From: Andrea Amorese Date: Wed, 9 Feb 2022 14:05:58 +0000 (+0100) Subject: Built motion from commit 022f8238.|2.6.1 X-Git-Url: http://repos.xcallymotion.com/base//%22angular-material.themes.css/%22?a=commitdiff_plain;h=078d8c6b57940c891cfbf8c81c23a8b4ed7b2100;p=motion2.git Built motion from commit 022f8238.|2.6.1 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index e0dbb3b..5defd42 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-02-09T10:06:57.411Z", + "time": "2022-02-09T13:58:38.476Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index f1369f4..09aa223 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-02-09T10:06:57.411Z", + "time": "2022-02-09T13:58:38.476Z", "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 66242d8..c02fe61 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 _0x9150=['urlForward[body]','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','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[headers],\x20browser[wsindowHeight]'];(function(_0xfdd294,_0x306d11){var _0x127d13=function(_0x3fe77c){while(--_0x3fe77c){_0xfdd294['push'](_0xfdd294['shift']());}};_0x127d13(++_0x306d11);}(_0x9150,0x81));var _0x0915=function(_0x98a01a,_0x2f927f){_0x98a01a=_0x98a01a-0x0;var _0x335240=_0x9150[_0x98a01a];return _0x335240;};'use strict';var Sequelize=require('sequelize');module[_0x0915('0x0')]={'name':{'type':Sequelize[_0x0915('0x1')],'get':function(_0x12e487){return this[_0x0915('0x2')](_0x0915('0x3'));}},'action':{'type':Sequelize[_0x0915('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0915('0x5'),_0x0915('0x6'),_0x0915('0x7'),'jscripty','urlForward','browser',_0x0915('0x8'),_0x0915('0x9')]],'msg':_0x0915('0xa')}},'comment':_0x0915('0xa')},'data1':{'type':Sequelize[_0x0915('0x4')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x0915('0x4')](0x1000),'comment':_0x0915('0xb')},'data3':{'type':Sequelize[_0x0915('0x4')](0x1000),'comment':_0x0915('0xc')},'data4':{'type':Sequelize[_0x0915('0x4')](0x1000),'comments':_0x0915('0xd')},'data5':{'type':Sequelize[_0x0915('0x4')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0x0915('0xe')},'data7':{'type':Sequelize['TEXT'],'comments':_0x0915('0xf')}}; \ No newline at end of file +var _0xabf0=['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]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','STRING','contactManager','motionbar','urlForward','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0xb88a0,_0x520839){var _0x37fe6c=function(_0x5f4396){while(--_0x5f4396){_0xb88a0['push'](_0xb88a0['shift']());}};_0x37fe6c(++_0x520839);}(_0xabf0,0x106));var _0x0abf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xabf0[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x0abf('0x0'));module[_0x0abf('0x1')]={'name':{'type':Sequelize[_0x0abf('0x2')],'get':function(_0xb23c50){return this[_0x0abf('0x3')]('action');}},'action':{'type':Sequelize[_0x0abf('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0abf('0x5'),'integration',_0x0abf('0x6'),'jscripty',_0x0abf('0x7'),'browser','bot',_0x0abf('0x8')]],'msg':_0x0abf('0x9')}},'comment':_0x0abf('0x9')},'data1':{'type':Sequelize[_0x0abf('0x4')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x0abf('0x4')](0x1000),'comment':_0x0abf('0xa')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x0abf('0xb')},'data4':{'type':Sequelize[_0x0abf('0x4')](0x1000),'comments':_0x0abf('0xc')},'data5':{'type':Sequelize[_0x0abf('0x4')](0x1000),'comments':_0x0abf('0xd')},'data6':{'type':Sequelize[_0x0abf('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x0abf('0xe')],'comments':_0x0abf('0xf')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 4356a2d..ed2d78c 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 _0x2abd=['send','body','Action','find','params','eml-format','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name'];(function(_0x46f7f0,_0x4ef418){var _0x783786=function(_0x1ad786){while(--_0x1ad786){_0x46f7f0['push'](_0x46f7f0['shift']());}};_0x783786(++_0x4ef418);}(_0x2abd,0x1de));var _0xd2ab=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2abd[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0xd2ab('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd2ab('0x1'));var util=require('util');var path=require(_0xd2ab('0x2'));var sox=require(_0xd2ab('0x3'));var csv=require(_0xd2ab('0x4'));var ejs=require(_0xd2ab('0x5'));var fs=require('fs');var fs_extra=require(_0xd2ab('0x6'));var _=require('lodash');var squel=require(_0xd2ab('0x7'));var crypto=require(_0xd2ab('0x8'));var jsforce=require(_0xd2ab('0x9'));var deskjs=require(_0xd2ab('0xa'));var toCsv=require(_0xd2ab('0x4'));var querystring=require(_0xd2ab('0xb'));var Papa=require(_0xd2ab('0xc'));var Redis=require(_0xd2ab('0xd'));var authService=require(_0xd2ab('0xe'));var qs=require(_0xd2ab('0xf'));var as=require(_0xd2ab('0x10'));var hardwareService=require(_0xd2ab('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xd2ab('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd2ab('0x13'));var db=require(_0xd2ab('0x14'))['db'];function respondWithStatusCode(_0x2549b1,_0x38a196){_0x38a196=_0x38a196||0xcc;return function(_0x54b880){if(_0x54b880){return _0x2549b1['sendStatus'](_0x38a196);}return _0x2549b1[_0xd2ab('0x15')](_0x38a196)['end']();};}function respondWithResult(_0x255c9a,_0x2ebda1){_0x2ebda1=_0x2ebda1||0xc8;return function(_0x1f97ab){if(_0x1f97ab){return _0x255c9a['status'](_0x2ebda1)[_0xd2ab('0x16')](_0x1f97ab);}};}function respondWithFilteredResult(_0xc29100,_0x450a4d){return function(_0x2e524c){if(_0x2e524c){var _0x5a2100=typeof _0x450a4d[_0xd2ab('0x17')]===_0xd2ab('0x18')&&typeof _0x450a4d[_0xd2ab('0x19')]===_0xd2ab('0x18');var _0x27d3b4=_0x2e524c[_0xd2ab('0x1a')];var _0x5dbc81=_0x5a2100?0x0:_0x450a4d[_0xd2ab('0x17')];var _0x2c5c88=_0x5a2100?_0x2e524c[_0xd2ab('0x1a')]:_0x450a4d[_0xd2ab('0x17')]+_0x450a4d[_0xd2ab('0x19')];var _0x3af627;if(_0x2c5c88>=_0x27d3b4){_0x2c5c88=_0x27d3b4;_0x3af627=0xc8;}else{_0x3af627=0xce;}_0xc29100[_0xd2ab('0x15')](_0x3af627);return _0xc29100[_0xd2ab('0x1b')](_0xd2ab('0x1c'),_0x5dbc81+'-'+_0x2c5c88+'/'+_0x27d3b4)['json'](_0x2e524c);}return null;};}function patchUpdates(_0x2f4a4d){return function(_0x173371){try{jsonpatch[_0xd2ab('0x1d')](_0x173371,_0x2f4a4d,!![]);}catch(_0x4366d5){return BPromise[_0xd2ab('0x1e')](_0x4366d5);}return _0x173371['save']();};}function saveUpdates(_0x3c103e,_0x5c8cbd){return function(_0x2a9f6e){if(_0x2a9f6e){return _0x2a9f6e[_0xd2ab('0x1f')](_0x3c103e)[_0xd2ab('0x20')](function(_0x1de87a){return _0x1de87a;});}return null;};}function removeEntity(_0x2d6e99,_0x5ede9f){return function(_0x13b669){if(_0x13b669){return _0x13b669[_0xd2ab('0x21')]()[_0xd2ab('0x20')](function(){_0x2d6e99[_0xd2ab('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdce10,_0x4d4ea2){return function(_0x256fdb){if(!_0x256fdb){_0xdce10[_0xd2ab('0x22')](0x194);}return _0x256fdb;};}function handleError(_0x356b3c,_0x3dbcd8){_0x3dbcd8=_0x3dbcd8||0x1f4;return function(_0x325839){logger[_0xd2ab('0x23')](_0x325839[_0xd2ab('0x24')]);if(_0x325839[_0xd2ab('0x25')]){delete _0x325839['name'];}_0x356b3c[_0xd2ab('0x15')](_0x3dbcd8)[_0xd2ab('0x26')](_0x325839);};}exports['update']=function(_0x3e34de,_0xc28875){if(_0x3e34de['body']['id']){delete _0x3e34de[_0xd2ab('0x27')]['id'];}return db[_0xd2ab('0x28')][_0xd2ab('0x29')]({'where':{'id':_0x3e34de[_0xd2ab('0x2a')]['id']}})[_0xd2ab('0x20')](handleEntityNotFound(_0xc28875,null))['then'](saveUpdates(_0x3e34de['body'],null))['then'](respondWithResult(_0xc28875,null))['catch'](handleError(_0xc28875,null));};exports[_0xd2ab('0x21')]=function(_0x8aea60,_0x107711){return db[_0xd2ab('0x28')][_0xd2ab('0x29')]({'where':{'id':_0x8aea60[_0xd2ab('0x2a')]['id']}})[_0xd2ab('0x20')](handleEntityNotFound(_0x107711,null))['then'](removeEntity(_0x107711,null))['catch'](handleError(_0x107711,null));}; \ No newline at end of file +var _0x5a81=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','then','error','name','body','Action','find','params','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x1c7e38,_0xbbaba6){var _0x4561af=function(_0x35e657){while(--_0x35e657){_0x1c7e38['push'](_0x1c7e38['shift']());}};_0x4561af(++_0xbbaba6);}(_0x5a81,0x193));var _0x15a8=function(_0x4df67d,_0x28f03f){_0x4df67d=_0x4df67d-0x0;var _0x1d3638=_0x5a81[_0x4df67d];return _0x1d3638;};'use strict';var emlformat=require(_0x15a8('0x0'));var rimraf=require(_0x15a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x15a8('0x2'));var rp=require(_0x15a8('0x3'));var moment=require(_0x15a8('0x4'));var BPromise=require(_0x15a8('0x5'));var Mustache=require(_0x15a8('0x6'));var util=require(_0x15a8('0x7'));var path=require('path');var sox=require(_0x15a8('0x8'));var csv=require(_0x15a8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15a8('0xa'));var squel=require(_0x15a8('0xb'));var crypto=require(_0x15a8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x15a8('0xd'));var toCsv=require(_0x15a8('0x9'));var querystring=require(_0x15a8('0xe'));var Papa=require(_0x15a8('0xf'));var Redis=require(_0x15a8('0x10'));var authService=require(_0x15a8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x15a8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x15a8('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x15a8('0x14'));var licenseUtil=require(_0x15a8('0x15'));var db=require(_0x15a8('0x16'))['db'];function respondWithStatusCode(_0x375431,_0x5b1abe){_0x5b1abe=_0x5b1abe||0xcc;return function(_0x12270a){if(_0x12270a){return _0x375431[_0x15a8('0x17')](_0x5b1abe);}return _0x375431[_0x15a8('0x18')](_0x5b1abe)[_0x15a8('0x19')]();};}function respondWithResult(_0x2263d9,_0x59a6ed){_0x59a6ed=_0x59a6ed||0xc8;return function(_0x33905e){if(_0x33905e){return _0x2263d9['status'](_0x59a6ed)[_0x15a8('0x1a')](_0x33905e);}};}function respondWithFilteredResult(_0x13e3f5,_0x3f275a){return function(_0x550183){if(_0x550183){var _0x515381=typeof _0x3f275a[_0x15a8('0x1b')]===_0x15a8('0x1c')&&typeof _0x3f275a[_0x15a8('0x1d')]===_0x15a8('0x1c');var _0xc193a5=_0x550183[_0x15a8('0x1e')];var _0x4e8eb4=_0x515381?0x0:_0x3f275a[_0x15a8('0x1b')];var _0x3e392d=_0x515381?_0x550183[_0x15a8('0x1e')]:_0x3f275a[_0x15a8('0x1b')]+_0x3f275a['limit'];var _0x2c8329;if(_0x3e392d>=_0xc193a5){_0x3e392d=_0xc193a5;_0x2c8329=0xc8;}else{_0x2c8329=0xce;}_0x13e3f5[_0x15a8('0x18')](_0x2c8329);return _0x13e3f5[_0x15a8('0x1f')](_0x15a8('0x20'),_0x4e8eb4+'-'+_0x3e392d+'/'+_0xc193a5)[_0x15a8('0x1a')](_0x550183);}return null;};}function patchUpdates(_0x3f66a9){return function(_0x2ed52c){try{jsonpatch['apply'](_0x2ed52c,_0x3f66a9,!![]);}catch(_0x496469){return BPromise['reject'](_0x496469);}return _0x2ed52c['save']();};}function saveUpdates(_0x3e4ae2,_0x553fe1){return function(_0x19655e){if(_0x19655e){return _0x19655e['update'](_0x3e4ae2)['then'](function(_0x413ae1){return _0x413ae1;});}return null;};}function removeEntity(_0x420b18,_0x1cc5af){return function(_0x4b7d5f){if(_0x4b7d5f){return _0x4b7d5f[_0x15a8('0x21')]()[_0x15a8('0x22')](function(){_0x420b18[_0x15a8('0x18')](0xcc)[_0x15a8('0x19')]();});}};}function handleEntityNotFound(_0x8e831c,_0xde3948){return function(_0x32fda4){if(!_0x32fda4){_0x8e831c[_0x15a8('0x17')](0x194);}return _0x32fda4;};}function handleError(_0x51df17,_0x25351f){_0x25351f=_0x25351f||0x1f4;return function(_0x24fb92){logger[_0x15a8('0x23')](_0x24fb92['stack']);if(_0x24fb92[_0x15a8('0x24')]){delete _0x24fb92[_0x15a8('0x24')];}_0x51df17[_0x15a8('0x18')](_0x25351f)['send'](_0x24fb92);};}exports['update']=function(_0x3dde14,_0xb1be73){if(_0x3dde14[_0x15a8('0x25')]['id']){delete _0x3dde14[_0x15a8('0x25')]['id'];}return db[_0x15a8('0x26')][_0x15a8('0x27')]({'where':{'id':_0x3dde14[_0x15a8('0x28')]['id']}})[_0x15a8('0x22')](handleEntityNotFound(_0xb1be73,null))[_0x15a8('0x22')](saveUpdates(_0x3dde14[_0x15a8('0x25')],null))['then'](respondWithResult(_0xb1be73,null))[_0x15a8('0x29')](handleError(_0xb1be73,null));};exports['destroy']=function(_0x41509f,_0x152808){return db[_0x15a8('0x26')][_0x15a8('0x27')]({'where':{'id':_0x41509f[_0x15a8('0x28')]['id']}})[_0x15a8('0x22')](handleEntityNotFound(_0x152808,null))[_0x15a8('0x22')](removeEntity(_0x152808,null))[_0x15a8('0x29')](handleError(_0x152808,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 94641b5..8fe3cb6 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 _0xe43f=['./action.attributes','exports','define','Action','tools_actions','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x18977b,_0x45d724){var _0x3ab2d1=function(_0x4fcafb){while(--_0x4fcafb){_0x18977b['push'](_0x18977b['shift']());}};_0x3ab2d1(++_0x45d724);}(_0xe43f,0x83));var _0xfe43=function(_0x43186d,_0x4b40ec){_0x43186d=_0x43186d-0x0;var _0x5f562c=_0xe43f[_0x43186d];return _0x5f562c;};'use strict';var _=require(_0xfe43('0x0'));var util=require(_0xfe43('0x1'));var logger=require('../../config/logger')(_0xfe43('0x2'));var moment=require(_0xfe43('0x3'));var BPromise=require(_0xfe43('0x4'));var rp=require(_0xfe43('0x5'));var fs=require('fs');var path=require(_0xfe43('0x6'));var rimraf=require(_0xfe43('0x7'));var config=require(_0xfe43('0x8'));var attributes=require(_0xfe43('0x9'));module[_0xfe43('0xa')]=function(_0x555e91,_0x23a7d5){return _0x555e91[_0xfe43('0xb')](_0xfe43('0xc'),attributes,{'tableName':_0xfe43('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbac0=['moment','bluebird','request-promise','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','../../config/logger','api'];(function(_0x3c3ced,_0x5bb983){var _0x3e222e=function(_0x26d440){while(--_0x26d440){_0x3c3ced['push'](_0x3c3ced['shift']());}};_0x3e222e(++_0x5bb983);}(_0xbac0,0x8c));var _0x0bac=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0xbac0[_0x2c1dcd];return _0x158ce5;};'use strict';var _=require(_0x0bac('0x0'));var util=require('util');var logger=require(_0x0bac('0x1'))(_0x0bac('0x2'));var moment=require(_0x0bac('0x3'));var BPromise=require(_0x0bac('0x4'));var rp=require(_0x0bac('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0bac('0x6'));var config=require(_0x0bac('0x7'));var attributes=require(_0x0bac('0x8'));module[_0x0bac('0x9')]=function(_0x19619c,_0x4654e9){return _0x19619c[_0x0bac('0xa')](_0x0bac('0xb'),attributes,{'tableName':_0x0bac('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 dfa7e2d..4acf6cf 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x250f50,_0x1546e2){var _0x1e354d=function(_0x5c1e7d){while(--_0x5c1e7d){_0x250f50['push'](_0x250f50['shift']());}};_0x1e354d(++_0x1546e2);}(_0xe14b,0x93));var _0xbe14=function(_0x5019ac,_0x34abba){_0x5019ac=_0x5019ac-0x0;var _0x14a9f9=_0xe14b[_0x5019ac];return _0x14a9f9;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x247eb0,_0x2539f0){var _0x3717d0=function(_0x5a1adc){while(--_0x5a1adc){_0x247eb0['push'](_0x247eb0['shift']());}};_0x3717d0(++_0x2539f0);}(_0xe14b,0x93));var _0xbe14=function(_0x4cbf07,_0x58b2af){_0x4cbf07=_0x4cbf07-0x0;var _0x30eaa6=_0xe14b[_0x4cbf07];return _0x30eaa6;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 312559e..423c1f5 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 _0x78a2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x282a2e,_0x22c5e7){var _0x1b352b=function(_0xf3e4ab){while(--_0xf3e4ab){_0x282a2e['push'](_0x282a2e['shift']());}};_0x1b352b(++_0x22c5e7);}(_0x78a2,0x17a));var _0x278a=function(_0x6b1fc8,_0x27d951){_0x6b1fc8=_0x6b1fc8-0x0;var _0x4e63af=_0x78a2[_0x6b1fc8];return _0x4e63af;};'use strict';var multer=require(_0x278a('0x0'));var util=require(_0x278a('0x1'));var path=require(_0x278a('0x2'));var timeout=require('connect-timeout');var express=require(_0x278a('0x3'));var router=express[_0x278a('0x4')]();var fs_extra=require(_0x278a('0x5'));var auth=require(_0x278a('0x6'));var interaction=require(_0x278a('0x7'));var config=require(_0x278a('0x8'));var controller=require(_0x278a('0x9'));router[_0x278a('0xa')](_0x278a('0xb'),auth['isAuthenticated'](),controller[_0x278a('0xc')]);router[_0x278a('0xd')](_0x278a('0xb'),auth['isAuthenticated'](),controller[_0x278a('0xe')]);module[_0x278a('0xf')]=router; \ No newline at end of file +var _0x0df5=['delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update'];(function(_0x281e5e,_0xf320e2){var _0x5a22d2=function(_0x405ff9){while(--_0x405ff9){_0x281e5e['push'](_0x281e5e['shift']());}};_0x5a22d2(++_0xf320e2);}(_0x0df5,0x114));var _0x50df=function(_0x15b3de,_0x20af35){_0x15b3de=_0x15b3de-0x0;var _0x392c15=_0x0df5[_0x15b3de];return _0x392c15;};'use strict';var multer=require(_0x50df('0x0'));var util=require('util');var path=require(_0x50df('0x1'));var timeout=require(_0x50df('0x2'));var express=require(_0x50df('0x3'));var router=express[_0x50df('0x4')]();var fs_extra=require(_0x50df('0x5'));var auth=require(_0x50df('0x6'));var interaction=require(_0x50df('0x7'));var config=require(_0x50df('0x8'));var controller=require(_0x50df('0x9'));router[_0x50df('0xa')]('/:id',auth[_0x50df('0xb')](),controller[_0x50df('0xc')]);router[_0x50df('0xd')](_0x50df('0xe'),auth[_0x50df('0xb')](),controller[_0x50df('0xf')]);module[_0x50df('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index b530978..f7ede2b 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 _0x9c5a=['exports','STRING','TEXT','sequelize'];(function(_0x4ecb79,_0x139206){var _0x5c9b98=function(_0xf1be2f){while(--_0xf1be2f){_0x4ecb79['push'](_0x4ecb79['shift']());}};_0x5c9b98(++_0x139206);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x1b1388,_0x1ae642){_0x1b1388=_0x1b1388-0x0;var _0x5b1196=_0x9c5a[_0x1b1388];return _0x5b1196;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa9c5('0x2')]},'parent':{'type':Sequelize[_0xa9c5('0x2')]},'table':{'type':Sequelize[_0xa9c5('0x2')]},'conditions':{'type':Sequelize[_0xa9c5('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x6aa7=['TEXT','sequelize','STRING'];(function(_0x2abd13,_0x501317){var _0x5ad645=function(_0x55ae11){while(--_0x55ae11){_0x2abd13['push'](_0x2abd13['shift']());}};_0x5ad645(++_0x501317);}(_0x6aa7,0x178));var _0x76aa=function(_0xc48493,_0x234a6b){_0xc48493=_0xc48493-0x0;var _0x3fa29e=_0x6aa7[_0xc48493];return _0x3fa29e;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x76aa('0x1')]},'parent':{'type':Sequelize[_0x76aa('0x1')]},'table':{'type':Sequelize[_0x76aa('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x76aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index c797675..3759b5e 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 _0xcdda=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','left_join','right_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)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','cross_join','IS\x20NOT\x20EMPTY','operator','condition','groupBy','clone','output','web','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','ValidationErrorItem','debug','eml-format','zip-dir','request-promise','mustache','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcdda,0xa3));var _0xacdd=function(_0x373b37,_0x201bbf){_0x373b37=_0x373b37-0x0;var _0x144a38=_0xcdda[_0x373b37];return _0x144a38;};'use strict';var emlformat=require(_0xacdd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xacdd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xacdd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xacdd('0x3'));var util=require(_0xacdd('0x4'));var path=require(_0xacdd('0x5'));var sox=require(_0xacdd('0x6'));var csv=require(_0xacdd('0x7'));var ejs=require(_0xacdd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xacdd('0x9'));var squel=require(_0xacdd('0xa'));var crypto=require(_0xacdd('0xb'));var jsforce=require(_0xacdd('0xc'));var deskjs=require(_0xacdd('0xd'));var toCsv=require(_0xacdd('0x7'));var querystring=require(_0xacdd('0xe'));var Papa=require(_0xacdd('0xf'));var Redis=require(_0xacdd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xacdd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacdd('0x12'));var logger=require(_0xacdd('0x13'))(_0xacdd('0x14'));var utils=require(_0xacdd('0x15'));var config=require(_0xacdd('0x16'));var licenseUtil=require(_0xacdd('0x17'));var db=require(_0xacdd('0x18'))['db'];var dbH=require(_0xacdd('0x18'))['dbH'];function respondWithStatusCode(_0x25ed6,_0x27cf13){_0x27cf13=_0x27cf13||0xcc;return function(_0x876120){if(_0x876120){return _0x25ed6['sendStatus'](_0x27cf13);}return _0x25ed6[_0xacdd('0x19')](_0x27cf13)[_0xacdd('0x1a')]();};}function respondWithResult(_0x4ae6ea,_0x336a85){_0x336a85=_0x336a85||0xc8;return function(_0x19fc6a){if(_0x19fc6a){return _0x4ae6ea[_0xacdd('0x19')](_0x336a85)[_0xacdd('0x1b')](_0x19fc6a);}};}function respondWithFilteredResult(_0x560ec3,_0xfce27){return function(_0x2549ee){if(_0x2549ee){var _0x4a5ee7=typeof _0xfce27[_0xacdd('0x1c')]===_0xacdd('0x1d')&&typeof _0xfce27[_0xacdd('0x1e')]==='undefined';var _0x48357e=_0x2549ee[_0xacdd('0x1f')];var _0x456be9=_0x4a5ee7?0x0:_0xfce27[_0xacdd('0x1c')];var _0x27cee0=_0x4a5ee7?_0x2549ee[_0xacdd('0x1f')]:_0xfce27[_0xacdd('0x1c')]+_0xfce27[_0xacdd('0x1e')];var _0x23e28f;if(_0x27cee0>=_0x48357e){_0x27cee0=_0x48357e;_0x23e28f=0xc8;}else{_0x23e28f=0xce;}_0x560ec3[_0xacdd('0x19')](_0x23e28f);return _0x560ec3['set'](_0xacdd('0x20'),_0x456be9+'-'+_0x27cee0+'/'+_0x48357e)[_0xacdd('0x1b')](_0x2549ee);}return null;};}function patchUpdates(_0x1e9f96){return function(_0xd4a529){try{jsonpatch[_0xacdd('0x21')](_0xd4a529,_0x1e9f96,!![]);}catch(_0x1d9ca6){return BPromise[_0xacdd('0x22')](_0x1d9ca6);}return _0xd4a529['save']();};}function saveUpdates(_0x12c411,_0x9d5075){return function(_0x1757c0){if(_0x1757c0){return _0x1757c0[_0xacdd('0x23')](_0x12c411)[_0xacdd('0x24')](function(_0x44007b){return _0x44007b;});}return null;};}function removeEntity(_0x403b26,_0x5c2856){return function(_0x1c96b7){if(_0x1c96b7){return _0x1c96b7[_0xacdd('0x25')]()[_0xacdd('0x24')](function(){var _0x2112e8=_0x1c96b7[_0xacdd('0x26')]({'plain':!![]});var _0x58b7b5='CustomReports';return db['UserProfileResource'][_0xacdd('0x25')]({'where':{'type':_0x58b7b5,'resourceId':_0x2112e8['id']}})[_0xacdd('0x24')](function(){return _0x1c96b7;});})['then'](function(){_0x403b26[_0xacdd('0x19')](0xcc)[_0xacdd('0x1a')]();});}};}function handleEntityNotFound(_0x1cac27,_0x3bb065){return function(_0x5f41a6){if(!_0x5f41a6){_0x1cac27['sendStatus'](0x194);}return _0x5f41a6;};}function handleError(_0x56d85f,_0x5d944a){_0x5d944a=_0x5d944a||0x1f4;return function(_0x45ab8f){logger[_0xacdd('0x27')](_0x45ab8f[_0xacdd('0x28')]);if(_0x45ab8f[_0xacdd('0x29')]){delete _0x45ab8f[_0xacdd('0x29')];}_0x56d85f[_0xacdd('0x19')](_0x5d944a)[_0xacdd('0x2a')](_0x45ab8f);};}exports[_0xacdd('0x2b')]=function(_0x2061e3,_0x352d9f){var _0x404e52={},_0xab76b9={},_0x415676={'count':0x0,'rows':[]};var _0x472386=_[_0xacdd('0x2c')](db[_0xacdd('0x2d')][_0xacdd('0x2e')],function(_0x4319b5){return{'name':_0x4319b5['fieldName'],'type':_0x4319b5['type'][_0xacdd('0x2f')]};});_0xab76b9[_0xacdd('0x30')]=_[_0xacdd('0x2c')](_0x472386,_0xacdd('0x29'));_0xab76b9[_0xacdd('0x31')]=_[_0xacdd('0x32')](_0x2061e3[_0xacdd('0x31')]);_0xab76b9[_0xacdd('0x33')]=_[_0xacdd('0x34')](_0xab76b9[_0xacdd('0x30')],_0xab76b9[_0xacdd('0x31')]);_0x404e52[_0xacdd('0x35')]=_[_0xacdd('0x34')](_0xab76b9[_0xacdd('0x30')],qs[_0xacdd('0x36')](_0x2061e3['query'][_0xacdd('0x36')]));_0x404e52[_0xacdd('0x35')]=_0x404e52[_0xacdd('0x35')][_0xacdd('0x37')]?_0x404e52[_0xacdd('0x35')]:_0xab76b9[_0xacdd('0x30')];if(!_0x2061e3['query'][_0xacdd('0x38')](_0xacdd('0x39'))){_0x404e52[_0xacdd('0x1e')]=qs[_0xacdd('0x1e')](_0x2061e3[_0xacdd('0x31')][_0xacdd('0x1e')]);_0x404e52[_0xacdd('0x1c')]=qs['offset'](_0x2061e3[_0xacdd('0x31')][_0xacdd('0x1c')]);}_0x404e52[_0xacdd('0x3a')]=qs[_0xacdd('0x3b')](_0x2061e3['query'][_0xacdd('0x3b')]);_0x404e52[_0xacdd('0x3c')]=qs['filters'](_[_0xacdd('0x3d')](_0x2061e3[_0xacdd('0x31')],_0xab76b9['filters']),_0x472386);if(_0x2061e3[_0xacdd('0x31')][_0xacdd('0x3e')]){_0x404e52['where']=_[_0xacdd('0x3f')](_0x404e52[_0xacdd('0x3c')],{'$or':_[_0xacdd('0x2c')](_0x472386,function(_0x282dd3){if(_0x282dd3[_0xacdd('0x40')]!==_0xacdd('0x41')){var _0x5908c1={};_0x5908c1[_0x282dd3[_0xacdd('0x29')]]={'$like':'%'+_0x2061e3[_0xacdd('0x31')][_0xacdd('0x3e')]+'%'};return _0x5908c1;}})});}_0x404e52=_['merge']({},_0x404e52,_0x2061e3['options']);var _0x55d0ce={'where':_0x404e52[_0xacdd('0x3c')]};return db['AnalyticCustomReport'][_0xacdd('0x1f')](_0x55d0ce)[_0xacdd('0x24')](function(_0x379d59){_0x415676[_0xacdd('0x1f')]=_0x379d59;if(_0x2061e3[_0xacdd('0x31')]['includeAll']){_0x404e52[_0xacdd('0x42')]=[{'all':!![]}];}return db[_0xacdd('0x2d')][_0xacdd('0x43')](_0x404e52);})['then'](function(_0x1610a3){_0x415676[_0xacdd('0x44')]=_0x1610a3;return _0x415676;})[_0xacdd('0x24')](respondWithFilteredResult(_0x352d9f,_0x404e52))['catch'](handleError(_0x352d9f,null));};exports[_0xacdd('0x45')]=function(_0x9d2a74,_0x1e423e){var _0x138e1c={'raw':![],'where':{'id':_0x9d2a74[_0xacdd('0x46')]['id']}},_0x2cc273={};_0x2cc273[_0xacdd('0x30')]=_[_0xacdd('0x32')](db['AnalyticCustomReport'][_0xacdd('0x2e')]);_0x2cc273['query']=_['keys'](_0x9d2a74['query']);_0x2cc273[_0xacdd('0x33')]=_[_0xacdd('0x34')](_0x2cc273[_0xacdd('0x30')],_0x2cc273[_0xacdd('0x31')]);_0x138e1c[_0xacdd('0x35')]=_['intersection'](_0x2cc273[_0xacdd('0x30')],qs[_0xacdd('0x36')](_0x9d2a74[_0xacdd('0x31')][_0xacdd('0x36')]));_0x138e1c[_0xacdd('0x35')]=_0x138e1c['attributes'][_0xacdd('0x37')]?_0x138e1c[_0xacdd('0x35')]:_0x2cc273[_0xacdd('0x30')];if(_0x9d2a74[_0xacdd('0x31')][_0xacdd('0x47')]){_0x138e1c[_0xacdd('0x42')]=[{'all':!![]}];}_0x138e1c=_[_0xacdd('0x3f')]({},_0x138e1c,_0x9d2a74[_0xacdd('0x48')]);return db[_0xacdd('0x2d')][_0xacdd('0x49')](_0x138e1c)[_0xacdd('0x24')](handleEntityNotFound(_0x1e423e,null))[_0xacdd('0x24')](respondWithResult(_0x1e423e,null))[_0xacdd('0x4a')](handleError(_0x1e423e,null));};exports[_0xacdd('0x4b')]=function(_0x5e995e,_0x40de76){return db[_0xacdd('0x2d')][_0xacdd('0x4b')](_0x5e995e['body'],{})[_0xacdd('0x24')](function(_0x1eb913){var _0x18348e=_0x5e995e[_0xacdd('0x4c')]['get']({'plain':!![]});if(!_0x18348e)throw new Error(_0xacdd('0x4d'));if(_0x18348e[_0xacdd('0x4e')]==='user'){var _0x2d8ceb=_0x1eb913[_0xacdd('0x26')]({'plain':!![]});var _0x2f0d2a=_0xacdd('0x4f');return db['UserProfileSection'][_0xacdd('0x49')]({'where':{'name':_0x2f0d2a,'userProfileId':_0x18348e[_0xacdd('0x50')]},'raw':!![]})['then'](function(_0x363cc5){if(_0x363cc5&&_0x363cc5[_0xacdd('0x51')]===0x0){return db[_0xacdd('0x52')][_0xacdd('0x4b')]({'name':_0x2d8ceb[_0xacdd('0x29')],'resourceId':_0x2d8ceb['id'],'type':'CustomReports','sectionId':_0x363cc5['id']},{})[_0xacdd('0x24')](function(){return _0x1eb913;});}else{return _0x1eb913;}})['catch'](function(_0x3a4c17){logger[_0xacdd('0x27')](_0xacdd('0x53'),_0x3a4c17);throw _0x3a4c17;});}return _0x1eb913;})[_0xacdd('0x24')](respondWithResult(_0x40de76,0xc9))[_0xacdd('0x4a')](handleError(_0x40de76,null));};exports['update']=function(_0x39cd9a,_0x10aad5){if(_0x39cd9a[_0xacdd('0x54')]['id']){delete _0x39cd9a['body']['id'];}return db['AnalyticCustomReport'][_0xacdd('0x49')]({'where':{'id':_0x39cd9a[_0xacdd('0x46')]['id']}})[_0xacdd('0x24')](handleEntityNotFound(_0x10aad5,null))[_0xacdd('0x24')](saveUpdates(_0x39cd9a[_0xacdd('0x54')],null))[_0xacdd('0x24')](respondWithResult(_0x10aad5,null))[_0xacdd('0x4a')](handleError(_0x10aad5,null));};exports[_0xacdd('0x25')]=function(_0x328caf,_0x30cbb4){return db[_0xacdd('0x2d')]['find']({'where':{'id':_0x328caf['params']['id']}})[_0xacdd('0x24')](handleEntityNotFound(_0x30cbb4,null))[_0xacdd('0x24')](removeEntity(_0x30cbb4,null))[_0xacdd('0x4a')](handleError(_0x30cbb4,null));};exports[_0xacdd('0x55')]=function(_0x6543c4,_0x14654e){var _0x15f317=0xa;var _0x81ebb7=['join',_0xacdd('0x56'),_0xacdd('0x57'),'cross_join'];var _0x462214={'SUM':_0xacdd('0x58'),'COUNT':_0xacdd('0x59'),'COUNT DISTINCT':_0xacdd('0x5a'),'MAX':_0xacdd('0x5b'),'MIN':_0xacdd('0x5c'),'AVG':_0xacdd('0x5d'),'GROUP_CONCAT':_0xacdd('0x5e'),'GROUP_CONCAT ASC':_0xacdd('0x5f'),'GROUP_CONCAT DESC':_0xacdd('0x60')};var _0xfb0abe={'SEC_TO_TIME':_0xacdd('0x61'),'DATE':_0xacdd('0x62'),'HOUR':_0xacdd('0x63'),'ROUND':_0xacdd('0x64'),'UNIX_TIMESTAMP':_0xacdd('0x65')};var _0xc8e833=function(_0x1afbde){return!_[_0xacdd('0x66')]([_0xacdd('0x67'),_0xacdd('0x68'),_0xacdd('0x69'),'IS\x20NOT\x20EMPTY'],_0x1afbde);};var _0x2128e1=function(_0x18df0a){if(!_0x18df0a||!_0x18df0a[_0xacdd('0x6a')][_0xacdd('0x37')]){return'';}for(var _0xe2f13='(',_0x28933f=0x0;_0x28933f<_0x18df0a[_0xacdd('0x6a')][_0xacdd('0x37')];_0x28933f+=0x1){_0x28933f>0x0&&(_0xe2f13+='\x20'+_0x18df0a['operator']+'\x20');_0xe2f13+=_0x18df0a[_0xacdd('0x6a')][_0x28933f][_0xacdd('0x6b')]?_0x2128e1(_0x18df0a['rules'][_0x28933f]['group']):_0x18df0a[_0xacdd('0x6a')][_0x28933f][_0xacdd('0x6c')]+'\x20'+_0x18df0a[_0xacdd('0x6a')][_0x28933f]['condition']+(_0xc8e833(_0x18df0a['rules'][_0x28933f]['condition'])?'\x20'+_0x18df0a['rules'][_0x28933f][_0xacdd('0x6d')]:'');}return _0xe2f13+')';};var _0x28e72e={'where':{'id':_0x6543c4[_0xacdd('0x46')]['id']}},_0x2fd376,_0x13f103,_0x431470,_0x1286f1,_0x49541e;_0x28e72e=_['merge']({},_0x28e72e,_0x6543c4[_0xacdd('0x48')]);return db[_0xacdd('0x2d')][_0xacdd('0x49')](_0x28e72e)['then'](function(_0x303050){if(_0x303050){_0x2fd376=_0x303050;return _0x303050[_0xacdd('0x6e')]();}return null;})['then'](function(_0x779bdc){if(_0x779bdc){if(!_0x779bdc[_0xacdd('0x37')]){throw new db[(_0xacdd('0x6f'))]['ValidationErrorItem'](_0xacdd('0x70'),0x193);}_0x13f103=_0x779bdc;return db[_0xacdd('0x71')][_0xacdd('0x43')]({'raw':!![]});}return null;})[_0xacdd('0x24')](function(_0x7b6f10){if(_0x7b6f10){_0x431470=_[_0xacdd('0x72')](_0x7b6f10,'id');var _0x30356f;var _0x25716a=squel[_0xacdd('0x73')]();_0x25716a[_0xacdd('0x74')](_0x2fd376['table']);for(var _0x3f7414=0x0;_0x3f7414<_0x13f103['length'];_0x3f7414+=0x1){_0x30356f=_0x13f103[_0x3f7414][_0xacdd('0x75')]?_0x431470[_0x13f103[_0x3f7414]['MetricId']][_0xacdd('0x76')]:_0x13f103[_0x3f7414][_0xacdd('0x6c')];_0x30356f=_0x13f103[_0x3f7414][_0xacdd('0x77')]?_[_0xacdd('0x78')](_0x462214[_0x13f103[_0x3f7414]['function']],'%s',_0x30356f):_0x30356f;_0x30356f=_0x13f103[_0x3f7414][_0xacdd('0x79')]?_['replace'](_0xfb0abe[_0x13f103[_0x3f7414][_0xacdd('0x79')]],'%s',_0x30356f):_0x30356f;if(_0x13f103[_0x3f7414]['groupBy']){_0x25716a[_0xacdd('0x6b')](_0x30356f);}_0x13f103[_0x3f7414][_0xacdd('0x7a')]&&_0x25716a[_0xacdd('0x3a')](_0x30356f,_0x13f103[_0x3f7414]['orderBy']===_0xacdd('0x7b')?![]:!![]);_0x25716a[_0xacdd('0x6c')](_0x30356f,_0x13f103[_0x3f7414][_0xacdd('0x7c')]||_0x30356f);}if(_0x2fd376[_0xacdd('0x7d')]){_0x2fd376[_0xacdd('0x7d')]=JSON[_0xacdd('0x7e')](_0x2fd376[_0xacdd('0x7d')]);for(var _0x382aff=0x0;_0x382aff<_0x2fd376['joins'][_0xacdd('0x37')];_0x382aff+=0x1){if(_0x2fd376[_0xacdd('0x7d')][_0x382aff][_0xacdd('0x40')]&&_[_0xacdd('0x66')](_0x81ebb7,_0x2fd376[_0xacdd('0x7d')][_0x382aff][_0xacdd('0x40')])&&_0x2fd376[_0xacdd('0x7d')][_0x382aff][_0xacdd('0x7f')]&&_0x2fd376['joins'][_0x382aff][_0xacdd('0x80')]&&_0x2fd376[_0xacdd('0x7d')][_0x382aff][_0xacdd('0x81')]){_0x25716a[_0x2fd376[_0xacdd('0x7d')][_0x382aff][_0xacdd('0x40')]](_0x2fd376[_0xacdd('0x7d')][_0x382aff]['foreignTable'],null,util[_0xacdd('0x79')](_0xacdd('0x82'),_0x2fd376[_0xacdd('0x83')],_0x2fd376['joins'][_0x382aff]['parentKey'],_0x2fd376[_0xacdd('0x7d')][_0x382aff][_0xacdd('0x80')],_0x2fd376['joins'][_0x382aff]['foreignKey']));}}}if(_0x2fd376[_0xacdd('0x84')]){_0x2fd376[_0xacdd('0x84')]=JSON[_0xacdd('0x7e')](_0x2fd376[_0xacdd('0x84')]);_0x25716a[_0xacdd('0x3c')](_0x2128e1(_0x2fd376[_0xacdd('0x84')]['group']));}_0x49541e=_0x25716a['clone']();_0x25716a[_0xacdd('0x1e')](_0x15f317);_0x25716a[_0xacdd('0x1c')](0x0);logger['debug'](_0xacdd('0x85'),_0x25716a[_0xacdd('0x86')]());return dbH[_0xacdd('0x87')][_0xacdd('0x31')](_0x25716a[_0xacdd('0x86')](),{'type':dbH[_0xacdd('0x87')][_0xacdd('0x88')][_0xacdd('0x89')]});}})['then'](respondWithResult(_0x14654e,null))['catch'](handleError(_0x14654e,null));};function runReport(_0x577517,_0x361fc9,_0x22caf3){var _0x3b8135=_0x361fc9['name'];var _0x12f20b=0xa;var _0x2604e3=[_0xacdd('0x8a'),_0xacdd('0x56'),_0xacdd('0x57'),_0xacdd('0x8b')];var _0x2219f9={'SUM':'SUM(%s)','COUNT':_0xacdd('0x59'),'COUNT DISTINCT':_0xacdd('0x5a'),'MAX':_0xacdd('0x5b'),'MIN':_0xacdd('0x5c'),'AVG':_0xacdd('0x5d'),'GROUP_CONCAT':_0xacdd('0x5e'),'GROUP_CONCAT ASC':_0xacdd('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3e8df1={'SEC_TO_TIME':_0xacdd('0x61'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xacdd('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3cd451=function(_0x2f2b35){return!_['includes']([_0xacdd('0x67'),_0xacdd('0x68'),_0xacdd('0x69'),_0xacdd('0x8c')],_0x2f2b35);};var _0x6618e5=function(_0x253ee2){if(!_0x253ee2||!_0x253ee2[_0xacdd('0x6a')][_0xacdd('0x37')]){return'';}for(var _0x5eb585='(',_0x17176d=0x0;_0x17176d<_0x253ee2[_0xacdd('0x6a')][_0xacdd('0x37')];_0x17176d+=0x1){_0x17176d>0x0&&(_0x5eb585+='\x20'+_0x253ee2[_0xacdd('0x8d')]+'\x20');_0x5eb585+=_0x253ee2[_0xacdd('0x6a')][_0x17176d][_0xacdd('0x6b')]?_0x6618e5(_0x253ee2[_0xacdd('0x6a')][_0x17176d][_0xacdd('0x6b')]):_0x253ee2[_0xacdd('0x6a')][_0x17176d][_0xacdd('0x6c')]+'\x20'+_0x253ee2[_0xacdd('0x6a')][_0x17176d][_0xacdd('0x8e')]+(_0x3cd451(_0x253ee2[_0xacdd('0x6a')][_0x17176d][_0xacdd('0x8e')])?'\x20'+_0x253ee2['rules'][_0x17176d]['value']:'');}return _0x5eb585+')';};var _0x930f74={'where':{'id':_0x577517['id']}},_0x10d964,_0x1058d8,_0x1b8835,_0x6c907b,_0x1ef912;_0x930f74=_['merge']({},_0x930f74,_0x22caf3);return db['AnalyticCustomReport']['find'](_0x930f74)['then'](function(_0x3d8d78){if(_0x3d8d78){_0x10d964=_0x3d8d78;return _0x3d8d78[_0xacdd('0x6e')]();}return null;})[_0xacdd('0x24')](function(_0x25a373){if(_0x25a373){if(!_0x25a373[_0xacdd('0x37')]){throw new db[(_0xacdd('0x6f'))]['ValidationErrorItem'](_0xacdd('0x70'),0x193);}_0x1058d8=_0x25a373;return db[_0xacdd('0x71')][_0xacdd('0x43')]({'raw':!![]});}return null;})[_0xacdd('0x24')](function(_0x24cdd0){if(_0x24cdd0){_0x1b8835=_[_0xacdd('0x72')](_0x24cdd0,'id');var _0x4b33d8;var _0x291cf1=squel[_0xacdd('0x73')]();_0x291cf1[_0xacdd('0x74')](_0x10d964['table']);for(var _0x188638=0x0;_0x188638<_0x1058d8[_0xacdd('0x37')];_0x188638+=0x1){_0x4b33d8=_0x1058d8[_0x188638]['MetricId']?_0x1b8835[_0x1058d8[_0x188638][_0xacdd('0x75')]]['metric']:_0x1058d8[_0x188638][_0xacdd('0x6c')];_0x4b33d8=_0x1058d8[_0x188638][_0xacdd('0x77')]?_[_0xacdd('0x78')](_0x2219f9[_0x1058d8[_0x188638]['function']],'%s',_0x4b33d8):_0x4b33d8;_0x4b33d8=_0x1058d8[_0x188638][_0xacdd('0x79')]?_[_0xacdd('0x78')](_0x3e8df1[_0x1058d8[_0x188638][_0xacdd('0x79')]],'%s',_0x4b33d8):_0x4b33d8;if(_0x1058d8[_0x188638][_0xacdd('0x8f')]){_0x291cf1[_0xacdd('0x6b')](_0x4b33d8);}_0x1058d8[_0x188638][_0xacdd('0x7a')]&&_0x291cf1[_0xacdd('0x3a')](_0x4b33d8,_0x1058d8[_0x188638]['orderBy']===_0xacdd('0x7b')?![]:!![]);_0x291cf1['field'](_0x4b33d8,_0x1058d8[_0x188638]['alias']||_0x4b33d8);}if(_0x10d964[_0xacdd('0x7d')]){_0x10d964[_0xacdd('0x7d')]=JSON[_0xacdd('0x7e')](_0x10d964[_0xacdd('0x7d')]);for(var _0x16cdf8=0x0;_0x16cdf8<_0x10d964[_0xacdd('0x7d')][_0xacdd('0x37')];_0x16cdf8+=0x1){if(_0x10d964[_0xacdd('0x7d')][_0x16cdf8][_0xacdd('0x40')]&&_[_0xacdd('0x66')](_0x2604e3,_0x10d964[_0xacdd('0x7d')][_0x16cdf8][_0xacdd('0x40')])&&_0x10d964['joins'][_0x16cdf8][_0xacdd('0x7f')]&&_0x10d964[_0xacdd('0x7d')][_0x16cdf8][_0xacdd('0x80')]&&_0x10d964[_0xacdd('0x7d')][_0x16cdf8][_0xacdd('0x81')]){_0x291cf1[_0x10d964[_0xacdd('0x7d')][_0x16cdf8][_0xacdd('0x40')]](_0x10d964[_0xacdd('0x7d')][_0x16cdf8][_0xacdd('0x80')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x10d964[_0xacdd('0x83')],_0x10d964[_0xacdd('0x7d')][_0x16cdf8][_0xacdd('0x7f')],_0x10d964[_0xacdd('0x7d')][_0x16cdf8][_0xacdd('0x80')],_0x10d964[_0xacdd('0x7d')][_0x16cdf8]['foreignKey']));}}}if(_0x10d964[_0xacdd('0x84')]){_0x10d964[_0xacdd('0x84')]=JSON[_0xacdd('0x7e')](_0x10d964[_0xacdd('0x84')]);_0x291cf1[_0xacdd('0x3c')](_0x6618e5(_0x10d964[_0xacdd('0x84')]['group']));}_0x1ef912=_0x291cf1[_0xacdd('0x90')]();_0x291cf1[_0xacdd('0x1e')](_0x12f20b);_0x291cf1['offset'](0x0);return;}})[_0xacdd('0x24')](function(){if(_0x361fc9[_0xacdd('0x91')]===_0xacdd('0x92')){return null;}var _0x3a428e=_[_0xacdd('0x3f')](_0x361fc9,{'name':_0x361fc9['fullPath']||_0x361fc9[_0xacdd('0x29')]||_0x10d964[_0xacdd('0x29')],'basename':_0x3b8135,'savename':util[_0xacdd('0x79')](_0xacdd('0x93'),_0x361fc9['name']||_0x10d964[_0xacdd('0x29')],require(_0xacdd('0x94'))['generate'](0x4),_0x361fc9[_0xacdd('0x91')]||_0xacdd('0x95')),'reportId':_0x10d964['id'],'reportType':_0xacdd('0x96')});return db[_0xacdd('0x97')]['create'](_0x3a428e,{'raw':!![]});})[_0xacdd('0x24')](function(_0x33a02a){if(_0x10d964['table']==='cdr'){_0x1ef912['where'](_0x10d964[_0xacdd('0x83')]+_0xacdd('0x98'),_0x361fc9[_0xacdd('0x99')],_0x361fc9[_0xacdd('0x9a')]);}else{_0x1ef912['where'](_0x10d964[_0xacdd('0x83')]+_0xacdd('0x9b'),_0x361fc9[_0xacdd('0x99')],_0x361fc9[_0xacdd('0x9a')]);}if(_0x33a02a){logger[_0xacdd('0x9c')](_0xacdd('0x9d'),_0x1ef912['toString']());require(_0xacdd('0x9e'))[_0xacdd('0x9f')](path[_0xacdd('0x8a')](__dirname,_0xacdd('0xa0'),_0x33a02a[_0xacdd('0x91')]),[_0x33a02a['id'],_0x1ef912[_0xacdd('0x86')](),path[_0xacdd('0x8a')](__dirname,_0xacdd('0xa1'),_0x33a02a['savename']),_0x3b8135]);return _0x33a02a;}else{var _0xbfe10c=squel[_0xacdd('0x73')]();_0xbfe10c[_0xacdd('0x74')]('('+_0x1ef912[_0xacdd('0x86')]()+')',_0xacdd('0xa2'));_0xbfe10c[_0xacdd('0x6c')](_0xacdd('0xa3'),'count');_0x1ef912[_0xacdd('0x1e')](_0x361fc9['limit']||_0x12f20b);_0x1ef912[_0xacdd('0x1c')](_0x361fc9[_0xacdd('0x1c')]||0x0);return dbH[_0xacdd('0x87')]['query'](_0xbfe10c[_0xacdd('0x86')](),{'type':dbH[_0xacdd('0x87')][_0xacdd('0x88')][_0xacdd('0x89')]})['then'](function(_0x67dd37){if(!_0x67dd37['length']){_0x6c907b=0x0;}else{_0x6c907b=_0x67dd37[0x0][_0xacdd('0x1f')]||0x0;}return dbH[_0xacdd('0x87')][_0xacdd('0x31')](_0x1ef912[_0xacdd('0x86')](),{'type':dbH[_0xacdd('0x87')]['QueryTypes']['SELECT']});})[_0xacdd('0x24')](function(_0x3e0d3e){return{'rows':_0x3e0d3e||[],'count':_0x6c907b};});}});}exports[_0xacdd('0xa4')]=function(_0x456438,_0x45f96e){return runReport(_0x456438[_0xacdd('0x46')],_0x456438[_0xacdd('0x31')],_0x456438['options'])[_0xacdd('0x24')](respondWithResult(_0x45f96e,null))[_0xacdd('0x4a')](handleError(_0x45f96e,null));};exports[_0xacdd('0xa5')]=runReport;exports[_0xacdd('0x31')]=function(_0x47db56,_0x293291){var _0x2e7d51=0xa;var _0x528463=[_0xacdd('0x8a'),_0xacdd('0x56'),'right_join','cross_join'];var _0x511c1c={'SUM':_0xacdd('0x58'),'COUNT':_0xacdd('0x59'),'COUNT DISTINCT':_0xacdd('0x5a'),'MAX':_0xacdd('0x5b'),'MIN':_0xacdd('0x5c'),'AVG':_0xacdd('0x5d'),'GROUP_CONCAT':_0xacdd('0x5e'),'GROUP_CONCAT ASC':_0xacdd('0x5f'),'GROUP_CONCAT DESC':_0xacdd('0x60')};var _0x1e62b7={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xacdd('0x62'),'HOUR':_0xacdd('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5670ed=function(_0x3c2f75){return!_['includes'](['IS\x20NULL',_0xacdd('0x68'),_0xacdd('0x69'),_0xacdd('0x8c')],_0x3c2f75);};var _0x335ddb=function(_0x18be17){if(!_0x18be17||!_0x18be17[_0xacdd('0x6a')][_0xacdd('0x37')]){return'';}for(var _0x59417e='(',_0x360aa8=0x0;_0x360aa8<_0x18be17[_0xacdd('0x6a')][_0xacdd('0x37')];_0x360aa8+=0x1){_0x360aa8>0x0&&(_0x59417e+='\x20'+_0x18be17[_0xacdd('0x8d')]+'\x20');_0x59417e+=_0x18be17[_0xacdd('0x6a')][_0x360aa8][_0xacdd('0x6b')]?_0x335ddb(_0x18be17['rules'][_0x360aa8][_0xacdd('0x6b')]):_0x18be17[_0xacdd('0x6a')][_0x360aa8][_0xacdd('0x6c')]+'\x20'+_0x18be17[_0xacdd('0x6a')][_0x360aa8]['condition']+(_0x5670ed(_0x18be17[_0xacdd('0x6a')][_0x360aa8][_0xacdd('0x8e')])?'\x20'+_0x18be17[_0xacdd('0x6a')][_0x360aa8]['value']:'');}return _0x59417e+')';};var _0xbfd39d={'where':{'id':_0x47db56[_0xacdd('0x46')]['id']}},_0x305c60,_0x37579b,_0x58255c,_0x3c3ec8,_0x79c198;_0xbfd39d=_[_0xacdd('0x3f')]({},_0xbfd39d,_0x47db56[_0xacdd('0x48')]);return db[_0xacdd('0x2d')][_0xacdd('0x49')](_0xbfd39d)[_0xacdd('0x24')](function(_0x511075){if(_0x511075){_0x305c60=_0x511075;return _0x511075[_0xacdd('0x6e')]();}return null;})[_0xacdd('0x24')](function(_0x2e10b5){if(_0x2e10b5){if(!_0x2e10b5[_0xacdd('0x37')]){throw new db[(_0xacdd('0x6f'))][(_0xacdd('0xa6'))](_0xacdd('0x70'),0x193);}_0x37579b=_0x2e10b5;return db[_0xacdd('0x71')][_0xacdd('0x43')]({'raw':!![]});}return null;})[_0xacdd('0x24')](function(_0x232070){if(_0x232070){_0x58255c=_['keyBy'](_0x232070,'id');var _0x332e54;var _0x1535b8=squel['select']();_0x1535b8['from'](_0x305c60['table']);for(var _0xccfc93=0x0;_0xccfc93<_0x37579b[_0xacdd('0x37')];_0xccfc93+=0x1){_0x332e54=_0x37579b[_0xccfc93]['MetricId']?_0x58255c[_0x37579b[_0xccfc93]['MetricId']]['metric']:_0x37579b[_0xccfc93]['field'];_0x332e54=_0x37579b[_0xccfc93]['function']?_[_0xacdd('0x78')](_0x511c1c[_0x37579b[_0xccfc93][_0xacdd('0x77')]],'%s',_0x332e54):_0x332e54;_0x332e54=_0x37579b[_0xccfc93][_0xacdd('0x79')]?_[_0xacdd('0x78')](_0x1e62b7[_0x37579b[_0xccfc93][_0xacdd('0x79')]],'%s',_0x332e54):_0x332e54;if(_0x37579b[_0xccfc93][_0xacdd('0x8f')]){_0x1535b8[_0xacdd('0x6b')](_0x332e54);}_0x37579b[_0xccfc93]['orderBy']&&_0x1535b8[_0xacdd('0x3a')](_0x332e54,_0x37579b[_0xccfc93][_0xacdd('0x7a')]===_0xacdd('0x7b')?![]:!![]);_0x1535b8['field'](_0x332e54,_0x37579b[_0xccfc93][_0xacdd('0x7c')]||_0x332e54);}if(_0x305c60[_0xacdd('0x7d')]){_0x305c60[_0xacdd('0x7d')]=JSON[_0xacdd('0x7e')](_0x305c60['joins']);for(var _0x4d213e=0x0;_0x4d213e<_0x305c60[_0xacdd('0x7d')][_0xacdd('0x37')];_0x4d213e+=0x1){if(_0x305c60['joins'][_0x4d213e][_0xacdd('0x40')]&&_[_0xacdd('0x66')](_0x528463,_0x305c60[_0xacdd('0x7d')][_0x4d213e][_0xacdd('0x40')])&&_0x305c60[_0xacdd('0x7d')][_0x4d213e][_0xacdd('0x7f')]&&_0x305c60[_0xacdd('0x7d')][_0x4d213e]['foreignTable']&&_0x305c60[_0xacdd('0x7d')][_0x4d213e][_0xacdd('0x81')]){_0x1535b8[_0x305c60[_0xacdd('0x7d')][_0x4d213e][_0xacdd('0x40')]](_0x305c60['joins'][_0x4d213e][_0xacdd('0x80')],null,util['format'](_0xacdd('0x82'),_0x305c60[_0xacdd('0x83')],_0x305c60[_0xacdd('0x7d')][_0x4d213e][_0xacdd('0x7f')],_0x305c60['joins'][_0x4d213e]['foreignTable'],_0x305c60[_0xacdd('0x7d')][_0x4d213e]['foreignKey']));}}}if(_0x305c60[_0xacdd('0x84')]){_0x305c60[_0xacdd('0x84')]=JSON[_0xacdd('0x7e')](_0x305c60[_0xacdd('0x84')]);_0x1535b8[_0xacdd('0x3c')](_0x335ddb(_0x305c60[_0xacdd('0x84')][_0xacdd('0x6b')]));}_0x79c198=_0x1535b8[_0xacdd('0x90')]();_0x1535b8['limit'](_0x2e7d51);_0x1535b8[_0xacdd('0x1c')](0x0);logger[_0xacdd('0xa7')](_0xacdd('0x85'),_0x1535b8[_0xacdd('0x86')]());return dbH[_0xacdd('0x87')][_0xacdd('0x31')](_0x1535b8[_0xacdd('0x86')](),{'type':dbH['sequelize'][_0xacdd('0x88')][_0xacdd('0x89')]});}})[_0xacdd('0x24')](function(){return{'sql':_0x79c198[_0xacdd('0x86')]()};})[_0xacdd('0x24')](respondWithResult(_0x293291,null))[_0xacdd('0x4a')](handleError(_0x293291,null));}; \ No newline at end of file +var _0x29d2=['pick','filter','merge','type','options','includeAll','include','AnalyticCustomReport','rows','catch','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','operator','rules','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','from','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','joins','foreignTable','parentKey','conditions','parse','Limited\x20Query:','sequelize','QueryTypes','right_join','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','select','foreignKey','output','web','%s-%s.%s','randomstring','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','toString','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','DATE(%s)','alias','clone','debug','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','CustomReports','destroy','end','error','name','send','index','map','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x3cbc79,_0x100701){var _0x1efdf2=function(_0x3406b5){while(--_0x3406b5){_0x3cbc79['push'](_0x3cbc79['shift']());}};_0x1efdf2(++_0x100701);}(_0x29d2,0x67));var _0x229d=function(_0x473704,_0x384a58){_0x473704=_0x473704-0x0;var _0x446ca1=_0x29d2[_0x473704];return _0x446ca1;};'use strict';var emlformat=require(_0x229d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x229d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x229d('0x2'));var moment=require(_0x229d('0x3'));var BPromise=require(_0x229d('0x4'));var Mustache=require('mustache');var util=require(_0x229d('0x5'));var path=require('path');var sox=require(_0x229d('0x6'));var csv=require(_0x229d('0x7'));var ejs=require(_0x229d('0x8'));var fs=require('fs');var fs_extra=require(_0x229d('0x9'));var _=require(_0x229d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x229d('0xb'));var toCsv=require(_0x229d('0x7'));var querystring=require('querystring');var Papa=require(_0x229d('0xc'));var Redis=require('ioredis');var authService=require(_0x229d('0xd'));var qs=require(_0x229d('0xe'));var as=require(_0x229d('0xf'));var hardwareService=require(_0x229d('0x10'));var logger=require(_0x229d('0x11'))(_0x229d('0x12'));var utils=require(_0x229d('0x13'));var config=require(_0x229d('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0x229d('0x15'))[_0x229d('0x16')];function respondWithStatusCode(_0x2c16cc,_0x674888){_0x674888=_0x674888||0xcc;return function(_0x3afe68){if(_0x3afe68){return _0x2c16cc['sendStatus'](_0x674888);}return _0x2c16cc[_0x229d('0x17')](_0x674888)['end']();};}function respondWithResult(_0x58731a,_0x45be52){_0x45be52=_0x45be52||0xc8;return function(_0x5546a5){if(_0x5546a5){return _0x58731a[_0x229d('0x17')](_0x45be52)[_0x229d('0x18')](_0x5546a5);}};}function respondWithFilteredResult(_0x5bd9e5,_0x16c9a5){return function(_0xb6aa49){if(_0xb6aa49){var _0x1a502f=typeof _0x16c9a5[_0x229d('0x19')]===_0x229d('0x1a')&&typeof _0x16c9a5[_0x229d('0x1b')]===_0x229d('0x1a');var _0x476158=_0xb6aa49[_0x229d('0x1c')];var _0x192e1e=_0x1a502f?0x0:_0x16c9a5[_0x229d('0x19')];var _0x5bd785=_0x1a502f?_0xb6aa49[_0x229d('0x1c')]:_0x16c9a5[_0x229d('0x19')]+_0x16c9a5[_0x229d('0x1b')];var _0x1966f4;if(_0x5bd785>=_0x476158){_0x5bd785=_0x476158;_0x1966f4=0xc8;}else{_0x1966f4=0xce;}_0x5bd9e5[_0x229d('0x17')](_0x1966f4);return _0x5bd9e5['set'](_0x229d('0x1d'),_0x192e1e+'-'+_0x5bd785+'/'+_0x476158)[_0x229d('0x18')](_0xb6aa49);}return null;};}function patchUpdates(_0x25e5ae){return function(_0x189145){try{jsonpatch[_0x229d('0x1e')](_0x189145,_0x25e5ae,!![]);}catch(_0x39bc68){return BPromise[_0x229d('0x1f')](_0x39bc68);}return _0x189145[_0x229d('0x20')]();};}function saveUpdates(_0x9ae64d,_0x411b5a){return function(_0x5beeae){if(_0x5beeae){return _0x5beeae[_0x229d('0x21')](_0x9ae64d)['then'](function(_0x4aeed7){return _0x4aeed7;});}return null;};}function removeEntity(_0x1fe653,_0x17a2a1){return function(_0x35b655){if(_0x35b655){return _0x35b655['destroy']()[_0x229d('0x22')](function(){var _0x42beba=_0x35b655[_0x229d('0x23')]({'plain':!![]});var _0x4f8db3=_0x229d('0x24');return db['UserProfileResource'][_0x229d('0x25')]({'where':{'type':_0x4f8db3,'resourceId':_0x42beba['id']}})[_0x229d('0x22')](function(){return _0x35b655;});})[_0x229d('0x22')](function(){_0x1fe653[_0x229d('0x17')](0xcc)[_0x229d('0x26')]();});}};}function handleEntityNotFound(_0x14f37b,_0x415e24){return function(_0x150510){if(!_0x150510){_0x14f37b['sendStatus'](0x194);}return _0x150510;};}function handleError(_0x323c21,_0x4dd4cf){_0x4dd4cf=_0x4dd4cf||0x1f4;return function(_0x1a789d){logger[_0x229d('0x27')](_0x1a789d['stack']);if(_0x1a789d[_0x229d('0x28')]){delete _0x1a789d[_0x229d('0x28')];}_0x323c21[_0x229d('0x17')](_0x4dd4cf)[_0x229d('0x29')](_0x1a789d);};}exports[_0x229d('0x2a')]=function(_0x5aef4d,_0x2938f1){var _0x1c7033={},_0x30b297={},_0x44d10d={'count':0x0,'rows':[]};var _0x3e8d3a=_[_0x229d('0x2b')](db['AnalyticCustomReport'][_0x229d('0x2c')],function(_0x1d6b04){return{'name':_0x1d6b04['fieldName'],'type':_0x1d6b04['type'][_0x229d('0x2d')]};});_0x30b297[_0x229d('0x2e')]=_[_0x229d('0x2b')](_0x3e8d3a,'name');_0x30b297[_0x229d('0x2f')]=_['keys'](_0x5aef4d[_0x229d('0x2f')]);_0x30b297[_0x229d('0x30')]=_['intersection'](_0x30b297[_0x229d('0x2e')],_0x30b297[_0x229d('0x2f')]);_0x1c7033[_0x229d('0x31')]=_[_0x229d('0x32')](_0x30b297[_0x229d('0x2e')],qs['fields'](_0x5aef4d[_0x229d('0x2f')][_0x229d('0x33')]));_0x1c7033[_0x229d('0x31')]=_0x1c7033[_0x229d('0x31')][_0x229d('0x34')]?_0x1c7033['attributes']:_0x30b297[_0x229d('0x2e')];if(!_0x5aef4d[_0x229d('0x2f')][_0x229d('0x35')]('nolimit')){_0x1c7033['limit']=qs[_0x229d('0x1b')](_0x5aef4d[_0x229d('0x2f')][_0x229d('0x1b')]);_0x1c7033[_0x229d('0x19')]=qs[_0x229d('0x19')](_0x5aef4d['query'][_0x229d('0x19')]);}_0x1c7033[_0x229d('0x36')]=qs[_0x229d('0x37')](_0x5aef4d[_0x229d('0x2f')][_0x229d('0x37')]);_0x1c7033[_0x229d('0x38')]=qs[_0x229d('0x30')](_[_0x229d('0x39')](_0x5aef4d['query'],_0x30b297[_0x229d('0x30')]),_0x3e8d3a);if(_0x5aef4d[_0x229d('0x2f')][_0x229d('0x3a')]){_0x1c7033[_0x229d('0x38')]=_[_0x229d('0x3b')](_0x1c7033[_0x229d('0x38')],{'$or':_[_0x229d('0x2b')](_0x3e8d3a,function(_0x2950bf){if(_0x2950bf[_0x229d('0x3c')]!=='VIRTUAL'){var _0x1211fa={};_0x1211fa[_0x2950bf[_0x229d('0x28')]]={'$like':'%'+_0x5aef4d[_0x229d('0x2f')][_0x229d('0x3a')]+'%'};return _0x1211fa;}})});}_0x1c7033=_['merge']({},_0x1c7033,_0x5aef4d[_0x229d('0x3d')]);var _0x55a867={'where':_0x1c7033[_0x229d('0x38')]};return db['AnalyticCustomReport'][_0x229d('0x1c')](_0x55a867)['then'](function(_0x16c607){_0x44d10d['count']=_0x16c607;if(_0x5aef4d[_0x229d('0x2f')][_0x229d('0x3e')]){_0x1c7033[_0x229d('0x3f')]=[{'all':!![]}];}return db[_0x229d('0x40')]['findAll'](_0x1c7033);})[_0x229d('0x22')](function(_0x472dce){_0x44d10d[_0x229d('0x41')]=_0x472dce;return _0x44d10d;})[_0x229d('0x22')](respondWithFilteredResult(_0x2938f1,_0x1c7033))[_0x229d('0x42')](handleError(_0x2938f1,null));};exports['show']=function(_0x3f3145,_0x432dcb){var _0x1dd605={'raw':![],'where':{'id':_0x3f3145[_0x229d('0x43')]['id']}},_0x105302={};_0x105302[_0x229d('0x2e')]=_[_0x229d('0x44')](db[_0x229d('0x40')][_0x229d('0x2c')]);_0x105302['query']=_['keys'](_0x3f3145[_0x229d('0x2f')]);_0x105302[_0x229d('0x30')]=_[_0x229d('0x32')](_0x105302['model'],_0x105302[_0x229d('0x2f')]);_0x1dd605['attributes']=_['intersection'](_0x105302[_0x229d('0x2e')],qs[_0x229d('0x33')](_0x3f3145['query']['fields']));_0x1dd605[_0x229d('0x31')]=_0x1dd605[_0x229d('0x31')]['length']?_0x1dd605[_0x229d('0x31')]:_0x105302['model'];if(_0x3f3145[_0x229d('0x2f')][_0x229d('0x3e')]){_0x1dd605['include']=[{'all':!![]}];}_0x1dd605=_['merge']({},_0x1dd605,_0x3f3145[_0x229d('0x3d')]);return db[_0x229d('0x40')]['find'](_0x1dd605)['then'](handleEntityNotFound(_0x432dcb,null))['then'](respondWithResult(_0x432dcb,null))[_0x229d('0x42')](handleError(_0x432dcb,null));};exports['create']=function(_0x4e74f6,_0x5ec424){return db[_0x229d('0x40')][_0x229d('0x45')](_0x4e74f6[_0x229d('0x46')],{})['then'](function(_0x49d65f){var _0x32ea13=_0x4e74f6[_0x229d('0x47')][_0x229d('0x23')]({'plain':!![]});if(!_0x32ea13)throw new Error(_0x229d('0x48'));if(_0x32ea13[_0x229d('0x49')]===_0x229d('0x47')){var _0x13dd58=_0x49d65f['get']({'plain':!![]});var _0x128719=_0x229d('0x4a');return db['UserProfileSection'][_0x229d('0x4b')]({'where':{'name':_0x128719,'userProfileId':_0x32ea13['userProfileId']},'raw':!![]})['then'](function(_0x1a9f72){if(_0x1a9f72&&_0x1a9f72[_0x229d('0x4c')]===0x0){return db[_0x229d('0x4d')][_0x229d('0x45')]({'name':_0x13dd58[_0x229d('0x28')],'resourceId':_0x13dd58['id'],'type':_0x229d('0x24'),'sectionId':_0x1a9f72['id']},{})['then'](function(){return _0x49d65f;});}else{return _0x49d65f;}})[_0x229d('0x42')](function(_0x256573){logger[_0x229d('0x27')](_0x229d('0x4e'),_0x256573);throw _0x256573;});}return _0x49d65f;})[_0x229d('0x22')](respondWithResult(_0x5ec424,0xc9))[_0x229d('0x42')](handleError(_0x5ec424,null));};exports[_0x229d('0x21')]=function(_0xf6d81,_0x1f6956){if(_0xf6d81[_0x229d('0x46')]['id']){delete _0xf6d81[_0x229d('0x46')]['id'];}return db[_0x229d('0x40')][_0x229d('0x4b')]({'where':{'id':_0xf6d81[_0x229d('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f6956,null))[_0x229d('0x22')](saveUpdates(_0xf6d81[_0x229d('0x46')],null))[_0x229d('0x22')](respondWithResult(_0x1f6956,null))[_0x229d('0x42')](handleError(_0x1f6956,null));};exports[_0x229d('0x25')]=function(_0x464c51,_0x5c454d){return db[_0x229d('0x40')][_0x229d('0x4b')]({'where':{'id':_0x464c51[_0x229d('0x43')]['id']}})[_0x229d('0x22')](handleEntityNotFound(_0x5c454d,null))['then'](removeEntity(_0x5c454d,null))[_0x229d('0x42')](handleError(_0x5c454d,null));};exports['preview']=function(_0x4ef932,_0x45e56b){var _0x30bad9=0xa;var _0x28e481=[_0x229d('0x4f'),_0x229d('0x50'),'right_join',_0x229d('0x51')];var _0x1bb48a={'SUM':_0x229d('0x52'),'COUNT':_0x229d('0x53'),'COUNT DISTINCT':_0x229d('0x54'),'MAX':_0x229d('0x55'),'MIN':_0x229d('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x229d('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4b9477={'SEC_TO_TIME':_0x229d('0x58'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x229d('0x59'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x244b41=function(_0x4ba16c){return!_[_0x229d('0x5a')]([_0x229d('0x5b'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x229d('0x5c')],_0x4ba16c);};var _0x5793c3=function(_0x3baabb){if(!_0x3baabb||!_0x3baabb['rules'][_0x229d('0x34')]){return'';}for(var _0x55e49a='(',_0x4dcdde=0x0;_0x4dcdde<_0x3baabb['rules'][_0x229d('0x34')];_0x4dcdde+=0x1){_0x4dcdde>0x0&&(_0x55e49a+='\x20'+_0x3baabb[_0x229d('0x5d')]+'\x20');_0x55e49a+=_0x3baabb[_0x229d('0x5e')][_0x4dcdde][_0x229d('0x5f')]?_0x5793c3(_0x3baabb[_0x229d('0x5e')][_0x4dcdde][_0x229d('0x5f')]):_0x3baabb[_0x229d('0x5e')][_0x4dcdde]['field']+'\x20'+_0x3baabb['rules'][_0x4dcdde][_0x229d('0x60')]+(_0x244b41(_0x3baabb[_0x229d('0x5e')][_0x4dcdde]['condition'])?'\x20'+_0x3baabb[_0x229d('0x5e')][_0x4dcdde][_0x229d('0x61')]:'');}return _0x55e49a+')';};var _0x127a27={'where':{'id':_0x4ef932['params']['id']}},_0x475563,_0x7614c1,_0x3f43da,_0x464dfa,_0x4e1b8d;_0x127a27=_['merge']({},_0x127a27,_0x4ef932[_0x229d('0x3d')]);return db[_0x229d('0x40')]['find'](_0x127a27)[_0x229d('0x22')](function(_0xeca1a0){if(_0xeca1a0){_0x475563=_0xeca1a0;return _0xeca1a0[_0x229d('0x62')]();}return null;})['then'](function(_0x33d811){if(_0x33d811){if(!_0x33d811['length']){throw new db[(_0x229d('0x63'))][(_0x229d('0x64'))](_0x229d('0x65'),0x193);}_0x7614c1=_0x33d811;return db[_0x229d('0x66')][_0x229d('0x67')]({'raw':!![]});}return null;})[_0x229d('0x22')](function(_0x1ab16b){if(_0x1ab16b){_0x3f43da=_[_0x229d('0x68')](_0x1ab16b,'id');var _0x1c4dc0;var _0x158792=squel['select']();_0x158792[_0x229d('0x69')](_0x475563[_0x229d('0x6a')]);for(var _0x51c245=0x0;_0x51c245<_0x7614c1[_0x229d('0x34')];_0x51c245+=0x1){_0x1c4dc0=_0x7614c1[_0x51c245][_0x229d('0x6b')]?_0x3f43da[_0x7614c1[_0x51c245]['MetricId']][_0x229d('0x6c')]:_0x7614c1[_0x51c245][_0x229d('0x6d')];_0x1c4dc0=_0x7614c1[_0x51c245][_0x229d('0x6e')]?_[_0x229d('0x6f')](_0x1bb48a[_0x7614c1[_0x51c245]['function']],'%s',_0x1c4dc0):_0x1c4dc0;_0x1c4dc0=_0x7614c1[_0x51c245]['format']?_['replace'](_0x4b9477[_0x7614c1[_0x51c245][_0x229d('0x70')]],'%s',_0x1c4dc0):_0x1c4dc0;if(_0x7614c1[_0x51c245][_0x229d('0x71')]){_0x158792['group'](_0x1c4dc0);}_0x7614c1[_0x51c245][_0x229d('0x72')]&&_0x158792[_0x229d('0x36')](_0x1c4dc0,_0x7614c1[_0x51c245]['orderBy']===_0x229d('0x73')?![]:!![]);_0x158792[_0x229d('0x6d')](_0x1c4dc0,_0x7614c1[_0x51c245]['alias']||_0x1c4dc0);}if(_0x475563[_0x229d('0x74')]){_0x475563[_0x229d('0x74')]=JSON['parse'](_0x475563[_0x229d('0x74')]);for(var _0x549138=0x0;_0x549138<_0x475563['joins']['length'];_0x549138+=0x1){if(_0x475563[_0x229d('0x74')][_0x549138][_0x229d('0x3c')]&&_[_0x229d('0x5a')](_0x28e481,_0x475563[_0x229d('0x74')][_0x549138][_0x229d('0x3c')])&&_0x475563['joins'][_0x549138]['parentKey']&&_0x475563['joins'][_0x549138][_0x229d('0x75')]&&_0x475563[_0x229d('0x74')][_0x549138]['foreignKey']){_0x158792[_0x475563[_0x229d('0x74')][_0x549138][_0x229d('0x3c')]](_0x475563[_0x229d('0x74')][_0x549138][_0x229d('0x75')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x475563[_0x229d('0x6a')],_0x475563[_0x229d('0x74')][_0x549138][_0x229d('0x76')],_0x475563[_0x229d('0x74')][_0x549138][_0x229d('0x75')],_0x475563[_0x229d('0x74')][_0x549138]['foreignKey']));}}}if(_0x475563[_0x229d('0x77')]){_0x475563[_0x229d('0x77')]=JSON[_0x229d('0x78')](_0x475563[_0x229d('0x77')]);_0x158792[_0x229d('0x38')](_0x5793c3(_0x475563[_0x229d('0x77')][_0x229d('0x5f')]));}_0x4e1b8d=_0x158792['clone']();_0x158792[_0x229d('0x1b')](_0x30bad9);_0x158792['offset'](0x0);logger['debug'](_0x229d('0x79'),_0x158792['toString']());return dbH['sequelize'][_0x229d('0x2f')](_0x158792['toString'](),{'type':dbH[_0x229d('0x7a')][_0x229d('0x7b')]['SELECT']});}})['then'](respondWithResult(_0x45e56b,null))[_0x229d('0x42')](handleError(_0x45e56b,null));};function runReport(_0x55498c,_0x42660f,_0x20fb33){var _0x3a0b24=_0x42660f[_0x229d('0x28')];var _0x4d39ff=0xa;var _0x461abe=[_0x229d('0x4f'),_0x229d('0x50'),_0x229d('0x7c'),_0x229d('0x51')];var _0x8c39b4={'SUM':'SUM(%s)','COUNT':_0x229d('0x53'),'COUNT DISTINCT':_0x229d('0x54'),'MAX':_0x229d('0x55'),'MIN':_0x229d('0x56'),'AVG':_0x229d('0x7d'),'GROUP_CONCAT':_0x229d('0x57'),'GROUP_CONCAT ASC':_0x229d('0x7e'),'GROUP_CONCAT DESC':_0x229d('0x7f')};var _0xcdf98a={'SEC_TO_TIME':_0x229d('0x58'),'DATE':'DATE(%s)','HOUR':_0x229d('0x80'),'ROUND':_0x229d('0x59'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5d0473=function(_0x18c37e){return!_['includes'](['IS\x20NULL',_0x229d('0x81'),_0x229d('0x82'),_0x229d('0x5c')],_0x18c37e);};var _0x12d4ad=function(_0x378bbe){if(!_0x378bbe||!_0x378bbe['rules'][_0x229d('0x34')]){return'';}for(var _0x2804ea='(',_0x55abfc=0x0;_0x55abfc<_0x378bbe[_0x229d('0x5e')][_0x229d('0x34')];_0x55abfc+=0x1){_0x55abfc>0x0&&(_0x2804ea+='\x20'+_0x378bbe[_0x229d('0x5d')]+'\x20');_0x2804ea+=_0x378bbe['rules'][_0x55abfc][_0x229d('0x5f')]?_0x12d4ad(_0x378bbe[_0x229d('0x5e')][_0x55abfc][_0x229d('0x5f')]):_0x378bbe[_0x229d('0x5e')][_0x55abfc][_0x229d('0x6d')]+'\x20'+_0x378bbe[_0x229d('0x5e')][_0x55abfc]['condition']+(_0x5d0473(_0x378bbe[_0x229d('0x5e')][_0x55abfc]['condition'])?'\x20'+_0x378bbe[_0x229d('0x5e')][_0x55abfc]['value']:'');}return _0x2804ea+')';};var _0x5588dc={'where':{'id':_0x55498c['id']}},_0x203d41,_0x468e18,_0x3a617f,_0x2111f8,_0x136ea2;_0x5588dc=_[_0x229d('0x3b')]({},_0x5588dc,_0x20fb33);return db[_0x229d('0x40')][_0x229d('0x4b')](_0x5588dc)[_0x229d('0x22')](function(_0x4a25a7){if(_0x4a25a7){_0x203d41=_0x4a25a7;return _0x4a25a7[_0x229d('0x62')]();}return null;})['then'](function(_0x2fd683){if(_0x2fd683){if(!_0x2fd683[_0x229d('0x34')]){throw new db[(_0x229d('0x63'))][(_0x229d('0x64'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x468e18=_0x2fd683;return db[_0x229d('0x66')][_0x229d('0x67')]({'raw':!![]});}return null;})['then'](function(_0x3e5fa2){if(_0x3e5fa2){_0x3a617f=_[_0x229d('0x68')](_0x3e5fa2,'id');var _0x1b1ac4;var _0xe85531=squel[_0x229d('0x83')]();_0xe85531[_0x229d('0x69')](_0x203d41[_0x229d('0x6a')]);for(var _0x402e81=0x0;_0x402e81<_0x468e18[_0x229d('0x34')];_0x402e81+=0x1){_0x1b1ac4=_0x468e18[_0x402e81][_0x229d('0x6b')]?_0x3a617f[_0x468e18[_0x402e81][_0x229d('0x6b')]][_0x229d('0x6c')]:_0x468e18[_0x402e81]['field'];_0x1b1ac4=_0x468e18[_0x402e81][_0x229d('0x6e')]?_[_0x229d('0x6f')](_0x8c39b4[_0x468e18[_0x402e81]['function']],'%s',_0x1b1ac4):_0x1b1ac4;_0x1b1ac4=_0x468e18[_0x402e81][_0x229d('0x70')]?_[_0x229d('0x6f')](_0xcdf98a[_0x468e18[_0x402e81]['format']],'%s',_0x1b1ac4):_0x1b1ac4;if(_0x468e18[_0x402e81][_0x229d('0x71')]){_0xe85531['group'](_0x1b1ac4);}_0x468e18[_0x402e81][_0x229d('0x72')]&&_0xe85531[_0x229d('0x36')](_0x1b1ac4,_0x468e18[_0x402e81][_0x229d('0x72')]===_0x229d('0x73')?![]:!![]);_0xe85531[_0x229d('0x6d')](_0x1b1ac4,_0x468e18[_0x402e81]['alias']||_0x1b1ac4);}if(_0x203d41[_0x229d('0x74')]){_0x203d41['joins']=JSON[_0x229d('0x78')](_0x203d41[_0x229d('0x74')]);for(var _0x685665=0x0;_0x685665<_0x203d41[_0x229d('0x74')][_0x229d('0x34')];_0x685665+=0x1){if(_0x203d41['joins'][_0x685665][_0x229d('0x3c')]&&_[_0x229d('0x5a')](_0x461abe,_0x203d41['joins'][_0x685665][_0x229d('0x3c')])&&_0x203d41[_0x229d('0x74')][_0x685665][_0x229d('0x76')]&&_0x203d41[_0x229d('0x74')][_0x685665][_0x229d('0x75')]&&_0x203d41[_0x229d('0x74')][_0x685665]['foreignKey']){_0xe85531[_0x203d41['joins'][_0x685665][_0x229d('0x3c')]](_0x203d41[_0x229d('0x74')][_0x685665][_0x229d('0x75')],null,util[_0x229d('0x70')]('%s.%s\x20=\x20%s.%s',_0x203d41[_0x229d('0x6a')],_0x203d41[_0x229d('0x74')][_0x685665][_0x229d('0x76')],_0x203d41[_0x229d('0x74')][_0x685665][_0x229d('0x75')],_0x203d41['joins'][_0x685665][_0x229d('0x84')]));}}}if(_0x203d41[_0x229d('0x77')]){_0x203d41[_0x229d('0x77')]=JSON['parse'](_0x203d41['conditions']);_0xe85531[_0x229d('0x38')](_0x12d4ad(_0x203d41[_0x229d('0x77')][_0x229d('0x5f')]));}_0x136ea2=_0xe85531['clone']();_0xe85531[_0x229d('0x1b')](_0x4d39ff);_0xe85531[_0x229d('0x19')](0x0);return;}})[_0x229d('0x22')](function(){if(_0x42660f[_0x229d('0x85')]===_0x229d('0x86')){return null;}var _0x3a5c5a=_[_0x229d('0x3b')](_0x42660f,{'name':_0x42660f['fullPath']||_0x42660f['name']||_0x203d41['name'],'basename':_0x3a0b24,'savename':util[_0x229d('0x70')](_0x229d('0x87'),_0x42660f['name']||_0x203d41[_0x229d('0x28')],require(_0x229d('0x88'))['generate'](0x4),_0x42660f[_0x229d('0x85')]||'csv'),'reportId':_0x203d41['id'],'reportType':_0x229d('0x89')});return db[_0x229d('0x8a')][_0x229d('0x45')](_0x3a5c5a,{'raw':!![]});})[_0x229d('0x22')](function(_0x4b2bfe){if(_0x203d41[_0x229d('0x6a')]===_0x229d('0x8b')){_0x136ea2[_0x229d('0x38')](_0x203d41[_0x229d('0x6a')]+_0x229d('0x8c'),_0x42660f[_0x229d('0x8d')],_0x42660f[_0x229d('0x8e')]);}else{_0x136ea2['where'](_0x203d41[_0x229d('0x6a')]+_0x229d('0x8f'),_0x42660f[_0x229d('0x8d')],_0x42660f['endDate']);}if(_0x4b2bfe){logger[_0x229d('0x90')](_0x229d('0x91'),_0x136ea2['toString']());require(_0x229d('0x92'))[_0x229d('0x93')](path[_0x229d('0x4f')](__dirname,_0x229d('0x94'),_0x4b2bfe[_0x229d('0x85')]),[_0x4b2bfe['id'],_0x136ea2[_0x229d('0x95')](),path[_0x229d('0x4f')](__dirname,_0x229d('0x96'),_0x4b2bfe[_0x229d('0x97')]),_0x3a0b24]);return _0x4b2bfe;}else{var _0x448c20=squel[_0x229d('0x83')]();_0x448c20['from']('('+_0x136ea2[_0x229d('0x95')]()+')',_0x229d('0x98'));_0x448c20[_0x229d('0x6d')](_0x229d('0x99'),_0x229d('0x1c'));_0x136ea2[_0x229d('0x1b')](_0x42660f[_0x229d('0x1b')]||_0x4d39ff);_0x136ea2['offset'](_0x42660f[_0x229d('0x19')]||0x0);return dbH['sequelize'][_0x229d('0x2f')](_0x448c20['toString'](),{'type':dbH[_0x229d('0x7a')]['QueryTypes'][_0x229d('0x9a')]})[_0x229d('0x22')](function(_0xbf7507){if(!_0xbf7507['length']){_0x2111f8=0x0;}else{_0x2111f8=_0xbf7507[0x0]['count']||0x0;}return dbH[_0x229d('0x7a')][_0x229d('0x2f')](_0x136ea2[_0x229d('0x95')](),{'type':dbH[_0x229d('0x7a')][_0x229d('0x7b')][_0x229d('0x9a')]});})[_0x229d('0x22')](function(_0x5d8f8d){return{'rows':_0x5d8f8d||[],'count':_0x2111f8};});}});}exports['run']=function(_0x53a6f3,_0x223760){return runReport(_0x53a6f3[_0x229d('0x43')],_0x53a6f3[_0x229d('0x2f')],_0x53a6f3[_0x229d('0x3d')])[_0x229d('0x22')](respondWithResult(_0x223760,null))[_0x229d('0x42')](handleError(_0x223760,null));};exports[_0x229d('0x9b')]=runReport;exports[_0x229d('0x2f')]=function(_0x4226a2,_0x4b339b){var _0x40a4c3=0xa;var _0x206993=[_0x229d('0x4f'),'left_join',_0x229d('0x7c'),_0x229d('0x51')];var _0x5b11e6={'SUM':_0x229d('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x229d('0x54'),'MAX':_0x229d('0x55'),'MIN':_0x229d('0x56'),'AVG':_0x229d('0x7d'),'GROUP_CONCAT':_0x229d('0x57'),'GROUP_CONCAT ASC':_0x229d('0x7e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x16d4b2={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x229d('0x9c'),'HOUR':_0x229d('0x80'),'ROUND':_0x229d('0x59'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x397776=function(_0x5c6aba){return!_['includes'](['IS\x20NULL',_0x229d('0x81'),_0x229d('0x82'),_0x229d('0x5c')],_0x5c6aba);};var _0x1da2c0=function(_0x54e5f2){if(!_0x54e5f2||!_0x54e5f2[_0x229d('0x5e')][_0x229d('0x34')]){return'';}for(var _0x41afb2='(',_0x3999c5=0x0;_0x3999c5<_0x54e5f2[_0x229d('0x5e')][_0x229d('0x34')];_0x3999c5+=0x1){_0x3999c5>0x0&&(_0x41afb2+='\x20'+_0x54e5f2['operator']+'\x20');_0x41afb2+=_0x54e5f2['rules'][_0x3999c5][_0x229d('0x5f')]?_0x1da2c0(_0x54e5f2[_0x229d('0x5e')][_0x3999c5]['group']):_0x54e5f2[_0x229d('0x5e')][_0x3999c5][_0x229d('0x6d')]+'\x20'+_0x54e5f2[_0x229d('0x5e')][_0x3999c5][_0x229d('0x60')]+(_0x397776(_0x54e5f2['rules'][_0x3999c5][_0x229d('0x60')])?'\x20'+_0x54e5f2['rules'][_0x3999c5][_0x229d('0x61')]:'');}return _0x41afb2+')';};var _0x5d75f1={'where':{'id':_0x4226a2[_0x229d('0x43')]['id']}},_0x31723e,_0x3f784d,_0x4c39a3,_0x425e99,_0x4bb735;_0x5d75f1=_[_0x229d('0x3b')]({},_0x5d75f1,_0x4226a2['options']);return db[_0x229d('0x40')][_0x229d('0x4b')](_0x5d75f1)[_0x229d('0x22')](function(_0x5a1dd0){if(_0x5a1dd0){_0x31723e=_0x5a1dd0;return _0x5a1dd0[_0x229d('0x62')]();}return null;})[_0x229d('0x22')](function(_0xdfc6ae){if(_0xdfc6ae){if(!_0xdfc6ae[_0x229d('0x34')]){throw new db[(_0x229d('0x63'))][(_0x229d('0x64'))](_0x229d('0x65'),0x193);}_0x3f784d=_0xdfc6ae;return db[_0x229d('0x66')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x6738f5){if(_0x6738f5){_0x4c39a3=_[_0x229d('0x68')](_0x6738f5,'id');var _0xa336d6;var _0x423a5f=squel[_0x229d('0x83')]();_0x423a5f[_0x229d('0x69')](_0x31723e[_0x229d('0x6a')]);for(var _0x1d3846=0x0;_0x1d3846<_0x3f784d['length'];_0x1d3846+=0x1){_0xa336d6=_0x3f784d[_0x1d3846][_0x229d('0x6b')]?_0x4c39a3[_0x3f784d[_0x1d3846][_0x229d('0x6b')]]['metric']:_0x3f784d[_0x1d3846][_0x229d('0x6d')];_0xa336d6=_0x3f784d[_0x1d3846][_0x229d('0x6e')]?_[_0x229d('0x6f')](_0x5b11e6[_0x3f784d[_0x1d3846][_0x229d('0x6e')]],'%s',_0xa336d6):_0xa336d6;_0xa336d6=_0x3f784d[_0x1d3846][_0x229d('0x70')]?_['replace'](_0x16d4b2[_0x3f784d[_0x1d3846][_0x229d('0x70')]],'%s',_0xa336d6):_0xa336d6;if(_0x3f784d[_0x1d3846]['groupBy']){_0x423a5f[_0x229d('0x5f')](_0xa336d6);}_0x3f784d[_0x1d3846][_0x229d('0x72')]&&_0x423a5f['order'](_0xa336d6,_0x3f784d[_0x1d3846][_0x229d('0x72')]===_0x229d('0x73')?![]:!![]);_0x423a5f[_0x229d('0x6d')](_0xa336d6,_0x3f784d[_0x1d3846][_0x229d('0x9d')]||_0xa336d6);}if(_0x31723e[_0x229d('0x74')]){_0x31723e['joins']=JSON[_0x229d('0x78')](_0x31723e[_0x229d('0x74')]);for(var _0x467e44=0x0;_0x467e44<_0x31723e[_0x229d('0x74')][_0x229d('0x34')];_0x467e44+=0x1){if(_0x31723e[_0x229d('0x74')][_0x467e44][_0x229d('0x3c')]&&_['includes'](_0x206993,_0x31723e[_0x229d('0x74')][_0x467e44][_0x229d('0x3c')])&&_0x31723e[_0x229d('0x74')][_0x467e44]['parentKey']&&_0x31723e[_0x229d('0x74')][_0x467e44][_0x229d('0x75')]&&_0x31723e['joins'][_0x467e44]['foreignKey']){_0x423a5f[_0x31723e['joins'][_0x467e44][_0x229d('0x3c')]](_0x31723e['joins'][_0x467e44]['foreignTable'],null,util[_0x229d('0x70')]('%s.%s\x20=\x20%s.%s',_0x31723e[_0x229d('0x6a')],_0x31723e[_0x229d('0x74')][_0x467e44][_0x229d('0x76')],_0x31723e['joins'][_0x467e44][_0x229d('0x75')],_0x31723e[_0x229d('0x74')][_0x467e44][_0x229d('0x84')]));}}}if(_0x31723e[_0x229d('0x77')]){_0x31723e['conditions']=JSON[_0x229d('0x78')](_0x31723e[_0x229d('0x77')]);_0x423a5f[_0x229d('0x38')](_0x1da2c0(_0x31723e['conditions'][_0x229d('0x5f')]));}_0x4bb735=_0x423a5f[_0x229d('0x9e')]();_0x423a5f[_0x229d('0x1b')](_0x40a4c3);_0x423a5f[_0x229d('0x19')](0x0);logger[_0x229d('0x9f')](_0x229d('0x79'),_0x423a5f[_0x229d('0x95')]());return dbH[_0x229d('0x7a')][_0x229d('0x2f')](_0x423a5f['toString'](),{'type':dbH[_0x229d('0x7a')][_0x229d('0x7b')][_0x229d('0x9a')]});}})[_0x229d('0x22')](function(){return{'sql':_0x4bb735[_0x229d('0x95')]()};})['then'](respondWithResult(_0x4b339b,null))[_0x229d('0x42')](handleError(_0x4b339b,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 1b86159..8cc6e96 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 _0xc1d9=['rimraf','../../config/environment','exports','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc1d9,0x113));var _0x9c1d=function(_0x144bbf,_0x2cc7f3){_0x144bbf=_0x144bbf-0x0;var _0x3021b7=_0xc1d9[_0x144bbf];return _0x3021b7;};'use strict';var _=require('lodash');var util=require(_0x9c1d('0x0'));var logger=require(_0x9c1d('0x1'))(_0x9c1d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9c1d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c1d('0x4'));var config=require(_0x9c1d('0x5'));var attributes=require('./analyticCustomReport.attributes');module[_0x9c1d('0x6')]=function(_0x1d2453,_0x245e09){return _0x1d2453['define'](_0x9c1d('0x7'),attributes,{'tableName':_0x9c1d('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fe6=['moment','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api'];(function(_0x6284c9,_0x3a31c4){var _0xf0a065=function(_0x2f52f4){while(--_0x2f52f4){_0x6284c9['push'](_0x6284c9['shift']());}};_0xf0a065(++_0x3a31c4);}(_0x7fe6,0x8c));var _0x67fe=function(_0x44dfb7,_0x70cde4){_0x44dfb7=_0x44dfb7-0x0;var _0x410fda=_0x7fe6[_0x44dfb7];return _0x410fda;};'use strict';var _=require('lodash');var util=require(_0x67fe('0x0'));var logger=require(_0x67fe('0x1'))(_0x67fe('0x2'));var moment=require(_0x67fe('0x3'));var BPromise=require(_0x67fe('0x4'));var rp=require(_0x67fe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x67fe('0x6'));var config=require(_0x67fe('0x7'));var attributes=require(_0x67fe('0x8'));module[_0x67fe('0x9')]=function(_0x4d3169,_0x2dff47){return _0x4d3169[_0x67fe('0xa')](_0x67fe('0xb'),attributes,{'tableName':_0x67fe('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 bf96006..3e2dbfe 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 _0x8cf9=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch'];(function(_0x359d68,_0x1f5351){var _0x4a8d4e=function(_0x50dd44){while(--_0x50dd44){_0x359d68['push'](_0x359d68['shift']());}};_0x4a8d4e(++_0x1f5351);}(_0x8cf9,0x126));var _0x98cf=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x8cf9[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x98cf('0x0'));var util=require(_0x98cf('0x1'));var moment=require(_0x98cf('0x2'));var BPromise=require(_0x98cf('0x3'));var rs=require(_0x98cf('0x4'));var fs=require('fs');var Redis=require(_0x98cf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98cf('0x6'));var logger=require(_0x98cf('0x7'))('rpc');var config=require(_0x98cf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x98cf('0x9')][_0x98cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42af31,_0x3e6d69,_0x133f95){return new BPromise(function(_0x25a96e,_0x17339a){return client[_0x98cf('0xb')](_0x42af31,_0x133f95)[_0x98cf('0xc')](function(_0xdd8d9){logger[_0x98cf('0xd')](_0x98cf('0xe'),_0x3e6d69,'request\x20sent');logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x3e6d69,'request\x20sent',JSON['stringify'](_0xdd8d9));if(_0xdd8d9[_0x98cf('0xf')]){if(_0xdd8d9[_0x98cf('0xf')][_0x98cf('0x10')]===0x1f4){logger['error'](_0x98cf('0xe'),_0x3e6d69,_0xdd8d9[_0x98cf('0xf')][_0x98cf('0x11')]);return _0x17339a(_0xdd8d9[_0x98cf('0xf')][_0x98cf('0x11')]);}logger[_0x98cf('0xf')](_0x98cf('0xe'),_0x3e6d69,_0xdd8d9[_0x98cf('0xf')][_0x98cf('0x11')]);return _0x25a96e(_0xdd8d9['error']['message']);}else{logger[_0x98cf('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3e6d69,_0x98cf('0x12'));_0x25a96e(_0xdd8d9[_0x98cf('0x13')][_0x98cf('0x11')]);}})[_0x98cf('0x14')](function(_0x5bd06b){logger[_0x98cf('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3e6d69,_0x5bd06b);_0x17339a(_0x5bd06b);});});} \ No newline at end of file +var _0x4754=['../../mysqldb','../../config/environment','jayson/promise','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x537887,_0x11c484){var _0x3707ad=function(_0x249fe1){while(--_0x249fe1){_0x537887['push'](_0x537887['shift']());}};_0x3707ad(++_0x11c484);}(_0x4754,0x1df));var _0x4475=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4754[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4475('0x0'));var util=require(_0x4475('0x1'));var moment=require(_0x4475('0x2'));var BPromise=require(_0x4475('0x3'));var rs=require(_0x4475('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4475('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4475('0x6'));var jayson=require(_0x4475('0x7'));var client=jayson['client'][_0x4475('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2382e1,_0x4557b2,_0x59cc14){return new BPromise(function(_0x2b1ec3,_0x2e418a){return client[_0x4475('0x9')](_0x2382e1,_0x59cc14)[_0x4475('0xa')](function(_0x5a5785){logger['info'](_0x4475('0xb'),_0x4557b2,_0x4475('0xc'));logger[_0x4475('0xd')](_0x4475('0xe'),_0x4557b2,_0x4475('0xc'),JSON[_0x4475('0xf')](_0x5a5785));if(_0x5a5785[_0x4475('0x10')]){if(_0x5a5785[_0x4475('0x10')][_0x4475('0x11')]===0x1f4){logger[_0x4475('0x10')](_0x4475('0xb'),_0x4557b2,_0x5a5785[_0x4475('0x10')]['message']);return _0x2e418a(_0x5a5785[_0x4475('0x10')][_0x4475('0x12')]);}logger[_0x4475('0x10')](_0x4475('0xb'),_0x4557b2,_0x5a5785[_0x4475('0x10')][_0x4475('0x12')]);return _0x2b1ec3(_0x5a5785[_0x4475('0x10')][_0x4475('0x12')]);}else{logger[_0x4475('0x13')](_0x4475('0xb'),_0x4557b2,_0x4475('0xc'));_0x2b1ec3(_0x5a5785[_0x4475('0x14')][_0x4475('0x12')]);}})[_0x4475('0x15')](function(_0x3f16e4){logger[_0x4475('0x10')](_0x4475('0xb'),_0x4557b2,_0x3f16e4);_0x2e418a(_0x3f16e4);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 3c75c57..d9e4eaf 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 _0x3b7d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3b7d,0x1d7));var _0xd3b7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x3b7d[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xd3b7('0x0'));var util=require(_0xd3b7('0x1'));var path=require('path');var timeout=require(_0xd3b7('0x2'));var express=require(_0xd3b7('0x3'));var router=express[_0xd3b7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd3b7('0x5'));var interaction=require(_0xd3b7('0x6'));var config=require(_0xd3b7('0x7'));var controller=require(_0xd3b7('0x8'));router[_0xd3b7('0x9')]('/',auth[_0xd3b7('0xa')](),controller[_0xd3b7('0xb')]);router['get'](_0xd3b7('0xc'),auth[_0xd3b7('0xa')](),controller[_0xd3b7('0xd')]);router['get']('/:id/preview',auth['isAuthenticated'](),controller[_0xd3b7('0xe')]);router[_0xd3b7('0x9')](_0xd3b7('0xf'),auth[_0xd3b7('0xa')](),controller[_0xd3b7('0x10')]);router[_0xd3b7('0x9')](_0xd3b7('0x11'),auth[_0xd3b7('0xa')](),controller['query']);router[_0xd3b7('0x12')]('/',auth[_0xd3b7('0xa')](),controller[_0xd3b7('0x13')]);router[_0xd3b7('0x14')](_0xd3b7('0xc'),auth[_0xd3b7('0xa')](),controller[_0xd3b7('0x15')]);router[_0xd3b7('0x16')](_0xd3b7('0xc'),auth[_0xd3b7('0xa')](),controller[_0xd3b7('0x17')]);module[_0xd3b7('0x18')]=router; \ No newline at end of file +var _0x0f10=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','preview','/:id/run','isAuthenticated','run','/:id/query','post','create','delete'];(function(_0x2e05ee,_0x480606){var _0x4d493d=function(_0x52cfa1){while(--_0x52cfa1){_0x2e05ee['push'](_0x2e05ee['shift']());}};_0x4d493d(++_0x480606);}(_0x0f10,0x14c));var _0x00f1=function(_0x2fafa1,_0x47bcbd){_0x2fafa1=_0x2fafa1-0x0;var _0x5c4c7c=_0x0f10[_0x2fafa1];return _0x5c4c7c;};'use strict';var multer=require(_0x00f1('0x0'));var util=require('util');var path=require(_0x00f1('0x1'));var timeout=require(_0x00f1('0x2'));var express=require(_0x00f1('0x3'));var router=express[_0x00f1('0x4')]();var fs_extra=require(_0x00f1('0x5'));var auth=require(_0x00f1('0x6'));var interaction=require(_0x00f1('0x7'));var config=require(_0x00f1('0x8'));var controller=require('./analyticCustomReport.controller');router[_0x00f1('0x9')]('/',auth['isAuthenticated'](),controller[_0x00f1('0xa')]);router[_0x00f1('0x9')](_0x00f1('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x00f1('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0x00f1('0xc')]);router[_0x00f1('0x9')](_0x00f1('0xd'),auth[_0x00f1('0xe')](),controller[_0x00f1('0xf')]);router[_0x00f1('0x9')](_0x00f1('0x10'),auth[_0x00f1('0xe')](),controller['query']);router[_0x00f1('0x11')]('/',auth[_0x00f1('0xe')](),controller[_0x00f1('0x12')]);router['put'](_0x00f1('0xb'),auth[_0x00f1('0xe')](),controller['update']);router[_0x00f1('0x13')](_0x00f1('0xb'),auth[_0x00f1('0xe')](),controller[_0x00f1('0x14')]);module[_0x00f1('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 3a7bfbb..30f6ce9 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 _0x53ec=['STRING','TEXT','sequelize','exports'];(function(_0x3d0048,_0x301f8c){var _0x381c11=function(_0x4025aa){while(--_0x4025aa){_0x3d0048['push'](_0x3d0048['shift']());}};_0x381c11(++_0x301f8c);}(_0x53ec,0x192));var _0xc53e=function(_0x4da749,_0x33272a){_0x4da749=_0x4da749-0x0;var _0x59afaf=_0x53ec[_0x4da749];return _0x59afaf;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc53e('0x2')]},'parent':{'type':Sequelize[_0xc53e('0x2')]},'table':{'type':Sequelize[_0xc53e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xc53e('0x3')]}}; \ No newline at end of file +var _0x3eea=['STRING','TEXT','sequelize'];(function(_0x123783,_0x2d5fbd){var _0x34a185=function(_0x143d32){while(--_0x143d32){_0x123783['push'](_0x123783['shift']());}};_0x34a185(++_0x2d5fbd);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x2a7051,_0x19df2a){_0x2a7051=_0x2a7051-0x0;var _0x1fcf2f=_0x3eea[_0x2a7051];return _0x1fcf2f;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 2d30d68..8fac1bf 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 _0x4975=['set','Content-Range','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','role','user','Reports','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','SUM(%s)','COUNT(%s)','MAX(%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)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignKey','foreignTable','conditions','parse','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','HOUR(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','getFields','replace','clone','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x41d3e4,_0x13428f){var _0x414240=function(_0x5254a6){while(--_0x5254a6){_0x41d3e4['push'](_0x41d3e4['shift']());}};_0x414240(++_0x13428f);}(_0x4975,0x86));var _0x5497=function(_0x2ec4c0,_0x4c676e){_0x2ec4c0=_0x2ec4c0-0x0;var _0x800a40=_0x4975[_0x2ec4c0];return _0x800a40;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];var dbH=require(_0x5497('0x17'))[_0x5497('0x18')];function respondWithStatusCode(_0x984990,_0x747dc7){_0x747dc7=_0x747dc7||0xcc;return function(_0x365144){if(_0x365144){return _0x984990[_0x5497('0x19')](_0x747dc7);}return _0x984990[_0x5497('0x1a')](_0x747dc7)[_0x5497('0x1b')]();};}function respondWithResult(_0x1a4c74,_0x55f590){_0x55f590=_0x55f590||0xc8;return function(_0x11b0a9){if(_0x11b0a9){return _0x1a4c74['status'](_0x55f590)[_0x5497('0x1c')](_0x11b0a9);}};}function respondWithFilteredResult(_0x2bfd8a,_0x19e5f3){return function(_0x3ce50b){if(_0x3ce50b){var _0x37c18e=typeof _0x19e5f3[_0x5497('0x1d')]===_0x5497('0x1e')&&typeof _0x19e5f3['limit']==='undefined';var _0x3f4d20=_0x3ce50b[_0x5497('0x1f')];var _0x3a47fd=_0x37c18e?0x0:_0x19e5f3['offset'];var _0xbf1ba7=_0x37c18e?_0x3ce50b[_0x5497('0x1f')]:_0x19e5f3[_0x5497('0x1d')]+_0x19e5f3[_0x5497('0x20')];var _0x1b1b43;if(_0xbf1ba7>=_0x3f4d20){_0xbf1ba7=_0x3f4d20;_0x1b1b43=0xc8;}else{_0x1b1b43=0xce;}_0x2bfd8a[_0x5497('0x1a')](_0x1b1b43);return _0x2bfd8a[_0x5497('0x21')](_0x5497('0x22'),_0x3a47fd+'-'+_0xbf1ba7+'/'+_0x3f4d20)[_0x5497('0x1c')](_0x3ce50b);}return null;};}function patchUpdates(_0x3f54ef){return function(_0x186065){try{jsonpatch['apply'](_0x186065,_0x3f54ef,!![]);}catch(_0x720767){return BPromise['reject'](_0x720767);}return _0x186065[_0x5497('0x23')]();};}function saveUpdates(_0xd0868d,_0x44265c){return function(_0x2f587d){if(_0x2f587d){return _0x2f587d[_0x5497('0x24')](_0xd0868d)[_0x5497('0x25')](function(_0x5018fa){return _0x5018fa;});}return null;};}function removeEntity(_0x54043a,_0x1eefce){return function(_0x34b97f){if(_0x34b97f){return _0x34b97f[_0x5497('0x26')]()[_0x5497('0x25')](function(){var _0x5223b5=_0x34b97f[_0x5497('0x27')]({'plain':!![]});var _0x57268c=_0x5497('0x28');return db[_0x5497('0x29')][_0x5497('0x26')]({'where':{'type':_0x57268c,'resourceId':_0x5223b5['id']}})[_0x5497('0x25')](function(){return _0x34b97f;});})[_0x5497('0x25')](function(){_0x54043a[_0x5497('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4af5f4,_0x5406e2){return function(_0x583d06){if(!_0x583d06){_0x4af5f4['sendStatus'](0x194);}return _0x583d06;};}function handleError(_0x39a2b7,_0x48d146){_0x48d146=_0x48d146||0x1f4;return function(_0x5e9356){logger[_0x5497('0x2a')](_0x5e9356[_0x5497('0x2b')]);if(_0x5e9356[_0x5497('0x2c')]){delete _0x5e9356['name'];}_0x39a2b7['status'](_0x48d146)['send'](_0x5e9356);};}exports[_0x5497('0x2d')]=function(_0x471e0b,_0xf4c117){var _0x5b8f79={},_0x489f71={},_0x594866={'count':0x0,'rows':[]};var _0xa28dd8=_['map'](db[_0x5497('0x2e')][_0x5497('0x2f')],function(_0x77c575){return{'name':_0x77c575['fieldName'],'type':_0x77c575[_0x5497('0x30')][_0x5497('0x31')]};});_0x489f71['model']=_[_0x5497('0x32')](_0xa28dd8,_0x5497('0x2c'));_0x489f71[_0x5497('0x33')]=_['keys'](_0x471e0b[_0x5497('0x33')]);_0x489f71[_0x5497('0x34')]=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],_0x489f71[_0x5497('0x33')]);_0x5b8f79['attributes']=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],qs['fields'](_0x471e0b[_0x5497('0x33')][_0x5497('0x37')]));_0x5b8f79[_0x5497('0x38')]=_0x5b8f79[_0x5497('0x38')][_0x5497('0x39')]?_0x5b8f79[_0x5497('0x38')]:_0x489f71['model'];if(!_0x471e0b[_0x5497('0x33')]['hasOwnProperty'](_0x5497('0x3a'))){_0x5b8f79[_0x5497('0x20')]=qs[_0x5497('0x20')](_0x471e0b['query']['limit']);_0x5b8f79[_0x5497('0x1d')]=qs[_0x5497('0x1d')](_0x471e0b[_0x5497('0x33')][_0x5497('0x1d')]);}_0x5b8f79[_0x5497('0x3b')]=qs[_0x5497('0x3c')](_0x471e0b['query'][_0x5497('0x3c')]);_0x5b8f79[_0x5497('0x3d')]=qs[_0x5497('0x34')](_[_0x5497('0x3e')](_0x471e0b[_0x5497('0x33')],_0x489f71[_0x5497('0x34')]),_0xa28dd8);if(_0x471e0b[_0x5497('0x33')][_0x5497('0x3f')]){_0x5b8f79[_0x5497('0x3d')]=_['merge'](_0x5b8f79[_0x5497('0x3d')],{'$or':_[_0x5497('0x32')](_0xa28dd8,function(_0x1e9616){if(_0x1e9616[_0x5497('0x30')]!==_0x5497('0x40')){var _0xa5ebe6={};_0xa5ebe6[_0x1e9616[_0x5497('0x2c')]]={'$like':'%'+_0x471e0b['query'][_0x5497('0x3f')]+'%'};return _0xa5ebe6;}})});}_0x5b8f79=_[_0x5497('0x41')]({},_0x5b8f79,_0x471e0b[_0x5497('0x42')]);var _0x35993c={'where':_0x5b8f79[_0x5497('0x3d')]};return db[_0x5497('0x2e')][_0x5497('0x1f')](_0x35993c)['then'](function(_0x2137bd){_0x594866[_0x5497('0x1f')]=_0x2137bd;if(_0x471e0b[_0x5497('0x33')][_0x5497('0x43')]){_0x5b8f79[_0x5497('0x44')]=[{'all':!![]}];}return db[_0x5497('0x2e')][_0x5497('0x45')](_0x5b8f79);})[_0x5497('0x25')](function(_0x2021ae){_0x594866[_0x5497('0x46')]=_0x2021ae;return _0x594866;})['then'](respondWithFilteredResult(_0xf4c117,_0x5b8f79))[_0x5497('0x47')](handleError(_0xf4c117,null));};exports['show']=function(_0x40822a,_0x9fc24){var _0x26ef01={'raw':!![],'where':{'id':_0x40822a[_0x5497('0x48')]['id']}},_0x3602ec={};_0x3602ec['model']=_[_0x5497('0x49')](db[_0x5497('0x2e')]['rawAttributes']);_0x3602ec[_0x5497('0x33')]=_['keys'](_0x40822a[_0x5497('0x33')]);_0x3602ec['filters']=_[_0x5497('0x35')](_0x3602ec[_0x5497('0x36')],_0x3602ec[_0x5497('0x33')]);_0x26ef01[_0x5497('0x38')]=_[_0x5497('0x35')](_0x3602ec['model'],qs['fields'](_0x40822a['query']['fields']));_0x26ef01[_0x5497('0x38')]=_0x26ef01[_0x5497('0x38')][_0x5497('0x39')]?_0x26ef01[_0x5497('0x38')]:_0x3602ec[_0x5497('0x36')];if(_0x40822a[_0x5497('0x33')][_0x5497('0x43')]){_0x26ef01[_0x5497('0x44')]=[{'all':!![]}];}_0x26ef01=_[_0x5497('0x41')]({},_0x26ef01,_0x40822a['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x26ef01)[_0x5497('0x25')](handleEntityNotFound(_0x9fc24,null))['then'](respondWithResult(_0x9fc24,null))[_0x5497('0x47')](handleError(_0x9fc24,null));};exports['create']=function(_0x12ffbc,_0x31f1ba){return db[_0x5497('0x2e')]['create'](_0x12ffbc[_0x5497('0x4b')],{})[_0x5497('0x25')](function(_0x515c3e){var _0x3abc92=_0x12ffbc['user'][_0x5497('0x27')]({'plain':!![]});if(!_0x3abc92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abc92[_0x5497('0x4c')]===_0x5497('0x4d')){var _0x26fd9f=_0x515c3e[_0x5497('0x27')]({'plain':!![]});var _0x25e80c=_0x5497('0x4e');return db[_0x5497('0x4f')][_0x5497('0x4a')]({'where':{'name':_0x25e80c,'userProfileId':_0x3abc92['userProfileId']},'raw':!![]})[_0x5497('0x25')](function(_0x5b2c22){if(_0x5b2c22&&_0x5b2c22['autoAssociation']===0x0){return db[_0x5497('0x29')][_0x5497('0x50')]({'name':_0x26fd9f['name'],'resourceId':_0x26fd9f['id'],'type':_0x5497('0x28'),'sectionId':_0x5b2c22['id']},{})[_0x5497('0x25')](function(){return _0x515c3e;});}else{return _0x515c3e;}})[_0x5497('0x47')](function(_0x3094c7){logger['error'](_0x5497('0x51'),_0x3094c7);throw _0x3094c7;});}return _0x515c3e;})['then'](respondWithResult(_0x31f1ba,0xc9))['catch'](handleError(_0x31f1ba,null));};exports[_0x5497('0x24')]=function(_0x33dd07,_0x2f7ec8){if(_0x33dd07['body']['id']){delete _0x33dd07['body']['id'];}return db[_0x5497('0x2e')]['find']({'where':{'id':_0x33dd07[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f7ec8,null))[_0x5497('0x25')](saveUpdates(_0x33dd07['body'],null))[_0x5497('0x25')](respondWithResult(_0x2f7ec8,null))[_0x5497('0x47')](handleError(_0x2f7ec8,null));};exports['destroy']=function(_0x418f17,_0x5dccfb){return db['AnalyticDefaultReport'][_0x5497('0x4a')]({'where':{'id':_0x418f17[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dccfb,null))[_0x5497('0x25')](removeEntity(_0x5dccfb,null))[_0x5497('0x47')](handleError(_0x5dccfb,null));};exports[_0x5497('0x52')]=function(_0x28b2a3,_0x3fca40){var _0x25c75e=0xa;var _0x590be7=[_0x5497('0x53'),'left_join','right_join','cross_join'];var _0x1f3965={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5497('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x25f349={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x425995=function(_0xc783ce){return!_['includes']([_0x5497('0x5e'),_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0xc783ce);};var _0x5823f6=function(_0x31271c){if(!_0x31271c||!_0x31271c[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x542bcf='(',_0x1ab48f=0x0;_0x1ab48f<_0x31271c['rules']['length'];_0x1ab48f+=0x1){_0x1ab48f>0x0&&(_0x542bcf+='\x20'+_0x31271c['operator']+'\x20');_0x542bcf+=_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x63')]?_0x5823f6(_0x31271c[_0x5497('0x62')][_0x1ab48f]['group']):_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x64')]+'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x65')]+(_0x425995(_0x31271c['rules'][_0x1ab48f][_0x5497('0x65')])?'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x66')]:'');}return _0x542bcf+')';};var _0x49617c={'where':{'id':_0x28b2a3[_0x5497('0x48')]['id']}},_0x164de1,_0x465bed,_0xb3eec2,_0x4368e3,_0x1467c4;_0x49617c=_[_0x5497('0x41')]({},_0x49617c,_0x28b2a3['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x49617c)[_0x5497('0x25')](function(_0x20efea){if(_0x20efea){_0x164de1=_0x20efea;return _0x20efea['getFields']();}return null;})['then'](function(_0x4a7360){if(_0x4a7360){if(!_0x4a7360[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x465bed=_0x4a7360;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x464df3){if(_0x464df3){_0xb3eec2=_[_0x5497('0x6a')](_0x464df3,'id');var _0x4338d4;var _0x3f38bf=squel[_0x5497('0x6b')]();_0x3f38bf[_0x5497('0x6c')](_0x164de1[_0x5497('0x6d')]);for(var _0x1fc6ad=0x0;_0x1fc6ad<_0x465bed['length'];_0x1fc6ad+=0x1){_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x6e')]?_0xb3eec2[_0x465bed[_0x1fc6ad][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x465bed[_0x1fc6ad]['field'];_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x70')]?_['replace'](_0x1f3965[_0x465bed[_0x1fc6ad][_0x5497('0x70')]],'%s',_0x4338d4):_0x4338d4;_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x71')]?_['replace'](_0x25f349[_0x465bed[_0x1fc6ad][_0x5497('0x71')]],'%s',_0x4338d4):_0x4338d4;if(_0x465bed[_0x1fc6ad][_0x5497('0x72')]){_0x3f38bf[_0x5497('0x63')](_0x4338d4);}_0x465bed[_0x1fc6ad][_0x5497('0x73')]&&_0x3f38bf['order'](_0x4338d4,_0x465bed[_0x1fc6ad][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x3f38bf[_0x5497('0x64')](_0x4338d4,_0x465bed[_0x1fc6ad]['alias']||_0x4338d4);}if(_0x164de1[_0x5497('0x75')]){_0x164de1[_0x5497('0x75')]=JSON['parse'](_0x164de1[_0x5497('0x75')]);for(var _0xebe694=0x0;_0xebe694<_0x164de1[_0x5497('0x75')]['length'];_0xebe694+=0x1){if(_0x164de1['joins'][_0xebe694][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x590be7,_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x30')])&&_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x77')]&&_0x164de1[_0x5497('0x75')][_0xebe694]['foreignTable']&&_0x164de1['joins'][_0xebe694][_0x5497('0x78')]){_0x3f38bf[_0x164de1[_0x5497('0x75')][_0xebe694]['type']](_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],null,util[_0x5497('0x71')]('%s.%s\x20=\x20%s.%s',_0x164de1[_0x5497('0x6d')],_0x164de1[_0x5497('0x75')][_0xebe694]['parentKey'],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x78')]));}}}if(_0x164de1[_0x5497('0x7a')]){_0x164de1['conditions']=JSON[_0x5497('0x7b')](_0x164de1[_0x5497('0x7a')]);_0x3f38bf[_0x5497('0x3d')](_0x5823f6(_0x164de1[_0x5497('0x7a')][_0x5497('0x63')]));}_0x1467c4=_0x3f38bf['clone']();_0x3f38bf[_0x5497('0x20')](_0x25c75e);_0x3f38bf[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')](_0x5497('0x7d'),_0x3f38bf['toString']());return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x3f38bf['toString'](),{'type':dbH[_0x5497('0x7e')][_0x5497('0x7f')][_0x5497('0x80')]});}})[_0x5497('0x25')](respondWithResult(_0x3fca40,null))['catch'](handleError(_0x3fca40,null));};function runReport(_0x547de7,_0x4ff64f,_0x5343d5){var _0x594761=_0x4ff64f[_0x5497('0x2c')];var _0x2375cc=0xa;var _0x15d0da=[_0x5497('0x53'),_0x5497('0x81'),'right_join','cross_join'];var _0x392987={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x4c41c4={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x22b019=function(_0x4aa4ba){return!_[_0x5497('0x76')](['IS\x20NULL',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0x4aa4ba);};var _0x5b0f9d=function(_0x59960b){if(!_0x59960b||!_0x59960b[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x953b31='(',_0xeb52c9=0x0;_0xeb52c9<_0x59960b[_0x5497('0x62')][_0x5497('0x39')];_0xeb52c9+=0x1){_0xeb52c9>0x0&&(_0x953b31+='\x20'+_0x59960b[_0x5497('0x86')]+'\x20');_0x953b31+=_0x59960b[_0x5497('0x62')][_0xeb52c9]['group']?_0x5b0f9d(_0x59960b['rules'][_0xeb52c9]['group']):_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x64')]+'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x65')]+(_0x22b019(_0x59960b['rules'][_0xeb52c9]['condition'])?'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x66')]:'');}return _0x953b31+')';};var _0x5dd9bc={'where':{'id':_0x547de7['id']}},_0x83b240,_0x2fc11a,_0x3ce2ee,_0x36c09f,_0x51e9fb;_0x5dd9bc=_['merge']({},_0x5dd9bc,_0x5343d5);return db['AnalyticDefaultReport']['find'](_0x5dd9bc)['then'](function(_0x497295){if(_0x497295){_0x83b240=_0x497295;return _0x497295['getFields']();}return null;})[_0x5497('0x25')](function(_0x5aa5e1){if(_0x5aa5e1){if(!_0x5aa5e1[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))](_0x5497('0x87'),0x193);}_0x2fc11a=_0x5aa5e1;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})['then'](function(_0x77d52c){if(_0x77d52c){_0x3ce2ee=_['keyBy'](_0x77d52c,'id');var _0x15a67d;var _0x2721b2=squel[_0x5497('0x6b')]();_0x2721b2[_0x5497('0x6c')](_0x83b240[_0x5497('0x6d')]);for(var _0x38fa59=0x0;_0x38fa59<_0x2fc11a[_0x5497('0x39')];_0x38fa59+=0x1){_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x6e')]?_0x3ce2ee[_0x2fc11a[_0x38fa59][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x2fc11a[_0x38fa59]['field'];_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x70')]?_['replace'](_0x392987[_0x2fc11a[_0x38fa59][_0x5497('0x70')]],'%s',_0x15a67d):_0x15a67d;_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x71')]?_['replace'](_0x4c41c4[_0x2fc11a[_0x38fa59][_0x5497('0x71')]],'%s',_0x15a67d):_0x15a67d;if(_0x2fc11a[_0x38fa59][_0x5497('0x72')]){_0x2721b2[_0x5497('0x63')](_0x15a67d);}_0x2fc11a[_0x38fa59][_0x5497('0x73')]&&_0x2721b2[_0x5497('0x3b')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x2721b2[_0x5497('0x64')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x88')]||_0x15a67d);}if(_0x83b240[_0x5497('0x75')]){_0x83b240[_0x5497('0x75')]=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x75')]);for(var _0x22426e=0x0;_0x22426e<_0x83b240['joins'][_0x5497('0x39')];_0x22426e+=0x1){if(_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x15d0da,_0x83b240[_0x5497('0x75')][_0x22426e]['type'])&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')]&&_0x83b240['joins'][_0x22426e]['foreignTable']&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]){_0x2721b2[_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]](_0x83b240[_0x5497('0x75')][_0x22426e]['foreignTable'],null,util['format'](_0x5497('0x89'),_0x83b240['table'],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x79')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]));}}}if(_0x83b240['conditions']){_0x83b240['conditions']=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x7a')]);_0x2721b2[_0x5497('0x3d')](_0x5b0f9d(_0x83b240['conditions'][_0x5497('0x63')]));}_0x51e9fb=_0x2721b2['clone']();_0x2721b2[_0x5497('0x20')](_0x2375cc);_0x2721b2['offset'](0x0);return;}})['then'](function(){if(_0x4ff64f[_0x5497('0x8a')]===_0x5497('0x8b')){return null;}var _0x4ce768=_[_0x5497('0x41')](_0x4ff64f,{'name':_0x4ff64f[_0x5497('0x8c')]||_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],'basename':_0x594761,'savename':util['format'](_0x5497('0x8d'),_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],require(_0x5497('0x8e'))[_0x5497('0x8f')](0x4),_0x4ff64f['output']||_0x5497('0x90')),'reportId':_0x83b240['id'],'reportType':'default'});return db[_0x5497('0x91')][_0x5497('0x50')](_0x4ce768,{'raw':!![]});})[_0x5497('0x25')](function(_0x314db4){if(_0x83b240[_0x5497('0x6d')]===_0x5497('0x92')){_0x51e9fb[_0x5497('0x3d')](_0x83b240[_0x5497('0x6d')]+_0x5497('0x93'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}else{_0x51e9fb['where'](_0x83b240[_0x5497('0x6d')]+_0x5497('0x96'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}if(_0x314db4){logger[_0x5497('0x97')](_0x5497('0x98'),_0x51e9fb[_0x5497('0x99')]());require(_0x5497('0x9a'))[_0x5497('0x9b')](path[_0x5497('0x53')](__dirname,_0x5497('0x9c'),_0x314db4['output']),[_0x314db4['id'],_0x51e9fb[_0x5497('0x99')](),path[_0x5497('0x53')](__dirname,_0x5497('0x9d'),_0x314db4[_0x5497('0x9e')]),_0x594761]);return _0x314db4;}else{var _0x46be08=squel[_0x5497('0x6b')]();_0x46be08[_0x5497('0x6c')]('('+_0x51e9fb[_0x5497('0x99')]()+')',_0x5497('0x9f'));_0x46be08[_0x5497('0x64')](_0x5497('0xa0'),_0x5497('0x1f'));_0x51e9fb[_0x5497('0x20')](_0x4ff64f[_0x5497('0x20')]||_0x2375cc);_0x51e9fb['offset'](_0x4ff64f['offset']||0x0);return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x46be08[_0x5497('0x99')](),{'type':dbH['sequelize'][_0x5497('0x7f')][_0x5497('0x80')]})[_0x5497('0x25')](function(_0x2bd48c){if(!_0x2bd48c[_0x5497('0x39')]){_0x36c09f=0x0;}else{_0x36c09f=_0x2bd48c[0x0][_0x5497('0x1f')]||0x0;}return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x51e9fb['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5497('0x80')]});})[_0x5497('0x25')](function(_0x4dab6a){return{'rows':_0x4dab6a||[],'count':_0x36c09f};});}});}exports[_0x5497('0xa1')]=function(_0x27f42b,_0x1bef85){return runReport(_0x27f42b['params'],_0x27f42b[_0x5497('0x33')],_0x27f42b['options'])[_0x5497('0x25')](respondWithResult(_0x1bef85,null))[_0x5497('0x47')](handleError(_0x1bef85,null));};exports[_0x5497('0xa2')]=runReport;exports['query']=function(_0x1c3dad,_0xfba062){var _0x494cc3=0xa;var _0x401f04=[_0x5497('0x53'),_0x5497('0x81'),'right_join',_0x5497('0xa3')];var _0x1a5c32={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x1dfb76={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x5c2517=function(_0x367929){return!_[_0x5497('0x76')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5497('0x60'),_0x5497('0x61')],_0x367929);};var _0x2fd2e3=function(_0x2fe770){if(!_0x2fe770||!_0x2fe770['rules'][_0x5497('0x39')]){return'';}for(var _0x1299cd='(',_0x4c2b14=0x0;_0x4c2b14<_0x2fe770['rules'][_0x5497('0x39')];_0x4c2b14+=0x1){_0x4c2b14>0x0&&(_0x1299cd+='\x20'+_0x2fe770[_0x5497('0x86')]+'\x20');_0x1299cd+=_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x63')]?_0x2fd2e3(_0x2fe770[_0x5497('0x62')][_0x4c2b14]['group']):_0x2fe770['rules'][_0x4c2b14][_0x5497('0x64')]+'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14]['condition']+(_0x5c2517(_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x65')])?'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x66')]:'');}return _0x1299cd+')';};var _0x358ec5={'where':{'id':_0x1c3dad['params']['id']}},_0x5cddbc,_0x188d21,_0xf92129,_0x2d5cc1,_0x4f9228;_0x358ec5=_[_0x5497('0x41')]({},_0x358ec5,_0x1c3dad[_0x5497('0x42')]);return db[_0x5497('0x2e')]['find'](_0x358ec5)[_0x5497('0x25')](function(_0x30a248){if(_0x30a248){_0x5cddbc=_0x30a248;return _0x30a248[_0x5497('0xa4')]();}return null;})['then'](function(_0x1d4c76){if(_0x1d4c76){if(!_0x1d4c76[_0x5497('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5497('0x87'),0x193);}_0x188d21=_0x1d4c76;return db[_0x5497('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x5001d5){if(_0x5001d5){_0xf92129=_[_0x5497('0x6a')](_0x5001d5,'id');var _0x2c58e6;var _0x300f3e=squel[_0x5497('0x6b')]();_0x300f3e[_0x5497('0x6c')](_0x5cddbc[_0x5497('0x6d')]);for(var _0x23732d=0x0;_0x23732d<_0x188d21['length'];_0x23732d+=0x1){_0x2c58e6=_0x188d21[_0x23732d]['MetricId']?_0xf92129[_0x188d21[_0x23732d][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x188d21[_0x23732d]['field'];_0x2c58e6=_0x188d21[_0x23732d]['function']?_[_0x5497('0xa5')](_0x1a5c32[_0x188d21[_0x23732d][_0x5497('0x70')]],'%s',_0x2c58e6):_0x2c58e6;_0x2c58e6=_0x188d21[_0x23732d][_0x5497('0x71')]?_[_0x5497('0xa5')](_0x1dfb76[_0x188d21[_0x23732d][_0x5497('0x71')]],'%s',_0x2c58e6):_0x2c58e6;if(_0x188d21[_0x23732d][_0x5497('0x72')]){_0x300f3e['group'](_0x2c58e6);}_0x188d21[_0x23732d][_0x5497('0x73')]&&_0x300f3e[_0x5497('0x3b')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x300f3e[_0x5497('0x64')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x88')]||_0x2c58e6);}if(_0x5cddbc['joins']){_0x5cddbc[_0x5497('0x75')]=JSON['parse'](_0x5cddbc[_0x5497('0x75')]);for(var _0x261804=0x0;_0x261804<_0x5cddbc[_0x5497('0x75')]['length'];_0x261804+=0x1){if(_0x5cddbc[_0x5497('0x75')][_0x261804]['type']&&_['includes'](_0x401f04,_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')])&&_0x5cddbc['joins'][_0x261804][_0x5497('0x77')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]){_0x300f3e[_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')]](_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],null,util['format'](_0x5497('0x89'),_0x5cddbc[_0x5497('0x6d')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x77')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]));}}}if(_0x5cddbc[_0x5497('0x7a')]){_0x5cddbc[_0x5497('0x7a')]=JSON[_0x5497('0x7b')](_0x5cddbc[_0x5497('0x7a')]);_0x300f3e[_0x5497('0x3d')](_0x2fd2e3(_0x5cddbc[_0x5497('0x7a')][_0x5497('0x63')]));}_0x4f9228=_0x300f3e[_0x5497('0xa6')]();_0x300f3e[_0x5497('0x20')](_0x494cc3);_0x300f3e[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')]('Limited\x20Query:',_0x300f3e[_0x5497('0x99')]());return dbH[_0x5497('0x7e')]['query'](_0x300f3e['toString'](),{'type':dbH[_0x5497('0x7e')]['QueryTypes'][_0x5497('0x80')]});}})[_0x5497('0x25')](function(){return{'sql':_0x4f9228[_0x5497('0x99')]()};})[_0x5497('0x25')](respondWithResult(_0xfba062,null))[_0x5497('0x47')](handleError(_0xfba062,null));}; \ No newline at end of file +var _0x4819=['keyBy','table','metric','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','from','countTable','COUNT(*)','SELECT','run','cross_join','COUNT(DISTINCT\x20%s)','debug','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','AnalyticDefaultReport','includeAll','include','findAll','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','body','preview','join','left_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','MetricId','function','replace','format','groupBy','group','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','conditions','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20NULL','IS\x20EMPTY','operator','condition'];(function(_0x50d77f,_0x1a76da){var _0x477ae3=function(_0x358ee2){while(--_0x358ee2){_0x50d77f['push'](_0x50d77f['shift']());}};_0x477ae3(++_0x1a76da);}(_0x4819,0xcd));var _0x9481=function(_0x18fd0b,_0xe0f9ed){_0x18fd0b=_0x18fd0b-0x0;var _0x3b19a3=_0x4819[_0x18fd0b];return _0x3b19a3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];var dbH=require(_0x9481('0x19'))['dbH'];function respondWithStatusCode(_0x5aac02,_0xce6fa2){_0xce6fa2=_0xce6fa2||0xcc;return function(_0x150276){if(_0x150276){return _0x5aac02[_0x9481('0x1a')](_0xce6fa2);}return _0x5aac02[_0x9481('0x1b')](_0xce6fa2)[_0x9481('0x1c')]();};}function respondWithResult(_0xc7a0b5,_0x3fb97f){_0x3fb97f=_0x3fb97f||0xc8;return function(_0x495b30){if(_0x495b30){return _0xc7a0b5[_0x9481('0x1b')](_0x3fb97f)[_0x9481('0x1d')](_0x495b30);}};}function respondWithFilteredResult(_0x5b1fe6,_0x2266d5){return function(_0x518150){if(_0x518150){var _0x34108d=typeof _0x2266d5[_0x9481('0x1e')]===_0x9481('0x1f')&&typeof _0x2266d5[_0x9481('0x20')]==='undefined';var _0x5eda66=_0x518150[_0x9481('0x21')];var _0x50a559=_0x34108d?0x0:_0x2266d5['offset'];var _0x26671c=_0x34108d?_0x518150[_0x9481('0x21')]:_0x2266d5[_0x9481('0x1e')]+_0x2266d5[_0x9481('0x20')];var _0x7000e7;if(_0x26671c>=_0x5eda66){_0x26671c=_0x5eda66;_0x7000e7=0xc8;}else{_0x7000e7=0xce;}_0x5b1fe6[_0x9481('0x1b')](_0x7000e7);return _0x5b1fe6['set'](_0x9481('0x22'),_0x50a559+'-'+_0x26671c+'/'+_0x5eda66)[_0x9481('0x1d')](_0x518150);}return null;};}function patchUpdates(_0x45f9df){return function(_0x615e02){try{jsonpatch[_0x9481('0x23')](_0x615e02,_0x45f9df,!![]);}catch(_0x56da97){return BPromise[_0x9481('0x24')](_0x56da97);}return _0x615e02[_0x9481('0x25')]();};}function saveUpdates(_0x572599,_0x2bcf37){return function(_0xd1cd1a){if(_0xd1cd1a){return _0xd1cd1a[_0x9481('0x26')](_0x572599)[_0x9481('0x27')](function(_0x2dc02e){return _0x2dc02e;});}return null;};}function removeEntity(_0x49ecfa,_0x91e3d9){return function(_0x22f0b5){if(_0x22f0b5){return _0x22f0b5['destroy']()['then'](function(){var _0x12b0c3=_0x22f0b5[_0x9481('0x28')]({'plain':!![]});var _0x550fce=_0x9481('0x29');return db[_0x9481('0x2a')][_0x9481('0x2b')]({'where':{'type':_0x550fce,'resourceId':_0x12b0c3['id']}})[_0x9481('0x27')](function(){return _0x22f0b5;});})['then'](function(){_0x49ecfa[_0x9481('0x1b')](0xcc)[_0x9481('0x1c')]();});}};}function handleEntityNotFound(_0x3c2585,_0x587706){return function(_0x1791b2){if(!_0x1791b2){_0x3c2585['sendStatus'](0x194);}return _0x1791b2;};}function handleError(_0x2e1eff,_0xe153ab){_0xe153ab=_0xe153ab||0x1f4;return function(_0x22ab26){logger[_0x9481('0x2c')](_0x22ab26[_0x9481('0x2d')]);if(_0x22ab26['name']){delete _0x22ab26[_0x9481('0x2e')];}_0x2e1eff[_0x9481('0x1b')](_0xe153ab)[_0x9481('0x2f')](_0x22ab26);};}exports['index']=function(_0x56752e,_0x1addc8){var _0x427c25={},_0x42df68={},_0x2b33f8={'count':0x0,'rows':[]};var _0x5d9926=_['map'](db['AnalyticDefaultReport'][_0x9481('0x30')],function(_0x5d6c65){return{'name':_0x5d6c65[_0x9481('0x31')],'type':_0x5d6c65['type'][_0x9481('0x32')]};});_0x42df68[_0x9481('0x33')]=_[_0x9481('0x34')](_0x5d9926,_0x9481('0x2e'));_0x42df68[_0x9481('0x35')]=_['keys'](_0x56752e[_0x9481('0x35')]);_0x42df68[_0x9481('0x36')]=_[_0x9481('0x37')](_0x42df68['model'],_0x42df68[_0x9481('0x35')]);_0x427c25[_0x9481('0x38')]=_[_0x9481('0x37')](_0x42df68[_0x9481('0x33')],qs[_0x9481('0x39')](_0x56752e[_0x9481('0x35')]['fields']));_0x427c25[_0x9481('0x38')]=_0x427c25['attributes'][_0x9481('0x3a')]?_0x427c25[_0x9481('0x38')]:_0x42df68[_0x9481('0x33')];if(!_0x56752e[_0x9481('0x35')][_0x9481('0x3b')](_0x9481('0x3c'))){_0x427c25['limit']=qs[_0x9481('0x20')](_0x56752e[_0x9481('0x35')]['limit']);_0x427c25['offset']=qs[_0x9481('0x1e')](_0x56752e['query'][_0x9481('0x1e')]);}_0x427c25[_0x9481('0x3d')]=qs[_0x9481('0x3e')](_0x56752e[_0x9481('0x35')]['sort']);_0x427c25[_0x9481('0x3f')]=qs['filters'](_[_0x9481('0x40')](_0x56752e['query'],_0x42df68[_0x9481('0x36')]),_0x5d9926);if(_0x56752e['query'][_0x9481('0x41')]){_0x427c25[_0x9481('0x3f')]=_[_0x9481('0x42')](_0x427c25[_0x9481('0x3f')],{'$or':_[_0x9481('0x34')](_0x5d9926,function(_0x3b7998){if(_0x3b7998[_0x9481('0x43')]!=='VIRTUAL'){var _0x464080={};_0x464080[_0x3b7998[_0x9481('0x2e')]]={'$like':'%'+_0x56752e[_0x9481('0x35')][_0x9481('0x41')]+'%'};return _0x464080;}})});}_0x427c25=_[_0x9481('0x42')]({},_0x427c25,_0x56752e[_0x9481('0x44')]);var _0x2e4241={'where':_0x427c25['where']};return db[_0x9481('0x45')][_0x9481('0x21')](_0x2e4241)['then'](function(_0x704e81){_0x2b33f8[_0x9481('0x21')]=_0x704e81;if(_0x56752e[_0x9481('0x35')][_0x9481('0x46')]){_0x427c25[_0x9481('0x47')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x9481('0x48')](_0x427c25);})['then'](function(_0x23811a){_0x2b33f8[_0x9481('0x49')]=_0x23811a;return _0x2b33f8;})['then'](respondWithFilteredResult(_0x1addc8,_0x427c25))['catch'](handleError(_0x1addc8,null));};exports[_0x9481('0x4a')]=function(_0x1d0df0,_0x42b19a){var _0x4c4caf={'raw':!![],'where':{'id':_0x1d0df0[_0x9481('0x4b')]['id']}},_0x4402f6={};_0x4402f6['model']=_['keys'](db[_0x9481('0x45')]['rawAttributes']);_0x4402f6[_0x9481('0x35')]=_[_0x9481('0x4c')](_0x1d0df0[_0x9481('0x35')]);_0x4402f6[_0x9481('0x36')]=_[_0x9481('0x37')](_0x4402f6['model'],_0x4402f6[_0x9481('0x35')]);_0x4c4caf[_0x9481('0x38')]=_['intersection'](_0x4402f6[_0x9481('0x33')],qs[_0x9481('0x39')](_0x1d0df0[_0x9481('0x35')][_0x9481('0x39')]));_0x4c4caf[_0x9481('0x38')]=_0x4c4caf[_0x9481('0x38')][_0x9481('0x3a')]?_0x4c4caf[_0x9481('0x38')]:_0x4402f6[_0x9481('0x33')];if(_0x1d0df0['query'][_0x9481('0x46')]){_0x4c4caf['include']=[{'all':!![]}];}_0x4c4caf=_['merge']({},_0x4c4caf,_0x1d0df0[_0x9481('0x44')]);return db['AnalyticDefaultReport'][_0x9481('0x4d')](_0x4c4caf)[_0x9481('0x27')](handleEntityNotFound(_0x42b19a,null))['then'](respondWithResult(_0x42b19a,null))[_0x9481('0x4e')](handleError(_0x42b19a,null));};exports[_0x9481('0x4f')]=function(_0x2f3413,_0x13b674){return db[_0x9481('0x45')][_0x9481('0x4f')](_0x2f3413['body'],{})['then'](function(_0x424b22){var _0x44d7e0=_0x2f3413[_0x9481('0x50')][_0x9481('0x28')]({'plain':!![]});if(!_0x44d7e0)throw new Error(_0x9481('0x51'));if(_0x44d7e0[_0x9481('0x52')]===_0x9481('0x50')){var _0x3d2250=_0x424b22['get']({'plain':!![]});var _0x3972c1=_0x9481('0x53');return db[_0x9481('0x54')][_0x9481('0x4d')]({'where':{'name':_0x3972c1,'userProfileId':_0x44d7e0[_0x9481('0x55')]},'raw':!![]})['then'](function(_0x4c3048){if(_0x4c3048&&_0x4c3048[_0x9481('0x56')]===0x0){return db[_0x9481('0x2a')][_0x9481('0x4f')]({'name':_0x3d2250['name'],'resourceId':_0x3d2250['id'],'type':'DefaultReports','sectionId':_0x4c3048['id']},{})['then'](function(){return _0x424b22;});}else{return _0x424b22;}})['catch'](function(_0x538507){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x538507);throw _0x538507;});}return _0x424b22;})[_0x9481('0x27')](respondWithResult(_0x13b674,0xc9))[_0x9481('0x4e')](handleError(_0x13b674,null));};exports['update']=function(_0xd8351c,_0x5f210c){if(_0xd8351c[_0x9481('0x57')]['id']){delete _0xd8351c[_0x9481('0x57')]['id'];}return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0xd8351c[_0x9481('0x4b')]['id']}})[_0x9481('0x27')](handleEntityNotFound(_0x5f210c,null))[_0x9481('0x27')](saveUpdates(_0xd8351c['body'],null))[_0x9481('0x27')](respondWithResult(_0x5f210c,null))[_0x9481('0x4e')](handleError(_0x5f210c,null));};exports['destroy']=function(_0x16416a,_0x1240dc){return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0x16416a[_0x9481('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1240dc,null))[_0x9481('0x27')](removeEntity(_0x1240dc,null))[_0x9481('0x4e')](handleError(_0x1240dc,null));};exports[_0x9481('0x58')]=function(_0x3fc0f9,_0x559dd2){var _0x3ac428=0xa;var _0x2927f5=[_0x9481('0x59'),_0x9481('0x5a'),'right_join','cross_join'];var _0x5b4234={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x589b16={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x239676=function(_0x205b96){return!_['includes'](['IS\x20NULL',_0x9481('0x67'),'IS\x20EMPTY',_0x9481('0x68')],_0x205b96);};var _0x59637f=function(_0x9af916){if(!_0x9af916||!_0x9af916[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x492464='(',_0x28d331=0x0;_0x28d331<_0x9af916[_0x9481('0x69')]['length'];_0x28d331+=0x1){_0x28d331>0x0&&(_0x492464+='\x20'+_0x9af916['operator']+'\x20');_0x492464+=_0x9af916['rules'][_0x28d331]['group']?_0x59637f(_0x9af916[_0x9481('0x69')][_0x28d331]['group']):_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6a')]+'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331]['condition']+(_0x239676(_0x9af916[_0x9481('0x69')][_0x28d331]['condition'])?'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6b')]:'');}return _0x492464+')';};var _0x3c267b={'where':{'id':_0x3fc0f9[_0x9481('0x4b')]['id']}},_0x4f157d,_0x2f20b4,_0x40fed2,_0x4ff016,_0x321972;_0x3c267b=_[_0x9481('0x42')]({},_0x3c267b,_0x3fc0f9[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x3c267b)[_0x9481('0x27')](function(_0x32ebde){if(_0x32ebde){_0x4f157d=_0x32ebde;return _0x32ebde[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x237d9b){if(_0x237d9b){if(!_0x237d9b[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x2f20b4=_0x237d9b;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})['then'](function(_0x1e05f8){if(_0x1e05f8){_0x40fed2=_['keyBy'](_0x1e05f8,'id');var _0x47bf37;var _0x1a7892=squel['select']();_0x1a7892['from'](_0x4f157d['table']);for(var _0x1b1967=0x0;_0x1b1967<_0x2f20b4[_0x9481('0x3a')];_0x1b1967+=0x1){_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x71')]?_0x40fed2[_0x2f20b4[_0x1b1967][_0x9481('0x71')]]['metric']:_0x2f20b4[_0x1b1967][_0x9481('0x6a')];_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x72')]?_[_0x9481('0x73')](_0x5b4234[_0x2f20b4[_0x1b1967][_0x9481('0x72')]],'%s',_0x47bf37):_0x47bf37;_0x47bf37=_0x2f20b4[_0x1b1967]['format']?_['replace'](_0x589b16[_0x2f20b4[_0x1b1967][_0x9481('0x74')]],'%s',_0x47bf37):_0x47bf37;if(_0x2f20b4[_0x1b1967][_0x9481('0x75')]){_0x1a7892[_0x9481('0x76')](_0x47bf37);}_0x2f20b4[_0x1b1967][_0x9481('0x77')]&&_0x1a7892[_0x9481('0x3d')](_0x47bf37,_0x2f20b4[_0x1b1967]['orderBy']===_0x9481('0x78')?![]:!![]);_0x1a7892[_0x9481('0x6a')](_0x47bf37,_0x2f20b4[_0x1b1967][_0x9481('0x79')]||_0x47bf37);}if(_0x4f157d[_0x9481('0x7a')]){_0x4f157d[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x4f157d[_0x9481('0x7a')]);for(var _0x42a6d2=0x0;_0x42a6d2<_0x4f157d[_0x9481('0x7a')][_0x9481('0x3a')];_0x42a6d2+=0x1){if(_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2927f5,_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')])&&_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7d')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7e')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7f')]){_0x1a7892[_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]](_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x4f157d['table'],_0x4f157d[_0x9481('0x7a')][_0x42a6d2]['parentKey'],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7f')]));}}}if(_0x4f157d[_0x9481('0x80')]){_0x4f157d[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x4f157d['conditions']);_0x1a7892[_0x9481('0x3f')](_0x59637f(_0x4f157d['conditions'][_0x9481('0x76')]));}_0x321972=_0x1a7892[_0x9481('0x81')]();_0x1a7892[_0x9481('0x20')](_0x3ac428);_0x1a7892['offset'](0x0);logger['debug']('Limited\x20Query:',_0x1a7892[_0x9481('0x82')]());return dbH['sequelize']['query'](_0x1a7892[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')]['SELECT']});}})[_0x9481('0x27')](respondWithResult(_0x559dd2,null))[_0x9481('0x4e')](handleError(_0x559dd2,null));};function runReport(_0x545457,_0x226932,_0x3c8241){var _0x1ea93a=_0x226932[_0x9481('0x2e')];var _0x5f4be2=0xa;var _0x2e585d=['join',_0x9481('0x5a'),_0x9481('0x85'),'cross_join'];var _0x1c82a1={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x9481('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x55b428={'SEC_TO_TIME':_0x9481('0x86'),'DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9481('0x66')};var _0x31e097=function(_0x339a30){return!_[_0x9481('0x7c')]([_0x9481('0x87'),_0x9481('0x67'),_0x9481('0x88'),_0x9481('0x68')],_0x339a30);};var _0x22e787=function(_0x31b70b){if(!_0x31b70b||!_0x31b70b['rules'][_0x9481('0x3a')]){return'';}for(var _0x5c430e='(',_0x4f55b5=0x0;_0x4f55b5<_0x31b70b['rules'][_0x9481('0x3a')];_0x4f55b5+=0x1){_0x4f55b5>0x0&&(_0x5c430e+='\x20'+_0x31b70b[_0x9481('0x89')]+'\x20');_0x5c430e+=_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x76')]?_0x22e787(_0x31b70b[_0x9481('0x69')][_0x4f55b5]['group']):_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6a')]+'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')]+(_0x31e097(_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')])?'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6b')]:'');}return _0x5c430e+')';};var _0x28d924={'where':{'id':_0x545457['id']}},_0x426d56,_0x5808c8,_0x27be69,_0x1d49ba,_0x458a6f;_0x28d924=_[_0x9481('0x42')]({},_0x28d924,_0x3c8241);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x28d924)[_0x9481('0x27')](function(_0x1173e9){if(_0x1173e9){_0x426d56=_0x1173e9;return _0x1173e9[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x5557d7){if(_0x5557d7){if(!_0x5557d7[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x5808c8=_0x5557d7;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x3ae3e2){if(_0x3ae3e2){_0x27be69=_[_0x9481('0x8b')](_0x3ae3e2,'id');var _0x538fe0;var _0x44e2c2=squel['select']();_0x44e2c2['from'](_0x426d56[_0x9481('0x8c')]);for(var _0x382455=0x0;_0x382455<_0x5808c8[_0x9481('0x3a')];_0x382455+=0x1){_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x71')]?_0x27be69[_0x5808c8[_0x382455][_0x9481('0x71')]][_0x9481('0x8d')]:_0x5808c8[_0x382455]['field'];_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x72')]?_['replace'](_0x1c82a1[_0x5808c8[_0x382455][_0x9481('0x72')]],'%s',_0x538fe0):_0x538fe0;_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x74')]?_[_0x9481('0x73')](_0x55b428[_0x5808c8[_0x382455]['format']],'%s',_0x538fe0):_0x538fe0;if(_0x5808c8[_0x382455]['groupBy']){_0x44e2c2[_0x9481('0x76')](_0x538fe0);}_0x5808c8[_0x382455][_0x9481('0x77')]&&_0x44e2c2[_0x9481('0x3d')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x44e2c2[_0x9481('0x6a')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x79')]||_0x538fe0);}if(_0x426d56[_0x9481('0x7a')]){_0x426d56[_0x9481('0x7a')]=JSON['parse'](_0x426d56[_0x9481('0x7a')]);for(var _0xd64114=0x0;_0xd64114<_0x426d56['joins'][_0x9481('0x3a')];_0xd64114+=0x1){if(_0x426d56['joins'][_0xd64114][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2e585d,_0x426d56['joins'][_0xd64114][_0x9481('0x43')])&&_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')]&&_0x426d56['joins'][_0xd64114][_0x9481('0x7e')]&&_0x426d56[_0x9481('0x7a')][_0xd64114]['foreignKey']){_0x44e2c2[_0x426d56[_0x9481('0x7a')][_0xd64114]['type']](_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x426d56['table'],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7f')]));}}}if(_0x426d56['conditions']){_0x426d56[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x426d56[_0x9481('0x80')]);_0x44e2c2[_0x9481('0x3f')](_0x22e787(_0x426d56[_0x9481('0x80')][_0x9481('0x76')]));}_0x458a6f=_0x44e2c2[_0x9481('0x81')]();_0x44e2c2['limit'](_0x5f4be2);_0x44e2c2[_0x9481('0x1e')](0x0);return;}})[_0x9481('0x27')](function(){if(_0x226932[_0x9481('0x8e')]===_0x9481('0x8f')){return null;}var _0x4e5a8d=_[_0x9481('0x42')](_0x226932,{'name':_0x226932[_0x9481('0x90')]||_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],'basename':_0x1ea93a,'savename':util['format'](_0x9481('0x91'),_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],require(_0x9481('0x92'))[_0x9481('0x93')](0x4),_0x226932[_0x9481('0x8e')]||_0x9481('0x94')),'reportId':_0x426d56['id'],'reportType':_0x9481('0x95')});return db[_0x9481('0x96')][_0x9481('0x4f')](_0x4e5a8d,{'raw':!![]});})[_0x9481('0x27')](function(_0x5930d6){if(_0x426d56[_0x9481('0x8c')]==='cdr'){_0x458a6f[_0x9481('0x3f')](_0x426d56[_0x9481('0x8c')]+_0x9481('0x97'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}else{_0x458a6f['where'](_0x426d56[_0x9481('0x8c')]+_0x9481('0x9a'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}if(_0x5930d6){logger[_0x9481('0x9b')](_0x9481('0x9c'),_0x458a6f['toString']());require(_0x9481('0x9d'))[_0x9481('0x9e')](path[_0x9481('0x59')](__dirname,_0x9481('0x9f'),_0x5930d6[_0x9481('0x8e')]),[_0x5930d6['id'],_0x458a6f[_0x9481('0x82')](),path[_0x9481('0x59')](__dirname,_0x9481('0xa0'),_0x5930d6[_0x9481('0xa1')]),_0x1ea93a]);return _0x5930d6;}else{var _0x26a666=squel[_0x9481('0xa2')]();_0x26a666[_0x9481('0xa3')]('('+_0x458a6f['toString']()+')',_0x9481('0xa4'));_0x26a666[_0x9481('0x6a')](_0x9481('0xa5'),_0x9481('0x21'));_0x458a6f[_0x9481('0x20')](_0x226932[_0x9481('0x20')]||_0x5f4be2);_0x458a6f[_0x9481('0x1e')](_0x226932[_0x9481('0x1e')]||0x0);return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x26a666[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]})[_0x9481('0x27')](function(_0xcf83d2){if(!_0xcf83d2[_0x9481('0x3a')]){_0x1d49ba=0x0;}else{_0x1d49ba=_0xcf83d2[0x0][_0x9481('0x21')]||0x0;}return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x458a6f['toString'](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});})[_0x9481('0x27')](function(_0x4553fc){return{'rows':_0x4553fc||[],'count':_0x1d49ba};});}});}exports[_0x9481('0xa7')]=function(_0x55c4ab,_0x57928a){return runReport(_0x55c4ab[_0x9481('0x4b')],_0x55c4ab[_0x9481('0x35')],_0x55c4ab[_0x9481('0x44')])[_0x9481('0x27')](respondWithResult(_0x57928a,null))['catch'](handleError(_0x57928a,null));};exports['runReport']=runReport;exports['query']=function(_0x52b980,_0x5792b1){var _0x3a199b=0xa;var _0x4b779b=[_0x9481('0x59'),_0x9481('0x5a'),_0x9481('0x85'),_0x9481('0xa8')];var _0x55a65f={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':_0x9481('0xa9'),'MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x583490={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':'HOUR(%s)','ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x1e40fe=function(_0x26c87b){return!_[_0x9481('0x7c')](['IS\x20NULL',_0x9481('0x67'),_0x9481('0x88'),'IS\x20NOT\x20EMPTY'],_0x26c87b);};var _0x4ea411=function(_0x1cdca0){if(!_0x1cdca0||!_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x15c53f='(',_0x7ee854=0x0;_0x7ee854<_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')];_0x7ee854+=0x1){_0x7ee854>0x0&&(_0x15c53f+='\x20'+_0x1cdca0[_0x9481('0x89')]+'\x20');_0x15c53f+=_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x76')]?_0x4ea411(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x76')]):_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x6a')]+'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x8a')]+(_0x1e40fe(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x8a')])?'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854]['value']:'');}return _0x15c53f+')';};var _0x49a6db={'where':{'id':_0x52b980['params']['id']}},_0x224b16,_0x83543f,_0x58c043,_0x97a67a,_0xe157e4;_0x49a6db=_[_0x9481('0x42')]({},_0x49a6db,_0x52b980[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x49a6db)['then'](function(_0x1a1058){if(_0x1a1058){_0x224b16=_0x1a1058;return _0x1a1058['getFields']();}return null;})[_0x9481('0x27')](function(_0x206661){if(_0x206661){if(!_0x206661[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x83543f=_0x206661;return db['AnalyticMetric'][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x40cdf9){if(_0x40cdf9){_0x58c043=_['keyBy'](_0x40cdf9,'id');var _0x5467fe;var _0x440d88=squel['select']();_0x440d88[_0x9481('0xa3')](_0x224b16['table']);for(var _0x2a0367=0x0;_0x2a0367<_0x83543f[_0x9481('0x3a')];_0x2a0367+=0x1){_0x5467fe=_0x83543f[_0x2a0367]['MetricId']?_0x58c043[_0x83543f[_0x2a0367][_0x9481('0x71')]][_0x9481('0x8d')]:_0x83543f[_0x2a0367][_0x9481('0x6a')];_0x5467fe=_0x83543f[_0x2a0367]['function']?_[_0x9481('0x73')](_0x55a65f[_0x83543f[_0x2a0367][_0x9481('0x72')]],'%s',_0x5467fe):_0x5467fe;_0x5467fe=_0x83543f[_0x2a0367][_0x9481('0x74')]?_[_0x9481('0x73')](_0x583490[_0x83543f[_0x2a0367][_0x9481('0x74')]],'%s',_0x5467fe):_0x5467fe;if(_0x83543f[_0x2a0367][_0x9481('0x75')]){_0x440d88[_0x9481('0x76')](_0x5467fe);}_0x83543f[_0x2a0367]['orderBy']&&_0x440d88[_0x9481('0x3d')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x440d88[_0x9481('0x6a')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x79')]||_0x5467fe);}if(_0x224b16['joins']){_0x224b16[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x7a')]);for(var _0x527ef6=0x0;_0x527ef6<_0x224b16['joins'][_0x9481('0x3a')];_0x527ef6+=0x1){if(_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x4b779b,_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')])&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7d')]&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')]&&_0x224b16['joins'][_0x527ef6][_0x9481('0x7f')]){_0x440d88[_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]](_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x224b16[_0x9481('0x8c')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['parentKey'],_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['foreignKey']));}}}if(_0x224b16[_0x9481('0x80')]){_0x224b16[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x80')]);_0x440d88['where'](_0x4ea411(_0x224b16[_0x9481('0x80')][_0x9481('0x76')]));}_0xe157e4=_0x440d88[_0x9481('0x81')]();_0x440d88[_0x9481('0x20')](_0x3a199b);_0x440d88['offset'](0x0);logger[_0x9481('0xaa')](_0x9481('0xab'),_0x440d88[_0x9481('0x82')]());return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x440d88[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});}})[_0x9481('0x27')](function(){return{'sql':_0xe157e4['toString']()};})[_0x9481('0x27')](respondWithResult(_0x5792b1,null))[_0x9481('0x4e')](handleError(_0x5792b1,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 70b5616..31a3360 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 _0xc893=['exports','define','analytics_default_reports','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3947c7,_0x47f769){var _0x50e62a=function(_0x4afb5b){while(--_0x4afb5b){_0x3947c7['push'](_0x3947c7['shift']());}};_0x50e62a(++_0x47f769);}(_0xc893,0x87));var _0x3c89=function(_0x309657,_0x3fb6eb){_0x309657=_0x309657-0x0;var _0x21fd4f=_0xc893[_0x309657];return _0x21fd4f;};'use strict';var _=require('lodash');var util=require(_0x3c89('0x0'));var logger=require(_0x3c89('0x1'))(_0x3c89('0x2'));var moment=require(_0x3c89('0x3'));var BPromise=require(_0x3c89('0x4'));var rp=require(_0x3c89('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c89('0x6'));var config=require(_0x3c89('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0x3c89('0x8')]=function(_0x3f74a2,_0x15d9c1){return _0x3f74a2[_0x3c89('0x9')]('AnalyticDefaultReport',attributes,{'tableName':_0x3c89('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72dd=['analytics_default_reports','util','api','moment','bluebird','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport'];(function(_0x2c2f3b,_0x5deb12){var _0xf1ab48=function(_0x3d8def){while(--_0x3d8def){_0x2c2f3b['push'](_0x2c2f3b['shift']());}};_0xf1ab48(++_0x5deb12);}(_0x72dd,0x8d));var _0xd72d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x72dd[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xd72d('0x0'));var logger=require('../../config/logger')(_0xd72d('0x1'));var moment=require(_0xd72d('0x2'));var BPromise=require(_0xd72d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd72d('0x4'));var config=require(_0xd72d('0x5'));var attributes=require(_0xd72d('0x6'));module[_0xd72d('0x7')]=function(_0x10467e,_0x381b88){return _0x10467e['define'](_0xd72d('0x8'),attributes,{'tableName':_0xd72d('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 3530113..0b97634 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 _0x8c73=['debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent'];(function(_0xc03608,_0x5cbe8c){var _0x3b9db0=function(_0x5850ab){while(--_0x5850ab){_0xc03608['push'](_0xc03608['shift']());}};_0x3b9db0(++_0x5cbe8c);}(_0x8c73,0xc8));var _0x38c7=function(_0x2237be,_0x2ed5c1){_0x2237be=_0x2237be-0x0;var _0x3312ab=_0x8c73[_0x2237be];return _0x3312ab;};'use strict';var _=require(_0x38c7('0x0'));var util=require(_0x38c7('0x1'));var moment=require(_0x38c7('0x2'));var BPromise=require(_0x38c7('0x3'));var rs=require(_0x38c7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x38c7('0x5'))['db'];var utils=require(_0x38c7('0x6'));var logger=require('../../config/logger')(_0x38c7('0x7'));var config=require('../../config/environment');var jayson=require(_0x38c7('0x8'));var client=jayson[_0x38c7('0x9')][_0x38c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8b2309,_0x300b56,_0x5e3245){return new BPromise(function(_0x2c0e01,_0x3f075d){return client[_0x38c7('0xb')](_0x8b2309,_0x5e3245)[_0x38c7('0xc')](function(_0x34ddd6){logger[_0x38c7('0xd')](_0x38c7('0xe'),_0x300b56,_0x38c7('0xf'));logger[_0x38c7('0x10')](_0x38c7('0x11'),_0x300b56,_0x38c7('0xf'),JSON[_0x38c7('0x12')](_0x34ddd6));if(_0x34ddd6['error']){if(_0x34ddd6['error'][_0x38c7('0x13')]===0x1f4){logger[_0x38c7('0x14')](_0x38c7('0xe'),_0x300b56,_0x34ddd6[_0x38c7('0x14')]['message']);return _0x3f075d(_0x34ddd6['error'][_0x38c7('0x15')]);}logger[_0x38c7('0x14')](_0x38c7('0xe'),_0x300b56,_0x34ddd6[_0x38c7('0x14')]['message']);return _0x2c0e01(_0x34ddd6['error'][_0x38c7('0x15')]);}else{logger[_0x38c7('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x300b56,_0x38c7('0xf'));_0x2c0e01(_0x34ddd6[_0x38c7('0x16')][_0x38c7('0x15')]);}})[_0x38c7('0x17')](function(_0x477375){logger['error'](_0x38c7('0xe'),_0x300b56,_0x477375);_0x3f075d(_0x477375);});});} \ No newline at end of file +var _0xb008=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x26660c,_0xa474ef){var _0x21fb98=function(_0xcedc16){while(--_0xcedc16){_0x26660c['push'](_0x26660c['shift']());}};_0x21fb98(++_0xa474ef);}(_0xb008,0x1e1));var _0x8b00=function(_0x5433a2,_0x13710c){_0x5433a2=_0x5433a2-0x0;var _0x29fb58=_0xb008[_0x5433a2];return _0x29fb58;};'use strict';var _=require(_0x8b00('0x0'));var util=require('util');var moment=require(_0x8b00('0x1'));var BPromise=require(_0x8b00('0x2'));var rs=require(_0x8b00('0x3'));var fs=require('fs');var Redis=require(_0x8b00('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b00('0x5'));var logger=require(_0x8b00('0x6'))(_0x8b00('0x7'));var config=require(_0x8b00('0x8'));var jayson=require(_0x8b00('0x9'));var client=jayson[_0x8b00('0xa')][_0x8b00('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x583a35,_0x1e1f14,_0x421ec3){return new BPromise(function(_0x56ba55,_0x2a42e6){return client[_0x8b00('0xc')](_0x583a35,_0x421ec3)[_0x8b00('0xd')](function(_0x38968a){logger[_0x8b00('0xe')](_0x8b00('0xf'),_0x1e1f14,'request\x20sent');logger[_0x8b00('0x10')](_0x8b00('0x11'),_0x1e1f14,_0x8b00('0x12'),JSON[_0x8b00('0x13')](_0x38968a));if(_0x38968a['error']){if(_0x38968a['error']['code']===0x1f4){logger['error'](_0x8b00('0xf'),_0x1e1f14,_0x38968a[_0x8b00('0x14')][_0x8b00('0x15')]);return _0x2a42e6(_0x38968a[_0x8b00('0x14')]['message']);}logger['error'](_0x8b00('0xf'),_0x1e1f14,_0x38968a['error'][_0x8b00('0x15')]);return _0x56ba55(_0x38968a[_0x8b00('0x14')][_0x8b00('0x15')]);}else{logger[_0x8b00('0xe')](_0x8b00('0xf'),_0x1e1f14,'request\x20sent');_0x56ba55(_0x38968a[_0x8b00('0x16')][_0x8b00('0x15')]);}})[_0x8b00('0x17')](function(_0x3f5d65){logger[_0x8b00('0x14')](_0x8b00('0xf'),_0x1e1f14,_0x3f5d65);_0x2a42e6(_0x3f5d65);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index f612be5..43da99e 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 _0x90e4=['query','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run'];(function(_0xfe4136,_0x39f69e){var _0x540bd6=function(_0x14738a){while(--_0x14738a){_0xfe4136['push'](_0xfe4136['shift']());}};_0x540bd6(++_0x39f69e);}(_0x90e4,0x14a));var _0x490e=function(_0x3662b4,_0x503b4d){_0x3662b4=_0x3662b4-0x0;var _0x50928c=_0x90e4[_0x3662b4];return _0x50928c;};'use strict';var multer=require(_0x490e('0x0'));var util=require(_0x490e('0x1'));var path=require(_0x490e('0x2'));var timeout=require(_0x490e('0x3'));var express=require(_0x490e('0x4'));var router=express[_0x490e('0x5')]();var fs_extra=require(_0x490e('0x6'));var auth=require(_0x490e('0x7'));var interaction=require(_0x490e('0x8'));var config=require(_0x490e('0x9'));var controller=require(_0x490e('0xa'));router[_0x490e('0xb')]('/',auth[_0x490e('0xc')](),controller[_0x490e('0xd')]);router['get'](_0x490e('0xe'),auth['isAuthenticated'](),controller[_0x490e('0xf')]);router[_0x490e('0xb')](_0x490e('0x10'),auth[_0x490e('0xc')](),controller[_0x490e('0x11')]);router[_0x490e('0xb')](_0x490e('0x12'),auth['isAuthenticated'](),controller[_0x490e('0x13')]);router[_0x490e('0xb')]('/:id/query',auth[_0x490e('0xc')](),controller[_0x490e('0x14')]);router['post']('/',auth[_0x490e('0xc')](),controller[_0x490e('0x15')]);router['put']('/:id',auth[_0x490e('0xc')](),controller[_0x490e('0x16')]);router[_0x490e('0x17')]('/:id',auth[_0x490e('0xc')](),controller['destroy']);module[_0x490e('0x18')]=router; \ No newline at end of file +var _0x67d5=['../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','/:id','show','/:id/preview','/:id/run','run','/:id/query','query','create','put','update','exports','util','path','express','fs-extra','../../components/auth/service'];(function(_0x927eac,_0x31232a){var _0x45e714=function(_0x393c25){while(--_0x393c25){_0x927eac['push'](_0x927eac['shift']());}};_0x45e714(++_0x31232a);}(_0x67d5,0x18a));var _0x567d=function(_0x531a1c,_0x38633b){_0x531a1c=_0x531a1c-0x0;var _0x506db4=_0x67d5[_0x531a1c];return _0x506db4;};'use strict';var multer=require('multer');var util=require(_0x567d('0x0'));var path=require(_0x567d('0x1'));var timeout=require('connect-timeout');var express=require(_0x567d('0x2'));var router=express['Router']();var fs_extra=require(_0x567d('0x3'));var auth=require(_0x567d('0x4'));var interaction=require(_0x567d('0x5'));var config=require(_0x567d('0x6'));var controller=require(_0x567d('0x7'));router[_0x567d('0x8')]('/',auth[_0x567d('0x9')](),controller['index']);router[_0x567d('0x8')](_0x567d('0xa'),auth[_0x567d('0x9')](),controller[_0x567d('0xb')]);router[_0x567d('0x8')](_0x567d('0xc'),auth['isAuthenticated'](),controller['preview']);router[_0x567d('0x8')](_0x567d('0xd'),auth[_0x567d('0x9')](),controller[_0x567d('0xe')]);router[_0x567d('0x8')](_0x567d('0xf'),auth[_0x567d('0x9')](),controller[_0x567d('0x10')]);router['post']('/',auth[_0x567d('0x9')](),controller[_0x567d('0x11')]);router[_0x567d('0x12')](_0x567d('0xa'),auth['isAuthenticated'](),controller[_0x567d('0x13')]);router['delete'](_0x567d('0xa'),auth[_0x567d('0x9')](),controller['destroy']);module[_0x567d('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index c85f2ee..cbfae25 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 _0x0a1c=['sequelize','moment','exports','STRING','csv','pdf','DATE','Loading','ENUM','manual','scheduled','INTEGER','UNSIGNED'];(function(_0x16b03f,_0x346a8b){var _0xbe7281=function(_0xe1c23e){while(--_0xe1c23e){_0x16b03f['push'](_0x16b03f['shift']());}};_0xbe7281(++_0x346a8b);}(_0x0a1c,0xdd));var _0xc0a1=function(_0x2bcd1f,_0x4f1972){_0x2bcd1f=_0x2bcd1f-0x0;var _0x2381ca=_0x0a1c[_0x2bcd1f];return _0x2381ca;};'use strict';var Sequelize=require(_0xc0a1('0x0'));var moment=require(_0xc0a1('0x1'));module[_0xc0a1('0x2')]={'name':{'type':Sequelize[_0xc0a1('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xc0a1('0x4'),_0xc0a1('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0xc0a1('0x4')},'savename':{'type':Sequelize[_0xc0a1('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xc0a1('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xc0a1('0x3')],'defaultValue':_0xc0a1('0x7')},'type':{'type':Sequelize[_0xc0a1('0x8')](_0xc0a1('0x9'),_0xc0a1('0xa')),'allowNull':![],'defaultValue':_0xc0a1('0x9')},'reportId':{'type':Sequelize[_0xc0a1('0xb')](0xb)[_0xc0a1('0xc')]},'reportType':{'type':Sequelize[_0xc0a1('0x3')]}}; \ No newline at end of file +var _0xea6a=['UNSIGNED','exports','STRING','ENUM','csv','pdf','DATE','Loading','manual','scheduled','INTEGER'];(function(_0x5e3eea,_0x3c8ae7){var _0x283d84=function(_0x26fd72){while(--_0x26fd72){_0x5e3eea['push'](_0x5e3eea['shift']());}};_0x283d84(++_0x3c8ae7);}(_0xea6a,0xf3));var _0xaea6=function(_0x5337e0,_0x11395c){_0x5337e0=_0x5337e0-0x0;var _0x16b502=_0xea6a[_0x5337e0];return _0x16b502;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xaea6('0x0')]={'name':{'type':Sequelize[_0xaea6('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xaea6('0x2')](_0xaea6('0x3'),_0xaea6('0x4'),'xlsx'),'allowNull':![],'defaultValue':_0xaea6('0x3')},'savename':{'type':Sequelize[_0xaea6('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0xaea6('0x5')]},'endDate':{'type':Sequelize[_0xaea6('0x5')]},'status':{'type':Sequelize[_0xaea6('0x1')],'defaultValue':_0xaea6('0x6')},'type':{'type':Sequelize[_0xaea6('0x2')](_0xaea6('0x7'),_0xaea6('0x8')),'allowNull':![],'defaultValue':_0xaea6('0x7')},'reportId':{'type':Sequelize[_0xaea6('0x9')](0xb)[_0xaea6('0xa')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index ff02385..4954e45 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 _0x1b01=['toLowerCase','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','offset','count','apply','reject','save','update','get','ExtractedReports','UserProfileResource','destroy','then','error','send','index','AnalyticExtractedReport','rawAttributes','type','key','map','name','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','model','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','body','params','basename','output','existsSync','join','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','format'];(function(_0x516208,_0x3fe7c5){var _0x367e70=function(_0x42a915){while(--_0x42a915){_0x516208['push'](_0x516208['shift']());}};_0x367e70(++_0x3fe7c5);}(_0x1b01,0x16d));var _0x11b0=function(_0x14e6ad,_0x5359a6){_0x14e6ad=_0x14e6ad-0x0;var _0x30ac85=_0x1b01[_0x14e6ad];return _0x30ac85;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x11b0('0x0'));var jsonpatch=require(_0x11b0('0x1'));var rp=require(_0x11b0('0x2'));var moment=require(_0x11b0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x11b0('0x4'));var util=require('util');var path=require(_0x11b0('0x5'));var sox=require(_0x11b0('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11b0('0x7'));var squel=require('squel');var crypto=require(_0x11b0('0x8'));var jsforce=require(_0x11b0('0x9'));var deskjs=require(_0x11b0('0xa'));var toCsv=require(_0x11b0('0xb'));var querystring=require(_0x11b0('0xc'));var Papa=require(_0x11b0('0xd'));var Redis=require('ioredis');var authService=require(_0x11b0('0xe'));var qs=require(_0x11b0('0xf'));var as=require(_0x11b0('0x10'));var hardwareService=require(_0x11b0('0x11'));var logger=require(_0x11b0('0x12'))(_0x11b0('0x13'));var utils=require(_0x11b0('0x14'));var config=require(_0x11b0('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x361051,_0x5bade2){_0x5bade2=_0x5bade2||0xcc;return function(_0x5c31b9){if(_0x5c31b9){return _0x361051[_0x11b0('0x16')](_0x5bade2);}return _0x361051[_0x11b0('0x17')](_0x5bade2)[_0x11b0('0x18')]();};}function respondWithResult(_0xda4573,_0x52afb3){_0x52afb3=_0x52afb3||0xc8;return function(_0x482381){if(_0x482381){return _0xda4573[_0x11b0('0x17')](_0x52afb3)['json'](_0x482381);}};}function respondWithFilteredResult(_0x1af055,_0x34b04d){return function(_0x2008b9){if(_0x2008b9){var _0x3ed086=typeof _0x34b04d['offset']===_0x11b0('0x19')&&typeof _0x34b04d[_0x11b0('0x1a')]==='undefined';var _0x1dc069=_0x2008b9['count'];var _0x4ff36f=_0x3ed086?0x0:_0x34b04d[_0x11b0('0x1b')];var _0x2dee2a=_0x3ed086?_0x2008b9[_0x11b0('0x1c')]:_0x34b04d[_0x11b0('0x1b')]+_0x34b04d[_0x11b0('0x1a')];var _0x24d996;if(_0x2dee2a>=_0x1dc069){_0x2dee2a=_0x1dc069;_0x24d996=0xc8;}else{_0x24d996=0xce;}_0x1af055[_0x11b0('0x17')](_0x24d996);return _0x1af055['set']('Content-Range',_0x4ff36f+'-'+_0x2dee2a+'/'+_0x1dc069)['json'](_0x2008b9);}return null;};}function patchUpdates(_0x438c97){return function(_0x2beb1f){try{jsonpatch[_0x11b0('0x1d')](_0x2beb1f,_0x438c97,!![]);}catch(_0x3d5286){return BPromise[_0x11b0('0x1e')](_0x3d5286);}return _0x2beb1f[_0x11b0('0x1f')]();};}function saveUpdates(_0x25b00d,_0x3786e5){return function(_0x464f49){if(_0x464f49){return _0x464f49[_0x11b0('0x20')](_0x25b00d)['then'](function(_0x1d7d47){return _0x1d7d47;});}return null;};}function removeEntity(_0x11f943,_0x38b4e8){return function(_0x33b0f5){if(_0x33b0f5){return _0x33b0f5['destroy']()['then'](function(){var _0x31da21=_0x33b0f5[_0x11b0('0x21')]({'plain':!![]});var _0x448ce6=_0x11b0('0x22');return db[_0x11b0('0x23')][_0x11b0('0x24')]({'where':{'type':_0x448ce6,'resourceId':_0x31da21['id']}})[_0x11b0('0x25')](function(){return _0x33b0f5;});})[_0x11b0('0x25')](function(){_0x11f943[_0x11b0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46ffc8,_0x33bd4b){return function(_0x24206a){if(!_0x24206a){_0x46ffc8[_0x11b0('0x16')](0x194);}return _0x24206a;};}function handleError(_0x3f182c,_0x253407){_0x253407=_0x253407||0x1f4;return function(_0x151dac){logger[_0x11b0('0x26')](_0x151dac['stack']);if(_0x151dac['name']){delete _0x151dac['name'];}_0x3f182c['status'](_0x253407)[_0x11b0('0x27')](_0x151dac);};}exports[_0x11b0('0x28')]=function(_0x17e4a1,_0x5558b4){var _0x2cd43c={},_0x26e3ed={},_0x33728b={'count':0x0,'rows':[]};var _0x1da4bf=_['map'](db[_0x11b0('0x29')][_0x11b0('0x2a')],function(_0x88dee1){return{'name':_0x88dee1['fieldName'],'type':_0x88dee1[_0x11b0('0x2b')][_0x11b0('0x2c')]};});_0x26e3ed['model']=_[_0x11b0('0x2d')](_0x1da4bf,_0x11b0('0x2e'));_0x26e3ed[_0x11b0('0x2f')]=_[_0x11b0('0x30')](_0x17e4a1[_0x11b0('0x2f')]);_0x26e3ed[_0x11b0('0x31')]=_[_0x11b0('0x32')](_0x26e3ed['model'],_0x26e3ed[_0x11b0('0x2f')]);_0x2cd43c[_0x11b0('0x33')]=_[_0x11b0('0x32')](_0x26e3ed['model'],qs[_0x11b0('0x34')](_0x17e4a1[_0x11b0('0x2f')][_0x11b0('0x34')]));_0x2cd43c[_0x11b0('0x33')]=_0x2cd43c[_0x11b0('0x33')][_0x11b0('0x35')]?_0x2cd43c['attributes']:_0x26e3ed['model'];if(!_0x17e4a1['query']['hasOwnProperty'](_0x11b0('0x36'))){_0x2cd43c[_0x11b0('0x1a')]=qs[_0x11b0('0x1a')](_0x17e4a1['query']['limit']);_0x2cd43c[_0x11b0('0x1b')]=qs[_0x11b0('0x1b')](_0x17e4a1[_0x11b0('0x2f')][_0x11b0('0x1b')]);}_0x2cd43c['order']=qs[_0x11b0('0x37')](_0x17e4a1[_0x11b0('0x2f')][_0x11b0('0x37')]);_0x2cd43c[_0x11b0('0x38')]=qs[_0x11b0('0x31')](_[_0x11b0('0x39')](_0x17e4a1[_0x11b0('0x2f')],_0x26e3ed[_0x11b0('0x31')]),_0x1da4bf);if(_0x17e4a1[_0x11b0('0x2f')][_0x11b0('0x3a')]){_0x2cd43c[_0x11b0('0x38')]=_['merge'](_0x2cd43c[_0x11b0('0x38')],{'$or':_[_0x11b0('0x2d')](_0x1da4bf,function(_0x1369c5){if(_0x1369c5[_0x11b0('0x2b')]!==_0x11b0('0x3b')){var _0x1123f2={};_0x1123f2[_0x1369c5['name']]={'$like':'%'+_0x17e4a1[_0x11b0('0x2f')][_0x11b0('0x3a')]+'%'};return _0x1123f2;}})});}_0x2cd43c=_[_0x11b0('0x3c')]({},_0x2cd43c,_0x17e4a1['options']);var _0xee196a={'where':_0x2cd43c[_0x11b0('0x38')]};return db[_0x11b0('0x29')][_0x11b0('0x1c')](_0xee196a)[_0x11b0('0x25')](function(_0x2d43ba){_0x33728b[_0x11b0('0x1c')]=_0x2d43ba;if(_0x17e4a1[_0x11b0('0x2f')][_0x11b0('0x3d')]){_0x2cd43c[_0x11b0('0x3e')]=[{'all':!![]}];}return db[_0x11b0('0x29')][_0x11b0('0x3f')](_0x2cd43c);})[_0x11b0('0x25')](function(_0x1ad2e9){_0x33728b[_0x11b0('0x40')]=_0x1ad2e9;return _0x33728b;})[_0x11b0('0x25')](respondWithFilteredResult(_0x5558b4,_0x2cd43c))[_0x11b0('0x41')](handleError(_0x5558b4,null));};exports[_0x11b0('0x42')]=function(_0x5d0418,_0x1c8f34){var _0x48887c={'raw':!![],'where':{'id':_0x5d0418['params']['id']}},_0x5200f7={};_0x5200f7[_0x11b0('0x43')]=_[_0x11b0('0x30')](db['AnalyticExtractedReport'][_0x11b0('0x2a')]);_0x5200f7['query']=_[_0x11b0('0x30')](_0x5d0418[_0x11b0('0x2f')]);_0x5200f7['filters']=_['intersection'](_0x5200f7[_0x11b0('0x43')],_0x5200f7[_0x11b0('0x2f')]);_0x48887c[_0x11b0('0x33')]=_[_0x11b0('0x32')](_0x5200f7['model'],qs[_0x11b0('0x34')](_0x5d0418['query'][_0x11b0('0x34')]));_0x48887c['attributes']=_0x48887c['attributes'][_0x11b0('0x35')]?_0x48887c[_0x11b0('0x33')]:_0x5200f7[_0x11b0('0x43')];if(_0x5d0418['query'][_0x11b0('0x3d')]){_0x48887c[_0x11b0('0x3e')]=[{'all':!![]}];}_0x48887c=_['merge']({},_0x48887c,_0x5d0418[_0x11b0('0x44')]);return db[_0x11b0('0x29')][_0x11b0('0x45')](_0x48887c)[_0x11b0('0x25')](handleEntityNotFound(_0x1c8f34,null))[_0x11b0('0x25')](respondWithResult(_0x1c8f34,null))[_0x11b0('0x41')](handleError(_0x1c8f34,null));};exports[_0x11b0('0x46')]=function(_0x41c6ea,_0x866b2b){return db[_0x11b0('0x29')][_0x11b0('0x46')](_0x41c6ea['body'],{})[_0x11b0('0x25')](function(_0x1602d2){var _0x10834c=_0x41c6ea[_0x11b0('0x47')][_0x11b0('0x21')]({'plain':!![]});if(!_0x10834c)throw new Error(_0x11b0('0x48'));if(_0x10834c[_0x11b0('0x49')]===_0x11b0('0x47')){var _0x32f3db=_0x1602d2['get']({'plain':!![]});var _0x15e958=_0x11b0('0x22');return db[_0x11b0('0x4a')]['find']({'where':{'name':_0x15e958,'userProfileId':_0x10834c['userProfileId']},'raw':!![]})['then'](function(_0xf719cb){if(_0xf719cb&&_0xf719cb['autoAssociation']===0x0){return db[_0x11b0('0x23')][_0x11b0('0x46')]({'name':_0x32f3db[_0x11b0('0x2e')],'resourceId':_0x32f3db['id'],'type':_0xf719cb['name'],'sectionId':_0xf719cb['id']},{})[_0x11b0('0x25')](function(){return _0x1602d2;});}else{return _0x1602d2;}})[_0x11b0('0x41')](function(_0x36e27b){logger[_0x11b0('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36e27b);throw _0x36e27b;});}return _0x1602d2;})[_0x11b0('0x25')](respondWithResult(_0x866b2b,0xc9))[_0x11b0('0x41')](handleError(_0x866b2b,null));};exports[_0x11b0('0x20')]=function(_0x223cb7,_0x171919){if(_0x223cb7[_0x11b0('0x4b')]['id']){delete _0x223cb7[_0x11b0('0x4b')]['id'];}return db[_0x11b0('0x29')][_0x11b0('0x45')]({'where':{'id':_0x223cb7[_0x11b0('0x4c')]['id']}})[_0x11b0('0x25')](handleEntityNotFound(_0x171919,null))[_0x11b0('0x25')](saveUpdates(_0x223cb7[_0x11b0('0x4b')],null))['then'](respondWithResult(_0x171919,null))[_0x11b0('0x41')](handleError(_0x171919,null));};exports[_0x11b0('0x24')]=function(_0x16e6f9,_0x580b13){return db['AnalyticExtractedReport'][_0x11b0('0x45')]({'where':{'id':_0x16e6f9[_0x11b0('0x4c')]['id']}})[_0x11b0('0x25')](handleEntityNotFound(_0x580b13,null))[_0x11b0('0x25')](removeEntity(_0x580b13,null))[_0x11b0('0x41')](handleError(_0x580b13,null));};exports['download']=function(_0x120f26,_0x468109,_0x3a3841){return db[_0x11b0('0x29')][_0x11b0('0x45')]({'where':{'id':_0x120f26[_0x11b0('0x4c')]['id']},'attributes':['name',_0x11b0('0x4d'),'savename',_0x11b0('0x4e')],'raw':!![]})[_0x11b0('0x25')](handleEntityNotFound(_0x468109,null))['then'](function(_0x53278a){if(_0x53278a){if(!fs[_0x11b0('0x4f')](path[_0x11b0('0x50')](config[_0x11b0('0x51')],_0x11b0('0x52'),_0x53278a[_0x11b0('0x53')]))){throw new db[(_0x11b0('0x54'))][(_0x11b0('0x55'))](_0x11b0('0x56'));}if(_0x120f26['query'][_0x11b0('0x57')]){return _0x468109['sendStatus'](0xc8);}return _0x468109[_0x11b0('0x58')](path[_0x11b0('0x50')](config[_0x11b0('0x51')],'server/files/reports',_0x53278a[_0x11b0('0x53')]),util[_0x11b0('0x59')]('%s.%s',_0x53278a['basename']||_0x53278a[_0x11b0('0x2e')],_0x53278a[_0x11b0('0x4e')][_0x11b0('0x5a')]()));}})['catch'](handleError(_0x468109,null));}; \ No newline at end of file +var _0xcd4e=['apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','key','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','findAll','show','model','fields','find','catch','create','body','user','role','ExtractedReports','userProfileId','params','savename','output','existsSync','root','server/files/reports','Sequelize','ValidationError','download','join','format','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set'];(function(_0x3b5c12,_0x2b59f6){var _0x208695=function(_0x537301){while(--_0x537301){_0x3b5c12['push'](_0x3b5c12['shift']());}};_0x208695(++_0x2b59f6);}(_0xcd4e,0x90));var _0xecd4=function(_0x38ec30,_0x5476b2){_0x38ec30=_0x38ec30-0x0;var _0x104d8f=_0xcd4e[_0x38ec30];return _0x104d8f;};'use strict';var emlformat=require(_0xecd4('0x0'));var rimraf=require(_0xecd4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xecd4('0x2'));var rp=require('request-promise');var moment=require(_0xecd4('0x3'));var BPromise=require(_0xecd4('0x4'));var Mustache=require(_0xecd4('0x5'));var util=require(_0xecd4('0x6'));var path=require(_0xecd4('0x7'));var sox=require('sox');var csv=require(_0xecd4('0x8'));var ejs=require(_0xecd4('0x9'));var fs=require('fs');var fs_extra=require(_0xecd4('0xa'));var _=require(_0xecd4('0xb'));var squel=require('squel');var crypto=require(_0xecd4('0xc'));var jsforce=require(_0xecd4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xecd4('0x8'));var querystring=require('querystring');var Papa=require(_0xecd4('0xe'));var Redis=require(_0xecd4('0xf'));var authService=require(_0xecd4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xecd4('0x11'));var logger=require(_0xecd4('0x12'))(_0xecd4('0x13'));var utils=require(_0xecd4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xecd4('0x15'));var db=require(_0xecd4('0x16'))['db'];function respondWithStatusCode(_0x24d16e,_0xc5743f){_0xc5743f=_0xc5743f||0xcc;return function(_0x569aec){if(_0x569aec){return _0x24d16e[_0xecd4('0x17')](_0xc5743f);}return _0x24d16e['status'](_0xc5743f)[_0xecd4('0x18')]();};}function respondWithResult(_0x549517,_0x3fb5c7){_0x3fb5c7=_0x3fb5c7||0xc8;return function(_0x2f03f0){if(_0x2f03f0){return _0x549517['status'](_0x3fb5c7)[_0xecd4('0x19')](_0x2f03f0);}};}function respondWithFilteredResult(_0x3717aa,_0x31202a){return function(_0x1b5246){if(_0x1b5246){var _0x5c7ea6=typeof _0x31202a[_0xecd4('0x1a')]===_0xecd4('0x1b')&&typeof _0x31202a[_0xecd4('0x1c')]===_0xecd4('0x1b');var _0xd594c6=_0x1b5246[_0xecd4('0x1d')];var _0x7f87db=_0x5c7ea6?0x0:_0x31202a[_0xecd4('0x1a')];var _0x2601ad=_0x5c7ea6?_0x1b5246['count']:_0x31202a['offset']+_0x31202a[_0xecd4('0x1c')];var _0x560b40;if(_0x2601ad>=_0xd594c6){_0x2601ad=_0xd594c6;_0x560b40=0xc8;}else{_0x560b40=0xce;}_0x3717aa[_0xecd4('0x1e')](_0x560b40);return _0x3717aa[_0xecd4('0x1f')]('Content-Range',_0x7f87db+'-'+_0x2601ad+'/'+_0xd594c6)[_0xecd4('0x19')](_0x1b5246);}return null;};}function patchUpdates(_0x44eb54){return function(_0xbfabdc){try{jsonpatch[_0xecd4('0x20')](_0xbfabdc,_0x44eb54,!![]);}catch(_0x58e7d7){return BPromise['reject'](_0x58e7d7);}return _0xbfabdc[_0xecd4('0x21')]();};}function saveUpdates(_0x33f387,_0x33232a){return function(_0x1d742d){if(_0x1d742d){return _0x1d742d[_0xecd4('0x22')](_0x33f387)[_0xecd4('0x23')](function(_0x2241d5){return _0x2241d5;});}return null;};}function removeEntity(_0xbea60,_0x15c1d3){return function(_0x5ab856){if(_0x5ab856){return _0x5ab856[_0xecd4('0x24')]()['then'](function(){var _0x515f78=_0x5ab856[_0xecd4('0x25')]({'plain':!![]});var _0x162a5c='ExtractedReports';return db[_0xecd4('0x26')][_0xecd4('0x24')]({'where':{'type':_0x162a5c,'resourceId':_0x515f78['id']}})[_0xecd4('0x23')](function(){return _0x5ab856;});})['then'](function(){_0xbea60['status'](0xcc)[_0xecd4('0x18')]();});}};}function handleEntityNotFound(_0x4ce040,_0x558615){return function(_0x5d96fe){if(!_0x5d96fe){_0x4ce040[_0xecd4('0x17')](0x194);}return _0x5d96fe;};}function handleError(_0x55ffce,_0x1e1586){_0x1e1586=_0x1e1586||0x1f4;return function(_0x2b2a02){logger[_0xecd4('0x27')](_0x2b2a02[_0xecd4('0x28')]);if(_0x2b2a02[_0xecd4('0x29')]){delete _0x2b2a02['name'];}_0x55ffce[_0xecd4('0x1e')](_0x1e1586)[_0xecd4('0x2a')](_0x2b2a02);};}exports['index']=function(_0x4eb71a,_0x525ba1){var _0x39ef8d={},_0x9873a7={},_0x2b1543={'count':0x0,'rows':[]};var _0x16cf36=_[_0xecd4('0x2b')](db[_0xecd4('0x2c')][_0xecd4('0x2d')],function(_0x5f11a2){return{'name':_0x5f11a2[_0xecd4('0x2e')],'type':_0x5f11a2['type'][_0xecd4('0x2f')]};});_0x9873a7['model']=_[_0xecd4('0x2b')](_0x16cf36,_0xecd4('0x29'));_0x9873a7[_0xecd4('0x30')]=_[_0xecd4('0x31')](_0x4eb71a[_0xecd4('0x30')]);_0x9873a7['filters']=_[_0xecd4('0x32')](_0x9873a7['model'],_0x9873a7[_0xecd4('0x30')]);_0x39ef8d['attributes']=_['intersection'](_0x9873a7['model'],qs['fields'](_0x4eb71a['query']['fields']));_0x39ef8d[_0xecd4('0x33')]=_0x39ef8d['attributes'][_0xecd4('0x34')]?_0x39ef8d[_0xecd4('0x33')]:_0x9873a7['model'];if(!_0x4eb71a[_0xecd4('0x30')][_0xecd4('0x35')](_0xecd4('0x36'))){_0x39ef8d[_0xecd4('0x1c')]=qs[_0xecd4('0x1c')](_0x4eb71a[_0xecd4('0x30')][_0xecd4('0x1c')]);_0x39ef8d[_0xecd4('0x1a')]=qs[_0xecd4('0x1a')](_0x4eb71a[_0xecd4('0x30')][_0xecd4('0x1a')]);}_0x39ef8d['order']=qs['sort'](_0x4eb71a[_0xecd4('0x30')][_0xecd4('0x37')]);_0x39ef8d[_0xecd4('0x38')]=qs[_0xecd4('0x39')](_[_0xecd4('0x3a')](_0x4eb71a['query'],_0x9873a7['filters']),_0x16cf36);if(_0x4eb71a[_0xecd4('0x30')][_0xecd4('0x3b')]){_0x39ef8d[_0xecd4('0x38')]=_['merge'](_0x39ef8d[_0xecd4('0x38')],{'$or':_[_0xecd4('0x2b')](_0x16cf36,function(_0x4fcfec){if(_0x4fcfec['type']!=='VIRTUAL'){var _0x42e90f={};_0x42e90f[_0x4fcfec[_0xecd4('0x29')]]={'$like':'%'+_0x4eb71a['query'][_0xecd4('0x3b')]+'%'};return _0x42e90f;}})});}_0x39ef8d=_[_0xecd4('0x3c')]({},_0x39ef8d,_0x4eb71a[_0xecd4('0x3d')]);var _0x4ee1ca={'where':_0x39ef8d[_0xecd4('0x38')]};return db['AnalyticExtractedReport'][_0xecd4('0x1d')](_0x4ee1ca)['then'](function(_0xf279b7){_0x2b1543[_0xecd4('0x1d')]=_0xf279b7;if(_0x4eb71a[_0xecd4('0x30')][_0xecd4('0x3e')]){_0x39ef8d['include']=[{'all':!![]}];}return db[_0xecd4('0x2c')][_0xecd4('0x3f')](_0x39ef8d);})[_0xecd4('0x23')](function(_0x249616){_0x2b1543['rows']=_0x249616;return _0x2b1543;})[_0xecd4('0x23')](respondWithFilteredResult(_0x525ba1,_0x39ef8d))['catch'](handleError(_0x525ba1,null));};exports[_0xecd4('0x40')]=function(_0x301b85,_0x57f72e){var _0x5ee623={'raw':!![],'where':{'id':_0x301b85['params']['id']}},_0x57d885={};_0x57d885[_0xecd4('0x41')]=_[_0xecd4('0x31')](db[_0xecd4('0x2c')]['rawAttributes']);_0x57d885[_0xecd4('0x30')]=_[_0xecd4('0x31')](_0x301b85[_0xecd4('0x30')]);_0x57d885[_0xecd4('0x39')]=_['intersection'](_0x57d885['model'],_0x57d885[_0xecd4('0x30')]);_0x5ee623[_0xecd4('0x33')]=_[_0xecd4('0x32')](_0x57d885[_0xecd4('0x41')],qs['fields'](_0x301b85[_0xecd4('0x30')][_0xecd4('0x42')]));_0x5ee623[_0xecd4('0x33')]=_0x5ee623[_0xecd4('0x33')][_0xecd4('0x34')]?_0x5ee623[_0xecd4('0x33')]:_0x57d885[_0xecd4('0x41')];if(_0x301b85[_0xecd4('0x30')][_0xecd4('0x3e')]){_0x5ee623['include']=[{'all':!![]}];}_0x5ee623=_[_0xecd4('0x3c')]({},_0x5ee623,_0x301b85['options']);return db['AnalyticExtractedReport'][_0xecd4('0x43')](_0x5ee623)[_0xecd4('0x23')](handleEntityNotFound(_0x57f72e,null))[_0xecd4('0x23')](respondWithResult(_0x57f72e,null))[_0xecd4('0x44')](handleError(_0x57f72e,null));};exports[_0xecd4('0x45')]=function(_0x58faeb,_0x48821f){return db['AnalyticExtractedReport'][_0xecd4('0x45')](_0x58faeb[_0xecd4('0x46')],{})[_0xecd4('0x23')](function(_0x1ef64f){var _0x15e521=_0x58faeb[_0xecd4('0x47')]['get']({'plain':!![]});if(!_0x15e521)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15e521[_0xecd4('0x48')]===_0xecd4('0x47')){var _0x414073=_0x1ef64f['get']({'plain':!![]});var _0x335a9f=_0xecd4('0x49');return db['UserProfileSection'][_0xecd4('0x43')]({'where':{'name':_0x335a9f,'userProfileId':_0x15e521[_0xecd4('0x4a')]},'raw':!![]})['then'](function(_0x27062a){if(_0x27062a&&_0x27062a['autoAssociation']===0x0){return db[_0xecd4('0x26')][_0xecd4('0x45')]({'name':_0x414073['name'],'resourceId':_0x414073['id'],'type':_0x27062a[_0xecd4('0x29')],'sectionId':_0x27062a['id']},{})['then'](function(){return _0x1ef64f;});}else{return _0x1ef64f;}})[_0xecd4('0x44')](function(_0x4790fb){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4790fb);throw _0x4790fb;});}return _0x1ef64f;})[_0xecd4('0x23')](respondWithResult(_0x48821f,0xc9))[_0xecd4('0x44')](handleError(_0x48821f,null));};exports['update']=function(_0x2e29cc,_0x547a0e){if(_0x2e29cc[_0xecd4('0x46')]['id']){delete _0x2e29cc['body']['id'];}return db['AnalyticExtractedReport'][_0xecd4('0x43')]({'where':{'id':_0x2e29cc[_0xecd4('0x4b')]['id']}})[_0xecd4('0x23')](handleEntityNotFound(_0x547a0e,null))['then'](saveUpdates(_0x2e29cc[_0xecd4('0x46')],null))[_0xecd4('0x23')](respondWithResult(_0x547a0e,null))[_0xecd4('0x44')](handleError(_0x547a0e,null));};exports[_0xecd4('0x24')]=function(_0x1dd7ca,_0x54421c){return db[_0xecd4('0x2c')][_0xecd4('0x43')]({'where':{'id':_0x1dd7ca['params']['id']}})[_0xecd4('0x23')](handleEntityNotFound(_0x54421c,null))['then'](removeEntity(_0x54421c,null))[_0xecd4('0x44')](handleError(_0x54421c,null));};exports['download']=function(_0x5b09b1,_0x376677,_0xaa3b28){return db['AnalyticExtractedReport'][_0xecd4('0x43')]({'where':{'id':_0x5b09b1['params']['id']},'attributes':[_0xecd4('0x29'),'basename',_0xecd4('0x4c'),_0xecd4('0x4d')],'raw':!![]})[_0xecd4('0x23')](handleEntityNotFound(_0x376677,null))['then'](function(_0x3dd8e5){if(_0x3dd8e5){if(!fs[_0xecd4('0x4e')](path['join'](config[_0xecd4('0x4f')],_0xecd4('0x50'),_0x3dd8e5['savename']))){throw new db[(_0xecd4('0x51'))][(_0xecd4('0x52'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x5b09b1[_0xecd4('0x30')]['exists']){return _0x376677[_0xecd4('0x17')](0xc8);}return _0x376677[_0xecd4('0x53')](path[_0xecd4('0x54')](config[_0xecd4('0x4f')],'server/files/reports',_0x3dd8e5['savename']),util[_0xecd4('0x55')](_0xecd4('0x56'),_0x3dd8e5['basename']||_0x3dd8e5[_0xecd4('0x29')],_0x3dd8e5[_0xecd4('0x4d')][_0xecd4('0x57')]()));}})['catch'](handleError(_0x376677,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index f98b92f..fa4bae4 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 _0x6eeb=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x25f501,_0x4703fc){var _0x2c8ef4=function(_0x341468){while(--_0x341468){_0x25f501['push'](_0x25f501['shift']());}};_0x2c8ef4(++_0x4703fc);}(_0x6eeb,0x6c));var _0xb6ee=function(_0x3a096c,_0x1f9d72){_0x3a096c=_0x3a096c-0x0;var _0x44a6a4=_0x6eeb[_0x3a096c];return _0x44a6a4;};'use strict';var _=require(_0xb6ee('0x0'));var util=require(_0xb6ee('0x1'));var logger=require(_0xb6ee('0x2'))(_0xb6ee('0x3'));var moment=require(_0xb6ee('0x4'));var BPromise=require(_0xb6ee('0x5'));var rp=require(_0xb6ee('0x6'));var fs=require('fs');var path=require(_0xb6ee('0x7'));var rimraf=require(_0xb6ee('0x8'));var config=require(_0xb6ee('0x9'));var attributes=require(_0xb6ee('0xa'));module[_0xb6ee('0xb')]=function(_0x588a56,_0x555fd2){return _0x588a56[_0xb6ee('0xc')](_0xb6ee('0xd'),attributes,{'tableName':_0xb6ee('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cf1=['analytics_extracted_reports','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5c107d,_0x155dbe){var _0x3eaf06=function(_0x348dd6){while(--_0x348dd6){_0x5c107d['push'](_0x5c107d['shift']());}};_0x3eaf06(++_0x155dbe);}(_0x8cf1,0x141));var _0x18cf=function(_0x2c9d02,_0x4a9348){_0x2c9d02=_0x2c9d02-0x0;var _0x5bf651=_0x8cf1[_0x2c9d02];return _0x5bf651;};'use strict';var _=require('lodash');var util=require(_0x18cf('0x0'));var logger=require(_0x18cf('0x1'))(_0x18cf('0x2'));var moment=require('moment');var BPromise=require(_0x18cf('0x3'));var rp=require(_0x18cf('0x4'));var fs=require('fs');var path=require(_0x18cf('0x5'));var rimraf=require(_0x18cf('0x6'));var config=require(_0x18cf('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0x18cf('0x8')]=function(_0xdb3bb,_0x162242){return _0xdb3bb['define']('AnalyticExtractedReport',attributes,{'tableName':_0x18cf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index d884f53..80de4ee 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 _0xc575=['error','code','message','request\x20sent','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xc575,0x123));var _0x5c57=function(_0x4c7e8e,_0x3c5035){_0x4c7e8e=_0x4c7e8e-0x0;var _0x503c3f=_0xc575[_0x4c7e8e];return _0x503c3f;};'use strict';var _=require(_0x5c57('0x0'));var util=require('util');var moment=require(_0x5c57('0x1'));var BPromise=require(_0x5c57('0x2'));var rs=require(_0x5c57('0x3'));var fs=require('fs');var Redis=require(_0x5c57('0x4'));var db=require(_0x5c57('0x5'))['db'];var utils=require(_0x5c57('0x6'));var logger=require(_0x5c57('0x7'))(_0x5c57('0x8'));var config=require(_0x5c57('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5c57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18c168,_0x424c7b,_0x15b3dc){return new BPromise(function(_0x1629b5,_0x2bc30b){return client['request'](_0x18c168,_0x15b3dc)[_0x5c57('0xb')](function(_0xca25d5){logger[_0x5c57('0xc')](_0x5c57('0xd'),_0x424c7b,'request\x20sent');logger[_0x5c57('0xe')](_0x5c57('0xf'),_0x424c7b,'request\x20sent',JSON[_0x5c57('0x10')](_0xca25d5));if(_0xca25d5[_0x5c57('0x11')]){if(_0xca25d5[_0x5c57('0x11')][_0x5c57('0x12')]===0x1f4){logger[_0x5c57('0x11')](_0x5c57('0xd'),_0x424c7b,_0xca25d5['error'][_0x5c57('0x13')]);return _0x2bc30b(_0xca25d5[_0x5c57('0x11')][_0x5c57('0x13')]);}logger[_0x5c57('0x11')](_0x5c57('0xd'),_0x424c7b,_0xca25d5[_0x5c57('0x11')]['message']);return _0x1629b5(_0xca25d5['error'][_0x5c57('0x13')]);}else{logger[_0x5c57('0xc')](_0x5c57('0xd'),_0x424c7b,_0x5c57('0x14'));_0x1629b5(_0xca25d5[_0x5c57('0x15')][_0x5c57('0x13')]);}})['catch'](function(_0x17e5e9){logger[_0x5c57('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x424c7b,_0x17e5e9);_0x2bc30b(_0x17e5e9);});});} \ No newline at end of file +var _0x35e4=['request\x20sent','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x5ebf07,_0x4f28ca){var _0x3251c7=function(_0x464e74){while(--_0x464e74){_0x5ebf07['push'](_0x5ebf07['shift']());}};_0x3251c7(++_0x4f28ca);}(_0x35e4,0x9f));var _0x435e=function(_0x7a8cd3,_0x83d814){_0x7a8cd3=_0x7a8cd3-0x0;var _0x1846c8=_0x35e4[_0x7a8cd3];return _0x1846c8;};'use strict';var _=require('lodash');var util=require(_0x435e('0x0'));var moment=require(_0x435e('0x1'));var BPromise=require(_0x435e('0x2'));var rs=require(_0x435e('0x3'));var fs=require('fs');var Redis=require(_0x435e('0x4'));var db=require(_0x435e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x435e('0x6'))(_0x435e('0x7'));var config=require(_0x435e('0x8'));var jayson=require(_0x435e('0x9'));var client=jayson[_0x435e('0xa')][_0x435e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44c906,_0x271750,_0x169ce9){return new BPromise(function(_0x9bc767,_0x363749){return client[_0x435e('0xc')](_0x44c906,_0x169ce9)[_0x435e('0xd')](function(_0x2d5615){logger[_0x435e('0xe')](_0x435e('0xf'),_0x271750,'request\x20sent');logger['debug'](_0x435e('0x10'),_0x271750,_0x435e('0x11'),JSON[_0x435e('0x12')](_0x2d5615));if(_0x2d5615[_0x435e('0x13')]){if(_0x2d5615[_0x435e('0x13')][_0x435e('0x14')]===0x1f4){logger['error'](_0x435e('0xf'),_0x271750,_0x2d5615[_0x435e('0x13')]['message']);return _0x363749(_0x2d5615[_0x435e('0x13')][_0x435e('0x15')]);}logger[_0x435e('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x271750,_0x2d5615[_0x435e('0x13')][_0x435e('0x15')]);return _0x9bc767(_0x2d5615['error']['message']);}else{logger[_0x435e('0xe')](_0x435e('0xf'),_0x271750,'request\x20sent');_0x9bc767(_0x2d5615['result'][_0x435e('0x15')]);}})['catch'](function(_0x41f78b){logger['error'](_0x435e('0xf'),_0x271750,_0x41f78b);_0x363749(_0x41f78b);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 61b758e..6285314 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 _0xc2af=['express','../../components/interaction/service','isAuthenticated','index','get','put','/:id','update','destroy','exports','multer','connect-timeout'];(function(_0x16bf6a,_0x4abf53){var _0x28fb1f=function(_0x3e815f){while(--_0x3e815f){_0x16bf6a['push'](_0x16bf6a['shift']());}};_0x28fb1f(++_0x4abf53);}(_0xc2af,0x8e));var _0xfc2a=function(_0x44c030,_0x321fba){_0x44c030=_0x44c030-0x0;var _0x336470=_0xc2af[_0x44c030];return _0x336470;};'use strict';var multer=require(_0xfc2a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfc2a('0x1'));var express=require(_0xfc2a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfc2a('0x3'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0xfc2a('0x4')](),controller[_0xfc2a('0x5')]);router[_0xfc2a('0x6')]('/:id',auth[_0xfc2a('0x4')](),controller['show']);router[_0xfc2a('0x6')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xfc2a('0x4')](),controller['create']);router[_0xfc2a('0x7')](_0xfc2a('0x8'),auth['isAuthenticated'](),controller[_0xfc2a('0x9')]);router['delete'](_0xfc2a('0x8'),auth['isAuthenticated'](),controller[_0xfc2a('0xa')]);module[_0xfc2a('0xb')]=router; \ No newline at end of file +var _0x6be4=['isAuthenticated','/:id','download','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x5e8cf1,_0x489252){var _0xafe7ec=function(_0x316a0c){while(--_0x316a0c){_0x5e8cf1['push'](_0x5e8cf1['shift']());}};_0xafe7ec(++_0x489252);}(_0x6be4,0x1ab));var _0x46be=function(_0x2da616,_0x287fa7){_0x2da616=_0x2da616-0x0;var _0x535c88=_0x6be4[_0x2da616];return _0x535c88;};'use strict';var multer=require('multer');var util=require(_0x46be('0x0'));var path=require(_0x46be('0x1'));var timeout=require(_0x46be('0x2'));var express=require('express');var router=express[_0x46be('0x3')]();var fs_extra=require(_0x46be('0x4'));var auth=require(_0x46be('0x5'));var interaction=require(_0x46be('0x6'));var config=require(_0x46be('0x7'));var controller=require(_0x46be('0x8'));router[_0x46be('0x9')]('/',auth[_0x46be('0xa')](),controller['index']);router[_0x46be('0x9')](_0x46be('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x46be('0x9')]('/:id/download',auth[_0x46be('0xa')](),controller[_0x46be('0xc')]);router[_0x46be('0xd')]('/',auth['isAuthenticated'](),controller[_0x46be('0xe')]);router[_0x46be('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x46be('0x10')]);router['delete'](_0x46be('0xb'),auth[_0x46be('0xa')](),controller[_0x46be('0x11')]);module[_0x46be('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index a10c503..bb15908 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 _0x4cf8=['BOOLEAN','exports','STRING'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x4cf8,0x88));var _0x84cf=function(_0xea6018,_0x4cf082){_0xea6018=_0xea6018-0x0;var _0x57b54d=_0x4cf8[_0xea6018];return _0x57b54d;};'use strict';var Sequelize=require('sequelize');module[_0x84cf('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x84cf('0x1')]},'format':{'type':Sequelize[_0x84cf('0x1')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x84cf('0x1')]},'custom':{'type':Sequelize[_0x84cf('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xb2ea=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x156c22,_0x3c9333){var _0x44d3b0=function(_0x221a99){while(--_0x221a99){_0x156c22['push'](_0x156c22['shift']());}};_0x44d3b0(++_0x3c9333);}(_0xb2ea,0x9a));var _0xab2e=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0xb2ea[_0x580b15];return _0x1adb1b;};'use strict';var Sequelize=require(_0xab2e('0x0'));module[_0xab2e('0x1')]={'field':{'type':Sequelize[_0xab2e('0x2')]},'alias':{'type':Sequelize[_0xab2e('0x3')]},'function':{'type':Sequelize[_0xab2e('0x3')]},'format':{'type':Sequelize[_0xab2e('0x3')]},'groupBy':{'type':Sequelize[_0xab2e('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index f1be901..af244a1 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 _0xb638=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','bulkCreate','body','params','destroy','bulkDestroy','AnalyticCustomReport','transaction','CustomReportId','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0xb638,0xff));var _0x8b63=function(_0x2c8838,_0x362297){_0x2c8838=_0x2c8838-0x0;var _0x2c0c17=_0xb638[_0x2c8838];return _0x2c0c17;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b63('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b63('0x1'));var rp=require(_0x8b63('0x2'));var moment=require(_0x8b63('0x3'));var BPromise=require(_0x8b63('0x4'));var Mustache=require('mustache');var util=require(_0x8b63('0x5'));var path=require(_0x8b63('0x6'));var sox=require(_0x8b63('0x7'));var csv=require('to-csv');var ejs=require(_0x8b63('0x8'));var fs=require('fs');var fs_extra=require(_0x8b63('0x9'));var _=require(_0x8b63('0xa'));var squel=require(_0x8b63('0xb'));var crypto=require('crypto');var jsforce=require(_0x8b63('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8b63('0xd'));var querystring=require(_0x8b63('0xe'));var Papa=require('papaparse');var Redis=require(_0x8b63('0xf'));var authService=require(_0x8b63('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8b63('0x11'));var hardwareService=require(_0x8b63('0x12'));var logger=require(_0x8b63('0x13'))(_0x8b63('0x14'));var utils=require(_0x8b63('0x15'));var config=require(_0x8b63('0x16'));var licenseUtil=require(_0x8b63('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a356c,_0xdb9ebc){_0xdb9ebc=_0xdb9ebc||0xcc;return function(_0x1bcda6){if(_0x1bcda6){return _0x3a356c[_0x8b63('0x18')](_0xdb9ebc);}return _0x3a356c[_0x8b63('0x19')](_0xdb9ebc)[_0x8b63('0x1a')]();};}function respondWithResult(_0x3ce98c,_0x4a6891){_0x4a6891=_0x4a6891||0xc8;return function(_0x5a48d3){if(_0x5a48d3){return _0x3ce98c[_0x8b63('0x19')](_0x4a6891)[_0x8b63('0x1b')](_0x5a48d3);}};}function respondWithFilteredResult(_0x3f71f2,_0x2ed228){return function(_0x3970fb){if(_0x3970fb){var _0x476a2f=typeof _0x2ed228[_0x8b63('0x1c')]==='undefined'&&typeof _0x2ed228[_0x8b63('0x1d')]===_0x8b63('0x1e');var _0x49a306=_0x3970fb[_0x8b63('0x1f')];var _0x540316=_0x476a2f?0x0:_0x2ed228['offset'];var _0x4e5873=_0x476a2f?_0x3970fb[_0x8b63('0x1f')]:_0x2ed228[_0x8b63('0x1c')]+_0x2ed228[_0x8b63('0x1d')];var _0x20387c;if(_0x4e5873>=_0x49a306){_0x4e5873=_0x49a306;_0x20387c=0xc8;}else{_0x20387c=0xce;}_0x3f71f2[_0x8b63('0x19')](_0x20387c);return _0x3f71f2['set'](_0x8b63('0x20'),_0x540316+'-'+_0x4e5873+'/'+_0x49a306)[_0x8b63('0x1b')](_0x3970fb);}return null;};}function patchUpdates(_0x15d6ce){return function(_0x427574){try{jsonpatch[_0x8b63('0x21')](_0x427574,_0x15d6ce,!![]);}catch(_0x41432d){return BPromise['reject'](_0x41432d);}return _0x427574[_0x8b63('0x22')]();};}function saveUpdates(_0x2218d1,_0x38d39d){return function(_0x2056ea){if(_0x2056ea){return _0x2056ea[_0x8b63('0x23')](_0x2218d1)[_0x8b63('0x24')](function(_0x926f76){return _0x926f76;});}return null;};}function removeEntity(_0x2a3a3a,_0x236216){return function(_0x19684b){if(_0x19684b){return _0x19684b['destroy']()[_0x8b63('0x24')](function(){_0x2a3a3a['status'](0xcc)[_0x8b63('0x1a')]();});}};}function handleEntityNotFound(_0xe52f47,_0x3be35e){return function(_0x429fbc){if(!_0x429fbc){_0xe52f47['sendStatus'](0x194);}return _0x429fbc;};}function handleError(_0x94d705,_0x1a112d){_0x1a112d=_0x1a112d||0x1f4;return function(_0x58b6e6){logger[_0x8b63('0x25')](_0x58b6e6[_0x8b63('0x26')]);if(_0x58b6e6['name']){delete _0x58b6e6[_0x8b63('0x27')];}_0x94d705[_0x8b63('0x19')](_0x1a112d)[_0x8b63('0x28')](_0x58b6e6);};}exports[_0x8b63('0x29')]=function(_0x710335,_0x2cddf9){var _0x279cd0={},_0x54f796={},_0x579690={'count':0x0,'rows':[]};var _0x1d11f4=_[_0x8b63('0x2a')](db[_0x8b63('0x2b')][_0x8b63('0x2c')],function(_0x2fe946){return{'name':_0x2fe946[_0x8b63('0x2d')],'type':_0x2fe946[_0x8b63('0x2e')]['key']};});_0x54f796[_0x8b63('0x2f')]=_['map'](_0x1d11f4,_0x8b63('0x27'));_0x54f796['query']=_[_0x8b63('0x30')](_0x710335['query']);_0x54f796[_0x8b63('0x31')]=_[_0x8b63('0x32')](_0x54f796[_0x8b63('0x2f')],_0x54f796[_0x8b63('0x33')]);_0x279cd0['attributes']=_[_0x8b63('0x32')](_0x54f796[_0x8b63('0x2f')],qs[_0x8b63('0x34')](_0x710335['query'][_0x8b63('0x34')]));_0x279cd0[_0x8b63('0x35')]=_0x279cd0[_0x8b63('0x35')][_0x8b63('0x36')]?_0x279cd0[_0x8b63('0x35')]:_0x54f796['model'];if(!_0x710335[_0x8b63('0x33')][_0x8b63('0x37')]('nolimit')){_0x279cd0[_0x8b63('0x1d')]=qs[_0x8b63('0x1d')](_0x710335[_0x8b63('0x33')][_0x8b63('0x1d')]);_0x279cd0['offset']=qs['offset'](_0x710335[_0x8b63('0x33')][_0x8b63('0x1c')]);}_0x279cd0[_0x8b63('0x38')]=qs[_0x8b63('0x39')](_0x710335[_0x8b63('0x33')][_0x8b63('0x39')]);_0x279cd0[_0x8b63('0x3a')]=qs[_0x8b63('0x31')](_[_0x8b63('0x3b')](_0x710335[_0x8b63('0x33')],_0x54f796[_0x8b63('0x31')]),_0x1d11f4);if(_0x710335[_0x8b63('0x33')][_0x8b63('0x3c')]){_0x279cd0[_0x8b63('0x3a')]=_[_0x8b63('0x3d')](_0x279cd0[_0x8b63('0x3a')],{'$or':_[_0x8b63('0x2a')](_0x1d11f4,function(_0x9be7a1){if(_0x9be7a1[_0x8b63('0x2e')]!==_0x8b63('0x3e')){var _0x5e5a26={};_0x5e5a26[_0x9be7a1[_0x8b63('0x27')]]={'$like':'%'+_0x710335[_0x8b63('0x33')][_0x8b63('0x3c')]+'%'};return _0x5e5a26;}})});}_0x279cd0=_[_0x8b63('0x3d')]({},_0x279cd0,_0x710335[_0x8b63('0x3f')]);var _0x1efce2={'where':_0x279cd0['where']};return db[_0x8b63('0x2b')][_0x8b63('0x1f')](_0x1efce2)[_0x8b63('0x24')](function(_0x27d7c0){_0x579690[_0x8b63('0x1f')]=_0x27d7c0;if(_0x710335['query'][_0x8b63('0x40')]){_0x279cd0[_0x8b63('0x41')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x8b63('0x42')](_0x279cd0);})[_0x8b63('0x24')](function(_0x1b54e9){_0x579690[_0x8b63('0x43')]=_0x1b54e9;return _0x579690;})['then'](respondWithFilteredResult(_0x2cddf9,_0x279cd0))[_0x8b63('0x44')](handleError(_0x2cddf9,null));};exports['show']=function(_0x2c9cd0,_0x129614){var _0x574a8e={'raw':![],'where':{'id':_0x2c9cd0['params']['id']}},_0x1ce8d4={};_0x1ce8d4[_0x8b63('0x2f')]=_[_0x8b63('0x30')](db['AnalyticFieldReport'][_0x8b63('0x2c')]);_0x1ce8d4['query']=_[_0x8b63('0x30')](_0x2c9cd0[_0x8b63('0x33')]);_0x1ce8d4['filters']=_['intersection'](_0x1ce8d4[_0x8b63('0x2f')],_0x1ce8d4[_0x8b63('0x33')]);_0x574a8e[_0x8b63('0x35')]=_['intersection'](_0x1ce8d4[_0x8b63('0x2f')],qs[_0x8b63('0x34')](_0x2c9cd0[_0x8b63('0x33')]['fields']));_0x574a8e[_0x8b63('0x35')]=_0x574a8e['attributes'][_0x8b63('0x36')]?_0x574a8e[_0x8b63('0x35')]:_0x1ce8d4[_0x8b63('0x2f')];if(_0x2c9cd0[_0x8b63('0x33')][_0x8b63('0x40')]){_0x574a8e[_0x8b63('0x41')]=[{'all':!![]}];}_0x574a8e=_['merge']({},_0x574a8e,_0x2c9cd0[_0x8b63('0x3f')]);return db[_0x8b63('0x2b')][_0x8b63('0x45')](_0x574a8e)['then'](handleEntityNotFound(_0x129614,null))[_0x8b63('0x24')](respondWithResult(_0x129614,null))['catch'](handleError(_0x129614,null));};exports[_0x8b63('0x46')]=function(_0x7c2a6f,_0x5a3fcc){return db[_0x8b63('0x2b')][_0x8b63('0x46')](_0x7c2a6f['body'],{})[_0x8b63('0x24')](respondWithResult(_0x5a3fcc,0xc9))[_0x8b63('0x44')](handleError(_0x5a3fcc,null));};exports[_0x8b63('0x47')]=function(_0x3fcccf,_0x42692a){return db[_0x8b63('0x2b')]['bulkCreate'](_0x3fcccf[_0x8b63('0x48')],{'raw':![],'individualHooks':!![]})[_0x8b63('0x24')](respondWithResult(_0x42692a,0xc9))['catch'](handleError(_0x42692a,null));};exports[_0x8b63('0x23')]=function(_0xa255da,_0xcfb2a0){if(_0xa255da['body']['id']){delete _0xa255da[_0x8b63('0x48')]['id'];}return db[_0x8b63('0x2b')][_0x8b63('0x45')]({'where':{'id':_0xa255da[_0x8b63('0x49')]['id']}})[_0x8b63('0x24')](handleEntityNotFound(_0xcfb2a0,null))[_0x8b63('0x24')](saveUpdates(_0xa255da['body'],null))[_0x8b63('0x24')](respondWithResult(_0xcfb2a0,null))[_0x8b63('0x44')](handleError(_0xcfb2a0,null));};exports[_0x8b63('0x4a')]=function(_0x160fa0,_0x442c02){return db[_0x8b63('0x2b')][_0x8b63('0x45')]({'where':{'id':_0x160fa0[_0x8b63('0x49')]['id']}})[_0x8b63('0x24')](handleEntityNotFound(_0x442c02,null))['then'](removeEntity(_0x442c02,null))[_0x8b63('0x44')](handleError(_0x442c02,null));};exports[_0x8b63('0x4b')]=function(_0x18dfd0,_0x44f100){return db[_0x8b63('0x2b')][_0x8b63('0x4a')]({'where':{'id':_0x18dfd0[_0x8b63('0x33')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x8b63('0x24')](respondWithResult(_0x44f100,0xcc))[_0x8b63('0x44')](handleError(_0x44f100,null));};exports['addFields']=function(_0x22de2b,_0x1dac81,_0x24488c){return db[_0x8b63('0x4c')]['findOne']({'where':{'id':_0x22de2b[_0x8b63('0x49')]['id']}})[_0x8b63('0x24')](handleEntityNotFound(_0x1dac81,null))[_0x8b63('0x24')](function(_0x3cd33b){if(_0x3cd33b){return db['sequelize'][_0x8b63('0x4d')](function(_0x33dd3b){return db['AnalyticFieldReport'][_0x8b63('0x4a')]({'where':{'CustomReportId':_0x22de2b[_0x8b63('0x49')]['id']},'transaction':_0x33dd3b})['then'](function(_0x533f4d){var _0x1b1860=_[_0x8b63('0x2a')](_0x22de2b['body'],function(_0x1d70bf){delete _0x1d70bf['id'];_0x1d70bf[_0x8b63('0x4e')]=_0x22de2b[_0x8b63('0x49')]['id'];return _0x1d70bf;});return db[_0x8b63('0x2b')][_0x8b63('0x47')](_0x1b1860,{'transaction':_0x33dd3b});});})[_0x8b63('0x24')](function(){return db[_0x8b63('0x2b')][_0x8b63('0x42')]({'where':{'CustomReportId':_0x22de2b[_0x8b63('0x49')]['id']}});});}})[_0x8b63('0x24')](respondWithResult(_0x1dac81,null))[_0x8b63('0x44')](handleError(_0x1dac81,null));}; \ No newline at end of file +var _0x6b0a=['to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','error','stack','name','send','index','AnalyticFieldReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','include','findAll','rows','show','params','keys','rawAttributes','length','includeAll','options','catch','create','bulkCreate','body','find','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x135892,_0x203263){var _0x1351d4=function(_0x40bfd8){while(--_0x40bfd8){_0x135892['push'](_0x135892['shift']());}};_0x1351d4(++_0x203263);}(_0x6b0a,0x9f));var _0xa6b0=function(_0x71138f,_0xa3a7b3){_0x71138f=_0x71138f-0x0;var _0x11f1fc=_0x6b0a[_0x71138f];return _0x11f1fc;};'use strict';var emlformat=require(_0xa6b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa6b0('0x1'));var jsonpatch=require(_0xa6b0('0x2'));var rp=require(_0xa6b0('0x3'));var moment=require(_0xa6b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa6b0('0x5'));var util=require(_0xa6b0('0x6'));var path=require(_0xa6b0('0x7'));var sox=require(_0xa6b0('0x8'));var csv=require(_0xa6b0('0x9'));var ejs=require(_0xa6b0('0xa'));var fs=require('fs');var fs_extra=require(_0xa6b0('0xb'));var _=require(_0xa6b0('0xc'));var squel=require(_0xa6b0('0xd'));var crypto=require('crypto');var jsforce=require(_0xa6b0('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa6b0('0xf'));var Papa=require(_0xa6b0('0x10'));var Redis=require('ioredis');var authService=require(_0xa6b0('0x11'));var qs=require(_0xa6b0('0x12'));var as=require(_0xa6b0('0x13'));var hardwareService=require(_0xa6b0('0x14'));var logger=require('../../config/logger')(_0xa6b0('0x15'));var utils=require('../../config/utils');var config=require(_0xa6b0('0x16'));var licenseUtil=require(_0xa6b0('0x17'));var db=require(_0xa6b0('0x18'))['db'];function respondWithStatusCode(_0xd01f44,_0x5e7fbc){_0x5e7fbc=_0x5e7fbc||0xcc;return function(_0x113b6f){if(_0x113b6f){return _0xd01f44[_0xa6b0('0x19')](_0x5e7fbc);}return _0xd01f44[_0xa6b0('0x1a')](_0x5e7fbc)[_0xa6b0('0x1b')]();};}function respondWithResult(_0x3d5ef1,_0x28f2f5){_0x28f2f5=_0x28f2f5||0xc8;return function(_0x488a85){if(_0x488a85){return _0x3d5ef1[_0xa6b0('0x1a')](_0x28f2f5)[_0xa6b0('0x1c')](_0x488a85);}};}function respondWithFilteredResult(_0x456e29,_0x2377ac){return function(_0x58e178){if(_0x58e178){var _0x395ae5=typeof _0x2377ac[_0xa6b0('0x1d')]===_0xa6b0('0x1e')&&typeof _0x2377ac[_0xa6b0('0x1f')]===_0xa6b0('0x1e');var _0x2ffa23=_0x58e178[_0xa6b0('0x20')];var _0x6899b5=_0x395ae5?0x0:_0x2377ac[_0xa6b0('0x1d')];var _0x3f57d3=_0x395ae5?_0x58e178[_0xa6b0('0x20')]:_0x2377ac['offset']+_0x2377ac[_0xa6b0('0x1f')];var _0x5d45d3;if(_0x3f57d3>=_0x2ffa23){_0x3f57d3=_0x2ffa23;_0x5d45d3=0xc8;}else{_0x5d45d3=0xce;}_0x456e29[_0xa6b0('0x1a')](_0x5d45d3);return _0x456e29[_0xa6b0('0x21')]('Content-Range',_0x6899b5+'-'+_0x3f57d3+'/'+_0x2ffa23)[_0xa6b0('0x1c')](_0x58e178);}return null;};}function patchUpdates(_0xbb3412){return function(_0x3c88d0){try{jsonpatch['apply'](_0x3c88d0,_0xbb3412,!![]);}catch(_0x25e767){return BPromise[_0xa6b0('0x22')](_0x25e767);}return _0x3c88d0['save']();};}function saveUpdates(_0x8b8c14,_0x53cb0a){return function(_0x231a18){if(_0x231a18){return _0x231a18[_0xa6b0('0x23')](_0x8b8c14)['then'](function(_0x49eb5c){return _0x49eb5c;});}return null;};}function removeEntity(_0x3e4563,_0x2c4373){return function(_0x2b41df){if(_0x2b41df){return _0x2b41df['destroy']()[_0xa6b0('0x24')](function(){_0x3e4563[_0xa6b0('0x1a')](0xcc)[_0xa6b0('0x1b')]();});}};}function handleEntityNotFound(_0x272286,_0x160d29){return function(_0x28c569){if(!_0x28c569){_0x272286[_0xa6b0('0x19')](0x194);}return _0x28c569;};}function handleError(_0x6b9a0d,_0x2cad78){_0x2cad78=_0x2cad78||0x1f4;return function(_0x4df198){logger[_0xa6b0('0x25')](_0x4df198[_0xa6b0('0x26')]);if(_0x4df198['name']){delete _0x4df198[_0xa6b0('0x27')];}_0x6b9a0d['status'](_0x2cad78)[_0xa6b0('0x28')](_0x4df198);};}exports[_0xa6b0('0x29')]=function(_0x4a7504,_0x691a19){var _0x36176c={},_0x551b71={},_0x29557c={'count':0x0,'rows':[]};var _0x563f07=_['map'](db[_0xa6b0('0x2a')]['rawAttributes'],function(_0x5889db){return{'name':_0x5889db[_0xa6b0('0x2b')],'type':_0x5889db[_0xa6b0('0x2c')][_0xa6b0('0x2d')]};});_0x551b71[_0xa6b0('0x2e')]=_['map'](_0x563f07,_0xa6b0('0x27'));_0x551b71[_0xa6b0('0x2f')]=_['keys'](_0x4a7504[_0xa6b0('0x2f')]);_0x551b71[_0xa6b0('0x30')]=_[_0xa6b0('0x31')](_0x551b71[_0xa6b0('0x2e')],_0x551b71[_0xa6b0('0x2f')]);_0x36176c[_0xa6b0('0x32')]=_[_0xa6b0('0x31')](_0x551b71['model'],qs[_0xa6b0('0x33')](_0x4a7504[_0xa6b0('0x2f')]['fields']));_0x36176c[_0xa6b0('0x32')]=_0x36176c[_0xa6b0('0x32')]['length']?_0x36176c['attributes']:_0x551b71[_0xa6b0('0x2e')];if(!_0x4a7504[_0xa6b0('0x2f')][_0xa6b0('0x34')](_0xa6b0('0x35'))){_0x36176c['limit']=qs[_0xa6b0('0x1f')](_0x4a7504[_0xa6b0('0x2f')][_0xa6b0('0x1f')]);_0x36176c['offset']=qs[_0xa6b0('0x1d')](_0x4a7504['query'][_0xa6b0('0x1d')]);}_0x36176c['order']=qs[_0xa6b0('0x36')](_0x4a7504[_0xa6b0('0x2f')][_0xa6b0('0x36')]);_0x36176c[_0xa6b0('0x37')]=qs['filters'](_[_0xa6b0('0x38')](_0x4a7504[_0xa6b0('0x2f')],_0x551b71[_0xa6b0('0x30')]),_0x563f07);if(_0x4a7504[_0xa6b0('0x2f')][_0xa6b0('0x39')]){_0x36176c['where']=_[_0xa6b0('0x3a')](_0x36176c['where'],{'$or':_[_0xa6b0('0x3b')](_0x563f07,function(_0x5ae4c7){if(_0x5ae4c7[_0xa6b0('0x2c')]!==_0xa6b0('0x3c')){var _0x4fbc7={};_0x4fbc7[_0x5ae4c7[_0xa6b0('0x27')]]={'$like':'%'+_0x4a7504[_0xa6b0('0x2f')][_0xa6b0('0x39')]+'%'};return _0x4fbc7;}})});}_0x36176c=_['merge']({},_0x36176c,_0x4a7504['options']);var _0x5cd989={'where':_0x36176c['where']};return db['AnalyticFieldReport'][_0xa6b0('0x20')](_0x5cd989)[_0xa6b0('0x24')](function(_0x2158f5){_0x29557c[_0xa6b0('0x20')]=_0x2158f5;if(_0x4a7504[_0xa6b0('0x2f')]['includeAll']){_0x36176c[_0xa6b0('0x3d')]=[{'all':!![]}];}return db[_0xa6b0('0x2a')][_0xa6b0('0x3e')](_0x36176c);})[_0xa6b0('0x24')](function(_0x7f123c){_0x29557c[_0xa6b0('0x3f')]=_0x7f123c;return _0x29557c;})[_0xa6b0('0x24')](respondWithFilteredResult(_0x691a19,_0x36176c))['catch'](handleError(_0x691a19,null));};exports[_0xa6b0('0x40')]=function(_0x509784,_0x10d186){var _0x413f59={'raw':![],'where':{'id':_0x509784[_0xa6b0('0x41')]['id']}},_0x27084e={};_0x27084e[_0xa6b0('0x2e')]=_[_0xa6b0('0x42')](db[_0xa6b0('0x2a')][_0xa6b0('0x43')]);_0x27084e['query']=_[_0xa6b0('0x42')](_0x509784[_0xa6b0('0x2f')]);_0x27084e[_0xa6b0('0x30')]=_[_0xa6b0('0x31')](_0x27084e[_0xa6b0('0x2e')],_0x27084e['query']);_0x413f59[_0xa6b0('0x32')]=_[_0xa6b0('0x31')](_0x27084e[_0xa6b0('0x2e')],qs[_0xa6b0('0x33')](_0x509784[_0xa6b0('0x2f')][_0xa6b0('0x33')]));_0x413f59['attributes']=_0x413f59[_0xa6b0('0x32')][_0xa6b0('0x44')]?_0x413f59['attributes']:_0x27084e['model'];if(_0x509784[_0xa6b0('0x2f')][_0xa6b0('0x45')]){_0x413f59[_0xa6b0('0x3d')]=[{'all':!![]}];}_0x413f59=_[_0xa6b0('0x3a')]({},_0x413f59,_0x509784[_0xa6b0('0x46')]);return db[_0xa6b0('0x2a')]['find'](_0x413f59)[_0xa6b0('0x24')](handleEntityNotFound(_0x10d186,null))[_0xa6b0('0x24')](respondWithResult(_0x10d186,null))[_0xa6b0('0x47')](handleError(_0x10d186,null));};exports[_0xa6b0('0x48')]=function(_0x2943b1,_0x3e5bae){return db[_0xa6b0('0x2a')][_0xa6b0('0x48')](_0x2943b1['body'],{})[_0xa6b0('0x24')](respondWithResult(_0x3e5bae,0xc9))[_0xa6b0('0x47')](handleError(_0x3e5bae,null));};exports[_0xa6b0('0x49')]=function(_0x3de718,_0x1fcf7c){return db[_0xa6b0('0x2a')][_0xa6b0('0x49')](_0x3de718[_0xa6b0('0x4a')],{'raw':![],'individualHooks':!![]})[_0xa6b0('0x24')](respondWithResult(_0x1fcf7c,0xc9))[_0xa6b0('0x47')](handleError(_0x1fcf7c,null));};exports[_0xa6b0('0x23')]=function(_0x42cafb,_0xf8a95e){if(_0x42cafb[_0xa6b0('0x4a')]['id']){delete _0x42cafb['body']['id'];}return db[_0xa6b0('0x2a')][_0xa6b0('0x4b')]({'where':{'id':_0x42cafb[_0xa6b0('0x41')]['id']}})['then'](handleEntityNotFound(_0xf8a95e,null))[_0xa6b0('0x24')](saveUpdates(_0x42cafb[_0xa6b0('0x4a')],null))[_0xa6b0('0x24')](respondWithResult(_0xf8a95e,null))[_0xa6b0('0x47')](handleError(_0xf8a95e,null));};exports[_0xa6b0('0x4c')]=function(_0x2dd5e1,_0x525a31){return db[_0xa6b0('0x2a')][_0xa6b0('0x4b')]({'where':{'id':_0x2dd5e1[_0xa6b0('0x41')]['id']}})[_0xa6b0('0x24')](handleEntityNotFound(_0x525a31,null))[_0xa6b0('0x24')](removeEntity(_0x525a31,null))[_0xa6b0('0x47')](handleError(_0x525a31,null));};exports[_0xa6b0('0x4d')]=function(_0x186283,_0x542522){return db['AnalyticFieldReport'][_0xa6b0('0x4c')]({'where':{'id':_0x186283[_0xa6b0('0x2f')][_0xa6b0('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0xa6b0('0x24')](respondWithResult(_0x542522,0xcc))[_0xa6b0('0x47')](handleError(_0x542522,null));};exports[_0xa6b0('0x4f')]=function(_0x25ea8e,_0x28e558,_0x30fc9a){return db[_0xa6b0('0x50')]['findOne']({'where':{'id':_0x25ea8e[_0xa6b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x28e558,null))[_0xa6b0('0x24')](function(_0x3479e2){if(_0x3479e2){return db[_0xa6b0('0x51')][_0xa6b0('0x52')](function(_0x1ccda3){return db[_0xa6b0('0x2a')]['destroy']({'where':{'CustomReportId':_0x25ea8e['params']['id']},'transaction':_0x1ccda3})['then'](function(_0x589f2f){var _0x5b335e=_[_0xa6b0('0x3b')](_0x25ea8e[_0xa6b0('0x4a')],function(_0x1f885d){delete _0x1f885d['id'];_0x1f885d[_0xa6b0('0x53')]=_0x25ea8e['params']['id'];return _0x1f885d;});return db[_0xa6b0('0x2a')][_0xa6b0('0x49')](_0x5b335e,{'transaction':_0x1ccda3});});})[_0xa6b0('0x24')](function(){return db[_0xa6b0('0x2a')][_0xa6b0('0x3e')]({'where':{'CustomReportId':_0x25ea8e[_0xa6b0('0x41')]['id']}});});}})[_0xa6b0('0x24')](respondWithResult(_0x28e558,null))[_0xa6b0('0x47')](handleError(_0x28e558,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index ca32fca..38915d3 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 _0xb8e7=['util','api','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','define','analytics_report_fields','lodash'];(function(_0xdfaa2e,_0x340874){var _0x2c39b5=function(_0x2838fb){while(--_0x2838fb){_0xdfaa2e['push'](_0xdfaa2e['shift']());}};_0x2c39b5(++_0x340874);}(_0xb8e7,0x18b));var _0x7b8e=function(_0x43b349,_0x534986){_0x43b349=_0x43b349-0x0;var _0x4f7cc9=_0xb8e7[_0x43b349];return _0x4f7cc9;};'use strict';var _=require(_0x7b8e('0x0'));var util=require(_0x7b8e('0x1'));var logger=require('../../config/logger')(_0x7b8e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7b8e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b8e('0x4'));var config=require(_0x7b8e('0x5'));var attributes=require(_0x7b8e('0x6'));module['exports']=function(_0x5646e0,_0x52e0f8){return _0x5646e0[_0x7b8e('0x7')]('AnalyticFieldReport',attributes,{'tableName':_0x7b8e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6cd2=['../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash','../../config/logger','request-promise','path','rimraf'];(function(_0x40001a,_0x57f2ae){var _0x4cec45=function(_0x5e4166){while(--_0x5e4166){_0x40001a['push'](_0x40001a['shift']());}};_0x4cec45(++_0x57f2ae);}(_0x6cd2,0xeb));var _0x26cd=function(_0x551a0d,_0x7379f9){_0x551a0d=_0x551a0d-0x0;var _0x332a8f=_0x6cd2[_0x551a0d];return _0x332a8f;};'use strict';var _=require(_0x26cd('0x0'));var util=require('util');var logger=require(_0x26cd('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x26cd('0x2'));var fs=require('fs');var path=require(_0x26cd('0x3'));var rimraf=require(_0x26cd('0x4'));var config=require(_0x26cd('0x5'));var attributes=require(_0x26cd('0x6'));module[_0x26cd('0x7')]=function(_0x3d125e,_0x4ad7bf){return _0x3d125e[_0x26cd('0x8')]('AnalyticFieldReport',attributes,{'tableName':_0x26cd('0x9'),'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 579de79..81fa5fa 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 _0xf980=['then','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x445101,_0x2414bf){var _0x3c3d04=function(_0x249067){while(--_0x249067){_0x445101['push'](_0x445101['shift']());}};_0x3c3d04(++_0x2414bf);}(_0xf980,0xcf));var _0x0f98=function(_0x505a68,_0xa297b7){_0x505a68=_0x505a68-0x0;var _0x4caac6=_0xf980[_0x505a68];return _0x4caac6;};'use strict';var _=require(_0x0f98('0x0'));var util=require(_0x0f98('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0f98('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f98('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f98('0x4'))(_0x0f98('0x5'));var config=require(_0x0f98('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0f98('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a538e,_0x540997,_0x162a92){return new BPromise(function(_0xbf3725,_0x5603f1){return client[_0x0f98('0x8')](_0x4a538e,_0x162a92)[_0x0f98('0x9')](function(_0x1d8260){logger['info'](_0x0f98('0xa'),_0x540997,'request\x20sent');logger[_0x0f98('0xb')](_0x0f98('0xc'),_0x540997,_0x0f98('0xd'),JSON['stringify'](_0x1d8260));if(_0x1d8260[_0x0f98('0xe')]){if(_0x1d8260['error']['code']===0x1f4){logger[_0x0f98('0xe')](_0x0f98('0xa'),_0x540997,_0x1d8260[_0x0f98('0xe')][_0x0f98('0xf')]);return _0x5603f1(_0x1d8260[_0x0f98('0xe')]['message']);}logger[_0x0f98('0xe')](_0x0f98('0xa'),_0x540997,_0x1d8260['error'][_0x0f98('0xf')]);return _0xbf3725(_0x1d8260[_0x0f98('0xe')]['message']);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x540997,_0x0f98('0xd'));_0xbf3725(_0x1d8260[_0x0f98('0x10')][_0x0f98('0xf')]);}})[_0x0f98('0x11')](function(_0x445b59){logger[_0x0f98('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x540997,_0x445b59);_0x5603f1(_0x445b59);});});} \ No newline at end of file +var _0x6b13=['rpc','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2c6bf7,_0x364f24){var _0x431b96=function(_0x524184){while(--_0x524184){_0x2c6bf7['push'](_0x2c6bf7['shift']());}};_0x431b96(++_0x364f24);}(_0x6b13,0x98));var _0x36b1=function(_0x37fb3a,_0x5a14ee){_0x37fb3a=_0x37fb3a-0x0;var _0x1e5c8f=_0x6b13[_0x37fb3a];return _0x1e5c8f;};'use strict';var _=require(_0x36b1('0x0'));var util=require(_0x36b1('0x1'));var moment=require(_0x36b1('0x2'));var BPromise=require(_0x36b1('0x3'));var rs=require(_0x36b1('0x4'));var fs=require('fs');var Redis=require(_0x36b1('0x5'));var db=require(_0x36b1('0x6'))['db'];var utils=require(_0x36b1('0x7'));var logger=require(_0x36b1('0x8'))(_0x36b1('0x9'));var config=require('../../config/environment');var jayson=require(_0x36b1('0xa'));var client=jayson['client'][_0x36b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x175682,_0x441c99,_0x126a22){return new BPromise(function(_0x147519,_0x6885db){return client[_0x36b1('0xc')](_0x175682,_0x126a22)[_0x36b1('0xd')](function(_0xf9abe1){logger[_0x36b1('0xe')](_0x36b1('0xf'),_0x441c99,_0x36b1('0x10'));logger[_0x36b1('0x11')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x441c99,_0x36b1('0x10'),JSON['stringify'](_0xf9abe1));if(_0xf9abe1['error']){if(_0xf9abe1['error'][_0x36b1('0x12')]===0x1f4){logger['error'](_0x36b1('0xf'),_0x441c99,_0xf9abe1['error']['message']);return _0x6885db(_0xf9abe1[_0x36b1('0x13')][_0x36b1('0x14')]);}logger[_0x36b1('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x441c99,_0xf9abe1[_0x36b1('0x13')][_0x36b1('0x14')]);return _0x147519(_0xf9abe1['error'][_0x36b1('0x14')]);}else{logger[_0x36b1('0xe')](_0x36b1('0xf'),_0x441c99,_0x36b1('0x10'));_0x147519(_0xf9abe1[_0x36b1('0x15')][_0x36b1('0x14')]);}})[_0x36b1('0x16')](function(_0x41b4d6){logger['error'](_0x36b1('0xf'),_0x441c99,_0x41b4d6);_0x6885db(_0x41b4d6);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index e5ff4ac..3f2310e 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(_0x53948f,_0x2f27ad){var _0xf976f4=function(_0x2cdf8a){while(--_0x2cdf8a){_0x53948f['push'](_0x53948f['shift']());}};_0xf976f4(++_0x2f27ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x7a066f,_0x4ae949){var _0xb80b30=function(_0x4eba15){while(--_0x4eba15){_0x7a066f['push'](_0x7a066f['shift']());}};_0xb80b30(++_0x4ae949);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 13619b3..9fcc19f 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 _0x9649=['sequelize','exports','name','STRING','TEXT'];(function(_0x26ceb9,_0x448ef9){var _0x563540=function(_0x4b7988){while(--_0x4b7988){_0x26ceb9['push'](_0x26ceb9['shift']());}};_0x563540(++_0x448ef9);}(_0x9649,0x118));var _0x9964=function(_0x464c45,_0x4910fa){_0x464c45=_0x464c45-0x0;var _0x74ed02=_0x9649[_0x464c45];return _0x74ed02;};'use strict';var Sequelize=require(_0x9964('0x0'));module[_0x9964('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9964('0x2')},'table':{'type':Sequelize[_0x9964('0x3')]},'metric':{'type':Sequelize[_0x9964('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc961=['STRING','name','TEXT','sequelize','exports'];(function(_0x2ca772,_0x52c3bf){var _0x4e940f=function(_0x6a3747){while(--_0x6a3747){_0x2ca772['push'](_0x2ca772['shift']());}};_0x4e940f(++_0x52c3bf);}(_0xc961,0x17a));var _0x1c96=function(_0x6be9d9,_0x153d7e){_0x6be9d9=_0x6be9d9-0x0;var _0x43858f=_0xc961[_0x6be9d9];return _0x43858f;};'use strict';var Sequelize=require(_0x1c96('0x0'));module[_0x1c96('0x1')]={'name':{'type':Sequelize[_0x1c96('0x2')],'allowNull':![],'unique':_0x1c96('0x3')},'table':{'type':Sequelize[_0x1c96('0x2')]},'metric':{'type':Sequelize[_0x1c96('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index afa0d75..35b81ce 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 _0x84ab=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Metrics','UserProfileResource','error','stack','name','map','AnalyticMetric','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','include','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0x84ab,0x12f));var _0xb84a=function(_0x15fc3c,_0x35665b){_0x15fc3c=_0x15fc3c-0x0;var _0x94c5c8=_0x84ab[_0x15fc3c];return _0x94c5c8;};'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'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){var _0x1aab7d=_0x3aa06f[_0xb84a('0x24')]({'plain':!![]});var _0x409df0=_0xb84a('0x25');return db[_0xb84a('0x26')][_0xb84a('0x23')]({'where':{'type':_0x409df0,'resourceId':_0x1aab7d['id']}})[_0xb84a('0x22')](function(){return _0x3aa06f;});})[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x1db72c,_0x2fe40d){return function(_0x35d1f7){if(!_0x35d1f7){_0x1db72c[_0xb84a('0x16')](0x194);}return _0x35d1f7;};}function handleError(_0x97d71b,_0x5349ea){_0x5349ea=_0x5349ea||0x1f4;return function(_0x582954){logger[_0xb84a('0x27')](_0x582954[_0xb84a('0x28')]);if(_0x582954['name']){delete _0x582954[_0xb84a('0x29')];}_0x97d71b[_0xb84a('0x17')](_0x5349ea)['send'](_0x582954);};}exports['index']=function(_0x28f2e7,_0x8e9319){var _0x49ba3d={},_0x251778={},_0xba1147={'count':0x0,'rows':[]};var _0x3abc22=_[_0xb84a('0x2a')](db[_0xb84a('0x2b')][_0xb84a('0x2c')],function(_0x34b212){return{'name':_0x34b212[_0xb84a('0x2d')],'type':_0x34b212['type'][_0xb84a('0x2e')]};});_0x251778['model']=_['map'](_0x3abc22,_0xb84a('0x29'));_0x251778[_0xb84a('0x2f')]=_['keys'](_0x28f2e7['query']);_0x251778[_0xb84a('0x30')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],_0x251778[_0xb84a('0x2f')]);_0x49ba3d[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],qs[_0xb84a('0x34')](_0x28f2e7['query'][_0xb84a('0x34')]));_0x49ba3d[_0xb84a('0x33')]=_0x49ba3d[_0xb84a('0x33')][_0xb84a('0x35')]?_0x49ba3d[_0xb84a('0x33')]:_0x251778[_0xb84a('0x32')];if(!_0x28f2e7[_0xb84a('0x2f')]['hasOwnProperty'](_0xb84a('0x36'))){_0x49ba3d['limit']=qs[_0xb84a('0x1c')](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x49ba3d['offset']=qs['offset'](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1a')]);}_0x49ba3d[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_0x28f2e7[_0xb84a('0x2f')]['sort']);_0x49ba3d[_0xb84a('0x39')]=qs[_0xb84a('0x30')](_['pick'](_0x28f2e7[_0xb84a('0x2f')],_0x251778[_0xb84a('0x30')]),_0x3abc22);if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3a')]){_0x49ba3d['where']=_['merge'](_0x49ba3d['where'],{'$or':_[_0xb84a('0x2a')](_0x3abc22,function(_0x11e1ac){if(_0x11e1ac[_0xb84a('0x3b')]!==_0xb84a('0x3c')){var _0x55b0b8={};_0x55b0b8[_0x11e1ac[_0xb84a('0x29')]]={'$like':'%'+_0x28f2e7['query'][_0xb84a('0x3a')]+'%'};return _0x55b0b8;}})});}_0x49ba3d=_['merge']({},_0x49ba3d,_0x28f2e7['options']);var _0x59d7a1={'where':_0x49ba3d[_0xb84a('0x39')]};return db[_0xb84a('0x2b')][_0xb84a('0x1d')](_0x59d7a1)[_0xb84a('0x22')](function(_0x5e547e){_0xba1147[_0xb84a('0x1d')]=_0x5e547e;if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x49ba3d[_0xb84a('0x3e')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x49ba3d);})[_0xb84a('0x22')](function(_0x1f3e04){_0xba1147['rows']=_0x1f3e04;return _0xba1147;})[_0xb84a('0x22')](respondWithFilteredResult(_0x8e9319,_0x49ba3d))[_0xb84a('0x3f')](handleError(_0x8e9319,null));};exports[_0xb84a('0x40')]=function(_0x25280a,_0x3f005b){var _0x241536={'raw':!![],'where':{'id':_0x25280a[_0xb84a('0x41')]['id']}},_0x24d700={};_0x24d700[_0xb84a('0x32')]=_[_0xb84a('0x42')](db[_0xb84a('0x2b')][_0xb84a('0x2c')]);_0x24d700[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x25280a[_0xb84a('0x2f')]);_0x24d700['filters']=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],_0x24d700[_0xb84a('0x2f')]);_0x241536[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],qs['fields'](_0x25280a[_0xb84a('0x2f')]['fields']));_0x241536[_0xb84a('0x33')]=_0x241536[_0xb84a('0x33')][_0xb84a('0x35')]?_0x241536[_0xb84a('0x33')]:_0x24d700['model'];if(_0x25280a[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x241536[_0xb84a('0x3e')]=[{'all':!![]}];}_0x241536=_['merge']({},_0x241536,_0x25280a['options']);return db[_0xb84a('0x2b')][_0xb84a('0x43')](_0x241536)[_0xb84a('0x22')](handleEntityNotFound(_0x3f005b,null))['then'](respondWithResult(_0x3f005b,null))['catch'](handleError(_0x3f005b,null));};exports['create']=function(_0x45630d,_0x384a0d){return db[_0xb84a('0x2b')][_0xb84a('0x44')](_0x45630d[_0xb84a('0x45')],{})['then'](function(_0x4b40fe){var _0x5b853a=_0x45630d['user'][_0xb84a('0x24')]({'plain':!![]});if(!_0x5b853a)throw new Error(_0xb84a('0x46'));if(_0x5b853a['role']===_0xb84a('0x47')){var _0xc8bac2=_0x4b40fe[_0xb84a('0x24')]({'plain':!![]});var _0x2f70f0=_0xb84a('0x25');return db[_0xb84a('0x48')]['find']({'where':{'name':_0x2f70f0,'userProfileId':_0x5b853a['userProfileId']},'raw':!![]})[_0xb84a('0x22')](function(_0x50172a){if(_0x50172a&&_0x50172a[_0xb84a('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0xc8bac2['name'],'resourceId':_0xc8bac2['id'],'type':_0x50172a[_0xb84a('0x29')],'sectionId':_0x50172a['id']},{})[_0xb84a('0x22')](function(){return _0x4b40fe;});}else{return _0x4b40fe;}})[_0xb84a('0x3f')](function(_0x25b6a0){logger[_0xb84a('0x27')](_0xb84a('0x4a'),_0x25b6a0);throw _0x25b6a0;});}return _0x4b40fe;})[_0xb84a('0x22')](respondWithResult(_0x384a0d,0xc9))[_0xb84a('0x3f')](handleError(_0x384a0d,null));};exports['update']=function(_0x5afdd0,_0x4c5bdf){if(_0x5afdd0[_0xb84a('0x45')]['id']){delete _0x5afdd0[_0xb84a('0x45')]['id'];}return db['AnalyticMetric'][_0xb84a('0x43')]({'where':{'id':_0x5afdd0['params']['id']}})['then'](handleEntityNotFound(_0x4c5bdf,null))['then'](saveUpdates(_0x5afdd0[_0xb84a('0x45')],null))[_0xb84a('0x22')](respondWithResult(_0x4c5bdf,null))[_0xb84a('0x3f')](handleError(_0x4c5bdf,null));};exports['destroy']=function(_0x5f757e,_0x2e98bf){return db[_0xb84a('0x2b')]['find']({'where':{'id':_0x5f757e[_0xb84a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e98bf,null))['then'](removeEntity(_0x2e98bf,null))[_0xb84a('0x3f')](handleError(_0x2e98bf,null));}; \ No newline at end of file +var _0x8d0e=['then','get','Metrics','UserProfileResource','end','sendStatus','error','stack','name','send','AnalyticMetric','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy'];(function(_0x3b8139,_0x459b80){var _0x5143a4=function(_0x452ffe){while(--_0x452ffe){_0x3b8139['push'](_0x3b8139['shift']());}};_0x5143a4(++_0x459b80);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x34fdc2,_0x526049){_0x34fdc2=_0x34fdc2-0x0;var _0x4dde3e=_0x8d0e[_0x34fdc2];return _0x4dde3e;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];function respondWithStatusCode(_0x5934b2,_0x38fac0){_0x38fac0=_0x38fac0||0xcc;return function(_0x15b9e5){if(_0x15b9e5){return _0x5934b2['sendStatus'](_0x38fac0);}return _0x5934b2[_0xe8d0('0x1b')](_0x38fac0)['end']();};}function respondWithResult(_0x59b4b7,_0x90a1ea){_0x90a1ea=_0x90a1ea||0xc8;return function(_0x2aa906){if(_0x2aa906){return _0x59b4b7[_0xe8d0('0x1b')](_0x90a1ea)[_0xe8d0('0x1c')](_0x2aa906);}};}function respondWithFilteredResult(_0x15d3a1,_0x7151c6){return function(_0x52818a){if(_0x52818a){var _0x6ccffa=typeof _0x7151c6['offset']===_0xe8d0('0x1d')&&typeof _0x7151c6[_0xe8d0('0x1e')]===_0xe8d0('0x1d');var _0x4d1db4=_0x52818a['count'];var _0x47c67a=_0x6ccffa?0x0:_0x7151c6[_0xe8d0('0x1f')];var _0x384854=_0x6ccffa?_0x52818a[_0xe8d0('0x20')]:_0x7151c6[_0xe8d0('0x1f')]+_0x7151c6[_0xe8d0('0x1e')];var _0x588133;if(_0x384854>=_0x4d1db4){_0x384854=_0x4d1db4;_0x588133=0xc8;}else{_0x588133=0xce;}_0x15d3a1[_0xe8d0('0x1b')](_0x588133);return _0x15d3a1[_0xe8d0('0x21')]('Content-Range',_0x47c67a+'-'+_0x384854+'/'+_0x4d1db4)['json'](_0x52818a);}return null;};}function patchUpdates(_0x554402){return function(_0x384a60){try{jsonpatch[_0xe8d0('0x22')](_0x384a60,_0x554402,!![]);}catch(_0x25363b){return BPromise[_0xe8d0('0x23')](_0x25363b);}return _0x384a60[_0xe8d0('0x24')]();};}function saveUpdates(_0x23a945,_0x1bd25c){return function(_0x28a6b5){if(_0x28a6b5){return _0x28a6b5[_0xe8d0('0x25')](_0x23a945)['then'](function(_0xed8f2e){return _0xed8f2e;});}return null;};}function removeEntity(_0x9f747,_0x572c25){return function(_0x106614){if(_0x106614){return _0x106614[_0xe8d0('0x26')]()[_0xe8d0('0x27')](function(){var _0xd86c76=_0x106614[_0xe8d0('0x28')]({'plain':!![]});var _0x149dfd=_0xe8d0('0x29');return db[_0xe8d0('0x2a')][_0xe8d0('0x26')]({'where':{'type':_0x149dfd,'resourceId':_0xd86c76['id']}})[_0xe8d0('0x27')](function(){return _0x106614;});})[_0xe8d0('0x27')](function(){_0x9f747['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0x26dd52,_0x10dec2){return function(_0x486f49){if(!_0x486f49){_0x26dd52[_0xe8d0('0x2c')](0x194);}return _0x486f49;};}function handleError(_0x343b08,_0x526240){_0x526240=_0x526240||0x1f4;return function(_0x1519e2){logger[_0xe8d0('0x2d')](_0x1519e2[_0xe8d0('0x2e')]);if(_0x1519e2[_0xe8d0('0x2f')]){delete _0x1519e2[_0xe8d0('0x2f')];}_0x343b08['status'](_0x526240)[_0xe8d0('0x30')](_0x1519e2);};}exports['index']=function(_0x5d3276,_0x50ad3c){var _0x547a2b={},_0x13cd4c={},_0x36ccec={'count':0x0,'rows':[]};var _0x5151fa=_['map'](db[_0xe8d0('0x31')]['rawAttributes'],function(_0x3b5d31){return{'name':_0x3b5d31[_0xe8d0('0x32')],'type':_0x3b5d31[_0xe8d0('0x33')][_0xe8d0('0x34')]};});_0x13cd4c[_0xe8d0('0x35')]=_['map'](_0x5151fa,_0xe8d0('0x2f'));_0x13cd4c[_0xe8d0('0x36')]=_[_0xe8d0('0x37')](_0x5d3276[_0xe8d0('0x36')]);_0x13cd4c['filters']=_[_0xe8d0('0x38')](_0x13cd4c[_0xe8d0('0x35')],_0x13cd4c['query']);_0x547a2b[_0xe8d0('0x39')]=_['intersection'](_0x13cd4c[_0xe8d0('0x35')],qs['fields'](_0x5d3276[_0xe8d0('0x36')]['fields']));_0x547a2b[_0xe8d0('0x39')]=_0x547a2b[_0xe8d0('0x39')][_0xe8d0('0x3a')]?_0x547a2b[_0xe8d0('0x39')]:_0x13cd4c['model'];if(!_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x3b')](_0xe8d0('0x3c'))){_0x547a2b['limit']=qs[_0xe8d0('0x1e')](_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x1e')]);_0x547a2b[_0xe8d0('0x1f')]=qs[_0xe8d0('0x1f')](_0x5d3276['query'][_0xe8d0('0x1f')]);}_0x547a2b[_0xe8d0('0x3d')]=qs[_0xe8d0('0x3e')](_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x3e')]);_0x547a2b[_0xe8d0('0x3f')]=qs[_0xe8d0('0x40')](_[_0xe8d0('0x41')](_0x5d3276['query'],_0x13cd4c['filters']),_0x5151fa);if(_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x42')]){_0x547a2b[_0xe8d0('0x3f')]=_[_0xe8d0('0x43')](_0x547a2b[_0xe8d0('0x3f')],{'$or':_['map'](_0x5151fa,function(_0x2e4362){if(_0x2e4362['type']!==_0xe8d0('0x44')){var _0x458294={};_0x458294[_0x2e4362[_0xe8d0('0x2f')]]={'$like':'%'+_0x5d3276['query'][_0xe8d0('0x42')]+'%'};return _0x458294;}})});}_0x547a2b=_[_0xe8d0('0x43')]({},_0x547a2b,_0x5d3276[_0xe8d0('0x45')]);var _0x230a90={'where':_0x547a2b[_0xe8d0('0x3f')]};return db['AnalyticMetric']['count'](_0x230a90)['then'](function(_0x4cf0da){_0x36ccec[_0xe8d0('0x20')]=_0x4cf0da;if(_0x5d3276['query'][_0xe8d0('0x46')]){_0x547a2b[_0xe8d0('0x47')]=[{'all':!![]}];}return db[_0xe8d0('0x31')][_0xe8d0('0x48')](_0x547a2b);})[_0xe8d0('0x27')](function(_0x1156da){_0x36ccec[_0xe8d0('0x49')]=_0x1156da;return _0x36ccec;})[_0xe8d0('0x27')](respondWithFilteredResult(_0x50ad3c,_0x547a2b))['catch'](handleError(_0x50ad3c,null));};exports[_0xe8d0('0x4a')]=function(_0x1da8b2,_0x4a3740){var _0x4bcdff={'raw':!![],'where':{'id':_0x1da8b2[_0xe8d0('0x4b')]['id']}},_0x3825a1={};_0x3825a1[_0xe8d0('0x35')]=_['keys'](db[_0xe8d0('0x31')][_0xe8d0('0x4c')]);_0x3825a1['query']=_[_0xe8d0('0x37')](_0x1da8b2[_0xe8d0('0x36')]);_0x3825a1['filters']=_[_0xe8d0('0x38')](_0x3825a1[_0xe8d0('0x35')],_0x3825a1[_0xe8d0('0x36')]);_0x4bcdff[_0xe8d0('0x39')]=_[_0xe8d0('0x38')](_0x3825a1[_0xe8d0('0x35')],qs[_0xe8d0('0x4d')](_0x1da8b2[_0xe8d0('0x36')]['fields']));_0x4bcdff[_0xe8d0('0x39')]=_0x4bcdff[_0xe8d0('0x39')][_0xe8d0('0x3a')]?_0x4bcdff[_0xe8d0('0x39')]:_0x3825a1[_0xe8d0('0x35')];if(_0x1da8b2[_0xe8d0('0x36')][_0xe8d0('0x46')]){_0x4bcdff[_0xe8d0('0x47')]=[{'all':!![]}];}_0x4bcdff=_[_0xe8d0('0x43')]({},_0x4bcdff,_0x1da8b2[_0xe8d0('0x45')]);return db[_0xe8d0('0x31')][_0xe8d0('0x4e')](_0x4bcdff)['then'](handleEntityNotFound(_0x4a3740,null))[_0xe8d0('0x27')](respondWithResult(_0x4a3740,null))[_0xe8d0('0x4f')](handleError(_0x4a3740,null));};exports[_0xe8d0('0x50')]=function(_0xad7d94,_0x34047c){return db[_0xe8d0('0x31')][_0xe8d0('0x50')](_0xad7d94['body'],{})[_0xe8d0('0x27')](function(_0x424764){var _0x151cf4=_0xad7d94[_0xe8d0('0x51')]['get']({'plain':!![]});if(!_0x151cf4)throw new Error(_0xe8d0('0x52'));if(_0x151cf4['role']===_0xe8d0('0x51')){var _0x382ae9=_0x424764[_0xe8d0('0x28')]({'plain':!![]});var _0x158d24=_0xe8d0('0x29');return db[_0xe8d0('0x53')][_0xe8d0('0x4e')]({'where':{'name':_0x158d24,'userProfileId':_0x151cf4['userProfileId']},'raw':!![]})[_0xe8d0('0x27')](function(_0x55f93d){if(_0x55f93d&&_0x55f93d['autoAssociation']===0x0){return db[_0xe8d0('0x2a')]['create']({'name':_0x382ae9[_0xe8d0('0x2f')],'resourceId':_0x382ae9['id'],'type':_0x55f93d['name'],'sectionId':_0x55f93d['id']},{})[_0xe8d0('0x27')](function(){return _0x424764;});}else{return _0x424764;}})[_0xe8d0('0x4f')](function(_0x13713c){logger[_0xe8d0('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13713c);throw _0x13713c;});}return _0x424764;})[_0xe8d0('0x27')](respondWithResult(_0x34047c,0xc9))[_0xe8d0('0x4f')](handleError(_0x34047c,null));};exports[_0xe8d0('0x25')]=function(_0x2e3f1d,_0x18cc14){if(_0x2e3f1d['body']['id']){delete _0x2e3f1d[_0xe8d0('0x54')]['id'];}return db[_0xe8d0('0x31')][_0xe8d0('0x4e')]({'where':{'id':_0x2e3f1d['params']['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x18cc14,null))['then'](saveUpdates(_0x2e3f1d['body'],null))[_0xe8d0('0x27')](respondWithResult(_0x18cc14,null))[_0xe8d0('0x4f')](handleError(_0x18cc14,null));};exports['destroy']=function(_0xcb6ce2,_0x3a8074){return db['AnalyticMetric'][_0xe8d0('0x4e')]({'where':{'id':_0xcb6ce2[_0xe8d0('0x4b')]['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x3a8074,null))[_0xe8d0('0x27')](removeEntity(_0x3a8074,null))['catch'](handleError(_0x3a8074,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d61e034..a2fecaa 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 _0x482d=['path','../../config/environment','./analyticMetric.attributes','exports','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1465ff,_0x329746){var _0x3495ff=function(_0x301873){while(--_0x301873){_0x1465ff['push'](_0x1465ff['shift']());}};_0x3495ff(++_0x329746);}(_0x482d,0x16c));var _0xd482=function(_0x53fd12,_0x30e2ae){_0x53fd12=_0x53fd12-0x0;var _0x45110a=_0x482d[_0x53fd12];return _0x45110a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd482('0x0'))(_0xd482('0x1'));var moment=require(_0xd482('0x2'));var BPromise=require(_0xd482('0x3'));var rp=require(_0xd482('0x4'));var fs=require('fs');var path=require(_0xd482('0x5'));var rimraf=require('rimraf');var config=require(_0xd482('0x6'));var attributes=require(_0xd482('0x7'));module[_0xd482('0x8')]=function(_0x57cd2c,_0x3b9989){return _0x57cd2c['define']('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2070=['../../config/environment','./analyticMetric.attributes','AnalyticMetric','analytics_metrics','../../config/logger','api','moment','request-promise','path'];(function(_0x1dbd0b,_0x26e998){var _0x5275fd=function(_0x54fb63){while(--_0x54fb63){_0x1dbd0b['push'](_0x1dbd0b['shift']());}};_0x5275fd(++_0x26e998);}(_0x2070,0x1a2));var _0x0207=function(_0x276268,_0x5c4299){_0x276268=_0x276268-0x0;var _0x1c3016=_0x2070[_0x276268];return _0x1c3016;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0207('0x0'))(_0x0207('0x1'));var moment=require(_0x0207('0x2'));var BPromise=require('bluebird');var rp=require(_0x0207('0x3'));var fs=require('fs');var path=require(_0x0207('0x4'));var rimraf=require('rimraf');var config=require(_0x0207('0x5'));var attributes=require(_0x0207('0x6'));module['exports']=function(_0x5573e8,_0x5cf734){return _0x5573e8['define'](_0x0207('0x7'),attributes,{'tableName':_0x0207('0x8'),'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 6568883..c2998d1 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 _0xe33b=['request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x153aae,_0x28cf2c){var _0xb918f7=function(_0x26d167){while(--_0x26d167){_0x153aae['push'](_0x153aae['shift']());}};_0xb918f7(++_0x28cf2c);}(_0xe33b,0x197));var _0xbe33=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xe33b[_0x21549c];return _0x426cbd;};'use strict';var _=require('lodash');var util=require(_0xbe33('0x0'));var moment=require(_0xbe33('0x1'));var BPromise=require(_0xbe33('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbe33('0x3'))['db'];var utils=require(_0xbe33('0x4'));var logger=require(_0xbe33('0x5'))(_0xbe33('0x6'));var config=require(_0xbe33('0x7'));var jayson=require(_0xbe33('0x8'));var client=jayson[_0xbe33('0x9')][_0xbe33('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeae4d9,_0x3f90f4,_0x313df3){return new BPromise(function(_0x4410ea,_0x2da4b8){return client[_0xbe33('0xb')](_0xeae4d9,_0x313df3)['then'](function(_0x4dbfb6){logger[_0xbe33('0xc')](_0xbe33('0xd'),_0x3f90f4,_0xbe33('0xe'));logger[_0xbe33('0xf')](_0xbe33('0x10'),_0x3f90f4,_0xbe33('0xe'),JSON['stringify'](_0x4dbfb6));if(_0x4dbfb6[_0xbe33('0x11')]){if(_0x4dbfb6[_0xbe33('0x11')][_0xbe33('0x12')]===0x1f4){logger[_0xbe33('0x11')](_0xbe33('0xd'),_0x3f90f4,_0x4dbfb6[_0xbe33('0x11')][_0xbe33('0x13')]);return _0x2da4b8(_0x4dbfb6['error'][_0xbe33('0x13')]);}logger['error'](_0xbe33('0xd'),_0x3f90f4,_0x4dbfb6[_0xbe33('0x11')][_0xbe33('0x13')]);return _0x4410ea(_0x4dbfb6[_0xbe33('0x11')]['message']);}else{logger[_0xbe33('0xc')](_0xbe33('0xd'),_0x3f90f4,_0xbe33('0xe'));_0x4410ea(_0x4dbfb6[_0xbe33('0x14')][_0xbe33('0x13')]);}})[_0xbe33('0x15')](function(_0x5ef7fa){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3f90f4,_0x5ef7fa);_0x2da4b8(_0x5ef7fa);});});} \ No newline at end of file +var _0xe03e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x105e3a,_0x985c68){var _0x5aa427=function(_0x53f22f){while(--_0x53f22f){_0x105e3a['push'](_0x105e3a['shift']());}};_0x5aa427(++_0x985c68);}(_0xe03e,0xfa));var _0xee03=function(_0xed51c3,_0x270c47){_0xed51c3=_0xed51c3-0x0;var _0x3983f8=_0xe03e[_0xed51c3];return _0x3983f8;};'use strict';var _=require(_0xee03('0x0'));var util=require(_0xee03('0x1'));var moment=require(_0xee03('0x2'));var BPromise=require(_0xee03('0x3'));var rs=require(_0xee03('0x4'));var fs=require('fs');var Redis=require(_0xee03('0x5'));var db=require(_0xee03('0x6'))['db'];var utils=require(_0xee03('0x7'));var logger=require(_0xee03('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xee03('0x9'));var client=jayson[_0xee03('0xa')][_0xee03('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x367520,_0x4ac949,_0x2ac0d5){return new BPromise(function(_0x30b237,_0x25f48f){return client[_0xee03('0xc')](_0x367520,_0x2ac0d5)[_0xee03('0xd')](function(_0x57bba6){logger[_0xee03('0xe')](_0xee03('0xf'),_0x4ac949,_0xee03('0x10'));logger[_0xee03('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x4ac949,_0xee03('0x10'),JSON[_0xee03('0x12')](_0x57bba6));if(_0x57bba6['error']){if(_0x57bba6[_0xee03('0x13')][_0xee03('0x14')]===0x1f4){logger[_0xee03('0x13')](_0xee03('0xf'),_0x4ac949,_0x57bba6[_0xee03('0x13')][_0xee03('0x15')]);return _0x25f48f(_0x57bba6[_0xee03('0x13')]['message']);}logger[_0xee03('0x13')](_0xee03('0xf'),_0x4ac949,_0x57bba6[_0xee03('0x13')][_0xee03('0x15')]);return _0x30b237(_0x57bba6[_0xee03('0x13')][_0xee03('0x15')]);}else{logger[_0xee03('0xe')](_0xee03('0xf'),_0x4ac949,_0xee03('0x10'));_0x30b237(_0x57bba6['result'][_0xee03('0x15')]);}})[_0xee03('0x16')](function(_0xebb25){logger[_0xee03('0x13')](_0xee03('0xf'),_0x4ac949,_0xebb25);_0x25f48f(_0xebb25);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index d7ac84f..14c1146 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 _0xf767=['put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','/:id','post','create'];(function(_0x376477,_0x54d800){var _0x154a11=function(_0x5e080c){while(--_0x5e080c){_0x376477['push'](_0x376477['shift']());}};_0x154a11(++_0x54d800);}(_0xf767,0x76));var _0x7f76=function(_0x460150,_0x232949){_0x460150=_0x460150-0x0;var _0x340677=_0xf767[_0x460150];return _0x340677;};'use strict';var multer=require('multer');var util=require(_0x7f76('0x0'));var path=require(_0x7f76('0x1'));var timeout=require(_0x7f76('0x2'));var express=require(_0x7f76('0x3'));var router=express[_0x7f76('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7f76('0x5'));var interaction=require(_0x7f76('0x6'));var config=require(_0x7f76('0x7'));var controller=require(_0x7f76('0x8'));router['get']('/',auth[_0x7f76('0x9')](),controller[_0x7f76('0xa')]);router[_0x7f76('0xb')](_0x7f76('0xc'),auth[_0x7f76('0x9')](),controller['show']);router[_0x7f76('0xd')]('/',auth[_0x7f76('0x9')](),controller[_0x7f76('0xe')]);router[_0x7f76('0xf')]('/:id',auth[_0x7f76('0x9')](),controller['update']);router[_0x7f76('0x10')](_0x7f76('0xc'),auth[_0x7f76('0x9')](),controller[_0x7f76('0x11')]);module[_0x7f76('0x12')]=router; \ No newline at end of file +var _0xc03e=['update','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0xfd274c,_0x5538c0){var _0x2ce4ed=function(_0x2b2f9a){while(--_0x2b2f9a){_0xfd274c['push'](_0xfd274c['shift']());}};_0x2ce4ed(++_0x5538c0);}(_0xc03e,0x15a));var _0xec03=function(_0x48e86c,_0x9f034d){_0x48e86c=_0x48e86c-0x0;var _0x54fa11=_0xc03e[_0x48e86c];return _0x54fa11;};'use strict';var multer=require(_0xec03('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xec03('0x1'));var express=require('express');var router=express[_0xec03('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xec03('0x3'));var interaction=require(_0xec03('0x4'));var config=require(_0xec03('0x5'));var controller=require(_0xec03('0x6'));router[_0xec03('0x7')]('/',auth[_0xec03('0x8')](),controller[_0xec03('0x9')]);router[_0xec03('0x7')](_0xec03('0xa'),auth['isAuthenticated'](),controller[_0xec03('0xb')]);router[_0xec03('0xc')]('/',auth[_0xec03('0x8')](),controller[_0xec03('0xd')]);router['put'](_0xec03('0xa'),auth[_0xec03('0x8')](),controller[_0xec03('0xe')]);router[_0xec03('0xf')](_0xec03('0xa'),auth[_0xec03('0x8')](),controller[_0xec03('0x10')]);module[_0xec03('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 5ab83ab..9e64afb 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 _0x080a=['exports','TEXT','sequelize'];(function(_0x30aa73,_0x14fc5a){var _0x5b8779=function(_0x1d5196){while(--_0x1d5196){_0x30aa73['push'](_0x30aa73['shift']());}};_0x5b8779(++_0x14fc5a);}(_0x080a,0x146));var _0xa080=function(_0x5cbc7f,_0x58830f){_0x5cbc7f=_0x5cbc7f-0x0;var _0x5a5c3c=_0x080a[_0x5cbc7f];return _0x5a5c3c;};'use strict';var Sequelize=require(_0xa080('0x0'));module[_0xa080('0x1')]={'tree':{'type':Sequelize[_0xa080('0x2')],'allowNull':![]}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 7884d66..29adc00 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 _0xbaca=['undefined','limit','count','offset','apply','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','rows','show','params','intersection','include','merge','find','catch','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x1afb2a,_0x1b9ca6){var _0x4c6998=function(_0x421aab){while(--_0x421aab){_0x1afb2a['push'](_0x1afb2a['shift']());}};_0x4c6998(++_0x1b9ca6);}(_0xbaca,0x15f));var _0xabac=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0xbaca[_0x118139];return _0x2fece9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xabac('0x0'));var zipdir=require(_0xabac('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabac('0x2'));var moment=require(_0xabac('0x3'));var BPromise=require(_0xabac('0x4'));var Mustache=require(_0xabac('0x5'));var util=require(_0xabac('0x6'));var path=require(_0xabac('0x7'));var sox=require(_0xabac('0x8'));var csv=require(_0xabac('0x9'));var ejs=require(_0xabac('0xa'));var fs=require('fs');var fs_extra=require(_0xabac('0xb'));var _=require(_0xabac('0xc'));var squel=require(_0xabac('0xd'));var crypto=require(_0xabac('0xe'));var jsforce=require(_0xabac('0xf'));var deskjs=require(_0xabac('0x10'));var toCsv=require('to-csv');var querystring=require(_0xabac('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xabac('0x12'));var as=require(_0xabac('0x13'));var hardwareService=require(_0xabac('0x14'));var logger=require(_0xabac('0x15'))(_0xabac('0x16'));var utils=require('../../config/utils');var config=require(_0xabac('0x17'));var licenseUtil=require(_0xabac('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11623f,_0xa71844){_0xa71844=_0xa71844||0xcc;return function(_0x2140b1){if(_0x2140b1){return _0x11623f[_0xabac('0x19')](_0xa71844);}return _0x11623f[_0xabac('0x1a')](_0xa71844)[_0xabac('0x1b')]();};}function respondWithResult(_0x336877,_0x5ecb4f){_0x5ecb4f=_0x5ecb4f||0xc8;return function(_0x384c7d){if(_0x384c7d){return _0x336877[_0xabac('0x1a')](_0x5ecb4f)[_0xabac('0x1c')](_0x384c7d);}};}function respondWithFilteredResult(_0x4bed44,_0x399673){return function(_0x4ff6e1){if(_0x4ff6e1){var _0x576b98=typeof _0x399673['offset']===_0xabac('0x1d')&&typeof _0x399673[_0xabac('0x1e')]===_0xabac('0x1d');var _0x3aac2b=_0x4ff6e1['count'];var _0x235525=_0x576b98?0x0:_0x399673['offset'];var _0x2b6974=_0x576b98?_0x4ff6e1[_0xabac('0x1f')]:_0x399673[_0xabac('0x20')]+_0x399673['limit'];var _0x4bbdcd;if(_0x2b6974>=_0x3aac2b){_0x2b6974=_0x3aac2b;_0x4bbdcd=0xc8;}else{_0x4bbdcd=0xce;}_0x4bed44[_0xabac('0x1a')](_0x4bbdcd);return _0x4bed44['set']('Content-Range',_0x235525+'-'+_0x2b6974+'/'+_0x3aac2b)['json'](_0x4ff6e1);}return null;};}function patchUpdates(_0xdaf8f8){return function(_0x1a5779){try{jsonpatch[_0xabac('0x21')](_0x1a5779,_0xdaf8f8,!![]);}catch(_0x563711){return BPromise['reject'](_0x563711);}return _0x1a5779[_0xabac('0x22')]();};}function saveUpdates(_0x5e586b,_0x65acfb){return function(_0x3fc603){if(_0x3fc603){return _0x3fc603[_0xabac('0x23')](_0x5e586b)[_0xabac('0x24')](function(_0x2939a2){return _0x2939a2;});}return null;};}function removeEntity(_0xfd0b89,_0x58961c){return function(_0x4d644b){if(_0x4d644b){return _0x4d644b[_0xabac('0x25')]()[_0xabac('0x24')](function(){_0xfd0b89[_0xabac('0x1a')](0xcc)[_0xabac('0x1b')]();});}};}function handleEntityNotFound(_0x36d3b1,_0xe8f074){return function(_0x5f530b){if(!_0x5f530b){_0x36d3b1[_0xabac('0x19')](0x194);}return _0x5f530b;};}function handleError(_0x46f444,_0x1ec5df){_0x1ec5df=_0x1ec5df||0x1f4;return function(_0x5409cd){logger[_0xabac('0x26')](_0x5409cd[_0xabac('0x27')]);if(_0x5409cd['name']){delete _0x5409cd[_0xabac('0x28')];}_0x46f444[_0xabac('0x1a')](_0x1ec5df)[_0xabac('0x29')](_0x5409cd);};}exports[_0xabac('0x2a')]=function(_0x362d64,_0x492e38){var _0x375987={},_0x340965={},_0x519497={'count':0x0,'rows':[]};var _0x44279c=_[_0xabac('0x2b')](db[_0xabac('0x2c')][_0xabac('0x2d')],function(_0x5acdb1){return{'name':_0x5acdb1[_0xabac('0x2e')],'type':_0x5acdb1[_0xabac('0x2f')][_0xabac('0x30')]};});_0x340965[_0xabac('0x31')]=_[_0xabac('0x2b')](_0x44279c,_0xabac('0x28'));_0x340965[_0xabac('0x32')]=_[_0xabac('0x33')](_0x362d64[_0xabac('0x32')]);_0x340965['filters']=_['intersection'](_0x340965[_0xabac('0x31')],_0x340965[_0xabac('0x32')]);_0x375987[_0xabac('0x34')]=_['intersection'](_0x340965[_0xabac('0x31')],qs[_0xabac('0x35')](_0x362d64[_0xabac('0x32')][_0xabac('0x35')]));_0x375987[_0xabac('0x34')]=_0x375987[_0xabac('0x34')][_0xabac('0x36')]?_0x375987[_0xabac('0x34')]:_0x340965['model'];if(!_0x362d64[_0xabac('0x32')][_0xabac('0x37')](_0xabac('0x38'))){_0x375987[_0xabac('0x1e')]=qs[_0xabac('0x1e')](_0x362d64[_0xabac('0x32')]['limit']);_0x375987['offset']=qs[_0xabac('0x20')](_0x362d64[_0xabac('0x32')][_0xabac('0x20')]);}_0x375987[_0xabac('0x39')]=qs[_0xabac('0x3a')](_0x362d64[_0xabac('0x32')][_0xabac('0x3a')]);_0x375987[_0xabac('0x3b')]=qs['filters'](_[_0xabac('0x3c')](_0x362d64['query'],_0x340965[_0xabac('0x3d')]),_0x44279c);if(_0x362d64['query'][_0xabac('0x3e')]){_0x375987[_0xabac('0x3b')]=_['merge'](_0x375987[_0xabac('0x3b')],{'$or':_[_0xabac('0x2b')](_0x44279c,function(_0x50cd94){if(_0x50cd94['type']!==_0xabac('0x3f')){var _0x2604d9={};_0x2604d9[_0x50cd94[_0xabac('0x28')]]={'$like':'%'+_0x362d64[_0xabac('0x32')][_0xabac('0x3e')]+'%'};return _0x2604d9;}})});}_0x375987=_['merge']({},_0x375987,_0x362d64[_0xabac('0x40')]);var _0x18bdca={'where':_0x375987[_0xabac('0x3b')]};return db['AnalyticTreeReport'][_0xabac('0x1f')](_0x18bdca)[_0xabac('0x24')](function(_0x58b3a2){_0x519497[_0xabac('0x1f')]=_0x58b3a2;if(_0x362d64['query'][_0xabac('0x41')]){_0x375987['include']=[{'all':!![]}];}return db[_0xabac('0x2c')]['findAll'](_0x375987);})['then'](function(_0x16cb69){_0x519497[_0xabac('0x42')]=_0x16cb69;return _0x519497;})[_0xabac('0x24')](respondWithFilteredResult(_0x492e38,_0x375987))['catch'](handleError(_0x492e38,null));};exports[_0xabac('0x43')]=function(_0x78bf5e,_0x495e52){var _0x32c950={'raw':!![],'where':{'id':_0x78bf5e[_0xabac('0x44')]['id']}},_0x3a9aa8={};_0x3a9aa8[_0xabac('0x31')]=_['keys'](db[_0xabac('0x2c')][_0xabac('0x2d')]);_0x3a9aa8['query']=_[_0xabac('0x33')](_0x78bf5e[_0xabac('0x32')]);_0x3a9aa8[_0xabac('0x3d')]=_[_0xabac('0x45')](_0x3a9aa8[_0xabac('0x31')],_0x3a9aa8[_0xabac('0x32')]);_0x32c950[_0xabac('0x34')]=_[_0xabac('0x45')](_0x3a9aa8[_0xabac('0x31')],qs[_0xabac('0x35')](_0x78bf5e[_0xabac('0x32')][_0xabac('0x35')]));_0x32c950[_0xabac('0x34')]=_0x32c950[_0xabac('0x34')][_0xabac('0x36')]?_0x32c950[_0xabac('0x34')]:_0x3a9aa8[_0xabac('0x31')];if(_0x78bf5e[_0xabac('0x32')][_0xabac('0x41')]){_0x32c950[_0xabac('0x46')]=[{'all':!![]}];}_0x32c950=_[_0xabac('0x47')]({},_0x32c950,_0x78bf5e[_0xabac('0x40')]);return db['AnalyticTreeReport'][_0xabac('0x48')](_0x32c950)['then'](handleEntityNotFound(_0x495e52,null))[_0xabac('0x24')](respondWithResult(_0x495e52,null))[_0xabac('0x49')](handleError(_0x495e52,null));};exports[_0xabac('0x4a')]=function(_0x31ab14,_0x31a0f0){return db[_0xabac('0x2c')]['create'](_0x31ab14[_0xabac('0x4b')],{})[_0xabac('0x24')](respondWithResult(_0x31a0f0,0xc9))[_0xabac('0x49')](handleError(_0x31a0f0,null));};exports['update']=function(_0x57b9d8,_0x5422a7){if(_0x57b9d8[_0xabac('0x4b')]['id']){delete _0x57b9d8['body']['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x57b9d8[_0xabac('0x44')]['id']}})['then'](handleEntityNotFound(_0x5422a7,null))['then'](saveUpdates(_0x57b9d8[_0xabac('0x4b')],null))[_0xabac('0x24')](respondWithResult(_0x5422a7,null))['catch'](handleError(_0x5422a7,null));};exports[_0xabac('0x25')]=function(_0x37550c,_0x11b8a6){return db['AnalyticTreeReport']['find']({'where':{'id':_0x37550c[_0xabac('0x44')]['id']}})[_0xabac('0x24')](handleEntityNotFound(_0x11b8a6,null))[_0xabac('0x24')](removeEntity(_0x11b8a6,null))[_0xabac('0x49')](handleError(_0x11b8a6,null));}; \ No newline at end of file +var _0xd55e=['request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','end','error','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','keys','find','catch','create','body','rimraf','zip-dir','fast-json-patch'];(function(_0x15e2c3,_0x1890d7){var _0x3612ee=function(_0x54acee){while(--_0x54acee){_0x15e2c3['push'](_0x15e2c3['shift']());}};_0x3612ee(++_0x1890d7);}(_0xd55e,0x1b3));var _0xed55=function(_0x511642,_0xe43d39){_0x511642=_0x511642-0x0;var _0x57e3f2=_0xd55e[_0x511642];return _0x57e3f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed55('0x0'));var zipdir=require(_0xed55('0x1'));var jsonpatch=require(_0xed55('0x2'));var rp=require(_0xed55('0x3'));var moment=require('moment');var BPromise=require(_0xed55('0x4'));var Mustache=require('mustache');var util=require(_0xed55('0x5'));var path=require(_0xed55('0x6'));var sox=require(_0xed55('0x7'));var csv=require(_0xed55('0x8'));var ejs=require(_0xed55('0x9'));var fs=require('fs');var fs_extra=require(_0xed55('0xa'));var _=require(_0xed55('0xb'));var squel=require('squel');var crypto=require(_0xed55('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xed55('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xed55('0xe'));var authService=require(_0xed55('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xed55('0x10'));var hardwareService=require(_0xed55('0x11'));var logger=require(_0xed55('0x12'))(_0xed55('0x13'));var utils=require('../../config/utils');var config=require(_0xed55('0x14'));var licenseUtil=require(_0xed55('0x15'));var db=require(_0xed55('0x16'))['db'];function respondWithStatusCode(_0xae0487,_0x2f8cdc){_0x2f8cdc=_0x2f8cdc||0xcc;return function(_0x3d8c9e){if(_0x3d8c9e){return _0xae0487[_0xed55('0x17')](_0x2f8cdc);}return _0xae0487[_0xed55('0x18')](_0x2f8cdc)['end']();};}function respondWithResult(_0x272f72,_0x25a332){_0x25a332=_0x25a332||0xc8;return function(_0x33713f){if(_0x33713f){return _0x272f72[_0xed55('0x18')](_0x25a332)['json'](_0x33713f);}};}function respondWithFilteredResult(_0x44b514,_0x757c41){return function(_0xed72cc){if(_0xed72cc){var _0x3d9a6a=typeof _0x757c41[_0xed55('0x19')]===_0xed55('0x1a')&&typeof _0x757c41[_0xed55('0x1b')]===_0xed55('0x1a');var _0x4f4aa1=_0xed72cc[_0xed55('0x1c')];var _0xc6852f=_0x3d9a6a?0x0:_0x757c41[_0xed55('0x19')];var _0x364dcd=_0x3d9a6a?_0xed72cc[_0xed55('0x1c')]:_0x757c41[_0xed55('0x19')]+_0x757c41[_0xed55('0x1b')];var _0xf1c350;if(_0x364dcd>=_0x4f4aa1){_0x364dcd=_0x4f4aa1;_0xf1c350=0xc8;}else{_0xf1c350=0xce;}_0x44b514[_0xed55('0x18')](_0xf1c350);return _0x44b514[_0xed55('0x1d')](_0xed55('0x1e'),_0xc6852f+'-'+_0x364dcd+'/'+_0x4f4aa1)[_0xed55('0x1f')](_0xed72cc);}return null;};}function patchUpdates(_0x4889e1){return function(_0x1d1b0f){try{jsonpatch[_0xed55('0x20')](_0x1d1b0f,_0x4889e1,!![]);}catch(_0x51cdaf){return BPromise[_0xed55('0x21')](_0x51cdaf);}return _0x1d1b0f[_0xed55('0x22')]();};}function saveUpdates(_0x235655,_0x34692b){return function(_0x41ec9e){if(_0x41ec9e){return _0x41ec9e['update'](_0x235655)[_0xed55('0x23')](function(_0xf6a715){return _0xf6a715;});}return null;};}function removeEntity(_0x116b78,_0x49e06f){return function(_0x502872){if(_0x502872){return _0x502872[_0xed55('0x24')]()['then'](function(){_0x116b78[_0xed55('0x18')](0xcc)[_0xed55('0x25')]();});}};}function handleEntityNotFound(_0x22d150,_0x9442cf){return function(_0x136875){if(!_0x136875){_0x22d150[_0xed55('0x17')](0x194);}return _0x136875;};}function handleError(_0x5bd3ef,_0x952d7d){_0x952d7d=_0x952d7d||0x1f4;return function(_0x2a4d78){logger[_0xed55('0x26')](_0x2a4d78['stack']);if(_0x2a4d78[_0xed55('0x27')]){delete _0x2a4d78['name'];}_0x5bd3ef[_0xed55('0x18')](_0x952d7d)['send'](_0x2a4d78);};}exports[_0xed55('0x28')]=function(_0x112a30,_0x414f27){var _0x498ee4={},_0x36ad7b={},_0x25ff8d={'count':0x0,'rows':[]};var _0x165a80=_[_0xed55('0x29')](db[_0xed55('0x2a')][_0xed55('0x2b')],function(_0x453c5c){return{'name':_0x453c5c[_0xed55('0x2c')],'type':_0x453c5c[_0xed55('0x2d')][_0xed55('0x2e')]};});_0x36ad7b[_0xed55('0x2f')]=_[_0xed55('0x29')](_0x165a80,_0xed55('0x27'));_0x36ad7b['query']=_['keys'](_0x112a30[_0xed55('0x30')]);_0x36ad7b[_0xed55('0x31')]=_[_0xed55('0x32')](_0x36ad7b[_0xed55('0x2f')],_0x36ad7b[_0xed55('0x30')]);_0x498ee4[_0xed55('0x33')]=_[_0xed55('0x32')](_0x36ad7b['model'],qs[_0xed55('0x34')](_0x112a30[_0xed55('0x30')]['fields']));_0x498ee4[_0xed55('0x33')]=_0x498ee4[_0xed55('0x33')][_0xed55('0x35')]?_0x498ee4[_0xed55('0x33')]:_0x36ad7b[_0xed55('0x2f')];if(!_0x112a30[_0xed55('0x30')][_0xed55('0x36')](_0xed55('0x37'))){_0x498ee4['limit']=qs[_0xed55('0x1b')](_0x112a30[_0xed55('0x30')][_0xed55('0x1b')]);_0x498ee4['offset']=qs[_0xed55('0x19')](_0x112a30[_0xed55('0x30')][_0xed55('0x19')]);}_0x498ee4[_0xed55('0x38')]=qs[_0xed55('0x39')](_0x112a30[_0xed55('0x30')][_0xed55('0x39')]);_0x498ee4[_0xed55('0x3a')]=qs[_0xed55('0x31')](_[_0xed55('0x3b')](_0x112a30[_0xed55('0x30')],_0x36ad7b[_0xed55('0x31')]),_0x165a80);if(_0x112a30[_0xed55('0x30')][_0xed55('0x3c')]){_0x498ee4[_0xed55('0x3a')]=_[_0xed55('0x3d')](_0x498ee4['where'],{'$or':_[_0xed55('0x29')](_0x165a80,function(_0x11d7fc){if(_0x11d7fc[_0xed55('0x2d')]!==_0xed55('0x3e')){var _0x42c1cc={};_0x42c1cc[_0x11d7fc[_0xed55('0x27')]]={'$like':'%'+_0x112a30[_0xed55('0x30')][_0xed55('0x3c')]+'%'};return _0x42c1cc;}})});}_0x498ee4=_[_0xed55('0x3d')]({},_0x498ee4,_0x112a30[_0xed55('0x3f')]);var _0x2dee5e={'where':_0x498ee4[_0xed55('0x3a')]};return db[_0xed55('0x2a')][_0xed55('0x1c')](_0x2dee5e)[_0xed55('0x23')](function(_0x4cc7e2){_0x25ff8d[_0xed55('0x1c')]=_0x4cc7e2;if(_0x112a30[_0xed55('0x30')][_0xed55('0x40')]){_0x498ee4[_0xed55('0x41')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xed55('0x42')](_0x498ee4);})[_0xed55('0x23')](function(_0x3134ec){_0x25ff8d['rows']=_0x3134ec;return _0x25ff8d;})[_0xed55('0x23')](respondWithFilteredResult(_0x414f27,_0x498ee4))['catch'](handleError(_0x414f27,null));};exports['show']=function(_0x1d2ee7,_0x3153a9){var _0x12d0d8={'raw':!![],'where':{'id':_0x1d2ee7[_0xed55('0x43')]['id']}},_0xe971a8={};_0xe971a8['model']=_[_0xed55('0x44')](db[_0xed55('0x2a')]['rawAttributes']);_0xe971a8[_0xed55('0x30')]=_[_0xed55('0x44')](_0x1d2ee7[_0xed55('0x30')]);_0xe971a8[_0xed55('0x31')]=_['intersection'](_0xe971a8[_0xed55('0x2f')],_0xe971a8[_0xed55('0x30')]);_0x12d0d8[_0xed55('0x33')]=_[_0xed55('0x32')](_0xe971a8['model'],qs[_0xed55('0x34')](_0x1d2ee7['query'][_0xed55('0x34')]));_0x12d0d8['attributes']=_0x12d0d8[_0xed55('0x33')][_0xed55('0x35')]?_0x12d0d8[_0xed55('0x33')]:_0xe971a8[_0xed55('0x2f')];if(_0x1d2ee7[_0xed55('0x30')][_0xed55('0x40')]){_0x12d0d8[_0xed55('0x41')]=[{'all':!![]}];}_0x12d0d8=_[_0xed55('0x3d')]({},_0x12d0d8,_0x1d2ee7[_0xed55('0x3f')]);return db['AnalyticTreeReport'][_0xed55('0x45')](_0x12d0d8)['then'](handleEntityNotFound(_0x3153a9,null))[_0xed55('0x23')](respondWithResult(_0x3153a9,null))[_0xed55('0x46')](handleError(_0x3153a9,null));};exports[_0xed55('0x47')]=function(_0x259933,_0x5e2354){return db[_0xed55('0x2a')][_0xed55('0x47')](_0x259933[_0xed55('0x48')],{})[_0xed55('0x23')](respondWithResult(_0x5e2354,0xc9))[_0xed55('0x46')](handleError(_0x5e2354,null));};exports['update']=function(_0x1bba51,_0x174226){if(_0x1bba51[_0xed55('0x48')]['id']){delete _0x1bba51[_0xed55('0x48')]['id'];}return db[_0xed55('0x2a')]['find']({'where':{'id':_0x1bba51[_0xed55('0x43')]['id']}})[_0xed55('0x23')](handleEntityNotFound(_0x174226,null))[_0xed55('0x23')](saveUpdates(_0x1bba51[_0xed55('0x48')],null))[_0xed55('0x23')](respondWithResult(_0x174226,null))[_0xed55('0x46')](handleError(_0x174226,null));};exports['destroy']=function(_0x3a5ae6,_0x4e7cfb){return db['AnalyticTreeReport'][_0xed55('0x45')]({'where':{'id':_0x3a5ae6[_0xed55('0x43')]['id']}})[_0xed55('0x23')](handleEntityNotFound(_0x4e7cfb,null))[_0xed55('0x23')](removeEntity(_0x4e7cfb,null))['catch'](handleError(_0x4e7cfb,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 8bf6068..ec2da78 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 _0x3cd8=['./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x277bcc,_0x2a6e64){var _0x1ff8be=function(_0x3e08f7){while(--_0x3e08f7){_0x277bcc['push'](_0x277bcc['shift']());}};_0x1ff8be(++_0x2a6e64);}(_0x3cd8,0x155));var _0x83cd=function(_0x1c2051,_0x4cb6b9){_0x1c2051=_0x1c2051-0x0;var _0x2b58a0=_0x3cd8[_0x1c2051];return _0x2b58a0;};'use strict';var _=require(_0x83cd('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x83cd('0x1'));var BPromise=require(_0x83cd('0x2'));var rp=require(_0x83cd('0x3'));var fs=require('fs');var path=require(_0x83cd('0x4'));var rimraf=require(_0x83cd('0x5'));var config=require(_0x83cd('0x6'));var attributes=require(_0x83cd('0x7'));module[_0x83cd('0x8')]=function(_0x11ca57,_0x2e30c6){return _0x11ca57[_0x83cd('0x9')](_0x83cd('0xa'),attributes,{'tableName':_0x83cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26ef=['moment','request-promise','path','rimraf','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash','util'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x26ef,0xf8));var _0xf26e=function(_0x24abf9,_0x5cbdd3){_0x24abf9=_0x24abf9-0x0;var _0x2da7ad=_0x26ef[_0x24abf9];return _0x2da7ad;};'use strict';var _=require(_0xf26e('0x0'));var util=require(_0xf26e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf26e('0x2'));var BPromise=require('bluebird');var rp=require(_0xf26e('0x3'));var fs=require('fs');var path=require(_0xf26e('0x4'));var rimraf=require(_0xf26e('0x5'));var config=require('../../config/environment');var attributes=require(_0xf26e('0x6'));module[_0xf26e('0x7')]=function(_0x317885,_0x5b43f5){return _0x317885[_0xf26e('0x8')](_0xf26e('0x9'),attributes,{'tableName':'analytics_report_trees','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 5aabd26..e9ab858 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(_0x26b229,_0x2febcc){var _0xdd3f32=function(_0x330b63){while(--_0x330b63){_0x26b229['push'](_0x26b229['shift']());}};_0xdd3f32(++_0x2febcc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4e36f2,_0xac97f0){_0x4e36f2=_0x4e36f2-0x0;var _0x53a43=_0x5f2f[_0x4e36f2];return _0x53a43;};'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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1aa13e,_0x12a40b){var _0x1144bd=function(_0x5f5cae){while(--_0x5f5cae){_0x1aa13e['push'](_0x1aa13e['shift']());}};_0x1144bd(++_0x12a40b);}(_0xadb5,0xad));var _0x5adb=function(_0x4d00b4,_0x40860d){_0x4d00b4=_0x4d00b4-0x0;var _0x4b1d73=_0xadb5[_0x4d00b4];return _0x4b1d73;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 44bac3a..7995b66 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 _0x50d6=['create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post'];(function(_0x3bf2d4,_0x3f0b4b){var _0x188403=function(_0x2b6fad){while(--_0x2b6fad){_0x3bf2d4['push'](_0x3bf2d4['shift']());}};_0x188403(++_0x3f0b4b);}(_0x50d6,0x83));var _0x650d=function(_0x55a41c,_0x2ced02){_0x55a41c=_0x55a41c-0x0;var _0x278b73=_0x50d6[_0x55a41c];return _0x278b73;};'use strict';var multer=require(_0x650d('0x0'));var util=require('util');var path=require(_0x650d('0x1'));var timeout=require(_0x650d('0x2'));var express=require(_0x650d('0x3'));var router=express[_0x650d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x650d('0x5'));var interaction=require(_0x650d('0x6'));var config=require(_0x650d('0x7'));var controller=require('./analyticTreeReport.controller');router[_0x650d('0x8')]('/',auth['isAuthenticated'](),controller[_0x650d('0x9')]);router[_0x650d('0x8')](_0x650d('0xa'),auth[_0x650d('0xb')](),controller['show']);router[_0x650d('0xc')]('/',auth[_0x650d('0xb')](),controller[_0x650d('0xd')]);router[_0x650d('0xe')]('/:id',auth[_0x650d('0xb')](),controller[_0x650d('0xf')]);router[_0x650d('0x10')](_0x650d('0xa'),auth[_0x650d('0xb')](),controller['destroy']);module[_0x650d('0x11')]=router; \ No newline at end of file +var _0xf128=['show','post','put','/:id','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0xf128,0x1bd));var _0x8f12=function(_0x1f22e0,_0x32e6a1){_0x1f22e0=_0x1f22e0-0x0;var _0x31d7ee=_0xf128[_0x1f22e0];return _0x31d7ee;};'use strict';var multer=require(_0x8f12('0x0'));var util=require(_0x8f12('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8f12('0x2'));var router=express[_0x8f12('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8f12('0x4'));var interaction=require(_0x8f12('0x5'));var config=require(_0x8f12('0x6'));var controller=require(_0x8f12('0x7'));router[_0x8f12('0x8')]('/',auth[_0x8f12('0x9')](),controller[_0x8f12('0xa')]);router[_0x8f12('0x8')]('/:id',auth[_0x8f12('0x9')](),controller[_0x8f12('0xb')]);router[_0x8f12('0xc')]('/',auth[_0x8f12('0x9')](),controller['create']);router[_0x8f12('0xd')](_0x8f12('0xe'),auth['isAuthenticated'](),controller[_0x8f12('0xf')]);router[_0x8f12('0x10')]('/:id',auth[_0x8f12('0x9')](),controller[_0x8f12('0x11')]);module[_0x8f12('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 47fa3a5..59dc0be 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 _0x765b=['STRING'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x765b,0x18c));var _0xb765=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0x765b[_0x9d1e6b];return _0x2b3070;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xb765('0x0')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe79a=['STRING'];(function(_0x1f703c,_0x5d6337){var _0xf8d79a=function(_0x544748){while(--_0x544748){_0x1f703c['push'](_0x1f703c['shift']());}};_0xf8d79a(++_0x5d6337);}(_0xe79a,0x70));var _0xae79=function(_0x139eb2,_0x3d7e18){_0x139eb2=_0x139eb2-0x0;var _0x2a5657=_0xe79a[_0x139eb2];return _0x2a5657;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xae79('0x0')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xae79('0x0')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index ab28ea8..9990da2 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 _0x3580=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','destroy','then','sendStatus','error','stack','name','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','filters','clone','options','find','get','omit','updatedAt','body','createdAt','create','originalname','basename','filename','file','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','zip-dir','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0x3580,0xef));var _0x0358=function(_0x1f8184,_0x59e343){_0x1f8184=_0x1f8184-0x0;var _0x3e19d8=_0x3580[_0x1f8184];return _0x3e19d8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0358('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0358('0x1'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0358('0x2'));var csv=require(_0x0358('0x3'));var ejs=require(_0x0358('0x4'));var fs=require('fs');var fs_extra=require(_0x0358('0x5'));var _=require(_0x0358('0x6'));var squel=require(_0x0358('0x7'));var crypto=require(_0x0358('0x8'));var jsforce=require(_0x0358('0x9'));var deskjs=require(_0x0358('0xa'));var toCsv=require(_0x0358('0x3'));var querystring=require('querystring');var Papa=require(_0x0358('0xb'));var Redis=require(_0x0358('0xc'));var authService=require(_0x0358('0xd'));var qs=require(_0x0358('0xe'));var as=require(_0x0358('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0358('0x10'))(_0x0358('0x11'));var utils=require(_0x0358('0x12'));var config=require(_0x0358('0x13'));var licenseUtil=require(_0x0358('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1705b6,_0x667b4e){_0x667b4e=_0x667b4e||0xcc;return function(_0x24b0eb){if(_0x24b0eb){return _0x1705b6['sendStatus'](_0x667b4e);}return _0x1705b6[_0x0358('0x15')](_0x667b4e)[_0x0358('0x16')]();};}function respondWithResult(_0x50100a,_0x5556d9){_0x5556d9=_0x5556d9||0xc8;return function(_0x19bbb4){if(_0x19bbb4){return _0x50100a[_0x0358('0x15')](_0x5556d9)['json'](_0x19bbb4);}};}function respondWithFilteredResult(_0x17d090,_0x4ca68f){return function(_0x4cc467){if(_0x4cc467){var _0x33ddd6=typeof _0x4ca68f[_0x0358('0x17')]===_0x0358('0x18')&&typeof _0x4ca68f[_0x0358('0x19')]==='undefined';var _0x459011=_0x4cc467['count'];var _0x12a420=_0x33ddd6?0x0:_0x4ca68f[_0x0358('0x17')];var _0x379e64=_0x33ddd6?_0x4cc467[_0x0358('0x1a')]:_0x4ca68f['offset']+_0x4ca68f[_0x0358('0x19')];var _0x34cf08;if(_0x379e64>=_0x459011){_0x379e64=_0x459011;_0x34cf08=0xc8;}else{_0x34cf08=0xce;}_0x17d090[_0x0358('0x15')](_0x34cf08);return _0x17d090['set'](_0x0358('0x1b'),_0x12a420+'-'+_0x379e64+'/'+_0x459011)[_0x0358('0x1c')](_0x4cc467);}return null;};}function patchUpdates(_0x192237){return function(_0x5a1004){try{jsonpatch[_0x0358('0x1d')](_0x5a1004,_0x192237,!![]);}catch(_0x463be7){return BPromise['reject'](_0x463be7);}return _0x5a1004[_0x0358('0x1e')]();};}function saveUpdates(_0x56a4c9,_0x50855e){return function(_0x272efc){if(_0x272efc){return _0x272efc[_0x0358('0x1f')](_0x56a4c9)['then'](function(_0x2d4b5f){return _0x2d4b5f;});}return null;};}function removeEntity(_0x58d6d0,_0x164e40){return function(_0x294cfb){if(_0x294cfb){return _0x294cfb[_0x0358('0x20')]()[_0x0358('0x21')](function(){_0x58d6d0[_0x0358('0x15')](0xcc)[_0x0358('0x16')]();});}};}function handleEntityNotFound(_0x122c37,_0x50f34c){return function(_0x58b5e3){if(!_0x58b5e3){_0x122c37[_0x0358('0x22')](0x194);}return _0x58b5e3;};}function handleError(_0x1a40c3,_0x516450){_0x516450=_0x516450||0x1f4;return function(_0x555f7b){logger[_0x0358('0x23')](_0x555f7b[_0x0358('0x24')]);if(_0x555f7b[_0x0358('0x25')]){delete _0x555f7b[_0x0358('0x25')];}_0x1a40c3[_0x0358('0x15')](_0x516450)['send'](_0x555f7b);};}exports['index']=function(_0x315ada,_0x5ab292){var _0x59877b={},_0x176aa0={},_0x25cecd={'count':0x0,'rows':[]};var _0x3c1933=_[_0x0358('0x26')](db[_0x0358('0x27')][_0x0358('0x28')],function(_0x3ed2e1){return{'name':_0x3ed2e1[_0x0358('0x29')],'type':_0x3ed2e1[_0x0358('0x2a')][_0x0358('0x2b')]};});_0x176aa0[_0x0358('0x2c')]=_[_0x0358('0x26')](_0x3c1933,_0x0358('0x25'));_0x176aa0[_0x0358('0x2d')]=_[_0x0358('0x2e')](_0x315ada[_0x0358('0x2d')]);_0x176aa0['filters']=_[_0x0358('0x2f')](_0x176aa0[_0x0358('0x2c')],_0x176aa0[_0x0358('0x2d')]);_0x59877b[_0x0358('0x30')]=_[_0x0358('0x2f')](_0x176aa0['model'],qs[_0x0358('0x31')](_0x315ada[_0x0358('0x2d')][_0x0358('0x31')]));_0x59877b[_0x0358('0x30')]=_0x59877b[_0x0358('0x30')][_0x0358('0x32')]?_0x59877b[_0x0358('0x30')]:_0x176aa0[_0x0358('0x2c')];if(!_0x315ada[_0x0358('0x2d')][_0x0358('0x33')]('nolimit')){_0x59877b[_0x0358('0x19')]=qs['limit'](_0x315ada[_0x0358('0x2d')][_0x0358('0x19')]);_0x59877b[_0x0358('0x17')]=qs[_0x0358('0x17')](_0x315ada[_0x0358('0x2d')][_0x0358('0x17')]);}_0x59877b[_0x0358('0x34')]=qs['sort'](_0x315ada[_0x0358('0x2d')][_0x0358('0x35')]);_0x59877b[_0x0358('0x36')]=qs['filters'](_[_0x0358('0x37')](_0x315ada['query'],_0x176aa0['filters']),_0x3c1933);if(_0x315ada['query'][_0x0358('0x38')]){_0x59877b[_0x0358('0x36')]=_['merge'](_0x59877b[_0x0358('0x36')],{'$or':_[_0x0358('0x26')](_0x3c1933,function(_0x36dd79){if(_0x36dd79[_0x0358('0x2a')]!==_0x0358('0x39')){var _0x5e4e51={};_0x5e4e51[_0x36dd79['name']]={'$like':'%'+_0x315ada[_0x0358('0x2d')][_0x0358('0x38')]+'%'};return _0x5e4e51;}})});}_0x59877b=_[_0x0358('0x3a')]({},_0x59877b,_0x315ada['options']);var _0x2a9563={'where':_0x59877b[_0x0358('0x36')]};return db[_0x0358('0x27')][_0x0358('0x1a')](_0x2a9563)[_0x0358('0x21')](function(_0x4186d7){_0x25cecd['count']=_0x4186d7;if(_0x315ada[_0x0358('0x2d')][_0x0358('0x3b')]){_0x59877b[_0x0358('0x3c')]=[{'all':!![]}];}return db[_0x0358('0x27')][_0x0358('0x3d')](_0x59877b);})[_0x0358('0x21')](function(_0x2dad6e){_0x25cecd['rows']=_0x2dad6e;return _0x25cecd;})['then'](respondWithFilteredResult(_0x5ab292,_0x59877b))[_0x0358('0x3e')](handleError(_0x5ab292,null));};exports[_0x0358('0x3f')]=function(_0x35a60b,_0x3e4978){var _0x473d9a={'raw':!![],'where':{'id':_0x35a60b[_0x0358('0x40')]['id']}},_0x286511={};_0x286511['model']=_['keys'](db[_0x0358('0x27')]['rawAttributes']);_0x286511['query']=_[_0x0358('0x2e')](_0x35a60b[_0x0358('0x2d')]);_0x286511[_0x0358('0x41')]=_['intersection'](_0x286511['model'],_0x286511[_0x0358('0x2d')]);_0x473d9a[_0x0358('0x30')]=_[_0x0358('0x2f')](_0x286511[_0x0358('0x2c')],qs['fields'](_0x35a60b[_0x0358('0x2d')][_0x0358('0x31')]));_0x473d9a[_0x0358('0x30')]=_0x473d9a[_0x0358('0x30')]['length']?_0x473d9a[_0x0358('0x30')]:_0x286511[_0x0358('0x2c')];if(_0x35a60b[_0x0358('0x2d')][_0x0358('0x3b')]){_0x473d9a[_0x0358('0x3c')]=[{'all':!![]}];}_0x473d9a=_[_0x0358('0x3a')]({},_0x473d9a,_0x35a60b['options']);return db[_0x0358('0x27')]['find'](_0x473d9a)[_0x0358('0x21')](handleEntityNotFound(_0x3e4978,null))['then'](respondWithResult(_0x3e4978,null))[_0x0358('0x3e')](handleError(_0x3e4978,null));};exports[_0x0358('0x42')]=function(_0x323809,_0x5d2adb){var _0x4d98a4={'where':{'id':_0x323809['params']['id']}},_0x3a4db6={};_0x3a4db6[_0x0358('0x2c')]=_['keys'](db['Attachment']['rawAttributes']);_0x4d98a4['attributes']=_[_0x0358('0x2f')](_0x3a4db6[_0x0358('0x2c')],qs[_0x0358('0x31')](_0x323809[_0x0358('0x2d')]['fields']));_0x4d98a4['attributes']=_0x4d98a4[_0x0358('0x30')][_0x0358('0x32')]?_0x4d98a4[_0x0358('0x30')]:_0x3a4db6['model'];if(_0x323809[_0x0358('0x2d')][_0x0358('0x3b')]){_0x4d98a4[_0x0358('0x3c')]=[{'all':!![]}];}_0x4d98a4=_[_0x0358('0x3a')]({},_0x4d98a4,_0x323809[_0x0358('0x43')]);return db[_0x0358('0x27')][_0x0358('0x44')](_0x4d98a4)['then'](handleEntityNotFound(_0x5d2adb,null))[_0x0358('0x21')](function(_0x3f537b){if(_0x3f537b){var _0x56131e=_0x3f537b[_0x0358('0x45')]({'plain':!![]});_0x56131e=qs[_0x0358('0x46')](_0x56131e,['id','createdAt',_0x0358('0x47')]);_0x323809[_0x0358('0x48')]=_[_0x0358('0x46')](_0x323809[_0x0358('0x48')],['id',_0x0358('0x49'),_0x0358('0x47')]);return db[_0x0358('0x27')]['create'](_[_0x0358('0x3a')](_0x56131e,_0x323809['body']),{'include':_0x323809[_0x0358('0x2d')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x0358('0x21')](respondWithResult(_0x5d2adb,0xc9))[_0x0358('0x3e')](handleError(_0x5d2adb,null));};exports['update']=function(_0x4109d9,_0x224f7d){if(_0x4109d9[_0x0358('0x48')]['id']){delete _0x4109d9[_0x0358('0x48')]['id'];}return db[_0x0358('0x27')]['find']({'where':{'id':_0x4109d9['params']['id']}})[_0x0358('0x21')](handleEntityNotFound(_0x224f7d,null))['then'](saveUpdates(_0x4109d9[_0x0358('0x48')],null))[_0x0358('0x21')](respondWithResult(_0x224f7d,null))[_0x0358('0x3e')](handleError(_0x224f7d,null));};exports[_0x0358('0x20')]=function(_0x418f19,_0x368618){return db[_0x0358('0x27')][_0x0358('0x44')]({'where':{'id':_0x418f19['params']['id']}})[_0x0358('0x21')](handleEntityNotFound(_0x368618,null))[_0x0358('0x21')](removeEntity(_0x368618,null))['catch'](handleError(_0x368618,null));};exports[_0x0358('0x4a')]=function(_0x372345,_0x3e9433,_0x10149a){_0x372345[_0x0358('0x48')][_0x0358('0x25')]=_0x372345['file'][_0x0358('0x4b')];_0x372345['body'][_0x0358('0x4c')]=_0x372345['file'][_0x0358('0x4d')];_0x372345[_0x0358('0x48')]['type']=_0x372345[_0x0358('0x4e')]['mimetype'];return db[_0x0358('0x27')][_0x0358('0x4a')](_0x372345[_0x0358('0x48')])[_0x0358('0x21')](respondWithResult(_0x3e9433,0xc9))[_0x0358('0x3e')](handleError(_0x3e9433,null));};exports[_0x0358('0x4f')]=function(_0x32c9b3,_0x2cd669,_0x1df1d3){return db[_0x0358('0x27')][_0x0358('0x50')]({'where':{'id':_0x32c9b3['params']['id']},'raw':!![]})[_0x0358('0x21')](handleEntityNotFound(_0x2cd669,null))['then'](function(_0x1cfb09){if(_0x1cfb09){var _0x19d1c1=_0x1cfb09[_0x0358('0x51')]!==null;var _0x55be55=path[_0x0358('0x52')](config[_0x0358('0x53')],_0x0358('0x54'));if(_0x19d1c1){_0x55be55=path[_0x0358('0x52')](_0x55be55,'offline-chat/');}var _0x4e599e=path[_0x0358('0x52')](_0x55be55,_0x1cfb09[_0x0358('0x4c')]);return _0x2cd669[_0x0358('0x4f')](_0x4e599e);}})['catch'](handleError(_0x2cd669,null));}; \ No newline at end of file +var _0x38bd=['createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','offline-chat/','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','clone','get','omit'];(function(_0x4db471,_0x334531){var _0x3935ff=function(_0x47dac5){while(--_0x47dac5){_0x4db471['push'](_0x4db471['shift']());}};_0x3935ff(++_0x334531);}(_0x38bd,0x1c1));var _0xd38b=function(_0xe98f8e,_0x5c01ee){_0xe98f8e=_0xe98f8e-0x0;var _0xec83fb=_0x38bd[_0xe98f8e];return _0xec83fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd38b('0x0'));var zipdir=require(_0xd38b('0x1'));var jsonpatch=require(_0xd38b('0x2'));var rp=require(_0xd38b('0x3'));var moment=require(_0xd38b('0x4'));var BPromise=require(_0xd38b('0x5'));var Mustache=require(_0xd38b('0x6'));var util=require(_0xd38b('0x7'));var path=require(_0xd38b('0x8'));var sox=require(_0xd38b('0x9'));var csv=require(_0xd38b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd38b('0xb'));var _=require('lodash');var squel=require(_0xd38b('0xc'));var crypto=require('crypto');var jsforce=require(_0xd38b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd38b('0xa'));var querystring=require(_0xd38b('0xe'));var Papa=require(_0xd38b('0xf'));var Redis=require('ioredis');var authService=require(_0xd38b('0x10'));var qs=require(_0xd38b('0x11'));var as=require(_0xd38b('0x12'));var hardwareService=require(_0xd38b('0x13'));var logger=require(_0xd38b('0x14'))(_0xd38b('0x15'));var utils=require(_0xd38b('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x747e8d,_0x54d467){_0x54d467=_0x54d467||0xcc;return function(_0x5483f1){if(_0x5483f1){return _0x747e8d[_0xd38b('0x17')](_0x54d467);}return _0x747e8d[_0xd38b('0x18')](_0x54d467)[_0xd38b('0x19')]();};}function respondWithResult(_0x4622db,_0x1cff62){_0x1cff62=_0x1cff62||0xc8;return function(_0x3a9664){if(_0x3a9664){return _0x4622db[_0xd38b('0x18')](_0x1cff62)[_0xd38b('0x1a')](_0x3a9664);}};}function respondWithFilteredResult(_0xfc9457,_0x323840){return function(_0x1547fa){if(_0x1547fa){var _0x1ffae4=typeof _0x323840['offset']===_0xd38b('0x1b')&&typeof _0x323840[_0xd38b('0x1c')]==='undefined';var _0x227441=_0x1547fa[_0xd38b('0x1d')];var _0x2f12e3=_0x1ffae4?0x0:_0x323840[_0xd38b('0x1e')];var _0x8989a7=_0x1ffae4?_0x1547fa[_0xd38b('0x1d')]:_0x323840[_0xd38b('0x1e')]+_0x323840['limit'];var _0x3fd064;if(_0x8989a7>=_0x227441){_0x8989a7=_0x227441;_0x3fd064=0xc8;}else{_0x3fd064=0xce;}_0xfc9457[_0xd38b('0x18')](_0x3fd064);return _0xfc9457[_0xd38b('0x1f')](_0xd38b('0x20'),_0x2f12e3+'-'+_0x8989a7+'/'+_0x227441)['json'](_0x1547fa);}return null;};}function patchUpdates(_0x39c5db){return function(_0x35bd89){try{jsonpatch[_0xd38b('0x21')](_0x35bd89,_0x39c5db,!![]);}catch(_0x208cc9){return BPromise[_0xd38b('0x22')](_0x208cc9);}return _0x35bd89['save']();};}function saveUpdates(_0x388ff7,_0x4e1aaa){return function(_0x22f3e4){if(_0x22f3e4){return _0x22f3e4[_0xd38b('0x23')](_0x388ff7)[_0xd38b('0x24')](function(_0x419a35){return _0x419a35;});}return null;};}function removeEntity(_0x26527a,_0x4d0922){return function(_0xd4b990){if(_0xd4b990){return _0xd4b990[_0xd38b('0x25')]()['then'](function(){_0x26527a['status'](0xcc)[_0xd38b('0x19')]();});}};}function handleEntityNotFound(_0x27b893,_0x1d0a30){return function(_0x44d3c7){if(!_0x44d3c7){_0x27b893[_0xd38b('0x17')](0x194);}return _0x44d3c7;};}function handleError(_0xa3fb47,_0x5d0eb9){_0x5d0eb9=_0x5d0eb9||0x1f4;return function(_0x8f8b5c){logger['error'](_0x8f8b5c[_0xd38b('0x26')]);if(_0x8f8b5c[_0xd38b('0x27')]){delete _0x8f8b5c[_0xd38b('0x27')];}_0xa3fb47[_0xd38b('0x18')](_0x5d0eb9)[_0xd38b('0x28')](_0x8f8b5c);};}exports[_0xd38b('0x29')]=function(_0x32a7fb,_0x5a18bb){var _0x1e8cd5={},_0x17958d={},_0x3f6dc7={'count':0x0,'rows':[]};var _0xbde058=_[_0xd38b('0x2a')](db[_0xd38b('0x2b')][_0xd38b('0x2c')],function(_0xda392d){return{'name':_0xda392d[_0xd38b('0x2d')],'type':_0xda392d[_0xd38b('0x2e')][_0xd38b('0x2f')]};});_0x17958d[_0xd38b('0x30')]=_[_0xd38b('0x2a')](_0xbde058,_0xd38b('0x27'));_0x17958d[_0xd38b('0x31')]=_[_0xd38b('0x32')](_0x32a7fb[_0xd38b('0x31')]);_0x17958d[_0xd38b('0x33')]=_[_0xd38b('0x34')](_0x17958d[_0xd38b('0x30')],_0x17958d[_0xd38b('0x31')]);_0x1e8cd5[_0xd38b('0x35')]=_[_0xd38b('0x34')](_0x17958d[_0xd38b('0x30')],qs[_0xd38b('0x36')](_0x32a7fb[_0xd38b('0x31')]['fields']));_0x1e8cd5[_0xd38b('0x35')]=_0x1e8cd5[_0xd38b('0x35')][_0xd38b('0x37')]?_0x1e8cd5['attributes']:_0x17958d['model'];if(!_0x32a7fb[_0xd38b('0x31')]['hasOwnProperty'](_0xd38b('0x38'))){_0x1e8cd5[_0xd38b('0x1c')]=qs[_0xd38b('0x1c')](_0x32a7fb[_0xd38b('0x31')][_0xd38b('0x1c')]);_0x1e8cd5[_0xd38b('0x1e')]=qs['offset'](_0x32a7fb['query']['offset']);}_0x1e8cd5['order']=qs[_0xd38b('0x39')](_0x32a7fb[_0xd38b('0x31')][_0xd38b('0x39')]);_0x1e8cd5['where']=qs['filters'](_['pick'](_0x32a7fb['query'],_0x17958d[_0xd38b('0x33')]),_0xbde058);if(_0x32a7fb[_0xd38b('0x31')][_0xd38b('0x3a')]){_0x1e8cd5[_0xd38b('0x3b')]=_[_0xd38b('0x3c')](_0x1e8cd5[_0xd38b('0x3b')],{'$or':_[_0xd38b('0x2a')](_0xbde058,function(_0x3b9638){if(_0x3b9638[_0xd38b('0x2e')]!==_0xd38b('0x3d')){var _0x4b47a7={};_0x4b47a7[_0x3b9638[_0xd38b('0x27')]]={'$like':'%'+_0x32a7fb[_0xd38b('0x31')][_0xd38b('0x3a')]+'%'};return _0x4b47a7;}})});}_0x1e8cd5=_[_0xd38b('0x3c')]({},_0x1e8cd5,_0x32a7fb['options']);var _0x44d3e8={'where':_0x1e8cd5['where']};return db[_0xd38b('0x2b')][_0xd38b('0x1d')](_0x44d3e8)['then'](function(_0x1687e0){_0x3f6dc7[_0xd38b('0x1d')]=_0x1687e0;if(_0x32a7fb[_0xd38b('0x31')][_0xd38b('0x3e')]){_0x1e8cd5[_0xd38b('0x3f')]=[{'all':!![]}];}return db[_0xd38b('0x2b')]['findAll'](_0x1e8cd5);})[_0xd38b('0x24')](function(_0x584cd7){_0x3f6dc7[_0xd38b('0x40')]=_0x584cd7;return _0x3f6dc7;})[_0xd38b('0x24')](respondWithFilteredResult(_0x5a18bb,_0x1e8cd5))[_0xd38b('0x41')](handleError(_0x5a18bb,null));};exports[_0xd38b('0x42')]=function(_0x1b046b,_0x5a2b9d){var _0x5c13b2={'raw':!![],'where':{'id':_0x1b046b[_0xd38b('0x43')]['id']}},_0x40e02b={};_0x40e02b[_0xd38b('0x30')]=_['keys'](db[_0xd38b('0x2b')][_0xd38b('0x2c')]);_0x40e02b[_0xd38b('0x31')]=_[_0xd38b('0x32')](_0x1b046b[_0xd38b('0x31')]);_0x40e02b[_0xd38b('0x33')]=_[_0xd38b('0x34')](_0x40e02b[_0xd38b('0x30')],_0x40e02b[_0xd38b('0x31')]);_0x5c13b2['attributes']=_[_0xd38b('0x34')](_0x40e02b[_0xd38b('0x30')],qs[_0xd38b('0x36')](_0x1b046b[_0xd38b('0x31')][_0xd38b('0x36')]));_0x5c13b2[_0xd38b('0x35')]=_0x5c13b2[_0xd38b('0x35')][_0xd38b('0x37')]?_0x5c13b2[_0xd38b('0x35')]:_0x40e02b[_0xd38b('0x30')];if(_0x1b046b[_0xd38b('0x31')][_0xd38b('0x3e')]){_0x5c13b2[_0xd38b('0x3f')]=[{'all':!![]}];}_0x5c13b2=_[_0xd38b('0x3c')]({},_0x5c13b2,_0x1b046b[_0xd38b('0x44')]);return db[_0xd38b('0x2b')][_0xd38b('0x45')](_0x5c13b2)[_0xd38b('0x24')](handleEntityNotFound(_0x5a2b9d,null))[_0xd38b('0x24')](respondWithResult(_0x5a2b9d,null))[_0xd38b('0x41')](handleError(_0x5a2b9d,null));};exports[_0xd38b('0x46')]=function(_0x56da4a,_0x365400){var _0x1743a0={'where':{'id':_0x56da4a[_0xd38b('0x43')]['id']}},_0x45e194={};_0x45e194[_0xd38b('0x30')]=_[_0xd38b('0x32')](db[_0xd38b('0x2b')][_0xd38b('0x2c')]);_0x1743a0[_0xd38b('0x35')]=_['intersection'](_0x45e194[_0xd38b('0x30')],qs[_0xd38b('0x36')](_0x56da4a[_0xd38b('0x31')][_0xd38b('0x36')]));_0x1743a0[_0xd38b('0x35')]=_0x1743a0[_0xd38b('0x35')][_0xd38b('0x37')]?_0x1743a0[_0xd38b('0x35')]:_0x45e194['model'];if(_0x56da4a[_0xd38b('0x31')][_0xd38b('0x3e')]){_0x1743a0[_0xd38b('0x3f')]=[{'all':!![]}];}_0x1743a0=_[_0xd38b('0x3c')]({},_0x1743a0,_0x56da4a['options']);return db[_0xd38b('0x2b')][_0xd38b('0x45')](_0x1743a0)[_0xd38b('0x24')](handleEntityNotFound(_0x365400,null))[_0xd38b('0x24')](function(_0x4d3163){if(_0x4d3163){var _0x231532=_0x4d3163[_0xd38b('0x47')]({'plain':!![]});_0x231532=qs[_0xd38b('0x48')](_0x231532,['id',_0xd38b('0x49'),_0xd38b('0x4a')]);_0x56da4a[_0xd38b('0x4b')]=_['omit'](_0x56da4a[_0xd38b('0x4b')],['id',_0xd38b('0x49'),_0xd38b('0x4a')]);return db[_0xd38b('0x2b')]['create'](_[_0xd38b('0x3c')](_0x231532,_0x56da4a['body']),{'include':_0x56da4a[_0xd38b('0x31')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xd38b('0x24')](respondWithResult(_0x365400,0xc9))['catch'](handleError(_0x365400,null));};exports[_0xd38b('0x23')]=function(_0x138309,_0x5c951d){if(_0x138309[_0xd38b('0x4b')]['id']){delete _0x138309['body']['id'];}return db[_0xd38b('0x2b')]['find']({'where':{'id':_0x138309['params']['id']}})[_0xd38b('0x24')](handleEntityNotFound(_0x5c951d,null))[_0xd38b('0x24')](saveUpdates(_0x138309[_0xd38b('0x4b')],null))['then'](respondWithResult(_0x5c951d,null))[_0xd38b('0x41')](handleError(_0x5c951d,null));};exports['destroy']=function(_0x1e5c0b,_0x2db023){return db['Attachment'][_0xd38b('0x45')]({'where':{'id':_0x1e5c0b[_0xd38b('0x43')]['id']}})[_0xd38b('0x24')](handleEntityNotFound(_0x2db023,null))[_0xd38b('0x24')](removeEntity(_0x2db023,null))[_0xd38b('0x41')](handleError(_0x2db023,null));};exports[_0xd38b('0x4c')]=function(_0x474b2d,_0x3bfd54,_0x263813){_0x474b2d[_0xd38b('0x4b')][_0xd38b('0x27')]=_0x474b2d[_0xd38b('0x4d')][_0xd38b('0x4e')];_0x474b2d[_0xd38b('0x4b')][_0xd38b('0x4f')]=_0x474b2d['file'][_0xd38b('0x50')];_0x474b2d[_0xd38b('0x4b')][_0xd38b('0x2e')]=_0x474b2d[_0xd38b('0x4d')][_0xd38b('0x51')];return db['Attachment'][_0xd38b('0x4c')](_0x474b2d[_0xd38b('0x4b')])['then'](respondWithResult(_0x3bfd54,0xc9))['catch'](handleError(_0x3bfd54,null));};exports[_0xd38b('0x52')]=function(_0x2b3b5e,_0x7bdc66,_0x31bb41){return db[_0xd38b('0x2b')][_0xd38b('0x53')]({'where':{'id':_0x2b3b5e['params']['id']},'raw':!![]})[_0xd38b('0x24')](handleEntityNotFound(_0x7bdc66,null))[_0xd38b('0x24')](function(_0x2a0222){if(_0x2a0222){var _0x1d00ac=_0x2a0222[_0xd38b('0x54')]!==null;var _0x2b0b7f=path[_0xd38b('0x55')](config['root'],'server/files/attachments/');if(_0x1d00ac){_0x2b0b7f=path[_0xd38b('0x55')](_0x2b0b7f,_0xd38b('0x56'));}var _0x5c7f3c=path[_0xd38b('0x55')](_0x2b0b7f,_0x2a0222[_0xd38b('0x4f')]);return _0x7bdc66[_0xd38b('0x52')](_0x5c7f3c);}})[_0xd38b('0x41')](handleError(_0x7bdc66,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index eb4fe13..9579aa7 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 _0x7366=['lodash','api','moment','request-promise','path','rimraf','../../config/environment','Attachment','attachments'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7366,0x17a));var _0x6736=function(_0xe24e7e,_0x24b30c){_0xe24e7e=_0xe24e7e-0x0;var _0x1068d6=_0x7366[_0xe24e7e];return _0x1068d6;};'use strict';var _=require(_0x6736('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6736('0x1'));var moment=require(_0x6736('0x2'));var BPromise=require('bluebird');var rp=require(_0x6736('0x3'));var fs=require('fs');var path=require(_0x6736('0x4'));var rimraf=require(_0x6736('0x5'));var config=require(_0x6736('0x6'));var attributes=require('./attachment.attributes');module['exports']=function(_0x4f92c0,_0x3c1bee){return _0x4f92c0['define'](_0x6736('0x7'),attributes,{'tableName':_0x6736('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd594=['Attachment','attachments','util','api','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x1bbb03,_0x18c084){var _0x1ae659=function(_0x388937){while(--_0x388937){_0x1bbb03['push'](_0x1bbb03['shift']());}};_0x1ae659(++_0x18c084);}(_0xd594,0x142));var _0x4d59=function(_0xe74b4b,_0x2aa789){_0xe74b4b=_0xe74b4b-0x0;var _0xc54661=_0xd594[_0xe74b4b];return _0xc54661;};'use strict';var _=require('lodash');var util=require(_0x4d59('0x0'));var logger=require('../../config/logger')(_0x4d59('0x1'));var moment=require('moment');var BPromise=require(_0x4d59('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d59('0x3'));var rimraf=require(_0x4d59('0x4'));var config=require(_0x4d59('0x5'));var attributes=require('./attachment.attributes');module[_0x4d59('0x6')]=function(_0x5dfbb1,_0x23b76a){return _0x5dfbb1[_0x4d59('0x7')](_0x4d59('0x8'),attributes,{'tableName':_0x4d59('0x9'),'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 57be978..1e93f0a 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 _0xbd3b=['body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','CreateAttachment','Attachment'];(function(_0x28fbcf,_0x53d24d){var _0x34d5c7=function(_0x41d6de){while(--_0x41d6de){_0x28fbcf['push'](_0x28fbcf['shift']());}};_0x34d5c7(++_0x53d24d);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x333767,_0x220733){_0x333767=_0x333767-0x0;var _0x42a755=_0xbd3b[_0x333767];return _0x42a755;};'use strict';var _=require(_0xbbd3('0x0'));var util=require(_0xbbd3('0x1'));var moment=require(_0xbbd3('0x2'));var BPromise=require('bluebird');var rs=require(_0xbbd3('0x3'));var fs=require('fs');var Redis=require(_0xbbd3('0x4'));var db=require(_0xbbd3('0x5'))['db'];var utils=require(_0xbbd3('0x6'));var logger=require('../../config/logger')(_0xbbd3('0x7'));var config=require(_0xbbd3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbbd3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cc5d9,_0x232ede,_0x44f331){return new BPromise(function(_0x4b8667,_0x3d3f9f){return client[_0xbbd3('0xa')](_0x3cc5d9,_0x44f331)[_0xbbd3('0xb')](function(_0x229f59){logger['info'](_0xbbd3('0xc'),_0x232ede,_0xbbd3('0xd'));logger[_0xbbd3('0xe')](_0xbbd3('0xf'),_0x232ede,'request\x20sent',JSON[_0xbbd3('0x10')](_0x229f59));if(_0x229f59['error']){if(_0x229f59['error'][_0xbbd3('0x11')]===0x1f4){logger[_0xbbd3('0x12')](_0xbbd3('0xc'),_0x232ede,_0x229f59[_0xbbd3('0x12')][_0xbbd3('0x13')]);return _0x3d3f9f(_0x229f59[_0xbbd3('0x12')][_0xbbd3('0x13')]);}logger[_0xbbd3('0x12')](_0xbbd3('0xc'),_0x232ede,_0x229f59[_0xbbd3('0x12')]['message']);return _0x4b8667(_0x229f59['error'][_0xbbd3('0x13')]);}else{logger[_0xbbd3('0x14')](_0xbbd3('0xc'),_0x232ede,_0xbbd3('0xd'));_0x4b8667(_0x229f59[_0xbbd3('0x15')]['message']);}})[_0xbbd3('0x16')](function(_0x49d6b9){logger[_0xbbd3('0x12')](_0xbbd3('0xc'),_0x232ede,_0x49d6b9);_0x3d3f9f(_0x49d6b9);});});}exports[_0xbbd3('0x17')]=function(_0x240a46){var _0x5f3952=this;return new Promise(function(_0x50b6e4,_0x12954a){return db[_0xbbd3('0x18')]['create'](_0x240a46[_0xbbd3('0x19')],{'raw':_0x240a46['options']?_0x240a46[_0xbbd3('0x1a')][_0xbbd3('0x1b')]===undefined?!![]:![]:!![]})[_0xbbd3('0xb')](function(_0x1fa586){logger[_0xbbd3('0x14')](_0xbbd3('0x17'),_0x240a46);logger[_0xbbd3('0xe')]('CreateAttachment',_0x240a46,JSON[_0xbbd3('0x10')](_0x1fa586));_0x50b6e4(_0x1fa586);})['catch'](function(_0x5392eb){logger[_0xbbd3('0x12')](_0xbbd3('0x17'),_0x5392eb[_0xbbd3('0x13')],_0x240a46);_0x12954a(_0x5f3952[_0xbbd3('0x12')](0x1f4,_0x5392eb['message']));});});}; \ No newline at end of file +var _0x984b=['ioredis','../../config/logger','rpc','client','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Attachment','create','options','raw','CreateAttachment','bluebird','randomstring'];(function(_0x21221c,_0x1bf89f){var _0x1aa255=function(_0x13aa1b){while(--_0x13aa1b){_0x21221c['push'](_0x21221c['shift']());}};_0x1aa255(++_0x1bf89f);}(_0x984b,0xee));var _0xb984=function(_0x281ce9,_0x5db8a4){_0x281ce9=_0x281ce9-0x0;var _0x46df1c=_0x984b[_0x281ce9];return _0x46df1c;};'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);});});}exports['CreateAttachment']=function(_0x396c36){var _0x35bd75=this;return new Promise(function(_0x3a5c96,_0x9afbee){return db[_0xb984('0x13')][_0xb984('0x14')](_0x396c36['body'],{'raw':_0x396c36[_0xb984('0x15')]?_0x396c36[_0xb984('0x15')][_0xb984('0x16')]===undefined?!![]:![]:!![]})[_0xb984('0x7')](function(_0x32831b){logger[_0xb984('0x8')]('CreateAttachment',_0x396c36);logger[_0xb984('0xb')](_0xb984('0x17'),_0x396c36,JSON['stringify'](_0x32831b));_0x3a5c96(_0x32831b);})[_0xb984('0x12')](function(_0x97af5c){logger[_0xb984('0xe')](_0xb984('0x17'),_0x97af5c[_0xb984('0x10')],_0x396c36);_0x9afbee(_0x35bd75[_0xb984('0xe')](0x1f4,_0x97af5c[_0xb984('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 9616173..894e8de 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 _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x8c1b74,_0x332a2e){var _0x50884c=function(_0x4f7d81){while(--_0x4f7d81){_0x8c1b74['push'](_0x8c1b74['shift']());}};_0x50884c(++_0x332a2e);}(_0x2032,0xd9));var _0x2203=function(_0x3bac0f,_0x2fd507){_0x3bac0f=_0x3bac0f-0x0;var _0x27598d=_0x2032[_0x3bac0f];return _0x27598d;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file +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(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5ecff9,_0x473070){_0x5ecff9=_0x5ecff9-0x0;var _0x5e1415=_0x0b0e[_0x5ecff9];return _0x5e1415;};'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 diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 5d5d66a..c8d8d64 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 _0x616f=['Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','disabled','blockedAt','online','admin','user','agent','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','use','User','passport-local','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x616f,0x1d2));var _0xf616=function(_0x191b1a,_0x48e0e6){_0x191b1a=_0x191b1a-0x0;var _0x283089=_0x616f[_0x191b1a];return _0x283089;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xf616('0x0'))['Strategy'];var moment=require('moment');var ActiveDirectory=require(_0xf616('0x1'));var BPromise=require('bluebird');var util=require(_0xf616('0x2'));var db=require(_0xf616('0x3'))['db'];var authService=require(_0xf616('0x4'));var utils=require(_0xf616('0x5'));var config=require(_0xf616('0x6'));var logger=require(_0xf616('0x7'))('api');function isActiveDirectoryConfigured(_0x100fad){var _0x236456=![];if(typeof _0x100fad[_0xf616('0x8')]!=='undefined'){_0x236456=_0x100fad[_0xf616('0x8')][_0xf616('0x9')]&&_0x100fad[_0xf616('0x8')][_0xf616('0xa')]&&_0x100fad[_0xf616('0x8')][_0xf616('0xb')];}return _0x236456;}function adAuthenticate(_0x39abb7,_0x501bd5,_0x3256d7){return new BPromise(function(_0x3ce048,_0xc1a815){try{var _0x59673d=new ActiveDirectory(_0x39abb7);_0x59673d['authenticate'](_0x501bd5,_0x3256d7,function(_0x5a636b,_0x1276d1){if(_0x5a636b){logger[_0xf616('0xc')](_0xf616('0xd'),_0x501bd5,util['inspect'](_0x5a636b,{'showHidden':![],'depth':null}));_0xc1a815(_0xf616('0xe'));}else if(!_0x1276d1){logger[_0xf616('0xc')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x501bd5);_0xc1a815(_0xf616('0xe'));}else{_0x3ce048(_0x1276d1);}});}catch(_0x4b757d){_0xc1a815(_0x4b757d);}});}function ActiveDirectoryAuthenticate(_0x36f6c2,_0x10708d,_0x519c04,_0x5e797f){var _0x1aaa29,_0x35f74d;if(!isActiveDirectoryConfigured(config)){logger[_0xf616('0xc')](_0xf616('0xf'),_0x10708d);return _0x5e797f(null,![],{'message':_0xf616('0xe')});}return db[_0xf616('0x10')][_0xf616('0x11')]({'where':{'id':0x1},'attributes':[_0xf616('0x12'),_0xf616('0x13')],'raw':!![]})[_0xf616('0x14')](function(_0x1a9182){_0x1aaa29=_0x1a9182;if(!_0x1aaa29[_0xf616('0x12')]){logger[_0xf616('0xc')](_0xf616('0x15'),_0x10708d);throw new Error(_0xf616('0xe'));}return _0x36f6c2['findOne']({'logging':!![],'attributes':['id',_0xf616('0x16'),_0xf616('0x17'),_0xf616('0x18'),'role',_0xf616('0x19'),'blocked',_0xf616('0x1a'),_0xf616('0x1b')],'where':{'name':_0x10708d,'role':{'$or':[_0xf616('0x1c'),_0xf616('0x1d'),_0xf616('0x1e')]},'adSsoEnabled':!![]}});})[_0xf616('0x14')](function(_0x5ea609){if(!_0x5ea609||_0x5ea609&&_0x5ea609[_0xf616('0x16')]!==_0x10708d){throw new Error(_0xf616('0xe'));}_0x35f74d=_0x5ea609;var _0x589bfb=_0x35f74d[_0xf616('0x16')]+'@'+config[_0xf616('0x8')]['domain'];return adAuthenticate(config[_0xf616('0x8')],_0x589bfb,_0x519c04);})[_0xf616('0x14')](function(_0x11a4d1){if(_0x35f74d[_0xf616('0x19')]){throw new Error(_0xf616('0xe'));}if(_0x1aaa29['blockDuration']>0x0){if(_0x35f74d['blocked']){if(moment(_0x35f74d[_0xf616('0x1a')])[_0xf616('0x1f')](_0x1aaa29[_0xf616('0x13')],_0xf616('0x20'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xf616('0x21')](_0x35f74d,0x0,![],null)[_0xf616('0x14')](function(){return utils['getLicense'](_0x35f74d);})[_0xf616('0x14')](function(){return _0x5e797f(null,_0x35f74d);});}else{return utils[_0xf616('0x22')](_0x35f74d)[_0xf616('0x14')](function(){return _0x5e797f(null,_0x35f74d);});}}else{return utils[_0xf616('0x22')](_0x35f74d)[_0xf616('0x14')](function(){return _0x5e797f(null,_0x35f74d);});}})[_0xf616('0x23')](function(_0x5f1f58){return _0x5e797f(null,![],_0x5f1f58);});}function handleError(_0x4370b9,_0x499440,_0x324fba){return _0x4370b9[_0xf616('0x24')](_0x499440||0x1f4)[_0xf616('0x25')]({'message':_0x324fba?_0x324fba[_0xf616('0x26')]||_0x324fba:''});}exports[_0xf616('0x27')]=function(_0x711317,_0x154149,_0xbde0db){passport[_0xf616('0x28')](_0xf616('0x29'),function(_0x7c44c5,_0x29e1bd,_0x464078){var _0x58c21e=_0x7c44c5||_0x464078;if(_0x58c21e){return handleError(_0x154149,0x191,_0x58c21e);}if(!_0x29e1bd){return handleError(_0x154149,0x194,{'message':_0xf616('0x2a')});}else{var _0x2acad8={'payload':{'id':_0x29e1bd['id'],'role':_0x29e1bd[_0xf616('0x2b')]},'options':{'expiresIn':0x15180}};return authService[_0xf616('0x2c')](_0x2acad8)[_0xf616('0x14')](function(_0x2bed20){_0x154149[_0xf616('0x2d')]({'id':_0x29e1bd['id'],'token':_0x2bed20,'statusCall':'','isAlreadyLogged':_0x29e1bd[_0xf616('0x1b')]});});}})(_0x711317,_0x154149,_0xbde0db);};passport[_0xf616('0x2e')]('ad-login',new LocalStrategy({'usernameField':_0xf616('0x16'),'passwordField':_0xf616('0x17')},function(_0x4333bd,_0x3892ee,_0x497190){return ActiveDirectoryAuthenticate(db[_0xf616('0x2f')],_0x4333bd,_0x3892ee,_0x497190);})); \ No newline at end of file +var _0x24a2=['blockedAt','online','agent','name','domain','blockDuration','add','clearBlockUser','getLicense','catch','send','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','passport-local','moment','activedirectory2','util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','baseDN','url','error','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','salt','role','disabled','blocked'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x24a2,0x156));var _0x224a=function(_0x83b8a3,_0x44009a){_0x83b8a3=_0x83b8a3-0x0;var _0xacefc9=_0x24a2[_0x83b8a3];return _0xacefc9;};'use strict';var passport=require(_0x224a('0x0'));var LocalStrategy=require(_0x224a('0x1'))['Strategy'];var moment=require(_0x224a('0x2'));var ActiveDirectory=require(_0x224a('0x3'));var BPromise=require('bluebird');var util=require(_0x224a('0x4'));var db=require(_0x224a('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x224a('0x6'));var config=require(_0x224a('0x7'));var logger=require(_0x224a('0x8'))(_0x224a('0x9'));function isActiveDirectoryConfigured(_0x2b914d){var _0x3f85b0=![];if(typeof _0x2b914d[_0x224a('0xa')]!=='undefined'){_0x3f85b0=_0x2b914d[_0x224a('0xa')][_0x224a('0xb')]&&_0x2b914d[_0x224a('0xa')][_0x224a('0xc')]&&_0x2b914d[_0x224a('0xa')]['domain'];}return _0x3f85b0;}function adAuthenticate(_0x4f41bb,_0x4a55f6,_0x1dc7d4){return new BPromise(function(_0xbe93c1,_0x27d258){try{var _0x15535a=new ActiveDirectory(_0x4f41bb);_0x15535a['authenticate'](_0x4a55f6,_0x1dc7d4,function(_0x56c88f,_0x35aec3){if(_0x56c88f){logger[_0x224a('0xd')]('Error\x20authenticate\x20%s:\x20%s',_0x4a55f6,util[_0x224a('0xe')](_0x56c88f,{'showHidden':![],'depth':null}));_0x27d258('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x35aec3){logger[_0x224a('0xd')](_0x224a('0xf'),_0x4a55f6);_0x27d258(_0x224a('0x10'));}else{_0xbe93c1(_0x35aec3);}});}catch(_0x505b1f){_0x27d258(_0x505b1f);}});}function ActiveDirectoryAuthenticate(_0x1a2b38,_0x2e1342,_0x5c3481,_0x2d115e){var _0x5c9508,_0x4103c5;if(!isActiveDirectoryConfigured(config)){logger[_0x224a('0xd')](_0x224a('0x11'),_0x2e1342);return _0x2d115e(null,![],{'message':_0x224a('0x10')});}return db[_0x224a('0x12')]['findOne']({'where':{'id':0x1},'attributes':[_0x224a('0x13'),'blockDuration'],'raw':!![]})[_0x224a('0x14')](function(_0x1725c1){_0x5c9508=_0x1725c1;if(!_0x5c9508[_0x224a('0x13')]){logger[_0x224a('0xd')](_0x224a('0x15'),_0x2e1342);throw new Error(_0x224a('0x10'));}return _0x1a2b38['findOne']({'logging':!![],'attributes':['id','name','password',_0x224a('0x16'),_0x224a('0x17'),_0x224a('0x18'),_0x224a('0x19'),_0x224a('0x1a'),_0x224a('0x1b')],'where':{'name':_0x2e1342,'role':{'$or':['admin','user',_0x224a('0x1c')]},'adSsoEnabled':!![]}});})[_0x224a('0x14')](function(_0x2eabe7){if(!_0x2eabe7||_0x2eabe7&&_0x2eabe7[_0x224a('0x1d')]!==_0x2e1342){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x4103c5=_0x2eabe7;var _0x1cd236=_0x4103c5[_0x224a('0x1d')]+'@'+config[_0x224a('0xa')][_0x224a('0x1e')];return adAuthenticate(config[_0x224a('0xa')],_0x1cd236,_0x5c3481);})[_0x224a('0x14')](function(_0x143519){if(_0x4103c5[_0x224a('0x18')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x5c9508[_0x224a('0x1f')]>0x0){if(_0x4103c5[_0x224a('0x19')]){if(moment(_0x4103c5[_0x224a('0x1a')])[_0x224a('0x20')](_0x5c9508['blockDuration'],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x224a('0x21')](_0x4103c5,0x0,![],null)[_0x224a('0x14')](function(){return utils['getLicense'](_0x4103c5);})[_0x224a('0x14')](function(){return _0x2d115e(null,_0x4103c5);});}else{return utils[_0x224a('0x22')](_0x4103c5)['then'](function(){return _0x2d115e(null,_0x4103c5);});}}else{return utils[_0x224a('0x22')](_0x4103c5)[_0x224a('0x14')](function(){return _0x2d115e(null,_0x4103c5);});}})[_0x224a('0x23')](function(_0x473449){return _0x2d115e(null,![],_0x473449);});}function handleError(_0xd17bc6,_0x3ed153,_0x3be1b3){return _0xd17bc6['status'](_0x3ed153||0x1f4)[_0x224a('0x24')]({'message':_0x3be1b3?_0x3be1b3[_0x224a('0x25')]||_0x3be1b3:''});}exports[_0x224a('0x26')]=function(_0x15c048,_0xa4a7dc,_0x1069b9){passport[_0x224a('0x27')](_0x224a('0x28'),function(_0x4b3bf1,_0x2c52e0,_0x5eb3b1){var _0x455ffc=_0x4b3bf1||_0x5eb3b1;if(_0x455ffc){return handleError(_0xa4a7dc,0x191,_0x455ffc);}if(!_0x2c52e0){return handleError(_0xa4a7dc,0x194,{'message':_0x224a('0x29')});}else{var _0x9fc6b2={'payload':{'id':_0x2c52e0['id'],'role':_0x2c52e0[_0x224a('0x17')]},'options':{'expiresIn':0x15180}};return authService[_0x224a('0x2a')](_0x9fc6b2)['then'](function(_0x3e514b){_0xa4a7dc[_0x224a('0x2b')]({'id':_0x2c52e0['id'],'token':_0x3e514b,'statusCall':'','isAlreadyLogged':_0x2c52e0[_0x224a('0x1b')]});});}})(_0x15c048,_0xa4a7dc,_0x1069b9);};passport[_0x224a('0x2c')](_0x224a('0x28'),new LocalStrategy({'usernameField':_0x224a('0x1d'),'passwordField':'password'},function(_0x47d7fe,_0x46f93d,_0x483cf4){return ActiveDirectoryAuthenticate(db[_0x224a('0x2d')],_0x47d7fe,_0x46f93d,_0x483cf4);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 7dbcef2..39d420c 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 _0x1c36=['exports','express','Router','./authActiveDirectory.controller','post'];(function(_0x1b8ffe,_0x1e4707){var _0x2c38a5=function(_0x5447c){while(--_0x5447c){_0x1b8ffe['push'](_0x1b8ffe['shift']());}};_0x2c38a5(++_0x1e4707);}(_0x1c36,0xdd));var _0x61c3=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x1c36[_0x237546];return _0x233e29;};'use strict';var express=require(_0x61c3('0x0'));var router=express[_0x61c3('0x1')]();var controller=require(_0x61c3('0x2'));router[_0x61c3('0x3')]('/',controller['login']);module[_0x61c3('0x4')]=router; \ No newline at end of file +var _0xc3e2=['./authActiveDirectory.controller','post','login','exports','express'];(function(_0x14e506,_0x40ef75){var _0xbf6490=function(_0x4ea639){while(--_0x4ea639){_0x14e506['push'](_0x14e506['shift']());}};_0xbf6490(++_0x40ef75);}(_0xc3e2,0x112));var _0x2c3e=function(_0x5d86cd,_0x21a55f){_0x5d86cd=_0x5d86cd-0x0;var _0xaba88a=_0xc3e2[_0x5d86cd];return _0xaba88a;};'use strict';var express=require(_0x2c3e('0x0'));var router=express['Router']();var controller=require(_0x2c3e('0x1'));router[_0x2c3e('0x2')]('/',controller[_0x2c3e('0x3')]);module[_0x2c3e('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 26a1af7..70a73cb 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(_0x16d911,_0x4026a1){var _0x1e9d6e=function(_0x146494){while(--_0x146494){_0x16d911['push'](_0x16d911['shift']());}};_0x1e9d6e(++_0x4026a1);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x7a54,0x106));var _0x47a5=function(_0x1fc974,_0x4e8a83){_0x1fc974=_0x1fc974-0x0;var _0x11fdb5=_0x7a54[_0x1fc974];return _0x11fdb5;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 1ff52fc..e451780 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 _0x591a=['callback','isMiddleware','setTokenCookie','express','passport','Router','../user/user.controller.js','../../components/auth/service','login','get','/callback'];(function(_0x2a4da6,_0x5e7f66){var _0x21f384=function(_0x1d2b45){while(--_0x1d2b45){_0x2a4da6['push'](_0x2a4da6['shift']());}};_0x21f384(++_0x5e7f66);}(_0x591a,0x163));var _0xa591=function(_0x2d0d9f,_0x22c0d8){_0x2d0d9f=_0x2d0d9f-0x0;var _0x30243d=_0x591a[_0x2d0d9f];return _0x30243d;};'use strict';var express=require(_0xa591('0x0'));var passport=require(_0xa591('0x1'));var router=express[_0xa591('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0xa591('0x3'));var authService=require(_0xa591('0x4'));router['get']('/',controller[_0xa591('0x5')]);router[_0xa591('0x6')](_0xa591('0x7'),controller[_0xa591('0x8')],authService[_0xa591('0x9')],userController[_0xa591('0x5')],authService[_0xa591('0xa')]);module['exports']=router; \ No newline at end of file +var _0x323b=['Router','./authGoogle.controller','../user/user.controller.js','get','login','/callback','callback','isMiddleware','setTokenCookie','express'];(function(_0xd2d54,_0x5329f7){var _0x78b113=function(_0x7d2b29){while(--_0x7d2b29){_0xd2d54['push'](_0xd2d54['shift']());}};_0x78b113(++_0x5329f7);}(_0x323b,0x1ad));var _0xb323=function(_0x53081d,_0x2bb654){_0x53081d=_0x53081d-0x0;var _0x4e0739=_0x323b[_0x53081d];return _0x4e0739;};'use strict';var express=require(_0xb323('0x0'));var passport=require('passport');var router=express[_0xb323('0x1')]();var controller=require(_0xb323('0x2'));var userController=require(_0xb323('0x3'));var authService=require('../../components/auth/service');router[_0xb323('0x4')]('/',controller[_0xb323('0x5')]);router[_0xb323('0x4')](_0xb323('0x6'),controller[_0xb323('0x7')],authService[_0xb323('0x8')],userController[_0xb323('0x5')],authService[_0xb323('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 c0ca673..6504571 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 _0xf26c=['../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','password','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','\x22%s\x22\x20<%s>','request','error','message','stringify','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','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/','status','send','params','now','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','passport-local','Strategy','jayson/promise','lodash','randomstring'];(function(_0x457b64,_0x49a219){var _0x437111=function(_0x3dad3d){while(--_0x3dad3d){_0x457b64['push'](_0x457b64['shift']());}};_0x437111(++_0x49a219);}(_0xf26c,0x186));var _0xcf26=function(_0x4051cc,_0x54fd4f){_0x4051cc=_0x4051cc-0x0;var _0x5dda95=_0xf26c[_0x4051cc];return _0x5dda95;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0xcf26('0x0'))[_0xcf26('0x1')];var jayson=require(_0xcf26('0x2'));var _=require(_0xcf26('0x3'));var rs=require(_0xcf26('0x4'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0xcf26('0x5'));var utils=require(_0xcf26('0x6'));var client=jayson[_0xcf26('0x7')][_0xcf26('0x8')]({'port':0x232b});function localAuthenticate(_0x2b5d41,_0x527922,_0x3d8e60,_0x179368){var _0x50b6cc,_0x1b0a0f;return db[_0xcf26('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0xcf26('0xa'),_0xcf26('0xb')],'raw':!![]})[_0xcf26('0xc')](function(_0x1a1386){_0x50b6cc=_0x1a1386;return _0x2b5d41[_0xcf26('0xd')]({'attributes':['id',_0xcf26('0xe'),_0xcf26('0xf'),'salt',_0xcf26('0x10'),_0xcf26('0x11'),_0xcf26('0x12'),_0xcf26('0x13'),_0xcf26('0x14')],'where':{'name':_0x527922,'role':{'$or':[_0xcf26('0x15'),_0xcf26('0x16'),_0xcf26('0x17')]}}});})[_0xcf26('0xc')](function(_0x5a4f9e){if(!_0x5a4f9e||_0x5a4f9e&&_0x5a4f9e[_0xcf26('0xe')]!==_0x527922){throw new Error(_0xcf26('0x18'));}else{_0x1b0a0f=_0x5a4f9e;return _0x1b0a0f;}})['then'](function(){_0x1b0a0f[_0xcf26('0x19')](_0x3d8e60,function(_0x1ab183,_0x480926){var _0x4840ba=_0x1b0a0f[_0xcf26('0x14')]+0x1;if(_0x1ab183){return _0x179368(_0x1ab183);}else if(!_0x480926){if(_0x1b0a0f[_0xcf26('0x11')]){return _0x179368(null,![],{'message':_0xcf26('0x18')});}else if(_0x50b6cc[_0xcf26('0xa')]>0x0){if(_0x1b0a0f[_0xcf26('0x12')]){if(_0x50b6cc['blockDuration']>0x0){if(moment(_0x1b0a0f[_0xcf26('0x13')])[_0xcf26('0x1a')](_0x50b6cc[_0xcf26('0xb')],'minutes')>moment()){return _0x179368(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xcf26('0x1b')](_0x1b0a0f,_0x4840ba,![],null)[_0xcf26('0xc')](function(){return _0x179368(null,![],{'message':_0xcf26('0x18')});});}}else{return _0x179368(null,![],{'message':_0xcf26('0x18')});}}else{if(_0x4840ba>=_0x50b6cc[_0xcf26('0xa')]){return utils[_0xcf26('0x1b')](_0x1b0a0f,0x0,!![],moment())['then'](function(){return _0x179368(null,![],{'message':_0xcf26('0x18')});});}else{return utils[_0xcf26('0x1b')](_0x1b0a0f,_0x4840ba,![],null)[_0xcf26('0xc')](function(){return _0x179368(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x179368(null,![],{'message':_0xcf26('0x18')});}}else{if(_0x1b0a0f['disabled']){return _0x179368(null,![],{'message':_0xcf26('0x18')});}else if(_0x50b6cc[_0xcf26('0xa')]>0x0){if(_0x1b0a0f['blocked']){if(_0x50b6cc[_0xcf26('0xb')]>0x0){if(moment(_0x1b0a0f[_0xcf26('0x13')])['add'](_0x50b6cc['blockDuration'],'minutes')>moment()){return _0x179368(null,![],{'message':_0xcf26('0x18')});}else{return utils[_0xcf26('0x1b')](_0x1b0a0f,0x0,![],null)[_0xcf26('0xc')](function(){return utils[_0xcf26('0x1c')](_0x1b0a0f);})[_0xcf26('0xc')](function(){return _0x179368(null,_0x1b0a0f);});}}else{return _0x179368(null,![],{'message':_0xcf26('0x18')});}}else{return utils[_0xcf26('0x1b')](_0x1b0a0f,0x0,![],null)[_0xcf26('0xc')](function(){return utils[_0xcf26('0x1c')](_0x1b0a0f);})[_0xcf26('0xc')](function(){return _0x179368(null,_0x1b0a0f);})[_0xcf26('0x1d')](function(_0x306d0b){return _0x179368(null,![],_0x306d0b);});}}else{if(_0x1b0a0f[_0xcf26('0x12')]){return _0x179368(null,![],{'message':_0xcf26('0x18')});}else{return utils[_0xcf26('0x1c')](_0x1b0a0f)[_0xcf26('0xc')](function(){return _0x179368(null,_0x1b0a0f);});}}}});})[_0xcf26('0x1d')](function(_0x567674){return _0x179368(null,![],_0x567674);});}function sendServiceMail(_0x39f196){return db[_0xcf26('0x1e')][_0xcf26('0x1f')]({'where':{'service':!![]},'attributes':['id',_0xcf26('0xe'),_0xcf26('0x20')],'include':[{'model':db[_0xcf26('0x21')],'as':_0xcf26('0x22'),'include':[{'model':db[_0xcf26('0x23')],'as':_0xcf26('0x23')}]}]})[_0xcf26('0xc')](function(_0x32893d){if(!_0x32893d){throw new Error(_0xcf26('0x24'));}var _0xc15e7d=_0x32893d[_0xcf26('0x25')]();var _0x147d77={'account':_0xc15e7d,'message':_[_0xcf26('0x26')]({'from':util['format'](_0xcf26('0x27'),_0x32893d['name'],_0x32893d['email']||_0x32893d[_0xcf26('0x22')][_0xcf26('0x16')])},_0x39f196)};return client[_0xcf26('0x28')]('SendMail',_0x147d77);})[_0xcf26('0xc')](function(_0x40704a){if(_0x40704a[_0xcf26('0x29')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x40704a['error'][_0xcf26('0x2a')]||JSON[_0xcf26('0x2b')](_0x40704a[_0xcf26('0x29')])));}return!![];});}function handleError(_0x2159fb,_0x31874d,_0x1bad2c){return _0x2159fb['status'](_0x31874d||0x1f4)['send']({'message':_0x1bad2c?_0x1bad2c[_0xcf26('0x2a')]||_0x1bad2c:''});}exports[_0xcf26('0x2c')]=function(_0x4f0285,_0x4b7bac,_0x59df61){passport['authenticate'](_0xcf26('0x2d'),function(_0x5e43ed,_0xe5e6ed,_0x1299f4){var _0x5e18c2=_0x5e43ed||_0x1299f4;if(_0x5e18c2){return handleError(_0x4b7bac,0x191,_0x5e18c2);}if(!_0xe5e6ed){return handleError(_0x4b7bac,0x194,{'message':_0xcf26('0x2e')});}else{var _0x19e632={'payload':{'id':_0xe5e6ed['id'],'role':_0xe5e6ed[_0xcf26('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xcf26('0x2f')](_0x19e632)[_0xcf26('0xc')](function(_0x39f34){_0x4b7bac[_0xcf26('0x30')]({'id':_0xe5e6ed['id'],'token':_0x39f34,'statusCall':'','isAlreadyLogged':_0xe5e6ed['online']});});}})(_0x4f0285,_0x4b7bac,_0x59df61);};exports[_0xcf26('0x31')]=function(_0x530b77,_0x49a877){if(!_0x530b77[_0xcf26('0x32')][_0xcf26('0x20')]){return handleError(_0x49a877,0x1f4,{'message':_0xcf26('0x33')});}var _0x53e116=rs['generate']();_0x530b77[_0xcf26('0x32')][_0xcf26('0x20')]=_0x530b77[_0xcf26('0x32')]['email'][_0xcf26('0x34')]()['toLowerCase']();var _0x2ef570;return db[_0xcf26('0x9')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xcf26('0xb')],'raw':!![]})[_0xcf26('0xc')](function(_0x327dae){_0x2ef570=_0x327dae;return db[_0xcf26('0x35')][_0xcf26('0x1f')]({'where':{'email':_0x530b77[_0xcf26('0x32')][_0xcf26('0x20')]}});})['then'](function(_0x320a95){if(!_0x320a95){throw new Error(_0xcf26('0x36'));}if(_0x320a95[_0xcf26('0x11')]){throw new Error(_0xcf26('0x37'));}if(_0x320a95[_0xcf26('0x12')]){if(moment(_0x320a95[_0xcf26('0x13')])[_0xcf26('0x1a')](_0x2ef570['blockDuration'],'minutes')>moment()){throw new Error(_0xcf26('0x38'));}else{_0x320a95['blocked']=![];_0x320a95[_0xcf26('0x13')]=null;}}_0x320a95[_0xcf26('0x39')]=_0x53e116;_0x320a95[_0xcf26('0x3a')]=Date['now']()+0x36ee80;return _0x320a95[_0xcf26('0x3b')]();})[_0xcf26('0xc')](function(){return sendServiceMail({'to':_0x530b77[_0xcf26('0x32')]['email'],'subject':_0xcf26('0x3c'),'text':_0xcf26('0x3d')+_0xcf26('0x3e')+_0xcf26('0x3f')+_0x530b77[_0xcf26('0x40')][_0xcf26('0x41')]+_0xcf26('0x42')+_0x53e116+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xcf26('0xc')](function(){_0x49a877[_0xcf26('0x43')](0xc8)[_0xcf26('0x44')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x1bf20a){return handleError(_0x49a877,0x1f4,_0x1bf20a);});};exports['reset']=function(_0x36d8a5,_0x1b174b){return db['User'][_0xcf26('0x1f')]({'where':{'resetPasswordToken':_0x36d8a5[_0xcf26('0x45')]['token'],'resetPasswordExpires':{'$gt':Date[_0xcf26('0x46')]()}}})[_0xcf26('0xc')](function(_0x4b098c){if(!_0x4b098c){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting']['findOne']({'attributes':['id','securePassword',_0xcf26('0x47'),_0xcf26('0x48')]})[_0xcf26('0xc')](function(_0x58ebed){if(_0x58ebed[_0xcf26('0x49')])authService[_0xcf26('0x4a')](_0x36d8a5['body'][_0xcf26('0xf')]);if(!_0x58ebed['enforcePasswordHistory']||!_0x4b098c[_0xcf26('0x4b')])return _0x4b098c;authService[_0xcf26('0x4c')](_0x36d8a5[_0xcf26('0x32')][_0xcf26('0xf')],_0x4b098c[_0xcf26('0x4b')],_0x58ebed[_0xcf26('0x48')]);return _0x4b098c;})['then'](function(){_0x4b098c[_0xcf26('0xf')]=_0x36d8a5[_0xcf26('0x32')][_0xcf26('0xf')];_0x4b098c[_0xcf26('0x39')]=null;_0x4b098c['resetPasswordExpires']=null;return _0x4b098c[_0xcf26('0x3b')]();});})['then'](function(){_0x1b174b[_0xcf26('0x43')](0xc8)['send']({'message':_0xcf26('0x4d')});})['catch'](function(_0x58973f){return handleError(_0x1b174b,0x1f4,_0x58973f);});};passport[_0xcf26('0x4e')](_0xcf26('0x2d'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x23a6b6,_0x20f1d5,_0x2effee){return localAuthenticate(db[_0xcf26('0x35')],_0x23a6b6,_0x20f1d5,_0x2effee);})); \ No newline at end of file +var _0xf1a9=['role','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','disabled','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','Setting','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','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','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','Password\x20reset!','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt'];(function(_0x396a04,_0x18d710){var _0x5d0777=function(_0x2ccf6e){while(--_0x2ccf6e){_0x396a04['push'](_0x396a04['shift']());}};_0x5d0777(++_0x18d710);}(_0xf1a9,0xdb));var _0x9f1a=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xf1a9[_0x934425];return _0x31d596;};'use strict';var util=require('util');var passport=require(_0x9f1a('0x0'));var LocalStrategy=require(_0x9f1a('0x1'))['Strategy'];var jayson=require(_0x9f1a('0x2'));var _=require(_0x9f1a('0x3'));var rs=require(_0x9f1a('0x4'));var moment=require(_0x9f1a('0x5'));var db=require(_0x9f1a('0x6'))['db'];var authService=require(_0x9f1a('0x7'));var utils=require(_0x9f1a('0x8'));var client=jayson[_0x9f1a('0x9')][_0x9f1a('0xa')]({'port':0x232b});function localAuthenticate(_0x532956,_0x564418,_0x4e54e5,_0x33ff36){var _0xf8b753,_0x1f9a2c;return db['Setting'][_0x9f1a('0xb')]({'where':{'id':0x1},'attributes':[_0x9f1a('0xc'),_0x9f1a('0xd')],'raw':!![]})[_0x9f1a('0xe')](function(_0x9c3c1f){_0xf8b753=_0x9c3c1f;return _0x532956[_0x9f1a('0xb')]({'attributes':['id',_0x9f1a('0xf'),_0x9f1a('0x10'),_0x9f1a('0x11'),_0x9f1a('0x12'),'disabled',_0x9f1a('0x13'),_0x9f1a('0x14'),_0x9f1a('0x15')],'where':{'name':_0x564418,'role':{'$or':[_0x9f1a('0x16'),_0x9f1a('0x17'),_0x9f1a('0x18')]}}});})[_0x9f1a('0xe')](function(_0x282165){if(!_0x282165||_0x282165&&_0x282165[_0x9f1a('0xf')]!==_0x564418){throw new Error(_0x9f1a('0x19'));}else{_0x1f9a2c=_0x282165;return _0x1f9a2c;}})[_0x9f1a('0xe')](function(){_0x1f9a2c['authenticate'](_0x4e54e5,function(_0x1da1cf,_0x2a8b7f){var _0x49de21=_0x1f9a2c['loginAttempts']+0x1;if(_0x1da1cf){return _0x33ff36(_0x1da1cf);}else if(!_0x2a8b7f){if(_0x1f9a2c[_0x9f1a('0x1a')]){return _0x33ff36(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xf8b753[_0x9f1a('0xc')]>0x0){if(_0x1f9a2c[_0x9f1a('0x13')]){if(_0xf8b753[_0x9f1a('0xd')]>0x0){if(moment(_0x1f9a2c[_0x9f1a('0x14')])[_0x9f1a('0x1b')](_0xf8b753[_0x9f1a('0xd')],'minutes')>moment()){return _0x33ff36(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x9f1a('0x1c')](_0x1f9a2c,_0x49de21,![],null)[_0x9f1a('0xe')](function(){return _0x33ff36(null,![],{'message':_0x9f1a('0x19')});});}}else{return _0x33ff36(null,![],{'message':_0x9f1a('0x19')});}}else{if(_0x49de21>=_0xf8b753[_0x9f1a('0xc')]){return utils[_0x9f1a('0x1c')](_0x1f9a2c,0x0,!![],moment())[_0x9f1a('0xe')](function(){return _0x33ff36(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x1f9a2c,_0x49de21,![],null)[_0x9f1a('0xe')](function(){return _0x33ff36(null,![],{'message':_0x9f1a('0x19')});});}}}else{return _0x33ff36(null,![],{'message':_0x9f1a('0x19')});}}else{if(_0x1f9a2c[_0x9f1a('0x1a')]){return _0x33ff36(null,![],{'message':_0x9f1a('0x19')});}else if(_0xf8b753[_0x9f1a('0xc')]>0x0){if(_0x1f9a2c[_0x9f1a('0x13')]){if(_0xf8b753['blockDuration']>0x0){if(moment(_0x1f9a2c['blockedAt'])[_0x9f1a('0x1b')](_0xf8b753[_0x9f1a('0xd')],_0x9f1a('0x1d'))>moment()){return _0x33ff36(null,![],{'message':_0x9f1a('0x19')});}else{return utils[_0x9f1a('0x1c')](_0x1f9a2c,0x0,![],null)[_0x9f1a('0xe')](function(){return utils[_0x9f1a('0x1e')](_0x1f9a2c);})['then'](function(){return _0x33ff36(null,_0x1f9a2c);});}}else{return _0x33ff36(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x9f1a('0x1c')](_0x1f9a2c,0x0,![],null)[_0x9f1a('0xe')](function(){return utils[_0x9f1a('0x1e')](_0x1f9a2c);})[_0x9f1a('0xe')](function(){return _0x33ff36(null,_0x1f9a2c);})['catch'](function(_0x1b690c){return _0x33ff36(null,![],_0x1b690c);});}}else{if(_0x1f9a2c[_0x9f1a('0x13')]){return _0x33ff36(null,![],{'message':_0x9f1a('0x19')});}else{return utils[_0x9f1a('0x1e')](_0x1f9a2c)[_0x9f1a('0xe')](function(){return _0x33ff36(null,_0x1f9a2c);});}}}});})[_0x9f1a('0x1f')](function(_0x5db22a){return _0x33ff36(null,![],_0x5db22a);});}function sendServiceMail(_0x1ff6d4){return db[_0x9f1a('0x20')][_0x9f1a('0x21')]({'where':{'service':!![]},'attributes':['id',_0x9f1a('0xf'),_0x9f1a('0x22')],'include':[{'model':db[_0x9f1a('0x23')],'as':_0x9f1a('0x24'),'include':[{'model':db[_0x9f1a('0x25')],'as':_0x9f1a('0x25')}]}]})[_0x9f1a('0xe')](function(_0x6ff2e6){if(!_0x6ff2e6){throw new Error(_0x9f1a('0x26'));}var _0x1b68c4=_0x6ff2e6[_0x9f1a('0x27')]();var _0x51e038={'account':_0x1b68c4,'message':_['merge']({'from':util[_0x9f1a('0x28')](_0x9f1a('0x29'),_0x6ff2e6[_0x9f1a('0xf')],_0x6ff2e6[_0x9f1a('0x22')]||_0x6ff2e6['Smtp']['user'])},_0x1ff6d4)};return client['request']('SendMail',_0x51e038);})['then'](function(_0x23d348){if(_0x23d348[_0x9f1a('0x2a')]){throw new Error(util[_0x9f1a('0x28')](_0x9f1a('0x2b'),_0x23d348[_0x9f1a('0x2a')][_0x9f1a('0x2c')]||JSON['stringify'](_0x23d348[_0x9f1a('0x2a')])));}return!![];});}function handleError(_0xcbde01,_0x5f2c41,_0x3034c8){return _0xcbde01[_0x9f1a('0x2d')](_0x5f2c41||0x1f4)[_0x9f1a('0x2e')]({'message':_0x3034c8?_0x3034c8['message']||_0x3034c8:''});}exports[_0x9f1a('0x2f')]=function(_0x320fa8,_0x4d0a05,_0x1b56cc){passport[_0x9f1a('0x30')](_0x9f1a('0x31'),function(_0x14cee6,_0x3043a6,_0x58c102){var _0x477a30=_0x14cee6||_0x58c102;if(_0x477a30){return handleError(_0x4d0a05,0x191,_0x477a30);}if(!_0x3043a6){return handleError(_0x4d0a05,0x194,{'message':_0x9f1a('0x32')});}else{var _0x289889={'payload':{'id':_0x3043a6['id'],'role':_0x3043a6[_0x9f1a('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x9f1a('0x33')](_0x289889)[_0x9f1a('0xe')](function(_0x21afab){_0x4d0a05[_0x9f1a('0x34')]({'id':_0x3043a6['id'],'token':_0x21afab,'statusCall':'','isAlreadyLogged':_0x3043a6[_0x9f1a('0x35')]});});}})(_0x320fa8,_0x4d0a05,_0x1b56cc);};exports['forgot']=function(_0x55757f,_0x168997){if(!_0x55757f[_0x9f1a('0x36')]['email']){return handleError(_0x168997,0x1f4,{'message':_0x9f1a('0x37')});}var _0x57ea10=rs['generate']();_0x55757f['body']['email']=_0x55757f[_0x9f1a('0x36')]['email'][_0x9f1a('0x38')]()[_0x9f1a('0x39')]();var _0x3fb2fe;return db[_0x9f1a('0x3a')][_0x9f1a('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x9f1a('0xe')](function(_0x42eb45){_0x3fb2fe=_0x42eb45;return db[_0x9f1a('0x3b')]['find']({'where':{'email':_0x55757f[_0x9f1a('0x36')][_0x9f1a('0x22')]}});})[_0x9f1a('0xe')](function(_0x543d93){if(!_0x543d93){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x543d93[_0x9f1a('0x1a')]){throw new Error(_0x9f1a('0x3c'));}if(_0x543d93[_0x9f1a('0x13')]){if(moment(_0x543d93[_0x9f1a('0x14')])['add'](_0x3fb2fe[_0x9f1a('0xd')],_0x9f1a('0x1d'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x543d93[_0x9f1a('0x13')]=![];_0x543d93[_0x9f1a('0x14')]=null;}}_0x543d93[_0x9f1a('0x3d')]=_0x57ea10;_0x543d93['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x543d93[_0x9f1a('0x3e')]();})[_0x9f1a('0xe')](function(){return sendServiceMail({'to':_0x55757f[_0x9f1a('0x36')][_0x9f1a('0x22')],'subject':_0x9f1a('0x3f'),'text':_0x9f1a('0x40')+_0x9f1a('0x41')+'https://'+_0x55757f[_0x9f1a('0x42')][_0x9f1a('0x43')]+'/reset/'+_0x57ea10+'\x0a\x0a'+_0x9f1a('0x44')});})['then'](function(){_0x168997[_0x9f1a('0x2d')](0xc8)['send']({'message':_0x9f1a('0x45')});})[_0x9f1a('0x1f')](function(_0x1d1199){return handleError(_0x168997,0x1f4,_0x1d1199);});};exports[_0x9f1a('0x46')]=function(_0x25d5df,_0x21caa3){return db[_0x9f1a('0x3b')][_0x9f1a('0x21')]({'where':{'resetPasswordToken':_0x25d5df['params'][_0x9f1a('0x47')],'resetPasswordExpires':{'$gt':Date[_0x9f1a('0x48')]()}}})[_0x9f1a('0xe')](function(_0x3ad51f){if(!_0x3ad51f){throw new Error(_0x9f1a('0x49'));}return db[_0x9f1a('0x3a')][_0x9f1a('0xb')]({'attributes':['id',_0x9f1a('0x4a'),'enforcePasswordHistory',_0x9f1a('0x4b')]})[_0x9f1a('0xe')](function(_0xfb9bf9){if(_0xfb9bf9[_0x9f1a('0x4a')])authService['validatePasswordPattern'](_0x25d5df[_0x9f1a('0x36')]['password']);if(!_0xfb9bf9[_0x9f1a('0x4c')]||!_0x3ad51f[_0x9f1a('0x4d')])return _0x3ad51f;authService['validatePasswordHistory'](_0x25d5df[_0x9f1a('0x36')]['password'],_0x3ad51f['previousPasswords'],_0xfb9bf9[_0x9f1a('0x4b')]);return _0x3ad51f;})[_0x9f1a('0xe')](function(){_0x3ad51f[_0x9f1a('0x10')]=_0x25d5df[_0x9f1a('0x36')]['password'];_0x3ad51f['resetPasswordToken']=null;_0x3ad51f['resetPasswordExpires']=null;return _0x3ad51f['save']();});})[_0x9f1a('0xe')](function(){_0x21caa3['status'](0xc8)[_0x9f1a('0x2e')]({'message':_0x9f1a('0x4e')});})[_0x9f1a('0x1f')](function(_0x286870){return handleError(_0x21caa3,0x1f4,_0x286870);});};passport['use']('local-login',new LocalStrategy({'usernameField':_0x9f1a('0xf'),'passwordField':'password'},function(_0x321339,_0x57632c,_0x3432c9){return localAuthenticate(db['User'],_0x321339,_0x57632c,_0x3432c9);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 1c8643e..cb8a485 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 _0x47a0=['post','reset','exports','express','Router','./authLocal.controller','login','/forgot','forgot'];(function(_0x30a31e,_0x31f766){var _0x170879=function(_0x313ee7){while(--_0x313ee7){_0x30a31e['push'](_0x30a31e['shift']());}};_0x170879(++_0x31f766);}(_0x47a0,0x1d7));var _0x047a=function(_0x25dfa8,_0x2c3cf7){_0x25dfa8=_0x25dfa8-0x0;var _0x8c7a62=_0x47a0[_0x25dfa8];return _0x8c7a62;};'use strict';var express=require(_0x047a('0x0'));var router=express[_0x047a('0x1')]();var controller=require(_0x047a('0x2'));router['post']('/',controller[_0x047a('0x3')]);router['post'](_0x047a('0x4'),controller[_0x047a('0x5')]);router[_0x047a('0x6')]('/reset/:token',controller[_0x047a('0x7')]);module[_0x047a('0x8')]=router; \ No newline at end of file +var _0xbd13=['exports','Router','./authLocal.controller','post','forgot','/reset/:token','reset'];(function(_0x138923,_0xd852c7){var _0x9e54eb=function(_0x1a4a76){while(--_0x1a4a76){_0x138923['push'](_0x138923['shift']());}};_0x9e54eb(++_0xd852c7);}(_0xbd13,0x174));var _0x3bd1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbd13[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0x3bd1('0x0')]();var controller=require(_0x3bd1('0x1'));router['post']('/',controller['login']);router[_0x3bd1('0x2')]('/forgot',controller[_0x3bd1('0x3')]);router['post'](_0x3bd1('0x4'),controller[_0x3bd1('0x5')]);module[_0x3bd1('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index ab4f946..db4805e 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 _0xde77=['exports','STRING','INTEGER','sequelize'];(function(_0x49749b,_0x358551){var _0xddf97e=function(_0x8fdf3){while(--_0x8fdf3){_0x49749b['push'](_0x49749b['shift']());}};_0xddf97e(++_0x358551);}(_0xde77,0x163));var _0x7de7=function(_0x58b1a2,_0x139818){_0x58b1a2=_0x58b1a2-0x0;var _0x440cc9=_0xde77[_0x58b1a2];return _0x440cc9;};'use strict';var Sequelize=require(_0x7de7('0x0'));module[_0x7de7('0x1')]={'name':{'type':Sequelize[_0x7de7('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x7de7('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x7de7('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xa8f8=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8f8,0x1f3));var _0x8a8f=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0xa8f8[_0x622035];return _0x326cf2;};'use strict';var Sequelize=require(_0x8a8f('0x0'));module[_0x8a8f('0x1')]={'name':{'type':Sequelize[_0x8a8f('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8a8f('0x2')]},'status':{'type':Sequelize[_0x8a8f('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8a8f('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 04032cf..847a483 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 _0x4924=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params','addConditions','ids','omit','findOne','Condition','getConditions','addActions','Action','getActions','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','Automation','rawAttributes'];(function(_0x2d86f2,_0x5e1b5c){var _0x4d2124=function(_0x4b6c2f){while(--_0x4b6c2f){_0x2d86f2['push'](_0x2d86f2['shift']());}};_0x4d2124(++_0x5e1b5c);}(_0x4924,0x11c));var _0x4492=function(_0x2493f7,_0x49c670){_0x2493f7=_0x2493f7-0x0;var _0x594ab2=_0x4924[_0x2493f7];return _0x594ab2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4492('0x0'));var jsonpatch=require(_0x4492('0x1'));var rp=require(_0x4492('0x2'));var moment=require(_0x4492('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4492('0x4'));var util=require('util');var path=require(_0x4492('0x5'));var sox=require(_0x4492('0x6'));var csv=require(_0x4492('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4492('0x8'));var _=require(_0x4492('0x9'));var squel=require(_0x4492('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4492('0xb'));var toCsv=require(_0x4492('0x7'));var querystring=require(_0x4492('0xc'));var Papa=require(_0x4492('0xd'));var Redis=require(_0x4492('0xe'));var authService=require(_0x4492('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4492('0x10'));var hardwareService=require(_0x4492('0x11'));var logger=require(_0x4492('0x12'))('api');var utils=require(_0x4492('0x13'));var config=require(_0x4492('0x14'));var licenseUtil=require(_0x4492('0x15'));var db=require(_0x4492('0x16'))['db'];function respondWithStatusCode(_0x40a597,_0x156f78){_0x156f78=_0x156f78||0xcc;return function(_0x12c291){if(_0x12c291){return _0x40a597[_0x4492('0x17')](_0x156f78);}return _0x40a597[_0x4492('0x18')](_0x156f78)['end']();};}function respondWithResult(_0x478630,_0x1eb36a){_0x1eb36a=_0x1eb36a||0xc8;return function(_0x10a6ef){if(_0x10a6ef){return _0x478630[_0x4492('0x18')](_0x1eb36a)[_0x4492('0x19')](_0x10a6ef);}};}function respondWithFilteredResult(_0x390666,_0x24f458){return function(_0x142a5d){if(_0x142a5d){var _0x153546=typeof _0x24f458['offset']===_0x4492('0x1a')&&typeof _0x24f458[_0x4492('0x1b')]===_0x4492('0x1a');var _0x3131f0=_0x142a5d[_0x4492('0x1c')];var _0x3a6a7a=_0x153546?0x0:_0x24f458[_0x4492('0x1d')];var _0x475d2a=_0x153546?_0x142a5d['count']:_0x24f458[_0x4492('0x1d')]+_0x24f458[_0x4492('0x1b')];var _0x39b5d9;if(_0x475d2a>=_0x3131f0){_0x475d2a=_0x3131f0;_0x39b5d9=0xc8;}else{_0x39b5d9=0xce;}_0x390666[_0x4492('0x18')](_0x39b5d9);return _0x390666['set'](_0x4492('0x1e'),_0x3a6a7a+'-'+_0x475d2a+'/'+_0x3131f0)[_0x4492('0x19')](_0x142a5d);}return null;};}function patchUpdates(_0x34b23f){return function(_0x4e6c6e){try{jsonpatch[_0x4492('0x1f')](_0x4e6c6e,_0x34b23f,!![]);}catch(_0x3955ea){return BPromise[_0x4492('0x20')](_0x3955ea);}return _0x4e6c6e[_0x4492('0x21')]();};}function saveUpdates(_0x180407,_0x124684){return function(_0x2596eb){if(_0x2596eb){return _0x2596eb[_0x4492('0x22')](_0x180407)[_0x4492('0x23')](function(_0x233ed8){return _0x233ed8;});}return null;};}function removeEntity(_0x125f6f,_0x2bd2d3){return function(_0x1250a9){if(_0x1250a9){return _0x1250a9[_0x4492('0x24')]()[_0x4492('0x23')](function(){_0x125f6f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x152c36,_0x275b3a){return function(_0x4d3c7d){if(!_0x4d3c7d){_0x152c36['sendStatus'](0x194);}return _0x4d3c7d;};}function handleError(_0x4dca11,_0x1c6c7a){_0x1c6c7a=_0x1c6c7a||0x1f4;return function(_0x2dca39){logger[_0x4492('0x25')](_0x2dca39[_0x4492('0x26')]);if(_0x2dca39['name']){delete _0x2dca39[_0x4492('0x27')];}_0x4dca11[_0x4492('0x18')](_0x1c6c7a)['send'](_0x2dca39);};}exports[_0x4492('0x28')]=function(_0x5dad82,_0x171ee5){var _0x28f5c7={},_0x190b4a={},_0xff0dda={'count':0x0,'rows':[]};var _0x2b164e=_[_0x4492('0x29')](db[_0x4492('0x2a')][_0x4492('0x2b')],function(_0x3d8629){return{'name':_0x3d8629['fieldName'],'type':_0x3d8629[_0x4492('0x2c')][_0x4492('0x2d')]};});_0x190b4a[_0x4492('0x2e')]=_[_0x4492('0x29')](_0x2b164e,'name');_0x190b4a[_0x4492('0x2f')]=_[_0x4492('0x30')](_0x5dad82['query']);_0x190b4a[_0x4492('0x31')]=_[_0x4492('0x32')](_0x190b4a[_0x4492('0x2e')],_0x190b4a['query']);_0x28f5c7[_0x4492('0x33')]=_['intersection'](_0x190b4a[_0x4492('0x2e')],qs['fields'](_0x5dad82[_0x4492('0x2f')][_0x4492('0x34')]));_0x28f5c7['attributes']=_0x28f5c7[_0x4492('0x33')][_0x4492('0x35')]?_0x28f5c7[_0x4492('0x33')]:_0x190b4a[_0x4492('0x2e')];if(!_0x5dad82['query'][_0x4492('0x36')](_0x4492('0x37'))){_0x28f5c7[_0x4492('0x1b')]=qs['limit'](_0x5dad82[_0x4492('0x2f')][_0x4492('0x1b')]);_0x28f5c7[_0x4492('0x1d')]=qs[_0x4492('0x1d')](_0x5dad82[_0x4492('0x2f')][_0x4492('0x1d')]);}_0x28f5c7[_0x4492('0x38')]=qs[_0x4492('0x39')](_0x5dad82[_0x4492('0x2f')]['sort']);_0x28f5c7['where']=qs['filters'](_[_0x4492('0x3a')](_0x5dad82[_0x4492('0x2f')],_0x190b4a['filters']),_0x2b164e);if(_0x5dad82[_0x4492('0x2f')][_0x4492('0x3b')]){_0x28f5c7[_0x4492('0x3c')]=_[_0x4492('0x3d')](_0x28f5c7['where'],{'$or':_[_0x4492('0x29')](_0x2b164e,function(_0x1c7c15){if(_0x1c7c15[_0x4492('0x2c')]!==_0x4492('0x3e')){var _0x42902c={};_0x42902c[_0x1c7c15[_0x4492('0x27')]]={'$like':'%'+_0x5dad82['query']['filter']+'%'};return _0x42902c;}})});}_0x28f5c7=_[_0x4492('0x3d')]({},_0x28f5c7,_0x5dad82[_0x4492('0x3f')]);var _0x5ca302={'where':_0x28f5c7['where']};return db[_0x4492('0x2a')][_0x4492('0x1c')](_0x5ca302)['then'](function(_0x406e8c){_0xff0dda[_0x4492('0x1c')]=_0x406e8c;if(_0x5dad82['query'][_0x4492('0x40')]){_0x28f5c7[_0x4492('0x41')]=[{'all':!![]}];}return db[_0x4492('0x2a')][_0x4492('0x42')](_0x28f5c7);})[_0x4492('0x23')](function(_0x342a99){_0xff0dda['rows']=_0x342a99;return _0xff0dda;})[_0x4492('0x23')](respondWithFilteredResult(_0x171ee5,_0x28f5c7))[_0x4492('0x43')](handleError(_0x171ee5,null));};exports[_0x4492('0x44')]=function(_0x5c0d62,_0x4f3662){var _0x431330={'raw':![],'where':{'id':_0x5c0d62['params']['id']}},_0x35ea6e={};_0x35ea6e['model']=_['keys'](db[_0x4492('0x2a')][_0x4492('0x2b')]);_0x35ea6e[_0x4492('0x2f')]=_[_0x4492('0x30')](_0x5c0d62[_0x4492('0x2f')]);_0x35ea6e[_0x4492('0x31')]=_[_0x4492('0x32')](_0x35ea6e['model'],_0x35ea6e[_0x4492('0x2f')]);_0x431330['attributes']=_[_0x4492('0x32')](_0x35ea6e[_0x4492('0x2e')],qs[_0x4492('0x34')](_0x5c0d62[_0x4492('0x2f')][_0x4492('0x34')]));_0x431330[_0x4492('0x33')]=_0x431330[_0x4492('0x33')][_0x4492('0x35')]?_0x431330[_0x4492('0x33')]:_0x35ea6e[_0x4492('0x2e')];if(_0x5c0d62[_0x4492('0x2f')][_0x4492('0x40')]){_0x431330['include']=[{'all':!![]}];}_0x431330=_['merge']({},_0x431330,_0x5c0d62[_0x4492('0x3f')]);return db['Automation'][_0x4492('0x45')](_0x431330)[_0x4492('0x23')](handleEntityNotFound(_0x4f3662,null))[_0x4492('0x23')](respondWithResult(_0x4f3662,null))[_0x4492('0x43')](handleError(_0x4f3662,null));};exports[_0x4492('0x46')]=function(_0x9c7ae,_0x938720){return db[_0x4492('0x2a')][_0x4492('0x46')](_0x9c7ae[_0x4492('0x47')],{})[_0x4492('0x23')](respondWithResult(_0x938720,0xc9))['catch'](handleError(_0x938720,null));};exports['update']=function(_0x47024e,_0x3bc4a9){if(_0x47024e['body']['id']){delete _0x47024e['body']['id'];}return db[_0x4492('0x2a')][_0x4492('0x45')]({'where':{'id':_0x47024e['params']['id']}})['then'](handleEntityNotFound(_0x3bc4a9,null))['then'](saveUpdates(_0x47024e[_0x4492('0x47')],null))[_0x4492('0x23')](respondWithResult(_0x3bc4a9,null))[_0x4492('0x43')](handleError(_0x3bc4a9,null));};exports[_0x4492('0x24')]=function(_0x133514,_0x49678c){return db[_0x4492('0x2a')][_0x4492('0x45')]({'where':{'id':_0x133514[_0x4492('0x48')]['id']}})['then'](handleEntityNotFound(_0x49678c,null))[_0x4492('0x23')](removeEntity(_0x49678c,null))['catch'](handleError(_0x49678c,null));};exports[_0x4492('0x49')]=function(_0x141715,_0xfed4fe,_0x4222ef){return db['Condition']['find']({'where':{'id':_0x141715[_0x4492('0x48')]['id']}})['then'](handleEntityNotFound(_0xfed4fe,null))[_0x4492('0x23')](function(_0xac8570){if(_0xac8570){return _0xac8570['addConditions'](_0x141715[_0x4492('0x47')][_0x4492('0x4a')],_[_0x4492('0x4b')](_0x141715['body'],[_0x4492('0x4a'),'id'])||{});}})['then'](respondWithResult(_0xfed4fe,null))['catch'](handleError(_0xfed4fe,null));};exports['getConditions']=function(_0x3525dd,_0x1821b5,_0x4fd1cb){var _0x950231={};var _0x27ee32={};var _0x11907a;var _0x2bb22e;return db[_0x4492('0x2a')][_0x4492('0x4c')]({'where':{'id':_0x3525dd['params']['id']}})['then'](handleEntityNotFound(_0x1821b5,null))[_0x4492('0x23')](function(_0x1269e9){if(_0x1269e9){_0x11907a=_0x1269e9;_0x27ee32['model']=_[_0x4492('0x30')](db[_0x4492('0x4d')][_0x4492('0x2b')]);_0x27ee32[_0x4492('0x2f')]=_[_0x4492('0x30')](_0x3525dd[_0x4492('0x2f')]);_0x27ee32[_0x4492('0x31')]=_[_0x4492('0x32')](_0x27ee32[_0x4492('0x2e')],_0x27ee32['query']);_0x950231[_0x4492('0x33')]=_[_0x4492('0x32')](_0x27ee32[_0x4492('0x2e')],qs[_0x4492('0x34')](_0x3525dd[_0x4492('0x2f')]['fields']));_0x950231['attributes']=_0x950231['attributes'][_0x4492('0x35')]?_0x950231[_0x4492('0x33')]:_0x27ee32['model'];_0x950231[_0x4492('0x38')]=qs[_0x4492('0x39')](_0x3525dd['query'][_0x4492('0x39')]);_0x950231[_0x4492('0x3c')]=qs[_0x4492('0x31')](_[_0x4492('0x3a')](_0x3525dd[_0x4492('0x2f')],_0x27ee32[_0x4492('0x31')]));if(_0x3525dd['query']['filter']){_0x950231[_0x4492('0x3c')]=_[_0x4492('0x3d')](_0x950231[_0x4492('0x3c')],{'$or':_[_0x4492('0x29')](_0x950231[_0x4492('0x33')],function(_0x152032){var _0x3d41f0={};_0x3d41f0[_0x152032]={'$like':'%'+_0x3525dd[_0x4492('0x2f')][_0x4492('0x3b')]+'%'};return _0x3d41f0;})});}_0x950231=_[_0x4492('0x3d')]({},_0x950231,_0x3525dd[_0x4492('0x3f')]);return _0x11907a[_0x4492('0x4e')](_0x950231);}})['then'](function(_0x5de840){if(_0x5de840){_0x2bb22e=_0x5de840[_0x4492('0x35')];if(!_0x3525dd[_0x4492('0x2f')][_0x4492('0x36')](_0x4492('0x37'))){_0x950231[_0x4492('0x1b')]=qs[_0x4492('0x1b')](_0x3525dd['query']['limit']);_0x950231[_0x4492('0x1d')]=qs[_0x4492('0x1d')](_0x3525dd['query'][_0x4492('0x1d')]);}return _0x11907a[_0x4492('0x4e')](_0x950231);}})[_0x4492('0x23')](function(_0x15af42){if(_0x15af42){return _0x15af42?{'count':_0x2bb22e,'rows':_0x15af42}:null;}})['then'](respondWithResult(_0x1821b5,null))[_0x4492('0x43')](handleError(_0x1821b5,null));};exports[_0x4492('0x4f')]=function(_0x3b9ad4,_0x2974f5,_0x4c58b9){return db[_0x4492('0x50')]['find']({'where':{'id':_0x3b9ad4[_0x4492('0x48')]['id']}})[_0x4492('0x23')](handleEntityNotFound(_0x2974f5,null))[_0x4492('0x23')](function(_0x3dcb74){if(_0x3dcb74){return _0x3dcb74['addActions'](_0x3b9ad4[_0x4492('0x47')][_0x4492('0x4a')],_['omit'](_0x3b9ad4[_0x4492('0x47')],[_0x4492('0x4a'),'id'])||{});}})[_0x4492('0x23')](respondWithResult(_0x2974f5,null))[_0x4492('0x43')](handleError(_0x2974f5,null));};exports[_0x4492('0x51')]=function(_0xe58b1a,_0x136e26,_0x58b5db){var _0x1362cd={};var _0x2e893e={};var _0x1279e9;var _0xf26182;return db[_0x4492('0x2a')]['findOne']({'where':{'id':_0xe58b1a[_0x4492('0x48')]['id']}})[_0x4492('0x23')](handleEntityNotFound(_0x136e26,null))[_0x4492('0x23')](function(_0x4d6d45){if(_0x4d6d45){_0x1279e9=_0x4d6d45;_0x2e893e[_0x4492('0x2e')]=_['keys'](db['Action'][_0x4492('0x2b')]);_0x2e893e['query']=_['keys'](_0xe58b1a[_0x4492('0x2f')]);_0x2e893e[_0x4492('0x31')]=_[_0x4492('0x32')](_0x2e893e[_0x4492('0x2e')],_0x2e893e[_0x4492('0x2f')]);_0x1362cd[_0x4492('0x33')]=_[_0x4492('0x32')](_0x2e893e['model'],qs[_0x4492('0x34')](_0xe58b1a['query']['fields']));_0x1362cd['attributes']=_0x1362cd[_0x4492('0x33')][_0x4492('0x35')]?_0x1362cd[_0x4492('0x33')]:_0x2e893e[_0x4492('0x2e')];_0x1362cd['order']=qs[_0x4492('0x39')](_0xe58b1a[_0x4492('0x2f')]['sort']);_0x1362cd['where']=qs[_0x4492('0x31')](_['pick'](_0xe58b1a[_0x4492('0x2f')],_0x2e893e[_0x4492('0x31')]));if(_0xe58b1a[_0x4492('0x2f')][_0x4492('0x3b')]){_0x1362cd['where']=_['merge'](_0x1362cd['where'],{'$or':_['map'](_0x1362cd[_0x4492('0x33')],function(_0x524c4a){var _0x3e31ca={};_0x3e31ca[_0x524c4a]={'$like':'%'+_0xe58b1a[_0x4492('0x2f')][_0x4492('0x3b')]+'%'};return _0x3e31ca;})});}_0x1362cd=_[_0x4492('0x3d')]({},_0x1362cd,_0xe58b1a['options']);return _0x1279e9[_0x4492('0x51')](_0x1362cd);}})[_0x4492('0x23')](function(_0x334b52){if(_0x334b52){_0xf26182=_0x334b52['length'];if(!_0xe58b1a['query'][_0x4492('0x36')](_0x4492('0x37'))){_0x1362cd['limit']=qs[_0x4492('0x1b')](_0xe58b1a['query'][_0x4492('0x1b')]);_0x1362cd[_0x4492('0x1d')]=qs['offset'](_0xe58b1a[_0x4492('0x2f')]['offset']);}return _0x1279e9['getActions'](_0x1362cd);}})[_0x4492('0x23')](function(_0x14b40a){if(_0x14b40a){return _0x14b40a?{'count':_0xf26182,'rows':_0x14b40a}:null;}})[_0x4492('0x23')](respondWithResult(_0x136e26,null))['catch'](handleError(_0x136e26,null));}; \ No newline at end of file +var _0xcbc8=['query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','addConditions','Condition','ids','omit','findOne','pick','getConditions','Action','addActions','getActions','order','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','key'];(function(_0x177db9,_0x39d4e0){var _0x1ffd6d=function(_0x55910c){while(--_0x55910c){_0x177db9['push'](_0x177db9['shift']());}};_0x1ffd6d(++_0x39d4e0);}(_0xcbc8,0x1bd));var _0x8cbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcbc8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8cbc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8cbc('0x1'));var rp=require(_0x8cbc('0x2'));var moment=require('moment');var BPromise=require(_0x8cbc('0x3'));var Mustache=require(_0x8cbc('0x4'));var util=require(_0x8cbc('0x5'));var path=require(_0x8cbc('0x6'));var sox=require(_0x8cbc('0x7'));var csv=require(_0x8cbc('0x8'));var ejs=require(_0x8cbc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8cbc('0xa'));var squel=require(_0x8cbc('0xb'));var crypto=require(_0x8cbc('0xc'));var jsforce=require(_0x8cbc('0xd'));var deskjs=require(_0x8cbc('0xe'));var toCsv=require(_0x8cbc('0x8'));var querystring=require(_0x8cbc('0xf'));var Papa=require('papaparse');var Redis=require(_0x8cbc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8cbc('0x11'));var as=require(_0x8cbc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8cbc('0x13'))(_0x8cbc('0x14'));var utils=require(_0x8cbc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8cbc('0x16'));var db=require(_0x8cbc('0x17'))['db'];function respondWithStatusCode(_0x1a0dc0,_0x384118){_0x384118=_0x384118||0xcc;return function(_0x2f91b6){if(_0x2f91b6){return _0x1a0dc0['sendStatus'](_0x384118);}return _0x1a0dc0['status'](_0x384118)[_0x8cbc('0x18')]();};}function respondWithResult(_0x36eb9a,_0x159a39){_0x159a39=_0x159a39||0xc8;return function(_0x2a0a90){if(_0x2a0a90){return _0x36eb9a[_0x8cbc('0x19')](_0x159a39)[_0x8cbc('0x1a')](_0x2a0a90);}};}function respondWithFilteredResult(_0x7d0c37,_0x43388f){return function(_0x3c2c14){if(_0x3c2c14){var _0x807c5e=typeof _0x43388f[_0x8cbc('0x1b')]===_0x8cbc('0x1c')&&typeof _0x43388f[_0x8cbc('0x1d')]===_0x8cbc('0x1c');var _0x2b6979=_0x3c2c14['count'];var _0x3b3176=_0x807c5e?0x0:_0x43388f[_0x8cbc('0x1b')];var _0x4a577d=_0x807c5e?_0x3c2c14[_0x8cbc('0x1e')]:_0x43388f[_0x8cbc('0x1b')]+_0x43388f[_0x8cbc('0x1d')];var _0x3ca5db;if(_0x4a577d>=_0x2b6979){_0x4a577d=_0x2b6979;_0x3ca5db=0xc8;}else{_0x3ca5db=0xce;}_0x7d0c37[_0x8cbc('0x19')](_0x3ca5db);return _0x7d0c37['set']('Content-Range',_0x3b3176+'-'+_0x4a577d+'/'+_0x2b6979)[_0x8cbc('0x1a')](_0x3c2c14);}return null;};}function patchUpdates(_0x18d1e3){return function(_0x3ea5e9){try{jsonpatch['apply'](_0x3ea5e9,_0x18d1e3,!![]);}catch(_0x4a91d9){return BPromise[_0x8cbc('0x1f')](_0x4a91d9);}return _0x3ea5e9[_0x8cbc('0x20')]();};}function saveUpdates(_0xa02610,_0xcbf8bb){return function(_0x26415f){if(_0x26415f){return _0x26415f[_0x8cbc('0x21')](_0xa02610)[_0x8cbc('0x22')](function(_0x4071fb){return _0x4071fb;});}return null;};}function removeEntity(_0x27b94c,_0x267856){return function(_0xa70eb7){if(_0xa70eb7){return _0xa70eb7[_0x8cbc('0x23')]()[_0x8cbc('0x22')](function(){_0x27b94c[_0x8cbc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b4c4b,_0x2b7a51){return function(_0x56b4ab){if(!_0x56b4ab){_0x4b4c4b[_0x8cbc('0x24')](0x194);}return _0x56b4ab;};}function handleError(_0xae45d6,_0x2e7388){_0x2e7388=_0x2e7388||0x1f4;return function(_0x1a599d){logger[_0x8cbc('0x25')](_0x1a599d[_0x8cbc('0x26')]);if(_0x1a599d['name']){delete _0x1a599d[_0x8cbc('0x27')];}_0xae45d6[_0x8cbc('0x19')](_0x2e7388)[_0x8cbc('0x28')](_0x1a599d);};}exports[_0x8cbc('0x29')]=function(_0x202ddb,_0x2c9eee){var _0x505933={},_0x38a015={},_0x131e76={'count':0x0,'rows':[]};var _0x1a8d3e=_[_0x8cbc('0x2a')](db[_0x8cbc('0x2b')][_0x8cbc('0x2c')],function(_0x2272c5){return{'name':_0x2272c5[_0x8cbc('0x2d')],'type':_0x2272c5['type'][_0x8cbc('0x2e')]};});_0x38a015['model']=_[_0x8cbc('0x2a')](_0x1a8d3e,_0x8cbc('0x27'));_0x38a015[_0x8cbc('0x2f')]=_[_0x8cbc('0x30')](_0x202ddb[_0x8cbc('0x2f')]);_0x38a015['filters']=_[_0x8cbc('0x31')](_0x38a015[_0x8cbc('0x32')],_0x38a015[_0x8cbc('0x2f')]);_0x505933[_0x8cbc('0x33')]=_['intersection'](_0x38a015[_0x8cbc('0x32')],qs[_0x8cbc('0x34')](_0x202ddb[_0x8cbc('0x2f')]['fields']));_0x505933[_0x8cbc('0x33')]=_0x505933['attributes'][_0x8cbc('0x35')]?_0x505933['attributes']:_0x38a015[_0x8cbc('0x32')];if(!_0x202ddb[_0x8cbc('0x2f')]['hasOwnProperty'](_0x8cbc('0x36'))){_0x505933['limit']=qs[_0x8cbc('0x1d')](_0x202ddb[_0x8cbc('0x2f')][_0x8cbc('0x1d')]);_0x505933[_0x8cbc('0x1b')]=qs[_0x8cbc('0x1b')](_0x202ddb[_0x8cbc('0x2f')]['offset']);}_0x505933['order']=qs[_0x8cbc('0x37')](_0x202ddb['query'][_0x8cbc('0x37')]);_0x505933[_0x8cbc('0x38')]=qs['filters'](_['pick'](_0x202ddb['query'],_0x38a015[_0x8cbc('0x39')]),_0x1a8d3e);if(_0x202ddb['query'][_0x8cbc('0x3a')]){_0x505933[_0x8cbc('0x38')]=_[_0x8cbc('0x3b')](_0x505933[_0x8cbc('0x38')],{'$or':_['map'](_0x1a8d3e,function(_0x15e523){if(_0x15e523[_0x8cbc('0x3c')]!==_0x8cbc('0x3d')){var _0x5c52f8={};_0x5c52f8[_0x15e523[_0x8cbc('0x27')]]={'$like':'%'+_0x202ddb['query']['filter']+'%'};return _0x5c52f8;}})});}_0x505933=_['merge']({},_0x505933,_0x202ddb[_0x8cbc('0x3e')]);var _0xabf2f2={'where':_0x505933[_0x8cbc('0x38')]};return db[_0x8cbc('0x2b')][_0x8cbc('0x1e')](_0xabf2f2)['then'](function(_0x9a9261){_0x131e76['count']=_0x9a9261;if(_0x202ddb[_0x8cbc('0x2f')][_0x8cbc('0x3f')]){_0x505933[_0x8cbc('0x40')]=[{'all':!![]}];}return db[_0x8cbc('0x2b')][_0x8cbc('0x41')](_0x505933);})[_0x8cbc('0x22')](function(_0x13c849){_0x131e76['rows']=_0x13c849;return _0x131e76;})[_0x8cbc('0x22')](respondWithFilteredResult(_0x2c9eee,_0x505933))[_0x8cbc('0x42')](handleError(_0x2c9eee,null));};exports['show']=function(_0x2662f9,_0x2d6e15){var _0x18caeb={'raw':![],'where':{'id':_0x2662f9[_0x8cbc('0x43')]['id']}},_0x4038f5={};_0x4038f5[_0x8cbc('0x32')]=_[_0x8cbc('0x30')](db[_0x8cbc('0x2b')][_0x8cbc('0x2c')]);_0x4038f5['query']=_[_0x8cbc('0x30')](_0x2662f9[_0x8cbc('0x2f')]);_0x4038f5[_0x8cbc('0x39')]=_[_0x8cbc('0x31')](_0x4038f5['model'],_0x4038f5[_0x8cbc('0x2f')]);_0x18caeb[_0x8cbc('0x33')]=_[_0x8cbc('0x31')](_0x4038f5[_0x8cbc('0x32')],qs[_0x8cbc('0x34')](_0x2662f9[_0x8cbc('0x2f')][_0x8cbc('0x34')]));_0x18caeb[_0x8cbc('0x33')]=_0x18caeb['attributes'][_0x8cbc('0x35')]?_0x18caeb[_0x8cbc('0x33')]:_0x4038f5['model'];if(_0x2662f9[_0x8cbc('0x2f')][_0x8cbc('0x3f')]){_0x18caeb[_0x8cbc('0x40')]=[{'all':!![]}];}_0x18caeb=_[_0x8cbc('0x3b')]({},_0x18caeb,_0x2662f9[_0x8cbc('0x3e')]);return db[_0x8cbc('0x2b')][_0x8cbc('0x44')](_0x18caeb)['then'](handleEntityNotFound(_0x2d6e15,null))[_0x8cbc('0x22')](respondWithResult(_0x2d6e15,null))[_0x8cbc('0x42')](handleError(_0x2d6e15,null));};exports[_0x8cbc('0x45')]=function(_0xf7005c,_0x177542){return db[_0x8cbc('0x2b')][_0x8cbc('0x45')](_0xf7005c[_0x8cbc('0x46')],{})['then'](respondWithResult(_0x177542,0xc9))[_0x8cbc('0x42')](handleError(_0x177542,null));};exports[_0x8cbc('0x21')]=function(_0x565a0d,_0x3cee09){if(_0x565a0d[_0x8cbc('0x46')]['id']){delete _0x565a0d[_0x8cbc('0x46')]['id'];}return db['Automation']['find']({'where':{'id':_0x565a0d[_0x8cbc('0x43')]['id']}})[_0x8cbc('0x22')](handleEntityNotFound(_0x3cee09,null))[_0x8cbc('0x22')](saveUpdates(_0x565a0d[_0x8cbc('0x46')],null))[_0x8cbc('0x22')](respondWithResult(_0x3cee09,null))[_0x8cbc('0x42')](handleError(_0x3cee09,null));};exports[_0x8cbc('0x23')]=function(_0x22c524,_0x24d925){return db[_0x8cbc('0x2b')][_0x8cbc('0x44')]({'where':{'id':_0x22c524[_0x8cbc('0x43')]['id']}})['then'](handleEntityNotFound(_0x24d925,null))['then'](removeEntity(_0x24d925,null))[_0x8cbc('0x42')](handleError(_0x24d925,null));};exports[_0x8cbc('0x47')]=function(_0x2fc2fc,_0x50a74f,_0x5272c5){return db[_0x8cbc('0x48')][_0x8cbc('0x44')]({'where':{'id':_0x2fc2fc[_0x8cbc('0x43')]['id']}})['then'](handleEntityNotFound(_0x50a74f,null))[_0x8cbc('0x22')](function(_0x2436e7){if(_0x2436e7){return _0x2436e7[_0x8cbc('0x47')](_0x2fc2fc[_0x8cbc('0x46')][_0x8cbc('0x49')],_[_0x8cbc('0x4a')](_0x2fc2fc[_0x8cbc('0x46')],[_0x8cbc('0x49'),'id'])||{});}})[_0x8cbc('0x22')](respondWithResult(_0x50a74f,null))[_0x8cbc('0x42')](handleError(_0x50a74f,null));};exports['getConditions']=function(_0x584ee9,_0x1c2121,_0x2f7795){var _0xd5984f={};var _0x7289ed={};var _0x1bba62;var _0x163c65;return db[_0x8cbc('0x2b')][_0x8cbc('0x4b')]({'where':{'id':_0x584ee9[_0x8cbc('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c2121,null))[_0x8cbc('0x22')](function(_0x419d22){if(_0x419d22){_0x1bba62=_0x419d22;_0x7289ed['model']=_['keys'](db[_0x8cbc('0x48')][_0x8cbc('0x2c')]);_0x7289ed[_0x8cbc('0x2f')]=_['keys'](_0x584ee9[_0x8cbc('0x2f')]);_0x7289ed[_0x8cbc('0x39')]=_[_0x8cbc('0x31')](_0x7289ed['model'],_0x7289ed['query']);_0xd5984f[_0x8cbc('0x33')]=_[_0x8cbc('0x31')](_0x7289ed[_0x8cbc('0x32')],qs[_0x8cbc('0x34')](_0x584ee9[_0x8cbc('0x2f')][_0x8cbc('0x34')]));_0xd5984f[_0x8cbc('0x33')]=_0xd5984f[_0x8cbc('0x33')][_0x8cbc('0x35')]?_0xd5984f[_0x8cbc('0x33')]:_0x7289ed[_0x8cbc('0x32')];_0xd5984f['order']=qs[_0x8cbc('0x37')](_0x584ee9['query'][_0x8cbc('0x37')]);_0xd5984f[_0x8cbc('0x38')]=qs[_0x8cbc('0x39')](_[_0x8cbc('0x4c')](_0x584ee9[_0x8cbc('0x2f')],_0x7289ed[_0x8cbc('0x39')]));if(_0x584ee9['query'][_0x8cbc('0x3a')]){_0xd5984f[_0x8cbc('0x38')]=_[_0x8cbc('0x3b')](_0xd5984f[_0x8cbc('0x38')],{'$or':_[_0x8cbc('0x2a')](_0xd5984f[_0x8cbc('0x33')],function(_0x4a5eeb){var _0xd62dce={};_0xd62dce[_0x4a5eeb]={'$like':'%'+_0x584ee9['query'][_0x8cbc('0x3a')]+'%'};return _0xd62dce;})});}_0xd5984f=_['merge']({},_0xd5984f,_0x584ee9[_0x8cbc('0x3e')]);return _0x1bba62[_0x8cbc('0x4d')](_0xd5984f);}})[_0x8cbc('0x22')](function(_0x581afa){if(_0x581afa){_0x163c65=_0x581afa[_0x8cbc('0x35')];if(!_0x584ee9[_0x8cbc('0x2f')]['hasOwnProperty'](_0x8cbc('0x36'))){_0xd5984f[_0x8cbc('0x1d')]=qs[_0x8cbc('0x1d')](_0x584ee9['query'][_0x8cbc('0x1d')]);_0xd5984f['offset']=qs['offset'](_0x584ee9[_0x8cbc('0x2f')][_0x8cbc('0x1b')]);}return _0x1bba62['getConditions'](_0xd5984f);}})[_0x8cbc('0x22')](function(_0x31ad0e){if(_0x31ad0e){return _0x31ad0e?{'count':_0x163c65,'rows':_0x31ad0e}:null;}})['then'](respondWithResult(_0x1c2121,null))[_0x8cbc('0x42')](handleError(_0x1c2121,null));};exports['addActions']=function(_0x25714e,_0x49704e,_0x3dd9c1){return db[_0x8cbc('0x4e')][_0x8cbc('0x44')]({'where':{'id':_0x25714e[_0x8cbc('0x43')]['id']}})[_0x8cbc('0x22')](handleEntityNotFound(_0x49704e,null))[_0x8cbc('0x22')](function(_0x4c397b){if(_0x4c397b){return _0x4c397b[_0x8cbc('0x4f')](_0x25714e[_0x8cbc('0x46')][_0x8cbc('0x49')],_[_0x8cbc('0x4a')](_0x25714e['body'],[_0x8cbc('0x49'),'id'])||{});}})[_0x8cbc('0x22')](respondWithResult(_0x49704e,null))[_0x8cbc('0x42')](handleError(_0x49704e,null));};exports[_0x8cbc('0x50')]=function(_0x14715e,_0x2ee926,_0x16fab6){var _0x1a2ec7={};var _0x11fa40={};var _0x2c5bd5;var _0x4d6048;return db['Automation'][_0x8cbc('0x4b')]({'where':{'id':_0x14715e['params']['id']}})[_0x8cbc('0x22')](handleEntityNotFound(_0x2ee926,null))[_0x8cbc('0x22')](function(_0x5c86c3){if(_0x5c86c3){_0x2c5bd5=_0x5c86c3;_0x11fa40[_0x8cbc('0x32')]=_[_0x8cbc('0x30')](db[_0x8cbc('0x4e')]['rawAttributes']);_0x11fa40[_0x8cbc('0x2f')]=_[_0x8cbc('0x30')](_0x14715e[_0x8cbc('0x2f')]);_0x11fa40[_0x8cbc('0x39')]=_[_0x8cbc('0x31')](_0x11fa40[_0x8cbc('0x32')],_0x11fa40[_0x8cbc('0x2f')]);_0x1a2ec7[_0x8cbc('0x33')]=_['intersection'](_0x11fa40[_0x8cbc('0x32')],qs[_0x8cbc('0x34')](_0x14715e[_0x8cbc('0x2f')][_0x8cbc('0x34')]));_0x1a2ec7['attributes']=_0x1a2ec7[_0x8cbc('0x33')][_0x8cbc('0x35')]?_0x1a2ec7[_0x8cbc('0x33')]:_0x11fa40['model'];_0x1a2ec7[_0x8cbc('0x51')]=qs['sort'](_0x14715e[_0x8cbc('0x2f')][_0x8cbc('0x37')]);_0x1a2ec7[_0x8cbc('0x38')]=qs[_0x8cbc('0x39')](_[_0x8cbc('0x4c')](_0x14715e[_0x8cbc('0x2f')],_0x11fa40['filters']));if(_0x14715e[_0x8cbc('0x2f')]['filter']){_0x1a2ec7[_0x8cbc('0x38')]=_['merge'](_0x1a2ec7['where'],{'$or':_[_0x8cbc('0x2a')](_0x1a2ec7[_0x8cbc('0x33')],function(_0x1a6e97){var _0x58a63b={};_0x58a63b[_0x1a6e97]={'$like':'%'+_0x14715e[_0x8cbc('0x2f')][_0x8cbc('0x3a')]+'%'};return _0x58a63b;})});}_0x1a2ec7=_[_0x8cbc('0x3b')]({},_0x1a2ec7,_0x14715e[_0x8cbc('0x3e')]);return _0x2c5bd5[_0x8cbc('0x50')](_0x1a2ec7);}})['then'](function(_0x957866){if(_0x957866){_0x4d6048=_0x957866[_0x8cbc('0x35')];if(!_0x14715e[_0x8cbc('0x2f')]['hasOwnProperty'](_0x8cbc('0x36'))){_0x1a2ec7[_0x8cbc('0x1d')]=qs[_0x8cbc('0x1d')](_0x14715e[_0x8cbc('0x2f')][_0x8cbc('0x1d')]);_0x1a2ec7[_0x8cbc('0x1b')]=qs[_0x8cbc('0x1b')](_0x14715e['query']['offset']);}return _0x2c5bd5[_0x8cbc('0x50')](_0x1a2ec7);}})[_0x8cbc('0x22')](function(_0x16e2db){if(_0x16e2db){return _0x16e2db?{'count':_0x4d6048,'rows':_0x16e2db}:null;}})[_0x8cbc('0x22')](respondWithResult(_0x2ee926,null))[_0x8cbc('0x42')](handleError(_0x2ee926,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 824eaa0..bb01d91 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 _0x15ae=['bluebird','request-promise','path','../../config/environment','./automation.attributes','exports','lodash','util','../../config/logger','moment'];(function(_0x43be,_0x18cf34){var _0x4c41b2=function(_0x26bc4d){while(--_0x26bc4d){_0x43be['push'](_0x43be['shift']());}};_0x4c41b2(++_0x18cf34);}(_0x15ae,0xc4));var _0xe15a=function(_0x239b41,_0x4047e9){_0x239b41=_0x239b41-0x0;var _0x1067a7=_0x15ae[_0x239b41];return _0x1067a7;};'use strict';var _=require(_0xe15a('0x0'));var util=require(_0xe15a('0x1'));var logger=require(_0xe15a('0x2'))('api');var moment=require(_0xe15a('0x3'));var BPromise=require(_0xe15a('0x4'));var rp=require(_0xe15a('0x5'));var fs=require('fs');var path=require(_0xe15a('0x6'));var rimraf=require('rimraf');var config=require(_0xe15a('0x7'));var attributes=require(_0xe15a('0x8'));module[_0xe15a('0x9')]=function(_0x2d4e6b,_0x501266){return _0x2d4e6b['define']('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde61=['path','rimraf','./automation.attributes','define','tools_automations','api','moment','bluebird','request-promise'];(function(_0x2c81be,_0x3d5b72){var _0x5028ee=function(_0x197950){while(--_0x197950){_0x2c81be['push'](_0x2c81be['shift']());}};_0x5028ee(++_0x3d5b72);}(_0xde61,0x16d));var _0x1de6=function(_0x19b1dd,_0x3600f9){_0x19b1dd=_0x19b1dd-0x0;var _0x257877=_0xde61[_0x19b1dd];return _0x257877;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1de6('0x0'));var moment=require(_0x1de6('0x1'));var BPromise=require(_0x1de6('0x2'));var rp=require(_0x1de6('0x3'));var fs=require('fs');var path=require(_0x1de6('0x4'));var rimraf=require(_0x1de6('0x5'));var config=require('../../config/environment');var attributes=require(_0x1de6('0x6'));module['exports']=function(_0x2173d6,_0x2eb1ca){return _0x2173d6[_0x1de6('0x7')]('Automation',attributes,{'tableName':_0x1de6('0x8'),'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 ecaff50..9683b8b 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 _0x160f=['http','then','info','Automation,\x20%s,\x20%s','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49fe49,_0x59440e,_0x41e909){return new BPromise(function(_0x5b76c8,_0x4bf890){return client['request'](_0x49fe49,_0x41e909)[_0xf160('0xc')](function(_0x90608){logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,'request\x20sent');logger['debug'](_0xf160('0xf'),_0x59440e,_0xf160('0x10'),JSON[_0xf160('0x11')](_0x90608));if(_0x90608['error']){if(_0x90608[_0xf160('0x12')][_0xf160('0x13')]===0x1f4){logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')]['message']);return _0x4bf890(_0x90608[_0xf160('0x12')]['message']);}logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')][_0xf160('0x14')]);return _0x5b76c8(_0x90608[_0xf160('0x12')][_0xf160('0x14')]);}else{logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,_0xf160('0x10'));_0x5b76c8(_0x90608['result'][_0xf160('0x14')]);}})[_0xf160('0x15')](function(_0x8699a0){logger[_0xf160('0x12')]('Automation,\x20%s,\x20%s',_0x59440e,_0x8699a0);_0x4bf890(_0x8699a0);});});} \ No newline at end of file +var _0xd4a2=['request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','lodash','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x31acb8,_0x536729){var _0x40213b=function(_0x2e9b7a){while(--_0x2e9b7a){_0x31acb8['push'](_0x31acb8['shift']());}};_0x40213b(++_0x536729);}(_0xd4a2,0x173));var _0x2d4a=function(_0x5244e9,_0x4ce4da){_0x5244e9=_0x5244e9-0x0;var _0x311da4=_0xd4a2[_0x5244e9];return _0x311da4;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2d4a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d4a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d4a('0x3'));var logger=require('../../config/logger')(_0x2d4a('0x4'));var config=require(_0x2d4a('0x5'));var jayson=require(_0x2d4a('0x6'));var client=jayson[_0x2d4a('0x7')][_0x2d4a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57058f,_0x45fefb,_0x41b161){return new BPromise(function(_0x1f237e,_0x29597e){return client[_0x2d4a('0x9')](_0x57058f,_0x41b161)[_0x2d4a('0xa')](function(_0xb9f016){logger[_0x2d4a('0xb')](_0x2d4a('0xc'),_0x45fefb,_0x2d4a('0xd'));logger[_0x2d4a('0xe')](_0x2d4a('0xf'),_0x45fefb,'request\x20sent',JSON['stringify'](_0xb9f016));if(_0xb9f016[_0x2d4a('0x10')]){if(_0xb9f016['error'][_0x2d4a('0x11')]===0x1f4){logger[_0x2d4a('0x10')](_0x2d4a('0xc'),_0x45fefb,_0xb9f016[_0x2d4a('0x10')][_0x2d4a('0x12')]);return _0x29597e(_0xb9f016[_0x2d4a('0x10')][_0x2d4a('0x12')]);}logger[_0x2d4a('0x10')]('Automation,\x20%s,\x20%s',_0x45fefb,_0xb9f016['error'][_0x2d4a('0x12')]);return _0x1f237e(_0xb9f016['error'][_0x2d4a('0x12')]);}else{logger[_0x2d4a('0xb')](_0x2d4a('0xc'),_0x45fefb,_0x2d4a('0xd'));_0x1f237e(_0xb9f016['result'][_0x2d4a('0x12')]);}})['catch'](function(_0x2838fa){logger['error'](_0x2d4a('0xc'),_0x45fefb,_0x2838fa);_0x29597e(_0x2838fa);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 1368149..890ead1 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 _0x3c7b=['/:id','show','/:id/actions','getActions','create','/:id/conditions','addConditions','post','addActions','delete','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','./automation.controller','isAuthenticated','get'];(function(_0xdcd0de,_0x1e9de5){var _0x2625c1=function(_0x2b7550){while(--_0x2b7550){_0xdcd0de['push'](_0xdcd0de['shift']());}};_0x2625c1(++_0x1e9de5);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x59e81c,_0x24e65b){_0x59e81c=_0x59e81c-0x0;var _0x28b917=_0x3c7b[_0x59e81c];return _0x28b917;};'use strict';var multer=require(_0xb3c7('0x0'));var util=require(_0xb3c7('0x1'));var path=require(_0xb3c7('0x2'));var timeout=require(_0xb3c7('0x3'));var express=require(_0xb3c7('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(_0xb3c7('0x5'));var controller=require(_0xb3c7('0x6'));router['get']('/',auth[_0xb3c7('0x7')](),controller['index']);router[_0xb3c7('0x8')](_0xb3c7('0x9'),auth[_0xb3c7('0x7')](),controller[_0xb3c7('0xa')]);router[_0xb3c7('0x8')]('/:id/conditions',auth[_0xb3c7('0x7')](),controller['getConditions']);router[_0xb3c7('0x8')](_0xb3c7('0xb'),auth[_0xb3c7('0x7')](),controller[_0xb3c7('0xc')]);router['post']('/',auth[_0xb3c7('0x7')](),controller[_0xb3c7('0xd')]);router['post'](_0xb3c7('0xe'),auth[_0xb3c7('0x7')](),controller[_0xb3c7('0xf')]);router[_0xb3c7('0x10')](_0xb3c7('0xb'),auth[_0xb3c7('0x7')](),controller[_0xb3c7('0x11')]);router['put'](_0xb3c7('0x9'),auth[_0xb3c7('0x7')](),controller['update']);router[_0xb3c7('0x12')](_0xb3c7('0x9'),auth[_0xb3c7('0x7')](),controller[_0xb3c7('0x13')]);module[_0xb3c7('0x14')]=router; \ No newline at end of file +var _0x894f=['getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','./automation.controller','get','/:id','show','/:id/conditions','isAuthenticated'];(function(_0x4def83,_0x5277f9){var _0xa4c6bf=function(_0x490614){while(--_0x490614){_0x4def83['push'](_0x4def83['shift']());}};_0xa4c6bf(++_0x5277f9);}(_0x894f,0x14d));var _0xf894=function(_0x4374e7,_0xf6250d){_0x4374e7=_0x4374e7-0x0;var _0x1511e4=_0x894f[_0x4374e7];return _0x1511e4;};'use strict';var multer=require(_0xf894('0x0'));var util=require(_0xf894('0x1'));var path=require(_0xf894('0x2'));var timeout=require(_0xf894('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf894('0x4'));var auth=require(_0xf894('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf894('0x6'));router[_0xf894('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf894('0x7')](_0xf894('0x8'),auth['isAuthenticated'](),controller[_0xf894('0x9')]);router[_0xf894('0x7')](_0xf894('0xa'),auth[_0xf894('0xb')](),controller[_0xf894('0xc')]);router[_0xf894('0x7')](_0xf894('0xd'),auth[_0xf894('0xb')](),controller[_0xf894('0xe')]);router[_0xf894('0xf')]('/',auth[_0xf894('0xb')](),controller[_0xf894('0x10')]);router[_0xf894('0xf')](_0xf894('0xa'),auth[_0xf894('0xb')](),controller[_0xf894('0x11')]);router[_0xf894('0xf')](_0xf894('0xd'),auth[_0xf894('0xb')](),controller[_0xf894('0x12')]);router[_0xf894('0x13')](_0xf894('0x8'),auth['isAuthenticated'](),controller[_0xf894('0x14')]);router['delete']('/:id',auth[_0xf894('0xb')](),controller[_0xf894('0x15')]);module[_0xf894('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 6eaeb1b..4646374 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 _0xb44f=['#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','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)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'];(function(_0x146a85,_0x529b52){var _0x1b59bf=function(_0x4af0fd){while(--_0x4af0fd){_0x146a85['push'](_0x146a85['shift']());}};_0x1b59bf(++_0x529b52);}(_0xb44f,0x165));var _0xfb44=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xb44f[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0xfb44('0x0'));module[_0xfb44('0x1')]={'name':{'type':Sequelize[_0xfb44('0x2')],'unique':_0xfb44('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xfb44('0x4')](_0xfb44('0x5')),'allowNull':![],'defaultValue':_0xfb44('0x5')},'description':{'type':Sequelize[_0xfb44('0x2')]},'active':{'type':Sequelize[_0xfb44('0x6')],'defaultValue':0x0,'comment':_0xfb44('0x7')},'limitCalls':{'type':Sequelize[_0xfb44('0x8')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xfb44('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xfb44('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xfb44('0x8')](0x3)[_0xfb44('0xa')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfb44('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0xfb44('0x8')](0x3)[_0xfb44('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfb44('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xfb44('0x8')](0x5)[_0xfb44('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfb44('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0xfb44('0x8')](0x3)[_0xfb44('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xfb44('0x8')](0x5)[_0xfb44('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfb44('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xfb44('0x8')](0x3)[_0xfb44('0xa')],'defaultValue':0x3,'comment':_0xfb44('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xfb44('0x8')](0x5)[_0xfb44('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfb44('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0xfb44('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xfb44('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xfb44('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0xfb44('0x4')]('always',_0xfb44('0x12'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xfb44('0x6')],'defaultValue':0x0,'comment':_0xfb44('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xfb44('0xa')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xfb44('0x8')](0x9)[_0xfb44('0xa')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfb44('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xfb44('0x8')](0x9)[_0xfb44('0xa')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xfb44('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xfb44('0x8')](0x9)[_0xfb44('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfb44('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xfb44('0x8')](0x9)[_0xfb44('0xa')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xfb44('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfb44('0x8')](0x9)[_0xfb44('0xa')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xfb44('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfb44('0x8')](0x9)[_0xfb44('0xa')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xfb44('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xfb44('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xfb44('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfb44('0x8')](0x9)[_0xfb44('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfb44('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0xfb44('0x4')](_0xfb44('0x1c'),_0xfb44('0x1d')),'defaultValue':_0xfb44('0x1c')},'dialPrefix':{'type':Sequelize[_0xfb44('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xfb44('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfb44('0x1e')},'dialCutDigit':{'type':Sequelize[_0xfb44('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfb44('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfb44('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xfb44('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xfb44('0x8')](0x3)[_0xfb44('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfb44('0x21')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfb44('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xfb44('0x8')](0x3)[_0xfb44('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfb44('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xfb44('0x8')](0x3)[_0xfb44('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfb44('0x24')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfb44('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xfb44('0x8')](0x3)[_0xfb44('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfb44('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xfb44('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfb44('0x26')}}; \ No newline at end of file +var _0x1724=['#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x40aaa4,_0x3b22f4){var _0x4e21e5=function(_0x35d2f3){while(--_0x35d2f3){_0x40aaa4['push'](_0x40aaa4['shift']());}};_0x4e21e5(++_0x3b22f4);}(_0x1724,0xca));var _0x4172=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x1724[_0x3a6efd];return _0x487b9a;};'use strict';var Sequelize=require(_0x4172('0x0'));module['exports']={'name':{'type':Sequelize[_0x4172('0x1')],'unique':_0x4172('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x4172('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x4172('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x4172('0x5')],'defaultValue':0x0,'comment':_0x4172('0x6')},'limitCalls':{'type':Sequelize[_0x4172('0x7')](0x4)[_0x4172('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x4172('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4172('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x4172('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4172('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4172('0x7')](0x3)[_0x4172('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4172('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4172('0x7')](0x5)[_0x4172('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x4172('0x7')](0x3)[_0x4172('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4172('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4172('0x7')](0x5)[_0x4172('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4172('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4172('0x7')](0x3)[_0x4172('0x8')],'defaultValue':0x3,'comment':_0x4172('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4172('0x7')](0x5)[_0x4172('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4172('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4172('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x4172('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4172('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x4172('0x3')](_0x4172('0x10'),_0x4172('0x11'),_0x4172('0x12')),'defaultValue':_0x4172('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4172('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x4172('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4172('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x4172('0x7')](0x9)[_0x4172('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4172('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4172('0x7')](0x9)[_0x4172('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4172('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x4172('0x7')](0x9)[_0x4172('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4172('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4172('0x7')](0x9)[_0x4172('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x4172('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4172('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4172('0x7')](0x9)[_0x4172('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4172('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4172('0x3')](_0x4172('0x19'),_0x4172('0x1a')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x4172('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4172('0x7')](0x3)[_0x4172('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x4172('0x7')](0x3)[_0x4172('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4172('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4172('0x7')](0x3)[_0x4172('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4172('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4172('0x7')](0x5)[_0x4172('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4172('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x4172('0x7')](0x3)[_0x4172('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4172('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x4172('0x7')](0x5)[_0x4172('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4172('0x7')](0x3)[_0x4172('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4172('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4172('0x7')](0x5)[_0x4172('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4172('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x4172('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4172('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4172('0x7')](0x5)[_0x4172('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4172('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4172('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4172('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4172('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 33c16ca..b96ad99 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 _0x2fe3=['bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','save','update','then','IvrCampaigns','UserProfileResource','destroy','stack','name','index','map','Campaign','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','merge','options','where','includeAll','findAll','catch','show','params','include','create','body','role','user','get','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','createdAt','updatedAt','omit','autoAssociation','findOne','CmHopper','nolimit','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','pick','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','field','phone','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','cm_contacts','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.OrderBY','cm_contact_has_items','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','request-promise'];(function(_0x34bc33,_0x13cf5a){var _0x5a62b4=function(_0x4fd58d){while(--_0x4fd58d){_0x34bc33['push'](_0x34bc33['shift']());}};_0x5a62b4(++_0x13cf5a);}(_0x2fe3,0x87));var _0x32fe=function(_0x166dd8,_0x436916){_0x166dd8=_0x166dd8-0x0;var _0x446081=_0x2fe3[_0x166dd8];return _0x446081;};'use strict';var emlformat=require(_0x32fe('0x0'));var rimraf=require(_0x32fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x32fe('0x2'));var moment=require('moment');var BPromise=require(_0x32fe('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x32fe('0x4'));var sox=require(_0x32fe('0x5'));var csv=require('to-csv');var ejs=require(_0x32fe('0x6'));var fs=require('fs');var fs_extra=require(_0x32fe('0x7'));var _=require(_0x32fe('0x8'));var squel=require(_0x32fe('0x9'));var crypto=require(_0x32fe('0xa'));var jsforce=require(_0x32fe('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x32fe('0xc'));var querystring=require(_0x32fe('0xd'));var Papa=require(_0x32fe('0xe'));var Redis=require(_0x32fe('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x32fe('0x10'));var hardwareService=require(_0x32fe('0x11'));var logger=require(_0x32fe('0x12'))(_0x32fe('0x13'));var utils=require('../../config/utils');var config=require(_0x32fe('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1679d2,_0x2ef765){_0x2ef765=_0x2ef765||0xcc;return function(_0x1fa3bf){if(_0x1fa3bf){return _0x1679d2[_0x32fe('0x15')](_0x2ef765);}return _0x1679d2[_0x32fe('0x16')](_0x2ef765)[_0x32fe('0x17')]();};}function respondWithResult(_0x3dc281,_0x427edd){_0x427edd=_0x427edd||0xc8;return function(_0xa9ab){if(_0xa9ab){return _0x3dc281[_0x32fe('0x16')](_0x427edd)[_0x32fe('0x18')](_0xa9ab);}};}function respondWithFilteredResult(_0x403d19,_0x31a6c0){return function(_0x625793){if(_0x625793){var _0x175fd1=typeof _0x31a6c0['offset']==='undefined'&&typeof _0x31a6c0[_0x32fe('0x19')]===_0x32fe('0x1a');var _0x5846ca=_0x625793[_0x32fe('0x1b')];var _0x69299f=_0x175fd1?0x0:_0x31a6c0[_0x32fe('0x1c')];var _0x5000ee=_0x175fd1?_0x625793[_0x32fe('0x1b')]:_0x31a6c0[_0x32fe('0x1c')]+_0x31a6c0[_0x32fe('0x19')];var _0x4427a0;if(_0x5000ee>=_0x5846ca){_0x5000ee=_0x5846ca;_0x4427a0=0xc8;}else{_0x4427a0=0xce;}_0x403d19['status'](_0x4427a0);return _0x403d19[_0x32fe('0x1d')]('Content-Range',_0x69299f+'-'+_0x5000ee+'/'+_0x5846ca)[_0x32fe('0x18')](_0x625793);}return null;};}function patchUpdates(_0x2702ad){return function(_0x23b317){try{jsonpatch[_0x32fe('0x1e')](_0x23b317,_0x2702ad,!![]);}catch(_0x5964cc){return BPromise['reject'](_0x5964cc);}return _0x23b317[_0x32fe('0x1f')]();};}function saveUpdates(_0x297212,_0x14ec68){return function(_0xbd0cb){if(_0xbd0cb){return _0xbd0cb[_0x32fe('0x20')](_0x297212)[_0x32fe('0x21')](function(_0x2de8ca){return _0x2de8ca;});}return null;};}function removeEntity(_0x3cb8a5,_0x521262){return function(_0x3a158e){if(_0x3a158e){return _0x3a158e['destroy']()[_0x32fe('0x21')](function(){var _0x362181=_0x3a158e['get']({'plain':!![]});var _0xd88903=_0x32fe('0x22');return db[_0x32fe('0x23')][_0x32fe('0x24')]({'where':{'type':_0xd88903,'resourceId':_0x362181['id']}})['then'](function(){return _0x3a158e;});})['then'](function(){_0x3cb8a5[_0x32fe('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e20ac,_0x8d1f78){return function(_0x59993d){if(!_0x59993d){_0x5e20ac[_0x32fe('0x15')](0x194);}return _0x59993d;};}function handleError(_0x9c9933,_0x1f67c9){_0x1f67c9=_0x1f67c9||0x1f4;return function(_0x382242){logger['error'](_0x382242[_0x32fe('0x25')]);if(_0x382242['name']){delete _0x382242[_0x32fe('0x26')];}_0x9c9933['status'](_0x1f67c9)['send'](_0x382242);};}exports[_0x32fe('0x27')]=function(_0x536044,_0x45d2b1){var _0x552eae={},_0x231b06={},_0x3cea3={'count':0x0,'rows':[]};var _0xce5a46=_[_0x32fe('0x28')](db[_0x32fe('0x29')][_0x32fe('0x2a')],function(_0x3f4aaf){return{'name':_0x3f4aaf[_0x32fe('0x2b')],'type':_0x3f4aaf[_0x32fe('0x2c')]['key']};});_0x231b06[_0x32fe('0x2d')]=_[_0x32fe('0x28')](_0xce5a46,_0x32fe('0x26'));_0x231b06['query']=_[_0x32fe('0x2e')](_0x536044[_0x32fe('0x2f')]);_0x231b06[_0x32fe('0x30')]=_[_0x32fe('0x31')](_0x231b06[_0x32fe('0x2d')],_0x231b06['query']);_0x552eae['attributes']=_[_0x32fe('0x31')](_0x231b06[_0x32fe('0x2d')],qs['fields'](_0x536044[_0x32fe('0x2f')][_0x32fe('0x32')]));_0x552eae[_0x32fe('0x33')]=_0x552eae[_0x32fe('0x33')][_0x32fe('0x34')]?_0x552eae[_0x32fe('0x33')]:_0x231b06['model'];if(!_0x536044[_0x32fe('0x2f')][_0x32fe('0x35')]('nolimit')){_0x552eae[_0x32fe('0x19')]=qs[_0x32fe('0x19')](_0x536044[_0x32fe('0x2f')][_0x32fe('0x19')]);_0x552eae[_0x32fe('0x1c')]=qs[_0x32fe('0x1c')](_0x536044[_0x32fe('0x2f')][_0x32fe('0x1c')]);}_0x552eae[_0x32fe('0x36')]=qs[_0x32fe('0x37')](_0x536044[_0x32fe('0x2f')][_0x32fe('0x37')]);_0x552eae['where']=qs[_0x32fe('0x30')](_['pick'](_0x536044['query'],_0x231b06[_0x32fe('0x30')]),_0xce5a46);if(_0x536044[_0x32fe('0x2f')][_0x32fe('0x38')]){_0x552eae['where']=_[_0x32fe('0x39')](_0x552eae['where'],{'$or':_[_0x32fe('0x28')](_0xce5a46,function(_0x24116c){if(_0x24116c[_0x32fe('0x2c')]!=='VIRTUAL'){var _0x5b033a={};_0x5b033a[_0x24116c[_0x32fe('0x26')]]={'$like':'%'+_0x536044[_0x32fe('0x2f')]['filter']+'%'};return _0x5b033a;}})});}_0x552eae=_['merge']({},_0x552eae,_0x536044[_0x32fe('0x3a')]);var _0x3bb6a0={'where':_0x552eae[_0x32fe('0x3b')]};return db['Campaign'][_0x32fe('0x1b')](_0x3bb6a0)[_0x32fe('0x21')](function(_0x4adcbe){_0x3cea3[_0x32fe('0x1b')]=_0x4adcbe;if(_0x536044['query'][_0x32fe('0x3c')]){_0x552eae['include']=[{'all':!![]}];}return db['Campaign'][_0x32fe('0x3d')](_0x552eae);})['then'](function(_0x5ee4aa){_0x3cea3['rows']=_0x5ee4aa;return _0x3cea3;})[_0x32fe('0x21')](respondWithFilteredResult(_0x45d2b1,_0x552eae))[_0x32fe('0x3e')](handleError(_0x45d2b1,null));};exports[_0x32fe('0x3f')]=function(_0x997c12,_0x1470ff){var _0x1ea10a={'raw':![],'where':{'id':_0x997c12[_0x32fe('0x40')]['id']}},_0xcdc144={};_0xcdc144[_0x32fe('0x2d')]=_[_0x32fe('0x2e')](db[_0x32fe('0x29')][_0x32fe('0x2a')]);_0xcdc144[_0x32fe('0x2f')]=_[_0x32fe('0x2e')](_0x997c12[_0x32fe('0x2f')]);_0xcdc144[_0x32fe('0x30')]=_[_0x32fe('0x31')](_0xcdc144[_0x32fe('0x2d')],_0xcdc144[_0x32fe('0x2f')]);_0x1ea10a[_0x32fe('0x33')]=_[_0x32fe('0x31')](_0xcdc144[_0x32fe('0x2d')],qs['fields'](_0x997c12[_0x32fe('0x2f')][_0x32fe('0x32')]));_0x1ea10a[_0x32fe('0x33')]=_0x1ea10a['attributes'][_0x32fe('0x34')]?_0x1ea10a[_0x32fe('0x33')]:_0xcdc144[_0x32fe('0x2d')];if(_0x997c12[_0x32fe('0x2f')][_0x32fe('0x3c')]){_0x1ea10a[_0x32fe('0x41')]=[{'all':!![]}];}_0x1ea10a=_['merge']({},_0x1ea10a,_0x997c12[_0x32fe('0x3a')]);return db[_0x32fe('0x29')]['find'](_0x1ea10a)[_0x32fe('0x21')](handleEntityNotFound(_0x1470ff,null))[_0x32fe('0x21')](respondWithResult(_0x1470ff,null))[_0x32fe('0x3e')](handleError(_0x1470ff,null));};exports[_0x32fe('0x42')]=function(_0x44ebdb,_0x1f464f){return db[_0x32fe('0x29')][_0x32fe('0x42')](_0x44ebdb[_0x32fe('0x43')],{})[_0x32fe('0x21')](function(_0x575f33){var _0x844907=_0x44ebdb['user']['get']({'plain':!![]});if(!_0x844907)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x844907[_0x32fe('0x44')]===_0x32fe('0x45')){var _0xced92a=_0x575f33[_0x32fe('0x46')]({'plain':!![]});var _0x1464bb=_0x32fe('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x1464bb,'userProfileId':_0x844907[_0x32fe('0x47')]},'raw':!![]})[_0x32fe('0x21')](function(_0xd66ebe){if(_0xd66ebe&&_0xd66ebe['autoAssociation']===0x0){return db[_0x32fe('0x23')][_0x32fe('0x42')]({'name':_0xced92a['name'],'resourceId':_0xced92a['id'],'type':_0xd66ebe[_0x32fe('0x26')],'sectionId':_0xd66ebe['id']},{})[_0x32fe('0x21')](function(){return _0x575f33;});}else{return _0x575f33;}})[_0x32fe('0x3e')](function(_0x3bfffa){logger[_0x32fe('0x48')](_0x32fe('0x49'),_0x3bfffa);throw _0x3bfffa;});}return _0x575f33;})['then'](respondWithResult(_0x1f464f,0xc9))[_0x32fe('0x3e')](handleError(_0x1f464f,null));};exports[_0x32fe('0x4a')]=function(_0x264bfd,_0x324f4b){var _0x5a984a={'where':{'id':_0x264bfd[_0x32fe('0x40')]['id']}},_0x483a9a={};_0x483a9a[_0x32fe('0x2d')]=_[_0x32fe('0x2e')](db[_0x32fe('0x29')]['rawAttributes']);_0x5a984a[_0x32fe('0x33')]=_[_0x32fe('0x31')](_0x483a9a['model'],qs[_0x32fe('0x32')](_0x264bfd[_0x32fe('0x2f')][_0x32fe('0x32')]));_0x5a984a[_0x32fe('0x33')]=_0x5a984a[_0x32fe('0x33')]['length']?_0x5a984a['attributes']:_0x483a9a[_0x32fe('0x2d')];if(_0x264bfd[_0x32fe('0x2f')]['includeAll']){_0x5a984a[_0x32fe('0x41')]=[{'all':!![]}];}_0x5a984a=_[_0x32fe('0x39')]({},_0x5a984a,_0x264bfd[_0x32fe('0x3a')]);return db[_0x32fe('0x29')][_0x32fe('0x4b')](_0x5a984a)[_0x32fe('0x21')](handleEntityNotFound(_0x324f4b,null))['then'](function(_0x1c2c71){if(_0x1c2c71){var _0x16e267=_0x1c2c71[_0x32fe('0x46')]({'plain':!![]});_0x16e267=qs['omit'](_0x16e267,['id',_0x32fe('0x4c'),_0x32fe('0x4d')]);_0x264bfd[_0x32fe('0x43')]=_[_0x32fe('0x4e')](_0x264bfd[_0x32fe('0x43')],['id','createdAt',_0x32fe('0x4d')]);return db[_0x32fe('0x29')][_0x32fe('0x42')](_[_0x32fe('0x39')](_0x16e267,_0x264bfd[_0x32fe('0x43')]),{'include':_0x264bfd['query'][_0x32fe('0x3c')]?[{'all':!![]}]:undefined})[_0x32fe('0x21')](function(_0x25826d){var _0x14eb06=_0x264bfd[_0x32fe('0x45')][_0x32fe('0x46')]({'plain':!![]});if(!_0x14eb06)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14eb06[_0x32fe('0x44')]===_0x32fe('0x45')){var _0x2a883a=_0x25826d[_0x32fe('0x46')]({'plain':!![]});var _0x38526c=_0x32fe('0x22');return db['UserProfileSection'][_0x32fe('0x4b')]({'where':{'name':_0x38526c,'userProfileId':_0x14eb06[_0x32fe('0x47')]},'raw':!![]})[_0x32fe('0x21')](function(_0x4b74d1){if(_0x4b74d1&&_0x4b74d1[_0x32fe('0x4f')]===0x0){return db['UserProfileResource'][_0x32fe('0x42')]({'name':_0x2a883a[_0x32fe('0x26')],'resourceId':_0x2a883a['id'],'type':_0x4b74d1[_0x32fe('0x26')],'sectionId':_0x4b74d1['id']},{})[_0x32fe('0x21')](function(){return _0x25826d;});}else{return _0x25826d;}})[_0x32fe('0x3e')](function(_0xd7f785){logger[_0x32fe('0x48')](_0x32fe('0x49'),_0xd7f785);throw _0xd7f785;});}return _0x25826d;});}})[_0x32fe('0x21')](respondWithResult(_0x324f4b,0xc9))['catch'](handleError(_0x324f4b,null));};exports['update']=function(_0xa29e0c,_0x197fea){if(_0xa29e0c['body']['id']){delete _0xa29e0c[_0x32fe('0x43')]['id'];}return db['Campaign'][_0x32fe('0x4b')]({'where':{'id':_0xa29e0c[_0x32fe('0x40')]['id']}})[_0x32fe('0x21')](handleEntityNotFound(_0x197fea,null))[_0x32fe('0x21')](saveUpdates(_0xa29e0c['body'],null))[_0x32fe('0x21')](respondWithResult(_0x197fea,null))[_0x32fe('0x3e')](handleError(_0x197fea,null));};exports[_0x32fe('0x24')]=function(_0x1fa6db,_0x229cf8){return db[_0x32fe('0x29')]['find']({'where':{'id':_0x1fa6db['params']['id']}})[_0x32fe('0x21')](handleEntityNotFound(_0x229cf8,null))[_0x32fe('0x21')](removeEntity(_0x229cf8,null))[_0x32fe('0x3e')](handleError(_0x229cf8,null));};exports['getHoppers']=function(_0x2707ce,_0x8a62fd,_0x966fe5){var _0x4dd064={'raw':!![],'where':{}};var _0x40b954={};var _0x2a5b21={'count':0x0,'rows':[]};return db[_0x32fe('0x29')][_0x32fe('0x50')]({'where':{'id':_0x2707ce[_0x32fe('0x40')]['id']}})[_0x32fe('0x21')](handleEntityNotFound(_0x8a62fd,null))['then'](function(_0x2a60f7){if(_0x2a60f7){_0x40b954[_0x32fe('0x2d')]=_[_0x32fe('0x2e')](db[_0x32fe('0x51')][_0x32fe('0x2a')]);_0x40b954[_0x32fe('0x2f')]=_['keys'](_0x2707ce[_0x32fe('0x2f')]);_0x40b954['filters']=_[_0x32fe('0x31')](_0x40b954[_0x32fe('0x2d')],_0x40b954[_0x32fe('0x2f')]);_0x4dd064[_0x32fe('0x33')]=_[_0x32fe('0x31')](_0x40b954[_0x32fe('0x2d')],qs[_0x32fe('0x32')](_0x2707ce[_0x32fe('0x2f')]['fields']));_0x4dd064['attributes']=_0x4dd064[_0x32fe('0x33')][_0x32fe('0x34')]?_0x4dd064['attributes']:_0x40b954[_0x32fe('0x2d')];if(!_0x2707ce[_0x32fe('0x2f')][_0x32fe('0x35')](_0x32fe('0x52'))){_0x4dd064[_0x32fe('0x19')]=qs[_0x32fe('0x19')](_0x2707ce[_0x32fe('0x2f')][_0x32fe('0x19')]);_0x4dd064['offset']=qs[_0x32fe('0x1c')](_0x2707ce[_0x32fe('0x2f')][_0x32fe('0x1c')]);}_0x4dd064['order']=qs[_0x32fe('0x37')](_0x2707ce[_0x32fe('0x2f')][_0x32fe('0x37')]);_0x4dd064[_0x32fe('0x3b')]=qs[_0x32fe('0x30')](_['pick'](_0x2707ce[_0x32fe('0x2f')],_0x40b954[_0x32fe('0x30')]));_0x4dd064[_0x32fe('0x3b')][_0x32fe('0x53')]=_0x2a60f7['id'];if(_0x2707ce['query']['filter']){_0x4dd064[_0x32fe('0x3b')]=_[_0x32fe('0x39')](_0x4dd064[_0x32fe('0x3b')],{'$or':_['map'](_0x4dd064['attributes'],function(_0xa00a56){var _0x3d8f84={};_0x3d8f84[_0xa00a56]={'$like':'%'+_0x2707ce[_0x32fe('0x2f')][_0x32fe('0x38')]+'%'};return _0x3d8f84;})});}_0x4dd064=_[_0x32fe('0x39')]({},_0x4dd064,_0x2707ce['options']);return db[_0x32fe('0x51')][_0x32fe('0x1b')]({'where':_0x4dd064['where']})[_0x32fe('0x21')](function(_0x431ed2){_0x2a5b21[_0x32fe('0x1b')]=_0x431ed2;if(_0x2707ce[_0x32fe('0x2f')][_0x32fe('0x3c')]){_0x4dd064[_0x32fe('0x41')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x4dd064);})['then'](function(_0x36f227){_0x2a5b21[_0x32fe('0x54')]=_0x36f227;return _0x2a5b21;});}})[_0x32fe('0x21')](respondWithFilteredResult(_0x8a62fd,_0x4dd064))[_0x32fe('0x3e')](handleError(_0x8a62fd,null));};exports[_0x32fe('0x55')]=function(_0x249fef,_0x134579,_0x649ffc){var _0x373228={'raw':!![],'where':{}};var _0x3f982a={};var _0x110b5c={'count':0x0,'rows':[]};return db[_0x32fe('0x29')][_0x32fe('0x50')]({'where':{'id':_0x249fef['params']['id']}})['then'](handleEntityNotFound(_0x134579,null))[_0x32fe('0x21')](function(_0x2d3ef3){if(_0x2d3ef3){_0x3f982a[_0x32fe('0x2d')]=_[_0x32fe('0x2e')](db[_0x32fe('0x56')][_0x32fe('0x2a')]);_0x3f982a[_0x32fe('0x2f')]=_[_0x32fe('0x2e')](_0x249fef['query']);_0x3f982a['filters']=_[_0x32fe('0x31')](_0x3f982a['model'],_0x3f982a[_0x32fe('0x2f')]);_0x373228[_0x32fe('0x33')]=_[_0x32fe('0x31')](_0x3f982a['model'],qs[_0x32fe('0x32')](_0x249fef[_0x32fe('0x2f')][_0x32fe('0x32')]));_0x373228[_0x32fe('0x33')]=_0x373228[_0x32fe('0x33')][_0x32fe('0x34')]?_0x373228[_0x32fe('0x33')]:_0x3f982a['model'];if(!_0x249fef[_0x32fe('0x2f')][_0x32fe('0x35')]('nolimit')){_0x373228[_0x32fe('0x19')]=qs['limit'](_0x249fef[_0x32fe('0x2f')][_0x32fe('0x19')]);_0x373228[_0x32fe('0x1c')]=qs[_0x32fe('0x1c')](_0x249fef[_0x32fe('0x2f')]['offset']);}_0x373228['order']=qs['sort'](_0x249fef[_0x32fe('0x2f')][_0x32fe('0x37')]);_0x373228['where']=qs[_0x32fe('0x30')](_['pick'](_0x249fef['query'],_0x3f982a['filters']));_0x373228[_0x32fe('0x3b')]['CampaignId']=_0x2d3ef3['id'];if(_0x249fef[_0x32fe('0x2f')][_0x32fe('0x38')]){_0x373228[_0x32fe('0x3b')]=_[_0x32fe('0x39')](_0x373228[_0x32fe('0x3b')],{'$or':_['map'](_0x373228['attributes'],function(_0x1f0e8e){var _0x72afa8={};_0x72afa8[_0x1f0e8e]={'$like':'%'+_0x249fef[_0x32fe('0x2f')][_0x32fe('0x38')]+'%'};return _0x72afa8;})});}_0x373228=_[_0x32fe('0x39')]({},_0x373228,_0x249fef['options']);return db[_0x32fe('0x56')][_0x32fe('0x1b')]({'where':_0x373228[_0x32fe('0x3b')]})['then'](function(_0x20f12c){_0x110b5c[_0x32fe('0x1b')]=_0x20f12c;if(_0x249fef[_0x32fe('0x2f')]['includeAll']){_0x373228['include']=[{'all':!![]}];}return db[_0x32fe('0x56')][_0x32fe('0x3d')](_0x373228);})[_0x32fe('0x21')](function(_0x14e697){_0x110b5c[_0x32fe('0x54')]=_0x14e697;return _0x110b5c;});}})['then'](respondWithFilteredResult(_0x134579,_0x373228))[_0x32fe('0x3e')](handleError(_0x134579,null));};exports[_0x32fe('0x57')]=function(_0x431b95,_0x56c8e4,_0x39cef3){var _0xf5f8e={'raw':!![],'where':{}};var _0x166a75={};var _0x7e5a35={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x431b95[_0x32fe('0x40')]['id']}})['then'](handleEntityNotFound(_0x56c8e4,null))[_0x32fe('0x21')](function(_0x44038f){if(_0x44038f){_0x166a75['model']=_[_0x32fe('0x2e')](db[_0x32fe('0x58')][_0x32fe('0x2a')]);_0x166a75[_0x32fe('0x2f')]=_[_0x32fe('0x2e')](_0x431b95['query']);_0x166a75[_0x32fe('0x30')]=_[_0x32fe('0x31')](_0x166a75[_0x32fe('0x2d')],_0x166a75[_0x32fe('0x2f')]);_0xf5f8e[_0x32fe('0x33')]=_[_0x32fe('0x31')](_0x166a75['model'],qs[_0x32fe('0x32')](_0x431b95[_0x32fe('0x2f')]['fields']));_0xf5f8e[_0x32fe('0x33')]=_0xf5f8e['attributes']['length']?_0xf5f8e[_0x32fe('0x33')]:_0x166a75['model'];if(!_0x431b95['query'][_0x32fe('0x35')](_0x32fe('0x52'))){_0xf5f8e[_0x32fe('0x19')]=qs['limit'](_0x431b95[_0x32fe('0x2f')][_0x32fe('0x19')]);_0xf5f8e[_0x32fe('0x1c')]=qs[_0x32fe('0x1c')](_0x431b95[_0x32fe('0x2f')][_0x32fe('0x1c')]);}_0xf5f8e[_0x32fe('0x36')]=qs['sort'](_0x431b95['query'][_0x32fe('0x37')]);_0xf5f8e[_0x32fe('0x3b')]=qs[_0x32fe('0x30')](_[_0x32fe('0x59')](_0x431b95[_0x32fe('0x2f')],_0x166a75[_0x32fe('0x30')]));_0xf5f8e[_0x32fe('0x3b')][_0x32fe('0x53')]=_0x44038f['id'];if(_0x431b95[_0x32fe('0x2f')]['filter']){_0xf5f8e['where']=_[_0x32fe('0x39')](_0xf5f8e[_0x32fe('0x3b')],{'$or':_[_0x32fe('0x28')](_0xf5f8e['attributes'],function(_0x3dfab6){var _0x4573e8={};_0x4573e8[_0x3dfab6]={'$like':'%'+_0x431b95[_0x32fe('0x2f')]['filter']+'%'};return _0x4573e8;})});}_0xf5f8e=_[_0x32fe('0x39')]({},_0xf5f8e,_0x431b95[_0x32fe('0x3a')]);return db[_0x32fe('0x58')][_0x32fe('0x1b')]({'where':_0xf5f8e[_0x32fe('0x3b')]})['then'](function(_0x45ecf2){_0x7e5a35[_0x32fe('0x1b')]=_0x45ecf2;if(_0x431b95[_0x32fe('0x2f')][_0x32fe('0x3c')]){_0xf5f8e[_0x32fe('0x41')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x32fe('0x3d')](_0xf5f8e);})['then'](function(_0x4e2fc3){_0x7e5a35[_0x32fe('0x54')]=_0x4e2fc3;return _0x7e5a35;});}})['then'](respondWithFilteredResult(_0x56c8e4,_0xf5f8e))[_0x32fe('0x3e')](handleError(_0x56c8e4,null));};exports['getHopperBlacks']=function(_0x23ec85,_0x3fd398,_0x3b5c04){var _0x9c6635={'raw':!![],'where':{}};var _0x121d8d={};var _0x549f2f={'count':0x0,'rows':[]};return db[_0x32fe('0x29')]['findOne']({'where':{'id':_0x23ec85[_0x32fe('0x40')]['id']}})[_0x32fe('0x21')](handleEntityNotFound(_0x3fd398,null))['then'](function(_0x172440){if(_0x172440){_0x121d8d[_0x32fe('0x2d')]=_[_0x32fe('0x2e')](db[_0x32fe('0x5a')][_0x32fe('0x2a')]);_0x121d8d['query']=_[_0x32fe('0x2e')](_0x23ec85[_0x32fe('0x2f')]);_0x121d8d[_0x32fe('0x30')]=_[_0x32fe('0x31')](_0x121d8d[_0x32fe('0x2d')],_0x121d8d['query']);_0x9c6635[_0x32fe('0x33')]=_[_0x32fe('0x31')](_0x121d8d[_0x32fe('0x2d')],qs[_0x32fe('0x32')](_0x23ec85['query'][_0x32fe('0x32')]));_0x9c6635[_0x32fe('0x33')]=_0x9c6635['attributes'][_0x32fe('0x34')]?_0x9c6635[_0x32fe('0x33')]:_0x121d8d['model'];if(!_0x23ec85[_0x32fe('0x2f')][_0x32fe('0x35')](_0x32fe('0x52'))){_0x9c6635['limit']=qs[_0x32fe('0x19')](_0x23ec85['query'][_0x32fe('0x19')]);_0x9c6635['offset']=qs[_0x32fe('0x1c')](_0x23ec85[_0x32fe('0x2f')][_0x32fe('0x1c')]);}_0x9c6635[_0x32fe('0x36')]=qs['sort'](_0x23ec85[_0x32fe('0x2f')][_0x32fe('0x37')]);_0x9c6635[_0x32fe('0x3b')]=qs[_0x32fe('0x30')](_['pick'](_0x23ec85['query'],_0x121d8d[_0x32fe('0x30')]));_0x9c6635[_0x32fe('0x3b')]['CampaignId']=_0x172440['id'];if(_0x23ec85[_0x32fe('0x2f')][_0x32fe('0x38')]){_0x9c6635[_0x32fe('0x3b')]=_[_0x32fe('0x39')](_0x9c6635[_0x32fe('0x3b')],{'$or':_[_0x32fe('0x28')](_0x9c6635['attributes'],function(_0x406da0){var _0x4c7ee3={};_0x4c7ee3[_0x406da0]={'$like':'%'+_0x23ec85['query'][_0x32fe('0x38')]+'%'};return _0x4c7ee3;})});}_0x9c6635=_[_0x32fe('0x39')]({},_0x9c6635,_0x23ec85['options']);return db[_0x32fe('0x5a')]['count']({'where':_0x9c6635[_0x32fe('0x3b')]})['then'](function(_0x549d0b){_0x549f2f[_0x32fe('0x1b')]=_0x549d0b;if(_0x23ec85[_0x32fe('0x2f')][_0x32fe('0x3c')]){_0x9c6635['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x32fe('0x3d')](_0x9c6635);})[_0x32fe('0x21')](function(_0x116816){_0x549f2f[_0x32fe('0x54')]=_0x116816;return _0x549f2f;});}})[_0x32fe('0x21')](respondWithFilteredResult(_0x3fd398,_0x9c6635))[_0x32fe('0x3e')](handleError(_0x3fd398,null));};exports[_0x32fe('0x5b')]=function(_0x2ce0c6,_0x505f87,_0x45d54e){var _0x112b0a={};var _0x1e8b20={};var _0x29904b;var _0x3d4c24;return db[_0x32fe('0x29')][_0x32fe('0x50')]({'where':{'id':_0x2ce0c6['params']['id']}})['then'](handleEntityNotFound(_0x505f87,null))[_0x32fe('0x21')](function(_0x4691a9){if(_0x4691a9){_0x29904b=_0x4691a9;_0x1e8b20['model']=_[_0x32fe('0x2e')](db['CmList'][_0x32fe('0x2a')]);_0x1e8b20[_0x32fe('0x2f')]=_[_0x32fe('0x2e')](_0x2ce0c6[_0x32fe('0x2f')]);_0x1e8b20['filters']=_[_0x32fe('0x31')](_0x1e8b20[_0x32fe('0x2d')],_0x1e8b20[_0x32fe('0x2f')]);_0x112b0a['attributes']=_['intersection'](_0x1e8b20[_0x32fe('0x2d')],qs[_0x32fe('0x32')](_0x2ce0c6[_0x32fe('0x2f')][_0x32fe('0x32')]));_0x112b0a[_0x32fe('0x33')]=_0x112b0a[_0x32fe('0x33')][_0x32fe('0x34')]?_0x112b0a[_0x32fe('0x33')]:_0x1e8b20['model'];_0x112b0a[_0x32fe('0x36')]=qs[_0x32fe('0x37')](_0x2ce0c6[_0x32fe('0x2f')]['sort']);_0x112b0a[_0x32fe('0x3b')]=qs[_0x32fe('0x30')](_[_0x32fe('0x59')](_0x2ce0c6[_0x32fe('0x2f')],_0x1e8b20[_0x32fe('0x30')]));if(_0x2ce0c6[_0x32fe('0x2f')][_0x32fe('0x38')]){_0x112b0a[_0x32fe('0x3b')]=_['merge'](_0x112b0a['where'],{'$or':_[_0x32fe('0x28')](_0x112b0a['attributes'],function(_0x4b56c7){var _0xfb366f={};_0xfb366f[_0x4b56c7]={'$like':'%'+_0x2ce0c6[_0x32fe('0x2f')][_0x32fe('0x38')]+'%'};return _0xfb366f;})});}_0x112b0a=_[_0x32fe('0x39')]({},_0x112b0a,_0x2ce0c6[_0x32fe('0x3a')]);return _0x29904b[_0x32fe('0x5b')](_0x112b0a);}})[_0x32fe('0x21')](function(_0x14e412){if(_0x14e412){_0x3d4c24=_0x14e412[_0x32fe('0x34')];if(!_0x2ce0c6['query'][_0x32fe('0x35')](_0x32fe('0x52'))){_0x112b0a['limit']=qs[_0x32fe('0x19')](_0x2ce0c6[_0x32fe('0x2f')][_0x32fe('0x19')]);_0x112b0a[_0x32fe('0x1c')]=qs['offset'](_0x2ce0c6[_0x32fe('0x2f')]['offset']);}return _0x29904b['getLists'](_0x112b0a);}})[_0x32fe('0x21')](function(_0x1d4236){if(_0x1d4236){return _0x1d4236?{'count':_0x3d4c24,'rows':_0x1d4236}:null;}})[_0x32fe('0x21')](respondWithResult(_0x505f87,null))[_0x32fe('0x3e')](handleError(_0x505f87,null));};exports[_0x32fe('0x5c')]=function(_0x5ebf93,_0x52b356,_0x2dd19c){var _0x2ef95b,_0x1ec0bc;var _0x2d2d07=[];var _0x2f3a86=moment()[_0x32fe('0x5d')](_0x32fe('0x5e'));return db['Campaign'][_0x32fe('0x4b')]({'where':{'id':_0x5ebf93[_0x32fe('0x40')]['id']}})[_0x32fe('0x21')](handleEntityNotFound(_0x52b356,null))['then'](function(_0x1d2df0){if(_0x1d2df0){_0x1ec0bc=_0x1d2df0;return _0x1d2df0[_0x32fe('0x5c')](_0x5ebf93[_0x32fe('0x43')][_0x32fe('0x5f')],_[_0x32fe('0x4e')](_0x5ebf93[_0x32fe('0x43')],[_0x32fe('0x5f'),'id'])||{});}return null;})[_0x32fe('0x60')](function(_0x4799a7){var _0x42df92;var _0x3ef5bf;_0x2ef95b=_0x4799a7||[];var _0x49daa0=[];if(_0x4799a7){for(var _0x345cbe=0x0;_0x345cbe<_0x4799a7[_0x32fe('0x34')];_0x345cbe+=0x1){var _0x5e5f63=_0x4799a7[_0x345cbe]['get']({'plain':!![]});_0x1ec0bc[_0x32fe('0x61')]=_0x5ebf93['body'][_0x32fe('0x61')]?_0x5ebf93[_0x32fe('0x43')][_0x32fe('0x61')]:_0x1ec0bc[_0x32fe('0x61')];switch(_0x1ec0bc[_0x32fe('0x61')]){case'always':_0x42df92=squel[_0x32fe('0x62')]()[_0x32fe('0x63')](_0x32fe('0x64'))[_0x32fe('0x65')](['phone',_0x32fe('0x66'),_0x32fe('0x67'),_0x32fe('0x68'),'CampaignId','createdAt',_0x32fe('0x4d')],squel['select']()[_0x32fe('0x69')](_0x32fe('0x6a'),_0x32fe('0x6a'))[_0x32fe('0x69')](_0x32fe('0x6b'),_0x32fe('0x66'))[_0x32fe('0x69')]('id','ContactId')[_0x32fe('0x69')](_0x5e5f63[_0x32fe('0x6c')][_0x32fe('0x6d')](),_0x32fe('0x68'))[_0x32fe('0x69')](_0x5ebf93[_0x32fe('0x40')]['id'][_0x32fe('0x6d')](),'CampaignId')[_0x32fe('0x69')]('\x27'+_0x2f3a86+'\x27',_0x32fe('0x4c'))[_0x32fe('0x69')]('\x27'+_0x2f3a86+'\x27',_0x32fe('0x4d'))[_0x32fe('0x6e')]('cm_contacts')['where'](_0x32fe('0x6f'))[_0x32fe('0x3b')](_0x32fe('0x70'),_0x5e5f63[_0x32fe('0x6c')][_0x32fe('0x6d')]())[_0x32fe('0x3b')](_0x32fe('0x71'))[_0x32fe('0x3b')](_0x32fe('0x72'),squel[_0x32fe('0x73')]()[_0x32fe('0x69')](_0x32fe('0x74'))[_0x32fe('0x6e')]('cm_hopper_final')[_0x32fe('0x3b')]('CampaignId\x20=\x20?',_0x5ebf93[_0x32fe('0x40')]['id'][_0x32fe('0x6d')]()))[_0x32fe('0x3b')](_0x32fe('0x72'),squel['select']()[_0x32fe('0x69')]('COALESCE(phone,\x27\x27)')[_0x32fe('0x6e')](_0x32fe('0x64'))[_0x32fe('0x3b')](_0x32fe('0x75'),_0x5ebf93[_0x32fe('0x40')]['id'][_0x32fe('0x6d')]())))['toString']();break;case _0x32fe('0x76'):_0x42df92=squel[_0x32fe('0x62')]()[_0x32fe('0x63')](_0x32fe('0x64'))[_0x32fe('0x65')]([_0x32fe('0x6a'),_0x32fe('0x66'),_0x32fe('0x67'),_0x32fe('0x68'),_0x32fe('0x53'),_0x32fe('0x4c'),_0x32fe('0x4d')],squel[_0x32fe('0x73')]()[_0x32fe('0x69')](_0x32fe('0x6a'),_0x32fe('0x6a'))['field']('NOW()','scheduledAt')[_0x32fe('0x69')]('id','ContactId')[_0x32fe('0x69')](_0x5e5f63[_0x32fe('0x6c')][_0x32fe('0x6d')](),_0x32fe('0x68'))['field'](_0x5ebf93['params']['id'][_0x32fe('0x6d')](),_0x32fe('0x53'))[_0x32fe('0x69')]('\x27'+_0x2f3a86+'\x27',_0x32fe('0x4c'))[_0x32fe('0x69')]('\x27'+_0x2f3a86+'\x27','updatedAt')[_0x32fe('0x6e')](_0x32fe('0x77'))['where']('deletedAt\x20IS\x20NULL')[_0x32fe('0x3b')]('ListId\x20=\x20?',_0x5e5f63['CmListId'][_0x32fe('0x6d')]())[_0x32fe('0x3b')](_0x32fe('0x71'))[_0x32fe('0x3b')](_0x32fe('0x72'),squel[_0x32fe('0x73')]()[_0x32fe('0x69')]('COALESCE(phone,\x27\x27)')[_0x32fe('0x6e')](_0x32fe('0x64'))[_0x32fe('0x3b')](_0x32fe('0x75'),_0x5ebf93['params']['id']['toString']())))['toString']();break;default:_0x42df92=squel['insert']()[_0x32fe('0x63')](_0x32fe('0x64'))[_0x32fe('0x65')]([_0x32fe('0x6a'),_0x32fe('0x66'),_0x32fe('0x67'),_0x32fe('0x68'),_0x32fe('0x53'),_0x32fe('0x4c'),_0x32fe('0x4d')],squel[_0x32fe('0x73')]()[_0x32fe('0x69')](_0x32fe('0x6a'),'phone')[_0x32fe('0x69')](_0x32fe('0x6b'),_0x32fe('0x66'))[_0x32fe('0x69')]('id','ContactId')[_0x32fe('0x69')](_0x5e5f63['CmListId'][_0x32fe('0x6d')](),_0x32fe('0x68'))[_0x32fe('0x69')](_0x5ebf93['params']['id'][_0x32fe('0x6d')](),'CampaignId')[_0x32fe('0x69')]('\x27'+_0x2f3a86+'\x27',_0x32fe('0x4c'))[_0x32fe('0x69')]('\x27'+_0x2f3a86+'\x27',_0x32fe('0x4d'))[_0x32fe('0x6e')](_0x32fe('0x77'))['where'](_0x32fe('0x6f'))[_0x32fe('0x3b')](_0x32fe('0x70'),_0x5e5f63['CmListId']['toString']())[_0x32fe('0x3b')](_0x32fe('0x71')))[_0x32fe('0x6d')]();}_0x3ef5bf=squel[_0x32fe('0x62')]()[_0x32fe('0x63')](_0x32fe('0x78'))[_0x32fe('0x65')]([_0x32fe('0x79'),_0x32fe('0x66'),_0x32fe('0x6a'),_0x32fe('0x7a'),_0x32fe('0x4c'),'updatedAt'],squel[_0x32fe('0x73')]()[_0x32fe('0x69')](_0x32fe('0x7b'),'id')[_0x32fe('0x69')](_0x32fe('0x6b'),_0x32fe('0x66'))[_0x32fe('0x69')]('ci.item',_0x32fe('0x6a'))['field'](_0x32fe('0x7c'),_0x32fe('0x7a'))['field']('\x27'+_0x2f3a86+'\x27',_0x32fe('0x4c'))[_0x32fe('0x69')]('\x27'+_0x2f3a86+'\x27',_0x32fe('0x4d'))[_0x32fe('0x6e')](_0x32fe('0x7d'),'ci')['join']('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x32fe('0x3b')](_0x32fe('0x7e'),_0x5e5f63[_0x32fe('0x6c')]['toString']())[_0x32fe('0x3b')](_0x32fe('0x7f'),_0x5ebf93[_0x32fe('0x40')]['id'][_0x32fe('0x6d')]())[_0x32fe('0x3b')](_0x32fe('0x80'),_0x2f3a86))[_0x32fe('0x6d')]();_0x49daa0[_0x32fe('0x81')](db[_0x32fe('0x82')]['query'](_0x42df92));_0x2d2d07['push'](db['sequelize'][_0x32fe('0x2f')](_0x3ef5bf));}return BPromise[_0x32fe('0x83')](_0x49daa0);}})[_0x32fe('0x21')](function(){return BPromise[_0x32fe('0x83')](_0x2d2d07);})[_0x32fe('0x21')](function(){return _0x2ef95b;})[_0x32fe('0x21')](respondWithResult(_0x52b356,null))[_0x32fe('0x3e')](handleError(_0x52b356,null));};exports[_0x32fe('0x84')]=function(_0x283346,_0x4e4697,_0x465280){return db[_0x32fe('0x29')][_0x32fe('0x4b')]({'where':{'id':_0x283346[_0x32fe('0x40')]['id']}})[_0x32fe('0x21')](handleEntityNotFound(_0x4e4697,null))[_0x32fe('0x21')](function(_0x3bb279){if(_0x3bb279){return _0x3bb279[_0x32fe('0x84')](_0x283346['query'][_0x32fe('0x5f')]);}})['then'](function(_0x3a2e43){if(_0x3a2e43){return db[_0x32fe('0x51')][_0x32fe('0x24')]({'where':{'ListId':_0x283346[_0x32fe('0x2f')][_0x32fe('0x5f')],'CampaignId':_0x283346[_0x32fe('0x40')]['id']}})[_0x32fe('0x21')](function(){return _0x3a2e43;});}})[_0x32fe('0x21')](respondWithStatusCode(_0x4e4697,null))['catch'](handleError(_0x4e4697,null));};exports[_0x32fe('0x85')]=function(_0x44306e,_0x45ba22,_0x35511c){var _0x49cc5e={};var _0x3ef417={};var _0x448d1a;var _0x35e548;return db['Campaign'][_0x32fe('0x50')]({'where':{'id':_0x44306e[_0x32fe('0x40')]['id']}})[_0x32fe('0x21')](handleEntityNotFound(_0x45ba22,null))[_0x32fe('0x21')](function(_0x29298e){if(_0x29298e){_0x448d1a=_0x29298e;_0x3ef417[_0x32fe('0x2d')]=_[_0x32fe('0x2e')](db[_0x32fe('0x86')]['rawAttributes']);_0x3ef417[_0x32fe('0x2f')]=_[_0x32fe('0x2e')](_0x44306e[_0x32fe('0x2f')]);_0x3ef417['filters']=_['intersection'](_0x3ef417[_0x32fe('0x2d')],_0x3ef417[_0x32fe('0x2f')]);_0x49cc5e[_0x32fe('0x33')]=_[_0x32fe('0x31')](_0x3ef417[_0x32fe('0x2d')],qs[_0x32fe('0x32')](_0x44306e[_0x32fe('0x2f')][_0x32fe('0x32')]));_0x49cc5e[_0x32fe('0x33')]=_0x49cc5e['attributes'][_0x32fe('0x34')]?_0x49cc5e[_0x32fe('0x33')]:_0x3ef417[_0x32fe('0x2d')];_0x49cc5e[_0x32fe('0x36')]=qs['sort'](_0x44306e['query'][_0x32fe('0x37')]);_0x49cc5e[_0x32fe('0x3b')]=qs[_0x32fe('0x30')](_['pick'](_0x44306e['query'],_0x3ef417[_0x32fe('0x30')]));if(_0x44306e[_0x32fe('0x2f')]['filter']){_0x49cc5e[_0x32fe('0x3b')]=_[_0x32fe('0x39')](_0x49cc5e[_0x32fe('0x3b')],{'$or':_[_0x32fe('0x28')](_0x49cc5e['attributes'],function(_0x2186ac){var _0x4142f8={};_0x4142f8[_0x2186ac]={'$like':'%'+_0x44306e[_0x32fe('0x2f')]['filter']+'%'};return _0x4142f8;})});}_0x49cc5e=_['merge']({},_0x49cc5e,_0x44306e[_0x32fe('0x3a')]);return _0x448d1a['getBlackLists'](_0x49cc5e);}})[_0x32fe('0x21')](function(_0x37ffae){if(_0x37ffae){_0x35e548=_0x37ffae[_0x32fe('0x34')];if(!_0x44306e[_0x32fe('0x2f')]['hasOwnProperty'](_0x32fe('0x52'))){_0x49cc5e[_0x32fe('0x19')]=qs['limit'](_0x44306e[_0x32fe('0x2f')][_0x32fe('0x19')]);_0x49cc5e['offset']=qs[_0x32fe('0x1c')](_0x44306e['query'][_0x32fe('0x1c')]);}return _0x448d1a['getBlackLists'](_0x49cc5e);}})[_0x32fe('0x21')](function(_0x3c3440){if(_0x3c3440){return _0x3c3440?{'count':_0x35e548,'rows':_0x3c3440}:null;}})[_0x32fe('0x21')](respondWithResult(_0x45ba22,null))[_0x32fe('0x3e')](handleError(_0x45ba22,null));};exports[_0x32fe('0x87')]=function(_0xc27f9c,_0x224389,_0x1620ce){var _0x3ef55e,_0x45e686;var _0x2fa2bc=[];var _0x383d0d=moment()[_0x32fe('0x5d')](_0x32fe('0x5e'));return db[_0x32fe('0x29')][_0x32fe('0x4b')]({'where':{'id':_0xc27f9c[_0x32fe('0x40')]['id']}})[_0x32fe('0x21')](handleEntityNotFound(_0x224389,null))[_0x32fe('0x21')](function(_0x807a85){if(_0x807a85){_0x45e686=_0x807a85;return _0x807a85[_0x32fe('0x87')](_0xc27f9c[_0x32fe('0x43')][_0x32fe('0x5f')],_[_0x32fe('0x4e')](_0xc27f9c[_0x32fe('0x43')],[_0x32fe('0x5f'),'id'])||{});}return null;})[_0x32fe('0x60')](function(_0x381c43){var _0xbe3d14;var _0x48f65d;_0x3ef55e=_0x381c43||[];var _0x4d56e6=[];if(_0x381c43){for(var _0x470ca1=0x0;_0x470ca1<_0x381c43[_0x32fe('0x34')];_0x470ca1+=0x1){var _0x2e5da4=_0x381c43[_0x470ca1][_0x32fe('0x46')]({'plain':!![]});_0xbe3d14=squel['insert']()[_0x32fe('0x63')](_0x32fe('0x88'))[_0x32fe('0x65')]([_0x32fe('0x6a'),_0x32fe('0x67'),_0x32fe('0x68'),_0x32fe('0x53'),_0x32fe('0x4c'),_0x32fe('0x4d')],squel[_0x32fe('0x73')]()[_0x32fe('0x69')](_0x32fe('0x6a'),_0x32fe('0x6a'))[_0x32fe('0x69')]('id',_0x32fe('0x67'))[_0x32fe('0x69')](_0x2e5da4['CmListId'][_0x32fe('0x6d')](),_0x32fe('0x68'))['field'](_0xc27f9c['params']['id'][_0x32fe('0x6d')](),'CampaignId')['field'](_0x32fe('0x6b'),_0x32fe('0x4c'))[_0x32fe('0x69')](_0x32fe('0x6b'),_0x32fe('0x4d'))['from'](_0x32fe('0x77'))['where'](_0x32fe('0x6f'))[_0x32fe('0x3b')](_0x32fe('0x70'),_0x2e5da4[_0x32fe('0x6c')][_0x32fe('0x6d')]())[_0x32fe('0x3b')](_0x32fe('0x71')))['toString']();_0x4d56e6[_0x32fe('0x81')](db['sequelize'][_0x32fe('0x2f')](_0xbe3d14));}return BPromise['all'](_0x4d56e6);}})['then'](function(){return _0x3ef55e;})[_0x32fe('0x21')](respondWithResult(_0x224389,null))[_0x32fe('0x3e')](handleError(_0x224389,null));};exports[_0x32fe('0x89')]=function(_0x447932,_0x118aa7,_0x13db20){return db[_0x32fe('0x29')]['find']({'where':{'id':_0x447932[_0x32fe('0x40')]['id']}})[_0x32fe('0x21')](handleEntityNotFound(_0x118aa7,null))['then'](function(_0x4975f4){if(_0x4975f4){return _0x4975f4[_0x32fe('0x89')](_0x447932[_0x32fe('0x2f')]['ids']);}})[_0x32fe('0x21')](function(_0x3024ae){if(_0x3024ae){return db[_0x32fe('0x5a')][_0x32fe('0x24')]({'where':{'ListId':_0x447932['query'][_0x32fe('0x5f')],'CampaignId':_0x447932['params']['id']}})[_0x32fe('0x21')](function(){return _0x3024ae;});}})[_0x32fe('0x21')](respondWithStatusCode(_0x118aa7,null))[_0x32fe('0x3e')](handleError(_0x118aa7,null));}; \ No newline at end of file +var _0xa8ac=['find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt','IvrCampaigns','UserProfileSection','destroy','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','field','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','select','fromQuery','ListId','cm_contacts','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','OrderBy','NOW()','ci.item','cm_contact_has_items','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','request-promise','moment','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','Campaign'];(function(_0x36c687,_0x35516a){var _0x42fcde=function(_0x3ce4ba){while(--_0x3ce4ba){_0x36c687['push'](_0x36c687['shift']());}};_0x42fcde(++_0x35516a);}(_0xa8ac,0xd9));var _0xca8a=function(_0x487f38,_0x109e21){_0x487f38=_0x487f38-0x0;var _0x5c1b4a=_0xa8ac[_0x487f38];return _0x5c1b4a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca8a('0x0'));var zipdir=require(_0xca8a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca8a('0x2'));var moment=require(_0xca8a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xca8a('0x4'));var path=require('path');var sox=require(_0xca8a('0x5'));var csv=require('to-csv');var ejs=require(_0xca8a('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca8a('0x7'));var squel=require('squel');var crypto=require(_0xca8a('0x8'));var jsforce=require(_0xca8a('0x9'));var deskjs=require(_0xca8a('0xa'));var toCsv=require(_0xca8a('0xb'));var querystring=require(_0xca8a('0xc'));var Papa=require(_0xca8a('0xd'));var Redis=require(_0xca8a('0xe'));var authService=require(_0xca8a('0xf'));var qs=require(_0xca8a('0x10'));var as=require(_0xca8a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca8a('0x12'))('api');var utils=require(_0xca8a('0x13'));var config=require(_0xca8a('0x14'));var licenseUtil=require(_0xca8a('0x15'));var db=require(_0xca8a('0x16'))['db'];function respondWithStatusCode(_0x3efdd3,_0x2fbbcc){_0x2fbbcc=_0x2fbbcc||0xcc;return function(_0x176120){if(_0x176120){return _0x3efdd3[_0xca8a('0x17')](_0x2fbbcc);}return _0x3efdd3[_0xca8a('0x18')](_0x2fbbcc)['end']();};}function respondWithResult(_0x2d7bd2,_0x37eb42){_0x37eb42=_0x37eb42||0xc8;return function(_0x15a35a){if(_0x15a35a){return _0x2d7bd2['status'](_0x37eb42)[_0xca8a('0x19')](_0x15a35a);}};}function respondWithFilteredResult(_0x167d3a,_0x4e8550){return function(_0x5538aa){if(_0x5538aa){var _0x2169fe=typeof _0x4e8550[_0xca8a('0x1a')]===_0xca8a('0x1b')&&typeof _0x4e8550[_0xca8a('0x1c')]===_0xca8a('0x1b');var _0x356bd8=_0x5538aa[_0xca8a('0x1d')];var _0x186b2a=_0x2169fe?0x0:_0x4e8550[_0xca8a('0x1a')];var _0x2d03c8=_0x2169fe?_0x5538aa['count']:_0x4e8550[_0xca8a('0x1a')]+_0x4e8550[_0xca8a('0x1c')];var _0x2052ea;if(_0x2d03c8>=_0x356bd8){_0x2d03c8=_0x356bd8;_0x2052ea=0xc8;}else{_0x2052ea=0xce;}_0x167d3a[_0xca8a('0x18')](_0x2052ea);return _0x167d3a[_0xca8a('0x1e')](_0xca8a('0x1f'),_0x186b2a+'-'+_0x2d03c8+'/'+_0x356bd8)[_0xca8a('0x19')](_0x5538aa);}return null;};}function patchUpdates(_0x7b6bde){return function(_0x62b19c){try{jsonpatch[_0xca8a('0x20')](_0x62b19c,_0x7b6bde,!![]);}catch(_0x335952){return BPromise[_0xca8a('0x21')](_0x335952);}return _0x62b19c[_0xca8a('0x22')]();};}function saveUpdates(_0x382201,_0x30dd86){return function(_0x43879c){if(_0x43879c){return _0x43879c[_0xca8a('0x23')](_0x382201)['then'](function(_0x284fce){return _0x284fce;});}return null;};}function removeEntity(_0x5e7262,_0x20d2a7){return function(_0x4241a4){if(_0x4241a4){return _0x4241a4['destroy']()[_0xca8a('0x24')](function(){var _0x5239e0=_0x4241a4[_0xca8a('0x25')]({'plain':!![]});var _0x297af4='IvrCampaigns';return db[_0xca8a('0x26')]['destroy']({'where':{'type':_0x297af4,'resourceId':_0x5239e0['id']}})[_0xca8a('0x24')](function(){return _0x4241a4;});})[_0xca8a('0x24')](function(){_0x5e7262['status'](0xcc)[_0xca8a('0x27')]();});}};}function handleEntityNotFound(_0x2f167f,_0x1ae921){return function(_0x5406d4){if(!_0x5406d4){_0x2f167f[_0xca8a('0x17')](0x194);}return _0x5406d4;};}function handleError(_0x54107f,_0x4ca10c){_0x4ca10c=_0x4ca10c||0x1f4;return function(_0xe7285b){logger[_0xca8a('0x28')](_0xe7285b[_0xca8a('0x29')]);if(_0xe7285b[_0xca8a('0x2a')]){delete _0xe7285b[_0xca8a('0x2a')];}_0x54107f[_0xca8a('0x18')](_0x4ca10c)[_0xca8a('0x2b')](_0xe7285b);};}exports[_0xca8a('0x2c')]=function(_0x5caf48,_0x346568){var _0x39ba05={},_0x3317b4={},_0x4685b7={'count':0x0,'rows':[]};var _0x2f67e8=_[_0xca8a('0x2d')](db['Campaign'][_0xca8a('0x2e')],function(_0x185507){return{'name':_0x185507[_0xca8a('0x2f')],'type':_0x185507['type'][_0xca8a('0x30')]};});_0x3317b4[_0xca8a('0x31')]=_[_0xca8a('0x2d')](_0x2f67e8,'name');_0x3317b4[_0xca8a('0x32')]=_[_0xca8a('0x33')](_0x5caf48[_0xca8a('0x32')]);_0x3317b4[_0xca8a('0x34')]=_[_0xca8a('0x35')](_0x3317b4['model'],_0x3317b4['query']);_0x39ba05[_0xca8a('0x36')]=_[_0xca8a('0x35')](_0x3317b4[_0xca8a('0x31')],qs[_0xca8a('0x37')](_0x5caf48[_0xca8a('0x32')][_0xca8a('0x37')]));_0x39ba05[_0xca8a('0x36')]=_0x39ba05['attributes'][_0xca8a('0x38')]?_0x39ba05[_0xca8a('0x36')]:_0x3317b4['model'];if(!_0x5caf48[_0xca8a('0x32')][_0xca8a('0x39')](_0xca8a('0x3a'))){_0x39ba05[_0xca8a('0x1c')]=qs[_0xca8a('0x1c')](_0x5caf48[_0xca8a('0x32')][_0xca8a('0x1c')]);_0x39ba05['offset']=qs[_0xca8a('0x1a')](_0x5caf48['query']['offset']);}_0x39ba05[_0xca8a('0x3b')]=qs[_0xca8a('0x3c')](_0x5caf48[_0xca8a('0x32')][_0xca8a('0x3c')]);_0x39ba05[_0xca8a('0x3d')]=qs[_0xca8a('0x34')](_[_0xca8a('0x3e')](_0x5caf48[_0xca8a('0x32')],_0x3317b4[_0xca8a('0x34')]),_0x2f67e8);if(_0x5caf48[_0xca8a('0x32')][_0xca8a('0x3f')]){_0x39ba05[_0xca8a('0x3d')]=_['merge'](_0x39ba05[_0xca8a('0x3d')],{'$or':_[_0xca8a('0x2d')](_0x2f67e8,function(_0x388f9b){if(_0x388f9b['type']!==_0xca8a('0x40')){var _0x318a7d={};_0x318a7d[_0x388f9b[_0xca8a('0x2a')]]={'$like':'%'+_0x5caf48[_0xca8a('0x32')][_0xca8a('0x3f')]+'%'};return _0x318a7d;}})});}_0x39ba05=_[_0xca8a('0x41')]({},_0x39ba05,_0x5caf48[_0xca8a('0x42')]);var _0x232692={'where':_0x39ba05['where']};return db['Campaign'][_0xca8a('0x1d')](_0x232692)[_0xca8a('0x24')](function(_0x1ad82d){_0x4685b7[_0xca8a('0x1d')]=_0x1ad82d;if(_0x5caf48['query'][_0xca8a('0x43')]){_0x39ba05[_0xca8a('0x44')]=[{'all':!![]}];}return db['Campaign'][_0xca8a('0x45')](_0x39ba05);})[_0xca8a('0x24')](function(_0x263379){_0x4685b7[_0xca8a('0x46')]=_0x263379;return _0x4685b7;})[_0xca8a('0x24')](respondWithFilteredResult(_0x346568,_0x39ba05))[_0xca8a('0x47')](handleError(_0x346568,null));};exports[_0xca8a('0x48')]=function(_0x266085,_0x5c90d0){var _0xe44634={'raw':![],'where':{'id':_0x266085[_0xca8a('0x49')]['id']}},_0x1919dd={};_0x1919dd[_0xca8a('0x31')]=_[_0xca8a('0x33')](db[_0xca8a('0x4a')]['rawAttributes']);_0x1919dd[_0xca8a('0x32')]=_[_0xca8a('0x33')](_0x266085[_0xca8a('0x32')]);_0x1919dd[_0xca8a('0x34')]=_[_0xca8a('0x35')](_0x1919dd['model'],_0x1919dd[_0xca8a('0x32')]);_0xe44634[_0xca8a('0x36')]=_['intersection'](_0x1919dd[_0xca8a('0x31')],qs[_0xca8a('0x37')](_0x266085['query'][_0xca8a('0x37')]));_0xe44634[_0xca8a('0x36')]=_0xe44634[_0xca8a('0x36')][_0xca8a('0x38')]?_0xe44634[_0xca8a('0x36')]:_0x1919dd[_0xca8a('0x31')];if(_0x266085[_0xca8a('0x32')][_0xca8a('0x43')]){_0xe44634[_0xca8a('0x44')]=[{'all':!![]}];}_0xe44634=_[_0xca8a('0x41')]({},_0xe44634,_0x266085[_0xca8a('0x42')]);return db[_0xca8a('0x4a')][_0xca8a('0x4b')](_0xe44634)[_0xca8a('0x24')](handleEntityNotFound(_0x5c90d0,null))[_0xca8a('0x24')](respondWithResult(_0x5c90d0,null))['catch'](handleError(_0x5c90d0,null));};exports[_0xca8a('0x4c')]=function(_0x1ffcd7,_0x281b1f){return db[_0xca8a('0x4a')][_0xca8a('0x4c')](_0x1ffcd7['body'],{})['then'](function(_0x55509f){var _0x3342be=_0x1ffcd7[_0xca8a('0x4d')][_0xca8a('0x25')]({'plain':!![]});if(!_0x3342be)throw new Error(_0xca8a('0x4e'));if(_0x3342be[_0xca8a('0x4f')]===_0xca8a('0x4d')){var _0x40e678=_0x55509f[_0xca8a('0x25')]({'plain':!![]});var _0x540bd2='IvrCampaigns';return db['UserProfileSection'][_0xca8a('0x4b')]({'where':{'name':_0x540bd2,'userProfileId':_0x3342be[_0xca8a('0x50')]},'raw':!![]})[_0xca8a('0x24')](function(_0x2538bc){if(_0x2538bc&&_0x2538bc['autoAssociation']===0x0){return db[_0xca8a('0x26')][_0xca8a('0x4c')]({'name':_0x40e678[_0xca8a('0x2a')],'resourceId':_0x40e678['id'],'type':_0x2538bc[_0xca8a('0x2a')],'sectionId':_0x2538bc['id']},{})[_0xca8a('0x24')](function(){return _0x55509f;});}else{return _0x55509f;}})[_0xca8a('0x47')](function(_0x54cce9){logger[_0xca8a('0x28')](_0xca8a('0x51'),_0x54cce9);throw _0x54cce9;});}return _0x55509f;})['then'](respondWithResult(_0x281b1f,0xc9))[_0xca8a('0x47')](handleError(_0x281b1f,null));};exports[_0xca8a('0x52')]=function(_0x10e5c8,_0x4e91cf){var _0x309663={'where':{'id':_0x10e5c8[_0xca8a('0x49')]['id']}},_0x2ae12e={};_0x2ae12e[_0xca8a('0x31')]=_['keys'](db[_0xca8a('0x4a')][_0xca8a('0x2e')]);_0x309663['attributes']=_[_0xca8a('0x35')](_0x2ae12e[_0xca8a('0x31')],qs[_0xca8a('0x37')](_0x10e5c8[_0xca8a('0x32')][_0xca8a('0x37')]));_0x309663[_0xca8a('0x36')]=_0x309663['attributes'][_0xca8a('0x38')]?_0x309663[_0xca8a('0x36')]:_0x2ae12e[_0xca8a('0x31')];if(_0x10e5c8['query'][_0xca8a('0x43')]){_0x309663['include']=[{'all':!![]}];}_0x309663=_[_0xca8a('0x41')]({},_0x309663,_0x10e5c8['options']);return db[_0xca8a('0x4a')]['find'](_0x309663)[_0xca8a('0x24')](handleEntityNotFound(_0x4e91cf,null))['then'](function(_0x3f6af4){if(_0x3f6af4){var _0x2f04e8=_0x3f6af4[_0xca8a('0x25')]({'plain':!![]});_0x2f04e8=qs[_0xca8a('0x53')](_0x2f04e8,['id',_0xca8a('0x54'),'updatedAt']);_0x10e5c8['body']=_[_0xca8a('0x53')](_0x10e5c8[_0xca8a('0x55')],['id',_0xca8a('0x54'),_0xca8a('0x56')]);return db[_0xca8a('0x4a')][_0xca8a('0x4c')](_['merge'](_0x2f04e8,_0x10e5c8[_0xca8a('0x55')]),{'include':_0x10e5c8[_0xca8a('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0xca8a('0x24')](function(_0xc44737){var _0x43c9b3=_0x10e5c8[_0xca8a('0x4d')][_0xca8a('0x25')]({'plain':!![]});if(!_0x43c9b3)throw new Error(_0xca8a('0x4e'));if(_0x43c9b3[_0xca8a('0x4f')]===_0xca8a('0x4d')){var _0x5bafc7=_0xc44737[_0xca8a('0x25')]({'plain':!![]});var _0x10d0d5=_0xca8a('0x57');return db[_0xca8a('0x58')][_0xca8a('0x4b')]({'where':{'name':_0x10d0d5,'userProfileId':_0x43c9b3['userProfileId']},'raw':!![]})['then'](function(_0x36a7c5){if(_0x36a7c5&&_0x36a7c5['autoAssociation']===0x0){return db['UserProfileResource'][_0xca8a('0x4c')]({'name':_0x5bafc7['name'],'resourceId':_0x5bafc7['id'],'type':_0x36a7c5[_0xca8a('0x2a')],'sectionId':_0x36a7c5['id']},{})['then'](function(){return _0xc44737;});}else{return _0xc44737;}})['catch'](function(_0x51c376){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51c376);throw _0x51c376;});}return _0xc44737;});}})[_0xca8a('0x24')](respondWithResult(_0x4e91cf,0xc9))[_0xca8a('0x47')](handleError(_0x4e91cf,null));};exports[_0xca8a('0x23')]=function(_0x2e324f,_0x328df2){if(_0x2e324f[_0xca8a('0x55')]['id']){delete _0x2e324f[_0xca8a('0x55')]['id'];}return db[_0xca8a('0x4a')][_0xca8a('0x4b')]({'where':{'id':_0x2e324f[_0xca8a('0x49')]['id']}})[_0xca8a('0x24')](handleEntityNotFound(_0x328df2,null))[_0xca8a('0x24')](saveUpdates(_0x2e324f[_0xca8a('0x55')],null))[_0xca8a('0x24')](respondWithResult(_0x328df2,null))[_0xca8a('0x47')](handleError(_0x328df2,null));};exports[_0xca8a('0x59')]=function(_0x2ffc19,_0x4af5a6){return db[_0xca8a('0x4a')][_0xca8a('0x4b')]({'where':{'id':_0x2ffc19['params']['id']}})['then'](handleEntityNotFound(_0x4af5a6,null))[_0xca8a('0x24')](removeEntity(_0x4af5a6,null))[_0xca8a('0x47')](handleError(_0x4af5a6,null));};exports[_0xca8a('0x5a')]=function(_0x118aa0,_0x1186e8,_0x476eb4){var _0x16354a={'raw':!![],'where':{}};var _0x11da14={};var _0x6382e1={'count':0x0,'rows':[]};return db[_0xca8a('0x4a')][_0xca8a('0x5b')]({'where':{'id':_0x118aa0[_0xca8a('0x49')]['id']}})['then'](handleEntityNotFound(_0x1186e8,null))[_0xca8a('0x24')](function(_0x5bbc90){if(_0x5bbc90){_0x11da14['model']=_[_0xca8a('0x33')](db[_0xca8a('0x5c')][_0xca8a('0x2e')]);_0x11da14[_0xca8a('0x32')]=_['keys'](_0x118aa0[_0xca8a('0x32')]);_0x11da14[_0xca8a('0x34')]=_['intersection'](_0x11da14[_0xca8a('0x31')],_0x11da14[_0xca8a('0x32')]);_0x16354a[_0xca8a('0x36')]=_[_0xca8a('0x35')](_0x11da14[_0xca8a('0x31')],qs[_0xca8a('0x37')](_0x118aa0[_0xca8a('0x32')][_0xca8a('0x37')]));_0x16354a[_0xca8a('0x36')]=_0x16354a[_0xca8a('0x36')][_0xca8a('0x38')]?_0x16354a[_0xca8a('0x36')]:_0x11da14[_0xca8a('0x31')];if(!_0x118aa0[_0xca8a('0x32')]['hasOwnProperty']('nolimit')){_0x16354a['limit']=qs[_0xca8a('0x1c')](_0x118aa0[_0xca8a('0x32')][_0xca8a('0x1c')]);_0x16354a[_0xca8a('0x1a')]=qs[_0xca8a('0x1a')](_0x118aa0['query'][_0xca8a('0x1a')]);}_0x16354a['order']=qs[_0xca8a('0x3c')](_0x118aa0[_0xca8a('0x32')][_0xca8a('0x3c')]);_0x16354a[_0xca8a('0x3d')]=qs[_0xca8a('0x34')](_[_0xca8a('0x3e')](_0x118aa0[_0xca8a('0x32')],_0x11da14[_0xca8a('0x34')]));_0x16354a[_0xca8a('0x3d')][_0xca8a('0x5d')]=_0x5bbc90['id'];if(_0x118aa0[_0xca8a('0x32')]['filter']){_0x16354a[_0xca8a('0x3d')]=_[_0xca8a('0x41')](_0x16354a[_0xca8a('0x3d')],{'$or':_[_0xca8a('0x2d')](_0x16354a['attributes'],function(_0x2b1e95){var _0x3af9a6={};_0x3af9a6[_0x2b1e95]={'$like':'%'+_0x118aa0[_0xca8a('0x32')]['filter']+'%'};return _0x3af9a6;})});}_0x16354a=_[_0xca8a('0x41')]({},_0x16354a,_0x118aa0['options']);return db[_0xca8a('0x5c')][_0xca8a('0x1d')]({'where':_0x16354a['where']})[_0xca8a('0x24')](function(_0x30f9ea){_0x6382e1[_0xca8a('0x1d')]=_0x30f9ea;if(_0x118aa0[_0xca8a('0x32')]['includeAll']){_0x16354a[_0xca8a('0x44')]=[{'all':!![]}];}return db[_0xca8a('0x5c')][_0xca8a('0x45')](_0x16354a);})['then'](function(_0x9dc7a5){_0x6382e1['rows']=_0x9dc7a5;return _0x6382e1;});}})['then'](respondWithFilteredResult(_0x1186e8,_0x16354a))['catch'](handleError(_0x1186e8,null));};exports[_0xca8a('0x5e')]=function(_0x19ac9c,_0x532d2f,_0x26108c){var _0x4ca901={'raw':!![],'where':{}};var _0x1479de={};var _0xcd7671={'count':0x0,'rows':[]};return db[_0xca8a('0x4a')][_0xca8a('0x5b')]({'where':{'id':_0x19ac9c['params']['id']}})[_0xca8a('0x24')](handleEntityNotFound(_0x532d2f,null))[_0xca8a('0x24')](function(_0x1ffaae){if(_0x1ffaae){_0x1479de['model']=_[_0xca8a('0x33')](db['CmHopperHistory'][_0xca8a('0x2e')]);_0x1479de[_0xca8a('0x32')]=_[_0xca8a('0x33')](_0x19ac9c[_0xca8a('0x32')]);_0x1479de[_0xca8a('0x34')]=_[_0xca8a('0x35')](_0x1479de['model'],_0x1479de['query']);_0x4ca901['attributes']=_[_0xca8a('0x35')](_0x1479de[_0xca8a('0x31')],qs[_0xca8a('0x37')](_0x19ac9c[_0xca8a('0x32')][_0xca8a('0x37')]));_0x4ca901[_0xca8a('0x36')]=_0x4ca901['attributes'][_0xca8a('0x38')]?_0x4ca901[_0xca8a('0x36')]:_0x1479de['model'];if(!_0x19ac9c[_0xca8a('0x32')]['hasOwnProperty']('nolimit')){_0x4ca901[_0xca8a('0x1c')]=qs['limit'](_0x19ac9c[_0xca8a('0x32')][_0xca8a('0x1c')]);_0x4ca901['offset']=qs[_0xca8a('0x1a')](_0x19ac9c[_0xca8a('0x32')]['offset']);}_0x4ca901[_0xca8a('0x3b')]=qs[_0xca8a('0x3c')](_0x19ac9c[_0xca8a('0x32')]['sort']);_0x4ca901[_0xca8a('0x3d')]=qs['filters'](_[_0xca8a('0x3e')](_0x19ac9c[_0xca8a('0x32')],_0x1479de['filters']));_0x4ca901['where']['CampaignId']=_0x1ffaae['id'];if(_0x19ac9c[_0xca8a('0x32')][_0xca8a('0x3f')]){_0x4ca901[_0xca8a('0x3d')]=_[_0xca8a('0x41')](_0x4ca901[_0xca8a('0x3d')],{'$or':_[_0xca8a('0x2d')](_0x4ca901['attributes'],function(_0xcddc3d){var _0x383375={};_0x383375[_0xcddc3d]={'$like':'%'+_0x19ac9c['query'][_0xca8a('0x3f')]+'%'};return _0x383375;})});}_0x4ca901=_['merge']({},_0x4ca901,_0x19ac9c[_0xca8a('0x42')]);return db[_0xca8a('0x5f')][_0xca8a('0x1d')]({'where':_0x4ca901[_0xca8a('0x3d')]})['then'](function(_0x855671){_0xcd7671[_0xca8a('0x1d')]=_0x855671;if(_0x19ac9c['query']['includeAll']){_0x4ca901[_0xca8a('0x44')]=[{'all':!![]}];}return db[_0xca8a('0x5f')][_0xca8a('0x45')](_0x4ca901);})['then'](function(_0x4b1045){_0xcd7671['rows']=_0x4b1045;return _0xcd7671;});}})[_0xca8a('0x24')](respondWithFilteredResult(_0x532d2f,_0x4ca901))[_0xca8a('0x47')](handleError(_0x532d2f,null));};exports['getHopperFinals']=function(_0x1f3edd,_0x13be05,_0xd5a736){var _0x1380f7={'raw':!![],'where':{}};var _0x41e286={};var _0x107d44={'count':0x0,'rows':[]};return db['Campaign'][_0xca8a('0x5b')]({'where':{'id':_0x1f3edd[_0xca8a('0x49')]['id']}})[_0xca8a('0x24')](handleEntityNotFound(_0x13be05,null))[_0xca8a('0x24')](function(_0x4ef71e){if(_0x4ef71e){_0x41e286[_0xca8a('0x31')]=_[_0xca8a('0x33')](db[_0xca8a('0x60')][_0xca8a('0x2e')]);_0x41e286[_0xca8a('0x32')]=_['keys'](_0x1f3edd[_0xca8a('0x32')]);_0x41e286[_0xca8a('0x34')]=_[_0xca8a('0x35')](_0x41e286['model'],_0x41e286[_0xca8a('0x32')]);_0x1380f7[_0xca8a('0x36')]=_[_0xca8a('0x35')](_0x41e286[_0xca8a('0x31')],qs[_0xca8a('0x37')](_0x1f3edd['query'][_0xca8a('0x37')]));_0x1380f7[_0xca8a('0x36')]=_0x1380f7['attributes'][_0xca8a('0x38')]?_0x1380f7[_0xca8a('0x36')]:_0x41e286[_0xca8a('0x31')];if(!_0x1f3edd[_0xca8a('0x32')][_0xca8a('0x39')](_0xca8a('0x3a'))){_0x1380f7['limit']=qs[_0xca8a('0x1c')](_0x1f3edd[_0xca8a('0x32')]['limit']);_0x1380f7[_0xca8a('0x1a')]=qs[_0xca8a('0x1a')](_0x1f3edd[_0xca8a('0x32')][_0xca8a('0x1a')]);}_0x1380f7['order']=qs['sort'](_0x1f3edd[_0xca8a('0x32')][_0xca8a('0x3c')]);_0x1380f7[_0xca8a('0x3d')]=qs[_0xca8a('0x34')](_[_0xca8a('0x3e')](_0x1f3edd['query'],_0x41e286[_0xca8a('0x34')]));_0x1380f7[_0xca8a('0x3d')]['CampaignId']=_0x4ef71e['id'];if(_0x1f3edd[_0xca8a('0x32')][_0xca8a('0x3f')]){_0x1380f7[_0xca8a('0x3d')]=_[_0xca8a('0x41')](_0x1380f7[_0xca8a('0x3d')],{'$or':_[_0xca8a('0x2d')](_0x1380f7['attributes'],function(_0x11377e){var _0x2644c6={};_0x2644c6[_0x11377e]={'$like':'%'+_0x1f3edd['query'][_0xca8a('0x3f')]+'%'};return _0x2644c6;})});}_0x1380f7=_[_0xca8a('0x41')]({},_0x1380f7,_0x1f3edd[_0xca8a('0x42')]);return db[_0xca8a('0x60')][_0xca8a('0x1d')]({'where':_0x1380f7[_0xca8a('0x3d')]})[_0xca8a('0x24')](function(_0x3b0774){_0x107d44[_0xca8a('0x1d')]=_0x3b0774;if(_0x1f3edd[_0xca8a('0x32')]['includeAll']){_0x1380f7[_0xca8a('0x44')]=[{'all':!![]}];}return db[_0xca8a('0x60')]['findAll'](_0x1380f7);})[_0xca8a('0x24')](function(_0x1172f8){_0x107d44[_0xca8a('0x46')]=_0x1172f8;return _0x107d44;});}})[_0xca8a('0x24')](respondWithFilteredResult(_0x13be05,_0x1380f7))[_0xca8a('0x47')](handleError(_0x13be05,null));};exports[_0xca8a('0x61')]=function(_0x483e86,_0x5d1c89,_0x4bb822){var _0x4d0837={'raw':!![],'where':{}};var _0x2ad8ee={};var _0x1856ba={'count':0x0,'rows':[]};return db[_0xca8a('0x4a')][_0xca8a('0x5b')]({'where':{'id':_0x483e86[_0xca8a('0x49')]['id']}})[_0xca8a('0x24')](handleEntityNotFound(_0x5d1c89,null))['then'](function(_0x264a66){if(_0x264a66){_0x2ad8ee['model']=_[_0xca8a('0x33')](db[_0xca8a('0x62')][_0xca8a('0x2e')]);_0x2ad8ee[_0xca8a('0x32')]=_[_0xca8a('0x33')](_0x483e86[_0xca8a('0x32')]);_0x2ad8ee['filters']=_[_0xca8a('0x35')](_0x2ad8ee[_0xca8a('0x31')],_0x2ad8ee[_0xca8a('0x32')]);_0x4d0837[_0xca8a('0x36')]=_[_0xca8a('0x35')](_0x2ad8ee[_0xca8a('0x31')],qs[_0xca8a('0x37')](_0x483e86[_0xca8a('0x32')][_0xca8a('0x37')]));_0x4d0837['attributes']=_0x4d0837[_0xca8a('0x36')][_0xca8a('0x38')]?_0x4d0837[_0xca8a('0x36')]:_0x2ad8ee[_0xca8a('0x31')];if(!_0x483e86[_0xca8a('0x32')]['hasOwnProperty'](_0xca8a('0x3a'))){_0x4d0837[_0xca8a('0x1c')]=qs[_0xca8a('0x1c')](_0x483e86[_0xca8a('0x32')][_0xca8a('0x1c')]);_0x4d0837['offset']=qs[_0xca8a('0x1a')](_0x483e86['query'][_0xca8a('0x1a')]);}_0x4d0837[_0xca8a('0x3b')]=qs[_0xca8a('0x3c')](_0x483e86[_0xca8a('0x32')][_0xca8a('0x3c')]);_0x4d0837[_0xca8a('0x3d')]=qs[_0xca8a('0x34')](_['pick'](_0x483e86[_0xca8a('0x32')],_0x2ad8ee['filters']));_0x4d0837['where'][_0xca8a('0x5d')]=_0x264a66['id'];if(_0x483e86[_0xca8a('0x32')][_0xca8a('0x3f')]){_0x4d0837['where']=_[_0xca8a('0x41')](_0x4d0837[_0xca8a('0x3d')],{'$or':_['map'](_0x4d0837[_0xca8a('0x36')],function(_0x2098c7){var _0x572c5a={};_0x572c5a[_0x2098c7]={'$like':'%'+_0x483e86[_0xca8a('0x32')][_0xca8a('0x3f')]+'%'};return _0x572c5a;})});}_0x4d0837=_['merge']({},_0x4d0837,_0x483e86[_0xca8a('0x42')]);return db[_0xca8a('0x62')][_0xca8a('0x1d')]({'where':_0x4d0837['where']})[_0xca8a('0x24')](function(_0x124fef){_0x1856ba[_0xca8a('0x1d')]=_0x124fef;if(_0x483e86['query'][_0xca8a('0x43')]){_0x4d0837[_0xca8a('0x44')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x4d0837);})[_0xca8a('0x24')](function(_0x30f091){_0x1856ba[_0xca8a('0x46')]=_0x30f091;return _0x1856ba;});}})[_0xca8a('0x24')](respondWithFilteredResult(_0x5d1c89,_0x4d0837))[_0xca8a('0x47')](handleError(_0x5d1c89,null));};exports[_0xca8a('0x63')]=function(_0x5858c2,_0x41bae9,_0x3d683f){var _0xfc0aab={};var _0x824c0c={};var _0x363da0;var _0x4a4865;return db[_0xca8a('0x4a')][_0xca8a('0x5b')]({'where':{'id':_0x5858c2[_0xca8a('0x49')]['id']}})[_0xca8a('0x24')](handleEntityNotFound(_0x41bae9,null))[_0xca8a('0x24')](function(_0x4a66d7){if(_0x4a66d7){_0x363da0=_0x4a66d7;_0x824c0c['model']=_[_0xca8a('0x33')](db[_0xca8a('0x64')][_0xca8a('0x2e')]);_0x824c0c[_0xca8a('0x32')]=_[_0xca8a('0x33')](_0x5858c2['query']);_0x824c0c[_0xca8a('0x34')]=_[_0xca8a('0x35')](_0x824c0c[_0xca8a('0x31')],_0x824c0c[_0xca8a('0x32')]);_0xfc0aab[_0xca8a('0x36')]=_[_0xca8a('0x35')](_0x824c0c[_0xca8a('0x31')],qs[_0xca8a('0x37')](_0x5858c2[_0xca8a('0x32')]['fields']));_0xfc0aab['attributes']=_0xfc0aab['attributes']['length']?_0xfc0aab[_0xca8a('0x36')]:_0x824c0c[_0xca8a('0x31')];_0xfc0aab[_0xca8a('0x3b')]=qs[_0xca8a('0x3c')](_0x5858c2[_0xca8a('0x32')]['sort']);_0xfc0aab['where']=qs[_0xca8a('0x34')](_[_0xca8a('0x3e')](_0x5858c2[_0xca8a('0x32')],_0x824c0c[_0xca8a('0x34')]));if(_0x5858c2[_0xca8a('0x32')]['filter']){_0xfc0aab[_0xca8a('0x3d')]=_[_0xca8a('0x41')](_0xfc0aab[_0xca8a('0x3d')],{'$or':_[_0xca8a('0x2d')](_0xfc0aab['attributes'],function(_0x4f13ec){var _0x335f04={};_0x335f04[_0x4f13ec]={'$like':'%'+_0x5858c2[_0xca8a('0x32')][_0xca8a('0x3f')]+'%'};return _0x335f04;})});}_0xfc0aab=_[_0xca8a('0x41')]({},_0xfc0aab,_0x5858c2[_0xca8a('0x42')]);return _0x363da0[_0xca8a('0x63')](_0xfc0aab);}})[_0xca8a('0x24')](function(_0x350552){if(_0x350552){_0x4a4865=_0x350552['length'];if(!_0x5858c2[_0xca8a('0x32')][_0xca8a('0x39')](_0xca8a('0x3a'))){_0xfc0aab[_0xca8a('0x1c')]=qs[_0xca8a('0x1c')](_0x5858c2[_0xca8a('0x32')][_0xca8a('0x1c')]);_0xfc0aab[_0xca8a('0x1a')]=qs[_0xca8a('0x1a')](_0x5858c2['query'][_0xca8a('0x1a')]);}return _0x363da0[_0xca8a('0x63')](_0xfc0aab);}})[_0xca8a('0x24')](function(_0x12b4ff){if(_0x12b4ff){return _0x12b4ff?{'count':_0x4a4865,'rows':_0x12b4ff}:null;}})[_0xca8a('0x24')](respondWithResult(_0x41bae9,null))[_0xca8a('0x47')](handleError(_0x41bae9,null));};exports[_0xca8a('0x65')]=function(_0x589bc6,_0x590955,_0xe13f4b){var _0xed013b,_0x1a6dbf;var _0x5465e3=[];var _0x460427=moment()[_0xca8a('0x66')](_0xca8a('0x67'));return db[_0xca8a('0x4a')]['find']({'where':{'id':_0x589bc6[_0xca8a('0x49')]['id']}})[_0xca8a('0x24')](handleEntityNotFound(_0x590955,null))[_0xca8a('0x24')](function(_0x3564ab){if(_0x3564ab){_0x1a6dbf=_0x3564ab;return _0x3564ab['addLists'](_0x589bc6[_0xca8a('0x55')][_0xca8a('0x68')],_['omit'](_0x589bc6[_0xca8a('0x55')],[_0xca8a('0x68'),'id'])||{});}return null;})[_0xca8a('0x69')](function(_0x581d65){var _0xdf9b88;var _0x4a0b4d;_0xed013b=_0x581d65||[];var _0x2d18a9=[];if(_0x581d65){for(var _0xc852ab=0x0;_0xc852ab<_0x581d65[_0xca8a('0x38')];_0xc852ab+=0x1){var _0x499f67=_0x581d65[_0xc852ab][_0xca8a('0x25')]({'plain':!![]});_0x1a6dbf[_0xca8a('0x6a')]=_0x589bc6[_0xca8a('0x55')]['dialCheckDuplicateType']?_0x589bc6[_0xca8a('0x55')][_0xca8a('0x6a')]:_0x1a6dbf[_0xca8a('0x6a')];switch(_0x1a6dbf[_0xca8a('0x6a')]){case _0xca8a('0x6b'):_0xdf9b88=squel[_0xca8a('0x6c')]()[_0xca8a('0x6d')](_0xca8a('0x6e'))['fromQuery']([_0xca8a('0x6f'),_0xca8a('0x70'),_0xca8a('0x71'),'ListId',_0xca8a('0x5d'),_0xca8a('0x54'),_0xca8a('0x56')],squel['select']()[_0xca8a('0x72')]('phone',_0xca8a('0x6f'))[_0xca8a('0x72')]('NOW()','scheduledAt')['field']('id',_0xca8a('0x71'))[_0xca8a('0x72')](_0x499f67[_0xca8a('0x73')][_0xca8a('0x74')](),'ListId')[_0xca8a('0x72')](_0x589bc6[_0xca8a('0x49')]['id'][_0xca8a('0x74')](),_0xca8a('0x5d'))[_0xca8a('0x72')]('\x27'+_0x460427+'\x27',_0xca8a('0x54'))[_0xca8a('0x72')]('\x27'+_0x460427+'\x27',_0xca8a('0x56'))[_0xca8a('0x75')]('cm_contacts')['where'](_0xca8a('0x76'))[_0xca8a('0x3d')](_0xca8a('0x77'),_0x499f67[_0xca8a('0x73')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0xca8a('0x3d')](_0xca8a('0x78'),squel['select']()[_0xca8a('0x72')]('COALESCE(calleridnum,\x27\x27)')[_0xca8a('0x75')](_0xca8a('0x79'))[_0xca8a('0x3d')](_0xca8a('0x7a'),_0x589bc6['params']['id'][_0xca8a('0x74')]()))[_0xca8a('0x3d')](_0xca8a('0x78'),squel[_0xca8a('0x7b')]()[_0xca8a('0x72')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0xca8a('0x3d')](_0xca8a('0x7a'),_0x589bc6[_0xca8a('0x49')]['id'][_0xca8a('0x74')]())))[_0xca8a('0x74')]();break;case'onlyIfOpen':_0xdf9b88=squel[_0xca8a('0x6c')]()['into'](_0xca8a('0x6e'))[_0xca8a('0x7c')]([_0xca8a('0x6f'),_0xca8a('0x70'),'ContactId',_0xca8a('0x7d'),_0xca8a('0x5d'),_0xca8a('0x54'),_0xca8a('0x56')],squel[_0xca8a('0x7b')]()[_0xca8a('0x72')](_0xca8a('0x6f'),_0xca8a('0x6f'))['field']('NOW()','scheduledAt')[_0xca8a('0x72')]('id',_0xca8a('0x71'))['field'](_0x499f67[_0xca8a('0x73')]['toString'](),_0xca8a('0x7d'))[_0xca8a('0x72')](_0x589bc6[_0xca8a('0x49')]['id']['toString'](),_0xca8a('0x5d'))[_0xca8a('0x72')]('\x27'+_0x460427+'\x27',_0xca8a('0x54'))[_0xca8a('0x72')]('\x27'+_0x460427+'\x27',_0xca8a('0x56'))[_0xca8a('0x75')](_0xca8a('0x7e'))[_0xca8a('0x3d')](_0xca8a('0x76'))[_0xca8a('0x3d')]('ListId\x20=\x20?',_0x499f67[_0xca8a('0x73')][_0xca8a('0x74')]())[_0xca8a('0x3d')](_0xca8a('0x7f'))['where'](_0xca8a('0x78'),squel[_0xca8a('0x7b')]()[_0xca8a('0x72')](_0xca8a('0x80'))[_0xca8a('0x75')]('cm_hopper')['where'](_0xca8a('0x7a'),_0x589bc6[_0xca8a('0x49')]['id'][_0xca8a('0x74')]())))['toString']();break;default:_0xdf9b88=squel[_0xca8a('0x6c')]()[_0xca8a('0x6d')](_0xca8a('0x6e'))[_0xca8a('0x7c')]([_0xca8a('0x6f'),_0xca8a('0x70'),_0xca8a('0x71'),_0xca8a('0x7d'),_0xca8a('0x5d'),_0xca8a('0x54'),_0xca8a('0x56')],squel[_0xca8a('0x7b')]()[_0xca8a('0x72')](_0xca8a('0x6f'),'phone')[_0xca8a('0x72')]('NOW()','scheduledAt')['field']('id',_0xca8a('0x71'))[_0xca8a('0x72')](_0x499f67['CmListId'][_0xca8a('0x74')](),'ListId')[_0xca8a('0x72')](_0x589bc6['params']['id'][_0xca8a('0x74')](),_0xca8a('0x5d'))['field']('\x27'+_0x460427+'\x27','createdAt')[_0xca8a('0x72')]('\x27'+_0x460427+'\x27',_0xca8a('0x56'))[_0xca8a('0x75')](_0xca8a('0x7e'))['where'](_0xca8a('0x76'))['where'](_0xca8a('0x77'),_0x499f67[_0xca8a('0x73')][_0xca8a('0x74')]())[_0xca8a('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0xca8a('0x74')]();}_0x4a0b4d=squel[_0xca8a('0x6c')]()['into'](_0xca8a('0x81'))[_0xca8a('0x7c')]([_0xca8a('0x82'),_0xca8a('0x70'),_0xca8a('0x6f'),_0xca8a('0x83'),'createdAt',_0xca8a('0x56')],squel[_0xca8a('0x7b')]()[_0xca8a('0x72')]('h.id','id')['field'](_0xca8a('0x84'),_0xca8a('0x70'))[_0xca8a('0x72')](_0xca8a('0x85'),'phone')['field']('ci.OrderBY','OrderBy')[_0xca8a('0x72')]('\x27'+_0x460427+'\x27',_0xca8a('0x54'))['field']('\x27'+_0x460427+'\x27',_0xca8a('0x56'))['from'](_0xca8a('0x86'),'ci')['join'](_0xca8a('0x6e'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0xca8a('0x3d')](_0xca8a('0x87'),_0x499f67['CmListId'][_0xca8a('0x74')]())[_0xca8a('0x3d')](_0xca8a('0x88'),_0x589bc6[_0xca8a('0x49')]['id'][_0xca8a('0x74')]())['where'](_0xca8a('0x89'),_0x460427))[_0xca8a('0x74')]();_0x2d18a9[_0xca8a('0x8a')](db[_0xca8a('0x8b')]['query'](_0xdf9b88));_0x5465e3[_0xca8a('0x8a')](db[_0xca8a('0x8b')]['query'](_0x4a0b4d));}return BPromise[_0xca8a('0x8c')](_0x2d18a9);}})[_0xca8a('0x24')](function(){return BPromise['all'](_0x5465e3);})[_0xca8a('0x24')](function(){return _0xed013b;})[_0xca8a('0x24')](respondWithResult(_0x590955,null))[_0xca8a('0x47')](handleError(_0x590955,null));};exports['removeLists']=function(_0x36df50,_0x4d3c30,_0x265031){return db[_0xca8a('0x4a')][_0xca8a('0x4b')]({'where':{'id':_0x36df50[_0xca8a('0x49')]['id']}})[_0xca8a('0x24')](handleEntityNotFound(_0x4d3c30,null))[_0xca8a('0x24')](function(_0x32769e){if(_0x32769e){return _0x32769e[_0xca8a('0x8d')](_0x36df50['query'][_0xca8a('0x68')]);}})[_0xca8a('0x24')](function(_0x3226ca){if(_0x3226ca){return db['CmHopper'][_0xca8a('0x59')]({'where':{'ListId':_0x36df50['query']['ids'],'CampaignId':_0x36df50[_0xca8a('0x49')]['id']}})[_0xca8a('0x24')](function(){return _0x3226ca;});}})['then'](respondWithStatusCode(_0x4d3c30,null))['catch'](handleError(_0x4d3c30,null));};exports[_0xca8a('0x8e')]=function(_0x3276df,_0x5466d6,_0x4fc7c1){var _0x2487eb={};var _0x5975fd={};var _0x403e86;var _0x455afc;return db[_0xca8a('0x4a')][_0xca8a('0x5b')]({'where':{'id':_0x3276df[_0xca8a('0x49')]['id']}})[_0xca8a('0x24')](handleEntityNotFound(_0x5466d6,null))[_0xca8a('0x24')](function(_0x1c1a3c){if(_0x1c1a3c){_0x403e86=_0x1c1a3c;_0x5975fd['model']=_[_0xca8a('0x33')](db[_0xca8a('0x64')][_0xca8a('0x2e')]);_0x5975fd[_0xca8a('0x32')]=_[_0xca8a('0x33')](_0x3276df['query']);_0x5975fd[_0xca8a('0x34')]=_[_0xca8a('0x35')](_0x5975fd[_0xca8a('0x31')],_0x5975fd['query']);_0x2487eb[_0xca8a('0x36')]=_[_0xca8a('0x35')](_0x5975fd[_0xca8a('0x31')],qs['fields'](_0x3276df[_0xca8a('0x32')][_0xca8a('0x37')]));_0x2487eb['attributes']=_0x2487eb['attributes']['length']?_0x2487eb['attributes']:_0x5975fd[_0xca8a('0x31')];_0x2487eb[_0xca8a('0x3b')]=qs[_0xca8a('0x3c')](_0x3276df['query'][_0xca8a('0x3c')]);_0x2487eb['where']=qs[_0xca8a('0x34')](_[_0xca8a('0x3e')](_0x3276df[_0xca8a('0x32')],_0x5975fd[_0xca8a('0x34')]));if(_0x3276df[_0xca8a('0x32')][_0xca8a('0x3f')]){_0x2487eb[_0xca8a('0x3d')]=_[_0xca8a('0x41')](_0x2487eb['where'],{'$or':_[_0xca8a('0x2d')](_0x2487eb['attributes'],function(_0x23583f){var _0xd83e28={};_0xd83e28[_0x23583f]={'$like':'%'+_0x3276df[_0xca8a('0x32')]['filter']+'%'};return _0xd83e28;})});}_0x2487eb=_[_0xca8a('0x41')]({},_0x2487eb,_0x3276df[_0xca8a('0x42')]);return _0x403e86[_0xca8a('0x8e')](_0x2487eb);}})[_0xca8a('0x24')](function(_0x3676a3){if(_0x3676a3){_0x455afc=_0x3676a3[_0xca8a('0x38')];if(!_0x3276df[_0xca8a('0x32')]['hasOwnProperty'](_0xca8a('0x3a'))){_0x2487eb[_0xca8a('0x1c')]=qs[_0xca8a('0x1c')](_0x3276df[_0xca8a('0x32')][_0xca8a('0x1c')]);_0x2487eb['offset']=qs[_0xca8a('0x1a')](_0x3276df[_0xca8a('0x32')][_0xca8a('0x1a')]);}return _0x403e86[_0xca8a('0x8e')](_0x2487eb);}})['then'](function(_0x5cbbc4){if(_0x5cbbc4){return _0x5cbbc4?{'count':_0x455afc,'rows':_0x5cbbc4}:null;}})[_0xca8a('0x24')](respondWithResult(_0x5466d6,null))[_0xca8a('0x47')](handleError(_0x5466d6,null));};exports['addBlackLists']=function(_0x6985c1,_0x11e17e,_0x106497){var _0x58c538,_0x56f357;var _0x5d6358=[];var _0x4e8700=moment()[_0xca8a('0x66')](_0xca8a('0x67'));return db['Campaign'][_0xca8a('0x4b')]({'where':{'id':_0x6985c1[_0xca8a('0x49')]['id']}})['then'](handleEntityNotFound(_0x11e17e,null))[_0xca8a('0x24')](function(_0x366e96){if(_0x366e96){_0x56f357=_0x366e96;return _0x366e96[_0xca8a('0x8f')](_0x6985c1[_0xca8a('0x55')][_0xca8a('0x68')],_[_0xca8a('0x53')](_0x6985c1[_0xca8a('0x55')],['ids','id'])||{});}return null;})[_0xca8a('0x69')](function(_0x1208ed){var _0x384423;var _0x56914f;_0x58c538=_0x1208ed||[];var _0x327a37=[];if(_0x1208ed){for(var _0x138707=0x0;_0x138707<_0x1208ed[_0xca8a('0x38')];_0x138707+=0x1){var _0x7c7143=_0x1208ed[_0x138707]['get']({'plain':!![]});_0x384423=squel[_0xca8a('0x6c')]()[_0xca8a('0x6d')](_0xca8a('0x90'))[_0xca8a('0x7c')]([_0xca8a('0x6f'),_0xca8a('0x71'),_0xca8a('0x7d'),_0xca8a('0x5d'),'createdAt',_0xca8a('0x56')],squel['select']()[_0xca8a('0x72')](_0xca8a('0x6f'),_0xca8a('0x6f'))[_0xca8a('0x72')]('id',_0xca8a('0x71'))[_0xca8a('0x72')](_0x7c7143[_0xca8a('0x73')][_0xca8a('0x74')](),'ListId')['field'](_0x6985c1[_0xca8a('0x49')]['id'][_0xca8a('0x74')](),_0xca8a('0x5d'))[_0xca8a('0x72')](_0xca8a('0x84'),'createdAt')[_0xca8a('0x72')](_0xca8a('0x84'),_0xca8a('0x56'))[_0xca8a('0x75')]('cm_contacts')[_0xca8a('0x3d')](_0xca8a('0x76'))['where'](_0xca8a('0x77'),_0x7c7143[_0xca8a('0x73')][_0xca8a('0x74')]())[_0xca8a('0x3d')](_0xca8a('0x7f')))[_0xca8a('0x74')]();_0x327a37[_0xca8a('0x8a')](db[_0xca8a('0x8b')]['query'](_0x384423));}return BPromise[_0xca8a('0x8c')](_0x327a37);}})['then'](function(){return _0x58c538;})['then'](respondWithResult(_0x11e17e,null))[_0xca8a('0x47')](handleError(_0x11e17e,null));};exports[_0xca8a('0x91')]=function(_0x3a6aac,_0x3bc122,_0x30dcd6){return db[_0xca8a('0x4a')][_0xca8a('0x4b')]({'where':{'id':_0x3a6aac[_0xca8a('0x49')]['id']}})['then'](handleEntityNotFound(_0x3bc122,null))['then'](function(_0x143407){if(_0x143407){return _0x143407[_0xca8a('0x91')](_0x3a6aac[_0xca8a('0x32')][_0xca8a('0x68')]);}})['then'](function(_0x5c0626){if(_0x5c0626){return db[_0xca8a('0x62')][_0xca8a('0x59')]({'where':{'ListId':_0x3a6aac[_0xca8a('0x32')][_0xca8a('0x68')],'CampaignId':_0x3a6aac[_0xca8a('0x49')]['id']}})['then'](function(){return _0x5c0626;});}})['then'](respondWithStatusCode(_0x3bc122,null))[_0xca8a('0x47')](handleError(_0x3bc122,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 03f5ea5..a161b0d 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x311c35,_0x54a2b0){var _0x31ff65=function(_0x2efbe1){while(--_0x2efbe1){_0x311c35['push'](_0x311c35['shift']());}};_0x31ff65(++_0x54a2b0);}(_0x7a54,0x106));var _0x47a5=function(_0x3b239d,_0x164041){_0x3b239d=_0x3b239d-0x0;var _0x490a9a=_0x7a54[_0x3b239d];return _0x490a9a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 3ca886b..26a811e 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 _0xc125=['where','attributes','limit','include','model','map','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','options','raw'];(function(_0x4479d8,_0x20f0fd){var _0x2827c6=function(_0x59a333){while(--_0x59a333){_0x4479d8['push'](_0x4479d8['shift']());}};_0x2827c6(++_0x20f0fd);}(_0xc125,0x150));var _0x5c12=function(_0x355ed7,_0x3277bc){_0x355ed7=_0x355ed7-0x0;var _0xeae99a=_0xc125[_0x355ed7];return _0xeae99a;};'use strict';var _=require('lodash');var util=require(_0x5c12('0x0'));var moment=require('moment');var BPromise=require(_0x5c12('0x1'));var rs=require(_0x5c12('0x2'));var fs=require('fs');var Redis=require(_0x5c12('0x3'));var db=require(_0x5c12('0x4'))['db'];var utils=require(_0x5c12('0x5'));var logger=require(_0x5c12('0x6'))(_0x5c12('0x7'));var config=require(_0x5c12('0x8'));var jayson=require(_0x5c12('0x9'));var client=jayson[_0x5c12('0xa')][_0x5c12('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11ace0,_0x4cab65,_0x1d0635){return new BPromise(function(_0x4465e3,_0x52a111){return client[_0x5c12('0xc')](_0x11ace0,_0x1d0635)[_0x5c12('0xd')](function(_0x3f7347){logger[_0x5c12('0xe')](_0x5c12('0xf'),_0x4cab65,_0x5c12('0x10'));logger[_0x5c12('0x11')](_0x5c12('0x12'),_0x4cab65,'request\x20sent',JSON[_0x5c12('0x13')](_0x3f7347));if(_0x3f7347[_0x5c12('0x14')]){if(_0x3f7347[_0x5c12('0x14')][_0x5c12('0x15')]===0x1f4){logger[_0x5c12('0x14')]('Campaign,\x20%s,\x20%s',_0x4cab65,_0x3f7347['error'][_0x5c12('0x16')]);return _0x52a111(_0x3f7347['error'][_0x5c12('0x16')]);}logger[_0x5c12('0x14')](_0x5c12('0xf'),_0x4cab65,_0x3f7347['error']['message']);return _0x4465e3(_0x3f7347[_0x5c12('0x14')][_0x5c12('0x16')]);}else{logger['info'](_0x5c12('0xf'),_0x4cab65,_0x5c12('0x10'));_0x4465e3(_0x3f7347[_0x5c12('0x17')]['message']);}})['catch'](function(_0x1d6487){logger[_0x5c12('0x14')](_0x5c12('0xf'),_0x4cab65,_0x1d6487);_0x52a111(_0x1d6487);});});}exports[_0x5c12('0x18')]=function(_0x1bd895){var _0xf1daab=this;return new Promise(function(_0x16543f,_0x2a6528){return db['Campaign']['findAll']({'raw':_0x1bd895[_0x5c12('0x19')]?_0x1bd895[_0x5c12('0x19')][_0x5c12('0x1a')]===undefined?!![]:![]:!![],'where':_0x1bd895[_0x5c12('0x19')]?_0x1bd895['options'][_0x5c12('0x1b')]||null:null,'attributes':_0x1bd895['options']?_0x1bd895[_0x5c12('0x19')][_0x5c12('0x1c')]||null:null,'limit':_0x1bd895['options']?_0x1bd895['options'][_0x5c12('0x1d')]||null:null,'include':_0x1bd895[_0x5c12('0x19')]?_0x1bd895['options'][_0x5c12('0x1e')]?_['map'](_0x1bd895[_0x5c12('0x19')][_0x5c12('0x1e')],function(_0x1d9e30){return{'model':db[_0x1d9e30[_0x5c12('0x1f')]],'as':_0x1d9e30['as'],'attributes':_0x1d9e30[_0x5c12('0x1c')],'include':_0x1d9e30[_0x5c12('0x1e')]?_[_0x5c12('0x20')](_0x1d9e30[_0x5c12('0x1e')],function(_0xca0f79){return{'model':db[_0xca0f79[_0x5c12('0x1f')]],'as':_0xca0f79['as'],'attributes':_0xca0f79[_0x5c12('0x1c')],'include':_0xca0f79[_0x5c12('0x1e')]?_[_0x5c12('0x20')](_0xca0f79['include'],function(_0x37979e){return{'model':db[_0x37979e[_0x5c12('0x1f')]],'as':_0x37979e['as'],'attributes':_0x37979e[_0x5c12('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5c12('0xd')](function(_0x2623b6){logger[_0x5c12('0xe')]('GetCampaign',_0x1bd895);logger[_0x5c12('0x11')](_0x5c12('0x18'),_0x1bd895,JSON[_0x5c12('0x13')](_0x2623b6));_0x16543f(_0x2623b6);})['catch'](function(_0x5815d4){logger[_0x5c12('0x14')](_0x5c12('0x18'),_0x5815d4['message'],_0x1bd895);_0x2a6528(_0xf1daab[_0x5c12('0x14')](0x1f4,_0x5815d4[_0x5c12('0x16')]));});});}; \ No newline at end of file +var _0x6b19=['message','result','catch','GetCampaign','findAll','options','raw','where','limit','include','map','model','attributes','then','stringify','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error'];(function(_0x42c114,_0x401711){var _0x42a726=function(_0x1c17b7){while(--_0x1c17b7){_0x42c114['push'](_0x42c114['shift']());}};_0x42a726(++_0x401711);}(_0x6b19,0xe8));var _0x96b1=function(_0x36d2a8,_0x586577){_0x36d2a8=_0x36d2a8-0x0;var _0x1b7a19=_0x6b19[_0x36d2a8];return _0x1b7a19;};'use strict';var _=require(_0x96b1('0x0'));var util=require(_0x96b1('0x1'));var moment=require('moment');var BPromise=require(_0x96b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96b1('0x3'))['db'];var utils=require(_0x96b1('0x4'));var logger=require(_0x96b1('0x5'))(_0x96b1('0x6'));var config=require(_0x96b1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x96b1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e3e1a,_0x572fde,_0x57a23a){return new BPromise(function(_0x307e65,_0x535cc9){return client[_0x96b1('0x9')](_0x3e3e1a,_0x57a23a)['then'](function(_0x36ea50){logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x572fde,_0x96b1('0xc'));logger[_0x96b1('0xd')](_0x96b1('0xe'),_0x572fde,_0x96b1('0xc'),JSON['stringify'](_0x36ea50));if(_0x36ea50['error']){if(_0x36ea50[_0x96b1('0xf')]['code']===0x1f4){logger['error'](_0x96b1('0xb'),_0x572fde,_0x36ea50[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x535cc9(_0x36ea50['error'][_0x96b1('0x10')]);}logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x572fde,_0x36ea50[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x307e65(_0x36ea50['error'][_0x96b1('0x10')]);}else{logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x572fde,_0x96b1('0xc'));_0x307e65(_0x36ea50[_0x96b1('0x11')][_0x96b1('0x10')]);}})[_0x96b1('0x12')](function(_0x2d5a32){logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x572fde,_0x2d5a32);_0x535cc9(_0x2d5a32);});});}exports[_0x96b1('0x13')]=function(_0x38478c){var _0x2b192a=this;return new Promise(function(_0x19972b,_0x212b31){return db['Campaign'][_0x96b1('0x14')]({'raw':_0x38478c['options']?_0x38478c[_0x96b1('0x15')][_0x96b1('0x16')]===undefined?!![]:![]:!![],'where':_0x38478c[_0x96b1('0x15')]?_0x38478c['options'][_0x96b1('0x17')]||null:null,'attributes':_0x38478c[_0x96b1('0x15')]?_0x38478c[_0x96b1('0x15')]['attributes']||null:null,'limit':_0x38478c[_0x96b1('0x15')]?_0x38478c[_0x96b1('0x15')][_0x96b1('0x18')]||null:null,'include':_0x38478c[_0x96b1('0x15')]?_0x38478c['options'][_0x96b1('0x19')]?_[_0x96b1('0x1a')](_0x38478c[_0x96b1('0x15')]['include'],function(_0x2b4f8e){return{'model':db[_0x2b4f8e[_0x96b1('0x1b')]],'as':_0x2b4f8e['as'],'attributes':_0x2b4f8e[_0x96b1('0x1c')],'include':_0x2b4f8e[_0x96b1('0x19')]?_['map'](_0x2b4f8e[_0x96b1('0x19')],function(_0x548bae){return{'model':db[_0x548bae[_0x96b1('0x1b')]],'as':_0x548bae['as'],'attributes':_0x548bae['attributes'],'include':_0x548bae[_0x96b1('0x19')]?_[_0x96b1('0x1a')](_0x548bae['include'],function(_0x50dcbc){return{'model':db[_0x50dcbc['model']],'as':_0x50dcbc['as'],'attributes':_0x50dcbc[_0x96b1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x96b1('0x1d')](function(_0x18e56a){logger[_0x96b1('0xa')](_0x96b1('0x13'),_0x38478c);logger['debug'](_0x96b1('0x13'),_0x38478c,JSON[_0x96b1('0x1e')](_0x18e56a));_0x19972b(_0x18e56a);})[_0x96b1('0x12')](function(_0x209ce8){logger['error'](_0x96b1('0x13'),_0x209ce8[_0x96b1('0x10')],_0x38478c);_0x212b31(_0x2b192a['error'](0x1f4,_0x209ce8['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 72112e6..a5f800d 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 _0x76bb=['/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','update','destroy','delete','removeBlackLists','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','/:id'];(function(_0x261e92,_0x41c9c8){var _0x1bf6df=function(_0x32f103){while(--_0x32f103){_0x261e92['push'](_0x261e92['shift']());}};_0x1bf6df(++_0x41c9c8);}(_0x76bb,0x16a));var _0xb76b=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0x76bb[_0x22b8a3];return _0x199a0c;};'use strict';var multer=require('multer');var util=require(_0xb76b('0x0'));var path=require(_0xb76b('0x1'));var timeout=require(_0xb76b('0x2'));var express=require(_0xb76b('0x3'));var router=express['Router']();var fs_extra=require(_0xb76b('0x4'));var auth=require(_0xb76b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb76b('0x6'));var controller=require(_0xb76b('0x7'));router['get']('/',auth[_0xb76b('0x8')](),controller[_0xb76b('0x9')]);router[_0xb76b('0xa')](_0xb76b('0xb'),auth[_0xb76b('0x8')](),controller['show']);router[_0xb76b('0xa')](_0xb76b('0xc'),auth[_0xb76b('0x8')](),controller[_0xb76b('0xd')]);router['get']('/:id/hopper_histories',auth[_0xb76b('0x8')](),controller[_0xb76b('0xe')]);router[_0xb76b('0xa')](_0xb76b('0xf'),auth[_0xb76b('0x8')](),controller[_0xb76b('0x10')]);router[_0xb76b('0xa')](_0xb76b('0x11'),auth['isAuthenticated'](),controller[_0xb76b('0x12')]);router['get'](_0xb76b('0x13'),auth[_0xb76b('0x8')](),controller[_0xb76b('0x14')]);router[_0xb76b('0xa')]('/:id/blacklists',auth[_0xb76b('0x8')](),controller[_0xb76b('0x15')]);router['post']('/',auth[_0xb76b('0x8')](),controller['create']);router[_0xb76b('0x16')](_0xb76b('0x17'),auth[_0xb76b('0x8')](),controller[_0xb76b('0x18')]);router['post']('/:id/lists',auth[_0xb76b('0x8')](),controller[_0xb76b('0x19')]);router['post'](_0xb76b('0x1a'),auth[_0xb76b('0x8')](),controller[_0xb76b('0x1b')]);router[_0xb76b('0x1c')](_0xb76b('0xb'),auth[_0xb76b('0x8')](),controller[_0xb76b('0x1d')]);router['delete']('/:id',auth[_0xb76b('0x8')](),controller[_0xb76b('0x1e')]);router[_0xb76b('0x1f')](_0xb76b('0x13'),auth[_0xb76b('0x8')](),controller['removeLists']);router[_0xb76b('0x1f')]('/:id/blacklists',auth[_0xb76b('0x8')](),controller[_0xb76b('0x20')]);module[_0xb76b('0x21')]=router; \ No newline at end of file +var _0x149c=['removeLists','delete','removeBlackLists','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/blacklists','post','create','/:id/clone','/:id/lists','addLists','addBlackLists','put','update'];(function(_0x565870,_0x5d9ee4){var _0x18403d=function(_0x1b5b06){while(--_0x1b5b06){_0x565870['push'](_0x565870['shift']());}};_0x18403d(++_0x5d9ee4);}(_0x149c,0x143));var _0xc149=function(_0x1c47d4,_0x145281){_0x1c47d4=_0x1c47d4-0x0;var _0x5a9ff7=_0x149c[_0x1c47d4];return _0x5a9ff7;};'use strict';var multer=require(_0xc149('0x0'));var util=require('util');var path=require(_0xc149('0x1'));var timeout=require(_0xc149('0x2'));var express=require(_0xc149('0x3'));var router=express['Router']();var fs_extra=require(_0xc149('0x4'));var auth=require(_0xc149('0x5'));var interaction=require(_0xc149('0x6'));var config=require(_0xc149('0x7'));var controller=require(_0xc149('0x8'));router[_0xc149('0x9')]('/',auth[_0xc149('0xa')](),controller['index']);router['get'](_0xc149('0xb'),auth[_0xc149('0xa')](),controller[_0xc149('0xc')]);router[_0xc149('0x9')](_0xc149('0xd'),auth[_0xc149('0xa')](),controller[_0xc149('0xe')]);router[_0xc149('0x9')](_0xc149('0xf'),auth[_0xc149('0xa')](),controller[_0xc149('0x10')]);router[_0xc149('0x9')](_0xc149('0x11'),auth[_0xc149('0xa')](),controller[_0xc149('0x12')]);router[_0xc149('0x9')](_0xc149('0x13'),auth[_0xc149('0xa')](),controller['getHopperBlacks']);router[_0xc149('0x9')]('/:id/lists',auth[_0xc149('0xa')](),controller['getLists']);router[_0xc149('0x9')](_0xc149('0x14'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xc149('0x15')]('/',auth[_0xc149('0xa')](),controller[_0xc149('0x16')]);router[_0xc149('0x15')](_0xc149('0x17'),auth[_0xc149('0xa')](),controller['clone']);router[_0xc149('0x15')](_0xc149('0x18'),auth[_0xc149('0xa')](),controller[_0xc149('0x19')]);router[_0xc149('0x15')]('/:id/blacklists',auth[_0xc149('0xa')](),controller[_0xc149('0x1a')]);router[_0xc149('0x1b')](_0xc149('0xb'),auth[_0xc149('0xa')](),controller[_0xc149('0x1c')]);router['delete'](_0xc149('0xb'),auth[_0xc149('0xa')](),controller['destroy']);router['delete'](_0xc149('0x18'),auth[_0xc149('0xa')](),controller[_0xc149('0x1d')]);router[_0xc149('0x1e')](_0xc149('0x14'),auth[_0xc149('0xa')](),controller[_0xc149('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index e75fcfc..95cefc1 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 _0x0176=['VIRTUAL','getDataValue','key','STRING'];(function(_0x43df38,_0x53ea52){var _0x2909a8=function(_0x608a2c){while(--_0x608a2c){_0x43df38['push'](_0x43df38['shift']());}};_0x2909a8(++_0x53ea52);}(_0x0176,0x1db));var _0x6017=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0176[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x6017('0x0')]},'name':{'type':Sequelize[_0x6017('0x1')],'get':function(){return this[_0x6017('0x2')](_0x6017('0x3'));}}}; \ No newline at end of file +var _0xb35d=['TEXT','STRING','getDataValue','key','sequelize','exports'];(function(_0x30510d,_0x22be64){var _0x375f53=function(_0x9b1721){while(--_0x9b1721){_0x30510d['push'](_0x30510d['shift']());}};_0x375f53(++_0x22be64);}(_0xb35d,0xac));var _0xdb35=function(_0x29db25,_0x457467){_0x29db25=_0x29db25-0x0;var _0x48b1a5=_0xb35d[_0x29db25];return _0x48b1a5;};'use strict';var Sequelize=require(_0xdb35('0x0'));module[_0xdb35('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xdb35('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdb35('0x3')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xdb35('0x4')](_0xdb35('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index f5afa8d..7936d73 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 _0x8c54=['findAll','rows','catch','show','params','rawAttributes','options','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','save','update','then','destroy','CannedAnswers','stack','name','index','map','CannedAnswer','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','include'];(function(_0x22ccc0,_0x914457){var _0xe2af6a=function(_0x55aa01){while(--_0x55aa01){_0x22ccc0['push'](_0x22ccc0['shift']());}};_0xe2af6a(++_0x914457);}(_0x8c54,0x66));var _0x48c5=function(_0x2c3d42,_0x2645bb){_0x2c3d42=_0x2c3d42-0x0;var _0x32984a=_0x8c54[_0x2c3d42];return _0x32984a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x48c5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x48c5('0x1'));var rp=require(_0x48c5('0x2'));var moment=require(_0x48c5('0x3'));var BPromise=require(_0x48c5('0x4'));var Mustache=require(_0x48c5('0x5'));var util=require(_0x48c5('0x6'));var path=require(_0x48c5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x48c5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x48c5('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x48c5('0xa'));var deskjs=require(_0x48c5('0xb'));var toCsv=require(_0x48c5('0xc'));var querystring=require(_0x48c5('0xd'));var Papa=require('papaparse');var Redis=require(_0x48c5('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x48c5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x48c5('0x10'));var logger=require(_0x48c5('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x48c5('0x12'));var db=require(_0x48c5('0x13'))['db'];function respondWithStatusCode(_0x3445b3,_0x37bcda){_0x37bcda=_0x37bcda||0xcc;return function(_0x99d9b3){if(_0x99d9b3){return _0x3445b3[_0x48c5('0x14')](_0x37bcda);}return _0x3445b3[_0x48c5('0x15')](_0x37bcda)[_0x48c5('0x16')]();};}function respondWithResult(_0x33f66f,_0x232881){_0x232881=_0x232881||0xc8;return function(_0x374177){if(_0x374177){return _0x33f66f[_0x48c5('0x15')](_0x232881)[_0x48c5('0x17')](_0x374177);}};}function respondWithFilteredResult(_0x2ab1f2,_0x1e6c76){return function(_0x29c8f2){if(_0x29c8f2){var _0x5157b7=typeof _0x1e6c76[_0x48c5('0x18')]==='undefined'&&typeof _0x1e6c76[_0x48c5('0x19')]==='undefined';var _0xdc260c=_0x29c8f2['count'];var _0x2793d9=_0x5157b7?0x0:_0x1e6c76[_0x48c5('0x18')];var _0x3e143d=_0x5157b7?_0x29c8f2[_0x48c5('0x1a')]:_0x1e6c76['offset']+_0x1e6c76['limit'];var _0x1e3877;if(_0x3e143d>=_0xdc260c){_0x3e143d=_0xdc260c;_0x1e3877=0xc8;}else{_0x1e3877=0xce;}_0x2ab1f2[_0x48c5('0x15')](_0x1e3877);return _0x2ab1f2[_0x48c5('0x1b')]('Content-Range',_0x2793d9+'-'+_0x3e143d+'/'+_0xdc260c)[_0x48c5('0x17')](_0x29c8f2);}return null;};}function patchUpdates(_0x207407){return function(_0x20c688){try{jsonpatch[_0x48c5('0x1c')](_0x20c688,_0x207407,!![]);}catch(_0x44fe53){return BPromise['reject'](_0x44fe53);}return _0x20c688[_0x48c5('0x1d')]();};}function saveUpdates(_0x1a11c5,_0x30f947){return function(_0x4b9e25){if(_0x4b9e25){return _0x4b9e25[_0x48c5('0x1e')](_0x1a11c5)[_0x48c5('0x1f')](function(_0x568a7e){return _0x568a7e;});}return null;};}function removeEntity(_0x37fb64,_0x2a162d){return function(_0x24047b){if(_0x24047b){return _0x24047b[_0x48c5('0x20')]()[_0x48c5('0x1f')](function(){var _0xe8cc40=_0x24047b['get']({'plain':!![]});var _0x5048e9=_0x48c5('0x21');return db['UserProfileResource'][_0x48c5('0x20')]({'where':{'type':_0x5048e9,'resourceId':_0xe8cc40['id']}})['then'](function(){return _0x24047b;});})['then'](function(){_0x37fb64[_0x48c5('0x15')](0xcc)[_0x48c5('0x16')]();});}};}function handleEntityNotFound(_0x2c571a,_0x4a6466){return function(_0x593fb3){if(!_0x593fb3){_0x2c571a[_0x48c5('0x14')](0x194);}return _0x593fb3;};}function handleError(_0x2fc68b,_0x1c53c5){_0x1c53c5=_0x1c53c5||0x1f4;return function(_0x2efc1c){logger['error'](_0x2efc1c[_0x48c5('0x22')]);if(_0x2efc1c['name']){delete _0x2efc1c[_0x48c5('0x23')];}_0x2fc68b[_0x48c5('0x15')](_0x1c53c5)['send'](_0x2efc1c);};}exports[_0x48c5('0x24')]=function(_0x56d2f0,_0x1c8710){var _0x1ef5de={},_0x5f4611={},_0x4bf8ff={'count':0x0,'rows':[]};var _0x41907a=_[_0x48c5('0x25')](db[_0x48c5('0x26')]['rawAttributes'],function(_0x4df6a0){return{'name':_0x4df6a0['fieldName'],'type':_0x4df6a0['type'][_0x48c5('0x27')]};});_0x5f4611[_0x48c5('0x28')]=_['map'](_0x41907a,'name');_0x5f4611[_0x48c5('0x29')]=_[_0x48c5('0x2a')](_0x56d2f0[_0x48c5('0x29')]);_0x5f4611[_0x48c5('0x2b')]=_['intersection'](_0x5f4611[_0x48c5('0x28')],_0x5f4611['query']);_0x1ef5de[_0x48c5('0x2c')]=_[_0x48c5('0x2d')](_0x5f4611['model'],qs[_0x48c5('0x2e')](_0x56d2f0['query'][_0x48c5('0x2e')]));_0x1ef5de[_0x48c5('0x2c')]=_0x1ef5de[_0x48c5('0x2c')][_0x48c5('0x2f')]?_0x1ef5de[_0x48c5('0x2c')]:_0x5f4611[_0x48c5('0x28')];if(!_0x56d2f0[_0x48c5('0x29')][_0x48c5('0x30')]('nolimit')){_0x1ef5de[_0x48c5('0x19')]=qs['limit'](_0x56d2f0[_0x48c5('0x29')][_0x48c5('0x19')]);_0x1ef5de[_0x48c5('0x18')]=qs[_0x48c5('0x18')](_0x56d2f0['query'][_0x48c5('0x18')]);}_0x1ef5de[_0x48c5('0x31')]=qs['sort'](_0x56d2f0[_0x48c5('0x29')][_0x48c5('0x32')]);_0x1ef5de[_0x48c5('0x33')]=qs[_0x48c5('0x2b')](_[_0x48c5('0x34')](_0x56d2f0[_0x48c5('0x29')],_0x5f4611['filters']),_0x41907a);if(_0x56d2f0[_0x48c5('0x29')][_0x48c5('0x35')]){_0x1ef5de['where']=_[_0x48c5('0x36')](_0x1ef5de['where'],{'$or':[{'key':{'$like':'%'+_0x56d2f0[_0x48c5('0x29')]['filter']+'%'}},{'value':{'$like':'%'+_0x56d2f0[_0x48c5('0x29')]['filter']+'%'}}]});}_0x1ef5de=_[_0x48c5('0x36')]({},_0x1ef5de,_0x56d2f0['options']);var _0x43a604={'where':_0x1ef5de[_0x48c5('0x33')]};return db[_0x48c5('0x26')]['count'](_0x43a604)[_0x48c5('0x1f')](function(_0x5f435d){_0x4bf8ff[_0x48c5('0x1a')]=_0x5f435d;if(_0x56d2f0[_0x48c5('0x29')]['includeAll']){_0x1ef5de[_0x48c5('0x37')]=[{'all':!![]}];}return db[_0x48c5('0x26')][_0x48c5('0x38')](_0x1ef5de);})[_0x48c5('0x1f')](function(_0x2cca18){_0x4bf8ff[_0x48c5('0x39')]=_0x2cca18;return _0x4bf8ff;})[_0x48c5('0x1f')](respondWithFilteredResult(_0x1c8710,_0x1ef5de))[_0x48c5('0x3a')](handleError(_0x1c8710,null));};exports[_0x48c5('0x3b')]=function(_0xa7b37,_0x24fc2d){var _0x33223f={'raw':!![],'where':{'id':_0xa7b37[_0x48c5('0x3c')]['id']}},_0x2709af={};_0x2709af[_0x48c5('0x28')]=_[_0x48c5('0x2a')](db[_0x48c5('0x26')][_0x48c5('0x3d')]);_0x2709af[_0x48c5('0x29')]=_[_0x48c5('0x2a')](_0xa7b37['query']);_0x2709af[_0x48c5('0x2b')]=_[_0x48c5('0x2d')](_0x2709af[_0x48c5('0x28')],_0x2709af[_0x48c5('0x29')]);_0x33223f['attributes']=_['intersection'](_0x2709af[_0x48c5('0x28')],qs[_0x48c5('0x2e')](_0xa7b37[_0x48c5('0x29')][_0x48c5('0x2e')]));_0x33223f[_0x48c5('0x2c')]=_0x33223f[_0x48c5('0x2c')]['length']?_0x33223f[_0x48c5('0x2c')]:_0x2709af[_0x48c5('0x28')];if(_0xa7b37[_0x48c5('0x29')]['includeAll']){_0x33223f[_0x48c5('0x37')]=[{'all':!![]}];}_0x33223f=_['merge']({},_0x33223f,_0xa7b37[_0x48c5('0x3e')]);return db['CannedAnswer'][_0x48c5('0x3f')](_0x33223f)['then'](handleEntityNotFound(_0x24fc2d,null))[_0x48c5('0x1f')](respondWithResult(_0x24fc2d,null))[_0x48c5('0x3a')](handleError(_0x24fc2d,null));};exports[_0x48c5('0x1e')]=function(_0x1930d1,_0x5cf08e){if(_0x1930d1[_0x48c5('0x40')]['id']){delete _0x1930d1[_0x48c5('0x40')]['id'];}return db[_0x48c5('0x26')][_0x48c5('0x3f')]({'where':{'id':_0x1930d1[_0x48c5('0x3c')]['id']}})[_0x48c5('0x1f')](handleEntityNotFound(_0x5cf08e,null))[_0x48c5('0x1f')](saveUpdates(_0x1930d1['body'],null))[_0x48c5('0x1f')](respondWithResult(_0x5cf08e,null))['catch'](handleError(_0x5cf08e,null));};exports['destroy']=function(_0xa625a7,_0x5e5125){return db[_0x48c5('0x26')][_0x48c5('0x3f')]({'where':{'id':_0xa625a7['params']['id']}})[_0x48c5('0x1f')](handleEntityNotFound(_0x5e5125,null))[_0x48c5('0x1f')](removeEntity(_0x5e5125,null))[_0x48c5('0x3a')](handleError(_0x5e5125,null));};exports[_0x48c5('0x41')]=function(_0xb7c39e,_0x5e671f){var _0x167112={'key':_0xb7c39e[_0x48c5('0x40')][_0x48c5('0x27')]};if(_0xb7c39e[_0x48c5('0x40')][_0x48c5('0x42')]){_0x167112[_0x48c5('0x42')]=_0xb7c39e[_0x48c5('0x40')][_0x48c5('0x42')];}else if(_0xb7c39e[_0x48c5('0x40')][_0x48c5('0x43')]){_0x167112[_0x48c5('0x43')]=_0xb7c39e[_0x48c5('0x40')][_0x48c5('0x43')];}else if(_0xb7c39e[_0x48c5('0x40')]['OpenchannelAccountId']){_0x167112[_0x48c5('0x44')]=_0xb7c39e[_0x48c5('0x40')][_0x48c5('0x44')];}else if(_0xb7c39e[_0x48c5('0x40')][_0x48c5('0x45')]){_0x167112[_0x48c5('0x45')]=_0xb7c39e[_0x48c5('0x40')][_0x48c5('0x45')];}return db[_0x48c5('0x26')][_0x48c5('0x3f')]({'where':_0x167112})[_0x48c5('0x1f')](function(_0x30c4b1){if(_0x30c4b1){throw new db['Sequelize'][(_0x48c5('0x46'))](_0x48c5('0x47'));}return db[_0x48c5('0x26')][_0x48c5('0x41')](_0xb7c39e[_0x48c5('0x40')]);})[_0x48c5('0x1f')](function(_0x529d65){var _0x5a36e8=_0xb7c39e[_0x48c5('0x48')][_0x48c5('0x49')]({'plain':!![]});if(!_0x5a36e8)throw new Error(_0x48c5('0x4a'));if(_0x5a36e8[_0x48c5('0x4b')]===_0x48c5('0x48')){var _0x3175e8=_0x529d65['get']({'plain':!![]});return db[_0x48c5('0x4c')][_0x48c5('0x3f')]({'where':{'name':'CannedAnswers','userProfileId':_0x5a36e8['userProfileId']},'raw':!![]})[_0x48c5('0x1f')](function(_0x361095){if(_0x361095&&_0x361095[_0x48c5('0x4d')]===0x0){return db[_0x48c5('0x4e')]['create']({'name':_0x3175e8['name'],'resourceId':_0x3175e8['id'],'type':_0x361095[_0x48c5('0x23')],'sectionId':_0x361095['id']},{})[_0x48c5('0x1f')](function(){return _0x529d65;});}else{return _0x529d65;}})[_0x48c5('0x3a')](function(_0x537a31){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x537a31);throw _0x537a31;});}return _0x529d65;})[_0x48c5('0x1f')](respondWithResult(_0x5e671f,0xc9))['catch'](handleError(_0x5e671f,null));}; \ No newline at end of file +var _0x24ff=['model','attributes','fields','length','order','sort','where','merge','filter','options','include','params','keys','includeAll','find','body','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','end','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','query','filters','intersection'];(function(_0x980058,_0x42ae14){var _0xc85f12=function(_0x39e02f){while(--_0x39e02f){_0x980058['push'](_0x980058['shift']());}};_0xc85f12(++_0x42ae14);}(_0x24ff,0xd0));var _0xf24f=function(_0x308129,_0xd36a89){_0x308129=_0x308129-0x0;var _0x223694=_0x24ff[_0x308129];return _0x223694;};'use strict';var emlformat=require(_0xf24f('0x0'));var rimraf=require(_0xf24f('0x1'));var zipdir=require(_0xf24f('0x2'));var jsonpatch=require(_0xf24f('0x3'));var rp=require(_0xf24f('0x4'));var moment=require(_0xf24f('0x5'));var BPromise=require(_0xf24f('0x6'));var Mustache=require(_0xf24f('0x7'));var util=require(_0xf24f('0x8'));var path=require(_0xf24f('0x9'));var sox=require('sox');var csv=require(_0xf24f('0xa'));var ejs=require(_0xf24f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf24f('0xc'));var squel=require(_0xf24f('0xd'));var crypto=require(_0xf24f('0xe'));var jsforce=require(_0xf24f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf24f('0xa'));var querystring=require(_0xf24f('0x10'));var Papa=require(_0xf24f('0x11'));var Redis=require(_0xf24f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf24f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf24f('0x14'))(_0xf24f('0x15'));var utils=require('../../config/utils');var config=require(_0xf24f('0x16'));var licenseUtil=require(_0xf24f('0x17'));var db=require(_0xf24f('0x18'))['db'];function respondWithStatusCode(_0x39e352,_0x32a1c9){_0x32a1c9=_0x32a1c9||0xcc;return function(_0x24416b){if(_0x24416b){return _0x39e352[_0xf24f('0x19')](_0x32a1c9);}return _0x39e352[_0xf24f('0x1a')](_0x32a1c9)['end']();};}function respondWithResult(_0x2f713c,_0x1b4c63){_0x1b4c63=_0x1b4c63||0xc8;return function(_0x348c26){if(_0x348c26){return _0x2f713c['status'](_0x1b4c63)[_0xf24f('0x1b')](_0x348c26);}};}function respondWithFilteredResult(_0xee0963,_0x164ef3){return function(_0x49156b){if(_0x49156b){var _0x57218b=typeof _0x164ef3[_0xf24f('0x1c')]===_0xf24f('0x1d')&&typeof _0x164ef3[_0xf24f('0x1e')]===_0xf24f('0x1d');var _0x138b02=_0x49156b[_0xf24f('0x1f')];var _0x58d732=_0x57218b?0x0:_0x164ef3[_0xf24f('0x1c')];var _0x24376d=_0x57218b?_0x49156b[_0xf24f('0x1f')]:_0x164ef3[_0xf24f('0x1c')]+_0x164ef3[_0xf24f('0x1e')];var _0x359dc5;if(_0x24376d>=_0x138b02){_0x24376d=_0x138b02;_0x359dc5=0xc8;}else{_0x359dc5=0xce;}_0xee0963['status'](_0x359dc5);return _0xee0963['set'](_0xf24f('0x20'),_0x58d732+'-'+_0x24376d+'/'+_0x138b02)['json'](_0x49156b);}return null;};}function patchUpdates(_0xc02541){return function(_0xd29cfd){try{jsonpatch[_0xf24f('0x21')](_0xd29cfd,_0xc02541,!![]);}catch(_0x229bee){return BPromise[_0xf24f('0x22')](_0x229bee);}return _0xd29cfd[_0xf24f('0x23')]();};}function saveUpdates(_0x5635f0,_0x381101){return function(_0x26e6cd){if(_0x26e6cd){return _0x26e6cd[_0xf24f('0x24')](_0x5635f0)[_0xf24f('0x25')](function(_0x145cf0){return _0x145cf0;});}return null;};}function removeEntity(_0x3df1a9,_0x56c742){return function(_0x3cbd4d){if(_0x3cbd4d){return _0x3cbd4d[_0xf24f('0x26')]()[_0xf24f('0x25')](function(){var _0x3e3d8b=_0x3cbd4d[_0xf24f('0x27')]({'plain':!![]});var _0x5a5d9b='CannedAnswers';return db['UserProfileResource'][_0xf24f('0x26')]({'where':{'type':_0x5a5d9b,'resourceId':_0x3e3d8b['id']}})[_0xf24f('0x25')](function(){return _0x3cbd4d;});})[_0xf24f('0x25')](function(){_0x3df1a9[_0xf24f('0x1a')](0xcc)[_0xf24f('0x28')]();});}};}function handleEntityNotFound(_0xcfa89d,_0x3b7567){return function(_0x2d2393){if(!_0x2d2393){_0xcfa89d[_0xf24f('0x19')](0x194);}return _0x2d2393;};}function handleError(_0x5a9a6b,_0x4ce4af){_0x4ce4af=_0x4ce4af||0x1f4;return function(_0x5a6adb){logger['error'](_0x5a6adb[_0xf24f('0x29')]);if(_0x5a6adb[_0xf24f('0x2a')]){delete _0x5a6adb['name'];}_0x5a9a6b[_0xf24f('0x1a')](_0x4ce4af)[_0xf24f('0x2b')](_0x5a6adb);};}exports['index']=function(_0x116e18,_0x202ef6){var _0x4c17bc={},_0x500c59={},_0x40e53b={'count':0x0,'rows':[]};var _0x18ceab=_[_0xf24f('0x2c')](db[_0xf24f('0x2d')][_0xf24f('0x2e')],function(_0x1b075a){return{'name':_0x1b075a[_0xf24f('0x2f')],'type':_0x1b075a[_0xf24f('0x30')][_0xf24f('0x31')]};});_0x500c59['model']=_[_0xf24f('0x2c')](_0x18ceab,'name');_0x500c59[_0xf24f('0x32')]=_['keys'](_0x116e18[_0xf24f('0x32')]);_0x500c59[_0xf24f('0x33')]=_[_0xf24f('0x34')](_0x500c59[_0xf24f('0x35')],_0x500c59['query']);_0x4c17bc[_0xf24f('0x36')]=_[_0xf24f('0x34')](_0x500c59['model'],qs['fields'](_0x116e18['query'][_0xf24f('0x37')]));_0x4c17bc[_0xf24f('0x36')]=_0x4c17bc['attributes'][_0xf24f('0x38')]?_0x4c17bc[_0xf24f('0x36')]:_0x500c59['model'];if(!_0x116e18[_0xf24f('0x32')]['hasOwnProperty']('nolimit')){_0x4c17bc[_0xf24f('0x1e')]=qs[_0xf24f('0x1e')](_0x116e18['query']['limit']);_0x4c17bc[_0xf24f('0x1c')]=qs['offset'](_0x116e18[_0xf24f('0x32')][_0xf24f('0x1c')]);}_0x4c17bc[_0xf24f('0x39')]=qs[_0xf24f('0x3a')](_0x116e18['query']['sort']);_0x4c17bc[_0xf24f('0x3b')]=qs[_0xf24f('0x33')](_['pick'](_0x116e18[_0xf24f('0x32')],_0x500c59['filters']),_0x18ceab);if(_0x116e18[_0xf24f('0x32')]['filter']){_0x4c17bc[_0xf24f('0x3b')]=_[_0xf24f('0x3c')](_0x4c17bc[_0xf24f('0x3b')],{'$or':[{'key':{'$like':'%'+_0x116e18[_0xf24f('0x32')][_0xf24f('0x3d')]+'%'}},{'value':{'$like':'%'+_0x116e18[_0xf24f('0x32')][_0xf24f('0x3d')]+'%'}}]});}_0x4c17bc=_[_0xf24f('0x3c')]({},_0x4c17bc,_0x116e18[_0xf24f('0x3e')]);var _0x53e4ce={'where':_0x4c17bc[_0xf24f('0x3b')]};return db[_0xf24f('0x2d')]['count'](_0x53e4ce)['then'](function(_0x518410){_0x40e53b[_0xf24f('0x1f')]=_0x518410;if(_0x116e18[_0xf24f('0x32')]['includeAll']){_0x4c17bc[_0xf24f('0x3f')]=[{'all':!![]}];}return db[_0xf24f('0x2d')]['findAll'](_0x4c17bc);})[_0xf24f('0x25')](function(_0x337fc0){_0x40e53b['rows']=_0x337fc0;return _0x40e53b;})[_0xf24f('0x25')](respondWithFilteredResult(_0x202ef6,_0x4c17bc))['catch'](handleError(_0x202ef6,null));};exports['show']=function(_0xe629fe,_0x120d53){var _0x11bd94={'raw':!![],'where':{'id':_0xe629fe[_0xf24f('0x40')]['id']}},_0x1423b5={};_0x1423b5[_0xf24f('0x35')]=_[_0xf24f('0x41')](db['CannedAnswer']['rawAttributes']);_0x1423b5[_0xf24f('0x32')]=_[_0xf24f('0x41')](_0xe629fe['query']);_0x1423b5[_0xf24f('0x33')]=_[_0xf24f('0x34')](_0x1423b5['model'],_0x1423b5[_0xf24f('0x32')]);_0x11bd94[_0xf24f('0x36')]=_['intersection'](_0x1423b5[_0xf24f('0x35')],qs['fields'](_0xe629fe[_0xf24f('0x32')][_0xf24f('0x37')]));_0x11bd94[_0xf24f('0x36')]=_0x11bd94[_0xf24f('0x36')][_0xf24f('0x38')]?_0x11bd94[_0xf24f('0x36')]:_0x1423b5[_0xf24f('0x35')];if(_0xe629fe[_0xf24f('0x32')][_0xf24f('0x42')]){_0x11bd94[_0xf24f('0x3f')]=[{'all':!![]}];}_0x11bd94=_[_0xf24f('0x3c')]({},_0x11bd94,_0xe629fe[_0xf24f('0x3e')]);return db['CannedAnswer'][_0xf24f('0x43')](_0x11bd94)[_0xf24f('0x25')](handleEntityNotFound(_0x120d53,null))[_0xf24f('0x25')](respondWithResult(_0x120d53,null))['catch'](handleError(_0x120d53,null));};exports[_0xf24f('0x24')]=function(_0x544395,_0x483cc3){if(_0x544395['body']['id']){delete _0x544395[_0xf24f('0x44')]['id'];}return db[_0xf24f('0x2d')][_0xf24f('0x43')]({'where':{'id':_0x544395['params']['id']}})[_0xf24f('0x25')](handleEntityNotFound(_0x483cc3,null))['then'](saveUpdates(_0x544395['body'],null))['then'](respondWithResult(_0x483cc3,null))[_0xf24f('0x45')](handleError(_0x483cc3,null));};exports['destroy']=function(_0x3f1c8b,_0x9098bb){return db['CannedAnswer']['find']({'where':{'id':_0x3f1c8b[_0xf24f('0x40')]['id']}})[_0xf24f('0x25')](handleEntityNotFound(_0x9098bb,null))[_0xf24f('0x25')](removeEntity(_0x9098bb,null))[_0xf24f('0x45')](handleError(_0x9098bb,null));};exports[_0xf24f('0x46')]=function(_0x21da59,_0x4da86c){var _0x113610={'key':_0x21da59[_0xf24f('0x44')][_0xf24f('0x31')]};if(_0x21da59['body'][_0xf24f('0x47')]){_0x113610[_0xf24f('0x47')]=_0x21da59[_0xf24f('0x44')]['MailAccountId'];}else if(_0x21da59[_0xf24f('0x44')][_0xf24f('0x48')]){_0x113610['SmsAccountId']=_0x21da59[_0xf24f('0x44')]['SmsAccountId'];}else if(_0x21da59['body'][_0xf24f('0x49')]){_0x113610[_0xf24f('0x49')]=_0x21da59[_0xf24f('0x44')][_0xf24f('0x49')];}else if(_0x21da59[_0xf24f('0x44')][_0xf24f('0x4a')]){_0x113610[_0xf24f('0x4a')]=_0x21da59['body'][_0xf24f('0x4a')];}return db['CannedAnswer'][_0xf24f('0x43')]({'where':_0x113610})[_0xf24f('0x25')](function(_0x14b9fc){if(_0x14b9fc){throw new db[(_0xf24f('0x4b'))][(_0xf24f('0x4c'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0xf24f('0x46')](_0x21da59['body']);})[_0xf24f('0x25')](function(_0x155811){var _0x44f7e0=_0x21da59[_0xf24f('0x4d')][_0xf24f('0x27')]({'plain':!![]});if(!_0x44f7e0)throw new Error(_0xf24f('0x4e'));if(_0x44f7e0[_0xf24f('0x4f')]===_0xf24f('0x4d')){var _0x143a2e=_0x155811[_0xf24f('0x27')]({'plain':!![]});return db[_0xf24f('0x50')][_0xf24f('0x43')]({'where':{'name':_0xf24f('0x51'),'userProfileId':_0x44f7e0[_0xf24f('0x52')]},'raw':!![]})[_0xf24f('0x25')](function(_0x2a048f){if(_0x2a048f&&_0x2a048f[_0xf24f('0x53')]===0x0){return db[_0xf24f('0x54')][_0xf24f('0x46')]({'name':_0x143a2e['name'],'resourceId':_0x143a2e['id'],'type':_0x2a048f[_0xf24f('0x2a')],'sectionId':_0x2a048f['id']},{})[_0xf24f('0x25')](function(){return _0x155811;});}else{return _0x155811;}})[_0xf24f('0x45')](function(_0x2ba00a){logger[_0xf24f('0x55')](_0xf24f('0x56'),_0x2ba00a);throw _0x2ba00a;});}return _0x155811;})[_0xf24f('0x25')](respondWithResult(_0x4da86c,0xc9))['catch'](handleError(_0x4da86c,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 5207930..b30e4eb 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 _0xbace=['bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x22b86f,_0xf3a9f2){var _0x4982fe=function(_0x1b0aeb){while(--_0x1b0aeb){_0x22b86f['push'](_0x22b86f['shift']());}};_0x4982fe(++_0xf3a9f2);}(_0xbace,0xbf));var _0xebac=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xbace[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0xebac('0x0'));var util=require(_0xebac('0x1'));var logger=require(_0xebac('0x2'))('api');var moment=require(_0xebac('0x3'));var BPromise=require(_0xebac('0x4'));var rp=require(_0xebac('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xebac('0x6'));var config=require(_0xebac('0x7'));var attributes=require(_0xebac('0x8'));module['exports']=function(_0x27d00d,_0x38034b){return _0x27d00d['define'](_0xebac('0x9'),attributes,{'tableName':_0xebac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xebac('0xb'),'collate':_0xebac('0xc')});}; \ No newline at end of file +var _0xb0bb=['../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb0bb,0xaf));var _0xbb0b=function(_0x3f3443,_0x384dbf){_0x3f3443=_0x3f3443-0x0;var _0x5542cd=_0xb0bb[_0x3f3443];return _0x5542cd;};'use strict';var _=require(_0xbb0b('0x0'));var util=require(_0xbb0b('0x1'));var logger=require(_0xbb0b('0x2'))(_0xbb0b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbb0b('0x4'));var fs=require('fs');var path=require(_0xbb0b('0x5'));var rimraf=require(_0xbb0b('0x6'));var config=require(_0xbb0b('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0xbb0b('0x8')]=function(_0x37d240,_0xc81c10){return _0x37d240[_0xbb0b('0x9')](_0xbb0b('0xa'),attributes,{'tableName':_0xbb0b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbb0b('0xc'),'collate':_0xbb0b('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index f84f4f2..982edfb 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(_0x66d73f,_0x4dd121){var _0x16c91b=function(_0x2679c4){while(--_0x2679c4){_0x66d73f['push'](_0x66d73f['shift']());}};_0x16c91b(++_0x4dd121);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0x5d59ba,_0x4e6d51){var _0x2bb269=function(_0x374362){while(--_0x374362){_0x5d59ba['push'](_0x5d59ba['shift']());}};_0x2bb269(++_0x4e6d51);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 8d421d7..af76359 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 _0x55cf=['/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','isAuthenticated','show','post','create'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x55cf,0x1e8));var _0xf55c=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0x55cf[_0x43776a];return _0x18eb8f;};'use strict';var multer=require(_0xf55c('0x0'));var util=require(_0xf55c('0x1'));var path=require('path');var timeout=require(_0xf55c('0x2'));var express=require(_0xf55c('0x3'));var router=express[_0xf55c('0x4')]();var fs_extra=require(_0xf55c('0x5'));var auth=require(_0xf55c('0x6'));var interaction=require(_0xf55c('0x7'));var config=require(_0xf55c('0x8'));var controller=require(_0xf55c('0x9'));router[_0xf55c('0xa')]('/',auth['isAuthenticated'](),controller[_0xf55c('0xb')]);router[_0xf55c('0xa')]('/:id',auth[_0xf55c('0xc')](),controller[_0xf55c('0xd')]);router[_0xf55c('0xe')]('/',auth[_0xf55c('0xc')](),controller[_0xf55c('0xf')]);router['put'](_0xf55c('0x10'),auth[_0xf55c('0xc')](),controller['update']);router['delete'](_0xf55c('0x10'),auth[_0xf55c('0xc')](),controller['destroy']);module[_0xf55c('0x11')]=router; \ No newline at end of file +var _0xfc4a=['create','put','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x4162dc,_0x212533){var _0x3973e3=function(_0xb61de3){while(--_0xb61de3){_0x4162dc['push'](_0x4162dc['shift']());}};_0x3973e3(++_0x212533);}(_0xfc4a,0x148));var _0xafc4=function(_0x534a75,_0x3464f2){_0x534a75=_0x534a75-0x0;var _0x2f8771=_0xfc4a[_0x534a75];return _0x2f8771;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xafc4('0x0'));var timeout=require(_0xafc4('0x1'));var express=require(_0xafc4('0x2'));var router=express[_0xafc4('0x3')]();var fs_extra=require(_0xafc4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xafc4('0x5'));var config=require(_0xafc4('0x6'));var controller=require(_0xafc4('0x7'));router['get']('/',auth[_0xafc4('0x8')](),controller[_0xafc4('0x9')]);router[_0xafc4('0xa')](_0xafc4('0xb'),auth[_0xafc4('0x8')](),controller[_0xafc4('0xc')]);router[_0xafc4('0xd')]('/',auth[_0xafc4('0x8')](),controller[_0xafc4('0xe')]);router[_0xafc4('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xafc4('0x10')]);module[_0xafc4('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 ea33d7e..6b30854 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 _0x1339=['STRING','INTEGER','sequelize','exports','1970-01-01\x2000:00:01'];(function(_0x46ae87,_0x4bd053){var _0x303fcc=function(_0xf522b9){while(--_0xf522b9){_0x46ae87['push'](_0x46ae87['shift']());}};_0x303fcc(++_0x4bd053);}(_0x1339,0x1bf));var _0x9133=function(_0x4b2aba,_0x4079ab){_0x4b2aba=_0x4b2aba-0x0;var _0x1b19d8=_0x1339[_0x4b2aba];return _0x1b19d8;};'use strict';var Sequelize=require(_0x9133('0x0'));module[_0x9133('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x9133('0x2')},'clid':{'type':Sequelize[_0x9133('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x9133('0x3')]},'channel':{'type':Sequelize[_0x9133('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x9133('0x3')]},'lastdata':{'type':Sequelize[_0x9133('0x3')]},'duration':{'type':Sequelize[_0x9133('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9133('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9133('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x9133('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x9133('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x9133('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x9133('0x3')]}}; \ No newline at end of file +var _0xfa68=['exports','DATE','STRING','INTEGER','sequelize'];(function(_0x401ccd,_0x140815){var _0x5a57ad=function(_0x8ad698){while(--_0x8ad698){_0x401ccd['push'](_0x401ccd['shift']());}};_0x5a57ad(++_0x140815);}(_0xfa68,0x86));var _0x8fa6=function(_0x3a8bab,_0x3ecd53){_0x3a8bab=_0x3a8bab-0x0;var _0x69a850=_0xfa68[_0x3a8bab];return _0x69a850;};'use strict';var Sequelize=require(_0x8fa6('0x0'));module[_0x8fa6('0x1')]={'calldate':{'type':Sequelize[_0x8fa6('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x8fa6('0x3')]},'src':{'type':Sequelize[_0x8fa6('0x3')]},'dst':{'type':Sequelize[_0x8fa6('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8fa6('0x3')]},'dstchannel':{'type':Sequelize[_0x8fa6('0x3')]},'lastapp':{'type':Sequelize[_0x8fa6('0x3')]},'lastdata':{'type':Sequelize[_0x8fa6('0x3')]},'duration':{'type':Sequelize[_0x8fa6('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8fa6('0x3')]},'amaflags':{'type':Sequelize[_0x8fa6('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x8fa6('0x3')]},'uniqueid':{'type':Sequelize[_0x8fa6('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x8fa6('0x3')]},'type':{'type':Sequelize[_0x8fa6('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index f1eb23b..e7507a0 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 _0xdf98=['ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','stack','name','send','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','pick','filters','filter','options','includeAll','include','Cdr','findAll','rows','catch','show','params','length','create','body','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xdf98,0xcf));var _0x8df9=function(_0x438874,_0x50bced){_0x438874=_0x438874-0x0;var _0x3a51c1=_0xdf98[_0x438874];return _0x3a51c1;};'use strict';var emlformat=require(_0x8df9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8df9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8df9('0x2'));var BPromise=require(_0x8df9('0x3'));var Mustache=require(_0x8df9('0x4'));var util=require(_0x8df9('0x5'));var path=require(_0x8df9('0x6'));var sox=require(_0x8df9('0x7'));var csv=require(_0x8df9('0x8'));var ejs=require(_0x8df9('0x9'));var fs=require('fs');var fs_extra=require(_0x8df9('0xa'));var _=require('lodash');var squel=require(_0x8df9('0xb'));var crypto=require(_0x8df9('0xc'));var jsforce=require(_0x8df9('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8df9('0xe'));var Papa=require('papaparse');var Redis=require(_0x8df9('0xf'));var authService=require(_0x8df9('0x10'));var qs=require(_0x8df9('0x11'));var as=require(_0x8df9('0x12'));var hardwareService=require(_0x8df9('0x13'));var logger=require(_0x8df9('0x14'))(_0x8df9('0x15'));var utils=require(_0x8df9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8df9('0x17'));var db=require(_0x8df9('0x18'))['db'];function respondWithStatusCode(_0x45f85b,_0x5a97dd){_0x5a97dd=_0x5a97dd||0xcc;return function(_0x42666d){if(_0x42666d){return _0x45f85b[_0x8df9('0x19')](_0x5a97dd);}return _0x45f85b[_0x8df9('0x1a')](_0x5a97dd)[_0x8df9('0x1b')]();};}function respondWithResult(_0x4bc4cc,_0x510e66){_0x510e66=_0x510e66||0xc8;return function(_0x2dcc1c){if(_0x2dcc1c){return _0x4bc4cc[_0x8df9('0x1a')](_0x510e66)[_0x8df9('0x1c')](_0x2dcc1c);}};}function respondWithFilteredResult(_0x50f0f7,_0x110f2b){return function(_0x526c78){if(_0x526c78){var _0xcc0419=typeof _0x110f2b['offset']===_0x8df9('0x1d')&&typeof _0x110f2b[_0x8df9('0x1e')]===_0x8df9('0x1d');var _0x218e76=_0x526c78[_0x8df9('0x1f')];var _0x16e8c4=_0xcc0419?0x0:_0x110f2b['offset'];var _0x54f2b0=_0xcc0419?_0x526c78[_0x8df9('0x1f')]:_0x110f2b['offset']+_0x110f2b['limit'];var _0x324dc0;if(_0x54f2b0>=_0x218e76){_0x54f2b0=_0x218e76;_0x324dc0=0xc8;}else{_0x324dc0=0xce;}_0x50f0f7[_0x8df9('0x1a')](_0x324dc0);return _0x50f0f7[_0x8df9('0x20')](_0x8df9('0x21'),_0x16e8c4+'-'+_0x54f2b0+'/'+_0x218e76)[_0x8df9('0x1c')](_0x526c78);}return null;};}function patchUpdates(_0xd73eb3){return function(_0x5a0071){try{jsonpatch[_0x8df9('0x22')](_0x5a0071,_0xd73eb3,!![]);}catch(_0x36deb6){return BPromise[_0x8df9('0x23')](_0x36deb6);}return _0x5a0071['save']();};}function saveUpdates(_0x5041f8,_0x490028){return function(_0x4a6748){if(_0x4a6748){return _0x4a6748['update'](_0x5041f8)[_0x8df9('0x24')](function(_0x239b71){return _0x239b71;});}return null;};}function removeEntity(_0x360d0b,_0x3dea66){return function(_0x478453){if(_0x478453){return _0x478453[_0x8df9('0x25')]()[_0x8df9('0x24')](function(){_0x360d0b[_0x8df9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3323dc,_0xe662a6){return function(_0x30cc42){if(!_0x30cc42){_0x3323dc['sendStatus'](0x194);}return _0x30cc42;};}function handleError(_0x5e8f46,_0x27d441){_0x27d441=_0x27d441||0x1f4;return function(_0x5117c9){logger['error'](_0x5117c9[_0x8df9('0x26')]);if(_0x5117c9[_0x8df9('0x27')]){delete _0x5117c9[_0x8df9('0x27')];}_0x5e8f46[_0x8df9('0x1a')](_0x27d441)[_0x8df9('0x28')](_0x5117c9);};}exports['index']=function(_0x5a3907,_0x8de080){var _0xce8575={},_0x2a9fee={},_0x5180fb={'count':0x0,'rows':[]};var _0x25d636=_[_0x8df9('0x29')](db['Cdr'][_0x8df9('0x2a')],function(_0x1c5065){return{'name':_0x1c5065['fieldName'],'type':_0x1c5065[_0x8df9('0x2b')][_0x8df9('0x2c')]};});_0x2a9fee[_0x8df9('0x2d')]=_['map'](_0x25d636,'name');_0x2a9fee[_0x8df9('0x2e')]=_[_0x8df9('0x2f')](_0x5a3907[_0x8df9('0x2e')]);_0x2a9fee['filters']=_[_0x8df9('0x30')](_0x2a9fee[_0x8df9('0x2d')],_0x2a9fee[_0x8df9('0x2e')]);_0xce8575[_0x8df9('0x31')]=_['intersection'](_0x2a9fee[_0x8df9('0x2d')],qs[_0x8df9('0x32')](_0x5a3907['query'][_0x8df9('0x32')]));_0xce8575['attributes']=_0xce8575['attributes']['length']?_0xce8575['attributes']:_0x2a9fee[_0x8df9('0x2d')];if(!_0x5a3907[_0x8df9('0x2e')][_0x8df9('0x33')](_0x8df9('0x34'))){_0xce8575[_0x8df9('0x1e')]=qs[_0x8df9('0x1e')](_0x5a3907[_0x8df9('0x2e')][_0x8df9('0x1e')]);_0xce8575[_0x8df9('0x35')]=qs[_0x8df9('0x35')](_0x5a3907[_0x8df9('0x2e')][_0x8df9('0x35')]);}_0xce8575['order']=qs['sort'](_0x5a3907['query'][_0x8df9('0x36')]);_0xce8575[_0x8df9('0x37')]=qs['filters'](_[_0x8df9('0x38')](_0x5a3907['query'],_0x2a9fee[_0x8df9('0x39')]),_0x25d636);if(_0x5a3907[_0x8df9('0x2e')]['filter']){_0xce8575['where']=_['merge'](_0xce8575[_0x8df9('0x37')],{'$or':_[_0x8df9('0x29')](_0x25d636,function(_0x25d77f){if(_0x25d77f['type']!=='VIRTUAL'){var _0x16b0c3={};_0x16b0c3[_0x25d77f['name']]={'$like':'%'+_0x5a3907[_0x8df9('0x2e')][_0x8df9('0x3a')]+'%'};return _0x16b0c3;}})});}_0xce8575=_['merge']({},_0xce8575,_0x5a3907[_0x8df9('0x3b')]);var _0x44e295={'where':_0xce8575[_0x8df9('0x37')]};return db['Cdr'][_0x8df9('0x1f')](_0x44e295)['then'](function(_0x11014b){_0x5180fb[_0x8df9('0x1f')]=_0x11014b;if(_0x5a3907[_0x8df9('0x2e')][_0x8df9('0x3c')]){_0xce8575[_0x8df9('0x3d')]=[{'all':!![]}];}return db[_0x8df9('0x3e')][_0x8df9('0x3f')](_0xce8575);})[_0x8df9('0x24')](function(_0x211b51){_0x5180fb[_0x8df9('0x40')]=_0x211b51;return _0x5180fb;})[_0x8df9('0x24')](respondWithFilteredResult(_0x8de080,_0xce8575))[_0x8df9('0x41')](handleError(_0x8de080,null));};exports[_0x8df9('0x42')]=function(_0x5d68b0,_0x5b84e6){var _0x1b5cb3={'raw':!![],'where':{'id':_0x5d68b0[_0x8df9('0x43')]['id']}},_0x4fdf12={};_0x4fdf12['model']=_[_0x8df9('0x2f')](db[_0x8df9('0x3e')][_0x8df9('0x2a')]);_0x4fdf12[_0x8df9('0x2e')]=_[_0x8df9('0x2f')](_0x5d68b0[_0x8df9('0x2e')]);_0x4fdf12[_0x8df9('0x39')]=_[_0x8df9('0x30')](_0x4fdf12[_0x8df9('0x2d')],_0x4fdf12[_0x8df9('0x2e')]);_0x1b5cb3[_0x8df9('0x31')]=_[_0x8df9('0x30')](_0x4fdf12['model'],qs[_0x8df9('0x32')](_0x5d68b0[_0x8df9('0x2e')][_0x8df9('0x32')]));_0x1b5cb3['attributes']=_0x1b5cb3[_0x8df9('0x31')][_0x8df9('0x44')]?_0x1b5cb3['attributes']:_0x4fdf12['model'];if(_0x5d68b0['query'][_0x8df9('0x3c')]){_0x1b5cb3[_0x8df9('0x3d')]=[{'all':!![]}];}_0x1b5cb3=_['merge']({},_0x1b5cb3,_0x5d68b0['options']);return db[_0x8df9('0x3e')]['find'](_0x1b5cb3)['then'](handleEntityNotFound(_0x5b84e6,null))['then'](respondWithResult(_0x5b84e6,null))[_0x8df9('0x41')](handleError(_0x5b84e6,null));};exports[_0x8df9('0x45')]=function(_0x28313f,_0x5510f7){return db[_0x8df9('0x3e')][_0x8df9('0x45')](_0x28313f[_0x8df9('0x46')],{})[_0x8df9('0x24')](respondWithResult(_0x5510f7,0xc9))[_0x8df9('0x41')](handleError(_0x5510f7,null));};exports['update']=function(_0x4f9dac,_0xdee15b){if(_0x4f9dac[_0x8df9('0x46')]['id']){delete _0x4f9dac[_0x8df9('0x46')]['id'];}return db[_0x8df9('0x3e')]['find']({'where':{'id':_0x4f9dac[_0x8df9('0x43')]['id']}})[_0x8df9('0x24')](handleEntityNotFound(_0xdee15b,null))[_0x8df9('0x24')](saveUpdates(_0x4f9dac[_0x8df9('0x46')],null))[_0x8df9('0x24')](respondWithResult(_0xdee15b,null))[_0x8df9('0x41')](handleError(_0xdee15b,null));};exports['destroy']=function(_0x3d9e7b,_0x4a24e5){return db[_0x8df9('0x3e')]['find']({'where':{'id':_0x3d9e7b[_0x8df9('0x43')]['id']}})['then'](handleEntityNotFound(_0x4a24e5,null))[_0x8df9('0x24')](removeEntity(_0x4a24e5,null))['catch'](handleError(_0x4a24e5,null));};exports[_0x8df9('0x47')]=function(_0x343518,_0xd445c9){return db['Cdr'][_0x8df9('0x47')]()['then'](respondWithResult(_0xd445c9,null))[_0x8df9('0x41')](handleError(_0xd445c9,null));}; \ No newline at end of file +var _0x236d=['undefined','limit','count','set','apply','save','update','then','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','catch','destroy','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x3e3c73,_0x2c8583){var _0x5d4cb4=function(_0x1e3443){while(--_0x1e3443){_0x3e3c73['push'](_0x3e3c73['shift']());}};_0x5d4cb4(++_0x2c8583);}(_0x236d,0x7e));var _0xd236=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x236d[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xd236('0x0'));var rimraf=require(_0xd236('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd236('0x2'));var rp=require('request-promise');var moment=require(_0xd236('0x3'));var BPromise=require(_0xd236('0x4'));var Mustache=require(_0xd236('0x5'));var util=require(_0xd236('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd236('0x7'));var ejs=require(_0xd236('0x8'));var fs=require('fs');var fs_extra=require(_0xd236('0x9'));var _=require(_0xd236('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd236('0xb'));var deskjs=require(_0xd236('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd236('0xd'));var Papa=require(_0xd236('0xe'));var Redis=require('ioredis');var authService=require(_0xd236('0xf'));var qs=require(_0xd236('0x10'));var as=require(_0xd236('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd236('0x12'))(_0xd236('0x13'));var utils=require(_0xd236('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd236('0x15'));var db=require(_0xd236('0x16'))['db'];function respondWithStatusCode(_0x3d1076,_0x160cb1){_0x160cb1=_0x160cb1||0xcc;return function(_0x21f27b){if(_0x21f27b){return _0x3d1076[_0xd236('0x17')](_0x160cb1);}return _0x3d1076[_0xd236('0x18')](_0x160cb1)[_0xd236('0x19')]();};}function respondWithResult(_0x22435c,_0x3d7465){_0x3d7465=_0x3d7465||0xc8;return function(_0x348734){if(_0x348734){return _0x22435c[_0xd236('0x18')](_0x3d7465)[_0xd236('0x1a')](_0x348734);}};}function respondWithFilteredResult(_0x3b60a7,_0xd851b5){return function(_0x3b2535){if(_0x3b2535){var _0x2a076d=typeof _0xd851b5[_0xd236('0x1b')]===_0xd236('0x1c')&&typeof _0xd851b5[_0xd236('0x1d')]==='undefined';var _0x4f06c6=_0x3b2535[_0xd236('0x1e')];var _0x1b02a5=_0x2a076d?0x0:_0xd851b5['offset'];var _0x11c6ec=_0x2a076d?_0x3b2535[_0xd236('0x1e')]:_0xd851b5[_0xd236('0x1b')]+_0xd851b5['limit'];var _0x355b65;if(_0x11c6ec>=_0x4f06c6){_0x11c6ec=_0x4f06c6;_0x355b65=0xc8;}else{_0x355b65=0xce;}_0x3b60a7[_0xd236('0x18')](_0x355b65);return _0x3b60a7[_0xd236('0x1f')]('Content-Range',_0x1b02a5+'-'+_0x11c6ec+'/'+_0x4f06c6)[_0xd236('0x1a')](_0x3b2535);}return null;};}function patchUpdates(_0x3b0a27){return function(_0x26c758){try{jsonpatch[_0xd236('0x20')](_0x26c758,_0x3b0a27,!![]);}catch(_0x2f512d){return BPromise['reject'](_0x2f512d);}return _0x26c758[_0xd236('0x21')]();};}function saveUpdates(_0x30e7aa,_0x1e4ddb){return function(_0x3d1e4e){if(_0x3d1e4e){return _0x3d1e4e[_0xd236('0x22')](_0x30e7aa)['then'](function(_0x4a35d0){return _0x4a35d0;});}return null;};}function removeEntity(_0x257f27,_0x4be5ac){return function(_0x22924d){if(_0x22924d){return _0x22924d['destroy']()[_0xd236('0x23')](function(){_0x257f27[_0xd236('0x18')](0xcc)[_0xd236('0x19')]();});}};}function handleEntityNotFound(_0x49d822,_0x41049a){return function(_0x339b08){if(!_0x339b08){_0x49d822[_0xd236('0x17')](0x194);}return _0x339b08;};}function handleError(_0x13ba7a,_0x3a30d8){_0x3a30d8=_0x3a30d8||0x1f4;return function(_0x17f927){logger[_0xd236('0x24')](_0x17f927[_0xd236('0x25')]);if(_0x17f927[_0xd236('0x26')]){delete _0x17f927[_0xd236('0x26')];}_0x13ba7a[_0xd236('0x18')](_0x3a30d8)[_0xd236('0x27')](_0x17f927);};}exports[_0xd236('0x28')]=function(_0x23714d,_0x3108f4){var _0x28175d={},_0x436a19={},_0x471ed6={'count':0x0,'rows':[]};var _0x463fc8=_[_0xd236('0x29')](db[_0xd236('0x2a')][_0xd236('0x2b')],function(_0x3c1617){return{'name':_0x3c1617[_0xd236('0x2c')],'type':_0x3c1617[_0xd236('0x2d')][_0xd236('0x2e')]};});_0x436a19[_0xd236('0x2f')]=_[_0xd236('0x29')](_0x463fc8,_0xd236('0x26'));_0x436a19['query']=_[_0xd236('0x30')](_0x23714d['query']);_0x436a19[_0xd236('0x31')]=_[_0xd236('0x32')](_0x436a19[_0xd236('0x2f')],_0x436a19['query']);_0x28175d[_0xd236('0x33')]=_[_0xd236('0x32')](_0x436a19[_0xd236('0x2f')],qs[_0xd236('0x34')](_0x23714d[_0xd236('0x35')][_0xd236('0x34')]));_0x28175d[_0xd236('0x33')]=_0x28175d['attributes'][_0xd236('0x36')]?_0x28175d['attributes']:_0x436a19[_0xd236('0x2f')];if(!_0x23714d['query'][_0xd236('0x37')](_0xd236('0x38'))){_0x28175d[_0xd236('0x1d')]=qs[_0xd236('0x1d')](_0x23714d[_0xd236('0x35')][_0xd236('0x1d')]);_0x28175d[_0xd236('0x1b')]=qs[_0xd236('0x1b')](_0x23714d[_0xd236('0x35')][_0xd236('0x1b')]);}_0x28175d[_0xd236('0x39')]=qs[_0xd236('0x3a')](_0x23714d[_0xd236('0x35')]['sort']);_0x28175d[_0xd236('0x3b')]=qs[_0xd236('0x31')](_[_0xd236('0x3c')](_0x23714d['query'],_0x436a19[_0xd236('0x31')]),_0x463fc8);if(_0x23714d[_0xd236('0x35')][_0xd236('0x3d')]){_0x28175d[_0xd236('0x3b')]=_[_0xd236('0x3e')](_0x28175d[_0xd236('0x3b')],{'$or':_['map'](_0x463fc8,function(_0x696bed){if(_0x696bed[_0xd236('0x2d')]!==_0xd236('0x3f')){var _0x3c798f={};_0x3c798f[_0x696bed[_0xd236('0x26')]]={'$like':'%'+_0x23714d[_0xd236('0x35')]['filter']+'%'};return _0x3c798f;}})});}_0x28175d=_[_0xd236('0x3e')]({},_0x28175d,_0x23714d[_0xd236('0x40')]);var _0x2ba3ae={'where':_0x28175d['where']};return db[_0xd236('0x2a')]['count'](_0x2ba3ae)[_0xd236('0x23')](function(_0x5793bf){_0x471ed6['count']=_0x5793bf;if(_0x23714d[_0xd236('0x35')][_0xd236('0x41')]){_0x28175d[_0xd236('0x42')]=[{'all':!![]}];}return db[_0xd236('0x2a')][_0xd236('0x43')](_0x28175d);})['then'](function(_0x4d0d65){_0x471ed6[_0xd236('0x44')]=_0x4d0d65;return _0x471ed6;})[_0xd236('0x23')](respondWithFilteredResult(_0x3108f4,_0x28175d))['catch'](handleError(_0x3108f4,null));};exports[_0xd236('0x45')]=function(_0x342fd5,_0x2d815b){var _0x55007d={'raw':!![],'where':{'id':_0x342fd5['params']['id']}},_0x58a93a={};_0x58a93a[_0xd236('0x2f')]=_['keys'](db['Cdr'][_0xd236('0x2b')]);_0x58a93a[_0xd236('0x35')]=_[_0xd236('0x30')](_0x342fd5[_0xd236('0x35')]);_0x58a93a[_0xd236('0x31')]=_['intersection'](_0x58a93a['model'],_0x58a93a[_0xd236('0x35')]);_0x55007d[_0xd236('0x33')]=_[_0xd236('0x32')](_0x58a93a[_0xd236('0x2f')],qs[_0xd236('0x34')](_0x342fd5[_0xd236('0x35')]['fields']));_0x55007d[_0xd236('0x33')]=_0x55007d['attributes'][_0xd236('0x36')]?_0x55007d[_0xd236('0x33')]:_0x58a93a['model'];if(_0x342fd5['query']['includeAll']){_0x55007d['include']=[{'all':!![]}];}_0x55007d=_[_0xd236('0x3e')]({},_0x55007d,_0x342fd5[_0xd236('0x40')]);return db[_0xd236('0x2a')][_0xd236('0x46')](_0x55007d)[_0xd236('0x23')](handleEntityNotFound(_0x2d815b,null))['then'](respondWithResult(_0x2d815b,null))['catch'](handleError(_0x2d815b,null));};exports[_0xd236('0x47')]=function(_0x7c0650,_0xbf4ba9){return db[_0xd236('0x2a')][_0xd236('0x47')](_0x7c0650[_0xd236('0x48')],{})['then'](respondWithResult(_0xbf4ba9,0xc9))[_0xd236('0x49')](handleError(_0xbf4ba9,null));};exports['update']=function(_0x223a14,_0x2c8861){if(_0x223a14['body']['id']){delete _0x223a14[_0xd236('0x48')]['id'];}return db[_0xd236('0x2a')]['find']({'where':{'id':_0x223a14['params']['id']}})[_0xd236('0x23')](handleEntityNotFound(_0x2c8861,null))[_0xd236('0x23')](saveUpdates(_0x223a14[_0xd236('0x48')],null))[_0xd236('0x23')](respondWithResult(_0x2c8861,null))['catch'](handleError(_0x2c8861,null));};exports[_0xd236('0x4a')]=function(_0x43c12b,_0x3d8ca6){return db[_0xd236('0x2a')][_0xd236('0x46')]({'where':{'id':_0x43c12b[_0xd236('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3d8ca6,null))['then'](removeEntity(_0x3d8ca6,null))[_0xd236('0x49')](handleError(_0x3d8ca6,null));};exports['describe']=function(_0xa39da6,_0x30c336){return db['Cdr'][_0xd236('0x4c')]()[_0xd236('0x23')](respondWithResult(_0x30c336,null))['catch'](handleError(_0x30c336,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 643e319..a61e47d 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(_0x4f631e,_0x37281d){var _0x3f1447=function(_0x28c7fa){while(--_0x28c7fa){_0x4f631e['push'](_0x4f631e['shift']());}};_0x3f1447(++_0x37281d);}(_0x7a54,0x106));var _0x47a5=function(_0x4e0156,_0x40b3db){_0x4e0156=_0x4e0156-0x0;var _0x517f0c=_0x7a54[_0x4e0156];return _0x517f0c;};'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(_0x52385b,_0x35a2e6){var _0x59ae91=function(_0x5bd5a8){while(--_0x5bd5a8){_0x52385b['push'](_0x52385b['shift']());}};_0x59ae91(++_0x35a2e6);}(_0x7a54,0x106));var _0x47a5=function(_0x5d058e,_0x5ebbbc){_0x5d058e=_0x5d058e-0x0;var _0x1dd308=_0x7a54[_0x5d058e];return _0x1dd308;};'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 d505750..95ce243 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 _0x82dd=['then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x465823,_0x14c09b){var _0x41ed37=function(_0x267380){while(--_0x267380){_0x465823['push'](_0x465823['shift']());}};_0x41ed37(++_0x14c09b);}(_0x82dd,0x19a));var _0xd82d=function(_0x2e5a33,_0x2e768c){_0x2e5a33=_0x2e5a33-0x0;var _0x1f5221=_0x82dd[_0x2e5a33];return _0x1f5221;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd82d('0x0'));var fs=require('fs');var Redis=require(_0xd82d('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd82d('0x2'))(_0xd82d('0x3'));var config=require(_0xd82d('0x4'));var jayson=require(_0xd82d('0x5'));var client=jayson[_0xd82d('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c1ffe,_0x179ff2,_0x162d76){return new BPromise(function(_0x2b05d6,_0x1b8b2c){return client[_0xd82d('0x7')](_0x2c1ffe,_0x162d76)[_0xd82d('0x8')](function(_0x47deab){logger[_0xd82d('0x9')](_0xd82d('0xa'),_0x179ff2,_0xd82d('0xb'));logger[_0xd82d('0xc')]('Cdr,\x20%s,\x20%s,\x20%s',_0x179ff2,_0xd82d('0xb'),JSON[_0xd82d('0xd')](_0x47deab));if(_0x47deab[_0xd82d('0xe')]){if(_0x47deab[_0xd82d('0xe')][_0xd82d('0xf')]===0x1f4){logger[_0xd82d('0xe')]('Cdr,\x20%s,\x20%s',_0x179ff2,_0x47deab['error'][_0xd82d('0x10')]);return _0x1b8b2c(_0x47deab['error']['message']);}logger[_0xd82d('0xe')]('Cdr,\x20%s,\x20%s',_0x179ff2,_0x47deab[_0xd82d('0xe')][_0xd82d('0x10')]);return _0x2b05d6(_0x47deab[_0xd82d('0xe')][_0xd82d('0x10')]);}else{logger['info'](_0xd82d('0xa'),_0x179ff2,_0xd82d('0xb'));_0x2b05d6(_0x47deab[_0xd82d('0x11')][_0xd82d('0x10')]);}})[_0xd82d('0x12')](function(_0x67d267){logger[_0xd82d('0xe')](_0xd82d('0xa'),_0x179ff2,_0x67d267);_0x1b8b2c(_0x67d267);});});} \ No newline at end of file +var _0x1f52=['request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','Cdr,\x20%s,\x20%s'];(function(_0x4d35b3,_0x2e2144){var _0xf8aa9b=function(_0x486b00){while(--_0x486b00){_0x4d35b3['push'](_0x4d35b3['shift']());}};_0xf8aa9b(++_0x2e2144);}(_0x1f52,0x10b));var _0x21f5=function(_0x55fd2c,_0x3fa39a){_0x55fd2c=_0x55fd2c-0x0;var _0x42f962=_0x1f52[_0x55fd2c];return _0x42f962;};'use strict';var _=require(_0x21f5('0x0'));var util=require(_0x21f5('0x1'));var moment=require(_0x21f5('0x2'));var BPromise=require('bluebird');var rs=require(_0x21f5('0x3'));var fs=require('fs');var Redis=require(_0x21f5('0x4'));var db=require(_0x21f5('0x5'))['db'];var utils=require(_0x21f5('0x6'));var logger=require('../../config/logger')(_0x21f5('0x7'));var config=require(_0x21f5('0x8'));var jayson=require(_0x21f5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17a5c2,_0x20f770,_0x5eeb4e){return new BPromise(function(_0x537f30,_0x405f18){return client['request'](_0x17a5c2,_0x5eeb4e)[_0x21f5('0xa')](function(_0x2ab349){logger[_0x21f5('0xb')](_0x21f5('0xc'),_0x20f770,_0x21f5('0xd'));logger[_0x21f5('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x20f770,_0x21f5('0xd'),JSON['stringify'](_0x2ab349));if(_0x2ab349[_0x21f5('0xf')]){if(_0x2ab349['error'][_0x21f5('0x10')]===0x1f4){logger[_0x21f5('0xf')](_0x21f5('0xc'),_0x20f770,_0x2ab349[_0x21f5('0xf')]['message']);return _0x405f18(_0x2ab349['error'][_0x21f5('0x11')]);}logger[_0x21f5('0xf')]('Cdr,\x20%s,\x20%s',_0x20f770,_0x2ab349[_0x21f5('0xf')][_0x21f5('0x11')]);return _0x537f30(_0x2ab349['error'][_0x21f5('0x11')]);}else{logger['info'](_0x21f5('0xc'),_0x20f770,_0x21f5('0xd'));_0x537f30(_0x2ab349[_0x21f5('0x12')][_0x21f5('0x11')]);}})[_0x21f5('0x13')](function(_0x308f01){logger[_0x21f5('0xf')](_0x21f5('0xc'),_0x20f770,_0x308f01);_0x405f18(_0x308f01);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index d7b8fe2..ac532e7 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _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(_0x129bcd,_0x1c14f3){var _0x1c88dd=function(_0x12505b){while(--_0x12505b){_0x129bcd['push'](_0x129bcd['shift']());}};_0x1c88dd(++_0x1c14f3);}(_0xb10b,0x12a));var _0xbb10=function(_0x75267d,_0x5d286c){_0x75267d=_0x75267d-0x0;var _0x21ccec=_0xb10b[_0x75267d];return _0x21ccec;};'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 1ad832c..1d7768b 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 _0x5e86=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5e86,0xbd));var _0x65e8=function(_0x18626a,_0x1e4b54){_0x18626a=_0x18626a-0x0;var _0x228f9f=_0x5e86[_0x18626a];return _0x228f9f;};'use strict';var Sequelize=require(_0x65e8('0x0'));module[_0x65e8('0x1')]={'priority':{'type':Sequelize[_0x65e8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x65e8('0x3')],'allowNull':![],'defaultValue':_0x65e8('0x4')},'appdata':{'type':Sequelize[_0x65e8('0x5')]()},'description':{'type':Sequelize[_0x65e8('0x3')]},'interval':{'type':Sequelize[_0x65e8('0x3')],'defaultValue':_0x65e8('0x6')}}; \ No newline at end of file +var _0x0e01=['exports','noop','TEXT','STRING','*,*,*,*'];(function(_0x286923,_0x30a7d7){var _0x3ad8aa=function(_0x9d59bb){while(--_0x9d59bb){_0x286923['push'](_0x286923['shift']());}};_0x3ad8aa(++_0x30a7d7);}(_0x0e01,0x1e0));var _0x10e0=function(_0x28effe,_0x5599e7){_0x28effe=_0x28effe-0x0;var _0x477a1a=_0x0e01[_0x28effe];return _0x477a1a;};'use strict';var Sequelize=require('sequelize');module[_0x10e0('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x10e0('0x1')},'appdata':{'type':Sequelize[_0x10e0('0x2')]()},'description':{'type':Sequelize[_0x10e0('0x3')]},'interval':{'type':Sequelize[_0x10e0('0x3')],'defaultValue':_0x10e0('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 2b110bf..dd6b1eb 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 _0x4f6f=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','params','model','keys','ChatApplication','rawAttributes','query','filters','attributes','intersection','fields','include','merge','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4f6f,0x157));var _0xf4f6=function(_0x43941d,_0x45fd0d){_0x43941d=_0x43941d-0x0;var _0x27b82a=_0x4f6f[_0x43941d];return _0x27b82a;};'use strict';var emlformat=require(_0xf4f6('0x0'));var rimraf=require(_0xf4f6('0x1'));var zipdir=require(_0xf4f6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4f6('0x3'));var moment=require('moment');var BPromise=require(_0xf4f6('0x4'));var Mustache=require(_0xf4f6('0x5'));var util=require('util');var path=require(_0xf4f6('0x6'));var sox=require(_0xf4f6('0x7'));var csv=require('to-csv');var ejs=require(_0xf4f6('0x8'));var fs=require('fs');var fs_extra=require(_0xf4f6('0x9'));var _=require(_0xf4f6('0xa'));var squel=require('squel');var crypto=require(_0xf4f6('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf4f6('0xc'));var querystring=require(_0xf4f6('0xd'));var Papa=require(_0xf4f6('0xe'));var Redis=require(_0xf4f6('0xf'));var authService=require(_0xf4f6('0x10'));var qs=require(_0xf4f6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4f6('0x12'));var logger=require(_0xf4f6('0x13'))(_0xf4f6('0x14'));var utils=require(_0xf4f6('0x15'));var config=require(_0xf4f6('0x16'));var licenseUtil=require(_0xf4f6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ea38b,_0x107046){_0x107046=_0x107046||0xcc;return function(_0x4976f5){if(_0x4976f5){return _0x5ea38b['sendStatus'](_0x107046);}return _0x5ea38b[_0xf4f6('0x18')](_0x107046)[_0xf4f6('0x19')]();};}function respondWithResult(_0x33492d,_0x4e623b){_0x4e623b=_0x4e623b||0xc8;return function(_0x3f314c){if(_0x3f314c){return _0x33492d[_0xf4f6('0x18')](_0x4e623b)[_0xf4f6('0x1a')](_0x3f314c);}};}function respondWithFilteredResult(_0x51c4c3,_0xfdf7ae){return function(_0x5ba4c4){if(_0x5ba4c4){var _0x1f06b6=typeof _0xfdf7ae[_0xf4f6('0x1b')]===_0xf4f6('0x1c')&&typeof _0xfdf7ae['limit']===_0xf4f6('0x1c');var _0x310845=_0x5ba4c4[_0xf4f6('0x1d')];var _0x4e1d2a=_0x1f06b6?0x0:_0xfdf7ae[_0xf4f6('0x1b')];var _0x4cb047=_0x1f06b6?_0x5ba4c4[_0xf4f6('0x1d')]:_0xfdf7ae[_0xf4f6('0x1b')]+_0xfdf7ae[_0xf4f6('0x1e')];var _0x4f0d14;if(_0x4cb047>=_0x310845){_0x4cb047=_0x310845;_0x4f0d14=0xc8;}else{_0x4f0d14=0xce;}_0x51c4c3[_0xf4f6('0x18')](_0x4f0d14);return _0x51c4c3[_0xf4f6('0x1f')](_0xf4f6('0x20'),_0x4e1d2a+'-'+_0x4cb047+'/'+_0x310845)[_0xf4f6('0x1a')](_0x5ba4c4);}return null;};}function patchUpdates(_0x112918){return function(_0x794453){try{jsonpatch[_0xf4f6('0x21')](_0x794453,_0x112918,!![]);}catch(_0x30917b){return BPromise[_0xf4f6('0x22')](_0x30917b);}return _0x794453[_0xf4f6('0x23')]();};}function saveUpdates(_0x3a5e24,_0x4d8497){return function(_0x9148f1){if(_0x9148f1){return _0x9148f1[_0xf4f6('0x24')](_0x3a5e24)[_0xf4f6('0x25')](function(_0x55ac8c){return _0x55ac8c;});}return null;};}function removeEntity(_0x1324f3,_0x45b5fb){return function(_0x5bbc9d){if(_0x5bbc9d){return _0x5bbc9d[_0xf4f6('0x26')]()[_0xf4f6('0x25')](function(){_0x1324f3[_0xf4f6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32af7b,_0x224be7){return function(_0x464be1){if(!_0x464be1){_0x32af7b[_0xf4f6('0x27')](0x194);}return _0x464be1;};}function handleError(_0x5f1d69,_0x303e94){_0x303e94=_0x303e94||0x1f4;return function(_0x330ec1){logger[_0xf4f6('0x28')](_0x330ec1[_0xf4f6('0x29')]);if(_0x330ec1[_0xf4f6('0x2a')]){delete _0x330ec1[_0xf4f6('0x2a')];}_0x5f1d69[_0xf4f6('0x18')](_0x303e94)[_0xf4f6('0x2b')](_0x330ec1);};}exports['show']=function(_0x43604d,_0x3fb157){var _0xe13578={'raw':!![],'where':{'id':_0x43604d[_0xf4f6('0x2c')]['id']}},_0x59490b={};_0x59490b[_0xf4f6('0x2d')]=_[_0xf4f6('0x2e')](db[_0xf4f6('0x2f')][_0xf4f6('0x30')]);_0x59490b[_0xf4f6('0x31')]=_[_0xf4f6('0x2e')](_0x43604d[_0xf4f6('0x31')]);_0x59490b[_0xf4f6('0x32')]=_['intersection'](_0x59490b['model'],_0x59490b[_0xf4f6('0x31')]);_0xe13578[_0xf4f6('0x33')]=_[_0xf4f6('0x34')](_0x59490b[_0xf4f6('0x2d')],qs[_0xf4f6('0x35')](_0x43604d[_0xf4f6('0x31')][_0xf4f6('0x35')]));_0xe13578[_0xf4f6('0x33')]=_0xe13578[_0xf4f6('0x33')]['length']?_0xe13578[_0xf4f6('0x33')]:_0x59490b[_0xf4f6('0x2d')];if(_0x43604d[_0xf4f6('0x31')]['includeAll']){_0xe13578[_0xf4f6('0x36')]=[{'all':!![]}];}_0xe13578=_[_0xf4f6('0x37')]({},_0xe13578,_0x43604d[_0xf4f6('0x38')]);return db[_0xf4f6('0x2f')][_0xf4f6('0x39')](_0xe13578)['then'](handleEntityNotFound(_0x3fb157,null))[_0xf4f6('0x25')](respondWithResult(_0x3fb157,null))[_0xf4f6('0x3a')](handleError(_0x3fb157,null));};exports['update']=function(_0x36315f,_0x384436){if(_0x36315f[_0xf4f6('0x3b')]['id']){delete _0x36315f[_0xf4f6('0x3b')]['id'];}return db['ChatApplication'][_0xf4f6('0x39')]({'where':{'id':_0x36315f['params']['id']}})[_0xf4f6('0x25')](handleEntityNotFound(_0x384436,null))[_0xf4f6('0x25')](saveUpdates(_0x36315f[_0xf4f6('0x3b')],null))['then'](respondWithResult(_0x384436,null))[_0xf4f6('0x3a')](handleError(_0x384436,null));};exports[_0xf4f6('0x26')]=function(_0x46f9b9,_0xf11e25){return db['ChatApplication'][_0xf4f6('0x39')]({'where':{'id':_0x46f9b9[_0xf4f6('0x2c')]['id']}})[_0xf4f6('0x25')](handleEntityNotFound(_0xf11e25,null))['then'](removeEntity(_0xf11e25,null))[_0xf4f6('0x3a')](handleError(_0xf11e25,null));}; \ No newline at end of file +var _0xc2da=['includeAll','include','options','find','catch','body','params','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','limit','undefined','count','set','apply','reject','save','update','then','destroy','name','send','show','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','model'];(function(_0x2d8e40,_0x306bb4){var _0x2da360=function(_0x18c988){while(--_0x18c988){_0x2d8e40['push'](_0x2d8e40['shift']());}};_0x2da360(++_0x306bb4);}(_0xc2da,0x124));var _0xac2d=function(_0xa7c05d,_0x312374){_0xa7c05d=_0xa7c05d-0x0;var _0x47b002=_0xc2da[_0xa7c05d];return _0x47b002;};'use strict';var emlformat=require(_0xac2d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac2d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac2d('0x2'));var moment=require('moment');var BPromise=require(_0xac2d('0x3'));var Mustache=require(_0xac2d('0x4'));var util=require(_0xac2d('0x5'));var path=require(_0xac2d('0x6'));var sox=require(_0xac2d('0x7'));var csv=require(_0xac2d('0x8'));var ejs=require(_0xac2d('0x9'));var fs=require('fs');var fs_extra=require(_0xac2d('0xa'));var _=require(_0xac2d('0xb'));var squel=require(_0xac2d('0xc'));var crypto=require(_0xac2d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac2d('0x8'));var querystring=require('querystring');var Papa=require(_0xac2d('0xe'));var Redis=require(_0xac2d('0xf'));var authService=require(_0xac2d('0x10'));var qs=require(_0xac2d('0x11'));var as=require(_0xac2d('0x12'));var hardwareService=require(_0xac2d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xac2d('0x14'));var config=require(_0xac2d('0x15'));var licenseUtil=require(_0xac2d('0x16'));var db=require(_0xac2d('0x17'))['db'];function respondWithStatusCode(_0x4b9e88,_0x21aa1b){_0x21aa1b=_0x21aa1b||0xcc;return function(_0x20fa0d){if(_0x20fa0d){return _0x4b9e88[_0xac2d('0x18')](_0x21aa1b);}return _0x4b9e88[_0xac2d('0x19')](_0x21aa1b)[_0xac2d('0x1a')]();};}function respondWithResult(_0x2bed84,_0x284984){_0x284984=_0x284984||0xc8;return function(_0x897641){if(_0x897641){return _0x2bed84[_0xac2d('0x19')](_0x284984)[_0xac2d('0x1b')](_0x897641);}};}function respondWithFilteredResult(_0x11a3aa,_0x33d014){return function(_0x74853a){if(_0x74853a){var _0x2d92b5=typeof _0x33d014[_0xac2d('0x1c')]==='undefined'&&typeof _0x33d014[_0xac2d('0x1d')]===_0xac2d('0x1e');var _0x50ac65=_0x74853a[_0xac2d('0x1f')];var _0xed956b=_0x2d92b5?0x0:_0x33d014[_0xac2d('0x1c')];var _0x4d34fa=_0x2d92b5?_0x74853a[_0xac2d('0x1f')]:_0x33d014['offset']+_0x33d014[_0xac2d('0x1d')];var _0x3651e6;if(_0x4d34fa>=_0x50ac65){_0x4d34fa=_0x50ac65;_0x3651e6=0xc8;}else{_0x3651e6=0xce;}_0x11a3aa['status'](_0x3651e6);return _0x11a3aa[_0xac2d('0x20')]('Content-Range',_0xed956b+'-'+_0x4d34fa+'/'+_0x50ac65)['json'](_0x74853a);}return null;};}function patchUpdates(_0x510e85){return function(_0x5eaaef){try{jsonpatch[_0xac2d('0x21')](_0x5eaaef,_0x510e85,!![]);}catch(_0x21c407){return BPromise[_0xac2d('0x22')](_0x21c407);}return _0x5eaaef[_0xac2d('0x23')]();};}function saveUpdates(_0x211d26,_0x391911){return function(_0x3454ea){if(_0x3454ea){return _0x3454ea[_0xac2d('0x24')](_0x211d26)[_0xac2d('0x25')](function(_0x3f1212){return _0x3f1212;});}return null;};}function removeEntity(_0xafa502,_0x226b6b){return function(_0x1df55b){if(_0x1df55b){return _0x1df55b[_0xac2d('0x26')]()[_0xac2d('0x25')](function(){_0xafa502[_0xac2d('0x19')](0xcc)[_0xac2d('0x1a')]();});}};}function handleEntityNotFound(_0x10da1d,_0x271e47){return function(_0x5f00a0){if(!_0x5f00a0){_0x10da1d[_0xac2d('0x18')](0x194);}return _0x5f00a0;};}function handleError(_0x38cad3,_0x337228){_0x337228=_0x337228||0x1f4;return function(_0x2323c8){logger['error'](_0x2323c8['stack']);if(_0x2323c8[_0xac2d('0x27')]){delete _0x2323c8[_0xac2d('0x27')];}_0x38cad3[_0xac2d('0x19')](_0x337228)[_0xac2d('0x28')](_0x2323c8);};}exports[_0xac2d('0x29')]=function(_0x2906ac,_0x104af8){var _0x42aa82={'raw':!![],'where':{'id':_0x2906ac['params']['id']}},_0x2ac875={};_0x2ac875['model']=_[_0xac2d('0x2a')](db[_0xac2d('0x2b')][_0xac2d('0x2c')]);_0x2ac875[_0xac2d('0x2d')]=_[_0xac2d('0x2a')](_0x2906ac['query']);_0x2ac875[_0xac2d('0x2e')]=_[_0xac2d('0x2f')](_0x2ac875['model'],_0x2ac875[_0xac2d('0x2d')]);_0x42aa82[_0xac2d('0x30')]=_[_0xac2d('0x2f')](_0x2ac875[_0xac2d('0x31')],qs['fields'](_0x2906ac[_0xac2d('0x2d')]['fields']));_0x42aa82[_0xac2d('0x30')]=_0x42aa82[_0xac2d('0x30')]['length']?_0x42aa82[_0xac2d('0x30')]:_0x2ac875[_0xac2d('0x31')];if(_0x2906ac[_0xac2d('0x2d')][_0xac2d('0x32')]){_0x42aa82[_0xac2d('0x33')]=[{'all':!![]}];}_0x42aa82=_['merge']({},_0x42aa82,_0x2906ac[_0xac2d('0x34')]);return db['ChatApplication'][_0xac2d('0x35')](_0x42aa82)['then'](handleEntityNotFound(_0x104af8,null))[_0xac2d('0x25')](respondWithResult(_0x104af8,null))[_0xac2d('0x36')](handleError(_0x104af8,null));};exports['update']=function(_0x5bd1e3,_0x3cf4d5){if(_0x5bd1e3[_0xac2d('0x37')]['id']){delete _0x5bd1e3[_0xac2d('0x37')]['id'];}return db[_0xac2d('0x2b')][_0xac2d('0x35')]({'where':{'id':_0x5bd1e3[_0xac2d('0x38')]['id']}})[_0xac2d('0x25')](handleEntityNotFound(_0x3cf4d5,null))['then'](saveUpdates(_0x5bd1e3[_0xac2d('0x37')],null))[_0xac2d('0x25')](respondWithResult(_0x3cf4d5,null))[_0xac2d('0x36')](handleError(_0x3cf4d5,null));};exports[_0xac2d('0x26')]=function(_0x2d90c2,_0x4eb307){return db[_0xac2d('0x2b')][_0xac2d('0x35')]({'where':{'id':_0x2d90c2[_0xac2d('0x38')]['id']}})[_0xac2d('0x25')](handleEntityNotFound(_0x4eb307,null))[_0xac2d('0x25')](removeEntity(_0x4eb307,null))[_0xac2d('0x36')](handleError(_0x4eb307,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 3f61b3c..617874b 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 _0xb379=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x210f2a,_0x409c0e){var _0x3ebbdf=function(_0x4ef2b2){while(--_0x4ef2b2){_0x210f2a['push'](_0x210f2a['shift']());}};_0x3ebbdf(++_0x409c0e);}(_0xb379,0x16b));var _0x9b37=function(_0x2c1f6c,_0x20ec3c){_0x2c1f6c=_0x2c1f6c-0x0;var _0x480e88=_0xb379[_0x2c1f6c];return _0x480e88;};'use strict';var _=require(_0x9b37('0x0'));var util=require('util');var logger=require(_0x9b37('0x1'))(_0x9b37('0x2'));var moment=require(_0x9b37('0x3'));var BPromise=require('bluebird');var rp=require(_0x9b37('0x4'));var fs=require('fs');var path=require(_0x9b37('0x5'));var rimraf=require(_0x9b37('0x6'));var config=require(_0x9b37('0x7'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0x344fb5,_0x371d38){return _0x344fb5[_0x9b37('0x8')](_0x9b37('0x9'),attributes,{'tableName':_0x9b37('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9b37('0xb'),'collate':_0x9b37('0xc')});}; \ No newline at end of file +var _0xfd10=['./chatApplication.attributes','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x24c46e,_0x4c2418){var _0x10282a=function(_0x8af004){while(--_0x8af004){_0x24c46e['push'](_0x24c46e['shift']());}};_0x10282a(++_0x4c2418);}(_0xfd10,0x72));var _0x0fd1=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xfd10[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x0fd1('0x0'));var util=require(_0x0fd1('0x1'));var logger=require('../../config/logger')(_0x0fd1('0x2'));var moment=require(_0x0fd1('0x3'));var BPromise=require(_0x0fd1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0fd1('0x5'));var config=require(_0x0fd1('0x6'));var attributes=require(_0x0fd1('0x7'));module['exports']=function(_0x4cb379,_0x1b004e){return _0x4cb379['define'](_0x0fd1('0x8'),attributes,{'tableName':_0x0fd1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0fd1('0xa')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 34b0e8d..24a1811 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 _0x5fd3=['then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0xdf25b2,_0xcb05d0){var _0x226517=function(_0x7a41d5){while(--_0x7a41d5){_0xdf25b2['push'](_0xdf25b2['shift']());}};_0x226517(++_0xcb05d0);}(_0x5fd3,0x164));var _0x35fd=function(_0x1cc0a7,_0x2edf25){_0x1cc0a7=_0x1cc0a7-0x0;var _0x14bdc6=_0x5fd3[_0x1cc0a7];return _0x14bdc6;};'use strict';var _=require(_0x35fd('0x0'));var util=require(_0x35fd('0x1'));var moment=require(_0x35fd('0x2'));var BPromise=require(_0x35fd('0x3'));var rs=require(_0x35fd('0x4'));var fs=require('fs');var Redis=require(_0x35fd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x35fd('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x35fd('0x7'));var jayson=require(_0x35fd('0x8'));var client=jayson[_0x35fd('0x9')][_0x35fd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5114e4,_0x4db99b,_0x14fd6e){return new BPromise(function(_0x31fc1c,_0x5771bd){return client[_0x35fd('0xb')](_0x5114e4,_0x14fd6e)[_0x35fd('0xc')](function(_0x180ad9){logger[_0x35fd('0xd')](_0x35fd('0xe'),_0x4db99b,_0x35fd('0xf'));logger['debug'](_0x35fd('0x10'),_0x4db99b,_0x35fd('0xf'),JSON[_0x35fd('0x11')](_0x180ad9));if(_0x180ad9['error']){if(_0x180ad9[_0x35fd('0x12')][_0x35fd('0x13')]===0x1f4){logger[_0x35fd('0x12')]('ChatApplication,\x20%s,\x20%s',_0x4db99b,_0x180ad9['error'][_0x35fd('0x14')]);return _0x5771bd(_0x180ad9[_0x35fd('0x12')]['message']);}logger[_0x35fd('0x12')](_0x35fd('0xe'),_0x4db99b,_0x180ad9[_0x35fd('0x12')]['message']);return _0x31fc1c(_0x180ad9[_0x35fd('0x12')][_0x35fd('0x14')]);}else{logger[_0x35fd('0xd')](_0x35fd('0xe'),_0x4db99b,_0x35fd('0xf'));_0x31fc1c(_0x180ad9[_0x35fd('0x15')]['message']);}})[_0x35fd('0x16')](function(_0x2cb5de){logger[_0x35fd('0x12')](_0x35fd('0xe'),_0x4db99b,_0x2cb5de);_0x5771bd(_0x2cb5de);});});} \ No newline at end of file +var _0x9f24=['http','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','ChatApplication,\x20%s,\x20%s','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x443351,_0x410b26){var _0x25e2a0=function(_0x1fbe01){while(--_0x1fbe01){_0x443351['push'](_0x443351['shift']());}};_0x25e2a0(++_0x410b26);}(_0x9f24,0xbb));var _0x49f2=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x9f24[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x49f2('0x0'));var util=require('util');var moment=require(_0x49f2('0x1'));var BPromise=require('bluebird');var rs=require(_0x49f2('0x2'));var fs=require('fs');var Redis=require(_0x49f2('0x3'));var db=require(_0x49f2('0x4'))['db'];var utils=require(_0x49f2('0x5'));var logger=require(_0x49f2('0x6'))(_0x49f2('0x7'));var config=require(_0x49f2('0x8'));var jayson=require(_0x49f2('0x9'));var client=jayson[_0x49f2('0xa')][_0x49f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3afa7d,_0x285fa0,_0x4353b7){return new BPromise(function(_0x1b89d0,_0x39986a){return client['request'](_0x3afa7d,_0x4353b7)[_0x49f2('0xc')](function(_0x735e6d){logger[_0x49f2('0xd')]('ChatApplication,\x20%s,\x20%s',_0x285fa0,_0x49f2('0xe'));logger[_0x49f2('0xf')](_0x49f2('0x10'),_0x285fa0,_0x49f2('0xe'),JSON['stringify'](_0x735e6d));if(_0x735e6d[_0x49f2('0x11')]){if(_0x735e6d[_0x49f2('0x11')][_0x49f2('0x12')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x285fa0,_0x735e6d[_0x49f2('0x11')][_0x49f2('0x13')]);return _0x39986a(_0x735e6d[_0x49f2('0x11')][_0x49f2('0x13')]);}logger[_0x49f2('0x11')](_0x49f2('0x14'),_0x285fa0,_0x735e6d[_0x49f2('0x11')][_0x49f2('0x13')]);return _0x1b89d0(_0x735e6d[_0x49f2('0x11')][_0x49f2('0x13')]);}else{logger[_0x49f2('0xd')](_0x49f2('0x14'),_0x285fa0,_0x49f2('0xe'));_0x1b89d0(_0x735e6d[_0x49f2('0x15')]['message']);}})['catch'](function(_0x2991cc){logger['error'](_0x49f2('0x14'),_0x285fa0,_0x2991cc);_0x39986a(_0x2991cc);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index a1f8ed6..df8e7b6 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 _0x21e7=['isAuthenticated','update','delete','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','show','put','/:id'];(function(_0x5064d2,_0x52213e){var _0x524dca=function(_0x4d6e4d){while(--_0x4d6e4d){_0x5064d2['push'](_0x5064d2['shift']());}};_0x524dca(++_0x52213e);}(_0x21e7,0x1d5));var _0x721e=function(_0x1c269e,_0x533203){_0x1c269e=_0x1c269e-0x0;var _0x5d9383=_0x21e7[_0x1c269e];return _0x5d9383;};'use strict';var multer=require('multer');var util=require(_0x721e('0x0'));var path=require(_0x721e('0x1'));var timeout=require('connect-timeout');var express=require(_0x721e('0x2'));var router=express['Router']();var fs_extra=require(_0x721e('0x3'));var auth=require(_0x721e('0x4'));var interaction=require(_0x721e('0x5'));var config=require(_0x721e('0x6'));var controller=require(_0x721e('0x7'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x721e('0x8')]);router[_0x721e('0x9')](_0x721e('0xa'),auth[_0x721e('0xb')](),controller[_0x721e('0xc')]);router[_0x721e('0xd')](_0x721e('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x721e('0xe')]=router; \ No newline at end of file +var _0x21f0=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','/:id','isAuthenticated','show','put','update','destroy','exports'];(function(_0x4a1f05,_0x193d41){var _0x193aff=function(_0x248cfc){while(--_0x248cfc){_0x4a1f05['push'](_0x4a1f05['shift']());}};_0x193aff(++_0x193d41);}(_0x21f0,0x70));var _0x021f=function(_0x14177e,_0x168043){_0x14177e=_0x14177e-0x0;var _0x46201b=_0x21f0[_0x14177e];return _0x46201b;};'use strict';var multer=require(_0x021f('0x0'));var util=require(_0x021f('0x1'));var path=require(_0x021f('0x2'));var timeout=require(_0x021f('0x3'));var express=require(_0x021f('0x4'));var router=express[_0x021f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x021f('0x6'));var interaction=require(_0x021f('0x7'));var config=require('../../config/environment');var controller=require(_0x021f('0x8'));router['get'](_0x021f('0x9'),auth[_0x021f('0xa')](),controller[_0x021f('0xb')]);router[_0x021f('0xc')]('/:id',auth[_0x021f('0xa')](),controller[_0x021f('0xd')]);router['delete'](_0x021f('0x9'),auth[_0x021f('0xa')](),controller[_0x021f('0xe')]);module[_0x021f('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index d0c8149..6e205e1 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 _0x600f=['sequelize','exports','STRING','BOOLEAN'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x600f,0xb4));var _0xf600=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0x600f[_0x280ae7];return _0x418b9e;};'use strict';var Sequelize=require(_0xf600('0x0'));module[_0xf600('0x1')]={'name':{'type':Sequelize[_0xf600('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xf600('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc165=['BOOLEAN','sequelize','exports','STRING'];(function(_0x4d7e2a,_0x239f14){var _0x37559a=function(_0x298a1b){while(--_0x298a1b){_0x4d7e2a['push'](_0x4d7e2a['shift']());}};_0x37559a(++_0x239f14);}(_0xc165,0x199));var _0x5c16=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0xc165[_0x359bbe];return _0x1b3353;};'use strict';var Sequelize=require(_0x5c16('0x0'));module[_0x5c16('0x1')]={'name':{'type':Sequelize[_0x5c16('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5c16('0x2')]},'write':{'type':Sequelize[_0x5c16('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 1a97f7a..1d835c7 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 _0x47b8=['removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','nolimit','eml-format','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','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','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','ChatGroup','includeAll','include','findAll','params','intersection','catch','create','body','find','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','findOne','User','pick','getMembers'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x47b8,0x6c));var _0x847b=function(_0x56078b,_0xf28749){_0x56078b=_0x56078b-0x0;var _0x4dbd9a=_0x47b8[_0x56078b];return _0x4dbd9a;};'use strict';var emlformat=require(_0x847b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x847b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x847b('0x2'));var moment=require('moment');var BPromise=require(_0x847b('0x3'));var Mustache=require(_0x847b('0x4'));var util=require('util');var path=require(_0x847b('0x5'));var sox=require('sox');var csv=require(_0x847b('0x6'));var ejs=require(_0x847b('0x7'));var fs=require('fs');var fs_extra=require(_0x847b('0x8'));var _=require(_0x847b('0x9'));var squel=require(_0x847b('0xa'));var crypto=require(_0x847b('0xb'));var jsforce=require(_0x847b('0xc'));var deskjs=require(_0x847b('0xd'));var toCsv=require(_0x847b('0x6'));var querystring=require('querystring');var Papa=require(_0x847b('0xe'));var Redis=require(_0x847b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x847b('0x10'));var as=require(_0x847b('0x11'));var hardwareService=require(_0x847b('0x12'));var logger=require(_0x847b('0x13'))(_0x847b('0x14'));var utils=require('../../config/utils');var config=require(_0x847b('0x15'));var licenseUtil=require(_0x847b('0x16'));var db=require(_0x847b('0x17'))['db'];config[_0x847b('0x18')]=_[_0x847b('0x19')](config['redis'],{'host':_0x847b('0x1a'),'port':0x18eb});var socket=require(_0x847b('0x1b'))(new Redis(config['redis']));require(_0x847b('0x1c'))[_0x847b('0x1d')](socket);function respondWithStatusCode(_0x6d9f0c,_0x201ef3){_0x201ef3=_0x201ef3||0xcc;return function(_0x2da75c){if(_0x2da75c){return _0x6d9f0c[_0x847b('0x1e')](_0x201ef3);}return _0x6d9f0c[_0x847b('0x1f')](_0x201ef3)[_0x847b('0x20')]();};}function respondWithResult(_0x56b83c,_0x365cbf){_0x365cbf=_0x365cbf||0xc8;return function(_0x1ff36e){if(_0x1ff36e){return _0x56b83c[_0x847b('0x1f')](_0x365cbf)[_0x847b('0x21')](_0x1ff36e);}};}function respondWithFilteredResult(_0x411299,_0x111fa0){return function(_0x543b00){if(_0x543b00){var _0x5851bf=typeof _0x111fa0[_0x847b('0x22')]===_0x847b('0x23')&&typeof _0x111fa0[_0x847b('0x24')]===_0x847b('0x23');var _0x43daf9=_0x543b00[_0x847b('0x25')];var _0x34de0c=_0x5851bf?0x0:_0x111fa0[_0x847b('0x22')];var _0x23ad9f=_0x5851bf?_0x543b00[_0x847b('0x25')]:_0x111fa0['offset']+_0x111fa0[_0x847b('0x24')];var _0x11a23d;if(_0x23ad9f>=_0x43daf9){_0x23ad9f=_0x43daf9;_0x11a23d=0xc8;}else{_0x11a23d=0xce;}_0x411299[_0x847b('0x1f')](_0x11a23d);return _0x411299['set'](_0x847b('0x26'),_0x34de0c+'-'+_0x23ad9f+'/'+_0x43daf9)[_0x847b('0x21')](_0x543b00);}return null;};}function patchUpdates(_0x45abab){return function(_0x24684a){try{jsonpatch[_0x847b('0x27')](_0x24684a,_0x45abab,!![]);}catch(_0x47d05b){return BPromise[_0x847b('0x28')](_0x47d05b);}return _0x24684a[_0x847b('0x29')]();};}function saveUpdates(_0x2ec5dc,_0x19bd1a){return function(_0x57df08){if(_0x57df08){return _0x57df08[_0x847b('0x2a')](_0x2ec5dc)[_0x847b('0x2b')](function(_0x789b9d){return _0x789b9d;});}return null;};}function removeEntity(_0x470ec9,_0xcde571){return function(_0x380450){if(_0x380450){return _0x380450[_0x847b('0x2c')]()['then'](function(){_0x470ec9[_0x847b('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x216df4,_0x5416c6){return function(_0x1eed2c){if(!_0x1eed2c){_0x216df4[_0x847b('0x1e')](0x194);}return _0x1eed2c;};}function handleError(_0x5ed04b,_0x3f3c38){_0x3f3c38=_0x3f3c38||0x1f4;return function(_0x2bf6b4){logger[_0x847b('0x2d')](_0x2bf6b4[_0x847b('0x2e')]);if(_0x2bf6b4[_0x847b('0x2f')]){delete _0x2bf6b4[_0x847b('0x2f')];}_0x5ed04b[_0x847b('0x1f')](_0x3f3c38)[_0x847b('0x30')](_0x2bf6b4);};}exports[_0x847b('0x31')]=function(_0x562a71,_0x16b386){var _0x3784cd={},_0x3c9005={},_0x44a293={'count':0x0,'rows':[]};var _0x4743dd=_[_0x847b('0x32')](db['ChatGroup'][_0x847b('0x33')],function(_0xf13037){return{'name':_0xf13037[_0x847b('0x34')],'type':_0xf13037[_0x847b('0x35')][_0x847b('0x36')]};});_0x3c9005[_0x847b('0x37')]=_[_0x847b('0x32')](_0x4743dd,_0x847b('0x2f'));_0x3c9005['query']=_[_0x847b('0x38')](_0x562a71[_0x847b('0x39')]);_0x3c9005[_0x847b('0x3a')]=_['intersection'](_0x3c9005[_0x847b('0x37')],_0x3c9005[_0x847b('0x39')]);_0x3784cd[_0x847b('0x3b')]=_['intersection'](_0x3c9005[_0x847b('0x37')],qs[_0x847b('0x3c')](_0x562a71[_0x847b('0x39')]['fields']));_0x3784cd[_0x847b('0x3b')]=_0x3784cd['attributes'][_0x847b('0x3d')]?_0x3784cd[_0x847b('0x3b')]:_0x3c9005['model'];if(!_0x562a71[_0x847b('0x39')][_0x847b('0x3e')]('nolimit')){_0x3784cd['limit']=qs[_0x847b('0x24')](_0x562a71['query']['limit']);_0x3784cd[_0x847b('0x22')]=qs['offset'](_0x562a71[_0x847b('0x39')][_0x847b('0x22')]);}_0x3784cd[_0x847b('0x3f')]=qs[_0x847b('0x40')](_0x562a71[_0x847b('0x39')][_0x847b('0x40')]);_0x3784cd[_0x847b('0x41')]=qs[_0x847b('0x3a')](_['pick'](_0x562a71[_0x847b('0x39')],_0x3c9005['filters']),_0x4743dd);if(_0x562a71[_0x847b('0x39')][_0x847b('0x42')]){_0x3784cd[_0x847b('0x41')]=_[_0x847b('0x43')](_0x3784cd[_0x847b('0x41')],{'$or':_[_0x847b('0x32')](_0x4743dd,function(_0x5629d9){if(_0x5629d9[_0x847b('0x35')]!==_0x847b('0x44')){var _0x4f4667={};_0x4f4667[_0x5629d9[_0x847b('0x2f')]]={'$like':'%'+_0x562a71[_0x847b('0x39')][_0x847b('0x42')]+'%'};return _0x4f4667;}})});}_0x3784cd=_[_0x847b('0x43')]({},_0x3784cd,_0x562a71[_0x847b('0x45')]);var _0x1e078f={'where':_0x3784cd['where']};return db[_0x847b('0x46')][_0x847b('0x25')](_0x1e078f)[_0x847b('0x2b')](function(_0x214c53){_0x44a293['count']=_0x214c53;if(_0x562a71[_0x847b('0x39')][_0x847b('0x47')]){_0x3784cd[_0x847b('0x48')]=[{'all':!![]}];}return db['ChatGroup'][_0x847b('0x49')](_0x3784cd);})['then'](function(_0x20f6d7){_0x44a293['rows']=_0x20f6d7;return _0x44a293;})[_0x847b('0x2b')](respondWithFilteredResult(_0x16b386,_0x3784cd))['catch'](handleError(_0x16b386,null));};exports['show']=function(_0x59175d,_0x1e38ad){var _0x29f574={'raw':!![],'where':{'id':_0x59175d[_0x847b('0x4a')]['id']}},_0xb25599={};_0xb25599[_0x847b('0x37')]=_[_0x847b('0x38')](db[_0x847b('0x46')]['rawAttributes']);_0xb25599[_0x847b('0x39')]=_[_0x847b('0x38')](_0x59175d[_0x847b('0x39')]);_0xb25599[_0x847b('0x3a')]=_['intersection'](_0xb25599['model'],_0xb25599['query']);_0x29f574['attributes']=_[_0x847b('0x4b')](_0xb25599[_0x847b('0x37')],qs[_0x847b('0x3c')](_0x59175d['query'][_0x847b('0x3c')]));_0x29f574[_0x847b('0x3b')]=_0x29f574[_0x847b('0x3b')]['length']?_0x29f574['attributes']:_0xb25599[_0x847b('0x37')];if(_0x59175d[_0x847b('0x39')]['includeAll']){_0x29f574['include']=[{'all':!![]}];}_0x29f574=_[_0x847b('0x43')]({},_0x29f574,_0x59175d[_0x847b('0x45')]);return db[_0x847b('0x46')]['find'](_0x29f574)['then'](handleEntityNotFound(_0x1e38ad,null))['then'](respondWithResult(_0x1e38ad,null))[_0x847b('0x4c')](handleError(_0x1e38ad,null));};exports[_0x847b('0x4d')]=function(_0x54eb08,_0x1e33b3){return db[_0x847b('0x46')][_0x847b('0x4d')](_0x54eb08[_0x847b('0x4e')],{})['then'](respondWithResult(_0x1e33b3,0xc9))[_0x847b('0x4c')](handleError(_0x1e33b3,null));};exports[_0x847b('0x2a')]=function(_0x12eb05,_0x4f6b69){if(_0x12eb05['body']['id']){delete _0x12eb05[_0x847b('0x4e')]['id'];}return db[_0x847b('0x46')][_0x847b('0x4f')]({'where':{'id':_0x12eb05[_0x847b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f6b69,null))[_0x847b('0x2b')](saveUpdates(_0x12eb05[_0x847b('0x4e')],null))[_0x847b('0x2b')](respondWithResult(_0x4f6b69,null))['catch'](handleError(_0x4f6b69,null));};exports[_0x847b('0x2c')]=function(_0x46c5eb,_0x1f3ebb){return db[_0x847b('0x46')][_0x847b('0x4f')]({'where':{'id':_0x46c5eb['params']['id']}})[_0x847b('0x2b')](handleEntityNotFound(_0x1f3ebb,null))['then'](removeEntity(_0x1f3ebb,null))[_0x847b('0x4c')](handleError(_0x1f3ebb,null));};exports['describe']=function(_0xa3facf,_0x378b17){return db[_0x847b('0x46')]['describe']()['then'](respondWithResult(_0x378b17,null))[_0x847b('0x4c')](handleError(_0x378b17,null));};exports[_0x847b('0x50')]=function(_0x52bd19,_0x2fcf1a,_0xeb0a60){return db[_0x847b('0x51')][_0x847b('0x25')]({'where':{'ChatGroupId':_0x52bd19[_0x847b('0x4a')]['id'],'ToId':_0x52bd19[_0x847b('0x52')]['id'],'read':![]}})[_0x847b('0x2b')](function(_0x3d361c){return{'id':_[_0x847b('0x53')](_0x52bd19[_0x847b('0x4a')]['id']),'count':_0x3d361c};})['then'](respondWithResult(_0x2fcf1a,null))[_0x847b('0x4c')](handleError(_0x2fcf1a,null));};exports[_0x847b('0x54')]=function(_0x336528,_0xabfca6,_0x3e3052){return db[_0x847b('0x46')][_0x847b('0x4f')]({'where':{'id':_0x336528['params']['id']}})['then'](handleEntityNotFound(_0xabfca6,null))[_0x847b('0x2b')](function(_0x26d092){if(_0x26d092){return _0x26d092[_0x847b('0x54')](_0x336528[_0x847b('0x4e')][_0x847b('0x55')],_['omit'](_0x336528[_0x847b('0x4e')],[_0x847b('0x55'),'id'])||{});}})[_0x847b('0x2b')](respondWithResult(_0xabfca6,null))[_0x847b('0x4c')](handleError(_0xabfca6,null));};exports['getMembers']=function(_0x291315,_0x205761,_0x28e66e){var _0xff4d02={};var _0x17716d={};var _0x4f5658;var _0x1860b3;return db[_0x847b('0x46')][_0x847b('0x56')]({'where':{'id':_0x291315[_0x847b('0x4a')]['id']}})[_0x847b('0x2b')](handleEntityNotFound(_0x205761,null))['then'](function(_0xc2e91c){if(_0xc2e91c){_0x4f5658=_0xc2e91c;_0x17716d[_0x847b('0x37')]=_[_0x847b('0x38')](db[_0x847b('0x57')][_0x847b('0x33')]);_0x17716d[_0x847b('0x39')]=_[_0x847b('0x38')](_0x291315[_0x847b('0x39')]);_0x17716d[_0x847b('0x3a')]=_[_0x847b('0x4b')](_0x17716d[_0x847b('0x37')],_0x17716d['query']);_0xff4d02[_0x847b('0x3b')]=_[_0x847b('0x4b')](_0x17716d[_0x847b('0x37')],qs[_0x847b('0x3c')](_0x291315[_0x847b('0x39')][_0x847b('0x3c')]));_0xff4d02['attributes']=_0xff4d02[_0x847b('0x3b')]['length']?_0xff4d02[_0x847b('0x3b')]:_0x17716d[_0x847b('0x37')];_0xff4d02[_0x847b('0x3f')]=qs[_0x847b('0x40')](_0x291315[_0x847b('0x39')][_0x847b('0x40')]);_0xff4d02[_0x847b('0x41')]=qs[_0x847b('0x3a')](_[_0x847b('0x58')](_0x291315['query'],_0x17716d['filters']));if(_0x291315[_0x847b('0x39')][_0x847b('0x42')]){_0xff4d02['where']=_[_0x847b('0x43')](_0xff4d02[_0x847b('0x41')],{'$or':_[_0x847b('0x32')](_0xff4d02[_0x847b('0x3b')],function(_0x427948){var _0x5a5e25={};_0x5a5e25[_0x427948]={'$like':'%'+_0x291315[_0x847b('0x39')][_0x847b('0x42')]+'%'};return _0x5a5e25;})});}_0xff4d02=_[_0x847b('0x43')]({},_0xff4d02,_0x291315[_0x847b('0x45')]);return _0x4f5658[_0x847b('0x59')](_0xff4d02);}})[_0x847b('0x2b')](function(_0x499b00){if(_0x499b00){_0x1860b3=_0x499b00['length'];if(!_0x291315['query'][_0x847b('0x3e')]('nolimit')){_0xff4d02[_0x847b('0x24')]=qs[_0x847b('0x24')](_0x291315['query']['limit']);_0xff4d02[_0x847b('0x22')]=qs[_0x847b('0x22')](_0x291315[_0x847b('0x39')][_0x847b('0x22')]);}return _0x4f5658['getMembers'](_0xff4d02);}})['then'](function(_0x4662b7){if(_0x4662b7){return _0x4662b7?{'count':_0x1860b3,'rows':_0x4662b7}:null;}})[_0x847b('0x2b')](respondWithResult(_0x205761,null))[_0x847b('0x4c')](handleError(_0x205761,null));};exports[_0x847b('0x5a')]=function(_0x41bb07,_0x92081c,_0x15a0d2){return db[_0x847b('0x46')][_0x847b('0x4f')]({'where':{'id':_0x41bb07[_0x847b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x92081c,null))['then'](function(_0x3efe4d){if(_0x3efe4d){return _0x3efe4d['removeMembers'](_0x41bb07[_0x847b('0x39')][_0x847b('0x55')]);}})[_0x847b('0x2b')](respondWithStatusCode(_0x92081c,null))[_0x847b('0x4c')](handleError(_0x92081c,null));};exports[_0x847b('0x5b')]=function(_0x1d82c0,_0x7bb2bc,_0x318e1e){if(_0x1d82c0[_0x847b('0x4e')]['id']){delete _0x1d82c0[_0x847b('0x4e')]['id'];}return db[_0x847b('0x46')]['find']({'where':{'id':_0x1d82c0[_0x847b('0x4a')]['id']}})[_0x847b('0x2b')](handleEntityNotFound(_0x7bb2bc,null))[_0x847b('0x2b')](function(_0xf4900){if(_0xf4900){_0x1d82c0[_0x847b('0x4e')][_0x847b('0x5c')]=_0xf4900['id'];return db[_0x847b('0x51')]['create'](_0x1d82c0[_0x847b('0x4e')]);}})[_0x847b('0x2b')](respondWithResult(_0x7bb2bc,null))[_0x847b('0x4c')](handleError(_0x7bb2bc,null));};exports[_0x847b('0x5d')]=function(_0x42e57f,_0x34b79f,_0x20b872){var _0x5a2e88={};var _0x1e0e09={};var _0xe60f53;var _0x16e9ff;return db[_0x847b('0x46')][_0x847b('0x56')]({'where':{'id':_0x42e57f[_0x847b('0x4a')]['id']}})[_0x847b('0x2b')](handleEntityNotFound(_0x34b79f,null))[_0x847b('0x2b')](function(_0x33dac9){if(_0x33dac9){_0xe60f53=_0x33dac9;_0x1e0e09[_0x847b('0x37')]=_[_0x847b('0x38')](db[_0x847b('0x51')][_0x847b('0x33')]);_0x1e0e09[_0x847b('0x39')]=_[_0x847b('0x38')](_0x42e57f['query']);_0x1e0e09['filters']=_['intersection'](_0x1e0e09['model'],_0x1e0e09[_0x847b('0x39')]);_0x5a2e88[_0x847b('0x3b')]=_[_0x847b('0x4b')](_0x1e0e09[_0x847b('0x37')],qs[_0x847b('0x3c')](_0x42e57f[_0x847b('0x39')][_0x847b('0x3c')]));_0x5a2e88[_0x847b('0x3b')]=_0x5a2e88[_0x847b('0x3b')][_0x847b('0x3d')]?_0x5a2e88[_0x847b('0x3b')]:_0x1e0e09[_0x847b('0x37')];_0x5a2e88[_0x847b('0x3f')]=qs['sort'](_0x42e57f['query']['sort']);_0x5a2e88[_0x847b('0x41')]=qs[_0x847b('0x3a')](_[_0x847b('0x58')](_0x42e57f[_0x847b('0x39')],_0x1e0e09[_0x847b('0x3a')]));if(_0x42e57f['query'][_0x847b('0x42')]){_0x5a2e88[_0x847b('0x41')]=_[_0x847b('0x43')](_0x5a2e88[_0x847b('0x41')],{'$or':_[_0x847b('0x32')](_0x5a2e88[_0x847b('0x3b')],function(_0x7be41a){var _0x1169b7={};_0x1169b7[_0x7be41a]={'$like':'%'+_0x42e57f['query'][_0x847b('0x42')]+'%'};return _0x1169b7;})});}if(_0x42e57f[_0x847b('0x39')][_0x847b('0x5e')]){var _0x3b44cb=_0x42e57f[_0x847b('0x39')][_0x847b('0x5e')][_0x847b('0x5f')](',');var _0x18d4dc={};_0x18d4dc[_0x3b44cb[0x0]]={'$gte':moment(_0x3b44cb[0x1])[_0x847b('0x60')](_0x847b('0x61'))};_0x5a2e88[_0x847b('0x41')]=_[_0x847b('0x43')](_0x5a2e88['where'],_0x18d4dc);}_0x5a2e88=_[_0x847b('0x43')]({},_0x5a2e88,_0x42e57f[_0x847b('0x45')]);return _0xe60f53[_0x847b('0x5d')](_0x5a2e88);}})['then'](function(_0x1d2bfa){if(_0x1d2bfa){_0x16e9ff=_0x1d2bfa[_0x847b('0x3d')];if(!_0x42e57f[_0x847b('0x39')][_0x847b('0x3e')](_0x847b('0x62'))){_0x5a2e88[_0x847b('0x24')]=qs[_0x847b('0x24')](_0x42e57f[_0x847b('0x39')]['limit']);_0x5a2e88[_0x847b('0x22')]=qs['offset'](_0x42e57f[_0x847b('0x39')][_0x847b('0x22')]);}return _0xe60f53['getMessages'](_0x5a2e88);}})[_0x847b('0x2b')](function(_0x3b13a1){if(_0x3b13a1){return _0x3b13a1?{'count':_0x16e9ff,'rows':_0x3b13a1}:null;}})[_0x847b('0x2b')](respondWithResult(_0x34b79f,null))[_0x847b('0x4c')](handleError(_0x34b79f,null));}; \ No newline at end of file +var _0x2ed1=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','ChatGroup','includeAll','include','findAll','params','keys','rawAttributes','options','find','create','body','catch','getUnread','user','toInteger','addMembers','ids','getMembers','User','order','removeMembers','ChatGroupId','ChatInternalMessage','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/auth/service'];(function(_0x2800a4,_0x3fad03){var _0x4d9f7f=function(_0x276e9c){while(--_0x276e9c){_0x2800a4['push'](_0x2800a4['shift']());}};_0x4d9f7f(++_0x3fad03);}(_0x2ed1,0x1ca));var _0x12ed=function(_0x142971,_0x30b983){_0x142971=_0x142971-0x0;var _0x4eac6d=_0x2ed1[_0x142971];return _0x4eac6d;};'use strict';var emlformat=require(_0x12ed('0x0'));var rimraf=require(_0x12ed('0x1'));var zipdir=require(_0x12ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x12ed('0x3'));var moment=require(_0x12ed('0x4'));var BPromise=require(_0x12ed('0x5'));var Mustache=require(_0x12ed('0x6'));var util=require('util');var path=require(_0x12ed('0x7'));var sox=require(_0x12ed('0x8'));var csv=require(_0x12ed('0x9'));var ejs=require(_0x12ed('0xa'));var fs=require('fs');var fs_extra=require(_0x12ed('0xb'));var _=require(_0x12ed('0xc'));var squel=require(_0x12ed('0xd'));var crypto=require('crypto');var jsforce=require(_0x12ed('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x12ed('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x12ed('0xf'));var authService=require(_0x12ed('0x10'));var qs=require(_0x12ed('0x11'));var as=require(_0x12ed('0x12'));var hardwareService=require(_0x12ed('0x13'));var logger=require(_0x12ed('0x14'))('api');var utils=require(_0x12ed('0x15'));var config=require(_0x12ed('0x16'));var licenseUtil=require(_0x12ed('0x17'));var db=require(_0x12ed('0x18'))['db'];config['redis']=_['defaults'](config[_0x12ed('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x12ed('0x1a'))(new Redis(config[_0x12ed('0x19')]));require(_0x12ed('0x1b'))[_0x12ed('0x1c')](socket);function respondWithStatusCode(_0x12af37,_0x470da1){_0x470da1=_0x470da1||0xcc;return function(_0x588e93){if(_0x588e93){return _0x12af37[_0x12ed('0x1d')](_0x470da1);}return _0x12af37[_0x12ed('0x1e')](_0x470da1)[_0x12ed('0x1f')]();};}function respondWithResult(_0x420047,_0x26182){_0x26182=_0x26182||0xc8;return function(_0x411720){if(_0x411720){return _0x420047[_0x12ed('0x1e')](_0x26182)[_0x12ed('0x20')](_0x411720);}};}function respondWithFilteredResult(_0x116ed0,_0x56224e){return function(_0x25e8ca){if(_0x25e8ca){var _0xe51658=typeof _0x56224e[_0x12ed('0x21')]==='undefined'&&typeof _0x56224e[_0x12ed('0x22')]===_0x12ed('0x23');var _0x5f45eb=_0x25e8ca[_0x12ed('0x24')];var _0x461942=_0xe51658?0x0:_0x56224e[_0x12ed('0x21')];var _0xf654c6=_0xe51658?_0x25e8ca[_0x12ed('0x24')]:_0x56224e[_0x12ed('0x21')]+_0x56224e[_0x12ed('0x22')];var _0x3ffaa8;if(_0xf654c6>=_0x5f45eb){_0xf654c6=_0x5f45eb;_0x3ffaa8=0xc8;}else{_0x3ffaa8=0xce;}_0x116ed0['status'](_0x3ffaa8);return _0x116ed0[_0x12ed('0x25')](_0x12ed('0x26'),_0x461942+'-'+_0xf654c6+'/'+_0x5f45eb)[_0x12ed('0x20')](_0x25e8ca);}return null;};}function patchUpdates(_0xd3a868){return function(_0x220449){try{jsonpatch[_0x12ed('0x27')](_0x220449,_0xd3a868,!![]);}catch(_0x50fdfc){return BPromise[_0x12ed('0x28')](_0x50fdfc);}return _0x220449[_0x12ed('0x29')]();};}function saveUpdates(_0x2b253f,_0x4657ce){return function(_0x576919){if(_0x576919){return _0x576919[_0x12ed('0x2a')](_0x2b253f)['then'](function(_0x47ef35){return _0x47ef35;});}return null;};}function removeEntity(_0x516024,_0x2b9d04){return function(_0x178d1e){if(_0x178d1e){return _0x178d1e[_0x12ed('0x2b')]()[_0x12ed('0x2c')](function(){_0x516024[_0x12ed('0x1e')](0xcc)[_0x12ed('0x1f')]();});}};}function handleEntityNotFound(_0x3de150,_0x3f1108){return function(_0xa4679d){if(!_0xa4679d){_0x3de150[_0x12ed('0x1d')](0x194);}return _0xa4679d;};}function handleError(_0x597ef0,_0x36cb1f){_0x36cb1f=_0x36cb1f||0x1f4;return function(_0x34cc67){logger[_0x12ed('0x2d')](_0x34cc67[_0x12ed('0x2e')]);if(_0x34cc67[_0x12ed('0x2f')]){delete _0x34cc67[_0x12ed('0x2f')];}_0x597ef0[_0x12ed('0x1e')](_0x36cb1f)['send'](_0x34cc67);};}exports[_0x12ed('0x30')]=function(_0x586703,_0x3c101f){var _0x1c85e3={},_0x953291={},_0x1ba368={'count':0x0,'rows':[]};var _0x3685fc=_[_0x12ed('0x31')](db['ChatGroup']['rawAttributes'],function(_0x33d0f4){return{'name':_0x33d0f4['fieldName'],'type':_0x33d0f4[_0x12ed('0x32')][_0x12ed('0x33')]};});_0x953291[_0x12ed('0x34')]=_[_0x12ed('0x31')](_0x3685fc,_0x12ed('0x2f'));_0x953291[_0x12ed('0x35')]=_['keys'](_0x586703[_0x12ed('0x35')]);_0x953291[_0x12ed('0x36')]=_[_0x12ed('0x37')](_0x953291[_0x12ed('0x34')],_0x953291[_0x12ed('0x35')]);_0x1c85e3[_0x12ed('0x38')]=_[_0x12ed('0x37')](_0x953291[_0x12ed('0x34')],qs[_0x12ed('0x39')](_0x586703['query']['fields']));_0x1c85e3[_0x12ed('0x38')]=_0x1c85e3[_0x12ed('0x38')][_0x12ed('0x3a')]?_0x1c85e3[_0x12ed('0x38')]:_0x953291[_0x12ed('0x34')];if(!_0x586703[_0x12ed('0x35')][_0x12ed('0x3b')](_0x12ed('0x3c'))){_0x1c85e3[_0x12ed('0x22')]=qs[_0x12ed('0x22')](_0x586703[_0x12ed('0x35')][_0x12ed('0x22')]);_0x1c85e3[_0x12ed('0x21')]=qs['offset'](_0x586703[_0x12ed('0x35')][_0x12ed('0x21')]);}_0x1c85e3['order']=qs[_0x12ed('0x3d')](_0x586703[_0x12ed('0x35')]['sort']);_0x1c85e3[_0x12ed('0x3e')]=qs['filters'](_[_0x12ed('0x3f')](_0x586703['query'],_0x953291[_0x12ed('0x36')]),_0x3685fc);if(_0x586703[_0x12ed('0x35')][_0x12ed('0x40')]){_0x1c85e3[_0x12ed('0x3e')]=_[_0x12ed('0x41')](_0x1c85e3[_0x12ed('0x3e')],{'$or':_[_0x12ed('0x31')](_0x3685fc,function(_0x189b5b){if(_0x189b5b['type']!==_0x12ed('0x42')){var _0x184327={};_0x184327[_0x189b5b[_0x12ed('0x2f')]]={'$like':'%'+_0x586703[_0x12ed('0x35')][_0x12ed('0x40')]+'%'};return _0x184327;}})});}_0x1c85e3=_['merge']({},_0x1c85e3,_0x586703['options']);var _0x190055={'where':_0x1c85e3[_0x12ed('0x3e')]};return db[_0x12ed('0x43')][_0x12ed('0x24')](_0x190055)[_0x12ed('0x2c')](function(_0x4c2618){_0x1ba368['count']=_0x4c2618;if(_0x586703[_0x12ed('0x35')][_0x12ed('0x44')]){_0x1c85e3[_0x12ed('0x45')]=[{'all':!![]}];}return db[_0x12ed('0x43')][_0x12ed('0x46')](_0x1c85e3);})[_0x12ed('0x2c')](function(_0x97912f){_0x1ba368['rows']=_0x97912f;return _0x1ba368;})[_0x12ed('0x2c')](respondWithFilteredResult(_0x3c101f,_0x1c85e3))['catch'](handleError(_0x3c101f,null));};exports['show']=function(_0x4b061f,_0x3a5c50){var _0x4eaec8={'raw':!![],'where':{'id':_0x4b061f[_0x12ed('0x47')]['id']}},_0x57011c={};_0x57011c[_0x12ed('0x34')]=_[_0x12ed('0x48')](db[_0x12ed('0x43')][_0x12ed('0x49')]);_0x57011c[_0x12ed('0x35')]=_[_0x12ed('0x48')](_0x4b061f['query']);_0x57011c[_0x12ed('0x36')]=_['intersection'](_0x57011c['model'],_0x57011c['query']);_0x4eaec8['attributes']=_[_0x12ed('0x37')](_0x57011c['model'],qs[_0x12ed('0x39')](_0x4b061f[_0x12ed('0x35')]['fields']));_0x4eaec8['attributes']=_0x4eaec8[_0x12ed('0x38')]['length']?_0x4eaec8[_0x12ed('0x38')]:_0x57011c['model'];if(_0x4b061f['query'][_0x12ed('0x44')]){_0x4eaec8[_0x12ed('0x45')]=[{'all':!![]}];}_0x4eaec8=_[_0x12ed('0x41')]({},_0x4eaec8,_0x4b061f[_0x12ed('0x4a')]);return db[_0x12ed('0x43')][_0x12ed('0x4b')](_0x4eaec8)['then'](handleEntityNotFound(_0x3a5c50,null))['then'](respondWithResult(_0x3a5c50,null))['catch'](handleError(_0x3a5c50,null));};exports[_0x12ed('0x4c')]=function(_0x545ccd,_0x1e6f94){return db[_0x12ed('0x43')][_0x12ed('0x4c')](_0x545ccd[_0x12ed('0x4d')],{})[_0x12ed('0x2c')](respondWithResult(_0x1e6f94,0xc9))[_0x12ed('0x4e')](handleError(_0x1e6f94,null));};exports[_0x12ed('0x2a')]=function(_0x2a7254,_0x472309){if(_0x2a7254[_0x12ed('0x4d')]['id']){delete _0x2a7254['body']['id'];}return db['ChatGroup'][_0x12ed('0x4b')]({'where':{'id':_0x2a7254[_0x12ed('0x47')]['id']}})[_0x12ed('0x2c')](handleEntityNotFound(_0x472309,null))[_0x12ed('0x2c')](saveUpdates(_0x2a7254[_0x12ed('0x4d')],null))[_0x12ed('0x2c')](respondWithResult(_0x472309,null))[_0x12ed('0x4e')](handleError(_0x472309,null));};exports[_0x12ed('0x2b')]=function(_0x437b74,_0xd20131){return db['ChatGroup'][_0x12ed('0x4b')]({'where':{'id':_0x437b74['params']['id']}})[_0x12ed('0x2c')](handleEntityNotFound(_0xd20131,null))['then'](removeEntity(_0xd20131,null))[_0x12ed('0x4e')](handleError(_0xd20131,null));};exports['describe']=function(_0x29df8a,_0x3fd57e){return db[_0x12ed('0x43')]['describe']()[_0x12ed('0x2c')](respondWithResult(_0x3fd57e,null))[_0x12ed('0x4e')](handleError(_0x3fd57e,null));};exports[_0x12ed('0x4f')]=function(_0x2cba62,_0x2a2e21,_0x3037fc){return db['ChatInternalMessage'][_0x12ed('0x24')]({'where':{'ChatGroupId':_0x2cba62[_0x12ed('0x47')]['id'],'ToId':_0x2cba62[_0x12ed('0x50')]['id'],'read':![]}})[_0x12ed('0x2c')](function(_0x2b52d6){return{'id':_[_0x12ed('0x51')](_0x2cba62[_0x12ed('0x47')]['id']),'count':_0x2b52d6};})['then'](respondWithResult(_0x2a2e21,null))[_0x12ed('0x4e')](handleError(_0x2a2e21,null));};exports['addMembers']=function(_0x356dbf,_0x1952ae,_0x106e00){return db[_0x12ed('0x43')]['find']({'where':{'id':_0x356dbf[_0x12ed('0x47')]['id']}})['then'](handleEntityNotFound(_0x1952ae,null))[_0x12ed('0x2c')](function(_0x31a138){if(_0x31a138){return _0x31a138[_0x12ed('0x52')](_0x356dbf['body'][_0x12ed('0x53')],_['omit'](_0x356dbf[_0x12ed('0x4d')],['ids','id'])||{});}})['then'](respondWithResult(_0x1952ae,null))[_0x12ed('0x4e')](handleError(_0x1952ae,null));};exports[_0x12ed('0x54')]=function(_0x5e5dc0,_0x3afab3,_0x4fbf1d){var _0x354e45={};var _0x5594bf={};var _0x5da7ed;var _0x1574f9;return db[_0x12ed('0x43')]['findOne']({'where':{'id':_0x5e5dc0[_0x12ed('0x47')]['id']}})[_0x12ed('0x2c')](handleEntityNotFound(_0x3afab3,null))[_0x12ed('0x2c')](function(_0xf1f10d){if(_0xf1f10d){_0x5da7ed=_0xf1f10d;_0x5594bf[_0x12ed('0x34')]=_['keys'](db[_0x12ed('0x55')]['rawAttributes']);_0x5594bf[_0x12ed('0x35')]=_[_0x12ed('0x48')](_0x5e5dc0[_0x12ed('0x35')]);_0x5594bf[_0x12ed('0x36')]=_[_0x12ed('0x37')](_0x5594bf[_0x12ed('0x34')],_0x5594bf['query']);_0x354e45[_0x12ed('0x38')]=_[_0x12ed('0x37')](_0x5594bf['model'],qs[_0x12ed('0x39')](_0x5e5dc0[_0x12ed('0x35')][_0x12ed('0x39')]));_0x354e45[_0x12ed('0x38')]=_0x354e45['attributes'][_0x12ed('0x3a')]?_0x354e45['attributes']:_0x5594bf[_0x12ed('0x34')];_0x354e45[_0x12ed('0x56')]=qs['sort'](_0x5e5dc0['query']['sort']);_0x354e45[_0x12ed('0x3e')]=qs[_0x12ed('0x36')](_[_0x12ed('0x3f')](_0x5e5dc0[_0x12ed('0x35')],_0x5594bf[_0x12ed('0x36')]));if(_0x5e5dc0[_0x12ed('0x35')][_0x12ed('0x40')]){_0x354e45[_0x12ed('0x3e')]=_[_0x12ed('0x41')](_0x354e45[_0x12ed('0x3e')],{'$or':_[_0x12ed('0x31')](_0x354e45[_0x12ed('0x38')],function(_0x1fe705){var _0x41d278={};_0x41d278[_0x1fe705]={'$like':'%'+_0x5e5dc0[_0x12ed('0x35')][_0x12ed('0x40')]+'%'};return _0x41d278;})});}_0x354e45=_[_0x12ed('0x41')]({},_0x354e45,_0x5e5dc0[_0x12ed('0x4a')]);return _0x5da7ed['getMembers'](_0x354e45);}})[_0x12ed('0x2c')](function(_0x1026d6){if(_0x1026d6){_0x1574f9=_0x1026d6[_0x12ed('0x3a')];if(!_0x5e5dc0[_0x12ed('0x35')][_0x12ed('0x3b')](_0x12ed('0x3c'))){_0x354e45[_0x12ed('0x22')]=qs[_0x12ed('0x22')](_0x5e5dc0['query'][_0x12ed('0x22')]);_0x354e45[_0x12ed('0x21')]=qs[_0x12ed('0x21')](_0x5e5dc0['query'][_0x12ed('0x21')]);}return _0x5da7ed[_0x12ed('0x54')](_0x354e45);}})['then'](function(_0x31b06d){if(_0x31b06d){return _0x31b06d?{'count':_0x1574f9,'rows':_0x31b06d}:null;}})[_0x12ed('0x2c')](respondWithResult(_0x3afab3,null))[_0x12ed('0x4e')](handleError(_0x3afab3,null));};exports[_0x12ed('0x57')]=function(_0x213690,_0x32e8f1,_0x53ff68){return db['ChatGroup'][_0x12ed('0x4b')]({'where':{'id':_0x213690[_0x12ed('0x47')]['id']}})[_0x12ed('0x2c')](handleEntityNotFound(_0x32e8f1,null))['then'](function(_0x306bdd){if(_0x306bdd){return _0x306bdd['removeMembers'](_0x213690[_0x12ed('0x35')][_0x12ed('0x53')]);}})['then'](respondWithStatusCode(_0x32e8f1,null))[_0x12ed('0x4e')](handleError(_0x32e8f1,null));};exports['addMessage']=function(_0x16ede5,_0x444541,_0x429033){if(_0x16ede5[_0x12ed('0x4d')]['id']){delete _0x16ede5[_0x12ed('0x4d')]['id'];}return db[_0x12ed('0x43')][_0x12ed('0x4b')]({'where':{'id':_0x16ede5[_0x12ed('0x47')]['id']}})['then'](handleEntityNotFound(_0x444541,null))[_0x12ed('0x2c')](function(_0x47f231){if(_0x47f231){_0x16ede5[_0x12ed('0x4d')][_0x12ed('0x58')]=_0x47f231['id'];return db[_0x12ed('0x59')][_0x12ed('0x4c')](_0x16ede5[_0x12ed('0x4d')]);}})[_0x12ed('0x2c')](respondWithResult(_0x444541,null))[_0x12ed('0x4e')](handleError(_0x444541,null));};exports['getMessages']=function(_0x31b087,_0x92cee7,_0x2a7707){var _0x2e1da3={};var _0x11950f={};var _0xb1a39a;var _0x5a9904;return db['ChatGroup'][_0x12ed('0x5a')]({'where':{'id':_0x31b087[_0x12ed('0x47')]['id']}})[_0x12ed('0x2c')](handleEntityNotFound(_0x92cee7,null))['then'](function(_0xdb7e80){if(_0xdb7e80){_0xb1a39a=_0xdb7e80;_0x11950f['model']=_[_0x12ed('0x48')](db[_0x12ed('0x59')][_0x12ed('0x49')]);_0x11950f['query']=_[_0x12ed('0x48')](_0x31b087['query']);_0x11950f[_0x12ed('0x36')]=_[_0x12ed('0x37')](_0x11950f[_0x12ed('0x34')],_0x11950f[_0x12ed('0x35')]);_0x2e1da3['attributes']=_[_0x12ed('0x37')](_0x11950f[_0x12ed('0x34')],qs[_0x12ed('0x39')](_0x31b087[_0x12ed('0x35')][_0x12ed('0x39')]));_0x2e1da3[_0x12ed('0x38')]=_0x2e1da3[_0x12ed('0x38')][_0x12ed('0x3a')]?_0x2e1da3[_0x12ed('0x38')]:_0x11950f[_0x12ed('0x34')];_0x2e1da3['order']=qs['sort'](_0x31b087[_0x12ed('0x35')]['sort']);_0x2e1da3[_0x12ed('0x3e')]=qs[_0x12ed('0x36')](_[_0x12ed('0x3f')](_0x31b087[_0x12ed('0x35')],_0x11950f[_0x12ed('0x36')]));if(_0x31b087['query'][_0x12ed('0x40')]){_0x2e1da3[_0x12ed('0x3e')]=_[_0x12ed('0x41')](_0x2e1da3[_0x12ed('0x3e')],{'$or':_['map'](_0x2e1da3[_0x12ed('0x38')],function(_0x35848c){var _0x17e91a={};_0x17e91a[_0x35848c]={'$like':'%'+_0x31b087[_0x12ed('0x35')][_0x12ed('0x40')]+'%'};return _0x17e91a;})});}if(_0x31b087[_0x12ed('0x35')][_0x12ed('0x5b')]){var _0x22ab31=_0x31b087[_0x12ed('0x35')][_0x12ed('0x5b')]['split'](',');var _0x4883bd={};_0x4883bd[_0x22ab31[0x0]]={'$gte':moment(_0x22ab31[0x1])[_0x12ed('0x5c')](_0x12ed('0x5d'))};_0x2e1da3[_0x12ed('0x3e')]=_[_0x12ed('0x41')](_0x2e1da3[_0x12ed('0x3e')],_0x4883bd);}_0x2e1da3=_[_0x12ed('0x41')]({},_0x2e1da3,_0x31b087['options']);return _0xb1a39a[_0x12ed('0x5e')](_0x2e1da3);}})[_0x12ed('0x2c')](function(_0x418952){if(_0x418952){_0x5a9904=_0x418952['length'];if(!_0x31b087['query'][_0x12ed('0x3b')](_0x12ed('0x3c'))){_0x2e1da3['limit']=qs['limit'](_0x31b087['query']['limit']);_0x2e1da3[_0x12ed('0x21')]=qs[_0x12ed('0x21')](_0x31b087['query'][_0x12ed('0x21')]);}return _0xb1a39a[_0x12ed('0x5e')](_0x2e1da3);}})[_0x12ed('0x2c')](function(_0x24c811){if(_0x24c811){return _0x24c811?{'count':_0x5a9904,'rows':_0x24c811}:null;}})['then'](respondWithResult(_0x92cee7,null))[_0x12ed('0x4e')](handleError(_0x92cee7,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 8005fc1..6e1e632 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 _0x870d=['save','update','remove','emit','hook','exports','../../mysqldb','ChatGroup','setMaxListeners'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x870d,0xde));var _0xd870=function(_0x550a07,_0x373a82){_0x550a07=_0x550a07-0x0;var _0x3974c6=_0x870d[_0x550a07];return _0x3974c6;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xd870('0x0'))['db'][_0xd870('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd870('0x2')](0x0);var events={'afterCreate':_0xd870('0x3'),'afterUpdate':_0xd870('0x4'),'afterDestroy':_0xd870('0x5')};function emitEvent(_0x54e456){return function(_0x78293f,_0x2a0582,_0x3fb08f){ChatGroupEvents[_0xd870('0x6')](_0x54e456+':'+_0x78293f['id'],_0x78293f);ChatGroupEvents[_0xd870('0x6')](_0x54e456,_0x78293f);_0x3fb08f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xd870('0x7')](e,emitEvent(event));}}module[_0xd870('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x27eb=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5ffb9f,_0x58af94){var _0x18fa90=function(_0x2e4434){while(--_0x2e4434){_0x5ffb9f['push'](_0x5ffb9f['shift']());}};_0x18fa90(++_0x58af94);}(_0x27eb,0xd0));var _0xb27e=function(_0x5601a1,_0x5aba57){_0x5601a1=_0x5601a1-0x0;var _0x473d46=_0x27eb[_0x5601a1];return _0x473d46;};'use strict';var EventEmitter=require(_0xb27e('0x0'));var ChatGroup=require(_0xb27e('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb27e('0x2'),'afterUpdate':_0xb27e('0x3'),'afterDestroy':_0xb27e('0x4')};function emitEvent(_0x5c9b37){return function(_0x2ed7d7,_0x1d82eb,_0x2aab8e){ChatGroupEvents[_0xb27e('0x5')](_0x5c9b37+':'+_0x2ed7d7['id'],_0x2ed7d7);ChatGroupEvents['emit'](_0x5c9b37,_0x2ed7d7);_0x2aab8e(null);};}for(var e in events){if(events[_0xb27e('0x6')](e)){var event=events[e];ChatGroup[_0xb27e('0x7')](e,emitEvent(event));}}module[_0xb27e('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 92621bc..a367a17 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 _0x0042=['path','rimraf','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0042,0x1a8));var _0x2004=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0x0042[_0x3ec122];return _0x4ecf41;};'use strict';var _=require(_0x2004('0x0'));var util=require(_0x2004('0x1'));var logger=require(_0x2004('0x2'))('api');var moment=require(_0x2004('0x3'));var BPromise=require('bluebird');var rp=require(_0x2004('0x4'));var fs=require('fs');var path=require(_0x2004('0x5'));var rimraf=require(_0x2004('0x6'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0x2004('0x7')]=function(_0x270676,_0x4e00ad){return _0x270676[_0x2004('0x8')](_0x2004('0x9'),attributes,{'tableName':_0x2004('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03f8=['moment','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports','define','chat_groups','../../config/logger','api'];(function(_0x43f136,_0x365817){var _0x531928=function(_0x5a59e9){while(--_0x5a59e9){_0x43f136['push'](_0x43f136['shift']());}};_0x531928(++_0x365817);}(_0x03f8,0x98));var _0x803f=function(_0x17f567,_0x243a98){_0x17f567=_0x17f567-0x0;var _0x4285d2=_0x03f8[_0x17f567];return _0x4285d2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x803f('0x0'))(_0x803f('0x1'));var moment=require(_0x803f('0x2'));var BPromise=require(_0x803f('0x3'));var rp=require(_0x803f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x803f('0x5'));var config=require(_0x803f('0x6'));var attributes=require(_0x803f('0x7'));module[_0x803f('0x8')]=function(_0x172f8d,_0x13f9cd){return _0x172f8d[_0x803f('0x9')]('ChatGroup',attributes,{'tableName':_0x803f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 82a6548..1c9230d 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 _0x8d0e=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error'];(function(_0x5168ba,_0x559159){var _0xc8accc=function(_0x1176b9){while(--_0x1176b9){_0x5168ba['push'](_0x5168ba['shift']());}};_0xc8accc(++_0x559159);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x40fa59,_0x447dac){_0x40fa59=_0x40fa59-0x0;var _0x25cd9e=_0x8d0e[_0x40fa59];return _0x25cd9e;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var moment=require(_0xe8d0('0x2'));var BPromise=require(_0xe8d0('0x3'));var rs=require(_0xe8d0('0x4'));var fs=require('fs');var Redis=require(_0xe8d0('0x5'));var db=require(_0xe8d0('0x6'))['db'];var utils=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('rpc');var config=require(_0xe8d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe8d0('0xa')]({'port':0x232a});config[_0xe8d0('0xb')]=_[_0xe8d0('0xc')](config[_0xe8d0('0xb')],{'host':_0xe8d0('0xd'),'port':0x18eb});var socket=require(_0xe8d0('0xe'))(new Redis(config[_0xe8d0('0xb')]));require(_0xe8d0('0xf'))['register'](socket);function respondWithRpcPromise(_0x10e56c,_0x19c3d0,_0x463159){return new BPromise(function(_0x599bc3,_0x580aab){return client[_0xe8d0('0x10')](_0x10e56c,_0x463159)[_0xe8d0('0x11')](function(_0x3da047){logger[_0xe8d0('0x12')](_0xe8d0('0x13'),_0x19c3d0,_0xe8d0('0x14'));logger['debug'](_0xe8d0('0x15'),_0x19c3d0,_0xe8d0('0x14'),JSON['stringify'](_0x3da047));if(_0x3da047[_0xe8d0('0x16')]){if(_0x3da047['error']['code']===0x1f4){logger[_0xe8d0('0x16')](_0xe8d0('0x13'),_0x19c3d0,_0x3da047[_0xe8d0('0x16')][_0xe8d0('0x17')]);return _0x580aab(_0x3da047[_0xe8d0('0x16')][_0xe8d0('0x17')]);}logger['error'](_0xe8d0('0x13'),_0x19c3d0,_0x3da047['error'][_0xe8d0('0x17')]);return _0x599bc3(_0x3da047[_0xe8d0('0x16')][_0xe8d0('0x17')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x19c3d0,'request\x20sent');_0x599bc3(_0x3da047[_0xe8d0('0x18')][_0xe8d0('0x17')]);}})[_0xe8d0('0x19')](function(_0x44bbe4){logger[_0xe8d0('0x16')]('ChatGroup,\x20%s,\x20%s',_0x19c3d0,_0x44bbe4);_0x580aab(_0x44bbe4);});});} \ No newline at end of file +var _0x9aee=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4fccd3,_0x4bb0f9){var _0x5d4d21=function(_0x17f0dd){while(--_0x17f0dd){_0x4fccd3['push'](_0x4fccd3['shift']());}};_0x5d4d21(++_0x4bb0f9);}(_0x9aee,0x71));var _0xe9ae=function(_0x23e567,_0x317c3b){_0x23e567=_0x23e567-0x0;var _0x1fceaf=_0x9aee[_0x23e567];return _0x1fceaf;};'use strict';var _=require(_0xe9ae('0x0'));var util=require(_0xe9ae('0x1'));var moment=require(_0xe9ae('0x2'));var BPromise=require(_0xe9ae('0x3'));var rs=require(_0xe9ae('0x4'));var fs=require('fs');var Redis=require(_0xe9ae('0x5'));var db=require(_0xe9ae('0x6'))['db'];var utils=require(_0xe9ae('0x7'));var logger=require(_0xe9ae('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe9ae('0x9')]['http']({'port':0x232a});config['redis']=_[_0xe9ae('0xa')](config['redis'],{'host':_0xe9ae('0xb'),'port':0x18eb});var socket=require(_0xe9ae('0xc'))(new Redis(config['redis']));require(_0xe9ae('0xd'))[_0xe9ae('0xe')](socket);function respondWithRpcPromise(_0x42ed89,_0x4dffbd,_0x359047){return new BPromise(function(_0x17371c,_0x30fcd4){return client['request'](_0x42ed89,_0x359047)[_0xe9ae('0xf')](function(_0x502fac){logger[_0xe9ae('0x10')](_0xe9ae('0x11'),_0x4dffbd,_0xe9ae('0x12'));logger[_0xe9ae('0x13')](_0xe9ae('0x14'),_0x4dffbd,_0xe9ae('0x12'),JSON[_0xe9ae('0x15')](_0x502fac));if(_0x502fac[_0xe9ae('0x16')]){if(_0x502fac['error'][_0xe9ae('0x17')]===0x1f4){logger[_0xe9ae('0x16')]('ChatGroup,\x20%s,\x20%s',_0x4dffbd,_0x502fac[_0xe9ae('0x16')][_0xe9ae('0x18')]);return _0x30fcd4(_0x502fac[_0xe9ae('0x16')][_0xe9ae('0x18')]);}logger[_0xe9ae('0x16')](_0xe9ae('0x11'),_0x4dffbd,_0x502fac[_0xe9ae('0x16')][_0xe9ae('0x18')]);return _0x17371c(_0x502fac[_0xe9ae('0x16')]['message']);}else{logger['info'](_0xe9ae('0x11'),_0x4dffbd,'request\x20sent');_0x17371c(_0x502fac[_0xe9ae('0x19')][_0xe9ae('0x18')]);}})[_0xe9ae('0x1a')](function(_0x360531){logger['error']('ChatGroup,\x20%s,\x20%s',_0x4dffbd,_0x360531);_0x30fcd4(_0x360531);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index d65511a..5f029b1 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 _0xb78c=['emit','removeListener','register','length','./chatGroup.events'];(function(_0x396f9e,_0x289390){var _0x452144=function(_0x463d96){while(--_0x463d96){_0x396f9e['push'](_0x396f9e['shift']());}};_0x452144(++_0x289390);}(_0xb78c,0xf4));var _0xcb78=function(_0x37dbbb,_0x1909de){_0x37dbbb=_0x37dbbb-0x0;var _0x10068f=_0xb78c[_0x37dbbb];return _0x10068f;};'use strict';var ChatGroupEvents=require(_0xcb78('0x0'));var events=['save','remove','update'];function createListener(_0xaec112,_0x4b7a9a){return function(_0x11db97){_0x4b7a9a[_0xcb78('0x1')](_0xaec112,_0x11db97);};}function removeListener(_0x3e877a,_0x5e99ac){return function(){ChatGroupEvents[_0xcb78('0x2')](_0x3e877a,_0x5e99ac);};}exports[_0xcb78('0x3')]=function(_0x16673c){for(var _0x3f3299=0x0,_0x1af4c3=events[_0xcb78('0x4')];_0x3f3299<_0x1af4c3;_0x3f3299++){var _0x893114=events[_0x3f3299];var _0x1231c7=createListener('chatGroup:'+_0x893114,_0x16673c);ChatGroupEvents['on'](_0x893114,_0x1231c7);}}; \ No newline at end of file +var _0x9b81=['removeListener','register','length','./chatGroup.events','save','remove','update','emit'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9b81,0x8b));var _0x19b8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9b81[_0x321bb2];return _0x9c12ed;};'use strict';var ChatGroupEvents=require(_0x19b8('0x0'));var events=[_0x19b8('0x1'),_0x19b8('0x2'),_0x19b8('0x3')];function createListener(_0x12c7da,_0xde8fcf){return function(_0x38cd53){_0xde8fcf[_0x19b8('0x4')](_0x12c7da,_0x38cd53);};}function removeListener(_0x394ca1,_0x56c3f7){return function(){ChatGroupEvents[_0x19b8('0x5')](_0x394ca1,_0x56c3f7);};}exports[_0x19b8('0x6')]=function(_0x1df0d6){for(var _0x186139=0x0,_0xab2dcf=events[_0x19b8('0x7')];_0x186139<_0xab2dcf;_0x186139++){var _0x5b0695=events[_0x186139];var _0x461ea9=createListener('chatGroup:'+_0x5b0695,_0x1df0d6);ChatGroupEvents['on'](_0x5b0695,_0x461ea9);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 2ff829f..ce23411 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 _0xa0da=['multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','isAuthenticated','describe','/:id','getUnread','/:id/members','getMessages','post','create','addMembers','/:id/messages','addMessage','put','update','delete','destroy','removeMembers','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa0da,0x87));var _0xaa0d=function(_0x1a49c9,_0x8a0be0){_0x1a49c9=_0x1a49c9-0x0;var _0x195866=_0xa0da[_0x1a49c9];return _0x195866;};'use strict';var multer=require(_0xaa0d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaa0d('0x1'));var express=require(_0xaa0d('0x2'));var router=express[_0xaa0d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xaa0d('0x4'));var interaction=require(_0xaa0d('0x5'));var config=require(_0xaa0d('0x6'));var controller=require(_0xaa0d('0x7'));router[_0xaa0d('0x8')]('/',auth['isAuthenticated'](),controller[_0xaa0d('0x9')]);router[_0xaa0d('0x8')]('/describe',auth[_0xaa0d('0xa')](),controller[_0xaa0d('0xb')]);router['get'](_0xaa0d('0xc'),auth[_0xaa0d('0xa')](),controller['show']);router[_0xaa0d('0x8')]('/:id/unread',auth['isAuthenticated'](),controller[_0xaa0d('0xd')]);router[_0xaa0d('0x8')](_0xaa0d('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0xaa0d('0x8')]('/:id/messages',auth[_0xaa0d('0xa')](),controller[_0xaa0d('0xf')]);router[_0xaa0d('0x10')]('/',auth[_0xaa0d('0xa')](),controller[_0xaa0d('0x11')]);router[_0xaa0d('0x10')](_0xaa0d('0xe'),auth[_0xaa0d('0xa')](),controller[_0xaa0d('0x12')]);router[_0xaa0d('0x10')](_0xaa0d('0x13'),auth['isAuthenticated'](),controller[_0xaa0d('0x14')]);router[_0xaa0d('0x15')](_0xaa0d('0xc'),auth['isAuthenticated'](),controller[_0xaa0d('0x16')]);router[_0xaa0d('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xaa0d('0x18')]);router[_0xaa0d('0x17')](_0xaa0d('0xe'),auth[_0xaa0d('0xa')](),controller[_0xaa0d('0x19')]);module[_0xaa0d('0x1a')]=router; \ No newline at end of file +var _0xf21a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','get','/describe','describe','/:id','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','update','delete','destroy','removeMembers','multer','util','path'];(function(_0x478362,_0x244ac7){var _0x59058c=function(_0xb39f81){while(--_0xb39f81){_0x478362['push'](_0x478362['shift']());}};_0x59058c(++_0x244ac7);}(_0xf21a,0x69));var _0xaf21=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf21a[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xaf21('0x0'));var util=require(_0xaf21('0x1'));var path=require(_0xaf21('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf21('0x3'));var router=express[_0xaf21('0x4')]();var fs_extra=require(_0xaf21('0x5'));var auth=require(_0xaf21('0x6'));var interaction=require(_0xaf21('0x7'));var config=require(_0xaf21('0x8'));var controller=require(_0xaf21('0x9'));router['get']('/',auth[_0xaf21('0xa')](),controller['index']);router[_0xaf21('0xb')](_0xaf21('0xc'),auth[_0xaf21('0xa')](),controller[_0xaf21('0xd')]);router[_0xaf21('0xb')](_0xaf21('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xaf21('0xb')](_0xaf21('0xf'),auth['isAuthenticated'](),controller['getUnread']);router[_0xaf21('0xb')](_0xaf21('0x10'),auth[_0xaf21('0xa')](),controller[_0xaf21('0x11')]);router[_0xaf21('0xb')](_0xaf21('0x12'),auth['isAuthenticated'](),controller[_0xaf21('0x13')]);router[_0xaf21('0x14')]('/',auth[_0xaf21('0xa')](),controller['create']);router['post'](_0xaf21('0x10'),auth[_0xaf21('0xa')](),controller[_0xaf21('0x15')]);router[_0xaf21('0x14')]('/:id/messages',auth[_0xaf21('0xa')](),controller[_0xaf21('0x16')]);router['put'](_0xaf21('0xe'),auth['isAuthenticated'](),controller[_0xaf21('0x17')]);router[_0xaf21('0x18')](_0xaf21('0xe'),auth[_0xaf21('0xa')](),controller[_0xaf21('0x19')]);router['delete']('/:id/members',auth['isAuthenticated'](),controller[_0xaf21('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 2d1a4a7..105c76c 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 _0x06ef=['DATE','STRING','ENUM','out','BOOLEAN','star','TEXT'];(function(_0x552c27,_0x478dc2){var _0x2a0922=function(_0x22617c){while(--_0x22617c){_0x552c27['push'](_0x552c27['shift']());}};_0x2a0922(++_0x478dc2);}(_0x06ef,0x185));var _0xf06e=function(_0xb3934e,_0x44c434){_0xb3934e=_0xb3934e-0x0;var _0x4b95ca=_0x06ef[_0xb3934e];return _0x4b95ca;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xf06e('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM']('star','thumb'),'defaultValue':_0xf06e('0x1')},'ratingMessage':{'type':Sequelize[_0xf06e('0x2')]},'pathTranscript':{'type':Sequelize[_0xf06e('0x2')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xf06e('0x3')]},'disposition':{'type':Sequelize[_0xf06e('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xf06e('0x4')]},'osVersion':{'type':Sequelize[_0xf06e('0x4')]},'deviceModel':{'type':Sequelize[_0xf06e('0x4')]},'deviceVendor':{'type':Sequelize[_0xf06e('0x4')]},'deviceType':{'type':Sequelize[_0xf06e('0x4')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xf06e('0x4')]},'formData':{'type':Sequelize[_0xf06e('0x2')]('long')},'read1stAt':{'type':Sequelize[_0xf06e('0x3')]},'lastMsgAt':{'type':Sequelize[_0xf06e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xf06e('0x5')]('in',_0xf06e('0x6')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xf06e('0x4')]},'customerPort':{'type':Sequelize[_0xf06e('0x4')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xf06e('0x0')],'defaultValue':![]}}; \ No newline at end of file +var _0x2032=['ENUM','exports','BOOLEAN','INTEGER','star','thumb','TEXT','STRING','DATE'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x2032,0xd9));var _0x2203=function(_0x1a04c9,_0x5b72f8){_0x1a04c9=_0x1a04c9-0x0;var _0x1ecee0=_0x2032[_0x1a04c9];return _0x1ecee0;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'closed':{'type':Sequelize[_0x2203('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x2203('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x2203('0x3'),_0x2203('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x2203('0x5')]},'pathTranscript':{'type':Sequelize[_0x2203('0x5')]},'mailTranscript':{'type':Sequelize[_0x2203('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x2203('0x7')]},'disposition':{'type':Sequelize[_0x2203('0x6')]},'secondDisposition':{'type':Sequelize[_0x2203('0x6')]},'thirdDisposition':{'type':Sequelize[_0x2203('0x6')]},'note':{'type':Sequelize[_0x2203('0x6')]},'browserName':{'type':Sequelize[_0x2203('0x6')]},'browserVersion':{'type':Sequelize[_0x2203('0x6')]},'osName':{'type':Sequelize[_0x2203('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x2203('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x2203('0x5')]},'customerIp':{'type':Sequelize[_0x2203('0x6')]},'formData':{'type':Sequelize[_0x2203('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x2203('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x2203('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x2203('0x6')]},'customerPort':{'type':Sequelize[_0x2203('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'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 d2b283e..5f33a5e 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 _0xe14d=['unreadMessages','having','`\x20=\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','union','User','some','isEmpty','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','contactName','DESC','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','groupBy','ChatInteractionId','push','all','rows','show','params','keys','includeAll','include','options','create','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Interaction\x20already\x20assigned','AbandonInteraction','abandon','originalname','basename','file','filename','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','transcript-%s.txt','now','pathTranscript','Messages','format','%s%d','agentAlias','System','customer','agentIdentifier','alias','fullname','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','setTags','spread','emit','chatInteractionTags:save','removeTags','server','files','tmp','transcript-%d-%s.zip','firstName','lastName','attachments','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','referer','customerPort','tail','existsSync','createReadStream','createWriteStream','renderFile','downloadInteraction.ejs','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','util','ejs','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','then','destroy','stack','name','send','render','merge','body','contact','interaction','account','Users','map','TagIds','Tags','split','forEach','waiting','talking','answered','abandoned','total','closed','UserId','disposition','unmanaged','index','ChatInteraction','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions'];(function(_0x3d717b,_0x5f4e85){var _0x4676b1=function(_0x325ad2){while(--_0x325ad2){_0x3d717b['push'](_0x3d717b['shift']());}};_0x4676b1(++_0x5f4e85);}(_0xe14d,0x1ee));var _0xde14=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xe14d[_0x15bc81];return _0x59440e;};'use strict';var rimraf=require(_0xde14('0x0'));var zipdir=require(_0xde14('0x1'));var rp=require(_0xde14('0x2'));var moment=require(_0xde14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xde14('0x4'));var util=require(_0xde14('0x5'));var path=require('path');var ejs=require(_0xde14('0x6'));var fs=require('fs');var _=require(_0xde14('0x7'));var squel=require(_0xde14('0x8'));var Redis=require(_0xde14('0x9'));var qs=require(_0xde14('0xa'));var as=require(_0xde14('0xb'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xde14('0xc'));var config=require(_0xde14('0xd'));var db=require(_0xde14('0xe'))['db'];config[_0xde14('0xf')]=_[_0xde14('0x10')](config[_0xde14('0xf')],{'host':_0xde14('0x11'),'port':0x18eb});var socket=require(_0xde14('0x12'))(new Redis(config['redis']));require(_0xde14('0x13'))[_0xde14('0x14')](socket);var jayson=require(_0xde14('0x15'));var client=jayson[_0xde14('0x16')][_0xde14('0x17')]({'port':0x232b});var client9004=jayson[_0xde14('0x16')][_0xde14('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x3d5a29,_0x34e28f,_0x29e3ca,_0x105f96){return new BPromise(function(_0x464624,_0x3521d4){var _0x281c54=_0x105f96||client;return _0x281c54[_0xde14('0x18')](_0x3d5a29,_0x29e3ca)['then'](function(_0x584959){logger[_0xde14('0x19')](_0xde14('0x1a'),_0x34e28f,_0xde14('0x1b'));logger['debug'](_0xde14('0x1c'),_0x34e28f,_0xde14('0x1b'),JSON[_0xde14('0x1d')](_0x584959));if(_0x584959[_0xde14('0x1e')]){if(_0x584959[_0xde14('0x1e')][_0xde14('0x1f')]===0x1f4){logger[_0xde14('0x1e')](_0xde14('0x1a'),_0x34e28f,_0x584959[_0xde14('0x1e')][_0xde14('0x20')]);return _0x3521d4(_0x584959['error'][_0xde14('0x20')]);}logger[_0xde14('0x1e')](_0xde14('0x1a'),_0x34e28f,_0x584959[_0xde14('0x1e')]['message']);return _0x464624(_0x584959[_0xde14('0x1e')]['message']);}else{logger[_0xde14('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x34e28f,_0xde14('0x1b'));_0x464624(_0x584959[_0xde14('0x21')][_0xde14('0x20')]);}})[_0xde14('0x22')](function(_0x39bdc5){logger[_0xde14('0x1e')](_0xde14('0x1a'),_0x34e28f,_0x39bdc5);_0x3521d4(_0x39bdc5);});});}function respondWithStatusCode(_0x2dd9e7,_0xdd8d59){_0xdd8d59=_0xdd8d59||0xcc;return function(_0x163b79){if(_0x163b79){return _0x2dd9e7[_0xde14('0x23')](_0xdd8d59);}return _0x2dd9e7[_0xde14('0x24')](_0xdd8d59)[_0xde14('0x25')]();};}function respondWithResult(_0x5ae4c1,_0x42dd4f){_0x42dd4f=_0x42dd4f||0xc8;return function(_0x3ce77c){if(_0x3ce77c){return _0x5ae4c1[_0xde14('0x24')](_0x42dd4f)[_0xde14('0x26')](_0x3ce77c);}};}function respondWithFilteredResult(_0x1bb7be,_0x21ef15){return function(_0x310d75){if(_0x310d75){var _0x23c735=typeof _0x21ef15[_0xde14('0x27')]===_0xde14('0x28')&&typeof _0x21ef15['limit']===_0xde14('0x28');var _0x1696ee=_0x310d75[_0xde14('0x29')];var _0xf8279a=_0x23c735?0x0:_0x21ef15['offset'];var _0x3fc2a4=_0x23c735?_0x310d75[_0xde14('0x29')]:_0x21ef15[_0xde14('0x27')]+_0x21ef15['limit'];var _0x4655fb;if(_0x3fc2a4>=_0x1696ee){_0x3fc2a4=_0x1696ee;_0x4655fb=0xc8;}else{_0x4655fb=0xce;}_0x1bb7be['status'](_0x4655fb);return _0x1bb7be[_0xde14('0x2a')](_0xde14('0x2b'),_0xf8279a+'-'+_0x3fc2a4+'/'+_0x1696ee)[_0xde14('0x26')](_0x310d75);}return null;};}function saveUpdates(_0x1e7906){return function(_0x2aca96){if(_0x2aca96){return _0x2aca96[_0xde14('0x2c')](_0x1e7906)[_0xde14('0x2d')](function(_0x464666){return _0x464666;});}return null;};}function removeEntity(_0x4e7c5b){return function(_0xbfc01b){if(_0xbfc01b){return _0xbfc01b[_0xde14('0x2e')]()['then'](function(){_0x4e7c5b[_0xde14('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e40ad){return function(_0x44e88a){if(!_0x44e88a){_0x2e40ad[_0xde14('0x23')](0x194);}return _0x44e88a;};}function handleError(_0x21a916,_0x13c164){_0x13c164=_0x13c164||0x1f4;return function(_0x57fc47){logger[_0xde14('0x1e')](_0x57fc47[_0xde14('0x2f')]);if(_0x57fc47['name']){delete _0x57fc47[_0xde14('0x30')];}_0x21a916[_0xde14('0x24')](_0x13c164)[_0xde14('0x31')](_0x57fc47);};}function getMustacheRender(_0x319136,_0x2713fb){return Mustache[_0xde14('0x32')](_0x319136,_[_0xde14('0x33')](_0x2713fb[_0xde14('0x34')],{'contact':_0x2713fb[_0xde14('0x35')],'message':_0x2713fb['message'],'agent':_0x2713fb['agent'],'interaction':_0x2713fb[_0xde14('0x36')],'account':_0x2713fb[_0xde14('0x37')]}))||'';}function getInteractionUsers(_0x20913d,_0x38d21c){return new BPromise(function(_0x31cad4,_0x23813f){try{if(_0x38d21c[_0x20913d['id']]){_0x20913d[_0xde14('0x38')]=_[_0xde14('0x39')](_0x38d21c[_0x20913d['id']],function(_0x2ac7ba){return{'id':_0x2ac7ba['id'],'fullname':_0x2ac7ba['fullname']};});}}catch(_0x1854d3){_0x23813f(_0x1854d3);}_0x31cad4(_0x20913d);});}function getInteractionTags(_0x48c043,_0x4a363c){return new BPromise(function(_0x4c1e37,_0xb0eba6){try{if(_0x48c043[_0xde14('0x3a')]){_0x48c043[_0xde14('0x3b')]=[];_0x48c043[_0xde14('0x3a')][_0xde14('0x3c')](',')[_0xde14('0x3d')](function(_0x1e89b6){_0x48c043[_0xde14('0x3b')]['push'](_0x4a363c[_0x1e89b6]);});}delete _0x48c043[_0xde14('0x3a')];}catch(_0x3883b9){_0xb0eba6(_0x3883b9);}_0x4c1e37(_0x48c043);});}function updateChatInteraction(_0x3864ff,_0x2b3004,_0x346566){return new BPromise(function(_0x3e52e4,_0x2ec2f3){return getInteractionUsers(_0x3864ff,_0x346566)[_0xde14('0x2d')](function(_0x50db0d){return getInteractionTags(_0x50db0d,_0x2b3004);})[_0xde14('0x2d')](function(_0xb6b2ee){return getStateInteraction(_0xb6b2ee);})[_0xde14('0x2d')](function(_0x25bd85){_0x3e52e4(_0x25bd85);})['catch'](function(_0x5ebb03){_0x2ec2f3(_0x5ebb03);});});}function getStateInteraction(_0x75d4f1){return new BPromise(function(_0x16e7d1){_0x75d4f1[_0xde14('0x3e')]=0x0;_0x75d4f1[_0xde14('0x3f')]=0x0;_0x75d4f1[_0xde14('0x40')]=0x0;_0x75d4f1['unmanaged']=0x0;_0x75d4f1[_0xde14('0x41')]=0x0;_0x75d4f1[_0xde14('0x42')]=0x0;if(!_0x75d4f1[_0xde14('0x43')]&&!_0x75d4f1['UserId']){_0x75d4f1[_0xde14('0x3e')]+=0x1;}if(!_0x75d4f1['closed']&&_0x75d4f1[_0xde14('0x44')]){_0x75d4f1['talking']+=0x1;if(_0x75d4f1[_0xde14('0x3e')]){_0x75d4f1[_0xde14('0x3e')]-=0x1;}}if(_0x75d4f1[_0xde14('0x43')]&&_0x75d4f1[_0xde14('0x45')]===_0xde14('0x41')){_0x75d4f1[_0xde14('0x41')]+=0x1;if(_0x75d4f1[_0xde14('0x3e')]){_0x75d4f1[_0xde14('0x3e')]-=0x1;}}else if(_0x75d4f1['closed']&&!_0x75d4f1[_0xde14('0x44')]&&_0x75d4f1['disposition']){_0x75d4f1[_0xde14('0x46')]+=0x1;if(_0x75d4f1['waiting']){_0x75d4f1[_0xde14('0x3e')]-=0x1;}}else if(_0x75d4f1[_0xde14('0x43')]&&_0x75d4f1[_0xde14('0x44')]){_0x75d4f1[_0xde14('0x40')]+=0x1;if(_0x75d4f1[_0xde14('0x3f')]){_0x75d4f1[_0xde14('0x3f')]-=0x1;}}_0x75d4f1[_0xde14('0x42')]+=0x1;_0x16e7d1(_0x75d4f1);});}exports[_0xde14('0x47')]=function(_0x4f1b43,_0x15859c){var _0xe3669c={},_0x220ca7={},_0x4b1ef7={'count':0x0,'rows':[]};var _0x5ab2de=_[_0xde14('0x39')](db[_0xde14('0x48')][_0xde14('0x49')],function(_0xdbdab8){return{'name':_0xdbdab8[_0xde14('0x4a')],'type':_0xdbdab8[_0xde14('0x4b')]['key']};});_0x220ca7[_0xde14('0x4c')]=_['map'](_0x5ab2de,_0xde14('0x30'));_0x220ca7[_0xde14('0x4d')]=_['keys'](_0x4f1b43[_0xde14('0x4d')]);_0x220ca7[_0xde14('0x4e')]=_[_0xde14('0x4f')](_0x220ca7[_0xde14('0x4c')],_0x220ca7[_0xde14('0x4d')]);_0xe3669c[_0xde14('0x50')]=_[_0xde14('0x4f')](_0x220ca7['model'],qs[_0xde14('0x51')](_0x4f1b43['query'][_0xde14('0x51')]));_0xe3669c[_0xde14('0x50')]=_0xe3669c[_0xde14('0x50')][_0xde14('0x52')]?_0xe3669c[_0xde14('0x50')]:_0x220ca7[_0xde14('0x4c')];if(!_0x4f1b43[_0xde14('0x4d')][_0xde14('0x53')](_0xde14('0x54'))){_0xe3669c[_0xde14('0x55')]=qs['limit'](_0x4f1b43[_0xde14('0x4d')][_0xde14('0x55')]);_0xe3669c[_0xde14('0x27')]=qs[_0xde14('0x27')](_0x4f1b43[_0xde14('0x4d')]['offset']);}_0xe3669c[_0xde14('0x56')]=qs['sort'](_0x4f1b43[_0xde14('0x4d')][_0xde14('0x57')]);_0xe3669c[_0xde14('0x58')]=qs[_0xde14('0x4e')](_[_0xde14('0x59')](_0x4f1b43['query'],_0x220ca7['filters']),_0x5ab2de);var _0x435964=[];var _0x56c3fe=squel[_0xde14('0x5a')]()[_0xde14('0x5b')]('id')[_0xde14('0x5b')](_0xde14('0x30'))[_0xde14('0x5b')](_0xde14('0x5c'))[_0xde14('0x5d')](_0xde14('0x5e'));var _0x423adc=squel['select']()[_0xde14('0x5b')](_0xde14('0x5f'))[_0xde14('0x5b')](_0xde14('0x60'))[_0xde14('0x5b')]('ui.ChatInteractionId')[_0xde14('0x5d')]('user_has_chat_interactions','ui')[_0xde14('0x61')](_0xde14('0x62'),'u',_0xde14('0x63'));var _0x4dbeaf=squel[_0xde14('0x5a')]()[_0xde14('0x5d')](_0xde14('0x64'),'i')[_0xde14('0x61')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xde14('0x62'),'o','o.id\x20=\x20i.UserId')['left_join'](_0xde14('0x65'),'a',_0xde14('0x66'))[_0xde14('0x61')](_0xde14('0x67'),'me',_0xde14('0x68'))[_0xde14('0x61')](_0xde14('0x69'),'it',_0xde14('0x6a'))[_0xde14('0x61')]('tools_tags','t',_0xde14('0x6b'));var _0x1cfc98=squel[_0xde14('0x6c')]();var _0x524e98=[];var _0x2bd32d=squel['expr']();var _0xc98b34;if(_0x4f1b43[_0xde14('0x4d')][_0xde14('0x6d')]){_0xc98b34=as[_0xde14('0x6e')](_0x4f1b43[_0xde14('0x4d')][_0xde14('0x6d')]);var _0x1a88b3=_0xc98b34['sqlOperator'];for(var _0x3a357a=0x0;_0x3a357a<_0xc98b34[_0xde14('0x6f')][_0xde14('0x52')];_0x3a357a++){var _0x40fcda=_0xc98b34[_0xde14('0x6f')][_0x3a357a];var _0x70a2e1='i';var _0x439118=_['find'](_0x5ab2de,['name',_0x40fcda[_0xde14('0x5b')]]);if(!_0x439118){switch(_0x40fcda[_0xde14('0x5b')]){case _0xde14('0x70'):if(_0x40fcda['value']==0x1){_0x4dbeaf[_0xde14('0x71')]('`'+_0x40fcda[_0xde14('0x5b')]+_0xde14('0x72'));}else{_0x4dbeaf[_0xde14('0x71')]('`'+_0x40fcda['field']+'`\x20>\x200');}break;case _0xde14('0x73'):if(_0x40fcda[_0xde14('0x74')]===_0xde14('0x75')){if(_0x40fcda[_0xde14('0x76')][_0xde14('0x3c')]('\x20')[_0xde14('0x52')]>0x1){_0x1cfc98[_0x1a88b3](_0xde14('0x77'),qs[_0xde14('0x78')](_0x40fcda[_0xde14('0x76')]),null);}else{var _0x4657d1='%'+_0x40fcda[_0xde14('0x76')]+'%';_0x1cfc98[_0x1a88b3](_0xde14('0x79'),_0x4657d1,_0x4657d1,_0x4657d1);}}else{_0x439118=_[_0xde14('0x7a')](_0x5ab2de,[_0xde14('0x30'),_0xde14('0x7b')]);_0x40fcda[_0xde14('0x5b')]=_0xde14('0x7b');_0x4474c2=as[_0xde14('0x7c')](_0x70a2e1,_0x439118[_0xde14('0x4b')],_0x40fcda);_0x1cfc98[_0x1a88b3](_0x4474c2[_0xde14('0x7d')],_0x4474c2[_0xde14('0x76')][_0xde14('0x7e')],_0x4474c2[_0xde14('0x76')]['end']);}break;case _0xde14('0x7f'):var _0x55ddcf=_0x40fcda[_0xde14('0x76')]['split'](',')[_0xde14('0x39')](function(_0xfa9c8d){return Number(_0xfa9c8d);});_0x55ddcf[_0xde14('0x3d')](function(_0x5506e1){_0x2bd32d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5506e1+',%');});_0x524e98=_[_0xde14('0x80')](_0x524e98,_0x55ddcf);break;case _0xde14('0x81'):if(_0x40fcda[_0xde14('0x74')]===_0xde14('0x75')){_0x1cfc98[_0x1a88b3]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x40fcda[_0xde14('0x76')]+'%',null);}else{_0x439118=_[_0xde14('0x7a')](_0x5ab2de,[_0xde14('0x30'),'UserId']);_0x40fcda['field']='UserId';_0x4474c2=as['buildExpression'](_0x70a2e1,_0x439118[_0xde14('0x4b')],_0x40fcda);_0x1cfc98[_0x1a88b3](_0x4474c2[_0xde14('0x7d')],_0x4474c2[_0xde14('0x76')]['start'],_0x4474c2[_0xde14('0x76')][_0xde14('0x25')]);}break;case _0xde14('0x34'):_0x4474c2=as[_0xde14('0x7c')]('me',null,_0x40fcda);_0x1cfc98[_0x1a88b3](_0x4474c2[_0xde14('0x7d')],_0x4474c2[_0xde14('0x76')]['start'],_0x4474c2['value'][_0xde14('0x25')]);break;}}else{var _0x4474c2=as['buildExpression'](_0x70a2e1,_0x439118[_0xde14('0x4b')],_0x40fcda);_0x1cfc98[_0x1a88b3](_0x4474c2[_0xde14('0x7d')],_0x4474c2[_0xde14('0x76')][_0xde14('0x7e')],_0x4474c2[_0xde14('0x76')][_0xde14('0x25')]);}}}else{var _0x2540df=_(_0x4f1b43['query'])['keys']()['map'](function(_0x5d9fa3){return _[_0xde14('0x82')](_0x5ab2de,[_0xde14('0x30'),_0x5d9fa3])?_0x5d9fa3:undefined;})['compact']()['value']();if(!_[_0xde14('0x83')](_0x2540df)){_0x2540df[_0xde14('0x3d')](function(_0xe2b9f5){if(_0xe2b9f5==='ChatWebsiteId'){_0x4dbeaf[_0xde14('0x58')](_0xde14('0x84'),[]['concat'](_0x4f1b43[_0xde14('0x4d')][_0xe2b9f5]));}else if(_0xe2b9f5===_0xde14('0x85')){var _0x11c863=JSON[_0xde14('0x86')](_0x4f1b43['query'][_0xe2b9f5])[_0xde14('0x87')];var _0x5a5b25=JSON[_0xde14('0x86')](_0x4f1b43[_0xde14('0x4d')][_0xe2b9f5])[_0xde14('0x88')];_0x4dbeaf['where'](_0xde14('0x89'),_0x11c863,_0x5a5b25);}else{if(_0x4f1b43[_0xde14('0x4d')][_0xe2b9f5]===_0xde14('0x8a')){_0x4dbeaf[_0xde14('0x58')]('i.'+_0xe2b9f5+_0xde14('0x8b'));}else{_0x4dbeaf['where']('i.'+_0xe2b9f5+'\x20=\x20?',_0x4f1b43[_0xde14('0x4d')][_0xe2b9f5]);}}});}if(_0x4f1b43[_0xde14('0x4d')][_0xde14('0x8c')]){if(_0x4f1b43['query'][_0xde14('0x8c')]==0x1){_0x4dbeaf[_0xde14('0x71')](_0xde14('0x8d'));}else{_0x4dbeaf[_0xde14('0x71')](_0xde14('0x8e'));}}if(_0x4f1b43[_0xde14('0x4d')][_0xde14('0x8f')]){_0x524e98=_['isArray'](_0x4f1b43[_0xde14('0x4d')][_0xde14('0x8f')])?_0x4f1b43[_0xde14('0x4d')][_0xde14('0x8f')]:new Array(_0x4f1b43[_0xde14('0x4d')][_0xde14('0x8f')]);_0x524e98[_0xde14('0x3d')](function(_0x57bc16){_0x2bd32d['or'](_0xde14('0x90'),'%,'+_0x57bc16+',%');});}if(_0x4f1b43[_0xde14('0x4d')]['filter']){var _0x4543f1=_0x4f1b43['query'][_0xde14('0x91')]['replace']('\x5c','\x5c\x5c')[_0xde14('0x92')](/'/g,'\x27\x27');if(qs[_0xde14('0x93')](_0x4543f1)){_0x1cfc98['or'](_0xde14('0x94'),_0x4543f1+'%');}else{_0x1cfc98['or'](_0xde14('0x95'),qs[_0xde14('0x78')](_0x4543f1))['or'](_0xde14('0x96'),_0x4543f1+'%');}}}_0x4dbeaf['where'](_0x1cfc98);_0x4dbeaf[_0xde14('0x97')](_0xde14('0x98'));var _0x1db63e={'type':db['Sequelize'][_0xde14('0x99')][_0xde14('0x9a')],'raw':!![]};var _0x411b4f=_0x4dbeaf['clone']();_0x411b4f[_0xde14('0x5b')](_0xde14('0x98'));_0x411b4f[_0xde14('0x5b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0xe3669c['order']){_0xe3669c['order'][_0xde14('0x3d')](function(_0x1ce32f){var _0x54ff4c=_0x1ce32f[0x0]===_0xde14('0x9b')?_0x1ce32f[0x0]:'i.'+_0x1ce32f[0x0];_0x4dbeaf[_0xde14('0x56')](_0x54ff4c,_0x1ce32f[0x1]===_0xde14('0x9c')?![]:!![]);});}if(!_[_0xde14('0x83')](_0x524e98)){_0x4dbeaf[_0xde14('0x71')](_0x2bd32d);_0x411b4f['where'](_0xde14('0x9d'),_0x524e98);}BPromise[_0xde14('0x9e')]()[_0xde14('0x2d')](function(){if(!_0xc98b34){if(_0x4f1b43[_0xde14('0x4d')][_0xde14('0x9f')])return;_0x411b4f[_0xde14('0x58')](_0xde14('0xa0'));_0x4dbeaf[_0xde14('0x58')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x4f1b43[_0xde14('0xa1')][_0xde14('0xa2')]!==_0xde14('0xa3'))return;return _0x4f1b43[_0xde14('0xa1')][_0xde14('0xa4')]({'attributes':['id'],'raw':!![]})[_0xde14('0x2d')](function(_0x4fb108){if(_[_0xde14('0x83')](_0x4fb108)){_0x411b4f['where'](_0xde14('0xa5'));_0x4dbeaf[_0xde14('0x58')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x411b4f[_0xde14('0x58')](_0xde14('0x84'),_[_0xde14('0x39')](_0x4fb108,'id'));_0x4dbeaf[_0xde14('0x58')](_0xde14('0x84'),_[_0xde14('0x39')](_0x4fb108,'id'));}});})[_0xde14('0x2d')](function(){if(_0x4f1b43[_0xde14('0xa1')][_0xde14('0xa2')]===_0xde14('0xa3')&&!_0xc98b34&&!_0x4f1b43[_0xde14('0x4d')][_0xde14('0x9f')])return[];return db[_0xde14('0xa6')]['query'](_0x411b4f['toString'](),_0x1db63e);})[_0xde14('0x2d')](function(_0x9f6dad){_0x4b1ef7['count']=_0x9f6dad[_0xde14('0x52')];if(_0x4b1ef7[_0xde14('0x29')]===0x0)return[];return db[_0xde14('0xa6')][_0xde14('0x4d')](_0x56c3fe[_0xde14('0xa7')](),_0x1db63e)[_0xde14('0x2d')](function(_0x2eb881){_0x435964=_[_0xde14('0xa8')](_0x2eb881,'id');_0x1db63e=_[_0xde14('0x33')](_0x1db63e,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4f1b43['query'][_0xde14('0x51')]){_0xe3669c[_0xde14('0x50')]['forEach'](function(_0x17b40c){_0x4dbeaf[_0xde14('0x5b')]('i.'+_0x17b40c);});}else{_0x4dbeaf['field'](_0xde14('0xa9'),_0xde14('0x70'));_0x4dbeaf['field'](_0xde14('0xaa'),'Account.key');_0x4dbeaf[_0xde14('0x5b')](_0xde14('0xab'),_0xde14('0xac'));_0x4dbeaf[_0xde14('0x5b')]('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',_0xde14('0x9b'));_0x4dbeaf[_0xde14('0x5b')](_0xde14('0xad'));_0x4dbeaf['field'](_0xde14('0xae'),_0xde14('0xaf'));_0x4dbeaf[_0xde14('0x5b')](_0xde14('0xb0'),'Contact.lastName');_0x4dbeaf[_0xde14('0x5b')](_0xde14('0xb1'),'Contact.email');_0x4dbeaf[_0xde14('0x5b')](_0xde14('0xb2'),_0xde14('0xb3'));_0x4dbeaf[_0xde14('0x5b')](_0xde14('0xb4'),_0xde14('0xb5'));_0x4dbeaf[_0xde14('0x5b')](_0xde14('0xb6'),'Contact.fax');_0x4dbeaf[_0xde14('0x5b')](_0xde14('0xb7'),_0xde14('0xb8'));_0x4dbeaf[_0xde14('0x5b')]('o.internal','Owner.internal');_0x4dbeaf['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xde14('0x3a'));}if(_0xe3669c[_0xde14('0x55')])_0x4dbeaf[_0xde14('0x55')](_0xe3669c['limit']);if(_0xe3669c['offset'])_0x4dbeaf[_0xde14('0x27')](_0xe3669c['offset']);return db['sequelize']['query'](_0x4dbeaf['toString'](),_0x1db63e);})[_0xde14('0x2d')](function(_0x54fbea){if(_0x54fbea['length']>0x0)_0x423adc['where']('ui.ChatInteractionId\x20IN\x20?',_[_0xde14('0x39')](_0x54fbea,'id'));return db[_0xde14('0xa6')][_0xde14('0x4d')](_0x423adc[_0xde14('0xa7')](),_0x1db63e)[_0xde14('0x2d')](function(_0x35dcce){var _0x4f7484=_[_0xde14('0xb9')](_0x35dcce,_0xde14('0xba'));var _0x63f985=[];_0x54fbea[_0xde14('0x3d')](function(_0x4648f7){_0x63f985[_0xde14('0xbb')](updateChatInteraction(_0x4648f7,_0x435964,_0x4f7484));});return BPromise[_0xde14('0xbc')](_0x63f985);});});})[_0xde14('0x2d')](function(_0x84794b){_0x4b1ef7[_0xde14('0xbd')]=_0x84794b;return _0x4b1ef7;})[_0xde14('0x2d')](respondWithFilteredResult(_0x15859c,_0xe3669c))[_0xde14('0x22')](handleError(_0x15859c,null));};exports[_0xde14('0xbe')]=function(_0xf16def,_0x22ea84){var _0x5b1473={'raw':![],'where':{'id':_0xf16def[_0xde14('0xbf')]['id']}},_0x14fd13={};_0x14fd13[_0xde14('0x4c')]=_[_0xde14('0xc0')](db[_0xde14('0x48')][_0xde14('0x49')]);_0x14fd13['query']=_[_0xde14('0xc0')](_0xf16def[_0xde14('0x4d')]);_0x14fd13[_0xde14('0x4e')]=_[_0xde14('0x4f')](_0x14fd13['model'],_0x14fd13['query']);_0x5b1473['attributes']=_[_0xde14('0x4f')](_0x14fd13[_0xde14('0x4c')],qs[_0xde14('0x51')](_0xf16def[_0xde14('0x4d')][_0xde14('0x51')]));_0x5b1473[_0xde14('0x50')]=_0x5b1473[_0xde14('0x50')][_0xde14('0x52')]?_0x5b1473[_0xde14('0x50')]:_0x14fd13[_0xde14('0x4c')];if(_0xf16def[_0xde14('0x4d')][_0xde14('0xc1')]){_0x5b1473[_0xde14('0xc2')]=[{'all':!![]}];}_0x5b1473=_[_0xde14('0x33')]({},_0x5b1473,_0xf16def[_0xde14('0xc3')]);return db[_0xde14('0x48')][_0xde14('0x7a')](_0x5b1473)[_0xde14('0x2d')](handleEntityNotFound(_0x22ea84,null))['then'](respondWithResult(_0x22ea84,null))[_0xde14('0x22')](handleError(_0x22ea84,null));};exports['create']=function(_0x48c0c3,_0x56a9d0){return db['ChatInteraction'][_0xde14('0xc4')](_0x48c0c3[_0xde14('0x34')],{})['then'](respondWithResult(_0x56a9d0,0xc9))[_0xde14('0x22')](handleError(_0x56a9d0,null));};exports['update']=function(_0x153fff,_0x32f18c){if(_0x153fff['body']['id']){delete _0x153fff[_0xde14('0x34')]['id'];}return db[_0xde14('0x48')][_0xde14('0x7a')]({'where':{'id':_0x153fff[_0xde14('0xbf')]['id']}})[_0xde14('0x2d')](handleEntityNotFound(_0x32f18c,null))[_0xde14('0x2d')](saveUpdates(_0x153fff[_0xde14('0x34')],null))[_0xde14('0x2d')](respondWithResult(_0x32f18c,null))[_0xde14('0x22')](handleError(_0x32f18c,null));};exports[_0xde14('0x2e')]=function(_0x271f5e,_0x15b4ef){return db['ChatInteraction'][_0xde14('0x7a')]({'where':{'id':_0x271f5e['params']['id']}})[_0xde14('0x2d')](handleEntityNotFound(_0x15b4ef,null))[_0xde14('0x2d')](removeEntity(_0x15b4ef,null))[_0xde14('0x22')](handleError(_0x15b4ef,null));};exports['describe']=function(_0x3d9ff9,_0x4a6501){return db[_0xde14('0x48')]['describe']()[_0xde14('0x2d')](respondWithResult(_0x4a6501,null))[_0xde14('0x22')](handleError(_0x4a6501,null));};exports[_0xde14('0xc5')]=function(_0x479caa,_0x5628db){var _0x4f90b0=_0x479caa[_0xde14('0xbf')]['id'];var _0x18ba4b;var _0x44d0ad;var _0x29aed6;return db['ChatInteraction'][_0xde14('0xc6')]({'where':{'id':_0x4f90b0}})[_0xde14('0x2d')](function(_0x56dc1f){_0x18ba4b=_0x56dc1f;return db[_0xde14('0xc7')][_0xde14('0xc6')]({'where':{'id':_0x56dc1f[_0xde14('0x9f')]},'attributes':['id',_0xde14('0xc8'),_0xde14('0xc9'),_0xde14('0xca'),_0xde14('0xcb'),_0xde14('0xcc')],'raw':!![]});})[_0xde14('0x2d')](function(_0xfbc3cc){if(_0xfbc3cc&&_0xfbc3cc[_0xde14('0xc8')]&&_0xfbc3cc[_0xde14('0xc9')]){_0x44d0ad=_0xfbc3cc;var _0x5d8883={'interaction':{'id':_0x4f90b0},'agent':{'id':_0x479caa[_0xde14('0xa1')]['id'],'name':_0x479caa['user'][_0xde14('0x30')],'fullname':_0x479caa[_0xde14('0xa1')]['fullname'],'email':_0x479caa['user'][_0xde14('0xcd')]},'contact':_0x479caa[_0xde14('0x34')][_0xde14('0x35')],'account':_0x479caa[_0xde14('0x34')][_0xde14('0x37')]};var _0x613120={'rejectUnauthorized':![],'method':_0xde14('0xce'),'url':_0xde14('0xcf'),'headers':{'X-APIKEY':_0xfbc3cc['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x479caa[_0xde14('0xa1')][_0xde14('0xcd')]],'buttons':null,'topic':_0x44d0ad[_0xde14('0xca')],'note':_[_0xde14('0xd0')](_0x44d0ad[_0xde14('0xcb')])?null:getMustacheRender(_0x44d0ad['vidaooNote'],_0x5d8883),'metadata':null},'redirect':_0xde14('0xd1'),'json':!![]};try{if(!_[_0xde14('0xd0')](_0x44d0ad[_0xde14('0xcc')])){var _0xd83ac6=getMustacheRender(_0x44d0ad[_0xde14('0xcc')],_0x5d8883);var _0x3a369a=JSON[_0xde14('0x86')](_0xd83ac6);_0x613120[_0xde14('0x34')][_0xde14('0xd2')]=_0x3a369a;}}catch(_0x3af55d){throw new db[(_0xde14('0xd3'))]['ValidationError'](_0xde14('0xd4'));}return rp(_0x613120);}else{throw new db[(_0xde14('0xd3'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0xde14('0x2d')](function(_0x31ebdd){_0x29aed6=_0x31ebdd;if(_0x29aed6['id']){var _0x428a64={'body':_0x29aed6[_0xde14('0xd5')],'ChatWebsiteId':_0x44d0ad['id'],'ChatInteractionId':_0x18ba4b['id'],'direction':_0xde14('0xd6'),'UserId':_0x479caa['user']['id']};return db[_0xde14('0xd7')][_0xde14('0xc4')](_0x428a64,{});}else{throw new db[(_0xde14('0xd3'))][(_0xde14('0xd8'))](_0xde14('0xd9'));}})[_0xde14('0x2d')](function(){return _0x18ba4b[_0xde14('0xda')]({'vidaooSessionId':_0x29aed6['id']});})[_0xde14('0x2d')](respondWithResult(_0x5628db,null))[_0xde14('0x22')](handleError(_0x5628db,null));};exports[_0xde14('0xdb')]=function(_0x449748,_0x331c0f){if(_0x449748[_0xde14('0x34')]['id']){delete _0x449748[_0xde14('0x34')]['id'];}return db[_0xde14('0x48')][_0xde14('0x7a')]({'where':{'id':_0x449748[_0xde14('0xbf')]['id']},'include':[{'model':db[_0xde14('0xdc')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x331c0f,null))[_0xde14('0x2d')](saveUpdates(_0x449748[_0xde14('0x34')],null))['then'](respondWithResult(_0x331c0f,null))[_0xde14('0x22')](handleError(_0x331c0f,null));};exports['abandon']=function(_0x593e49,_0x42c858){if(_0x593e49['body']['id']){delete _0x593e49[_0xde14('0x34')]['id'];}return db[_0xde14('0x48')][_0xde14('0x7a')]({'where':{'id':_0x593e49[_0xde14('0xbf')]['id']}})['then'](function(_0x34d9fe){if(!_0x34d9fe){logger[_0xde14('0x1e')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,'entity\x20not\x20found');_0x42c858[_0xde14('0x23')](0x194);}else{if(_0x34d9fe[_0xde14('0x44')]){throw new db[(_0xde14('0xd3'))]['ValidationError'](_0xde14('0xdd'));}}return _0x34d9fe;})[_0xde14('0x2d')](function(_0x4a83c2){if(_0x4a83c2){return _0x4a83c2[_0xde14('0x2c')]({'closed':_0x593e49['body'][_0xde14('0x43')],'disposition':_0x593e49['body'][_0xde14('0x45')]})[_0xde14('0x2d')](function(_0x397686){return _0x397686;});}})['then'](function(){return respondWithRpcPromise(_0xde14('0xde'),_0xde14('0xdf'),_0x593e49[_0xde14('0x34')],client9004);})['then'](respondWithResult(_0x42c858,null))[_0xde14('0x22')](handleError(_0x42c858,null));};exports['attachmentUpload']=function(_0xcb4fe6,_0x3ccccb){_0xcb4fe6[_0xde14('0x34')][_0xde14('0x30')]=_0xcb4fe6['file'][_0xde14('0xe0')];_0xcb4fe6[_0xde14('0x34')][_0xde14('0xe1')]=_0xcb4fe6[_0xde14('0xe2')][_0xde14('0xe3')];_0xcb4fe6[_0xde14('0x34')][_0xde14('0x4b')]=_0xcb4fe6[_0xde14('0xe2')][_0xde14('0xe4')];return db[_0xde14('0xe5')]['create'](_0xcb4fe6[_0xde14('0x34')])[_0xde14('0x2d')](respondWithResult(_0x3ccccb,0xc9))[_0xde14('0x22')](handleError(_0x3ccccb,null));};exports[_0xde14('0xe6')]=function(_0x1d3c21,_0x375d5b){return db['ChatInteraction'][_0xde14('0xc6')]({'where':{'id':_0x1d3c21[_0xde14('0xbf')]['id']},'raw':!![]})[_0xde14('0x2d')](handleEntityNotFound(_0x375d5b,null))[_0xde14('0x2d')](function(_0x5228b9){if(_0x5228b9){if(_0x5228b9[_0xde14('0x43')]){return _0x375d5b[_0xde14('0x24')](0x193)[_0xde14('0x26')]({'status':0x193,'message':_0xde14('0xe7')});}return db[_0xde14('0xe5')][_0xde14('0xc6')]({'where':{'id':_0x1d3c21[_0xde14('0x4d')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x375d5b,null));}})['then'](function(_0x55ee6e){if(_0x55ee6e){var _0x244778=_0x55ee6e[_0xde14('0xe8')]!==null;var _0x36edcc=path[_0xde14('0xe9')](config[_0xde14('0xea')],_0xde14('0xeb'));if(_0x244778){_0x36edcc=path[_0xde14('0xe9')](_0x36edcc,_0xde14('0xec'));}var _0x61812c=path[_0xde14('0xe9')](_0x36edcc,_0x55ee6e[_0xde14('0xe1')]);return _0x375d5b[_0xde14('0xed')](_0x61812c);}})[_0xde14('0x22')](handleError(_0x375d5b,null));};exports[_0xde14('0xee')]=function(_0x324389,_0xc4e7e8){var _0x4c8ddd=null;var _0x973b9f=null;var _0xe7729a=null;if(_0x324389[_0xde14('0x34')]['id']){delete _0x324389[_0xde14('0x34')]['id'];}if(_0x324389[_0xde14('0x34')][_0xde14('0xef')]){_0xe7729a=path[_0xde14('0xe9')](config['root'],'server/files/chat/upload/',util['format'](_0xde14('0xf0'),Date[_0xde14('0xf1')]()));_0x324389[_0xde14('0x34')][_0xde14('0xf2')]=_0xe7729a;}return db[_0xde14('0x48')][_0xde14('0x7a')]({'where':{'id':_0x324389[_0xde14('0xbf')]['id']},'include':[{'model':db[_0xde14('0xd7')],'as':_0xde14('0xf3'),'include':[{'model':db[_0xde14('0x81')],'as':_0xde14('0x81')}]}]})[_0xde14('0x2d')](handleEntityNotFound(_0xc4e7e8,null))[_0xde14('0x2d')](saveUpdates(_0x324389[_0xde14('0x34')],null))[_0xde14('0x2d')](function(_0x2a8fcb){if(_0x2a8fcb){_0x4c8ddd=_0x2a8fcb;return db['ChatWebsite']['find']({'where':{'id':_0x4c8ddd['ChatWebsiteId']}});}})[_0xde14('0x2d')](function(_0x84a4a9){if(_0x84a4a9){_0x973b9f=_0x84a4a9;return db[_0xde14('0xdc')]['find']({'where':{'id':_0x4c8ddd[_0xde14('0x7b')]}});}})[_0xde14('0x2d')](function(_0x4d3be2){if(_0x4d3be2){if(_0xe7729a){var _0x2f3517=null;for(var _0x4518cf=0x1;_0x4518cf<_0x4c8ddd[_0xde14('0xf3')][_0xde14('0x52')];++_0x4518cf){_0x2f3517=_0x4c8ddd[_0xde14('0xf3')][_0x4518cf];var _0x55de57=_0x2f3517[_0xde14('0x44')]?util[_0xde14('0xf4')](_0xde14('0xf5'),_0x973b9f[_0xde14('0xf6')],_0x2f3517[_0xde14('0x44')]):_0xde14('0xf7');var _0x221413=_0x324389[_0xde14('0x34')][_0xde14('0xf8')]||util[_0xde14('0xf4')](_0xde14('0xf5'),'Visitor',_0x2f3517[_0xde14('0x7b')]);switch(_0x973b9f[_0xde14('0xf9')]){case'website_alias':_0x55de57=_0x2f3517[_0xde14('0x44')]?util['format'](_0xde14('0xf5'),_0x973b9f['agentAlias'],_0x2f3517[_0xde14('0x44')]):'System';break;case'agent_alias':_0x55de57=_0x2f3517[_0xde14('0x44')]?_0x2f3517[_0xde14('0x81')][_0xde14('0xfa')]||_0x2f3517[_0xde14('0x81')][_0xde14('0xfb')]:_0xde14('0xf7');break;case _0xde14('0xfc'):_0x55de57=_0x2f3517['UserId']?_0x2f3517['User'][_0xde14('0xfb')]:'System';break;default:_0x55de57=_0x2f3517[_0xde14('0x44')]?util[_0xde14('0xf4')]('%s%d',_0x973b9f['agentAlias'],_0x2f3517[_0xde14('0x44')]):'System';}var _0x32ea6f=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x2f3517[_0xde14('0x85')])['format'](_0xde14('0xfd')),_0x2f3517[_0xde14('0xfe')]==='in'?_0x221413:_0x55de57,_0x2f3517[_0xde14('0x34')]);if(!_0x2f3517[_0xde14('0xff')]){fs[_0xde14('0x100')](_0xe7729a,_0x32ea6f);}}return db[_0xde14('0x101')][_0xde14('0xc6')]({'where':{'service':!![]},'include':[{'model':db[_0xde14('0x102')],'as':_0xde14('0x103'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xde14('0x104'),'raw':!![]}]}]});}}})['then'](function(_0x46e6c8){if(!_0x46e6c8||!_0x46e6c8[_0xde14('0x103')]||!_0x324389[_0xde14('0x34')])return _0x4c8ddd;var _0xaa98a1=_0x46e6c8[_0xde14('0x105')]();return respondWithRpcPromise(_0xde14('0x106'),_0xde14('0x107'),{'account':_0xaa98a1,'message':{'from':util[_0xde14('0xf4')]('\x22%s\x22\x20<%s>',_0x46e6c8[_0xde14('0x30')],_0x46e6c8[_0xde14('0xcd')]||_0x46e6c8['Smtp'][_0xde14('0xa1')]),'to':_0x324389[_0xde14('0x34')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0xde14('0xf4')](_0xde14('0x108'),_0x324389[_0xde14('0x34')][_0xde14('0xef')]),'attachments':[{'path':_0xe7729a}]}})[_0xde14('0x2d')](function(){return _0x4c8ddd;})[_0xde14('0x22')](function(_0x5680d4){logger[_0xde14('0x1e')](_0x5680d4);});})[_0xde14('0x2d')](respondWithStatusCode(_0xc4e7e8,0xc8))[_0xde14('0x22')](handleError(_0xc4e7e8,null));};exports[_0xde14('0x109')]=function(_0x20ad12,_0x2eccf5){return db['ChatMessage']['find']({'where':{'id':_0x20ad12[_0xde14('0xbf')]['id']}})['then'](handleEntityNotFound(_0x2eccf5,null))[_0xde14('0x2d')](function(_0x1b39cf){if(_0x1b39cf){return _0x1b39cf[_0xde14('0x109')](_0x20ad12[_0xde14('0x34')][_0xde14('0x10a')],_[_0xde14('0x10b')](_0x20ad12[_0xde14('0x34')],[_0xde14('0x10a'),'id'])||{});}})['then'](respondWithResult(_0x2eccf5,null))[_0xde14('0x22')](handleError(_0x2eccf5,null));};exports[_0xde14('0x10c')]=function(_0x14b2ee,_0x3b90ff){var _0x3d5fd1={'raw':![],'where':{}};var _0x2a0d68={};var _0x16fb18={'count':0x0,'rows':[]};return db[_0xde14('0x48')][_0xde14('0xc6')]({'where':{'id':_0x14b2ee[_0xde14('0xbf')]['id']}})[_0xde14('0x2d')](handleEntityNotFound(_0x3b90ff,null))[_0xde14('0x2d')](function(_0x4f0a67){if(_0x4f0a67){_0x2a0d68[_0xde14('0x4c')]=_['keys'](db[_0xde14('0xd7')][_0xde14('0x49')]);_0x2a0d68['query']=_['keys'](_0x14b2ee[_0xde14('0x4d')]);_0x2a0d68[_0xde14('0x4e')]=_[_0xde14('0x4f')](_0x2a0d68[_0xde14('0x4c')],_0x2a0d68[_0xde14('0x4d')]);_0x3d5fd1[_0xde14('0x50')]=_[_0xde14('0x4f')](_0x2a0d68[_0xde14('0x4c')],qs[_0xde14('0x51')](_0x14b2ee['query'][_0xde14('0x51')]));_0x3d5fd1['attributes']=_0x3d5fd1[_0xde14('0x50')][_0xde14('0x52')]?_0x3d5fd1[_0xde14('0x50')]:_0x2a0d68[_0xde14('0x4c')];if(!_0x14b2ee[_0xde14('0x4d')][_0xde14('0x53')]('nolimit')){_0x3d5fd1[_0xde14('0x55')]=qs[_0xde14('0x55')](_0x14b2ee[_0xde14('0x4d')][_0xde14('0x55')]);_0x3d5fd1[_0xde14('0x27')]=qs['offset'](_0x14b2ee[_0xde14('0x4d')]['offset']);}_0x3d5fd1['order']=qs[_0xde14('0x57')](_0x14b2ee['query']['sort']);_0x3d5fd1[_0xde14('0x58')]=qs['filters'](_['pick'](_0x14b2ee[_0xde14('0x4d')],_0x2a0d68['filters']));_0x3d5fd1[_0xde14('0x58')][_0xde14('0xba')]=_0x4f0a67['id'];if(_0x14b2ee[_0xde14('0x4d')][_0xde14('0x91')]){_0x3d5fd1[_0xde14('0x58')]=_['merge'](_0x3d5fd1[_0xde14('0x58')],{'$or':_[_0xde14('0x39')](_0x3d5fd1[_0xde14('0x50')],function(_0x57d83d){var _0x59640c={};_0x59640c[_0x57d83d]={'$like':'%'+_0x14b2ee['query']['filter']+'%'};return _0x59640c;})});}if(_0x14b2ee[_0xde14('0x4d')][_0xde14('0x87')]){var _0x38c682=_0x14b2ee['query'][_0xde14('0x87')][_0xde14('0x3c')](',');var _0x5dea0c={};_0x5dea0c[_0x38c682[0x0]]={'$gte':moment(_0x38c682[0x1])['format'](_0xde14('0x10d'))};_0x3d5fd1[_0xde14('0x58')]=_[_0xde14('0x33')](_0x3d5fd1[_0xde14('0x58')],_0x5dea0c);}_0x3d5fd1=_[_0xde14('0x33')]({},_0x3d5fd1,_0x14b2ee[_0xde14('0xc3')]);return db[_0xde14('0xd7')]['count']({'where':_0x3d5fd1[_0xde14('0x58')]})[_0xde14('0x2d')](function(_0x4a6b57){_0x16fb18['count']=_0x4a6b57;if(_0x14b2ee[_0xde14('0x4d')][_0xde14('0xc1')]){_0x3d5fd1[_0xde14('0xc2')]=[{'all':!![]}];}return db['ChatMessage'][_0xde14('0x10e')](_0x3d5fd1);})[_0xde14('0x2d')](function(_0x875097){_0x16fb18[_0xde14('0xbd')]=_0x875097;return _0x16fb18;});}})[_0xde14('0x2d')](respondWithFilteredResult(_0x3b90ff,_0x3d5fd1))[_0xde14('0x22')](handleError(_0x3b90ff,null));};exports[_0xde14('0x10f')]=function(_0x5af548,_0x138f17){var _0x376c6f={'where':{}},_0x29e276={},_0x4c98cc={'count':0x0,'rows':[]};return db[_0xde14('0x48')][_0xde14('0xc6')]({'where':{'id':_0x5af548[_0xde14('0xbf')]['id']}})[_0xde14('0x2d')](handleEntityNotFound(_0x138f17,null))[_0xde14('0x2d')](function(_0x7100cd){if(_0x7100cd){_0x29e276[_0xde14('0x4c')]=_[_0xde14('0xc0')](db[_0xde14('0xd7')][_0xde14('0x49')]);_0x29e276[_0xde14('0x4d')]=_['keys'](_0x5af548[_0xde14('0x4d')]);_0x29e276[_0xde14('0x4e')]=_[_0xde14('0x4f')](_0x29e276[_0xde14('0x4c')],_0x29e276[_0xde14('0x4d')]);_0x376c6f[_0xde14('0x50')]=_[_0xde14('0x4f')](_0x29e276[_0xde14('0x4c')],qs[_0xde14('0x51')](_0x5af548[_0xde14('0x4d')]['fields']));_0x376c6f[_0xde14('0x50')]=_0x376c6f['attributes']['length']?_0x376c6f[_0xde14('0x50')]:_0x29e276['model'];if(!_0x5af548[_0xde14('0x4d')][_0xde14('0x53')](_0xde14('0x54'))){_0x376c6f[_0xde14('0x55')]=qs[_0xde14('0x55')](_0x5af548[_0xde14('0x4d')]['limit']);_0x376c6f[_0xde14('0x27')]=qs['offset'](_0x5af548['query'][_0xde14('0x27')]);}_0x376c6f['order']=qs[_0xde14('0x57')](_0x5af548[_0xde14('0x4d')][_0xde14('0x57')]);_0x376c6f[_0xde14('0x58')]=qs[_0xde14('0x4e')](_[_0xde14('0x59')](_0x5af548[_0xde14('0x4d')],_0x29e276[_0xde14('0x4e')]));_0x376c6f['where'][_0xde14('0xba')]=_0x7100cd['id'];if(_0x5af548['query'][_0xde14('0x91')]){_0x376c6f[_0xde14('0x58')]=_[_0xde14('0x33')](_0x376c6f[_0xde14('0x58')],{'$or':_[_0xde14('0x39')](_0x376c6f[_0xde14('0x50')],function(_0x27732d){var _0x4ef9e4={};_0x4ef9e4[_0x27732d]={'$like':'%'+_0x5af548[_0xde14('0x4d')][_0xde14('0x91')]+'%'};return _0x4ef9e4;})});}_0x376c6f[_0xde14('0x58')]['secret']=![];if(_0x5af548[_0xde14('0x4d')]['id']){_0x376c6f['where']['id']={'$gt':_0x5af548['query']['id']};}_0x376c6f=_[_0xde14('0x33')]({},_0x376c6f,_0x5af548[_0xde14('0xc3')]);return db[_0xde14('0xd7')][_0xde14('0x29')]({'where':_0x376c6f[_0xde14('0x58')]})[_0xde14('0x2d')](function(_0x37b21d){_0x4c98cc[_0xde14('0x29')]=_0x37b21d;_0x376c6f['include']=[];if(_0x5af548[_0xde14('0x4d')][_0xde14('0x110')]){_0x376c6f['include'][_0xde14('0xbb')]({'model':db[_0xde14('0x81')],'as':'User','attributes':['id',_0xde14('0xfb'),_0xde14('0xfa')]});}if(_0x5af548[_0xde14('0x4d')][_0xde14('0xc1')]){_0x376c6f['include']=[{'all':!![]}];}return db[_0xde14('0xd7')][_0xde14('0x10e')](_0x376c6f);})[_0xde14('0x2d')](function(_0x2fcf14){_0x4c98cc[_0xde14('0xbd')]=_0x2fcf14;return _0x4c98cc;});}})['then'](respondWithFilteredResult(_0x138f17,_0x376c6f))[_0xde14('0x22')](handleError(_0x138f17,null));};exports['addTags']=function(_0x46ccbf,_0x46bb44){return db[_0xde14('0x48')][_0xde14('0x7a')]({'where':{'id':_0x46ccbf[_0xde14('0xbf')]['id']}})[_0xde14('0x2d')](handleEntityNotFound(_0x46bb44,null))[_0xde14('0x2d')](function(_0x4ca1a7){if(_0x4ca1a7){return _0x4ca1a7[_0xde14('0x111')](_0x46ccbf[_0xde14('0x34')]['ids'],_[_0xde14('0x10b')](_0x46ccbf['body'],['ids','id'])||{})[_0xde14('0x112')](function(){return db['Tag']['findAll']({'attributes':['id',_0xde14('0x30'),_0xde14('0x5c')],'where':{'id':_0x46ccbf['body'][_0xde14('0x10a')]}});})[_0xde14('0x2d')](function(_0x433728){socket[_0xde14('0x113')](_0xde14('0x114'),{'id':Number(_0x46ccbf['params']['id']),'tags':_0x433728||[]});return{'id':Number(_0x46ccbf['params']['id']),'tags':_0x433728||[]};});}})[_0xde14('0x2d')](respondWithResult(_0x46bb44,null))[_0xde14('0x22')](handleError(_0x46bb44,null));};exports[_0xde14('0x115')]=function(_0x5a9161,_0x53e0c2){return db[_0xde14('0x48')][_0xde14('0x7a')]({'where':{'id':_0x5a9161[_0xde14('0xbf')]['id']}})[_0xde14('0x2d')](handleEntityNotFound(_0x53e0c2,null))['then'](function(_0x533318){if(_0x533318){return _0x533318[_0xde14('0x115')](_0x5a9161[_0xde14('0x4d')]['ids']);}})['then'](respondWithStatusCode(_0x53e0c2,null))[_0xde14('0x22')](handleError(_0x53e0c2,null));};exports['download']=function(_0x546b0f,_0x946d49){var _0x3d87e5=moment()['unix']()[_0xde14('0xa7')]();var _0x113d3b=path[_0xde14('0xe9')](config[_0xde14('0xea')],_0xde14('0x116'),_0xde14('0x117'),_0xde14('0x118'));var _0x8e1358=path[_0xde14('0xe9')](config[_0xde14('0xea')],_0xde14('0x116'),_0xde14('0x117'),'attachments');var _0x2513d8=path[_0xde14('0xe9')](_0x113d3b,_0x3d87e5);var _0x5edfa1=util[_0xde14('0xf4')](_0xde14('0x119'),_0x546b0f[_0xde14('0xbf')]['id'],_0x3d87e5);var _0x5a703d=path[_0xde14('0xe9')](_0x113d3b,_0x5edfa1);var _0xbd95d7=[];_0xbd95d7['push']({'model':db[_0xde14('0x81')],'as':_0xde14('0x81'),'attributes':['id',_0xde14('0xfb')],'raw':!![]});_0xbd95d7[_0xde14('0xbb')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xde14('0x11a'),_0xde14('0x11b')],'raw':!![]});if(_0x546b0f[_0xde14('0x4d')][_0xde14('0x11c')]){_0xbd95d7[_0xde14('0xbb')]({'model':db[_0xde14('0xe5')],'as':_0xde14('0xe5'),'raw':!![]});}var _0x3e34af=[{'model':db[_0xde14('0xd7')],'as':_0xde14('0xf3'),'attributes':['id',_0xde14('0x34'),_0xde14('0x85'),'direction',_0xde14('0xff'),'read'],'include':_0xbd95d7}];_0x3e34af[_0xde14('0xbb')]({'model':db['ChatWebsite'],'as':_0xde14('0x11d'),'attributes':['id',_0xde14('0x30')]});_0x3e34af[_0xde14('0xbb')]({'model':db[_0xde14('0x81')],'as':_0xde14('0x11e'),'attributes':['id',_0xde14('0xfb')]});return db[_0xde14('0x48')][_0xde14('0x7a')]({'where':{'id':_0x546b0f[_0xde14('0xbf')]['id']},'include':_0x3e34af})[_0xde14('0x2d')](handleEntityNotFound(_0x946d49,null))[_0xde14('0x2d')](function(_0x84dba9){if(_0x84dba9){var _0x49085d=_0x84dba9[_0xde14('0x11f')]({'plain':!![]});fs[_0xde14('0x120')](_0x2513d8);var _0x569df7={'channel':_0xde14('0x121'),'account':_0x49085d['Account']['name'],'agent':_0x49085d[_0xde14('0x11e')]?_0x49085d[_0xde14('0x11e')][_0xde14('0xfb')]:_0xde14('0x122'),'createdAt':moment(_0x49085d[_0xde14('0x85')])[_0xde14('0xf4')](_0xde14('0x10d'))[_0xde14('0xa7')](),'closedAt':_0x49085d[_0xde14('0x43')]?moment(_0x49085d[_0xde14('0x123')])[_0xde14('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')[_0xde14('0xa7')]():'','disposition':_0x49085d[_0xde14('0x45')],'chatInfo':{'browser':_0x49085d['browserName'],'os':_0x49085d['osName'],'referer':_0x49085d[_0xde14('0x124')],'customerIp':_0x49085d['customerIp'],'customerPort':_0x49085d['customerPort']?_0x49085d[_0xde14('0x125')]:_0xde14('0x122')},'messages':_(_0x49085d[_0xde14('0xf3')])[_0xde14('0x126')]()[_0xde14('0x91')]({'secret':![]})[_0xde14('0x39')](function(_0x3f2779){if(_0x3f2779[_0xde14('0xe5')]){var _0x1d93f7=path[_0xde14('0xe9')](_0x8e1358,_0x3f2779['Attachment'][_0xde14('0xe1')]);if(fs[_0xde14('0x127')](_0x1d93f7)){fs[_0xde14('0x128')](_0x1d93f7)['pipe'](fs[_0xde14('0x129')](path[_0xde14('0xe9')](_0x2513d8,_0x3f2779[_0xde14('0xe5')][_0xde14('0xe1')])));}}return{'date':moment(_0x3f2779[_0xde14('0x85')])[_0xde14('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')[_0xde14('0xa7')](),'sender':_0x3f2779[_0xde14('0xfe')]==='out'?_0x3f2779[_0xde14('0x81')]?_0x3f2779['User'][_0xde14('0xfb')]:_0xde14('0xf7'):_0x3f2779[_0xde14('0x73')][_0xde14('0x11a')]+(_0x3f2779[_0xde14('0x73')][_0xde14('0x11b')]?'\x20'+_0x3f2779[_0xde14('0x73')][_0xde14('0x11b')]:''),'body':_0x3f2779[_0xde14('0xe5')]?_0x3f2779[_0xde14('0xe5')]['basename']:_0x3f2779[_0xde14('0x34')],'direction':_0x3f2779['direction']==='out'?'A':'C','secret':_0x3f2779[_0xde14('0xff')],'read':_0x3f2779[_0xde14('0x8c')],'attachment':_0x3f2779['Attachment']};})[_0xde14('0x76')]()};return ejs[_0xde14('0x12a')](path['join'](config[_0xde14('0xea')],_0xde14('0x116'),'views',_0xde14('0x12b')),{'interaction':_0x569df7})[_0xde14('0x2d')](function(_0x568c6d){var _0x4ad0ad=path[_0xde14('0xe9')](_0x2513d8,'transcript-'+_0x49085d['id']+'-'+_0x3d87e5+'.pdf');var _0x168874={'path':_0x4ad0ad,'channel':_0xde14('0x121'),'interactionId':_0x49085d['id']};return pdf[_0xde14('0x12c')](_0x568c6d,_0x168874);})[_0xde14('0x2d')](function(){return new Promise(function(_0x23a7d3,_0x4531b0){zipdir(_0x2513d8,{'saveTo':_0x5a703d},function(_0xb4684f,_0x322641){if(_0xb4684f)return _0x4531b0(_0xb4684f);return _0x23a7d3(_0x322641);});})[_0xde14('0x2d')](function(){return new BPromise(function(_0x4bbbd8,_0xac6cf){rimraf(_0x2513d8,function(_0xd7c682){if(_0xd7c682)_0xac6cf(_0xd7c682);return _0x4bbbd8();});});})[_0xde14('0x2d')](function(){return _0x946d49[_0xde14('0xed')](_0x5a703d,_0x5edfa1,function(_0x3a3dca){if(_0x3a3dca){logger[_0xde14('0x1e')](_0xde14('0x12d'),_0x3a3dca);}else{fs[_0xde14('0x12e')](_0x5a703d);}});});});}else{return _0x946d49['sendStatus'](0xc8);}})['catch'](handleError(_0x946d49,null));}; \ No newline at end of file +var _0x008c=['ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandon','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','%s%d','agentAlias','customer','website_alias','agent_alias','alias','System','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','addMessage','omit','ids','getMessages','hasOwnProperty','nolimit','pick','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','getMyMessages','spread','color','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','transcript-%d-%s.zip','firstName','lastName','read','Account','get','mkdirSync','Chat','Owner','N.A.','closedAt','browserName','referer','customerPort','tail','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.ejs','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../mysqldb','redis','localhost','register','jayson/promise','http','client','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','status','json','offset','undefined','limit','count','set','Content-Range','destroy','end','sendStatus','stack','name','send','render','merge','body','contact','interaction','account','Users','fullname','TagIds','Tags','push','waiting','answered','unmanaged','abandoned','total','closed','UserId','talking','disposition','index','map','fieldName','type','key','model','query','keys','attributes','fields','length','order','sort','where','filters','select','field','tools_tags','u.id','u.fullname','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','forEach','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','group','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rows','catch','show','rawAttributes','intersection','options','ChatInteraction','create','update','params','describe','findOne','ChatWebsite','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','vidaooApiKey','isNull','metadata','Sequelize'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x008c,0x188));var _0xc008=function(_0x4864ea,_0x7764ed){_0x4864ea=_0x4864ea-0x0;var _0x12e74f=_0x008c[_0x4864ea];return _0x12e74f;};'use strict';var rimraf=require(_0xc008('0x0'));var zipdir=require(_0xc008('0x1'));var rp=require(_0xc008('0x2'));var moment=require(_0xc008('0x3'));var BPromise=require(_0xc008('0x4'));var Mustache=require('mustache');var util=require(_0xc008('0x5'));var path=require(_0xc008('0x6'));var ejs=require(_0xc008('0x7'));var fs=require('fs');var _=require(_0xc008('0x8'));var squel=require(_0xc008('0x9'));var Redis=require(_0xc008('0xa'));var qs=require(_0xc008('0xb'));var as=require(_0xc008('0xc'));var pdf=require(_0xc008('0xd'));var logger=require('../../config/logger')(_0xc008('0xe'));var config=require('../../config/environment');var db=require(_0xc008('0xf'))['db'];config['redis']=_['defaults'](config[_0xc008('0x10')],{'host':_0xc008('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInteraction.socket')[_0xc008('0x12')](socket);var jayson=require(_0xc008('0x13'));var client=jayson['client'][_0xc008('0x14')]({'port':0x232b});var client9004=jayson[_0xc008('0x15')][_0xc008('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x2a5b4e,_0x9ffa93,_0x1819c6,_0x69726e){return new BPromise(function(_0x593f7a,_0x560e28){var _0x33f44c=_0x69726e||client;return _0x33f44c['request'](_0x2a5b4e,_0x1819c6)[_0xc008('0x16')](function(_0x4584e1){logger[_0xc008('0x17')](_0xc008('0x18'),_0x9ffa93,_0xc008('0x19'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x9ffa93,'request\x20sent',JSON[_0xc008('0x1a')](_0x4584e1));if(_0x4584e1[_0xc008('0x1b')]){if(_0x4584e1[_0xc008('0x1b')][_0xc008('0x1c')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x9ffa93,_0x4584e1['error']['message']);return _0x560e28(_0x4584e1[_0xc008('0x1b')][_0xc008('0x1d')]);}logger['error'](_0xc008('0x18'),_0x9ffa93,_0x4584e1['error']['message']);return _0x593f7a(_0x4584e1['error']['message']);}else{logger[_0xc008('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x9ffa93,'request\x20sent');_0x593f7a(_0x4584e1['result']['message']);}})['catch'](function(_0x13a263){logger[_0xc008('0x1b')](_0xc008('0x18'),_0x9ffa93,_0x13a263);_0x560e28(_0x13a263);});});}function respondWithStatusCode(_0x415af3,_0x11cc75){_0x11cc75=_0x11cc75||0xcc;return function(_0x110128){if(_0x110128){return _0x415af3['sendStatus'](_0x11cc75);}return _0x415af3[_0xc008('0x1e')](_0x11cc75)['end']();};}function respondWithResult(_0x58a6ea,_0x218599){_0x218599=_0x218599||0xc8;return function(_0x36f358){if(_0x36f358){return _0x58a6ea[_0xc008('0x1e')](_0x218599)[_0xc008('0x1f')](_0x36f358);}};}function respondWithFilteredResult(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(_0x5de1e9){var _0x3f7b07=typeof _0x48582b[_0xc008('0x20')]===_0xc008('0x21')&&typeof _0x48582b[_0xc008('0x22')]==='undefined';var _0x5e2aca=_0x5de1e9['count'];var _0x4adbab=_0x3f7b07?0x0:_0x48582b['offset'];var _0x3865c0=_0x3f7b07?_0x5de1e9[_0xc008('0x23')]:_0x48582b[_0xc008('0x20')]+_0x48582b['limit'];var _0x24c14c;if(_0x3865c0>=_0x5e2aca){_0x3865c0=_0x5e2aca;_0x24c14c=0xc8;}else{_0x24c14c=0xce;}_0x5410f5[_0xc008('0x1e')](_0x24c14c);return _0x5410f5[_0xc008('0x24')](_0xc008('0x25'),_0x4adbab+'-'+_0x3865c0+'/'+_0x5e2aca)['json'](_0x5de1e9);}return null;};}function saveUpdates(_0xcdb32b){return function(_0x2e0b4e){if(_0x2e0b4e){return _0x2e0b4e['update'](_0xcdb32b)['then'](function(_0x539766){return _0x539766;});}return null;};}function removeEntity(_0x1032b2){return function(_0x267abd){if(_0x267abd){return _0x267abd[_0xc008('0x26')]()[_0xc008('0x16')](function(){_0x1032b2[_0xc008('0x1e')](0xcc)[_0xc008('0x27')]();});}};}function handleEntityNotFound(_0x294f97){return function(_0x22d8e8){if(!_0x22d8e8){_0x294f97[_0xc008('0x28')](0x194);}return _0x22d8e8;};}function handleError(_0x2b862d,_0x2f4b6b){_0x2f4b6b=_0x2f4b6b||0x1f4;return function(_0x1ac7c8){logger['error'](_0x1ac7c8[_0xc008('0x29')]);if(_0x1ac7c8[_0xc008('0x2a')]){delete _0x1ac7c8['name'];}_0x2b862d[_0xc008('0x1e')](_0x2f4b6b)[_0xc008('0x2b')](_0x1ac7c8);};}function getMustacheRender(_0x383be7,_0xca0520){return Mustache[_0xc008('0x2c')](_0x383be7,_[_0xc008('0x2d')](_0xca0520[_0xc008('0x2e')],{'contact':_0xca0520[_0xc008('0x2f')],'message':_0xca0520[_0xc008('0x1d')],'agent':_0xca0520['agent'],'interaction':_0xca0520[_0xc008('0x30')],'account':_0xca0520[_0xc008('0x31')]}))||'';}function getInteractionUsers(_0x459df4,_0x344bad){return new BPromise(function(_0x40002f,_0x315562){try{if(_0x344bad[_0x459df4['id']]){_0x459df4[_0xc008('0x32')]=_['map'](_0x344bad[_0x459df4['id']],function(_0x35f360){return{'id':_0x35f360['id'],'fullname':_0x35f360[_0xc008('0x33')]};});}}catch(_0x50e1d4){_0x315562(_0x50e1d4);}_0x40002f(_0x459df4);});}function getInteractionTags(_0x399b64,_0x15453c){return new BPromise(function(_0x5e38d5,_0x263473){try{if(_0x399b64[_0xc008('0x34')]){_0x399b64[_0xc008('0x35')]=[];_0x399b64['TagIds']['split'](',')['forEach'](function(_0x234f2a){_0x399b64['Tags'][_0xc008('0x36')](_0x15453c[_0x234f2a]);});}delete _0x399b64[_0xc008('0x34')];}catch(_0x6a4ccb){_0x263473(_0x6a4ccb);}_0x5e38d5(_0x399b64);});}function updateChatInteraction(_0x440459,_0x3148e1,_0xa381d1){return new BPromise(function(_0x472994,_0x35b496){return getInteractionUsers(_0x440459,_0xa381d1)[_0xc008('0x16')](function(_0x387dfd){return getInteractionTags(_0x387dfd,_0x3148e1);})[_0xc008('0x16')](function(_0xdfca2e){return getStateInteraction(_0xdfca2e);})[_0xc008('0x16')](function(_0x2bf3fd){_0x472994(_0x2bf3fd);})['catch'](function(_0x3238b4){_0x35b496(_0x3238b4);});});}function getStateInteraction(_0x23c4db){return new BPromise(function(_0x30b7df){_0x23c4db[_0xc008('0x37')]=0x0;_0x23c4db['talking']=0x0;_0x23c4db[_0xc008('0x38')]=0x0;_0x23c4db[_0xc008('0x39')]=0x0;_0x23c4db[_0xc008('0x3a')]=0x0;_0x23c4db[_0xc008('0x3b')]=0x0;if(!_0x23c4db[_0xc008('0x3c')]&&!_0x23c4db['UserId']){_0x23c4db[_0xc008('0x37')]+=0x1;}if(!_0x23c4db[_0xc008('0x3c')]&&_0x23c4db[_0xc008('0x3d')]){_0x23c4db[_0xc008('0x3e')]+=0x1;if(_0x23c4db[_0xc008('0x37')]){_0x23c4db['waiting']-=0x1;}}if(_0x23c4db[_0xc008('0x3c')]&&_0x23c4db[_0xc008('0x3f')]===_0xc008('0x3a')){_0x23c4db[_0xc008('0x3a')]+=0x1;if(_0x23c4db['waiting']){_0x23c4db[_0xc008('0x37')]-=0x1;}}else if(_0x23c4db[_0xc008('0x3c')]&&!_0x23c4db[_0xc008('0x3d')]&&_0x23c4db['disposition']){_0x23c4db[_0xc008('0x39')]+=0x1;if(_0x23c4db['waiting']){_0x23c4db[_0xc008('0x37')]-=0x1;}}else if(_0x23c4db['closed']&&_0x23c4db[_0xc008('0x3d')]){_0x23c4db[_0xc008('0x38')]+=0x1;if(_0x23c4db['talking']){_0x23c4db[_0xc008('0x3e')]-=0x1;}}_0x23c4db[_0xc008('0x3b')]+=0x1;_0x30b7df(_0x23c4db);});}exports[_0xc008('0x40')]=function(_0x5caaa2,_0x1cec64){var _0x2a9b5c={},_0x200469={},_0x44fc5d={'count':0x0,'rows':[]};var _0x347629=_[_0xc008('0x41')](db['ChatInteraction']['rawAttributes'],function(_0x5283a8){return{'name':_0x5283a8[_0xc008('0x42')],'type':_0x5283a8[_0xc008('0x43')][_0xc008('0x44')]};});_0x200469[_0xc008('0x45')]=_[_0xc008('0x41')](_0x347629,_0xc008('0x2a'));_0x200469[_0xc008('0x46')]=_[_0xc008('0x47')](_0x5caaa2['query']);_0x200469['filters']=_['intersection'](_0x200469[_0xc008('0x45')],_0x200469[_0xc008('0x46')]);_0x2a9b5c[_0xc008('0x48')]=_['intersection'](_0x200469[_0xc008('0x45')],qs[_0xc008('0x49')](_0x5caaa2[_0xc008('0x46')][_0xc008('0x49')]));_0x2a9b5c[_0xc008('0x48')]=_0x2a9b5c[_0xc008('0x48')][_0xc008('0x4a')]?_0x2a9b5c[_0xc008('0x48')]:_0x200469[_0xc008('0x45')];if(!_0x5caaa2[_0xc008('0x46')]['hasOwnProperty']('nolimit')){_0x2a9b5c[_0xc008('0x22')]=qs['limit'](_0x5caaa2[_0xc008('0x46')][_0xc008('0x22')]);_0x2a9b5c[_0xc008('0x20')]=qs['offset'](_0x5caaa2[_0xc008('0x46')][_0xc008('0x20')]);}_0x2a9b5c[_0xc008('0x4b')]=qs[_0xc008('0x4c')](_0x5caaa2[_0xc008('0x46')]['sort']);_0x2a9b5c[_0xc008('0x4d')]=qs[_0xc008('0x4e')](_['pick'](_0x5caaa2[_0xc008('0x46')],_0x200469[_0xc008('0x4e')]),_0x347629);var _0x5b5fbf=[];var _0x51d3dc=squel[_0xc008('0x4f')]()[_0xc008('0x50')]('id')[_0xc008('0x50')](_0xc008('0x2a'))[_0xc008('0x50')]('color')['from'](_0xc008('0x51'));var _0x5d815d=squel[_0xc008('0x4f')]()[_0xc008('0x50')](_0xc008('0x52'))[_0xc008('0x50')](_0xc008('0x53'))[_0xc008('0x50')]('ui.ChatInteractionId')[_0xc008('0x54')](_0xc008('0x55'),'ui')[_0xc008('0x56')](_0xc008('0x57'),'u',_0xc008('0x58'));var _0x5aa385=squel[_0xc008('0x4f')]()['from']('chat_interactions','i')['left_join'](_0xc008('0x59'),'c',_0xc008('0x5a'))[_0xc008('0x56')]('users','o',_0xc008('0x5b'))[_0xc008('0x56')](_0xc008('0x5c'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0xc008('0x56')](_0xc008('0x5d'),'me',_0xc008('0x5e'))[_0xc008('0x56')]('chat_interaction_has_tags','it',_0xc008('0x5f'))['left_join'](_0xc008('0x51'),'t',_0xc008('0x60'));var _0x2ae14e=squel[_0xc008('0x61')]();var _0x192c87=[];var _0x4752f6=squel['expr']();var _0x375e71;if(_0x5caaa2['query']['search']){_0x375e71=as[_0xc008('0x62')](_0x5caaa2[_0xc008('0x46')]['search']);var _0xb1befa=_0x375e71[_0xc008('0x63')];for(var _0x3e373e=0x0;_0x3e373e<_0x375e71[_0xc008('0x64')][_0xc008('0x4a')];_0x3e373e++){var _0x31a339=_0x375e71[_0xc008('0x64')][_0x3e373e];var _0x57ce9a='i';var _0x16e052=_[_0xc008('0x65')](_0x347629,[_0xc008('0x2a'),_0x31a339[_0xc008('0x50')]]);if(!_0x16e052){switch(_0x31a339[_0xc008('0x50')]){case _0xc008('0x66'):if(_0x31a339[_0xc008('0x67')]==0x1){_0x5aa385[_0xc008('0x68')]('`'+_0x31a339[_0xc008('0x50')]+_0xc008('0x69'));}else{_0x5aa385[_0xc008('0x68')]('`'+_0x31a339[_0xc008('0x50')]+_0xc008('0x6a'));}break;case _0xc008('0x6b'):if(_0x31a339['operator']===_0xc008('0x6c')){if(_0x31a339[_0xc008('0x67')][_0xc008('0x6d')]('\x20')['length']>0x1){_0x2ae14e[_0xb1befa](_0xc008('0x6e'),qs[_0xc008('0x6f')](_0x31a339['value']),null);}else{var _0x53765c='%'+_0x31a339[_0xc008('0x67')]+'%';_0x2ae14e[_0xb1befa](_0xc008('0x70'),_0x53765c,_0x53765c,_0x53765c);}}else{_0x16e052=_[_0xc008('0x65')](_0x347629,[_0xc008('0x2a'),_0xc008('0x71')]);_0x31a339[_0xc008('0x50')]=_0xc008('0x71');_0x5a94ff=as[_0xc008('0x72')](_0x57ce9a,_0x16e052[_0xc008('0x43')],_0x31a339);_0x2ae14e[_0xb1befa](_0x5a94ff[_0xc008('0x73')],_0x5a94ff[_0xc008('0x67')]['start'],_0x5a94ff[_0xc008('0x67')][_0xc008('0x27')]);}break;case _0xc008('0x74'):var _0x27dc80=_0x31a339['value'][_0xc008('0x6d')](',')['map'](function(_0x3a1de5){return Number(_0x3a1de5);});_0x27dc80[_0xc008('0x75')](function(_0x419257){_0x4752f6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x419257+',%');});_0x192c87=_[_0xc008('0x76')](_0x192c87,_0x27dc80);break;case _0xc008('0x77'):if(_0x31a339[_0xc008('0x78')]==='$substring'){_0x2ae14e[_0xb1befa](_0xc008('0x79'),'%'+_0x31a339['value']+'%',null);}else{_0x16e052=_[_0xc008('0x65')](_0x347629,[_0xc008('0x2a'),_0xc008('0x3d')]);_0x31a339[_0xc008('0x50')]=_0xc008('0x3d');_0x5a94ff=as['buildExpression'](_0x57ce9a,_0x16e052[_0xc008('0x43')],_0x31a339);_0x2ae14e[_0xb1befa](_0x5a94ff[_0xc008('0x73')],_0x5a94ff['value'][_0xc008('0x7a')],_0x5a94ff['value'][_0xc008('0x27')]);}break;case'body':_0x5a94ff=as[_0xc008('0x72')]('me',null,_0x31a339);_0x2ae14e[_0xb1befa](_0x5a94ff['text'],_0x5a94ff[_0xc008('0x67')][_0xc008('0x7a')],_0x5a94ff[_0xc008('0x67')][_0xc008('0x27')]);break;}}else{var _0x5a94ff=as[_0xc008('0x72')](_0x57ce9a,_0x16e052[_0xc008('0x43')],_0x31a339);_0x2ae14e[_0xb1befa](_0x5a94ff[_0xc008('0x73')],_0x5a94ff[_0xc008('0x67')][_0xc008('0x7a')],_0x5a94ff[_0xc008('0x67')][_0xc008('0x27')]);}}}else{var _0x3b46e4=_(_0x5caaa2['query'])[_0xc008('0x47')]()['map'](function(_0x511477){return _['some'](_0x347629,[_0xc008('0x2a'),_0x511477])?_0x511477:undefined;})[_0xc008('0x7b')]()[_0xc008('0x67')]();if(!_[_0xc008('0x7c')](_0x3b46e4)){_0x3b46e4[_0xc008('0x75')](function(_0x2e9646){if(_0x2e9646===_0xc008('0x7d')){_0x5aa385[_0xc008('0x4d')](_0xc008('0x7e'),[]['concat'](_0x5caaa2[_0xc008('0x46')][_0x2e9646]));}else if(_0x2e9646===_0xc008('0x7f')){var _0x2b1b26=JSON[_0xc008('0x80')](_0x5caaa2[_0xc008('0x46')][_0x2e9646])[_0xc008('0x81')];var _0x23d4ff=JSON[_0xc008('0x80')](_0x5caaa2[_0xc008('0x46')][_0x2e9646])[_0xc008('0x82')];_0x5aa385[_0xc008('0x4d')](_0xc008('0x83'),_0x2b1b26,_0x23d4ff);}else{if(_0x5caaa2['query'][_0x2e9646]==='null'){_0x5aa385[_0xc008('0x4d')]('i.'+_0x2e9646+_0xc008('0x84'));}else{_0x5aa385[_0xc008('0x4d')]('i.'+_0x2e9646+'\x20=\x20?',_0x5caaa2[_0xc008('0x46')][_0x2e9646]);}}});}if(_0x5caaa2[_0xc008('0x46')]['read']){if(_0x5caaa2['query']['read']==0x1){_0x5aa385[_0xc008('0x68')](_0xc008('0x85'));}else{_0x5aa385[_0xc008('0x68')](_0xc008('0x86'));}}if(_0x5caaa2[_0xc008('0x46')][_0xc008('0x87')]){_0x192c87=_[_0xc008('0x88')](_0x5caaa2[_0xc008('0x46')][_0xc008('0x87')])?_0x5caaa2[_0xc008('0x46')]['tag']:new Array(_0x5caaa2['query'][_0xc008('0x87')]);_0x192c87[_0xc008('0x75')](function(_0x3f3dcf){_0x4752f6['or'](_0xc008('0x89'),'%,'+_0x3f3dcf+',%');});}if(_0x5caaa2[_0xc008('0x46')][_0xc008('0x8a')]){var _0x4b434f=_0x5caaa2['query'][_0xc008('0x8a')][_0xc008('0x8b')]('\x5c','\x5c\x5c')[_0xc008('0x8b')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4b434f)){_0x2ae14e['or']('i.id\x20LIKE\x20?',_0x4b434f+'%');}else{_0x2ae14e['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4b434f))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x4b434f+'%');}}}_0x5aa385['where'](_0x2ae14e);_0x5aa385[_0xc008('0x8c')]('i.id');var _0x10abd6={'type':db['Sequelize'][_0xc008('0x8d')][_0xc008('0x8e')],'raw':!![]};var _0x903f67=_0x5aa385['clone']();_0x903f67['field'](_0xc008('0x8f'));_0x903f67['field'](_0xc008('0x90'),_0xc008('0x66'));if(_0x2a9b5c['order']){_0x2a9b5c[_0xc008('0x4b')]['forEach'](function(_0x554cf4){var _0x23bece=_0x554cf4[0x0]===_0xc008('0x91')?_0x554cf4[0x0]:'i.'+_0x554cf4[0x0];_0x5aa385['order'](_0x23bece,_0x554cf4[0x1]===_0xc008('0x92')?![]:!![]);});}if(!_[_0xc008('0x7c')](_0x192c87)){_0x5aa385[_0xc008('0x68')](_0x4752f6);_0x903f67['where'](_0xc008('0x93'),_0x192c87);}BPromise[_0xc008('0x94')]()[_0xc008('0x16')](function(){if(!_0x375e71){if(_0x5caaa2[_0xc008('0x46')][_0xc008('0x7d')])return;_0x903f67[_0xc008('0x4d')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x5aa385[_0xc008('0x4d')](_0xc008('0x95'));return;}if(_0x5caaa2[_0xc008('0x96')]['role']!==_0xc008('0x97'))return;return _0x5caaa2[_0xc008('0x96')][_0xc008('0x98')]({'attributes':['id'],'raw':!![]})['then'](function(_0x48c38b){if(_['isEmpty'](_0x48c38b)){_0x903f67[_0xc008('0x4d')](_0xc008('0x99'));_0x5aa385[_0xc008('0x4d')](_0xc008('0x99'));}else{_0x903f67[_0xc008('0x4d')](_0xc008('0x7e'),_[_0xc008('0x41')](_0x48c38b,'id'));_0x5aa385[_0xc008('0x4d')]('i.ChatWebsiteId\x20IN\x20?',_[_0xc008('0x41')](_0x48c38b,'id'));}});})[_0xc008('0x16')](function(){if(_0x5caaa2['user']['role']===_0xc008('0x97')&&!_0x375e71&&!_0x5caaa2[_0xc008('0x46')][_0xc008('0x7d')])return[];return db[_0xc008('0x9a')][_0xc008('0x46')](_0x903f67['toString'](),_0x10abd6);})[_0xc008('0x16')](function(_0x1515bb){_0x44fc5d['count']=_0x1515bb[_0xc008('0x4a')];if(_0x44fc5d[_0xc008('0x23')]===0x0)return[];return db[_0xc008('0x9a')][_0xc008('0x46')](_0x51d3dc['toString'](),_0x10abd6)[_0xc008('0x16')](function(_0x2d42e0){_0x5b5fbf=_[_0xc008('0x9b')](_0x2d42e0,'id');_0x10abd6=_[_0xc008('0x2d')](_0x10abd6,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5caaa2[_0xc008('0x46')][_0xc008('0x49')]){_0x2a9b5c['attributes']['forEach'](function(_0x1c9bda){_0x5aa385['field']('i.'+_0x1c9bda);});}else{_0x5aa385[_0xc008('0x50')](_0xc008('0x90'),'unreadMessages');_0x5aa385[_0xc008('0x50')](_0xc008('0x9c'),_0xc008('0x9d'));_0x5aa385[_0xc008('0x50')](_0xc008('0x9e'),_0xc008('0x9f'));_0x5aa385[_0xc008('0x50')](_0xc008('0xa0'),_0xc008('0x91'));_0x5aa385[_0xc008('0x50')]('i.*');_0x5aa385['field'](_0xc008('0xa1'),_0xc008('0xa2'));_0x5aa385['field'](_0xc008('0xa3'),_0xc008('0xa4'));_0x5aa385[_0xc008('0x50')]('c.email',_0xc008('0xa5'));_0x5aa385[_0xc008('0x50')](_0xc008('0xa6'),_0xc008('0xa7'));_0x5aa385[_0xc008('0x50')](_0xc008('0xa8'),_0xc008('0xa9'));_0x5aa385['field'](_0xc008('0xaa'),'Contact.fax');_0x5aa385[_0xc008('0x50')](_0xc008('0xab'),_0xc008('0xac'));_0x5aa385['field'](_0xc008('0xad'),_0xc008('0xae'));_0x5aa385[_0xc008('0x50')](_0xc008('0xaf'),_0xc008('0x34'));}if(_0x2a9b5c[_0xc008('0x22')])_0x5aa385[_0xc008('0x22')](_0x2a9b5c[_0xc008('0x22')]);if(_0x2a9b5c[_0xc008('0x20')])_0x5aa385[_0xc008('0x20')](_0x2a9b5c['offset']);return db[_0xc008('0x9a')][_0xc008('0x46')](_0x5aa385[_0xc008('0xb0')](),_0x10abd6);})[_0xc008('0x16')](function(_0x43dc6c){if(_0x43dc6c['length']>0x0)_0x5d815d[_0xc008('0x4d')](_0xc008('0xb1'),_[_0xc008('0x41')](_0x43dc6c,'id'));return db[_0xc008('0x9a')][_0xc008('0x46')](_0x5d815d[_0xc008('0xb0')](),_0x10abd6)[_0xc008('0x16')](function(_0x220170){var _0x2cc170=_[_0xc008('0xb2')](_0x220170,_0xc008('0xb3'));var _0x27e3fc=[];_0x43dc6c[_0xc008('0x75')](function(_0x1094bf){_0x27e3fc[_0xc008('0x36')](updateChatInteraction(_0x1094bf,_0x5b5fbf,_0x2cc170));});return BPromise['all'](_0x27e3fc);});});})['then'](function(_0xa53d53){_0x44fc5d[_0xc008('0xb4')]=_0xa53d53;return _0x44fc5d;})[_0xc008('0x16')](respondWithFilteredResult(_0x1cec64,_0x2a9b5c))[_0xc008('0xb5')](handleError(_0x1cec64,null));};exports[_0xc008('0xb6')]=function(_0xcf64a4,_0x3ca43b){var _0x3eb3de={'raw':![],'where':{'id':_0xcf64a4['params']['id']}},_0x265a04={};_0x265a04[_0xc008('0x45')]=_[_0xc008('0x47')](db['ChatInteraction'][_0xc008('0xb7')]);_0x265a04[_0xc008('0x46')]=_[_0xc008('0x47')](_0xcf64a4[_0xc008('0x46')]);_0x265a04[_0xc008('0x4e')]=_[_0xc008('0xb8')](_0x265a04['model'],_0x265a04[_0xc008('0x46')]);_0x3eb3de[_0xc008('0x48')]=_[_0xc008('0xb8')](_0x265a04[_0xc008('0x45')],qs['fields'](_0xcf64a4[_0xc008('0x46')]['fields']));_0x3eb3de[_0xc008('0x48')]=_0x3eb3de[_0xc008('0x48')]['length']?_0x3eb3de[_0xc008('0x48')]:_0x265a04['model'];if(_0xcf64a4[_0xc008('0x46')]['includeAll']){_0x3eb3de['include']=[{'all':!![]}];}_0x3eb3de=_['merge']({},_0x3eb3de,_0xcf64a4[_0xc008('0xb9')]);return db[_0xc008('0xba')]['find'](_0x3eb3de)[_0xc008('0x16')](handleEntityNotFound(_0x3ca43b,null))[_0xc008('0x16')](respondWithResult(_0x3ca43b,null))['catch'](handleError(_0x3ca43b,null));};exports[_0xc008('0xbb')]=function(_0x13cc0b,_0x1564a9){return db['ChatInteraction'][_0xc008('0xbb')](_0x13cc0b[_0xc008('0x2e')],{})[_0xc008('0x16')](respondWithResult(_0x1564a9,0xc9))[_0xc008('0xb5')](handleError(_0x1564a9,null));};exports[_0xc008('0xbc')]=function(_0x9b6108,_0x2d87ff){if(_0x9b6108[_0xc008('0x2e')]['id']){delete _0x9b6108[_0xc008('0x2e')]['id'];}return db[_0xc008('0xba')][_0xc008('0x65')]({'where':{'id':_0x9b6108['params']['id']}})[_0xc008('0x16')](handleEntityNotFound(_0x2d87ff,null))[_0xc008('0x16')](saveUpdates(_0x9b6108[_0xc008('0x2e')],null))['then'](respondWithResult(_0x2d87ff,null))[_0xc008('0xb5')](handleError(_0x2d87ff,null));};exports[_0xc008('0x26')]=function(_0x3f6018,_0x5bd03e){return db[_0xc008('0xba')]['find']({'where':{'id':_0x3f6018[_0xc008('0xbd')]['id']}})[_0xc008('0x16')](handleEntityNotFound(_0x5bd03e,null))[_0xc008('0x16')](removeEntity(_0x5bd03e,null))['catch'](handleError(_0x5bd03e,null));};exports[_0xc008('0xbe')]=function(_0x11cbc7,_0x11617a){return db[_0xc008('0xba')][_0xc008('0xbe')]()[_0xc008('0x16')](respondWithResult(_0x11617a,null))[_0xc008('0xb5')](handleError(_0x11617a,null));};exports['createVidaooSession']=function(_0x209ae3,_0x28de8a){var _0x17db9a=_0x209ae3[_0xc008('0xbd')]['id'];var _0x5a61d6;var _0x46fba5;var _0x500559;return db[_0xc008('0xba')][_0xc008('0xbf')]({'where':{'id':_0x17db9a}})[_0xc008('0x16')](function(_0x14ae16){_0x5a61d6=_0x14ae16;return db[_0xc008('0xc0')][_0xc008('0xbf')]({'where':{'id':_0x14ae16[_0xc008('0x7d')]},'attributes':['id','vidaooApiKey',_0xc008('0xc1'),_0xc008('0xc2'),_0xc008('0xc3'),_0xc008('0xc4')],'raw':!![]});})['then'](function(_0x16b41d){if(_0x16b41d&&_0x16b41d['vidaooApiKey']&&_0x16b41d[_0xc008('0xc1')]){_0x46fba5=_0x16b41d;var _0x3b2e99={'interaction':{'id':_0x17db9a},'agent':{'id':_0x209ae3[_0xc008('0x96')]['id'],'name':_0x209ae3['user']['name'],'fullname':_0x209ae3[_0xc008('0x96')]['fullname'],'email':_0x209ae3[_0xc008('0x96')][_0xc008('0xc5')]},'contact':_0x209ae3[_0xc008('0x2e')][_0xc008('0x2f')],'account':_0x209ae3['body'][_0xc008('0x31')]};var _0x1aac21={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x16b41d[_0xc008('0xc6')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x209ae3[_0xc008('0x96')]['email']],'buttons':null,'topic':_0x46fba5[_0xc008('0xc2')],'note':_[_0xc008('0xc7')](_0x46fba5[_0xc008('0xc3')])?null:getMustacheRender(_0x46fba5[_0xc008('0xc3')],_0x3b2e99),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xc008('0xc7')](_0x46fba5[_0xc008('0xc4')])){var _0xc344a7=getMustacheRender(_0x46fba5[_0xc008('0xc4')],_0x3b2e99);var _0x78b833=JSON[_0xc008('0x80')](_0xc344a7);_0x1aac21[_0xc008('0x2e')][_0xc008('0xc8')]=_0x78b833;}}catch(_0x2f0e45){throw new db[(_0xc008('0xc9'))][(_0xc008('0xca'))](_0xc008('0xcb'));}return rp(_0x1aac21);}else{throw new db[(_0xc008('0xc9'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0xc008('0x16')](function(_0x4465f9){_0x500559=_0x4465f9;if(_0x500559['id']){var _0x28f448={'body':_0x500559[_0xc008('0xcc')],'ChatWebsiteId':_0x46fba5['id'],'ChatInteractionId':_0x5a61d6['id'],'direction':_0xc008('0xcd'),'UserId':_0x209ae3[_0xc008('0x96')]['id']};return db[_0xc008('0xce')]['create'](_0x28f448,{});}else{throw new db['Sequelize'][(_0xc008('0xca'))](_0xc008('0xcf'));}})[_0xc008('0x16')](function(){return _0x5a61d6['updateAttributes']({'vidaooSessionId':_0x500559['id']});})[_0xc008('0x16')](respondWithResult(_0x28de8a,null))[_0xc008('0xb5')](handleError(_0x28de8a,null));};exports[_0xc008('0xd0')]=function(_0x40a737,_0x156ec3){if(_0x40a737[_0xc008('0x2e')]['id']){delete _0x40a737[_0xc008('0x2e')]['id'];}return db[_0xc008('0xba')][_0xc008('0x65')]({'where':{'id':_0x40a737[_0xc008('0xbd')]['id']},'include':[{'model':db[_0xc008('0xd1')],'as':_0xc008('0x6b')}]})['then'](handleEntityNotFound(_0x156ec3,null))['then'](saveUpdates(_0x40a737[_0xc008('0x2e')],null))[_0xc008('0x16')](respondWithResult(_0x156ec3,null))['catch'](handleError(_0x156ec3,null));};exports[_0xc008('0xd2')]=function(_0x1d44fa,_0x20e0b0){if(_0x1d44fa[_0xc008('0x2e')]['id']){delete _0x1d44fa[_0xc008('0x2e')]['id'];}return db[_0xc008('0xba')][_0xc008('0x65')]({'where':{'id':_0x1d44fa[_0xc008('0xbd')]['id']}})[_0xc008('0x16')](function(_0x48d2d7){if(!_0x48d2d7){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xc008('0xd2'),0x194,'entity\x20not\x20found');_0x20e0b0[_0xc008('0x28')](0x194);}else{if(_0x48d2d7[_0xc008('0x3d')]){throw new db[(_0xc008('0xc9'))][(_0xc008('0xca'))](_0xc008('0xd3'));}}return _0x48d2d7;})[_0xc008('0x16')](function(_0x293fc5){if(_0x293fc5){return _0x293fc5[_0xc008('0xbc')]({'closed':_0x1d44fa[_0xc008('0x2e')][_0xc008('0x3c')],'disposition':_0x1d44fa[_0xc008('0x2e')][_0xc008('0x3f')]})[_0xc008('0x16')](function(_0x304083){return _0x304083;});}})[_0xc008('0x16')](function(){return respondWithRpcPromise(_0xc008('0xd4'),_0xc008('0xd2'),_0x1d44fa['body'],client9004);})[_0xc008('0x16')](respondWithResult(_0x20e0b0,null))['catch'](handleError(_0x20e0b0,null));};exports[_0xc008('0xd5')]=function(_0x176dc8,_0x31d06c){_0x176dc8['body'][_0xc008('0x2a')]=_0x176dc8[_0xc008('0xd6')][_0xc008('0xd7')];_0x176dc8[_0xc008('0x2e')][_0xc008('0xd8')]=_0x176dc8[_0xc008('0xd6')][_0xc008('0xd9')];_0x176dc8['body'][_0xc008('0x43')]=_0x176dc8[_0xc008('0xd6')][_0xc008('0xda')];return db[_0xc008('0xdb')]['create'](_0x176dc8['body'])['then'](respondWithResult(_0x31d06c,0xc9))['catch'](handleError(_0x31d06c,null));};exports[_0xc008('0xdc')]=function(_0x1b9158,_0xfa6008){return db[_0xc008('0xba')]['findOne']({'where':{'id':_0x1b9158[_0xc008('0xbd')]['id']},'raw':!![]})[_0xc008('0x16')](handleEntityNotFound(_0xfa6008,null))[_0xc008('0x16')](function(_0x567bfc){if(_0x567bfc){if(_0x567bfc[_0xc008('0x3c')]){return _0xfa6008['status'](0x193)[_0xc008('0x1f')]({'status':0x193,'message':'Unauthorized'});}return db[_0xc008('0xdb')][_0xc008('0xbf')]({'where':{'id':_0x1b9158[_0xc008('0x46')][_0xc008('0xdd')]},'raw':!![]})['then'](handleEntityNotFound(_0xfa6008,null));}})[_0xc008('0x16')](function(_0x19dcb7){if(_0x19dcb7){var _0x30f35b=_0x19dcb7[_0xc008('0xde')]!==null;var _0x1d89f1=path[_0xc008('0xdf')](config[_0xc008('0xe0')],'server/files/attachments/');if(_0x30f35b){_0x1d89f1=path[_0xc008('0xdf')](_0x1d89f1,_0xc008('0xe1'));}var _0x322587=path['join'](_0x1d89f1,_0x19dcb7['basename']);return _0xfa6008[_0xc008('0xe2')](_0x322587);}})[_0xc008('0xb5')](handleError(_0xfa6008,null));};exports[_0xc008('0xe3')]=function(_0x21cacf,_0x590541){var _0xc45c61=null;var _0x22b653=null;var _0x566e83=null;if(_0x21cacf['body']['id']){delete _0x21cacf['body']['id'];}if(_0x21cacf[_0xc008('0x2e')]['mailTranscript']){_0x566e83=path[_0xc008('0xdf')](config['root'],_0xc008('0xe4'),util[_0xc008('0xe5')](_0xc008('0xe6'),Date[_0xc008('0xe7')]()));_0x21cacf['body']['pathTranscript']=_0x566e83;}return db[_0xc008('0xba')][_0xc008('0x65')]({'where':{'id':_0x21cacf[_0xc008('0xbd')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xc008('0xe8'),'include':[{'model':db[_0xc008('0x77')],'as':_0xc008('0x77')}]}]})[_0xc008('0x16')](handleEntityNotFound(_0x590541,null))[_0xc008('0x16')](saveUpdates(_0x21cacf[_0xc008('0x2e')],null))[_0xc008('0x16')](function(_0x2087b3){if(_0x2087b3){_0xc45c61=_0x2087b3;return db[_0xc008('0xc0')][_0xc008('0x65')]({'where':{'id':_0xc45c61[_0xc008('0x7d')]}});}})['then'](function(_0x5ea13a){if(_0x5ea13a){_0x22b653=_0x5ea13a;return db[_0xc008('0xd1')]['find']({'where':{'id':_0xc45c61[_0xc008('0x71')]}});}})[_0xc008('0x16')](function(_0x4a7268){if(_0x4a7268){if(_0x566e83){var _0x487c0d=null;for(var _0x41099a=0x1;_0x41099a<_0xc45c61[_0xc008('0xe8')][_0xc008('0x4a')];++_0x41099a){_0x487c0d=_0xc45c61[_0xc008('0xe8')][_0x41099a];var _0x3e0b78=_0x487c0d[_0xc008('0x3d')]?util['format'](_0xc008('0xe9'),_0x22b653[_0xc008('0xea')],_0x487c0d[_0xc008('0x3d')]):'System';var _0x21a898=_0x21cacf[_0xc008('0x2e')][_0xc008('0xeb')]||util[_0xc008('0xe5')]('%s%d','Visitor',_0x487c0d[_0xc008('0x71')]);switch(_0x22b653['agentIdentifier']){case _0xc008('0xec'):_0x3e0b78=_0x487c0d[_0xc008('0x3d')]?util[_0xc008('0xe5')](_0xc008('0xe9'),_0x22b653[_0xc008('0xea')],_0x487c0d['UserId']):'System';break;case _0xc008('0xed'):_0x3e0b78=_0x487c0d[_0xc008('0x3d')]?_0x487c0d[_0xc008('0x77')][_0xc008('0xee')]||_0x487c0d[_0xc008('0x77')][_0xc008('0x33')]:_0xc008('0xef');break;case'agent_fullname':_0x3e0b78=_0x487c0d[_0xc008('0x3d')]?_0x487c0d[_0xc008('0x77')][_0xc008('0x33')]:_0xc008('0xef');break;default:_0x3e0b78=_0x487c0d[_0xc008('0x3d')]?util[_0xc008('0xe5')](_0xc008('0xe9'),_0x22b653[_0xc008('0xea')],_0x487c0d[_0xc008('0x3d')]):_0xc008('0xef');}var _0x3e8d3d=util[_0xc008('0xe5')]('[%s]\x20%s:\x20%s\x0a',moment(_0x487c0d[_0xc008('0x7f')])[_0xc008('0xe5')]('MM/DD/YYYY\x20HH:mm:ss'),_0x487c0d[_0xc008('0xf0')]==='in'?_0x21a898:_0x3e0b78,_0x487c0d[_0xc008('0x2e')]);if(!_0x487c0d[_0xc008('0xf1')]){fs[_0xc008('0xf2')](_0x566e83,_0x3e8d3d);}}return db[_0xc008('0xf3')][_0xc008('0xbf')]({'where':{'service':!![]},'include':[{'model':db[_0xc008('0xf4')],'as':_0xc008('0xf5'),'raw':!![],'include':[{'model':db[_0xc008('0xf6')],'as':_0xc008('0xf6'),'raw':!![]}]}]});}}})[_0xc008('0x16')](function(_0x487055){if(!_0x487055||!_0x487055[_0xc008('0xf5')]||!_0x21cacf[_0xc008('0x2e')])return _0xc45c61;var _0x8067ed=_0x487055[_0xc008('0xf7')]();return respondWithRpcPromise(_0xc008('0xf8'),_0xc008('0xf9'),{'account':_0x8067ed,'message':{'from':util[_0xc008('0xe5')](_0xc008('0xfa'),_0x487055[_0xc008('0x2a')],_0x487055[_0xc008('0xc5')]||_0x487055[_0xc008('0xf5')][_0xc008('0x96')]),'to':_0x21cacf[_0xc008('0x2e')][_0xc008('0xfb')],'subject':_0xc008('0xfc'),'text':util[_0xc008('0xe5')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x21cacf['body']['mailTranscript']),'attachments':[{'path':_0x566e83}]}})[_0xc008('0x16')](function(){return _0xc45c61;})[_0xc008('0xb5')](function(_0x3f80f4){logger[_0xc008('0x1b')](_0x3f80f4);});})[_0xc008('0x16')](respondWithStatusCode(_0x590541,0xc8))[_0xc008('0xb5')](handleError(_0x590541,null));};exports[_0xc008('0xfd')]=function(_0x47bc33,_0x3e7099){return db['ChatMessage']['find']({'where':{'id':_0x47bc33[_0xc008('0xbd')]['id']}})[_0xc008('0x16')](handleEntityNotFound(_0x3e7099,null))['then'](function(_0x43521e){if(_0x43521e){return _0x43521e[_0xc008('0xfd')](_0x47bc33[_0xc008('0x2e')]['ids'],_[_0xc008('0xfe')](_0x47bc33[_0xc008('0x2e')],[_0xc008('0xff'),'id'])||{});}})['then'](respondWithResult(_0x3e7099,null))[_0xc008('0xb5')](handleError(_0x3e7099,null));};exports[_0xc008('0x100')]=function(_0x3b1ab3,_0x304522){var _0x45e0c0={'raw':![],'where':{}};var _0xdf0607={};var _0x873b09={'count':0x0,'rows':[]};return db[_0xc008('0xba')]['findOne']({'where':{'id':_0x3b1ab3[_0xc008('0xbd')]['id']}})[_0xc008('0x16')](handleEntityNotFound(_0x304522,null))[_0xc008('0x16')](function(_0x1b5f8c){if(_0x1b5f8c){_0xdf0607[_0xc008('0x45')]=_['keys'](db[_0xc008('0xce')][_0xc008('0xb7')]);_0xdf0607[_0xc008('0x46')]=_[_0xc008('0x47')](_0x3b1ab3[_0xc008('0x46')]);_0xdf0607[_0xc008('0x4e')]=_[_0xc008('0xb8')](_0xdf0607[_0xc008('0x45')],_0xdf0607['query']);_0x45e0c0[_0xc008('0x48')]=_[_0xc008('0xb8')](_0xdf0607[_0xc008('0x45')],qs[_0xc008('0x49')](_0x3b1ab3['query']['fields']));_0x45e0c0[_0xc008('0x48')]=_0x45e0c0[_0xc008('0x48')]['length']?_0x45e0c0[_0xc008('0x48')]:_0xdf0607[_0xc008('0x45')];if(!_0x3b1ab3[_0xc008('0x46')][_0xc008('0x101')](_0xc008('0x102'))){_0x45e0c0[_0xc008('0x22')]=qs[_0xc008('0x22')](_0x3b1ab3['query']['limit']);_0x45e0c0[_0xc008('0x20')]=qs['offset'](_0x3b1ab3[_0xc008('0x46')][_0xc008('0x20')]);}_0x45e0c0[_0xc008('0x4b')]=qs[_0xc008('0x4c')](_0x3b1ab3[_0xc008('0x46')][_0xc008('0x4c')]);_0x45e0c0[_0xc008('0x4d')]=qs[_0xc008('0x4e')](_[_0xc008('0x103')](_0x3b1ab3[_0xc008('0x46')],_0xdf0607[_0xc008('0x4e')]));_0x45e0c0['where'][_0xc008('0xb3')]=_0x1b5f8c['id'];if(_0x3b1ab3[_0xc008('0x46')][_0xc008('0x8a')]){_0x45e0c0[_0xc008('0x4d')]=_[_0xc008('0x2d')](_0x45e0c0[_0xc008('0x4d')],{'$or':_[_0xc008('0x41')](_0x45e0c0['attributes'],function(_0x43065b){var _0x36c97d={};_0x36c97d[_0x43065b]={'$like':'%'+_0x3b1ab3[_0xc008('0x46')]['filter']+'%'};return _0x36c97d;})});}if(_0x3b1ab3[_0xc008('0x46')][_0xc008('0x81')]){var _0x41b8c4=_0x3b1ab3[_0xc008('0x46')][_0xc008('0x81')][_0xc008('0x6d')](',');var _0x556e58={};_0x556e58[_0x41b8c4[0x0]]={'$gte':moment(_0x41b8c4[0x1])['format'](_0xc008('0x104'))};_0x45e0c0[_0xc008('0x4d')]=_[_0xc008('0x2d')](_0x45e0c0[_0xc008('0x4d')],_0x556e58);}_0x45e0c0=_[_0xc008('0x2d')]({},_0x45e0c0,_0x3b1ab3['options']);return db[_0xc008('0xce')]['count']({'where':_0x45e0c0[_0xc008('0x4d')]})[_0xc008('0x16')](function(_0x59df96){_0x873b09[_0xc008('0x23')]=_0x59df96;if(_0x3b1ab3[_0xc008('0x46')][_0xc008('0x105')]){_0x45e0c0[_0xc008('0x106')]=[{'all':!![]}];}return db['ChatMessage'][_0xc008('0x107')](_0x45e0c0);})[_0xc008('0x16')](function(_0x174d2d){_0x873b09[_0xc008('0xb4')]=_0x174d2d;return _0x873b09;});}})[_0xc008('0x16')](respondWithFilteredResult(_0x304522,_0x45e0c0))['catch'](handleError(_0x304522,null));};exports[_0xc008('0x108')]=function(_0x3383bb,_0x204748){var _0x4ca3fa={'where':{}},_0x43f96e={},_0x353cd5={'count':0x0,'rows':[]};return db[_0xc008('0xba')][_0xc008('0xbf')]({'where':{'id':_0x3383bb['params']['id']}})[_0xc008('0x16')](handleEntityNotFound(_0x204748,null))[_0xc008('0x16')](function(_0x74ccbe){if(_0x74ccbe){_0x43f96e[_0xc008('0x45')]=_[_0xc008('0x47')](db['ChatMessage'][_0xc008('0xb7')]);_0x43f96e['query']=_['keys'](_0x3383bb[_0xc008('0x46')]);_0x43f96e['filters']=_[_0xc008('0xb8')](_0x43f96e[_0xc008('0x45')],_0x43f96e[_0xc008('0x46')]);_0x4ca3fa[_0xc008('0x48')]=_[_0xc008('0xb8')](_0x43f96e[_0xc008('0x45')],qs[_0xc008('0x49')](_0x3383bb['query'][_0xc008('0x49')]));_0x4ca3fa[_0xc008('0x48')]=_0x4ca3fa[_0xc008('0x48')][_0xc008('0x4a')]?_0x4ca3fa[_0xc008('0x48')]:_0x43f96e[_0xc008('0x45')];if(!_0x3383bb['query'][_0xc008('0x101')](_0xc008('0x102'))){_0x4ca3fa[_0xc008('0x22')]=qs[_0xc008('0x22')](_0x3383bb[_0xc008('0x46')][_0xc008('0x22')]);_0x4ca3fa[_0xc008('0x20')]=qs[_0xc008('0x20')](_0x3383bb['query']['offset']);}_0x4ca3fa[_0xc008('0x4b')]=qs[_0xc008('0x4c')](_0x3383bb['query'][_0xc008('0x4c')]);_0x4ca3fa['where']=qs[_0xc008('0x4e')](_[_0xc008('0x103')](_0x3383bb[_0xc008('0x46')],_0x43f96e[_0xc008('0x4e')]));_0x4ca3fa[_0xc008('0x4d')][_0xc008('0xb3')]=_0x74ccbe['id'];if(_0x3383bb[_0xc008('0x46')]['filter']){_0x4ca3fa[_0xc008('0x4d')]=_['merge'](_0x4ca3fa[_0xc008('0x4d')],{'$or':_[_0xc008('0x41')](_0x4ca3fa[_0xc008('0x48')],function(_0x41afa8){var _0x206f8a={};_0x206f8a[_0x41afa8]={'$like':'%'+_0x3383bb[_0xc008('0x46')][_0xc008('0x8a')]+'%'};return _0x206f8a;})});}_0x4ca3fa['where'][_0xc008('0xf1')]=![];if(_0x3383bb[_0xc008('0x46')]['id']){_0x4ca3fa['where']['id']={'$gt':_0x3383bb[_0xc008('0x46')]['id']};}_0x4ca3fa=_[_0xc008('0x2d')]({},_0x4ca3fa,_0x3383bb[_0xc008('0xb9')]);return db[_0xc008('0xce')][_0xc008('0x23')]({'where':_0x4ca3fa[_0xc008('0x4d')]})['then'](function(_0xe87804){_0x353cd5[_0xc008('0x23')]=_0xe87804;_0x4ca3fa[_0xc008('0x106')]=[];if(_0x3383bb[_0xc008('0x46')]['includeAgent']){_0x4ca3fa['include']['push']({'model':db[_0xc008('0x77')],'as':_0xc008('0x77'),'attributes':['id','fullname','alias']});}if(_0x3383bb['query']['includeAll']){_0x4ca3fa[_0xc008('0x106')]=[{'all':!![]}];}return db[_0xc008('0xce')]['findAll'](_0x4ca3fa);})[_0xc008('0x16')](function(_0x431a5d){_0x353cd5[_0xc008('0xb4')]=_0x431a5d;return _0x353cd5;});}})[_0xc008('0x16')](respondWithFilteredResult(_0x204748,_0x4ca3fa))[_0xc008('0xb5')](handleError(_0x204748,null));};exports['addTags']=function(_0x5cd30d,_0x197cfd){return db[_0xc008('0xba')][_0xc008('0x65')]({'where':{'id':_0x5cd30d[_0xc008('0xbd')]['id']}})[_0xc008('0x16')](handleEntityNotFound(_0x197cfd,null))[_0xc008('0x16')](function(_0x2c4a8b){if(_0x2c4a8b){return _0x2c4a8b['setTags'](_0x5cd30d[_0xc008('0x2e')][_0xc008('0xff')],_[_0xc008('0xfe')](_0x5cd30d[_0xc008('0x2e')],[_0xc008('0xff'),'id'])||{})[_0xc008('0x109')](function(){return db[_0xc008('0x74')]['findAll']({'attributes':['id','name',_0xc008('0x10a')],'where':{'id':_0x5cd30d[_0xc008('0x2e')][_0xc008('0xff')]}});})[_0xc008('0x16')](function(_0x28b578){socket[_0xc008('0x10b')](_0xc008('0x10c'),{'id':Number(_0x5cd30d[_0xc008('0xbd')]['id']),'tags':_0x28b578||[]});return{'id':Number(_0x5cd30d[_0xc008('0xbd')]['id']),'tags':_0x28b578||[]};});}})[_0xc008('0x16')](respondWithResult(_0x197cfd,null))[_0xc008('0xb5')](handleError(_0x197cfd,null));};exports[_0xc008('0x10d')]=function(_0x37e1f2,_0x5161f3){return db['ChatInteraction'][_0xc008('0x65')]({'where':{'id':_0x37e1f2[_0xc008('0xbd')]['id']}})[_0xc008('0x16')](handleEntityNotFound(_0x5161f3,null))[_0xc008('0x16')](function(_0x25c7dd){if(_0x25c7dd){return _0x25c7dd[_0xc008('0x10d')](_0x37e1f2[_0xc008('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x5161f3,null))['catch'](handleError(_0x5161f3,null));};exports[_0xc008('0xe2')]=function(_0x4b7132,_0x4dd095){var _0x4b37c6=moment()[_0xc008('0x10e')]()[_0xc008('0xb0')]();var _0x8a1e6a=path[_0xc008('0xdf')](config[_0xc008('0xe0')],_0xc008('0x10f'),_0xc008('0x110'),_0xc008('0x111'));var _0x28b8e5=path[_0xc008('0xdf')](config[_0xc008('0xe0')],_0xc008('0x10f'),'files','attachments');var _0x44cb9=path[_0xc008('0xdf')](_0x8a1e6a,_0x4b37c6);var _0xc55c88=util[_0xc008('0xe5')](_0xc008('0x112'),_0x4b7132[_0xc008('0xbd')]['id'],_0x4b37c6);var _0xcdba52=path[_0xc008('0xdf')](_0x8a1e6a,_0xc55c88);var _0x5adeeb=[];_0x5adeeb[_0xc008('0x36')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x5adeeb['push']({'model':db[_0xc008('0xd1')],'as':'Contact','attributes':['id',_0xc008('0x113'),_0xc008('0x114')],'raw':!![]});if(_0x4b7132[_0xc008('0x46')]['attachments']){_0x5adeeb['push']({'model':db[_0xc008('0xdb')],'as':_0xc008('0xdb'),'raw':!![]});}var _0x5e1141=[{'model':db[_0xc008('0xce')],'as':_0xc008('0xe8'),'attributes':['id',_0xc008('0x2e'),_0xc008('0x7f'),_0xc008('0xf0'),_0xc008('0xf1'),_0xc008('0x115')],'include':_0x5adeeb}];_0x5e1141[_0xc008('0x36')]({'model':db[_0xc008('0xc0')],'as':_0xc008('0x116'),'attributes':['id','name']});_0x5e1141[_0xc008('0x36')]({'model':db[_0xc008('0x77')],'as':'Owner','attributes':['id','fullname']});return db[_0xc008('0xba')][_0xc008('0x65')]({'where':{'id':_0x4b7132[_0xc008('0xbd')]['id']},'include':_0x5e1141})['then'](handleEntityNotFound(_0x4dd095,null))['then'](function(_0x58ae00){if(_0x58ae00){var _0x4ffe17=_0x58ae00[_0xc008('0x117')]({'plain':!![]});fs[_0xc008('0x118')](_0x44cb9);var _0xbf133d={'channel':_0xc008('0x119'),'account':_0x4ffe17[_0xc008('0x116')][_0xc008('0x2a')],'agent':_0x4ffe17[_0xc008('0x11a')]?_0x4ffe17['Owner'][_0xc008('0x33')]:_0xc008('0x11b'),'createdAt':moment(_0x4ffe17[_0xc008('0x7f')])[_0xc008('0xe5')](_0xc008('0x104'))['toString'](),'closedAt':_0x4ffe17[_0xc008('0x3c')]?moment(_0x4ffe17[_0xc008('0x11c')])['format'](_0xc008('0x104'))[_0xc008('0xb0')]():'','disposition':_0x4ffe17[_0xc008('0x3f')],'chatInfo':{'browser':_0x4ffe17[_0xc008('0x11d')],'os':_0x4ffe17['osName'],'referer':_0x4ffe17[_0xc008('0x11e')],'customerIp':_0x4ffe17['customerIp'],'customerPort':_0x4ffe17[_0xc008('0x11f')]?_0x4ffe17[_0xc008('0x11f')]:_0xc008('0x11b')},'messages':_(_0x4ffe17[_0xc008('0xe8')])[_0xc008('0x120')]()['filter']({'secret':![]})[_0xc008('0x41')](function(_0x168e28){if(_0x168e28[_0xc008('0xdb')]){var _0xa167a=path['join'](_0x28b8e5,_0x168e28[_0xc008('0xdb')]['basename']);if(fs['existsSync'](_0xa167a)){fs[_0xc008('0x121')](_0xa167a)[_0xc008('0x122')](fs[_0xc008('0x123')](path['join'](_0x44cb9,_0x168e28[_0xc008('0xdb')][_0xc008('0xd8')])));}}return{'date':moment(_0x168e28['createdAt'])[_0xc008('0xe5')](_0xc008('0x104'))['toString'](),'sender':_0x168e28['direction']===_0xc008('0xcd')?_0x168e28['User']?_0x168e28['User'][_0xc008('0x33')]:'System':_0x168e28[_0xc008('0x6b')][_0xc008('0x113')]+(_0x168e28[_0xc008('0x6b')][_0xc008('0x114')]?'\x20'+_0x168e28[_0xc008('0x6b')]['lastName']:''),'body':_0x168e28['Attachment']?_0x168e28[_0xc008('0xdb')]['basename']:_0x168e28[_0xc008('0x2e')],'direction':_0x168e28['direction']==='out'?'A':'C','secret':_0x168e28['secret'],'read':_0x168e28[_0xc008('0x115')],'attachment':_0x168e28['Attachment']};})[_0xc008('0x67')]()};return ejs[_0xc008('0x124')](path['join'](config['root'],_0xc008('0x10f'),_0xc008('0x125'),_0xc008('0x126')),{'interaction':_0xbf133d})[_0xc008('0x16')](function(_0x4e2707){var _0x54536d=path[_0xc008('0xdf')](_0x44cb9,'transcript-'+_0x4ffe17['id']+'-'+_0x4b37c6+'.pdf');var _0x103a1a={'path':_0x54536d,'channel':_0xc008('0x119'),'interactionId':_0x4ffe17['id']};return pdf['createPdfFromHTML'](_0x4e2707,_0x103a1a);})['then'](function(){return new Promise(function(_0x5a8519,_0x23d4db){zipdir(_0x44cb9,{'saveTo':_0xcdba52},function(_0x4ec916,_0x2dc83c){if(_0x4ec916)return _0x23d4db(_0x4ec916);return _0x5a8519(_0x2dc83c);});})[_0xc008('0x16')](function(){return new BPromise(function(_0x1a1460,_0x17c403){rimraf(_0x44cb9,function(_0x1007b2){if(_0x1007b2)_0x17c403(_0x1007b2);return _0x1a1460();});});})['then'](function(){return _0x4dd095['download'](_0xcdba52,_0xc55c88,function(_0x1fa509){if(_0x1fa509){logger[_0xc008('0x1b')](_0xc008('0x127'),_0x1fa509);}else{fs[_0xc008('0x128')](_0xcdba52);}});});});}else{return _0x4dd095[_0xc008('0x28')](0xc8);}})[_0xc008('0xb5')](handleError(_0x4dd095,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 5f91d15..ad4ed6b 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 _0xded3=['hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','getUsers','setDataValue','Users','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x337570,_0xdd86bc){var _0x27b1fb=function(_0x567d79){while(--_0x567d79){_0x337570['push'](_0x337570['shift']());}};_0x27b1fb(++_0xdd86bc);}(_0xded3,0xf0));var _0x3ded=function(_0xf50fb9,_0x1a0fc9){_0xf50fb9=_0xf50fb9-0x0;var _0x2d287e=_0xded3[_0xf50fb9];return _0x2d287e;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x3ded('0x0'))['db']['ChatInteraction'];var ChatMessage=require(_0x3ded('0x0'))['db'][_0x3ded('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x3ded('0x2')](0x0);var events={'afterCreate':_0x3ded('0x3'),'afterUpdate':_0x3ded('0x4'),'afterDestroy':'remove'};function emitEvent(_0xf7f122){return function(_0x135f93,_0x419f33,_0xb1da24){_0x135f93[_0x3ded('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x14628d){_0x135f93[_0x3ded('0x6')](_0x3ded('0x7'),_0x14628d['map'](function(_0x29d06e){return{'id':_0x29d06e['id']};}));return ChatMessage[_0x3ded('0x8')]({'where':{'ChatInteractionId':_0x135f93['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3ded('0x9')](function(_0x5682b9){_0x135f93['setDataValue'](_0x3ded('0xa'),_0x5682b9[_0x3ded('0xb')]);ChatInteractionEvents['emit'](_0xf7f122+':'+_0x135f93['id'],_0x135f93);ChatInteractionEvents[_0x3ded('0xc')](_0xf7f122,_0x135f93);_0xb1da24(null);})[_0x3ded('0xd')](_0xb1da24(null));};}for(var e in events){if(events[_0x3ded('0xe')](e)){var event=events[e];ChatInteraction[_0x3ded('0xf')](e,emitEvent(event));}}module[_0x3ded('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xc6f9=['events','../../mysqldb','ChatInteraction','setMaxListeners','save','update','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x5383f1,_0x327fb3){var _0xa23930=function(_0x35d9f6){while(--_0x35d9f6){_0x5383f1['push'](_0x5383f1['shift']());}};_0xa23930(++_0x327fb3);}(_0xc6f9,0x168));var _0x9c6f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc6f9[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x9c6f('0x0'));var ChatInteraction=require(_0x9c6f('0x1'))['db'][_0x9c6f('0x2')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x9c6f('0x3')](0x0);var events={'afterCreate':_0x9c6f('0x4'),'afterUpdate':_0x9c6f('0x5'),'afterDestroy':_0x9c6f('0x6')};function emitEvent(_0x5af456){return function(_0x33fc1a,_0x2346f4,_0x133dd1){_0x33fc1a['getUsers']({'attributes':['id'],'raw':!![]})[_0x9c6f('0x7')](function(_0x1168d5){_0x33fc1a[_0x9c6f('0x8')]('Users',_0x1168d5[_0x9c6f('0x9')](function(_0x2f95cc){return{'id':_0x2f95cc['id']};}));return ChatMessage[_0x9c6f('0xa')]({'where':{'ChatInteractionId':_0x33fc1a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9c6f('0x7')](function(_0x46b14d){_0x33fc1a[_0x9c6f('0x8')](_0x9c6f('0xb'),_0x46b14d[_0x9c6f('0xc')]);ChatInteractionEvents['emit'](_0x5af456+':'+_0x33fc1a['id'],_0x33fc1a);ChatInteractionEvents[_0x9c6f('0xd')](_0x5af456,_0x33fc1a);_0x133dd1(null);})[_0x9c6f('0xe')](_0x133dd1(null));};}for(var e in events){if(events[_0x9c6f('0xf')](e)){var event=events[e];ChatInteraction[_0x9c6f('0x10')](e,emitEvent(event));}}module[_0x9c6f('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 24cde18..159e340 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 _0x06dc=['../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x2558bc,_0x2170de){var _0x5dadc2=function(_0x39edba){while(--_0x39edba){_0x2558bc['push'](_0x2558bc['shift']());}};_0x5dadc2(++_0x2170de);}(_0x06dc,0x160));var _0xc06d=function(_0x1a9e78,_0x180720){_0x1a9e78=_0x1a9e78-0x0;var _0x113e06=_0x06dc[_0x1a9e78];return _0x113e06;};'use strict';var _=require(_0xc06d('0x0'));var util=require(_0xc06d('0x1'));var logger=require(_0xc06d('0x2'))(_0xc06d('0x3'));var moment=require(_0xc06d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc06d('0x5'));var attributes=require(_0xc06d('0x6'));module['exports']=function(_0x42790f,_0x2aef59){return _0x42790f[_0xc06d('0x7')](_0xc06d('0x8'),attributes,{'tableName':_0xc06d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x204cdf,_0x198203,_0x353f4e){if(_0x204cdf[_0xc06d('0xa')](_0xc06d('0xb'))){_0x204cdf[_0xc06d('0xc')]=moment()[_0xc06d('0xd')](_0xc06d('0xe'));}_0x353f4e(null,_0x204cdf);}},'charset':_0xc06d('0xf'),'collate':_0xc06d('0x10')});}; \ No newline at end of file +var _0x6307=['path','rimraf','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x6307,0x1d6));var _0x7630=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0x6307[_0x4914e2];return _0x2dcd07;};'use strict';var _=require(_0x7630('0x0'));var util=require(_0x7630('0x1'));var logger=require(_0x7630('0x2'))(_0x7630('0x3'));var moment=require(_0x7630('0x4'));var BPromise=require('bluebird');var rp=require(_0x7630('0x5'));var fs=require('fs');var path=require(_0x7630('0x6'));var rimraf=require(_0x7630('0x7'));var config=require(_0x7630('0x8'));var attributes=require(_0x7630('0x9'));module[_0x7630('0xa')]=function(_0x57722e,_0x2004e2){return _0x57722e['define'](_0x7630('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ef5ee,_0x1bfdf0,_0x5ba98c){if(_0x4ef5ee['changed'](_0x7630('0xc'))){_0x4ef5ee[_0x7630('0xd')]=moment()[_0x7630('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5ba98c(null,_0x4ef5ee);}},'charset':_0x7630('0xf'),'collate':_0x7630('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 4e0262b..d7ca5ca 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 _0x36af=['code','message','result','catch','UpdateChatInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToChatInteraction','ChatInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x36af,0xf1));var _0xf36a=function(_0x176152,_0x557fc0){_0x176152=_0x176152-0x0;var _0x3aec6a=_0x36af[_0x176152];return _0x3aec6a;};'use strict';var _=require(_0xf36a('0x0'));var util=require(_0xf36a('0x1'));var moment=require('moment');var BPromise=require(_0xf36a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf36a('0x3'));var db=require(_0xf36a('0x4'))['db'];var utils=require(_0xf36a('0x5'));var logger=require(_0xf36a('0x6'))(_0xf36a('0x7'));var config=require(_0xf36a('0x8'));var jayson=require(_0xf36a('0x9'));var client=jayson['client'][_0xf36a('0xa')]({'port':0x232a});config['redis']=_[_0xf36a('0xb')](config[_0xf36a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf36a('0xd'))(new Redis(config['redis']));require(_0xf36a('0xe'))[_0xf36a('0xf')](socket);function respondWithRpcPromise(_0x98b7df,_0x4c1b28,_0x377756){return new BPromise(function(_0x3e3514,_0x4cc9b1){return client[_0xf36a('0x10')](_0x98b7df,_0x377756)[_0xf36a('0x11')](function(_0x440bb1){logger[_0xf36a('0x12')](_0xf36a('0x13'),_0x4c1b28,'request\x20sent');logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x4c1b28,_0xf36a('0x14'),JSON[_0xf36a('0x15')](_0x440bb1));if(_0x440bb1[_0xf36a('0x16')]){if(_0x440bb1[_0xf36a('0x16')][_0xf36a('0x17')]===0x1f4){logger[_0xf36a('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x4c1b28,_0x440bb1[_0xf36a('0x16')][_0xf36a('0x18')]);return _0x4cc9b1(_0x440bb1[_0xf36a('0x16')]['message']);}logger[_0xf36a('0x16')](_0xf36a('0x13'),_0x4c1b28,_0x440bb1[_0xf36a('0x16')][_0xf36a('0x18')]);return _0x3e3514(_0x440bb1[_0xf36a('0x16')][_0xf36a('0x18')]);}else{logger[_0xf36a('0x12')](_0xf36a('0x13'),_0x4c1b28,'request\x20sent');_0x3e3514(_0x440bb1[_0xf36a('0x19')][_0xf36a('0x18')]);}})[_0xf36a('0x1a')](function(_0x1f31a6){logger[_0xf36a('0x16')](_0xf36a('0x13'),_0x4c1b28,_0x1f31a6);_0x4cc9b1(_0x1f31a6);});});}exports[_0xf36a('0x1b')]=function(_0x16436c){var _0x3e5f46=this;return new Promise(function(_0x4a1482,_0xb70f6c){return db['ChatInteraction'][_0xf36a('0x1c')](_0x16436c[_0xf36a('0x1d')],{'raw':_0x16436c[_0xf36a('0x1e')]?_0x16436c[_0xf36a('0x1e')][_0xf36a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16436c['options']?_0x16436c[_0xf36a('0x1e')][_0xf36a('0x20')]||null:null,'attributes':_0x16436c[_0xf36a('0x1e')]?_0x16436c['options'][_0xf36a('0x21')]||null:null,'limit':_0x16436c[_0xf36a('0x1e')]?_0x16436c[_0xf36a('0x1e')][_0xf36a('0x22')]||null:null})[_0xf36a('0x11')](function(_0x44ff3d){logger[_0xf36a('0x12')](_0xf36a('0x1b'),_0x16436c);logger[_0xf36a('0x23')](_0xf36a('0x1b'),_0x16436c,JSON[_0xf36a('0x15')](_0x44ff3d));_0x4a1482(_0x44ff3d);})['catch'](function(_0x2546b0){logger['error']('UpdateChatInteraction',_0x2546b0['message'],_0x16436c);_0xb70f6c(_0x3e5f46['error'](0x1f4,_0x2546b0[_0xf36a('0x18')]));});});};exports[_0xf36a('0x24')]=function(_0x24e735){return new Promise(function(_0x1c14f3,_0xaefbce){return db[_0xf36a('0x25')][_0xf36a('0x26')]({'where':_0x24e735[_0xf36a('0x1e')]?_0x24e735[_0xf36a('0x1e')][_0xf36a('0x20')]||null:null})[_0xf36a('0x11')](function(_0x560360){if(_0x560360){return _0x560360[_0xf36a('0x27')](_0x24e735[_0xf36a('0x1d')]['ids'],_[_0xf36a('0x28')](_0x24e735['body'],[_0xf36a('0x29'),'id'])||{});}})[_0xf36a('0x2a')](function(_0x487887){logger[_0xf36a('0x12')]('AddTags',_0x24e735);logger[_0xf36a('0x23')](_0xf36a('0x2b'),_0x24e735,JSON[_0xf36a('0x15')](_0x487887));_0x1c14f3(_0x487887);})['catch'](function(_0x10ac96){logger[_0xf36a('0x16')]('AddTags',_0x10ac96['message'],_0x24e735);_0xaefbce(_this['error'](0x1f4,_0x10ac96['message']));});});}; \ No newline at end of file +var _0x6659=['update','options','where','attributes','limit','then','UpdateChatInteraction','catch','AddTagsToChatInteraction','find','addTags','body','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatInteraction'];(function(_0x501cf3,_0x2f84e5){var _0x289b68=function(_0x91bf5a){while(--_0x91bf5a){_0x501cf3['push'](_0x501cf3['shift']());}};_0x289b68(++_0x2f84e5);}(_0x6659,0x1a9));var _0x9665=function(_0x7f41b9,_0x51ded8){_0x7f41b9=_0x7f41b9-0x0;var _0x396543=_0x6659[_0x7f41b9];return _0x396543;};'use strict';var _=require(_0x9665('0x0'));var util=require('util');var moment=require(_0x9665('0x1'));var BPromise=require(_0x9665('0x2'));var rs=require(_0x9665('0x3'));var fs=require('fs');var Redis=require(_0x9665('0x4'));var db=require(_0x9665('0x5'))['db'];var utils=require(_0x9665('0x6'));var logger=require(_0x9665('0x7'))('rpc');var config=require(_0x9665('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9665('0x9')]['http']({'port':0x232a});config[_0x9665('0xa')]=_['defaults'](config[_0x9665('0xa')],{'host':_0x9665('0xb'),'port':0x18eb});var socket=require(_0x9665('0xc'))(new Redis(config['redis']));require(_0x9665('0xd'))[_0x9665('0xe')](socket);function respondWithRpcPromise(_0x1f8876,_0x2f3b63,_0x3fee99){return new BPromise(function(_0x41940d,_0x393671){return client[_0x9665('0xf')](_0x1f8876,_0x3fee99)['then'](function(_0xff4159){logger[_0x9665('0x10')](_0x9665('0x11'),_0x2f3b63,'request\x20sent');logger[_0x9665('0x12')](_0x9665('0x13'),_0x2f3b63,_0x9665('0x14'),JSON[_0x9665('0x15')](_0xff4159));if(_0xff4159[_0x9665('0x16')]){if(_0xff4159[_0x9665('0x16')][_0x9665('0x17')]===0x1f4){logger[_0x9665('0x16')](_0x9665('0x11'),_0x2f3b63,_0xff4159['error'][_0x9665('0x18')]);return _0x393671(_0xff4159[_0x9665('0x16')][_0x9665('0x18')]);}logger[_0x9665('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x2f3b63,_0xff4159[_0x9665('0x16')][_0x9665('0x18')]);return _0x41940d(_0xff4159['error']['message']);}else{logger[_0x9665('0x10')](_0x9665('0x11'),_0x2f3b63,_0x9665('0x14'));_0x41940d(_0xff4159['result'][_0x9665('0x18')]);}})['catch'](function(_0x21f826){logger[_0x9665('0x16')](_0x9665('0x11'),_0x2f3b63,_0x21f826);_0x393671(_0x21f826);});});}exports['UpdateChatInteraction']=function(_0x8f282b){var _0x461327=this;return new Promise(function(_0x490255,_0x7a3e1c){return db[_0x9665('0x19')][_0x9665('0x1a')](_0x8f282b['body'],{'raw':_0x8f282b[_0x9665('0x1b')]?_0x8f282b[_0x9665('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8f282b[_0x9665('0x1b')]?_0x8f282b[_0x9665('0x1b')][_0x9665('0x1c')]||null:null,'attributes':_0x8f282b[_0x9665('0x1b')]?_0x8f282b[_0x9665('0x1b')][_0x9665('0x1d')]||null:null,'limit':_0x8f282b[_0x9665('0x1b')]?_0x8f282b['options'][_0x9665('0x1e')]||null:null})[_0x9665('0x1f')](function(_0x3bb0b8){logger['info'](_0x9665('0x20'),_0x8f282b);logger[_0x9665('0x12')](_0x9665('0x20'),_0x8f282b,JSON['stringify'](_0x3bb0b8));_0x490255(_0x3bb0b8);})[_0x9665('0x21')](function(_0x235e50){logger[_0x9665('0x16')](_0x9665('0x20'),_0x235e50[_0x9665('0x18')],_0x8f282b);_0x7a3e1c(_0x461327[_0x9665('0x16')](0x1f4,_0x235e50[_0x9665('0x18')]));});});};exports[_0x9665('0x22')]=function(_0x42c7c0){return new Promise(function(_0x2b45eb,_0x486b1f){return db[_0x9665('0x19')][_0x9665('0x23')]({'where':_0x42c7c0['options']?_0x42c7c0[_0x9665('0x1b')][_0x9665('0x1c')]||null:null})['then'](function(_0x1244f4){if(_0x1244f4){return _0x1244f4[_0x9665('0x24')](_0x42c7c0[_0x9665('0x25')][_0x9665('0x26')],_[_0x9665('0x27')](_0x42c7c0['body'],[_0x9665('0x26'),'id'])||{});}})['spread'](function(_0x213742){logger[_0x9665('0x10')](_0x9665('0x28'),_0x42c7c0);logger[_0x9665('0x12')](_0x9665('0x28'),_0x42c7c0,JSON[_0x9665('0x15')](_0x213742));_0x2b45eb(_0x213742);})[_0x9665('0x21')](function(_0x406a4b){logger['error'](_0x9665('0x28'),_0x406a4b[_0x9665('0x18')],_0x42c7c0);_0x486b1f(_this[_0x9665('0x16')](0x1f4,_0x406a4b[_0x9665('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index ec29f19..a19c26b 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 _0x842d=['./chatInteraction.events','save','update','emit','removeListener','register','chatInteraction:'];(function(_0x11262,_0x2063f7){var _0x4a78c8=function(_0x445991){while(--_0x445991){_0x11262['push'](_0x11262['shift']());}};_0x4a78c8(++_0x2063f7);}(_0x842d,0x103));var _0xd842=function(_0x15f236,_0x59a12b){_0x15f236=_0x15f236-0x0;var _0x3645c0=_0x842d[_0x15f236];return _0x3645c0;};'use strict';var ChatInteractionEvents=require(_0xd842('0x0'));var events=[_0xd842('0x1'),'remove',_0xd842('0x2')];function createListener(_0x4e7163,_0x2fcd05){return function(_0x3e2108){_0x2fcd05[_0xd842('0x3')](_0x4e7163,_0x3e2108);};}function removeListener(_0x45c89a,_0x4eaff2){return function(){ChatInteractionEvents[_0xd842('0x4')](_0x45c89a,_0x4eaff2);};}exports[_0xd842('0x5')]=function(_0x17b1be){for(var _0x1ad572=0x0,_0x523c66=events['length'];_0x1ad572<_0x523c66;_0x1ad572++){var _0x357c99=events[_0x1ad572];var _0x36b10e=createListener(_0xd842('0x6')+_0x357c99,_0x17b1be);ChatInteractionEvents['on'](_0x357c99,_0x36b10e);}}; \ No newline at end of file +var _0x03d2=['save','remove','emit','removeListener','chatInteraction:','./chatInteraction.events'];(function(_0x1f68dd,_0x40414e){var _0x5b72c9=function(_0x57ed35){while(--_0x57ed35){_0x1f68dd['push'](_0x1f68dd['shift']());}};_0x5b72c9(++_0x40414e);}(_0x03d2,0xe3));var _0x203d=function(_0x58b510,_0x54fc0c){_0x58b510=_0x58b510-0x0;var _0x4dc398=_0x03d2[_0x58b510];return _0x4dc398;};'use strict';var ChatInteractionEvents=require(_0x203d('0x0'));var events=[_0x203d('0x1'),_0x203d('0x2'),'update'];function createListener(_0x5a9370,_0x34a8da){return function(_0xabb8ba){_0x34a8da[_0x203d('0x3')](_0x5a9370,_0xabb8ba);};}function removeListener(_0x4a11bb,_0x47a184){return function(){ChatInteractionEvents[_0x203d('0x4')](_0x4a11bb,_0x47a184);};}exports['register']=function(_0x4ec6fc){for(var _0x369b8b=0x0,_0x211ce1=events['length'];_0x369b8b<_0x211ce1;_0x369b8b++){var _0x4fce71=events[_0x369b8b];var _0x4da3c8=createListener(_0x203d('0x5')+_0x4fce71,_0x4ec6fc);ChatInteractionEvents['on'](_0x4fce71,_0x4da3c8);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 6753560..2f0d61b 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 _0x2091=['addTags','put','/:id','tracked','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMyMessages','/:id/download','download','post','create','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','now','originalname','replace','attachmentUpload','chat','chatinteraction:addtags'];(function(_0x1bd85d,_0xdc683f){var _0xd40669=function(_0x318648){while(--_0x318648){_0x1bd85d['push'](_0x1bd85d['shift']());}};_0xd40669(++_0xdc683f);}(_0x2091,0xfa));var _0x1209=function(_0x252ecd,_0x2c4da5){_0x252ecd=_0x252ecd-0x0;var _0x193b57=_0x2091[_0x252ecd];return _0x193b57;};'use strict';var multer=require(_0x1209('0x0'));var util=require(_0x1209('0x1'));var path=require('path');var timeout=require(_0x1209('0x2'));var express=require(_0x1209('0x3'));var router=express['Router']();var fs_extra=require(_0x1209('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1209('0x5'));var config=require(_0x1209('0x6'));var controller=require('./chatInteraction.controller');router[_0x1209('0x7')]('/',auth[_0x1209('0x8')](),controller['index']);router[_0x1209('0x7')](_0x1209('0x9'),auth[_0x1209('0x8')](),controller[_0x1209('0xa')]);router[_0x1209('0x7')]('/:id',auth[_0x1209('0xb')](),controller[_0x1209('0xc')]);router[_0x1209('0x7')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0x1209('0xd')]);router[_0x1209('0x7')](_0x1209('0xe'),auth[_0x1209('0x8')](),controller['getMessages']);router[_0x1209('0x7')]('/:id/my_messages',auth[_0x1209('0xb')](),controller[_0x1209('0xf')]);router[_0x1209('0x7')](_0x1209('0x10'),auth[_0x1209('0x8')](),controller[_0x1209('0x11')]);router[_0x1209('0x12')]('/',auth['isAuthenticated'](),controller[_0x1209('0x13')]);router[_0x1209('0x12')]('/:id/vidaoo',auth[_0x1209('0x8')](),controller[_0x1209('0x14')]);var upload=multer({'storage':multer[_0x1209('0x15')]({'destination':function(_0x464589,_0x5055b1,_0x3357af){_0x3357af(null,path[_0x1209('0x16')](config[_0x1209('0x17')],_0x1209('0x18')));},'filename':function(_0x5b8b05,_0x3fa31a,_0x4b5fdf){_0x4b5fdf(null,util[_0x1209('0x19')]('%s-%s',Date[_0x1209('0x1a')](),_0x3fa31a[_0x1209('0x1b')][_0x1209('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload['single']('file'),controller[_0x1209('0x1d')]);router[_0x1209('0x12')]('/:id/messages',auth[_0x1209('0xb')](),controller['addMessage']);router[_0x1209('0x12')]('/:id/tags',auth[_0x1209('0x8')](),interaction['tracked'](_0x1209('0x1e'),_0x1209('0x1f')),controller[_0x1209('0x20')]);router[_0x1209('0x21')](_0x1209('0x22'),auth[_0x1209('0x8')](),interaction[_0x1209('0x23')](_0x1209('0x1e'),_0x1209('0x24')),controller['update']);router[_0x1209('0x21')](_0x1209('0x25'),controller[_0x1209('0x26')]);router[_0x1209('0x21')](_0x1209('0x27'),auth[_0x1209('0xb')](),controller[_0x1209('0x28')]);router['put'](_0x1209('0x29'),controller[_0x1209('0x2a')]);router[_0x1209('0x2b')](_0x1209('0x22'),auth[_0x1209('0x8')](),interaction['tracked'](_0x1209('0x1e'),_0x1209('0x2c')),controller[_0x1209('0x2d')]);router['delete'](_0x1209('0x2e'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x7d99=['../../components/auth/service','get','index','/describe','describe','show','/:id/attachment_download','isChatInteractionAuthorized','isAuthenticated','/:id/my_messages','getMyMessages','download','create','post','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','/:id/attachment_upload','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','/:id','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x2cedfc,_0x33e3ee){var _0x2a596c=function(_0x1a24e0){while(--_0x1a24e0){_0x2cedfc['push'](_0x2cedfc['shift']());}};_0x2a596c(++_0x33e3ee);}(_0x7d99,0x1c6));var _0x97d9=function(_0x17ccc8,_0x5e79ed){_0x17ccc8=_0x17ccc8-0x0;var _0x23609b=_0x7d99[_0x17ccc8];return _0x23609b;};'use strict';var multer=require('multer');var util=require(_0x97d9('0x0'));var path=require(_0x97d9('0x1'));var timeout=require(_0x97d9('0x2'));var express=require(_0x97d9('0x3'));var router=express['Router']();var fs_extra=require(_0x97d9('0x4'));var auth=require(_0x97d9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0x97d9('0x6')]('/',auth['isAuthenticated'](),controller[_0x97d9('0x7')]);router[_0x97d9('0x6')](_0x97d9('0x8'),auth['isAuthenticated'](),controller[_0x97d9('0x9')]);router['get']('/:id',auth['isChatInteractionAuthorized'](),controller[_0x97d9('0xa')]);router['get'](_0x97d9('0xb'),auth[_0x97d9('0xc')](),controller['attachmentDownload']);router[_0x97d9('0x6')]('/:id/messages',auth[_0x97d9('0xd')](),controller['getMessages']);router[_0x97d9('0x6')](_0x97d9('0xe'),auth[_0x97d9('0xc')](),controller[_0x97d9('0xf')]);router[_0x97d9('0x6')]('/:id/download',auth[_0x97d9('0xd')](),controller[_0x97d9('0x10')]);router['post']('/',auth[_0x97d9('0xd')](),controller[_0x97d9('0x11')]);router[_0x97d9('0x12')]('/:id/vidaoo',auth[_0x97d9('0xd')](),controller[_0x97d9('0x13')]);var upload=multer({'storage':multer[_0x97d9('0x14')]({'destination':function(_0x173d1c,_0x2f345a,_0x46cc25){_0x46cc25(null,path[_0x97d9('0x15')](config[_0x97d9('0x16')],_0x97d9('0x17')));},'filename':function(_0xeb8859,_0xdb0c60,_0x2cb062){_0x2cb062(null,util['format'](_0x97d9('0x18'),Date[_0x97d9('0x19')](),_0xdb0c60['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x97d9('0x12')](_0x97d9('0x1a'),upload['single'](_0x97d9('0x1b')),controller[_0x97d9('0x1c')]);router[_0x97d9('0x12')](_0x97d9('0x1d'),auth['isChatInteractionAuthorized'](),controller[_0x97d9('0x1e')]);router[_0x97d9('0x12')](_0x97d9('0x1f'),auth['isAuthenticated'](),interaction['tracked'](_0x97d9('0x20'),_0x97d9('0x21')),controller[_0x97d9('0x22')]);router[_0x97d9('0x23')](_0x97d9('0x24'),auth[_0x97d9('0xd')](),interaction[_0x97d9('0x25')](_0x97d9('0x20'),_0x97d9('0x26')),controller[_0x97d9('0x27')]);router[_0x97d9('0x23')](_0x97d9('0x28'),controller[_0x97d9('0x29')]);router[_0x97d9('0x23')](_0x97d9('0x2a'),auth[_0x97d9('0xc')](),controller[_0x97d9('0x2b')]);router[_0x97d9('0x23')](_0x97d9('0x2c'),controller[_0x97d9('0x2d')]);router[_0x97d9('0x2e')](_0x97d9('0x24'),auth['isAuthenticated'](),interaction['tracked'](_0x97d9('0x20'),_0x97d9('0x2f')),controller[_0x97d9('0x30')]);router['delete'](_0x97d9('0x1f'),auth[_0x97d9('0xd')](),controller[_0x97d9('0x31')]);module[_0x97d9('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 227c0f9..2a1ca1b 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 _0x9ef7=['exports','TEXT','medium','INTEGER','sequelize'];(function(_0x27d106,_0x1226fb){var _0x3f10c7=function(_0x129b68){while(--_0x129b68){_0x27d106['push'](_0x27d106['shift']());}};_0x3f10c7(++_0x1226fb);}(_0x9ef7,0x112));var _0x79ef=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x9ef7[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0x79ef('0x0'));module[_0x79ef('0x1')]={'body':{'type':Sequelize[_0x79ef('0x2')](_0x79ef('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x79ef('0x4')]}}; \ No newline at end of file +var _0xdd75=['BOOLEAN','sequelize','exports','TEXT','medium'];(function(_0x4a36dc,_0x907029){var _0x311c01=function(_0x4ac7d2){while(--_0x4ac7d2){_0x4a36dc['push'](_0x4a36dc['shift']());}};_0x311c01(++_0x907029);}(_0xdd75,0x169));var _0x5dd7=function(_0x40e1ed,_0x297e89){_0x40e1ed=_0x40e1ed-0x0;var _0x220ddd=_0xdd75[_0x40e1ed];return _0x220ddd;};'use strict';var Sequelize=require(_0x5dd7('0x0'));module[_0x5dd7('0x1')]={'body':{'type':Sequelize[_0x5dd7('0x2')](_0x5dd7('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5dd7('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 4de7fdb..220d4ab 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 _0x77c3=['where','merge','VIRTUAL','options','includeAll','include','catch','show','intersection','find','create','params','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','UserProfileResource','findAll','isEmpty','resourceId','push','FromId','ToId','read','all','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','sendStatus','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77c3,0x9e));var _0x377c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77c3[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x377c('0x0'));var rimraf=require(_0x377c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x377c('0x2'));var rp=require(_0x377c('0x3'));var moment=require(_0x377c('0x4'));var BPromise=require(_0x377c('0x5'));var Mustache=require(_0x377c('0x6'));var util=require(_0x377c('0x7'));var path=require(_0x377c('0x8'));var sox=require('sox');var csv=require(_0x377c('0x9'));var ejs=require(_0x377c('0xa'));var fs=require('fs');var fs_extra=require(_0x377c('0xb'));var _=require('lodash');var squel=require(_0x377c('0xc'));var crypto=require(_0x377c('0xd'));var jsforce=require(_0x377c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x377c('0x9'));var querystring=require(_0x377c('0xf'));var Papa=require('papaparse');var Redis=require(_0x377c('0x10'));var authService=require(_0x377c('0x11'));var qs=require(_0x377c('0x12'));var as=require(_0x377c('0x13'));var hardwareService=require(_0x377c('0x14'));var logger=require('../../config/logger')(_0x377c('0x15'));var utils=require(_0x377c('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x377c('0x17'))['db'];config[_0x377c('0x18')]=_[_0x377c('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x377c('0x1a'))(new Redis(config[_0x377c('0x18')]));require(_0x377c('0x1b'))[_0x377c('0x1c')](socket);function respondWithStatusCode(_0x3b8e1d,_0x152d7f){_0x152d7f=_0x152d7f||0xcc;return function(_0x203696){if(_0x203696){return _0x3b8e1d['sendStatus'](_0x152d7f);}return _0x3b8e1d[_0x377c('0x1d')](_0x152d7f)[_0x377c('0x1e')]();};}function respondWithResult(_0x5125e6,_0x12068b){_0x12068b=_0x12068b||0xc8;return function(_0x5a81b9){if(_0x5a81b9){return _0x5125e6[_0x377c('0x1d')](_0x12068b)[_0x377c('0x1f')](_0x5a81b9);}};}function respondWithFilteredResult(_0x1d3d3,_0x3e22a5){return function(_0x32e20d){if(_0x32e20d){var _0x4869d4=typeof _0x3e22a5['offset']===_0x377c('0x20')&&typeof _0x3e22a5[_0x377c('0x21')]===_0x377c('0x20');var _0x56f232=_0x32e20d[_0x377c('0x22')];var _0x2bb6e4=_0x4869d4?0x0:_0x3e22a5[_0x377c('0x23')];var _0x1c586a=_0x4869d4?_0x32e20d[_0x377c('0x22')]:_0x3e22a5[_0x377c('0x23')]+_0x3e22a5['limit'];var _0x1afb2a;if(_0x1c586a>=_0x56f232){_0x1c586a=_0x56f232;_0x1afb2a=0xc8;}else{_0x1afb2a=0xce;}_0x1d3d3[_0x377c('0x1d')](_0x1afb2a);return _0x1d3d3['set'](_0x377c('0x24'),_0x2bb6e4+'-'+_0x1c586a+'/'+_0x56f232)[_0x377c('0x1f')](_0x32e20d);}return null;};}function patchUpdates(_0xaff065){return function(_0x229352){try{jsonpatch[_0x377c('0x25')](_0x229352,_0xaff065,!![]);}catch(_0x17e48a){return BPromise[_0x377c('0x26')](_0x17e48a);}return _0x229352['save']();};}function saveUpdates(_0x29f814,_0x5b5b27){return function(_0x2efb32){if(_0x2efb32){return _0x2efb32[_0x377c('0x27')](_0x29f814)[_0x377c('0x28')](function(_0xa5aef0){return _0xa5aef0;});}return null;};}function removeEntity(_0x6a07bc,_0x4346c9){return function(_0x4607d7){if(_0x4607d7){return _0x4607d7['destroy']()[_0x377c('0x28')](function(){_0x6a07bc[_0x377c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13318d,_0x2d1181){return function(_0x346cff){if(!_0x346cff){_0x13318d[_0x377c('0x29')](0x194);}return _0x346cff;};}function handleError(_0x22b93d,_0x483bba){_0x483bba=_0x483bba||0x1f4;return function(_0x5a7ed1){logger['error'](_0x5a7ed1[_0x377c('0x2a')]);if(_0x5a7ed1['name']){delete _0x5a7ed1[_0x377c('0x2b')];}_0x22b93d[_0x377c('0x1d')](_0x483bba)[_0x377c('0x2c')](_0x5a7ed1);};}exports[_0x377c('0x2d')]=function(_0x4546b2,_0x10dff8){var _0x9a89e4={},_0x2f8d6b={},_0x522cc1={'count':0x0,'rows':[]};var _0x396a56=_[_0x377c('0x2e')](db[_0x377c('0x2f')][_0x377c('0x30')],function(_0x1c4a1a){return{'name':_0x1c4a1a['fieldName'],'type':_0x1c4a1a[_0x377c('0x31')][_0x377c('0x32')]};});_0x2f8d6b[_0x377c('0x33')]=_[_0x377c('0x2e')](_0x396a56,_0x377c('0x2b'));_0x2f8d6b[_0x377c('0x34')]=_[_0x377c('0x35')](_0x4546b2[_0x377c('0x34')]);_0x2f8d6b[_0x377c('0x36')]=_['intersection'](_0x2f8d6b[_0x377c('0x33')],_0x2f8d6b[_0x377c('0x34')]);_0x9a89e4[_0x377c('0x37')]=_['intersection'](_0x2f8d6b[_0x377c('0x33')],qs['fields'](_0x4546b2[_0x377c('0x34')][_0x377c('0x38')]));_0x9a89e4['attributes']=_0x9a89e4['attributes'][_0x377c('0x39')]?_0x9a89e4[_0x377c('0x37')]:_0x2f8d6b[_0x377c('0x33')];if(!_0x4546b2[_0x377c('0x34')][_0x377c('0x3a')](_0x377c('0x3b'))){_0x9a89e4[_0x377c('0x21')]=qs[_0x377c('0x21')](_0x4546b2['query']['limit']);_0x9a89e4[_0x377c('0x23')]=qs[_0x377c('0x23')](_0x4546b2['query'][_0x377c('0x23')]);}_0x9a89e4[_0x377c('0x3c')]=qs['sort'](_0x4546b2['query'][_0x377c('0x3d')]);_0x9a89e4['where']=qs[_0x377c('0x36')](_[_0x377c('0x3e')](_0x4546b2[_0x377c('0x34')],_0x2f8d6b[_0x377c('0x36')]),_0x396a56);if(_0x4546b2[_0x377c('0x34')][_0x377c('0x3f')]){_0x9a89e4[_0x377c('0x40')]=_[_0x377c('0x41')](_0x9a89e4[_0x377c('0x40')],{'$or':_[_0x377c('0x2e')](_0x396a56,function(_0x393dac){if(_0x393dac[_0x377c('0x31')]!==_0x377c('0x42')){var _0x2f3ff0={};_0x2f3ff0[_0x393dac[_0x377c('0x2b')]]={'$like':'%'+_0x4546b2[_0x377c('0x34')]['filter']+'%'};return _0x2f3ff0;}})});}_0x9a89e4=_[_0x377c('0x41')]({},_0x9a89e4,_0x4546b2[_0x377c('0x43')]);var _0x506a88={'where':_0x9a89e4['where']};return db[_0x377c('0x2f')]['count'](_0x506a88)[_0x377c('0x28')](function(_0x586581){_0x522cc1[_0x377c('0x22')]=_0x586581;if(_0x4546b2[_0x377c('0x34')][_0x377c('0x44')]){_0x9a89e4[_0x377c('0x45')]=[{'all':!![]}];}return db[_0x377c('0x2f')]['findAll'](_0x9a89e4);})[_0x377c('0x28')](function(_0x7107a3){_0x522cc1['rows']=_0x7107a3;return _0x522cc1;})[_0x377c('0x28')](respondWithFilteredResult(_0x10dff8,_0x9a89e4))[_0x377c('0x46')](handleError(_0x10dff8,null));};exports[_0x377c('0x47')]=function(_0x5cabf1,_0x483158){var _0x402f1c={'raw':!![],'where':{'id':_0x5cabf1['params']['id']}},_0x5d8814={};_0x5d8814[_0x377c('0x33')]=_['keys'](db[_0x377c('0x2f')][_0x377c('0x30')]);_0x5d8814['query']=_[_0x377c('0x35')](_0x5cabf1[_0x377c('0x34')]);_0x5d8814[_0x377c('0x36')]=_[_0x377c('0x48')](_0x5d8814['model'],_0x5d8814['query']);_0x402f1c[_0x377c('0x37')]=_['intersection'](_0x5d8814[_0x377c('0x33')],qs[_0x377c('0x38')](_0x5cabf1['query'][_0x377c('0x38')]));_0x402f1c[_0x377c('0x37')]=_0x402f1c['attributes'][_0x377c('0x39')]?_0x402f1c[_0x377c('0x37')]:_0x5d8814[_0x377c('0x33')];if(_0x5cabf1[_0x377c('0x34')][_0x377c('0x44')]){_0x402f1c[_0x377c('0x45')]=[{'all':!![]}];}_0x402f1c=_[_0x377c('0x41')]({},_0x402f1c,_0x5cabf1['options']);return db[_0x377c('0x2f')][_0x377c('0x49')](_0x402f1c)['then'](handleEntityNotFound(_0x483158,null))[_0x377c('0x28')](respondWithResult(_0x483158,null))['catch'](handleError(_0x483158,null));};exports[_0x377c('0x4a')]=function(_0x4b48d2,_0x8150fd){return db['ChatInternalMessage']['create'](_0x4b48d2['body'],{})[_0x377c('0x28')](respondWithResult(_0x8150fd,0xc9))[_0x377c('0x46')](handleError(_0x8150fd,null));};exports[_0x377c('0x27')]=function(_0x502bb8,_0x5a2ed9){if(_0x502bb8['body']['id']){delete _0x502bb8['body']['id'];}return db[_0x377c('0x2f')][_0x377c('0x49')]({'where':{'id':_0x502bb8[_0x377c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a2ed9,null))[_0x377c('0x28')](saveUpdates(_0x502bb8[_0x377c('0x4c')],null))[_0x377c('0x28')](respondWithResult(_0x5a2ed9,null))['catch'](handleError(_0x5a2ed9,null));};exports['destroy']=function(_0x2b8031,_0x1e0041){return db[_0x377c('0x2f')][_0x377c('0x49')]({'where':{'id':_0x2b8031[_0x377c('0x4b')]['id']}})[_0x377c('0x28')](handleEntityNotFound(_0x1e0041,null))['then'](removeEntity(_0x1e0041,null))[_0x377c('0x46')](handleError(_0x1e0041,null));};exports[_0x377c('0x4d')]=function(_0x465399,_0x251e00){return db[_0x377c('0x2f')][_0x377c('0x4d')]()[_0x377c('0x28')](respondWithResult(_0x251e00,null))[_0x377c('0x46')](handleError(_0x251e00,null));};function wrapUser(_0x4105eb){return function(_0xf4183){var _0x752d0c=_0x4105eb[_0x377c('0x4e')]({'plain':!![]});_0x752d0c[_0x377c('0x4f')]=[];if(_0xf4183){_0x752d0c[_0x377c('0x50')]=_0xf4183[_0x377c('0x51')];_0x752d0c[_0x377c('0x52')]=_0xf4183;}else{_0x752d0c[_0x377c('0x50')]=moment(0x0)[_0x377c('0x53')](_0x377c('0x54'));_0x752d0c[_0x377c('0x52')]={};}return _0x752d0c;};}exports[_0x377c('0x55')]=function(_0x58babc,_0x53ca05,_0x343159){var _0x510d5c=[];return db[_0x377c('0x56')]['findAll']({'where':{'role':[_0x377c('0x57'),_0x377c('0x58'),'user']},'attributes':['id','fullname',_0x377c('0x2b'),_0x377c('0x59'),_0x377c('0x5a'),_0x377c('0x5b'),_0x377c('0x5c'),_0x377c('0x5d'),_0x377c('0x5e'),_0x377c('0x5f')],'order':qs['sort'](_0x377c('0x60')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x377c('0x2b'),'type'],'through':{'attributes':[]}}]})[_0x377c('0x28')](function(_0x2cbdca){if(_0x2cbdca){var _0xcd35f3=_0x58babc[_0x377c('0x61')][_0x377c('0x4e')]({'plain':!![]});if(!_0xcd35f3)throw new Error(_0x377c('0x62'));if(_0xcd35f3[_0x377c('0x59')]===_0x377c('0x61')){return db[_0x377c('0x63')]['find']({'where':{'name':_0x377c('0x64'),'userProfileId':_0xcd35f3[_0x377c('0x65')]},'raw':!![]})[_0x377c('0x28')](function(_0x5a6213){if(_0x5a6213){if(_0x5a6213['autoAssociation']===0x0){return db[_0x377c('0x66')][_0x377c('0x67')]({'where':{'sectionId':_0x5a6213['id']},'raw':!![]})[_0x377c('0x28')](function(_0x568a5b){var _0x11d1f4=[];if(_[_0x377c('0x68')](_0x568a5b)){_0x11d1f4=_[_0x377c('0x3f')](_0x2cbdca,function(_0x56d6ab){if(_0x56d6ab['role']!==_0x377c('0x57')){return _0x56d6ab;}});return _0x11d1f4;}else{for(var _0x27684=0x0;_0x27684<_0x2cbdca[_0x377c('0x39')];_0x27684++){var _0x19fe68=_0x2cbdca[_0x27684];if(_0x19fe68[_0x377c('0x59')]===_0x377c('0x57')){var _0x5ac9ef=_[_0x377c('0x49')](_0x568a5b,function(_0x40100e){return _0x40100e[_0x377c('0x69')]===_0x19fe68['id'];});if(_0x5ac9ef)_0x11d1f4[_0x377c('0x6a')](_0x19fe68);}else{_0x11d1f4[_0x377c('0x6a')](_0x19fe68);}}return _0x11d1f4;}});}else{return _0x2cbdca;}}else{var _0x4b0153=_[_0x377c('0x3f')](_0x2cbdca,function(_0x35dbe0){if(_0x35dbe0[_0x377c('0x59')]!==_0x377c('0x57')){return _0x35dbe0;}});return _0x4b0153;}});}else{return _0x2cbdca;}}})[_0x377c('0x28')](function(_0x35a56e){var _0x5c5d78=[];if(_0x35a56e){_0x510d5c=_0x35a56e;for(var _0x59b2be=0x0;_0x59b2be<_0x35a56e['length'];_0x59b2be+=0x1){_0x510d5c[_0x59b2be]['messages']=[];_0x5c5d78[_0x377c('0x6a')](db['ChatInternalMessage'][_0x377c('0x49')]({'where':{'FromId':[_0x58babc[_0x377c('0x61')]['id'],_0x35a56e[_0x59b2be]['id']],'ToId':[_0x58babc[_0x377c('0x61')]['id'],_0x35a56e[_0x59b2be]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x377c('0x6b'),_0x377c('0x6c'),_0x377c('0x6d'),_0x377c('0x4c')],'order':qs[_0x377c('0x3d')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x377c('0x28')](wrapUser(_0x35a56e[_0x59b2be])));}return BPromise[_0x377c('0x6e')](_0x5c5d78);}return[];})[_0x377c('0x28')](function(_0x24550b){return{'rows':_0x24550b,'count':_0x24550b['length']};})['then'](respondWithResult(_0x53ca05,null))[_0x377c('0x46')](handleError(_0x53ca05,null));}; \ No newline at end of file +var _0xfa6e=['type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','merge','VIRTUAL','options','where','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','lastMessageAt','createdAt','lastMessage','getUsers','User','agent','admin','user','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','filter','resourceId','push','FromId','ToId','read','-createdAt','all','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','end','json','offset','undefined','set','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','ChatInternalMessage','rawAttributes'];(function(_0x52ba7f,_0x217cd3){var _0x1d29ec=function(_0x5118c4){while(--_0x5118c4){_0x52ba7f['push'](_0x52ba7f['shift']());}};_0x1d29ec(++_0x217cd3);}(_0xfa6e,0x18f));var _0xefa6=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xfa6e[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xefa6('0x0'));var zipdir=require(_0xefa6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xefa6('0x2'));var moment=require(_0xefa6('0x3'));var BPromise=require(_0xefa6('0x4'));var Mustache=require(_0xefa6('0x5'));var util=require(_0xefa6('0x6'));var path=require(_0xefa6('0x7'));var sox=require(_0xefa6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xefa6('0x9'));var _=require(_0xefa6('0xa'));var squel=require(_0xefa6('0xb'));var crypto=require(_0xefa6('0xc'));var jsforce=require(_0xefa6('0xd'));var deskjs=require(_0xefa6('0xe'));var toCsv=require(_0xefa6('0xf'));var querystring=require(_0xefa6('0x10'));var Papa=require(_0xefa6('0x11'));var Redis=require('ioredis');var authService=require(_0xefa6('0x12'));var qs=require(_0xefa6('0x13'));var as=require(_0xefa6('0x14'));var hardwareService=require(_0xefa6('0x15'));var logger=require(_0xefa6('0x16'))(_0xefa6('0x17'));var utils=require(_0xefa6('0x18'));var config=require(_0xefa6('0x19'));var licenseUtil=require(_0xefa6('0x1a'));var db=require(_0xefa6('0x1b'))['db'];config[_0xefa6('0x1c')]=_[_0xefa6('0x1d')](config[_0xefa6('0x1c')],{'host':_0xefa6('0x1e'),'port':0x18eb});var socket=require(_0xefa6('0x1f'))(new Redis(config['redis']));require(_0xefa6('0x20'))[_0xefa6('0x21')](socket);function respondWithStatusCode(_0x15b106,_0x94c8d8){_0x94c8d8=_0x94c8d8||0xcc;return function(_0x15f53d){if(_0x15f53d){return _0x15b106['sendStatus'](_0x94c8d8);}return _0x15b106[_0xefa6('0x22')](_0x94c8d8)[_0xefa6('0x23')]();};}function respondWithResult(_0x5d9899,_0x17afa3){_0x17afa3=_0x17afa3||0xc8;return function(_0x339033){if(_0x339033){return _0x5d9899['status'](_0x17afa3)[_0xefa6('0x24')](_0x339033);}};}function respondWithFilteredResult(_0xf3b8c9,_0x196155){return function(_0xbf4ef1){if(_0xbf4ef1){var _0x103bc8=typeof _0x196155[_0xefa6('0x25')]===_0xefa6('0x26')&&typeof _0x196155['limit']==='undefined';var _0x4a0117=_0xbf4ef1['count'];var _0xaa477a=_0x103bc8?0x0:_0x196155[_0xefa6('0x25')];var _0x281894=_0x103bc8?_0xbf4ef1['count']:_0x196155[_0xefa6('0x25')]+_0x196155['limit'];var _0x1c0352;if(_0x281894>=_0x4a0117){_0x281894=_0x4a0117;_0x1c0352=0xc8;}else{_0x1c0352=0xce;}_0xf3b8c9[_0xefa6('0x22')](_0x1c0352);return _0xf3b8c9[_0xefa6('0x27')]('Content-Range',_0xaa477a+'-'+_0x281894+'/'+_0x4a0117)['json'](_0xbf4ef1);}return null;};}function patchUpdates(_0x49f366){return function(_0x2973c3){try{jsonpatch[_0xefa6('0x28')](_0x2973c3,_0x49f366,!![]);}catch(_0x14befe){return BPromise[_0xefa6('0x29')](_0x14befe);}return _0x2973c3[_0xefa6('0x2a')]();};}function saveUpdates(_0x22227a,_0x3d2cab){return function(_0x1c3fb9){if(_0x1c3fb9){return _0x1c3fb9[_0xefa6('0x2b')](_0x22227a)[_0xefa6('0x2c')](function(_0x335cf7){return _0x335cf7;});}return null;};}function removeEntity(_0x418556,_0x5671c4){return function(_0x5d9774){if(_0x5d9774){return _0x5d9774[_0xefa6('0x2d')]()[_0xefa6('0x2c')](function(){_0x418556[_0xefa6('0x22')](0xcc)[_0xefa6('0x23')]();});}};}function handleEntityNotFound(_0x2973c8,_0x6e2260){return function(_0x1638a2){if(!_0x1638a2){_0x2973c8[_0xefa6('0x2e')](0x194);}return _0x1638a2;};}function handleError(_0x27aee0,_0x37bcde){_0x37bcde=_0x37bcde||0x1f4;return function(_0x2682b6){logger[_0xefa6('0x2f')](_0x2682b6['stack']);if(_0x2682b6[_0xefa6('0x30')]){delete _0x2682b6[_0xefa6('0x30')];}_0x27aee0['status'](_0x37bcde)[_0xefa6('0x31')](_0x2682b6);};}exports[_0xefa6('0x32')]=function(_0xd230c,_0x1cc9f4){var _0x413829={},_0x4aa060={},_0x1b76f0={'count':0x0,'rows':[]};var _0x2de6e0=_['map'](db[_0xefa6('0x33')][_0xefa6('0x34')],function(_0x3b91ce){return{'name':_0x3b91ce['fieldName'],'type':_0x3b91ce[_0xefa6('0x35')][_0xefa6('0x36')]};});_0x4aa060[_0xefa6('0x37')]=_[_0xefa6('0x38')](_0x2de6e0,_0xefa6('0x30'));_0x4aa060['query']=_[_0xefa6('0x39')](_0xd230c[_0xefa6('0x3a')]);_0x4aa060[_0xefa6('0x3b')]=_[_0xefa6('0x3c')](_0x4aa060[_0xefa6('0x37')],_0x4aa060['query']);_0x413829[_0xefa6('0x3d')]=_['intersection'](_0x4aa060['model'],qs[_0xefa6('0x3e')](_0xd230c[_0xefa6('0x3a')][_0xefa6('0x3e')]));_0x413829[_0xefa6('0x3d')]=_0x413829['attributes'][_0xefa6('0x3f')]?_0x413829['attributes']:_0x4aa060[_0xefa6('0x37')];if(!_0xd230c[_0xefa6('0x3a')][_0xefa6('0x40')](_0xefa6('0x41'))){_0x413829[_0xefa6('0x42')]=qs[_0xefa6('0x42')](_0xd230c['query']['limit']);_0x413829[_0xefa6('0x25')]=qs[_0xefa6('0x25')](_0xd230c[_0xefa6('0x3a')][_0xefa6('0x25')]);}_0x413829[_0xefa6('0x43')]=qs[_0xefa6('0x44')](_0xd230c[_0xefa6('0x3a')]['sort']);_0x413829['where']=qs[_0xefa6('0x3b')](_['pick'](_0xd230c[_0xefa6('0x3a')],_0x4aa060[_0xefa6('0x3b')]),_0x2de6e0);if(_0xd230c['query']['filter']){_0x413829['where']=_[_0xefa6('0x45')](_0x413829['where'],{'$or':_[_0xefa6('0x38')](_0x2de6e0,function(_0x987cb8){if(_0x987cb8[_0xefa6('0x35')]!==_0xefa6('0x46')){var _0x14b310={};_0x14b310[_0x987cb8['name']]={'$like':'%'+_0xd230c[_0xefa6('0x3a')]['filter']+'%'};return _0x14b310;}})});}_0x413829=_[_0xefa6('0x45')]({},_0x413829,_0xd230c[_0xefa6('0x47')]);var _0x1d5be9={'where':_0x413829[_0xefa6('0x48')]};return db[_0xefa6('0x33')][_0xefa6('0x49')](_0x1d5be9)[_0xefa6('0x2c')](function(_0x4c8c59){_0x1b76f0[_0xefa6('0x49')]=_0x4c8c59;if(_0xd230c[_0xefa6('0x3a')][_0xefa6('0x4a')]){_0x413829['include']=[{'all':!![]}];}return db['ChatInternalMessage'][_0xefa6('0x4b')](_0x413829);})[_0xefa6('0x2c')](function(_0x4624b0){_0x1b76f0[_0xefa6('0x4c')]=_0x4624b0;return _0x1b76f0;})[_0xefa6('0x2c')](respondWithFilteredResult(_0x1cc9f4,_0x413829))[_0xefa6('0x4d')](handleError(_0x1cc9f4,null));};exports[_0xefa6('0x4e')]=function(_0x3b94bb,_0x3c515c){var _0x6940a1={'raw':!![],'where':{'id':_0x3b94bb[_0xefa6('0x4f')]['id']}},_0x5e546d={};_0x5e546d[_0xefa6('0x37')]=_['keys'](db[_0xefa6('0x33')]['rawAttributes']);_0x5e546d[_0xefa6('0x3a')]=_[_0xefa6('0x39')](_0x3b94bb['query']);_0x5e546d['filters']=_[_0xefa6('0x3c')](_0x5e546d[_0xefa6('0x37')],_0x5e546d['query']);_0x6940a1[_0xefa6('0x3d')]=_[_0xefa6('0x3c')](_0x5e546d[_0xefa6('0x37')],qs['fields'](_0x3b94bb[_0xefa6('0x3a')][_0xefa6('0x3e')]));_0x6940a1['attributes']=_0x6940a1[_0xefa6('0x3d')][_0xefa6('0x3f')]?_0x6940a1[_0xefa6('0x3d')]:_0x5e546d[_0xefa6('0x37')];if(_0x3b94bb[_0xefa6('0x3a')]['includeAll']){_0x6940a1[_0xefa6('0x50')]=[{'all':!![]}];}_0x6940a1=_[_0xefa6('0x45')]({},_0x6940a1,_0x3b94bb[_0xefa6('0x47')]);return db[_0xefa6('0x33')][_0xefa6('0x51')](_0x6940a1)[_0xefa6('0x2c')](handleEntityNotFound(_0x3c515c,null))['then'](respondWithResult(_0x3c515c,null))[_0xefa6('0x4d')](handleError(_0x3c515c,null));};exports['create']=function(_0xb8f444,_0x2e33f7){return db[_0xefa6('0x33')][_0xefa6('0x52')](_0xb8f444[_0xefa6('0x53')],{})[_0xefa6('0x2c')](respondWithResult(_0x2e33f7,0xc9))['catch'](handleError(_0x2e33f7,null));};exports[_0xefa6('0x2b')]=function(_0x27d9c3,_0x225210){if(_0x27d9c3[_0xefa6('0x53')]['id']){delete _0x27d9c3[_0xefa6('0x53')]['id'];}return db['ChatInternalMessage'][_0xefa6('0x51')]({'where':{'id':_0x27d9c3['params']['id']}})[_0xefa6('0x2c')](handleEntityNotFound(_0x225210,null))[_0xefa6('0x2c')](saveUpdates(_0x27d9c3['body'],null))[_0xefa6('0x2c')](respondWithResult(_0x225210,null))[_0xefa6('0x4d')](handleError(_0x225210,null));};exports['destroy']=function(_0x3db2df,_0x1380db){return db[_0xefa6('0x33')]['find']({'where':{'id':_0x3db2df[_0xefa6('0x4f')]['id']}})[_0xefa6('0x2c')](handleEntityNotFound(_0x1380db,null))[_0xefa6('0x2c')](removeEntity(_0x1380db,null))['catch'](handleError(_0x1380db,null));};exports[_0xefa6('0x54')]=function(_0xc49b8,_0x34fde2){return db[_0xefa6('0x33')][_0xefa6('0x54')]()['then'](respondWithResult(_0x34fde2,null))[_0xefa6('0x4d')](handleError(_0x34fde2,null));};function wrapUser(_0x15a18e){return function(_0x554768){var _0x2d3131=_0x15a18e['get']({'plain':!![]});_0x2d3131['messages']=[];if(_0x554768){_0x2d3131[_0xefa6('0x55')]=_0x554768[_0xefa6('0x56')];_0x2d3131[_0xefa6('0x57')]=_0x554768;}else{_0x2d3131['lastMessageAt']=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2d3131[_0xefa6('0x57')]={};}return _0x2d3131;};}exports[_0xefa6('0x58')]=function(_0x812e3c,_0x677cd1,_0x54dc29){var _0x38bd00=[];return db[_0xefa6('0x59')][_0xefa6('0x4b')]({'where':{'role':[_0xefa6('0x5a'),_0xefa6('0x5b'),_0xefa6('0x5c')]},'attributes':['id','fullname',_0xefa6('0x30'),_0xefa6('0x5d'),_0xefa6('0x5e'),_0xefa6('0x5f'),'online',_0xefa6('0x60'),_0xefa6('0x61'),_0xefa6('0x62')],'order':qs['sort']('-online'),'include':[{'model':db[_0xefa6('0x63')],'as':_0xefa6('0x64'),'attributes':['id',_0xefa6('0x30'),_0xefa6('0x35')],'through':{'attributes':[]}}]})[_0xefa6('0x2c')](function(_0x5d19ac){if(_0x5d19ac){var _0x59f3e3=_0x812e3c[_0xefa6('0x5c')]['get']({'plain':!![]});if(!_0x59f3e3)throw new Error(_0xefa6('0x65'));if(_0x59f3e3[_0xefa6('0x5d')]==='user'){return db['UserProfileSection'][_0xefa6('0x51')]({'where':{'name':'Agents','userProfileId':_0x59f3e3[_0xefa6('0x66')]},'raw':!![]})['then'](function(_0x29269d){if(_0x29269d){if(_0x29269d[_0xefa6('0x67')]===0x0){return db[_0xefa6('0x68')][_0xefa6('0x4b')]({'where':{'sectionId':_0x29269d['id']},'raw':!![]})[_0xefa6('0x2c')](function(_0x13b815){var _0x51e364=[];if(_['isEmpty'](_0x13b815)){_0x51e364=_[_0xefa6('0x69')](_0x5d19ac,function(_0x5b54cc){if(_0x5b54cc[_0xefa6('0x5d')]!==_0xefa6('0x5a')){return _0x5b54cc;}});return _0x51e364;}else{for(var _0x24eb4=0x0;_0x24eb4<_0x5d19ac['length'];_0x24eb4++){var _0x47b1f9=_0x5d19ac[_0x24eb4];if(_0x47b1f9['role']===_0xefa6('0x5a')){var _0x2d38bf=_[_0xefa6('0x51')](_0x13b815,function(_0x5d4edc){return _0x5d4edc[_0xefa6('0x6a')]===_0x47b1f9['id'];});if(_0x2d38bf)_0x51e364['push'](_0x47b1f9);}else{_0x51e364[_0xefa6('0x6b')](_0x47b1f9);}}return _0x51e364;}});}else{return _0x5d19ac;}}else{var _0x1f675d=_['filter'](_0x5d19ac,function(_0x55ecc1){if(_0x55ecc1[_0xefa6('0x5d')]!==_0xefa6('0x5a')){return _0x55ecc1;}});return _0x1f675d;}});}else{return _0x5d19ac;}}})[_0xefa6('0x2c')](function(_0x36bfe5){var _0x2c03a5=[];if(_0x36bfe5){_0x38bd00=_0x36bfe5;for(var _0x269cf2=0x0;_0x269cf2<_0x36bfe5[_0xefa6('0x3f')];_0x269cf2+=0x1){_0x38bd00[_0x269cf2]['messages']=[];_0x2c03a5[_0xefa6('0x6b')](db['ChatInternalMessage'][_0xefa6('0x51')]({'where':{'FromId':[_0x812e3c['user']['id'],_0x36bfe5[_0x269cf2]['id']],'ToId':[_0x812e3c[_0xefa6('0x5c')]['id'],_0x36bfe5[_0x269cf2]['id']],'ChatGroupId':null},'attributes':['id',_0xefa6('0x56'),_0xefa6('0x6c'),_0xefa6('0x6d'),_0xefa6('0x6e'),_0xefa6('0x53')],'order':qs[_0xefa6('0x44')](_0xefa6('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xefa6('0x2c')](wrapUser(_0x36bfe5[_0x269cf2])));}return BPromise[_0xefa6('0x70')](_0x2c03a5);}return[];})[_0xefa6('0x2c')](function(_0x3bcb8f){return{'rows':_0x3bcb8f,'count':_0x3bcb8f[_0xefa6('0x3f')]};})[_0xefa6('0x2c')](respondWithResult(_0x677cd1,null))[_0xefa6('0x4d')](handleError(_0x677cd1,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index c2eb641..bbb4fa8 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 _0x1f06=['setMaxListeners','save','emit','hook','exports','events','ChatInternalMessage'];(function(_0x110287,_0x7d59cc){var _0x250a23=function(_0x55681d){while(--_0x55681d){_0x110287['push'](_0x110287['shift']());}};_0x250a23(++_0x7d59cc);}(_0x1f06,0xde));var _0x61f0=function(_0x5847eb,_0x155d09){_0x5847eb=_0x5847eb-0x0;var _0x23da35=_0x1f06[_0x5847eb];return _0x23da35;};'use strict';var EventEmitter=require(_0x61f0('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x61f0('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x61f0('0x2')](0x0);var events={'afterCreate':_0x61f0('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1fc87a){return function(_0x7cc9a3,_0x1385bf,_0x44f569){ChatInternalMessageEvents[_0x61f0('0x4')](_0x1fc87a+':'+_0x7cc9a3['id'],_0x7cc9a3);ChatInternalMessageEvents[_0x61f0('0x4')](_0x1fc87a,_0x7cc9a3);_0x44f569(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x61f0('0x5')](e,emitEvent(event));}}module[_0x61f0('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xf4cf=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x363160,_0x5dfb11){var _0xa4b3f9=function(_0x1e93e7){while(--_0x1e93e7){_0x363160['push'](_0x363160['shift']());}};_0xa4b3f9(++_0x5dfb11);}(_0xf4cf,0x1e0));var _0xff4c=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xf4cf[_0x50a0c2];return _0x5ebadd;};'use strict';var EventEmitter=require(_0xff4c('0x0'));var ChatInternalMessage=require(_0xff4c('0x1'))['db'][_0xff4c('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xff4c('0x3')](0x0);var events={'afterCreate':_0xff4c('0x4'),'afterUpdate':_0xff4c('0x5'),'afterDestroy':_0xff4c('0x6')};function emitEvent(_0x5416e0){return function(_0x51e090,_0x476157,_0x5212eb){ChatInternalMessageEvents[_0xff4c('0x7')](_0x5416e0+':'+_0x51e090['id'],_0x51e090);ChatInternalMessageEvents[_0xff4c('0x7')](_0x5416e0,_0x51e090);_0x5212eb(null);};}for(var e in events){if(events[_0xff4c('0x8')](e)){var event=events[e];ChatInternalMessage[_0xff4c('0x9')](e,emitEvent(event));}}module[_0xff4c('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 5b3d37d..ba74fe8 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 _0xfabd=['exports','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfabd,0x10c));var _0xdfab=function(_0x1986ee,_0x224cf0){_0x1986ee=_0x1986ee-0x0;var _0x1c9ef8=_0xfabd[_0x1986ee];return _0x1c9ef8;};'use strict';var _=require(_0xdfab('0x0'));var util=require(_0xdfab('0x1'));var logger=require('../../config/logger')(_0xdfab('0x2'));var moment=require('moment');var BPromise=require(_0xdfab('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdfab('0x4'));var rimraf=require(_0xdfab('0x5'));var config=require(_0xdfab('0x6'));var attributes=require('./chatInternalMessage.attributes');module[_0xdfab('0x7')]=function(_0x4a4967,_0x4ddb6c){return _0x4a4967['define'](_0xdfab('0x8'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdfab('0x9'),'collate':_0xdfab('0xa')});}; \ No newline at end of file +var _0xde6a=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','ChatInternalMessage'];(function(_0x3d82d6,_0x344112){var _0x521b27=function(_0x1afe97){while(--_0x1afe97){_0x3d82d6['push'](_0x3d82d6['shift']());}};_0x521b27(++_0x344112);}(_0xde6a,0x1cb));var _0xade6=function(_0x3d94a6,_0x6b5972){_0x3d94a6=_0x3d94a6-0x0;var _0x249bad=_0xde6a[_0x3d94a6];return _0x249bad;};'use strict';var _=require('lodash');var util=require(_0xade6('0x0'));var logger=require(_0xade6('0x1'))('api');var moment=require('moment');var BPromise=require(_0xade6('0x2'));var rp=require(_0xade6('0x3'));var fs=require('fs');var path=require(_0xade6('0x4'));var rimraf=require('rimraf');var config=require(_0xade6('0x5'));var attributes=require('./chatInternalMessage.attributes');module[_0xade6('0x6')]=function(_0x17da55,_0x2a3e5a){return _0x17da55[_0xade6('0x7')](_0xade6('0x8'),attributes,{'tableName':_0xade6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xade6('0xa'),'collate':_0xade6('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 73ed77d..33ae636 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 _0x34ab=['moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util'];(function(_0x105e04,_0x4d6a0b){var _0x2ff99f=function(_0x1a1340){while(--_0x1a1340){_0x105e04['push'](_0x105e04['shift']());}};_0x2ff99f(++_0x4d6a0b);}(_0x34ab,0xf1));var _0xb34a=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0x34ab[_0x5eef05];return _0x56d4b8;};'use strict';var _=require(_0xb34a('0x0'));var util=require(_0xb34a('0x1'));var moment=require(_0xb34a('0x2'));var BPromise=require(_0xb34a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb34a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb34a('0x5'))(_0xb34a('0x6'));var config=require(_0xb34a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb34a('0x8')][_0xb34a('0x9')]({'port':0x232a});config[_0xb34a('0xa')]=_[_0xb34a('0xb')](config[_0xb34a('0xa')],{'host':_0xb34a('0xc'),'port':0x18eb});var socket=require(_0xb34a('0xd'))(new Redis(config['redis']));require(_0xb34a('0xe'))[_0xb34a('0xf')](socket);function respondWithRpcPromise(_0x511892,_0x22f097,_0x3888c8){return new BPromise(function(_0x351970,_0x53f630){return client[_0xb34a('0x10')](_0x511892,_0x3888c8)[_0xb34a('0x11')](function(_0x197448){logger[_0xb34a('0x12')](_0xb34a('0x13'),_0x22f097,_0xb34a('0x14'));logger[_0xb34a('0x15')](_0xb34a('0x16'),_0x22f097,_0xb34a('0x14'),JSON['stringify'](_0x197448));if(_0x197448[_0xb34a('0x17')]){if(_0x197448['error'][_0xb34a('0x18')]===0x1f4){logger[_0xb34a('0x17')](_0xb34a('0x13'),_0x22f097,_0x197448[_0xb34a('0x17')][_0xb34a('0x19')]);return _0x53f630(_0x197448['error'][_0xb34a('0x19')]);}logger[_0xb34a('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x22f097,_0x197448['error'][_0xb34a('0x19')]);return _0x351970(_0x197448[_0xb34a('0x17')][_0xb34a('0x19')]);}else{logger['info'](_0xb34a('0x13'),_0x22f097,_0xb34a('0x14'));_0x351970(_0x197448[_0xb34a('0x1a')][_0xb34a('0x19')]);}})['catch'](function(_0x5ed23c){logger[_0xb34a('0x17')](_0xb34a('0x13'),_0x22f097,_0x5ed23c);_0x53f630(_0x5ed23c);});});} \ No newline at end of file +var _0xbbb5=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment'];(function(_0x354b61,_0x3a611d){var _0x1aedb4=function(_0x45e8e8){while(--_0x45e8e8){_0x354b61['push'](_0x354b61['shift']());}};_0x1aedb4(++_0x3a611d);}(_0xbbb5,0x1ae));var _0x5bbb=function(_0x3343a3,_0x41afb6){_0x3343a3=_0x3343a3-0x0;var _0x3e86f1=_0xbbb5[_0x3343a3];return _0x3e86f1;};'use strict';var _=require(_0x5bbb('0x0'));var util=require('util');var moment=require(_0x5bbb('0x1'));var BPromise=require('bluebird');var rs=require(_0x5bbb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5bbb('0x3'))['db'];var utils=require(_0x5bbb('0x4'));var logger=require('../../config/logger')(_0x5bbb('0x5'));var config=require(_0x5bbb('0x6'));var jayson=require(_0x5bbb('0x7'));var client=jayson[_0x5bbb('0x8')]['http']({'port':0x232a});config[_0x5bbb('0x9')]=_[_0x5bbb('0xa')](config['redis'],{'host':_0x5bbb('0xb'),'port':0x18eb});var socket=require(_0x5bbb('0xc'))(new Redis(config[_0x5bbb('0x9')]));require(_0x5bbb('0xd'))[_0x5bbb('0xe')](socket);function respondWithRpcPromise(_0x1f9944,_0xd40f7a,_0x2e1a01){return new BPromise(function(_0x21d9da,_0x28cdc2){return client[_0x5bbb('0xf')](_0x1f9944,_0x2e1a01)['then'](function(_0x35761d){logger[_0x5bbb('0x10')](_0x5bbb('0x11'),_0xd40f7a,_0x5bbb('0x12'));logger['debug'](_0x5bbb('0x13'),_0xd40f7a,_0x5bbb('0x12'),JSON['stringify'](_0x35761d));if(_0x35761d[_0x5bbb('0x14')]){if(_0x35761d[_0x5bbb('0x14')][_0x5bbb('0x15')]===0x1f4){logger[_0x5bbb('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0xd40f7a,_0x35761d[_0x5bbb('0x14')][_0x5bbb('0x16')]);return _0x28cdc2(_0x35761d[_0x5bbb('0x14')][_0x5bbb('0x16')]);}logger[_0x5bbb('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0xd40f7a,_0x35761d[_0x5bbb('0x14')][_0x5bbb('0x16')]);return _0x21d9da(_0x35761d[_0x5bbb('0x14')][_0x5bbb('0x16')]);}else{logger[_0x5bbb('0x10')](_0x5bbb('0x11'),_0xd40f7a,'request\x20sent');_0x21d9da(_0x35761d[_0x5bbb('0x17')][_0x5bbb('0x16')]);}})['catch'](function(_0x484d31){logger[_0x5bbb('0x14')](_0x5bbb('0x11'),_0xd40f7a,_0x484d31);_0x28cdc2(_0x484d31);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index c3abab0..901f3d8 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 _0x43bb=['./chatInternalMessage.events','save','emit','removeListener','chatInternalMessage:'];(function(_0x11731f,_0x2271b5){var _0x14587c=function(_0x31e014){while(--_0x31e014){_0x11731f['push'](_0x11731f['shift']());}};_0x14587c(++_0x2271b5);}(_0x43bb,0x1c7));var _0xb43b=function(_0x43e193,_0x3c7b98){_0x43e193=_0x43e193-0x0;var _0x2cec78=_0x43bb[_0x43e193];return _0x2cec78;};'use strict';var ChatInternalMessageEvents=require(_0xb43b('0x0'));var events=[_0xb43b('0x1'),'remove','update'];function createListener(_0x58540a,_0x35bbad){return function(_0x88e9b9){_0x35bbad[_0xb43b('0x2')](_0x58540a,_0x88e9b9);};}function removeListener(_0x44b60f,_0x45eec1){return function(){ChatInternalMessageEvents[_0xb43b('0x3')](_0x44b60f,_0x45eec1);};}exports['register']=function(_0xb64a35){for(var _0x33c106=0x0,_0x5cfb6b=events['length'];_0x33c106<_0x5cfb6b;_0x33c106++){var _0x2b9284=events[_0x33c106];var _0x3572f4=createListener(_0xb43b('0x4')+_0x2b9284,_0xb64a35);ChatInternalMessageEvents['on'](_0x2b9284,_0x3572f4);}}; \ No newline at end of file +var _0xd1f5=['removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','update','emit'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0xd1f5,0x154));var _0x5d1f=function(_0x4b6164,_0x1c9039){_0x4b6164=_0x4b6164-0x0;var _0x1949b9=_0xd1f5[_0x4b6164];return _0x1949b9;};'use strict';var ChatInternalMessageEvents=require(_0x5d1f('0x0'));var events=[_0x5d1f('0x1'),'remove',_0x5d1f('0x2')];function createListener(_0x5656ef,_0x4081c0){return function(_0x246b63){_0x4081c0[_0x5d1f('0x3')](_0x5656ef,_0x246b63);};}function removeListener(_0xde7038,_0x18c4e6){return function(){ChatInternalMessageEvents[_0x5d1f('0x4')](_0xde7038,_0x18c4e6);};}exports[_0x5d1f('0x5')]=function(_0x37e7b9){for(var _0x3a7421=0x0,_0x479f16=events[_0x5d1f('0x6')];_0x3a7421<_0x479f16;_0x3a7421++){var _0x2177ae=events[_0x3a7421];var _0x74f8ca=createListener(_0x5d1f('0x7')+_0x2177ae,_0x37e7b9);ChatInternalMessageEvents['on'](_0x2177ae,_0x74f8ca);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index cd9bf74..5045cf5 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 _0x67c2=['/users','getUsers','/:id','show','post','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x67c2,0x1d0));var _0x267c=function(_0xb27b72,_0x13e91c){_0xb27b72=_0xb27b72-0x0;var _0x578999=_0x67c2[_0xb27b72];return _0x578999;};'use strict';var multer=require(_0x267c('0x0'));var util=require('util');var path=require(_0x267c('0x1'));var timeout=require('connect-timeout');var express=require(_0x267c('0x2'));var router=express[_0x267c('0x3')]();var fs_extra=require(_0x267c('0x4'));var auth=require(_0x267c('0x5'));var interaction=require(_0x267c('0x6'));var config=require(_0x267c('0x7'));var controller=require('./chatInternalMessage.controller');router['get']('/',auth[_0x267c('0x8')](),controller['index']);router['get'](_0x267c('0x9'),auth['isAuthenticated'](),controller[_0x267c('0xa')]);router['get'](_0x267c('0xb'),auth['isAuthenticated'](),controller[_0x267c('0xc')]);router['get'](_0x267c('0xd'),auth[_0x267c('0x8')](),controller[_0x267c('0xe')]);router[_0x267c('0xf')]('/',auth[_0x267c('0x8')](),controller['create']);router['put'](_0x267c('0xd'),controller[_0x267c('0x10')]);router['delete'](_0x267c('0xd'),auth['isAuthenticated'](),controller[_0x267c('0x11')]);module[_0x267c('0x12')]=router; \ No newline at end of file +var _0x9b24=['post','create','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/users','getUsers'];(function(_0x38854e,_0x23cbc9){var _0x3f8415=function(_0x4e493e){while(--_0x4e493e){_0x38854e['push'](_0x38854e['shift']());}};_0x3f8415(++_0x23cbc9);}(_0x9b24,0x6f));var _0x49b2=function(_0x2cdb77,_0x287524){_0x2cdb77=_0x2cdb77-0x0;var _0x57c5fb=_0x9b24[_0x2cdb77];return _0x57c5fb;};'use strict';var multer=require(_0x49b2('0x0'));var util=require(_0x49b2('0x1'));var path=require(_0x49b2('0x2'));var timeout=require('connect-timeout');var express=require(_0x49b2('0x3'));var router=express[_0x49b2('0x4')]();var fs_extra=require(_0x49b2('0x5'));var auth=require(_0x49b2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x49b2('0x7'));var controller=require('./chatInternalMessage.controller');router['get']('/',auth[_0x49b2('0x8')](),controller[_0x49b2('0x9')]);router[_0x49b2('0xa')](_0x49b2('0xb'),auth[_0x49b2('0x8')](),controller[_0x49b2('0xc')]);router['get'](_0x49b2('0xd'),auth[_0x49b2('0x8')](),controller[_0x49b2('0xe')]);router[_0x49b2('0xa')]('/:id',auth[_0x49b2('0x8')](),controller['show']);router[_0x49b2('0xf')]('/',auth[_0x49b2('0x8')](),controller[_0x49b2('0x10')]);router['put'](_0x49b2('0x11'),controller[_0x49b2('0x12')]);router['delete'](_0x49b2('0x11'),auth[_0x49b2('0x8')](),controller[_0x49b2('0x13')]);module[_0x49b2('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 2859101..83e6861 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 _0x1123=['TEXT','BOOLEAN','ENUM','DATE','STRING'];(function(_0x4d7602,_0x2ec899){var _0x40e114=function(_0x4f3691){while(--_0x4f3691){_0x4d7602['push'](_0x4d7602['shift']());}};_0x40e114(++_0x2ec899);}(_0x1123,0x118));var _0x3112=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1123[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x3112('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x3112('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3112('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3112('0x2')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x3112('0x3')]},'providerName':{'type':Sequelize[_0x3112('0x4')]},'providerResponse':{'type':Sequelize[_0x3112('0x0')]}}; \ No newline at end of file +var _0xdca3=['ENUM','out','DATE','STRING','sequelize','TEXT','medium','BOOLEAN'];(function(_0x4e22d8,_0xc96e52){var _0x375988=function(_0xc6b0e6){while(--_0xc6b0e6){_0x4e22d8['push'](_0x4e22d8['shift']());}};_0x375988(++_0xc96e52);}(_0xdca3,0x64));var _0x3dca=function(_0x1a277e,_0x556598){_0x1a277e=_0x1a277e-0x0;var _0x58bbf1=_0xdca3[_0x1a277e];return _0x58bbf1;};'use strict';var Sequelize=require(_0x3dca('0x0'));module['exports']={'body':{'type':Sequelize[_0x3dca('0x1')](_0x3dca('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3dca('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3dca('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3dca('0x4')]('in',_0x3dca('0x5')),'defaultValue':_0x3dca('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x3dca('0x6')]},'providerName':{'type':Sequelize[_0x3dca('0x7')]},'providerResponse':{'type':Sequelize[_0x3dca('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 4a0aa5d..806438a 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 _0x26fc=['acceptmessage','parse','formData','../../config/logger','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','Sequelize','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','jayson/promise','client','http','request','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','name','send','map','ChatMessage','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','body','destroy','describe','chat-interactions','chat','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','ChatInteraction','format','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager'];(function(_0x533b02,_0x5d53de){var _0xf970=function(_0x117bfb){while(--_0x117bfb){_0x533b02['push'](_0x533b02['shift']());}};_0xf970(++_0x5d53de);}(_0x26fc,0x8b));var _0xc26f=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x26fc[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0xc26f('0x0'));var rimraf=require(_0xc26f('0x1'));var zipdir=require(_0xc26f('0x2'));var jsonpatch=require(_0xc26f('0x3'));var rp=require(_0xc26f('0x4'));var moment=require('moment');var BPromise=require(_0xc26f('0x5'));var Mustache=require(_0xc26f('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc26f('0x7'));var csv=require(_0xc26f('0x8'));var ejs=require(_0xc26f('0x9'));var fs=require('fs');var fs_extra=require(_0xc26f('0xa'));var _=require(_0xc26f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc26f('0xc'));var deskjs=require(_0xc26f('0xd'));var toCsv=require(_0xc26f('0x8'));var querystring=require('querystring');var Papa=require(_0xc26f('0xe'));var Redis=require(_0xc26f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc26f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc26f('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc26f('0x12'));var db=require(_0xc26f('0x13'))['db'];config[_0xc26f('0x14')]=_[_0xc26f('0x15')](config[_0xc26f('0x14')],{'host':_0xc26f('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc26f('0x14')]));require(_0xc26f('0x17'))['register'](socket);var jayson=require(_0xc26f('0x18'));var client=jayson[_0xc26f('0x19')][_0xc26f('0x1a')]({'port':0x232c});var client9002=jayson[_0xc26f('0x19')][_0xc26f('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2e8e3c,_0x48d6f2,_0x21ccf2,_0x1ca9b3){return new BPromise(function(_0x5f82c5,_0x298638){var _0x49e864=_0x1ca9b3||client;return _0x49e864[_0xc26f('0x1b')](_0x2e8e3c,_0x21ccf2)['then'](function(_0x55f67){logger[_0xc26f('0x1c')]('ChatMessage,\x20%s,\x20%s',_0x48d6f2,_0xc26f('0x1d'));logger[_0xc26f('0x1e')](_0xc26f('0x1f'),_0x48d6f2,_0xc26f('0x1d'),JSON[_0xc26f('0x20')](_0x55f67));if(_0x55f67[_0xc26f('0x21')]){if(_0x55f67['error'][_0xc26f('0x22')]===0x1f4){logger['error'](_0xc26f('0x23'),_0x48d6f2,_0x55f67[_0xc26f('0x21')][_0xc26f('0x24')]);return _0x298638(_0x55f67[_0xc26f('0x21')]['message']);}logger[_0xc26f('0x21')](_0xc26f('0x23'),_0x48d6f2,_0x55f67['error'][_0xc26f('0x24')]);return _0x5f82c5(_0x55f67['error']['message']);}else{logger[_0xc26f('0x1c')](_0xc26f('0x23'),_0x48d6f2,'request\x20sent');_0x5f82c5(_0x55f67[_0xc26f('0x25')]['message']);}})[_0xc26f('0x26')](function(_0x583303){logger[_0xc26f('0x21')]('ChatMessage,\x20%s,\x20%s',_0x48d6f2,_0x583303);_0x298638(_0x583303);});});}function respondWithStatusCode(_0x2dc9fa,_0x5e0357){_0x5e0357=_0x5e0357||0xcc;return function(_0x402f1c){if(_0x402f1c){return _0x2dc9fa['sendStatus'](_0x5e0357);}return _0x2dc9fa[_0xc26f('0x27')](_0x5e0357)['end']();};}function respondWithResult(_0x317778,_0xe6c91f){_0xe6c91f=_0xe6c91f||0xc8;return function(_0x4e8234){if(_0x4e8234){return _0x317778['status'](_0xe6c91f)[_0xc26f('0x28')](_0x4e8234);}};}function respondWithFilteredResult(_0x19553c,_0x53524b){return function(_0x162a0a){if(_0x162a0a){var _0x36f39a=typeof _0x53524b[_0xc26f('0x29')]===_0xc26f('0x2a')&&typeof _0x53524b[_0xc26f('0x2b')]==='undefined';var _0x1aabb8=_0x162a0a[_0xc26f('0x2c')];var _0x1425af=_0x36f39a?0x0:_0x53524b[_0xc26f('0x29')];var _0x56cc69=_0x36f39a?_0x162a0a['count']:_0x53524b[_0xc26f('0x29')]+_0x53524b[_0xc26f('0x2b')];var _0x54ccc7;if(_0x56cc69>=_0x1aabb8){_0x56cc69=_0x1aabb8;_0x54ccc7=0xc8;}else{_0x54ccc7=0xce;}_0x19553c[_0xc26f('0x27')](_0x54ccc7);return _0x19553c['set'](_0xc26f('0x2d'),_0x1425af+'-'+_0x56cc69+'/'+_0x1aabb8)['json'](_0x162a0a);}return null;};}function patchUpdates(_0x5cd7bc){return function(_0x1d7c3c){try{jsonpatch[_0xc26f('0x2e')](_0x1d7c3c,_0x5cd7bc,!![]);}catch(_0x1b30e6){return BPromise[_0xc26f('0x2f')](_0x1b30e6);}return _0x1d7c3c[_0xc26f('0x30')]();};}function saveUpdates(_0x41cc5c,_0x20fb66){return function(_0x175489){if(_0x175489){return _0x175489[_0xc26f('0x31')](_0x41cc5c)['then'](function(_0x11ea20){return _0x11ea20;});}return null;};}function removeEntity(_0x566fce,_0x11ba71){return function(_0x3d03cd){if(_0x3d03cd){return _0x3d03cd['destroy']()[_0xc26f('0x32')](function(){_0x566fce[_0xc26f('0x27')](0xcc)[_0xc26f('0x33')]();});}};}function handleEntityNotFound(_0xa20339,_0x30351f){return function(_0x2cfea4){if(!_0x2cfea4){_0xa20339[_0xc26f('0x34')](0x194);}return _0x2cfea4;};}function handleError(_0x3e193c,_0x2b6987){_0x2b6987=_0x2b6987||0x1f4;return function(_0x3ee10e){logger['error'](_0x3ee10e[_0xc26f('0x35')]);if(_0x3ee10e[_0xc26f('0x36')]){delete _0x3ee10e[_0xc26f('0x36')];}_0x3e193c[_0xc26f('0x27')](_0x2b6987)[_0xc26f('0x37')](_0x3ee10e);};}exports['index']=function(_0x4e318d,_0x3cef9b){var _0x3e9610={},_0x167b5e={},_0xb9db81={'count':0x0,'rows':[]};var _0x32b1ab=_[_0xc26f('0x38')](db[_0xc26f('0x39')]['rawAttributes'],function(_0x5313d0){return{'name':_0x5313d0['fieldName'],'type':_0x5313d0['type'][_0xc26f('0x3a')]};});_0x167b5e[_0xc26f('0x3b')]=_['map'](_0x32b1ab,'name');_0x167b5e['query']=_['keys'](_0x4e318d[_0xc26f('0x3c')]);_0x167b5e[_0xc26f('0x3d')]=_[_0xc26f('0x3e')](_0x167b5e[_0xc26f('0x3b')],_0x167b5e[_0xc26f('0x3c')]);_0x3e9610[_0xc26f('0x3f')]=_[_0xc26f('0x3e')](_0x167b5e[_0xc26f('0x3b')],qs[_0xc26f('0x40')](_0x4e318d[_0xc26f('0x3c')][_0xc26f('0x40')]));_0x3e9610[_0xc26f('0x3f')]=_0x3e9610['attributes'][_0xc26f('0x41')]?_0x3e9610[_0xc26f('0x3f')]:_0x167b5e[_0xc26f('0x3b')];if(!_0x4e318d[_0xc26f('0x3c')][_0xc26f('0x42')]('nolimit')){_0x3e9610[_0xc26f('0x2b')]=qs[_0xc26f('0x2b')](_0x4e318d[_0xc26f('0x3c')][_0xc26f('0x2b')]);_0x3e9610[_0xc26f('0x29')]=qs['offset'](_0x4e318d[_0xc26f('0x3c')][_0xc26f('0x29')]);}_0x3e9610[_0xc26f('0x43')]=qs['sort'](_0x4e318d['query']['sort']);_0x3e9610[_0xc26f('0x44')]=qs[_0xc26f('0x3d')](_[_0xc26f('0x45')](_0x4e318d[_0xc26f('0x3c')],_0x167b5e[_0xc26f('0x3d')]),_0x32b1ab);if(_0x4e318d['query']['filter']){_0x3e9610[_0xc26f('0x44')]=_[_0xc26f('0x46')](_0x3e9610[_0xc26f('0x44')],{'$or':_[_0xc26f('0x38')](_0x32b1ab,function(_0x2fe79a){if(_0x2fe79a['type']!==_0xc26f('0x47')){var _0x614e28={};_0x614e28[_0x2fe79a[_0xc26f('0x36')]]={'$like':'%'+_0x4e318d[_0xc26f('0x3c')][_0xc26f('0x48')]+'%'};return _0x614e28;}})});}_0x3e9610=_[_0xc26f('0x46')]({},_0x3e9610,_0x4e318d[_0xc26f('0x49')]);var _0x2c4253={'where':_0x3e9610['where']};return db[_0xc26f('0x39')][_0xc26f('0x2c')](_0x2c4253)[_0xc26f('0x32')](function(_0x3575bd){_0xb9db81['count']=_0x3575bd;if(_0x4e318d[_0xc26f('0x3c')][_0xc26f('0x4a')]){_0x3e9610[_0xc26f('0x4b')]=[{'all':!![]}];}return db[_0xc26f('0x39')][_0xc26f('0x4c')](_0x3e9610);})[_0xc26f('0x32')](function(_0x3abd7d){_0xb9db81[_0xc26f('0x4d')]=_0x3abd7d;return _0xb9db81;})[_0xc26f('0x32')](respondWithFilteredResult(_0x3cef9b,_0x3e9610))[_0xc26f('0x26')](handleError(_0x3cef9b,null));};exports[_0xc26f('0x4e')]=function(_0x52780d,_0x54a0af){var _0x43e1e3={'raw':!![],'where':{'id':_0x52780d[_0xc26f('0x4f')]['id']}},_0xe61bc1={};_0xe61bc1['model']=_[_0xc26f('0x50')](db[_0xc26f('0x39')][_0xc26f('0x51')]);_0xe61bc1[_0xc26f('0x3c')]=_['keys'](_0x52780d[_0xc26f('0x3c')]);_0xe61bc1[_0xc26f('0x3d')]=_[_0xc26f('0x3e')](_0xe61bc1['model'],_0xe61bc1[_0xc26f('0x3c')]);_0x43e1e3[_0xc26f('0x3f')]=_['intersection'](_0xe61bc1['model'],qs['fields'](_0x52780d['query'][_0xc26f('0x40')]));_0x43e1e3['attributes']=_0x43e1e3[_0xc26f('0x3f')][_0xc26f('0x41')]?_0x43e1e3[_0xc26f('0x3f')]:_0xe61bc1[_0xc26f('0x3b')];if(_0x52780d['query'][_0xc26f('0x4a')]){_0x43e1e3[_0xc26f('0x4b')]=[{'all':!![]}];}_0x43e1e3=_[_0xc26f('0x46')]({},_0x43e1e3,_0x52780d[_0xc26f('0x49')]);return db[_0xc26f('0x39')][_0xc26f('0x52')](_0x43e1e3)[_0xc26f('0x32')](handleEntityNotFound(_0x54a0af,null))['then'](respondWithResult(_0x54a0af,null))[_0xc26f('0x26')](handleError(_0x54a0af,null));};exports[_0xc26f('0x53')]=function(_0x1125a3,_0x16665f){return db[_0xc26f('0x39')][_0xc26f('0x53')](_0x1125a3[_0xc26f('0x54')],{})['then'](respondWithResult(_0x16665f,0xc9))['catch'](handleError(_0x16665f,null));};exports[_0xc26f('0x31')]=function(_0x463ee4,_0x580379){if(_0x463ee4[_0xc26f('0x54')]['id']){delete _0x463ee4[_0xc26f('0x54')]['id'];}return db[_0xc26f('0x39')][_0xc26f('0x52')]({'where':{'id':_0x463ee4[_0xc26f('0x4f')]['id']}})[_0xc26f('0x32')](handleEntityNotFound(_0x580379,null))[_0xc26f('0x32')](saveUpdates(_0x463ee4['body'],null))[_0xc26f('0x32')](respondWithResult(_0x580379,null))[_0xc26f('0x26')](handleError(_0x580379,null));};exports[_0xc26f('0x55')]=function(_0x3afaa2,_0x401c1d){return db['ChatMessage'][_0xc26f('0x52')]({'where':{'id':_0x3afaa2[_0xc26f('0x4f')]['id']}})[_0xc26f('0x32')](handleEntityNotFound(_0x401c1d,null))[_0xc26f('0x32')](removeEntity(_0x401c1d,null))[_0xc26f('0x26')](handleError(_0x401c1d,null));};exports[_0xc26f('0x56')]=function(_0x40f68e,_0x4f93fe){return db[_0xc26f('0x39')][_0xc26f('0x56')]()[_0xc26f('0x32')](respondWithResult(_0x4f93fe,null))[_0xc26f('0x26')](handleError(_0x4f93fe,null));};var interaction_log=require('../../config/logger')(_0xc26f('0x57'));exports['accept']=function(_0x41e26c,_0x7cb7f9,_0x25bb31){var _0x4a32f2={'agent':{},'channel':_0xc26f('0x58')};if(_0x41e26c[_0xc26f('0x54')]['id']){delete _0x41e26c['body']['id'];}_0x41e26c[_0xc26f('0x54')]['read']=!![];_0x41e26c[_0xc26f('0x54')]['readAt']=moment()['format'](_0xc26f('0x59'));_0x41e26c[_0xc26f('0x54')][_0xc26f('0x5a')]=_0x41e26c[_0xc26f('0x54')][_0xc26f('0x5a')]||_0x41e26c['user']['id'];_0x4a32f2[_0xc26f('0x5b')]['id']=_0x41e26c['body']['UserId'];return db['ChatMessage'][_0xc26f('0x52')]({'where':{'id':_0x41e26c[_0xc26f('0x4f')]['id'],'UserId':null}})[_0xc26f('0x32')](handleEntityNotFound(_0x7cb7f9,null))[_0xc26f('0x32')](saveUpdates(_0x41e26c['body'],null))[_0xc26f('0x32')](function(_0x5a23d6){if(_0x5a23d6){_0x4a32f2[_0xc26f('0x24')]=_0x5a23d6['get']({'plain':!![]});return db[_0xc26f('0x5c')][_0xc26f('0x52')]({'where':{'id':_0x5a23d6['ChatInteractionId']}});}return null;})[_0xc26f('0x32')](handleEntityNotFound(_0x7cb7f9,null))[_0xc26f('0x32')](function(_0x52e8a6){if(_0x52e8a6){return _0x52e8a6[_0xc26f('0x31')]({'UserId':_0x41e26c[_0xc26f('0x54')][_0xc26f('0x5a')],'read1stAt':_['isNil'](_0x52e8a6['read1stAt'])?moment()[_0xc26f('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc26f('0x32')](function(_0x34ae91){if(_0x34ae91){_0x4a32f2[_0xc26f('0x5e')]=_0x34ae91[_0xc26f('0x5f')]({'plain':!![]});interaction_log[_0xc26f('0x1c')](_0xc26f('0x60'),_0x41e26c[_0xc26f('0x61')]['id'],_0x41e26c[_0xc26f('0x61')][_0xc26f('0x36')],_0x41e26c['user'][_0xc26f('0x62')],_0x4a32f2[_0xc26f('0x5e')]['id'],_0x41e26c[_0xc26f('0x54')]?JSON[_0xc26f('0x20')](_0x41e26c[_0xc26f('0x54')]):'null');return respondWithRpcPromise(_0xc26f('0x63'),'acceptMessage',_0x4a32f2);}return null;})[_0xc26f('0x32')](function(_0x5c44e2){var _0x1802b5=_0xc26f('0x64')+_0x5c44e2[_0xc26f('0x24')][_0xc26f('0x65')];return db['sequelize'][_0xc26f('0x3c')](_0x1802b5,{'type':db['Sequelize']['QueryTypes'][_0xc26f('0x66')],'raw':!![]})['then'](function(_0x391af2){return _0x391af2;});})[_0xc26f('0x32')](function(_0x21f848){if(_0x21f848){_0x4a32f2['message'][_0xc26f('0x67')]=_0x21f848[0x0];if(!_0x41e26c['body']['UserId'])return;return db[_0xc26f('0x68')]['find']({'where':{'id':_0x41e26c[_0xc26f('0x54')]['UserId'],'role':_0xc26f('0x5b')},'attributes':['id','name',_0xc26f('0x69'),_0xc26f('0x6a'),_0xc26f('0x6b')],'raw':!![]});}return null;})[_0xc26f('0x32')](function(_0x5917f7){if(!_0x5917f7)return null;_0x4a32f2[_0xc26f('0x24')][_0xc26f('0x5b')]=_0x5917f7;return _0x4a32f2;})[_0xc26f('0x32')](function(_0xe9d645){if(_0xe9d645){if(_0x41e26c[_0xc26f('0x54')][_0xc26f('0x6c')]){_0x4a32f2[_0xc26f('0x24')][_0xc26f('0x6d')]=util[_0xc26f('0x5d')](_0xc26f('0x6e'),_0x41e26c[_0xc26f('0x61')][_0xc26f('0x36')]);_0x4a32f2['message'][_0xc26f('0x6f')]=_0x4a32f2[_0xc26f('0x6f')];_0x4a32f2[_0xc26f('0x24')][_0xc26f('0x70')]=_0x4a32f2[_0xc26f('0x6f')];_0x4a32f2['message'][_0xc26f('0x71')]='accept';return respondWithRpcPromise(_0xc26f('0x72'),_0xc26f('0x72'),{'event':_0xc26f('0x73'),'message':_[_0xc26f('0x46')](_0x4a32f2['message'],JSON[_0xc26f('0x74')](_0x4a32f2['interaction'][_0xc26f('0x75')]))},client9002)[_0xc26f('0x32')](function(){return _0x4a32f2;});}return _0x4a32f2;}return null;})[_0xc26f('0x32')](respondWithResult(_0x7cb7f9,null))[_0xc26f('0x26')](handleError(_0x7cb7f9,null));};var interaction_log=require(_0xc26f('0x76'))('chat-interactions');exports[_0xc26f('0x2f')]=function(_0x3317f3,_0xbac5c7,_0x5e6396){var _0x4559d9={'agent':{},'channel':_0xc26f('0x58')};if(_0x3317f3['body']['id']){delete _0x3317f3[_0xc26f('0x54')]['id'];}_0x3317f3['body'][_0xc26f('0x5a')]=_0x3317f3[_0xc26f('0x54')]['UserId']||_0x3317f3['user']['id'];_0x4559d9[_0xc26f('0x5b')]['id']=_0x3317f3[_0xc26f('0x54')][_0xc26f('0x5a')];return db[_0xc26f('0x39')]['find']({'where':{'id':_0x3317f3['params']['id'],'UserId':null}})[_0xc26f('0x32')](handleEntityNotFound(_0xbac5c7,null))[_0xc26f('0x32')](function(_0x1a6499){if(_0x1a6499){_0x4559d9['message']=_0x1a6499[_0xc26f('0x5f')]({'plain':!![]});return db[_0xc26f('0x5c')][_0xc26f('0x52')]({'where':{'id':_0x1a6499[_0xc26f('0x77')]}});}return null;})[_0xc26f('0x32')](handleEntityNotFound(_0xbac5c7,null))[_0xc26f('0x32')](function(_0x2913b6){if(_0x2913b6){_0x4559d9[_0xc26f('0x5e')]=_0x2913b6[_0xc26f('0x5f')]({'plain':!![]});interaction_log[_0xc26f('0x1c')](_0xc26f('0x78'),_0x3317f3[_0xc26f('0x61')]['id'],_0x3317f3['user'][_0xc26f('0x36')],_0x3317f3[_0xc26f('0x61')][_0xc26f('0x62')],_0x4559d9['interaction']['id'],_0x3317f3[_0xc26f('0x54')]?JSON[_0xc26f('0x20')](_0x3317f3[_0xc26f('0x54')]):_0xc26f('0x79'));return respondWithRpcPromise(_0xc26f('0x7a'),_0xc26f('0x7b'),_0x4559d9);}return null;})[_0xc26f('0x32')](function(_0x5f2eb1){var _0x5eb2df=_0xc26f('0x64')+_0x5f2eb1[_0xc26f('0x24')]['ContactId'];return db[_0xc26f('0x7c')][_0xc26f('0x3c')](_0x5eb2df,{'type':db[_0xc26f('0x7d')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x44265a){return _0x44265a;});})[_0xc26f('0x32')](function(_0x213832){if(_0x213832){_0x4559d9['message']['contact']=_0x213832[0x0];if(!_0x3317f3[_0xc26f('0x54')][_0xc26f('0x5a')])return;return db[_0xc26f('0x68')][_0xc26f('0x52')]({'where':{'id':_0x3317f3[_0xc26f('0x54')][_0xc26f('0x5a')],'role':_0xc26f('0x5b')},'attributes':['id',_0xc26f('0x36'),_0xc26f('0x69'),_0xc26f('0x6a'),'internal'],'raw':!![]});}return null;})[_0xc26f('0x32')](function(_0x547447){if(!_0x547447)return null;_0x4559d9[_0xc26f('0x24')]['agent']=_0x547447;return _0x4559d9;})[_0xc26f('0x32')](function(_0x95dedc){if(_0x95dedc){_0x95dedc['message'][_0xc26f('0x6d')]=util[_0xc26f('0x5d')](_0xc26f('0x6e'),_0x3317f3[_0xc26f('0x61')][_0xc26f('0x36')]);_0x95dedc['message'][_0xc26f('0x6f')]=_0x4559d9[_0xc26f('0x6f')];_0x95dedc['message'][_0xc26f('0x70')]=_0x4559d9[_0xc26f('0x6f')];_0x95dedc[_0xc26f('0x24')][_0xc26f('0x71')]=_0xc26f('0x2f');respondWithRpcPromise(_0xc26f('0x72'),_0xc26f('0x72'),{'event':_0xc26f('0x7e'),'message':_[_0xc26f('0x46')](_0x4559d9['message'],JSON['parse'](_0x4559d9[_0xc26f('0x5e')][_0xc26f('0x75')]))},client9002);return _0x4559d9;}return null;})[_0xc26f('0x32')](respondWithResult(_0xbac5c7,null))[_0xc26f('0x26')](handleError(_0xbac5c7,null));}; \ No newline at end of file +var _0x840d=['ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','destroy','stack','name','send','map','ChatMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','rows','catch','params','options','find','create','body','describe','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','internal','agent','channel','motionChannel','EventManager','acceptmessage','formData','chat-interactions','reject','RejectMessage','rejectMessage','QueryTypes','User','interface','SIP/%s','event','parse','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','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','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x840d,0x1ee));var _0xd840=function(_0x16ea52,_0x55b51d){_0x16ea52=_0x16ea52-0x0;var _0x4becf5=_0x840d[_0x16ea52];return _0x4becf5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd840('0x0'));var jsonpatch=require(_0xd840('0x1'));var rp=require(_0xd840('0x2'));var moment=require('moment');var BPromise=require(_0xd840('0x3'));var Mustache=require(_0xd840('0x4'));var util=require('util');var path=require(_0xd840('0x5'));var sox=require(_0xd840('0x6'));var csv=require(_0xd840('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd840('0x8'));var _=require(_0xd840('0x9'));var squel=require(_0xd840('0xa'));var crypto=require('crypto');var jsforce=require(_0xd840('0xb'));var deskjs=require(_0xd840('0xc'));var toCsv=require(_0xd840('0x7'));var querystring=require(_0xd840('0xd'));var Papa=require(_0xd840('0xe'));var Redis=require(_0xd840('0xf'));var authService=require(_0xd840('0x10'));var qs=require(_0xd840('0x11'));var as=require(_0xd840('0x12'));var hardwareService=require(_0xd840('0x13'));var logger=require(_0xd840('0x14'))(_0xd840('0x15'));var utils=require(_0xd840('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd840('0x17'))['db'];config[_0xd840('0x18')]=_[_0xd840('0x19')](config['redis'],{'host':_0xd840('0x1a'),'port':0x18eb});var socket=require(_0xd840('0x1b'))(new Redis(config[_0xd840('0x18')]));require(_0xd840('0x1c'))[_0xd840('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd840('0x1e')][_0xd840('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xd840('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x569f87,_0x1de01b,_0x2bc2bb,_0x366c73){return new BPromise(function(_0x200aba,_0x2c40fd){var _0x2b31d0=_0x366c73||client;return _0x2b31d0[_0xd840('0x20')](_0x569f87,_0x2bc2bb)[_0xd840('0x21')](function(_0x3e346b){logger['info'](_0xd840('0x22'),_0x1de01b,'request\x20sent');logger[_0xd840('0x23')](_0xd840('0x24'),_0x1de01b,_0xd840('0x25'),JSON['stringify'](_0x3e346b));if(_0x3e346b['error']){if(_0x3e346b[_0xd840('0x26')]['code']===0x1f4){logger['error'](_0xd840('0x22'),_0x1de01b,_0x3e346b[_0xd840('0x26')][_0xd840('0x27')]);return _0x2c40fd(_0x3e346b['error']['message']);}logger[_0xd840('0x26')](_0xd840('0x22'),_0x1de01b,_0x3e346b[_0xd840('0x26')]['message']);return _0x200aba(_0x3e346b[_0xd840('0x26')][_0xd840('0x27')]);}else{logger[_0xd840('0x28')]('ChatMessage,\x20%s,\x20%s',_0x1de01b,_0xd840('0x25'));_0x200aba(_0x3e346b[_0xd840('0x29')][_0xd840('0x27')]);}})['catch'](function(_0x487879){logger[_0xd840('0x26')](_0xd840('0x22'),_0x1de01b,_0x487879);_0x2c40fd(_0x487879);});});}function respondWithStatusCode(_0x5cdafc,_0x3f2ec5){_0x3f2ec5=_0x3f2ec5||0xcc;return function(_0x5891c){if(_0x5891c){return _0x5cdafc[_0xd840('0x2a')](_0x3f2ec5);}return _0x5cdafc[_0xd840('0x2b')](_0x3f2ec5)[_0xd840('0x2c')]();};}function respondWithResult(_0x4fa7ec,_0x366f98){_0x366f98=_0x366f98||0xc8;return function(_0x596f0a){if(_0x596f0a){return _0x4fa7ec[_0xd840('0x2b')](_0x366f98)[_0xd840('0x2d')](_0x596f0a);}};}function respondWithFilteredResult(_0x590c6b,_0x5175cc){return function(_0x2ad471){if(_0x2ad471){var _0x5af3d3=typeof _0x5175cc[_0xd840('0x2e')]===_0xd840('0x2f')&&typeof _0x5175cc['limit']===_0xd840('0x2f');var _0x5f44a5=_0x2ad471['count'];var _0x46c6c9=_0x5af3d3?0x0:_0x5175cc['offset'];var _0x1d1181=_0x5af3d3?_0x2ad471[_0xd840('0x30')]:_0x5175cc[_0xd840('0x2e')]+_0x5175cc['limit'];var _0x1ec389;if(_0x1d1181>=_0x5f44a5){_0x1d1181=_0x5f44a5;_0x1ec389=0xc8;}else{_0x1ec389=0xce;}_0x590c6b[_0xd840('0x2b')](_0x1ec389);return _0x590c6b[_0xd840('0x31')](_0xd840('0x32'),_0x46c6c9+'-'+_0x1d1181+'/'+_0x5f44a5)['json'](_0x2ad471);}return null;};}function patchUpdates(_0x4014a4){return function(_0x2e48b0){try{jsonpatch[_0xd840('0x33')](_0x2e48b0,_0x4014a4,!![]);}catch(_0x119a15){return BPromise['reject'](_0x119a15);}return _0x2e48b0[_0xd840('0x34')]();};}function saveUpdates(_0x3b4d86,_0x54ea6a){return function(_0x1b88df){if(_0x1b88df){return _0x1b88df[_0xd840('0x35')](_0x3b4d86)[_0xd840('0x21')](function(_0x2a4918){return _0x2a4918;});}return null;};}function removeEntity(_0x3be409,_0x1224aa){return function(_0x1994a3){if(_0x1994a3){return _0x1994a3[_0xd840('0x36')]()['then'](function(){_0x3be409[_0xd840('0x2b')](0xcc)[_0xd840('0x2c')]();});}};}function handleEntityNotFound(_0xc4e287,_0x4af24a){return function(_0x43c53e){if(!_0x43c53e){_0xc4e287[_0xd840('0x2a')](0x194);}return _0x43c53e;};}function handleError(_0x32c9f,_0x6c4ed6){_0x6c4ed6=_0x6c4ed6||0x1f4;return function(_0x238899){logger['error'](_0x238899[_0xd840('0x37')]);if(_0x238899[_0xd840('0x38')]){delete _0x238899[_0xd840('0x38')];}_0x32c9f[_0xd840('0x2b')](_0x6c4ed6)[_0xd840('0x39')](_0x238899);};}exports['index']=function(_0x339064,_0x2bbb22){var _0x45820b={},_0x5ee459={},_0x8107ab={'count':0x0,'rows':[]};var _0x5035fe=_[_0xd840('0x3a')](db[_0xd840('0x3b')][_0xd840('0x3c')],function(_0x5e5ece){return{'name':_0x5e5ece[_0xd840('0x3d')],'type':_0x5e5ece['type'][_0xd840('0x3e')]};});_0x5ee459[_0xd840('0x3f')]=_[_0xd840('0x3a')](_0x5035fe,_0xd840('0x38'));_0x5ee459[_0xd840('0x40')]=_[_0xd840('0x41')](_0x339064[_0xd840('0x40')]);_0x5ee459[_0xd840('0x42')]=_['intersection'](_0x5ee459[_0xd840('0x3f')],_0x5ee459[_0xd840('0x40')]);_0x45820b['attributes']=_[_0xd840('0x43')](_0x5ee459[_0xd840('0x3f')],qs['fields'](_0x339064[_0xd840('0x40')][_0xd840('0x44')]));_0x45820b['attributes']=_0x45820b[_0xd840('0x45')][_0xd840('0x46')]?_0x45820b[_0xd840('0x45')]:_0x5ee459[_0xd840('0x3f')];if(!_0x339064[_0xd840('0x40')][_0xd840('0x47')]('nolimit')){_0x45820b[_0xd840('0x48')]=qs[_0xd840('0x48')](_0x339064['query']['limit']);_0x45820b[_0xd840('0x2e')]=qs[_0xd840('0x2e')](_0x339064[_0xd840('0x40')][_0xd840('0x2e')]);}_0x45820b[_0xd840('0x49')]=qs[_0xd840('0x4a')](_0x339064['query'][_0xd840('0x4a')]);_0x45820b[_0xd840('0x4b')]=qs[_0xd840('0x42')](_[_0xd840('0x4c')](_0x339064['query'],_0x5ee459[_0xd840('0x42')]),_0x5035fe);if(_0x339064[_0xd840('0x40')]['filter']){_0x45820b[_0xd840('0x4b')]=_[_0xd840('0x4d')](_0x45820b[_0xd840('0x4b')],{'$or':_[_0xd840('0x3a')](_0x5035fe,function(_0x269cb0){if(_0x269cb0['type']!==_0xd840('0x4e')){var _0x5b0d44={};_0x5b0d44[_0x269cb0[_0xd840('0x38')]]={'$like':'%'+_0x339064['query']['filter']+'%'};return _0x5b0d44;}})});}_0x45820b=_[_0xd840('0x4d')]({},_0x45820b,_0x339064['options']);var _0x50a7e2={'where':_0x45820b[_0xd840('0x4b')]};return db[_0xd840('0x3b')][_0xd840('0x30')](_0x50a7e2)['then'](function(_0x1a2be4){_0x8107ab[_0xd840('0x30')]=_0x1a2be4;if(_0x339064[_0xd840('0x40')][_0xd840('0x4f')]){_0x45820b[_0xd840('0x50')]=[{'all':!![]}];}return db[_0xd840('0x3b')]['findAll'](_0x45820b);})['then'](function(_0x2c14b1){_0x8107ab[_0xd840('0x51')]=_0x2c14b1;return _0x8107ab;})['then'](respondWithFilteredResult(_0x2bbb22,_0x45820b))[_0xd840('0x52')](handleError(_0x2bbb22,null));};exports['show']=function(_0x550505,_0x17bb2b){var _0x3d722f={'raw':!![],'where':{'id':_0x550505[_0xd840('0x53')]['id']}},_0x5044db={};_0x5044db[_0xd840('0x3f')]=_['keys'](db['ChatMessage'][_0xd840('0x3c')]);_0x5044db[_0xd840('0x40')]=_[_0xd840('0x41')](_0x550505[_0xd840('0x40')]);_0x5044db[_0xd840('0x42')]=_[_0xd840('0x43')](_0x5044db['model'],_0x5044db[_0xd840('0x40')]);_0x3d722f[_0xd840('0x45')]=_[_0xd840('0x43')](_0x5044db['model'],qs[_0xd840('0x44')](_0x550505[_0xd840('0x40')][_0xd840('0x44')]));_0x3d722f['attributes']=_0x3d722f['attributes']['length']?_0x3d722f['attributes']:_0x5044db[_0xd840('0x3f')];if(_0x550505['query'][_0xd840('0x4f')]){_0x3d722f[_0xd840('0x50')]=[{'all':!![]}];}_0x3d722f=_[_0xd840('0x4d')]({},_0x3d722f,_0x550505[_0xd840('0x54')]);return db[_0xd840('0x3b')][_0xd840('0x55')](_0x3d722f)['then'](handleEntityNotFound(_0x17bb2b,null))[_0xd840('0x21')](respondWithResult(_0x17bb2b,null))[_0xd840('0x52')](handleError(_0x17bb2b,null));};exports[_0xd840('0x56')]=function(_0x34bcf2,_0x422f74){return db[_0xd840('0x3b')][_0xd840('0x56')](_0x34bcf2[_0xd840('0x57')],{})[_0xd840('0x21')](respondWithResult(_0x422f74,0xc9))[_0xd840('0x52')](handleError(_0x422f74,null));};exports['update']=function(_0x2ebdfe,_0x3fde03){if(_0x2ebdfe[_0xd840('0x57')]['id']){delete _0x2ebdfe[_0xd840('0x57')]['id'];}return db[_0xd840('0x3b')][_0xd840('0x55')]({'where':{'id':_0x2ebdfe[_0xd840('0x53')]['id']}})[_0xd840('0x21')](handleEntityNotFound(_0x3fde03,null))[_0xd840('0x21')](saveUpdates(_0x2ebdfe['body'],null))['then'](respondWithResult(_0x3fde03,null))[_0xd840('0x52')](handleError(_0x3fde03,null));};exports['destroy']=function(_0xbe6680,_0x21a726){return db['ChatMessage'][_0xd840('0x55')]({'where':{'id':_0xbe6680[_0xd840('0x53')]['id']}})['then'](handleEntityNotFound(_0x21a726,null))[_0xd840('0x21')](removeEntity(_0x21a726,null))[_0xd840('0x52')](handleError(_0x21a726,null));};exports[_0xd840('0x58')]=function(_0x34910e,_0x4cd4ca){return db[_0xd840('0x3b')][_0xd840('0x58')]()[_0xd840('0x21')](respondWithResult(_0x4cd4ca,null))['catch'](handleError(_0x4cd4ca,null));};var interaction_log=require(_0xd840('0x14'))('chat-interactions');exports[_0xd840('0x59')]=function(_0x1f1c75,_0x3baa23,_0x430943){var _0x1005b5={'agent':{},'channel':_0xd840('0x5a')};if(_0x1f1c75[_0xd840('0x57')]['id']){delete _0x1f1c75['body']['id'];}_0x1f1c75[_0xd840('0x57')][_0xd840('0x5b')]=!![];_0x1f1c75[_0xd840('0x57')][_0xd840('0x5c')]=moment()[_0xd840('0x5d')](_0xd840('0x5e'));_0x1f1c75[_0xd840('0x57')]['UserId']=_0x1f1c75[_0xd840('0x57')][_0xd840('0x5f')]||_0x1f1c75[_0xd840('0x60')]['id'];_0x1005b5['agent']['id']=_0x1f1c75[_0xd840('0x57')]['UserId'];return db[_0xd840('0x3b')][_0xd840('0x55')]({'where':{'id':_0x1f1c75[_0xd840('0x53')]['id'],'UserId':null}})[_0xd840('0x21')](handleEntityNotFound(_0x3baa23,null))[_0xd840('0x21')](saveUpdates(_0x1f1c75[_0xd840('0x57')],null))[_0xd840('0x21')](function(_0x1cc6e7){if(_0x1cc6e7){_0x1005b5['message']=_0x1cc6e7[_0xd840('0x61')]({'plain':!![]});return db[_0xd840('0x62')][_0xd840('0x55')]({'where':{'id':_0x1cc6e7[_0xd840('0x63')]}});}return null;})[_0xd840('0x21')](handleEntityNotFound(_0x3baa23,null))[_0xd840('0x21')](function(_0x1a5e95){if(_0x1a5e95){return _0x1a5e95[_0xd840('0x35')]({'UserId':_0x1f1c75[_0xd840('0x57')]['UserId'],'read1stAt':_[_0xd840('0x64')](_0x1a5e95['read1stAt'])?moment()[_0xd840('0x5d')](_0xd840('0x5e')):undefined});}return null;})[_0xd840('0x21')](function(_0x3ba0de){if(_0x3ba0de){_0x1005b5[_0xd840('0x65')]=_0x3ba0de[_0xd840('0x61')]({'plain':!![]});interaction_log[_0xd840('0x28')](_0xd840('0x66'),_0x1f1c75[_0xd840('0x60')]['id'],_0x1f1c75[_0xd840('0x60')][_0xd840('0x38')],_0x1f1c75[_0xd840('0x60')][_0xd840('0x67')],_0x1005b5[_0xd840('0x65')]['id'],_0x1f1c75[_0xd840('0x57')]?JSON[_0xd840('0x68')](_0x1f1c75[_0xd840('0x57')]):_0xd840('0x69'));return respondWithRpcPromise(_0xd840('0x6a'),'acceptMessage',_0x1005b5);}return null;})[_0xd840('0x21')](function(_0x1db597){var _0x36d362=_0xd840('0x6b')+_0x1db597[_0xd840('0x27')][_0xd840('0x6c')];return db[_0xd840('0x6d')][_0xd840('0x40')](_0x36d362,{'type':db[_0xd840('0x6e')]['QueryTypes'][_0xd840('0x6f')],'raw':!![]})[_0xd840('0x21')](function(_0xe5dc3e){return _0xe5dc3e;});})['then'](function(_0x403c0a){if(_0x403c0a){_0x1005b5[_0xd840('0x27')][_0xd840('0x70')]=_0x403c0a[0x0];if(!_0x1f1c75[_0xd840('0x57')][_0xd840('0x5f')])return;return db['User'][_0xd840('0x55')]({'where':{'id':_0x1f1c75['body'][_0xd840('0x5f')],'role':'agent'},'attributes':['id',_0xd840('0x38'),_0xd840('0x71'),_0xd840('0x72'),_0xd840('0x73')],'raw':!![]});}return null;})[_0xd840('0x21')](function(_0x3e889a){if(!_0x3e889a)return null;_0x1005b5[_0xd840('0x27')][_0xd840('0x74')]=_0x3e889a;return _0x1005b5;})[_0xd840('0x21')](function(_0x5ea18d){if(_0x5ea18d){if(_0x1f1c75[_0xd840('0x57')]['manual']){_0x1005b5[_0xd840('0x27')]['interface']=util['format']('SIP/%s',_0x1f1c75['user'][_0xd840('0x38')]);_0x1005b5[_0xd840('0x27')][_0xd840('0x75')]=_0x1005b5['channel'];_0x1005b5[_0xd840('0x27')][_0xd840('0x76')]=_0x1005b5[_0xd840('0x75')];_0x1005b5['message']['event']=_0xd840('0x59');return respondWithRpcPromise(_0xd840('0x77'),_0xd840('0x77'),{'event':_0xd840('0x78'),'message':_['merge'](_0x1005b5[_0xd840('0x27')],JSON['parse'](_0x1005b5[_0xd840('0x65')][_0xd840('0x79')]))},client9002)[_0xd840('0x21')](function(){return _0x1005b5;});}return _0x1005b5;}return null;})['then'](respondWithResult(_0x3baa23,null))['catch'](handleError(_0x3baa23,null));};var interaction_log=require(_0xd840('0x14'))(_0xd840('0x7a'));exports[_0xd840('0x7b')]=function(_0x390946,_0x3ab888,_0x427e5){var _0x473dad={'agent':{},'channel':'chat'};if(_0x390946[_0xd840('0x57')]['id']){delete _0x390946['body']['id'];}_0x390946['body'][_0xd840('0x5f')]=_0x390946[_0xd840('0x57')][_0xd840('0x5f')]||_0x390946[_0xd840('0x60')]['id'];_0x473dad[_0xd840('0x74')]['id']=_0x390946[_0xd840('0x57')]['UserId'];return db[_0xd840('0x3b')][_0xd840('0x55')]({'where':{'id':_0x390946[_0xd840('0x53')]['id'],'UserId':null}})[_0xd840('0x21')](handleEntityNotFound(_0x3ab888,null))[_0xd840('0x21')](function(_0x1a1164){if(_0x1a1164){_0x473dad[_0xd840('0x27')]=_0x1a1164[_0xd840('0x61')]({'plain':!![]});return db['ChatInteraction'][_0xd840('0x55')]({'where':{'id':_0x1a1164[_0xd840('0x63')]}});}return null;})[_0xd840('0x21')](handleEntityNotFound(_0x3ab888,null))[_0xd840('0x21')](function(_0x5b7e65){if(_0x5b7e65){_0x473dad[_0xd840('0x65')]=_0x5b7e65[_0xd840('0x61')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x390946[_0xd840('0x60')]['id'],_0x390946['user'][_0xd840('0x38')],_0x390946[_0xd840('0x60')][_0xd840('0x67')],_0x473dad[_0xd840('0x65')]['id'],_0x390946[_0xd840('0x57')]?JSON[_0xd840('0x68')](_0x390946[_0xd840('0x57')]):_0xd840('0x69'));return respondWithRpcPromise(_0xd840('0x7c'),_0xd840('0x7d'),_0x473dad);}return null;})['then'](function(_0x350178){var _0x21fb25=_0xd840('0x6b')+_0x350178[_0xd840('0x27')][_0xd840('0x6c')];return db['sequelize']['query'](_0x21fb25,{'type':db[_0xd840('0x6e')][_0xd840('0x7e')][_0xd840('0x6f')],'raw':!![]})[_0xd840('0x21')](function(_0x54c73a){return _0x54c73a;});})[_0xd840('0x21')](function(_0x378a94){if(_0x378a94){_0x473dad[_0xd840('0x27')][_0xd840('0x70')]=_0x378a94[0x0];if(!_0x390946[_0xd840('0x57')][_0xd840('0x5f')])return;return db[_0xd840('0x7f')][_0xd840('0x55')]({'where':{'id':_0x390946[_0xd840('0x57')][_0xd840('0x5f')],'role':'agent'},'attributes':['id',_0xd840('0x38'),_0xd840('0x71'),_0xd840('0x72'),_0xd840('0x73')],'raw':!![]});}return null;})[_0xd840('0x21')](function(_0xa421fb){if(!_0xa421fb)return null;_0x473dad[_0xd840('0x27')]['agent']=_0xa421fb;return _0x473dad;})[_0xd840('0x21')](function(_0x36c3ad){if(_0x36c3ad){_0x36c3ad['message'][_0xd840('0x80')]=util[_0xd840('0x5d')](_0xd840('0x81'),_0x390946['user']['name']);_0x36c3ad[_0xd840('0x27')][_0xd840('0x75')]=_0x473dad[_0xd840('0x75')];_0x36c3ad['message'][_0xd840('0x76')]=_0x473dad[_0xd840('0x75')];_0x36c3ad[_0xd840('0x27')][_0xd840('0x82')]=_0xd840('0x7b');respondWithRpcPromise('EventManager',_0xd840('0x77'),{'event':'rejectmessage','message':_[_0xd840('0x4d')](_0x473dad[_0xd840('0x27')],JSON[_0xd840('0x83')](_0x473dad[_0xd840('0x65')][_0xd840('0x79')]))},client9002);return _0x473dad;}return null;})[_0xd840('0x21')](respondWithResult(_0x3ab888,null))[_0xd840('0x52')](handleError(_0x3ab888,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 9020993..46e69ad 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 _0xfd5c=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xfd5c,0x12d));var _0xcfd5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd5c[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xcfd5('0x0'));var ChatMessage=require(_0xcfd5('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xcfd5('0x2')](0x0);var events={'afterCreate':_0xcfd5('0x3'),'afterUpdate':_0xcfd5('0x4'),'afterDestroy':_0xcfd5('0x5')};function emitEvent(_0x200cc9){return function(_0x9f195c,_0x2f7b74,_0x3aafc6){ChatMessageEvents['emit'](_0x200cc9+':'+_0x9f195c['id'],_0x9f195c);ChatMessageEvents[_0xcfd5('0x6')](_0x200cc9,_0x9f195c);_0x3aafc6(null);};}for(var e in events){if(events[_0xcfd5('0x7')](e)){var event=events[e];ChatMessage[_0xcfd5('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x5e62=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','save'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x5e62,0x19a));var _0x25e6=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x5e62[_0x1992f1];return _0x413dfe;};'use strict';var EventEmitter=require(_0x25e6('0x0'));var ChatMessage=require(_0x25e6('0x1'))['db'][_0x25e6('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x25e6('0x3'),'afterUpdate':'update','afterDestroy':_0x25e6('0x4')};function emitEvent(_0x12182b){return function(_0x22a832,_0x3d30fd,_0x20f6a2){ChatMessageEvents[_0x25e6('0x5')](_0x12182b+':'+_0x22a832['id'],_0x22a832);ChatMessageEvents[_0x25e6('0x5')](_0x12182b,_0x22a832);_0x20f6a2(null);};}for(var e in events){if(events[_0x25e6('0x6')](e)){var event=events[e];ChatMessage[_0x25e6('0x7')](e,emitEvent(event));}}module[_0x25e6('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 35843c1..4d3a67a 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 _0x324d=['update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','isNil','ChatInteraction','findOne','ChatInteractionId','then'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0x324d,0x170));var _0xd324=function(_0x204d9d,_0x1ccbc3){_0x204d9d=_0x204d9d-0x0;var _0x136cf8=_0x324d[_0x204d9d];return _0x136cf8;};'use strict';var _=require(_0xd324('0x0'));var util=require(_0xd324('0x1'));var logger=require('../../config/logger')(_0xd324('0x2'));var moment=require(_0xd324('0x3'));var BPromise=require(_0xd324('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd324('0x5'));var rimraf=require(_0xd324('0x6'));var config=require(_0xd324('0x7'));var attributes=require(_0xd324('0x8'));module[_0xd324('0x9')]=function(_0x3110d7,_0x42a694){return _0x3110d7['define'](_0xd324('0xa'),attributes,{'tableName':_0xd324('0xb'),'paranoid':![],'indexes':[{'name':_0xd324('0xc'),'fields':['body'],'type':_0xd324('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x6c60d4,_0xa21a59,_0x3eacc7){var _0x395001=_0x3110d7[_0xd324('0xe')];var _0x136cb8=_0x6c60d4[_0xd324('0xf')]({'plain':!![]});if(_0x136cb8[_0xd324('0x10')][_0xd324('0x11')]()==='in'||_0x136cb8['direction'][_0xd324('0x11')]()===_0xd324('0x12')&&!_0x136cb8['secret']&&!_[_0xd324('0x13')](_0x136cb8['UserId'])){_0x395001[_0xd324('0x14')][_0xd324('0x15')]({'where':{'id':_0x136cb8[_0xd324('0x16')]}})[_0xd324('0x17')](function(_0x57d189){if(_0x57d189){_0x57d189[_0xd324('0x18')]({'lastMsgAt':_0x136cb8[_0xd324('0x19')],'lastMsgDirection':_0x136cb8[_0xd324('0x10')]['toLowerCase']()});}})['catch'](function(_0x28cdf0){console['error'](_0x28cdf0);});}_0x3eacc7();}},'charset':_0xd324('0x1a'),'collate':_0xd324('0x1b')});}; \ No newline at end of file +var _0xdc31=['fti_chat_messages','models','get','toLowerCase','direction','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','util','moment','bluebird','../../config/environment','exports','define','ChatMessage','chat_messages'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0xdc31,0x70));var _0x1dc3=function(_0x923d30,_0x25f5f8){_0x923d30=_0x923d30-0x0;var _0x4c346e=_0xdc31[_0x923d30];return _0x4c346e;};'use strict';var _=require('lodash');var util=require(_0x1dc3('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1dc3('0x1'));var BPromise=require(_0x1dc3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1dc3('0x3'));var attributes=require('./chatMessage.attributes');module[_0x1dc3('0x4')]=function(_0x1e6d7d,_0x3f5e1e){return _0x1e6d7d[_0x1dc3('0x5')](_0x1dc3('0x6'),attributes,{'tableName':_0x1dc3('0x7'),'paranoid':![],'indexes':[{'name':_0x1dc3('0x8'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5be786,_0xccc987,_0x829ecb){var _0x28a72e=_0x1e6d7d[_0x1dc3('0x9')];var _0x3f6f2f=_0x5be786[_0x1dc3('0xa')]({'plain':!![]});if(_0x3f6f2f['direction'][_0x1dc3('0xb')]()==='in'||_0x3f6f2f[_0x1dc3('0xc')]['toLowerCase']()===_0x1dc3('0xd')&&!_0x3f6f2f['secret']&&!_[_0x1dc3('0xe')](_0x3f6f2f[_0x1dc3('0xf')])){_0x28a72e[_0x1dc3('0x10')][_0x1dc3('0x11')]({'where':{'id':_0x3f6f2f[_0x1dc3('0x12')]}})[_0x1dc3('0x13')](function(_0x549e3f){if(_0x549e3f){_0x549e3f[_0x1dc3('0x14')]({'lastMsgAt':_0x3f6f2f[_0x1dc3('0x15')],'lastMsgDirection':_0x3f6f2f[_0x1dc3('0xc')][_0x1dc3('0xb')]()});}})[_0x1dc3('0x16')](function(_0x1e28a4){console['error'](_0x1e28a4);});}_0x829ecb();}},'charset':'utf8mb4','collate':_0x1dc3('0x17')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index bbb025e..e31c3f4 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 _0x7198=['client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','result','create','options','raw','debug','CreateChatMessage','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1cb60c,_0x424642){var _0x1d8e2b=function(_0x1d6b6c){while(--_0x1d6b6c){_0x1cb60c['push'](_0x1cb60c['shift']());}};_0x1d8e2b(++_0x424642);}(_0x7198,0x137));var _0x8719=function(_0x4ef1c9,_0x42ee02){_0x4ef1c9=_0x4ef1c9-0x0;var _0x46487c=_0x7198[_0x4ef1c9];return _0x46487c;};'use strict';var _=require(_0x8719('0x0'));var util=require(_0x8719('0x1'));var moment=require(_0x8719('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8719('0x3'));var db=require(_0x8719('0x4'))['db'];var utils=require(_0x8719('0x5'));var logger=require('../../config/logger')(_0x8719('0x6'));var config=require(_0x8719('0x7'));var jayson=require(_0x8719('0x8'));var client=jayson[_0x8719('0x9')][_0x8719('0xa')]({'port':0x232a});config[_0x8719('0xb')]=_['defaults'](config['redis'],{'host':_0x8719('0xc'),'port':0x18eb});var socket=require(_0x8719('0xd'))(new Redis(config[_0x8719('0xb')]));require(_0x8719('0xe'))[_0x8719('0xf')](socket);function respondWithRpcPromise(_0xe8dd7a,_0x4fa12c,_0x47113a){return new BPromise(function(_0x26c7a4,_0x50b60a){return client[_0x8719('0x10')](_0xe8dd7a,_0x47113a)[_0x8719('0x11')](function(_0x2c1c75){logger['info']('ChatMessage,\x20%s,\x20%s',_0x4fa12c,'request\x20sent');logger['debug'](_0x8719('0x12'),_0x4fa12c,_0x8719('0x13'),JSON[_0x8719('0x14')](_0x2c1c75));if(_0x2c1c75[_0x8719('0x15')]){if(_0x2c1c75[_0x8719('0x15')][_0x8719('0x16')]===0x1f4){logger[_0x8719('0x15')](_0x8719('0x17'),_0x4fa12c,_0x2c1c75[_0x8719('0x15')][_0x8719('0x18')]);return _0x50b60a(_0x2c1c75[_0x8719('0x15')][_0x8719('0x18')]);}logger[_0x8719('0x15')]('ChatMessage,\x20%s,\x20%s',_0x4fa12c,_0x2c1c75[_0x8719('0x15')][_0x8719('0x18')]);return _0x26c7a4(_0x2c1c75[_0x8719('0x15')][_0x8719('0x18')]);}else{logger[_0x8719('0x19')](_0x8719('0x17'),_0x4fa12c,_0x8719('0x13'));_0x26c7a4(_0x2c1c75[_0x8719('0x1a')][_0x8719('0x18')]);}})['catch'](function(_0x5bbdb4){logger[_0x8719('0x15')](_0x8719('0x17'),_0x4fa12c,_0x5bbdb4);_0x50b60a(_0x5bbdb4);});});}exports['CreateChatMessage']=function(_0x41581a){var _0x126806=this;return new Promise(function(_0x2cc0d6,_0x3055bc){return db['ChatMessage'][_0x8719('0x1b')](_0x41581a['body'],{'raw':_0x41581a[_0x8719('0x1c')]?_0x41581a[_0x8719('0x1c')][_0x8719('0x1d')]===undefined?!![]:![]:!![]})[_0x8719('0x11')](function(_0x1336f0){logger['info']('CreateChatMessage',_0x41581a);logger[_0x8719('0x1e')](_0x8719('0x1f'),_0x41581a,JSON['stringify'](_0x1336f0));_0x2cc0d6(_0x1336f0);})['catch'](function(_0x3beb49){logger[_0x8719('0x15')](_0x8719('0x1f'),_0x3beb49['message'],_0x41581a);_0x3055bc(_0x126806['error'](0x1f4,_0x3beb49[_0x8719('0x18')]));});});}; \ No newline at end of file +var _0x4cea=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatMessage.socket','info','request\x20sent','debug','stringify','error','ChatMessage,\x20%s,\x20%s','message','catch','CreateChatMessage','ChatMessage','create','options','then','moment','bluebird','randomstring','ioredis'];(function(_0x301e2d,_0x4ee18d){var _0x45637f=function(_0x22b116){while(--_0x22b116){_0x301e2d['push'](_0x301e2d['shift']());}};_0x45637f(++_0x4ee18d);}(_0x4cea,0x130));var _0xa4ce=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4cea[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa4ce('0x0'));var BPromise=require(_0xa4ce('0x1'));var rs=require(_0xa4ce('0x2'));var fs=require('fs');var Redis=require(_0xa4ce('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa4ce('0x4'));var logger=require(_0xa4ce('0x5'))(_0xa4ce('0x6'));var config=require(_0xa4ce('0x7'));var jayson=require(_0xa4ce('0x8'));var client=jayson[_0xa4ce('0x9')][_0xa4ce('0xa')]({'port':0x232a});config[_0xa4ce('0xb')]=_[_0xa4ce('0xc')](config[_0xa4ce('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa4ce('0xd'))(new Redis(config[_0xa4ce('0xb')]));require(_0xa4ce('0xe'))['register'](socket);function respondWithRpcPromise(_0x4aa00a,_0x5e9246,_0x5f02c2){return new BPromise(function(_0x7d81a,_0xabe815){return client['request'](_0x4aa00a,_0x5f02c2)['then'](function(_0x14c3ef){logger[_0xa4ce('0xf')]('ChatMessage,\x20%s,\x20%s',_0x5e9246,_0xa4ce('0x10'));logger[_0xa4ce('0x11')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5e9246,_0xa4ce('0x10'),JSON[_0xa4ce('0x12')](_0x14c3ef));if(_0x14c3ef[_0xa4ce('0x13')]){if(_0x14c3ef['error']['code']===0x1f4){logger[_0xa4ce('0x13')](_0xa4ce('0x14'),_0x5e9246,_0x14c3ef[_0xa4ce('0x13')][_0xa4ce('0x15')]);return _0xabe815(_0x14c3ef[_0xa4ce('0x13')][_0xa4ce('0x15')]);}logger[_0xa4ce('0x13')]('ChatMessage,\x20%s,\x20%s',_0x5e9246,_0x14c3ef[_0xa4ce('0x13')]['message']);return _0x7d81a(_0x14c3ef[_0xa4ce('0x13')][_0xa4ce('0x15')]);}else{logger[_0xa4ce('0xf')](_0xa4ce('0x14'),_0x5e9246,_0xa4ce('0x10'));_0x7d81a(_0x14c3ef['result'][_0xa4ce('0x15')]);}})[_0xa4ce('0x16')](function(_0x304a70){logger[_0xa4ce('0x13')](_0xa4ce('0x14'),_0x5e9246,_0x304a70);_0xabe815(_0x304a70);});});}exports[_0xa4ce('0x17')]=function(_0x250782){var _0xa62ea4=this;return new Promise(function(_0x19aebf,_0x287a6e){return db[_0xa4ce('0x18')][_0xa4ce('0x19')](_0x250782['body'],{'raw':_0x250782[_0xa4ce('0x1a')]?_0x250782[_0xa4ce('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xa4ce('0x1b')](function(_0x373e5a){logger['info'](_0xa4ce('0x17'),_0x250782);logger[_0xa4ce('0x11')](_0xa4ce('0x17'),_0x250782,JSON['stringify'](_0x373e5a));_0x19aebf(_0x373e5a);})[_0xa4ce('0x16')](function(_0xcfc0a){logger[_0xa4ce('0x13')]('CreateChatMessage',_0xcfc0a[_0xa4ce('0x15')],_0x250782);_0x287a6e(_0xa62ea4[_0xa4ce('0x13')](0x1f4,_0xcfc0a['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 6003054..0c56fed 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 _0x8958=['removeListener','length','chatMessage:','save'];(function(_0x386306,_0x1363c9){var _0xcb23d=function(_0x1fc525){while(--_0x1fc525){_0x386306['push'](_0x386306['shift']());}};_0xcb23d(++_0x1363c9);}(_0x8958,0x93));var _0x8895=function(_0x827d61,_0x127d23){_0x827d61=_0x827d61-0x0;var _0x3d2398=_0x8958[_0x827d61];return _0x3d2398;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x8895('0x0'),'remove','update'];function createListener(_0x5baab1,_0x4cea64){return function(_0x418b66){_0x4cea64['emit'](_0x5baab1,_0x418b66);};}function removeListener(_0x38d5d7,_0xce4955){return function(){ChatMessageEvents[_0x8895('0x1')](_0x38d5d7,_0xce4955);};}exports['register']=function(_0x22fa52){for(var _0x2f03ad=0x0,_0x124e1e=events[_0x8895('0x2')];_0x2f03ad<_0x124e1e;_0x2f03ad++){var _0x33013a=events[_0x2f03ad];var _0x51376b=createListener(_0x8895('0x3')+_0x33013a,_0x22fa52);ChatMessageEvents['on'](_0x33013a,_0x51376b);}}; \ No newline at end of file +var _0x0faf=['update','emit','removeListener','length','chatMessage:','./chatMessage.events','remove'];(function(_0x55d70d,_0x32fa55){var _0x41dbc4=function(_0x16c38c){while(--_0x16c38c){_0x55d70d['push'](_0x55d70d['shift']());}};_0x41dbc4(++_0x32fa55);}(_0x0faf,0x132));var _0xf0fa=function(_0x481df5,_0x216652){_0x481df5=_0x481df5-0x0;var _0x32726e=_0x0faf[_0x481df5];return _0x32726e;};'use strict';var ChatMessageEvents=require(_0xf0fa('0x0'));var events=['save',_0xf0fa('0x1'),_0xf0fa('0x2')];function createListener(_0x2c6207,_0x35a260){return function(_0xccb93e){_0x35a260[_0xf0fa('0x3')](_0x2c6207,_0xccb93e);};}function removeListener(_0x515b12,_0xc83253){return function(){ChatMessageEvents[_0xf0fa('0x4')](_0x515b12,_0xc83253);};}exports['register']=function(_0x3637a3){for(var _0x44ffa0=0x0,_0x25b5c4=events[_0xf0fa('0x5')];_0x44ffa0<_0x25b5c4;_0x44ffa0++){var _0x2db1d9=events[_0x44ffa0];var _0x587865=createListener(_0xf0fa('0x6')+_0x2db1d9,_0x3637a3);ChatMessageEvents['on'](_0x2db1d9,_0x587865);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index c211d95..46b9c90 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 _0x06fe=['index','describe','/:id','show','post','chat','chatmessage:create','create','put','update','accept','/:id/reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x06fe,0x147));var _0xe06f=function(_0x2db315,_0x58d720){_0x2db315=_0x2db315-0x0;var _0x12f9a2=_0x06fe[_0x2db315];return _0x12f9a2;};'use strict';var multer=require(_0xe06f('0x0'));var util=require(_0xe06f('0x1'));var path=require(_0xe06f('0x2'));var timeout=require('connect-timeout');var express=require(_0xe06f('0x3'));var router=express[_0xe06f('0x4')]();var fs_extra=require(_0xe06f('0x5'));var auth=require(_0xe06f('0x6'));var interaction=require(_0xe06f('0x7'));var config=require('../../config/environment');var controller=require(_0xe06f('0x8'));router[_0xe06f('0x9')]('/',auth[_0xe06f('0xa')](),controller[_0xe06f('0xb')]);router['get']('/describe',auth[_0xe06f('0xa')](),controller[_0xe06f('0xc')]);router['get'](_0xe06f('0xd'),auth[_0xe06f('0xa')](),controller[_0xe06f('0xe')]);router[_0xe06f('0xf')]('/',auth[_0xe06f('0xa')](),interaction['tracked'](_0xe06f('0x10'),_0xe06f('0x11')),controller[_0xe06f('0x12')]);router[_0xe06f('0x13')]('/:id',controller[_0xe06f('0x14')]);router[_0xe06f('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0xe06f('0x15')]);router['put'](_0xe06f('0x16'),auth[_0xe06f('0xa')](),controller['reject']);router[_0xe06f('0x17')](_0xe06f('0xd'),auth['isAuthenticated'](),controller[_0xe06f('0x18')]);module[_0xe06f('0x19')]=router; \ No newline at end of file +var _0x6c23=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','post','tracked','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router'];(function(_0x1b0a39,_0x409224){var _0x3fe538=function(_0x44e2b7){while(--_0x44e2b7){_0x1b0a39['push'](_0x1b0a39['shift']());}};_0x3fe538(++_0x409224);}(_0x6c23,0x146));var _0x36c2=function(_0x2e7f80,_0x34f38b){_0x2e7f80=_0x2e7f80-0x0;var _0x5837fd=_0x6c23[_0x2e7f80];return _0x5837fd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x36c2('0x0'));var timeout=require(_0x36c2('0x1'));var express=require(_0x36c2('0x2'));var router=express[_0x36c2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x36c2('0x4'));var interaction=require(_0x36c2('0x5'));var config=require(_0x36c2('0x6'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0x36c2('0x7')](),controller['index']);router[_0x36c2('0x8')]('/describe',auth[_0x36c2('0x7')](),controller['describe']);router[_0x36c2('0x8')](_0x36c2('0x9'),auth[_0x36c2('0x7')](),controller['show']);router[_0x36c2('0xa')]('/',auth['isAuthenticated'](),interaction[_0x36c2('0xb')]('chat',_0x36c2('0xc')),controller[_0x36c2('0xd')]);router[_0x36c2('0xe')](_0x36c2('0x9'),controller[_0x36c2('0xf')]);router['put'](_0x36c2('0x10'),auth['isAuthenticated'](),controller[_0x36c2('0x11')]);router[_0x36c2('0xe')](_0x36c2('0x12'),auth['isAuthenticated'](),controller[_0x36c2('0x13')]);router['delete'](_0x36c2('0x9'),auth['isAuthenticated'](),controller[_0x36c2('0x14')]);module[_0x36c2('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index ab43ac4..fd117b6 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 _0x5f66=['medium','TEXT','exports'];(function(_0x47b384,_0x41cb40){var _0x1566ab=function(_0x45d9ed){while(--_0x45d9ed){_0x47b384['push'](_0x47b384['shift']());}};_0x1566ab(++_0x41cb40);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x67c7e2,_0x5f02ee){var _0x52b665=function(_0x16c269){while(--_0x16c269){_0x67c7e2['push'](_0x67c7e2['shift']());}};_0x52b665(++_0x5f02ee);}(_0x2032,0xd9));var _0x2203=function(_0x27b280,_0x125695){_0x27b280=_0x27b280-0x0;var _0x4baa19=_0x2032[_0x27b280];return _0x4baa19;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 4aab937..87e397a 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(_0x425ab5,_0x93aff7){var _0x3c83ab=function(_0x3fbb7b){while(--_0x3fbb7b){_0x425ab5['push'](_0x425ab5['shift']());}};_0x3c83ab(++_0x93aff7);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 _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(_0x5eba04,_0x370ba0){var _0x5078f9=function(_0x3c14c0){while(--_0x3c14c0){_0x5eba04['push'](_0x5eba04['shift']());}};_0x5078f9(++_0x370ba0);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 7a5b8d3..761ef21 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 _0x195f=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x3de239,_0x51af78){var _0x307e62=function(_0x3a2327){while(--_0x3a2327){_0x3de239['push'](_0x3de239['shift']());}};_0x307e62(++_0x51af78);}(_0x195f,0x113));var _0xf195=function(_0x27b423,_0x312583){_0x27b423=_0x27b423-0x0;var _0x5c11b8=_0x195f[_0x27b423];return _0x5c11b8;};'use strict';var EventEmitter=require(_0xf195('0x0'));var ChatOfflineMessage=require(_0xf195('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xf195('0x2')](0x0);var events={'afterCreate':_0xf195('0x3'),'afterUpdate':'update','afterDestroy':_0xf195('0x4')};function emitEvent(_0x52cf31){return function(_0x127a41,_0x349605,_0x189127){ChatOfflineMessageEvents[_0xf195('0x5')](_0x52cf31+':'+_0x127a41['id'],_0x127a41);ChatOfflineMessageEvents[_0xf195('0x5')](_0x52cf31,_0x127a41);_0x189127(null);};}for(var e in events){if(events[_0xf195('0x6')](e)){var event=events[e];ChatOfflineMessage[_0xf195('0x7')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x9e33=['save','update','emit','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners'];(function(_0x39ea42,_0x3c1f50){var _0x33f5b7=function(_0x5d8e73){while(--_0x5d8e73){_0x39ea42['push'](_0x39ea42['shift']());}};_0x33f5b7(++_0x3c1f50);}(_0x9e33,0x144));var _0x39e3=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x9e33[_0x1e3c16];return _0x47a0c9;};'use strict';var EventEmitter=require(_0x39e3('0x0'));var ChatOfflineMessage=require(_0x39e3('0x1'))['db'][_0x39e3('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x39e3('0x3')](0x0);var events={'afterCreate':_0x39e3('0x4'),'afterUpdate':_0x39e3('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4cd538){return function(_0xa933e2,_0x5bdf29,_0x4453d7){ChatOfflineMessageEvents[_0x39e3('0x6')](_0x4cd538+':'+_0xa933e2['id'],_0xa933e2);ChatOfflineMessageEvents[_0x39e3('0x6')](_0x4cd538,_0xa933e2);_0x4453d7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x39e3('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index b214c47..96d011e 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 _0xb06e=['ChatOfflineMessage','chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','define'];(function(_0x504e8c,_0x563d11){var _0xcae156=function(_0x359bb8){while(--_0x359bb8){_0x504e8c['push'](_0x504e8c['shift']());}};_0xcae156(++_0x563d11);}(_0xb06e,0xd0));var _0xeb06=function(_0x434941,_0x4f3659){_0x434941=_0x434941-0x0;var _0x1f0301=_0xb06e[_0x434941];return _0x1f0301;};'use strict';var attributes=require(_0xeb06('0x0'));module['exports']=function(_0x487461){return _0x487461[_0xeb06('0x1')](_0xeb06('0x2'),attributes,{'tableName':_0xeb06('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeb06('0x4'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe5c5=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0xe5c5,0x10f));var _0x5e5c=function(_0x41dc62,_0x29da27){_0x41dc62=_0x41dc62-0x0;var _0x26c53d=_0xe5c5[_0x41dc62];return _0x26c53d;};'use strict';var attributes=require(_0x5e5c('0x0'));module['exports']=function(_0x1d4289){return _0x1d4289[_0x5e5c('0x1')](_0x5e5c('0x2'),attributes,{'tableName':_0x5e5c('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5e5c('0x4'),'collate':_0x5e5c('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 5330997..cb241f4 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 _0xa74c=['request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0xa74c,0x190));var _0xca74=function(_0x5e3905,_0x14f174){_0x5e3905=_0x5e3905-0x0;var _0x490d56=_0xa74c[_0x5e3905];return _0x490d56;};'use strict';var _=require('lodash');var util=require(_0xca74('0x0'));var moment=require(_0xca74('0x1'));var BPromise=require(_0xca74('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca74('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xca74('0x4'))(_0xca74('0x5'));var config=require(_0xca74('0x6'));var jayson=require(_0xca74('0x7'));var client=jayson[_0xca74('0x8')][_0xca74('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25c72d,_0x717f21,_0xaf8aa6){return new BPromise(function(_0x51fd0f,_0x2fd20f){return client[_0xca74('0xa')](_0x25c72d,_0xaf8aa6)[_0xca74('0xb')](function(_0x2b2948){logger[_0xca74('0xc')](_0xca74('0xd'),_0x717f21,_0xca74('0xe'));logger[_0xca74('0xf')](_0xca74('0x10'),_0x717f21,_0xca74('0xe'),JSON[_0xca74('0x11')](_0x2b2948));if(_0x2b2948[_0xca74('0x12')]){if(_0x2b2948[_0xca74('0x12')][_0xca74('0x13')]===0x1f4){logger[_0xca74('0x12')](_0xca74('0xd'),_0x717f21,_0x2b2948[_0xca74('0x12')][_0xca74('0x14')]);return _0x2fd20f(_0x2b2948[_0xca74('0x12')][_0xca74('0x14')]);}logger[_0xca74('0x12')](_0xca74('0xd'),_0x717f21,_0x2b2948['error'][_0xca74('0x14')]);return _0x51fd0f(_0x2b2948['error'][_0xca74('0x14')]);}else{logger[_0xca74('0xc')](_0xca74('0xd'),_0x717f21,_0xca74('0xe'));_0x51fd0f(_0x2b2948[_0xca74('0x15')][_0xca74('0x14')]);}})[_0xca74('0x16')](function(_0x26de5a){logger['error'](_0xca74('0xd'),_0x717f21,_0x26de5a);_0x2fd20f(_0x26de5a);});});} \ No newline at end of file +var _0xa4a7=['info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4d6d5d,_0x43542d){var _0x5dcb15=function(_0x1ddc69){while(--_0x1ddc69){_0x4d6d5d['push'](_0x4d6d5d['shift']());}};_0x5dcb15(++_0x43542d);}(_0xa4a7,0x81));var _0x7a4a=function(_0x1b0b02,_0x2552ef){_0x1b0b02=_0x1b0b02-0x0;var _0x1a8a13=_0xa4a7[_0x1b0b02];return _0x1a8a13;};'use strict';var _=require(_0x7a4a('0x0'));var util=require(_0x7a4a('0x1'));var moment=require(_0x7a4a('0x2'));var BPromise=require('bluebird');var rs=require(_0x7a4a('0x3'));var fs=require('fs');var Redis=require(_0x7a4a('0x4'));var db=require(_0x7a4a('0x5'))['db'];var utils=require(_0x7a4a('0x6'));var logger=require(_0x7a4a('0x7'))(_0x7a4a('0x8'));var config=require(_0x7a4a('0x9'));var jayson=require(_0x7a4a('0xa'));var client=jayson[_0x7a4a('0xb')][_0x7a4a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7ccc76,_0x3466ba,_0x395d4e){return new BPromise(function(_0xcdc27d,_0xb618b9){return client[_0x7a4a('0xd')](_0x7ccc76,_0x395d4e)[_0x7a4a('0xe')](function(_0x4572d3){logger[_0x7a4a('0xf')](_0x7a4a('0x10'),_0x3466ba,_0x7a4a('0x11'));logger[_0x7a4a('0x12')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x3466ba,_0x7a4a('0x11'),JSON[_0x7a4a('0x13')](_0x4572d3));if(_0x4572d3[_0x7a4a('0x14')]){if(_0x4572d3['error'][_0x7a4a('0x15')]===0x1f4){logger[_0x7a4a('0x14')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3466ba,_0x4572d3[_0x7a4a('0x14')][_0x7a4a('0x16')]);return _0xb618b9(_0x4572d3[_0x7a4a('0x14')][_0x7a4a('0x16')]);}logger[_0x7a4a('0x14')](_0x7a4a('0x10'),_0x3466ba,_0x4572d3[_0x7a4a('0x14')][_0x7a4a('0x16')]);return _0xcdc27d(_0x4572d3[_0x7a4a('0x14')][_0x7a4a('0x16')]);}else{logger[_0x7a4a('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3466ba,_0x7a4a('0x11'));_0xcdc27d(_0x4572d3[_0x7a4a('0x17')][_0x7a4a('0x16')]);}})['catch'](function(_0x1e6ea6){logger[_0x7a4a('0x14')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3466ba,_0x1e6ea6);_0xb618b9(_0x1e6ea6);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 4f7950b..e547e9b 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 _0x862c=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','index','isAuthenticated','describe','/:id','post','put'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x862c,0x194));var _0xc862=function(_0x4a46de,_0x134871){_0x4a46de=_0x4a46de-0x0;var _0x1ecb35=_0x862c[_0x4a46de];return _0x1ecb35;};'use strict';var multer=require(_0xc862('0x0'));var util=require(_0xc862('0x1'));var path=require(_0xc862('0x2'));var timeout=require(_0xc862('0x3'));var express=require('express');var router=express[_0xc862('0x4')]();var fs_extra=require(_0xc862('0x5'));var auth=require(_0xc862('0x6'));var interaction=require(_0xc862('0x7'));var config=require('../../config/environment');var controller=require(_0xc862('0x8'));router[_0xc862('0x9')]('/',auth['isAuthenticated'](),controller[_0xc862('0xa')]);router[_0xc862('0x9')]('/describe',auth[_0xc862('0xb')](),controller[_0xc862('0xc')]);router[_0xc862('0x9')](_0xc862('0xd'),auth[_0xc862('0xb')](),controller['show']);router[_0xc862('0xe')]('/',auth[_0xc862('0xb')](),controller['create']);router[_0xc862('0xf')](_0xc862('0xd'),auth[_0xc862('0xb')](),controller[_0xc862('0x10')]);router[_0xc862('0x11')](_0xc862('0xd'),auth[_0xc862('0xb')](),controller[_0xc862('0x12')]);module[_0xc862('0x13')]=router; \ No newline at end of file +var _0x4360=['express','Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5cbdee,_0x595c92){var _0x1f0e6d=function(_0x4876e3){while(--_0x4876e3){_0x5cbdee['push'](_0x5cbdee['shift']());}};_0x1f0e6d(++_0x595c92);}(_0x4360,0xce));var _0x0436=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x4360[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require(_0x0436('0x0'));var util=require(_0x0436('0x1'));var path=require(_0x0436('0x2'));var timeout=require(_0x0436('0x3'));var express=require(_0x0436('0x4'));var router=express[_0x0436('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0436('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0436('0x7'));var controller=require(_0x0436('0x8'));router[_0x0436('0x9')]('/',auth['isAuthenticated'](),controller[_0x0436('0xa')]);router['get'](_0x0436('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x0436('0x9')]('/:id',auth[_0x0436('0xc')](),controller['show']);router[_0x0436('0xd')]('/',auth[_0x0436('0xc')](),controller[_0x0436('0xe')]);router[_0x0436('0xf')](_0x0436('0x10'),auth['isAuthenticated'](),controller[_0x0436('0x11')]);router[_0x0436('0x12')](_0x0436('0x10'),auth['isAuthenticated'](),controller[_0x0436('0x13')]);module[_0x0436('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 4618a9e..75ac061 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 _0x03f4=['sequelize','exports','STRING','timeout','mouseOver'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0x03f4,0xb9));var _0x403f=function(_0xd0ec29,_0x4bfa79){_0xd0ec29=_0xd0ec29-0x0;var _0xd5c0f0=_0x03f4[_0xd0ec29];return _0xd5c0f0;};'use strict';var Sequelize=require(_0x403f('0x0'));module[_0x403f('0x1')]={'name':{'type':Sequelize[_0x403f('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0x403f('0x3')),'defaultValue':_0x403f('0x4')},'selector':{'type':Sequelize[_0x403f('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x74f9=['mouseOver','exports','STRING','ENUM'];(function(_0x1c64b0,_0x57d581){var _0x11ac72=function(_0x1562fd){while(--_0x1562fd){_0x1c64b0['push'](_0x1c64b0['shift']());}};_0x11ac72(++_0x57d581);}(_0x74f9,0x101));var _0x974f=function(_0xf72888,_0x661b9d){_0xf72888=_0xf72888-0x0;var _0x58ed5f=_0x74f9[_0xf72888];return _0x58ed5f;};'use strict';var Sequelize=require('sequelize');module[_0x974f('0x0')]={'name':{'type':Sequelize[_0x974f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x974f('0x2')](_0x974f('0x3'),'timeout'),'defaultValue':_0x974f('0x3')},'selector':{'type':Sequelize[_0x974f('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 26da829..ee8052e 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 _0x544f=['squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','then','destroy','end','error','stack','name','send','show','params','model','keys','ChatProactiveAction','query','filters','attributes','fields','include','merge','options','find','catch','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash'];(function(_0x359968,_0x3af7ce){var _0x582c79=function(_0x5e06ad){while(--_0x5e06ad){_0x359968['push'](_0x359968['shift']());}};_0x582c79(++_0x3af7ce);}(_0x544f,0x14c));var _0xf544=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x544f[_0x20ef64];return _0x3707d8;};'use strict';var emlformat=require(_0xf544('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf544('0x1'));var rp=require(_0xf544('0x2'));var moment=require(_0xf544('0x3'));var BPromise=require(_0xf544('0x4'));var Mustache=require('mustache');var util=require(_0xf544('0x5'));var path=require(_0xf544('0x6'));var sox=require('sox');var csv=require(_0xf544('0x7'));var ejs=require(_0xf544('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf544('0x9'));var squel=require(_0xf544('0xa'));var crypto=require(_0xf544('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf544('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf544('0xd'));var Papa=require('papaparse');var Redis=require(_0xf544('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf544('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf544('0x10'));var logger=require(_0xf544('0x11'))(_0xf544('0x12'));var utils=require(_0xf544('0x13'));var config=require(_0xf544('0x14'));var licenseUtil=require(_0xf544('0x15'));var db=require(_0xf544('0x16'))['db'];function respondWithStatusCode(_0x1cbfbe,_0x580c7f){_0x580c7f=_0x580c7f||0xcc;return function(_0x107096){if(_0x107096){return _0x1cbfbe[_0xf544('0x17')](_0x580c7f);}return _0x1cbfbe['status'](_0x580c7f)['end']();};}function respondWithResult(_0x542d90,_0x1990a6){_0x1990a6=_0x1990a6||0xc8;return function(_0x4cfad1){if(_0x4cfad1){return _0x542d90[_0xf544('0x18')](_0x1990a6)['json'](_0x4cfad1);}};}function respondWithFilteredResult(_0x1c4731,_0x47a009){return function(_0x1065c3){if(_0x1065c3){var _0x262779=typeof _0x47a009[_0xf544('0x19')]==='undefined'&&typeof _0x47a009[_0xf544('0x1a')]===_0xf544('0x1b');var _0x114153=_0x1065c3[_0xf544('0x1c')];var _0x7f64f4=_0x262779?0x0:_0x47a009[_0xf544('0x19')];var _0x1e77f7=_0x262779?_0x1065c3[_0xf544('0x1c')]:_0x47a009[_0xf544('0x19')]+_0x47a009[_0xf544('0x1a')];var _0x1fc7a5;if(_0x1e77f7>=_0x114153){_0x1e77f7=_0x114153;_0x1fc7a5=0xc8;}else{_0x1fc7a5=0xce;}_0x1c4731['status'](_0x1fc7a5);return _0x1c4731[_0xf544('0x1d')](_0xf544('0x1e'),_0x7f64f4+'-'+_0x1e77f7+'/'+_0x114153)[_0xf544('0x1f')](_0x1065c3);}return null;};}function patchUpdates(_0x332995){return function(_0x5aa399){try{jsonpatch['apply'](_0x5aa399,_0x332995,!![]);}catch(_0x27caf0){return BPromise[_0xf544('0x20')](_0x27caf0);}return _0x5aa399[_0xf544('0x21')]();};}function saveUpdates(_0x12f4a8,_0x2ad1a1){return function(_0x4ac9b0){if(_0x4ac9b0){return _0x4ac9b0['update'](_0x12f4a8)[_0xf544('0x22')](function(_0x3cd6ac){return _0x3cd6ac;});}return null;};}function removeEntity(_0x1ddb6e,_0x5b49ba){return function(_0x2a7d18){if(_0x2a7d18){return _0x2a7d18[_0xf544('0x23')]()[_0xf544('0x22')](function(){_0x1ddb6e[_0xf544('0x18')](0xcc)[_0xf544('0x24')]();});}};}function handleEntityNotFound(_0x1aa869,_0x4a1282){return function(_0x2bc1f6){if(!_0x2bc1f6){_0x1aa869['sendStatus'](0x194);}return _0x2bc1f6;};}function handleError(_0x3da4eb,_0x1169f8){_0x1169f8=_0x1169f8||0x1f4;return function(_0x2e3c4d){logger[_0xf544('0x25')](_0x2e3c4d[_0xf544('0x26')]);if(_0x2e3c4d[_0xf544('0x27')]){delete _0x2e3c4d[_0xf544('0x27')];}_0x3da4eb[_0xf544('0x18')](_0x1169f8)[_0xf544('0x28')](_0x2e3c4d);};}exports[_0xf544('0x29')]=function(_0x1ba3d4,_0x161dfc){var _0x5c5fe6={'raw':!![],'where':{'id':_0x1ba3d4[_0xf544('0x2a')]['id']}},_0x341026={};_0x341026[_0xf544('0x2b')]=_[_0xf544('0x2c')](db[_0xf544('0x2d')]['rawAttributes']);_0x341026[_0xf544('0x2e')]=_[_0xf544('0x2c')](_0x1ba3d4[_0xf544('0x2e')]);_0x341026[_0xf544('0x2f')]=_['intersection'](_0x341026[_0xf544('0x2b')],_0x341026['query']);_0x5c5fe6[_0xf544('0x30')]=_['intersection'](_0x341026[_0xf544('0x2b')],qs[_0xf544('0x31')](_0x1ba3d4[_0xf544('0x2e')]['fields']));_0x5c5fe6['attributes']=_0x5c5fe6[_0xf544('0x30')]['length']?_0x5c5fe6[_0xf544('0x30')]:_0x341026[_0xf544('0x2b')];if(_0x1ba3d4['query']['includeAll']){_0x5c5fe6[_0xf544('0x32')]=[{'all':!![]}];}_0x5c5fe6=_[_0xf544('0x33')]({},_0x5c5fe6,_0x1ba3d4[_0xf544('0x34')]);return db[_0xf544('0x2d')][_0xf544('0x35')](_0x5c5fe6)[_0xf544('0x22')](handleEntityNotFound(_0x161dfc,null))[_0xf544('0x22')](respondWithResult(_0x161dfc,null))[_0xf544('0x36')](handleError(_0x161dfc,null));};exports[_0xf544('0x37')]=function(_0xa984ba,_0x3b0124){return db[_0xf544('0x2d')][_0xf544('0x37')](_0xa984ba[_0xf544('0x38')],{})[_0xf544('0x22')](respondWithResult(_0x3b0124,0xc9))['catch'](handleError(_0x3b0124,null));};exports['update']=function(_0x54d2f7,_0xd57a60){if(_0x54d2f7[_0xf544('0x38')]['id']){delete _0x54d2f7[_0xf544('0x38')]['id'];}return db[_0xf544('0x2d')][_0xf544('0x35')]({'where':{'id':_0x54d2f7[_0xf544('0x2a')]['id']}})['then'](handleEntityNotFound(_0xd57a60,null))[_0xf544('0x22')](saveUpdates(_0x54d2f7[_0xf544('0x38')],null))[_0xf544('0x22')](respondWithResult(_0xd57a60,null))[_0xf544('0x36')](handleError(_0xd57a60,null));};exports['destroy']=function(_0x4872e4,_0x4b8aac){return db[_0xf544('0x2d')][_0xf544('0x35')]({'where':{'id':_0x4872e4['params']['id']}})[_0xf544('0x22')](handleEntityNotFound(_0x4b8aac,null))[_0xf544('0x22')](removeEntity(_0x4b8aac,null))[_0xf544('0x36')](handleError(_0x4b8aac,null));}; \ No newline at end of file +var _0x7dfd=['destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','stack','name','send','show','ChatProactiveAction','query','keys','filters','intersection','attributes','model','fields','length','includeAll','include','merge','options','create','catch','body','params'];(function(_0x4548dd,_0x225cd7){var _0x1665bd=function(_0x36b39d){while(--_0x36b39d){_0x4548dd['push'](_0x4548dd['shift']());}};_0x1665bd(++_0x225cd7);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd7df('0x0'));var rimraf=require(_0xd7df('0x1'));var zipdir=require(_0xd7df('0x2'));var jsonpatch=require(_0xd7df('0x3'));var rp=require(_0xd7df('0x4'));var moment=require(_0xd7df('0x5'));var BPromise=require(_0xd7df('0x6'));var Mustache=require(_0xd7df('0x7'));var util=require(_0xd7df('0x8'));var path=require(_0xd7df('0x9'));var sox=require(_0xd7df('0xa'));var csv=require(_0xd7df('0xb'));var ejs=require(_0xd7df('0xc'));var fs=require('fs');var fs_extra=require(_0xd7df('0xd'));var _=require(_0xd7df('0xe'));var squel=require(_0xd7df('0xf'));var crypto=require(_0xd7df('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xd7df('0x11'));var toCsv=require(_0xd7df('0xb'));var querystring=require(_0xd7df('0x12'));var Papa=require(_0xd7df('0x13'));var Redis=require('ioredis');var authService=require(_0xd7df('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd7df('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7df('0x16'))(_0xd7df('0x17'));var utils=require(_0xd7df('0x18'));var config=require(_0xd7df('0x19'));var licenseUtil=require(_0xd7df('0x1a'));var db=require(_0xd7df('0x1b'))['db'];function respondWithStatusCode(_0x2e8187,_0x3da618){_0x3da618=_0x3da618||0xcc;return function(_0x7ba3c){if(_0x7ba3c){return _0x2e8187[_0xd7df('0x1c')](_0x3da618);}return _0x2e8187[_0xd7df('0x1d')](_0x3da618)[_0xd7df('0x1e')]();};}function respondWithResult(_0xe1595f,_0x196632){_0x196632=_0x196632||0xc8;return function(_0x3b2559){if(_0x3b2559){return _0xe1595f[_0xd7df('0x1d')](_0x196632)[_0xd7df('0x1f')](_0x3b2559);}};}function respondWithFilteredResult(_0x57b8be,_0x4c5cf){return function(_0x23cdbc){if(_0x23cdbc){var _0x513b13=typeof _0x4c5cf[_0xd7df('0x20')]===_0xd7df('0x21')&&typeof _0x4c5cf['limit']===_0xd7df('0x21');var _0x30ee65=_0x23cdbc[_0xd7df('0x22')];var _0x5210e5=_0x513b13?0x0:_0x4c5cf[_0xd7df('0x20')];var _0x471621=_0x513b13?_0x23cdbc[_0xd7df('0x22')]:_0x4c5cf['offset']+_0x4c5cf[_0xd7df('0x23')];var _0x20dc3e;if(_0x471621>=_0x30ee65){_0x471621=_0x30ee65;_0x20dc3e=0xc8;}else{_0x20dc3e=0xce;}_0x57b8be[_0xd7df('0x1d')](_0x20dc3e);return _0x57b8be['set'](_0xd7df('0x24'),_0x5210e5+'-'+_0x471621+'/'+_0x30ee65)['json'](_0x23cdbc);}return null;};}function patchUpdates(_0x225e33){return function(_0x5ab737){try{jsonpatch[_0xd7df('0x25')](_0x5ab737,_0x225e33,!![]);}catch(_0x342b54){return BPromise[_0xd7df('0x26')](_0x342b54);}return _0x5ab737['save']();};}function saveUpdates(_0xc50077,_0x502ae8){return function(_0x44079b){if(_0x44079b){return _0x44079b[_0xd7df('0x27')](_0xc50077)[_0xd7df('0x28')](function(_0x29f354){return _0x29f354;});}return null;};}function removeEntity(_0x1c774b,_0xa80cbf){return function(_0x1e3bf3){if(_0x1e3bf3){return _0x1e3bf3['destroy']()['then'](function(){_0x1c774b[_0xd7df('0x1d')](0xcc)[_0xd7df('0x1e')]();});}};}function handleEntityNotFound(_0x26047f,_0x459f11){return function(_0x13f190){if(!_0x13f190){_0x26047f[_0xd7df('0x1c')](0x194);}return _0x13f190;};}function handleError(_0x373359,_0x2b6fde){_0x2b6fde=_0x2b6fde||0x1f4;return function(_0x163904){logger['error'](_0x163904[_0xd7df('0x29')]);if(_0x163904[_0xd7df('0x2a')]){delete _0x163904[_0xd7df('0x2a')];}_0x373359[_0xd7df('0x1d')](_0x2b6fde)[_0xd7df('0x2b')](_0x163904);};}exports[_0xd7df('0x2c')]=function(_0x3f78fa,_0x36de76){var _0x5195cf={'raw':!![],'where':{'id':_0x3f78fa['params']['id']}},_0x4ba779={};_0x4ba779['model']=_['keys'](db[_0xd7df('0x2d')]['rawAttributes']);_0x4ba779[_0xd7df('0x2e')]=_[_0xd7df('0x2f')](_0x3f78fa['query']);_0x4ba779[_0xd7df('0x30')]=_[_0xd7df('0x31')](_0x4ba779['model'],_0x4ba779[_0xd7df('0x2e')]);_0x5195cf[_0xd7df('0x32')]=_[_0xd7df('0x31')](_0x4ba779[_0xd7df('0x33')],qs[_0xd7df('0x34')](_0x3f78fa[_0xd7df('0x2e')]['fields']));_0x5195cf[_0xd7df('0x32')]=_0x5195cf[_0xd7df('0x32')][_0xd7df('0x35')]?_0x5195cf[_0xd7df('0x32')]:_0x4ba779[_0xd7df('0x33')];if(_0x3f78fa[_0xd7df('0x2e')][_0xd7df('0x36')]){_0x5195cf[_0xd7df('0x37')]=[{'all':!![]}];}_0x5195cf=_[_0xd7df('0x38')]({},_0x5195cf,_0x3f78fa[_0xd7df('0x39')]);return db[_0xd7df('0x2d')]['find'](_0x5195cf)['then'](handleEntityNotFound(_0x36de76,null))[_0xd7df('0x28')](respondWithResult(_0x36de76,null))['catch'](handleError(_0x36de76,null));};exports[_0xd7df('0x3a')]=function(_0xab3dd8,_0xa0ed20){return db[_0xd7df('0x2d')]['create'](_0xab3dd8['body'],{})['then'](respondWithResult(_0xa0ed20,0xc9))[_0xd7df('0x3b')](handleError(_0xa0ed20,null));};exports[_0xd7df('0x27')]=function(_0x55c43f,_0x27c57c){if(_0x55c43f[_0xd7df('0x3c')]['id']){delete _0x55c43f[_0xd7df('0x3c')]['id'];}return db[_0xd7df('0x2d')]['find']({'where':{'id':_0x55c43f[_0xd7df('0x3d')]['id']}})[_0xd7df('0x28')](handleEntityNotFound(_0x27c57c,null))['then'](saveUpdates(_0x55c43f[_0xd7df('0x3c')],null))['then'](respondWithResult(_0x27c57c,null))[_0xd7df('0x3b')](handleError(_0x27c57c,null));};exports[_0xd7df('0x3e')]=function(_0x1ed647,_0x59c755){return db[_0xd7df('0x2d')][_0xd7df('0x3f')]({'where':{'id':_0x1ed647[_0xd7df('0x3d')]['id']}})[_0xd7df('0x28')](handleEntityNotFound(_0x59c755,null))['then'](removeEntity(_0x59c755,null))[_0xd7df('0x3b')](handleError(_0x59c755,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 1e796ba..fb8f027 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 _0xf816=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','lodash'];(function(_0x22545d,_0x2fc0bb){var _0x13c84b=function(_0x21a4aa){while(--_0x21a4aa){_0x22545d['push'](_0x22545d['shift']());}};_0x13c84b(++_0x2fc0bb);}(_0xf816,0xbf));var _0x6f81=function(_0xe1dafe,_0x47c69d){_0xe1dafe=_0xe1dafe-0x0;var _0xde1068=_0xf816[_0xe1dafe];return _0xde1068;};'use strict';var _=require(_0x6f81('0x0'));var util=require(_0x6f81('0x1'));var logger=require(_0x6f81('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6f81('0x3'));var rp=require(_0x6f81('0x4'));var fs=require('fs');var path=require(_0x6f81('0x5'));var rimraf=require(_0x6f81('0x6'));var config=require(_0x6f81('0x7'));var attributes=require(_0x6f81('0x8'));module[_0x6f81('0x9')]=function(_0x384eab,_0x3f98e4){return _0x384eab[_0x6f81('0xa')]('ChatProactiveAction',attributes,{'tableName':_0x6f81('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d51=['define','chat_proactive_actions','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0x1267b0,_0x399d83){var _0x2a796e=function(_0x74d6d7){while(--_0x74d6d7){_0x1267b0['push'](_0x1267b0['shift']());}};_0x2a796e(++_0x399d83);}(_0x4d51,0xc0));var _0x14d5=function(_0x3a30ed,_0x1a0537){_0x3a30ed=_0x3a30ed-0x0;var _0x384988=_0x4d51[_0x3a30ed];return _0x384988;};'use strict';var _=require(_0x14d5('0x0'));var util=require('util');var logger=require(_0x14d5('0x1'))(_0x14d5('0x2'));var moment=require(_0x14d5('0x3'));var BPromise=require('bluebird');var rp=require(_0x14d5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x14d5('0x5'));var attributes=require(_0x14d5('0x6'));module[_0x14d5('0x7')]=function(_0x47afec,_0x373676){return _0x47afec[_0x14d5('0x8')]('ChatProactiveAction',attributes,{'tableName':_0x14d5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 8a76ab5..db9730b 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 _0x7d4a=['request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../config/environment','client','http','then','ChatProactiveAction,\x20%s,\x20%s'];(function(_0xf4666e,_0x571140){var _0x1853f1=function(_0x5160a5){while(--_0x5160a5){_0xf4666e['push'](_0xf4666e['shift']());}};_0x1853f1(++_0x571140);}(_0x7d4a,0xf3));var _0xa7d4=function(_0x33ba4c,_0x59f017){_0x33ba4c=_0x33ba4c-0x0;var _0x307f0f=_0x7d4a[_0x33ba4c];return _0x307f0f;};'use strict';var _=require(_0xa7d4('0x0'));var util=require('util');var moment=require(_0xa7d4('0x1'));var BPromise=require(_0xa7d4('0x2'));var rs=require(_0xa7d4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa7d4('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xa7d4('0x5')][_0xa7d4('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x420030,_0x5bf9ca,_0x371335){return new BPromise(function(_0x2e82a7,_0x12d271){return client['request'](_0x420030,_0x371335)[_0xa7d4('0x7')](function(_0x5ea381){logger['info'](_0xa7d4('0x8'),_0x5bf9ca,_0xa7d4('0x9'));logger[_0xa7d4('0xa')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x5bf9ca,'request\x20sent',JSON[_0xa7d4('0xb')](_0x5ea381));if(_0x5ea381[_0xa7d4('0xc')]){if(_0x5ea381['error'][_0xa7d4('0xd')]===0x1f4){logger[_0xa7d4('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x5bf9ca,_0x5ea381[_0xa7d4('0xc')]['message']);return _0x12d271(_0x5ea381[_0xa7d4('0xc')][_0xa7d4('0xe')]);}logger[_0xa7d4('0xc')](_0xa7d4('0x8'),_0x5bf9ca,_0x5ea381['error'][_0xa7d4('0xe')]);return _0x2e82a7(_0x5ea381[_0xa7d4('0xc')][_0xa7d4('0xe')]);}else{logger[_0xa7d4('0xf')](_0xa7d4('0x8'),_0x5bf9ca,_0xa7d4('0x9'));_0x2e82a7(_0x5ea381[_0xa7d4('0x10')]['message']);}})[_0xa7d4('0x11')](function(_0x5ed83c){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x5bf9ca,_0x5ed83c);_0x12d271(_0x5ed83c);});});} \ No newline at end of file +var _0x90d1=['request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x90d1,0x164));var _0x190d=function(_0x3e0191,_0x1d4b20){_0x3e0191=_0x3e0191-0x0;var _0xf2ae83=_0x90d1[_0x3e0191];return _0xf2ae83;};'use strict';var _=require('lodash');var util=require(_0x190d('0x0'));var moment=require(_0x190d('0x1'));var BPromise=require(_0x190d('0x2'));var rs=require(_0x190d('0x3'));var fs=require('fs');var Redis=require(_0x190d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x190d('0x5'));var logger=require(_0x190d('0x6'))(_0x190d('0x7'));var config=require(_0x190d('0x8'));var jayson=require(_0x190d('0x9'));var client=jayson[_0x190d('0xa')][_0x190d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5087bb,_0x9f0f88,_0x203a56){return new BPromise(function(_0x21af31,_0x5d5506){return client[_0x190d('0xc')](_0x5087bb,_0x203a56)[_0x190d('0xd')](function(_0x37ccaf){logger[_0x190d('0xe')](_0x190d('0xf'),_0x9f0f88,_0x190d('0x10'));logger[_0x190d('0x11')](_0x190d('0x12'),_0x9f0f88,_0x190d('0x10'),JSON['stringify'](_0x37ccaf));if(_0x37ccaf[_0x190d('0x13')]){if(_0x37ccaf[_0x190d('0x13')][_0x190d('0x14')]===0x1f4){logger[_0x190d('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x9f0f88,_0x37ccaf['error'][_0x190d('0x15')]);return _0x5d5506(_0x37ccaf[_0x190d('0x13')][_0x190d('0x15')]);}logger[_0x190d('0x13')](_0x190d('0xf'),_0x9f0f88,_0x37ccaf['error'][_0x190d('0x15')]);return _0x21af31(_0x37ccaf[_0x190d('0x13')]['message']);}else{logger[_0x190d('0xe')](_0x190d('0xf'),_0x9f0f88,'request\x20sent');_0x21af31(_0x37ccaf['result'][_0x190d('0x15')]);}})[_0x190d('0x16')](function(_0x5d3a6b){logger['error'](_0x190d('0xf'),_0x9f0f88,_0x5d3a6b);_0x5d5506(_0x5d3a6b);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index f8fdd55..cae6105 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 _0x5d58=['/:id','isAuthenticated','show','create','update','delete','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x37d718,_0x4b5779){var _0x1b650a=function(_0x38c66){while(--_0x38c66){_0x37d718['push'](_0x37d718['shift']());}};_0x1b650a(++_0x4b5779);}(_0x5d58,0x187));var _0x85d5=function(_0x5be568,_0x333f60){_0x5be568=_0x5be568-0x0;var _0x52719e=_0x5d58[_0x5be568];return _0x52719e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85d5('0x0')]();var fs_extra=require(_0x85d5('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var controller=require('./chatProactiveAction.controller');router[_0x85d5('0x4')](_0x85d5('0x5'),auth[_0x85d5('0x6')](),controller[_0x85d5('0x7')]);router['post']('/',auth[_0x85d5('0x6')](),controller[_0x85d5('0x8')]);router['put'](_0x85d5('0x5'),auth['isAuthenticated'](),controller[_0x85d5('0x9')]);router[_0x85d5('0xa')](_0x85d5('0x5'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xae24=['destroy','exports','multer','path','express','Router','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0xe5b539,_0x467802){var _0x4bd185=function(_0x15d499){while(--_0x15d499){_0xe5b539['push'](_0xe5b539['shift']());}};_0x4bd185(++_0x467802);}(_0xae24,0x182));var _0x4ae2=function(_0x11f0b2,_0x156d7a){_0x11f0b2=_0x11f0b2-0x0;var _0x3f71f9=_0xae24[_0x11f0b2];return _0x3f71f9;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require('util');var path=require(_0x4ae2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ae2('0x4'));var config=require('../../config/environment');var controller=require(_0x4ae2('0x5'));router[_0x4ae2('0x6')](_0x4ae2('0x7'),auth[_0x4ae2('0x8')](),controller[_0x4ae2('0x9')]);router[_0x4ae2('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4ae2('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x4ae2('0xc')]);router[_0x4ae2('0xd')]('/:id',auth[_0x4ae2('0x8')](),controller[_0x4ae2('0xe')]);module[_0x4ae2('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index bb8d12d..783741e 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 _0xf128=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf128,0xcf));var _0x8f12=function(_0x1e06c0,_0x3c8d32){_0x1e06c0=_0x1e06c0-0x0;var _0x20a073=_0xf128[_0x1e06c0];return _0x20a073;};'use strict';var Sequelize=require(_0x8f12('0x0'));module[_0x8f12('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8f12('0x2')]},'timeout':{'type':Sequelize[_0x8f12('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8f12('0x4')](_0x8f12('0x5'),_0x8f12('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x9c25=['exports','name','INTEGER','beepall','roundrobin','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9c25,0xd1));var _0x59c2=function(_0x7cbb23,_0x404d77){_0x7cbb23=_0x7cbb23-0x0;var _0x306654=_0x9c25[_0x7cbb23];return _0x306654;};'use strict';var Sequelize=require(_0x59c2('0x0'));module[_0x59c2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x59c2('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x59c2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x59c2('0x4'),_0x59c2('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 46e7d2c..1324cdc 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 _0x265d=['to-csv','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','offset','undefined','limit','json','apply','reject','save','destroy','then','get','ChatQueues','UserProfileResource','status','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','merge','filter','options','count','includeAll','include','findAll','rows','show','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','params','UserChatQueue','pick','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','order','addTeams','ids','Team','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userChatQueue:save','removeTeams','Agents','select','field','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','union','compact','value','isEmpty','emit','userChatQueue:remove','addAgents','omit','spread','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0x265d,0x12c));var _0xd265=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x265d[_0x34843e];return _0x598f7f;};'use strict';var emlformat=require(_0xd265('0x0'));var rimraf=require(_0xd265('0x1'));var zipdir=require(_0xd265('0x2'));var jsonpatch=require(_0xd265('0x3'));var rp=require(_0xd265('0x4'));var moment=require(_0xd265('0x5'));var BPromise=require(_0xd265('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd265('0x7'));var csv=require(_0xd265('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd265('0x9'));var _=require(_0xd265('0xa'));var squel=require(_0xd265('0xb'));var crypto=require(_0xd265('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd265('0x8'));var querystring=require(_0xd265('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd265('0xe'));var qs=require(_0xd265('0xf'));var as=require(_0xd265('0x10'));var hardwareService=require(_0xd265('0x11'));var logger=require(_0xd265('0x12'))('api');var utils=require(_0xd265('0x13'));var config=require(_0xd265('0x14'));var licenseUtil=require(_0xd265('0x15'));var db=require(_0xd265('0x16'))['db'];config[_0xd265('0x17')]=_[_0xd265('0x18')](config['redis'],{'host':_0xd265('0x19'),'port':0x18eb});var socket=require(_0xd265('0x1a'))(new Redis(config[_0xd265('0x17')]));require(_0xd265('0x1b'))[_0xd265('0x1c')](socket);var jayson=require(_0xd265('0x1d'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f5f46,_0x59ab97,_0xe29bba,_0x3529a1){return new BPromise(function(_0x56665c,_0x508b01){var _0x74e8b9=_0x3529a1||client;return _0x74e8b9[_0xd265('0x1e')](_0x1f5f46,_0xe29bba)['then'](function(_0x5e1e50){logger[_0xd265('0x1f')](_0xd265('0x20'),_0x59ab97,_0xd265('0x21'));logger[_0xd265('0x22')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x59ab97,'request\x20sent',JSON[_0xd265('0x23')](_0x5e1e50));if(_0x5e1e50[_0xd265('0x24')]){if(_0x5e1e50[_0xd265('0x24')][_0xd265('0x25')]===0x1f4){logger['error'](_0xd265('0x20'),_0x59ab97,_0x5e1e50[_0xd265('0x24')]['message']);return _0x508b01(_0x5e1e50['error'][_0xd265('0x26')]);}logger[_0xd265('0x24')](_0xd265('0x20'),_0x59ab97,_0x5e1e50[_0xd265('0x24')]['message']);return _0x56665c(_0x5e1e50[_0xd265('0x24')][_0xd265('0x26')]);}else{logger['info'](_0xd265('0x20'),_0x59ab97,_0xd265('0x21'));_0x56665c(_0x5e1e50[_0xd265('0x27')][_0xd265('0x26')]);}})[_0xd265('0x28')](function(_0x3f22b1){logger[_0xd265('0x24')](_0xd265('0x20'),_0x59ab97,_0x3f22b1);_0x508b01(_0x3f22b1);});});}function respondWithStatusCode(_0x1e17d1,_0x2e5350){_0x2e5350=_0x2e5350||0xcc;return function(_0x40af7f){if(_0x40af7f){return _0x1e17d1[_0xd265('0x29')](_0x2e5350);}return _0x1e17d1['status'](_0x2e5350)[_0xd265('0x2a')]();};}function respondWithResult(_0x432de5,_0x3641db){_0x3641db=_0x3641db||0xc8;return function(_0x394ee7){if(_0x394ee7){return _0x432de5['status'](_0x3641db)['json'](_0x394ee7);}};}function respondWithFilteredResult(_0x30c284,_0x5c4974){return function(_0x1fcd63){if(_0x1fcd63){var _0x141de1=typeof _0x5c4974[_0xd265('0x2b')]===_0xd265('0x2c')&&typeof _0x5c4974[_0xd265('0x2d')]===_0xd265('0x2c');var _0x223a70=_0x1fcd63['count'];var _0x2e082d=_0x141de1?0x0:_0x5c4974[_0xd265('0x2b')];var _0x560fd1=_0x141de1?_0x1fcd63['count']:_0x5c4974[_0xd265('0x2b')]+_0x5c4974[_0xd265('0x2d')];var _0x2d81b1;if(_0x560fd1>=_0x223a70){_0x560fd1=_0x223a70;_0x2d81b1=0xc8;}else{_0x2d81b1=0xce;}_0x30c284['status'](_0x2d81b1);return _0x30c284['set']('Content-Range',_0x2e082d+'-'+_0x560fd1+'/'+_0x223a70)[_0xd265('0x2e')](_0x1fcd63);}return null;};}function patchUpdates(_0x2d0021){return function(_0x5f0410){try{jsonpatch[_0xd265('0x2f')](_0x5f0410,_0x2d0021,!![]);}catch(_0x25377e){return BPromise[_0xd265('0x30')](_0x25377e);}return _0x5f0410[_0xd265('0x31')]();};}function saveUpdates(_0x13fa53,_0x4272d3){return function(_0x5b1500){if(_0x5b1500){return _0x5b1500['update'](_0x13fa53)['then'](function(_0x3ea61c){return _0x3ea61c;});}return null;};}function removeEntity(_0x266640,_0x1a6b44){return function(_0x982a18){if(_0x982a18){return _0x982a18[_0xd265('0x32')]()[_0xd265('0x33')](function(){var _0x142032=_0x982a18[_0xd265('0x34')]({'plain':!![]});var _0xe37a13=_0xd265('0x35');return db[_0xd265('0x36')][_0xd265('0x32')]({'where':{'type':_0xe37a13,'resourceId':_0x142032['id']}})[_0xd265('0x33')](function(){return _0x982a18;});})['then'](function(){_0x266640[_0xd265('0x37')](0xcc)[_0xd265('0x2a')]();});}};}function handleEntityNotFound(_0x5cdb2e,_0x3672ab){return function(_0x1c1674){if(!_0x1c1674){_0x5cdb2e[_0xd265('0x29')](0x194);}return _0x1c1674;};}function handleError(_0x3b1794,_0x12232b){_0x12232b=_0x12232b||0x1f4;return function(_0x37dd30){logger[_0xd265('0x24')](_0x37dd30['stack']);if(_0x37dd30['name']){delete _0x37dd30[_0xd265('0x38')];}_0x3b1794[_0xd265('0x37')](_0x12232b)['send'](_0x37dd30);};}exports[_0xd265('0x39')]=function(_0x304989,_0x5ddfa0){var _0x2bcfd8={},_0x1ad6e9={},_0x20634f={'count':0x0,'rows':[]};var _0x11c727=_[_0xd265('0x3a')](db[_0xd265('0x3b')][_0xd265('0x3c')],function(_0x489d00){return{'name':_0x489d00[_0xd265('0x3d')],'type':_0x489d00[_0xd265('0x3e')][_0xd265('0x3f')]};});_0x1ad6e9[_0xd265('0x40')]=_[_0xd265('0x3a')](_0x11c727,'name');_0x1ad6e9[_0xd265('0x41')]=_[_0xd265('0x42')](_0x304989[_0xd265('0x41')]);_0x1ad6e9['filters']=_[_0xd265('0x43')](_0x1ad6e9[_0xd265('0x40')],_0x1ad6e9[_0xd265('0x41')]);_0x2bcfd8[_0xd265('0x44')]=_[_0xd265('0x43')](_0x1ad6e9['model'],qs[_0xd265('0x45')](_0x304989['query'][_0xd265('0x45')]));_0x2bcfd8[_0xd265('0x44')]=_0x2bcfd8[_0xd265('0x44')]['length']?_0x2bcfd8[_0xd265('0x44')]:_0x1ad6e9[_0xd265('0x40')];if(!_0x304989[_0xd265('0x41')][_0xd265('0x46')](_0xd265('0x47'))){_0x2bcfd8['limit']=qs[_0xd265('0x2d')](_0x304989[_0xd265('0x41')][_0xd265('0x2d')]);_0x2bcfd8[_0xd265('0x2b')]=qs[_0xd265('0x2b')](_0x304989[_0xd265('0x41')][_0xd265('0x2b')]);}_0x2bcfd8['order']=qs[_0xd265('0x48')](_0x304989['query'][_0xd265('0x48')]);_0x2bcfd8[_0xd265('0x49')]=qs['filters'](_['pick'](_0x304989[_0xd265('0x41')],_0x1ad6e9[_0xd265('0x4a')]),_0x11c727);if(_0x304989['query']['filter']){_0x2bcfd8['where']=_[_0xd265('0x4b')](_0x2bcfd8[_0xd265('0x49')],{'$or':_[_0xd265('0x3a')](_0x11c727,function(_0x206d1e){if(_0x206d1e[_0xd265('0x3e')]!=='VIRTUAL'){var _0x11afa1={};_0x11afa1[_0x206d1e[_0xd265('0x38')]]={'$like':'%'+_0x304989[_0xd265('0x41')][_0xd265('0x4c')]+'%'};return _0x11afa1;}})});}_0x2bcfd8=_['merge']({},_0x2bcfd8,_0x304989[_0xd265('0x4d')]);var _0x25e5f5={'where':_0x2bcfd8[_0xd265('0x49')]};return db[_0xd265('0x3b')][_0xd265('0x4e')](_0x25e5f5)['then'](function(_0x15bf9d){_0x20634f[_0xd265('0x4e')]=_0x15bf9d;if(_0x304989[_0xd265('0x41')][_0xd265('0x4f')]){_0x2bcfd8[_0xd265('0x50')]=[{'all':!![]}];}return db[_0xd265('0x3b')][_0xd265('0x51')](_0x2bcfd8);})[_0xd265('0x33')](function(_0x4e0690){_0x20634f[_0xd265('0x52')]=_0x4e0690;return _0x20634f;})[_0xd265('0x33')](respondWithFilteredResult(_0x5ddfa0,_0x2bcfd8))[_0xd265('0x28')](handleError(_0x5ddfa0,null));};exports[_0xd265('0x53')]=function(_0x24a1c0,_0x55fa0e){var _0x1b6ab0={'raw':!![],'where':{'id':_0x24a1c0['params']['id']}},_0x2484c2={};_0x2484c2[_0xd265('0x40')]=_[_0xd265('0x42')](db[_0xd265('0x3b')][_0xd265('0x3c')]);_0x2484c2[_0xd265('0x41')]=_[_0xd265('0x42')](_0x24a1c0[_0xd265('0x41')]);_0x2484c2['filters']=_['intersection'](_0x2484c2[_0xd265('0x40')],_0x2484c2[_0xd265('0x41')]);_0x1b6ab0[_0xd265('0x44')]=_[_0xd265('0x43')](_0x2484c2['model'],qs['fields'](_0x24a1c0['query'][_0xd265('0x45')]));_0x1b6ab0['attributes']=_0x1b6ab0[_0xd265('0x44')][_0xd265('0x54')]?_0x1b6ab0[_0xd265('0x44')]:_0x2484c2[_0xd265('0x40')];if(_0x24a1c0[_0xd265('0x41')]['includeAll']){_0x1b6ab0[_0xd265('0x50')]=[{'all':!![]}];}_0x1b6ab0=_[_0xd265('0x4b')]({},_0x1b6ab0,_0x24a1c0[_0xd265('0x4d')]);return db[_0xd265('0x3b')][_0xd265('0x55')](_0x1b6ab0)[_0xd265('0x33')](handleEntityNotFound(_0x55fa0e,null))[_0xd265('0x33')](respondWithResult(_0x55fa0e,null))['catch'](handleError(_0x55fa0e,null));};exports[_0xd265('0x56')]=function(_0x3122bf,_0xa396b){return db[_0xd265('0x3b')][_0xd265('0x56')](_0x3122bf['body'],{})[_0xd265('0x33')](function(_0x1d9d32){var _0x2502c0=_0x3122bf[_0xd265('0x57')][_0xd265('0x34')]({'plain':!![]});if(!_0x2502c0)throw new Error(_0xd265('0x58'));if(_0x2502c0[_0xd265('0x59')]===_0xd265('0x57')){var _0x5d6d93=_0x1d9d32[_0xd265('0x34')]({'plain':!![]});var _0x1de614='ChatQueues';return db[_0xd265('0x5a')][_0xd265('0x55')]({'where':{'name':_0x1de614,'userProfileId':_0x2502c0[_0xd265('0x5b')]},'raw':!![]})[_0xd265('0x33')](function(_0x5ada24){if(_0x5ada24&&_0x5ada24[_0xd265('0x5c')]===0x0){return db[_0xd265('0x36')][_0xd265('0x56')]({'name':_0x5d6d93['name'],'resourceId':_0x5d6d93['id'],'type':_0x5ada24['name'],'sectionId':_0x5ada24['id']},{})[_0xd265('0x33')](function(){return _0x1d9d32;});}else{return _0x1d9d32;}})[_0xd265('0x28')](function(_0x556efd){logger[_0xd265('0x24')](_0xd265('0x5d'),_0x556efd);throw _0x556efd;});}return _0x1d9d32;})['then'](respondWithResult(_0xa396b,0xc9))['catch'](handleError(_0xa396b,null));};exports[_0xd265('0x5e')]=function(_0x39c20f,_0x570778){if(_0x39c20f['body']['id']){delete _0x39c20f[_0xd265('0x5f')]['id'];}return db[_0xd265('0x3b')][_0xd265('0x55')]({'where':{'id':_0x39c20f['params']['id']}})[_0xd265('0x33')](handleEntityNotFound(_0x570778,null))['then'](saveUpdates(_0x39c20f[_0xd265('0x5f')],null))[_0xd265('0x33')](respondWithResult(_0x570778,null))[_0xd265('0x28')](handleError(_0x570778,null));};exports[_0xd265('0x32')]=function(_0x5a5fdf,_0x38c8f2){return db[_0xd265('0x3b')][_0xd265('0x55')]({'where':{'id':_0x5a5fdf['params']['id']}})['then'](handleEntityNotFound(_0x38c8f2,null))[_0xd265('0x33')](removeEntity(_0x38c8f2,null))[_0xd265('0x28')](handleError(_0x38c8f2,null));};exports['describe']=function(_0x32864d,_0x53e3c2){return db[_0xd265('0x3b')][_0xd265('0x60')]()[_0xd265('0x33')](respondWithResult(_0x53e3c2,null))[_0xd265('0x28')](handleError(_0x53e3c2,null));};exports[_0xd265('0x61')]=function(_0x3ceeda,_0xfc2b83,_0x36b638){var _0x16cccf={'raw':!![],'where':{}},_0x45cab7={},_0x34d42b;return db[_0xd265('0x3b')][_0xd265('0x62')]({'where':{'id':_0x3ceeda[_0xd265('0x63')]['id']}})[_0xd265('0x33')](handleEntityNotFound(_0xfc2b83,null))['then'](function(_0x2c4c34){if(_0x2c4c34){_0x34d42b=_0x2c4c34['get']({'plain':!![]});_0x45cab7[_0xd265('0x40')]=_['keys'](db[_0xd265('0x64')][_0xd265('0x3c')]);_0x45cab7['query']=_[_0xd265('0x42')](_0x3ceeda[_0xd265('0x41')]);_0x45cab7[_0xd265('0x4a')]=_['intersection'](_0x45cab7['model'],_0x45cab7[_0xd265('0x41')]);_0x16cccf[_0xd265('0x44')]=_[_0xd265('0x43')](_0x45cab7[_0xd265('0x40')],qs[_0xd265('0x45')](_0x3ceeda[_0xd265('0x41')]['fields']));_0x16cccf[_0xd265('0x44')]=_0x16cccf[_0xd265('0x44')][_0xd265('0x54')]?_0x16cccf[_0xd265('0x44')]:_0x45cab7['model'];if(!_0x3ceeda['query'][_0xd265('0x46')](_0xd265('0x47'))){_0x16cccf[_0xd265('0x2d')]=qs[_0xd265('0x2d')](_0x3ceeda[_0xd265('0x41')][_0xd265('0x2d')]);_0x16cccf[_0xd265('0x2b')]=qs[_0xd265('0x2b')](_0x3ceeda['query'][_0xd265('0x2b')]);}_0x16cccf['order']=qs[_0xd265('0x48')](_0x3ceeda[_0xd265('0x41')][_0xd265('0x48')]);_0x16cccf['where']=qs['filters'](_[_0xd265('0x65')](_0x3ceeda[_0xd265('0x41')],_0x45cab7[_0xd265('0x4a')]));_0x16cccf[_0xd265('0x49')][_0xd265('0x66')]=_0x2c4c34['id'];if(_0x3ceeda[_0xd265('0x41')][_0xd265('0x4c')]){_0x16cccf[_0xd265('0x49')]=_['merge'](_0x16cccf[_0xd265('0x49')],{'$or':_[_0xd265('0x3a')](_0x16cccf[_0xd265('0x44')],function(_0x593fe8){var _0x5a29e8={};_0x5a29e8[_0x593fe8]={'$like':'%'+_0x3ceeda[_0xd265('0x41')][_0xd265('0x4c')]+'%'};return _0x5a29e8;})});}_0x16cccf=_[_0xd265('0x4b')]({},_0x16cccf,_0x3ceeda['options']);return db['UserChatQueue'][_0xd265('0x51')](_0x16cccf);}})['then'](function(_0x114186){if(_0x114186){return db[_0xd265('0x67')][_0xd265('0x68')]({'where':{'id':_[_0xd265('0x3a')](_0x114186,_0xd265('0x69')),'role':_0xd265('0x6a')},'attributes':['id',_0xd265('0x38'),_0xd265('0x6b'),_0xd265('0x6c'),_0xd265('0x6d')]});}})[_0xd265('0x33')](function(_0xcc0097){if(_0xcc0097){return{'count':_0xcc0097[_0xd265('0x4e')],'rows':_[_0xd265('0x3a')](_0xcc0097[_0xd265('0x52')],function(_0x565bd0){return{'membername':_0x565bd0[_0xd265('0x38')],'UserId':_0x565bd0['id'],'queue_name':_0x34d42b[_0xd265('0x38')],'ChatQueueId':_0x34d42b['id'],'interface':util[_0xd265('0x6e')](_0xd265('0x6f'),_0xd265('0x70'),_0x565bd0[_0xd265('0x38')]),'penalty':0x0,'paused':_0x565bd0['chatPause'],'createdAt':_0x565bd0['createdAt'],'updatedAt':_0x565bd0[_0xd265('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd265('0x33')](respondWithFilteredResult(_0xfc2b83,_0x16cccf))['catch'](handleError(_0xfc2b83,null));};exports[_0xd265('0x71')]=function(_0x545b70,_0x25d596,_0x59778a){var _0xda0f12={};var _0x3a63d5={};var _0x97d52c;var _0x31c64f;return db[_0xd265('0x3b')][_0xd265('0x62')]({'where':{'id':_0x545b70[_0xd265('0x63')]['id']}})['then'](handleEntityNotFound(_0x25d596,null))['then'](function(_0x1bfa99){if(_0x1bfa99){_0x97d52c=_0x1bfa99;_0x3a63d5[_0xd265('0x40')]=_[_0xd265('0x42')](db['Team'][_0xd265('0x3c')]);_0x3a63d5['query']=_['keys'](_0x545b70['query']);_0x3a63d5[_0xd265('0x4a')]=_[_0xd265('0x43')](_0x3a63d5['model'],_0x3a63d5[_0xd265('0x41')]);_0xda0f12[_0xd265('0x44')]=_[_0xd265('0x43')](_0x3a63d5[_0xd265('0x40')],qs[_0xd265('0x45')](_0x545b70['query'][_0xd265('0x45')]));_0xda0f12[_0xd265('0x44')]=_0xda0f12[_0xd265('0x44')][_0xd265('0x54')]?_0xda0f12[_0xd265('0x44')]:_0x3a63d5[_0xd265('0x40')];_0xda0f12[_0xd265('0x72')]=qs[_0xd265('0x48')](_0x545b70[_0xd265('0x41')][_0xd265('0x48')]);_0xda0f12[_0xd265('0x49')]=qs[_0xd265('0x4a')](_[_0xd265('0x65')](_0x545b70['query'],_0x3a63d5[_0xd265('0x4a')]));if(_0x545b70[_0xd265('0x41')][_0xd265('0x4c')]){_0xda0f12[_0xd265('0x49')]=_['merge'](_0xda0f12[_0xd265('0x49')],{'$or':_[_0xd265('0x3a')](_0xda0f12[_0xd265('0x44')],function(_0x10a3cc){var _0x3022cf={};_0x3022cf[_0x10a3cc]={'$like':'%'+_0x545b70['query'][_0xd265('0x4c')]+'%'};return _0x3022cf;})});}_0xda0f12=_[_0xd265('0x4b')]({},_0xda0f12,_0x545b70[_0xd265('0x4d')]);return _0x97d52c['getTeams'](_0xda0f12);}})[_0xd265('0x33')](function(_0x11a3bb){if(_0x11a3bb){_0x31c64f=_0x11a3bb['length'];if(!_0x545b70[_0xd265('0x41')][_0xd265('0x46')](_0xd265('0x47'))){_0xda0f12[_0xd265('0x2d')]=qs[_0xd265('0x2d')](_0x545b70[_0xd265('0x41')][_0xd265('0x2d')]);_0xda0f12['offset']=qs[_0xd265('0x2b')](_0x545b70[_0xd265('0x41')][_0xd265('0x2b')]);}return _0x97d52c[_0xd265('0x71')](_0xda0f12);}})['then'](function(_0x6f2221){if(_0x6f2221){return _0x6f2221?{'count':_0x31c64f,'rows':_0x6f2221}:null;}})[_0xd265('0x33')](respondWithResult(_0x25d596,null))[_0xd265('0x28')](handleError(_0x25d596,null));};exports[_0xd265('0x73')]=function(_0x5598c7,_0x1ba80b,_0x1c313c){var _0x15ca75=_0x5598c7[_0xd265('0x5f')][_0xd265('0x74')];return db[_0xd265('0x75')][_0xd265('0x51')]({'where':{'id':_0x15ca75},'attributes':['id'],'include':[{'model':db[_0xd265('0x67')],'as':'Agents','attributes':['id','name',_0xd265('0x76'),_0xd265('0x77'),_0xd265('0x78')],'raw':!![]}]})[_0xd265('0x33')](function(_0x338183){if(_0x338183){var _0x2e4976=_[_0xd265('0x79')](_0x338183,function(_0x4288f4){var _0x553a80=_0x4288f4[_0xd265('0x34')]({'plain':!![]});return _0x553a80['Agents'];});return db['ChatQueue'][_0xd265('0x55')]({'where':{'id':_0x5598c7[_0xd265('0x63')]['id']}})[_0xd265('0x33')](function(_0x3ee2b7){return db[_0xd265('0x7a')][_0xd265('0x7b')](function(_0x125b02){return _0x3ee2b7['addTeams'](_0x15ca75,{'transaction':_0x125b02})['then'](function(){return BPromise[_0xd265('0x7c')](_0x2e4976,function(_0x2ffa9f){return db[_0xd265('0x64')][_0xd265('0x7d')]({'where':{'UserId':_0x2ffa9f['id'],'ChatQueueId':_0x5598c7[_0xd265('0x63')]['id']},'transaction':_0x125b02});});})[_0xd265('0x33')](function(){_0x2e4976[_0xd265('0x7e')](function(_0x2f68d3){socket['emit'](_0xd265('0x7f'),{'UserId':_0x2f68d3['id'],'ChatQueueId':_0x3ee2b7['id']});});});});});}})[_0xd265('0x33')](respondWithStatusCode(_0x1ba80b,null))[_0xd265('0x28')](handleError(_0x1ba80b,null));};exports[_0xd265('0x80')]=function(_0x3374cf,_0x2a6604,_0x455dde){return db['Team']['findAll']({'where':{'id':_0x3374cf[_0xd265('0x41')][_0xd265('0x74')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd265('0x81'),'attributes':['id'],'raw':!![]}]})[_0xd265('0x33')](handleEntityNotFound(_0x2a6604,null))[_0xd265('0x33')](function(_0x4b07a3){var _0x2d1b88=_[_0xd265('0x3a')](_0x4b07a3,'id');var _0x46adc9=[];var _0xf40e4f=[];var _0xb41807=squel[_0xd265('0x82')]();_0xb41807[_0xd265('0x83')]('tq.TeamId')['from'](_0xd265('0x84'),'tq')[_0xd265('0x85')](_0xd265('0x86'),'ut',_0xd265('0x87'))['where']('ChatQueueId\x20=\x20?',_0x3374cf[_0xd265('0x63')]['id']);for(var _0x4d9e36=0x0;_0x4d9e36<_0x4b07a3['length'];_0x4d9e36+=0x1){let _0x4bdddb=_0x4b07a3[_0x4d9e36];for(var _0x280644=0x0;_0x280644<_0x4bdddb[_0xd265('0x81')][_0xd265('0x54')];_0x280644+=0x1){let _0x3b2e78=_0x4bdddb[_0xd265('0x81')][_0x280644];var _0x7ef243=_0xb41807[_0xd265('0x88')]();_0x7ef243[_0xd265('0x49')](_0xd265('0x89'),_0x3b2e78['id']);_0xf40e4f[_0xd265('0x8a')](db[_0xd265('0x7a')]['query'](_0x7ef243[_0xd265('0x8b')](),{'type':db[_0xd265('0x7a')]['QueryTypes'][_0xd265('0x8c')]})[_0xd265('0x33')](function(_0x1e5715){if(_0x1e5715[_0xd265('0x54')]===0x1){return _0x3b2e78['id'];}else{var _0x244bf7=_[_0xd265('0x8d')](_[_0xd265('0x3a')](_0x1e5715,_0xd265('0x8e')),function(_0x2ce13e){return _['includes'](_0x2d1b88,_0x2ce13e);});if(_0x244bf7){return _0x3b2e78['id'];}}}));}}return BPromise['all'](_0xf40e4f)['then'](function(_0x3c17b2){_0x46adc9=_(_0x46adc9)[_0xd265('0x8f')](_0x3c17b2)[_0xd265('0x90')]()[_0xd265('0x91')]();return db[_0xd265('0x3b')][_0xd265('0x55')]({'where':{'id':_0x3374cf[_0xd265('0x63')]['id']}})[_0xd265('0x33')](function(_0x3e71bc){return db['sequelize'][_0xd265('0x7b')](function(_0x3e67e4){return _0x3e71bc['removeTeams'](_0x3374cf[_0xd265('0x41')][_0xd265('0x74')],{'transaction':_0x3e67e4})[_0xd265('0x33')](function(){if(!_[_0xd265('0x92')](_0x46adc9)){return _0x3e71bc['removeAgents'](_0x46adc9,{'transaction':_0x3e67e4});}})[_0xd265('0x33')](function(){_0x46adc9['forEach'](function(_0x434d8c){socket[_0xd265('0x93')](_0xd265('0x94'),{'UserId':_0x434d8c,'ChatQueueId':_0x3e71bc['id']});});});});});});})['then'](respondWithStatusCode(_0x2a6604,null))[_0xd265('0x28')](handleError(_0x2a6604,null));};exports['addAgents']=function(_0x558604,_0x30f881,_0x49a388){return db[_0xd265('0x3b')][_0xd265('0x55')]({'where':{'id':_0x558604[_0xd265('0x63')]['id']}})[_0xd265('0x33')](handleEntityNotFound(_0x30f881,null))[_0xd265('0x33')](function(_0x4ee85e){if(_0x4ee85e){return _0x4ee85e[_0xd265('0x95')](_0x558604[_0xd265('0x5f')]['ids'],_[_0xd265('0x96')](_0x558604[_0xd265('0x5f')],['ids','id'])||{})[_0xd265('0x97')](function(_0x202ca8){for(var _0x35ada3=0x0;_0x35ada3<_0x558604[_0xd265('0x5f')][_0xd265('0x74')][_0xd265('0x54')];_0x35ada3+=0x1){socket[_0xd265('0x93')](_0xd265('0x7f'),{'UserId':Number(_0x558604[_0xd265('0x5f')]['ids'][_0x35ada3]),'ChatQueueId':Number(_0x558604[_0xd265('0x63')]['id'])});}return _0x202ca8;});}})['then'](respondWithResult(_0x30f881,null))[_0xd265('0x28')](handleError(_0x30f881,null));};exports[_0xd265('0x98')]=function(_0x343f63,_0x1823e6,_0x9ad332){return db[_0xd265('0x3b')][_0xd265('0x55')]({'where':{'id':_0x343f63[_0xd265('0x63')]['id']}})['then'](handleEntityNotFound(_0x1823e6,null))[_0xd265('0x33')](function(_0x3bdda3){if(_0x3bdda3){return _0x3bdda3[_0xd265('0x98')](_0x343f63[_0xd265('0x41')]['ids'])[_0xd265('0x33')](function(){if(_['isArray'](_0x343f63[_0xd265('0x41')][_0xd265('0x74')])){for(var _0x3cffed=0x0;_0x3cffed<_0x343f63[_0xd265('0x41')][_0xd265('0x74')][_0xd265('0x54')];_0x3cffed+=0x1){socket[_0xd265('0x93')](_0xd265('0x94'),{'UserId':Number(_0x343f63[_0xd265('0x41')][_0xd265('0x74')][_0x3cffed]),'ChatQueueId':Number(_0x343f63[_0xd265('0x63')]['id'])});}}else{socket[_0xd265('0x93')]('userChatQueue:remove',{'UserId':Number(_0x343f63[_0xd265('0x41')][_0xd265('0x74')]),'ChatQueueId':Number(_0x343f63[_0xd265('0x63')]['id'])});}});}})[_0xd265('0x33')](respondWithStatusCode(_0x1823e6,null))['catch'](handleError(_0x1823e6,null));};exports['getAgents']=function(_0x43fbf6,_0x3e5b43,_0x3f93d9){var _0x1c485f={};var _0xd65de3={};var _0x480b93;var _0x462c16;return db[_0xd265('0x3b')][_0xd265('0x62')]({'where':{'id':_0x43fbf6[_0xd265('0x63')]['id']}})[_0xd265('0x33')](handleEntityNotFound(_0x3e5b43,null))[_0xd265('0x33')](function(_0x3e4a4e){if(_0x3e4a4e){_0x480b93=_0x3e4a4e;_0xd65de3[_0xd265('0x40')]=_[_0xd265('0x42')](db[_0xd265('0x67')][_0xd265('0x3c')]);_0xd65de3[_0xd265('0x41')]=_[_0xd265('0x42')](_0x43fbf6[_0xd265('0x41')]);_0xd65de3[_0xd265('0x4a')]=_[_0xd265('0x43')](_0xd65de3['model'],_0xd65de3[_0xd265('0x41')]);_0x1c485f['attributes']=_['intersection'](_0xd65de3[_0xd265('0x40')],qs['fields'](_0x43fbf6[_0xd265('0x41')][_0xd265('0x45')]));_0x1c485f[_0xd265('0x44')]=_0x1c485f['attributes']['length']?_0x1c485f['attributes']:_0xd65de3['model'];_0x1c485f[_0xd265('0x72')]=qs[_0xd265('0x48')](_0x43fbf6[_0xd265('0x41')][_0xd265('0x48')]);_0x1c485f[_0xd265('0x49')]=qs['filters'](_[_0xd265('0x65')](_0x43fbf6['query'],_0xd65de3[_0xd265('0x4a')]));if(_0x43fbf6['query']['filter']){_0x1c485f[_0xd265('0x49')]=_['merge'](_0x1c485f[_0xd265('0x49')],{'$or':_[_0xd265('0x3a')](_0x1c485f[_0xd265('0x44')],function(_0x4bc378){var _0x48ef89={};_0x48ef89[_0x4bc378]={'$like':'%'+_0x43fbf6[_0xd265('0x41')][_0xd265('0x4c')]+'%'};return _0x48ef89;})});}_0x1c485f=_[_0xd265('0x4b')]({},_0x1c485f,_0x43fbf6[_0xd265('0x4d')]);return _0x480b93[_0xd265('0x99')](_0x1c485f);}})[_0xd265('0x33')](function(_0x525ce4){if(_0x525ce4){_0x462c16=_0x525ce4[_0xd265('0x54')];if(!_0x43fbf6[_0xd265('0x41')][_0xd265('0x46')]('nolimit')){_0x1c485f[_0xd265('0x2d')]=qs[_0xd265('0x2d')](_0x43fbf6['query'][_0xd265('0x2d')]);_0x1c485f['offset']=qs[_0xd265('0x2b')](_0x43fbf6['query'][_0xd265('0x2b')]);}return _0x480b93['getAgents'](_0x1c485f);}})['then'](function(_0x1ffe8e){if(_0x1ffe8e){return _0x1ffe8e?{'count':_0x462c16,'rows':_0x1ffe8e}:null;}})[_0xd265('0x33')](respondWithResult(_0x3e5b43,null))[_0xd265('0x28')](handleError(_0x3e5b43,null));}; \ No newline at end of file +var _0x4768=['sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','select','tq.TeamId','from','join','user_has_teams','ChatQueueId\x20=\x20?','clone','toString','QueryTypes','every','TeamId','includes','all','value','removeTeams','isEmpty','removeAgents','userChatQueue:remove','addAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','util','path','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','ChatQueues','sendStatus','stack','name','index','map','ChatQueue','fieldName','type','key','query','model','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','keys','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','pick','getTeams','addTeams','ids','Team','voicePause','Agents'];(function(_0x3067f3,_0x55914e){var _0xcecdf4=function(_0x2a5929){while(--_0x2a5929){_0x3067f3['push'](_0x3067f3['shift']());}};_0xcecdf4(++_0x55914e);}(_0x4768,0x140));var _0x8476=function(_0x3f20d8,_0xf377a2){_0x3f20d8=_0x3f20d8-0x0;var _0x59c1a0=_0x4768[_0x3f20d8];return _0x59c1a0;};'use strict';var emlformat=require(_0x8476('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8476('0x1'));var jsonpatch=require(_0x8476('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8476('0x3'));var path=require(_0x8476('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8476('0x5'));var fs=require('fs');var fs_extra=require(_0x8476('0x6'));var _=require('lodash');var squel=require(_0x8476('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8476('0x8'));var Papa=require(_0x8476('0x9'));var Redis=require(_0x8476('0xa'));var authService=require(_0x8476('0xb'));var qs=require(_0x8476('0xc'));var as=require(_0x8476('0xd'));var hardwareService=require(_0x8476('0xe'));var logger=require(_0x8476('0xf'))(_0x8476('0x10'));var utils=require(_0x8476('0x11'));var config=require(_0x8476('0x12'));var licenseUtil=require(_0x8476('0x13'));var db=require(_0x8476('0x14'))['db'];config[_0x8476('0x15')]=_['defaults'](config[_0x8476('0x15')],{'host':_0x8476('0x16'),'port':0x18eb});var socket=require(_0x8476('0x17'))(new Redis(config[_0x8476('0x15')]));require('./chatQueue.socket')[_0x8476('0x18')](socket);var jayson=require(_0x8476('0x19'));var client=jayson[_0x8476('0x1a')][_0x8476('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3d657a,_0x2f79f7,_0x62c340,_0x1e210e){return new BPromise(function(_0x469dfd,_0x2ead0b){var _0x3350fd=_0x1e210e||client;return _0x3350fd[_0x8476('0x1c')](_0x3d657a,_0x62c340)['then'](function(_0x254259){logger[_0x8476('0x1d')]('ChatQueue,\x20%s,\x20%s',_0x2f79f7,_0x8476('0x1e'));logger[_0x8476('0x1f')](_0x8476('0x20'),_0x2f79f7,_0x8476('0x1e'),JSON['stringify'](_0x254259));if(_0x254259[_0x8476('0x21')]){if(_0x254259['error'][_0x8476('0x22')]===0x1f4){logger[_0x8476('0x21')](_0x8476('0x23'),_0x2f79f7,_0x254259[_0x8476('0x21')][_0x8476('0x24')]);return _0x2ead0b(_0x254259[_0x8476('0x21')]['message']);}logger[_0x8476('0x21')](_0x8476('0x23'),_0x2f79f7,_0x254259[_0x8476('0x21')][_0x8476('0x24')]);return _0x469dfd(_0x254259[_0x8476('0x21')]['message']);}else{logger['info'](_0x8476('0x23'),_0x2f79f7,_0x8476('0x1e'));_0x469dfd(_0x254259[_0x8476('0x25')][_0x8476('0x24')]);}})[_0x8476('0x26')](function(_0x2b82c4){logger['error'](_0x8476('0x23'),_0x2f79f7,_0x2b82c4);_0x2ead0b(_0x2b82c4);});});}function respondWithStatusCode(_0x356d02,_0x51aad8){_0x51aad8=_0x51aad8||0xcc;return function(_0x1f2996){if(_0x1f2996){return _0x356d02['sendStatus'](_0x51aad8);}return _0x356d02[_0x8476('0x27')](_0x51aad8)[_0x8476('0x28')]();};}function respondWithResult(_0x25f9af,_0x1c4384){_0x1c4384=_0x1c4384||0xc8;return function(_0x8bae6){if(_0x8bae6){return _0x25f9af['status'](_0x1c4384)[_0x8476('0x29')](_0x8bae6);}};}function respondWithFilteredResult(_0x131f9d,_0x3a34a9){return function(_0x3543c5){if(_0x3543c5){var _0x14d95b=typeof _0x3a34a9[_0x8476('0x2a')]===_0x8476('0x2b')&&typeof _0x3a34a9[_0x8476('0x2c')]===_0x8476('0x2b');var _0x188a7a=_0x3543c5[_0x8476('0x2d')];var _0x36abd3=_0x14d95b?0x0:_0x3a34a9['offset'];var _0x2e9ac4=_0x14d95b?_0x3543c5[_0x8476('0x2d')]:_0x3a34a9['offset']+_0x3a34a9[_0x8476('0x2c')];var _0xa1a511;if(_0x2e9ac4>=_0x188a7a){_0x2e9ac4=_0x188a7a;_0xa1a511=0xc8;}else{_0xa1a511=0xce;}_0x131f9d['status'](_0xa1a511);return _0x131f9d['set'](_0x8476('0x2e'),_0x36abd3+'-'+_0x2e9ac4+'/'+_0x188a7a)[_0x8476('0x29')](_0x3543c5);}return null;};}function patchUpdates(_0x407e97){return function(_0x4a527f){try{jsonpatch[_0x8476('0x2f')](_0x4a527f,_0x407e97,!![]);}catch(_0x198d9e){return BPromise[_0x8476('0x30')](_0x198d9e);}return _0x4a527f[_0x8476('0x31')]();};}function saveUpdates(_0x2c0e7a,_0x5bae65){return function(_0x2aee30){if(_0x2aee30){return _0x2aee30[_0x8476('0x32')](_0x2c0e7a)[_0x8476('0x33')](function(_0x27531f){return _0x27531f;});}return null;};}function removeEntity(_0x3cdc18,_0x5c5409){return function(_0x4e9d13){if(_0x4e9d13){return _0x4e9d13[_0x8476('0x34')]()[_0x8476('0x33')](function(){var _0x472a7d=_0x4e9d13['get']({'plain':!![]});var _0x597662=_0x8476('0x35');return db['UserProfileResource'][_0x8476('0x34')]({'where':{'type':_0x597662,'resourceId':_0x472a7d['id']}})[_0x8476('0x33')](function(){return _0x4e9d13;});})[_0x8476('0x33')](function(){_0x3cdc18[_0x8476('0x27')](0xcc)[_0x8476('0x28')]();});}};}function handleEntityNotFound(_0x59410a,_0x55b21a){return function(_0x4b736f){if(!_0x4b736f){_0x59410a[_0x8476('0x36')](0x194);}return _0x4b736f;};}function handleError(_0x52afbf,_0x56141c){_0x56141c=_0x56141c||0x1f4;return function(_0xf006dc){logger[_0x8476('0x21')](_0xf006dc[_0x8476('0x37')]);if(_0xf006dc[_0x8476('0x38')]){delete _0xf006dc['name'];}_0x52afbf[_0x8476('0x27')](_0x56141c)['send'](_0xf006dc);};}exports[_0x8476('0x39')]=function(_0x259b27,_0x273cb2){var _0x10d8fb={},_0x533d7c={},_0x384c72={'count':0x0,'rows':[]};var _0x2491c0=_[_0x8476('0x3a')](db[_0x8476('0x3b')]['rawAttributes'],function(_0x7dacd9){return{'name':_0x7dacd9[_0x8476('0x3c')],'type':_0x7dacd9[_0x8476('0x3d')][_0x8476('0x3e')]};});_0x533d7c['model']=_['map'](_0x2491c0,_0x8476('0x38'));_0x533d7c[_0x8476('0x3f')]=_['keys'](_0x259b27[_0x8476('0x3f')]);_0x533d7c['filters']=_['intersection'](_0x533d7c[_0x8476('0x40')],_0x533d7c['query']);_0x10d8fb['attributes']=_[_0x8476('0x41')](_0x533d7c[_0x8476('0x40')],qs[_0x8476('0x42')](_0x259b27[_0x8476('0x3f')][_0x8476('0x42')]));_0x10d8fb['attributes']=_0x10d8fb['attributes'][_0x8476('0x43')]?_0x10d8fb[_0x8476('0x44')]:_0x533d7c[_0x8476('0x40')];if(!_0x259b27['query'][_0x8476('0x45')](_0x8476('0x46'))){_0x10d8fb[_0x8476('0x2c')]=qs[_0x8476('0x2c')](_0x259b27[_0x8476('0x3f')][_0x8476('0x2c')]);_0x10d8fb[_0x8476('0x2a')]=qs[_0x8476('0x2a')](_0x259b27[_0x8476('0x3f')][_0x8476('0x2a')]);}_0x10d8fb[_0x8476('0x47')]=qs[_0x8476('0x48')](_0x259b27['query'][_0x8476('0x48')]);_0x10d8fb[_0x8476('0x49')]=qs[_0x8476('0x4a')](_['pick'](_0x259b27[_0x8476('0x3f')],_0x533d7c[_0x8476('0x4a')]),_0x2491c0);if(_0x259b27['query'][_0x8476('0x4b')]){_0x10d8fb['where']=_[_0x8476('0x4c')](_0x10d8fb['where'],{'$or':_[_0x8476('0x3a')](_0x2491c0,function(_0x4d997d){if(_0x4d997d[_0x8476('0x3d')]!==_0x8476('0x4d')){var _0x215999={};_0x215999[_0x4d997d[_0x8476('0x38')]]={'$like':'%'+_0x259b27[_0x8476('0x3f')][_0x8476('0x4b')]+'%'};return _0x215999;}})});}_0x10d8fb=_[_0x8476('0x4c')]({},_0x10d8fb,_0x259b27[_0x8476('0x4e')]);var _0xf5735c={'where':_0x10d8fb[_0x8476('0x49')]};return db[_0x8476('0x3b')][_0x8476('0x2d')](_0xf5735c)['then'](function(_0x5c51da){_0x384c72[_0x8476('0x2d')]=_0x5c51da;if(_0x259b27['query'][_0x8476('0x4f')]){_0x10d8fb[_0x8476('0x50')]=[{'all':!![]}];}return db[_0x8476('0x3b')][_0x8476('0x51')](_0x10d8fb);})[_0x8476('0x33')](function(_0x1d3ca0){_0x384c72['rows']=_0x1d3ca0;return _0x384c72;})[_0x8476('0x33')](respondWithFilteredResult(_0x273cb2,_0x10d8fb))[_0x8476('0x26')](handleError(_0x273cb2,null));};exports[_0x8476('0x52')]=function(_0x332af7,_0x1037ea){var _0x15131c={'raw':!![],'where':{'id':_0x332af7['params']['id']}},_0x185bfd={};_0x185bfd[_0x8476('0x40')]=_[_0x8476('0x53')](db[_0x8476('0x3b')][_0x8476('0x54')]);_0x185bfd['query']=_['keys'](_0x332af7[_0x8476('0x3f')]);_0x185bfd[_0x8476('0x4a')]=_[_0x8476('0x41')](_0x185bfd[_0x8476('0x40')],_0x185bfd['query']);_0x15131c[_0x8476('0x44')]=_[_0x8476('0x41')](_0x185bfd['model'],qs[_0x8476('0x42')](_0x332af7['query'][_0x8476('0x42')]));_0x15131c[_0x8476('0x44')]=_0x15131c['attributes'][_0x8476('0x43')]?_0x15131c[_0x8476('0x44')]:_0x185bfd['model'];if(_0x332af7['query'][_0x8476('0x4f')]){_0x15131c[_0x8476('0x50')]=[{'all':!![]}];}_0x15131c=_[_0x8476('0x4c')]({},_0x15131c,_0x332af7[_0x8476('0x4e')]);return db[_0x8476('0x3b')]['find'](_0x15131c)[_0x8476('0x33')](handleEntityNotFound(_0x1037ea,null))['then'](respondWithResult(_0x1037ea,null))[_0x8476('0x26')](handleError(_0x1037ea,null));};exports['create']=function(_0x1232bd,_0x534aeb){return db[_0x8476('0x3b')][_0x8476('0x55')](_0x1232bd[_0x8476('0x56')],{})[_0x8476('0x33')](function(_0x34230b){var _0x4c6fdd=_0x1232bd[_0x8476('0x57')]['get']({'plain':!![]});if(!_0x4c6fdd)throw new Error(_0x8476('0x58'));if(_0x4c6fdd[_0x8476('0x59')]==='user'){var _0x349ad5=_0x34230b[_0x8476('0x5a')]({'plain':!![]});var _0x46d648=_0x8476('0x35');return db[_0x8476('0x5b')]['find']({'where':{'name':_0x46d648,'userProfileId':_0x4c6fdd[_0x8476('0x5c')]},'raw':!![]})[_0x8476('0x33')](function(_0x5086d4){if(_0x5086d4&&_0x5086d4[_0x8476('0x5d')]===0x0){return db[_0x8476('0x5e')][_0x8476('0x55')]({'name':_0x349ad5[_0x8476('0x38')],'resourceId':_0x349ad5['id'],'type':_0x5086d4[_0x8476('0x38')],'sectionId':_0x5086d4['id']},{})['then'](function(){return _0x34230b;});}else{return _0x34230b;}})[_0x8476('0x26')](function(_0x4c3de3){logger[_0x8476('0x21')](_0x8476('0x5f'),_0x4c3de3);throw _0x4c3de3;});}return _0x34230b;})[_0x8476('0x33')](respondWithResult(_0x534aeb,0xc9))[_0x8476('0x26')](handleError(_0x534aeb,null));};exports[_0x8476('0x32')]=function(_0x2b931f,_0x4eef39){if(_0x2b931f[_0x8476('0x56')]['id']){delete _0x2b931f[_0x8476('0x56')]['id'];}return db[_0x8476('0x3b')][_0x8476('0x60')]({'where':{'id':_0x2b931f[_0x8476('0x61')]['id']}})[_0x8476('0x33')](handleEntityNotFound(_0x4eef39,null))[_0x8476('0x33')](saveUpdates(_0x2b931f['body'],null))['then'](respondWithResult(_0x4eef39,null))[_0x8476('0x26')](handleError(_0x4eef39,null));};exports[_0x8476('0x34')]=function(_0x291a26,_0x1ed69a){return db[_0x8476('0x3b')][_0x8476('0x60')]({'where':{'id':_0x291a26['params']['id']}})['then'](handleEntityNotFound(_0x1ed69a,null))[_0x8476('0x33')](removeEntity(_0x1ed69a,null))[_0x8476('0x26')](handleError(_0x1ed69a,null));};exports['describe']=function(_0x19c1a8,_0x220a43){return db[_0x8476('0x3b')][_0x8476('0x62')]()[_0x8476('0x33')](respondWithResult(_0x220a43,null))[_0x8476('0x26')](handleError(_0x220a43,null));};exports[_0x8476('0x63')]=function(_0x11a130,_0xb6530,_0x3de839){var _0x248e15={'raw':!![],'where':{}},_0x231ab6={},_0x6ecf46;return db[_0x8476('0x3b')][_0x8476('0x64')]({'where':{'id':_0x11a130[_0x8476('0x61')]['id']}})[_0x8476('0x33')](handleEntityNotFound(_0xb6530,null))[_0x8476('0x33')](function(_0x5bcd3d){if(_0x5bcd3d){_0x6ecf46=_0x5bcd3d[_0x8476('0x5a')]({'plain':!![]});_0x231ab6[_0x8476('0x40')]=_[_0x8476('0x53')](db[_0x8476('0x65')][_0x8476('0x54')]);_0x231ab6[_0x8476('0x3f')]=_[_0x8476('0x53')](_0x11a130[_0x8476('0x3f')]);_0x231ab6[_0x8476('0x4a')]=_[_0x8476('0x41')](_0x231ab6[_0x8476('0x40')],_0x231ab6['query']);_0x248e15[_0x8476('0x44')]=_['intersection'](_0x231ab6[_0x8476('0x40')],qs[_0x8476('0x42')](_0x11a130['query'][_0x8476('0x42')]));_0x248e15[_0x8476('0x44')]=_0x248e15[_0x8476('0x44')]['length']?_0x248e15[_0x8476('0x44')]:_0x231ab6['model'];if(!_0x11a130[_0x8476('0x3f')][_0x8476('0x45')](_0x8476('0x46'))){_0x248e15[_0x8476('0x2c')]=qs[_0x8476('0x2c')](_0x11a130[_0x8476('0x3f')][_0x8476('0x2c')]);_0x248e15['offset']=qs[_0x8476('0x2a')](_0x11a130[_0x8476('0x3f')][_0x8476('0x2a')]);}_0x248e15['order']=qs['sort'](_0x11a130['query'][_0x8476('0x48')]);_0x248e15[_0x8476('0x49')]=qs[_0x8476('0x4a')](_['pick'](_0x11a130[_0x8476('0x3f')],_0x231ab6[_0x8476('0x4a')]));_0x248e15['where'][_0x8476('0x66')]=_0x5bcd3d['id'];if(_0x11a130[_0x8476('0x3f')][_0x8476('0x4b')]){_0x248e15[_0x8476('0x49')]=_[_0x8476('0x4c')](_0x248e15[_0x8476('0x49')],{'$or':_[_0x8476('0x3a')](_0x248e15['attributes'],function(_0x121514){var _0x2943ec={};_0x2943ec[_0x121514]={'$like':'%'+_0x11a130['query'][_0x8476('0x4b')]+'%'};return _0x2943ec;})});}_0x248e15=_[_0x8476('0x4c')]({},_0x248e15,_0x11a130[_0x8476('0x4e')]);return db[_0x8476('0x65')]['findAll'](_0x248e15);}})[_0x8476('0x33')](function(_0x6af0a3){if(_0x6af0a3){return db[_0x8476('0x67')][_0x8476('0x68')]({'where':{'id':_[_0x8476('0x3a')](_0x6af0a3,_0x8476('0x69')),'role':'agent'},'attributes':['id','name','chatPause',_0x8476('0x6a'),_0x8476('0x6b')]});}})[_0x8476('0x33')](function(_0x2209f8){if(_0x2209f8){return{'count':_0x2209f8[_0x8476('0x2d')],'rows':_['map'](_0x2209f8['rows'],function(_0x3d3029){return{'membername':_0x3d3029['name'],'UserId':_0x3d3029['id'],'queue_name':_0x6ecf46[_0x8476('0x38')],'ChatQueueId':_0x6ecf46['id'],'interface':util[_0x8476('0x6c')](_0x8476('0x6d'),_0x8476('0x6e'),_0x3d3029[_0x8476('0x38')]),'penalty':0x0,'paused':_0x3d3029['chatPause'],'createdAt':_0x3d3029['createdAt'],'updatedAt':_0x3d3029['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8476('0x33')](respondWithFilteredResult(_0xb6530,_0x248e15))[_0x8476('0x26')](handleError(_0xb6530,null));};exports['getTeams']=function(_0x646393,_0x2d5f23,_0x1521a2){var _0x50c377={};var _0x487808={};var _0x5ba32a;var _0x328fa5;return db[_0x8476('0x3b')][_0x8476('0x64')]({'where':{'id':_0x646393[_0x8476('0x61')]['id']}})[_0x8476('0x33')](handleEntityNotFound(_0x2d5f23,null))[_0x8476('0x33')](function(_0x5b2f95){if(_0x5b2f95){_0x5ba32a=_0x5b2f95;_0x487808['model']=_[_0x8476('0x53')](db['Team'][_0x8476('0x54')]);_0x487808['query']=_[_0x8476('0x53')](_0x646393['query']);_0x487808['filters']=_[_0x8476('0x41')](_0x487808[_0x8476('0x40')],_0x487808[_0x8476('0x3f')]);_0x50c377[_0x8476('0x44')]=_[_0x8476('0x41')](_0x487808['model'],qs['fields'](_0x646393[_0x8476('0x3f')][_0x8476('0x42')]));_0x50c377['attributes']=_0x50c377[_0x8476('0x44')][_0x8476('0x43')]?_0x50c377[_0x8476('0x44')]:_0x487808[_0x8476('0x40')];_0x50c377['order']=qs[_0x8476('0x48')](_0x646393[_0x8476('0x3f')][_0x8476('0x48')]);_0x50c377[_0x8476('0x49')]=qs[_0x8476('0x4a')](_[_0x8476('0x6f')](_0x646393[_0x8476('0x3f')],_0x487808[_0x8476('0x4a')]));if(_0x646393[_0x8476('0x3f')][_0x8476('0x4b')]){_0x50c377[_0x8476('0x49')]=_[_0x8476('0x4c')](_0x50c377[_0x8476('0x49')],{'$or':_[_0x8476('0x3a')](_0x50c377[_0x8476('0x44')],function(_0x4f014c){var _0x3ec74d={};_0x3ec74d[_0x4f014c]={'$like':'%'+_0x646393[_0x8476('0x3f')][_0x8476('0x4b')]+'%'};return _0x3ec74d;})});}_0x50c377=_[_0x8476('0x4c')]({},_0x50c377,_0x646393[_0x8476('0x4e')]);return _0x5ba32a['getTeams'](_0x50c377);}})['then'](function(_0x54ac9a){if(_0x54ac9a){_0x328fa5=_0x54ac9a['length'];if(!_0x646393[_0x8476('0x3f')][_0x8476('0x45')](_0x8476('0x46'))){_0x50c377[_0x8476('0x2c')]=qs['limit'](_0x646393['query']['limit']);_0x50c377[_0x8476('0x2a')]=qs[_0x8476('0x2a')](_0x646393[_0x8476('0x3f')][_0x8476('0x2a')]);}return _0x5ba32a[_0x8476('0x70')](_0x50c377);}})[_0x8476('0x33')](function(_0x15d0f0){if(_0x15d0f0){return _0x15d0f0?{'count':_0x328fa5,'rows':_0x15d0f0}:null;}})[_0x8476('0x33')](respondWithResult(_0x2d5f23,null))[_0x8476('0x26')](handleError(_0x2d5f23,null));};exports[_0x8476('0x71')]=function(_0x59aabb,_0x20f216,_0x359278){var _0x40b1cb=_0x59aabb['body'][_0x8476('0x72')];return db[_0x8476('0x73')][_0x8476('0x51')]({'where':{'id':_0x40b1cb},'attributes':['id'],'include':[{'model':db[_0x8476('0x67')],'as':'Agents','attributes':['id',_0x8476('0x38'),'online',_0x8476('0x74'),'interface'],'raw':!![]}]})[_0x8476('0x33')](function(_0x541c88){if(_0x541c88){var _0x5ba4b6=_['flatMap'](_0x541c88,function(_0x55c71b){var _0x47c75e=_0x55c71b['get']({'plain':!![]});return _0x47c75e[_0x8476('0x75')];});return db[_0x8476('0x3b')]['find']({'where':{'id':_0x59aabb['params']['id']}})[_0x8476('0x33')](function(_0x4ccc00){return db[_0x8476('0x76')][_0x8476('0x77')](function(_0x40bb4e){return _0x4ccc00['addTeams'](_0x40b1cb,{'transaction':_0x40bb4e})[_0x8476('0x33')](function(){return BPromise[_0x8476('0x78')](_0x5ba4b6,function(_0x529984){return db['UserChatQueue'][_0x8476('0x79')]({'where':{'UserId':_0x529984['id'],'ChatQueueId':_0x59aabb['params']['id']},'transaction':_0x40bb4e});});})[_0x8476('0x33')](function(){_0x5ba4b6[_0x8476('0x7a')](function(_0x3b6dd8){socket[_0x8476('0x7b')](_0x8476('0x7c'),{'UserId':_0x3b6dd8['id'],'ChatQueueId':_0x4ccc00['id']});});});});});}})[_0x8476('0x33')](respondWithStatusCode(_0x20f216,null))[_0x8476('0x26')](handleError(_0x20f216,null));};exports['removeTeams']=function(_0x347a96,_0x27d4f2,_0x2f6c13){return db[_0x8476('0x73')][_0x8476('0x51')]({'where':{'id':_0x347a96[_0x8476('0x3f')][_0x8476('0x72')]},'attributes':['id'],'include':[{'model':db[_0x8476('0x67')],'as':_0x8476('0x75'),'attributes':['id'],'raw':!![]}]})[_0x8476('0x33')](handleEntityNotFound(_0x27d4f2,null))[_0x8476('0x33')](function(_0x8949db){var _0xeb120c=_['map'](_0x8949db,'id');var _0x326efd=[];var _0x78b151=[];var _0x4308f4=squel[_0x8476('0x7d')]();_0x4308f4['field'](_0x8476('0x7e'))[_0x8476('0x7f')]('team_has_chat_queues','tq')[_0x8476('0x80')](_0x8476('0x81'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8476('0x82'),_0x347a96[_0x8476('0x61')]['id']);for(var _0xfdee75=0x0;_0xfdee75<_0x8949db[_0x8476('0x43')];_0xfdee75+=0x1){let _0x5ed36c=_0x8949db[_0xfdee75];for(var _0x466ea6=0x0;_0x466ea6<_0x5ed36c[_0x8476('0x75')]['length'];_0x466ea6+=0x1){let _0x3ecc89=_0x5ed36c[_0x8476('0x75')][_0x466ea6];var _0x53ccb3=_0x4308f4[_0x8476('0x83')]();_0x53ccb3[_0x8476('0x49')]('ut.UserId\x20=\x20?',_0x3ecc89['id']);_0x78b151['push'](db['sequelize'][_0x8476('0x3f')](_0x53ccb3[_0x8476('0x84')](),{'type':db[_0x8476('0x76')][_0x8476('0x85')]['SELECT']})['then'](function(_0x37ec12){if(_0x37ec12[_0x8476('0x43')]===0x1){return _0x3ecc89['id'];}else{var _0x1fb008=_[_0x8476('0x86')](_['map'](_0x37ec12,_0x8476('0x87')),function(_0x4652c1){return _[_0x8476('0x88')](_0xeb120c,_0x4652c1);});if(_0x1fb008){return _0x3ecc89['id'];}}}));}}return BPromise[_0x8476('0x89')](_0x78b151)['then'](function(_0x4f2616){_0x326efd=_(_0x326efd)['union'](_0x4f2616)['compact']()[_0x8476('0x8a')]();return db[_0x8476('0x3b')][_0x8476('0x60')]({'where':{'id':_0x347a96[_0x8476('0x61')]['id']}})[_0x8476('0x33')](function(_0x2ccea5){return db[_0x8476('0x76')][_0x8476('0x77')](function(_0x4fb8f2){return _0x2ccea5[_0x8476('0x8b')](_0x347a96[_0x8476('0x3f')][_0x8476('0x72')],{'transaction':_0x4fb8f2})['then'](function(){if(!_[_0x8476('0x8c')](_0x326efd)){return _0x2ccea5[_0x8476('0x8d')](_0x326efd,{'transaction':_0x4fb8f2});}})[_0x8476('0x33')](function(){_0x326efd[_0x8476('0x7a')](function(_0x514866){socket[_0x8476('0x7b')](_0x8476('0x8e'),{'UserId':_0x514866,'ChatQueueId':_0x2ccea5['id']});});});});});});})[_0x8476('0x33')](respondWithStatusCode(_0x27d4f2,null))['catch'](handleError(_0x27d4f2,null));};exports[_0x8476('0x8f')]=function(_0x36b3a3,_0x7f462a,_0x4e7fb2){return db[_0x8476('0x3b')][_0x8476('0x60')]({'where':{'id':_0x36b3a3[_0x8476('0x61')]['id']}})[_0x8476('0x33')](handleEntityNotFound(_0x7f462a,null))['then'](function(_0x3d5630){if(_0x3d5630){return _0x3d5630[_0x8476('0x8f')](_0x36b3a3['body'][_0x8476('0x72')],_['omit'](_0x36b3a3['body'],['ids','id'])||{})['spread'](function(_0x51b6bd){for(var _0x66a2d3=0x0;_0x66a2d3<_0x36b3a3['body']['ids'][_0x8476('0x43')];_0x66a2d3+=0x1){socket[_0x8476('0x7b')](_0x8476('0x7c'),{'UserId':Number(_0x36b3a3[_0x8476('0x56')]['ids'][_0x66a2d3]),'ChatQueueId':Number(_0x36b3a3[_0x8476('0x61')]['id'])});}return _0x51b6bd;});}})['then'](respondWithResult(_0x7f462a,null))[_0x8476('0x26')](handleError(_0x7f462a,null));};exports[_0x8476('0x8d')]=function(_0x17b141,_0x423daa,_0x13f695){return db['ChatQueue'][_0x8476('0x60')]({'where':{'id':_0x17b141[_0x8476('0x61')]['id']}})[_0x8476('0x33')](handleEntityNotFound(_0x423daa,null))['then'](function(_0x512493){if(_0x512493){return _0x512493[_0x8476('0x8d')](_0x17b141[_0x8476('0x3f')][_0x8476('0x72')])['then'](function(){if(_[_0x8476('0x90')](_0x17b141[_0x8476('0x3f')]['ids'])){for(var _0x5574ba=0x0;_0x5574ba<_0x17b141[_0x8476('0x3f')][_0x8476('0x72')][_0x8476('0x43')];_0x5574ba+=0x1){socket[_0x8476('0x7b')](_0x8476('0x8e'),{'UserId':Number(_0x17b141['query']['ids'][_0x5574ba]),'ChatQueueId':Number(_0x17b141['params']['id'])});}}else{socket[_0x8476('0x7b')](_0x8476('0x8e'),{'UserId':Number(_0x17b141[_0x8476('0x3f')][_0x8476('0x72')]),'ChatQueueId':Number(_0x17b141['params']['id'])});}});}})['then'](respondWithStatusCode(_0x423daa,null))[_0x8476('0x26')](handleError(_0x423daa,null));};exports[_0x8476('0x91')]=function(_0x300146,_0x37155c,_0x5a5c6e){var _0x12ffd5={};var _0x22516e={};var _0x164969;var _0xb88e75;return db[_0x8476('0x3b')][_0x8476('0x64')]({'where':{'id':_0x300146['params']['id']}})[_0x8476('0x33')](handleEntityNotFound(_0x37155c,null))[_0x8476('0x33')](function(_0x4c6424){if(_0x4c6424){_0x164969=_0x4c6424;_0x22516e[_0x8476('0x40')]=_[_0x8476('0x53')](db[_0x8476('0x67')][_0x8476('0x54')]);_0x22516e[_0x8476('0x3f')]=_[_0x8476('0x53')](_0x300146[_0x8476('0x3f')]);_0x22516e[_0x8476('0x4a')]=_[_0x8476('0x41')](_0x22516e[_0x8476('0x40')],_0x22516e[_0x8476('0x3f')]);_0x12ffd5[_0x8476('0x44')]=_['intersection'](_0x22516e[_0x8476('0x40')],qs[_0x8476('0x42')](_0x300146['query'][_0x8476('0x42')]));_0x12ffd5[_0x8476('0x44')]=_0x12ffd5[_0x8476('0x44')][_0x8476('0x43')]?_0x12ffd5[_0x8476('0x44')]:_0x22516e[_0x8476('0x40')];_0x12ffd5[_0x8476('0x47')]=qs[_0x8476('0x48')](_0x300146['query'][_0x8476('0x48')]);_0x12ffd5['where']=qs[_0x8476('0x4a')](_[_0x8476('0x6f')](_0x300146[_0x8476('0x3f')],_0x22516e['filters']));if(_0x300146['query'][_0x8476('0x4b')]){_0x12ffd5[_0x8476('0x49')]=_[_0x8476('0x4c')](_0x12ffd5[_0x8476('0x49')],{'$or':_[_0x8476('0x3a')](_0x12ffd5['attributes'],function(_0x2beacd){var _0x501570={};_0x501570[_0x2beacd]={'$like':'%'+_0x300146['query']['filter']+'%'};return _0x501570;})});}_0x12ffd5=_[_0x8476('0x4c')]({},_0x12ffd5,_0x300146[_0x8476('0x4e')]);return _0x164969[_0x8476('0x91')](_0x12ffd5);}})[_0x8476('0x33')](function(_0x18a479){if(_0x18a479){_0xb88e75=_0x18a479['length'];if(!_0x300146[_0x8476('0x3f')][_0x8476('0x45')]('nolimit')){_0x12ffd5[_0x8476('0x2c')]=qs[_0x8476('0x2c')](_0x300146[_0x8476('0x3f')][_0x8476('0x2c')]);_0x12ffd5[_0x8476('0x2a')]=qs[_0x8476('0x2a')](_0x300146[_0x8476('0x3f')][_0x8476('0x2a')]);}return _0x164969[_0x8476('0x91')](_0x12ffd5);}})[_0x8476('0x33')](function(_0x3d1083){if(_0x3d1083){return _0x3d1083?{'count':_0xb88e75,'rows':_0x3d1083}:null;}})[_0x8476('0x33')](respondWithResult(_0x37155c,null))[_0x8476('0x26')](handleError(_0x37155c,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index b5571b0..b2313dd 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 _0x0735=['save','update','emit','hook','exports','events','ChatQueue','setMaxListeners'];(function(_0x57bb67,_0x30811c){var _0x12ed21=function(_0x29d120){while(--_0x29d120){_0x57bb67['push'](_0x57bb67['shift']());}};_0x12ed21(++_0x30811c);}(_0x0735,0x1a5));var _0x5073=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x0735[_0x334841];return _0x5beb4b;};'use strict';var EventEmitter=require(_0x5073('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x5073('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x5073('0x2')](0x0);var events={'afterCreate':_0x5073('0x3'),'afterUpdate':_0x5073('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4f3655){return function(_0x1eb041,_0x53a228,_0x2bddd4){ChatQueueEvents[_0x5073('0x5')](_0x4f3655+':'+_0x1eb041['id'],_0x1eb041);ChatQueueEvents[_0x5073('0x5')](_0x4f3655,_0x1eb041);_0x2bddd4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x5073('0x6')](e,emitEvent(event));}}module[_0x5073('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xbbdb=['setMaxListeners','save','update','emit','hook','../../mysqldb','ChatQueue'];(function(_0x393ec8,_0x2d382c){var _0x1d7d80=function(_0x309fe5){while(--_0x309fe5){_0x393ec8['push'](_0x393ec8['shift']());}};_0x1d7d80(++_0x2d382c);}(_0xbbdb,0x11d));var _0xbbbd=function(_0x74115b,_0x31f752){_0x74115b=_0x74115b-0x0;var _0x57ebbd=_0xbbdb[_0x74115b];return _0x57ebbd;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0xbbbd('0x0'))['db'][_0xbbbd('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbbbd('0x2')](0x0);var events={'afterCreate':_0xbbbd('0x3'),'afterUpdate':_0xbbbd('0x4'),'afterDestroy':'remove'};function emitEvent(_0x544d8f){return function(_0x16e4ca,_0x2a55cf,_0x4dcbc6){ChatQueueEvents[_0xbbbd('0x5')](_0x544d8f+':'+_0x16e4ca['id'],_0x16e4ca);ChatQueueEvents[_0xbbbd('0x5')](_0x544d8f,_0x16e4ca);_0x4dcbc6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xbbbd('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 352975e..3d51d7c 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 _0x5d9d=['./chatQueue.attributes','exports','ChatQueue','chat_queues','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x10a727,_0x587594){var _0x12b584=function(_0x156840){while(--_0x156840){_0x10a727['push'](_0x10a727['shift']());}};_0x12b584(++_0x587594);}(_0x5d9d,0xca));var _0xd5d9=function(_0x5d342b,_0x1bab62){_0x5d342b=_0x5d342b-0x0;var _0xa0e548=_0x5d9d[_0x5d342b];return _0xa0e548;};'use strict';var _=require(_0xd5d9('0x0'));var util=require(_0xd5d9('0x1'));var logger=require(_0xd5d9('0x2'))('api');var moment=require(_0xd5d9('0x3'));var BPromise=require('bluebird');var rp=require(_0xd5d9('0x4'));var fs=require('fs');var path=require(_0xd5d9('0x5'));var rimraf=require(_0xd5d9('0x6'));var config=require('../../config/environment');var attributes=require(_0xd5d9('0x7'));module[_0xd5d9('0x8')]=function(_0x17fa64,_0x4b0292){return _0x17fa64['define'](_0xd5d9('0x9'),attributes,{'tableName':_0xd5d9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8f1=['moment','bluebird','request-promise','path','./chatQueue.attributes','define','ChatQueue','chat_queues','lodash','util','../../config/logger'];(function(_0x568cf0,_0x1a44cb){var _0x360f81=function(_0x414953){while(--_0x414953){_0x568cf0['push'](_0x568cf0['shift']());}};_0x360f81(++_0x1a44cb);}(_0xf8f1,0x11b));var _0x1f8f=function(_0x209e12,_0x2ce907){_0x209e12=_0x209e12-0x0;var _0x3f5b89=_0xf8f1[_0x209e12];return _0x3f5b89;};'use strict';var _=require(_0x1f8f('0x0'));var util=require(_0x1f8f('0x1'));var logger=require(_0x1f8f('0x2'))('api');var moment=require(_0x1f8f('0x3'));var BPromise=require(_0x1f8f('0x4'));var rp=require(_0x1f8f('0x5'));var fs=require('fs');var path=require(_0x1f8f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1f8f('0x7'));module['exports']=function(_0x408507,_0x314561){return _0x408507[_0x1f8f('0x8')](_0x1f8f('0x9'),attributes,{'tableName':_0x1f8f('0xa'),'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 0dc005a..4b949a9 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 _0x0598=['include','map','model','GetChatQueue','raw','ShowChatQueue','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','then','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','catch','ChatQueue','findAll','options','where','attributes'];(function(_0x3b1d1e,_0x523d23){var _0x4eddf1=function(_0x4339e0){while(--_0x4339e0){_0x3b1d1e['push'](_0x3b1d1e['shift']());}};_0x4eddf1(++_0x523d23);}(_0x0598,0x92));var _0x8059=function(_0x5c9006,_0x3c3e0f){_0x5c9006=_0x5c9006-0x0;var _0x85c51a=_0x0598[_0x5c9006];return _0x85c51a;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});config['redis']=_[_0x8059('0x7')](config[_0x8059('0x8')],{'host':_0x8059('0x9'),'port':0x18eb});var socket=require(_0x8059('0xa'))(new Redis(config['redis']));require('./chatQueue.socket')[_0x8059('0xb')](socket);function respondWithRpcPromise(_0x1bf5fd,_0x336f85,_0x5097d6){return new BPromise(function(_0x283b63,_0x52a60d){return client['request'](_0x1bf5fd,_0x5097d6)[_0x8059('0xc')](function(_0x4109a9){logger['info']('ChatQueue,\x20%s,\x20%s',_0x336f85,'request\x20sent');logger[_0x8059('0xd')](_0x8059('0xe'),_0x336f85,_0x8059('0xf'),JSON[_0x8059('0x10')](_0x4109a9));if(_0x4109a9[_0x8059('0x11')]){if(_0x4109a9['error'][_0x8059('0x12')]===0x1f4){logger['error'](_0x8059('0x13'),_0x336f85,_0x4109a9['error'][_0x8059('0x14')]);return _0x52a60d(_0x4109a9[_0x8059('0x11')][_0x8059('0x14')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x336f85,_0x4109a9['error'][_0x8059('0x14')]);return _0x283b63(_0x4109a9[_0x8059('0x11')][_0x8059('0x14')]);}else{logger[_0x8059('0x15')](_0x8059('0x13'),_0x336f85,'request\x20sent');_0x283b63(_0x4109a9[_0x8059('0x16')][_0x8059('0x14')]);}})[_0x8059('0x17')](function(_0x1c4566){logger['error'](_0x8059('0x13'),_0x336f85,_0x1c4566);_0x52a60d(_0x1c4566);});});}exports['GetChatQueue']=function(_0x113f42){var _0x493825=this;return new Promise(function(_0x1857c1,_0x56d794){return db[_0x8059('0x18')][_0x8059('0x19')]({'raw':_0x113f42[_0x8059('0x1a')]?_0x113f42['options']['raw']===undefined?!![]:![]:!![],'where':_0x113f42[_0x8059('0x1a')]?_0x113f42[_0x8059('0x1a')][_0x8059('0x1b')]||null:null,'attributes':_0x113f42[_0x8059('0x1a')]?_0x113f42['options'][_0x8059('0x1c')]||null:null,'limit':_0x113f42[_0x8059('0x1a')]?_0x113f42[_0x8059('0x1a')]['limit']||null:null,'include':_0x113f42[_0x8059('0x1a')]?_0x113f42[_0x8059('0x1a')][_0x8059('0x1d')]?_[_0x8059('0x1e')](_0x113f42['options'][_0x8059('0x1d')],function(_0x2cd179){return{'model':db[_0x2cd179[_0x8059('0x1f')]],'as':_0x2cd179['as'],'attributes':_0x2cd179[_0x8059('0x1c')],'include':_0x2cd179[_0x8059('0x1d')]?_['map'](_0x2cd179[_0x8059('0x1d')],function(_0x19b95a){return{'model':db[_0x19b95a[_0x8059('0x1f')]],'as':_0x19b95a['as'],'attributes':_0x19b95a['attributes'],'include':_0x19b95a['include']?_['map'](_0x19b95a[_0x8059('0x1d')],function(_0xbebe0e){return{'model':db[_0xbebe0e[_0x8059('0x1f')]],'as':_0xbebe0e['as'],'attributes':_0xbebe0e[_0x8059('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1eb71b){logger['info'](_0x8059('0x20'),_0x113f42);logger[_0x8059('0xd')]('GetChatQueue',_0x113f42,JSON[_0x8059('0x10')](_0x1eb71b));_0x1857c1(_0x1eb71b);})[_0x8059('0x17')](function(_0x30aac2){logger[_0x8059('0x11')](_0x8059('0x20'),_0x30aac2[_0x8059('0x14')],_0x113f42);_0x56d794(_0x493825[_0x8059('0x11')](0x1f4,_0x30aac2[_0x8059('0x14')]));});});};exports['ShowChatQueue']=function(_0xb3c36e){var _0x40b39e=this;return new Promise(function(_0x1f8983,_0x15f843){return db[_0x8059('0x18')]['find']({'raw':_0xb3c36e[_0x8059('0x1a')]?_0xb3c36e[_0x8059('0x1a')][_0x8059('0x21')]===undefined?!![]:![]:!![],'where':_0xb3c36e[_0x8059('0x1a')]?_0xb3c36e[_0x8059('0x1a')][_0x8059('0x1b')]||null:null,'attributes':_0xb3c36e[_0x8059('0x1a')]?_0xb3c36e[_0x8059('0x1a')][_0x8059('0x1c')]||null:null,'include':_0xb3c36e[_0x8059('0x1a')]?_0xb3c36e['options'][_0x8059('0x1d')]?_['map'](_0xb3c36e[_0x8059('0x1a')]['include'],function(_0x49fb7e){return{'model':db[_0x49fb7e[_0x8059('0x1f')]],'as':_0x49fb7e['as'],'attributes':_0x49fb7e['attributes'],'include':_0x49fb7e[_0x8059('0x1d')]?_['map'](_0x49fb7e[_0x8059('0x1d')],function(_0x55ddda){return{'model':db[_0x55ddda[_0x8059('0x1f')]],'as':_0x55ddda['as'],'attributes':_0x55ddda[_0x8059('0x1c')],'include':_0x55ddda['include']?_[_0x8059('0x1e')](_0x55ddda[_0x8059('0x1d')],function(_0x3e5fd3){return{'model':db[_0x3e5fd3['model']],'as':_0x3e5fd3['as'],'attributes':_0x3e5fd3[_0x8059('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e8596){logger['info'](_0x8059('0x22'),_0xb3c36e);logger[_0x8059('0xd')](_0x8059('0x22'),_0xb3c36e,JSON[_0x8059('0x10')](_0x1e8596));_0x1f8983(_0x1e8596);})['catch'](function(_0x26b623){logger['error']('ShowChatQueue',_0x26b623[_0x8059('0x14')],_0xb3c36e);_0x15f843(_0x40b39e[_0x8059('0x11')](0x1f4,_0x26b623[_0x8059('0x14')]));});});}; \ No newline at end of file +var _0xc038=['raw','ShowChatQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetChatQueue','ChatQueue','options','where','attributes','limit','include','model','map','stringify'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xc038,0x17e));var _0x8c03=function(_0x1061bc,_0x3f05e5){_0x1061bc=_0x1061bc-0x0;var _0x4e1f56=_0xc038[_0x1061bc];return _0x4e1f56;};'use strict';var _=require(_0x8c03('0x0'));var util=require(_0x8c03('0x1'));var moment=require('moment');var BPromise=require(_0x8c03('0x2'));var rs=require(_0x8c03('0x3'));var fs=require('fs');var Redis=require(_0x8c03('0x4'));var db=require(_0x8c03('0x5'))['db'];var utils=require(_0x8c03('0x6'));var logger=require('../../config/logger')(_0x8c03('0x7'));var config=require(_0x8c03('0x8'));var jayson=require(_0x8c03('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x8c03('0xa')]=_[_0x8c03('0xb')](config[_0x8c03('0xa')],{'host':_0x8c03('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8c03('0xa')]));require(_0x8c03('0xd'))[_0x8c03('0xe')](socket);function respondWithRpcPromise(_0x46c575,_0x1acd8b,_0x111c02){return new BPromise(function(_0x47f31f,_0x1693f7){return client[_0x8c03('0xf')](_0x46c575,_0x111c02)[_0x8c03('0x10')](function(_0x53931b){logger[_0x8c03('0x11')](_0x8c03('0x12'),_0x1acd8b,_0x8c03('0x13'));logger[_0x8c03('0x14')](_0x8c03('0x15'),_0x1acd8b,_0x8c03('0x13'),JSON['stringify'](_0x53931b));if(_0x53931b[_0x8c03('0x16')]){if(_0x53931b[_0x8c03('0x16')]['code']===0x1f4){logger[_0x8c03('0x16')]('ChatQueue,\x20%s,\x20%s',_0x1acd8b,_0x53931b[_0x8c03('0x16')][_0x8c03('0x17')]);return _0x1693f7(_0x53931b[_0x8c03('0x16')]['message']);}logger[_0x8c03('0x16')](_0x8c03('0x12'),_0x1acd8b,_0x53931b[_0x8c03('0x16')][_0x8c03('0x17')]);return _0x47f31f(_0x53931b[_0x8c03('0x16')][_0x8c03('0x17')]);}else{logger[_0x8c03('0x11')](_0x8c03('0x12'),_0x1acd8b,'request\x20sent');_0x47f31f(_0x53931b[_0x8c03('0x18')][_0x8c03('0x17')]);}})[_0x8c03('0x19')](function(_0x29e587){logger[_0x8c03('0x16')](_0x8c03('0x12'),_0x1acd8b,_0x29e587);_0x1693f7(_0x29e587);});});}exports[_0x8c03('0x1a')]=function(_0x2ea4cb){var _0x31a68a=this;return new Promise(function(_0x4a0ecc,_0x3e4766){return db[_0x8c03('0x1b')]['findAll']({'raw':_0x2ea4cb[_0x8c03('0x1c')]?_0x2ea4cb['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ea4cb[_0x8c03('0x1c')]?_0x2ea4cb[_0x8c03('0x1c')][_0x8c03('0x1d')]||null:null,'attributes':_0x2ea4cb[_0x8c03('0x1c')]?_0x2ea4cb[_0x8c03('0x1c')][_0x8c03('0x1e')]||null:null,'limit':_0x2ea4cb[_0x8c03('0x1c')]?_0x2ea4cb[_0x8c03('0x1c')][_0x8c03('0x1f')]||null:null,'include':_0x2ea4cb['options']?_0x2ea4cb[_0x8c03('0x1c')]['include']?_['map'](_0x2ea4cb[_0x8c03('0x1c')][_0x8c03('0x20')],function(_0x21bfdd){return{'model':db[_0x21bfdd[_0x8c03('0x21')]],'as':_0x21bfdd['as'],'attributes':_0x21bfdd[_0x8c03('0x1e')],'include':_0x21bfdd[_0x8c03('0x20')]?_[_0x8c03('0x22')](_0x21bfdd['include'],function(_0x1eceeb){return{'model':db[_0x1eceeb[_0x8c03('0x21')]],'as':_0x1eceeb['as'],'attributes':_0x1eceeb[_0x8c03('0x1e')],'include':_0x1eceeb[_0x8c03('0x20')]?_[_0x8c03('0x22')](_0x1eceeb[_0x8c03('0x20')],function(_0x16283e){return{'model':db[_0x16283e[_0x8c03('0x21')]],'as':_0x16283e['as'],'attributes':_0x16283e[_0x8c03('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8c03('0x10')](function(_0x2038c8){logger[_0x8c03('0x11')]('GetChatQueue',_0x2ea4cb);logger[_0x8c03('0x14')](_0x8c03('0x1a'),_0x2ea4cb,JSON[_0x8c03('0x23')](_0x2038c8));_0x4a0ecc(_0x2038c8);})[_0x8c03('0x19')](function(_0x7bfaf2){logger[_0x8c03('0x16')](_0x8c03('0x1a'),_0x7bfaf2[_0x8c03('0x17')],_0x2ea4cb);_0x3e4766(_0x31a68a['error'](0x1f4,_0x7bfaf2[_0x8c03('0x17')]));});});};exports['ShowChatQueue']=function(_0xc4274f){var _0x58973f=this;return new Promise(function(_0x500e12,_0x1f4bb7){return db['ChatQueue']['find']({'raw':_0xc4274f[_0x8c03('0x1c')]?_0xc4274f[_0x8c03('0x1c')][_0x8c03('0x24')]===undefined?!![]:![]:!![],'where':_0xc4274f[_0x8c03('0x1c')]?_0xc4274f[_0x8c03('0x1c')]['where']||null:null,'attributes':_0xc4274f[_0x8c03('0x1c')]?_0xc4274f['options'][_0x8c03('0x1e')]||null:null,'include':_0xc4274f[_0x8c03('0x1c')]?_0xc4274f[_0x8c03('0x1c')]['include']?_[_0x8c03('0x22')](_0xc4274f[_0x8c03('0x1c')]['include'],function(_0x57046d){return{'model':db[_0x57046d[_0x8c03('0x21')]],'as':_0x57046d['as'],'attributes':_0x57046d['attributes'],'include':_0x57046d[_0x8c03('0x20')]?_[_0x8c03('0x22')](_0x57046d[_0x8c03('0x20')],function(_0x1fc385){return{'model':db[_0x1fc385['model']],'as':_0x1fc385['as'],'attributes':_0x1fc385[_0x8c03('0x1e')],'include':_0x1fc385['include']?_[_0x8c03('0x22')](_0x1fc385['include'],function(_0x872cc8){return{'model':db[_0x872cc8['model']],'as':_0x872cc8['as'],'attributes':_0x872cc8[_0x8c03('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8c03('0x10')](function(_0x24fef8){logger['info'](_0x8c03('0x25'),_0xc4274f);logger[_0x8c03('0x14')](_0x8c03('0x25'),_0xc4274f,JSON[_0x8c03('0x23')](_0x24fef8));_0x500e12(_0x24fef8);})[_0x8c03('0x19')](function(_0x299a52){logger[_0x8c03('0x16')](_0x8c03('0x25'),_0x299a52[_0x8c03('0x17')],_0xc4274f);_0x1f4bb7(_0x58973f[_0x8c03('0x16')](0x1f4,_0x299a52['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 66001da..eac09a9 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 _0x8ce3=['emit','removeListener','length','./chatQueue.events','save','update'];(function(_0x1e3ee9,_0x2b0ffb){var _0x185bb8=function(_0x4c562b){while(--_0x4c562b){_0x1e3ee9['push'](_0x1e3ee9['shift']());}};_0x185bb8(++_0x2b0ffb);}(_0x8ce3,0xc3));var _0x38ce=function(_0x3a2e8c,_0x4001d3){_0x3a2e8c=_0x3a2e8c-0x0;var _0x588177=_0x8ce3[_0x3a2e8c];return _0x588177;};'use strict';var ChatQueueEvents=require(_0x38ce('0x0'));var events=[_0x38ce('0x1'),'remove',_0x38ce('0x2')];function createListener(_0x2b99b0,_0xee1d0e){return function(_0x26ec48){_0xee1d0e[_0x38ce('0x3')](_0x2b99b0,_0x26ec48);};}function removeListener(_0x17b96d,_0x1efae3){return function(){ChatQueueEvents[_0x38ce('0x4')](_0x17b96d,_0x1efae3);};}exports['register']=function(_0x372f86){for(var _0xb24f4c=0x0,_0x58074c=events[_0x38ce('0x5')];_0xb24f4c<_0x58074c;_0xb24f4c++){var _0xbe7332=events[_0xb24f4c];var _0x3f8011=createListener('chatQueue:'+_0xbe7332,_0x372f86);ChatQueueEvents['on'](_0xbe7332,_0x3f8011);}}; \ No newline at end of file +var _0x80d9=['./chatQueue.events','remove','update','emit','removeListener','chatQueue:'];(function(_0x5bad27,_0x5145ff){var _0x15ea0a=function(_0x2d52e8){while(--_0x2d52e8){_0x5bad27['push'](_0x5bad27['shift']());}};_0x15ea0a(++_0x5145ff);}(_0x80d9,0x15c));var _0x980d=function(_0x1056cd,_0x1c4505){_0x1056cd=_0x1056cd-0x0;var _0x517c51=_0x80d9[_0x1056cd];return _0x517c51;};'use strict';var ChatQueueEvents=require(_0x980d('0x0'));var events=['save',_0x980d('0x1'),_0x980d('0x2')];function createListener(_0xac96e5,_0x5d4b87){return function(_0x358d0a){_0x5d4b87[_0x980d('0x3')](_0xac96e5,_0x358d0a);};}function removeListener(_0x38d1b9,_0x279d93){return function(){ChatQueueEvents[_0x980d('0x4')](_0x38d1b9,_0x279d93);};}exports['register']=function(_0x4c3533){for(var _0x2fd4b9=0x0,_0x50854e=events['length'];_0x2fd4b9<_0x50854e;_0x2fd4b9++){var _0x7e96f7=events[_0x2fd4b9];var _0x758fc3=createListener(_0x980d('0x5')+_0x7e96f7,_0x4c3533);ChatQueueEvents['on'](_0x7e96f7,_0x758fc3);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 1e00c58..2bef8a4 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3e74,0x175));var _0x43e7=function(_0x1c9c7d,_0x440491){_0x1c9c7d=_0x1c9c7d-0x0;var _0x2d3270=_0x3e74[_0x1c9c7d];return _0x2d3270;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x9bb8fd,_0x1a4f7c){var _0x295bb0=function(_0x688b1f){while(--_0x688b1f){_0x9bb8fd['push'](_0x9bb8fd['shift']());}};_0x295bb0(++_0x1a4f7c);}(_0xe14b,0x93));var _0xbe14=function(_0x48da06,_0x179ca9){_0x48da06=_0x48da06-0x0;var _0x5e6aa7=_0xe14b[_0x48da06];return _0x5e6aa7;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 1a9b1ed..81b0594 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 _0xf0b0=['DATE','sequelize','exports','STRING'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xf0b0,0x1e9));var _0x0f0b=function(_0x5acf09,_0xfb6440){_0x5acf09=_0x5acf09-0x0;var _0x131d82=_0xf0b0[_0x5acf09];return _0x131d82;};'use strict';var moment=require('moment');var Sequelize=require(_0x0f0b('0x0'));module[_0x0f0b('0x1')]={'uniqueid':{'type':Sequelize[_0x0f0b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0f0b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x0f0b('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0f0b('0x2')]}}; \ No newline at end of file +var _0xe660=['STRING','DATE','sequelize','exports'];(function(_0x2ceedb,_0x3d4af3){var _0x1eef5c=function(_0xee38c1){while(--_0xee38c1){_0x2ceedb['push'](_0x2ceedb['shift']());}};_0x1eef5c(++_0x3d4af3);}(_0xe660,0xde));var _0x0e66=function(_0x21f9c2,_0x2b3d2a){_0x21f9c2=_0x21f9c2-0x0;var _0x3da17f=_0xe660[_0x21f9c2];return _0x3da17f;};'use strict';var moment=require('moment');var Sequelize=require(_0x0e66('0x0'));module[_0x0e66('0x1')]={'uniqueid':{'type':Sequelize[_0x0e66('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0e66('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0e66('0x3')]},'acceptAt':{'type':Sequelize[_0x0e66('0x3')]},'exitAt':{'type':Sequelize[_0x0e66('0x3')]},'reason':{'type':Sequelize[_0x0e66('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index ee116a1..e71105f 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 _0x04cc=['limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','ChatQueueReport','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x04cc,0x11a));var _0xc04c=function(_0x292688,_0x4ed5d4){_0x292688=_0x292688-0x0;var _0x12f117=_0x04cc[_0x292688];return _0x12f117;};'use strict';var emlformat=require(_0xc04c('0x0'));var rimraf=require(_0xc04c('0x1'));var zipdir=require(_0xc04c('0x2'));var jsonpatch=require(_0xc04c('0x3'));var rp=require('request-promise');var moment=require(_0xc04c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc04c('0x5'));var path=require(_0xc04c('0x6'));var sox=require(_0xc04c('0x7'));var csv=require(_0xc04c('0x8'));var ejs=require(_0xc04c('0x9'));var fs=require('fs');var fs_extra=require(_0xc04c('0xa'));var _=require(_0xc04c('0xb'));var squel=require('squel');var crypto=require(_0xc04c('0xc'));var jsforce=require(_0xc04c('0xd'));var deskjs=require(_0xc04c('0xe'));var toCsv=require(_0xc04c('0x8'));var querystring=require(_0xc04c('0xf'));var Papa=require(_0xc04c('0x10'));var Redis=require(_0xc04c('0x11'));var authService=require(_0xc04c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc04c('0x13'));var logger=require(_0xc04c('0x14'))(_0xc04c('0x15'));var utils=require(_0xc04c('0x16'));var config=require(_0xc04c('0x17'));var licenseUtil=require(_0xc04c('0x18'));var db=require(_0xc04c('0x19'))['db'];function respondWithStatusCode(_0x563a5f,_0x510e18){_0x510e18=_0x510e18||0xcc;return function(_0x11a9e4){if(_0x11a9e4){return _0x563a5f['sendStatus'](_0x510e18);}return _0x563a5f[_0xc04c('0x1a')](_0x510e18)[_0xc04c('0x1b')]();};}function respondWithResult(_0x27a3f8,_0x23e500){_0x23e500=_0x23e500||0xc8;return function(_0x4f318d){if(_0x4f318d){return _0x27a3f8[_0xc04c('0x1a')](_0x23e500)[_0xc04c('0x1c')](_0x4f318d);}};}function respondWithFilteredResult(_0x1df6d9,_0x247582){return function(_0x4c1154){if(_0x4c1154){var _0x4e1aea=typeof _0x247582['offset']===_0xc04c('0x1d')&&typeof _0x247582[_0xc04c('0x1e')]==='undefined';var _0x82afdd=_0x4c1154['count'];var _0x170f47=_0x4e1aea?0x0:_0x247582[_0xc04c('0x1f')];var _0x59d405=_0x4e1aea?_0x4c1154[_0xc04c('0x20')]:_0x247582[_0xc04c('0x1f')]+_0x247582[_0xc04c('0x1e')];var _0x1ad3e6;if(_0x59d405>=_0x82afdd){_0x59d405=_0x82afdd;_0x1ad3e6=0xc8;}else{_0x1ad3e6=0xce;}_0x1df6d9[_0xc04c('0x1a')](_0x1ad3e6);return _0x1df6d9[_0xc04c('0x21')](_0xc04c('0x22'),_0x170f47+'-'+_0x59d405+'/'+_0x82afdd)[_0xc04c('0x1c')](_0x4c1154);}return null;};}function patchUpdates(_0x9b1151){return function(_0x4050ae){try{jsonpatch[_0xc04c('0x23')](_0x4050ae,_0x9b1151,!![]);}catch(_0x5d7c0e){return BPromise[_0xc04c('0x24')](_0x5d7c0e);}return _0x4050ae[_0xc04c('0x25')]();};}function saveUpdates(_0x1a3927,_0x1fa984){return function(_0x2422af){if(_0x2422af){return _0x2422af[_0xc04c('0x26')](_0x1a3927)[_0xc04c('0x27')](function(_0x244e80){return _0x244e80;});}return null;};}function removeEntity(_0x204d03,_0x17bc59){return function(_0x47dddc){if(_0x47dddc){return _0x47dddc[_0xc04c('0x28')]()['then'](function(){_0x204d03[_0xc04c('0x1a')](0xcc)[_0xc04c('0x1b')]();});}};}function handleEntityNotFound(_0x446722,_0x40f467){return function(_0x3b2337){if(!_0x3b2337){_0x446722['sendStatus'](0x194);}return _0x3b2337;};}function handleError(_0x175049,_0x158f28){_0x158f28=_0x158f28||0x1f4;return function(_0xae56c9){logger[_0xc04c('0x29')](_0xae56c9[_0xc04c('0x2a')]);if(_0xae56c9['name']){delete _0xae56c9[_0xc04c('0x2b')];}_0x175049[_0xc04c('0x1a')](_0x158f28)[_0xc04c('0x2c')](_0xae56c9);};}exports['index']=function(_0x1c3f29,_0x5f0706){var _0x4082da={},_0x14ba62={},_0x1bc9ab={'count':0x0,'rows':[]};var _0x596b9b=_[_0xc04c('0x2d')](db['ChatQueueReport'][_0xc04c('0x2e')],function(_0xc356a2){return{'name':_0xc356a2[_0xc04c('0x2f')],'type':_0xc356a2[_0xc04c('0x30')][_0xc04c('0x31')]};});_0x14ba62['model']=_[_0xc04c('0x2d')](_0x596b9b,'name');_0x14ba62[_0xc04c('0x32')]=_['keys'](_0x1c3f29['query']);_0x14ba62['filters']=_[_0xc04c('0x33')](_0x14ba62[_0xc04c('0x34')],_0x14ba62['query']);_0x4082da['attributes']=_[_0xc04c('0x33')](_0x14ba62[_0xc04c('0x34')],qs[_0xc04c('0x35')](_0x1c3f29[_0xc04c('0x32')]['fields']));_0x4082da[_0xc04c('0x36')]=_0x4082da[_0xc04c('0x36')][_0xc04c('0x37')]?_0x4082da[_0xc04c('0x36')]:_0x14ba62[_0xc04c('0x34')];if(!_0x1c3f29[_0xc04c('0x32')][_0xc04c('0x38')](_0xc04c('0x39'))){_0x4082da[_0xc04c('0x1e')]=qs['limit'](_0x1c3f29[_0xc04c('0x32')][_0xc04c('0x1e')]);_0x4082da[_0xc04c('0x1f')]=qs[_0xc04c('0x1f')](_0x1c3f29[_0xc04c('0x32')][_0xc04c('0x1f')]);}_0x4082da['order']=qs[_0xc04c('0x3a')](_0x1c3f29['query']['sort']);_0x4082da['where']=qs[_0xc04c('0x3b')](_[_0xc04c('0x3c')](_0x1c3f29[_0xc04c('0x32')],_0x14ba62[_0xc04c('0x3b')]),_0x596b9b);if(_0x1c3f29[_0xc04c('0x32')][_0xc04c('0x3d')]){_0x4082da[_0xc04c('0x3e')]=_[_0xc04c('0x3f')](_0x4082da['where'],{'$or':_[_0xc04c('0x2d')](_0x596b9b,function(_0x2ecddd){if(_0x2ecddd['type']!==_0xc04c('0x40')){var _0x2ff7b4={};_0x2ff7b4[_0x2ecddd[_0xc04c('0x2b')]]={'$like':'%'+_0x1c3f29[_0xc04c('0x32')][_0xc04c('0x3d')]+'%'};return _0x2ff7b4;}})});}_0x4082da=_[_0xc04c('0x3f')]({},_0x4082da,_0x1c3f29[_0xc04c('0x41')]);var _0xb4968={'where':_0x4082da['where']};return db[_0xc04c('0x42')]['count'](_0xb4968)[_0xc04c('0x27')](function(_0x1cd5df){_0x1bc9ab[_0xc04c('0x20')]=_0x1cd5df;if(_0x1c3f29[_0xc04c('0x32')][_0xc04c('0x43')]){_0x4082da[_0xc04c('0x44')]=[{'all':!![]}];}return db[_0xc04c('0x42')]['findAll'](_0x4082da);})[_0xc04c('0x27')](function(_0xf6d3ce){_0x1bc9ab[_0xc04c('0x45')]=_0xf6d3ce;return _0x1bc9ab;})[_0xc04c('0x27')](respondWithFilteredResult(_0x5f0706,_0x4082da))[_0xc04c('0x46')](handleError(_0x5f0706,null));};exports[_0xc04c('0x47')]=function(_0x29dd7d,_0x287bbb){var _0x3320be={'raw':!![],'where':{'id':_0x29dd7d[_0xc04c('0x48')]['id']}},_0x4ba324={};_0x4ba324[_0xc04c('0x34')]=_['keys'](db[_0xc04c('0x42')][_0xc04c('0x2e')]);_0x4ba324[_0xc04c('0x32')]=_[_0xc04c('0x49')](_0x29dd7d[_0xc04c('0x32')]);_0x4ba324[_0xc04c('0x3b')]=_[_0xc04c('0x33')](_0x4ba324['model'],_0x4ba324[_0xc04c('0x32')]);_0x3320be[_0xc04c('0x36')]=_['intersection'](_0x4ba324[_0xc04c('0x34')],qs[_0xc04c('0x35')](_0x29dd7d[_0xc04c('0x32')][_0xc04c('0x35')]));_0x3320be['attributes']=_0x3320be['attributes']['length']?_0x3320be['attributes']:_0x4ba324['model'];if(_0x29dd7d[_0xc04c('0x32')][_0xc04c('0x43')]){_0x3320be['include']=[{'all':!![]}];}_0x3320be=_[_0xc04c('0x3f')]({},_0x3320be,_0x29dd7d[_0xc04c('0x41')]);return db[_0xc04c('0x42')][_0xc04c('0x4a')](_0x3320be)[_0xc04c('0x27')](handleEntityNotFound(_0x287bbb,null))['then'](respondWithResult(_0x287bbb,null))['catch'](handleError(_0x287bbb,null));};exports[_0xc04c('0x4b')]=function(_0x196bf4,_0x360f04){return db[_0xc04c('0x42')][_0xc04c('0x4b')](_0x196bf4['body'],{})[_0xc04c('0x27')](respondWithResult(_0x360f04,0xc9))[_0xc04c('0x46')](handleError(_0x360f04,null));};exports[_0xc04c('0x26')]=function(_0x3a93bf,_0x1e2590){if(_0x3a93bf['body']['id']){delete _0x3a93bf[_0xc04c('0x4c')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x3a93bf[_0xc04c('0x48')]['id']}})['then'](handleEntityNotFound(_0x1e2590,null))[_0xc04c('0x27')](saveUpdates(_0x3a93bf['body'],null))[_0xc04c('0x27')](respondWithResult(_0x1e2590,null))[_0xc04c('0x46')](handleError(_0x1e2590,null));};exports['destroy']=function(_0x37f794,_0x4d6af4){return db[_0xc04c('0x42')][_0xc04c('0x4a')]({'where':{'id':_0x37f794[_0xc04c('0x48')]['id']}})[_0xc04c('0x27')](handleEntityNotFound(_0x4d6af4,null))[_0xc04c('0x27')](removeEntity(_0x4d6af4,null))[_0xc04c('0x46')](handleError(_0x4d6af4,null));};exports[_0xc04c('0x4d')]=function(_0x56c80a,_0x45688a){return db[_0xc04c('0x42')][_0xc04c('0x4d')]()[_0xc04c('0x27')](respondWithResult(_0x45688a,null))[_0xc04c('0x46')](handleError(_0x45688a,null));}; \ No newline at end of file +var _0xfa45=['end','json','undefined','limit','count','offset','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x879f57,_0x54d31a){var _0x390a5a=function(_0x360d84){while(--_0x360d84){_0x879f57['push'](_0x879f57['shift']());}};_0x390a5a(++_0x54d31a);}(_0xfa45,0x11b));var _0x5fa4=function(_0x181e34,_0x2bf7d8){_0x181e34=_0x181e34-0x0;var _0xb73d3e=_0xfa45[_0x181e34];return _0xb73d3e;};'use strict';var emlformat=require(_0x5fa4('0x0'));var rimraf=require(_0x5fa4('0x1'));var zipdir=require(_0x5fa4('0x2'));var jsonpatch=require(_0x5fa4('0x3'));var rp=require(_0x5fa4('0x4'));var moment=require(_0x5fa4('0x5'));var BPromise=require(_0x5fa4('0x6'));var Mustache=require('mustache');var util=require(_0x5fa4('0x7'));var path=require('path');var sox=require(_0x5fa4('0x8'));var csv=require(_0x5fa4('0x9'));var ejs=require(_0x5fa4('0xa'));var fs=require('fs');var fs_extra=require(_0x5fa4('0xb'));var _=require(_0x5fa4('0xc'));var squel=require(_0x5fa4('0xd'));var crypto=require(_0x5fa4('0xe'));var jsforce=require(_0x5fa4('0xf'));var deskjs=require(_0x5fa4('0x10'));var toCsv=require(_0x5fa4('0x9'));var querystring=require('querystring');var Papa=require(_0x5fa4('0x11'));var Redis=require('ioredis');var authService=require(_0x5fa4('0x12'));var qs=require(_0x5fa4('0x13'));var as=require(_0x5fa4('0x14'));var hardwareService=require(_0x5fa4('0x15'));var logger=require(_0x5fa4('0x16'))(_0x5fa4('0x17'));var utils=require(_0x5fa4('0x18'));var config=require(_0x5fa4('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5fa4('0x1a'))['db'];function respondWithStatusCode(_0x4a6ce3,_0x25abcd){_0x25abcd=_0x25abcd||0xcc;return function(_0x2eeea3){if(_0x2eeea3){return _0x4a6ce3[_0x5fa4('0x1b')](_0x25abcd);}return _0x4a6ce3[_0x5fa4('0x1c')](_0x25abcd)[_0x5fa4('0x1d')]();};}function respondWithResult(_0x51af4c,_0x397328){_0x397328=_0x397328||0xc8;return function(_0x3921b0){if(_0x3921b0){return _0x51af4c['status'](_0x397328)[_0x5fa4('0x1e')](_0x3921b0);}};}function respondWithFilteredResult(_0x40ce98,_0x4d8471){return function(_0x442064){if(_0x442064){var _0x5cacd7=typeof _0x4d8471['offset']===_0x5fa4('0x1f')&&typeof _0x4d8471[_0x5fa4('0x20')]===_0x5fa4('0x1f');var _0x21d502=_0x442064[_0x5fa4('0x21')];var _0x100a46=_0x5cacd7?0x0:_0x4d8471['offset'];var _0x3d6380=_0x5cacd7?_0x442064[_0x5fa4('0x21')]:_0x4d8471[_0x5fa4('0x22')]+_0x4d8471[_0x5fa4('0x20')];var _0x7273f9;if(_0x3d6380>=_0x21d502){_0x3d6380=_0x21d502;_0x7273f9=0xc8;}else{_0x7273f9=0xce;}_0x40ce98[_0x5fa4('0x1c')](_0x7273f9);return _0x40ce98[_0x5fa4('0x23')](_0x5fa4('0x24'),_0x100a46+'-'+_0x3d6380+'/'+_0x21d502)[_0x5fa4('0x1e')](_0x442064);}return null;};}function patchUpdates(_0x1b50c6){return function(_0x7998dc){try{jsonpatch[_0x5fa4('0x25')](_0x7998dc,_0x1b50c6,!![]);}catch(_0x541f44){return BPromise['reject'](_0x541f44);}return _0x7998dc[_0x5fa4('0x26')]();};}function saveUpdates(_0x3b23d6,_0x18eb29){return function(_0x1cd221){if(_0x1cd221){return _0x1cd221['update'](_0x3b23d6)['then'](function(_0x45f9d9){return _0x45f9d9;});}return null;};}function removeEntity(_0x54134f,_0xe63c6b){return function(_0x1a242a){if(_0x1a242a){return _0x1a242a[_0x5fa4('0x27')]()[_0x5fa4('0x28')](function(){_0x54134f['status'](0xcc)[_0x5fa4('0x1d')]();});}};}function handleEntityNotFound(_0x3d2abb,_0x452b9f){return function(_0x198d4b){if(!_0x198d4b){_0x3d2abb['sendStatus'](0x194);}return _0x198d4b;};}function handleError(_0x57996b,_0x169d61){_0x169d61=_0x169d61||0x1f4;return function(_0x46a1d9){logger[_0x5fa4('0x29')](_0x46a1d9[_0x5fa4('0x2a')]);if(_0x46a1d9['name']){delete _0x46a1d9[_0x5fa4('0x2b')];}_0x57996b[_0x5fa4('0x1c')](_0x169d61)[_0x5fa4('0x2c')](_0x46a1d9);};}exports[_0x5fa4('0x2d')]=function(_0x51833c,_0x49209e){var _0x27dcff={},_0x379fff={},_0x256fc8={'count':0x0,'rows':[]};var _0x34d33a=_['map'](db[_0x5fa4('0x2e')][_0x5fa4('0x2f')],function(_0x14ea77){return{'name':_0x14ea77[_0x5fa4('0x30')],'type':_0x14ea77[_0x5fa4('0x31')][_0x5fa4('0x32')]};});_0x379fff[_0x5fa4('0x33')]=_[_0x5fa4('0x34')](_0x34d33a,_0x5fa4('0x2b'));_0x379fff['query']=_[_0x5fa4('0x35')](_0x51833c[_0x5fa4('0x36')]);_0x379fff[_0x5fa4('0x37')]=_['intersection'](_0x379fff[_0x5fa4('0x33')],_0x379fff[_0x5fa4('0x36')]);_0x27dcff[_0x5fa4('0x38')]=_[_0x5fa4('0x39')](_0x379fff[_0x5fa4('0x33')],qs[_0x5fa4('0x3a')](_0x51833c['query'][_0x5fa4('0x3a')]));_0x27dcff[_0x5fa4('0x38')]=_0x27dcff[_0x5fa4('0x38')][_0x5fa4('0x3b')]?_0x27dcff[_0x5fa4('0x38')]:_0x379fff['model'];if(!_0x51833c[_0x5fa4('0x36')][_0x5fa4('0x3c')]('nolimit')){_0x27dcff[_0x5fa4('0x20')]=qs['limit'](_0x51833c[_0x5fa4('0x36')]['limit']);_0x27dcff[_0x5fa4('0x22')]=qs[_0x5fa4('0x22')](_0x51833c['query']['offset']);}_0x27dcff['order']=qs[_0x5fa4('0x3d')](_0x51833c[_0x5fa4('0x36')][_0x5fa4('0x3d')]);_0x27dcff[_0x5fa4('0x3e')]=qs['filters'](_['pick'](_0x51833c[_0x5fa4('0x36')],_0x379fff[_0x5fa4('0x37')]),_0x34d33a);if(_0x51833c[_0x5fa4('0x36')]['filter']){_0x27dcff[_0x5fa4('0x3e')]=_[_0x5fa4('0x3f')](_0x27dcff[_0x5fa4('0x3e')],{'$or':_['map'](_0x34d33a,function(_0x90a874){if(_0x90a874[_0x5fa4('0x31')]!=='VIRTUAL'){var _0x3d8692={};_0x3d8692[_0x90a874['name']]={'$like':'%'+_0x51833c[_0x5fa4('0x36')][_0x5fa4('0x40')]+'%'};return _0x3d8692;}})});}_0x27dcff=_[_0x5fa4('0x3f')]({},_0x27dcff,_0x51833c[_0x5fa4('0x41')]);var _0x47e864={'where':_0x27dcff[_0x5fa4('0x3e')]};return db[_0x5fa4('0x2e')][_0x5fa4('0x21')](_0x47e864)[_0x5fa4('0x28')](function(_0x527e20){_0x256fc8[_0x5fa4('0x21')]=_0x527e20;if(_0x51833c[_0x5fa4('0x36')][_0x5fa4('0x42')]){_0x27dcff[_0x5fa4('0x43')]=[{'all':!![]}];}return db[_0x5fa4('0x2e')][_0x5fa4('0x44')](_0x27dcff);})[_0x5fa4('0x28')](function(_0x41683c){_0x256fc8[_0x5fa4('0x45')]=_0x41683c;return _0x256fc8;})['then'](respondWithFilteredResult(_0x49209e,_0x27dcff))[_0x5fa4('0x46')](handleError(_0x49209e,null));};exports[_0x5fa4('0x47')]=function(_0x36248e,_0xd80796){var _0x3b94be={'raw':!![],'where':{'id':_0x36248e[_0x5fa4('0x48')]['id']}},_0x282257={};_0x282257[_0x5fa4('0x33')]=_[_0x5fa4('0x35')](db[_0x5fa4('0x2e')][_0x5fa4('0x2f')]);_0x282257[_0x5fa4('0x36')]=_['keys'](_0x36248e[_0x5fa4('0x36')]);_0x282257[_0x5fa4('0x37')]=_[_0x5fa4('0x39')](_0x282257[_0x5fa4('0x33')],_0x282257[_0x5fa4('0x36')]);_0x3b94be['attributes']=_[_0x5fa4('0x39')](_0x282257[_0x5fa4('0x33')],qs[_0x5fa4('0x3a')](_0x36248e[_0x5fa4('0x36')][_0x5fa4('0x3a')]));_0x3b94be[_0x5fa4('0x38')]=_0x3b94be[_0x5fa4('0x38')][_0x5fa4('0x3b')]?_0x3b94be[_0x5fa4('0x38')]:_0x282257[_0x5fa4('0x33')];if(_0x36248e['query'][_0x5fa4('0x42')]){_0x3b94be[_0x5fa4('0x43')]=[{'all':!![]}];}_0x3b94be=_[_0x5fa4('0x3f')]({},_0x3b94be,_0x36248e[_0x5fa4('0x41')]);return db[_0x5fa4('0x2e')][_0x5fa4('0x49')](_0x3b94be)[_0x5fa4('0x28')](handleEntityNotFound(_0xd80796,null))['then'](respondWithResult(_0xd80796,null))['catch'](handleError(_0xd80796,null));};exports[_0x5fa4('0x4a')]=function(_0x561927,_0x46ff29){return db[_0x5fa4('0x2e')][_0x5fa4('0x4a')](_0x561927[_0x5fa4('0x4b')],{})[_0x5fa4('0x28')](respondWithResult(_0x46ff29,0xc9))[_0x5fa4('0x46')](handleError(_0x46ff29,null));};exports[_0x5fa4('0x4c')]=function(_0x571cd2,_0x6e95a){if(_0x571cd2[_0x5fa4('0x4b')]['id']){delete _0x571cd2[_0x5fa4('0x4b')]['id'];}return db['ChatQueueReport'][_0x5fa4('0x49')]({'where':{'id':_0x571cd2['params']['id']}})[_0x5fa4('0x28')](handleEntityNotFound(_0x6e95a,null))[_0x5fa4('0x28')](saveUpdates(_0x571cd2[_0x5fa4('0x4b')],null))[_0x5fa4('0x28')](respondWithResult(_0x6e95a,null))[_0x5fa4('0x46')](handleError(_0x6e95a,null));};exports[_0x5fa4('0x27')]=function(_0xcba431,_0x5374a7){return db[_0x5fa4('0x2e')][_0x5fa4('0x49')]({'where':{'id':_0xcba431[_0x5fa4('0x48')]['id']}})[_0x5fa4('0x28')](handleEntityNotFound(_0x5374a7,null))[_0x5fa4('0x28')](removeEntity(_0x5374a7,null))[_0x5fa4('0x46')](handleError(_0x5374a7,null));};exports[_0x5fa4('0x4d')]=function(_0x3588ef,_0x1f2785){return db[_0x5fa4('0x2e')]['describe']()[_0x5fa4('0x28')](respondWithResult(_0x1f2785,null))[_0x5fa4('0x46')](handleError(_0x1f2785,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index d14f58f..ec80014 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(_0x325be4,_0x591f53){var _0xb276d7=function(_0x237101){while(--_0x237101){_0x325be4['push'](_0x325be4['shift']());}};_0xb276d7(++_0x591f53);}(_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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x1fa706,_0x2ac76f){var _0x544909=function(_0x5d496c){while(--_0x5d496c){_0x1fa706['push'](_0x1fa706['shift']());}};_0x544909(++_0x2ac76f);}(_0x757a,0xde));var _0xa757=function(_0x4e5872,_0x2df9b5){_0x4e5872=_0x4e5872-0x0;var _0x43e9c5=_0x757a[_0x4e5872];return _0x43e9c5;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 36e9e90..8af8f0d 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 _0xbd48=['info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','CreateChatQueueReport','ChatQueueReport','body','options','raw','stringify','catch','update','where','attributes','UpdateChatQueueReport','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd48,0xd4));var _0x8bd4=function(_0x5c1ef7,_0x3e1790){_0x5c1ef7=_0x5c1ef7-0x0;var _0x4b9ffc=_0xbd48[_0x5c1ef7];return _0x4b9ffc;};'use strict';var _=require(_0x8bd4('0x0'));var util=require('util');var moment=require(_0x8bd4('0x1'));var BPromise=require(_0x8bd4('0x2'));var rs=require(_0x8bd4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bd4('0x4'))['db'];var utils=require(_0x8bd4('0x5'));var logger=require(_0x8bd4('0x6'))(_0x8bd4('0x7'));var config=require(_0x8bd4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8bd4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31a749,_0xcfc99c,_0x40fa01){return new BPromise(function(_0xd23b7e,_0x1bb290){return client[_0x8bd4('0xa')](_0x31a749,_0x40fa01)[_0x8bd4('0xb')](function(_0x1aa31f){logger[_0x8bd4('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0xcfc99c,_0x8bd4('0xd'));logger[_0x8bd4('0xe')](_0x8bd4('0xf'),_0xcfc99c,_0x8bd4('0xd'),JSON['stringify'](_0x1aa31f));if(_0x1aa31f[_0x8bd4('0x10')]){if(_0x1aa31f[_0x8bd4('0x10')][_0x8bd4('0x11')]===0x1f4){logger[_0x8bd4('0x10')](_0x8bd4('0x12'),_0xcfc99c,_0x1aa31f[_0x8bd4('0x10')]['message']);return _0x1bb290(_0x1aa31f[_0x8bd4('0x10')][_0x8bd4('0x13')]);}logger[_0x8bd4('0x10')](_0x8bd4('0x12'),_0xcfc99c,_0x1aa31f[_0x8bd4('0x10')][_0x8bd4('0x13')]);return _0xd23b7e(_0x1aa31f[_0x8bd4('0x10')]['message']);}else{logger[_0x8bd4('0xc')](_0x8bd4('0x12'),_0xcfc99c,_0x8bd4('0xd'));_0xd23b7e(_0x1aa31f[_0x8bd4('0x14')][_0x8bd4('0x13')]);}})['catch'](function(_0x5e2b22){logger['error'](_0x8bd4('0x12'),_0xcfc99c,_0x5e2b22);_0x1bb290(_0x5e2b22);});});}exports[_0x8bd4('0x15')]=function(_0x59333d){var _0x4aa049=this;return new Promise(function(_0x2d8f95,_0x396c2f){return db[_0x8bd4('0x16')]['create'](_0x59333d[_0x8bd4('0x17')],{'raw':_0x59333d[_0x8bd4('0x18')]?_0x59333d['options'][_0x8bd4('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3b81bf){logger[_0x8bd4('0xc')](_0x8bd4('0x15'),_0x59333d);logger['debug'](_0x8bd4('0x15'),_0x59333d,JSON[_0x8bd4('0x1a')](_0x3b81bf));_0x2d8f95(_0x3b81bf);})[_0x8bd4('0x1b')](function(_0x239e16){logger['error']('CreateChatQueueReport',_0x239e16[_0x8bd4('0x13')],_0x59333d);_0x396c2f(_0x4aa049[_0x8bd4('0x10')](0x1f4,_0x239e16[_0x8bd4('0x13')]));});});};exports['UpdateChatQueueReport']=function(_0x2b2fa3){var _0x5e99b6=this;return new Promise(function(_0x5d9bdc,_0x463acc){return db[_0x8bd4('0x16')][_0x8bd4('0x1c')](_0x2b2fa3[_0x8bd4('0x17')],{'raw':_0x2b2fa3['options']?_0x2b2fa3['options'][_0x8bd4('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b2fa3['options']?_0x2b2fa3[_0x8bd4('0x18')][_0x8bd4('0x1d')]||null:null,'attributes':_0x2b2fa3[_0x8bd4('0x18')]?_0x2b2fa3[_0x8bd4('0x18')][_0x8bd4('0x1e')]||null:null,'limit':_0x2b2fa3['options']?_0x2b2fa3[_0x8bd4('0x18')]['limit']||null:null})[_0x8bd4('0xb')](function(_0x56a5db){logger[_0x8bd4('0xc')](_0x8bd4('0x1f'),_0x2b2fa3);logger[_0x8bd4('0xe')](_0x8bd4('0x1f'),_0x2b2fa3,JSON[_0x8bd4('0x1a')](_0x56a5db));_0x5d9bdc(_0x56a5db);})['catch'](function(_0x24406b){logger[_0x8bd4('0x10')](_0x8bd4('0x1f'),_0x24406b[_0x8bd4('0x13')],_0x2b2fa3);_0x463acc(_0x5e99b6[_0x8bd4('0x10')](0x1f4,_0x24406b['message']));});});}; \ No newline at end of file +var _0xb235=['then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','CreateChatQueueReport','create','body','options','debug','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x538b34,_0x4b26af){var _0x265f6f=function(_0x140a61){while(--_0x140a61){_0x538b34['push'](_0x538b34['shift']());}};_0x265f6f(++_0x4b26af);}(_0xb235,0x1c1));var _0x5b23=function(_0x271a95,_0x4d2a07){_0x271a95=_0x271a95-0x0;var _0x3fa489=_0xb235[_0x271a95];return _0x3fa489;};'use strict';var _=require(_0x5b23('0x0'));var util=require(_0x5b23('0x1'));var moment=require('moment');var BPromise=require(_0x5b23('0x2'));var rs=require(_0x5b23('0x3'));var fs=require('fs');var Redis=require(_0x5b23('0x4'));var db=require(_0x5b23('0x5'))['db'];var utils=require(_0x5b23('0x6'));var logger=require(_0x5b23('0x7'))(_0x5b23('0x8'));var config=require('../../config/environment');var jayson=require(_0x5b23('0x9'));var client=jayson[_0x5b23('0xa')][_0x5b23('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5830c3,_0x4b8b1c,_0x3c0121){return new BPromise(function(_0x4727c5,_0x1a637c){return client[_0x5b23('0xc')](_0x5830c3,_0x3c0121)[_0x5b23('0xd')](function(_0x3b224f){logger['info'](_0x5b23('0xe'),_0x4b8b1c,_0x5b23('0xf'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x4b8b1c,_0x5b23('0xf'),JSON[_0x5b23('0x10')](_0x3b224f));if(_0x3b224f[_0x5b23('0x11')]){if(_0x3b224f[_0x5b23('0x11')][_0x5b23('0x12')]===0x1f4){logger[_0x5b23('0x11')](_0x5b23('0xe'),_0x4b8b1c,_0x3b224f[_0x5b23('0x11')][_0x5b23('0x13')]);return _0x1a637c(_0x3b224f[_0x5b23('0x11')][_0x5b23('0x13')]);}logger[_0x5b23('0x11')](_0x5b23('0xe'),_0x4b8b1c,_0x3b224f[_0x5b23('0x11')][_0x5b23('0x13')]);return _0x4727c5(_0x3b224f[_0x5b23('0x11')][_0x5b23('0x13')]);}else{logger[_0x5b23('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x4b8b1c,_0x5b23('0xf'));_0x4727c5(_0x3b224f[_0x5b23('0x15')]['message']);}})['catch'](function(_0x13035c){logger['error'](_0x5b23('0xe'),_0x4b8b1c,_0x13035c);_0x1a637c(_0x13035c);});});}exports[_0x5b23('0x16')]=function(_0xf20d15){var _0x226b71=this;return new Promise(function(_0x54ef76,_0x4ec5a8){return db['ChatQueueReport'][_0x5b23('0x17')](_0xf20d15[_0x5b23('0x18')],{'raw':_0xf20d15[_0x5b23('0x19')]?_0xf20d15[_0x5b23('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x5b23('0xd')](function(_0x57d010){logger[_0x5b23('0x14')](_0x5b23('0x16'),_0xf20d15);logger[_0x5b23('0x1a')](_0x5b23('0x16'),_0xf20d15,JSON['stringify'](_0x57d010));_0x54ef76(_0x57d010);})['catch'](function(_0x386279){logger[_0x5b23('0x11')](_0x5b23('0x16'),_0x386279[_0x5b23('0x13')],_0xf20d15);_0x4ec5a8(_0x226b71[_0x5b23('0x11')](0x1f4,_0x386279[_0x5b23('0x13')]));});});};exports[_0x5b23('0x1b')]=function(_0x17b88d){var _0xdda99a=this;return new Promise(function(_0x418c83,_0x41c1f3){return db[_0x5b23('0x1c')][_0x5b23('0x1d')](_0x17b88d['body'],{'raw':_0x17b88d['options']?_0x17b88d[_0x5b23('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17b88d['options']?_0x17b88d[_0x5b23('0x19')][_0x5b23('0x1e')]||null:null,'attributes':_0x17b88d[_0x5b23('0x19')]?_0x17b88d[_0x5b23('0x19')][_0x5b23('0x1f')]||null:null,'limit':_0x17b88d[_0x5b23('0x19')]?_0x17b88d['options']['limit']||null:null})[_0x5b23('0xd')](function(_0x417fd0){logger[_0x5b23('0x14')](_0x5b23('0x1b'),_0x17b88d);logger[_0x5b23('0x1a')]('UpdateChatQueueReport',_0x17b88d,JSON[_0x5b23('0x10')](_0x417fd0));_0x418c83(_0x417fd0);})[_0x5b23('0x20')](function(_0x5f3968){logger['error'](_0x5b23('0x1b'),_0x5f3968[_0x5b23('0x13')],_0x17b88d);_0x41c1f3(_0xdda99a['error'](0x1f4,_0x5f3968['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index e1d7ca5..dbd01f0 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 _0xa67e=['show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe'];(function(_0x526003,_0x14a099){var _0x576822=function(_0xf6081){while(--_0xf6081){_0x526003['push'](_0x526003['shift']());}};_0x576822(++_0x14a099);}(_0xa67e,0x153));var _0xea67=function(_0x521dfc,_0x31db8a){_0x521dfc=_0x521dfc-0x0;var _0x1fad43=_0xa67e[_0x521dfc];return _0x1fad43;};'use strict';var multer=require(_0xea67('0x0'));var util=require('util');var path=require(_0xea67('0x1'));var timeout=require(_0xea67('0x2'));var express=require(_0xea67('0x3'));var router=express[_0xea67('0x4')]();var fs_extra=require(_0xea67('0x5'));var auth=require(_0xea67('0x6'));var interaction=require(_0xea67('0x7'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0xea67('0x8')]('/',auth['isAuthenticated'](),controller[_0xea67('0x9')]);router[_0xea67('0x8')](_0xea67('0xa'),auth[_0xea67('0xb')](),controller[_0xea67('0xc')]);router['get']('/:id',auth[_0xea67('0xb')](),controller[_0xea67('0xd')]);router[_0xea67('0xe')]('/',auth[_0xea67('0xb')](),controller[_0xea67('0xf')]);router[_0xea67('0x10')](_0xea67('0x11'),auth[_0xea67('0xb')](),controller[_0xea67('0x12')]);router[_0xea67('0x13')](_0xea67('0x11'),auth[_0xea67('0xb')](),controller[_0xea67('0x14')]);module[_0xea67('0x15')]=router; \ No newline at end of file +var _0x537c=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x2b04b7,_0x24c783){var _0x557df5=function(_0x3b2a6c){while(--_0x3b2a6c){_0x2b04b7['push'](_0x2b04b7['shift']());}};_0x557df5(++_0x24c783);}(_0x537c,0x164));var _0xc537=function(_0x273c37,_0xef989){_0x273c37=_0x273c37-0x0;var _0x2ff772=_0x537c[_0x273c37];return _0x2ff772;};'use strict';var multer=require(_0xc537('0x0'));var util=require(_0xc537('0x1'));var path=require(_0xc537('0x2'));var timeout=require(_0xc537('0x3'));var express=require(_0xc537('0x4'));var router=express[_0xc537('0x5')]();var fs_extra=require(_0xc537('0x6'));var auth=require(_0xc537('0x7'));var interaction=require(_0xc537('0x8'));var config=require('../../config/environment');var controller=require(_0xc537('0x9'));router[_0xc537('0xa')]('/',auth[_0xc537('0xb')](),controller[_0xc537('0xc')]);router[_0xc537('0xa')](_0xc537('0xd'),auth['isAuthenticated'](),controller[_0xc537('0xe')]);router['get'](_0xc537('0xf'),auth[_0xc537('0xb')](),controller[_0xc537('0x10')]);router[_0xc537('0x11')]('/',auth[_0xc537('0xb')](),controller['create']);router[_0xc537('0x12')]('/:id',auth[_0xc537('0xb')](),controller[_0xc537('0x13')]);router['delete'](_0xc537('0xf'),auth[_0xc537('0xb')](),controller[_0xc537('0x14')]);module[_0xc537('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 4d01bb0..908f620 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x4ec70e,_0x1b8e5a){var _0x4596e5=function(_0x3605fb){while(--_0x3605fb){_0x4ec70e['push'](_0x4ec70e['shift']());}};_0x4596e5(++_0x1b8e5a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xcb91[_0x562f3b];return _0x1edd55;};'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 +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x35cf05,_0x801e3a){var _0x57ca7c=function(_0x33345b){while(--_0x33345b){_0x35cf05['push'](_0x35cf05['shift']());}};_0x57ca7c(++_0x801e3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 6b29301..b8f1ae8 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 _0x4ff9=['path','to-csv','fs-extra','lodash','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','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xbbe775,_0x5282be){var _0x2acf50=function(_0x245b65){while(--_0x245b65){_0xbbe775['push'](_0xbbe775['shift']());}};_0x2acf50(++_0x5282be);}(_0x4ff9,0x1d7));var _0x94ff=function(_0xdd57da,_0x4d5d64){_0xdd57da=_0xdd57da-0x0;var _0x11fd74=_0x4ff9[_0xdd57da];return _0x11fd74;};'use strict';var emlformat=require(_0x94ff('0x0'));var rimraf=require(_0x94ff('0x1'));var zipdir=require(_0x94ff('0x2'));var jsonpatch=require(_0x94ff('0x3'));var rp=require(_0x94ff('0x4'));var moment=require(_0x94ff('0x5'));var BPromise=require(_0x94ff('0x6'));var Mustache=require(_0x94ff('0x7'));var util=require(_0x94ff('0x8'));var path=require(_0x94ff('0x9'));var sox=require('sox');var csv=require(_0x94ff('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x94ff('0xb'));var _=require(_0x94ff('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x94ff('0xd'));var deskjs=require(_0x94ff('0xe'));var toCsv=require('to-csv');var querystring=require(_0x94ff('0xf'));var Papa=require(_0x94ff('0x10'));var Redis=require(_0x94ff('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x94ff('0x12'));var as=require(_0x94ff('0x13'));var hardwareService=require(_0x94ff('0x14'));var logger=require(_0x94ff('0x15'))(_0x94ff('0x16'));var utils=require(_0x94ff('0x17'));var config=require(_0x94ff('0x18'));var licenseUtil=require(_0x94ff('0x19'));var db=require(_0x94ff('0x1a'))['db'];function respondWithStatusCode(_0x700669,_0x53444c){_0x53444c=_0x53444c||0xcc;return function(_0x584cc1){if(_0x584cc1){return _0x700669['sendStatus'](_0x53444c);}return _0x700669[_0x94ff('0x1b')](_0x53444c)[_0x94ff('0x1c')]();};}function respondWithResult(_0x3abc3d,_0x3d65e2){_0x3d65e2=_0x3d65e2||0xc8;return function(_0x564bde){if(_0x564bde){return _0x3abc3d['status'](_0x3d65e2)[_0x94ff('0x1d')](_0x564bde);}};}function respondWithFilteredResult(_0x816a95,_0x3d9ae1){return function(_0x4f3b3d){if(_0x4f3b3d){var _0x2d28bc=typeof _0x3d9ae1[_0x94ff('0x1e')]===_0x94ff('0x1f')&&typeof _0x3d9ae1['limit']===_0x94ff('0x1f');var _0x21c6e9=_0x4f3b3d[_0x94ff('0x20')];var _0x436738=_0x2d28bc?0x0:_0x3d9ae1['offset'];var _0x58c54f=_0x2d28bc?_0x4f3b3d[_0x94ff('0x20')]:_0x3d9ae1[_0x94ff('0x1e')]+_0x3d9ae1[_0x94ff('0x21')];var _0x503668;if(_0x58c54f>=_0x21c6e9){_0x58c54f=_0x21c6e9;_0x503668=0xc8;}else{_0x503668=0xce;}_0x816a95[_0x94ff('0x1b')](_0x503668);return _0x816a95['set'](_0x94ff('0x22'),_0x436738+'-'+_0x58c54f+'/'+_0x21c6e9)[_0x94ff('0x1d')](_0x4f3b3d);}return null;};}function patchUpdates(_0x517661){return function(_0x59cb09){try{jsonpatch[_0x94ff('0x23')](_0x59cb09,_0x517661,!![]);}catch(_0x37fb9e){return BPromise[_0x94ff('0x24')](_0x37fb9e);}return _0x59cb09[_0x94ff('0x25')]();};}function saveUpdates(_0x34c06b,_0x57c1e5){return function(_0x1af4b0){if(_0x1af4b0){return _0x1af4b0[_0x94ff('0x26')](_0x34c06b)[_0x94ff('0x27')](function(_0x5ae671){return _0x5ae671;});}return null;};}function removeEntity(_0x18b73f,_0x11765f){return function(_0x351878){if(_0x351878){return _0x351878[_0x94ff('0x28')]()[_0x94ff('0x27')](function(){_0x18b73f['status'](0xcc)[_0x94ff('0x1c')]();});}};}function handleEntityNotFound(_0x543b1f,_0x39f506){return function(_0x2f638e){if(!_0x2f638e){_0x543b1f[_0x94ff('0x29')](0x194);}return _0x2f638e;};}function handleError(_0x4408d3,_0x3b73b2){_0x3b73b2=_0x3b73b2||0x1f4;return function(_0x5d94cd){logger[_0x94ff('0x2a')](_0x5d94cd[_0x94ff('0x2b')]);if(_0x5d94cd[_0x94ff('0x2c')]){delete _0x5d94cd[_0x94ff('0x2c')];}_0x4408d3[_0x94ff('0x1b')](_0x3b73b2)[_0x94ff('0x2d')](_0x5d94cd);};}exports[_0x94ff('0x2e')]=function(_0x24385e,_0xd3cc5e){var _0x593d0a={},_0x57100f={},_0x6413ac={'count':0x0,'rows':[]};var _0x27fb14=_[_0x94ff('0x2f')](db[_0x94ff('0x30')][_0x94ff('0x31')],function(_0x566856){return{'name':_0x566856['fieldName'],'type':_0x566856[_0x94ff('0x32')][_0x94ff('0x33')]};});_0x57100f[_0x94ff('0x34')]=_['map'](_0x27fb14,'name');_0x57100f['query']=_[_0x94ff('0x35')](_0x24385e[_0x94ff('0x36')]);_0x57100f['filters']=_[_0x94ff('0x37')](_0x57100f[_0x94ff('0x34')],_0x57100f['query']);_0x593d0a[_0x94ff('0x38')]=_[_0x94ff('0x37')](_0x57100f['model'],qs['fields'](_0x24385e[_0x94ff('0x36')][_0x94ff('0x39')]));_0x593d0a['attributes']=_0x593d0a[_0x94ff('0x38')][_0x94ff('0x3a')]?_0x593d0a[_0x94ff('0x38')]:_0x57100f[_0x94ff('0x34')];if(!_0x24385e['query'][_0x94ff('0x3b')]('nolimit')){_0x593d0a[_0x94ff('0x21')]=qs[_0x94ff('0x21')](_0x24385e[_0x94ff('0x36')][_0x94ff('0x21')]);_0x593d0a['offset']=qs['offset'](_0x24385e['query'][_0x94ff('0x1e')]);}_0x593d0a[_0x94ff('0x3c')]=qs[_0x94ff('0x3d')](_0x24385e[_0x94ff('0x36')][_0x94ff('0x3d')]);_0x593d0a['where']=qs['filters'](_[_0x94ff('0x3e')](_0x24385e[_0x94ff('0x36')],_0x57100f[_0x94ff('0x3f')]),_0x27fb14);if(_0x24385e[_0x94ff('0x36')][_0x94ff('0x40')]){_0x593d0a[_0x94ff('0x41')]=_[_0x94ff('0x42')](_0x593d0a[_0x94ff('0x41')],{'$or':_[_0x94ff('0x2f')](_0x27fb14,function(_0x56ee6f){if(_0x56ee6f['type']!==_0x94ff('0x43')){var _0x769775={};_0x769775[_0x56ee6f[_0x94ff('0x2c')]]={'$like':'%'+_0x24385e[_0x94ff('0x36')][_0x94ff('0x40')]+'%'};return _0x769775;}})});}_0x593d0a=_[_0x94ff('0x42')]({},_0x593d0a,_0x24385e[_0x94ff('0x44')]);var _0x38fd9d={'where':_0x593d0a[_0x94ff('0x41')]};return db[_0x94ff('0x30')]['count'](_0x38fd9d)[_0x94ff('0x27')](function(_0x37ab58){_0x6413ac[_0x94ff('0x20')]=_0x37ab58;if(_0x24385e[_0x94ff('0x36')]['includeAll']){_0x593d0a[_0x94ff('0x45')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x94ff('0x46')](_0x593d0a);})[_0x94ff('0x27')](function(_0xb67c9){_0x6413ac[_0x94ff('0x47')]=_0xb67c9;return _0x6413ac;})[_0x94ff('0x27')](respondWithFilteredResult(_0xd3cc5e,_0x593d0a))[_0x94ff('0x48')](handleError(_0xd3cc5e,null));};exports[_0x94ff('0x49')]=function(_0x54ea6c,_0x4a2a5b){var _0x2f20e8={'raw':!![],'where':{'id':_0x54ea6c[_0x94ff('0x4a')]['id']}},_0x38c87f={};_0x38c87f[_0x94ff('0x34')]=_[_0x94ff('0x35')](db[_0x94ff('0x30')]['rawAttributes']);_0x38c87f['query']=_[_0x94ff('0x35')](_0x54ea6c[_0x94ff('0x36')]);_0x38c87f[_0x94ff('0x3f')]=_['intersection'](_0x38c87f[_0x94ff('0x34')],_0x38c87f[_0x94ff('0x36')]);_0x2f20e8[_0x94ff('0x38')]=_[_0x94ff('0x37')](_0x38c87f['model'],qs[_0x94ff('0x39')](_0x54ea6c[_0x94ff('0x36')][_0x94ff('0x39')]));_0x2f20e8[_0x94ff('0x38')]=_0x2f20e8['attributes'][_0x94ff('0x3a')]?_0x2f20e8[_0x94ff('0x38')]:_0x38c87f[_0x94ff('0x34')];if(_0x54ea6c[_0x94ff('0x36')][_0x94ff('0x4b')]){_0x2f20e8['include']=[{'all':!![]}];}_0x2f20e8=_[_0x94ff('0x42')]({},_0x2f20e8,_0x54ea6c[_0x94ff('0x44')]);return db['ChatTransferReport'][_0x94ff('0x4c')](_0x2f20e8)[_0x94ff('0x27')](handleEntityNotFound(_0x4a2a5b,null))[_0x94ff('0x27')](respondWithResult(_0x4a2a5b,null))[_0x94ff('0x48')](handleError(_0x4a2a5b,null));};exports[_0x94ff('0x4d')]=function(_0x41d406,_0x27e343){return db['ChatTransferReport'][_0x94ff('0x4d')](_0x41d406[_0x94ff('0x4e')],{})[_0x94ff('0x27')](respondWithResult(_0x27e343,0xc9))['catch'](handleError(_0x27e343,null));};exports[_0x94ff('0x26')]=function(_0x8001a6,_0x438937){if(_0x8001a6[_0x94ff('0x4e')]['id']){delete _0x8001a6[_0x94ff('0x4e')]['id'];}return db[_0x94ff('0x30')]['find']({'where':{'id':_0x8001a6['params']['id']}})[_0x94ff('0x27')](handleEntityNotFound(_0x438937,null))[_0x94ff('0x27')](saveUpdates(_0x8001a6[_0x94ff('0x4e')],null))['then'](respondWithResult(_0x438937,null))[_0x94ff('0x48')](handleError(_0x438937,null));};exports[_0x94ff('0x28')]=function(_0x49d8bf,_0x21f798){return db[_0x94ff('0x30')][_0x94ff('0x4c')]({'where':{'id':_0x49d8bf[_0x94ff('0x4a')]['id']}})[_0x94ff('0x27')](handleEntityNotFound(_0x21f798,null))[_0x94ff('0x27')](removeEntity(_0x21f798,null))[_0x94ff('0x48')](handleError(_0x21f798,null));};exports[_0x94ff('0x4f')]=function(_0x220510,_0x31cada){return db[_0x94ff('0x30')][_0x94ff('0x4f')]()[_0x94ff('0x27')](respondWithResult(_0x31cada,null))['catch'](handleError(_0x31cada,null));}; \ No newline at end of file +var _0x8f39=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','sendStatus','error','name','send','index','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','merge','options','ChatTransferReport','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x48a2e6,_0x14a1e9){var _0x2bc896=function(_0x47252c){while(--_0x47252c){_0x48a2e6['push'](_0x48a2e6['shift']());}};_0x2bc896(++_0x14a1e9);}(_0x8f39,0xda));var _0x98f3=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x8f39[_0x176329];return _0x31997c;};'use strict';var emlformat=require(_0x98f3('0x0'));var rimraf=require(_0x98f3('0x1'));var zipdir=require(_0x98f3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98f3('0x3'));var moment=require(_0x98f3('0x4'));var BPromise=require(_0x98f3('0x5'));var Mustache=require(_0x98f3('0x6'));var util=require(_0x98f3('0x7'));var path=require('path');var sox=require(_0x98f3('0x8'));var csv=require(_0x98f3('0x9'));var ejs=require(_0x98f3('0xa'));var fs=require('fs');var fs_extra=require(_0x98f3('0xb'));var _=require(_0x98f3('0xc'));var squel=require(_0x98f3('0xd'));var crypto=require(_0x98f3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x98f3('0xf'));var toCsv=require(_0x98f3('0x9'));var querystring=require(_0x98f3('0x10'));var Papa=require(_0x98f3('0x11'));var Redis=require(_0x98f3('0x12'));var authService=require(_0x98f3('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x98f3('0x14'));var hardwareService=require(_0x98f3('0x15'));var logger=require(_0x98f3('0x16'))(_0x98f3('0x17'));var utils=require('../../config/utils');var config=require(_0x98f3('0x18'));var licenseUtil=require(_0x98f3('0x19'));var db=require(_0x98f3('0x1a'))['db'];function respondWithStatusCode(_0x31dcee,_0x1355c5){_0x1355c5=_0x1355c5||0xcc;return function(_0x20f598){if(_0x20f598){return _0x31dcee['sendStatus'](_0x1355c5);}return _0x31dcee[_0x98f3('0x1b')](_0x1355c5)[_0x98f3('0x1c')]();};}function respondWithResult(_0x28bfac,_0x156ffe){_0x156ffe=_0x156ffe||0xc8;return function(_0x460968){if(_0x460968){return _0x28bfac[_0x98f3('0x1b')](_0x156ffe)['json'](_0x460968);}};}function respondWithFilteredResult(_0x39ecc6,_0x869d3e){return function(_0x3f0018){if(_0x3f0018){var _0x30ec79=typeof _0x869d3e[_0x98f3('0x1d')]===_0x98f3('0x1e')&&typeof _0x869d3e[_0x98f3('0x1f')]==='undefined';var _0x30eb04=_0x3f0018[_0x98f3('0x20')];var _0x225a35=_0x30ec79?0x0:_0x869d3e['offset'];var _0x1c85ed=_0x30ec79?_0x3f0018[_0x98f3('0x20')]:_0x869d3e[_0x98f3('0x1d')]+_0x869d3e['limit'];var _0x246a18;if(_0x1c85ed>=_0x30eb04){_0x1c85ed=_0x30eb04;_0x246a18=0xc8;}else{_0x246a18=0xce;}_0x39ecc6[_0x98f3('0x1b')](_0x246a18);return _0x39ecc6['set'](_0x98f3('0x21'),_0x225a35+'-'+_0x1c85ed+'/'+_0x30eb04)['json'](_0x3f0018);}return null;};}function patchUpdates(_0xf35646){return function(_0xe7de55){try{jsonpatch[_0x98f3('0x22')](_0xe7de55,_0xf35646,!![]);}catch(_0x32704f){return BPromise[_0x98f3('0x23')](_0x32704f);}return _0xe7de55['save']();};}function saveUpdates(_0x3ef79e,_0x4fea9f){return function(_0x1c21c9){if(_0x1c21c9){return _0x1c21c9[_0x98f3('0x24')](_0x3ef79e)['then'](function(_0x214231){return _0x214231;});}return null;};}function removeEntity(_0x418397,_0x2e00d0){return function(_0x2e7d38){if(_0x2e7d38){return _0x2e7d38[_0x98f3('0x25')]()[_0x98f3('0x26')](function(){_0x418397[_0x98f3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c2b69,_0x3271d5){return function(_0x20806b){if(!_0x20806b){_0x1c2b69[_0x98f3('0x27')](0x194);}return _0x20806b;};}function handleError(_0x5c58e4,_0x2affdf){_0x2affdf=_0x2affdf||0x1f4;return function(_0x407e2b){logger[_0x98f3('0x28')](_0x407e2b['stack']);if(_0x407e2b[_0x98f3('0x29')]){delete _0x407e2b['name'];}_0x5c58e4['status'](_0x2affdf)[_0x98f3('0x2a')](_0x407e2b);};}exports[_0x98f3('0x2b')]=function(_0x15d1b8,_0x445bcf){var _0x28c0cb={},_0x25207b={},_0x4ef76b={'count':0x0,'rows':[]};var _0x536df3=_['map'](db['ChatTransferReport'][_0x98f3('0x2c')],function(_0x26c3d3){return{'name':_0x26c3d3[_0x98f3('0x2d')],'type':_0x26c3d3['type'][_0x98f3('0x2e')]};});_0x25207b[_0x98f3('0x2f')]=_[_0x98f3('0x30')](_0x536df3,_0x98f3('0x29'));_0x25207b['query']=_['keys'](_0x15d1b8[_0x98f3('0x31')]);_0x25207b['filters']=_[_0x98f3('0x32')](_0x25207b[_0x98f3('0x2f')],_0x25207b['query']);_0x28c0cb[_0x98f3('0x33')]=_[_0x98f3('0x32')](_0x25207b[_0x98f3('0x2f')],qs[_0x98f3('0x34')](_0x15d1b8[_0x98f3('0x31')][_0x98f3('0x34')]));_0x28c0cb[_0x98f3('0x33')]=_0x28c0cb[_0x98f3('0x33')][_0x98f3('0x35')]?_0x28c0cb[_0x98f3('0x33')]:_0x25207b[_0x98f3('0x2f')];if(!_0x15d1b8['query'][_0x98f3('0x36')](_0x98f3('0x37'))){_0x28c0cb[_0x98f3('0x1f')]=qs[_0x98f3('0x1f')](_0x15d1b8[_0x98f3('0x31')]['limit']);_0x28c0cb[_0x98f3('0x1d')]=qs[_0x98f3('0x1d')](_0x15d1b8[_0x98f3('0x31')][_0x98f3('0x1d')]);}_0x28c0cb[_0x98f3('0x38')]=qs[_0x98f3('0x39')](_0x15d1b8[_0x98f3('0x31')]['sort']);_0x28c0cb[_0x98f3('0x3a')]=qs[_0x98f3('0x3b')](_[_0x98f3('0x3c')](_0x15d1b8[_0x98f3('0x31')],_0x25207b['filters']),_0x536df3);if(_0x15d1b8['query'][_0x98f3('0x3d')]){_0x28c0cb[_0x98f3('0x3a')]=_['merge'](_0x28c0cb[_0x98f3('0x3a')],{'$or':_[_0x98f3('0x30')](_0x536df3,function(_0x31e239){if(_0x31e239[_0x98f3('0x3e')]!=='VIRTUAL'){var _0x440a79={};_0x440a79[_0x31e239[_0x98f3('0x29')]]={'$like':'%'+_0x15d1b8[_0x98f3('0x31')][_0x98f3('0x3d')]+'%'};return _0x440a79;}})});}_0x28c0cb=_[_0x98f3('0x3f')]({},_0x28c0cb,_0x15d1b8[_0x98f3('0x40')]);var _0x2df920={'where':_0x28c0cb[_0x98f3('0x3a')]};return db['ChatTransferReport']['count'](_0x2df920)[_0x98f3('0x26')](function(_0x2bd471){_0x4ef76b[_0x98f3('0x20')]=_0x2bd471;if(_0x15d1b8[_0x98f3('0x31')]['includeAll']){_0x28c0cb['include']=[{'all':!![]}];}return db[_0x98f3('0x41')][_0x98f3('0x42')](_0x28c0cb);})[_0x98f3('0x26')](function(_0xfd5319){_0x4ef76b[_0x98f3('0x43')]=_0xfd5319;return _0x4ef76b;})['then'](respondWithFilteredResult(_0x445bcf,_0x28c0cb))[_0x98f3('0x44')](handleError(_0x445bcf,null));};exports[_0x98f3('0x45')]=function(_0x2a896e,_0x258997){var _0x5904a9={'raw':!![],'where':{'id':_0x2a896e[_0x98f3('0x46')]['id']}},_0xbb14d8={};_0xbb14d8[_0x98f3('0x2f')]=_[_0x98f3('0x47')](db[_0x98f3('0x41')]['rawAttributes']);_0xbb14d8[_0x98f3('0x31')]=_[_0x98f3('0x47')](_0x2a896e[_0x98f3('0x31')]);_0xbb14d8[_0x98f3('0x3b')]=_['intersection'](_0xbb14d8['model'],_0xbb14d8['query']);_0x5904a9[_0x98f3('0x33')]=_['intersection'](_0xbb14d8['model'],qs[_0x98f3('0x34')](_0x2a896e[_0x98f3('0x31')][_0x98f3('0x34')]));_0x5904a9['attributes']=_0x5904a9[_0x98f3('0x33')][_0x98f3('0x35')]?_0x5904a9['attributes']:_0xbb14d8[_0x98f3('0x2f')];if(_0x2a896e[_0x98f3('0x31')][_0x98f3('0x48')]){_0x5904a9[_0x98f3('0x49')]=[{'all':!![]}];}_0x5904a9=_[_0x98f3('0x3f')]({},_0x5904a9,_0x2a896e['options']);return db[_0x98f3('0x41')][_0x98f3('0x4a')](_0x5904a9)[_0x98f3('0x26')](handleEntityNotFound(_0x258997,null))['then'](respondWithResult(_0x258997,null))[_0x98f3('0x44')](handleError(_0x258997,null));};exports['create']=function(_0x364f15,_0x328678){return db[_0x98f3('0x41')][_0x98f3('0x4b')](_0x364f15[_0x98f3('0x4c')],{})[_0x98f3('0x26')](respondWithResult(_0x328678,0xc9))[_0x98f3('0x44')](handleError(_0x328678,null));};exports[_0x98f3('0x24')]=function(_0x155335,_0xb2c758){if(_0x155335[_0x98f3('0x4c')]['id']){delete _0x155335[_0x98f3('0x4c')]['id'];}return db[_0x98f3('0x41')][_0x98f3('0x4a')]({'where':{'id':_0x155335[_0x98f3('0x46')]['id']}})['then'](handleEntityNotFound(_0xb2c758,null))[_0x98f3('0x26')](saveUpdates(_0x155335[_0x98f3('0x4c')],null))[_0x98f3('0x26')](respondWithResult(_0xb2c758,null))[_0x98f3('0x44')](handleError(_0xb2c758,null));};exports[_0x98f3('0x25')]=function(_0x303a66,_0x5ed7bd){return db[_0x98f3('0x41')][_0x98f3('0x4a')]({'where':{'id':_0x303a66[_0x98f3('0x46')]['id']}})[_0x98f3('0x26')](handleEntityNotFound(_0x5ed7bd,null))[_0x98f3('0x26')](removeEntity(_0x5ed7bd,null))['catch'](handleError(_0x5ed7bd,null));};exports['describe']=function(_0x491000,_0x474ffc){return db[_0x98f3('0x41')][_0x98f3('0x4d')]()[_0x98f3('0x26')](respondWithResult(_0x474ffc,null))[_0x98f3('0x44')](handleError(_0x474ffc,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 77b1992..865b372 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 _0x4241=['bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','moment'];(function(_0xc3dcbf,_0x4ae84c){var _0x40bf65=function(_0x1fc974){while(--_0x1fc974){_0xc3dcbf['push'](_0xc3dcbf['shift']());}};_0x40bf65(++_0x4ae84c);}(_0x4241,0x168));var _0x1424=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x4241[_0x3826ad];return _0x17b900;};'use strict';var _=require(_0x1424('0x0'));var util=require(_0x1424('0x1'));var logger=require('../../config/logger')(_0x1424('0x2'));var moment=require(_0x1424('0x3'));var BPromise=require(_0x1424('0x4'));var rp=require(_0x1424('0x5'));var fs=require('fs');var path=require(_0x1424('0x6'));var rimraf=require(_0x1424('0x7'));var config=require(_0x1424('0x8'));var attributes=require(_0x1424('0x9'));module[_0x1424('0xa')]=function(_0x2149e3,_0x2c9ee4){return _0x2149e3['define'](_0x1424('0xb'),attributes,{'tableName':_0x1424('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1424('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda7b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','report_chat_transfer','uniqueid','lodash','util'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0xda7b,0x150));var _0xbda7=function(_0xd94fcc,_0x39d650){_0xd94fcc=_0xd94fcc-0x0;var _0x14c88f=_0xda7b[_0xd94fcc];return _0x14c88f;};'use strict';var _=require(_0xbda7('0x0'));var util=require(_0xbda7('0x1'));var logger=require(_0xbda7('0x2'))(_0xbda7('0x3'));var moment=require(_0xbda7('0x4'));var BPromise=require(_0xbda7('0x5'));var rp=require(_0xbda7('0x6'));var fs=require('fs');var path=require(_0xbda7('0x7'));var rimraf=require(_0xbda7('0x8'));var config=require(_0xbda7('0x9'));var attributes=require(_0xbda7('0xa'));module['exports']=function(_0x5db09b,_0xdb94bd){return _0x5db09b['define']('ChatTransferReport',attributes,{'tableName':_0xbda7('0xb'),'paranoid':![],'indexes':[{'name':_0xbda7('0xc'),'fields':[_0xbda7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 82b251a..5d9e84b 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 _0xca9f=['info','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x28ce75,_0x103f9d){var _0x13360b=function(_0x340027){while(--_0x340027){_0x28ce75['push'](_0x28ce75['shift']());}};_0x13360b(++_0x103f9d);}(_0xca9f,0x128));var _0xfca9=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0xca9f[_0x39106e];return _0x892aec;};'use strict';var _=require(_0xfca9('0x0'));var util=require(_0xfca9('0x1'));var moment=require(_0xfca9('0x2'));var BPromise=require('bluebird');var rs=require(_0xfca9('0x3'));var fs=require('fs');var Redis=require(_0xfca9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfca9('0x5'));var logger=require(_0xfca9('0x6'))(_0xfca9('0x7'));var config=require(_0xfca9('0x8'));var jayson=require(_0xfca9('0x9'));var client=jayson['client'][_0xfca9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c5bec,_0x4c32c5,_0x5da1bf){return new BPromise(function(_0x2f309c,_0x4dfd86){return client[_0xfca9('0xb')](_0x4c5bec,_0x5da1bf)['then'](function(_0x5bbe78){logger[_0xfca9('0xc')](_0xfca9('0xd'),_0x4c32c5,'request\x20sent');logger['debug'](_0xfca9('0xe'),_0x4c32c5,_0xfca9('0xf'),JSON[_0xfca9('0x10')](_0x5bbe78));if(_0x5bbe78[_0xfca9('0x11')]){if(_0x5bbe78[_0xfca9('0x11')][_0xfca9('0x12')]===0x1f4){logger[_0xfca9('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x4c32c5,_0x5bbe78['error'][_0xfca9('0x13')]);return _0x4dfd86(_0x5bbe78[_0xfca9('0x11')][_0xfca9('0x13')]);}logger[_0xfca9('0x11')](_0xfca9('0xd'),_0x4c32c5,_0x5bbe78[_0xfca9('0x11')][_0xfca9('0x13')]);return _0x2f309c(_0x5bbe78[_0xfca9('0x11')][_0xfca9('0x13')]);}else{logger[_0xfca9('0xc')](_0xfca9('0xd'),_0x4c32c5,_0xfca9('0xf'));_0x2f309c(_0x5bbe78[_0xfca9('0x14')][_0xfca9('0x13')]);}})[_0xfca9('0x15')](function(_0x25bbe3){logger[_0xfca9('0x11')](_0xfca9('0xd'),_0x4c32c5,_0x25bbe3);_0x4dfd86(_0x25bbe3);});});} \ No newline at end of file +var _0x6be7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x6be7,0xd6));var _0x76be=function(_0x417273,_0x4c4aa6){_0x417273=_0x417273-0x0;var _0x1f718c=_0x6be7[_0x417273];return _0x1f718c;};'use strict';var _=require(_0x76be('0x0'));var util=require('util');var moment=require(_0x76be('0x1'));var BPromise=require(_0x76be('0x2'));var rs=require(_0x76be('0x3'));var fs=require('fs');var Redis=require(_0x76be('0x4'));var db=require(_0x76be('0x5'))['db'];var utils=require(_0x76be('0x6'));var logger=require(_0x76be('0x7'))('rpc');var config=require(_0x76be('0x8'));var jayson=require(_0x76be('0x9'));var client=jayson[_0x76be('0xa')][_0x76be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2faf24,_0x17b150,_0x44230d){return new BPromise(function(_0x45c70a,_0x217484){return client['request'](_0x2faf24,_0x44230d)[_0x76be('0xc')](function(_0xc851d7){logger[_0x76be('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x17b150,_0x76be('0xe'));logger[_0x76be('0xf')](_0x76be('0x10'),_0x17b150,'request\x20sent',JSON[_0x76be('0x11')](_0xc851d7));if(_0xc851d7['error']){if(_0xc851d7[_0x76be('0x12')][_0x76be('0x13')]===0x1f4){logger[_0x76be('0x12')](_0x76be('0x14'),_0x17b150,_0xc851d7[_0x76be('0x12')][_0x76be('0x15')]);return _0x217484(_0xc851d7[_0x76be('0x12')][_0x76be('0x15')]);}logger[_0x76be('0x12')](_0x76be('0x14'),_0x17b150,_0xc851d7[_0x76be('0x12')][_0x76be('0x15')]);return _0x45c70a(_0xc851d7[_0x76be('0x12')][_0x76be('0x15')]);}else{logger[_0x76be('0xd')](_0x76be('0x14'),_0x17b150,'request\x20sent');_0x45c70a(_0xc851d7[_0x76be('0x16')][_0x76be('0x15')]);}})[_0x76be('0x17')](function(_0x543fcc){logger['error'](_0x76be('0x14'),_0x17b150,_0x543fcc);_0x217484(_0x543fcc);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 48612ad..0344562 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 _0xa40e=['delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x338012,_0x3db184){var _0xc1d3ed=function(_0x26c553){while(--_0x26c553){_0x338012['push'](_0x338012['shift']());}};_0xc1d3ed(++_0x3db184);}(_0xa40e,0x18a));var _0xea40=function(_0x55db80,_0x111035){_0x55db80=_0x55db80-0x0;var _0x4eaeb8=_0xa40e[_0x55db80];return _0x4eaeb8;};'use strict';var multer=require('multer');var util=require(_0xea40('0x0'));var path=require('path');var timeout=require(_0xea40('0x1'));var express=require(_0xea40('0x2'));var router=express[_0xea40('0x3')]();var fs_extra=require(_0xea40('0x4'));var auth=require(_0xea40('0x5'));var interaction=require(_0xea40('0x6'));var config=require(_0xea40('0x7'));var controller=require(_0xea40('0x8'));router[_0xea40('0x9')]('/',auth['isAuthenticated'](),controller[_0xea40('0xa')]);router[_0xea40('0x9')](_0xea40('0xb'),auth[_0xea40('0xc')](),controller[_0xea40('0xd')]);router[_0xea40('0x9')](_0xea40('0xe'),auth[_0xea40('0xc')](),controller[_0xea40('0xf')]);router[_0xea40('0x10')]('/',auth[_0xea40('0xc')](),controller[_0xea40('0x11')]);router[_0xea40('0x12')](_0xea40('0xe'),auth[_0xea40('0xc')](),controller[_0xea40('0x13')]);router[_0xea40('0x14')]('/:id',auth[_0xea40('0xc')](),controller[_0xea40('0x15')]);module[_0xea40('0x16')]=router; \ No newline at end of file +var _0xf993=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','multer'];(function(_0x28019c,_0x67743){var _0x48ca39=function(_0x4c161e){while(--_0x4c161e){_0x28019c['push'](_0x28019c['shift']());}};_0x48ca39(++_0x67743);}(_0xf993,0x1b8));var _0x3f99=function(_0x104627,_0xe5315){_0x104627=_0x104627-0x0;var _0x304b03=_0xf993[_0x104627];return _0x304b03;};'use strict';var multer=require(_0x3f99('0x0'));var util=require(_0x3f99('0x1'));var path=require(_0x3f99('0x2'));var timeout=require(_0x3f99('0x3'));var express=require(_0x3f99('0x4'));var router=express[_0x3f99('0x5')]();var fs_extra=require(_0x3f99('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3f99('0x7'));var config=require(_0x3f99('0x8'));var controller=require(_0x3f99('0x9'));router[_0x3f99('0xa')]('/',auth[_0x3f99('0xb')](),controller[_0x3f99('0xc')]);router[_0x3f99('0xa')](_0x3f99('0xd'),auth[_0x3f99('0xb')](),controller[_0x3f99('0xe')]);router[_0x3f99('0xa')](_0x3f99('0xf'),auth[_0x3f99('0xb')](),controller[_0x3f99('0x10')]);router['post']('/',auth[_0x3f99('0xb')](),controller[_0x3f99('0x11')]);router[_0x3f99('0x12')]('/:id',auth[_0x3f99('0xb')](),controller[_0x3f99('0x13')]);router['delete']('/:id',auth[_0x3f99('0xb')](),controller[_0x3f99('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 6478700..77116f6 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 _0xdace=['Generated\x20by\x20XCALLY\x20Motion','sequelize','exports','STRING','email','Agent','#011F6A','#ffffff','BOOLEAN','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Type\x20a\x20message','Skip','Feedback','ENUM','star','thumb','input','name','getDataValue','parse','onlineForm','setDataValue','stringify','textarea','Comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x25cd2c,_0x57498e){var _0x1e364c=function(_0x35ac2e){while(--_0x35ac2e){_0x25cd2c['push'](_0x25cd2c['shift']());}};_0x1e364c(++_0x57498e);}(_0xdace,0xc5));var _0xedac=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0xdace[_0x4a0e68];return _0x4fb274;};'use strict';var Sequelize=require(_0xedac('0x0'));var rs=require('randomstring');module[_0xedac('0x1')]={'name':{'type':Sequelize[_0xedac('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xedac('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xedac('0x2')]},'mapKey':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x3')},'mapKeyOffline':{'type':Sequelize[_0xedac('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0xedac('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xedac('0x2')],'allowNull':![],'defaultValue':_0xedac('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xedac('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xedac('0x2')],'allowNull':![],'defaultValue':_0xedac('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xedac('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xedac('0x2')]},'animation':{'type':Sequelize[_0xedac('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0xedac('0x8')),'defaultValue':_0xedac('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xedac('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xedac('0xb')},'offline_chat_button':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0xc')},'header_offline':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0xd')},'download_transcript':{'type':Sequelize[_0xedac('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xedac('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xedac('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xedac('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xedac('0xf')]},'closingQuestion':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xedac('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xedac('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x11')},'placeholderMessage':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x12')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0xc')},'skipMessageButton':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x13')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x14')},'ratingType':{'type':Sequelize[_0xedac('0x15')](_0xedac('0x16'),_0xedac('0x17')),'defaultValue':_0xedac('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xedac('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xedac('0x18'),'variable':null,'config':{'placeholder':_0xedac('0x19'),'type':'text','required':!![]},'props':{'title':_0xedac('0x19'),'helpText':''}},{'type':_0xedac('0x18'),'props':{'title':_0xedac('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xedac('0x3'),'type':_0xedac('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xedac('0x1a')]('onlineForm')?JSON[_0xedac('0x1b')](this[_0xedac('0x1a')](_0xedac('0x1c'))):{};},'set':function(_0x41ad8d){return this[_0xedac('0x1d')](_0xedac('0x1c'),JSON[_0xedac('0x1e')](_0x41ad8d));}},'offlineForm':{'type':Sequelize[_0xedac('0xf')],'defaultValue':function(){return JSON[_0xedac('0x1e')]({'items':[{'type':_0xedac('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xedac('0x3'),'type':_0xedac('0x3')},'variable':null},{'type':_0xedac('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0xedac('0x20'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xedac('0x21'))?JSON[_0xedac('0x1b')](this[_0xedac('0x1a')](_0xedac('0x21'))):{};},'set':function(_0x555f1f){return this['setDataValue'](_0xedac('0x21'),JSON[_0xedac('0x1e')](_0x555f1f));}},'token':{'type':Sequelize[_0xedac('0x2')],'defaultValue':function(){return rs[_0xedac('0x22')]();}},'autoclose':{'type':Sequelize[_0xedac('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xedac('0x2')]},'waitingTitle':{'type':Sequelize[_0xedac('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x23')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xedac('0x24')},'offlineMessageBody':{'type':Sequelize[_0xedac('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xedac('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x25')},'skipUnmanaged':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x13')},'sendUnmanaged':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xedac('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xedac('0x2')]},'notificationTemplate':{'type':Sequelize[_0xedac('0xf')],'defaultValue':function(){return _0xedac('0x26');}},'notificationSound':{'type':Sequelize[_0xedac('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0xedac('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x28')},'verticalAlignment':{'type':Sequelize[_0xedac('0xe')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x29')},'messagesAlignment':{'type':Sequelize[_0xedac('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xedac('0x2')]},'customerAvatar':{'type':Sequelize[_0xedac('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xedac('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xedac('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xedac('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xedac('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x2b')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xedac('0xe')],'comment':_0xedac('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xedac('0x2d'),'set':function(_0x2fa832){if(!_0x2fa832)this['setDataValue'](_0xedac('0x2e'),null);this['setDataValue'](_0xedac('0x2f'),_0x2fa832);}},'vidaooEscalation':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xedac('0x2')]},'vidaooTopic':{'type':Sequelize[_0xedac('0x2')],'allowNull':![],'defaultValue':_0xedac('0x30')},'vidaooNote':{'type':Sequelize[_0xedac('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xedac('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xedac('0xf')]}}; \ No newline at end of file +var _0x1339=['New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','BOOLEAN','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Skip','thumb','stringify','input','text','name','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','offlineForm','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.'];(function(_0x1acc2d,_0x597696){var _0xabfa6d=function(_0x41e83c){while(--_0x41e83c){_0x1acc2d['push'](_0x1acc2d['shift']());}};_0xabfa6d(++_0x597696);}(_0x1339,0x1ed));var _0x9133=function(_0x45f4a0,_0x5a6daa){_0x45f4a0=_0x45f4a0-0x0;var _0xfe5a41=_0x1339[_0x45f4a0];return _0xfe5a41;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x9133('0x0')]={'name':{'type':Sequelize[_0x9133('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x9133('0x1')],'allowNull':![],'unique':_0x9133('0x2')},'description':{'type':Sequelize[_0x9133('0x1')]},'mapKey':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x3')},'mapKeyOffline':{'type':Sequelize[_0x9133('0x1')],'defaultValue':'email'},'key':{'type':Sequelize[_0x9133('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x9133('0x1')],'allowNull':![],'defaultValue':_0x9133('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x9133('0x1')],'allowNull':![],'defaultValue':_0x9133('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x9133('0x1')],'allowNull':![],'defaultValue':_0x9133('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x9133('0x1')],'allowNull':![],'defaultValue':_0x9133('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x9133('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x9133('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x9133('0x8')](_0x9133('0x9'),_0x9133('0xa')),'defaultValue':_0x9133('0x9')},'header_online':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x9133('0xc')},'offline_chat_button':{'type':Sequelize[_0x9133('0x1')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x9133('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x9133('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x9133('0xf')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x9133('0x10')]},'closingQuestion':{'type':Sequelize[_0x9133('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x11')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9133('0x12')},'noteTitle':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x13')},'placeholderMessage':{'type':Sequelize[_0x9133('0x1')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x9133('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x9133('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x9133('0x8')]('star',_0x9133('0x15')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x9133('0x16')]({'items':[{'type':_0x9133('0x17'),'variable':null,'config':{'placeholder':'name','type':_0x9133('0x18'),'required':!![]},'props':{'title':_0x9133('0x19'),'helpText':''}},{'type':_0x9133('0x17'),'props':{'title':_0x9133('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x9133('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x9133('0x1a'))?JSON[_0x9133('0x1b')](this[_0x9133('0x1c')](_0x9133('0x1a'))):{};},'set':function(_0x4483ef){return this[_0x9133('0x1d')](_0x9133('0x1a'),JSON[_0x9133('0x16')](_0x4483ef));}},'offlineForm':{'type':Sequelize[_0x9133('0x10')],'defaultValue':function(){return JSON[_0x9133('0x16')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x9133('0x3'),'type':_0x9133('0x3')},'variable':null},{'type':_0x9133('0x1e'),'config':{'placeholder':_0x9133('0x1f')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x9133('0x1c')](_0x9133('0x20'))?JSON[_0x9133('0x1b')](this[_0x9133('0x1c')](_0x9133('0x20'))):{};},'set':function(_0x88326c){return this['setDataValue']('offlineForm',JSON['stringify'](_0x88326c));}},'token':{'type':Sequelize[_0x9133('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x9133('0xf')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x9133('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x9133('0x1')]},'waitingTitle':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x21')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9133('0x22')},'offlineMessageSubject':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x23')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x9133('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0x9133('0xf')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x9133('0x1')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x14')},'sendUnmanaged':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x25')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x9133('0x10')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x9133('0x1')]},'notificationTemplate':{'type':Sequelize[_0x9133('0x10')],'defaultValue':function(){return _0x9133('0x26');}},'notificationSound':{'type':Sequelize[_0x9133('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x9133('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x28')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x29')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x9133('0x2a')},'defaultTitle':{'type':Sequelize[_0x9133('0x1')]},'customerAvatar':{'type':Sequelize[_0x9133('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x9133('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x9133('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9133('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9133('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x2b')},'systemAvatar':{'type':Sequelize[_0x9133('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9133('0x7')],'comment':_0x9133('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xafd8f9){if(!_0xafd8f9)this[_0x9133('0x1d')](_0x9133('0x2d'),null);this[_0x9133('0x1d')](_0x9133('0x2e'),_0xafd8f9);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x9133('0x1')]},'vidaooTopic':{'type':Sequelize[_0x9133('0x1')],'allowNull':![],'defaultValue':_0x9133('0x2f')},'vidaooNote':{'type':Sequelize[_0x9133('0x1')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x9133('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x9133('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index b3b6dbf..f149600 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 _0xb7fe=['length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','keys','include','create','user','role','body','find','params','describe','addDisposition','ChatWebsiteId','findOne','Disposition','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','difference','createdAt','updatedAt','ListId','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','Contacts','DESC','Applications','List','applications','list','orderBy','asc','account','defaults','contact','cf-connecting-ip','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','CompanyId','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','SendMail','sendMail','forwardOfflineAddress','toPairsIn','mapValues','subjectOffline','email','MailAccountId','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','fullname','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','inspect','No\x20timezone','Interval','Intervals','../../config/license/util','License','increment','some','readFileSync','server/files/chat/iframe.ejs','remote','x-real-ip','virtual','replace','render','verticalAlignment','labelText','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','READ_COMMITTED','ChatApplication','finally','json','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','bluebird','mustache','util','ejs','fs-extra','lodash','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','http','client','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','status','end','limit','undefined','count','set','Content-Range','update','destroy','then','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xb7fe,0xe7));var _0xeb7f=function(_0x4fdf5c,_0x581059){_0x4fdf5c=_0x4fdf5c-0x0;var _0x3ee8ff=_0xb7fe[_0x4fdf5c];return _0x3ee8ff;};'use strict';var BPromise=require(_0xeb7f('0x0'));var Mustache=require(_0xeb7f('0x1'));var util=require(_0xeb7f('0x2'));var path=require('path');var ejs=require(_0xeb7f('0x3'));var fs=require('fs');var fs_extra=require(_0xeb7f('0x4'));var _=require(_0xeb7f('0x5'));var querystring=require(_0xeb7f('0x6'));var Redis=require('ioredis');var qs=require(_0xeb7f('0x7'));var logger=require(_0xeb7f('0x8'))(_0xeb7f('0x9'));var config=require(_0xeb7f('0xa'));var db=require(_0xeb7f('0xb'))['db'];config[_0xeb7f('0xc')]=_['defaults'](config[_0xeb7f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb7f('0xd'))(new Redis(config[_0xeb7f('0xc')]));require(_0xeb7f('0xe'))[_0xeb7f('0xf')](socket);var htmlToText=require(_0xeb7f('0x10'));var jayson=require(_0xeb7f('0x11'));var client=jayson['client'][_0xeb7f('0x12')]({'port':0x232c});var client9002=jayson[_0xeb7f('0x13')][_0xeb7f('0x12')]({'port':0x232a});var client9003=jayson[_0xeb7f('0x13')][_0xeb7f('0x12')]({'port':0x232b});var client9001=jayson[_0xeb7f('0x13')][_0xeb7f('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x499b16,_0x426e10,_0xb6272,_0x11d71b){return new BPromise(function(_0x59c874,_0x363a0d){var _0x84cb7a=_0x11d71b||client;return _0x84cb7a[_0xeb7f('0x14')](_0x499b16,_0xb6272)['then'](function(_0x4ac921){logger['info'](_0xeb7f('0x15'),_0x426e10,_0xeb7f('0x16'));logger[_0xeb7f('0x17')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x426e10,_0xeb7f('0x16'),JSON[_0xeb7f('0x18')](_0x4ac921));if(_0x4ac921[_0xeb7f('0x19')]){if(_0x4ac921[_0xeb7f('0x19')]['code']===0x1f4){logger['error'](_0xeb7f('0x15'),_0x426e10,_0x4ac921[_0xeb7f('0x19')][_0xeb7f('0x1a')]);return _0x363a0d(_0x4ac921['error']['message']);}logger['error'](_0xeb7f('0x15'),_0x426e10,_0x4ac921[_0xeb7f('0x19')]['message']);return _0x59c874(_0x4ac921[_0xeb7f('0x19')][_0xeb7f('0x1a')]);}else{logger[_0xeb7f('0x1b')](_0xeb7f('0x15'),_0x426e10,_0xeb7f('0x16'));_0x59c874(_0x4ac921[_0xeb7f('0x1c')][_0xeb7f('0x1a')]);}})[_0xeb7f('0x1d')](function(_0xa3f92){logger['error'](_0xeb7f('0x15'),_0x426e10,_0xa3f92);_0x363a0d(_0xa3f92);});});}function respondWithStatusCode(_0x1fe6c2,_0x23903f){_0x23903f=_0x23903f||0xcc;return function(_0x132f7b){if(_0x132f7b){return _0x1fe6c2['sendStatus'](_0x23903f);}return _0x1fe6c2[_0xeb7f('0x1e')](_0x23903f)[_0xeb7f('0x1f')]();};}function respondWithResult(_0x5b0b17,_0x2df4e0){_0x2df4e0=_0x2df4e0||0xc8;return function(_0x1d49b2){if(_0x1d49b2){return _0x5b0b17['status'](_0x2df4e0)['json'](_0x1d49b2);}};}function respondWithFilteredResult(_0xc342dd,_0x1d7a39){return function(_0x4be8e8){if(_0x4be8e8){var _0x48aae=typeof _0x1d7a39['offset']==='undefined'&&typeof _0x1d7a39[_0xeb7f('0x20')]===_0xeb7f('0x21');var _0x3236ac=_0x4be8e8[_0xeb7f('0x22')];var _0x7dff00=_0x48aae?0x0:_0x1d7a39['offset'];var _0x548b8f=_0x48aae?_0x4be8e8[_0xeb7f('0x22')]:_0x1d7a39['offset']+_0x1d7a39[_0xeb7f('0x20')];var _0x1c247c;if(_0x548b8f>=_0x3236ac){_0x548b8f=_0x3236ac;_0x1c247c=0xc8;}else{_0x1c247c=0xce;}_0xc342dd['status'](_0x1c247c);return _0xc342dd[_0xeb7f('0x23')](_0xeb7f('0x24'),_0x7dff00+'-'+_0x548b8f+'/'+_0x3236ac)['json'](_0x4be8e8);}return null;};}function saveUpdates(_0x5b8224){return function(_0x379b7f){if(_0x379b7f){return _0x379b7f[_0xeb7f('0x25')](_0x5b8224)['then'](function(_0x104f4e){return _0x104f4e;});}return null;};}function removeEntity(_0x4d72b7){return function(_0xb4c4c8){if(_0xb4c4c8){return _0xb4c4c8[_0xeb7f('0x26')]()[_0xeb7f('0x27')](function(){var _0x52d468=_0xb4c4c8[_0xeb7f('0x28')]({'plain':!![]});var _0x293b09=_0xeb7f('0x29');return db[_0xeb7f('0x2a')]['destroy']({'where':{'type':_0x293b09,'resourceId':_0x52d468['id']}})[_0xeb7f('0x27')](function(){return _0xb4c4c8;});})[_0xeb7f('0x27')](function(){_0x4d72b7[_0xeb7f('0x1e')](0xcc)[_0xeb7f('0x1f')]();});}};}function handleEntityNotFound(_0x58807a){return function(_0x1c0112){if(!_0x1c0112){_0x58807a[_0xeb7f('0x2b')](0x194);}return _0x1c0112;};}function handleError(_0x97862f,_0x2a52ab){_0x2a52ab=_0x2a52ab||0x1f4;return function(_0x50904d){logger[_0xeb7f('0x19')](_0x50904d[_0xeb7f('0x2c')]);if(_0x50904d[_0xeb7f('0x2d')]){delete _0x50904d['name'];}_0x97862f[_0xeb7f('0x1e')](_0x2a52ab)[_0xeb7f('0x2e')](_0x50904d);};}exports[_0xeb7f('0x2f')]=function(_0x58dc84,_0x386bb4){var _0x45494f={'include':[{'model':db[_0xeb7f('0x30')],'as':_0xeb7f('0x31')}]},_0x176b43={},_0x38b8ef={'count':0x0,'rows':[]};var _0x22cabe=_['map'](db[_0xeb7f('0x32')][_0xeb7f('0x33')],function(_0x2f6568){return{'name':_0x2f6568[_0xeb7f('0x34')],'type':_0x2f6568[_0xeb7f('0x35')][_0xeb7f('0x36')]};});_0x176b43[_0xeb7f('0x37')]=_[_0xeb7f('0x38')](_0x22cabe,_0xeb7f('0x2d'));_0x176b43[_0xeb7f('0x39')]=_['keys'](_0x58dc84[_0xeb7f('0x39')]);_0x176b43[_0xeb7f('0x3a')]=_[_0xeb7f('0x3b')](_0x176b43[_0xeb7f('0x37')],_0x176b43['query']);_0x45494f[_0xeb7f('0x3c')]=_['intersection'](_0x176b43[_0xeb7f('0x37')],qs['fields'](_0x58dc84[_0xeb7f('0x39')][_0xeb7f('0x3d')]));_0x45494f[_0xeb7f('0x3c')]=_0x45494f[_0xeb7f('0x3c')][_0xeb7f('0x3e')]?_0x45494f['attributes']:_0x176b43[_0xeb7f('0x37')];if(!_0x58dc84['query'][_0xeb7f('0x3f')](_0xeb7f('0x40'))){_0x45494f[_0xeb7f('0x20')]=qs['limit'](_0x58dc84[_0xeb7f('0x39')]['limit']);_0x45494f[_0xeb7f('0x41')]=qs[_0xeb7f('0x41')](_0x58dc84['query'][_0xeb7f('0x41')]);}_0x45494f[_0xeb7f('0x42')]=qs[_0xeb7f('0x43')](_0x58dc84[_0xeb7f('0x39')][_0xeb7f('0x43')]);_0x45494f[_0xeb7f('0x44')]=qs[_0xeb7f('0x3a')](_[_0xeb7f('0x45')](_0x58dc84[_0xeb7f('0x39')],_0x176b43[_0xeb7f('0x3a')]),_0x22cabe);if(_0x58dc84[_0xeb7f('0x39')][_0xeb7f('0x46')]){_0x45494f[_0xeb7f('0x44')]=_[_0xeb7f('0x47')](_0x45494f[_0xeb7f('0x44')],{'$or':_[_0xeb7f('0x38')](_0x22cabe,function(_0x5d8703){if(_0x5d8703['type']!==_0xeb7f('0x48')){var _0x207fa7={};_0x207fa7[_0x5d8703[_0xeb7f('0x2d')]]={'$like':'%'+_0x58dc84['query'][_0xeb7f('0x46')]+'%'};return _0x207fa7;}})});}_0x45494f=_['merge']({},_0x45494f,_0x58dc84[_0xeb7f('0x49')]);var _0x87f004={'where':_0x45494f[_0xeb7f('0x44')]};return db[_0xeb7f('0x32')][_0xeb7f('0x22')](_0x87f004)[_0xeb7f('0x27')](function(_0x7e7066){_0x38b8ef[_0xeb7f('0x22')]=_0x7e7066;if(_0x58dc84[_0xeb7f('0x39')][_0xeb7f('0x4a')]){_0x45494f['include']=[{'all':!![]}];}return db[_0xeb7f('0x32')][_0xeb7f('0x4b')](_0x45494f);})[_0xeb7f('0x27')](function(_0x4e1277){_0x38b8ef['rows']=_0x4e1277;return _0x38b8ef;})[_0xeb7f('0x27')](respondWithFilteredResult(_0x386bb4,_0x45494f))[_0xeb7f('0x1d')](handleError(_0x386bb4,null));};exports['show']=function(_0x26c61a,_0x3fb4ac){var _0x3f9230={'raw':![],'where':{'id':_0x26c61a['params']['id']},'include':[{'model':db[_0xeb7f('0x30')],'as':_0xeb7f('0x31')}]},_0x3d21aa={};_0x3d21aa[_0xeb7f('0x37')]=_[_0xeb7f('0x4c')](db[_0xeb7f('0x32')][_0xeb7f('0x33')]);_0x3d21aa[_0xeb7f('0x39')]=_[_0xeb7f('0x4c')](_0x26c61a[_0xeb7f('0x39')]);_0x3d21aa[_0xeb7f('0x3a')]=_['intersection'](_0x3d21aa['model'],_0x3d21aa[_0xeb7f('0x39')]);_0x3f9230[_0xeb7f('0x3c')]=_[_0xeb7f('0x3b')](_0x3d21aa['model'],qs[_0xeb7f('0x3d')](_0x26c61a[_0xeb7f('0x39')]['fields']));_0x3f9230[_0xeb7f('0x3c')]=_0x3f9230['attributes']['length']?_0x3f9230[_0xeb7f('0x3c')]:_0x3d21aa[_0xeb7f('0x37')];if(_0x26c61a[_0xeb7f('0x39')][_0xeb7f('0x4a')]){_0x3f9230[_0xeb7f('0x4d')]=[{'all':!![]}];}_0x3f9230=_[_0xeb7f('0x47')]({},_0x3f9230,_0x26c61a[_0xeb7f('0x49')]);return db[_0xeb7f('0x32')]['find'](_0x3f9230)['then'](handleEntityNotFound(_0x3fb4ac,null))[_0xeb7f('0x27')](respondWithResult(_0x3fb4ac,null))['catch'](handleError(_0x3fb4ac,null));};exports[_0xeb7f('0x4e')]=function(_0x1b3c4c,_0x2e25d6){return db[_0xeb7f('0x32')][_0xeb7f('0x4e')](_0x1b3c4c['body'],{})[_0xeb7f('0x27')](function(_0x3e386a){var _0x4e9961=_0x1b3c4c[_0xeb7f('0x4f')][_0xeb7f('0x28')]({'plain':!![]});if(!_0x4e9961)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e9961[_0xeb7f('0x50')]===_0xeb7f('0x4f')){var _0x1261e9=_0x3e386a[_0xeb7f('0x28')]({'plain':!![]});var _0x2ae6dd=_0xeb7f('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x2ae6dd,'userProfileId':_0x4e9961['userProfileId']},'raw':!![]})[_0xeb7f('0x27')](function(_0x3bf709){if(_0x3bf709&&_0x3bf709['autoAssociation']===0x0){return db['UserProfileResource'][_0xeb7f('0x4e')]({'name':_0x1261e9[_0xeb7f('0x2d')],'resourceId':_0x1261e9['id'],'type':_0x3bf709[_0xeb7f('0x2d')],'sectionId':_0x3bf709['id']},{})['then'](function(){return _0x3e386a;});}else{return _0x3e386a;}})[_0xeb7f('0x1d')](function(_0x16da1c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16da1c);throw _0x16da1c;});}return _0x3e386a;})['then'](respondWithResult(_0x2e25d6,0xc9))['catch'](handleError(_0x2e25d6,null));};exports['update']=function(_0x33f103,_0x81315e){if(_0x33f103[_0xeb7f('0x51')]['id']){delete _0x33f103[_0xeb7f('0x51')]['id'];}return db['ChatWebsite'][_0xeb7f('0x52')]({'where':{'id':_0x33f103[_0xeb7f('0x53')]['id']},'include':[{'model':db[_0xeb7f('0x30')],'as':'mandatoryDispositionPause'}]})[_0xeb7f('0x27')](handleEntityNotFound(_0x81315e,null))['then'](saveUpdates(_0x33f103['body'],null))[_0xeb7f('0x27')](respondWithResult(_0x81315e,null))[_0xeb7f('0x1d')](handleError(_0x81315e,null));};exports['destroy']=function(_0x46c4a2,_0x3cf655){return db[_0xeb7f('0x32')][_0xeb7f('0x52')]({'where':{'id':_0x46c4a2[_0xeb7f('0x53')]['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x3cf655,null))['then'](removeEntity(_0x3cf655,null))['catch'](handleError(_0x3cf655,null));};exports['describe']=function(_0x3ad68b,_0x34c5bf){return db[_0xeb7f('0x32')][_0xeb7f('0x54')]()[_0xeb7f('0x27')](respondWithResult(_0x34c5bf,null))[_0xeb7f('0x1d')](handleError(_0x34c5bf,null));};exports[_0xeb7f('0x55')]=function(_0x43d360,_0x13e9f8){if(_0x43d360[_0xeb7f('0x51')]['id']){delete _0x43d360[_0xeb7f('0x51')]['id'];}return db[_0xeb7f('0x32')][_0xeb7f('0x52')]({'where':{'id':_0x43d360[_0xeb7f('0x53')]['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x13e9f8,null))['then'](function(_0x3b29a2){if(_0x3b29a2){_0x43d360[_0xeb7f('0x51')][_0xeb7f('0x56')]=_0x3b29a2['id'];return db['Disposition'][_0xeb7f('0x4e')](_0x43d360[_0xeb7f('0x51')]);}})['then'](respondWithResult(_0x13e9f8,null))['catch'](handleError(_0x13e9f8,null));};exports['getDispositions']=function(_0x4c74e8,_0x374c08){var _0x5d3004={'raw':![],'where':{}};var _0x98407={};var _0x81bbd={'count':0x0,'rows':[]};return db[_0xeb7f('0x32')][_0xeb7f('0x57')]({'where':{'id':_0x4c74e8[_0xeb7f('0x53')]['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x374c08,null))[_0xeb7f('0x27')](function(_0x455511){if(_0x455511){_0x98407[_0xeb7f('0x37')]=_[_0xeb7f('0x4c')](db['Disposition'][_0xeb7f('0x33')]);_0x98407[_0xeb7f('0x39')]=_['keys'](_0x4c74e8[_0xeb7f('0x39')]);_0x98407[_0xeb7f('0x3a')]=_['intersection'](_0x98407[_0xeb7f('0x37')],_0x98407[_0xeb7f('0x39')]);_0x5d3004['attributes']=_['intersection'](_0x98407['model'],qs[_0xeb7f('0x3d')](_0x4c74e8['query'][_0xeb7f('0x3d')]));_0x5d3004[_0xeb7f('0x3c')]=_0x5d3004[_0xeb7f('0x3c')][_0xeb7f('0x3e')]?_0x5d3004['attributes']:_0x98407[_0xeb7f('0x37')];if(!_0x4c74e8[_0xeb7f('0x39')][_0xeb7f('0x3f')]('nolimit')){_0x5d3004[_0xeb7f('0x20')]=qs[_0xeb7f('0x20')](_0x4c74e8[_0xeb7f('0x39')]['limit']);_0x5d3004['offset']=qs['offset'](_0x4c74e8['query'][_0xeb7f('0x41')]);}_0x5d3004['order']=qs[_0xeb7f('0x43')](_0x4c74e8[_0xeb7f('0x39')][_0xeb7f('0x43')]);_0x5d3004['where']=qs[_0xeb7f('0x3a')](_['pick'](_0x4c74e8[_0xeb7f('0x39')],_0x98407[_0xeb7f('0x3a')]));_0x5d3004[_0xeb7f('0x44')][_0xeb7f('0x56')]=_0x455511['id'];if(_0x4c74e8[_0xeb7f('0x39')]['filter']){_0x5d3004[_0xeb7f('0x44')]=_[_0xeb7f('0x47')](_0x5d3004[_0xeb7f('0x44')],{'$or':_[_0xeb7f('0x38')](_0x5d3004[_0xeb7f('0x3c')],function(_0xf68ae6){var _0x40d0b9={};_0x40d0b9[_0xf68ae6]={'$like':'%'+_0x4c74e8[_0xeb7f('0x39')][_0xeb7f('0x46')]+'%'};return _0x40d0b9;})});}_0x5d3004=_['merge']({},_0x5d3004,_0x4c74e8[_0xeb7f('0x49')]);return db['Disposition']['count']({'where':_0x5d3004['where']})['then'](function(_0xb94770){_0x81bbd['count']=_0xb94770;if(_0x4c74e8[_0xeb7f('0x39')][_0xeb7f('0x4a')]){_0x5d3004[_0xeb7f('0x4d')]=[{'all':!![]}];}return db[_0xeb7f('0x58')][_0xeb7f('0x4b')](_0x5d3004);})[_0xeb7f('0x27')](function(_0x16e360){_0x81bbd[_0xeb7f('0x59')]=_0x16e360;return _0x81bbd;});}})[_0xeb7f('0x27')](respondWithFilteredResult(_0x374c08,_0x5d3004))['catch'](handleError(_0x374c08,null));};exports[_0xeb7f('0x5a')]=function(_0x25b1e7,_0x9a0749){return db['ChatWebsite'][_0xeb7f('0x52')]({'where':{'id':_0x25b1e7[_0xeb7f('0x53')]['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x9a0749,null))[_0xeb7f('0x27')](function(_0x14970f){if(_0x14970f){return _0x14970f[_0xeb7f('0x5a')](_0x25b1e7['query'][_0xeb7f('0x5b')]);}})['then'](respondWithStatusCode(_0x9a0749,null))[_0xeb7f('0x1d')](handleError(_0x9a0749,null));};exports[_0xeb7f('0x5c')]=function(_0x435d80,_0x3f614a){if(_0x435d80['body']['id']){delete _0x435d80[_0xeb7f('0x51')]['id'];}return db[_0xeb7f('0x32')][_0xeb7f('0x52')]({'where':{'id':_0x435d80[_0xeb7f('0x53')]['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x3f614a,null))['then'](function(_0x5d614a){if(_0x5d614a){_0x435d80['body'][_0xeb7f('0x56')]=_0x5d614a['id'];return db[_0xeb7f('0x5d')]['create'](_0x435d80['body']);}})['then'](respondWithResult(_0x3f614a,null))[_0xeb7f('0x1d')](handleError(_0x3f614a,null));};exports[_0xeb7f('0x5e')]=function(_0x83e2c8,_0x21f34a){var _0x14c850={'raw':![],'where':{}};var _0x2d70b8={};var _0x461dc3={'count':0x0,'rows':[]};return db[_0xeb7f('0x32')][_0xeb7f('0x57')]({'where':{'id':_0x83e2c8[_0xeb7f('0x53')]['id']}})['then'](handleEntityNotFound(_0x21f34a,null))['then'](function(_0x1c9827){if(_0x1c9827){_0x2d70b8[_0xeb7f('0x37')]=_[_0xeb7f('0x4c')](db[_0xeb7f('0x5d')][_0xeb7f('0x33')]);_0x2d70b8[_0xeb7f('0x39')]=_[_0xeb7f('0x4c')](_0x83e2c8[_0xeb7f('0x39')]);_0x2d70b8[_0xeb7f('0x3a')]=_[_0xeb7f('0x3b')](_0x2d70b8[_0xeb7f('0x37')],_0x2d70b8[_0xeb7f('0x39')]);_0x14c850[_0xeb7f('0x3c')]=_[_0xeb7f('0x3b')](_0x2d70b8[_0xeb7f('0x37')],qs[_0xeb7f('0x3d')](_0x83e2c8['query'][_0xeb7f('0x3d')]));_0x14c850['attributes']=_0x14c850[_0xeb7f('0x3c')]['length']?_0x14c850[_0xeb7f('0x3c')]:_0x2d70b8['model'];if(!_0x83e2c8[_0xeb7f('0x39')][_0xeb7f('0x3f')](_0xeb7f('0x40'))){_0x14c850[_0xeb7f('0x20')]=qs['limit'](_0x83e2c8['query']['limit']);_0x14c850[_0xeb7f('0x41')]=qs[_0xeb7f('0x41')](_0x83e2c8[_0xeb7f('0x39')][_0xeb7f('0x41')]);}_0x14c850[_0xeb7f('0x42')]=qs[_0xeb7f('0x43')](_0x83e2c8[_0xeb7f('0x39')]['sort']);_0x14c850['where']=qs[_0xeb7f('0x3a')](_[_0xeb7f('0x45')](_0x83e2c8[_0xeb7f('0x39')],_0x2d70b8['filters']));_0x14c850[_0xeb7f('0x44')][_0xeb7f('0x56')]=_0x1c9827['id'];if(_0x83e2c8[_0xeb7f('0x39')]['filter']){_0x14c850[_0xeb7f('0x44')]=_[_0xeb7f('0x47')](_0x14c850[_0xeb7f('0x44')],{'$or':_[_0xeb7f('0x38')](_0x14c850['attributes'],function(_0x583561){var _0x5f1a54={};_0x5f1a54[_0x583561]={'$like':'%'+_0x83e2c8[_0xeb7f('0x39')][_0xeb7f('0x46')]+'%'};return _0x5f1a54;})});}_0x14c850=_[_0xeb7f('0x47')]({},_0x14c850,_0x83e2c8[_0xeb7f('0x49')]);return db[_0xeb7f('0x5d')][_0xeb7f('0x22')]({'where':_0x14c850[_0xeb7f('0x44')]})[_0xeb7f('0x27')](function(_0x2fffe9){_0x461dc3[_0xeb7f('0x22')]=_0x2fffe9;if(_0x83e2c8[_0xeb7f('0x39')][_0xeb7f('0x4a')]){_0x14c850['include']=[{'all':!![]}];}return db[_0xeb7f('0x5d')][_0xeb7f('0x4b')](_0x14c850);})[_0xeb7f('0x27')](function(_0x1260c5){_0x461dc3['rows']=_0x1260c5;return _0x461dc3;});}})[_0xeb7f('0x27')](respondWithFilteredResult(_0x21f34a,_0x14c850))['catch'](handleError(_0x21f34a,null));};exports[_0xeb7f('0x5f')]=function(_0x437235,_0x29c56e){return db[_0xeb7f('0x32')][_0xeb7f('0x52')]({'where':{'id':_0x437235['params']['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x29c56e,null))['then'](function(_0x590e19){if(_0x590e19){return _0x590e19[_0xeb7f('0x5f')](_0x437235[_0xeb7f('0x39')][_0xeb7f('0x5b')]);}})[_0xeb7f('0x27')](respondWithStatusCode(_0x29c56e,null))[_0xeb7f('0x1d')](handleError(_0x29c56e,null));};exports[_0xeb7f('0x60')]=function(_0x690a24,_0x6a8dab){_0x690a24[_0xeb7f('0x51')][_0xeb7f('0x61')]=_0x690a24[_0xeb7f('0x62')][_0xeb7f('0x63')];return db['ChatWebsite'][_0xeb7f('0x52')]({'where':{'id':_0x690a24['params']['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x6a8dab,null))[_0xeb7f('0x27')](saveUpdates(_0x690a24['body'],null))['then'](respondWithResult(_0x6a8dab,null))[_0xeb7f('0x1d')](handleError(_0x6a8dab,null));};exports[_0xeb7f('0x64')]=function(_0xa654fe,_0x57edad){_0xa654fe[_0xeb7f('0x51')][_0xeb7f('0x65')]=_0xa654fe[_0xeb7f('0x62')][_0xeb7f('0x63')];return db[_0xeb7f('0x32')]['find']({'where':{'id':_0xa654fe[_0xeb7f('0x53')]['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x57edad,null))[_0xeb7f('0x27')](saveUpdates(_0xa654fe['body'],null))[_0xeb7f('0x27')](respondWithResult(_0x57edad,null))[_0xeb7f('0x1d')](handleError(_0x57edad,null));};exports[_0xeb7f('0x66')]=function(_0x50246e,_0x5ad690){_0x50246e[_0xeb7f('0x51')][_0xeb7f('0x67')]=_0x50246e['file'][_0xeb7f('0x63')];return db['ChatWebsite'][_0xeb7f('0x52')]({'where':{'id':_0x50246e[_0xeb7f('0x53')]['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x5ad690,null))[_0xeb7f('0x27')](saveUpdates(_0x50246e[_0xeb7f('0x51')],null))[_0xeb7f('0x27')](respondWithResult(_0x5ad690,null))[_0xeb7f('0x1d')](handleError(_0x5ad690,null));};exports['addSystemAvatar']=function(_0x5b891a,_0x1da001){_0x5b891a[_0xeb7f('0x51')][_0xeb7f('0x68')]=_0x5b891a[_0xeb7f('0x62')][_0xeb7f('0x63')];return db[_0xeb7f('0x32')][_0xeb7f('0x52')]({'where':{'id':_0x5b891a[_0xeb7f('0x53')]['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x1da001,null))['then'](saveUpdates(_0x5b891a[_0xeb7f('0x51')],null))['then'](respondWithResult(_0x1da001,null))[_0xeb7f('0x1d')](handleError(_0x1da001,null));};exports[_0xeb7f('0x69')]=function(_0xce40b2,_0x5b9150){var _0x4c8050=path[_0xeb7f('0x6a')](config[_0xeb7f('0x6b')],_0xeb7f('0x6c'));var _0x40244d={'where':{'id':_0xce40b2[_0xeb7f('0x53')]['id']},'attributes':['id',_0xeb7f('0x61')],'raw':!![]};var _0x266f3e=![];return require('../../config/license/util')[_0xeb7f('0x6d')]()[_0xeb7f('0x27')](function(_0x46e323){if(_0x46e323){_0x266f3e=_0x46e323[_0xeb7f('0x6e')];}})['then'](function(){return db[_0xeb7f('0x32')][_0xeb7f('0x52')](_0x40244d);})[_0xeb7f('0x27')](handleEntityNotFound(_0x5b9150,null))[_0xeb7f('0x27')](function(_0xefb913){if(_0xefb913){if(!_[_0xeb7f('0x6f')](_0xefb913[_0xeb7f('0x61')])){if(fs['existsSync'](path['join'](config[_0xeb7f('0x6b')],_0xeb7f('0x70'),_0xefb913[_0xeb7f('0x61')]))&&_0x266f3e){_0x4c8050=path[_0xeb7f('0x6a')](config['root'],_0xeb7f('0x70'),_0xefb913['sitepic']);}}return _0x5b9150[_0xeb7f('0x71')](_0x4c8050);}})['catch'](handleError(_0x5b9150,null));};exports['getAvatar']=function(_0x315b0f,_0x5a73c3){var _0x12bd56=path[_0xeb7f('0x6a')](config['root'],_0xeb7f('0x72'));var _0x489b1e={'where':{'id':_0x315b0f[_0xeb7f('0x53')]['id']},'attributes':['id',_0xeb7f('0x65')],'raw':!![]};return db['ChatWebsite']['find'](_0x489b1e)[_0xeb7f('0x27')](handleEntityNotFound(_0x5a73c3,null))['then'](function(_0x59fcbd){if(_0x59fcbd){if(!_[_0xeb7f('0x6f')](_0x59fcbd[_0xeb7f('0x65')])){if(fs[_0xeb7f('0x73')](path['join'](config[_0xeb7f('0x6b')],_0xeb7f('0x74'),_0x59fcbd[_0xeb7f('0x65')]))){_0x12bd56=path[_0xeb7f('0x6a')](config[_0xeb7f('0x6b')],_0xeb7f('0x74'),_0x59fcbd[_0xeb7f('0x65')]);}}return _0x5a73c3[_0xeb7f('0x71')](_0x12bd56);}})[_0xeb7f('0x1d')](handleError(_0x5a73c3,null));};exports[_0xeb7f('0x75')]=function(_0x390137,_0x39ff3b){var _0x4d9bf6=path[_0xeb7f('0x6a')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x16c239={'where':{'id':_0x390137[_0xeb7f('0x53')]['id']},'attributes':['id','customerAvatar',_0xeb7f('0x76')],'raw':!![]};return db[_0xeb7f('0x32')]['find'](_0x16c239)[_0xeb7f('0x27')](handleEntityNotFound(_0x39ff3b,null))[_0xeb7f('0x27')](function(_0x2da682){if(_0x2da682){if(!_[_0xeb7f('0x6f')](_0x2da682[_0xeb7f('0x67')])){if(fs[_0xeb7f('0x73')](path[_0xeb7f('0x6a')](config['root'],'server/files/images/avatars/',_0x2da682[_0xeb7f('0x67')]))&&_0x2da682[_0xeb7f('0x76')]){_0x4d9bf6=path[_0xeb7f('0x6a')](config[_0xeb7f('0x6b')],_0xeb7f('0x74'),_0x2da682['customerAvatar']);}}return _0x39ff3b[_0xeb7f('0x71')](_0x4d9bf6);}})['catch'](handleError(_0x39ff3b,null));};exports[_0xeb7f('0x77')]=function(_0x3fe991,_0x59345f){var _0x3d751e=path[_0xeb7f('0x6a')](config[_0xeb7f('0x6b')],_0xeb7f('0x78'));var _0x32c9be={'where':{'id':_0x3fe991[_0xeb7f('0x53')]['id']},'attributes':['id',_0xeb7f('0x68')],'raw':!![]};return db['ChatWebsite'][_0xeb7f('0x52')](_0x32c9be)[_0xeb7f('0x27')](handleEntityNotFound(_0x59345f,null))['then'](function(_0x363df4){if(_0x363df4){if(!_['isNil'](_0x363df4[_0xeb7f('0x68')])){if(fs[_0xeb7f('0x73')](path[_0xeb7f('0x6a')](config[_0xeb7f('0x6b')],_0xeb7f('0x74'),_0x363df4[_0xeb7f('0x68')]))){_0x3d751e=path[_0xeb7f('0x6a')](config[_0xeb7f('0x6b')],_0xeb7f('0x74'),_0x363df4[_0xeb7f('0x68')]);}}return _0x59345f[_0xeb7f('0x71')](_0x3d751e);}})[_0xeb7f('0x1d')](handleError(_0x59345f,null));};exports[_0xeb7f('0x79')]=function(_0x5c37f8,_0x33d579){var _0x129ade=require(_0xeb7f('0x7a'));var _0x5e90b6=new _0x129ade();var _0x2313d5=_0x5e90b6[_0xeb7f('0x7b')](_0x5c37f8[_0xeb7f('0x7c')][_0xeb7f('0x7d')])[_0xeb7f('0x7e')]();var _0x4e43de={'body':_0x5c37f8[_0xeb7f('0x51')],'channel':_0xeb7f('0x7f')};var _0x9de049=[];var _0x2b8f0e=[];var _0x397161={};var _0x460ef6=![];return db[_0xeb7f('0x80')]['describe']()[_0xeb7f('0x27')](function(_0x5cd80d){if(!_0x5cd80d){throw new db[(_0xeb7f('0x81'))]['ValidationError']('no\x20available\x20attributes');}_0x9de049=_[_0xeb7f('0x82')](_[_0xeb7f('0x4c')](_0x5cd80d),[_0xeb7f('0x83'),'updatedAt']);_0x2b8f0e=_[_0xeb7f('0x82')](_[_0xeb7f('0x4c')](_0x5cd80d),[_0xeb7f('0x83'),_0xeb7f('0x84'),'CompanyId',_0xeb7f('0x85')]);if(_0x5c37f8[_0xeb7f('0x51')]['id']){delete _0x5c37f8[_0xeb7f('0x51')]['id'];}if(_['isNil'](_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0x86')])){throw new db[(_0xeb7f('0x81'))][(_0xeb7f('0x87'))]('from\x20is\x20mandatory');}if(_[_0xeb7f('0x6f')](_0x5c37f8[_0xeb7f('0x51')]['body'])||_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0x51')]===''){throw new db[(_0xeb7f('0x81'))]['ValidationError'](_0xeb7f('0x88'));}if(_[_0xeb7f('0x6f')](_0x5c37f8[_0xeb7f('0x51')]['mapKey'])){throw new db[(_0xeb7f('0x81'))][(_0xeb7f('0x87'))](_0xeb7f('0x89')+_0x2b8f0e);}if(!_[_0xeb7f('0x8a')](_0x2b8f0e,_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0x8b')])){throw new db[(_0xeb7f('0x81'))][(_0xeb7f('0x87'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b8f0e);}_0x397161[_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0x8b')]]=_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0x86')];})[_0xeb7f('0x27')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x5c37f8[_0xeb7f('0x53')]['id']},'include':[{'model':db[_0xeb7f('0x8c')],'as':'List','include':[{'model':db[_0xeb7f('0x80')],'as':_0xeb7f('0x8d'),'where':_0x397161,'limit':0x1,'order':[[_0xeb7f('0x84'),_0xeb7f('0x8e')]]}]},{'model':db['ChatApplication'],'as':_0xeb7f('0x8f')}]});})[_0xeb7f('0x27')](handleEntityNotFound(_0x33d579,null))[_0xeb7f('0x27')](function(_0x40a7d0){if(_0x40a7d0&&_0x40a7d0[_0xeb7f('0x90')]){_0x4e43de['account']=_0x40a7d0;_0x4e43de[_0xeb7f('0x91')]=_0x40a7d0['Applications'];_0x4e43de[_0xeb7f('0x92')]=_0x40a7d0[_0xeb7f('0x90')];_0x4e43de[_0xeb7f('0x91')]=_[_0xeb7f('0x93')](_0x4e43de[_0xeb7f('0x91')],['priority'],[_0xeb7f('0x94')]);if(_0x4e43de[_0xeb7f('0x95')]['Applications']){delete _0x4e43de[_0xeb7f('0x95')]['Applications'];}if(_0x4e43de[_0xeb7f('0x95')]['List']&&_0x4e43de[_0xeb7f('0x95')][_0xeb7f('0x90')]['Contacts']['length']){return _0x4e43de[_0xeb7f('0x95')][_0xeb7f('0x90')][_0xeb7f('0x8d')][0x0];}var _0x4644ab=_[_0xeb7f('0x96')](_0x5c37f8[_0xeb7f('0x51')],{'firstName':_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0x86')],'ListId':_0x40a7d0[_0xeb7f('0x85')]});_0x4644ab[_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0x8b')]]=_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0x86')];return db['CmContact'][_0xeb7f('0x4e')](_0x4644ab,{'fields':_0x9de049,'raw':!![]});}})[_0xeb7f('0x27')](handleEntityNotFound(_0x33d579,null))['then'](function(_0x52ae28){_0x4e43de[_0xeb7f('0x97')]=_0x52ae28;var _0x4498e4=_0x5c37f8[_0xeb7f('0x51')]['customerIp'];if(_0x5c37f8[_0xeb7f('0x7c')][_0xeb7f('0x98')]){_0x4498e4=_0x5c37f8[_0xeb7f('0x7c')][_0xeb7f('0x98')];}else if(_0x5c37f8[_0xeb7f('0x7c')]['x-forwarded-for']){_0x4498e4=_['first'](_0x5c37f8[_0xeb7f('0x7c')][_0xeb7f('0x99')]['split'](','));}if(_0x52ae28){var _0x3185ac={'ContactId':_0x52ae28['id'],'ChatWebsiteId':_0x5c37f8[_0xeb7f('0x53')]['id'],'from':(_0x52ae28[_0xeb7f('0x9a')]||'')+'\x20'+(_0x52ae28[_0xeb7f('0x9b')]||''),'customerIp':_0x4498e4,'customerPort':_0x5c37f8[_0xeb7f('0x7c')][_0xeb7f('0x9c')]?_0x5c37f8['headers'][_0xeb7f('0x9c')]:null,'referer':_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0x9d')],'browserName':_0x2313d5[_0xeb7f('0x9e')][_0xeb7f('0x2d')]&&_0x2313d5['browser'][_0xeb7f('0x9f')]?util['format'](_0xeb7f('0xa0'),_0x2313d5['browser'][_0xeb7f('0x2d')],_0x2313d5[_0xeb7f('0x9e')][_0xeb7f('0x9f')]):'unknown','browserVersion':_0x2313d5[_0xeb7f('0x9e')]['version']||_0xeb7f('0xa1'),'osName':util[_0xeb7f('0xa2')]('%s\x20%s',_0x2313d5['os']['name'],_0x2313d5['os']['version']),'osVersion':_0x2313d5['os'][_0xeb7f('0x9f')],'deviceModel':_0x2313d5[_0xeb7f('0xa3')][_0xeb7f('0x37')]&&_0x2313d5[_0xeb7f('0xa3')]['vendor']?util[_0xeb7f('0xa2')](_0xeb7f('0xa4'),_0x2313d5['device']['model'],_0x2313d5[_0xeb7f('0xa3')][_0xeb7f('0xa5')],_0x2313d5[_0xeb7f('0xa3')][_0xeb7f('0x35')]):null,'deviceVendor':_0x2313d5[_0xeb7f('0xa3')][_0xeb7f('0xa5')],'deviceType':_0x2313d5['device'][_0xeb7f('0x35')],'formData':JSON['stringify'](_0x5c37f8[_0xeb7f('0x51')])};var _0x2b0a99={'ChatWebsiteId':_0x5c37f8['params']['id'],'closed':![]};if(_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0xa6')]){_0x2b0a99[_0xeb7f('0xa6')]=_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0xa6')];return db[_0xeb7f('0xa7')][_0xeb7f('0x52')]({'where':_0x2b0a99})[_0xeb7f('0x27')](function(_0x5a0404){if(_0x5a0404){return[_0x5a0404,![]];}_0x3185ac[_0xeb7f('0xa6')]=_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0xa6')];_0x3185ac[_0xeb7f('0xa8')]=_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0xa8')];return db['ChatInteraction'][_0xeb7f('0x4e')](_0x3185ac)[_0xeb7f('0x27')](function(_0x2e19b9){return[_0x2e19b9,!![]];});});}_0x2b0a99[_0xeb7f('0xa9')]=_0x52ae28['id'];if(_0x5c37f8['body'][_0xeb7f('0xaa')]&&_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0xaa')]['id']){_0x2b0a99['id']=_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0xaa')]['id'];return db[_0xeb7f('0xa7')][_0xeb7f('0x52')]({'where':_0x2b0a99})[_0xeb7f('0x27')](function(_0x459808){if(_0x459808){return[_0x459808,![]];}return db[_0xeb7f('0xa7')][_0xeb7f('0x4e')](_0x3185ac)[_0xeb7f('0x27')](function(_0x573f4e){return[_0x573f4e,!![]];});});}return db['ChatInteraction'][_0xeb7f('0x4e')](_0x3185ac)[_0xeb7f('0x27')](function(_0x486f6b){return[_0x486f6b,!![]];});}})[_0xeb7f('0xab')](function(_0x2ff796,_0x118318){if(_0x2ff796){_0x460ef6=_0x118318;if(!_0x118318){var _0x27c981={'from':(_0x4e43de['contact']['firstName']||'')+'\x20'+(_0x4e43de['contact']['lastName']||'')};if(_0x5c37f8[_0xeb7f('0x51')]['threadId']&&_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0xac')]&&_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0xa6')]!=_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0xac')]){_0x27c981[_0xeb7f('0xa6')]=_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0xac')];}return _0x2ff796['update'](_0x27c981);}else{return _0x2ff796;}}})[_0xeb7f('0x27')](function(_0x39b541){_0x4e43de[_0xeb7f('0xaa')]=_0x39b541['get']({'plain':!![]});_0x4e43de[_0xeb7f('0xaa')]['created']=_0x460ef6;if(_0x4e43de['interaction'][_0xeb7f('0xad')]){if(_0x4e43de['account'][_0xeb7f('0xae')]){_0x4e43de[_0xeb7f('0x91')][_0xeb7f('0xaf')]({'id':0x0,'priority':_0x4e43de['applications'][_0xeb7f('0x3e')]+0x1,'app':_0xeb7f('0xb0'),'appdata':_0xeb7f('0xb1'),'interval':_0xeb7f('0xb2')});}}return db[_0xeb7f('0xb3')]['create']({'body':_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0x51')],'ChatWebsiteId':_0x5c37f8[_0xeb7f('0x53')]['id'],'ChatInteractionId':_0x39b541['id'],'direction':'in','ContactId':_0x4e43de['contact']['id'],'AttachmentId':_0x5c37f8[_0xeb7f('0x51')][_0xeb7f('0xb4')]});})['then'](function(_0x20ed90){_0x4e43de[_0xeb7f('0x1a')]=_0x20ed90;if(_0x4e43de[_0xeb7f('0xaa')][_0xeb7f('0xb5')]){return db[_0xeb7f('0xb6')][_0xeb7f('0x52')]({'attributes':['id',_0xeb7f('0x2d')],'where':{'id':_0x4e43de[_0xeb7f('0xaa')][_0xeb7f('0xb5')]}})[_0xeb7f('0x27')](function(_0x198ee9){if(_0x198ee9){_0x4e43de[_0xeb7f('0x91')]['unshift']({'id':0x0,'priority':0x0,'app':_0xeb7f('0xb7'),'appdata':_0x198ee9[_0xeb7f('0x2d')]+','+(_0x4e43de['account'][_0xeb7f('0xb8')]||0xa),'interval':_0xeb7f('0xb2')});_0x4e43de[_0xeb7f('0xb9')]=!![];}return respondWithRpcPromise(_0xeb7f('0xba'),_0xeb7f('0xbb'),_0x4e43de);});}return respondWithRpcPromise(_0xeb7f('0xba'),_0xeb7f('0xbb'),_0x4e43de);})[_0xeb7f('0x27')](function(_0x58ad29){respondWithRpcPromise(_0xeb7f('0xbc'),_0xeb7f('0xbc'),{'event':_0xeb7f('0x79'),'message':_0x58ad29},client9002);return _0x58ad29;})[_0xeb7f('0x27')](respondWithResult(_0x33d579,null))[_0xeb7f('0x1d')](handleError(_0x33d579,null));};exports[_0xeb7f('0xbd')]=function(_0x301e80,_0x3d5409){var _0x327e62,_0x5613a3,_0x52e70f;var _0x24fe8d=[];var _0x1d8156={};var _0x4b3fd6=_0x301e80[_0xeb7f('0xbe')]||[];var _0x1ac248=[];var _0x3f7419;return db['CmContact'][_0xeb7f('0x54')]()['then'](function(_0xf712cd){if(!_0xf712cd){throw new db[(_0xeb7f('0x81'))][(_0xeb7f('0x87'))]('no\x20available\x20attributes');}_0x24fe8d=_[_0xeb7f('0x82')](_[_0xeb7f('0x4c')](_0xf712cd),[_0xeb7f('0x83'),_0xeb7f('0x84'),_0xeb7f('0xbf'),_0xeb7f('0x85')]);if(_0x301e80[_0xeb7f('0x51')]['id']){delete _0x301e80[_0xeb7f('0x51')]['id'];}if(_['isNil'](_0x301e80[_0xeb7f('0x51')][_0xeb7f('0x86')])){throw _0x3d5409[_0xeb7f('0x1e')](0x1f4)[_0xeb7f('0x2e')](new db[(_0xeb7f('0x81'))][(_0xeb7f('0x87'))]('from\x20is\x20mandatory'));}if(_[_0xeb7f('0x6f')](_0x301e80[_0xeb7f('0x51')][_0xeb7f('0x51')])||_0x301e80[_0xeb7f('0x51')][_0xeb7f('0x51')]===''){throw _0x3d5409['status'](0x1f4)[_0xeb7f('0x2e')](new db['Sequelize']['ValidationError'](_0xeb7f('0x88')));}if(_[_0xeb7f('0x6f')](_0x301e80['body']['mapKeyOffline'])){throw _0x3d5409[_0xeb7f('0x1e')](0x1f4)['send'](new db[(_0xeb7f('0x81'))][(_0xeb7f('0x87'))](_0xeb7f('0xc0')+_0x24fe8d));}if(!_['includes'](_0x24fe8d,_0x301e80[_0xeb7f('0x51')][_0xeb7f('0xc1')])){throw _0x3d5409[_0xeb7f('0x1e')](0x1f4)[_0xeb7f('0x2e')](new db[(_0xeb7f('0x81'))][(_0xeb7f('0x87'))](_0xeb7f('0xc2')+_0x24fe8d));}_0x1d8156[_0x301e80[_0xeb7f('0x51')][_0xeb7f('0xc1')]]=_0x301e80[_0xeb7f('0x51')][_0xeb7f('0x86')];})[_0xeb7f('0x27')](function(){return db[_0xeb7f('0x32')][_0xeb7f('0x52')]({'where':{'id':_0x301e80[_0xeb7f('0x53')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db['MailAccount'],'as':_0xeb7f('0xc3')}]});})[_0xeb7f('0x27')](handleEntityNotFound(_0x3d5409,null))[_0xeb7f('0x27')](function(_0x420fb7){if(_0x420fb7&&_0x420fb7[_0xeb7f('0x90')]){_0x5613a3=_0x420fb7;var _0x128630=_['defaults'](_0x301e80[_0xeb7f('0x51')],{'firstName':_0x301e80[_0xeb7f('0x51')][_0xeb7f('0x86')],'phone':_0x301e80[_0xeb7f('0x51')][_0xeb7f('0x86')],'ListId':_0x420fb7[_0xeb7f('0x85')]});_0x128630[_0x301e80['body'][_0xeb7f('0xc1')]]=_0x301e80[_0xeb7f('0x51')][_0xeb7f('0x86')];return db[_0xeb7f('0x80')][_0xeb7f('0xc4')]({'where':_0x1d8156,'defaults':_0x128630});}})[_0xeb7f('0xab')](function(_0x4ad9ff){if(_0x4ad9ff){_0x52e70f=_0x4ad9ff;var _0x3f4267=fs['readFileSync'](path[_0xeb7f('0x6a')](config[_0xeb7f('0x6b')],_0xeb7f('0xc5')),_0xeb7f('0xc6'));var _0x56196b=ejs['render'](_0x3f4267,{'body':_[_0xeb7f('0xc7')](_0x301e80[_0xeb7f('0x51')][_0xeb7f('0x51')]),'bodyTitle':_0x5613a3[_0xeb7f('0xc8')]});return db[_0xeb7f('0xc9')][_0xeb7f('0x4e')]({'body':_0x56196b,'plainBody':htmlToText[_0xeb7f('0xca')](_0x56196b),'ContactId':_0x4ad9ff['id'],'ChatWebsiteId':_0x5613a3['id']});}})[_0xeb7f('0x27')](function(_0x2000c2){_0x3f7419=_0x2000c2;if(_0x4b3fd6[_0xeb7f('0x3e')]){var _0x2f1581=_0x4b3fd6['map'](function(_0x5ec7b4){return{'name':_0x5ec7b4[_0xeb7f('0xcb')],'basename':_0x5ec7b4[_0xeb7f('0x63')],'type':_0x5ec7b4[_0xeb7f('0xcc')],'ChatOfflineMessageId':_0x2000c2['id']};});_0x1ac248=_0x2f1581[_0xeb7f('0x38')](_0x9cbc79=>{var _0xd6aa2a={'filename':_0x9cbc79[_0xeb7f('0x2d')],'path':path['join'](config[_0xeb7f('0x6b')],_0xeb7f('0xcd'),_0xeb7f('0xbe'),_0xeb7f('0xce'),_0xeb7f('0xcf'),_0x9cbc79[_0xeb7f('0xd0')])};return _0xd6aa2a;});if(!_0x5613a3['openNewInteraction']){return db['sequelize'][_0xeb7f('0xd1')](function(_0x12bbd8){return db[_0xeb7f('0xd2')][_0xeb7f('0xd3')](_0x2f1581,{'transaction':_0x12bbd8});});}}})[_0xeb7f('0x27')](function(){if(_0x3f7419){_0x327e62=_0x3f7419;return db[_0xeb7f('0xc3')][_0xeb7f('0x57')]({'where':{'service':!![]},'include':[{'model':db[_0xeb7f('0xd4')],'as':_0xeb7f('0xd5'),'raw':!![],'include':[{'model':db[_0xeb7f('0xd6')],'as':_0xeb7f('0xd6'),'raw':!![]}]}]});}})[_0xeb7f('0x27')](function(_0x5d9424){if(_0x5d9424&&_0x5d9424['Smtp']&&_0x5613a3[_0xeb7f('0xd7')]&&_0x5613a3['forwardOfflineAddress']){var _0x23cd28=_0x5d9424[_0xeb7f('0xd8')]();return respondWithRpcPromise(_0xeb7f('0xd9'),_0xeb7f('0xda'),{'account':_0x23cd28,'message':{'from':util[_0xeb7f('0xa2')]('\x22%s\x22\x20<%s>',_0x5d9424[_0xeb7f('0x2d')],_0x5d9424['email']||_0x5d9424[_0xeb7f('0xd5')][_0xeb7f('0x4f')]),'to':_0x5613a3[_0xeb7f('0xdb')],'subject':_0x5613a3['offlineMessageSubject'],'html':_0x327e62['body'],'attachments':_0x1ac248}},client9003)['then'](function(){return _0x327e62;})[_0xeb7f('0x1d')](function(_0xe5f6d5){logger[_0xeb7f('0x19')](_0xe5f6d5);});}})['then'](function(){if(_0x5613a3&&_0x5613a3['openNewInteraction']&&_0x5613a3['MailAccountId']){var _0xb7841b=[];if(_0x4b3fd6[_0xeb7f('0x3e')]){_0xb7841b=_0x4b3fd6[_0xeb7f('0x38')](function(_0x345f95){return{'name':_0x345f95[_0xeb7f('0xcb')],'basename':_0x345f95[_0xeb7f('0x63')],'type':_0x345f95[_0xeb7f('0xcc')],'ChatOfflineMessageId':_0x3f7419['id']};});}var _0x9e96c9;if(!_[_0xeb7f('0x6f')](_0x5613a3['subjectOffline'])){var _0x1a7400=_[_0xeb7f('0x38')](_0x301e80['body'],function(_0x23fa6a){return _0x23fa6a;});var _0x45a4eb=_[_0xeb7f('0xdc')](_0x1a7400)[0x0];var _0x40808d=_[_0xeb7f('0xdd')](_0x45a4eb,function(_0x236326){return _0x236326;});_0x9e96c9=_0x40808d[0x1][_0x5613a3[_0xeb7f('0xde')]];}var _0x232f2b={'from':_0x52e70f[_0xeb7f('0xdf')],'firstName':_0x52e70f[_0xeb7f('0x9a')],'lastName':_0x52e70f[_0xeb7f('0x9b')],'mapKey':_0xeb7f('0xdf'),'message':{'from':_0x52e70f[_0xeb7f('0xdf')],'to':_0x5613a3[_0xeb7f('0xc3')][_0xeb7f('0xdf')],'cc':'','subject':_['isNil'](_0x9e96c9)?_0x5613a3['offlineMessageSubject']:_0x9e96c9,'messageId':'','sentAt':new Date(),'attach':_0xb7841b['length'],'attachments':_0xb7841b,'originChannel':'Chat','ChatWebsiteId':_0x5613a3['id'],'ChatOfflineMessageId':_0x327e62['id'],'originTo':_0x5613a3[_0xeb7f('0xc3')]['email']},'body':_0x327e62['body']};var _0x503834={'account':{'id':_0x5613a3[_0xeb7f('0xe0')]},'body':_0x232f2b,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xeb7f('0xe1'),_0xeb7f('0xe2'),_0x503834,client9001)[_0xeb7f('0x27')](function(){return _0x327e62;})[_0xeb7f('0x1d')](function(_0x3c1ef0){logger['error'](_0x3c1ef0);});}return;})[_0xeb7f('0x27')](function(){if(_0x327e62){return _0x327e62;}})[_0xeb7f('0x27')](respondWithResult(_0x3d5409,null))[_0xeb7f('0x1d')](function(_0x2bd7dc){logger[_0xeb7f('0x19')](_0xeb7f('0x1d'),_0x2bd7dc);for(var _0x5a8d1f of _0x4b3fd6){var _0x3e490f=path[_0xeb7f('0x6a')](config[_0xeb7f('0x6b')],_0xeb7f('0xcd'),_0xeb7f('0xbe'),_0xeb7f('0xce'),'offline-chat',_0x5a8d1f[_0xeb7f('0x63')]);fs_extra['remove'](_0x3e490f)[_0xeb7f('0x1d')](function(_0x49d550){logger[_0xeb7f('0x19')](_0xeb7f('0xe3'),_0x3e490f,_0x49d550);});}});};exports['addInteraction']=function(_0x292177,_0x20bfae){return db['ChatInteraction'][_0xeb7f('0x52')]({'where':{'id':_0x292177[_0xeb7f('0x53')]['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x20bfae,null))[_0xeb7f('0x27')](function(_0x281994){if(_0x281994){return _0x281994[_0xeb7f('0xe4')](_0x292177['body']['ids'],_[_0xeb7f('0xe5')](_0x292177[_0xeb7f('0x51')],[_0xeb7f('0x5b'),'id'])||{});}})[_0xeb7f('0x27')](respondWithResult(_0x20bfae,null))['catch'](handleError(_0x20bfae,null));};exports['getInteractions']=function(_0x1591dd,_0x4f18ae){var _0x3a04b5={'raw':![],'where':{}};var _0x5b2d5b={};var _0x39b4e8={'count':0x0,'rows':[]};return db[_0xeb7f('0x32')]['findOne']({'where':{'id':_0x1591dd['params']['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x4f18ae,null))[_0xeb7f('0x27')](function(_0x23e0b8){if(_0x23e0b8){_0x5b2d5b['model']=_[_0xeb7f('0x4c')](db[_0xeb7f('0xa7')][_0xeb7f('0x33')]);_0x5b2d5b['query']=_[_0xeb7f('0x4c')](_0x1591dd['query']);_0x5b2d5b[_0xeb7f('0x3a')]=_[_0xeb7f('0x3b')](_0x5b2d5b['model'],_0x5b2d5b[_0xeb7f('0x39')]);_0x3a04b5[_0xeb7f('0x3c')]=_[_0xeb7f('0x3b')](_0x5b2d5b['model'],qs[_0xeb7f('0x3d')](_0x1591dd['query'][_0xeb7f('0x3d')]));_0x3a04b5[_0xeb7f('0x3c')]=_0x3a04b5[_0xeb7f('0x3c')][_0xeb7f('0x3e')]?_0x3a04b5[_0xeb7f('0x3c')]:_0x5b2d5b[_0xeb7f('0x37')];if(!_0x1591dd[_0xeb7f('0x39')][_0xeb7f('0x3f')](_0xeb7f('0x40'))){_0x3a04b5[_0xeb7f('0x20')]=qs[_0xeb7f('0x20')](_0x1591dd['query'][_0xeb7f('0x20')]);_0x3a04b5['offset']=qs[_0xeb7f('0x41')](_0x1591dd[_0xeb7f('0x39')][_0xeb7f('0x41')]);}_0x3a04b5['order']=qs[_0xeb7f('0x43')](_0x1591dd[_0xeb7f('0x39')][_0xeb7f('0x43')]);_0x3a04b5['where']=qs['filters'](_[_0xeb7f('0x45')](_0x1591dd[_0xeb7f('0x39')],_0x5b2d5b['filters']));_0x3a04b5['where'][_0xeb7f('0x56')]=_0x23e0b8['id'];if(_0x1591dd[_0xeb7f('0x39')][_0xeb7f('0x46')]){_0x3a04b5[_0xeb7f('0x44')]=_[_0xeb7f('0x47')](_0x3a04b5[_0xeb7f('0x44')],{'$or':_[_0xeb7f('0x38')](_0x3a04b5['attributes'],function(_0x13a1ca){var _0x31004c={};_0x31004c[_0x13a1ca]={'$like':'%'+_0x1591dd['query'][_0xeb7f('0x46')]+'%'};return _0x31004c;})});}_0x3a04b5=_[_0xeb7f('0x47')]({},_0x3a04b5,_0x1591dd[_0xeb7f('0x49')]);return db[_0xeb7f('0xa7')][_0xeb7f('0x22')]({'where':_0x3a04b5[_0xeb7f('0x44')]})['then'](function(_0x4929f9){_0x39b4e8[_0xeb7f('0x22')]=_0x4929f9;if(_0x1591dd[_0xeb7f('0x39')][_0xeb7f('0x4a')]){_0x3a04b5[_0xeb7f('0x4d')]=[{'model':db[_0xeb7f('0x80')],'as':_0xeb7f('0xe6'),'required':![]},{'model':db[_0xeb7f('0xb6')],'as':'Owner','attributes':[_0xeb7f('0x2d'),_0xeb7f('0xe7'),'internal'],'required':![]},{'model':db[_0xeb7f('0xe8')],'as':_0xeb7f('0xe9'),'attributes':['id',_0xeb7f('0x2d'),_0xeb7f('0xea')],'where':_0x1591dd[_0xeb7f('0x39')][_0xeb7f('0xeb')]?{'id':_0x1591dd[_0xeb7f('0x39')]['tag']}:undefined,'required':_0x1591dd['query'][_0xeb7f('0xeb')]?!![]:![]}];}return db[_0xeb7f('0xa7')][_0xeb7f('0x4b')](_0x3a04b5);})[_0xeb7f('0x27')](function(_0x400bbe){_0x39b4e8['rows']=_0x400bbe;return _0x39b4e8;});}})[_0xeb7f('0x27')](respondWithFilteredResult(_0x4f18ae,_0x3a04b5))[_0xeb7f('0x1d')](handleError(_0x4f18ae,null));};function iftimePromise(_0x3429ef,_0x27889e){return respondWithRpcPromise(_0xeb7f('0xec'),'getSnippet',{'command':_0x27889e[_0xeb7f('0xed')]?util[_0xeb7f('0xa2')](_0xeb7f('0xee'),_0x3429ef[_0xeb7f('0xef')],_0x27889e[_0xeb7f('0xed')]):util[_0xeb7f('0xa2')](_0xeb7f('0xf0'),_0x3429ef[_0xeb7f('0xef')])},client9002)['then'](function(_0x147f0f){var _0x39b73a=_0x147f0f&&_0x147f0f[_0xeb7f('0xf1')](_0xeb7f('0xf2'))>=0x0?!![]:![];logger[_0xeb7f('0x1b')](_0xeb7f('0xf3'),_0x27889e['id'],_0x3429ef['id'],_0x3429ef[_0xeb7f('0xef')],_0x39b73a?'ONLINE':_0xeb7f('0xf4'),_0x27889e[_0xeb7f('0xed')]?_0x27889e[_0xeb7f('0xed')]:'No\x20timezone');return _0x39b73a;})[_0xeb7f('0x1d')](function(_0x5d9281){logger[_0xeb7f('0x19')](_0xeb7f('0xf3'),_0x27889e['id'],_0x3429ef['id'],_0x3429ef[_0xeb7f('0xef')],util[_0xeb7f('0xf5')](_0x5d9281,{'showHidden':![],'depth':null}),_0x27889e['timezone']?_0x27889e['timezone']:_0xeb7f('0xf6'));return![];});}exports['getSnippet']=function(_0x331c66,_0x4209b3){var _0x33f47d=0x0;var _0x2cc5d0=0x0;var _0xb1137e=![];var _0x4fcc31;var _0x29e562;return db[_0xeb7f('0x32')]['find']({'where':{'id':_0x331c66['params']['id']},'include':[{'model':db[_0xeb7f('0xf7')],'as':_0xeb7f('0xf7'),'include':[{'model':db[_0xeb7f('0xf7')],'as':_0xeb7f('0xf8'),'attributes':['id',_0xeb7f('0xef')],'raw':!![]}]}]})[_0xeb7f('0x27')](handleEntityNotFound(_0x4209b3,null))[_0xeb7f('0x27')](function(_0x4c342c){if(_0x4c342c){_0x4fcc31=_0x4c342c;return _0x4c342c['getProactiveActions']({'raw':!![]});}})['then'](function(_0x38acf8){if(_0x4fcc31){if(_0x38acf8){_0x29e562=_0x38acf8;}}return require(_0xeb7f('0xf9'))[_0xeb7f('0x6d')]();})['then'](function(_0x13041d){if(_0x13041d){_0x2cc5d0=_0x13041d['virtual'];_0xb1137e=_0x13041d['custom'];}})[_0xeb7f('0x27')](function(){return db[_0xeb7f('0xa7')][_0xeb7f('0x22')]({'where':{'closed':![]}});})[_0xeb7f('0x27')](function(_0x264ed9){_0x33f47d=_0x264ed9;if(_0x2cc5d0&&_0x264ed9>_0x2cc5d0){return db[_0xeb7f('0xfa')][_0xeb7f('0x57')]({'where':{'id':0x1}})[_0xeb7f('0x27')](function(_0x5a6993){if(_0x5a6993){_0x5a6993[_0xeb7f('0xfb')]('chatLicenseExceeded');}});}})[_0xeb7f('0x27')](function(){if(_0x4fcc31[_0xeb7f('0xf7')]&&_0x4fcc31[_0xeb7f('0xf7')][_0xeb7f('0xf8')]){var _0x4600ca=[];for(var _0x3f7beb=0x0;_0x3f7beb<_0x4fcc31[_0xeb7f('0xf7')][_0xeb7f('0xf8')][_0xeb7f('0x3e')];_0x3f7beb++){var _0xc33e2f=_0x4fcc31[_0xeb7f('0xf7')]['Intervals'][_0x3f7beb]['get']({'plain':!![]});_0x4600ca[_0xeb7f('0xaf')](iftimePromise(_0xc33e2f,_0x4fcc31));}return BPromise['all'](_0x4600ca)['then'](function(_0x18fba9){return _[_0xeb7f('0xfc')](_0x18fba9);});}else{return!![];}})[_0xeb7f('0x27')](function(_0x40c970){var _0x127342=fs[_0xeb7f('0xfd')](path[_0xeb7f('0x6a')](config[_0xeb7f('0x6b')],_0xeb7f('0xfe')),_0xeb7f('0xc6'));var _0x5558a7={'remote':_0x4fcc31[_0xeb7f('0xff')],'query':querystring[_0xeb7f('0x18')](_[_0xeb7f('0x47')](_0x4fcc31['get']({'plain':!![]}),{'customerIp':_0x331c66['headers'][_0xeb7f('0x99')]||_0x331c66['headers'][_0xeb7f('0x100')]||_0x331c66['connection']['remoteAddress']||_0x331c66['ip'],'referer':_0x331c66['headers'][_0xeb7f('0x9d')],'openedInteractions':_0x33f47d,'maxInteractions':_0x2cc5d0,'virtual':_0xb1137e[_0xeb7f('0x101')],'online':_0x40c970,'custom':_0xb1137e}))[_0xeb7f('0x102')](/'/g,'\x5c\x27')};_0x4209b3[_0xeb7f('0x2e')](ejs['render'](Mustache[_0xeb7f('0x103')](_0x127342,_0x5558a7),{'proactiveActions':_0x29e562,'alignment':_0x4fcc31['alignment'],'verticalAlignment':_0x4fcc31[_0xeb7f('0x104')],'div_color':_0x4fcc31[_0xeb7f('0xea')],'labelText':_0x4fcc31[_0xeb7f('0x105')],'text_color':_0x4fcc31[_0xeb7f('0x106')],'text_button_color':_0x4fcc31[_0xeb7f('0x107')],'button_color':_0x4fcc31['color_button'],'background_color':_0x4fcc31[_0xeb7f('0x108')],'hideWhenOffline':_0x4fcc31[_0xeb7f('0x109')],'interval':_0x4fcc31[_0xeb7f('0x10a')]}));})['catch'](handleError(_0x4209b3,null));};exports[_0xeb7f('0x10b')]=function(_0x30aecf,_0xdbb8e3){var _0x2caacd=_0x30aecf[_0xeb7f('0x53')]['id'];var _0x292a6a=_0x30aecf[_0xeb7f('0x51')];var _0x2b08fb=0xc8;var _0x3d7483=null;return db[_0xeb7f('0x10c')][_0xeb7f('0xd1')]({'isolationLevel':db[_0xeb7f('0x10c')]['Transaction']['ISOLATION_LEVELS'][_0xeb7f('0x10d')]},function(_0x1eee7b){return db[_0xeb7f('0x32')]['findOne']({'where':{'id':_0x2caacd},'transaction':_0x1eee7b})[_0xeb7f('0x27')](function(_0x17ffa0){if(_0x17ffa0){return db[_0xeb7f('0x10e')][_0xeb7f('0x26')]({'where':{'ChatWebsiteId':_0x2caacd},'transaction':_0x1eee7b})[_0xeb7f('0x27')](function(){var _0x3fc279=_[_0xeb7f('0x38')](_0x292a6a,function(_0x4159c2){_0x4159c2[_0xeb7f('0x56')]=_0x2caacd;return _0x4159c2;});return db[_0xeb7f('0x10e')][_0xeb7f('0xd3')](_0x3fc279,{'transaction':_0x1eee7b});});}else{_0x2b08fb=0x194;_0x3d7483=[];}});})[_0xeb7f('0x27')](function(){if(_0x2b08fb!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x2caacd},'order':'priority'})['then'](function(_0x2cf22e){_0x3d7483=_0x2cf22e;});}})[_0xeb7f('0x1d')](function(_0x54a72f){_0x2b08fb=0x1f4;logger[_0xeb7f('0x19')](_0x54a72f[_0xeb7f('0x2c')]);if(_0x54a72f[_0xeb7f('0x2d')]){delete _0x54a72f[_0xeb7f('0x2d')];}_0x3d7483=_0x54a72f;})[_0xeb7f('0x10f')](function(){if(_0x3d7483===null){_0xdbb8e3[_0xeb7f('0x2b')](_0x2b08fb);}else{if(_0x2b08fb===0x1f4){_0xdbb8e3[_0xeb7f('0x1e')](_0x2b08fb)[_0xeb7f('0x2e')](_0x3d7483);}else{_0xdbb8e3[_0xeb7f('0x1e')](_0x2b08fb)[_0xeb7f('0x110')](_0x3d7483);}}});};exports[_0xeb7f('0x111')]=function(_0x736308,_0x29c111){var _0x2a8e64={};var _0x37b8d9={};var _0x38834c;var _0x15c0f0;return db[_0xeb7f('0x32')][_0xeb7f('0x57')]({'where':{'id':_0x736308[_0xeb7f('0x53')]['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x29c111,null))['then'](function(_0x42f0e3){if(_0x42f0e3){_0x38834c=_0x42f0e3;_0x37b8d9['model']=_['keys'](db[_0xeb7f('0x10e')][_0xeb7f('0x33')]);_0x37b8d9[_0xeb7f('0x39')]=_[_0xeb7f('0x4c')](_0x736308['query']);_0x37b8d9[_0xeb7f('0x3a')]=_[_0xeb7f('0x3b')](_0x37b8d9['model'],_0x37b8d9['query']);_0x2a8e64['attributes']=_[_0xeb7f('0x3b')](_0x37b8d9[_0xeb7f('0x37')],qs[_0xeb7f('0x3d')](_0x736308[_0xeb7f('0x39')]['fields']));_0x2a8e64[_0xeb7f('0x3c')]=_0x2a8e64[_0xeb7f('0x3c')][_0xeb7f('0x3e')]?_0x2a8e64[_0xeb7f('0x3c')]:_0x37b8d9[_0xeb7f('0x37')];_0x2a8e64[_0xeb7f('0x42')]=qs[_0xeb7f('0x43')](_0x736308[_0xeb7f('0x39')]['sort']);_0x2a8e64['where']=qs['filters'](_[_0xeb7f('0x45')](_0x736308['query'],_0x37b8d9['filters']));if(_0x736308[_0xeb7f('0x39')][_0xeb7f('0x46')]){_0x2a8e64[_0xeb7f('0x44')]=_['merge'](_0x2a8e64[_0xeb7f('0x44')],{'$or':_['map'](_0x2a8e64[_0xeb7f('0x3c')],function(_0x5ee57f){var _0x49f413={};_0x49f413[_0x5ee57f]={'$like':'%'+_0x736308[_0xeb7f('0x39')][_0xeb7f('0x46')]+'%'};return _0x49f413;})});}_0x2a8e64=_[_0xeb7f('0x47')]({},_0x2a8e64,_0x736308[_0xeb7f('0x49')]);return _0x38834c[_0xeb7f('0x111')](_0x2a8e64);}})[_0xeb7f('0x27')](function(_0x52a4cc){if(_0x52a4cc){_0x15c0f0=_0x52a4cc[_0xeb7f('0x3e')];if(!_0x736308[_0xeb7f('0x39')][_0xeb7f('0x3f')]('nolimit')){_0x2a8e64[_0xeb7f('0x20')]=qs[_0xeb7f('0x20')](_0x736308[_0xeb7f('0x39')][_0xeb7f('0x20')]);_0x2a8e64[_0xeb7f('0x41')]=qs['offset'](_0x736308['query']['offset']);}return _0x38834c[_0xeb7f('0x111')](_0x2a8e64);}})[_0xeb7f('0x27')](function(_0x517baf){if(_0x517baf){return _0x517baf?{'count':_0x15c0f0,'rows':_0x517baf}:null;}})['then'](respondWithResult(_0x29c111,null))['catch'](handleError(_0x29c111,null));};exports[_0xeb7f('0x112')]=function(_0x565981,_0x3584f9){return db[_0xeb7f('0x113')][_0xeb7f('0x52')]({'where':{'id':_0x565981[_0xeb7f('0x53')]['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x3584f9,null))[_0xeb7f('0x27')](function(_0x104323){if(_0x104323){return _0x104323['addProactiveActions'](_0x565981[_0xeb7f('0x51')][_0xeb7f('0x5b')],_[_0xeb7f('0xe5')](_0x565981[_0xeb7f('0x51')],[_0xeb7f('0x5b'),'id'])||{});}})[_0xeb7f('0x27')](respondWithResult(_0x3584f9,null))[_0xeb7f('0x1d')](handleError(_0x3584f9,null));};exports[_0xeb7f('0x114')]=function(_0x207606,_0x1f968b){var _0x2e441f={};var _0x10af24={};var _0x1a875a;var _0x4c0e51;return db[_0xeb7f('0x32')][_0xeb7f('0x57')]({'where':{'id':_0x207606['params']['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x1f968b,null))['then'](function(_0xfeea95){if(_0xfeea95){_0x1a875a=_0xfeea95;_0x10af24[_0xeb7f('0x37')]=_[_0xeb7f('0x4c')](db[_0xeb7f('0x115')]['rawAttributes']);_0x10af24[_0xeb7f('0x39')]=_[_0xeb7f('0x4c')](_0x207606['query']);_0x10af24['filters']=_['intersection'](_0x10af24[_0xeb7f('0x37')],_0x10af24[_0xeb7f('0x39')]);_0x2e441f[_0xeb7f('0x3c')]=_[_0xeb7f('0x3b')](_0x10af24[_0xeb7f('0x37')],qs[_0xeb7f('0x3d')](_0x207606[_0xeb7f('0x39')][_0xeb7f('0x3d')]));_0x2e441f[_0xeb7f('0x3c')]=_0x2e441f['attributes'][_0xeb7f('0x3e')]?_0x2e441f[_0xeb7f('0x3c')]:_0x10af24[_0xeb7f('0x37')];_0x2e441f[_0xeb7f('0x42')]=qs[_0xeb7f('0x43')](_0x207606[_0xeb7f('0x39')][_0xeb7f('0x43')]);_0x2e441f[_0xeb7f('0x44')]=qs['filters'](_[_0xeb7f('0x45')](_0x207606[_0xeb7f('0x39')],_0x10af24['filters']));if(_0x207606[_0xeb7f('0x39')][_0xeb7f('0x46')]){_0x2e441f[_0xeb7f('0x44')]=_[_0xeb7f('0x47')](_0x2e441f[_0xeb7f('0x44')],{'$or':_[_0xeb7f('0x38')](_0x2e441f[_0xeb7f('0x3c')],function(_0x293c3){var _0xe61810={};_0xe61810[_0x293c3]={'$like':'%'+_0x207606[_0xeb7f('0x39')][_0xeb7f('0x46')]+'%'};return _0xe61810;})});}_0x2e441f=_[_0xeb7f('0x47')]({},_0x2e441f,_0x207606[_0xeb7f('0x49')]);return _0x1a875a[_0xeb7f('0x114')](_0x2e441f);}})[_0xeb7f('0x27')](function(_0x27264c){if(_0x27264c){_0x4c0e51=_0x27264c[_0xeb7f('0x3e')];if(!_0x207606[_0xeb7f('0x39')][_0xeb7f('0x3f')](_0xeb7f('0x40'))){_0x2e441f['limit']=qs[_0xeb7f('0x20')](_0x207606[_0xeb7f('0x39')][_0xeb7f('0x20')]);_0x2e441f['offset']=qs[_0xeb7f('0x41')](_0x207606[_0xeb7f('0x39')][_0xeb7f('0x41')]);}return _0x1a875a[_0xeb7f('0x114')](_0x2e441f);}})[_0xeb7f('0x27')](function(_0x54f7de){if(_0x54f7de){return _0x54f7de?{'count':_0x4c0e51,'rows':_0x54f7de}:null;}})[_0xeb7f('0x27')](respondWithResult(_0x1f968b,null))[_0xeb7f('0x1d')](handleError(_0x1f968b,null));};exports[_0xeb7f('0x116')]=function(_0x1355dd,_0x250799){var _0x2d2cbc=_0x1355dd[_0xeb7f('0x39')][_0xeb7f('0x117')]===_0xeb7f('0x118')?_0xeb7f('0x119'):_0xeb7f('0x11a');return db[_0xeb7f('0x32')][_0xeb7f('0x52')]({'attributes':['id',_0x2d2cbc],'where':{'id':_0x1355dd[_0xeb7f('0x53')]['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x250799,null))[_0xeb7f('0x27')](function(_0x566ea7){if(_0x566ea7){var _0x5bbb7f=_0x566ea7[_0x2d2cbc];var _0x59bfdf=_0x5bbb7f&&_0x5bbb7f[_0xeb7f('0x11b')]?_0x5bbb7f[_0xeb7f('0x11b')]:[];_0x250799[_0xeb7f('0x2e')]({'fromKey':_[_0xeb7f('0x6f')](_0x5bbb7f[_0xeb7f('0x11c')])?undefined:_0x5bbb7f['fromKey'],'count':_0x59bfdf['length'],'rows':_0x59bfdf});}})[_0xeb7f('0x1d')](handleError(_0x250799,null));};exports[_0xeb7f('0x11d')]=function(_0x3b0eb4,_0x4007c8){var _0x1723e2={'raw':![],'where':{}};var _0x4b6b78={};var _0x40c86d={'count':0x0,'rows':[]};return db[_0xeb7f('0x32')]['findOne']({'where':{'id':_0x3b0eb4[_0xeb7f('0x53')]['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x4007c8,null))['then'](function(_0x285cda){if(_0x285cda){_0x4b6b78[_0xeb7f('0x37')]=_[_0xeb7f('0x4c')](db[_0xeb7f('0xc9')][_0xeb7f('0x33')]);_0x4b6b78[_0xeb7f('0x39')]=_[_0xeb7f('0x4c')](_0x3b0eb4['query']);_0x4b6b78[_0xeb7f('0x3a')]=_[_0xeb7f('0x3b')](_0x4b6b78['model'],_0x4b6b78['query']);_0x1723e2[_0xeb7f('0x3c')]=_[_0xeb7f('0x3b')](_0x4b6b78[_0xeb7f('0x37')],qs['fields'](_0x3b0eb4['query'][_0xeb7f('0x3d')]));_0x1723e2[_0xeb7f('0x3c')]=_0x1723e2[_0xeb7f('0x3c')][_0xeb7f('0x3e')]?_0x1723e2[_0xeb7f('0x3c')]:_0x4b6b78[_0xeb7f('0x37')];if(!_0x3b0eb4[_0xeb7f('0x39')][_0xeb7f('0x3f')]('nolimit')){_0x1723e2[_0xeb7f('0x20')]=qs['limit'](_0x3b0eb4['query'][_0xeb7f('0x20')]);_0x1723e2[_0xeb7f('0x41')]=qs['offset'](_0x3b0eb4['query'][_0xeb7f('0x41')]);}_0x1723e2[_0xeb7f('0x42')]=qs[_0xeb7f('0x43')](_0x3b0eb4['query'][_0xeb7f('0x43')]);_0x1723e2['where']=qs['filters'](_[_0xeb7f('0x45')](_0x3b0eb4[_0xeb7f('0x39')],_0x4b6b78['filters']));_0x1723e2[_0xeb7f('0x44')][_0xeb7f('0x56')]=_0x285cda['id'];if(_0x3b0eb4[_0xeb7f('0x39')][_0xeb7f('0x46')]){_0x1723e2['where']=_['merge'](_0x1723e2['where'],{'$or':_['map'](_0x1723e2['attributes'],function(_0x358b15){var _0x1cbbd1={};_0x1cbbd1[_0x358b15]={'$like':'%'+_0x3b0eb4[_0xeb7f('0x39')]['filter']+'%'};return _0x1cbbd1;})});}_0x1723e2=_[_0xeb7f('0x47')]({},_0x1723e2,_0x3b0eb4['options']);return db[_0xeb7f('0xc9')]['count']({'where':_0x1723e2['where']})[_0xeb7f('0x27')](function(_0x103649){_0x40c86d[_0xeb7f('0x22')]=_0x103649;if(_0x3b0eb4[_0xeb7f('0x39')][_0xeb7f('0x4a')]){_0x1723e2[_0xeb7f('0x4d')]=[{'all':!![]}];}else{_0x1723e2['include']=[{'model':db[_0xeb7f('0x80')],'as':_0xeb7f('0xe6'),'required':![]},{'model':db[_0xeb7f('0xd2')],'as':_0xeb7f('0x11e'),'required':![]}];}return db[_0xeb7f('0xc9')][_0xeb7f('0x4b')](_0x1723e2);})[_0xeb7f('0x27')](function(_0x168468){_0x40c86d['rows']=_0x168468;return _0x40c86d;});}})['then'](respondWithFilteredResult(_0x4007c8,_0x1723e2))[_0xeb7f('0x1d')](handleError(_0x4007c8,null));};exports['addAgents']=function(_0x5c0724,_0x3bd22a){return db['ChatWebsite']['find']({'where':{'id':_0x5c0724[_0xeb7f('0x53')]['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x3bd22a,null))['then'](function(_0x478a7c){if(_0x478a7c){return _0x478a7c['addAgents'](_0x5c0724[_0xeb7f('0x51')][_0xeb7f('0x5b')],_[_0xeb7f('0xe5')](_0x5c0724[_0xeb7f('0x51')],['ids','id'])||{})[_0xeb7f('0xab')](function(_0x145a84){for(var _0x10b4c6=0x0;_0x10b4c6<_0x5c0724['body'][_0xeb7f('0x5b')]['length'];_0x10b4c6+=0x1){socket['emit'](_0xeb7f('0x11f'),{'UserId':Number(_0x5c0724[_0xeb7f('0x51')]['ids'][_0x10b4c6]),'ChatWebsiteId':Number(_0x5c0724[_0xeb7f('0x53')]['id'])});}return _0x145a84;});}})[_0xeb7f('0x27')](respondWithResult(_0x3bd22a,null))[_0xeb7f('0x1d')](handleError(_0x3bd22a,null));};exports[_0xeb7f('0x120')]=function(_0xae14b0,_0x4f9193){return db[_0xeb7f('0x32')][_0xeb7f('0x52')]({'where':{'id':_0xae14b0[_0xeb7f('0x53')]['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x4f9193,null))[_0xeb7f('0x27')](function(_0x37e217){if(_0x37e217){return _0x37e217[_0xeb7f('0x120')](_0xae14b0[_0xeb7f('0x39')][_0xeb7f('0x5b')])[_0xeb7f('0x27')](function(){if(_[_0xeb7f('0x121')](_0xae14b0[_0xeb7f('0x39')][_0xeb7f('0x5b')])){for(var _0x164bec=0x0;_0x164bec<_0xae14b0[_0xeb7f('0x39')][_0xeb7f('0x5b')][_0xeb7f('0x3e')];_0x164bec+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0xae14b0[_0xeb7f('0x39')][_0xeb7f('0x5b')][_0x164bec]),'ChatWebsiteId':Number(_0xae14b0[_0xeb7f('0x53')]['id'])});}}else{socket[_0xeb7f('0x122')](_0xeb7f('0x123'),{'UserId':Number(_0xae14b0['query'][_0xeb7f('0x5b')]),'ChatWebsiteId':Number(_0xae14b0[_0xeb7f('0x53')]['id'])});}});}})[_0xeb7f('0x27')](respondWithStatusCode(_0x4f9193,null))['catch'](handleError(_0x4f9193,null));};exports[_0xeb7f('0x124')]=function(_0x460e7a,_0x37fcd9){var _0x5af561={};var _0x27805d={};var _0x3f42e8;var _0x20b0ae;return db[_0xeb7f('0x32')][_0xeb7f('0x57')]({'where':{'id':_0x460e7a[_0xeb7f('0x53')]['id']}})[_0xeb7f('0x27')](handleEntityNotFound(_0x37fcd9,null))['then'](function(_0x4f56a2){if(_0x4f56a2){_0x3f42e8=_0x4f56a2;_0x27805d[_0xeb7f('0x37')]=_[_0xeb7f('0x4c')](db[_0xeb7f('0xb6')][_0xeb7f('0x33')]);_0x27805d[_0xeb7f('0x39')]=_[_0xeb7f('0x4c')](_0x460e7a[_0xeb7f('0x39')]);_0x27805d['filters']=_[_0xeb7f('0x3b')](_0x27805d[_0xeb7f('0x37')],_0x27805d[_0xeb7f('0x39')]);_0x5af561[_0xeb7f('0x3c')]=_[_0xeb7f('0x3b')](_0x27805d[_0xeb7f('0x37')],qs[_0xeb7f('0x3d')](_0x460e7a[_0xeb7f('0x39')][_0xeb7f('0x3d')]));_0x5af561['attributes']=_0x5af561[_0xeb7f('0x3c')][_0xeb7f('0x3e')]?_0x5af561['attributes']:_0x27805d[_0xeb7f('0x37')];_0x5af561[_0xeb7f('0x42')]=qs[_0xeb7f('0x43')](_0x460e7a[_0xeb7f('0x39')][_0xeb7f('0x43')]);_0x5af561[_0xeb7f('0x44')]=qs['filters'](_[_0xeb7f('0x45')](_0x460e7a[_0xeb7f('0x39')],_0x27805d[_0xeb7f('0x3a')]));if(_0x460e7a[_0xeb7f('0x39')][_0xeb7f('0x46')]){_0x5af561['where']=_[_0xeb7f('0x47')](_0x5af561[_0xeb7f('0x44')],{'$or':_[_0xeb7f('0x38')](_0x5af561[_0xeb7f('0x3c')],function(_0x330955){var _0x1c931a={};_0x1c931a[_0x330955]={'$like':'%'+_0x460e7a[_0xeb7f('0x39')][_0xeb7f('0x46')]+'%'};return _0x1c931a;})});}_0x5af561=_['merge']({},_0x5af561,_0x460e7a[_0xeb7f('0x49')]);return _0x3f42e8[_0xeb7f('0x124')](_0x5af561);}})[_0xeb7f('0x27')](function(_0x5f207a){if(_0x5f207a){_0x20b0ae=_0x5f207a['length'];if(!_0x460e7a[_0xeb7f('0x39')][_0xeb7f('0x3f')]('nolimit')){_0x5af561[_0xeb7f('0x20')]=qs['limit'](_0x460e7a['query'][_0xeb7f('0x20')]);_0x5af561[_0xeb7f('0x41')]=qs[_0xeb7f('0x41')](_0x460e7a[_0xeb7f('0x39')][_0xeb7f('0x41')]);}return _0x3f42e8['getAgents'](_0x5af561);}})[_0xeb7f('0x27')](function(_0x3287b6){if(_0x3287b6){return _0x3287b6?{'count':_0x20b0ae,'rows':_0x3287b6}:null;}})[_0xeb7f('0x27')](respondWithResult(_0x37fcd9,null))[_0xeb7f('0x1d')](handleError(_0x37fcd9,null));}; \ No newline at end of file +var _0x0534=['mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','ChatOfflineMessage','originalname','server','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Owner','internal','Tag','color','tag','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','ONLINE','OFFLINE','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','No\x20timezone','getSnippet','Interval','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','referer','replace','render','alignment','verticalAlignment','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','omit','getProactiveActions','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','addAgents','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','emit','getAgents','mustache','util','path','ejs','fs-extra','querystring','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','html-to-text','http','client','request','then','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','info','request\x20sent','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','model','map','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','findOne','keys','sort','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','sitepic','file','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','filename','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','root','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','user-agent','chat','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','account','applications','list','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','%s\x20%s','unknown','format','vendor','%s\x20%s\x20%s','device','type','stringify','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','files','no\x20available\x20attributes','mapKeyOffline'];(function(_0x3e7591,_0x453bff){var _0x5172d8=function(_0x1c79f3){while(--_0x1c79f3){_0x3e7591['push'](_0x3e7591['shift']());}};_0x5172d8(++_0x453bff);}(_0x0534,0x196));var _0x4053=function(_0x562faa,_0x23adc7){_0x562faa=_0x562faa-0x0;var _0xc70f59=_0x0534[_0x562faa];return _0xc70f59;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x4053('0x0'));var util=require(_0x4053('0x1'));var path=require(_0x4053('0x2'));var ejs=require(_0x4053('0x3'));var fs=require('fs');var fs_extra=require(_0x4053('0x4'));var _=require('lodash');var querystring=require(_0x4053('0x5'));var Redis=require(_0x4053('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x4053('0x7'))('api');var config=require('../../config/environment');var db=require(_0x4053('0x8'))['db'];config[_0x4053('0x9')]=_[_0x4053('0xa')](config[_0x4053('0x9')],{'host':_0x4053('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4053('0x9')]));require(_0x4053('0xc'))[_0x4053('0xd')](socket);var htmlToText=require(_0x4053('0xe'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4053('0xf')]({'port':0x232c});var client9002=jayson[_0x4053('0x10')][_0x4053('0xf')]({'port':0x232a});var client9003=jayson['client'][_0x4053('0xf')]({'port':0x232b});var client9001=jayson['client'][_0x4053('0xf')]({'port':0x2329});function respondWithRpcPromise(_0x52151c,_0x72723,_0x391fb3,_0x49571e){return new BPromise(function(_0x489cb0,_0x18a719){var _0xf85755=_0x49571e||client;return _0xf85755[_0x4053('0x11')](_0x52151c,_0x391fb3)[_0x4053('0x12')](function(_0x5f747e){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x72723,'request\x20sent');logger[_0x4053('0x13')](_0x4053('0x14'),_0x72723,'request\x20sent',JSON['stringify'](_0x5f747e));if(_0x5f747e[_0x4053('0x15')]){if(_0x5f747e['error'][_0x4053('0x16')]===0x1f4){logger[_0x4053('0x15')](_0x4053('0x17'),_0x72723,_0x5f747e[_0x4053('0x15')][_0x4053('0x18')]);return _0x18a719(_0x5f747e['error'][_0x4053('0x18')]);}logger[_0x4053('0x15')](_0x4053('0x17'),_0x72723,_0x5f747e[_0x4053('0x15')][_0x4053('0x18')]);return _0x489cb0(_0x5f747e[_0x4053('0x15')][_0x4053('0x18')]);}else{logger[_0x4053('0x19')](_0x4053('0x17'),_0x72723,_0x4053('0x1a'));_0x489cb0(_0x5f747e['result']['message']);}})['catch'](function(_0x51ba0d){logger[_0x4053('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x72723,_0x51ba0d);_0x18a719(_0x51ba0d);});});}function respondWithStatusCode(_0x1dd150,_0x5e8ea5){_0x5e8ea5=_0x5e8ea5||0xcc;return function(_0x93371c){if(_0x93371c){return _0x1dd150[_0x4053('0x1b')](_0x5e8ea5);}return _0x1dd150[_0x4053('0x1c')](_0x5e8ea5)[_0x4053('0x1d')]();};}function respondWithResult(_0xea8eb6,_0x4adb40){_0x4adb40=_0x4adb40||0xc8;return function(_0xceae52){if(_0xceae52){return _0xea8eb6['status'](_0x4adb40)[_0x4053('0x1e')](_0xceae52);}};}function respondWithFilteredResult(_0x5d41a2,_0x268222){return function(_0x4b6a23){if(_0x4b6a23){var _0x491e0d=typeof _0x268222[_0x4053('0x1f')]===_0x4053('0x20')&&typeof _0x268222[_0x4053('0x21')]===_0x4053('0x20');var _0x2a4cbe=_0x4b6a23[_0x4053('0x22')];var _0x3cefe2=_0x491e0d?0x0:_0x268222[_0x4053('0x1f')];var _0x50dc7d=_0x491e0d?_0x4b6a23[_0x4053('0x22')]:_0x268222[_0x4053('0x1f')]+_0x268222[_0x4053('0x21')];var _0xbff3e0;if(_0x50dc7d>=_0x2a4cbe){_0x50dc7d=_0x2a4cbe;_0xbff3e0=0xc8;}else{_0xbff3e0=0xce;}_0x5d41a2['status'](_0xbff3e0);return _0x5d41a2[_0x4053('0x23')](_0x4053('0x24'),_0x3cefe2+'-'+_0x50dc7d+'/'+_0x2a4cbe)[_0x4053('0x1e')](_0x4b6a23);}return null;};}function saveUpdates(_0x4b0e41){return function(_0x3398e5){if(_0x3398e5){return _0x3398e5[_0x4053('0x25')](_0x4b0e41)[_0x4053('0x12')](function(_0x14d203){return _0x14d203;});}return null;};}function removeEntity(_0x48a0d6){return function(_0x51aafa){if(_0x51aafa){return _0x51aafa[_0x4053('0x26')]()[_0x4053('0x12')](function(){var _0x1c544c=_0x51aafa[_0x4053('0x27')]({'plain':!![]});var _0x3f6d3d='ChatWebsites';return db[_0x4053('0x28')]['destroy']({'where':{'type':_0x3f6d3d,'resourceId':_0x1c544c['id']}})[_0x4053('0x12')](function(){return _0x51aafa;});})[_0x4053('0x12')](function(){_0x48a0d6['status'](0xcc)[_0x4053('0x1d')]();});}};}function handleEntityNotFound(_0x50dd25){return function(_0x1b5001){if(!_0x1b5001){_0x50dd25[_0x4053('0x1b')](0x194);}return _0x1b5001;};}function handleError(_0x4aa2d6,_0x407304){_0x407304=_0x407304||0x1f4;return function(_0x5538e3){logger['error'](_0x5538e3['stack']);if(_0x5538e3[_0x4053('0x29')]){delete _0x5538e3[_0x4053('0x29')];}_0x4aa2d6[_0x4053('0x1c')](_0x407304)[_0x4053('0x2a')](_0x5538e3);};}exports[_0x4053('0x2b')]=function(_0x59b152,_0x555b3a){var _0x3f29d2={'include':[{'model':db[_0x4053('0x2c')],'as':_0x4053('0x2d')}]},_0x5c0c8c={},_0x3d9d0b={'count':0x0,'rows':[]};var _0x4cf6a9=_['map'](db[_0x4053('0x2e')][_0x4053('0x2f')],function(_0x18e119){return{'name':_0x18e119[_0x4053('0x30')],'type':_0x18e119['type']['key']};});_0x5c0c8c[_0x4053('0x31')]=_[_0x4053('0x32')](_0x4cf6a9,_0x4053('0x29'));_0x5c0c8c[_0x4053('0x33')]=_['keys'](_0x59b152[_0x4053('0x33')]);_0x5c0c8c['filters']=_['intersection'](_0x5c0c8c[_0x4053('0x31')],_0x5c0c8c['query']);_0x3f29d2[_0x4053('0x34')]=_[_0x4053('0x35')](_0x5c0c8c['model'],qs[_0x4053('0x36')](_0x59b152['query'][_0x4053('0x36')]));_0x3f29d2[_0x4053('0x34')]=_0x3f29d2[_0x4053('0x34')]['length']?_0x3f29d2['attributes']:_0x5c0c8c[_0x4053('0x31')];if(!_0x59b152[_0x4053('0x33')][_0x4053('0x37')](_0x4053('0x38'))){_0x3f29d2[_0x4053('0x21')]=qs[_0x4053('0x21')](_0x59b152[_0x4053('0x33')][_0x4053('0x21')]);_0x3f29d2[_0x4053('0x1f')]=qs[_0x4053('0x1f')](_0x59b152[_0x4053('0x33')][_0x4053('0x1f')]);}_0x3f29d2[_0x4053('0x39')]=qs['sort'](_0x59b152[_0x4053('0x33')]['sort']);_0x3f29d2[_0x4053('0x3a')]=qs[_0x4053('0x3b')](_[_0x4053('0x3c')](_0x59b152[_0x4053('0x33')],_0x5c0c8c[_0x4053('0x3b')]),_0x4cf6a9);if(_0x59b152[_0x4053('0x33')][_0x4053('0x3d')]){_0x3f29d2[_0x4053('0x3a')]=_[_0x4053('0x3e')](_0x3f29d2[_0x4053('0x3a')],{'$or':_[_0x4053('0x32')](_0x4cf6a9,function(_0x323647){if(_0x323647['type']!==_0x4053('0x3f')){var _0x1d05fe={};_0x1d05fe[_0x323647[_0x4053('0x29')]]={'$like':'%'+_0x59b152['query']['filter']+'%'};return _0x1d05fe;}})});}_0x3f29d2=_[_0x4053('0x3e')]({},_0x3f29d2,_0x59b152[_0x4053('0x40')]);var _0x3060a2={'where':_0x3f29d2[_0x4053('0x3a')]};return db[_0x4053('0x2e')][_0x4053('0x22')](_0x3060a2)['then'](function(_0x56b56b){_0x3d9d0b['count']=_0x56b56b;if(_0x59b152[_0x4053('0x33')]['includeAll']){_0x3f29d2[_0x4053('0x41')]=[{'all':!![]}];}return db[_0x4053('0x2e')][_0x4053('0x42')](_0x3f29d2);})[_0x4053('0x12')](function(_0x17a5f3){_0x3d9d0b[_0x4053('0x43')]=_0x17a5f3;return _0x3d9d0b;})['then'](respondWithFilteredResult(_0x555b3a,_0x3f29d2))[_0x4053('0x44')](handleError(_0x555b3a,null));};exports[_0x4053('0x45')]=function(_0x2e18ca,_0x121143){var _0x445c49={'raw':![],'where':{'id':_0x2e18ca[_0x4053('0x46')]['id']},'include':[{'model':db[_0x4053('0x2c')],'as':_0x4053('0x2d')}]},_0x3963a3={};_0x3963a3['model']=_['keys'](db[_0x4053('0x2e')][_0x4053('0x2f')]);_0x3963a3[_0x4053('0x33')]=_['keys'](_0x2e18ca[_0x4053('0x33')]);_0x3963a3[_0x4053('0x3b')]=_['intersection'](_0x3963a3['model'],_0x3963a3['query']);_0x445c49[_0x4053('0x34')]=_[_0x4053('0x35')](_0x3963a3[_0x4053('0x31')],qs[_0x4053('0x36')](_0x2e18ca[_0x4053('0x33')][_0x4053('0x36')]));_0x445c49['attributes']=_0x445c49[_0x4053('0x34')][_0x4053('0x47')]?_0x445c49[_0x4053('0x34')]:_0x3963a3[_0x4053('0x31')];if(_0x2e18ca[_0x4053('0x33')][_0x4053('0x48')]){_0x445c49[_0x4053('0x41')]=[{'all':!![]}];}_0x445c49=_[_0x4053('0x3e')]({},_0x445c49,_0x2e18ca[_0x4053('0x40')]);return db[_0x4053('0x2e')][_0x4053('0x49')](_0x445c49)[_0x4053('0x12')](handleEntityNotFound(_0x121143,null))[_0x4053('0x12')](respondWithResult(_0x121143,null))[_0x4053('0x44')](handleError(_0x121143,null));};exports[_0x4053('0x4a')]=function(_0x17cd56,_0x2b724c){return db[_0x4053('0x2e')][_0x4053('0x4a')](_0x17cd56[_0x4053('0x4b')],{})[_0x4053('0x12')](function(_0x3ad8c6){var _0x3d13dc=_0x17cd56[_0x4053('0x4c')][_0x4053('0x27')]({'plain':!![]});if(!_0x3d13dc)throw new Error(_0x4053('0x4d'));if(_0x3d13dc[_0x4053('0x4e')]===_0x4053('0x4c')){var _0x191509=_0x3ad8c6[_0x4053('0x27')]({'plain':!![]});var _0x16bab4=_0x4053('0x4f');return db[_0x4053('0x50')]['find']({'where':{'name':_0x16bab4,'userProfileId':_0x3d13dc[_0x4053('0x51')]},'raw':!![]})[_0x4053('0x12')](function(_0x2b3726){if(_0x2b3726&&_0x2b3726[_0x4053('0x52')]===0x0){return db[_0x4053('0x28')]['create']({'name':_0x191509[_0x4053('0x29')],'resourceId':_0x191509['id'],'type':_0x2b3726[_0x4053('0x29')],'sectionId':_0x2b3726['id']},{})[_0x4053('0x12')](function(){return _0x3ad8c6;});}else{return _0x3ad8c6;}})[_0x4053('0x44')](function(_0x55c2cc){logger[_0x4053('0x15')](_0x4053('0x53'),_0x55c2cc);throw _0x55c2cc;});}return _0x3ad8c6;})['then'](respondWithResult(_0x2b724c,0xc9))[_0x4053('0x44')](handleError(_0x2b724c,null));};exports['update']=function(_0x398b21,_0x33269a){if(_0x398b21[_0x4053('0x4b')]['id']){delete _0x398b21[_0x4053('0x4b')]['id'];}return db[_0x4053('0x2e')][_0x4053('0x49')]({'where':{'id':_0x398b21[_0x4053('0x46')]['id']},'include':[{'model':db[_0x4053('0x2c')],'as':_0x4053('0x2d')}]})[_0x4053('0x12')](handleEntityNotFound(_0x33269a,null))[_0x4053('0x12')](saveUpdates(_0x398b21[_0x4053('0x4b')],null))['then'](respondWithResult(_0x33269a,null))[_0x4053('0x44')](handleError(_0x33269a,null));};exports[_0x4053('0x26')]=function(_0x3c68ed,_0x52ef23){return db[_0x4053('0x2e')][_0x4053('0x49')]({'where':{'id':_0x3c68ed['params']['id']}})['then'](handleEntityNotFound(_0x52ef23,null))[_0x4053('0x12')](removeEntity(_0x52ef23,null))['catch'](handleError(_0x52ef23,null));};exports[_0x4053('0x54')]=function(_0x3ff130,_0x560a8d){return db['ChatWebsite'][_0x4053('0x54')]()[_0x4053('0x12')](respondWithResult(_0x560a8d,null))['catch'](handleError(_0x560a8d,null));};exports[_0x4053('0x55')]=function(_0x1b12b8,_0x286c78){if(_0x1b12b8['body']['id']){delete _0x1b12b8[_0x4053('0x4b')]['id'];}return db['ChatWebsite'][_0x4053('0x49')]({'where':{'id':_0x1b12b8[_0x4053('0x46')]['id']}})[_0x4053('0x12')](handleEntityNotFound(_0x286c78,null))[_0x4053('0x12')](function(_0x232ba3){if(_0x232ba3){_0x1b12b8[_0x4053('0x4b')][_0x4053('0x56')]=_0x232ba3['id'];return db[_0x4053('0x57')][_0x4053('0x4a')](_0x1b12b8['body']);}})[_0x4053('0x12')](respondWithResult(_0x286c78,null))[_0x4053('0x44')](handleError(_0x286c78,null));};exports['getDispositions']=function(_0x21aa0a,_0x1bedea){var _0x5b257d={'raw':![],'where':{}};var _0x88e56d={};var _0x594387={'count':0x0,'rows':[]};return db[_0x4053('0x2e')][_0x4053('0x58')]({'where':{'id':_0x21aa0a[_0x4053('0x46')]['id']}})['then'](handleEntityNotFound(_0x1bedea,null))[_0x4053('0x12')](function(_0xc412bd){if(_0xc412bd){_0x88e56d[_0x4053('0x31')]=_[_0x4053('0x59')](db[_0x4053('0x57')]['rawAttributes']);_0x88e56d['query']=_[_0x4053('0x59')](_0x21aa0a[_0x4053('0x33')]);_0x88e56d[_0x4053('0x3b')]=_[_0x4053('0x35')](_0x88e56d['model'],_0x88e56d[_0x4053('0x33')]);_0x5b257d[_0x4053('0x34')]=_[_0x4053('0x35')](_0x88e56d[_0x4053('0x31')],qs[_0x4053('0x36')](_0x21aa0a[_0x4053('0x33')][_0x4053('0x36')]));_0x5b257d['attributes']=_0x5b257d[_0x4053('0x34')][_0x4053('0x47')]?_0x5b257d[_0x4053('0x34')]:_0x88e56d[_0x4053('0x31')];if(!_0x21aa0a[_0x4053('0x33')][_0x4053('0x37')](_0x4053('0x38'))){_0x5b257d[_0x4053('0x21')]=qs[_0x4053('0x21')](_0x21aa0a[_0x4053('0x33')][_0x4053('0x21')]);_0x5b257d[_0x4053('0x1f')]=qs[_0x4053('0x1f')](_0x21aa0a[_0x4053('0x33')][_0x4053('0x1f')]);}_0x5b257d[_0x4053('0x39')]=qs[_0x4053('0x5a')](_0x21aa0a['query'][_0x4053('0x5a')]);_0x5b257d[_0x4053('0x3a')]=qs[_0x4053('0x3b')](_[_0x4053('0x3c')](_0x21aa0a[_0x4053('0x33')],_0x88e56d[_0x4053('0x3b')]));_0x5b257d[_0x4053('0x3a')][_0x4053('0x56')]=_0xc412bd['id'];if(_0x21aa0a['query']['filter']){_0x5b257d['where']=_[_0x4053('0x3e')](_0x5b257d[_0x4053('0x3a')],{'$or':_['map'](_0x5b257d[_0x4053('0x34')],function(_0x30ecbd){var _0x8bf7a5={};_0x8bf7a5[_0x30ecbd]={'$like':'%'+_0x21aa0a[_0x4053('0x33')][_0x4053('0x3d')]+'%'};return _0x8bf7a5;})});}_0x5b257d=_[_0x4053('0x3e')]({},_0x5b257d,_0x21aa0a[_0x4053('0x40')]);return db[_0x4053('0x57')][_0x4053('0x22')]({'where':_0x5b257d[_0x4053('0x3a')]})['then'](function(_0xcb2177){_0x594387[_0x4053('0x22')]=_0xcb2177;if(_0x21aa0a[_0x4053('0x33')]['includeAll']){_0x5b257d[_0x4053('0x41')]=[{'all':!![]}];}return db[_0x4053('0x57')][_0x4053('0x42')](_0x5b257d);})['then'](function(_0x4983dc){_0x594387[_0x4053('0x43')]=_0x4983dc;return _0x594387;});}})[_0x4053('0x12')](respondWithFilteredResult(_0x1bedea,_0x5b257d))[_0x4053('0x44')](handleError(_0x1bedea,null));};exports['removeDispositions']=function(_0x4d5629,_0x217c6a){return db['ChatWebsite']['find']({'where':{'id':_0x4d5629['params']['id']}})[_0x4053('0x12')](handleEntityNotFound(_0x217c6a,null))[_0x4053('0x12')](function(_0x264ff7){if(_0x264ff7){return _0x264ff7[_0x4053('0x5b')](_0x4d5629[_0x4053('0x33')][_0x4053('0x5c')]);}})[_0x4053('0x12')](respondWithStatusCode(_0x217c6a,null))[_0x4053('0x44')](handleError(_0x217c6a,null));};exports['addAnswer']=function(_0x5ed230,_0x44ac1d){if(_0x5ed230[_0x4053('0x4b')]['id']){delete _0x5ed230[_0x4053('0x4b')]['id'];}return db[_0x4053('0x2e')][_0x4053('0x49')]({'where':{'id':_0x5ed230[_0x4053('0x46')]['id']}})[_0x4053('0x12')](handleEntityNotFound(_0x44ac1d,null))[_0x4053('0x12')](function(_0x215f9d){if(_0x215f9d){_0x5ed230['body'][_0x4053('0x56')]=_0x215f9d['id'];return db[_0x4053('0x5d')][_0x4053('0x4a')](_0x5ed230[_0x4053('0x4b')]);}})[_0x4053('0x12')](respondWithResult(_0x44ac1d,null))[_0x4053('0x44')](handleError(_0x44ac1d,null));};exports[_0x4053('0x5e')]=function(_0x46654a,_0xff949e){var _0x35406f={'raw':![],'where':{}};var _0x14f766={};var _0x24d64b={'count':0x0,'rows':[]};return db[_0x4053('0x2e')]['findOne']({'where':{'id':_0x46654a[_0x4053('0x46')]['id']}})[_0x4053('0x12')](handleEntityNotFound(_0xff949e,null))[_0x4053('0x12')](function(_0x10003a){if(_0x10003a){_0x14f766[_0x4053('0x31')]=_[_0x4053('0x59')](db[_0x4053('0x5d')][_0x4053('0x2f')]);_0x14f766['query']=_[_0x4053('0x59')](_0x46654a[_0x4053('0x33')]);_0x14f766['filters']=_['intersection'](_0x14f766[_0x4053('0x31')],_0x14f766[_0x4053('0x33')]);_0x35406f[_0x4053('0x34')]=_[_0x4053('0x35')](_0x14f766['model'],qs[_0x4053('0x36')](_0x46654a[_0x4053('0x33')][_0x4053('0x36')]));_0x35406f[_0x4053('0x34')]=_0x35406f['attributes'][_0x4053('0x47')]?_0x35406f['attributes']:_0x14f766['model'];if(!_0x46654a[_0x4053('0x33')]['hasOwnProperty'](_0x4053('0x38'))){_0x35406f[_0x4053('0x21')]=qs['limit'](_0x46654a[_0x4053('0x33')][_0x4053('0x21')]);_0x35406f[_0x4053('0x1f')]=qs[_0x4053('0x1f')](_0x46654a[_0x4053('0x33')][_0x4053('0x1f')]);}_0x35406f[_0x4053('0x39')]=qs[_0x4053('0x5a')](_0x46654a[_0x4053('0x33')][_0x4053('0x5a')]);_0x35406f[_0x4053('0x3a')]=qs[_0x4053('0x3b')](_[_0x4053('0x3c')](_0x46654a['query'],_0x14f766[_0x4053('0x3b')]));_0x35406f[_0x4053('0x3a')][_0x4053('0x56')]=_0x10003a['id'];if(_0x46654a[_0x4053('0x33')][_0x4053('0x3d')]){_0x35406f[_0x4053('0x3a')]=_[_0x4053('0x3e')](_0x35406f[_0x4053('0x3a')],{'$or':_[_0x4053('0x32')](_0x35406f['attributes'],function(_0x4854e0){var _0x1164c4={};_0x1164c4[_0x4854e0]={'$like':'%'+_0x46654a['query'][_0x4053('0x3d')]+'%'};return _0x1164c4;})});}_0x35406f=_['merge']({},_0x35406f,_0x46654a[_0x4053('0x40')]);return db[_0x4053('0x5d')][_0x4053('0x22')]({'where':_0x35406f[_0x4053('0x3a')]})[_0x4053('0x12')](function(_0x832ac2){_0x24d64b[_0x4053('0x22')]=_0x832ac2;if(_0x46654a[_0x4053('0x33')][_0x4053('0x48')]){_0x35406f[_0x4053('0x41')]=[{'all':!![]}];}return db[_0x4053('0x5d')][_0x4053('0x42')](_0x35406f);})['then'](function(_0x25c26e){_0x24d64b[_0x4053('0x43')]=_0x25c26e;return _0x24d64b;});}})['then'](respondWithFilteredResult(_0xff949e,_0x35406f))[_0x4053('0x44')](handleError(_0xff949e,null));};exports[_0x4053('0x5f')]=function(_0x104688,_0xcd4f65){return db['ChatWebsite'][_0x4053('0x49')]({'where':{'id':_0x104688[_0x4053('0x46')]['id']}})[_0x4053('0x12')](handleEntityNotFound(_0xcd4f65,null))[_0x4053('0x12')](function(_0x4ec181){if(_0x4ec181){return _0x4ec181[_0x4053('0x5f')](_0x104688[_0x4053('0x33')]['ids']);}})[_0x4053('0x12')](respondWithStatusCode(_0xcd4f65,null))['catch'](handleError(_0xcd4f65,null));};exports['addLogo']=function(_0x1993bf,_0x3a4350){_0x1993bf[_0x4053('0x4b')][_0x4053('0x60')]=_0x1993bf[_0x4053('0x61')]['filename'];return db[_0x4053('0x2e')][_0x4053('0x49')]({'where':{'id':_0x1993bf[_0x4053('0x46')]['id']}})[_0x4053('0x12')](handleEntityNotFound(_0x3a4350,null))[_0x4053('0x12')](saveUpdates(_0x1993bf[_0x4053('0x4b')],null))[_0x4053('0x12')](respondWithResult(_0x3a4350,null))[_0x4053('0x44')](handleError(_0x3a4350,null));};exports[_0x4053('0x62')]=function(_0x352731,_0x45af2b){_0x352731['body'][_0x4053('0x63')]=_0x352731['file']['filename'];return db[_0x4053('0x2e')][_0x4053('0x49')]({'where':{'id':_0x352731['params']['id']}})[_0x4053('0x12')](handleEntityNotFound(_0x45af2b,null))[_0x4053('0x12')](saveUpdates(_0x352731[_0x4053('0x4b')],null))[_0x4053('0x12')](respondWithResult(_0x45af2b,null))[_0x4053('0x44')](handleError(_0x45af2b,null));};exports[_0x4053('0x64')]=function(_0x1713ba,_0x2792bd){_0x1713ba[_0x4053('0x4b')][_0x4053('0x65')]=_0x1713ba[_0x4053('0x61')]['filename'];return db[_0x4053('0x2e')][_0x4053('0x49')]({'where':{'id':_0x1713ba[_0x4053('0x46')]['id']}})[_0x4053('0x12')](handleEntityNotFound(_0x2792bd,null))['then'](saveUpdates(_0x1713ba[_0x4053('0x4b')],null))[_0x4053('0x12')](respondWithResult(_0x2792bd,null))[_0x4053('0x44')](handleError(_0x2792bd,null));};exports[_0x4053('0x66')]=function(_0x5cbecd,_0x48d48c){_0x5cbecd['body'][_0x4053('0x67')]=_0x5cbecd[_0x4053('0x61')][_0x4053('0x68')];return db['ChatWebsite']['find']({'where':{'id':_0x5cbecd[_0x4053('0x46')]['id']}})[_0x4053('0x12')](handleEntityNotFound(_0x48d48c,null))[_0x4053('0x12')](saveUpdates(_0x5cbecd[_0x4053('0x4b')],null))[_0x4053('0x12')](respondWithResult(_0x48d48c,null))[_0x4053('0x44')](handleError(_0x48d48c,null));};exports[_0x4053('0x69')]=function(_0x5e4549,_0x5cea37){var _0x415323=path[_0x4053('0x6a')](config['root'],_0x4053('0x6b'));var _0x2d2746={'where':{'id':_0x5e4549[_0x4053('0x46')]['id']},'attributes':['id',_0x4053('0x60')],'raw':!![]};var _0x1e407d=![];return require(_0x4053('0x6c'))[_0x4053('0x6d')]()[_0x4053('0x12')](function(_0x454f9a){if(_0x454f9a){_0x1e407d=_0x454f9a[_0x4053('0x6e')];}})[_0x4053('0x12')](function(){return db[_0x4053('0x2e')][_0x4053('0x49')](_0x2d2746);})[_0x4053('0x12')](handleEntityNotFound(_0x5cea37,null))[_0x4053('0x12')](function(_0x5f22ce){if(_0x5f22ce){if(!_[_0x4053('0x6f')](_0x5f22ce[_0x4053('0x60')])){if(fs[_0x4053('0x70')](path[_0x4053('0x6a')](config['root'],_0x4053('0x71'),_0x5f22ce[_0x4053('0x60')]))&&_0x1e407d){_0x415323=path[_0x4053('0x6a')](config[_0x4053('0x72')],_0x4053('0x71'),_0x5f22ce[_0x4053('0x60')]);}}return _0x5cea37[_0x4053('0x73')](_0x415323);}})[_0x4053('0x44')](handleError(_0x5cea37,null));};exports[_0x4053('0x74')]=function(_0x35d63b,_0x1dc222){var _0x3984b6=path[_0x4053('0x6a')](config[_0x4053('0x72')],_0x4053('0x75'));var _0x523f3a={'where':{'id':_0x35d63b[_0x4053('0x46')]['id']},'attributes':['id',_0x4053('0x63')],'raw':!![]};return db[_0x4053('0x2e')][_0x4053('0x49')](_0x523f3a)['then'](handleEntityNotFound(_0x1dc222,null))[_0x4053('0x12')](function(_0x56fabc){if(_0x56fabc){if(!_[_0x4053('0x6f')](_0x56fabc['agentAvatar'])){if(fs[_0x4053('0x70')](path[_0x4053('0x6a')](config[_0x4053('0x72')],_0x4053('0x76'),_0x56fabc[_0x4053('0x63')]))){_0x3984b6=path[_0x4053('0x6a')](config[_0x4053('0x72')],_0x4053('0x76'),_0x56fabc['agentAvatar']);}}return _0x1dc222[_0x4053('0x73')](_0x3984b6);}})[_0x4053('0x44')](handleError(_0x1dc222,null));};exports[_0x4053('0x77')]=function(_0x37d42d,_0xfbe6fe){var _0x461d1b=path['join'](config[_0x4053('0x72')],_0x4053('0x78'));var _0x57d4ec={'where':{'id':_0x37d42d['params']['id']},'attributes':['id',_0x4053('0x65'),_0x4053('0x79')],'raw':!![]};return db[_0x4053('0x2e')][_0x4053('0x49')](_0x57d4ec)['then'](handleEntityNotFound(_0xfbe6fe,null))[_0x4053('0x12')](function(_0x4c67fb){if(_0x4c67fb){if(!_[_0x4053('0x6f')](_0x4c67fb[_0x4053('0x65')])){if(fs[_0x4053('0x70')](path['join'](config[_0x4053('0x72')],_0x4053('0x76'),_0x4c67fb[_0x4053('0x65')]))&&_0x4c67fb['showCustomerAvatar']){_0x461d1b=path[_0x4053('0x6a')](config[_0x4053('0x72')],_0x4053('0x76'),_0x4c67fb[_0x4053('0x65')]);}}return _0xfbe6fe['download'](_0x461d1b);}})[_0x4053('0x44')](handleError(_0xfbe6fe,null));};exports[_0x4053('0x7a')]=function(_0x40c4cc,_0x2e36fc){var _0xf78a53=path[_0x4053('0x6a')](config[_0x4053('0x72')],_0x4053('0x7b'));var _0x12689c={'where':{'id':_0x40c4cc[_0x4053('0x46')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite'][_0x4053('0x49')](_0x12689c)[_0x4053('0x12')](handleEntityNotFound(_0x2e36fc,null))['then'](function(_0x1138cb){if(_0x1138cb){if(!_[_0x4053('0x6f')](_0x1138cb[_0x4053('0x67')])){if(fs[_0x4053('0x70')](path[_0x4053('0x6a')](config[_0x4053('0x72')],_0x4053('0x76'),_0x1138cb[_0x4053('0x67')]))){_0xf78a53=path[_0x4053('0x6a')](config[_0x4053('0x72')],_0x4053('0x76'),_0x1138cb[_0x4053('0x67')]);}}return _0x2e36fc[_0x4053('0x73')](_0xf78a53);}})['catch'](handleError(_0x2e36fc,null));};exports['notify']=function(_0x580bd1,_0x406dc8){var _0x4c6e2b=require(_0x4053('0x7c'));var _0x917fab=new _0x4c6e2b();var _0x4809f9=_0x917fab[_0x4053('0x7d')](_0x580bd1[_0x4053('0x7e')][_0x4053('0x7f')])['getResult']();var _0x33b461={'body':_0x580bd1[_0x4053('0x4b')],'channel':_0x4053('0x80')};var _0x5bc3c9=[];var _0x505718=[];var _0xf1d7fb={};var _0x24665c=![];return db['CmContact']['describe']()[_0x4053('0x12')](function(_0x27169c){if(!_0x27169c){throw new db[(_0x4053('0x81'))][(_0x4053('0x82'))]('no\x20available\x20attributes');}_0x5bc3c9=_[_0x4053('0x83')](_[_0x4053('0x59')](_0x27169c),[_0x4053('0x84'),_0x4053('0x85')]);_0x505718=_[_0x4053('0x83')](_[_0x4053('0x59')](_0x27169c),[_0x4053('0x84'),_0x4053('0x85'),_0x4053('0x86'),_0x4053('0x87')]);if(_0x580bd1[_0x4053('0x4b')]['id']){delete _0x580bd1[_0x4053('0x4b')]['id'];}if(_[_0x4053('0x6f')](_0x580bd1[_0x4053('0x4b')][_0x4053('0x88')])){throw new db[(_0x4053('0x81'))][(_0x4053('0x82'))](_0x4053('0x89'));}if(_[_0x4053('0x6f')](_0x580bd1[_0x4053('0x4b')][_0x4053('0x4b')])||_0x580bd1[_0x4053('0x4b')]['body']===''){throw new db['Sequelize'][(_0x4053('0x82'))](_0x4053('0x8a'));}if(_['isNil'](_0x580bd1[_0x4053('0x4b')]['mapKey'])){throw new db[(_0x4053('0x81'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x505718);}if(!_[_0x4053('0x8b')](_0x505718,_0x580bd1['body'][_0x4053('0x8c')])){throw new db[(_0x4053('0x81'))][(_0x4053('0x82'))](_0x4053('0x8d')+_0x505718);}_0xf1d7fb[_0x580bd1['body'][_0x4053('0x8c')]]=_0x580bd1[_0x4053('0x4b')]['from'];})[_0x4053('0x12')](function(){return db[_0x4053('0x2e')][_0x4053('0x49')]({'where':{'id':_0x580bd1['params']['id']},'include':[{'model':db[_0x4053('0x8e')],'as':_0x4053('0x8f'),'include':[{'model':db[_0x4053('0x90')],'as':_0x4053('0x91'),'where':_0xf1d7fb,'limit':0x1,'order':[[_0x4053('0x85'),_0x4053('0x92')]]}]},{'model':db[_0x4053('0x93')],'as':_0x4053('0x94')}]});})[_0x4053('0x12')](handleEntityNotFound(_0x406dc8,null))['then'](function(_0x5563bb){if(_0x5563bb&&_0x5563bb[_0x4053('0x8f')]){_0x33b461[_0x4053('0x95')]=_0x5563bb;_0x33b461[_0x4053('0x96')]=_0x5563bb['Applications'];_0x33b461[_0x4053('0x97')]=_0x5563bb[_0x4053('0x8f')];_0x33b461['applications']=_['orderBy'](_0x33b461['applications'],[_0x4053('0x98')],[_0x4053('0x99')]);if(_0x33b461[_0x4053('0x95')][_0x4053('0x94')]){delete _0x33b461['account'][_0x4053('0x94')];}if(_0x33b461[_0x4053('0x95')][_0x4053('0x8f')]&&_0x33b461[_0x4053('0x95')][_0x4053('0x8f')][_0x4053('0x91')][_0x4053('0x47')]){return _0x33b461['account'][_0x4053('0x8f')][_0x4053('0x91')][0x0];}var _0x4a984c=_[_0x4053('0xa')](_0x580bd1[_0x4053('0x4b')],{'firstName':_0x580bd1[_0x4053('0x4b')]['from'],'ListId':_0x5563bb['ListId']});_0x4a984c[_0x580bd1[_0x4053('0x4b')][_0x4053('0x8c')]]=_0x580bd1['body'][_0x4053('0x88')];return db[_0x4053('0x90')][_0x4053('0x4a')](_0x4a984c,{'fields':_0x5bc3c9,'raw':!![]});}})['then'](handleEntityNotFound(_0x406dc8,null))[_0x4053('0x12')](function(_0x2b8fcc){_0x33b461[_0x4053('0x9a')]=_0x2b8fcc;var _0x3941ba=_0x580bd1[_0x4053('0x4b')][_0x4053('0x9b')];if(_0x580bd1[_0x4053('0x7e')][_0x4053('0x9c')]){_0x3941ba=_0x580bd1[_0x4053('0x7e')]['cf-connecting-ip'];}else if(_0x580bd1['headers'][_0x4053('0x9d')]){_0x3941ba=_['first'](_0x580bd1['headers'][_0x4053('0x9d')][_0x4053('0x9e')](','));}if(_0x2b8fcc){var _0x413981={'ContactId':_0x2b8fcc['id'],'ChatWebsiteId':_0x580bd1[_0x4053('0x46')]['id'],'from':(_0x2b8fcc[_0x4053('0x9f')]||'')+'\x20'+(_0x2b8fcc[_0x4053('0xa0')]||''),'customerIp':_0x3941ba,'customerPort':_0x580bd1['headers'][_0x4053('0xa1')]?_0x580bd1[_0x4053('0x7e')][_0x4053('0xa1')]:null,'referer':_0x580bd1[_0x4053('0x4b')]['referer'],'browserName':_0x4809f9[_0x4053('0xa2')][_0x4053('0x29')]&&_0x4809f9[_0x4053('0xa2')][_0x4053('0xa3')]?util['format'](_0x4053('0xa4'),_0x4809f9[_0x4053('0xa2')][_0x4053('0x29')],_0x4809f9[_0x4053('0xa2')][_0x4053('0xa3')]):_0x4053('0xa5'),'browserVersion':_0x4809f9[_0x4053('0xa2')]['version']||_0x4053('0xa5'),'osName':util[_0x4053('0xa6')](_0x4053('0xa4'),_0x4809f9['os'][_0x4053('0x29')],_0x4809f9['os'][_0x4053('0xa3')]),'osVersion':_0x4809f9['os'][_0x4053('0xa3')],'deviceModel':_0x4809f9['device']['model']&&_0x4809f9['device'][_0x4053('0xa7')]?util['format'](_0x4053('0xa8'),_0x4809f9[_0x4053('0xa9')][_0x4053('0x31')],_0x4809f9[_0x4053('0xa9')][_0x4053('0xa7')],_0x4809f9[_0x4053('0xa9')]['type']):null,'deviceVendor':_0x4809f9[_0x4053('0xa9')][_0x4053('0xa7')],'deviceType':_0x4809f9['device'][_0x4053('0xaa')],'formData':JSON[_0x4053('0xab')](_0x580bd1[_0x4053('0x4b')])};var _0x177ebf={'ChatWebsiteId':_0x580bd1['params']['id'],'closed':![]};if(_0x580bd1[_0x4053('0x4b')][_0x4053('0xac')]){_0x177ebf[_0x4053('0xac')]=_0x580bd1['body'][_0x4053('0xac')];return db['ChatInteraction']['find']({'where':_0x177ebf})[_0x4053('0x12')](function(_0x462f91){if(_0x462f91){return[_0x462f91,![]];}_0x413981['threadId']=_0x580bd1['body'][_0x4053('0xac')];_0x413981[_0x4053('0xad')]=_0x580bd1[_0x4053('0x4b')][_0x4053('0xad')];return db[_0x4053('0xae')][_0x4053('0x4a')](_0x413981)[_0x4053('0x12')](function(_0x3ed1d9){return[_0x3ed1d9,!![]];});});}_0x177ebf[_0x4053('0xaf')]=_0x2b8fcc['id'];if(_0x580bd1[_0x4053('0x4b')]['interaction']&&_0x580bd1[_0x4053('0x4b')][_0x4053('0xb0')]['id']){_0x177ebf['id']=_0x580bd1[_0x4053('0x4b')][_0x4053('0xb0')]['id'];return db[_0x4053('0xae')][_0x4053('0x49')]({'where':_0x177ebf})[_0x4053('0x12')](function(_0x3edf7c){if(_0x3edf7c){return[_0x3edf7c,![]];}return db[_0x4053('0xae')][_0x4053('0x4a')](_0x413981)['then'](function(_0x5e508f){return[_0x5e508f,!![]];});});}return db[_0x4053('0xae')][_0x4053('0x4a')](_0x413981)['then'](function(_0x35b83a){return[_0x35b83a,!![]];});}})[_0x4053('0xb1')](function(_0x2f6140,_0x647386){if(_0x2f6140){_0x24665c=_0x647386;if(!_0x647386){var _0x5e13d4={'from':(_0x33b461['contact'][_0x4053('0x9f')]||'')+'\x20'+(_0x33b461[_0x4053('0x9a')][_0x4053('0xa0')]||'')};if(_0x580bd1['body'][_0x4053('0xac')]&&_0x580bd1[_0x4053('0x4b')][_0x4053('0xb2')]&&_0x580bd1[_0x4053('0x4b')][_0x4053('0xac')]!=_0x580bd1[_0x4053('0x4b')][_0x4053('0xb2')]){_0x5e13d4[_0x4053('0xac')]=_0x580bd1['body'][_0x4053('0xb2')];}return _0x2f6140[_0x4053('0x25')](_0x5e13d4);}else{return _0x2f6140;}}})[_0x4053('0x12')](function(_0x1ece56){_0x33b461[_0x4053('0xb0')]=_0x1ece56[_0x4053('0x27')]({'plain':!![]});_0x33b461['interaction'][_0x4053('0xb3')]=_0x24665c;if(_0x33b461[_0x4053('0xb0')][_0x4053('0xb3')]){if(_0x33b461[_0x4053('0x95')][_0x4053('0xb4')]){_0x33b461[_0x4053('0x96')][_0x4053('0xb5')]({'id':0x0,'priority':_0x33b461['applications'][_0x4053('0x47')]+0x1,'app':_0x4053('0xb6'),'appdata':'unmanaged','interval':_0x4053('0xb7')});}}return db[_0x4053('0xb8')][_0x4053('0x4a')]({'body':_0x580bd1[_0x4053('0x4b')]['body'],'ChatWebsiteId':_0x580bd1[_0x4053('0x46')]['id'],'ChatInteractionId':_0x1ece56['id'],'direction':'in','ContactId':_0x33b461[_0x4053('0x9a')]['id'],'AttachmentId':_0x580bd1['body'][_0x4053('0xb9')]});})[_0x4053('0x12')](function(_0x57c285){_0x33b461[_0x4053('0x18')]=_0x57c285;if(_0x33b461[_0x4053('0xb0')][_0x4053('0xba')]){return db[_0x4053('0xbb')][_0x4053('0x49')]({'attributes':['id',_0x4053('0x29')],'where':{'id':_0x33b461[_0x4053('0xb0')][_0x4053('0xba')]}})[_0x4053('0x12')](function(_0x316608){if(_0x316608){_0x33b461[_0x4053('0x96')][_0x4053('0xbc')]({'id':0x0,'priority':0x0,'app':_0x4053('0xbd'),'appdata':_0x316608['name']+','+(_0x33b461[_0x4053('0x95')][_0x4053('0xbe')]||0xa),'interval':_0x4053('0xb7')});_0x33b461[_0x4053('0xbf')]=!![];}return respondWithRpcPromise(_0x4053('0xc0'),_0x4053('0xc1'),_0x33b461);});}return respondWithRpcPromise(_0x4053('0xc0'),_0x4053('0xc1'),_0x33b461);})[_0x4053('0x12')](function(_0xbbf60e){respondWithRpcPromise(_0x4053('0xc2'),_0x4053('0xc2'),{'event':_0x4053('0xc3'),'message':_0xbbf60e},client9002);return _0xbbf60e;})[_0x4053('0x12')](respondWithResult(_0x406dc8,null))[_0x4053('0x44')](handleError(_0x406dc8,null));};exports[_0x4053('0xc4')]=function(_0x3c4784,_0x38b2b6){var _0x4de64a,_0x218f05,_0x4e6ef5;var _0x387281=[];var _0x10fe05={};var _0x1f2cef=_0x3c4784[_0x4053('0xc5')]||[];var _0x2e91a4=[];var _0xc737f5;return db[_0x4053('0x90')]['describe']()[_0x4053('0x12')](function(_0xa06d7f){if(!_0xa06d7f){throw new db[(_0x4053('0x81'))][(_0x4053('0x82'))](_0x4053('0xc6'));}_0x387281=_['difference'](_[_0x4053('0x59')](_0xa06d7f),[_0x4053('0x84'),_0x4053('0x85'),'CompanyId',_0x4053('0x87')]);if(_0x3c4784['body']['id']){delete _0x3c4784[_0x4053('0x4b')]['id'];}if(_[_0x4053('0x6f')](_0x3c4784[_0x4053('0x4b')][_0x4053('0x88')])){throw _0x38b2b6[_0x4053('0x1c')](0x1f4)[_0x4053('0x2a')](new db[(_0x4053('0x81'))][(_0x4053('0x82'))](_0x4053('0x89')));}if(_['isNil'](_0x3c4784[_0x4053('0x4b')][_0x4053('0x4b')])||_0x3c4784[_0x4053('0x4b')]['body']===''){throw _0x38b2b6[_0x4053('0x1c')](0x1f4)[_0x4053('0x2a')](new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x4053('0x6f')](_0x3c4784['body']['mapKeyOffline'])){throw _0x38b2b6[_0x4053('0x1c')](0x1f4)[_0x4053('0x2a')](new db[(_0x4053('0x81'))][(_0x4053('0x82'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x387281));}if(!_[_0x4053('0x8b')](_0x387281,_0x3c4784[_0x4053('0x4b')][_0x4053('0xc7')])){throw _0x38b2b6[_0x4053('0x1c')](0x1f4)[_0x4053('0x2a')](new db['Sequelize']['ValidationError'](_0x4053('0xc8')+_0x387281));}_0x10fe05[_0x3c4784[_0x4053('0x4b')][_0x4053('0xc7')]]=_0x3c4784[_0x4053('0x4b')][_0x4053('0x88')];})[_0x4053('0x12')](function(){return db[_0x4053('0x2e')][_0x4053('0x49')]({'where':{'id':_0x3c4784[_0x4053('0x46')]['id']},'include':[{'model':db[_0x4053('0x8e')],'as':_0x4053('0x8f')},{'model':db[_0x4053('0xc9')],'as':_0x4053('0xc9')}]});})[_0x4053('0x12')](handleEntityNotFound(_0x38b2b6,null))[_0x4053('0x12')](function(_0x221cd1){if(_0x221cd1&&_0x221cd1[_0x4053('0x8f')]){_0x218f05=_0x221cd1;var _0x3ed761=_[_0x4053('0xa')](_0x3c4784[_0x4053('0x4b')],{'firstName':_0x3c4784[_0x4053('0x4b')][_0x4053('0x88')],'phone':_0x3c4784[_0x4053('0x4b')][_0x4053('0x88')],'ListId':_0x221cd1[_0x4053('0x87')]});_0x3ed761[_0x3c4784[_0x4053('0x4b')][_0x4053('0xc7')]]=_0x3c4784[_0x4053('0x4b')][_0x4053('0x88')];return db[_0x4053('0x90')][_0x4053('0xca')]({'where':_0x10fe05,'defaults':_0x3ed761});}})[_0x4053('0xb1')](function(_0x549e83){if(_0x549e83){_0x4e6ef5=_0x549e83;var _0x2ee50d=fs[_0x4053('0xcb')](path[_0x4053('0x6a')](config[_0x4053('0x72')],_0x4053('0xcc')),_0x4053('0xcd'));var _0x59e9a7=ejs['render'](_0x2ee50d,{'body':_[_0x4053('0xce')](_0x3c4784[_0x4053('0x4b')][_0x4053('0x4b')]),'bodyTitle':_0x218f05['offlineMessageBody']});return db[_0x4053('0xcf')][_0x4053('0x4a')]({'body':_0x59e9a7,'plainBody':htmlToText['fromString'](_0x59e9a7),'ContactId':_0x549e83['id'],'ChatWebsiteId':_0x218f05['id']});}})[_0x4053('0x12')](function(_0xabe4b5){_0xc737f5=_0xabe4b5;if(_0x1f2cef[_0x4053('0x47')]){var _0x46d26d=_0x1f2cef[_0x4053('0x32')](function(_0x4d0aa0){return{'name':_0x4d0aa0[_0x4053('0xd0')],'basename':_0x4d0aa0[_0x4053('0x68')],'type':_0x4d0aa0['mimetype'],'ChatOfflineMessageId':_0xabe4b5['id']};});_0x2e91a4=_0x46d26d['map'](_0x2db5ca=>{var _0x4d9bc4={'filename':_0x2db5ca['name'],'path':path['join'](config[_0x4053('0x72')],_0x4053('0xd1'),_0x4053('0xc5'),_0x4053('0xd2'),_0x4053('0xd3'),_0x2db5ca[_0x4053('0xd4')])};return _0x4d9bc4;});if(!_0x218f05[_0x4053('0xd5')]){return db['sequelize'][_0x4053('0xd6')](function(_0x534ca7){return db[_0x4053('0xd7')][_0x4053('0xd8')](_0x46d26d,{'transaction':_0x534ca7});});}}})[_0x4053('0x12')](function(){if(_0xc737f5){_0x4de64a=_0xc737f5;return db[_0x4053('0xc9')][_0x4053('0x58')]({'where':{'service':!![]},'include':[{'model':db[_0x4053('0xd9')],'as':_0x4053('0xda'),'raw':!![],'include':[{'model':db[_0x4053('0xdb')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x4053('0x12')](function(_0x7189af){if(_0x7189af&&_0x7189af['Smtp']&&_0x218f05[_0x4053('0xdc')]&&_0x218f05[_0x4053('0xdd')]){var _0x4fdcdf=_0x7189af['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x4053('0xde'),{'account':_0x4fdcdf,'message':{'from':util[_0x4053('0xa6')](_0x4053('0xdf'),_0x7189af[_0x4053('0x29')],_0x7189af[_0x4053('0xe0')]||_0x7189af[_0x4053('0xda')][_0x4053('0x4c')]),'to':_0x218f05[_0x4053('0xdd')],'subject':_0x218f05[_0x4053('0xe1')],'html':_0x4de64a['body'],'attachments':_0x2e91a4}},client9003)[_0x4053('0x12')](function(){return _0x4de64a;})[_0x4053('0x44')](function(_0x480af0){logger[_0x4053('0x15')](_0x480af0);});}})[_0x4053('0x12')](function(){if(_0x218f05&&_0x218f05[_0x4053('0xd5')]&&_0x218f05['MailAccountId']){var _0x53e054=[];if(_0x1f2cef[_0x4053('0x47')]){_0x53e054=_0x1f2cef[_0x4053('0x32')](function(_0x33738d){return{'name':_0x33738d[_0x4053('0xd0')],'basename':_0x33738d[_0x4053('0x68')],'type':_0x33738d['mimetype'],'ChatOfflineMessageId':_0xc737f5['id']};});}var _0x4a4f7e;if(!_[_0x4053('0x6f')](_0x218f05[_0x4053('0xe2')])){var _0xb772b8=_[_0x4053('0x32')](_0x3c4784[_0x4053('0x4b')],function(_0x15de21){return _0x15de21;});var _0x29ea0c=_[_0x4053('0xe3')](_0xb772b8)[0x0];var _0x47c2a8=_[_0x4053('0xe4')](_0x29ea0c,function(_0x350e7e){return _0x350e7e;});_0x4a4f7e=_0x47c2a8[0x1][_0x218f05[_0x4053('0xe2')]];}var _0x2db524={'from':_0x4e6ef5[_0x4053('0xe0')],'firstName':_0x4e6ef5[_0x4053('0x9f')],'lastName':_0x4e6ef5['lastName'],'mapKey':'email','message':{'from':_0x4e6ef5['email'],'to':_0x218f05[_0x4053('0xc9')][_0x4053('0xe0')],'cc':'','subject':_['isNil'](_0x4a4f7e)?_0x218f05['offlineMessageSubject']:_0x4a4f7e,'messageId':'','sentAt':new Date(),'attach':_0x53e054['length'],'attachments':_0x53e054,'originChannel':_0x4053('0xe5'),'ChatWebsiteId':_0x218f05['id'],'ChatOfflineMessageId':_0x4de64a['id'],'originTo':_0x218f05[_0x4053('0xc9')][_0x4053('0xe0')]},'body':_0x4de64a[_0x4053('0x4b')]};var _0x3dacee={'account':{'id':_0x218f05[_0x4053('0xe6')]},'body':_0x2db524,'log':_0x4053('0xe7')};return respondWithRpcPromise(_0x4053('0xe7'),_0x4053('0xe8'),_0x3dacee,client9001)[_0x4053('0x12')](function(){return _0x4de64a;})[_0x4053('0x44')](function(_0x1f3254){logger[_0x4053('0x15')](_0x1f3254);});}return;})[_0x4053('0x12')](function(){if(_0x4de64a){return _0x4de64a;}})[_0x4053('0x12')](respondWithResult(_0x38b2b6,null))['catch'](function(_0x361921){logger['error'](_0x4053('0x44'),_0x361921);for(var _0x591c04 of _0x1f2cef){var _0x2e055f=path[_0x4053('0x6a')](config['root'],_0x4053('0xd1'),_0x4053('0xc5'),_0x4053('0xd2'),_0x4053('0xd3'),_0x591c04[_0x4053('0x68')]);fs_extra[_0x4053('0xe9')](_0x2e055f)[_0x4053('0x44')](function(_0x2f4a52){logger[_0x4053('0x15')](_0x4053('0xea'),_0x2e055f,_0x2f4a52);});}});};exports[_0x4053('0xeb')]=function(_0x2b8f9b,_0x1a589e){return db[_0x4053('0xae')][_0x4053('0x49')]({'where':{'id':_0x2b8f9b[_0x4053('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a589e,null))[_0x4053('0x12')](function(_0x226be1){if(_0x226be1){return _0x226be1[_0x4053('0xeb')](_0x2b8f9b[_0x4053('0x4b')][_0x4053('0x5c')],_['omit'](_0x2b8f9b[_0x4053('0x4b')],[_0x4053('0x5c'),'id'])||{});}})[_0x4053('0x12')](respondWithResult(_0x1a589e,null))[_0x4053('0x44')](handleError(_0x1a589e,null));};exports[_0x4053('0xec')]=function(_0x4dca27,_0x471c4a){var _0xf3c483={'raw':![],'where':{}};var _0x13ae35={};var _0x56a1d8={'count':0x0,'rows':[]};return db[_0x4053('0x2e')][_0x4053('0x58')]({'where':{'id':_0x4dca27['params']['id']}})[_0x4053('0x12')](handleEntityNotFound(_0x471c4a,null))[_0x4053('0x12')](function(_0x206411){if(_0x206411){_0x13ae35['model']=_['keys'](db[_0x4053('0xae')][_0x4053('0x2f')]);_0x13ae35[_0x4053('0x33')]=_['keys'](_0x4dca27['query']);_0x13ae35[_0x4053('0x3b')]=_[_0x4053('0x35')](_0x13ae35[_0x4053('0x31')],_0x13ae35[_0x4053('0x33')]);_0xf3c483[_0x4053('0x34')]=_['intersection'](_0x13ae35[_0x4053('0x31')],qs[_0x4053('0x36')](_0x4dca27[_0x4053('0x33')][_0x4053('0x36')]));_0xf3c483[_0x4053('0x34')]=_0xf3c483['attributes'][_0x4053('0x47')]?_0xf3c483[_0x4053('0x34')]:_0x13ae35['model'];if(!_0x4dca27[_0x4053('0x33')][_0x4053('0x37')]('nolimit')){_0xf3c483[_0x4053('0x21')]=qs['limit'](_0x4dca27[_0x4053('0x33')][_0x4053('0x21')]);_0xf3c483[_0x4053('0x1f')]=qs[_0x4053('0x1f')](_0x4dca27[_0x4053('0x33')][_0x4053('0x1f')]);}_0xf3c483[_0x4053('0x39')]=qs[_0x4053('0x5a')](_0x4dca27['query'][_0x4053('0x5a')]);_0xf3c483['where']=qs[_0x4053('0x3b')](_[_0x4053('0x3c')](_0x4dca27[_0x4053('0x33')],_0x13ae35[_0x4053('0x3b')]));_0xf3c483[_0x4053('0x3a')]['ChatWebsiteId']=_0x206411['id'];if(_0x4dca27[_0x4053('0x33')][_0x4053('0x3d')]){_0xf3c483[_0x4053('0x3a')]=_[_0x4053('0x3e')](_0xf3c483['where'],{'$or':_['map'](_0xf3c483[_0x4053('0x34')],function(_0x2a7f19){var _0x4de191={};_0x4de191[_0x2a7f19]={'$like':'%'+_0x4dca27[_0x4053('0x33')][_0x4053('0x3d')]+'%'};return _0x4de191;})});}_0xf3c483=_[_0x4053('0x3e')]({},_0xf3c483,_0x4dca27['options']);return db[_0x4053('0xae')][_0x4053('0x22')]({'where':_0xf3c483[_0x4053('0x3a')]})[_0x4053('0x12')](function(_0x3ce5ba){_0x56a1d8[_0x4053('0x22')]=_0x3ce5ba;if(_0x4dca27['query'][_0x4053('0x48')]){_0xf3c483[_0x4053('0x41')]=[{'model':db[_0x4053('0x90')],'as':'Contact','required':![]},{'model':db[_0x4053('0xbb')],'as':_0x4053('0xed'),'attributes':[_0x4053('0x29'),'fullname',_0x4053('0xee')],'required':![]},{'model':db[_0x4053('0xef')],'as':'Tags','attributes':['id','name',_0x4053('0xf0')],'where':_0x4dca27['query'][_0x4053('0xf1')]?{'id':_0x4dca27[_0x4053('0x33')][_0x4053('0xf1')]}:undefined,'required':_0x4dca27[_0x4053('0x33')][_0x4053('0xf1')]?!![]:![]}];}return db[_0x4053('0xae')][_0x4053('0x42')](_0xf3c483);})[_0x4053('0x12')](function(_0x58b10d){_0x56a1d8[_0x4053('0x43')]=_0x58b10d;return _0x56a1d8;});}})[_0x4053('0x12')](respondWithFilteredResult(_0x471c4a,_0xf3c483))[_0x4053('0x44')](handleError(_0x471c4a,null));};function iftimePromise(_0xd2bd6e,_0xf3e46c){return respondWithRpcPromise('Command','getSnippet',{'command':_0xf3e46c[_0x4053('0xf2')]?util['format'](_0x4053('0xf3'),_0xd2bd6e['interval'],_0xf3e46c[_0x4053('0xf2')]):util[_0x4053('0xa6')](_0x4053('0xf4'),_0xd2bd6e[_0x4053('0xf5')])},client9002)[_0x4053('0x12')](function(_0x34b5fb){var _0x2fe0b9=_0x34b5fb&&_0x34b5fb[_0x4053('0xf6')](_0x4053('0xf7'))>=0x0?!![]:![];logger[_0x4053('0x19')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0xf3e46c['id'],_0xd2bd6e['id'],_0xd2bd6e[_0x4053('0xf5')],_0x2fe0b9?_0x4053('0xf8'):_0x4053('0xf9'),_0xf3e46c[_0x4053('0xf2')]?_0xf3e46c[_0x4053('0xf2')]:'No\x20timezone');return _0x2fe0b9;})[_0x4053('0x44')](function(_0x31f8ed){logger[_0x4053('0x15')](_0x4053('0xfa'),_0xf3e46c['id'],_0xd2bd6e['id'],_0xd2bd6e['interval'],util['inspect'](_0x31f8ed,{'showHidden':![],'depth':null}),_0xf3e46c[_0x4053('0xf2')]?_0xf3e46c['timezone']:_0x4053('0xfb'));return![];});}exports[_0x4053('0xfc')]=function(_0x845bdd,_0x3004be){var _0x21f68c=0x0;var _0x2a51cd=0x0;var _0x472b3f=![];var _0xc5d463;var _0x319642;return db[_0x4053('0x2e')][_0x4053('0x49')]({'where':{'id':_0x845bdd[_0x4053('0x46')]['id']},'include':[{'model':db[_0x4053('0xfd')],'as':_0x4053('0xfd'),'include':[{'model':db[_0x4053('0xfd')],'as':'Intervals','attributes':['id',_0x4053('0xf5')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3004be,null))[_0x4053('0x12')](function(_0x525fff){if(_0x525fff){_0xc5d463=_0x525fff;return _0x525fff['getProactiveActions']({'raw':!![]});}})['then'](function(_0x3abf18){if(_0xc5d463){if(_0x3abf18){_0x319642=_0x3abf18;}}return require(_0x4053('0x6c'))['getLicense']();})[_0x4053('0x12')](function(_0x563392){if(_0x563392){_0x2a51cd=_0x563392[_0x4053('0xfe')];_0x472b3f=_0x563392['custom'];}})[_0x4053('0x12')](function(){return db[_0x4053('0xae')][_0x4053('0x22')]({'where':{'closed':![]}});})['then'](function(_0x11cfcb){_0x21f68c=_0x11cfcb;if(_0x2a51cd&&_0x11cfcb>_0x2a51cd){return db[_0x4053('0xff')][_0x4053('0x58')]({'where':{'id':0x1}})['then'](function(_0x4a5340){if(_0x4a5340){_0x4a5340[_0x4053('0x100')](_0x4053('0x101'));}});}})[_0x4053('0x12')](function(){if(_0xc5d463[_0x4053('0xfd')]&&_0xc5d463[_0x4053('0xfd')][_0x4053('0x102')]){var _0x1df013=[];for(var _0x495aad=0x0;_0x495aad<_0xc5d463[_0x4053('0xfd')][_0x4053('0x102')]['length'];_0x495aad++){var _0x5a192e=_0xc5d463[_0x4053('0xfd')][_0x4053('0x102')][_0x495aad][_0x4053('0x27')]({'plain':!![]});_0x1df013['push'](iftimePromise(_0x5a192e,_0xc5d463));}return BPromise[_0x4053('0x103')](_0x1df013)[_0x4053('0x12')](function(_0x38d1dd){return _[_0x4053('0x104')](_0x38d1dd);});}else{return!![];}})[_0x4053('0x12')](function(_0x2ecc39){var _0x489281=fs['readFileSync'](path['join'](config[_0x4053('0x72')],_0x4053('0x105')),'utf8');var _0x284688={'remote':_0xc5d463[_0x4053('0x106')],'query':querystring[_0x4053('0xab')](_[_0x4053('0x3e')](_0xc5d463[_0x4053('0x27')]({'plain':!![]}),{'customerIp':_0x845bdd[_0x4053('0x7e')]['x-forwarded-for']||_0x845bdd[_0x4053('0x7e')][_0x4053('0x107')]||_0x845bdd[_0x4053('0x108')][_0x4053('0x109')]||_0x845bdd['ip'],'referer':_0x845bdd['headers'][_0x4053('0x10a')],'openedInteractions':_0x21f68c,'maxInteractions':_0x2a51cd,'virtual':_0x472b3f['virtual'],'online':_0x2ecc39,'custom':_0x472b3f}))[_0x4053('0x10b')](/'/g,'\x5c\x27')};_0x3004be['send'](ejs[_0x4053('0x10c')](Mustache[_0x4053('0x10c')](_0x489281,_0x284688),{'proactiveActions':_0x319642,'alignment':_0xc5d463[_0x4053('0x10d')],'verticalAlignment':_0xc5d463[_0x4053('0x10e')],'div_color':_0xc5d463[_0x4053('0xf0')],'labelText':_0xc5d463['labelText'],'text_color':_0xc5d463[_0x4053('0x10f')],'text_button_color':_0xc5d463[_0x4053('0x110')],'button_color':_0xc5d463[_0x4053('0x111')],'background_color':_0xc5d463[_0x4053('0x112')],'hideWhenOffline':_0xc5d463[_0x4053('0x113')],'interval':_0xc5d463[_0x4053('0x114')]}));})[_0x4053('0x44')](handleError(_0x3004be,null));};exports[_0x4053('0x115')]=function(_0x4f0e7a,_0x4022dc){var _0x2fb10b=_0x4f0e7a['params']['id'];var _0x3a4886=_0x4f0e7a[_0x4053('0x4b')];var _0x6ac5cf=0xc8;var _0x58c78d=null;return db[_0x4053('0x116')][_0x4053('0xd6')]({'isolationLevel':db['sequelize'][_0x4053('0x117')][_0x4053('0x118')][_0x4053('0x119')]},function(_0x4b18ee){return db[_0x4053('0x2e')][_0x4053('0x58')]({'where':{'id':_0x2fb10b},'transaction':_0x4b18ee})[_0x4053('0x12')](function(_0x343c96){if(_0x343c96){return db['ChatApplication'][_0x4053('0x26')]({'where':{'ChatWebsiteId':_0x2fb10b},'transaction':_0x4b18ee})[_0x4053('0x12')](function(){var _0x131c6b=_['map'](_0x3a4886,function(_0x2999bb){_0x2999bb[_0x4053('0x56')]=_0x2fb10b;return _0x2999bb;});return db[_0x4053('0x93')][_0x4053('0xd8')](_0x131c6b,{'transaction':_0x4b18ee});});}else{_0x6ac5cf=0x194;_0x58c78d=[];}});})[_0x4053('0x12')](function(){if(_0x6ac5cf!==0x194){return db[_0x4053('0x93')][_0x4053('0x11a')]({'where':{'ChatWebsiteId':_0x2fb10b},'order':_0x4053('0x98')})[_0x4053('0x12')](function(_0x2b398f){_0x58c78d=_0x2b398f;});}})[_0x4053('0x44')](function(_0x3d4173){_0x6ac5cf=0x1f4;logger['error'](_0x3d4173['stack']);if(_0x3d4173[_0x4053('0x29')]){delete _0x3d4173['name'];}_0x58c78d=_0x3d4173;})['finally'](function(){if(_0x58c78d===null){_0x4022dc[_0x4053('0x1b')](_0x6ac5cf);}else{if(_0x6ac5cf===0x1f4){_0x4022dc[_0x4053('0x1c')](_0x6ac5cf)['send'](_0x58c78d);}else{_0x4022dc[_0x4053('0x1c')](_0x6ac5cf)[_0x4053('0x1e')](_0x58c78d);}}});};exports[_0x4053('0x11b')]=function(_0xb4ce9a,_0x4b6c81){var _0xe8fe5e={};var _0x20c355={};var _0x3a16dc;var _0x5f085d;return db[_0x4053('0x2e')]['findOne']({'where':{'id':_0xb4ce9a[_0x4053('0x46')]['id']}})[_0x4053('0x12')](handleEntityNotFound(_0x4b6c81,null))[_0x4053('0x12')](function(_0x7f71de){if(_0x7f71de){_0x3a16dc=_0x7f71de;_0x20c355['model']=_[_0x4053('0x59')](db['ChatApplication']['rawAttributes']);_0x20c355['query']=_[_0x4053('0x59')](_0xb4ce9a[_0x4053('0x33')]);_0x20c355[_0x4053('0x3b')]=_[_0x4053('0x35')](_0x20c355[_0x4053('0x31')],_0x20c355[_0x4053('0x33')]);_0xe8fe5e['attributes']=_[_0x4053('0x35')](_0x20c355[_0x4053('0x31')],qs['fields'](_0xb4ce9a[_0x4053('0x33')][_0x4053('0x36')]));_0xe8fe5e[_0x4053('0x34')]=_0xe8fe5e[_0x4053('0x34')][_0x4053('0x47')]?_0xe8fe5e[_0x4053('0x34')]:_0x20c355[_0x4053('0x31')];_0xe8fe5e[_0x4053('0x39')]=qs[_0x4053('0x5a')](_0xb4ce9a[_0x4053('0x33')][_0x4053('0x5a')]);_0xe8fe5e[_0x4053('0x3a')]=qs[_0x4053('0x3b')](_[_0x4053('0x3c')](_0xb4ce9a[_0x4053('0x33')],_0x20c355[_0x4053('0x3b')]));if(_0xb4ce9a[_0x4053('0x33')][_0x4053('0x3d')]){_0xe8fe5e['where']=_['merge'](_0xe8fe5e[_0x4053('0x3a')],{'$or':_['map'](_0xe8fe5e[_0x4053('0x34')],function(_0x3c07c6){var _0x5075c6={};_0x5075c6[_0x3c07c6]={'$like':'%'+_0xb4ce9a['query'][_0x4053('0x3d')]+'%'};return _0x5075c6;})});}_0xe8fe5e=_[_0x4053('0x3e')]({},_0xe8fe5e,_0xb4ce9a[_0x4053('0x40')]);return _0x3a16dc['getApplications'](_0xe8fe5e);}})[_0x4053('0x12')](function(_0x2ad28a){if(_0x2ad28a){_0x5f085d=_0x2ad28a['length'];if(!_0xb4ce9a[_0x4053('0x33')][_0x4053('0x37')](_0x4053('0x38'))){_0xe8fe5e[_0x4053('0x21')]=qs[_0x4053('0x21')](_0xb4ce9a[_0x4053('0x33')][_0x4053('0x21')]);_0xe8fe5e['offset']=qs[_0x4053('0x1f')](_0xb4ce9a[_0x4053('0x33')][_0x4053('0x1f')]);}return _0x3a16dc[_0x4053('0x11b')](_0xe8fe5e);}})[_0x4053('0x12')](function(_0x5e653d){if(_0x5e653d){return _0x5e653d?{'count':_0x5f085d,'rows':_0x5e653d}:null;}})[_0x4053('0x12')](respondWithResult(_0x4b6c81,null))['catch'](handleError(_0x4b6c81,null));};exports[_0x4053('0x11c')]=function(_0x3a2b8a,_0x4a2090){return db[_0x4053('0x11d')][_0x4053('0x49')]({'where':{'id':_0x3a2b8a[_0x4053('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a2090,null))[_0x4053('0x12')](function(_0x2e312b){if(_0x2e312b){return _0x2e312b[_0x4053('0x11c')](_0x3a2b8a[_0x4053('0x4b')][_0x4053('0x5c')],_[_0x4053('0x11e')](_0x3a2b8a[_0x4053('0x4b')],[_0x4053('0x5c'),'id'])||{});}})[_0x4053('0x12')](respondWithResult(_0x4a2090,null))[_0x4053('0x44')](handleError(_0x4a2090,null));};exports[_0x4053('0x11f')]=function(_0x22e27e,_0x1220de){var _0x337fc7={};var _0x21a1fd={};var _0x29382a;var _0x2811f2;return db[_0x4053('0x2e')][_0x4053('0x58')]({'where':{'id':_0x22e27e[_0x4053('0x46')]['id']}})[_0x4053('0x12')](handleEntityNotFound(_0x1220de,null))[_0x4053('0x12')](function(_0x5dd6f3){if(_0x5dd6f3){_0x29382a=_0x5dd6f3;_0x21a1fd[_0x4053('0x31')]=_[_0x4053('0x59')](db['ChatProactiveAction']['rawAttributes']);_0x21a1fd[_0x4053('0x33')]=_['keys'](_0x22e27e['query']);_0x21a1fd['filters']=_[_0x4053('0x35')](_0x21a1fd[_0x4053('0x31')],_0x21a1fd[_0x4053('0x33')]);_0x337fc7[_0x4053('0x34')]=_[_0x4053('0x35')](_0x21a1fd[_0x4053('0x31')],qs[_0x4053('0x36')](_0x22e27e['query'][_0x4053('0x36')]));_0x337fc7[_0x4053('0x34')]=_0x337fc7[_0x4053('0x34')][_0x4053('0x47')]?_0x337fc7['attributes']:_0x21a1fd[_0x4053('0x31')];_0x337fc7['order']=qs[_0x4053('0x5a')](_0x22e27e[_0x4053('0x33')][_0x4053('0x5a')]);_0x337fc7['where']=qs[_0x4053('0x3b')](_[_0x4053('0x3c')](_0x22e27e[_0x4053('0x33')],_0x21a1fd['filters']));if(_0x22e27e[_0x4053('0x33')][_0x4053('0x3d')]){_0x337fc7[_0x4053('0x3a')]=_[_0x4053('0x3e')](_0x337fc7[_0x4053('0x3a')],{'$or':_[_0x4053('0x32')](_0x337fc7['attributes'],function(_0x5bc3ad){var _0x378a2d={};_0x378a2d[_0x5bc3ad]={'$like':'%'+_0x22e27e[_0x4053('0x33')][_0x4053('0x3d')]+'%'};return _0x378a2d;})});}_0x337fc7=_[_0x4053('0x3e')]({},_0x337fc7,_0x22e27e[_0x4053('0x40')]);return _0x29382a[_0x4053('0x11f')](_0x337fc7);}})['then'](function(_0x534eda){if(_0x534eda){_0x2811f2=_0x534eda['length'];if(!_0x22e27e[_0x4053('0x33')]['hasOwnProperty'](_0x4053('0x38'))){_0x337fc7[_0x4053('0x21')]=qs[_0x4053('0x21')](_0x22e27e['query'][_0x4053('0x21')]);_0x337fc7[_0x4053('0x1f')]=qs[_0x4053('0x1f')](_0x22e27e[_0x4053('0x33')]['offset']);}return _0x29382a['getProactiveActions'](_0x337fc7);}})[_0x4053('0x12')](function(_0x14e164){if(_0x14e164){return _0x14e164?{'count':_0x2811f2,'rows':_0x14e164}:null;}})['then'](respondWithResult(_0x1220de,null))['catch'](handleError(_0x1220de,null));};exports['getFields']=function(_0x4420e9,_0x112102){var _0x3e44b1=_0x4420e9[_0x4053('0x33')][_0x4053('0x120')]===_0x4053('0x121')?_0x4053('0x122'):_0x4053('0x123');return db[_0x4053('0x2e')][_0x4053('0x49')]({'attributes':['id',_0x3e44b1],'where':{'id':_0x4420e9['params']['id']}})[_0x4053('0x12')](handleEntityNotFound(_0x112102,null))[_0x4053('0x12')](function(_0x4e2207){if(_0x4e2207){var _0x3a8538=_0x4e2207[_0x3e44b1];var _0x89e0f3=_0x3a8538&&_0x3a8538[_0x4053('0x124')]?_0x3a8538['items']:[];_0x112102['send']({'fromKey':_[_0x4053('0x6f')](_0x3a8538['fromKey'])?undefined:_0x3a8538[_0x4053('0x125')],'count':_0x89e0f3[_0x4053('0x47')],'rows':_0x89e0f3});}})[_0x4053('0x44')](handleError(_0x112102,null));};exports[_0x4053('0x126')]=function(_0x49b3f6,_0x40a720){var _0x1af6f7={'raw':![],'where':{}};var _0x15bfeb={};var _0x2ab194={'count':0x0,'rows':[]};return db[_0x4053('0x2e')][_0x4053('0x58')]({'where':{'id':_0x49b3f6[_0x4053('0x46')]['id']}})[_0x4053('0x12')](handleEntityNotFound(_0x40a720,null))[_0x4053('0x12')](function(_0x48283c){if(_0x48283c){_0x15bfeb[_0x4053('0x31')]=_[_0x4053('0x59')](db['ChatOfflineMessage'][_0x4053('0x2f')]);_0x15bfeb[_0x4053('0x33')]=_['keys'](_0x49b3f6[_0x4053('0x33')]);_0x15bfeb['filters']=_[_0x4053('0x35')](_0x15bfeb[_0x4053('0x31')],_0x15bfeb[_0x4053('0x33')]);_0x1af6f7['attributes']=_[_0x4053('0x35')](_0x15bfeb[_0x4053('0x31')],qs[_0x4053('0x36')](_0x49b3f6['query'][_0x4053('0x36')]));_0x1af6f7[_0x4053('0x34')]=_0x1af6f7[_0x4053('0x34')][_0x4053('0x47')]?_0x1af6f7[_0x4053('0x34')]:_0x15bfeb['model'];if(!_0x49b3f6[_0x4053('0x33')][_0x4053('0x37')](_0x4053('0x38'))){_0x1af6f7['limit']=qs[_0x4053('0x21')](_0x49b3f6['query'][_0x4053('0x21')]);_0x1af6f7['offset']=qs[_0x4053('0x1f')](_0x49b3f6['query'][_0x4053('0x1f')]);}_0x1af6f7['order']=qs['sort'](_0x49b3f6[_0x4053('0x33')]['sort']);_0x1af6f7[_0x4053('0x3a')]=qs[_0x4053('0x3b')](_[_0x4053('0x3c')](_0x49b3f6[_0x4053('0x33')],_0x15bfeb[_0x4053('0x3b')]));_0x1af6f7[_0x4053('0x3a')][_0x4053('0x56')]=_0x48283c['id'];if(_0x49b3f6[_0x4053('0x33')][_0x4053('0x3d')]){_0x1af6f7[_0x4053('0x3a')]=_[_0x4053('0x3e')](_0x1af6f7['where'],{'$or':_[_0x4053('0x32')](_0x1af6f7['attributes'],function(_0x3893ed){var _0x47002d={};_0x47002d[_0x3893ed]={'$like':'%'+_0x49b3f6[_0x4053('0x33')][_0x4053('0x3d')]+'%'};return _0x47002d;})});}_0x1af6f7=_['merge']({},_0x1af6f7,_0x49b3f6['options']);return db[_0x4053('0xcf')][_0x4053('0x22')]({'where':_0x1af6f7[_0x4053('0x3a')]})[_0x4053('0x12')](function(_0x3b1a15){_0x2ab194['count']=_0x3b1a15;if(_0x49b3f6[_0x4053('0x33')][_0x4053('0x48')]){_0x1af6f7[_0x4053('0x41')]=[{'all':!![]}];}else{_0x1af6f7[_0x4053('0x41')]=[{'model':db[_0x4053('0x90')],'as':_0x4053('0x127'),'required':![]},{'model':db[_0x4053('0xd7')],'as':'Attachments','required':![]}];}return db[_0x4053('0xcf')][_0x4053('0x42')](_0x1af6f7);})[_0x4053('0x12')](function(_0x569b23){_0x2ab194[_0x4053('0x43')]=_0x569b23;return _0x2ab194;});}})[_0x4053('0x12')](respondWithFilteredResult(_0x40a720,_0x1af6f7))['catch'](handleError(_0x40a720,null));};exports[_0x4053('0x128')]=function(_0xc9764e,_0x434300){return db[_0x4053('0x2e')]['find']({'where':{'id':_0xc9764e[_0x4053('0x46')]['id']}})[_0x4053('0x12')](handleEntityNotFound(_0x434300,null))[_0x4053('0x12')](function(_0x93051d){if(_0x93051d){return _0x93051d['addAgents'](_0xc9764e[_0x4053('0x4b')][_0x4053('0x5c')],_[_0x4053('0x11e')](_0xc9764e['body'],[_0x4053('0x5c'),'id'])||{})[_0x4053('0xb1')](function(_0xb286c1){for(var _0x5343e7=0x0;_0x5343e7<_0xc9764e[_0x4053('0x4b')]['ids']['length'];_0x5343e7+=0x1){socket['emit'](_0x4053('0x129'),{'UserId':Number(_0xc9764e['body'][_0x4053('0x5c')][_0x5343e7]),'ChatWebsiteId':Number(_0xc9764e['params']['id'])});}return _0xb286c1;});}})[_0x4053('0x12')](respondWithResult(_0x434300,null))[_0x4053('0x44')](handleError(_0x434300,null));};exports[_0x4053('0x12a')]=function(_0x5e5c3c,_0xddf90d){return db[_0x4053('0x2e')][_0x4053('0x49')]({'where':{'id':_0x5e5c3c['params']['id']}})[_0x4053('0x12')](handleEntityNotFound(_0xddf90d,null))['then'](function(_0x404090){if(_0x404090){return _0x404090[_0x4053('0x12a')](_0x5e5c3c['query']['ids'])[_0x4053('0x12')](function(){if(_[_0x4053('0x12b')](_0x5e5c3c[_0x4053('0x33')]['ids'])){for(var _0x3e5404=0x0;_0x3e5404<_0x5e5c3c[_0x4053('0x33')]['ids'][_0x4053('0x47')];_0x3e5404+=0x1){socket['emit'](_0x4053('0x12c'),{'UserId':Number(_0x5e5c3c[_0x4053('0x33')][_0x4053('0x5c')][_0x3e5404]),'ChatWebsiteId':Number(_0x5e5c3c[_0x4053('0x46')]['id'])});}}else{socket[_0x4053('0x12d')]('userChatWebsite:remove',{'UserId':Number(_0x5e5c3c[_0x4053('0x33')][_0x4053('0x5c')]),'ChatWebsiteId':Number(_0x5e5c3c[_0x4053('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0xddf90d,null))['catch'](handleError(_0xddf90d,null));};exports['getAgents']=function(_0x3cff30,_0x48e6c1){var _0x3d15e0={};var _0x40258a={};var _0x15fd4d;var _0x1c6943;return db['ChatWebsite'][_0x4053('0x58')]({'where':{'id':_0x3cff30[_0x4053('0x46')]['id']}})[_0x4053('0x12')](handleEntityNotFound(_0x48e6c1,null))[_0x4053('0x12')](function(_0x161016){if(_0x161016){_0x15fd4d=_0x161016;_0x40258a['model']=_[_0x4053('0x59')](db['User']['rawAttributes']);_0x40258a[_0x4053('0x33')]=_[_0x4053('0x59')](_0x3cff30[_0x4053('0x33')]);_0x40258a[_0x4053('0x3b')]=_[_0x4053('0x35')](_0x40258a['model'],_0x40258a['query']);_0x3d15e0[_0x4053('0x34')]=_[_0x4053('0x35')](_0x40258a[_0x4053('0x31')],qs[_0x4053('0x36')](_0x3cff30[_0x4053('0x33')][_0x4053('0x36')]));_0x3d15e0[_0x4053('0x34')]=_0x3d15e0[_0x4053('0x34')][_0x4053('0x47')]?_0x3d15e0[_0x4053('0x34')]:_0x40258a[_0x4053('0x31')];_0x3d15e0[_0x4053('0x39')]=qs[_0x4053('0x5a')](_0x3cff30[_0x4053('0x33')][_0x4053('0x5a')]);_0x3d15e0['where']=qs[_0x4053('0x3b')](_[_0x4053('0x3c')](_0x3cff30[_0x4053('0x33')],_0x40258a[_0x4053('0x3b')]));if(_0x3cff30[_0x4053('0x33')][_0x4053('0x3d')]){_0x3d15e0[_0x4053('0x3a')]=_[_0x4053('0x3e')](_0x3d15e0[_0x4053('0x3a')],{'$or':_['map'](_0x3d15e0['attributes'],function(_0x55be1f){var _0x1e1c92={};_0x1e1c92[_0x55be1f]={'$like':'%'+_0x3cff30[_0x4053('0x33')][_0x4053('0x3d')]+'%'};return _0x1e1c92;})});}_0x3d15e0=_[_0x4053('0x3e')]({},_0x3d15e0,_0x3cff30['options']);return _0x15fd4d[_0x4053('0x12e')](_0x3d15e0);}})[_0x4053('0x12')](function(_0x4b9081){if(_0x4b9081){_0x1c6943=_0x4b9081['length'];if(!_0x3cff30[_0x4053('0x33')][_0x4053('0x37')](_0x4053('0x38'))){_0x3d15e0[_0x4053('0x21')]=qs[_0x4053('0x21')](_0x3cff30[_0x4053('0x33')][_0x4053('0x21')]);_0x3d15e0['offset']=qs[_0x4053('0x1f')](_0x3cff30[_0x4053('0x33')][_0x4053('0x1f')]);}return _0x15fd4d['getAgents'](_0x3d15e0);}})['then'](function(_0x32f856){if(_0x32f856){return _0x32f856?{'count':_0x1c6943,'rows':_0x32f856}:null;}})[_0x4053('0x12')](respondWithResult(_0x48e6c1,null))['catch'](handleError(_0x48e6c1,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 49e3400..7e582c3 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 _0x308a=['hook','events','ChatWebsite','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x43291d,_0x166561){var _0x6c48ff=function(_0x5a31a4){while(--_0x5a31a4){_0x43291d['push'](_0x43291d['shift']());}};_0x6c48ff(++_0x166561);}(_0x308a,0x71));var _0xa308=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x308a[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xa308('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xa308('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa308('0x2')](0x0);var events={'afterCreate':_0xa308('0x3'),'afterUpdate':_0xa308('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5320e6){return function(_0x3a294d,_0x99d71a,_0x37035d){ChatWebsiteEvents[_0xa308('0x5')](_0x5320e6+':'+_0x3a294d['id'],_0x3a294d);ChatWebsiteEvents[_0xa308('0x5')](_0x5320e6,_0x3a294d);_0x37035d(null);};}for(var e in events){if(events[_0xa308('0x6')](e)){var event=events[e];ChatWebsite[_0xa308('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x59c3=['update','emit','hook','events','../../mysqldb','ChatWebsite','setMaxListeners','save'];(function(_0x34d22a,_0x840e43){var _0x2e81f8=function(_0x3d6953){while(--_0x3d6953){_0x34d22a['push'](_0x34d22a['shift']());}};_0x2e81f8(++_0x840e43);}(_0x59c3,0x133));var _0x359c=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x59c3[_0x42245d];return _0x4b211a;};'use strict';var EventEmitter=require(_0x359c('0x0'));var ChatWebsite=require(_0x359c('0x1'))['db'][_0x359c('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x359c('0x3')](0x0);var events={'afterCreate':_0x359c('0x4'),'afterUpdate':_0x359c('0x5'),'afterDestroy':'remove'};function emitEvent(_0xa40711){return function(_0x225098,_0x61333a,_0x9497b6){ChatWebsiteEvents[_0x359c('0x6')](_0xa40711+':'+_0x225098['id'],_0x225098);ChatWebsiteEvents[_0x359c('0x6')](_0xa40711,_0x225098);_0x9497b6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x359c('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index dc4a514..92096ba 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 _0x1135=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./chatWebsite.attributes','exports','chat_websites'];(function(_0x2e7602,_0x233736){var _0x210418=function(_0x2669a5){while(--_0x2669a5){_0x2e7602['push'](_0x2e7602['shift']());}};_0x210418(++_0x233736);}(_0x1135,0x14a));var _0x5113=function(_0x1f0f8f,_0xde3c0f){_0x1f0f8f=_0x1f0f8f-0x0;var _0x156f31=_0x1135[_0x1f0f8f];return _0x156f31;};'use strict';var _=require('lodash');var util=require(_0x5113('0x0'));var logger=require(_0x5113('0x1'))(_0x5113('0x2'));var moment=require(_0x5113('0x3'));var BPromise=require(_0x5113('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5113('0x5'));var config=require(_0x5113('0x6'));var attributes=require(_0x5113('0x7'));module[_0x5113('0x8')]=function(_0x428f1c,_0x51365b){return _0x428f1c['define']('ChatWebsite',attributes,{'tableName':_0x5113('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f60=['chat_websites','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7f60,0x181));var _0x07f6=function(_0x58280d,_0x385634){_0x58280d=_0x58280d-0x0;var _0x257ada=_0x7f60[_0x58280d];return _0x257ada;};'use strict';var _=require('lodash');var util=require(_0x07f6('0x0'));var logger=require(_0x07f6('0x1'))(_0x07f6('0x2'));var moment=require(_0x07f6('0x3'));var BPromise=require(_0x07f6('0x4'));var rp=require(_0x07f6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x07f6('0x6'));var attributes=require(_0x07f6('0x7'));module[_0x07f6('0x8')]=function(_0x528987,_0x27b771){return _0x528987[_0x07f6('0x9')](_0x07f6('0xa'),attributes,{'tableName':_0x07f6('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 7200b06..f15c86a 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 _0x150b=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x150b,0x1db));var _0xb150=function(_0x47bc58,_0x1e1998){_0x47bc58=_0x47bc58-0x0;var _0x4a0860=_0x150b[_0x47bc58];return _0x4a0860;};'use strict';var _=require(_0xb150('0x0'));var util=require(_0xb150('0x1'));var moment=require(_0xb150('0x2'));var BPromise=require(_0xb150('0x3'));var rs=require(_0xb150('0x4'));var fs=require('fs');var Redis=require(_0xb150('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb150('0x6'));var logger=require(_0xb150('0x7'))(_0xb150('0x8'));var config=require(_0xb150('0x9'));var jayson=require(_0xb150('0xa'));var client=jayson[_0xb150('0xb')][_0xb150('0xc')]({'port':0x232a});config[_0xb150('0xd')]=_[_0xb150('0xe')](config[_0xb150('0xd')],{'host':_0xb150('0xf'),'port':0x18eb});var socket=require(_0xb150('0x10'))(new Redis(config[_0xb150('0xd')]));require(_0xb150('0x11'))[_0xb150('0x12')](socket);function respondWithRpcPromise(_0x94916f,_0x31feed,_0x402d74){return new BPromise(function(_0x7486d4,_0x3fa855){return client['request'](_0x94916f,_0x402d74)[_0xb150('0x13')](function(_0x19d0cd){logger[_0xb150('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x31feed,'request\x20sent');logger[_0xb150('0x15')](_0xb150('0x16'),_0x31feed,'request\x20sent',JSON[_0xb150('0x17')](_0x19d0cd));if(_0x19d0cd[_0xb150('0x18')]){if(_0x19d0cd[_0xb150('0x18')]['code']===0x1f4){logger[_0xb150('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x31feed,_0x19d0cd[_0xb150('0x18')]['message']);return _0x3fa855(_0x19d0cd[_0xb150('0x18')]['message']);}logger['error'](_0xb150('0x19'),_0x31feed,_0x19d0cd[_0xb150('0x18')][_0xb150('0x1a')]);return _0x7486d4(_0x19d0cd['error'][_0xb150('0x1a')]);}else{logger[_0xb150('0x14')](_0xb150('0x19'),_0x31feed,_0xb150('0x1b'));_0x7486d4(_0x19d0cd[_0xb150('0x1c')][_0xb150('0x1a')]);}})[_0xb150('0x1d')](function(_0x4adc87){logger[_0xb150('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x31feed,_0x4adc87);_0x3fa855(_0x4adc87);});});} \ No newline at end of file +var _0x85ec=['http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b0a19,_0x3be156){var _0x530bf0=function(_0x165ce2){while(--_0x165ce2){_0x4b0a19['push'](_0x4b0a19['shift']());}};_0x530bf0(++_0x3be156);}(_0x85ec,0x65));var _0xc85e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x85ec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc85e('0x0'));var util=require('util');var moment=require(_0xc85e('0x1'));var BPromise=require(_0xc85e('0x2'));var rs=require(_0xc85e('0x3'));var fs=require('fs');var Redis=require(_0xc85e('0x4'));var db=require(_0xc85e('0x5'))['db'];var utils=require(_0xc85e('0x6'));var logger=require(_0xc85e('0x7'))(_0xc85e('0x8'));var config=require(_0xc85e('0x9'));var jayson=require(_0xc85e('0xa'));var client=jayson['client'][_0xc85e('0xb')]({'port':0x232a});config[_0xc85e('0xc')]=_[_0xc85e('0xd')](config[_0xc85e('0xc')],{'host':_0xc85e('0xe'),'port':0x18eb});var socket=require(_0xc85e('0xf'))(new Redis(config[_0xc85e('0xc')]));require(_0xc85e('0x10'))[_0xc85e('0x11')](socket);function respondWithRpcPromise(_0x344b9e,_0x479e05,_0x4c45e0){return new BPromise(function(_0x422f08,_0x6e2834){return client[_0xc85e('0x12')](_0x344b9e,_0x4c45e0)['then'](function(_0x16d0e6){logger[_0xc85e('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x479e05,_0xc85e('0x14'));logger[_0xc85e('0x15')](_0xc85e('0x16'),_0x479e05,_0xc85e('0x14'),JSON['stringify'](_0x16d0e6));if(_0x16d0e6['error']){if(_0x16d0e6[_0xc85e('0x17')][_0xc85e('0x18')]===0x1f4){logger[_0xc85e('0x17')](_0xc85e('0x19'),_0x479e05,_0x16d0e6['error']['message']);return _0x6e2834(_0x16d0e6[_0xc85e('0x17')][_0xc85e('0x1a')]);}logger[_0xc85e('0x17')](_0xc85e('0x19'),_0x479e05,_0x16d0e6['error'][_0xc85e('0x1a')]);return _0x422f08(_0x16d0e6[_0xc85e('0x17')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x479e05,_0xc85e('0x14'));_0x422f08(_0x16d0e6[_0xc85e('0x1b')]['message']);}})['catch'](function(_0x3bec66){logger[_0xc85e('0x17')](_0xc85e('0x19'),_0x479e05,_0x3bec66);_0x6e2834(_0x3bec66);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 0127e11..ed4f838 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 _0xa1b6=['save','update','emit','removeListener','register','length','./chatWebsite.events'];(function(_0x1dc1c6,_0x388835){var _0x229b6f=function(_0x798e8f){while(--_0x798e8f){_0x1dc1c6['push'](_0x1dc1c6['shift']());}};_0x229b6f(++_0x388835);}(_0xa1b6,0x13a));var _0x6a1b=function(_0x12fadd,_0x4b5bae){_0x12fadd=_0x12fadd-0x0;var _0x5c9664=_0xa1b6[_0x12fadd];return _0x5c9664;};'use strict';var ChatWebsiteEvents=require(_0x6a1b('0x0'));var events=[_0x6a1b('0x1'),'remove',_0x6a1b('0x2')];function createListener(_0x2ebbae,_0x3e193a){return function(_0x4cc1a6){_0x3e193a[_0x6a1b('0x3')](_0x2ebbae,_0x4cc1a6);};}function removeListener(_0x1d85d7,_0x24ddbe){return function(){ChatWebsiteEvents[_0x6a1b('0x4')](_0x1d85d7,_0x24ddbe);};}exports[_0x6a1b('0x5')]=function(_0x44409c){for(var _0x241ed5=0x0,_0x4361a7=events[_0x6a1b('0x6')];_0x241ed5<_0x4361a7;_0x241ed5++){var _0x45c858=events[_0x241ed5];var _0x34cca7=createListener('chatWebsite:'+_0x45c858,_0x44409c);ChatWebsiteEvents['on'](_0x45c858,_0x34cca7);}}; \ No newline at end of file +var _0xad82=['emit','removeListener','register','chatWebsite:','save','remove'];(function(_0x53da4f,_0x220e8d){var _0x23ef2c=function(_0x424422){while(--_0x424422){_0x53da4f['push'](_0x53da4f['shift']());}};_0x23ef2c(++_0x220e8d);}(_0xad82,0x1d2));var _0x2ad8=function(_0x38b1fe,_0x53aedb){_0x38b1fe=_0x38b1fe-0x0;var _0x1b3f86=_0xad82[_0x38b1fe];return _0x1b3f86;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x2ad8('0x0'),_0x2ad8('0x1'),'update'];function createListener(_0x1c8bca,_0x24e60d){return function(_0x1dfcd2){_0x24e60d[_0x2ad8('0x2')](_0x1c8bca,_0x1dfcd2);};}function removeListener(_0x377222,_0xf936da){return function(){ChatWebsiteEvents[_0x2ad8('0x3')](_0x377222,_0xf936da);};}exports[_0x2ad8('0x4')]=function(_0x3dd7a4){for(var _0x542027=0x0,_0x2261b3=events['length'];_0x542027<_0x2261b3;_0x542027++){var _0x3c5cbb=events[_0x542027];var _0x397838=createListener(_0x2ad8('0x5')+_0x3c5cbb,_0x3dd7a4);ChatWebsiteEvents['on'](_0x3c5cbb,_0x397838);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index d766766..3443335 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 _0x9b73=['addApplications','addProactiveActions','/:id/users','put','destroy','delete','removeDispositions','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/snippet','getSnippet','getApplications','getProactiveActions','/:id/fields','/:id/offline_messages','getAgents','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','now','/:id/logo','single','file','addLogo','server/files/images/avatars/','format','%s-%s','originalname','addCustomerAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','/:id/interactions','/:id/applications'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9b73,0x160));var _0x39b7=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9b73[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x39b7('0x0'));var util=require(_0x39b7('0x1'));var path=require('path');var timeout=require(_0x39b7('0x2'));var express=require(_0x39b7('0x3'));var router=express[_0x39b7('0x4')]();var fs_extra=require(_0x39b7('0x5'));var auth=require(_0x39b7('0x6'));var interaction=require(_0x39b7('0x7'));var config=require(_0x39b7('0x8'));var controller=require(_0x39b7('0x9'));router[_0x39b7('0xa')]('/',auth[_0x39b7('0xb')](),controller[_0x39b7('0xc')]);router[_0x39b7('0xa')]('/describe',auth[_0x39b7('0xb')](),controller[_0x39b7('0xd')]);router[_0x39b7('0xa')](_0x39b7('0xe'),auth[_0x39b7('0xb')](),controller['show']);router['get'](_0x39b7('0xf'),auth[_0x39b7('0xb')](),controller[_0x39b7('0x10')]);router['get'](_0x39b7('0x11'),auth[_0x39b7('0xb')](),controller[_0x39b7('0x12')]);router['get']('/:id/logo',controller[_0x39b7('0x13')]);router[_0x39b7('0xa')](_0x39b7('0x14'),controller[_0x39b7('0x15')]);router[_0x39b7('0xa')](_0x39b7('0x16'),controller[_0x39b7('0x17')]);router[_0x39b7('0xa')](_0x39b7('0x18'),controller[_0x39b7('0x19')]);router[_0x39b7('0xa')]('/:id/interactions',auth[_0x39b7('0xb')](),controller['getInteractions']);router['get'](_0x39b7('0x1a'),controller[_0x39b7('0x1b')]);router[_0x39b7('0xa')]('/:id/applications',auth[_0x39b7('0xb')](),controller[_0x39b7('0x1c')]);router[_0x39b7('0xa')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x39b7('0x1d')]);router['get'](_0x39b7('0x1e'),controller['getFields']);router[_0x39b7('0xa')](_0x39b7('0x1f'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x39b7('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x39b7('0x20')]);router[_0x39b7('0x21')]('/',auth[_0x39b7('0xb')](),controller['create']);router[_0x39b7('0x21')](_0x39b7('0xf'),auth[_0x39b7('0xb')](),controller[_0x39b7('0x22')]);router['post'](_0x39b7('0x11'),auth[_0x39b7('0xb')](),controller[_0x39b7('0x23')]);var upload=multer({'storage':multer[_0x39b7('0x24')]({'destination':function(_0x1fdb89,_0x416f5e,_0x25ae48){_0x25ae48(null,path[_0x39b7('0x25')](config[_0x39b7('0x26')],_0x39b7('0x27')));},'filename':function(_0x1a5f7d,_0x53dcca,_0x524303){_0x524303(null,util['format']('%s-%s',Date[_0x39b7('0x28')](),_0x53dcca['originalname']));}})});router['post'](_0x39b7('0x29'),upload[_0x39b7('0x2a')](_0x39b7('0x2b')),controller[_0x39b7('0x2c')]);var upload=multer({'storage':multer[_0x39b7('0x24')]({'destination':function(_0xcc6327,_0x15dec6,_0x2ec886){_0x2ec886(null,path[_0x39b7('0x25')](config[_0x39b7('0x26')],_0x39b7('0x2d')));},'filename':function(_0x38ace7,_0x25fa1,_0x33b757){_0x33b757(null,util[_0x39b7('0x2e')](_0x39b7('0x2f'),Date[_0x39b7('0x28')](),_0x25fa1[_0x39b7('0x30')]));}})});router[_0x39b7('0x21')]('/:id/avatar',upload[_0x39b7('0x2a')](_0x39b7('0x2b')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x471d67,_0x65f951,_0x23f7d5){_0x23f7d5(null,path[_0x39b7('0x25')](config[_0x39b7('0x26')],_0x39b7('0x2d')));},'filename':function(_0x44e37d,_0xd1efa5,_0x9fce05){_0x9fce05(null,util['format'](_0x39b7('0x2f'),Date[_0x39b7('0x28')](),_0xd1efa5['originalname']));}})});router[_0x39b7('0x21')](_0x39b7('0x16'),upload[_0x39b7('0x2a')](_0x39b7('0x2b')),controller[_0x39b7('0x31')]);var upload=multer({'storage':multer[_0x39b7('0x24')]({'destination':function(_0x2709ba,_0x56a0e3,_0x191763){_0x191763(null,path[_0x39b7('0x25')](config[_0x39b7('0x26')],_0x39b7('0x2d')));},'filename':function(_0x2d91d8,_0x58fa03,_0x7c3f32){_0x7c3f32(null,util[_0x39b7('0x2e')](_0x39b7('0x2f'),Date[_0x39b7('0x28')](),_0x58fa03[_0x39b7('0x30')]));}})});router[_0x39b7('0x21')](_0x39b7('0x18'),upload[_0x39b7('0x2a')](_0x39b7('0x2b')),controller['addSystemAvatar']);router[_0x39b7('0x21')](_0x39b7('0x32'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x16ab0e,_0x50a7f1,_0x2b2af3){const _0x5efeda=path['join'](config[_0x39b7('0x26')],_0x39b7('0x33'),_0x39b7('0x34'),_0x39b7('0x35'));fs_extra[_0x39b7('0x36')](_0x5efeda,function(){_0x2b2af3(null,_0x5efeda);});},'filename':function(_0x4375b0,_0x3c16d0,_0x282bc7){const _0x5880e1=_0x3c16d0[_0x39b7('0x30')][_0x39b7('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4b5d8a=path[_0x39b7('0x38')](_0x5880e1);const _0x10c640=Date[_0x39b7('0x28')]()+'-'+_0x5880e1[_0x39b7('0x37')](_0x4b5d8a,'')+_0x4b5d8a;_0x282bc7(null,_0x10c640);}})});router[_0x39b7('0x21')](_0x39b7('0x39'),offlineUploadMulter[_0x39b7('0x3a')](),controller[_0x39b7('0x3b')]);router[_0x39b7('0x21')](_0x39b7('0x3c'),auth[_0x39b7('0xb')](),controller['addInteraction']);router[_0x39b7('0x21')](_0x39b7('0x3d'),auth[_0x39b7('0xb')](),controller[_0x39b7('0x3e')]);router['post']('/:id/proactive_actions',auth[_0x39b7('0xb')](),controller[_0x39b7('0x3f')]);router[_0x39b7('0x21')](_0x39b7('0x40'),auth['isAuthenticated'](),controller['addAgents']);router[_0x39b7('0x41')](_0x39b7('0xe'),auth[_0x39b7('0xb')](),controller['update']);router['delete']('/:id',auth[_0x39b7('0xb')](),controller[_0x39b7('0x42')]);router[_0x39b7('0x43')](_0x39b7('0xf'),auth[_0x39b7('0xb')](),controller[_0x39b7('0x44')]);router[_0x39b7('0x43')](_0x39b7('0x11'),auth[_0x39b7('0xb')](),controller['removeAnswers']);router[_0x39b7('0x43')](_0x39b7('0x40'),auth[_0x39b7('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x0559=['create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','post','addAvatar','server/files/images/avatars/','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','put','update','/:id','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getFields','/:id/offline_messages','getOfflineMessages','getAgents'];(function(_0x576a33,_0x3806f7){var _0xa0f5de=function(_0x90905){while(--_0x90905){_0x576a33['push'](_0x576a33['shift']());}};_0xa0f5de(++_0x3806f7);}(_0x0559,0x74));var _0x9055=function(_0x49157b,_0x5d8601){_0x49157b=_0x49157b-0x0;var _0x3ea5d4=_0x0559[_0x49157b];return _0x3ea5d4;};'use strict';var multer=require(_0x9055('0x0'));var util=require('util');var path=require(_0x9055('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9055('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9055('0x3'));var interaction=require(_0x9055('0x4'));var config=require(_0x9055('0x5'));var controller=require(_0x9055('0x6'));router[_0x9055('0x7')]('/',auth['isAuthenticated'](),controller[_0x9055('0x8')]);router[_0x9055('0x7')](_0x9055('0x9'),auth[_0x9055('0xa')](),controller[_0x9055('0xb')]);router[_0x9055('0x7')]('/:id',auth[_0x9055('0xa')](),controller[_0x9055('0xc')]);router[_0x9055('0x7')](_0x9055('0xd'),auth['isAuthenticated'](),controller[_0x9055('0xe')]);router[_0x9055('0x7')](_0x9055('0xf'),auth['isAuthenticated'](),controller[_0x9055('0x10')]);router[_0x9055('0x7')](_0x9055('0x11'),controller[_0x9055('0x12')]);router[_0x9055('0x7')](_0x9055('0x13'),controller[_0x9055('0x14')]);router['get'](_0x9055('0x15'),controller['getCustomerAvatar']);router['get']('/:id/system_avatar',controller['getSystemAvatar']);router['get'](_0x9055('0x16'),auth[_0x9055('0xa')](),controller[_0x9055('0x17')]);router['get'](_0x9055('0x18'),controller['getSnippet']);router['get'](_0x9055('0x19'),auth[_0x9055('0xa')](),controller[_0x9055('0x1a')]);router[_0x9055('0x7')](_0x9055('0x1b'),auth[_0x9055('0xa')](),controller['getProactiveActions']);router[_0x9055('0x7')]('/:id/fields',controller[_0x9055('0x1c')]);router['get'](_0x9055('0x1d'),auth['isAuthenticated'](),controller[_0x9055('0x1e')]);router['get']('/:id/users',auth[_0x9055('0xa')](),controller[_0x9055('0x1f')]);router['post']('/',auth[_0x9055('0xa')](),controller[_0x9055('0x20')]);router['post']('/:id/dispositions',auth[_0x9055('0xa')](),controller[_0x9055('0x21')]);router['post']('/:id/canned_answers',auth[_0x9055('0xa')](),controller[_0x9055('0x22')]);var upload=multer({'storage':multer[_0x9055('0x23')]({'destination':function(_0x34c28f,_0x53adb6,_0x1b9869){_0x1b9869(null,path[_0x9055('0x24')](config[_0x9055('0x25')],_0x9055('0x26')));},'filename':function(_0x568fba,_0x54b704,_0x3aa724){_0x3aa724(null,util[_0x9055('0x27')](_0x9055('0x28'),Date[_0x9055('0x29')](),_0x54b704[_0x9055('0x2a')]));}})});router['post']('/:id/logo',upload[_0x9055('0x2b')](_0x9055('0x2c')),controller[_0x9055('0x2d')]);var upload=multer({'storage':multer[_0x9055('0x23')]({'destination':function(_0x4643ca,_0x25c85c,_0x5a6fe5){_0x5a6fe5(null,path[_0x9055('0x24')](config[_0x9055('0x25')],'server/files/images/avatars/'));},'filename':function(_0xe0af74,_0x2546e1,_0x5b4352){_0x5b4352(null,util[_0x9055('0x27')](_0x9055('0x28'),Date['now'](),_0x2546e1[_0x9055('0x2a')]));}})});router[_0x9055('0x2e')](_0x9055('0x13'),upload[_0x9055('0x2b')](_0x9055('0x2c')),controller[_0x9055('0x2f')]);var upload=multer({'storage':multer[_0x9055('0x23')]({'destination':function(_0x55fd82,_0x3f763b,_0x211d55){_0x211d55(null,path[_0x9055('0x24')](config[_0x9055('0x25')],_0x9055('0x30')));},'filename':function(_0x3eada6,_0x1ec793,_0x3028b5){_0x3028b5(null,util[_0x9055('0x27')]('%s-%s',Date[_0x9055('0x29')](),_0x1ec793[_0x9055('0x2a')]));}})});router[_0x9055('0x2e')](_0x9055('0x15'),upload[_0x9055('0x2b')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5afe9c,_0x1ba515,_0x128213){_0x128213(null,path[_0x9055('0x24')](config[_0x9055('0x25')],_0x9055('0x30')));},'filename':function(_0x14e646,_0x1f3b4e,_0x50aa93){_0x50aa93(null,util[_0x9055('0x27')](_0x9055('0x28'),Date[_0x9055('0x29')](),_0x1f3b4e['originalname']));}})});router[_0x9055('0x2e')](_0x9055('0x31'),upload[_0x9055('0x2b')]('file'),controller[_0x9055('0x32')]);router['post'](_0x9055('0x33'),controller[_0x9055('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0x9055('0x23')]({'destination':function(_0x186025,_0x189359,_0x1637b9){const _0x54baf2=path[_0x9055('0x24')](config['root'],'server/files',_0x9055('0x35'),_0x9055('0x36'));fs_extra[_0x9055('0x37')](_0x54baf2,function(){_0x1637b9(null,_0x54baf2);});},'filename':function(_0x509b96,_0x410f0c,_0x245820){const _0xa4a15c=_0x410f0c[_0x9055('0x2a')][_0x9055('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x38ce4a=path[_0x9055('0x39')](_0xa4a15c);const _0x4ee67d=Date[_0x9055('0x29')]()+'-'+_0xa4a15c['replace'](_0x38ce4a,'')+_0x38ce4a;_0x245820(null,_0x4ee67d);}})});router[_0x9055('0x2e')](_0x9055('0x3a'),offlineUploadMulter[_0x9055('0x3b')](),controller[_0x9055('0x3c')]);router[_0x9055('0x2e')]('/:id/interactions',auth[_0x9055('0xa')](),controller[_0x9055('0x3d')]);router[_0x9055('0x2e')]('/:id/applications',auth[_0x9055('0xa')](),controller[_0x9055('0x3e')]);router[_0x9055('0x2e')](_0x9055('0x1b'),auth[_0x9055('0xa')](),controller[_0x9055('0x3f')]);router[_0x9055('0x2e')](_0x9055('0x40'),auth[_0x9055('0xa')](),controller[_0x9055('0x41')]);router[_0x9055('0x42')]('/:id',auth[_0x9055('0xa')](),controller[_0x9055('0x43')]);router['delete'](_0x9055('0x44'),auth[_0x9055('0xa')](),controller['destroy']);router[_0x9055('0x45')]('/:id/dispositions',auth[_0x9055('0xa')](),controller[_0x9055('0x46')]);router[_0x9055('0x45')](_0x9055('0xf'),auth[_0x9055('0xa')](),controller[_0x9055('0x47')]);router[_0x9055('0x45')](_0x9055('0x40'),auth[_0x9055('0xa')](),controller[_0x9055('0x48')]);module[_0x9055('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 dce420c..d9719d4 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 _0xd239=['client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs','use','express','../components/auth/service','../config/environment','Router','env','production','app','get'];(function(_0x4b82ed,_0x5dffe4){var _0x5552b3=function(_0x48716f){while(--_0x48716f){_0x4b82ed['push'](_0x4b82ed['shift']());}};_0x5552b3(++_0x5dffe4);}(_0xd239,0xb8));var _0x9d23=function(_0xe98508,_0x17f727){_0xe98508=_0xe98508-0x0;var _0x21f63e=_0xd239[_0xe98508];return _0x21f63e;};var beaverLogger=require('beaver-logger/server');var express=require(_0x9d23('0x0'));var auth=require(_0x9d23('0x1'));var config=require(_0x9d23('0x2'));var router=express[_0x9d23('0x3')]();var isProduction=config[_0x9d23('0x4')]===_0x9d23('0x5')||![];function clientSideLogs(_0x5629bf,_0x4591a2,_0x3d51f6){var _0x433936=_0x5629bf[_0x9d23('0x6')][_0x9d23('0x7')](_0x9d23('0x8'));if(!_0x433936){throw new Error(_0x9d23('0x9'));}return beaverLogger['expressEndpoint']({'uri':_0x9d23('0xa'),'logger':_0x433936,'enableCors':!isProduction})(_0x5629bf,_0x4591a2,_0x3d51f6);}router[_0x9d23('0xb')](auth['isAuthenticated'](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0xf576=['beaver-logger/server','express','../config/environment','production','app','get','expressEndpoint','/client-logs','use','isAuthenticated','exports'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xf576,0x16b));var _0x6f57=function(_0x1c24fb,_0x196918){_0x1c24fb=_0x1c24fb-0x0;var _0x2a7514=_0xf576[_0x1c24fb];return _0x2a7514;};var beaverLogger=require(_0x6f57('0x0'));var express=require(_0x6f57('0x1'));var auth=require('../components/auth/service');var config=require(_0x6f57('0x2'));var router=express['Router']();var isProduction=config['env']===_0x6f57('0x3')||![];function clientSideLogs(_0x292bbb,_0x390345,_0x454393){var _0x5dab7c=_0x292bbb[_0x6f57('0x4')][_0x6f57('0x5')]('client-side-logger');if(!_0x5dab7c){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x6f57('0x6')]({'uri':_0x6f57('0x7'),'logger':_0x5dab7c,'enableCors':!isProduction})(_0x292bbb,_0x390345,_0x454393);}router[_0x6f57('0x8')](auth[_0x6f57('0x9')](),clientSideLogs);module[_0x6f57('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 b035627..6a7765a 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 _0x1ba4=['MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT'];(function(_0x1a2581,_0x44dab6){var _0x21ef3e=function(_0x26839e){while(--_0x26839e){_0x1a2581['push'](_0x1a2581['shift']());}};_0x21ef3e(++_0x44dab6);}(_0x1ba4,0x1f2));var _0x41ba=function(_0x3e1c52,_0x49c450){_0x3e1c52=_0x3e1c52-0x0;var _0x402b68=_0x1ba4[_0x3e1c52];return _0x402b68;};'use strict';var Sequelize=require(_0x41ba('0x0'));module[_0x41ba('0x1')]={'name':{'type':Sequelize[_0x41ba('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x41ba('0x3')]('AmazonAWS',_0x41ba('0x4'),_0x41ba('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x41ba('0x6'),_0x41ba('0x7'))},'data1':{'type':Sequelize[_0x41ba('0x2')],'comment':_0x41ba('0x8')},'data2':{'type':Sequelize[_0x41ba('0x2')],'comment':_0x41ba('0x9')},'data3':{'type':Sequelize[_0x41ba('0x2')],'comment':_0x41ba('0xa')},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x41ba('0xb')],'comment':_0x41ba('0xc')},'data6':{'type':Sequelize[_0x41ba('0xb')],'comment':_0x41ba('0xd')},'data7':{'type':Sequelize['TEXT'],'comment':_0x41ba('0xe')}}; \ No newline at end of file +var _0xa2e6=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','MicrosoftAzure','Dynamics365','STRING','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x367b27,_0x276028){var _0x40458c=function(_0x4b93cf){while(--_0x4b93cf){_0x367b27['push'](_0x367b27['shift']());}};_0x40458c(++_0x276028);}(_0xa2e6,0xdd));var _0x6a2e=function(_0x5ce636,_0xbbc513){_0x5ce636=_0x5ce636-0x0;var _0x5d6cbc=_0xa2e6[_0x5ce636];return _0x5d6cbc;};'use strict';var Sequelize=require(_0x6a2e('0x0'));module[_0x6a2e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x6a2e('0x2')]('AmazonAWS','Google',_0x6a2e('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x6a2e('0x2')]('Outlook365',_0x6a2e('0x4'))},'data1':{'type':Sequelize[_0x6a2e('0x5')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x6a2e('0x5')],'comment':_0x6a2e('0x6')},'data3':{'type':Sequelize[_0x6a2e('0x5')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x6a2e('0x5')],'comment':_0x6a2e('0x7')},'data5':{'type':Sequelize[_0x6a2e('0x8')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize['TEXT'],'comment':_0x6a2e('0x9')},'data7':{'type':Sequelize[_0x6a2e('0x8')],'comment':_0x6a2e('0xa')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 2290e99..da6498e 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 _0x3043=['find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','findOne','generateMicrosoftAuthorizationUrl','user','state','Invalid\x20state\x20parameter','from','base64','toString','ascii','parse','id_token','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','error','Invalid\x20authentication\x20state\x20parameter','stringify','ioredis','../../components/parsers/qs','../../config/environment','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','set','update','then','destroy','name','send','padEnd','index','map','CloudProvider','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','length','merge'];(function(_0x2cd591,_0x3a63c4){var _0x35b3ec=function(_0x729003){while(--_0x729003){_0x2cd591['push'](_0x2cd591['shift']());}};_0x35b3ec(++_0x3a63c4);}(_0x3043,0x81));var _0x3304=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0x3043[_0x609988];return _0x159984;};'use strict';var _=require('lodash');var Redis=require(_0x3304('0x0'));var qs=require(_0x3304('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0x3304('0x2'));var logger=require('../../config/logger')('api');var db=require('../../mysqldb')['db'];var oauth=require(_0x3304('0x3'));config[_0x3304('0x4')]=_[_0x3304('0x5')](config[_0x3304('0x4')],{'host':_0x3304('0x6'),'port':0x18eb});var socket=require(_0x3304('0x7'))(new Redis(config[_0x3304('0x4')]));var redis=new Redis(config[_0x3304('0x4')]);function respondWithStatusCode(_0x3c4768,_0x15032b){_0x15032b=_0x15032b||0xcc;return function(_0x1bafe9){if(_0x1bafe9){return _0x3c4768[_0x3304('0x8')](_0x15032b);}return _0x3c4768[_0x3304('0x9')](_0x15032b)[_0x3304('0xa')]();};}function respondWithResult(_0x595c0d,_0x1753a6){_0x1753a6=_0x1753a6||0xc8;return function(_0x7748d1){if(_0x7748d1){return _0x595c0d[_0x3304('0x9')](_0x1753a6)[_0x3304('0xb')](_0x7748d1);}};}function respondWithFilteredResult(_0x575427,_0x36b7b7){return function(_0x98cf52){if(_0x98cf52){var _0x16c7f7=typeof _0x36b7b7[_0x3304('0xc')]==='undefined'&&typeof _0x36b7b7[_0x3304('0xd')]===_0x3304('0xe');var _0x155267=_0x98cf52['count'];var _0x2ac77b=_0x16c7f7?0x0:_0x36b7b7[_0x3304('0xc')];var _0x5341fa=_0x16c7f7?_0x98cf52[_0x3304('0xf')]:_0x36b7b7['offset']+_0x36b7b7[_0x3304('0xd')];var _0x5c640a;if(_0x5341fa>=_0x155267){_0x5341fa=_0x155267;_0x5c640a=0xc8;}else{_0x5c640a=0xce;}_0x575427[_0x3304('0x9')](_0x5c640a);return _0x575427[_0x3304('0x10')]('Content-Range',_0x2ac77b+'-'+_0x5341fa+'/'+_0x155267)['json'](_0x98cf52);}return null;};}function saveUpdates(_0x958379){return function(_0x492257){if(_0x492257){return _0x492257[_0x3304('0x11')](_0x958379)[_0x3304('0x12')](function(_0x2467e2){return _0x2467e2;});}return null;};}function removeEntity(_0x1c1041){return function(_0x1388a8){if(_0x1388a8){return _0x1388a8[_0x3304('0x13')]()[_0x3304('0x12')](function(){_0x1c1041[_0x3304('0x9')](0xcc)[_0x3304('0xa')]();});}};}function handleEntityNotFound(_0xf27613){return function(_0xdb4938){if(!_0xdb4938){_0xf27613[_0x3304('0x8')](0x194);}return _0xdb4938;};}function handleError(_0x498bf5,_0xbdc8aa){_0xbdc8aa=_0xbdc8aa||0x1f4;return function(_0x42604c){logger['error'](_0x42604c['stack']);if(_0x42604c[_0x3304('0x14')]){delete _0x42604c[_0x3304('0x14')];}_0x498bf5[_0x3304('0x9')](_0xbdc8aa)[_0x3304('0x15')](_0x42604c);};}function maskClientSecret(_0x4ee5ff){return _[_0x3304('0x16')](_0x4ee5ff['slice'](0x0,0x3),0x14,'*');}exports[_0x3304('0x17')]=function(_0xafb007,_0x11ca30){var _0xd082ad={},_0x397ed3={},_0x50fb52={'count':0x0,'rows':[]};var _0x3ebbd8=_[_0x3304('0x18')](db[_0x3304('0x19')][_0x3304('0x1a')],function(_0x5ecdf5){return{'name':_0x5ecdf5['fieldName'],'type':_0x5ecdf5[_0x3304('0x1b')][_0x3304('0x1c')]};});_0x397ed3[_0x3304('0x1d')]=_['map'](_0x3ebbd8,_0x3304('0x14'));_0x397ed3[_0x3304('0x1e')]=_['keys'](_0xafb007['query']);_0x397ed3[_0x3304('0x1f')]=_['intersection'](_0x397ed3[_0x3304('0x1d')],_0x397ed3[_0x3304('0x1e')]);_0xd082ad[_0x3304('0x20')]=_[_0x3304('0x21')](_0x397ed3[_0x3304('0x1d')],qs[_0x3304('0x22')](_0xafb007['query'][_0x3304('0x22')]));_0xd082ad[_0x3304('0x20')]=_0xd082ad[_0x3304('0x20')]['length']?_0xd082ad['attributes']:_0x397ed3['model'];if(!_0xafb007[_0x3304('0x1e')][_0x3304('0x23')](_0x3304('0x24'))){_0xd082ad[_0x3304('0xd')]=qs[_0x3304('0xd')](_0xafb007[_0x3304('0x1e')][_0x3304('0xd')]);_0xd082ad[_0x3304('0xc')]=qs[_0x3304('0xc')](_0xafb007[_0x3304('0x1e')]['offset']);}_0xd082ad[_0x3304('0x25')]=qs[_0x3304('0x26')](_0xafb007['query'][_0x3304('0x26')]);_0xd082ad[_0x3304('0x27')]=qs[_0x3304('0x1f')](_[_0x3304('0x28')](_0xafb007['query'],_0x397ed3[_0x3304('0x1f')]),_0x3ebbd8);if(_0xafb007[_0x3304('0x1e')][_0x3304('0x29')]){_0xd082ad['where']=_['merge'](_0xd082ad[_0x3304('0x27')],{'$or':_[_0x3304('0x18')](_0x3ebbd8,function(_0x35aeb2){if(_0x35aeb2[_0x3304('0x1b')]!=='VIRTUAL'){var _0x50471a={};_0x50471a[_0x35aeb2['name']]={'$like':'%'+_0xafb007[_0x3304('0x1e')][_0x3304('0x29')]+'%'};return _0x50471a;}})});}_0xd082ad=_['merge']({},_0xd082ad,_0xafb007[_0x3304('0x2a')]);var _0x58664={'where':_0xd082ad[_0x3304('0x27')]};return db[_0x3304('0x19')]['count'](_0x58664)[_0x3304('0x12')](function(_0x3840c8){_0x50fb52[_0x3304('0xf')]=_0x3840c8;if(_0xafb007[_0x3304('0x1e')][_0x3304('0x2b')]){_0xd082ad[_0x3304('0x2c')]=[{'all':!![]}];}return db['CloudProvider'][_0x3304('0x2d')](_0xd082ad);})[_0x3304('0x12')](function(_0x19eb02){_0x50fb52[_0x3304('0x2e')]=_[_0x3304('0x18')](_0x19eb02,function(_0x91c6bd){if(_0x91c6bd[_0x3304('0x2f')]===_0x3304('0x30')){var _0x1a244f=encryptor[_0x3304('0x31')](_0x91c6bd['data3']);_0x91c6bd[_0x3304('0x32')]=maskClientSecret(_0x1a244f);}return _0x91c6bd;});return _0x50fb52;})[_0x3304('0x12')](respondWithFilteredResult(_0x11ca30,_0xd082ad))[_0x3304('0x33')](handleError(_0x11ca30,null));};exports[_0x3304('0x34')]=function(_0x528c9b,_0x4d0c96){var _0x363214={'raw':!![],'where':{'id':_0x528c9b[_0x3304('0x35')]['id']}},_0x4bb35d={};_0x4bb35d['model']=_[_0x3304('0x36')](db[_0x3304('0x19')]['rawAttributes']);_0x4bb35d['query']=_[_0x3304('0x36')](_0x528c9b[_0x3304('0x1e')]);_0x4bb35d[_0x3304('0x1f')]=_['intersection'](_0x4bb35d[_0x3304('0x1d')],_0x4bb35d[_0x3304('0x1e')]);_0x363214[_0x3304('0x20')]=_[_0x3304('0x21')](_0x4bb35d[_0x3304('0x1d')],qs[_0x3304('0x22')](_0x528c9b['query'][_0x3304('0x22')]));_0x363214['attributes']=_0x363214[_0x3304('0x20')][_0x3304('0x37')]?_0x363214[_0x3304('0x20')]:_0x4bb35d[_0x3304('0x1d')];if(_0x528c9b[_0x3304('0x1e')]['includeAll']){_0x363214[_0x3304('0x2c')]=[{'all':!![]}];}_0x363214=_[_0x3304('0x38')]({},_0x363214,_0x528c9b[_0x3304('0x2a')]);return db[_0x3304('0x19')][_0x3304('0x39')](_0x363214)['then'](handleEntityNotFound(_0x4d0c96,null))['then'](function(_0x2a603d){if(_0x2a603d[_0x3304('0x2f')]===_0x3304('0x30')){var _0xb32390=encryptor[_0x3304('0x31')](_0x2a603d[_0x3304('0x32')]);_0x2a603d[_0x3304('0x32')]=maskClientSecret(_0xb32390);}return _0x2a603d;})[_0x3304('0x12')](respondWithResult(_0x4d0c96,null))['catch'](handleError(_0x4d0c96,null));};exports[_0x3304('0x3a')]=function(_0x1fc7fa,_0xecfc85){if(!_0x1fc7fa[_0x3304('0x3b')][_0x3304('0x14')])throw new Error(_0x3304('0x3c'));if(!_0x1fc7fa[_0x3304('0x3b')][_0x3304('0x2f')])throw new Error(_0x3304('0x3d'));var _0x58f2e9=db[_0x3304('0x19')][_0x3304('0x1a')][_0x3304('0x2f')][_0x3304('0x3e')];if(!_0x58f2e9[_0x3304('0x3f')](_0x1fc7fa[_0x3304('0x3b')][_0x3304('0x2f')]))throw new Error(_0x3304('0x40')+_0x58f2e9[_0x3304('0x41')](',\x20'));if(_0x1fc7fa[_0x3304('0x3b')]['service']===_0x3304('0x30')&&_0x1fc7fa[_0x3304('0x3b')][_0x3304('0x32')]){_0x1fc7fa[_0x3304('0x3b')][_0x3304('0x32')]=encryptor[_0x3304('0x42')](_0x1fc7fa['body'][_0x3304('0x32')]);}return db[_0x3304('0x19')][_0x3304('0x3a')](_0x1fc7fa['body'],{})[_0x3304('0x12')](respondWithResult(_0xecfc85,0xc9))[_0x3304('0x33')](handleError(_0xecfc85,null));};exports[_0x3304('0x11')]=function(_0x2e77ac,_0xf632fa){if(_0x2e77ac[_0x3304('0x3b')]['id']){delete _0x2e77ac[_0x3304('0x3b')]['id'];}return db[_0x3304('0x19')][_0x3304('0x39')]({'where':{'id':_0x2e77ac[_0x3304('0x35')]['id']}})[_0x3304('0x12')](handleEntityNotFound(_0xf632fa,null))['then'](function(_0x5656a5){if(_0x5656a5[_0x3304('0x2f')]===_0x3304('0x30')&&_0x2e77ac['body']['data3']){_0x2e77ac[_0x3304('0x3b')]['data3']=encryptor[_0x3304('0x42')](_0x2e77ac[_0x3304('0x3b')]['data3']);}return _0x5656a5;})[_0x3304('0x12')](saveUpdates(_0x2e77ac[_0x3304('0x3b')],null))['then'](respondWithResult(_0xf632fa,null))[_0x3304('0x33')](handleError(_0xf632fa,null));};exports[_0x3304('0x13')]=function(_0x7bfee4,_0x525960){return db['CloudProvider'][_0x3304('0x39')]({'where':{'id':_0x7bfee4[_0x3304('0x35')]['id']}})[_0x3304('0x12')](handleEntityNotFound(_0x525960,null))[_0x3304('0x12')](removeEntity(_0x525960,null))['catch'](handleError(_0x525960,null));};exports['oauth2MicrosoftAuthorize']=function(_0x2c277b,_0x464574){return db['CloudProvider'][_0x3304('0x43')]({'where':{'id':_0x2c277b[_0x3304('0x35')]['id']},'raw':!![]})[_0x3304('0x12')](function(_0x2958ff){if(!_0x2958ff)return _0x464574['sendStatus'](0x194);return{'url':oauth[_0x3304('0x44')](_0x2958ff,_0x2c277b[_0x3304('0x45')]['id'])};})[_0x3304('0x12')](respondWithResult(_0x464574,null))['catch'](handleError(_0x464574,null));};exports['oauth2MicrosoftCallback']=function(_0x330634,_0x2b4ce7){var _0x3154bb=_0x330634[_0x3304('0x3b')];var _0x1e8937;var _0x408e11;if(_0x3154bb['error'])throw _0x3154bb;redis['get'](_0x3154bb[_0x3304('0x46')])[_0x3304('0x12')](function(_0x34c494){if(!_0x34c494)throw new Error(_0x3304('0x47'));_0x1e8937=JSON['parse'](_0x34c494);var _0x3f88ea=Buffer[_0x3304('0x48')](_0x3154bb[_0x3304('0x46')],_0x3304('0x49'))[_0x3304('0x4a')](_0x3304('0x4b'));_0x408e11=JSON[_0x3304('0x4c')](_0x3f88ea);if(!oauth['isValidIdToken'](_0x3154bb[_0x3304('0x4d')],_0x1e8937['oauth2Claims']))throw new Error(_0x3304('0x4e'));redis[_0x3304('0x4f')](_0x3154bb[_0x3304('0x46')]);return oauth[_0x3304('0x50')](_0x3154bb[_0x3304('0x51')],_0x1e8937);})[_0x3304('0x12')](function(_0x419b61){_0x1e8937['data5']=_0x419b61[_0x3304('0x52')];_0x1e8937[_0x3304('0x53')]=_0x419b61[_0x3304('0x54')];return db[_0x3304('0x19')][_0x3304('0x11')]({'data5':_0x1e8937[_0x3304('0x55')],'data6':_0x1e8937[_0x3304('0x53')]},{'where':{'id':_0x1e8937['id']}});})[_0x3304('0x12')](function(){oauth[_0x3304('0x56')](_0x1e8937);socket[_0x3304('0x57')](_0x3304('0x58'),{'id':_0x408e11['id']});return;})[_0x3304('0x12')](respondWithStatusCode(_0x2b4ce7,null))[_0x3304('0x33')](function(_0x28eb9e){if(_0x408e11){socket[_0x3304('0x57')](_0x3304('0x59'),{'id':_0x408e11['id']});}if(!_0x1e8937){logger[_0x3304('0x5a')](_0x3304('0x5b'),_0x28eb9e);return _0x2b4ce7[_0x3304('0x9')](0x1f4)[_0x3304('0x15')](_0x28eb9e['message']);}logger[_0x3304('0x5a')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x1e8937['id'],JSON[_0x3304('0x5c')](_0x28eb9e));});}; \ No newline at end of file +var _0x4a49=['join','encryptString','params','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','error','Invalid\x20state\x20parameter','parse','state','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','access_token','refresh_token','update','data5','data6','startRefreshInterval','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','json','limit','count','offset','set','then','destroy','end','stack','name','send','padEnd','slice','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','CloudProvider','rows','service','decryptString','data3','catch','find','MicrosoftAzure','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'];(function(_0x44917a,_0x3014a7){var _0x5d277e=function(_0x111692){while(--_0x111692){_0x44917a['push'](_0x44917a['shift']());}};_0x5d277e(++_0x3014a7);}(_0x4a49,0x135));var _0x94a4=function(_0x348be8,_0x35e760){_0x348be8=_0x348be8-0x0;var _0x799938=_0x4a49[_0x348be8];return _0x799938;};'use strict';var _=require(_0x94a4('0x0'));var Redis=require(_0x94a4('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require(_0x94a4('0x2'));var logger=require(_0x94a4('0x3'))(_0x94a4('0x4'));var db=require(_0x94a4('0x5'))['db'];var oauth=require(_0x94a4('0x6'));config[_0x94a4('0x7')]=_['defaults'](config[_0x94a4('0x7')],{'host':_0x94a4('0x8'),'port':0x18eb});var socket=require(_0x94a4('0x9'))(new Redis(config['redis']));var redis=new Redis(config[_0x94a4('0x7')]);function respondWithStatusCode(_0x5d5889,_0x2acadd){_0x2acadd=_0x2acadd||0xcc;return function(_0x43864a){if(_0x43864a){return _0x5d5889[_0x94a4('0xa')](_0x2acadd);}return _0x5d5889[_0x94a4('0xb')](_0x2acadd)['end']();};}function respondWithResult(_0x158598,_0x5d88d3){_0x5d88d3=_0x5d88d3||0xc8;return function(_0x1a6706){if(_0x1a6706){return _0x158598['status'](_0x5d88d3)[_0x94a4('0xc')](_0x1a6706);}};}function respondWithFilteredResult(_0x51a126,_0x2ab7cc){return function(_0x18554c){if(_0x18554c){var _0x9a5643=typeof _0x2ab7cc['offset']==='undefined'&&typeof _0x2ab7cc[_0x94a4('0xd')]==='undefined';var _0x468831=_0x18554c[_0x94a4('0xe')];var _0x327fd1=_0x9a5643?0x0:_0x2ab7cc['offset'];var _0x5d720d=_0x9a5643?_0x18554c[_0x94a4('0xe')]:_0x2ab7cc[_0x94a4('0xf')]+_0x2ab7cc[_0x94a4('0xd')];var _0x1a8386;if(_0x5d720d>=_0x468831){_0x5d720d=_0x468831;_0x1a8386=0xc8;}else{_0x1a8386=0xce;}_0x51a126['status'](_0x1a8386);return _0x51a126[_0x94a4('0x10')]('Content-Range',_0x327fd1+'-'+_0x5d720d+'/'+_0x468831)[_0x94a4('0xc')](_0x18554c);}return null;};}function saveUpdates(_0x3f9551){return function(_0x11cf60){if(_0x11cf60){return _0x11cf60['update'](_0x3f9551)[_0x94a4('0x11')](function(_0x1a8c4b){return _0x1a8c4b;});}return null;};}function removeEntity(_0x1d24ca){return function(_0x3353df){if(_0x3353df){return _0x3353df[_0x94a4('0x12')]()[_0x94a4('0x11')](function(){_0x1d24ca[_0x94a4('0xb')](0xcc)[_0x94a4('0x13')]();});}};}function handleEntityNotFound(_0x5654ba){return function(_0x3e73aa){if(!_0x3e73aa){_0x5654ba[_0x94a4('0xa')](0x194);}return _0x3e73aa;};}function handleError(_0x477077,_0xb52f0e){_0xb52f0e=_0xb52f0e||0x1f4;return function(_0xcd32d5){logger['error'](_0xcd32d5[_0x94a4('0x14')]);if(_0xcd32d5[_0x94a4('0x15')]){delete _0xcd32d5[_0x94a4('0x15')];}_0x477077[_0x94a4('0xb')](_0xb52f0e)[_0x94a4('0x16')](_0xcd32d5);};}function maskClientSecret(_0x2f2057){return _[_0x94a4('0x17')](_0x2f2057[_0x94a4('0x18')](0x0,0x3),0x14,'*');}exports[_0x94a4('0x19')]=function(_0x418ccc,_0x5b9a38){var _0x2bd8cd={},_0xa3956c={},_0x1d9e7e={'count':0x0,'rows':[]};var _0x1ca454=_['map'](db['CloudProvider'][_0x94a4('0x1a')],function(_0x4ae60e){return{'name':_0x4ae60e[_0x94a4('0x1b')],'type':_0x4ae60e[_0x94a4('0x1c')][_0x94a4('0x1d')]};});_0xa3956c[_0x94a4('0x1e')]=_[_0x94a4('0x1f')](_0x1ca454,_0x94a4('0x15'));_0xa3956c[_0x94a4('0x20')]=_[_0x94a4('0x21')](_0x418ccc['query']);_0xa3956c[_0x94a4('0x22')]=_[_0x94a4('0x23')](_0xa3956c[_0x94a4('0x1e')],_0xa3956c[_0x94a4('0x20')]);_0x2bd8cd[_0x94a4('0x24')]=_[_0x94a4('0x23')](_0xa3956c[_0x94a4('0x1e')],qs[_0x94a4('0x25')](_0x418ccc['query']['fields']));_0x2bd8cd[_0x94a4('0x24')]=_0x2bd8cd[_0x94a4('0x24')][_0x94a4('0x26')]?_0x2bd8cd[_0x94a4('0x24')]:_0xa3956c[_0x94a4('0x1e')];if(!_0x418ccc[_0x94a4('0x20')][_0x94a4('0x27')](_0x94a4('0x28'))){_0x2bd8cd[_0x94a4('0xd')]=qs[_0x94a4('0xd')](_0x418ccc['query'][_0x94a4('0xd')]);_0x2bd8cd[_0x94a4('0xf')]=qs[_0x94a4('0xf')](_0x418ccc[_0x94a4('0x20')][_0x94a4('0xf')]);}_0x2bd8cd[_0x94a4('0x29')]=qs[_0x94a4('0x2a')](_0x418ccc[_0x94a4('0x20')][_0x94a4('0x2a')]);_0x2bd8cd['where']=qs['filters'](_['pick'](_0x418ccc[_0x94a4('0x20')],_0xa3956c[_0x94a4('0x22')]),_0x1ca454);if(_0x418ccc[_0x94a4('0x20')]['filter']){_0x2bd8cd[_0x94a4('0x2b')]=_['merge'](_0x2bd8cd[_0x94a4('0x2b')],{'$or':_[_0x94a4('0x1f')](_0x1ca454,function(_0x5dd1d0){if(_0x5dd1d0['type']!==_0x94a4('0x2c')){var _0xd9cd99={};_0xd9cd99[_0x5dd1d0['name']]={'$like':'%'+_0x418ccc['query'][_0x94a4('0x2d')]+'%'};return _0xd9cd99;}})});}_0x2bd8cd=_[_0x94a4('0x2e')]({},_0x2bd8cd,_0x418ccc[_0x94a4('0x2f')]);var _0xc09023={'where':_0x2bd8cd[_0x94a4('0x2b')]};return db['CloudProvider'][_0x94a4('0xe')](_0xc09023)[_0x94a4('0x11')](function(_0x53b4b4){_0x1d9e7e['count']=_0x53b4b4;if(_0x418ccc[_0x94a4('0x20')][_0x94a4('0x30')]){_0x2bd8cd['include']=[{'all':!![]}];}return db[_0x94a4('0x31')]['findAll'](_0x2bd8cd);})[_0x94a4('0x11')](function(_0xeb5166){_0x1d9e7e[_0x94a4('0x32')]=_[_0x94a4('0x1f')](_0xeb5166,function(_0x20ef00){if(_0x20ef00[_0x94a4('0x33')]==='MicrosoftAzure'){var _0x21631f=encryptor[_0x94a4('0x34')](_0x20ef00[_0x94a4('0x35')]);_0x20ef00[_0x94a4('0x35')]=maskClientSecret(_0x21631f);}return _0x20ef00;});return _0x1d9e7e;})[_0x94a4('0x11')](respondWithFilteredResult(_0x5b9a38,_0x2bd8cd))[_0x94a4('0x36')](handleError(_0x5b9a38,null));};exports['show']=function(_0x4547b1,_0x322282){var _0x38482c={'raw':!![],'where':{'id':_0x4547b1['params']['id']}},_0x5bbb09={};_0x5bbb09[_0x94a4('0x1e')]=_[_0x94a4('0x21')](db['CloudProvider'][_0x94a4('0x1a')]);_0x5bbb09[_0x94a4('0x20')]=_['keys'](_0x4547b1[_0x94a4('0x20')]);_0x5bbb09[_0x94a4('0x22')]=_[_0x94a4('0x23')](_0x5bbb09['model'],_0x5bbb09[_0x94a4('0x20')]);_0x38482c[_0x94a4('0x24')]=_[_0x94a4('0x23')](_0x5bbb09['model'],qs[_0x94a4('0x25')](_0x4547b1['query'][_0x94a4('0x25')]));_0x38482c['attributes']=_0x38482c[_0x94a4('0x24')][_0x94a4('0x26')]?_0x38482c[_0x94a4('0x24')]:_0x5bbb09[_0x94a4('0x1e')];if(_0x4547b1[_0x94a4('0x20')][_0x94a4('0x30')]){_0x38482c['include']=[{'all':!![]}];}_0x38482c=_[_0x94a4('0x2e')]({},_0x38482c,_0x4547b1[_0x94a4('0x2f')]);return db[_0x94a4('0x31')][_0x94a4('0x37')](_0x38482c)[_0x94a4('0x11')](handleEntityNotFound(_0x322282,null))[_0x94a4('0x11')](function(_0xced6d8){if(_0xced6d8[_0x94a4('0x33')]===_0x94a4('0x38')){var _0x23e3e2=encryptor[_0x94a4('0x34')](_0xced6d8[_0x94a4('0x35')]);_0xced6d8['data3']=maskClientSecret(_0x23e3e2);}return _0xced6d8;})[_0x94a4('0x11')](respondWithResult(_0x322282,null))[_0x94a4('0x36')](handleError(_0x322282,null));};exports['create']=function(_0x5f5444,_0x16da9f){if(!_0x5f5444[_0x94a4('0x39')][_0x94a4('0x15')])throw new Error(_0x94a4('0x3a'));if(!_0x5f5444[_0x94a4('0x39')][_0x94a4('0x33')])throw new Error(_0x94a4('0x3b'));var _0xe11037=db[_0x94a4('0x31')][_0x94a4('0x1a')][_0x94a4('0x33')][_0x94a4('0x3c')];if(!_0xe11037[_0x94a4('0x3d')](_0x5f5444['body'][_0x94a4('0x33')]))throw new Error(_0x94a4('0x3e')+_0xe11037[_0x94a4('0x3f')](',\x20'));if(_0x5f5444[_0x94a4('0x39')][_0x94a4('0x33')]==='MicrosoftAzure'&&_0x5f5444[_0x94a4('0x39')][_0x94a4('0x35')]){_0x5f5444['body']['data3']=encryptor[_0x94a4('0x40')](_0x5f5444[_0x94a4('0x39')]['data3']);}return db[_0x94a4('0x31')]['create'](_0x5f5444[_0x94a4('0x39')],{})[_0x94a4('0x11')](respondWithResult(_0x16da9f,0xc9))[_0x94a4('0x36')](handleError(_0x16da9f,null));};exports['update']=function(_0x290bc1,_0x8ca7f){if(_0x290bc1[_0x94a4('0x39')]['id']){delete _0x290bc1[_0x94a4('0x39')]['id'];}return db[_0x94a4('0x31')][_0x94a4('0x37')]({'where':{'id':_0x290bc1[_0x94a4('0x41')]['id']}})[_0x94a4('0x11')](handleEntityNotFound(_0x8ca7f,null))[_0x94a4('0x11')](function(_0x1e7cc0){if(_0x1e7cc0[_0x94a4('0x33')]===_0x94a4('0x38')&&_0x290bc1[_0x94a4('0x39')][_0x94a4('0x35')]){_0x290bc1[_0x94a4('0x39')][_0x94a4('0x35')]=encryptor[_0x94a4('0x40')](_0x290bc1[_0x94a4('0x39')][_0x94a4('0x35')]);}return _0x1e7cc0;})[_0x94a4('0x11')](saveUpdates(_0x290bc1[_0x94a4('0x39')],null))[_0x94a4('0x11')](respondWithResult(_0x8ca7f,null))[_0x94a4('0x36')](handleError(_0x8ca7f,null));};exports[_0x94a4('0x12')]=function(_0x2b4e55,_0x2f0a1f){return db[_0x94a4('0x31')][_0x94a4('0x37')]({'where':{'id':_0x2b4e55[_0x94a4('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f0a1f,null))[_0x94a4('0x11')](removeEntity(_0x2f0a1f,null))[_0x94a4('0x36')](handleError(_0x2f0a1f,null));};exports[_0x94a4('0x42')]=function(_0x1339df,_0x8d4683){return db[_0x94a4('0x31')][_0x94a4('0x43')]({'where':{'id':_0x1339df[_0x94a4('0x41')]['id']},'raw':!![]})[_0x94a4('0x11')](function(_0x50e45f){if(!_0x50e45f)return _0x8d4683[_0x94a4('0xa')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x50e45f,_0x1339df[_0x94a4('0x44')]['id'])};})[_0x94a4('0x11')](respondWithResult(_0x8d4683,null))[_0x94a4('0x36')](handleError(_0x8d4683,null));};exports[_0x94a4('0x45')]=function(_0x18201e,_0x233ddd){var _0x6a5d87=_0x18201e[_0x94a4('0x39')];var _0x5acfbb;var _0x23ba9d;if(_0x6a5d87[_0x94a4('0x46')])throw _0x6a5d87;redis['get'](_0x6a5d87['state'])['then'](function(_0x2f29d6){if(!_0x2f29d6)throw new Error(_0x94a4('0x47'));_0x5acfbb=JSON[_0x94a4('0x48')](_0x2f29d6);var _0x175e0d=Buffer['from'](_0x6a5d87[_0x94a4('0x49')],_0x94a4('0x4a'))[_0x94a4('0x4b')](_0x94a4('0x4c'));_0x23ba9d=JSON['parse'](_0x175e0d);if(!oauth[_0x94a4('0x4d')](_0x6a5d87[_0x94a4('0x4e')],_0x5acfbb[_0x94a4('0x4f')]))throw new Error(_0x94a4('0x50'));redis['del'](_0x6a5d87[_0x94a4('0x49')]);return oauth[_0x94a4('0x51')](_0x6a5d87[_0x94a4('0x52')],_0x5acfbb);})[_0x94a4('0x11')](function(_0x453677){_0x5acfbb['data5']=_0x453677[_0x94a4('0x53')];_0x5acfbb['data6']=_0x453677[_0x94a4('0x54')];return db[_0x94a4('0x31')][_0x94a4('0x55')]({'data5':_0x5acfbb[_0x94a4('0x56')],'data6':_0x5acfbb[_0x94a4('0x57')]},{'where':{'id':_0x5acfbb['id']}});})[_0x94a4('0x11')](function(){oauth[_0x94a4('0x58')](_0x5acfbb);socket['emit'](_0x94a4('0x59'),{'id':_0x23ba9d['id']});return;})['then'](respondWithStatusCode(_0x233ddd,null))[_0x94a4('0x36')](function(_0xb0e145){if(_0x23ba9d){socket['emit'](_0x94a4('0x5a'),{'id':_0x23ba9d['id']});}if(!_0x5acfbb){logger[_0x94a4('0x46')](_0x94a4('0x5b'),_0xb0e145);return _0x233ddd['status'](0x1f4)[_0x94a4('0x16')](_0xb0e145['message']);}logger[_0x94a4('0x46')](_0x94a4('0x5c'),_0x5acfbb['id'],JSON['stringify'](_0xb0e145));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 2144a60..0ed21e6 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 _0x8302=['cloud_providers','util','../../config/logger','api','request-promise','path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider'];(function(_0x4127e6,_0xbf2204){var _0x3f9211=function(_0x4cd4bc){while(--_0x4cd4bc){_0x4127e6['push'](_0x4127e6['shift']());}};_0x3f9211(++_0xbf2204);}(_0x8302,0xe8));var _0x2830=function(_0x5ec61d,_0x36c73c){_0x5ec61d=_0x5ec61d-0x0;var _0x2e0e5c=_0x8302[_0x5ec61d];return _0x2e0e5c;};'use strict';var _=require('lodash');var util=require(_0x2830('0x0'));var logger=require(_0x2830('0x1'))(_0x2830('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2830('0x3'));var fs=require('fs');var path=require(_0x2830('0x4'));var rimraf=require(_0x2830('0x5'));var config=require('../../config/environment');var attributes=require(_0x2830('0x6'));module[_0x2830('0x7')]=function(_0x1754e7,_0x50440c){return _0x1754e7[_0x2830('0x8')](_0x2830('0x9'),attributes,{'tableName':_0x2830('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1117=['moment','bluebird','request-promise','path','exports','define','CloudProvider','cloud_providers','lodash','api'];(function(_0x445c8b,_0x1a0cb6){var _0x58e3a5=function(_0x2638ad){while(--_0x2638ad){_0x445c8b['push'](_0x445c8b['shift']());}};_0x58e3a5(++_0x1a0cb6);}(_0x1117,0x1ac));var _0x7111=function(_0xd62e7a,_0xac4f19){_0xd62e7a=_0xd62e7a-0x0;var _0x1bf0c8=_0x1117[_0xd62e7a];return _0x1bf0c8;};'use strict';var _=require(_0x7111('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7111('0x1'));var moment=require(_0x7111('0x2'));var BPromise=require(_0x7111('0x3'));var rp=require(_0x7111('0x4'));var fs=require('fs');var path=require(_0x7111('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0x7111('0x6')]=function(_0x37dbdc,_0x9d12d1){return _0x37dbdc[_0x7111('0x7')](_0x7111('0x8'),attributes,{'tableName':_0x7111('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index c459283..f05fb01 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 _0xb8bd=['iss','aud','audience','unix','exp','resolve','then','data3','findOne','data6','decryptString','data5','access_token','refresh_token','CloudProvider','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','data4','POST','data2','intervals','bind','findAll','all','catch','inspect','exports','lodash','jsonwebtoken','moment','ioredis','request-promise','util','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','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','join','Outlook365','replace','{TENANT_ID}','code','stringify','toString','base64','randomBytes','hex','state','nonce','prompt','key','value','oauth2Claims','oauth2/','data1','set','payload'];(function(_0x396071,_0x5ce24a){var _0x16797e=function(_0x3f8aa5){while(--_0x3f8aa5){_0x396071['push'](_0x396071['shift']());}};_0x16797e(++_0x5ce24a);}(_0xb8bd,0x1ea));var _0xdb8b=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xb8bd[_0xc8a931];return _0x28bd27;};'use strict';var _=require(_0xdb8b('0x0'));var crypto=require('crypto');var jwt=require(_0xdb8b('0x1'));var moment=require(_0xdb8b('0x2'));var Redis=require(_0xdb8b('0x3'));var rp=require(_0xdb8b('0x4'));var util=require(_0xdb8b('0x5'));var encryptor=require('../../components/encryptor');var config=require(_0xdb8b('0x6'));var logger=require(_0xdb8b('0x7'))(_0xdb8b('0x8'));var schedule=require(_0xdb8b('0x9'));var db=require(_0xdb8b('0xa'))['db'];config[_0xdb8b('0xb')]=_[_0xdb8b('0xc')](config[_0xdb8b('0xb')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xdb8b('0xb')]);var MICROSOFT_AUTH_URL=_0xdb8b('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0xdb8b('0xe'),_0xdb8b('0xf'),_0xdb8b('0x10'),_0xdb8b('0x11'),_0xdb8b('0x12'),_0xdb8b('0x13'),_0xdb8b('0x14')],'Dynamics365':[_0xdb8b('0xe'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xdb8b('0x15');var MICROSOFT_TOKEN_ENDPOINT=_0xdb8b('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4bf6b6){var _0x55302d=_[_0xdb8b('0x17')](AZURE_AUTH_SCOPES[_0x4bf6b6[_0xdb8b('0x18')]]);if(_0x4bf6b6['type']===_0xdb8b('0x19'))_0x55302d[_0xdb8b('0x1a')](_0x4bf6b6[_0xdb8b('0x1b')]+_0xdb8b('0x1c'));return _0x55302d[_0xdb8b('0x1d')]('\x20');}function getAccessTokenScope(_0x42cdc1){if(_0x42cdc1['type']===_0xdb8b('0x1e'))return _0xdb8b('0x12');if(_0x42cdc1['type']===_0xdb8b('0x19'))return _0x42cdc1[_0xdb8b('0x1b')]+_0xdb8b('0x1c');}function generateMicrosoftAuthorizationUrl(_0x5601d8,_0x254877){var _0xf79c32=MICROSOFT_AUTH_URL[_0xdb8b('0x1f')](_0xdb8b('0x20'),_0x5601d8['data2']);var _0x11feb4=[_0xdb8b('0x21'),'id_token'];var _0x470110=Buffer['from'](JSON[_0xdb8b('0x22')]({'id':_0x254877}))[_0xdb8b('0x23')](_0xdb8b('0x24'));var _0x3b4a7c=crypto[_0xdb8b('0x25')](0x10)[_0xdb8b('0x23')](_0xdb8b('0x26'));var _0x1e8452=getAuthorizationScopes(_0x5601d8);var _0xe6883b=[{'key':'client_id','value':_0x5601d8['data1']},{'key':'response_type','value':encodeURIComponent(_0x11feb4['join']('\x20'))},{'key':'redirect_uri','value':_0x5601d8['data4']},{'key':'response_mode','value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x1e8452)},{'key':_0xdb8b('0x27'),'value':_0x470110},{'key':_0xdb8b('0x28'),'value':_0x3b4a7c},{'key':_0xdb8b('0x29'),'value':'login'}];var _0x385ea5=_0xf79c32+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xdb8b('0x17')](_0xe6883b,function(_0x3f19f0){return _0x3f19f0[_0xdb8b('0x2a')]+'='+_0x3f19f0[_0xdb8b('0x2b')];})[_0xdb8b('0x1d')]('&');_0x5601d8[_0xdb8b('0x2c')]={'issuer':_0xf79c32[_0xdb8b('0x1f')](_0xdb8b('0x2d'),''),'audience':_0x5601d8[_0xdb8b('0x2e')],'state':_0x470110,'nonce':_0x3b4a7c};redis[_0xdb8b('0x2f')](_0x470110,JSON['stringify'](_0x5601d8));return _0x385ea5;}function isValidIdToken(_0x14790d,_0x2cdf99){try{var _0x53209d=jwt['decode'](_0x14790d,{'complete':!![]});var _0x40c0a1=_0x53209d[_0xdb8b('0x30')];if(_0x40c0a1[_0xdb8b('0x31')]!==_0x2cdf99['issuer'])return![];if(_0x40c0a1[_0xdb8b('0x32')]!==_0x2cdf99[_0xdb8b('0x33')])return![];if(_0x40c0a1[_0xdb8b('0x28')]!==_0x2cdf99[_0xdb8b('0x28')])return![];if(moment()['isAfter'](moment[_0xdb8b('0x34')](_0x40c0a1[_0xdb8b('0x35')])))return![];return!![];}catch(_0x14a051){throw _0x14a051;}}function refreshOauth2MicrosoftAccessToken(_0x1a8b7f){return Promise[_0xdb8b('0x36')]()[_0xdb8b('0x37')](function(){if(_0x1a8b7f[_0xdb8b('0x38')])return _0x1a8b7f;return db['CloudProvider'][_0xdb8b('0x39')]({'where':{'id':_0x1a8b7f['id']},'raw':!![]});})[_0xdb8b('0x37')](function(_0x47ed29){var _0x161927={'grant_type':'refresh_token','refresh_token':_0x47ed29[_0xdb8b('0x3a')],'scope':getAccessTokenScope(_0x47ed29),'redirect_uri':_0x47ed29['data4'],'client_id':_0x47ed29['data1'],'client_secret':encryptor[_0xdb8b('0x3b')](_0x47ed29['data3'])};var _0x45bef7={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xdb8b('0x1f')](_0xdb8b('0x20'),_0x47ed29['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x161927,'json':!![]};return rp(_0x45bef7);})[_0xdb8b('0x37')](function(_0x412b7f){_0x1a8b7f[_0xdb8b('0x3c')]=_0x412b7f[_0xdb8b('0x3d')];_0x1a8b7f[_0xdb8b('0x3a')]=_0x412b7f[_0xdb8b('0x3e')];return db[_0xdb8b('0x3f')][_0xdb8b('0x40')]({'data5':_0x1a8b7f[_0xdb8b('0x3c')],'data6':_0x1a8b7f[_0xdb8b('0x3a')]},{'where':{'id':_0x1a8b7f['id']}});})[_0xdb8b('0x37')](function(){return _0x1a8b7f;})['catch'](function(_0x52f0af){logger[_0xdb8b('0x41')](_0xdb8b('0x42'),_0x1a8b7f['id'],_0x52f0af);});}function getOauth2MicrosoftAccessToken(_0x4a05df,_0x7f0de3){var _0x12e348={'grant_type':'authorization_code','code':_0x4a05df,'scope':getAccessTokenScope(_0x7f0de3),'redirect_uri':_0x7f0de3[_0xdb8b('0x43')],'client_id':_0x7f0de3[_0xdb8b('0x2e')],'client_secret':encryptor[_0xdb8b('0x3b')](_0x7f0de3[_0xdb8b('0x38')])};var _0x509de3={'method':_0xdb8b('0x44'),'uri':MICROSOFT_AUTH_URL[_0xdb8b('0x1f')]('{TENANT_ID}',_0x7f0de3[_0xdb8b('0x45')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x12e348,'json':!![]};return rp(_0x509de3);}function startRefreshInterval(_0x4e5658){var _0xde97c5=schedule[_0xdb8b('0x46')];if(_0xde97c5[_0x4e5658['id']])clearInterval(_0xde97c5[_0x4e5658['id']]);_0xde97c5[_0x4e5658['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xdb8b('0x47')](this,{'id':_0x4e5658['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xdb8b('0x46')]=_0xde97c5;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xdb8b('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x33aebd){var _0x38c7bb=_0x33aebd[_0xdb8b('0x17')](function(_0xd8c7a7){return refreshOauth2MicrosoftAccessToken(_0xd8c7a7)[_0xdb8b('0x37')](function(_0x5f1f5f){startRefreshInterval(_0x5f1f5f);});});return Promise[_0xdb8b('0x49')](_0x38c7bb);})[_0xdb8b('0x4a')](function(_0x47d484){var _0x240010=_0x47d484?util[_0xdb8b('0x4b')](_0x47d484,{'showHidden':![],'depth':null}):'';logger[_0xdb8b('0x41')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x240010);});}module[_0xdb8b('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xf9ba=['payload','iss','issuer','aud','nonce','isAfter','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data1','intervals','bind','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','map','type','Dynamics365','push','data7','/.default','join','replace','{TENANT_ID}','data2','code','id_token','from','stringify','toString','client_id','response_type','data4','response_mode','scope','state','prompt','login','key','value','oauth2Claims','oauth2/','set','decode'];(function(_0x1e8529,_0x3c8b4f){var _0x5e6ce6=function(_0x44981d){while(--_0x44981d){_0x1e8529['push'](_0x1e8529['shift']());}};_0x5e6ce6(++_0x3c8b4f);}(_0xf9ba,0x156));var _0xaf9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf9ba[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0xaf9b('0x0'));var moment=require('moment');var Redis=require(_0xaf9b('0x1'));var rp=require(_0xaf9b('0x2'));var util=require(_0xaf9b('0x3'));var encryptor=require(_0xaf9b('0x4'));var config=require(_0xaf9b('0x5'));var logger=require('../../config/logger')(_0xaf9b('0x6'));var schedule=require(_0xaf9b('0x7'));var db=require(_0xaf9b('0x8'))['db'];config[_0xaf9b('0x9')]=_[_0xaf9b('0xa')](config[_0xaf9b('0x9')],{'host':_0xaf9b('0xb'),'port':0x18eb});var redis=new Redis(config[_0xaf9b('0x9')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xaf9b('0xc'),_0xaf9b('0xd'),_0xaf9b('0xe'),_0xaf9b('0xf'),_0xaf9b('0x10'),'https://outlook.office.com/POP.AccessAsUser.All',_0xaf9b('0x11')],'Dynamics365':[_0xaf9b('0xc'),_0xaf9b('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0xaf9b('0x12');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x183d7f){var _0x25fc39=_[_0xaf9b('0x13')](AZURE_AUTH_SCOPES[_0x183d7f[_0xaf9b('0x14')]]);if(_0x183d7f[_0xaf9b('0x14')]===_0xaf9b('0x15'))_0x25fc39[_0xaf9b('0x16')](_0x183d7f[_0xaf9b('0x17')]+_0xaf9b('0x18'));return _0x25fc39[_0xaf9b('0x19')]('\x20');}function getAccessTokenScope(_0x2077aa){if(_0x2077aa['type']==='Outlook365')return _0xaf9b('0x10');if(_0x2077aa[_0xaf9b('0x14')]==='Dynamics365')return _0x2077aa[_0xaf9b('0x17')]+_0xaf9b('0x18');}function generateMicrosoftAuthorizationUrl(_0x2488eb,_0x4ba296){var _0x3bd6cc=MICROSOFT_AUTH_URL[_0xaf9b('0x1a')](_0xaf9b('0x1b'),_0x2488eb[_0xaf9b('0x1c')]);var _0x357844=[_0xaf9b('0x1d'),_0xaf9b('0x1e')];var _0x4174ff=Buffer[_0xaf9b('0x1f')](JSON[_0xaf9b('0x20')]({'id':_0x4ba296}))[_0xaf9b('0x21')]('base64');var _0x31c3c6=crypto['randomBytes'](0x10)[_0xaf9b('0x21')]('hex');var _0x2bc25d=getAuthorizationScopes(_0x2488eb);var _0x40e00c=[{'key':_0xaf9b('0x22'),'value':_0x2488eb['data1']},{'key':_0xaf9b('0x23'),'value':encodeURIComponent(_0x357844[_0xaf9b('0x19')]('\x20'))},{'key':'redirect_uri','value':_0x2488eb[_0xaf9b('0x24')]},{'key':_0xaf9b('0x25'),'value':'form_post'},{'key':_0xaf9b('0x26'),'value':encodeURIComponent(_0x2bc25d)},{'key':_0xaf9b('0x27'),'value':_0x4174ff},{'key':'nonce','value':_0x31c3c6},{'key':_0xaf9b('0x28'),'value':_0xaf9b('0x29')}];var _0x1376c9=_0x3bd6cc+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x40e00c,function(_0x309244){return _0x309244[_0xaf9b('0x2a')]+'='+_0x309244[_0xaf9b('0x2b')];})[_0xaf9b('0x19')]('&');_0x2488eb[_0xaf9b('0x2c')]={'issuer':_0x3bd6cc[_0xaf9b('0x1a')](_0xaf9b('0x2d'),''),'audience':_0x2488eb['data1'],'state':_0x4174ff,'nonce':_0x31c3c6};redis[_0xaf9b('0x2e')](_0x4174ff,JSON[_0xaf9b('0x20')](_0x2488eb));return _0x1376c9;}function isValidIdToken(_0x3ac7c3,_0x4aecce){try{var _0x6f2c12=jwt[_0xaf9b('0x2f')](_0x3ac7c3,{'complete':!![]});var _0x452c78=_0x6f2c12[_0xaf9b('0x30')];if(_0x452c78[_0xaf9b('0x31')]!==_0x4aecce[_0xaf9b('0x32')])return![];if(_0x452c78[_0xaf9b('0x33')]!==_0x4aecce['audience'])return![];if(_0x452c78[_0xaf9b('0x34')]!==_0x4aecce[_0xaf9b('0x34')])return![];if(moment()[_0xaf9b('0x35')](moment['unix'](_0x452c78[_0xaf9b('0x36')])))return![];return!![];}catch(_0x11f528){throw _0x11f528;}}function refreshOauth2MicrosoftAccessToken(_0x559c13){return Promise[_0xaf9b('0x37')]()[_0xaf9b('0x38')](function(){if(_0x559c13[_0xaf9b('0x39')])return _0x559c13;return db[_0xaf9b('0x3a')][_0xaf9b('0x3b')]({'where':{'id':_0x559c13['id']},'raw':!![]});})[_0xaf9b('0x38')](function(_0x1afb79){var _0x59eb22={'grant_type':_0xaf9b('0x3c'),'refresh_token':_0x1afb79[_0xaf9b('0x3d')],'scope':getAccessTokenScope(_0x1afb79),'redirect_uri':_0x1afb79['data4'],'client_id':_0x1afb79['data1'],'client_secret':encryptor[_0xaf9b('0x3e')](_0x1afb79['data3'])};var _0x483e8f={'method':_0xaf9b('0x3f'),'uri':MICROSOFT_AUTH_URL[_0xaf9b('0x1a')](_0xaf9b('0x1b'),_0x1afb79[_0xaf9b('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x59eb22,'json':!![]};return rp(_0x483e8f);})[_0xaf9b('0x38')](function(_0x43260a){_0x559c13[_0xaf9b('0x40')]=_0x43260a[_0xaf9b('0x41')];_0x559c13[_0xaf9b('0x3d')]=_0x43260a['refresh_token'];return db['CloudProvider'][_0xaf9b('0x42')]({'data5':_0x559c13['data5'],'data6':_0x559c13[_0xaf9b('0x3d')]},{'where':{'id':_0x559c13['id']}});})['then'](function(){return _0x559c13;})[_0xaf9b('0x43')](function(_0x2dd19a){logger[_0xaf9b('0x44')](_0xaf9b('0x45'),_0x559c13['id'],_0x2dd19a);});}function getOauth2MicrosoftAccessToken(_0xb8c4d5,_0x2dad10){var _0x22fd09={'grant_type':_0xaf9b('0x46'),'code':_0xb8c4d5,'scope':getAccessTokenScope(_0x2dad10),'redirect_uri':_0x2dad10[_0xaf9b('0x24')],'client_id':_0x2dad10[_0xaf9b('0x47')],'client_secret':encryptor['decryptString'](_0x2dad10[_0xaf9b('0x39')])};var _0x55b7c4={'method':_0xaf9b('0x3f'),'uri':MICROSOFT_AUTH_URL['replace'](_0xaf9b('0x1b'),_0x2dad10[_0xaf9b('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x22fd09,'json':!![]};return rp(_0x55b7c4);}function startRefreshInterval(_0x2fdd82){var _0x519e5a=schedule[_0xaf9b('0x48')];if(_0x519e5a[_0x2fdd82['id']])clearInterval(_0x519e5a[_0x2fdd82['id']]);_0x519e5a[_0x2fdd82['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xaf9b('0x49')](this,{'id':_0x2fdd82['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xaf9b('0x48')]=_0x519e5a;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x2e4933){var _0x2f5e69=_0x2e4933[_0xaf9b('0x13')](function(_0x393d8e){return refreshOauth2MicrosoftAccessToken(_0x393d8e)['then'](function(_0x5b341e){startRefreshInterval(_0x5b341e);});});return Promise[_0xaf9b('0x4a')](_0x2f5e69);})['catch'](function(_0x54405d){var _0x4ae2be=_0x54405d?util[_0xaf9b('0x4b')](_0x54405d,{'showHidden':![],'depth':null}):'';logger['error'](_0xaf9b('0x4c'),_0x4ae2be);});}module[_0xaf9b('0x4d')]={'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 25603c7..8c010db 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 _0x7177=['stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7177,0x101));var _0x7717=function(_0xc6879,_0x84a966){_0xc6879=_0xc6879-0x0;var _0x54f7a4=_0x7177[_0xc6879];return _0x54f7a4;};'use strict';var _=require(_0x7717('0x0'));var util=require('util');var moment=require(_0x7717('0x1'));var BPromise=require('bluebird');var rs=require(_0x7717('0x2'));var fs=require('fs');var Redis=require(_0x7717('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7717('0x4'));var logger=require(_0x7717('0x5'))('rpc');var config=require(_0x7717('0x6'));var jayson=require(_0x7717('0x7'));var client=jayson[_0x7717('0x8')][_0x7717('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe3d36b,_0x3db511,_0xaca6aa){return new BPromise(function(_0x2ded67,_0x29a980){return client[_0x7717('0xa')](_0xe3d36b,_0xaca6aa)[_0x7717('0xb')](function(_0x51d2a6){logger[_0x7717('0xc')](_0x7717('0xd'),_0x3db511,'request\x20sent');logger[_0x7717('0xe')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x3db511,_0x7717('0xf'),JSON[_0x7717('0x10')](_0x51d2a6));if(_0x51d2a6[_0x7717('0x11')]){if(_0x51d2a6[_0x7717('0x11')][_0x7717('0x12')]===0x1f4){logger['error'](_0x7717('0xd'),_0x3db511,_0x51d2a6[_0x7717('0x11')][_0x7717('0x13')]);return _0x29a980(_0x51d2a6[_0x7717('0x11')][_0x7717('0x13')]);}logger[_0x7717('0x11')](_0x7717('0xd'),_0x3db511,_0x51d2a6['error'][_0x7717('0x13')]);return _0x2ded67(_0x51d2a6[_0x7717('0x11')][_0x7717('0x13')]);}else{logger[_0x7717('0xc')](_0x7717('0xd'),_0x3db511,_0x7717('0xf'));_0x2ded67(_0x51d2a6[_0x7717('0x14')]['message']);}})['catch'](function(_0x4071ff){logger['error'](_0x7717('0xd'),_0x3db511,_0x4071ff);_0x29a980(_0x4071ff);});});} \ No newline at end of file +var _0x6ab9=['jayson/promise','client','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x5016d0,_0x40f27c){var _0x556fa3=function(_0x53afa7){while(--_0x53afa7){_0x5016d0['push'](_0x5016d0['shift']());}};_0x556fa3(++_0x40f27c);}(_0x6ab9,0x19a));var _0x96ab=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x6ab9[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0x96ab('0x0'));var util=require(_0x96ab('0x1'));var moment=require('moment');var BPromise=require(_0x96ab('0x2'));var rs=require(_0x96ab('0x3'));var fs=require('fs');var Redis=require(_0x96ab('0x4'));var db=require(_0x96ab('0x5'))['db'];var utils=require(_0x96ab('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x96ab('0x7'));var jayson=require(_0x96ab('0x8'));var client=jayson[_0x96ab('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d2a35,_0xf8e2b1,_0x516cf7){return new BPromise(function(_0x313efb,_0x1e3f17){return client[_0x96ab('0xa')](_0x3d2a35,_0x516cf7)[_0x96ab('0xb')](function(_0x39b50e){logger[_0x96ab('0xc')](_0x96ab('0xd'),_0xf8e2b1,_0x96ab('0xe'));logger[_0x96ab('0xf')](_0x96ab('0x10'),_0xf8e2b1,_0x96ab('0xe'),JSON[_0x96ab('0x11')](_0x39b50e));if(_0x39b50e[_0x96ab('0x12')]){if(_0x39b50e['error'][_0x96ab('0x13')]===0x1f4){logger['error'](_0x96ab('0xd'),_0xf8e2b1,_0x39b50e[_0x96ab('0x12')][_0x96ab('0x14')]);return _0x1e3f17(_0x39b50e[_0x96ab('0x12')][_0x96ab('0x14')]);}logger[_0x96ab('0x12')](_0x96ab('0xd'),_0xf8e2b1,_0x39b50e[_0x96ab('0x12')][_0x96ab('0x14')]);return _0x313efb(_0x39b50e[_0x96ab('0x12')][_0x96ab('0x14')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0xf8e2b1,_0x96ab('0xe'));_0x313efb(_0x39b50e[_0x96ab('0x15')][_0x96ab('0x14')]);}})['catch'](function(_0x43e35e){logger[_0x96ab('0x12')]('CloudProvider,\x20%s,\x20%s',_0xf8e2b1,_0x43e35e);_0x1e3f17(_0x43e35e);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 90d36bc..fb9add7 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x1a100d,_0x42be1f){var _0x117998=function(_0x3b406d){while(--_0x3b406d){_0x1a100d['push'](_0x1a100d['shift']());}};_0x117998(++_0x42be1f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4aa[_0x3ab51d];return _0x29a04e;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file +var _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(_0x12171a,_0x2c01b3){var _0x10a89d=function(_0x212eab){while(--_0x212eab){_0x12171a['push'](_0x12171a['shift']());}};_0x10a89d(++_0x2c01b3);}(_0x2ef3,0xba));var _0x32ef=function(_0xf6ecb2,_0x2c7969){_0xf6ecb2=_0xf6ecb2-0x0;var _0x2ac34f=_0x2ef3[_0xf6ecb2];return _0x2ac34f;};'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 04cdaf3..042e16d 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 _0x30ff=['name','exports','STRING'];(function(_0x29d5b1,_0x1de0c8){var _0x5432e1=function(_0x50262c){while(--_0x50262c){_0x29d5b1['push'](_0x29d5b1['shift']());}};_0x5432e1(++_0x1de0c8);}(_0x30ff,0x6a));var _0xf30f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x30ff[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xf30f('0x0')]={'name':{'type':Sequelize[_0xf30f('0x1')],'unique':_0xf30f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xf30f('0x1')]},'companyId':{'type':Sequelize[_0xf30f('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xf30f('0x1')]},'fax':{'type':Sequelize[_0xf30f('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xf30f('0x1')]},'postalCode':{'type':Sequelize[_0xf30f('0x1')]},'city':{'type':Sequelize[_0xf30f('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf30f('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xf30f('0x1')]},'sStreet':{'type':Sequelize[_0xf30f('0x1')]},'sPostalCode':{'type':Sequelize[_0xf30f('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xf30f('0x1')]},'description':{'type':Sequelize[_0xf30f('0x1')]}}; \ No newline at end of file +var _0xdc14=['name','sequelize','exports','STRING'];(function(_0xf86d81,_0x427dbc){var _0x41f46f=function(_0x556c9e){while(--_0x556c9e){_0xf86d81['push'](_0xf86d81['shift']());}};_0x41f46f(++_0x427dbc);}(_0xdc14,0x161));var _0x4dc1=function(_0x167af2,_0x56bbca){_0x167af2=_0x167af2-0x0;var _0x774212=_0xdc14[_0x167af2];return _0x774212;};'use strict';var Sequelize=require(_0x4dc1('0x0'));module[_0x4dc1('0x1')]={'name':{'type':Sequelize[_0x4dc1('0x2')],'unique':_0x4dc1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x4dc1('0x2')]},'companyId':{'type':Sequelize[_0x4dc1('0x2')]},'website':{'type':Sequelize[_0x4dc1('0x2')]},'phone':{'type':Sequelize[_0x4dc1('0x2')]},'fax':{'type':Sequelize[_0x4dc1('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x4dc1('0x2')]},'postalCode':{'type':Sequelize[_0x4dc1('0x2')]},'city':{'type':Sequelize[_0x4dc1('0x2')]},'country':{'type':Sequelize[_0x4dc1('0x2')]},'email':{'type':Sequelize[_0x4dc1('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x4dc1('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4dc1('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 1244a87..1f3d489 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 _0xabe2=['CmContact','ids','omit','getContacts','findOne','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','limit','count','offset','Content-Range','json','reject','save','update','then','get','Companies','UserProfileResource','sendStatus','name','send','index','CmCompany','describe','keys','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','merge','options','includeAll','rows','catch','params','rawAttributes','intersection','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addContacts'];(function(_0x8962d6,_0x503ed6){var _0x566f25=function(_0x56b0f0){while(--_0x56b0f0){_0x8962d6['push'](_0x8962d6['shift']());}};_0x566f25(++_0x503ed6);}(_0xabe2,0x1e5));var _0x2abe=function(_0x554e88,_0x2924a6){_0x554e88=_0x554e88-0x0;var _0x17c4b0=_0xabe2[_0x554e88];return _0x17c4b0;};'use strict';var emlformat=require(_0x2abe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2abe('0x1'));var jsonpatch=require(_0x2abe('0x2'));var rp=require(_0x2abe('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2abe('0x4'));var util=require('util');var path=require(_0x2abe('0x5'));var sox=require(_0x2abe('0x6'));var csv=require('to-csv');var ejs=require(_0x2abe('0x7'));var fs=require('fs');var fs_extra=require(_0x2abe('0x8'));var _=require(_0x2abe('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2abe('0xa'));var deskjs=require(_0x2abe('0xb'));var toCsv=require(_0x2abe('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2abe('0xd'));var qs=require(_0x2abe('0xe'));var as=require(_0x2abe('0xf'));var hardwareService=require(_0x2abe('0x10'));var logger=require(_0x2abe('0x11'))(_0x2abe('0x12'));var utils=require(_0x2abe('0x13'));var config=require(_0x2abe('0x14'));var licenseUtil=require(_0x2abe('0x15'));var db=require(_0x2abe('0x16'))['db'];function respondWithStatusCode(_0x454e86,_0x3473d7){_0x3473d7=_0x3473d7||0xcc;return function(_0x4232d4){if(_0x4232d4){return _0x454e86['sendStatus'](_0x3473d7);}return _0x454e86['status'](_0x3473d7)['end']();};}function respondWithResult(_0x2a2f93,_0x35891a){_0x35891a=_0x35891a||0xc8;return function(_0x4ed55b){if(_0x4ed55b){return _0x2a2f93[_0x2abe('0x17')](_0x35891a)['json'](_0x4ed55b);}};}function respondWithFilteredResult(_0x3f04dc,_0x34bc52){return function(_0x2bb63b){if(_0x2bb63b){var _0x4a501c=typeof _0x34bc52['offset']==='undefined'&&typeof _0x34bc52[_0x2abe('0x18')]==='undefined';var _0x3843af=_0x2bb63b[_0x2abe('0x19')];var _0x3faefd=_0x4a501c?0x0:_0x34bc52[_0x2abe('0x1a')];var _0x2ee39e=_0x4a501c?_0x2bb63b[_0x2abe('0x19')]:_0x34bc52['offset']+_0x34bc52[_0x2abe('0x18')];var _0xc5d17b;if(_0x2ee39e>=_0x3843af){_0x2ee39e=_0x3843af;_0xc5d17b=0xc8;}else{_0xc5d17b=0xce;}_0x3f04dc[_0x2abe('0x17')](_0xc5d17b);return _0x3f04dc['set'](_0x2abe('0x1b'),_0x3faefd+'-'+_0x2ee39e+'/'+_0x3843af)[_0x2abe('0x1c')](_0x2bb63b);}return null;};}function patchUpdates(_0x219bb1){return function(_0x5a09d0){try{jsonpatch['apply'](_0x5a09d0,_0x219bb1,!![]);}catch(_0x5df4cc){return BPromise[_0x2abe('0x1d')](_0x5df4cc);}return _0x5a09d0[_0x2abe('0x1e')]();};}function saveUpdates(_0x5779da,_0x309301){return function(_0x3806bd){if(_0x3806bd){return _0x3806bd[_0x2abe('0x1f')](_0x5779da)['then'](function(_0x54f671){return _0x54f671;});}return null;};}function removeEntity(_0x5618cb,_0x1026c9){return function(_0x410632){if(_0x410632){return _0x410632['destroy']()[_0x2abe('0x20')](function(){var _0x570bae=_0x410632[_0x2abe('0x21')]({'plain':!![]});var _0x282858=_0x2abe('0x22');return db[_0x2abe('0x23')]['destroy']({'where':{'type':_0x282858,'resourceId':_0x570bae['id']}})['then'](function(){return _0x410632;});})[_0x2abe('0x20')](function(){_0x5618cb[_0x2abe('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbfe536,_0x5066bf){return function(_0x46803a){if(!_0x46803a){_0xbfe536[_0x2abe('0x24')](0x194);}return _0x46803a;};}function handleError(_0x19dc3f,_0x12ac5b){_0x12ac5b=_0x12ac5b||0x1f4;return function(_0x2e3a15){logger['error'](_0x2e3a15['stack']);if(_0x2e3a15[_0x2abe('0x25')]){delete _0x2e3a15[_0x2abe('0x25')];}_0x19dc3f[_0x2abe('0x17')](_0x12ac5b)[_0x2abe('0x26')](_0x2e3a15);};}exports[_0x2abe('0x27')]=function(_0x9feb0f,_0x50e209){var _0x4985ec={},_0x54e43d={},_0x2d23ad={'count':0x0,'rows':[]};return db[_0x2abe('0x28')][_0x2abe('0x29')]()[_0x2abe('0x20')](function(_0x5a64be){_0x54e43d['model']=_[_0x2abe('0x2a')](_0x5a64be);_0x54e43d['query']=_[_0x2abe('0x2a')](_0x9feb0f[_0x2abe('0x2b')]);_0x54e43d[_0x2abe('0x2c')]=_['intersection'](_0x54e43d[_0x2abe('0x2d')],_0x54e43d['query']);_0x4985ec['attributes']=_['intersection'](_0x54e43d[_0x2abe('0x2d')],qs[_0x2abe('0x2e')](_0x9feb0f[_0x2abe('0x2b')][_0x2abe('0x2e')]));_0x4985ec[_0x2abe('0x2f')]=_0x4985ec[_0x2abe('0x2f')][_0x2abe('0x30')]?_0x4985ec[_0x2abe('0x2f')]:_0x54e43d[_0x2abe('0x2d')];if(!_0x9feb0f[_0x2abe('0x2b')][_0x2abe('0x31')](_0x2abe('0x32'))){_0x4985ec[_0x2abe('0x18')]=qs[_0x2abe('0x18')](_0x9feb0f[_0x2abe('0x2b')][_0x2abe('0x18')]);_0x4985ec[_0x2abe('0x1a')]=qs[_0x2abe('0x1a')](_0x9feb0f['query']['offset']);}_0x4985ec[_0x2abe('0x33')]=qs[_0x2abe('0x34')](_0x9feb0f['query']['sort']);_0x4985ec[_0x2abe('0x35')]=qs[_0x2abe('0x2c')](_[_0x2abe('0x36')](_0x9feb0f[_0x2abe('0x2b')],_0x54e43d[_0x2abe('0x2c')]),_0x5a64be);if(_0x9feb0f[_0x2abe('0x2b')][_0x2abe('0x37')]){_0x4985ec[_0x2abe('0x35')]=_['merge'](_0x4985ec[_0x2abe('0x35')],{'$or':_[_0x2abe('0x38')](_0x4985ec[_0x2abe('0x2f')],function(_0x143c6a){var _0x54c803={};_0x54c803[_0x143c6a]={'$like':'%'+_0x9feb0f[_0x2abe('0x2b')][_0x2abe('0x37')]+'%'};return _0x54c803;})});}_0x4985ec=_[_0x2abe('0x39')]({},_0x4985ec,_0x9feb0f[_0x2abe('0x3a')]);var _0x207b67={'where':_0x4985ec[_0x2abe('0x35')]};return db[_0x2abe('0x28')]['count'](_0x207b67)[_0x2abe('0x20')](function(_0x34f9e0){_0x2d23ad[_0x2abe('0x19')]=_0x34f9e0;if(_0x9feb0f[_0x2abe('0x2b')][_0x2abe('0x3b')]){_0x4985ec['include']=[{'all':!![]}];}return db[_0x2abe('0x28')]['findAll'](_0x4985ec);})[_0x2abe('0x20')](function(_0xbba1c4){_0x2d23ad[_0x2abe('0x3c')]=_0xbba1c4;return _0x2d23ad;})['then'](respondWithFilteredResult(_0x50e209,_0x4985ec))[_0x2abe('0x3d')](handleError(_0x50e209,null));})[_0x2abe('0x3d')](handleError(_0x50e209,null));};exports['show']=function(_0x197d66,_0x5993b5){var _0x6154fd={'raw':![],'where':{'id':_0x197d66[_0x2abe('0x3e')]['id']}},_0x3b35cc={};_0x3b35cc[_0x2abe('0x2d')]=_[_0x2abe('0x2a')](db[_0x2abe('0x28')][_0x2abe('0x3f')]);_0x3b35cc[_0x2abe('0x2b')]=_[_0x2abe('0x2a')](_0x197d66[_0x2abe('0x2b')]);_0x3b35cc['filters']=_[_0x2abe('0x40')](_0x3b35cc[_0x2abe('0x2d')],_0x3b35cc[_0x2abe('0x2b')]);_0x6154fd[_0x2abe('0x2f')]=_['intersection'](_0x3b35cc[_0x2abe('0x2d')],qs[_0x2abe('0x2e')](_0x197d66[_0x2abe('0x2b')]['fields']));_0x6154fd[_0x2abe('0x2f')]=_0x6154fd[_0x2abe('0x2f')][_0x2abe('0x30')]?_0x6154fd[_0x2abe('0x2f')]:_0x3b35cc[_0x2abe('0x2d')];if(_0x197d66[_0x2abe('0x2b')]['includeAll']){_0x6154fd[_0x2abe('0x41')]=[{'all':!![]}];}_0x6154fd=_['merge']({},_0x6154fd,_0x197d66['options']);return db[_0x2abe('0x28')][_0x2abe('0x42')](_0x6154fd)[_0x2abe('0x20')](handleEntityNotFound(_0x5993b5,null))[_0x2abe('0x20')](respondWithResult(_0x5993b5,null))['catch'](handleError(_0x5993b5,null));};exports[_0x2abe('0x43')]=function(_0x404338,_0x3d03ca){return db[_0x2abe('0x28')]['create'](_0x404338[_0x2abe('0x44')],{})[_0x2abe('0x20')](function(_0x43971c){var _0x4a66b4=_0x404338['user']['get']({'plain':!![]});if(!_0x4a66b4)throw new Error(_0x2abe('0x45'));if(_0x4a66b4[_0x2abe('0x46')]==='user'){var _0x78f82f=_0x43971c[_0x2abe('0x21')]({'plain':!![]});var _0x3f393e=_0x2abe('0x22');return db[_0x2abe('0x47')][_0x2abe('0x42')]({'where':{'name':_0x3f393e,'userProfileId':_0x4a66b4['userProfileId']},'raw':!![]})['then'](function(_0x65c6de){if(_0x65c6de&&_0x65c6de['autoAssociation']===0x0){return db[_0x2abe('0x23')][_0x2abe('0x43')]({'name':_0x78f82f['name'],'resourceId':_0x78f82f['id'],'type':_0x65c6de[_0x2abe('0x25')],'sectionId':_0x65c6de['id']},{})['then'](function(){return _0x43971c;});}else{return _0x43971c;}})[_0x2abe('0x3d')](function(_0x282665){logger['error'](_0x2abe('0x48'),_0x282665);throw _0x282665;});}return _0x43971c;})[_0x2abe('0x20')](respondWithResult(_0x3d03ca,0xc9))['catch'](handleError(_0x3d03ca,null));};exports[_0x2abe('0x1f')]=function(_0x46a509,_0x3bba83){if(_0x46a509[_0x2abe('0x44')]['id']){delete _0x46a509['body']['id'];}return db[_0x2abe('0x28')][_0x2abe('0x42')]({'where':{'id':_0x46a509[_0x2abe('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3bba83,null))['then'](saveUpdates(_0x46a509[_0x2abe('0x44')],null))[_0x2abe('0x20')](respondWithResult(_0x3bba83,null))[_0x2abe('0x3d')](handleError(_0x3bba83,null));};exports[_0x2abe('0x49')]=function(_0x394bc5,_0x12e87c){return db['CmCompany'][_0x2abe('0x42')]({'where':{'id':_0x394bc5[_0x2abe('0x3e')]['id']}})[_0x2abe('0x20')](handleEntityNotFound(_0x12e87c,null))[_0x2abe('0x20')](removeEntity(_0x12e87c,null))[_0x2abe('0x3d')](handleError(_0x12e87c,null));};exports[_0x2abe('0x29')]=function(_0x504329,_0x59d221){return db[_0x2abe('0x28')]['describe']()[_0x2abe('0x20')](respondWithResult(_0x59d221,null))['catch'](handleError(_0x59d221,null));};exports[_0x2abe('0x4a')]=function(_0x327247,_0x2de8b5,_0x3aab27){return db[_0x2abe('0x4b')]['find']({'where':{'id':_0x327247[_0x2abe('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2de8b5,null))['then'](function(_0x4c8816){if(_0x4c8816){return _0x4c8816[_0x2abe('0x4a')](_0x327247['body'][_0x2abe('0x4c')],_[_0x2abe('0x4d')](_0x327247[_0x2abe('0x44')],[_0x2abe('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x2de8b5,null))['catch'](handleError(_0x2de8b5,null));};exports[_0x2abe('0x4e')]=function(_0xa9b36a,_0x420892,_0x2b70a4){var _0x3e7742={};var _0x3723bc={};var _0x3e6bc8;var _0x57cc94;return db['CmCompany'][_0x2abe('0x4f')]({'where':{'id':_0xa9b36a[_0x2abe('0x3e')]['id']}})[_0x2abe('0x20')](handleEntityNotFound(_0x420892,null))[_0x2abe('0x20')](function(_0x24a343){if(_0x24a343){_0x3e6bc8=_0x24a343;_0x3723bc['model']=_[_0x2abe('0x2a')](db[_0x2abe('0x4b')][_0x2abe('0x3f')]);_0x3723bc['query']=_[_0x2abe('0x2a')](_0xa9b36a[_0x2abe('0x2b')]);_0x3723bc['filters']=_['intersection'](_0x3723bc[_0x2abe('0x2d')],_0x3723bc['query']);_0x3e7742[_0x2abe('0x2f')]=_[_0x2abe('0x40')](_0x3723bc[_0x2abe('0x2d')],qs[_0x2abe('0x2e')](_0xa9b36a[_0x2abe('0x2b')][_0x2abe('0x2e')]));_0x3e7742['attributes']=_0x3e7742[_0x2abe('0x2f')][_0x2abe('0x30')]?_0x3e7742[_0x2abe('0x2f')]:_0x3723bc[_0x2abe('0x2d')];_0x3e7742['order']=qs[_0x2abe('0x34')](_0xa9b36a[_0x2abe('0x2b')]['sort']);_0x3e7742[_0x2abe('0x35')]=qs[_0x2abe('0x2c')](_['pick'](_0xa9b36a[_0x2abe('0x2b')],_0x3723bc['filters']));if(_0xa9b36a['query'][_0x2abe('0x37')]){_0x3e7742[_0x2abe('0x35')]=_[_0x2abe('0x39')](_0x3e7742[_0x2abe('0x35')],{'$or':_[_0x2abe('0x38')](_0x3e7742[_0x2abe('0x2f')],function(_0x3e6585){var _0x44e2cb={};_0x44e2cb[_0x3e6585]={'$like':'%'+_0xa9b36a['query']['filter']+'%'};return _0x44e2cb;})});}_0x3e7742=_[_0x2abe('0x39')]({},_0x3e7742,_0xa9b36a[_0x2abe('0x3a')]);return _0x3e6bc8[_0x2abe('0x4e')](_0x3e7742);}})[_0x2abe('0x20')](function(_0x530cd3){if(_0x530cd3){_0x57cc94=_0x530cd3['length'];if(!_0xa9b36a[_0x2abe('0x2b')]['hasOwnProperty']('nolimit')){_0x3e7742[_0x2abe('0x18')]=qs['limit'](_0xa9b36a[_0x2abe('0x2b')][_0x2abe('0x18')]);_0x3e7742[_0x2abe('0x1a')]=qs[_0x2abe('0x1a')](_0xa9b36a['query'][_0x2abe('0x1a')]);}return _0x3e6bc8[_0x2abe('0x4e')](_0x3e7742);}})[_0x2abe('0x20')](function(_0x13d1df){if(_0x13d1df){return _0x13d1df?{'count':_0x57cc94,'rows':_0x13d1df}:null;}})[_0x2abe('0x20')](respondWithResult(_0x420892,null))['catch'](handleError(_0x420892,null));}; \ No newline at end of file +var _0x444e=['merge','map','filter','options','findAll','rows','catch','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','getContacts','findOne','rawAttributes','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','get','Companies','UserProfileResource','stack','name','send','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick'];(function(_0x3d9395,_0x430361){var _0x63f98d=function(_0x1449f6){while(--_0x1449f6){_0x3d9395['push'](_0x3d9395['shift']());}};_0x63f98d(++_0x430361);}(_0x444e,0xc0));var _0xe444=function(_0xe54790,_0x28615e){_0xe54790=_0xe54790-0x0;var _0x52e5d5=_0x444e[_0xe54790];return _0x52e5d5;};'use strict';var emlformat=require(_0xe444('0x0'));var rimraf=require(_0xe444('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe444('0x2'));var rp=require(_0xe444('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe444('0x4'));var util=require(_0xe444('0x5'));var path=require(_0xe444('0x6'));var sox=require(_0xe444('0x7'));var csv=require('to-csv');var ejs=require(_0xe444('0x8'));var fs=require('fs');var fs_extra=require(_0xe444('0x9'));var _=require(_0xe444('0xa'));var squel=require(_0xe444('0xb'));var crypto=require(_0xe444('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe444('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe444('0xe'));var Papa=require(_0xe444('0xf'));var Redis=require(_0xe444('0x10'));var authService=require(_0xe444('0x11'));var qs=require(_0xe444('0x12'));var as=require(_0xe444('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe444('0x14'))(_0xe444('0x15'));var utils=require(_0xe444('0x16'));var config=require(_0xe444('0x17'));var licenseUtil=require(_0xe444('0x18'));var db=require(_0xe444('0x19'))['db'];function respondWithStatusCode(_0x20bd50,_0x2168ee){_0x2168ee=_0x2168ee||0xcc;return function(_0x15f6cd){if(_0x15f6cd){return _0x20bd50[_0xe444('0x1a')](_0x2168ee);}return _0x20bd50[_0xe444('0x1b')](_0x2168ee)[_0xe444('0x1c')]();};}function respondWithResult(_0x4ac7fd,_0x267655){_0x267655=_0x267655||0xc8;return function(_0x5be8cc){if(_0x5be8cc){return _0x4ac7fd[_0xe444('0x1b')](_0x267655)[_0xe444('0x1d')](_0x5be8cc);}};}function respondWithFilteredResult(_0x21a1a3,_0x2289b7){return function(_0x5d24ab){if(_0x5d24ab){var _0x2da3b6=typeof _0x2289b7[_0xe444('0x1e')]===_0xe444('0x1f')&&typeof _0x2289b7[_0xe444('0x20')]==='undefined';var _0x38dd6a=_0x5d24ab[_0xe444('0x21')];var _0x4a9e00=_0x2da3b6?0x0:_0x2289b7[_0xe444('0x1e')];var _0x4eac00=_0x2da3b6?_0x5d24ab[_0xe444('0x21')]:_0x2289b7[_0xe444('0x1e')]+_0x2289b7['limit'];var _0x45179d;if(_0x4eac00>=_0x38dd6a){_0x4eac00=_0x38dd6a;_0x45179d=0xc8;}else{_0x45179d=0xce;}_0x21a1a3[_0xe444('0x1b')](_0x45179d);return _0x21a1a3['set'](_0xe444('0x22'),_0x4a9e00+'-'+_0x4eac00+'/'+_0x38dd6a)[_0xe444('0x1d')](_0x5d24ab);}return null;};}function patchUpdates(_0x1a6122){return function(_0x228cab){try{jsonpatch[_0xe444('0x23')](_0x228cab,_0x1a6122,!![]);}catch(_0x1f0106){return BPromise['reject'](_0x1f0106);}return _0x228cab['save']();};}function saveUpdates(_0x3aa37a,_0x5c475d){return function(_0x5f13ab){if(_0x5f13ab){return _0x5f13ab[_0xe444('0x24')](_0x3aa37a)[_0xe444('0x25')](function(_0x5682fc){return _0x5682fc;});}return null;};}function removeEntity(_0x580f91,_0x1636e1){return function(_0x414904){if(_0x414904){return _0x414904[_0xe444('0x26')]()[_0xe444('0x25')](function(){var _0x3eb934=_0x414904[_0xe444('0x27')]({'plain':!![]});var _0xfd203a=_0xe444('0x28');return db[_0xe444('0x29')]['destroy']({'where':{'type':_0xfd203a,'resourceId':_0x3eb934['id']}})[_0xe444('0x25')](function(){return _0x414904;});})[_0xe444('0x25')](function(){_0x580f91[_0xe444('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36ab13,_0x7c1398){return function(_0xc88b37){if(!_0xc88b37){_0x36ab13[_0xe444('0x1a')](0x194);}return _0xc88b37;};}function handleError(_0x173395,_0x1f35e1){_0x1f35e1=_0x1f35e1||0x1f4;return function(_0x14ec29){logger['error'](_0x14ec29[_0xe444('0x2a')]);if(_0x14ec29[_0xe444('0x2b')]){delete _0x14ec29[_0xe444('0x2b')];}_0x173395[_0xe444('0x1b')](_0x1f35e1)[_0xe444('0x2c')](_0x14ec29);};}exports['index']=function(_0x5653bb,_0x26d340){var _0x1885c3={},_0x24190f={},_0x5f2443={'count':0x0,'rows':[]};return db[_0xe444('0x2d')][_0xe444('0x2e')]()[_0xe444('0x25')](function(_0x5b8d43){_0x24190f[_0xe444('0x2f')]=_[_0xe444('0x30')](_0x5b8d43);_0x24190f[_0xe444('0x31')]=_[_0xe444('0x30')](_0x5653bb[_0xe444('0x31')]);_0x24190f[_0xe444('0x32')]=_[_0xe444('0x33')](_0x24190f[_0xe444('0x2f')],_0x24190f[_0xe444('0x31')]);_0x1885c3[_0xe444('0x34')]=_[_0xe444('0x33')](_0x24190f[_0xe444('0x2f')],qs[_0xe444('0x35')](_0x5653bb[_0xe444('0x31')][_0xe444('0x35')]));_0x1885c3[_0xe444('0x34')]=_0x1885c3[_0xe444('0x34')][_0xe444('0x36')]?_0x1885c3[_0xe444('0x34')]:_0x24190f[_0xe444('0x2f')];if(!_0x5653bb['query']['hasOwnProperty'](_0xe444('0x37'))){_0x1885c3['limit']=qs[_0xe444('0x20')](_0x5653bb[_0xe444('0x31')][_0xe444('0x20')]);_0x1885c3[_0xe444('0x1e')]=qs[_0xe444('0x1e')](_0x5653bb[_0xe444('0x31')][_0xe444('0x1e')]);}_0x1885c3[_0xe444('0x38')]=qs[_0xe444('0x39')](_0x5653bb[_0xe444('0x31')]['sort']);_0x1885c3[_0xe444('0x3a')]=qs['filters'](_[_0xe444('0x3b')](_0x5653bb[_0xe444('0x31')],_0x24190f['filters']),_0x5b8d43);if(_0x5653bb[_0xe444('0x31')]['filter']){_0x1885c3[_0xe444('0x3a')]=_[_0xe444('0x3c')](_0x1885c3[_0xe444('0x3a')],{'$or':_[_0xe444('0x3d')](_0x1885c3[_0xe444('0x34')],function(_0x2abaac){var _0x28ab04={};_0x28ab04[_0x2abaac]={'$like':'%'+_0x5653bb['query'][_0xe444('0x3e')]+'%'};return _0x28ab04;})});}_0x1885c3=_[_0xe444('0x3c')]({},_0x1885c3,_0x5653bb[_0xe444('0x3f')]);var _0x46885e={'where':_0x1885c3[_0xe444('0x3a')]};return db[_0xe444('0x2d')]['count'](_0x46885e)['then'](function(_0x855db1){_0x5f2443['count']=_0x855db1;if(_0x5653bb[_0xe444('0x31')]['includeAll']){_0x1885c3['include']=[{'all':!![]}];}return db[_0xe444('0x2d')][_0xe444('0x40')](_0x1885c3);})['then'](function(_0x18c4da){_0x5f2443[_0xe444('0x41')]=_0x18c4da;return _0x5f2443;})[_0xe444('0x25')](respondWithFilteredResult(_0x26d340,_0x1885c3))['catch'](handleError(_0x26d340,null));})[_0xe444('0x42')](handleError(_0x26d340,null));};exports['show']=function(_0x2a2e1f,_0x1b5fd5){var _0x575c77={'raw':![],'where':{'id':_0x2a2e1f[_0xe444('0x43')]['id']}},_0x2e0d35={};_0x2e0d35[_0xe444('0x2f')]=_[_0xe444('0x30')](db[_0xe444('0x2d')]['rawAttributes']);_0x2e0d35['query']=_[_0xe444('0x30')](_0x2a2e1f['query']);_0x2e0d35[_0xe444('0x32')]=_['intersection'](_0x2e0d35[_0xe444('0x2f')],_0x2e0d35[_0xe444('0x31')]);_0x575c77[_0xe444('0x34')]=_[_0xe444('0x33')](_0x2e0d35[_0xe444('0x2f')],qs[_0xe444('0x35')](_0x2a2e1f['query'][_0xe444('0x35')]));_0x575c77[_0xe444('0x34')]=_0x575c77[_0xe444('0x34')]['length']?_0x575c77[_0xe444('0x34')]:_0x2e0d35[_0xe444('0x2f')];if(_0x2a2e1f[_0xe444('0x31')]['includeAll']){_0x575c77['include']=[{'all':!![]}];}_0x575c77=_[_0xe444('0x3c')]({},_0x575c77,_0x2a2e1f[_0xe444('0x3f')]);return db[_0xe444('0x2d')][_0xe444('0x44')](_0x575c77)[_0xe444('0x25')](handleEntityNotFound(_0x1b5fd5,null))['then'](respondWithResult(_0x1b5fd5,null))[_0xe444('0x42')](handleError(_0x1b5fd5,null));};exports['create']=function(_0x280918,_0xc8a2ed){return db[_0xe444('0x2d')][_0xe444('0x45')](_0x280918[_0xe444('0x46')],{})['then'](function(_0x3f438d){var _0x4332dc=_0x280918[_0xe444('0x47')][_0xe444('0x27')]({'plain':!![]});if(!_0x4332dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4332dc[_0xe444('0x48')]===_0xe444('0x47')){var _0x383264=_0x3f438d[_0xe444('0x27')]({'plain':!![]});var _0x3acf1b=_0xe444('0x28');return db[_0xe444('0x49')][_0xe444('0x44')]({'where':{'name':_0x3acf1b,'userProfileId':_0x4332dc[_0xe444('0x4a')]},'raw':!![]})['then'](function(_0x3498c7){if(_0x3498c7&&_0x3498c7[_0xe444('0x4b')]===0x0){return db['UserProfileResource'][_0xe444('0x45')]({'name':_0x383264[_0xe444('0x2b')],'resourceId':_0x383264['id'],'type':_0x3498c7[_0xe444('0x2b')],'sectionId':_0x3498c7['id']},{})['then'](function(){return _0x3f438d;});}else{return _0x3f438d;}})['catch'](function(_0x366bad){logger[_0xe444('0x4c')](_0xe444('0x4d'),_0x366bad);throw _0x366bad;});}return _0x3f438d;})[_0xe444('0x25')](respondWithResult(_0xc8a2ed,0xc9))[_0xe444('0x42')](handleError(_0xc8a2ed,null));};exports[_0xe444('0x24')]=function(_0x2bcfbc,_0x29e8c7){if(_0x2bcfbc[_0xe444('0x46')]['id']){delete _0x2bcfbc[_0xe444('0x46')]['id'];}return db[_0xe444('0x2d')]['find']({'where':{'id':_0x2bcfbc[_0xe444('0x43')]['id']}})[_0xe444('0x25')](handleEntityNotFound(_0x29e8c7,null))[_0xe444('0x25')](saveUpdates(_0x2bcfbc[_0xe444('0x46')],null))[_0xe444('0x25')](respondWithResult(_0x29e8c7,null))[_0xe444('0x42')](handleError(_0x29e8c7,null));};exports['destroy']=function(_0x598526,_0x1c0a94){return db[_0xe444('0x2d')]['find']({'where':{'id':_0x598526[_0xe444('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c0a94,null))[_0xe444('0x25')](removeEntity(_0x1c0a94,null))[_0xe444('0x42')](handleError(_0x1c0a94,null));};exports[_0xe444('0x2e')]=function(_0x379bfb,_0x2556ba){return db[_0xe444('0x2d')][_0xe444('0x2e')]()[_0xe444('0x25')](respondWithResult(_0x2556ba,null))[_0xe444('0x42')](handleError(_0x2556ba,null));};exports[_0xe444('0x4e')]=function(_0x21e988,_0x48f838,_0x1f9da3){return db['CmContact'][_0xe444('0x44')]({'where':{'id':_0x21e988['params']['id']}})[_0xe444('0x25')](handleEntityNotFound(_0x48f838,null))['then'](function(_0x53ea9d){if(_0x53ea9d){return _0x53ea9d['addContacts'](_0x21e988[_0xe444('0x46')]['ids'],_['omit'](_0x21e988[_0xe444('0x46')],[_0xe444('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x48f838,null))[_0xe444('0x42')](handleError(_0x48f838,null));};exports[_0xe444('0x50')]=function(_0x353fce,_0x3952bf,_0x136c78){var _0x3f9726={};var _0x395eef={};var _0x42e5e4;var _0x7aef87;return db['CmCompany'][_0xe444('0x51')]({'where':{'id':_0x353fce[_0xe444('0x43')]['id']}})['then'](handleEntityNotFound(_0x3952bf,null))[_0xe444('0x25')](function(_0x5ac1d7){if(_0x5ac1d7){_0x42e5e4=_0x5ac1d7;_0x395eef['model']=_[_0xe444('0x30')](db['CmContact'][_0xe444('0x52')]);_0x395eef[_0xe444('0x31')]=_[_0xe444('0x30')](_0x353fce[_0xe444('0x31')]);_0x395eef[_0xe444('0x32')]=_[_0xe444('0x33')](_0x395eef[_0xe444('0x2f')],_0x395eef['query']);_0x3f9726[_0xe444('0x34')]=_[_0xe444('0x33')](_0x395eef['model'],qs[_0xe444('0x35')](_0x353fce[_0xe444('0x31')][_0xe444('0x35')]));_0x3f9726[_0xe444('0x34')]=_0x3f9726['attributes'][_0xe444('0x36')]?_0x3f9726['attributes']:_0x395eef[_0xe444('0x2f')];_0x3f9726[_0xe444('0x38')]=qs[_0xe444('0x39')](_0x353fce[_0xe444('0x31')][_0xe444('0x39')]);_0x3f9726['where']=qs['filters'](_[_0xe444('0x3b')](_0x353fce[_0xe444('0x31')],_0x395eef[_0xe444('0x32')]));if(_0x353fce[_0xe444('0x31')][_0xe444('0x3e')]){_0x3f9726[_0xe444('0x3a')]=_[_0xe444('0x3c')](_0x3f9726[_0xe444('0x3a')],{'$or':_[_0xe444('0x3d')](_0x3f9726[_0xe444('0x34')],function(_0x1bcfc4){var _0x4c1492={};_0x4c1492[_0x1bcfc4]={'$like':'%'+_0x353fce[_0xe444('0x31')][_0xe444('0x3e')]+'%'};return _0x4c1492;})});}_0x3f9726=_[_0xe444('0x3c')]({},_0x3f9726,_0x353fce[_0xe444('0x3f')]);return _0x42e5e4[_0xe444('0x50')](_0x3f9726);}})['then'](function(_0x5012f){if(_0x5012f){_0x7aef87=_0x5012f[_0xe444('0x36')];if(!_0x353fce[_0xe444('0x31')][_0xe444('0x53')]('nolimit')){_0x3f9726['limit']=qs[_0xe444('0x20')](_0x353fce['query'][_0xe444('0x20')]);_0x3f9726[_0xe444('0x1e')]=qs['offset'](_0x353fce['query'][_0xe444('0x1e')]);}return _0x42e5e4[_0xe444('0x50')](_0x3f9726);}})['then'](function(_0x174645){if(_0x174645){return _0x174645?{'count':_0x7aef87,'rows':_0x174645}:null;}})[_0xe444('0x25')](respondWithResult(_0x3952bf,null))[_0xe444('0x42')](handleError(_0x3952bf,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index c71635b..9d45671 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 _0x0e4d=['path','rimraf','../../config/environment','exports','define','cm_companies','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2f29d5,_0x90af1c){var _0x486f9e=function(_0x4abd2e){while(--_0x4abd2e){_0x2f29d5['push'](_0x2f29d5['shift']());}};_0x486f9e(++_0x90af1c);}(_0x0e4d,0x96));var _0xd0e4=function(_0x280652,_0x256542){_0x280652=_0x280652-0x0;var _0x4dab42=_0x0e4d[_0x280652];return _0x4dab42;};'use strict';var _=require(_0xd0e4('0x0'));var util=require(_0xd0e4('0x1'));var logger=require(_0xd0e4('0x2'))('api');var moment=require(_0xd0e4('0x3'));var BPromise=require(_0xd0e4('0x4'));var rp=require(_0xd0e4('0x5'));var fs=require('fs');var path=require(_0xd0e4('0x6'));var rimraf=require(_0xd0e4('0x7'));var config=require(_0xd0e4('0x8'));var attributes=require('./cmCompany.attributes');module[_0xd0e4('0x9')]=function(_0x4c1e3a,_0xe635e7){return _0x4c1e3a[_0xd0e4('0xa')]('CmCompany',attributes,{'tableName':_0xd0e4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed8f=['./cmCompany.attributes','exports','CmCompany','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x26ed66,_0x3aa151){var _0x262716=function(_0x4f9cd1){while(--_0x4f9cd1){_0x26ed66['push'](_0x26ed66['shift']());}};_0x262716(++_0x3aa151);}(_0xed8f,0x111));var _0xfed8=function(_0x4007b1,_0x206901){_0x4007b1=_0x4007b1-0x0;var _0x108d6c=_0xed8f[_0x4007b1];return _0x108d6c;};'use strict';var _=require('lodash');var util=require(_0xfed8('0x0'));var logger=require('../../config/logger')(_0xfed8('0x1'));var moment=require(_0xfed8('0x2'));var BPromise=require(_0xfed8('0x3'));var rp=require(_0xfed8('0x4'));var fs=require('fs');var path=require(_0xfed8('0x5'));var rimraf=require('rimraf');var config=require(_0xfed8('0x6'));var attributes=require(_0xfed8('0x7'));module[_0xfed8('0x8')]=function(_0x190977,_0x1f6b55){return _0x190977['define'](_0xfed8('0x9'),attributes,{'tableName':'cm_companies','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 eb9c7be..ee97fd0 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 _0xa97b=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','error','message'];(function(_0x3a07c1,_0x34d57f){var _0x2bbe15=function(_0x5a02fb){while(--_0x5a02fb){_0x3a07c1['push'](_0x3a07c1['shift']());}};_0x2bbe15(++_0x34d57f);}(_0xa97b,0x66));var _0xba97=function(_0x2f62df,_0x5e4918){_0x2f62df=_0x2f62df-0x0;var _0x22e45e=_0xa97b[_0x2f62df];return _0x22e45e;};'use strict';var _=require(_0xba97('0x0'));var util=require(_0xba97('0x1'));var moment=require(_0xba97('0x2'));var BPromise=require('bluebird');var rs=require(_0xba97('0x3'));var fs=require('fs');var Redis=require(_0xba97('0x4'));var db=require(_0xba97('0x5'))['db'];var utils=require(_0xba97('0x6'));var logger=require(_0xba97('0x7'))('rpc');var config=require(_0xba97('0x8'));var jayson=require(_0xba97('0x9'));var client=jayson['client'][_0xba97('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc2a770,_0x42e295,_0x2515cb){return new BPromise(function(_0x3fcc06,_0x5aa39c){return client['request'](_0xc2a770,_0x2515cb)[_0xba97('0xb')](function(_0x5e5006){logger[_0xba97('0xc')](_0xba97('0xd'),_0x42e295,_0xba97('0xe'));logger[_0xba97('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x42e295,_0xba97('0xe'),JSON['stringify'](_0x5e5006));if(_0x5e5006[_0xba97('0x10')]){if(_0x5e5006[_0xba97('0x10')]['code']===0x1f4){logger[_0xba97('0x10')](_0xba97('0xd'),_0x42e295,_0x5e5006[_0xba97('0x10')][_0xba97('0x11')]);return _0x5aa39c(_0x5e5006['error'][_0xba97('0x11')]);}logger['error'](_0xba97('0xd'),_0x42e295,_0x5e5006['error'][_0xba97('0x11')]);return _0x3fcc06(_0x5e5006[_0xba97('0x10')]['message']);}else{logger['info'](_0xba97('0xd'),_0x42e295,_0xba97('0xe'));_0x3fcc06(_0x5e5006[_0xba97('0x12')][_0xba97('0x11')]);}})[_0xba97('0x13')](function(_0x5e7da0){logger[_0xba97('0x10')](_0xba97('0xd'),_0x42e295,_0x5e7da0);_0x5aa39c(_0x5e7da0);});});} \ No newline at end of file +var _0x5f82=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','stringify','error','CmCompany,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','../../config/utils'];(function(_0x35d394,_0x16f312){var _0x42b960=function(_0x325d5f){while(--_0x325d5f){_0x35d394['push'](_0x35d394['shift']());}};_0x42b960(++_0x16f312);}(_0x5f82,0x1b3));var _0x25f8=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x5f82[_0x45b034];return _0x509cb0;};'use strict';var _=require(_0x25f8('0x0'));var util=require(_0x25f8('0x1'));var moment=require(_0x25f8('0x2'));var BPromise=require('bluebird');var rs=require(_0x25f8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x25f8('0x4'));var logger=require(_0x25f8('0x5'))(_0x25f8('0x6'));var config=require(_0x25f8('0x7'));var jayson=require(_0x25f8('0x8'));var client=jayson['client'][_0x25f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c3da9,_0x323126,_0xd66590){return new BPromise(function(_0x16f8f7,_0x30cc9a){return client['request'](_0x3c3da9,_0xd66590)[_0x25f8('0xa')](function(_0x5ef6c5){logger['info']('CmCompany,\x20%s,\x20%s',_0x323126,_0x25f8('0xb'));logger[_0x25f8('0xc')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x323126,_0x25f8('0xb'),JSON[_0x25f8('0xd')](_0x5ef6c5));if(_0x5ef6c5[_0x25f8('0xe')]){if(_0x5ef6c5[_0x25f8('0xe')]['code']===0x1f4){logger[_0x25f8('0xe')](_0x25f8('0xf'),_0x323126,_0x5ef6c5[_0x25f8('0xe')][_0x25f8('0x10')]);return _0x30cc9a(_0x5ef6c5[_0x25f8('0xe')][_0x25f8('0x10')]);}logger['error'](_0x25f8('0xf'),_0x323126,_0x5ef6c5[_0x25f8('0xe')][_0x25f8('0x10')]);return _0x16f8f7(_0x5ef6c5[_0x25f8('0xe')]['message']);}else{logger[_0x25f8('0x11')]('CmCompany,\x20%s,\x20%s',_0x323126,_0x25f8('0xb'));_0x16f8f7(_0x5ef6c5[_0x25f8('0x12')]['message']);}})[_0x25f8('0x13')](function(_0x46d56f){logger[_0x25f8('0xe')]('CmCompany,\x20%s,\x20%s',_0x323126,_0x46d56f);_0x30cc9a(_0x46d56f);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index ad93028..99a408b 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 _0xbaab=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','/:id','show','post','/:id/contacts','addContacts','put'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0xbaab,0x1b8));var _0xbbaa=function(_0x54c34e,_0xbba99f){_0x54c34e=_0x54c34e-0x0;var _0x38ed9e=_0xbaab[_0x54c34e];return _0x38ed9e;};'use strict';var multer=require(_0xbbaa('0x0'));var util=require(_0xbbaa('0x1'));var path=require(_0xbbaa('0x2'));var timeout=require(_0xbbaa('0x3'));var express=require(_0xbbaa('0x4'));var router=express[_0xbbaa('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbbaa('0x6'));var interaction=require(_0xbbaa('0x7'));var config=require(_0xbbaa('0x8'));var controller=require(_0xbbaa('0x9'));router[_0xbbaa('0xa')]('/',auth[_0xbbaa('0xb')](),controller[_0xbbaa('0xc')]);router[_0xbbaa('0xa')](_0xbbaa('0xd'),auth[_0xbbaa('0xb')](),controller['describe']);router['get'](_0xbbaa('0xe'),auth[_0xbbaa('0xb')](),controller[_0xbbaa('0xf')]);router[_0xbbaa('0xa')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router['post']('/',auth[_0xbbaa('0xb')](),controller['create']);router[_0xbbaa('0x10')](_0xbbaa('0x11'),auth[_0xbbaa('0xb')](),controller[_0xbbaa('0x12')]);router[_0xbbaa('0x13')](_0xbbaa('0xe'),auth[_0xbbaa('0xb')](),controller[_0xbbaa('0x14')]);router['delete']('/:id',auth[_0xbbaa('0xb')](),controller[_0xbbaa('0x15')]);module[_0xbbaa('0x16')]=router; \ No newline at end of file +var _0xa94c=['post','/:id/contacts','addContacts','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','show','getContacts'];(function(_0x46cfef,_0x3fe887){var _0x5594ce=function(_0x552c4b){while(--_0x552c4b){_0x46cfef['push'](_0x46cfef['shift']());}};_0x5594ce(++_0x3fe887);}(_0xa94c,0x72));var _0xca94=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xa94c[_0x36eaaa];return _0x461349;};'use strict';var multer=require('multer');var util=require(_0xca94('0x0'));var path=require(_0xca94('0x1'));var timeout=require(_0xca94('0x2'));var express=require(_0xca94('0x3'));var router=express[_0xca94('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xca94('0x5'));var config=require(_0xca94('0x6'));var controller=require('./cmCompany.controller');router[_0xca94('0x7')]('/',auth[_0xca94('0x8')](),controller['index']);router[_0xca94('0x7')](_0xca94('0x9'),auth[_0xca94('0x8')](),controller['describe']);router[_0xca94('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xca94('0xa')]);router['get']('/:id/contacts',auth[_0xca94('0x8')](),controller[_0xca94('0xb')]);router[_0xca94('0xc')]('/',auth[_0xca94('0x8')](),controller['create']);router['post'](_0xca94('0xd'),auth[_0xca94('0x8')](),controller[_0xca94('0xe')]);router[_0xca94('0xf')](_0xca94('0x10'),auth[_0xca94('0x8')](),controller[_0xca94('0x11')]);router[_0xca94('0x12')]('/:id',auth[_0xca94('0x8')](),controller[_0xca94('0x13')]);module[_0xca94('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 5899845..0e64fb6 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 _0x725b=['lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x388679,_0x502313){var _0x3392fa=function(_0x39dfda){while(--_0x39dfda){_0x388679['push'](_0x388679['shift']());}};_0x3392fa(++_0x502313);}(_0x725b,0x17a));var _0xb725=function(_0x5c5043,_0x4ad678){_0x5c5043=_0x5c5043-0x0;var _0x2dd68f=_0x725b[_0x5c5043];return _0x2dd68f;};'use strict';var _=require(_0xb725('0x0'));var Sequelize=require(_0xb725('0x1'));module[_0xb725('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xb725('0x3')]},'street':{'type':Sequelize[_0xb725('0x3')]},'postalCode':{'type':Sequelize[_0xb725('0x3')]},'city':{'type':Sequelize[_0xb725('0x3')]},'country':{'type':Sequelize[_0xb725('0x3')]},'dateOfBirth':{'type':Sequelize[_0xb725('0x3')]},'description':{'type':Sequelize[_0xb725('0x4')]},'phone':{'type':Sequelize[_0xb725('0x3')]},'mobile':{'type':Sequelize[_0xb725('0x3')]},'fax':{'type':Sequelize[_0xb725('0x3')]},'email':{'type':Sequelize[_0xb725('0x3')]},'url':{'type':Sequelize[_0xb725('0x3')]},'facebook':{'type':Sequelize[_0xb725('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xb725('0x3')]},'skype':{'type':Sequelize[_0xb725('0x3')]},'teams':{'type':Sequelize[_0xb725('0x3')]},'viber':{'type':Sequelize[_0xb725('0x3')]},'line':{'type':Sequelize[_0xb725('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xb725('0x3')]},'UserId':{'type':Sequelize[_0xb725('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xb725('0x3')]},'priority':{'type':Sequelize[_0xb725('0x5')](0x2)[_0xb725('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xb725('0x7')],'defaultValue':Sequelize[_0xb725('0x8')]},'dialTimezone':{'type':Sequelize[_0xb725('0x3')]},'utcOffset':{'type':Sequelize[_0xb725('0x5')]}}; \ No newline at end of file +var _0x18b4=['UNSIGNED','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x1461ed,_0x21bf49){var _0x5486fc=function(_0x291554){while(--_0x291554){_0x1461ed['push'](_0x1461ed['shift']());}};_0x5486fc(++_0x21bf49);}(_0x18b4,0x1db));var _0x418b=function(_0x6f4a24,_0x43e627){_0x6f4a24=_0x6f4a24-0x0;var _0xd13205=_0x18b4[_0x6f4a24];return _0xd13205;};'use strict';var _=require('lodash');var Sequelize=require(_0x418b('0x0'));module[_0x418b('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x418b('0x2')]},'street':{'type':Sequelize[_0x418b('0x2')]},'postalCode':{'type':Sequelize[_0x418b('0x2')]},'city':{'type':Sequelize[_0x418b('0x2')]},'country':{'type':Sequelize[_0x418b('0x2')]},'dateOfBirth':{'type':Sequelize[_0x418b('0x2')]},'description':{'type':Sequelize[_0x418b('0x3')]},'phone':{'type':Sequelize[_0x418b('0x2')]},'mobile':{'type':Sequelize[_0x418b('0x2')]},'fax':{'type':Sequelize[_0x418b('0x2')]},'email':{'type':Sequelize[_0x418b('0x2')]},'url':{'type':Sequelize[_0x418b('0x2')]},'facebook':{'type':Sequelize[_0x418b('0x2')]},'fb_data':{'type':Sequelize[_0x418b('0x2')]},'twitter':{'type':Sequelize[_0x418b('0x2')]},'skype':{'type':Sequelize[_0x418b('0x2')]},'teams':{'type':Sequelize[_0x418b('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x418b('0x2')]},'wechat':{'type':Sequelize[_0x418b('0x2')]},'telegram':{'type':Sequelize[_0x418b('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x418b('0x2')]},'priority':{'type':Sequelize[_0x418b('0x4')](0x2)[_0x418b('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x418b('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 69c496d..7441b60 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 _0x9811=['stack','name','send','index','CmContact','keys','length','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','type','model','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','field','color','tools_tags','from','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','cm_contact_has_tags','t.id\x20=\x20ct.TagId','where','expr','search','parseSearch','sqlOperator','conditions','find','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','value','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','end','filter','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','\x20=\x20?','tag','replace','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','group','c.id','SELECT','DESC','t.id\x20IN\x20?','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','merge','fields','c.firstName','c.lastName','c.phone','c.mobile','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','catch','destroy','params','describe','tags','displayName','columnName','alias','custom','body','findAll','get','mergeWith','isArray','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','create','join','utcOffset','timezones','additionalPhones','bulkCreate','duplicates','$or','findOrCreate','contact','show','Phones','ContactItemType','ItemType','literal','omit','cf_%d','$and','pickBy','format','table','setFields','id\x20=\x20?','text','values','phone','getTags','rawAttributes','options','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','CmContactId','hopperId','getHoppers','ContactId','includeAll','include','rows','getHopperHistories','getHopperFinals','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','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','importUpdates','../../components/import/cm/csvUpdates','getJourney','mail','chat','sms','openchannel','whatsapp','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','destination','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','VoiceCallReport','findAndCountAll','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','key','browserName','customerIp','customerPort','osName','ratingValue','referer','substatus','externalUrl','threadId','Interaction','Owner','flatten','sortBy','reverse','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','then','sendStatus','error'];(function(_0xd2c095,_0x47fff6){var _0x26fe6f=function(_0x567dc1){while(--_0x567dc1){_0xd2c095['push'](_0xd2c095['shift']());}};_0x26fe6f(++_0x47fff6);}(_0x9811,0x123));var _0x1981=function(_0x320a89,_0x28abca){_0x320a89=_0x320a89-0x0;var _0x21d07b=_0x9811[_0x320a89];return _0x21d07b;};'use strict';var moment=require('moment');var BPromise=require(_0x1981('0x0'));var util=require(_0x1981('0x1'));var path=require(_0x1981('0x2'));var fs=require('fs');var _=require(_0x1981('0x3'));var squel=require(_0x1981('0x4'));var Papa=require(_0x1981('0x5'));var Redis=require(_0x1981('0x6'));var qs=require(_0x1981('0x7'));var as=require(_0x1981('0x8'));var logger=require(_0x1981('0x9'))(_0x1981('0xa'));var config=require(_0x1981('0xb'));var shared=require(_0x1981('0xc'));var db=require(_0x1981('0xd'))['db'];config[_0x1981('0xe')]=_['defaults'](config[_0x1981('0xe')],{'host':_0x1981('0xf'),'port':0x18eb});var socket=require(_0x1981('0x10'))(new Redis(config[_0x1981('0xe')]));require(_0x1981('0x11'))[_0x1981('0x12')](socket);function respondWithResult(_0x290773,_0x3b8e14){_0x3b8e14=_0x3b8e14||0xc8;return function(_0x3b77ce){if(_0x3b77ce){return _0x290773[_0x1981('0x13')](_0x3b8e14)[_0x1981('0x14')](_0x3b77ce);}};}function respondWithFilteredResult(_0x5e42d8,_0x4aac78){return function(_0x465880){if(_0x465880){var _0x17a959=typeof _0x4aac78[_0x1981('0x15')]===_0x1981('0x16')&&typeof _0x4aac78[_0x1981('0x17')]===_0x1981('0x16');var _0x22c4c6=_0x465880[_0x1981('0x18')];var _0x2c4c25=_0x17a959?0x0:_0x4aac78['offset'];var _0x2e0c20=_0x17a959?_0x465880['count']:_0x4aac78[_0x1981('0x15')]+_0x4aac78[_0x1981('0x17')];var _0x5c9015;if(_0x2e0c20>=_0x22c4c6){_0x2e0c20=_0x22c4c6;_0x5c9015=0xc8;}else{_0x5c9015=0xce;}_0x5e42d8[_0x1981('0x13')](_0x5c9015);return _0x5e42d8[_0x1981('0x19')](_0x1981('0x1a'),_0x2c4c25+'-'+_0x2e0c20+'/'+_0x22c4c6)['json'](_0x465880);}return null;};}function saveUpdates(_0x72df02){return function(_0x276da8){if(_0x276da8){return _0x276da8['update'](_0x72df02)[_0x1981('0x1b')](function(_0x504b4f){return _0x504b4f;});}return null;};}function removeEntity(_0x25f024){return function(_0xbd5ca6){if(_0xbd5ca6){return _0xbd5ca6['destroy']()[_0x1981('0x1b')](function(){_0x25f024['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40f1d8){return function(_0x54e410){if(!_0x54e410){_0x40f1d8[_0x1981('0x1c')](0x194);}return _0x54e410;};}function handleError(_0x385c6e,_0x292321){_0x292321=_0x292321||0x1f4;return function(_0x1357e6){logger[_0x1981('0x1d')](_0x1357e6[_0x1981('0x1e')]);if(_0x1357e6[_0x1981('0x1f')]){delete _0x1357e6[_0x1981('0x1f')];}_0x385c6e[_0x1981('0x13')](_0x292321)[_0x1981('0x20')](_0x1357e6);};}exports[_0x1981('0x21')]=function(_0x361139,_0x8fd524){var _0x5f0120={},_0xca3dba={},_0x32ed3a={'count':0x0,'rows':[]};return db[_0x1981('0x22')]['describe']()['then'](function(_0x41edd1){var _0x254c66=[];for(var _0x4998e1=0x0;_0x4998e10x1){_0x5a0465['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1981('0x62')](_0x41f933),null);}else{if(qs[_0x1981('0x63')](_0x41f933)){_0x5a0465['or'](_0x1981('0x64'),_0x41f933+'%');_0x5a0465['or'](_0x1981('0x65'),_0x41f933+'%');_0x5a0465['or'](_0x1981('0x66'),_0x41f933+'%');_0x5a0465['or'](_0x1981('0x67'),_0x41f933+'%');}else if(qs[_0x1981('0x68')](_0x41f933)){_0x5a0465['or']('c.email\x20LIKE\x20?',_0x41f933+'%');}else{_0x5a0465['or'](_0x1981('0x69'),'%'+_0x41f933+'%');_0x5a0465['or']('c.lastName\x20LIKE\x20?','%'+_0x41f933+'%');_0x5a0465['or'](_0x1981('0x6a'),'%'+_0x41f933+'%');}}}}_0x23a62c[_0x1981('0x40')](_0x5a0465);_0x23a62c[_0x1981('0x6b')](_0x1981('0x6c'));var _0x5d5a80={'type':db['Sequelize']['QueryTypes'][_0x1981('0x6d')],'raw':!![]};var _0x5d60fc=_0x23a62c['clone']()[_0x1981('0x37')](_0x1981('0x6c'));if(_0x5f0120[_0x1981('0x33')]){_0x5f0120['order'][_0x1981('0x4a')](function(_0xe2d6e3){_0x23a62c[_0x1981('0x33')]('c.'+_0xe2d6e3[0x0],_0xe2d6e3[0x1]===_0x1981('0x6e')?![]:!![]);});}if(!_[_0x1981('0x5b')](_0x3290dd)){_0x23a62c['having'](_0x16ee61);_0x5d60fc[_0x1981('0x40')](_0x1981('0x6f'),_0x3290dd);}BPromise[_0x1981('0x70')]()[_0x1981('0x1b')](function(){if(!_0x309d21)return;if(_0x361139[_0x1981('0x71')][_0x1981('0x72')]!==_0x1981('0x73'))return;if(!_[_0x1981('0x74')](_0x309d21['conditions'],[_0x1981('0x37'),_0x1981('0x4d')])){return _0x361139[_0x1981('0x71')][_0x1981('0x75')]({'attributes':['id'],'raw':!![]})['then'](function(_0x563c1a){if(_['isEmpty'](_0x563c1a)){_0x5d60fc['where'](_0x1981('0x76'));_0x23a62c[_0x1981('0x40')](_0x1981('0x76'));}else{_0x5d60fc[_0x1981('0x40')](_0x1981('0x5d'),_[_0x1981('0x49')](_0x563c1a,'id'));_0x23a62c['where']('c.ListId\x20IN\x20?',_[_0x1981('0x49')](_0x563c1a,'id'));}});}})['then'](function(){if(_0x361139[_0x1981('0x71')][_0x1981('0x72')]==='agent'&&!_0x309d21&&!_0x361139[_0x1981('0x2e')]['ListId'])return[];return db[_0x1981('0x77')][_0x1981('0x2e')](_0x5d60fc[_0x1981('0x78')](),_0x5d5a80);})['then'](function(_0x20f17c){_0x32ed3a[_0x1981('0x18')]=_0x20f17c[_0x1981('0x24')];if(_0x32ed3a[_0x1981('0x18')]===0x0)return[];return db[_0x1981('0x77')][_0x1981('0x2e')](_0x4c29d1['toString'](),_0x5d5a80)[_0x1981('0x1b')](function(_0x162a2e){_0x3bd936=_[_0x1981('0x79')](_0x162a2e,'id');_0x5d5a80=_[_0x1981('0x7a')](_0x5d5a80,{'model':db[_0x1981('0x22')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x361139[_0x1981('0x2e')][_0x1981('0x7b')]){_0x5f0120['attributes'][_0x1981('0x4a')](function(_0x53d9d0){_0x23a62c['field']('c.'+_0x53d9d0);});}else{_0x23a62c[_0x1981('0x37')](_0x1981('0x6c'));_0x23a62c['field'](_0x1981('0x7c'));_0x23a62c[_0x1981('0x37')](_0x1981('0x7d'));_0x23a62c[_0x1981('0x37')](_0x1981('0x7e'));_0x23a62c['field'](_0x1981('0x7f'));_0x23a62c[_0x1981('0x37')]('c.fax');_0x23a62c['field'](_0x1981('0x80'));_0x23a62c['field'](_0x1981('0x81'));_0x23a62c['field'](_0x1981('0x82'));_0x23a62c[_0x1981('0x37')](_0x1981('0x83'));_0x23a62c[_0x1981('0x37')](_0x1981('0x84'));_0x23a62c[_0x1981('0x37')](_0x1981('0x85'),_0x1981('0x86'));}if(_0x5f0120[_0x1981('0x17')])_0x23a62c[_0x1981('0x17')](_0x5f0120[_0x1981('0x17')]);if(_0x5f0120[_0x1981('0x15')])_0x23a62c[_0x1981('0x15')](_0x5f0120[_0x1981('0x15')]);return db[_0x1981('0x77')][_0x1981('0x2e')](_0x23a62c[_0x1981('0x78')](),_0x5d5a80);});})[_0x1981('0x1b')](function(_0x3a6abb){_0x3a6abb[_0x1981('0x4a')](function(_0x5b13af){if(_0x5b13af['TagIds']){_0x5b13af[_0x1981('0x87')]=[];_0x5b13af[_0x1981('0x86')]['split'](',')[_0x1981('0x4a')](function(_0x467f1d){_0x5b13af[_0x1981('0x87')]['push'](_0x3bd936[_0x467f1d]);});}delete _0x5b13af['TagIds'];});_0x32ed3a['rows']=_0x3a6abb;return _0x32ed3a;})[_0x1981('0x1b')](respondWithFilteredResult(_0x8fd524,_0x5f0120));})[_0x1981('0x88')](handleError(_0x8fd524,null));};exports[_0x1981('0x89')]=function(_0x3eb7c1,_0x48e015){return db[_0x1981('0x22')]['find']({'where':{'id':_0x3eb7c1[_0x1981('0x8a')]['id']}})[_0x1981('0x1b')](handleEntityNotFound(_0x48e015,null))['then'](removeEntity(_0x48e015,null))[_0x1981('0x88')](handleError(_0x48e015,null));};exports['describe']=function(_0x31511e,_0x50c648){return db[_0x1981('0x22')][_0x1981('0x8b')]()['then'](function(_0x2b29f1){delete _0x2b29f1[_0x1981('0x8c')];for(var _0x1e2abd=0x0;_0x1e2abd0x0){return new Promise(function(_0x5e79b8,_0x323632){var _0x56004b=[];for(var _0x494d04=0x0;_0x494d04<_0x25b18b[_0x1981('0x24')];_0x494d04++){_0x56004b[_0x1981('0x27')](insertAdditionalPhones(_0x25b18b[_0x494d04][_0x1981('0xba')],_0x25b18b[_0x494d04]['additionalPhones']));}Promise[_0x1981('0x2b')](_0x56004b)[_0x1981('0x1b')](function(){_0x5e79b8(0x1);});})[_0x1981('0x1b')](function(){return{'success':_0x1c46d1,'failure':_0x456f2c,'duplicates':_0x9ec8ae};});}else{return{'success':_0x1c46d1,'failure':_0x456f2c,'duplicates':_0x9ec8ae};}}})['then'](respondWithResult(_0x2003be,0xc9))[_0x1981('0x88')](handleError(_0x2003be,null));};exports[_0x1981('0xbb')]=function(_0x141176,_0x1e1c04){var _0x29f8b8;return db[_0x1981('0x22')][_0x1981('0x8b')]()[_0x1981('0x1b')](function(_0x5d42e7){return db['CmContact'][_0x1981('0x46')]({'where':{'id':_0x141176[_0x1981('0x8a')]['id']},'include':[{'model':db[_0x1981('0x47')],'as':_0x1981('0x87'),'attributes':['id',_0x1981('0x1f'),_0x1981('0x38')],'required':_0x141176[_0x1981('0x2e')]['tag']?!![]:![]},{'model':db[_0x1981('0xa6')],'as':_0x1981('0xbc'),'where':{'CmContactId':_0x141176[_0x1981('0x8a')]['id']},'required':![],'include':[{'model':db[_0x1981('0xbd')],'as':_0x1981('0xbe')}]}],'order':[db[_0x1981('0x77')][_0x1981('0xbf')]('Phones.OrderBy')],'attributes':_['keys'](_0x5d42e7)});})['then'](function(_0x3cb87c){if(!_[_0x1981('0x59')](_0x3cb87c)){_0x29f8b8=_0x3cb87c[_0x1981('0x93')]({'plain':!![]});var _0x4dc4b5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3cb87c&&_0x3cb87c[_0x1981('0x5c')]){if(_0x3cb87c[_0x1981('0x5c')]){_0x4dc4b5['where']['$and'][_0x1981('0x27')]({'ListId':{'$ne':_0x3cb87c[_0x1981('0x5c')]}});}}return db[_0x1981('0x28')][_0x1981('0x92')](_0x4dc4b5);}})[_0x1981('0x1b')](function(_0x40b193){if(!_[_0x1981('0x59')](_0x40b193)){return _[_0x1981('0xc0')](_0x29f8b8,_[_0x1981('0x49')](_0x40b193,function(_0x12d4fc){return util['format'](_0x1981('0xc1'),_0x12d4fc['id']);}));}})['then'](handleEntityNotFound(_0x1e1c04,null))[_0x1981('0x1b')](respondWithResult(_0x1e1c04,null))['catch'](handleError(_0x1e1c04,null));};exports[_0x1981('0x9d')]=function(_0x187161,_0x334a1d){var _0x1b0448;if(_0x187161[_0x1981('0x91')]['id']){delete _0x187161[_0x1981('0x91')]['id'];}if(!_[_0x1981('0x59')](_0x187161[_0x1981('0x91')]['dialTimezone'])){var _0x1f43c8=_0x187161[_0x1981('0x91')]['dialTimezone'];if(!_[_0x1981('0x59')](shared[_0x1981('0xb4')][_0x1f43c8]))_0x187161[_0x1981('0x91')][_0x1981('0xb3')]=shared[_0x1981('0xb4')][_0x1f43c8][_0x1981('0xb3')];}return db[_0x1981('0x22')][_0x1981('0x46')]({'where':{'id':_0x187161[_0x1981('0x8a')]['id']}})['then'](handleEntityNotFound(_0x334a1d,null))[_0x1981('0x1b')](saveUpdates(_0x187161[_0x1981('0x91')],null))['then'](function(_0xc75c2e){_0x1b0448=_0xc75c2e;var _0x260e1d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xc75c2e&&_0xc75c2e['ListId']){if(_0xc75c2e[_0x1981('0x5c')]){_0x260e1d[_0x1981('0x40')][_0x1981('0xc2')][_0x1981('0x27')]({'ListId':{'$ne':_0xc75c2e[_0x1981('0x5c')]}});}}return db[_0x1981('0x28')][_0x1981('0x92')](_0x260e1d);})[_0x1981('0x1b')](function(_0x2c0e4f){if(_0x2c0e4f){return _[_0x1981('0xc0')](_[_0x1981('0xc3')](_0x187161['body'],function(_0x3dc055,_0x4bada7){return _[_0x1981('0x25')](_0x4bada7,'cf_');}),_[_0x1981('0x49')](_0x2c0e4f,function(_0x33d37b){return util[_0x1981('0xc4')]('cf_%d',_0x33d37b['id']);}));}})[_0x1981('0x1b')](function(_0x4c6c01){if(_0x4c6c01&&!_[_0x1981('0x5b')](_0x4c6c01)){var _0x21bb9d=squel[_0x1981('0x9d')]()[_0x1981('0xc5')]('cm_contacts')[_0x1981('0xc6')](_0x4c6c01)[_0x1981('0x40')](_0x1981('0xc7'),_0x187161[_0x1981('0x8a')]['id'])['toParam']();return db[_0x1981('0x77')][_0x1981('0x2e')](_0x21bb9d[_0x1981('0xc8')],{'replacements':_0x21bb9d[_0x1981('0xc9')]});}})['then'](function(){if(_0x187161[_0x1981('0x91')][_0x1981('0xca')]&&_0x1b0448){return db[_0x1981('0x98')][_0x1981('0x9d')]({'phone':_0x187161[_0x1981('0x91')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x1b0448['id']}});}})['then'](function(){return _0x1b0448;})[_0x1981('0x1b')](respondWithResult(_0x334a1d,null))[_0x1981('0x88')](handleError(_0x334a1d,null));};exports[_0x1981('0xcb')]=function(_0x47b823,_0x291386){var _0x485bff={};var _0x45d42f={};var _0x39f3f8;var _0x359917;return db[_0x1981('0x22')][_0x1981('0x29')]({'where':{'id':_0x47b823['params']['id']}})[_0x1981('0x1b')](handleEntityNotFound(_0x291386,null))['then'](function(_0x350ad2){if(_0x350ad2){_0x39f3f8=_0x350ad2;_0x45d42f[_0x1981('0x2d')]=_[_0x1981('0x23')](db[_0x1981('0x47')][_0x1981('0xcc')]);_0x45d42f[_0x1981('0x2e')]=_[_0x1981('0x23')](_0x47b823['query']);_0x45d42f[_0x1981('0x35')]=_[_0x1981('0x2f')](_0x45d42f[_0x1981('0x2d')],_0x45d42f[_0x1981('0x2e')]);_0x485bff[_0x1981('0x30')]=_[_0x1981('0x2f')](_0x45d42f['model'],qs[_0x1981('0x7b')](_0x47b823[_0x1981('0x2e')][_0x1981('0x7b')]));_0x485bff[_0x1981('0x30')]=_0x485bff[_0x1981('0x30')][_0x1981('0x24')]?_0x485bff[_0x1981('0x30')]:_0x45d42f[_0x1981('0x2d')];_0x485bff[_0x1981('0x33')]=qs['sort'](_0x47b823['query'][_0x1981('0x34')]);_0x485bff[_0x1981('0x40')]=qs[_0x1981('0x35')](_['pick'](_0x47b823[_0x1981('0x2e')],_0x45d42f[_0x1981('0x35')]));if(_0x47b823[_0x1981('0x2e')]['filter']){_0x485bff[_0x1981('0x40')]=_[_0x1981('0x7a')](_0x485bff[_0x1981('0x40')],{'$or':_['map'](_0x485bff['attributes'],function(_0x4ccb4d){var _0x1f4239={};_0x1f4239[_0x4ccb4d]={'$like':'%'+_0x47b823[_0x1981('0x2e')][_0x1981('0x58')]+'%'};return _0x1f4239;})});}_0x485bff=_[_0x1981('0x7a')]({},_0x485bff,_0x47b823[_0x1981('0xcd')]);return _0x39f3f8[_0x1981('0xcb')](_0x485bff);}})[_0x1981('0x1b')](function(_0x58bc1f){if(_0x58bc1f){_0x359917=_0x58bc1f[_0x1981('0x24')];if(!_0x47b823['query']['hasOwnProperty'](_0x1981('0x32'))){_0x485bff['limit']=qs[_0x1981('0x17')](_0x47b823[_0x1981('0x2e')]['limit']);_0x485bff[_0x1981('0x15')]=qs[_0x1981('0x15')](_0x47b823[_0x1981('0x2e')][_0x1981('0x15')]);}return _0x39f3f8[_0x1981('0xcb')](_0x485bff);}})[_0x1981('0x1b')](function(_0x358dcc){if(_0x358dcc){return _0x358dcc?{'count':_0x359917,'rows':_0x358dcc}:null;}})[_0x1981('0x1b')](respondWithResult(_0x291386,null))[_0x1981('0x88')](handleError(_0x291386,null));};exports[_0x1981('0xce')]=function(_0x2653d3,_0x3bdcbd){if(_0x2653d3['body']['id']){delete _0x2653d3[_0x1981('0x91')]['id'];}return db[_0x1981('0x22')]['findOne']({'where':{'id':_0x2653d3['params']['id']}})[_0x1981('0x1b')](handleEntityNotFound(_0x3bdcbd,null))['then'](function(_0x3133d6){if(_0x3133d6){return _0x3133d6['setTags'](_0x2653d3[_0x1981('0x91')][_0x1981('0xcf')]||[]);}return null;})[_0x1981('0x1b')](respondWithResult(_0x3bdcbd,null))[_0x1981('0x88')](handleError(_0x3bdcbd,null));};exports[_0x1981('0xd0')]=function(_0x235dd4,_0x27a7fb){var _0x517093=[];_0x517093[_0x1981('0x27')](addAdditionalPhones(_0x235dd4[_0x1981('0x91')]));Promise['all'](_0x517093)[_0x1981('0x1b')](function(){_0x517093=[];_0x517093[_0x1981('0x27')](deleteCmHopperPhones(_0x235dd4[_0x1981('0x91')]['id']));_0x517093[_0x1981('0x27')](addCmHopperPhones(_0x235dd4[_0x1981('0x91')]['id']));Promise[_0x1981('0x2b')](_0x517093)[_0x1981('0x1b')](function(){return[0x1];})[_0x1981('0x1b')](respondWithResult(_0x27a7fb,null));});};function addAdditionalPhones(_0x423454){var _0x5c120a;return new Promise(function(_0x1147bf,_0x1acf13){return db[_0x1981('0xa6')][_0x1981('0x89')]({'where':{'CmContactId':_0x423454['id']}})[_0x1981('0x1b')](function(){db['ContactItemType'][_0x1981('0x92')]({'raw':!![],'attributes':['id',_0x1981('0xd1')]})[_0x1981('0x1b')](function(_0x1ac2f8){var _0x5fdd31=[];for(var _0x5156c7=0x0;_0x5156c7<_0x423454[_0x1981('0xd2')][_0x1981('0x24')];_0x5156c7++){var _0x5d18c0=_0x423454['item_types']?_['isNil'](_0x423454[_0x1981('0xd3')][_0x5156c7])?'':_0x423454[_0x1981('0xd3')][_0x5156c7]:_0x423454[_0x1981('0xd2')][_0x5156c7][_0x1981('0xd4')]?_0x423454[_0x1981('0xd2')][_0x5156c7][_0x1981('0xd4')]:'';var _0x5e89f4=_[_0x1981('0x59')](_0x423454[_0x1981('0xd2')][_0x5156c7]['description'])?'':_0x423454[_0x1981('0xd2')][_0x5156c7][_0x1981('0xd5')];var _0x527c3c=_0x5d18c0+':'+_0x423454[_0x1981('0xd2')][_0x5156c7][_0x1981('0xca')]+'§'+_0x5e89f4;if(_[_0x1981('0x59')](_0x5c120a))_0x5c120a=_0x527c3c;else _0x5c120a+=';'+_0x527c3c;var _0x462746=null;if(_0x423454[_0x1981('0xd3')]){if(!_[_0x1981('0x59')](_0x423454[_0x1981('0xd3')][_0x5156c7])){var _0x3f88e0=_[_0x1981('0x46')](_0x1ac2f8,function(_0x473203){return _0x473203['id']===_0x423454['item_types'][_0x5156c7];});if(!_[_0x1981('0x59')](_0x3f88e0)){_0x462746=_0x3f88e0['OrderBy'];}}}else{if(!_[_0x1981('0x59')](_0x423454['items'][_0x5156c7])){var _0x3f88e0=_['find'](_0x1ac2f8,function(_0x290397){return _0x290397['id']===_0x423454[_0x1981('0xd2')][_0x5156c7][_0x1981('0xd4')];});if(!_[_0x1981('0x59')](_0x3f88e0)){_0x462746=_0x5156c7;}}}if(_[_0x1981('0x59')](_0x462746)){_0x462746=0x64;}_0x5fdd31[_0x1981('0x27')](addAdditionalPhone(_0x423454['id'],_0x423454[_0x1981('0xd2')][_0x5156c7][_0x1981('0xca')],_0x423454[_0x1981('0xd3')]?_[_0x1981('0x59')](_0x423454[_0x1981('0xd3')][_0x5156c7])?null:_0x423454[_0x1981('0xd3')][_0x5156c7]:_0x423454[_0x1981('0xd2')][_0x5156c7]['ItemTypeId']?_0x423454[_0x1981('0xd2')][_0x5156c7]['ItemTypeId']:null,_0x462746,_0x5e89f4));}Promise['all'](_0x5fdd31)['then'](function(){db['CmContact'][_0x1981('0x9d')]({'AdditionalPhones':_0x5c120a},{'where':{'id':_0x423454['id']}})[_0x1981('0x1b')](function(){_0x1147bf(0x1);});});});});});}function addAdditionalPhone(_0x5ba8d2,_0xbffcfc,_0x509fd9,_0x5e638d,_0x2139b9){return db['CmContactHasItem'][_0x1981('0x46')]({'where':{'CmContactId':_0x5ba8d2,'item':_0xbffcfc}})[_0x1981('0x1b')](function(_0x551008){if(_0x551008)logger['info'](_0x1981('0xd6'),_0x551008);else{db[_0x1981('0xa6')][_0x1981('0xb1')]({'CmContactId':_0x5ba8d2,'item':_0xbffcfc,'ItemTypeId':_0x509fd9,'OrderBy':_0x5e638d,'ItemClass':_0x1981('0xd7'),'description':_0x2139b9});}});}function deletePhones(_0x233918){return db[_0x1981('0xa6')][_0x1981('0x89')]({'where':{'CmContactId':_0x233918}});}function deleteCmHopperPhones(_0x3784a4){return new Promise(function(_0x189f62,_0x3a92a1){return db[_0x1981('0x98')][_0x1981('0x92')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3784a4}})['then'](function(_0x3452e0){db[_0x1981('0xd8')][_0x1981('0x89')]({'where':{'CmHopperId':{'$in':_[_0x1981('0x49')](_0x3452e0,'id')}}});})['then'](function(){_0x189f62(0x1);});});}function addCmHopperPhones(_0x4650ee){return new Promise(function(_0x20bce4,_0x2322c0){return db[_0x1981('0x98')][_0x1981('0x92')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4650ee}})[_0x1981('0x1b')](function(_0x17a909){var _0x5b8bb0=[];_[_0x1981('0x49')](_0x17a909,function(_0x552be0){_0x5b8bb0[_0x1981('0x27')](createCmHopperPhone(_0x4650ee,_0x552be0['id']));});Promise[_0x1981('0x2b')](_0x5b8bb0)['then'](function(){_0x20bce4(0x1);});});});}function createCmHopperPhone(_0x60c405,_0x3f7119){return new Promise(function(_0x590d85,_0x318706){db[_0x1981('0xa6')][_0x1981('0x92')]({'raw':!![],'attributes':[_0x1981('0xd9'),_0x1981('0xd1')],'where':{'CmContactId':_0x60c405,'ItemClass':_0x1981('0xd7')},'include':[{'model':db[_0x1981('0xbd')],'attributes':[_0x1981('0xd1')],'as':'ItemType'}],'order':[_0x1981('0xd1'),db[_0x1981('0x77')]['literal'](_0x1981('0xda'))]})[_0x1981('0x1b')](function(_0x41fad){var _0x3431e4=0x1;var _0x385e44=_[_0x1981('0x49')](_0x41fad,function(_0x465a71){_0x465a71[_0x1981('0xdb')]=_0x3f7119;_0x465a71[_0x1981('0xca')]=_0x465a71['item'];_0x465a71[_0x1981('0xd1')]=_0x3431e4;delete _0x465a71[_0x1981('0xdc')];_0x3431e4=_0x3431e4+0x1;return _0x465a71;});return db['CmHopperAdditionalPhone'][_0x1981('0xb6')](_0x385e44,{});})[_0x1981('0x1b')](function(){_0x590d85(0x1);});});}function insertAdditionalPhones(_0x30e52d,_0x4e9b3b){return new Promise(function(_0x589a64,_0x119ed9){var _0x424897=[];for(var _0x7980ab=0x0;_0x7980ab<_0x4e9b3b[_0x1981('0x24')];_0x7980ab++){var _0x56ff60=_0x4e9b3b[_0x7980ab];_0x424897[_0x1981('0x27')](parseContactItemType(_0x56ff60));}Promise['all'](_0x424897)['then'](function(){var _0x21f33c={'id':_0x30e52d['id'],'items':_0x4e9b3b};return addAdditionalPhones(_0x21f33c)[_0x1981('0x1b')](function(_0x6828cf){return addCmHopperPhones(_0x30e52d['id']);});})[_0x1981('0x1b')](function(){_0x589a64(_0x30e52d);});});}function parseContactItemType(_0x5d859a){return new Promise(function(_0x3ce8e7,_0x32eb5d){if(_0x5d859a[_0x1981('0x31')](_0x1981('0xd4'))){_0x3ce8e7(_0x5d859a);}else{return db[_0x1981('0xbd')]['find']({'where':{'name':_0x5d859a[_0x1981('0xbe')]}})['then'](function(_0x38002d){if(_[_0x1981('0x59')](_0x38002d))_0x5d859a['ItemTypeId']=null;else _0x5d859a[_0x1981('0xd4')]=_0x38002d['id'];_0x3ce8e7(_0x5d859a);});}});}exports[_0x1981('0xdd')]=function(_0x1f77ac,_0x4f8ee7){return db[_0x1981('0xa6')][_0x1981('0x92')]({'raw':!![],'where':{'CmContactId':_0x1f77ac[_0x1981('0x8a')]['id'],'ItemClass':_0x1981('0xd7')},'include':[{'model':db[_0x1981('0xbd')],'as':_0x1981('0xbe')}],'order':[[_0x1981('0xd1')],[db[_0x1981('0x77')][_0x1981('0xbf')](_0x1981('0xda'))]]})[_0x1981('0x1b')](function(_0x12d6be){return _0x12d6be;})['then'](respondWithResult(_0x4f8ee7,null))[_0x1981('0x88')](handleError(_0x4f8ee7,null));};exports['duplicateAdditionalPhones']=function(_0xe99177,_0x1fb245){return db['CmContactHasItem'][_0x1981('0x92')]({'raw':!![],'where':{'CmContactId':_0xe99177['body']['fromContactId']}})[_0x1981('0x1b')](function(_0x4f298b){var _0x31d41a=_['map'](_0x4f298b,function(_0x16ba6e){_0x16ba6e[_0x1981('0xde')]=_0xe99177[_0x1981('0x91')]['toContactId'];return _0x16ba6e;});return db[_0x1981('0xa6')][_0x1981('0xb6')](_0x31d41a,{});})[_0x1981('0x1b')](function(_0x35f7a3){return addCmHopperPhones(_0xe99177['body']['toContactId']);})[_0x1981('0x1b')](function(_0x9c6782){return['ok'];})[_0x1981('0x1b')](respondWithResult(_0x1fb245,null))['catch'](handleError(_0x1fb245,null));};exports['rescheduleAdditionalPhones']=function(_0x1240d2,_0x55c9c9){var _0x3a7c0c=[];_0x3a7c0c[_0x1981('0x27')](createCmHopperPhone(_0x1240d2[_0x1981('0x91')]['id'],_0x1240d2[_0x1981('0x91')][_0x1981('0xdf')]));Promise[_0x1981('0x2b')](_0x3a7c0c)[_0x1981('0x1b')](function(){return[0x1];})[_0x1981('0x1b')](respondWithResult(_0x55c9c9,null));};exports[_0x1981('0xe0')]=function(_0x981b87,_0x436d13){var _0x129209={'raw':![],'where':{}};var _0x35e4f7={};var _0x3c400c={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x981b87['params']['id']}})[_0x1981('0x1b')](handleEntityNotFound(_0x436d13,null))[_0x1981('0x1b')](function(_0x4cdd09){if(_0x4cdd09){_0x35e4f7['model']=_[_0x1981('0x23')](db[_0x1981('0x98')][_0x1981('0xcc')]);_0x35e4f7['query']=_['keys'](_0x981b87[_0x1981('0x2e')]);_0x35e4f7[_0x1981('0x35')]=_[_0x1981('0x2f')](_0x35e4f7[_0x1981('0x2d')],_0x35e4f7[_0x1981('0x2e')]);_0x129209[_0x1981('0x30')]=_['intersection'](_0x35e4f7[_0x1981('0x2d')],qs[_0x1981('0x7b')](_0x981b87[_0x1981('0x2e')]['fields']));_0x129209[_0x1981('0x30')]=_0x129209[_0x1981('0x30')]['length']?_0x129209['attributes']:_0x35e4f7['model'];if(!_0x981b87[_0x1981('0x2e')][_0x1981('0x31')]('nolimit')){_0x129209[_0x1981('0x17')]=qs['limit'](_0x981b87[_0x1981('0x2e')][_0x1981('0x17')]);_0x129209[_0x1981('0x15')]=qs[_0x1981('0x15')](_0x981b87[_0x1981('0x2e')][_0x1981('0x15')]);}_0x129209[_0x1981('0x33')]=qs[_0x1981('0x34')](_0x981b87[_0x1981('0x2e')][_0x1981('0x34')]);_0x129209[_0x1981('0x40')]=qs[_0x1981('0x35')](_[_0x1981('0x36')](_0x981b87[_0x1981('0x2e')],_0x35e4f7[_0x1981('0x35')]));_0x129209[_0x1981('0x40')][_0x1981('0xe1')]=_0x4cdd09['id'];if(_0x981b87[_0x1981('0x2e')][_0x1981('0x58')]){_0x129209[_0x1981('0x40')]=_['merge'](_0x129209['where'],{'$or':_['map'](_0x129209[_0x1981('0x30')],function(_0x24bcd7){var _0x177460={};_0x177460[_0x24bcd7]={'$like':'%'+_0x981b87['query'][_0x1981('0x58')]+'%'};return _0x177460;})});}_0x129209=_['merge']({},_0x129209,_0x981b87['options']);return db[_0x1981('0x98')][_0x1981('0x18')]({'where':_0x129209[_0x1981('0x40')]})[_0x1981('0x1b')](function(_0x427052){_0x3c400c[_0x1981('0x18')]=_0x427052;if(_0x981b87[_0x1981('0x2e')][_0x1981('0xe2')]){_0x129209[_0x1981('0xe3')]=[{'all':!![]}];}return db[_0x1981('0x98')][_0x1981('0x92')](_0x129209);})[_0x1981('0x1b')](function(_0x2c3bba){_0x3c400c[_0x1981('0xe4')]=_0x2c3bba;return _0x3c400c;});}})['then'](respondWithFilteredResult(_0x436d13,_0x129209))['catch'](handleError(_0x436d13,null));};exports[_0x1981('0xe5')]=function(_0x175c94,_0x1eae77){var _0x5dd022={'raw':!![],'where':{}};var _0xc6c4e={};var _0x1dfadb={'count':0x0,'rows':[]};return db['CmContact'][_0x1981('0x29')]({'where':{'id':_0x175c94['params']['id']}})[_0x1981('0x1b')](handleEntityNotFound(_0x1eae77,null))[_0x1981('0x1b')](function(_0x491f65){if(_0x491f65){_0xc6c4e['model']=_[_0x1981('0x23')](db[_0x1981('0xa8')]['rawAttributes']);_0xc6c4e[_0x1981('0x2e')]=_[_0x1981('0x23')](_0x175c94['query']);_0xc6c4e[_0x1981('0x35')]=_[_0x1981('0x2f')](_0xc6c4e[_0x1981('0x2d')],_0xc6c4e[_0x1981('0x2e')]);_0x5dd022['attributes']=_['intersection'](_0xc6c4e[_0x1981('0x2d')],qs['fields'](_0x175c94[_0x1981('0x2e')][_0x1981('0x7b')]));_0x5dd022[_0x1981('0x30')]=_0x5dd022[_0x1981('0x30')][_0x1981('0x24')]?_0x5dd022[_0x1981('0x30')]:_0xc6c4e['model'];if(!_0x175c94[_0x1981('0x2e')][_0x1981('0x31')](_0x1981('0x32'))){_0x5dd022['limit']=qs['limit'](_0x175c94[_0x1981('0x2e')][_0x1981('0x17')]);_0x5dd022[_0x1981('0x15')]=qs[_0x1981('0x15')](_0x175c94['query'][_0x1981('0x15')]);}_0x5dd022['order']=qs['sort'](_0x175c94['query'][_0x1981('0x34')]);_0x5dd022['where']=qs['filters'](_[_0x1981('0x36')](_0x175c94[_0x1981('0x2e')],_0xc6c4e[_0x1981('0x35')]));_0x5dd022[_0x1981('0x40')][_0x1981('0xe1')]=_0x491f65['id'];if(_0x175c94[_0x1981('0x2e')][_0x1981('0x58')]){_0x5dd022[_0x1981('0x40')]=_[_0x1981('0x7a')](_0x5dd022[_0x1981('0x40')],{'$or':_[_0x1981('0x49')](_0x5dd022[_0x1981('0x30')],function(_0x1375ec){var _0x14e3d9={};_0x14e3d9[_0x1375ec]={'$like':'%'+_0x175c94['query'][_0x1981('0x58')]+'%'};return _0x14e3d9;})});}_0x5dd022=_[_0x1981('0x7a')]({},_0x5dd022,_0x175c94['options']);return db[_0x1981('0xa8')][_0x1981('0x18')]({'where':_0x5dd022[_0x1981('0x40')]})[_0x1981('0x1b')](function(_0x10c3d9){_0x1dfadb[_0x1981('0x18')]=_0x10c3d9;if(_0x175c94[_0x1981('0x2e')][_0x1981('0xe2')]){_0x5dd022[_0x1981('0xe3')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x5dd022);})[_0x1981('0x1b')](function(_0xbc58ed){_0x1dfadb[_0x1981('0xe4')]=_0xbc58ed;return _0x1dfadb;});}})[_0x1981('0x1b')](respondWithFilteredResult(_0x1eae77,_0x5dd022))[_0x1981('0x88')](handleError(_0x1eae77,null));};exports[_0x1981('0xe6')]=function(_0x499f27,_0x16e11e){var _0x56372e={'raw':!![],'where':{}};var _0x5d628a={};var _0x2f222b={'count':0x0,'rows':[]};return db[_0x1981('0x22')][_0x1981('0x29')]({'where':{'id':_0x499f27[_0x1981('0x8a')]['id']}})[_0x1981('0x1b')](handleEntityNotFound(_0x16e11e,null))[_0x1981('0x1b')](function(_0x27ca09){if(_0x27ca09){_0x5d628a[_0x1981('0x2d')]=_[_0x1981('0x23')](db[_0x1981('0xa7')][_0x1981('0xcc')]);_0x5d628a['query']=_[_0x1981('0x23')](_0x499f27['query']);_0x5d628a['filters']=_[_0x1981('0x2f')](_0x5d628a['model'],_0x5d628a['query']);_0x56372e[_0x1981('0x30')]=_[_0x1981('0x2f')](_0x5d628a[_0x1981('0x2d')],qs['fields'](_0x499f27[_0x1981('0x2e')][_0x1981('0x7b')]));_0x56372e['attributes']=_0x56372e[_0x1981('0x30')]['length']?_0x56372e[_0x1981('0x30')]:_0x5d628a['model'];if(!_0x499f27['query']['hasOwnProperty'](_0x1981('0x32'))){_0x56372e[_0x1981('0x17')]=qs[_0x1981('0x17')](_0x499f27['query']['limit']);_0x56372e['offset']=qs[_0x1981('0x15')](_0x499f27[_0x1981('0x2e')][_0x1981('0x15')]);}_0x56372e[_0x1981('0x33')]=qs[_0x1981('0x34')](_0x499f27[_0x1981('0x2e')][_0x1981('0x34')]);_0x56372e['where']=qs['filters'](_[_0x1981('0x36')](_0x499f27[_0x1981('0x2e')],_0x5d628a[_0x1981('0x35')]));_0x56372e[_0x1981('0x40')]['ContactId']=_0x27ca09['id'];if(_0x499f27['query'][_0x1981('0x58')]){_0x56372e[_0x1981('0x40')]=_[_0x1981('0x7a')](_0x56372e['where'],{'$or':_['map'](_0x56372e['attributes'],function(_0x529a74){var _0x168236={};_0x168236[_0x529a74]={'$like':'%'+_0x499f27[_0x1981('0x2e')]['filter']+'%'};return _0x168236;})});}_0x56372e=_['merge']({},_0x56372e,_0x499f27[_0x1981('0xcd')]);return db[_0x1981('0xa7')]['count']({'where':_0x56372e['where']})[_0x1981('0x1b')](function(_0x5eac5f){_0x2f222b[_0x1981('0x18')]=_0x5eac5f;if(_0x499f27[_0x1981('0x2e')]['includeAll']){_0x56372e[_0x1981('0xe3')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x56372e);})[_0x1981('0x1b')](function(_0x54f96d){_0x2f222b[_0x1981('0xe4')]=_0x54f96d;return _0x2f222b;});}})[_0x1981('0x1b')](respondWithFilteredResult(_0x16e11e,_0x56372e))[_0x1981('0x88')](handleError(_0x16e11e,null));};exports['getJscriptySessions']=function(_0x24a0df,_0x35294e){var _0x50be06={'raw':!![],'where':{}};var _0x49021b={};var _0x2338f8={'count':0x0,'rows':[]};return db[_0x1981('0x22')][_0x1981('0x29')]({'where':{'id':_0x24a0df[_0x1981('0x8a')]['id']}})[_0x1981('0x1b')](handleEntityNotFound(_0x35294e,null))[_0x1981('0x1b')](function(_0x1ea187){if(_0x1ea187){_0x49021b['model']=_[_0x1981('0x23')](db[_0x1981('0xae')][_0x1981('0xcc')]);_0x49021b['query']=_[_0x1981('0x23')](_0x24a0df[_0x1981('0x2e')]);_0x49021b[_0x1981('0x35')]=_[_0x1981('0x2f')](_0x49021b[_0x1981('0x2d')],_0x49021b[_0x1981('0x2e')]);_0x50be06[_0x1981('0x30')]=_[_0x1981('0x2f')](_0x49021b[_0x1981('0x2d')],qs[_0x1981('0x7b')](_0x24a0df[_0x1981('0x2e')]['fields']));_0x50be06[_0x1981('0x30')]=_0x50be06[_0x1981('0x30')]['length']?_0x50be06[_0x1981('0x30')]:_0x49021b['model'];if(!_0x24a0df[_0x1981('0x2e')]['hasOwnProperty']('nolimit')){_0x50be06[_0x1981('0x17')]=qs[_0x1981('0x17')](_0x24a0df[_0x1981('0x2e')]['limit']);_0x50be06[_0x1981('0x15')]=qs[_0x1981('0x15')](_0x24a0df[_0x1981('0x2e')]['offset']);}_0x50be06[_0x1981('0x33')]=qs[_0x1981('0x34')](_0x24a0df['query'][_0x1981('0x34')]);_0x50be06[_0x1981('0x40')]=qs[_0x1981('0x35')](_[_0x1981('0x36')](_0x24a0df[_0x1981('0x2e')],_0x49021b[_0x1981('0x35')]));_0x50be06['where']['ContactId']=_0x1ea187['id'];if(_0x24a0df[_0x1981('0x2e')][_0x1981('0x58')]){_0x50be06[_0x1981('0x40')]=_['merge'](_0x50be06[_0x1981('0x40')],{'$or':_[_0x1981('0x49')](_0x50be06[_0x1981('0x30')],function(_0x1dcf1e){var _0x2bd25d={};_0x2bd25d[_0x1dcf1e]={'$like':'%'+_0x24a0df[_0x1981('0x2e')]['filter']+'%'};return _0x2bd25d;})});}_0x50be06=_[_0x1981('0x7a')]({},_0x50be06,_0x24a0df[_0x1981('0xcd')]);return db[_0x1981('0xae')][_0x1981('0x18')]({'where':_0x50be06[_0x1981('0x40')]})[_0x1981('0x1b')](function(_0x3cee80){_0x2338f8['count']=_0x3cee80;if(_0x24a0df[_0x1981('0x2e')]['includeAll']){_0x50be06['include']=[{'all':!![]}];}return db[_0x1981('0xae')]['findAll'](_0x50be06);})['then'](function(_0xe40318){_0x2338f8[_0x1981('0xe4')]=_0xe40318;return _0x2338f8;});}})['then'](respondWithFilteredResult(_0x35294e,_0x50be06))['catch'](handleError(_0x35294e,null));};exports[_0x1981('0xe7')]=function(_0x3382c3,_0x495871){try{if(!_0x3382c3[_0x1981('0x91')]['ListId']){throw new Error(_0x1981('0xe8'));}if(!_0x3382c3[_0x1981('0x91')][_0x1981('0xe9')]){throw new Error(_0x1981('0xea'));}if(!_0x3382c3['body'][_0x1981('0xeb')]){throw new Error(_0x1981('0xec'));}if(!_0x3382c3[_0x1981('0x91')][_0x1981('0xed')]){throw new Error(_0x1981('0xee'));}var _0x2d744c=_0x3382c3[_0x1981('0x91')][_0x1981('0xe9')][_0x1981('0x48')](',');var _0x58063c=_0x3382c3['body']['binding_values'][_0x1981('0x48')](',');if(!_0x2d744c['length']||!_0x58063c[_0x1981('0x24')]||_0x2d744c[_0x1981('0x24')]!==_0x58063c['length']){throw new Error(_0x1981('0xef'));}_0x3382c3[_0x1981('0x91')]['fields']=_[_0x1981('0xf0')](_0x2d744c,_0x58063c);if(!_0x3382c3[_0x1981('0x91')][_0x1981('0x7b')][_0x1981('0xca')]){throw new Error(_0x1981('0xf1'));}if(!_0x3382c3['body'][_0x1981('0x7b')][_0x1981('0xf2')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x51bac4=path['join'](config[_0x1981('0xf3')],_0x1981('0xf4'),_0x3382c3[_0x1981('0xf5')][_0x1981('0xf6')]);fs[_0x1981('0xf7')](_0x51bac4,parseInt(_0x1981('0xf8'),0x8));var _0x107f29=require(_0x1981('0xf9'))[_0x1981('0xfa')](path[_0x1981('0xb2')](__dirname,_0x1981('0xfb')),[_0x51bac4,_0x3382c3[_0x1981('0x91')][_0x1981('0xe9')],_0x3382c3['body']['binding_values'],_0x3382c3['body'][_0x1981('0x5c')],_0x3382c3[_0x1981('0x91')][_0x1981('0xfc')],_0x3382c3[_0x1981('0x91')][_0x1981('0xb7')],_0x3382c3[_0x1981('0x91')]['socket_timestamp']]);return _0x495871[_0x1981('0x13')](0xc8)[_0x1981('0x14')]({'message':_0x1981('0xfd'),'pid':_0x107f29[_0x1981('0xfe')]});}catch(_0x5722cb){return _0x495871['status'](0x1f4)[_0x1981('0x20')](_0x5722cb);}};exports[_0x1981('0xff')]=function(_0x5710b7,_0x2d6a66){var _0x27bdd9=fs[_0x1981('0x100')](_0x5710b7[_0x1981('0xf5')][_0x1981('0x2')]);Papa[_0x1981('0x101')](_0x27bdd9,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x480606){return _0x2d6a66[_0x1981('0x13')](0xc8)[_0x1981('0x14')]({'file':_0x5710b7['file'],'fields':_0x480606[_0x1981('0x102')]['fields']});}});};exports[_0x1981('0x103')]=function(_0x3a4967,_0x256916){return db[_0x1981('0x4d')][_0x1981('0x92')]({'raw':!![],'attributes':['id'],'where':{'role':_0x1981('0x73')}})['then'](function(_0x21622b){var _0xc8edb4=![];if(!_0x3a4967['body']['ListId']){throw new Error(_0x1981('0xe8'));}if(!_0x3a4967['body']['binding']['phone']){throw new Error(_0x1981('0xf1'));}if(!_0x3a4967[_0x1981('0x91')][_0x1981('0x104')]['firstName']){throw new Error(_0x1981('0x105'));}if(!_0x3a4967[_0x1981('0x91')][_0x1981('0xed')]){throw new Error(_0x1981('0xee'));}var _0x5cf3ef=require(_0x1981('0xf9'))[_0x1981('0xfa')](path[_0x1981('0xb2')](__dirname,_0x1981('0x106')),[_0x3a4967[_0x1981('0x8a')]['id'],JSON[_0x1981('0x107')](_0x3a4967[_0x1981('0x91')]),JSON[_0x1981('0x107')](_0x21622b)]);_0x5cf3ef['on'](_0x1981('0x108'),function(){_0xc8edb4=!![];return _0x256916[_0x1981('0x13')](0xc8)[_0x1981('0x14')]({'message':_0x1981('0x109'),'pid':_0x5cf3ef['pid']});});_0x5cf3ef['on'](_0x1981('0x10a'),function(_0x25efc3){if(_0x25efc3&&!_0xc8edb4){return _0x256916[_0x1981('0x13')](0x1f4)[_0x1981('0x14')]({'message':'error\x20child\x20process','pid':_0x5cf3ef['pid']});}});})[_0x1981('0x88')](handleError(_0x256916,null));};exports[_0x1981('0x10b')]=function(_0x505f9a,_0x56806f,_0x4ee462){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x1981('0x1b')](function(_0x4b0f97){var _0x5c8615=![];if(!_0x505f9a['body'][_0x1981('0x5c')]){throw new Error(_0x1981('0xe8'));}if(!_0x505f9a[_0x1981('0x91')]['binding']['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x505f9a[_0x1981('0x91')]['binding'][_0x1981('0xf2')]){throw new Error(_0x1981('0x105'));}if(!_0x505f9a[_0x1981('0x91')][_0x1981('0xed')]){throw new Error(_0x1981('0xee'));}var _0x4940ac=require(_0x1981('0xf9'))['fork'](path[_0x1981('0xb2')](__dirname,_0x1981('0x10c')),[_0x505f9a[_0x1981('0x8a')]['id'],JSON[_0x1981('0x107')](_0x505f9a[_0x1981('0x91')]),JSON[_0x1981('0x107')](_0x4b0f97)]);_0x4940ac['on'](_0x1981('0x108'),function(_0x6495b1){_0x5c8615=!![];return _0x56806f['status'](0xc8)[_0x1981('0x14')]({'message':_0x1981('0x109'),'pid':_0x4940ac[_0x1981('0xfe')]});});_0x4940ac['on'](_0x1981('0x10a'),function(_0x1e967b){if(_0x1e967b&&!_0x5c8615){return _0x56806f[_0x1981('0x13')](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0x4940ac[_0x1981('0xfe')]});}});})[_0x1981('0x88')](handleError(_0x56806f,null));};exports[_0x1981('0x10d')]=function(_0x37d9cd,_0x579554){var _0x209853=[_0x1981('0x10e'),_0x1981('0x10f'),_0x1981('0x110'),_0x1981('0x111'),'fax',_0x1981('0x112'),_0x1981('0x113')];var _0x191590={'offset':0x0,'order':qs[_0x1981('0x34')](_0x1981('0x114'))},_0x36ca82={'count':0x0,'rows':[]};Promise[_0x1981('0x70')]()['then'](function(){if(_0x37d9cd['query'][_0x1981('0x115')]){if(!_[_0x1981('0x116')](_0x209853,_0x37d9cd[_0x1981('0x2e')]['channel'][_0x1981('0x117')]())){throw new Error(_0x1981('0x118'));}_0x209853=[_0x37d9cd[_0x1981('0x2e')]['channel']['toLowerCase']()];}if(_0x37d9cd[_0x1981('0x2e')][_0x1981('0x119')]){try{var _0x2fb444=JSON[_0x1981('0x101')](_0x37d9cd[_0x1981('0x2e')][_0x1981('0x119')]);if(!moment(_0x2fb444[_0x1981('0x3a')])[_0x1981('0x11a')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x2fb444['to'])[_0x1981('0x11a')]()){throw new Error(_0x1981('0x11b'));}}catch(_0xcaa6fe){throw new Error(_0x1981('0x11c'));}}if(!_0x37d9cd['query'][_0x1981('0x31')](_0x1981('0x32'))){_0x191590[_0x1981('0x17')]=qs[_0x1981('0x17')](_0x37d9cd[_0x1981('0x2e')][_0x1981('0x17')]||0xa);_0x191590[_0x1981('0x15')]=qs[_0x1981('0x15')](_0x37d9cd[_0x1981('0x2e')][_0x1981('0x15')]);}var _0x21d95f=_0x209853[_0x1981('0x49')](function(_0x8e8b4a){if(_0x8e8b4a===_0x1981('0x113')){var _0x301f1a={'attributes':['id','uniqueid',_0x1981('0x2c'),_0x1981('0x11d'),_0x1981('0x11e'),'callerid',_0x1981('0x11f'),_0x1981('0x120'),_0x1981('0x121'),_0x1981('0x122'),_0x1981('0x123'),_0x1981('0x124'),_0x1981('0x125'),_0x1981('0x126'),_0x1981('0x127')],'where':{'ContactId':_0x37d9cd['params']['id']},'include':[{'model':db[_0x1981('0x4d')],'as':'User','attributes':['id',_0x1981('0x1f'),_0x1981('0x128'),_0x1981('0x8f')]}],'order':[['createdAt',_0x1981('0x6e')]]};if(_0x37d9cd[_0x1981('0x2e')][_0x1981('0x119')]){_0x301f1a[_0x1981('0x40')][_0x1981('0x123')]={'$gte':_0x2fb444[_0x1981('0x3a')],'$lte':_0x2fb444['to']};}return db[_0x1981('0x129')][_0x1981('0x12a')](_0x301f1a)[_0x1981('0x1b')](function(_0x3ceee6){_0x36ca82['count']+=_0x3ceee6['count'];return _[_0x1981('0x49')](_0x3ceee6[_0x1981('0xe4')],function(_0x306b9c){var _0x48231f=_0x306b9c[_0x1981('0x93')]({'plain':!![]});_0x48231f[_0x1981('0x115')]=_0x8e8b4a;if(_0x48231f['User']){_0x48231f['User']={'id':_0x48231f['User']['id'],'name':_0x48231f['User']['name'],'fullname':_0x48231f[_0x1981('0x4d')]['fullname'],'alias':_0x48231f[_0x1981('0x4d')][_0x1981('0x8f')]};}return _0x48231f;});});}else{var _0x33e7da=_[_0x1981('0x12b')](_0x8e8b4a)+(_0x8e8b4a===_0x1981('0x10f')?_0x1981('0x12c'):_0x1981('0x12d'));var _0x284529={'attributes':['id',_0x1981('0x12e'),_0x1981('0x12f'),_0x1981('0x123'),_0x1981('0x122'),_0x1981('0x130'),_0x1981('0x131'),'thirdDisposition',_0x1981('0x127'),_0x33e7da+'Id'],'where':{'ContactId':_0x37d9cd['params']['id']},'include':[{'model':db[_0x33e7da],'as':_0x1981('0x12d'),'attributes':['id',_0x1981('0x1f'),_0x1981('0x132')]},{'model':db[_0x1981('0x4d')],'as':'Owner','attributes':['id','name',_0x1981('0x128')]},{'model':db[_0x1981('0x47')],'as':'Tags','attributes':['id',_0x1981('0x1f'),_0x1981('0x38')],'through':{'attributes':[]}}],'order':[[_0x1981('0x123'),_0x1981('0x6e')]]};if(_0x37d9cd['query']['range']){_0x284529['where'][_0x1981('0x123')]={'$gte':_0x2fb444['from'],'$lte':_0x2fb444['to']};}switch(_0x8e8b4a){case _0x1981('0x10f'):_0x284529[_0x1981('0x30')]['push'](_0x1981('0x133'),_0x1981('0x134'),_0x1981('0x135'),'deviceModel',_0x1981('0x136'),'ratingMessage','ratingType',_0x1981('0x137'),_0x1981('0x138'));break;case'mail':_0x284529[_0x1981('0x30')][_0x1981('0x27')]('subject',_0x1981('0x139'));break;case _0x1981('0x111'):_0x284529[_0x1981('0x30')][_0x1981('0x27')](_0x1981('0x13a'),_0x1981('0x13b'));break;}return db[_[_0x1981('0x12b')](_0x8e8b4a)+_0x1981('0x13c')]['findAndCountAll'](_0x284529)[_0x1981('0x1b')](function(_0x579962){_0x36ca82[_0x1981('0x18')]+=_0x579962['count'];return _[_0x1981('0x49')](_0x579962[_0x1981('0xe4')],function(_0x1fdebc){var _0x307165=_0x1fdebc[_0x1981('0x93')]({'plain':!![]});_0x307165[_0x1981('0x115')]=_0x8e8b4a;if(_0x307165[_0x1981('0x13d')]){_0x307165[_0x1981('0x13d')]={'id':_0x307165[_0x1981('0x13d')]['id'],'name':_0x307165[_0x1981('0x13d')][_0x1981('0x1f')],'fullname':_0x307165[_0x1981('0x13d')][_0x1981('0x128')]};}return _0x307165;});});}});return Promise[_0x1981('0x2b')](_0x21d95f);})[_0x1981('0x1b')](function(_0x2f9d63){return _(_0x2f9d63)[_0x1981('0x13e')]()[_0x1981('0x13f')](_0x1981('0x123'))[_0x1981('0x140')]()[_0x1981('0x50')]();})[_0x1981('0x1b')](function(_0x227ae3){_0x36ca82['rows']=_0x191590['limit']?_0x227ae3['slice'](_0x191590[_0x1981('0x15')],_0x191590[_0x1981('0x15')]+_0x191590[_0x1981('0x17')]):_0x227ae3;return _0x36ca82;})[_0x1981('0x1b')](respondWithFilteredResult(_0x579554,_0x191590))[_0x1981('0x88')](handleError(_0x579554,null));}; \ No newline at end of file +var _0x5ef3=['`ItemType`.OrderBy','ItemType.OrderBy','bulkCreate','getAdditionalPhones','literal','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','include','CmHopperFinal','getJscriptySessions','options','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','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','path','meta','import','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','importUpdates','../../components/import/cm/csvUpdates','error\x20child\x20process','mail','chat','openchannel','fax','whatsapp','voice','-createdAt','channel','includes','toLowerCase','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','callerid','starttime','endtime','note','userDisposition','userThirdDisposition','UserId','createdAt','findAndCountAll','startCase','Website','Account','closed','closedAt','secondDisposition','thirdDisposition','key','fullname','customerPort','deviceModel','ratingMessage','ratingType','referer','subject','substatus','externalUrl','threadId','Interaction','Owner','flatten','sortBy','reverse','slice','moment','bluebird','util','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','end','stack','name','send','index','CmContact','describe','keys','startsWith','push','findOne','trimStart','all','length','cf_','fieldType','filters','intersection','model','query','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','select','field','color','tools_tags','from','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','Tag','value','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','castTo','DATE','buildExpression','type','start','filter','isNil','Contact','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','split','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','QueryTypes','c.id','order','DESC','resolve','role','user','getLists','isEmpty','c.ListId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','Tags','TagIds','rows','catch','tags','columnName','displayName','analytics','findAll','alias','custom','values','body','get','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','dialTimezone','timezones','utcOffset','additionalPhones','duplicates','$or','findOrCreate','spread','show','Phones','params','ContactItemType','Phones.OrderBy','$and','CmCustomField','omit','cf_%d','format','table','setFields','toParam','text','phone','rawAttributes','getTags','setTags','ids','setAdditionalPhones','items','item_types','ItemTypeId','description','OrderBy','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','ItemType'];(function(_0x1fc439,_0x1bb4ce){var _0x5e77a1=function(_0x386304){while(--_0x386304){_0x1fc439['push'](_0x1fc439['shift']());}};_0x5e77a1(++_0x1bb4ce);}(_0x5ef3,0x19c));var _0x35ef=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x5ef3[_0x2b9b7f];return _0x4ed19a;};'use strict';var moment=require(_0x35ef('0x0'));var BPromise=require(_0x35ef('0x1'));var util=require(_0x35ef('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x35ef('0x3'));var squel=require(_0x35ef('0x4'));var Papa=require(_0x35ef('0x5'));var Redis=require(_0x35ef('0x6'));var qs=require(_0x35ef('0x7'));var as=require(_0x35ef('0x8'));var logger=require(_0x35ef('0x9'))(_0x35ef('0xa'));var config=require(_0x35ef('0xb'));var shared=require('../../config/environment/shared');var db=require(_0x35ef('0xc'))['db'];config[_0x35ef('0xd')]=_['defaults'](config[_0x35ef('0xd')],{'host':_0x35ef('0xe'),'port':0x18eb});var socket=require(_0x35ef('0xf'))(new Redis(config['redis']));require('./cmContact.socket')['register'](socket);function respondWithResult(_0x401ec1,_0x3b39f0){_0x3b39f0=_0x3b39f0||0xc8;return function(_0x381648){if(_0x381648){return _0x401ec1[_0x35ef('0x10')](_0x3b39f0)[_0x35ef('0x11')](_0x381648);}};}function respondWithFilteredResult(_0x23b4b0,_0x5be226){return function(_0x56747a){if(_0x56747a){var _0x954b6b=typeof _0x5be226[_0x35ef('0x12')]===_0x35ef('0x13')&&typeof _0x5be226[_0x35ef('0x14')]===_0x35ef('0x13');var _0x13564c=_0x56747a[_0x35ef('0x15')];var _0x331162=_0x954b6b?0x0:_0x5be226['offset'];var _0x4af536=_0x954b6b?_0x56747a['count']:_0x5be226[_0x35ef('0x12')]+_0x5be226[_0x35ef('0x14')];var _0x33d1d4;if(_0x4af536>=_0x13564c){_0x4af536=_0x13564c;_0x33d1d4=0xc8;}else{_0x33d1d4=0xce;}_0x23b4b0['status'](_0x33d1d4);return _0x23b4b0[_0x35ef('0x16')](_0x35ef('0x17'),_0x331162+'-'+_0x4af536+'/'+_0x13564c)[_0x35ef('0x11')](_0x56747a);}return null;};}function saveUpdates(_0x5ce1bc){return function(_0x1b4260){if(_0x1b4260){return _0x1b4260[_0x35ef('0x18')](_0x5ce1bc)['then'](function(_0x46c0b0){return _0x46c0b0;});}return null;};}function removeEntity(_0x112863){return function(_0x38f991){if(_0x38f991){return _0x38f991[_0x35ef('0x19')]()[_0x35ef('0x1a')](function(){_0x112863[_0x35ef('0x10')](0xcc)[_0x35ef('0x1b')]();});}};}function handleEntityNotFound(_0x554a33){return function(_0x123cfb){if(!_0x123cfb){_0x554a33['sendStatus'](0x194);}return _0x123cfb;};}function handleError(_0x322eed,_0x4f89e7){_0x4f89e7=_0x4f89e7||0x1f4;return function(_0x5712e8){logger['error'](_0x5712e8[_0x35ef('0x1c')]);if(_0x5712e8[_0x35ef('0x1d')]){delete _0x5712e8[_0x35ef('0x1d')];}_0x322eed['status'](_0x4f89e7)[_0x35ef('0x1e')](_0x5712e8);};}exports[_0x35ef('0x1f')]=function(_0x359e41,_0x12306c){var _0x1f7147={},_0x42fd6d={},_0x43fd0f={'count':0x0,'rows':[]};return db[_0x35ef('0x20')][_0x35ef('0x21')]()['then'](function(_0x5a3255){var _0xe40a3=[];for(var _0x2156e9=0x0;_0x2156e90x1){_0x594dee['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x35ef('0x60')](_0x53e189),null);}else{if(qs[_0x35ef('0x61')](_0x53e189)){_0x594dee['or'](_0x35ef('0x62'),_0x53e189+'%');_0x594dee['or'](_0x35ef('0x63'),_0x53e189+'%');_0x594dee['or']('c.mobile\x20LIKE\x20?',_0x53e189+'%');_0x594dee['or'](_0x35ef('0x64'),_0x53e189+'%');}else if(qs[_0x35ef('0x65')](_0x53e189)){_0x594dee['or'](_0x35ef('0x66'),_0x53e189+'%');}else{_0x594dee['or'](_0x35ef('0x67'),'%'+_0x53e189+'%');_0x594dee['or'](_0x35ef('0x68'),'%'+_0x53e189+'%');_0x594dee['or']('c.email\x20LIKE\x20?','%'+_0x53e189+'%');}}}}_0x5e4843[_0x35ef('0x34')](_0x594dee);_0x5e4843['group']('c.id');var _0x4cbff0={'type':db['Sequelize'][_0x35ef('0x69')]['SELECT'],'raw':!![]};var _0x9532d5=_0x5e4843['clone']()[_0x35ef('0x37')](_0x35ef('0x6a'));if(_0x1f7147[_0x35ef('0x6b')]){_0x1f7147['order'][_0x35ef('0x4a')](function(_0x21742e){_0x5e4843['order']('c.'+_0x21742e[0x0],_0x21742e[0x1]===_0x35ef('0x6c')?![]:!![]);});}if(!_['isEmpty'](_0x25c01a)){_0x5e4843['having'](_0x461791);_0x9532d5[_0x35ef('0x34')]('t.id\x20IN\x20?',_0x25c01a);}BPromise[_0x35ef('0x6d')]()['then'](function(){if(!_0x4a8c4a)return;if(_0x359e41['user'][_0x35ef('0x6e')]!=='agent')return;if(!_['some'](_0x4a8c4a[_0x35ef('0x45')],[_0x35ef('0x37'),_0x35ef('0x4d')])){return _0x359e41[_0x35ef('0x6f')][_0x35ef('0x70')]({'attributes':['id'],'raw':!![]})['then'](function(_0x39f4e1){if(_[_0x35ef('0x71')](_0x39f4e1)){_0x9532d5[_0x35ef('0x34')](_0x35ef('0x72'));_0x5e4843[_0x35ef('0x34')]('c.ListId\x20IS\x20NULL');}else{_0x9532d5['where'](_0x35ef('0x58'),_[_0x35ef('0x49')](_0x39f4e1,'id'));_0x5e4843[_0x35ef('0x34')](_0x35ef('0x58'),_[_0x35ef('0x49')](_0x39f4e1,'id'));}});}})[_0x35ef('0x1a')](function(){if(_0x359e41[_0x35ef('0x6f')][_0x35ef('0x6e')]===_0x35ef('0x73')&&!_0x4a8c4a&&!_0x359e41[_0x35ef('0x2e')][_0x35ef('0x57')])return[];return db[_0x35ef('0x74')][_0x35ef('0x2e')](_0x9532d5[_0x35ef('0x75')](),_0x4cbff0);})['then'](function(_0x3f7073){_0x43fd0f['count']=_0x3f7073['length'];if(_0x43fd0f['count']===0x0)return[];return db[_0x35ef('0x74')][_0x35ef('0x2e')](_0x1b9c91[_0x35ef('0x75')](),_0x4cbff0)[_0x35ef('0x1a')](function(_0x40b455){_0x2d90b4=_[_0x35ef('0x76')](_0x40b455,'id');_0x4cbff0=_[_0x35ef('0x77')](_0x4cbff0,{'model':db[_0x35ef('0x20')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x359e41[_0x35ef('0x2e')][_0x35ef('0x2f')]){_0x1f7147[_0x35ef('0x30')][_0x35ef('0x4a')](function(_0x526aea){_0x5e4843[_0x35ef('0x37')]('c.'+_0x526aea);});}else{_0x5e4843[_0x35ef('0x37')]('c.id');_0x5e4843[_0x35ef('0x37')](_0x35ef('0x78'));_0x5e4843[_0x35ef('0x37')](_0x35ef('0x79'));_0x5e4843[_0x35ef('0x37')]('c.phone');_0x5e4843[_0x35ef('0x37')]('c.mobile');_0x5e4843[_0x35ef('0x37')](_0x35ef('0x7a'));_0x5e4843[_0x35ef('0x37')](_0x35ef('0x7b'));_0x5e4843[_0x35ef('0x37')](_0x35ef('0x7c'));_0x5e4843[_0x35ef('0x37')](_0x35ef('0x7d'));_0x5e4843[_0x35ef('0x37')](_0x35ef('0x7e'));_0x5e4843['field'](_0x35ef('0x7f'));_0x5e4843[_0x35ef('0x37')](_0x35ef('0x80'),'TagIds');}if(_0x1f7147[_0x35ef('0x14')])_0x5e4843[_0x35ef('0x14')](_0x1f7147['limit']);if(_0x1f7147[_0x35ef('0x12')])_0x5e4843['offset'](_0x1f7147[_0x35ef('0x12')]);return db[_0x35ef('0x74')][_0x35ef('0x2e')](_0x5e4843[_0x35ef('0x75')](),_0x4cbff0);});})['then'](function(_0x416995){_0x416995[_0x35ef('0x4a')](function(_0x32e6d3){if(_0x32e6d3['TagIds']){_0x32e6d3[_0x35ef('0x81')]=[];_0x32e6d3[_0x35ef('0x82')]['split'](',')[_0x35ef('0x4a')](function(_0x4130e3){_0x32e6d3[_0x35ef('0x81')]['push'](_0x2d90b4[_0x4130e3]);});}delete _0x32e6d3[_0x35ef('0x82')];});_0x43fd0f[_0x35ef('0x83')]=_0x416995;return _0x43fd0f;})[_0x35ef('0x1a')](respondWithFilteredResult(_0x12306c,_0x1f7147));})[_0x35ef('0x84')](handleError(_0x12306c,null));};exports[_0x35ef('0x19')]=function(_0x3aa54c,_0x4d188){return db[_0x35ef('0x20')][_0x35ef('0x46')]({'where':{'id':_0x3aa54c['params']['id']}})[_0x35ef('0x1a')](handleEntityNotFound(_0x4d188,null))[_0x35ef('0x1a')](removeEntity(_0x4d188,null))[_0x35ef('0x84')](handleError(_0x4d188,null));};exports['describe']=function(_0x38bcfd,_0x521425){return db[_0x35ef('0x20')][_0x35ef('0x21')]()[_0x35ef('0x1a')](function(_0x3ea8e3){delete _0x3ea8e3[_0x35ef('0x85')];for(var _0x14fb30=0x0;_0x14fb300x0){return new Promise(function(_0x52a9a5,_0x2b7c91){var _0x1d0d4d=[];for(var _0x1fc27d=0x0;_0x1fc27d<_0x1f51eb['length'];_0x1fc27d++){_0x1d0d4d[_0x35ef('0x24')](insertAdditionalPhones(_0x1f51eb[_0x1fc27d]['contact'],_0x1f51eb[_0x1fc27d][_0x35ef('0xad')]));}Promise[_0x35ef('0x27')](_0x1d0d4d)[_0x35ef('0x1a')](function(){_0x52a9a5(0x1);});})[_0x35ef('0x1a')](function(){return{'success':_0x1a6010,'failure':_0x187320,'duplicates':_0x10dd3e};});}else{return{'success':_0x1a6010,'failure':_0x187320,'duplicates':_0x10dd3e};}}})[_0x35ef('0x1a')](respondWithResult(_0xe8b372,0xc9))[_0x35ef('0x84')](handleError(_0xe8b372,null));};exports[_0x35ef('0xb2')]=function(_0x32423a,_0x2da968){var _0x3a1b5f;return db['CmContact'][_0x35ef('0x21')]()[_0x35ef('0x1a')](function(_0xd96518){return db['CmContact']['find']({'where':{'id':_0x32423a['params']['id']},'include':[{'model':db['Tag'],'as':_0x35ef('0x81'),'attributes':['id',_0x35ef('0x1d'),'color'],'required':_0x32423a['query'][_0x35ef('0x5c')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x35ef('0xb3'),'where':{'CmContactId':_0x32423a[_0x35ef('0xb4')]['id']},'required':![],'include':[{'model':db[_0x35ef('0xb5')],'as':'ItemType'}]}],'order':[db[_0x35ef('0x74')]['literal'](_0x35ef('0xb6'))],'attributes':_[_0x35ef('0x22')](_0xd96518)});})['then'](function(_0x10e40f){if(!_[_0x35ef('0x55')](_0x10e40f)){_0x3a1b5f=_0x10e40f['get']({'plain':!![]});var _0x24c0a3={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x10e40f&&_0x10e40f[_0x35ef('0x57')]){if(_0x10e40f['ListId']){_0x24c0a3[_0x35ef('0x34')][_0x35ef('0xb7')][_0x35ef('0x24')]({'ListId':{'$ne':_0x10e40f[_0x35ef('0x57')]}});}}return db[_0x35ef('0xb8')][_0x35ef('0x89')](_0x24c0a3);}})[_0x35ef('0x1a')](function(_0x3b93a7){if(!_[_0x35ef('0x55')](_0x3b93a7)){return _[_0x35ef('0xb9')](_0x3a1b5f,_[_0x35ef('0x49')](_0x3b93a7,function(_0x50fade){return util['format'](_0x35ef('0xba'),_0x50fade['id']);}));}})[_0x35ef('0x1a')](handleEntityNotFound(_0x2da968,null))[_0x35ef('0x1a')](respondWithResult(_0x2da968,null))[_0x35ef('0x84')](handleError(_0x2da968,null));};exports[_0x35ef('0x18')]=function(_0x40c31b,_0x4ae6a9){var _0x1938f5;if(_0x40c31b[_0x35ef('0x8d')]['id']){delete _0x40c31b[_0x35ef('0x8d')]['id'];}if(!_[_0x35ef('0x55')](_0x40c31b['body'][_0x35ef('0xaa')])){var _0x4791d5=_0x40c31b[_0x35ef('0x8d')][_0x35ef('0xaa')];if(!_[_0x35ef('0x55')](shared[_0x35ef('0xab')][_0x4791d5]))_0x40c31b[_0x35ef('0x8d')][_0x35ef('0xac')]=shared[_0x35ef('0xab')][_0x4791d5][_0x35ef('0xac')];}return db[_0x35ef('0x20')]['find']({'where':{'id':_0x40c31b[_0x35ef('0xb4')]['id']}})[_0x35ef('0x1a')](handleEntityNotFound(_0x4ae6a9,null))[_0x35ef('0x1a')](saveUpdates(_0x40c31b['body'],null))[_0x35ef('0x1a')](function(_0x33a9f0){_0x1938f5=_0x33a9f0;var _0x43bbfa={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x33a9f0&&_0x33a9f0[_0x35ef('0x57')]){if(_0x33a9f0['ListId']){_0x43bbfa[_0x35ef('0x34')]['$and']['push']({'ListId':{'$ne':_0x33a9f0[_0x35ef('0x57')]}});}}return db[_0x35ef('0xb8')][_0x35ef('0x89')](_0x43bbfa);})[_0x35ef('0x1a')](function(_0x404eea){if(_0x404eea){return _['omit'](_['pickBy'](_0x40c31b['body'],function(_0x1efcc2,_0x502c20){return _[_0x35ef('0x23')](_0x502c20,_0x35ef('0x29'));}),_[_0x35ef('0x49')](_0x404eea,function(_0x48da04){return util[_0x35ef('0xbb')](_0x35ef('0xba'),_0x48da04['id']);}));}})['then'](function(_0x497a78){if(_0x497a78&&!_[_0x35ef('0x71')](_0x497a78)){var _0x3f1c1a=squel[_0x35ef('0x18')]()[_0x35ef('0xbc')]('cm_contacts')[_0x35ef('0xbd')](_0x497a78)['where']('id\x20=\x20?',_0x40c31b['params']['id'])[_0x35ef('0xbe')]();return db[_0x35ef('0x74')][_0x35ef('0x2e')](_0x3f1c1a[_0x35ef('0xbf')],{'replacements':_0x3f1c1a[_0x35ef('0x8c')]});}})[_0x35ef('0x1a')](function(){if(_0x40c31b[_0x35ef('0x8d')][_0x35ef('0xc0')]&&_0x1938f5){return db['CmHopper'][_0x35ef('0x18')]({'phone':_0x40c31b[_0x35ef('0x8d')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x1938f5['id']}});}})[_0x35ef('0x1a')](function(){return _0x1938f5;})['then'](respondWithResult(_0x4ae6a9,null))['catch'](handleError(_0x4ae6a9,null));};exports['getTags']=function(_0xf36c88,_0x242631){var _0x3d1c11={};var _0x51dd82={};var _0x4aa36e;var _0x41e5cc;return db[_0x35ef('0x20')][_0x35ef('0x25')]({'where':{'id':_0xf36c88['params']['id']}})[_0x35ef('0x1a')](handleEntityNotFound(_0x242631,null))[_0x35ef('0x1a')](function(_0x405b83){if(_0x405b83){_0x4aa36e=_0x405b83;_0x51dd82['model']=_[_0x35ef('0x22')](db[_0x35ef('0x47')][_0x35ef('0xc1')]);_0x51dd82[_0x35ef('0x2e')]=_[_0x35ef('0x22')](_0xf36c88[_0x35ef('0x2e')]);_0x51dd82['filters']=_[_0x35ef('0x2c')](_0x51dd82[_0x35ef('0x2d')],_0x51dd82['query']);_0x3d1c11['attributes']=_[_0x35ef('0x2c')](_0x51dd82['model'],qs[_0x35ef('0x2f')](_0xf36c88['query']['fields']));_0x3d1c11[_0x35ef('0x30')]=_0x3d1c11[_0x35ef('0x30')][_0x35ef('0x28')]?_0x3d1c11[_0x35ef('0x30')]:_0x51dd82[_0x35ef('0x2d')];_0x3d1c11['order']=qs[_0x35ef('0x33')](_0xf36c88[_0x35ef('0x2e')][_0x35ef('0x33')]);_0x3d1c11[_0x35ef('0x34')]=qs[_0x35ef('0x2b')](_['pick'](_0xf36c88['query'],_0x51dd82[_0x35ef('0x2b')]));if(_0xf36c88['query']['filter']){_0x3d1c11[_0x35ef('0x34')]=_['merge'](_0x3d1c11['where'],{'$or':_[_0x35ef('0x49')](_0x3d1c11[_0x35ef('0x30')],function(_0x5b0586){var _0x519802={};_0x519802[_0x5b0586]={'$like':'%'+_0xf36c88[_0x35ef('0x2e')][_0x35ef('0x54')]+'%'};return _0x519802;})});}_0x3d1c11=_[_0x35ef('0x77')]({},_0x3d1c11,_0xf36c88['options']);return _0x4aa36e[_0x35ef('0xc2')](_0x3d1c11);}})[_0x35ef('0x1a')](function(_0x471ad9){if(_0x471ad9){_0x41e5cc=_0x471ad9[_0x35ef('0x28')];if(!_0xf36c88[_0x35ef('0x2e')][_0x35ef('0x31')]('nolimit')){_0x3d1c11['limit']=qs[_0x35ef('0x14')](_0xf36c88[_0x35ef('0x2e')][_0x35ef('0x14')]);_0x3d1c11[_0x35ef('0x12')]=qs[_0x35ef('0x12')](_0xf36c88['query'][_0x35ef('0x12')]);}return _0x4aa36e[_0x35ef('0xc2')](_0x3d1c11);}})['then'](function(_0x120690){if(_0x120690){return _0x120690?{'count':_0x41e5cc,'rows':_0x120690}:null;}})[_0x35ef('0x1a')](respondWithResult(_0x242631,null))[_0x35ef('0x84')](handleError(_0x242631,null));};exports['setTags']=function(_0x4c31cb,_0x1a1bbd){if(_0x4c31cb[_0x35ef('0x8d')]['id']){delete _0x4c31cb[_0x35ef('0x8d')]['id'];}return db[_0x35ef('0x20')][_0x35ef('0x25')]({'where':{'id':_0x4c31cb[_0x35ef('0xb4')]['id']}})[_0x35ef('0x1a')](handleEntityNotFound(_0x1a1bbd,null))[_0x35ef('0x1a')](function(_0x13e409){if(_0x13e409){return _0x13e409[_0x35ef('0xc3')](_0x4c31cb[_0x35ef('0x8d')][_0x35ef('0xc4')]||[]);}return null;})[_0x35ef('0x1a')](respondWithResult(_0x1a1bbd,null))[_0x35ef('0x84')](handleError(_0x1a1bbd,null));};exports[_0x35ef('0xc5')]=function(_0x179197,_0x3caf94){var _0x5a2a06=[];_0x5a2a06[_0x35ef('0x24')](addAdditionalPhones(_0x179197[_0x35ef('0x8d')]));Promise['all'](_0x5a2a06)[_0x35ef('0x1a')](function(){_0x5a2a06=[];_0x5a2a06['push'](deleteCmHopperPhones(_0x179197[_0x35ef('0x8d')]['id']));_0x5a2a06[_0x35ef('0x24')](addCmHopperPhones(_0x179197[_0x35ef('0x8d')]['id']));Promise[_0x35ef('0x27')](_0x5a2a06)[_0x35ef('0x1a')](function(){return[0x1];})[_0x35ef('0x1a')](respondWithResult(_0x3caf94,null));});};function addAdditionalPhones(_0x4ab181){var _0x687834;return new Promise(function(_0x5f3250,_0xb5473c){return db['CmContactHasItem'][_0x35ef('0x19')]({'where':{'CmContactId':_0x4ab181['id']}})[_0x35ef('0x1a')](function(){db[_0x35ef('0xb5')][_0x35ef('0x89')]({'raw':!![],'attributes':['id','OrderBy']})[_0x35ef('0x1a')](function(_0x45f3c8){var _0x534caf=[];for(var _0x3a5d7b=0x0;_0x3a5d7b<_0x4ab181[_0x35ef('0xc6')][_0x35ef('0x28')];_0x3a5d7b++){var _0x11ed5a=_0x4ab181['item_types']?_[_0x35ef('0x55')](_0x4ab181['item_types'][_0x3a5d7b])?'':_0x4ab181[_0x35ef('0xc7')][_0x3a5d7b]:_0x4ab181['items'][_0x3a5d7b][_0x35ef('0xc8')]?_0x4ab181[_0x35ef('0xc6')][_0x3a5d7b]['ItemTypeId']:'';var _0x40801f=_[_0x35ef('0x55')](_0x4ab181[_0x35ef('0xc6')][_0x3a5d7b]['description'])?'':_0x4ab181[_0x35ef('0xc6')][_0x3a5d7b][_0x35ef('0xc9')];var _0xb721bc=_0x11ed5a+':'+_0x4ab181[_0x35ef('0xc6')][_0x3a5d7b][_0x35ef('0xc0')]+'§'+_0x40801f;if(_[_0x35ef('0x55')](_0x687834))_0x687834=_0xb721bc;else _0x687834+=';'+_0xb721bc;var _0x484a1e=null;if(_0x4ab181[_0x35ef('0xc7')]){if(!_['isNil'](_0x4ab181[_0x35ef('0xc7')][_0x3a5d7b])){var _0x2697f0=_[_0x35ef('0x46')](_0x45f3c8,function(_0xdca685){return _0xdca685['id']===_0x4ab181[_0x35ef('0xc7')][_0x3a5d7b];});if(!_['isNil'](_0x2697f0)){_0x484a1e=_0x2697f0[_0x35ef('0xca')];}}}else{if(!_[_0x35ef('0x55')](_0x4ab181[_0x35ef('0xc6')][_0x3a5d7b])){var _0x2697f0=_[_0x35ef('0x46')](_0x45f3c8,function(_0x20ea0e){return _0x20ea0e['id']===_0x4ab181['items'][_0x3a5d7b][_0x35ef('0xc8')];});if(!_[_0x35ef('0x55')](_0x2697f0)){_0x484a1e=_0x3a5d7b;}}}if(_[_0x35ef('0x55')](_0x484a1e)){_0x484a1e=0x64;}_0x534caf['push'](addAdditionalPhone(_0x4ab181['id'],_0x4ab181['items'][_0x3a5d7b][_0x35ef('0xc0')],_0x4ab181[_0x35ef('0xc7')]?_[_0x35ef('0x55')](_0x4ab181['item_types'][_0x3a5d7b])?null:_0x4ab181['item_types'][_0x3a5d7b]:_0x4ab181[_0x35ef('0xc6')][_0x3a5d7b][_0x35ef('0xc8')]?_0x4ab181[_0x35ef('0xc6')][_0x3a5d7b]['ItemTypeId']:null,_0x484a1e,_0x40801f));}Promise[_0x35ef('0x27')](_0x534caf)[_0x35ef('0x1a')](function(){db[_0x35ef('0x20')][_0x35ef('0x18')]({'AdditionalPhones':_0x687834},{'where':{'id':_0x4ab181['id']}})[_0x35ef('0x1a')](function(){_0x5f3250(0x1);});});});});});}function addAdditionalPhone(_0x549510,_0x4f48f2,_0x1d36d8,_0x9cef92,_0x24c9eb){return db['CmContactHasItem'][_0x35ef('0x46')]({'where':{'CmContactId':_0x549510,'item':_0x4f48f2}})[_0x35ef('0x1a')](function(_0x2121ac){if(_0x2121ac)logger[_0x35ef('0x90')](_0x35ef('0xcb'),_0x2121ac);else{db[_0x35ef('0x9f')][_0x35ef('0x94')]({'CmContactId':_0x549510,'item':_0x4f48f2,'ItemTypeId':_0x1d36d8,'OrderBy':_0x9cef92,'ItemClass':_0x35ef('0xcc'),'description':_0x24c9eb});}});}function deletePhones(_0x47655f){return db[_0x35ef('0x9f')]['destroy']({'where':{'CmContactId':_0x47655f}});}function deleteCmHopperPhones(_0x363d66){return new Promise(function(_0x58ebff,_0x57dbe8){return db['CmHopper'][_0x35ef('0x89')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x363d66}})[_0x35ef('0x1a')](function(_0x383545){db[_0x35ef('0xcd')][_0x35ef('0x19')]({'where':{'CmHopperId':{'$in':_['map'](_0x383545,'id')}}});})[_0x35ef('0x1a')](function(){_0x58ebff(0x1);});});}function addCmHopperPhones(_0x491b64){return new Promise(function(_0xb0bbdc,_0x5e75f4){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x491b64}})[_0x35ef('0x1a')](function(_0x5c3e32){var _0x1e5bfb=[];_['map'](_0x5c3e32,function(_0x20b4ba){_0x1e5bfb['push'](createCmHopperPhone(_0x491b64,_0x20b4ba['id']));});Promise['all'](_0x1e5bfb)[_0x35ef('0x1a')](function(){_0xb0bbdc(0x1);});});});}function createCmHopperPhone(_0xe8ca0a,_0x3db855){return new Promise(function(_0x41b04a,_0xf2fefb){db[_0x35ef('0x9f')][_0x35ef('0x89')]({'raw':!![],'attributes':[_0x35ef('0xce'),_0x35ef('0xca')],'where':{'CmContactId':_0xe8ca0a,'ItemClass':'PHONE'},'include':[{'model':db[_0x35ef('0xb5')],'attributes':[_0x35ef('0xca')],'as':_0x35ef('0xcf')}],'order':[_0x35ef('0xca'),db[_0x35ef('0x74')]['literal'](_0x35ef('0xd0'))]})[_0x35ef('0x1a')](function(_0x46095b){var _0x462fb6=0x1;var _0x3341f6=_['map'](_0x46095b,function(_0x5e661c){_0x5e661c['CmHopperId']=_0x3db855;_0x5e661c[_0x35ef('0xc0')]=_0x5e661c[_0x35ef('0xce')];_0x5e661c[_0x35ef('0xca')]=_0x462fb6;delete _0x5e661c[_0x35ef('0xd1')];_0x462fb6=_0x462fb6+0x1;return _0x5e661c;});return db[_0x35ef('0xcd')][_0x35ef('0xd2')](_0x3341f6,{});})[_0x35ef('0x1a')](function(){_0x41b04a(0x1);});});}function insertAdditionalPhones(_0x326eeb,_0x353c62){return new Promise(function(_0x1a819a,_0x279a89){var _0x4a0cec=[];for(var _0x205346=0x0;_0x205346<_0x353c62['length'];_0x205346++){var _0x2c2202=_0x353c62[_0x205346];_0x4a0cec['push'](parseContactItemType(_0x2c2202));}Promise[_0x35ef('0x27')](_0x4a0cec)[_0x35ef('0x1a')](function(){var _0x29442d={'id':_0x326eeb['id'],'items':_0x353c62};return addAdditionalPhones(_0x29442d)[_0x35ef('0x1a')](function(_0x340204){return addCmHopperPhones(_0x326eeb['id']);});})['then'](function(){_0x1a819a(_0x326eeb);});});}function parseContactItemType(_0x579445){return new Promise(function(_0xe014eb,_0x1444c7){if(_0x579445[_0x35ef('0x31')](_0x35ef('0xc8'))){_0xe014eb(_0x579445);}else{return db[_0x35ef('0xb5')][_0x35ef('0x46')]({'where':{'name':_0x579445['ItemType']}})['then'](function(_0x20f2c7){if(_[_0x35ef('0x55')](_0x20f2c7))_0x579445[_0x35ef('0xc8')]=null;else _0x579445[_0x35ef('0xc8')]=_0x20f2c7['id'];_0xe014eb(_0x579445);});}});}exports[_0x35ef('0xd3')]=function(_0xde01e3,_0x18d095){return db[_0x35ef('0x9f')][_0x35ef('0x89')]({'raw':!![],'where':{'CmContactId':_0xde01e3[_0x35ef('0xb4')]['id'],'ItemClass':_0x35ef('0xcc')},'include':[{'model':db[_0x35ef('0xb5')],'as':_0x35ef('0xcf')}],'order':[[_0x35ef('0xca')],[db['sequelize'][_0x35ef('0xd4')](_0x35ef('0xd0'))]]})['then'](function(_0x596967){return _0x596967;})['then'](respondWithResult(_0x18d095,null))['catch'](handleError(_0x18d095,null));};exports[_0x35ef('0xd5')]=function(_0x828ffa,_0x2c52eb){return db['CmContactHasItem'][_0x35ef('0x89')]({'raw':!![],'where':{'CmContactId':_0x828ffa[_0x35ef('0x8d')]['fromContactId']}})[_0x35ef('0x1a')](function(_0x280593){var _0x344b6a=_[_0x35ef('0x49')](_0x280593,function(_0x45beeb){_0x45beeb[_0x35ef('0xd6')]=_0x828ffa['body']['toContactId'];return _0x45beeb;});return db[_0x35ef('0x9f')]['bulkCreate'](_0x344b6a,{});})[_0x35ef('0x1a')](function(_0x1b5fbb){return addCmHopperPhones(_0x828ffa[_0x35ef('0x8d')][_0x35ef('0xd7')]);})[_0x35ef('0x1a')](function(_0x4c596c){return['ok'];})['then'](respondWithResult(_0x2c52eb,null))['catch'](handleError(_0x2c52eb,null));};exports[_0x35ef('0xd8')]=function(_0x472467,_0x3f214a){var _0x4134d5=[];_0x4134d5[_0x35ef('0x24')](createCmHopperPhone(_0x472467['body']['id'],_0x472467[_0x35ef('0x8d')][_0x35ef('0xd9')]));Promise[_0x35ef('0x27')](_0x4134d5)['then'](function(){return[0x1];})['then'](respondWithResult(_0x3f214a,null));};exports[_0x35ef('0xda')]=function(_0x25200d,_0x3c0150){var _0x139ed9={'raw':![],'where':{}};var _0x1eb107={};var _0x2b9cd2={'count':0x0,'rows':[]};return db['CmContact'][_0x35ef('0x25')]({'where':{'id':_0x25200d['params']['id']}})['then'](handleEntityNotFound(_0x3c0150,null))['then'](function(_0x1b47b1){if(_0x1b47b1){_0x1eb107[_0x35ef('0x2d')]=_['keys'](db[_0x35ef('0x92')][_0x35ef('0xc1')]);_0x1eb107[_0x35ef('0x2e')]=_[_0x35ef('0x22')](_0x25200d['query']);_0x1eb107[_0x35ef('0x2b')]=_[_0x35ef('0x2c')](_0x1eb107['model'],_0x1eb107['query']);_0x139ed9[_0x35ef('0x30')]=_['intersection'](_0x1eb107[_0x35ef('0x2d')],qs[_0x35ef('0x2f')](_0x25200d[_0x35ef('0x2e')][_0x35ef('0x2f')]));_0x139ed9[_0x35ef('0x30')]=_0x139ed9[_0x35ef('0x30')][_0x35ef('0x28')]?_0x139ed9[_0x35ef('0x30')]:_0x1eb107[_0x35ef('0x2d')];if(!_0x25200d[_0x35ef('0x2e')][_0x35ef('0x31')]('nolimit')){_0x139ed9[_0x35ef('0x14')]=qs[_0x35ef('0x14')](_0x25200d['query'][_0x35ef('0x14')]);_0x139ed9[_0x35ef('0x12')]=qs[_0x35ef('0x12')](_0x25200d[_0x35ef('0x2e')][_0x35ef('0x12')]);}_0x139ed9['order']=qs['sort'](_0x25200d[_0x35ef('0x2e')][_0x35ef('0x33')]);_0x139ed9[_0x35ef('0x34')]=qs[_0x35ef('0x2b')](_[_0x35ef('0x35')](_0x25200d[_0x35ef('0x2e')],_0x1eb107[_0x35ef('0x2b')]));_0x139ed9[_0x35ef('0x34')]['ContactId']=_0x1b47b1['id'];if(_0x25200d['query'][_0x35ef('0x54')]){_0x139ed9['where']=_[_0x35ef('0x77')](_0x139ed9[_0x35ef('0x34')],{'$or':_[_0x35ef('0x49')](_0x139ed9['attributes'],function(_0x46e03d){var _0x46eeef={};_0x46eeef[_0x46e03d]={'$like':'%'+_0x25200d[_0x35ef('0x2e')][_0x35ef('0x54')]+'%'};return _0x46eeef;})});}_0x139ed9=_[_0x35ef('0x77')]({},_0x139ed9,_0x25200d['options']);return db[_0x35ef('0x92')][_0x35ef('0x15')]({'where':_0x139ed9[_0x35ef('0x34')]})[_0x35ef('0x1a')](function(_0x290866){_0x2b9cd2['count']=_0x290866;if(_0x25200d['query']['includeAll']){_0x139ed9['include']=[{'all':!![]}];}return db[_0x35ef('0x92')][_0x35ef('0x89')](_0x139ed9);})[_0x35ef('0x1a')](function(_0x543b9e){_0x2b9cd2[_0x35ef('0x83')]=_0x543b9e;return _0x2b9cd2;});}})[_0x35ef('0x1a')](respondWithFilteredResult(_0x3c0150,_0x139ed9))['catch'](handleError(_0x3c0150,null));};exports['getHopperHistories']=function(_0x9dbce,_0xdbed81){var _0x2ad052={'raw':!![],'where':{}};var _0x2ea0c0={};var _0x334354={'count':0x0,'rows':[]};return db[_0x35ef('0x20')][_0x35ef('0x25')]({'where':{'id':_0x9dbce[_0x35ef('0xb4')]['id']}})[_0x35ef('0x1a')](handleEntityNotFound(_0xdbed81,null))[_0x35ef('0x1a')](function(_0x567d44){if(_0x567d44){_0x2ea0c0['model']=_[_0x35ef('0x22')](db[_0x35ef('0xa0')][_0x35ef('0xc1')]);_0x2ea0c0[_0x35ef('0x2e')]=_[_0x35ef('0x22')](_0x9dbce[_0x35ef('0x2e')]);_0x2ea0c0['filters']=_['intersection'](_0x2ea0c0[_0x35ef('0x2d')],_0x2ea0c0[_0x35ef('0x2e')]);_0x2ad052['attributes']=_[_0x35ef('0x2c')](_0x2ea0c0[_0x35ef('0x2d')],qs[_0x35ef('0x2f')](_0x9dbce[_0x35ef('0x2e')][_0x35ef('0x2f')]));_0x2ad052['attributes']=_0x2ad052[_0x35ef('0x30')][_0x35ef('0x28')]?_0x2ad052['attributes']:_0x2ea0c0['model'];if(!_0x9dbce[_0x35ef('0x2e')]['hasOwnProperty'](_0x35ef('0x32'))){_0x2ad052[_0x35ef('0x14')]=qs[_0x35ef('0x14')](_0x9dbce[_0x35ef('0x2e')][_0x35ef('0x14')]);_0x2ad052[_0x35ef('0x12')]=qs['offset'](_0x9dbce[_0x35ef('0x2e')][_0x35ef('0x12')]);}_0x2ad052[_0x35ef('0x6b')]=qs[_0x35ef('0x33')](_0x9dbce[_0x35ef('0x2e')]['sort']);_0x2ad052['where']=qs[_0x35ef('0x2b')](_['pick'](_0x9dbce[_0x35ef('0x2e')],_0x2ea0c0['filters']));_0x2ad052[_0x35ef('0x34')][_0x35ef('0xdb')]=_0x567d44['id'];if(_0x9dbce['query'][_0x35ef('0x54')]){_0x2ad052[_0x35ef('0x34')]=_[_0x35ef('0x77')](_0x2ad052[_0x35ef('0x34')],{'$or':_[_0x35ef('0x49')](_0x2ad052[_0x35ef('0x30')],function(_0x2cb582){var _0x14e924={};_0x14e924[_0x2cb582]={'$like':'%'+_0x9dbce[_0x35ef('0x2e')]['filter']+'%'};return _0x14e924;})});}_0x2ad052=_['merge']({},_0x2ad052,_0x9dbce['options']);return db['CmHopperHistory'][_0x35ef('0x15')]({'where':_0x2ad052[_0x35ef('0x34')]})[_0x35ef('0x1a')](function(_0x4e5d93){_0x334354[_0x35ef('0x15')]=_0x4e5d93;if(_0x9dbce['query']['includeAll']){_0x2ad052[_0x35ef('0xdc')]=[{'all':!![]}];}return db[_0x35ef('0xa0')][_0x35ef('0x89')](_0x2ad052);})[_0x35ef('0x1a')](function(_0x182d6a){_0x334354[_0x35ef('0x83')]=_0x182d6a;return _0x334354;});}})['then'](respondWithFilteredResult(_0xdbed81,_0x2ad052))[_0x35ef('0x84')](handleError(_0xdbed81,null));};exports['getHopperFinals']=function(_0x2bbe61,_0x908ab){var _0x16e565={'raw':!![],'where':{}};var _0x2b851a={};var _0x30a11a={'count':0x0,'rows':[]};return db['CmContact'][_0x35ef('0x25')]({'where':{'id':_0x2bbe61['params']['id']}})[_0x35ef('0x1a')](handleEntityNotFound(_0x908ab,null))[_0x35ef('0x1a')](function(_0xe4c877){if(_0xe4c877){_0x2b851a[_0x35ef('0x2d')]=_[_0x35ef('0x22')](db[_0x35ef('0xdd')][_0x35ef('0xc1')]);_0x2b851a[_0x35ef('0x2e')]=_[_0x35ef('0x22')](_0x2bbe61[_0x35ef('0x2e')]);_0x2b851a[_0x35ef('0x2b')]=_['intersection'](_0x2b851a[_0x35ef('0x2d')],_0x2b851a['query']);_0x16e565[_0x35ef('0x30')]=_['intersection'](_0x2b851a['model'],qs[_0x35ef('0x2f')](_0x2bbe61['query'][_0x35ef('0x2f')]));_0x16e565['attributes']=_0x16e565[_0x35ef('0x30')]['length']?_0x16e565['attributes']:_0x2b851a[_0x35ef('0x2d')];if(!_0x2bbe61[_0x35ef('0x2e')][_0x35ef('0x31')](_0x35ef('0x32'))){_0x16e565[_0x35ef('0x14')]=qs['limit'](_0x2bbe61[_0x35ef('0x2e')][_0x35ef('0x14')]);_0x16e565[_0x35ef('0x12')]=qs[_0x35ef('0x12')](_0x2bbe61[_0x35ef('0x2e')]['offset']);}_0x16e565[_0x35ef('0x6b')]=qs[_0x35ef('0x33')](_0x2bbe61[_0x35ef('0x2e')][_0x35ef('0x33')]);_0x16e565[_0x35ef('0x34')]=qs[_0x35ef('0x2b')](_[_0x35ef('0x35')](_0x2bbe61[_0x35ef('0x2e')],_0x2b851a[_0x35ef('0x2b')]));_0x16e565[_0x35ef('0x34')]['ContactId']=_0xe4c877['id'];if(_0x2bbe61['query'][_0x35ef('0x54')]){_0x16e565[_0x35ef('0x34')]=_['merge'](_0x16e565[_0x35ef('0x34')],{'$or':_['map'](_0x16e565[_0x35ef('0x30')],function(_0x2ff6cb){var _0x78c786={};_0x78c786[_0x2ff6cb]={'$like':'%'+_0x2bbe61[_0x35ef('0x2e')][_0x35ef('0x54')]+'%'};return _0x78c786;})});}_0x16e565=_[_0x35ef('0x77')]({},_0x16e565,_0x2bbe61['options']);return db[_0x35ef('0xdd')][_0x35ef('0x15')]({'where':_0x16e565[_0x35ef('0x34')]})[_0x35ef('0x1a')](function(_0x222a42){_0x30a11a[_0x35ef('0x15')]=_0x222a42;if(_0x2bbe61['query']['includeAll']){_0x16e565[_0x35ef('0xdc')]=[{'all':!![]}];}return db[_0x35ef('0xdd')]['findAll'](_0x16e565);})['then'](function(_0x2eb031){_0x30a11a[_0x35ef('0x83')]=_0x2eb031;return _0x30a11a;});}})[_0x35ef('0x1a')](respondWithFilteredResult(_0x908ab,_0x16e565))[_0x35ef('0x84')](handleError(_0x908ab,null));};exports[_0x35ef('0xde')]=function(_0x448001,_0x23df4b){var _0x35d46c={'raw':!![],'where':{}};var _0x85a9b0={};var _0x2aab08={'count':0x0,'rows':[]};return db[_0x35ef('0x20')][_0x35ef('0x25')]({'where':{'id':_0x448001[_0x35ef('0xb4')]['id']}})[_0x35ef('0x1a')](handleEntityNotFound(_0x23df4b,null))[_0x35ef('0x1a')](function(_0x2a7219){if(_0x2a7219){_0x85a9b0[_0x35ef('0x2d')]=_[_0x35ef('0x22')](db[_0x35ef('0xa7')][_0x35ef('0xc1')]);_0x85a9b0[_0x35ef('0x2e')]=_['keys'](_0x448001[_0x35ef('0x2e')]);_0x85a9b0[_0x35ef('0x2b')]=_['intersection'](_0x85a9b0[_0x35ef('0x2d')],_0x85a9b0[_0x35ef('0x2e')]);_0x35d46c[_0x35ef('0x30')]=_['intersection'](_0x85a9b0['model'],qs[_0x35ef('0x2f')](_0x448001[_0x35ef('0x2e')][_0x35ef('0x2f')]));_0x35d46c[_0x35ef('0x30')]=_0x35d46c['attributes']['length']?_0x35d46c[_0x35ef('0x30')]:_0x85a9b0[_0x35ef('0x2d')];if(!_0x448001[_0x35ef('0x2e')][_0x35ef('0x31')](_0x35ef('0x32'))){_0x35d46c[_0x35ef('0x14')]=qs['limit'](_0x448001['query'][_0x35ef('0x14')]);_0x35d46c['offset']=qs['offset'](_0x448001[_0x35ef('0x2e')][_0x35ef('0x12')]);}_0x35d46c[_0x35ef('0x6b')]=qs[_0x35ef('0x33')](_0x448001[_0x35ef('0x2e')]['sort']);_0x35d46c[_0x35ef('0x34')]=qs[_0x35ef('0x2b')](_['pick'](_0x448001[_0x35ef('0x2e')],_0x85a9b0[_0x35ef('0x2b')]));_0x35d46c[_0x35ef('0x34')][_0x35ef('0xdb')]=_0x2a7219['id'];if(_0x448001['query'][_0x35ef('0x54')]){_0x35d46c['where']=_['merge'](_0x35d46c['where'],{'$or':_[_0x35ef('0x49')](_0x35d46c[_0x35ef('0x30')],function(_0x1753ce){var _0x193a43={};_0x193a43[_0x1753ce]={'$like':'%'+_0x448001[_0x35ef('0x2e')][_0x35ef('0x54')]+'%'};return _0x193a43;})});}_0x35d46c=_['merge']({},_0x35d46c,_0x448001[_0x35ef('0xdf')]);return db[_0x35ef('0xa7')][_0x35ef('0x15')]({'where':_0x35d46c[_0x35ef('0x34')]})['then'](function(_0x2b5565){_0x2aab08[_0x35ef('0x15')]=_0x2b5565;if(_0x448001[_0x35ef('0x2e')]['includeAll']){_0x35d46c[_0x35ef('0xdc')]=[{'all':!![]}];}return db[_0x35ef('0xa7')][_0x35ef('0x89')](_0x35d46c);})[_0x35ef('0x1a')](function(_0x313d32){_0x2aab08[_0x35ef('0x83')]=_0x313d32;return _0x2aab08;});}})['then'](respondWithFilteredResult(_0x23df4b,_0x35d46c))['catch'](handleError(_0x23df4b,null));};exports[_0x35ef('0xe0')]=function(_0x4f16e7,_0x307e84){try{if(!_0x4f16e7[_0x35ef('0x8d')][_0x35ef('0x57')]){throw new Error(_0x35ef('0xe1'));}if(!_0x4f16e7['body'][_0x35ef('0xe2')]){throw new Error(_0x35ef('0xe3'));}if(!_0x4f16e7[_0x35ef('0x8d')][_0x35ef('0xe4')]){throw new Error(_0x35ef('0xe5'));}if(!_0x4f16e7[_0x35ef('0x8d')][_0x35ef('0xe6')]){throw new Error(_0x35ef('0xe7'));}var _0x24d94f=_0x4f16e7[_0x35ef('0x8d')][_0x35ef('0xe2')][_0x35ef('0x5f')](',');var _0x55056a=_0x4f16e7['body'][_0x35ef('0xe4')][_0x35ef('0x5f')](',');if(!_0x24d94f[_0x35ef('0x28')]||!_0x55056a['length']||_0x24d94f['length']!==_0x55056a[_0x35ef('0x28')]){throw new Error(_0x35ef('0xe8'));}_0x4f16e7[_0x35ef('0x8d')][_0x35ef('0x2f')]=_[_0x35ef('0xe9')](_0x24d94f,_0x55056a);if(!_0x4f16e7[_0x35ef('0x8d')][_0x35ef('0x2f')][_0x35ef('0xc0')]){throw new Error(_0x35ef('0xea'));}if(!_0x4f16e7[_0x35ef('0x8d')][_0x35ef('0x2f')][_0x35ef('0xeb')]){throw new Error(_0x35ef('0xec'));}var _0x41ebd8=path['join'](config[_0x35ef('0xed')],'server/files/tmp',_0x4f16e7[_0x35ef('0xee')][_0x35ef('0xef')]);fs[_0x35ef('0xf0')](_0x41ebd8,parseInt(_0x35ef('0xf1'),0x8));var _0x1191a4=require(_0x35ef('0xf2'))[_0x35ef('0xf3')](path[_0x35ef('0x8f')](__dirname,_0x35ef('0xf4')),[_0x41ebd8,_0x4f16e7[_0x35ef('0x8d')][_0x35ef('0xe2')],_0x4f16e7['body'][_0x35ef('0xe4')],_0x4f16e7[_0x35ef('0x8d')]['ListId'],_0x4f16e7[_0x35ef('0x8d')][_0x35ef('0xf5')],_0x4f16e7['body'][_0x35ef('0xae')],_0x4f16e7['body']['socket_timestamp']]);return _0x307e84[_0x35ef('0x10')](0xc8)[_0x35ef('0x11')]({'message':_0x35ef('0xf6'),'pid':_0x1191a4[_0x35ef('0xf7')]});}catch(_0x325839){return _0x307e84[_0x35ef('0x10')](0x1f4)[_0x35ef('0x1e')](_0x325839);}};exports[_0x35ef('0xf8')]=function(_0x179e5d,_0x5ceb63){var _0x4fc811=fs[_0x35ef('0xf9')](_0x179e5d[_0x35ef('0xee')][_0x35ef('0xfa')]);Papa['parse'](_0x4fc811,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2f7348){return _0x5ceb63[_0x35ef('0x10')](0xc8)[_0x35ef('0x11')]({'file':_0x179e5d[_0x35ef('0xee')],'fields':_0x2f7348[_0x35ef('0xfb')]['fields']});}});};exports[_0x35ef('0xfc')]=function(_0x5f2a2d,_0x3428d1){return db['User'][_0x35ef('0x89')]({'raw':!![],'attributes':['id'],'where':{'role':_0x35ef('0x73')}})[_0x35ef('0x1a')](function(_0x50a8d6){var _0x429d5b=![];if(!_0x5f2a2d[_0x35ef('0x8d')][_0x35ef('0x57')]){throw new Error(_0x35ef('0xe1'));}if(!_0x5f2a2d[_0x35ef('0x8d')]['binding'][_0x35ef('0xc0')]){throw new Error(_0x35ef('0xea'));}if(!_0x5f2a2d['body'][_0x35ef('0xfd')][_0x35ef('0xeb')]){throw new Error(_0x35ef('0xec'));}if(!_0x5f2a2d[_0x35ef('0x8d')][_0x35ef('0xe6')]){throw new Error(_0x35ef('0xe7'));}var _0x48527f=require(_0x35ef('0xf2'))[_0x35ef('0xf3')](path[_0x35ef('0x8f')](__dirname,_0x35ef('0xfe')),[_0x5f2a2d['params']['id'],JSON[_0x35ef('0xff')](_0x5f2a2d[_0x35ef('0x8d')]),JSON[_0x35ef('0xff')](_0x50a8d6)]);_0x48527f['on'](_0x35ef('0x100'),function(){_0x429d5b=!![];return _0x3428d1[_0x35ef('0x10')](0xc8)[_0x35ef('0x11')]({'message':_0x35ef('0x101'),'pid':_0x48527f[_0x35ef('0xf7')]});});_0x48527f['on']('exit',function(_0x4b922e){if(_0x4b922e&&!_0x429d5b){return _0x3428d1[_0x35ef('0x10')](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0x48527f[_0x35ef('0xf7')]});}});})[_0x35ef('0x84')](handleError(_0x3428d1,null));};exports[_0x35ef('0x102')]=function(_0x118759,_0x319853,_0x4fc3ac){return db['User'][_0x35ef('0x89')]({'raw':!![],'attributes':['id'],'where':{'role':_0x35ef('0x73')}})[_0x35ef('0x1a')](function(_0x4565a9){var _0x554748=![];if(!_0x118759['body'][_0x35ef('0x57')]){throw new Error(_0x35ef('0xe1'));}if(!_0x118759[_0x35ef('0x8d')]['binding'][_0x35ef('0xc0')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x118759[_0x35ef('0x8d')][_0x35ef('0xfd')][_0x35ef('0xeb')]){throw new Error(_0x35ef('0xec'));}if(!_0x118759[_0x35ef('0x8d')][_0x35ef('0xe6')]){throw new Error(_0x35ef('0xe7'));}var _0x2a7e1c=require(_0x35ef('0xf2'))['fork'](path['join'](__dirname,_0x35ef('0x103')),[_0x118759[_0x35ef('0xb4')]['id'],JSON[_0x35ef('0xff')](_0x118759[_0x35ef('0x8d')]),JSON[_0x35ef('0xff')](_0x4565a9)]);_0x2a7e1c['on'](_0x35ef('0x100'),function(_0x3cf595){_0x554748=!![];return _0x319853[_0x35ef('0x10')](0xc8)[_0x35ef('0x11')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x2a7e1c[_0x35ef('0xf7')]});});_0x2a7e1c['on']('exit',function(_0x356eb5){if(_0x356eb5&&!_0x554748){return _0x319853[_0x35ef('0x10')](0x1f4)[_0x35ef('0x11')]({'message':_0x35ef('0x104'),'pid':_0x2a7e1c[_0x35ef('0xf7')]});}});})[_0x35ef('0x84')](handleError(_0x319853,null));};exports['getJourney']=function(_0xd3b003,_0x22c07c){var _0x5b2aac=[_0x35ef('0x105'),_0x35ef('0x106'),'sms',_0x35ef('0x107'),_0x35ef('0x108'),_0x35ef('0x109'),_0x35ef('0x10a')];var _0x1418f1={'offset':0x0,'order':qs['sort'](_0x35ef('0x10b'))},_0x170e63={'count':0x0,'rows':[]};Promise['resolve']()[_0x35ef('0x1a')](function(){if(_0xd3b003['query'][_0x35ef('0x10c')]){if(!_[_0x35ef('0x10d')](_0x5b2aac,_0xd3b003[_0x35ef('0x2e')]['channel'][_0x35ef('0x10e')]())){throw new Error('Invalid\x20channel');}_0x5b2aac=[_0xd3b003[_0x35ef('0x2e')][_0x35ef('0x10c')]['toLowerCase']()];}if(_0xd3b003['query'][_0x35ef('0x10f')]){try{var _0x1143a2=JSON[_0x35ef('0x110')](_0xd3b003['query'][_0x35ef('0x10f')]);if(!moment(_0x1143a2[_0x35ef('0x3a')])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x1143a2['to'])[_0x35ef('0x111')]()){throw new Error(_0x35ef('0x112'));}}catch(_0x177c4a){throw new Error(_0x35ef('0x113'));}}if(!_0xd3b003['query'][_0x35ef('0x31')](_0x35ef('0x32'))){_0x1418f1['limit']=qs[_0x35ef('0x14')](_0xd3b003[_0x35ef('0x2e')][_0x35ef('0x14')]||0xa);_0x1418f1['offset']=qs['offset'](_0xd3b003['query'][_0x35ef('0x12')]);}var _0x330f1b=_0x5b2aac[_0x35ef('0x49')](function(_0x4ff421){if(_0x4ff421===_0x35ef('0x10a')){var _0x1d7b47={'attributes':['id','uniqueid',_0x35ef('0x52'),_0x35ef('0x114'),'destination',_0x35ef('0x115'),_0x35ef('0x116'),_0x35ef('0x117'),'duration',_0x35ef('0x118'),'createdAt',_0x35ef('0x119'),'userSecondDisposition',_0x35ef('0x11a'),_0x35ef('0x11b')],'where':{'ContactId':_0xd3b003[_0x35ef('0xb4')]['id']},'include':[{'model':db['User'],'as':_0x35ef('0x4d'),'attributes':['id',_0x35ef('0x1d'),'fullname','alias']}],'order':[[_0x35ef('0x11c'),'DESC']]};if(_0xd3b003[_0x35ef('0x2e')][_0x35ef('0x10f')]){_0x1d7b47['where'][_0x35ef('0x11c')]={'$gte':_0x1143a2[_0x35ef('0x3a')],'$lte':_0x1143a2['to']};}return db[_0x35ef('0xa2')][_0x35ef('0x11d')](_0x1d7b47)[_0x35ef('0x1a')](function(_0x414bb6){_0x170e63[_0x35ef('0x15')]+=_0x414bb6[_0x35ef('0x15')];return _[_0x35ef('0x49')](_0x414bb6['rows'],function(_0x2f353a){var _0x3cb68c=_0x2f353a[_0x35ef('0x8e')]({'plain':!![]});_0x3cb68c[_0x35ef('0x10c')]=_0x4ff421;if(_0x3cb68c[_0x35ef('0x4d')]){_0x3cb68c[_0x35ef('0x4d')]={'id':_0x3cb68c[_0x35ef('0x4d')]['id'],'name':_0x3cb68c[_0x35ef('0x4d')]['name'],'fullname':_0x3cb68c[_0x35ef('0x4d')]['fullname'],'alias':_0x3cb68c[_0x35ef('0x4d')][_0x35ef('0x8a')]};}return _0x3cb68c;});});}else{var _0x201949=_[_0x35ef('0x11e')](_0x4ff421)+(_0x4ff421===_0x35ef('0x106')?_0x35ef('0x11f'):_0x35ef('0x120'));var _0x211831={'attributes':['id',_0x35ef('0x121'),_0x35ef('0x122'),_0x35ef('0x11c'),'note','disposition',_0x35ef('0x123'),_0x35ef('0x124'),'UserId',_0x201949+'Id'],'where':{'ContactId':_0xd3b003[_0x35ef('0xb4')]['id']},'include':[{'model':db[_0x201949],'as':_0x35ef('0x120'),'attributes':['id',_0x35ef('0x1d'),_0x35ef('0x125')]},{'model':db[_0x35ef('0x4d')],'as':'Owner','attributes':['id',_0x35ef('0x1d'),_0x35ef('0x126')]},{'model':db[_0x35ef('0x47')],'as':_0x35ef('0x81'),'attributes':['id',_0x35ef('0x1d'),_0x35ef('0x38')],'through':{'attributes':[]}}],'order':[['createdAt',_0x35ef('0x6c')]]};if(_0xd3b003[_0x35ef('0x2e')][_0x35ef('0x10f')]){_0x211831[_0x35ef('0x34')][_0x35ef('0x11c')]={'$gte':_0x1143a2[_0x35ef('0x3a')],'$lte':_0x1143a2['to']};}switch(_0x4ff421){case'chat':_0x211831[_0x35ef('0x30')][_0x35ef('0x24')]('browserName','customerIp',_0x35ef('0x127'),_0x35ef('0x128'),'osName',_0x35ef('0x129'),_0x35ef('0x12a'),'ratingValue',_0x35ef('0x12b'));break;case'mail':_0x211831[_0x35ef('0x30')]['push'](_0x35ef('0x12c'),_0x35ef('0x12d'));break;case'openchannel':_0x211831[_0x35ef('0x30')][_0x35ef('0x24')](_0x35ef('0x12e'),_0x35ef('0x12f'));break;}return db[_[_0x35ef('0x11e')](_0x4ff421)+_0x35ef('0x130')][_0x35ef('0x11d')](_0x211831)[_0x35ef('0x1a')](function(_0x4e2b06){_0x170e63[_0x35ef('0x15')]+=_0x4e2b06['count'];return _[_0x35ef('0x49')](_0x4e2b06['rows'],function(_0x26c887){var _0x4e8c56=_0x26c887[_0x35ef('0x8e')]({'plain':!![]});_0x4e8c56[_0x35ef('0x10c')]=_0x4ff421;if(_0x4e8c56[_0x35ef('0x131')]){_0x4e8c56['Owner']={'id':_0x4e8c56['Owner']['id'],'name':_0x4e8c56[_0x35ef('0x131')][_0x35ef('0x1d')],'fullname':_0x4e8c56[_0x35ef('0x131')][_0x35ef('0x126')]};}return _0x4e8c56;});});}});return Promise[_0x35ef('0x27')](_0x330f1b);})[_0x35ef('0x1a')](function(_0x45954c){return _(_0x45954c)[_0x35ef('0x132')]()[_0x35ef('0x133')](_0x35ef('0x11c'))[_0x35ef('0x134')]()['value']();})[_0x35ef('0x1a')](function(_0xb8985a){_0x170e63[_0x35ef('0x83')]=_0x1418f1['limit']?_0xb8985a[_0x35ef('0x135')](_0x1418f1['offset'],_0x1418f1['offset']+_0x1418f1[_0x35ef('0x14')]):_0xb8985a;return _0x170e63;})[_0x35ef('0x1a')](respondWithFilteredResult(_0x22c07c,_0x1418f1))['catch'](handleError(_0x22c07c,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 7272be8..cf64b07 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 _0xf109=['setMaxListeners','save','update','remove','emit','exports','events','CmContact'];(function(_0x52ced5,_0x2e8ebc){var _0x1b6599=function(_0x334587){while(--_0x334587){_0x52ced5['push'](_0x52ced5['shift']());}};_0x1b6599(++_0x2e8ebc);}(_0xf109,0x76));var _0x9f10=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xf109[_0x101e7b];return _0x4995c0;};'use strict';var EventEmitter=require(_0x9f10('0x0'));var CmContact=require('../../mysqldb')['db'][_0x9f10('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x9f10('0x2')](0x0);var events={'afterCreate':_0x9f10('0x3'),'afterUpdate':_0x9f10('0x4'),'afterDestroy':_0x9f10('0x5')};function emitEvent(_0xbd1048){return function(_0x5d22a9,_0x5521f9,_0x53f26c){CmContactEvents[_0x9f10('0x6')](_0xbd1048+':'+_0x5d22a9['id'],_0x5d22a9);CmContactEvents[_0x9f10('0x6')](_0xbd1048,_0x5d22a9);_0x53f26c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x9f10('0x7')]=CmContactEvents; \ No newline at end of file +var _0x2a72=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact'];(function(_0x15fe82,_0x1559b9){var _0x5bc08c=function(_0x5b4f4c){while(--_0x5b4f4c){_0x15fe82['push'](_0x15fe82['shift']());}};_0x5bc08c(++_0x1559b9);}(_0x2a72,0xad));var _0x22a7=function(_0x4366e3,_0x53f422){_0x4366e3=_0x4366e3-0x0;var _0x189d11=_0x2a72[_0x4366e3];return _0x189d11;};'use strict';var EventEmitter=require(_0x22a7('0x0'));var CmContact=require(_0x22a7('0x1'))['db'][_0x22a7('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x22a7('0x3')](0x0);var events={'afterCreate':_0x22a7('0x4'),'afterUpdate':_0x22a7('0x5'),'afterDestroy':_0x22a7('0x6')};function emitEvent(_0x1a24fa){return function(_0x68ca08,_0x2e65e7,_0x5ca2ab){CmContactEvents['emit'](_0x1a24fa+':'+_0x68ca08['id'],_0x68ca08);CmContactEvents[_0x22a7('0x7')](_0x1a24fa,_0x68ca08);_0x5ca2ab(null);};}for(var e in events){if(events[_0x22a7('0x8')](e)){var event=events[e];CmContact[_0x22a7('0x9')](e,emitEvent(event));}}module[_0x22a7('0xa')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 7f8e2e8..be2bba6 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 _0xea36=['dialTimezone','VoiceQueue','findOne','timezones','isNil','utcOffset','minutes','then','CmHopper','create','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','Campaign','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','ListId','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','CmList','Lists','get','always','onlyIfOpen','findAll','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','email','FULLTEXT','models','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xea36,0x77));var _0x6ea3=function(_0x2288a8,_0x4219c5){_0x2288a8=_0x2288a8-0x0;var _0x37da3a=_0xea36[_0x2288a8];return _0x37da3a;};'use strict';var _=require(_0x6ea3('0x0'));var util=require(_0x6ea3('0x1'));var logger=require(_0x6ea3('0x2'))('api');var moment=require(_0x6ea3('0x3'));var BPromise=require(_0x6ea3('0x4'));var rp=require(_0x6ea3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6ea3('0x6'));var shared=require(_0x6ea3('0x7'));var attributes=require(_0x6ea3('0x8'));module[_0x6ea3('0x9')]=function(_0x3ef694,_0x2aa8b1){return _0x3ef694[_0x6ea3('0xa')]('CmContact',attributes,{'tableName':_0x6ea3('0xb'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x6ea3('0xc')]},{'name':_0x6ea3('0xd'),'fields':[_0x6ea3('0xe'),_0x6ea3('0xf'),_0x6ea3('0xc'),_0x6ea3('0x10'),'fax',_0x6ea3('0x11')],'type':_0x6ea3('0x12')}],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x4111c6,_0x5eefbb,_0x24b26a){var _0x43820d=_0x3ef694[_0x6ea3('0x13')];var _0x32e819=_0x4111c6['get']({'plain':!![]});function _0x116cf3(){return function(_0x2227a5){logger[_0x6ea3('0x14')](_0x6ea3('0x15'),_0x6ea3('0x16'),util[_0x6ea3('0x17')](_0x2227a5,{'showHidden':![],'depth':null}));};}function _0x239197(_0x2fb269,_0x5272d5){var _0x160fe8=_0x5272d5[_0x6ea3('0x18')]?_0x5272d5[_0x6ea3('0x18')]:moment()[_0x6ea3('0x19')](_0x6ea3('0x1a'));return new BPromise(function(_0x45355a,_0x522acd){if(_['isNil'](_0x5272d5[_0x6ea3('0x1b')])){_0x45355a({'ret':_0x160fe8});}else{_0x43820d[_0x6ea3('0x1c')][_0x6ea3('0x1d')]({'where':{'id':_0x2fb269['id']}})['then'](function(_0x4abc28){if(!_['isNil'](_0x4abc28)){var _0x556b44=_0x4abc28['dialTimezone'];if(!_['isNil'](_0x556b44)){var _0x53b70e=shared[_0x6ea3('0x1e')];var _0x2944e2=_0x53b70e[_0x556b44];var _0x4c4834=_0x53b70e[_0x5272d5[_0x6ea3('0x1b')]];if(!_[_0x6ea3('0x1f')](_0x2944e2)&&!_[_0x6ea3('0x1f')](_0x4c4834)){var _0x3ee841=_0x2944e2[_0x6ea3('0x20')]-_0x4c4834[_0x6ea3('0x20')];_0x160fe8=_0x5272d5[_0x6ea3('0x18')]?_0x5272d5['scheduledat']:moment();var _0x590843=moment(_0x160fe8)['add'](_0x3ee841,_0x6ea3('0x21'));_0x45355a({'ret':_0x590843[_0x6ea3('0x19')](_0x6ea3('0x1a'))});}else _0x45355a({'ret':_0x160fe8});}else _0x45355a({'ret':_0x160fe8});}else{_0x45355a({'ret':_0x160fe8});}});}});return 0xa;}var _0x4bf4e6=function(_0x537ac5){return new BPromise(function(_0x52dd22,_0x51c1ae){_0x239197(_0x537ac5,_0x32e819)[_0x6ea3('0x22')](function(_0x483b23){_0x32e819[_0x6ea3('0x18')]=_0x483b23['ret'];_0x43820d[_0x6ea3('0x23')][_0x6ea3('0x1d')]({'where':{'phone':_0x32e819[_0x6ea3('0xc')],'VoiceQueueId':_0x537ac5['id']}})[_0x6ea3('0x22')](function(_0x32f073){if(!_[_0x6ea3('0x1f')](_0x32f073)){throw new Error('cmContact,\x20afterCreate\x20'+_0x32e819['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x537ac5['id']);}return _0x43820d[_0x6ea3('0x23')][_0x6ea3('0x24')]({'phone':_0x32e819['phone'],'ContactId':_0x32e819['id'],'ListId':_0x32e819['ListId'],'priority':_0x32e819[_0x6ea3('0x25')]?_0x32e819[_0x6ea3('0x25')]:0x2,'scheduledat':_0x32e819['scheduledat']?_0x32e819[_0x6ea3('0x18')]:moment()[_0x6ea3('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x32e819[_0x6ea3('0x26')]?!![]:![],'callbackuniqueid':_0x32e819[_0x6ea3('0x26')]?_0x32e819[_0x6ea3('0x26')]:undefined,'callbackat':_0x32e819['callbackUniqueid']?moment()[_0x6ea3('0x19')](_0x6ea3('0x1a')):undefined,'VoiceQueueId':_0x537ac5['id']});})[_0x6ea3('0x27')](function(_0x2987a8){_0x51c1ae(_0x2987a8);});});});};var _0x4adef0=function(_0x751036){return new BPromise(function(_0x2a8af3,_0x31b5e4){_0x239197(_0x751036,_0x32e819)['then'](function(_0x2d0385){_0x32e819['scheduledat']=_0x2d0385['ret'];_0x43820d[_0x6ea3('0x23')][_0x6ea3('0x1d')]({'where':{'phone':_0x32e819['phone'],'VoiceQueueId':_0x751036['id']}})['then'](function(_0x53f610){if(!_[_0x6ea3('0x1f')](_0x53f610)){throw new Error(_0x6ea3('0x28')+_0x32e819[_0x6ea3('0xc')]+_0x6ea3('0x29')+_0x751036['id']);}return _0x43820d[_0x6ea3('0x2a')][_0x6ea3('0x1d')]({'where':{'calleridnum':_0x32e819['phone'],'VoiceQueueId':_0x751036['id']}});})[_0x6ea3('0x22')](function(_0x42cb0b){if(!_[_0x6ea3('0x1f')](_0x42cb0b)){throw new Error(_0x6ea3('0x2b')+_0x32e819[_0x6ea3('0xc')]+_0x6ea3('0x2c')+_0x751036['id']);}return _0x43820d[_0x6ea3('0x23')]['create']({'phone':_0x32e819[_0x6ea3('0xc')],'ContactId':_0x32e819['id'],'ListId':_0x32e819['ListId'],'priority':_0x32e819[_0x6ea3('0x25')]?_0x32e819[_0x6ea3('0x25')]:0x2,'scheduledat':_0x32e819[_0x6ea3('0x18')]?_0x32e819[_0x6ea3('0x18')]:moment()['format'](_0x6ea3('0x1a')),'callback':_0x32e819['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x32e819[_0x6ea3('0x26')]?_0x32e819[_0x6ea3('0x26')]:undefined,'callbackat':_0x32e819[_0x6ea3('0x26')]?moment()[_0x6ea3('0x19')](_0x6ea3('0x1a')):undefined,'VoiceQueueId':_0x751036['id']});})[_0x6ea3('0x27')](function(_0x482470){_0x31b5e4(_0x482470);});});});};function _0x159144(){return function(_0x114120){logger[_0x6ea3('0x14')]('cmContact',_0x6ea3('0x16'),util['inspect'](_0x114120,{'showHidden':![],'depth':null}));};}function _0xacc232(_0x2d4e8d,_0x5659dd){var _0x55e0ce=_0x5659dd[_0x6ea3('0x18')]?_0x5659dd[_0x6ea3('0x18')]:moment()[_0x6ea3('0x19')](_0x6ea3('0x1a'));return new BPromise(function(_0x18ee98,_0x35dfcc){if(_['isNil'](_0x5659dd[_0x6ea3('0x1b')])){_0x18ee98({'ret':_0x55e0ce});}else{_0x43820d[_0x6ea3('0x2d')][_0x6ea3('0x1d')]({'where':{'id':_0x2d4e8d['id']}})[_0x6ea3('0x22')](function(_0x55cabc){if(!_['isNil'](_0x55cabc)){var _0x1b94f3=_0x55cabc[_0x6ea3('0x1b')];if(!_['isNil'](_0x1b94f3)){var _0x4d6c5e=shared[_0x6ea3('0x1e')];var _0x4b62c6=_0x4d6c5e[_0x1b94f3];var _0x2287bb=_0x4d6c5e[_0x5659dd[_0x6ea3('0x1b')]];if(!_[_0x6ea3('0x1f')](_0x4b62c6)&&!_[_0x6ea3('0x1f')](_0x2287bb)){var _0x48382a=_0x4b62c6['utcOffset']-_0x2287bb[_0x6ea3('0x20')];_0x55e0ce=_0x5659dd[_0x6ea3('0x18')]?_0x5659dd[_0x6ea3('0x18')]:moment();var _0x984cc1=moment(_0x55e0ce)['add'](_0x48382a,_0x6ea3('0x21'));_0x18ee98({'ret':_0x984cc1['format'](_0x6ea3('0x1a'))});}else _0x18ee98({'ret':_0x55e0ce});}else _0x18ee98({'ret':_0x55e0ce});}else{_0x18ee98({'ret':_0x55e0ce});}});}});return 0xa;}var _0x5073ec=function(_0xb4c2ab){return new BPromise(function(_0x276d96,_0x3cf813){_0xacc232(_0xb4c2ab,_0x32e819)[_0x6ea3('0x22')](function(_0x3dbf7c){_0x32e819['scheduledat']=_0x3dbf7c[_0x6ea3('0x2e')];_0x43820d['CmHopper']['findOne']({'where':{'phone':_0x32e819[_0x6ea3('0xc')],'CampaignId':_0xb4c2ab['id']}})[_0x6ea3('0x22')](function(_0x295af4){if(!_[_0x6ea3('0x1f')](_0x295af4)){throw new Error(_0x6ea3('0x28')+_0x32e819[_0x6ea3('0xc')]+_0x6ea3('0x2f')+_0xb4c2ab['id']);}return _0x43820d['CmHopper'][_0x6ea3('0x24')]({'phone':_0x32e819[_0x6ea3('0xc')],'ContactId':_0x32e819['id'],'ListId':_0x32e819[_0x6ea3('0x30')],'priority':_0x32e819[_0x6ea3('0x25')]?_0x32e819[_0x6ea3('0x25')]:0x2,'scheduledat':_0x32e819[_0x6ea3('0x18')]?_0x32e819[_0x6ea3('0x18')]:moment()[_0x6ea3('0x19')](_0x6ea3('0x1a')),'callback':_0x32e819[_0x6ea3('0x26')]?!![]:![],'callbackuniqueid':_0x32e819[_0x6ea3('0x26')]?_0x32e819[_0x6ea3('0x26')]:undefined,'callbackat':_0x32e819[_0x6ea3('0x26')]?moment()['format'](_0x6ea3('0x1a')):undefined,'CampaignId':_0xb4c2ab['id']});})[_0x6ea3('0x27')](function(_0x5378eb){_0x3cf813(_0x5378eb);});});});};var _0x3c91cc=function(_0x2ad0fc){return new BPromise(function(_0x141de2,_0x5d6d95){_0xacc232(_0x2ad0fc,_0x32e819)[_0x6ea3('0x22')](function(_0x14f082){_0x32e819['scheduledat']=_0x14f082['ret'];_0x43820d[_0x6ea3('0x23')][_0x6ea3('0x1d')]({'where':{'phone':_0x32e819[_0x6ea3('0xc')],'CampaignId':_0x2ad0fc['id']}})[_0x6ea3('0x22')](function(_0x49c2bc){if(!_[_0x6ea3('0x1f')](_0x49c2bc)){throw new Error(_0x6ea3('0x28')+_0x32e819[_0x6ea3('0xc')]+_0x6ea3('0x31')+_0x2ad0fc['id']);}return _0x43820d['CmHopperFinal'][_0x6ea3('0x1d')]({'where':{'calleridnum':_0x32e819[_0x6ea3('0xc')],'CampaignId':_0x2ad0fc['id']}});})['then'](function(_0x4f65ff){if(!_[_0x6ea3('0x1f')](_0x4f65ff)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x32e819['phone']+_0x6ea3('0x32')+_0x2ad0fc['id']);}return _0x43820d[_0x6ea3('0x23')][_0x6ea3('0x24')]({'phone':_0x32e819[_0x6ea3('0xc')],'ContactId':_0x32e819['id'],'ListId':_0x32e819[_0x6ea3('0x30')],'priority':_0x32e819[_0x6ea3('0x25')]?_0x32e819[_0x6ea3('0x25')]:0x2,'scheduledat':_0x32e819[_0x6ea3('0x18')]?_0x32e819[_0x6ea3('0x18')]:moment()['format'](_0x6ea3('0x1a')),'callback':_0x32e819['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x32e819[_0x6ea3('0x26')]?_0x32e819[_0x6ea3('0x26')]:undefined,'callbackat':_0x32e819['callbackUniqueid']?moment()[_0x6ea3('0x19')](_0x6ea3('0x1a')):undefined,'CampaignId':_0x2ad0fc['id']});})['catch'](function(_0x51b2a){_0x5d6d95(_0x51b2a);});});});};if(_0x32e819['ListId']){_0x43820d[_0x6ea3('0x1c')]['findAll']({'where':{'type':_0x6ea3('0x33')},'attributes':['id',_0x6ea3('0x34'),'dialTimezone'],'include':[{'model':_0x43820d[_0x6ea3('0x35')],'as':_0x6ea3('0x36'),'where':{'id':_0x32e819[_0x6ea3('0x30')]}}]})[_0x6ea3('0x22')](function(_0x360449){if(_0x360449){var _0x5c6269=[];for(var _0x33948c=0x0,_0x4631a6;_0x33948c<_0x360449['length'];_0x33948c+=0x1){_0x4631a6=_0x360449[_0x33948c][_0x6ea3('0x37')]({'plain':!![]});switch(_0x4631a6[_0x6ea3('0x34')]){case _0x6ea3('0x38'):_0x4adef0(_0x4631a6)[_0x6ea3('0x27')](_0x116cf3());break;case _0x6ea3('0x39'):_0x4bf4e6(_0x4631a6)[_0x6ea3('0x27')](_0x116cf3());break;default:_0xacc232(_0x4631a6,_0x32e819)[_0x6ea3('0x22')](function(_0x54d858){_0x32e819[_0x6ea3('0x18')]=_0x54d858[_0x6ea3('0x2e')];_0x43820d[_0x6ea3('0x23')]['create']({'phone':_0x32e819[_0x6ea3('0xc')],'ContactId':_0x32e819['id'],'ListId':_0x32e819['ListId'],'scheduledat':_0x32e819['scheduledat']?_0x32e819[_0x6ea3('0x18')]:moment()[_0x6ea3('0x19')](_0x6ea3('0x1a')),'priority':_0x32e819['priority']?_0x32e819['priority']:0x2,'callback':_0x32e819[_0x6ea3('0x26')]?!![]:![],'callbackuniqueid':_0x32e819[_0x6ea3('0x26')]?_0x32e819['callbackUniqueid']:undefined,'callbackat':_0x32e819[_0x6ea3('0x26')]?moment()[_0x6ea3('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x4631a6['id']})[_0x6ea3('0x27')](_0x116cf3());});}}}})['then'](function(){return _0x43820d[_0x6ea3('0x1c')][_0x6ea3('0x3a')]({'where':{'type':_0x6ea3('0x33')},'attributes':['id'],'include':[{'model':_0x43820d['CmList'],'as':_0x6ea3('0x3b'),'where':{'id':_0x32e819[_0x6ea3('0x30')]}}]})[_0x6ea3('0x22')](function(_0x33b05d){if(_0x33b05d){var _0x5b0b44=[];for(var _0x3aa72f=0x0,_0xc86ee0;_0x3aa72f<_0x33b05d[_0x6ea3('0x3c')];_0x3aa72f+=0x1){_0xc86ee0=_0x33b05d[_0x3aa72f]['get']({'plain':!![]});_0x43820d[_0x6ea3('0x3d')][_0x6ea3('0x24')]({'phone':_0x32e819[_0x6ea3('0xc')],'ContactId':_0x32e819['id'],'ListId':_0x32e819[_0x6ea3('0x30')],'VoiceQueueId':_0xc86ee0['id']})['catch'](function(_0x5403a0){logger[_0x6ea3('0x14')](_0x6ea3('0x3e'),_0x6ea3('0x16'),_0x5403a0[_0x6ea3('0x3f')]);});}}});})[_0x6ea3('0x22')](function(){return _0x43820d[_0x6ea3('0x2d')]['findAll']({'attributes':['id',_0x6ea3('0x34'),_0x6ea3('0x1b')],'include':[{'model':_0x43820d['CmList'],'as':'Lists','where':{'id':_0x32e819[_0x6ea3('0x30')]}}]})['then'](function(_0x16291a){if(_0x16291a){var _0x458a95=[];for(var _0x540c7b=0x0,_0x53cb95;_0x540c7b<_0x16291a[_0x6ea3('0x3c')];_0x540c7b+=0x1){_0x53cb95=_0x16291a[_0x540c7b][_0x6ea3('0x37')]({'plain':!![]});switch(_0x53cb95['dialCheckDuplicateType']){case _0x6ea3('0x38'):_0x3c91cc(_0x53cb95)[_0x6ea3('0x27')](_0x159144());break;case _0x6ea3('0x39'):_0x5073ec(_0x53cb95)['catch'](_0x159144());break;default:_0x43820d[_0x6ea3('0x23')]['create']({'phone':_0x32e819[_0x6ea3('0xc')],'ContactId':_0x32e819['id'],'ListId':_0x32e819[_0x6ea3('0x30')],'scheduledat':_0x32e819['scheduledat']?_0x32e819[_0x6ea3('0x18')]:moment()['format'](_0x6ea3('0x1a')),'priority':_0x32e819[_0x6ea3('0x25')]?_0x32e819[_0x6ea3('0x25')]:0x2,'callback':_0x32e819[_0x6ea3('0x26')]?!![]:![],'callbackuniqueid':_0x32e819[_0x6ea3('0x26')]?_0x32e819[_0x6ea3('0x26')]:undefined,'callbackat':_0x32e819[_0x6ea3('0x26')]?moment()['format'](_0x6ea3('0x1a')):undefined,'CampaignId':_0x53cb95['id']})[_0x6ea3('0x27')](_0x159144());}}}});})[_0x6ea3('0x22')](function(){return _0x43820d['Campaign'][_0x6ea3('0x3a')]({'attributes':['id'],'include':[{'model':_0x43820d[_0x6ea3('0x35')],'as':_0x6ea3('0x3b'),'where':{'id':_0x32e819[_0x6ea3('0x30')]}}]})[_0x6ea3('0x22')](function(_0x151707){if(_0x151707){var _0x37bb61=[];for(var _0x82ff2=0x0,_0x30be5a;_0x82ff2<_0x151707['length'];_0x82ff2+=0x1){_0x30be5a=_0x151707[_0x82ff2]['get']({'plain':!![]});_0x43820d[_0x6ea3('0x3d')][_0x6ea3('0x24')]({'phone':_0x32e819['phone'],'ContactId':_0x32e819['id'],'ListId':_0x32e819[_0x6ea3('0x30')],'CampaignId':_0x30be5a['id']})[_0x6ea3('0x27')](function(_0x3b7cad){logger[_0x6ea3('0x14')](_0x6ea3('0x3e'),_0x6ea3('0x16'),_0x3b7cad[_0x6ea3('0x3f')]);});}}});})[_0x6ea3('0x22')](function(){_0x24b26a();})['catch'](function(_0xbdce39){logger[_0x6ea3('0x14')](_0x6ea3('0x3e'),_0x6ea3('0x16'),_0xbdce39[_0x6ea3('0x3f')]);_0x24b26a(_0xbdce39);});}else{_0x24b26a(new Error(_0x6ea3('0x40')));}},'afterDestroy':function(_0x403284,_0x301718,_0x3ccca4){var _0x3821ce=_0x3ef694[_0x6ea3('0x13')];var _0x1330c5=_0x403284[_0x6ea3('0x37')]({'plain':!![]});return _0x3821ce['CmHopper'][_0x6ea3('0x3a')]({'raw':!![],'where':{'ListId':_0x1330c5[_0x6ea3('0x30')],'ContactId':_0x1330c5['id']}})['then'](function(_0x5892f8){if(!_[_0x6ea3('0x41')](_0x5892f8)){var _0x2deec8=[];for(var _0x40e858=0x0;_0x40e858<_0x5892f8['length'];_0x40e858+=0x1){var _0x4b4b66=_0x3821ce['CmHopper'][_0x6ea3('0x42')]({'where':{'ListId':_0x5892f8[_0x40e858][_0x6ea3('0x30')],'ContactId':_0x5892f8[_0x40e858][_0x6ea3('0x43')],'VoiceQueueId':_0x5892f8[_0x40e858][_0x6ea3('0x44')],'CampaignId':_0x5892f8[_0x40e858]['CampaignId']}});_0x2deec8['push'](_0x4b4b66);}return BPromise[_0x6ea3('0x45')](_0x2deec8);}})[_0x6ea3('0x22')](function(_0x205cfd){logger[_0x6ea3('0x46')](_0x6ea3('0x47'),util[_0x6ea3('0x17')](_0x205cfd,{'showHidden':![],'depth':null}));_0x3ccca4();})['catch'](function(_0x3b6e4f){logger[_0x6ea3('0x14')](_0x6ea3('0x48'),util[_0x6ea3('0x17')](_0x3b6e4f,{'showHidden':![],'depth':null}));_0x3ccca4(_0x3b6e4f);});}}});}; \ No newline at end of file +var _0xa71c=['findOne','then','timezones','utcOffset','add','minutes','ret','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','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','ListId','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','always','isEmpty','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','CmContact','phone','fti_cm_contacts','firstName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue'];(function(_0x449cba,_0x343d43){var _0x1566ea=function(_0x49033f){while(--_0x49033f){_0x449cba['push'](_0x449cba['shift']());}};_0x1566ea(++_0x343d43);}(_0xa71c,0xbe));var _0xca71=function(_0x27fff6,_0x2d2033){_0x27fff6=_0x27fff6-0x0;var _0x5f2d5a=_0xa71c[_0x27fff6];return _0x5f2d5a;};'use strict';var _=require(_0xca71('0x0'));var util=require(_0xca71('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xca71('0x2'));var BPromise=require(_0xca71('0x3'));var rp=require(_0xca71('0x4'));var fs=require('fs');var path=require(_0xca71('0x5'));var rimraf=require(_0xca71('0x6'));var config=require(_0xca71('0x7'));var shared=require(_0xca71('0x8'));var attributes=require(_0xca71('0x9'));module['exports']=function(_0x4497ba,_0x523151){return _0x4497ba['define'](_0xca71('0xa'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xca71('0xb'),'fields':[_0xca71('0xb')]},{'name':_0xca71('0xc'),'fields':[_0xca71('0xd'),'lastName','phone',_0xca71('0xe'),_0xca71('0xf'),_0xca71('0x10')],'type':_0xca71('0x11')}],'timestamps':!![],'charset':_0xca71('0x12'),'collate':_0xca71('0x13'),'hooks':{'afterCreate':function(_0x5d964f,_0x407e55,_0x72891c){var _0x54bd03=_0x4497ba[_0xca71('0x14')];var _0x361fcd=_0x5d964f[_0xca71('0x15')]({'plain':!![]});function _0x5436a6(){return function(_0x1705cf){logger[_0xca71('0x16')](_0xca71('0x17'),_0xca71('0x18'),util[_0xca71('0x19')](_0x1705cf,{'showHidden':![],'depth':null}));};}function _0x1b7737(_0x266e68,_0x20962f){var _0x571613=_0x20962f['scheduledat']?_0x20962f[_0xca71('0x1a')]:moment()[_0xca71('0x1b')](_0xca71('0x1c'));return new BPromise(function(_0x2f9900,_0x2d66de){if(_[_0xca71('0x1d')](_0x20962f[_0xca71('0x1e')])){_0x2f9900({'ret':_0x571613});}else{_0x54bd03[_0xca71('0x1f')][_0xca71('0x20')]({'where':{'id':_0x266e68['id']}})[_0xca71('0x21')](function(_0xd89892){if(!_[_0xca71('0x1d')](_0xd89892)){var _0xe5a0fa=_0xd89892['dialTimezone'];if(!_[_0xca71('0x1d')](_0xe5a0fa)){var _0x14d279=shared[_0xca71('0x22')];var _0x25af39=_0x14d279[_0xe5a0fa];var _0x3a22db=_0x14d279[_0x20962f['dialTimezone']];if(!_['isNil'](_0x25af39)&&!_[_0xca71('0x1d')](_0x3a22db)){var _0x21f98a=_0x25af39[_0xca71('0x23')]-_0x3a22db[_0xca71('0x23')];_0x571613=_0x20962f[_0xca71('0x1a')]?_0x20962f[_0xca71('0x1a')]:moment();var _0x15b8c9=moment(_0x571613)[_0xca71('0x24')](_0x21f98a,_0xca71('0x25'));_0x2f9900({'ret':_0x15b8c9[_0xca71('0x1b')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x2f9900({'ret':_0x571613});}else _0x2f9900({'ret':_0x571613});}else{_0x2f9900({'ret':_0x571613});}});}});return 0xa;}var _0x217900=function(_0x1b6790){return new BPromise(function(_0xe61547,_0x43b4a3){_0x1b7737(_0x1b6790,_0x361fcd)[_0xca71('0x21')](function(_0x321b58){_0x361fcd[_0xca71('0x1a')]=_0x321b58[_0xca71('0x26')];_0x54bd03['CmHopper'][_0xca71('0x20')]({'where':{'phone':_0x361fcd[_0xca71('0xb')],'VoiceQueueId':_0x1b6790['id']}})[_0xca71('0x21')](function(_0x54dc12){if(!_[_0xca71('0x1d')](_0x54dc12)){throw new Error(_0xca71('0x27')+_0x361fcd[_0xca71('0xb')]+_0xca71('0x28')+_0x1b6790['id']);}return _0x54bd03[_0xca71('0x29')][_0xca71('0x2a')]({'phone':_0x361fcd['phone'],'ContactId':_0x361fcd['id'],'ListId':_0x361fcd['ListId'],'priority':_0x361fcd[_0xca71('0x2b')]?_0x361fcd['priority']:0x2,'scheduledat':_0x361fcd[_0xca71('0x1a')]?_0x361fcd[_0xca71('0x1a')]:moment()['format'](_0xca71('0x1c')),'callback':_0x361fcd[_0xca71('0x2c')]?!![]:![],'callbackuniqueid':_0x361fcd[_0xca71('0x2c')]?_0x361fcd[_0xca71('0x2c')]:undefined,'callbackat':_0x361fcd[_0xca71('0x2c')]?moment()[_0xca71('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x1b6790['id']});})[_0xca71('0x2d')](function(_0x402b5f){_0x43b4a3(_0x402b5f);});});});};var _0x46672f=function(_0xcfe1a1){return new BPromise(function(_0x1378e2,_0x45848c){_0x1b7737(_0xcfe1a1,_0x361fcd)[_0xca71('0x21')](function(_0x1a3dd1){_0x361fcd[_0xca71('0x1a')]=_0x1a3dd1[_0xca71('0x26')];_0x54bd03[_0xca71('0x29')][_0xca71('0x20')]({'where':{'phone':_0x361fcd[_0xca71('0xb')],'VoiceQueueId':_0xcfe1a1['id']}})[_0xca71('0x21')](function(_0x1da962){if(!_[_0xca71('0x1d')](_0x1da962)){throw new Error(_0xca71('0x27')+_0x361fcd[_0xca71('0xb')]+_0xca71('0x2e')+_0xcfe1a1['id']);}return _0x54bd03[_0xca71('0x2f')]['findOne']({'where':{'calleridnum':_0x361fcd[_0xca71('0xb')],'VoiceQueueId':_0xcfe1a1['id']}});})[_0xca71('0x21')](function(_0x454ed2){if(!_[_0xca71('0x1d')](_0x454ed2)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x361fcd['phone']+_0xca71('0x30')+_0xcfe1a1['id']);}return _0x54bd03[_0xca71('0x29')][_0xca71('0x2a')]({'phone':_0x361fcd[_0xca71('0xb')],'ContactId':_0x361fcd['id'],'ListId':_0x361fcd['ListId'],'priority':_0x361fcd[_0xca71('0x2b')]?_0x361fcd[_0xca71('0x2b')]:0x2,'scheduledat':_0x361fcd[_0xca71('0x1a')]?_0x361fcd[_0xca71('0x1a')]:moment()[_0xca71('0x1b')](_0xca71('0x1c')),'callback':_0x361fcd[_0xca71('0x2c')]?!![]:![],'callbackuniqueid':_0x361fcd['callbackUniqueid']?_0x361fcd[_0xca71('0x2c')]:undefined,'callbackat':_0x361fcd[_0xca71('0x2c')]?moment()[_0xca71('0x1b')](_0xca71('0x1c')):undefined,'VoiceQueueId':_0xcfe1a1['id']});})[_0xca71('0x2d')](function(_0x32e788){_0x45848c(_0x32e788);});});});};function _0x3326b5(){return function(_0x43bc11){logger[_0xca71('0x16')](_0xca71('0x17'),'afterCreate',util[_0xca71('0x19')](_0x43bc11,{'showHidden':![],'depth':null}));};}function _0x1af1c9(_0x21906c,_0xfae8a){var _0x29743c=_0xfae8a[_0xca71('0x1a')]?_0xfae8a[_0xca71('0x1a')]:moment()['format'](_0xca71('0x1c'));return new BPromise(function(_0x247b10,_0x14fdb7){if(_[_0xca71('0x1d')](_0xfae8a[_0xca71('0x1e')])){_0x247b10({'ret':_0x29743c});}else{_0x54bd03[_0xca71('0x31')][_0xca71('0x20')]({'where':{'id':_0x21906c['id']}})[_0xca71('0x21')](function(_0x1fd36c){if(!_[_0xca71('0x1d')](_0x1fd36c)){var _0x27850a=_0x1fd36c[_0xca71('0x1e')];if(!_['isNil'](_0x27850a)){var _0x505213=shared[_0xca71('0x22')];var _0x179d08=_0x505213[_0x27850a];var _0x1665b7=_0x505213[_0xfae8a[_0xca71('0x1e')]];if(!_[_0xca71('0x1d')](_0x179d08)&&!_['isNil'](_0x1665b7)){var _0x3eb57=_0x179d08['utcOffset']-_0x1665b7[_0xca71('0x23')];_0x29743c=_0xfae8a['scheduledat']?_0xfae8a[_0xca71('0x1a')]:moment();var _0x155984=moment(_0x29743c)[_0xca71('0x24')](_0x3eb57,'minutes');_0x247b10({'ret':_0x155984['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x247b10({'ret':_0x29743c});}else _0x247b10({'ret':_0x29743c});}else{_0x247b10({'ret':_0x29743c});}});}});return 0xa;}var _0xaf6c38=function(_0x3dc478){return new BPromise(function(_0x207be8,_0x36302d){_0x1af1c9(_0x3dc478,_0x361fcd)[_0xca71('0x21')](function(_0x118145){_0x361fcd[_0xca71('0x1a')]=_0x118145[_0xca71('0x26')];_0x54bd03['CmHopper']['findOne']({'where':{'phone':_0x361fcd[_0xca71('0xb')],'CampaignId':_0x3dc478['id']}})[_0xca71('0x21')](function(_0x2b8903){if(!_['isNil'](_0x2b8903)){throw new Error(_0xca71('0x27')+_0x361fcd[_0xca71('0xb')]+_0xca71('0x32')+_0x3dc478['id']);}return _0x54bd03[_0xca71('0x29')][_0xca71('0x2a')]({'phone':_0x361fcd[_0xca71('0xb')],'ContactId':_0x361fcd['id'],'ListId':_0x361fcd[_0xca71('0x33')],'priority':_0x361fcd[_0xca71('0x2b')]?_0x361fcd[_0xca71('0x2b')]:0x2,'scheduledat':_0x361fcd[_0xca71('0x1a')]?_0x361fcd['scheduledat']:moment()[_0xca71('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x361fcd[_0xca71('0x2c')]?!![]:![],'callbackuniqueid':_0x361fcd[_0xca71('0x2c')]?_0x361fcd[_0xca71('0x2c')]:undefined,'callbackat':_0x361fcd[_0xca71('0x2c')]?moment()[_0xca71('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x3dc478['id']});})[_0xca71('0x2d')](function(_0xa65105){_0x36302d(_0xa65105);});});});};var _0x52c38d=function(_0x16605d){return new BPromise(function(_0x52879c,_0x824aa){_0x1af1c9(_0x16605d,_0x361fcd)[_0xca71('0x21')](function(_0x3fd9b0){_0x361fcd[_0xca71('0x1a')]=_0x3fd9b0[_0xca71('0x26')];_0x54bd03[_0xca71('0x29')][_0xca71('0x20')]({'where':{'phone':_0x361fcd[_0xca71('0xb')],'CampaignId':_0x16605d['id']}})['then'](function(_0x349bee){if(!_[_0xca71('0x1d')](_0x349bee)){throw new Error('cmContact,\x20afterCreate\x20'+_0x361fcd[_0xca71('0xb')]+_0xca71('0x34')+_0x16605d['id']);}return _0x54bd03[_0xca71('0x2f')][_0xca71('0x20')]({'where':{'calleridnum':_0x361fcd[_0xca71('0xb')],'CampaignId':_0x16605d['id']}});})[_0xca71('0x21')](function(_0x5b9c98){if(!_[_0xca71('0x1d')](_0x5b9c98)){throw new Error(_0xca71('0x35')+_0x361fcd[_0xca71('0xb')]+_0xca71('0x36')+_0x16605d['id']);}return _0x54bd03[_0xca71('0x29')][_0xca71('0x2a')]({'phone':_0x361fcd['phone'],'ContactId':_0x361fcd['id'],'ListId':_0x361fcd['ListId'],'priority':_0x361fcd[_0xca71('0x2b')]?_0x361fcd[_0xca71('0x2b')]:0x2,'scheduledat':_0x361fcd[_0xca71('0x1a')]?_0x361fcd['scheduledat']:moment()[_0xca71('0x1b')](_0xca71('0x1c')),'callback':_0x361fcd[_0xca71('0x2c')]?!![]:![],'callbackuniqueid':_0x361fcd[_0xca71('0x2c')]?_0x361fcd[_0xca71('0x2c')]:undefined,'callbackat':_0x361fcd[_0xca71('0x2c')]?moment()['format'](_0xca71('0x1c')):undefined,'CampaignId':_0x16605d['id']});})[_0xca71('0x2d')](function(_0x36e3d6){_0x824aa(_0x36e3d6);});});});};if(_0x361fcd[_0xca71('0x33')]){_0x54bd03[_0xca71('0x1f')][_0xca71('0x37')]({'where':{'type':_0xca71('0x38')},'attributes':['id',_0xca71('0x39'),_0xca71('0x1e')],'include':[{'model':_0x54bd03[_0xca71('0x3a')],'as':_0xca71('0x3b'),'where':{'id':_0x361fcd['ListId']}}]})[_0xca71('0x21')](function(_0x4875fe){if(_0x4875fe){var _0xb6079d=[];for(var _0x2b133a=0x0,_0x308426;_0x2b133a<_0x4875fe[_0xca71('0x3c')];_0x2b133a+=0x1){_0x308426=_0x4875fe[_0x2b133a][_0xca71('0x15')]({'plain':!![]});switch(_0x308426[_0xca71('0x39')]){case'always':_0x46672f(_0x308426)[_0xca71('0x2d')](_0x5436a6());break;case _0xca71('0x3d'):_0x217900(_0x308426)[_0xca71('0x2d')](_0x5436a6());break;default:_0x1af1c9(_0x308426,_0x361fcd)[_0xca71('0x21')](function(_0x14e4f4){_0x361fcd[_0xca71('0x1a')]=_0x14e4f4[_0xca71('0x26')];_0x54bd03['CmHopper'][_0xca71('0x2a')]({'phone':_0x361fcd[_0xca71('0xb')],'ContactId':_0x361fcd['id'],'ListId':_0x361fcd[_0xca71('0x33')],'scheduledat':_0x361fcd[_0xca71('0x1a')]?_0x361fcd[_0xca71('0x1a')]:moment()['format'](_0xca71('0x1c')),'priority':_0x361fcd[_0xca71('0x2b')]?_0x361fcd[_0xca71('0x2b')]:0x2,'callback':_0x361fcd['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x361fcd[_0xca71('0x2c')]?_0x361fcd[_0xca71('0x2c')]:undefined,'callbackat':_0x361fcd['callbackUniqueid']?moment()[_0xca71('0x1b')](_0xca71('0x1c')):undefined,'VoiceQueueId':_0x308426['id']})[_0xca71('0x2d')](_0x5436a6());});}}}})[_0xca71('0x21')](function(){return _0x54bd03[_0xca71('0x1f')]['findAll']({'where':{'type':_0xca71('0x38')},'attributes':['id'],'include':[{'model':_0x54bd03[_0xca71('0x3a')],'as':_0xca71('0x3e'),'where':{'id':_0x361fcd[_0xca71('0x33')]}}]})[_0xca71('0x21')](function(_0x51abfc){if(_0x51abfc){var _0x3119e4=[];for(var _0x3daf8b=0x0,_0x3133d0;_0x3daf8b<_0x51abfc['length'];_0x3daf8b+=0x1){_0x3133d0=_0x51abfc[_0x3daf8b]['get']({'plain':!![]});_0x54bd03[_0xca71('0x3f')][_0xca71('0x2a')]({'phone':_0x361fcd[_0xca71('0xb')],'ContactId':_0x361fcd['id'],'ListId':_0x361fcd[_0xca71('0x33')],'VoiceQueueId':_0x3133d0['id']})[_0xca71('0x2d')](function(_0x4c2cf3){logger[_0xca71('0x16')](_0xca71('0x40'),_0xca71('0x18'),_0x4c2cf3[_0xca71('0x41')]);});}}});})['then'](function(){return _0x54bd03[_0xca71('0x31')][_0xca71('0x37')]({'attributes':['id',_0xca71('0x39'),_0xca71('0x1e')],'include':[{'model':_0x54bd03['CmList'],'as':_0xca71('0x3b'),'where':{'id':_0x361fcd[_0xca71('0x33')]}}]})['then'](function(_0x1f80eb){if(_0x1f80eb){var _0x328a8e=[];for(var _0x48de29=0x0,_0x160839;_0x48de29<_0x1f80eb['length'];_0x48de29+=0x1){_0x160839=_0x1f80eb[_0x48de29]['get']({'plain':!![]});switch(_0x160839[_0xca71('0x39')]){case _0xca71('0x42'):_0x52c38d(_0x160839)[_0xca71('0x2d')](_0x3326b5());break;case _0xca71('0x3d'):_0xaf6c38(_0x160839)[_0xca71('0x2d')](_0x3326b5());break;default:_0x54bd03['CmHopper'][_0xca71('0x2a')]({'phone':_0x361fcd[_0xca71('0xb')],'ContactId':_0x361fcd['id'],'ListId':_0x361fcd['ListId'],'scheduledat':_0x361fcd[_0xca71('0x1a')]?_0x361fcd[_0xca71('0x1a')]:moment()[_0xca71('0x1b')](_0xca71('0x1c')),'priority':_0x361fcd[_0xca71('0x2b')]?_0x361fcd[_0xca71('0x2b')]:0x2,'callback':_0x361fcd[_0xca71('0x2c')]?!![]:![],'callbackuniqueid':_0x361fcd[_0xca71('0x2c')]?_0x361fcd[_0xca71('0x2c')]:undefined,'callbackat':_0x361fcd['callbackUniqueid']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x160839['id']})[_0xca71('0x2d')](_0x3326b5());}}}});})[_0xca71('0x21')](function(){return _0x54bd03['Campaign'][_0xca71('0x37')]({'attributes':['id'],'include':[{'model':_0x54bd03['CmList'],'as':'BlackLists','where':{'id':_0x361fcd[_0xca71('0x33')]}}]})[_0xca71('0x21')](function(_0xa6f2ba){if(_0xa6f2ba){var _0x283317=[];for(var _0x157006=0x0,_0x3b56de;_0x157006<_0xa6f2ba[_0xca71('0x3c')];_0x157006+=0x1){_0x3b56de=_0xa6f2ba[_0x157006][_0xca71('0x15')]({'plain':!![]});_0x54bd03[_0xca71('0x3f')][_0xca71('0x2a')]({'phone':_0x361fcd[_0xca71('0xb')],'ContactId':_0x361fcd['id'],'ListId':_0x361fcd[_0xca71('0x33')],'CampaignId':_0x3b56de['id']})['catch'](function(_0x1219ce){logger[_0xca71('0x16')](_0xca71('0x40'),_0xca71('0x18'),_0x1219ce[_0xca71('0x41')]);});}}});})['then'](function(){_0x72891c();})['catch'](function(_0x4c3f9e){logger[_0xca71('0x16')](_0xca71('0x40'),_0xca71('0x18'),_0x4c3f9e[_0xca71('0x41')]);_0x72891c(_0x4c3f9e);});}else{_0x72891c(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x416790,_0x5d6346,_0x45249b){var _0x5ee3f6=_0x4497ba[_0xca71('0x14')];var _0x55e63b=_0x416790[_0xca71('0x15')]({'plain':!![]});return _0x5ee3f6[_0xca71('0x29')][_0xca71('0x37')]({'raw':!![],'where':{'ListId':_0x55e63b['ListId'],'ContactId':_0x55e63b['id']}})['then'](function(_0x4566e9){if(!_[_0xca71('0x43')](_0x4566e9)){var _0x213166=[];for(var _0x418581=0x0;_0x418581<_0x4566e9[_0xca71('0x3c')];_0x418581+=0x1){var _0x48d762=_0x5ee3f6[_0xca71('0x29')]['destroy']({'where':{'ListId':_0x4566e9[_0x418581][_0xca71('0x33')],'ContactId':_0x4566e9[_0x418581]['ContactId'],'VoiceQueueId':_0x4566e9[_0x418581][_0xca71('0x44')],'CampaignId':_0x4566e9[_0x418581][_0xca71('0x45')]}});_0x213166[_0xca71('0x46')](_0x48d762);}return BPromise[_0xca71('0x47')](_0x213166);}})[_0xca71('0x21')](function(_0x5715e6){logger[_0xca71('0x48')](_0xca71('0x49'),util[_0xca71('0x19')](_0x5715e6,{'showHidden':![],'depth':null}));_0x45249b();})[_0xca71('0x2d')](function(_0x577273){logger[_0xca71('0x16')]('[CmContact][afterDestroy][Error]',util[_0xca71('0x19')](_0x577273,{'showHidden':![],'depth':null}));_0x45249b(_0x577273);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 88054dd..d49af58 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x3bfea6,_0x568e05){var _0x1cd4b9=function(_0x3fe6ba){while(--_0x3fe6ba){_0x3bfea6['push'](_0x3bfea6['shift']());}};_0x1cd4b9(++_0x568e05);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index f67e307..2786c5b 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 _0x44d4=['INTEGER','STRING','sequelize'];(function(_0x3b2385,_0x14fc2c){var _0x43d231=function(_0x357295){while(--_0x357295){_0x3b2385['push'](_0x3b2385['shift']());}};_0x43d231(++_0x14fc2c);}(_0x44d4,0x161));var _0x444d=function(_0x73029b,_0x3df32d){_0x73029b=_0x73029b-0x0;var _0x4ef368=_0x44d4[_0x73029b];return _0x4ef368;};'use strict';var Sequelize=require(_0x444d('0x0'));module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x444d('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x444d('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x3ee5=['STRING','PHONE','exports','INTEGER'];(function(_0x567cc7,_0x37e782){var _0x2764d2=function(_0x41a31f){while(--_0x41a31f){_0x567cc7['push'](_0x567cc7['shift']());}};_0x2764d2(++_0x37e782);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x38aec2,_0x132d90){_0x38aec2=_0x38aec2-0x0;var _0xcd4b0d=_0x3ee5[_0x38aec2];return _0xcd4b0d;};'use strict';var Sequelize=require('sequelize');module[_0x53ee('0x0')]={'CmContactId':{'type':Sequelize[_0x53ee('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x53ee('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x53ee('0x2')],'defaultValue':_0x53ee('0x3')},'OrderBy':{'type':Sequelize[_0x53ee('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x53ee('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 4cfe12f..6cf6972 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 _0x1b7d=['sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','CmContactHasItems','destroy','end','error','name','send','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','order','sort','where','pick','filters','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0x1b7d,0xec));var _0xd1b7=function(_0x34dcfb,_0x38a9a2){_0x34dcfb=_0x34dcfb-0x0;var _0x18337a=_0x1b7d[_0x34dcfb];return _0x18337a;};'use strict';var emlformat=require(_0xd1b7('0x0'));var rimraf=require(_0xd1b7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd1b7('0x2'));var rp=require(_0xd1b7('0x3'));var moment=require(_0xd1b7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd1b7('0x5'));var path=require(_0xd1b7('0x6'));var sox=require(_0xd1b7('0x7'));var csv=require(_0xd1b7('0x8'));var ejs=require(_0xd1b7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd1b7('0xa'));var crypto=require(_0xd1b7('0xb'));var jsforce=require(_0xd1b7('0xc'));var deskjs=require(_0xd1b7('0xd'));var toCsv=require(_0xd1b7('0x8'));var querystring=require(_0xd1b7('0xe'));var Papa=require(_0xd1b7('0xf'));var Redis=require(_0xd1b7('0x10'));var authService=require(_0xd1b7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd1b7('0x12'));var hardwareService=require(_0xd1b7('0x13'));var logger=require(_0xd1b7('0x14'))('api');var utils=require(_0xd1b7('0x15'));var config=require(_0xd1b7('0x16'));var licenseUtil=require(_0xd1b7('0x17'));var db=require(_0xd1b7('0x18'))['db'];function respondWithStatusCode(_0x989a94,_0x4716f1){_0x4716f1=_0x4716f1||0xcc;return function(_0x2fb201){if(_0x2fb201){return _0x989a94[_0xd1b7('0x19')](_0x4716f1);}return _0x989a94[_0xd1b7('0x1a')](_0x4716f1)['end']();};}function respondWithResult(_0x456c5b,_0x44dbfb){_0x44dbfb=_0x44dbfb||0xc8;return function(_0x7febc3){if(_0x7febc3){return _0x456c5b[_0xd1b7('0x1a')](_0x44dbfb)['json'](_0x7febc3);}};}function respondWithFilteredResult(_0x14fbf9,_0x40951f){return function(_0x5a6f80){if(_0x5a6f80){var _0x48e1d7=typeof _0x40951f[_0xd1b7('0x1b')]===_0xd1b7('0x1c')&&typeof _0x40951f[_0xd1b7('0x1d')]===_0xd1b7('0x1c');var _0x22febc=_0x5a6f80[_0xd1b7('0x1e')];var _0x570751=_0x48e1d7?0x0:_0x40951f[_0xd1b7('0x1b')];var _0x581a59=_0x48e1d7?_0x5a6f80[_0xd1b7('0x1e')]:_0x40951f[_0xd1b7('0x1b')]+_0x40951f[_0xd1b7('0x1d')];var _0x5a31f9;if(_0x581a59>=_0x22febc){_0x581a59=_0x22febc;_0x5a31f9=0xc8;}else{_0x5a31f9=0xce;}_0x14fbf9['status'](_0x5a31f9);return _0x14fbf9[_0xd1b7('0x1f')](_0xd1b7('0x20'),_0x570751+'-'+_0x581a59+'/'+_0x22febc)['json'](_0x5a6f80);}return null;};}function patchUpdates(_0x46361f){return function(_0x2ed65f){try{jsonpatch[_0xd1b7('0x21')](_0x2ed65f,_0x46361f,!![]);}catch(_0x198b8b){return BPromise[_0xd1b7('0x22')](_0x198b8b);}return _0x2ed65f[_0xd1b7('0x23')]();};}function saveUpdates(_0x1e41ab,_0x1d55d2){return function(_0x389bf8){if(_0x389bf8){return _0x389bf8[_0xd1b7('0x24')](_0x1e41ab)[_0xd1b7('0x25')](function(_0x4d6a93){return _0x4d6a93;});}return null;};}function removeEntity(_0x10909f,_0x1c6db8){return function(_0x6aecd3){if(_0x6aecd3){return _0x6aecd3['destroy']()['then'](function(){var _0x2d1d9e=_0x6aecd3[_0xd1b7('0x26')]({'plain':!![]});var _0x7b6e0f=_0xd1b7('0x27');return db['UserProfileResource'][_0xd1b7('0x28')]({'where':{'type':_0x7b6e0f,'resourceId':_0x2d1d9e['id']}})[_0xd1b7('0x25')](function(){return _0x6aecd3;});})[_0xd1b7('0x25')](function(){_0x10909f[_0xd1b7('0x1a')](0xcc)[_0xd1b7('0x29')]();});}};}function handleEntityNotFound(_0x4925cf,_0x15d908){return function(_0xf70bf9){if(!_0xf70bf9){_0x4925cf[_0xd1b7('0x19')](0x194);}return _0xf70bf9;};}function handleError(_0x48f50f,_0xc2e1c7){_0xc2e1c7=_0xc2e1c7||0x1f4;return function(_0x2fdfb9){logger[_0xd1b7('0x2a')](_0x2fdfb9['stack']);if(_0x2fdfb9[_0xd1b7('0x2b')]){delete _0x2fdfb9[_0xd1b7('0x2b')];}_0x48f50f[_0xd1b7('0x1a')](_0xc2e1c7)[_0xd1b7('0x2c')](_0x2fdfb9);};}exports['index']=function(_0x41f47f,_0x257e1c){var _0x504771={},_0x50543a={},_0x17fafc={'count':0x0,'rows':[]};var _0x15a654=_[_0xd1b7('0x2d')](db[_0xd1b7('0x2e')][_0xd1b7('0x2f')],function(_0x1c8d7b){return{'name':_0x1c8d7b[_0xd1b7('0x30')],'type':_0x1c8d7b[_0xd1b7('0x31')][_0xd1b7('0x32')]};});_0x50543a[_0xd1b7('0x33')]=_['map'](_0x15a654,_0xd1b7('0x2b'));_0x50543a[_0xd1b7('0x34')]=_[_0xd1b7('0x35')](_0x41f47f[_0xd1b7('0x34')]);_0x50543a['filters']=_[_0xd1b7('0x36')](_0x50543a['model'],_0x50543a[_0xd1b7('0x34')]);_0x504771['attributes']=_[_0xd1b7('0x36')](_0x50543a[_0xd1b7('0x33')],qs['fields'](_0x41f47f[_0xd1b7('0x34')][_0xd1b7('0x37')]));_0x504771['attributes']=_0x504771[_0xd1b7('0x38')][_0xd1b7('0x39')]?_0x504771[_0xd1b7('0x38')]:_0x50543a[_0xd1b7('0x33')];if(!_0x41f47f[_0xd1b7('0x34')]['hasOwnProperty']('nolimit')){_0x504771['limit']=qs['limit'](_0x41f47f['query'][_0xd1b7('0x1d')]);_0x504771[_0xd1b7('0x1b')]=qs[_0xd1b7('0x1b')](_0x41f47f[_0xd1b7('0x34')]['offset']);}_0x504771[_0xd1b7('0x3a')]=qs[_0xd1b7('0x3b')](_0x41f47f[_0xd1b7('0x34')][_0xd1b7('0x3b')]);_0x504771[_0xd1b7('0x3c')]=qs['filters'](_[_0xd1b7('0x3d')](_0x41f47f[_0xd1b7('0x34')],_0x50543a[_0xd1b7('0x3e')]),_0x15a654);if(_0x41f47f[_0xd1b7('0x34')]['filter']){_0x504771[_0xd1b7('0x3c')]=_[_0xd1b7('0x3f')](_0x504771[_0xd1b7('0x3c')],{'$or':_[_0xd1b7('0x2d')](_0x15a654,function(_0x2b6dd2){if(_0x2b6dd2[_0xd1b7('0x31')]!=='VIRTUAL'){var _0x47975d={};_0x47975d[_0x2b6dd2['name']]={'$like':'%'+_0x41f47f[_0xd1b7('0x34')]['filter']+'%'};return _0x47975d;}})});}_0x504771=_[_0xd1b7('0x3f')]({},_0x504771,_0x41f47f[_0xd1b7('0x40')]);var _0xcbe260={'where':_0x504771[_0xd1b7('0x3c')]};return db[_0xd1b7('0x2e')][_0xd1b7('0x1e')](_0xcbe260)[_0xd1b7('0x25')](function(_0x2d9a51){_0x17fafc[_0xd1b7('0x1e')]=_0x2d9a51;if(_0x41f47f[_0xd1b7('0x34')]['includeAll']){_0x504771[_0xd1b7('0x41')]=[{'all':!![]}];}return db[_0xd1b7('0x2e')][_0xd1b7('0x42')](_0x504771);})[_0xd1b7('0x25')](function(_0x417ba9){_0x17fafc[_0xd1b7('0x43')]=_0x417ba9;return _0x17fafc;})[_0xd1b7('0x25')](respondWithFilteredResult(_0x257e1c,_0x504771))[_0xd1b7('0x44')](handleError(_0x257e1c,null));};exports[_0xd1b7('0x45')]=function(_0x1c564a,_0x3b5314){var _0x28471f={'raw':!![],'where':{'id':_0x1c564a[_0xd1b7('0x46')]['id']}},_0x31592c={};_0x31592c[_0xd1b7('0x33')]=_[_0xd1b7('0x35')](db['CmContactHasItem']['rawAttributes']);_0x31592c[_0xd1b7('0x34')]=_[_0xd1b7('0x35')](_0x1c564a[_0xd1b7('0x34')]);_0x31592c[_0xd1b7('0x3e')]=_[_0xd1b7('0x36')](_0x31592c['model'],_0x31592c[_0xd1b7('0x34')]);_0x28471f[_0xd1b7('0x38')]=_[_0xd1b7('0x36')](_0x31592c['model'],qs[_0xd1b7('0x37')](_0x1c564a['query'][_0xd1b7('0x37')]));_0x28471f[_0xd1b7('0x38')]=_0x28471f[_0xd1b7('0x38')][_0xd1b7('0x39')]?_0x28471f[_0xd1b7('0x38')]:_0x31592c['model'];if(_0x1c564a[_0xd1b7('0x34')][_0xd1b7('0x47')]){_0x28471f['include']=[{'all':!![]}];}_0x28471f=_[_0xd1b7('0x3f')]({},_0x28471f,_0x1c564a[_0xd1b7('0x40')]);return db['CmContactHasItem'][_0xd1b7('0x48')](_0x28471f)[_0xd1b7('0x25')](handleEntityNotFound(_0x3b5314,null))['then'](respondWithResult(_0x3b5314,null))[_0xd1b7('0x44')](handleError(_0x3b5314,null));};exports['create']=function(_0x3e0c71,_0x50f114){return db['CmContactHasItem'][_0xd1b7('0x49')](_0x3e0c71[_0xd1b7('0x4a')],{})[_0xd1b7('0x25')](function(_0x391970){var _0x2c0b48=_0x3e0c71[_0xd1b7('0x4b')]['get']({'plain':!![]});if(!_0x2c0b48)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c0b48[_0xd1b7('0x4c')]===_0xd1b7('0x4b')){var _0x37f2f6=_0x391970[_0xd1b7('0x26')]({'plain':!![]});var _0x3efd2d=_0xd1b7('0x27');return db[_0xd1b7('0x4d')][_0xd1b7('0x48')]({'where':{'name':_0x3efd2d,'userProfileId':_0x2c0b48[_0xd1b7('0x4e')]},'raw':!![]})[_0xd1b7('0x25')](function(_0xc2a8e3){if(_0xc2a8e3&&_0xc2a8e3[_0xd1b7('0x4f')]===0x0){return db['UserProfileResource'][_0xd1b7('0x49')]({'name':_0x37f2f6[_0xd1b7('0x2b')],'resourceId':_0x37f2f6['id'],'type':_0xc2a8e3['name'],'sectionId':_0xc2a8e3['id']},{})[_0xd1b7('0x25')](function(){return _0x391970;});}else{return _0x391970;}})[_0xd1b7('0x44')](function(_0x3cf57e){logger['error'](_0xd1b7('0x50'),_0x3cf57e);throw _0x3cf57e;});}return _0x391970;})[_0xd1b7('0x25')](respondWithResult(_0x50f114,0xc9))['catch'](handleError(_0x50f114,null));};exports[_0xd1b7('0x24')]=function(_0x57bba2,_0x8ddcbd){if(_0x57bba2['body']['id']){delete _0x57bba2['body']['id'];}return db[_0xd1b7('0x2e')][_0xd1b7('0x48')]({'where':{'id':_0x57bba2[_0xd1b7('0x46')]['id']}})[_0xd1b7('0x25')](handleEntityNotFound(_0x8ddcbd,null))[_0xd1b7('0x25')](saveUpdates(_0x57bba2['body'],null))[_0xd1b7('0x25')](respondWithResult(_0x8ddcbd,null))['catch'](handleError(_0x8ddcbd,null));};exports[_0xd1b7('0x28')]=function(_0x14dd89,_0x1015d8){return db[_0xd1b7('0x2e')][_0xd1b7('0x48')]({'where':{'id':_0x14dd89[_0xd1b7('0x46')]['id']}})[_0xd1b7('0x25')](handleEntityNotFound(_0x1015d8,null))['then'](removeEntity(_0x1015d8,null))[_0xd1b7('0x44')](handleError(_0x1015d8,null));}; \ No newline at end of file +var _0x928e=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','CmContactHasItems','UserProfileResource','error','map','CmContactHasItem','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','include','rows','catch','params','rawAttributes','includeAll','options','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x928e,0xaa));var _0xe928=function(_0x19c67f,_0x2a500c){_0x19c67f=_0x19c67f-0x0;var _0xcda945=_0x928e[_0x19c67f];return _0xcda945;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe928('0x0'));var jsonpatch=require(_0xe928('0x1'));var rp=require(_0xe928('0x2'));var moment=require(_0xe928('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe928('0x4'));var util=require(_0xe928('0x5'));var path=require(_0xe928('0x6'));var sox=require(_0xe928('0x7'));var csv=require(_0xe928('0x8'));var ejs=require(_0xe928('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe928('0xa'));var squel=require(_0xe928('0xb'));var crypto=require(_0xe928('0xc'));var jsforce=require(_0xe928('0xd'));var deskjs=require(_0xe928('0xe'));var toCsv=require(_0xe928('0x8'));var querystring=require(_0xe928('0xf'));var Papa=require('papaparse');var Redis=require(_0xe928('0x10'));var authService=require(_0xe928('0x11'));var qs=require(_0xe928('0x12'));var as=require(_0xe928('0x13'));var hardwareService=require(_0xe928('0x14'));var logger=require('../../config/logger')(_0xe928('0x15'));var utils=require(_0xe928('0x16'));var config=require(_0xe928('0x17'));var licenseUtil=require(_0xe928('0x18'));var db=require(_0xe928('0x19'))['db'];function respondWithStatusCode(_0x551cdd,_0x33f378){_0x33f378=_0x33f378||0xcc;return function(_0x4d0948){if(_0x4d0948){return _0x551cdd[_0xe928('0x1a')](_0x33f378);}return _0x551cdd['status'](_0x33f378)[_0xe928('0x1b')]();};}function respondWithResult(_0x541c47,_0x2a6993){_0x2a6993=_0x2a6993||0xc8;return function(_0x1d52c0){if(_0x1d52c0){return _0x541c47[_0xe928('0x1c')](_0x2a6993)[_0xe928('0x1d')](_0x1d52c0);}};}function respondWithFilteredResult(_0x431552,_0x2df3e2){return function(_0x1abb2d){if(_0x1abb2d){var _0x47ac61=typeof _0x2df3e2[_0xe928('0x1e')]===_0xe928('0x1f')&&typeof _0x2df3e2['limit']===_0xe928('0x1f');var _0x3eda48=_0x1abb2d['count'];var _0x1f5bad=_0x47ac61?0x0:_0x2df3e2[_0xe928('0x1e')];var _0x4217d8=_0x47ac61?_0x1abb2d[_0xe928('0x20')]:_0x2df3e2[_0xe928('0x1e')]+_0x2df3e2[_0xe928('0x21')];var _0x2d7800;if(_0x4217d8>=_0x3eda48){_0x4217d8=_0x3eda48;_0x2d7800=0xc8;}else{_0x2d7800=0xce;}_0x431552['status'](_0x2d7800);return _0x431552[_0xe928('0x22')](_0xe928('0x23'),_0x1f5bad+'-'+_0x4217d8+'/'+_0x3eda48)[_0xe928('0x1d')](_0x1abb2d);}return null;};}function patchUpdates(_0x1b1ac2){return function(_0x14eac3){try{jsonpatch[_0xe928('0x24')](_0x14eac3,_0x1b1ac2,!![]);}catch(_0x2ea36b){return BPromise['reject'](_0x2ea36b);}return _0x14eac3[_0xe928('0x25')]();};}function saveUpdates(_0x3aed41,_0xd023a3){return function(_0xa78a5a){if(_0xa78a5a){return _0xa78a5a[_0xe928('0x26')](_0x3aed41)[_0xe928('0x27')](function(_0xd9dd48){return _0xd9dd48;});}return null;};}function removeEntity(_0x32c1d6,_0x48de5b){return function(_0x1a7081){if(_0x1a7081){return _0x1a7081[_0xe928('0x28')]()[_0xe928('0x27')](function(){var _0x10f455=_0x1a7081['get']({'plain':!![]});var _0x3112d3=_0xe928('0x29');return db[_0xe928('0x2a')][_0xe928('0x28')]({'where':{'type':_0x3112d3,'resourceId':_0x10f455['id']}})[_0xe928('0x27')](function(){return _0x1a7081;});})['then'](function(){_0x32c1d6[_0xe928('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cfd44,_0x149b1c){return function(_0x4c3274){if(!_0x4c3274){_0x3cfd44[_0xe928('0x1a')](0x194);}return _0x4c3274;};}function handleError(_0x4096a3,_0x1a0781){_0x1a0781=_0x1a0781||0x1f4;return function(_0x255b83){logger[_0xe928('0x2b')](_0x255b83['stack']);if(_0x255b83['name']){delete _0x255b83['name'];}_0x4096a3[_0xe928('0x1c')](_0x1a0781)['send'](_0x255b83);};}exports['index']=function(_0x1b6c62,_0x13e1dd){var _0xcaaef8={},_0xe06664={},_0x150d80={'count':0x0,'rows':[]};var _0x2300aa=_[_0xe928('0x2c')](db[_0xe928('0x2d')]['rawAttributes'],function(_0x3c4576){return{'name':_0x3c4576[_0xe928('0x2e')],'type':_0x3c4576[_0xe928('0x2f')][_0xe928('0x30')]};});_0xe06664[_0xe928('0x31')]=_['map'](_0x2300aa,_0xe928('0x32'));_0xe06664[_0xe928('0x33')]=_[_0xe928('0x34')](_0x1b6c62['query']);_0xe06664[_0xe928('0x35')]=_[_0xe928('0x36')](_0xe06664['model'],_0xe06664[_0xe928('0x33')]);_0xcaaef8['attributes']=_[_0xe928('0x36')](_0xe06664[_0xe928('0x31')],qs['fields'](_0x1b6c62[_0xe928('0x33')][_0xe928('0x37')]));_0xcaaef8['attributes']=_0xcaaef8[_0xe928('0x38')][_0xe928('0x39')]?_0xcaaef8[_0xe928('0x38')]:_0xe06664[_0xe928('0x31')];if(!_0x1b6c62[_0xe928('0x33')][_0xe928('0x3a')](_0xe928('0x3b'))){_0xcaaef8[_0xe928('0x21')]=qs[_0xe928('0x21')](_0x1b6c62[_0xe928('0x33')][_0xe928('0x21')]);_0xcaaef8[_0xe928('0x1e')]=qs['offset'](_0x1b6c62[_0xe928('0x33')][_0xe928('0x1e')]);}_0xcaaef8['order']=qs[_0xe928('0x3c')](_0x1b6c62[_0xe928('0x33')]['sort']);_0xcaaef8['where']=qs[_0xe928('0x35')](_[_0xe928('0x3d')](_0x1b6c62[_0xe928('0x33')],_0xe06664['filters']),_0x2300aa);if(_0x1b6c62[_0xe928('0x33')]['filter']){_0xcaaef8[_0xe928('0x3e')]=_[_0xe928('0x3f')](_0xcaaef8['where'],{'$or':_[_0xe928('0x2c')](_0x2300aa,function(_0x12ad3d){if(_0x12ad3d[_0xe928('0x2f')]!==_0xe928('0x40')){var _0x2d9b68={};_0x2d9b68[_0x12ad3d[_0xe928('0x32')]]={'$like':'%'+_0x1b6c62[_0xe928('0x33')][_0xe928('0x41')]+'%'};return _0x2d9b68;}})});}_0xcaaef8=_[_0xe928('0x3f')]({},_0xcaaef8,_0x1b6c62['options']);var _0x74c579={'where':_0xcaaef8['where']};return db[_0xe928('0x2d')][_0xe928('0x20')](_0x74c579)[_0xe928('0x27')](function(_0x536aee){_0x150d80[_0xe928('0x20')]=_0x536aee;if(_0x1b6c62[_0xe928('0x33')]['includeAll']){_0xcaaef8[_0xe928('0x42')]=[{'all':!![]}];}return db[_0xe928('0x2d')]['findAll'](_0xcaaef8);})[_0xe928('0x27')](function(_0x347f3b){_0x150d80[_0xe928('0x43')]=_0x347f3b;return _0x150d80;})[_0xe928('0x27')](respondWithFilteredResult(_0x13e1dd,_0xcaaef8))[_0xe928('0x44')](handleError(_0x13e1dd,null));};exports['show']=function(_0x5804c0,_0x22e6eb){var _0x497f7d={'raw':!![],'where':{'id':_0x5804c0[_0xe928('0x45')]['id']}},_0x1e78aa={};_0x1e78aa['model']=_[_0xe928('0x34')](db[_0xe928('0x2d')][_0xe928('0x46')]);_0x1e78aa[_0xe928('0x33')]=_[_0xe928('0x34')](_0x5804c0[_0xe928('0x33')]);_0x1e78aa[_0xe928('0x35')]=_[_0xe928('0x36')](_0x1e78aa[_0xe928('0x31')],_0x1e78aa[_0xe928('0x33')]);_0x497f7d[_0xe928('0x38')]=_[_0xe928('0x36')](_0x1e78aa['model'],qs[_0xe928('0x37')](_0x5804c0['query']['fields']));_0x497f7d['attributes']=_0x497f7d[_0xe928('0x38')][_0xe928('0x39')]?_0x497f7d[_0xe928('0x38')]:_0x1e78aa[_0xe928('0x31')];if(_0x5804c0[_0xe928('0x33')][_0xe928('0x47')]){_0x497f7d[_0xe928('0x42')]=[{'all':!![]}];}_0x497f7d=_['merge']({},_0x497f7d,_0x5804c0[_0xe928('0x48')]);return db[_0xe928('0x2d')][_0xe928('0x49')](_0x497f7d)[_0xe928('0x27')](handleEntityNotFound(_0x22e6eb,null))['then'](respondWithResult(_0x22e6eb,null))[_0xe928('0x44')](handleError(_0x22e6eb,null));};exports[_0xe928('0x4a')]=function(_0x5ba269,_0x142dc4){return db[_0xe928('0x2d')]['create'](_0x5ba269['body'],{})[_0xe928('0x27')](function(_0x1b263c){var _0x225abf=_0x5ba269['user'][_0xe928('0x4b')]({'plain':!![]});if(!_0x225abf)throw new Error(_0xe928('0x4c'));if(_0x225abf[_0xe928('0x4d')]===_0xe928('0x4e')){var _0xe992ae=_0x1b263c[_0xe928('0x4b')]({'plain':!![]});var _0x10dad7='CmContactHasItems';return db[_0xe928('0x4f')][_0xe928('0x49')]({'where':{'name':_0x10dad7,'userProfileId':_0x225abf[_0xe928('0x50')]},'raw':!![]})[_0xe928('0x27')](function(_0x33904d){if(_0x33904d&&_0x33904d[_0xe928('0x51')]===0x0){return db[_0xe928('0x2a')][_0xe928('0x4a')]({'name':_0xe992ae[_0xe928('0x32')],'resourceId':_0xe992ae['id'],'type':_0x33904d[_0xe928('0x32')],'sectionId':_0x33904d['id']},{})[_0xe928('0x27')](function(){return _0x1b263c;});}else{return _0x1b263c;}})[_0xe928('0x44')](function(_0x4e681d){logger[_0xe928('0x2b')](_0xe928('0x52'),_0x4e681d);throw _0x4e681d;});}return _0x1b263c;})[_0xe928('0x27')](respondWithResult(_0x142dc4,0xc9))[_0xe928('0x44')](handleError(_0x142dc4,null));};exports['update']=function(_0x1fda5b,_0x54fe8a){if(_0x1fda5b[_0xe928('0x53')]['id']){delete _0x1fda5b['body']['id'];}return db[_0xe928('0x2d')][_0xe928('0x49')]({'where':{'id':_0x1fda5b[_0xe928('0x45')]['id']}})[_0xe928('0x27')](handleEntityNotFound(_0x54fe8a,null))['then'](saveUpdates(_0x1fda5b[_0xe928('0x53')],null))[_0xe928('0x27')](respondWithResult(_0x54fe8a,null))[_0xe928('0x44')](handleError(_0x54fe8a,null));};exports[_0xe928('0x28')]=function(_0x25a34a,_0x466934){return db[_0xe928('0x2d')][_0xe928('0x49')]({'where':{'id':_0x25a34a[_0xe928('0x45')]['id']}})[_0xe928('0x27')](handleEntityNotFound(_0x466934,null))[_0xe928('0x27')](removeEntity(_0x466934,null))['catch'](handleError(_0x466934,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 6bf1646..e65a008 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 _0x43f7=['exports','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x39a2d6,_0x477459){var _0x23af66=function(_0x2eb95e){while(--_0x2eb95e){_0x39a2d6['push'](_0x39a2d6['shift']());}};_0x23af66(++_0x477459);}(_0x43f7,0x14d));var _0x743f=function(_0x480571,_0xa3f2cc){_0x480571=_0x480571-0x0;var _0x3adb22=_0x43f7[_0x480571];return _0x3adb22;};'use strict';var _=require(_0x743f('0x0'));var util=require('util');var logger=require(_0x743f('0x1'))(_0x743f('0x2'));var moment=require(_0x743f('0x3'));var BPromise=require('bluebird');var rp=require(_0x743f('0x4'));var fs=require('fs');var path=require(_0x743f('0x5'));var rimraf=require(_0x743f('0x6'));var config=require(_0x743f('0x7'));var attributes=require('./cmContactHasItem.attributes');module[_0x743f('0x8')]=function(_0x181417,_0x1a987b){return _0x181417['define'](_0x743f('0x9'),attributes,{'tableName':_0x743f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbddc=['../../config/logger','api','bluebird','path','rimraf','exports','define','cm_contact_has_items','lodash','util'];(function(_0x55ff21,_0x1540f0){var _0x4baf37=function(_0x51128b){while(--_0x51128b){_0x55ff21['push'](_0x55ff21['shift']());}};_0x4baf37(++_0x1540f0);}(_0xbddc,0x76));var _0xcbdd=function(_0x50e708,_0x2bd50e){_0x50e708=_0x50e708-0x0;var _0x226b7a=_0xbddc[_0x50e708];return _0x226b7a;};'use strict';var _=require(_0xcbdd('0x0'));var util=require(_0xcbdd('0x1'));var logger=require(_0xcbdd('0x2'))(_0xcbdd('0x3'));var moment=require('moment');var BPromise=require(_0xcbdd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcbdd('0x5'));var rimraf=require(_0xcbdd('0x6'));var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0xcbdd('0x7')]=function(_0x44901c,_0x49cecc){return _0x44901c[_0xcbdd('0x8')]('CmContactHasItem',attributes,{'tableName':_0xcbdd('0x9'),'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 0c4d76a..8cd9be9 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 _0x5505=['../../config/environment','jayson/promise','client','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5f0fdc,_0x1930ef){var _0x4edabb=function(_0x3c01b5){while(--_0x3c01b5){_0x5f0fdc['push'](_0x5f0fdc['shift']());}};_0x4edabb(++_0x1930ef);}(_0x5505,0x6a));var _0x5550=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5505[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x5550('0x0'));var util=require(_0x5550('0x1'));var moment=require(_0x5550('0x2'));var BPromise=require(_0x5550('0x3'));var rs=require(_0x5550('0x4'));var fs=require('fs');var Redis=require(_0x5550('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5550('0x6'));var logger=require(_0x5550('0x7'))(_0x5550('0x8'));var config=require(_0x5550('0x9'));var jayson=require(_0x5550('0xa'));var client=jayson[_0x5550('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d3054,_0x10c93e,_0x2ae44f){return new BPromise(function(_0x25e78f,_0x501464){return client[_0x5550('0xc')](_0x1d3054,_0x2ae44f)['then'](function(_0x78341){logger[_0x5550('0xd')](_0x5550('0xe'),_0x10c93e,_0x5550('0xf'));logger[_0x5550('0x10')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x10c93e,_0x5550('0xf'),JSON[_0x5550('0x11')](_0x78341));if(_0x78341[_0x5550('0x12')]){if(_0x78341[_0x5550('0x12')][_0x5550('0x13')]===0x1f4){logger[_0x5550('0x12')](_0x5550('0xe'),_0x10c93e,_0x78341[_0x5550('0x12')][_0x5550('0x14')]);return _0x501464(_0x78341[_0x5550('0x12')]['message']);}logger['error'](_0x5550('0xe'),_0x10c93e,_0x78341[_0x5550('0x12')][_0x5550('0x14')]);return _0x25e78f(_0x78341[_0x5550('0x12')][_0x5550('0x14')]);}else{logger[_0x5550('0xd')]('CmContactHasItem,\x20%s,\x20%s',_0x10c93e,'request\x20sent');_0x25e78f(_0x78341[_0x5550('0x15')][_0x5550('0x14')]);}})[_0x5550('0x16')](function(_0x2540e1){logger[_0x5550('0x12')](_0x5550('0xe'),_0x10c93e,_0x2540e1);_0x501464(_0x2540e1);});});} \ No newline at end of file +var _0x858f=['rpc','jayson/promise','client','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xa3bd17,_0x551cba){var _0x1742fa=function(_0x34accf){while(--_0x34accf){_0xa3bd17['push'](_0xa3bd17['shift']());}};_0x1742fa(++_0x551cba);}(_0x858f,0x100));var _0xf858=function(_0x87506e,_0x5680ec){_0x87506e=_0x87506e-0x0;var _0x5496a4=_0x858f[_0x87506e];return _0x5496a4;};'use strict';var _=require(_0xf858('0x0'));var util=require(_0xf858('0x1'));var moment=require(_0xf858('0x2'));var BPromise=require(_0xf858('0x3'));var rs=require(_0xf858('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf858('0x5'))['db'];var utils=require(_0xf858('0x6'));var logger=require(_0xf858('0x7'))(_0xf858('0x8'));var config=require('../../config/environment');var jayson=require(_0xf858('0x9'));var client=jayson[_0xf858('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x174e1c,_0x28a14a,_0x3b455e){return new BPromise(function(_0x58b758,_0x412f98){return client[_0xf858('0xb')](_0x174e1c,_0x3b455e)[_0xf858('0xc')](function(_0x4228f1){logger[_0xf858('0xd')](_0xf858('0xe'),_0x28a14a,_0xf858('0xf'));logger['debug'](_0xf858('0x10'),_0x28a14a,_0xf858('0xf'),JSON['stringify'](_0x4228f1));if(_0x4228f1['error']){if(_0x4228f1[_0xf858('0x11')][_0xf858('0x12')]===0x1f4){logger[_0xf858('0x11')](_0xf858('0xe'),_0x28a14a,_0x4228f1[_0xf858('0x11')][_0xf858('0x13')]);return _0x412f98(_0x4228f1['error'][_0xf858('0x13')]);}logger[_0xf858('0x11')](_0xf858('0xe'),_0x28a14a,_0x4228f1[_0xf858('0x11')]['message']);return _0x58b758(_0x4228f1[_0xf858('0x11')][_0xf858('0x13')]);}else{logger[_0xf858('0xd')](_0xf858('0xe'),_0x28a14a,_0xf858('0xf'));_0x58b758(_0x4228f1[_0xf858('0x14')]['message']);}})[_0xf858('0x15')](function(_0x4bbe9e){logger[_0xf858('0x11')](_0xf858('0xe'),_0x28a14a,_0x4bbe9e);_0x412f98(_0x4bbe9e);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index af3d979..593fb2c 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 _0x3d81=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy'];(function(_0x57fc2a,_0x14bbe5){var _0xa839b=function(_0x26572c){while(--_0x26572c){_0x57fc2a['push'](_0x57fc2a['shift']());}};_0xa839b(++_0x14bbe5);}(_0x3d81,0x1dc));var _0x13d8=function(_0x48b573,_0x2ad8e5){_0x48b573=_0x48b573-0x0;var _0x3167ee=_0x3d81[_0x48b573];return _0x3167ee;};'use strict';var multer=require(_0x13d8('0x0'));var util=require(_0x13d8('0x1'));var path=require(_0x13d8('0x2'));var timeout=require(_0x13d8('0x3'));var express=require('express');var router=express[_0x13d8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x13d8('0x5'));var interaction=require(_0x13d8('0x6'));var config=require('../../config/environment');var controller=require(_0x13d8('0x7'));router[_0x13d8('0x8')]('/',auth[_0x13d8('0x9')](),controller[_0x13d8('0xa')]);router[_0x13d8('0x8')](_0x13d8('0xb'),auth[_0x13d8('0x9')](),controller[_0x13d8('0xc')]);router[_0x13d8('0xd')]('/',auth[_0x13d8('0x9')](),controller[_0x13d8('0xe')]);router[_0x13d8('0xf')](_0x13d8('0xb'),auth['isAuthenticated'](),controller[_0x13d8('0x10')]);router['delete'](_0x13d8('0xb'),auth['isAuthenticated'](),controller[_0x13d8('0x11')]);module[_0x13d8('0x12')]=router; \ No newline at end of file +var _0x205c=['delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','index','get','/:id','show','post','create','update'];(function(_0x1adb5d,_0x1e36cc){var _0x3acc58=function(_0x30a5ac){while(--_0x30a5ac){_0x1adb5d['push'](_0x1adb5d['shift']());}};_0x3acc58(++_0x1e36cc);}(_0x205c,0x122));var _0xc205=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x205c[_0x36c5b0];return _0xf19333;};'use strict';var multer=require(_0xc205('0x0'));var util=require('util');var path=require(_0xc205('0x1'));var timeout=require(_0xc205('0x2'));var express=require(_0xc205('0x3'));var router=express[_0xc205('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc205('0x5'));var config=require(_0xc205('0x6'));var controller=require(_0xc205('0x7'));router['get']('/',auth[_0xc205('0x8')](),controller[_0xc205('0x9')]);router[_0xc205('0xa')](_0xc205('0xb'),auth[_0xc205('0x8')](),controller[_0xc205('0xc')]);router[_0xc205('0xd')]('/',auth['isAuthenticated'](),controller[_0xc205('0xe')]);router['put'](_0xc205('0xb'),auth[_0xc205('0x8')](),controller[_0xc205('0xf')]);router[_0xc205('0x10')]('/:id',auth[_0xc205('0x8')](),controller[_0xc205('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 70e7439..097950f 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 _0x0f0a=['VIRTUAL','getDataValue','STRING','setDataValue','alias','name','TEXT','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports'];(function(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0x0f0a,0xce));var _0xa0f0=function(_0x52ec13,_0xb520ab){_0x52ec13=_0x52ec13-0x0;var _0x4bf818=_0x0f0a[_0x52ec13];return _0x4bf818;};'use strict';var Sequelize=require(_0xa0f0('0x0'));var _=require(_0xa0f0('0x1'));module[_0xa0f0('0x2')]={'name':{'type':Sequelize[_0xa0f0('0x3')],'get':function(_0x14959b){return this[_0xa0f0('0x4')]('alias');}},'alias':{'type':Sequelize[_0xa0f0('0x5')],'allowNull':![],'set':function(_0x18fa83){this[_0xa0f0('0x6')](_0xa0f0('0x7'),_0x18fa83?_0x18fa83:this[_0xa0f0('0x4')](_0xa0f0('0x8')));}},'type':{'type':Sequelize[_0xa0f0('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xa0f0('0x9')]('long'),'get':function(){if(this['getDataValue'](_0xa0f0('0xa'))===_0xa0f0('0xb')){return JSON[_0xa0f0('0xc')](this[_0xa0f0('0x4')](_0xa0f0('0xd')));}else{return this[_0xa0f0('0x4')]('values');}},'set':function(_0xc6ce01){if(Array[_0xa0f0('0xe')](_0xc6ce01)){this[_0xa0f0('0x6')]('values',JSON[_0xa0f0('0xf')](_0xc6ce01));}else{this['setDataValue'](_0xa0f0('0xd'),_0xc6ce01);}}},'required':{'type':Sequelize[_0xa0f0('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa0f0('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xa0f0('0x11')](_0xa0f0('0x12'))}}; \ No newline at end of file +var _0x2980=['parse','values','isArray','stringify','BOOLEAN','ENUM','sequelize','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','long','type','select'];(function(_0x2f499b,_0x1b11ce){var _0x40621e=function(_0x13bcd5){while(--_0x13bcd5){_0x2f499b['push'](_0x2f499b['shift']());}};_0x40621e(++_0x1b11ce);}(_0x2980,0xf0));var _0x0298=function(_0x3cbd07,_0x599925){_0x3cbd07=_0x3cbd07-0x0;var _0x5a13f3=_0x2980[_0x3cbd07];return _0x5a13f3;};'use strict';var Sequelize=require(_0x0298('0x0'));var _=require('lodash');module[_0x0298('0x1')]={'name':{'type':Sequelize[_0x0298('0x2')],'get':function(_0x355d7e){return this[_0x0298('0x3')](_0x0298('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x54d3e8){this[_0x0298('0x5')]('alias',_0x54d3e8?_0x54d3e8:this[_0x0298('0x3')](_0x0298('0x6')));}},'type':{'type':Sequelize[_0x0298('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0x0298('0x8')](_0x0298('0x9')),'get':function(){if(this[_0x0298('0x3')](_0x0298('0xa'))===_0x0298('0xb')){return JSON[_0x0298('0xc')](this[_0x0298('0x3')]('values'));}else{return this['getDataValue'](_0x0298('0xd'));}},'set':function(_0x5b6f36){if(Array[_0x0298('0xe')](_0x5b6f36)){this[_0x0298('0x5')]('values',JSON[_0x0298('0xf')](_0x5b6f36));}else{this[_0x0298('0x5')](_0x0298('0xd'),_0x5b6f36);}}},'required':{'type':Sequelize[_0x0298('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x0298('0x11')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index ee31ff9..53ff50f 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 _0x2aa5=['../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','CmCustomField','rawAttributes','type','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x25f784,_0x3725e9){var _0x8ac986=function(_0xc000f9){while(--_0xc000f9){_0x25f784['push'](_0x25f784['shift']());}};_0x8ac986(++_0x3725e9);}(_0x2aa5,0x145));var _0x52aa=function(_0x400e1f,_0x2dc1ee){_0x400e1f=_0x400e1f-0x0;var _0x383a9b=_0x2aa5[_0x400e1f];return _0x383a9b;};'use strict';var emlformat=require(_0x52aa('0x0'));var rimraf=require(_0x52aa('0x1'));var zipdir=require(_0x52aa('0x2'));var jsonpatch=require(_0x52aa('0x3'));var rp=require(_0x52aa('0x4'));var moment=require(_0x52aa('0x5'));var BPromise=require(_0x52aa('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x52aa('0x7'));var sox=require(_0x52aa('0x8'));var csv=require(_0x52aa('0x9'));var ejs=require(_0x52aa('0xa'));var fs=require('fs');var fs_extra=require(_0x52aa('0xb'));var _=require(_0x52aa('0xc'));var squel=require(_0x52aa('0xd'));var crypto=require(_0x52aa('0xe'));var jsforce=require(_0x52aa('0xf'));var deskjs=require(_0x52aa('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x52aa('0x11'));var Redis=require(_0x52aa('0x12'));var authService=require(_0x52aa('0x13'));var qs=require(_0x52aa('0x14'));var as=require(_0x52aa('0x15'));var hardwareService=require(_0x52aa('0x16'));var logger=require(_0x52aa('0x17'))(_0x52aa('0x18'));var utils=require(_0x52aa('0x19'));var config=require(_0x52aa('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfb9ec5,_0x4a3d11){_0x4a3d11=_0x4a3d11||0xcc;return function(_0x3c1e10){if(_0x3c1e10){return _0xfb9ec5['sendStatus'](_0x4a3d11);}return _0xfb9ec5[_0x52aa('0x1b')](_0x4a3d11)[_0x52aa('0x1c')]();};}function respondWithResult(_0x2251bb,_0x137e22){_0x137e22=_0x137e22||0xc8;return function(_0x5fc744){if(_0x5fc744){return _0x2251bb['status'](_0x137e22)[_0x52aa('0x1d')](_0x5fc744);}};}function respondWithFilteredResult(_0x211521,_0x507a69){return function(_0x52d413){if(_0x52d413){var _0x4d5185=typeof _0x507a69[_0x52aa('0x1e')]===_0x52aa('0x1f')&&typeof _0x507a69[_0x52aa('0x20')]===_0x52aa('0x1f');var _0x364b26=_0x52d413[_0x52aa('0x21')];var _0x2f24c3=_0x4d5185?0x0:_0x507a69[_0x52aa('0x1e')];var _0xb9a192=_0x4d5185?_0x52d413[_0x52aa('0x21')]:_0x507a69['offset']+_0x507a69[_0x52aa('0x20')];var _0x5870ed;if(_0xb9a192>=_0x364b26){_0xb9a192=_0x364b26;_0x5870ed=0xc8;}else{_0x5870ed=0xce;}_0x211521['status'](_0x5870ed);return _0x211521['set'](_0x52aa('0x22'),_0x2f24c3+'-'+_0xb9a192+'/'+_0x364b26)[_0x52aa('0x1d')](_0x52d413);}return null;};}function patchUpdates(_0x1861bb){return function(_0x5effe4){try{jsonpatch[_0x52aa('0x23')](_0x5effe4,_0x1861bb,!![]);}catch(_0x34fdb4){return BPromise[_0x52aa('0x24')](_0x34fdb4);}return _0x5effe4[_0x52aa('0x25')]();};}function saveUpdates(_0x253f75,_0x2bd112){return function(_0x40603b){if(_0x40603b){return _0x40603b[_0x52aa('0x26')](_0x253f75)[_0x52aa('0x27')](function(_0x149c52){return _0x149c52;});}return null;};}function removeEntity(_0x1d3190,_0x799640){return function(_0x259c9a){if(_0x259c9a){return _0x259c9a[_0x52aa('0x28')]()[_0x52aa('0x27')](function(){_0x1d3190[_0x52aa('0x1b')](0xcc)[_0x52aa('0x1c')]();});}};}function handleEntityNotFound(_0x5a8ebd,_0x4d1e1e){return function(_0x45e524){if(!_0x45e524){_0x5a8ebd[_0x52aa('0x29')](0x194);}return _0x45e524;};}function handleError(_0x424b22,_0x1fd873){_0x1fd873=_0x1fd873||0x1f4;return function(_0x1f5de6){logger[_0x52aa('0x2a')](_0x1f5de6[_0x52aa('0x2b')]);if(_0x1f5de6[_0x52aa('0x2c')]){delete _0x1f5de6[_0x52aa('0x2c')];}_0x424b22[_0x52aa('0x1b')](_0x1fd873)[_0x52aa('0x2d')](_0x1f5de6);};}exports['index']=function(_0x309cc5,_0x51830b){var _0xb49d47={},_0x245ccf={},_0x1ad06f={'count':0x0,'rows':[]};var _0x1a6e8=_[_0x52aa('0x2e')](db[_0x52aa('0x2f')][_0x52aa('0x30')],function(_0x62735d){return{'name':_0x62735d['fieldName'],'type':_0x62735d[_0x52aa('0x31')][_0x52aa('0x32')]};});_0x245ccf['model']=_[_0x52aa('0x33')](_['map'](_0x1a6e8,_0x52aa('0x2c')),['name']);_0x245ccf[_0x52aa('0x34')]=_[_0x52aa('0x35')](_0x309cc5['query']);_0x245ccf[_0x52aa('0x36')]=_[_0x52aa('0x37')](_0x245ccf[_0x52aa('0x38')],_0x245ccf[_0x52aa('0x34')]);_0xb49d47[_0x52aa('0x39')]=_[_0x52aa('0x37')](_0x245ccf['model'],qs[_0x52aa('0x3a')](_0x309cc5[_0x52aa('0x34')][_0x52aa('0x3a')]));_0xb49d47[_0x52aa('0x39')]=_0xb49d47[_0x52aa('0x39')][_0x52aa('0x3b')]?_0xb49d47[_0x52aa('0x39')]:_0x245ccf[_0x52aa('0x38')];if(!_0x309cc5[_0x52aa('0x34')][_0x52aa('0x3c')](_0x52aa('0x3d'))){_0xb49d47[_0x52aa('0x20')]=qs[_0x52aa('0x20')](_0x309cc5[_0x52aa('0x34')][_0x52aa('0x20')]);_0xb49d47[_0x52aa('0x1e')]=qs[_0x52aa('0x1e')](_0x309cc5[_0x52aa('0x34')][_0x52aa('0x1e')]);}_0xb49d47['order']=qs[_0x52aa('0x3e')](_0x309cc5[_0x52aa('0x34')]['sort']);_0xb49d47[_0x52aa('0x3f')]=qs[_0x52aa('0x36')](_[_0x52aa('0x40')](_0x309cc5['query'],_0x245ccf[_0x52aa('0x36')]),_0x1a6e8);if(_0x309cc5[_0x52aa('0x34')][_0x52aa('0x41')]){_0xb49d47[_0x52aa('0x3f')]=_[_0x52aa('0x42')](_0xb49d47['where'],{'$or':_[_0x52aa('0x2e')](_0x1a6e8,function(_0x57fe5d){if(_0x57fe5d[_0x52aa('0x31')]!==_0x52aa('0x43')){var _0x848873={};_0x848873[_0x57fe5d[_0x52aa('0x2c')]]={'$like':'%'+_0x309cc5[_0x52aa('0x34')][_0x52aa('0x41')]+'%'};return _0x848873;}})});}_0xb49d47=_[_0x52aa('0x42')]({},_0xb49d47,_0x309cc5['options']);var _0x21e4db={'where':_0xb49d47[_0x52aa('0x3f')]};return db['CmCustomField']['count'](_0x21e4db)[_0x52aa('0x27')](function(_0x28efe4){_0x1ad06f[_0x52aa('0x21')]=_0x28efe4;if(_0x309cc5['query'][_0x52aa('0x44')]){_0xb49d47[_0x52aa('0x45')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0xb49d47);})[_0x52aa('0x27')](function(_0x2e843a){_0x1ad06f[_0x52aa('0x46')]=_0x2e843a;return _0x1ad06f;})[_0x52aa('0x27')](respondWithFilteredResult(_0x51830b,_0xb49d47))[_0x52aa('0x47')](handleError(_0x51830b,null));};exports['show']=function(_0x562ddf,_0x22136e){var _0x11795={'raw':!![],'where':{'id':_0x562ddf[_0x52aa('0x48')]['id']}},_0x6d77fb={};_0x6d77fb[_0x52aa('0x38')]=_[_0x52aa('0x35')](db['CmCustomField'][_0x52aa('0x30')]);_0x6d77fb[_0x52aa('0x34')]=_['keys'](_0x562ddf[_0x52aa('0x34')]);_0x6d77fb[_0x52aa('0x36')]=_[_0x52aa('0x37')](_0x6d77fb[_0x52aa('0x38')],_0x6d77fb[_0x52aa('0x34')]);_0x11795['attributes']=_[_0x52aa('0x37')](_0x6d77fb[_0x52aa('0x38')],qs[_0x52aa('0x3a')](_0x562ddf[_0x52aa('0x34')][_0x52aa('0x3a')]));_0x11795[_0x52aa('0x39')]=_0x11795['attributes'][_0x52aa('0x3b')]?_0x11795[_0x52aa('0x39')]:_0x6d77fb['model'];if(_0x562ddf[_0x52aa('0x34')]['includeAll']){_0x11795[_0x52aa('0x45')]=[{'all':!![]}];}_0x11795=_[_0x52aa('0x42')]({},_0x11795,_0x562ddf['options']);return db[_0x52aa('0x2f')][_0x52aa('0x49')](_0x11795)['then'](handleEntityNotFound(_0x22136e,null))[_0x52aa('0x27')](respondWithResult(_0x22136e,null))[_0x52aa('0x47')](handleError(_0x22136e,null));};exports[_0x52aa('0x26')]=function(_0x4975fe,_0x35b7b1){if(_0x4975fe['body']['id']){delete _0x4975fe[_0x52aa('0x4a')]['id'];}return db[_0x52aa('0x2f')]['find']({'where':{'id':_0x4975fe[_0x52aa('0x48')]['id']}})[_0x52aa('0x27')](handleEntityNotFound(_0x35b7b1,null))[_0x52aa('0x27')](saveUpdates(_0x4975fe[_0x52aa('0x4a')],null))[_0x52aa('0x27')](respondWithResult(_0x35b7b1,null))[_0x52aa('0x47')](handleError(_0x35b7b1,null));};exports[_0x52aa('0x28')]=function(_0x3f635a,_0xdba8ef){return db['CmCustomField'][_0x52aa('0x49')]({'where':{'id':_0x3f635a[_0x52aa('0x48')]['id']}})['then'](handleEntityNotFound(_0xdba8ef,null))[_0x52aa('0x27')](removeEntity(_0xdba8ef,null))[_0x52aa('0x47')](handleError(_0xdba8ef,null));};exports[_0x52aa('0x4b')]=function(_0x136e14,_0x181647){var _0x4a10b4;return db[_0x52aa('0x4c')][_0x52aa('0x4d')](function(_0x56363f){return db['CmCustomField'][_0x52aa('0x4b')](_0x136e14['body'],{'transaction':_0x56363f})[_0x52aa('0x27')](function(_0x1bf74b){_0x4a10b4=_0x1bf74b;var _0x1de25d={'type':db[_0x52aa('0x4e')][_0x52aa('0x4f')],'transaction':_0x56363f};switch(_0x136e14[_0x52aa('0x4a')][_0x52aa('0x31')]){case _0x52aa('0x50'):_0x1de25d['type']=db['Sequelize'][_0x52aa('0x4f')];break;case _0x52aa('0x51'):_0x1de25d[_0x52aa('0x31')]=db[_0x52aa('0x4e')][_0x52aa('0x52')];break;case'switch':_0x1de25d['type']=db[_0x52aa('0x4e')][_0x52aa('0x53')];_0x1de25d['defaultValue']=![];break;default:}return db[_0x52aa('0x4c')]['queryInterface'][_0x52aa('0x54')]('cm_contacts',util[_0x52aa('0x55')](_0x52aa('0x56'),_0x4a10b4['id']),_0x1de25d);})['then'](function(){return _0x4a10b4;});})['then'](respondWithResult(_0x181647,0xc9))['catch'](handleError(_0x181647,null));}; \ No newline at end of file +var _0x354e=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','set','reject','save','update','then','destroy','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','key','differenceBy','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','where','pick','type','filter','merge','options','count','includeAll','findAll','rows','catch','show','params','keys','body','find','create','sequelize','transaction','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','cm_contacts','format','cf_%d','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x53a3cb,_0x18a0e2){var _0x3b298a=function(_0x861f25){while(--_0x861f25){_0x53a3cb['push'](_0x53a3cb['shift']());}};_0x3b298a(++_0x18a0e2);}(_0x354e,0xea));var _0xe354=function(_0x21922a,_0x241d1b){_0x21922a=_0x21922a-0x0;var _0xfd010e=_0x354e[_0x21922a];return _0xfd010e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe354('0x0'));var zipdir=require(_0xe354('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe354('0x2'));var moment=require(_0xe354('0x3'));var BPromise=require(_0xe354('0x4'));var Mustache=require(_0xe354('0x5'));var util=require(_0xe354('0x6'));var path=require(_0xe354('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe354('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe354('0x9'));var squel=require(_0xe354('0xa'));var crypto=require(_0xe354('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe354('0xc'));var querystring=require(_0xe354('0xd'));var Papa=require(_0xe354('0xe'));var Redis=require(_0xe354('0xf'));var authService=require(_0xe354('0x10'));var qs=require(_0xe354('0x11'));var as=require(_0xe354('0x12'));var hardwareService=require(_0xe354('0x13'));var logger=require('../../config/logger')(_0xe354('0x14'));var utils=require(_0xe354('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe354('0x16'));var db=require(_0xe354('0x17'))['db'];function respondWithStatusCode(_0x31c86f,_0x33d3b8){_0x33d3b8=_0x33d3b8||0xcc;return function(_0x426a32){if(_0x426a32){return _0x31c86f['sendStatus'](_0x33d3b8);}return _0x31c86f[_0xe354('0x18')](_0x33d3b8)[_0xe354('0x19')]();};}function respondWithResult(_0x1efecf,_0x333e0b){_0x333e0b=_0x333e0b||0xc8;return function(_0x310f3e){if(_0x310f3e){return _0x1efecf[_0xe354('0x18')](_0x333e0b)[_0xe354('0x1a')](_0x310f3e);}};}function respondWithFilteredResult(_0x4d9485,_0x2c5c6c){return function(_0x11f055){if(_0x11f055){var _0x2a1557=typeof _0x2c5c6c[_0xe354('0x1b')]==='undefined'&&typeof _0x2c5c6c[_0xe354('0x1c')]===_0xe354('0x1d');var _0x1b25e4=_0x11f055['count'];var _0x543c83=_0x2a1557?0x0:_0x2c5c6c[_0xe354('0x1b')];var _0x551776=_0x2a1557?_0x11f055['count']:_0x2c5c6c[_0xe354('0x1b')]+_0x2c5c6c[_0xe354('0x1c')];var _0x527f64;if(_0x551776>=_0x1b25e4){_0x551776=_0x1b25e4;_0x527f64=0xc8;}else{_0x527f64=0xce;}_0x4d9485[_0xe354('0x18')](_0x527f64);return _0x4d9485[_0xe354('0x1e')]('Content-Range',_0x543c83+'-'+_0x551776+'/'+_0x1b25e4)[_0xe354('0x1a')](_0x11f055);}return null;};}function patchUpdates(_0x1bee06){return function(_0xb09393){try{jsonpatch['apply'](_0xb09393,_0x1bee06,!![]);}catch(_0x49a24e){return BPromise[_0xe354('0x1f')](_0x49a24e);}return _0xb09393[_0xe354('0x20')]();};}function saveUpdates(_0x1455eb,_0x127077){return function(_0x194db2){if(_0x194db2){return _0x194db2[_0xe354('0x21')](_0x1455eb)[_0xe354('0x22')](function(_0x928ead){return _0x928ead;});}return null;};}function removeEntity(_0x54da34,_0x409367){return function(_0x2bcda5){if(_0x2bcda5){return _0x2bcda5[_0xe354('0x23')]()[_0xe354('0x22')](function(){_0x54da34['status'](0xcc)[_0xe354('0x19')]();});}};}function handleEntityNotFound(_0x33f7fd,_0x4fc3fd){return function(_0x533161){if(!_0x533161){_0x33f7fd['sendStatus'](0x194);}return _0x533161;};}function handleError(_0x472d9c,_0x309651){_0x309651=_0x309651||0x1f4;return function(_0x863f6){logger['error'](_0x863f6[_0xe354('0x24')]);if(_0x863f6[_0xe354('0x25')]){delete _0x863f6['name'];}_0x472d9c['status'](_0x309651)[_0xe354('0x26')](_0x863f6);};}exports[_0xe354('0x27')]=function(_0xcfa69b,_0x4003bb){var _0x36cc74={},_0xc8f0c1={},_0x1b0020={'count':0x0,'rows':[]};var _0x2d474d=_[_0xe354('0x28')](db[_0xe354('0x29')][_0xe354('0x2a')],function(_0x4384a7){return{'name':_0x4384a7[_0xe354('0x2b')],'type':_0x4384a7['type'][_0xe354('0x2c')]};});_0xc8f0c1['model']=_[_0xe354('0x2d')](_['map'](_0x2d474d,_0xe354('0x25')),[_0xe354('0x25')]);_0xc8f0c1[_0xe354('0x2e')]=_['keys'](_0xcfa69b[_0xe354('0x2e')]);_0xc8f0c1[_0xe354('0x2f')]=_[_0xe354('0x30')](_0xc8f0c1[_0xe354('0x31')],_0xc8f0c1[_0xe354('0x2e')]);_0x36cc74['attributes']=_[_0xe354('0x30')](_0xc8f0c1[_0xe354('0x31')],qs[_0xe354('0x32')](_0xcfa69b[_0xe354('0x2e')]['fields']));_0x36cc74[_0xe354('0x33')]=_0x36cc74['attributes'][_0xe354('0x34')]?_0x36cc74['attributes']:_0xc8f0c1[_0xe354('0x31')];if(!_0xcfa69b[_0xe354('0x2e')][_0xe354('0x35')]('nolimit')){_0x36cc74['limit']=qs[_0xe354('0x1c')](_0xcfa69b[_0xe354('0x2e')]['limit']);_0x36cc74[_0xe354('0x1b')]=qs[_0xe354('0x1b')](_0xcfa69b[_0xe354('0x2e')][_0xe354('0x1b')]);}_0x36cc74['order']=qs['sort'](_0xcfa69b[_0xe354('0x2e')]['sort']);_0x36cc74[_0xe354('0x36')]=qs[_0xe354('0x2f')](_[_0xe354('0x37')](_0xcfa69b[_0xe354('0x2e')],_0xc8f0c1['filters']),_0x2d474d);if(_0xcfa69b[_0xe354('0x2e')]['filter']){_0x36cc74[_0xe354('0x36')]=_['merge'](_0x36cc74[_0xe354('0x36')],{'$or':_['map'](_0x2d474d,function(_0x42c1ca){if(_0x42c1ca[_0xe354('0x38')]!=='VIRTUAL'){var _0x54e02c={};_0x54e02c[_0x42c1ca[_0xe354('0x25')]]={'$like':'%'+_0xcfa69b['query'][_0xe354('0x39')]+'%'};return _0x54e02c;}})});}_0x36cc74=_[_0xe354('0x3a')]({},_0x36cc74,_0xcfa69b[_0xe354('0x3b')]);var _0xe6875e={'where':_0x36cc74[_0xe354('0x36')]};return db[_0xe354('0x29')][_0xe354('0x3c')](_0xe6875e)['then'](function(_0x3d25bb){_0x1b0020[_0xe354('0x3c')]=_0x3d25bb;if(_0xcfa69b[_0xe354('0x2e')][_0xe354('0x3d')]){_0x36cc74['include']=[{'all':!![]}];}return db[_0xe354('0x29')][_0xe354('0x3e')](_0x36cc74);})[_0xe354('0x22')](function(_0x127b6f){_0x1b0020[_0xe354('0x3f')]=_0x127b6f;return _0x1b0020;})[_0xe354('0x22')](respondWithFilteredResult(_0x4003bb,_0x36cc74))[_0xe354('0x40')](handleError(_0x4003bb,null));};exports[_0xe354('0x41')]=function(_0x3ead32,_0x2730ea){var _0x20856a={'raw':!![],'where':{'id':_0x3ead32[_0xe354('0x42')]['id']}},_0xfc7d47={};_0xfc7d47[_0xe354('0x31')]=_[_0xe354('0x43')](db[_0xe354('0x29')][_0xe354('0x2a')]);_0xfc7d47[_0xe354('0x2e')]=_[_0xe354('0x43')](_0x3ead32[_0xe354('0x2e')]);_0xfc7d47[_0xe354('0x2f')]=_['intersection'](_0xfc7d47[_0xe354('0x31')],_0xfc7d47['query']);_0x20856a[_0xe354('0x33')]=_['intersection'](_0xfc7d47[_0xe354('0x31')],qs[_0xe354('0x32')](_0x3ead32['query'][_0xe354('0x32')]));_0x20856a[_0xe354('0x33')]=_0x20856a[_0xe354('0x33')]['length']?_0x20856a[_0xe354('0x33')]:_0xfc7d47[_0xe354('0x31')];if(_0x3ead32[_0xe354('0x2e')][_0xe354('0x3d')]){_0x20856a['include']=[{'all':!![]}];}_0x20856a=_[_0xe354('0x3a')]({},_0x20856a,_0x3ead32[_0xe354('0x3b')]);return db[_0xe354('0x29')]['find'](_0x20856a)[_0xe354('0x22')](handleEntityNotFound(_0x2730ea,null))['then'](respondWithResult(_0x2730ea,null))[_0xe354('0x40')](handleError(_0x2730ea,null));};exports[_0xe354('0x21')]=function(_0x149f16,_0x4ea3ea){if(_0x149f16[_0xe354('0x44')]['id']){delete _0x149f16[_0xe354('0x44')]['id'];}return db[_0xe354('0x29')][_0xe354('0x45')]({'where':{'id':_0x149f16['params']['id']}})['then'](handleEntityNotFound(_0x4ea3ea,null))[_0xe354('0x22')](saveUpdates(_0x149f16[_0xe354('0x44')],null))[_0xe354('0x22')](respondWithResult(_0x4ea3ea,null))[_0xe354('0x40')](handleError(_0x4ea3ea,null));};exports[_0xe354('0x23')]=function(_0x343108,_0x3e35b8){return db[_0xe354('0x29')][_0xe354('0x45')]({'where':{'id':_0x343108['params']['id']}})[_0xe354('0x22')](handleEntityNotFound(_0x3e35b8,null))[_0xe354('0x22')](removeEntity(_0x3e35b8,null))[_0xe354('0x40')](handleError(_0x3e35b8,null));};exports[_0xe354('0x46')]=function(_0x1fe15c,_0x1c30d2){var _0x12d143;return db[_0xe354('0x47')][_0xe354('0x48')](function(_0x579cf3){return db[_0xe354('0x29')][_0xe354('0x46')](_0x1fe15c['body'],{'transaction':_0x579cf3})['then'](function(_0x41cd72){_0x12d143=_0x41cd72;var _0x1a8746={'type':db['Sequelize'][_0xe354('0x49')],'transaction':_0x579cf3};switch(_0x1fe15c[_0xe354('0x44')][_0xe354('0x38')]){case _0xe354('0x4a'):_0x1a8746['type']=db[_0xe354('0x4b')]['TEXT'];break;case _0xe354('0x4c'):_0x1a8746[_0xe354('0x38')]=db[_0xe354('0x4b')][_0xe354('0x4d')];break;case _0xe354('0x4e'):_0x1a8746[_0xe354('0x38')]=db[_0xe354('0x4b')][_0xe354('0x4f')];_0x1a8746[_0xe354('0x50')]=![];break;default:}return db[_0xe354('0x47')]['queryInterface']['addColumn'](_0xe354('0x51'),util[_0xe354('0x52')](_0xe354('0x53'),_0x12d143['id']),_0x1a8746);})[_0xe354('0x22')](function(){return _0x12d143;});})[_0xe354('0x22')](respondWithResult(_0x1c30d2,0xc9))['catch'](handleError(_0x1c30d2,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index e54373f..d96d9ee 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 _0xdac6=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util'];(function(_0x2d69e1,_0x43f881){var _0x9b5140=function(_0x374b86){while(--_0x374b86){_0x2d69e1['push'](_0x2d69e1['shift']());}};_0x9b5140(++_0x43f881);}(_0xdac6,0x1ea));var _0x6dac=function(_0xf4b775,_0x3e0218){_0xf4b775=_0xf4b775-0x0;var _0x156259=_0xdac6[_0xf4b775];return _0x156259;};'use strict';var _=require(_0x6dac('0x0'));var util=require(_0x6dac('0x1'));var logger=require(_0x6dac('0x2'))('api');var moment=require(_0x6dac('0x3'));var BPromise=require(_0x6dac('0x4'));var rp=require(_0x6dac('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6dac('0x6'));var attributes=require(_0x6dac('0x7'));module[_0x6dac('0x8')]=function(_0x4b9b65,_0x393e6b){return _0x4b9b65[_0x6dac('0x9')](_0x6dac('0xa'),attributes,{'tableName':_0x6dac('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf32b=['CmCustomField','cm_custom_fields','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x598dd2,_0x446543){var _0x312d70=function(_0x5aba66){while(--_0x5aba66){_0x598dd2['push'](_0x598dd2['shift']());}};_0x312d70(++_0x446543);}(_0xf32b,0x70));var _0xbf32=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf32b[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0xbf32('0x0'));var logger=require('../../config/logger')(_0xbf32('0x1'));var moment=require(_0xbf32('0x2'));var BPromise=require(_0xbf32('0x3'));var rp=require(_0xbf32('0x4'));var fs=require('fs');var path=require(_0xbf32('0x5'));var rimraf=require(_0xbf32('0x6'));var config=require(_0xbf32('0x7'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x36169d,_0x1cb2e8){return _0x36169d['define'](_0xbf32('0x8'),attributes,{'tableName':_0xbf32('0x9'),'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 a3deba8..f1c9023 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 _0xd9bc=['moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x8eb090,_0x49ed8c){var _0xe565d9=function(_0x2d5590){while(--_0x2d5590){_0x8eb090['push'](_0x8eb090['shift']());}};_0xe565d9(++_0x49ed8c);}(_0xd9bc,0x1a3));var _0xcd9b=function(_0x11beb9,_0x1c040d){_0x11beb9=_0x11beb9-0x0;var _0x11d428=_0xd9bc[_0x11beb9];return _0x11d428;};'use strict';var _=require(_0xcd9b('0x0'));var util=require('util');var moment=require(_0xcd9b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd9b('0x2'))['db'];var utils=require(_0xcd9b('0x3'));var logger=require(_0xcd9b('0x4'))('rpc');var config=require(_0xcd9b('0x5'));var jayson=require(_0xcd9b('0x6'));var client=jayson[_0xcd9b('0x7')][_0xcd9b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56cad8,_0xcb5bec,_0x14908d){return new BPromise(function(_0x13d98c,_0x552405){return client[_0xcd9b('0x9')](_0x56cad8,_0x14908d)[_0xcd9b('0xa')](function(_0x447140){logger[_0xcd9b('0xb')](_0xcd9b('0xc'),_0xcb5bec,_0xcd9b('0xd'));logger['debug'](_0xcd9b('0xe'),_0xcb5bec,_0xcd9b('0xd'),JSON[_0xcd9b('0xf')](_0x447140));if(_0x447140[_0xcd9b('0x10')]){if(_0x447140[_0xcd9b('0x10')][_0xcd9b('0x11')]===0x1f4){logger[_0xcd9b('0x10')]('CmCustomField,\x20%s,\x20%s',_0xcb5bec,_0x447140['error'][_0xcd9b('0x12')]);return _0x552405(_0x447140[_0xcd9b('0x10')][_0xcd9b('0x12')]);}logger['error'](_0xcd9b('0xc'),_0xcb5bec,_0x447140[_0xcd9b('0x10')][_0xcd9b('0x12')]);return _0x13d98c(_0x447140['error'][_0xcd9b('0x12')]);}else{logger[_0xcd9b('0xb')]('CmCustomField,\x20%s,\x20%s',_0xcb5bec,'request\x20sent');_0x13d98c(_0x447140[_0xcd9b('0x13')]['message']);}})[_0xcd9b('0x14')](function(_0x3aaf8f){logger[_0xcd9b('0x10')](_0xcd9b('0xc'),_0xcb5bec,_0x3aaf8f);_0x552405(_0x3aaf8f);});});} \ No newline at end of file +var _0xa45b=['request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2dbfb1,_0x4f4321){var _0x3bccc2=function(_0x202026){while(--_0x202026){_0x2dbfb1['push'](_0x2dbfb1['shift']());}};_0x3bccc2(++_0x4f4321);}(_0xa45b,0xef));var _0xba45=function(_0x3313d5,_0x4a1d9d){_0x3313d5=_0x3313d5-0x0;var _0x3a7b66=_0xa45b[_0x3313d5];return _0x3a7b66;};'use strict';var _=require(_0xba45('0x0'));var util=require(_0xba45('0x1'));var moment=require(_0xba45('0x2'));var BPromise=require(_0xba45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba45('0x4'));var db=require(_0xba45('0x5'))['db'];var utils=require(_0xba45('0x6'));var logger=require(_0xba45('0x7'))(_0xba45('0x8'));var config=require(_0xba45('0x9'));var jayson=require(_0xba45('0xa'));var client=jayson[_0xba45('0xb')][_0xba45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x277c1a,_0x16e3a2,_0x24c4ca){return new BPromise(function(_0xed0214,_0x24ea92){return client[_0xba45('0xd')](_0x277c1a,_0x24c4ca)['then'](function(_0x50f88d){logger['info']('CmCustomField,\x20%s,\x20%s',_0x16e3a2,_0xba45('0xe'));logger[_0xba45('0xf')](_0xba45('0x10'),_0x16e3a2,_0xba45('0xe'),JSON[_0xba45('0x11')](_0x50f88d));if(_0x50f88d[_0xba45('0x12')]){if(_0x50f88d[_0xba45('0x12')][_0xba45('0x13')]===0x1f4){logger[_0xba45('0x12')](_0xba45('0x14'),_0x16e3a2,_0x50f88d[_0xba45('0x12')]['message']);return _0x24ea92(_0x50f88d[_0xba45('0x12')][_0xba45('0x15')]);}logger[_0xba45('0x12')](_0xba45('0x14'),_0x16e3a2,_0x50f88d['error'][_0xba45('0x15')]);return _0xed0214(_0x50f88d['error'][_0xba45('0x15')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x16e3a2,_0xba45('0xe'));_0xed0214(_0x50f88d['result'][_0xba45('0x15')]);}})[_0xba45('0x16')](function(_0x2bdd42){logger[_0xba45('0x12')](_0xba45('0x14'),_0x16e3a2,_0x2bdd42);_0x24ea92(_0x2bdd42);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 4a103d7..f1de6f3 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 _0xcc34=['./cmCustomField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4c26ef,_0x277f06){var _0x2ca700=function(_0x139883){while(--_0x139883){_0x4c26ef['push'](_0x4c26ef['shift']());}};_0x2ca700(++_0x277f06);}(_0xcc34,0x7e));var _0x4cc3=function(_0x4eb90c,_0x538fd4){_0x4eb90c=_0x4eb90c-0x0;var _0x4a6ede=_0xcc34[_0x4eb90c];return _0x4a6ede;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4cc3('0x0'));var timeout=require('connect-timeout');var express=require(_0x4cc3('0x1'));var router=express[_0x4cc3('0x2')]();var fs_extra=require(_0x4cc3('0x3'));var auth=require(_0x4cc3('0x4'));var interaction=require(_0x4cc3('0x5'));var config=require(_0x4cc3('0x6'));var controller=require(_0x4cc3('0x7'));router[_0x4cc3('0x8')]('/',auth[_0x4cc3('0x9')](),controller[_0x4cc3('0xa')]);router['get'](_0x4cc3('0xb'),auth[_0x4cc3('0x9')](),controller[_0x4cc3('0xc')]);router['post']('/',auth[_0x4cc3('0x9')](),controller[_0x4cc3('0xd')]);router[_0x4cc3('0xe')]('/:id',auth[_0x4cc3('0x9')](),controller[_0x4cc3('0xf')]);router[_0x4cc3('0x10')](_0x4cc3('0xb'),auth[_0x4cc3('0x9')](),controller[_0x4cc3('0x11')]);module[_0x4cc3('0x12')]=router; \ No newline at end of file +var _0xa976=['post','create','put','/:id','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','isAuthenticated','index','get','show'];(function(_0xb3f712,_0x3ed2e6){var _0x2baf96=function(_0x440f4f){while(--_0x440f4f){_0xb3f712['push'](_0xb3f712['shift']());}};_0x2baf96(++_0x3ed2e6);}(_0xa976,0xd7));var _0x6a97=function(_0x3e9295,_0x351532){_0x3e9295=_0x3e9295-0x0;var _0x356bb0=_0xa976[_0x3e9295];return _0x356bb0;};'use strict';var multer=require(_0x6a97('0x0'));var util=require(_0x6a97('0x1'));var path=require('path');var timeout=require(_0x6a97('0x2'));var express=require(_0x6a97('0x3'));var router=express[_0x6a97('0x4')]();var fs_extra=require(_0x6a97('0x5'));var auth=require(_0x6a97('0x6'));var interaction=require(_0x6a97('0x7'));var config=require('../../config/environment');var controller=require(_0x6a97('0x8'));router['get']('/',auth[_0x6a97('0x9')](),controller[_0x6a97('0xa')]);router[_0x6a97('0xb')]('/:id',auth[_0x6a97('0x9')](),controller[_0x6a97('0xc')]);router[_0x6a97('0xd')]('/',auth[_0x6a97('0x9')](),controller[_0x6a97('0xe')]);router[_0x6a97('0xf')](_0x6a97('0x10'),auth[_0x6a97('0x9')](),controller['update']);router[_0x6a97('0x11')](_0x6a97('0x10'),auth['isAuthenticated'](),controller[_0x6a97('0x12')]);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 f610bd9..2166004 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 _0x1107=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','exports','STRING','BOOLEAN'];(function(_0x29abae,_0x624325){var _0x38f916=function(_0x57f990){while(--_0x57f990){_0x29abae['push'](_0x29abae['shift']());}};_0x38f916(++_0x624325);}(_0x1107,0x95));var _0x7110=function(_0x27fb22,_0xab9f66){_0x27fb22=_0x27fb22-0x0;var _0x2046fc=_0x1107[_0x27fb22];return _0x2046fc;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x7110('0x0')]={'phone':{'type':Sequelize[_0x7110('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x7110('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x7110('0x3')],'defaultValue':moment()[_0x7110('0x4')](_0x7110('0x5'))},'countbusyretry':{'type':Sequelize[_0x7110('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7110('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x7110('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7110('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x7110('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x7110('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x7110('0x7')},'UserId':{'type':Sequelize[_0x7110('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x7110('0x6')],'unique':_0x7110('0x7')},'CampaignId':{'type':Sequelize[_0x7110('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7110('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7110('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7110('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x7110('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x63ac=['sequelize','exports','STRING','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','DATE','UNSIGNED','contactListQueue'];(function(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0x63ac,0x17a));var _0xc63a=function(_0x4b418f,_0x3b6a96){_0x4b418f=_0x4b418f-0x0;var _0x2ed208=_0x63ac[_0x4b418f];return _0x2ed208;};'use strict';var moment=require('moment');var Sequelize=require(_0xc63a('0x0'));module[_0xc63a('0x1')]={'phone':{'type':Sequelize[_0xc63a('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0xc63a('0x3'))},'countbusyretry':{'type':Sequelize[_0xc63a('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc63a('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xc63a('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc63a('0x6')]},'priority':{'type':Sequelize[_0xc63a('0x4')](0x2)[_0xc63a('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xc63a('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xc63a('0x4')],'unique':_0xc63a('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xc63a('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xc63a('0x4')],'unique':_0xc63a('0x8')},'CampaignId':{'type':Sequelize[_0xc63a('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xc63a('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc63a('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc63a('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc63a('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc63a('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xc63a('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xc63a('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0xc63a('0x6')],'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 8cf24d0..801bdeb 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 _0xbbda=['$in','$notIn','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','CmHopper','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state','deleted','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','filter','dialPreviewAutoRecallMe','value','direction','prev','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','priority','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','getPreviewRecall','hopperId','recallme','Company','isNumber','getOpenContacts','getTimezones','timezones','push','utcOffset','getTimezone','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','rawAttributes','key','model','map','keys','query','filters','intersection','concat','$and','$or','$gt','$gte','$lte','$ne','$eq','$not','$notBetween'];(function(_0x46fccd,_0x48ade1){var _0x366df9=function(_0x2fda90){while(--_0x2fda90){_0x46fccd['push'](_0x46fccd['shift']());}};_0x366df9(++_0x48ade1);}(_0xbbda,0x66));var _0xabbd=function(_0x523df5,_0x36ff47){_0x523df5=_0x523df5-0x0;var _0x17e85b=_0xbbda[_0x523df5];return _0x17e85b;};'use strict';var emlformat=require(_0xabbd('0x0'));var rimraf=require(_0xabbd('0x1'));var zipdir=require(_0xabbd('0x2'));var jsonpatch=require(_0xabbd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xabbd('0x4'));var Mustache=require('mustache');var util=require(_0xabbd('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xabbd('0x6'));var ejs=require(_0xabbd('0x7'));var fs=require('fs');var fs_extra=require(_0xabbd('0x8'));var _=require(_0xabbd('0x9'));var squel=require('squel');var crypto=require(_0xabbd('0xa'));var jsforce=require(_0xabbd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xabbd('0x6'));var querystring=require(_0xabbd('0xc'));var Papa=require('papaparse');var Redis=require(_0xabbd('0xd'));var authService=require(_0xabbd('0xe'));var qs=require(_0xabbd('0xf'));var as=require(_0xabbd('0x10'));var hardwareService=require(_0xabbd('0x11'));var logger=require(_0xabbd('0x12'))(_0xabbd('0x13'));var utils=require('../../config/utils');var config=require(_0xabbd('0x14'));var shared=require(_0xabbd('0x14'));var licenseUtil=require(_0xabbd('0x15'));var db=require(_0xabbd('0x16'))['db'];function respondWithStatusCode(_0x4bb960,_0xb9733d){_0xb9733d=_0xb9733d||0xcc;return function(_0x1f3df0){if(_0x1f3df0){return _0x4bb960[_0xabbd('0x17')](_0xb9733d);}return _0x4bb960['status'](_0xb9733d)[_0xabbd('0x18')]();};}function respondWithResult(_0x5d1e4a,_0x45734d){_0x45734d=_0x45734d||0xc8;return function(_0xc01d38){if(_0xc01d38){return _0x5d1e4a['status'](_0x45734d)[_0xabbd('0x19')](_0xc01d38);}};}function respondWithFilteredResult(_0x28ef0c,_0x57d8aa){return function(_0x3d9b06){if(_0x3d9b06){var _0x2eaee8=typeof _0x57d8aa[_0xabbd('0x1a')]===_0xabbd('0x1b')&&typeof _0x57d8aa[_0xabbd('0x1c')]===_0xabbd('0x1b');var _0x8de816=_0x3d9b06[_0xabbd('0x1d')];var _0x258963=_0x2eaee8?0x0:_0x57d8aa['offset'];var _0x21f034=_0x2eaee8?_0x3d9b06[_0xabbd('0x1d')]:_0x57d8aa[_0xabbd('0x1a')]+_0x57d8aa[_0xabbd('0x1c')];var _0x18058f;if(_0x21f034>=_0x8de816){_0x21f034=_0x8de816;_0x18058f=0xc8;}else{_0x18058f=0xce;}_0x28ef0c[_0xabbd('0x1e')](_0x18058f);return _0x28ef0c[_0xabbd('0x1f')](_0xabbd('0x20'),_0x258963+'-'+_0x21f034+'/'+_0x8de816)['json'](_0x3d9b06);}return null;};}function patchUpdates(_0x4ff044){return function(_0x31b2f5){try{jsonpatch[_0xabbd('0x21')](_0x31b2f5,_0x4ff044,!![]);}catch(_0x8dfea0){return BPromise[_0xabbd('0x22')](_0x8dfea0);}return _0x31b2f5[_0xabbd('0x23')]();};}function saveUpdates(_0x389422,_0x5dbe44){return function(_0x476b57){if(_0x476b57){return _0x476b57[_0xabbd('0x24')](_0x389422)['then'](function(_0x3be01b){return _0x3be01b;});}return null;};}function removeEntity(_0x32a23f,_0xc4a55f){return function(_0x26e00b){if(_0x26e00b){return _0x26e00b[_0xabbd('0x25')]()[_0xabbd('0x26')](function(){_0x32a23f[_0xabbd('0x1e')](0xcc)[_0xabbd('0x18')]();});}};}function handleEntityNotFound(_0x4b2cbb,_0x56ecdd){return function(_0xf7009a){if(!_0xf7009a){_0x4b2cbb['sendStatus'](0x194);}return _0xf7009a;};}function handleError(_0x52f13e,_0x548135){_0x548135=_0x548135||0x1f4;return function(_0x40c25b){logger[_0xabbd('0x27')](_0x40c25b[_0xabbd('0x28')]);if(_0x40c25b['name']){delete _0x40c25b[_0xabbd('0x29')];}_0x52f13e['status'](_0x548135)[_0xabbd('0x2a')](_0x40c25b);};}exports[_0xabbd('0x2b')]=function(_0x12cbf8,_0x19dff2){var _0x3fe8fd={},_0x182fce={},_0x15f012={'count':0x0,'rows':[]};var _0x460945=_['map'](db['CmHopper'][_0xabbd('0x2c')],function(_0x5cb1c0){return{'name':_0x5cb1c0['fieldName'],'type':_0x5cb1c0['type'][_0xabbd('0x2d')]};});_0x182fce[_0xabbd('0x2e')]=_[_0xabbd('0x2f')](_0x460945,_0xabbd('0x29'));_0x182fce['query']=_[_0xabbd('0x30')](_0x12cbf8[_0xabbd('0x31')]);_0x182fce[_0xabbd('0x32')]=_[_0xabbd('0x33')](_0x182fce[_0xabbd('0x2e')],_0x182fce['query']);_0x182fce['filters']=_[_0xabbd('0x34')](_0x182fce[_0xabbd('0x32')],[_0xabbd('0x35'),_0xabbd('0x36'),_0xabbd('0x37'),_0xabbd('0x38'),'$lt',_0xabbd('0x39'),_0xabbd('0x3a'),_0xabbd('0x3b'),_0xabbd('0x3c'),'$between',_0xabbd('0x3d'),_0xabbd('0x3e'),_0xabbd('0x3f'),_0xabbd('0x40'),_0xabbd('0x41'),'$iLike',_0xabbd('0x42'),'$like',_0xabbd('0x43'),_0xabbd('0x44'),_0xabbd('0x45'),_0xabbd('0x46')]);_0x3fe8fd[_0xabbd('0x47')]=_[_0xabbd('0x33')](_0x182fce[_0xabbd('0x2e')],qs[_0xabbd('0x48')](_0x12cbf8[_0xabbd('0x31')][_0xabbd('0x48')]));_0x3fe8fd[_0xabbd('0x47')]=_0x3fe8fd[_0xabbd('0x47')][_0xabbd('0x49')]?_0x3fe8fd[_0xabbd('0x47')]:_0x182fce[_0xabbd('0x2e')];if(!_0x12cbf8['query'][_0xabbd('0x4a')](_0xabbd('0x4b'))){_0x3fe8fd[_0xabbd('0x1c')]=qs[_0xabbd('0x1c')](_0x12cbf8[_0xabbd('0x31')][_0xabbd('0x1c')]);_0x3fe8fd['offset']=qs['offset'](_0x12cbf8[_0xabbd('0x31')][_0xabbd('0x1a')]);}_0x3fe8fd[_0xabbd('0x4c')]=qs['sort'](_0x12cbf8[_0xabbd('0x31')][_0xabbd('0x4d')]);_0x3fe8fd[_0xabbd('0x4e')]=qs['filters'](_[_0xabbd('0x4f')](_0x12cbf8[_0xabbd('0x31')],_0x182fce[_0xabbd('0x32')]),_0x460945);if(_0x12cbf8['query']['filter']){_0x3fe8fd[_0xabbd('0x4e')]=_[_0xabbd('0x50')](_0x3fe8fd[_0xabbd('0x4e')],{'$or':_[_0xabbd('0x2f')](_0x460945,function(_0x44a2ef){if(_0x44a2ef[_0xabbd('0x51')]!==_0xabbd('0x52')){var _0x5b6573={};_0x5b6573[_0x44a2ef['name']]={'$like':'%'+_0x12cbf8[_0xabbd('0x31')]['filter']+'%'};return _0x5b6573;}})});}_0x3fe8fd=_[_0xabbd('0x50')]({},_0x3fe8fd,_0x12cbf8[_0xabbd('0x53')]);var _0x580141={'where':_0x3fe8fd[_0xabbd('0x4e')]};return db['CmHopper']['count'](_0x580141)[_0xabbd('0x26')](function(_0x4455fc){_0x15f012[_0xabbd('0x1d')]=_0x4455fc;if(_0x12cbf8[_0xabbd('0x31')][_0xabbd('0x54')]){_0x3fe8fd[_0xabbd('0x55')]=[{'all':!![]}];}return db['CmHopper'][_0xabbd('0x56')](_0x3fe8fd);})[_0xabbd('0x26')](function(_0x2b68fa){_0x15f012[_0xabbd('0x57')]=_0x2b68fa;return _0x15f012;})[_0xabbd('0x26')](respondWithFilteredResult(_0x19dff2,_0x3fe8fd))[_0xabbd('0x58')](handleError(_0x19dff2,null));};exports[_0xabbd('0x59')]=function(_0x219150,_0x519b4a){var _0x34e3a6={'raw':!![],'where':{'id':_0x219150[_0xabbd('0x5a')]['id']}},_0x27174b={};_0x27174b['model']=_[_0xabbd('0x30')](db[_0xabbd('0x5b')][_0xabbd('0x2c')]);_0x27174b[_0xabbd('0x31')]=_[_0xabbd('0x30')](_0x219150[_0xabbd('0x31')]);_0x27174b[_0xabbd('0x32')]=_[_0xabbd('0x33')](_0x27174b[_0xabbd('0x2e')],_0x27174b['query']);_0x34e3a6[_0xabbd('0x47')]=_[_0xabbd('0x33')](_0x27174b[_0xabbd('0x2e')],qs['fields'](_0x219150[_0xabbd('0x31')]['fields']));_0x34e3a6['attributes']=_0x34e3a6[_0xabbd('0x47')]['length']?_0x34e3a6[_0xabbd('0x47')]:_0x27174b[_0xabbd('0x2e')];if(_0x219150[_0xabbd('0x31')][_0xabbd('0x54')]){_0x34e3a6[_0xabbd('0x55')]=[{'all':!![]}];}_0x34e3a6=_[_0xabbd('0x50')]({},_0x34e3a6,_0x219150[_0xabbd('0x53')]);return db['CmHopper'][_0xabbd('0x5c')](_0x34e3a6)[_0xabbd('0x26')](handleEntityNotFound(_0x519b4a,null))[_0xabbd('0x26')](respondWithResult(_0x519b4a,null))[_0xabbd('0x58')](handleError(_0x519b4a,null));};exports[_0xabbd('0x5d')]=function(_0x3b73da,_0x502a88){return db[_0xabbd('0x5b')][_0xabbd('0x5d')](_0x3b73da[_0xabbd('0x5e')],{})[_0xabbd('0x26')](respondWithResult(_0x502a88,0xc9))[_0xabbd('0x58')](handleError(_0x502a88,null));};exports[_0xabbd('0x24')]=function(_0x533fd7,_0x5647e5){if(_0x533fd7[_0xabbd('0x5e')]['id']){delete _0x533fd7[_0xabbd('0x5e')]['id'];}return db[_0xabbd('0x5b')][_0xabbd('0x5c')]({'where':{'id':_0x533fd7[_0xabbd('0x5a')]['id']}})[_0xabbd('0x26')](handleEntityNotFound(_0x5647e5,null))['then'](saveUpdates(_0x533fd7[_0xabbd('0x5e')],null))[_0xabbd('0x26')](respondWithResult(_0x5647e5,null))[_0xabbd('0x58')](handleError(_0x5647e5,null));};exports[_0xabbd('0x5f')]=function(_0x49bd8b,_0x4dd3ce){return db[_0xabbd('0x5b')][_0xabbd('0x5f')]()['then'](respondWithResult(_0x4dd3ce,null))[_0xabbd('0x58')](handleError(_0x4dd3ce,null));};exports['destroy']=function(_0x578358,_0x199db4){var _0x48b850;var _0x37d68d=_0x578358['params']['id'];return db['CmHopper'][_0xabbd('0x5c')]({'where':{'id':_0x578358[_0xabbd('0x5a')]['id']}})[_0xabbd('0x26')](handleEntityNotFound(_0x199db4,null))[_0xabbd('0x26')](function(_0x5988a8){if(_0x5988a8){return _0x5988a8[_0xabbd('0x25')]()[_0xabbd('0x26')](function(_0x292e27){return _0x292e27;});}})['then'](function(_0x44d61f){_0x48b850=_0x44d61f;if(_0x44d61f){if(_0x44d61f[_0xabbd('0x60')]||_0x44d61f[_0xabbd('0x61')]){return db[_0x44d61f[_0xabbd('0x60')]?_0xabbd('0x62'):'Campaign'][_0xabbd('0x5c')]({'where':{'id':_0x44d61f['VoiceQueueId']?_0x44d61f[_0xabbd('0x60')]:_0x44d61f[_0xabbd('0x61')]},'attributes':['id',_0xabbd('0x29')],'raw':!![]});}}})[_0xabbd('0x26')](function(_0x2f7832){var _0x48cf1b={};if(_0x2f7832){_[_0xabbd('0x50')](_0x48cf1b,_[_0xabbd('0x63')](_0x48b850[_0xabbd('0x64')],[_0xabbd('0x65'),_0xabbd('0x66'),'id']));_0x48cf1b[_0xabbd('0x67')]=0x15;_0x48cf1b['statedesc']=_0xabbd('0x68');_0x48cf1b['campaign']=_0x2f7832[_0xabbd('0x29')];_0x48cf1b['membername']=_0x578358[_0xabbd('0x69')][_0xabbd('0x29')];_0x48cf1b[_0xabbd('0x6a')]=_0x578358['user']['id'];_0x48cf1b[_0xabbd('0x68')]=!![];_0x48cf1b[_0xabbd('0x6b')]=moment()[_0xabbd('0x6c')](_0xabbd('0x6d'));_0x48cf1b[_0xabbd('0x6e')]=_0x48b850[_0xabbd('0x6f')];_0x48cf1b[_0xabbd('0x70')]=_0x48b850[_0xabbd('0x60')]?_0xabbd('0x71'):_0xabbd('0x72');return db[_0xabbd('0x73')]['find']({'where':{'id':_0x48cf1b[_0xabbd('0x74')]},'attributes':['firstName',_0xabbd('0x75')]})[_0xabbd('0x26')](function(_0x4a11cc){if(!_[_0xabbd('0x76')](_0x199db4)&&!_[_0xabbd('0x76')](_0x4a11cc[_0xabbd('0x77')])){_0x48cf1b[_0xabbd('0x78')]=_0x4a11cc[_0xabbd('0x77')];if(!_[_0xabbd('0x76')](_0x4a11cc[_0xabbd('0x75')])){_0x48cf1b[_0xabbd('0x78')]+='\x20'+_0x4a11cc[_0xabbd('0x75')];}}})[_0xabbd('0x79')](function(){return db[_0xabbd('0x7a')][_0xabbd('0x5d')](_0x48cf1b);});}})[_0xabbd('0x26')](function(_0x4d4d23){return db[_0xabbd('0x7b')]['destroy']({'where':{'CmHopperId':_0x37d68d}});})[_0xabbd('0x26')](function(){return _0x199db4[_0xabbd('0x1e')](0xcc)['end']();})[_0xabbd('0x58')](handleError(_0x199db4,null));};exports[_0xabbd('0x7c')]=function(_0x538208,_0x4add14,_0x55728d){var _0x15cb13=[];return db[_0xabbd('0x73')][_0xabbd('0x5f')]()[_0xabbd('0x26')](function(_0x363602){_0x15cb13=_[_0xabbd('0x30')](_0x363602);return _0x538208[_0xabbd('0x69')][_0xabbd('0x7d')]({'where':{'type':_0xabbd('0x7e'),'dialActive':!![],'dialMethod':_0xabbd('0x7f')},'attributes':['id',_0xabbd('0x80'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0xabbd('0x26')](function(_0x8ec9a3){if(_0x8ec9a3&&_0x8ec9a3[_0xabbd('0x49')]){return db[_0xabbd('0x81')][_0xabbd('0x82')](function(_0x38cc77){var _0x2714d5={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xabbd('0x6c')](_0xabbd('0x6d'))},'VoiceQueueId':{'$in':_[_0xabbd('0x2f')](_0x8ec9a3,'id')},'$or':[{'UserId':null},{'UserId':_0x538208[_0xabbd('0x69')]['id']}]};var _0x107873={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x8ec9a3)[_0xabbd('0x83')]([_0xabbd('0x84'),0x0])[_0xabbd('0x2f')]('id')[_0xabbd('0x85')]()},'$or':[{'UserId':null},{'UserId':_0x538208[_0xabbd('0x69')]['id']}]};var _0x4ac352={'$or':[_0x2714d5,_0x107873]};var _0x5dbcc9=[];if(_0x538208[_0xabbd('0x5e')][_0xabbd('0x86')]&&_0x538208['body'][_0xabbd('0x86')]===_0xabbd('0x87')){if(!_['isEmpty'](_0x538208[_0xabbd('0x5e')][_0xabbd('0x88')])){_0x4ac352['id']={'$in':_0x538208[_0xabbd('0x5e')][_0xabbd('0x88')]};}_0x5dbcc9=[['priority',_0xabbd('0x89')],[_0xabbd('0x8a'),_0x8ec9a3[0x0]['dialOrderByScheduledAt']==='ASC'?_0xabbd('0x8b'):_0xabbd('0x89')],db[_0xabbd('0x81')][_0xabbd('0x8c')](_0xabbd('0x8d')),['id',_0xabbd('0x8b')]];}else{if(!_[_0xabbd('0x8e')](_0x538208[_0xabbd('0x5e')]['hopperIds'])){_0x4ac352['id']={'$notIn':_0x538208[_0xabbd('0x5e')][_0xabbd('0x88')]};}_0x5dbcc9=[[_0xabbd('0x8f'),_0xabbd('0x8b')],[_0xabbd('0x8a'),_0x8ec9a3[0x0][_0xabbd('0x80')]],db[_0xabbd('0x81')][_0xabbd('0x8c')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xabbd('0x89')]];}return db[_0xabbd('0x5b')][_0xabbd('0x90')]({'attributes':['id',_0xabbd('0x91'),_0xabbd('0x6f'),'recallme'],'where':_0x4ac352,'order':_0x5dbcc9,'transaction':_0x38cc77,'lock':_0x38cc77[_0xabbd('0x92')][_0xabbd('0x93')],'include':[{'model':db[_0xabbd('0x73')],'as':_0xabbd('0x94'),'attributes':_0x15cb13,'include':[{'model':db[_0xabbd('0x95')],'as':'Company','attributes':['id',_0xabbd('0x29')]}]},{'model':db[_0xabbd('0x96')],'as':_0xabbd('0x97'),'attributes':['id',_0xabbd('0x29')]},{'model':db[_0xabbd('0x62')],'as':_0xabbd('0x98'),'attributes':['id','name','dialActive']}]})[_0xabbd('0x26')](function(_0x3c9f9b){if(_0x3c9f9b){return _0x3c9f9b[_0xabbd('0x24')]({'UserId':_0x538208['user']['id']},{'transaction':_0x38cc77});}});});}})[_0xabbd('0x26')](handleEntityNotFound(_0x4add14,null))[_0xabbd('0x26')](respondWithResult(_0x4add14,null))[_0xabbd('0x58')](handleError(_0x4add14,null));};exports[_0xabbd('0x99')]=function(_0x1b3fb6,_0x47b420,_0x1ec6ac){var _0x291cd7=[];return db[_0xabbd('0x73')]['describe']()[_0xabbd('0x26')](function(_0x28e046){_0x291cd7=_[_0xabbd('0x30')](_0x28e046);return _0x1b3fb6[_0xabbd('0x69')][_0xabbd('0x7d')]({'where':{'type':_0xabbd('0x7e'),'dialActive':!![],'dialMethod':_0xabbd('0x7f')},'attributes':['id',_0xabbd('0x80'),_0xabbd('0x84')],'raw':!![]});})[_0xabbd('0x26')](function(_0x4fb86e){if(_0x4fb86e&&_0x4fb86e[_0xabbd('0x49')]){return db[_0xabbd('0x81')][_0xabbd('0x82')](function(_0xf7ec44){var _0x11997c={'active':![],'recallme':!![],'id':_0x1b3fb6['body'][_0xabbd('0x9a')]};return db[_0xabbd('0x5b')][_0xabbd('0x90')]({'attributes':['id','scheduledat',_0xabbd('0x9b')],'where':_0x11997c,'transaction':_0xf7ec44,'lock':_0xf7ec44[_0xabbd('0x92')][_0xabbd('0x93')],'include':[{'model':db['CmContact'],'as':_0xabbd('0x94'),'attributes':_0x291cd7,'include':[{'model':db[_0xabbd('0x95')],'as':_0xabbd('0x9c'),'attributes':['id',_0xabbd('0x29')]}]},{'model':db['CmList'],'as':_0xabbd('0x97'),'attributes':['id',_0xabbd('0x29')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xabbd('0x29'),'dialActive']}]})[_0xabbd('0x26')](function(_0x108dfb){if(_0x108dfb){return _0x108dfb[_0xabbd('0x24')]({'UserId':_0x1b3fb6[_0xabbd('0x69')]['id']},{'transaction':_0xf7ec44});}});});}})[_0xabbd('0x26')](handleEntityNotFound(_0x47b420,null))[_0xabbd('0x26')](respondWithResult(_0x47b420,null))['catch'](handleError(_0x47b420,null));};exports['getOpenContacts']=function(_0x53a8a8,_0x1f56d0,_0xdf746c){return _0x53a8a8[_0xabbd('0x69')][_0xabbd('0x7d')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xabbd('0x7f')},'attributes':['id'],'raw':!![]})['then'](function(_0x9b0238){if(_0x9b0238&&_0x9b0238['length']){return db[_0xabbd('0x5b')][_0xabbd('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xabbd('0x6c')](_0xabbd('0x6d'))},'VoiceQueueId':{'$in':_['map'](_0x9b0238,'id')},'$or':[{'UserId':null},{'UserId':_0x53a8a8[_0xabbd('0x69')]['id']}]}});}return 0x0;})[_0xabbd('0x26')](function(_0x2623bf){if(!_['isNil'](_0x2623bf)&&_[_0xabbd('0x9d')](_0x2623bf)){return _0x1f56d0['status'](0xc8)['json']({'contacts':_0x2623bf});}else{logger[_0xabbd('0x27')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xabbd('0x9e'),0x194,'entity\x20not\x20found');_0x1f56d0[_0xabbd('0x17')](0x194);}})[_0xabbd('0x58')](handleError(_0x1f56d0,null));};exports[_0xabbd('0x9f')]=function(_0x556918,_0x465176,_0x471469){var _0x2c8e13=shared[_0xabbd('0xa0')];var _0x7fe4a=[];_['map'](_0x2c8e13,function(_0x185235){_0x7fe4a[_0xabbd('0xa1')]({'id':_0x185235[_0xabbd('0x29')],'name':_0x185235[_0xabbd('0x29')],'utcOffset':_0x185235[_0xabbd('0xa2')]});});return _0x465176[_0xabbd('0x1e')](0xc8)[_0xabbd('0x19')]({'tz':_0x7fe4a});};exports[_0xabbd('0xa3')]=function(_0x4c57ab,_0x1040af,_0x388938){var _0x2213ce=shared[_0xabbd('0xa0')];var _0x3d2d23={};if(!_[_0xabbd('0x76')](_0x2213ce[_0x4c57ab[_0xabbd('0x5e')]['id']]))_0x3d2d23=_0x2213ce[_0x4c57ab[_0xabbd('0x5e')]['id']];return _0x1040af[_0xabbd('0x1e')](0xc8)['json'](_0x3d2d23);}; \ No newline at end of file +var _0x17b7=['$lt','$eq','$not','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$any','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','filter','options','includeAll','include','findAll','catch','show','params','CmHopper','find','create','body','describe','VoiceQueueId','CampaignId','Campaign','omit','dataValues','updatedAt','statedesc','deleted','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','CmHopperAdditionalPhone','getPreview','CmContact','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','CmCompany','Company','CmList','List','VoiceQueue','Queue','dialActive','getPreviewRecall','getVoiceQueues','length','hopperId','Contact','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','to-csv','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','map','rawAttributes','key','keys','query','intersection','model','concat','$and','$or','$gte'];(function(_0x23ab7d,_0x5d90d9){var _0x5239ce=function(_0x247fd3){while(--_0x247fd3){_0x23ab7d['push'](_0x23ab7d['shift']());}};_0x5239ce(++_0x5d90d9);}(_0x17b7,0xfd));var _0x717b=function(_0x1c2d2d,_0xfaabea){_0x1c2d2d=_0x1c2d2d-0x0;var _0x32b269=_0x17b7[_0x1c2d2d];return _0x32b269;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x717b('0x0'));var jsonpatch=require(_0x717b('0x1'));var rp=require(_0x717b('0x2'));var moment=require(_0x717b('0x3'));var BPromise=require(_0x717b('0x4'));var Mustache=require(_0x717b('0x5'));var util=require('util');var path=require(_0x717b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x717b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x717b('0x8'));var squel=require(_0x717b('0x9'));var crypto=require(_0x717b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x717b('0xb'));var querystring=require(_0x717b('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x717b('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x717b('0xe'));var logger=require(_0x717b('0xf'))(_0x717b('0x10'));var utils=require(_0x717b('0x11'));var config=require(_0x717b('0x12'));var shared=require(_0x717b('0x12'));var licenseUtil=require(_0x717b('0x13'));var db=require(_0x717b('0x14'))['db'];function respondWithStatusCode(_0xcb2276,_0x4af2f2){_0x4af2f2=_0x4af2f2||0xcc;return function(_0x1c49bd){if(_0x1c49bd){return _0xcb2276[_0x717b('0x15')](_0x4af2f2);}return _0xcb2276[_0x717b('0x16')](_0x4af2f2)[_0x717b('0x17')]();};}function respondWithResult(_0x5750f0,_0x3312f1){_0x3312f1=_0x3312f1||0xc8;return function(_0x234b34){if(_0x234b34){return _0x5750f0[_0x717b('0x16')](_0x3312f1)['json'](_0x234b34);}};}function respondWithFilteredResult(_0x42a279,_0x267b51){return function(_0x5a5ebc){if(_0x5a5ebc){var _0x31eebf=typeof _0x267b51[_0x717b('0x18')]===_0x717b('0x19')&&typeof _0x267b51[_0x717b('0x1a')]===_0x717b('0x19');var _0xc503e9=_0x5a5ebc[_0x717b('0x1b')];var _0x393f0e=_0x31eebf?0x0:_0x267b51[_0x717b('0x18')];var _0x8db1c1=_0x31eebf?_0x5a5ebc[_0x717b('0x1b')]:_0x267b51[_0x717b('0x18')]+_0x267b51['limit'];var _0x13dc02;if(_0x8db1c1>=_0xc503e9){_0x8db1c1=_0xc503e9;_0x13dc02=0xc8;}else{_0x13dc02=0xce;}_0x42a279['status'](_0x13dc02);return _0x42a279[_0x717b('0x1c')](_0x717b('0x1d'),_0x393f0e+'-'+_0x8db1c1+'/'+_0xc503e9)[_0x717b('0x1e')](_0x5a5ebc);}return null;};}function patchUpdates(_0x518600){return function(_0x8cc19f){try{jsonpatch[_0x717b('0x1f')](_0x8cc19f,_0x518600,!![]);}catch(_0x442f27){return BPromise[_0x717b('0x20')](_0x442f27);}return _0x8cc19f[_0x717b('0x21')]();};}function saveUpdates(_0x40e9c6,_0x142579){return function(_0xb2408a){if(_0xb2408a){return _0xb2408a[_0x717b('0x22')](_0x40e9c6)[_0x717b('0x23')](function(_0x37a1df){return _0x37a1df;});}return null;};}function removeEntity(_0x4caaea,_0x1731c5){return function(_0x5c4b1f){if(_0x5c4b1f){return _0x5c4b1f[_0x717b('0x24')]()[_0x717b('0x23')](function(){_0x4caaea['status'](0xcc)[_0x717b('0x17')]();});}};}function handleEntityNotFound(_0x16dba0,_0x114170){return function(_0x82d186){if(!_0x82d186){_0x16dba0[_0x717b('0x15')](0x194);}return _0x82d186;};}function handleError(_0x15bd50,_0x4f5915){_0x4f5915=_0x4f5915||0x1f4;return function(_0x99e093){logger[_0x717b('0x25')](_0x99e093['stack']);if(_0x99e093['name']){delete _0x99e093[_0x717b('0x26')];}_0x15bd50[_0x717b('0x16')](_0x4f5915)['send'](_0x99e093);};}exports[_0x717b('0x27')]=function(_0xfa2fca,_0x31299e){var _0xda5e09={},_0xc9e79f={},_0x30c579={'count':0x0,'rows':[]};var _0xa98289=_[_0x717b('0x28')](db['CmHopper'][_0x717b('0x29')],function(_0x11d89c){return{'name':_0x11d89c['fieldName'],'type':_0x11d89c['type'][_0x717b('0x2a')]};});_0xc9e79f['model']=_[_0x717b('0x28')](_0xa98289,'name');_0xc9e79f['query']=_[_0x717b('0x2b')](_0xfa2fca[_0x717b('0x2c')]);_0xc9e79f['filters']=_[_0x717b('0x2d')](_0xc9e79f[_0x717b('0x2e')],_0xc9e79f['query']);_0xc9e79f['filters']=_[_0x717b('0x2f')](_0xc9e79f['filters'],[_0x717b('0x30'),_0x717b('0x31'),'$gt',_0x717b('0x32'),_0x717b('0x33'),'$lte','$ne',_0x717b('0x34'),_0x717b('0x35'),'$between',_0x717b('0x36'),_0x717b('0x37'),_0x717b('0x38'),_0x717b('0x39'),'$notLike',_0x717b('0x3a'),_0x717b('0x3b'),_0x717b('0x39'),_0x717b('0x3c'),'$contains','$contained',_0x717b('0x3d')]);_0xda5e09['attributes']=_[_0x717b('0x2d')](_0xc9e79f[_0x717b('0x2e')],qs[_0x717b('0x3e')](_0xfa2fca[_0x717b('0x2c')][_0x717b('0x3e')]));_0xda5e09['attributes']=_0xda5e09[_0x717b('0x3f')]['length']?_0xda5e09[_0x717b('0x3f')]:_0xc9e79f[_0x717b('0x2e')];if(!_0xfa2fca[_0x717b('0x2c')][_0x717b('0x40')](_0x717b('0x41'))){_0xda5e09['limit']=qs['limit'](_0xfa2fca[_0x717b('0x2c')][_0x717b('0x1a')]);_0xda5e09[_0x717b('0x18')]=qs['offset'](_0xfa2fca['query']['offset']);}_0xda5e09[_0x717b('0x42')]=qs[_0x717b('0x43')](_0xfa2fca['query'][_0x717b('0x43')]);_0xda5e09[_0x717b('0x44')]=qs[_0x717b('0x45')](_['pick'](_0xfa2fca[_0x717b('0x2c')],_0xc9e79f[_0x717b('0x45')]),_0xa98289);if(_0xfa2fca[_0x717b('0x2c')]['filter']){_0xda5e09[_0x717b('0x44')]=_[_0x717b('0x46')](_0xda5e09[_0x717b('0x44')],{'$or':_[_0x717b('0x28')](_0xa98289,function(_0x790e31){if(_0x790e31[_0x717b('0x47')]!=='VIRTUAL'){var _0x1a896d={};_0x1a896d[_0x790e31[_0x717b('0x26')]]={'$like':'%'+_0xfa2fca[_0x717b('0x2c')][_0x717b('0x48')]+'%'};return _0x1a896d;}})});}_0xda5e09=_[_0x717b('0x46')]({},_0xda5e09,_0xfa2fca[_0x717b('0x49')]);var _0xd4403a={'where':_0xda5e09[_0x717b('0x44')]};return db['CmHopper']['count'](_0xd4403a)['then'](function(_0x38d587){_0x30c579['count']=_0x38d587;if(_0xfa2fca[_0x717b('0x2c')][_0x717b('0x4a')]){_0xda5e09[_0x717b('0x4b')]=[{'all':!![]}];}return db['CmHopper'][_0x717b('0x4c')](_0xda5e09);})[_0x717b('0x23')](function(_0x123cde){_0x30c579['rows']=_0x123cde;return _0x30c579;})['then'](respondWithFilteredResult(_0x31299e,_0xda5e09))[_0x717b('0x4d')](handleError(_0x31299e,null));};exports[_0x717b('0x4e')]=function(_0x527a34,_0x3c06e6){var _0x2e9d53={'raw':!![],'where':{'id':_0x527a34[_0x717b('0x4f')]['id']}},_0x52f15c={};_0x52f15c[_0x717b('0x2e')]=_['keys'](db[_0x717b('0x50')][_0x717b('0x29')]);_0x52f15c['query']=_[_0x717b('0x2b')](_0x527a34[_0x717b('0x2c')]);_0x52f15c[_0x717b('0x45')]=_[_0x717b('0x2d')](_0x52f15c[_0x717b('0x2e')],_0x52f15c[_0x717b('0x2c')]);_0x2e9d53[_0x717b('0x3f')]=_[_0x717b('0x2d')](_0x52f15c[_0x717b('0x2e')],qs['fields'](_0x527a34[_0x717b('0x2c')]['fields']));_0x2e9d53[_0x717b('0x3f')]=_0x2e9d53[_0x717b('0x3f')]['length']?_0x2e9d53['attributes']:_0x52f15c[_0x717b('0x2e')];if(_0x527a34[_0x717b('0x2c')]['includeAll']){_0x2e9d53[_0x717b('0x4b')]=[{'all':!![]}];}_0x2e9d53=_[_0x717b('0x46')]({},_0x2e9d53,_0x527a34[_0x717b('0x49')]);return db['CmHopper'][_0x717b('0x51')](_0x2e9d53)[_0x717b('0x23')](handleEntityNotFound(_0x3c06e6,null))['then'](respondWithResult(_0x3c06e6,null))[_0x717b('0x4d')](handleError(_0x3c06e6,null));};exports['create']=function(_0x5a2e96,_0x25d616){return db['CmHopper'][_0x717b('0x52')](_0x5a2e96['body'],{})['then'](respondWithResult(_0x25d616,0xc9))[_0x717b('0x4d')](handleError(_0x25d616,null));};exports[_0x717b('0x22')]=function(_0x2ce382,_0x3b3e87){if(_0x2ce382['body']['id']){delete _0x2ce382[_0x717b('0x53')]['id'];}return db[_0x717b('0x50')][_0x717b('0x51')]({'where':{'id':_0x2ce382[_0x717b('0x4f')]['id']}})[_0x717b('0x23')](handleEntityNotFound(_0x3b3e87,null))[_0x717b('0x23')](saveUpdates(_0x2ce382['body'],null))[_0x717b('0x23')](respondWithResult(_0x3b3e87,null))[_0x717b('0x4d')](handleError(_0x3b3e87,null));};exports[_0x717b('0x54')]=function(_0x41fba8,_0x1922a1){return db[_0x717b('0x50')]['describe']()['then'](respondWithResult(_0x1922a1,null))[_0x717b('0x4d')](handleError(_0x1922a1,null));};exports[_0x717b('0x24')]=function(_0x2bfeae,_0x34db6a){var _0x45e8e5;var _0x1f1bac=_0x2bfeae[_0x717b('0x4f')]['id'];return db[_0x717b('0x50')][_0x717b('0x51')]({'where':{'id':_0x2bfeae['params']['id']}})[_0x717b('0x23')](handleEntityNotFound(_0x34db6a,null))[_0x717b('0x23')](function(_0x2984e4){if(_0x2984e4){return _0x2984e4['destroy']()[_0x717b('0x23')](function(_0x2348a6){return _0x2348a6;});}})[_0x717b('0x23')](function(_0x21a88a){_0x45e8e5=_0x21a88a;if(_0x21a88a){if(_0x21a88a[_0x717b('0x55')]||_0x21a88a[_0x717b('0x56')]){return db[_0x21a88a[_0x717b('0x55')]?'VoiceQueue':_0x717b('0x57')][_0x717b('0x51')]({'where':{'id':_0x21a88a[_0x717b('0x55')]?_0x21a88a['VoiceQueueId']:_0x21a88a[_0x717b('0x56')]},'attributes':['id',_0x717b('0x26')],'raw':!![]});}}})[_0x717b('0x23')](function(_0x7a88e5){var _0x477136={};if(_0x7a88e5){_[_0x717b('0x46')](_0x477136,_[_0x717b('0x58')](_0x45e8e5[_0x717b('0x59')],['createdAt',_0x717b('0x5a'),'id']));_0x477136['state']=0x15;_0x477136[_0x717b('0x5b')]=_0x717b('0x5c');_0x477136['campaign']=_0x7a88e5['name'];_0x477136['membername']=_0x2bfeae[_0x717b('0x5d')][_0x717b('0x26')];_0x477136[_0x717b('0x5e')]=_0x2bfeae[_0x717b('0x5d')]['id'];_0x477136[_0x717b('0x5c')]=!![];_0x477136[_0x717b('0x5f')]=moment()[_0x717b('0x60')](_0x717b('0x61'));_0x477136[_0x717b('0x62')]=_0x45e8e5[_0x717b('0x63')];_0x477136['campaigntype']=_0x45e8e5[_0x717b('0x55')]?_0x717b('0x64'):_0x717b('0x65');return db['CmContact']['find']({'where':{'id':_0x477136[_0x717b('0x66')]},'attributes':[_0x717b('0x67'),_0x717b('0x68')]})[_0x717b('0x23')](function(_0x4936e0){if(!_[_0x717b('0x69')](_0x34db6a)&&!_[_0x717b('0x69')](_0x4936e0[_0x717b('0x67')])){_0x477136[_0x717b('0x6a')]=_0x4936e0[_0x717b('0x67')];if(!_[_0x717b('0x69')](_0x4936e0[_0x717b('0x68')])){_0x477136[_0x717b('0x6a')]+='\x20'+_0x4936e0[_0x717b('0x68')];}}})['finally'](function(){return db[_0x717b('0x6b')][_0x717b('0x52')](_0x477136);});}})['then'](function(_0x28de0b){return db[_0x717b('0x6c')]['destroy']({'where':{'CmHopperId':_0x1f1bac}});})[_0x717b('0x23')](function(){return _0x34db6a[_0x717b('0x16')](0xcc)[_0x717b('0x17')]();})[_0x717b('0x4d')](handleError(_0x34db6a,null));};exports[_0x717b('0x6d')]=function(_0x45fc71,_0x46ffa7,_0x27075f){var _0x120547=[];return db[_0x717b('0x6e')][_0x717b('0x54')]()[_0x717b('0x23')](function(_0x5ce341){_0x120547=_[_0x717b('0x2b')](_0x5ce341);return _0x45fc71['user']['getVoiceQueues']({'where':{'type':_0x717b('0x6f'),'dialActive':!![],'dialMethod':_0x717b('0x70')},'attributes':['id',_0x717b('0x71'),_0x717b('0x72')],'raw':!![]});})[_0x717b('0x23')](function(_0x1e0d47){if(_0x1e0d47&&_0x1e0d47['length']){return db[_0x717b('0x73')][_0x717b('0x74')](function(_0x146625){var _0x592e42={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x717b('0x60')](_0x717b('0x61'))},'VoiceQueueId':{'$in':_['map'](_0x1e0d47,'id')},'$or':[{'UserId':null},{'UserId':_0x45fc71[_0x717b('0x5d')]['id']}]};var _0x100307={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1e0d47)[_0x717b('0x48')](['dialPreviewAutoRecallMe',0x0])[_0x717b('0x28')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x45fc71['user']['id']}]};var _0x351a4d={'$or':[_0x592e42,_0x100307]};var _0x34bead=[];if(_0x45fc71[_0x717b('0x53')][_0x717b('0x75')]&&_0x45fc71[_0x717b('0x53')][_0x717b('0x75')]===_0x717b('0x76')){if(!_[_0x717b('0x77')](_0x45fc71[_0x717b('0x53')]['hopperIds'])){_0x351a4d['id']={'$in':_0x45fc71['body'][_0x717b('0x78')]};}_0x34bead=[[_0x717b('0x79'),_0x717b('0x7a')],[_0x717b('0x7b'),_0x1e0d47[0x0]['dialOrderByScheduledAt']===_0x717b('0x7a')?_0x717b('0x7c'):_0x717b('0x7a')],db[_0x717b('0x73')][_0x717b('0x7d')](_0x717b('0x7e')),['id',_0x717b('0x7c')]];}else{if(!_[_0x717b('0x77')](_0x45fc71[_0x717b('0x53')][_0x717b('0x78')])){_0x351a4d['id']={'$notIn':_0x45fc71[_0x717b('0x53')]['hopperIds']};}_0x34bead=[[_0x717b('0x79'),'DESC'],[_0x717b('0x7b'),_0x1e0d47[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0x717b('0x7d')](_0x717b('0x7f')),['id',_0x717b('0x7a')]];}return db[_0x717b('0x50')][_0x717b('0x80')]({'attributes':['id',_0x717b('0x81'),_0x717b('0x63'),'recallme'],'where':_0x351a4d,'order':_0x34bead,'transaction':_0x146625,'lock':_0x146625[_0x717b('0x82')][_0x717b('0x83')],'include':[{'model':db[_0x717b('0x6e')],'as':'Contact','attributes':_0x120547,'include':[{'model':db[_0x717b('0x84')],'as':_0x717b('0x85'),'attributes':['id',_0x717b('0x26')]}]},{'model':db[_0x717b('0x86')],'as':_0x717b('0x87'),'attributes':['id',_0x717b('0x26')]},{'model':db[_0x717b('0x88')],'as':_0x717b('0x89'),'attributes':['id',_0x717b('0x26'),_0x717b('0x8a')]}]})['then'](function(_0x16d865){if(_0x16d865){return _0x16d865[_0x717b('0x22')]({'UserId':_0x45fc71['user']['id']},{'transaction':_0x146625});}});});}})[_0x717b('0x23')](handleEntityNotFound(_0x46ffa7,null))[_0x717b('0x23')](respondWithResult(_0x46ffa7,null))[_0x717b('0x4d')](handleError(_0x46ffa7,null));};exports[_0x717b('0x8b')]=function(_0x1f9a01,_0x3577f7,_0x423f98){var _0x41210e=[];return db[_0x717b('0x6e')]['describe']()[_0x717b('0x23')](function(_0x1497d7){_0x41210e=_['keys'](_0x1497d7);return _0x1f9a01[_0x717b('0x5d')][_0x717b('0x8c')]({'where':{'type':_0x717b('0x6f'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x717b('0x71'),_0x717b('0x72')],'raw':!![]});})[_0x717b('0x23')](function(_0xab5e57){if(_0xab5e57&&_0xab5e57[_0x717b('0x8d')]){return db['sequelize'][_0x717b('0x74')](function(_0x3961fd){var _0x21b0a9={'active':![],'recallme':!![],'id':_0x1f9a01[_0x717b('0x53')][_0x717b('0x8e')]};return db['CmHopper'][_0x717b('0x80')]({'attributes':['id','scheduledat','recallme'],'where':_0x21b0a9,'transaction':_0x3961fd,'lock':_0x3961fd['LOCK']['UPDATE'],'include':[{'model':db[_0x717b('0x6e')],'as':_0x717b('0x8f'),'attributes':_0x41210e,'include':[{'model':db['CmCompany'],'as':_0x717b('0x85'),'attributes':['id',_0x717b('0x26')]}]},{'model':db[_0x717b('0x86')],'as':_0x717b('0x87'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x717b('0x89'),'attributes':['id',_0x717b('0x26'),_0x717b('0x8a')]}]})['then'](function(_0x126243){if(_0x126243){return _0x126243[_0x717b('0x22')]({'UserId':_0x1f9a01['user']['id']},{'transaction':_0x3961fd});}});});}})['then'](handleEntityNotFound(_0x3577f7,null))['then'](respondWithResult(_0x3577f7,null))['catch'](handleError(_0x3577f7,null));};exports['getOpenContacts']=function(_0x16835d,_0x4f3da3,_0x70d89a){return _0x16835d[_0x717b('0x5d')][_0x717b('0x8c')]({'where':{'type':_0x717b('0x6f'),'dialActive':!![],'dialMethod':_0x717b('0x70')},'attributes':['id'],'raw':!![]})['then'](function(_0x451b8c){if(_0x451b8c&&_0x451b8c[_0x717b('0x8d')]){return db[_0x717b('0x50')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x717b('0x60')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x717b('0x28')](_0x451b8c,'id')},'$or':[{'UserId':null},{'UserId':_0x16835d[_0x717b('0x5d')]['id']}]}});}return 0x0;})['then'](function(_0x1951a2){if(!_['isNil'](_0x1951a2)&&_['isNumber'](_0x1951a2)){return _0x4f3da3[_0x717b('0x16')](0xc8)[_0x717b('0x1e')]({'contacts':_0x1951a2});}else{logger['error'](_0x717b('0x90'),_0x717b('0x91'),0x194,_0x717b('0x92'));_0x4f3da3[_0x717b('0x15')](0x194);}})[_0x717b('0x4d')](handleError(_0x4f3da3,null));};exports[_0x717b('0x93')]=function(_0x18d7a1,_0xedcc4b,_0x3a176a){var _0x208373=shared['timezones'];var _0x10c447=[];_[_0x717b('0x28')](_0x208373,function(_0x5e1677){_0x10c447[_0x717b('0x94')]({'id':_0x5e1677[_0x717b('0x26')],'name':_0x5e1677['name'],'utcOffset':_0x5e1677[_0x717b('0x95')]});});return _0xedcc4b[_0x717b('0x16')](0xc8)[_0x717b('0x1e')]({'tz':_0x10c447});};exports[_0x717b('0x96')]=function(_0x4d4f83,_0x33c0c8,_0x2c1e41){var _0x1a8629=shared[_0x717b('0x97')];var _0x12f054={};if(!_['isNil'](_0x1a8629[_0x4d4f83['body']['id']]))_0x12f054=_0x1a8629[_0x4d4f83[_0x717b('0x53')]['id']];return _0x33c0c8['status'](0xc8)[_0x717b('0x1e')](_0x12f054);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index f5bbf6b..238fe8e 100644 --- a/server/api/cmHopper/cmHopper.model.js +++ b/server/api/cmHopper/cmHopper.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x687b=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x687b,0x14a));var _0xb687=function(_0xa0ab99,_0x5496c1){_0xa0ab99=_0xa0ab99-0x0;var _0x3bf6b5=_0x687b[_0xa0ab99];return _0x3bf6b5;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xb687('0xc'),'fields':[_0xb687('0xc')]},{'name':'phone','fields':[_0xb687('0xd')]},{'name':_0xb687('0xe'),'fields':[_0xb687('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','cm_hopper','scheduledat','phone','priority','lodash'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xabce,0x103));var _0xeabc=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xabce[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./cmHopper.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('CmHopper',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]},{'name':'phone','fields':[_0xeabc('0xb')]},{'name':_0xeabc('0xc'),'fields':[_0xeabc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 75ddc33..7e0021f 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 _0x7949=['voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','name','CmList','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','twilio/lib/webhooks/webhooks','http','request','then','info','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','GetCmHopper','catch','ShowCmHopper','find','stringify','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','Contact','keys','User','Agent','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','LOCK','UPDATE','GetCmHopperPreview','GetContactByPhone','findOne','dialTimezone','DESC','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7949,0xb8));var _0x9794=function(_0x417928,_0x431a62){_0x417928=_0x417928-0x0;var _0x4fe4b9=_0x7949[_0x417928];return _0x4fe4b9;};'use strict';var _=require(_0x9794('0x0'));var util=require(_0x9794('0x1'));var moment=require(_0x9794('0x2'));var BPromise=require('bluebird');var rs=require(_0x9794('0x3'));var fs=require('fs');var Redis=require(_0x9794('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9794('0x5'))('rpc');var config=require(_0x9794('0x6'));var jayson=require('jayson/promise');const {validateExpressRequest}=require(_0x9794('0x7'));var client=jayson['client'][_0x9794('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4fafb1,_0x482976,_0x4d47fa){return new BPromise(function(_0x26d9a6,_0x250db5){return client[_0x9794('0x9')](_0x4fafb1,_0x4d47fa)[_0x9794('0xa')](function(_0x53d8a7){logger[_0x9794('0xb')](_0x9794('0xc'),_0x482976,'request\x20sent');logger[_0x9794('0xd')](_0x9794('0xe'),_0x482976,_0x9794('0xf'),JSON['stringify'](_0x53d8a7));if(_0x53d8a7[_0x9794('0x10')]){if(_0x53d8a7['error'][_0x9794('0x11')]===0x1f4){logger[_0x9794('0x10')](_0x9794('0xc'),_0x482976,_0x53d8a7[_0x9794('0x10')][_0x9794('0x12')]);return _0x250db5(_0x53d8a7[_0x9794('0x10')]['message']);}logger[_0x9794('0x10')](_0x9794('0xc'),_0x482976,_0x53d8a7[_0x9794('0x10')]['message']);return _0x26d9a6(_0x53d8a7[_0x9794('0x10')][_0x9794('0x12')]);}else{logger[_0x9794('0xb')](_0x9794('0xc'),_0x482976,_0x9794('0xf'));_0x26d9a6(_0x53d8a7[_0x9794('0x13')]['message']);}})['catch'](function(_0x3f4bc8){logger[_0x9794('0x10')](_0x9794('0xc'),_0x482976,_0x3f4bc8);_0x250db5(_0x3f4bc8);});});}exports['GetCmHopper']=function(_0x34d3f4){var _0x18db2c=this;return new Promise(function(_0x2064a9,_0x5b96bf){return db[_0x9794('0x14')][_0x9794('0x15')]({'raw':_0x34d3f4[_0x9794('0x16')]?_0x34d3f4[_0x9794('0x16')][_0x9794('0x17')]===undefined?!![]:![]:!![],'where':_0x34d3f4[_0x9794('0x16')]?_0x34d3f4['options'][_0x9794('0x18')]||null:null,'attributes':_0x34d3f4[_0x9794('0x16')]?_0x34d3f4[_0x9794('0x16')][_0x9794('0x19')]||null:null,'limit':_0x34d3f4[_0x9794('0x16')]?_0x34d3f4['options'][_0x9794('0x1a')]||null:null,'include':_0x34d3f4[_0x9794('0x16')]?_0x34d3f4['options'][_0x9794('0x1b')]?_[_0x9794('0x1c')](_0x34d3f4['options'][_0x9794('0x1b')],function(_0x29441c){return{'model':db[_0x29441c['model']],'as':_0x29441c['as'],'attributes':_0x29441c[_0x9794('0x19')],'include':_0x29441c[_0x9794('0x1b')]?_[_0x9794('0x1c')](_0x29441c[_0x9794('0x1b')],function(_0x137c1c){return{'model':db[_0x137c1c[_0x9794('0x1d')]],'as':_0x137c1c['as'],'attributes':_0x137c1c['attributes'],'include':_0x137c1c[_0x9794('0x1b')]?_[_0x9794('0x1c')](_0x137c1c[_0x9794('0x1b')],function(_0xfc63e5){return{'model':db[_0xfc63e5[_0x9794('0x1d')]],'as':_0xfc63e5['as'],'attributes':_0xfc63e5[_0x9794('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9794('0xa')](function(_0x35f92d){logger[_0x9794('0xb')](_0x9794('0x1e'),_0x34d3f4);logger[_0x9794('0xd')](_0x9794('0x1e'),_0x34d3f4,JSON['stringify'](_0x35f92d));_0x2064a9(_0x35f92d);})[_0x9794('0x1f')](function(_0x41a323){logger[_0x9794('0x10')](_0x9794('0x1e'),_0x41a323['message'],_0x34d3f4);_0x5b96bf(_0x18db2c[_0x9794('0x10')](0x1f4,_0x41a323[_0x9794('0x12')]));});});};exports[_0x9794('0x20')]=function(_0x4124bf){var _0x73d4=this;return new Promise(function(_0x5aa404,_0x27683f){return db[_0x9794('0x14')][_0x9794('0x21')]({'raw':_0x4124bf[_0x9794('0x16')]?_0x4124bf[_0x9794('0x16')][_0x9794('0x17')]===undefined?!![]:![]:!![],'where':_0x4124bf['options']?_0x4124bf[_0x9794('0x16')]['where']||null:null,'attributes':_0x4124bf[_0x9794('0x16')]?_0x4124bf[_0x9794('0x16')][_0x9794('0x19')]||null:null,'include':_0x4124bf[_0x9794('0x16')]?_0x4124bf[_0x9794('0x16')][_0x9794('0x1b')]?_['map'](_0x4124bf['options'][_0x9794('0x1b')],function(_0x414dc6){return{'model':db[_0x414dc6[_0x9794('0x1d')]],'as':_0x414dc6['as'],'attributes':_0x414dc6[_0x9794('0x19')],'include':_0x414dc6[_0x9794('0x1b')]?_[_0x9794('0x1c')](_0x414dc6[_0x9794('0x1b')],function(_0x657d8b){return{'model':db[_0x657d8b[_0x9794('0x1d')]],'as':_0x657d8b['as'],'attributes':_0x657d8b[_0x9794('0x19')],'include':_0x657d8b[_0x9794('0x1b')]?_[_0x9794('0x1c')](_0x657d8b['include'],function(_0x23139a){return{'model':db[_0x23139a['model']],'as':_0x23139a['as'],'attributes':_0x23139a[_0x9794('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9794('0xa')](function(_0xf814f){logger[_0x9794('0xb')](_0x9794('0x20'),_0x4124bf);logger[_0x9794('0xd')](_0x9794('0x20'),_0x4124bf,JSON[_0x9794('0x22')](_0xf814f));_0x5aa404(_0xf814f);})[_0x9794('0x1f')](function(_0xe3620e){logger[_0x9794('0x10')](_0x9794('0x20'),_0xe3620e[_0x9794('0x12')],_0x4124bf);_0x27683f(_0x73d4[_0x9794('0x10')](0x1f4,_0xe3620e[_0x9794('0x12')]));});});};exports[_0x9794('0x23')]=function(_0x1da102){var _0x197189=this;return new Promise(function(_0x2aeeef,_0x49ce93){return db[_0x9794('0x14')][_0x9794('0x24')](_0x1da102[_0x9794('0x25')],{'raw':_0x1da102['options']?_0x1da102['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x310d62){logger['info'](_0x9794('0x23'),_0x1da102);logger['debug']('CreateCmHopper',_0x1da102,JSON[_0x9794('0x22')](_0x310d62));_0x2aeeef(_0x310d62);})[_0x9794('0x1f')](function(_0x1b0aed){logger[_0x9794('0x10')](_0x9794('0x23'),_0x1b0aed['message'],_0x1da102);_0x49ce93(_0x197189[_0x9794('0x10')](0x1f4,_0x1b0aed[_0x9794('0x12')]));});});};exports[_0x9794('0x26')]=function(_0x25763b){var _0x6b8bb9=this;return new Promise(function(_0x552a9f,_0x5e2f38){return db[_0x9794('0x14')][_0x9794('0x27')](_0x25763b[_0x9794('0x25')],{'raw':_0x25763b[_0x9794('0x16')]?_0x25763b[_0x9794('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25763b['options']?_0x25763b[_0x9794('0x16')]['where']||null:null,'attributes':_0x25763b[_0x9794('0x16')]?_0x25763b[_0x9794('0x16')]['attributes']||null:null,'limit':_0x25763b[_0x9794('0x16')]?_0x25763b[_0x9794('0x16')][_0x9794('0x1a')]||null:null})['then'](function(_0x2d606b){logger[_0x9794('0xb')](_0x9794('0x26'),_0x25763b);logger['info'](_0x9794('0x28'),JSON[_0x9794('0x22')](_0x25763b[_0x9794('0x16')][_0x9794('0x18')]),_0x25763b['body'][_0x9794('0x29')]);logger['debug'](_0x9794('0x26'),_0x25763b,JSON[_0x9794('0x22')](_0x2d606b));_0x552a9f(_0x2d606b);})['catch'](function(_0xf1d826){logger[_0x9794('0x10')](_0x9794('0x26'),_0xf1d826[_0x9794('0x12')],_0x25763b);_0x5e2f38(_0x6b8bb9['error'](0x1f4,_0xf1d826[_0x9794('0x12')]));});});};exports[_0x9794('0x2a')]=function(_0xb0ae26){var _0x46c1d8=this;return new Promise(function(_0x44d553,_0x34bf42){return db[_0x9794('0x14')][_0x9794('0x2b')]({'where':_0xb0ae26[_0x9794('0x16')]?_0xb0ae26['options'][_0x9794('0x18')]||null:null})[_0x9794('0xa')](function(_0x56a63b){logger[_0x9794('0xb')]('DestroyCmHopper',_0xb0ae26);logger[_0x9794('0xd')](_0x9794('0x2a'),_0xb0ae26,JSON[_0x9794('0x22')](_0x56a63b));_0x44d553(_0x56a63b);})[_0x9794('0x1f')](function(_0x26c818){logger[_0x9794('0x10')](_0x9794('0x2a'),_0x26c818['message'],_0xb0ae26);_0x34bf42(_0x46c1d8[_0x9794('0x10')](0x1f4,_0x26c818[_0x9794('0x12')]));});});};exports[_0x9794('0x2c')]=function(_0x3e8d04){var _0x4d7f27=this;return new Promise(function(_0x113fae,_0x38562c){return db[_0x9794('0x2d')][_0x9794('0x2e')]()[_0x9794('0xa')](function(_0xad15d0){return db[_0x9794('0x2f')][_0x9794('0x30')](function(_0x1a3c7d){return db['CmHopper'][_0x9794('0x15')]({'where':_0x3e8d04[_0x9794('0x16')]?_0x3e8d04['options'][_0x9794('0x18')]||null:null,'attributes':_0x3e8d04[_0x9794('0x16')]?_0x3e8d04[_0x9794('0x16')]['attributes']||null:null,'limit':_0x3e8d04['options']?_0x3e8d04[_0x9794('0x16')][_0x9794('0x1a')]||null:null,'order':_0x3e8d04[_0x9794('0x16')]?_0x3e8d04[_0x9794('0x16')][_0x9794('0x31')]||null:null,'transaction':_0x1a3c7d,'lock':_0x1a3c7d['LOCK']['UPDATE'],'include':[{'model':db[_0x9794('0x2d')],'as':_0x9794('0x32'),'attributes':_[_0x9794('0x33')](_0xad15d0)},{'model':db[_0x9794('0x34')],'as':_0x9794('0x35'),'attributes':['id','name',_0x9794('0x36')]}]})[_0x9794('0xa')](function(_0x1d91a9){var _0x54c876=[];var _0x6a9f40=[];for(var _0x1dc363=0x0;_0x1dc363<_0x1d91a9[_0x9794('0x37')];_0x1dc363+=0x1){var _0x447257=_0x1d91a9[_0x1dc363][_0x9794('0x38')];if(_0x447257===null){_0x54c876[_0x9794('0x39')](_0x1d91a9[_0x1dc363][_0x9794('0x27')](_0x3e8d04[_0x9794('0x25')],{'transaction':_0x1a3c7d}));}else if(!_0x6a9f40[_0x9794('0x3a')](_0x447257)){_0x6a9f40['push'](_0x447257);_0x54c876[_0x9794('0x39')](_0x1d91a9[_0x1dc363][_0x9794('0x27')](_0x3e8d04['body'],{'transaction':_0x1a3c7d}));}}return BPromise[_0x9794('0x3b')](_0x54c876);});})[_0x9794('0xa')](function(_0x994d34){logger[_0x9794('0xb')](_0x9794('0x2c'),_0x3e8d04);if(_0x994d34[_0x9794('0x37')]>0x0){logger['info'](_0x9794('0x3c'),_0x994d34[0x0][_0x9794('0x3d')]['id'],_0x994d34[0x0][_0x9794('0x3d')][_0x9794('0x3e')],_0x994d34[0x0]['dataValues'][_0x9794('0x29')]);}logger[_0x9794('0xd')](_0x9794('0x2c'),_0x3e8d04,JSON['stringify'](_0x994d34));_0x113fae(_0x994d34);})[_0x9794('0x1f')](function(_0x1865ae){logger[_0x9794('0x10')](_0x9794('0x2c'),_0x1865ae[_0x9794('0x12')],_0x3e8d04);_0x38562c(_0x4d7f27[_0x9794('0x10')](0x1f4,_0x1865ae['message']));});});});};exports[_0x9794('0x3f')]=function(_0x265b0e){var _0x14e127=this;return new Promise(function(_0x5dafa0,_0x25c71f){return db[_0x9794('0x2f')][_0x9794('0x30')](function(_0x363956){return db['CmHopperFinal'][_0x9794('0x24')](_0x265b0e['body'],{'raw':_0x265b0e[_0x9794('0x16')]?_0x265b0e['options'][_0x9794('0x17')]===undefined?!![]:![]:!![],'transaction':_0x363956})['then'](function(){logger[_0x9794('0xb')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x9794('0x22')](_0x265b0e[_0x9794('0x16')][_0x9794('0x18')]),_0x265b0e[_0x9794('0x16')][_0x9794('0x18')][_0x9794('0x29')]);return db[_0x9794('0x14')][_0x9794('0x2b')]({'where':_0x265b0e[_0x9794('0x16')]?_0x265b0e[_0x9794('0x16')][_0x9794('0x18')]||null:null,'transaction':_0x363956});});})[_0x9794('0xa')](function(_0x467c7c){logger[_0x9794('0xb')]('MoveContactManagedDialer',_0x265b0e);logger[_0x9794('0xd')]('MoveContactManagedDialer',_0x265b0e,JSON[_0x9794('0x22')](_0x467c7c));_0x5dafa0(_0x467c7c);})[_0x9794('0x1f')](function(_0x3845c3){logger[_0x9794('0x10')](_0x9794('0x3f'),_0x3845c3[_0x9794('0x12')],_0x265b0e);_0x25c71f(_0x14e127['error'](0x1f4,_0x3845c3[_0x9794('0x12')]));});});};exports[_0x9794('0x40')]=function(_0x236620){var _0x3b4fbf=this;return new Promise(function(_0x3264d9,_0x433e44){return db[_0x9794('0x14')][_0x9794('0x15')]({'raw':_0x236620[_0x9794('0x16')]?_0x236620[_0x9794('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x236620[_0x9794('0x16')]?_0x236620['options'][_0x9794('0x18')]||null:null,'attributes':[[db['sequelize']['fn'](_0x9794('0x41'),db[_0x9794('0x2f')]['fn']('IF',db['sequelize'][_0x9794('0x42')](_0x9794('0x43')+util[_0x9794('0x44')](_0x9794('0x45'),moment()[_0x9794('0x44')](_0x9794('0x46')))+_0x9794('0x47')))),_0x9794('0x48')]]})[_0x9794('0xa')](function(_0x523765){logger[_0x9794('0xb')]('CountReScheduled',_0x236620);logger[_0x9794('0xd')](_0x9794('0x40'),_0x236620,JSON[_0x9794('0x22')](_0x523765));_0x3264d9(_0x523765);})[_0x9794('0x1f')](function(_0x41855d){logger[_0x9794('0x10')](_0x9794('0x40'),_0x41855d['message'],_0x236620);_0x433e44(_0x3b4fbf[_0x9794('0x10')](0x1f4,_0x41855d[_0x9794('0x12')]));});});};exports[_0x9794('0x49')]=function(_0x881ca1){var _0x216110=this;return new Promise(function(_0x387835,_0x28378b){return db[_0x9794('0x2d')]['describe']()[_0x9794('0xa')](function(_0x495def){return db[_0x9794('0x2f')][_0x9794('0x30')](function(_0x328286){return db[_0x9794('0x14')][_0x9794('0x15')]({'where':_0x881ca1[_0x9794('0x16')]?_0x881ca1[_0x9794('0x16')][_0x9794('0x18')]||null:null,'attributes':_0x881ca1[_0x9794('0x16')]?_0x881ca1[_0x9794('0x16')][_0x9794('0x19')]||null:null,'limit':0x1,'order':_0x881ca1['options']?_0x881ca1[_0x9794('0x16')][_0x9794('0x31')]||null:null,'group':db[_0x9794('0x14')][_0x9794('0x38')],'transaction':_0x328286,'lock':_0x328286[_0x9794('0x4a')][_0x9794('0x4b')],'include':_0x881ca1[_0x9794('0x16')]?_0x881ca1['options']['include']?_[_0x9794('0x1c')](_0x881ca1[_0x9794('0x16')][_0x9794('0x1b')],function(_0x3821e5){return{'model':db[_0x3821e5[_0x9794('0x1d')]],'as':_0x3821e5['as'],'attributes':_0x3821e5[_0x9794('0x19')],'include':_0x3821e5[_0x9794('0x1b')]?_[_0x9794('0x1c')](_0x3821e5[_0x9794('0x1b')],function(_0x266061){return{'model':db[_0x266061[_0x9794('0x1d')]],'as':_0x266061['as'],'attributes':_0x266061[_0x9794('0x19')],'include':_0x266061[_0x9794('0x1b')]?_['map'](_0x266061[_0x9794('0x1b')],function(_0x2106b3){return{'model':db[_0x2106b3[_0x9794('0x1d')]],'as':_0x2106b3['as'],'attributes':_0x2106b3[_0x9794('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9794('0xa')](function(_0x43f019){var _0x2f1622=[];for(var _0x26ecd0=0x0;_0x26ecd0<_0x43f019[_0x9794('0x37')];_0x26ecd0+=0x1){_0x2f1622[_0x9794('0x39')](_0x43f019[_0x26ecd0][_0x9794('0x27')](_0x881ca1['body'],{'transaction':_0x328286}));}return BPromise[_0x9794('0x3b')](_0x2f1622);});})['then'](function(_0x9d6602){logger[_0x9794('0xb')](_0x9794('0x49'),_0x881ca1);logger[_0x9794('0xd')]('GetContactRecallMe',_0x881ca1,JSON[_0x9794('0x22')](_0x9d6602));_0x387835(_0x9d6602);})[_0x9794('0x1f')](function(_0x4fd050){logger['error'](_0x9794('0x49'),_0x4fd050[_0x9794('0x12')],_0x881ca1);_0x28378b(_0x216110[_0x9794('0x10')](0x1f4,_0x4fd050[_0x9794('0x12')]));});});});};exports[_0x9794('0x4c')]=function(_0x2116c3){var _0x341580=this;return new Promise(function(_0x446397,_0x250f03){db[_0x9794('0x2d')][_0x9794('0x2e')]()[_0x9794('0xa')](function(_0x1931e2){return db[_0x9794('0x14')][_0x9794('0x15')]({'raw':_0x2116c3[_0x9794('0x16')]?_0x2116c3[_0x9794('0x16')][_0x9794('0x17')]===undefined?!![]:![]:!![],'where':_0x2116c3[_0x9794('0x16')]?_0x2116c3[_0x9794('0x16')][_0x9794('0x18')]||null:null,'attributes':_0x2116c3['options']?_0x2116c3[_0x9794('0x16')][_0x9794('0x19')]||null:null,'limit':_0x2116c3[_0x9794('0x16')]?_0x2116c3['options']['limit']||null:null,'include':_0x2116c3[_0x9794('0x16')]?_0x2116c3[_0x9794('0x16')][_0x9794('0x1b')]?_['map'](_0x2116c3[_0x9794('0x16')][_0x9794('0x1b')],function(_0x56f219){return{'model':db[_0x56f219[_0x9794('0x1d')]],'as':_0x56f219['as'],'attributes':_0x56f219['as']===_0x9794('0x32')?_[_0x9794('0x33')](_0x1931e2):_0x56f219[_0x9794('0x19')],'include':_0x56f219[_0x9794('0x1b')]?_[_0x9794('0x1c')](_0x56f219[_0x9794('0x1b')],function(_0x404b88){return{'model':db[_0x404b88[_0x9794('0x1d')]],'as':_0x404b88['as'],'attributes':_0x404b88[_0x9794('0x19')],'include':_0x404b88['include']?_[_0x9794('0x1c')](_0x404b88[_0x9794('0x1b')],function(_0x35dcf9){return{'model':db[_0x35dcf9[_0x9794('0x1d')]],'as':_0x35dcf9['as'],'attributes':_0x35dcf9[_0x9794('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9794('0xa')](function(_0x5c3ab0){logger[_0x9794('0xb')](_0x9794('0x1e'),_0x2116c3);logger[_0x9794('0xd')]('GetCmHopper',_0x2116c3,JSON[_0x9794('0x22')](_0x5c3ab0));_0x446397(_0x5c3ab0);})['catch'](function(_0x1fc4b4){logger['error'](_0x9794('0x1e'),_0x1fc4b4[_0x9794('0x12')],_0x2116c3);_0x250f03(_0x341580[_0x9794('0x10')](0x1f4,_0x1fc4b4[_0x9794('0x12')]));});});});};exports[_0x9794('0x4d')]=function(_0x5ac780){var _0x2f9c47=this;return new Promise(function(_0x106c8f,_0x2cef24){return db[_0x9794('0x2d')][_0x9794('0x4e')]({'raw':!![],'where':{'phone':_0x5ac780['options'][_0x9794('0x18')]['phone']},'attributes':['id',_0x9794('0x4f')],'order':[['id',_0x9794('0x50')]]})[_0x9794('0xa')](function(_0x585aa4){logger[_0x9794('0xb')]('getContactByPhone',_0x5ac780);logger[_0x9794('0xd')]('getContactByPhone',_0x5ac780,JSON[_0x9794('0x22')](_0x585aa4));_0x106c8f(_0x585aa4);})[_0x9794('0x1f')](function(_0x17fdc6){logger['error']('getContactByPhone',_0x17fdc6[_0x9794('0x12')],_0x5ac780);_0x2cef24(_0x2f9c47['error'](0x1f4,_0x17fdc6['message']));});});};exports[_0x9794('0x51')]=function(_0x2da642){var _0x3740fd=this;return new Promise(function(_0x5ca409,_0xcf2fa3){return db['sequelize'][_0x9794('0x30')](function(_0x2d2c9e){return db[_0x9794('0x14')]['update']({'active':![]},{'where':{},'transaction':_0x2d2c9e})[_0x9794('0xa')](function(_0x5f8c0d){logger[_0x9794('0xb')](_0x9794('0x51'),_0x2da642);logger[_0x9794('0xd')](_0x9794('0x51'),_0x2da642,JSON[_0x9794('0x22')](_0x5f8c0d));_0x5ca409(_0x5f8c0d);})['catch'](function(_0x4922be){logger[_0x9794('0x10')](_0x9794('0x51'),_0x4922be['message'],_0x2da642);_0xcf2fa3(_0x3740fd['error'](0x1f4,_0x4922be[_0x9794('0x12')]));});});});};exports[_0x9794('0x52')]=function(_0x4cb58c){var _0x20d380=this;var _0x271e3d=_0x4cb58c[_0x9794('0x25')][_0x9794('0x18')][_0x9794('0x53')];var _0x3504fd=_0x4cb58c[_0x9794('0x25')][_0x9794('0x18')][_0x9794('0x54')];return new Promise(function(_0x35c4bb,_0x24f82a){return db[_0x9794('0x14')][_0x9794('0x15')]({'where':{'voiceQueueId':_0x271e3d,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x9794('0x2f')]['literal'](_0x9794('0x55')+_0x3504fd+_0x9794('0x56'))}},'include':[{'model':db['CmContact'],'as':_0x9794('0x32')},{'model':db[_0x9794('0x34')],'as':'Agent','attributes':['id',_0x9794('0x57'),_0x9794('0x36')]},{'model':db[_0x9794('0x58')],'as':'List'}]})[_0x9794('0xa')](function(_0xbacd3){return db[_0x9794('0x2f')][_0x9794('0x30')](function(_0x17817c){return db[_0x9794('0x14')][_0x9794('0x27')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x271e3d,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x9794('0x2f')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x3504fd+'\x20MINUTE')}},'transaction':_0x17817c})[_0x9794('0xa')](function(_0xeada4b){_0x35c4bb(_0xbacd3);})[_0x9794('0x1f')](function(_0x1a1688){logger['error'](_0x9794('0x52'),_0x1a1688[_0x9794('0x12')],_0x4cb58c);_0x24f82a(validateExpressRequest);});});})[_0x9794('0x1f')](function(_0xfae12e){logger[_0x9794('0x10')](_0x9794('0x52'),_0xfae12e[_0x9794('0x12')],_0x4cb58c);_0x24f82a(_0x20d380['error'](0x1f4,_0xfae12e[_0x9794('0x12')]));});});}; \ No newline at end of file +var _0x6fc4=['request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','code','error','message','result','options','where','attributes','limit','map','include','model','GetCmHopper','stringify','catch','ShowCmHopper','CmHopper','find','CreateCmHopper','create','update','raw','UpdateCmHopper','active','destroy','DestroyCmHopper','GetContactDialer','CmContact','sequelize','transaction','findAll','order','LOCK','UPDATE','User','name','voicePause','UserId','body','includes','push','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','all','GetCmHopperPreview','Contact','keys','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueId','interval','\x20MINUTE','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','twilio/lib/webhooks/webhooks','client','http'];(function(_0x4f6e24,_0xbe65eb){var _0x3a4520=function(_0x4a7bfd){while(--_0x4a7bfd){_0x4f6e24['push'](_0x4f6e24['shift']());}};_0x3a4520(++_0xbe65eb);}(_0x6fc4,0x15f));var _0x46fc=function(_0x2383bc,_0x2d5ec9){_0x2383bc=_0x2383bc-0x0;var _0x283573=_0x6fc4[_0x2383bc];return _0x283573;};'use strict';var _=require(_0x46fc('0x0'));var util=require('util');var moment=require(_0x46fc('0x1'));var BPromise=require(_0x46fc('0x2'));var rs=require(_0x46fc('0x3'));var fs=require('fs');var Redis=require(_0x46fc('0x4'));var db=require(_0x46fc('0x5'))['db'];var utils=require(_0x46fc('0x6'));var logger=require(_0x46fc('0x7'))(_0x46fc('0x8'));var config=require(_0x46fc('0x9'));var jayson=require('jayson/promise');const {validateExpressRequest}=require(_0x46fc('0xa'));var client=jayson[_0x46fc('0xb')][_0x46fc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x86e9eb,_0x1623d6,_0x5f24ef){return new BPromise(function(_0x51eeb6,_0x45636b){return client[_0x46fc('0xd')](_0x86e9eb,_0x5f24ef)[_0x46fc('0xe')](function(_0x316256){logger[_0x46fc('0xf')](_0x46fc('0x10'),_0x1623d6,_0x46fc('0x11'));logger[_0x46fc('0x12')](_0x46fc('0x13'),_0x1623d6,_0x46fc('0x11'),JSON['stringify'](_0x316256));if(_0x316256['error']){if(_0x316256['error'][_0x46fc('0x14')]===0x1f4){logger['error'](_0x46fc('0x10'),_0x1623d6,_0x316256[_0x46fc('0x15')][_0x46fc('0x16')]);return _0x45636b(_0x316256[_0x46fc('0x15')][_0x46fc('0x16')]);}logger[_0x46fc('0x15')](_0x46fc('0x10'),_0x1623d6,_0x316256[_0x46fc('0x15')][_0x46fc('0x16')]);return _0x51eeb6(_0x316256['error'][_0x46fc('0x16')]);}else{logger['info']('CmHopper,\x20%s,\x20%s',_0x1623d6,_0x46fc('0x11'));_0x51eeb6(_0x316256[_0x46fc('0x17')]['message']);}})['catch'](function(_0x31e2a5){logger[_0x46fc('0x15')](_0x46fc('0x10'),_0x1623d6,_0x31e2a5);_0x45636b(_0x31e2a5);});});}exports['GetCmHopper']=function(_0x4f2b57){var _0x5e016b=this;return new Promise(function(_0x40adcb,_0x32a281){return db['CmHopper']['findAll']({'raw':_0x4f2b57[_0x46fc('0x18')]?_0x4f2b57[_0x46fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4f2b57['options']?_0x4f2b57[_0x46fc('0x18')][_0x46fc('0x19')]||null:null,'attributes':_0x4f2b57[_0x46fc('0x18')]?_0x4f2b57[_0x46fc('0x18')][_0x46fc('0x1a')]||null:null,'limit':_0x4f2b57[_0x46fc('0x18')]?_0x4f2b57[_0x46fc('0x18')][_0x46fc('0x1b')]||null:null,'include':_0x4f2b57[_0x46fc('0x18')]?_0x4f2b57[_0x46fc('0x18')]['include']?_[_0x46fc('0x1c')](_0x4f2b57[_0x46fc('0x18')][_0x46fc('0x1d')],function(_0x163412){return{'model':db[_0x163412[_0x46fc('0x1e')]],'as':_0x163412['as'],'attributes':_0x163412[_0x46fc('0x1a')],'include':_0x163412[_0x46fc('0x1d')]?_[_0x46fc('0x1c')](_0x163412[_0x46fc('0x1d')],function(_0x38032f){return{'model':db[_0x38032f['model']],'as':_0x38032f['as'],'attributes':_0x38032f[_0x46fc('0x1a')],'include':_0x38032f[_0x46fc('0x1d')]?_['map'](_0x38032f[_0x46fc('0x1d')],function(_0x4f8e76){return{'model':db[_0x4f8e76[_0x46fc('0x1e')]],'as':_0x4f8e76['as'],'attributes':_0x4f8e76[_0x46fc('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f2b80){logger[_0x46fc('0xf')](_0x46fc('0x1f'),_0x4f2b57);logger[_0x46fc('0x12')]('GetCmHopper',_0x4f2b57,JSON[_0x46fc('0x20')](_0x4f2b80));_0x40adcb(_0x4f2b80);})[_0x46fc('0x21')](function(_0x24603d){logger[_0x46fc('0x15')]('GetCmHopper',_0x24603d[_0x46fc('0x16')],_0x4f2b57);_0x32a281(_0x5e016b[_0x46fc('0x15')](0x1f4,_0x24603d['message']));});});};exports[_0x46fc('0x22')]=function(_0x573024){var _0x122389=this;return new Promise(function(_0x36b944,_0x39f11a){return db[_0x46fc('0x23')][_0x46fc('0x24')]({'raw':_0x573024[_0x46fc('0x18')]?_0x573024['options']['raw']===undefined?!![]:![]:!![],'where':_0x573024[_0x46fc('0x18')]?_0x573024[_0x46fc('0x18')]['where']||null:null,'attributes':_0x573024[_0x46fc('0x18')]?_0x573024[_0x46fc('0x18')][_0x46fc('0x1a')]||null:null,'include':_0x573024[_0x46fc('0x18')]?_0x573024[_0x46fc('0x18')][_0x46fc('0x1d')]?_[_0x46fc('0x1c')](_0x573024['options']['include'],function(_0x126666){return{'model':db[_0x126666[_0x46fc('0x1e')]],'as':_0x126666['as'],'attributes':_0x126666['attributes'],'include':_0x126666[_0x46fc('0x1d')]?_['map'](_0x126666[_0x46fc('0x1d')],function(_0x3d05c4){return{'model':db[_0x3d05c4[_0x46fc('0x1e')]],'as':_0x3d05c4['as'],'attributes':_0x3d05c4[_0x46fc('0x1a')],'include':_0x3d05c4['include']?_[_0x46fc('0x1c')](_0x3d05c4[_0x46fc('0x1d')],function(_0x155d51){return{'model':db[_0x155d51[_0x46fc('0x1e')]],'as':_0x155d51['as'],'attributes':_0x155d51[_0x46fc('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b3238){logger[_0x46fc('0xf')](_0x46fc('0x22'),_0x573024);logger[_0x46fc('0x12')](_0x46fc('0x22'),_0x573024,JSON[_0x46fc('0x20')](_0x3b3238));_0x36b944(_0x3b3238);})[_0x46fc('0x21')](function(_0x76cf12){logger['error'](_0x46fc('0x22'),_0x76cf12['message'],_0x573024);_0x39f11a(_0x122389[_0x46fc('0x15')](0x1f4,_0x76cf12[_0x46fc('0x16')]));});});};exports[_0x46fc('0x25')]=function(_0x4bfed8){var _0x8b2305=this;return new Promise(function(_0x4005df,_0x4fd987){return db[_0x46fc('0x23')][_0x46fc('0x26')](_0x4bfed8['body'],{'raw':_0x4bfed8[_0x46fc('0x18')]?_0x4bfed8[_0x46fc('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x19f668){logger[_0x46fc('0xf')](_0x46fc('0x25'),_0x4bfed8);logger['debug']('CreateCmHopper',_0x4bfed8,JSON['stringify'](_0x19f668));_0x4005df(_0x19f668);})[_0x46fc('0x21')](function(_0x41d282){logger[_0x46fc('0x15')]('CreateCmHopper',_0x41d282['message'],_0x4bfed8);_0x4fd987(_0x8b2305[_0x46fc('0x15')](0x1f4,_0x41d282[_0x46fc('0x16')]));});});};exports['UpdateCmHopper']=function(_0xec1d89){var _0x4203ff=this;return new Promise(function(_0x4785b9,_0x403100){return db[_0x46fc('0x23')][_0x46fc('0x27')](_0xec1d89['body'],{'raw':_0xec1d89[_0x46fc('0x18')]?_0xec1d89['options'][_0x46fc('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xec1d89[_0x46fc('0x18')]?_0xec1d89[_0x46fc('0x18')][_0x46fc('0x19')]||null:null,'attributes':_0xec1d89['options']?_0xec1d89['options'][_0x46fc('0x1a')]||null:null,'limit':_0xec1d89[_0x46fc('0x18')]?_0xec1d89[_0x46fc('0x18')][_0x46fc('0x1b')]||null:null})[_0x46fc('0xe')](function(_0x242784){logger[_0x46fc('0xf')](_0x46fc('0x29'),_0xec1d89);logger[_0x46fc('0xf')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x46fc('0x20')](_0xec1d89[_0x46fc('0x18')]['where']),_0xec1d89['body'][_0x46fc('0x2a')]);logger[_0x46fc('0x12')](_0x46fc('0x29'),_0xec1d89,JSON[_0x46fc('0x20')](_0x242784));_0x4785b9(_0x242784);})[_0x46fc('0x21')](function(_0x163f41){logger[_0x46fc('0x15')](_0x46fc('0x29'),_0x163f41[_0x46fc('0x16')],_0xec1d89);_0x403100(_0x4203ff[_0x46fc('0x15')](0x1f4,_0x163f41['message']));});});};exports['DestroyCmHopper']=function(_0x1fbf32){var _0x3c3bf8=this;return new Promise(function(_0x151fcc,_0x4bcb14){return db[_0x46fc('0x23')][_0x46fc('0x2b')]({'where':_0x1fbf32[_0x46fc('0x18')]?_0x1fbf32[_0x46fc('0x18')][_0x46fc('0x19')]||null:null})['then'](function(_0x387389){logger[_0x46fc('0xf')](_0x46fc('0x2c'),_0x1fbf32);logger['debug'](_0x46fc('0x2c'),_0x1fbf32,JSON['stringify'](_0x387389));_0x151fcc(_0x387389);})['catch'](function(_0x509a97){logger['error'](_0x46fc('0x2c'),_0x509a97[_0x46fc('0x16')],_0x1fbf32);_0x4bcb14(_0x3c3bf8['error'](0x1f4,_0x509a97[_0x46fc('0x16')]));});});};exports[_0x46fc('0x2d')]=function(_0xbc1744){var _0x35a1ac=this;return new Promise(function(_0x2226db,_0x4959fa){return db[_0x46fc('0x2e')]['describe']()[_0x46fc('0xe')](function(_0x31e39a){return db[_0x46fc('0x2f')][_0x46fc('0x30')](function(_0x161960){return db[_0x46fc('0x23')][_0x46fc('0x31')]({'where':_0xbc1744[_0x46fc('0x18')]?_0xbc1744[_0x46fc('0x18')][_0x46fc('0x19')]||null:null,'attributes':_0xbc1744[_0x46fc('0x18')]?_0xbc1744[_0x46fc('0x18')][_0x46fc('0x1a')]||null:null,'limit':_0xbc1744['options']?_0xbc1744['options'][_0x46fc('0x1b')]||null:null,'order':_0xbc1744[_0x46fc('0x18')]?_0xbc1744[_0x46fc('0x18')][_0x46fc('0x32')]||null:null,'transaction':_0x161960,'lock':_0x161960[_0x46fc('0x33')][_0x46fc('0x34')],'include':[{'model':db[_0x46fc('0x2e')],'as':'Contact','attributes':_['keys'](_0x31e39a)},{'model':db[_0x46fc('0x35')],'as':'Agent','attributes':['id',_0x46fc('0x36'),_0x46fc('0x37')]}]})[_0x46fc('0xe')](function(_0x1fe125){var _0x193e59=[];var _0x272a3a=[];for(var _0x2d0ac2=0x0;_0x2d0ac2<_0x1fe125['length'];_0x2d0ac2+=0x1){var _0x4deb3b=_0x1fe125[_0x2d0ac2][_0x46fc('0x38')];if(_0x4deb3b===null){_0x193e59['push'](_0x1fe125[_0x2d0ac2]['update'](_0xbc1744[_0x46fc('0x39')],{'transaction':_0x161960}));}else if(!_0x272a3a[_0x46fc('0x3a')](_0x4deb3b)){_0x272a3a[_0x46fc('0x3b')](_0x4deb3b);_0x193e59[_0x46fc('0x3b')](_0x1fe125[_0x2d0ac2][_0x46fc('0x27')](_0xbc1744[_0x46fc('0x39')],{'transaction':_0x161960}));}}return BPromise['all'](_0x193e59);});})[_0x46fc('0xe')](function(_0x39db69){logger[_0x46fc('0xf')](_0x46fc('0x2d'),_0xbc1744);if(_0x39db69['length']>0x0){logger[_0x46fc('0xf')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x39db69[0x0][_0x46fc('0x3c')]['id'],_0x39db69[0x0][_0x46fc('0x3c')][_0x46fc('0x3d')],_0x39db69[0x0][_0x46fc('0x3c')][_0x46fc('0x2a')]);}logger[_0x46fc('0x12')](_0x46fc('0x2d'),_0xbc1744,JSON[_0x46fc('0x20')](_0x39db69));_0x2226db(_0x39db69);})['catch'](function(_0x5b053e){logger[_0x46fc('0x15')](_0x46fc('0x2d'),_0x5b053e['message'],_0xbc1744);_0x4959fa(_0x35a1ac[_0x46fc('0x15')](0x1f4,_0x5b053e['message']));});});});};exports[_0x46fc('0x3e')]=function(_0x51effe){var _0x254d97=this;return new Promise(function(_0x38f9c8,_0x823ad5){return db[_0x46fc('0x2f')][_0x46fc('0x30')](function(_0x2db47f){return db[_0x46fc('0x3f')][_0x46fc('0x26')](_0x51effe[_0x46fc('0x39')],{'raw':_0x51effe[_0x46fc('0x18')]?_0x51effe[_0x46fc('0x18')][_0x46fc('0x28')]===undefined?!![]:![]:!![],'transaction':_0x2db47f})[_0x46fc('0xe')](function(){logger[_0x46fc('0xf')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x46fc('0x20')](_0x51effe['options'][_0x46fc('0x19')]),_0x51effe['options'][_0x46fc('0x19')]['active']);return db['CmHopper']['destroy']({'where':_0x51effe['options']?_0x51effe[_0x46fc('0x18')][_0x46fc('0x19')]||null:null,'transaction':_0x2db47f});});})[_0x46fc('0xe')](function(_0x1a7f8e){logger[_0x46fc('0xf')](_0x46fc('0x3e'),_0x51effe);logger[_0x46fc('0x12')](_0x46fc('0x3e'),_0x51effe,JSON[_0x46fc('0x20')](_0x1a7f8e));_0x38f9c8(_0x1a7f8e);})[_0x46fc('0x21')](function(_0x5a6549){logger[_0x46fc('0x15')](_0x46fc('0x3e'),_0x5a6549['message'],_0x51effe);_0x823ad5(_0x254d97[_0x46fc('0x15')](0x1f4,_0x5a6549['message']));});});};exports[_0x46fc('0x40')]=function(_0x246a60){var _0x499bdd=this;return new Promise(function(_0x58a013,_0x280692){return db[_0x46fc('0x23')][_0x46fc('0x31')]({'raw':_0x246a60[_0x46fc('0x18')]?_0x246a60[_0x46fc('0x18')][_0x46fc('0x28')]===undefined?!![]:![]:!![],'where':_0x246a60[_0x46fc('0x18')]?_0x246a60[_0x46fc('0x18')]['where']||null:null,'attributes':[[db[_0x46fc('0x2f')]['fn'](_0x46fc('0x41'),db[_0x46fc('0x2f')]['fn']('IF',db[_0x46fc('0x2f')]['literal'](_0x46fc('0x42')+util[_0x46fc('0x43')](_0x46fc('0x44'),moment()[_0x46fc('0x43')](_0x46fc('0x45')))+_0x46fc('0x46')))),_0x46fc('0x47')]]})[_0x46fc('0xe')](function(_0x48cf5c){logger[_0x46fc('0xf')](_0x46fc('0x40'),_0x246a60);logger[_0x46fc('0x12')](_0x46fc('0x40'),_0x246a60,JSON['stringify'](_0x48cf5c));_0x58a013(_0x48cf5c);})[_0x46fc('0x21')](function(_0x1571d1){logger[_0x46fc('0x15')](_0x46fc('0x40'),_0x1571d1['message'],_0x246a60);_0x280692(_0x499bdd['error'](0x1f4,_0x1571d1['message']));});});};exports[_0x46fc('0x48')]=function(_0x40592c){var _0x22dadc=this;return new Promise(function(_0x5d3be9,_0x57de4d){return db[_0x46fc('0x2e')][_0x46fc('0x49')]()[_0x46fc('0xe')](function(_0x50b3e0){return db[_0x46fc('0x2f')][_0x46fc('0x30')](function(_0x340907){return db[_0x46fc('0x23')][_0x46fc('0x31')]({'where':_0x40592c[_0x46fc('0x18')]?_0x40592c[_0x46fc('0x18')][_0x46fc('0x19')]||null:null,'attributes':_0x40592c[_0x46fc('0x18')]?_0x40592c['options'][_0x46fc('0x1a')]||null:null,'limit':0x1,'order':_0x40592c[_0x46fc('0x18')]?_0x40592c[_0x46fc('0x18')][_0x46fc('0x32')]||null:null,'group':db[_0x46fc('0x23')][_0x46fc('0x38')],'transaction':_0x340907,'lock':_0x340907[_0x46fc('0x33')][_0x46fc('0x34')],'include':_0x40592c['options']?_0x40592c['options'][_0x46fc('0x1d')]?_[_0x46fc('0x1c')](_0x40592c['options']['include'],function(_0x188251){return{'model':db[_0x188251[_0x46fc('0x1e')]],'as':_0x188251['as'],'attributes':_0x188251[_0x46fc('0x1a')],'include':_0x188251[_0x46fc('0x1d')]?_[_0x46fc('0x1c')](_0x188251[_0x46fc('0x1d')],function(_0x4cb46){return{'model':db[_0x4cb46[_0x46fc('0x1e')]],'as':_0x4cb46['as'],'attributes':_0x4cb46['attributes'],'include':_0x4cb46[_0x46fc('0x1d')]?_[_0x46fc('0x1c')](_0x4cb46[_0x46fc('0x1d')],function(_0x15d45a){return{'model':db[_0x15d45a[_0x46fc('0x1e')]],'as':_0x15d45a['as'],'attributes':_0x15d45a[_0x46fc('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48e99e){var _0x2f0f73=[];for(var _0xbfccf8=0x0;_0xbfccf8<_0x48e99e['length'];_0xbfccf8+=0x1){_0x2f0f73['push'](_0x48e99e[_0xbfccf8]['update'](_0x40592c[_0x46fc('0x39')],{'transaction':_0x340907}));}return BPromise[_0x46fc('0x4a')](_0x2f0f73);});})['then'](function(_0x5cf430){logger['info'](_0x46fc('0x48'),_0x40592c);logger[_0x46fc('0x12')]('GetContactRecallMe',_0x40592c,JSON['stringify'](_0x5cf430));_0x5d3be9(_0x5cf430);})[_0x46fc('0x21')](function(_0x30aa2d){logger[_0x46fc('0x15')](_0x46fc('0x48'),_0x30aa2d['message'],_0x40592c);_0x57de4d(_0x22dadc[_0x46fc('0x15')](0x1f4,_0x30aa2d['message']));});});});};exports[_0x46fc('0x4b')]=function(_0x581566){var _0x314a9b=this;return new Promise(function(_0xdf0573,_0x150d8a){db['CmContact'][_0x46fc('0x49')]()[_0x46fc('0xe')](function(_0x5d7c76){return db['CmHopper'][_0x46fc('0x31')]({'raw':_0x581566['options']?_0x581566[_0x46fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x581566[_0x46fc('0x18')]?_0x581566[_0x46fc('0x18')][_0x46fc('0x19')]||null:null,'attributes':_0x581566[_0x46fc('0x18')]?_0x581566[_0x46fc('0x18')][_0x46fc('0x1a')]||null:null,'limit':_0x581566[_0x46fc('0x18')]?_0x581566[_0x46fc('0x18')]['limit']||null:null,'include':_0x581566[_0x46fc('0x18')]?_0x581566[_0x46fc('0x18')][_0x46fc('0x1d')]?_[_0x46fc('0x1c')](_0x581566[_0x46fc('0x18')]['include'],function(_0x230900){return{'model':db[_0x230900['model']],'as':_0x230900['as'],'attributes':_0x230900['as']===_0x46fc('0x4c')?_[_0x46fc('0x4d')](_0x5d7c76):_0x230900[_0x46fc('0x1a')],'include':_0x230900[_0x46fc('0x1d')]?_[_0x46fc('0x1c')](_0x230900[_0x46fc('0x1d')],function(_0x418c1c){return{'model':db[_0x418c1c[_0x46fc('0x1e')]],'as':_0x418c1c['as'],'attributes':_0x418c1c[_0x46fc('0x1a')],'include':_0x418c1c[_0x46fc('0x1d')]?_[_0x46fc('0x1c')](_0x418c1c[_0x46fc('0x1d')],function(_0x10910b){return{'model':db[_0x10910b[_0x46fc('0x1e')]],'as':_0x10910b['as'],'attributes':_0x10910b['attributes']};}):[]};}):[]};}):[]:[]})[_0x46fc('0xe')](function(_0x5cb125){logger[_0x46fc('0xf')]('GetCmHopper',_0x581566);logger[_0x46fc('0x12')](_0x46fc('0x1f'),_0x581566,JSON[_0x46fc('0x20')](_0x5cb125));_0xdf0573(_0x5cb125);})[_0x46fc('0x21')](function(_0x4cb4d6){logger[_0x46fc('0x15')](_0x46fc('0x1f'),_0x4cb4d6[_0x46fc('0x16')],_0x581566);_0x150d8a(_0x314a9b[_0x46fc('0x15')](0x1f4,_0x4cb4d6['message']));});});});};exports[_0x46fc('0x4e')]=function(_0x4358a3){var _0x35fdea=this;return new Promise(function(_0xf568e3,_0x3ed47f){return db['CmContact'][_0x46fc('0x4f')]({'raw':!![],'where':{'phone':_0x4358a3[_0x46fc('0x18')][_0x46fc('0x19')][_0x46fc('0x50')]},'attributes':['id',_0x46fc('0x51')],'order':[['id',_0x46fc('0x52')]]})[_0x46fc('0xe')](function(_0x4170c4){logger[_0x46fc('0xf')](_0x46fc('0x53'),_0x4358a3);logger[_0x46fc('0x12')](_0x46fc('0x53'),_0x4358a3,JSON[_0x46fc('0x20')](_0x4170c4));_0xf568e3(_0x4170c4);})['catch'](function(_0x27630b){logger[_0x46fc('0x15')](_0x46fc('0x53'),_0x27630b[_0x46fc('0x16')],_0x4358a3);_0x3ed47f(_0x35fdea[_0x46fc('0x15')](0x1f4,_0x27630b[_0x46fc('0x16')]));});});};exports[_0x46fc('0x54')]=function(_0x5d5753){var _0x51a06f=this;return new Promise(function(_0x3b3686,_0x45730a){return db[_0x46fc('0x2f')]['transaction'](function(_0x40ba48){return db['CmHopper'][_0x46fc('0x27')]({'active':![]},{'where':{},'transaction':_0x40ba48})[_0x46fc('0xe')](function(_0x5497b4){logger[_0x46fc('0xf')](_0x46fc('0x54'),_0x5d5753);logger[_0x46fc('0x12')](_0x46fc('0x54'),_0x5d5753,JSON[_0x46fc('0x20')](_0x5497b4));_0x3b3686(_0x5497b4);})['catch'](function(_0x77fd7b){logger[_0x46fc('0x15')](_0x46fc('0x54'),_0x77fd7b[_0x46fc('0x16')],_0x5d5753);_0x45730a(_0x51a06f[_0x46fc('0x15')](0x1f4,_0x77fd7b[_0x46fc('0x16')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0xd5c912){var _0x8a76c3=this;var _0x3ad51d=_0xd5c912[_0x46fc('0x39')]['where'][_0x46fc('0x55')];var _0x1391a1=_0xd5c912[_0x46fc('0x39')][_0x46fc('0x19')][_0x46fc('0x56')];return new Promise(function(_0x38ead3,_0x5a08a3){return db[_0x46fc('0x23')][_0x46fc('0x31')]({'where':{'voiceQueueId':_0x3ad51d,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x46fc('0x2f')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x1391a1+_0x46fc('0x57'))}},'include':[{'model':db[_0x46fc('0x2e')],'as':_0x46fc('0x4c')},{'model':db[_0x46fc('0x35')],'as':'Agent','attributes':['id',_0x46fc('0x36'),_0x46fc('0x37')]},{'model':db[_0x46fc('0x58')],'as':_0x46fc('0x59')}]})['then'](function(_0x1b0e4b){return db[_0x46fc('0x2f')][_0x46fc('0x30')](function(_0x12a46f){return db[_0x46fc('0x23')][_0x46fc('0x27')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x3ad51d,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x46fc('0x2f')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x1391a1+_0x46fc('0x57'))}},'transaction':_0x12a46f})[_0x46fc('0xe')](function(_0x1bea1e){_0x38ead3(_0x1b0e4b);})[_0x46fc('0x21')](function(_0x46e20d){logger[_0x46fc('0x15')](_0x46fc('0x5a'),_0x46e20d[_0x46fc('0x16')],_0xd5c912);_0x5a08a3(validateExpressRequest);});});})[_0x46fc('0x21')](function(_0x20e7e7){logger['error'](_0x46fc('0x5a'),_0x20e7e7[_0x46fc('0x16')],_0xd5c912);_0x5a08a3(_0x8a76c3[_0x46fc('0x15')](0x1f4,_0x20e7e7[_0x46fc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index ec6a49c..72b1629 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 _0x540c=['get','/describe','describe','getOpenContacts','/timezones','getTimezones','/:id','show','post','/preview','/timezone','getTimezone','getPreviewRecall','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','index'];(function(_0x28f1de,_0x355054){var _0x5b5dad=function(_0x399b72){while(--_0x399b72){_0x28f1de['push'](_0x28f1de['shift']());}};_0x5b5dad(++_0x355054);}(_0x540c,0x1a6));var _0xc540=function(_0x3ceeb4,_0x9e1f78){_0x3ceeb4=_0x3ceeb4-0x0;var _0x22ff88=_0x540c[_0x3ceeb4];return _0x22ff88;};'use strict';var multer=require(_0xc540('0x0'));var util=require('util');var path=require(_0xc540('0x1'));var timeout=require('connect-timeout');var express=require(_0xc540('0x2'));var router=express[_0xc540('0x3')]();var fs_extra=require(_0xc540('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc540('0x5'));var config=require(_0xc540('0x6'));var controller=require(_0xc540('0x7'));router['get']('/',auth[_0xc540('0x8')](),controller[_0xc540('0x9')]);router[_0xc540('0xa')](_0xc540('0xb'),auth[_0xc540('0x8')](),controller[_0xc540('0xc')]);router[_0xc540('0xa')]('/opencontacts',auth[_0xc540('0x8')](),controller[_0xc540('0xd')]);router[_0xc540('0xa')](_0xc540('0xe'),auth['isAuthenticated'](),controller[_0xc540('0xf')]);router['get'](_0xc540('0x10'),auth[_0xc540('0x8')](),controller[_0xc540('0x11')]);router[_0xc540('0x12')]('/',auth[_0xc540('0x8')](),controller['create']);router[_0xc540('0x12')](_0xc540('0x13'),auth[_0xc540('0x8')](),controller['getPreview']);router['post'](_0xc540('0x14'),auth[_0xc540('0x8')](),controller[_0xc540('0x15')]);router['post']('/previewrecall',auth[_0xc540('0x8')](),controller[_0xc540('0x16')]);router['put'](_0xc540('0x10'),auth['isAuthenticated'](),controller[_0xc540('0x17')]);router[_0xc540('0x18')](_0xc540('0x10'),auth[_0xc540('0x8')](),controller[_0xc540('0x19')]);module[_0xc540('0x1a')]=router; \ No newline at end of file +var _0x8f78=['getTimezone','getPreviewRecall','put','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/opencontacts','getOpenContacts','/timezones','/:id','show','post','getPreview','/timezone'];(function(_0x41d7f5,_0x1c0d69){var _0x357324=function(_0x517c61){while(--_0x517c61){_0x41d7f5['push'](_0x41d7f5['shift']());}};_0x357324(++_0x1c0d69);}(_0x8f78,0x11a));var _0x88f7=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x8f78[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x88f7('0x0'));var timeout=require(_0x88f7('0x1'));var express=require(_0x88f7('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x88f7('0x3'));var interaction=require(_0x88f7('0x4'));var config=require(_0x88f7('0x5'));var controller=require(_0x88f7('0x6'));router[_0x88f7('0x7')]('/',auth[_0x88f7('0x8')](),controller[_0x88f7('0x9')]);router[_0x88f7('0x7')]('/describe',auth[_0x88f7('0x8')](),controller['describe']);router['get'](_0x88f7('0xa'),auth[_0x88f7('0x8')](),controller[_0x88f7('0xb')]);router[_0x88f7('0x7')](_0x88f7('0xc'),auth[_0x88f7('0x8')](),controller['getTimezones']);router['get'](_0x88f7('0xd'),auth[_0x88f7('0x8')](),controller[_0x88f7('0xe')]);router[_0x88f7('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x88f7('0xf')]('/preview',auth['isAuthenticated'](),controller[_0x88f7('0x10')]);router[_0x88f7('0xf')](_0x88f7('0x11'),auth[_0x88f7('0x8')](),controller[_0x88f7('0x12')]);router[_0x88f7('0xf')]('/previewrecall',auth['isAuthenticated'](),controller[_0x88f7('0x13')]);router[_0x88f7('0x14')](_0x88f7('0xd'),auth['isAuthenticated'](),controller[_0x88f7('0x15')]);router[_0x88f7('0x16')](_0x88f7('0xd'),auth[_0x88f7('0x8')](),controller[_0x88f7('0x17')]);module[_0x88f7('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 4d749c9..aa2efd1 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 _0x8d45=['INTEGER','STRING','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x8d45,0xac));var _0x58d4=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8d45[_0x3947c9];return _0x2e7871;};'use strict';var moment=require(_0x58d4('0x0'));var Sequelize=require(_0x58d4('0x1'));module[_0x58d4('0x2')]={'CmHopperId':{'type':Sequelize[_0x58d4('0x3')]},'phone':{'type':Sequelize[_0x58d4('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x58d4('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x58d4('0x5')](_0x58d4('0x6'))},'countbusyretry':{'type':Sequelize[_0x58d4('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x58d4('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x58d4('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x58d4('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x58d4('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x58d4('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x58d4('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x58d4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd4bd=['YYYY-MM-DD\x20HH:mm:ss','moment','INTEGER','STRING','DATE','format'];(function(_0x2b1fec,_0x5677a2){var _0x405720=function(_0x9c9267){while(--_0x9c9267){_0x2b1fec['push'](_0x2b1fec['shift']());}};_0x405720(++_0x5677a2);}(_0xd4bd,0x1d5));var _0xdd4b=function(_0x3bafed,_0x124d23){_0x3bafed=_0x3bafed-0x0;var _0x38b79f=_0xd4bd[_0x3bafed];return _0x38b79f;};'use strict';var moment=require(_0xdd4b('0x0'));var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0xdd4b('0x1')]},'phone':{'type':Sequelize[_0xdd4b('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xdd4b('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':moment()[_0xdd4b('0x4')](_0xdd4b('0x5'))},'countbusyretry':{'type':Sequelize[_0xdd4b('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdd4b('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdd4b('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xdd4b('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdd4b('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdd4b('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xdd4b('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdd4b('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 99a7236..ce34deb 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 _0x8cbe=['UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','CmHopperAdditionalPhones','sendStatus','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0xfad1a7,_0x2e3b8d){var _0x571012=function(_0x33255d){while(--_0x33255d){_0xfad1a7['push'](_0xfad1a7['shift']());}};_0x571012(++_0x2e3b8d);}(_0x8cbe,0x141));var _0xe8cb=function(_0x3907bc,_0x51fdcd){_0x3907bc=_0x3907bc-0x0;var _0x3398f3=_0x8cbe[_0x3907bc];return _0x3398f3;};'use strict';var emlformat=require(_0xe8cb('0x0'));var rimraf=require(_0xe8cb('0x1'));var zipdir=require(_0xe8cb('0x2'));var jsonpatch=require(_0xe8cb('0x3'));var rp=require(_0xe8cb('0x4'));var moment=require(_0xe8cb('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe8cb('0x6'));var path=require('path');var sox=require(_0xe8cb('0x7'));var csv=require('to-csv');var ejs=require(_0xe8cb('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe8cb('0x9'));var squel=require(_0xe8cb('0xa'));var crypto=require('crypto');var jsforce=require(_0xe8cb('0xb'));var deskjs=require(_0xe8cb('0xc'));var toCsv=require(_0xe8cb('0xd'));var querystring=require(_0xe8cb('0xe'));var Papa=require('papaparse');var Redis=require(_0xe8cb('0xf'));var authService=require(_0xe8cb('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe8cb('0x11'));var logger=require(_0xe8cb('0x12'))(_0xe8cb('0x13'));var utils=require(_0xe8cb('0x14'));var config=require(_0xe8cb('0x15'));var licenseUtil=require(_0xe8cb('0x16'));var db=require(_0xe8cb('0x17'))['db'];function respondWithStatusCode(_0x54b5e2,_0x5e063b){_0x5e063b=_0x5e063b||0xcc;return function(_0x2aac3f){if(_0x2aac3f){return _0x54b5e2['sendStatus'](_0x5e063b);}return _0x54b5e2[_0xe8cb('0x18')](_0x5e063b)[_0xe8cb('0x19')]();};}function respondWithResult(_0x4a5a7f,_0x59279f){_0x59279f=_0x59279f||0xc8;return function(_0x4fb2db){if(_0x4fb2db){return _0x4a5a7f[_0xe8cb('0x18')](_0x59279f)[_0xe8cb('0x1a')](_0x4fb2db);}};}function respondWithFilteredResult(_0x1c51ce,_0x60f7a8){return function(_0x446751){if(_0x446751){var _0x1100b1=typeof _0x60f7a8['offset']===_0xe8cb('0x1b')&&typeof _0x60f7a8[_0xe8cb('0x1c')]===_0xe8cb('0x1b');var _0x549d82=_0x446751[_0xe8cb('0x1d')];var _0x3637ac=_0x1100b1?0x0:_0x60f7a8['offset'];var _0x582810=_0x1100b1?_0x446751['count']:_0x60f7a8['offset']+_0x60f7a8[_0xe8cb('0x1c')];var _0x50e789;if(_0x582810>=_0x549d82){_0x582810=_0x549d82;_0x50e789=0xc8;}else{_0x50e789=0xce;}_0x1c51ce[_0xe8cb('0x18')](_0x50e789);return _0x1c51ce[_0xe8cb('0x1e')]('Content-Range',_0x3637ac+'-'+_0x582810+'/'+_0x549d82)[_0xe8cb('0x1a')](_0x446751);}return null;};}function patchUpdates(_0x1b308b){return function(_0x3be502){try{jsonpatch[_0xe8cb('0x1f')](_0x3be502,_0x1b308b,!![]);}catch(_0x48cb8a){return BPromise[_0xe8cb('0x20')](_0x48cb8a);}return _0x3be502[_0xe8cb('0x21')]();};}function saveUpdates(_0x51abff,_0x283099){return function(_0x580be1){if(_0x580be1){return _0x580be1[_0xe8cb('0x22')](_0x51abff)['then'](function(_0x1a6e5e){return _0x1a6e5e;});}return null;};}function removeEntity(_0x13acd5,_0x17cd38){return function(_0x52eaad){if(_0x52eaad){return _0x52eaad[_0xe8cb('0x23')]()[_0xe8cb('0x24')](function(){var _0x997e09=_0x52eaad[_0xe8cb('0x25')]({'plain':!![]});var _0x230aa4=_0xe8cb('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x230aa4,'resourceId':_0x997e09['id']}})[_0xe8cb('0x24')](function(){return _0x52eaad;});})[_0xe8cb('0x24')](function(){_0x13acd5[_0xe8cb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dceb5,_0xe12f3f){return function(_0x5e1966){if(!_0x5e1966){_0x4dceb5[_0xe8cb('0x27')](0x194);}return _0x5e1966;};}function handleError(_0x5ee54a,_0x565a78){_0x565a78=_0x565a78||0x1f4;return function(_0x5c1a90){logger[_0xe8cb('0x28')](_0x5c1a90[_0xe8cb('0x29')]);if(_0x5c1a90['name']){delete _0x5c1a90[_0xe8cb('0x2a')];}_0x5ee54a[_0xe8cb('0x18')](_0x565a78)[_0xe8cb('0x2b')](_0x5c1a90);};}exports['index']=function(_0x2b64ce,_0x11b694){var _0x3dbe77={},_0x1be2f8={},_0xac19a3={'count':0x0,'rows':[]};var _0x109d13=_[_0xe8cb('0x2c')](db[_0xe8cb('0x2d')][_0xe8cb('0x2e')],function(_0x2f03d5){return{'name':_0x2f03d5['fieldName'],'type':_0x2f03d5[_0xe8cb('0x2f')][_0xe8cb('0x30')]};});_0x1be2f8['model']=_[_0xe8cb('0x2c')](_0x109d13,_0xe8cb('0x2a'));_0x1be2f8[_0xe8cb('0x31')]=_[_0xe8cb('0x32')](_0x2b64ce[_0xe8cb('0x31')]);_0x1be2f8['filters']=_[_0xe8cb('0x33')](_0x1be2f8[_0xe8cb('0x34')],_0x1be2f8[_0xe8cb('0x31')]);_0x3dbe77['attributes']=_[_0xe8cb('0x33')](_0x1be2f8[_0xe8cb('0x34')],qs[_0xe8cb('0x35')](_0x2b64ce[_0xe8cb('0x31')][_0xe8cb('0x35')]));_0x3dbe77[_0xe8cb('0x36')]=_0x3dbe77[_0xe8cb('0x36')][_0xe8cb('0x37')]?_0x3dbe77[_0xe8cb('0x36')]:_0x1be2f8[_0xe8cb('0x34')];if(!_0x2b64ce[_0xe8cb('0x31')][_0xe8cb('0x38')](_0xe8cb('0x39'))){_0x3dbe77[_0xe8cb('0x1c')]=qs[_0xe8cb('0x1c')](_0x2b64ce['query']['limit']);_0x3dbe77[_0xe8cb('0x3a')]=qs['offset'](_0x2b64ce['query'][_0xe8cb('0x3a')]);}_0x3dbe77[_0xe8cb('0x3b')]=qs[_0xe8cb('0x3c')](_0x2b64ce[_0xe8cb('0x31')][_0xe8cb('0x3c')]);_0x3dbe77[_0xe8cb('0x3d')]=qs[_0xe8cb('0x3e')](_['pick'](_0x2b64ce['query'],_0x1be2f8[_0xe8cb('0x3e')]),_0x109d13);if(_0x2b64ce[_0xe8cb('0x31')][_0xe8cb('0x3f')]){_0x3dbe77[_0xe8cb('0x3d')]=_[_0xe8cb('0x40')](_0x3dbe77[_0xe8cb('0x3d')],{'$or':_[_0xe8cb('0x2c')](_0x109d13,function(_0xbd7c71){if(_0xbd7c71[_0xe8cb('0x2f')]!==_0xe8cb('0x41')){var _0x22673c={};_0x22673c[_0xbd7c71['name']]={'$like':'%'+_0x2b64ce[_0xe8cb('0x31')]['filter']+'%'};return _0x22673c;}})});}_0x3dbe77=_[_0xe8cb('0x40')]({},_0x3dbe77,_0x2b64ce[_0xe8cb('0x42')]);var _0xc2adfa={'where':_0x3dbe77['where']};return db['CmHopperAdditionalPhone'][_0xe8cb('0x1d')](_0xc2adfa)[_0xe8cb('0x24')](function(_0x203bc9){_0xac19a3[_0xe8cb('0x1d')]=_0x203bc9;if(_0x2b64ce[_0xe8cb('0x31')][_0xe8cb('0x43')]){_0x3dbe77['include']=[{'all':!![]}];}return db[_0xe8cb('0x2d')][_0xe8cb('0x44')](_0x3dbe77);})[_0xe8cb('0x24')](function(_0xcc5e5f){_0xac19a3[_0xe8cb('0x45')]=_0xcc5e5f;return _0xac19a3;})['then'](respondWithFilteredResult(_0x11b694,_0x3dbe77))[_0xe8cb('0x46')](handleError(_0x11b694,null));};exports[_0xe8cb('0x47')]=function(_0x3c7b35,_0x240cdf){var _0x1a8100={'raw':!![],'where':{'id':_0x3c7b35[_0xe8cb('0x48')]['id']}},_0x280d52={};_0x280d52[_0xe8cb('0x34')]=_[_0xe8cb('0x32')](db[_0xe8cb('0x2d')]['rawAttributes']);_0x280d52[_0xe8cb('0x31')]=_[_0xe8cb('0x32')](_0x3c7b35[_0xe8cb('0x31')]);_0x280d52['filters']=_[_0xe8cb('0x33')](_0x280d52[_0xe8cb('0x34')],_0x280d52[_0xe8cb('0x31')]);_0x1a8100[_0xe8cb('0x36')]=_['intersection'](_0x280d52['model'],qs['fields'](_0x3c7b35['query'][_0xe8cb('0x35')]));_0x1a8100[_0xe8cb('0x36')]=_0x1a8100[_0xe8cb('0x36')][_0xe8cb('0x37')]?_0x1a8100[_0xe8cb('0x36')]:_0x280d52[_0xe8cb('0x34')];if(_0x3c7b35[_0xe8cb('0x31')][_0xe8cb('0x43')]){_0x1a8100['include']=[{'all':!![]}];}_0x1a8100=_[_0xe8cb('0x40')]({},_0x1a8100,_0x3c7b35[_0xe8cb('0x42')]);return db[_0xe8cb('0x2d')][_0xe8cb('0x49')](_0x1a8100)['then'](handleEntityNotFound(_0x240cdf,null))[_0xe8cb('0x24')](respondWithResult(_0x240cdf,null))[_0xe8cb('0x46')](handleError(_0x240cdf,null));};exports[_0xe8cb('0x4a')]=function(_0x201427,_0x2c0a3f){return db['CmHopperAdditionalPhone']['create'](_0x201427[_0xe8cb('0x4b')],{})[_0xe8cb('0x24')](function(_0x14c46b){var _0x449cd9=_0x201427[_0xe8cb('0x4c')][_0xe8cb('0x25')]({'plain':!![]});if(!_0x449cd9)throw new Error(_0xe8cb('0x4d'));if(_0x449cd9[_0xe8cb('0x4e')]===_0xe8cb('0x4c')){var _0x35d56e=_0x14c46b[_0xe8cb('0x25')]({'plain':!![]});var _0x5bb240=_0xe8cb('0x26');return db['UserProfileSection'][_0xe8cb('0x49')]({'where':{'name':_0x5bb240,'userProfileId':_0x449cd9['userProfileId']},'raw':!![]})[_0xe8cb('0x24')](function(_0x84f746){if(_0x84f746&&_0x84f746['autoAssociation']===0x0){return db[_0xe8cb('0x4f')][_0xe8cb('0x4a')]({'name':_0x35d56e[_0xe8cb('0x2a')],'resourceId':_0x35d56e['id'],'type':_0x84f746[_0xe8cb('0x2a')],'sectionId':_0x84f746['id']},{})[_0xe8cb('0x24')](function(){return _0x14c46b;});}else{return _0x14c46b;}})['catch'](function(_0xd2cc8){logger[_0xe8cb('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd2cc8);throw _0xd2cc8;});}return _0x14c46b;})['then'](respondWithResult(_0x2c0a3f,0xc9))[_0xe8cb('0x46')](handleError(_0x2c0a3f,null));};exports[_0xe8cb('0x22')]=function(_0xe3d996,_0x4b2be5){if(_0xe3d996[_0xe8cb('0x4b')]['id']){delete _0xe3d996[_0xe8cb('0x4b')]['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0xe3d996['params']['id']}})[_0xe8cb('0x24')](handleEntityNotFound(_0x4b2be5,null))['then'](saveUpdates(_0xe3d996['body'],null))[_0xe8cb('0x24')](respondWithResult(_0x4b2be5,null))[_0xe8cb('0x46')](handleError(_0x4b2be5,null));};exports['destroy']=function(_0x54544f,_0x30dec4){return db['CmHopperAdditionalPhone'][_0xe8cb('0x49')]({'where':{'id':_0x54544f['params']['id']}})['then'](handleEntityNotFound(_0x30dec4,null))[_0xe8cb('0x24')](removeEntity(_0x30dec4,null))['catch'](handleError(_0x30dec4,null));}; \ No newline at end of file +var _0xeabe=['pick','VIRTUAL','filter','merge','CmHopperAdditionalPhone','includeAll','include','findAll','rows','show','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','error','update','body','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','get','CmHopperAdditionalPhones','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','order','sort','where'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0xeabe,0xb8));var _0xeeab=function(_0x45f803,_0xc17e11){_0x45f803=_0x45f803-0x0;var _0x156de2=_0xeabe[_0x45f803];return _0x156de2;};'use strict';var emlformat=require(_0xeeab('0x0'));var rimraf=require(_0xeeab('0x1'));var zipdir=require(_0xeeab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeeab('0x3'));var moment=require('moment');var BPromise=require(_0xeeab('0x4'));var Mustache=require(_0xeeab('0x5'));var util=require(_0xeeab('0x6'));var path=require(_0xeeab('0x7'));var sox=require('sox');var csv=require(_0xeeab('0x8'));var ejs=require(_0xeeab('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeeab('0xa'));var squel=require(_0xeeab('0xb'));var crypto=require(_0xeeab('0xc'));var jsforce=require(_0xeeab('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xeeab('0x8'));var querystring=require(_0xeeab('0xe'));var Papa=require('papaparse');var Redis=require(_0xeeab('0xf'));var authService=require(_0xeeab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeeab('0x11'));var logger=require(_0xeeab('0x12'))(_0xeeab('0x13'));var utils=require(_0xeeab('0x14'));var config=require(_0xeeab('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xeeab('0x16'))['db'];function respondWithStatusCode(_0x5e45af,_0x3617e0){_0x3617e0=_0x3617e0||0xcc;return function(_0x3b82d0){if(_0x3b82d0){return _0x5e45af[_0xeeab('0x17')](_0x3617e0);}return _0x5e45af[_0xeeab('0x18')](_0x3617e0)['end']();};}function respondWithResult(_0x4955db,_0x285002){_0x285002=_0x285002||0xc8;return function(_0x55c58e){if(_0x55c58e){return _0x4955db[_0xeeab('0x18')](_0x285002)[_0xeeab('0x19')](_0x55c58e);}};}function respondWithFilteredResult(_0x2fcf08,_0x1ef501){return function(_0x4d4fd1){if(_0x4d4fd1){var _0x38b459=typeof _0x1ef501[_0xeeab('0x1a')]==='undefined'&&typeof _0x1ef501[_0xeeab('0x1b')]===_0xeeab('0x1c');var _0x30fc43=_0x4d4fd1['count'];var _0x45f89d=_0x38b459?0x0:_0x1ef501[_0xeeab('0x1a')];var _0x2eddef=_0x38b459?_0x4d4fd1[_0xeeab('0x1d')]:_0x1ef501[_0xeeab('0x1a')]+_0x1ef501[_0xeeab('0x1b')];var _0x254358;if(_0x2eddef>=_0x30fc43){_0x2eddef=_0x30fc43;_0x254358=0xc8;}else{_0x254358=0xce;}_0x2fcf08[_0xeeab('0x18')](_0x254358);return _0x2fcf08[_0xeeab('0x1e')](_0xeeab('0x1f'),_0x45f89d+'-'+_0x2eddef+'/'+_0x30fc43)[_0xeeab('0x19')](_0x4d4fd1);}return null;};}function patchUpdates(_0x4e9781){return function(_0x479725){try{jsonpatch[_0xeeab('0x20')](_0x479725,_0x4e9781,!![]);}catch(_0x4a9e85){return BPromise[_0xeeab('0x21')](_0x4a9e85);}return _0x479725[_0xeeab('0x22')]();};}function saveUpdates(_0x47ba92,_0x3e09ed){return function(_0xdb82ee){if(_0xdb82ee){return _0xdb82ee['update'](_0x47ba92)['then'](function(_0xd17287){return _0xd17287;});}return null;};}function removeEntity(_0x1f1d3d,_0x59ef05){return function(_0x12840b){if(_0x12840b){return _0x12840b[_0xeeab('0x23')]()[_0xeeab('0x24')](function(){var _0x1917f2=_0x12840b[_0xeeab('0x25')]({'plain':!![]});var _0x5d43f1=_0xeeab('0x26');return db['UserProfileResource'][_0xeeab('0x23')]({'where':{'type':_0x5d43f1,'resourceId':_0x1917f2['id']}})[_0xeeab('0x24')](function(){return _0x12840b;});})[_0xeeab('0x24')](function(){_0x1f1d3d[_0xeeab('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dd808,_0x24dc32){return function(_0x23c5e1){if(!_0x23c5e1){_0x5dd808[_0xeeab('0x17')](0x194);}return _0x23c5e1;};}function handleError(_0x384599,_0x2e4c4a){_0x2e4c4a=_0x2e4c4a||0x1f4;return function(_0x2660b7){logger['error'](_0x2660b7[_0xeeab('0x27')]);if(_0x2660b7['name']){delete _0x2660b7['name'];}_0x384599[_0xeeab('0x18')](_0x2e4c4a)[_0xeeab('0x28')](_0x2660b7);};}exports[_0xeeab('0x29')]=function(_0x143bab,_0x966bf8){var _0x18198e={},_0x144af8={},_0xc8b7dc={'count':0x0,'rows':[]};var _0x5416df=_[_0xeeab('0x2a')](db['CmHopperAdditionalPhone'][_0xeeab('0x2b')],function(_0x3ba801){return{'name':_0x3ba801[_0xeeab('0x2c')],'type':_0x3ba801[_0xeeab('0x2d')][_0xeeab('0x2e')]};});_0x144af8[_0xeeab('0x2f')]=_[_0xeeab('0x2a')](_0x5416df,_0xeeab('0x30'));_0x144af8['query']=_[_0xeeab('0x31')](_0x143bab[_0xeeab('0x32')]);_0x144af8[_0xeeab('0x33')]=_[_0xeeab('0x34')](_0x144af8[_0xeeab('0x2f')],_0x144af8[_0xeeab('0x32')]);_0x18198e[_0xeeab('0x35')]=_['intersection'](_0x144af8['model'],qs['fields'](_0x143bab[_0xeeab('0x32')][_0xeeab('0x36')]));_0x18198e[_0xeeab('0x35')]=_0x18198e[_0xeeab('0x35')][_0xeeab('0x37')]?_0x18198e[_0xeeab('0x35')]:_0x144af8[_0xeeab('0x2f')];if(!_0x143bab[_0xeeab('0x32')]['hasOwnProperty']('nolimit')){_0x18198e[_0xeeab('0x1b')]=qs[_0xeeab('0x1b')](_0x143bab[_0xeeab('0x32')]['limit']);_0x18198e[_0xeeab('0x1a')]=qs[_0xeeab('0x1a')](_0x143bab[_0xeeab('0x32')][_0xeeab('0x1a')]);}_0x18198e[_0xeeab('0x38')]=qs[_0xeeab('0x39')](_0x143bab[_0xeeab('0x32')][_0xeeab('0x39')]);_0x18198e[_0xeeab('0x3a')]=qs[_0xeeab('0x33')](_[_0xeeab('0x3b')](_0x143bab[_0xeeab('0x32')],_0x144af8[_0xeeab('0x33')]),_0x5416df);if(_0x143bab[_0xeeab('0x32')]['filter']){_0x18198e['where']=_['merge'](_0x18198e[_0xeeab('0x3a')],{'$or':_[_0xeeab('0x2a')](_0x5416df,function(_0x290263){if(_0x290263['type']!==_0xeeab('0x3c')){var _0x2a0f92={};_0x2a0f92[_0x290263['name']]={'$like':'%'+_0x143bab[_0xeeab('0x32')][_0xeeab('0x3d')]+'%'};return _0x2a0f92;}})});}_0x18198e=_[_0xeeab('0x3e')]({},_0x18198e,_0x143bab['options']);var _0x4b7483={'where':_0x18198e[_0xeeab('0x3a')]};return db[_0xeeab('0x3f')]['count'](_0x4b7483)[_0xeeab('0x24')](function(_0x286766){_0xc8b7dc['count']=_0x286766;if(_0x143bab['query'][_0xeeab('0x40')]){_0x18198e[_0xeeab('0x41')]=[{'all':!![]}];}return db[_0xeeab('0x3f')][_0xeeab('0x42')](_0x18198e);})[_0xeeab('0x24')](function(_0x52d557){_0xc8b7dc[_0xeeab('0x43')]=_0x52d557;return _0xc8b7dc;})[_0xeeab('0x24')](respondWithFilteredResult(_0x966bf8,_0x18198e))['catch'](handleError(_0x966bf8,null));};exports[_0xeeab('0x44')]=function(_0x43a68d,_0x5d742a){var _0x29aabd={'raw':!![],'where':{'id':_0x43a68d['params']['id']}},_0x3e6a8f={};_0x3e6a8f['model']=_[_0xeeab('0x31')](db['CmHopperAdditionalPhone'][_0xeeab('0x2b')]);_0x3e6a8f[_0xeeab('0x32')]=_[_0xeeab('0x31')](_0x43a68d[_0xeeab('0x32')]);_0x3e6a8f['filters']=_['intersection'](_0x3e6a8f[_0xeeab('0x2f')],_0x3e6a8f[_0xeeab('0x32')]);_0x29aabd['attributes']=_[_0xeeab('0x34')](_0x3e6a8f[_0xeeab('0x2f')],qs[_0xeeab('0x36')](_0x43a68d[_0xeeab('0x32')][_0xeeab('0x36')]));_0x29aabd[_0xeeab('0x35')]=_0x29aabd[_0xeeab('0x35')]['length']?_0x29aabd['attributes']:_0x3e6a8f['model'];if(_0x43a68d['query'][_0xeeab('0x40')]){_0x29aabd['include']=[{'all':!![]}];}_0x29aabd=_['merge']({},_0x29aabd,_0x43a68d[_0xeeab('0x45')]);return db[_0xeeab('0x3f')][_0xeeab('0x46')](_0x29aabd)[_0xeeab('0x24')](handleEntityNotFound(_0x5d742a,null))[_0xeeab('0x24')](respondWithResult(_0x5d742a,null))[_0xeeab('0x47')](handleError(_0x5d742a,null));};exports[_0xeeab('0x48')]=function(_0x4c094f,_0x4d692d){return db[_0xeeab('0x3f')][_0xeeab('0x48')](_0x4c094f['body'],{})[_0xeeab('0x24')](function(_0x9a3e73){var _0x1d64af=_0x4c094f['user'][_0xeeab('0x25')]({'plain':!![]});if(!_0x1d64af)throw new Error(_0xeeab('0x49'));if(_0x1d64af[_0xeeab('0x4a')]===_0xeeab('0x4b')){var _0x2eec90=_0x9a3e73[_0xeeab('0x25')]({'plain':!![]});var _0x643080=_0xeeab('0x26');return db[_0xeeab('0x4c')][_0xeeab('0x46')]({'where':{'name':_0x643080,'userProfileId':_0x1d64af['userProfileId']},'raw':!![]})[_0xeeab('0x24')](function(_0x44e270){if(_0x44e270&&_0x44e270['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2eec90[_0xeeab('0x30')],'resourceId':_0x2eec90['id'],'type':_0x44e270[_0xeeab('0x30')],'sectionId':_0x44e270['id']},{})[_0xeeab('0x24')](function(){return _0x9a3e73;});}else{return _0x9a3e73;}})[_0xeeab('0x47')](function(_0x4c8008){logger[_0xeeab('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c8008);throw _0x4c8008;});}return _0x9a3e73;})['then'](respondWithResult(_0x4d692d,0xc9))['catch'](handleError(_0x4d692d,null));};exports[_0xeeab('0x4e')]=function(_0x548c2e,_0x42a679){if(_0x548c2e[_0xeeab('0x4f')]['id']){delete _0x548c2e[_0xeeab('0x4f')]['id'];}return db[_0xeeab('0x3f')][_0xeeab('0x46')]({'where':{'id':_0x548c2e[_0xeeab('0x50')]['id']}})[_0xeeab('0x24')](handleEntityNotFound(_0x42a679,null))[_0xeeab('0x24')](saveUpdates(_0x548c2e['body'],null))[_0xeeab('0x24')](respondWithResult(_0x42a679,null))[_0xeeab('0x47')](handleError(_0x42a679,null));};exports[_0xeeab('0x23')]=function(_0x540091,_0x425b4c){return db[_0xeeab('0x3f')][_0xeeab('0x46')]({'where':{'id':_0x540091['params']['id']}})[_0xeeab('0x24')](handleEntityNotFound(_0x425b4c,null))[_0xeeab('0x24')](removeEntity(_0x425b4c,null))[_0xeeab('0x47')](handleError(_0x425b4c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index cb067c4..df87894 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 _0x6117=['cm_hopper_additional_phones','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define'];(function(_0x112870,_0x56ffb2){var _0x59bcd2=function(_0x5a6c9f){while(--_0x5a6c9f){_0x112870['push'](_0x112870['shift']());}};_0x59bcd2(++_0x56ffb2);}(_0x6117,0x198));var _0x7611=function(_0x3e7a4e,_0x52627e){_0x3e7a4e=_0x3e7a4e-0x0;var _0x4901dd=_0x6117[_0x3e7a4e];return _0x4901dd;};'use strict';var _=require(_0x7611('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7611('0x1'));var moment=require(_0x7611('0x2'));var BPromise=require('bluebird');var rp=require(_0x7611('0x3'));var fs=require('fs');var path=require(_0x7611('0x4'));var rimraf=require(_0x7611('0x5'));var config=require(_0x7611('0x6'));var attributes=require(_0x7611('0x7'));module[_0x7611('0x8')]=function(_0x2f406d,_0x2f7a0e){return _0x2f406d[_0x7611('0x9')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x7611('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc99d=['moment','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','lodash','util','../../config/logger','api'];(function(_0x1de5da,_0x4bc4f9){var _0x37c2f6=function(_0x40b96d){while(--_0x40b96d){_0x1de5da['push'](_0x1de5da['shift']());}};_0x37c2f6(++_0x4bc4f9);}(_0xc99d,0x175));var _0xdc99=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xc99d[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0xdc99('0x0'));var util=require(_0xdc99('0x1'));var logger=require(_0xdc99('0x2'))(_0xdc99('0x3'));var moment=require(_0xdc99('0x4'));var BPromise=require('bluebird');var rp=require(_0xdc99('0x5'));var fs=require('fs');var path=require(_0xdc99('0x6'));var rimraf=require(_0xdc99('0x7'));var config=require(_0xdc99('0x8'));var attributes=require(_0xdc99('0x9'));module[_0xdc99('0xa')]=function(_0x474715,_0x336b69){return _0x474715[_0xdc99('0xb')](_0xdc99('0xc'),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 cf57e08..cf9f9c0 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 _0xbbdb=['countdropretry','countmachineretry','dialGlobalMaxRetry','CmHopperAdditionalPhone','countabandonedretry','entity','ContactId','duration','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','then','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbbdb,0x137));var _0xbbbd=function(_0x37b1d8,_0x614312){_0x37b1d8=_0x37b1d8-0x0;var _0x3739e7=_0xbbdb[_0x37b1d8];return _0x3739e7;};'use strict';var _=require('lodash');var util=require(_0xbbbd('0x0'));var moment=require(_0xbbbd('0x1'));var BPromise=require(_0xbbbd('0x2'));var rs=require(_0xbbbd('0x3'));var fs=require('fs');var Redis=require(_0xbbbd('0x4'));var db=require(_0xbbbd('0x5'))['db'];var utils=require(_0xbbbd('0x6'));var logger=require('../../config/logger')(_0xbbbd('0x7'));var config=require(_0xbbbd('0x8'));var jayson=require(_0xbbbd('0x9'));var client=jayson[_0xbbbd('0xa')][_0xbbbd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33de50,_0x516ae8,_0x18f2e8){return new BPromise(function(_0x546490,_0x44bb00){return client['request'](_0x33de50,_0x18f2e8)['then'](function(_0xb5e789){logger[_0xbbbd('0xc')](_0xbbbd('0xd'),_0x516ae8,_0xbbbd('0xe'));logger[_0xbbbd('0xf')](_0xbbbd('0x10'),_0x516ae8,_0xbbbd('0xe'),JSON[_0xbbbd('0x11')](_0xb5e789));if(_0xb5e789['error']){if(_0xb5e789[_0xbbbd('0x12')][_0xbbbd('0x13')]===0x1f4){logger['error'](_0xbbbd('0xd'),_0x516ae8,_0xb5e789['error'][_0xbbbd('0x14')]);return _0x44bb00(_0xb5e789[_0xbbbd('0x12')]['message']);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x516ae8,_0xb5e789[_0xbbbd('0x12')][_0xbbbd('0x14')]);return _0x546490(_0xb5e789['error'][_0xbbbd('0x14')]);}else{logger[_0xbbbd('0xc')](_0xbbbd('0xd'),_0x516ae8,_0xbbbd('0xe'));_0x546490(_0xb5e789[_0xbbbd('0x15')][_0xbbbd('0x14')]);}})[_0xbbbd('0x16')](function(_0x518d5e){logger[_0xbbbd('0x12')](_0xbbbd('0xd'),_0x516ae8,_0x518d5e);_0x44bb00(_0x518d5e);});});}exports[_0xbbbd('0x17')]=function(_0x55a058){var _0x10434f=this;return new Promise(function(_0x4774a2,_0x22f503){return db[_0xbbbd('0x18')][_0xbbbd('0x19')]({'raw':!![],'where':{'ContactId':_0x55a058[_0xbbbd('0x1a')]['ContactId'],'ListId':_0x55a058[_0xbbbd('0x1a')][_0xbbbd('0x1b')],'VoiceQueueId':_0x55a058['body']['VoiceQueueId']===undefined?null:_0x55a058[_0xbbbd('0x1a')][_0xbbbd('0x1c')],'CampaignId':_0x55a058[_0xbbbd('0x1a')][_0xbbbd('0x1d')]===undefined?null:_0x55a058[_0xbbbd('0x1a')][_0xbbbd('0x1d')]}})['then'](function(_0x4a4549){if(_0x4a4549!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x4a4549['id'],'OrderBy':{'$gt':_0x4a4549['OrderBy']}},'order':[[_0xbbbd('0x1e'),_0xbbbd('0x1f')]]})[_0xbbbd('0x20')](function(_0x197df1){var _0x6839b3=0x0;if(_0x197df1){if(_0x197df1[_0xbbbd('0x21')]+_0x197df1[_0xbbbd('0x22')]+_0x197df1[_0xbbbd('0x23')]+_0x197df1[_0xbbbd('0x24')]+_0x197df1[_0xbbbd('0x25')]+_0x197df1['countabandonedretry']+_0x197df1[_0xbbbd('0x26')]+_0x197df1['countagentrejectretry']<_0x55a058['entity'][_0xbbbd('0x27')])_0x6839b3=0x1;_0x4774a2({'additional':_0x6839b3});}else{return db[_0xbbbd('0x28')][_0xbbbd('0x19')]({'raw':!![],'where':{'CmHopperId':_0x4a4549['id']},'order':[[_0xbbbd('0x1e'),_0xbbbd('0x1f')]]})[_0xbbbd('0x20')](function(_0x54b29c){var _0x67add1=0x0;if(_0x54b29c){if(_0x54b29c[_0xbbbd('0x21')]+_0x54b29c['countcongestionretry']+_0x54b29c[_0xbbbd('0x23')]+_0x54b29c['countnosuchnumberretry']+_0x54b29c[_0xbbbd('0x25')]+_0x54b29c[_0xbbbd('0x29')]+_0x54b29c[_0xbbbd('0x26')]+_0x54b29c['countagentrejectretry']<_0x55a058[_0xbbbd('0x2a')][_0xbbbd('0x27')])_0x67add1=0x1;_0x4774a2({'additional':_0x67add1});}else{_0x4774a2({'additional':0x0});}})['catch'](function(_0x4dc37e){logger[_0xbbbd('0x12')](_0xbbbd('0x17'),_0x4dc37e[_0xbbbd('0x14')]);_0x22f503(_0x10434f[_0xbbbd('0x12')](0x1f4,_0x4dc37e['message']));});}})[_0xbbbd('0x16')](function(_0x8551a7){logger[_0xbbbd('0x12')](_0xbbbd('0x17'),_0x8551a7['message']);_0x22f503(_0x10434f[_0xbbbd('0x12')](0x1f4,_0x8551a7[_0xbbbd('0x14')]));});}else _0x4774a2({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x57f354){var _0x420cec=this;return new Promise(function(_0x59a460,_0x3aae8d){return db[_0xbbbd('0x18')][_0xbbbd('0x19')]({'raw':!![],'where':{'ContactId':_0x57f354[_0xbbbd('0x1a')][_0xbbbd('0x2b')],'ListId':_0x57f354['body'][_0xbbbd('0x1b')],'VoiceQueueId':_0x57f354[_0xbbbd('0x1a')][_0xbbbd('0x1c')]===undefined?null:_0x57f354['body'][_0xbbbd('0x1c')],'CampaignId':_0x57f354[_0xbbbd('0x1a')][_0xbbbd('0x1d')]===undefined?null:_0x57f354[_0xbbbd('0x1a')][_0xbbbd('0x1d')]}})['then'](function(_0x49bd13){if(_0x49bd13!=null){return db[_0xbbbd('0x28')][_0xbbbd('0x19')]({'raw':!![],'where':{'CmHopperId':_0x49bd13['id'],'OrderBy':{'$gte':_0x49bd13[_0xbbbd('0x1e')]}},'order':[['OrderBy',_0xbbbd('0x1f')]]})[_0xbbbd('0x20')](function(_0x497913){if(_0x497913)return activateAdditionalPhone(_0x49bd13,_0x57f354[_0xbbbd('0x1a')],_0x497913,_0x57f354[_0xbbbd('0x2c')],_0x57f354['waitTime'])['then'](function(_0x54fb3b){_0x59a460(_0x54fb3b);});else{return db[_0xbbbd('0x28')][_0xbbbd('0x19')]({'raw':!![],'where':{'CmHopperId':_0x49bd13['id']},'order':[['OrderBy','ASC']]})['then'](function(_0x1c2b5b){if(_0x1c2b5b)return activateAdditionalPhone(_0x49bd13,_0x57f354[_0xbbbd('0x1a')],_0x1c2b5b,_0x57f354[_0xbbbd('0x2c')],_0x57f354['waitTime'])[_0xbbbd('0x20')](function(_0x2cadfa){_0x59a460(_0x2cadfa);});else{_0x59a460({'id':_0x49bd13['id'],'phone':''});}})[_0xbbbd('0x16')](function(_0x5506e3){logger['error'](_0xbbbd('0x17'),_0x5506e3[_0xbbbd('0x14')]);_0x3aae8d(_0x420cec[_0xbbbd('0x12')](0x1f4,_0x5506e3[_0xbbbd('0x14')]));});}})[_0xbbbd('0x16')](function(_0x14dd0a){logger[_0xbbbd('0x12')](_0xbbbd('0x17'),_0x14dd0a['message']);_0x3aae8d(_0x420cec[_0xbbbd('0x12')](0x1f4,_0x14dd0a[_0xbbbd('0x14')]));});}else _0x59a460(0x1);});});};function activateAdditionalPhone(_0x4f3b57,_0x31a518,_0x5dc1af,_0x1d84bd,_0x4c3044){return new Promise(function(_0x26bc8b,_0x32c682){var _0x36fbb2;if(_[_0xbbbd('0x2d')](_0x5dc1af[_0xbbbd('0x2e')])){_0x5dc1af['scheduledat']=moment();}if(moment()>moment(_0x5dc1af[_0xbbbd('0x2e')])){_0x36fbb2=moment()[_0xbbbd('0x2f')](_0x4c3044||0x3,_0xbbbd('0x30'));}else{if(_0x5dc1af[_0xbbbd('0x1e')]==0x0){_0x36fbb2=moment(_0x5dc1af[_0xbbbd('0x2e')]);}else{_0x36fbb2=moment()[_0xbbbd('0x2f')](_0x4c3044||0x3,_0xbbbd('0x30'));}}if(_[_0xbbbd('0x2d')](_0x36fbb2)){_0x36fbb2=moment()[_0xbbbd('0x2f')](_0x4c3044||0x3,_0xbbbd('0x30'));}var _0x11cdea={'phone':_0x4f3b57[_0xbbbd('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x4f3b57[_0xbbbd('0x1e')])?0x0:_0x4f3b57[_0xbbbd('0x1e')],'scheduledat':moment()[_0xbbbd('0x2f')](_0x1d84bd||0x1,_0xbbbd('0x30')),'countbusyretry':_0x31a518[_0xbbbd('0x21')],'countcongestionretry':_0x31a518[_0xbbbd('0x22')],'countnoanswerretry':_0x31a518[_0xbbbd('0x23')],'countnosuchnumberretry':_0x31a518[_0xbbbd('0x24')],'countdropretry':_0x31a518[_0xbbbd('0x25')],'countabandonedretry':_0x31a518[_0xbbbd('0x29')],'countmachineretry':_0x31a518[_0xbbbd('0x26')],'countagentrejectretry':_0x31a518['countagentrejectretry'],'createdAt':_0x31a518[_0xbbbd('0x32')],'updatedAt':_0x31a518[_0xbbbd('0x33')]};var _0xda61e7={'CmHopperId':_0x4f3b57['id'],'phone':_0x5dc1af['phone'],'active':0x0,'OrderBy':_[_0xbbbd('0x2d')](_0x5dc1af[_0xbbbd('0x1e')])?0x0:_0x5dc1af['OrderBy'],'scheduledat':_0x36fbb2,'countbusyretry':_0x5dc1af[_0xbbbd('0x21')],'countcongestionretry':_0x5dc1af['countcongestionretry'],'countnoanswerretry':_0x5dc1af[_0xbbbd('0x23')],'countnosuchnumberretry':_0x5dc1af['countnosuchnumberretry'],'countdropretry':_0x5dc1af['countdropretry'],'countabandonedretry':_0x5dc1af[_0xbbbd('0x29')],'countmachineretry':_0x5dc1af[_0xbbbd('0x26')],'countagentrejectretry':_0x5dc1af['countagentrejectretry'],'createdAt':_0x5dc1af[_0xbbbd('0x32')],'updatedAt':_0x5dc1af[_0xbbbd('0x33')]};return db[_0xbbbd('0x34')][_0xbbbd('0x35')](function(_0x4a6790){return db[_0xbbbd('0x28')][_0xbbbd('0x36')](_0x11cdea,{'where':{'id':_0x5dc1af['id']}},{'transaction':_0x4a6790})['then'](function(){return db[_0xbbbd('0x18')]['update'](_0xda61e7,{'where':{'id':_0x4f3b57['id']}},{'transaction':_0x4a6790});});})[_0xbbbd('0x20')](function(_0x49bb31){_0x26bc8b({'id':_0x4f3b57['id'],'phone':_0x5dc1af[_0xbbbd('0x31')]});})[_0xbbbd('0x16')](function(_0x1a11f8){logger['error'](_0xbbbd('0x37'),_0x1a11f8[_0xbbbd('0x14')]);_0x32c682({'error':_0x1a11f8['message']});});});}exports['IncrementPreviewCounters']=function(_0x39bb57){var _0x199660=this;return new Promise(function(_0x1c9d09,_0x18bdb1){return db[_0xbbbd('0x18')][_0xbbbd('0x36')](_0x39bb57['body'][_0xbbbd('0x38')],{'where':{'id':_0x39bb57[_0xbbbd('0x1a')]['id']}})[_0xbbbd('0x20')](function(_0x12668a){_0x1c9d09(_0x12668a);})[_0xbbbd('0x16')](function(_0x9c0ab1){logger['error'](_0xbbbd('0x39'),_0x9c0ab1[_0xbbbd('0x14')]);_0x18bdb1(_0x199660[_0xbbbd('0x12')](0x1f4,_0x9c0ab1[_0xbbbd('0x14')]));});});}; \ No newline at end of file +var _0xd6aa=['add','minutes','createdAt','updatedAt','phone','sequelize','IncrementPreviewCounters','field','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CmHopper','findOne','ContactId','ListId','body','VoiceQueueId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnoanswerretry','countnosuchnumberretry','VerifyAdditionalPhones','SwapAdditionalPhones','CampaignId','duration','isNil','scheduledat'];(function(_0x594e9d,_0x883433){var _0x2f4839=function(_0x28e1d4){while(--_0x28e1d4){_0x594e9d['push'](_0x594e9d['shift']());}};_0x2f4839(++_0x883433);}(_0xd6aa,0x182));var _0xad6a=function(_0x48baa3,_0x3cebbf){_0x48baa3=_0x48baa3-0x0;var _0x394bba=_0xd6aa[_0x48baa3];return _0x394bba;};'use strict';var _=require(_0xad6a('0x0'));var util=require(_0xad6a('0x1'));var moment=require('moment');var BPromise=require(_0xad6a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad6a('0x3'));var db=require(_0xad6a('0x4'))['db'];var utils=require(_0xad6a('0x5'));var logger=require(_0xad6a('0x6'))(_0xad6a('0x7'));var config=require(_0xad6a('0x8'));var jayson=require(_0xad6a('0x9'));var client=jayson[_0xad6a('0xa')][_0xad6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21cca8,_0x4c52bf,_0x3fe075){return new BPromise(function(_0x59ada9,_0x3d56d2){return client['request'](_0x21cca8,_0x3fe075)[_0xad6a('0xc')](function(_0xec3f65){logger[_0xad6a('0xd')](_0xad6a('0xe'),_0x4c52bf,_0xad6a('0xf'));logger['debug'](_0xad6a('0x10'),_0x4c52bf,_0xad6a('0xf'),JSON[_0xad6a('0x11')](_0xec3f65));if(_0xec3f65['error']){if(_0xec3f65['error']['code']===0x1f4){logger[_0xad6a('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4c52bf,_0xec3f65['error'][_0xad6a('0x13')]);return _0x3d56d2(_0xec3f65['error'][_0xad6a('0x13')]);}logger[_0xad6a('0x12')](_0xad6a('0xe'),_0x4c52bf,_0xec3f65[_0xad6a('0x12')][_0xad6a('0x13')]);return _0x59ada9(_0xec3f65[_0xad6a('0x12')][_0xad6a('0x13')]);}else{logger[_0xad6a('0xd')](_0xad6a('0xe'),_0x4c52bf,'request\x20sent');_0x59ada9(_0xec3f65['result'][_0xad6a('0x13')]);}})[_0xad6a('0x14')](function(_0x557328){logger[_0xad6a('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4c52bf,_0x557328);_0x3d56d2(_0x557328);});});}exports['VerifyAdditionalPhones']=function(_0x2f841a){var _0x2b61bf=this;return new Promise(function(_0x328364,_0x1dd5dd){return db[_0xad6a('0x15')][_0xad6a('0x16')]({'raw':!![],'where':{'ContactId':_0x2f841a['body'][_0xad6a('0x17')],'ListId':_0x2f841a['body'][_0xad6a('0x18')],'VoiceQueueId':_0x2f841a[_0xad6a('0x19')][_0xad6a('0x1a')]===undefined?null:_0x2f841a[_0xad6a('0x19')][_0xad6a('0x1a')],'CampaignId':_0x2f841a[_0xad6a('0x19')]['CampaignId']===undefined?null:_0x2f841a[_0xad6a('0x19')]['CampaignId']}})['then'](function(_0x37bc79){if(_0x37bc79!=null){return db[_0xad6a('0x1b')][_0xad6a('0x16')]({'raw':!![],'where':{'CmHopperId':_0x37bc79['id'],'OrderBy':{'$gt':_0x37bc79[_0xad6a('0x1c')]}},'order':[[_0xad6a('0x1c'),_0xad6a('0x1d')]]})[_0xad6a('0xc')](function(_0x38e9c0){var _0x2fd5e3=0x0;if(_0x38e9c0){if(_0x38e9c0[_0xad6a('0x1e')]+_0x38e9c0[_0xad6a('0x1f')]+_0x38e9c0['countnoanswerretry']+_0x38e9c0['countnosuchnumberretry']+_0x38e9c0[_0xad6a('0x20')]+_0x38e9c0[_0xad6a('0x21')]+_0x38e9c0[_0xad6a('0x22')]+_0x38e9c0[_0xad6a('0x23')]<_0x2f841a[_0xad6a('0x24')][_0xad6a('0x25')])_0x2fd5e3=0x1;_0x328364({'additional':_0x2fd5e3});}else{return db[_0xad6a('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x37bc79['id']},'order':[[_0xad6a('0x1c'),_0xad6a('0x1d')]]})['then'](function(_0x1e3e57){var _0x243a63=0x0;if(_0x1e3e57){if(_0x1e3e57[_0xad6a('0x1e')]+_0x1e3e57['countcongestionretry']+_0x1e3e57[_0xad6a('0x26')]+_0x1e3e57[_0xad6a('0x27')]+_0x1e3e57[_0xad6a('0x20')]+_0x1e3e57[_0xad6a('0x21')]+_0x1e3e57[_0xad6a('0x22')]+_0x1e3e57[_0xad6a('0x23')]<_0x2f841a[_0xad6a('0x24')]['dialGlobalMaxRetry'])_0x243a63=0x1;_0x328364({'additional':_0x243a63});}else{_0x328364({'additional':0x0});}})['catch'](function(_0x4664b6){logger['error'](_0xad6a('0x28'),_0x4664b6[_0xad6a('0x13')]);_0x1dd5dd(_0x2b61bf['error'](0x1f4,_0x4664b6[_0xad6a('0x13')]));});}})[_0xad6a('0x14')](function(_0x4dac41){logger[_0xad6a('0x12')](_0xad6a('0x28'),_0x4dac41['message']);_0x1dd5dd(_0x2b61bf[_0xad6a('0x12')](0x1f4,_0x4dac41[_0xad6a('0x13')]));});}else _0x328364({'additional':0x0});});});};exports[_0xad6a('0x29')]=function(_0x23467d){var _0x7888e7=this;return new Promise(function(_0x11744e,_0xfa4144){return db[_0xad6a('0x15')][_0xad6a('0x16')]({'raw':!![],'where':{'ContactId':_0x23467d[_0xad6a('0x19')][_0xad6a('0x17')],'ListId':_0x23467d[_0xad6a('0x19')]['ListId'],'VoiceQueueId':_0x23467d['body'][_0xad6a('0x1a')]===undefined?null:_0x23467d['body'][_0xad6a('0x1a')],'CampaignId':_0x23467d[_0xad6a('0x19')][_0xad6a('0x2a')]===undefined?null:_0x23467d[_0xad6a('0x19')][_0xad6a('0x2a')]}})['then'](function(_0x56de2c){if(_0x56de2c!=null){return db[_0xad6a('0x1b')][_0xad6a('0x16')]({'raw':!![],'where':{'CmHopperId':_0x56de2c['id'],'OrderBy':{'$gte':_0x56de2c[_0xad6a('0x1c')]}},'order':[['OrderBy',_0xad6a('0x1d')]]})['then'](function(_0x162cc7){if(_0x162cc7)return activateAdditionalPhone(_0x56de2c,_0x23467d[_0xad6a('0x19')],_0x162cc7,_0x23467d[_0xad6a('0x2b')],_0x23467d['waitTime'])['then'](function(_0x168042){_0x11744e(_0x168042);});else{return db[_0xad6a('0x1b')][_0xad6a('0x16')]({'raw':!![],'where':{'CmHopperId':_0x56de2c['id']},'order':[[_0xad6a('0x1c'),_0xad6a('0x1d')]]})[_0xad6a('0xc')](function(_0x19671e){if(_0x19671e)return activateAdditionalPhone(_0x56de2c,_0x23467d[_0xad6a('0x19')],_0x19671e,_0x23467d[_0xad6a('0x2b')],_0x23467d['waitTime'])['then'](function(_0x1121dd){_0x11744e(_0x1121dd);});else{_0x11744e({'id':_0x56de2c['id'],'phone':''});}})[_0xad6a('0x14')](function(_0x2b55fe){logger[_0xad6a('0x12')]('VerifyAdditionalPhones',_0x2b55fe[_0xad6a('0x13')]);_0xfa4144(_0x7888e7['error'](0x1f4,_0x2b55fe['message']));});}})[_0xad6a('0x14')](function(_0x50481f){logger[_0xad6a('0x12')](_0xad6a('0x28'),_0x50481f['message']);_0xfa4144(_0x7888e7[_0xad6a('0x12')](0x1f4,_0x50481f[_0xad6a('0x13')]));});}else _0x11744e(0x1);});});};function activateAdditionalPhone(_0x135c9a,_0x256c3a,_0x163eba,_0x2c1a45,_0x19e27b){return new Promise(function(_0x536052,_0x49757f){var _0x28ced3;if(_[_0xad6a('0x2c')](_0x163eba[_0xad6a('0x2d')])){_0x163eba[_0xad6a('0x2d')]=moment();}if(moment()>moment(_0x163eba[_0xad6a('0x2d')])){_0x28ced3=moment()[_0xad6a('0x2e')](_0x19e27b||0x3,_0xad6a('0x2f'));}else{if(_0x163eba[_0xad6a('0x1c')]==0x0){_0x28ced3=moment(_0x163eba['scheduledat']);}else{_0x28ced3=moment()[_0xad6a('0x2e')](_0x19e27b||0x3,_0xad6a('0x2f'));}}if(_[_0xad6a('0x2c')](_0x28ced3)){_0x28ced3=moment()[_0xad6a('0x2e')](_0x19e27b||0x3,_0xad6a('0x2f'));}var _0x33a138={'phone':_0x135c9a['phone'],'active':0x0,'OrderBy':_[_0xad6a('0x2c')](_0x135c9a[_0xad6a('0x1c')])?0x0:_0x135c9a[_0xad6a('0x1c')],'scheduledat':moment()[_0xad6a('0x2e')](_0x2c1a45||0x1,'minutes'),'countbusyretry':_0x256c3a[_0xad6a('0x1e')],'countcongestionretry':_0x256c3a[_0xad6a('0x1f')],'countnoanswerretry':_0x256c3a[_0xad6a('0x26')],'countnosuchnumberretry':_0x256c3a[_0xad6a('0x27')],'countdropretry':_0x256c3a[_0xad6a('0x20')],'countabandonedretry':_0x256c3a['countabandonedretry'],'countmachineretry':_0x256c3a[_0xad6a('0x22')],'countagentrejectretry':_0x256c3a['countagentrejectretry'],'createdAt':_0x256c3a[_0xad6a('0x30')],'updatedAt':_0x256c3a[_0xad6a('0x31')]};var _0x58b442={'CmHopperId':_0x135c9a['id'],'phone':_0x163eba[_0xad6a('0x32')],'active':0x0,'OrderBy':_[_0xad6a('0x2c')](_0x163eba['OrderBy'])?0x0:_0x163eba[_0xad6a('0x1c')],'scheduledat':_0x28ced3,'countbusyretry':_0x163eba[_0xad6a('0x1e')],'countcongestionretry':_0x163eba[_0xad6a('0x1f')],'countnoanswerretry':_0x163eba[_0xad6a('0x26')],'countnosuchnumberretry':_0x163eba['countnosuchnumberretry'],'countdropretry':_0x163eba[_0xad6a('0x20')],'countabandonedretry':_0x163eba[_0xad6a('0x21')],'countmachineretry':_0x163eba[_0xad6a('0x22')],'countagentrejectretry':_0x163eba[_0xad6a('0x23')],'createdAt':_0x163eba[_0xad6a('0x30')],'updatedAt':_0x163eba[_0xad6a('0x31')]};return db[_0xad6a('0x33')]['transaction'](function(_0x45a647){return db[_0xad6a('0x1b')]['update'](_0x33a138,{'where':{'id':_0x163eba['id']}},{'transaction':_0x45a647})[_0xad6a('0xc')](function(){return db[_0xad6a('0x15')]['update'](_0x58b442,{'where':{'id':_0x135c9a['id']}},{'transaction':_0x45a647});});})[_0xad6a('0xc')](function(_0x317f13){_0x536052({'id':_0x135c9a['id'],'phone':_0x163eba['phone']});})[_0xad6a('0x14')](function(_0xbb8aee){logger[_0xad6a('0x12')]('activateAdditionalPhone',_0xbb8aee[_0xad6a('0x13')]);_0x49757f({'error':_0xbb8aee[_0xad6a('0x13')]});});});}exports[_0xad6a('0x34')]=function(_0x16589f){var _0x1b278d=this;return new Promise(function(_0x315a34,_0x3c40ad){return db[_0xad6a('0x15')]['update'](_0x16589f['body'][_0xad6a('0x35')],{'where':{'id':_0x16589f['body']['id']}})[_0xad6a('0xc')](function(_0x3e9661){_0x315a34(_0x3e9661);})[_0xad6a('0x14')](function(_0x30b559){logger['error'](_0xad6a('0x34'),_0x30b559[_0xad6a('0x13')]);_0x3c40ad(_0x1b278d[_0xad6a('0x12')](0x1f4,_0x30b559[_0xad6a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index e371b79..d57437a 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 _0xd7ed=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x2e59d9,_0x348d00){var _0x1d1dd8=function(_0x50ee5d){while(--_0x50ee5d){_0x2e59d9['push'](_0x2e59d9['shift']());}};_0x1d1dd8(++_0x348d00);}(_0xd7ed,0x1a1));var _0xdd7e=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xd7ed[_0x1da527];return _0x40fc7c;};'use strict';var multer=require(_0xdd7e('0x0'));var util=require('util');var path=require(_0xdd7e('0x1'));var timeout=require(_0xdd7e('0x2'));var express=require('express');var router=express[_0xdd7e('0x3')]();var fs_extra=require(_0xdd7e('0x4'));var auth=require(_0xdd7e('0x5'));var interaction=require(_0xdd7e('0x6'));var config=require(_0xdd7e('0x7'));var controller=require(_0xdd7e('0x8'));router[_0xdd7e('0x9')]('/',auth[_0xdd7e('0xa')](),controller[_0xdd7e('0xb')]);router[_0xdd7e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdd7e('0xc')]);router[_0xdd7e('0xd')]('/',auth['isAuthenticated'](),controller[_0xdd7e('0xe')]);router[_0xdd7e('0xf')](_0xdd7e('0x10'),auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x11')]);router[_0xdd7e('0x12')](_0xdd7e('0x10'),auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x13')]);module[_0xdd7e('0x14')]=router; \ No newline at end of file +var _0xa45b=['isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xa7e305,_0x1cf42d){var _0x1d1ae4=function(_0x44e41e){while(--_0x44e41e){_0xa7e305['push'](_0xa7e305['shift']());}};_0x1d1ae4(++_0x1cf42d);}(_0xa45b,0x199));var _0xba45=function(_0x1577bc,_0x131e2b){_0x1577bc=_0x1577bc-0x0;var _0x500f75=_0xa45b[_0x1577bc];return _0x500f75;};'use strict';var multer=require('multer');var util=require(_0xba45('0x0'));var path=require(_0xba45('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xba45('0x2'));var auth=require(_0xba45('0x3'));var interaction=require(_0xba45('0x4'));var config=require(_0xba45('0x5'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0xba45('0x6')]('/',auth[_0xba45('0x7')](),controller[_0xba45('0x8')]);router[_0xba45('0x6')](_0xba45('0x9'),auth[_0xba45('0x7')](),controller[_0xba45('0xa')]);router[_0xba45('0xb')]('/',auth['isAuthenticated'](),controller[_0xba45('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xba45('0xd')](_0xba45('0x9'),auth['isAuthenticated'](),controller[_0xba45('0xe')]);module[_0xba45('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 5d646ce..2478e99 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 _0x21cd=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x29f95d,_0x4bb951){var _0x216ddd=function(_0x5764c4){while(--_0x5764c4){_0x29f95d['push'](_0x29f95d['shift']());}};_0x216ddd(++_0x4bb951);}(_0x21cd,0x6a));var _0xd21c=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x21cd[_0x4b055c];return _0x4b62bb;};'use strict';var moment=require(_0xd21c('0x0'));var Sequelize=require(_0xd21c('0x1'));module[_0xd21c('0x2')]={'phone':{'type':Sequelize[_0xd21c('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xd21c('0x4')],'unique':_0xd21c('0x5')},'ListId':{'type':Sequelize[_0xd21c('0x4')],'unique':_0xd21c('0x5')},'VoiceQueueId':{'type':Sequelize[_0xd21c('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x4351=['sequelize','exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x2d7959,_0x106897){var _0x6c5cba=function(_0x198e7c){while(--_0x198e7c){_0x2d7959['push'](_0x2d7959['shift']());}};_0x6c5cba(++_0x106897);}(_0x4351,0x1b5));var _0x1435=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4351[_0x2d7f0e];return _0x110b07;};'use strict';var moment=require(_0x1435('0x0'));var Sequelize=require(_0x1435('0x1'));module[_0x1435('0x2')]={'phone':{'type':Sequelize[_0x1435('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x1435('0x4')],'unique':_0x1435('0x5')},'ListId':{'type':Sequelize[_0x1435('0x4')],'unique':_0x1435('0x5')},'VoiceQueueId':{'type':Sequelize[_0x1435('0x4')],'unique':_0x1435('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 962f23c..a174ef6 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 _0x068d=['body','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','map','CmHopperBlack','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','type','filter','merge','includeAll','include','rows','catch','show','params','fields'];(function(_0x33558c,_0x48314c){var _0xff3591=function(_0x3d49d4){while(--_0x3d49d4){_0x33558c['push'](_0x33558c['shift']());}};_0xff3591(++_0x48314c);}(_0x068d,0x166));var _0xd068=function(_0x424fc8,_0x32a514){_0x424fc8=_0x424fc8-0x0;var _0x44c86d=_0x068d[_0x424fc8];return _0x44c86d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd068('0x0'));var zipdir=require(_0xd068('0x1'));var jsonpatch=require(_0xd068('0x2'));var rp=require('request-promise');var moment=require(_0xd068('0x3'));var BPromise=require(_0xd068('0x4'));var Mustache=require(_0xd068('0x5'));var util=require(_0xd068('0x6'));var path=require(_0xd068('0x7'));var sox=require(_0xd068('0x8'));var csv=require(_0xd068('0x9'));var ejs=require(_0xd068('0xa'));var fs=require('fs');var fs_extra=require(_0xd068('0xb'));var _=require(_0xd068('0xc'));var squel=require(_0xd068('0xd'));var crypto=require('crypto');var jsforce=require(_0xd068('0xe'));var deskjs=require(_0xd068('0xf'));var toCsv=require(_0xd068('0x9'));var querystring=require(_0xd068('0x10'));var Papa=require(_0xd068('0x11'));var Redis=require(_0xd068('0x12'));var authService=require(_0xd068('0x13'));var qs=require(_0xd068('0x14'));var as=require(_0xd068('0x15'));var hardwareService=require(_0xd068('0x16'));var logger=require('../../config/logger')(_0xd068('0x17'));var utils=require(_0xd068('0x18'));var config=require(_0xd068('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18f410,_0x41256f){_0x41256f=_0x41256f||0xcc;return function(_0x321f58){if(_0x321f58){return _0x18f410['sendStatus'](_0x41256f);}return _0x18f410[_0xd068('0x1a')](_0x41256f)[_0xd068('0x1b')]();};}function respondWithResult(_0x1210e3,_0xc7349d){_0xc7349d=_0xc7349d||0xc8;return function(_0x4830ab){if(_0x4830ab){return _0x1210e3['status'](_0xc7349d)[_0xd068('0x1c')](_0x4830ab);}};}function respondWithFilteredResult(_0x53ece2,_0x5e2df4){return function(_0x2afda6){if(_0x2afda6){var _0xcbbeaa=typeof _0x5e2df4[_0xd068('0x1d')]==='undefined'&&typeof _0x5e2df4[_0xd068('0x1e')]===_0xd068('0x1f');var _0x1dd7ba=_0x2afda6[_0xd068('0x20')];var _0x27c017=_0xcbbeaa?0x0:_0x5e2df4[_0xd068('0x1d')];var _0x1529c9=_0xcbbeaa?_0x2afda6[_0xd068('0x20')]:_0x5e2df4[_0xd068('0x1d')]+_0x5e2df4['limit'];var _0x56e542;if(_0x1529c9>=_0x1dd7ba){_0x1529c9=_0x1dd7ba;_0x56e542=0xc8;}else{_0x56e542=0xce;}_0x53ece2[_0xd068('0x1a')](_0x56e542);return _0x53ece2[_0xd068('0x21')](_0xd068('0x22'),_0x27c017+'-'+_0x1529c9+'/'+_0x1dd7ba)['json'](_0x2afda6);}return null;};}function patchUpdates(_0x5d17e1){return function(_0x1436ee){try{jsonpatch['apply'](_0x1436ee,_0x5d17e1,!![]);}catch(_0x2dfc70){return BPromise[_0xd068('0x23')](_0x2dfc70);}return _0x1436ee[_0xd068('0x24')]();};}function saveUpdates(_0x544a95,_0x244376){return function(_0x41646a){if(_0x41646a){return _0x41646a[_0xd068('0x25')](_0x544a95)['then'](function(_0x30a2e9){return _0x30a2e9;});}return null;};}function removeEntity(_0xf7ea46,_0x3f394c){return function(_0x799626){if(_0x799626){return _0x799626[_0xd068('0x26')]()[_0xd068('0x27')](function(){_0xf7ea46['status'](0xcc)[_0xd068('0x1b')]();});}};}function handleEntityNotFound(_0x5aa86b,_0x51fd55){return function(_0x10b129){if(!_0x10b129){_0x5aa86b['sendStatus'](0x194);}return _0x10b129;};}function handleError(_0x138bac,_0x2d5259){_0x2d5259=_0x2d5259||0x1f4;return function(_0x164957){logger[_0xd068('0x28')](_0x164957['stack']);if(_0x164957[_0xd068('0x29')]){delete _0x164957[_0xd068('0x29')];}_0x138bac[_0xd068('0x1a')](_0x2d5259)[_0xd068('0x2a')](_0x164957);};}exports['index']=function(_0x16c213,_0x545479){var _0x5b2b73={},_0x5d0063={},_0x18510b={'count':0x0,'rows':[]};var _0x567f0e=_[_0xd068('0x2b')](db[_0xd068('0x2c')][_0xd068('0x2d')],function(_0x40de5c){return{'name':_0x40de5c[_0xd068('0x2e')],'type':_0x40de5c['type'][_0xd068('0x2f')]};});_0x5d0063[_0xd068('0x30')]=_['map'](_0x567f0e,_0xd068('0x29'));_0x5d0063[_0xd068('0x31')]=_[_0xd068('0x32')](_0x16c213[_0xd068('0x31')]);_0x5d0063[_0xd068('0x33')]=_[_0xd068('0x34')](_0x5d0063[_0xd068('0x30')],_0x5d0063['query']);_0x5b2b73[_0xd068('0x35')]=_[_0xd068('0x34')](_0x5d0063[_0xd068('0x30')],qs['fields'](_0x16c213[_0xd068('0x31')]['fields']));_0x5b2b73['attributes']=_0x5b2b73[_0xd068('0x35')][_0xd068('0x36')]?_0x5b2b73[_0xd068('0x35')]:_0x5d0063['model'];if(!_0x16c213[_0xd068('0x31')]['hasOwnProperty']('nolimit')){_0x5b2b73[_0xd068('0x1e')]=qs['limit'](_0x16c213['query'][_0xd068('0x1e')]);_0x5b2b73[_0xd068('0x1d')]=qs['offset'](_0x16c213[_0xd068('0x31')][_0xd068('0x1d')]);}_0x5b2b73[_0xd068('0x37')]=qs[_0xd068('0x38')](_0x16c213[_0xd068('0x31')]['sort']);_0x5b2b73[_0xd068('0x39')]=qs['filters'](_['pick'](_0x16c213[_0xd068('0x31')],_0x5d0063[_0xd068('0x33')]),_0x567f0e);if(_0x16c213['query']['filter']){_0x5b2b73[_0xd068('0x39')]=_['merge'](_0x5b2b73['where'],{'$or':_[_0xd068('0x2b')](_0x567f0e,function(_0x22369e){if(_0x22369e[_0xd068('0x3a')]!=='VIRTUAL'){var _0x209ec3={};_0x209ec3[_0x22369e[_0xd068('0x29')]]={'$like':'%'+_0x16c213['query'][_0xd068('0x3b')]+'%'};return _0x209ec3;}})});}_0x5b2b73=_[_0xd068('0x3c')]({},_0x5b2b73,_0x16c213['options']);var _0x70a36a={'where':_0x5b2b73['where']};return db['CmHopperBlack'][_0xd068('0x20')](_0x70a36a)[_0xd068('0x27')](function(_0x18b751){_0x18510b[_0xd068('0x20')]=_0x18b751;if(_0x16c213[_0xd068('0x31')][_0xd068('0x3d')]){_0x5b2b73[_0xd068('0x3e')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x5b2b73);})[_0xd068('0x27')](function(_0x486279){_0x18510b[_0xd068('0x3f')]=_0x486279;return _0x18510b;})[_0xd068('0x27')](respondWithFilteredResult(_0x545479,_0x5b2b73))[_0xd068('0x40')](handleError(_0x545479,null));};exports[_0xd068('0x41')]=function(_0x5b6658,_0x50c263){var _0x2e4aba={'raw':!![],'where':{'id':_0x5b6658[_0xd068('0x42')]['id']}},_0x49e7d6={};_0x49e7d6['model']=_[_0xd068('0x32')](db[_0xd068('0x2c')][_0xd068('0x2d')]);_0x49e7d6['query']=_[_0xd068('0x32')](_0x5b6658[_0xd068('0x31')]);_0x49e7d6['filters']=_['intersection'](_0x49e7d6[_0xd068('0x30')],_0x49e7d6[_0xd068('0x31')]);_0x2e4aba[_0xd068('0x35')]=_[_0xd068('0x34')](_0x49e7d6[_0xd068('0x30')],qs[_0xd068('0x43')](_0x5b6658[_0xd068('0x31')]['fields']));_0x2e4aba[_0xd068('0x35')]=_0x2e4aba[_0xd068('0x35')]['length']?_0x2e4aba[_0xd068('0x35')]:_0x49e7d6[_0xd068('0x30')];if(_0x5b6658[_0xd068('0x31')][_0xd068('0x3d')]){_0x2e4aba[_0xd068('0x3e')]=[{'all':!![]}];}_0x2e4aba=_[_0xd068('0x3c')]({},_0x2e4aba,_0x5b6658['options']);return db['CmHopperBlack']['find'](_0x2e4aba)[_0xd068('0x27')](handleEntityNotFound(_0x50c263,null))[_0xd068('0x27')](respondWithResult(_0x50c263,null))[_0xd068('0x40')](handleError(_0x50c263,null));};exports[_0xd068('0x25')]=function(_0x4dbfa9,_0x1c5e3c){if(_0x4dbfa9[_0xd068('0x44')]['id']){delete _0x4dbfa9['body']['id'];}return db[_0xd068('0x2c')]['find']({'where':{'id':_0x4dbfa9[_0xd068('0x42')]['id']}})[_0xd068('0x27')](handleEntityNotFound(_0x1c5e3c,null))[_0xd068('0x27')](saveUpdates(_0x4dbfa9[_0xd068('0x44')],null))[_0xd068('0x27')](respondWithResult(_0x1c5e3c,null))[_0xd068('0x40')](handleError(_0x1c5e3c,null));};exports[_0xd068('0x26')]=function(_0x32165b,_0x43231a){return db['CmHopperBlack'][_0xd068('0x45')]({'where':{'id':_0x32165b[_0xd068('0x42')]['id']}})[_0xd068('0x27')](handleEntityNotFound(_0x43231a,null))[_0xd068('0x27')](removeEntity(_0x43231a,null))[_0xd068('0x40')](handleError(_0x43231a,null));};exports['describe']=function(_0x3370f3,_0xf302ac){return db[_0xd068('0x2c')][_0xd068('0x46')]()[_0xd068('0x27')](respondWithResult(_0xf302ac,null))['catch'](handleError(_0xf302ac,null));}; \ No newline at end of file +var _0xbe46=['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','status','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','nolimit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','keys','length','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','crypto'];(function(_0x2a75e8,_0x263a08){var _0xbb495b=function(_0x8115e3){while(--_0x8115e3){_0x2a75e8['push'](_0x2a75e8['shift']());}};_0xbb495b(++_0x263a08);}(_0xbe46,0x1e6));var _0x6be4=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xbe46[_0x4dbaad];return _0x226c72;};'use strict';var emlformat=require(_0x6be4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6be4('0x1'));var jsonpatch=require(_0x6be4('0x2'));var rp=require(_0x6be4('0x3'));var moment=require(_0x6be4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6be4('0x5'));var util=require(_0x6be4('0x6'));var path=require(_0x6be4('0x7'));var sox=require(_0x6be4('0x8'));var csv=require(_0x6be4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6be4('0xa'));var jsforce=require(_0x6be4('0xb'));var deskjs=require(_0x6be4('0xc'));var toCsv=require(_0x6be4('0x9'));var querystring=require(_0x6be4('0xd'));var Papa=require(_0x6be4('0xe'));var Redis=require('ioredis');var authService=require(_0x6be4('0xf'));var qs=require(_0x6be4('0x10'));var as=require(_0x6be4('0x11'));var hardwareService=require(_0x6be4('0x12'));var logger=require('../../config/logger')(_0x6be4('0x13'));var utils=require(_0x6be4('0x14'));var config=require(_0x6be4('0x15'));var licenseUtil=require(_0x6be4('0x16'));var db=require(_0x6be4('0x17'))['db'];function respondWithStatusCode(_0x42f830,_0x42ab51){_0x42ab51=_0x42ab51||0xcc;return function(_0x19f753){if(_0x19f753){return _0x42f830['sendStatus'](_0x42ab51);}return _0x42f830[_0x6be4('0x18')](_0x42ab51)['end']();};}function respondWithResult(_0x30bf25,_0x3829cc){_0x3829cc=_0x3829cc||0xc8;return function(_0x8cd03f){if(_0x8cd03f){return _0x30bf25[_0x6be4('0x18')](_0x3829cc)['json'](_0x8cd03f);}};}function respondWithFilteredResult(_0x225029,_0x5c3f14){return function(_0x5a6840){if(_0x5a6840){var _0x539b72=typeof _0x5c3f14[_0x6be4('0x19')]==='undefined'&&typeof _0x5c3f14['limit']===_0x6be4('0x1a');var _0x169120=_0x5a6840[_0x6be4('0x1b')];var _0x16fed6=_0x539b72?0x0:_0x5c3f14[_0x6be4('0x19')];var _0x50425f=_0x539b72?_0x5a6840[_0x6be4('0x1b')]:_0x5c3f14[_0x6be4('0x19')]+_0x5c3f14[_0x6be4('0x1c')];var _0x21b3b8;if(_0x50425f>=_0x169120){_0x50425f=_0x169120;_0x21b3b8=0xc8;}else{_0x21b3b8=0xce;}_0x225029[_0x6be4('0x18')](_0x21b3b8);return _0x225029['set'](_0x6be4('0x1d'),_0x16fed6+'-'+_0x50425f+'/'+_0x169120)['json'](_0x5a6840);}return null;};}function patchUpdates(_0x5535a5){return function(_0x2b1bd8){try{jsonpatch[_0x6be4('0x1e')](_0x2b1bd8,_0x5535a5,!![]);}catch(_0x42bee1){return BPromise[_0x6be4('0x1f')](_0x42bee1);}return _0x2b1bd8[_0x6be4('0x20')]();};}function saveUpdates(_0x17559d,_0x1d1cd9){return function(_0x368568){if(_0x368568){return _0x368568[_0x6be4('0x21')](_0x17559d)[_0x6be4('0x22')](function(_0x4d1ad0){return _0x4d1ad0;});}return null;};}function removeEntity(_0x118043,_0x4506c5){return function(_0x142d1c){if(_0x142d1c){return _0x142d1c[_0x6be4('0x23')]()['then'](function(){_0x118043[_0x6be4('0x18')](0xcc)[_0x6be4('0x24')]();});}};}function handleEntityNotFound(_0x534723,_0x4a032d){return function(_0x3dcba0){if(!_0x3dcba0){_0x534723[_0x6be4('0x25')](0x194);}return _0x3dcba0;};}function handleError(_0x54ec36,_0x51cb8d){_0x51cb8d=_0x51cb8d||0x1f4;return function(_0x519892){logger['error'](_0x519892[_0x6be4('0x26')]);if(_0x519892[_0x6be4('0x27')]){delete _0x519892[_0x6be4('0x27')];}_0x54ec36['status'](_0x51cb8d)[_0x6be4('0x28')](_0x519892);};}exports[_0x6be4('0x29')]=function(_0x2d9e41,_0x2afa5b){var _0x480366={},_0x148704={},_0x1d24b7={'count':0x0,'rows':[]};var _0x2075b7=_[_0x6be4('0x2a')](db[_0x6be4('0x2b')][_0x6be4('0x2c')],function(_0x3ba31d){return{'name':_0x3ba31d[_0x6be4('0x2d')],'type':_0x3ba31d['type'][_0x6be4('0x2e')]};});_0x148704[_0x6be4('0x2f')]=_['map'](_0x2075b7,'name');_0x148704[_0x6be4('0x30')]=_['keys'](_0x2d9e41[_0x6be4('0x30')]);_0x148704[_0x6be4('0x31')]=_['intersection'](_0x148704[_0x6be4('0x2f')],_0x148704['query']);_0x480366[_0x6be4('0x32')]=_[_0x6be4('0x33')](_0x148704[_0x6be4('0x2f')],qs[_0x6be4('0x34')](_0x2d9e41[_0x6be4('0x30')]['fields']));_0x480366[_0x6be4('0x32')]=_0x480366[_0x6be4('0x32')]['length']?_0x480366['attributes']:_0x148704[_0x6be4('0x2f')];if(!_0x2d9e41[_0x6be4('0x30')]['hasOwnProperty'](_0x6be4('0x35'))){_0x480366['limit']=qs[_0x6be4('0x1c')](_0x2d9e41[_0x6be4('0x30')][_0x6be4('0x1c')]);_0x480366[_0x6be4('0x19')]=qs[_0x6be4('0x19')](_0x2d9e41['query']['offset']);}_0x480366[_0x6be4('0x36')]=qs['sort'](_0x2d9e41[_0x6be4('0x30')]['sort']);_0x480366[_0x6be4('0x37')]=qs[_0x6be4('0x31')](_[_0x6be4('0x38')](_0x2d9e41['query'],_0x148704[_0x6be4('0x31')]),_0x2075b7);if(_0x2d9e41['query'][_0x6be4('0x39')]){_0x480366[_0x6be4('0x37')]=_['merge'](_0x480366[_0x6be4('0x37')],{'$or':_['map'](_0x2075b7,function(_0x336c3a){if(_0x336c3a['type']!==_0x6be4('0x3a')){var _0x402da4={};_0x402da4[_0x336c3a['name']]={'$like':'%'+_0x2d9e41[_0x6be4('0x30')]['filter']+'%'};return _0x402da4;}})});}_0x480366=_[_0x6be4('0x3b')]({},_0x480366,_0x2d9e41[_0x6be4('0x3c')]);var _0x346444={'where':_0x480366[_0x6be4('0x37')]};return db[_0x6be4('0x2b')][_0x6be4('0x1b')](_0x346444)[_0x6be4('0x22')](function(_0x119340){_0x1d24b7[_0x6be4('0x1b')]=_0x119340;if(_0x2d9e41[_0x6be4('0x30')][_0x6be4('0x3d')]){_0x480366[_0x6be4('0x3e')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x480366);})['then'](function(_0x507595){_0x1d24b7[_0x6be4('0x3f')]=_0x507595;return _0x1d24b7;})[_0x6be4('0x22')](respondWithFilteredResult(_0x2afa5b,_0x480366))[_0x6be4('0x40')](handleError(_0x2afa5b,null));};exports['show']=function(_0x3c79b3,_0x515eed){var _0x1b6d0d={'raw':!![],'where':{'id':_0x3c79b3[_0x6be4('0x41')]['id']}},_0x3ae99a={};_0x3ae99a[_0x6be4('0x2f')]=_[_0x6be4('0x42')](db['CmHopperBlack'][_0x6be4('0x2c')]);_0x3ae99a['query']=_['keys'](_0x3c79b3[_0x6be4('0x30')]);_0x3ae99a['filters']=_['intersection'](_0x3ae99a[_0x6be4('0x2f')],_0x3ae99a[_0x6be4('0x30')]);_0x1b6d0d['attributes']=_['intersection'](_0x3ae99a[_0x6be4('0x2f')],qs[_0x6be4('0x34')](_0x3c79b3['query']['fields']));_0x1b6d0d[_0x6be4('0x32')]=_0x1b6d0d[_0x6be4('0x32')][_0x6be4('0x43')]?_0x1b6d0d[_0x6be4('0x32')]:_0x3ae99a[_0x6be4('0x2f')];if(_0x3c79b3[_0x6be4('0x30')]['includeAll']){_0x1b6d0d[_0x6be4('0x3e')]=[{'all':!![]}];}_0x1b6d0d=_['merge']({},_0x1b6d0d,_0x3c79b3[_0x6be4('0x3c')]);return db[_0x6be4('0x2b')][_0x6be4('0x44')](_0x1b6d0d)[_0x6be4('0x22')](handleEntityNotFound(_0x515eed,null))[_0x6be4('0x22')](respondWithResult(_0x515eed,null))[_0x6be4('0x40')](handleError(_0x515eed,null));};exports[_0x6be4('0x21')]=function(_0x1c52e7,_0x228e95){if(_0x1c52e7[_0x6be4('0x45')]['id']){delete _0x1c52e7[_0x6be4('0x45')]['id'];}return db[_0x6be4('0x2b')]['find']({'where':{'id':_0x1c52e7[_0x6be4('0x41')]['id']}})[_0x6be4('0x22')](handleEntityNotFound(_0x228e95,null))[_0x6be4('0x22')](saveUpdates(_0x1c52e7[_0x6be4('0x45')],null))[_0x6be4('0x22')](respondWithResult(_0x228e95,null))[_0x6be4('0x40')](handleError(_0x228e95,null));};exports['destroy']=function(_0x58db4c,_0x39908a){return db['CmHopperBlack'][_0x6be4('0x44')]({'where':{'id':_0x58db4c['params']['id']}})[_0x6be4('0x22')](handleEntityNotFound(_0x39908a,null))[_0x6be4('0x22')](removeEntity(_0x39908a,null))[_0x6be4('0x40')](handleError(_0x39908a,null));};exports['describe']=function(_0x40efec,_0x5a34b7){return db['CmHopperBlack'][_0x6be4('0x46')]()['then'](respondWithResult(_0x5a34b7,null))[_0x6be4('0x40')](handleError(_0x5a34b7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 2d172df..b911cb3 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 _0x07e3=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','util','api'];(function(_0x3d7595,_0x23bf60){var _0x163d06=function(_0x2c3a21){while(--_0x2c3a21){_0x3d7595['push'](_0x3d7595['shift']());}};_0x163d06(++_0x23bf60);}(_0x07e3,0x1c0));var _0x307e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x07e3[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x307e('0x0'));var logger=require('../../config/logger')(_0x307e('0x1'));var moment=require('moment');var BPromise=require(_0x307e('0x2'));var rp=require(_0x307e('0x3'));var fs=require('fs');var path=require(_0x307e('0x4'));var rimraf=require(_0x307e('0x5'));var config=require(_0x307e('0x6'));var attributes=require(_0x307e('0x7'));module[_0x307e('0x8')]=function(_0x18a769,_0xc3fef1){return _0x18a769[_0x307e('0x9')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cd5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define'];(function(_0x2447d7,_0x3466fe){var _0x262442=function(_0x4fd8d5){while(--_0x4fd8d5){_0x2447d7['push'](_0x2447d7['shift']());}};_0x262442(++_0x3466fe);}(_0x7cd5,0x96));var _0x57cd=function(_0x185de3,_0x4b6b36){_0x185de3=_0x185de3-0x0;var _0x5981b2=_0x7cd5[_0x185de3];return _0x5981b2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x57cd('0x0'))(_0x57cd('0x1'));var moment=require(_0x57cd('0x2'));var BPromise=require(_0x57cd('0x3'));var rp=require(_0x57cd('0x4'));var fs=require('fs');var path=require(_0x57cd('0x5'));var rimraf=require(_0x57cd('0x6'));var config=require(_0x57cd('0x7'));var attributes=require(_0x57cd('0x8'));module['exports']=function(_0x296cda,_0xfb9a31){return _0x296cda[_0x57cd('0x9')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','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 9180210..7660b25 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 _0xe7a3=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','DestroyCmHopperBlack','destroy'];(function(_0x11cbc6,_0x491855){var _0x425f5c=function(_0x4986c3){while(--_0x4986c3){_0x11cbc6['push'](_0x11cbc6['shift']());}};_0x425f5c(++_0x491855);}(_0xe7a3,0x1c8));var _0x3e7a=function(_0x170873,_0x4a15b2){_0x170873=_0x170873-0x0;var _0x19a340=_0xe7a3[_0x170873];return _0x19a340;};'use strict';var _=require(_0x3e7a('0x0'));var util=require(_0x3e7a('0x1'));var moment=require(_0x3e7a('0x2'));var BPromise=require(_0x3e7a('0x3'));var rs=require(_0x3e7a('0x4'));var fs=require('fs');var Redis=require(_0x3e7a('0x5'));var db=require(_0x3e7a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e7a('0x7'))('rpc');var config=require(_0x3e7a('0x8'));var jayson=require(_0x3e7a('0x9'));var client=jayson[_0x3e7a('0xa')][_0x3e7a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x220c07,_0xe690a,_0x4f197e){return new BPromise(function(_0x33f33a,_0x59642a){return client[_0x3e7a('0xc')](_0x220c07,_0x4f197e)[_0x3e7a('0xd')](function(_0x1261fb){logger[_0x3e7a('0xe')](_0x3e7a('0xf'),_0xe690a,_0x3e7a('0x10'));logger[_0x3e7a('0x11')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0xe690a,_0x3e7a('0x10'),JSON[_0x3e7a('0x12')](_0x1261fb));if(_0x1261fb[_0x3e7a('0x13')]){if(_0x1261fb['error'][_0x3e7a('0x14')]===0x1f4){logger[_0x3e7a('0x13')](_0x3e7a('0xf'),_0xe690a,_0x1261fb[_0x3e7a('0x13')][_0x3e7a('0x15')]);return _0x59642a(_0x1261fb[_0x3e7a('0x13')][_0x3e7a('0x15')]);}logger[_0x3e7a('0x13')](_0x3e7a('0xf'),_0xe690a,_0x1261fb[_0x3e7a('0x13')]['message']);return _0x33f33a(_0x1261fb[_0x3e7a('0x13')]['message']);}else{logger[_0x3e7a('0xe')](_0x3e7a('0xf'),_0xe690a,_0x3e7a('0x10'));_0x33f33a(_0x1261fb['result'][_0x3e7a('0x15')]);}})[_0x3e7a('0x16')](function(_0x204529){logger['error'](_0x3e7a('0xf'),_0xe690a,_0x204529);_0x59642a(_0x204529);});});}exports[_0x3e7a('0x17')]=function(_0x39ea67){var _0x4a1fa4=this;return new Promise(function(_0x53158e,_0x714a0a){return db[_0x3e7a('0x18')][_0x3e7a('0x19')]({'raw':_0x39ea67[_0x3e7a('0x1a')]?_0x39ea67[_0x3e7a('0x1a')][_0x3e7a('0x1b')]===undefined?!![]:![]:!![],'where':_0x39ea67[_0x3e7a('0x1a')]?_0x39ea67['options'][_0x3e7a('0x1c')]||null:null,'attributes':_0x39ea67[_0x3e7a('0x1a')]?_0x39ea67[_0x3e7a('0x1a')][_0x3e7a('0x1d')]||null:null,'limit':_0x39ea67['options']?_0x39ea67[_0x3e7a('0x1a')][_0x3e7a('0x1e')]||null:null,'include':_0x39ea67[_0x3e7a('0x1a')]?_0x39ea67['options'][_0x3e7a('0x1f')]?_[_0x3e7a('0x20')](_0x39ea67[_0x3e7a('0x1a')][_0x3e7a('0x1f')],function(_0x96be52){return{'model':db[_0x96be52[_0x3e7a('0x21')]],'as':_0x96be52['as'],'attributes':_0x96be52[_0x3e7a('0x1d')],'include':_0x96be52[_0x3e7a('0x1f')]?_[_0x3e7a('0x20')](_0x96be52[_0x3e7a('0x1f')],function(_0x1c802c){return{'model':db[_0x1c802c[_0x3e7a('0x21')]],'as':_0x1c802c['as'],'attributes':_0x1c802c[_0x3e7a('0x1d')],'include':_0x1c802c['include']?_[_0x3e7a('0x20')](_0x1c802c[_0x3e7a('0x1f')],function(_0x21e4f8){return{'model':db[_0x21e4f8['model']],'as':_0x21e4f8['as'],'attributes':_0x21e4f8[_0x3e7a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30cb20){logger['info'](_0x3e7a('0x17'),_0x39ea67);logger[_0x3e7a('0x11')]('GetCmHopperBlack',_0x39ea67,JSON['stringify'](_0x30cb20));_0x53158e(_0x30cb20);})[_0x3e7a('0x16')](function(_0x17d25c){logger[_0x3e7a('0x13')](_0x3e7a('0x17'),_0x17d25c[_0x3e7a('0x15')],_0x39ea67);_0x714a0a(_0x4a1fa4[_0x3e7a('0x13')](0x1f4,_0x17d25c[_0x3e7a('0x15')]));});});};exports[_0x3e7a('0x22')]=function(_0x39ea34){var _0x3ca565=this;return new Promise(function(_0x2450ca,_0x1d563a){return db[_0x3e7a('0x18')][_0x3e7a('0x23')](_0x39ea34['body'],{'raw':_0x39ea34['options']?_0x39ea34['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39ea34['options']?_0x39ea34[_0x3e7a('0x1a')][_0x3e7a('0x1c')]||null:null,'attributes':_0x39ea34[_0x3e7a('0x1a')]?_0x39ea34[_0x3e7a('0x1a')][_0x3e7a('0x1d')]||null:null,'limit':_0x39ea34[_0x3e7a('0x1a')]?_0x39ea34[_0x3e7a('0x1a')][_0x3e7a('0x1e')]||null:null})['then'](function(_0x57edc0){logger['info'](_0x3e7a('0x22'),_0x39ea34);logger[_0x3e7a('0x11')](_0x3e7a('0x22'),_0x39ea34,JSON[_0x3e7a('0x12')](_0x57edc0));_0x2450ca(_0x57edc0);})[_0x3e7a('0x16')](function(_0x2bfe0b){logger[_0x3e7a('0x13')](_0x3e7a('0x22'),_0x2bfe0b[_0x3e7a('0x15')],_0x39ea34);_0x1d563a(_0x3ca565[_0x3e7a('0x13')](0x1f4,_0x2bfe0b['message']));});});};exports[_0x3e7a('0x24')]=function(_0x95d8b8){var _0x3abe3d=this;return new Promise(function(_0x1edd31,_0x3cd5b6){return db['CmHopperBlack'][_0x3e7a('0x25')]({'where':_0x95d8b8[_0x3e7a('0x1a')]?_0x95d8b8[_0x3e7a('0x1a')][_0x3e7a('0x1c')]||null:null})['then'](function(_0x2c5552){logger[_0x3e7a('0xe')](_0x3e7a('0x24'),_0x95d8b8);logger['debug'](_0x3e7a('0x24'),_0x95d8b8,JSON[_0x3e7a('0x12')](_0x2c5552));_0x1edd31(_0x2c5552);})[_0x3e7a('0x16')](function(_0x4fe9fd){logger['error'](_0x3e7a('0x24'),_0x4fe9fd[_0x3e7a('0x15')],_0x95d8b8);_0x3cd5b6(_0x3abe3d[_0x3e7a('0x13')](0x1f4,_0x4fe9fd[_0x3e7a('0x15')]));});});}; \ No newline at end of file +var _0x9f82=['request\x20sent','debug','stringify','error','code','message','info','catch','CmHopperBlack','findAll','options','where','attributes','limit','map','include','model','GetCmHopperBlack','UpdateCmHopperBlack','body','raw','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x9f82,0x1a7));var _0x29f8=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9f82[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x29f8('0x0'));var util=require(_0x29f8('0x1'));var moment=require(_0x29f8('0x2'));var BPromise=require(_0x29f8('0x3'));var rs=require(_0x29f8('0x4'));var fs=require('fs');var Redis=require(_0x29f8('0x5'));var db=require(_0x29f8('0x6'))['db'];var utils=require(_0x29f8('0x7'));var logger=require(_0x29f8('0x8'))(_0x29f8('0x9'));var config=require(_0x29f8('0xa'));var jayson=require(_0x29f8('0xb'));var client=jayson[_0x29f8('0xc')][_0x29f8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x585578,_0x9227ad,_0x1f5de2){return new BPromise(function(_0x2d0a45,_0x5a7672){return client[_0x29f8('0xe')](_0x585578,_0x1f5de2)[_0x29f8('0xf')](function(_0x294287){logger['info'](_0x29f8('0x10'),_0x9227ad,_0x29f8('0x11'));logger[_0x29f8('0x12')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x9227ad,_0x29f8('0x11'),JSON[_0x29f8('0x13')](_0x294287));if(_0x294287[_0x29f8('0x14')]){if(_0x294287[_0x29f8('0x14')][_0x29f8('0x15')]===0x1f4){logger[_0x29f8('0x14')](_0x29f8('0x10'),_0x9227ad,_0x294287[_0x29f8('0x14')][_0x29f8('0x16')]);return _0x5a7672(_0x294287[_0x29f8('0x14')][_0x29f8('0x16')]);}logger[_0x29f8('0x14')]('CmHopperBlack,\x20%s,\x20%s',_0x9227ad,_0x294287['error'][_0x29f8('0x16')]);return _0x2d0a45(_0x294287[_0x29f8('0x14')][_0x29f8('0x16')]);}else{logger[_0x29f8('0x17')]('CmHopperBlack,\x20%s,\x20%s',_0x9227ad,_0x29f8('0x11'));_0x2d0a45(_0x294287['result']['message']);}})[_0x29f8('0x18')](function(_0x1c7d48){logger[_0x29f8('0x14')](_0x29f8('0x10'),_0x9227ad,_0x1c7d48);_0x5a7672(_0x1c7d48);});});}exports['GetCmHopperBlack']=function(_0x4b92e4){var _0x1a2ae3=this;return new Promise(function(_0x1a502f,_0x2070c4){return db[_0x29f8('0x19')][_0x29f8('0x1a')]({'raw':_0x4b92e4[_0x29f8('0x1b')]?_0x4b92e4[_0x29f8('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4b92e4[_0x29f8('0x1b')]?_0x4b92e4[_0x29f8('0x1b')][_0x29f8('0x1c')]||null:null,'attributes':_0x4b92e4[_0x29f8('0x1b')]?_0x4b92e4['options'][_0x29f8('0x1d')]||null:null,'limit':_0x4b92e4[_0x29f8('0x1b')]?_0x4b92e4[_0x29f8('0x1b')][_0x29f8('0x1e')]||null:null,'include':_0x4b92e4[_0x29f8('0x1b')]?_0x4b92e4[_0x29f8('0x1b')]['include']?_[_0x29f8('0x1f')](_0x4b92e4['options'][_0x29f8('0x20')],function(_0x85f8bc){return{'model':db[_0x85f8bc[_0x29f8('0x21')]],'as':_0x85f8bc['as'],'attributes':_0x85f8bc[_0x29f8('0x1d')],'include':_0x85f8bc[_0x29f8('0x20')]?_[_0x29f8('0x1f')](_0x85f8bc[_0x29f8('0x20')],function(_0x17dc62){return{'model':db[_0x17dc62['model']],'as':_0x17dc62['as'],'attributes':_0x17dc62[_0x29f8('0x1d')],'include':_0x17dc62['include']?_[_0x29f8('0x1f')](_0x17dc62[_0x29f8('0x20')],function(_0x489f76){return{'model':db[_0x489f76[_0x29f8('0x21')]],'as':_0x489f76['as'],'attributes':_0x489f76[_0x29f8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x29f8('0xf')](function(_0x31429c){logger[_0x29f8('0x17')](_0x29f8('0x22'),_0x4b92e4);logger[_0x29f8('0x12')](_0x29f8('0x22'),_0x4b92e4,JSON[_0x29f8('0x13')](_0x31429c));_0x1a502f(_0x31429c);})[_0x29f8('0x18')](function(_0x4386ae){logger['error']('GetCmHopperBlack',_0x4386ae[_0x29f8('0x16')],_0x4b92e4);_0x2070c4(_0x1a2ae3[_0x29f8('0x14')](0x1f4,_0x4386ae[_0x29f8('0x16')]));});});};exports[_0x29f8('0x23')]=function(_0x31843c){var _0xbd4d52=this;return new Promise(function(_0x1bbc79,_0x3d1862){return db[_0x29f8('0x19')]['update'](_0x31843c[_0x29f8('0x24')],{'raw':_0x31843c['options']?_0x31843c[_0x29f8('0x1b')][_0x29f8('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31843c[_0x29f8('0x1b')]?_0x31843c[_0x29f8('0x1b')]['where']||null:null,'attributes':_0x31843c[_0x29f8('0x1b')]?_0x31843c[_0x29f8('0x1b')][_0x29f8('0x1d')]||null:null,'limit':_0x31843c[_0x29f8('0x1b')]?_0x31843c['options'][_0x29f8('0x1e')]||null:null})[_0x29f8('0xf')](function(_0xa40c2b){logger[_0x29f8('0x17')](_0x29f8('0x23'),_0x31843c);logger[_0x29f8('0x12')](_0x29f8('0x23'),_0x31843c,JSON[_0x29f8('0x13')](_0xa40c2b));_0x1bbc79(_0xa40c2b);})['catch'](function(_0xd812c6){logger['error'](_0x29f8('0x23'),_0xd812c6[_0x29f8('0x16')],_0x31843c);_0x3d1862(_0xbd4d52['error'](0x1f4,_0xd812c6[_0x29f8('0x16')]));});});};exports[_0x29f8('0x26')]=function(_0x160f90){var _0x5e272f=this;return new Promise(function(_0x48d7d0,_0x41e8b){return db['CmHopperBlack'][_0x29f8('0x27')]({'where':_0x160f90['options']?_0x160f90[_0x29f8('0x1b')]['where']||null:null})[_0x29f8('0xf')](function(_0x31c6f2){logger[_0x29f8('0x17')](_0x29f8('0x26'),_0x160f90);logger['debug'](_0x29f8('0x26'),_0x160f90,JSON['stringify'](_0x31c6f2));_0x48d7d0(_0x31c6f2);})[_0x29f8('0x18')](function(_0x16d295){logger[_0x29f8('0x14')](_0x29f8('0x26'),_0x16d295[_0x29f8('0x16')],_0x160f90);_0x41e8b(_0x5e272f[_0x29f8('0x14')](0x1f4,_0x16d295[_0x29f8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 3ebc010..c196faf 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 _0x0424=['isAuthenticated','index','/describe','/:id','show','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','./cmHopperBlack.controller','get'];(function(_0x3e6980,_0x190736){var _0x5697dc=function(_0xb86ad8){while(--_0xb86ad8){_0x3e6980['push'](_0x3e6980['shift']());}};_0x5697dc(++_0x190736);}(_0x0424,0x159));var _0x4042=function(_0x40c58d,_0xca539f){_0x40c58d=_0x40c58d-0x0;var _0x2a8381=_0x0424[_0x40c58d];return _0x2a8381;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4042('0x0'));var timeout=require(_0x4042('0x1'));var express=require(_0x4042('0x2'));var router=express[_0x4042('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4042('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4042('0x5'));router[_0x4042('0x6')]('/',auth[_0x4042('0x7')](),controller[_0x4042('0x8')]);router[_0x4042('0x6')](_0x4042('0x9'),auth[_0x4042('0x7')](),controller['describe']);router['get'](_0x4042('0xa'),auth[_0x4042('0x7')](),controller[_0x4042('0xb')]);router['put'](_0x4042('0xa'),auth[_0x4042('0x7')](),controller[_0x4042('0xc')]);router[_0x4042('0xd')](_0x4042('0xa'),auth[_0x4042('0x7')](),controller[_0x4042('0xe')]);module[_0x4042('0xf')]=router; \ No newline at end of file +var _0xabce=['show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe'];(function(_0x18b5b8,_0x4a116d){var _0x50f7cc=function(_0x119f7e){while(--_0x119f7e){_0x18b5b8['push'](_0x18b5b8['shift']());}};_0x50f7cc(++_0x4a116d);}(_0xabce,0x103));var _0xeabc=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xabce[_0x2576d7];return _0x16a08c;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./cmHopperBlack.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')](_0xeabc('0xd'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xe')]);router[_0xeabc('0xf')](_0xeabc('0xd'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);module[_0xeabc('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index d0f0258..8013ce9 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 _0xbcde=['endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue'];(function(_0x56eb81,_0x40bc16){var _0x1ceb0c=function(_0x3bb02c){while(--_0x3bb02c){_0x56eb81['push'](_0x56eb81['shift']());}};_0x1ceb0c(++_0x40bc16);}(_0xbcde,0x165));var _0xebcd=function(_0xfdc48b,_0x305583){_0xfdc48b=_0xfdc48b-0x0;var _0x471c8c=_0xbcde[_0xfdc48b];return _0x471c8c;};'use strict';var Sequelize=require(_0xebcd('0x0'));var moment=require(_0xebcd('0x1'));module[_0xebcd('0x2')]={'state':{'type':Sequelize[_0xebcd('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xebcd('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xebcd('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xebcd('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xebcd('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xebcd('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xebcd('0x4')]},'originatecalleridname':{'type':Sequelize[_0xebcd('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xebcd('0x4')]},'starttime':{'type':Sequelize[_0xebcd('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xebcd('0x5')]},'droptime':{'type':Sequelize[_0xebcd('0x5')]},'endtime':{'type':Sequelize[_0xebcd('0x5')]},'ringtime':{'type':Sequelize[_0xebcd('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xebcd('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xebcd('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xebcd('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xebcd('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xebcd('0x4')]},'membername':{'type':Sequelize[_0xebcd('0x4')]},'reason':{'type':Sequelize[_0xebcd('0x4')]},'disposition':{'type':Sequelize[_0xebcd('0x4')]},'secondDisposition':{'type':Sequelize[_0xebcd('0x4')]},'thirdDisposition':{'type':Sequelize[_0xebcd('0x4')]},'dispositionat':{'type':Sequelize[_0xebcd('0x5')],'set':function(_0x4a8749){var _0xbeae6b=this[_0xebcd('0x6')](_0xebcd('0x7'));if(_0xbeae6b&&_0x4a8749){this[_0xebcd('0x8')](_0xebcd('0x9'),moment(_0x4a8749)[_0xebcd('0xa')](moment(_0xbeae6b),_0xebcd('0xb')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xebcd('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xebcd('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xebcd('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xebcd('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xebcd('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xebcd('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xebcd('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa782=['DATE','getDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','INTEGER','STRING'];(function(_0x54483a,_0x2b0b3e){var _0x204233=function(_0x2f53ea){while(--_0x2f53ea){_0x54483a['push'](_0x54483a['shift']());}};_0x204233(++_0x2b0b3e);}(_0xa782,0x178));var _0x2a78=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xa782[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0x2a78('0x0'));var moment=require(_0x2a78('0x1'));module['exports']={'state':{'type':Sequelize[_0x2a78('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x2a78('0x3')]},'scheduledat':{'type':Sequelize[_0x2a78('0x4')]},'countbusyretry':{'type':Sequelize[_0x2a78('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2a78('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2a78('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2a78('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2a78('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x2a78('0x3')]},'originatecalleridname':{'type':Sequelize[_0x2a78('0x3')]},'calleridnum':{'type':Sequelize[_0x2a78('0x3')]},'calleridname':{'type':Sequelize[_0x2a78('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x2a78('0x4')]},'answertime':{'type':Sequelize[_0x2a78('0x4')]},'droptime':{'type':Sequelize[_0x2a78('0x4')]},'endtime':{'type':Sequelize[_0x2a78('0x4')]},'ringtime':{'type':Sequelize[_0x2a78('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2a78('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2a78('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2a78('0x3')]},'campaign':{'type':Sequelize[_0x2a78('0x3')]},'campaigntype':{'type':Sequelize[_0x2a78('0x3')]},'membername':{'type':Sequelize[_0x2a78('0x3')]},'reason':{'type':Sequelize[_0x2a78('0x3')]},'disposition':{'type':Sequelize[_0x2a78('0x3')]},'secondDisposition':{'type':Sequelize[_0x2a78('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2a78('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x19e569){var _0x21ff05=this[_0x2a78('0x5')]('endtime');if(_0x21ff05&&_0x19e569){this['setDataValue'](_0x2a78('0x6'),moment(_0x19e569)[_0x2a78('0x7')](moment(_0x21ff05),_0x2a78('0x8')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x2a78('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x2a78('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2a78('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x2a78('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2a78('0x4')]},'deleted':{'type':Sequelize[_0x2a78('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x2a78('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x2a78('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x2a78('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2a78('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2a78('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2a78('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index ed3690c..283fdd0 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 _0x5d17=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','state\x20=\x204','moveContactsIvrCampaignHopperFinal','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','findOne','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','describe','update','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()'];(function(_0x57fa7e,_0xd0b5ce){var _0x320671=function(_0x3392cc){while(--_0x3392cc){_0x57fa7e['push'](_0x57fa7e['shift']());}};_0x320671(++_0xd0b5ce);}(_0x5d17,0x114));var _0x75d1=function(_0x53d172,_0x46611b){_0x53d172=_0x53d172-0x0;var _0x1bd0a2=_0x5d17[_0x53d172];return _0x1bd0a2;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['CmHopperFinal'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')]()['then'](respondWithResult(_0x16f744,null))['catch'](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x8ce3d2,_0x50def3){if(_0x8ce3d2[_0x75d1('0x44')][_0x75d1('0x45')]){delete _0x8ce3d2[_0x75d1('0x44')]['uniqueid'];}return db[_0x75d1('0x28')][_0x75d1('0x46')]({'where':{'uniqueid':_0x8ce3d2[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x50def3,null))[_0x75d1('0x24')](saveUpdates(_0x8ce3d2[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x50def3,null))['catch'](handleError(_0x50def3,null));};exports[_0x75d1('0x47')]=function(_0x382195,_0x16b3c0,_0x395e0b){return db[_0x75d1('0x28')][_0x75d1('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x382195[_0x75d1('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x51')))),'congestionContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),_0x75d1('0x55')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),_0x75d1('0x57')],[db['sequelize']['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})['then'](handleEntityNotFound(_0x16b3c0,null))[_0x75d1('0x24')](respondWithResult(_0x16b3c0,null))[_0x75d1('0x3e')](handleError(_0x16b3c0,null));};exports[_0x75d1('0x59')]=function(_0x16cc70,_0x5d2219,_0x22ce12){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x16cc70[_0x75d1('0x40')]['id']},'attributes':[[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x51')))),_0x75d1('0x5a')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),'abandonedContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})[_0x75d1('0x24')](handleEntityNotFound(_0x5d2219,null))[_0x75d1('0x24')](respondWithResult(_0x5d2219,null))['catch'](handleError(_0x5d2219,null));};exports[_0x75d1('0x5b')]=function(_0x1f9ac2,_0x290587,_0x1baaca){return db[_0x75d1('0x5c')]['find']({'where':{'id':_0x1f9ac2['params']['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x290587,null))['then'](function(_0x3f15f3){var _0xf29a9f;if(_0x3f15f3){_0xf29a9f=squel[_0x75d1('0x5d')]()['into']('cm_hopper')[_0x75d1('0x5e')](['phone',_0x75d1('0x5f'),_0x75d1('0x60'),_0x75d1('0x61'),'VoiceQueueId',_0x75d1('0x62'),_0x75d1('0x63')],squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x66'),_0x75d1('0x67'))[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')](_0x75d1('0x69'),_0x75d1('0x60'))[_0x75d1('0x65')](_0x75d1('0x6a'),'ListId')['field'](_0x75d1('0x6b'),_0x75d1('0x6c'))['field'](_0x75d1('0x68'),'createdAt')['field']('NOW()',_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2['params']['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x1f9ac2[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()['field']('phone')['from'](_0x75d1('0x74'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2[_0x75d1('0x40')]['id'][_0x75d1('0x70')]()))[_0x75d1('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x75d1('0x64')]()[_0x75d1('0x65')]('calleridnum')[_0x75d1('0x6d')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x1f9ac2[_0x75d1('0x40')]['id']['toString']())['where'](_0x75d1('0x75')))['group'](_0x75d1('0x60')))[_0x75d1('0x70')]();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0xf29a9f);}return[];})[_0x75d1('0x24')](respondWithResult(_0x290587,null))[_0x75d1('0x3e')](handleError(_0x290587,null));};exports[_0x75d1('0x76')]=function(_0x217347,_0x51b682,_0x195a0a){return db['Campaign'][_0x75d1('0x46')]({'where':{'id':_0x217347[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x51b682,null))['then'](function(_0x10bc92){var _0x150735;if(_0x10bc92){_0x150735=squel[_0x75d1('0x5d')]()[_0x75d1('0x77')](_0x75d1('0x74'))[_0x75d1('0x5e')]([_0x75d1('0x67'),'scheduledAt',_0x75d1('0x60'),_0x75d1('0x61'),_0x75d1('0x78'),_0x75d1('0x62'),_0x75d1('0x63')],squel['select']()['field'](_0x75d1('0x66'),'phone')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')]('ANY_VALUE(ContactId)','ContactId')[_0x75d1('0x65')](_0x75d1('0x6a'),_0x75d1('0x61'))[_0x75d1('0x65')](_0x75d1('0x79'),'CampaignId')[_0x75d1('0x65')](_0x75d1('0x68'),'createdAt')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')]('CampaignId\x20=\x20?',_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x217347[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x67'))[_0x75d1('0x6d')]('cm_hopper')[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id']['toString']()))[_0x75d1('0x35')](_0x75d1('0x73'),squel['select']()[_0x75d1('0x65')](_0x75d1('0x7b'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')]('state\x20=\x204'))[_0x75d1('0x7c')](_0x75d1('0x60')))['toString']();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0x150735);}return[];})['then'](respondWithResult(_0x51b682,null))['catch'](handleError(_0x51b682,null));};exports[_0x75d1('0x7d')]=function(_0x44a017,_0x4d8e5d,_0x1f3a7e){return db['CmHopper'][_0x75d1('0x7e')]({'where':{'VoiceQueueId':_0x44a017['body'][_0x75d1('0x6c')],'CampaignId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x78')],'ContactId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x60')]}})[_0x75d1('0x24')](handleEntityNotFound(_0x4d8e5d,null))[_0x75d1('0x24')](function(_0x205e82){if(_0x205e82){return _0x205e82;}return null;})[_0x75d1('0x24')](respondWithResult(_0x4d8e5d,null))[_0x75d1('0x3e')](handleError(_0x4d8e5d,null));}; \ No newline at end of file +var _0x53ec=['ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','name','send','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','show','params','include','find','catch','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\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','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','noSuchContacts','`state`\x20=\x203,\x201,\x20null','dropContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','ContactId','VoiceQueueId','updatedAt','select','ANY_VALUE(calleridnum)','scheduledAt','field','ListId','ANY_VALUE(VoiceQueueId)','NOW()','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(ContactId)'];(function(_0x56d6d4,_0x328056){var _0x52f859=function(_0x45287c){while(--_0x45287c){_0x56d6d4['push'](_0x56d6d4['shift']());}};_0x52f859(++_0x328056);}(_0x53ec,0x192));var _0xc53e=function(_0x20048c,_0x337690){_0x20048c=_0x20048c-0x0;var _0x1d7f4b=_0x53ec[_0x20048c];return _0x1d7f4b;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];function respondWithStatusCode(_0x863fa,_0x4203aa){_0x4203aa=_0x4203aa||0xcc;return function(_0x56f0e5){if(_0x56f0e5){return _0x863fa['sendStatus'](_0x4203aa);}return _0x863fa[_0xc53e('0x18')](_0x4203aa)[_0xc53e('0x19')]();};}function respondWithResult(_0x7cd798,_0x3d2e17){_0x3d2e17=_0x3d2e17||0xc8;return function(_0x358ef3){if(_0x358ef3){return _0x7cd798[_0xc53e('0x18')](_0x3d2e17)[_0xc53e('0x1a')](_0x358ef3);}};}function respondWithFilteredResult(_0x19c0d1,_0x455e4d){return function(_0x2ad6eb){if(_0x2ad6eb){var _0x5b0a88=typeof _0x455e4d[_0xc53e('0x1b')]===_0xc53e('0x1c')&&typeof _0x455e4d[_0xc53e('0x1d')]===_0xc53e('0x1c');var _0x15333b=_0x2ad6eb[_0xc53e('0x1e')];var _0x164016=_0x5b0a88?0x0:_0x455e4d[_0xc53e('0x1b')];var _0x3b550e=_0x5b0a88?_0x2ad6eb['count']:_0x455e4d['offset']+_0x455e4d[_0xc53e('0x1d')];var _0x2a5bac;if(_0x3b550e>=_0x15333b){_0x3b550e=_0x15333b;_0x2a5bac=0xc8;}else{_0x2a5bac=0xce;}_0x19c0d1[_0xc53e('0x18')](_0x2a5bac);return _0x19c0d1[_0xc53e('0x1f')](_0xc53e('0x20'),_0x164016+'-'+_0x3b550e+'/'+_0x15333b)[_0xc53e('0x1a')](_0x2ad6eb);}return null;};}function patchUpdates(_0x15a015){return function(_0x25702b){try{jsonpatch[_0xc53e('0x21')](_0x25702b,_0x15a015,!![]);}catch(_0x401af6){return BPromise[_0xc53e('0x22')](_0x401af6);}return _0x25702b[_0xc53e('0x23')]();};}function saveUpdates(_0x426467,_0x4fb695){return function(_0x47cfdd){if(_0x47cfdd){return _0x47cfdd['update'](_0x426467)[_0xc53e('0x24')](function(_0x384218){return _0x384218;});}return null;};}function removeEntity(_0x7591c1,_0x4015c8){return function(_0x180811){if(_0x180811){return _0x180811['destroy']()['then'](function(){_0x7591c1[_0xc53e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae55e,_0x3a5ce8){return function(_0x443179){if(!_0x443179){_0x1ae55e[_0xc53e('0x25')](0x194);}return _0x443179;};}function handleError(_0x63c5dc,_0x4df8cf){_0x4df8cf=_0x4df8cf||0x1f4;return function(_0x398e7a){logger['error'](_0x398e7a['stack']);if(_0x398e7a['name']){delete _0x398e7a[_0xc53e('0x26')];}_0x63c5dc['status'](_0x4df8cf)[_0xc53e('0x27')](_0x398e7a);};}exports['index']=function(_0x24a77e,_0x5112d2){var _0x5ce216={},_0x8f0ee6={},_0x6a62b0={'count':0x0,'rows':[]};var _0x42dec1=_[_0xc53e('0x28')](db[_0xc53e('0x29')][_0xc53e('0x2a')],function(_0x3280fe){return{'name':_0x3280fe[_0xc53e('0x2b')],'type':_0x3280fe['type'][_0xc53e('0x2c')]};});_0x8f0ee6[_0xc53e('0x2d')]=_[_0xc53e('0x28')](_0x42dec1,'name');_0x8f0ee6[_0xc53e('0x2e')]=_['keys'](_0x24a77e[_0xc53e('0x2e')]);_0x8f0ee6[_0xc53e('0x2f')]=_['intersection'](_0x8f0ee6['model'],_0x8f0ee6[_0xc53e('0x2e')]);_0x5ce216[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x8f0ee6[_0xc53e('0x2d')],qs[_0xc53e('0x32')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x5ce216[_0xc53e('0x30')]=_0x5ce216['attributes'][_0xc53e('0x33')]?_0x5ce216[_0xc53e('0x30')]:_0x8f0ee6[_0xc53e('0x2d')];if(!_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x34')](_0xc53e('0x35'))){_0x5ce216[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x24a77e[_0xc53e('0x2e')]['limit']);_0x5ce216[_0xc53e('0x1b')]=qs['offset'](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x1b')]);}_0x5ce216['order']=qs[_0xc53e('0x36')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x36')]);_0x5ce216['where']=qs[_0xc53e('0x2f')](_[_0xc53e('0x37')](_0x24a77e[_0xc53e('0x2e')],_0x8f0ee6[_0xc53e('0x2f')]),_0x42dec1);if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]){_0x5ce216[_0xc53e('0x39')]=_['merge'](_0x5ce216[_0xc53e('0x39')],{'$or':_[_0xc53e('0x28')](_0x42dec1,function(_0x2db711){if(_0x2db711['type']!==_0xc53e('0x3a')){var _0x5e8ab7={};_0x5e8ab7[_0x2db711[_0xc53e('0x26')]]={'$like':'%'+_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]+'%'};return _0x5e8ab7;}})});}_0x5ce216=_[_0xc53e('0x3b')]({},_0x5ce216,_0x24a77e[_0xc53e('0x3c')]);var _0x5507d0={'where':_0x5ce216[_0xc53e('0x39')]};return db[_0xc53e('0x29')]['count'](_0x5507d0)['then'](function(_0x5e9e15){_0x6a62b0['count']=_0x5e9e15;if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x5ce216['include']=[{'all':!![]}];}return db[_0xc53e('0x29')]['findAll'](_0x5ce216);})['then'](function(_0x53447e){_0x6a62b0[_0xc53e('0x3e')]=_0x53447e;return _0x6a62b0;})['then'](respondWithFilteredResult(_0x5112d2,_0x5ce216))['catch'](handleError(_0x5112d2,null));};exports[_0xc53e('0x3f')]=function(_0x53a82f,_0x422088){var _0x360af9={'raw':!![],'where':{'id':_0x53a82f[_0xc53e('0x40')]['id']}},_0x49f204={};_0x49f204[_0xc53e('0x2d')]=_['keys'](db[_0xc53e('0x29')]['rawAttributes']);_0x49f204['query']=_['keys'](_0x53a82f['query']);_0x49f204[_0xc53e('0x2f')]=_[_0xc53e('0x31')](_0x49f204[_0xc53e('0x2d')],_0x49f204['query']);_0x360af9[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x49f204['model'],qs['fields'](_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x360af9[_0xc53e('0x30')]=_0x360af9['attributes'][_0xc53e('0x33')]?_0x360af9[_0xc53e('0x30')]:_0x49f204[_0xc53e('0x2d')];if(_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x360af9[_0xc53e('0x41')]=[{'all':!![]}];}_0x360af9=_[_0xc53e('0x3b')]({},_0x360af9,_0x53a82f['options']);return db[_0xc53e('0x29')][_0xc53e('0x42')](_0x360af9)[_0xc53e('0x24')](handleEntityNotFound(_0x422088,null))['then'](respondWithResult(_0x422088,null))[_0xc53e('0x43')](handleError(_0x422088,null));};exports[_0xc53e('0x44')]=function(_0x4458c8,_0x15e744){return db[_0xc53e('0x29')][_0xc53e('0x44')]()['then'](respondWithResult(_0x15e744,null))[_0xc53e('0x43')](handleError(_0x15e744,null));};exports[_0xc53e('0x45')]=function(_0x39feea,_0x5a6e41){if(_0x39feea[_0xc53e('0x46')][_0xc53e('0x47')]){delete _0x39feea[_0xc53e('0x46')][_0xc53e('0x47')];}return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'uniqueid':_0x39feea[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x5a6e41,null))[_0xc53e('0x24')](saveUpdates(_0x39feea[_0xc53e('0x46')],null))['then'](respondWithResult(_0x5a6e41,null))[_0xc53e('0x43')](handleError(_0x5a6e41,null));};exports[_0xc53e('0x48')]=function(_0x38520c,_0x3d74ac,_0x136544){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x38520c[_0xc53e('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x4c')))),'noSuchContacts'],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db['sequelize'][_0xc53e('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0xc53e('0x4d')],[db[_0xc53e('0x4a')]['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')]['literal'](_0xc53e('0x4e')))),_0xc53e('0x4f')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x50')))),_0xc53e('0x51')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')]['literal'](_0xc53e('0x52')))),'dropContacts'],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x53')))),_0xc53e('0x54')],[db['sequelize']['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db['sequelize']['literal'](_0xc53e('0x55')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db['sequelize'][_0xc53e('0x4b')]('`state`\x20=\x2019,\x201,\x20null'))),_0xc53e('0x56')]]})[_0xc53e('0x24')](handleEntityNotFound(_0x3d74ac,null))[_0xc53e('0x24')](respondWithResult(_0x3d74ac,null))[_0xc53e('0x43')](handleError(_0x3d74ac,null));};exports[_0xc53e('0x57')]=function(_0x4caf5f,_0x55e068,_0x4655b7){return db[_0xc53e('0x29')][_0xc53e('0x58')]({'raw':![],'where':{'CampaignId':_0x4caf5f[_0xc53e('0x40')]['id']},'attributes':[[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x4c')))),_0xc53e('0x59')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')]['literal'](_0xc53e('0x5a')))),_0xc53e('0x4d')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x4e')))),'busyContacts'],[db['sequelize']['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x50')))),_0xc53e('0x51')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xc53e('0x52')))),_0xc53e('0x5b')],[db['sequelize']['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x53')))),_0xc53e('0x54')],[db['sequelize']['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x55')))),_0xc53e('0x5c')],[db[_0xc53e('0x4a')]['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x5d')))),'answeringMachine']]})[_0xc53e('0x24')](handleEntityNotFound(_0x55e068,null))[_0xc53e('0x24')](respondWithResult(_0x55e068,null))[_0xc53e('0x43')](handleError(_0x55e068,null));};exports[_0xc53e('0x5e')]=function(_0x32f954,_0x2d9803,_0x51638a){return db[_0xc53e('0x5f')][_0xc53e('0x42')]({'where':{'id':_0x32f954[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x2d9803,null))['then'](function(_0x5e1f4a){var _0x57edb;if(_0x5e1f4a){_0x57edb=squel[_0xc53e('0x60')]()[_0xc53e('0x61')](_0xc53e('0x62'))['fromQuery']([_0xc53e('0x63'),'scheduledAt',_0xc53e('0x64'),'ListId',_0xc53e('0x65'),'createdAt',_0xc53e('0x66')],squel[_0xc53e('0x67')]()['field'](_0xc53e('0x68'),_0xc53e('0x63'))['field']('NOW()',_0xc53e('0x69'))[_0xc53e('0x6a')]('ANY_VALUE(ContactId)','ContactId')[_0xc53e('0x6a')]('ANY_VALUE(ListId)',_0xc53e('0x6b'))['field'](_0xc53e('0x6c'),_0xc53e('0x65'))[_0xc53e('0x6a')](_0xc53e('0x6d'),_0xc53e('0x6e'))[_0xc53e('0x6a')](_0xc53e('0x6d'),_0xc53e('0x66'))[_0xc53e('0x6f')](_0xc53e('0x70'))['where'](_0xc53e('0x71'),_0x32f954['params']['id'][_0xc53e('0x72')]())[_0xc53e('0x39')](_0xc53e('0x73'),_0x32f954[_0xc53e('0x46')][_0xc53e('0x74')][_0xc53e('0x72')]())[_0xc53e('0x39')](_0xc53e('0x75'))[_0xc53e('0x39')](_0xc53e('0x76'),squel['select']()[_0xc53e('0x6a')]('phone')[_0xc53e('0x6f')](_0xc53e('0x62'))[_0xc53e('0x39')]('VoiceQueueId\x20=\x20?',_0x32f954[_0xc53e('0x40')]['id'][_0xc53e('0x72')]()))[_0xc53e('0x39')](_0xc53e('0x76'),squel[_0xc53e('0x67')]()['field'](_0xc53e('0x77'))[_0xc53e('0x6f')]('cm_hopper_final')[_0xc53e('0x39')](_0xc53e('0x71'),_0x32f954[_0xc53e('0x40')]['id']['toString']())[_0xc53e('0x39')](_0xc53e('0x78')))['group'](_0xc53e('0x64')))[_0xc53e('0x72')]();return db['sequelize']['query'](_0x57edb);}return[];})[_0xc53e('0x24')](respondWithResult(_0x2d9803,null))['catch'](handleError(_0x2d9803,null));};exports[_0xc53e('0x79')]=function(_0x3d2636,_0x263d97,_0x58684c){return db[_0xc53e('0x7a')][_0xc53e('0x42')]({'where':{'id':_0x3d2636[_0xc53e('0x40')]['id']}})['then'](handleEntityNotFound(_0x263d97,null))[_0xc53e('0x24')](function(_0x2e048a){var _0x1c24e6;if(_0x2e048a){_0x1c24e6=squel[_0xc53e('0x60')]()[_0xc53e('0x61')]('cm_hopper')[_0xc53e('0x7b')]([_0xc53e('0x63'),_0xc53e('0x69'),_0xc53e('0x64'),_0xc53e('0x6b'),_0xc53e('0x7c'),_0xc53e('0x6e'),_0xc53e('0x66')],squel[_0xc53e('0x67')]()['field'](_0xc53e('0x68'),_0xc53e('0x63'))[_0xc53e('0x6a')](_0xc53e('0x6d'),_0xc53e('0x69'))[_0xc53e('0x6a')](_0xc53e('0x7d'),_0xc53e('0x64'))[_0xc53e('0x6a')]('ANY_VALUE(ListId)',_0xc53e('0x6b'))[_0xc53e('0x6a')](_0xc53e('0x7e'),_0xc53e('0x7c'))['field'](_0xc53e('0x6d'),_0xc53e('0x6e'))[_0xc53e('0x6a')](_0xc53e('0x6d'),'updatedAt')[_0xc53e('0x6f')](_0xc53e('0x70'))[_0xc53e('0x39')](_0xc53e('0x7f'),_0x3d2636[_0xc53e('0x40')]['id'][_0xc53e('0x72')]())[_0xc53e('0x39')]('state\x20=\x20?',_0x3d2636[_0xc53e('0x46')]['state'][_0xc53e('0x72')]())[_0xc53e('0x39')](_0xc53e('0x75'))['where'](_0xc53e('0x76'),squel[_0xc53e('0x67')]()[_0xc53e('0x6a')]('phone')[_0xc53e('0x6f')](_0xc53e('0x62'))[_0xc53e('0x39')]('CampaignId\x20=\x20?',_0x3d2636[_0xc53e('0x40')]['id'][_0xc53e('0x72')]()))[_0xc53e('0x39')](_0xc53e('0x76'),squel[_0xc53e('0x67')]()['field']('calleridnum')['from'](_0xc53e('0x70'))[_0xc53e('0x39')](_0xc53e('0x7f'),_0x3d2636[_0xc53e('0x40')]['id']['toString']())[_0xc53e('0x39')]('state\x20=\x204'))[_0xc53e('0x80')](_0xc53e('0x64')))[_0xc53e('0x72')]();return db[_0xc53e('0x4a')]['query'](_0x1c24e6);}return[];})[_0xc53e('0x24')](respondWithResult(_0x263d97,null))[_0xc53e('0x43')](handleError(_0x263d97,null));};exports[_0xc53e('0x81')]=function(_0x352bc6,_0x67be18,_0x306343){return db[_0xc53e('0x82')][_0xc53e('0x83')]({'where':{'VoiceQueueId':_0x352bc6[_0xc53e('0x46')][_0xc53e('0x65')],'CampaignId':_0x352bc6[_0xc53e('0x46')][_0xc53e('0x7c')],'ContactId':_0x352bc6[_0xc53e('0x46')][_0xc53e('0x64')]}})[_0xc53e('0x24')](handleEntityNotFound(_0x67be18,null))[_0xc53e('0x24')](function(_0x3dc1be){if(_0x3dc1be){return _0x3dc1be;}return null;})[_0xc53e('0x24')](respondWithResult(_0x67be18,null))[_0xc53e('0x43')](handleError(_0x67be18,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index a026a0f..6ebfe1e 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 _0xe4e0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x375d21,_0x4c625b){var _0x3e3672=function(_0x5c01db){while(--_0x5c01db){_0x375d21['push'](_0x375d21['shift']());}};_0x3e3672(++_0x4c625b);}(_0xe4e0,0x1ce));var _0x0e4e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xe4e0[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x0e4e('0x0'));var util=require(_0x0e4e('0x1'));var logger=require(_0x0e4e('0x2'))(_0x0e4e('0x3'));var moment=require(_0x0e4e('0x4'));var BPromise=require(_0x0e4e('0x5'));var rp=require(_0x0e4e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e4e('0x7'));var config=require(_0x0e4e('0x8'));var attributes=require(_0x0e4e('0x9'));module[_0x0e4e('0xa')]=function(_0x367bf6,_0x3cd0c5){return _0x367bf6[_0x0e4e('0xb')](_0x0e4e('0xc'),attributes,{'tableName':_0x0e4e('0xd'),'paranoid':![],'indexes':[{'name':_0x0e4e('0xe'),'fields':[_0x0e4e('0xe')]},{'name':_0x0e4e('0xf'),'fields':[_0x0e4e('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x087a=['calleridnum','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x087a,0x1a6));var _0xa087=function(_0x22542e,_0x2da587){_0x22542e=_0x22542e-0x0;var _0x12d10f=_0x087a[_0x22542e];return _0x12d10f;};'use strict';var _=require('lodash');var util=require(_0xa087('0x0'));var logger=require('../../config/logger')(_0xa087('0x1'));var moment=require(_0xa087('0x2'));var BPromise=require(_0xa087('0x3'));var rp=require(_0xa087('0x4'));var fs=require('fs');var path=require(_0xa087('0x5'));var rimraf=require(_0xa087('0x6'));var config=require(_0xa087('0x7'));var attributes=require(_0xa087('0x8'));module[_0xa087('0x9')]=function(_0x32f139,_0x4c6b23){return _0x32f139[_0xa087('0xa')](_0xa087('0xb'),attributes,{'tableName':_0xa087('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xa087('0xd')]},{'name':_0xa087('0xe'),'fields':[_0xa087('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 0ef6317..771d522 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(_0x31c660,_0x2727a3){var _0x6dbab9=function(_0x17fa45){while(--_0x17fa45){_0x31c660['push'](_0x31c660['shift']());}};_0x6dbab9(++_0x2727a3);}(_0x7a54,0x106));var _0x47a5=function(_0x56ec94,_0x35cc14){_0x56ec94=_0x56ec94-0x0;var _0x4da6ad=_0x7a54[_0x56ec94];return _0x4da6ad;};'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(_0x5a538d,_0x14bb85){var _0x250293=function(_0x104a63){while(--_0x104a63){_0x5a538d['push'](_0x5a538d['shift']());}};_0x250293(++_0x14bb85);}(_0x7a54,0x106));var _0x47a5=function(_0x4fb7dc,_0x253589){_0x4fb7dc=_0x4fb7dc-0x0;var _0x18963c=_0x7a54[_0x4fb7dc];return _0x18963c;};'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 1f0f959..2413867 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 _0x657b=['moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','Router','isAuthenticated','get','/describe','/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id'];(function(_0x33ffe7,_0x3c96e5){var _0x23761a=function(_0x1cbb9b){while(--_0x1cbb9b){_0x33ffe7['push'](_0x33ffe7['shift']());}};_0x23761a(++_0x3c96e5);}(_0x657b,0x98));var _0xb657=function(_0x8fcb57,_0xade71d){_0x8fcb57=_0x8fcb57-0x0;var _0x20f0c8=_0x657b[_0x8fcb57];return _0x20f0c8;};'use strict';var multer=require(_0xb657('0x0'));var util=require(_0xb657('0x1'));var path=require(_0xb657('0x2'));var timeout=require(_0xb657('0x3'));var express=require(_0xb657('0x4'));var router=express[_0xb657('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0xb657('0x6')](),controller['index']);router[_0xb657('0x7')](_0xb657('0x8'),auth[_0xb657('0x6')](),controller['describe']);router['get'](_0xb657('0x9'),auth[_0xb657('0x6')](),controller['show']);router[_0xb657('0x7')]('/voice/queue/countAttributes/:id',auth[_0xb657('0x6')](),controller[_0xb657('0xa')]);router[_0xb657('0x7')](_0xb657('0xb'),auth['isAuthenticated'](),controller[_0xb657('0xc')]);router[_0xb657('0xd')](_0xb657('0xe'),auth[_0xb657('0x6')](),controller['moveContactsQueueCampaignHopperFinal']);router['post'](_0xb657('0xf'),auth['isAuthenticated'](),controller[_0xb657('0x10')]);router[_0xb657('0xd')](_0xb657('0x11'),auth[_0xb657('0x6')](),controller['checkContactHopper']);router[_0xb657('0x12')](_0xb657('0x9'),auth[_0xb657('0x6')](),controller[_0xb657('0x13')]);module[_0xb657('0x14')]=router; \ No newline at end of file +var _0x85de=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','index','get','/describe','isAuthenticated','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x85de,0x65));var _0xe85d=function(_0x2a37b1,_0x225056){_0x2a37b1=_0x2a37b1-0x0;var _0x1f1240=_0x85de[_0x2a37b1];return _0x1f1240;};'use strict';var multer=require(_0xe85d('0x0'));var util=require(_0xe85d('0x1'));var path=require(_0xe85d('0x2'));var timeout=require(_0xe85d('0x3'));var express=require(_0xe85d('0x4'));var router=express[_0xe85d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe85d('0x6'));var interaction=require(_0xe85d('0x7'));var config=require(_0xe85d('0x8'));var controller=require(_0xe85d('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe85d('0xa')]);router[_0xe85d('0xb')](_0xe85d('0xc'),auth[_0xe85d('0xd')](),controller['describe']);router[_0xe85d('0xb')](_0xe85d('0xe'),auth[_0xe85d('0xd')](),controller[_0xe85d('0xf')]);router[_0xe85d('0xb')](_0xe85d('0x10'),auth[_0xe85d('0xd')](),controller[_0xe85d('0x11')]);router[_0xe85d('0xb')](_0xe85d('0x12'),auth[_0xe85d('0xd')](),controller[_0xe85d('0x13')]);router[_0xe85d('0x14')](_0xe85d('0x15'),auth[_0xe85d('0xd')](),controller[_0xe85d('0x16')]);router[_0xe85d('0x14')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller[_0xe85d('0x17')]);router[_0xe85d('0x14')](_0xe85d('0x18'),auth[_0xe85d('0xd')](),controller[_0xe85d('0x19')]);router[_0xe85d('0x1a')](_0xe85d('0xe'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 87f51fb..de23833 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 _0xe2dc=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x44dba1,_0x270ad5){var _0x2fbd3f=function(_0x5e0865){while(--_0x5e0865){_0x44dba1['push'](_0x44dba1['shift']());}};_0x2fbd3f(++_0x270ad5);}(_0xe2dc,0x1c6));var _0xce2d=function(_0x3310da,_0x10a734){_0x3310da=_0x3310da-0x0;var _0x2f55f8=_0xe2dc[_0x3310da];return _0x2f55f8;};'use strict';var Sequelize=require(_0xce2d('0x0'));module[_0xce2d('0x1')]={'state':{'type':Sequelize[_0xce2d('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xce2d('0x3')]},'scheduledat':{'type':Sequelize[_0xce2d('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xce2d('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xce2d('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xce2d('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xce2d('0x3')]},'calleridnum':{'type':Sequelize[_0xce2d('0x3')]},'calleridname':{'type':Sequelize[_0xce2d('0x3')]},'starttime':{'type':Sequelize[_0xce2d('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xce2d('0x4')]},'droptime':{'type':Sequelize[_0xce2d('0x4')]},'endtime':{'type':Sequelize[_0xce2d('0x4')]},'ringtime':{'type':Sequelize[_0xce2d('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xce2d('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xce2d('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xce2d('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xce2d('0x3')]},'campaign':{'type':Sequelize[_0xce2d('0x3')]},'campaigntype':{'type':Sequelize[_0xce2d('0x3')]},'membername':{'type':Sequelize[_0xce2d('0x3')]},'reason':{'type':Sequelize[_0xce2d('0x3')]},'amd':{'type':Sequelize[_0xce2d('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xce2d('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xce2d('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xce2d('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xce2d('0x4')]},'recallme':{'type':Sequelize[_0xce2d('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xce2d('0x4')]},'edited':{'type':Sequelize[_0xce2d('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xce2d('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xce2d('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xce2d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xce2d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xce2d('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xce2d('0x3')]}}; \ No newline at end of file +var _0x8239=['INTEGER','STRING','BOOLEAN','sequelize','exports','DATE'];(function(_0xde639e,_0x508b44){var _0x105a83=function(_0x2a9b87){while(--_0x2a9b87){_0xde639e['push'](_0xde639e['shift']());}};_0x105a83(++_0x508b44);}(_0x8239,0x177));var _0x9823=function(_0x1a379f,_0x3f2a61){_0x1a379f=_0x1a379f-0x0;var _0x3ce282=_0x8239[_0x1a379f];return _0x3ce282;};'use strict';var Sequelize=require(_0x9823('0x0'));module[_0x9823('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x9823('0x2')]},'countbusyretry':{'type':Sequelize[_0x9823('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9823('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9823('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x9823('0x4')]},'originatecalleridname':{'type':Sequelize[_0x9823('0x4')]},'calleridnum':{'type':Sequelize[_0x9823('0x4')]},'calleridname':{'type':Sequelize[_0x9823('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x9823('0x2')]},'answertime':{'type':Sequelize[_0x9823('0x2')]},'droptime':{'type':Sequelize[_0x9823('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x9823('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9823('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9823('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x9823('0x4')]},'membername':{'type':Sequelize[_0x9823('0x4')]},'reason':{'type':Sequelize[_0x9823('0x4')]},'amd':{'type':Sequelize[_0x9823('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9823('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x9823('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x9823('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9823('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9823('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9823('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9823('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9823('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 9b88a35..065d3c3 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 _0x5cc7=['update','then','destroy','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','Content-Range','apply','reject','save'];(function(_0x50480c,_0x3f6cd9){var _0x1fc31c=function(_0x254d4b){while(--_0x254d4b){_0x50480c['push'](_0x50480c['shift']());}};_0x1fc31c(++_0x3f6cd9);}(_0x5cc7,0x1a4));var _0x75cc=function(_0x1720df,_0x4cc0b2){_0x1720df=_0x1720df-0x0;var _0x2f4955=_0x5cc7[_0x1720df];return _0x2f4955;};'use strict';var emlformat=require(_0x75cc('0x0'));var rimraf=require(_0x75cc('0x1'));var zipdir=require(_0x75cc('0x2'));var jsonpatch=require(_0x75cc('0x3'));var rp=require('request-promise');var moment=require(_0x75cc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x75cc('0x5'));var util=require(_0x75cc('0x6'));var path=require(_0x75cc('0x7'));var sox=require(_0x75cc('0x8'));var csv=require(_0x75cc('0x9'));var ejs=require(_0x75cc('0xa'));var fs=require('fs');var fs_extra=require(_0x75cc('0xb'));var _=require(_0x75cc('0xc'));var squel=require(_0x75cc('0xd'));var crypto=require('crypto');var jsforce=require(_0x75cc('0xe'));var deskjs=require(_0x75cc('0xf'));var toCsv=require(_0x75cc('0x9'));var querystring=require(_0x75cc('0x10'));var Papa=require(_0x75cc('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x75cc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x75cc('0x13'))(_0x75cc('0x14'));var utils=require(_0x75cc('0x15'));var config=require(_0x75cc('0x16'));var licenseUtil=require(_0x75cc('0x17'));var db=require(_0x75cc('0x18'))['db'];function respondWithStatusCode(_0x5edacf,_0x3ea129){_0x3ea129=_0x3ea129||0xcc;return function(_0x51b959){if(_0x51b959){return _0x5edacf[_0x75cc('0x19')](_0x3ea129);}return _0x5edacf['status'](_0x3ea129)[_0x75cc('0x1a')]();};}function respondWithResult(_0x2d42df,_0xd59b87){_0xd59b87=_0xd59b87||0xc8;return function(_0x4eda4e){if(_0x4eda4e){return _0x2d42df[_0x75cc('0x1b')](_0xd59b87)['json'](_0x4eda4e);}};}function respondWithFilteredResult(_0x107e47,_0x2f6ec5){return function(_0x5d875d){if(_0x5d875d){var _0x5ee5ec=typeof _0x2f6ec5['offset']===_0x75cc('0x1c')&&typeof _0x2f6ec5[_0x75cc('0x1d')]===_0x75cc('0x1c');var _0x25bfe7=_0x5d875d[_0x75cc('0x1e')];var _0x327b27=_0x5ee5ec?0x0:_0x2f6ec5[_0x75cc('0x1f')];var _0x4a2dcd=_0x5ee5ec?_0x5d875d[_0x75cc('0x1e')]:_0x2f6ec5[_0x75cc('0x1f')]+_0x2f6ec5[_0x75cc('0x1d')];var _0x856c83;if(_0x4a2dcd>=_0x25bfe7){_0x4a2dcd=_0x25bfe7;_0x856c83=0xc8;}else{_0x856c83=0xce;}_0x107e47[_0x75cc('0x1b')](_0x856c83);return _0x107e47['set'](_0x75cc('0x20'),_0x327b27+'-'+_0x4a2dcd+'/'+_0x25bfe7)['json'](_0x5d875d);}return null;};}function patchUpdates(_0x4d7b2c){return function(_0x3d9ff2){try{jsonpatch[_0x75cc('0x21')](_0x3d9ff2,_0x4d7b2c,!![]);}catch(_0x20108e){return BPromise[_0x75cc('0x22')](_0x20108e);}return _0x3d9ff2[_0x75cc('0x23')]();};}function saveUpdates(_0x4d6b5a,_0x1972a4){return function(_0x17426d){if(_0x17426d){return _0x17426d[_0x75cc('0x24')](_0x4d6b5a)[_0x75cc('0x25')](function(_0x14c839){return _0x14c839;});}return null;};}function removeEntity(_0x5620bc,_0x365411){return function(_0x13b2c1){if(_0x13b2c1){return _0x13b2c1[_0x75cc('0x26')]()[_0x75cc('0x25')](function(){_0x5620bc['status'](0xcc)[_0x75cc('0x1a')]();});}};}function handleEntityNotFound(_0x428e1c,_0x654691){return function(_0x85073e){if(!_0x85073e){_0x428e1c['sendStatus'](0x194);}return _0x85073e;};}function handleError(_0x48aa30,_0x3e7989){_0x3e7989=_0x3e7989||0x1f4;return function(_0x58e23e){logger['error'](_0x58e23e['stack']);if(_0x58e23e[_0x75cc('0x27')]){delete _0x58e23e[_0x75cc('0x27')];}_0x48aa30[_0x75cc('0x1b')](_0x3e7989)[_0x75cc('0x28')](_0x58e23e);};}exports[_0x75cc('0x29')]=function(_0x2ea901,_0x16487c){var _0x152e5d={},_0x33a020={},_0x2a57fb={'count':0x0,'rows':[]};var _0x1a2788=_[_0x75cc('0x2a')](db[_0x75cc('0x2b')][_0x75cc('0x2c')],function(_0x1f694f){return{'name':_0x1f694f[_0x75cc('0x2d')],'type':_0x1f694f[_0x75cc('0x2e')]['key']};});_0x33a020[_0x75cc('0x2f')]=_['map'](_0x1a2788,'name');_0x33a020[_0x75cc('0x30')]=_[_0x75cc('0x31')](_0x2ea901[_0x75cc('0x30')]);_0x33a020[_0x75cc('0x32')]=_[_0x75cc('0x33')](_0x33a020['model'],_0x33a020[_0x75cc('0x30')]);_0x152e5d['attributes']=_[_0x75cc('0x33')](_0x33a020[_0x75cc('0x2f')],qs[_0x75cc('0x34')](_0x2ea901[_0x75cc('0x30')]['fields']));_0x152e5d[_0x75cc('0x35')]=_0x152e5d[_0x75cc('0x35')][_0x75cc('0x36')]?_0x152e5d[_0x75cc('0x35')]:_0x33a020[_0x75cc('0x2f')];if(!_0x2ea901['query'][_0x75cc('0x37')](_0x75cc('0x38'))){_0x152e5d[_0x75cc('0x1d')]=qs[_0x75cc('0x1d')](_0x2ea901[_0x75cc('0x30')][_0x75cc('0x1d')]);_0x152e5d[_0x75cc('0x1f')]=qs[_0x75cc('0x1f')](_0x2ea901[_0x75cc('0x30')][_0x75cc('0x1f')]);}_0x152e5d[_0x75cc('0x39')]=qs[_0x75cc('0x3a')](_0x2ea901['query']['sort']);_0x152e5d['where']=qs['filters'](_['pick'](_0x2ea901[_0x75cc('0x30')],_0x33a020[_0x75cc('0x32')]),_0x1a2788);if(_0x2ea901[_0x75cc('0x30')][_0x75cc('0x3b')]){_0x152e5d[_0x75cc('0x3c')]=_['merge'](_0x152e5d['where'],{'$or':_[_0x75cc('0x2a')](_0x1a2788,function(_0x19a4c1){if(_0x19a4c1[_0x75cc('0x2e')]!==_0x75cc('0x3d')){var _0x35db8e={};_0x35db8e[_0x19a4c1[_0x75cc('0x27')]]={'$like':'%'+_0x2ea901[_0x75cc('0x30')]['filter']+'%'};return _0x35db8e;}})});}_0x152e5d=_[_0x75cc('0x3e')]({},_0x152e5d,_0x2ea901[_0x75cc('0x3f')]);var _0x103dfb={'where':_0x152e5d[_0x75cc('0x3c')]};return db[_0x75cc('0x2b')][_0x75cc('0x1e')](_0x103dfb)[_0x75cc('0x25')](function(_0x31a1ac){_0x2a57fb[_0x75cc('0x1e')]=_0x31a1ac;if(_0x2ea901[_0x75cc('0x30')][_0x75cc('0x40')]){_0x152e5d[_0x75cc('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x75cc('0x42')](_0x152e5d);})['then'](function(_0x482b53){_0x2a57fb[_0x75cc('0x43')]=_0x482b53;return _0x2a57fb;})[_0x75cc('0x25')](respondWithFilteredResult(_0x16487c,_0x152e5d))[_0x75cc('0x44')](handleError(_0x16487c,null));};exports[_0x75cc('0x45')]=function(_0x1293dc,_0x49c69c){var _0x16b28e={'raw':!![],'where':{'id':_0x1293dc[_0x75cc('0x46')]['id']}},_0x8404e3={};_0x8404e3[_0x75cc('0x2f')]=_[_0x75cc('0x31')](db['CmHopperHistory']['rawAttributes']);_0x8404e3[_0x75cc('0x30')]=_[_0x75cc('0x31')](_0x1293dc[_0x75cc('0x30')]);_0x8404e3[_0x75cc('0x32')]=_[_0x75cc('0x33')](_0x8404e3[_0x75cc('0x2f')],_0x8404e3[_0x75cc('0x30')]);_0x16b28e[_0x75cc('0x35')]=_[_0x75cc('0x33')](_0x8404e3['model'],qs[_0x75cc('0x34')](_0x1293dc[_0x75cc('0x30')][_0x75cc('0x34')]));_0x16b28e['attributes']=_0x16b28e[_0x75cc('0x35')][_0x75cc('0x36')]?_0x16b28e[_0x75cc('0x35')]:_0x8404e3['model'];if(_0x1293dc[_0x75cc('0x30')][_0x75cc('0x40')]){_0x16b28e[_0x75cc('0x41')]=[{'all':!![]}];}_0x16b28e=_[_0x75cc('0x3e')]({},_0x16b28e,_0x1293dc[_0x75cc('0x3f')]);return db['CmHopperHistory'][_0x75cc('0x47')](_0x16b28e)[_0x75cc('0x25')](handleEntityNotFound(_0x49c69c,null))[_0x75cc('0x25')](respondWithResult(_0x49c69c,null))[_0x75cc('0x44')](handleError(_0x49c69c,null));};exports[_0x75cc('0x48')]=function(_0x4796e3,_0x262853){return db['CmHopperHistory']['create'](_0x4796e3[_0x75cc('0x49')],{})['then'](respondWithResult(_0x262853,0xc9))[_0x75cc('0x44')](handleError(_0x262853,null));};exports['describe']=function(_0x88effb,_0x26a918){return db['CmHopperHistory'][_0x75cc('0x4a')]()[_0x75cc('0x25')](respondWithResult(_0x26a918,null))[_0x75cc('0x44')](handleError(_0x26a918,null));};exports[_0x75cc('0x24')]=function(_0x414561,_0x5b9746){if(_0x414561[_0x75cc('0x49')]['uniqueid']){delete _0x414561[_0x75cc('0x49')][_0x75cc('0x4b')];}return db[_0x75cc('0x2b')][_0x75cc('0x47')]({'where':{'uniqueid':_0x414561[_0x75cc('0x46')]['id']}})[_0x75cc('0x25')](handleEntityNotFound(_0x5b9746,null))[_0x75cc('0x25')](saveUpdates(_0x414561[_0x75cc('0x49')],null))['then'](respondWithResult(_0x5b9746,null))['catch'](handleError(_0x5b9746,null));}; \ No newline at end of file +var _0x8f3c=['rawAttributes','keys','find','create','body','describe','uniqueid','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','update','then','destroy','name','send','map','CmHopperHistory','fieldName','type','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','filters','merge','where','VIRTUAL','filter','includeAll','include','rows','catch','show','params'];(function(_0x4c72db,_0x3b58b4){var _0x9985f4=function(_0x3de41f){while(--_0x3de41f){_0x4c72db['push'](_0x4c72db['shift']());}};_0x9985f4(++_0x3b58b4);}(_0x8f3c,0x95));var _0xc8f3=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x8f3c[_0x11005e];return _0x29338f;};'use strict';var emlformat=require(_0xc8f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc8f3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8f3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc8f3('0x3'));var util=require(_0xc8f3('0x4'));var path=require(_0xc8f3('0x5'));var sox=require(_0xc8f3('0x6'));var csv=require(_0xc8f3('0x7'));var ejs=require(_0xc8f3('0x8'));var fs=require('fs');var fs_extra=require(_0xc8f3('0x9'));var _=require(_0xc8f3('0xa'));var squel=require(_0xc8f3('0xb'));var crypto=require('crypto');var jsforce=require(_0xc8f3('0xc'));var deskjs=require(_0xc8f3('0xd'));var toCsv=require(_0xc8f3('0x7'));var querystring=require('querystring');var Papa=require(_0xc8f3('0xe'));var Redis=require('ioredis');var authService=require(_0xc8f3('0xf'));var qs=require(_0xc8f3('0x10'));var as=require(_0xc8f3('0x11'));var hardwareService=require(_0xc8f3('0x12'));var logger=require(_0xc8f3('0x13'))(_0xc8f3('0x14'));var utils=require(_0xc8f3('0x15'));var config=require(_0xc8f3('0x16'));var licenseUtil=require(_0xc8f3('0x17'));var db=require(_0xc8f3('0x18'))['db'];function respondWithStatusCode(_0xa1d76e,_0x2ea05f){_0x2ea05f=_0x2ea05f||0xcc;return function(_0x46c7f4){if(_0x46c7f4){return _0xa1d76e[_0xc8f3('0x19')](_0x2ea05f);}return _0xa1d76e['status'](_0x2ea05f)[_0xc8f3('0x1a')]();};}function respondWithResult(_0x411aa4,_0x434b21){_0x434b21=_0x434b21||0xc8;return function(_0xd3f629){if(_0xd3f629){return _0x411aa4[_0xc8f3('0x1b')](_0x434b21)[_0xc8f3('0x1c')](_0xd3f629);}};}function respondWithFilteredResult(_0x5803ec,_0x1092a4){return function(_0x1a04cf){if(_0x1a04cf){var _0x2db11b=typeof _0x1092a4[_0xc8f3('0x1d')]===_0xc8f3('0x1e')&&typeof _0x1092a4[_0xc8f3('0x1f')]===_0xc8f3('0x1e');var _0x5e6630=_0x1a04cf[_0xc8f3('0x20')];var _0x1bbf27=_0x2db11b?0x0:_0x1092a4[_0xc8f3('0x1d')];var _0x1cf06a=_0x2db11b?_0x1a04cf['count']:_0x1092a4['offset']+_0x1092a4[_0xc8f3('0x1f')];var _0x501980;if(_0x1cf06a>=_0x5e6630){_0x1cf06a=_0x5e6630;_0x501980=0xc8;}else{_0x501980=0xce;}_0x5803ec[_0xc8f3('0x1b')](_0x501980);return _0x5803ec[_0xc8f3('0x21')]('Content-Range',_0x1bbf27+'-'+_0x1cf06a+'/'+_0x5e6630)['json'](_0x1a04cf);}return null;};}function patchUpdates(_0x23ebf0){return function(_0x474c7c){try{jsonpatch[_0xc8f3('0x22')](_0x474c7c,_0x23ebf0,!![]);}catch(_0x2fb579){return BPromise['reject'](_0x2fb579);}return _0x474c7c['save']();};}function saveUpdates(_0x21bb27,_0x45a90a){return function(_0x5d2f38){if(_0x5d2f38){return _0x5d2f38[_0xc8f3('0x23')](_0x21bb27)[_0xc8f3('0x24')](function(_0x2af638){return _0x2af638;});}return null;};}function removeEntity(_0xce2424,_0x3c7894){return function(_0x514c1){if(_0x514c1){return _0x514c1[_0xc8f3('0x25')]()[_0xc8f3('0x24')](function(){_0xce2424[_0xc8f3('0x1b')](0xcc)[_0xc8f3('0x1a')]();});}};}function handleEntityNotFound(_0x9a8b68,_0x3542b7){return function(_0x258d2d){if(!_0x258d2d){_0x9a8b68[_0xc8f3('0x19')](0x194);}return _0x258d2d;};}function handleError(_0x1f5d5f,_0x294745){_0x294745=_0x294745||0x1f4;return function(_0x39bdfd){logger['error'](_0x39bdfd['stack']);if(_0x39bdfd[_0xc8f3('0x26')]){delete _0x39bdfd[_0xc8f3('0x26')];}_0x1f5d5f[_0xc8f3('0x1b')](_0x294745)[_0xc8f3('0x27')](_0x39bdfd);};}exports['index']=function(_0x21b046,_0x313ee9){var _0x49570d={},_0x119dea={},_0x177aa9={'count':0x0,'rows':[]};var _0x5b1815=_[_0xc8f3('0x28')](db[_0xc8f3('0x29')]['rawAttributes'],function(_0xeea04e){return{'name':_0xeea04e[_0xc8f3('0x2a')],'type':_0xeea04e[_0xc8f3('0x2b')]['key']};});_0x119dea['model']=_[_0xc8f3('0x28')](_0x5b1815,_0xc8f3('0x26'));_0x119dea[_0xc8f3('0x2c')]=_['keys'](_0x21b046[_0xc8f3('0x2c')]);_0x119dea['filters']=_['intersection'](_0x119dea['model'],_0x119dea['query']);_0x49570d[_0xc8f3('0x2d')]=_[_0xc8f3('0x2e')](_0x119dea[_0xc8f3('0x2f')],qs[_0xc8f3('0x30')](_0x21b046[_0xc8f3('0x2c')][_0xc8f3('0x30')]));_0x49570d[_0xc8f3('0x2d')]=_0x49570d[_0xc8f3('0x2d')][_0xc8f3('0x31')]?_0x49570d[_0xc8f3('0x2d')]:_0x119dea['model'];if(!_0x21b046[_0xc8f3('0x2c')][_0xc8f3('0x32')](_0xc8f3('0x33'))){_0x49570d[_0xc8f3('0x1f')]=qs[_0xc8f3('0x1f')](_0x21b046[_0xc8f3('0x2c')]['limit']);_0x49570d[_0xc8f3('0x1d')]=qs[_0xc8f3('0x1d')](_0x21b046[_0xc8f3('0x2c')]['offset']);}_0x49570d[_0xc8f3('0x34')]=qs['sort'](_0x21b046[_0xc8f3('0x2c')]['sort']);_0x49570d['where']=qs[_0xc8f3('0x35')](_['pick'](_0x21b046[_0xc8f3('0x2c')],_0x119dea[_0xc8f3('0x35')]),_0x5b1815);if(_0x21b046['query']['filter']){_0x49570d['where']=_[_0xc8f3('0x36')](_0x49570d[_0xc8f3('0x37')],{'$or':_[_0xc8f3('0x28')](_0x5b1815,function(_0x1bf326){if(_0x1bf326['type']!==_0xc8f3('0x38')){var _0x2b9a3f={};_0x2b9a3f[_0x1bf326[_0xc8f3('0x26')]]={'$like':'%'+_0x21b046[_0xc8f3('0x2c')][_0xc8f3('0x39')]+'%'};return _0x2b9a3f;}})});}_0x49570d=_['merge']({},_0x49570d,_0x21b046['options']);var _0x2dd146={'where':_0x49570d[_0xc8f3('0x37')]};return db[_0xc8f3('0x29')]['count'](_0x2dd146)['then'](function(_0x5514c6){_0x177aa9[_0xc8f3('0x20')]=_0x5514c6;if(_0x21b046[_0xc8f3('0x2c')][_0xc8f3('0x3a')]){_0x49570d[_0xc8f3('0x3b')]=[{'all':!![]}];}return db[_0xc8f3('0x29')]['findAll'](_0x49570d);})['then'](function(_0x5b0181){_0x177aa9[_0xc8f3('0x3c')]=_0x5b0181;return _0x177aa9;})[_0xc8f3('0x24')](respondWithFilteredResult(_0x313ee9,_0x49570d))[_0xc8f3('0x3d')](handleError(_0x313ee9,null));};exports[_0xc8f3('0x3e')]=function(_0x2b6b24,_0x578b0b){var _0x39a399={'raw':!![],'where':{'id':_0x2b6b24[_0xc8f3('0x3f')]['id']}},_0x4a56c1={};_0x4a56c1[_0xc8f3('0x2f')]=_['keys'](db['CmHopperHistory'][_0xc8f3('0x40')]);_0x4a56c1[_0xc8f3('0x2c')]=_[_0xc8f3('0x41')](_0x2b6b24[_0xc8f3('0x2c')]);_0x4a56c1['filters']=_[_0xc8f3('0x2e')](_0x4a56c1[_0xc8f3('0x2f')],_0x4a56c1['query']);_0x39a399['attributes']=_['intersection'](_0x4a56c1[_0xc8f3('0x2f')],qs[_0xc8f3('0x30')](_0x2b6b24['query'][_0xc8f3('0x30')]));_0x39a399[_0xc8f3('0x2d')]=_0x39a399[_0xc8f3('0x2d')][_0xc8f3('0x31')]?_0x39a399['attributes']:_0x4a56c1[_0xc8f3('0x2f')];if(_0x2b6b24[_0xc8f3('0x2c')][_0xc8f3('0x3a')]){_0x39a399[_0xc8f3('0x3b')]=[{'all':!![]}];}_0x39a399=_[_0xc8f3('0x36')]({},_0x39a399,_0x2b6b24['options']);return db[_0xc8f3('0x29')][_0xc8f3('0x42')](_0x39a399)[_0xc8f3('0x24')](handleEntityNotFound(_0x578b0b,null))['then'](respondWithResult(_0x578b0b,null))[_0xc8f3('0x3d')](handleError(_0x578b0b,null));};exports[_0xc8f3('0x43')]=function(_0x256e38,_0x12977b){return db[_0xc8f3('0x29')]['create'](_0x256e38[_0xc8f3('0x44')],{})[_0xc8f3('0x24')](respondWithResult(_0x12977b,0xc9))['catch'](handleError(_0x12977b,null));};exports[_0xc8f3('0x45')]=function(_0x4afd5e,_0x5dfbba){return db[_0xc8f3('0x29')][_0xc8f3('0x45')]()[_0xc8f3('0x24')](respondWithResult(_0x5dfbba,null))[_0xc8f3('0x3d')](handleError(_0x5dfbba,null));};exports[_0xc8f3('0x23')]=function(_0x42c521,_0x295776){if(_0x42c521[_0xc8f3('0x44')][_0xc8f3('0x46')]){delete _0x42c521['body'][_0xc8f3('0x46')];}return db[_0xc8f3('0x29')][_0xc8f3('0x42')]({'where':{'uniqueid':_0x42c521[_0xc8f3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x295776,null))[_0xc8f3('0x24')](saveUpdates(_0x42c521[_0xc8f3('0x44')],null))['then'](respondWithResult(_0x295776,null))['catch'](handleError(_0x295776,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 7cbd378..f012d59 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 _0xc74c=['CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x264738,_0x998758){var _0x58ab47=function(_0x6fd39e){while(--_0x6fd39e){_0x264738['push'](_0x264738['shift']());}};_0x58ab47(++_0x998758);}(_0xc74c,0x163));var _0xcc74=function(_0x18d578,_0x1974aa){_0x18d578=_0x18d578-0x0;var _0xedb538=_0xc74c[_0x18d578];return _0xedb538;};'use strict';var _=require(_0xcc74('0x0'));var util=require(_0xcc74('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcc74('0x2'));var BPromise=require(_0xcc74('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc74('0x4'));var rimraf=require(_0xcc74('0x5'));var config=require(_0xcc74('0x6'));var attributes=require(_0xcc74('0x7'));module[_0xcc74('0x8')]=function(_0x23c249,_0x425b73){return _0x23c249['define'](_0xcc74('0x9'),attributes,{'tableName':_0xcc74('0xa'),'paranoid':![],'indexes':[{'name':_0xcc74('0xb'),'fields':[_0xcc74('0xb')]},{'name':_0xcc74('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9219=['moment','path','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x300a0a,_0x1653d4){var _0x28b718=function(_0x1100ce){while(--_0x1100ce){_0x300a0a['push'](_0x300a0a['shift']());}};_0x28b718(++_0x1653d4);}(_0x9219,0x19e));var _0x9921=function(_0x4611e9,_0xb17db8){_0x4611e9=_0x4611e9-0x0;var _0x189bbe=_0x9219[_0x4611e9];return _0x189bbe;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9921('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9921('0x1'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9921('0x2'));module[_0x9921('0x3')]=function(_0x4f9708,_0x1f932b){return _0x4f9708[_0x9921('0x4')](_0x9921('0x5'),attributes,{'tableName':_0x9921('0x6'),'paranoid':![],'indexes':[{'name':_0x9921('0x7'),'fields':[_0x9921('0x7')]},{'name':_0x9921('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index f3b457c..059a281 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 _0x720c=['debug','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','catch','CmHopperHistory','create','body','options','CreateCmHopperHistory','findAll','raw','where','sequelize','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','then','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','col','ivrAnswerCallsDay','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x24e147,_0x240df5){var _0x2b5aba=function(_0x6c2323){while(--_0x6c2323){_0x24e147['push'](_0x24e147['shift']());}};_0x2b5aba(++_0x240df5);}(_0x720c,0x154));var _0xc720=function(_0x4d2b7f,_0x4836b9){_0x4d2b7f=_0x4d2b7f-0x0;var _0x1ee7d0=_0x720c[_0x4d2b7f];return _0x1ee7d0;};'use strict';var _=require(_0xc720('0x0'));var util=require('util');var moment=require(_0xc720('0x1'));var BPromise=require(_0xc720('0x2'));var rs=require(_0xc720('0x3'));var fs=require('fs');var Redis=require(_0xc720('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc720('0x5'));var logger=require(_0xc720('0x6'))(_0xc720('0x7'));var config=require(_0xc720('0x8'));var jayson=require(_0xc720('0x9'));var client=jayson[_0xc720('0xa')][_0xc720('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bc8b0,_0x20d21c,_0x8a01fc){return new BPromise(function(_0x10a2c8,_0x1a2a00){return client[_0xc720('0xc')](_0x5bc8b0,_0x8a01fc)['then'](function(_0x539493){logger[_0xc720('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x20d21c,_0xc720('0xe'));logger[_0xc720('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x20d21c,_0xc720('0xe'),JSON[_0xc720('0x10')](_0x539493));if(_0x539493[_0xc720('0x11')]){if(_0x539493[_0xc720('0x11')][_0xc720('0x12')]===0x1f4){logger['error'](_0xc720('0x13'),_0x20d21c,_0x539493[_0xc720('0x11')][_0xc720('0x14')]);return _0x1a2a00(_0x539493[_0xc720('0x11')]['message']);}logger[_0xc720('0x11')](_0xc720('0x13'),_0x20d21c,_0x539493[_0xc720('0x11')]['message']);return _0x10a2c8(_0x539493[_0xc720('0x11')][_0xc720('0x14')]);}else{logger[_0xc720('0xd')](_0xc720('0x13'),_0x20d21c,_0xc720('0xe'));_0x10a2c8(_0x539493['result']['message']);}})[_0xc720('0x15')](function(_0x583e07){logger[_0xc720('0x11')](_0xc720('0x13'),_0x20d21c,_0x583e07);_0x1a2a00(_0x583e07);});});}exports['CreateCmHopperHistory']=function(_0x34de4c){var _0x2a4fc0=this;return new Promise(function(_0x195cf3,_0x7b41f3){return db[_0xc720('0x16')][_0xc720('0x17')](_0x34de4c[_0xc720('0x18')],{'raw':_0x34de4c[_0xc720('0x19')]?_0x34de4c[_0xc720('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x52cdf7){logger[_0xc720('0xd')](_0xc720('0x1a'),_0x34de4c);logger[_0xc720('0xf')](_0xc720('0x1a'),_0x34de4c,JSON[_0xc720('0x10')](_0x52cdf7));_0x195cf3(_0x52cdf7);})[_0xc720('0x15')](function(_0x358cfe){logger['error'](_0xc720('0x1a'),_0x358cfe['message'],_0x34de4c);_0x7b41f3(_0x2a4fc0[_0xc720('0x11')](0x1f4,_0x358cfe[_0xc720('0x14')]));});});};exports['AvgHandleTime']=function(_0xfc7d7b){var _0x2d6b3f=this;return new Promise(function(_0x2efbdc,_0x232cb1){return db[_0xc720('0x16')][_0xc720('0x1b')]({'raw':_0xfc7d7b[_0xc720('0x19')]?_0xfc7d7b['options'][_0xc720('0x1c')]===undefined?!![]:![]:!![],'where':_0xfc7d7b[_0xc720('0x19')]?_0xfc7d7b['options'][_0xc720('0x1d')]||null:null,'attributes':[[db[_0xc720('0x1e')]['fn']('COUNT',db[_0xc720('0x1e')]['col']('id')),_0xc720('0x1f')],[db[_0xc720('0x1e')]['fn'](_0xc720('0x20'),db[_0xc720('0x1e')]['fn']('IF',db[_0xc720('0x1e')][_0xc720('0x21')](_0xc720('0x22')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0xc720('0x20'),db[_0xc720('0x1e')]['fn']('IF',db['sequelize'][_0xc720('0x21')]('`state`\x20=\x2010,\x201,\x20null'))),_0xc720('0x23')],[db[_0xc720('0x1e')]['fn']('COUNT',db[_0xc720('0x1e')]['fn']('IF',db[_0xc720('0x1e')][_0xc720('0x21')](_0xc720('0x24')))),_0xc720('0x25')],[db[_0xc720('0x1e')]['fn'](_0xc720('0x26'),db[_0xc720('0x1e')]['fn']('IF',db[_0xc720('0x1e')][_0xc720('0x21')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xc720('0x27')],[db['sequelize']['fn'](_0xc720('0x26'),db['sequelize']['fn']('IF',db['sequelize'][_0xc720('0x21')](_0xc720('0x28')))),_0xc720('0x29')]]})[_0xc720('0x2a')](function(_0x4edcf4){logger[_0xc720('0xd')](_0xc720('0x2b'),_0xfc7d7b);logger['debug'](_0xc720('0x2b'),_0xfc7d7b,JSON[_0xc720('0x10')](_0x4edcf4));_0x2efbdc(_0x4edcf4);})[_0xc720('0x15')](function(_0x27e264){logger['error'](_0xc720('0x2b'),_0x27e264[_0xc720('0x14')],_0xfc7d7b);_0x232cb1(_0x2d6b3f['error'](0x1f4,_0x27e264['message']));});});};exports[_0xc720('0x2c')]=function(_0x20894f){var _0x53b239=this;return new Promise(function(_0x42c8f6,_0x5c4dff){return db[_0xc720('0x16')][_0xc720('0x1b')]({'raw':_0x20894f[_0xc720('0x19')]?_0x20894f[_0xc720('0x19')][_0xc720('0x1c')]===undefined?!![]:![]:!![],'where':_0x20894f['options']?_0x20894f[_0xc720('0x19')]['where']||null:null,'attributes':[[_0xc720('0x2d'),'name'],[db['sequelize']['fn'](_0xc720('0x20'),db[_0xc720('0x1e')]['fn']('IF',db[_0xc720('0x1e')][_0xc720('0x21')](_0xc720('0x2e')))),'outboundNoSuchCallsDay'],[db[_0xc720('0x1e')]['fn']('COUNT',db[_0xc720('0x1e')]['fn']('IF',db[_0xc720('0x1e')]['literal'](_0xc720('0x2f')))),_0xc720('0x30')],[db[_0xc720('0x1e')]['fn'](_0xc720('0x20'),db[_0xc720('0x1e')]['fn']('IF',db[_0xc720('0x1e')][_0xc720('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0xc720('0x31')],[db[_0xc720('0x1e')]['fn'](_0xc720('0x20'),db['sequelize']['fn']('IF',db[_0xc720('0x1e')][_0xc720('0x21')](_0xc720('0x32')))),_0xc720('0x33')],[db[_0xc720('0x1e')]['fn'](_0xc720('0x20'),db[_0xc720('0x1e')]['fn']('IF',db[_0xc720('0x1e')][_0xc720('0x21')]('`state`\x20=\x208,\x201,\x20null'))),_0xc720('0x34')],[db[_0xc720('0x1e')]['fn'](_0xc720('0x20'),db['sequelize']['fn']('IF',db[_0xc720('0x1e')][_0xc720('0x21')](_0xc720('0x35')))),'outboundDropCallsDayTimeout'],[db[_0xc720('0x1e')]['fn'](_0xc720('0x20'),db[_0xc720('0x1e')]['fn']('IF',db[_0xc720('0x1e')][_0xc720('0x21')](_0xc720('0x36')))),_0xc720('0x37')],[db[_0xc720('0x1e')]['fn']('COUNT',db[_0xc720('0x1e')]['fn']('IF',db[_0xc720('0x1e')][_0xc720('0x21')](_0xc720('0x38')))),_0xc720('0x39')],[db[_0xc720('0x1e')]['fn']('COUNT',db[_0xc720('0x1e')]['fn']('IF',db['sequelize'][_0xc720('0x21')](_0xc720('0x3a')))),_0xc720('0x3b')],[db[_0xc720('0x1e')]['fn']('COUNT',db[_0xc720('0x1e')]['fn']('IF',db[_0xc720('0x1e')][_0xc720('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xc720('0x1e')]['fn']('IF',db[_0xc720('0x1e')]['literal'](_0xc720('0x3c')))),'outboundRejectCallsDay'],[db[_0xc720('0x1e')]['fn']('COUNT',db[_0xc720('0x1e')]['fn']('IF',db[_0xc720('0x1e')]['literal'](_0xc720('0x3d')))),_0xc720('0x3e')],[db['sequelize']['fn'](_0xc720('0x20'),db[_0xc720('0x1e')]['fn']('IF',db['sequelize'][_0xc720('0x21')](_0xc720('0x3f')))),_0xc720('0x40')],[db[_0xc720('0x1e')]['fn'](_0xc720('0x20'),db[_0xc720('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xc720('0x41')))),_0xc720('0x42')]],'group':[_0xc720('0x2d')]})[_0xc720('0x2a')](function(_0x2778e2){logger['info'](_0xc720('0x2c'),_0x20894f);logger['debug'](_0xc720('0x2c'),_0x20894f,JSON[_0xc720('0x10')](_0x2778e2));_0x42c8f6(_0x2778e2);})[_0xc720('0x15')](function(_0x3e9609){logger[_0xc720('0x11')](_0xc720('0x2c'),_0x3e9609[_0xc720('0x14')],_0x20894f);_0x5c4dff(_0x53b239[_0xc720('0x11')](0x1f4,_0x3e9609[_0xc720('0x14')]));});});};exports[_0xc720('0x43')]=function(_0x9b9db4){var _0x280fd2=this;return new Promise(function(_0x379edd,_0x132649){return db[_0xc720('0x16')][_0xc720('0x1b')]({'raw':_0x9b9db4[_0xc720('0x19')]?_0x9b9db4[_0xc720('0x19')][_0xc720('0x1c')]===undefined?!![]:![]:!![],'where':_0x9b9db4[_0xc720('0x19')]?_0x9b9db4[_0xc720('0x19')]['where']||null:null,'attributes':[[_0xc720('0x2d'),_0xc720('0x44')],[db[_0xc720('0x1e')]['fn'](_0xc720('0x20'),db[_0xc720('0x1e')][_0xc720('0x45')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn']('COUNT',db[_0xc720('0x1e')]['fn']('IF',db[_0xc720('0x1e')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xc720('0x46')]],'group':[_0xc720('0x2d')]})['then'](function(_0x5b7d96){logger[_0xc720('0xd')](_0xc720('0x43'),_0x9b9db4);logger['debug'](_0xc720('0x43'),_0x9b9db4,JSON[_0xc720('0x10')](_0x5b7d96));_0x379edd(_0x5b7d96);})[_0xc720('0x15')](function(_0x2056b2){logger[_0xc720('0x11')](_0xc720('0x43'),_0x2056b2[_0xc720('0x14')],_0x9b9db4);_0x132649(_0x280fd2['error'](0x1f4,_0x2056b2[_0xc720('0x14')]));});});}; \ No newline at end of file +var _0xfccf=['predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','raw','where','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','AvgHandleTime','sequelize','COUNT','col','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xfccf,0xaa));var _0xffcc=function(_0x39b6f7,_0x513052){_0x39b6f7=_0x39b6f7-0x0;var _0x5f4545=_0xfccf[_0x39b6f7];return _0x5f4545;};'use strict';var _=require(_0xffcc('0x0'));var util=require(_0xffcc('0x1'));var moment=require(_0xffcc('0x2'));var BPromise=require(_0xffcc('0x3'));var rs=require(_0xffcc('0x4'));var fs=require('fs');var Redis=require(_0xffcc('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xffcc('0x6'))(_0xffcc('0x7'));var config=require(_0xffcc('0x8'));var jayson=require(_0xffcc('0x9'));var client=jayson[_0xffcc('0xa')][_0xffcc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x229fe1,_0x3cf6b6,_0x5792b8){return new BPromise(function(_0x15e64c,_0x240dfe){return client['request'](_0x229fe1,_0x5792b8)[_0xffcc('0xc')](function(_0x3ceec5){logger['info'](_0xffcc('0xd'),_0x3cf6b6,_0xffcc('0xe'));logger[_0xffcc('0xf')](_0xffcc('0x10'),_0x3cf6b6,_0xffcc('0xe'),JSON[_0xffcc('0x11')](_0x3ceec5));if(_0x3ceec5[_0xffcc('0x12')]){if(_0x3ceec5[_0xffcc('0x12')][_0xffcc('0x13')]===0x1f4){logger[_0xffcc('0x12')](_0xffcc('0xd'),_0x3cf6b6,_0x3ceec5['error']['message']);return _0x240dfe(_0x3ceec5[_0xffcc('0x12')][_0xffcc('0x14')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x3cf6b6,_0x3ceec5[_0xffcc('0x12')]['message']);return _0x15e64c(_0x3ceec5[_0xffcc('0x12')][_0xffcc('0x14')]);}else{logger[_0xffcc('0x15')](_0xffcc('0xd'),_0x3cf6b6,'request\x20sent');_0x15e64c(_0x3ceec5[_0xffcc('0x16')][_0xffcc('0x14')]);}})[_0xffcc('0x17')](function(_0x1fc745){logger['error'](_0xffcc('0xd'),_0x3cf6b6,_0x1fc745);_0x240dfe(_0x1fc745);});});}exports[_0xffcc('0x18')]=function(_0x4e979f){var _0x3dd2c8=this;return new Promise(function(_0x230411,_0x51437d){return db[_0xffcc('0x19')][_0xffcc('0x1a')](_0x4e979f[_0xffcc('0x1b')],{'raw':_0x4e979f[_0xffcc('0x1c')]?_0x4e979f['options']['raw']===undefined?!![]:![]:!![]})[_0xffcc('0xc')](function(_0x402c95){logger[_0xffcc('0x15')](_0xffcc('0x18'),_0x4e979f);logger[_0xffcc('0xf')](_0xffcc('0x18'),_0x4e979f,JSON[_0xffcc('0x11')](_0x402c95));_0x230411(_0x402c95);})[_0xffcc('0x17')](function(_0x217914){logger[_0xffcc('0x12')](_0xffcc('0x18'),_0x217914[_0xffcc('0x14')],_0x4e979f);_0x51437d(_0x3dd2c8['error'](0x1f4,_0x217914[_0xffcc('0x14')]));});});};exports[_0xffcc('0x1d')]=function(_0x18e4ed){var _0x1b9024=this;return new Promise(function(_0x1c073e,_0x3bc3c7){return db[_0xffcc('0x19')]['findAll']({'raw':_0x18e4ed[_0xffcc('0x1c')]?_0x18e4ed[_0xffcc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x18e4ed[_0xffcc('0x1c')]?_0x18e4ed[_0xffcc('0x1c')]['where']||null:null,'attributes':[[db[_0xffcc('0x1e')]['fn'](_0xffcc('0x1f'),db[_0xffcc('0x1e')][_0xffcc('0x20')]('id')),'predictiveIntervalTotalCalls'],[db[_0xffcc('0x1e')]['fn'](_0xffcc('0x1f'),db[_0xffcc('0x1e')]['fn']('IF',db[_0xffcc('0x1e')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn']('COUNT',db[_0xffcc('0x1e')]['fn']('IF',db['sequelize'][_0xffcc('0x21')](_0xffcc('0x22')))),_0xffcc('0x23')],[db[_0xffcc('0x1e')]['fn'](_0xffcc('0x1f'),db['sequelize']['fn']('IF',db[_0xffcc('0x1e')][_0xffcc('0x21')](_0xffcc('0x24')))),_0xffcc('0x25')],[db[_0xffcc('0x1e')]['fn'](_0xffcc('0x26'),db[_0xffcc('0x1e')]['fn']('IF',db[_0xffcc('0x1e')][_0xffcc('0x21')](_0xffcc('0x27')))),_0xffcc('0x28')],[db['sequelize']['fn']('AVG',db[_0xffcc('0x1e')]['fn']('IF',db[_0xffcc('0x1e')]['literal'](_0xffcc('0x29')))),_0xffcc('0x2a')]]})[_0xffcc('0xc')](function(_0x2a6beb){logger[_0xffcc('0x15')]('AvgHandleTime',_0x18e4ed);logger[_0xffcc('0xf')]('AvgHandleTime',_0x18e4ed,JSON[_0xffcc('0x11')](_0x2a6beb));_0x1c073e(_0x2a6beb);})['catch'](function(_0x294510){logger[_0xffcc('0x12')]('AvgHandleTime',_0x294510[_0xffcc('0x14')],_0x18e4ed);_0x3bc3c7(_0x1b9024[_0xffcc('0x12')](0x1f4,_0x294510[_0xffcc('0x14')]));});});};exports[_0xffcc('0x2b')]=function(_0x217277){var _0x5c5be2=this;return new Promise(function(_0x1248ed,_0x5986b1){return db[_0xffcc('0x19')]['findAll']({'raw':_0x217277[_0xffcc('0x1c')]?_0x217277[_0xffcc('0x1c')][_0xffcc('0x2c')]===undefined?!![]:![]:!![],'where':_0x217277['options']?_0x217277[_0xffcc('0x1c')][_0xffcc('0x2d')]||null:null,'attributes':[[_0xffcc('0x2e'),_0xffcc('0x2f')],[db[_0xffcc('0x1e')]['fn']('COUNT',db[_0xffcc('0x1e')]['fn']('IF',db[_0xffcc('0x1e')][_0xffcc('0x21')](_0xffcc('0x30')))),'outboundNoSuchCallsDay'],[db[_0xffcc('0x1e')]['fn'](_0xffcc('0x1f'),db[_0xffcc('0x1e')]['fn']('IF',db[_0xffcc('0x1e')]['literal'](_0xffcc('0x31')))),_0xffcc('0x32')],[db['sequelize']['fn'](_0xffcc('0x1f'),db[_0xffcc('0x1e')]['fn']('IF',db['sequelize'][_0xffcc('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0xffcc('0x33')],[db[_0xffcc('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xffcc('0x1e')][_0xffcc('0x21')](_0xffcc('0x34')))),_0xffcc('0x35')],[db[_0xffcc('0x1e')]['fn'](_0xffcc('0x1f'),db[_0xffcc('0x1e')]['fn']('IF',db[_0xffcc('0x1e')][_0xffcc('0x21')]('`state`\x20=\x208,\x201,\x20null'))),_0xffcc('0x36')],[db[_0xffcc('0x1e')]['fn'](_0xffcc('0x1f'),db[_0xffcc('0x1e')]['fn']('IF',db[_0xffcc('0x1e')][_0xffcc('0x21')](_0xffcc('0x37')))),_0xffcc('0x38')],[db[_0xffcc('0x1e')]['fn'](_0xffcc('0x1f'),db[_0xffcc('0x1e')]['fn']('IF',db[_0xffcc('0x1e')]['literal'](_0xffcc('0x39')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn']('COUNT',db[_0xffcc('0x1e')]['fn']('IF',db['sequelize'][_0xffcc('0x21')](_0xffcc('0x3a')))),_0xffcc('0x3b')],[db[_0xffcc('0x1e')]['fn'](_0xffcc('0x1f'),db[_0xffcc('0x1e')]['fn']('IF',db['sequelize'][_0xffcc('0x21')]('`state`\x20=\x2013,\x201,\x20null'))),_0xffcc('0x3c')],[db['sequelize']['fn'](_0xffcc('0x1f'),db[_0xffcc('0x1e')]['fn']('IF',db[_0xffcc('0x1e')][_0xffcc('0x21')](_0xffcc('0x3d')))),_0xffcc('0x3e')],[db['sequelize']['fn'](_0xffcc('0x1f'),db[_0xffcc('0x1e')]['fn']('IF',db[_0xffcc('0x1e')][_0xffcc('0x21')]('`state`\x20=\x2018,\x201,\x20null'))),_0xffcc('0x3f')],[db['sequelize']['fn'](_0xffcc('0x1f'),db['sequelize']['fn']('IF',db[_0xffcc('0x1e')]['literal'](_0xffcc('0x40')))),_0xffcc('0x41')],[db[_0xffcc('0x1e')]['fn'](_0xffcc('0x1f'),db[_0xffcc('0x1e')]['fn']('IF',db['sequelize'][_0xffcc('0x21')](_0xffcc('0x42')))),_0xffcc('0x3f')],[db[_0xffcc('0x1e')]['fn'](_0xffcc('0x1f'),db[_0xffcc('0x1e')]['fn']('IF',db['sequelize'][_0xffcc('0x21')](_0xffcc('0x43')))),'outboundReCallsDay']],'group':[_0xffcc('0x2e')]})[_0xffcc('0xc')](function(_0x44ef5d){logger[_0xffcc('0x15')](_0xffcc('0x2b'),_0x217277);logger[_0xffcc('0xf')](_0xffcc('0x2b'),_0x217277,JSON['stringify'](_0x44ef5d));_0x1248ed(_0x44ef5d);})[_0xffcc('0x17')](function(_0x5c40f5){logger['error'](_0xffcc('0x2b'),_0x5c40f5['message'],_0x217277);_0x5986b1(_0x5c5be2['error'](0x1f4,_0x5c40f5['message']));});});};exports['GetCampaignHopperHistory']=function(_0x4afd24){var _0x912857=this;return new Promise(function(_0x530182,_0x511bcb){return db[_0xffcc('0x19')]['findAll']({'raw':_0x4afd24['options']?_0x4afd24[_0xffcc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4afd24['options']?_0x4afd24['options'][_0xffcc('0x2d')]||null:null,'attributes':[[_0xffcc('0x2e'),_0xffcc('0x2f')],[db['sequelize']['fn'](_0xffcc('0x1f'),db[_0xffcc('0x1e')][_0xffcc('0x20')]('id')),'ivrTotalCallsDays'],[db[_0xffcc('0x1e')]['fn'](_0xffcc('0x1f'),db[_0xffcc('0x1e')]['fn']('IF',db['sequelize'][_0xffcc('0x21')](_0xffcc('0x44')))),'ivrAnswerCallsDay']],'group':[_0xffcc('0x2e')]})[_0xffcc('0xc')](function(_0x5b45f1){logger[_0xffcc('0x15')](_0xffcc('0x45'),_0x4afd24);logger['debug'](_0xffcc('0x45'),_0x4afd24,JSON[_0xffcc('0x11')](_0x5b45f1));_0x530182(_0x5b45f1);})[_0xffcc('0x17')](function(_0x58243c){logger[_0xffcc('0x12')](_0xffcc('0x45'),_0x58243c[_0xffcc('0x14')],_0x4afd24);_0x511bcb(_0x912857[_0xffcc('0x12')](0x1f4,_0x58243c[_0xffcc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 5b59a54..a7324c7 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 _0x0b4a=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update'];(function(_0x31503e,_0x33ef85){var _0x533b36=function(_0x22f2f4){while(--_0x22f2f4){_0x31503e['push'](_0x31503e['shift']());}};_0x533b36(++_0x33ef85);}(_0x0b4a,0xf3));var _0xa0b4=function(_0xe56711,_0x31bd00){_0xe56711=_0xe56711-0x0;var _0x132dab=_0x0b4a[_0xe56711];return _0x132dab;};'use strict';var multer=require(_0xa0b4('0x0'));var util=require(_0xa0b4('0x1'));var path=require(_0xa0b4('0x2'));var timeout=require(_0xa0b4('0x3'));var express=require(_0xa0b4('0x4'));var router=express[_0xa0b4('0x5')]();var fs_extra=require(_0xa0b4('0x6'));var auth=require(_0xa0b4('0x7'));var interaction=require(_0xa0b4('0x8'));var config=require(_0xa0b4('0x9'));var controller=require(_0xa0b4('0xa'));router[_0xa0b4('0xb')]('/',auth[_0xa0b4('0xc')](),controller[_0xa0b4('0xd')]);router[_0xa0b4('0xb')](_0xa0b4('0xe'),auth[_0xa0b4('0xc')](),controller[_0xa0b4('0xf')]);router[_0xa0b4('0xb')](_0xa0b4('0x10'),auth['isAuthenticated'](),controller[_0xa0b4('0x11')]);router[_0xa0b4('0x12')]('/',auth[_0xa0b4('0xc')](),controller[_0xa0b4('0x13')]);router['put']('/:id',auth[_0xa0b4('0xc')](),controller[_0xa0b4('0x14')]);module[_0xa0b4('0x15')]=router; \ No newline at end of file +var _0x738f=['post','create','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id'];(function(_0x303ff8,_0x22e541){var _0x2c9ed2=function(_0x454c82){while(--_0x454c82){_0x303ff8['push'](_0x303ff8['shift']());}};_0x2c9ed2(++_0x22e541);}(_0x738f,0xa4));var _0xf738=function(_0x3d8eb2,_0x5e58a3){_0x3d8eb2=_0x3d8eb2-0x0;var _0x1bb6bb=_0x738f[_0x3d8eb2];return _0x1bb6bb;};'use strict';var multer=require(_0xf738('0x0'));var util=require(_0xf738('0x1'));var path=require(_0xf738('0x2'));var timeout=require(_0xf738('0x3'));var express=require(_0xf738('0x4'));var router=express[_0xf738('0x5')]();var fs_extra=require(_0xf738('0x6'));var auth=require(_0xf738('0x7'));var interaction=require(_0xf738('0x8'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0xf738('0x9')]('/',auth[_0xf738('0xa')](),controller['index']);router[_0xf738('0x9')]('/describe',auth[_0xf738('0xa')](),controller['describe']);router[_0xf738('0x9')](_0xf738('0xb'),auth[_0xf738('0xa')](),controller['show']);router[_0xf738('0xc')]('/',auth[_0xf738('0xa')](),controller[_0xf738('0xd')]);router[_0xf738('0xe')]('/:id',auth[_0xf738('0xa')](),controller['update']);module[_0xf738('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 8da9ce1..6fb1939 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 _0x85d0=['STRING'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x85d0,0x164));var _0x085d=function(_0x47e3c1,_0x197447){_0x47e3c1=_0x47e3c1-0x0;var _0x202272=_0x85d0[_0x47e3c1];return _0x202272;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x085d('0x0')]},'dialPrefix':{'type':Sequelize[_0x085d('0x0')]}}; \ No newline at end of file +var _0x9417=['sequelize','exports','STRING','name'];(function(_0x3f51d7,_0x2ac93e){var _0x127aa4=function(_0x2d5574){while(--_0x2d5574){_0x3f51d7['push'](_0x3f51d7['shift']());}};_0x127aa4(++_0x2ac93e);}(_0x9417,0xb4));var _0x7941=function(_0x111494,_0x1d73da){_0x111494=_0x111494-0x0;var _0x1d0d8b=_0x9417[_0x111494];return _0x1d0d8b;};'use strict';var Sequelize=require(_0x7941('0x0'));module[_0x7941('0x1')]={'name':{'type':Sequelize[_0x7941('0x2')],'unique':_0x7941('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x7941('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 1a5954d..493a08b 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 _0x7bfc=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','describe','addDisposition','ListId','Disposition','findOne','nolimit','removeDispositions','addContacts','CmContact','tags','isArray','join','push','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','format','cf_%d','getContactsCsv','ContactItemType','alias','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','customField_','select','item','from','cm_contact_has_items','CmContactId\x20=\x20c.id','ItemTypeId\x20=\x20?','toString','each','isEmpty','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','CmCustomField','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','ids','emit','removeAgents','userCmList:remove','User','info','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./cmList.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update','then','destroy','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','get'];(function(_0xbcfc7b,_0x2d3304){var _0x3cf8c8=function(_0x38be40){while(--_0x38be40){_0xbcfc7b['push'](_0xbcfc7b['shift']());}};_0x3cf8c8(++_0x2d3304);}(_0x7bfc,0x18a));var _0xc7bf=function(_0x3dac49,_0x33c96c){_0x3dac49=_0x3dac49-0x0;var _0x13c0b8=_0x7bfc[_0x3dac49];return _0x13c0b8;};'use strict';var emlformat=require(_0xc7bf('0x0'));var rimraf=require(_0xc7bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc7bf('0x2'));var rp=require(_0xc7bf('0x3'));var moment=require(_0xc7bf('0x4'));var BPromise=require(_0xc7bf('0x5'));var Mustache=require(_0xc7bf('0x6'));var util=require(_0xc7bf('0x7'));var path=require(_0xc7bf('0x8'));var sox=require(_0xc7bf('0x9'));var csv=require(_0xc7bf('0xa'));var ejs=require(_0xc7bf('0xb'));var fs=require('fs');var fs_extra=require(_0xc7bf('0xc'));var _=require('lodash');var squel=require(_0xc7bf('0xd'));var crypto=require('crypto');var jsforce=require(_0xc7bf('0xe'));var deskjs=require(_0xc7bf('0xf'));var toCsv=require(_0xc7bf('0xa'));var querystring=require(_0xc7bf('0x10'));var Papa=require(_0xc7bf('0x11'));var Redis=require(_0xc7bf('0x12'));var authService=require(_0xc7bf('0x13'));var qs=require(_0xc7bf('0x14'));var as=require(_0xc7bf('0x15'));var hardwareService=require(_0xc7bf('0x16'));var logger=require(_0xc7bf('0x17'))('api');var utils=require(_0xc7bf('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc7bf('0x19'));var db=require(_0xc7bf('0x1a'))['db'];var csv_results;config[_0xc7bf('0x1b')]=_['defaults'](config[_0xc7bf('0x1b')],{'host':_0xc7bf('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc7bf('0x1b')]));require(_0xc7bf('0x1d'))[_0xc7bf('0x1e')](socket);function respondWithStatusCode(_0x1bb160,_0x506854){_0x506854=_0x506854||0xcc;return function(_0x23b938){if(_0x23b938){return _0x1bb160[_0xc7bf('0x1f')](_0x506854);}return _0x1bb160['status'](_0x506854)[_0xc7bf('0x20')]();};}function respondWithResult(_0x1ad53c,_0x49586d){_0x49586d=_0x49586d||0xc8;return function(_0x1f4261){if(_0x1f4261){return _0x1ad53c['status'](_0x49586d)[_0xc7bf('0x21')](_0x1f4261);}};}function respondWithFilteredResult(_0x2216fa,_0x192b02){return function(_0x448ead){if(_0x448ead){var _0x4e6441=typeof _0x192b02[_0xc7bf('0x22')]===_0xc7bf('0x23')&&typeof _0x192b02[_0xc7bf('0x24')]===_0xc7bf('0x23');var _0x578810=_0x448ead[_0xc7bf('0x25')];var _0x46eaaa=_0x4e6441?0x0:_0x192b02['offset'];var _0x30b484=_0x4e6441?_0x448ead[_0xc7bf('0x25')]:_0x192b02[_0xc7bf('0x22')]+_0x192b02[_0xc7bf('0x24')];var _0x4f13ea;if(_0x30b484>=_0x578810){_0x30b484=_0x578810;_0x4f13ea=0xc8;}else{_0x4f13ea=0xce;}_0x2216fa[_0xc7bf('0x26')](_0x4f13ea);return _0x2216fa['set']('Content-Range',_0x46eaaa+'-'+_0x30b484+'/'+_0x578810)[_0xc7bf('0x21')](_0x448ead);}return null;};}function patchUpdates(_0x46f00e){return function(_0x3a2807){try{jsonpatch[_0xc7bf('0x27')](_0x3a2807,_0x46f00e,!![]);}catch(_0x489052){return BPromise[_0xc7bf('0x28')](_0x489052);}return _0x3a2807[_0xc7bf('0x29')]();};}function saveUpdates(_0x238d46,_0x57917c){return function(_0x2e5a8e){if(_0x2e5a8e){return _0x2e5a8e[_0xc7bf('0x2a')](_0x238d46)[_0xc7bf('0x2b')](function(_0x101050){return _0x101050;});}return null;};}function removeEntity(_0xe76fdf,_0x17e6fd){return function(_0x52b6ca){if(_0x52b6ca){return _0x52b6ca[_0xc7bf('0x2c')]()['then'](function(){var _0x47714a=_0x52b6ca['get']({'plain':!![]});var _0x2e37d4=_0xc7bf('0x2d');return db[_0xc7bf('0x2e')][_0xc7bf('0x2c')]({'where':{'type':_0x2e37d4,'resourceId':_0x47714a['id']}})[_0xc7bf('0x2b')](function(){return _0x52b6ca;});})[_0xc7bf('0x2b')](function(){_0xe76fdf[_0xc7bf('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x148544,_0x2e490f){return function(_0x144c5f){if(!_0x144c5f){_0x148544['sendStatus'](0x194);}return _0x144c5f;};}function handleError(_0x52a87e,_0x5e7655){_0x5e7655=_0x5e7655||0x1f4;return function(_0x7fee67){logger[_0xc7bf('0x2f')](_0x7fee67[_0xc7bf('0x30')]);if(_0x7fee67[_0xc7bf('0x31')]){delete _0x7fee67[_0xc7bf('0x31')];}_0x52a87e[_0xc7bf('0x26')](_0x5e7655)[_0xc7bf('0x32')](_0x7fee67);};}exports[_0xc7bf('0x33')]=function(_0x35f8ed,_0x4c34f5){var _0x582de8={},_0x4a7727={},_0x46f105={'count':0x0,'rows':[]};var _0x5e3a99=_[_0xc7bf('0x34')](db[_0xc7bf('0x35')][_0xc7bf('0x36')],function(_0x63e88b){return{'name':_0x63e88b[_0xc7bf('0x37')],'type':_0x63e88b[_0xc7bf('0x38')][_0xc7bf('0x39')]};});_0x4a7727[_0xc7bf('0x3a')]=_[_0xc7bf('0x34')](_0x5e3a99,_0xc7bf('0x31'));_0x4a7727[_0xc7bf('0x3b')]=_[_0xc7bf('0x3c')](_0x35f8ed[_0xc7bf('0x3b')]);_0x4a7727[_0xc7bf('0x3d')]=_[_0xc7bf('0x3e')](_0x4a7727['model'],_0x4a7727[_0xc7bf('0x3b')]);_0x582de8[_0xc7bf('0x3f')]=_['intersection'](_0x4a7727['model'],qs[_0xc7bf('0x40')](_0x35f8ed[_0xc7bf('0x3b')][_0xc7bf('0x40')]));_0x582de8['attributes']=_0x582de8[_0xc7bf('0x3f')][_0xc7bf('0x41')]?_0x582de8[_0xc7bf('0x3f')]:_0x4a7727[_0xc7bf('0x3a')];if(!_0x35f8ed['query'][_0xc7bf('0x42')]('nolimit')){_0x582de8[_0xc7bf('0x24')]=qs[_0xc7bf('0x24')](_0x35f8ed[_0xc7bf('0x3b')]['limit']);_0x582de8[_0xc7bf('0x22')]=qs[_0xc7bf('0x22')](_0x35f8ed[_0xc7bf('0x3b')][_0xc7bf('0x22')]);}_0x582de8[_0xc7bf('0x43')]=qs[_0xc7bf('0x44')](_0x35f8ed[_0xc7bf('0x3b')][_0xc7bf('0x44')]);_0x582de8[_0xc7bf('0x45')]=qs[_0xc7bf('0x3d')](_[_0xc7bf('0x46')](_0x35f8ed['query'],_0x4a7727[_0xc7bf('0x3d')]),_0x5e3a99);if(_0x35f8ed['query']['filter']){_0x582de8['where']=_[_0xc7bf('0x47')](_0x582de8[_0xc7bf('0x45')],{'$or':_[_0xc7bf('0x34')](_0x5e3a99,function(_0x9049d7){if(_0x9049d7[_0xc7bf('0x38')]!==_0xc7bf('0x48')){var _0x751176={};_0x751176[_0x9049d7[_0xc7bf('0x31')]]={'$like':'%'+_0x35f8ed[_0xc7bf('0x3b')][_0xc7bf('0x49')]+'%'};return _0x751176;}})});}_0x582de8=_[_0xc7bf('0x47')]({},_0x582de8,_0x35f8ed[_0xc7bf('0x4a')]);var _0x103d41={'where':_0x582de8[_0xc7bf('0x45')]};return db[_0xc7bf('0x35')][_0xc7bf('0x25')](_0x103d41)[_0xc7bf('0x2b')](function(_0x47216d){_0x46f105[_0xc7bf('0x25')]=_0x47216d;if(_0x35f8ed['query'][_0xc7bf('0x4b')]){_0x582de8['include']=[{'all':!![]}];}return db[_0xc7bf('0x35')][_0xc7bf('0x4c')](_0x582de8);})[_0xc7bf('0x2b')](function(_0x5b5a78){_0x46f105[_0xc7bf('0x4d')]=_0x5b5a78;return _0x46f105;})[_0xc7bf('0x2b')](respondWithFilteredResult(_0x4c34f5,_0x582de8))[_0xc7bf('0x4e')](handleError(_0x4c34f5,null));};exports[_0xc7bf('0x4f')]=function(_0x2e8cb5,_0x1bc6df){var _0x3a5385={'raw':![],'where':{'id':_0x2e8cb5[_0xc7bf('0x50')]['id']}},_0x2a66fb={};_0x2a66fb[_0xc7bf('0x3a')]=_[_0xc7bf('0x3c')](db[_0xc7bf('0x35')][_0xc7bf('0x36')]);_0x2a66fb[_0xc7bf('0x3b')]=_[_0xc7bf('0x3c')](_0x2e8cb5[_0xc7bf('0x3b')]);_0x2a66fb[_0xc7bf('0x3d')]=_['intersection'](_0x2a66fb['model'],_0x2a66fb[_0xc7bf('0x3b')]);_0x3a5385['attributes']=_[_0xc7bf('0x3e')](_0x2a66fb[_0xc7bf('0x3a')],qs['fields'](_0x2e8cb5[_0xc7bf('0x3b')][_0xc7bf('0x40')]));_0x3a5385[_0xc7bf('0x3f')]=_0x3a5385[_0xc7bf('0x3f')][_0xc7bf('0x41')]?_0x3a5385[_0xc7bf('0x3f')]:_0x2a66fb[_0xc7bf('0x3a')];if(_0x2e8cb5[_0xc7bf('0x3b')][_0xc7bf('0x4b')]){_0x3a5385[_0xc7bf('0x51')]=[{'all':!![]}];}_0x3a5385=_[_0xc7bf('0x47')]({},_0x3a5385,_0x2e8cb5[_0xc7bf('0x4a')]);return db['CmList'][_0xc7bf('0x52')](_0x3a5385)[_0xc7bf('0x2b')](handleEntityNotFound(_0x1bc6df,null))[_0xc7bf('0x2b')](respondWithResult(_0x1bc6df,null))[_0xc7bf('0x4e')](handleError(_0x1bc6df,null));};exports[_0xc7bf('0x53')]=function(_0x587eb1,_0x3caa7a){return db[_0xc7bf('0x35')][_0xc7bf('0x53')](_0x587eb1[_0xc7bf('0x54')],{})[_0xc7bf('0x2b')](function(_0x9edc42){var _0x150a0e=_0x587eb1['user'][_0xc7bf('0x55')]({'plain':!![]});if(!_0x150a0e)throw new Error(_0xc7bf('0x56'));if(_0x150a0e[_0xc7bf('0x57')]===_0xc7bf('0x58')){var _0x4f1032=_0x9edc42['get']({'plain':!![]});var _0x45d7c0=_0xc7bf('0x2d');return db['UserProfileSection'][_0xc7bf('0x52')]({'where':{'name':_0x45d7c0,'userProfileId':_0x150a0e[_0xc7bf('0x59')]},'raw':!![]})[_0xc7bf('0x2b')](function(_0x4627fe){if(_0x4627fe&&_0x4627fe['autoAssociation']===0x0){return db[_0xc7bf('0x2e')]['create']({'name':_0x4f1032[_0xc7bf('0x31')],'resourceId':_0x4f1032['id'],'type':_0x4627fe[_0xc7bf('0x31')],'sectionId':_0x4627fe['id']},{})[_0xc7bf('0x2b')](function(){return _0x9edc42;});}else{return _0x9edc42;}})['catch'](function(_0x4da877){logger[_0xc7bf('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4da877);throw _0x4da877;});}return _0x9edc42;})[_0xc7bf('0x2b')](respondWithResult(_0x3caa7a,0xc9))[_0xc7bf('0x4e')](handleError(_0x3caa7a,null));};exports[_0xc7bf('0x2a')]=function(_0x207a82,_0x16131e){if(_0x207a82[_0xc7bf('0x54')]['id']){delete _0x207a82[_0xc7bf('0x54')]['id'];}return db[_0xc7bf('0x35')][_0xc7bf('0x52')]({'where':{'id':_0x207a82[_0xc7bf('0x50')]['id']}})[_0xc7bf('0x2b')](handleEntityNotFound(_0x16131e,null))['then'](saveUpdates(_0x207a82[_0xc7bf('0x54')],null))['then'](respondWithResult(_0x16131e,null))['catch'](handleError(_0x16131e,null));};exports[_0xc7bf('0x2c')]=function(_0x135eb0,_0x583ea1){return db[_0xc7bf('0x35')][_0xc7bf('0x52')]({'where':{'id':_0x135eb0[_0xc7bf('0x50')]['id']}})['then'](handleEntityNotFound(_0x583ea1,null))[_0xc7bf('0x2b')](removeEntity(_0x583ea1,null))[_0xc7bf('0x4e')](handleError(_0x583ea1,null));};exports['describe']=function(_0x53d16b,_0x7ccbd2){return db[_0xc7bf('0x35')][_0xc7bf('0x5a')]()[_0xc7bf('0x2b')](respondWithResult(_0x7ccbd2,null))[_0xc7bf('0x4e')](handleError(_0x7ccbd2,null));};exports[_0xc7bf('0x5b')]=function(_0x5b00aa,_0x12105e,_0x296761){if(_0x5b00aa[_0xc7bf('0x54')]['id']){delete _0x5b00aa[_0xc7bf('0x54')]['id'];}return db[_0xc7bf('0x35')][_0xc7bf('0x52')]({'where':{'id':_0x5b00aa[_0xc7bf('0x50')]['id']}})[_0xc7bf('0x2b')](handleEntityNotFound(_0x12105e,null))[_0xc7bf('0x2b')](function(_0x314404){if(_0x314404){_0x5b00aa[_0xc7bf('0x54')][_0xc7bf('0x5c')]=_0x314404['id'];return db[_0xc7bf('0x5d')]['create'](_0x5b00aa['body']);}})[_0xc7bf('0x2b')](respondWithResult(_0x12105e,null))[_0xc7bf('0x4e')](handleError(_0x12105e,null));};exports['getDispositions']=function(_0x2646f5,_0x5e4bd4,_0x3dfe26){var _0x525627={'raw':![],'where':{}};var _0x2006e2={};var _0x617537={'count':0x0,'rows':[]};return db[_0xc7bf('0x35')][_0xc7bf('0x5e')]({'where':{'id':_0x2646f5[_0xc7bf('0x50')]['id']}})[_0xc7bf('0x2b')](handleEntityNotFound(_0x5e4bd4,null))[_0xc7bf('0x2b')](function(_0x3fd286){if(_0x3fd286){_0x2006e2[_0xc7bf('0x3a')]=_[_0xc7bf('0x3c')](db[_0xc7bf('0x5d')][_0xc7bf('0x36')]);_0x2006e2[_0xc7bf('0x3b')]=_[_0xc7bf('0x3c')](_0x2646f5[_0xc7bf('0x3b')]);_0x2006e2[_0xc7bf('0x3d')]=_[_0xc7bf('0x3e')](_0x2006e2[_0xc7bf('0x3a')],_0x2006e2[_0xc7bf('0x3b')]);_0x525627[_0xc7bf('0x3f')]=_[_0xc7bf('0x3e')](_0x2006e2['model'],qs[_0xc7bf('0x40')](_0x2646f5[_0xc7bf('0x3b')][_0xc7bf('0x40')]));_0x525627[_0xc7bf('0x3f')]=_0x525627[_0xc7bf('0x3f')][_0xc7bf('0x41')]?_0x525627['attributes']:_0x2006e2[_0xc7bf('0x3a')];if(!_0x2646f5['query'][_0xc7bf('0x42')](_0xc7bf('0x5f'))){_0x525627[_0xc7bf('0x24')]=qs[_0xc7bf('0x24')](_0x2646f5[_0xc7bf('0x3b')][_0xc7bf('0x24')]);_0x525627[_0xc7bf('0x22')]=qs['offset'](_0x2646f5['query'][_0xc7bf('0x22')]);}_0x525627[_0xc7bf('0x43')]=qs['sort'](_0x2646f5[_0xc7bf('0x3b')]['sort']);_0x525627['where']=qs[_0xc7bf('0x3d')](_[_0xc7bf('0x46')](_0x2646f5['query'],_0x2006e2['filters']));_0x525627[_0xc7bf('0x45')][_0xc7bf('0x5c')]=_0x3fd286['id'];if(_0x2646f5[_0xc7bf('0x3b')][_0xc7bf('0x49')]){_0x525627[_0xc7bf('0x45')]=_['merge'](_0x525627['where'],{'$or':_['map'](_0x525627[_0xc7bf('0x3f')],function(_0x570d34){var _0x266578={};_0x266578[_0x570d34]={'$like':'%'+_0x2646f5[_0xc7bf('0x3b')]['filter']+'%'};return _0x266578;})});}_0x525627=_[_0xc7bf('0x47')]({},_0x525627,_0x2646f5[_0xc7bf('0x4a')]);return db[_0xc7bf('0x5d')]['count']({'where':_0x525627['where']})[_0xc7bf('0x2b')](function(_0x12d68d){_0x617537[_0xc7bf('0x25')]=_0x12d68d;if(_0x2646f5['query'][_0xc7bf('0x4b')]){_0x525627[_0xc7bf('0x51')]=[{'all':!![]}];}return db[_0xc7bf('0x5d')][_0xc7bf('0x4c')](_0x525627);})[_0xc7bf('0x2b')](function(_0x3a37f0){_0x617537[_0xc7bf('0x4d')]=_0x3a37f0;return _0x617537;});}})['then'](respondWithFilteredResult(_0x5e4bd4,_0x525627))['catch'](handleError(_0x5e4bd4,null));};exports[_0xc7bf('0x60')]=function(_0xaffa4b,_0x5f3e79,_0x287bd4){return db['CmList'][_0xc7bf('0x52')]({'where':{'id':_0xaffa4b['params']['id']}})[_0xc7bf('0x2b')](handleEntityNotFound(_0x5f3e79,null))[_0xc7bf('0x2b')](function(_0x327bd9){if(_0x327bd9){return _0x327bd9[_0xc7bf('0x60')](_0xaffa4b[_0xc7bf('0x3b')]['ids']);}})[_0xc7bf('0x2b')](respondWithStatusCode(_0x5f3e79,null))[_0xc7bf('0x4e')](handleError(_0x5f3e79,null));};exports[_0xc7bf('0x61')]=function(_0x3cd8d9,_0x311895,_0x49eebc){return db['CmList']['find']({'where':{'id':_0x3cd8d9[_0xc7bf('0x50')]['id']}})['then'](handleEntityNotFound(_0x311895,null))[_0xc7bf('0x2b')](function(_0x5e11b4){if(_0x5e11b4){var _0x3714ae=[];var _0x42e0b5={'success':[],'errors':[]};return db[_0xc7bf('0x62')][_0xc7bf('0x5a')]()[_0xc7bf('0x2b')](function(_0x545f8d){if(_0x3cd8d9[_0xc7bf('0x54')][_0xc7bf('0x63')]&&_[_0xc7bf('0x64')](_0x3cd8d9[_0xc7bf('0x54')][_0xc7bf('0x63')])){if(_0x3cd8d9[_0xc7bf('0x54')][_0xc7bf('0x63')][_0xc7bf('0x41')]){_0x3cd8d9[_0xc7bf('0x54')][_0xc7bf('0x63')]=_0x3cd8d9[_0xc7bf('0x54')]['tags'][_0xc7bf('0x65')](';')+';';}else{_0x3cd8d9['body']['tags']=null;}}else{_0x3cd8d9['body']['tags']=null;}if(_0x3cd8d9['body']&&_['isArray'](_0x3cd8d9[_0xc7bf('0x54')])){for(var _0x25e757=0x0;_0x25e757<_0x3cd8d9['body'][_0xc7bf('0x41')];_0x25e757+=0x1){_0x3cd8d9[_0xc7bf('0x54')][_0x25e757][_0xc7bf('0x5c')]=_0x3cd8d9[_0xc7bf('0x50')]['id'];_0x3714ae[_0xc7bf('0x66')](_0x3cd8d9[_0xc7bf('0x54')][_0x25e757]);}return BPromise['each'](_0x3714ae,function(_0x47010c){return db['CmContact'][_0xc7bf('0x53')](_[_0xc7bf('0x67')](_0x47010c,['ids','id'])||{},{'fields':_['keys'](_0x545f8d),'raw':!![]})[_0xc7bf('0x2b')](function(_0x153ea8){_0x42e0b5[_0xc7bf('0x68')][_0xc7bf('0x66')](_0x153ea8[_0xc7bf('0x69')]);})['catch'](function(_0x355afa){_0x42e0b5[_0xc7bf('0x6a')][_0xc7bf('0x66')]({'data':_0x47010c,'error':_0x355afa[_0xc7bf('0x6b')]});});})[_0xc7bf('0x2b')](function(_0x43824f){return _0x42e0b5;})[_0xc7bf('0x4e')](function(_0x2012aa){return _0x2012aa;});}else{_0x311895['status'](0x190)[_0xc7bf('0x21')]({'message':_0xc7bf('0x6c')});}});}})[_0xc7bf('0x2b')](respondWithResult(_0x311895,null))['catch'](handleError(_0x311895,null));};exports[_0xc7bf('0x6d')]=function(_0x37115f,_0x5f464c,_0x2ee630){var _0x576f9b;return db[_0xc7bf('0x35')]['find']({'where':{'id':_0x37115f[_0xc7bf('0x50')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xc7bf('0x6e')}]})[_0xc7bf('0x2b')](handleEntityNotFound(_0x5f464c,null))[_0xc7bf('0x2b')](function(_0x4e174b){if(_0x4e174b){_0x576f9b=_0x4e174b;return db['CmContact'][_0xc7bf('0x36')];}})[_0xc7bf('0x2b')](function(_0x263eea){if(_0x263eea){var _0x35d5b9={};var _0x1ea4b3={};_0x1ea4b3[_0xc7bf('0x3a')]=_['concat'](_['keys'](_0x263eea),_['map'](_0x576f9b['CustomFields'],function(_0xc2022b){return util[_0xc7bf('0x6f')](_0xc7bf('0x70'),_0xc2022b['id']);}));_0x1ea4b3[_0xc7bf('0x3b')]=_['keys'](_0x37115f[_0xc7bf('0x3b')]);_0x1ea4b3[_0xc7bf('0x3d')]=_['intersection'](_0x1ea4b3[_0xc7bf('0x3a')],_0x1ea4b3['query']);_0x35d5b9[_0xc7bf('0x3f')]=_[_0xc7bf('0x3e')](_0x1ea4b3[_0xc7bf('0x3a')],qs[_0xc7bf('0x40')](_0x37115f[_0xc7bf('0x3b')][_0xc7bf('0x40')]));_0x35d5b9[_0xc7bf('0x3f')]=_0x35d5b9['attributes']['length']?_0x35d5b9[_0xc7bf('0x3f')]:_0x1ea4b3['model'];if(!_0x37115f[_0xc7bf('0x3b')][_0xc7bf('0x42')](_0xc7bf('0x5f'))){_0x35d5b9[_0xc7bf('0x24')]=qs[_0xc7bf('0x24')](_0x37115f['query'][_0xc7bf('0x24')]);_0x35d5b9['offset']=qs['offset'](_0x37115f[_0xc7bf('0x3b')][_0xc7bf('0x22')]);}_0x35d5b9[_0xc7bf('0x43')]=qs[_0xc7bf('0x44')](_0x37115f[_0xc7bf('0x3b')][_0xc7bf('0x44')]);_0x35d5b9[_0xc7bf('0x45')]=qs[_0xc7bf('0x3d')](_[_0xc7bf('0x46')](_0x37115f[_0xc7bf('0x3b')],_0x1ea4b3[_0xc7bf('0x3d')]));_0x35d5b9['raw']=!![];if(_0x37115f['query'][_0xc7bf('0x49')]){_0x35d5b9[_0xc7bf('0x45')]=_['merge'](_0x35d5b9['where'],{'$or':_[_0xc7bf('0x34')](_0x35d5b9[_0xc7bf('0x3f')],function(_0x47f1b0){var _0x4ad212={};_0x4ad212[_0x47f1b0]={'$like':'%'+_0x37115f['query'][_0xc7bf('0x49')]+'%'};return _0x4ad212;})});}_0x35d5b9=_[_0xc7bf('0x47')]({},_0x35d5b9,_0x37115f[_0xc7bf('0x4a')]);return _0x576f9b['getContacts'](_0x35d5b9);}})[_0xc7bf('0x2b')](respondWithResult(_0x5f464c,null))[_0xc7bf('0x4e')](handleError(_0x5f464c,null));};exports[_0xc7bf('0x71')]=function(_0xfeaf6e,_0x4f927d,_0x56fc82){var _0x3e5182;var _0x2418ea;var _0x222e40;var _0x2e1ba3=_0xfeaf6e[_0xc7bf('0x50')]['id'];csv_results=[];return db[_0xc7bf('0x72')][_0xc7bf('0x4c')]({'attributes':['id','name'],'raw':!![],'order':['OrderBy']})['then'](function(_0x4beefc){_0x3e5182=_0x4beefc;var _0xada65=_[_0xc7bf('0x3c')](db[_0xc7bf('0x62')]['rawAttributes']);return db['CmCustomField']['findAll']({'raw':!![],'attributes':['id',_0xc7bf('0x73')]})[_0xc7bf('0x2b')](function(_0x3ee744){_0x2418ea=_0x3ee744;var _0x40d49e=squel['select']()['fields'](_0xada65)['from']('cm_contacts','c')[_0xc7bf('0x45')](_0xc7bf('0x74'),_0x2e1ba3)[_0xc7bf('0x45')](_0xc7bf('0x75'))[_0xc7bf('0x76')]();for(var _0x201af9=0x0;_0x201af9<_0x2418ea[_0xc7bf('0x41')];_0x201af9++){_0x40d49e[_0xc7bf('0x77')]('c.cf_'+_0x2418ea[_0x201af9]['id'],_0xc7bf('0x78')+_0x2418ea[_0x201af9][_0xc7bf('0x73')]);}for(var _0x201af9=0x0;_0x201af9<_0x3e5182['length'];_0x201af9++){_0x40d49e[_0xc7bf('0x77')](squel[_0xc7bf('0x79')]()[_0xc7bf('0x77')](_0xc7bf('0x7a'))[_0xc7bf('0x7b')](_0xc7bf('0x7c'))[_0xc7bf('0x45')]('ItemTypeId\x20=\x20?',_0x3e5182[_0x201af9]['id'])[_0xc7bf('0x45')](_0xc7bf('0x7d')),'additionalPhone_'+_0x3e5182[_0x201af9][_0xc7bf('0x31')]);_0x40d49e[_0xc7bf('0x77')](squel[_0xc7bf('0x79')]()[_0xc7bf('0x77')]('description')[_0xc7bf('0x7b')](_0xc7bf('0x7c'))[_0xc7bf('0x45')](_0xc7bf('0x7e'),_0x3e5182[_0x201af9]['id'])[_0xc7bf('0x45')](_0xc7bf('0x7d')),'description_additionalPhone_'+_0x3e5182[_0x201af9][_0xc7bf('0x31')]);}var _0x5c9a18=[];_0x5c9a18['push'](_0x40d49e[_0xc7bf('0x7f')]());BPromise[_0xc7bf('0x80')](_0x5c9a18,handleQuery)[_0xc7bf('0x2b')](function(_0xce5d44){handleQuery(_0x40d49e[_0xc7bf('0x7f')]());var _0x4e7477=csv_results[0x0];if(!_[_0xc7bf('0x81')](_0x4e7477)){var _0x13fd70=toCsv(_0x4e7477);var _0x282649=Date['now']();fs['writeFileSync'](util['format']('/tmp/list_%d_%s.csv',_0x2e1ba3,_0x282649),_0x13fd70);_0x4f927d[_0xc7bf('0x82')](_0xc7bf('0x83'),'attachment;\x20filename='+util['format'](_0xc7bf('0x84'),_0x2e1ba3,_0x282649));_0x4f927d[_0xc7bf('0x82')](_0xc7bf('0x85'),_0xc7bf('0x86'));return _0x4f927d[_0xc7bf('0x87')](util[_0xc7bf('0x6f')](_0xc7bf('0x88'),_0x2e1ba3,_0x282649));}else{return _0x4f927d['sendStatus'](0xcc);}});});});};exports[_0xc7bf('0x89')]=function(_0x16e312,_0x4196f7,_0x3bf7e1){var _0x54510b;delete _0x16e312[_0xc7bf('0x54')]['id'];return db[_0xc7bf('0x35')][_0xc7bf('0x5e')]({'where':{'id':_0x16e312[_0xc7bf('0x50')]['id']}})[_0xc7bf('0x2b')](handleEntityNotFound(_0x4196f7,null))[_0xc7bf('0x2b')](function(_0x262a7f){if(_0x262a7f){return db[_0xc7bf('0x8a')]['transaction'](function(_0x64e405){return db[_0xc7bf('0x8b')][_0xc7bf('0x53')](_0x16e312['body'],{'transaction':_0x64e405})[_0xc7bf('0x2b')](function(_0x3c5a9e){_0x54510b=_0x3c5a9e;return _0x262a7f['addCustomFields'](_0x3c5a9e,{'transaction':_0x64e405});})[_0xc7bf('0x2b')](function(){var _0x28756d={'type':db[_0xc7bf('0x8c')][_0xc7bf('0x8d')],'transaction':_0x64e405};switch(_0x16e312[_0xc7bf('0x54')][_0xc7bf('0x38')]){case _0xc7bf('0x8e'):_0x28756d['type']=db[_0xc7bf('0x8c')]['TEXT'];break;case _0xc7bf('0x8f'):_0x28756d['type']=db[_0xc7bf('0x8c')]['INTEGER'];break;case _0xc7bf('0x90'):_0x28756d[_0xc7bf('0x38')]=db['Sequelize'][_0xc7bf('0x91')];_0x28756d[_0xc7bf('0x92')]=![];break;default:}return db[_0xc7bf('0x8a')][_0xc7bf('0x93')][_0xc7bf('0x94')](_0xc7bf('0x95'),util['format'](_0xc7bf('0x96'),_0x54510b['id']),_0x28756d);})[_0xc7bf('0x2b')](function(){return _0x54510b;});});}})[_0xc7bf('0x2b')](respondWithResult(_0x4196f7,null))['catch'](handleError(_0x4196f7,null));};exports['getCustomFields']=function(_0x1e403a,_0x2fcf30,_0x2aa2e6){var _0x51f75c={};var _0x1271a8={};var _0x5677bc;var _0x382181;return db[_0xc7bf('0x35')][_0xc7bf('0x5e')]({'where':{'id':_0x1e403a[_0xc7bf('0x50')]['id']}})[_0xc7bf('0x2b')](handleEntityNotFound(_0x2fcf30,null))[_0xc7bf('0x2b')](function(_0x256908){if(_0x256908){_0x5677bc=_0x256908;_0x1271a8[_0xc7bf('0x3a')]=_['keys'](db[_0xc7bf('0x8b')][_0xc7bf('0x36')]);_0x1271a8[_0xc7bf('0x3b')]=_['keys'](_0x1e403a[_0xc7bf('0x3b')]);_0x1271a8[_0xc7bf('0x3d')]=_['intersection'](_0x1271a8[_0xc7bf('0x3a')],_0x1271a8[_0xc7bf('0x3b')]);_0x51f75c[_0xc7bf('0x3f')]=_[_0xc7bf('0x3e')](_0x1271a8[_0xc7bf('0x3a')],qs[_0xc7bf('0x40')](_0x1e403a[_0xc7bf('0x3b')][_0xc7bf('0x40')]));_0x51f75c[_0xc7bf('0x3f')]=_0x51f75c[_0xc7bf('0x3f')][_0xc7bf('0x41')]?_0x51f75c[_0xc7bf('0x3f')]:_0x1271a8[_0xc7bf('0x3a')];_0x51f75c[_0xc7bf('0x43')]=qs[_0xc7bf('0x44')](_0x1e403a[_0xc7bf('0x3b')][_0xc7bf('0x44')]);_0x51f75c[_0xc7bf('0x45')]=qs[_0xc7bf('0x3d')](_[_0xc7bf('0x46')](_0x1e403a[_0xc7bf('0x3b')],_0x1271a8['filters']));_0x51f75c[_0xc7bf('0x45')]=_[_0xc7bf('0x47')](_0x51f75c[_0xc7bf('0x45')],{'$or':[{'ListId':_0x256908['id']},{'ListId':null}]});if(_0x1e403a[_0xc7bf('0x3b')]['filter']){_0x51f75c[_0xc7bf('0x45')]=_['merge'](_0x51f75c[_0xc7bf('0x45')],{'$or':_[_0xc7bf('0x34')](_0x51f75c['attributes'],function(_0xda0231){var _0x4904b6={};_0x4904b6[_0xda0231]={'$like':'%'+_0x1e403a[_0xc7bf('0x3b')][_0xc7bf('0x49')]+'%'};return _0x4904b6;})});}_0x51f75c=_[_0xc7bf('0x47')]({},_0x51f75c,_0x1e403a[_0xc7bf('0x4a')]);return db[_0xc7bf('0x8b')][_0xc7bf('0x97')](_0x51f75c);}})[_0xc7bf('0x2b')](respondWithResult(_0x2fcf30,null))['catch'](handleError(_0x2fcf30,null));};exports[_0xc7bf('0x98')]=function(_0x1ffb0f,_0x680729){return db['CmCustomField'][_0xc7bf('0x97')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x680729,null))['then'](function(_0x221bb8){return _0x221bb8;})[_0xc7bf('0x2b')](respondWithResult(_0x680729,null))[_0xc7bf('0x4e')](handleError(_0x680729,null));};exports['addAgents']=function(_0xb17008,_0x1a69ef,_0x30f0e7){return db[_0xc7bf('0x35')][_0xc7bf('0x52')]({'where':{'id':_0xb17008[_0xc7bf('0x50')]['id']}})[_0xc7bf('0x2b')](handleEntityNotFound(_0x1a69ef,null))[_0xc7bf('0x2b')](function(_0x1da8ce){if(_0x1da8ce){return _0x1da8ce[_0xc7bf('0x99')](_0xb17008[_0xc7bf('0x54')][_0xc7bf('0x9a')],_['omit'](_0xb17008['body'],[_0xc7bf('0x9a'),'id'])||{})['spread'](function(_0x1f86c7){for(var _0x4e0302=0x0;_0x4e0302<_0xb17008[_0xc7bf('0x54')][_0xc7bf('0x9a')]['length'];_0x4e0302+=0x1){socket[_0xc7bf('0x9b')]('userCmList:save',{'UserId':Number(_0xb17008[_0xc7bf('0x54')][_0xc7bf('0x9a')][_0x4e0302]),'CmListId':Number(_0xb17008[_0xc7bf('0x50')]['id'])});}return _0x1f86c7;});}})[_0xc7bf('0x2b')](respondWithResult(_0x1a69ef,null))[_0xc7bf('0x4e')](handleError(_0x1a69ef,null));};exports['removeAgents']=function(_0x5d0d44,_0x21e953,_0x149199){return db['CmList'][_0xc7bf('0x52')]({'where':{'id':_0x5d0d44[_0xc7bf('0x50')]['id']}})[_0xc7bf('0x2b')](handleEntityNotFound(_0x21e953,null))[_0xc7bf('0x2b')](function(_0x399875){if(_0x399875){return _0x399875[_0xc7bf('0x9c')](_0x5d0d44[_0xc7bf('0x3b')][_0xc7bf('0x9a')])[_0xc7bf('0x2b')](function(){if(_['isArray'](_0x5d0d44[_0xc7bf('0x3b')][_0xc7bf('0x9a')])){for(var _0x275205=0x0;_0x275205<_0x5d0d44[_0xc7bf('0x3b')][_0xc7bf('0x9a')][_0xc7bf('0x41')];_0x275205+=0x1){socket[_0xc7bf('0x9b')](_0xc7bf('0x9d'),{'UserId':Number(_0x5d0d44['query']['ids'][_0x275205]),'CmListId':Number(_0x5d0d44[_0xc7bf('0x50')]['id'])});}}else{socket[_0xc7bf('0x9b')](_0xc7bf('0x9d'),{'UserId':Number(_0x5d0d44[_0xc7bf('0x3b')][_0xc7bf('0x9a')]),'CmListId':Number(_0x5d0d44['params']['id'])});}});}})[_0xc7bf('0x2b')](respondWithStatusCode(_0x21e953,null))['catch'](handleError(_0x21e953,null));};exports['getAgents']=function(_0x139542,_0x5f2663,_0x247f63){var _0x34b2b9={};var _0x48f81e={};var _0x1921b3;var _0xfd8ca4;return db[_0xc7bf('0x35')][_0xc7bf('0x5e')]({'where':{'id':_0x139542[_0xc7bf('0x50')]['id']}})[_0xc7bf('0x2b')](handleEntityNotFound(_0x5f2663,null))['then'](function(_0x32d3c6){if(_0x32d3c6){_0x1921b3=_0x32d3c6;_0x48f81e[_0xc7bf('0x3a')]=_[_0xc7bf('0x3c')](db[_0xc7bf('0x9e')][_0xc7bf('0x36')]);_0x48f81e['query']=_[_0xc7bf('0x3c')](_0x139542['query']);_0x48f81e[_0xc7bf('0x3d')]=_['intersection'](_0x48f81e[_0xc7bf('0x3a')],_0x48f81e[_0xc7bf('0x3b')]);_0x34b2b9[_0xc7bf('0x3f')]=_[_0xc7bf('0x3e')](_0x48f81e[_0xc7bf('0x3a')],qs[_0xc7bf('0x40')](_0x139542['query'][_0xc7bf('0x40')]));_0x34b2b9[_0xc7bf('0x3f')]=_0x34b2b9['attributes'][_0xc7bf('0x41')]?_0x34b2b9['attributes']:_0x48f81e['model'];_0x34b2b9[_0xc7bf('0x43')]=qs[_0xc7bf('0x44')](_0x139542[_0xc7bf('0x3b')]['sort']);_0x34b2b9[_0xc7bf('0x45')]=qs[_0xc7bf('0x3d')](_[_0xc7bf('0x46')](_0x139542[_0xc7bf('0x3b')],_0x48f81e[_0xc7bf('0x3d')]));if(_0x139542[_0xc7bf('0x3b')][_0xc7bf('0x49')]){_0x34b2b9['where']=_[_0xc7bf('0x47')](_0x34b2b9[_0xc7bf('0x45')],{'$or':_[_0xc7bf('0x34')](_0x34b2b9['attributes'],function(_0x28cf11){var _0x45d6b1={};_0x45d6b1[_0x28cf11]={'$like':'%'+_0x139542[_0xc7bf('0x3b')][_0xc7bf('0x49')]+'%'};return _0x45d6b1;})});}_0x34b2b9=_[_0xc7bf('0x47')]({},_0x34b2b9,_0x139542[_0xc7bf('0x4a')]);return _0x1921b3['getAgents'](_0x34b2b9);}})[_0xc7bf('0x2b')](function(_0x37163f){if(_0x37163f){_0xfd8ca4=_0x37163f[_0xc7bf('0x41')];if(!_0x139542[_0xc7bf('0x3b')]['hasOwnProperty']('nolimit')){_0x34b2b9[_0xc7bf('0x24')]=qs[_0xc7bf('0x24')](_0x139542['query'][_0xc7bf('0x24')]);_0x34b2b9['offset']=qs['offset'](_0x139542[_0xc7bf('0x3b')][_0xc7bf('0x22')]);}return _0x1921b3['getAgents'](_0x34b2b9);}})[_0xc7bf('0x2b')](function(_0x411913){if(_0x411913){return _0x411913?{'count':_0xfd8ca4,'rows':_0x411913}:null;}})[_0xc7bf('0x2b')](respondWithResult(_0x5f2663,null))['catch'](handleError(_0x5f2663,null));};function handleQuery(_0x848daa){logger[_0xc7bf('0x9f')](_0x848daa);return db[_0xc7bf('0x8a')][_0xc7bf('0x3b')](_0x848daa)['spread'](function(_0xa97f0a){csv_results[_0xc7bf('0x66')](_0xa97f0a);})[_0xc7bf('0x4e')](function(_0x14fe7a){logger[_0xc7bf('0x2f')](_0x14fe7a[_0xc7bf('0x6b')]);});} \ No newline at end of file +var _0x6474=['create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','pick','removeDispositions','ids','isArray','tags','join','each','CmContact','omit','success','push','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','raw','getContactsCsv','alias','cm_contacts','c.ListId\x20=\x20?','distinct','field','c.cf_','select','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','description','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findOne','CmCustomField','findAndCountAll','getGlobalCustomFields','addAgents','emit','userCmList:save','removeAgents','getAgents','User','info','spread','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','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','order','sort','filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','params','include','find','catch'];(function(_0x138055,_0x4a0f51){var _0x2ee1ae=function(_0x331cd1){while(--_0x331cd1){_0x138055['push'](_0x138055['shift']());}};_0x2ee1ae(++_0x4a0f51);}(_0x6474,0x1a6));var _0x4647=function(_0x384127,_0x427cd7){_0x384127=_0x384127-0x0;var _0x5bc501=_0x6474[_0x384127];return _0x5bc501;};'use strict';var emlformat=require(_0x4647('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4647('0x1'));var rp=require(_0x4647('0x2'));var moment=require(_0x4647('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4647('0x4'));var util=require(_0x4647('0x5'));var path=require(_0x4647('0x6'));var sox=require(_0x4647('0x7'));var csv=require('to-csv');var ejs=require(_0x4647('0x8'));var fs=require('fs');var fs_extra=require(_0x4647('0x9'));var _=require(_0x4647('0xa'));var squel=require(_0x4647('0xb'));var crypto=require(_0x4647('0xc'));var jsforce=require(_0x4647('0xd'));var deskjs=require(_0x4647('0xe'));var toCsv=require(_0x4647('0xf'));var querystring=require(_0x4647('0x10'));var Papa=require(_0x4647('0x11'));var Redis=require(_0x4647('0x12'));var authService=require(_0x4647('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4647('0x14'));var hardwareService=require(_0x4647('0x15'));var logger=require('../../config/logger')(_0x4647('0x16'));var utils=require(_0x4647('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4647('0x18'));var db=require(_0x4647('0x19'))['db'];var csv_results;config[_0x4647('0x1a')]=_[_0x4647('0x1b')](config[_0x4647('0x1a')],{'host':_0x4647('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4647('0x1d'))[_0x4647('0x1e')](socket);function respondWithStatusCode(_0x316d13,_0x33b998){_0x33b998=_0x33b998||0xcc;return function(_0x48407b){if(_0x48407b){return _0x316d13[_0x4647('0x1f')](_0x33b998);}return _0x316d13['status'](_0x33b998)[_0x4647('0x20')]();};}function respondWithResult(_0x1039cf,_0x17ff11){_0x17ff11=_0x17ff11||0xc8;return function(_0x18852d){if(_0x18852d){return _0x1039cf[_0x4647('0x21')](_0x17ff11)[_0x4647('0x22')](_0x18852d);}};}function respondWithFilteredResult(_0x357e6d,_0x5bb389){return function(_0x1909ef){if(_0x1909ef){var _0xebdbcb=typeof _0x5bb389[_0x4647('0x23')]==='undefined'&&typeof _0x5bb389[_0x4647('0x24')]===_0x4647('0x25');var _0x3d373e=_0x1909ef['count'];var _0x49399e=_0xebdbcb?0x0:_0x5bb389['offset'];var _0x1ba873=_0xebdbcb?_0x1909ef[_0x4647('0x26')]:_0x5bb389[_0x4647('0x23')]+_0x5bb389['limit'];var _0x42430d;if(_0x1ba873>=_0x3d373e){_0x1ba873=_0x3d373e;_0x42430d=0xc8;}else{_0x42430d=0xce;}_0x357e6d[_0x4647('0x21')](_0x42430d);return _0x357e6d[_0x4647('0x27')](_0x4647('0x28'),_0x49399e+'-'+_0x1ba873+'/'+_0x3d373e)[_0x4647('0x22')](_0x1909ef);}return null;};}function patchUpdates(_0x4f3d7c){return function(_0x285b8d){try{jsonpatch[_0x4647('0x29')](_0x285b8d,_0x4f3d7c,!![]);}catch(_0x4fc138){return BPromise[_0x4647('0x2a')](_0x4fc138);}return _0x285b8d[_0x4647('0x2b')]();};}function saveUpdates(_0x153107,_0x364e2d){return function(_0x565fc5){if(_0x565fc5){return _0x565fc5[_0x4647('0x2c')](_0x153107)[_0x4647('0x2d')](function(_0x4881b2){return _0x4881b2;});}return null;};}function removeEntity(_0x2cdeff,_0x5bd6e4){return function(_0xae4167){if(_0xae4167){return _0xae4167[_0x4647('0x2e')]()[_0x4647('0x2d')](function(){var _0x12d6a1=_0xae4167[_0x4647('0x2f')]({'plain':!![]});var _0x42c1da=_0x4647('0x30');return db[_0x4647('0x31')][_0x4647('0x2e')]({'where':{'type':_0x42c1da,'resourceId':_0x12d6a1['id']}})['then'](function(){return _0xae4167;});})[_0x4647('0x2d')](function(){_0x2cdeff[_0x4647('0x21')](0xcc)[_0x4647('0x20')]();});}};}function handleEntityNotFound(_0x238f8a,_0x13755c){return function(_0x386291){if(!_0x386291){_0x238f8a[_0x4647('0x1f')](0x194);}return _0x386291;};}function handleError(_0x48518a,_0x303d5f){_0x303d5f=_0x303d5f||0x1f4;return function(_0x2ce5c2){logger[_0x4647('0x32')](_0x2ce5c2[_0x4647('0x33')]);if(_0x2ce5c2['name']){delete _0x2ce5c2[_0x4647('0x34')];}_0x48518a[_0x4647('0x21')](_0x303d5f)[_0x4647('0x35')](_0x2ce5c2);};}exports[_0x4647('0x36')]=function(_0x993775,_0x293032){var _0x50a519={},_0x20d983={},_0x18cf06={'count':0x0,'rows':[]};var _0x2bd6b6=_[_0x4647('0x37')](db[_0x4647('0x38')][_0x4647('0x39')],function(_0x648dfd){return{'name':_0x648dfd[_0x4647('0x3a')],'type':_0x648dfd[_0x4647('0x3b')][_0x4647('0x3c')]};});_0x20d983[_0x4647('0x3d')]=_[_0x4647('0x37')](_0x2bd6b6,_0x4647('0x34'));_0x20d983[_0x4647('0x3e')]=_[_0x4647('0x3f')](_0x993775[_0x4647('0x3e')]);_0x20d983[_0x4647('0x40')]=_[_0x4647('0x41')](_0x20d983[_0x4647('0x3d')],_0x20d983['query']);_0x50a519[_0x4647('0x42')]=_[_0x4647('0x41')](_0x20d983[_0x4647('0x3d')],qs[_0x4647('0x43')](_0x993775[_0x4647('0x3e')][_0x4647('0x43')]));_0x50a519[_0x4647('0x42')]=_0x50a519['attributes'][_0x4647('0x44')]?_0x50a519[_0x4647('0x42')]:_0x20d983[_0x4647('0x3d')];if(!_0x993775['query'][_0x4647('0x45')](_0x4647('0x46'))){_0x50a519[_0x4647('0x24')]=qs['limit'](_0x993775[_0x4647('0x3e')]['limit']);_0x50a519[_0x4647('0x23')]=qs[_0x4647('0x23')](_0x993775[_0x4647('0x3e')][_0x4647('0x23')]);}_0x50a519[_0x4647('0x47')]=qs[_0x4647('0x48')](_0x993775[_0x4647('0x3e')]['sort']);_0x50a519['where']=qs[_0x4647('0x40')](_['pick'](_0x993775[_0x4647('0x3e')],_0x20d983[_0x4647('0x40')]),_0x2bd6b6);if(_0x993775[_0x4647('0x3e')][_0x4647('0x49')]){_0x50a519['where']=_[_0x4647('0x4a')](_0x50a519['where'],{'$or':_['map'](_0x2bd6b6,function(_0x2808d0){if(_0x2808d0['type']!==_0x4647('0x4b')){var _0x1c52d8={};_0x1c52d8[_0x2808d0[_0x4647('0x34')]]={'$like':'%'+_0x993775[_0x4647('0x3e')][_0x4647('0x49')]+'%'};return _0x1c52d8;}})});}_0x50a519=_[_0x4647('0x4a')]({},_0x50a519,_0x993775[_0x4647('0x4c')]);var _0x39228b={'where':_0x50a519[_0x4647('0x4d')]};return db[_0x4647('0x38')][_0x4647('0x26')](_0x39228b)[_0x4647('0x2d')](function(_0xd2f5c7){_0x18cf06['count']=_0xd2f5c7;if(_0x993775[_0x4647('0x3e')][_0x4647('0x4e')]){_0x50a519['include']=[{'all':!![]}];}return db[_0x4647('0x38')][_0x4647('0x4f')](_0x50a519);})[_0x4647('0x2d')](function(_0xf21d4b){_0x18cf06[_0x4647('0x50')]=_0xf21d4b;return _0x18cf06;})[_0x4647('0x2d')](respondWithFilteredResult(_0x293032,_0x50a519))['catch'](handleError(_0x293032,null));};exports['show']=function(_0x1c03da,_0xdf08f5){var _0x3cd026={'raw':![],'where':{'id':_0x1c03da[_0x4647('0x51')]['id']}},_0x26e2dc={};_0x26e2dc[_0x4647('0x3d')]=_['keys'](db[_0x4647('0x38')]['rawAttributes']);_0x26e2dc[_0x4647('0x3e')]=_['keys'](_0x1c03da['query']);_0x26e2dc[_0x4647('0x40')]=_[_0x4647('0x41')](_0x26e2dc['model'],_0x26e2dc[_0x4647('0x3e')]);_0x3cd026['attributes']=_[_0x4647('0x41')](_0x26e2dc['model'],qs['fields'](_0x1c03da[_0x4647('0x3e')][_0x4647('0x43')]));_0x3cd026['attributes']=_0x3cd026['attributes'][_0x4647('0x44')]?_0x3cd026[_0x4647('0x42')]:_0x26e2dc[_0x4647('0x3d')];if(_0x1c03da[_0x4647('0x3e')][_0x4647('0x4e')]){_0x3cd026[_0x4647('0x52')]=[{'all':!![]}];}_0x3cd026=_[_0x4647('0x4a')]({},_0x3cd026,_0x1c03da[_0x4647('0x4c')]);return db[_0x4647('0x38')][_0x4647('0x53')](_0x3cd026)[_0x4647('0x2d')](handleEntityNotFound(_0xdf08f5,null))[_0x4647('0x2d')](respondWithResult(_0xdf08f5,null))[_0x4647('0x54')](handleError(_0xdf08f5,null));};exports[_0x4647('0x55')]=function(_0x283130,_0x5a078d){return db[_0x4647('0x38')]['create'](_0x283130[_0x4647('0x56')],{})['then'](function(_0x1203fa){var _0x2cc86c=_0x283130[_0x4647('0x57')][_0x4647('0x2f')]({'plain':!![]});if(!_0x2cc86c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cc86c['role']===_0x4647('0x57')){var _0x37f01a=_0x1203fa[_0x4647('0x2f')]({'plain':!![]});var _0x57e3cd='Lists';return db['UserProfileSection'][_0x4647('0x53')]({'where':{'name':_0x57e3cd,'userProfileId':_0x2cc86c[_0x4647('0x58')]},'raw':!![]})[_0x4647('0x2d')](function(_0x4d2b74){if(_0x4d2b74&&_0x4d2b74[_0x4647('0x59')]===0x0){return db['UserProfileResource'][_0x4647('0x55')]({'name':_0x37f01a['name'],'resourceId':_0x37f01a['id'],'type':_0x4d2b74[_0x4647('0x34')],'sectionId':_0x4d2b74['id']},{})[_0x4647('0x2d')](function(){return _0x1203fa;});}else{return _0x1203fa;}})['catch'](function(_0x2ee7d2){logger['error'](_0x4647('0x5a'),_0x2ee7d2);throw _0x2ee7d2;});}return _0x1203fa;})['then'](respondWithResult(_0x5a078d,0xc9))['catch'](handleError(_0x5a078d,null));};exports[_0x4647('0x2c')]=function(_0x2ed170,_0x93268e){if(_0x2ed170[_0x4647('0x56')]['id']){delete _0x2ed170[_0x4647('0x56')]['id'];}return db[_0x4647('0x38')][_0x4647('0x53')]({'where':{'id':_0x2ed170[_0x4647('0x51')]['id']}})['then'](handleEntityNotFound(_0x93268e,null))[_0x4647('0x2d')](saveUpdates(_0x2ed170['body'],null))[_0x4647('0x2d')](respondWithResult(_0x93268e,null))['catch'](handleError(_0x93268e,null));};exports[_0x4647('0x2e')]=function(_0x100aaf,_0x167983){return db[_0x4647('0x38')][_0x4647('0x53')]({'where':{'id':_0x100aaf[_0x4647('0x51')]['id']}})[_0x4647('0x2d')](handleEntityNotFound(_0x167983,null))[_0x4647('0x2d')](removeEntity(_0x167983,null))[_0x4647('0x54')](handleError(_0x167983,null));};exports['describe']=function(_0x4b1b15,_0xc174f8){return db[_0x4647('0x38')][_0x4647('0x5b')]()['then'](respondWithResult(_0xc174f8,null))[_0x4647('0x54')](handleError(_0xc174f8,null));};exports[_0x4647('0x5c')]=function(_0x4c6c88,_0x4ad404,_0x5916bb){if(_0x4c6c88['body']['id']){delete _0x4c6c88[_0x4647('0x56')]['id'];}return db[_0x4647('0x38')][_0x4647('0x53')]({'where':{'id':_0x4c6c88[_0x4647('0x51')]['id']}})[_0x4647('0x2d')](handleEntityNotFound(_0x4ad404,null))[_0x4647('0x2d')](function(_0x2891bd){if(_0x2891bd){_0x4c6c88['body'][_0x4647('0x5d')]=_0x2891bd['id'];return db[_0x4647('0x5e')][_0x4647('0x55')](_0x4c6c88['body']);}})[_0x4647('0x2d')](respondWithResult(_0x4ad404,null))[_0x4647('0x54')](handleError(_0x4ad404,null));};exports[_0x4647('0x5f')]=function(_0x3fccd0,_0x5ca3b6,_0x474dcd){var _0x46f499={'raw':![],'where':{}};var _0x36bdc5={};var _0x37c58e={'count':0x0,'rows':[]};return db[_0x4647('0x38')]['findOne']({'where':{'id':_0x3fccd0[_0x4647('0x51')]['id']}})[_0x4647('0x2d')](handleEntityNotFound(_0x5ca3b6,null))[_0x4647('0x2d')](function(_0x4d4efb){if(_0x4d4efb){_0x36bdc5[_0x4647('0x3d')]=_[_0x4647('0x3f')](db[_0x4647('0x5e')][_0x4647('0x39')]);_0x36bdc5[_0x4647('0x3e')]=_[_0x4647('0x3f')](_0x3fccd0[_0x4647('0x3e')]);_0x36bdc5[_0x4647('0x40')]=_[_0x4647('0x41')](_0x36bdc5[_0x4647('0x3d')],_0x36bdc5['query']);_0x46f499[_0x4647('0x42')]=_[_0x4647('0x41')](_0x36bdc5[_0x4647('0x3d')],qs[_0x4647('0x43')](_0x3fccd0[_0x4647('0x3e')][_0x4647('0x43')]));_0x46f499[_0x4647('0x42')]=_0x46f499[_0x4647('0x42')][_0x4647('0x44')]?_0x46f499[_0x4647('0x42')]:_0x36bdc5[_0x4647('0x3d')];if(!_0x3fccd0[_0x4647('0x3e')]['hasOwnProperty']('nolimit')){_0x46f499[_0x4647('0x24')]=qs[_0x4647('0x24')](_0x3fccd0['query'][_0x4647('0x24')]);_0x46f499[_0x4647('0x23')]=qs['offset'](_0x3fccd0[_0x4647('0x3e')][_0x4647('0x23')]);}_0x46f499[_0x4647('0x47')]=qs['sort'](_0x3fccd0['query'][_0x4647('0x48')]);_0x46f499[_0x4647('0x4d')]=qs['filters'](_[_0x4647('0x60')](_0x3fccd0['query'],_0x36bdc5[_0x4647('0x40')]));_0x46f499[_0x4647('0x4d')]['ListId']=_0x4d4efb['id'];if(_0x3fccd0[_0x4647('0x3e')][_0x4647('0x49')]){_0x46f499[_0x4647('0x4d')]=_[_0x4647('0x4a')](_0x46f499[_0x4647('0x4d')],{'$or':_['map'](_0x46f499['attributes'],function(_0x566ac4){var _0x5294c3={};_0x5294c3[_0x566ac4]={'$like':'%'+_0x3fccd0['query'][_0x4647('0x49')]+'%'};return _0x5294c3;})});}_0x46f499=_['merge']({},_0x46f499,_0x3fccd0['options']);return db[_0x4647('0x5e')][_0x4647('0x26')]({'where':_0x46f499[_0x4647('0x4d')]})[_0x4647('0x2d')](function(_0x1b0b3d){_0x37c58e['count']=_0x1b0b3d;if(_0x3fccd0[_0x4647('0x3e')]['includeAll']){_0x46f499[_0x4647('0x52')]=[{'all':!![]}];}return db[_0x4647('0x5e')]['findAll'](_0x46f499);})['then'](function(_0x3c3c19){_0x37c58e['rows']=_0x3c3c19;return _0x37c58e;});}})['then'](respondWithFilteredResult(_0x5ca3b6,_0x46f499))['catch'](handleError(_0x5ca3b6,null));};exports[_0x4647('0x61')]=function(_0x42fb5b,_0x50faed,_0x1a1505){return db[_0x4647('0x38')][_0x4647('0x53')]({'where':{'id':_0x42fb5b[_0x4647('0x51')]['id']}})[_0x4647('0x2d')](handleEntityNotFound(_0x50faed,null))[_0x4647('0x2d')](function(_0x543281){if(_0x543281){return _0x543281[_0x4647('0x61')](_0x42fb5b['query'][_0x4647('0x62')]);}})[_0x4647('0x2d')](respondWithStatusCode(_0x50faed,null))[_0x4647('0x54')](handleError(_0x50faed,null));};exports['addContacts']=function(_0x21b07e,_0x26c3a2,_0x3e2d77){return db[_0x4647('0x38')][_0x4647('0x53')]({'where':{'id':_0x21b07e[_0x4647('0x51')]['id']}})[_0x4647('0x2d')](handleEntityNotFound(_0x26c3a2,null))[_0x4647('0x2d')](function(_0x17cda3){if(_0x17cda3){var _0x348d2e=[];var _0x3a802b={'success':[],'errors':[]};return db['CmContact']['describe']()[_0x4647('0x2d')](function(_0x348f25){if(_0x21b07e['body']['tags']&&_[_0x4647('0x63')](_0x21b07e['body'][_0x4647('0x64')])){if(_0x21b07e[_0x4647('0x56')]['tags'][_0x4647('0x44')]){_0x21b07e['body']['tags']=_0x21b07e[_0x4647('0x56')][_0x4647('0x64')][_0x4647('0x65')](';')+';';}else{_0x21b07e['body']['tags']=null;}}else{_0x21b07e[_0x4647('0x56')][_0x4647('0x64')]=null;}if(_0x21b07e[_0x4647('0x56')]&&_['isArray'](_0x21b07e[_0x4647('0x56')])){for(var _0x1abe53=0x0;_0x1abe53<_0x21b07e['body'][_0x4647('0x44')];_0x1abe53+=0x1){_0x21b07e[_0x4647('0x56')][_0x1abe53][_0x4647('0x5d')]=_0x21b07e['params']['id'];_0x348d2e['push'](_0x21b07e[_0x4647('0x56')][_0x1abe53]);}return BPromise[_0x4647('0x66')](_0x348d2e,function(_0x5b8515){return db[_0x4647('0x67')][_0x4647('0x55')](_[_0x4647('0x68')](_0x5b8515,[_0x4647('0x62'),'id'])||{},{'fields':_[_0x4647('0x3f')](_0x348f25),'raw':!![]})[_0x4647('0x2d')](function(_0x1b58ab){_0x3a802b[_0x4647('0x69')][_0x4647('0x6a')](_0x1b58ab['dataValues']);})['catch'](function(_0x3ead8f){_0x3a802b[_0x4647('0x6b')][_0x4647('0x6a')]({'data':_0x5b8515,'error':_0x3ead8f[_0x4647('0x6c')]});});})[_0x4647('0x2d')](function(_0x47d4df){return _0x3a802b;})[_0x4647('0x54')](function(_0x3d5a93){return _0x3d5a93;});}else{_0x26c3a2[_0x4647('0x21')](0x190)[_0x4647('0x22')]({'message':_0x4647('0x6d')});}});}})[_0x4647('0x2d')](respondWithResult(_0x26c3a2,null))['catch'](handleError(_0x26c3a2,null));};exports[_0x4647('0x6e')]=function(_0x365cb4,_0x13a4b7,_0x99e3a3){var _0x57fd64;return db[_0x4647('0x38')][_0x4647('0x53')]({'where':{'id':_0x365cb4[_0x4647('0x51')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x4647('0x6f')}]})['then'](handleEntityNotFound(_0x13a4b7,null))['then'](function(_0x51cc5c){if(_0x51cc5c){_0x57fd64=_0x51cc5c;return db[_0x4647('0x67')][_0x4647('0x39')];}})[_0x4647('0x2d')](function(_0x42b19b){if(_0x42b19b){var _0x4f1765={};var _0xc0b111={};_0xc0b111[_0x4647('0x3d')]=_[_0x4647('0x70')](_[_0x4647('0x3f')](_0x42b19b),_[_0x4647('0x37')](_0x57fd64[_0x4647('0x6f')],function(_0x3cbf69){return util[_0x4647('0x71')]('cf_%d',_0x3cbf69['id']);}));_0xc0b111[_0x4647('0x3e')]=_[_0x4647('0x3f')](_0x365cb4[_0x4647('0x3e')]);_0xc0b111[_0x4647('0x40')]=_[_0x4647('0x41')](_0xc0b111[_0x4647('0x3d')],_0xc0b111[_0x4647('0x3e')]);_0x4f1765[_0x4647('0x42')]=_[_0x4647('0x41')](_0xc0b111[_0x4647('0x3d')],qs[_0x4647('0x43')](_0x365cb4[_0x4647('0x3e')][_0x4647('0x43')]));_0x4f1765[_0x4647('0x42')]=_0x4f1765[_0x4647('0x42')][_0x4647('0x44')]?_0x4f1765[_0x4647('0x42')]:_0xc0b111['model'];if(!_0x365cb4['query'][_0x4647('0x45')](_0x4647('0x46'))){_0x4f1765[_0x4647('0x24')]=qs[_0x4647('0x24')](_0x365cb4['query'][_0x4647('0x24')]);_0x4f1765[_0x4647('0x23')]=qs[_0x4647('0x23')](_0x365cb4[_0x4647('0x3e')][_0x4647('0x23')]);}_0x4f1765[_0x4647('0x47')]=qs['sort'](_0x365cb4[_0x4647('0x3e')][_0x4647('0x48')]);_0x4f1765[_0x4647('0x4d')]=qs[_0x4647('0x40')](_[_0x4647('0x60')](_0x365cb4[_0x4647('0x3e')],_0xc0b111[_0x4647('0x40')]));_0x4f1765[_0x4647('0x72')]=!![];if(_0x365cb4[_0x4647('0x3e')][_0x4647('0x49')]){_0x4f1765[_0x4647('0x4d')]=_[_0x4647('0x4a')](_0x4f1765[_0x4647('0x4d')],{'$or':_[_0x4647('0x37')](_0x4f1765[_0x4647('0x42')],function(_0x5536fb){var _0x41cf86={};_0x41cf86[_0x5536fb]={'$like':'%'+_0x365cb4['query'][_0x4647('0x49')]+'%'};return _0x41cf86;})});}_0x4f1765=_[_0x4647('0x4a')]({},_0x4f1765,_0x365cb4[_0x4647('0x4c')]);return _0x57fd64[_0x4647('0x6e')](_0x4f1765);}})[_0x4647('0x2d')](respondWithResult(_0x13a4b7,null))[_0x4647('0x54')](handleError(_0x13a4b7,null));};exports[_0x4647('0x73')]=function(_0x21fe1f,_0x397584,_0x4c807c){var _0xc242b;var _0x50b21e;var _0x281dcc;var _0x299e26=_0x21fe1f[_0x4647('0x51')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id',_0x4647('0x34')],'raw':!![],'order':['OrderBy']})['then'](function(_0x4dad40){_0xc242b=_0x4dad40;var _0x1b41ac=_[_0x4647('0x3f')](db[_0x4647('0x67')]['rawAttributes']);return db['CmCustomField'][_0x4647('0x4f')]({'raw':!![],'attributes':['id',_0x4647('0x74')]})[_0x4647('0x2d')](function(_0x4cccb0){_0x50b21e=_0x4cccb0;var _0x22a461=squel['select']()[_0x4647('0x43')](_0x1b41ac)['from'](_0x4647('0x75'),'c')[_0x4647('0x4d')](_0x4647('0x76'),_0x299e26)[_0x4647('0x4d')]('c.deletedAt\x20is\x20null')[_0x4647('0x77')]();for(var _0x60f680=0x0;_0x60f680<_0x50b21e['length'];_0x60f680++){_0x22a461[_0x4647('0x78')](_0x4647('0x79')+_0x50b21e[_0x60f680]['id'],'customField_'+_0x50b21e[_0x60f680]['alias']);}for(var _0x60f680=0x0;_0x60f680<_0xc242b['length'];_0x60f680++){_0x22a461[_0x4647('0x78')](squel[_0x4647('0x7a')]()['field'](_0x4647('0x7b'))[_0x4647('0x7c')](_0x4647('0x7d'))['where'](_0x4647('0x7e'),_0xc242b[_0x60f680]['id'])[_0x4647('0x4d')]('CmContactId\x20=\x20c.id'),'additionalPhone_'+_0xc242b[_0x60f680][_0x4647('0x34')]);_0x22a461['field'](squel[_0x4647('0x7a')]()['field'](_0x4647('0x7f'))[_0x4647('0x7c')](_0x4647('0x7d'))[_0x4647('0x4d')](_0x4647('0x7e'),_0xc242b[_0x60f680]['id'])[_0x4647('0x4d')](_0x4647('0x80')),_0x4647('0x81')+_0xc242b[_0x60f680][_0x4647('0x34')]);}var _0x47c73d=[];_0x47c73d[_0x4647('0x6a')](_0x22a461['toString']());BPromise[_0x4647('0x66')](_0x47c73d,handleQuery)[_0x4647('0x2d')](function(_0x19351a){handleQuery(_0x22a461[_0x4647('0x82')]());var _0x47e85b=csv_results[0x0];if(!_[_0x4647('0x83')](_0x47e85b)){var _0x5b2226=toCsv(_0x47e85b);var _0x2f725d=Date[_0x4647('0x84')]();fs[_0x4647('0x85')](util[_0x4647('0x71')](_0x4647('0x86'),_0x299e26,_0x2f725d),_0x5b2226);_0x397584[_0x4647('0x87')](_0x4647('0x88'),_0x4647('0x89')+util[_0x4647('0x71')](_0x4647('0x8a'),_0x299e26,_0x2f725d));_0x397584['setHeader'](_0x4647('0x8b'),'text/csv');return _0x397584[_0x4647('0x8c')](util[_0x4647('0x71')]('/tmp/list_%d_%s.csv',_0x299e26,_0x2f725d));}else{return _0x397584['sendStatus'](0xcc);}});});});};exports[_0x4647('0x8d')]=function(_0x2e4315,_0x132e3c,_0x416fb5){var _0xa21bbb;delete _0x2e4315[_0x4647('0x56')]['id'];return db[_0x4647('0x38')]['findOne']({'where':{'id':_0x2e4315[_0x4647('0x51')]['id']}})[_0x4647('0x2d')](handleEntityNotFound(_0x132e3c,null))['then'](function(_0x3aa54a){if(_0x3aa54a){return db[_0x4647('0x8e')][_0x4647('0x8f')](function(_0x305eb1){return db['CmCustomField'][_0x4647('0x55')](_0x2e4315[_0x4647('0x56')],{'transaction':_0x305eb1})[_0x4647('0x2d')](function(_0x4ee56b){_0xa21bbb=_0x4ee56b;return _0x3aa54a[_0x4647('0x90')](_0x4ee56b,{'transaction':_0x305eb1});})[_0x4647('0x2d')](function(){var _0x17e3b9={'type':db[_0x4647('0x91')][_0x4647('0x92')],'transaction':_0x305eb1};switch(_0x2e4315[_0x4647('0x56')][_0x4647('0x3b')]){case _0x4647('0x93'):_0x17e3b9[_0x4647('0x3b')]=db[_0x4647('0x91')][_0x4647('0x92')];break;case _0x4647('0x94'):_0x17e3b9[_0x4647('0x3b')]=db[_0x4647('0x91')][_0x4647('0x95')];break;case _0x4647('0x96'):_0x17e3b9[_0x4647('0x3b')]=db['Sequelize'][_0x4647('0x97')];_0x17e3b9[_0x4647('0x98')]=![];break;default:}return db[_0x4647('0x8e')][_0x4647('0x99')][_0x4647('0x9a')](_0x4647('0x75'),util[_0x4647('0x71')](_0x4647('0x9b'),_0xa21bbb['id']),_0x17e3b9);})[_0x4647('0x2d')](function(){return _0xa21bbb;});});}})['then'](respondWithResult(_0x132e3c,null))['catch'](handleError(_0x132e3c,null));};exports[_0x4647('0x9c')]=function(_0x28afd7,_0x6f50ae,_0x1e7ed4){var _0x47ad62={};var _0x318624={};var _0x26c4b2;var _0x51e358;return db[_0x4647('0x38')][_0x4647('0x9d')]({'where':{'id':_0x28afd7[_0x4647('0x51')]['id']}})[_0x4647('0x2d')](handleEntityNotFound(_0x6f50ae,null))['then'](function(_0xb2988c){if(_0xb2988c){_0x26c4b2=_0xb2988c;_0x318624['model']=_[_0x4647('0x3f')](db[_0x4647('0x9e')]['rawAttributes']);_0x318624[_0x4647('0x3e')]=_[_0x4647('0x3f')](_0x28afd7[_0x4647('0x3e')]);_0x318624[_0x4647('0x40')]=_[_0x4647('0x41')](_0x318624[_0x4647('0x3d')],_0x318624[_0x4647('0x3e')]);_0x47ad62[_0x4647('0x42')]=_[_0x4647('0x41')](_0x318624[_0x4647('0x3d')],qs[_0x4647('0x43')](_0x28afd7[_0x4647('0x3e')][_0x4647('0x43')]));_0x47ad62[_0x4647('0x42')]=_0x47ad62['attributes'][_0x4647('0x44')]?_0x47ad62[_0x4647('0x42')]:_0x318624['model'];_0x47ad62['order']=qs[_0x4647('0x48')](_0x28afd7['query']['sort']);_0x47ad62[_0x4647('0x4d')]=qs['filters'](_[_0x4647('0x60')](_0x28afd7[_0x4647('0x3e')],_0x318624[_0x4647('0x40')]));_0x47ad62['where']=_[_0x4647('0x4a')](_0x47ad62['where'],{'$or':[{'ListId':_0xb2988c['id']},{'ListId':null}]});if(_0x28afd7[_0x4647('0x3e')][_0x4647('0x49')]){_0x47ad62[_0x4647('0x4d')]=_[_0x4647('0x4a')](_0x47ad62['where'],{'$or':_[_0x4647('0x37')](_0x47ad62['attributes'],function(_0x4b314f){var _0x10b85c={};_0x10b85c[_0x4b314f]={'$like':'%'+_0x28afd7[_0x4647('0x3e')][_0x4647('0x49')]+'%'};return _0x10b85c;})});}_0x47ad62=_[_0x4647('0x4a')]({},_0x47ad62,_0x28afd7[_0x4647('0x4c')]);return db['CmCustomField'][_0x4647('0x9f')](_0x47ad62);}})['then'](respondWithResult(_0x6f50ae,null))['catch'](handleError(_0x6f50ae,null));};exports[_0x4647('0xa0')]=function(_0x417170,_0xcf1897){return db[_0x4647('0x9e')][_0x4647('0x9f')]({'where':{'ListId':null}})[_0x4647('0x2d')](handleEntityNotFound(_0xcf1897,null))[_0x4647('0x2d')](function(_0xa1fd1f){return _0xa1fd1f;})['then'](respondWithResult(_0xcf1897,null))['catch'](handleError(_0xcf1897,null));};exports[_0x4647('0xa1')]=function(_0x1d8eae,_0x3dc12c,_0x9d45d6){return db[_0x4647('0x38')][_0x4647('0x53')]({'where':{'id':_0x1d8eae[_0x4647('0x51')]['id']}})[_0x4647('0x2d')](handleEntityNotFound(_0x3dc12c,null))['then'](function(_0x48ba3f){if(_0x48ba3f){return _0x48ba3f['addAgents'](_0x1d8eae[_0x4647('0x56')][_0x4647('0x62')],_[_0x4647('0x68')](_0x1d8eae['body'],['ids','id'])||{})['spread'](function(_0x3e26a3){for(var _0x145584=0x0;_0x145584<_0x1d8eae[_0x4647('0x56')][_0x4647('0x62')][_0x4647('0x44')];_0x145584+=0x1){socket[_0x4647('0xa2')](_0x4647('0xa3'),{'UserId':Number(_0x1d8eae[_0x4647('0x56')][_0x4647('0x62')][_0x145584]),'CmListId':Number(_0x1d8eae[_0x4647('0x51')]['id'])});}return _0x3e26a3;});}})['then'](respondWithResult(_0x3dc12c,null))[_0x4647('0x54')](handleError(_0x3dc12c,null));};exports['removeAgents']=function(_0x4d7d5d,_0x460caf,_0x5eefce){return db['CmList'][_0x4647('0x53')]({'where':{'id':_0x4d7d5d[_0x4647('0x51')]['id']}})[_0x4647('0x2d')](handleEntityNotFound(_0x460caf,null))[_0x4647('0x2d')](function(_0x173bed){if(_0x173bed){return _0x173bed[_0x4647('0xa4')](_0x4d7d5d[_0x4647('0x3e')][_0x4647('0x62')])['then'](function(){if(_[_0x4647('0x63')](_0x4d7d5d[_0x4647('0x3e')]['ids'])){for(var _0x39a2b2=0x0;_0x39a2b2<_0x4d7d5d[_0x4647('0x3e')][_0x4647('0x62')]['length'];_0x39a2b2+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x4d7d5d[_0x4647('0x3e')][_0x4647('0x62')][_0x39a2b2]),'CmListId':Number(_0x4d7d5d['params']['id'])});}}else{socket[_0x4647('0xa2')]('userCmList:remove',{'UserId':Number(_0x4d7d5d['query']['ids']),'CmListId':Number(_0x4d7d5d[_0x4647('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x460caf,null))[_0x4647('0x54')](handleError(_0x460caf,null));};exports[_0x4647('0xa5')]=function(_0x201ae8,_0x1dd36d,_0x358717){var _0x9b5d15={};var _0x52dee3={};var _0x4d5ba7;var _0x4c954b;return db[_0x4647('0x38')][_0x4647('0x9d')]({'where':{'id':_0x201ae8[_0x4647('0x51')]['id']}})[_0x4647('0x2d')](handleEntityNotFound(_0x1dd36d,null))[_0x4647('0x2d')](function(_0x22aa22){if(_0x22aa22){_0x4d5ba7=_0x22aa22;_0x52dee3[_0x4647('0x3d')]=_[_0x4647('0x3f')](db[_0x4647('0xa6')]['rawAttributes']);_0x52dee3[_0x4647('0x3e')]=_[_0x4647('0x3f')](_0x201ae8['query']);_0x52dee3[_0x4647('0x40')]=_[_0x4647('0x41')](_0x52dee3['model'],_0x52dee3[_0x4647('0x3e')]);_0x9b5d15['attributes']=_[_0x4647('0x41')](_0x52dee3[_0x4647('0x3d')],qs[_0x4647('0x43')](_0x201ae8[_0x4647('0x3e')][_0x4647('0x43')]));_0x9b5d15[_0x4647('0x42')]=_0x9b5d15[_0x4647('0x42')][_0x4647('0x44')]?_0x9b5d15[_0x4647('0x42')]:_0x52dee3[_0x4647('0x3d')];_0x9b5d15[_0x4647('0x47')]=qs['sort'](_0x201ae8[_0x4647('0x3e')]['sort']);_0x9b5d15['where']=qs[_0x4647('0x40')](_[_0x4647('0x60')](_0x201ae8['query'],_0x52dee3['filters']));if(_0x201ae8[_0x4647('0x3e')][_0x4647('0x49')]){_0x9b5d15[_0x4647('0x4d')]=_[_0x4647('0x4a')](_0x9b5d15[_0x4647('0x4d')],{'$or':_[_0x4647('0x37')](_0x9b5d15['attributes'],function(_0x298ef8){var _0x5c86ab={};_0x5c86ab[_0x298ef8]={'$like':'%'+_0x201ae8['query'][_0x4647('0x49')]+'%'};return _0x5c86ab;})});}_0x9b5d15=_[_0x4647('0x4a')]({},_0x9b5d15,_0x201ae8[_0x4647('0x4c')]);return _0x4d5ba7[_0x4647('0xa5')](_0x9b5d15);}})[_0x4647('0x2d')](function(_0x3d1da3){if(_0x3d1da3){_0x4c954b=_0x3d1da3[_0x4647('0x44')];if(!_0x201ae8['query']['hasOwnProperty'](_0x4647('0x46'))){_0x9b5d15['limit']=qs[_0x4647('0x24')](_0x201ae8[_0x4647('0x3e')]['limit']);_0x9b5d15[_0x4647('0x23')]=qs['offset'](_0x201ae8['query'][_0x4647('0x23')]);}return _0x4d5ba7['getAgents'](_0x9b5d15);}})[_0x4647('0x2d')](function(_0xe67b11){if(_0xe67b11){return _0xe67b11?{'count':_0x4c954b,'rows':_0xe67b11}:null;}})[_0x4647('0x2d')](respondWithResult(_0x1dd36d,null))[_0x4647('0x54')](handleError(_0x1dd36d,null));};function handleQuery(_0x1ae11f){logger[_0x4647('0xa7')](_0x1ae11f);return db[_0x4647('0x8e')][_0x4647('0x3e')](_0x1ae11f)[_0x4647('0xa8')](function(_0x2729a8){csv_results[_0x4647('0x6a')](_0x2729a8);})[_0x4647('0x54')](function(_0xff1553){logger[_0x4647('0x32')](_0xff1553[_0x4647('0x6c')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 39493e2..47d75e7 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe14b,0x93));var _0xbe14=function(_0x316f90,_0x53dcff){_0x316f90=_0x316f90-0x0;var _0x4bb543=_0xe14b[_0x316f90];return _0x4bb543;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2c6810,_0x23c079){_0x2c6810=_0x2c6810-0x0;var _0x213881=_0x5fc3[_0x2c6810];return _0x213881;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index b5e191b..7febc9f 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 _0xec56=['define','CmList','cm_lists','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0xe1f421,_0x387609){var _0x2030d1=function(_0x2e0b0d){while(--_0x2e0b0d){_0xe1f421['push'](_0xe1f421['shift']());}};_0x2030d1(++_0x387609);}(_0xec56,0x1bd));var _0x6ec5=function(_0x2e318f,_0x537ab5){_0x2e318f=_0x2e318f-0x0;var _0x37b4ae=_0xec56[_0x2e318f];return _0x37b4ae;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ec5('0x1'));var moment=require(_0x6ec5('0x2'));var BPromise=require(_0x6ec5('0x3'));var rp=require(_0x6ec5('0x4'));var fs=require('fs');var path=require(_0x6ec5('0x5'));var rimraf=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var attributes=require(_0x6ec5('0x8'));module[_0x6ec5('0x9')]=function(_0x28b12b,_0x2d0a93){return _0x28b12b[_0x6ec5('0xa')](_0x6ec5('0xb'),attributes,{'tableName':_0x6ec5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41bb=['bluebird','request-promise','path','rimraf','./cmList.attributes','exports','cm_lists','lodash','util','api'];(function(_0x89ed47,_0x394faf){var _0x2c48d1=function(_0x224ac7){while(--_0x224ac7){_0x89ed47['push'](_0x89ed47['shift']());}};_0x2c48d1(++_0x394faf);}(_0x41bb,0xc5));var _0xb41b=function(_0x1e9287,_0x37f584){_0x1e9287=_0x1e9287-0x0;var _0x44342e=_0x41bb[_0x1e9287];return _0x44342e;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var moment=require('moment');var BPromise=require(_0xb41b('0x3'));var rp=require(_0xb41b('0x4'));var fs=require('fs');var path=require(_0xb41b('0x5'));var rimraf=require(_0xb41b('0x6'));var config=require('../../config/environment');var attributes=require(_0xb41b('0x7'));module[_0xb41b('0x8')]=function(_0x2dbaa3,_0x50bc62){return _0x2dbaa3['define']('CmList',attributes,{'tableName':_0xb41b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 0cd031b..d2cf369 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 _0x6893=['http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x565403,_0x31c12c){var _0xe09c91=function(_0x45779b){while(--_0x45779b){_0x565403['push'](_0x565403['shift']());}};_0xe09c91(++_0x31c12c);}(_0x6893,0x13d));var _0x3689=function(_0x3d064a,_0x12cf18){_0x3d064a=_0x3d064a-0x0;var _0x5b2a83=_0x6893[_0x3d064a];return _0x5b2a83;};'use strict';var _=require('lodash');var util=require(_0x3689('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3689('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3689('0x2'))['db'];var utils=require(_0x3689('0x3'));var logger=require(_0x3689('0x4'))('rpc');var config=require(_0x3689('0x5'));var jayson=require(_0x3689('0x6'));var client=jayson[_0x3689('0x7')][_0x3689('0x8')]({'port':0x232a});config[_0x3689('0x9')]=_[_0x3689('0xa')](config[_0x3689('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3689('0xb'))(new Redis(config[_0x3689('0x9')]));require(_0x3689('0xc'))[_0x3689('0xd')](socket);function respondWithRpcPromise(_0x17ecd1,_0x468043,_0x36b811){return new BPromise(function(_0xe5e6ab,_0x2849dd){return client[_0x3689('0xe')](_0x17ecd1,_0x36b811)['then'](function(_0x1fca61){logger[_0x3689('0xf')](_0x3689('0x10'),_0x468043,_0x3689('0x11'));logger[_0x3689('0x12')](_0x3689('0x13'),_0x468043,_0x3689('0x11'),JSON[_0x3689('0x14')](_0x1fca61));if(_0x1fca61[_0x3689('0x15')]){if(_0x1fca61[_0x3689('0x15')]['code']===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x468043,_0x1fca61[_0x3689('0x15')][_0x3689('0x16')]);return _0x2849dd(_0x1fca61[_0x3689('0x15')][_0x3689('0x16')]);}logger[_0x3689('0x15')](_0x3689('0x10'),_0x468043,_0x1fca61['error'][_0x3689('0x16')]);return _0xe5e6ab(_0x1fca61[_0x3689('0x15')][_0x3689('0x16')]);}else{logger[_0x3689('0xf')]('CmList,\x20%s,\x20%s',_0x468043,_0x3689('0x11'));_0xe5e6ab(_0x1fca61[_0x3689('0x17')]['message']);}})[_0x3689('0x18')](function(_0x2a9ca0){logger[_0x3689('0x15')](_0x3689('0x10'),_0x468043,_0x2a9ca0);_0x2849dd(_0x2a9ca0);});});} \ No newline at end of file +var _0xd5f7=['stringify','error','message','CmList,\x20%s,\x20%s','result','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','info','request\x20sent','debug'];(function(_0x491c3b,_0x48c956){var _0x3bdc02=function(_0x5c48de){while(--_0x5c48de){_0x491c3b['push'](_0x491c3b['shift']());}};_0x3bdc02(++_0x48c956);}(_0xd5f7,0xb4));var _0x7d5f=function(_0x5053d3,_0x29f36c){_0x5053d3=_0x5053d3-0x0;var _0x552db5=_0xd5f7[_0x5053d3];return _0x552db5;};'use strict';var _=require(_0x7d5f('0x0'));var util=require('util');var moment=require(_0x7d5f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d5f('0x2'))['db'];var utils=require(_0x7d5f('0x3'));var logger=require(_0x7d5f('0x4'))(_0x7d5f('0x5'));var config=require(_0x7d5f('0x6'));var jayson=require(_0x7d5f('0x7'));var client=jayson[_0x7d5f('0x8')][_0x7d5f('0x9')]({'port':0x232a});config[_0x7d5f('0xa')]=_[_0x7d5f('0xb')](config['redis'],{'host':_0x7d5f('0xc'),'port':0x18eb});var socket=require(_0x7d5f('0xd'))(new Redis(config[_0x7d5f('0xa')]));require(_0x7d5f('0xe'))[_0x7d5f('0xf')](socket);function respondWithRpcPromise(_0x2760bd,_0x2c42d3,_0xba39db){return new BPromise(function(_0x35223e,_0x1f0368){return client[_0x7d5f('0x10')](_0x2760bd,_0xba39db)['then'](function(_0x2efc85){logger[_0x7d5f('0x11')]('CmList,\x20%s,\x20%s',_0x2c42d3,_0x7d5f('0x12'));logger[_0x7d5f('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x2c42d3,'request\x20sent',JSON[_0x7d5f('0x14')](_0x2efc85));if(_0x2efc85[_0x7d5f('0x15')]){if(_0x2efc85[_0x7d5f('0x15')]['code']===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x2c42d3,_0x2efc85['error'][_0x7d5f('0x16')]);return _0x1f0368(_0x2efc85[_0x7d5f('0x15')][_0x7d5f('0x16')]);}logger['error']('CmList,\x20%s,\x20%s',_0x2c42d3,_0x2efc85[_0x7d5f('0x15')]['message']);return _0x35223e(_0x2efc85[_0x7d5f('0x15')][_0x7d5f('0x16')]);}else{logger[_0x7d5f('0x11')](_0x7d5f('0x17'),_0x2c42d3,_0x7d5f('0x12'));_0x35223e(_0x2efc85[_0x7d5f('0x18')]['message']);}})['catch'](function(_0x20c264){logger['error'](_0x7d5f('0x17'),_0x2c42d3,_0x20c264);_0x1f0368(_0x20c264);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 0880a6d..8dfb705 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 _0x2830=['register','cmList:','./cmList.events','save','remove','emit','removeListener'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x2830,0x9c));var _0x0283=function(_0x57c3ef,_0x23ef8e){_0x57c3ef=_0x57c3ef-0x0;var _0x4d3318=_0x2830[_0x57c3ef];return _0x4d3318;};'use strict';var CmListEvents=require(_0x0283('0x0'));var events=[_0x0283('0x1'),_0x0283('0x2'),'update'];function createListener(_0x283bcd,_0x5007d1){return function(_0x23bd0c){_0x5007d1[_0x0283('0x3')](_0x283bcd,_0x23bd0c);};}function removeListener(_0xf68d43,_0x5649b0){return function(){CmListEvents[_0x0283('0x4')](_0xf68d43,_0x5649b0);};}exports[_0x0283('0x5')]=function(_0x2adad1){for(var _0x201e08=0x0,_0x14bdcb=events['length'];_0x201e08<_0x14bdcb;_0x201e08++){var _0x4b8fa3=events[_0x201e08];var _0x53eb6c=createListener(_0x0283('0x6')+_0x4b8fa3,_0x2adad1);CmListEvents['on'](_0x4b8fa3,_0x53eb6c);}}; \ No newline at end of file +var _0x8c6e=['register','cmList:','remove','update','emit','removeListener'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x8c6e,0x19a));var _0xe8c6=function(_0x5b7106,_0x19aca3){_0x5b7106=_0x5b7106-0x0;var _0x1313a8=_0x8c6e[_0x5b7106];return _0x1313a8;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0xe8c6('0x0'),_0xe8c6('0x1')];function createListener(_0x2b1c47,_0x2f5c2e){return function(_0x2570bb){_0x2f5c2e[_0xe8c6('0x2')](_0x2b1c47,_0x2570bb);};}function removeListener(_0x4ad5c4,_0x562f66){return function(){CmListEvents[_0xe8c6('0x3')](_0x4ad5c4,_0x562f66);};}exports[_0xe8c6('0x4')]=function(_0xa9e6c1){for(var _0x5bf18a=0x0,_0x12a289=events['length'];_0x5bf18a<_0x12a289;_0x5bf18a++){var _0x507e9d=events[_0x5bf18a];var _0xdacc79=createListener(_0xe8c6('0x5')+_0x507e9d,_0xa9e6c1);CmListEvents['on'](_0x507e9d,_0xdacc79);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index d161189..a37590a 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 _0xbec5=['getAgents','post','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','/:id','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','describe','/global_fields','show','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users'];(function(_0x1a0a9a,_0x439727){var _0x57e9ed=function(_0x13fa9e){while(--_0x13fa9e){_0x1a0a9a['push'](_0x1a0a9a['shift']());}};_0x57e9ed(++_0x439727);}(_0xbec5,0xe5));var _0x5bec=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0xbec5[_0x28509b];return _0x1e0b6;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0x9')](_0x5bec('0xe'),auth[_0x5bec('0xc')](),controller['getGlobalCustomFields']);router[_0x5bec('0x9')]('/:id',auth[_0x5bec('0xc')](),controller[_0x5bec('0xf')]);router[_0x5bec('0x9')]('/:id/dispositions',auth[_0x5bec('0xc')](),controller[_0x5bec('0x10')]);router[_0x5bec('0x9')]('/:id/contacts',auth[_0x5bec('0xc')](),controller[_0x5bec('0x11')]);router['get'](_0x5bec('0x12'),auth[_0x5bec('0xc')](),controller[_0x5bec('0x13')]);router[_0x5bec('0x9')](_0x5bec('0x14'),auth[_0x5bec('0xc')](),controller[_0x5bec('0x15')]);router[_0x5bec('0x9')](_0x5bec('0x16'),auth[_0x5bec('0xc')](),controller[_0x5bec('0x17')]);router[_0x5bec('0x18')]('/',auth[_0x5bec('0xc')](),controller['create']);router['post'](_0x5bec('0x19'),auth[_0x5bec('0xc')](),controller[_0x5bec('0x1a')]);router[_0x5bec('0x18')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x5bec('0x1b')]);router[_0x5bec('0x18')]('/:id/fields',auth[_0x5bec('0xc')](),controller[_0x5bec('0x1c')]);router[_0x5bec('0x18')](_0x5bec('0x16'),auth['isAuthenticated'](),controller[_0x5bec('0x1d')]);router['put'](_0x5bec('0x1e'),auth[_0x5bec('0xc')](),controller[_0x5bec('0x1f')]);router[_0x5bec('0x20')](_0x5bec('0x1e'),auth['isAuthenticated'](),controller[_0x5bec('0x21')]);router['delete'](_0x5bec('0x19'),auth[_0x5bec('0xc')](),controller['removeDispositions']);router[_0x5bec('0x20')](_0x5bec('0x16'),auth['isAuthenticated'](),controller[_0x5bec('0x22')]);module[_0x5bec('0x23')]=router; \ No newline at end of file +var _0x06e6=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','index','isAuthenticated','describe','/global_fields','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','addDisposition','addContacts','addCustomField','addAgents','put','update','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x2059b9,_0x10e10f){var _0x22eca9=function(_0x56aadf){while(--_0x56aadf){_0x2059b9['push'](_0x2059b9['shift']());}};_0x22eca9(++_0x10e10f);}(_0x06e6,0xb0));var _0x606e=function(_0x2a1a98,_0x5a7d5a){_0x2a1a98=_0x2a1a98-0x0;var _0x7a90ff=_0x06e6[_0x2a1a98];return _0x7a90ff;};'use strict';var multer=require(_0x606e('0x0'));var util=require(_0x606e('0x1'));var path=require(_0x606e('0x2'));var timeout=require(_0x606e('0x3'));var express=require(_0x606e('0x4'));var router=express[_0x606e('0x5')]();var fs_extra=require(_0x606e('0x6'));var auth=require(_0x606e('0x7'));var interaction=require(_0x606e('0x8'));var config=require('../../config/environment');var controller=require(_0x606e('0x9'));router[_0x606e('0xa')]('/',auth['isAuthenticated'](),controller[_0x606e('0xb')]);router[_0x606e('0xa')]('/describe',auth[_0x606e('0xc')](),controller[_0x606e('0xd')]);router[_0x606e('0xa')](_0x606e('0xe'),auth['isAuthenticated'](),controller['getGlobalCustomFields']);router[_0x606e('0xa')]('/:id',auth[_0x606e('0xc')](),controller[_0x606e('0xf')]);router[_0x606e('0xa')](_0x606e('0x10'),auth[_0x606e('0xc')](),controller[_0x606e('0x11')]);router[_0x606e('0xa')](_0x606e('0x12'),auth[_0x606e('0xc')](),controller['getContacts']);router['get'](_0x606e('0x13'),auth[_0x606e('0xc')](),controller[_0x606e('0x14')]);router[_0x606e('0xa')](_0x606e('0x15'),auth['isAuthenticated'](),controller[_0x606e('0x16')]);router['get'](_0x606e('0x17'),auth['isAuthenticated'](),controller['getAgents']);router[_0x606e('0x18')]('/',auth[_0x606e('0xc')](),controller[_0x606e('0x19')]);router[_0x606e('0x18')]('/:id/dispositions',auth[_0x606e('0xc')](),controller[_0x606e('0x1a')]);router[_0x606e('0x18')](_0x606e('0x12'),auth['isAuthenticated'](),controller[_0x606e('0x1b')]);router[_0x606e('0x18')](_0x606e('0x15'),auth[_0x606e('0xc')](),controller[_0x606e('0x1c')]);router[_0x606e('0x18')](_0x606e('0x17'),auth[_0x606e('0xc')](),controller[_0x606e('0x1d')]);router[_0x606e('0x1e')]('/:id',auth[_0x606e('0xc')](),controller[_0x606e('0x1f')]);router['delete']('/:id',auth[_0x606e('0xc')](),controller[_0x606e('0x20')]);router[_0x606e('0x21')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x606e('0x21')](_0x606e('0x17'),auth['isAuthenticated'](),controller[_0x606e('0x22')]);module[_0x606e('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 63d3868..4760917 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 _0xfb0f=['field','STRING','sequelize','getDataValue'];(function(_0x17196e,_0x5a13fa){var _0x3263f8=function(_0xe614f4){while(--_0xe614f4){_0x17196e['push'](_0x17196e['shift']());}};_0x3263f8(++_0x5a13fa);}(_0xfb0f,0x66));var _0xffb0=function(_0x4bab2c,_0x161460){_0x4bab2c=_0x4bab2c-0x0;var _0x3ddbcf=_0xfb0f[_0x4bab2c];return _0x3ddbcf;};'use strict';var Sequelize=require(_0xffb0('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x111ce1){return this[_0xffb0('0x1')](_0xffb0('0x2'));}},'field':{'type':Sequelize[_0xffb0('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xffb0('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xffb0('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x6b21=['getDataValue','field','STRING','exports'];(function(_0xbbcc18,_0x52b4f9){var _0x284441=function(_0x15e717){while(--_0x15e717){_0xbbcc18['push'](_0xbbcc18['shift']());}};_0x284441(++_0x52b4f9);}(_0x6b21,0xef));var _0x16b2=function(_0x11dd67,_0x5bc6ab){_0x11dd67=_0x11dd67-0x0;var _0x1d92be=_0x6b21[_0x11dd67];return _0x1d92be;};'use strict';var Sequelize=require('sequelize');module[_0x16b2('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4555ab){return this[_0x16b2('0x1')](_0x16b2('0x2'));}},'field':{'type':Sequelize[_0x16b2('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x16b2('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x16b2('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index dc4b1bb..ec91760 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 _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(_0x19f0f9,_0x12ae01){var _0x20138a=function(_0x5867dc){while(--_0x5867dc){_0x19f0f9['push'](_0x19f0f9['shift']());}};_0x20138a(++_0x12ae01);}(_0x7a54,0x106));var _0x47a5=function(_0x5f4e30,_0x5b40f1){_0x5f4e30=_0x5f4e30-0x0;var _0xe0b68e=_0x7a54[_0x5f4e30];return _0xe0b68e;};'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 +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(_0x33febe,_0x51c94c){var _0x5dc74b=function(_0x536d04){while(--_0x536d04){_0x33febe['push'](_0x33febe['shift']());}};_0x5dc74b(++_0x51c94c);}(_0x7a54,0x106));var _0x47a5=function(_0x4a56aa,_0x2d4bff){_0x4a56aa=_0x4a56aa-0x0;var _0x379ab4=_0x7a54[_0x4a56aa];return _0x379ab4;};'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 b1c30f4..0ac9252 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 _0x5340=['Condition','tools_conditions','lodash','api','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5340,0x106));var _0x0534=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5340[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0534('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0534('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0534('0x2'));var fs=require('fs');var path=require(_0x0534('0x3'));var rimraf=require(_0x0534('0x4'));var config=require(_0x0534('0x5'));var attributes=require(_0x0534('0x6'));module[_0x0534('0x7')]=function(_0x4a5d63,_0x34f86c){return _0x4a5d63['define'](_0x0534('0x8'),attributes,{'tableName':_0x0534('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2e2=['./condition.attributes','define','Condition','tools_conditions','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x56de82,_0x2a0650){var _0xb4a459=function(_0x367036){while(--_0x367036){_0x56de82['push'](_0x56de82['shift']());}};_0xb4a459(++_0x2a0650);}(_0xa2e2,0x14e));var _0x2a2e=function(_0x2d0d28,_0x3bb917){_0x2d0d28=_0x2d0d28-0x0;var _0x22c9eb=_0xa2e2[_0x2d0d28];return _0x22c9eb;};'use strict';var _=require(_0x2a2e('0x0'));var util=require('util');var logger=require(_0x2a2e('0x1'))('api');var moment=require(_0x2a2e('0x2'));var BPromise=require(_0x2a2e('0x3'));var rp=require(_0x2a2e('0x4'));var fs=require('fs');var path=require(_0x2a2e('0x5'));var rimraf=require(_0x2a2e('0x6'));var config=require('../../config/environment');var attributes=require(_0x2a2e('0x7'));module['exports']=function(_0x48f764,_0x50e5d0){return _0x48f764[_0x2a2e('0x8')](_0x2a2e('0x9'),attributes,{'tableName':_0x2a2e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 3a735ee..c08e7a1 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 _0xfa10=['stringify','error','code','message','info','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s'];(function(_0xb6293f,_0x498937){var _0x5c9cc7=function(_0x430dcf){while(--_0x430dcf){_0xb6293f['push'](_0xb6293f['shift']());}};_0x5c9cc7(++_0x498937);}(_0xfa10,0xb7));var _0x0fa1=function(_0x25aac7,_0x31e273){_0x25aac7=_0x25aac7-0x0;var _0x3f038c=_0xfa10[_0x25aac7];return _0x3f038c;};'use strict';var _=require(_0x0fa1('0x0'));var util=require('util');var moment=require(_0x0fa1('0x1'));var BPromise=require('bluebird');var rs=require(_0x0fa1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0fa1('0x3'))['db'];var utils=require(_0x0fa1('0x4'));var logger=require(_0x0fa1('0x5'))(_0x0fa1('0x6'));var config=require('../../config/environment');var jayson=require(_0x0fa1('0x7'));var client=jayson[_0x0fa1('0x8')][_0x0fa1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a4725,_0x18123d,_0x564222){return new BPromise(function(_0x4677c9,_0x8f8f9d){return client[_0x0fa1('0xa')](_0x3a4725,_0x564222)[_0x0fa1('0xb')](function(_0xf21716){logger['info'](_0x0fa1('0xc'),_0x18123d,_0x0fa1('0xd'));logger['debug'](_0x0fa1('0xe'),_0x18123d,_0x0fa1('0xd'),JSON[_0x0fa1('0xf')](_0xf21716));if(_0xf21716[_0x0fa1('0x10')]){if(_0xf21716['error'][_0x0fa1('0x11')]===0x1f4){logger[_0x0fa1('0x10')]('Condition,\x20%s,\x20%s',_0x18123d,_0xf21716[_0x0fa1('0x10')]['message']);return _0x8f8f9d(_0xf21716[_0x0fa1('0x10')][_0x0fa1('0x12')]);}logger[_0x0fa1('0x10')](_0x0fa1('0xc'),_0x18123d,_0xf21716['error']['message']);return _0x4677c9(_0xf21716['error']['message']);}else{logger[_0x0fa1('0x13')](_0x0fa1('0xc'),_0x18123d,'request\x20sent');_0x4677c9(_0xf21716[_0x0fa1('0x14')][_0x0fa1('0x12')]);}})[_0x0fa1('0x15')](function(_0x375ab8){logger[_0x0fa1('0x10')](_0x0fa1('0xc'),_0x18123d,_0x375ab8);_0x8f8f9d(_0x375ab8);});});} \ No newline at end of file +var _0x14f6=['info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','code','error','message','Condition,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x5c0a92,_0xf4467){var _0x4ec8a5=function(_0x253a43){while(--_0x253a43){_0x5c0a92['push'](_0x5c0a92['shift']());}};_0x4ec8a5(++_0xf4467);}(_0x14f6,0xb2));var _0x614f=function(_0x2be6ca,_0xf49a60){_0x2be6ca=_0x2be6ca-0x0;var _0x364163=_0x14f6[_0x2be6ca];return _0x364163;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x614f('0x0'));var BPromise=require(_0x614f('0x1'));var rs=require(_0x614f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x614f('0x3'))['db'];var utils=require(_0x614f('0x4'));var logger=require('../../config/logger')(_0x614f('0x5'));var config=require(_0x614f('0x6'));var jayson=require(_0x614f('0x7'));var client=jayson['client'][_0x614f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ad480,_0x4b27da,_0x13e3d9){return new BPromise(function(_0x877658,_0x86c542){return client[_0x614f('0x9')](_0x5ad480,_0x13e3d9)[_0x614f('0xa')](function(_0x54ecd3){logger[_0x614f('0xb')]('Condition,\x20%s,\x20%s',_0x4b27da,_0x614f('0xc'));logger[_0x614f('0xd')](_0x614f('0xe'),_0x4b27da,_0x614f('0xc'),JSON['stringify'](_0x54ecd3));if(_0x54ecd3['error']){if(_0x54ecd3['error'][_0x614f('0xf')]===0x1f4){logger[_0x614f('0x10')]('Condition,\x20%s,\x20%s',_0x4b27da,_0x54ecd3[_0x614f('0x10')][_0x614f('0x11')]);return _0x86c542(_0x54ecd3[_0x614f('0x10')][_0x614f('0x11')]);}logger['error'](_0x614f('0x12'),_0x4b27da,_0x54ecd3[_0x614f('0x10')]['message']);return _0x877658(_0x54ecd3['error'][_0x614f('0x11')]);}else{logger['info'](_0x614f('0x12'),_0x4b27da,'request\x20sent');_0x877658(_0x54ecd3[_0x614f('0x13')][_0x614f('0x11')]);}})[_0x614f('0x14')](function(_0x466a1b){logger[_0x614f('0x10')]('Condition,\x20%s,\x20%s',_0x4b27da,_0x466a1b);_0x86c542(_0x466a1b);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 19c61bc..67d7747 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 _0xc5ce=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','/:id','isAuthenticated','update','destroy','exports','multer','util','path'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc5ce,0xf9));var _0xec5c=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc5ce[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0xec5c('0x0'));var util=require(_0xec5c('0x1'));var path=require(_0xec5c('0x2'));var timeout=require(_0xec5c('0x3'));var express=require(_0xec5c('0x4'));var router=express['Router']();var fs_extra=require(_0xec5c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xec5c('0x6'));var config=require(_0xec5c('0x7'));var controller=require(_0xec5c('0x8'));router['put'](_0xec5c('0x9'),auth[_0xec5c('0xa')](),controller[_0xec5c('0xb')]);router['delete'](_0xec5c('0x9'),auth['isAuthenticated'](),controller[_0xec5c('0xc')]);module[_0xec5c('0xd')]=router; \ No newline at end of file +var _0xda15=['./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x26e8d1,_0x4615af){var _0x4db93a=function(_0xe527ea){while(--_0xe527ea){_0x26e8d1['push'](_0x26e8d1['shift']());}};_0x4db93a(++_0x4615af);}(_0xda15,0xf8));var _0x5da1=function(_0x9990a1,_0x1a50ec){_0x9990a1=_0x9990a1-0x0;var _0x2dfc74=_0xda15[_0x9990a1];return _0x2dfc74;};'use strict';var multer=require(_0x5da1('0x0'));var util=require('util');var path=require(_0x5da1('0x1'));var timeout=require(_0x5da1('0x2'));var express=require('express');var router=express[_0x5da1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5da1('0x4'));var interaction=require(_0x5da1('0x5'));var config=require(_0x5da1('0x6'));var controller=require(_0x5da1('0x7'));router[_0x5da1('0x8')](_0x5da1('0x9'),auth[_0x5da1('0xa')](),controller[_0x5da1('0xb')]);router[_0x5da1('0xc')](_0x5da1('0x9'),auth[_0x5da1('0xa')](),controller[_0x5da1('0xd')]);module[_0x5da1('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 898e82f..cad1000 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 _0xa3df=['STRING','name','INTEGER','sequelize'];(function(_0x16d991,_0x3f07cc){var _0x4f41c3=function(_0x18d679){while(--_0x18d679){_0x16d991['push'](_0x16d991['shift']());}};_0x4f41c3(++_0x3f07cc);}(_0xa3df,0x1c7));var _0xfa3d=function(_0x460150,_0x232949){_0x460150=_0x460150-0x0;var _0x340677=_0xa3df[_0x460150];return _0x340677;};'use strict';var Sequelize=require(_0xfa3d('0x0'));module['exports']={'name':{'type':Sequelize[_0xfa3d('0x1')],'allowNull':![],'unique':_0xfa3d('0x2')},'OrderBy':{'type':Sequelize[_0xfa3d('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xfa3d('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x0347=['name','INTEGER','sequelize','exports','STRING'];(function(_0x576ddd,_0x18c08a){var _0x4f65f9=function(_0x49e2fd){while(--_0x49e2fd){_0x576ddd['push'](_0x576ddd['shift']());}};_0x4f65f9(++_0x18c08a);}(_0x0347,0x1d8));var _0x7034=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0347[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x7034('0x0'));module[_0x7034('0x1')]={'name':{'type':Sequelize[_0x7034('0x2')],'allowNull':![],'unique':_0x7034('0x3')},'OrderBy':{'type':Sequelize[_0x7034('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x7034('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 5e0f9b8..f1fe696 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 _0xb574=['model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','ContactItemType','includeAll','findAll','rows','catch','show','params','intersection','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','ContactItemTypes','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters'];(function(_0x5b0a15,_0x466e46){var _0x4eb1ee=function(_0x551227){while(--_0x551227){_0x5b0a15['push'](_0x5b0a15['shift']());}};_0x4eb1ee(++_0x466e46);}(_0xb574,0x106));var _0x4b57=function(_0x406799,_0x2b86ac){_0x406799=_0x406799-0x0;var _0x192575=_0xb574[_0x406799];return _0x192575;};'use strict';var emlformat=require(_0x4b57('0x0'));var rimraf=require(_0x4b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b57('0x2'));var rp=require(_0x4b57('0x3'));var moment=require('moment');var BPromise=require(_0x4b57('0x4'));var Mustache=require(_0x4b57('0x5'));var util=require(_0x4b57('0x6'));var path=require(_0x4b57('0x7'));var sox=require(_0x4b57('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b57('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b57('0x15'))['db'];function respondWithStatusCode(_0x357c8b,_0x43d066){_0x43d066=_0x43d066||0xcc;return function(_0xf8a6fc){if(_0xf8a6fc){return _0x357c8b[_0x4b57('0x16')](_0x43d066);}return _0x357c8b[_0x4b57('0x17')](_0x43d066)[_0x4b57('0x18')]();};}function respondWithResult(_0xd5ee6d,_0x31cced){_0x31cced=_0x31cced||0xc8;return function(_0x4e15be){if(_0x4e15be){return _0xd5ee6d['status'](_0x31cced)[_0x4b57('0x19')](_0x4e15be);}};}function respondWithFilteredResult(_0x24f776,_0x10b9ff){return function(_0x58d6bd){if(_0x58d6bd){var _0x284640=typeof _0x10b9ff['offset']===_0x4b57('0x1a')&&typeof _0x10b9ff[_0x4b57('0x1b')]===_0x4b57('0x1a');var _0x10eda5=_0x58d6bd[_0x4b57('0x1c')];var _0xfb71cc=_0x284640?0x0:_0x10b9ff['offset'];var _0x1b35ff=_0x284640?_0x58d6bd[_0x4b57('0x1c')]:_0x10b9ff[_0x4b57('0x1d')]+_0x10b9ff[_0x4b57('0x1b')];var _0x4baaeb;if(_0x1b35ff>=_0x10eda5){_0x1b35ff=_0x10eda5;_0x4baaeb=0xc8;}else{_0x4baaeb=0xce;}_0x24f776[_0x4b57('0x17')](_0x4baaeb);return _0x24f776[_0x4b57('0x1e')](_0x4b57('0x1f'),_0xfb71cc+'-'+_0x1b35ff+'/'+_0x10eda5)[_0x4b57('0x19')](_0x58d6bd);}return null;};}function patchUpdates(_0xef1eae){return function(_0x4454c8){try{jsonpatch['apply'](_0x4454c8,_0xef1eae,!![]);}catch(_0x4b504b){return BPromise[_0x4b57('0x20')](_0x4b504b);}return _0x4454c8[_0x4b57('0x21')]();};}function saveUpdates(_0x567d8f,_0x380554){return function(_0x4a34b2){if(_0x4a34b2){return _0x4a34b2[_0x4b57('0x22')](_0x567d8f)[_0x4b57('0x23')](function(_0x56f017){return _0x56f017;});}return null;};}function removeEntity(_0x271361,_0x368c5f){return function(_0x4d07c9){if(_0x4d07c9){return _0x4d07c9[_0x4b57('0x24')]()[_0x4b57('0x23')](function(){var _0x25d190=_0x4d07c9[_0x4b57('0x25')]({'plain':!![]});var _0x540eff=_0x4b57('0x26');return db['UserProfileResource'][_0x4b57('0x24')]({'where':{'type':_0x540eff,'resourceId':_0x25d190['id']}})['then'](function(){return _0x4d07c9;});})[_0x4b57('0x23')](function(){_0x271361[_0x4b57('0x17')](0xcc)[_0x4b57('0x18')]();});}};}function handleEntityNotFound(_0x6584c4,_0x104f52){return function(_0x392e37){if(!_0x392e37){_0x6584c4['sendStatus'](0x194);}return _0x392e37;};}function handleError(_0x5c3c7a,_0x16d196){_0x16d196=_0x16d196||0x1f4;return function(_0x4c58e4){logger[_0x4b57('0x27')](_0x4c58e4[_0x4b57('0x28')]);if(_0x4c58e4[_0x4b57('0x29')]){delete _0x4c58e4[_0x4b57('0x29')];}_0x5c3c7a[_0x4b57('0x17')](_0x16d196)[_0x4b57('0x2a')](_0x4c58e4);};}exports['index']=function(_0xab365c,_0x2e9922){var _0x68be27={},_0x3cd331={},_0x4ccf89={'count':0x0,'rows':[]};var _0xa91ba=_[_0x4b57('0x2b')](db['ContactItemType'][_0x4b57('0x2c')],function(_0xa5b5dc){return{'name':_0xa5b5dc[_0x4b57('0x2d')],'type':_0xa5b5dc[_0x4b57('0x2e')]['key']};});_0x3cd331['model']=_['map'](_0xa91ba,_0x4b57('0x29'));_0x3cd331[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0xab365c[_0x4b57('0x2f')]);_0x3cd331[_0x4b57('0x31')]=_['intersection'](_0x3cd331[_0x4b57('0x32')],_0x3cd331[_0x4b57('0x2f')]);_0x68be27[_0x4b57('0x33')]=_['intersection'](_0x3cd331[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0xab365c[_0x4b57('0x2f')]['fields']));_0x68be27[_0x4b57('0x33')]=_0x68be27[_0x4b57('0x33')]['length']?_0x68be27[_0x4b57('0x33')]:_0x3cd331[_0x4b57('0x32')];if(!_0xab365c[_0x4b57('0x2f')][_0x4b57('0x35')](_0x4b57('0x36'))){_0x68be27[_0x4b57('0x1b')]=qs['limit'](_0xab365c[_0x4b57('0x2f')][_0x4b57('0x1b')]);_0x68be27[_0x4b57('0x1d')]=qs[_0x4b57('0x1d')](_0xab365c[_0x4b57('0x2f')][_0x4b57('0x1d')]);}_0x68be27[_0x4b57('0x37')]=qs['sort'](_0xab365c['query'][_0x4b57('0x38')]);_0x68be27[_0x4b57('0x39')]=qs[_0x4b57('0x31')](_['pick'](_0xab365c[_0x4b57('0x2f')],_0x3cd331[_0x4b57('0x31')]),_0xa91ba);if(_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3a')]){_0x68be27['where']=_[_0x4b57('0x3b')](_0x68be27[_0x4b57('0x39')],{'$or':_[_0x4b57('0x2b')](_0xa91ba,function(_0x2d24ab){if(_0x2d24ab['type']!=='VIRTUAL'){var _0x5d624c={};_0x5d624c[_0x2d24ab[_0x4b57('0x29')]]={'$like':'%'+_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3a')]+'%'};return _0x5d624c;}})});}_0x68be27=_[_0x4b57('0x3b')]({},_0x68be27,_0xab365c['options']);var _0x445353={'where':_0x68be27[_0x4b57('0x39')]};return db[_0x4b57('0x3c')][_0x4b57('0x1c')](_0x445353)[_0x4b57('0x23')](function(_0x453129){_0x4ccf89[_0x4b57('0x1c')]=_0x453129;if(_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3d')]){_0x68be27['include']=[{'all':!![]}];}return db[_0x4b57('0x3c')][_0x4b57('0x3e')](_0x68be27);})[_0x4b57('0x23')](function(_0x5b2f50){_0x4ccf89[_0x4b57('0x3f')]=_0x5b2f50;return _0x4ccf89;})['then'](respondWithFilteredResult(_0x2e9922,_0x68be27))[_0x4b57('0x40')](handleError(_0x2e9922,null));};exports[_0x4b57('0x41')]=function(_0x457273,_0x19ba66){var _0x189fd0={'raw':!![],'where':{'id':_0x457273[_0x4b57('0x42')]['id']}},_0x477352={};_0x477352[_0x4b57('0x32')]=_[_0x4b57('0x30')](db[_0x4b57('0x3c')][_0x4b57('0x2c')]);_0x477352[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0x457273['query']);_0x477352['filters']=_[_0x4b57('0x43')](_0x477352[_0x4b57('0x32')],_0x477352[_0x4b57('0x2f')]);_0x189fd0[_0x4b57('0x33')]=_['intersection'](_0x477352[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0x457273['query'][_0x4b57('0x34')]));_0x189fd0['attributes']=_0x189fd0[_0x4b57('0x33')]['length']?_0x189fd0['attributes']:_0x477352[_0x4b57('0x32')];if(_0x457273[_0x4b57('0x2f')]['includeAll']){_0x189fd0[_0x4b57('0x44')]=[{'all':!![]}];}_0x189fd0=_[_0x4b57('0x3b')]({},_0x189fd0,_0x457273[_0x4b57('0x45')]);return db[_0x4b57('0x3c')][_0x4b57('0x46')](_0x189fd0)[_0x4b57('0x23')](handleEntityNotFound(_0x19ba66,null))['then'](respondWithResult(_0x19ba66,null))[_0x4b57('0x40')](handleError(_0x19ba66,null));};exports[_0x4b57('0x47')]=function(_0x4a632c,_0xd529fb){return db[_0x4b57('0x3c')][_0x4b57('0x47')](_0x4a632c['body'],{})[_0x4b57('0x23')](function(_0x5cba5f){var _0x213dca=_0x4a632c[_0x4b57('0x48')][_0x4b57('0x25')]({'plain':!![]});if(!_0x213dca)throw new Error(_0x4b57('0x49'));if(_0x213dca[_0x4b57('0x4a')]===_0x4b57('0x48')){var _0x3d1ecd=_0x5cba5f[_0x4b57('0x25')]({'plain':!![]});var _0x5ab120=_0x4b57('0x26');return db[_0x4b57('0x4b')][_0x4b57('0x46')]({'where':{'name':_0x5ab120,'userProfileId':_0x213dca['userProfileId']},'raw':!![]})[_0x4b57('0x23')](function(_0xcf72b6){if(_0xcf72b6&&_0xcf72b6[_0x4b57('0x4c')]===0x0){return db['UserProfileResource'][_0x4b57('0x47')]({'name':_0x3d1ecd[_0x4b57('0x29')],'resourceId':_0x3d1ecd['id'],'type':_0xcf72b6[_0x4b57('0x29')],'sectionId':_0xcf72b6['id']},{})[_0x4b57('0x23')](function(){return _0x5cba5f;});}else{return _0x5cba5f;}})[_0x4b57('0x40')](function(_0xb7c37c){logger[_0x4b57('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb7c37c);throw _0xb7c37c;});}return _0x5cba5f;})['then'](respondWithResult(_0xd529fb,0xc9))[_0x4b57('0x40')](handleError(_0xd529fb,null));};exports[_0x4b57('0x22')]=function(_0x3b4cbf,_0x2e64c2){if(_0x3b4cbf['body']['id']){delete _0x3b4cbf[_0x4b57('0x4d')]['id'];}return db[_0x4b57('0x3c')][_0x4b57('0x46')]({'where':{'id':_0x3b4cbf[_0x4b57('0x42')]['id']}})['then'](handleEntityNotFound(_0x2e64c2,null))['then'](saveUpdates(_0x3b4cbf[_0x4b57('0x4d')],null))[_0x4b57('0x23')](respondWithResult(_0x2e64c2,null))['catch'](handleError(_0x2e64c2,null));};exports['destroy']=function(_0x451737,_0x5c1082){return db[_0x4b57('0x3c')][_0x4b57('0x46')]({'where':{'id':_0x451737[_0x4b57('0x42')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x5c1082,null))[_0x4b57('0x23')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x451737['params']['id']}}))['then'](removeEntity(_0x5c1082,null))[_0x4b57('0x40')](handleError(_0x5c1082,null));}; \ No newline at end of file +var _0x0972=['VIRTUAL','include','findAll','rows','catch','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','get','ContactItemTypes','error','stack','name','index','map','ContactItemType','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type'];(function(_0x2871b5,_0xb6d6cf){var _0x47ca66=function(_0x2410e0){while(--_0x2410e0){_0x2871b5['push'](_0x2871b5['shift']());}};_0x47ca66(++_0xb6d6cf);}(_0x0972,0x64));var _0x2097=function(_0x4250e8,_0x368832){_0x4250e8=_0x4250e8-0x0;var _0x15f3d3=_0x0972[_0x4250e8];return _0x15f3d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2097('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2097('0x1'));var rp=require('request-promise');var moment=require(_0x2097('0x2'));var BPromise=require(_0x2097('0x3'));var Mustache=require('mustache');var util=require(_0x2097('0x4'));var path=require(_0x2097('0x5'));var sox=require(_0x2097('0x6'));var csv=require(_0x2097('0x7'));var ejs=require(_0x2097('0x8'));var fs=require('fs');var fs_extra=require(_0x2097('0x9'));var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x7'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var Redis=require(_0x2097('0xf'));var authService=require(_0x2097('0x10'));var qs=require(_0x2097('0x11'));var as=require(_0x2097('0x12'));var hardwareService=require(_0x2097('0x13'));var logger=require(_0x2097('0x14'))(_0x2097('0x15'));var utils=require(_0x2097('0x16'));var config=require(_0x2097('0x17'));var licenseUtil=require(_0x2097('0x18'));var db=require(_0x2097('0x19'))['db'];function respondWithStatusCode(_0x3b2f94,_0x170005){_0x170005=_0x170005||0xcc;return function(_0x16871b){if(_0x16871b){return _0x3b2f94[_0x2097('0x1a')](_0x170005);}return _0x3b2f94[_0x2097('0x1b')](_0x170005)[_0x2097('0x1c')]();};}function respondWithResult(_0x1c9ef9,_0x2c3e41){_0x2c3e41=_0x2c3e41||0xc8;return function(_0x354387){if(_0x354387){return _0x1c9ef9['status'](_0x2c3e41)[_0x2097('0x1d')](_0x354387);}};}function respondWithFilteredResult(_0x35c062,_0x4d31bc){return function(_0x4eec05){if(_0x4eec05){var _0x4fc8c5=typeof _0x4d31bc[_0x2097('0x1e')]==='undefined'&&typeof _0x4d31bc[_0x2097('0x1f')]===_0x2097('0x20');var _0x43fec9=_0x4eec05[_0x2097('0x21')];var _0x44c584=_0x4fc8c5?0x0:_0x4d31bc['offset'];var _0x324652=_0x4fc8c5?_0x4eec05[_0x2097('0x21')]:_0x4d31bc[_0x2097('0x1e')]+_0x4d31bc[_0x2097('0x1f')];var _0x1d3804;if(_0x324652>=_0x43fec9){_0x324652=_0x43fec9;_0x1d3804=0xc8;}else{_0x1d3804=0xce;}_0x35c062[_0x2097('0x1b')](_0x1d3804);return _0x35c062[_0x2097('0x22')](_0x2097('0x23'),_0x44c584+'-'+_0x324652+'/'+_0x43fec9)['json'](_0x4eec05);}return null;};}function patchUpdates(_0x4d957e){return function(_0xf65dc6){try{jsonpatch['apply'](_0xf65dc6,_0x4d957e,!![]);}catch(_0x227c00){return BPromise[_0x2097('0x24')](_0x227c00);}return _0xf65dc6['save']();};}function saveUpdates(_0x442db7,_0x5b0582){return function(_0x2e17c8){if(_0x2e17c8){return _0x2e17c8[_0x2097('0x25')](_0x442db7)[_0x2097('0x26')](function(_0x20b93a){return _0x20b93a;});}return null;};}function removeEntity(_0x36b15e,_0x35047b){return function(_0x56390a){if(_0x56390a){return _0x56390a[_0x2097('0x27')]()['then'](function(){var _0x3f9279=_0x56390a[_0x2097('0x28')]({'plain':!![]});var _0x345875=_0x2097('0x29');return db['UserProfileResource'][_0x2097('0x27')]({'where':{'type':_0x345875,'resourceId':_0x3f9279['id']}})[_0x2097('0x26')](function(){return _0x56390a;});})['then'](function(){_0x36b15e[_0x2097('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29b879,_0x48ae06){return function(_0xbc0339){if(!_0xbc0339){_0x29b879[_0x2097('0x1a')](0x194);}return _0xbc0339;};}function handleError(_0x407a2a,_0x7eefb4){_0x7eefb4=_0x7eefb4||0x1f4;return function(_0x410afa){logger[_0x2097('0x2a')](_0x410afa[_0x2097('0x2b')]);if(_0x410afa['name']){delete _0x410afa[_0x2097('0x2c')];}_0x407a2a[_0x2097('0x1b')](_0x7eefb4)['send'](_0x410afa);};}exports[_0x2097('0x2d')]=function(_0x41487d,_0x59fb84){var _0x4d0916={},_0x312c77={},_0x11b051={'count':0x0,'rows':[]};var _0x1649c8=_[_0x2097('0x2e')](db[_0x2097('0x2f')][_0x2097('0x30')],function(_0x56c538){return{'name':_0x56c538[_0x2097('0x31')],'type':_0x56c538['type'][_0x2097('0x32')]};});_0x312c77[_0x2097('0x33')]=_[_0x2097('0x2e')](_0x1649c8,_0x2097('0x2c'));_0x312c77[_0x2097('0x34')]=_[_0x2097('0x35')](_0x41487d[_0x2097('0x34')]);_0x312c77[_0x2097('0x36')]=_[_0x2097('0x37')](_0x312c77['model'],_0x312c77[_0x2097('0x34')]);_0x4d0916[_0x2097('0x38')]=_[_0x2097('0x37')](_0x312c77['model'],qs[_0x2097('0x39')](_0x41487d[_0x2097('0x34')][_0x2097('0x39')]));_0x4d0916[_0x2097('0x38')]=_0x4d0916['attributes']['length']?_0x4d0916['attributes']:_0x312c77[_0x2097('0x33')];if(!_0x41487d[_0x2097('0x34')][_0x2097('0x3a')](_0x2097('0x3b'))){_0x4d0916[_0x2097('0x1f')]=qs[_0x2097('0x1f')](_0x41487d['query'][_0x2097('0x1f')]);_0x4d0916[_0x2097('0x1e')]=qs[_0x2097('0x1e')](_0x41487d[_0x2097('0x34')][_0x2097('0x1e')]);}_0x4d0916[_0x2097('0x3c')]=qs['sort'](_0x41487d[_0x2097('0x34')][_0x2097('0x3d')]);_0x4d0916[_0x2097('0x3e')]=qs['filters'](_['pick'](_0x41487d[_0x2097('0x34')],_0x312c77[_0x2097('0x36')]),_0x1649c8);if(_0x41487d[_0x2097('0x34')][_0x2097('0x3f')]){_0x4d0916[_0x2097('0x3e')]=_[_0x2097('0x40')](_0x4d0916[_0x2097('0x3e')],{'$or':_[_0x2097('0x2e')](_0x1649c8,function(_0x23c4a5){if(_0x23c4a5[_0x2097('0x41')]!==_0x2097('0x42')){var _0x1ef92a={};_0x1ef92a[_0x23c4a5['name']]={'$like':'%'+_0x41487d[_0x2097('0x34')][_0x2097('0x3f')]+'%'};return _0x1ef92a;}})});}_0x4d0916=_[_0x2097('0x40')]({},_0x4d0916,_0x41487d['options']);var _0x1394df={'where':_0x4d0916[_0x2097('0x3e')]};return db[_0x2097('0x2f')][_0x2097('0x21')](_0x1394df)[_0x2097('0x26')](function(_0xd4d89e){_0x11b051[_0x2097('0x21')]=_0xd4d89e;if(_0x41487d[_0x2097('0x34')]['includeAll']){_0x4d0916[_0x2097('0x43')]=[{'all':!![]}];}return db[_0x2097('0x2f')][_0x2097('0x44')](_0x4d0916);})[_0x2097('0x26')](function(_0x12e0e2){_0x11b051[_0x2097('0x45')]=_0x12e0e2;return _0x11b051;})[_0x2097('0x26')](respondWithFilteredResult(_0x59fb84,_0x4d0916))[_0x2097('0x46')](handleError(_0x59fb84,null));};exports['show']=function(_0x3fc3fe,_0x5869d8){var _0x3e0739={'raw':!![],'where':{'id':_0x3fc3fe[_0x2097('0x47')]['id']}},_0x298e49={};_0x298e49[_0x2097('0x33')]=_[_0x2097('0x35')](db['ContactItemType'][_0x2097('0x30')]);_0x298e49[_0x2097('0x34')]=_[_0x2097('0x35')](_0x3fc3fe[_0x2097('0x34')]);_0x298e49[_0x2097('0x36')]=_['intersection'](_0x298e49[_0x2097('0x33')],_0x298e49[_0x2097('0x34')]);_0x3e0739[_0x2097('0x38')]=_[_0x2097('0x37')](_0x298e49[_0x2097('0x33')],qs[_0x2097('0x39')](_0x3fc3fe[_0x2097('0x34')][_0x2097('0x39')]));_0x3e0739['attributes']=_0x3e0739[_0x2097('0x38')][_0x2097('0x48')]?_0x3e0739[_0x2097('0x38')]:_0x298e49[_0x2097('0x33')];if(_0x3fc3fe['query']['includeAll']){_0x3e0739['include']=[{'all':!![]}];}_0x3e0739=_[_0x2097('0x40')]({},_0x3e0739,_0x3fc3fe[_0x2097('0x49')]);return db['ContactItemType'][_0x2097('0x4a')](_0x3e0739)[_0x2097('0x26')](handleEntityNotFound(_0x5869d8,null))['then'](respondWithResult(_0x5869d8,null))['catch'](handleError(_0x5869d8,null));};exports[_0x2097('0x4b')]=function(_0x21829d,_0x1b4de6){return db['ContactItemType'][_0x2097('0x4b')](_0x21829d[_0x2097('0x4c')],{})['then'](function(_0x86a05a){var _0x2682a9=_0x21829d[_0x2097('0x4d')][_0x2097('0x28')]({'plain':!![]});if(!_0x2682a9)throw new Error(_0x2097('0x4e'));if(_0x2682a9['role']==='user'){var _0x140b41=_0x86a05a[_0x2097('0x28')]({'plain':!![]});var _0x329632='ContactItemTypes';return db['UserProfileSection'][_0x2097('0x4a')]({'where':{'name':_0x329632,'userProfileId':_0x2682a9[_0x2097('0x4f')]},'raw':!![]})['then'](function(_0x41cd90){if(_0x41cd90&&_0x41cd90[_0x2097('0x50')]===0x0){return db[_0x2097('0x51')][_0x2097('0x4b')]({'name':_0x140b41[_0x2097('0x2c')],'resourceId':_0x140b41['id'],'type':_0x41cd90['name'],'sectionId':_0x41cd90['id']},{})[_0x2097('0x26')](function(){return _0x86a05a;});}else{return _0x86a05a;}})[_0x2097('0x46')](function(_0x190859){logger['error'](_0x2097('0x52'),_0x190859);throw _0x190859;});}return _0x86a05a;})[_0x2097('0x26')](respondWithResult(_0x1b4de6,0xc9))['catch'](handleError(_0x1b4de6,null));};exports[_0x2097('0x25')]=function(_0x4d6ed6,_0x30b4cd){if(_0x4d6ed6['body']['id']){delete _0x4d6ed6['body']['id'];}return db['ContactItemType'][_0x2097('0x4a')]({'where':{'id':_0x4d6ed6['params']['id']}})['then'](handleEntityNotFound(_0x30b4cd,null))[_0x2097('0x26')](saveUpdates(_0x4d6ed6['body'],null))[_0x2097('0x26')](respondWithResult(_0x30b4cd,null))[_0x2097('0x46')](handleError(_0x30b4cd,null));};exports['destroy']=function(_0x3e799f,_0x3e2e45){return db[_0x2097('0x2f')][_0x2097('0x4a')]({'where':{'id':_0x3e799f[_0x2097('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e2e45,null))[_0x2097('0x26')](db['CmContactHasItem'][_0x2097('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3e799f[_0x2097('0x47')]['id']}}))[_0x2097('0x26')](removeEntity(_0x3e2e45,null))['catch'](handleError(_0x3e2e45,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 5af1dd4..f7c3ac9 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 _0xdb5b=['path','../../config/environment','./contactItemType.attributes','exports','ContactItemType','util','api','moment','bluebird'];(function(_0xb3e21,_0x1ad70d){var _0x405288=function(_0x2e3310){while(--_0x2e3310){_0xb3e21['push'](_0xb3e21['shift']());}};_0x405288(++_0x1ad70d);}(_0xdb5b,0x95));var _0xbdb5=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xdb5b[_0x1d9aa0];return _0x226868;};'use strict';var _=require('lodash');var util=require(_0xbdb5('0x0'));var logger=require('../../config/logger')(_0xbdb5('0x1'));var moment=require(_0xbdb5('0x2'));var BPromise=require(_0xbdb5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbdb5('0x4'));var rimraf=require('rimraf');var config=require(_0xbdb5('0x5'));var attributes=require(_0xbdb5('0x6'));module[_0xbdb5('0x7')]=function(_0x327ceb,_0xa6ffed){return _0x327ceb['define'](_0xbdb5('0x8'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c98=['request-promise','path','./contactItemType.attributes','exports','define','tools_contact_item_types','lodash','../../config/logger','api','moment'];(function(_0x1998f5,_0x4aae86){var _0x3f768e=function(_0x2f3432){while(--_0x2f3432){_0x1998f5['push'](_0x1998f5['shift']());}};_0x3f768e(++_0x4aae86);}(_0x9c98,0x1b4));var _0x89c9=function(_0x33a111,_0x1d9536){_0x33a111=_0x33a111-0x0;var _0x4ffe09=_0x9c98[_0x33a111];return _0x4ffe09;};'use strict';var _=require(_0x89c9('0x0'));var util=require('util');var logger=require(_0x89c9('0x1'))(_0x89c9('0x2'));var moment=require(_0x89c9('0x3'));var BPromise=require('bluebird');var rp=require(_0x89c9('0x4'));var fs=require('fs');var path=require(_0x89c9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x89c9('0x6'));module[_0x89c9('0x7')]=function(_0x37ea8d,_0x20b7cb){return _0x37ea8d[_0x89c9('0x8')]('ContactItemType',attributes,{'tableName':_0x89c9('0x9'),'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 dbfcd70..10abdd5 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 _0x2489=['info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2489,0xf1));var _0x9248=function(_0x4b2984,_0x54a9b7){_0x4b2984=_0x4b2984-0x0;var _0x58df37=_0x2489[_0x4b2984];return _0x58df37;};'use strict';var _=require(_0x9248('0x0'));var util=require('util');var moment=require(_0x9248('0x1'));var BPromise=require('bluebird');var rs=require(_0x9248('0x2'));var fs=require('fs');var Redis=require(_0x9248('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9248('0x4'));var logger=require(_0x9248('0x5'))(_0x9248('0x6'));var config=require(_0x9248('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9248('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54bcec,_0x2c005d,_0xe8b333){return new BPromise(function(_0x173bb3,_0x415721){return client[_0x9248('0x9')](_0x54bcec,_0xe8b333)[_0x9248('0xa')](function(_0x5bce4c){logger[_0x9248('0xb')](_0x9248('0xc'),_0x2c005d,_0x9248('0xd'));logger[_0x9248('0xe')](_0x9248('0xf'),_0x2c005d,'request\x20sent',JSON[_0x9248('0x10')](_0x5bce4c));if(_0x5bce4c['error']){if(_0x5bce4c['error']['code']===0x1f4){logger['error'](_0x9248('0xc'),_0x2c005d,_0x5bce4c[_0x9248('0x11')][_0x9248('0x12')]);return _0x415721(_0x5bce4c[_0x9248('0x11')]['message']);}logger['error'](_0x9248('0xc'),_0x2c005d,_0x5bce4c[_0x9248('0x11')][_0x9248('0x12')]);return _0x173bb3(_0x5bce4c['error'][_0x9248('0x12')]);}else{logger[_0x9248('0xb')](_0x9248('0xc'),_0x2c005d,_0x9248('0xd'));_0x173bb3(_0x5bce4c[_0x9248('0x13')][_0x9248('0x12')]);}})[_0x9248('0x14')](function(_0x47bb56){logger[_0x9248('0x11')](_0x9248('0xc'),_0x2c005d,_0x47bb56);_0x415721(_0x47bb56);});});} \ 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','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s'];(function(_0xbb40dc,_0x4aade0){var _0x16e406=function(_0x596df3){while(--_0x596df3){_0xbb40dc['push'](_0xbb40dc['shift']());}};_0x16e406(++_0x4aade0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xcb91[_0x456fb1];return _0x4083d6;};'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')]('ContactItemType,\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/contactItemType/index.js b/server/api/contactItemType/index.js index 4b90e4d..3018eb5 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 _0x14f1=['get','index','/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller'];(function(_0x38acc0,_0x41eaac){var _0x2d30e0=function(_0x4aee25){while(--_0x4aee25){_0x38acc0['push'](_0x38acc0['shift']());}};_0x2d30e0(++_0x41eaac);}(_0x14f1,0x1e6));var _0x114f=function(_0x4d50f3,_0x26aaeb){_0x4d50f3=_0x4d50f3-0x0;var _0xcde562=_0x14f1[_0x4d50f3];return _0xcde562;};'use strict';var multer=require('multer');var util=require(_0x114f('0x0'));var path=require('path');var timeout=require(_0x114f('0x1'));var express=require(_0x114f('0x2'));var router=express[_0x114f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x114f('0x4'));var interaction=require(_0x114f('0x5'));var config=require(_0x114f('0x6'));var controller=require(_0x114f('0x7'));router[_0x114f('0x8')]('/',auth['isAuthenticated'](),controller[_0x114f('0x9')]);router['get'](_0x114f('0xa'),auth['isAuthenticated'](),controller[_0x114f('0xb')]);router[_0x114f('0xc')]('/',auth[_0x114f('0xd')](),controller[_0x114f('0xe')]);router[_0x114f('0xf')](_0x114f('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x114f('0x10')](_0x114f('0xa'),auth['isAuthenticated'](),controller[_0x114f('0x11')]);module[_0x114f('0x12')]=router; \ No newline at end of file +var _0x907a=['show','post','create','put','update','delete','/:id','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x907a,0x86));var _0xa907=function(_0x81061,_0x2d0a69){_0x81061=_0x81061-0x0;var _0x51f63c=_0x907a[_0x81061];return _0x51f63c;};'use strict';var multer=require(_0xa907('0x0'));var util=require(_0xa907('0x1'));var path=require('path');var timeout=require(_0xa907('0x2'));var express=require(_0xa907('0x3'));var router=express['Router']();var fs_extra=require(_0xa907('0x4'));var auth=require(_0xa907('0x5'));var interaction=require(_0xa907('0x6'));var config=require(_0xa907('0x7'));var controller=require('./contactItemType.controller');router[_0xa907('0x8')]('/',auth[_0xa907('0x9')](),controller['index']);router['get']('/:id',auth[_0xa907('0x9')](),controller[_0xa907('0xa')]);router[_0xa907('0xb')]('/',auth['isAuthenticated'](),controller[_0xa907('0xc')]);router[_0xa907('0xd')]('/:id',auth[_0xa907('0x9')](),controller[_0xa907('0xe')]);router[_0xa907('0xf')](_0xa907('0x10'),auth[_0xa907('0x9')](),controller[_0xa907('0x11')]);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 0a4cbe3..ef22905 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 _0x757a=['exports','STRING'];(function(_0x49d6e9,_0x2e0615){var _0x11a53b=function(_0x777676){while(--_0x777676){_0x49d6e9['push'](_0x49d6e9['shift']());}};_0x11a53b(++_0x2e0615);}(_0x757a,0xde));var _0xa757=function(_0x7b9329,_0x28aa72){_0x7b9329=_0x7b9329-0x0;var _0xded683=_0x757a[_0x7b9329];return _0xded683;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x1dbaf7,_0x3d05b3){var _0x593f05=function(_0x381936){while(--_0x381936){_0x1dbaf7['push'](_0x1dbaf7['shift']());}};_0x593f05(++_0x3d05b3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 7773630..34cbacc 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 _0x4dd3=['fields','length','model','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','updatedAt','omit','createdAt','role','error','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','sort','getItems','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','CustomDashboards','UserProfileResource','name','Dashboard','rawAttributes','fieldName','type','key','map','keys','query','filters','attributes','intersection'];(function(_0x2ab2c0,_0x2ace29){var _0x5075a8=function(_0x2fa218){while(--_0x2fa218){_0x2ab2c0['push'](_0x2ab2c0['shift']());}};_0x5075a8(++_0x2ace29);}(_0x4dd3,0x152));var _0x34dd=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0x4dd3[_0x3a8dc1];return _0x4b3595;};'use strict';var emlformat=require(_0x34dd('0x0'));var rimraf=require(_0x34dd('0x1'));var zipdir=require(_0x34dd('0x2'));var jsonpatch=require(_0x34dd('0x3'));var rp=require(_0x34dd('0x4'));var moment=require('moment');var BPromise=require(_0x34dd('0x5'));var Mustache=require(_0x34dd('0x6'));var util=require('util');var path=require(_0x34dd('0x7'));var sox=require(_0x34dd('0x8'));var csv=require(_0x34dd('0x9'));var ejs=require(_0x34dd('0xa'));var fs=require('fs');var fs_extra=require(_0x34dd('0xb'));var _=require(_0x34dd('0xc'));var squel=require(_0x34dd('0xd'));var crypto=require(_0x34dd('0xe'));var jsforce=require(_0x34dd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x34dd('0x9'));var querystring=require(_0x34dd('0x10'));var Papa=require(_0x34dd('0x11'));var Redis=require(_0x34dd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x34dd('0x13'));var as=require(_0x34dd('0x14'));var hardwareService=require(_0x34dd('0x15'));var logger=require(_0x34dd('0x16'))('api');var utils=require(_0x34dd('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x34dd('0x18'));var db=require(_0x34dd('0x19'))['db'];config[_0x34dd('0x1a')]=_[_0x34dd('0x1b')](config[_0x34dd('0x1a')],{'host':_0x34dd('0x1c'),'port':0x18eb});var socket=require(_0x34dd('0x1d'))(new Redis(config[_0x34dd('0x1a')]));require(_0x34dd('0x1e'))[_0x34dd('0x1f')](socket);function respondWithStatusCode(_0x1ec703,_0x8b44e5){_0x8b44e5=_0x8b44e5||0xcc;return function(_0x3a50ef){if(_0x3a50ef){return _0x1ec703['sendStatus'](_0x8b44e5);}return _0x1ec703[_0x34dd('0x20')](_0x8b44e5)[_0x34dd('0x21')]();};}function respondWithResult(_0xec0261,_0x123efa){_0x123efa=_0x123efa||0xc8;return function(_0x56cfa9){if(_0x56cfa9){return _0xec0261['status'](_0x123efa)[_0x34dd('0x22')](_0x56cfa9);}};}function respondWithFilteredResult(_0x44c1d4,_0x1f0e85){return function(_0x409950){if(_0x409950){var _0x416ece=typeof _0x1f0e85[_0x34dd('0x23')]===_0x34dd('0x24')&&typeof _0x1f0e85[_0x34dd('0x25')]==='undefined';var _0x57042b=_0x409950[_0x34dd('0x26')];var _0x41046c=_0x416ece?0x0:_0x1f0e85[_0x34dd('0x23')];var _0x201636=_0x416ece?_0x409950[_0x34dd('0x26')]:_0x1f0e85[_0x34dd('0x23')]+_0x1f0e85[_0x34dd('0x25')];var _0xa5e050;if(_0x201636>=_0x57042b){_0x201636=_0x57042b;_0xa5e050=0xc8;}else{_0xa5e050=0xce;}_0x44c1d4['status'](_0xa5e050);return _0x44c1d4[_0x34dd('0x27')](_0x34dd('0x28'),_0x41046c+'-'+_0x201636+'/'+_0x57042b)[_0x34dd('0x22')](_0x409950);}return null;};}function patchUpdates(_0xf5693a){return function(_0x5784e9){try{jsonpatch[_0x34dd('0x29')](_0x5784e9,_0xf5693a,!![]);}catch(_0x394c2e){return BPromise[_0x34dd('0x2a')](_0x394c2e);}return _0x5784e9['save']();};}function saveUpdates(_0x5835cb,_0x3d1d04){return function(_0x529ade){if(_0x529ade){return _0x529ade[_0x34dd('0x2b')](_0x5835cb)['then'](function(_0x573a4e){return _0x573a4e;});}return null;};}function removeEntity(_0x5e67fa,_0x3cb706){return function(_0x1776dd){if(_0x1776dd){return _0x1776dd[_0x34dd('0x2c')]()[_0x34dd('0x2d')](function(){var _0x18ffbf=_0x1776dd[_0x34dd('0x2e')]({'plain':!![]});var _0x21c40c=_0x34dd('0x2f');return db[_0x34dd('0x30')]['destroy']({'where':{'type':_0x21c40c,'resourceId':_0x18ffbf['id']}})[_0x34dd('0x2d')](function(){return _0x1776dd;});})[_0x34dd('0x2d')](function(){_0x5e67fa[_0x34dd('0x20')](0xcc)[_0x34dd('0x21')]();});}};}function handleEntityNotFound(_0x518b81,_0x3d5fdf){return function(_0x2a8864){if(!_0x2a8864){_0x518b81['sendStatus'](0x194);}return _0x2a8864;};}function handleError(_0x1b4e65,_0x2dc248){_0x2dc248=_0x2dc248||0x1f4;return function(_0x202a2b){logger['error'](_0x202a2b['stack']);if(_0x202a2b[_0x34dd('0x31')]){delete _0x202a2b['name'];}_0x1b4e65[_0x34dd('0x20')](_0x2dc248)['send'](_0x202a2b);};}exports['index']=function(_0xc8708b,_0x1a7445){var _0x317298={},_0x4eda9d={},_0x153fef={'count':0x0,'rows':[]};var _0x1596f9=_['map'](db[_0x34dd('0x32')][_0x34dd('0x33')],function(_0x3117a2){return{'name':_0x3117a2[_0x34dd('0x34')],'type':_0x3117a2[_0x34dd('0x35')][_0x34dd('0x36')]};});_0x4eda9d['model']=_[_0x34dd('0x37')](_0x1596f9,'name');_0x4eda9d['query']=_[_0x34dd('0x38')](_0xc8708b[_0x34dd('0x39')]);_0x4eda9d[_0x34dd('0x3a')]=_['intersection'](_0x4eda9d['model'],_0x4eda9d['query']);_0x317298[_0x34dd('0x3b')]=_[_0x34dd('0x3c')](_0x4eda9d['model'],qs[_0x34dd('0x3d')](_0xc8708b[_0x34dd('0x39')][_0x34dd('0x3d')]));_0x317298['attributes']=_0x317298[_0x34dd('0x3b')][_0x34dd('0x3e')]?_0x317298[_0x34dd('0x3b')]:_0x4eda9d[_0x34dd('0x3f')];if(!_0xc8708b[_0x34dd('0x39')][_0x34dd('0x40')]('nolimit')){_0x317298['limit']=qs[_0x34dd('0x25')](_0xc8708b[_0x34dd('0x39')]['limit']);_0x317298[_0x34dd('0x23')]=qs[_0x34dd('0x23')](_0xc8708b[_0x34dd('0x39')]['offset']);}_0x317298[_0x34dd('0x41')]=qs['sort'](_0xc8708b[_0x34dd('0x39')]['sort']);_0x317298[_0x34dd('0x42')]=qs['filters'](_[_0x34dd('0x43')](_0xc8708b[_0x34dd('0x39')],_0x4eda9d[_0x34dd('0x3a')]),_0x1596f9);if(_0xc8708b['query'][_0x34dd('0x44')]){_0x317298[_0x34dd('0x42')]=_[_0x34dd('0x45')](_0x317298[_0x34dd('0x42')],{'$or':_[_0x34dd('0x37')](_0x1596f9,function(_0xc0aac7){if(_0xc0aac7[_0x34dd('0x35')]!==_0x34dd('0x46')){var _0x41cbea={};_0x41cbea[_0xc0aac7[_0x34dd('0x31')]]={'$like':'%'+_0xc8708b[_0x34dd('0x39')][_0x34dd('0x44')]+'%'};return _0x41cbea;}})});}_0x317298=_['merge']({},_0x317298,_0xc8708b[_0x34dd('0x47')]);var _0x2e93ff={'where':_0x317298[_0x34dd('0x42')]};return db[_0x34dd('0x32')][_0x34dd('0x26')](_0x2e93ff)[_0x34dd('0x2d')](function(_0x4228f8){_0x153fef['count']=_0x4228f8;if(_0xc8708b[_0x34dd('0x39')][_0x34dd('0x48')]){_0x317298[_0x34dd('0x49')]=[{'all':!![]}];}return db[_0x34dd('0x32')][_0x34dd('0x4a')](_0x317298);})[_0x34dd('0x2d')](function(_0x565176){_0x153fef[_0x34dd('0x4b')]=_0x565176;return _0x153fef;})[_0x34dd('0x2d')](respondWithFilteredResult(_0x1a7445,_0x317298))[_0x34dd('0x4c')](handleError(_0x1a7445,null));};exports[_0x34dd('0x4d')]=function(_0x68c6e0,_0x6b265e){var _0x159902={'raw':![],'where':{'id':_0x68c6e0[_0x34dd('0x4e')]['id']}},_0xcaac69={};_0xcaac69['model']=_[_0x34dd('0x38')](db[_0x34dd('0x32')][_0x34dd('0x33')]);_0xcaac69['query']=_['keys'](_0x68c6e0[_0x34dd('0x39')]);_0xcaac69['filters']=_[_0x34dd('0x3c')](_0xcaac69[_0x34dd('0x3f')],_0xcaac69[_0x34dd('0x39')]);_0x159902[_0x34dd('0x3b')]=_['intersection'](_0xcaac69[_0x34dd('0x3f')],qs['fields'](_0x68c6e0[_0x34dd('0x39')][_0x34dd('0x3d')]));_0x159902[_0x34dd('0x3b')]=_0x159902[_0x34dd('0x3b')][_0x34dd('0x3e')]?_0x159902[_0x34dd('0x3b')]:_0xcaac69[_0x34dd('0x3f')];if(_0x68c6e0[_0x34dd('0x39')][_0x34dd('0x48')]){_0x159902[_0x34dd('0x49')]=[{'all':!![]}];}_0x159902=_[_0x34dd('0x45')]({},_0x159902,_0x68c6e0['options']);return db[_0x34dd('0x32')]['find'](_0x159902)['then'](handleEntityNotFound(_0x6b265e,null))[_0x34dd('0x2d')](respondWithResult(_0x6b265e,null))[_0x34dd('0x4c')](handleError(_0x6b265e,null));};exports[_0x34dd('0x4f')]=function(_0x38b15d,_0xb25f42){return db[_0x34dd('0x32')]['create'](_0x38b15d[_0x34dd('0x50')],{})[_0x34dd('0x2d')](function(_0x4dd208){var _0x4b90a2=_0x38b15d[_0x34dd('0x51')][_0x34dd('0x2e')]({'plain':!![]});if(!_0x4b90a2)throw new Error(_0x34dd('0x52'));if(_0x4b90a2['role']===_0x34dd('0x51')){var _0x396c49=_0x4dd208['get']({'plain':!![]});var _0x109dca=_0x34dd('0x2f');return db[_0x34dd('0x53')][_0x34dd('0x54')]({'where':{'name':_0x109dca,'userProfileId':_0x4b90a2[_0x34dd('0x55')]},'raw':!![]})[_0x34dd('0x2d')](function(_0x3523ae){if(_0x3523ae&&_0x3523ae[_0x34dd('0x56')]===0x0){return db[_0x34dd('0x30')][_0x34dd('0x4f')]({'name':_0x396c49[_0x34dd('0x31')],'resourceId':_0x396c49['id'],'type':_0x3523ae['name'],'sectionId':_0x3523ae['id']},{})['then'](function(){return _0x4dd208;});}else{return _0x4dd208;}})[_0x34dd('0x4c')](function(_0x4133f4){logger['error'](_0x34dd('0x57'),_0x4133f4);throw _0x4133f4;});}return _0x4dd208;})[_0x34dd('0x2d')](respondWithResult(_0xb25f42,0xc9))[_0x34dd('0x4c')](handleError(_0xb25f42,null));};exports['clone']=function(_0x45a4c5,_0x42348f){var _0x47cbef={'where':{'id':_0x45a4c5[_0x34dd('0x4e')]['id']}},_0x2c1660={};_0x2c1660[_0x34dd('0x3f')]=_['keys'](db['Dashboard'][_0x34dd('0x33')]);_0x47cbef['attributes']=_['intersection'](_0x2c1660[_0x34dd('0x3f')],qs[_0x34dd('0x3d')](_0x45a4c5[_0x34dd('0x39')][_0x34dd('0x3d')]));_0x47cbef[_0x34dd('0x3b')]=_0x47cbef[_0x34dd('0x3b')]['length']?_0x47cbef[_0x34dd('0x3b')]:_0x2c1660[_0x34dd('0x3f')];if(_0x45a4c5[_0x34dd('0x39')][_0x34dd('0x48')]){_0x47cbef['include']=[{'all':!![]}];}_0x47cbef=_[_0x34dd('0x45')]({},_0x47cbef,_0x45a4c5[_0x34dd('0x47')]);return db[_0x34dd('0x32')]['find'](_0x47cbef)[_0x34dd('0x2d')](handleEntityNotFound(_0x42348f,null))['then'](function(_0x1876e2){if(_0x1876e2){var _0x717c1=_0x1876e2[_0x34dd('0x2e')]({'plain':!![]});_0x717c1=qs['omit'](_0x717c1,['id','createdAt',_0x34dd('0x58')]);_0x45a4c5[_0x34dd('0x50')]=_[_0x34dd('0x59')](_0x45a4c5['body'],['id',_0x34dd('0x5a'),'updatedAt']);return db[_0x34dd('0x32')][_0x34dd('0x4f')](_['merge'](_0x717c1,_0x45a4c5[_0x34dd('0x50')]),{'include':_0x45a4c5[_0x34dd('0x39')][_0x34dd('0x48')]?[{'all':!![]}]:undefined})[_0x34dd('0x2d')](function(_0x5768e0){var _0x33f758=_0x45a4c5[_0x34dd('0x51')]['get']({'plain':!![]});if(!_0x33f758)throw new Error(_0x34dd('0x52'));if(_0x33f758[_0x34dd('0x5b')]===_0x34dd('0x51')){var _0x1bad28=_0x5768e0[_0x34dd('0x2e')]({'plain':!![]});var _0xd370c=_0x34dd('0x2f');return db[_0x34dd('0x53')][_0x34dd('0x54')]({'where':{'name':_0xd370c,'userProfileId':_0x33f758['userProfileId']},'raw':!![]})[_0x34dd('0x2d')](function(_0x241bab){if(_0x241bab&&_0x241bab[_0x34dd('0x56')]===0x0){return db[_0x34dd('0x30')][_0x34dd('0x4f')]({'name':_0x1bad28['name'],'resourceId':_0x1bad28['id'],'type':_0x241bab['name'],'sectionId':_0x241bab['id']},{})[_0x34dd('0x2d')](function(){return _0x5768e0;});}else{return _0x5768e0;}})['catch'](function(_0xa7b58){logger[_0x34dd('0x5c')](_0x34dd('0x57'),_0xa7b58);throw _0xa7b58;});}return _0x5768e0;});}})['then'](respondWithResult(_0x42348f,0xc9))[_0x34dd('0x4c')](handleError(_0x42348f,null));};exports['update']=function(_0x549454,_0x35be5d){if(_0x549454[_0x34dd('0x50')]['id']){delete _0x549454[_0x34dd('0x50')]['id'];}return db[_0x34dd('0x32')]['find']({'where':{'id':_0x549454['params']['id']}})[_0x34dd('0x2d')](handleEntityNotFound(_0x35be5d,null))['then'](saveUpdates(_0x549454['body'],null))[_0x34dd('0x2d')](respondWithResult(_0x35be5d,null))[_0x34dd('0x4c')](handleError(_0x35be5d,null));};exports['destroy']=function(_0x3f1dfd,_0x31583b){return db[_0x34dd('0x32')][_0x34dd('0x54')]({'where':{'id':_0x3f1dfd[_0x34dd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x31583b,null))[_0x34dd('0x2d')](removeEntity(_0x31583b,null))[_0x34dd('0x4c')](handleError(_0x31583b,null));};function widgetAttributes(_0x21d6db){try{switch(_0x21d6db['type']){case _0x34dd('0x5d'):return[{'name':_0x34dd('0x5e'),'value':_0x21d6db[_0x34dd('0x5e')]||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db[_0x34dd('0x5f')][0x0]?_0x21d6db[_0x34dd('0x5f')][0x0][_0x34dd('0x60')]:undefined)||_0x34dd('0x61')}];case'custom':return[{'name':'attrPath','value':_0x21d6db[_0x34dd('0x62')]||(_0x21d6db['attrs']&&_0x21d6db['attrs'][0x0]?_0x21d6db[_0x34dd('0x5f')][0x0][_0x34dd('0x60')]:undefined)||''}];case _0x34dd('0x63'):return[{'name':'attrHourFormat','value':_0x21d6db[_0x34dd('0x64')]||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db[_0x34dd('0x5f')][0x0]?_0x21d6db[_0x34dd('0x5f')][0x0][_0x34dd('0x60')]:undefined)||_0x34dd('0x65')},{'name':_0x34dd('0x66'),'value':_0x21d6db[_0x34dd('0x66')]||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db['attrs'][0x1]?_0x21d6db[_0x34dd('0x5f')][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0x21d6db[_0x34dd('0x67')]||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db['attrs'][0x2]?_0x21d6db[_0x34dd('0x5f')][0x2]['value']:undefined)||0xc}];case _0x34dd('0x68'):return[{'name':_0x34dd('0x69'),'value':_0x21d6db['attrMetric']||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db['attrs'][0x0]?_0x21d6db[_0x34dd('0x5f')][0x0][_0x34dd('0x60')]:undefined)||'total'},{'name':_0x34dd('0x6a'),'value':_0x21d6db[_0x34dd('0x6a')]||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db['attrs'][0x1]?_0x21d6db[_0x34dd('0x5f')][0x1][_0x34dd('0x60')]:undefined)||[]},{'name':_0x34dd('0x67'),'value':_0x21d6db[_0x34dd('0x67')]||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db[_0x34dd('0x5f')][0x2]?_0x21d6db[_0x34dd('0x5f')][0x2][_0x34dd('0x60')]:undefined)||0x14},{'name':_0x34dd('0x6b'),'value':_0x21d6db[_0x34dd('0x6b')]||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db[_0x34dd('0x5f')][0x3]?_0x21d6db[_0x34dd('0x5f')][0x3][_0x34dd('0x60')]:undefined)||_0x34dd('0x6c')},{'name':'attrEmailAccounts','value':_0x21d6db[_0x34dd('0x6d')]||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db['attrs'][0x4]?_0x21d6db['attrs'][0x4][_0x34dd('0x60')]:undefined)||''},{'name':_0x34dd('0x6e'),'value':_0x21d6db['attrFaxAccounts']||(_0x21d6db['attrs']&&_0x21d6db[_0x34dd('0x5f')][0x5]?_0x21d6db[_0x34dd('0x5f')][0x5][_0x34dd('0x60')]:undefined)||''},{'name':_0x34dd('0x6f'),'value':_0x21d6db[_0x34dd('0x6f')]||(_0x21d6db['attrs']&&_0x21d6db[_0x34dd('0x5f')][0x6]?_0x21d6db['attrs'][0x6][_0x34dd('0x60')]:undefined)||''},{'name':_0x34dd('0x70'),'value':_0x21d6db[_0x34dd('0x70')]||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db[_0x34dd('0x5f')][0x7]?_0x21d6db['attrs'][0x7][_0x34dd('0x60')]:undefined)||''},{'name':_0x34dd('0x71'),'value':_0x21d6db[_0x34dd('0x71')]||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db['attrs'][0x8]?_0x21d6db['attrs'][0x8][_0x34dd('0x60')]:undefined)||''},{'name':_0x34dd('0x72'),'value':_0x21d6db[_0x34dd('0x72')]||(_0x21d6db['attrs']&&_0x21d6db['attrs'][0x9]?_0x21d6db[_0x34dd('0x5f')][0x9]['value']:undefined)||''}];case _0x34dd('0x73'):case _0x34dd('0x74'):return[{'name':_0x34dd('0x75'),'value':_0x21d6db[_0x34dd('0x75')]||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db['attrs'][0x0]?_0x21d6db['attrs'][0x0][_0x34dd('0x60')]:undefined)||'total'},{'name':_0x34dd('0x76'),'value':_0x21d6db[_0x34dd('0x76')]||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db[_0x34dd('0x5f')][0x1]?_0x21d6db[_0x34dd('0x5f')][0x1][_0x34dd('0x60')]:undefined)||null},{'name':_0x34dd('0x77'),'value':_0x21d6db[_0x34dd('0x77')]||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db[_0x34dd('0x5f')][0x2]?_0x21d6db[_0x34dd('0x5f')][0x2][_0x34dd('0x60')]:undefined)||null},{'name':_0x34dd('0x6a'),'value':_0x21d6db[_0x34dd('0x6a')]||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db[_0x34dd('0x5f')][0x3]?_0x21d6db[_0x34dd('0x5f')][0x3][_0x34dd('0x60')]:undefined)||[]},{'name':'attrChannel','value':_0x21d6db[_0x34dd('0x6b')]||(_0x21d6db['attrs']&&_0x21d6db[_0x34dd('0x5f')][0x4]?_0x21d6db[_0x34dd('0x5f')][0x4][_0x34dd('0x60')]:undefined)||'voice'},{'name':_0x34dd('0x6d'),'value':_0x21d6db[_0x34dd('0x6d')]||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db['attrs'][0x5]?_0x21d6db[_0x34dd('0x5f')][0x5][_0x34dd('0x60')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x21d6db['attrFaxAccounts']||(_0x21d6db['attrs']&&_0x21d6db[_0x34dd('0x5f')][0x6]?_0x21d6db[_0x34dd('0x5f')][0x6][_0x34dd('0x60')]:undefined)||''},{'name':_0x34dd('0x6f'),'value':_0x21d6db['attrSmsAccounts']||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db[_0x34dd('0x5f')][0x7]?_0x21d6db[_0x34dd('0x5f')][0x7][_0x34dd('0x60')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x21d6db[_0x34dd('0x70')]||(_0x21d6db['attrs']&&_0x21d6db['attrs'][0x8]?_0x21d6db[_0x34dd('0x5f')][0x8][_0x34dd('0x60')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x21d6db['attrWhatsappAccounts']||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db['attrs'][0x9]?_0x21d6db['attrs'][0x9][_0x34dd('0x60')]:undefined)||''},{'name':'attrChatWebsites','value':_0x21d6db[_0x34dd('0x72')]||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db[_0x34dd('0x5f')][0xa]?_0x21d6db[_0x34dd('0x5f')][0xa][_0x34dd('0x60')]:undefined)||''}];case _0x34dd('0x78'):return[{'name':'attrReport','type':_0x21d6db[_0x34dd('0x79')]||(_0x21d6db['attrs']&&_0x21d6db[_0x34dd('0x5f')][0x0]?_0x21d6db[_0x34dd('0x5f')][0x0][_0x34dd('0x35')]:undefined)||null,'value':_0x21d6db[_0x34dd('0x7a')]||(_0x21d6db[_0x34dd('0x5f')]&&_0x21d6db[_0x34dd('0x5f')][0x0]?_0x21d6db['attrs'][0x0][_0x34dd('0x60')]:undefined)||null},{'name':_0x34dd('0x7b'),'value':_0x21d6db[_0x34dd('0x7b')]||(_0x21d6db['attrs']&&_0x21d6db[_0x34dd('0x5f')][0x1]?_0x21d6db['attrs'][0x1][_0x34dd('0x60')]:undefined)||0x0}];default:return[];}}catch(_0xbc2cd6){logger[_0x34dd('0x5c')](_0x34dd('0x7c'),JSON[_0x34dd('0x7d')](_0xbc2cd6));return[];}}exports[_0x34dd('0x7e')]=function(_0x34fd49,_0xe6cc0,_0x4a3e90){if(_0x34fd49['body']['id']){delete _0x34fd49[_0x34dd('0x50')]['id'];}return db[_0x34dd('0x32')]['find']({'where':{'id':_0x34fd49[_0x34dd('0x4e')]['id']}})['then'](handleEntityNotFound(_0xe6cc0,null))['then'](function(_0x27061c){if(_0x27061c){_0x34fd49[_0x34dd('0x50')][_0x34dd('0x7f')]=_0x27061c['id'];_0x34fd49['body'][_0x34dd('0x5f')]=widgetAttributes(_0x34fd49[_0x34dd('0x50')]);return db[_0x34dd('0x80')][_0x34dd('0x4f')](_0x34fd49[_0x34dd('0x50')]);}})['then'](respondWithResult(_0xe6cc0,null))[_0x34dd('0x4c')](handleError(_0xe6cc0,null));};exports['getItems']=function(_0x36f287,_0x312b93,_0x7d4f24){var _0x3c3305={};var _0x47190b={};var _0x15abfc;var _0x2bd64c;return db[_0x34dd('0x32')][_0x34dd('0x81')]({'where':{'id':_0x36f287['params']['id']}})[_0x34dd('0x2d')](handleEntityNotFound(_0x312b93,null))['then'](function(_0x4b362d){if(_0x4b362d){_0x15abfc=_0x4b362d;_0x47190b[_0x34dd('0x3f')]=_[_0x34dd('0x38')](db['DashboardItem'][_0x34dd('0x33')]);_0x47190b[_0x34dd('0x39')]=_[_0x34dd('0x38')](_0x36f287[_0x34dd('0x39')]);_0x47190b[_0x34dd('0x3a')]=_[_0x34dd('0x3c')](_0x47190b[_0x34dd('0x3f')],_0x47190b[_0x34dd('0x39')]);_0x3c3305[_0x34dd('0x3b')]=_[_0x34dd('0x3c')](_0x47190b[_0x34dd('0x3f')],qs[_0x34dd('0x3d')](_0x36f287[_0x34dd('0x39')][_0x34dd('0x3d')]));_0x3c3305[_0x34dd('0x3b')]=_0x3c3305[_0x34dd('0x3b')][_0x34dd('0x3e')]?_0x3c3305['attributes']:_0x47190b[_0x34dd('0x3f')];_0x3c3305['order']=qs[_0x34dd('0x82')](_0x36f287[_0x34dd('0x39')][_0x34dd('0x82')]);_0x3c3305[_0x34dd('0x42')]=qs['filters'](_[_0x34dd('0x43')](_0x36f287[_0x34dd('0x39')],_0x47190b[_0x34dd('0x3a')]));if(_0x36f287['query'][_0x34dd('0x44')]){_0x3c3305[_0x34dd('0x42')]=_[_0x34dd('0x45')](_0x3c3305['where'],{'$or':_['map'](_0x3c3305['attributes'],function(_0x4b3f83){var _0x25b588={};_0x25b588[_0x4b3f83]={'$like':'%'+_0x36f287[_0x34dd('0x39')]['filter']+'%'};return _0x25b588;})});}_0x3c3305=_[_0x34dd('0x45')]({},_0x3c3305,_0x36f287['options']);return _0x15abfc[_0x34dd('0x83')](_0x3c3305);}})[_0x34dd('0x2d')](function(_0xe450f0){if(_0xe450f0){_0x2bd64c=_0xe450f0['length'];if(!_0x36f287[_0x34dd('0x39')][_0x34dd('0x40')](_0x34dd('0x84'))){_0x3c3305['limit']=qs[_0x34dd('0x25')](_0x36f287[_0x34dd('0x39')][_0x34dd('0x25')]);_0x3c3305['offset']=qs[_0x34dd('0x23')](_0x36f287[_0x34dd('0x39')]['offset']);}return _0x15abfc[_0x34dd('0x83')](_0x3c3305);}})['then'](function(_0x53835e){if(_0x53835e){return _0x53835e?{'count':_0x2bd64c,'rows':_0x53835e}:null;}})[_0x34dd('0x2d')](respondWithResult(_0x312b93,null))['catch'](handleError(_0x312b93,null));}; \ No newline at end of file +var _0xed55=['attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrSmsAccounts','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','merge','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','Dashboard','includeAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','body','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0xed55,0x128));var _0x5ed5=function(_0x2ade6c,_0x2d42f2){_0x2ade6c=_0x2ade6c-0x0;var _0x2cb372=_0xed55[_0x2ade6c];return _0x2cb372;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ed5('0x0'));var zipdir=require(_0x5ed5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ed5('0x2'));var moment=require(_0x5ed5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5ed5('0x4'));var util=require(_0x5ed5('0x5'));var path=require(_0x5ed5('0x6'));var sox=require(_0x5ed5('0x7'));var csv=require(_0x5ed5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ed5('0x9'));var _=require('lodash');var squel=require(_0x5ed5('0xa'));var crypto=require(_0x5ed5('0xb'));var jsforce=require(_0x5ed5('0xc'));var deskjs=require(_0x5ed5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5ed5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5ed5('0xf'));var qs=require(_0x5ed5('0x10'));var as=require(_0x5ed5('0x11'));var hardwareService=require(_0x5ed5('0x12'));var logger=require(_0x5ed5('0x13'))('api');var utils=require(_0x5ed5('0x14'));var config=require(_0x5ed5('0x15'));var licenseUtil=require(_0x5ed5('0x16'));var db=require(_0x5ed5('0x17'))['db'];config[_0x5ed5('0x18')]=_[_0x5ed5('0x19')](config['redis'],{'host':_0x5ed5('0x1a'),'port':0x18eb});var socket=require(_0x5ed5('0x1b'))(new Redis(config[_0x5ed5('0x18')]));require(_0x5ed5('0x1c'))[_0x5ed5('0x1d')](socket);function respondWithStatusCode(_0x1a5d87,_0x151e19){_0x151e19=_0x151e19||0xcc;return function(_0x29a382){if(_0x29a382){return _0x1a5d87[_0x5ed5('0x1e')](_0x151e19);}return _0x1a5d87[_0x5ed5('0x1f')](_0x151e19)[_0x5ed5('0x20')]();};}function respondWithResult(_0x5af4c8,_0x504514){_0x504514=_0x504514||0xc8;return function(_0x5a0e5c){if(_0x5a0e5c){return _0x5af4c8['status'](_0x504514)[_0x5ed5('0x21')](_0x5a0e5c);}};}function respondWithFilteredResult(_0xd0db9f,_0xd20530){return function(_0x2b1c2b){if(_0x2b1c2b){var _0xb7c7a7=typeof _0xd20530[_0x5ed5('0x22')]===_0x5ed5('0x23')&&typeof _0xd20530[_0x5ed5('0x24')]===_0x5ed5('0x23');var _0x5ae80d=_0x2b1c2b['count'];var _0x69a66a=_0xb7c7a7?0x0:_0xd20530[_0x5ed5('0x22')];var _0xdf9fe3=_0xb7c7a7?_0x2b1c2b[_0x5ed5('0x25')]:_0xd20530[_0x5ed5('0x22')]+_0xd20530['limit'];var _0x3388c8;if(_0xdf9fe3>=_0x5ae80d){_0xdf9fe3=_0x5ae80d;_0x3388c8=0xc8;}else{_0x3388c8=0xce;}_0xd0db9f[_0x5ed5('0x1f')](_0x3388c8);return _0xd0db9f['set'](_0x5ed5('0x26'),_0x69a66a+'-'+_0xdf9fe3+'/'+_0x5ae80d)[_0x5ed5('0x21')](_0x2b1c2b);}return null;};}function patchUpdates(_0x48a5b9){return function(_0x55c5f8){try{jsonpatch[_0x5ed5('0x27')](_0x55c5f8,_0x48a5b9,!![]);}catch(_0x11f27e){return BPromise[_0x5ed5('0x28')](_0x11f27e);}return _0x55c5f8[_0x5ed5('0x29')]();};}function saveUpdates(_0x5571c4,_0x9ea479){return function(_0x413567){if(_0x413567){return _0x413567[_0x5ed5('0x2a')](_0x5571c4)[_0x5ed5('0x2b')](function(_0x1e54b9){return _0x1e54b9;});}return null;};}function removeEntity(_0x23dda3,_0x4c1495){return function(_0x465b2d){if(_0x465b2d){return _0x465b2d[_0x5ed5('0x2c')]()[_0x5ed5('0x2b')](function(){var _0x598089=_0x465b2d[_0x5ed5('0x2d')]({'plain':!![]});var _0x225f34=_0x5ed5('0x2e');return db[_0x5ed5('0x2f')][_0x5ed5('0x2c')]({'where':{'type':_0x225f34,'resourceId':_0x598089['id']}})[_0x5ed5('0x2b')](function(){return _0x465b2d;});})['then'](function(){_0x23dda3['status'](0xcc)[_0x5ed5('0x20')]();});}};}function handleEntityNotFound(_0x1ad3ce,_0x1c35f9){return function(_0x53cc68){if(!_0x53cc68){_0x1ad3ce[_0x5ed5('0x1e')](0x194);}return _0x53cc68;};}function handleError(_0x3ec303,_0x2cfc32){_0x2cfc32=_0x2cfc32||0x1f4;return function(_0x1495a2){logger[_0x5ed5('0x30')](_0x1495a2[_0x5ed5('0x31')]);if(_0x1495a2[_0x5ed5('0x32')]){delete _0x1495a2[_0x5ed5('0x32')];}_0x3ec303['status'](_0x2cfc32)[_0x5ed5('0x33')](_0x1495a2);};}exports['index']=function(_0x2ec5e5,_0x1ff524){var _0x2da289={},_0x268972={},_0x36fa95={'count':0x0,'rows':[]};var _0x419120=_[_0x5ed5('0x34')](db['Dashboard'][_0x5ed5('0x35')],function(_0x5b3f14){return{'name':_0x5b3f14[_0x5ed5('0x36')],'type':_0x5b3f14[_0x5ed5('0x37')][_0x5ed5('0x38')]};});_0x268972[_0x5ed5('0x39')]=_[_0x5ed5('0x34')](_0x419120,_0x5ed5('0x32'));_0x268972['query']=_[_0x5ed5('0x3a')](_0x2ec5e5[_0x5ed5('0x3b')]);_0x268972['filters']=_[_0x5ed5('0x3c')](_0x268972[_0x5ed5('0x39')],_0x268972[_0x5ed5('0x3b')]);_0x2da289['attributes']=_['intersection'](_0x268972[_0x5ed5('0x39')],qs[_0x5ed5('0x3d')](_0x2ec5e5['query'][_0x5ed5('0x3d')]));_0x2da289[_0x5ed5('0x3e')]=_0x2da289['attributes'][_0x5ed5('0x3f')]?_0x2da289[_0x5ed5('0x3e')]:_0x268972[_0x5ed5('0x39')];if(!_0x2ec5e5['query'][_0x5ed5('0x40')](_0x5ed5('0x41'))){_0x2da289['limit']=qs[_0x5ed5('0x24')](_0x2ec5e5[_0x5ed5('0x3b')][_0x5ed5('0x24')]);_0x2da289[_0x5ed5('0x22')]=qs['offset'](_0x2ec5e5[_0x5ed5('0x3b')]['offset']);}_0x2da289[_0x5ed5('0x42')]=qs[_0x5ed5('0x43')](_0x2ec5e5[_0x5ed5('0x3b')][_0x5ed5('0x43')]);_0x2da289[_0x5ed5('0x44')]=qs[_0x5ed5('0x45')](_[_0x5ed5('0x46')](_0x2ec5e5[_0x5ed5('0x3b')],_0x268972['filters']),_0x419120);if(_0x2ec5e5[_0x5ed5('0x3b')][_0x5ed5('0x47')]){_0x2da289[_0x5ed5('0x44')]=_['merge'](_0x2da289[_0x5ed5('0x44')],{'$or':_[_0x5ed5('0x34')](_0x419120,function(_0x376de4){if(_0x376de4[_0x5ed5('0x37')]!==_0x5ed5('0x48')){var _0x5f0a80={};_0x5f0a80[_0x376de4[_0x5ed5('0x32')]]={'$like':'%'+_0x2ec5e5[_0x5ed5('0x3b')][_0x5ed5('0x47')]+'%'};return _0x5f0a80;}})});}_0x2da289=_['merge']({},_0x2da289,_0x2ec5e5[_0x5ed5('0x49')]);var _0x34e27f={'where':_0x2da289[_0x5ed5('0x44')]};return db[_0x5ed5('0x4a')]['count'](_0x34e27f)['then'](function(_0x390fd3){_0x36fa95[_0x5ed5('0x25')]=_0x390fd3;if(_0x2ec5e5[_0x5ed5('0x3b')][_0x5ed5('0x4b')]){_0x2da289['include']=[{'all':!![]}];}return db[_0x5ed5('0x4a')]['findAll'](_0x2da289);})[_0x5ed5('0x2b')](function(_0x3695e3){_0x36fa95[_0x5ed5('0x4c')]=_0x3695e3;return _0x36fa95;})[_0x5ed5('0x2b')](respondWithFilteredResult(_0x1ff524,_0x2da289))[_0x5ed5('0x4d')](handleError(_0x1ff524,null));};exports[_0x5ed5('0x4e')]=function(_0x28e88d,_0xb785a1){var _0x2f6ac1={'raw':![],'where':{'id':_0x28e88d[_0x5ed5('0x4f')]['id']}},_0x203b3d={};_0x203b3d['model']=_[_0x5ed5('0x3a')](db[_0x5ed5('0x4a')][_0x5ed5('0x35')]);_0x203b3d['query']=_[_0x5ed5('0x3a')](_0x28e88d[_0x5ed5('0x3b')]);_0x203b3d[_0x5ed5('0x45')]=_[_0x5ed5('0x3c')](_0x203b3d['model'],_0x203b3d['query']);_0x2f6ac1[_0x5ed5('0x3e')]=_[_0x5ed5('0x3c')](_0x203b3d['model'],qs[_0x5ed5('0x3d')](_0x28e88d['query']['fields']));_0x2f6ac1[_0x5ed5('0x3e')]=_0x2f6ac1[_0x5ed5('0x3e')][_0x5ed5('0x3f')]?_0x2f6ac1[_0x5ed5('0x3e')]:_0x203b3d['model'];if(_0x28e88d[_0x5ed5('0x3b')][_0x5ed5('0x4b')]){_0x2f6ac1['include']=[{'all':!![]}];}_0x2f6ac1=_['merge']({},_0x2f6ac1,_0x28e88d[_0x5ed5('0x49')]);return db[_0x5ed5('0x4a')][_0x5ed5('0x50')](_0x2f6ac1)[_0x5ed5('0x2b')](handleEntityNotFound(_0xb785a1,null))[_0x5ed5('0x2b')](respondWithResult(_0xb785a1,null))[_0x5ed5('0x4d')](handleError(_0xb785a1,null));};exports['create']=function(_0x4fe678,_0x3ddad6){return db['Dashboard'][_0x5ed5('0x51')](_0x4fe678['body'],{})[_0x5ed5('0x2b')](function(_0x74a572){var _0x2457fa=_0x4fe678[_0x5ed5('0x52')][_0x5ed5('0x2d')]({'plain':!![]});if(!_0x2457fa)throw new Error(_0x5ed5('0x53'));if(_0x2457fa[_0x5ed5('0x54')]===_0x5ed5('0x52')){var _0x1aec60=_0x74a572[_0x5ed5('0x2d')]({'plain':!![]});var _0x264527=_0x5ed5('0x2e');return db[_0x5ed5('0x55')][_0x5ed5('0x50')]({'where':{'name':_0x264527,'userProfileId':_0x2457fa[_0x5ed5('0x56')]},'raw':!![]})['then'](function(_0x4aafd4){if(_0x4aafd4&&_0x4aafd4[_0x5ed5('0x57')]===0x0){return db[_0x5ed5('0x2f')]['create']({'name':_0x1aec60['name'],'resourceId':_0x1aec60['id'],'type':_0x4aafd4[_0x5ed5('0x32')],'sectionId':_0x4aafd4['id']},{})['then'](function(){return _0x74a572;});}else{return _0x74a572;}})[_0x5ed5('0x4d')](function(_0x22fc27){logger[_0x5ed5('0x30')](_0x5ed5('0x58'),_0x22fc27);throw _0x22fc27;});}return _0x74a572;})[_0x5ed5('0x2b')](respondWithResult(_0x3ddad6,0xc9))['catch'](handleError(_0x3ddad6,null));};exports[_0x5ed5('0x59')]=function(_0x32b4a8,_0x11cf13){var _0x36881d={'where':{'id':_0x32b4a8['params']['id']}},_0x20599e={};_0x20599e[_0x5ed5('0x39')]=_[_0x5ed5('0x3a')](db[_0x5ed5('0x4a')][_0x5ed5('0x35')]);_0x36881d[_0x5ed5('0x3e')]=_[_0x5ed5('0x3c')](_0x20599e[_0x5ed5('0x39')],qs[_0x5ed5('0x3d')](_0x32b4a8[_0x5ed5('0x3b')][_0x5ed5('0x3d')]));_0x36881d[_0x5ed5('0x3e')]=_0x36881d['attributes'][_0x5ed5('0x3f')]?_0x36881d[_0x5ed5('0x3e')]:_0x20599e[_0x5ed5('0x39')];if(_0x32b4a8[_0x5ed5('0x3b')][_0x5ed5('0x4b')]){_0x36881d[_0x5ed5('0x5a')]=[{'all':!![]}];}_0x36881d=_['merge']({},_0x36881d,_0x32b4a8[_0x5ed5('0x49')]);return db[_0x5ed5('0x4a')][_0x5ed5('0x50')](_0x36881d)[_0x5ed5('0x2b')](handleEntityNotFound(_0x11cf13,null))[_0x5ed5('0x2b')](function(_0x3da047){if(_0x3da047){var _0x21f174=_0x3da047[_0x5ed5('0x2d')]({'plain':!![]});_0x21f174=qs[_0x5ed5('0x5b')](_0x21f174,['id',_0x5ed5('0x5c'),'updatedAt']);_0x32b4a8['body']=_[_0x5ed5('0x5b')](_0x32b4a8['body'],['id','createdAt',_0x5ed5('0x5d')]);return db['Dashboard'][_0x5ed5('0x51')](_['merge'](_0x21f174,_0x32b4a8[_0x5ed5('0x5e')]),{'include':_0x32b4a8['query']['includeAll']?[{'all':!![]}]:undefined})[_0x5ed5('0x2b')](function(_0x21c26f){var _0xb742a1=_0x32b4a8[_0x5ed5('0x52')]['get']({'plain':!![]});if(!_0xb742a1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb742a1[_0x5ed5('0x54')]===_0x5ed5('0x52')){var _0x292fd7=_0x21c26f[_0x5ed5('0x2d')]({'plain':!![]});var _0x31bccd='CustomDashboards';return db[_0x5ed5('0x55')][_0x5ed5('0x50')]({'where':{'name':_0x31bccd,'userProfileId':_0xb742a1['userProfileId']},'raw':!![]})[_0x5ed5('0x2b')](function(_0x37c15f){if(_0x37c15f&&_0x37c15f[_0x5ed5('0x57')]===0x0){return db[_0x5ed5('0x2f')][_0x5ed5('0x51')]({'name':_0x292fd7[_0x5ed5('0x32')],'resourceId':_0x292fd7['id'],'type':_0x37c15f[_0x5ed5('0x32')],'sectionId':_0x37c15f['id']},{})[_0x5ed5('0x2b')](function(){return _0x21c26f;});}else{return _0x21c26f;}})[_0x5ed5('0x4d')](function(_0x24346b){logger[_0x5ed5('0x30')](_0x5ed5('0x58'),_0x24346b);throw _0x24346b;});}return _0x21c26f;});}})[_0x5ed5('0x2b')](respondWithResult(_0x11cf13,0xc9))['catch'](handleError(_0x11cf13,null));};exports[_0x5ed5('0x2a')]=function(_0x4a40b3,_0x58d26c){if(_0x4a40b3[_0x5ed5('0x5e')]['id']){delete _0x4a40b3[_0x5ed5('0x5e')]['id'];}return db['Dashboard'][_0x5ed5('0x50')]({'where':{'id':_0x4a40b3[_0x5ed5('0x4f')]['id']}})[_0x5ed5('0x2b')](handleEntityNotFound(_0x58d26c,null))[_0x5ed5('0x2b')](saveUpdates(_0x4a40b3[_0x5ed5('0x5e')],null))['then'](respondWithResult(_0x58d26c,null))[_0x5ed5('0x4d')](handleError(_0x58d26c,null));};exports[_0x5ed5('0x2c')]=function(_0x44a887,_0x128953){return db[_0x5ed5('0x4a')][_0x5ed5('0x50')]({'where':{'id':_0x44a887[_0x5ed5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x128953,null))['then'](removeEntity(_0x128953,null))[_0x5ed5('0x4d')](handleError(_0x128953,null));};function widgetAttributes(_0x57c5b0){try{switch(_0x57c5b0[_0x5ed5('0x37')]){case _0x5ed5('0x5f'):return[{'name':_0x5ed5('0x60'),'value':_0x57c5b0[_0x5ed5('0x60')]||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0[_0x5ed5('0x61')][0x0]?_0x57c5b0[_0x5ed5('0x61')][0x0][_0x5ed5('0x62')]:undefined)||_0x5ed5('0x63')}];case'custom':return[{'name':_0x5ed5('0x64'),'value':_0x57c5b0[_0x5ed5('0x64')]||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0[_0x5ed5('0x61')][0x0]?_0x57c5b0[_0x5ed5('0x61')][0x0]['value']:undefined)||''}];case _0x5ed5('0x65'):return[{'name':_0x5ed5('0x66'),'value':_0x57c5b0[_0x5ed5('0x66')]||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0[_0x5ed5('0x61')][0x0]?_0x57c5b0[_0x5ed5('0x61')][0x0][_0x5ed5('0x62')]:undefined)||_0x5ed5('0x67')},{'name':_0x5ed5('0x68'),'value':_0x57c5b0[_0x5ed5('0x68')]||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0[_0x5ed5('0x61')][0x1]?_0x57c5b0[_0x5ed5('0x61')][0x1][_0x5ed5('0x62')]:undefined)||_0x5ed5('0x69')},{'name':_0x5ed5('0x6a'),'value':_0x57c5b0[_0x5ed5('0x6a')]||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0[_0x5ed5('0x61')][0x2]?_0x57c5b0[_0x5ed5('0x61')][0x2][_0x5ed5('0x62')]:undefined)||0xc}];case _0x5ed5('0x6b'):return[{'name':_0x5ed5('0x6c'),'value':_0x57c5b0[_0x5ed5('0x6c')]||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0['attrs'][0x0]?_0x57c5b0['attrs'][0x0][_0x5ed5('0x62')]:undefined)||'total'},{'name':_0x5ed5('0x6d'),'value':_0x57c5b0[_0x5ed5('0x6d')]||(_0x57c5b0['attrs']&&_0x57c5b0[_0x5ed5('0x61')][0x1]?_0x57c5b0['attrs'][0x1][_0x5ed5('0x62')]:undefined)||[]},{'name':_0x5ed5('0x6a'),'value':_0x57c5b0[_0x5ed5('0x6a')]||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0[_0x5ed5('0x61')][0x2]?_0x57c5b0['attrs'][0x2][_0x5ed5('0x62')]:undefined)||0x14},{'name':_0x5ed5('0x6e'),'value':_0x57c5b0[_0x5ed5('0x6e')]||(_0x57c5b0['attrs']&&_0x57c5b0[_0x5ed5('0x61')][0x3]?_0x57c5b0['attrs'][0x3][_0x5ed5('0x62')]:undefined)||_0x5ed5('0x6f')},{'name':_0x5ed5('0x70'),'value':_0x57c5b0['attrEmailAccounts']||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0['attrs'][0x4]?_0x57c5b0[_0x5ed5('0x61')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x57c5b0[_0x5ed5('0x71')]||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0[_0x5ed5('0x61')][0x5]?_0x57c5b0['attrs'][0x5][_0x5ed5('0x62')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x57c5b0['attrSmsAccounts']||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0['attrs'][0x6]?_0x57c5b0['attrs'][0x6][_0x5ed5('0x62')]:undefined)||''},{'name':_0x5ed5('0x72'),'value':_0x57c5b0[_0x5ed5('0x72')]||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0['attrs'][0x7]?_0x57c5b0[_0x5ed5('0x61')][0x7]['value']:undefined)||''},{'name':_0x5ed5('0x73'),'value':_0x57c5b0[_0x5ed5('0x73')]||(_0x57c5b0['attrs']&&_0x57c5b0[_0x5ed5('0x61')][0x8]?_0x57c5b0[_0x5ed5('0x61')][0x8][_0x5ed5('0x62')]:undefined)||''},{'name':_0x5ed5('0x74'),'value':_0x57c5b0[_0x5ed5('0x74')]||(_0x57c5b0['attrs']&&_0x57c5b0['attrs'][0x9]?_0x57c5b0[_0x5ed5('0x61')][0x9]['value']:undefined)||''}];case _0x5ed5('0x75'):case _0x5ed5('0x76'):return[{'name':_0x5ed5('0x77'),'value':_0x57c5b0[_0x5ed5('0x77')]||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0[_0x5ed5('0x61')][0x0]?_0x57c5b0['attrs'][0x0][_0x5ed5('0x62')]:undefined)||_0x5ed5('0x78')},{'name':_0x5ed5('0x79'),'value':_0x57c5b0[_0x5ed5('0x79')]||(_0x57c5b0['attrs']&&_0x57c5b0[_0x5ed5('0x61')][0x1]?_0x57c5b0[_0x5ed5('0x61')][0x1][_0x5ed5('0x62')]:undefined)||null},{'name':'attrSerie3','value':_0x57c5b0[_0x5ed5('0x7a')]||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0[_0x5ed5('0x61')][0x2]?_0x57c5b0[_0x5ed5('0x61')][0x2][_0x5ed5('0x62')]:undefined)||null},{'name':_0x5ed5('0x6d'),'value':_0x57c5b0['attrVoiceQueues']||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0['attrs'][0x3]?_0x57c5b0['attrs'][0x3]['value']:undefined)||[]},{'name':_0x5ed5('0x6e'),'value':_0x57c5b0['attrChannel']||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0['attrs'][0x4]?_0x57c5b0[_0x5ed5('0x61')][0x4][_0x5ed5('0x62')]:undefined)||_0x5ed5('0x6f')},{'name':_0x5ed5('0x70'),'value':_0x57c5b0['attrEmailAccounts']||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0[_0x5ed5('0x61')][0x5]?_0x57c5b0[_0x5ed5('0x61')][0x5][_0x5ed5('0x62')]:undefined)||''},{'name':_0x5ed5('0x71'),'value':_0x57c5b0[_0x5ed5('0x71')]||(_0x57c5b0['attrs']&&_0x57c5b0[_0x5ed5('0x61')][0x6]?_0x57c5b0[_0x5ed5('0x61')][0x6][_0x5ed5('0x62')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x57c5b0[_0x5ed5('0x7b')]||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0[_0x5ed5('0x61')][0x7]?_0x57c5b0[_0x5ed5('0x61')][0x7][_0x5ed5('0x62')]:undefined)||''},{'name':_0x5ed5('0x72'),'value':_0x57c5b0[_0x5ed5('0x72')]||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0['attrs'][0x8]?_0x57c5b0[_0x5ed5('0x61')][0x8][_0x5ed5('0x62')]:undefined)||''},{'name':_0x5ed5('0x73'),'value':_0x57c5b0['attrWhatsappAccounts']||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0[_0x5ed5('0x61')][0x9]?_0x57c5b0[_0x5ed5('0x61')][0x9][_0x5ed5('0x62')]:undefined)||''},{'name':_0x5ed5('0x74'),'value':_0x57c5b0['attrChatWebsites']||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0[_0x5ed5('0x61')][0xa]?_0x57c5b0[_0x5ed5('0x61')][0xa][_0x5ed5('0x62')]:undefined)||''}];case _0x5ed5('0x7c'):return[{'name':_0x5ed5('0x7d'),'type':_0x57c5b0[_0x5ed5('0x7e')]||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0[_0x5ed5('0x61')][0x0]?_0x57c5b0['attrs'][0x0][_0x5ed5('0x37')]:undefined)||null,'value':_0x57c5b0['attrReport']||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0['attrs'][0x0]?_0x57c5b0[_0x5ed5('0x61')][0x0][_0x5ed5('0x62')]:undefined)||null},{'name':_0x5ed5('0x7f'),'value':_0x57c5b0[_0x5ed5('0x7f')]||(_0x57c5b0[_0x5ed5('0x61')]&&_0x57c5b0[_0x5ed5('0x61')][0x1]?_0x57c5b0[_0x5ed5('0x61')][0x1][_0x5ed5('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x3209a1){logger[_0x5ed5('0x30')]('widgetAttributes:\x20%s',JSON[_0x5ed5('0x80')](_0x3209a1));return[];}}exports[_0x5ed5('0x81')]=function(_0x5ea679,_0x4eeaa3,_0x5dcf20){if(_0x5ea679[_0x5ed5('0x5e')]['id']){delete _0x5ea679[_0x5ed5('0x5e')]['id'];}return db[_0x5ed5('0x4a')][_0x5ed5('0x50')]({'where':{'id':_0x5ea679[_0x5ed5('0x4f')]['id']}})[_0x5ed5('0x2b')](handleEntityNotFound(_0x4eeaa3,null))[_0x5ed5('0x2b')](function(_0x17f757){if(_0x17f757){_0x5ea679[_0x5ed5('0x5e')][_0x5ed5('0x82')]=_0x17f757['id'];_0x5ea679[_0x5ed5('0x5e')][_0x5ed5('0x61')]=widgetAttributes(_0x5ea679[_0x5ed5('0x5e')]);return db[_0x5ed5('0x83')][_0x5ed5('0x51')](_0x5ea679[_0x5ed5('0x5e')]);}})[_0x5ed5('0x2b')](respondWithResult(_0x4eeaa3,null))['catch'](handleError(_0x4eeaa3,null));};exports[_0x5ed5('0x84')]=function(_0x522d44,_0x5b2e24,_0x4eb0f9){var _0x394fba={};var _0x1ee736={};var _0x43c503;var _0x2e4e75;return db[_0x5ed5('0x4a')][_0x5ed5('0x85')]({'where':{'id':_0x522d44[_0x5ed5('0x4f')]['id']}})[_0x5ed5('0x2b')](handleEntityNotFound(_0x5b2e24,null))[_0x5ed5('0x2b')](function(_0x37d7d5){if(_0x37d7d5){_0x43c503=_0x37d7d5;_0x1ee736['model']=_[_0x5ed5('0x3a')](db[_0x5ed5('0x83')][_0x5ed5('0x35')]);_0x1ee736[_0x5ed5('0x3b')]=_[_0x5ed5('0x3a')](_0x522d44[_0x5ed5('0x3b')]);_0x1ee736[_0x5ed5('0x45')]=_[_0x5ed5('0x3c')](_0x1ee736[_0x5ed5('0x39')],_0x1ee736[_0x5ed5('0x3b')]);_0x394fba[_0x5ed5('0x3e')]=_[_0x5ed5('0x3c')](_0x1ee736['model'],qs[_0x5ed5('0x3d')](_0x522d44[_0x5ed5('0x3b')][_0x5ed5('0x3d')]));_0x394fba[_0x5ed5('0x3e')]=_0x394fba['attributes'][_0x5ed5('0x3f')]?_0x394fba[_0x5ed5('0x3e')]:_0x1ee736[_0x5ed5('0x39')];_0x394fba[_0x5ed5('0x42')]=qs[_0x5ed5('0x43')](_0x522d44[_0x5ed5('0x3b')][_0x5ed5('0x43')]);_0x394fba[_0x5ed5('0x44')]=qs['filters'](_[_0x5ed5('0x46')](_0x522d44[_0x5ed5('0x3b')],_0x1ee736['filters']));if(_0x522d44['query'][_0x5ed5('0x47')]){_0x394fba['where']=_[_0x5ed5('0x86')](_0x394fba['where'],{'$or':_[_0x5ed5('0x34')](_0x394fba[_0x5ed5('0x3e')],function(_0x26277b){var _0x28aa67={};_0x28aa67[_0x26277b]={'$like':'%'+_0x522d44[_0x5ed5('0x3b')][_0x5ed5('0x47')]+'%'};return _0x28aa67;})});}_0x394fba=_[_0x5ed5('0x86')]({},_0x394fba,_0x522d44[_0x5ed5('0x49')]);return _0x43c503[_0x5ed5('0x84')](_0x394fba);}})[_0x5ed5('0x2b')](function(_0xa1f3f9){if(_0xa1f3f9){_0x2e4e75=_0xa1f3f9[_0x5ed5('0x3f')];if(!_0x522d44['query'][_0x5ed5('0x40')](_0x5ed5('0x41'))){_0x394fba[_0x5ed5('0x24')]=qs[_0x5ed5('0x24')](_0x522d44['query'][_0x5ed5('0x24')]);_0x394fba[_0x5ed5('0x22')]=qs[_0x5ed5('0x22')](_0x522d44[_0x5ed5('0x3b')]['offset']);}return _0x43c503[_0x5ed5('0x84')](_0x394fba);}})['then'](function(_0xeaa0a9){if(_0xeaa0a9){return _0xeaa0a9?{'count':_0x2e4e75,'rows':_0xeaa0a9}:null;}})[_0x5ed5('0x2b')](respondWithResult(_0x5b2e24,null))[_0x5ed5('0x4d')](handleError(_0x5b2e24,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 62eff3d..3908539 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 _0xcfbf=['hook','exports','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x4d59fd,_0x4e7d6d){var _0x2a1c97=function(_0x2c9bc1){while(--_0x2c9bc1){_0x4d59fd['push'](_0x4d59fd['shift']());}};_0x2a1c97(++_0x4e7d6d);}(_0xcfbf,0x1f1));var _0xfcfb=function(_0x2ab767,_0x54ea35){_0x2ab767=_0x2ab767-0x0;var _0x2720b3=_0xcfbf[_0x2ab767];return _0x2720b3;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xfcfb('0x0'))['db'][_0xfcfb('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xfcfb('0x2')](0x0);var events={'afterCreate':_0xfcfb('0x3'),'afterUpdate':_0xfcfb('0x4'),'afterDestroy':_0xfcfb('0x5')};function emitEvent(_0xb8fc79){return function(_0x1ce038,_0x4c56ff,_0xf2ed04){DashboardEvents['emit'](_0xb8fc79+':'+_0x1ce038['id'],_0x1ce038);DashboardEvents['emit'](_0xb8fc79,_0x1ce038);_0xf2ed04(null);};}for(var e in events){if(events[_0xfcfb('0x6')](e)){var event=events[e];Dashboard[_0xfcfb('0x7')](e,emitEvent(event));}}module[_0xfcfb('0x8')]=DashboardEvents; \ No newline at end of file +var _0xa4bc=['setMaxListeners','save','update','remove','emit','hook','exports','events','Dashboard'];(function(_0x2cdad9,_0x39b1fb){var _0x3f6adf=function(_0x3a2312){while(--_0x3a2312){_0x2cdad9['push'](_0x2cdad9['shift']());}};_0x3f6adf(++_0x39b1fb);}(_0xa4bc,0xcd));var _0xca4b=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0xa4bc[_0x5471ec];return _0x121d4c;};'use strict';var EventEmitter=require(_0xca4b('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xca4b('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xca4b('0x2')](0x0);var events={'afterCreate':_0xca4b('0x3'),'afterUpdate':_0xca4b('0x4'),'afterDestroy':_0xca4b('0x5')};function emitEvent(_0x3cdc63){return function(_0x5a823c,_0x191399,_0x53ffbb){DashboardEvents[_0xca4b('0x6')](_0x3cdc63+':'+_0x5a823c['id'],_0x5a823c);DashboardEvents[_0xca4b('0x6')](_0x3cdc63,_0x5a823c);_0x53ffbb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xca4b('0x7')](e,emitEvent(event));}}module[_0xca4b('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 11f3424..b29be47 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 _0xf4ae=['rimraf','../../config/environment','./dashboard.attributes','define','Dashboard','dashboards','lodash','../../config/logger','api','moment','request-promise'];(function(_0x56702a,_0x55c095){var _0x4cb548=function(_0x37815c){while(--_0x37815c){_0x56702a['push'](_0x56702a['shift']());}};_0x4cb548(++_0x55c095);}(_0xf4ae,0x69));var _0xef4a=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0xf4ae[_0x47408e];return _0x1636bc;};'use strict';var _=require(_0xef4a('0x0'));var util=require('util');var logger=require(_0xef4a('0x1'))(_0xef4a('0x2'));var moment=require(_0xef4a('0x3'));var BPromise=require('bluebird');var rp=require(_0xef4a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef4a('0x5'));var config=require(_0xef4a('0x6'));var attributes=require(_0xef4a('0x7'));module['exports']=function(_0x50e532,_0x5cb368){return _0x50e532[_0xef4a('0x8')](_0xef4a('0x9'),attributes,{'tableName':_0xef4a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4266=['bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x56b402,_0x33af20){var _0x28064e=function(_0x400cbf){while(--_0x400cbf){_0x56b402['push'](_0x56b402['shift']());}};_0x28064e(++_0x33af20);}(_0x4266,0xa4));var _0x6426=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x4266[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x6426('0x0'));var util=require(_0x6426('0x1'));var logger=require(_0x6426('0x2'))(_0x6426('0x3'));var moment=require(_0x6426('0x4'));var BPromise=require(_0x6426('0x5'));var rp=require(_0x6426('0x6'));var fs=require('fs');var path=require(_0x6426('0x7'));var rimraf=require(_0x6426('0x8'));var config=require(_0x6426('0x9'));var attributes=require(_0x6426('0xa'));module[_0x6426('0xb')]=function(_0x392929,_0x52741a){return _0x392929[_0x6426('0xc')]('Dashboard',attributes,{'tableName':'dashboards','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 999ab69..6400760 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 _0xc6ad=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3ca802,_0x3b0bbd){var _0x3af123=function(_0x5384a1){while(--_0x5384a1){_0x3ca802['push'](_0x3ca802['shift']());}};_0x3af123(++_0x3b0bbd);}(_0xc6ad,0xe0));var _0xdc6a=function(_0x5b8554,_0x838904){_0x5b8554=_0x5b8554-0x0;var _0x2a99b9=_0xc6ad[_0x5b8554];return _0x2a99b9;};'use strict';var _=require(_0xdc6a('0x0'));var util=require(_0xdc6a('0x1'));var moment=require(_0xdc6a('0x2'));var BPromise=require(_0xdc6a('0x3'));var rs=require(_0xdc6a('0x4'));var fs=require('fs');var Redis=require(_0xdc6a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc6a('0x6'));var logger=require(_0xdc6a('0x7'))(_0xdc6a('0x8'));var config=require(_0xdc6a('0x9'));var jayson=require(_0xdc6a('0xa'));var client=jayson[_0xdc6a('0xb')][_0xdc6a('0xc')]({'port':0x232a});config[_0xdc6a('0xd')]=_[_0xdc6a('0xe')](config[_0xdc6a('0xd')],{'host':_0xdc6a('0xf'),'port':0x18eb});var socket=require(_0xdc6a('0x10'))(new Redis(config[_0xdc6a('0xd')]));require(_0xdc6a('0x11'))[_0xdc6a('0x12')](socket);function respondWithRpcPromise(_0x10cd8d,_0x4c5b1d,_0x103d0a){return new BPromise(function(_0x2beaa4,_0x154086){return client[_0xdc6a('0x13')](_0x10cd8d,_0x103d0a)['then'](function(_0x2e381d){logger[_0xdc6a('0x14')](_0xdc6a('0x15'),_0x4c5b1d,_0xdc6a('0x16'));logger[_0xdc6a('0x17')](_0xdc6a('0x18'),_0x4c5b1d,_0xdc6a('0x16'),JSON['stringify'](_0x2e381d));if(_0x2e381d[_0xdc6a('0x19')]){if(_0x2e381d[_0xdc6a('0x19')][_0xdc6a('0x1a')]===0x1f4){logger[_0xdc6a('0x19')](_0xdc6a('0x15'),_0x4c5b1d,_0x2e381d['error'][_0xdc6a('0x1b')]);return _0x154086(_0x2e381d['error'][_0xdc6a('0x1b')]);}logger['error'](_0xdc6a('0x15'),_0x4c5b1d,_0x2e381d[_0xdc6a('0x19')][_0xdc6a('0x1b')]);return _0x2beaa4(_0x2e381d[_0xdc6a('0x19')]['message']);}else{logger[_0xdc6a('0x14')](_0xdc6a('0x15'),_0x4c5b1d,_0xdc6a('0x16'));_0x2beaa4(_0x2e381d[_0xdc6a('0x1c')][_0xdc6a('0x1b')]);}})['catch'](function(_0x21b6d2){logger[_0xdc6a('0x19')](_0xdc6a('0x15'),_0x4c5b1d,_0x21b6d2);_0x154086(_0x21b6d2);});});} \ No newline at end of file +var _0xe1ff=['localhost','socket.io-emitter','register','request','then','info','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dashboard,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x5e3715,_0x55f0ea){var _0x3d9464=function(_0x4144b2){while(--_0x4144b2){_0x5e3715['push'](_0x5e3715['shift']());}};_0x3d9464(++_0x55f0ea);}(_0xe1ff,0x1e0));var _0xfe1f=function(_0x1eb8a2,_0x12cf9b){_0x1eb8a2=_0x1eb8a2-0x0;var _0xe82551=_0xe1ff[_0x1eb8a2];return _0xe82551;};'use strict';var _=require(_0xfe1f('0x0'));var util=require(_0xfe1f('0x1'));var moment=require(_0xfe1f('0x2'));var BPromise=require('bluebird');var rs=require(_0xfe1f('0x3'));var fs=require('fs');var Redis=require(_0xfe1f('0x4'));var db=require(_0xfe1f('0x5'))['db'];var utils=require(_0xfe1f('0x6'));var logger=require('../../config/logger')(_0xfe1f('0x7'));var config=require(_0xfe1f('0x8'));var jayson=require(_0xfe1f('0x9'));var client=jayson['client'][_0xfe1f('0xa')]({'port':0x232a});config[_0xfe1f('0xb')]=_[_0xfe1f('0xc')](config[_0xfe1f('0xb')],{'host':_0xfe1f('0xd'),'port':0x18eb});var socket=require(_0xfe1f('0xe'))(new Redis(config[_0xfe1f('0xb')]));require('./dashboard.socket')[_0xfe1f('0xf')](socket);function respondWithRpcPromise(_0x1c5574,_0x464a59,_0x4573cf){return new BPromise(function(_0x2f5ff6,_0x50f45f){return client[_0xfe1f('0x10')](_0x1c5574,_0x4573cf)[_0xfe1f('0x11')](function(_0x54671c){logger[_0xfe1f('0x12')]('Dashboard,\x20%s,\x20%s',_0x464a59,'request\x20sent');logger[_0xfe1f('0x13')](_0xfe1f('0x14'),_0x464a59,_0xfe1f('0x15'),JSON[_0xfe1f('0x16')](_0x54671c));if(_0x54671c[_0xfe1f('0x17')]){if(_0x54671c[_0xfe1f('0x17')][_0xfe1f('0x18')]===0x1f4){logger['error'](_0xfe1f('0x19'),_0x464a59,_0x54671c['error'][_0xfe1f('0x1a')]);return _0x50f45f(_0x54671c[_0xfe1f('0x17')]['message']);}logger[_0xfe1f('0x17')]('Dashboard,\x20%s,\x20%s',_0x464a59,_0x54671c[_0xfe1f('0x17')][_0xfe1f('0x1a')]);return _0x2f5ff6(_0x54671c['error'][_0xfe1f('0x1a')]);}else{logger[_0xfe1f('0x12')](_0xfe1f('0x19'),_0x464a59,_0xfe1f('0x15'));_0x2f5ff6(_0x54671c[_0xfe1f('0x1b')][_0xfe1f('0x1a')]);}})[_0xfe1f('0x1c')](function(_0xb212c6){logger[_0xfe1f('0x17')](_0xfe1f('0x19'),_0x464a59,_0xb212c6);_0x50f45f(_0xb212c6);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index df60d8b..8d804bf 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 _0x7b27=['register','dashboard:','save','remove','update','emit'];(function(_0x398c87,_0x3a24b0){var _0x40191f=function(_0x3f026b){while(--_0x3f026b){_0x398c87['push'](_0x398c87['shift']());}};_0x40191f(++_0x3a24b0);}(_0x7b27,0x188));var _0x77b2=function(_0x5446f9,_0x2fa0f9){_0x5446f9=_0x5446f9-0x0;var _0x48a887=_0x7b27[_0x5446f9];return _0x48a887;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x77b2('0x0'),_0x77b2('0x1'),_0x77b2('0x2')];function createListener(_0x5c1f66,_0x210859){return function(_0x560a7f){_0x210859[_0x77b2('0x3')](_0x5c1f66,_0x560a7f);};}function removeListener(_0x420664,_0x409dcf){return function(){DashboardEvents['removeListener'](_0x420664,_0x409dcf);};}exports[_0x77b2('0x4')]=function(_0x2f6d3d){for(var _0x4f4efa=0x0,_0x207924=events['length'];_0x4f4efa<_0x207924;_0x4f4efa++){var _0x5a1424=events[_0x4f4efa];var _0x50b27=createListener(_0x77b2('0x5')+_0x5a1424,_0x2f6d3d);DashboardEvents['on'](_0x5a1424,_0x50b27);}}; \ No newline at end of file +var _0x9800=['dashboard:','./dashboard.events','save','removeListener'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x9800,0x169));var _0x0980=function(_0x19afaf,_0x2b8911){_0x19afaf=_0x19afaf-0x0;var _0x25302f=_0x9800[_0x19afaf];return _0x25302f;};'use strict';var DashboardEvents=require(_0x0980('0x0'));var events=[_0x0980('0x1'),'remove','update'];function createListener(_0x777b9f,_0xe7c5da){return function(_0x5f3bd5){_0xe7c5da['emit'](_0x777b9f,_0x5f3bd5);};}function removeListener(_0x32e3ff,_0xa27fab){return function(){DashboardEvents[_0x0980('0x2')](_0x32e3ff,_0xa27fab);};}exports['register']=function(_0x3b94ab){for(var _0x3864d9=0x0,_0x213706=events['length'];_0x3864d9<_0x213706;_0x3864d9++){var _0xe7b66d=events[_0x3864d9];var _0x5c5ee5=createListener(_0x0980('0x3')+_0xe7b66d,_0x3b94ab);DashboardEvents['on'](_0xe7b66d,_0x5c5ee5);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index f3ef7f6..ce6b43d 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 _0xdc32=['post','/:id/clone','clone','addItem','put','update','delete','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','/:id/items','isAuthenticated','getItems','create'];(function(_0x49414d,_0x59379b){var _0x2c025a=function(_0x5d10c9){while(--_0x5d10c9){_0x49414d['push'](_0x49414d['shift']());}};_0x2c025a(++_0x59379b);}(_0xdc32,0x1bf));var _0x2dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc32[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x2dc3('0x0'));var path=require(_0x2dc3('0x1'));var timeout=require('connect-timeout');var express=require(_0x2dc3('0x2'));var router=express[_0x2dc3('0x3')]();var fs_extra=require(_0x2dc3('0x4'));var auth=require(_0x2dc3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2dc3('0x6'));var controller=require('./dashboard.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2dc3('0x7')](_0x2dc3('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x2dc3('0x7')](_0x2dc3('0x9'),auth[_0x2dc3('0xa')](),controller[_0x2dc3('0xb')]);router['post']('/',auth[_0x2dc3('0xa')](),controller[_0x2dc3('0xc')]);router[_0x2dc3('0xd')](_0x2dc3('0xe'),auth[_0x2dc3('0xa')](),controller[_0x2dc3('0xf')]);router['post'](_0x2dc3('0x9'),auth[_0x2dc3('0xa')](),controller[_0x2dc3('0x10')]);router[_0x2dc3('0x11')](_0x2dc3('0x8'),auth[_0x2dc3('0xa')](),controller[_0x2dc3('0x12')]);router[_0x2dc3('0x13')]('/:id',auth[_0x2dc3('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe1c7=['create','clone','/:id/items','addItem','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','show','getItems','post'];(function(_0xc6b104,_0x1d805a){var _0x1c6fce=function(_0x1bfb3f){while(--_0x1bfb3f){_0xc6b104['push'](_0xc6b104['shift']());}};_0x1c6fce(++_0x1d805a);}(_0xe1c7,0x1a1));var _0x7e1c=function(_0x20bc10,_0x35bed9){_0x20bc10=_0x20bc10-0x0;var _0x3bd5ce=_0xe1c7[_0x20bc10];return _0x3bd5ce;};'use strict';var multer=require('multer');var util=require(_0x7e1c('0x0'));var path=require(_0x7e1c('0x1'));var timeout=require(_0x7e1c('0x2'));var express=require(_0x7e1c('0x3'));var router=express[_0x7e1c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7e1c('0x5'));var interaction=require(_0x7e1c('0x6'));var config=require(_0x7e1c('0x7'));var controller=require(_0x7e1c('0x8'));router[_0x7e1c('0x9')]('/',auth[_0x7e1c('0xa')](),controller['index']);router[_0x7e1c('0x9')](_0x7e1c('0xb'),auth['isAuthenticated'](),controller[_0x7e1c('0xc')]);router[_0x7e1c('0x9')]('/:id/items',auth[_0x7e1c('0xa')](),controller[_0x7e1c('0xd')]);router[_0x7e1c('0xe')]('/',auth[_0x7e1c('0xa')](),controller[_0x7e1c('0xf')]);router[_0x7e1c('0xe')]('/:id/clone',auth[_0x7e1c('0xa')](),controller[_0x7e1c('0x10')]);router['post'](_0x7e1c('0x11'),auth[_0x7e1c('0xa')](),controller[_0x7e1c('0x12')]);router[_0x7e1c('0x13')]('/:id',auth[_0x7e1c('0xa')](),controller[_0x7e1c('0x14')]);router[_0x7e1c('0x15')](_0x7e1c('0xb'),auth[_0x7e1c('0xa')](),controller[_0x7e1c('0x16')]);module[_0x7e1c('0x17')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 02aed4d..f0a8998 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 _0x4975=['parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports','STRING','TEXT','long'];(function(_0x56442c,_0x46f7cd){var _0x5ed5dc=function(_0x4fbfc4){while(--_0x4fbfc4){_0x56442c['push'](_0x56442c['shift']());}};_0x5ed5dc(++_0x46f7cd);}(_0x4975,0x86));var _0x5497=function(_0x41d93c,_0x314e9b){_0x41d93c=_0x41d93c-0x0;var _0x102e80=_0x4975[_0x41d93c];return _0x102e80;};'use strict';var Sequelize=require(_0x5497('0x0'));var squel=require('squel');var _=require(_0x5497('0x1'));module[_0x5497('0x2')]={'title':{'type':Sequelize[_0x5497('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5497('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5497('0x4')](_0x5497('0x5')),'get':function(){try{return JSON[_0x5497('0x6')](this[_0x5497('0x7')](_0x5497('0x8')));}catch(_0x5d5272){return[];}},'set':function(_0x539a27){try{this[_0x5497('0x9')]('attrs',JSON[_0x5497('0xa')](_0x539a27));}catch(_0x674a2a){this[_0x5497('0x9')]('attrs',JSON[_0x5497('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5497('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5497('0xb')]},'col':{'type':Sequelize[_0x5497('0xb')]},'background':{'type':Sequelize[_0x5497('0x3')],'allowNull':![],'defaultValue':_0x5497('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5497('0x3')],'allowNull':![],'defaultValue':_0x5497('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5497('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xf494=['squel','lodash','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#2196f3','sequelize'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xf494,0x1c6));var _0x4f49=function(_0x3ea60f,_0x5d3d0e){_0x3ea60f=_0x3ea60f-0x0;var _0x3c31dc=_0xf494[_0x3ea60f];return _0x3c31dc;};'use strict';var Sequelize=require(_0x4f49('0x0'));var squel=require(_0x4f49('0x1'));var _=require(_0x4f49('0x2'));module['exports']={'title':{'type':Sequelize[_0x4f49('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4f49('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4f49('0x4')](_0x4f49('0x5')),'get':function(){try{return JSON[_0x4f49('0x6')](this[_0x4f49('0x7')](_0x4f49('0x8')));}catch(_0x790e8b){return[];}},'set':function(_0xc5e778){try{this[_0x4f49('0x9')](_0x4f49('0x8'),JSON['stringify'](_0xc5e778));}catch(_0x58e9a0){this[_0x4f49('0x9')](_0x4f49('0x8'),JSON[_0x4f49('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x4f49('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4f49('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4f49('0xb')]},'col':{'type':Sequelize[_0x4f49('0xb')]},'background':{'type':Sequelize[_0x4f49('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4f49('0x3')],'allowNull':![],'defaultValue':_0x4f49('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x4f49('0xb')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index fd882a9..fd7f037 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 _0x044a=['redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','offset','count','limit','Content-Range','json','apply','reject','save','update','then','error','name','send','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','catch','destroy','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie2','attrSerie3','web-report','attrReport','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x4c83d7,_0x357d1b){var _0x291c68=function(_0x596edd){while(--_0x596edd){_0x4c83d7['push'](_0x4c83d7['shift']());}};_0x291c68(++_0x357d1b);}(_0x044a,0x173));var _0xa044=function(_0x2e0516,_0x9e24cc){_0x2e0516=_0x2e0516-0x0;var _0x1d3594=_0x044a[_0x2e0516];return _0x1d3594;};'use strict';var emlformat=require(_0xa044('0x0'));var rimraf=require(_0xa044('0x1'));var zipdir=require(_0xa044('0x2'));var jsonpatch=require(_0xa044('0x3'));var rp=require(_0xa044('0x4'));var moment=require(_0xa044('0x5'));var BPromise=require(_0xa044('0x6'));var Mustache=require(_0xa044('0x7'));var util=require(_0xa044('0x8'));var path=require(_0xa044('0x9'));var sox=require('sox');var csv=require(_0xa044('0xa'));var ejs=require(_0xa044('0xb'));var fs=require('fs');var fs_extra=require(_0xa044('0xc'));var _=require(_0xa044('0xd'));var squel=require('squel');var crypto=require(_0xa044('0xe'));var jsforce=require(_0xa044('0xf'));var deskjs=require(_0xa044('0x10'));var toCsv=require(_0xa044('0xa'));var querystring=require('querystring');var Papa=require(_0xa044('0x11'));var Redis=require(_0xa044('0x12'));var authService=require(_0xa044('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa044('0x14'));var hardwareService=require(_0xa044('0x15'));var logger=require(_0xa044('0x16'))(_0xa044('0x17'));var utils=require('../../config/utils');var config=require(_0xa044('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa044('0x19')]=_[_0xa044('0x1a')](config[_0xa044('0x19')],{'host':_0xa044('0x1b'),'port':0x18eb});var socket=require(_0xa044('0x1c'))(new Redis(config[_0xa044('0x19')]));require(_0xa044('0x1d'))['register'](socket);function respondWithStatusCode(_0x31c5ae,_0x56c7c2){_0x56c7c2=_0x56c7c2||0xcc;return function(_0x18268b){if(_0x18268b){return _0x31c5ae[_0xa044('0x1e')](_0x56c7c2);}return _0x31c5ae[_0xa044('0x1f')](_0x56c7c2)[_0xa044('0x20')]();};}function respondWithResult(_0xeb7e4e,_0x4c7107){_0x4c7107=_0x4c7107||0xc8;return function(_0x516c34){if(_0x516c34){return _0xeb7e4e[_0xa044('0x1f')](_0x4c7107)['json'](_0x516c34);}};}function respondWithFilteredResult(_0x3ca144,_0x3361af){return function(_0x1b43c1){if(_0x1b43c1){var _0x9774ab=typeof _0x3361af[_0xa044('0x21')]==='undefined'&&typeof _0x3361af['limit']==='undefined';var _0x39422b=_0x1b43c1[_0xa044('0x22')];var _0x273f06=_0x9774ab?0x0:_0x3361af['offset'];var _0x2092d4=_0x9774ab?_0x1b43c1[_0xa044('0x22')]:_0x3361af['offset']+_0x3361af[_0xa044('0x23')];var _0x40999a;if(_0x2092d4>=_0x39422b){_0x2092d4=_0x39422b;_0x40999a=0xc8;}else{_0x40999a=0xce;}_0x3ca144[_0xa044('0x1f')](_0x40999a);return _0x3ca144['set'](_0xa044('0x24'),_0x273f06+'-'+_0x2092d4+'/'+_0x39422b)[_0xa044('0x25')](_0x1b43c1);}return null;};}function patchUpdates(_0x26747b){return function(_0xa7ae76){try{jsonpatch[_0xa044('0x26')](_0xa7ae76,_0x26747b,!![]);}catch(_0x3f4d03){return BPromise[_0xa044('0x27')](_0x3f4d03);}return _0xa7ae76[_0xa044('0x28')]();};}function saveUpdates(_0x36c237,_0x57ecd2){return function(_0x52fb9f){if(_0x52fb9f){return _0x52fb9f[_0xa044('0x29')](_0x36c237)[_0xa044('0x2a')](function(_0x228d5e){return _0x228d5e;});}return null;};}function removeEntity(_0x4c3d4b,_0x418756){return function(_0x253454){if(_0x253454){return _0x253454['destroy']()[_0xa044('0x2a')](function(){_0x4c3d4b[_0xa044('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c19da,_0x2889c2){return function(_0x5d28d8){if(!_0x5d28d8){_0x2c19da['sendStatus'](0x194);}return _0x5d28d8;};}function handleError(_0x47dcba,_0x265a0e){_0x265a0e=_0x265a0e||0x1f4;return function(_0x159519){logger[_0xa044('0x2b')](_0x159519['stack']);if(_0x159519[_0xa044('0x2c')]){delete _0x159519[_0xa044('0x2c')];}_0x47dcba['status'](_0x265a0e)[_0xa044('0x2d')](_0x159519);};}exports['show']=function(_0x50893d,_0x1cb1be){var _0x48ad57={'raw':![],'where':{'id':_0x50893d[_0xa044('0x2e')]['id']}},_0x30fd39={};_0x30fd39[_0xa044('0x2f')]=_[_0xa044('0x30')](db[_0xa044('0x31')][_0xa044('0x32')]);_0x30fd39['query']=_[_0xa044('0x30')](_0x50893d[_0xa044('0x33')]);_0x30fd39[_0xa044('0x34')]=_[_0xa044('0x35')](_0x30fd39['model'],_0x30fd39[_0xa044('0x33')]);_0x48ad57[_0xa044('0x36')]=_['intersection'](_0x30fd39['model'],qs[_0xa044('0x37')](_0x50893d[_0xa044('0x33')]['fields']));_0x48ad57[_0xa044('0x36')]=_0x48ad57[_0xa044('0x36')][_0xa044('0x38')]?_0x48ad57['attributes']:_0x30fd39[_0xa044('0x2f')];if(_0x50893d[_0xa044('0x33')][_0xa044('0x39')]){_0x48ad57[_0xa044('0x3a')]=[{'all':!![]}];}_0x48ad57=_[_0xa044('0x3b')]({},_0x48ad57,_0x50893d['options']);return db[_0xa044('0x31')][_0xa044('0x3c')](_0x48ad57)[_0xa044('0x2a')](handleEntityNotFound(_0x1cb1be,null))['then'](respondWithResult(_0x1cb1be,null))[_0xa044('0x3d')](handleError(_0x1cb1be,null));};exports[_0xa044('0x3e')]=function(_0x59d0d3,_0x2c17dc){return db[_0xa044('0x31')][_0xa044('0x3c')]({'where':{'id':_0x59d0d3[_0xa044('0x2e')]['id']}})[_0xa044('0x2a')](handleEntityNotFound(_0x2c17dc,null))[_0xa044('0x2a')](removeEntity(_0x2c17dc,null))[_0xa044('0x3d')](handleError(_0x2c17dc,null));};function widgetAttributes(_0x3b78a8){try{switch(_0x3b78a8['type']){case _0xa044('0x3f'):return[{'name':_0xa044('0x40'),'value':_0x3b78a8[_0xa044('0x40')]||(_0x3b78a8[_0xa044('0x41')]&&_0x3b78a8[_0xa044('0x41')][0x0]?_0x3b78a8['attrs'][0x0][_0xa044('0x42')]:undefined)||'https://'}];case _0xa044('0x43'):return[{'name':_0xa044('0x44'),'value':_0x3b78a8['attrPath']||(_0x3b78a8['attrs']&&_0x3b78a8['attrs'][0x0]?_0x3b78a8[_0xa044('0x41')][0x0][_0xa044('0x42')]:undefined)||''}];case _0xa044('0x45'):return[{'name':_0xa044('0x46'),'value':_0x3b78a8[_0xa044('0x46')]||(_0x3b78a8[_0xa044('0x41')]&&_0x3b78a8[_0xa044('0x41')][0x0]?_0x3b78a8[_0xa044('0x41')][0x0][_0xa044('0x42')]:undefined)||_0xa044('0x47')},{'name':'attrTimezone','value':_0x3b78a8[_0xa044('0x48')]||(_0x3b78a8[_0xa044('0x41')]&&_0x3b78a8[_0xa044('0x41')][0x1]?_0x3b78a8[_0xa044('0x41')][0x1][_0xa044('0x42')]:undefined)||_0xa044('0x49')},{'name':_0xa044('0x4a'),'value':_0x3b78a8[_0xa044('0x4a')]||(_0x3b78a8[_0xa044('0x41')]&&_0x3b78a8[_0xa044('0x41')][0x2]?_0x3b78a8['attrs'][0x2]['value']:undefined)||0xc}];case _0xa044('0x4b'):return[{'name':'attrMetric','value':_0x3b78a8[_0xa044('0x4c')]||(_0x3b78a8[_0xa044('0x41')]&&_0x3b78a8[_0xa044('0x41')][0x0]?_0x3b78a8[_0xa044('0x41')][0x0][_0xa044('0x42')]:undefined)||_0xa044('0x4d')},{'name':'attrVoiceQueues','value':_0x3b78a8[_0xa044('0x4e')]||(_0x3b78a8['attrs']&&_0x3b78a8[_0xa044('0x41')][0x1]?_0x3b78a8[_0xa044('0x41')][0x1][_0xa044('0x42')]:undefined)||[]},{'name':'attrFontSize','value':_0x3b78a8['attrFontSize']||(_0x3b78a8[_0xa044('0x41')]&&_0x3b78a8[_0xa044('0x41')][0x2]?_0x3b78a8[_0xa044('0x41')][0x2][_0xa044('0x42')]:undefined)||0x14},{'name':_0xa044('0x4f'),'value':_0x3b78a8[_0xa044('0x4f')]||(_0x3b78a8['attrs']&&_0x3b78a8[_0xa044('0x41')][0x3]?_0x3b78a8[_0xa044('0x41')][0x3][_0xa044('0x42')]:undefined)||_0xa044('0x50')},{'name':_0xa044('0x51'),'value':_0x3b78a8[_0xa044('0x51')]||(_0x3b78a8[_0xa044('0x41')]&&_0x3b78a8[_0xa044('0x41')][0x4]?_0x3b78a8[_0xa044('0x41')][0x4][_0xa044('0x42')]:undefined)||''},{'name':_0xa044('0x52'),'value':_0x3b78a8[_0xa044('0x52')]||(_0x3b78a8[_0xa044('0x41')]&&_0x3b78a8['attrs'][0x5]?_0x3b78a8[_0xa044('0x41')][0x5][_0xa044('0x42')]:undefined)||''},{'name':_0xa044('0x53'),'value':_0x3b78a8[_0xa044('0x53')]||(_0x3b78a8[_0xa044('0x41')]&&_0x3b78a8[_0xa044('0x41')][0x6]?_0x3b78a8[_0xa044('0x41')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3b78a8[_0xa044('0x54')]||(_0x3b78a8[_0xa044('0x41')]&&_0x3b78a8[_0xa044('0x41')][0x7]?_0x3b78a8[_0xa044('0x41')][0x7]['value']:undefined)||''},{'name':_0xa044('0x55'),'value':_0x3b78a8[_0xa044('0x55')]||(_0x3b78a8[_0xa044('0x41')]&&_0x3b78a8[_0xa044('0x41')][0x8]?_0x3b78a8[_0xa044('0x41')][0x8][_0xa044('0x42')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3b78a8[_0xa044('0x56')]||(_0x3b78a8['attrs']&&_0x3b78a8['attrs'][0x9]?_0x3b78a8[_0xa044('0x41')][0x9][_0xa044('0x42')]:undefined)||''}];case _0xa044('0x57'):case _0xa044('0x58'):return[{'name':'attrSerie1','value':_0x3b78a8['attrSerie1']||(_0x3b78a8['attrs']&&_0x3b78a8[_0xa044('0x41')][0x0]?_0x3b78a8[_0xa044('0x41')][0x0]['value']:undefined)||_0xa044('0x4d')},{'name':_0xa044('0x59'),'value':_0x3b78a8['attrSerie2']||(_0x3b78a8['attrs']&&_0x3b78a8[_0xa044('0x41')][0x1]?_0x3b78a8[_0xa044('0x41')][0x1][_0xa044('0x42')]:undefined)||null},{'name':_0xa044('0x5a'),'value':_0x3b78a8['attrSerie3']||(_0x3b78a8[_0xa044('0x41')]&&_0x3b78a8[_0xa044('0x41')][0x2]?_0x3b78a8[_0xa044('0x41')][0x2][_0xa044('0x42')]:undefined)||null},{'name':_0xa044('0x4e'),'value':_0x3b78a8[_0xa044('0x4e')]||(_0x3b78a8[_0xa044('0x41')]&&_0x3b78a8[_0xa044('0x41')][0x3]?_0x3b78a8[_0xa044('0x41')][0x3][_0xa044('0x42')]:undefined)||[]},{'name':_0xa044('0x4f'),'value':_0x3b78a8[_0xa044('0x4f')]||(_0x3b78a8[_0xa044('0x41')]&&_0x3b78a8[_0xa044('0x41')][0x4]?_0x3b78a8[_0xa044('0x41')][0x4]['value']:undefined)||_0xa044('0x50')},{'name':_0xa044('0x51'),'value':_0x3b78a8[_0xa044('0x51')]||(_0x3b78a8[_0xa044('0x41')]&&_0x3b78a8[_0xa044('0x41')][0x5]?_0x3b78a8[_0xa044('0x41')][0x5]['value']:undefined)||''},{'name':_0xa044('0x52'),'value':_0x3b78a8[_0xa044('0x52')]||(_0x3b78a8[_0xa044('0x41')]&&_0x3b78a8[_0xa044('0x41')][0x6]?_0x3b78a8[_0xa044('0x41')][0x6]['value']:undefined)||''},{'name':_0xa044('0x53'),'value':_0x3b78a8['attrSmsAccounts']||(_0x3b78a8['attrs']&&_0x3b78a8[_0xa044('0x41')][0x7]?_0x3b78a8[_0xa044('0x41')][0x7]['value']:undefined)||''},{'name':_0xa044('0x54'),'value':_0x3b78a8[_0xa044('0x54')]||(_0x3b78a8['attrs']&&_0x3b78a8[_0xa044('0x41')][0x8]?_0x3b78a8['attrs'][0x8]['value']:undefined)||''},{'name':_0xa044('0x55'),'value':_0x3b78a8['attrWhatsappAccounts']||(_0x3b78a8['attrs']&&_0x3b78a8[_0xa044('0x41')][0x9]?_0x3b78a8[_0xa044('0x41')][0x9][_0xa044('0x42')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3b78a8[_0xa044('0x56')]||(_0x3b78a8[_0xa044('0x41')]&&_0x3b78a8[_0xa044('0x41')][0xa]?_0x3b78a8[_0xa044('0x41')][0xa][_0xa044('0x42')]:undefined)||''}];case _0xa044('0x5b'):return[{'name':_0xa044('0x5c'),'type':_0x3b78a8['reportType']||(_0x3b78a8['attrs']&&_0x3b78a8[_0xa044('0x41')][0x0]?_0x3b78a8[_0xa044('0x41')][0x0][_0xa044('0x5d')]:undefined)||null,'value':_0x3b78a8[_0xa044('0x5c')]||(_0x3b78a8[_0xa044('0x41')]&&_0x3b78a8['attrs'][0x0]?_0x3b78a8[_0xa044('0x41')][0x0]['value']:undefined)||null},{'name':_0xa044('0x5e'),'value':_0x3b78a8[_0xa044('0x5e')]||(_0x3b78a8['attrs']&&_0x3b78a8['attrs'][0x1]?_0x3b78a8[_0xa044('0x41')][0x1][_0xa044('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x146e8d){logger[_0xa044('0x2b')](_0xa044('0x5f'),JSON[_0xa044('0x60')](_0x146e8d));return[];}}exports[_0xa044('0x61')]=function(_0x420180,_0xa408fc){if(_0x420180[_0xa044('0x62')]){_0x420180[_0xa044('0x62')]['attrs']=widgetAttributes(_0x420180['body']);}return db[_0xa044('0x31')][_0xa044('0x61')](_0x420180[_0xa044('0x62')],{})[_0xa044('0x2a')](respondWithResult(_0xa408fc,0xc9))['catch'](handleError(_0xa408fc,null));};exports['update']=function(_0x2296dc,_0x13845f){if(_0x2296dc[_0xa044('0x62')]['id']){delete _0x2296dc[_0xa044('0x62')]['id'];}_0x2296dc['body']['attrs']=widgetAttributes(_0x2296dc[_0xa044('0x62')]);return db['DashboardItem']['find']({'where':{'id':_0x2296dc['params']['id']}})[_0xa044('0x2a')](handleEntityNotFound(_0x13845f,null))['then'](saveUpdates(_0x2296dc[_0xa044('0x62')],null))[_0xa044('0x2a')](respondWithResult(_0x13845f,null))['catch'](handleError(_0x13845f,null));}; \ No newline at end of file +var _0x7c09=['params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrVoiceQueues','attrChatWebsites','web-report','attrReport','reportType','attrRefresh','stringify','body','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','show'];(function(_0x53d160,_0x1997c0){var _0x246ef1=function(_0x4e9597){while(--_0x4e9597){_0x53d160['push'](_0x53d160['shift']());}};_0x246ef1(++_0x1997c0);}(_0x7c09,0x102));var _0x97c0=function(_0x4a8160,_0x259693){_0x4a8160=_0x4a8160-0x0;var _0xa135c8=_0x7c09[_0x4a8160];return _0xa135c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97c0('0x0'));var zipdir=require(_0x97c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97c0('0x2'));var moment=require(_0x97c0('0x3'));var BPromise=require(_0x97c0('0x4'));var Mustache=require(_0x97c0('0x5'));var util=require(_0x97c0('0x6'));var path=require(_0x97c0('0x7'));var sox=require(_0x97c0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97c0('0x9'));var squel=require(_0x97c0('0xa'));var crypto=require(_0x97c0('0xb'));var jsforce=require(_0x97c0('0xc'));var deskjs=require(_0x97c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x97c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x97c0('0xf'));var authService=require(_0x97c0('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97c0('0x11'));var logger=require(_0x97c0('0x12'))(_0x97c0('0x13'));var utils=require(_0x97c0('0x14'));var config=require(_0x97c0('0x15'));var licenseUtil=require(_0x97c0('0x16'));var db=require(_0x97c0('0x17'))['db'];config[_0x97c0('0x18')]=_[_0x97c0('0x19')](config[_0x97c0('0x18')],{'host':_0x97c0('0x1a'),'port':0x18eb});var socket=require(_0x97c0('0x1b'))(new Redis(config[_0x97c0('0x18')]));require('./dashboardItem.socket')[_0x97c0('0x1c')](socket);function respondWithStatusCode(_0x15b336,_0xcac10b){_0xcac10b=_0xcac10b||0xcc;return function(_0x496017){if(_0x496017){return _0x15b336[_0x97c0('0x1d')](_0xcac10b);}return _0x15b336[_0x97c0('0x1e')](_0xcac10b)[_0x97c0('0x1f')]();};}function respondWithResult(_0x21e5f7,_0x482be5){_0x482be5=_0x482be5||0xc8;return function(_0x13d46e){if(_0x13d46e){return _0x21e5f7['status'](_0x482be5)[_0x97c0('0x20')](_0x13d46e);}};}function respondWithFilteredResult(_0x3ae7c4,_0x51180e){return function(_0x560ac0){if(_0x560ac0){var _0x16918b=typeof _0x51180e[_0x97c0('0x21')]===_0x97c0('0x22')&&typeof _0x51180e[_0x97c0('0x23')]===_0x97c0('0x22');var _0x4fed42=_0x560ac0[_0x97c0('0x24')];var _0x432705=_0x16918b?0x0:_0x51180e[_0x97c0('0x21')];var _0x4ca20a=_0x16918b?_0x560ac0['count']:_0x51180e[_0x97c0('0x21')]+_0x51180e[_0x97c0('0x23')];var _0x169f19;if(_0x4ca20a>=_0x4fed42){_0x4ca20a=_0x4fed42;_0x169f19=0xc8;}else{_0x169f19=0xce;}_0x3ae7c4['status'](_0x169f19);return _0x3ae7c4[_0x97c0('0x25')](_0x97c0('0x26'),_0x432705+'-'+_0x4ca20a+'/'+_0x4fed42)[_0x97c0('0x20')](_0x560ac0);}return null;};}function patchUpdates(_0x272314){return function(_0x30fba2){try{jsonpatch[_0x97c0('0x27')](_0x30fba2,_0x272314,!![]);}catch(_0x9dff60){return BPromise['reject'](_0x9dff60);}return _0x30fba2[_0x97c0('0x28')]();};}function saveUpdates(_0x29b3aa,_0x1f7adb){return function(_0x216785){if(_0x216785){return _0x216785['update'](_0x29b3aa)[_0x97c0('0x29')](function(_0x14cada){return _0x14cada;});}return null;};}function removeEntity(_0x52a429,_0x2ec9d6){return function(_0x2bb908){if(_0x2bb908){return _0x2bb908[_0x97c0('0x2a')]()['then'](function(){_0x52a429['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11b8ad,_0x8e3ee7){return function(_0x3a744c){if(!_0x3a744c){_0x11b8ad[_0x97c0('0x1d')](0x194);}return _0x3a744c;};}function handleError(_0x26939e,_0x153b14){_0x153b14=_0x153b14||0x1f4;return function(_0x4a3645){logger[_0x97c0('0x2b')](_0x4a3645[_0x97c0('0x2c')]);if(_0x4a3645[_0x97c0('0x2d')]){delete _0x4a3645['name'];}_0x26939e[_0x97c0('0x1e')](_0x153b14)[_0x97c0('0x2e')](_0x4a3645);};}exports[_0x97c0('0x2f')]=function(_0x23d2af,_0x2a7b2b){var _0x5c4e4e={'raw':![],'where':{'id':_0x23d2af[_0x97c0('0x30')]['id']}},_0x59abbb={};_0x59abbb[_0x97c0('0x31')]=_[_0x97c0('0x32')](db['DashboardItem'][_0x97c0('0x33')]);_0x59abbb[_0x97c0('0x34')]=_['keys'](_0x23d2af[_0x97c0('0x34')]);_0x59abbb[_0x97c0('0x35')]=_[_0x97c0('0x36')](_0x59abbb[_0x97c0('0x31')],_0x59abbb[_0x97c0('0x34')]);_0x5c4e4e[_0x97c0('0x37')]=_[_0x97c0('0x36')](_0x59abbb[_0x97c0('0x31')],qs[_0x97c0('0x38')](_0x23d2af[_0x97c0('0x34')][_0x97c0('0x38')]));_0x5c4e4e[_0x97c0('0x37')]=_0x5c4e4e[_0x97c0('0x37')][_0x97c0('0x39')]?_0x5c4e4e[_0x97c0('0x37')]:_0x59abbb['model'];if(_0x23d2af[_0x97c0('0x34')][_0x97c0('0x3a')]){_0x5c4e4e[_0x97c0('0x3b')]=[{'all':!![]}];}_0x5c4e4e=_[_0x97c0('0x3c')]({},_0x5c4e4e,_0x23d2af[_0x97c0('0x3d')]);return db[_0x97c0('0x3e')][_0x97c0('0x3f')](_0x5c4e4e)[_0x97c0('0x29')](handleEntityNotFound(_0x2a7b2b,null))['then'](respondWithResult(_0x2a7b2b,null))[_0x97c0('0x40')](handleError(_0x2a7b2b,null));};exports['destroy']=function(_0x23e482,_0x20291){return db[_0x97c0('0x3e')][_0x97c0('0x3f')]({'where':{'id':_0x23e482[_0x97c0('0x30')]['id']}})[_0x97c0('0x29')](handleEntityNotFound(_0x20291,null))[_0x97c0('0x29')](removeEntity(_0x20291,null))[_0x97c0('0x40')](handleError(_0x20291,null));};function widgetAttributes(_0x38f37a){try{switch(_0x38f37a[_0x97c0('0x41')]){case _0x97c0('0x42'):return[{'name':'attrUrl','value':_0x38f37a[_0x97c0('0x43')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a['attrs'][0x0]?_0x38f37a[_0x97c0('0x44')][0x0][_0x97c0('0x45')]:undefined)||_0x97c0('0x46')}];case _0x97c0('0x47'):return[{'name':'attrPath','value':_0x38f37a[_0x97c0('0x48')]||(_0x38f37a['attrs']&&_0x38f37a[_0x97c0('0x44')][0x0]?_0x38f37a[_0x97c0('0x44')][0x0]['value']:undefined)||''}];case _0x97c0('0x49'):return[{'name':_0x97c0('0x4a'),'value':_0x38f37a[_0x97c0('0x4a')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x0]?_0x38f37a[_0x97c0('0x44')][0x0][_0x97c0('0x45')]:undefined)||_0x97c0('0x4b')},{'name':_0x97c0('0x4c'),'value':_0x38f37a[_0x97c0('0x4c')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x1]?_0x38f37a[_0x97c0('0x44')][0x1]['value']:undefined)||_0x97c0('0x4d')},{'name':_0x97c0('0x4e'),'value':_0x38f37a[_0x97c0('0x4e')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x2]?_0x38f37a[_0x97c0('0x44')][0x2][_0x97c0('0x45')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x38f37a[_0x97c0('0x4f')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x0]?_0x38f37a[_0x97c0('0x44')][0x0][_0x97c0('0x45')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x38f37a['attrVoiceQueues']||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a['attrs'][0x1]?_0x38f37a['attrs'][0x1][_0x97c0('0x45')]:undefined)||[]},{'name':_0x97c0('0x4e'),'value':_0x38f37a[_0x97c0('0x4e')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x2]?_0x38f37a['attrs'][0x2][_0x97c0('0x45')]:undefined)||0x14},{'name':_0x97c0('0x50'),'value':_0x38f37a[_0x97c0('0x50')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x3]?_0x38f37a[_0x97c0('0x44')][0x3][_0x97c0('0x45')]:undefined)||_0x97c0('0x51')},{'name':_0x97c0('0x52'),'value':_0x38f37a[_0x97c0('0x52')]||(_0x38f37a['attrs']&&_0x38f37a[_0x97c0('0x44')][0x4]?_0x38f37a[_0x97c0('0x44')][0x4][_0x97c0('0x45')]:undefined)||''},{'name':_0x97c0('0x53'),'value':_0x38f37a['attrFaxAccounts']||(_0x38f37a['attrs']&&_0x38f37a[_0x97c0('0x44')][0x5]?_0x38f37a[_0x97c0('0x44')][0x5][_0x97c0('0x45')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x38f37a[_0x97c0('0x54')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x6]?_0x38f37a[_0x97c0('0x44')][0x6][_0x97c0('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x38f37a[_0x97c0('0x55')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x7]?_0x38f37a['attrs'][0x7]['value']:undefined)||''},{'name':_0x97c0('0x56'),'value':_0x38f37a['attrWhatsappAccounts']||(_0x38f37a['attrs']&&_0x38f37a[_0x97c0('0x44')][0x8]?_0x38f37a[_0x97c0('0x44')][0x8][_0x97c0('0x45')]:undefined)||''},{'name':'attrChatWebsites','value':_0x38f37a['attrChatWebsites']||(_0x38f37a['attrs']&&_0x38f37a[_0x97c0('0x44')][0x9]?_0x38f37a[_0x97c0('0x44')][0x9][_0x97c0('0x45')]:undefined)||''}];case _0x97c0('0x57'):case _0x97c0('0x58'):return[{'name':_0x97c0('0x59'),'value':_0x38f37a[_0x97c0('0x59')]||(_0x38f37a['attrs']&&_0x38f37a[_0x97c0('0x44')][0x0]?_0x38f37a[_0x97c0('0x44')][0x0][_0x97c0('0x45')]:undefined)||_0x97c0('0x5a')},{'name':_0x97c0('0x5b'),'value':_0x38f37a[_0x97c0('0x5b')]||(_0x38f37a['attrs']&&_0x38f37a[_0x97c0('0x44')][0x1]?_0x38f37a[_0x97c0('0x44')][0x1]['value']:undefined)||null},{'name':_0x97c0('0x5c'),'value':_0x38f37a[_0x97c0('0x5c')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x2]?_0x38f37a[_0x97c0('0x44')][0x2][_0x97c0('0x45')]:undefined)||null},{'name':_0x97c0('0x5d'),'value':_0x38f37a['attrVoiceQueues']||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x3]?_0x38f37a[_0x97c0('0x44')][0x3][_0x97c0('0x45')]:undefined)||[]},{'name':_0x97c0('0x50'),'value':_0x38f37a[_0x97c0('0x50')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x4]?_0x38f37a[_0x97c0('0x44')][0x4][_0x97c0('0x45')]:undefined)||_0x97c0('0x51')},{'name':_0x97c0('0x52'),'value':_0x38f37a[_0x97c0('0x52')]||(_0x38f37a['attrs']&&_0x38f37a[_0x97c0('0x44')][0x5]?_0x38f37a[_0x97c0('0x44')][0x5][_0x97c0('0x45')]:undefined)||''},{'name':_0x97c0('0x53'),'value':_0x38f37a[_0x97c0('0x53')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a['attrs'][0x6]?_0x38f37a[_0x97c0('0x44')][0x6][_0x97c0('0x45')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x38f37a[_0x97c0('0x54')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x7]?_0x38f37a['attrs'][0x7][_0x97c0('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x38f37a[_0x97c0('0x55')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x8]?_0x38f37a[_0x97c0('0x44')][0x8][_0x97c0('0x45')]:undefined)||''},{'name':_0x97c0('0x56'),'value':_0x38f37a[_0x97c0('0x56')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x9]?_0x38f37a[_0x97c0('0x44')][0x9][_0x97c0('0x45')]:undefined)||''},{'name':'attrChatWebsites','value':_0x38f37a[_0x97c0('0x5e')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0xa]?_0x38f37a[_0x97c0('0x44')][0xa]['value']:undefined)||''}];case _0x97c0('0x5f'):return[{'name':_0x97c0('0x60'),'type':_0x38f37a[_0x97c0('0x61')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a['attrs'][0x0]?_0x38f37a[_0x97c0('0x44')][0x0][_0x97c0('0x41')]:undefined)||null,'value':_0x38f37a[_0x97c0('0x60')]||(_0x38f37a['attrs']&&_0x38f37a[_0x97c0('0x44')][0x0]?_0x38f37a[_0x97c0('0x44')][0x0][_0x97c0('0x45')]:undefined)||null},{'name':_0x97c0('0x62'),'value':_0x38f37a[_0x97c0('0x62')]||(_0x38f37a[_0x97c0('0x44')]&&_0x38f37a[_0x97c0('0x44')][0x1]?_0x38f37a['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0xeb4eb3){logger[_0x97c0('0x2b')]('widgetAttributes:\x20%s',JSON[_0x97c0('0x63')](_0xeb4eb3));return[];}}exports['create']=function(_0x5dc808,_0x3518fb){if(_0x5dc808['body']){_0x5dc808[_0x97c0('0x64')][_0x97c0('0x44')]=widgetAttributes(_0x5dc808['body']);}return db['DashboardItem']['create'](_0x5dc808[_0x97c0('0x64')],{})['then'](respondWithResult(_0x3518fb,0xc9))[_0x97c0('0x40')](handleError(_0x3518fb,null));};exports[_0x97c0('0x65')]=function(_0xdbadf4,_0x26bed6){if(_0xdbadf4[_0x97c0('0x64')]['id']){delete _0xdbadf4[_0x97c0('0x64')]['id'];}_0xdbadf4[_0x97c0('0x64')][_0x97c0('0x44')]=widgetAttributes(_0xdbadf4[_0x97c0('0x64')]);return db[_0x97c0('0x3e')][_0x97c0('0x3f')]({'where':{'id':_0xdbadf4['params']['id']}})[_0x97c0('0x29')](handleEntityNotFound(_0x26bed6,null))[_0x97c0('0x29')](saveUpdates(_0xdbadf4[_0x97c0('0x64')],null))[_0x97c0('0x29')](respondWithResult(_0x26bed6,null))[_0x97c0('0x40')](handleError(_0x26bed6,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index f0e93d9..d303e3a 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 _0x15ad=['setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x3c0e33,_0x4e9903){var _0x48d10c=function(_0x227823){while(--_0x227823){_0x3c0e33['push'](_0x3c0e33['shift']());}};_0x48d10c(++_0x4e9903);}(_0x15ad,0x6e));var _0xd15a=function(_0x11c28f,_0x47c8c7){_0x11c28f=_0x11c28f-0x0;var _0x2fb0c2=_0x15ad[_0x11c28f];return _0x2fb0c2;};'use strict';var EventEmitter=require(_0xd15a('0x0'));var DashboardItem=require(_0xd15a('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd15a('0x2')](0x0);var events={'afterCreate':_0xd15a('0x3'),'afterUpdate':_0xd15a('0x4'),'afterDestroy':_0xd15a('0x5')};function emitEvent(_0x5f41a1){return function(_0x1df6f3,_0x39c8e8,_0x51ed41){DashboardItemEvents[_0xd15a('0x6')](_0x5f41a1+':'+_0x1df6f3['id'],_0x1df6f3);DashboardItemEvents[_0xd15a('0x6')](_0x5f41a1,_0x1df6f3);_0x51ed41(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xd15a('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x3a26=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xf621f9,_0x3c59a1){var _0xd178e1=function(_0x497125){while(--_0x497125){_0xf621f9['push'](_0xf621f9['shift']());}};_0xd178e1(++_0x3c59a1);}(_0x3a26,0x129));var _0x63a2=function(_0x4a44df,_0x2eb985){_0x4a44df=_0x4a44df-0x0;var _0x11481a=_0x3a26[_0x4a44df];return _0x11481a;};'use strict';var EventEmitter=require(_0x63a2('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x63a2('0x1')](0x0);var events={'afterCreate':_0x63a2('0x2'),'afterUpdate':_0x63a2('0x3'),'afterDestroy':_0x63a2('0x4')};function emitEvent(_0x399cf0){return function(_0x52d368,_0x1d2898,_0x178f68){DashboardItemEvents[_0x63a2('0x5')](_0x399cf0+':'+_0x52d368['id'],_0x52d368);DashboardItemEvents['emit'](_0x399cf0,_0x52d368);_0x178f68(null);};}for(var e in events){if(events[_0x63a2('0x6')](e)){var event=events[e];DashboardItem[_0x63a2('0x7')](e,emitEvent(event));}}module[_0x63a2('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index a6f2e14..1bbc825 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 _0xdfcc=['moment','bluebird','request-promise','rimraf','DashboardItem','dashboard_items','lodash','util','../../config/logger'];(function(_0x1c7a7f,_0x957855){var _0x505dd6=function(_0x1c1e6e){while(--_0x1c1e6e){_0x1c7a7f['push'](_0x1c7a7f['shift']());}};_0x505dd6(++_0x957855);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x132d12,_0x2c9799){_0x132d12=_0x132d12-0x0;var _0x1c3163=_0xdfcc[_0x132d12];return _0x1c3163;};'use strict';var _=require(_0xcdfc('0x0'));var util=require(_0xcdfc('0x1'));var logger=require(_0xcdfc('0x2'))('api');var moment=require(_0xcdfc('0x3'));var BPromise=require(_0xcdfc('0x4'));var rp=require(_0xcdfc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcdfc('0x6'));var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module['exports']=function(_0xa928f6,_0x155d4c){return _0xa928f6['define'](_0xcdfc('0x7'),attributes,{'tableName':_0xcdfc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dec=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','exports','define','DashboardItem','lodash'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9dec,0x1d3));var _0xc9de=function(_0x51d121,_0x6a9a0b){_0x51d121=_0x51d121-0x0;var _0x10a0ce=_0x9dec[_0x51d121];return _0x10a0ce;};'use strict';var _=require(_0xc9de('0x0'));var util=require('util');var logger=require(_0xc9de('0x1'))(_0xc9de('0x2'));var moment=require(_0xc9de('0x3'));var BPromise=require(_0xc9de('0x4'));var rp=require(_0xc9de('0x5'));var fs=require('fs');var path=require(_0xc9de('0x6'));var rimraf=require(_0xc9de('0x7'));var config=require('../../config/environment');var attributes=require(_0xc9de('0x8'));module[_0xc9de('0x9')]=function(_0x193ae3,_0x40148e){return _0x193ae3[_0xc9de('0xa')](_0xc9de('0xb'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index acc9b63..a329f83 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 _0x36ff=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','request\x20sent','debug','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','result','lodash','util'];(function(_0x382168,_0xe03b6a){var _0x3ecf7e=function(_0x17b089){while(--_0x17b089){_0x382168['push'](_0x382168['shift']());}};_0x3ecf7e(++_0xe03b6a);}(_0x36ff,0xe8));var _0xf36f=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x36ff[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0xf36f('0x0'));var util=require(_0xf36f('0x1'));var moment=require(_0xf36f('0x2'));var BPromise=require(_0xf36f('0x3'));var rs=require(_0xf36f('0x4'));var fs=require('fs');var Redis=require(_0xf36f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf36f('0x6'));var logger=require(_0xf36f('0x7'))('rpc');var config=require(_0xf36f('0x8'));var jayson=require(_0xf36f('0x9'));var client=jayson[_0xf36f('0xa')]['http']({'port':0x232a});config[_0xf36f('0xb')]=_['defaults'](config[_0xf36f('0xb')],{'host':_0xf36f('0xc'),'port':0x18eb});var socket=require(_0xf36f('0xd'))(new Redis(config['redis']));require(_0xf36f('0xe'))[_0xf36f('0xf')](socket);function respondWithRpcPromise(_0x2f02f5,_0x384345,_0x1b3d96){return new BPromise(function(_0x4d9323,_0x5b3ec2){return client[_0xf36f('0x10')](_0x2f02f5,_0x1b3d96)[_0xf36f('0x11')](function(_0x26f310){logger['info']('DashboardItem,\x20%s,\x20%s',_0x384345,_0xf36f('0x12'));logger[_0xf36f('0x13')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x384345,_0xf36f('0x12'),JSON[_0xf36f('0x14')](_0x26f310));if(_0x26f310[_0xf36f('0x15')]){if(_0x26f310[_0xf36f('0x15')][_0xf36f('0x16')]===0x1f4){logger[_0xf36f('0x15')]('DashboardItem,\x20%s,\x20%s',_0x384345,_0x26f310[_0xf36f('0x15')][_0xf36f('0x17')]);return _0x5b3ec2(_0x26f310[_0xf36f('0x15')]['message']);}logger[_0xf36f('0x15')](_0xf36f('0x18'),_0x384345,_0x26f310[_0xf36f('0x15')][_0xf36f('0x17')]);return _0x4d9323(_0x26f310[_0xf36f('0x15')][_0xf36f('0x17')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x384345,_0xf36f('0x12'));_0x4d9323(_0x26f310[_0xf36f('0x19')][_0xf36f('0x17')]);}})['catch'](function(_0x36d2f6){logger[_0xf36f('0x15')](_0xf36f('0x18'),_0x384345,_0x36d2f6);_0x5b3ec2(_0x36d2f6);});});} \ No newline at end of file +var _0x7b99=['then','info','DashboardItem,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request'];(function(_0x446d7e,_0x3e8d84){var _0x2566de=function(_0x251f3b){while(--_0x251f3b){_0x446d7e['push'](_0x446d7e['shift']());}};_0x2566de(++_0x3e8d84);}(_0x7b99,0x64));var _0x97b9=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x7b99[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x97b9('0x0'));var util=require(_0x97b9('0x1'));var moment=require(_0x97b9('0x2'));var BPromise=require(_0x97b9('0x3'));var rs=require(_0x97b9('0x4'));var fs=require('fs');var Redis=require(_0x97b9('0x5'));var db=require(_0x97b9('0x6'))['db'];var utils=require(_0x97b9('0x7'));var logger=require(_0x97b9('0x8'))('rpc');var config=require(_0x97b9('0x9'));var jayson=require(_0x97b9('0xa'));var client=jayson[_0x97b9('0xb')][_0x97b9('0xc')]({'port':0x232a});config[_0x97b9('0xd')]=_[_0x97b9('0xe')](config[_0x97b9('0xd')],{'host':_0x97b9('0xf'),'port':0x18eb});var socket=require(_0x97b9('0x10'))(new Redis(config[_0x97b9('0xd')]));require(_0x97b9('0x11'))[_0x97b9('0x12')](socket);function respondWithRpcPromise(_0x482b03,_0x56165c,_0x4eb105){return new BPromise(function(_0x1884f2,_0x32fac6){return client[_0x97b9('0x13')](_0x482b03,_0x4eb105)[_0x97b9('0x14')](function(_0x7142e8){logger[_0x97b9('0x15')](_0x97b9('0x16'),_0x56165c,'request\x20sent');logger[_0x97b9('0x17')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x56165c,_0x97b9('0x18'),JSON['stringify'](_0x7142e8));if(_0x7142e8[_0x97b9('0x19')]){if(_0x7142e8[_0x97b9('0x19')][_0x97b9('0x1a')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x56165c,_0x7142e8[_0x97b9('0x19')]['message']);return _0x32fac6(_0x7142e8[_0x97b9('0x19')][_0x97b9('0x1b')]);}logger[_0x97b9('0x19')](_0x97b9('0x16'),_0x56165c,_0x7142e8[_0x97b9('0x19')]['message']);return _0x1884f2(_0x7142e8[_0x97b9('0x19')]['message']);}else{logger[_0x97b9('0x15')](_0x97b9('0x16'),_0x56165c,'request\x20sent');_0x1884f2(_0x7142e8[_0x97b9('0x1c')]['message']);}})[_0x97b9('0x1d')](function(_0x56436c){logger['error'](_0x97b9('0x16'),_0x56165c,_0x56436c);_0x32fac6(_0x56436c);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 0856b6c..12bfa36 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 _0xbc0f=['register','length','save','remove','update','emit','removeListener'];(function(_0x1b9c2a,_0x50582e){var _0x21ab47=function(_0x3382c6){while(--_0x3382c6){_0x1b9c2a['push'](_0x1b9c2a['shift']());}};_0x21ab47(++_0x50582e);}(_0xbc0f,0x9c));var _0xfbc0=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xbc0f[_0x50a0c2];return _0x5ebadd;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xfbc0('0x0'),_0xfbc0('0x1'),_0xfbc0('0x2')];function createListener(_0xd59f8d,_0xeac5ea){return function(_0x2668f5){_0xeac5ea[_0xfbc0('0x3')](_0xd59f8d,_0x2668f5);};}function removeListener(_0x28d776,_0x371c11){return function(){DashboardItemEvents[_0xfbc0('0x4')](_0x28d776,_0x371c11);};}exports[_0xfbc0('0x5')]=function(_0x32d6f9){for(var _0xd7ccba=0x0,_0x537b63=events[_0xfbc0('0x6')];_0xd7ccba<_0x537b63;_0xd7ccba++){var _0x5721ef=events[_0xd7ccba];var _0x3a4b8d=createListener('dashboardItem:'+_0x5721ef,_0x32d6f9);DashboardItemEvents['on'](_0x5721ef,_0x3a4b8d);}}; \ No newline at end of file +var _0x9c37=['dashboardItem:','./dashboardItem.events','remove','update','register','length'];(function(_0x566786,_0x2fc0ec){var _0x719735=function(_0x431f98){while(--_0x431f98){_0x566786['push'](_0x566786['shift']());}};_0x719735(++_0x2fc0ec);}(_0x9c37,0x1f3));var _0x79c3=function(_0x593a17,_0xa08e9b){_0x593a17=_0x593a17-0x0;var _0x12c116=_0x9c37[_0x593a17];return _0x12c116;};'use strict';var DashboardItemEvents=require(_0x79c3('0x0'));var events=['save',_0x79c3('0x1'),_0x79c3('0x2')];function createListener(_0x5b15c2,_0x19d3ad){return function(_0x1f2d26){_0x19d3ad['emit'](_0x5b15c2,_0x1f2d26);};}function removeListener(_0x13bd48,_0x3ef48a){return function(){DashboardItemEvents['removeListener'](_0x13bd48,_0x3ef48a);};}exports[_0x79c3('0x3')]=function(_0x5111de){for(var _0x17d276=0x0,_0x32909a=events[_0x79c3('0x4')];_0x17d276<_0x32909a;_0x17d276++){var _0x35c82c=events[_0x17d276];var _0x3c230c=createListener(_0x79c3('0x5')+_0x35c82c,_0x5111de);DashboardItemEvents['on'](_0x35c82c,_0x3c230c);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index b9e1c0c..24f7817 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 _0xaedc=['update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','post','isAuthenticated','put'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xaedc,0x1cf));var _0xcaed=function(_0x2db82d,_0x2576f7){_0x2db82d=_0x2db82d-0x0;var _0x424948=_0xaedc[_0x2db82d];return _0x424948;};'use strict';var multer=require(_0xcaed('0x0'));var util=require('util');var path=require(_0xcaed('0x1'));var timeout=require(_0xcaed('0x2'));var express=require('express');var router=express[_0xcaed('0x3')]();var fs_extra=require(_0xcaed('0x4'));var auth=require(_0xcaed('0x5'));var interaction=require(_0xcaed('0x6'));var config=require(_0xcaed('0x7'));var controller=require('./dashboardItem.controller');router['get'](_0xcaed('0x8'),auth['isAuthenticated'](),controller[_0xcaed('0x9')]);router[_0xcaed('0xa')]('/',auth[_0xcaed('0xb')](),controller['create']);router[_0xcaed('0xc')]('/:id',auth[_0xcaed('0xb')](),controller[_0xcaed('0xd')]);router[_0xcaed('0xe')]('/:id',auth[_0xcaed('0xb')](),controller[_0xcaed('0xf')]);module[_0xcaed('0x10')]=router; \ No newline at end of file +var _0xfeea=['get','/:id','isAuthenticated','show','post','update','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller'];(function(_0x9ec5ea,_0x10b401){var _0x4f0d51=function(_0x3abee7){while(--_0x3abee7){_0x9ec5ea['push'](_0x9ec5ea['shift']());}};_0x4f0d51(++_0x10b401);}(_0xfeea,0x84));var _0xafee=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0xfeea[_0x41d02a];return _0x4c3983;};'use strict';var multer=require(_0xafee('0x0'));var util=require(_0xafee('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xafee('0x2'));var router=express[_0xafee('0x3')]();var fs_extra=require(_0xafee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xafee('0x5'));var config=require(_0xafee('0x6'));var controller=require(_0xafee('0x7'));router[_0xafee('0x8')](_0xafee('0x9'),auth[_0xafee('0xa')](),controller[_0xafee('0xb')]);router[_0xafee('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xafee('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 8c9a392..b021f17 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 _0x1582=['sequelize','exports','ENUM','first','second','third','STRING'];(function(_0x1598cc,_0x2a0c25){var _0x53252a=function(_0xa9fa99){while(--_0xa9fa99){_0x1598cc['push'](_0x1598cc['shift']());}};_0x53252a(++_0x2a0c25);}(_0x1582,0x142));var _0x2158=function(_0x12fe32,_0x1d5358){_0x12fe32=_0x12fe32-0x0;var _0x1701f5=_0x1582[_0x12fe32];return _0x1701f5;};'use strict';var Sequelize=require(_0x2158('0x0'));module[_0x2158('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x2158('0x2')](_0x2158('0x3'),_0x2158('0x4'),_0x2158('0x5')),'allowNull':![],'defaultValue':_0x2158('0x3')},'description':{'type':Sequelize[_0x2158('0x6')]}}; \ No newline at end of file +var _0x4cdd=['second','sequelize','exports','STRING','ENUM','first'];(function(_0x3cc4bd,_0x7d752c){var _0x54c47f=function(_0x447c7c){while(--_0x447c7c){_0x3cc4bd['push'](_0x3cc4bd['shift']());}};_0x54c47f(++_0x7d752c);}(_0x4cdd,0x1ab));var _0xd4cd=function(_0x719b9b,_0xd9ec4f){_0x719b9b=_0x719b9b-0x0;var _0x6a01f9=_0x4cdd[_0x719b9b];return _0x6a01f9;};'use strict';var Sequelize=require(_0xd4cd('0x0'));module[_0xd4cd('0x1')]={'name':{'type':Sequelize[_0xd4cd('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xd4cd('0x3')](_0xd4cd('0x4'),_0xd4cd('0x5'),'third'),'allowNull':![],'defaultValue':_0xd4cd('0x4')},'description':{'type':Sequelize[_0xd4cd('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 12839fd..06da2d8 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 _0x31c2=['../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','Disposition','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','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'];(function(_0x172ed7,_0x3d08fd){var _0xfa8f61=function(_0xe07a21){while(--_0xe07a21){_0x172ed7['push'](_0x172ed7['shift']());}};_0xfa8f61(++_0x3d08fd);}(_0x31c2,0x1e1));var _0x231c=function(_0x84bf0e,_0x1f670c){_0x84bf0e=_0x84bf0e-0x0;var _0x522689=_0x31c2[_0x84bf0e];return _0x522689;};'use strict';var emlformat=require(_0x231c('0x0'));var rimraf=require(_0x231c('0x1'));var zipdir=require(_0x231c('0x2'));var jsonpatch=require(_0x231c('0x3'));var rp=require(_0x231c('0x4'));var moment=require(_0x231c('0x5'));var BPromise=require(_0x231c('0x6'));var Mustache=require(_0x231c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x231c('0x8'));var csv=require(_0x231c('0x9'));var ejs=require(_0x231c('0xa'));var fs=require('fs');var fs_extra=require(_0x231c('0xb'));var _=require('lodash');var squel=require(_0x231c('0xc'));var crypto=require('crypto');var jsforce=require(_0x231c('0xd'));var deskjs=require(_0x231c('0xe'));var toCsv=require(_0x231c('0x9'));var querystring=require('querystring');var Papa=require(_0x231c('0xf'));var Redis=require(_0x231c('0x10'));var authService=require(_0x231c('0x11'));var qs=require(_0x231c('0x12'));var as=require(_0x231c('0x13'));var hardwareService=require(_0x231c('0x14'));var logger=require(_0x231c('0x15'))('api');var utils=require(_0x231c('0x16'));var config=require(_0x231c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x231c('0x18'))['db'];function respondWithStatusCode(_0x43c270,_0x871ed1){_0x871ed1=_0x871ed1||0xcc;return function(_0x1aa3fe){if(_0x1aa3fe){return _0x43c270[_0x231c('0x19')](_0x871ed1);}return _0x43c270[_0x231c('0x1a')](_0x871ed1)[_0x231c('0x1b')]();};}function respondWithResult(_0x3355f6,_0xc09de5){_0xc09de5=_0xc09de5||0xc8;return function(_0x311218){if(_0x311218){return _0x3355f6[_0x231c('0x1a')](_0xc09de5)[_0x231c('0x1c')](_0x311218);}};}function respondWithFilteredResult(_0xe37de8,_0x1f7764){return function(_0x12a6ad){if(_0x12a6ad){var _0x210f2e=typeof _0x1f7764[_0x231c('0x1d')]===_0x231c('0x1e')&&typeof _0x1f7764[_0x231c('0x1f')]===_0x231c('0x1e');var _0x51b8ca=_0x12a6ad[_0x231c('0x20')];var _0x341645=_0x210f2e?0x0:_0x1f7764[_0x231c('0x1d')];var _0xadea80=_0x210f2e?_0x12a6ad[_0x231c('0x20')]:_0x1f7764[_0x231c('0x1d')]+_0x1f7764[_0x231c('0x1f')];var _0x172d50;if(_0xadea80>=_0x51b8ca){_0xadea80=_0x51b8ca;_0x172d50=0xc8;}else{_0x172d50=0xce;}_0xe37de8[_0x231c('0x1a')](_0x172d50);return _0xe37de8[_0x231c('0x21')]('Content-Range',_0x341645+'-'+_0xadea80+'/'+_0x51b8ca)[_0x231c('0x1c')](_0x12a6ad);}return null;};}function patchUpdates(_0x5e8a53){return function(_0x872034){try{jsonpatch['apply'](_0x872034,_0x5e8a53,!![]);}catch(_0x42cca3){return BPromise[_0x231c('0x22')](_0x42cca3);}return _0x872034[_0x231c('0x23')]();};}function saveUpdates(_0x3267f9,_0x255671){return function(_0x309393){if(_0x309393){return _0x309393[_0x231c('0x24')](_0x3267f9)[_0x231c('0x25')](function(_0x54566f){return _0x54566f;});}return null;};}function removeEntity(_0x128112,_0x3336d8){return function(_0x4af49b){if(_0x4af49b){return _0x4af49b[_0x231c('0x26')]()[_0x231c('0x25')](function(){var _0x5c569a=_0x4af49b[_0x231c('0x27')]({'plain':!![]});var _0x564939=_0x231c('0x28');return db[_0x231c('0x29')][_0x231c('0x26')]({'where':{'type':_0x564939,'resourceId':_0x5c569a['id']}})[_0x231c('0x25')](function(){return _0x4af49b;});})[_0x231c('0x25')](function(){_0x128112[_0x231c('0x1a')](0xcc)[_0x231c('0x1b')]();});}};}function handleEntityNotFound(_0x4caf68,_0x33cc46){return function(_0x1b53bc){if(!_0x1b53bc){_0x4caf68['sendStatus'](0x194);}return _0x1b53bc;};}function handleError(_0x3a0ca4,_0x40f820){_0x40f820=_0x40f820||0x1f4;return function(_0x45ced8){logger[_0x231c('0x2a')](_0x45ced8[_0x231c('0x2b')]);if(_0x45ced8[_0x231c('0x2c')]){delete _0x45ced8[_0x231c('0x2c')];}_0x3a0ca4['status'](_0x40f820)[_0x231c('0x2d')](_0x45ced8);};}exports[_0x231c('0x2e')]=function(_0x578512,_0x4be2e2){var _0x5bfc50={},_0x9f459={},_0x5d39fa={'count':0x0,'rows':[]};var _0x222df9=_['map'](db[_0x231c('0x2f')][_0x231c('0x30')],function(_0x6fb073){return{'name':_0x6fb073[_0x231c('0x31')],'type':_0x6fb073['type'][_0x231c('0x32')]};});_0x9f459[_0x231c('0x33')]=_[_0x231c('0x34')](_0x222df9,_0x231c('0x2c'));_0x9f459[_0x231c('0x35')]=_[_0x231c('0x36')](_0x578512[_0x231c('0x35')]);_0x9f459[_0x231c('0x37')]=_['intersection'](_0x9f459['model'],_0x9f459[_0x231c('0x35')]);_0x5bfc50[_0x231c('0x38')]=_[_0x231c('0x39')](_0x9f459[_0x231c('0x33')],qs[_0x231c('0x3a')](_0x578512[_0x231c('0x35')]['fields']));_0x5bfc50[_0x231c('0x38')]=_0x5bfc50[_0x231c('0x38')]['length']?_0x5bfc50['attributes']:_0x9f459[_0x231c('0x33')];if(!_0x578512['query'][_0x231c('0x3b')]('nolimit')){_0x5bfc50[_0x231c('0x1f')]=qs[_0x231c('0x1f')](_0x578512['query'][_0x231c('0x1f')]);_0x5bfc50[_0x231c('0x1d')]=qs[_0x231c('0x1d')](_0x578512['query'][_0x231c('0x1d')]);}_0x5bfc50[_0x231c('0x3c')]=qs[_0x231c('0x3d')](_0x578512[_0x231c('0x35')][_0x231c('0x3d')]);_0x5bfc50[_0x231c('0x3e')]=qs[_0x231c('0x37')](_[_0x231c('0x3f')](_0x578512[_0x231c('0x35')],_0x9f459[_0x231c('0x37')]),_0x222df9);if(_0x578512[_0x231c('0x35')][_0x231c('0x40')]){_0x5bfc50[_0x231c('0x3e')]=_['merge'](_0x5bfc50[_0x231c('0x3e')],{'$or':_[_0x231c('0x34')](_0x222df9,function(_0x41c9e2){if(_0x41c9e2[_0x231c('0x41')]!==_0x231c('0x42')){var _0x5a002e={};_0x5a002e[_0x41c9e2[_0x231c('0x2c')]]={'$like':'%'+_0x578512[_0x231c('0x35')][_0x231c('0x40')]+'%'};return _0x5a002e;}})});}_0x5bfc50=_['merge']({},_0x5bfc50,_0x578512[_0x231c('0x43')]);var _0x145c17={'where':_0x5bfc50[_0x231c('0x3e')]};return db[_0x231c('0x2f')][_0x231c('0x20')](_0x145c17)[_0x231c('0x25')](function(_0x5d46eb){_0x5d39fa[_0x231c('0x20')]=_0x5d46eb;if(_0x578512[_0x231c('0x35')][_0x231c('0x44')]){_0x5bfc50[_0x231c('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x231c('0x46')](_0x5bfc50);})['then'](function(_0x26bfd2){_0x5d39fa['rows']=_0x26bfd2;return _0x5d39fa;})[_0x231c('0x25')](respondWithFilteredResult(_0x4be2e2,_0x5bfc50))[_0x231c('0x47')](handleError(_0x4be2e2,null));};exports[_0x231c('0x48')]=function(_0x232e81,_0x87beaf){var _0xa0f301={'raw':!![],'where':{'id':_0x232e81[_0x231c('0x49')]['id']}},_0x592eb2={};_0x592eb2[_0x231c('0x33')]=_[_0x231c('0x36')](db['Disposition'][_0x231c('0x30')]);_0x592eb2[_0x231c('0x35')]=_[_0x231c('0x36')](_0x232e81[_0x231c('0x35')]);_0x592eb2['filters']=_[_0x231c('0x39')](_0x592eb2['model'],_0x592eb2[_0x231c('0x35')]);_0xa0f301[_0x231c('0x38')]=_[_0x231c('0x39')](_0x592eb2[_0x231c('0x33')],qs[_0x231c('0x3a')](_0x232e81[_0x231c('0x35')][_0x231c('0x3a')]));_0xa0f301[_0x231c('0x38')]=_0xa0f301[_0x231c('0x38')][_0x231c('0x4a')]?_0xa0f301[_0x231c('0x38')]:_0x592eb2[_0x231c('0x33')];if(_0x232e81[_0x231c('0x35')][_0x231c('0x44')]){_0xa0f301['include']=[{'all':!![]}];}_0xa0f301=_[_0x231c('0x4b')]({},_0xa0f301,_0x232e81[_0x231c('0x43')]);return db[_0x231c('0x2f')][_0x231c('0x4c')](_0xa0f301)[_0x231c('0x25')](handleEntityNotFound(_0x87beaf,null))['then'](respondWithResult(_0x87beaf,null))['catch'](handleError(_0x87beaf,null));};exports[_0x231c('0x4d')]=function(_0x56a885,_0x419f63){return db[_0x231c('0x2f')][_0x231c('0x4d')](_0x56a885['body'],{})[_0x231c('0x25')](function(_0x4af7f8){var _0x2c9336=_0x56a885[_0x231c('0x4e')]['get']({'plain':!![]});if(!_0x2c9336)throw new Error(_0x231c('0x4f'));if(_0x2c9336[_0x231c('0x50')]===_0x231c('0x4e')){var _0x5d2d20=_0x4af7f8['get']({'plain':!![]});var _0x4a93af=_0x231c('0x28');return db[_0x231c('0x51')][_0x231c('0x4c')]({'where':{'name':_0x4a93af,'userProfileId':_0x2c9336['userProfileId']},'raw':!![]})[_0x231c('0x25')](function(_0x3b1305){if(_0x3b1305&&_0x3b1305[_0x231c('0x52')]===0x0){return db[_0x231c('0x29')][_0x231c('0x4d')]({'name':_0x5d2d20[_0x231c('0x2c')],'resourceId':_0x5d2d20['id'],'type':_0x3b1305[_0x231c('0x2c')],'sectionId':_0x3b1305['id']},{})[_0x231c('0x25')](function(){return _0x4af7f8;});}else{return _0x4af7f8;}})[_0x231c('0x47')](function(_0x2f2e5a){logger[_0x231c('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f2e5a);throw _0x2f2e5a;});}return _0x4af7f8;})[_0x231c('0x25')](respondWithResult(_0x419f63,0xc9))[_0x231c('0x47')](handleError(_0x419f63,null));};exports['update']=function(_0x2656e4,_0x49f298){if(_0x2656e4[_0x231c('0x53')]['id']){delete _0x2656e4[_0x231c('0x53')]['id'];}return db[_0x231c('0x2f')][_0x231c('0x4c')]({'where':{'id':_0x2656e4[_0x231c('0x49')]['id']}})[_0x231c('0x25')](handleEntityNotFound(_0x49f298,null))[_0x231c('0x25')](saveUpdates(_0x2656e4[_0x231c('0x53')],null))[_0x231c('0x25')](respondWithResult(_0x49f298,null))[_0x231c('0x47')](handleError(_0x49f298,null));};exports['destroy']=function(_0x3cbbb3,_0x1c4a13){return db[_0x231c('0x2f')]['find']({'where':{'id':_0x3cbbb3[_0x231c('0x49')]['id']}})[_0x231c('0x25')](handleEntityNotFound(_0x1c4a13,null))['then'](removeEntity(_0x1c4a13,null))[_0x231c('0x47')](handleError(_0x1c4a13,null));}; \ No newline at end of file +var _0x3841=['includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','error','body','eml-format','rimraf','request-promise','bluebird','mustache','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','Dispositions','UserProfileResource','end','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','Disposition','include','findAll','rows','params','keys'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x3841,0x1da));var _0x1384=function(_0x3d8ba1,_0x5ba1fd){_0x3d8ba1=_0x3d8ba1-0x0;var _0x87804e=_0x3841[_0x3d8ba1];return _0x87804e;};'use strict';var emlformat=require(_0x1384('0x0'));var rimraf=require(_0x1384('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1384('0x2'));var moment=require('moment');var BPromise=require(_0x1384('0x3'));var Mustache=require(_0x1384('0x4'));var util=require('util');var path=require('path');var sox=require(_0x1384('0x5'));var csv=require('to-csv');var ejs=require(_0x1384('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1384('0x7'));var crypto=require(_0x1384('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x1384('0x9'));var toCsv=require(_0x1384('0xa'));var querystring=require(_0x1384('0xb'));var Papa=require(_0x1384('0xc'));var Redis=require('ioredis');var authService=require(_0x1384('0xd'));var qs=require(_0x1384('0xe'));var as=require(_0x1384('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1384('0x10'))(_0x1384('0x11'));var utils=require(_0x1384('0x12'));var config=require(_0x1384('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39ec5a,_0xb7fa66){_0xb7fa66=_0xb7fa66||0xcc;return function(_0x21ebcd){if(_0x21ebcd){return _0x39ec5a['sendStatus'](_0xb7fa66);}return _0x39ec5a[_0x1384('0x14')](_0xb7fa66)['end']();};}function respondWithResult(_0x30f2d9,_0x467b62){_0x467b62=_0x467b62||0xc8;return function(_0x1202d0){if(_0x1202d0){return _0x30f2d9['status'](_0x467b62)[_0x1384('0x15')](_0x1202d0);}};}function respondWithFilteredResult(_0x5bd7c0,_0x11e914){return function(_0x42e293){if(_0x42e293){var _0x5a3c3e=typeof _0x11e914['offset']==='undefined'&&typeof _0x11e914[_0x1384('0x16')]===_0x1384('0x17');var _0x330937=_0x42e293[_0x1384('0x18')];var _0x47d1cd=_0x5a3c3e?0x0:_0x11e914['offset'];var _0x1c4cc0=_0x5a3c3e?_0x42e293[_0x1384('0x18')]:_0x11e914[_0x1384('0x19')]+_0x11e914['limit'];var _0x4ba7c8;if(_0x1c4cc0>=_0x330937){_0x1c4cc0=_0x330937;_0x4ba7c8=0xc8;}else{_0x4ba7c8=0xce;}_0x5bd7c0[_0x1384('0x14')](_0x4ba7c8);return _0x5bd7c0['set'](_0x1384('0x1a'),_0x47d1cd+'-'+_0x1c4cc0+'/'+_0x330937)[_0x1384('0x15')](_0x42e293);}return null;};}function patchUpdates(_0x23f4e1){return function(_0x24ffa4){try{jsonpatch[_0x1384('0x1b')](_0x24ffa4,_0x23f4e1,!![]);}catch(_0x16ac7e){return BPromise[_0x1384('0x1c')](_0x16ac7e);}return _0x24ffa4[_0x1384('0x1d')]();};}function saveUpdates(_0xf9fd06,_0x327887){return function(_0x20568a){if(_0x20568a){return _0x20568a[_0x1384('0x1e')](_0xf9fd06)[_0x1384('0x1f')](function(_0x35dcfb){return _0x35dcfb;});}return null;};}function removeEntity(_0x497f51,_0x5b6ee2){return function(_0x14491b){if(_0x14491b){return _0x14491b[_0x1384('0x20')]()[_0x1384('0x1f')](function(){var _0x37b20e=_0x14491b['get']({'plain':!![]});var _0x52f7db=_0x1384('0x21');return db[_0x1384('0x22')][_0x1384('0x20')]({'where':{'type':_0x52f7db,'resourceId':_0x37b20e['id']}})[_0x1384('0x1f')](function(){return _0x14491b;});})[_0x1384('0x1f')](function(){_0x497f51['status'](0xcc)[_0x1384('0x23')]();});}};}function handleEntityNotFound(_0x1fe024,_0x29c2d4){return function(_0x24eb4f){if(!_0x24eb4f){_0x1fe024['sendStatus'](0x194);}return _0x24eb4f;};}function handleError(_0x54a007,_0x25d6f4){_0x25d6f4=_0x25d6f4||0x1f4;return function(_0x4faaba){logger['error'](_0x4faaba[_0x1384('0x24')]);if(_0x4faaba[_0x1384('0x25')]){delete _0x4faaba[_0x1384('0x25')];}_0x54a007[_0x1384('0x14')](_0x25d6f4)[_0x1384('0x26')](_0x4faaba);};}exports[_0x1384('0x27')]=function(_0x2127c1,_0x5acd3a){var _0x399f89={},_0x8b166={},_0xde8c4f={'count':0x0,'rows':[]};var _0x42c771=_[_0x1384('0x28')](db['Disposition'][_0x1384('0x29')],function(_0x4fbb59){return{'name':_0x4fbb59['fieldName'],'type':_0x4fbb59[_0x1384('0x2a')][_0x1384('0x2b')]};});_0x8b166[_0x1384('0x2c')]=_[_0x1384('0x28')](_0x42c771,_0x1384('0x25'));_0x8b166[_0x1384('0x2d')]=_['keys'](_0x2127c1['query']);_0x8b166[_0x1384('0x2e')]=_[_0x1384('0x2f')](_0x8b166['model'],_0x8b166[_0x1384('0x2d')]);_0x399f89[_0x1384('0x30')]=_[_0x1384('0x2f')](_0x8b166[_0x1384('0x2c')],qs[_0x1384('0x31')](_0x2127c1['query'][_0x1384('0x31')]));_0x399f89[_0x1384('0x30')]=_0x399f89[_0x1384('0x30')][_0x1384('0x32')]?_0x399f89[_0x1384('0x30')]:_0x8b166[_0x1384('0x2c')];if(!_0x2127c1[_0x1384('0x2d')]['hasOwnProperty'](_0x1384('0x33'))){_0x399f89[_0x1384('0x16')]=qs[_0x1384('0x16')](_0x2127c1[_0x1384('0x2d')][_0x1384('0x16')]);_0x399f89[_0x1384('0x19')]=qs[_0x1384('0x19')](_0x2127c1[_0x1384('0x2d')][_0x1384('0x19')]);}_0x399f89[_0x1384('0x34')]=qs[_0x1384('0x35')](_0x2127c1[_0x1384('0x2d')][_0x1384('0x35')]);_0x399f89[_0x1384('0x36')]=qs[_0x1384('0x2e')](_[_0x1384('0x37')](_0x2127c1[_0x1384('0x2d')],_0x8b166[_0x1384('0x2e')]),_0x42c771);if(_0x2127c1[_0x1384('0x2d')][_0x1384('0x38')]){_0x399f89[_0x1384('0x36')]=_[_0x1384('0x39')](_0x399f89[_0x1384('0x36')],{'$or':_[_0x1384('0x28')](_0x42c771,function(_0xd6e96e){if(_0xd6e96e[_0x1384('0x2a')]!=='VIRTUAL'){var _0x5f3385={};_0x5f3385[_0xd6e96e['name']]={'$like':'%'+_0x2127c1[_0x1384('0x2d')][_0x1384('0x38')]+'%'};return _0x5f3385;}})});}_0x399f89=_[_0x1384('0x39')]({},_0x399f89,_0x2127c1[_0x1384('0x3a')]);var _0x4146b3={'where':_0x399f89['where']};return db[_0x1384('0x3b')][_0x1384('0x18')](_0x4146b3)['then'](function(_0x2ba170){_0xde8c4f[_0x1384('0x18')]=_0x2ba170;if(_0x2127c1[_0x1384('0x2d')]['includeAll']){_0x399f89[_0x1384('0x3c')]=[{'all':!![]}];}return db[_0x1384('0x3b')][_0x1384('0x3d')](_0x399f89);})[_0x1384('0x1f')](function(_0x1c07e1){_0xde8c4f[_0x1384('0x3e')]=_0x1c07e1;return _0xde8c4f;})[_0x1384('0x1f')](respondWithFilteredResult(_0x5acd3a,_0x399f89))['catch'](handleError(_0x5acd3a,null));};exports['show']=function(_0x461120,_0xf34bd0){var _0x4fd5b5={'raw':!![],'where':{'id':_0x461120[_0x1384('0x3f')]['id']}},_0x2fc2aa={};_0x2fc2aa['model']=_['keys'](db['Disposition'][_0x1384('0x29')]);_0x2fc2aa[_0x1384('0x2d')]=_[_0x1384('0x40')](_0x461120['query']);_0x2fc2aa[_0x1384('0x2e')]=_[_0x1384('0x2f')](_0x2fc2aa['model'],_0x2fc2aa['query']);_0x4fd5b5[_0x1384('0x30')]=_[_0x1384('0x2f')](_0x2fc2aa[_0x1384('0x2c')],qs['fields'](_0x461120[_0x1384('0x2d')][_0x1384('0x31')]));_0x4fd5b5[_0x1384('0x30')]=_0x4fd5b5[_0x1384('0x30')][_0x1384('0x32')]?_0x4fd5b5['attributes']:_0x2fc2aa[_0x1384('0x2c')];if(_0x461120['query'][_0x1384('0x41')]){_0x4fd5b5['include']=[{'all':!![]}];}_0x4fd5b5=_[_0x1384('0x39')]({},_0x4fd5b5,_0x461120[_0x1384('0x3a')]);return db[_0x1384('0x3b')][_0x1384('0x42')](_0x4fd5b5)['then'](handleEntityNotFound(_0xf34bd0,null))[_0x1384('0x1f')](respondWithResult(_0xf34bd0,null))[_0x1384('0x43')](handleError(_0xf34bd0,null));};exports[_0x1384('0x44')]=function(_0x216a89,_0x24e54f){return db[_0x1384('0x3b')][_0x1384('0x44')](_0x216a89['body'],{})[_0x1384('0x1f')](function(_0xaa097c){var _0x20cb17=_0x216a89[_0x1384('0x45')]['get']({'plain':!![]});if(!_0x20cb17)throw new Error(_0x1384('0x46'));if(_0x20cb17['role']==='user'){var _0x4c8a5b=_0xaa097c[_0x1384('0x47')]({'plain':!![]});var _0x4c2d36='Dispositions';return db[_0x1384('0x48')][_0x1384('0x42')]({'where':{'name':_0x4c2d36,'userProfileId':_0x20cb17[_0x1384('0x49')]},'raw':!![]})[_0x1384('0x1f')](function(_0x19de3a){if(_0x19de3a&&_0x19de3a[_0x1384('0x4a')]===0x0){return db[_0x1384('0x22')][_0x1384('0x44')]({'name':_0x4c8a5b['name'],'resourceId':_0x4c8a5b['id'],'type':_0x19de3a[_0x1384('0x25')],'sectionId':_0x19de3a['id']},{})[_0x1384('0x1f')](function(){return _0xaa097c;});}else{return _0xaa097c;}})[_0x1384('0x43')](function(_0x36317e){logger[_0x1384('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36317e);throw _0x36317e;});}return _0xaa097c;})[_0x1384('0x1f')](respondWithResult(_0x24e54f,0xc9))[_0x1384('0x43')](handleError(_0x24e54f,null));};exports[_0x1384('0x1e')]=function(_0x3bc9e9,_0x3d60db){if(_0x3bc9e9[_0x1384('0x4c')]['id']){delete _0x3bc9e9['body']['id'];}return db[_0x1384('0x3b')][_0x1384('0x42')]({'where':{'id':_0x3bc9e9[_0x1384('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3d60db,null))[_0x1384('0x1f')](saveUpdates(_0x3bc9e9[_0x1384('0x4c')],null))[_0x1384('0x1f')](respondWithResult(_0x3d60db,null))[_0x1384('0x43')](handleError(_0x3d60db,null));};exports[_0x1384('0x20')]=function(_0x58d1db,_0x4b5824){return db[_0x1384('0x3b')][_0x1384('0x42')]({'where':{'id':_0x58d1db[_0x1384('0x3f')]['id']}})[_0x1384('0x1f')](handleEntityNotFound(_0x4b5824,null))[_0x1384('0x1f')](removeEntity(_0x4b5824,null))['catch'](handleError(_0x4b5824,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 1ed626b..c7fd077 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 _0xe086=['request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','name','name_chat','ChatWebsiteId','MailAccountId','name_sms','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xfacb90,_0x75399b){var _0x2ac8b8=function(_0x10cc64){while(--_0x10cc64){_0xfacb90['push'](_0xfacb90['shift']());}};_0x2ac8b8(++_0x75399b);}(_0xe086,0x14a));var _0x6e08=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe086[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6e08('0x0'));var util=require(_0x6e08('0x1'));var logger=require(_0x6e08('0x2'))(_0x6e08('0x3'));var moment=require(_0x6e08('0x4'));var BPromise=require(_0x6e08('0x5'));var rp=require(_0x6e08('0x6'));var fs=require('fs');var path=require(_0x6e08('0x7'));var rimraf=require(_0x6e08('0x8'));var config=require(_0x6e08('0x9'));var attributes=require(_0x6e08('0xa'));module[_0x6e08('0xb')]=function(_0x5bae7d,_0x11dcb5){return _0x5bae7d[_0x6e08('0xc')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x6e08('0xd'),'ListId']},{'unique':!![],'name':_0x6e08('0xe'),'fields':[_0x6e08('0xd'),_0x6e08('0xf')]},{'unique':!![],'name':'name_mail','fields':[_0x6e08('0xd'),_0x6e08('0x10')]},{'unique':!![],'name':_0x6e08('0x11'),'fields':[_0x6e08('0xd'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0x6e08('0xd'),'FaxAccountId']},{'unique':!![],'name':_0x6e08('0x12'),'fields':[_0x6e08('0xd'),'OpenchannelAccountId']},{'unique':!![],'name':_0x6e08('0x13'),'fields':[_0x6e08('0xd'),_0x6e08('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf4a1=['path','rimraf','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name','ListId','name_chat','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','../../config/logger','api'];(function(_0x459e16,_0x1d46b6){var _0x24209f=function(_0x1f54e0){while(--_0x1f54e0){_0x459e16['push'](_0x459e16['shift']());}};_0x24209f(++_0x1d46b6);}(_0xf4a1,0x151));var _0x1f4a=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0xf4a1[_0x1e2080];return _0x260111;};'use strict';var _=require(_0x1f4a('0x0'));var util=require('util');var logger=require(_0x1f4a('0x1'))(_0x1f4a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f4a('0x3'));var rimraf=require(_0x1f4a('0x4'));var config=require(_0x1f4a('0x5'));var attributes=require(_0x1f4a('0x6'));module[_0x1f4a('0x7')]=function(_0x2950ae,_0x36d091){return _0x2950ae[_0x1f4a('0x8')]('Disposition',attributes,{'tableName':_0x1f4a('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x1f4a('0xa'),_0x1f4a('0xb')]},{'unique':!![],'name':_0x1f4a('0xc'),'fields':[_0x1f4a('0xa'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x1f4a('0xa'),_0x1f4a('0xd')]},{'unique':!![],'name':_0x1f4a('0xe'),'fields':[_0x1f4a('0xa'),'SmsAccountId']},{'unique':!![],'name':_0x1f4a('0xf'),'fields':[_0x1f4a('0xa'),_0x1f4a('0x10')]},{'unique':!![],'name':_0x1f4a('0x11'),'fields':['name',_0x1f4a('0x12')]},{'unique':!![],'name':_0x1f4a('0x13'),'fields':[_0x1f4a('0xa'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 906026f..e259072 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(_0x368c8a,_0xc05e63){var _0x43e0de=function(_0x44194d){while(--_0x44194d){_0x368c8a['push'](_0x368c8a['shift']());}};_0x43e0de(++_0xc05e63);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3e1cc2,_0x250d5f){var _0x372556=function(_0x360ab0){while(--_0x360ab0){_0x3e1cc2['push'](_0x3e1cc2['shift']());}};_0x372556(++_0x250d5f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 c80f23e..cb8a6fe 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 _0x5dc1=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x5e108f,_0x24196e){var _0x1104c4=function(_0xa4f4b0){while(--_0xa4f4b0){_0x5e108f['push'](_0x5e108f['shift']());}};_0x1104c4(++_0x24196e);}(_0x5dc1,0x1cb));var _0x15dc=function(_0x404019,_0x56682d){_0x404019=_0x404019-0x0;var _0x5846b4=_0x5dc1[_0x404019];return _0x5846b4;};'use strict';var multer=require(_0x15dc('0x0'));var util=require(_0x15dc('0x1'));var path=require('path');var timeout=require(_0x15dc('0x2'));var express=require(_0x15dc('0x3'));var router=express['Router']();var fs_extra=require(_0x15dc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x15dc('0x5'));var config=require(_0x15dc('0x6'));var controller=require(_0x15dc('0x7'));router[_0x15dc('0x8')]('/',auth[_0x15dc('0x9')](),controller[_0x15dc('0xa')]);router[_0x15dc('0x8')](_0x15dc('0xb'),auth[_0x15dc('0x9')](),controller[_0x15dc('0xc')]);router[_0x15dc('0xd')]('/',auth[_0x15dc('0x9')](),controller[_0x15dc('0xe')]);router[_0x15dc('0xf')](_0x15dc('0xb'),auth[_0x15dc('0x9')](),controller[_0x15dc('0x10')]);router[_0x15dc('0x11')](_0x15dc('0xb'),auth[_0x15dc('0x9')](),controller[_0x15dc('0x12')]);module[_0x15dc('0x13')]=router; \ No newline at end of file +var _0x5d26=['destroy','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','show','create','/:id','update','delete'];(function(_0x5b306c,_0x5a7bd3){var _0x4ff9ce=function(_0x21c437){while(--_0x21c437){_0x5b306c['push'](_0x5b306c['shift']());}};_0x4ff9ce(++_0x5a7bd3);}(_0x5d26,0xc4));var _0x65d2=function(_0xfa7f86,_0x1b7554){_0xfa7f86=_0xfa7f86-0x0;var _0x4986f7=_0x5d26[_0xfa7f86];return _0x4986f7;};'use strict';var multer=require('multer');var util=require(_0x65d2('0x0'));var path=require(_0x65d2('0x1'));var timeout=require('connect-timeout');var express=require(_0x65d2('0x2'));var router=express['Router']();var fs_extra=require(_0x65d2('0x3'));var auth=require(_0x65d2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x65d2('0x5'));var controller=require(_0x65d2('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x65d2('0x7')]('/:id',auth[_0x65d2('0x8')](),controller[_0x65d2('0x9')]);router['post']('/',auth[_0x65d2('0x8')](),controller[_0x65d2('0xa')]);router['put'](_0x65d2('0xb'),auth[_0x65d2('0x8')](),controller[_0x65d2('0xc')]);router[_0x65d2('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x65d2('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 2d21f8d..f983779 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 _0x9759=['yes','localstationid','2400','4800','7200','12000','14400','9600','v17,v27,v29','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM'];(function(_0x33dcf7,_0x3d5390){var _0x542d4e=function(_0x281250){while(--_0x281250){_0x33dcf7['push'](_0x33dcf7['shift']());}};_0x542d4e(++_0x3d5390);}(_0x9759,0x11d));var _0x9975=function(_0xcafa40,_0x44f42e){_0xcafa40=_0xcafa40-0x0;var _0x1d4309=_0x9759[_0xcafa40];return _0x1d4309;};'use strict';var Sequelize=require(_0x9975('0x0'));module['exports']={'name':{'type':Sequelize[_0x9975('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x9975('0x2')](_0x9975('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x9975('0x1')],'unique':_0x9975('0x4')},'minrate':{'type':Sequelize[_0x9975('0x2')](_0x9975('0x5'),_0x9975('0x6'),_0x9975('0x7'),'9600',_0x9975('0x8'),_0x9975('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0x9975('0x5'),_0x9975('0x6'),_0x9975('0x7'),_0x9975('0xa'),'12000','14400'),'defaultValue':_0x9975('0x9')},'modem':{'type':Sequelize[_0x9975('0x1')],'defaultValue':_0x9975('0xb')},'gateway':{'type':Sequelize[_0x9975('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x9975('0x2')](_0x9975('0xc'),'IAX',_0x9975('0xd'),_0x9975('0xe')),'defaultValue':_0x9975('0xc')},'key':{'type':Sequelize[_0x9975('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9975('0xf')],'defaultValue':function(){return _0x9975('0x10');}},'notificationSound':{'type':Sequelize[_0x9975('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9975('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9975('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9975('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9975('0x12')],'allowNull':!![],'defaultValue':null,'comment':_0x9975('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x9975('0x11')],'defaultValue':![],'comment':_0x9975('0x14'),'set':function(_0x288fe6){if(!_0x288fe6)this[_0x9975('0x15')](_0x9975('0x16'),null);this[_0x9975('0x15')](_0x9975('0x17'),_0x288fe6);}}}; \ No newline at end of file +var _0x5196=['localstationid','7200','9600','12000','4800','2400','14400','v17,v27,v29','INTEGER','ENUM','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING','yes','xCALLY\x20Motion\x20Fax'];(function(_0x5645ad,_0x580ea3){var _0x17d292=function(_0xe66902){while(--_0xe66902){_0x5645ad['push'](_0x5645ad['shift']());}};_0x17d292(++_0x580ea3);}(_0x5196,0x164));var _0x6519=function(_0xa539a2,_0x12cd7d){_0xa539a2=_0xa539a2-0x0;var _0x47fd3d=_0x5196[_0xa539a2];return _0x47fd3d;};'use strict';var Sequelize=require(_0x6519('0x0'));module['exports']={'name':{'type':Sequelize[_0x6519('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0x6519('0x2'),'no'),'defaultValue':_0x6519('0x2')},'headerinfo':{'type':Sequelize[_0x6519('0x1')],'defaultValue':_0x6519('0x3')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x6519('0x4')},'minrate':{'type':Sequelize['ENUM']('2400','4800',_0x6519('0x5'),_0x6519('0x6'),_0x6519('0x7'),'14400'),'defaultValue':_0x6519('0x8')},'maxrate':{'type':Sequelize['ENUM'](_0x6519('0x9'),'4800','7200',_0x6519('0x6'),'12000','14400'),'defaultValue':_0x6519('0xa')},'modem':{'type':Sequelize[_0x6519('0x1')],'defaultValue':_0x6519('0xb')},'gateway':{'type':Sequelize[_0x6519('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6519('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x6519('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6519('0xd')](_0x6519('0xe'),_0x6519('0xf'),_0x6519('0x10'),_0x6519('0x11')),'defaultValue':_0x6519('0xe')},'key':{'type':Sequelize[_0x6519('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6519('0x12')],'defaultValue':function(){return _0x6519('0x13');}},'notificationSound':{'type':Sequelize[_0x6519('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6519('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6519('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6519('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6519('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6519('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6519('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6519('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x6519('0x14')],'defaultValue':![],'comment':_0x6519('0x15'),'set':function(_0x159e38){if(!_0x159e38)this[_0x6519('0x16')]('mandatoryDispositionPauseId',null);this[_0x6519('0x16')](_0x6519('0x17'),_0x159e38);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 4db9f9c..96b88f6 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 _0xac82=['eml-format','rimraf','fast-json-patch','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','undefined','limit','count','set','json','apply','reject','save','update','FaxAccounts','UserProfileResource','end','sendStatus','stack','name','send','Pause','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxAccount','rows','show','params','mandatoryDispositionPause','rawAttributes','includeAll','include','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','destroy','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','path','from','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','User','getAgents'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xac82,0x192));var _0x2ac8=function(_0x479d2a,_0x412cde){_0x479d2a=_0x479d2a-0x0;var _0x39665a=_0xac82[_0x479d2a];return _0x39665a;};'use strict';var emlformat=require(_0x2ac8('0x0'));var rimraf=require(_0x2ac8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ac8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2ac8('0x3'));var path=require('path');var sox=require(_0x2ac8('0x4'));var csv=require(_0x2ac8('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ac8('0x6'));var _=require('lodash');var squel=require(_0x2ac8('0x7'));var crypto=require('crypto');var jsforce=require(_0x2ac8('0x8'));var deskjs=require(_0x2ac8('0x9'));var toCsv=require(_0x2ac8('0x5'));var querystring=require(_0x2ac8('0xa'));var Papa=require(_0x2ac8('0xb'));var Redis=require(_0x2ac8('0xc'));var authService=require(_0x2ac8('0xd'));var qs=require(_0x2ac8('0xe'));var as=require(_0x2ac8('0xf'));var hardwareService=require(_0x2ac8('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x2ac8('0x11'));var config=require(_0x2ac8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x2ac8('0x13'))['db'];config[_0x2ac8('0x14')]=_[_0x2ac8('0x15')](config[_0x2ac8('0x14')],{'host':_0x2ac8('0x16'),'port':0x18eb});var socket=require(_0x2ac8('0x17'))(new Redis(config[_0x2ac8('0x14')]));require(_0x2ac8('0x18'))[_0x2ac8('0x19')](socket);var jayson=require(_0x2ac8('0x1a'));var client=jayson[_0x2ac8('0x1b')][_0x2ac8('0x1c')]({'port':0x232c});var client9002=jayson[_0x2ac8('0x1b')][_0x2ac8('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x54a591,_0x301414,_0x1119d0,_0x5c67b8){return new BPromise(function(_0x52c2fc,_0x8ddc39){var _0x88f7e4=_0x5c67b8||client;return _0x88f7e4[_0x2ac8('0x1d')](_0x54a591,_0x1119d0)[_0x2ac8('0x1e')](function(_0x1783f4){logger[_0x2ac8('0x1f')](_0x2ac8('0x20'),_0x301414,_0x2ac8('0x21'));logger[_0x2ac8('0x22')](_0x2ac8('0x23'),_0x301414,'request\x20sent',JSON[_0x2ac8('0x24')](_0x1783f4));if(_0x1783f4[_0x2ac8('0x25')]){if(_0x1783f4[_0x2ac8('0x25')][_0x2ac8('0x26')]===0x1f4){logger[_0x2ac8('0x25')]('FaxAccount,\x20%s,\x20%s',_0x301414,_0x1783f4[_0x2ac8('0x25')][_0x2ac8('0x27')]);return _0x8ddc39(_0x1783f4['error'][_0x2ac8('0x27')]);}logger[_0x2ac8('0x25')](_0x2ac8('0x20'),_0x301414,_0x1783f4[_0x2ac8('0x25')][_0x2ac8('0x27')]);return _0x52c2fc(_0x1783f4[_0x2ac8('0x25')][_0x2ac8('0x27')]);}else{logger[_0x2ac8('0x1f')](_0x2ac8('0x20'),_0x301414,'request\x20sent');_0x52c2fc(_0x1783f4[_0x2ac8('0x28')][_0x2ac8('0x27')]);}})[_0x2ac8('0x29')](function(_0x2e4193){logger[_0x2ac8('0x25')](_0x2ac8('0x20'),_0x301414,_0x2e4193);_0x8ddc39(_0x2e4193);});});}function respondWithStatusCode(_0x46fe4f,_0x4f2147){_0x4f2147=_0x4f2147||0xcc;return function(_0x7f027d){if(_0x7f027d){return _0x46fe4f['sendStatus'](_0x4f2147);}return _0x46fe4f[_0x2ac8('0x2a')](_0x4f2147)['end']();};}function respondWithResult(_0x145c88,_0x3196b3){_0x3196b3=_0x3196b3||0xc8;return function(_0x21abf3){if(_0x21abf3){return _0x145c88[_0x2ac8('0x2a')](_0x3196b3)['json'](_0x21abf3);}};}function respondWithFilteredResult(_0x58d1b9,_0x5b5aad){return function(_0x1a288b){if(_0x1a288b){var _0x371b97=typeof _0x5b5aad[_0x2ac8('0x2b')]===_0x2ac8('0x2c')&&typeof _0x5b5aad[_0x2ac8('0x2d')]==='undefined';var _0x1cc2ca=_0x1a288b[_0x2ac8('0x2e')];var _0x4f6028=_0x371b97?0x0:_0x5b5aad[_0x2ac8('0x2b')];var _0x4eb637=_0x371b97?_0x1a288b[_0x2ac8('0x2e')]:_0x5b5aad[_0x2ac8('0x2b')]+_0x5b5aad[_0x2ac8('0x2d')];var _0x1b2d97;if(_0x4eb637>=_0x1cc2ca){_0x4eb637=_0x1cc2ca;_0x1b2d97=0xc8;}else{_0x1b2d97=0xce;}_0x58d1b9['status'](_0x1b2d97);return _0x58d1b9[_0x2ac8('0x2f')]('Content-Range',_0x4f6028+'-'+_0x4eb637+'/'+_0x1cc2ca)[_0x2ac8('0x30')](_0x1a288b);}return null;};}function patchUpdates(_0x826aa1){return function(_0x3d917e){try{jsonpatch[_0x2ac8('0x31')](_0x3d917e,_0x826aa1,!![]);}catch(_0xeb9643){return BPromise[_0x2ac8('0x32')](_0xeb9643);}return _0x3d917e[_0x2ac8('0x33')]();};}function saveUpdates(_0x77bff0,_0x42e327){return function(_0x303a2e){if(_0x303a2e){return _0x303a2e[_0x2ac8('0x34')](_0x77bff0)[_0x2ac8('0x1e')](function(_0x526da4){return _0x526da4;});}return null;};}function removeEntity(_0x5f5307,_0x25f663){return function(_0x31c8b8){if(_0x31c8b8){return _0x31c8b8['destroy']()[_0x2ac8('0x1e')](function(){var _0x16c118=_0x31c8b8['get']({'plain':!![]});var _0x1e1d85=_0x2ac8('0x35');return db[_0x2ac8('0x36')]['destroy']({'where':{'type':_0x1e1d85,'resourceId':_0x16c118['id']}})[_0x2ac8('0x1e')](function(){return _0x31c8b8;});})[_0x2ac8('0x1e')](function(){_0x5f5307[_0x2ac8('0x2a')](0xcc)[_0x2ac8('0x37')]();});}};}function handleEntityNotFound(_0x3444b9,_0x30d90e){return function(_0x8a483d){if(!_0x8a483d){_0x3444b9[_0x2ac8('0x38')](0x194);}return _0x8a483d;};}function handleError(_0x246dc8,_0x3f7611){_0x3f7611=_0x3f7611||0x1f4;return function(_0x14fee5){logger['error'](_0x14fee5[_0x2ac8('0x39')]);if(_0x14fee5[_0x2ac8('0x3a')]){delete _0x14fee5['name'];}_0x246dc8[_0x2ac8('0x2a')](_0x3f7611)[_0x2ac8('0x3b')](_0x14fee5);};}exports['index']=function(_0x413577,_0xa05be3){var _0x19ec53={'include':[{'model':db[_0x2ac8('0x3c')],'as':'mandatoryDispositionPause'}]},_0x38ec30={},_0x473fa3={'count':0x0,'rows':[]};var _0x15e506=_[_0x2ac8('0x3d')](db['FaxAccount']['rawAttributes'],function(_0x1fd69d){return{'name':_0x1fd69d[_0x2ac8('0x3e')],'type':_0x1fd69d[_0x2ac8('0x3f')][_0x2ac8('0x40')]};});_0x38ec30[_0x2ac8('0x41')]=_[_0x2ac8('0x3d')](_0x15e506,_0x2ac8('0x3a'));_0x38ec30[_0x2ac8('0x42')]=_[_0x2ac8('0x43')](_0x413577['query']);_0x38ec30[_0x2ac8('0x44')]=_[_0x2ac8('0x45')](_0x38ec30[_0x2ac8('0x41')],_0x38ec30[_0x2ac8('0x42')]);_0x19ec53['attributes']=_[_0x2ac8('0x45')](_0x38ec30[_0x2ac8('0x41')],qs[_0x2ac8('0x46')](_0x413577['query']['fields']));_0x19ec53[_0x2ac8('0x47')]=_0x19ec53[_0x2ac8('0x47')][_0x2ac8('0x48')]?_0x19ec53['attributes']:_0x38ec30['model'];if(!_0x413577['query'][_0x2ac8('0x49')]('nolimit')){_0x19ec53[_0x2ac8('0x2d')]=qs[_0x2ac8('0x2d')](_0x413577[_0x2ac8('0x42')][_0x2ac8('0x2d')]);_0x19ec53[_0x2ac8('0x2b')]=qs[_0x2ac8('0x2b')](_0x413577[_0x2ac8('0x42')][_0x2ac8('0x2b')]);}_0x19ec53[_0x2ac8('0x4a')]=qs[_0x2ac8('0x4b')](_0x413577[_0x2ac8('0x42')][_0x2ac8('0x4b')]);_0x19ec53[_0x2ac8('0x4c')]=qs[_0x2ac8('0x44')](_[_0x2ac8('0x4d')](_0x413577[_0x2ac8('0x42')],_0x38ec30['filters']),_0x15e506);if(_0x413577[_0x2ac8('0x42')][_0x2ac8('0x4e')]){_0x19ec53[_0x2ac8('0x4c')]=_[_0x2ac8('0x4f')](_0x19ec53['where'],{'$or':_[_0x2ac8('0x3d')](_0x15e506,function(_0x25435d){if(_0x25435d['type']!==_0x2ac8('0x50')){var _0x1bb57c={};_0x1bb57c[_0x25435d['name']]={'$like':'%'+_0x413577[_0x2ac8('0x42')][_0x2ac8('0x4e')]+'%'};return _0x1bb57c;}})});}_0x19ec53=_[_0x2ac8('0x4f')]({},_0x19ec53,_0x413577[_0x2ac8('0x51')]);var _0x19a223={'where':_0x19ec53[_0x2ac8('0x4c')]};return db[_0x2ac8('0x52')]['count'](_0x19a223)['then'](function(_0x1c238a){_0x473fa3['count']=_0x1c238a;if(_0x413577[_0x2ac8('0x42')]['includeAll']){_0x19ec53['include']=[{'all':!![]}];}return db[_0x2ac8('0x52')]['findAll'](_0x19ec53);})[_0x2ac8('0x1e')](function(_0x48d2bc){_0x473fa3[_0x2ac8('0x53')]=_0x48d2bc;return _0x473fa3;})['then'](respondWithFilteredResult(_0xa05be3,_0x19ec53))[_0x2ac8('0x29')](handleError(_0xa05be3,null));};exports[_0x2ac8('0x54')]=function(_0x51bbf3,_0x469542){var _0x9d2243={'raw':![],'where':{'id':_0x51bbf3[_0x2ac8('0x55')]['id']},'include':[{'model':db[_0x2ac8('0x3c')],'as':_0x2ac8('0x56')}]},_0x18d154={};_0x18d154[_0x2ac8('0x41')]=_[_0x2ac8('0x43')](db[_0x2ac8('0x52')][_0x2ac8('0x57')]);_0x18d154['query']=_[_0x2ac8('0x43')](_0x51bbf3[_0x2ac8('0x42')]);_0x18d154['filters']=_[_0x2ac8('0x45')](_0x18d154[_0x2ac8('0x41')],_0x18d154[_0x2ac8('0x42')]);_0x9d2243['attributes']=_[_0x2ac8('0x45')](_0x18d154[_0x2ac8('0x41')],qs['fields'](_0x51bbf3[_0x2ac8('0x42')][_0x2ac8('0x46')]));_0x9d2243['attributes']=_0x9d2243[_0x2ac8('0x47')][_0x2ac8('0x48')]?_0x9d2243[_0x2ac8('0x47')]:_0x18d154[_0x2ac8('0x41')];if(_0x51bbf3['query'][_0x2ac8('0x58')]){_0x9d2243[_0x2ac8('0x59')]=[{'all':!![]}];}_0x9d2243=_[_0x2ac8('0x4f')]({},_0x9d2243,_0x51bbf3['options']);return db[_0x2ac8('0x52')][_0x2ac8('0x5a')](_0x9d2243)[_0x2ac8('0x1e')](handleEntityNotFound(_0x469542,null))[_0x2ac8('0x1e')](respondWithResult(_0x469542,null))[_0x2ac8('0x29')](handleError(_0x469542,null));};exports[_0x2ac8('0x5b')]=function(_0x25591b,_0x1466e0){return db[_0x2ac8('0x52')][_0x2ac8('0x5b')](_0x25591b[_0x2ac8('0x5c')],{})[_0x2ac8('0x1e')](function(_0x5bd8){var _0x3f87f0=_0x25591b[_0x2ac8('0x5d')][_0x2ac8('0x5e')]({'plain':!![]});if(!_0x3f87f0)throw new Error(_0x2ac8('0x5f'));if(_0x3f87f0['role']===_0x2ac8('0x5d')){var _0x1bb0f3=_0x5bd8[_0x2ac8('0x5e')]({'plain':!![]});var _0x45357d=_0x2ac8('0x35');return db[_0x2ac8('0x60')][_0x2ac8('0x5a')]({'where':{'name':_0x45357d,'userProfileId':_0x3f87f0[_0x2ac8('0x61')]},'raw':!![]})[_0x2ac8('0x1e')](function(_0x4f4849){if(_0x4f4849&&_0x4f4849[_0x2ac8('0x62')]===0x0){return db[_0x2ac8('0x36')]['create']({'name':_0x1bb0f3[_0x2ac8('0x3a')],'resourceId':_0x1bb0f3['id'],'type':_0x4f4849[_0x2ac8('0x3a')],'sectionId':_0x4f4849['id']},{})[_0x2ac8('0x1e')](function(){return _0x5bd8;});}else{return _0x5bd8;}})[_0x2ac8('0x29')](function(_0x432d38){logger['error'](_0x2ac8('0x63'),_0x432d38);throw _0x432d38;});}return _0x5bd8;})[_0x2ac8('0x1e')](respondWithResult(_0x1466e0,0xc9))['catch'](handleError(_0x1466e0,null));};exports[_0x2ac8('0x34')]=function(_0x540571,_0x4ff99c){if(_0x540571[_0x2ac8('0x5c')]['id']){delete _0x540571[_0x2ac8('0x5c')]['id'];}return db[_0x2ac8('0x52')][_0x2ac8('0x5a')]({'where':{'id':_0x540571[_0x2ac8('0x55')]['id']},'include':[{'model':db[_0x2ac8('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x2ac8('0x1e')](handleEntityNotFound(_0x4ff99c,null))[_0x2ac8('0x1e')](saveUpdates(_0x540571[_0x2ac8('0x5c')],null))[_0x2ac8('0x1e')](respondWithResult(_0x4ff99c,null))[_0x2ac8('0x29')](handleError(_0x4ff99c,null));};exports[_0x2ac8('0x64')]=function(_0x39656c,_0xad31f0){return db['FaxAccount'][_0x2ac8('0x5a')]({'where':{'id':_0x39656c[_0x2ac8('0x55')]['id']}})['then'](handleEntityNotFound(_0xad31f0,null))['then'](removeEntity(_0xad31f0,null))[_0x2ac8('0x29')](handleError(_0xad31f0,null));};exports[_0x2ac8('0x65')]=function(_0x584968,_0x5ecc86){return db[_0x2ac8('0x52')][_0x2ac8('0x65')]()[_0x2ac8('0x1e')](respondWithResult(_0x5ecc86,null))[_0x2ac8('0x29')](handleError(_0x5ecc86,null));};exports[_0x2ac8('0x66')]=function(_0x55b6ae,_0x43e06c,_0x526c62){if(_0x55b6ae[_0x2ac8('0x5c')]['id']){delete _0x55b6ae[_0x2ac8('0x5c')]['id'];}return db[_0x2ac8('0x52')][_0x2ac8('0x5a')]({'where':{'id':_0x55b6ae[_0x2ac8('0x55')]['id']}})[_0x2ac8('0x1e')](handleEntityNotFound(_0x43e06c,null))[_0x2ac8('0x1e')](function(_0x6f297){if(_0x6f297){_0x55b6ae[_0x2ac8('0x5c')][_0x2ac8('0x67')]=_0x6f297['id'];return db[_0x2ac8('0x68')][_0x2ac8('0x5b')](_0x55b6ae[_0x2ac8('0x5c')]);}})[_0x2ac8('0x1e')](respondWithResult(_0x43e06c,null))['catch'](handleError(_0x43e06c,null));};exports[_0x2ac8('0x69')]=function(_0x4aea43,_0x3272b6,_0x1f371f){var _0x127bd5={'raw':![],'where':{}};var _0x398ea8={};var _0x5e9f68={'count':0x0,'rows':[]};return db[_0x2ac8('0x52')][_0x2ac8('0x6a')]({'where':{'id':_0x4aea43['params']['id']}})[_0x2ac8('0x1e')](handleEntityNotFound(_0x3272b6,null))[_0x2ac8('0x1e')](function(_0x42791f){if(_0x42791f){_0x398ea8['model']=_[_0x2ac8('0x43')](db[_0x2ac8('0x68')][_0x2ac8('0x57')]);_0x398ea8[_0x2ac8('0x42')]=_[_0x2ac8('0x43')](_0x4aea43[_0x2ac8('0x42')]);_0x398ea8[_0x2ac8('0x44')]=_[_0x2ac8('0x45')](_0x398ea8[_0x2ac8('0x41')],_0x398ea8['query']);_0x127bd5['attributes']=_[_0x2ac8('0x45')](_0x398ea8[_0x2ac8('0x41')],qs[_0x2ac8('0x46')](_0x4aea43['query'][_0x2ac8('0x46')]));_0x127bd5[_0x2ac8('0x47')]=_0x127bd5[_0x2ac8('0x47')][_0x2ac8('0x48')]?_0x127bd5['attributes']:_0x398ea8[_0x2ac8('0x41')];if(!_0x4aea43[_0x2ac8('0x42')][_0x2ac8('0x49')](_0x2ac8('0x6b'))){_0x127bd5[_0x2ac8('0x2d')]=qs[_0x2ac8('0x2d')](_0x4aea43[_0x2ac8('0x42')][_0x2ac8('0x2d')]);_0x127bd5[_0x2ac8('0x2b')]=qs[_0x2ac8('0x2b')](_0x4aea43[_0x2ac8('0x42')][_0x2ac8('0x2b')]);}_0x127bd5[_0x2ac8('0x4a')]=qs[_0x2ac8('0x4b')](_0x4aea43[_0x2ac8('0x42')][_0x2ac8('0x4b')]);_0x127bd5[_0x2ac8('0x4c')]=qs['filters'](_[_0x2ac8('0x4d')](_0x4aea43[_0x2ac8('0x42')],_0x398ea8[_0x2ac8('0x44')]));_0x127bd5[_0x2ac8('0x4c')]['FaxAccountId']=_0x42791f['id'];if(_0x4aea43['query'][_0x2ac8('0x4e')]){_0x127bd5[_0x2ac8('0x4c')]=_[_0x2ac8('0x4f')](_0x127bd5[_0x2ac8('0x4c')],{'$or':_[_0x2ac8('0x3d')](_0x127bd5[_0x2ac8('0x47')],function(_0x22819c){var _0x5d51af={};_0x5d51af[_0x22819c]={'$like':'%'+_0x4aea43[_0x2ac8('0x42')][_0x2ac8('0x4e')]+'%'};return _0x5d51af;})});}_0x127bd5=_['merge']({},_0x127bd5,_0x4aea43[_0x2ac8('0x51')]);return db['Disposition'][_0x2ac8('0x2e')]({'where':_0x127bd5['where']})[_0x2ac8('0x1e')](function(_0x53806f){_0x5e9f68['count']=_0x53806f;if(_0x4aea43[_0x2ac8('0x42')][_0x2ac8('0x58')]){_0x127bd5['include']=[{'all':!![]}];}return db['Disposition'][_0x2ac8('0x6c')](_0x127bd5);})['then'](function(_0x88b9d){_0x5e9f68[_0x2ac8('0x53')]=_0x88b9d;return _0x5e9f68;});}})['then'](respondWithFilteredResult(_0x3272b6,_0x127bd5))[_0x2ac8('0x29')](handleError(_0x3272b6,null));};exports[_0x2ac8('0x6d')]=function(_0x18420b,_0x1765fc,_0xb174a5){return db[_0x2ac8('0x52')][_0x2ac8('0x5a')]({'where':{'id':_0x18420b['params']['id']}})[_0x2ac8('0x1e')](handleEntityNotFound(_0x1765fc,null))[_0x2ac8('0x1e')](function(_0x244270){if(_0x244270){return _0x244270[_0x2ac8('0x6d')](_0x18420b[_0x2ac8('0x42')][_0x2ac8('0x6e')]);}})[_0x2ac8('0x1e')](respondWithStatusCode(_0x1765fc,null))[_0x2ac8('0x29')](handleError(_0x1765fc,null));};exports[_0x2ac8('0x6f')]=function(_0x23b95a,_0xb2e571,_0x4c6f27){if(_0x23b95a[_0x2ac8('0x5c')]['id']){delete _0x23b95a[_0x2ac8('0x5c')]['id'];}return db['FaxAccount'][_0x2ac8('0x5a')]({'where':{'id':_0x23b95a[_0x2ac8('0x55')]['id']}})[_0x2ac8('0x1e')](handleEntityNotFound(_0xb2e571,null))['then'](function(_0x13306e){if(_0x13306e){_0x23b95a['body']['FaxAccountId']=_0x13306e['id'];return db[_0x2ac8('0x70')]['create'](_0x23b95a[_0x2ac8('0x5c')]);}})['then'](respondWithResult(_0xb2e571,null))[_0x2ac8('0x29')](handleError(_0xb2e571,null));};exports[_0x2ac8('0x71')]=function(_0xf2f0b0,_0x4652b3,_0x4201aa){var _0x477a7e={'raw':![],'where':{}};var _0x2866ba={};var _0x27e8a4={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2ac8('0x6a')]({'where':{'id':_0xf2f0b0[_0x2ac8('0x55')]['id']}})['then'](handleEntityNotFound(_0x4652b3,null))['then'](function(_0x32ca7d){if(_0x32ca7d){_0x2866ba[_0x2ac8('0x41')]=_['keys'](db[_0x2ac8('0x70')][_0x2ac8('0x57')]);_0x2866ba[_0x2ac8('0x42')]=_[_0x2ac8('0x43')](_0xf2f0b0[_0x2ac8('0x42')]);_0x2866ba[_0x2ac8('0x44')]=_[_0x2ac8('0x45')](_0x2866ba[_0x2ac8('0x41')],_0x2866ba[_0x2ac8('0x42')]);_0x477a7e[_0x2ac8('0x47')]=_['intersection'](_0x2866ba[_0x2ac8('0x41')],qs[_0x2ac8('0x46')](_0xf2f0b0[_0x2ac8('0x42')][_0x2ac8('0x46')]));_0x477a7e[_0x2ac8('0x47')]=_0x477a7e['attributes'][_0x2ac8('0x48')]?_0x477a7e['attributes']:_0x2866ba[_0x2ac8('0x41')];if(!_0xf2f0b0[_0x2ac8('0x42')][_0x2ac8('0x49')](_0x2ac8('0x6b'))){_0x477a7e[_0x2ac8('0x2d')]=qs[_0x2ac8('0x2d')](_0xf2f0b0[_0x2ac8('0x42')]['limit']);_0x477a7e[_0x2ac8('0x2b')]=qs[_0x2ac8('0x2b')](_0xf2f0b0[_0x2ac8('0x42')][_0x2ac8('0x2b')]);}_0x477a7e[_0x2ac8('0x4a')]=qs[_0x2ac8('0x4b')](_0xf2f0b0[_0x2ac8('0x42')][_0x2ac8('0x4b')]);_0x477a7e[_0x2ac8('0x4c')]=qs[_0x2ac8('0x44')](_[_0x2ac8('0x4d')](_0xf2f0b0[_0x2ac8('0x42')],_0x2866ba[_0x2ac8('0x44')]));_0x477a7e['where'][_0x2ac8('0x67')]=_0x32ca7d['id'];if(_0xf2f0b0['query'][_0x2ac8('0x4e')]){_0x477a7e[_0x2ac8('0x4c')]=_['merge'](_0x477a7e[_0x2ac8('0x4c')],{'$or':_['map'](_0x477a7e['attributes'],function(_0x169856){var _0xb4576b={};_0xb4576b[_0x169856]={'$like':'%'+_0xf2f0b0['query'][_0x2ac8('0x4e')]+'%'};return _0xb4576b;})});}_0x477a7e=_[_0x2ac8('0x4f')]({},_0x477a7e,_0xf2f0b0[_0x2ac8('0x51')]);return db['CannedAnswer'][_0x2ac8('0x2e')]({'where':_0x477a7e['where']})['then'](function(_0x4bda21){_0x27e8a4[_0x2ac8('0x2e')]=_0x4bda21;if(_0xf2f0b0[_0x2ac8('0x42')][_0x2ac8('0x58')]){_0x477a7e['include']=[{'all':!![]}];}return db[_0x2ac8('0x70')][_0x2ac8('0x6c')](_0x477a7e);})[_0x2ac8('0x1e')](function(_0x47bc5a){_0x27e8a4[_0x2ac8('0x53')]=_0x47bc5a;return _0x27e8a4;});}})[_0x2ac8('0x1e')](respondWithFilteredResult(_0x4652b3,_0x477a7e))['catch'](handleError(_0x4652b3,null));};exports[_0x2ac8('0x72')]=function(_0x33fc16,_0x1c3139,_0x5cdb6a){return db[_0x2ac8('0x52')]['find']({'where':{'id':_0x33fc16[_0x2ac8('0x55')]['id']}})[_0x2ac8('0x1e')](handleEntityNotFound(_0x1c3139,null))['then'](function(_0x4b4d21){if(_0x4b4d21){return _0x4b4d21[_0x2ac8('0x72')](_0x33fc16[_0x2ac8('0x42')][_0x2ac8('0x6e')]);}})[_0x2ac8('0x1e')](respondWithStatusCode(_0x1c3139,null))[_0x2ac8('0x29')](handleError(_0x1c3139,null));};exports['addInteraction']=function(_0x33ff99,_0x5cf95d,_0x53a7d0){return db[_0x2ac8('0x73')]['find']({'where':{'id':_0x33ff99[_0x2ac8('0x55')]['id']}})[_0x2ac8('0x1e')](handleEntityNotFound(_0x5cf95d,null))['then'](function(_0x3def58){if(_0x3def58){return _0x3def58[_0x2ac8('0x74')](_0x33ff99['body'][_0x2ac8('0x6e')],_[_0x2ac8('0x75')](_0x33ff99[_0x2ac8('0x5c')],[_0x2ac8('0x6e'),'id'])||{});}})[_0x2ac8('0x1e')](respondWithResult(_0x5cf95d,null))['catch'](handleError(_0x5cf95d,null));};exports[_0x2ac8('0x76')]=function(_0x199eb1,_0x3c3794,_0xeec4a8){var _0x5d7b86={'raw':![],'where':{}};var _0x41c13e={};var _0x2f0fa3={'count':0x0,'rows':[]};return db[_0x2ac8('0x52')][_0x2ac8('0x6a')]({'where':{'id':_0x199eb1[_0x2ac8('0x55')]['id']}})[_0x2ac8('0x1e')](handleEntityNotFound(_0x3c3794,null))[_0x2ac8('0x1e')](function(_0xe53833){if(_0xe53833){_0x41c13e[_0x2ac8('0x41')]=_[_0x2ac8('0x43')](db[_0x2ac8('0x73')]['rawAttributes']);_0x41c13e[_0x2ac8('0x42')]=_[_0x2ac8('0x43')](_0x199eb1['query']);_0x41c13e[_0x2ac8('0x44')]=_[_0x2ac8('0x45')](_0x41c13e[_0x2ac8('0x41')],_0x41c13e[_0x2ac8('0x42')]);_0x5d7b86[_0x2ac8('0x47')]=_[_0x2ac8('0x45')](_0x41c13e[_0x2ac8('0x41')],qs[_0x2ac8('0x46')](_0x199eb1[_0x2ac8('0x42')][_0x2ac8('0x46')]));_0x5d7b86[_0x2ac8('0x47')]=_0x5d7b86['attributes'][_0x2ac8('0x48')]?_0x5d7b86[_0x2ac8('0x47')]:_0x41c13e[_0x2ac8('0x41')];if(!_0x199eb1['query'][_0x2ac8('0x49')](_0x2ac8('0x6b'))){_0x5d7b86[_0x2ac8('0x2d')]=qs['limit'](_0x199eb1[_0x2ac8('0x42')][_0x2ac8('0x2d')]);_0x5d7b86[_0x2ac8('0x2b')]=qs[_0x2ac8('0x2b')](_0x199eb1[_0x2ac8('0x42')][_0x2ac8('0x2b')]);}_0x5d7b86[_0x2ac8('0x4a')]=qs['sort'](_0x199eb1[_0x2ac8('0x42')][_0x2ac8('0x4b')]);_0x5d7b86['where']=qs[_0x2ac8('0x44')](_[_0x2ac8('0x4d')](_0x199eb1[_0x2ac8('0x42')],_0x41c13e[_0x2ac8('0x44')]));_0x5d7b86['where']['FaxAccountId']=_0xe53833['id'];if(_0x199eb1[_0x2ac8('0x42')][_0x2ac8('0x4e')]){_0x5d7b86['where']=_[_0x2ac8('0x4f')](_0x5d7b86['where'],{'$or':_[_0x2ac8('0x3d')](_0x5d7b86[_0x2ac8('0x47')],function(_0x39a8cf){var _0x3159d7={};_0x3159d7[_0x39a8cf]={'$like':'%'+_0x199eb1[_0x2ac8('0x42')]['filter']+'%'};return _0x3159d7;})});}_0x5d7b86=_[_0x2ac8('0x4f')]({},_0x5d7b86,_0x199eb1[_0x2ac8('0x51')]);return db['FaxInteraction'][_0x2ac8('0x2e')]({'where':_0x5d7b86[_0x2ac8('0x4c')]})[_0x2ac8('0x1e')](function(_0x4f55da){_0x2f0fa3[_0x2ac8('0x2e')]=_0x4f55da;if(_0x199eb1['query'][_0x2ac8('0x58')]){_0x5d7b86[_0x2ac8('0x59')]=[{'model':db[_0x2ac8('0x77')],'as':_0x2ac8('0x78'),'required':![]},{'model':db['User'],'as':_0x2ac8('0x79'),'attributes':[_0x2ac8('0x3a'),_0x2ac8('0x7a'),_0x2ac8('0x7b')],'required':![]},{'model':db[_0x2ac8('0x7c')],'as':_0x2ac8('0x7d'),'attributes':['id',_0x2ac8('0x3a'),'color'],'where':_0x199eb1[_0x2ac8('0x42')][_0x2ac8('0x7e')]?{'id':_0x199eb1[_0x2ac8('0x42')]['tag']}:undefined,'required':_0x199eb1['query']['tag']?!![]:![]}];}return db[_0x2ac8('0x73')][_0x2ac8('0x6c')](_0x5d7b86);})['then'](function(_0x3c44f5){_0x2f0fa3[_0x2ac8('0x53')]=_0x3c44f5;return _0x2f0fa3;});}})['then'](respondWithFilteredResult(_0x3c3794,_0x5d7b86))[_0x2ac8('0x29')](handleError(_0x3c3794,null));};exports[_0x2ac8('0x7f')]=function(_0x15df8d,_0x2282c1){var _0x174f4b=_0x15df8d[_0x2ac8('0x55')]['id'];var _0x4bcc1f=_0x15df8d[_0x2ac8('0x5c')];var _0x680eba=0xc8;var _0x1dc1fe=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x2ac8('0x80')][_0x2ac8('0x81')][_0x2ac8('0x82')][_0x2ac8('0x83')]},function(_0x2e6e4b){return db[_0x2ac8('0x52')][_0x2ac8('0x6a')]({'where':{'id':_0x174f4b},'transaction':_0x2e6e4b})[_0x2ac8('0x1e')](function(_0x2c97a3){if(_0x2c97a3){return db[_0x2ac8('0x84')][_0x2ac8('0x64')]({'where':{'FaxAccountId':_0x174f4b},'transaction':_0x2e6e4b})['then'](function(){var _0x2c6b39=_[_0x2ac8('0x3d')](_0x4bcc1f,function(_0x40aa1a){_0x40aa1a[_0x2ac8('0x67')]=_0x174f4b;return _0x40aa1a;});return db[_0x2ac8('0x84')][_0x2ac8('0x85')](_0x2c6b39,{'transaction':_0x2e6e4b});});}else{_0x680eba=0x194;_0x1dc1fe=[];}});})[_0x2ac8('0x1e')](function(){if(_0x680eba!==0x194){return db[_0x2ac8('0x84')][_0x2ac8('0x86')]({'where':{'FaxAccountId':_0x174f4b},'order':_0x2ac8('0x87')})[_0x2ac8('0x1e')](function(_0x49dff2){_0x1dc1fe=_0x49dff2;});}})[_0x2ac8('0x29')](function(_0xef7873){_0x680eba=0x1f4;logger['error'](_0xef7873['stack']);if(_0xef7873['name']){delete _0xef7873['name'];}_0x1dc1fe=_0xef7873;})[_0x2ac8('0x88')](function(){if(_0x1dc1fe===null){_0x2282c1[_0x2ac8('0x38')](_0x680eba);}else{if(_0x680eba===0x1f4){_0x2282c1['status'](_0x680eba)[_0x2ac8('0x3b')](_0x1dc1fe);}else{_0x2282c1[_0x2ac8('0x2a')](_0x680eba)[_0x2ac8('0x30')](_0x1dc1fe);}}});};exports[_0x2ac8('0x89')]=function(_0x11f67b,_0x474557,_0xe893b){var _0x3ba7fc={};var _0x1a7522={};var _0x2b91ad;var _0x3dc37c;return db[_0x2ac8('0x52')]['findOne']({'where':{'id':_0x11f67b[_0x2ac8('0x55')]['id']}})[_0x2ac8('0x1e')](handleEntityNotFound(_0x474557,null))[_0x2ac8('0x1e')](function(_0x36b3e7){if(_0x36b3e7){_0x2b91ad=_0x36b3e7;_0x1a7522['model']=_[_0x2ac8('0x43')](db[_0x2ac8('0x84')][_0x2ac8('0x57')]);_0x1a7522[_0x2ac8('0x42')]=_['keys'](_0x11f67b[_0x2ac8('0x42')]);_0x1a7522[_0x2ac8('0x44')]=_[_0x2ac8('0x45')](_0x1a7522[_0x2ac8('0x41')],_0x1a7522[_0x2ac8('0x42')]);_0x3ba7fc[_0x2ac8('0x47')]=_[_0x2ac8('0x45')](_0x1a7522[_0x2ac8('0x41')],qs['fields'](_0x11f67b[_0x2ac8('0x42')][_0x2ac8('0x46')]));_0x3ba7fc['attributes']=_0x3ba7fc['attributes'][_0x2ac8('0x48')]?_0x3ba7fc[_0x2ac8('0x47')]:_0x1a7522[_0x2ac8('0x41')];_0x3ba7fc[_0x2ac8('0x4a')]=qs[_0x2ac8('0x4b')](_0x11f67b['query']['sort']);_0x3ba7fc['where']=qs[_0x2ac8('0x44')](_[_0x2ac8('0x4d')](_0x11f67b[_0x2ac8('0x42')],_0x1a7522[_0x2ac8('0x44')]));if(_0x11f67b[_0x2ac8('0x42')][_0x2ac8('0x4e')]){_0x3ba7fc[_0x2ac8('0x4c')]=_[_0x2ac8('0x4f')](_0x3ba7fc['where'],{'$or':_['map'](_0x3ba7fc[_0x2ac8('0x47')],function(_0x57cb4b){var _0xfdb644={};_0xfdb644[_0x57cb4b]={'$like':'%'+_0x11f67b[_0x2ac8('0x42')][_0x2ac8('0x4e')]+'%'};return _0xfdb644;})});}_0x3ba7fc=_[_0x2ac8('0x4f')]({},_0x3ba7fc,_0x11f67b['options']);return _0x2b91ad[_0x2ac8('0x89')](_0x3ba7fc);}})['then'](function(_0x51eaf0){if(_0x51eaf0){_0x3dc37c=_0x51eaf0[_0x2ac8('0x48')];if(!_0x11f67b[_0x2ac8('0x42')]['hasOwnProperty']('nolimit')){_0x3ba7fc[_0x2ac8('0x2d')]=qs[_0x2ac8('0x2d')](_0x11f67b[_0x2ac8('0x42')][_0x2ac8('0x2d')]);_0x3ba7fc[_0x2ac8('0x2b')]=qs[_0x2ac8('0x2b')](_0x11f67b['query'][_0x2ac8('0x2b')]);}return _0x2b91ad[_0x2ac8('0x89')](_0x3ba7fc);}})[_0x2ac8('0x1e')](function(_0x3c5911){if(_0x3c5911){return _0x3c5911?{'count':_0x3dc37c,'rows':_0x3c5911}:null;}})[_0x2ac8('0x1e')](respondWithResult(_0x474557,null))[_0x2ac8('0x29')](handleError(_0x474557,null));};function Extension(_0x20ba6f,_0x2ab294,_0x249973,_0x27be28){this['context']=_0x2ac8('0x8a');this[_0x2ac8('0x8b')]=_0x20ba6f[_0x2ac8('0x8c')];this['app']=_0x27be28;this[_0x2ac8('0x3f')]=_0x2ac8('0x8d');this[_0x2ac8('0x8e')]=_0x2ac8('0x8f');this[_0x2ac8('0x67')]=_0x20ba6f['id'];this[_0x2ac8('0x87')]=_0x2ab294;this['appdata']=_0x249973;}function createExtensionsReciveFax(_0x216843){var _0x3dd8f4=0x1;var _0x1382a1=[];_0x1382a1[_0x2ac8('0x90')](new Extension(_0x216843,_0x3dd8f4,'',_0x2ac8('0x91')));_0x3dd8f4+=0x1;_0x1382a1[_0x2ac8('0x90')](new Extension(_0x216843,_0x3dd8f4,_0x2ac8('0x92'),'Set'));_0x3dd8f4+=0x1;for(var _0x13db74 in _0x216843){if(_0x216843['hasOwnProperty'](_0x13db74)&&(_0x13db74==='ecm'||_0x13db74===_0x2ac8('0x8c')||_0x13db74==='gateway'||_0x13db74==='faxdetect'||_0x13db74==='headerinfo'||_0x13db74===_0x2ac8('0x93')||_0x13db74===_0x2ac8('0x94')||_0x13db74===_0x2ac8('0x95')||_0x13db74===_0x2ac8('0x96'))){_0x1382a1['push'](new Extension(_0x216843,_0x3dd8f4,_0x2ac8('0x97')+_0x13db74+')='+_0x216843[_0x13db74],_0x2ac8('0x98')));_0x3dd8f4+=0x1;}}_0x1382a1[_0x2ac8('0x90')](new Extension(_0x216843,_0x3dd8f4,'6',_0x2ac8('0x99')));_0x3dd8f4+=0x1;_0x1382a1['push'](new Extension(_0x216843,_0x3dd8f4,_0x2ac8('0x9a'),_0x2ac8('0x9b')));_0x3dd8f4=0x0;return _0x1382a1;}exports[_0x2ac8('0x9c')]=function(_0x3c4cd7,_0x441736,_0x592d5d){var _0x564cb8;return db[_0x2ac8('0x80')][_0x2ac8('0x9d')](function(_0x503355){return db[_0x2ac8('0x52')][_0x2ac8('0x5b')](_0x3c4cd7[_0x2ac8('0x5c')],{'transaction':_0x503355})[_0x2ac8('0x1e')](function(_0x3121d9){_0x564cb8=_0x3121d9[_0x2ac8('0x5e')]({'plain':!![]});return db[_0x2ac8('0x9e')]['bulkCreate'](createExtensionsReciveFax(_0x564cb8),{'transaction':_0x503355});});})[_0x2ac8('0x1e')](function(){return _0x564cb8;})[_0x2ac8('0x1e')](respondWithResult(_0x441736,null))[_0x2ac8('0x29')](handleError(_0x441736,null));};exports[_0x2ac8('0x9f')]=function(_0x570914,_0x1e1f99,_0x2fa5ba){var _0xe0d023;return db[_0x2ac8('0x80')]['transaction'](function(_0xccf13d){return db[_0x2ac8('0x52')][_0x2ac8('0x34')](_0x570914[_0x2ac8('0x5c')],{'where':{'id':_0x570914['body']['id']},'transaction':_0xccf13d})[_0x2ac8('0x1e')](function(_0x30f7c7){return db[_0x2ac8('0x9e')][_0x2ac8('0x64')]({'where':{'FaxAccountId':_0x570914['body']['id']},'transaction':_0xccf13d})[_0x2ac8('0x1e')](function(_0x375b66){return db[_0x2ac8('0x9e')]['bulkCreate'](createExtensionsReciveFax(_[_0x2ac8('0x75')](_0x570914[_0x2ac8('0x5c')],[_0x2ac8('0xa0'),'key',_0x2ac8('0xa1'),_0x2ac8('0xa2'),_0x2ac8('0xa3'),'ListId'])),{'transaction':_0xccf13d});});});})[_0x2ac8('0x1e')](function(){return db[_0x2ac8('0x52')][_0x2ac8('0xa4')](_0x570914[_0x2ac8('0x5c')]['id']);})[_0x2ac8('0x1e')](respondWithResult(_0x1e1f99,null))[_0x2ac8('0x29')](handleError(_0x1e1f99,null));};exports[_0x2ac8('0xa5')]=function(_0x4b7dca,_0xde1f1c,_0xa0dfc5){var _0x56e0c1={'raw':!![],'where':{}};var _0x58db05={};var _0x11f4f3={'count':0x0,'rows':[]};return db[_0x2ac8('0x52')]['findOne']({'where':{'id':_0x4b7dca[_0x2ac8('0x55')]['id']}})[_0x2ac8('0x1e')](handleEntityNotFound(_0xde1f1c,null))['then'](function(_0x27000a){if(_0x27000a){_0x58db05[_0x2ac8('0x41')]=_['keys'](db[_0x2ac8('0xa6')][_0x2ac8('0x57')]);_0x58db05['query']=_[_0x2ac8('0x43')](_0x4b7dca[_0x2ac8('0x42')]);_0x58db05[_0x2ac8('0x44')]=_[_0x2ac8('0x45')](_0x58db05[_0x2ac8('0x41')],_0x58db05[_0x2ac8('0x42')]);_0x56e0c1['attributes']=_[_0x2ac8('0x45')](_0x58db05[_0x2ac8('0x41')],qs[_0x2ac8('0x46')](_0x4b7dca['query'][_0x2ac8('0x46')]));_0x56e0c1[_0x2ac8('0x47')]=_0x56e0c1['attributes']['length']?_0x56e0c1[_0x2ac8('0x47')]:_0x58db05[_0x2ac8('0x41')];if(!_0x4b7dca[_0x2ac8('0x42')][_0x2ac8('0x49')]('nolimit')){_0x56e0c1[_0x2ac8('0x2d')]=qs[_0x2ac8('0x2d')](_0x4b7dca[_0x2ac8('0x42')][_0x2ac8('0x2d')]);_0x56e0c1[_0x2ac8('0x2b')]=qs[_0x2ac8('0x2b')](_0x4b7dca[_0x2ac8('0x42')][_0x2ac8('0x2b')]);}_0x56e0c1[_0x2ac8('0x4a')]=qs[_0x2ac8('0x4b')](_0x4b7dca[_0x2ac8('0x42')][_0x2ac8('0x4b')]);_0x56e0c1[_0x2ac8('0x4c')]=qs[_0x2ac8('0x44')](_[_0x2ac8('0x4d')](_0x4b7dca[_0x2ac8('0x42')],_0x58db05[_0x2ac8('0x44')]));_0x56e0c1['where'][_0x2ac8('0x67')]=_0x27000a['id'];if(_0x4b7dca[_0x2ac8('0x42')][_0x2ac8('0x4e')]){_0x56e0c1['where']=_[_0x2ac8('0x4f')](_0x56e0c1[_0x2ac8('0x4c')],{'$or':_[_0x2ac8('0x3d')](_0x56e0c1['attributes'],function(_0xa0198a){var _0x57b786={};_0x57b786[_0xa0198a]={'$like':'%'+_0x4b7dca['query'][_0x2ac8('0x4e')]+'%'};return _0x57b786;})});}if(_0x4b7dca[_0x2ac8('0x42')][_0x2ac8('0xa7')]){var _0x21bdbc=_0x4b7dca[_0x2ac8('0x42')][_0x2ac8('0xa7')][_0x2ac8('0xa8')](',');var _0x21de53={};_0x21de53[_0x21bdbc[0x0]]={'$gte':moment(_0x21bdbc[0x1])[_0x2ac8('0xa9')](_0x2ac8('0xaa'))};_0x56e0c1['where']=_[_0x2ac8('0x4f')](_0x56e0c1[_0x2ac8('0x4c')],_0x21de53);}_0x56e0c1=_['merge']({},_0x56e0c1,_0x4b7dca[_0x2ac8('0x51')]);return db[_0x2ac8('0xa6')][_0x2ac8('0x2e')]({'where':_0x56e0c1[_0x2ac8('0x4c')]})[_0x2ac8('0x1e')](function(_0x5a13eb){_0x11f4f3[_0x2ac8('0x2e')]=_0x5a13eb;if(_0x4b7dca[_0x2ac8('0x42')][_0x2ac8('0x58')]){_0x56e0c1[_0x2ac8('0x59')]=[{'all':!![]}];}return db[_0x2ac8('0xa6')][_0x2ac8('0x6c')](_0x56e0c1);})['then'](function(_0xc971ed){_0x11f4f3['rows']=_0xc971ed;return _0x11f4f3;});}})[_0x2ac8('0x1e')](respondWithFilteredResult(_0xde1f1c,_0x56e0c1))[_0x2ac8('0x29')](handleError(_0xde1f1c,null));};exports[_0x2ac8('0x3b')]=function(_0x1cbe28,_0x38f5dc,_0x1a3262){var _0x758c5e,_0x2da251={},_0x5837bc;if(_0x1cbe28[_0x2ac8('0x5c')]['to']){_0x5837bc=_0x1cbe28[_0x2ac8('0x5c')]['to'][0x0];}return db[_0x2ac8('0x52')]['find']({'where':{'id':_0x1cbe28[_0x2ac8('0x55')]['id']},'include':[{'model':db[_0x2ac8('0xab')],'as':_0x2ac8('0xac'),'include':[{'model':db[_0x2ac8('0x77')],'as':_0x2ac8('0xad'),'where':{'fax':_0x5837bc},'limit':0x1,'order':[[_0x2ac8('0xa2'),_0x2ac8('0xae')]]}]}]})[_0x2ac8('0x1e')](handleEntityNotFound(_0x38f5dc,null))['then'](function(_0xd40886){_0x758c5e=_0xd40886;if(_0x1cbe28['body']['attachments']&&_0x1cbe28[_0x2ac8('0x5c')][_0x2ac8('0xaf')][_0x2ac8('0x48')]){for(var _0x16dd59=0x0;_0x16dd59<_0x1cbe28['body']['attachments'][_0x2ac8('0x48')];_0x16dd59+=0x1){_0x1cbe28[_0x2ac8('0x5c')][_0x2ac8('0xaf')][_0x16dd59]={'filename':_0x1cbe28['body']['attachments'][_0x16dd59]['name'],'id':_0x1cbe28[_0x2ac8('0x5c')][_0x2ac8('0xaf')][_0x16dd59]['id'],'path':path['join'](config['root'],_0x2ac8('0xb0'),_0x1cbe28[_0x2ac8('0x5c')]['attachments'][_0x16dd59][_0x2ac8('0xb1')])};}}return respondWithRpcPromise(_0x2ac8('0xb2'),'CheckAfterSend',{'FaxAccountId':_[_0x2ac8('0xb3')](_0x1cbe28[_0x2ac8('0x55')]['id'])?undefined:_0x1cbe28['params']['id'],'path':_[_0x2ac8('0xb3')](_0x1cbe28[_0x2ac8('0x5c')][_0x2ac8('0xaf')][0x0][_0x2ac8('0xb4')])?undefined:_0x1cbe28['body']['attachments'][0x0][_0x2ac8('0xb4')],'fax':_[_0x2ac8('0xb3')](_0x1cbe28[_0x2ac8('0x5c')]['to'][0x0])?undefined:_0x1cbe28[_0x2ac8('0x5c')]['to'][0x0]},client9002);})[_0x2ac8('0x1e')](function(){if(_0x758c5e){if(_[_0x2ac8('0xb3')](_0x1cbe28['body'][_0x2ac8('0xb5')])){_0x1cbe28[_0x2ac8('0x5c')][_0x2ac8('0xb5')]=util[_0x2ac8('0xa9')]('\x22%s\x22\x20<%s>',_0x758c5e[_0x2ac8('0x3a')],_0x758c5e['fax']);}if(_0x758c5e['List']){if(_0x758c5e[_0x2ac8('0xac')][_0x2ac8('0xad')][_0x2ac8('0x48')]){return _0x758c5e[_0x2ac8('0xac')]['Contacts'][0x0];}else{return db[_0x2ac8('0x77')]['create'](_[_0x2ac8('0x15')](_0x1cbe28['body'],{'firstName':_0x1cbe28[_0x2ac8('0x5c')]['to'][0x0],'phone':_0x1cbe28[_0x2ac8('0x5c')]['to'][0x0],'fax':_0x1cbe28[_0x2ac8('0x5c')]['to'][0x0],'ListId':_0x758c5e[_0x2ac8('0xb6')]}));}}else{throw new Error(_0x2ac8('0xb7'));}}else{throw new Error(_0x2ac8('0xb8'));}})[_0x2ac8('0x1e')](function(_0x57025c){if(_0x57025c){return db[_0x2ac8('0x73')][_0x2ac8('0x5a')]({'where':{'ContactId':_0x57025c['id'],'closed':![],'FaxAccountId':_0x758c5e['id']}})[_0x2ac8('0x1e')](function(_0x3c832d){if(_0x3c832d){return[_0x3c832d,![]];}return db[_0x2ac8('0x73')]['create']({'UserId':_0x1cbe28[_0x2ac8('0x5d')]['id'],'ContactId':_0x57025c['id'],'FaxAccountId':_0x758c5e['id'],'fax':_0x1cbe28[_0x2ac8('0x5c')]['to'][0x0],'firstMsgDirection':_0x2ac8('0xb9'),'Messages':[_[_0x2ac8('0x4f')](_0x1cbe28['body'],{'read':![],'body':_0x1cbe28['body']['attachments'][0x0][_0x2ac8('0xba')],'FaxAccountId':_0x758c5e['id'],'UserId':_0x1cbe28[_0x2ac8('0x5d')]['id'],'ContactId':_0x57025c['id'],'AttachmentId':_0x1cbe28[_0x2ac8('0x5c')][_0x2ac8('0xaf')][0x0]['id']})]},{'include':[{'model':db[_0x2ac8('0xa6')],'as':_0x2ac8('0xbb')}]})[_0x2ac8('0x1e')](function(_0x4645e4){return[_0x4645e4,!![]];});});}else{throw new Error(_0x2ac8('0xbc'));}})[_0x2ac8('0xbd')](function(_0x278f84,_0x15992d){if(_0x15992d){return _0x278f84;}return db[_0x2ac8('0xa6')][_0x2ac8('0x5b')]({'direction':_0x2ac8('0xb9'),'read':![],'body':_0x1cbe28[_0x2ac8('0x5c')]['attachments'][0x0]['filename'],'FaxAccountId':_0x758c5e['id'],'FaxInteractionId':_0x278f84['id'],'UserId':_0x1cbe28[_0x2ac8('0x5d')]['id'],'ContactId':_0x278f84['ContactId'],'AttachmentId':_0x1cbe28[_0x2ac8('0x5c')]['attachments'][0x0]['id']})[_0x2ac8('0x1e')](function(_0x575f6d){_0x278f84[_0x2ac8('0xbe')][_0x2ac8('0xbb')]=[];_0x278f84[_0x2ac8('0xbe')][_0x2ac8('0xbb')][_0x2ac8('0x90')](_0x575f6d[_0x2ac8('0xbe')]);return _0x278f84;});})[_0x2ac8('0x1e')](function(_0x25e2d9){respondWithRpcPromise(_0x2ac8('0xbf'),'SendFax',{'FaxAccountId':_['isNil'](_0x1cbe28[_0x2ac8('0x55')]['id'])?undefined:_0x1cbe28['params']['id'],'path':_['isNil'](_0x1cbe28[_0x2ac8('0x5c')][_0x2ac8('0xaf')][0x0]['path'])?undefined:_0x1cbe28[_0x2ac8('0x5c')][_0x2ac8('0xaf')][0x0][_0x2ac8('0xb4')],'fax':_['isNil'](_0x1cbe28[_0x2ac8('0x5c')]['to'][0x0])?undefined:_0x1cbe28[_0x2ac8('0x5c')]['to'][0x0],'AttachmentId':_0x1cbe28[_0x2ac8('0x5c')][_0x2ac8('0xaf')][0x0]['id']},client9002)[_0x2ac8('0x1e')](function(_0x2e32ca){logger['info'](_0x2ac8('0xc0'),_0x2e32ca);})[_0x2ac8('0x29')](function(_0x54770f){logger[_0x2ac8('0x1f')]('SendFaxRpc,\x20%s',_0x54770f);});return _0x25e2d9;})[_0x2ac8('0x1e')](respondWithResult(_0x38f5dc,null))[_0x2ac8('0x29')](handleError(_0x38f5dc,null));};exports[_0x2ac8('0xc1')]=function(_0x38aee2,_0x26306e,_0x1069e0){return db[_0x2ac8('0x52')]['find']({'where':{'id':_0x38aee2['params']['id']}})[_0x2ac8('0x1e')](handleEntityNotFound(_0x26306e,null))[_0x2ac8('0x1e')](function(_0x5456e3){if(_0x5456e3){return _0x5456e3[_0x2ac8('0xc1')](_0x38aee2[_0x2ac8('0x5c')][_0x2ac8('0x6e')],_[_0x2ac8('0x75')](_0x38aee2['body'],['ids','id'])||{})[_0x2ac8('0xbd')](function(_0x3a4476){for(var _0x55a97c=0x0;_0x55a97c<_0x38aee2[_0x2ac8('0x5c')]['ids'][_0x2ac8('0x48')];_0x55a97c+=0x1){socket[_0x2ac8('0xc2')](_0x2ac8('0xc3'),{'UserId':Number(_0x38aee2[_0x2ac8('0x5c')]['ids'][_0x55a97c]),'FaxAccountId':Number(_0x38aee2['params']['id'])});}return _0x3a4476;});}})[_0x2ac8('0x1e')](respondWithResult(_0x26306e,null))['catch'](handleError(_0x26306e,null));};exports[_0x2ac8('0xc4')]=function(_0x928f6a,_0x538074,_0x234ec7){return db[_0x2ac8('0x52')][_0x2ac8('0x5a')]({'where':{'id':_0x928f6a[_0x2ac8('0x55')]['id']}})[_0x2ac8('0x1e')](handleEntityNotFound(_0x538074,null))[_0x2ac8('0x1e')](function(_0x4c112f){if(_0x4c112f){return _0x4c112f[_0x2ac8('0xc4')](_0x928f6a['query'][_0x2ac8('0x6e')])[_0x2ac8('0x1e')](function(){if(_[_0x2ac8('0xc5')](_0x928f6a[_0x2ac8('0x42')][_0x2ac8('0x6e')])){for(var _0x597ef0=0x0;_0x597ef0<_0x928f6a[_0x2ac8('0x42')]['ids'][_0x2ac8('0x48')];_0x597ef0+=0x1){socket[_0x2ac8('0xc2')]('userFaxAccount:remove',{'UserId':Number(_0x928f6a[_0x2ac8('0x42')][_0x2ac8('0x6e')][_0x597ef0]),'FaxAccountId':Number(_0x928f6a['params']['id'])});}}else{socket[_0x2ac8('0xc2')](_0x2ac8('0xc6'),{'UserId':Number(_0x928f6a[_0x2ac8('0x42')][_0x2ac8('0x6e')]),'FaxAccountId':Number(_0x928f6a['params']['id'])});}});}})[_0x2ac8('0x1e')](respondWithStatusCode(_0x538074,null))[_0x2ac8('0x29')](handleError(_0x538074,null));};exports['getAgents']=function(_0x2f5d4c,_0xa8bc7e,_0x4cb35a){var _0x54e012={};var _0x3a1765={};var _0x534030;var _0x5bdd57;return db[_0x2ac8('0x52')]['findOne']({'where':{'id':_0x2f5d4c['params']['id']}})['then'](handleEntityNotFound(_0xa8bc7e,null))['then'](function(_0x122e9e){if(_0x122e9e){_0x534030=_0x122e9e;_0x3a1765['model']=_[_0x2ac8('0x43')](db[_0x2ac8('0xc7')][_0x2ac8('0x57')]);_0x3a1765['query']=_[_0x2ac8('0x43')](_0x2f5d4c[_0x2ac8('0x42')]);_0x3a1765['filters']=_[_0x2ac8('0x45')](_0x3a1765['model'],_0x3a1765['query']);_0x54e012[_0x2ac8('0x47')]=_['intersection'](_0x3a1765[_0x2ac8('0x41')],qs['fields'](_0x2f5d4c['query'][_0x2ac8('0x46')]));_0x54e012[_0x2ac8('0x47')]=_0x54e012[_0x2ac8('0x47')]['length']?_0x54e012[_0x2ac8('0x47')]:_0x3a1765[_0x2ac8('0x41')];_0x54e012[_0x2ac8('0x4a')]=qs[_0x2ac8('0x4b')](_0x2f5d4c[_0x2ac8('0x42')][_0x2ac8('0x4b')]);_0x54e012[_0x2ac8('0x4c')]=qs[_0x2ac8('0x44')](_['pick'](_0x2f5d4c['query'],_0x3a1765[_0x2ac8('0x44')]));if(_0x2f5d4c[_0x2ac8('0x42')][_0x2ac8('0x4e')]){_0x54e012[_0x2ac8('0x4c')]=_['merge'](_0x54e012[_0x2ac8('0x4c')],{'$or':_[_0x2ac8('0x3d')](_0x54e012['attributes'],function(_0x1642cb){var _0x4c838a={};_0x4c838a[_0x1642cb]={'$like':'%'+_0x2f5d4c['query']['filter']+'%'};return _0x4c838a;})});}_0x54e012=_[_0x2ac8('0x4f')]({},_0x54e012,_0x2f5d4c[_0x2ac8('0x51')]);return _0x534030[_0x2ac8('0xc8')](_0x54e012);}})['then'](function(_0x52f0fa){if(_0x52f0fa){_0x5bdd57=_0x52f0fa[_0x2ac8('0x48')];if(!_0x2f5d4c['query']['hasOwnProperty'](_0x2ac8('0x6b'))){_0x54e012[_0x2ac8('0x2d')]=qs['limit'](_0x2f5d4c[_0x2ac8('0x42')][_0x2ac8('0x2d')]);_0x54e012[_0x2ac8('0x2b')]=qs[_0x2ac8('0x2b')](_0x2f5d4c[_0x2ac8('0x42')][_0x2ac8('0x2b')]);}return _0x534030[_0x2ac8('0xc8')](_0x54e012);}})[_0x2ac8('0x1e')](function(_0x1bd2a4){if(_0x1bd2a4){return _0x1bd2a4?{'count':_0x5bdd57,'rows':_0x1bd2a4}:null;}})[_0x2ac8('0x1e')](respondWithResult(_0xa8bc7e,null))[_0x2ac8('0x29')](handleError(_0xa8bc7e,null));}; \ No newline at end of file +var _0x3014=['fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','show','params','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','rows','removeDispositions','ids','addAnswer','CannedAnswer','findAll','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','finally','json','getApplications','context','from-voip-provider','exten','localstationid','app','Fax\x20Extension','priority','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','maxrate','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','omit','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','split','format','CmList','List','Contacts','DESC','attachments','root','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','user','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','save','update','destroy','get','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes'];(function(_0x54c4e0,_0x4bbe50){var _0x5057e8=function(_0x124d04){while(--_0x124d04){_0x54c4e0['push'](_0x54c4e0['shift']());}};_0x5057e8(++_0x4bbe50);}(_0x3014,0x137));var _0x4301=function(_0x54cfbb,_0x5046ea){_0x54cfbb=_0x54cfbb-0x0;var _0x351ec8=_0x3014[_0x54cfbb];return _0x351ec8;};'use strict';var emlformat=require(_0x4301('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4301('0x1'));var jsonpatch=require(_0x4301('0x2'));var rp=require(_0x4301('0x3'));var moment=require(_0x4301('0x4'));var BPromise=require(_0x4301('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4301('0x6'));var csv=require(_0x4301('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4301('0x8'));var _=require(_0x4301('0x9'));var squel=require(_0x4301('0xa'));var crypto=require(_0x4301('0xb'));var jsforce=require(_0x4301('0xc'));var deskjs=require(_0x4301('0xd'));var toCsv=require(_0x4301('0x7'));var querystring=require(_0x4301('0xe'));var Papa=require('papaparse');var Redis=require(_0x4301('0xf'));var authService=require(_0x4301('0x10'));var qs=require(_0x4301('0x11'));var as=require(_0x4301('0x12'));var hardwareService=require(_0x4301('0x13'));var logger=require('../../config/logger')(_0x4301('0x14'));var utils=require(_0x4301('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4301('0x16'));var db=require(_0x4301('0x17'))['db'];config['redis']=_['defaults'](config[_0x4301('0x18')],{'host':_0x4301('0x19'),'port':0x18eb});var socket=require(_0x4301('0x1a'))(new Redis(config[_0x4301('0x18')]));require(_0x4301('0x1b'))[_0x4301('0x1c')](socket);var jayson=require(_0x4301('0x1d'));var client=jayson[_0x4301('0x1e')][_0x4301('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x4301('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x44e051,_0x5ed811,_0x346bb9,_0x550863){return new BPromise(function(_0xa04203,_0x2c77ca){var _0x15a93a=_0x550863||client;return _0x15a93a['request'](_0x44e051,_0x346bb9)[_0x4301('0x20')](function(_0x3ed695){logger[_0x4301('0x21')](_0x4301('0x22'),_0x5ed811,_0x4301('0x23'));logger[_0x4301('0x24')](_0x4301('0x25'),_0x5ed811,_0x4301('0x23'),JSON['stringify'](_0x3ed695));if(_0x3ed695[_0x4301('0x26')]){if(_0x3ed695[_0x4301('0x26')][_0x4301('0x27')]===0x1f4){logger[_0x4301('0x26')]('FaxAccount,\x20%s,\x20%s',_0x5ed811,_0x3ed695[_0x4301('0x26')]['message']);return _0x2c77ca(_0x3ed695[_0x4301('0x26')][_0x4301('0x28')]);}logger[_0x4301('0x26')](_0x4301('0x22'),_0x5ed811,_0x3ed695[_0x4301('0x26')][_0x4301('0x28')]);return _0xa04203(_0x3ed695[_0x4301('0x26')]['message']);}else{logger['info'](_0x4301('0x22'),_0x5ed811,_0x4301('0x23'));_0xa04203(_0x3ed695[_0x4301('0x29')][_0x4301('0x28')]);}})[_0x4301('0x2a')](function(_0x4281b2){logger[_0x4301('0x26')](_0x4301('0x22'),_0x5ed811,_0x4281b2);_0x2c77ca(_0x4281b2);});});}function respondWithStatusCode(_0x3c1692,_0x2e47a6){_0x2e47a6=_0x2e47a6||0xcc;return function(_0x45aca6){if(_0x45aca6){return _0x3c1692[_0x4301('0x2b')](_0x2e47a6);}return _0x3c1692['status'](_0x2e47a6)[_0x4301('0x2c')]();};}function respondWithResult(_0x5a2bd5,_0x5c1060){_0x5c1060=_0x5c1060||0xc8;return function(_0x58da65){if(_0x58da65){return _0x5a2bd5[_0x4301('0x2d')](_0x5c1060)['json'](_0x58da65);}};}function respondWithFilteredResult(_0x438d99,_0x5bf514){return function(_0x15cf23){if(_0x15cf23){var _0x23d861=typeof _0x5bf514[_0x4301('0x2e')]===_0x4301('0x2f')&&typeof _0x5bf514['limit']===_0x4301('0x2f');var _0x5516cc=_0x15cf23[_0x4301('0x30')];var _0x50e637=_0x23d861?0x0:_0x5bf514[_0x4301('0x2e')];var _0x110df7=_0x23d861?_0x15cf23[_0x4301('0x30')]:_0x5bf514['offset']+_0x5bf514[_0x4301('0x31')];var _0x59d6a6;if(_0x110df7>=_0x5516cc){_0x110df7=_0x5516cc;_0x59d6a6=0xc8;}else{_0x59d6a6=0xce;}_0x438d99[_0x4301('0x2d')](_0x59d6a6);return _0x438d99[_0x4301('0x32')](_0x4301('0x33'),_0x50e637+'-'+_0x110df7+'/'+_0x5516cc)['json'](_0x15cf23);}return null;};}function patchUpdates(_0x499962){return function(_0x487cbb){try{jsonpatch['apply'](_0x487cbb,_0x499962,!![]);}catch(_0x246ca1){return BPromise['reject'](_0x246ca1);}return _0x487cbb[_0x4301('0x34')]();};}function saveUpdates(_0x87939b,_0x469da9){return function(_0x37ecbe){if(_0x37ecbe){return _0x37ecbe[_0x4301('0x35')](_0x87939b)['then'](function(_0x36a5bb){return _0x36a5bb;});}return null;};}function removeEntity(_0x1781d2,_0x56d8d8){return function(_0x2aaa08){if(_0x2aaa08){return _0x2aaa08[_0x4301('0x36')]()['then'](function(){var _0x5c50a5=_0x2aaa08[_0x4301('0x37')]({'plain':!![]});var _0x3c86d4='FaxAccounts';return db[_0x4301('0x38')][_0x4301('0x36')]({'where':{'type':_0x3c86d4,'resourceId':_0x5c50a5['id']}})[_0x4301('0x20')](function(){return _0x2aaa08;});})[_0x4301('0x20')](function(){_0x1781d2['status'](0xcc)[_0x4301('0x2c')]();});}};}function handleEntityNotFound(_0x572f4e,_0x389a6c){return function(_0x260adf){if(!_0x260adf){_0x572f4e[_0x4301('0x2b')](0x194);}return _0x260adf;};}function handleError(_0x39ac16,_0x22cea9){_0x22cea9=_0x22cea9||0x1f4;return function(_0x46fc87){logger['error'](_0x46fc87[_0x4301('0x39')]);if(_0x46fc87[_0x4301('0x3a')]){delete _0x46fc87[_0x4301('0x3a')];}_0x39ac16[_0x4301('0x2d')](_0x22cea9)[_0x4301('0x3b')](_0x46fc87);};}exports['index']=function(_0x52796e,_0x30028b){var _0x55e8c1={'include':[{'model':db[_0x4301('0x3c')],'as':_0x4301('0x3d')}]},_0x30fa88={},_0x49ec2d={'count':0x0,'rows':[]};var _0x4df2e7=_['map'](db[_0x4301('0x3e')][_0x4301('0x3f')],function(_0x27fb64){return{'name':_0x27fb64['fieldName'],'type':_0x27fb64[_0x4301('0x40')][_0x4301('0x41')]};});_0x30fa88[_0x4301('0x42')]=_[_0x4301('0x43')](_0x4df2e7,_0x4301('0x3a'));_0x30fa88[_0x4301('0x44')]=_[_0x4301('0x45')](_0x52796e[_0x4301('0x44')]);_0x30fa88[_0x4301('0x46')]=_[_0x4301('0x47')](_0x30fa88[_0x4301('0x42')],_0x30fa88[_0x4301('0x44')]);_0x55e8c1[_0x4301('0x48')]=_[_0x4301('0x47')](_0x30fa88['model'],qs[_0x4301('0x49')](_0x52796e[_0x4301('0x44')]['fields']));_0x55e8c1[_0x4301('0x48')]=_0x55e8c1['attributes']['length']?_0x55e8c1['attributes']:_0x30fa88['model'];if(!_0x52796e['query']['hasOwnProperty'](_0x4301('0x4a'))){_0x55e8c1[_0x4301('0x31')]=qs['limit'](_0x52796e[_0x4301('0x44')]['limit']);_0x55e8c1[_0x4301('0x2e')]=qs[_0x4301('0x2e')](_0x52796e[_0x4301('0x44')][_0x4301('0x2e')]);}_0x55e8c1[_0x4301('0x4b')]=qs[_0x4301('0x4c')](_0x52796e[_0x4301('0x44')]['sort']);_0x55e8c1[_0x4301('0x4d')]=qs[_0x4301('0x46')](_[_0x4301('0x4e')](_0x52796e[_0x4301('0x44')],_0x30fa88[_0x4301('0x46')]),_0x4df2e7);if(_0x52796e['query'][_0x4301('0x4f')]){_0x55e8c1[_0x4301('0x4d')]=_[_0x4301('0x50')](_0x55e8c1[_0x4301('0x4d')],{'$or':_[_0x4301('0x43')](_0x4df2e7,function(_0x2d97fc){if(_0x2d97fc[_0x4301('0x40')]!==_0x4301('0x51')){var _0x1a699f={};_0x1a699f[_0x2d97fc[_0x4301('0x3a')]]={'$like':'%'+_0x52796e[_0x4301('0x44')][_0x4301('0x4f')]+'%'};return _0x1a699f;}})});}_0x55e8c1=_[_0x4301('0x50')]({},_0x55e8c1,_0x52796e[_0x4301('0x52')]);var _0x1e06a6={'where':_0x55e8c1[_0x4301('0x4d')]};return db[_0x4301('0x3e')][_0x4301('0x30')](_0x1e06a6)['then'](function(_0x22579c){_0x49ec2d[_0x4301('0x30')]=_0x22579c;if(_0x52796e[_0x4301('0x44')]['includeAll']){_0x55e8c1[_0x4301('0x53')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x55e8c1);})['then'](function(_0x58b5a0){_0x49ec2d['rows']=_0x58b5a0;return _0x49ec2d;})[_0x4301('0x20')](respondWithFilteredResult(_0x30028b,_0x55e8c1))[_0x4301('0x2a')](handleError(_0x30028b,null));};exports[_0x4301('0x54')]=function(_0x3247ca,_0xdf6c1b){var _0x569035={'raw':![],'where':{'id':_0x3247ca[_0x4301('0x55')]['id']},'include':[{'model':db[_0x4301('0x3c')],'as':_0x4301('0x3d')}]},_0x13729f={};_0x13729f[_0x4301('0x42')]=_[_0x4301('0x45')](db[_0x4301('0x3e')][_0x4301('0x3f')]);_0x13729f[_0x4301('0x44')]=_[_0x4301('0x45')](_0x3247ca[_0x4301('0x44')]);_0x13729f[_0x4301('0x46')]=_[_0x4301('0x47')](_0x13729f['model'],_0x13729f[_0x4301('0x44')]);_0x569035[_0x4301('0x48')]=_[_0x4301('0x47')](_0x13729f['model'],qs[_0x4301('0x49')](_0x3247ca['query']['fields']));_0x569035[_0x4301('0x48')]=_0x569035['attributes'][_0x4301('0x56')]?_0x569035[_0x4301('0x48')]:_0x13729f['model'];if(_0x3247ca['query'][_0x4301('0x57')]){_0x569035['include']=[{'all':!![]}];}_0x569035=_[_0x4301('0x50')]({},_0x569035,_0x3247ca['options']);return db['FaxAccount'][_0x4301('0x58')](_0x569035)['then'](handleEntityNotFound(_0xdf6c1b,null))[_0x4301('0x20')](respondWithResult(_0xdf6c1b,null))[_0x4301('0x2a')](handleError(_0xdf6c1b,null));};exports[_0x4301('0x59')]=function(_0x3c8658,_0x2e89ef){return db['FaxAccount'][_0x4301('0x59')](_0x3c8658[_0x4301('0x5a')],{})[_0x4301('0x20')](function(_0x353ef3){var _0x27dd88=_0x3c8658['user']['get']({'plain':!![]});if(!_0x27dd88)throw new Error(_0x4301('0x5b'));if(_0x27dd88[_0x4301('0x5c')]==='user'){var _0x4f4c84=_0x353ef3[_0x4301('0x37')]({'plain':!![]});var _0x1d92dc='FaxAccounts';return db[_0x4301('0x5d')][_0x4301('0x58')]({'where':{'name':_0x1d92dc,'userProfileId':_0x27dd88[_0x4301('0x5e')]},'raw':!![]})[_0x4301('0x20')](function(_0x1a549a){if(_0x1a549a&&_0x1a549a[_0x4301('0x5f')]===0x0){return db[_0x4301('0x38')][_0x4301('0x59')]({'name':_0x4f4c84[_0x4301('0x3a')],'resourceId':_0x4f4c84['id'],'type':_0x1a549a[_0x4301('0x3a')],'sectionId':_0x1a549a['id']},{})[_0x4301('0x20')](function(){return _0x353ef3;});}else{return _0x353ef3;}})[_0x4301('0x2a')](function(_0x12f477){logger[_0x4301('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12f477);throw _0x12f477;});}return _0x353ef3;})[_0x4301('0x20')](respondWithResult(_0x2e89ef,0xc9))[_0x4301('0x2a')](handleError(_0x2e89ef,null));};exports[_0x4301('0x35')]=function(_0x1df519,_0x3a137f){if(_0x1df519[_0x4301('0x5a')]['id']){delete _0x1df519[_0x4301('0x5a')]['id'];}return db['FaxAccount'][_0x4301('0x58')]({'where':{'id':_0x1df519[_0x4301('0x55')]['id']},'include':[{'model':db[_0x4301('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x4301('0x20')](handleEntityNotFound(_0x3a137f,null))['then'](saveUpdates(_0x1df519['body'],null))[_0x4301('0x20')](respondWithResult(_0x3a137f,null))[_0x4301('0x2a')](handleError(_0x3a137f,null));};exports[_0x4301('0x36')]=function(_0x14ef6c,_0x3d5b56){return db['FaxAccount'][_0x4301('0x58')]({'where':{'id':_0x14ef6c['params']['id']}})[_0x4301('0x20')](handleEntityNotFound(_0x3d5b56,null))[_0x4301('0x20')](removeEntity(_0x3d5b56,null))[_0x4301('0x2a')](handleError(_0x3d5b56,null));};exports[_0x4301('0x60')]=function(_0x2cbd99,_0xb70c72){return db[_0x4301('0x3e')][_0x4301('0x60')]()[_0x4301('0x20')](respondWithResult(_0xb70c72,null))[_0x4301('0x2a')](handleError(_0xb70c72,null));};exports[_0x4301('0x61')]=function(_0x37e833,_0x27a681,_0x492a47){if(_0x37e833[_0x4301('0x5a')]['id']){delete _0x37e833[_0x4301('0x5a')]['id'];}return db[_0x4301('0x3e')][_0x4301('0x58')]({'where':{'id':_0x37e833[_0x4301('0x55')]['id']}})[_0x4301('0x20')](handleEntityNotFound(_0x27a681,null))[_0x4301('0x20')](function(_0x4dd655){if(_0x4dd655){_0x37e833[_0x4301('0x5a')][_0x4301('0x62')]=_0x4dd655['id'];return db[_0x4301('0x63')][_0x4301('0x59')](_0x37e833[_0x4301('0x5a')]);}})[_0x4301('0x20')](respondWithResult(_0x27a681,null))[_0x4301('0x2a')](handleError(_0x27a681,null));};exports[_0x4301('0x64')]=function(_0x35be4e,_0x258d97,_0x230e3c){var _0x4eb505={'raw':![],'where':{}};var _0x518363={};var _0x3ba94c={'count':0x0,'rows':[]};return db[_0x4301('0x3e')][_0x4301('0x65')]({'where':{'id':_0x35be4e['params']['id']}})[_0x4301('0x20')](handleEntityNotFound(_0x258d97,null))['then'](function(_0x35628c){if(_0x35628c){_0x518363[_0x4301('0x42')]=_['keys'](db['Disposition'][_0x4301('0x3f')]);_0x518363[_0x4301('0x44')]=_[_0x4301('0x45')](_0x35be4e[_0x4301('0x44')]);_0x518363[_0x4301('0x46')]=_[_0x4301('0x47')](_0x518363[_0x4301('0x42')],_0x518363[_0x4301('0x44')]);_0x4eb505[_0x4301('0x48')]=_[_0x4301('0x47')](_0x518363[_0x4301('0x42')],qs[_0x4301('0x49')](_0x35be4e['query']['fields']));_0x4eb505[_0x4301('0x48')]=_0x4eb505[_0x4301('0x48')][_0x4301('0x56')]?_0x4eb505['attributes']:_0x518363[_0x4301('0x42')];if(!_0x35be4e[_0x4301('0x44')][_0x4301('0x66')](_0x4301('0x4a'))){_0x4eb505['limit']=qs[_0x4301('0x31')](_0x35be4e[_0x4301('0x44')][_0x4301('0x31')]);_0x4eb505['offset']=qs[_0x4301('0x2e')](_0x35be4e[_0x4301('0x44')][_0x4301('0x2e')]);}_0x4eb505['order']=qs['sort'](_0x35be4e[_0x4301('0x44')][_0x4301('0x4c')]);_0x4eb505[_0x4301('0x4d')]=qs['filters'](_[_0x4301('0x4e')](_0x35be4e[_0x4301('0x44')],_0x518363[_0x4301('0x46')]));_0x4eb505[_0x4301('0x4d')]['FaxAccountId']=_0x35628c['id'];if(_0x35be4e[_0x4301('0x44')]['filter']){_0x4eb505[_0x4301('0x4d')]=_[_0x4301('0x50')](_0x4eb505['where'],{'$or':_[_0x4301('0x43')](_0x4eb505[_0x4301('0x48')],function(_0x5e1a3c){var _0x5a6825={};_0x5a6825[_0x5e1a3c]={'$like':'%'+_0x35be4e[_0x4301('0x44')][_0x4301('0x4f')]+'%'};return _0x5a6825;})});}_0x4eb505=_[_0x4301('0x50')]({},_0x4eb505,_0x35be4e[_0x4301('0x52')]);return db[_0x4301('0x63')][_0x4301('0x30')]({'where':_0x4eb505[_0x4301('0x4d')]})['then'](function(_0x1003bc){_0x3ba94c[_0x4301('0x30')]=_0x1003bc;if(_0x35be4e[_0x4301('0x44')]['includeAll']){_0x4eb505[_0x4301('0x53')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x4eb505);})[_0x4301('0x20')](function(_0x39ba78){_0x3ba94c[_0x4301('0x67')]=_0x39ba78;return _0x3ba94c;});}})[_0x4301('0x20')](respondWithFilteredResult(_0x258d97,_0x4eb505))[_0x4301('0x2a')](handleError(_0x258d97,null));};exports[_0x4301('0x68')]=function(_0xbb4778,_0xa4f13b,_0x17a6bf){return db[_0x4301('0x3e')][_0x4301('0x58')]({'where':{'id':_0xbb4778['params']['id']}})['then'](handleEntityNotFound(_0xa4f13b,null))[_0x4301('0x20')](function(_0x3cdaa7){if(_0x3cdaa7){return _0x3cdaa7['removeDispositions'](_0xbb4778[_0x4301('0x44')][_0x4301('0x69')]);}})[_0x4301('0x20')](respondWithStatusCode(_0xa4f13b,null))['catch'](handleError(_0xa4f13b,null));};exports[_0x4301('0x6a')]=function(_0x2df9d9,_0x4e01a9,_0x1b5e32){if(_0x2df9d9[_0x4301('0x5a')]['id']){delete _0x2df9d9[_0x4301('0x5a')]['id'];}return db[_0x4301('0x3e')][_0x4301('0x58')]({'where':{'id':_0x2df9d9['params']['id']}})['then'](handleEntityNotFound(_0x4e01a9,null))['then'](function(_0x50d32b){if(_0x50d32b){_0x2df9d9[_0x4301('0x5a')]['FaxAccountId']=_0x50d32b['id'];return db['CannedAnswer'][_0x4301('0x59')](_0x2df9d9[_0x4301('0x5a')]);}})[_0x4301('0x20')](respondWithResult(_0x4e01a9,null))[_0x4301('0x2a')](handleError(_0x4e01a9,null));};exports['getAnswers']=function(_0x38e022,_0x4d42c2,_0x57a164){var _0x49a3fa={'raw':![],'where':{}};var _0x4f20fa={};var _0x21f0ca={'count':0x0,'rows':[]};return db[_0x4301('0x3e')][_0x4301('0x65')]({'where':{'id':_0x38e022['params']['id']}})[_0x4301('0x20')](handleEntityNotFound(_0x4d42c2,null))[_0x4301('0x20')](function(_0xecb6d4){if(_0xecb6d4){_0x4f20fa['model']=_[_0x4301('0x45')](db['CannedAnswer'][_0x4301('0x3f')]);_0x4f20fa[_0x4301('0x44')]=_[_0x4301('0x45')](_0x38e022['query']);_0x4f20fa[_0x4301('0x46')]=_[_0x4301('0x47')](_0x4f20fa[_0x4301('0x42')],_0x4f20fa[_0x4301('0x44')]);_0x49a3fa[_0x4301('0x48')]=_[_0x4301('0x47')](_0x4f20fa[_0x4301('0x42')],qs[_0x4301('0x49')](_0x38e022[_0x4301('0x44')]['fields']));_0x49a3fa[_0x4301('0x48')]=_0x49a3fa[_0x4301('0x48')][_0x4301('0x56')]?_0x49a3fa[_0x4301('0x48')]:_0x4f20fa[_0x4301('0x42')];if(!_0x38e022[_0x4301('0x44')][_0x4301('0x66')](_0x4301('0x4a'))){_0x49a3fa['limit']=qs[_0x4301('0x31')](_0x38e022[_0x4301('0x44')][_0x4301('0x31')]);_0x49a3fa[_0x4301('0x2e')]=qs[_0x4301('0x2e')](_0x38e022[_0x4301('0x44')][_0x4301('0x2e')]);}_0x49a3fa[_0x4301('0x4b')]=qs[_0x4301('0x4c')](_0x38e022[_0x4301('0x44')]['sort']);_0x49a3fa[_0x4301('0x4d')]=qs[_0x4301('0x46')](_['pick'](_0x38e022['query'],_0x4f20fa[_0x4301('0x46')]));_0x49a3fa[_0x4301('0x4d')][_0x4301('0x62')]=_0xecb6d4['id'];if(_0x38e022[_0x4301('0x44')][_0x4301('0x4f')]){_0x49a3fa['where']=_[_0x4301('0x50')](_0x49a3fa[_0x4301('0x4d')],{'$or':_['map'](_0x49a3fa[_0x4301('0x48')],function(_0x16eb11){var _0x1cf2eb={};_0x1cf2eb[_0x16eb11]={'$like':'%'+_0x38e022[_0x4301('0x44')][_0x4301('0x4f')]+'%'};return _0x1cf2eb;})});}_0x49a3fa=_[_0x4301('0x50')]({},_0x49a3fa,_0x38e022[_0x4301('0x52')]);return db['CannedAnswer'][_0x4301('0x30')]({'where':_0x49a3fa[_0x4301('0x4d')]})[_0x4301('0x20')](function(_0x4cd0a3){_0x21f0ca[_0x4301('0x30')]=_0x4cd0a3;if(_0x38e022[_0x4301('0x44')]['includeAll']){_0x49a3fa[_0x4301('0x53')]=[{'all':!![]}];}return db[_0x4301('0x6b')][_0x4301('0x6c')](_0x49a3fa);})['then'](function(_0x3b7be2){_0x21f0ca[_0x4301('0x67')]=_0x3b7be2;return _0x21f0ca;});}})[_0x4301('0x20')](respondWithFilteredResult(_0x4d42c2,_0x49a3fa))[_0x4301('0x2a')](handleError(_0x4d42c2,null));};exports[_0x4301('0x6d')]=function(_0x2415aa,_0x1422c8,_0x4e01be){return db['FaxAccount'][_0x4301('0x58')]({'where':{'id':_0x2415aa[_0x4301('0x55')]['id']}})[_0x4301('0x20')](handleEntityNotFound(_0x1422c8,null))[_0x4301('0x20')](function(_0x4bdb20){if(_0x4bdb20){return _0x4bdb20[_0x4301('0x6d')](_0x2415aa[_0x4301('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x1422c8,null))[_0x4301('0x2a')](handleError(_0x1422c8,null));};exports[_0x4301('0x6e')]=function(_0x34764b,_0x41334e,_0x17e4f0){return db[_0x4301('0x6f')][_0x4301('0x58')]({'where':{'id':_0x34764b[_0x4301('0x55')]['id']}})[_0x4301('0x20')](handleEntityNotFound(_0x41334e,null))['then'](function(_0x22f722){if(_0x22f722){return _0x22f722['addInteraction'](_0x34764b[_0x4301('0x5a')][_0x4301('0x69')],_['omit'](_0x34764b['body'],[_0x4301('0x69'),'id'])||{});}})['then'](respondWithResult(_0x41334e,null))[_0x4301('0x2a')](handleError(_0x41334e,null));};exports[_0x4301('0x70')]=function(_0x125c45,_0x204a83,_0x4008f6){var _0x5d5810={'raw':![],'where':{}};var _0xca2d4c={};var _0x39916f={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4301('0x65')]({'where':{'id':_0x125c45[_0x4301('0x55')]['id']}})['then'](handleEntityNotFound(_0x204a83,null))[_0x4301('0x20')](function(_0x57b48f){if(_0x57b48f){_0xca2d4c[_0x4301('0x42')]=_[_0x4301('0x45')](db[_0x4301('0x6f')][_0x4301('0x3f')]);_0xca2d4c[_0x4301('0x44')]=_[_0x4301('0x45')](_0x125c45[_0x4301('0x44')]);_0xca2d4c[_0x4301('0x46')]=_[_0x4301('0x47')](_0xca2d4c['model'],_0xca2d4c['query']);_0x5d5810[_0x4301('0x48')]=_[_0x4301('0x47')](_0xca2d4c[_0x4301('0x42')],qs['fields'](_0x125c45[_0x4301('0x44')]['fields']));_0x5d5810[_0x4301('0x48')]=_0x5d5810[_0x4301('0x48')]['length']?_0x5d5810[_0x4301('0x48')]:_0xca2d4c[_0x4301('0x42')];if(!_0x125c45[_0x4301('0x44')]['hasOwnProperty'](_0x4301('0x4a'))){_0x5d5810['limit']=qs[_0x4301('0x31')](_0x125c45[_0x4301('0x44')][_0x4301('0x31')]);_0x5d5810['offset']=qs[_0x4301('0x2e')](_0x125c45[_0x4301('0x44')][_0x4301('0x2e')]);}_0x5d5810[_0x4301('0x4b')]=qs['sort'](_0x125c45[_0x4301('0x44')][_0x4301('0x4c')]);_0x5d5810[_0x4301('0x4d')]=qs[_0x4301('0x46')](_[_0x4301('0x4e')](_0x125c45[_0x4301('0x44')],_0xca2d4c[_0x4301('0x46')]));_0x5d5810[_0x4301('0x4d')][_0x4301('0x62')]=_0x57b48f['id'];if(_0x125c45['query']['filter']){_0x5d5810[_0x4301('0x4d')]=_[_0x4301('0x50')](_0x5d5810['where'],{'$or':_[_0x4301('0x43')](_0x5d5810['attributes'],function(_0x4daca5){var _0x3795f9={};_0x3795f9[_0x4daca5]={'$like':'%'+_0x125c45['query'][_0x4301('0x4f')]+'%'};return _0x3795f9;})});}_0x5d5810=_[_0x4301('0x50')]({},_0x5d5810,_0x125c45[_0x4301('0x52')]);return db[_0x4301('0x6f')]['count']({'where':_0x5d5810['where']})[_0x4301('0x20')](function(_0x306c58){_0x39916f[_0x4301('0x30')]=_0x306c58;if(_0x125c45[_0x4301('0x44')]['includeAll']){_0x5d5810[_0x4301('0x53')]=[{'model':db[_0x4301('0x71')],'as':'Contact','required':![]},{'model':db[_0x4301('0x72')],'as':_0x4301('0x73'),'attributes':['name',_0x4301('0x74'),_0x4301('0x75')],'required':![]},{'model':db[_0x4301('0x76')],'as':_0x4301('0x77'),'attributes':['id','name',_0x4301('0x78')],'where':_0x125c45['query'][_0x4301('0x79')]?{'id':_0x125c45[_0x4301('0x44')][_0x4301('0x79')]}:undefined,'required':_0x125c45['query'][_0x4301('0x79')]?!![]:![]}];}return db['FaxInteraction'][_0x4301('0x6c')](_0x5d5810);})[_0x4301('0x20')](function(_0x5e921e){_0x39916f[_0x4301('0x67')]=_0x5e921e;return _0x39916f;});}})[_0x4301('0x20')](respondWithFilteredResult(_0x204a83,_0x5d5810))[_0x4301('0x2a')](handleError(_0x204a83,null));};exports[_0x4301('0x7a')]=function(_0x38d82a,_0x1965a9){var _0x2fbf57=_0x38d82a[_0x4301('0x55')]['id'];var _0x1e3562=_0x38d82a[_0x4301('0x5a')];var _0x481ab5=0xc8;var _0x2b8fbe=null;return db[_0x4301('0x7b')][_0x4301('0x7c')]({'isolationLevel':db[_0x4301('0x7b')]['Transaction']['ISOLATION_LEVELS'][_0x4301('0x7d')]},function(_0x4d967d){return db[_0x4301('0x3e')][_0x4301('0x65')]({'where':{'id':_0x2fbf57},'transaction':_0x4d967d})[_0x4301('0x20')](function(_0x8e0224){if(_0x8e0224){return db[_0x4301('0x7e')][_0x4301('0x36')]({'where':{'FaxAccountId':_0x2fbf57},'transaction':_0x4d967d})[_0x4301('0x20')](function(){var _0x5d126e=_[_0x4301('0x43')](_0x1e3562,function(_0x816927){_0x816927[_0x4301('0x62')]=_0x2fbf57;return _0x816927;});return db['FaxApplication'][_0x4301('0x7f')](_0x5d126e,{'transaction':_0x4d967d});});}else{_0x481ab5=0x194;_0x2b8fbe=[];}});})[_0x4301('0x20')](function(){if(_0x481ab5!==0x194){return db['FaxApplication'][_0x4301('0x80')]({'where':{'FaxAccountId':_0x2fbf57},'order':'priority'})['then'](function(_0x505c05){_0x2b8fbe=_0x505c05;});}})[_0x4301('0x2a')](function(_0x439e61){_0x481ab5=0x1f4;logger[_0x4301('0x26')](_0x439e61[_0x4301('0x39')]);if(_0x439e61[_0x4301('0x3a')]){delete _0x439e61['name'];}_0x2b8fbe=_0x439e61;})[_0x4301('0x81')](function(){if(_0x2b8fbe===null){_0x1965a9[_0x4301('0x2b')](_0x481ab5);}else{if(_0x481ab5===0x1f4){_0x1965a9['status'](_0x481ab5)[_0x4301('0x3b')](_0x2b8fbe);}else{_0x1965a9[_0x4301('0x2d')](_0x481ab5)[_0x4301('0x82')](_0x2b8fbe);}}});};exports[_0x4301('0x83')]=function(_0x5efd19,_0x248cb8,_0x5c3db7){var _0x57fc1a={};var _0x1cd894={};var _0x2ea482;var _0x3c8317;return db[_0x4301('0x3e')]['findOne']({'where':{'id':_0x5efd19['params']['id']}})['then'](handleEntityNotFound(_0x248cb8,null))[_0x4301('0x20')](function(_0xfa72e7){if(_0xfa72e7){_0x2ea482=_0xfa72e7;_0x1cd894[_0x4301('0x42')]=_[_0x4301('0x45')](db[_0x4301('0x7e')][_0x4301('0x3f')]);_0x1cd894[_0x4301('0x44')]=_[_0x4301('0x45')](_0x5efd19[_0x4301('0x44')]);_0x1cd894[_0x4301('0x46')]=_[_0x4301('0x47')](_0x1cd894['model'],_0x1cd894[_0x4301('0x44')]);_0x57fc1a[_0x4301('0x48')]=_[_0x4301('0x47')](_0x1cd894[_0x4301('0x42')],qs[_0x4301('0x49')](_0x5efd19[_0x4301('0x44')]['fields']));_0x57fc1a['attributes']=_0x57fc1a['attributes']['length']?_0x57fc1a['attributes']:_0x1cd894[_0x4301('0x42')];_0x57fc1a['order']=qs[_0x4301('0x4c')](_0x5efd19['query']['sort']);_0x57fc1a[_0x4301('0x4d')]=qs['filters'](_[_0x4301('0x4e')](_0x5efd19[_0x4301('0x44')],_0x1cd894['filters']));if(_0x5efd19['query'][_0x4301('0x4f')]){_0x57fc1a[_0x4301('0x4d')]=_[_0x4301('0x50')](_0x57fc1a[_0x4301('0x4d')],{'$or':_[_0x4301('0x43')](_0x57fc1a[_0x4301('0x48')],function(_0x42bfb0){var _0x51f7f9={};_0x51f7f9[_0x42bfb0]={'$like':'%'+_0x5efd19[_0x4301('0x44')][_0x4301('0x4f')]+'%'};return _0x51f7f9;})});}_0x57fc1a=_['merge']({},_0x57fc1a,_0x5efd19['options']);return _0x2ea482[_0x4301('0x83')](_0x57fc1a);}})[_0x4301('0x20')](function(_0x3a355e){if(_0x3a355e){_0x3c8317=_0x3a355e[_0x4301('0x56')];if(!_0x5efd19[_0x4301('0x44')][_0x4301('0x66')](_0x4301('0x4a'))){_0x57fc1a[_0x4301('0x31')]=qs[_0x4301('0x31')](_0x5efd19['query'][_0x4301('0x31')]);_0x57fc1a[_0x4301('0x2e')]=qs[_0x4301('0x2e')](_0x5efd19['query'][_0x4301('0x2e')]);}return _0x2ea482[_0x4301('0x83')](_0x57fc1a);}})[_0x4301('0x20')](function(_0x513107){if(_0x513107){return _0x513107?{'count':_0x3c8317,'rows':_0x513107}:null;}})[_0x4301('0x20')](respondWithResult(_0x248cb8,null))[_0x4301('0x2a')](handleError(_0x248cb8,null));};function Extension(_0x335d30,_0x3dc80b,_0x48bc20,_0x320c77){this[_0x4301('0x84')]=_0x4301('0x85');this[_0x4301('0x86')]=_0x335d30[_0x4301('0x87')];this[_0x4301('0x88')]=_0x320c77;this[_0x4301('0x40')]='system';this['description']=_0x4301('0x89');this[_0x4301('0x62')]=_0x335d30['id'];this[_0x4301('0x8a')]=_0x3dc80b;this['appdata']=_0x48bc20;}function createExtensionsReciveFax(_0x595ca7){var _0x481190=0x1;var _0x5e5286=[];_0x5e5286[_0x4301('0x8b')](new Extension(_0x595ca7,_0x481190,'',_0x4301('0x8c')));_0x481190+=0x1;_0x5e5286['push'](new Extension(_0x595ca7,_0x481190,_0x4301('0x8d'),_0x4301('0x8e')));_0x481190+=0x1;for(var _0x1d1153 in _0x595ca7){if(_0x595ca7[_0x4301('0x66')](_0x1d1153)&&(_0x1d1153===_0x4301('0x8f')||_0x1d1153===_0x4301('0x87')||_0x1d1153===_0x4301('0x90')||_0x1d1153===_0x4301('0x91')||_0x1d1153==='headerinfo'||_0x1d1153===_0x4301('0x92')||_0x1d1153==='minrate'||_0x1d1153==='modem'||_0x1d1153==='t38timeout')){_0x5e5286[_0x4301('0x8b')](new Extension(_0x595ca7,_0x481190,_0x4301('0x93')+_0x1d1153+')='+_0x595ca7[_0x1d1153],'Set'));_0x481190+=0x1;}}_0x5e5286[_0x4301('0x8b')](new Extension(_0x595ca7,_0x481190,'6',_0x4301('0x94')));_0x481190+=0x1;_0x5e5286[_0x4301('0x8b')](new Extension(_0x595ca7,_0x481190,_0x4301('0x95'),_0x4301('0x96')));_0x481190=0x0;return _0x5e5286;}exports['addAccountApplications']=function(_0x3be18d,_0x11a2b0,_0x47488c){var _0x37e8f7;return db[_0x4301('0x7b')][_0x4301('0x7c')](function(_0x342442){return db[_0x4301('0x3e')][_0x4301('0x59')](_0x3be18d['body'],{'transaction':_0x342442})[_0x4301('0x20')](function(_0x5d8509){_0x37e8f7=_0x5d8509[_0x4301('0x37')]({'plain':!![]});return db[_0x4301('0x97')][_0x4301('0x7f')](createExtensionsReciveFax(_0x37e8f7),{'transaction':_0x342442});});})[_0x4301('0x20')](function(){return _0x37e8f7;})['then'](respondWithResult(_0x11a2b0,null))[_0x4301('0x2a')](handleError(_0x11a2b0,null));};exports['updateAccountApplications']=function(_0xb61955,_0x540056,_0x959459){var _0x3f6b6d;return db[_0x4301('0x7b')][_0x4301('0x7c')](function(_0x30bea1){return db[_0x4301('0x3e')][_0x4301('0x35')](_0xb61955[_0x4301('0x5a')],{'where':{'id':_0xb61955[_0x4301('0x5a')]['id']},'transaction':_0x30bea1})['then'](function(_0x31d212){return db[_0x4301('0x97')][_0x4301('0x36')]({'where':{'FaxAccountId':_0xb61955['body']['id']},'transaction':_0x30bea1})['then'](function(_0x291178){return db[_0x4301('0x97')]['bulkCreate'](createExtensionsReciveFax(_[_0x4301('0x98')](_0xb61955['body'],[_0x4301('0x99'),_0x4301('0x41'),_0x4301('0x9a'),_0x4301('0x9b'),_0x4301('0x9c'),_0x4301('0x9d')])),{'transaction':_0x30bea1});});});})[_0x4301('0x20')](function(){return db[_0x4301('0x3e')]['findById'](_0xb61955[_0x4301('0x5a')]['id']);})[_0x4301('0x20')](respondWithResult(_0x540056,null))['catch'](handleError(_0x540056,null));};exports[_0x4301('0x9e')]=function(_0x201210,_0x11790c,_0x1a09e5){var _0xe77dc5={'raw':!![],'where':{}};var _0x13e510={};var _0x4bf96c={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4301('0x65')]({'where':{'id':_0x201210[_0x4301('0x55')]['id']}})[_0x4301('0x20')](handleEntityNotFound(_0x11790c,null))[_0x4301('0x20')](function(_0x559660){if(_0x559660){_0x13e510[_0x4301('0x42')]=_['keys'](db[_0x4301('0x9f')][_0x4301('0x3f')]);_0x13e510['query']=_['keys'](_0x201210['query']);_0x13e510[_0x4301('0x46')]=_[_0x4301('0x47')](_0x13e510[_0x4301('0x42')],_0x13e510[_0x4301('0x44')]);_0xe77dc5[_0x4301('0x48')]=_[_0x4301('0x47')](_0x13e510[_0x4301('0x42')],qs[_0x4301('0x49')](_0x201210[_0x4301('0x44')][_0x4301('0x49')]));_0xe77dc5[_0x4301('0x48')]=_0xe77dc5[_0x4301('0x48')][_0x4301('0x56')]?_0xe77dc5[_0x4301('0x48')]:_0x13e510[_0x4301('0x42')];if(!_0x201210[_0x4301('0x44')]['hasOwnProperty'](_0x4301('0x4a'))){_0xe77dc5['limit']=qs[_0x4301('0x31')](_0x201210[_0x4301('0x44')][_0x4301('0x31')]);_0xe77dc5[_0x4301('0x2e')]=qs['offset'](_0x201210[_0x4301('0x44')][_0x4301('0x2e')]);}_0xe77dc5['order']=qs[_0x4301('0x4c')](_0x201210[_0x4301('0x44')]['sort']);_0xe77dc5[_0x4301('0x4d')]=qs[_0x4301('0x46')](_[_0x4301('0x4e')](_0x201210[_0x4301('0x44')],_0x13e510[_0x4301('0x46')]));_0xe77dc5[_0x4301('0x4d')][_0x4301('0x62')]=_0x559660['id'];if(_0x201210[_0x4301('0x44')][_0x4301('0x4f')]){_0xe77dc5[_0x4301('0x4d')]=_[_0x4301('0x50')](_0xe77dc5[_0x4301('0x4d')],{'$or':_[_0x4301('0x43')](_0xe77dc5[_0x4301('0x48')],function(_0xb68dd6){var _0x2e118d={};_0x2e118d[_0xb68dd6]={'$like':'%'+_0x201210[_0x4301('0x44')][_0x4301('0x4f')]+'%'};return _0x2e118d;})});}if(_0x201210['query']['$gte']){var _0x2d13d7=_0x201210[_0x4301('0x44')]['$gte'][_0x4301('0xa0')](',');var _0x92cb5f={};_0x92cb5f[_0x2d13d7[0x0]]={'$gte':moment(_0x2d13d7[0x1])[_0x4301('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0xe77dc5[_0x4301('0x4d')]=_[_0x4301('0x50')](_0xe77dc5['where'],_0x92cb5f);}_0xe77dc5=_[_0x4301('0x50')]({},_0xe77dc5,_0x201210['options']);return db[_0x4301('0x9f')][_0x4301('0x30')]({'where':_0xe77dc5[_0x4301('0x4d')]})[_0x4301('0x20')](function(_0x33ea16){_0x4bf96c[_0x4301('0x30')]=_0x33ea16;if(_0x201210[_0x4301('0x44')][_0x4301('0x57')]){_0xe77dc5[_0x4301('0x53')]=[{'all':!![]}];}return db[_0x4301('0x9f')][_0x4301('0x6c')](_0xe77dc5);})['then'](function(_0x293efa){_0x4bf96c['rows']=_0x293efa;return _0x4bf96c;});}})[_0x4301('0x20')](respondWithFilteredResult(_0x11790c,_0xe77dc5))[_0x4301('0x2a')](handleError(_0x11790c,null));};exports[_0x4301('0x3b')]=function(_0x531c85,_0x414d7b,_0x405073){var _0x5c2289,_0x124f00={},_0x1b5624;if(_0x531c85[_0x4301('0x5a')]['to']){_0x1b5624=_0x531c85[_0x4301('0x5a')]['to'][0x0];}return db[_0x4301('0x3e')][_0x4301('0x58')]({'where':{'id':_0x531c85[_0x4301('0x55')]['id']},'include':[{'model':db[_0x4301('0xa2')],'as':_0x4301('0xa3'),'include':[{'model':db[_0x4301('0x71')],'as':_0x4301('0xa4'),'where':{'fax':_0x1b5624},'limit':0x1,'order':[[_0x4301('0x9b'),_0x4301('0xa5')]]}]}]})['then'](handleEntityNotFound(_0x414d7b,null))[_0x4301('0x20')](function(_0xec9c8e){_0x5c2289=_0xec9c8e;if(_0x531c85[_0x4301('0x5a')][_0x4301('0xa6')]&&_0x531c85['body'][_0x4301('0xa6')][_0x4301('0x56')]){for(var _0x2e45f1=0x0;_0x2e45f1<_0x531c85[_0x4301('0x5a')]['attachments']['length'];_0x2e45f1+=0x1){_0x531c85[_0x4301('0x5a')]['attachments'][_0x2e45f1]={'filename':_0x531c85[_0x4301('0x5a')][_0x4301('0xa6')][_0x2e45f1][_0x4301('0x3a')],'id':_0x531c85[_0x4301('0x5a')][_0x4301('0xa6')][_0x2e45f1]['id'],'path':path['join'](config[_0x4301('0xa7')],'server/files/attachments',_0x531c85['body'][_0x4301('0xa6')][_0x2e45f1][_0x4301('0xa8')])};}}return respondWithRpcPromise(_0x4301('0xa9'),_0x4301('0xa9'),{'FaxAccountId':_['isNil'](_0x531c85[_0x4301('0x55')]['id'])?undefined:_0x531c85['params']['id'],'path':_[_0x4301('0xaa')](_0x531c85['body']['attachments'][0x0][_0x4301('0xab')])?undefined:_0x531c85[_0x4301('0x5a')][_0x4301('0xa6')][0x0]['path'],'fax':_['isNil'](_0x531c85[_0x4301('0x5a')]['to'][0x0])?undefined:_0x531c85[_0x4301('0x5a')]['to'][0x0]},client9002);})[_0x4301('0x20')](function(){if(_0x5c2289){if(_[_0x4301('0xaa')](_0x531c85['body'][_0x4301('0xac')])){_0x531c85[_0x4301('0x5a')]['from']=util['format'](_0x4301('0xad'),_0x5c2289[_0x4301('0x3a')],_0x5c2289[_0x4301('0xae')]);}if(_0x5c2289['List']){if(_0x5c2289[_0x4301('0xa3')]['Contacts'][_0x4301('0x56')]){return _0x5c2289[_0x4301('0xa3')][_0x4301('0xa4')][0x0];}else{return db[_0x4301('0x71')][_0x4301('0x59')](_['defaults'](_0x531c85[_0x4301('0x5a')],{'firstName':_0x531c85[_0x4301('0x5a')]['to'][0x0],'phone':_0x531c85['body']['to'][0x0],'fax':_0x531c85['body']['to'][0x0],'ListId':_0x5c2289[_0x4301('0x9d')]}));}}else{throw new Error(_0x4301('0xaf'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x4301('0x20')](function(_0x5ecbcc){if(_0x5ecbcc){return db[_0x4301('0x6f')]['find']({'where':{'ContactId':_0x5ecbcc['id'],'closed':![],'FaxAccountId':_0x5c2289['id']}})[_0x4301('0x20')](function(_0x103ece){if(_0x103ece){return[_0x103ece,![]];}return db[_0x4301('0x6f')]['create']({'UserId':_0x531c85[_0x4301('0xb0')]['id'],'ContactId':_0x5ecbcc['id'],'FaxAccountId':_0x5c2289['id'],'fax':_0x531c85[_0x4301('0x5a')]['to'][0x0],'firstMsgDirection':_0x4301('0xb1'),'Messages':[_[_0x4301('0x50')](_0x531c85[_0x4301('0x5a')],{'read':![],'body':_0x531c85[_0x4301('0x5a')][_0x4301('0xa6')][0x0][_0x4301('0xb2')],'FaxAccountId':_0x5c2289['id'],'UserId':_0x531c85[_0x4301('0xb0')]['id'],'ContactId':_0x5ecbcc['id'],'AttachmentId':_0x531c85[_0x4301('0x5a')][_0x4301('0xa6')][0x0]['id']})]},{'include':[{'model':db[_0x4301('0x9f')],'as':'Messages'}]})[_0x4301('0x20')](function(_0x319a3e){return[_0x319a3e,!![]];});});}else{throw new Error(_0x4301('0xb3'));}})[_0x4301('0xb4')](function(_0x481656,_0xb134a4){if(_0xb134a4){return _0x481656;}return db[_0x4301('0x9f')][_0x4301('0x59')]({'direction':_0x4301('0xb1'),'read':![],'body':_0x531c85['body'][_0x4301('0xa6')][0x0]['filename'],'FaxAccountId':_0x5c2289['id'],'FaxInteractionId':_0x481656['id'],'UserId':_0x531c85[_0x4301('0xb0')]['id'],'ContactId':_0x481656[_0x4301('0xb5')],'AttachmentId':_0x531c85[_0x4301('0x5a')][_0x4301('0xa6')][0x0]['id']})[_0x4301('0x20')](function(_0x10867b){_0x481656[_0x4301('0xb6')]['Messages']=[];_0x481656['dataValues'][_0x4301('0xb7')]['push'](_0x10867b[_0x4301('0xb6')]);return _0x481656;});})[_0x4301('0x20')](function(_0xc070eb){respondWithRpcPromise(_0x4301('0xb8'),'SendFax',{'FaxAccountId':_['isNil'](_0x531c85[_0x4301('0x55')]['id'])?undefined:_0x531c85[_0x4301('0x55')]['id'],'path':_[_0x4301('0xaa')](_0x531c85['body'][_0x4301('0xa6')][0x0][_0x4301('0xab')])?undefined:_0x531c85[_0x4301('0x5a')][_0x4301('0xa6')][0x0][_0x4301('0xab')],'fax':_['isNil'](_0x531c85[_0x4301('0x5a')]['to'][0x0])?undefined:_0x531c85[_0x4301('0x5a')]['to'][0x0],'AttachmentId':_0x531c85[_0x4301('0x5a')]['attachments'][0x0]['id']},client9002)[_0x4301('0x20')](function(_0x2de54b){logger[_0x4301('0x21')](_0x4301('0xb9'),_0x2de54b);})[_0x4301('0x2a')](function(_0x4adbf0){logger[_0x4301('0x21')](_0x4301('0xb9'),_0x4adbf0);});return _0xc070eb;})[_0x4301('0x20')](respondWithResult(_0x414d7b,null))[_0x4301('0x2a')](handleError(_0x414d7b,null));};exports[_0x4301('0xba')]=function(_0x383c9d,_0x3b65ea,_0x333896){return db[_0x4301('0x3e')][_0x4301('0x58')]({'where':{'id':_0x383c9d[_0x4301('0x55')]['id']}})['then'](handleEntityNotFound(_0x3b65ea,null))[_0x4301('0x20')](function(_0x5f4559){if(_0x5f4559){return _0x5f4559['addAgents'](_0x383c9d[_0x4301('0x5a')][_0x4301('0x69')],_[_0x4301('0x98')](_0x383c9d[_0x4301('0x5a')],[_0x4301('0x69'),'id'])||{})[_0x4301('0xb4')](function(_0x34392c){for(var _0xc2f4b1=0x0;_0xc2f4b1<_0x383c9d[_0x4301('0x5a')][_0x4301('0x69')][_0x4301('0x56')];_0xc2f4b1+=0x1){socket['emit'](_0x4301('0xbb'),{'UserId':Number(_0x383c9d[_0x4301('0x5a')][_0x4301('0x69')][_0xc2f4b1]),'FaxAccountId':Number(_0x383c9d[_0x4301('0x55')]['id'])});}return _0x34392c;});}})[_0x4301('0x20')](respondWithResult(_0x3b65ea,null))[_0x4301('0x2a')](handleError(_0x3b65ea,null));};exports[_0x4301('0xbc')]=function(_0x2461f9,_0x236ee1,_0x3a9168){return db['FaxAccount']['find']({'where':{'id':_0x2461f9[_0x4301('0x55')]['id']}})[_0x4301('0x20')](handleEntityNotFound(_0x236ee1,null))[_0x4301('0x20')](function(_0x1ff502){if(_0x1ff502){return _0x1ff502[_0x4301('0xbc')](_0x2461f9[_0x4301('0x44')][_0x4301('0x69')])[_0x4301('0x20')](function(){if(_[_0x4301('0xbd')](_0x2461f9['query'][_0x4301('0x69')])){for(var _0x2a2fd9=0x0;_0x2a2fd9<_0x2461f9[_0x4301('0x44')][_0x4301('0x69')]['length'];_0x2a2fd9+=0x1){socket['emit'](_0x4301('0xbe'),{'UserId':Number(_0x2461f9['query'][_0x4301('0x69')][_0x2a2fd9]),'FaxAccountId':Number(_0x2461f9[_0x4301('0x55')]['id'])});}}else{socket['emit'](_0x4301('0xbe'),{'UserId':Number(_0x2461f9['query'][_0x4301('0x69')]),'FaxAccountId':Number(_0x2461f9[_0x4301('0x55')]['id'])});}});}})[_0x4301('0x20')](respondWithStatusCode(_0x236ee1,null))[_0x4301('0x2a')](handleError(_0x236ee1,null));};exports['getAgents']=function(_0x2f2608,_0xf527aa,_0x58aadd){var _0x2324e5={};var _0x318463={};var _0x16d6e1;var _0x643df7;return db[_0x4301('0x3e')]['findOne']({'where':{'id':_0x2f2608[_0x4301('0x55')]['id']}})[_0x4301('0x20')](handleEntityNotFound(_0xf527aa,null))['then'](function(_0x252606){if(_0x252606){_0x16d6e1=_0x252606;_0x318463[_0x4301('0x42')]=_[_0x4301('0x45')](db[_0x4301('0x72')]['rawAttributes']);_0x318463['query']=_[_0x4301('0x45')](_0x2f2608['query']);_0x318463['filters']=_['intersection'](_0x318463['model'],_0x318463[_0x4301('0x44')]);_0x2324e5['attributes']=_['intersection'](_0x318463[_0x4301('0x42')],qs['fields'](_0x2f2608[_0x4301('0x44')][_0x4301('0x49')]));_0x2324e5[_0x4301('0x48')]=_0x2324e5[_0x4301('0x48')][_0x4301('0x56')]?_0x2324e5['attributes']:_0x318463['model'];_0x2324e5[_0x4301('0x4b')]=qs[_0x4301('0x4c')](_0x2f2608['query']['sort']);_0x2324e5[_0x4301('0x4d')]=qs[_0x4301('0x46')](_['pick'](_0x2f2608[_0x4301('0x44')],_0x318463[_0x4301('0x46')]));if(_0x2f2608[_0x4301('0x44')]['filter']){_0x2324e5[_0x4301('0x4d')]=_[_0x4301('0x50')](_0x2324e5[_0x4301('0x4d')],{'$or':_[_0x4301('0x43')](_0x2324e5[_0x4301('0x48')],function(_0x18d900){var _0x5b9e33={};_0x5b9e33[_0x18d900]={'$like':'%'+_0x2f2608[_0x4301('0x44')][_0x4301('0x4f')]+'%'};return _0x5b9e33;})});}_0x2324e5=_['merge']({},_0x2324e5,_0x2f2608[_0x4301('0x52')]);return _0x16d6e1[_0x4301('0xbf')](_0x2324e5);}})[_0x4301('0x20')](function(_0x58a8fb){if(_0x58a8fb){_0x643df7=_0x58a8fb[_0x4301('0x56')];if(!_0x2f2608[_0x4301('0x44')][_0x4301('0x66')](_0x4301('0x4a'))){_0x2324e5[_0x4301('0x31')]=qs[_0x4301('0x31')](_0x2f2608[_0x4301('0x44')][_0x4301('0x31')]);_0x2324e5[_0x4301('0x2e')]=qs[_0x4301('0x2e')](_0x2f2608[_0x4301('0x44')][_0x4301('0x2e')]);}return _0x16d6e1[_0x4301('0xbf')](_0x2324e5);}})['then'](function(_0xf75387){if(_0xf75387){return _0xf75387?{'count':_0x643df7,'rows':_0xf75387}:null;}})['then'](respondWithResult(_0xf527aa,null))[_0x4301('0x2a')](handleError(_0xf527aa,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index d1e606d..30d1849 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 _0x787c=['exports','events','FaxAccount','setMaxListeners','save','update','remove','emit','hook'];(function(_0x74cf82,_0x3fb535){var _0x445914=function(_0x28023c){while(--_0x28023c){_0x74cf82['push'](_0x74cf82['shift']());}};_0x445914(++_0x3fb535);}(_0x787c,0x172));var _0xc787=function(_0xdd2e27,_0xcfc3f1){_0xdd2e27=_0xdd2e27-0x0;var _0x1cd98a=_0x787c[_0xdd2e27];return _0x1cd98a;};'use strict';var EventEmitter=require(_0xc787('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xc787('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xc787('0x2')](0x0);var events={'afterCreate':_0xc787('0x3'),'afterUpdate':_0xc787('0x4'),'afterDestroy':_0xc787('0x5')};function emitEvent(_0x2c6bd1){return function(_0x3fbe2b,_0x3e46bb,_0x1c2bb4){FaxAccountEvents[_0xc787('0x6')](_0x2c6bd1+':'+_0x3fbe2b['id'],_0x3fbe2b);FaxAccountEvents[_0xc787('0x6')](_0x2c6bd1,_0x3fbe2b);_0x1c2bb4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xc787('0x7')](e,emitEvent(event));}}module[_0xc787('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x5f6d=['events','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2446a,_0x599886){var _0x12d9a9=function(_0x529d15){while(--_0x529d15){_0x2446a['push'](_0x2446a['shift']());}};_0x12d9a9(++_0x599886);}(_0x5f6d,0x162));var _0xd5f6=function(_0x51d510,_0x15ad49){_0x51d510=_0x51d510-0x0;var _0x41866a=_0x5f6d[_0x51d510];return _0x41866a;};'use strict';var EventEmitter=require(_0xd5f6('0x0'));var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xd5f6('0x1')](0x0);var events={'afterCreate':_0xd5f6('0x2'),'afterUpdate':'update','afterDestroy':_0xd5f6('0x3')};function emitEvent(_0x32141f){return function(_0x57c27c,_0x41bbc1,_0x153488){FaxAccountEvents[_0xd5f6('0x4')](_0x32141f+':'+_0x57c27c['id'],_0x57c27c);FaxAccountEvents[_0xd5f6('0x4')](_0x32141f,_0x57c27c);_0x153488(null);};}for(var e in events){if(events[_0xd5f6('0x5')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 5951422..911bd93 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 _0xe026=['exports','define','fax_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes'];(function(_0x397581,_0x566b8b){var _0x350f0f=function(_0x168ca2){while(--_0x168ca2){_0x397581['push'](_0x397581['shift']());}};_0x350f0f(++_0x566b8b);}(_0xe026,0xdb));var _0x6e02=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xe026[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x6e02('0x0'));var util=require(_0x6e02('0x1'));var logger=require(_0x6e02('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6e02('0x3'));var rp=require(_0x6e02('0x4'));var fs=require('fs');var path=require(_0x6e02('0x5'));var rimraf=require(_0x6e02('0x6'));var config=require(_0x6e02('0x7'));var attributes=require(_0x6e02('0x8'));module[_0x6e02('0x9')]=function(_0x2db599,_0x5302ff){return _0x2db599[_0x6e02('0xa')]('FaxAccount',attributes,{'tableName':_0x6e02('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9af3=['../../config/environment','exports','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3941c7,_0x48ce4f){var _0x1ac551=function(_0x33e059){while(--_0x33e059){_0x3941c7['push'](_0x3941c7['shift']());}};_0x1ac551(++_0x48ce4f);}(_0x9af3,0x158));var _0x39af=function(_0x589033,_0x32610d){_0x589033=_0x589033-0x0;var _0x5627f2=_0x9af3[_0x589033];return _0x5627f2;};'use strict';var _=require(_0x39af('0x0'));var util=require(_0x39af('0x1'));var logger=require(_0x39af('0x2'))(_0x39af('0x3'));var moment=require(_0x39af('0x4'));var BPromise=require(_0x39af('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x39af('0x6'));var rimraf=require(_0x39af('0x7'));var config=require(_0x39af('0x8'));var attributes=require('./faxAccount.attributes');module[_0x39af('0x9')]=function(_0x32a94b,_0x555041){return _0x32a94b['define']('FaxAccount',attributes,{'tableName':_0x39af('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 6c1813d..acf22e7 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 _0xfd43=['limit','include','map','model','GetFaxAccount','catch','NotifyFaxAccount','body','fax','describe','then','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','CmContact','Contacts','DESC','FaxApplication','Applications','List','get','applications','list','orderBy','priority','asc','create','contact','FaxInteraction','spread','push','length','close','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','unshift','name','waitForTheAssignedAgent','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','./faxAccount.socket','register','request','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','findAll','options','where','attributes'];(function(_0xc2ac6e,_0x2e5d97){var _0x2dab43=function(_0x532a30){while(--_0x532a30){_0xc2ac6e['push'](_0xc2ac6e['shift']());}};_0x2dab43(++_0x2e5d97);}(_0xfd43,0x19b));var _0x3fd4=function(_0x8c1a0a,_0x40cb49){_0x8c1a0a=_0x8c1a0a-0x0;var _0x1af472=_0xfd43[_0x8c1a0a];return _0x1af472;};'use strict';var _=require(_0x3fd4('0x0'));var util=require(_0x3fd4('0x1'));var moment=require(_0x3fd4('0x2'));var BPromise=require(_0x3fd4('0x3'));var rs=require(_0x3fd4('0x4'));var fs=require('fs');var Redis=require(_0x3fd4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fd4('0x6'));var logger=require(_0x3fd4('0x7'))(_0x3fd4('0x8'));var config=require(_0x3fd4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3fd4('0xa')][_0x3fd4('0xb')]({'port':0x232c});config[_0x3fd4('0xc')]=_['defaults'](config[_0x3fd4('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3fd4('0xd'))[_0x3fd4('0xe')](socket);function respondWithRpcPromise(_0x177292,_0x3b7edb,_0x36288e){return new BPromise(function(_0x59725c,_0x46baae){return client[_0x3fd4('0xf')](_0x177292,_0x36288e)['then'](function(_0xac391c){logger['info'](_0x3fd4('0x10'),_0x3b7edb,_0x3fd4('0x11'));logger[_0x3fd4('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3b7edb,_0x3fd4('0x11'),JSON[_0x3fd4('0x13')](_0xac391c));if(_0xac391c[_0x3fd4('0x14')]){if(_0xac391c[_0x3fd4('0x14')][_0x3fd4('0x15')]===0x1f4){logger[_0x3fd4('0x14')](_0x3fd4('0x10'),_0x3b7edb,_0xac391c['error'][_0x3fd4('0x16')]);return _0x46baae(_0xac391c['error'][_0x3fd4('0x16')]);}logger[_0x3fd4('0x14')](_0x3fd4('0x10'),_0x3b7edb,_0xac391c[_0x3fd4('0x14')][_0x3fd4('0x16')]);return _0x59725c(_0xac391c[_0x3fd4('0x14')][_0x3fd4('0x16')]);}else{logger[_0x3fd4('0x17')](_0x3fd4('0x10'),_0x3b7edb,_0x3fd4('0x11'));_0x59725c(_0xac391c[_0x3fd4('0x18')][_0x3fd4('0x16')]);}})['catch'](function(_0x2c6af7){logger['error'](_0x3fd4('0x10'),_0x3b7edb,_0x2c6af7);_0x46baae(_0x2c6af7);});});}exports['GetFaxAccount']=function(_0x3af0d8){var _0x3f2a7f=this;return new Promise(function(_0x23430a,_0x739abe){return db['FaxAccount'][_0x3fd4('0x19')]({'raw':_0x3af0d8[_0x3fd4('0x1a')]?_0x3af0d8[_0x3fd4('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3af0d8['options']?_0x3af0d8[_0x3fd4('0x1a')][_0x3fd4('0x1b')]||null:null,'attributes':_0x3af0d8[_0x3fd4('0x1a')]?_0x3af0d8[_0x3fd4('0x1a')][_0x3fd4('0x1c')]||null:null,'limit':_0x3af0d8['options']?_0x3af0d8[_0x3fd4('0x1a')][_0x3fd4('0x1d')]||null:null,'include':_0x3af0d8['options']?_0x3af0d8[_0x3fd4('0x1a')][_0x3fd4('0x1e')]?_[_0x3fd4('0x1f')](_0x3af0d8[_0x3fd4('0x1a')][_0x3fd4('0x1e')],function(_0x892238){return{'model':db[_0x892238[_0x3fd4('0x20')]],'as':_0x892238['as'],'attributes':_0x892238[_0x3fd4('0x1c')],'include':_0x892238['include']?_[_0x3fd4('0x1f')](_0x892238['include'],function(_0x42f905){return{'model':db[_0x42f905['model']],'as':_0x42f905['as'],'attributes':_0x42f905['attributes'],'include':_0x42f905['include']?_[_0x3fd4('0x1f')](_0x42f905[_0x3fd4('0x1e')],function(_0x1b5765){return{'model':db[_0x1b5765[_0x3fd4('0x20')]],'as':_0x1b5765['as'],'attributes':_0x1b5765[_0x3fd4('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f1e20){logger['info']('GetFaxAccount',_0x3af0d8);logger[_0x3fd4('0x12')](_0x3fd4('0x21'),_0x3af0d8,JSON[_0x3fd4('0x13')](_0x2f1e20));_0x23430a(_0x2f1e20);})[_0x3fd4('0x22')](function(_0x1fe844){logger[_0x3fd4('0x14')](_0x3fd4('0x21'),_0x1fe844[_0x3fd4('0x16')],_0x3af0d8);_0x739abe(_0x3f2a7f[_0x3fd4('0x14')](0x1f4,_0x1fe844[_0x3fd4('0x16')]));});});};exports[_0x3fd4('0x23')]=function(_0x44ae1f,_0x5b940b,_0xbef31a){var _0x116e63=this;return new Promise(function(_0x47dfa7,_0x272636){var _0x5032bc={'body':_0x44ae1f[_0x3fd4('0x24')],'channel':_0x3fd4('0x25')};var _0x3e1865=[];var _0x147274=[];var _0x281e79={};return db['CmContact'][_0x3fd4('0x26')]()[_0x3fd4('0x27')](function(_0x2e6723){if(!_0x2e6723){throw new db[(_0x3fd4('0x28'))][(_0x3fd4('0x29'))](_0x3fd4('0x2a'));}_0x3e1865=_[_0x3fd4('0x2b')](_[_0x3fd4('0x2c')](_0x2e6723),['createdAt','updatedAt']);_0x147274=_[_0x3fd4('0x2b')](_[_0x3fd4('0x2c')](_0x2e6723),[_0x3fd4('0x2d'),_0x3fd4('0x2e'),_0x3fd4('0x2f'),_0x3fd4('0x30')]);if(_0x44ae1f['body']['id']){delete _0x44ae1f[_0x3fd4('0x24')]['id'];}if(_['isNil'](_0x44ae1f['body'][_0x3fd4('0x31')])){throw new db[(_0x3fd4('0x28'))][(_0x3fd4('0x29'))]('from\x20is\x20mandatory');}if(_[_0x3fd4('0x32')](_0x44ae1f[_0x3fd4('0x24')][_0x3fd4('0x24')])||_0x44ae1f[_0x3fd4('0x24')][_0x3fd4('0x24')]===''){throw new db[(_0x3fd4('0x28'))][(_0x3fd4('0x29'))](_0x3fd4('0x33'));}if(_[_0x3fd4('0x32')](_0x44ae1f[_0x3fd4('0x24')][_0x3fd4('0x34')])){throw new db[(_0x3fd4('0x28'))][(_0x3fd4('0x29'))](_0x3fd4('0x35')+_0x147274);}if(!_[_0x3fd4('0x36')](_0x147274,_0x44ae1f[_0x3fd4('0x24')][_0x3fd4('0x34')])){throw new db[(_0x3fd4('0x28'))][(_0x3fd4('0x29'))](_0x3fd4('0x37')+_0x147274);}_0x281e79[_0x44ae1f[_0x3fd4('0x24')][_0x3fd4('0x34')]]=_0x44ae1f[_0x3fd4('0x24')][_0x3fd4('0x31')];})[_0x3fd4('0x27')](function(){return db['FaxAccount'][_0x3fd4('0x38')]({'where':{'id':_0x44ae1f[_0x3fd4('0x39')]['id']},'include':[{'model':db[_0x3fd4('0x3a')],'as':'List','include':[{'model':db[_0x3fd4('0x3b')],'as':_0x3fd4('0x3c'),'where':_0x281e79,'limit':0x1,'order':[['updatedAt',_0x3fd4('0x3d')]]}]},{'model':db[_0x3fd4('0x3e')],'as':_0x3fd4('0x3f')}]});})[_0x3fd4('0x27')](function(_0x35adfa){if(_0x35adfa&&_0x35adfa[_0x3fd4('0x40')]){var _0x229f8b=_0x35adfa[_0x3fd4('0x41')]({'plain':!![]});_0x5032bc[_0x3fd4('0x39')]=_0x229f8b;_0x5032bc[_0x3fd4('0x42')]=_0x229f8b[_0x3fd4('0x3f')];_0x5032bc[_0x3fd4('0x43')]=_0x229f8b[_0x3fd4('0x40')];_0x5032bc[_0x3fd4('0x42')]=_[_0x3fd4('0x44')](_0x5032bc[_0x3fd4('0x42')],[_0x3fd4('0x45')],[_0x3fd4('0x46')]);if(_0x5032bc[_0x3fd4('0x39')]['Applications']){delete _0x5032bc[_0x3fd4('0x39')]['Applications'];}if(_0x5032bc['account'][_0x3fd4('0x40')]&&_0x5032bc[_0x3fd4('0x39')][_0x3fd4('0x40')][_0x3fd4('0x3c')]['length']){return _0x5032bc[_0x3fd4('0x39')][_0x3fd4('0x40')]['Contacts'][0x0];}var _0x1359fc=_['defaults'](_0x44ae1f[_0x3fd4('0x24')],{'firstName':_0x44ae1f[_0x3fd4('0x24')][_0x3fd4('0x31')],'ListId':_0x229f8b[_0x3fd4('0x30')]});_0x1359fc[_0x44ae1f[_0x3fd4('0x24')][_0x3fd4('0x34')]]=_0x44ae1f[_0x3fd4('0x24')][_0x3fd4('0x31')];return db[_0x3fd4('0x3b')][_0x3fd4('0x47')](_0x1359fc,{'fields':_0x3e1865,'raw':!![]});}})[_0x3fd4('0x27')](function(_0x4ce254){_0x5032bc[_0x3fd4('0x48')]=_0x4ce254;if(_0x4ce254){var _0x31e28a={'ContactId':_0x4ce254['id'],'FaxAccountId':_0x44ae1f[_0x3fd4('0x39')]['id'],'fax':_0x4ce254[_0x3fd4('0x25')]};return db[_0x3fd4('0x49')][_0x3fd4('0x38')]({'where':{'ContactId':_0x4ce254['id'],'closed':![],'FaxAccountId':_0x44ae1f[_0x3fd4('0x39')]['id']}})[_0x3fd4('0x27')](function(_0x2b2425){if(_0x2b2425){return[_0x2b2425,![]];}return db[_0x3fd4('0x49')][_0x3fd4('0x47')](_0x31e28a)[_0x3fd4('0x27')](function(_0x7be828){return[_0x7be828,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x3fd4('0x4a')](function(_0x1b24b0,_0x56c705){var _0x506f9d=_0x1b24b0[_0x3fd4('0x41')]({'plain':!![]});if(_0x56c705){if(_0x5032bc['account']['autoclose']){_0x5032bc[_0x3fd4('0x42')][_0x3fd4('0x4b')]({'id':0x0,'priority':_0x5032bc[_0x3fd4('0x42')][_0x3fd4('0x4c')]+0x1,'app':_0x3fd4('0x4d'),'appdata':'unmanaged','interval':_0x3fd4('0x4e')});}_0x506f9d['created']=!![];}else{_0x506f9d[_0x3fd4('0x4f')]=![];}_0x5032bc[_0x3fd4('0x50')]=_0x506f9d;return db['FaxMessage']['create']({'body':_0x44ae1f[_0x3fd4('0x24')][_0x3fd4('0x24')],'FaxAccountId':_0x44ae1f[_0x3fd4('0x39')]['id'],'FaxInteractionId':_0x1b24b0['id'],'direction':'in','ContactId':_0x1b24b0[_0x3fd4('0x51')],'AttachmentId':_0x44ae1f[_0x3fd4('0x24')][_0x3fd4('0x52')]});})[_0x3fd4('0x27')](function(_0x32c4bd){_0x5032bc[_0x3fd4('0x16')]=_0x32c4bd;if(_0x5032bc['interaction'][_0x3fd4('0x53')]){return db['User'][_0x3fd4('0x38')]({'attributes':['id','name'],'where':{'id':_0x5032bc[_0x3fd4('0x50')][_0x3fd4('0x53')]}})[_0x3fd4('0x27')](function(_0x32136c){if(_0x32136c){_0x5032bc[_0x3fd4('0x42')][_0x3fd4('0x54')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x32136c[_0x3fd4('0x55')]+','+(_0x5032bc[_0x3fd4('0x39')][_0x3fd4('0x56')]||0xa),'interval':_0x3fd4('0x4e')});}return respondWithRpcPromise('Start',_0x3fd4('0x57'),_0x5032bc);});}return respondWithRpcPromise('Start',_0x3fd4('0x57'),_0x5032bc);})['then'](function(_0x364262){_0x47dfa7(_0x364262);})[_0x3fd4('0x22')](function(_0x39d1c6){_0x272636(_0x116e63['error'](0x1f4,_0x39d1c6['message']));});});}; \ No newline at end of file +var _0x9e2b=['Applications','get','applications','list','orderBy','priority','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../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','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','GetFaxAccount','FaxAccount','options','raw','where','limit','include','model','attributes','map','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','keys','updatedAt','CompanyId','ListId','body','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','find','account','CmList','List','Contacts','DESC','FaxApplication'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x9e2b,0x180));var _0xb9e2=function(_0x3652f5,_0x42a6f0){_0x3652f5=_0x3652f5-0x0;var _0xf4d528=_0x9e2b[_0x3652f5];return _0xf4d528;};'use strict';var _=require('lodash');var util=require(_0xb9e2('0x0'));var moment=require(_0xb9e2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9e2('0x2'));var db=require(_0xb9e2('0x3'))['db'];var utils=require(_0xb9e2('0x4'));var logger=require(_0xb9e2('0x5'))(_0xb9e2('0x6'));var config=require(_0xb9e2('0x7'));var jayson=require(_0xb9e2('0x8'));var client=jayson[_0xb9e2('0x9')][_0xb9e2('0xa')]({'port':0x232c});config[_0xb9e2('0xb')]=_[_0xb9e2('0xc')](config[_0xb9e2('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb9e2('0xd'))(new Redis(config[_0xb9e2('0xb')]));require(_0xb9e2('0xe'))[_0xb9e2('0xf')](socket);function respondWithRpcPromise(_0x1c9fea,_0x3ce45a,_0x5e5865){return new BPromise(function(_0x24e6a7,_0x3f591f){return client[_0xb9e2('0x10')](_0x1c9fea,_0x5e5865)[_0xb9e2('0x11')](function(_0x61bba1){logger[_0xb9e2('0x12')](_0xb9e2('0x13'),_0x3ce45a,'request\x20sent');logger[_0xb9e2('0x14')](_0xb9e2('0x15'),_0x3ce45a,'request\x20sent',JSON[_0xb9e2('0x16')](_0x61bba1));if(_0x61bba1['error']){if(_0x61bba1[_0xb9e2('0x17')]['code']===0x1f4){logger[_0xb9e2('0x17')](_0xb9e2('0x13'),_0x3ce45a,_0x61bba1['error'][_0xb9e2('0x18')]);return _0x3f591f(_0x61bba1['error'][_0xb9e2('0x18')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x3ce45a,_0x61bba1['error'][_0xb9e2('0x18')]);return _0x24e6a7(_0x61bba1[_0xb9e2('0x17')][_0xb9e2('0x18')]);}else{logger[_0xb9e2('0x12')](_0xb9e2('0x13'),_0x3ce45a,'request\x20sent');_0x24e6a7(_0x61bba1['result'][_0xb9e2('0x18')]);}})['catch'](function(_0x4e7548){logger[_0xb9e2('0x17')](_0xb9e2('0x13'),_0x3ce45a,_0x4e7548);_0x3f591f(_0x4e7548);});});}exports[_0xb9e2('0x19')]=function(_0x15f12a){var _0x25b4a2=this;return new Promise(function(_0x4239ec,_0x2bdf1e){return db[_0xb9e2('0x1a')]['findAll']({'raw':_0x15f12a[_0xb9e2('0x1b')]?_0x15f12a[_0xb9e2('0x1b')][_0xb9e2('0x1c')]===undefined?!![]:![]:!![],'where':_0x15f12a[_0xb9e2('0x1b')]?_0x15f12a[_0xb9e2('0x1b')][_0xb9e2('0x1d')]||null:null,'attributes':_0x15f12a['options']?_0x15f12a['options']['attributes']||null:null,'limit':_0x15f12a[_0xb9e2('0x1b')]?_0x15f12a[_0xb9e2('0x1b')][_0xb9e2('0x1e')]||null:null,'include':_0x15f12a[_0xb9e2('0x1b')]?_0x15f12a[_0xb9e2('0x1b')][_0xb9e2('0x1f')]?_['map'](_0x15f12a[_0xb9e2('0x1b')][_0xb9e2('0x1f')],function(_0x5a8cab){return{'model':db[_0x5a8cab[_0xb9e2('0x20')]],'as':_0x5a8cab['as'],'attributes':_0x5a8cab[_0xb9e2('0x21')],'include':_0x5a8cab[_0xb9e2('0x1f')]?_[_0xb9e2('0x22')](_0x5a8cab[_0xb9e2('0x1f')],function(_0x3e407c){return{'model':db[_0x3e407c[_0xb9e2('0x20')]],'as':_0x3e407c['as'],'attributes':_0x3e407c[_0xb9e2('0x21')],'include':_0x3e407c[_0xb9e2('0x1f')]?_[_0xb9e2('0x22')](_0x3e407c['include'],function(_0x3237d0){return{'model':db[_0x3237d0[_0xb9e2('0x20')]],'as':_0x3237d0['as'],'attributes':_0x3237d0[_0xb9e2('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ca217){logger[_0xb9e2('0x12')](_0xb9e2('0x19'),_0x15f12a);logger['debug'](_0xb9e2('0x19'),_0x15f12a,JSON[_0xb9e2('0x16')](_0x5ca217));_0x4239ec(_0x5ca217);})['catch'](function(_0x339f76){logger[_0xb9e2('0x17')](_0xb9e2('0x19'),_0x339f76['message'],_0x15f12a);_0x2bdf1e(_0x25b4a2['error'](0x1f4,_0x339f76['message']));});});};exports['NotifyFaxAccount']=function(_0x458af2,_0x2f0a4e,_0x41e055){var _0x134a7a=this;return new Promise(function(_0x3ce3cc,_0x3d0641){var _0x8be046={'body':_0x458af2['body'],'channel':_0xb9e2('0x23')};var _0x6c32ac=[];var _0x4056fc=[];var _0x298078={};return db['CmContact'][_0xb9e2('0x24')]()[_0xb9e2('0x11')](function(_0x3340fb){if(!_0x3340fb){throw new db[(_0xb9e2('0x25'))][(_0xb9e2('0x26'))](_0xb9e2('0x27'));}_0x6c32ac=_[_0xb9e2('0x28')](_['keys'](_0x3340fb),[_0xb9e2('0x29'),'updatedAt']);_0x4056fc=_[_0xb9e2('0x28')](_[_0xb9e2('0x2a')](_0x3340fb),[_0xb9e2('0x29'),_0xb9e2('0x2b'),_0xb9e2('0x2c'),_0xb9e2('0x2d')]);if(_0x458af2['body']['id']){delete _0x458af2[_0xb9e2('0x2e')]['id'];}if(_[_0xb9e2('0x2f')](_0x458af2[_0xb9e2('0x2e')]['from'])){throw new db[(_0xb9e2('0x25'))][(_0xb9e2('0x26'))](_0xb9e2('0x30'));}if(_[_0xb9e2('0x2f')](_0x458af2['body'][_0xb9e2('0x2e')])||_0x458af2[_0xb9e2('0x2e')]['body']===''){throw new db[(_0xb9e2('0x25'))][(_0xb9e2('0x26'))](_0xb9e2('0x31'));}if(_[_0xb9e2('0x2f')](_0x458af2[_0xb9e2('0x2e')][_0xb9e2('0x32')])){throw new db[(_0xb9e2('0x25'))]['ValidationError'](_0xb9e2('0x33')+_0x4056fc);}if(!_[_0xb9e2('0x34')](_0x4056fc,_0x458af2['body'][_0xb9e2('0x32')])){throw new db[(_0xb9e2('0x25'))][(_0xb9e2('0x26'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4056fc);}_0x298078[_0x458af2[_0xb9e2('0x2e')][_0xb9e2('0x32')]]=_0x458af2[_0xb9e2('0x2e')][_0xb9e2('0x35')];})[_0xb9e2('0x11')](function(){return db[_0xb9e2('0x1a')][_0xb9e2('0x36')]({'where':{'id':_0x458af2[_0xb9e2('0x37')]['id']},'include':[{'model':db[_0xb9e2('0x38')],'as':_0xb9e2('0x39'),'include':[{'model':db['CmContact'],'as':_0xb9e2('0x3a'),'where':_0x298078,'limit':0x1,'order':[[_0xb9e2('0x2b'),_0xb9e2('0x3b')]]}]},{'model':db[_0xb9e2('0x3c')],'as':_0xb9e2('0x3d')}]});})[_0xb9e2('0x11')](function(_0x2d5af5){if(_0x2d5af5&&_0x2d5af5[_0xb9e2('0x39')]){var _0x3ed367=_0x2d5af5[_0xb9e2('0x3e')]({'plain':!![]});_0x8be046[_0xb9e2('0x37')]=_0x3ed367;_0x8be046[_0xb9e2('0x3f')]=_0x3ed367[_0xb9e2('0x3d')];_0x8be046[_0xb9e2('0x40')]=_0x3ed367[_0xb9e2('0x39')];_0x8be046['applications']=_[_0xb9e2('0x41')](_0x8be046[_0xb9e2('0x3f')],[_0xb9e2('0x42')],['asc']);if(_0x8be046[_0xb9e2('0x37')][_0xb9e2('0x3d')]){delete _0x8be046[_0xb9e2('0x37')][_0xb9e2('0x3d')];}if(_0x8be046[_0xb9e2('0x37')][_0xb9e2('0x39')]&&_0x8be046['account'][_0xb9e2('0x39')]['Contacts'][_0xb9e2('0x43')]){return _0x8be046['account'][_0xb9e2('0x39')][_0xb9e2('0x3a')][0x0];}var _0x12b14d=_[_0xb9e2('0xc')](_0x458af2[_0xb9e2('0x2e')],{'firstName':_0x458af2[_0xb9e2('0x2e')][_0xb9e2('0x35')],'ListId':_0x3ed367['ListId']});_0x12b14d[_0x458af2[_0xb9e2('0x2e')]['mapKey']]=_0x458af2[_0xb9e2('0x2e')][_0xb9e2('0x35')];return db['CmContact'][_0xb9e2('0x44')](_0x12b14d,{'fields':_0x6c32ac,'raw':!![]});}})['then'](function(_0x48cc8f){_0x8be046[_0xb9e2('0x45')]=_0x48cc8f;if(_0x48cc8f){var _0x5f01f0={'ContactId':_0x48cc8f['id'],'FaxAccountId':_0x458af2[_0xb9e2('0x37')]['id'],'fax':_0x48cc8f[_0xb9e2('0x23')]};return db[_0xb9e2('0x46')][_0xb9e2('0x36')]({'where':{'ContactId':_0x48cc8f['id'],'closed':![],'FaxAccountId':_0x458af2[_0xb9e2('0x37')]['id']}})[_0xb9e2('0x11')](function(_0x1aec26){if(_0x1aec26){return[_0x1aec26,![]];}return db['FaxInteraction'][_0xb9e2('0x44')](_0x5f01f0)[_0xb9e2('0x11')](function(_0x31bb20){return[_0x31bb20,!![]];});});}else{throw new Error(_0xb9e2('0x47'));}})[_0xb9e2('0x48')](function(_0x3f4245,_0x57a7ea){var _0x117abb=_0x3f4245[_0xb9e2('0x3e')]({'plain':!![]});if(_0x57a7ea){if(_0x8be046[_0xb9e2('0x37')]['autoclose']){_0x8be046[_0xb9e2('0x3f')][_0xb9e2('0x49')]({'id':0x0,'priority':_0x8be046['applications'][_0xb9e2('0x43')]+0x1,'app':'close','appdata':_0xb9e2('0x4a'),'interval':_0xb9e2('0x4b')});}_0x117abb[_0xb9e2('0x4c')]=!![];}else{_0x117abb['created']=![];}_0x8be046[_0xb9e2('0x4d')]=_0x117abb;return db[_0xb9e2('0x4e')]['create']({'body':_0x458af2[_0xb9e2('0x2e')][_0xb9e2('0x2e')],'FaxAccountId':_0x458af2[_0xb9e2('0x37')]['id'],'FaxInteractionId':_0x3f4245['id'],'direction':'in','ContactId':_0x3f4245[_0xb9e2('0x4f')],'AttachmentId':_0x458af2['body'][_0xb9e2('0x50')]});})[_0xb9e2('0x11')](function(_0x10d258){_0x8be046[_0xb9e2('0x18')]=_0x10d258;if(_0x8be046[_0xb9e2('0x4d')][_0xb9e2('0x51')]){return db[_0xb9e2('0x52')]['find']({'attributes':['id',_0xb9e2('0x53')],'where':{'id':_0x8be046[_0xb9e2('0x4d')][_0xb9e2('0x51')]}})[_0xb9e2('0x11')](function(_0x3c7b9e){if(_0x3c7b9e){_0x8be046[_0xb9e2('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb9e2('0x54'),'appdata':_0x3c7b9e[_0xb9e2('0x53')]+','+(_0x8be046[_0xb9e2('0x37')][_0xb9e2('0x55')]||0xa),'interval':_0xb9e2('0x4b')});}return respondWithRpcPromise(_0xb9e2('0x56'),_0xb9e2('0x57'),_0x8be046);});}return respondWithRpcPromise(_0xb9e2('0x56'),'startRouting',_0x8be046);})['then'](function(_0x410118){_0x3ce3cc(_0x410118);})[_0xb9e2('0x58')](function(_0x649b30){_0x3d0641(_0x134a7a[_0xb9e2('0x17')](0x1f4,_0x649b30['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 14eb65c..7fd5e2d 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 _0xd518=['register','./faxAccount.events','save','remove','emit'];(function(_0x10ace1,_0x30913d){var _0x19a4da=function(_0x2b2ef0){while(--_0x2b2ef0){_0x10ace1['push'](_0x10ace1['shift']());}};_0x19a4da(++_0x30913d);}(_0xd518,0x196));var _0x8d51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd518[_0x3dd15e];return _0x231fd0;};'use strict';var FaxAccountEvents=require(_0x8d51('0x0'));var events=[_0x8d51('0x1'),_0x8d51('0x2'),'update'];function createListener(_0x13a7f0,_0x271764){return function(_0x5e6830){_0x271764[_0x8d51('0x3')](_0x13a7f0,_0x5e6830);};}function removeListener(_0x3006e3,_0x30851f){return function(){FaxAccountEvents['removeListener'](_0x3006e3,_0x30851f);};}exports[_0x8d51('0x4')]=function(_0x64fbfa){for(var _0x26a2ec=0x0,_0x587945=events['length'];_0x26a2ec<_0x587945;_0x26a2ec++){var _0x129ced=events[_0x26a2ec];var _0x4fbddf=createListener('faxAccount:'+_0x129ced,_0x64fbfa);FaxAccountEvents['on'](_0x129ced,_0x4fbddf);}}; \ No newline at end of file +var _0x0cc8=['removeListener','register','faxAccount:','./faxAccount.events','remove','update','emit'];(function(_0x25b444,_0x20da5e){var _0x425f88=function(_0xe4183e){while(--_0xe4183e){_0x25b444['push'](_0x25b444['shift']());}};_0x425f88(++_0x20da5e);}(_0x0cc8,0x137));var _0x80cc=function(_0x3bc3b4,_0x5acff4){_0x3bc3b4=_0x3bc3b4-0x0;var _0x4c546b=_0x0cc8[_0x3bc3b4];return _0x4c546b;};'use strict';var FaxAccountEvents=require(_0x80cc('0x0'));var events=['save',_0x80cc('0x1'),_0x80cc('0x2')];function createListener(_0x5963cc,_0x17f733){return function(_0x2788a7){_0x17f733[_0x80cc('0x3')](_0x5963cc,_0x2788a7);};}function removeListener(_0x14aa43,_0x15f4c1){return function(){FaxAccountEvents[_0x80cc('0x4')](_0x14aa43,_0x15f4c1);};}exports[_0x80cc('0x5')]=function(_0x4706d8){for(var _0x22cf2b=0x0,_0x434cdb=events['length'];_0x22cf2b<_0x434cdb;_0x22cf2b++){var _0x35e6a3=events[_0x22cf2b];var _0x48b7f7=createListener(_0x80cc('0x6')+_0x35e6a3,_0x4706d8);FaxAccountEvents['on'](_0x35e6a3,_0x48b7f7);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 6a0391f..55459cc 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(_0x1e80b7,_0x595030){var _0x67f6e4=function(_0x8f1cf6){while(--_0x8f1cf6){_0x1e80b7['push'](_0x1e80b7['shift']());}};_0x67f6e4(++_0x595030);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0x1d2bc9,_0xfc9e87){var _0x4dc736=function(_0x4582dc){while(--_0x4582dc){_0x1d2bc9['push'](_0x1d2bc9['shift']());}};_0x4dc736(++_0xfc9e87);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 67606e8..5f03ef9 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 _0xc83d=['sequelize','exports','INTEGER','STRING','noop'];(function(_0x4ac189,_0x2e39a8){var _0x171634=function(_0x414035){while(--_0x414035){_0x4ac189['push'](_0x4ac189['shift']());}};_0x171634(++_0x2e39a8);}(_0xc83d,0x154));var _0xdc83=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc83d[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xdc83('0x0'));module[_0xdc83('0x1')]={'priority':{'type':Sequelize[_0xdc83('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xdc83('0x3')],'allowNull':![],'defaultValue':_0xdc83('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xdc83('0x3')]},'interval':{'type':Sequelize[_0xdc83('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x266e=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x5dd36f,_0x1c92c6){var _0x39cd21=function(_0x2d7d9e){while(--_0x2d7d9e){_0x5dd36f['push'](_0x5dd36f['shift']());}};_0x39cd21(++_0x1c92c6);}(_0x266e,0x150));var _0xe266=function(_0xdd7122,_0x35d800){_0xdd7122=_0xdd7122-0x0;var _0x267f93=_0x266e[_0xdd7122];return _0x267f93;};'use strict';var Sequelize=require('sequelize');module[_0xe266('0x0')]={'priority':{'type':Sequelize[_0xe266('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xe266('0x2')],'allowNull':![],'defaultValue':_0xe266('0x3')},'appdata':{'type':Sequelize[_0xe266('0x4')]()},'description':{'type':Sequelize[_0xe266('0x2')]},'interval':{'type':Sequelize[_0xe266('0x2')],'defaultValue':_0xe266('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 8ffff58..49e727d 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 _0x74d2=['limit','count','Content-Range','apply','reject','save','update','destroy','then','name','send','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','merge','map','VIRTUAL','filter','options','FaxApplication','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined'];(function(_0x232080,_0x4d4cae){var _0x79e89c=function(_0x40b6af){while(--_0x40b6af){_0x232080['push'](_0x232080['shift']());}};_0x79e89c(++_0x4d4cae);}(_0x74d2,0x107));var _0x274d=function(_0x2f4d41,_0x525047){_0x2f4d41=_0x2f4d41-0x0;var _0x3b0bb2=_0x74d2[_0x2f4d41];return _0x3b0bb2;};'use strict';var emlformat=require(_0x274d('0x0'));var rimraf=require(_0x274d('0x1'));var zipdir=require(_0x274d('0x2'));var jsonpatch=require(_0x274d('0x3'));var rp=require(_0x274d('0x4'));var moment=require(_0x274d('0x5'));var BPromise=require(_0x274d('0x6'));var Mustache=require(_0x274d('0x7'));var util=require(_0x274d('0x8'));var path=require(_0x274d('0x9'));var sox=require(_0x274d('0xa'));var csv=require(_0x274d('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x274d('0xc'));var _=require(_0x274d('0xd'));var squel=require('squel');var crypto=require(_0x274d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x274d('0xf'));var toCsv=require(_0x274d('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x274d('0x10'));var authService=require(_0x274d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x274d('0x12'));var hardwareService=require(_0x274d('0x13'));var logger=require('../../config/logger')(_0x274d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x274d('0x15'));var db=require(_0x274d('0x16'))['db'];function respondWithStatusCode(_0x3a69ed,_0x1d83ce){_0x1d83ce=_0x1d83ce||0xcc;return function(_0x6ac4d){if(_0x6ac4d){return _0x3a69ed[_0x274d('0x17')](_0x1d83ce);}return _0x3a69ed['status'](_0x1d83ce)[_0x274d('0x18')]();};}function respondWithResult(_0x34ba7a,_0x1d8678){_0x1d8678=_0x1d8678||0xc8;return function(_0x2c37a6){if(_0x2c37a6){return _0x34ba7a[_0x274d('0x19')](_0x1d8678)[_0x274d('0x1a')](_0x2c37a6);}};}function respondWithFilteredResult(_0x2eae83,_0x4bc7e0){return function(_0x145dd6){if(_0x145dd6){var _0x307ed5=typeof _0x4bc7e0[_0x274d('0x1b')]===_0x274d('0x1c')&&typeof _0x4bc7e0[_0x274d('0x1d')]===_0x274d('0x1c');var _0x1e34cf=_0x145dd6[_0x274d('0x1e')];var _0x16a357=_0x307ed5?0x0:_0x4bc7e0[_0x274d('0x1b')];var _0x29ce60=_0x307ed5?_0x145dd6[_0x274d('0x1e')]:_0x4bc7e0[_0x274d('0x1b')]+_0x4bc7e0[_0x274d('0x1d')];var _0x268eba;if(_0x29ce60>=_0x1e34cf){_0x29ce60=_0x1e34cf;_0x268eba=0xc8;}else{_0x268eba=0xce;}_0x2eae83[_0x274d('0x19')](_0x268eba);return _0x2eae83['set'](_0x274d('0x1f'),_0x16a357+'-'+_0x29ce60+'/'+_0x1e34cf)[_0x274d('0x1a')](_0x145dd6);}return null;};}function patchUpdates(_0x4ebc38){return function(_0x522147){try{jsonpatch[_0x274d('0x20')](_0x522147,_0x4ebc38,!![]);}catch(_0x2962c2){return BPromise[_0x274d('0x21')](_0x2962c2);}return _0x522147[_0x274d('0x22')]();};}function saveUpdates(_0x25829b,_0x1eb8e6){return function(_0x8b1357){if(_0x8b1357){return _0x8b1357[_0x274d('0x23')](_0x25829b)['then'](function(_0x4e84e6){return _0x4e84e6;});}return null;};}function removeEntity(_0x2c3c5c,_0xac4fff){return function(_0x35d4f6){if(_0x35d4f6){return _0x35d4f6[_0x274d('0x24')]()[_0x274d('0x25')](function(){_0x2c3c5c[_0x274d('0x19')](0xcc)[_0x274d('0x18')]();});}};}function handleEntityNotFound(_0x5ee620,_0x4dcb04){return function(_0x3f0de9){if(!_0x3f0de9){_0x5ee620[_0x274d('0x17')](0x194);}return _0x3f0de9;};}function handleError(_0x29de4d,_0x28b64f){_0x28b64f=_0x28b64f||0x1f4;return function(_0x5776c4){logger['error'](_0x5776c4['stack']);if(_0x5776c4[_0x274d('0x26')]){delete _0x5776c4['name'];}_0x29de4d[_0x274d('0x19')](_0x28b64f)[_0x274d('0x27')](_0x5776c4);};}exports[_0x274d('0x28')]=function(_0xbaf4e8,_0x1e52d9){var _0x170f06={},_0x5b5430={},_0x50f92a={'count':0x0,'rows':[]};var _0x3c9f56=_['map'](db['FaxApplication'][_0x274d('0x29')],function(_0x50f19a){return{'name':_0x50f19a[_0x274d('0x2a')],'type':_0x50f19a[_0x274d('0x2b')][_0x274d('0x2c')]};});_0x5b5430[_0x274d('0x2d')]=_['map'](_0x3c9f56,_0x274d('0x26'));_0x5b5430['query']=_[_0x274d('0x2e')](_0xbaf4e8[_0x274d('0x2f')]);_0x5b5430[_0x274d('0x30')]=_[_0x274d('0x31')](_0x5b5430[_0x274d('0x2d')],_0x5b5430[_0x274d('0x2f')]);_0x170f06[_0x274d('0x32')]=_[_0x274d('0x31')](_0x5b5430[_0x274d('0x2d')],qs[_0x274d('0x33')](_0xbaf4e8[_0x274d('0x2f')][_0x274d('0x33')]));_0x170f06[_0x274d('0x32')]=_0x170f06[_0x274d('0x32')][_0x274d('0x34')]?_0x170f06[_0x274d('0x32')]:_0x5b5430[_0x274d('0x2d')];if(!_0xbaf4e8['query'][_0x274d('0x35')]('nolimit')){_0x170f06[_0x274d('0x1d')]=qs['limit'](_0xbaf4e8[_0x274d('0x2f')][_0x274d('0x1d')]);_0x170f06[_0x274d('0x1b')]=qs[_0x274d('0x1b')](_0xbaf4e8[_0x274d('0x2f')][_0x274d('0x1b')]);}_0x170f06[_0x274d('0x36')]=qs['sort'](_0xbaf4e8[_0x274d('0x2f')]['sort']);_0x170f06[_0x274d('0x37')]=qs['filters'](_[_0x274d('0x38')](_0xbaf4e8[_0x274d('0x2f')],_0x5b5430[_0x274d('0x30')]),_0x3c9f56);if(_0xbaf4e8[_0x274d('0x2f')]['filter']){_0x170f06[_0x274d('0x37')]=_[_0x274d('0x39')](_0x170f06[_0x274d('0x37')],{'$or':_[_0x274d('0x3a')](_0x3c9f56,function(_0x16e884){if(_0x16e884[_0x274d('0x2b')]!==_0x274d('0x3b')){var _0x20eaa0={};_0x20eaa0[_0x16e884['name']]={'$like':'%'+_0xbaf4e8[_0x274d('0x2f')][_0x274d('0x3c')]+'%'};return _0x20eaa0;}})});}_0x170f06=_['merge']({},_0x170f06,_0xbaf4e8[_0x274d('0x3d')]);var _0x227069={'where':_0x170f06['where']};return db[_0x274d('0x3e')]['count'](_0x227069)[_0x274d('0x25')](function(_0x1adcc9){_0x50f92a[_0x274d('0x1e')]=_0x1adcc9;if(_0xbaf4e8['query']['includeAll']){_0x170f06[_0x274d('0x3f')]=[{'all':!![]}];}return db[_0x274d('0x3e')][_0x274d('0x40')](_0x170f06);})['then'](function(_0x539354){_0x50f92a[_0x274d('0x41')]=_0x539354;return _0x50f92a;})['then'](respondWithFilteredResult(_0x1e52d9,_0x170f06))[_0x274d('0x42')](handleError(_0x1e52d9,null));};exports[_0x274d('0x43')]=function(_0x3e2ff9,_0x217c7b){var _0x2ff6d4={'raw':!![],'where':{'id':_0x3e2ff9[_0x274d('0x44')]['id']}},_0x440867={};_0x440867[_0x274d('0x2d')]=_[_0x274d('0x2e')](db[_0x274d('0x3e')][_0x274d('0x29')]);_0x440867['query']=_['keys'](_0x3e2ff9[_0x274d('0x2f')]);_0x440867[_0x274d('0x30')]=_[_0x274d('0x31')](_0x440867[_0x274d('0x2d')],_0x440867[_0x274d('0x2f')]);_0x2ff6d4[_0x274d('0x32')]=_[_0x274d('0x31')](_0x440867[_0x274d('0x2d')],qs[_0x274d('0x33')](_0x3e2ff9[_0x274d('0x2f')]['fields']));_0x2ff6d4['attributes']=_0x2ff6d4[_0x274d('0x32')][_0x274d('0x34')]?_0x2ff6d4[_0x274d('0x32')]:_0x440867[_0x274d('0x2d')];if(_0x3e2ff9[_0x274d('0x2f')][_0x274d('0x45')]){_0x2ff6d4['include']=[{'all':!![]}];}_0x2ff6d4=_[_0x274d('0x39')]({},_0x2ff6d4,_0x3e2ff9['options']);return db[_0x274d('0x3e')][_0x274d('0x46')](_0x2ff6d4)[_0x274d('0x25')](handleEntityNotFound(_0x217c7b,null))[_0x274d('0x25')](respondWithResult(_0x217c7b,null))[_0x274d('0x42')](handleError(_0x217c7b,null));};exports['create']=function(_0x1f120d,_0x199f27){return db['FaxApplication'][_0x274d('0x47')](_0x1f120d[_0x274d('0x48')],{})[_0x274d('0x25')](respondWithResult(_0x199f27,0xc9))[_0x274d('0x42')](handleError(_0x199f27,null));};exports[_0x274d('0x23')]=function(_0x11de2a,_0x3a91a3){if(_0x11de2a['body']['id']){delete _0x11de2a[_0x274d('0x48')]['id'];}return db[_0x274d('0x3e')][_0x274d('0x46')]({'where':{'id':_0x11de2a[_0x274d('0x44')]['id']}})[_0x274d('0x25')](handleEntityNotFound(_0x3a91a3,null))[_0x274d('0x25')](saveUpdates(_0x11de2a[_0x274d('0x48')],null))[_0x274d('0x25')](respondWithResult(_0x3a91a3,null))[_0x274d('0x42')](handleError(_0x3a91a3,null));};exports['destroy']=function(_0x222e0e,_0x118a16){return db['FaxApplication'][_0x274d('0x46')]({'where':{'id':_0x222e0e[_0x274d('0x44')]['id']}})[_0x274d('0x25')](handleEntityNotFound(_0x118a16,null))['then'](removeEntity(_0x118a16,null))[_0x274d('0x42')](handleError(_0x118a16,null));}; \ No newline at end of file +var _0xaedc=['to-csv','ejs','fs-extra','lodash','squel','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','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','then','includeAll','findAll','rows','catch','params','keys','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x438c8b,_0x4cce66){var _0x3aa276=function(_0x416ee){while(--_0x416ee){_0x438c8b['push'](_0x438c8b['shift']());}};_0x3aa276(++_0x4cce66);}(_0xaedc,0x1c7));var _0xcaed=function(_0x51e3db,_0x483e38){_0x51e3db=_0x51e3db-0x0;var _0x3f3a11=_0xaedc[_0x51e3db];return _0x3f3a11;};'use strict';var emlformat=require(_0xcaed('0x0'));var rimraf=require(_0xcaed('0x1'));var zipdir=require(_0xcaed('0x2'));var jsonpatch=require(_0xcaed('0x3'));var rp=require(_0xcaed('0x4'));var moment=require('moment');var BPromise=require(_0xcaed('0x5'));var Mustache=require(_0xcaed('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcaed('0x7'));var ejs=require(_0xcaed('0x8'));var fs=require('fs');var fs_extra=require(_0xcaed('0x9'));var _=require(_0xcaed('0xa'));var squel=require(_0xcaed('0xb'));var crypto=require('crypto');var jsforce=require(_0xcaed('0xc'));var deskjs=require(_0xcaed('0xd'));var toCsv=require(_0xcaed('0x7'));var querystring=require(_0xcaed('0xe'));var Papa=require(_0xcaed('0xf'));var Redis=require(_0xcaed('0x10'));var authService=require(_0xcaed('0x11'));var qs=require(_0xcaed('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcaed('0x13'));var logger=require(_0xcaed('0x14'))(_0xcaed('0x15'));var utils=require(_0xcaed('0x16'));var config=require(_0xcaed('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcaed('0x18'))['db'];function respondWithStatusCode(_0xa176b8,_0x47b453){_0x47b453=_0x47b453||0xcc;return function(_0x453302){if(_0x453302){return _0xa176b8[_0xcaed('0x19')](_0x47b453);}return _0xa176b8[_0xcaed('0x1a')](_0x47b453)[_0xcaed('0x1b')]();};}function respondWithResult(_0x5df64a,_0x50aa8a){_0x50aa8a=_0x50aa8a||0xc8;return function(_0x800906){if(_0x800906){return _0x5df64a[_0xcaed('0x1a')](_0x50aa8a)[_0xcaed('0x1c')](_0x800906);}};}function respondWithFilteredResult(_0x1f2fcc,_0x259bc7){return function(_0x419af7){if(_0x419af7){var _0xcf9439=typeof _0x259bc7['offset']===_0xcaed('0x1d')&&typeof _0x259bc7[_0xcaed('0x1e')]===_0xcaed('0x1d');var _0x452279=_0x419af7['count'];var _0x549261=_0xcf9439?0x0:_0x259bc7[_0xcaed('0x1f')];var _0x4138eb=_0xcf9439?_0x419af7['count']:_0x259bc7['offset']+_0x259bc7[_0xcaed('0x1e')];var _0x14374d;if(_0x4138eb>=_0x452279){_0x4138eb=_0x452279;_0x14374d=0xc8;}else{_0x14374d=0xce;}_0x1f2fcc[_0xcaed('0x1a')](_0x14374d);return _0x1f2fcc[_0xcaed('0x20')](_0xcaed('0x21'),_0x549261+'-'+_0x4138eb+'/'+_0x452279)[_0xcaed('0x1c')](_0x419af7);}return null;};}function patchUpdates(_0xc01eaf){return function(_0x22ed6d){try{jsonpatch[_0xcaed('0x22')](_0x22ed6d,_0xc01eaf,!![]);}catch(_0x461ff0){return BPromise[_0xcaed('0x23')](_0x461ff0);}return _0x22ed6d[_0xcaed('0x24')]();};}function saveUpdates(_0x28ea07,_0x4b7ae6){return function(_0x4340c2){if(_0x4340c2){return _0x4340c2[_0xcaed('0x25')](_0x28ea07)['then'](function(_0x2865bf){return _0x2865bf;});}return null;};}function removeEntity(_0x3d891a,_0x1f73e1){return function(_0x5f38f3){if(_0x5f38f3){return _0x5f38f3[_0xcaed('0x26')]()['then'](function(){_0x3d891a[_0xcaed('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4087a5,_0x3161ee){return function(_0x58af02){if(!_0x58af02){_0x4087a5[_0xcaed('0x19')](0x194);}return _0x58af02;};}function handleError(_0xcf5490,_0x57117a){_0x57117a=_0x57117a||0x1f4;return function(_0x4803f8){logger[_0xcaed('0x27')](_0x4803f8[_0xcaed('0x28')]);if(_0x4803f8['name']){delete _0x4803f8[_0xcaed('0x29')];}_0xcf5490['status'](_0x57117a)[_0xcaed('0x2a')](_0x4803f8);};}exports['index']=function(_0x46bd5d,_0x193334){var _0x2bc562={},_0x39745c={},_0x2212dc={'count':0x0,'rows':[]};var _0x59f3d8=_[_0xcaed('0x2b')](db[_0xcaed('0x2c')][_0xcaed('0x2d')],function(_0x2ccad4){return{'name':_0x2ccad4[_0xcaed('0x2e')],'type':_0x2ccad4[_0xcaed('0x2f')][_0xcaed('0x30')]};});_0x39745c[_0xcaed('0x31')]=_[_0xcaed('0x2b')](_0x59f3d8,_0xcaed('0x29'));_0x39745c[_0xcaed('0x32')]=_['keys'](_0x46bd5d['query']);_0x39745c[_0xcaed('0x33')]=_[_0xcaed('0x34')](_0x39745c['model'],_0x39745c[_0xcaed('0x32')]);_0x2bc562[_0xcaed('0x35')]=_['intersection'](_0x39745c[_0xcaed('0x31')],qs[_0xcaed('0x36')](_0x46bd5d[_0xcaed('0x32')][_0xcaed('0x36')]));_0x2bc562['attributes']=_0x2bc562['attributes'][_0xcaed('0x37')]?_0x2bc562['attributes']:_0x39745c[_0xcaed('0x31')];if(!_0x46bd5d[_0xcaed('0x32')][_0xcaed('0x38')](_0xcaed('0x39'))){_0x2bc562[_0xcaed('0x1e')]=qs[_0xcaed('0x1e')](_0x46bd5d[_0xcaed('0x32')][_0xcaed('0x1e')]);_0x2bc562[_0xcaed('0x1f')]=qs['offset'](_0x46bd5d[_0xcaed('0x32')]['offset']);}_0x2bc562[_0xcaed('0x3a')]=qs[_0xcaed('0x3b')](_0x46bd5d['query'][_0xcaed('0x3b')]);_0x2bc562[_0xcaed('0x3c')]=qs['filters'](_['pick'](_0x46bd5d['query'],_0x39745c['filters']),_0x59f3d8);if(_0x46bd5d['query'][_0xcaed('0x3d')]){_0x2bc562[_0xcaed('0x3c')]=_[_0xcaed('0x3e')](_0x2bc562[_0xcaed('0x3c')],{'$or':_[_0xcaed('0x2b')](_0x59f3d8,function(_0x2697ce){if(_0x2697ce[_0xcaed('0x2f')]!==_0xcaed('0x3f')){var _0x12973c={};_0x12973c[_0x2697ce[_0xcaed('0x29')]]={'$like':'%'+_0x46bd5d[_0xcaed('0x32')][_0xcaed('0x3d')]+'%'};return _0x12973c;}})});}_0x2bc562=_[_0xcaed('0x3e')]({},_0x2bc562,_0x46bd5d[_0xcaed('0x40')]);var _0x5e0c37={'where':_0x2bc562[_0xcaed('0x3c')]};return db[_0xcaed('0x2c')][_0xcaed('0x41')](_0x5e0c37)[_0xcaed('0x42')](function(_0x552ed4){_0x2212dc[_0xcaed('0x41')]=_0x552ed4;if(_0x46bd5d[_0xcaed('0x32')][_0xcaed('0x43')]){_0x2bc562['include']=[{'all':!![]}];}return db['FaxApplication'][_0xcaed('0x44')](_0x2bc562);})[_0xcaed('0x42')](function(_0x51973a){_0x2212dc[_0xcaed('0x45')]=_0x51973a;return _0x2212dc;})['then'](respondWithFilteredResult(_0x193334,_0x2bc562))[_0xcaed('0x46')](handleError(_0x193334,null));};exports['show']=function(_0x1710c2,_0x149670){var _0x1fce12={'raw':!![],'where':{'id':_0x1710c2[_0xcaed('0x47')]['id']}},_0x247365={};_0x247365[_0xcaed('0x31')]=_[_0xcaed('0x48')](db[_0xcaed('0x2c')][_0xcaed('0x2d')]);_0x247365[_0xcaed('0x32')]=_[_0xcaed('0x48')](_0x1710c2[_0xcaed('0x32')]);_0x247365[_0xcaed('0x33')]=_[_0xcaed('0x34')](_0x247365[_0xcaed('0x31')],_0x247365['query']);_0x1fce12['attributes']=_[_0xcaed('0x34')](_0x247365['model'],qs[_0xcaed('0x36')](_0x1710c2[_0xcaed('0x32')]['fields']));_0x1fce12[_0xcaed('0x35')]=_0x1fce12['attributes'][_0xcaed('0x37')]?_0x1fce12[_0xcaed('0x35')]:_0x247365[_0xcaed('0x31')];if(_0x1710c2[_0xcaed('0x32')][_0xcaed('0x43')]){_0x1fce12[_0xcaed('0x49')]=[{'all':!![]}];}_0x1fce12=_[_0xcaed('0x3e')]({},_0x1fce12,_0x1710c2[_0xcaed('0x40')]);return db[_0xcaed('0x2c')][_0xcaed('0x4a')](_0x1fce12)['then'](handleEntityNotFound(_0x149670,null))['then'](respondWithResult(_0x149670,null))[_0xcaed('0x46')](handleError(_0x149670,null));};exports[_0xcaed('0x4b')]=function(_0x2a194d,_0x516e5f){return db[_0xcaed('0x2c')][_0xcaed('0x4b')](_0x2a194d['body'],{})[_0xcaed('0x42')](respondWithResult(_0x516e5f,0xc9))['catch'](handleError(_0x516e5f,null));};exports[_0xcaed('0x25')]=function(_0x283a9e,_0x564f49){if(_0x283a9e[_0xcaed('0x4c')]['id']){delete _0x283a9e[_0xcaed('0x4c')]['id'];}return db['FaxApplication'][_0xcaed('0x4a')]({'where':{'id':_0x283a9e[_0xcaed('0x47')]['id']}})[_0xcaed('0x42')](handleEntityNotFound(_0x564f49,null))[_0xcaed('0x42')](saveUpdates(_0x283a9e[_0xcaed('0x4c')],null))[_0xcaed('0x42')](respondWithResult(_0x564f49,null))[_0xcaed('0x46')](handleError(_0x564f49,null));};exports['destroy']=function(_0x50e3c1,_0x58a647){return db[_0xcaed('0x2c')][_0xcaed('0x4a')]({'where':{'id':_0x50e3c1[_0xcaed('0x47')]['id']}})[_0xcaed('0x42')](handleEntityNotFound(_0x58a647,null))[_0xcaed('0x42')](removeEntity(_0x58a647,null))['catch'](handleError(_0x58a647,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index f6a303d..c1096f4 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 _0x8905=['FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./faxApplication.attributes','exports','define'];(function(_0x4ebdf4,_0x57d47f){var _0x18d1c1=function(_0x83f2a0){while(--_0x83f2a0){_0x4ebdf4['push'](_0x4ebdf4['shift']());}};_0x18d1c1(++_0x57d47f);}(_0x8905,0x146));var _0x5890=function(_0x8375a,_0x205a93){_0x8375a=_0x8375a-0x0;var _0x1c1243=_0x8905[_0x8375a];return _0x1c1243;};'use strict';var _=require(_0x5890('0x0'));var util=require(_0x5890('0x1'));var logger=require(_0x5890('0x2'))(_0x5890('0x3'));var moment=require(_0x5890('0x4'));var BPromise=require('bluebird');var rp=require(_0x5890('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5890('0x6'));var config=require('../../config/environment');var attributes=require(_0x5890('0x7'));module[_0x5890('0x8')]=function(_0x1f6f96,_0x74fad7){return _0x1f6f96[_0x5890('0x9')](_0x5890('0xa'),attributes,{'tableName':_0x5890('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5890('0xc'),'collate':_0x5890('0xd')});}; \ No newline at end of file +var _0x37c4=['util','../../config/logger','bluebird','rimraf','./faxApplication.attributes','exports','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1c3ad8,_0x23dfb7){var _0x9201cc=function(_0x463dc4){while(--_0x463dc4){_0x1c3ad8['push'](_0x1c3ad8['shift']());}};_0x9201cc(++_0x23dfb7);}(_0x37c4,0x1e3));var _0x437c=function(_0x49c48a,_0x151545){_0x49c48a=_0x49c48a-0x0;var _0x55cea9=_0x37c4[_0x49c48a];return _0x55cea9;};'use strict';var _=require(_0x437c('0x0'));var util=require(_0x437c('0x1'));var logger=require(_0x437c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x437c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x437c('0x4'));var config=require('../../config/environment');var attributes=require(_0x437c('0x5'));module[_0x437c('0x6')]=function(_0x628e83,_0x5b01af){return _0x628e83['define'](_0x437c('0x7'),attributes,{'tableName':_0x437c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x437c('0x9'),'collate':_0x437c('0xa')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index ca8ba0a..2610323 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 _0x6138=['message','FaxApplication','update','options','where','attributes','limit','info','UpdateFaxApplication','debug','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6138,0xbe));var _0x8613=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x6138[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var util=require(_0x8613('0x0'));var moment=require(_0x8613('0x1'));var BPromise=require(_0x8613('0x2'));var rs=require(_0x8613('0x3'));var fs=require('fs');var Redis=require(_0x8613('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8613('0x5'));var logger=require(_0x8613('0x6'))(_0x8613('0x7'));var config=require(_0x8613('0x8'));var jayson=require(_0x8613('0x9'));var client=jayson[_0x8613('0xa')][_0x8613('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9b41cb,_0x2b6a81,_0x435f5a){return new BPromise(function(_0xc0b00,_0x15e25f){return client[_0x8613('0xc')](_0x9b41cb,_0x435f5a)[_0x8613('0xd')](function(_0x2cf26b){logger['info'](_0x8613('0xe'),_0x2b6a81,_0x8613('0xf'));logger['debug'](_0x8613('0x10'),_0x2b6a81,_0x8613('0xf'),JSON[_0x8613('0x11')](_0x2cf26b));if(_0x2cf26b['error']){if(_0x2cf26b[_0x8613('0x12')][_0x8613('0x13')]===0x1f4){logger[_0x8613('0x12')](_0x8613('0xe'),_0x2b6a81,_0x2cf26b[_0x8613('0x12')][_0x8613('0x14')]);return _0x15e25f(_0x2cf26b['error']['message']);}logger[_0x8613('0x12')]('FaxApplication,\x20%s,\x20%s',_0x2b6a81,_0x2cf26b[_0x8613('0x12')]['message']);return _0xc0b00(_0x2cf26b['error'][_0x8613('0x14')]);}else{logger['info'](_0x8613('0xe'),_0x2b6a81,_0x8613('0xf'));_0xc0b00(_0x2cf26b['result'][_0x8613('0x14')]);}})['catch'](function(_0x59fe42){logger[_0x8613('0x12')]('FaxApplication,\x20%s,\x20%s',_0x2b6a81,_0x59fe42);_0x15e25f(_0x59fe42);});});}exports['UpdateFaxApplication']=function(_0x55552b){var _0x1d4355=this;return new Promise(function(_0x50e724,_0x39684e){return db[_0x8613('0x15')][_0x8613('0x16')](_0x55552b['body'],{'raw':_0x55552b[_0x8613('0x17')]?_0x55552b[_0x8613('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55552b[_0x8613('0x17')]?_0x55552b[_0x8613('0x17')][_0x8613('0x18')]||null:null,'attributes':_0x55552b[_0x8613('0x17')]?_0x55552b[_0x8613('0x17')][_0x8613('0x19')]||null:null,'limit':_0x55552b[_0x8613('0x17')]?_0x55552b['options'][_0x8613('0x1a')]||null:null})[_0x8613('0xd')](function(_0x574881){logger[_0x8613('0x1b')](_0x8613('0x1c'),_0x55552b);logger[_0x8613('0x1d')]('UpdateFaxApplication',_0x55552b,JSON[_0x8613('0x11')](_0x574881));_0x50e724(_0x574881);})['catch'](function(_0x5d9d13){logger[_0x8613('0x12')](_0x8613('0x1c'),_0x5d9d13['message'],_0x55552b);_0x39684e(_0x1d4355[_0x8613('0x12')](0x1f4,_0x5d9d13[_0x8613('0x14')]));});});}; \ No newline at end of file +var _0x0d17=['limit','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateFaxApplication','FaxApplication','update','body','options','raw','attributes'];(function(_0xa9fe94,_0x14022b){var _0xd287c2=function(_0x1342c3){while(--_0x1342c3){_0xa9fe94['push'](_0xa9fe94['shift']());}};_0xd287c2(++_0x14022b);}(_0x0d17,0x93));var _0x70d1=function(_0x2782bb,_0x262f27){_0x2782bb=_0x2782bb-0x0;var _0x573f68=_0x0d17[_0x2782bb];return _0x573f68;};'use strict';var _=require('lodash');var util=require(_0x70d1('0x0'));var moment=require(_0x70d1('0x1'));var BPromise=require('bluebird');var rs=require(_0x70d1('0x2'));var fs=require('fs');var Redis=require(_0x70d1('0x3'));var db=require(_0x70d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x70d1('0x5'))('rpc');var config=require(_0x70d1('0x6'));var jayson=require(_0x70d1('0x7'));var client=jayson[_0x70d1('0x8')][_0x70d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x182a92,_0x39149d,_0x50733a){return new BPromise(function(_0x573a5c,_0x5c4695){return client[_0x70d1('0xa')](_0x182a92,_0x50733a)['then'](function(_0x7d69e0){logger[_0x70d1('0xb')](_0x70d1('0xc'),_0x39149d,_0x70d1('0xd'));logger[_0x70d1('0xe')](_0x70d1('0xf'),_0x39149d,_0x70d1('0xd'),JSON[_0x70d1('0x10')](_0x7d69e0));if(_0x7d69e0[_0x70d1('0x11')]){if(_0x7d69e0[_0x70d1('0x11')][_0x70d1('0x12')]===0x1f4){logger[_0x70d1('0x11')](_0x70d1('0xc'),_0x39149d,_0x7d69e0[_0x70d1('0x11')][_0x70d1('0x13')]);return _0x5c4695(_0x7d69e0[_0x70d1('0x11')][_0x70d1('0x13')]);}logger[_0x70d1('0x11')](_0x70d1('0xc'),_0x39149d,_0x7d69e0['error'][_0x70d1('0x13')]);return _0x573a5c(_0x7d69e0[_0x70d1('0x11')][_0x70d1('0x13')]);}else{logger[_0x70d1('0xb')](_0x70d1('0xc'),_0x39149d,'request\x20sent');_0x573a5c(_0x7d69e0['result'][_0x70d1('0x13')]);}})['catch'](function(_0x32d002){logger[_0x70d1('0x11')](_0x70d1('0xc'),_0x39149d,_0x32d002);_0x5c4695(_0x32d002);});});}exports[_0x70d1('0x14')]=function(_0x599db0){var _0x2fbdc4=this;return new Promise(function(_0x38514a,_0x4263ed){return db[_0x70d1('0x15')][_0x70d1('0x16')](_0x599db0[_0x70d1('0x17')],{'raw':_0x599db0[_0x70d1('0x18')]?_0x599db0[_0x70d1('0x18')][_0x70d1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x599db0[_0x70d1('0x18')]?_0x599db0[_0x70d1('0x18')]['where']||null:null,'attributes':_0x599db0[_0x70d1('0x18')]?_0x599db0[_0x70d1('0x18')][_0x70d1('0x1a')]||null:null,'limit':_0x599db0[_0x70d1('0x18')]?_0x599db0[_0x70d1('0x18')][_0x70d1('0x1b')]||null:null})[_0x70d1('0x1c')](function(_0xbf8f67){logger['info'](_0x70d1('0x14'),_0x599db0);logger[_0x70d1('0xe')](_0x70d1('0x14'),_0x599db0,JSON[_0x70d1('0x10')](_0xbf8f67));_0x38514a(_0xbf8f67);})['catch'](function(_0x3d5d2d){logger['error'](_0x70d1('0x14'),_0x3d5d2d['message'],_0x599db0);_0x4263ed(_0x2fbdc4['error'](0x1f4,_0x3d5d2d[_0x70d1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 404c8d6..5ab45da 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 _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x1b8e87,_0x5b00fb){var _0x188a6b=function(_0x137812){while(--_0x137812){_0x1b8e87['push'](_0x1b8e87['shift']());}};_0x188a6b(++_0x5b00fb);}(_0x757a,0xde));var _0xa757=function(_0x591d89,_0x247e65){_0x591d89=_0x591d89-0x0;var _0x397e3c=_0x757a[_0x591d89];return _0x397e3c;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa571=['index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x10509d,_0xfbdfe0){var _0x486be6=function(_0x55a702){while(--_0x55a702){_0x10509d['push'](_0x10509d['shift']());}};_0x486be6(++_0xfbdfe0);}(_0xa571,0x107));var _0x1a57=function(_0x5b6417,_0x29f4e4){_0x5b6417=_0x5b6417-0x0;var _0x527f95=_0xa571[_0x5b6417];return _0x527f95;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./faxApplication.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0xb')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0xc')]);router['put'](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);module[_0x1a57('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 f68ec87..56c6cd3 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 _0xea41=['BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x50374c,_0x2de3d1){var _0x4cae5b=function(_0x2c4e80){while(--_0x2c4e80){_0x50374c['push'](_0x50374c['shift']());}};_0x4cae5b(++_0x2de3d1);}(_0xea41,0x14f));var _0x1ea4=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xea41[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x1ea4('0x0'));module['exports']={'closed':{'type':Sequelize[_0x1ea4('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1ea4('0x2')]},'disposition':{'type':Sequelize[_0x1ea4('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1ea4('0x3')]},'note':{'type':Sequelize[_0x1ea4('0x3')]},'read1stAt':{'type':Sequelize[_0x1ea4('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x1ea4('0x4')]('in',_0x1ea4('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x1ea4('0x4')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xd5bc=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x2179f1,_0x21c653){var _0x176ec9=function(_0x4c4a4c){while(--_0x4c4a4c){_0x2179f1['push'](_0x2179f1['shift']());}};_0x176ec9(++_0x21c653);}(_0xd5bc,0x78));var _0xcd5b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd5bc[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xcd5b('0x0'));module[_0xcd5b('0x1')]={'closed':{'type':Sequelize[_0xcd5b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcd5b('0x3')]},'disposition':{'type':Sequelize[_0xcd5b('0x4')]},'secondDisposition':{'type':Sequelize[_0xcd5b('0x4')]},'thirdDisposition':{'type':Sequelize[_0xcd5b('0x4')]},'note':{'type':Sequelize[_0xcd5b('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xcd5b('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xcd5b('0x5')]('in',_0xcd5b('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcd5b('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 7dd0e8d..1234d1a 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 _0x60d7=['type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','select','field','tools_tags','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','Contact','operator','$substring','value','length','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','keys','some','compact','FaxAccountId','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','agent','sequelize','toString','merge','FaxInteraction','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','params','rawAttributes','includeAll','include','create','destroy','describe','FaxMessage','addMessage','ids','getMessages','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','omit','spread','Tag','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','closed','UserId','answered','unmanaged','total','index','fieldName'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x60d7,0x17e));var _0x760d=function(_0x38f609,_0x15284f){_0x38f609=_0x38f609-0x0;var _0x1e1369=_0x60d7[_0x38f609];return _0x1e1369;};'use strict';var emlformat=require(_0x760d('0x0'));var rimraf=require(_0x760d('0x1'));var zipdir=require(_0x760d('0x2'));var jsonpatch=require(_0x760d('0x3'));var rp=require(_0x760d('0x4'));var moment=require(_0x760d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x760d('0x6'));var util=require(_0x760d('0x7'));var path=require(_0x760d('0x8'));var sox=require(_0x760d('0x9'));var csv=require(_0x760d('0xa'));var ejs=require(_0x760d('0xb'));var fs=require('fs');var fs_extra=require(_0x760d('0xc'));var _=require(_0x760d('0xd'));var squel=require('squel');var crypto=require(_0x760d('0xe'));var jsforce=require(_0x760d('0xf'));var deskjs=require(_0x760d('0x10'));var toCsv=require(_0x760d('0xa'));var querystring=require(_0x760d('0x11'));var Papa=require(_0x760d('0x12'));var Redis=require(_0x760d('0x13'));var authService=require(_0x760d('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x760d('0x15'));var hardwareService=require(_0x760d('0x16'));var logger=require(_0x760d('0x17'))(_0x760d('0x18'));var utils=require('../../config/utils');var config=require(_0x760d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x760d('0x1a'))['db'];config[_0x760d('0x1b')]=_[_0x760d('0x1c')](config[_0x760d('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x760d('0x1d'))(new Redis(config['redis']));require(_0x760d('0x1e'))[_0x760d('0x1f')](socket);function respondWithStatusCode(_0x43baef,_0x73dc09){_0x73dc09=_0x73dc09||0xcc;return function(_0x3b3a2d){if(_0x3b3a2d){return _0x43baef[_0x760d('0x20')](_0x73dc09);}return _0x43baef[_0x760d('0x21')](_0x73dc09)[_0x760d('0x22')]();};}function respondWithResult(_0x4cdb45,_0x54daf1){_0x54daf1=_0x54daf1||0xc8;return function(_0x38e30f){if(_0x38e30f){return _0x4cdb45[_0x760d('0x21')](_0x54daf1)[_0x760d('0x23')](_0x38e30f);}};}function respondWithFilteredResult(_0x45a743,_0x289366){return function(_0x5e887e){if(_0x5e887e){var _0x21b8fe=typeof _0x289366[_0x760d('0x24')]==='undefined'&&typeof _0x289366[_0x760d('0x25')]===_0x760d('0x26');var _0x1dbecc=_0x5e887e[_0x760d('0x27')];var _0x752f74=_0x21b8fe?0x0:_0x289366[_0x760d('0x24')];var _0x41c997=_0x21b8fe?_0x5e887e[_0x760d('0x27')]:_0x289366[_0x760d('0x24')]+_0x289366[_0x760d('0x25')];var _0x348f0c;if(_0x41c997>=_0x1dbecc){_0x41c997=_0x1dbecc;_0x348f0c=0xc8;}else{_0x348f0c=0xce;}_0x45a743[_0x760d('0x21')](_0x348f0c);return _0x45a743[_0x760d('0x28')](_0x760d('0x29'),_0x752f74+'-'+_0x41c997+'/'+_0x1dbecc)[_0x760d('0x23')](_0x5e887e);}return null;};}function patchUpdates(_0x4cc441){return function(_0x6c3749){try{jsonpatch[_0x760d('0x2a')](_0x6c3749,_0x4cc441,!![]);}catch(_0x18c47d){return BPromise[_0x760d('0x2b')](_0x18c47d);}return _0x6c3749[_0x760d('0x2c')]();};}function saveUpdates(_0x26d779,_0x8f3ce){return function(_0x1be357){if(_0x1be357){return _0x1be357[_0x760d('0x2d')](_0x26d779)['then'](function(_0x4ec66b){return _0x4ec66b;});}return null;};}function removeEntity(_0x605462,_0x508418){return function(_0x2eb795){if(_0x2eb795){return _0x2eb795['destroy']()[_0x760d('0x2e')](function(){_0x605462[_0x760d('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cd688,_0x2b2e24){return function(_0x5b6321){if(!_0x5b6321){_0x3cd688[_0x760d('0x20')](0x194);}return _0x5b6321;};}function handleError(_0x210b5c,_0x410f19){_0x410f19=_0x410f19||0x1f4;return function(_0x1236c8){logger['error'](_0x1236c8[_0x760d('0x2f')]);if(_0x1236c8[_0x760d('0x30')]){delete _0x1236c8[_0x760d('0x30')];}_0x210b5c[_0x760d('0x21')](_0x410f19)[_0x760d('0x31')](_0x1236c8);};}function getInteractionUsers(_0x62e69e,_0x62d7d9){return new BPromise(function(_0x468430,_0x384b62){try{if(_0x62d7d9[_0x62e69e['id']]){_0x62e69e[_0x760d('0x32')]=_[_0x760d('0x33')](_0x62d7d9[_0x62e69e['id']],function(_0x2b235f){return{'id':_0x2b235f['id'],'fullname':_0x2b235f[_0x760d('0x34')]};});}}catch(_0x3d127c){_0x384b62(_0x3d127c);}_0x468430(_0x62e69e);});}function getInteractionTags(_0x24bb86,_0x1eca6f){return new BPromise(function(_0xdf682c,_0x5091b2){try{if(_0x24bb86[_0x760d('0x35')]){_0x24bb86[_0x760d('0x36')]=[];_0x24bb86[_0x760d('0x35')][_0x760d('0x37')](',')[_0x760d('0x38')](function(_0x59c3b0){_0x24bb86[_0x760d('0x36')][_0x760d('0x39')](_0x1eca6f[_0x59c3b0]);});}delete _0x24bb86['TagIds'];}catch(_0x5f5b38){_0x5091b2(_0x5f5b38);}_0xdf682c(_0x24bb86);});}function updateFaxInteraction(_0x31aaa7,_0x2febc6,_0x41cd5b){return new BPromise(function(_0x423748,_0x5f2d26){return getInteractionUsers(_0x31aaa7,_0x41cd5b)[_0x760d('0x2e')](function(_0x462f9e){return getInteractionTags(_0x462f9e,_0x2febc6);})[_0x760d('0x2e')](function(_0x149562){return getStateInteraction(_0x149562);})[_0x760d('0x2e')](function(_0x1c6022){_0x423748(_0x1c6022);})[_0x760d('0x3a')](function(_0x4a195a){_0x5f2d26(_0x4a195a);});});}function getStateInteraction(_0xa12ecb){return new BPromise(function(_0x1032a8){_0xa12ecb[_0x760d('0x3b')]=0x0;_0xa12ecb[_0x760d('0x3c')]=0x0;_0xa12ecb['answered']=0x0;_0xa12ecb['unmanaged']=0x0;_0xa12ecb['total']=0x0;if(!_0xa12ecb[_0x760d('0x3d')]&&!_0xa12ecb['UserId']){_0xa12ecb[_0x760d('0x3b')]+=0x1;}if(!_0xa12ecb['closed']&&_0xa12ecb[_0x760d('0x3e')]){_0xa12ecb[_0x760d('0x3c')]+=0x1;if(_0xa12ecb[_0x760d('0x3b')]){_0xa12ecb[_0x760d('0x3b')]-=0x1;}}if(_0xa12ecb[_0x760d('0x3d')]&&_0xa12ecb[_0x760d('0x3e')]){_0xa12ecb[_0x760d('0x3f')]+=0x1;if(_0xa12ecb[_0x760d('0x3c')]){_0xa12ecb['talking']-=0x1;}}if(_0xa12ecb[_0x760d('0x3d')]&&!_0xa12ecb[_0x760d('0x3e')]){_0xa12ecb[_0x760d('0x40')]+=0x1;if(_0xa12ecb[_0x760d('0x3b')]){_0xa12ecb['waiting']-=0x1;}}_0xa12ecb[_0x760d('0x41')]+=0x1;_0x1032a8(_0xa12ecb);});}exports[_0x760d('0x42')]=function(_0x2d371e,_0x8f39c4){var _0x506eba={},_0x311fd5={},_0x570e46={'count':0x0,'rows':[]};var _0x5bb5d2=_[_0x760d('0x33')](db['FaxInteraction']['rawAttributes'],function(_0x567c37){return{'name':_0x567c37[_0x760d('0x43')],'type':_0x567c37[_0x760d('0x44')][_0x760d('0x45')]};});_0x311fd5[_0x760d('0x46')]=_[_0x760d('0x33')](_0x5bb5d2,'name');_0x311fd5[_0x760d('0x47')]=_['keys'](_0x2d371e[_0x760d('0x47')]);_0x311fd5[_0x760d('0x48')]=_[_0x760d('0x49')](_0x311fd5['model'],_0x311fd5[_0x760d('0x47')]);_0x506eba[_0x760d('0x4a')]=_[_0x760d('0x49')](_0x311fd5['model'],qs[_0x760d('0x4b')](_0x2d371e[_0x760d('0x47')][_0x760d('0x4b')]));_0x506eba[_0x760d('0x4a')]=_0x506eba[_0x760d('0x4a')]['length']?_0x506eba[_0x760d('0x4a')]:_0x311fd5['model'];if(!_0x2d371e['query'][_0x760d('0x4c')]('nolimit')){_0x506eba[_0x760d('0x25')]=qs[_0x760d('0x25')](_0x2d371e[_0x760d('0x47')][_0x760d('0x25')]);_0x506eba[_0x760d('0x24')]=qs[_0x760d('0x24')](_0x2d371e[_0x760d('0x47')]['offset']);}_0x506eba[_0x760d('0x4d')]=qs[_0x760d('0x4e')](_0x2d371e[_0x760d('0x47')][_0x760d('0x4e')]);_0x506eba[_0x760d('0x4f')]=qs['filters'](_[_0x760d('0x50')](_0x2d371e[_0x760d('0x47')],_0x311fd5[_0x760d('0x48')]),_0x5bb5d2);var _0x456686=[];var _0x403ad2=squel[_0x760d('0x51')]()[_0x760d('0x52')]('id')[_0x760d('0x52')]('name')[_0x760d('0x52')]('color')['from'](_0x760d('0x53'));var _0x2125d7=squel[_0x760d('0x51')]()[_0x760d('0x52')]('u.id')[_0x760d('0x52')]('u.fullname')[_0x760d('0x52')](_0x760d('0x54'))['from'](_0x760d('0x55'),'ui')[_0x760d('0x56')](_0x760d('0x57'),'u',_0x760d('0x58'));var _0x51503d=squel[_0x760d('0x51')]()['from'](_0x760d('0x59'),'i')[_0x760d('0x56')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x760d('0x56')](_0x760d('0x57'),'o',_0x760d('0x5a'))[_0x760d('0x56')](_0x760d('0x5b'),'a',_0x760d('0x5c'))['left_join'](_0x760d('0x5d'),'me',_0x760d('0x5e'))['left_join'](_0x760d('0x5f'),'it',_0x760d('0x60'))[_0x760d('0x56')]('tools_tags','t',_0x760d('0x61'));var _0x393051=squel[_0x760d('0x62')]();var _0x37d83f=[];var _0x148d1c=squel[_0x760d('0x62')]();var _0x35198e;if(_0x2d371e[_0x760d('0x47')][_0x760d('0x63')]){_0x35198e=as[_0x760d('0x64')](_0x2d371e[_0x760d('0x47')][_0x760d('0x63')]);var _0x39521a=_0x35198e[_0x760d('0x65')];for(var _0x4e4d60=0x0;_0x4e4d60<_0x35198e[_0x760d('0x66')]['length'];_0x4e4d60++){var _0x9006ab=_0x35198e[_0x760d('0x66')][_0x4e4d60];var _0x416467='i';var _0x11b977=_[_0x760d('0x67')](_0x5bb5d2,[_0x760d('0x30'),_0x9006ab[_0x760d('0x52')]]);if(!_0x11b977){switch(_0x9006ab[_0x760d('0x52')]){case _0x760d('0x68'):if(_0x9006ab['value']==0x1){_0x51503d['having']('`'+_0x9006ab[_0x760d('0x52')]+'`\x20=\x200');}else{_0x51503d[_0x760d('0x69')]('`'+_0x9006ab['field']+'`\x20>\x200');}break;case _0x760d('0x6a'):if(_0x9006ab[_0x760d('0x6b')]===_0x760d('0x6c')){if(_0x9006ab[_0x760d('0x6d')]['split']('\x20')[_0x760d('0x6e')]>0x1){_0x393051[_0x39521a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x760d('0x6f')](_0x9006ab[_0x760d('0x6d')]),null);}else{var _0xc88325='%'+_0x9006ab['value']+'%';_0x393051[_0x39521a](_0x760d('0x70'),_0xc88325,_0xc88325,_0xc88325);}}else{_0x11b977=_[_0x760d('0x67')](_0x5bb5d2,[_0x760d('0x30'),_0x760d('0x71')]);_0x9006ab['field']=_0x760d('0x71');_0x1ebf09=as[_0x760d('0x72')](_0x416467,_0x11b977[_0x760d('0x44')],_0x9006ab);_0x393051[_0x39521a](_0x1ebf09[_0x760d('0x73')],_0x1ebf09[_0x760d('0x6d')][_0x760d('0x74')],_0x1ebf09[_0x760d('0x6d')][_0x760d('0x22')]);}break;case'Tag':var _0x4443e7=_0x9006ab[_0x760d('0x6d')][_0x760d('0x37')](',')[_0x760d('0x33')](function(_0x42f26c){return Number(_0x42f26c);});_0x4443e7[_0x760d('0x38')](function(_0x59e6f5){_0x148d1c['or'](_0x760d('0x75'),'%,'+_0x59e6f5+',%');});_0x37d83f=_['union'](_0x37d83f,_0x4443e7);break;case _0x760d('0x76'):if(_0x9006ab[_0x760d('0x6b')]===_0x760d('0x6c')){_0x393051[_0x39521a](_0x760d('0x77'),'%'+_0x9006ab[_0x760d('0x6d')]+'%',null);}else{_0x11b977=_[_0x760d('0x67')](_0x5bb5d2,['name',_0x760d('0x3e')]);_0x9006ab[_0x760d('0x52')]=_0x760d('0x3e');_0x1ebf09=as[_0x760d('0x72')](_0x416467,_0x11b977[_0x760d('0x44')],_0x9006ab);_0x393051[_0x39521a](_0x1ebf09[_0x760d('0x73')],_0x1ebf09[_0x760d('0x6d')][_0x760d('0x74')],_0x1ebf09['value'][_0x760d('0x22')]);}break;case _0x760d('0x78'):_0x1ebf09=as[_0x760d('0x72')]('me',null,_0x9006ab);_0x393051[_0x39521a](_0x1ebf09[_0x760d('0x73')],_0x1ebf09[_0x760d('0x6d')][_0x760d('0x74')],_0x1ebf09[_0x760d('0x6d')][_0x760d('0x22')]);break;}}else{var _0x1ebf09=as[_0x760d('0x72')](_0x416467,_0x11b977[_0x760d('0x44')],_0x9006ab);_0x393051[_0x39521a](_0x1ebf09[_0x760d('0x73')],_0x1ebf09['value'][_0x760d('0x74')],_0x1ebf09[_0x760d('0x6d')][_0x760d('0x22')]);}}}else{var _0x38607e=_(_0x2d371e[_0x760d('0x47')])[_0x760d('0x79')]()[_0x760d('0x33')](function(_0x593744){return _[_0x760d('0x7a')](_0x5bb5d2,[_0x760d('0x30'),_0x593744])?_0x593744:undefined;})[_0x760d('0x7b')]()['value']();if(!_['isEmpty'](_0x38607e)){_0x38607e[_0x760d('0x38')](function(_0x46807c){if(_0x46807c===_0x760d('0x7c')){_0x51503d[_0x760d('0x4f')]('i.FaxAccountId\x20IN\x20?',[][_0x760d('0x7d')](_0x2d371e[_0x760d('0x47')][_0x46807c]));}else if(_0x46807c===_0x760d('0x7e')){var _0x4065b5=JSON[_0x760d('0x7f')](_0x2d371e[_0x760d('0x47')][_0x46807c])[_0x760d('0x80')];var _0x20f370=JSON[_0x760d('0x7f')](_0x2d371e[_0x760d('0x47')][_0x46807c])['$lte'];_0x51503d[_0x760d('0x4f')](_0x760d('0x81'),_0x4065b5,_0x20f370);}else{if(_0x2d371e[_0x760d('0x47')][_0x46807c]==='null'){_0x51503d[_0x760d('0x4f')]('i.'+_0x46807c+_0x760d('0x82'));}else{_0x51503d[_0x760d('0x4f')]('i.'+_0x46807c+_0x760d('0x83'),_0x2d371e[_0x760d('0x47')][_0x46807c]);}}});}if(_0x2d371e[_0x760d('0x47')][_0x760d('0x84')]){if(_0x2d371e['query'][_0x760d('0x84')]==0x1){_0x51503d[_0x760d('0x69')](_0x760d('0x85'));}else{_0x51503d['having'](_0x760d('0x86'));}}if(_0x2d371e[_0x760d('0x47')]['tag']){_0x37d83f=_['isArray'](_0x2d371e[_0x760d('0x47')]['tag'])?_0x2d371e[_0x760d('0x47')][_0x760d('0x87')]:new Array(_0x2d371e[_0x760d('0x47')][_0x760d('0x87')]);_0x37d83f[_0x760d('0x38')](function(_0x490a23){_0x148d1c['or'](_0x760d('0x75'),'%,'+_0x490a23+',%');});}if(_0x2d371e[_0x760d('0x47')][_0x760d('0x88')]){var _0x4ea74a=_0x2d371e['query'][_0x760d('0x88')][_0x760d('0x89')]('\x5c','\x5c\x5c')[_0x760d('0x89')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4ea74a)){_0x393051['or'](_0x760d('0x8a'),_0x4ea74a+'%')['or']('i.fax\x20LIKE\x20?',_0x4ea74a+'%');}_0x393051['or'](_0x760d('0x8b'),_0x4ea74a+'%');}}_0x51503d[_0x760d('0x4f')](_0x393051);_0x51503d[_0x760d('0x8c')](_0x760d('0x8d'));var _0xfe6d0c={'type':db[_0x760d('0x8e')][_0x760d('0x8f')][_0x760d('0x90')],'raw':!![]};var _0x2d6d18=_0x51503d[_0x760d('0x91')]();_0x2d6d18[_0x760d('0x52')](_0x760d('0x8d'));_0x2d6d18['field'](_0x760d('0x92'),_0x760d('0x68'));if(_0x506eba[_0x760d('0x4d')]){_0x506eba['order']['forEach'](function(_0x3c82db){var _0x17799d=_0x3c82db[0x0]===_0x760d('0x93')?_0x3c82db[0x0]:'i.'+_0x3c82db[0x0];_0x51503d[_0x760d('0x4d')](_0x17799d,_0x3c82db[0x1]===_0x760d('0x94')?![]:!![]);});}if(!_[_0x760d('0x95')](_0x37d83f)){_0x51503d[_0x760d('0x69')](_0x148d1c);_0x2d6d18[_0x760d('0x4f')]('t.id\x20IN\x20?',_0x37d83f);}BPromise[_0x760d('0x96')]()[_0x760d('0x2e')](function(){if(!_0x35198e){if(_0x2d371e['query'][_0x760d('0x7c')])return;_0x2d6d18[_0x760d('0x4f')](_0x760d('0x97'));_0x51503d[_0x760d('0x4f')](_0x760d('0x97'));return;}if(_0x2d371e[_0x760d('0x98')][_0x760d('0x99')]!=='agent')return;return _0x2d371e[_0x760d('0x98')][_0x760d('0x9a')]({'attributes':['id'],'raw':!![]})[_0x760d('0x2e')](function(_0x3e1f39){if(_[_0x760d('0x95')](_0x3e1f39)){_0x2d6d18[_0x760d('0x4f')](_0x760d('0x9b'));_0x51503d[_0x760d('0x4f')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x2d6d18[_0x760d('0x4f')](_0x760d('0x9c'),_['map'](_0x3e1f39,'id'));_0x51503d[_0x760d('0x4f')]('i.FaxAccountId\x20IN\x20?',_[_0x760d('0x33')](_0x3e1f39,'id'));}});})[_0x760d('0x2e')](function(){if(_0x2d371e[_0x760d('0x98')][_0x760d('0x99')]===_0x760d('0x9d')&&!_0x35198e&&!_0x2d371e['query'][_0x760d('0x7c')])return[];return db[_0x760d('0x9e')][_0x760d('0x47')](_0x2d6d18[_0x760d('0x9f')](),_0xfe6d0c);})[_0x760d('0x2e')](function(_0xe9e0c){_0x570e46[_0x760d('0x27')]=_0xe9e0c['length'];if(_0x570e46[_0x760d('0x27')]===0x0)return[];return db[_0x760d('0x9e')]['query'](_0x403ad2['toString'](),_0xfe6d0c)[_0x760d('0x2e')](function(_0x50de78){_0x456686=_['keyBy'](_0x50de78,'id');_0xfe6d0c=_[_0x760d('0xa0')](_0xfe6d0c,{'model':db[_0x760d('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d371e[_0x760d('0x47')][_0x760d('0x4b')]){_0x506eba[_0x760d('0x4a')][_0x760d('0x38')](function(_0x30f7ef){_0x51503d[_0x760d('0x52')]('i.'+_0x30f7ef);});}else{_0x51503d['field'](_0x760d('0x92'),_0x760d('0x68'));_0x51503d[_0x760d('0x52')]('a.key',_0x760d('0xa2'));_0x51503d[_0x760d('0x52')](_0x760d('0xa3'),_0x760d('0xa4'));_0x51503d['field'](_0x760d('0xa5'),'contactName');_0x51503d[_0x760d('0x52')](_0x760d('0xa6'));_0x51503d[_0x760d('0x52')](_0x760d('0xa7'),'Contact.firstName');_0x51503d['field']('c.lastName',_0x760d('0xa8'));_0x51503d[_0x760d('0x52')]('c.email',_0x760d('0xa9'));_0x51503d['field']('c.phone',_0x760d('0xaa'));_0x51503d[_0x760d('0x52')](_0x760d('0xab'),_0x760d('0xac'));_0x51503d[_0x760d('0x52')](_0x760d('0xad'),_0x760d('0xae'));_0x51503d[_0x760d('0x52')](_0x760d('0xaf'),_0x760d('0xb0'));_0x51503d[_0x760d('0x52')]('o.internal',_0x760d('0xb1'));_0x51503d[_0x760d('0x52')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x760d('0x35'));}if(_0x506eba[_0x760d('0x25')])_0x51503d[_0x760d('0x25')](_0x506eba[_0x760d('0x25')]);if(_0x506eba['offset'])_0x51503d[_0x760d('0x24')](_0x506eba[_0x760d('0x24')]);return db[_0x760d('0x9e')][_0x760d('0x47')](_0x51503d[_0x760d('0x9f')](),_0xfe6d0c);})[_0x760d('0x2e')](function(_0x243bad){if(_0x243bad['length']>0x0)_0x2125d7[_0x760d('0x4f')](_0x760d('0xb2'),_['map'](_0x243bad,'id'));return db[_0x760d('0x9e')]['query'](_0x2125d7[_0x760d('0x9f')](),_0xfe6d0c)['then'](function(_0x58a70a){var _0x3d9571=_[_0x760d('0xb3')](_0x58a70a,_0x760d('0xb4'));var _0x55e5fa=[];_0x243bad['forEach'](function(_0x6cc604){_0x55e5fa[_0x760d('0x39')](updateFaxInteraction(_0x6cc604,_0x456686,_0x3d9571));});return BPromise[_0x760d('0xb5')](_0x55e5fa);});});})[_0x760d('0x2e')](function(_0x20a8a7){_0x570e46['rows']=_0x20a8a7;return _0x570e46;})['then'](respondWithFilteredResult(_0x8f39c4,_0x506eba))['catch'](handleError(_0x8f39c4,null));};exports['show']=function(_0x1c03bb,_0x2c2f04){var _0x912caf={'raw':![],'where':{'id':_0x1c03bb[_0x760d('0xb6')]['id']}},_0x5333d3={};_0x5333d3['model']=_[_0x760d('0x79')](db[_0x760d('0xa1')][_0x760d('0xb7')]);_0x5333d3[_0x760d('0x47')]=_[_0x760d('0x79')](_0x1c03bb[_0x760d('0x47')]);_0x5333d3[_0x760d('0x48')]=_['intersection'](_0x5333d3[_0x760d('0x46')],_0x5333d3[_0x760d('0x47')]);_0x912caf[_0x760d('0x4a')]=_[_0x760d('0x49')](_0x5333d3[_0x760d('0x46')],qs[_0x760d('0x4b')](_0x1c03bb[_0x760d('0x47')][_0x760d('0x4b')]));_0x912caf[_0x760d('0x4a')]=_0x912caf[_0x760d('0x4a')][_0x760d('0x6e')]?_0x912caf['attributes']:_0x5333d3[_0x760d('0x46')];if(_0x1c03bb['query'][_0x760d('0xb8')]){_0x912caf[_0x760d('0xb9')]=[{'all':!![]}];}_0x912caf=_[_0x760d('0xa0')]({},_0x912caf,_0x1c03bb['options']);return db['FaxInteraction'][_0x760d('0x67')](_0x912caf)[_0x760d('0x2e')](handleEntityNotFound(_0x2c2f04,null))[_0x760d('0x2e')](respondWithResult(_0x2c2f04,null))[_0x760d('0x3a')](handleError(_0x2c2f04,null));};exports[_0x760d('0xba')]=function(_0x565a22,_0x5c1771){return db['FaxInteraction'][_0x760d('0xba')](_0x565a22[_0x760d('0x78')],{})[_0x760d('0x2e')](respondWithResult(_0x5c1771,0xc9))['catch'](handleError(_0x5c1771,null));};exports[_0x760d('0x2d')]=function(_0x10ea7e,_0x4b12e5){if(_0x10ea7e[_0x760d('0x78')]['id']){delete _0x10ea7e['body']['id'];}return db[_0x760d('0xa1')][_0x760d('0x67')]({'where':{'id':_0x10ea7e[_0x760d('0xb6')]['id']}})['then'](handleEntityNotFound(_0x4b12e5,null))[_0x760d('0x2e')](saveUpdates(_0x10ea7e[_0x760d('0x78')],null))[_0x760d('0x2e')](respondWithResult(_0x4b12e5,null))[_0x760d('0x3a')](handleError(_0x4b12e5,null));};exports[_0x760d('0xbb')]=function(_0x5f4a01,_0x218402){return db[_0x760d('0xa1')]['find']({'where':{'id':_0x5f4a01[_0x760d('0xb6')]['id']}})[_0x760d('0x2e')](handleEntityNotFound(_0x218402,null))[_0x760d('0x2e')](removeEntity(_0x218402,null))[_0x760d('0x3a')](handleError(_0x218402,null));};exports[_0x760d('0xbc')]=function(_0x2a9e14,_0x3c40ec){return db[_0x760d('0xa1')][_0x760d('0xbc')]()['then'](respondWithResult(_0x3c40ec,null))[_0x760d('0x3a')](handleError(_0x3c40ec,null));};exports['addMessage']=function(_0x28ba22,_0x18bc2d,_0x4fcfec){return db[_0x760d('0xbd')]['find']({'where':{'id':_0x28ba22['params']['id']}})[_0x760d('0x2e')](handleEntityNotFound(_0x18bc2d,null))[_0x760d('0x2e')](function(_0x5b389e){if(_0x5b389e){return _0x5b389e[_0x760d('0xbe')](_0x28ba22['body'][_0x760d('0xbf')],_['omit'](_0x28ba22[_0x760d('0x78')],[_0x760d('0xbf'),'id'])||{});}})[_0x760d('0x2e')](respondWithResult(_0x18bc2d,null))[_0x760d('0x3a')](handleError(_0x18bc2d,null));};exports[_0x760d('0xc0')]=function(_0x480016,_0xf04880,_0x3c9f98){var _0x1b06aa={'raw':![],'where':{}};var _0x3ebe9e={};var _0x35b5b4={'count':0x0,'rows':[]};return db[_0x760d('0xa1')]['findOne']({'where':{'id':_0x480016[_0x760d('0xb6')]['id']}})[_0x760d('0x2e')](handleEntityNotFound(_0xf04880,null))[_0x760d('0x2e')](function(_0x1b89b9){if(_0x1b89b9){_0x3ebe9e['model']=_['keys'](db[_0x760d('0xbd')]['rawAttributes']);_0x3ebe9e[_0x760d('0x47')]=_[_0x760d('0x79')](_0x480016[_0x760d('0x47')]);_0x3ebe9e[_0x760d('0x48')]=_[_0x760d('0x49')](_0x3ebe9e['model'],_0x3ebe9e['query']);_0x1b06aa['attributes']=_[_0x760d('0x49')](_0x3ebe9e['model'],qs[_0x760d('0x4b')](_0x480016[_0x760d('0x47')]['fields']));_0x1b06aa[_0x760d('0x4a')]=_0x1b06aa['attributes'][_0x760d('0x6e')]?_0x1b06aa['attributes']:_0x3ebe9e[_0x760d('0x46')];if(!_0x480016[_0x760d('0x47')][_0x760d('0x4c')](_0x760d('0xc1'))){_0x1b06aa[_0x760d('0x25')]=qs[_0x760d('0x25')](_0x480016[_0x760d('0x47')]['limit']);_0x1b06aa[_0x760d('0x24')]=qs[_0x760d('0x24')](_0x480016[_0x760d('0x47')][_0x760d('0x24')]);}_0x1b06aa[_0x760d('0x4d')]=qs['sort'](_0x480016['query']['sort']);_0x1b06aa['where']=qs[_0x760d('0x48')](_[_0x760d('0x50')](_0x480016['query'],_0x3ebe9e[_0x760d('0x48')]));_0x1b06aa[_0x760d('0x4f')][_0x760d('0xb4')]=_0x1b89b9['id'];if(_0x480016[_0x760d('0x47')][_0x760d('0x88')]){_0x1b06aa[_0x760d('0x4f')]=_[_0x760d('0xa0')](_0x1b06aa[_0x760d('0x4f')],{'$or':_['map'](_0x1b06aa[_0x760d('0x4a')],function(_0x3d78c9){var _0x422b04={};_0x422b04[_0x3d78c9]={'$like':'%'+_0x480016[_0x760d('0x47')]['filter']+'%'};return _0x422b04;})});}if(_0x480016[_0x760d('0x47')][_0x760d('0x80')]){var _0xb75d7b=_0x480016[_0x760d('0x47')][_0x760d('0x80')][_0x760d('0x37')](',');var _0x2dd136={};_0x2dd136[_0xb75d7b[0x0]]={'$gte':moment(_0xb75d7b[0x1])[_0x760d('0xc2')](_0x760d('0xc3'))};_0x1b06aa['where']=_[_0x760d('0xa0')](_0x1b06aa[_0x760d('0x4f')],_0x2dd136);}_0x1b06aa=_[_0x760d('0xa0')]({},_0x1b06aa,_0x480016[_0x760d('0xc4')]);return db['FaxMessage'][_0x760d('0x27')]({'where':_0x1b06aa[_0x760d('0x4f')]})['then'](function(_0x3be18e){_0x35b5b4[_0x760d('0x27')]=_0x3be18e;if(_0x480016['query'][_0x760d('0xb8')]){_0x1b06aa['include']=[{'all':!![]}];}return db[_0x760d('0xbd')]['findAll'](_0x1b06aa);})[_0x760d('0x2e')](function(_0xa50413){_0x35b5b4[_0x760d('0xc5')]=_0xa50413;return _0x35b5b4;});}})[_0x760d('0x2e')](respondWithFilteredResult(_0xf04880,_0x1b06aa))[_0x760d('0x3a')](handleError(_0xf04880,null));};exports[_0x760d('0xc6')]=function(_0x8a29bb,_0x5bfc24,_0x14b0cb){return db[_0x760d('0xa1')][_0x760d('0x67')]({'where':{'id':_0x8a29bb[_0x760d('0xb6')]['id']}})[_0x760d('0x2e')](handleEntityNotFound(_0x5bfc24,null))[_0x760d('0x2e')](function(_0x4dc3bd){if(_0x4dc3bd){return _0x4dc3bd['setTags'](_0x8a29bb[_0x760d('0x78')]['ids'],_[_0x760d('0xc7')](_0x8a29bb[_0x760d('0x78')],[_0x760d('0xbf'),'id'])||{})[_0x760d('0xc8')](function(){return db[_0x760d('0xc9')]['findAll']({'attributes':['id',_0x760d('0x30'),'color'],'where':{'id':_0x8a29bb['body'][_0x760d('0xbf')]}});})[_0x760d('0x2e')](function(_0x398df9){socket[_0x760d('0xca')]('faxInteractionTags:save',{'id':Number(_0x8a29bb[_0x760d('0xb6')]['id']),'tags':_0x398df9||[]});return{'id':Number(_0x8a29bb[_0x760d('0xb6')]['id']),'tags':_0x398df9||[]};});}})[_0x760d('0x2e')](respondWithResult(_0x5bfc24,null))[_0x760d('0x3a')](handleError(_0x5bfc24,null));};exports[_0x760d('0xcb')]=function(_0x1c0e46,_0x6f2dfb,_0x446c8d){return db[_0x760d('0xa1')][_0x760d('0x67')]({'where':{'id':_0x1c0e46[_0x760d('0xb6')]['id']}})[_0x760d('0x2e')](handleEntityNotFound(_0x6f2dfb,null))['then'](function(_0x58a47d){if(_0x58a47d){return _0x58a47d[_0x760d('0xcb')](_0x1c0e46['query']['ids']);}})[_0x760d('0x2e')](respondWithStatusCode(_0x6f2dfb,null))[_0x760d('0x3a')](handleError(_0x6f2dfb,null));};exports[_0x760d('0xcc')]=function(_0x93131f,_0x470ea6){var _0xe7d0e1=moment()[_0x760d('0xcd')]()[_0x760d('0x9f')]();var _0x4f337d=path[_0x760d('0xce')](config[_0x760d('0xcf')],_0x760d('0xd0'),_0x760d('0xd1'),_0x760d('0xd2'));var _0x4a31c7=path[_0x760d('0xce')](config[_0x760d('0xcf')],_0x760d('0xd0'),'files',_0x760d('0xd3'));var _0x981bbe=path[_0x760d('0xce')](_0x4f337d,_0xe7d0e1);var _0x1f65d7=util['format'](_0x760d('0xd4'),_0x93131f[_0x760d('0xb6')]['id'],_0xe7d0e1);var _0x490bc9=path[_0x760d('0xce')](_0x4f337d,_0x1f65d7);var _0x1d8aa4=[];_0x1d8aa4[_0x760d('0x39')]({'model':db[_0x760d('0xd5')],'as':_0x760d('0xd5'),'raw':!![]});var _0x45cafa=[{'model':db[_0x760d('0xbd')],'as':_0x760d('0xd6'),'attributes':['id',_0x760d('0x78'),_0x760d('0x7e')],'include':_0x1d8aa4}];return db[_0x760d('0xa1')][_0x760d('0x67')]({'where':{'id':_0x93131f['params']['id']},'include':_0x45cafa})['then'](handleEntityNotFound(_0x470ea6,null))['then'](function(_0x2d22a9){if(_0x2d22a9&&_0x2d22a9[_0x760d('0xd6')]){var _0x3a8633=_0x2d22a9[_0x760d('0xd7')]({'plain':!![]});fs[_0x760d('0xd8')](_0x981bbe);for(var _0xfd2daa=0x0;_0xfd2daa<_0x3a8633[_0x760d('0xd6')]['length'];_0xfd2daa++){var _0x213aad=_0x3a8633[_0x760d('0xd6')][_0xfd2daa][_0x760d('0xd5')];if(_0x213aad){var _0x50e9a6=path[_0x760d('0xce')](_0x4a31c7,_0x213aad[_0x760d('0xd9')]);if(fs[_0x760d('0xda')](_0x50e9a6)){fs[_0x760d('0xdb')](_0x50e9a6)[_0x760d('0xdc')](fs[_0x760d('0xdd')](path[_0x760d('0xce')](_0x981bbe,_0x213aad[_0x760d('0xd9')])));}}}return BPromise['resolve']()[_0x760d('0x2e')](function(){return new BPromise(function(_0x291556,_0x1d9123){zipdir(_0x981bbe,{'saveTo':_0x490bc9},function(_0x4994e4,_0x1f867f){if(_0x4994e4)return _0x1d9123(_0x4994e4);return _0x291556(_0x1f867f);});})['then'](function(){return new BPromise(function(_0x289b47,_0x489bc0){rimraf(_0x981bbe,function(_0x44f9e9){if(_0x44f9e9)_0x489bc0(_0x44f9e9);return _0x289b47();});});})[_0x760d('0x2e')](function(){return _0x470ea6['download'](_0x490bc9,_0x1f65d7,function(_0x70951){if(_0x70951){console[_0x760d('0xde')](_0x760d('0xdf'),_0x70951);}else{fs[_0x760d('0xe0')](_0x490bc9);}});});});}else{return _0x470ea6[_0x760d('0x20')](0xc8);}})['catch'](handleError(_0x470ea6,null));}; \ No newline at end of file +var _0x3685=['split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','some','compact','FaxAccountId','createdAt','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','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','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','show','params','include','options','create','describe','addMessage','FaxMessage','ids','getMessages','hasOwnProperty','sort','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','emit','faxInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','basename','existsSync','pipe','createWriteStream','download','log','unlinkSync','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','Users','fullname','Tags','TagIds','forEach','catch','answered','unmanaged','total','closed','UserId','waiting','talking','index','map','FaxInteraction','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','nolimit','order','filters','pick','select','field','color','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator'];(function(_0x2dc808,_0x5986e3){var _0x2bbf60=function(_0x4e3a3f){while(--_0x4e3a3f){_0x2dc808['push'](_0x2dc808['shift']());}};_0x2bbf60(++_0x5986e3);}(_0x3685,0x76));var _0x5368=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3685[_0x20a584];return _0x4b41a8;};'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(_0x5368('0x0'));var Mustache=require(_0x5368('0x1'));var util=require(_0x5368('0x2'));var path=require(_0x5368('0x3'));var sox=require(_0x5368('0x4'));var csv=require('to-csv');var ejs=require(_0x5368('0x5'));var fs=require('fs');var fs_extra=require(_0x5368('0x6'));var _=require(_0x5368('0x7'));var squel=require(_0x5368('0x8'));var crypto=require(_0x5368('0x9'));var jsforce=require(_0x5368('0xa'));var deskjs=require(_0x5368('0xb'));var toCsv=require(_0x5368('0xc'));var querystring=require(_0x5368('0xd'));var Papa=require('papaparse');var Redis=require(_0x5368('0xe'));var authService=require(_0x5368('0xf'));var qs=require(_0x5368('0x10'));var as=require(_0x5368('0x11'));var hardwareService=require(_0x5368('0x12'));var logger=require(_0x5368('0x13'))('api');var utils=require(_0x5368('0x14'));var config=require(_0x5368('0x15'));var licenseUtil=require(_0x5368('0x16'));var db=require('../../mysqldb')['db'];config[_0x5368('0x17')]=_[_0x5368('0x18')](config[_0x5368('0x17')],{'host':_0x5368('0x19'),'port':0x18eb});var socket=require(_0x5368('0x1a'))(new Redis(config[_0x5368('0x17')]));require('./faxInteraction.socket')[_0x5368('0x1b')](socket);function respondWithStatusCode(_0x49bf58,_0x5c3051){_0x5c3051=_0x5c3051||0xcc;return function(_0x599059){if(_0x599059){return _0x49bf58[_0x5368('0x1c')](_0x5c3051);}return _0x49bf58[_0x5368('0x1d')](_0x5c3051)[_0x5368('0x1e')]();};}function respondWithResult(_0x3ba671,_0xd86e7b){_0xd86e7b=_0xd86e7b||0xc8;return function(_0x11aec6){if(_0x11aec6){return _0x3ba671[_0x5368('0x1d')](_0xd86e7b)[_0x5368('0x1f')](_0x11aec6);}};}function respondWithFilteredResult(_0x543e4e,_0x2b7591){return function(_0xdc231e){if(_0xdc231e){var _0x1c5a7c=typeof _0x2b7591[_0x5368('0x20')]===_0x5368('0x21')&&typeof _0x2b7591['limit']===_0x5368('0x21');var _0x33127b=_0xdc231e['count'];var _0x5accc6=_0x1c5a7c?0x0:_0x2b7591['offset'];var _0x39a62c=_0x1c5a7c?_0xdc231e[_0x5368('0x22')]:_0x2b7591[_0x5368('0x20')]+_0x2b7591[_0x5368('0x23')];var _0x25a1e0;if(_0x39a62c>=_0x33127b){_0x39a62c=_0x33127b;_0x25a1e0=0xc8;}else{_0x25a1e0=0xce;}_0x543e4e[_0x5368('0x1d')](_0x25a1e0);return _0x543e4e[_0x5368('0x24')](_0x5368('0x25'),_0x5accc6+'-'+_0x39a62c+'/'+_0x33127b)[_0x5368('0x1f')](_0xdc231e);}return null;};}function patchUpdates(_0xc347c0){return function(_0x10865b){try{jsonpatch[_0x5368('0x26')](_0x10865b,_0xc347c0,!![]);}catch(_0x2d1983){return BPromise[_0x5368('0x27')](_0x2d1983);}return _0x10865b[_0x5368('0x28')]();};}function saveUpdates(_0x226d14,_0x294013){return function(_0x5d70be){if(_0x5d70be){return _0x5d70be[_0x5368('0x29')](_0x226d14)['then'](function(_0x45aab6){return _0x45aab6;});}return null;};}function removeEntity(_0x36572c,_0x50a065){return function(_0x8b9a6e){if(_0x8b9a6e){return _0x8b9a6e[_0x5368('0x2a')]()[_0x5368('0x2b')](function(){_0x36572c[_0x5368('0x1d')](0xcc)[_0x5368('0x1e')]();});}};}function handleEntityNotFound(_0xc245b9,_0x58c9e8){return function(_0x25981d){if(!_0x25981d){_0xc245b9[_0x5368('0x1c')](0x194);}return _0x25981d;};}function handleError(_0x4fb645,_0x3bb9dc){_0x3bb9dc=_0x3bb9dc||0x1f4;return function(_0x1e7e14){logger[_0x5368('0x2c')](_0x1e7e14[_0x5368('0x2d')]);if(_0x1e7e14[_0x5368('0x2e')]){delete _0x1e7e14[_0x5368('0x2e')];}_0x4fb645[_0x5368('0x1d')](_0x3bb9dc)[_0x5368('0x2f')](_0x1e7e14);};}function getInteractionUsers(_0x2052df,_0x12b752){return new BPromise(function(_0x111ca9,_0x28c556){try{if(_0x12b752[_0x2052df['id']]){_0x2052df[_0x5368('0x30')]=_['map'](_0x12b752[_0x2052df['id']],function(_0x4e7dab){return{'id':_0x4e7dab['id'],'fullname':_0x4e7dab[_0x5368('0x31')]};});}}catch(_0x2fee8b){_0x28c556(_0x2fee8b);}_0x111ca9(_0x2052df);});}function getInteractionTags(_0x28f7f4,_0x310ba3){return new BPromise(function(_0x28e963,_0x32d655){try{if(_0x28f7f4['TagIds']){_0x28f7f4[_0x5368('0x32')]=[];_0x28f7f4[_0x5368('0x33')]['split'](',')[_0x5368('0x34')](function(_0x465e22){_0x28f7f4[_0x5368('0x32')]['push'](_0x310ba3[_0x465e22]);});}delete _0x28f7f4[_0x5368('0x33')];}catch(_0x3f9555){_0x32d655(_0x3f9555);}_0x28e963(_0x28f7f4);});}function updateFaxInteraction(_0x428651,_0x1ce851,_0x7ea3f){return new BPromise(function(_0x3964fc,_0xa4078b){return getInteractionUsers(_0x428651,_0x7ea3f)[_0x5368('0x2b')](function(_0x406f6c){return getInteractionTags(_0x406f6c,_0x1ce851);})[_0x5368('0x2b')](function(_0x48a344){return getStateInteraction(_0x48a344);})[_0x5368('0x2b')](function(_0x4270b4){_0x3964fc(_0x4270b4);})[_0x5368('0x35')](function(_0x17a052){_0xa4078b(_0x17a052);});});}function getStateInteraction(_0x5aad65){return new BPromise(function(_0x2e41d8){_0x5aad65['waiting']=0x0;_0x5aad65['talking']=0x0;_0x5aad65[_0x5368('0x36')]=0x0;_0x5aad65[_0x5368('0x37')]=0x0;_0x5aad65[_0x5368('0x38')]=0x0;if(!_0x5aad65[_0x5368('0x39')]&&!_0x5aad65[_0x5368('0x3a')]){_0x5aad65[_0x5368('0x3b')]+=0x1;}if(!_0x5aad65[_0x5368('0x39')]&&_0x5aad65[_0x5368('0x3a')]){_0x5aad65['talking']+=0x1;if(_0x5aad65['waiting']){_0x5aad65[_0x5368('0x3b')]-=0x1;}}if(_0x5aad65[_0x5368('0x39')]&&_0x5aad65['UserId']){_0x5aad65[_0x5368('0x36')]+=0x1;if(_0x5aad65['talking']){_0x5aad65[_0x5368('0x3c')]-=0x1;}}if(_0x5aad65[_0x5368('0x39')]&&!_0x5aad65['UserId']){_0x5aad65[_0x5368('0x37')]+=0x1;if(_0x5aad65['waiting']){_0x5aad65['waiting']-=0x1;}}_0x5aad65['total']+=0x1;_0x2e41d8(_0x5aad65);});}exports[_0x5368('0x3d')]=function(_0x25e3de,_0x3b6de1){var _0x2408d5={},_0x3f487d={},_0x537ad3={'count':0x0,'rows':[]};var _0x3f0911=_[_0x5368('0x3e')](db[_0x5368('0x3f')][_0x5368('0x40')],function(_0x50253c){return{'name':_0x50253c['fieldName'],'type':_0x50253c[_0x5368('0x41')][_0x5368('0x42')]};});_0x3f487d[_0x5368('0x43')]=_[_0x5368('0x3e')](_0x3f0911,'name');_0x3f487d['query']=_[_0x5368('0x44')](_0x25e3de[_0x5368('0x45')]);_0x3f487d['filters']=_[_0x5368('0x46')](_0x3f487d[_0x5368('0x43')],_0x3f487d[_0x5368('0x45')]);_0x2408d5['attributes']=_[_0x5368('0x46')](_0x3f487d['model'],qs[_0x5368('0x47')](_0x25e3de['query'][_0x5368('0x47')]));_0x2408d5[_0x5368('0x48')]=_0x2408d5[_0x5368('0x48')]['length']?_0x2408d5['attributes']:_0x3f487d['model'];if(!_0x25e3de['query']['hasOwnProperty'](_0x5368('0x49'))){_0x2408d5[_0x5368('0x23')]=qs[_0x5368('0x23')](_0x25e3de[_0x5368('0x45')][_0x5368('0x23')]);_0x2408d5[_0x5368('0x20')]=qs[_0x5368('0x20')](_0x25e3de['query'][_0x5368('0x20')]);}_0x2408d5[_0x5368('0x4a')]=qs['sort'](_0x25e3de[_0x5368('0x45')]['sort']);_0x2408d5['where']=qs[_0x5368('0x4b')](_[_0x5368('0x4c')](_0x25e3de[_0x5368('0x45')],_0x3f487d[_0x5368('0x4b')]),_0x3f0911);var _0x31c3a1=[];var _0x513f37=squel[_0x5368('0x4d')]()[_0x5368('0x4e')]('id')[_0x5368('0x4e')]('name')[_0x5368('0x4e')](_0x5368('0x4f'))['from'](_0x5368('0x50'));var _0x3b1ea3=squel['select']()[_0x5368('0x4e')](_0x5368('0x51'))[_0x5368('0x4e')](_0x5368('0x52'))['field'](_0x5368('0x53'))[_0x5368('0x54')](_0x5368('0x55'),'ui')[_0x5368('0x56')](_0x5368('0x57'),'u',_0x5368('0x58'));var _0xde316f=squel[_0x5368('0x4d')]()[_0x5368('0x54')](_0x5368('0x59'),'i')[_0x5368('0x56')](_0x5368('0x5a'),'c',_0x5368('0x5b'))['left_join'](_0x5368('0x57'),'o',_0x5368('0x5c'))[_0x5368('0x56')](_0x5368('0x5d'),'a',_0x5368('0x5e'))['left_join'](_0x5368('0x5f'),'me',_0x5368('0x60'))[_0x5368('0x56')](_0x5368('0x61'),'it',_0x5368('0x62'))[_0x5368('0x56')](_0x5368('0x50'),'t',_0x5368('0x63'));var _0x4de73b=squel[_0x5368('0x64')]();var _0x349375=[];var _0x2b5efe=squel[_0x5368('0x64')]();var _0x2b4451;if(_0x25e3de['query'][_0x5368('0x65')]){_0x2b4451=as[_0x5368('0x66')](_0x25e3de[_0x5368('0x45')][_0x5368('0x65')]);var _0x1c3dd0=_0x2b4451[_0x5368('0x67')];for(var _0x41a654=0x0;_0x41a654<_0x2b4451['conditions'][_0x5368('0x68')];_0x41a654++){var _0x116572=_0x2b4451[_0x5368('0x69')][_0x41a654];var _0x12b375='i';var _0xd48ae=_[_0x5368('0x6a')](_0x3f0911,[_0x5368('0x2e'),_0x116572['field']]);if(!_0xd48ae){switch(_0x116572[_0x5368('0x4e')]){case _0x5368('0x6b'):if(_0x116572[_0x5368('0x6c')]==0x1){_0xde316f['having']('`'+_0x116572[_0x5368('0x4e')]+'`\x20=\x200');}else{_0xde316f[_0x5368('0x6d')]('`'+_0x116572[_0x5368('0x4e')]+_0x5368('0x6e'));}break;case _0x5368('0x6f'):if(_0x116572[_0x5368('0x70')]==='$substring'){if(_0x116572[_0x5368('0x6c')][_0x5368('0x71')]('\x20')[_0x5368('0x68')]>0x1){_0x4de73b[_0x1c3dd0](_0x5368('0x72'),qs[_0x5368('0x73')](_0x116572[_0x5368('0x6c')]),null);}else{var _0xc77b37='%'+_0x116572[_0x5368('0x6c')]+'%';_0x4de73b[_0x1c3dd0](_0x5368('0x74'),_0xc77b37,_0xc77b37,_0xc77b37);}}else{_0xd48ae=_[_0x5368('0x6a')](_0x3f0911,[_0x5368('0x2e'),'ContactId']);_0x116572['field']=_0x5368('0x75');_0x488af4=as[_0x5368('0x76')](_0x12b375,_0xd48ae['type'],_0x116572);_0x4de73b[_0x1c3dd0](_0x488af4['text'],_0x488af4[_0x5368('0x6c')][_0x5368('0x77')],_0x488af4[_0x5368('0x6c')][_0x5368('0x1e')]);}break;case _0x5368('0x78'):var _0x1824b2=_0x116572['value'][_0x5368('0x71')](',')['map'](function(_0x361b11){return Number(_0x361b11);});_0x1824b2[_0x5368('0x34')](function(_0x487a66){_0x2b5efe['or'](_0x5368('0x79'),'%,'+_0x487a66+',%');});_0x349375=_[_0x5368('0x7a')](_0x349375,_0x1824b2);break;case'User':if(_0x116572['operator']===_0x5368('0x7b')){_0x4de73b[_0x1c3dd0](_0x5368('0x7c'),'%'+_0x116572[_0x5368('0x6c')]+'%',null);}else{_0xd48ae=_[_0x5368('0x6a')](_0x3f0911,[_0x5368('0x2e'),_0x5368('0x3a')]);_0x116572[_0x5368('0x4e')]=_0x5368('0x3a');_0x488af4=as[_0x5368('0x76')](_0x12b375,_0xd48ae[_0x5368('0x41')],_0x116572);_0x4de73b[_0x1c3dd0](_0x488af4[_0x5368('0x7d')],_0x488af4[_0x5368('0x6c')]['start'],_0x488af4[_0x5368('0x6c')][_0x5368('0x1e')]);}break;case _0x5368('0x7e'):_0x488af4=as['buildExpression']('me',null,_0x116572);_0x4de73b[_0x1c3dd0](_0x488af4[_0x5368('0x7d')],_0x488af4[_0x5368('0x6c')][_0x5368('0x77')],_0x488af4[_0x5368('0x6c')][_0x5368('0x1e')]);break;}}else{var _0x488af4=as['buildExpression'](_0x12b375,_0xd48ae['type'],_0x116572);_0x4de73b[_0x1c3dd0](_0x488af4[_0x5368('0x7d')],_0x488af4['value'][_0x5368('0x77')],_0x488af4[_0x5368('0x6c')][_0x5368('0x1e')]);}}}else{var _0x447442=_(_0x25e3de[_0x5368('0x45')])[_0x5368('0x44')]()['map'](function(_0x49a37f){return _[_0x5368('0x7f')](_0x3f0911,[_0x5368('0x2e'),_0x49a37f])?_0x49a37f:undefined;})[_0x5368('0x80')]()[_0x5368('0x6c')]();if(!_['isEmpty'](_0x447442)){_0x447442['forEach'](function(_0x5610e0){if(_0x5610e0===_0x5368('0x81')){_0xde316f['where']('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x25e3de[_0x5368('0x45')][_0x5610e0]));}else if(_0x5610e0===_0x5368('0x82')){var _0x37fb82=JSON[_0x5368('0x83')](_0x25e3de['query'][_0x5610e0])[_0x5368('0x84')];var _0x1c229b=JSON['parse'](_0x25e3de[_0x5368('0x45')][_0x5610e0])[_0x5368('0x85')];_0xde316f[_0x5368('0x86')](_0x5368('0x87'),_0x37fb82,_0x1c229b);}else{if(_0x25e3de[_0x5368('0x45')][_0x5610e0]===_0x5368('0x88')){_0xde316f['where']('i.'+_0x5610e0+'\x20IS\x20NULL');}else{_0xde316f[_0x5368('0x86')]('i.'+_0x5610e0+_0x5368('0x89'),_0x25e3de[_0x5368('0x45')][_0x5610e0]);}}});}if(_0x25e3de['query']['read']){if(_0x25e3de[_0x5368('0x45')]['read']==0x1){_0xde316f[_0x5368('0x6d')](_0x5368('0x8a'));}else{_0xde316f[_0x5368('0x6d')]('`unreadMessages`\x20>\x200');}}if(_0x25e3de[_0x5368('0x45')][_0x5368('0x8b')]){_0x349375=_['isArray'](_0x25e3de[_0x5368('0x45')][_0x5368('0x8b')])?_0x25e3de[_0x5368('0x45')][_0x5368('0x8b')]:new Array(_0x25e3de['query']['tag']);_0x349375['forEach'](function(_0x3e4d35){_0x2b5efe['or'](_0x5368('0x79'),'%,'+_0x3e4d35+',%');});}if(_0x25e3de[_0x5368('0x45')][_0x5368('0x8c')]){var _0x22d942=_0x25e3de[_0x5368('0x45')][_0x5368('0x8c')][_0x5368('0x8d')]('\x5c','\x5c\x5c')[_0x5368('0x8d')](/'/g,'\x27\x27');if(qs[_0x5368('0x8e')](_0x22d942)){_0x4de73b['or']('i.id\x20LIKE\x20?',_0x22d942+'%')['or'](_0x5368('0x8f'),_0x22d942+'%');}_0x4de73b['or'](_0x5368('0x90'),_0x22d942+'%');}}_0xde316f[_0x5368('0x86')](_0x4de73b);_0xde316f[_0x5368('0x91')](_0x5368('0x92'));var _0x29d866={'type':db[_0x5368('0x93')][_0x5368('0x94')][_0x5368('0x95')],'raw':!![]};var _0xb5575c=_0xde316f[_0x5368('0x96')]();_0xb5575c[_0x5368('0x4e')](_0x5368('0x92'));_0xb5575c[_0x5368('0x4e')](_0x5368('0x97'),'unreadMessages');if(_0x2408d5[_0x5368('0x4a')]){_0x2408d5[_0x5368('0x4a')][_0x5368('0x34')](function(_0x5f41e1){var _0xf74799=_0x5f41e1[0x0]===_0x5368('0x98')?_0x5f41e1[0x0]:'i.'+_0x5f41e1[0x0];_0xde316f[_0x5368('0x4a')](_0xf74799,_0x5f41e1[0x1]===_0x5368('0x99')?![]:!![]);});}if(!_[_0x5368('0x9a')](_0x349375)){_0xde316f[_0x5368('0x6d')](_0x2b5efe);_0xb5575c[_0x5368('0x86')](_0x5368('0x9b'),_0x349375);}BPromise[_0x5368('0x9c')]()[_0x5368('0x2b')](function(){if(!_0x2b4451){if(_0x25e3de[_0x5368('0x45')]['FaxAccountId'])return;_0xb5575c['where'](_0x5368('0x9d'));_0xde316f[_0x5368('0x86')](_0x5368('0x9d'));return;}if(_0x25e3de[_0x5368('0x9e')][_0x5368('0x9f')]!==_0x5368('0xa0'))return;return _0x25e3de[_0x5368('0x9e')][_0x5368('0xa1')]({'attributes':['id'],'raw':!![]})[_0x5368('0x2b')](function(_0x3fc79f){if(_[_0x5368('0x9a')](_0x3fc79f)){_0xb5575c[_0x5368('0x86')](_0x5368('0xa2'));_0xde316f['where'](_0x5368('0xa2'));}else{_0xb5575c[_0x5368('0x86')](_0x5368('0xa3'),_[_0x5368('0x3e')](_0x3fc79f,'id'));_0xde316f['where']('i.FaxAccountId\x20IN\x20?',_['map'](_0x3fc79f,'id'));}});})['then'](function(){if(_0x25e3de[_0x5368('0x9e')][_0x5368('0x9f')]===_0x5368('0xa0')&&!_0x2b4451&&!_0x25e3de[_0x5368('0x45')][_0x5368('0x81')])return[];return db[_0x5368('0xa4')][_0x5368('0x45')](_0xb5575c[_0x5368('0xa5')](),_0x29d866);})[_0x5368('0x2b')](function(_0x53a17b){_0x537ad3[_0x5368('0x22')]=_0x53a17b[_0x5368('0x68')];if(_0x537ad3[_0x5368('0x22')]===0x0)return[];return db[_0x5368('0xa4')][_0x5368('0x45')](_0x513f37['toString'](),_0x29d866)[_0x5368('0x2b')](function(_0x36eb3e){_0x31c3a1=_[_0x5368('0xa6')](_0x36eb3e,'id');_0x29d866=_[_0x5368('0xa7')](_0x29d866,{'model':db[_0x5368('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x25e3de[_0x5368('0x45')][_0x5368('0x47')]){_0x2408d5['attributes'][_0x5368('0x34')](function(_0x2b25d2){_0xde316f[_0x5368('0x4e')]('i.'+_0x2b25d2);});}else{_0xde316f[_0x5368('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5368('0x6b'));_0xde316f[_0x5368('0x4e')](_0x5368('0xa8'),_0x5368('0xa9'));_0xde316f[_0x5368('0x4e')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0xde316f[_0x5368('0x4e')]('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',_0x5368('0x98'));_0xde316f[_0x5368('0x4e')](_0x5368('0xaa'));_0xde316f[_0x5368('0x4e')](_0x5368('0xab'),_0x5368('0xac'));_0xde316f[_0x5368('0x4e')](_0x5368('0xad'),_0x5368('0xae'));_0xde316f[_0x5368('0x4e')](_0x5368('0xaf'),_0x5368('0xb0'));_0xde316f[_0x5368('0x4e')](_0x5368('0xb1'),_0x5368('0xb2'));_0xde316f[_0x5368('0x4e')](_0x5368('0xb3'),'Contact.mobile');_0xde316f['field'](_0x5368('0xb4'),_0x5368('0xb5'));_0xde316f[_0x5368('0x4e')]('o.fullname',_0x5368('0xb6'));_0xde316f[_0x5368('0x4e')](_0x5368('0xb7'),'Owner.internal');_0xde316f[_0x5368('0x4e')](_0x5368('0xb8'),_0x5368('0x33'));}if(_0x2408d5[_0x5368('0x23')])_0xde316f[_0x5368('0x23')](_0x2408d5[_0x5368('0x23')]);if(_0x2408d5[_0x5368('0x20')])_0xde316f[_0x5368('0x20')](_0x2408d5[_0x5368('0x20')]);return db['sequelize'][_0x5368('0x45')](_0xde316f[_0x5368('0xa5')](),_0x29d866);})[_0x5368('0x2b')](function(_0x369d0c){if(_0x369d0c['length']>0x0)_0x3b1ea3['where'](_0x5368('0xb9'),_[_0x5368('0x3e')](_0x369d0c,'id'));return db[_0x5368('0xa4')][_0x5368('0x45')](_0x3b1ea3['toString'](),_0x29d866)[_0x5368('0x2b')](function(_0x56f771){var _0x3d46c6=_[_0x5368('0xba')](_0x56f771,_0x5368('0xbb'));var _0x2626f5=[];_0x369d0c['forEach'](function(_0x423d61){_0x2626f5['push'](updateFaxInteraction(_0x423d61,_0x31c3a1,_0x3d46c6));});return BPromise[_0x5368('0xbc')](_0x2626f5);});});})['then'](function(_0x1bf0e9){_0x537ad3['rows']=_0x1bf0e9;return _0x537ad3;})[_0x5368('0x2b')](respondWithFilteredResult(_0x3b6de1,_0x2408d5))[_0x5368('0x35')](handleError(_0x3b6de1,null));};exports[_0x5368('0xbd')]=function(_0x4c9e30,_0x3fc9a0){var _0x469b1f={'raw':![],'where':{'id':_0x4c9e30[_0x5368('0xbe')]['id']}},_0x2360d7={};_0x2360d7[_0x5368('0x43')]=_['keys'](db[_0x5368('0x3f')][_0x5368('0x40')]);_0x2360d7[_0x5368('0x45')]=_[_0x5368('0x44')](_0x4c9e30[_0x5368('0x45')]);_0x2360d7['filters']=_[_0x5368('0x46')](_0x2360d7[_0x5368('0x43')],_0x2360d7[_0x5368('0x45')]);_0x469b1f[_0x5368('0x48')]=_[_0x5368('0x46')](_0x2360d7[_0x5368('0x43')],qs['fields'](_0x4c9e30[_0x5368('0x45')][_0x5368('0x47')]));_0x469b1f[_0x5368('0x48')]=_0x469b1f[_0x5368('0x48')][_0x5368('0x68')]?_0x469b1f[_0x5368('0x48')]:_0x2360d7[_0x5368('0x43')];if(_0x4c9e30[_0x5368('0x45')]['includeAll']){_0x469b1f[_0x5368('0xbf')]=[{'all':!![]}];}_0x469b1f=_['merge']({},_0x469b1f,_0x4c9e30[_0x5368('0xc0')]);return db[_0x5368('0x3f')][_0x5368('0x6a')](_0x469b1f)['then'](handleEntityNotFound(_0x3fc9a0,null))[_0x5368('0x2b')](respondWithResult(_0x3fc9a0,null))[_0x5368('0x35')](handleError(_0x3fc9a0,null));};exports['create']=function(_0x4d7cea,_0x5c5d32){return db[_0x5368('0x3f')][_0x5368('0xc1')](_0x4d7cea[_0x5368('0x7e')],{})[_0x5368('0x2b')](respondWithResult(_0x5c5d32,0xc9))[_0x5368('0x35')](handleError(_0x5c5d32,null));};exports['update']=function(_0xd0827c,_0x283ebf){if(_0xd0827c[_0x5368('0x7e')]['id']){delete _0xd0827c[_0x5368('0x7e')]['id'];}return db[_0x5368('0x3f')][_0x5368('0x6a')]({'where':{'id':_0xd0827c[_0x5368('0xbe')]['id']}})[_0x5368('0x2b')](handleEntityNotFound(_0x283ebf,null))[_0x5368('0x2b')](saveUpdates(_0xd0827c[_0x5368('0x7e')],null))[_0x5368('0x2b')](respondWithResult(_0x283ebf,null))[_0x5368('0x35')](handleError(_0x283ebf,null));};exports[_0x5368('0x2a')]=function(_0x43ed62,_0x205bfe){return db[_0x5368('0x3f')][_0x5368('0x6a')]({'where':{'id':_0x43ed62[_0x5368('0xbe')]['id']}})[_0x5368('0x2b')](handleEntityNotFound(_0x205bfe,null))['then'](removeEntity(_0x205bfe,null))[_0x5368('0x35')](handleError(_0x205bfe,null));};exports['describe']=function(_0x32279e,_0x18d743){return db[_0x5368('0x3f')][_0x5368('0xc2')]()[_0x5368('0x2b')](respondWithResult(_0x18d743,null))['catch'](handleError(_0x18d743,null));};exports[_0x5368('0xc3')]=function(_0x2fbef9,_0x442bea,_0x592392){return db[_0x5368('0xc4')]['find']({'where':{'id':_0x2fbef9[_0x5368('0xbe')]['id']}})['then'](handleEntityNotFound(_0x442bea,null))[_0x5368('0x2b')](function(_0x45c815){if(_0x45c815){return _0x45c815[_0x5368('0xc3')](_0x2fbef9[_0x5368('0x7e')][_0x5368('0xc5')],_['omit'](_0x2fbef9[_0x5368('0x7e')],[_0x5368('0xc5'),'id'])||{});}})[_0x5368('0x2b')](respondWithResult(_0x442bea,null))[_0x5368('0x35')](handleError(_0x442bea,null));};exports[_0x5368('0xc6')]=function(_0x144815,_0x10588e,_0x1401b8){var _0x5c2897={'raw':![],'where':{}};var _0x15d194={};var _0x167bd5={'count':0x0,'rows':[]};return db[_0x5368('0x3f')]['findOne']({'where':{'id':_0x144815[_0x5368('0xbe')]['id']}})[_0x5368('0x2b')](handleEntityNotFound(_0x10588e,null))[_0x5368('0x2b')](function(_0x53fb04){if(_0x53fb04){_0x15d194['model']=_[_0x5368('0x44')](db[_0x5368('0xc4')][_0x5368('0x40')]);_0x15d194[_0x5368('0x45')]=_[_0x5368('0x44')](_0x144815['query']);_0x15d194[_0x5368('0x4b')]=_['intersection'](_0x15d194[_0x5368('0x43')],_0x15d194[_0x5368('0x45')]);_0x5c2897[_0x5368('0x48')]=_[_0x5368('0x46')](_0x15d194['model'],qs[_0x5368('0x47')](_0x144815[_0x5368('0x45')][_0x5368('0x47')]));_0x5c2897[_0x5368('0x48')]=_0x5c2897[_0x5368('0x48')][_0x5368('0x68')]?_0x5c2897[_0x5368('0x48')]:_0x15d194[_0x5368('0x43')];if(!_0x144815[_0x5368('0x45')][_0x5368('0xc7')](_0x5368('0x49'))){_0x5c2897['limit']=qs['limit'](_0x144815[_0x5368('0x45')][_0x5368('0x23')]);_0x5c2897[_0x5368('0x20')]=qs['offset'](_0x144815[_0x5368('0x45')][_0x5368('0x20')]);}_0x5c2897[_0x5368('0x4a')]=qs['sort'](_0x144815[_0x5368('0x45')][_0x5368('0xc8')]);_0x5c2897['where']=qs[_0x5368('0x4b')](_['pick'](_0x144815[_0x5368('0x45')],_0x15d194[_0x5368('0x4b')]));_0x5c2897[_0x5368('0x86')][_0x5368('0xbb')]=_0x53fb04['id'];if(_0x144815['query'][_0x5368('0x8c')]){_0x5c2897[_0x5368('0x86')]=_[_0x5368('0xa7')](_0x5c2897[_0x5368('0x86')],{'$or':_[_0x5368('0x3e')](_0x5c2897['attributes'],function(_0x1c567c){var _0x1af326={};_0x1af326[_0x1c567c]={'$like':'%'+_0x144815[_0x5368('0x45')][_0x5368('0x8c')]+'%'};return _0x1af326;})});}if(_0x144815[_0x5368('0x45')]['$gte']){var _0x1536e3=_0x144815[_0x5368('0x45')]['$gte'][_0x5368('0x71')](',');var _0xa2bdea={};_0xa2bdea[_0x1536e3[0x0]]={'$gte':moment(_0x1536e3[0x1])[_0x5368('0xc9')](_0x5368('0xca'))};_0x5c2897[_0x5368('0x86')]=_[_0x5368('0xa7')](_0x5c2897['where'],_0xa2bdea);}_0x5c2897=_[_0x5368('0xa7')]({},_0x5c2897,_0x144815[_0x5368('0xc0')]);return db[_0x5368('0xc4')][_0x5368('0x22')]({'where':_0x5c2897[_0x5368('0x86')]})[_0x5368('0x2b')](function(_0x28de3d){_0x167bd5['count']=_0x28de3d;if(_0x144815[_0x5368('0x45')]['includeAll']){_0x5c2897[_0x5368('0xbf')]=[{'all':!![]}];}return db[_0x5368('0xc4')]['findAll'](_0x5c2897);})[_0x5368('0x2b')](function(_0x55db18){_0x167bd5[_0x5368('0xcb')]=_0x55db18;return _0x167bd5;});}})['then'](respondWithFilteredResult(_0x10588e,_0x5c2897))[_0x5368('0x35')](handleError(_0x10588e,null));};exports[_0x5368('0xcc')]=function(_0x528678,_0x2daa14,_0x4d8d04){return db[_0x5368('0x3f')][_0x5368('0x6a')]({'where':{'id':_0x528678[_0x5368('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2daa14,null))[_0x5368('0x2b')](function(_0x1b7ae5){if(_0x1b7ae5){return _0x1b7ae5[_0x5368('0xcd')](_0x528678[_0x5368('0x7e')]['ids'],_[_0x5368('0xce')](_0x528678[_0x5368('0x7e')],[_0x5368('0xc5'),'id'])||{})[_0x5368('0xcf')](function(){return db[_0x5368('0x78')]['findAll']({'attributes':['id',_0x5368('0x2e'),_0x5368('0x4f')],'where':{'id':_0x528678['body'][_0x5368('0xc5')]}});})['then'](function(_0x4fc1bb){socket[_0x5368('0xd0')](_0x5368('0xd1'),{'id':Number(_0x528678['params']['id']),'tags':_0x4fc1bb||[]});return{'id':Number(_0x528678['params']['id']),'tags':_0x4fc1bb||[]};});}})['then'](respondWithResult(_0x2daa14,null))[_0x5368('0x35')](handleError(_0x2daa14,null));};exports[_0x5368('0xd2')]=function(_0x2f5af0,_0x45e65d,_0xdd0735){return db['FaxInteraction'][_0x5368('0x6a')]({'where':{'id':_0x2f5af0['params']['id']}})[_0x5368('0x2b')](handleEntityNotFound(_0x45e65d,null))[_0x5368('0x2b')](function(_0x3a75fe){if(_0x3a75fe){return _0x3a75fe[_0x5368('0xd2')](_0x2f5af0[_0x5368('0x45')][_0x5368('0xc5')]);}})[_0x5368('0x2b')](respondWithStatusCode(_0x45e65d,null))[_0x5368('0x35')](handleError(_0x45e65d,null));};exports['download']=function(_0x49ff6e,_0x4fd4ed){var _0x42da93=moment()[_0x5368('0xd3')]()[_0x5368('0xa5')]();var _0x496f85=path[_0x5368('0xd4')](config[_0x5368('0xd5')],_0x5368('0xd6'),_0x5368('0xd7'),_0x5368('0xd8'));var _0x68e44e=path[_0x5368('0xd4')](config[_0x5368('0xd5')],_0x5368('0xd6'),_0x5368('0xd7'),_0x5368('0xd9'));var _0x237f9c=path[_0x5368('0xd4')](_0x496f85,_0x42da93);var _0x47c747=util['format'](_0x5368('0xda'),_0x49ff6e[_0x5368('0xbe')]['id'],_0x42da93);var _0x5f584d=path[_0x5368('0xd4')](_0x496f85,_0x47c747);var _0x5c6a70=[];_0x5c6a70[_0x5368('0xdb')]({'model':db['Attachment'],'as':_0x5368('0xdc'),'raw':!![]});var _0x33f22c=[{'model':db['FaxMessage'],'as':_0x5368('0xdd'),'attributes':['id','body',_0x5368('0x82')],'include':_0x5c6a70}];return db['FaxInteraction'][_0x5368('0x6a')]({'where':{'id':_0x49ff6e[_0x5368('0xbe')]['id']},'include':_0x33f22c})[_0x5368('0x2b')](handleEntityNotFound(_0x4fd4ed,null))[_0x5368('0x2b')](function(_0x31d9e4){if(_0x31d9e4&&_0x31d9e4['Messages']){var _0x44e998=_0x31d9e4[_0x5368('0xde')]({'plain':!![]});fs[_0x5368('0xdf')](_0x237f9c);for(var _0x2df1b0=0x0;_0x2df1b0<_0x44e998[_0x5368('0xdd')][_0x5368('0x68')];_0x2df1b0++){var _0x19fa59=_0x44e998['Messages'][_0x2df1b0][_0x5368('0xdc')];if(_0x19fa59){var _0xf48e42=path[_0x5368('0xd4')](_0x68e44e,_0x19fa59[_0x5368('0xe0')]);if(fs[_0x5368('0xe1')](_0xf48e42)){fs['createReadStream'](_0xf48e42)[_0x5368('0xe2')](fs[_0x5368('0xe3')](path[_0x5368('0xd4')](_0x237f9c,_0x19fa59[_0x5368('0xe0')])));}}}return BPromise[_0x5368('0x9c')]()[_0x5368('0x2b')](function(){return new BPromise(function(_0x26d760,_0x2c6397){zipdir(_0x237f9c,{'saveTo':_0x5f584d},function(_0x2e45fb,_0x3dccc6){if(_0x2e45fb)return _0x2c6397(_0x2e45fb);return _0x26d760(_0x3dccc6);});})[_0x5368('0x2b')](function(){return new BPromise(function(_0x28a3b7,_0x76154e){rimraf(_0x237f9c,function(_0xd34de7){if(_0xd34de7)_0x76154e(_0xd34de7);return _0x28a3b7();});});})['then'](function(){return _0x4fd4ed[_0x5368('0xe4')](_0x5f584d,_0x47c747,function(_0x344278){if(_0x344278){console[_0x5368('0xe5')]('err',_0x344278);}else{fs[_0x5368('0xe6')](_0x5f584d);}});});});}else{return _0x4fd4ed[_0x5368('0x1c')](0xc8);}})[_0x5368('0x35')](handleError(_0x4fd4ed,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index a845d72..be00d96 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 _0xb16e=['FaxInteraction','../../mysqldb','FaxMessage','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x1c0130,_0x61bc9e){var _0x11d7d5=function(_0x2a7dbf){while(--_0x2a7dbf){_0x1c0130['push'](_0x1c0130['shift']());}};_0x11d7d5(++_0x61bc9e);}(_0xb16e,0xd7));var _0xeb16=function(_0x3cb152,_0x57eb54){_0x3cb152=_0x3cb152-0x0;var _0x4f54c3=_0xb16e[_0x3cb152];return _0x4f54c3;};'use strict';var EventEmitter=require(_0xeb16('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xeb16('0x1')];var FaxMessage=require(_0xeb16('0x2'))['db'][_0xeb16('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xeb16('0x4'),'afterDestroy':_0xeb16('0x5')};function emitEvent(_0x2d58fa){return function(_0x28200b,_0xc9bd5f,_0x4f9055){_0x28200b[_0xeb16('0x6')]({'attributes':['id'],'raw':!![]})[_0xeb16('0x7')](function(_0x30bbd4){_0x28200b[_0xeb16('0x8')]('Users',_0x30bbd4[_0xeb16('0x9')](function(_0x4c3eab){return{'id':_0x4c3eab['id']};}));return FaxMessage[_0xeb16('0xa')]({'where':{'FaxInteractionId':_0x28200b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xeb16('0x7')](function(_0x3107ae){_0x28200b[_0xeb16('0x8')](_0xeb16('0xb'),_0x3107ae[_0xeb16('0xc')]);FaxInteractionEvents[_0xeb16('0xd')](_0x2d58fa+':'+_0x28200b['id'],_0x28200b);FaxInteractionEvents[_0xeb16('0xd')](_0x2d58fa,_0x28200b);_0x4f9055(null);})[_0xeb16('0xe')](_0x4f9055(null));};}for(var e in events){if(events[_0xeb16('0xf')](e)){var event=events[e];FaxInteraction[_0xeb16('0x10')](e,emitEvent(event));}}module[_0xeb16('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x29a1=['catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','save','update','remove','setDataValue','Users','map','findAll','then','unreadMessages','length','emit'];(function(_0x11198b,_0x4b5155){var _0x1732b1=function(_0xbf8a00){while(--_0xbf8a00){_0x11198b['push'](_0x11198b['shift']());}};_0x1732b1(++_0x4b5155);}(_0x29a1,0x1b3));var _0x129a=function(_0x224039,_0x1c61ce){_0x224039=_0x224039-0x0;var _0xbd021b=_0x29a1[_0x224039];return _0xbd021b;};'use strict';var EventEmitter=require(_0x129a('0x0'));var FaxInteraction=require(_0x129a('0x1'))['db'][_0x129a('0x2')];var FaxMessage=require(_0x129a('0x1'))['db'][_0x129a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x129a('0x4'),'afterUpdate':_0x129a('0x5'),'afterDestroy':_0x129a('0x6')};function emitEvent(_0x37d9c3){return function(_0x4e70,_0x1590ee,_0x489b05){_0x4e70['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x40871f){_0x4e70[_0x129a('0x7')](_0x129a('0x8'),_0x40871f[_0x129a('0x9')](function(_0x33f65c){return{'id':_0x33f65c['id']};}));return FaxMessage[_0x129a('0xa')]({'where':{'FaxInteractionId':_0x4e70['id'],'direction':'in','read':![]},'raw':!![]});})[_0x129a('0xb')](function(_0x19a5d5){_0x4e70['setDataValue'](_0x129a('0xc'),_0x19a5d5[_0x129a('0xd')]);FaxInteractionEvents[_0x129a('0xe')](_0x37d9c3+':'+_0x4e70['id'],_0x4e70);FaxInteractionEvents[_0x129a('0xe')](_0x37d9c3,_0x4e70);_0x489b05(null);})[_0x129a('0xf')](_0x489b05(null));};}for(var e in events){if(events[_0x129a('0x10')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x129a('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 615a933..19191ac 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 _0x6c4b=['closed','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','request-promise','path','../../config/environment','define','FaxInteraction','fax_interactions','changed'];(function(_0x29b212,_0x2bda77){var _0x5400ef=function(_0x4dde7a){while(--_0x4dde7a){_0x29b212['push'](_0x29b212['shift']());}};_0x5400ef(++_0x2bda77);}(_0x6c4b,0x9e));var _0xb6c4=function(_0x2ed4c9,_0x243771){_0x2ed4c9=_0x2ed4c9-0x0;var _0x237f0a=_0x6c4b[_0x2ed4c9];return _0x237f0a;};'use strict';var _=require(_0xb6c4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb6c4('0x1'));var moment=require(_0xb6c4('0x2'));var BPromise=require(_0xb6c4('0x3'));var rp=require(_0xb6c4('0x4'));var fs=require('fs');var path=require(_0xb6c4('0x5'));var rimraf=require('rimraf');var config=require(_0xb6c4('0x6'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x152e43,_0x3eb1cd){return _0x152e43[_0xb6c4('0x7')](_0xb6c4('0x8'),attributes,{'tableName':_0xb6c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x172d78,_0x17ce58,_0xfc9c53){if(_0x172d78[_0xb6c4('0xa')](_0xb6c4('0xb'))){_0x172d78['closedAt']=moment()['format'](_0xb6c4('0xc'));}_0xfc9c53(null,_0x172d78);}}});}; \ No newline at end of file +var _0xa057=['moment','bluebird','path','rimraf','./faxInteraction.attributes','define','FaxInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api'];(function(_0x426b48,_0x595c31){var _0x31004d=function(_0x115016){while(--_0x115016){_0x426b48['push'](_0x426b48['shift']());}};_0x31004d(++_0x595c31);}(_0xa057,0x123));var _0x7a05=function(_0x250c11,_0x80eff){_0x250c11=_0x250c11-0x0;var _0x1bc7ac=_0xa057[_0x250c11];return _0x1bc7ac;};'use strict';var _=require(_0x7a05('0x0'));var util=require(_0x7a05('0x1'));var logger=require('../../config/logger')(_0x7a05('0x2'));var moment=require(_0x7a05('0x3'));var BPromise=require(_0x7a05('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a05('0x5'));var rimraf=require(_0x7a05('0x6'));var config=require('../../config/environment');var attributes=require(_0x7a05('0x7'));module['exports']=function(_0x599a35,_0x1f3b61){return _0x599a35[_0x7a05('0x8')](_0x7a05('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x32d32f,_0x2135d2,_0x93ca4a){if(_0x32d32f['changed'](_0x7a05('0xa'))){_0x32d32f[_0x7a05('0xb')]=moment()[_0x7a05('0xc')](_0x7a05('0xd'));}_0x93ca4a(null,_0x32d32f);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index cb5c4ac..cf067fa 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 _0x3b6f=['options','where','attributes','limit','AddTagsToFaxInteraction','find','body','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./faxInteraction.socket','register','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3b6f,0x120));var _0xf3b6=function(_0x586243,_0x3c33f2){_0x586243=_0x586243-0x0;var _0x4d0ae9=_0x3b6f[_0x586243];return _0x4d0ae9;};'use strict';var _=require(_0xf3b6('0x0'));var util=require(_0xf3b6('0x1'));var moment=require(_0xf3b6('0x2'));var BPromise=require(_0xf3b6('0x3'));var rs=require(_0xf3b6('0x4'));var fs=require('fs');var Redis=require(_0xf3b6('0x5'));var db=require(_0xf3b6('0x6'))['db'];var utils=require(_0xf3b6('0x7'));var logger=require(_0xf3b6('0x8'))(_0xf3b6('0x9'));var config=require('../../config/environment');var jayson=require(_0xf3b6('0xa'));var client=jayson['client'][_0xf3b6('0xb')]({'port':0x232a});config[_0xf3b6('0xc')]=_[_0xf3b6('0xd')](config[_0xf3b6('0xc')],{'host':_0xf3b6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf3b6('0xf'))[_0xf3b6('0x10')](socket);function respondWithRpcPromise(_0x271b25,_0x1c3fa1,_0x133ce1){return new BPromise(function(_0x50fc0d,_0x20057d){return client['request'](_0x271b25,_0x133ce1)[_0xf3b6('0x11')](function(_0x330f2e){logger['info'](_0xf3b6('0x12'),_0x1c3fa1,_0xf3b6('0x13'));logger[_0xf3b6('0x14')](_0xf3b6('0x15'),_0x1c3fa1,_0xf3b6('0x13'),JSON[_0xf3b6('0x16')](_0x330f2e));if(_0x330f2e[_0xf3b6('0x17')]){if(_0x330f2e[_0xf3b6('0x17')][_0xf3b6('0x18')]===0x1f4){logger[_0xf3b6('0x17')](_0xf3b6('0x12'),_0x1c3fa1,_0x330f2e[_0xf3b6('0x17')][_0xf3b6('0x19')]);return _0x20057d(_0x330f2e[_0xf3b6('0x17')][_0xf3b6('0x19')]);}logger[_0xf3b6('0x17')](_0xf3b6('0x12'),_0x1c3fa1,_0x330f2e['error']['message']);return _0x50fc0d(_0x330f2e[_0xf3b6('0x17')][_0xf3b6('0x19')]);}else{logger[_0xf3b6('0x1a')](_0xf3b6('0x12'),_0x1c3fa1,_0xf3b6('0x13'));_0x50fc0d(_0x330f2e[_0xf3b6('0x1b')][_0xf3b6('0x19')]);}})[_0xf3b6('0x1c')](function(_0x43f399){logger[_0xf3b6('0x17')](_0xf3b6('0x12'),_0x1c3fa1,_0x43f399);_0x20057d(_0x43f399);});});}exports[_0xf3b6('0x1d')]=function(_0x35eed3){var _0x1da883=this;return new Promise(function(_0x4c873d,_0x1a301b){return db[_0xf3b6('0x1e')][_0xf3b6('0x1f')](_0x35eed3['body'],{'raw':_0x35eed3[_0xf3b6('0x20')]?_0x35eed3[_0xf3b6('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35eed3[_0xf3b6('0x20')]?_0x35eed3[_0xf3b6('0x20')][_0xf3b6('0x21')]||null:null,'attributes':_0x35eed3[_0xf3b6('0x20')]?_0x35eed3[_0xf3b6('0x20')][_0xf3b6('0x22')]||null:null,'limit':_0x35eed3[_0xf3b6('0x20')]?_0x35eed3[_0xf3b6('0x20')][_0xf3b6('0x23')]||null:null})[_0xf3b6('0x11')](function(_0x38ed93){logger[_0xf3b6('0x1a')](_0xf3b6('0x1d'),_0x35eed3);logger[_0xf3b6('0x14')](_0xf3b6('0x1d'),_0x35eed3,JSON['stringify'](_0x38ed93));_0x4c873d(_0x38ed93);})['catch'](function(_0x1f8de5){logger[_0xf3b6('0x17')](_0xf3b6('0x1d'),_0x1f8de5['message'],_0x35eed3);_0x1a301b(_0x1da883['error'](0x1f4,_0x1f8de5['message']));});});};exports[_0xf3b6('0x24')]=function(_0x57fafb){return new Promise(function(_0x6048bb,_0x1141b5){return db[_0xf3b6('0x1e')][_0xf3b6('0x25')]({'where':_0x57fafb[_0xf3b6('0x20')]?_0x57fafb[_0xf3b6('0x20')][_0xf3b6('0x21')]||null:null})[_0xf3b6('0x11')](function(_0x535c12){if(_0x535c12){return _0x535c12['addTags'](_0x57fafb['body']['ids'],_['omit'](_0x57fafb[_0xf3b6('0x26')],['ids','id'])||{});}})['spread'](function(_0x58f8b5){logger['info'](_0xf3b6('0x27'),_0x57fafb);logger[_0xf3b6('0x14')](_0xf3b6('0x27'),_0x57fafb,JSON[_0xf3b6('0x16')](_0x58f8b5));_0x6048bb(_0x58f8b5);})['catch'](function(_0x106653){logger[_0xf3b6('0x17')]('AddTags',_0x106653[_0xf3b6('0x19')],_0x57fafb);_0x1141b5(_this[_0xf3b6('0x17')](0x1f4,_0x106653[_0xf3b6('0x19')]));});});}; \ No newline at end of file +var _0xee3d=['request\x20sent','stringify','error','code','message','result','FaxInteraction','body','options','raw','where','attributes','limit','UpdateFaxInteraction','catch','AddTagsToFaxInteraction','find','ids','omit','spread','AddTags','lodash','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','debug'];(function(_0x2298f0,_0x3bbf4f){var _0x39b136=function(_0xc2cd6e){while(--_0xc2cd6e){_0x2298f0['push'](_0x2298f0['shift']());}};_0x39b136(++_0x3bbf4f);}(_0xee3d,0x12d));var _0xdee3=function(_0x22f8ef,_0x220f79){_0x22f8ef=_0x22f8ef-0x0;var _0x33245e=_0xee3d[_0x22f8ef];return _0x33245e;};'use strict';var _=require(_0xdee3('0x0'));var util=require('util');var moment=require(_0xdee3('0x1'));var BPromise=require(_0xdee3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdee3('0x3'));var logger=require('../../config/logger')(_0xdee3('0x4'));var config=require(_0xdee3('0x5'));var jayson=require(_0xdee3('0x6'));var client=jayson[_0xdee3('0x7')]['http']({'port':0x232a});config[_0xdee3('0x8')]=_[_0xdee3('0x9')](config[_0xdee3('0x8')],{'host':_0xdee3('0xa'),'port':0x18eb});var socket=require(_0xdee3('0xb'))(new Redis(config[_0xdee3('0x8')]));require(_0xdee3('0xc'))[_0xdee3('0xd')](socket);function respondWithRpcPromise(_0x3c1132,_0x2d9190,_0x5ed6f5){return new BPromise(function(_0x3f321a,_0x1f56f2){return client[_0xdee3('0xe')](_0x3c1132,_0x5ed6f5)[_0xdee3('0xf')](function(_0x44591a){logger[_0xdee3('0x10')](_0xdee3('0x11'),_0x2d9190,'request\x20sent');logger[_0xdee3('0x12')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x2d9190,_0xdee3('0x13'),JSON[_0xdee3('0x14')](_0x44591a));if(_0x44591a[_0xdee3('0x15')]){if(_0x44591a[_0xdee3('0x15')][_0xdee3('0x16')]===0x1f4){logger[_0xdee3('0x15')](_0xdee3('0x11'),_0x2d9190,_0x44591a[_0xdee3('0x15')][_0xdee3('0x17')]);return _0x1f56f2(_0x44591a['error'][_0xdee3('0x17')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x2d9190,_0x44591a['error'][_0xdee3('0x17')]);return _0x3f321a(_0x44591a['error'][_0xdee3('0x17')]);}else{logger[_0xdee3('0x10')](_0xdee3('0x11'),_0x2d9190,_0xdee3('0x13'));_0x3f321a(_0x44591a[_0xdee3('0x18')][_0xdee3('0x17')]);}})['catch'](function(_0x1c9e32){logger[_0xdee3('0x15')](_0xdee3('0x11'),_0x2d9190,_0x1c9e32);_0x1f56f2(_0x1c9e32);});});}exports['UpdateFaxInteraction']=function(_0x553190){var _0xa866d3=this;return new Promise(function(_0x59e9b6,_0x2b5014){return db[_0xdee3('0x19')]['update'](_0x553190[_0xdee3('0x1a')],{'raw':_0x553190[_0xdee3('0x1b')]?_0x553190['options'][_0xdee3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x553190[_0xdee3('0x1b')]?_0x553190[_0xdee3('0x1b')][_0xdee3('0x1d')]||null:null,'attributes':_0x553190[_0xdee3('0x1b')]?_0x553190[_0xdee3('0x1b')][_0xdee3('0x1e')]||null:null,'limit':_0x553190[_0xdee3('0x1b')]?_0x553190[_0xdee3('0x1b')][_0xdee3('0x1f')]||null:null})[_0xdee3('0xf')](function(_0x54e495){logger[_0xdee3('0x10')]('UpdateFaxInteraction',_0x553190);logger[_0xdee3('0x12')](_0xdee3('0x20'),_0x553190,JSON['stringify'](_0x54e495));_0x59e9b6(_0x54e495);})[_0xdee3('0x21')](function(_0x13afbf){logger[_0xdee3('0x15')]('UpdateFaxInteraction',_0x13afbf['message'],_0x553190);_0x2b5014(_0xa866d3['error'](0x1f4,_0x13afbf[_0xdee3('0x17')]));});});};exports[_0xdee3('0x22')]=function(_0x48ad2b){return new Promise(function(_0x3497d0,_0x167f27){return db['FaxInteraction'][_0xdee3('0x23')]({'where':_0x48ad2b[_0xdee3('0x1b')]?_0x48ad2b[_0xdee3('0x1b')][_0xdee3('0x1d')]||null:null})[_0xdee3('0xf')](function(_0x290361){if(_0x290361){return _0x290361['addTags'](_0x48ad2b[_0xdee3('0x1a')][_0xdee3('0x24')],_[_0xdee3('0x25')](_0x48ad2b['body'],['ids','id'])||{});}})[_0xdee3('0x26')](function(_0x574bc8){logger[_0xdee3('0x10')](_0xdee3('0x27'),_0x48ad2b);logger[_0xdee3('0x12')](_0xdee3('0x27'),_0x48ad2b,JSON[_0xdee3('0x14')](_0x574bc8));_0x3497d0(_0x574bc8);})['catch'](function(_0x5c9635){logger['error'](_0xdee3('0x27'),_0x5c9635['message'],_0x48ad2b);_0x167f27(_this[_0xdee3('0x15')](0x1f4,_0x5c9635['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 96212bc..b6b0664 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 _0x8024=['save','remove','update','register','length','faxInteraction:'];(function(_0x59e174,_0x43a286){var _0x2d581f=function(_0xfdc0a9){while(--_0xfdc0a9){_0x59e174['push'](_0x59e174['shift']());}};_0x2d581f(++_0x43a286);}(_0x8024,0x192));var _0x4802=function(_0x198f59,_0x16308d){_0x198f59=_0x198f59-0x0;var _0x51fa15=_0x8024[_0x198f59];return _0x51fa15;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x4802('0x0'),_0x4802('0x1'),_0x4802('0x2')];function createListener(_0x254982,_0x72769a){return function(_0x43b066){_0x72769a['emit'](_0x254982,_0x43b066);};}function removeListener(_0x1697a0,_0x255430){return function(){FaxInteractionEvents['removeListener'](_0x1697a0,_0x255430);};}exports[_0x4802('0x3')]=function(_0x18df34){for(var _0x16fd0d=0x0,_0x5e75ea=events[_0x4802('0x4')];_0x16fd0d<_0x5e75ea;_0x16fd0d++){var _0x3b21c2=events[_0x16fd0d];var _0x2f3e9d=createListener(_0x4802('0x5')+_0x3b21c2,_0x18df34);FaxInteractionEvents['on'](_0x3b21c2,_0x2f3e9d);}}; \ No newline at end of file +var _0xa3de=['emit','register','length','faxInteraction:','save','remove','update'];(function(_0x4c4568,_0x3baf58){var _0x3ef5ff=function(_0x89cf99){while(--_0x89cf99){_0x4c4568['push'](_0x4c4568['shift']());}};_0x3ef5ff(++_0x3baf58);}(_0xa3de,0x1cb));var _0xea3d=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0xa3de[_0x2ff238];return _0x204a56;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xea3d('0x0'),_0xea3d('0x1'),_0xea3d('0x2')];function createListener(_0x262ec2,_0x228a74){return function(_0x3f21cb){_0x228a74[_0xea3d('0x3')](_0x262ec2,_0x3f21cb);};}function removeListener(_0x2693ff,_0x18e866){return function(){FaxInteractionEvents['removeListener'](_0x2693ff,_0x18e866);};}exports[_0xea3d('0x4')]=function(_0x4791c2){for(var _0x368694=0x0,_0x36cc17=events[_0xea3d('0x5')];_0x368694<_0x36cc17;_0x368694++){var _0x47f254=events[_0x368694];var _0x450eba=createListener(_0xea3d('0x6')+_0x47f254,_0x4791c2);FaxInteractionEvents['on'](_0x47f254,_0x450eba);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index aca8449..b914d71 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 _0xbe61=['addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','put','delete','faxinteraction:destroy','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create'];(function(_0x2a00db,_0x1c7251){var _0x25f4fe=function(_0x127626){while(--_0x127626){_0x2a00db['push'](_0x2a00db['shift']());}};_0x25f4fe(++_0x1c7251);}(_0xbe61,0x1dc));var _0x1be6=function(_0x7a39ca,_0x597f76){_0x7a39ca=_0x7a39ca-0x0;var _0x4ec413=_0xbe61[_0x7a39ca];return _0x4ec413;};'use strict';var multer=require('multer');var util=require(_0x1be6('0x0'));var path=require(_0x1be6('0x1'));var timeout=require(_0x1be6('0x2'));var express=require(_0x1be6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1be6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1be6('0x5'));var controller=require('./faxInteraction.controller');router[_0x1be6('0x6')]('/',auth[_0x1be6('0x7')](),controller[_0x1be6('0x8')]);router[_0x1be6('0x6')](_0x1be6('0x9'),auth['isAuthenticated'](),controller[_0x1be6('0xa')]);router[_0x1be6('0x6')](_0x1be6('0xb'),auth[_0x1be6('0x7')](),controller[_0x1be6('0xc')]);router['get'](_0x1be6('0xd'),auth['isAuthenticated'](),controller[_0x1be6('0xe')]);router[_0x1be6('0x6')]('/:id/download',auth[_0x1be6('0x7')](),controller[_0x1be6('0xf')]);router[_0x1be6('0x10')]('/',auth[_0x1be6('0x7')](),controller[_0x1be6('0x11')]);router[_0x1be6('0x10')]('/:id/messages',auth[_0x1be6('0x7')](),controller[_0x1be6('0x12')]);router[_0x1be6('0x10')](_0x1be6('0x13'),auth[_0x1be6('0x7')](),interaction[_0x1be6('0x14')](_0x1be6('0x15'),_0x1be6('0x16')),controller['addTags']);router[_0x1be6('0x17')](_0x1be6('0xb'),auth[_0x1be6('0x7')](),interaction[_0x1be6('0x14')]('fax','faxinteraction:update'),controller['update']);router[_0x1be6('0x18')]('/:id',auth[_0x1be6('0x7')](),interaction['tracked'](_0x1be6('0x15'),_0x1be6('0x19')),controller['destroy']);router[_0x1be6('0x18')](_0x1be6('0x13'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x7cca=['/describe','describe','get','/:id','getMessages','create','post','/:id/tags','tracked','fax','faxinteraction:addtags','faxinteraction:update','delete','faxinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index'];(function(_0x44989b,_0x1824e8){var _0x1c771c=function(_0xbbfbac){while(--_0xbbfbac){_0x44989b['push'](_0x44989b['shift']());}};_0x1c771c(++_0x1824e8);}(_0x7cca,0x160));var _0xa7cc=function(_0x1b981b,_0x22afde){_0x1b981b=_0x1b981b-0x0;var _0x449c5d=_0x7cca[_0x1b981b];return _0x449c5d;};'use strict';var multer=require(_0xa7cc('0x0'));var util=require(_0xa7cc('0x1'));var path=require(_0xa7cc('0x2'));var timeout=require(_0xa7cc('0x3'));var express=require(_0xa7cc('0x4'));var router=express[_0xa7cc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa7cc('0x6'));var interaction=require(_0xa7cc('0x7'));var config=require(_0xa7cc('0x8'));var controller=require(_0xa7cc('0x9'));router['get']('/',auth[_0xa7cc('0xa')](),controller[_0xa7cc('0xb')]);router['get'](_0xa7cc('0xc'),auth[_0xa7cc('0xa')](),controller[_0xa7cc('0xd')]);router[_0xa7cc('0xe')](_0xa7cc('0xf'),auth[_0xa7cc('0xa')](),controller['show']);router[_0xa7cc('0xe')]('/:id/messages',auth['isAuthenticated'](),controller[_0xa7cc('0x10')]);router[_0xa7cc('0xe')]('/:id/download',auth[_0xa7cc('0xa')](),controller['download']);router['post']('/',auth[_0xa7cc('0xa')](),controller[_0xa7cc('0x11')]);router['post']('/:id/messages',auth[_0xa7cc('0xa')](),controller['addMessage']);router[_0xa7cc('0x12')](_0xa7cc('0x13'),auth[_0xa7cc('0xa')](),interaction[_0xa7cc('0x14')](_0xa7cc('0x15'),_0xa7cc('0x16')),controller['addTags']);router['put']('/:id',auth[_0xa7cc('0xa')](),interaction['tracked'](_0xa7cc('0x15'),_0xa7cc('0x17')),controller['update']);router[_0xa7cc('0x18')](_0xa7cc('0xf'),auth[_0xa7cc('0xa')](),interaction[_0xa7cc('0x14')]('fax',_0xa7cc('0x19')),controller['destroy']);router[_0xa7cc('0x18')](_0xa7cc('0x13'),auth[_0xa7cc('0xa')](),controller[_0xa7cc('0x1a')]);module[_0xa7cc('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 7152abd..5c97ccf 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 _0xb7cf=['exports','TEXT','medium','BOOLEAN','out','DATE','sequelize'];(function(_0x4f06fa,_0x31c38b){var _0x25c1a1=function(_0x273e76){while(--_0x273e76){_0x4f06fa['push'](_0x4f06fa['shift']());}};_0x25c1a1(++_0x31c38b);}(_0xb7cf,0xca));var _0xfb7c=function(_0x3b65b7,_0x1756e2){_0x3b65b7=_0x3b65b7-0x0;var _0x186695=_0xb7cf[_0x3b65b7];return _0x186695;};'use strict';var Sequelize=require(_0xfb7c('0x0'));module[_0xfb7c('0x1')]={'body':{'type':Sequelize[_0xfb7c('0x2')](_0xfb7c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xfb7c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfb7c('0x5')),'defaultValue':_0xfb7c('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xfb7c('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xfb7c('0x6')]}}; \ No newline at end of file +var _0x1306=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x31b90f,_0x35ef73){var _0x15653b=function(_0x3b992f){while(--_0x3b992f){_0x31b90f['push'](_0x31b90f['shift']());}};_0x15653b(++_0x35ef73);}(_0x1306,0x17a));var _0x6130=function(_0x125001,_0x51be92){_0x125001=_0x125001-0x0;var _0x22a1fb=_0x1306[_0x125001];return _0x22a1fb;};'use strict';var Sequelize=require(_0x6130('0x0'));module[_0x6130('0x1')]={'body':{'type':Sequelize[_0x6130('0x2')](_0x6130('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6130('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6130('0x5')]('in',_0x6130('0x6')),'defaultValue':_0x6130('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x6130('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x6130('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index a8ed901..3bc08c6 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 _0x0041=['request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','name','index','map','FaxMessage','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','update','body','describe','../../config/logger','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','contact','agent','email','internal','manual','interface','format','channel','motionChannel','accept','EventManager','acceptmessage','fax-interactions','fax','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SELECT','User','fullname','SIP/%s','event','rejectmessage','create','CmContact','findOne','Attachment','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','server','files','attachments','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http'];(function(_0x4b499f,_0x50033b){var _0x1d3905=function(_0x4e0863){while(--_0x4e0863){_0x4b499f['push'](_0x4b499f['shift']());}};_0x1d3905(++_0x50033b);}(_0x0041,0x72));var _0x1004=function(_0x213810,_0x10a0fd){_0x213810=_0x213810-0x0;var _0x49b6fe=_0x0041[_0x213810];return _0x49b6fe;};'use strict';var emlformat=require(_0x1004('0x0'));var rimraf=require(_0x1004('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1004('0x2'));var rp=require('request-promise');var moment=require(_0x1004('0x3'));var BPromise=require(_0x1004('0x4'));var Mustache=require(_0x1004('0x5'));var util=require('util');var path=require(_0x1004('0x6'));var sox=require(_0x1004('0x7'));var csv=require(_0x1004('0x8'));var ejs=require(_0x1004('0x9'));var fs=require('fs');var fs_extra=require(_0x1004('0xa'));var _=require(_0x1004('0xb'));var squel=require(_0x1004('0xc'));var crypto=require(_0x1004('0xd'));var jsforce=require(_0x1004('0xe'));var deskjs=require(_0x1004('0xf'));var toCsv=require(_0x1004('0x8'));var querystring=require(_0x1004('0x10'));var Papa=require(_0x1004('0x11'));var Redis=require(_0x1004('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1004('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1004('0x14'));var utils=require(_0x1004('0x15'));var config=require(_0x1004('0x16'));var licenseUtil=require(_0x1004('0x17'));var db=require(_0x1004('0x18'))['db'];config[_0x1004('0x19')]=_['defaults'](config[_0x1004('0x19')],{'host':_0x1004('0x1a'),'port':0x18eb});var socket=require(_0x1004('0x1b'))(new Redis(config[_0x1004('0x19')]));require(_0x1004('0x1c'))[_0x1004('0x1d')](socket);var jayson=require(_0x1004('0x1e'));var client=jayson[_0x1004('0x1f')][_0x1004('0x20')]({'port':0x232c});var client9002=jayson[_0x1004('0x1f')][_0x1004('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x7363f7,_0x36d64a,_0x34ec11,_0x5317b8){return new BPromise(function(_0x159d3f,_0x2fed89){var _0x464bfb=_0x5317b8||client;return _0x464bfb[_0x1004('0x21')](_0x7363f7,_0x34ec11)['then'](function(_0x538470){logger[_0x1004('0x22')](_0x1004('0x23'),_0x36d64a,_0x1004('0x24'));logger[_0x1004('0x25')](_0x1004('0x26'),_0x36d64a,_0x1004('0x24'),JSON[_0x1004('0x27')](_0x538470));if(_0x538470[_0x1004('0x28')]){if(_0x538470[_0x1004('0x28')]['code']===0x1f4){logger[_0x1004('0x28')](_0x1004('0x23'),_0x36d64a,_0x538470[_0x1004('0x28')][_0x1004('0x29')]);return _0x2fed89(_0x538470[_0x1004('0x28')][_0x1004('0x29')]);}logger[_0x1004('0x28')](_0x1004('0x23'),_0x36d64a,_0x538470[_0x1004('0x28')]['message']);return _0x159d3f(_0x538470[_0x1004('0x28')][_0x1004('0x29')]);}else{logger[_0x1004('0x22')]('FaxMessage,\x20%s,\x20%s',_0x36d64a,'request\x20sent');_0x159d3f(_0x538470['result'][_0x1004('0x29')]);}})['catch'](function(_0x37c2f3){logger['error'](_0x1004('0x23'),_0x36d64a,_0x37c2f3);_0x2fed89(_0x37c2f3);});});}function respondWithStatusCode(_0x234c97,_0x44dcb6){_0x44dcb6=_0x44dcb6||0xcc;return function(_0x4770fb){if(_0x4770fb){return _0x234c97[_0x1004('0x2a')](_0x44dcb6);}return _0x234c97[_0x1004('0x2b')](_0x44dcb6)[_0x1004('0x2c')]();};}function respondWithResult(_0x459136,_0x10842b){_0x10842b=_0x10842b||0xc8;return function(_0x1419dc){if(_0x1419dc){return _0x459136['status'](_0x10842b)[_0x1004('0x2d')](_0x1419dc);}};}function respondWithFilteredResult(_0x496346,_0x5c1bf3){return function(_0x104427){if(_0x104427){var _0x24444e=typeof _0x5c1bf3[_0x1004('0x2e')]===_0x1004('0x2f')&&typeof _0x5c1bf3[_0x1004('0x30')]===_0x1004('0x2f');var _0x5557f4=_0x104427['count'];var _0x1c5c8d=_0x24444e?0x0:_0x5c1bf3[_0x1004('0x2e')];var _0xe73f7=_0x24444e?_0x104427[_0x1004('0x31')]:_0x5c1bf3[_0x1004('0x2e')]+_0x5c1bf3['limit'];var _0x4f464f;if(_0xe73f7>=_0x5557f4){_0xe73f7=_0x5557f4;_0x4f464f=0xc8;}else{_0x4f464f=0xce;}_0x496346[_0x1004('0x2b')](_0x4f464f);return _0x496346[_0x1004('0x32')]('Content-Range',_0x1c5c8d+'-'+_0xe73f7+'/'+_0x5557f4)[_0x1004('0x2d')](_0x104427);}return null;};}function patchUpdates(_0xe2995b){return function(_0xfc374d){try{jsonpatch[_0x1004('0x33')](_0xfc374d,_0xe2995b,!![]);}catch(_0x562054){return BPromise[_0x1004('0x34')](_0x562054);}return _0xfc374d['save']();};}function saveUpdates(_0x58056a,_0x140897){return function(_0x3fd1d3){if(_0x3fd1d3){return _0x3fd1d3['update'](_0x58056a)[_0x1004('0x35')](function(_0x416e43){return _0x416e43;});}return null;};}function removeEntity(_0x245ea6,_0x21be65){return function(_0x2ec997){if(_0x2ec997){return _0x2ec997[_0x1004('0x36')]()[_0x1004('0x35')](function(){_0x245ea6[_0x1004('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xabdd85,_0x1e78ca){return function(_0x5155e3){if(!_0x5155e3){_0xabdd85[_0x1004('0x2a')](0x194);}return _0x5155e3;};}function handleError(_0x4b4682,_0x3b1369){_0x3b1369=_0x3b1369||0x1f4;return function(_0x49ad4b){logger[_0x1004('0x28')](_0x49ad4b['stack']);if(_0x49ad4b[_0x1004('0x37')]){delete _0x49ad4b[_0x1004('0x37')];}_0x4b4682[_0x1004('0x2b')](_0x3b1369)['send'](_0x49ad4b);};}exports[_0x1004('0x38')]=function(_0x4be931,_0x4807d5){var _0x21cf47={},_0x52d768={},_0x2ef086={'count':0x0,'rows':[]};var _0x4ed386=_[_0x1004('0x39')](db[_0x1004('0x3a')][_0x1004('0x3b')],function(_0x54db90){return{'name':_0x54db90['fieldName'],'type':_0x54db90[_0x1004('0x3c')][_0x1004('0x3d')]};});_0x52d768[_0x1004('0x3e')]=_[_0x1004('0x39')](_0x4ed386,'name');_0x52d768['query']=_[_0x1004('0x3f')](_0x4be931[_0x1004('0x40')]);_0x52d768[_0x1004('0x41')]=_[_0x1004('0x42')](_0x52d768['model'],_0x52d768[_0x1004('0x40')]);_0x21cf47['attributes']=_['intersection'](_0x52d768[_0x1004('0x3e')],qs[_0x1004('0x43')](_0x4be931['query'][_0x1004('0x43')]));_0x21cf47[_0x1004('0x44')]=_0x21cf47[_0x1004('0x44')][_0x1004('0x45')]?_0x21cf47[_0x1004('0x44')]:_0x52d768['model'];if(!_0x4be931[_0x1004('0x40')][_0x1004('0x46')](_0x1004('0x47'))){_0x21cf47[_0x1004('0x30')]=qs['limit'](_0x4be931[_0x1004('0x40')][_0x1004('0x30')]);_0x21cf47['offset']=qs[_0x1004('0x2e')](_0x4be931['query'][_0x1004('0x2e')]);}_0x21cf47[_0x1004('0x48')]=qs[_0x1004('0x49')](_0x4be931[_0x1004('0x40')][_0x1004('0x49')]);_0x21cf47['where']=qs['filters'](_[_0x1004('0x4a')](_0x4be931[_0x1004('0x40')],_0x52d768['filters']),_0x4ed386);if(_0x4be931[_0x1004('0x40')][_0x1004('0x4b')]){_0x21cf47[_0x1004('0x4c')]=_[_0x1004('0x4d')](_0x21cf47[_0x1004('0x4c')],{'$or':_['map'](_0x4ed386,function(_0xca68c3){if(_0xca68c3[_0x1004('0x3c')]!==_0x1004('0x4e')){var _0x4eb7ed={};_0x4eb7ed[_0xca68c3['name']]={'$like':'%'+_0x4be931[_0x1004('0x40')][_0x1004('0x4b')]+'%'};return _0x4eb7ed;}})});}_0x21cf47=_['merge']({},_0x21cf47,_0x4be931[_0x1004('0x4f')]);var _0x1db868={'where':_0x21cf47[_0x1004('0x4c')]};return db['FaxMessage']['count'](_0x1db868)[_0x1004('0x35')](function(_0xc99bd9){_0x2ef086[_0x1004('0x31')]=_0xc99bd9;if(_0x4be931[_0x1004('0x40')][_0x1004('0x50')]){_0x21cf47[_0x1004('0x51')]=[{'all':!![]}];}return db[_0x1004('0x3a')][_0x1004('0x52')](_0x21cf47);})[_0x1004('0x35')](function(_0x47294c){_0x2ef086['rows']=_0x47294c;return _0x2ef086;})[_0x1004('0x35')](respondWithFilteredResult(_0x4807d5,_0x21cf47))[_0x1004('0x53')](handleError(_0x4807d5,null));};exports[_0x1004('0x54')]=function(_0x3628af,_0x5c5185){var _0x1cf25f={'raw':!![],'where':{'id':_0x3628af[_0x1004('0x55')]['id']}},_0x835c6a={};_0x835c6a[_0x1004('0x3e')]=_[_0x1004('0x3f')](db[_0x1004('0x3a')]['rawAttributes']);_0x835c6a['query']=_[_0x1004('0x3f')](_0x3628af[_0x1004('0x40')]);_0x835c6a[_0x1004('0x41')]=_[_0x1004('0x42')](_0x835c6a[_0x1004('0x3e')],_0x835c6a[_0x1004('0x40')]);_0x1cf25f['attributes']=_['intersection'](_0x835c6a[_0x1004('0x3e')],qs[_0x1004('0x43')](_0x3628af['query'][_0x1004('0x43')]));_0x1cf25f[_0x1004('0x44')]=_0x1cf25f['attributes'][_0x1004('0x45')]?_0x1cf25f[_0x1004('0x44')]:_0x835c6a[_0x1004('0x3e')];if(_0x3628af[_0x1004('0x40')]['includeAll']){_0x1cf25f[_0x1004('0x51')]=[{'all':!![]}];}_0x1cf25f=_['merge']({},_0x1cf25f,_0x3628af[_0x1004('0x4f')]);return db['FaxMessage'][_0x1004('0x56')](_0x1cf25f)[_0x1004('0x35')](handleEntityNotFound(_0x5c5185,null))[_0x1004('0x35')](respondWithResult(_0x5c5185,null))['catch'](handleError(_0x5c5185,null));};exports[_0x1004('0x57')]=function(_0x11a7df,_0x40d94e){if(_0x11a7df['body']['id']){delete _0x11a7df[_0x1004('0x58')]['id'];}return db[_0x1004('0x3a')][_0x1004('0x56')]({'where':{'id':_0x11a7df[_0x1004('0x55')]['id']}})[_0x1004('0x35')](handleEntityNotFound(_0x40d94e,null))[_0x1004('0x35')](saveUpdates(_0x11a7df[_0x1004('0x58')],null))[_0x1004('0x35')](respondWithResult(_0x40d94e,null))[_0x1004('0x53')](handleError(_0x40d94e,null));};exports[_0x1004('0x36')]=function(_0xe278cb,_0x333f93){return db['FaxMessage'][_0x1004('0x56')]({'where':{'id':_0xe278cb[_0x1004('0x55')]['id']}})[_0x1004('0x35')](handleEntityNotFound(_0x333f93,null))[_0x1004('0x35')](removeEntity(_0x333f93,null))[_0x1004('0x53')](handleError(_0x333f93,null));};exports[_0x1004('0x59')]=function(_0x4b45d1,_0x1c5811){return db[_0x1004('0x3a')][_0x1004('0x59')]()[_0x1004('0x35')](respondWithResult(_0x1c5811,null))['catch'](handleError(_0x1c5811,null));};var interaction_log=require(_0x1004('0x5a'))('fax-interactions');exports['accept']=function(_0x568d6d,_0x1f2ff2,_0x2e5893){var _0x41a2ce={'agent':{},'channel':'fax'};if(_0x568d6d['body']['id']){delete _0x568d6d[_0x1004('0x58')]['id'];}_0x568d6d[_0x1004('0x58')][_0x1004('0x5b')]=!![];_0x568d6d['body']['readAt']=moment()['format'](_0x1004('0x5c'));_0x568d6d[_0x1004('0x58')][_0x1004('0x5d')]=_0x568d6d[_0x1004('0x58')][_0x1004('0x5d')]||_0x568d6d[_0x1004('0x5e')]['id'];_0x41a2ce['agent']['id']=_0x568d6d[_0x1004('0x58')][_0x1004('0x5d')];return db['FaxMessage'][_0x1004('0x56')]({'where':{'id':_0x568d6d[_0x1004('0x55')]['id'],'UserId':null}})[_0x1004('0x35')](handleEntityNotFound(_0x1f2ff2,null))['then'](saveUpdates(_0x568d6d[_0x1004('0x58')],null))[_0x1004('0x35')](function(_0x5a4cb9){if(_0x5a4cb9){_0x41a2ce[_0x1004('0x29')]=_0x5a4cb9[_0x1004('0x5f')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x5a4cb9[_0x1004('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x1f2ff2,null))[_0x1004('0x35')](function(_0x2b8aec){if(_0x2b8aec){return _0x2b8aec[_0x1004('0x57')]({'UserId':_0x568d6d[_0x1004('0x58')][_0x1004('0x5d')],'read1stAt':_[_0x1004('0x61')](_0x2b8aec[_0x1004('0x62')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x2c26bf){if(_0x2c26bf){_0x41a2ce[_0x1004('0x63')]=_0x2c26bf['get']({'plain':!![]});interaction_log[_0x1004('0x22')](_0x1004('0x64'),_0x568d6d[_0x1004('0x5e')]['id'],_0x568d6d[_0x1004('0x5e')][_0x1004('0x37')],_0x568d6d[_0x1004('0x5e')][_0x1004('0x65')],_0x41a2ce[_0x1004('0x63')]['id'],_0x568d6d[_0x1004('0x58')]?JSON[_0x1004('0x27')](_0x568d6d[_0x1004('0x58')]):_0x1004('0x66'));return respondWithRpcPromise(_0x1004('0x67'),_0x1004('0x68'),_0x41a2ce);}return null;})[_0x1004('0x35')](function(_0x9eb04b){var _0x5b4522='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x9eb04b[_0x1004('0x29')][_0x1004('0x69')];return db['sequelize'][_0x1004('0x40')](_0x5b4522,{'type':db[_0x1004('0x6a')][_0x1004('0x6b')]['SELECT'],'raw':!![]})[_0x1004('0x35')](function(_0x325ab2){return _0x325ab2;});})[_0x1004('0x35')](function(_0x3b7952){if(_0x3b7952){_0x41a2ce[_0x1004('0x29')][_0x1004('0x6c')]=_0x3b7952[0x0];if(!_0x568d6d['body'][_0x1004('0x5d')])return;return db['User'][_0x1004('0x56')]({'where':{'id':_0x568d6d[_0x1004('0x58')]['UserId'],'role':_0x1004('0x6d')},'attributes':['id',_0x1004('0x37'),'fullname',_0x1004('0x6e'),_0x1004('0x6f')],'raw':!![]});}return null;})[_0x1004('0x35')](function(_0x51a826){if(!_0x51a826)return null;_0x41a2ce['message'][_0x1004('0x6d')]=_0x51a826;return _0x41a2ce;})[_0x1004('0x35')](function(_0x6fd6df){if(_0x6fd6df){if(_0x568d6d[_0x1004('0x58')][_0x1004('0x70')]){_0x41a2ce[_0x1004('0x29')][_0x1004('0x71')]=util[_0x1004('0x72')]('SIP/%s',_0x568d6d[_0x1004('0x5e')][_0x1004('0x37')]);_0x41a2ce[_0x1004('0x29')]['channel']=_0x41a2ce[_0x1004('0x73')];_0x41a2ce[_0x1004('0x29')][_0x1004('0x74')]=_0x41a2ce[_0x1004('0x73')];_0x41a2ce[_0x1004('0x29')]['event']=_0x1004('0x75');return respondWithRpcPromise(_0x1004('0x76'),'EventManager',{'event':_0x1004('0x77'),'message':_0x41a2ce['message']},client9002)[_0x1004('0x35')](function(){return _0x41a2ce;});}return _0x41a2ce;}return null;})[_0x1004('0x35')](respondWithResult(_0x1f2ff2,null))['catch'](handleError(_0x1f2ff2,null));};var interaction_log=require('../../config/logger')(_0x1004('0x78'));exports[_0x1004('0x34')]=function(_0x2e88a3,_0x1459eb,_0x151724){var _0x74afd5={'agent':{},'channel':_0x1004('0x79')};if(_0x2e88a3[_0x1004('0x58')]['id']){delete _0x2e88a3[_0x1004('0x58')]['id'];}_0x2e88a3[_0x1004('0x58')][_0x1004('0x5d')]=_0x2e88a3[_0x1004('0x58')]['UserId']||_0x2e88a3[_0x1004('0x5e')]['id'];_0x74afd5[_0x1004('0x6d')]['id']=_0x2e88a3['body']['UserId'];return db[_0x1004('0x3a')][_0x1004('0x56')]({'where':{'id':_0x2e88a3['params']['id'],'UserId':null}})[_0x1004('0x35')](handleEntityNotFound(_0x1459eb,null))[_0x1004('0x35')](function(_0x23f2dc){if(_0x23f2dc){_0x74afd5[_0x1004('0x29')]=_0x23f2dc['get']({'plain':!![]});return db[_0x1004('0x7a')][_0x1004('0x56')]({'where':{'id':_0x23f2dc[_0x1004('0x60')]}});}return null;})[_0x1004('0x35')](handleEntityNotFound(_0x1459eb,null))['then'](function(_0x34be78){if(_0x34be78){_0x74afd5['interaction']=_0x34be78[_0x1004('0x5f')]({'plain':!![]});interaction_log[_0x1004('0x22')](_0x1004('0x7b'),_0x2e88a3[_0x1004('0x5e')]['id'],_0x2e88a3[_0x1004('0x5e')][_0x1004('0x37')],_0x2e88a3[_0x1004('0x5e')][_0x1004('0x65')],_0x74afd5[_0x1004('0x63')]['id'],_0x2e88a3['body']?JSON[_0x1004('0x27')](_0x2e88a3[_0x1004('0x58')]):_0x1004('0x66'));return respondWithRpcPromise('RejectMessage',_0x1004('0x7c'),_0x74afd5);}return null;})['then'](function(_0x37fe43){var _0x50ddeb=_0x1004('0x7d')+_0x37fe43['message']['ContactId'];return db[_0x1004('0x7e')][_0x1004('0x40')](_0x50ddeb,{'type':db[_0x1004('0x6a')][_0x1004('0x6b')][_0x1004('0x7f')],'raw':!![]})[_0x1004('0x35')](function(_0x3c163c){return _0x3c163c;});})[_0x1004('0x35')](function(_0x27cca7){if(_0x27cca7){_0x74afd5[_0x1004('0x29')][_0x1004('0x6c')]=_0x27cca7[0x0];if(!_0x2e88a3[_0x1004('0x58')][_0x1004('0x5d')])return;return db[_0x1004('0x80')][_0x1004('0x56')]({'where':{'id':_0x2e88a3['body'][_0x1004('0x5d')],'role':_0x1004('0x6d')},'attributes':['id',_0x1004('0x37'),_0x1004('0x81'),'email',_0x1004('0x6f')],'raw':!![]});}return null;})['then'](function(_0x113ec3){if(!_0x113ec3)return null;_0x74afd5[_0x1004('0x29')]['agent']=_0x113ec3;return _0x74afd5;})['then'](function(_0x2e02f3){if(_0x2e02f3){_0x2e02f3[_0x1004('0x29')][_0x1004('0x71')]=util[_0x1004('0x72')](_0x1004('0x82'),_0x2e88a3['user']['name']);_0x2e02f3[_0x1004('0x29')][_0x1004('0x73')]=_0x74afd5[_0x1004('0x73')];_0x2e02f3[_0x1004('0x29')][_0x1004('0x74')]=_0x74afd5['channel'];_0x2e02f3[_0x1004('0x29')][_0x1004('0x83')]=_0x1004('0x34');respondWithRpcPromise(_0x1004('0x76'),_0x1004('0x76'),{'event':_0x1004('0x84'),'message':_0x2e02f3[_0x1004('0x29')]},client9002);return _0x74afd5;}return null;})[_0x1004('0x35')](respondWithResult(_0x1459eb,null))[_0x1004('0x53')](handleError(_0x1459eb,null));};exports[_0x1004('0x85')]=function(_0xc010d,_0x58c59d){var _0x204d22;return db[_0x1004('0x3a')][_0x1004('0x85')](_0xc010d[_0x1004('0x58')],{})[_0x1004('0x35')](function(_0x262e81){_0x204d22=_0x262e81;return db[_0x1004('0x86')][_0x1004('0x87')]({'where':{'id':_0x204d22['ContactId']}});})[_0x1004('0x35')](function(_0xf63083){if(_[_0x1004('0x61')](_0xf63083)){return;}else{_0x204d22[_0x1004('0x79')]=_0xf63083[_0x1004('0x79')];return db[_0x1004('0x88')][_0x1004('0x87')]({'where':{'id':_0x204d22['AttachmentId']}});}})[_0x1004('0x35')](function(_0x4a444f){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x1004('0x61')](_0xc010d['body'])?undefined:_0xc010d['body'][_0x1004('0x89')],'path':_[_0x1004('0x61')](_0x4a444f)?undefined:util[_0x1004('0x72')](_0x1004('0x8a'),_0x4a444f[_0x1004('0x8b')]),'fax':_[_0x1004('0x61')](_0x204d22[_0x1004('0x79')])?undefined:_0x204d22[_0x1004('0x79')],'AttachmentId':_0x204d22[_0x1004('0x8c')]},client9002);})[_0x1004('0x35')](respondWithResult(_0x58c59d,0xc9))['catch'](handleError(_0x58c59d,null));};exports[_0x1004('0x8d')]=function(_0x39f07d,_0x58abe6){var _0x3f993f=path[_0x1004('0x8e')](config[_0x1004('0x8f')],_0x1004('0x90'),_0x1004('0x91'),_0x1004('0x92'));return db[_0x1004('0x3a')][_0x1004('0x56')]({'where':{'id':_0x39f07d[_0x1004('0x55')]['id']},'include':[{'model':db[_0x1004('0x88')],'as':'Attachment'}]})[_0x1004('0x35')](handleEntityNotFound(_0x58abe6,null))['then'](function(_0x12b0b4){if(_0x12b0b4){return _0x58abe6[_0x1004('0x8d')](path['join'](_0x3f993f,_0x12b0b4[_0x1004('0x88')][_0x1004('0x8b')]));}})[_0x1004('0x53')](handleError(_0x58abe6,null));}; \ No newline at end of file +var _0x71b8=['debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','status','end','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','stack','send','index','map','FaxMessage','rawAttributes','type','key','name','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','body','params','destroy','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','manual','interface','SIP/%s','channel','EventManager','acceptmessage','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','internal','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','join','root','files','attachments','Attachment','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x71b8,0x6d));var _0x871b=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x71b8[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require(_0x871b('0x0'));var rimraf=require(_0x871b('0x1'));var zipdir=require(_0x871b('0x2'));var jsonpatch=require(_0x871b('0x3'));var rp=require(_0x871b('0x4'));var moment=require(_0x871b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x871b('0x6'));var util=require(_0x871b('0x7'));var path=require(_0x871b('0x8'));var sox=require(_0x871b('0x9'));var csv=require('to-csv');var ejs=require(_0x871b('0xa'));var fs=require('fs');var fs_extra=require(_0x871b('0xb'));var _=require(_0x871b('0xc'));var squel=require(_0x871b('0xd'));var crypto=require(_0x871b('0xe'));var jsforce=require(_0x871b('0xf'));var deskjs=require(_0x871b('0x10'));var toCsv=require(_0x871b('0x11'));var querystring=require(_0x871b('0x12'));var Papa=require(_0x871b('0x13'));var Redis=require(_0x871b('0x14'));var authService=require(_0x871b('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x871b('0x16'));var logger=require(_0x871b('0x17'))('api');var utils=require(_0x871b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x871b('0x19'));var db=require(_0x871b('0x1a'))['db'];config[_0x871b('0x1b')]=_[_0x871b('0x1c')](config[_0x871b('0x1b')],{'host':_0x871b('0x1d'),'port':0x18eb});var socket=require(_0x871b('0x1e'))(new Redis(config[_0x871b('0x1b')]));require('./faxMessage.socket')[_0x871b('0x1f')](socket);var jayson=require(_0x871b('0x20'));var client=jayson[_0x871b('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x871b('0x21')][_0x871b('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x327230,_0x3125e9,_0x4caf25,_0x43da1a){return new BPromise(function(_0xf5f071,_0x9a9263){var _0x114245=_0x43da1a||client;return _0x114245[_0x871b('0x23')](_0x327230,_0x4caf25)['then'](function(_0x426c1f){logger[_0x871b('0x24')]('FaxMessage,\x20%s,\x20%s',_0x3125e9,_0x871b('0x25'));logger[_0x871b('0x26')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x3125e9,_0x871b('0x25'),JSON[_0x871b('0x27')](_0x426c1f));if(_0x426c1f[_0x871b('0x28')]){if(_0x426c1f[_0x871b('0x28')][_0x871b('0x29')]===0x1f4){logger[_0x871b('0x28')](_0x871b('0x2a'),_0x3125e9,_0x426c1f[_0x871b('0x28')][_0x871b('0x2b')]);return _0x9a9263(_0x426c1f['error']['message']);}logger['error'](_0x871b('0x2a'),_0x3125e9,_0x426c1f[_0x871b('0x28')][_0x871b('0x2b')]);return _0xf5f071(_0x426c1f[_0x871b('0x28')]['message']);}else{logger[_0x871b('0x24')](_0x871b('0x2a'),_0x3125e9,_0x871b('0x25'));_0xf5f071(_0x426c1f[_0x871b('0x2c')][_0x871b('0x2b')]);}})[_0x871b('0x2d')](function(_0x1969dd){logger['error'](_0x871b('0x2a'),_0x3125e9,_0x1969dd);_0x9a9263(_0x1969dd);});});}function respondWithStatusCode(_0x2cb7f6,_0x1dd510){_0x1dd510=_0x1dd510||0xcc;return function(_0x18f543){if(_0x18f543){return _0x2cb7f6['sendStatus'](_0x1dd510);}return _0x2cb7f6[_0x871b('0x2e')](_0x1dd510)[_0x871b('0x2f')]();};}function respondWithResult(_0xca95a7,_0x54e098){_0x54e098=_0x54e098||0xc8;return function(_0x1cf665){if(_0x1cf665){return _0xca95a7[_0x871b('0x2e')](_0x54e098)['json'](_0x1cf665);}};}function respondWithFilteredResult(_0x21682e,_0x6809ee){return function(_0x1f18c5){if(_0x1f18c5){var _0x5f30cd=typeof _0x6809ee[_0x871b('0x30')]==='undefined'&&typeof _0x6809ee[_0x871b('0x31')]===_0x871b('0x32');var _0xe52dfd=_0x1f18c5['count'];var _0x287523=_0x5f30cd?0x0:_0x6809ee['offset'];var _0x24ba5e=_0x5f30cd?_0x1f18c5[_0x871b('0x33')]:_0x6809ee['offset']+_0x6809ee[_0x871b('0x31')];var _0x2e3f60;if(_0x24ba5e>=_0xe52dfd){_0x24ba5e=_0xe52dfd;_0x2e3f60=0xc8;}else{_0x2e3f60=0xce;}_0x21682e[_0x871b('0x2e')](_0x2e3f60);return _0x21682e[_0x871b('0x34')](_0x871b('0x35'),_0x287523+'-'+_0x24ba5e+'/'+_0xe52dfd)['json'](_0x1f18c5);}return null;};}function patchUpdates(_0x3defc7){return function(_0xbed99a){try{jsonpatch['apply'](_0xbed99a,_0x3defc7,!![]);}catch(_0x305668){return BPromise[_0x871b('0x36')](_0x305668);}return _0xbed99a[_0x871b('0x37')]();};}function saveUpdates(_0x4405c4,_0x71469d){return function(_0x2ab390){if(_0x2ab390){return _0x2ab390[_0x871b('0x38')](_0x4405c4)[_0x871b('0x39')](function(_0x5f0af6){return _0x5f0af6;});}return null;};}function removeEntity(_0x46bfba,_0x5bc9b7){return function(_0x130cc2){if(_0x130cc2){return _0x130cc2['destroy']()[_0x871b('0x39')](function(){_0x46bfba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48225a,_0x3133fb){return function(_0x457257){if(!_0x457257){_0x48225a['sendStatus'](0x194);}return _0x457257;};}function handleError(_0x568e30,_0x566d6d){_0x566d6d=_0x566d6d||0x1f4;return function(_0x5ebf50){logger[_0x871b('0x28')](_0x5ebf50[_0x871b('0x3a')]);if(_0x5ebf50['name']){delete _0x5ebf50['name'];}_0x568e30[_0x871b('0x2e')](_0x566d6d)[_0x871b('0x3b')](_0x5ebf50);};}exports[_0x871b('0x3c')]=function(_0x25dd59,_0x8bf6dc){var _0x5149b4={},_0x5da19d={},_0x1e7175={'count':0x0,'rows':[]};var _0x5015fa=_[_0x871b('0x3d')](db[_0x871b('0x3e')][_0x871b('0x3f')],function(_0x5a8f9b){return{'name':_0x5a8f9b['fieldName'],'type':_0x5a8f9b[_0x871b('0x40')][_0x871b('0x41')]};});_0x5da19d['model']=_[_0x871b('0x3d')](_0x5015fa,_0x871b('0x42'));_0x5da19d[_0x871b('0x43')]=_[_0x871b('0x44')](_0x25dd59[_0x871b('0x43')]);_0x5da19d[_0x871b('0x45')]=_[_0x871b('0x46')](_0x5da19d['model'],_0x5da19d[_0x871b('0x43')]);_0x5149b4[_0x871b('0x47')]=_[_0x871b('0x46')](_0x5da19d['model'],qs[_0x871b('0x48')](_0x25dd59[_0x871b('0x43')]['fields']));_0x5149b4[_0x871b('0x47')]=_0x5149b4[_0x871b('0x47')][_0x871b('0x49')]?_0x5149b4[_0x871b('0x47')]:_0x5da19d[_0x871b('0x4a')];if(!_0x25dd59[_0x871b('0x43')][_0x871b('0x4b')]('nolimit')){_0x5149b4[_0x871b('0x31')]=qs['limit'](_0x25dd59[_0x871b('0x43')]['limit']);_0x5149b4[_0x871b('0x30')]=qs['offset'](_0x25dd59[_0x871b('0x43')][_0x871b('0x30')]);}_0x5149b4[_0x871b('0x4c')]=qs[_0x871b('0x4d')](_0x25dd59[_0x871b('0x43')][_0x871b('0x4d')]);_0x5149b4[_0x871b('0x4e')]=qs[_0x871b('0x45')](_['pick'](_0x25dd59[_0x871b('0x43')],_0x5da19d['filters']),_0x5015fa);if(_0x25dd59['query'][_0x871b('0x4f')]){_0x5149b4[_0x871b('0x4e')]=_[_0x871b('0x50')](_0x5149b4[_0x871b('0x4e')],{'$or':_[_0x871b('0x3d')](_0x5015fa,function(_0x340299){if(_0x340299[_0x871b('0x40')]!==_0x871b('0x51')){var _0x484448={};_0x484448[_0x340299[_0x871b('0x42')]]={'$like':'%'+_0x25dd59[_0x871b('0x43')]['filter']+'%'};return _0x484448;}})});}_0x5149b4=_[_0x871b('0x50')]({},_0x5149b4,_0x25dd59[_0x871b('0x52')]);var _0x182203={'where':_0x5149b4[_0x871b('0x4e')]};return db[_0x871b('0x3e')]['count'](_0x182203)['then'](function(_0x1c965c){_0x1e7175[_0x871b('0x33')]=_0x1c965c;if(_0x25dd59[_0x871b('0x43')][_0x871b('0x53')]){_0x5149b4[_0x871b('0x54')]=[{'all':!![]}];}return db[_0x871b('0x3e')][_0x871b('0x55')](_0x5149b4);})[_0x871b('0x39')](function(_0x24f58d){_0x1e7175[_0x871b('0x56')]=_0x24f58d;return _0x1e7175;})[_0x871b('0x39')](respondWithFilteredResult(_0x8bf6dc,_0x5149b4))[_0x871b('0x2d')](handleError(_0x8bf6dc,null));};exports[_0x871b('0x57')]=function(_0x2ede5a,_0xcd809d){var _0x2dfcc9={'raw':!![],'where':{'id':_0x2ede5a['params']['id']}},_0x4f17a8={};_0x4f17a8[_0x871b('0x4a')]=_[_0x871b('0x44')](db['FaxMessage'][_0x871b('0x3f')]);_0x4f17a8[_0x871b('0x43')]=_['keys'](_0x2ede5a[_0x871b('0x43')]);_0x4f17a8[_0x871b('0x45')]=_[_0x871b('0x46')](_0x4f17a8[_0x871b('0x4a')],_0x4f17a8[_0x871b('0x43')]);_0x2dfcc9[_0x871b('0x47')]=_[_0x871b('0x46')](_0x4f17a8[_0x871b('0x4a')],qs[_0x871b('0x48')](_0x2ede5a['query'][_0x871b('0x48')]));_0x2dfcc9[_0x871b('0x47')]=_0x2dfcc9[_0x871b('0x47')]['length']?_0x2dfcc9['attributes']:_0x4f17a8['model'];if(_0x2ede5a[_0x871b('0x43')][_0x871b('0x53')]){_0x2dfcc9['include']=[{'all':!![]}];}_0x2dfcc9=_['merge']({},_0x2dfcc9,_0x2ede5a[_0x871b('0x52')]);return db[_0x871b('0x3e')][_0x871b('0x58')](_0x2dfcc9)[_0x871b('0x39')](handleEntityNotFound(_0xcd809d,null))[_0x871b('0x39')](respondWithResult(_0xcd809d,null))['catch'](handleError(_0xcd809d,null));};exports['update']=function(_0x21b471,_0x17e547){if(_0x21b471[_0x871b('0x59')]['id']){delete _0x21b471[_0x871b('0x59')]['id'];}return db[_0x871b('0x3e')][_0x871b('0x58')]({'where':{'id':_0x21b471[_0x871b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x17e547,null))['then'](saveUpdates(_0x21b471[_0x871b('0x59')],null))[_0x871b('0x39')](respondWithResult(_0x17e547,null))['catch'](handleError(_0x17e547,null));};exports[_0x871b('0x5b')]=function(_0x2606c0,_0x561d15){return db[_0x871b('0x3e')][_0x871b('0x58')]({'where':{'id':_0x2606c0[_0x871b('0x5a')]['id']}})[_0x871b('0x39')](handleEntityNotFound(_0x561d15,null))[_0x871b('0x39')](removeEntity(_0x561d15,null))[_0x871b('0x2d')](handleError(_0x561d15,null));};exports['describe']=function(_0x4a7fa6,_0x1adfbd){return db[_0x871b('0x3e')][_0x871b('0x5c')]()[_0x871b('0x39')](respondWithResult(_0x1adfbd,null))[_0x871b('0x2d')](handleError(_0x1adfbd,null));};var interaction_log=require('../../config/logger')(_0x871b('0x5d'));exports[_0x871b('0x5e')]=function(_0x530ff3,_0x6cdb06,_0x5324bb){var _0x47c292={'agent':{},'channel':_0x871b('0x5f')};if(_0x530ff3[_0x871b('0x59')]['id']){delete _0x530ff3['body']['id'];}_0x530ff3[_0x871b('0x59')][_0x871b('0x60')]=!![];_0x530ff3['body']['readAt']=moment()[_0x871b('0x61')](_0x871b('0x62'));_0x530ff3[_0x871b('0x59')][_0x871b('0x63')]=_0x530ff3[_0x871b('0x59')][_0x871b('0x63')]||_0x530ff3[_0x871b('0x64')]['id'];_0x47c292[_0x871b('0x65')]['id']=_0x530ff3[_0x871b('0x59')]['UserId'];return db[_0x871b('0x3e')]['find']({'where':{'id':_0x530ff3['params']['id'],'UserId':null}})[_0x871b('0x39')](handleEntityNotFound(_0x6cdb06,null))[_0x871b('0x39')](saveUpdates(_0x530ff3[_0x871b('0x59')],null))[_0x871b('0x39')](function(_0x152d21){if(_0x152d21){_0x47c292[_0x871b('0x2b')]=_0x152d21[_0x871b('0x66')]({'plain':!![]});return db[_0x871b('0x67')][_0x871b('0x58')]({'where':{'id':_0x152d21['FaxInteractionId']}});}return null;})[_0x871b('0x39')](handleEntityNotFound(_0x6cdb06,null))[_0x871b('0x39')](function(_0x293a86){if(_0x293a86){return _0x293a86[_0x871b('0x38')]({'UserId':_0x530ff3[_0x871b('0x59')]['UserId'],'read1stAt':_[_0x871b('0x68')](_0x293a86[_0x871b('0x69')])?moment()[_0x871b('0x61')](_0x871b('0x62')):undefined});}return null;})[_0x871b('0x39')](function(_0x4edeed){if(_0x4edeed){_0x47c292[_0x871b('0x6a')]=_0x4edeed['get']({'plain':!![]});interaction_log[_0x871b('0x24')](_0x871b('0x6b'),_0x530ff3['user']['id'],_0x530ff3[_0x871b('0x64')][_0x871b('0x42')],_0x530ff3['user'][_0x871b('0x6c')],_0x47c292[_0x871b('0x6a')]['id'],_0x530ff3[_0x871b('0x59')]?JSON[_0x871b('0x27')](_0x530ff3[_0x871b('0x59')]):_0x871b('0x6d'));return respondWithRpcPromise(_0x871b('0x6e'),_0x871b('0x6f'),_0x47c292);}return null;})['then'](function(_0x134e84){var _0x56a659=_0x871b('0x70')+_0x134e84[_0x871b('0x2b')][_0x871b('0x71')];return db[_0x871b('0x72')][_0x871b('0x43')](_0x56a659,{'type':db[_0x871b('0x73')][_0x871b('0x74')][_0x871b('0x75')],'raw':!![]})[_0x871b('0x39')](function(_0x5a8f6b){return _0x5a8f6b;});})[_0x871b('0x39')](function(_0xbca515){if(_0xbca515){_0x47c292['message'][_0x871b('0x76')]=_0xbca515[0x0];if(!_0x530ff3[_0x871b('0x59')][_0x871b('0x63')])return;return db['User'][_0x871b('0x58')]({'where':{'id':_0x530ff3[_0x871b('0x59')]['UserId'],'role':_0x871b('0x65')},'attributes':['id',_0x871b('0x42'),_0x871b('0x77'),_0x871b('0x78'),'internal'],'raw':!![]});}return null;})[_0x871b('0x39')](function(_0x360508){if(!_0x360508)return null;_0x47c292[_0x871b('0x2b')][_0x871b('0x65')]=_0x360508;return _0x47c292;})['then'](function(_0x3837fd){if(_0x3837fd){if(_0x530ff3[_0x871b('0x59')][_0x871b('0x79')]){_0x47c292['message'][_0x871b('0x7a')]=util[_0x871b('0x61')](_0x871b('0x7b'),_0x530ff3[_0x871b('0x64')]['name']);_0x47c292[_0x871b('0x2b')]['channel']=_0x47c292[_0x871b('0x7c')];_0x47c292[_0x871b('0x2b')]['motionChannel']=_0x47c292[_0x871b('0x7c')];_0x47c292['message']['event']='accept';return respondWithRpcPromise(_0x871b('0x7d'),_0x871b('0x7d'),{'event':_0x871b('0x7e'),'message':_0x47c292['message']},client9002)[_0x871b('0x39')](function(){return _0x47c292;});}return _0x47c292;}return null;})[_0x871b('0x39')](respondWithResult(_0x6cdb06,null))['catch'](handleError(_0x6cdb06,null));};var interaction_log=require('../../config/logger')(_0x871b('0x5d'));exports['reject']=function(_0x20bb8e,_0x2ef535,_0x23ef3b){var _0x11887e={'agent':{},'channel':_0x871b('0x5f')};if(_0x20bb8e['body']['id']){delete _0x20bb8e[_0x871b('0x59')]['id'];}_0x20bb8e[_0x871b('0x59')][_0x871b('0x63')]=_0x20bb8e['body'][_0x871b('0x63')]||_0x20bb8e[_0x871b('0x64')]['id'];_0x11887e[_0x871b('0x65')]['id']=_0x20bb8e[_0x871b('0x59')][_0x871b('0x63')];return db[_0x871b('0x3e')]['find']({'where':{'id':_0x20bb8e[_0x871b('0x5a')]['id'],'UserId':null}})[_0x871b('0x39')](handleEntityNotFound(_0x2ef535,null))[_0x871b('0x39')](function(_0xde6308){if(_0xde6308){_0x11887e[_0x871b('0x2b')]=_0xde6308['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0xde6308[_0x871b('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0x2ef535,null))[_0x871b('0x39')](function(_0x21b50e){if(_0x21b50e){_0x11887e['interaction']=_0x21b50e[_0x871b('0x66')]({'plain':!![]});interaction_log[_0x871b('0x24')](_0x871b('0x80'),_0x20bb8e[_0x871b('0x64')]['id'],_0x20bb8e['user']['name'],_0x20bb8e[_0x871b('0x64')][_0x871b('0x6c')],_0x11887e[_0x871b('0x6a')]['id'],_0x20bb8e[_0x871b('0x59')]?JSON[_0x871b('0x27')](_0x20bb8e[_0x871b('0x59')]):_0x871b('0x6d'));return respondWithRpcPromise(_0x871b('0x81'),_0x871b('0x82'),_0x11887e);}return null;})[_0x871b('0x39')](function(_0x4661f4){var _0x24f150=_0x871b('0x70')+_0x4661f4[_0x871b('0x2b')][_0x871b('0x71')];return db[_0x871b('0x72')][_0x871b('0x43')](_0x24f150,{'type':db[_0x871b('0x73')]['QueryTypes'][_0x871b('0x75')],'raw':!![]})['then'](function(_0x60cae2){return _0x60cae2;});})[_0x871b('0x39')](function(_0xbf29c){if(_0xbf29c){_0x11887e['message'][_0x871b('0x76')]=_0xbf29c[0x0];if(!_0x20bb8e[_0x871b('0x59')][_0x871b('0x63')])return;return db[_0x871b('0x83')][_0x871b('0x58')]({'where':{'id':_0x20bb8e[_0x871b('0x59')][_0x871b('0x63')],'role':_0x871b('0x65')},'attributes':['id',_0x871b('0x42'),_0x871b('0x77'),_0x871b('0x78'),_0x871b('0x84')],'raw':!![]});}return null;})[_0x871b('0x39')](function(_0x50327f){if(!_0x50327f)return null;_0x11887e[_0x871b('0x2b')][_0x871b('0x65')]=_0x50327f;return _0x11887e;})['then'](function(_0x21fa36){if(_0x21fa36){_0x21fa36[_0x871b('0x2b')][_0x871b('0x7a')]=util[_0x871b('0x61')](_0x871b('0x7b'),_0x20bb8e[_0x871b('0x64')]['name']);_0x21fa36[_0x871b('0x2b')][_0x871b('0x7c')]=_0x11887e[_0x871b('0x7c')];_0x21fa36[_0x871b('0x2b')]['motionChannel']=_0x11887e['channel'];_0x21fa36['message']['event']='reject';respondWithRpcPromise(_0x871b('0x7d'),_0x871b('0x7d'),{'event':_0x871b('0x85'),'message':_0x21fa36[_0x871b('0x2b')]},client9002);return _0x11887e;}return null;})[_0x871b('0x39')](respondWithResult(_0x2ef535,null))['catch'](handleError(_0x2ef535,null));};exports['create']=function(_0x54fe9c,_0x1419a5){var _0x2733da;return db[_0x871b('0x3e')][_0x871b('0x86')](_0x54fe9c[_0x871b('0x59')],{})[_0x871b('0x39')](function(_0x4c3287){_0x2733da=_0x4c3287;return db[_0x871b('0x87')][_0x871b('0x88')]({'where':{'id':_0x2733da['ContactId']}});})['then'](function(_0x3904e7){if(_[_0x871b('0x68')](_0x3904e7)){return;}else{_0x2733da[_0x871b('0x5f')]=_0x3904e7[_0x871b('0x5f')];return db['Attachment'][_0x871b('0x88')]({'where':{'id':_0x2733da[_0x871b('0x89')]}});}})[_0x871b('0x39')](function(_0x4667fb){return respondWithRpcPromise(_0x871b('0x8a'),_0x871b('0x8a'),{'FaxAccountId':_[_0x871b('0x68')](_0x54fe9c[_0x871b('0x59')])?undefined:_0x54fe9c[_0x871b('0x59')]['FaxAccountId'],'path':_['isNil'](_0x4667fb)?undefined:util[_0x871b('0x61')](_0x871b('0x8b'),_0x4667fb[_0x871b('0x8c')]),'fax':_[_0x871b('0x68')](_0x2733da[_0x871b('0x5f')])?undefined:_0x2733da[_0x871b('0x5f')],'AttachmentId':_0x2733da[_0x871b('0x89')]},client9002);})[_0x871b('0x39')](respondWithResult(_0x1419a5,0xc9))['catch'](handleError(_0x1419a5,null));};exports['download']=function(_0x45e1e6,_0x3c4b7c){var _0x5aab5b=path[_0x871b('0x8d')](config[_0x871b('0x8e')],'server',_0x871b('0x8f'),_0x871b('0x90'));return db[_0x871b('0x3e')][_0x871b('0x58')]({'where':{'id':_0x45e1e6['params']['id']},'include':[{'model':db[_0x871b('0x91')],'as':'Attachment'}]})[_0x871b('0x39')](handleEntityNotFound(_0x3c4b7c,null))[_0x871b('0x39')](function(_0x3b8cdc){if(_0x3b8cdc){return _0x3c4b7c[_0x871b('0x92')](path[_0x871b('0x8d')](_0x5aab5b,_0x3b8cdc[_0x871b('0x91')]['basename']));}})[_0x871b('0x2d')](handleError(_0x3c4b7c,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 8e50aa1..794672a 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 _0xe635=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save'];(function(_0x335d0f,_0x4688fd){var _0x22c74f=function(_0x4d1336){while(--_0x4d1336){_0x335d0f['push'](_0x335d0f['shift']());}};_0x22c74f(++_0x4688fd);}(_0xe635,0x1be));var _0x5e63=function(_0x2c7d37,_0x1b995c){_0x2c7d37=_0x2c7d37-0x0;var _0x4c6830=_0xe635[_0x2c7d37];return _0x4c6830;};'use strict';var EventEmitter=require(_0x5e63('0x0'));var FaxMessage=require(_0x5e63('0x1'))['db'][_0x5e63('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x5e63('0x3')](0x0);var events={'afterCreate':_0x5e63('0x4'),'afterUpdate':_0x5e63('0x5'),'afterDestroy':_0x5e63('0x6')};function emitEvent(_0x585c30){return function(_0x56a8b5,_0x352338,_0x30e8d1){FaxMessageEvents[_0x5e63('0x7')](_0x585c30+':'+_0x56a8b5['id'],_0x56a8b5);FaxMessageEvents[_0x5e63('0x7')](_0x585c30,_0x56a8b5);_0x30e8d1(null);};}for(var e in events){if(events[_0x5e63('0x8')](e)){var event=events[e];FaxMessage[_0x5e63('0x9')](e,emitEvent(event));}}module[_0x5e63('0xa')]=FaxMessageEvents; \ No newline at end of file +var _0xae35=['events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x3358e1,_0x2a03e8){var _0x566410=function(_0x5a37a9){while(--_0x5a37a9){_0x3358e1['push'](_0x3358e1['shift']());}};_0x566410(++_0x2a03e8);}(_0xae35,0x172));var _0x5ae3=function(_0x1d6f55,_0x219fdb){_0x1d6f55=_0x1d6f55-0x0;var _0x4d3189=_0xae35[_0x1d6f55];return _0x4d3189;};'use strict';var EventEmitter=require(_0x5ae3('0x0'));var FaxMessage=require(_0x5ae3('0x1'))['db'][_0x5ae3('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x5ae3('0x3')](0x0);var events={'afterCreate':_0x5ae3('0x4'),'afterUpdate':_0x5ae3('0x5'),'afterDestroy':_0x5ae3('0x6')};function emitEvent(_0x39d9b7){return function(_0x54c0f2,_0x6dffe3,_0x4d1536){FaxMessageEvents[_0x5ae3('0x7')](_0x39d9b7+':'+_0x54c0f2['id'],_0x54c0f2);FaxMessageEvents[_0x5ae3('0x7')](_0x39d9b7,_0x54c0f2);_0x4d1536(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x5ae3('0x8')](e,emitEvent(event));}}module[_0x5ae3('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index cba1332..c137f63 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 _0x2389=['exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','toLowerCase','direction','out','isNil','UserId','findOne','FaxInteractionId','createdAt','error','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0xcad1c3,_0x24fe36){var _0x34c2c5=function(_0x545139){while(--_0x545139){_0xcad1c3['push'](_0xcad1c3['shift']());}};_0x34c2c5(++_0x24fe36);}(_0x2389,0x1da));var _0x9238=function(_0x28ff8f,_0x342ed9){_0x28ff8f=_0x28ff8f-0x0;var _0x35a754=_0x2389[_0x28ff8f];return _0x35a754;};'use strict';var _=require(_0x9238('0x0'));var util=require('util');var logger=require(_0x9238('0x1'))(_0x9238('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9238('0x3'));var fs=require('fs');var path=require(_0x9238('0x4'));var rimraf=require(_0x9238('0x5'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0x9238('0x6')]=function(_0x20b9c1,_0x54f9aa){return _0x20b9c1[_0x9238('0x7')](_0x9238('0x8'),attributes,{'tableName':_0x9238('0x9'),'paranoid':![],'indexes':[{'name':_0x9238('0xa'),'fields':[_0x9238('0xb')],'type':_0x9238('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x155b92,_0x5eadd4,_0x3c08b4){var _0x8010e=_0x20b9c1['models'];var _0x46a0ee=_0x155b92[_0x9238('0xd')]({'plain':!![]});if(_0x46a0ee['direction'][_0x9238('0xe')]()==='in'||_0x46a0ee[_0x9238('0xf')][_0x9238('0xe')]()===_0x9238('0x10')&&!_0x46a0ee['secret']&&!_[_0x9238('0x11')](_0x46a0ee[_0x9238('0x12')])){_0x8010e['FaxInteraction'][_0x9238('0x13')]({'where':{'id':_0x46a0ee[_0x9238('0x14')]}})['then'](function(_0x5122d5){if(_0x5122d5){_0x5122d5['update']({'lastMsgAt':_0x46a0ee[_0x9238('0x15')],'lastMsgDirection':_0x46a0ee[_0x9238('0xf')]['toLowerCase']()});}})['catch'](function(_0x1a88a5){console[_0x9238('0x16')](_0x1a88a5);});}_0x3c08b4();}},'charset':'utf8mb4','collate':_0x9238('0x17')});}; \ No newline at end of file +var _0xe900=['toLowerCase','out','isNil','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','direction'];(function(_0x2694ea,_0x1018fd){var _0xafa4ce=function(_0x394cc9){while(--_0x394cc9){_0x2694ea['push'](_0x2694ea['shift']());}};_0xafa4ce(++_0x1018fd);}(_0xe900,0x1bf));var _0x0e90=function(_0x486364,_0x31b03b){_0x486364=_0x486364-0x0;var _0x23209c=_0xe900[_0x486364];return _0x23209c;};'use strict';var _=require('lodash');var util=require(_0x0e90('0x0'));var logger=require(_0x0e90('0x1'))(_0x0e90('0x2'));var moment=require(_0x0e90('0x3'));var BPromise=require('bluebird');var rp=require(_0x0e90('0x4'));var fs=require('fs');var path=require(_0x0e90('0x5'));var rimraf=require(_0x0e90('0x6'));var config=require(_0x0e90('0x7'));var attributes=require('./faxMessage.attributes');module[_0x0e90('0x8')]=function(_0x31202a,_0x33526b){return _0x31202a[_0x0e90('0x9')](_0x0e90('0xa'),attributes,{'tableName':_0x0e90('0xb'),'paranoid':![],'indexes':[{'name':_0x0e90('0xc'),'fields':[_0x0e90('0xd')],'type':_0x0e90('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x367bd2,_0x2af699,_0x4cc0cf){var _0x20e03c=_0x31202a['models'];var _0x2f33ee=_0x367bd2[_0x0e90('0xf')]({'plain':!![]});if(_0x2f33ee[_0x0e90('0x10')][_0x0e90('0x11')]()==='in'||_0x2f33ee[_0x0e90('0x10')][_0x0e90('0x11')]()===_0x0e90('0x12')&&!_0x2f33ee['secret']&&!_[_0x0e90('0x13')](_0x2f33ee['UserId'])){_0x20e03c[_0x0e90('0x14')][_0x0e90('0x15')]({'where':{'id':_0x2f33ee[_0x0e90('0x16')]}})[_0x0e90('0x17')](function(_0x16a78e){if(_0x16a78e){_0x16a78e[_0x0e90('0x18')]({'lastMsgAt':_0x2f33ee[_0x0e90('0x19')],'lastMsgDirection':_0x2f33ee[_0x0e90('0x10')][_0x0e90('0x11')]()});}})[_0x0e90('0x1a')](function(_0x1f5fd5){console[_0x0e90('0x1b')](_0x1f5fd5);});}_0x4cc0cf();}},'charset':_0x0e90('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 95bf671..d96f43d 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 _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','info','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage','FaxMessage','body','raw','then','debug','catch','UpdateFaxMessage','update','options','where','attributes','limit'];(function(_0x1b650d,_0x3d2b17){var _0xe44259=function(_0x250b4a){while(--_0x250b4a){_0x1b650d['push'](_0x1b650d['shift']());}};_0xe44259(++_0x3d2b17);}(_0x9f62,0x154));var _0x29f6=function(_0x1f43fd,_0x14e995){_0x1f43fd=_0x1f43fd-0x0;var _0x511976=_0x9f62[_0x1f43fd];return _0x511976;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});config[_0x29f6('0x9')]=_[_0x29f6('0xa')](config[_0x29f6('0x9')],{'host':_0x29f6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0xe25841,_0x44db16,_0x4fb455){return new BPromise(function(_0x5a0724,_0x29b3f5){return client[_0x29f6('0xc')](_0xe25841,_0x4fb455)['then'](function(_0x17b69c){logger[_0x29f6('0xd')]('FaxMessage,\x20%s,\x20%s',_0x44db16,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'),JSON[_0x29f6('0xf')](_0x17b69c));if(_0x17b69c[_0x29f6('0x10')]){if(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x11')]===0x1f4){logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x29b3f5(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x5a0724(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'));_0x5a0724(_0x17b69c[_0x29f6('0x14')][_0x29f6('0x13')]);}})['catch'](function(_0xcb90){logger[_0x29f6('0x10')]('FaxMessage,\x20%s,\x20%s',_0x44db16,_0xcb90);_0x29b3f5(_0xcb90);});});}exports[_0x29f6('0x15')]=function(_0x3e81af){var _0x42a8fa=this;return new Promise(function(_0x41b9f0,_0xb6e7a9){return db[_0x29f6('0x16')]['create'](_0x3e81af[_0x29f6('0x17')],{'raw':_0x3e81af['options']?_0x3e81af['options'][_0x29f6('0x18')]===undefined?!![]:![]:!![]})[_0x29f6('0x19')](function(_0x39c6b3){logger[_0x29f6('0xd')]('CreateFaxMessage',_0x3e81af);logger[_0x29f6('0x1a')]('CreateFaxMessage',_0x3e81af,JSON[_0x29f6('0xf')](_0x39c6b3));_0x41b9f0(_0x39c6b3);})[_0x29f6('0x1b')](function(_0x4200cc){logger[_0x29f6('0x10')]('CreateFaxMessage',_0x4200cc[_0x29f6('0x13')],_0x3e81af);_0xb6e7a9(_0x42a8fa[_0x29f6('0x10')](0x1f4,_0x4200cc['message']));});});};exports[_0x29f6('0x1c')]=function(_0x45f792){var _0x2519ac=this;return new Promise(function(_0x342038,_0x84ccb7){return db[_0x29f6('0x16')][_0x29f6('0x1d')](_0x45f792['body'],{'raw':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x1f')]||null:null,'attributes':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x20')]||null:null,'limit':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x21')]||null:null})[_0x29f6('0x19')](function(_0x304c28){logger[_0x29f6('0xd')](_0x29f6('0x1c'),_0x45f792);logger[_0x29f6('0x1a')]('UpdateFaxMessage',_0x45f792,JSON['stringify'](_0x304c28));_0x342038(_0x304c28);})[_0x29f6('0x1b')](function(_0x489897){logger[_0x29f6('0x10')](_0x29f6('0x1c'),_0x489897[_0x29f6('0x13')],_0x45f792);_0x84ccb7(_0x2519ac[_0x29f6('0x10')](0x1f4,_0x489897['message']));});});}; \ No newline at end of file +var _0xd6d6=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','raw','info','CreateFaxMessage','update','where','limit','UpdateFaxMessage'];(function(_0x37f13f,_0x5c46c0){var _0x16a49e=function(_0x2a6ad4){while(--_0x2a6ad4){_0x37f13f['push'](_0x37f13f['shift']());}};_0x16a49e(++_0x5c46c0);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x2b937b,_0x262036){_0x2b937b=_0x2b937b-0x0;var _0x22e713=_0xd6d6[_0x2b937b];return _0x22e713;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});config[_0x6d6d('0xc')]=_[_0x6d6d('0xd')](config[_0x6d6d('0xc')],{'host':_0x6d6d('0xe'),'port':0x18eb});var socket=require(_0x6d6d('0xf'))(new Redis(config[_0x6d6d('0xc')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x404c88,_0x1fa46d,_0x23b18a){return new BPromise(function(_0x290dfb,_0xf84314){return client['request'](_0x404c88,_0x23b18a)[_0x6d6d('0x10')](function(_0x158f82){logger['info']('FaxMessage,\x20%s,\x20%s',_0x1fa46d,_0x6d6d('0x11'));logger[_0x6d6d('0x12')](_0x6d6d('0x13'),_0x1fa46d,_0x6d6d('0x11'),JSON[_0x6d6d('0x14')](_0x158f82));if(_0x158f82[_0x6d6d('0x15')]){if(_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x16')]===0x1f4){logger['error'](_0x6d6d('0x17'),_0x1fa46d,_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x18')]);return _0xf84314(_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x18')]);}logger['error'](_0x6d6d('0x17'),_0x1fa46d,_0x158f82['error'][_0x6d6d('0x18')]);return _0x290dfb(_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x18')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x1fa46d,_0x6d6d('0x11'));_0x290dfb(_0x158f82[_0x6d6d('0x19')][_0x6d6d('0x18')]);}})[_0x6d6d('0x1a')](function(_0x51fff6){logger['error'](_0x6d6d('0x17'),_0x1fa46d,_0x51fff6);_0xf84314(_0x51fff6);});});}exports['CreateFaxMessage']=function(_0x26f631){var _0xb8590d=this;return new Promise(function(_0x30d87d,_0x450352){return db[_0x6d6d('0x1b')][_0x6d6d('0x1c')](_0x26f631[_0x6d6d('0x1d')],{'raw':_0x26f631[_0x6d6d('0x1e')]?_0x26f631[_0x6d6d('0x1e')][_0x6d6d('0x1f')]===undefined?!![]:![]:!![]})[_0x6d6d('0x10')](function(_0x6e58e3){logger[_0x6d6d('0x20')](_0x6d6d('0x21'),_0x26f631);logger[_0x6d6d('0x12')](_0x6d6d('0x21'),_0x26f631,JSON[_0x6d6d('0x14')](_0x6e58e3));_0x30d87d(_0x6e58e3);})['catch'](function(_0x3b73e5){logger[_0x6d6d('0x15')](_0x6d6d('0x21'),_0x3b73e5[_0x6d6d('0x18')],_0x26f631);_0x450352(_0xb8590d[_0x6d6d('0x15')](0x1f4,_0x3b73e5[_0x6d6d('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x2851dd){var _0x2b5e31=this;return new Promise(function(_0x235451,_0x126ac8){return db[_0x6d6d('0x1b')][_0x6d6d('0x22')](_0x2851dd[_0x6d6d('0x1d')],{'raw':_0x2851dd['options']?_0x2851dd[_0x6d6d('0x1e')][_0x6d6d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2851dd['options']?_0x2851dd['options'][_0x6d6d('0x23')]||null:null,'attributes':_0x2851dd[_0x6d6d('0x1e')]?_0x2851dd[_0x6d6d('0x1e')]['attributes']||null:null,'limit':_0x2851dd[_0x6d6d('0x1e')]?_0x2851dd[_0x6d6d('0x1e')][_0x6d6d('0x24')]||null:null})[_0x6d6d('0x10')](function(_0x64d1f7){logger[_0x6d6d('0x20')](_0x6d6d('0x25'),_0x2851dd);logger[_0x6d6d('0x12')](_0x6d6d('0x25'),_0x2851dd,JSON[_0x6d6d('0x14')](_0x64d1f7));_0x235451(_0x64d1f7);})['catch'](function(_0x1f9469){logger['error'](_0x6d6d('0x25'),_0x1f9469[_0x6d6d('0x18')],_0x2851dd);_0x126ac8(_0x2b5e31[_0x6d6d('0x15')](0x1f4,_0x1f9469[_0x6d6d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 7cbb676..029eecb 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 _0x69ae=['removeListener','register','length','remove','emit'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0x69ae,0xee));var _0xe69a=function(_0x4ac7ae,_0x167789){_0x4ac7ae=_0x4ac7ae-0x0;var _0x3162f4=_0x69ae[_0x4ac7ae];return _0x3162f4;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save',_0xe69a('0x0'),'update'];function createListener(_0x5aaeaf,_0x540a6b){return function(_0x20730f){_0x540a6b[_0xe69a('0x1')](_0x5aaeaf,_0x20730f);};}function removeListener(_0x2f3e02,_0x433676){return function(){FaxMessageEvents[_0xe69a('0x2')](_0x2f3e02,_0x433676);};}exports[_0xe69a('0x3')]=function(_0x1ce09b){for(var _0x226c94=0x0,_0x568f54=events[_0xe69a('0x4')];_0x226c94<_0x568f54;_0x226c94++){var _0x30c43e=events[_0x226c94];var _0x4afd25=createListener('faxMessage:'+_0x30c43e,_0x1ce09b);FaxMessageEvents['on'](_0x30c43e,_0x4afd25);}}; \ No newline at end of file +var _0xec90=['save','remove','update','removeListener','register','length','faxMessage:','./faxMessage.events'];(function(_0x5bad92,_0x49ce3a){var _0x4a907c=function(_0x2bb1a1){while(--_0x2bb1a1){_0x5bad92['push'](_0x5bad92['shift']());}};_0x4a907c(++_0x49ce3a);}(_0xec90,0xcf));var _0x0ec9=function(_0x24fa88,_0x4007b2){_0x24fa88=_0x24fa88-0x0;var _0x2a7377=_0xec90[_0x24fa88];return _0x2a7377;};'use strict';var FaxMessageEvents=require(_0x0ec9('0x0'));var events=[_0x0ec9('0x1'),_0x0ec9('0x2'),_0x0ec9('0x3')];function createListener(_0xe5ebdf,_0x1742eb){return function(_0x3193e6){_0x1742eb['emit'](_0xe5ebdf,_0x3193e6);};}function removeListener(_0x5d316e,_0x33e0dc){return function(){FaxMessageEvents[_0x0ec9('0x4')](_0x5d316e,_0x33e0dc);};}exports[_0x0ec9('0x5')]=function(_0x1e8679){for(var _0x48b4dc=0x0,_0x5933e2=events[_0x0ec9('0x6')];_0x48b4dc<_0x5933e2;_0x48b4dc++){var _0x196685=events[_0x48b4dc];var _0xa27ec8=createListener(_0x0ec9('0x7')+_0x196685,_0x1e8679);FaxMessageEvents['on'](_0x196685,_0xa27ec8);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 439e20c..13a96f5 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 _0x3140=['download','post','tracked','fax','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x340a6b,_0xfb9414){var _0x1f5ffd=function(_0x1233f3){while(--_0x1233f3){_0x340a6b['push'](_0x340a6b['shift']());}};_0x1f5ffd(++_0xfb9414);}(_0x3140,0xaf));var _0x0314=function(_0x47a940,_0x50c7bc){_0x47a940=_0x47a940-0x0;var _0x408cc8=_0x3140[_0x47a940];return _0x408cc8;};'use strict';var multer=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var timeout=require(_0x0314('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0314('0x4'));var auth=require(_0x0314('0x5'));var interaction=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var controller=require(_0x0314('0x8'));router[_0x0314('0x9')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0xb')]);router[_0x0314('0x9')](_0x0314('0xc'),auth[_0x0314('0xa')](),controller['describe']);router[_0x0314('0x9')](_0x0314('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0314('0x9')]('/:id/download',auth[_0x0314('0xa')](),controller[_0x0314('0xe')]);router[_0x0314('0xf')]('/',auth[_0x0314('0xa')](),interaction[_0x0314('0x10')](_0x0314('0x11'),'faxmessage:create'),controller[_0x0314('0x12')]);router[_0x0314('0x13')](_0x0314('0xd'),auth[_0x0314('0xa')](),controller[_0x0314('0x14')]);router[_0x0314('0x13')](_0x0314('0x15'),auth['isAuthenticated'](),controller[_0x0314('0x16')]);router[_0x0314('0x13')](_0x0314('0x17'),auth[_0x0314('0xa')](),controller[_0x0314('0x18')]);router[_0x0314('0x19')](_0x0314('0xd'),auth[_0x0314('0xa')](),controller['destroy']);module[_0x0314('0x1a')]=router; \ No newline at end of file +var _0xa571=['download','post','tracked','fax','put','/:id/accept','accept','/:id/reject','reject','delete','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/download'];(function(_0x369f4c,_0x58d926){var _0x1746c8=function(_0xfcc375){while(--_0xfcc375){_0x369f4c['push'](_0x369f4c['shift']());}};_0x1746c8(++_0x58d926);}(_0xa571,0x107));var _0x1a57=function(_0x3573a4,_0x52f833){_0x3573a4=_0x3573a4-0x0;var _0x33ba3f=_0xa571[_0x3573a4];return _0x33ba3f;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./faxMessage.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['describe']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')]('/',auth[_0x1a57('0x8')](),interaction[_0x1a57('0xf')](_0x1a57('0x10'),'faxmessage:create'),controller['create']);router[_0x1a57('0x11')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['update']);router[_0x1a57('0x11')](_0x1a57('0x12'),auth['isAuthenticated'](),controller[_0x1a57('0x13')]);router['put'](_0x1a57('0x14'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x15')]);router[_0x1a57('0x16')]('/:id',auth[_0x1a57('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 86c0a9e..474a76e 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 _0xb6dc=['beepall','roundrobin','exports','STRING','name','INTEGER','rrmemory'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0xb6dc,0xaa));var _0xcb6d=function(_0x1d3ce6,_0x32f1fb){_0x1d3ce6=_0x1d3ce6-0x0;var _0x3db33a=_0xb6dc[_0x1d3ce6];return _0x3db33a;};'use strict';var Sequelize=require('sequelize');module[_0xcb6d('0x0')]={'name':{'type':Sequelize[_0xcb6d('0x1')],'unique':_0xcb6d('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcb6d('0x1')]},'timeout':{'type':Sequelize[_0xcb6d('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xcb6d('0x4'),_0xcb6d('0x5'),_0xcb6d('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6632=['INTEGER','rrmemory','sequelize','name','STRING'];(function(_0x39080d,_0x5a6b27){var _0x4b6884=function(_0x34d9d1){while(--_0x34d9d1){_0x39080d['push'](_0x39080d['shift']());}};_0x4b6884(++_0x5a6b27);}(_0x6632,0xed));var _0x2663=function(_0x329454,_0x466785){_0x329454=_0x329454-0x0;var _0x173b8e=_0x6632[_0x329454];return _0x173b8e;};'use strict';var Sequelize=require(_0x2663('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2663('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2663('0x2')]},'timeout':{'type':Sequelize[_0x2663('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2663('0x4'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2663('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index bc6beec..e8f5cfc 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 _0xd668=['hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','find','describe','getMembers','findOne','sort','UserFaxQueue','User','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','params','sequelize','each','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','get','UserProfileResource','destroy','error','name','send','map','FaxQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x5d4d0b,_0x2f6942){var _0xf86455=function(_0x2485ac){while(--_0x2485ac){_0x5d4d0b['push'](_0x5d4d0b['shift']());}};_0xf86455(++_0x2f6942);}(_0xd668,0x170));var _0x8d66=function(_0x39707d,_0xc4b704){_0x39707d=_0x39707d-0x0;var _0x589438=_0xd668[_0x39707d];return _0x589438;};'use strict';var emlformat=require(_0x8d66('0x0'));var rimraf=require(_0x8d66('0x1'));var zipdir=require(_0x8d66('0x2'));var jsonpatch=require(_0x8d66('0x3'));var rp=require(_0x8d66('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8d66('0x5'));var util=require(_0x8d66('0x6'));var path=require(_0x8d66('0x7'));var sox=require('sox');var csv=require(_0x8d66('0x8'));var ejs=require(_0x8d66('0x9'));var fs=require('fs');var fs_extra=require(_0x8d66('0xa'));var _=require(_0x8d66('0xb'));var squel=require('squel');var crypto=require(_0x8d66('0xc'));var jsforce=require(_0x8d66('0xd'));var deskjs=require(_0x8d66('0xe'));var toCsv=require(_0x8d66('0x8'));var querystring=require(_0x8d66('0xf'));var Papa=require(_0x8d66('0x10'));var Redis=require(_0x8d66('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d66('0x12'));var logger=require(_0x8d66('0x13'))('api');var utils=require(_0x8d66('0x14'));var config=require(_0x8d66('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d66('0x16'))['db'];config[_0x8d66('0x17')]=_[_0x8d66('0x18')](config[_0x8d66('0x17')],{'host':_0x8d66('0x19'),'port':0x18eb});var socket=require(_0x8d66('0x1a'))(new Redis(config[_0x8d66('0x17')]));require(_0x8d66('0x1b'))['register'](socket);function respondWithStatusCode(_0x65e4c5,_0x2696df){_0x2696df=_0x2696df||0xcc;return function(_0x4b517f){if(_0x4b517f){return _0x65e4c5[_0x8d66('0x1c')](_0x2696df);}return _0x65e4c5['status'](_0x2696df)[_0x8d66('0x1d')]();};}function respondWithResult(_0x4659b5,_0xfb9ed0){_0xfb9ed0=_0xfb9ed0||0xc8;return function(_0x26e9f5){if(_0x26e9f5){return _0x4659b5[_0x8d66('0x1e')](_0xfb9ed0)[_0x8d66('0x1f')](_0x26e9f5);}};}function respondWithFilteredResult(_0x41bdf2,_0x101266){return function(_0x2b1e99){if(_0x2b1e99){var _0x46eb72=typeof _0x101266[_0x8d66('0x20')]===_0x8d66('0x21')&&typeof _0x101266[_0x8d66('0x22')]===_0x8d66('0x21');var _0x59eab6=_0x2b1e99[_0x8d66('0x23')];var _0x4bf647=_0x46eb72?0x0:_0x101266[_0x8d66('0x20')];var _0x1b2ec3=_0x46eb72?_0x2b1e99[_0x8d66('0x23')]:_0x101266['offset']+_0x101266[_0x8d66('0x22')];var _0x1741f3;if(_0x1b2ec3>=_0x59eab6){_0x1b2ec3=_0x59eab6;_0x1741f3=0xc8;}else{_0x1741f3=0xce;}_0x41bdf2[_0x8d66('0x1e')](_0x1741f3);return _0x41bdf2[_0x8d66('0x24')]('Content-Range',_0x4bf647+'-'+_0x1b2ec3+'/'+_0x59eab6)['json'](_0x2b1e99);}return null;};}function patchUpdates(_0x22b153){return function(_0xfa7612){try{jsonpatch[_0x8d66('0x25')](_0xfa7612,_0x22b153,!![]);}catch(_0xe4db7f){return BPromise[_0x8d66('0x26')](_0xe4db7f);}return _0xfa7612['save']();};}function saveUpdates(_0x3dc1ae,_0xa4a56b){return function(_0x28a355){if(_0x28a355){return _0x28a355[_0x8d66('0x27')](_0x3dc1ae)[_0x8d66('0x28')](function(_0x266fb8){return _0x266fb8;});}return null;};}function removeEntity(_0x26b732,_0x569bdc){return function(_0x4d81da){if(_0x4d81da){return _0x4d81da['destroy']()['then'](function(){var _0xfdccf1=_0x4d81da[_0x8d66('0x29')]({'plain':!![]});var _0x2dd488='FaxQueues';return db[_0x8d66('0x2a')][_0x8d66('0x2b')]({'where':{'type':_0x2dd488,'resourceId':_0xfdccf1['id']}})[_0x8d66('0x28')](function(){return _0x4d81da;});})['then'](function(){_0x26b732['status'](0xcc)[_0x8d66('0x1d')]();});}};}function handleEntityNotFound(_0x30737e,_0x10fc40){return function(_0x159c05){if(!_0x159c05){_0x30737e[_0x8d66('0x1c')](0x194);}return _0x159c05;};}function handleError(_0x111e85,_0x47591b){_0x47591b=_0x47591b||0x1f4;return function(_0x4c3cab){logger[_0x8d66('0x2c')](_0x4c3cab['stack']);if(_0x4c3cab['name']){delete _0x4c3cab[_0x8d66('0x2d')];}_0x111e85[_0x8d66('0x1e')](_0x47591b)[_0x8d66('0x2e')](_0x4c3cab);};}exports['index']=function(_0x43ef4c,_0x21993b){var _0xf60d77={},_0x3b7016={},_0x1a3eab={'count':0x0,'rows':[]};var _0x4cde9f=_[_0x8d66('0x2f')](db[_0x8d66('0x30')][_0x8d66('0x31')],function(_0x1d738c){return{'name':_0x1d738c[_0x8d66('0x32')],'type':_0x1d738c[_0x8d66('0x33')][_0x8d66('0x34')]};});_0x3b7016['model']=_[_0x8d66('0x2f')](_0x4cde9f,_0x8d66('0x2d'));_0x3b7016[_0x8d66('0x35')]=_[_0x8d66('0x36')](_0x43ef4c[_0x8d66('0x35')]);_0x3b7016[_0x8d66('0x37')]=_[_0x8d66('0x38')](_0x3b7016[_0x8d66('0x39')],_0x3b7016[_0x8d66('0x35')]);_0xf60d77[_0x8d66('0x3a')]=_[_0x8d66('0x38')](_0x3b7016[_0x8d66('0x39')],qs[_0x8d66('0x3b')](_0x43ef4c['query']['fields']));_0xf60d77['attributes']=_0xf60d77['attributes'][_0x8d66('0x3c')]?_0xf60d77[_0x8d66('0x3a')]:_0x3b7016[_0x8d66('0x39')];if(!_0x43ef4c[_0x8d66('0x35')][_0x8d66('0x3d')](_0x8d66('0x3e'))){_0xf60d77[_0x8d66('0x22')]=qs['limit'](_0x43ef4c[_0x8d66('0x35')][_0x8d66('0x22')]);_0xf60d77[_0x8d66('0x20')]=qs[_0x8d66('0x20')](_0x43ef4c[_0x8d66('0x35')]['offset']);}_0xf60d77[_0x8d66('0x3f')]=qs['sort'](_0x43ef4c[_0x8d66('0x35')]['sort']);_0xf60d77[_0x8d66('0x40')]=qs['filters'](_[_0x8d66('0x41')](_0x43ef4c['query'],_0x3b7016[_0x8d66('0x37')]),_0x4cde9f);if(_0x43ef4c[_0x8d66('0x35')]['filter']){_0xf60d77[_0x8d66('0x40')]=_[_0x8d66('0x42')](_0xf60d77['where'],{'$or':_[_0x8d66('0x2f')](_0x4cde9f,function(_0x1e0c9f){if(_0x1e0c9f[_0x8d66('0x33')]!==_0x8d66('0x43')){var _0x185b50={};_0x185b50[_0x1e0c9f['name']]={'$like':'%'+_0x43ef4c[_0x8d66('0x35')][_0x8d66('0x44')]+'%'};return _0x185b50;}})});}_0xf60d77=_['merge']({},_0xf60d77,_0x43ef4c[_0x8d66('0x45')]);var _0x440f86={'where':_0xf60d77['where']};return db[_0x8d66('0x30')]['count'](_0x440f86)[_0x8d66('0x28')](function(_0x226637){_0x1a3eab[_0x8d66('0x23')]=_0x226637;if(_0x43ef4c[_0x8d66('0x35')][_0x8d66('0x46')]){_0xf60d77[_0x8d66('0x47')]=[{'all':!![]}];}return db[_0x8d66('0x30')][_0x8d66('0x48')](_0xf60d77);})[_0x8d66('0x28')](function(_0x56b517){_0x1a3eab[_0x8d66('0x49')]=_0x56b517;return _0x1a3eab;})[_0x8d66('0x28')](respondWithFilteredResult(_0x21993b,_0xf60d77))[_0x8d66('0x4a')](handleError(_0x21993b,null));};exports[_0x8d66('0x4b')]=function(_0x462a96,_0x2847da){var _0x546faf={'raw':!![],'where':{'id':_0x462a96['params']['id']}},_0x3204a9={};_0x3204a9[_0x8d66('0x39')]=_[_0x8d66('0x36')](db[_0x8d66('0x30')][_0x8d66('0x31')]);_0x3204a9[_0x8d66('0x35')]=_[_0x8d66('0x36')](_0x462a96['query']);_0x3204a9[_0x8d66('0x37')]=_[_0x8d66('0x38')](_0x3204a9['model'],_0x3204a9[_0x8d66('0x35')]);_0x546faf[_0x8d66('0x3a')]=_[_0x8d66('0x38')](_0x3204a9[_0x8d66('0x39')],qs[_0x8d66('0x3b')](_0x462a96['query']['fields']));_0x546faf[_0x8d66('0x3a')]=_0x546faf[_0x8d66('0x3a')][_0x8d66('0x3c')]?_0x546faf[_0x8d66('0x3a')]:_0x3204a9['model'];if(_0x462a96[_0x8d66('0x35')]['includeAll']){_0x546faf[_0x8d66('0x47')]=[{'all':!![]}];}_0x546faf=_[_0x8d66('0x42')]({},_0x546faf,_0x462a96['options']);return db[_0x8d66('0x30')]['find'](_0x546faf)[_0x8d66('0x28')](handleEntityNotFound(_0x2847da,null))[_0x8d66('0x28')](respondWithResult(_0x2847da,null))[_0x8d66('0x4a')](handleError(_0x2847da,null));};exports[_0x8d66('0x4c')]=function(_0x51997f,_0x17b833){return db['FaxQueue']['create'](_0x51997f[_0x8d66('0x4d')],{})[_0x8d66('0x28')](function(_0xf60c1a){var _0x3f4cab=_0x51997f[_0x8d66('0x4e')][_0x8d66('0x29')]({'plain':!![]});if(!_0x3f4cab)throw new Error(_0x8d66('0x4f'));if(_0x3f4cab[_0x8d66('0x50')]===_0x8d66('0x4e')){var _0x13b2df=_0xf60c1a[_0x8d66('0x29')]({'plain':!![]});var _0x196f5e=_0x8d66('0x51');return db[_0x8d66('0x52')]['find']({'where':{'name':_0x196f5e,'userProfileId':_0x3f4cab[_0x8d66('0x53')]},'raw':!![]})[_0x8d66('0x28')](function(_0x16d128){if(_0x16d128&&_0x16d128[_0x8d66('0x54')]===0x0){return db['UserProfileResource'][_0x8d66('0x4c')]({'name':_0x13b2df[_0x8d66('0x2d')],'resourceId':_0x13b2df['id'],'type':_0x16d128['name'],'sectionId':_0x16d128['id']},{})[_0x8d66('0x28')](function(){return _0xf60c1a;});}else{return _0xf60c1a;}})[_0x8d66('0x4a')](function(_0x9c4d12){logger[_0x8d66('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9c4d12);throw _0x9c4d12;});}return _0xf60c1a;})[_0x8d66('0x28')](respondWithResult(_0x17b833,0xc9))[_0x8d66('0x4a')](handleError(_0x17b833,null));};exports[_0x8d66('0x27')]=function(_0x4fe08f,_0x18833f){if(_0x4fe08f[_0x8d66('0x4d')]['id']){delete _0x4fe08f[_0x8d66('0x4d')]['id'];}return db['FaxQueue'][_0x8d66('0x55')]({'where':{'id':_0x4fe08f['params']['id']}})['then'](handleEntityNotFound(_0x18833f,null))[_0x8d66('0x28')](saveUpdates(_0x4fe08f[_0x8d66('0x4d')],null))['then'](respondWithResult(_0x18833f,null))[_0x8d66('0x4a')](handleError(_0x18833f,null));};exports[_0x8d66('0x2b')]=function(_0x294efc,_0x534cc1){return db[_0x8d66('0x30')]['find']({'where':{'id':_0x294efc['params']['id']}})[_0x8d66('0x28')](handleEntityNotFound(_0x534cc1,null))[_0x8d66('0x28')](removeEntity(_0x534cc1,null))[_0x8d66('0x4a')](handleError(_0x534cc1,null));};exports[_0x8d66('0x56')]=function(_0x33fadd,_0x5d80ca){return db['FaxQueue'][_0x8d66('0x56')]()[_0x8d66('0x28')](respondWithResult(_0x5d80ca,null))[_0x8d66('0x4a')](handleError(_0x5d80ca,null));};exports[_0x8d66('0x57')]=function(_0x38aeb6,_0x44d6a5,_0x2d063c){var _0x575bf6={'raw':!![],'where':{}},_0x535e1d={},_0x849a8b;return db[_0x8d66('0x30')][_0x8d66('0x58')]({'where':{'id':_0x38aeb6['params']['id']}})[_0x8d66('0x28')](handleEntityNotFound(_0x44d6a5,null))['then'](function(_0x4a79cc){if(_0x4a79cc){_0x849a8b=_0x4a79cc[_0x8d66('0x29')]({'plain':!![]});_0x535e1d[_0x8d66('0x39')]=_[_0x8d66('0x36')](db['UserFaxQueue'][_0x8d66('0x31')]);_0x535e1d[_0x8d66('0x35')]=_[_0x8d66('0x36')](_0x38aeb6['query']);_0x535e1d['filters']=_[_0x8d66('0x38')](_0x535e1d[_0x8d66('0x39')],_0x535e1d['query']);_0x575bf6[_0x8d66('0x3a')]=_['intersection'](_0x535e1d[_0x8d66('0x39')],qs[_0x8d66('0x3b')](_0x38aeb6['query'][_0x8d66('0x3b')]));_0x575bf6['attributes']=_0x575bf6[_0x8d66('0x3a')]['length']?_0x575bf6[_0x8d66('0x3a')]:_0x535e1d[_0x8d66('0x39')];if(!_0x38aeb6[_0x8d66('0x35')]['hasOwnProperty'](_0x8d66('0x3e'))){_0x575bf6[_0x8d66('0x22')]=qs[_0x8d66('0x22')](_0x38aeb6[_0x8d66('0x35')]['limit']);_0x575bf6[_0x8d66('0x20')]=qs[_0x8d66('0x20')](_0x38aeb6[_0x8d66('0x35')][_0x8d66('0x20')]);}_0x575bf6[_0x8d66('0x3f')]=qs[_0x8d66('0x59')](_0x38aeb6[_0x8d66('0x35')][_0x8d66('0x59')]);_0x575bf6[_0x8d66('0x40')]=qs[_0x8d66('0x37')](_['pick'](_0x38aeb6[_0x8d66('0x35')],_0x535e1d[_0x8d66('0x37')]));_0x575bf6[_0x8d66('0x40')]['FaxQueueId']=_0x4a79cc['id'];if(_0x38aeb6[_0x8d66('0x35')][_0x8d66('0x44')]){_0x575bf6[_0x8d66('0x40')]=_[_0x8d66('0x42')](_0x575bf6[_0x8d66('0x40')],{'$or':_[_0x8d66('0x2f')](_0x575bf6[_0x8d66('0x3a')],function(_0x1172b5){var _0x42720e={};_0x42720e[_0x1172b5]={'$like':'%'+_0x38aeb6[_0x8d66('0x35')][_0x8d66('0x44')]+'%'};return _0x42720e;})});}_0x575bf6=_[_0x8d66('0x42')]({},_0x575bf6,_0x38aeb6['options']);return db[_0x8d66('0x5a')]['findAll'](_0x575bf6);}})[_0x8d66('0x28')](function(_0x5dc0d9){if(_0x5dc0d9){return db[_0x8d66('0x5b')]['findAndCountAll']({'where':{'id':_[_0x8d66('0x2f')](_0x5dc0d9,_0x8d66('0x5c')),'role':_0x8d66('0x5d')},'attributes':['id',_0x8d66('0x2d'),_0x8d66('0x5e'),_0x8d66('0x5f'),_0x8d66('0x60')]});}})[_0x8d66('0x28')](function(_0x559c71){if(_0x559c71){return{'count':_0x559c71[_0x8d66('0x23')],'rows':_[_0x8d66('0x2f')](_0x559c71['rows'],function(_0x573e3f){return{'membername':_0x573e3f['name'],'UserId':_0x573e3f['id'],'queue_name':_0x849a8b[_0x8d66('0x2d')],'FaxQueueId':_0x849a8b['id'],'interface':util[_0x8d66('0x61')](_0x8d66('0x62'),_0x8d66('0x63'),_0x573e3f[_0x8d66('0x2d')]),'penalty':0x0,'paused':_0x573e3f['faxPause'],'createdAt':_0x573e3f['createdAt'],'updatedAt':_0x573e3f[_0x8d66('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8d66('0x28')](respondWithFilteredResult(_0x44d6a5,_0x575bf6))['catch'](handleError(_0x44d6a5,null));};exports[_0x8d66('0x64')]=function(_0x492106,_0x35bbae,_0xdbfff7){var _0x22d16d={};var _0x347db6={};var _0x17fc93;var _0x2d7bf7;return db[_0x8d66('0x30')][_0x8d66('0x58')]({'where':{'id':_0x492106['params']['id']}})[_0x8d66('0x28')](handleEntityNotFound(_0x35bbae,null))['then'](function(_0x3b2fcd){if(_0x3b2fcd){_0x17fc93=_0x3b2fcd;_0x347db6[_0x8d66('0x39')]=_[_0x8d66('0x36')](db['Team'][_0x8d66('0x31')]);_0x347db6['query']=_[_0x8d66('0x36')](_0x492106['query']);_0x347db6[_0x8d66('0x37')]=_[_0x8d66('0x38')](_0x347db6[_0x8d66('0x39')],_0x347db6[_0x8d66('0x35')]);_0x22d16d[_0x8d66('0x3a')]=_[_0x8d66('0x38')](_0x347db6[_0x8d66('0x39')],qs['fields'](_0x492106[_0x8d66('0x35')][_0x8d66('0x3b')]));_0x22d16d[_0x8d66('0x3a')]=_0x22d16d['attributes']['length']?_0x22d16d[_0x8d66('0x3a')]:_0x347db6[_0x8d66('0x39')];_0x22d16d[_0x8d66('0x3f')]=qs[_0x8d66('0x59')](_0x492106['query'][_0x8d66('0x59')]);_0x22d16d[_0x8d66('0x40')]=qs[_0x8d66('0x37')](_[_0x8d66('0x41')](_0x492106[_0x8d66('0x35')],_0x347db6['filters']));if(_0x492106[_0x8d66('0x35')][_0x8d66('0x44')]){_0x22d16d[_0x8d66('0x40')]=_[_0x8d66('0x42')](_0x22d16d['where'],{'$or':_[_0x8d66('0x2f')](_0x22d16d[_0x8d66('0x3a')],function(_0x54d165){var _0x44aae9={};_0x44aae9[_0x54d165]={'$like':'%'+_0x492106[_0x8d66('0x35')][_0x8d66('0x44')]+'%'};return _0x44aae9;})});}_0x22d16d=_[_0x8d66('0x42')]({},_0x22d16d,_0x492106[_0x8d66('0x45')]);return _0x17fc93[_0x8d66('0x64')](_0x22d16d);}})[_0x8d66('0x28')](function(_0xcbe97e){if(_0xcbe97e){_0x2d7bf7=_0xcbe97e[_0x8d66('0x3c')];if(!_0x492106[_0x8d66('0x35')][_0x8d66('0x3d')]('nolimit')){_0x22d16d[_0x8d66('0x22')]=qs[_0x8d66('0x22')](_0x492106[_0x8d66('0x35')][_0x8d66('0x22')]);_0x22d16d[_0x8d66('0x20')]=qs[_0x8d66('0x20')](_0x492106[_0x8d66('0x35')][_0x8d66('0x20')]);}return _0x17fc93[_0x8d66('0x64')](_0x22d16d);}})['then'](function(_0x40758d){if(_0x40758d){return _0x40758d?{'count':_0x2d7bf7,'rows':_0x40758d}:null;}})[_0x8d66('0x28')](respondWithResult(_0x35bbae,null))['catch'](handleError(_0x35bbae,null));};exports[_0x8d66('0x65')]=function(_0x57d3c8,_0x2c9852,_0x554df9){var _0x43b293=_0x57d3c8[_0x8d66('0x4d')][_0x8d66('0x66')];return db[_0x8d66('0x67')]['findAll']({'where':{'id':_0x43b293},'attributes':['id'],'include':[{'model':db[_0x8d66('0x5b')],'as':_0x8d66('0x68'),'attributes':['id','name',_0x8d66('0x69'),_0x8d66('0x6a'),_0x8d66('0x6b')],'raw':!![]}]})['then'](function(_0x3782a2){if(_0x3782a2){var _0x21bee2=_[_0x8d66('0x6c')](_0x3782a2,function(_0x52b3b5){var _0x4526ff=_0x52b3b5[_0x8d66('0x29')]({'plain':!![]});return _0x4526ff['Agents'];});return db['FaxQueue'][_0x8d66('0x55')]({'where':{'id':_0x57d3c8[_0x8d66('0x6d')]['id']}})[_0x8d66('0x28')](function(_0x44d951){return db[_0x8d66('0x6e')]['transaction'](function(_0x3f715e){return _0x44d951[_0x8d66('0x65')](_0x43b293,{'transaction':_0x3f715e})[_0x8d66('0x28')](function(){return BPromise[_0x8d66('0x6f')](_0x21bee2,function(_0x4329f3){return db[_0x8d66('0x5a')][_0x8d66('0x70')]({'where':{'UserId':_0x4329f3['id'],'FaxQueueId':_0x57d3c8[_0x8d66('0x6d')]['id']},'transaction':_0x3f715e});});})[_0x8d66('0x28')](function(){_0x21bee2[_0x8d66('0x71')](function(_0x2ebd4f){socket[_0x8d66('0x72')]('userFaxQueue:save',{'UserId':_0x2ebd4f['id'],'FaxQueueId':_0x44d951['id']});});});});});}})[_0x8d66('0x28')](respondWithStatusCode(_0x2c9852,null))['catch'](handleError(_0x2c9852,null));};exports[_0x8d66('0x73')]=function(_0x566a9c,_0x30a52a,_0x5d9ce8){return db[_0x8d66('0x67')][_0x8d66('0x48')]({'where':{'id':_0x566a9c['query'][_0x8d66('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8d66('0x68'),'attributes':['id'],'raw':!![]}]})[_0x8d66('0x28')](handleEntityNotFound(_0x30a52a,null))[_0x8d66('0x28')](function(_0x30e9fb){var _0x29b975=_[_0x8d66('0x2f')](_0x30e9fb,'id');var _0x576f19=[];var _0x4dc687=[];var _0x1007fc=squel[_0x8d66('0x74')]();_0x1007fc['field'](_0x8d66('0x75'))[_0x8d66('0x76')]('team_has_fax_queues','tq')[_0x8d66('0x77')](_0x8d66('0x78'),'ut',_0x8d66('0x79'))[_0x8d66('0x40')]('FaxQueueId\x20=\x20?',_0x566a9c[_0x8d66('0x6d')]['id']);for(var _0x46ffa6=0x0;_0x46ffa6<_0x30e9fb[_0x8d66('0x3c')];_0x46ffa6+=0x1){let _0x154bd9=_0x30e9fb[_0x46ffa6];for(var _0x4889cc=0x0;_0x4889cc<_0x154bd9['Agents'][_0x8d66('0x3c')];_0x4889cc+=0x1){let _0x548901=_0x154bd9[_0x8d66('0x68')][_0x4889cc];var _0x37ab02=_0x1007fc[_0x8d66('0x7a')]();_0x37ab02[_0x8d66('0x40')]('ut.UserId\x20=\x20?',_0x548901['id']);_0x4dc687[_0x8d66('0x7b')](db['sequelize'][_0x8d66('0x35')](_0x37ab02[_0x8d66('0x7c')](),{'type':db[_0x8d66('0x6e')][_0x8d66('0x7d')][_0x8d66('0x7e')]})[_0x8d66('0x28')](function(_0x2470e1){if(_0x2470e1[_0x8d66('0x3c')]===0x1){return _0x548901['id'];}else{var _0x1aca6f=_[_0x8d66('0x7f')](_[_0x8d66('0x2f')](_0x2470e1,_0x8d66('0x80')),function(_0x5102cf){return _[_0x8d66('0x81')](_0x29b975,_0x5102cf);});if(_0x1aca6f){return _0x548901['id'];}}}));}}return BPromise[_0x8d66('0x82')](_0x4dc687)[_0x8d66('0x28')](function(_0x304fa2){_0x576f19=_(_0x576f19)[_0x8d66('0x83')](_0x304fa2)[_0x8d66('0x84')]()[_0x8d66('0x85')]();return db[_0x8d66('0x30')][_0x8d66('0x55')]({'where':{'id':_0x566a9c[_0x8d66('0x6d')]['id']}})[_0x8d66('0x28')](function(_0x377e12){return db[_0x8d66('0x6e')][_0x8d66('0x86')](function(_0x149086){return _0x377e12[_0x8d66('0x73')](_0x566a9c[_0x8d66('0x35')][_0x8d66('0x66')],{'transaction':_0x149086})[_0x8d66('0x28')](function(){if(!_[_0x8d66('0x87')](_0x576f19)){return _0x377e12[_0x8d66('0x88')](_0x576f19,{'transaction':_0x149086});}})[_0x8d66('0x28')](function(){_0x576f19[_0x8d66('0x71')](function(_0x380993){socket[_0x8d66('0x72')](_0x8d66('0x89'),{'UserId':_0x380993,'FaxQueueId':_0x377e12['id']});});});});});});})[_0x8d66('0x28')](respondWithStatusCode(_0x30a52a,null))[_0x8d66('0x4a')](handleError(_0x30a52a,null));};exports[_0x8d66('0x8a')]=function(_0x42ef14,_0x17ecb3,_0xc7fffb){return db[_0x8d66('0x30')][_0x8d66('0x55')]({'where':{'id':_0x42ef14[_0x8d66('0x6d')]['id']}})['then'](handleEntityNotFound(_0x17ecb3,null))[_0x8d66('0x28')](function(_0xb5bf75){if(_0xb5bf75){return _0xb5bf75[_0x8d66('0x8a')](_0x42ef14['body'][_0x8d66('0x66')],_[_0x8d66('0x8b')](_0x42ef14[_0x8d66('0x4d')],['ids','id'])||{})[_0x8d66('0x8c')](function(_0x2f45eb){for(var _0x57f875=0x0;_0x57f875<_0x42ef14[_0x8d66('0x4d')][_0x8d66('0x66')]['length'];_0x57f875+=0x1){socket[_0x8d66('0x72')](_0x8d66('0x8d'),{'UserId':Number(_0x42ef14[_0x8d66('0x4d')][_0x8d66('0x66')][_0x57f875]),'FaxQueueId':Number(_0x42ef14[_0x8d66('0x6d')]['id'])});}return _0x2f45eb;});}})['then'](respondWithResult(_0x17ecb3,null))[_0x8d66('0x4a')](handleError(_0x17ecb3,null));};exports[_0x8d66('0x88')]=function(_0x4aa621,_0x58b925,_0x491a27){return db[_0x8d66('0x30')][_0x8d66('0x55')]({'where':{'id':_0x4aa621[_0x8d66('0x6d')]['id']}})[_0x8d66('0x28')](handleEntityNotFound(_0x58b925,null))['then'](function(_0x325f1f){if(_0x325f1f){return _0x325f1f[_0x8d66('0x88')](_0x4aa621[_0x8d66('0x35')][_0x8d66('0x66')])[_0x8d66('0x28')](function(){if(_['isArray'](_0x4aa621['query'][_0x8d66('0x66')])){for(var _0x1403f4=0x0;_0x1403f4<_0x4aa621['query']['ids'][_0x8d66('0x3c')];_0x1403f4+=0x1){socket[_0x8d66('0x72')]('userFaxQueue:remove',{'UserId':Number(_0x4aa621[_0x8d66('0x35')]['ids'][_0x1403f4]),'FaxQueueId':Number(_0x4aa621['params']['id'])});}}else{socket[_0x8d66('0x72')]('userFaxQueue:remove',{'UserId':Number(_0x4aa621[_0x8d66('0x35')][_0x8d66('0x66')]),'FaxQueueId':Number(_0x4aa621['params']['id'])});}});}})[_0x8d66('0x28')](respondWithStatusCode(_0x58b925,null))[_0x8d66('0x4a')](handleError(_0x58b925,null));};exports[_0x8d66('0x8e')]=function(_0x47b7b1,_0x53cd46,_0x5bfe11){var _0xe09a70={};var _0x4e7196={};var _0x35daea;var _0x28189c;return db['FaxQueue'][_0x8d66('0x58')]({'where':{'id':_0x47b7b1[_0x8d66('0x6d')]['id']}})[_0x8d66('0x28')](handleEntityNotFound(_0x53cd46,null))['then'](function(_0x1056ac){if(_0x1056ac){_0x35daea=_0x1056ac;_0x4e7196['model']=_[_0x8d66('0x36')](db[_0x8d66('0x5b')][_0x8d66('0x31')]);_0x4e7196[_0x8d66('0x35')]=_[_0x8d66('0x36')](_0x47b7b1['query']);_0x4e7196[_0x8d66('0x37')]=_[_0x8d66('0x38')](_0x4e7196[_0x8d66('0x39')],_0x4e7196['query']);_0xe09a70[_0x8d66('0x3a')]=_[_0x8d66('0x38')](_0x4e7196['model'],qs[_0x8d66('0x3b')](_0x47b7b1['query'][_0x8d66('0x3b')]));_0xe09a70[_0x8d66('0x3a')]=_0xe09a70[_0x8d66('0x3a')][_0x8d66('0x3c')]?_0xe09a70[_0x8d66('0x3a')]:_0x4e7196['model'];_0xe09a70[_0x8d66('0x3f')]=qs[_0x8d66('0x59')](_0x47b7b1['query'][_0x8d66('0x59')]);_0xe09a70[_0x8d66('0x40')]=qs['filters'](_[_0x8d66('0x41')](_0x47b7b1[_0x8d66('0x35')],_0x4e7196[_0x8d66('0x37')]));if(_0x47b7b1[_0x8d66('0x35')][_0x8d66('0x44')]){_0xe09a70[_0x8d66('0x40')]=_[_0x8d66('0x42')](_0xe09a70[_0x8d66('0x40')],{'$or':_[_0x8d66('0x2f')](_0xe09a70['attributes'],function(_0x4cbe53){var _0x3fcf74={};_0x3fcf74[_0x4cbe53]={'$like':'%'+_0x47b7b1['query'][_0x8d66('0x44')]+'%'};return _0x3fcf74;})});}_0xe09a70=_[_0x8d66('0x42')]({},_0xe09a70,_0x47b7b1['options']);return _0x35daea[_0x8d66('0x8e')](_0xe09a70);}})[_0x8d66('0x28')](function(_0x3f62ab){if(_0x3f62ab){_0x28189c=_0x3f62ab['length'];if(!_0x47b7b1['query'][_0x8d66('0x3d')](_0x8d66('0x3e'))){_0xe09a70[_0x8d66('0x22')]=qs[_0x8d66('0x22')](_0x47b7b1['query'][_0x8d66('0x22')]);_0xe09a70[_0x8d66('0x20')]=qs[_0x8d66('0x20')](_0x47b7b1[_0x8d66('0x35')][_0x8d66('0x20')]);}return _0x35daea[_0x8d66('0x8e')](_0xe09a70);}})['then'](function(_0xb5017f){if(_0xb5017f){return _0xb5017f?{'count':_0x28189c,'rows':_0xb5017f}:null;}})[_0x8d66('0x28')](respondWithResult(_0x53cd46,null))[_0x8d66('0x4a')](handleError(_0x53cd46,null));}; \ No newline at end of file +var _0x76ff=['push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','json','offset','undefined','count','limit','status','set','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','include','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','UserId','agent','format','%s/%s','SIP','faxPause','createdAt','updatedAt','Team','getTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','forEach','emit','userFaxQueue:save','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone'];(function(_0x3c2685,_0x330364){var _0x4e6f84=function(_0x5e1b46){while(--_0x5e1b46){_0x3c2685['push'](_0x3c2685['shift']());}};_0x4e6f84(++_0x330364);}(_0x76ff,0xa5));var _0xf76f=function(_0x3bcac0,_0x475dc7){_0x3bcac0=_0x3bcac0-0x0;var _0x5a86ba=_0x76ff[_0x3bcac0];return _0x5a86ba;};'use strict';var emlformat=require(_0xf76f('0x0'));var rimraf=require(_0xf76f('0x1'));var zipdir=require(_0xf76f('0x2'));var jsonpatch=require(_0xf76f('0x3'));var rp=require(_0xf76f('0x4'));var moment=require('moment');var BPromise=require(_0xf76f('0x5'));var Mustache=require(_0xf76f('0x6'));var util=require(_0xf76f('0x7'));var path=require(_0xf76f('0x8'));var sox=require('sox');var csv=require(_0xf76f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf76f('0xa'));var _=require('lodash');var squel=require(_0xf76f('0xb'));var crypto=require(_0xf76f('0xc'));var jsforce=require(_0xf76f('0xd'));var deskjs=require(_0xf76f('0xe'));var toCsv=require(_0xf76f('0x9'));var querystring=require(_0xf76f('0xf'));var Papa=require(_0xf76f('0x10'));var Redis=require(_0xf76f('0x11'));var authService=require(_0xf76f('0x12'));var qs=require(_0xf76f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf76f('0x14'));var logger=require('../../config/logger')(_0xf76f('0x15'));var utils=require(_0xf76f('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf76f('0x17'))['db'];config[_0xf76f('0x18')]=_[_0xf76f('0x19')](config[_0xf76f('0x18')],{'host':_0xf76f('0x1a'),'port':0x18eb});var socket=require(_0xf76f('0x1b'))(new Redis(config[_0xf76f('0x18')]));require(_0xf76f('0x1c'))[_0xf76f('0x1d')](socket);function respondWithStatusCode(_0x2593cd,_0x54373e){_0x54373e=_0x54373e||0xcc;return function(_0x594985){if(_0x594985){return _0x2593cd[_0xf76f('0x1e')](_0x54373e);}return _0x2593cd['status'](_0x54373e)[_0xf76f('0x1f')]();};}function respondWithResult(_0x1460d4,_0x4a7ec0){_0x4a7ec0=_0x4a7ec0||0xc8;return function(_0x578613){if(_0x578613){return _0x1460d4['status'](_0x4a7ec0)[_0xf76f('0x20')](_0x578613);}};}function respondWithFilteredResult(_0x421917,_0x431cf8){return function(_0x51720c){if(_0x51720c){var _0x34f857=typeof _0x431cf8[_0xf76f('0x21')]==='undefined'&&typeof _0x431cf8['limit']===_0xf76f('0x22');var _0x5d4554=_0x51720c[_0xf76f('0x23')];var _0x354c62=_0x34f857?0x0:_0x431cf8['offset'];var _0x250eab=_0x34f857?_0x51720c[_0xf76f('0x23')]:_0x431cf8[_0xf76f('0x21')]+_0x431cf8[_0xf76f('0x24')];var _0xd70c19;if(_0x250eab>=_0x5d4554){_0x250eab=_0x5d4554;_0xd70c19=0xc8;}else{_0xd70c19=0xce;}_0x421917[_0xf76f('0x25')](_0xd70c19);return _0x421917[_0xf76f('0x26')]('Content-Range',_0x354c62+'-'+_0x250eab+'/'+_0x5d4554)[_0xf76f('0x20')](_0x51720c);}return null;};}function patchUpdates(_0x160897){return function(_0x55940d){try{jsonpatch[_0xf76f('0x27')](_0x55940d,_0x160897,!![]);}catch(_0x2d845e){return BPromise[_0xf76f('0x28')](_0x2d845e);}return _0x55940d[_0xf76f('0x29')]();};}function saveUpdates(_0x45c95e,_0x4432e9){return function(_0x16dfef){if(_0x16dfef){return _0x16dfef[_0xf76f('0x2a')](_0x45c95e)[_0xf76f('0x2b')](function(_0x143347){return _0x143347;});}return null;};}function removeEntity(_0x443a5f,_0x108fd7){return function(_0x225b0b){if(_0x225b0b){return _0x225b0b[_0xf76f('0x2c')]()[_0xf76f('0x2b')](function(){var _0x1eeccd=_0x225b0b[_0xf76f('0x2d')]({'plain':!![]});var _0x351e85=_0xf76f('0x2e');return db[_0xf76f('0x2f')][_0xf76f('0x2c')]({'where':{'type':_0x351e85,'resourceId':_0x1eeccd['id']}})[_0xf76f('0x2b')](function(){return _0x225b0b;});})[_0xf76f('0x2b')](function(){_0x443a5f[_0xf76f('0x25')](0xcc)[_0xf76f('0x1f')]();});}};}function handleEntityNotFound(_0x28d650,_0x1f7d93){return function(_0x1c2fc9){if(!_0x1c2fc9){_0x28d650[_0xf76f('0x1e')](0x194);}return _0x1c2fc9;};}function handleError(_0x47dfdd,_0x3624f0){_0x3624f0=_0x3624f0||0x1f4;return function(_0x3a1c27){logger[_0xf76f('0x30')](_0x3a1c27[_0xf76f('0x31')]);if(_0x3a1c27['name']){delete _0x3a1c27[_0xf76f('0x32')];}_0x47dfdd[_0xf76f('0x25')](_0x3624f0)[_0xf76f('0x33')](_0x3a1c27);};}exports[_0xf76f('0x34')]=function(_0x261f1b,_0x258bac){var _0x6d89c6={},_0x3eec86={},_0x185364={'count':0x0,'rows':[]};var _0x5a2d4b=_[_0xf76f('0x35')](db[_0xf76f('0x36')][_0xf76f('0x37')],function(_0x443a94){return{'name':_0x443a94[_0xf76f('0x38')],'type':_0x443a94[_0xf76f('0x39')][_0xf76f('0x3a')]};});_0x3eec86[_0xf76f('0x3b')]=_[_0xf76f('0x35')](_0x5a2d4b,_0xf76f('0x32'));_0x3eec86[_0xf76f('0x3c')]=_[_0xf76f('0x3d')](_0x261f1b[_0xf76f('0x3c')]);_0x3eec86[_0xf76f('0x3e')]=_['intersection'](_0x3eec86[_0xf76f('0x3b')],_0x3eec86[_0xf76f('0x3c')]);_0x6d89c6[_0xf76f('0x3f')]=_[_0xf76f('0x40')](_0x3eec86[_0xf76f('0x3b')],qs[_0xf76f('0x41')](_0x261f1b['query'][_0xf76f('0x41')]));_0x6d89c6[_0xf76f('0x3f')]=_0x6d89c6[_0xf76f('0x3f')][_0xf76f('0x42')]?_0x6d89c6[_0xf76f('0x3f')]:_0x3eec86[_0xf76f('0x3b')];if(!_0x261f1b[_0xf76f('0x3c')][_0xf76f('0x43')](_0xf76f('0x44'))){_0x6d89c6[_0xf76f('0x24')]=qs[_0xf76f('0x24')](_0x261f1b['query'][_0xf76f('0x24')]);_0x6d89c6[_0xf76f('0x21')]=qs[_0xf76f('0x21')](_0x261f1b[_0xf76f('0x3c')]['offset']);}_0x6d89c6[_0xf76f('0x45')]=qs[_0xf76f('0x46')](_0x261f1b[_0xf76f('0x3c')][_0xf76f('0x46')]);_0x6d89c6[_0xf76f('0x47')]=qs[_0xf76f('0x3e')](_[_0xf76f('0x48')](_0x261f1b[_0xf76f('0x3c')],_0x3eec86[_0xf76f('0x3e')]),_0x5a2d4b);if(_0x261f1b[_0xf76f('0x3c')][_0xf76f('0x49')]){_0x6d89c6['where']=_[_0xf76f('0x4a')](_0x6d89c6[_0xf76f('0x47')],{'$or':_[_0xf76f('0x35')](_0x5a2d4b,function(_0x14167c){if(_0x14167c[_0xf76f('0x39')]!=='VIRTUAL'){var _0x3bb3fc={};_0x3bb3fc[_0x14167c[_0xf76f('0x32')]]={'$like':'%'+_0x261f1b['query'][_0xf76f('0x49')]+'%'};return _0x3bb3fc;}})});}_0x6d89c6=_[_0xf76f('0x4a')]({},_0x6d89c6,_0x261f1b[_0xf76f('0x4b')]);var _0x17a0dd={'where':_0x6d89c6['where']};return db[_0xf76f('0x36')][_0xf76f('0x23')](_0x17a0dd)[_0xf76f('0x2b')](function(_0x3ea2c4){_0x185364['count']=_0x3ea2c4;if(_0x261f1b['query'][_0xf76f('0x4c')]){_0x6d89c6['include']=[{'all':!![]}];}return db['FaxQueue'][_0xf76f('0x4d')](_0x6d89c6);})['then'](function(_0x1578b9){_0x185364[_0xf76f('0x4e')]=_0x1578b9;return _0x185364;})[_0xf76f('0x2b')](respondWithFilteredResult(_0x258bac,_0x6d89c6))[_0xf76f('0x4f')](handleError(_0x258bac,null));};exports[_0xf76f('0x50')]=function(_0x5540ff,_0x7ef0b3){var _0x28e014={'raw':!![],'where':{'id':_0x5540ff['params']['id']}},_0x346f02={};_0x346f02[_0xf76f('0x3b')]=_['keys'](db[_0xf76f('0x36')][_0xf76f('0x37')]);_0x346f02[_0xf76f('0x3c')]=_[_0xf76f('0x3d')](_0x5540ff[_0xf76f('0x3c')]);_0x346f02[_0xf76f('0x3e')]=_[_0xf76f('0x40')](_0x346f02[_0xf76f('0x3b')],_0x346f02['query']);_0x28e014[_0xf76f('0x3f')]=_['intersection'](_0x346f02[_0xf76f('0x3b')],qs[_0xf76f('0x41')](_0x5540ff[_0xf76f('0x3c')][_0xf76f('0x41')]));_0x28e014['attributes']=_0x28e014[_0xf76f('0x3f')][_0xf76f('0x42')]?_0x28e014['attributes']:_0x346f02[_0xf76f('0x3b')];if(_0x5540ff[_0xf76f('0x3c')][_0xf76f('0x4c')]){_0x28e014[_0xf76f('0x51')]=[{'all':!![]}];}_0x28e014=_['merge']({},_0x28e014,_0x5540ff[_0xf76f('0x4b')]);return db[_0xf76f('0x36')][_0xf76f('0x52')](_0x28e014)[_0xf76f('0x2b')](handleEntityNotFound(_0x7ef0b3,null))[_0xf76f('0x2b')](respondWithResult(_0x7ef0b3,null))[_0xf76f('0x4f')](handleError(_0x7ef0b3,null));};exports['create']=function(_0x4410a6,_0x2bd92e){return db[_0xf76f('0x36')]['create'](_0x4410a6[_0xf76f('0x53')],{})[_0xf76f('0x2b')](function(_0x422321){var _0x2f9e8f=_0x4410a6['user']['get']({'plain':!![]});if(!_0x2f9e8f)throw new Error(_0xf76f('0x54'));if(_0x2f9e8f[_0xf76f('0x55')]===_0xf76f('0x56')){var _0x5551da=_0x422321['get']({'plain':!![]});var _0x3372d6=_0xf76f('0x2e');return db[_0xf76f('0x57')][_0xf76f('0x52')]({'where':{'name':_0x3372d6,'userProfileId':_0x2f9e8f[_0xf76f('0x58')]},'raw':!![]})[_0xf76f('0x2b')](function(_0x597d82){if(_0x597d82&&_0x597d82[_0xf76f('0x59')]===0x0){return db[_0xf76f('0x2f')][_0xf76f('0x5a')]({'name':_0x5551da['name'],'resourceId':_0x5551da['id'],'type':_0x597d82[_0xf76f('0x32')],'sectionId':_0x597d82['id']},{})[_0xf76f('0x2b')](function(){return _0x422321;});}else{return _0x422321;}})[_0xf76f('0x4f')](function(_0x4fccf7){logger['error'](_0xf76f('0x5b'),_0x4fccf7);throw _0x4fccf7;});}return _0x422321;})[_0xf76f('0x2b')](respondWithResult(_0x2bd92e,0xc9))[_0xf76f('0x4f')](handleError(_0x2bd92e,null));};exports['update']=function(_0x1bfc59,_0x5986cb){if(_0x1bfc59[_0xf76f('0x53')]['id']){delete _0x1bfc59[_0xf76f('0x53')]['id'];}return db[_0xf76f('0x36')][_0xf76f('0x52')]({'where':{'id':_0x1bfc59[_0xf76f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5986cb,null))[_0xf76f('0x2b')](saveUpdates(_0x1bfc59[_0xf76f('0x53')],null))['then'](respondWithResult(_0x5986cb,null))[_0xf76f('0x4f')](handleError(_0x5986cb,null));};exports[_0xf76f('0x2c')]=function(_0xd95a76,_0x46c9c3){return db[_0xf76f('0x36')][_0xf76f('0x52')]({'where':{'id':_0xd95a76[_0xf76f('0x5c')]['id']}})[_0xf76f('0x2b')](handleEntityNotFound(_0x46c9c3,null))[_0xf76f('0x2b')](removeEntity(_0x46c9c3,null))[_0xf76f('0x4f')](handleError(_0x46c9c3,null));};exports[_0xf76f('0x5d')]=function(_0x341ce4,_0xa0675b){return db['FaxQueue'][_0xf76f('0x5d')]()[_0xf76f('0x2b')](respondWithResult(_0xa0675b,null))[_0xf76f('0x4f')](handleError(_0xa0675b,null));};exports['getMembers']=function(_0x2b7172,_0x5d1037,_0x2ed42b){var _0x3f7aa9={'raw':!![],'where':{}},_0x317e8a={},_0x2d393d;return db[_0xf76f('0x36')][_0xf76f('0x5e')]({'where':{'id':_0x2b7172[_0xf76f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5d1037,null))[_0xf76f('0x2b')](function(_0x56c444){if(_0x56c444){_0x2d393d=_0x56c444[_0xf76f('0x2d')]({'plain':!![]});_0x317e8a[_0xf76f('0x3b')]=_[_0xf76f('0x3d')](db[_0xf76f('0x5f')][_0xf76f('0x37')]);_0x317e8a[_0xf76f('0x3c')]=_[_0xf76f('0x3d')](_0x2b7172['query']);_0x317e8a['filters']=_[_0xf76f('0x40')](_0x317e8a['model'],_0x317e8a[_0xf76f('0x3c')]);_0x3f7aa9[_0xf76f('0x3f')]=_[_0xf76f('0x40')](_0x317e8a['model'],qs['fields'](_0x2b7172[_0xf76f('0x3c')]['fields']));_0x3f7aa9[_0xf76f('0x3f')]=_0x3f7aa9[_0xf76f('0x3f')][_0xf76f('0x42')]?_0x3f7aa9[_0xf76f('0x3f')]:_0x317e8a[_0xf76f('0x3b')];if(!_0x2b7172['query'][_0xf76f('0x43')](_0xf76f('0x44'))){_0x3f7aa9[_0xf76f('0x24')]=qs[_0xf76f('0x24')](_0x2b7172['query'][_0xf76f('0x24')]);_0x3f7aa9[_0xf76f('0x21')]=qs[_0xf76f('0x21')](_0x2b7172[_0xf76f('0x3c')]['offset']);}_0x3f7aa9[_0xf76f('0x45')]=qs[_0xf76f('0x46')](_0x2b7172[_0xf76f('0x3c')]['sort']);_0x3f7aa9[_0xf76f('0x47')]=qs[_0xf76f('0x3e')](_['pick'](_0x2b7172['query'],_0x317e8a[_0xf76f('0x3e')]));_0x3f7aa9[_0xf76f('0x47')][_0xf76f('0x60')]=_0x56c444['id'];if(_0x2b7172[_0xf76f('0x3c')][_0xf76f('0x49')]){_0x3f7aa9[_0xf76f('0x47')]=_['merge'](_0x3f7aa9[_0xf76f('0x47')],{'$or':_[_0xf76f('0x35')](_0x3f7aa9[_0xf76f('0x3f')],function(_0x3612a7){var _0x484ad8={};_0x484ad8[_0x3612a7]={'$like':'%'+_0x2b7172[_0xf76f('0x3c')][_0xf76f('0x49')]+'%'};return _0x484ad8;})});}_0x3f7aa9=_['merge']({},_0x3f7aa9,_0x2b7172[_0xf76f('0x4b')]);return db[_0xf76f('0x5f')][_0xf76f('0x4d')](_0x3f7aa9);}})[_0xf76f('0x2b')](function(_0x218c25){if(_0x218c25){return db[_0xf76f('0x61')][_0xf76f('0x62')]({'where':{'id':_[_0xf76f('0x35')](_0x218c25,_0xf76f('0x63')),'role':_0xf76f('0x64')},'attributes':['id',_0xf76f('0x32'),'faxPause','updatedAt','createdAt']});}})['then'](function(_0x43a5f3){if(_0x43a5f3){return{'count':_0x43a5f3[_0xf76f('0x23')],'rows':_[_0xf76f('0x35')](_0x43a5f3[_0xf76f('0x4e')],function(_0x4b9c1b){return{'membername':_0x4b9c1b[_0xf76f('0x32')],'UserId':_0x4b9c1b['id'],'queue_name':_0x2d393d[_0xf76f('0x32')],'FaxQueueId':_0x2d393d['id'],'interface':util[_0xf76f('0x65')](_0xf76f('0x66'),_0xf76f('0x67'),_0x4b9c1b['name']),'penalty':0x0,'paused':_0x4b9c1b[_0xf76f('0x68')],'createdAt':_0x4b9c1b[_0xf76f('0x69')],'updatedAt':_0x4b9c1b[_0xf76f('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf76f('0x2b')](respondWithFilteredResult(_0x5d1037,_0x3f7aa9))['catch'](handleError(_0x5d1037,null));};exports['getTeams']=function(_0x59c38b,_0x5926f4,_0x3debfc){var _0x9db19a={};var _0x1b8665={};var _0x2dccbc;var _0x39cbd8;return db[_0xf76f('0x36')][_0xf76f('0x5e')]({'where':{'id':_0x59c38b[_0xf76f('0x5c')]['id']}})[_0xf76f('0x2b')](handleEntityNotFound(_0x5926f4,null))[_0xf76f('0x2b')](function(_0x2934e3){if(_0x2934e3){_0x2dccbc=_0x2934e3;_0x1b8665[_0xf76f('0x3b')]=_['keys'](db[_0xf76f('0x6b')][_0xf76f('0x37')]);_0x1b8665[_0xf76f('0x3c')]=_[_0xf76f('0x3d')](_0x59c38b['query']);_0x1b8665[_0xf76f('0x3e')]=_[_0xf76f('0x40')](_0x1b8665['model'],_0x1b8665[_0xf76f('0x3c')]);_0x9db19a['attributes']=_[_0xf76f('0x40')](_0x1b8665['model'],qs[_0xf76f('0x41')](_0x59c38b[_0xf76f('0x3c')]['fields']));_0x9db19a[_0xf76f('0x3f')]=_0x9db19a['attributes'][_0xf76f('0x42')]?_0x9db19a[_0xf76f('0x3f')]:_0x1b8665[_0xf76f('0x3b')];_0x9db19a[_0xf76f('0x45')]=qs[_0xf76f('0x46')](_0x59c38b[_0xf76f('0x3c')][_0xf76f('0x46')]);_0x9db19a['where']=qs[_0xf76f('0x3e')](_['pick'](_0x59c38b[_0xf76f('0x3c')],_0x1b8665['filters']));if(_0x59c38b[_0xf76f('0x3c')][_0xf76f('0x49')]){_0x9db19a[_0xf76f('0x47')]=_['merge'](_0x9db19a['where'],{'$or':_[_0xf76f('0x35')](_0x9db19a['attributes'],function(_0x1dce34){var _0x441179={};_0x441179[_0x1dce34]={'$like':'%'+_0x59c38b[_0xf76f('0x3c')][_0xf76f('0x49')]+'%'};return _0x441179;})});}_0x9db19a=_[_0xf76f('0x4a')]({},_0x9db19a,_0x59c38b[_0xf76f('0x4b')]);return _0x2dccbc[_0xf76f('0x6c')](_0x9db19a);}})['then'](function(_0x42fc51){if(_0x42fc51){_0x39cbd8=_0x42fc51[_0xf76f('0x42')];if(!_0x59c38b['query']['hasOwnProperty'](_0xf76f('0x44'))){_0x9db19a[_0xf76f('0x24')]=qs[_0xf76f('0x24')](_0x59c38b['query'][_0xf76f('0x24')]);_0x9db19a[_0xf76f('0x21')]=qs[_0xf76f('0x21')](_0x59c38b[_0xf76f('0x3c')][_0xf76f('0x21')]);}return _0x2dccbc[_0xf76f('0x6c')](_0x9db19a);}})['then'](function(_0x45ba48){if(_0x45ba48){return _0x45ba48?{'count':_0x39cbd8,'rows':_0x45ba48}:null;}})['then'](respondWithResult(_0x5926f4,null))[_0xf76f('0x4f')](handleError(_0x5926f4,null));};exports['addTeams']=function(_0x27f576,_0x3a6880,_0x5412b1){var _0x3bb7cb=_0x27f576[_0xf76f('0x53')][_0xf76f('0x6d')];return db['Team'][_0xf76f('0x4d')]({'where':{'id':_0x3bb7cb},'attributes':['id'],'include':[{'model':db[_0xf76f('0x61')],'as':_0xf76f('0x6e'),'attributes':['id',_0xf76f('0x32'),_0xf76f('0x6f'),_0xf76f('0x70'),_0xf76f('0x71')],'raw':!![]}]})[_0xf76f('0x2b')](function(_0x460d5d){if(_0x460d5d){var _0x250d9e=_['flatMap'](_0x460d5d,function(_0x37650c){var _0x4368b5=_0x37650c[_0xf76f('0x2d')]({'plain':!![]});return _0x4368b5[_0xf76f('0x6e')];});return db[_0xf76f('0x36')][_0xf76f('0x52')]({'where':{'id':_0x27f576[_0xf76f('0x5c')]['id']}})['then'](function(_0x5eba3e){return db[_0xf76f('0x72')][_0xf76f('0x73')](function(_0x492e90){return _0x5eba3e[_0xf76f('0x74')](_0x3bb7cb,{'transaction':_0x492e90})[_0xf76f('0x2b')](function(){return BPromise[_0xf76f('0x75')](_0x250d9e,function(_0x59757a){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x59757a['id'],'FaxQueueId':_0x27f576['params']['id']},'transaction':_0x492e90});});})[_0xf76f('0x2b')](function(){_0x250d9e[_0xf76f('0x76')](function(_0x2cc8d9){socket[_0xf76f('0x77')](_0xf76f('0x78'),{'UserId':_0x2cc8d9['id'],'FaxQueueId':_0x5eba3e['id']});});});});});}})['then'](respondWithStatusCode(_0x3a6880,null))[_0xf76f('0x4f')](handleError(_0x3a6880,null));};exports['removeTeams']=function(_0x3ad338,_0x45629b,_0x20c332){return db[_0xf76f('0x6b')][_0xf76f('0x4d')]({'where':{'id':_0x3ad338[_0xf76f('0x3c')][_0xf76f('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xf76f('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x45629b,null))[_0xf76f('0x2b')](function(_0x4340f7){var _0x4b207e=_['map'](_0x4340f7,'id');var _0x2f30c8=[];var _0x8ea6b6=[];var _0x2f6a87=squel[_0xf76f('0x79')]();_0x2f6a87[_0xf76f('0x7a')](_0xf76f('0x7b'))[_0xf76f('0x7c')](_0xf76f('0x7d'),'tq')[_0xf76f('0x7e')](_0xf76f('0x7f'),'ut',_0xf76f('0x80'))['where'](_0xf76f('0x81'),_0x3ad338[_0xf76f('0x5c')]['id']);for(var _0x547cb9=0x0;_0x547cb9<_0x4340f7[_0xf76f('0x42')];_0x547cb9+=0x1){let _0x14b947=_0x4340f7[_0x547cb9];for(var _0x97a2a2=0x0;_0x97a2a2<_0x14b947[_0xf76f('0x6e')]['length'];_0x97a2a2+=0x1){let _0x18cd19=_0x14b947[_0xf76f('0x6e')][_0x97a2a2];var _0x218b7e=_0x2f6a87[_0xf76f('0x82')]();_0x218b7e[_0xf76f('0x47')]('ut.UserId\x20=\x20?',_0x18cd19['id']);_0x8ea6b6[_0xf76f('0x83')](db[_0xf76f('0x72')][_0xf76f('0x3c')](_0x218b7e[_0xf76f('0x84')](),{'type':db[_0xf76f('0x72')][_0xf76f('0x85')][_0xf76f('0x86')]})['then'](function(_0x49aac5){if(_0x49aac5[_0xf76f('0x42')]===0x1){return _0x18cd19['id'];}else{var _0x10124c=_[_0xf76f('0x87')](_[_0xf76f('0x35')](_0x49aac5,'TeamId'),function(_0xe6c188){return _[_0xf76f('0x88')](_0x4b207e,_0xe6c188);});if(_0x10124c){return _0x18cd19['id'];}}}));}}return BPromise[_0xf76f('0x89')](_0x8ea6b6)[_0xf76f('0x2b')](function(_0x8dbe2e){_0x2f30c8=_(_0x2f30c8)[_0xf76f('0x8a')](_0x8dbe2e)[_0xf76f('0x8b')]()[_0xf76f('0x8c')]();return db['FaxQueue']['find']({'where':{'id':_0x3ad338['params']['id']}})['then'](function(_0x3d3848){return db['sequelize'][_0xf76f('0x73')](function(_0xc83dc3){return _0x3d3848[_0xf76f('0x8d')](_0x3ad338[_0xf76f('0x3c')]['ids'],{'transaction':_0xc83dc3})['then'](function(){if(!_[_0xf76f('0x8e')](_0x2f30c8)){return _0x3d3848[_0xf76f('0x8f')](_0x2f30c8,{'transaction':_0xc83dc3});}})['then'](function(){_0x2f30c8[_0xf76f('0x76')](function(_0xec5939){socket[_0xf76f('0x77')](_0xf76f('0x90'),{'UserId':_0xec5939,'FaxQueueId':_0x3d3848['id']});});});});});});})[_0xf76f('0x2b')](respondWithStatusCode(_0x45629b,null))[_0xf76f('0x4f')](handleError(_0x45629b,null));};exports[_0xf76f('0x91')]=function(_0x1a4571,_0x36d609,_0x251ebc){return db[_0xf76f('0x36')]['find']({'where':{'id':_0x1a4571[_0xf76f('0x5c')]['id']}})[_0xf76f('0x2b')](handleEntityNotFound(_0x36d609,null))[_0xf76f('0x2b')](function(_0x300493){if(_0x300493){return _0x300493[_0xf76f('0x91')](_0x1a4571['body'][_0xf76f('0x6d')],_['omit'](_0x1a4571[_0xf76f('0x53')],[_0xf76f('0x6d'),'id'])||{})['spread'](function(_0x4e8349){for(var _0x36b936=0x0;_0x36b936<_0x1a4571[_0xf76f('0x53')]['ids']['length'];_0x36b936+=0x1){socket[_0xf76f('0x77')](_0xf76f('0x78'),{'UserId':Number(_0x1a4571[_0xf76f('0x53')][_0xf76f('0x6d')][_0x36b936]),'FaxQueueId':Number(_0x1a4571[_0xf76f('0x5c')]['id'])});}return _0x4e8349;});}})[_0xf76f('0x2b')](respondWithResult(_0x36d609,null))[_0xf76f('0x4f')](handleError(_0x36d609,null));};exports[_0xf76f('0x8f')]=function(_0x16f368,_0x21ce0b,_0x36fe09){return db[_0xf76f('0x36')][_0xf76f('0x52')]({'where':{'id':_0x16f368['params']['id']}})[_0xf76f('0x2b')](handleEntityNotFound(_0x21ce0b,null))[_0xf76f('0x2b')](function(_0x4974fb){if(_0x4974fb){return _0x4974fb[_0xf76f('0x8f')](_0x16f368[_0xf76f('0x3c')][_0xf76f('0x6d')])[_0xf76f('0x2b')](function(){if(_[_0xf76f('0x92')](_0x16f368[_0xf76f('0x3c')][_0xf76f('0x6d')])){for(var _0xb6d376=0x0;_0xb6d376<_0x16f368[_0xf76f('0x3c')][_0xf76f('0x6d')][_0xf76f('0x42')];_0xb6d376+=0x1){socket[_0xf76f('0x77')](_0xf76f('0x90'),{'UserId':Number(_0x16f368[_0xf76f('0x3c')][_0xf76f('0x6d')][_0xb6d376]),'FaxQueueId':Number(_0x16f368[_0xf76f('0x5c')]['id'])});}}else{socket[_0xf76f('0x77')]('userFaxQueue:remove',{'UserId':Number(_0x16f368[_0xf76f('0x3c')]['ids']),'FaxQueueId':Number(_0x16f368[_0xf76f('0x5c')]['id'])});}});}})[_0xf76f('0x2b')](respondWithStatusCode(_0x21ce0b,null))[_0xf76f('0x4f')](handleError(_0x21ce0b,null));};exports[_0xf76f('0x93')]=function(_0xe26299,_0x24a3bb,_0x1dffe4){var _0x4974b5={};var _0x162733={};var _0x1bd26d;var _0x11f93b;return db[_0xf76f('0x36')][_0xf76f('0x5e')]({'where':{'id':_0xe26299['params']['id']}})[_0xf76f('0x2b')](handleEntityNotFound(_0x24a3bb,null))[_0xf76f('0x2b')](function(_0x2fa3bc){if(_0x2fa3bc){_0x1bd26d=_0x2fa3bc;_0x162733['model']=_[_0xf76f('0x3d')](db[_0xf76f('0x61')][_0xf76f('0x37')]);_0x162733['query']=_[_0xf76f('0x3d')](_0xe26299[_0xf76f('0x3c')]);_0x162733['filters']=_['intersection'](_0x162733[_0xf76f('0x3b')],_0x162733[_0xf76f('0x3c')]);_0x4974b5['attributes']=_[_0xf76f('0x40')](_0x162733[_0xf76f('0x3b')],qs[_0xf76f('0x41')](_0xe26299[_0xf76f('0x3c')]['fields']));_0x4974b5['attributes']=_0x4974b5[_0xf76f('0x3f')][_0xf76f('0x42')]?_0x4974b5['attributes']:_0x162733['model'];_0x4974b5[_0xf76f('0x45')]=qs[_0xf76f('0x46')](_0xe26299[_0xf76f('0x3c')][_0xf76f('0x46')]);_0x4974b5[_0xf76f('0x47')]=qs[_0xf76f('0x3e')](_[_0xf76f('0x48')](_0xe26299[_0xf76f('0x3c')],_0x162733[_0xf76f('0x3e')]));if(_0xe26299[_0xf76f('0x3c')][_0xf76f('0x49')]){_0x4974b5[_0xf76f('0x47')]=_['merge'](_0x4974b5['where'],{'$or':_[_0xf76f('0x35')](_0x4974b5[_0xf76f('0x3f')],function(_0x264f4b){var _0x215533={};_0x215533[_0x264f4b]={'$like':'%'+_0xe26299[_0xf76f('0x3c')][_0xf76f('0x49')]+'%'};return _0x215533;})});}_0x4974b5=_[_0xf76f('0x4a')]({},_0x4974b5,_0xe26299[_0xf76f('0x4b')]);return _0x1bd26d[_0xf76f('0x93')](_0x4974b5);}})[_0xf76f('0x2b')](function(_0x280d20){if(_0x280d20){_0x11f93b=_0x280d20[_0xf76f('0x42')];if(!_0xe26299['query'][_0xf76f('0x43')]('nolimit')){_0x4974b5[_0xf76f('0x24')]=qs[_0xf76f('0x24')](_0xe26299[_0xf76f('0x3c')][_0xf76f('0x24')]);_0x4974b5[_0xf76f('0x21')]=qs[_0xf76f('0x21')](_0xe26299['query'][_0xf76f('0x21')]);}return _0x1bd26d[_0xf76f('0x93')](_0x4974b5);}})[_0xf76f('0x2b')](function(_0x2f7f91){if(_0x2f7f91){return _0x2f7f91?{'count':_0x11f93b,'rows':_0x2f7f91}:null;}})[_0xf76f('0x2b')](respondWithResult(_0x24a3bb,null))[_0xf76f('0x4f')](handleError(_0x24a3bb,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 87e6cfa..7648a5c 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 _0x7319=['emit','hook','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x7319,0xd3));var _0x9731=function(_0x3fbf5e,_0x9a2c8c){_0x3fbf5e=_0x3fbf5e-0x0;var _0x28207b=_0x7319[_0x3fbf5e];return _0x28207b;};'use strict';var EventEmitter=require(_0x9731('0x0'));var FaxQueue=require(_0x9731('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x9731('0x2')](0x0);var events={'afterCreate':_0x9731('0x3'),'afterUpdate':'update','afterDestroy':_0x9731('0x4')};function emitEvent(_0x158815){return function(_0x2dd305,_0x49af53,_0x58a572){FaxQueueEvents[_0x9731('0x5')](_0x158815+':'+_0x2dd305['id'],_0x2dd305);FaxQueueEvents[_0x9731('0x5')](_0x158815,_0x2dd305);_0x58a572(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x9731('0x6')](e,emitEvent(event));}}module[_0x9731('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x6d5b=['exports','events','FaxQueue','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x207811,_0x3420a6){var _0x170d56=function(_0x4340b7){while(--_0x4340b7){_0x207811['push'](_0x207811['shift']());}};_0x170d56(++_0x3420a6);}(_0x6d5b,0xc7));var _0xb6d5=function(_0x1dc5a7,_0x448a9f){_0x1dc5a7=_0x1dc5a7-0x0;var _0x4b3f3e=_0x6d5b[_0x1dc5a7];return _0x4b3f3e;};'use strict';var EventEmitter=require(_0xb6d5('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xb6d5('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb6d5('0x2'),'afterUpdate':_0xb6d5('0x3'),'afterDestroy':_0xb6d5('0x4')};function emitEvent(_0x2ce7a1){return function(_0x3edb5d,_0xdb83d1,_0x5791a9){FaxQueueEvents[_0xb6d5('0x5')](_0x2ce7a1+':'+_0x3edb5d['id'],_0x3edb5d);FaxQueueEvents[_0xb6d5('0x5')](_0x2ce7a1,_0x3edb5d);_0x5791a9(null);};}for(var e in events){if(events[_0xb6d5('0x6')](e)){var event=events[e];FaxQueue[_0xb6d5('0x7')](e,emitEvent(event));}}module[_0xb6d5('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 e4f5f2e..5dcd93d 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 _0xf871=['define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','path','rimraf','exports'];(function(_0x26299e,_0x394ad1){var _0x6c4f4a=function(_0x539ae9){while(--_0x539ae9){_0x26299e['push'](_0x26299e['shift']());}};_0x6c4f4a(++_0x394ad1);}(_0xf871,0x1ed));var _0x1f87=function(_0x90f34f,_0x404021){_0x90f34f=_0x90f34f-0x0;var _0x4b18cf=_0xf871[_0x90f34f];return _0x4b18cf;};'use strict';var _=require(_0x1f87('0x0'));var util=require(_0x1f87('0x1'));var logger=require(_0x1f87('0x2'))(_0x1f87('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f87('0x4'));var rimraf=require(_0x1f87('0x5'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x1f87('0x6')]=function(_0x391bf2,_0x294824){return _0x391bf2[_0x1f87('0x7')](_0x1f87('0x8'),attributes,{'tableName':_0x1f87('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64f0=['./faxQueue.attributes','define','FaxQueue','fax_queues','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment'];(function(_0x345a01,_0x2bbc13){var _0x517cde=function(_0x31957a){while(--_0x31957a){_0x345a01['push'](_0x345a01['shift']());}};_0x517cde(++_0x2bbc13);}(_0x64f0,0x11c));var _0x064f=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x64f0[_0x51fe5f];return _0x4abce9;};'use strict';var _=require(_0x064f('0x0'));var util=require(_0x064f('0x1'));var logger=require(_0x064f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x064f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x064f('0x4'));var config=require(_0x064f('0x5'));var attributes=require(_0x064f('0x6'));module['exports']=function(_0x1bd79f,_0x3b68ba){return _0x1bd79f[_0x064f('0x7')](_0x064f('0x8'),attributes,{'tableName':_0x064f('0x9'),'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 7f6c54e..3061306 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 _0x8b71=['FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','then','info'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x8b71,0xac));var _0x18b7=function(_0x250b70,_0x48daab){_0x250b70=_0x250b70-0x0;var _0x246488=_0x8b71[_0x250b70];return _0x246488;};'use strict';var _=require(_0x18b7('0x0'));var util=require(_0x18b7('0x1'));var moment=require(_0x18b7('0x2'));var BPromise=require(_0x18b7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18b7('0x4'));var db=require(_0x18b7('0x5'))['db'];var utils=require(_0x18b7('0x6'));var logger=require(_0x18b7('0x7'))(_0x18b7('0x8'));var config=require(_0x18b7('0x9'));var jayson=require(_0x18b7('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x18b7('0xb')](config['redis'],{'host':_0x18b7('0xc'),'port':0x18eb});var socket=require(_0x18b7('0xd'))(new Redis(config['redis']));require(_0x18b7('0xe'))[_0x18b7('0xf')](socket);function respondWithRpcPromise(_0x16c36b,_0x44a933,_0x18a00a){return new BPromise(function(_0xbed192,_0x49d34a){return client['request'](_0x16c36b,_0x18a00a)[_0x18b7('0x10')](function(_0x197727){logger[_0x18b7('0x11')](_0x18b7('0x12'),_0x44a933,_0x18b7('0x13'));logger[_0x18b7('0x14')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x44a933,_0x18b7('0x13'),JSON[_0x18b7('0x15')](_0x197727));if(_0x197727['error']){if(_0x197727['error'][_0x18b7('0x16')]===0x1f4){logger[_0x18b7('0x17')](_0x18b7('0x12'),_0x44a933,_0x197727[_0x18b7('0x17')]['message']);return _0x49d34a(_0x197727[_0x18b7('0x17')][_0x18b7('0x18')]);}logger[_0x18b7('0x17')]('FaxQueue,\x20%s,\x20%s',_0x44a933,_0x197727[_0x18b7('0x17')]['message']);return _0xbed192(_0x197727[_0x18b7('0x17')][_0x18b7('0x18')]);}else{logger['info'](_0x18b7('0x12'),_0x44a933,_0x18b7('0x13'));_0xbed192(_0x197727['result']['message']);}})[_0x18b7('0x19')](function(_0x510858){logger['error'](_0x18b7('0x12'),_0x44a933,_0x510858);_0x49d34a(_0x510858);});});}exports[_0x18b7('0x1a')]=function(_0x256fe8){var _0x7c9efe=this;return new Promise(function(_0x34710a,_0xc19a37){return db[_0x18b7('0x1b')]['findAll']({'raw':_0x256fe8[_0x18b7('0x1c')]?_0x256fe8[_0x18b7('0x1c')][_0x18b7('0x1d')]===undefined?!![]:![]:!![],'where':_0x256fe8[_0x18b7('0x1c')]?_0x256fe8[_0x18b7('0x1c')][_0x18b7('0x1e')]||null:null,'attributes':_0x256fe8[_0x18b7('0x1c')]?_0x256fe8[_0x18b7('0x1c')][_0x18b7('0x1f')]||null:null,'limit':_0x256fe8[_0x18b7('0x1c')]?_0x256fe8[_0x18b7('0x1c')][_0x18b7('0x20')]||null:null,'include':_0x256fe8[_0x18b7('0x1c')]?_0x256fe8[_0x18b7('0x1c')][_0x18b7('0x21')]?_[_0x18b7('0x22')](_0x256fe8[_0x18b7('0x1c')][_0x18b7('0x21')],function(_0x12c04e){return{'model':db[_0x12c04e['model']],'as':_0x12c04e['as'],'attributes':_0x12c04e[_0x18b7('0x1f')],'include':_0x12c04e[_0x18b7('0x21')]?_[_0x18b7('0x22')](_0x12c04e[_0x18b7('0x21')],function(_0x53cf8d){return{'model':db[_0x53cf8d[_0x18b7('0x23')]],'as':_0x53cf8d['as'],'attributes':_0x53cf8d['attributes'],'include':_0x53cf8d['include']?_[_0x18b7('0x22')](_0x53cf8d['include'],function(_0x8862a9){return{'model':db[_0x8862a9['model']],'as':_0x8862a9['as'],'attributes':_0x8862a9[_0x18b7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x18b7('0x10')](function(_0x14912b){logger[_0x18b7('0x11')]('GetFaxQueue',_0x256fe8);logger[_0x18b7('0x14')](_0x18b7('0x1a'),_0x256fe8,JSON[_0x18b7('0x15')](_0x14912b));_0x34710a(_0x14912b);})[_0x18b7('0x19')](function(_0x1945f5){logger['error'](_0x18b7('0x1a'),_0x1945f5[_0x18b7('0x18')],_0x256fe8);_0xc19a37(_0x7c9efe[_0x18b7('0x17')](0x1f4,_0x1945f5['message']));});});};exports[_0x18b7('0x24')]=function(_0x5cef52){var _0x29bb2c=this;return new Promise(function(_0x1e8721,_0x562978){return db['FaxQueue'][_0x18b7('0x25')]({'raw':_0x5cef52[_0x18b7('0x1c')]?_0x5cef52[_0x18b7('0x1c')][_0x18b7('0x1d')]===undefined?!![]:![]:!![],'where':_0x5cef52[_0x18b7('0x1c')]?_0x5cef52['options']['where']||null:null,'attributes':_0x5cef52[_0x18b7('0x1c')]?_0x5cef52['options'][_0x18b7('0x1f')]||null:null,'include':_0x5cef52[_0x18b7('0x1c')]?_0x5cef52['options'][_0x18b7('0x21')]?_[_0x18b7('0x22')](_0x5cef52[_0x18b7('0x1c')]['include'],function(_0x24e269){return{'model':db[_0x24e269[_0x18b7('0x23')]],'as':_0x24e269['as'],'attributes':_0x24e269[_0x18b7('0x1f')],'include':_0x24e269['include']?_['map'](_0x24e269['include'],function(_0x4924fb){return{'model':db[_0x4924fb['model']],'as':_0x4924fb['as'],'attributes':_0x4924fb[_0x18b7('0x1f')],'include':_0x4924fb[_0x18b7('0x21')]?_['map'](_0x4924fb[_0x18b7('0x21')],function(_0x535a61){return{'model':db[_0x535a61[_0x18b7('0x23')]],'as':_0x535a61['as'],'attributes':_0x535a61['attributes']};}):[]};}):[]};}):[]:[]})[_0x18b7('0x10')](function(_0x168867){logger['info'](_0x18b7('0x24'),_0x5cef52);logger[_0x18b7('0x14')](_0x18b7('0x24'),_0x5cef52,JSON[_0x18b7('0x15')](_0x168867));_0x1e8721(_0x168867);})[_0x18b7('0x19')](function(_0x49f27d){logger['error'](_0x18b7('0x24'),_0x49f27d[_0x18b7('0x18')],_0x5cef52);_0x562978(_0x29bb2c['error'](0x1f4,_0x49f27d['message']));});});}; \ No newline at end of file +var _0x1b95=['rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','then','request\x20sent','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','info','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','map','model','debug','find','ShowFaxQueue','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x5dfe6f,_0x4952f8){var _0x2d040d=function(_0x36a111){while(--_0x36a111){_0x5dfe6f['push'](_0x5dfe6f['shift']());}};_0x2d040d(++_0x4952f8);}(_0x1b95,0xfd));var _0x51b9=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x1b95[_0x4fde08];return _0x12e725;};'use strict';var _=require('lodash');var util=require(_0x51b9('0x0'));var moment=require(_0x51b9('0x1'));var BPromise=require(_0x51b9('0x2'));var rs=require(_0x51b9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51b9('0x4'));var logger=require(_0x51b9('0x5'))(_0x51b9('0x6'));var config=require(_0x51b9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x51b9('0x8')]({'port':0x232a});config[_0x51b9('0x9')]=_[_0x51b9('0xa')](config['redis'],{'host':_0x51b9('0xb'),'port':0x18eb});var socket=require(_0x51b9('0xc'))(new Redis(config[_0x51b9('0x9')]));require(_0x51b9('0xd'))[_0x51b9('0xe')](socket);function respondWithRpcPromise(_0x5c08bd,_0x32a97e,_0x25828f){return new BPromise(function(_0x3cf1da,_0x471680){return client['request'](_0x5c08bd,_0x25828f)[_0x51b9('0xf')](function(_0x32c9be){logger['info']('FaxQueue,\x20%s,\x20%s',_0x32a97e,_0x51b9('0x10'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x32a97e,_0x51b9('0x10'),JSON[_0x51b9('0x11')](_0x32c9be));if(_0x32c9be[_0x51b9('0x12')]){if(_0x32c9be[_0x51b9('0x12')][_0x51b9('0x13')]===0x1f4){logger['error'](_0x51b9('0x14'),_0x32a97e,_0x32c9be[_0x51b9('0x12')][_0x51b9('0x15')]);return _0x471680(_0x32c9be['error']['message']);}logger['error'](_0x51b9('0x14'),_0x32a97e,_0x32c9be['error'][_0x51b9('0x15')]);return _0x3cf1da(_0x32c9be[_0x51b9('0x12')][_0x51b9('0x15')]);}else{logger[_0x51b9('0x16')](_0x51b9('0x14'),_0x32a97e,'request\x20sent');_0x3cf1da(_0x32c9be['result'][_0x51b9('0x15')]);}})[_0x51b9('0x17')](function(_0xf5aee){logger[_0x51b9('0x12')](_0x51b9('0x14'),_0x32a97e,_0xf5aee);_0x471680(_0xf5aee);});});}exports[_0x51b9('0x18')]=function(_0x4cf9bf){var _0x1e3971=this;return new Promise(function(_0x3c4714,_0x56eeeb){return db[_0x51b9('0x19')]['findAll']({'raw':_0x4cf9bf['options']?_0x4cf9bf[_0x51b9('0x1a')][_0x51b9('0x1b')]===undefined?!![]:![]:!![],'where':_0x4cf9bf[_0x51b9('0x1a')]?_0x4cf9bf[_0x51b9('0x1a')][_0x51b9('0x1c')]||null:null,'attributes':_0x4cf9bf[_0x51b9('0x1a')]?_0x4cf9bf['options'][_0x51b9('0x1d')]||null:null,'limit':_0x4cf9bf[_0x51b9('0x1a')]?_0x4cf9bf[_0x51b9('0x1a')][_0x51b9('0x1e')]||null:null,'include':_0x4cf9bf[_0x51b9('0x1a')]?_0x4cf9bf[_0x51b9('0x1a')][_0x51b9('0x1f')]?_[_0x51b9('0x20')](_0x4cf9bf['options'][_0x51b9('0x1f')],function(_0x4aba3e){return{'model':db[_0x4aba3e[_0x51b9('0x21')]],'as':_0x4aba3e['as'],'attributes':_0x4aba3e[_0x51b9('0x1d')],'include':_0x4aba3e[_0x51b9('0x1f')]?_[_0x51b9('0x20')](_0x4aba3e[_0x51b9('0x1f')],function(_0x43529b){return{'model':db[_0x43529b[_0x51b9('0x21')]],'as':_0x43529b['as'],'attributes':_0x43529b[_0x51b9('0x1d')],'include':_0x43529b[_0x51b9('0x1f')]?_[_0x51b9('0x20')](_0x43529b[_0x51b9('0x1f')],function(_0x447d1f){return{'model':db[_0x447d1f[_0x51b9('0x21')]],'as':_0x447d1f['as'],'attributes':_0x447d1f[_0x51b9('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8b26f5){logger['info'](_0x51b9('0x18'),_0x4cf9bf);logger[_0x51b9('0x22')]('GetFaxQueue',_0x4cf9bf,JSON[_0x51b9('0x11')](_0x8b26f5));_0x3c4714(_0x8b26f5);})['catch'](function(_0x4edb5c){logger[_0x51b9('0x12')](_0x51b9('0x18'),_0x4edb5c[_0x51b9('0x15')],_0x4cf9bf);_0x56eeeb(_0x1e3971['error'](0x1f4,_0x4edb5c[_0x51b9('0x15')]));});});};exports['ShowFaxQueue']=function(_0x3aece7){var _0x120ace=this;return new Promise(function(_0x5201de,_0x35256f){return db[_0x51b9('0x19')][_0x51b9('0x23')]({'raw':_0x3aece7[_0x51b9('0x1a')]?_0x3aece7[_0x51b9('0x1a')][_0x51b9('0x1b')]===undefined?!![]:![]:!![],'where':_0x3aece7[_0x51b9('0x1a')]?_0x3aece7[_0x51b9('0x1a')]['where']||null:null,'attributes':_0x3aece7[_0x51b9('0x1a')]?_0x3aece7[_0x51b9('0x1a')][_0x51b9('0x1d')]||null:null,'include':_0x3aece7[_0x51b9('0x1a')]?_0x3aece7[_0x51b9('0x1a')][_0x51b9('0x1f')]?_[_0x51b9('0x20')](_0x3aece7['options'][_0x51b9('0x1f')],function(_0x325884){return{'model':db[_0x325884[_0x51b9('0x21')]],'as':_0x325884['as'],'attributes':_0x325884['attributes'],'include':_0x325884[_0x51b9('0x1f')]?_['map'](_0x325884[_0x51b9('0x1f')],function(_0x183aa1){return{'model':db[_0x183aa1[_0x51b9('0x21')]],'as':_0x183aa1['as'],'attributes':_0x183aa1[_0x51b9('0x1d')],'include':_0x183aa1[_0x51b9('0x1f')]?_[_0x51b9('0x20')](_0x183aa1['include'],function(_0x44d8c7){return{'model':db[_0x44d8c7[_0x51b9('0x21')]],'as':_0x44d8c7['as'],'attributes':_0x44d8c7[_0x51b9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x51b9('0xf')](function(_0x308f47){logger['info'](_0x51b9('0x24'),_0x3aece7);logger[_0x51b9('0x22')]('ShowFaxQueue',_0x3aece7,JSON['stringify'](_0x308f47));_0x5201de(_0x308f47);})[_0x51b9('0x17')](function(_0x148959){logger['error']('ShowFaxQueue',_0x148959[_0x51b9('0x15')],_0x3aece7);_0x35256f(_0x120ace['error'](0x1f4,_0x148959[_0x51b9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 62f4c89..7d9d88a 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 _0x1220=['emit','length','./faxQueue.events','save'];(function(_0x3ace60,_0x19735e){var _0x30eb00=function(_0xfded5f){while(--_0xfded5f){_0x3ace60['push'](_0x3ace60['shift']());}};_0x30eb00(++_0x19735e);}(_0x1220,0x8a));var _0x0122=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x1220[_0x50a0c2];return _0x5ebadd;};'use strict';var FaxQueueEvents=require(_0x0122('0x0'));var events=[_0x0122('0x1'),'remove','update'];function createListener(_0x4842aa,_0x1b23e6){return function(_0xebad2b){_0x1b23e6[_0x0122('0x2')](_0x4842aa,_0xebad2b);};}function removeListener(_0x400a17,_0x2876f4){return function(){FaxQueueEvents['removeListener'](_0x400a17,_0x2876f4);};}exports['register']=function(_0x300dfe){for(var _0x33bd09=0x0,_0x8b4dca=events[_0x0122('0x3')];_0x33bd09<_0x8b4dca;_0x33bd09++){var _0x5b72e5=events[_0x33bd09];var _0x38e810=createListener('faxQueue:'+_0x5b72e5,_0x300dfe);FaxQueueEvents['on'](_0x5b72e5,_0x38e810);}}; \ No newline at end of file +var _0x3ee8=['remove','update','emit','removeListener','register','length','faxQueue:'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x3ee8,0x188));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0x83ee('0x0'),_0x83ee('0x1')];function createListener(_0x167a2a,_0x45b951){return function(_0x5f1671){_0x45b951[_0x83ee('0x2')](_0x167a2a,_0x5f1671);};}function removeListener(_0x1afb42,_0x29fee5){return function(){FaxQueueEvents[_0x83ee('0x3')](_0x1afb42,_0x29fee5);};}exports[_0x83ee('0x4')]=function(_0x59602d){for(var _0x107d14=0x0,_0x4068bb=events[_0x83ee('0x5')];_0x107d14<_0x4068bb;_0x107d14++){var _0x27847c=events[_0x107d14];var _0x1e041d=createListener(_0x83ee('0x6')+_0x27847c,_0x59602d);FaxQueueEvents['on'](_0x27847c,_0x1e041d);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 37dc3e5..a7143d7 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 _0xb016=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','post','create','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','express','fs-extra','../../components/auth/service'];(function(_0x5470cd,_0x13ed59){var _0x1e122b=function(_0x33f901){while(--_0x33f901){_0x5470cd['push'](_0x5470cd['shift']());}};_0x1e122b(++_0x13ed59);}(_0xb016,0x159));var _0x6b01=function(_0x263bad,_0x28b936){_0x263bad=_0x263bad-0x0;var _0x1bb45a=_0xb016[_0x263bad];return _0x1bb45a;};'use strict';var multer=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b01('0x2'));var router=express['Router']();var fs_extra=require(_0x6b01('0x3'));var auth=require(_0x6b01('0x4'));var interaction=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var controller=require('./faxQueue.controller');router[_0x6b01('0x7')]('/',auth[_0x6b01('0x8')](),controller[_0x6b01('0x9')]);router['get']('/describe',auth[_0x6b01('0x8')](),controller[_0x6b01('0xa')]);router['get']('/:id',auth[_0x6b01('0x8')](),controller[_0x6b01('0xb')]);router[_0x6b01('0x7')](_0x6b01('0xc'),auth[_0x6b01('0x8')](),controller['getMembers']);router['get'](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller[_0x6b01('0xe')]);router['get'](_0x6b01('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0x6b01('0x10')]('/',auth['isAuthenticated'](),controller[_0x6b01('0x11')]);router[_0x6b01('0x10')]('/:id/teams',auth[_0x6b01('0x8')](),controller['addTeams']);router['post']('/:id/users',auth[_0x6b01('0x8')](),controller['addAgents']);router['put'](_0x6b01('0x12'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x13')]);router[_0x6b01('0x14')](_0x6b01('0x12'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x15')]);router[_0x6b01('0x14')](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x16')]);router['delete'](_0x6b01('0xf'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x17')]);module[_0x6b01('0x18')]=router; \ No newline at end of file +var _0xe626=['isAuthenticated','describe','/:id','show','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','/:id/teams','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get'];(function(_0x494180,_0x36d4c5){var _0x14eeef=function(_0x8446bb){while(--_0x8446bb){_0x494180['push'](_0x494180['shift']());}};_0x14eeef(++_0x36d4c5);}(_0xe626,0x9d));var _0x6e62=function(_0x12beed,_0x2e5ad3){_0x12beed=_0x12beed-0x0;var _0x42491c=_0xe626[_0x12beed];return _0x42491c;};'use strict';var multer=require(_0x6e62('0x0'));var util=require(_0x6e62('0x1'));var path=require(_0x6e62('0x2'));var timeout=require(_0x6e62('0x3'));var express=require('express');var router=express[_0x6e62('0x4')]();var fs_extra=require(_0x6e62('0x5'));var auth=require(_0x6e62('0x6'));var interaction=require(_0x6e62('0x7'));var config=require(_0x6e62('0x8'));var controller=require('./faxQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x6e62('0x9')]);router[_0x6e62('0xa')]('/describe',auth[_0x6e62('0xb')](),controller[_0x6e62('0xc')]);router[_0x6e62('0xa')](_0x6e62('0xd'),auth['isAuthenticated'](),controller[_0x6e62('0xe')]);router[_0x6e62('0xa')]('/:id/members',auth[_0x6e62('0xb')](),controller['getMembers']);router[_0x6e62('0xa')]('/:id/teams',auth[_0x6e62('0xb')](),controller['getTeams']);router[_0x6e62('0xa')](_0x6e62('0xf'),auth[_0x6e62('0xb')](),controller[_0x6e62('0x10')]);router[_0x6e62('0x11')]('/',auth[_0x6e62('0xb')](),controller[_0x6e62('0x12')]);router['post']('/:id/teams',auth[_0x6e62('0xb')](),controller[_0x6e62('0x13')]);router['post'](_0x6e62('0xf'),auth[_0x6e62('0xb')](),controller[_0x6e62('0x14')]);router[_0x6e62('0x15')]('/:id',auth[_0x6e62('0xb')](),controller[_0x6e62('0x16')]);router[_0x6e62('0x17')](_0x6e62('0xd'),auth[_0x6e62('0xb')](),controller[_0x6e62('0x18')]);router[_0x6e62('0x17')](_0x6e62('0x19'),auth[_0x6e62('0xb')](),controller[_0x6e62('0x1a')]);router['delete'](_0x6e62('0xf'),auth[_0x6e62('0xb')](),controller['removeAgents']);module[_0x6e62('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index c0d9a08..3480ac5 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 _0x309d=['exports','STRING','DATE','moment','sequelize'];(function(_0x53360d,_0x1f2dc4){var _0x5b86f7=function(_0x4fe27f){while(--_0x4fe27f){_0x53360d['push'](_0x53360d['shift']());}};_0x5b86f7(++_0x1f2dc4);}(_0x309d,0x1ed));var _0xd309=function(_0x1a810d,_0x577ca6){_0x1a810d=_0x1a810d-0x0;var _0x263eef=_0x309d[_0x1a810d];return _0x263eef;};'use strict';var moment=require(_0xd309('0x0'));var Sequelize=require(_0xd309('0x1'));module[_0xd309('0x2')]={'uniqueid':{'type':Sequelize[_0xd309('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd309('0x4')]},'leaveAt':{'type':Sequelize[_0xd309('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd309('0x4')]},'reason':{'type':Sequelize[_0xd309('0x3')]}}; \ No newline at end of file +var _0xe95e=['moment','sequelize','exports','STRING','DATE'];(function(_0x3b7740,_0x1da42b){var _0x25a980=function(_0x49616a){while(--_0x49616a){_0x3b7740['push'](_0x3b7740['shift']());}};_0x25a980(++_0x1da42b);}(_0xe95e,0x78));var _0xee95=function(_0x1a2ed5,_0x255d82){_0x1a2ed5=_0x1a2ed5-0x0;var _0x5c9cc1=_0xe95e[_0x1a2ed5];return _0x5c9cc1;};'use strict';var moment=require(_0xee95('0x0'));var Sequelize=require(_0xee95('0x1'));module[_0xee95('0x2')]={'uniqueid':{'type':Sequelize[_0xee95('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xee95('0x3')]},'joinAt':{'type':Sequelize[_0xee95('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xee95('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xee95('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index d5b6491..d0af46a 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 _0x49e9=['count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','FaxQueueReport','rawAttributes','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','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','undefined','limit'];(function(_0x120eb8,_0x4411bc){var _0x342cd8=function(_0x4730c8){while(--_0x4730c8){_0x120eb8['push'](_0x120eb8['shift']());}};_0x342cd8(++_0x4411bc);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x949e('0x0'));var rimraf=require(_0x949e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x949e('0x2'));var rp=require(_0x949e('0x3'));var moment=require(_0x949e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x949e('0x5'));var path=require('path');var sox=require(_0x949e('0x6'));var csv=require(_0x949e('0x7'));var ejs=require(_0x949e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x949e('0x9'));var squel=require(_0x949e('0xa'));var crypto=require(_0x949e('0xb'));var jsforce=require(_0x949e('0xc'));var deskjs=require(_0x949e('0xd'));var toCsv=require(_0x949e('0x7'));var querystring=require(_0x949e('0xe'));var Papa=require('papaparse');var Redis=require(_0x949e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x949e('0x10'));var as=require(_0x949e('0x11'));var hardwareService=require(_0x949e('0x12'));var logger=require('../../config/logger')(_0x949e('0x13'));var utils=require(_0x949e('0x14'));var config=require(_0x949e('0x15'));var licenseUtil=require(_0x949e('0x16'));var db=require(_0x949e('0x17'))['db'];function respondWithStatusCode(_0x253d5e,_0x1871a5){_0x1871a5=_0x1871a5||0xcc;return function(_0x17d1f3){if(_0x17d1f3){return _0x253d5e[_0x949e('0x18')](_0x1871a5);}return _0x253d5e[_0x949e('0x19')](_0x1871a5)[_0x949e('0x1a')]();};}function respondWithResult(_0x7a8954,_0x3e0e54){_0x3e0e54=_0x3e0e54||0xc8;return function(_0x7f8be2){if(_0x7f8be2){return _0x7a8954[_0x949e('0x19')](_0x3e0e54)['json'](_0x7f8be2);}};}function respondWithFilteredResult(_0x257981,_0x3d81cd){return function(_0x587bff){if(_0x587bff){var _0xf1f41a=typeof _0x3d81cd['offset']===_0x949e('0x1b')&&typeof _0x3d81cd[_0x949e('0x1c')]==='undefined';var _0x37fd96=_0x587bff[_0x949e('0x1d')];var _0x43498d=_0xf1f41a?0x0:_0x3d81cd[_0x949e('0x1e')];var _0x20333c=_0xf1f41a?_0x587bff['count']:_0x3d81cd[_0x949e('0x1e')]+_0x3d81cd[_0x949e('0x1c')];var _0x476fa8;if(_0x20333c>=_0x37fd96){_0x20333c=_0x37fd96;_0x476fa8=0xc8;}else{_0x476fa8=0xce;}_0x257981[_0x949e('0x19')](_0x476fa8);return _0x257981[_0x949e('0x1f')](_0x949e('0x20'),_0x43498d+'-'+_0x20333c+'/'+_0x37fd96)[_0x949e('0x21')](_0x587bff);}return null;};}function patchUpdates(_0x2f21bd){return function(_0x104740){try{jsonpatch[_0x949e('0x22')](_0x104740,_0x2f21bd,!![]);}catch(_0x23fc20){return BPromise[_0x949e('0x23')](_0x23fc20);}return _0x104740[_0x949e('0x24')]();};}function saveUpdates(_0x1927ab,_0x199d53){return function(_0x2e81f2){if(_0x2e81f2){return _0x2e81f2['update'](_0x1927ab)[_0x949e('0x25')](function(_0x44ffb4){return _0x44ffb4;});}return null;};}function removeEntity(_0x5572ae,_0x48a1d1){return function(_0x23b38e){if(_0x23b38e){return _0x23b38e[_0x949e('0x26')]()[_0x949e('0x25')](function(){_0x5572ae[_0x949e('0x19')](0xcc)[_0x949e('0x1a')]();});}};}function handleEntityNotFound(_0x1185b3,_0x29e07b){return function(_0x255b11){if(!_0x255b11){_0x1185b3[_0x949e('0x18')](0x194);}return _0x255b11;};}function handleError(_0x20258c,_0x5dcc46){_0x5dcc46=_0x5dcc46||0x1f4;return function(_0x212224){logger[_0x949e('0x27')](_0x212224['stack']);if(_0x212224[_0x949e('0x28')]){delete _0x212224[_0x949e('0x28')];}_0x20258c['status'](_0x5dcc46)[_0x949e('0x29')](_0x212224);};}exports[_0x949e('0x2a')]=function(_0x5b9f28,_0x1867d9){var _0x5b2b0b={},_0x5e6e34={},_0x4e169d={'count':0x0,'rows':[]};var _0x54ad5d=_['map'](db[_0x949e('0x2b')][_0x949e('0x2c')],function(_0x3051ec){return{'name':_0x3051ec['fieldName'],'type':_0x3051ec['type']['key']};});_0x5e6e34['model']=_[_0x949e('0x2d')](_0x54ad5d,_0x949e('0x28'));_0x5e6e34[_0x949e('0x2e')]=_[_0x949e('0x2f')](_0x5b9f28['query']);_0x5e6e34[_0x949e('0x30')]=_[_0x949e('0x31')](_0x5e6e34[_0x949e('0x32')],_0x5e6e34['query']);_0x5b2b0b[_0x949e('0x33')]=_[_0x949e('0x31')](_0x5e6e34[_0x949e('0x32')],qs['fields'](_0x5b9f28['query'][_0x949e('0x34')]));_0x5b2b0b[_0x949e('0x33')]=_0x5b2b0b[_0x949e('0x33')][_0x949e('0x35')]?_0x5b2b0b['attributes']:_0x5e6e34[_0x949e('0x32')];if(!_0x5b9f28[_0x949e('0x2e')][_0x949e('0x36')](_0x949e('0x37'))){_0x5b2b0b[_0x949e('0x1c')]=qs[_0x949e('0x1c')](_0x5b9f28[_0x949e('0x2e')][_0x949e('0x1c')]);_0x5b2b0b['offset']=qs['offset'](_0x5b9f28[_0x949e('0x2e')]['offset']);}_0x5b2b0b['order']=qs[_0x949e('0x38')](_0x5b9f28[_0x949e('0x2e')][_0x949e('0x38')]);_0x5b2b0b[_0x949e('0x39')]=qs[_0x949e('0x30')](_[_0x949e('0x3a')](_0x5b9f28[_0x949e('0x2e')],_0x5e6e34[_0x949e('0x30')]),_0x54ad5d);if(_0x5b9f28[_0x949e('0x2e')][_0x949e('0x3b')]){_0x5b2b0b[_0x949e('0x39')]=_[_0x949e('0x3c')](_0x5b2b0b[_0x949e('0x39')],{'$or':_[_0x949e('0x2d')](_0x54ad5d,function(_0x26ad2b){if(_0x26ad2b[_0x949e('0x3d')]!==_0x949e('0x3e')){var _0x498fa3={};_0x498fa3[_0x26ad2b[_0x949e('0x28')]]={'$like':'%'+_0x5b9f28['query'][_0x949e('0x3b')]+'%'};return _0x498fa3;}})});}_0x5b2b0b=_[_0x949e('0x3c')]({},_0x5b2b0b,_0x5b9f28['options']);var _0x5084dc={'where':_0x5b2b0b['where']};return db[_0x949e('0x2b')][_0x949e('0x1d')](_0x5084dc)['then'](function(_0x59c024){_0x4e169d['count']=_0x59c024;if(_0x5b9f28[_0x949e('0x2e')][_0x949e('0x3f')]){_0x5b2b0b['include']=[{'all':!![]}];}return db[_0x949e('0x2b')][_0x949e('0x40')](_0x5b2b0b);})['then'](function(_0x3a1bc7){_0x4e169d[_0x949e('0x41')]=_0x3a1bc7;return _0x4e169d;})[_0x949e('0x25')](respondWithFilteredResult(_0x1867d9,_0x5b2b0b))[_0x949e('0x42')](handleError(_0x1867d9,null));};exports['show']=function(_0x58b34b,_0x2bca69){var _0x590aa7={'raw':!![],'where':{'id':_0x58b34b[_0x949e('0x43')]['id']}},_0x7201da={};_0x7201da[_0x949e('0x32')]=_[_0x949e('0x2f')](db[_0x949e('0x2b')]['rawAttributes']);_0x7201da['query']=_[_0x949e('0x2f')](_0x58b34b['query']);_0x7201da[_0x949e('0x30')]=_[_0x949e('0x31')](_0x7201da[_0x949e('0x32')],_0x7201da[_0x949e('0x2e')]);_0x590aa7[_0x949e('0x33')]=_[_0x949e('0x31')](_0x7201da['model'],qs['fields'](_0x58b34b[_0x949e('0x2e')][_0x949e('0x34')]));_0x590aa7[_0x949e('0x33')]=_0x590aa7[_0x949e('0x33')][_0x949e('0x35')]?_0x590aa7['attributes']:_0x7201da[_0x949e('0x32')];if(_0x58b34b[_0x949e('0x2e')]['includeAll']){_0x590aa7[_0x949e('0x44')]=[{'all':!![]}];}_0x590aa7=_[_0x949e('0x3c')]({},_0x590aa7,_0x58b34b[_0x949e('0x45')]);return db[_0x949e('0x2b')][_0x949e('0x46')](_0x590aa7)[_0x949e('0x25')](handleEntityNotFound(_0x2bca69,null))[_0x949e('0x25')](respondWithResult(_0x2bca69,null))[_0x949e('0x42')](handleError(_0x2bca69,null));};exports[_0x949e('0x47')]=function(_0x4913f5,_0x1599ea){return db['FaxQueueReport'][_0x949e('0x47')](_0x4913f5[_0x949e('0x48')],{})['then'](respondWithResult(_0x1599ea,0xc9))[_0x949e('0x42')](handleError(_0x1599ea,null));};exports[_0x949e('0x49')]=function(_0x121355,_0x2e2b6a){if(_0x121355[_0x949e('0x48')]['id']){delete _0x121355[_0x949e('0x48')]['id'];}return db[_0x949e('0x2b')][_0x949e('0x46')]({'where':{'id':_0x121355['params']['id']}})[_0x949e('0x25')](handleEntityNotFound(_0x2e2b6a,null))[_0x949e('0x25')](saveUpdates(_0x121355[_0x949e('0x48')],null))[_0x949e('0x25')](respondWithResult(_0x2e2b6a,null))[_0x949e('0x42')](handleError(_0x2e2b6a,null));};exports['destroy']=function(_0x5f23b2,_0x46a4fe){return db[_0x949e('0x2b')]['find']({'where':{'id':_0x5f23b2[_0x949e('0x43')]['id']}})[_0x949e('0x25')](handleEntityNotFound(_0x46a4fe,null))[_0x949e('0x25')](removeEntity(_0x46a4fe,null))[_0x949e('0x42')](handleError(_0x46a4fe,null));};exports['describe']=function(_0x4b990e,_0x450d16){return db[_0x949e('0x2b')][_0x949e('0x4a')]()[_0x949e('0x25')](respondWithResult(_0x450d16,null))[_0x949e('0x42')](handleError(_0x450d16,null));}; \ No newline at end of file +var _0x34e5=['mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','error','stack','index','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','FaxQueueReport','includeAll','include','findAll','rows','show','options','find','catch','create','body','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0xc381b,_0x13a8cb){var _0x33dfd8=function(_0x5900d9){while(--_0x5900d9){_0xc381b['push'](_0xc381b['shift']());}};_0x33dfd8(++_0x13a8cb);}(_0x34e5,0x172));var _0x534e=function(_0x5985fe,_0x311135){_0x5985fe=_0x5985fe-0x0;var _0x3b252e=_0x34e5[_0x5985fe];return _0x3b252e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x534e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x534e('0x1'));var rp=require(_0x534e('0x2'));var moment=require(_0x534e('0x3'));var BPromise=require(_0x534e('0x4'));var Mustache=require(_0x534e('0x5'));var util=require('util');var path=require(_0x534e('0x6'));var sox=require(_0x534e('0x7'));var csv=require(_0x534e('0x8'));var ejs=require(_0x534e('0x9'));var fs=require('fs');var fs_extra=require(_0x534e('0xa'));var _=require(_0x534e('0xb'));var squel=require(_0x534e('0xc'));var crypto=require('crypto');var jsforce=require(_0x534e('0xd'));var deskjs=require(_0x534e('0xe'));var toCsv=require(_0x534e('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x534e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x534e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x534e('0x11'));var logger=require(_0x534e('0x12'))(_0x534e('0x13'));var utils=require('../../config/utils');var config=require(_0x534e('0x14'));var licenseUtil=require(_0x534e('0x15'));var db=require(_0x534e('0x16'))['db'];function respondWithStatusCode(_0x28b8ff,_0x2c4539){_0x2c4539=_0x2c4539||0xcc;return function(_0x5ef1b1){if(_0x5ef1b1){return _0x28b8ff[_0x534e('0x17')](_0x2c4539);}return _0x28b8ff[_0x534e('0x18')](_0x2c4539)[_0x534e('0x19')]();};}function respondWithResult(_0x3ff42d,_0x359565){_0x359565=_0x359565||0xc8;return function(_0x478027){if(_0x478027){return _0x3ff42d[_0x534e('0x18')](_0x359565)[_0x534e('0x1a')](_0x478027);}};}function respondWithFilteredResult(_0x536c9e,_0x5282cb){return function(_0x4171d6){if(_0x4171d6){var _0x3940c3=typeof _0x5282cb['offset']==='undefined'&&typeof _0x5282cb[_0x534e('0x1b')]===_0x534e('0x1c');var _0x9297b6=_0x4171d6[_0x534e('0x1d')];var _0x22bc92=_0x3940c3?0x0:_0x5282cb[_0x534e('0x1e')];var _0x100751=_0x3940c3?_0x4171d6['count']:_0x5282cb[_0x534e('0x1e')]+_0x5282cb[_0x534e('0x1b')];var _0x466d74;if(_0x100751>=_0x9297b6){_0x100751=_0x9297b6;_0x466d74=0xc8;}else{_0x466d74=0xce;}_0x536c9e[_0x534e('0x18')](_0x466d74);return _0x536c9e[_0x534e('0x1f')]('Content-Range',_0x22bc92+'-'+_0x100751+'/'+_0x9297b6)[_0x534e('0x1a')](_0x4171d6);}return null;};}function patchUpdates(_0x1b87d1){return function(_0x5f9ae9){try{jsonpatch[_0x534e('0x20')](_0x5f9ae9,_0x1b87d1,!![]);}catch(_0x4724f9){return BPromise[_0x534e('0x21')](_0x4724f9);}return _0x5f9ae9[_0x534e('0x22')]();};}function saveUpdates(_0x85188b,_0x21f2e1){return function(_0x5e086a){if(_0x5e086a){return _0x5e086a[_0x534e('0x23')](_0x85188b)[_0x534e('0x24')](function(_0x39466c){return _0x39466c;});}return null;};}function removeEntity(_0x4a09ed,_0x324205){return function(_0x44bbc1){if(_0x44bbc1){return _0x44bbc1[_0x534e('0x25')]()[_0x534e('0x24')](function(){_0x4a09ed['status'](0xcc)[_0x534e('0x19')]();});}};}function handleEntityNotFound(_0x588c08,_0xb83f1){return function(_0x106b7a){if(!_0x106b7a){_0x588c08[_0x534e('0x17')](0x194);}return _0x106b7a;};}function handleError(_0x1720f4,_0x174577){_0x174577=_0x174577||0x1f4;return function(_0x57b216){logger[_0x534e('0x26')](_0x57b216[_0x534e('0x27')]);if(_0x57b216['name']){delete _0x57b216['name'];}_0x1720f4[_0x534e('0x18')](_0x174577)['send'](_0x57b216);};}exports[_0x534e('0x28')]=function(_0x3c5c11,_0x281cda){var _0x122225={},_0x15be5c={},_0x42119b={'count':0x0,'rows':[]};var _0x5253b5=_['map'](db['FaxQueueReport'][_0x534e('0x29')],function(_0x15bdc1){return{'name':_0x15bdc1[_0x534e('0x2a')],'type':_0x15bdc1[_0x534e('0x2b')][_0x534e('0x2c')]};});_0x15be5c[_0x534e('0x2d')]=_[_0x534e('0x2e')](_0x5253b5,_0x534e('0x2f'));_0x15be5c[_0x534e('0x30')]=_[_0x534e('0x31')](_0x3c5c11[_0x534e('0x30')]);_0x15be5c[_0x534e('0x32')]=_['intersection'](_0x15be5c[_0x534e('0x2d')],_0x15be5c[_0x534e('0x30')]);_0x122225['attributes']=_[_0x534e('0x33')](_0x15be5c['model'],qs[_0x534e('0x34')](_0x3c5c11[_0x534e('0x30')][_0x534e('0x34')]));_0x122225[_0x534e('0x35')]=_0x122225['attributes'][_0x534e('0x36')]?_0x122225[_0x534e('0x35')]:_0x15be5c['model'];if(!_0x3c5c11['query'][_0x534e('0x37')](_0x534e('0x38'))){_0x122225[_0x534e('0x1b')]=qs[_0x534e('0x1b')](_0x3c5c11['query'][_0x534e('0x1b')]);_0x122225['offset']=qs[_0x534e('0x1e')](_0x3c5c11['query'][_0x534e('0x1e')]);}_0x122225[_0x534e('0x39')]=qs['sort'](_0x3c5c11[_0x534e('0x30')]['sort']);_0x122225['where']=qs['filters'](_['pick'](_0x3c5c11[_0x534e('0x30')],_0x15be5c['filters']),_0x5253b5);if(_0x3c5c11['query'][_0x534e('0x3a')]){_0x122225[_0x534e('0x3b')]=_[_0x534e('0x3c')](_0x122225['where'],{'$or':_[_0x534e('0x2e')](_0x5253b5,function(_0x20bbfa){if(_0x20bbfa['type']!==_0x534e('0x3d')){var _0x47c952={};_0x47c952[_0x20bbfa[_0x534e('0x2f')]]={'$like':'%'+_0x3c5c11[_0x534e('0x30')]['filter']+'%'};return _0x47c952;}})});}_0x122225=_[_0x534e('0x3c')]({},_0x122225,_0x3c5c11['options']);var _0x1c5260={'where':_0x122225[_0x534e('0x3b')]};return db[_0x534e('0x3e')][_0x534e('0x1d')](_0x1c5260)['then'](function(_0x5ca5c4){_0x42119b[_0x534e('0x1d')]=_0x5ca5c4;if(_0x3c5c11['query'][_0x534e('0x3f')]){_0x122225[_0x534e('0x40')]=[{'all':!![]}];}return db[_0x534e('0x3e')][_0x534e('0x41')](_0x122225);})['then'](function(_0x1dcfe5){_0x42119b[_0x534e('0x42')]=_0x1dcfe5;return _0x42119b;})[_0x534e('0x24')](respondWithFilteredResult(_0x281cda,_0x122225))['catch'](handleError(_0x281cda,null));};exports[_0x534e('0x43')]=function(_0x549649,_0x1493c1){var _0x24c9c2={'raw':!![],'where':{'id':_0x549649['params']['id']}},_0x32f2aa={};_0x32f2aa[_0x534e('0x2d')]=_[_0x534e('0x31')](db[_0x534e('0x3e')][_0x534e('0x29')]);_0x32f2aa[_0x534e('0x30')]=_[_0x534e('0x31')](_0x549649[_0x534e('0x30')]);_0x32f2aa['filters']=_[_0x534e('0x33')](_0x32f2aa['model'],_0x32f2aa['query']);_0x24c9c2[_0x534e('0x35')]=_[_0x534e('0x33')](_0x32f2aa[_0x534e('0x2d')],qs[_0x534e('0x34')](_0x549649[_0x534e('0x30')][_0x534e('0x34')]));_0x24c9c2['attributes']=_0x24c9c2[_0x534e('0x35')][_0x534e('0x36')]?_0x24c9c2[_0x534e('0x35')]:_0x32f2aa['model'];if(_0x549649[_0x534e('0x30')]['includeAll']){_0x24c9c2[_0x534e('0x40')]=[{'all':!![]}];}_0x24c9c2=_[_0x534e('0x3c')]({},_0x24c9c2,_0x549649[_0x534e('0x44')]);return db[_0x534e('0x3e')][_0x534e('0x45')](_0x24c9c2)[_0x534e('0x24')](handleEntityNotFound(_0x1493c1,null))['then'](respondWithResult(_0x1493c1,null))[_0x534e('0x46')](handleError(_0x1493c1,null));};exports['create']=function(_0x5cfe5f,_0x298e11){return db[_0x534e('0x3e')][_0x534e('0x47')](_0x5cfe5f[_0x534e('0x48')],{})[_0x534e('0x24')](respondWithResult(_0x298e11,0xc9))[_0x534e('0x46')](handleError(_0x298e11,null));};exports[_0x534e('0x23')]=function(_0x376c83,_0x42c35d){if(_0x376c83['body']['id']){delete _0x376c83[_0x534e('0x48')]['id'];}return db[_0x534e('0x3e')][_0x534e('0x45')]({'where':{'id':_0x376c83[_0x534e('0x49')]['id']}})['then'](handleEntityNotFound(_0x42c35d,null))[_0x534e('0x24')](saveUpdates(_0x376c83[_0x534e('0x48')],null))[_0x534e('0x24')](respondWithResult(_0x42c35d,null))[_0x534e('0x46')](handleError(_0x42c35d,null));};exports[_0x534e('0x25')]=function(_0x176147,_0xc625df){return db[_0x534e('0x3e')][_0x534e('0x45')]({'where':{'id':_0x176147[_0x534e('0x49')]['id']}})[_0x534e('0x24')](handleEntityNotFound(_0xc625df,null))[_0x534e('0x24')](removeEntity(_0xc625df,null))['catch'](handleError(_0xc625df,null));};exports[_0x534e('0x4a')]=function(_0x3aee59,_0x5a5507){return db[_0x534e('0x3e')][_0x534e('0x4a')]()[_0x534e('0x24')](respondWithResult(_0x5a5507,null))['catch'](handleError(_0x5a5507,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 97dfcd4..a7e516f 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 _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5cc07d,_0x545e1f){_0x5cc07d=_0x5cc07d-0x0;var _0x3b371d=_0x1cb9[_0x5cc07d];return _0x3b371d;};'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_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0x1cb9,0x14e));var _0x91cb=function(_0x36d338,_0x3fb051){_0x36d338=_0x36d338-0x0;var _0x51acd7=_0x1cb9[_0x36d338];return _0x51acd7;};'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_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 0109032..faa32d9 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 _0x3c13=['../../config/logger','../../config/environment','jayson/promise','client','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','body','raw','UpdateFaxQueueReport','options','where','limit','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x3c13,0xbf));var _0x33c1=function(_0x5777a8,_0x24b197){_0x5777a8=_0x5777a8-0x0;var _0x172424=_0x3c13[_0x5777a8];return _0x172424;};'use strict';var _=require('lodash');var util=require(_0x33c1('0x0'));var moment=require(_0x33c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x33c1('0x2'));var fs=require('fs');var Redis=require(_0x33c1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x33c1('0x4'));var logger=require(_0x33c1('0x5'))('rpc');var config=require(_0x33c1('0x6'));var jayson=require(_0x33c1('0x7'));var client=jayson[_0x33c1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a1add,_0x746567,_0x35dd76){return new BPromise(function(_0x1f339b,_0x4f9ca8){return client['request'](_0x5a1add,_0x35dd76)[_0x33c1('0x9')](function(_0x1681e5){logger['info'](_0x33c1('0xa'),_0x746567,_0x33c1('0xb'));logger[_0x33c1('0xc')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x746567,_0x33c1('0xb'),JSON[_0x33c1('0xd')](_0x1681e5));if(_0x1681e5[_0x33c1('0xe')]){if(_0x1681e5[_0x33c1('0xe')][_0x33c1('0xf')]===0x1f4){logger[_0x33c1('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x746567,_0x1681e5[_0x33c1('0xe')][_0x33c1('0x10')]);return _0x4f9ca8(_0x1681e5[_0x33c1('0xe')][_0x33c1('0x10')]);}logger[_0x33c1('0xe')](_0x33c1('0xa'),_0x746567,_0x1681e5['error']['message']);return _0x1f339b(_0x1681e5[_0x33c1('0xe')][_0x33c1('0x10')]);}else{logger[_0x33c1('0x11')](_0x33c1('0xa'),_0x746567,_0x33c1('0xb'));_0x1f339b(_0x1681e5[_0x33c1('0x12')][_0x33c1('0x10')]);}})[_0x33c1('0x13')](function(_0x39c16c){logger[_0x33c1('0xe')](_0x33c1('0xa'),_0x746567,_0x39c16c);_0x4f9ca8(_0x39c16c);});});}exports[_0x33c1('0x14')]=function(_0x4a6cee){var _0x2a105e=this;return new Promise(function(_0x3b8d01,_0x53f857){return db[_0x33c1('0x15')]['create'](_0x4a6cee[_0x33c1('0x16')],{'raw':_0x4a6cee['options']?_0x4a6cee['options'][_0x33c1('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0xe19a59){logger[_0x33c1('0x11')](_0x33c1('0x14'),_0x4a6cee);logger['debug'](_0x33c1('0x14'),_0x4a6cee,JSON[_0x33c1('0xd')](_0xe19a59));_0x3b8d01(_0xe19a59);})['catch'](function(_0x1d399c){logger[_0x33c1('0xe')]('CreateFaxQueueReport',_0x1d399c[_0x33c1('0x10')],_0x4a6cee);_0x53f857(_0x2a105e['error'](0x1f4,_0x1d399c[_0x33c1('0x10')]));});});};exports[_0x33c1('0x18')]=function(_0x1cdcca){var _0x535a00=this;return new Promise(function(_0x2238c3,_0x2b163c){return db[_0x33c1('0x15')]['update'](_0x1cdcca['body'],{'raw':_0x1cdcca[_0x33c1('0x19')]?_0x1cdcca[_0x33c1('0x19')][_0x33c1('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cdcca['options']?_0x1cdcca[_0x33c1('0x19')][_0x33c1('0x1a')]||null:null,'attributes':_0x1cdcca[_0x33c1('0x19')]?_0x1cdcca['options']['attributes']||null:null,'limit':_0x1cdcca[_0x33c1('0x19')]?_0x1cdcca['options'][_0x33c1('0x1b')]||null:null})[_0x33c1('0x9')](function(_0x5e690a){logger[_0x33c1('0x11')]('UpdateFaxQueueReport',_0x1cdcca);logger[_0x33c1('0xc')](_0x33c1('0x18'),_0x1cdcca,JSON[_0x33c1('0xd')](_0x5e690a));_0x2238c3(_0x5e690a);})[_0x33c1('0x13')](function(_0x29c98d){logger[_0x33c1('0xe')]('UpdateFaxQueueReport',_0x29c98d[_0x33c1('0x10')],_0x1cdcca);_0x2b163c(_0x535a00[_0x33c1('0xe')](0x1f4,_0x29c98d[_0x33c1('0x10')]));});});}; \ No newline at end of file +var _0x8fda=['create','body','options','raw','UpdateFaxQueueReport','FaxQueueReport','update','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateFaxQueueReport'];(function(_0x3d432c,_0x4895c2){var _0x2efff5=function(_0xcfec0c){while(--_0xcfec0c){_0x3d432c['push'](_0x3d432c['shift']());}};_0x2efff5(++_0x4895c2);}(_0x8fda,0x1bb));var _0xa8fd=function(_0x1db636,_0xf0cf20){_0x1db636=_0x1db636-0x0;var _0x1d6e4a=_0x8fda[_0x1db636];return _0x1d6e4a;};'use strict';var _=require('lodash');var util=require(_0xa8fd('0x0'));var moment=require(_0xa8fd('0x1'));var BPromise=require(_0xa8fd('0x2'));var rs=require(_0xa8fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa8fd('0x4'))['db'];var utils=require(_0xa8fd('0x5'));var logger=require('../../config/logger')(_0xa8fd('0x6'));var config=require(_0xa8fd('0x7'));var jayson=require(_0xa8fd('0x8'));var client=jayson[_0xa8fd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19097e,_0x3c13ef,_0x586d2b){return new BPromise(function(_0xb4980b,_0x47fc4e){return client[_0xa8fd('0xa')](_0x19097e,_0x586d2b)[_0xa8fd('0xb')](function(_0x4a0ca3){logger[_0xa8fd('0xc')](_0xa8fd('0xd'),_0x3c13ef,_0xa8fd('0xe'));logger[_0xa8fd('0xf')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x3c13ef,_0xa8fd('0xe'),JSON[_0xa8fd('0x10')](_0x4a0ca3));if(_0x4a0ca3[_0xa8fd('0x11')]){if(_0x4a0ca3[_0xa8fd('0x11')][_0xa8fd('0x12')]===0x1f4){logger[_0xa8fd('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x3c13ef,_0x4a0ca3[_0xa8fd('0x11')]['message']);return _0x47fc4e(_0x4a0ca3[_0xa8fd('0x11')][_0xa8fd('0x13')]);}logger[_0xa8fd('0x11')](_0xa8fd('0xd'),_0x3c13ef,_0x4a0ca3[_0xa8fd('0x11')][_0xa8fd('0x13')]);return _0xb4980b(_0x4a0ca3[_0xa8fd('0x11')]['message']);}else{logger[_0xa8fd('0xc')](_0xa8fd('0xd'),_0x3c13ef,_0xa8fd('0xe'));_0xb4980b(_0x4a0ca3['result']['message']);}})[_0xa8fd('0x14')](function(_0x1043e2){logger[_0xa8fd('0x11')](_0xa8fd('0xd'),_0x3c13ef,_0x1043e2);_0x47fc4e(_0x1043e2);});});}exports[_0xa8fd('0x15')]=function(_0x9b722d){var _0x35b108=this;return new Promise(function(_0x2dfee4,_0x1b89c7){return db['FaxQueueReport'][_0xa8fd('0x16')](_0x9b722d[_0xa8fd('0x17')],{'raw':_0x9b722d[_0xa8fd('0x18')]?_0x9b722d[_0xa8fd('0x18')][_0xa8fd('0x19')]===undefined?!![]:![]:!![]})[_0xa8fd('0xb')](function(_0xfeb9fb){logger[_0xa8fd('0xc')](_0xa8fd('0x15'),_0x9b722d);logger[_0xa8fd('0xf')]('CreateFaxQueueReport',_0x9b722d,JSON[_0xa8fd('0x10')](_0xfeb9fb));_0x2dfee4(_0xfeb9fb);})[_0xa8fd('0x14')](function(_0x3cb653){logger['error'](_0xa8fd('0x15'),_0x3cb653[_0xa8fd('0x13')],_0x9b722d);_0x1b89c7(_0x35b108['error'](0x1f4,_0x3cb653[_0xa8fd('0x13')]));});});};exports[_0xa8fd('0x1a')]=function(_0x547e20){var _0x4b0f7d=this;return new Promise(function(_0x479a8d,_0x353fc3){return db[_0xa8fd('0x1b')][_0xa8fd('0x1c')](_0x547e20[_0xa8fd('0x17')],{'raw':_0x547e20[_0xa8fd('0x18')]?_0x547e20[_0xa8fd('0x18')][_0xa8fd('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x547e20['options']?_0x547e20['options']['where']||null:null,'attributes':_0x547e20[_0xa8fd('0x18')]?_0x547e20[_0xa8fd('0x18')][_0xa8fd('0x1d')]||null:null,'limit':_0x547e20[_0xa8fd('0x18')]?_0x547e20[_0xa8fd('0x18')][_0xa8fd('0x1e')]||null:null})[_0xa8fd('0xb')](function(_0x2b4764){logger[_0xa8fd('0xc')](_0xa8fd('0x1a'),_0x547e20);logger[_0xa8fd('0xf')]('UpdateFaxQueueReport',_0x547e20,JSON[_0xa8fd('0x10')](_0x2b4764));_0x479a8d(_0x2b4764);})[_0xa8fd('0x14')](function(_0x435970){logger[_0xa8fd('0x11')](_0xa8fd('0x1a'),_0x435970['message'],_0x547e20);_0x353fc3(_0x4b0f7d[_0xa8fd('0x11')](0x1f4,_0x435970[_0xa8fd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index eb370cb..856f148 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 _0xf337=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x12ddb2,_0x5ad61e){var _0x10b6dd=function(_0x47dd27){while(--_0x47dd27){_0x12ddb2['push'](_0x12ddb2['shift']());}};_0x10b6dd(++_0x5ad61e);}(_0xf337,0x98));var _0x7f33=function(_0x808d09,_0x5f538b){_0x808d09=_0x808d09-0x0;var _0x7ab914=_0xf337[_0x808d09];return _0x7ab914;};'use strict';var multer=require(_0x7f33('0x0'));var util=require(_0x7f33('0x1'));var path=require(_0x7f33('0x2'));var timeout=require(_0x7f33('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7f33('0x4'));var auth=require(_0x7f33('0x5'));var interaction=require(_0x7f33('0x6'));var config=require('../../config/environment');var controller=require(_0x7f33('0x7'));router[_0x7f33('0x8')]('/',auth[_0x7f33('0x9')](),controller[_0x7f33('0xa')]);router[_0x7f33('0x8')](_0x7f33('0xb'),auth['isAuthenticated'](),controller[_0x7f33('0xc')]);router[_0x7f33('0x8')](_0x7f33('0xd'),auth[_0x7f33('0x9')](),controller[_0x7f33('0xe')]);router[_0x7f33('0xf')]('/',auth[_0x7f33('0x9')](),controller[_0x7f33('0x10')]);router['put'](_0x7f33('0xd'),auth[_0x7f33('0x9')](),controller[_0x7f33('0x11')]);router[_0x7f33('0x12')](_0x7f33('0xd'),auth[_0x7f33('0x9')](),controller[_0x7f33('0x13')]);module[_0x7f33('0x14')]=router; \ No newline at end of file +var _0x6c22=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated'];(function(_0x99283f,_0x132ef2){var _0x5d3ec4=function(_0x30da11){while(--_0x30da11){_0x99283f['push'](_0x99283f['shift']());}};_0x5d3ec4(++_0x132ef2);}(_0x6c22,0x10d));var _0x26c2=function(_0x8bf294,_0x1ca4ae){_0x8bf294=_0x8bf294-0x0;var _0x596021=_0x6c22[_0x8bf294];return _0x596021;};'use strict';var multer=require(_0x26c2('0x0'));var util=require(_0x26c2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x26c2('0x2'));var router=express[_0x26c2('0x3')]();var fs_extra=require(_0x26c2('0x4'));var auth=require(_0x26c2('0x5'));var interaction=require(_0x26c2('0x6'));var config=require(_0x26c2('0x7'));var controller=require(_0x26c2('0x8'));router[_0x26c2('0x9')]('/',auth[_0x26c2('0xa')](),controller['index']);router['get'](_0x26c2('0xb'),auth['isAuthenticated'](),controller[_0x26c2('0xc')]);router['get'](_0x26c2('0xd'),auth[_0x26c2('0xa')](),controller[_0x26c2('0xe')]);router[_0x26c2('0xf')]('/',auth[_0x26c2('0xa')](),controller[_0x26c2('0x10')]);router[_0x26c2('0x11')](_0x26c2('0xd'),auth[_0x26c2('0xa')](),controller['update']);router['delete'](_0x26c2('0xd'),auth[_0x26c2('0xa')](),controller[_0x26c2('0x12')]);module[_0x26c2('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 1d2b708..9931584 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x3460c9,_0x565510){var _0x1d8283=function(_0x8a51bd){while(--_0x8a51bd){_0x3460c9['push'](_0x3460c9['shift']());}};_0x1d8283(++_0x565510);}(_0x34e8,0x12c));var _0x834e=function(_0x3264d6,_0x26a6b1){_0x3264d6=_0x3264d6-0x0;var _0x3a7580=_0x34e8[_0x3264d6];return _0x3a7580;};'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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x5a95ce,_0x4fddd7){var _0x184e50=function(_0x357435){while(--_0x357435){_0x5a95ce['push'](_0x5a95ce['shift']());}};_0x184e50(++_0x4fddd7);}(_0xf4eb,0xec));var _0xbf4e=function(_0x31d851,_0x406268){_0x31d851=_0x31d851-0x0;var _0x3b1a76=_0xf4eb[_0x31d851];return _0x3b1a76;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 7740018..b806adc 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 _0x86df=['rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','show','fields','find','create','body','catch','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','index','map','FaxTransferReport'];(function(_0x1bf233,_0x43ee48){var _0x5292d0=function(_0x29e4d4){while(--_0x29e4d4){_0x1bf233['push'](_0x1bf233['shift']());}};_0x5292d0(++_0x43ee48);}(_0x86df,0xc0));var _0xf86d=function(_0x5202d3,_0x31df2a){_0x5202d3=_0x5202d3-0x0;var _0x5b535e=_0x86df[_0x5202d3];return _0x5b535e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf86d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf86d('0x1'));var rp=require(_0xf86d('0x2'));var moment=require(_0xf86d('0x3'));var BPromise=require(_0xf86d('0x4'));var Mustache=require(_0xf86d('0x5'));var util=require(_0xf86d('0x6'));var path=require(_0xf86d('0x7'));var sox=require(_0xf86d('0x8'));var csv=require('to-csv');var ejs=require(_0xf86d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf86d('0xa'));var squel=require(_0xf86d('0xb'));var crypto=require(_0xf86d('0xc'));var jsforce=require(_0xf86d('0xd'));var deskjs=require(_0xf86d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf86d('0xf'));var Papa=require(_0xf86d('0x10'));var Redis=require(_0xf86d('0x11'));var authService=require(_0xf86d('0x12'));var qs=require(_0xf86d('0x13'));var as=require(_0xf86d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf86d('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xf86d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf86d('0x17'))['db'];function respondWithStatusCode(_0x343cbf,_0x4fbadc){_0x4fbadc=_0x4fbadc||0xcc;return function(_0x3303e8){if(_0x3303e8){return _0x343cbf[_0xf86d('0x18')](_0x4fbadc);}return _0x343cbf[_0xf86d('0x19')](_0x4fbadc)['end']();};}function respondWithResult(_0x1d020e,_0x3a5bdb){_0x3a5bdb=_0x3a5bdb||0xc8;return function(_0x29bf4f){if(_0x29bf4f){return _0x1d020e['status'](_0x3a5bdb)[_0xf86d('0x1a')](_0x29bf4f);}};}function respondWithFilteredResult(_0x52ad03,_0x4baf72){return function(_0x121c7d){if(_0x121c7d){var _0x4ca5a0=typeof _0x4baf72['offset']==='undefined'&&typeof _0x4baf72['limit']===_0xf86d('0x1b');var _0x3a5f7c=_0x121c7d[_0xf86d('0x1c')];var _0x17c8bd=_0x4ca5a0?0x0:_0x4baf72[_0xf86d('0x1d')];var _0x185045=_0x4ca5a0?_0x121c7d[_0xf86d('0x1c')]:_0x4baf72[_0xf86d('0x1d')]+_0x4baf72['limit'];var _0x181b56;if(_0x185045>=_0x3a5f7c){_0x185045=_0x3a5f7c;_0x181b56=0xc8;}else{_0x181b56=0xce;}_0x52ad03[_0xf86d('0x19')](_0x181b56);return _0x52ad03[_0xf86d('0x1e')](_0xf86d('0x1f'),_0x17c8bd+'-'+_0x185045+'/'+_0x3a5f7c)['json'](_0x121c7d);}return null;};}function patchUpdates(_0x149fa8){return function(_0x4720d6){try{jsonpatch[_0xf86d('0x20')](_0x4720d6,_0x149fa8,!![]);}catch(_0x1f1e7c){return BPromise[_0xf86d('0x21')](_0x1f1e7c);}return _0x4720d6[_0xf86d('0x22')]();};}function saveUpdates(_0x4b1ce7,_0x5e2a2d){return function(_0x2f20d9){if(_0x2f20d9){return _0x2f20d9[_0xf86d('0x23')](_0x4b1ce7)[_0xf86d('0x24')](function(_0x4fc9a0){return _0x4fc9a0;});}return null;};}function removeEntity(_0x59d5a1,_0x437b3c){return function(_0x3f0ad0){if(_0x3f0ad0){return _0x3f0ad0[_0xf86d('0x25')]()[_0xf86d('0x24')](function(){_0x59d5a1[_0xf86d('0x19')](0xcc)[_0xf86d('0x26')]();});}};}function handleEntityNotFound(_0x5b0c69,_0x2ac39e){return function(_0x8f05ab){if(!_0x8f05ab){_0x5b0c69['sendStatus'](0x194);}return _0x8f05ab;};}function handleError(_0x19f79d,_0x36b425){_0x36b425=_0x36b425||0x1f4;return function(_0x2bd6a2){logger[_0xf86d('0x27')](_0x2bd6a2[_0xf86d('0x28')]);if(_0x2bd6a2['name']){delete _0x2bd6a2['name'];}_0x19f79d[_0xf86d('0x19')](_0x36b425)[_0xf86d('0x29')](_0x2bd6a2);};}exports[_0xf86d('0x2a')]=function(_0x2d4772,_0x2c1996){var _0xa3bb24={},_0x552ac8={},_0x3c5fcc={'count':0x0,'rows':[]};var _0x20e474=_[_0xf86d('0x2b')](db[_0xf86d('0x2c')][_0xf86d('0x2d')],function(_0x39fc42){return{'name':_0x39fc42[_0xf86d('0x2e')],'type':_0x39fc42[_0xf86d('0x2f')][_0xf86d('0x30')]};});_0x552ac8[_0xf86d('0x31')]=_[_0xf86d('0x2b')](_0x20e474,_0xf86d('0x32'));_0x552ac8[_0xf86d('0x33')]=_[_0xf86d('0x34')](_0x2d4772['query']);_0x552ac8['filters']=_[_0xf86d('0x35')](_0x552ac8[_0xf86d('0x31')],_0x552ac8[_0xf86d('0x33')]);_0xa3bb24[_0xf86d('0x36')]=_[_0xf86d('0x35')](_0x552ac8[_0xf86d('0x31')],qs['fields'](_0x2d4772[_0xf86d('0x33')]['fields']));_0xa3bb24[_0xf86d('0x36')]=_0xa3bb24[_0xf86d('0x36')][_0xf86d('0x37')]?_0xa3bb24[_0xf86d('0x36')]:_0x552ac8[_0xf86d('0x31')];if(!_0x2d4772[_0xf86d('0x33')][_0xf86d('0x38')](_0xf86d('0x39'))){_0xa3bb24[_0xf86d('0x3a')]=qs[_0xf86d('0x3a')](_0x2d4772[_0xf86d('0x33')][_0xf86d('0x3a')]);_0xa3bb24[_0xf86d('0x1d')]=qs[_0xf86d('0x1d')](_0x2d4772[_0xf86d('0x33')][_0xf86d('0x1d')]);}_0xa3bb24[_0xf86d('0x3b')]=qs[_0xf86d('0x3c')](_0x2d4772['query'][_0xf86d('0x3c')]);_0xa3bb24[_0xf86d('0x3d')]=qs['filters'](_[_0xf86d('0x3e')](_0x2d4772[_0xf86d('0x33')],_0x552ac8[_0xf86d('0x3f')]),_0x20e474);if(_0x2d4772[_0xf86d('0x33')][_0xf86d('0x40')]){_0xa3bb24[_0xf86d('0x3d')]=_['merge'](_0xa3bb24[_0xf86d('0x3d')],{'$or':_[_0xf86d('0x2b')](_0x20e474,function(_0x4e8569){if(_0x4e8569[_0xf86d('0x2f')]!=='VIRTUAL'){var _0x4b5570={};_0x4b5570[_0x4e8569[_0xf86d('0x32')]]={'$like':'%'+_0x2d4772[_0xf86d('0x33')]['filter']+'%'};return _0x4b5570;}})});}_0xa3bb24=_[_0xf86d('0x41')]({},_0xa3bb24,_0x2d4772[_0xf86d('0x42')]);var _0x574538={'where':_0xa3bb24['where']};return db[_0xf86d('0x2c')][_0xf86d('0x1c')](_0x574538)[_0xf86d('0x24')](function(_0x3a982f){_0x3c5fcc[_0xf86d('0x1c')]=_0x3a982f;if(_0x2d4772[_0xf86d('0x33')][_0xf86d('0x43')]){_0xa3bb24[_0xf86d('0x44')]=[{'all':!![]}];}return db[_0xf86d('0x2c')][_0xf86d('0x45')](_0xa3bb24);})['then'](function(_0x162869){_0x3c5fcc[_0xf86d('0x46')]=_0x162869;return _0x3c5fcc;})[_0xf86d('0x24')](respondWithFilteredResult(_0x2c1996,_0xa3bb24))['catch'](handleError(_0x2c1996,null));};exports[_0xf86d('0x47')]=function(_0x2ed34d,_0x40ceff){var _0x994e4f={'raw':!![],'where':{'id':_0x2ed34d['params']['id']}},_0x2ea5f1={};_0x2ea5f1['model']=_[_0xf86d('0x34')](db[_0xf86d('0x2c')]['rawAttributes']);_0x2ea5f1['query']=_[_0xf86d('0x34')](_0x2ed34d[_0xf86d('0x33')]);_0x2ea5f1[_0xf86d('0x3f')]=_[_0xf86d('0x35')](_0x2ea5f1[_0xf86d('0x31')],_0x2ea5f1[_0xf86d('0x33')]);_0x994e4f[_0xf86d('0x36')]=_[_0xf86d('0x35')](_0x2ea5f1[_0xf86d('0x31')],qs['fields'](_0x2ed34d[_0xf86d('0x33')][_0xf86d('0x48')]));_0x994e4f['attributes']=_0x994e4f[_0xf86d('0x36')][_0xf86d('0x37')]?_0x994e4f[_0xf86d('0x36')]:_0x2ea5f1[_0xf86d('0x31')];if(_0x2ed34d[_0xf86d('0x33')]['includeAll']){_0x994e4f['include']=[{'all':!![]}];}_0x994e4f=_[_0xf86d('0x41')]({},_0x994e4f,_0x2ed34d['options']);return db[_0xf86d('0x2c')][_0xf86d('0x49')](_0x994e4f)[_0xf86d('0x24')](handleEntityNotFound(_0x40ceff,null))[_0xf86d('0x24')](respondWithResult(_0x40ceff,null))['catch'](handleError(_0x40ceff,null));};exports[_0xf86d('0x4a')]=function(_0x18478b,_0x329735){return db['FaxTransferReport'][_0xf86d('0x4a')](_0x18478b[_0xf86d('0x4b')],{})[_0xf86d('0x24')](respondWithResult(_0x329735,0xc9))[_0xf86d('0x4c')](handleError(_0x329735,null));};exports['update']=function(_0x467c93,_0x564056){if(_0x467c93[_0xf86d('0x4b')]['id']){delete _0x467c93['body']['id'];}return db['FaxTransferReport'][_0xf86d('0x49')]({'where':{'id':_0x467c93[_0xf86d('0x4d')]['id']}})[_0xf86d('0x24')](handleEntityNotFound(_0x564056,null))['then'](saveUpdates(_0x467c93[_0xf86d('0x4b')],null))['then'](respondWithResult(_0x564056,null))[_0xf86d('0x4c')](handleError(_0x564056,null));};exports[_0xf86d('0x25')]=function(_0x58809b,_0x533f76){return db[_0xf86d('0x2c')][_0xf86d('0x49')]({'where':{'id':_0x58809b[_0xf86d('0x4d')]['id']}})[_0xf86d('0x24')](handleEntityNotFound(_0x533f76,null))[_0xf86d('0x24')](removeEntity(_0x533f76,null))[_0xf86d('0x4c')](handleError(_0x533f76,null));};exports[_0xf86d('0x4e')]=function(_0x2a4b40,_0x47d265){return db[_0xf86d('0x2c')][_0xf86d('0x4e')]()[_0xf86d('0x24')](respondWithResult(_0x47d265,null))['catch'](handleError(_0x47d265,null));}; \ No newline at end of file +var _0x192a=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','nolimit','order','sort','where','pick','filter','options','includeAll','FaxTransferReport','findAll','catch','show','params','fields','length','include','merge','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','api','../../config/utils'];(function(_0x28a7c8,_0x43c168){var _0x196dfe=function(_0x4d357e){while(--_0x4d357e){_0x28a7c8['push'](_0x28a7c8['shift']());}};_0x196dfe(++_0x43c168);}(_0x192a,0x10f));var _0xa192=function(_0x1496ac,_0x595ff5){_0x1496ac=_0x1496ac-0x0;var _0x164e02=_0x192a[_0x1496ac];return _0x164e02;};'use strict';var emlformat=require(_0xa192('0x0'));var rimraf=require(_0xa192('0x1'));var zipdir=require(_0xa192('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa192('0x3'));var BPromise=require(_0xa192('0x4'));var Mustache=require(_0xa192('0x5'));var util=require(_0xa192('0x6'));var path=require(_0xa192('0x7'));var sox=require(_0xa192('0x8'));var csv=require(_0xa192('0x9'));var ejs=require(_0xa192('0xa'));var fs=require('fs');var fs_extra=require(_0xa192('0xb'));var _=require(_0xa192('0xc'));var squel=require(_0xa192('0xd'));var crypto=require(_0xa192('0xe'));var jsforce=require(_0xa192('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa192('0x9'));var querystring=require(_0xa192('0x10'));var Papa=require('papaparse');var Redis=require(_0xa192('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa192('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa192('0x13'));var utils=require(_0xa192('0x14'));var config=require(_0xa192('0x15'));var licenseUtil=require(_0xa192('0x16'));var db=require(_0xa192('0x17'))['db'];function respondWithStatusCode(_0x515be3,_0x2479dd){_0x2479dd=_0x2479dd||0xcc;return function(_0x3080a7){if(_0x3080a7){return _0x515be3[_0xa192('0x18')](_0x2479dd);}return _0x515be3[_0xa192('0x19')](_0x2479dd)[_0xa192('0x1a')]();};}function respondWithResult(_0x5e3625,_0x25bdc3){_0x25bdc3=_0x25bdc3||0xc8;return function(_0x4f12d1){if(_0x4f12d1){return _0x5e3625['status'](_0x25bdc3)[_0xa192('0x1b')](_0x4f12d1);}};}function respondWithFilteredResult(_0x44f885,_0x3ade5e){return function(_0x3db589){if(_0x3db589){var _0x679a10=typeof _0x3ade5e[_0xa192('0x1c')]===_0xa192('0x1d')&&typeof _0x3ade5e[_0xa192('0x1e')]===_0xa192('0x1d');var _0x499dc8=_0x3db589[_0xa192('0x1f')];var _0xfdfe16=_0x679a10?0x0:_0x3ade5e[_0xa192('0x1c')];var _0x444187=_0x679a10?_0x3db589[_0xa192('0x1f')]:_0x3ade5e[_0xa192('0x1c')]+_0x3ade5e['limit'];var _0x17a5a4;if(_0x444187>=_0x499dc8){_0x444187=_0x499dc8;_0x17a5a4=0xc8;}else{_0x17a5a4=0xce;}_0x44f885[_0xa192('0x19')](_0x17a5a4);return _0x44f885['set']('Content-Range',_0xfdfe16+'-'+_0x444187+'/'+_0x499dc8)[_0xa192('0x1b')](_0x3db589);}return null;};}function patchUpdates(_0xa49ee3){return function(_0x3563ec){try{jsonpatch[_0xa192('0x20')](_0x3563ec,_0xa49ee3,!![]);}catch(_0x3bb57e){return BPromise['reject'](_0x3bb57e);}return _0x3563ec[_0xa192('0x21')]();};}function saveUpdates(_0x229393,_0x4975e6){return function(_0x252d27){if(_0x252d27){return _0x252d27[_0xa192('0x22')](_0x229393)[_0xa192('0x23')](function(_0x366011){return _0x366011;});}return null;};}function removeEntity(_0x42e721,_0x23ce2e){return function(_0x3be7f6){if(_0x3be7f6){return _0x3be7f6['destroy']()[_0xa192('0x23')](function(){_0x42e721[_0xa192('0x19')](0xcc)[_0xa192('0x1a')]();});}};}function handleEntityNotFound(_0x5b2206,_0x384ea2){return function(_0x38eb8c){if(!_0x38eb8c){_0x5b2206['sendStatus'](0x194);}return _0x38eb8c;};}function handleError(_0x9bf116,_0x45d6cb){_0x45d6cb=_0x45d6cb||0x1f4;return function(_0x55c0b1){logger[_0xa192('0x24')](_0x55c0b1['stack']);if(_0x55c0b1[_0xa192('0x25')]){delete _0x55c0b1[_0xa192('0x25')];}_0x9bf116[_0xa192('0x19')](_0x45d6cb)[_0xa192('0x26')](_0x55c0b1);};}exports[_0xa192('0x27')]=function(_0x48c85f,_0xf7dad){var _0x645eb1={},_0x47b219={},_0x4c9eef={'count':0x0,'rows':[]};var _0x3aaae7=_[_0xa192('0x28')](db['FaxTransferReport'][_0xa192('0x29')],function(_0x1aba35){return{'name':_0x1aba35[_0xa192('0x2a')],'type':_0x1aba35[_0xa192('0x2b')][_0xa192('0x2c')]};});_0x47b219['model']=_[_0xa192('0x28')](_0x3aaae7,'name');_0x47b219[_0xa192('0x2d')]=_[_0xa192('0x2e')](_0x48c85f['query']);_0x47b219[_0xa192('0x2f')]=_['intersection'](_0x47b219['model'],_0x47b219[_0xa192('0x2d')]);_0x645eb1[_0xa192('0x30')]=_[_0xa192('0x31')](_0x47b219[_0xa192('0x32')],qs['fields'](_0x48c85f['query']['fields']));_0x645eb1[_0xa192('0x30')]=_0x645eb1[_0xa192('0x30')]['length']?_0x645eb1['attributes']:_0x47b219['model'];if(!_0x48c85f[_0xa192('0x2d')]['hasOwnProperty'](_0xa192('0x33'))){_0x645eb1[_0xa192('0x1e')]=qs['limit'](_0x48c85f['query']['limit']);_0x645eb1['offset']=qs[_0xa192('0x1c')](_0x48c85f[_0xa192('0x2d')][_0xa192('0x1c')]);}_0x645eb1[_0xa192('0x34')]=qs[_0xa192('0x35')](_0x48c85f[_0xa192('0x2d')][_0xa192('0x35')]);_0x645eb1[_0xa192('0x36')]=qs['filters'](_[_0xa192('0x37')](_0x48c85f[_0xa192('0x2d')],_0x47b219[_0xa192('0x2f')]),_0x3aaae7);if(_0x48c85f['query']['filter']){_0x645eb1[_0xa192('0x36')]=_['merge'](_0x645eb1[_0xa192('0x36')],{'$or':_[_0xa192('0x28')](_0x3aaae7,function(_0x529c81){if(_0x529c81[_0xa192('0x2b')]!=='VIRTUAL'){var _0x3e6c67={};_0x3e6c67[_0x529c81['name']]={'$like':'%'+_0x48c85f['query'][_0xa192('0x38')]+'%'};return _0x3e6c67;}})});}_0x645eb1=_['merge']({},_0x645eb1,_0x48c85f[_0xa192('0x39')]);var _0x46ced4={'where':_0x645eb1[_0xa192('0x36')]};return db['FaxTransferReport'][_0xa192('0x1f')](_0x46ced4)[_0xa192('0x23')](function(_0xd0193a){_0x4c9eef[_0xa192('0x1f')]=_0xd0193a;if(_0x48c85f[_0xa192('0x2d')][_0xa192('0x3a')]){_0x645eb1['include']=[{'all':!![]}];}return db[_0xa192('0x3b')][_0xa192('0x3c')](_0x645eb1);})[_0xa192('0x23')](function(_0xd3606a){_0x4c9eef['rows']=_0xd3606a;return _0x4c9eef;})['then'](respondWithFilteredResult(_0xf7dad,_0x645eb1))[_0xa192('0x3d')](handleError(_0xf7dad,null));};exports[_0xa192('0x3e')]=function(_0x3495ea,_0x52e5a9){var _0x5b3883={'raw':!![],'where':{'id':_0x3495ea[_0xa192('0x3f')]['id']}},_0x4b154c={};_0x4b154c[_0xa192('0x32')]=_[_0xa192('0x2e')](db[_0xa192('0x3b')][_0xa192('0x29')]);_0x4b154c[_0xa192('0x2d')]=_[_0xa192('0x2e')](_0x3495ea[_0xa192('0x2d')]);_0x4b154c['filters']=_[_0xa192('0x31')](_0x4b154c[_0xa192('0x32')],_0x4b154c['query']);_0x5b3883[_0xa192('0x30')]=_[_0xa192('0x31')](_0x4b154c[_0xa192('0x32')],qs[_0xa192('0x40')](_0x3495ea[_0xa192('0x2d')][_0xa192('0x40')]));_0x5b3883[_0xa192('0x30')]=_0x5b3883['attributes'][_0xa192('0x41')]?_0x5b3883[_0xa192('0x30')]:_0x4b154c[_0xa192('0x32')];if(_0x3495ea[_0xa192('0x2d')][_0xa192('0x3a')]){_0x5b3883[_0xa192('0x42')]=[{'all':!![]}];}_0x5b3883=_[_0xa192('0x43')]({},_0x5b3883,_0x3495ea[_0xa192('0x39')]);return db[_0xa192('0x3b')][_0xa192('0x44')](_0x5b3883)[_0xa192('0x23')](handleEntityNotFound(_0x52e5a9,null))['then'](respondWithResult(_0x52e5a9,null))[_0xa192('0x3d')](handleError(_0x52e5a9,null));};exports['create']=function(_0x374004,_0x170e59){return db[_0xa192('0x3b')][_0xa192('0x45')](_0x374004[_0xa192('0x46')],{})[_0xa192('0x23')](respondWithResult(_0x170e59,0xc9))[_0xa192('0x3d')](handleError(_0x170e59,null));};exports[_0xa192('0x22')]=function(_0x43ade5,_0x34cb0f){if(_0x43ade5[_0xa192('0x46')]['id']){delete _0x43ade5[_0xa192('0x46')]['id'];}return db[_0xa192('0x3b')]['find']({'where':{'id':_0x43ade5[_0xa192('0x3f')]['id']}})[_0xa192('0x23')](handleEntityNotFound(_0x34cb0f,null))[_0xa192('0x23')](saveUpdates(_0x43ade5[_0xa192('0x46')],null))[_0xa192('0x23')](respondWithResult(_0x34cb0f,null))[_0xa192('0x3d')](handleError(_0x34cb0f,null));};exports[_0xa192('0x47')]=function(_0x559bbc,_0x4c54fd){return db[_0xa192('0x3b')][_0xa192('0x44')]({'where':{'id':_0x559bbc[_0xa192('0x3f')]['id']}})[_0xa192('0x23')](handleEntityNotFound(_0x4c54fd,null))['then'](removeEntity(_0x4c54fd,null))[_0xa192('0x3d')](handleError(_0x4c54fd,null));};exports[_0xa192('0x48')]=function(_0x2009f0,_0x23596c){return db[_0xa192('0x3b')]['describe']()['then'](respondWithResult(_0x23596c,null))[_0xa192('0x3d')](handleError(_0x23596c,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 92a9051..6644031 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 _0x867a=['define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x867a,0x15d));var _0xa867=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x867a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa867('0x0'));var util=require(_0xa867('0x1'));var logger=require(_0xa867('0x2'))(_0xa867('0x3'));var moment=require(_0xa867('0x4'));var BPromise=require('bluebird');var rp=require(_0xa867('0x5'));var fs=require('fs');var path=require(_0xa867('0x6'));var rimraf=require(_0xa867('0x7'));var config=require(_0xa867('0x8'));var attributes=require(_0xa867('0x9'));module[_0xa867('0xa')]=function(_0x354314,_0x9c6bb4){return _0x354314[_0xa867('0xb')](_0xa867('0xc'),attributes,{'tableName':_0xa867('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa867('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9cc1=['exports','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x1b9f79,_0x5991ae){var _0x131000=function(_0x2b8a02){while(--_0x2b8a02){_0x1b9f79['push'](_0x1b9f79['shift']());}};_0x131000(++_0x5991ae);}(_0x9cc1,0x18c));var _0x19cc=function(_0x1be9ce,_0x27443d){_0x1be9ce=_0x1be9ce-0x0;var _0x164439=_0x9cc1[_0x1be9ce];return _0x164439;};'use strict';var _=require(_0x19cc('0x0'));var util=require(_0x19cc('0x1'));var logger=require(_0x19cc('0x2'))(_0x19cc('0x3'));var moment=require(_0x19cc('0x4'));var BPromise=require(_0x19cc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x19cc('0x6'));var rimraf=require(_0x19cc('0x7'));var config=require(_0x19cc('0x8'));var attributes=require(_0x19cc('0x9'));module[_0x19cc('0xa')]=function(_0x3fe962,_0x2c82d9){return _0x3fe962[_0x19cc('0xb')](_0x19cc('0xc'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x19cc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index bed09f4..648b931 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 _0x426e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x15ef4a,_0x3adbec){var _0x35b126=function(_0x4a36d8){while(--_0x4a36d8){_0x15ef4a['push'](_0x15ef4a['shift']());}};_0x35b126(++_0x3adbec);}(_0x426e,0x114));var _0xe426=function(_0x2b4379,_0x43f502){_0x2b4379=_0x2b4379-0x0;var _0xb9a7f=_0x426e[_0x2b4379];return _0xb9a7f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe426('0x0'));var BPromise=require(_0xe426('0x1'));var rs=require(_0xe426('0x2'));var fs=require('fs');var Redis=require(_0xe426('0x3'));var db=require(_0xe426('0x4'))['db'];var utils=require(_0xe426('0x5'));var logger=require('../../config/logger')(_0xe426('0x6'));var config=require(_0xe426('0x7'));var jayson=require(_0xe426('0x8'));var client=jayson['client'][_0xe426('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x419695,_0x20c117,_0x1b4d17){return new BPromise(function(_0x4e40eb,_0x23144e){return client[_0xe426('0xa')](_0x419695,_0x1b4d17)[_0xe426('0xb')](function(_0x5ae763){logger[_0xe426('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x20c117,_0xe426('0xd'));logger[_0xe426('0xe')](_0xe426('0xf'),_0x20c117,_0xe426('0xd'),JSON[_0xe426('0x10')](_0x5ae763));if(_0x5ae763[_0xe426('0x11')]){if(_0x5ae763[_0xe426('0x11')][_0xe426('0x12')]===0x1f4){logger[_0xe426('0x11')](_0xe426('0x13'),_0x20c117,_0x5ae763[_0xe426('0x11')][_0xe426('0x14')]);return _0x23144e(_0x5ae763[_0xe426('0x11')]['message']);}logger[_0xe426('0x11')](_0xe426('0x13'),_0x20c117,_0x5ae763[_0xe426('0x11')][_0xe426('0x14')]);return _0x4e40eb(_0x5ae763[_0xe426('0x11')][_0xe426('0x14')]);}else{logger[_0xe426('0xc')](_0xe426('0x13'),_0x20c117,_0xe426('0xd'));_0x4e40eb(_0x5ae763[_0xe426('0x15')]['message']);}})[_0xe426('0x16')](function(_0xd2186e){logger[_0xe426('0x11')](_0xe426('0x13'),_0x20c117,_0xd2186e);_0x23144e(_0xd2186e);});});} \ No newline at end of file +var _0xd2e0=['stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x23bd62,_0x24a954){var _0x3d7bea=function(_0x4c65ed){while(--_0x4c65ed){_0x23bd62['push'](_0x23bd62['shift']());}};_0x3d7bea(++_0x24a954);}(_0xd2e0,0xdf));var _0x0d2e=function(_0x481457,_0x3fa389){_0x481457=_0x481457-0x0;var _0x457aa6=_0xd2e0[_0x481457];return _0x457aa6;};'use strict';var _=require(_0x0d2e('0x0'));var util=require(_0x0d2e('0x1'));var moment=require(_0x0d2e('0x2'));var BPromise=require(_0x0d2e('0x3'));var rs=require(_0x0d2e('0x4'));var fs=require('fs');var Redis=require(_0x0d2e('0x5'));var db=require(_0x0d2e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d2e('0x7'))(_0x0d2e('0x8'));var config=require('../../config/environment');var jayson=require(_0x0d2e('0x9'));var client=jayson[_0x0d2e('0xa')][_0x0d2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d1a91,_0x1f8931,_0x3ce69a){return new BPromise(function(_0x2e1afc,_0x2f22a8){return client[_0x0d2e('0xc')](_0x5d1a91,_0x3ce69a)[_0x0d2e('0xd')](function(_0x5a64ad){logger[_0x0d2e('0xe')](_0x0d2e('0xf'),_0x1f8931,'request\x20sent');logger[_0x0d2e('0x10')](_0x0d2e('0x11'),_0x1f8931,_0x0d2e('0x12'),JSON[_0x0d2e('0x13')](_0x5a64ad));if(_0x5a64ad[_0x0d2e('0x14')]){if(_0x5a64ad[_0x0d2e('0x14')]['code']===0x1f4){logger[_0x0d2e('0x14')](_0x0d2e('0xf'),_0x1f8931,_0x5a64ad['error'][_0x0d2e('0x15')]);return _0x2f22a8(_0x5a64ad[_0x0d2e('0x14')][_0x0d2e('0x15')]);}logger[_0x0d2e('0x14')](_0x0d2e('0xf'),_0x1f8931,_0x5a64ad[_0x0d2e('0x14')]['message']);return _0x2e1afc(_0x5a64ad[_0x0d2e('0x14')]['message']);}else{logger[_0x0d2e('0xe')](_0x0d2e('0xf'),_0x1f8931,_0x0d2e('0x12'));_0x2e1afc(_0x5a64ad['result']['message']);}})['catch'](function(_0x1f415c){logger[_0x0d2e('0x14')](_0x0d2e('0xf'),_0x1f8931,_0x1f415c);_0x2f22a8(_0x1f415c);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 7bafff9..febb2e7 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 _0x3bec=['create','put','update','delete','exports','multer','util','Router','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x3bec,0x185));var _0xc3be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3bec[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc3be('0x0'));var util=require(_0xc3be('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc3be('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc3be('0x3'));var config=require('../../config/environment');var controller=require(_0xc3be('0x4'));router[_0xc3be('0x5')]('/',auth[_0xc3be('0x6')](),controller[_0xc3be('0x7')]);router[_0xc3be('0x5')](_0xc3be('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0xc3be('0x5')](_0xc3be('0x9'),auth[_0xc3be('0x6')](),controller[_0xc3be('0xa')]);router['post']('/',auth[_0xc3be('0x6')](),controller[_0xc3be('0xb')]);router[_0xc3be('0xc')](_0xc3be('0x9'),auth[_0xc3be('0x6')](),controller[_0xc3be('0xd')]);router[_0xc3be('0xe')](_0xc3be('0x9'),auth[_0xc3be('0x6')](),controller['destroy']);module[_0xc3be('0xf')]=router; \ No newline at end of file +var _0x897d=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x36e126,_0x1eaa2e){var _0x5224f0=function(_0x4048bf){while(--_0x4048bf){_0x36e126['push'](_0x36e126['shift']());}};_0x5224f0(++_0x1eaa2e);}(_0x897d,0x1b2));var _0xd897=function(_0x4bcd9a,_0x9f9d3d){_0x4bcd9a=_0x4bcd9a-0x0;var _0x58e631=_0x897d[_0x4bcd9a];return _0x58e631;};'use strict';var multer=require(_0xd897('0x0'));var util=require(_0xd897('0x1'));var path=require(_0xd897('0x2'));var timeout=require(_0xd897('0x3'));var express=require(_0xd897('0x4'));var router=express[_0xd897('0x5')]();var fs_extra=require(_0xd897('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd897('0x7'));var config=require(_0xd897('0x8'));var controller=require(_0xd897('0x9'));router[_0xd897('0xa')]('/',auth['isAuthenticated'](),controller[_0xd897('0xb')]);router['get'](_0xd897('0xc'),auth[_0xd897('0xd')](),controller[_0xd897('0xe')]);router['get'](_0xd897('0xf'),auth[_0xd897('0xd')](),controller[_0xd897('0x10')]);router[_0xd897('0x11')]('/',auth[_0xd897('0xd')](),controller[_0xd897('0x12')]);router[_0xd897('0x13')]('/:id',auth[_0xd897('0xd')](),controller['update']);router[_0xd897('0x14')](_0xd897('0xf'),auth[_0xd897('0xd')](),controller[_0xd897('0x15')]);module[_0xd897('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 58226f8..0e0dbb7 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 _0x38b0=['/:id/fields','getFields','create','post','addConfiguration','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x35f3f9,_0x577a55){var _0x43a7e4=function(_0x4986d9){while(--_0x4986d9){_0x35f3f9['push'](_0x35f3f9['shift']());}};_0x43a7e4(++_0x577a55);}(_0x38b0,0x141));var _0x038b=function(_0x508685,_0x9f94af){_0x508685=_0x508685-0x0;var _0x976a76=_0x38b0[_0x508685];return _0x976a76;};'use strict';var multer=require('multer');var util=require(_0x038b('0x0'));var path=require(_0x038b('0x1'));var timeout=require(_0x038b('0x2'));var express=require(_0x038b('0x3'));var router=express[_0x038b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x038b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x038b('0x6'));var controller=require(_0x038b('0x7'));router[_0x038b('0x8')]('/',auth[_0x038b('0x9')](),controller[_0x038b('0xa')]);router[_0x038b('0x8')](_0x038b('0xb'),auth[_0x038b('0x9')](),controller[_0x038b('0xc')]);router['get'](_0x038b('0xd'),auth[_0x038b('0x9')](),controller[_0x038b('0xe')]);router[_0x038b('0x8')](_0x038b('0xf'),auth[_0x038b('0x9')](),controller[_0x038b('0x10')]);router['post']('/',auth[_0x038b('0x9')](),controller[_0x038b('0x11')]);router[_0x038b('0x12')](_0x038b('0xd'),auth[_0x038b('0x9')](),controller[_0x038b('0x13')]);router[_0x038b('0x14')]('/:id',auth[_0x038b('0x9')](),controller[_0x038b('0x15')]);router[_0x038b('0x16')](_0x038b('0xb'),auth[_0x038b('0x9')](),controller['destroy']);module[_0x038b('0x17')]=router; \ No newline at end of file +var _0x11f3=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','update','destroy','exports','path','connect-timeout','Router'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x11f3,0x9d));var _0x311f=function(_0x190859,_0x52c54b){_0x190859=_0x190859-0x0;var _0x39e79c=_0x11f3[_0x190859];return _0x39e79c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x311f('0x0'));var timeout=require(_0x311f('0x1'));var express=require('express');var router=express[_0x311f('0x2')]();var fs_extra=require(_0x311f('0x3'));var auth=require(_0x311f('0x4'));var interaction=require(_0x311f('0x5'));var config=require(_0x311f('0x6'));var controller=require('./intDeskAccount.controller');router[_0x311f('0x7')]('/',auth[_0x311f('0x8')](),controller[_0x311f('0x9')]);router[_0x311f('0x7')](_0x311f('0xa'),auth[_0x311f('0x8')](),controller[_0x311f('0xb')]);router[_0x311f('0x7')](_0x311f('0xc'),auth[_0x311f('0x8')](),controller['getConfigurations']);router['get'](_0x311f('0xd'),auth[_0x311f('0x8')](),controller[_0x311f('0xe')]);router[_0x311f('0xf')]('/',auth[_0x311f('0x8')](),controller['create']);router[_0x311f('0xf')](_0x311f('0xc'),auth[_0x311f('0x8')](),controller[_0x311f('0x10')]);router['put'](_0x311f('0xa'),auth[_0x311f('0x8')](),controller[_0x311f('0x11')]);router['delete'](_0x311f('0xa'),auth['isAuthenticated'](),controller[_0x311f('0x12')]);module[_0x311f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 2da475f..e3f2074 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 _0x4297=['basic','integrationTab','newTab','sequelize','STRING','ENUM'];(function(_0x32d6dc,_0x5c4b40){var _0x5b4dea=function(_0x207645){while(--_0x207645){_0x32d6dc['push'](_0x32d6dc['shift']());}};_0x5b4dea(++_0x5c4b40);}(_0x4297,0x111));var _0x7429=function(_0x2c8a32,_0x46f29e){_0x2c8a32=_0x2c8a32-0x0;var _0x22b3d7=_0x4297[_0x2c8a32];return _0x22b3d7;};'use strict';var Sequelize=require(_0x7429('0x0'));module['exports']={'name':{'type':Sequelize[_0x7429('0x1')]},'description':{'type':Sequelize[_0x7429('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7429('0x1')]},'authType':{'type':Sequelize[_0x7429('0x2')](_0x7429('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x7429('0x1')]},'consumerKey':{'type':Sequelize[_0x7429('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x7429('0x1')]},'tokenSecret':{'type':Sequelize[_0x7429('0x1')]},'serverUrl':{'type':Sequelize[_0x7429('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7429('0x2')](_0x7429('0x4'),_0x7429('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x4c23=['basic','integrationTab','sequelize','STRING','ENUM'];(function(_0x694ea0,_0x35595e){var _0x22f47e=function(_0x2a17e0){while(--_0x2a17e0){_0x694ea0['push'](_0x694ea0['shift']());}};_0x22f47e(++_0x35595e);}(_0x4c23,0x1b5));var _0x34c2=function(_0x45dae8,_0x5c0982){_0x45dae8=_0x45dae8-0x0;var _0x51cd63=_0x4c23[_0x45dae8];return _0x51cd63;};'use strict';var Sequelize=require(_0x34c2('0x0'));module['exports']={'name':{'type':Sequelize[_0x34c2('0x1')]},'description':{'type':Sequelize[_0x34c2('0x1')]},'username':{'type':Sequelize[_0x34c2('0x1')]},'remoteUri':{'type':Sequelize[_0x34c2('0x1')]},'authType':{'type':Sequelize[_0x34c2('0x2')]('basic'),'defaultValue':_0x34c2('0x3')},'password':{'type':Sequelize[_0x34c2('0x1')]},'consumerKey':{'type':Sequelize[_0x34c2('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x34c2('0x2')]('integrationTab','newTab'),'defaultValue':_0x34c2('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 38f539d..d7f8449 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 _0x0122=['lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','DeskAccount','rawAttributes','fieldName','map','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','update','findOne','DeskConfiguration','pick','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','type','getFields','remoteUri','username','password','token','tokenSecret','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization','%s:%s','toString','base64','concat','_embedded','entries','active','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra'];(function(_0x35f901,_0x4f5415){var _0x5ac5cb=function(_0x512b36){while(--_0x512b36){_0x35f901['push'](_0x35f901['shift']());}};_0x5ac5cb(++_0x4f5415);}(_0x0122,0x65));var _0x2012=function(_0x578e66,_0x229498){_0x578e66=_0x578e66-0x0;var _0x1f4a00=_0x0122[_0x578e66];return _0x1f4a00;};'use strict';var emlformat=require(_0x2012('0x0'));var rimraf=require(_0x2012('0x1'));var zipdir=require(_0x2012('0x2'));var jsonpatch=require(_0x2012('0x3'));var rp=require(_0x2012('0x4'));var moment=require('moment');var BPromise=require(_0x2012('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2012('0x6'));var sox=require(_0x2012('0x7'));var csv=require('to-csv');var ejs=require(_0x2012('0x8'));var fs=require('fs');var fs_extra=require(_0x2012('0x9'));var _=require(_0x2012('0xa'));var squel=require(_0x2012('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2012('0xc'));var toCsv=require(_0x2012('0xd'));var querystring=require(_0x2012('0xe'));var Papa=require(_0x2012('0xf'));var Redis=require(_0x2012('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2012('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2012('0x12'));var logger=require(_0x2012('0x13'))(_0x2012('0x14'));var utils=require(_0x2012('0x15'));var config=require(_0x2012('0x16'));var licenseUtil=require(_0x2012('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2012('0x18'));function respondWithStatusCode(_0x5325cb,_0x214afe){_0x214afe=_0x214afe||0xcc;return function(_0x1dd918){if(_0x1dd918){return _0x5325cb[_0x2012('0x19')](_0x214afe);}return _0x5325cb[_0x2012('0x1a')](_0x214afe)[_0x2012('0x1b')]();};}function respondWithResult(_0x214db1,_0x5087a4){_0x5087a4=_0x5087a4||0xc8;return function(_0x3ee3fb){if(_0x3ee3fb){return _0x214db1['status'](_0x5087a4)['json'](_0x3ee3fb);}};}function respondWithFilteredResult(_0x397015,_0x3c5b6b){return function(_0x1add0d){if(_0x1add0d){var _0x5ac84c=typeof _0x3c5b6b[_0x2012('0x1c')]===_0x2012('0x1d')&&typeof _0x3c5b6b[_0x2012('0x1e')]===_0x2012('0x1d');var _0x5d121f=_0x1add0d[_0x2012('0x1f')];var _0x29f758=_0x5ac84c?0x0:_0x3c5b6b[_0x2012('0x1c')];var _0x2a3f29=_0x5ac84c?_0x1add0d[_0x2012('0x1f')]:_0x3c5b6b['offset']+_0x3c5b6b[_0x2012('0x1e')];var _0x29414b;if(_0x2a3f29>=_0x5d121f){_0x2a3f29=_0x5d121f;_0x29414b=0xc8;}else{_0x29414b=0xce;}_0x397015['status'](_0x29414b);return _0x397015['set'](_0x2012('0x20'),_0x29f758+'-'+_0x2a3f29+'/'+_0x5d121f)[_0x2012('0x21')](_0x1add0d);}return null;};}function patchUpdates(_0x22c03a){return function(_0x174857){try{jsonpatch[_0x2012('0x22')](_0x174857,_0x22c03a,!![]);}catch(_0xc1d29e){return BPromise[_0x2012('0x23')](_0xc1d29e);}return _0x174857[_0x2012('0x24')]();};}function saveUpdates(_0x17cf4f,_0x11439d){return function(_0x5baa27){if(_0x5baa27){return _0x5baa27['update'](_0x17cf4f)[_0x2012('0x25')](function(_0x16b1dd){return _0x16b1dd;});}return null;};}function removeEntity(_0x2180f6,_0x26f513){return function(_0x345f87){if(_0x345f87){return _0x345f87[_0x2012('0x26')]()['then'](function(){_0x2180f6['status'](0xcc)[_0x2012('0x1b')]();});}};}function handleEntityNotFound(_0x4457a9,_0x33a79c){return function(_0x7d830c){if(!_0x7d830c){_0x4457a9[_0x2012('0x19')](0x194);}return _0x7d830c;};}function handleError(_0x13b26b,_0x28ba5a){_0x28ba5a=_0x28ba5a||0x1f4;return function(_0x19f7da){logger['error'](_0x19f7da[_0x2012('0x27')]);if(_0x19f7da[_0x2012('0x28')]){delete _0x19f7da[_0x2012('0x28')];}_0x13b26b['status'](_0x28ba5a)[_0x2012('0x29')](_0x19f7da);};}exports[_0x2012('0x2a')]=function(_0x44eb55,_0x254e9f){var _0x1a3dd7={},_0x118e32={},_0xe2570d={'count':0x0,'rows':[]};var _0x1962db=_['map'](db[_0x2012('0x2b')][_0x2012('0x2c')],function(_0x20ac8d){return{'name':_0x20ac8d[_0x2012('0x2d')],'type':_0x20ac8d['type']['key']};});_0x118e32['model']=_[_0x2012('0x2e')](_0x1962db,_0x2012('0x28'));_0x118e32['query']=_[_0x2012('0x2f')](_0x44eb55[_0x2012('0x30')]);_0x118e32[_0x2012('0x31')]=_[_0x2012('0x32')](_0x118e32[_0x2012('0x33')],_0x118e32[_0x2012('0x30')]);_0x1a3dd7[_0x2012('0x34')]=_[_0x2012('0x32')](_0x118e32[_0x2012('0x33')],qs[_0x2012('0x35')](_0x44eb55[_0x2012('0x30')]['fields']));_0x1a3dd7[_0x2012('0x34')]=_0x1a3dd7[_0x2012('0x34')]['length']?_0x1a3dd7[_0x2012('0x34')]:_0x118e32[_0x2012('0x33')];if(!_0x44eb55[_0x2012('0x30')][_0x2012('0x36')](_0x2012('0x37'))){_0x1a3dd7[_0x2012('0x1e')]=qs[_0x2012('0x1e')](_0x44eb55[_0x2012('0x30')][_0x2012('0x1e')]);_0x1a3dd7['offset']=qs[_0x2012('0x1c')](_0x44eb55[_0x2012('0x30')]['offset']);}_0x1a3dd7[_0x2012('0x38')]=qs[_0x2012('0x39')](_0x44eb55[_0x2012('0x30')]['sort']);_0x1a3dd7[_0x2012('0x3a')]=qs['filters'](_['pick'](_0x44eb55[_0x2012('0x30')],_0x118e32['filters']),_0x1962db);if(_0x44eb55[_0x2012('0x30')][_0x2012('0x3b')]){_0x1a3dd7['where']=_[_0x2012('0x3c')](_0x1a3dd7['where'],{'$or':_[_0x2012('0x2e')](_0x1962db,function(_0x1cd42c){if(_0x1cd42c['type']!=='VIRTUAL'){var _0x1772e6={};_0x1772e6[_0x1cd42c[_0x2012('0x28')]]={'$like':'%'+_0x44eb55[_0x2012('0x30')][_0x2012('0x3b')]+'%'};return _0x1772e6;}})});}_0x1a3dd7=_['merge']({},_0x1a3dd7,_0x44eb55['options']);var _0xf4f0e2={'where':_0x1a3dd7['where']};return db['DeskAccount'][_0x2012('0x1f')](_0xf4f0e2)['then'](function(_0xdebb16){_0xe2570d['count']=_0xdebb16;if(_0x44eb55['query'][_0x2012('0x3d')]){_0x1a3dd7[_0x2012('0x3e')]=[{'all':!![]}];}return db[_0x2012('0x2b')][_0x2012('0x3f')](_0x1a3dd7);})[_0x2012('0x25')](function(_0x17c837){_0xe2570d[_0x2012('0x40')]=_0x17c837;return _0xe2570d;})[_0x2012('0x25')](respondWithFilteredResult(_0x254e9f,_0x1a3dd7))[_0x2012('0x41')](handleError(_0x254e9f,null));};exports[_0x2012('0x42')]=function(_0x15c1ea,_0x1b7304){var _0x2cb026={'raw':![],'where':{'id':_0x15c1ea[_0x2012('0x43')]['id']}},_0x44df2b={};_0x44df2b['model']=_['keys'](db[_0x2012('0x2b')][_0x2012('0x2c')]);_0x44df2b[_0x2012('0x30')]=_[_0x2012('0x2f')](_0x15c1ea[_0x2012('0x30')]);_0x44df2b[_0x2012('0x31')]=_[_0x2012('0x32')](_0x44df2b[_0x2012('0x33')],_0x44df2b[_0x2012('0x30')]);_0x2cb026['attributes']=_[_0x2012('0x32')](_0x44df2b[_0x2012('0x33')],qs[_0x2012('0x35')](_0x15c1ea[_0x2012('0x30')]['fields']));_0x2cb026[_0x2012('0x34')]=_0x2cb026[_0x2012('0x34')][_0x2012('0x44')]?_0x2cb026['attributes']:_0x44df2b[_0x2012('0x33')];if(_0x15c1ea[_0x2012('0x30')][_0x2012('0x3d')]){_0x2cb026[_0x2012('0x3e')]=[{'all':!![]}];}_0x2cb026=_[_0x2012('0x3c')]({},_0x2cb026,_0x15c1ea[_0x2012('0x45')]);return db[_0x2012('0x2b')][_0x2012('0x46')](_0x2cb026)[_0x2012('0x25')](handleEntityNotFound(_0x1b7304,null))[_0x2012('0x25')](respondWithResult(_0x1b7304,null))['catch'](handleError(_0x1b7304,null));};exports[_0x2012('0x47')]=function(_0x40e30f,_0x3154f9){return db['DeskAccount'][_0x2012('0x47')](_0x40e30f[_0x2012('0x48')],{})[_0x2012('0x25')](respondWithResult(_0x3154f9,0xc9))[_0x2012('0x41')](handleError(_0x3154f9,null));};exports[_0x2012('0x49')]=function(_0x10e6ae,_0x44c9c5){if(_0x10e6ae[_0x2012('0x48')]['id']){delete _0x10e6ae[_0x2012('0x48')]['id'];}return db[_0x2012('0x2b')][_0x2012('0x46')]({'where':{'id':_0x10e6ae[_0x2012('0x43')]['id']}})[_0x2012('0x25')](handleEntityNotFound(_0x44c9c5,null))[_0x2012('0x25')](saveUpdates(_0x10e6ae[_0x2012('0x48')],null))[_0x2012('0x25')](respondWithResult(_0x44c9c5,null))[_0x2012('0x41')](handleError(_0x44c9c5,null));};exports[_0x2012('0x26')]=function(_0x31f473,_0x5dd6e8){return db['DeskAccount'][_0x2012('0x46')]({'where':{'id':_0x31f473['params']['id']}})[_0x2012('0x25')](handleEntityNotFound(_0x5dd6e8,null))['then'](removeEntity(_0x5dd6e8,null))[_0x2012('0x41')](handleError(_0x5dd6e8,null));};exports['getConfigurations']=function(_0x2e73e8,_0x53d163,_0x5348cb){var _0x3e3742={};var _0x40208d={};var _0x1f93c4;var _0x4d4a5f;return db[_0x2012('0x2b')][_0x2012('0x4a')]({'where':{'id':_0x2e73e8['params']['id']}})[_0x2012('0x25')](handleEntityNotFound(_0x53d163,null))['then'](function(_0x25639b){if(_0x25639b){_0x1f93c4=_0x25639b;_0x40208d[_0x2012('0x33')]=_['keys'](db[_0x2012('0x4b')][_0x2012('0x2c')]);_0x40208d['query']=_[_0x2012('0x2f')](_0x2e73e8['query']);_0x40208d[_0x2012('0x31')]=_[_0x2012('0x32')](_0x40208d[_0x2012('0x33')],_0x40208d[_0x2012('0x30')]);_0x3e3742['attributes']=_['intersection'](_0x40208d[_0x2012('0x33')],qs[_0x2012('0x35')](_0x2e73e8['query'][_0x2012('0x35')]));_0x3e3742[_0x2012('0x34')]=_0x3e3742['attributes'][_0x2012('0x44')]?_0x3e3742[_0x2012('0x34')]:_0x40208d['model'];_0x3e3742[_0x2012('0x38')]=qs[_0x2012('0x39')](_0x2e73e8[_0x2012('0x30')][_0x2012('0x39')]);_0x3e3742['where']=qs[_0x2012('0x31')](_[_0x2012('0x4c')](_0x2e73e8[_0x2012('0x30')],_0x40208d[_0x2012('0x31')]));if(_0x2e73e8['query'][_0x2012('0x3b')]){_0x3e3742['where']=_['merge'](_0x3e3742[_0x2012('0x3a')],{'$or':_[_0x2012('0x2e')](_0x3e3742['attributes'],function(_0xb66046){var _0x4f1f18={};_0x4f1f18[_0xb66046]={'$like':'%'+_0x2e73e8[_0x2012('0x30')][_0x2012('0x3b')]+'%'};return _0x4f1f18;})});}_0x3e3742=_[_0x2012('0x3c')]({},_0x3e3742,_0x2e73e8[_0x2012('0x45')]);return _0x1f93c4[_0x2012('0x4d')](_0x3e3742);}})[_0x2012('0x25')](function(_0x44e46d){if(_0x44e46d){_0x4d4a5f=_0x44e46d['length'];if(!_0x2e73e8['query']['hasOwnProperty'](_0x2012('0x37'))){_0x3e3742[_0x2012('0x1e')]=qs[_0x2012('0x1e')](_0x2e73e8[_0x2012('0x30')]['limit']);_0x3e3742[_0x2012('0x1c')]=qs[_0x2012('0x1c')](_0x2e73e8[_0x2012('0x30')][_0x2012('0x1c')]);}return _0x1f93c4['getConfigurations'](_0x3e3742);}})[_0x2012('0x25')](function(_0x2b6dc6){if(_0x2b6dc6){return _0x2b6dc6?{'count':_0x4d4a5f,'rows':_0x2b6dc6}:null;}})['then'](respondWithResult(_0x53d163,null))['catch'](handleError(_0x53d163,null));};exports['addConfiguration']=function(_0x332281,_0x4d1208,_0x51e3fc){if(_0x332281[_0x2012('0x48')]['id']){delete _0x332281[_0x2012('0x48')]['id'];}return db['DeskAccount'][_0x2012('0x4a')]({'where':{'id':_0x332281['params']['id']}})[_0x2012('0x25')](handleEntityNotFound(_0x4d1208,null))[_0x2012('0x25')](function(_0x4fa9ef){if(_0x4fa9ef){_0x332281[_0x2012('0x48')][_0x2012('0x4e')]=_0x4fa9ef['id'];_0x332281[_0x2012('0x48')][_0x2012('0x4f')]=integrations[_0x2012('0x50')](_0x332281[_0x2012('0x48')][_0x2012('0x51')],_0x332281[_0x2012('0x48')]['type']);_0x332281[_0x2012('0x48')][_0x2012('0x52')]=integrations[_0x2012('0x53')](_0x332281[_0x2012('0x48')][_0x2012('0x51')],_0x332281[_0x2012('0x48')][_0x2012('0x54')]);return db[_0x2012('0x4b')][_0x2012('0x47')](_0x332281[_0x2012('0x48')],{'include':[{'model':db['DeskField'],'as':_0x2012('0x4f')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0x2012('0x25')](respondWithResult(_0x4d1208,null))[_0x2012('0x41')](handleError(_0x4d1208,null));};exports[_0x2012('0x55')]=function(_0x309a50,_0x23b3dc,_0x4079c5){var _0x4e0782=[{'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 _0x50d049='';return db[_0x2012('0x2b')][_0x2012('0x4a')]({'where':{'id':_0x309a50[_0x2012('0x43')]['id']},'attributes':['id',_0x2012('0x56'),'authType',_0x2012('0x57'),_0x2012('0x58'),'consumerKey','consumerSecret',_0x2012('0x59'),_0x2012('0x5a')]})[_0x2012('0x25')](handleEntityNotFound(_0x23b3dc,null))[_0x2012('0x25')](function(_0x55ca5c){if(_0x55ca5c){_0x50d049=_0x55ca5c[_0x2012('0x56')];var _0x42f858=_0x50d049[_0x2012('0x5b')](-0x1);if(_0x42f858==='/'){_0x50d049=_0x50d049['substring'](0x0,_0x50d049[_0x2012('0x5c')](_0x42f858));}var _0x26168d={'method':_0x2012('0x5d'),'uri':util[_0x2012('0x5e')](_0x2012('0x5f'),_0x50d049),'headers':{'Content-Type':_0x2012('0x60'),'Accept':_0x2012('0x60')},'json':!![]};if(_0x55ca5c['authType']===_0x2012('0x61')){_0x26168d['headers'][_0x2012('0x62')]=util[_0x2012('0x5e')]('Basic\x20%s',new Buffer(util['format'](_0x2012('0x63'),_0x55ca5c['username'],_0x55ca5c[_0x2012('0x58')]))[_0x2012('0x64')](_0x2012('0x65')));}return rp(_0x26168d)[_0x2012('0x25')](function(_0x5a416d){return _0x4e0782[_0x2012('0x66')](_[_0x2012('0x2e')](_0x5a416d[_0x2012('0x67')][_0x2012('0x68')],function(_0x1d6978){return{'id':_0x1d6978[_0x2012('0x28')],'name':_0x1d6978[_0x2012('0x28')],'type':_0x1d6978[_0x2012('0x54')],'active':_0x1d6978[_0x2012('0x69')],'label':_0x1d6978[_0x2012('0x6a')],'custom':!![]};}));});}})[_0x2012('0x25')](function(_0xf9d33c){return{'count':_0xf9d33c[_0x2012('0x44')],'rows':_0xf9d33c};})[_0x2012('0x25')](respondWithResult(_0x23b3dc,null))[_0x2012('0x41')](function(_0x9d0d39){var _0x113718=_0x309a50[_0x2012('0x30')][_0x2012('0x6b')]?0x1f4:_0x9d0d39[_0x2012('0x6c')]||0x1f4;logger[_0x2012('0x6d')](_0x2012('0x6e'),_0x2012('0x55'),_0x113718,JSON['stringify'](_0x9d0d39));delete _0x9d0d39[_0x2012('0x28')];if(_0x113718===0x191){_0x113718=0x190;}_0x23b3dc[_0x2012('0x1a')](_0x113718)[_0x2012('0x29')](_0x309a50[_0x2012('0x30')][_0x2012('0x6b')]?{'message':'Wrong\x20credentials','statusCode':_0x9d0d39[_0x2012('0x6c')]}:_0x9d0d39);});}; \ No newline at end of file +var _0xf74d=['DeskAccount','length','find','create','body','getConfigurations','findOne','DeskConfiguration','pick','addConfiguration','AccountId','Descriptions','getDescriptions','DeskField','Subjects','getFields','priority','remoteUri','authType','username','password','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','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','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0xf74d,0x9f));var _0xdf74=function(_0x22d17f,_0x340c69){_0x22d17f=_0x22d17f-0x0;var _0x2d1a54=_0xf74d[_0x22d17f];return _0x2d1a54;};'use strict';var emlformat=require(_0xdf74('0x0'));var rimraf=require(_0xdf74('0x1'));var zipdir=require(_0xdf74('0x2'));var jsonpatch=require(_0xdf74('0x3'));var rp=require(_0xdf74('0x4'));var moment=require('moment');var BPromise=require(_0xdf74('0x5'));var Mustache=require('mustache');var util=require(_0xdf74('0x6'));var path=require(_0xdf74('0x7'));var sox=require(_0xdf74('0x8'));var csv=require('to-csv');var ejs=require(_0xdf74('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf74('0xa'));var squel=require(_0xdf74('0xb'));var crypto=require('crypto');var jsforce=require(_0xdf74('0xc'));var deskjs=require(_0xdf74('0xd'));var toCsv=require(_0xdf74('0xe'));var querystring=require('querystring');var Papa=require(_0xdf74('0xf'));var Redis=require(_0xdf74('0x10'));var authService=require(_0xdf74('0x11'));var qs=require(_0xdf74('0x12'));var as=require(_0xdf74('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf74('0x14'))(_0xdf74('0x15'));var utils=require(_0xdf74('0x16'));var config=require(_0xdf74('0x17'));var licenseUtil=require(_0xdf74('0x18'));var db=require(_0xdf74('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x46abd2,_0x438926){_0x438926=_0x438926||0xcc;return function(_0x46902c){if(_0x46902c){return _0x46abd2[_0xdf74('0x1a')](_0x438926);}return _0x46abd2[_0xdf74('0x1b')](_0x438926)['end']();};}function respondWithResult(_0x53ab37,_0x554038){_0x554038=_0x554038||0xc8;return function(_0x34fc3a){if(_0x34fc3a){return _0x53ab37[_0xdf74('0x1b')](_0x554038)[_0xdf74('0x1c')](_0x34fc3a);}};}function respondWithFilteredResult(_0xc3de83,_0x4c7fb9){return function(_0x507fc4){if(_0x507fc4){var _0x5beabe=typeof _0x4c7fb9['offset']===_0xdf74('0x1d')&&typeof _0x4c7fb9[_0xdf74('0x1e')]===_0xdf74('0x1d');var _0x1b35c6=_0x507fc4[_0xdf74('0x1f')];var _0x1af12a=_0x5beabe?0x0:_0x4c7fb9[_0xdf74('0x20')];var _0x3bcb3a=_0x5beabe?_0x507fc4[_0xdf74('0x1f')]:_0x4c7fb9[_0xdf74('0x20')]+_0x4c7fb9[_0xdf74('0x1e')];var _0xbe0aef;if(_0x3bcb3a>=_0x1b35c6){_0x3bcb3a=_0x1b35c6;_0xbe0aef=0xc8;}else{_0xbe0aef=0xce;}_0xc3de83[_0xdf74('0x1b')](_0xbe0aef);return _0xc3de83[_0xdf74('0x21')](_0xdf74('0x22'),_0x1af12a+'-'+_0x3bcb3a+'/'+_0x1b35c6)['json'](_0x507fc4);}return null;};}function patchUpdates(_0x40a7dd){return function(_0x2b9102){try{jsonpatch['apply'](_0x2b9102,_0x40a7dd,!![]);}catch(_0x404805){return BPromise[_0xdf74('0x23')](_0x404805);}return _0x2b9102[_0xdf74('0x24')]();};}function saveUpdates(_0x13beea,_0x226886){return function(_0x407ee5){if(_0x407ee5){return _0x407ee5[_0xdf74('0x25')](_0x13beea)[_0xdf74('0x26')](function(_0x27920e){return _0x27920e;});}return null;};}function removeEntity(_0x153d7f,_0x2b6401){return function(_0x2c0e23){if(_0x2c0e23){return _0x2c0e23[_0xdf74('0x27')]()[_0xdf74('0x26')](function(){_0x153d7f[_0xdf74('0x1b')](0xcc)[_0xdf74('0x28')]();});}};}function handleEntityNotFound(_0x2aa184,_0x52ec68){return function(_0x520c14){if(!_0x520c14){_0x2aa184[_0xdf74('0x1a')](0x194);}return _0x520c14;};}function handleError(_0x4ae430,_0xef89c0){_0xef89c0=_0xef89c0||0x1f4;return function(_0x4cfce7){logger[_0xdf74('0x29')](_0x4cfce7[_0xdf74('0x2a')]);if(_0x4cfce7[_0xdf74('0x2b')]){delete _0x4cfce7['name'];}_0x4ae430[_0xdf74('0x1b')](_0xef89c0)[_0xdf74('0x2c')](_0x4cfce7);};}exports[_0xdf74('0x2d')]=function(_0x34afd2,_0x4cc800){var _0x1199ff={},_0x404ade={},_0x411825={'count':0x0,'rows':[]};var _0x329950=_[_0xdf74('0x2e')](db['DeskAccount'][_0xdf74('0x2f')],function(_0x2af684){return{'name':_0x2af684[_0xdf74('0x30')],'type':_0x2af684[_0xdf74('0x31')][_0xdf74('0x32')]};});_0x404ade['model']=_['map'](_0x329950,_0xdf74('0x2b'));_0x404ade[_0xdf74('0x33')]=_[_0xdf74('0x34')](_0x34afd2[_0xdf74('0x33')]);_0x404ade[_0xdf74('0x35')]=_[_0xdf74('0x36')](_0x404ade[_0xdf74('0x37')],_0x404ade[_0xdf74('0x33')]);_0x1199ff[_0xdf74('0x38')]=_[_0xdf74('0x36')](_0x404ade[_0xdf74('0x37')],qs[_0xdf74('0x39')](_0x34afd2['query'][_0xdf74('0x39')]));_0x1199ff[_0xdf74('0x38')]=_0x1199ff['attributes']['length']?_0x1199ff[_0xdf74('0x38')]:_0x404ade[_0xdf74('0x37')];if(!_0x34afd2[_0xdf74('0x33')][_0xdf74('0x3a')](_0xdf74('0x3b'))){_0x1199ff['limit']=qs['limit'](_0x34afd2[_0xdf74('0x33')][_0xdf74('0x1e')]);_0x1199ff[_0xdf74('0x20')]=qs[_0xdf74('0x20')](_0x34afd2[_0xdf74('0x33')][_0xdf74('0x20')]);}_0x1199ff[_0xdf74('0x3c')]=qs[_0xdf74('0x3d')](_0x34afd2[_0xdf74('0x33')]['sort']);_0x1199ff[_0xdf74('0x3e')]=qs[_0xdf74('0x35')](_['pick'](_0x34afd2[_0xdf74('0x33')],_0x404ade[_0xdf74('0x35')]),_0x329950);if(_0x34afd2['query'][_0xdf74('0x3f')]){_0x1199ff[_0xdf74('0x3e')]=_[_0xdf74('0x40')](_0x1199ff[_0xdf74('0x3e')],{'$or':_[_0xdf74('0x2e')](_0x329950,function(_0x1a5295){if(_0x1a5295[_0xdf74('0x31')]!=='VIRTUAL'){var _0x54a643={};_0x54a643[_0x1a5295[_0xdf74('0x2b')]]={'$like':'%'+_0x34afd2[_0xdf74('0x33')][_0xdf74('0x3f')]+'%'};return _0x54a643;}})});}_0x1199ff=_[_0xdf74('0x40')]({},_0x1199ff,_0x34afd2[_0xdf74('0x41')]);var _0x14d384={'where':_0x1199ff['where']};return db['DeskAccount']['count'](_0x14d384)[_0xdf74('0x26')](function(_0x4dd4ce){_0x411825['count']=_0x4dd4ce;if(_0x34afd2['query'][_0xdf74('0x42')]){_0x1199ff[_0xdf74('0x43')]=[{'all':!![]}];}return db['DeskAccount'][_0xdf74('0x44')](_0x1199ff);})[_0xdf74('0x26')](function(_0x3a575e){_0x411825[_0xdf74('0x45')]=_0x3a575e;return _0x411825;})[_0xdf74('0x26')](respondWithFilteredResult(_0x4cc800,_0x1199ff))[_0xdf74('0x46')](handleError(_0x4cc800,null));};exports[_0xdf74('0x47')]=function(_0x3767ec,_0xf6e733){var _0x162444={'raw':![],'where':{'id':_0x3767ec[_0xdf74('0x48')]['id']}},_0xb05d59={};_0xb05d59['model']=_[_0xdf74('0x34')](db[_0xdf74('0x49')][_0xdf74('0x2f')]);_0xb05d59[_0xdf74('0x33')]=_['keys'](_0x3767ec[_0xdf74('0x33')]);_0xb05d59[_0xdf74('0x35')]=_[_0xdf74('0x36')](_0xb05d59['model'],_0xb05d59[_0xdf74('0x33')]);_0x162444['attributes']=_['intersection'](_0xb05d59[_0xdf74('0x37')],qs[_0xdf74('0x39')](_0x3767ec[_0xdf74('0x33')][_0xdf74('0x39')]));_0x162444[_0xdf74('0x38')]=_0x162444['attributes'][_0xdf74('0x4a')]?_0x162444[_0xdf74('0x38')]:_0xb05d59[_0xdf74('0x37')];if(_0x3767ec['query'][_0xdf74('0x42')]){_0x162444['include']=[{'all':!![]}];}_0x162444=_[_0xdf74('0x40')]({},_0x162444,_0x3767ec[_0xdf74('0x41')]);return db['DeskAccount'][_0xdf74('0x4b')](_0x162444)[_0xdf74('0x26')](handleEntityNotFound(_0xf6e733,null))['then'](respondWithResult(_0xf6e733,null))[_0xdf74('0x46')](handleError(_0xf6e733,null));};exports[_0xdf74('0x4c')]=function(_0x56f9bc,_0x158903){return db[_0xdf74('0x49')]['create'](_0x56f9bc['body'],{})[_0xdf74('0x26')](respondWithResult(_0x158903,0xc9))[_0xdf74('0x46')](handleError(_0x158903,null));};exports['update']=function(_0xa03172,_0xd66396){if(_0xa03172[_0xdf74('0x4d')]['id']){delete _0xa03172['body']['id'];}return db[_0xdf74('0x49')][_0xdf74('0x4b')]({'where':{'id':_0xa03172[_0xdf74('0x48')]['id']}})[_0xdf74('0x26')](handleEntityNotFound(_0xd66396,null))[_0xdf74('0x26')](saveUpdates(_0xa03172['body'],null))['then'](respondWithResult(_0xd66396,null))[_0xdf74('0x46')](handleError(_0xd66396,null));};exports[_0xdf74('0x27')]=function(_0x4b2ab2,_0x1982d4){return db['DeskAccount'][_0xdf74('0x4b')]({'where':{'id':_0x4b2ab2['params']['id']}})[_0xdf74('0x26')](handleEntityNotFound(_0x1982d4,null))[_0xdf74('0x26')](removeEntity(_0x1982d4,null))['catch'](handleError(_0x1982d4,null));};exports[_0xdf74('0x4e')]=function(_0xabd6f3,_0x3766b9,_0x16ea98){var _0x3440b={};var _0x32469e={};var _0x5bf13e;var _0x471a5a;return db[_0xdf74('0x49')][_0xdf74('0x4f')]({'where':{'id':_0xabd6f3['params']['id']}})[_0xdf74('0x26')](handleEntityNotFound(_0x3766b9,null))[_0xdf74('0x26')](function(_0xaf5467){if(_0xaf5467){_0x5bf13e=_0xaf5467;_0x32469e[_0xdf74('0x37')]=_[_0xdf74('0x34')](db[_0xdf74('0x50')][_0xdf74('0x2f')]);_0x32469e[_0xdf74('0x33')]=_[_0xdf74('0x34')](_0xabd6f3[_0xdf74('0x33')]);_0x32469e[_0xdf74('0x35')]=_[_0xdf74('0x36')](_0x32469e[_0xdf74('0x37')],_0x32469e[_0xdf74('0x33')]);_0x3440b[_0xdf74('0x38')]=_[_0xdf74('0x36')](_0x32469e[_0xdf74('0x37')],qs[_0xdf74('0x39')](_0xabd6f3['query'][_0xdf74('0x39')]));_0x3440b[_0xdf74('0x38')]=_0x3440b[_0xdf74('0x38')][_0xdf74('0x4a')]?_0x3440b['attributes']:_0x32469e[_0xdf74('0x37')];_0x3440b[_0xdf74('0x3c')]=qs[_0xdf74('0x3d')](_0xabd6f3['query']['sort']);_0x3440b['where']=qs[_0xdf74('0x35')](_[_0xdf74('0x51')](_0xabd6f3['query'],_0x32469e[_0xdf74('0x35')]));if(_0xabd6f3[_0xdf74('0x33')][_0xdf74('0x3f')]){_0x3440b['where']=_[_0xdf74('0x40')](_0x3440b[_0xdf74('0x3e')],{'$or':_['map'](_0x3440b[_0xdf74('0x38')],function(_0x4a833a){var _0x1389ff={};_0x1389ff[_0x4a833a]={'$like':'%'+_0xabd6f3[_0xdf74('0x33')][_0xdf74('0x3f')]+'%'};return _0x1389ff;})});}_0x3440b=_['merge']({},_0x3440b,_0xabd6f3['options']);return _0x5bf13e['getConfigurations'](_0x3440b);}})[_0xdf74('0x26')](function(_0x304cda){if(_0x304cda){_0x471a5a=_0x304cda[_0xdf74('0x4a')];if(!_0xabd6f3[_0xdf74('0x33')][_0xdf74('0x3a')](_0xdf74('0x3b'))){_0x3440b['limit']=qs[_0xdf74('0x1e')](_0xabd6f3[_0xdf74('0x33')][_0xdf74('0x1e')]);_0x3440b[_0xdf74('0x20')]=qs[_0xdf74('0x20')](_0xabd6f3['query'][_0xdf74('0x20')]);}return _0x5bf13e[_0xdf74('0x4e')](_0x3440b);}})['then'](function(_0x58ca69){if(_0x58ca69){return _0x58ca69?{'count':_0x471a5a,'rows':_0x58ca69}:null;}})[_0xdf74('0x26')](respondWithResult(_0x3766b9,null))[_0xdf74('0x46')](handleError(_0x3766b9,null));};exports[_0xdf74('0x52')]=function(_0x1e9efb,_0x40e1a5,_0x2d5ffd){if(_0x1e9efb['body']['id']){delete _0x1e9efb['body']['id'];}return db[_0xdf74('0x49')]['findOne']({'where':{'id':_0x1e9efb[_0xdf74('0x48')]['id']}})['then'](handleEntityNotFound(_0x40e1a5,null))[_0xdf74('0x26')](function(_0x300429){if(_0x300429){_0x1e9efb[_0xdf74('0x4d')][_0xdf74('0x53')]=_0x300429['id'];_0x1e9efb[_0xdf74('0x4d')]['Subjects']=integrations['getSubjects'](_0x1e9efb[_0xdf74('0x4d')]['channel'],_0x1e9efb[_0xdf74('0x4d')][_0xdf74('0x31')]);_0x1e9efb[_0xdf74('0x4d')][_0xdf74('0x54')]=integrations[_0xdf74('0x55')](_0x1e9efb[_0xdf74('0x4d')]['channel'],_0x1e9efb[_0xdf74('0x4d')][_0xdf74('0x31')]);return db[_0xdf74('0x50')][_0xdf74('0x4c')](_0x1e9efb['body'],{'include':[{'model':db[_0xdf74('0x56')],'as':_0xdf74('0x57')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0xdf74('0x26')](respondWithResult(_0x40e1a5,null))[_0xdf74('0x46')](handleError(_0x40e1a5,null));};exports[_0xdf74('0x58')]=function(_0x444324,_0x2f8be9,_0x673bfe){var _0x30191b=[{'name':_0xdf74('0x59'),'label':_0xdf74('0x59'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x26cbb9='';return db[_0xdf74('0x49')]['findOne']({'where':{'id':_0x444324['params']['id']},'attributes':['id',_0xdf74('0x5a'),_0xdf74('0x5b'),_0xdf74('0x5c'),_0xdf74('0x5d'),'consumerKey','consumerSecret','token',_0xdf74('0x5e')]})[_0xdf74('0x26')](handleEntityNotFound(_0x2f8be9,null))[_0xdf74('0x26')](function(_0x120d64){if(_0x120d64){_0x26cbb9=_0x120d64['remoteUri'];var _0x4d93a1=_0x26cbb9[_0xdf74('0x5f')](-0x1);if(_0x4d93a1==='/'){_0x26cbb9=_0x26cbb9[_0xdf74('0x60')](0x0,_0x26cbb9[_0xdf74('0x61')](_0x4d93a1));}var _0x4e5727={'method':_0xdf74('0x62'),'uri':util[_0xdf74('0x63')](_0xdf74('0x64'),_0x26cbb9),'headers':{'Content-Type':_0xdf74('0x65'),'Accept':_0xdf74('0x65')},'json':!![]};if(_0x120d64[_0xdf74('0x5b')]==='basic'){_0x4e5727[_0xdf74('0x66')][_0xdf74('0x67')]=util['format'](_0xdf74('0x68'),new Buffer(util[_0xdf74('0x63')](_0xdf74('0x69'),_0x120d64[_0xdf74('0x5c')],_0x120d64[_0xdf74('0x5d')]))[_0xdf74('0x6a')](_0xdf74('0x6b')));}return rp(_0x4e5727)[_0xdf74('0x26')](function(_0x131d16){return _0x30191b[_0xdf74('0x6c')](_['map'](_0x131d16[_0xdf74('0x6d')][_0xdf74('0x6e')],function(_0x732ccd){return{'id':_0x732ccd[_0xdf74('0x2b')],'name':_0x732ccd['name'],'type':_0x732ccd[_0xdf74('0x31')],'active':_0x732ccd[_0xdf74('0x6f')],'label':_0x732ccd['label'],'custom':!![]};}));});}})[_0xdf74('0x26')](function(_0xdcf479){return{'count':_0xdcf479['length'],'rows':_0xdcf479};})[_0xdf74('0x26')](respondWithResult(_0x2f8be9,null))[_0xdf74('0x46')](function(_0x2b9e77){var _0x20930f=_0x444324[_0xdf74('0x33')][_0xdf74('0x70')]?0x1f4:_0x2b9e77[_0xdf74('0x71')]||0x1f4;logger[_0xdf74('0x29')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x20930f,JSON[_0xdf74('0x72')](_0x2b9e77));delete _0x2b9e77['name'];if(_0x20930f===0x191){_0x20930f=0x190;}_0x2f8be9[_0xdf74('0x1b')](_0x20930f)[_0xdf74('0x2c')](_0x444324[_0xdf74('0x33')]['test']?{'message':_0xdf74('0x73'),'statusCode':_0x2b9e77[_0xdf74('0x71')]}:_0x2b9e77);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 5c07f67..50a47cc 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 _0x4949=['../../components/integrations/configuration','DeskAccount','int_desk_accounts','util','api','moment','path','rimraf','../../config/environment'];(function(_0x5a056e,_0x382a98){var _0x5e1dab=function(_0x1059a4){while(--_0x1059a4){_0x5a056e['push'](_0x5a056e['shift']());}};_0x5e1dab(++_0x382a98);}(_0x4949,0x1bc));var _0x9494=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4949[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x9494('0x0'));var logger=require('../../config/logger')(_0x9494('0x1'));var moment=require(_0x9494('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9494('0x3'));var rimraf=require(_0x9494('0x4'));var config=require(_0x9494('0x5'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x9494('0x6'));module['exports']=function(_0x4bcf10,_0x40c311){return _0x4bcf10['define'](_0x9494('0x7'),attributes,{'tableName':_0x9494('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfb1=['../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xcbc424,_0x1a9fa5){var _0x43bd49=function(_0xd2165){while(--_0xd2165){_0xcbc424['push'](_0xcbc424['shift']());}};_0x43bd49(++_0x1a9fa5);}(_0xdfb1,0xd8));var _0x1dfb=function(_0x1b24ca,_0x454021){_0x1b24ca=_0x1b24ca-0x0;var _0x24a591=_0xdfb1[_0x1b24ca];return _0x24a591;};'use strict';var _=require(_0x1dfb('0x0'));var util=require(_0x1dfb('0x1'));var logger=require(_0x1dfb('0x2'))(_0x1dfb('0x3'));var moment=require('moment');var BPromise=require(_0x1dfb('0x4'));var rp=require(_0x1dfb('0x5'));var fs=require('fs');var path=require(_0x1dfb('0x6'));var rimraf=require(_0x1dfb('0x7'));var config=require(_0x1dfb('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x1dfb('0x9'));module[_0x1dfb('0xa')]=function(_0x4951d1,_0x1b9e79){return _0x4951d1[_0x1dfb('0xb')](_0x1dfb('0xc'),attributes,{'tableName':_0x1dfb('0xd'),'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 c8c6d9d..cc7c6dc 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 _0x3ea1=['request','then','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','catch','find','ShowDeskAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x213b86,_0x3dfceb){var _0x140420=function(_0x1ad1db){while(--_0x1ad1db){_0x213b86['push'](_0x213b86['shift']());}};_0x140420(++_0x3dfceb);}(_0x3ea1,0x177));var _0x13ea=function(_0x4d040b,_0x4d5562){_0x4d040b=_0x4d040b-0x0;var _0x4eab87=_0x3ea1[_0x4d040b];return _0x4eab87;};'use strict';var _=require(_0x13ea('0x0'));var util=require(_0x13ea('0x1'));var moment=require('moment');var BPromise=require(_0x13ea('0x2'));var rs=require(_0x13ea('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x13ea('0x4'))['db'];var utils=require(_0x13ea('0x5'));var logger=require('../../config/logger')(_0x13ea('0x6'));var config=require(_0x13ea('0x7'));var jayson=require(_0x13ea('0x8'));var client=jayson['client'][_0x13ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25589a,_0x5b9c8e,_0x6c84cd){return new BPromise(function(_0x6325c,_0x1e2ccb){return client[_0x13ea('0xa')](_0x25589a,_0x6c84cd)[_0x13ea('0xb')](function(_0x2ff5a0){logger[_0x13ea('0xc')](_0x13ea('0xd'),_0x5b9c8e,'request\x20sent');logger['debug'](_0x13ea('0xe'),_0x5b9c8e,_0x13ea('0xf'),JSON['stringify'](_0x2ff5a0));if(_0x2ff5a0['error']){if(_0x2ff5a0[_0x13ea('0x10')][_0x13ea('0x11')]===0x1f4){logger[_0x13ea('0x10')](_0x13ea('0xd'),_0x5b9c8e,_0x2ff5a0[_0x13ea('0x10')][_0x13ea('0x12')]);return _0x1e2ccb(_0x2ff5a0['error'][_0x13ea('0x12')]);}logger['error'](_0x13ea('0xd'),_0x5b9c8e,_0x2ff5a0['error'][_0x13ea('0x12')]);return _0x6325c(_0x2ff5a0[_0x13ea('0x10')]['message']);}else{logger['info'](_0x13ea('0xd'),_0x5b9c8e,_0x13ea('0xf'));_0x6325c(_0x2ff5a0['result'][_0x13ea('0x12')]);}})['catch'](function(_0x4a7868){logger[_0x13ea('0x10')](_0x13ea('0xd'),_0x5b9c8e,_0x4a7868);_0x1e2ccb(_0x4a7868);});});}exports[_0x13ea('0x13')]=function(_0x57eaf3){var _0x5b708d=this;return new Promise(function(_0xcedec6,_0x4d44b4){return db[_0x13ea('0x14')][_0x13ea('0x15')]({'raw':_0x57eaf3[_0x13ea('0x16')]?_0x57eaf3['options'][_0x13ea('0x17')]===undefined?!![]:![]:!![],'where':_0x57eaf3[_0x13ea('0x16')]?_0x57eaf3[_0x13ea('0x16')][_0x13ea('0x18')]||null:null,'attributes':_0x57eaf3[_0x13ea('0x16')]?_0x57eaf3[_0x13ea('0x16')][_0x13ea('0x19')]||null:null,'limit':_0x57eaf3[_0x13ea('0x16')]?_0x57eaf3[_0x13ea('0x16')][_0x13ea('0x1a')]||null:null,'include':_0x57eaf3[_0x13ea('0x16')]?_0x57eaf3[_0x13ea('0x16')][_0x13ea('0x1b')]?_[_0x13ea('0x1c')](_0x57eaf3[_0x13ea('0x16')][_0x13ea('0x1b')],function(_0x1506ff){return{'model':db[_0x1506ff[_0x13ea('0x1d')]],'as':_0x1506ff['as'],'attributes':_0x1506ff[_0x13ea('0x19')],'include':_0x1506ff[_0x13ea('0x1b')]?_[_0x13ea('0x1c')](_0x1506ff[_0x13ea('0x1b')],function(_0x488302){return{'model':db[_0x488302[_0x13ea('0x1d')]],'as':_0x488302['as'],'attributes':_0x488302[_0x13ea('0x19')],'include':_0x488302[_0x13ea('0x1b')]?_[_0x13ea('0x1c')](_0x488302['include'],function(_0x1aa6fb){return{'model':db[_0x1aa6fb[_0x13ea('0x1d')]],'as':_0x1aa6fb['as'],'attributes':_0x1aa6fb[_0x13ea('0x19')]};}):[]};}):[]};}):[]:[]})[_0x13ea('0xb')](function(_0x30ef17){logger[_0x13ea('0xc')](_0x13ea('0x13'),_0x57eaf3);logger[_0x13ea('0x1e')](_0x13ea('0x13'),_0x57eaf3,JSON[_0x13ea('0x1f')](_0x30ef17));_0xcedec6(_0x30ef17);})[_0x13ea('0x20')](function(_0x4d5a37){logger[_0x13ea('0x10')](_0x13ea('0x13'),_0x4d5a37[_0x13ea('0x12')],_0x57eaf3);_0x4d44b4(_0x5b708d[_0x13ea('0x10')](0x1f4,_0x4d5a37[_0x13ea('0x12')]));});});};exports['ShowDeskAccount']=function(_0x880898){var _0x1325db=this;return new Promise(function(_0xcae515,_0x187334){return db[_0x13ea('0x14')][_0x13ea('0x21')]({'raw':_0x880898[_0x13ea('0x16')]?_0x880898['options'][_0x13ea('0x17')]===undefined?!![]:![]:!![],'where':_0x880898[_0x13ea('0x16')]?_0x880898[_0x13ea('0x16')][_0x13ea('0x18')]||null:null,'attributes':_0x880898['options']?_0x880898[_0x13ea('0x16')]['attributes']||null:null,'include':_0x880898[_0x13ea('0x16')]?_0x880898[_0x13ea('0x16')]['include']?_['map'](_0x880898[_0x13ea('0x16')][_0x13ea('0x1b')],function(_0x487ac0){return{'model':db[_0x487ac0[_0x13ea('0x1d')]],'as':_0x487ac0['as'],'attributes':_0x487ac0[_0x13ea('0x19')],'include':_0x487ac0[_0x13ea('0x1b')]?_[_0x13ea('0x1c')](_0x487ac0[_0x13ea('0x1b')],function(_0x31ca2e){return{'model':db[_0x31ca2e[_0x13ea('0x1d')]],'as':_0x31ca2e['as'],'attributes':_0x31ca2e['attributes'],'include':_0x31ca2e[_0x13ea('0x1b')]?_[_0x13ea('0x1c')](_0x31ca2e[_0x13ea('0x1b')],function(_0x363805){return{'model':db[_0x363805[_0x13ea('0x1d')]],'as':_0x363805['as'],'attributes':_0x363805[_0x13ea('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2979fa){logger[_0x13ea('0xc')]('ShowDeskAccount',_0x880898);logger['debug'](_0x13ea('0x22'),_0x880898,JSON[_0x13ea('0x1f')](_0x2979fa));_0xcae515(_0x2979fa);})[_0x13ea('0x20')](function(_0x5f8cf){logger[_0x13ea('0x10')]('ShowDeskAccount',_0x5f8cf[_0x13ea('0x12')],_0x880898);_0x187334(_0x1325db[_0x13ea('0x10')](0x1f4,_0x5f8cf[_0x13ea('0x12')]));});});}; \ No newline at end of file +var _0x98d8=['include','map','model','debug','ShowDeskAccount','find','raw','where','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','catch','GetDeskAccount','DeskAccount','findAll','options','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98d8,0x15c));var _0x898d=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0x98d8[_0x393d69];return _0x3cee37;};'use strict';var _=require(_0x898d('0x0'));var util=require(_0x898d('0x1'));var moment=require(_0x898d('0x2'));var BPromise=require(_0x898d('0x3'));var rs=require(_0x898d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x898d('0x5'));var logger=require(_0x898d('0x6'))('rpc');var config=require(_0x898d('0x7'));var jayson=require(_0x898d('0x8'));var client=jayson[_0x898d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19f72e,_0x5de0e2,_0x41491d){return new BPromise(function(_0x53a77a,_0x5ef46c){return client[_0x898d('0xa')](_0x19f72e,_0x41491d)[_0x898d('0xb')](function(_0x51e2ce){logger[_0x898d('0xc')]('DeskAccount,\x20%s,\x20%s',_0x5de0e2,_0x898d('0xd'));logger['debug'](_0x898d('0xe'),_0x5de0e2,_0x898d('0xd'),JSON[_0x898d('0xf')](_0x51e2ce));if(_0x51e2ce['error']){if(_0x51e2ce[_0x898d('0x10')][_0x898d('0x11')]===0x1f4){logger[_0x898d('0x10')]('DeskAccount,\x20%s,\x20%s',_0x5de0e2,_0x51e2ce[_0x898d('0x10')][_0x898d('0x12')]);return _0x5ef46c(_0x51e2ce[_0x898d('0x10')][_0x898d('0x12')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x5de0e2,_0x51e2ce[_0x898d('0x10')][_0x898d('0x12')]);return _0x53a77a(_0x51e2ce[_0x898d('0x10')][_0x898d('0x12')]);}else{logger[_0x898d('0xc')](_0x898d('0x13'),_0x5de0e2,_0x898d('0xd'));_0x53a77a(_0x51e2ce['result'][_0x898d('0x12')]);}})[_0x898d('0x14')](function(_0x325fbc){logger[_0x898d('0x10')]('DeskAccount,\x20%s,\x20%s',_0x5de0e2,_0x325fbc);_0x5ef46c(_0x325fbc);});});}exports[_0x898d('0x15')]=function(_0x33dbf7){var _0x5ae356=this;return new Promise(function(_0x39694e,_0x47b1f1){return db[_0x898d('0x16')][_0x898d('0x17')]({'raw':_0x33dbf7[_0x898d('0x18')]?_0x33dbf7[_0x898d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x33dbf7['options']?_0x33dbf7[_0x898d('0x18')]['where']||null:null,'attributes':_0x33dbf7[_0x898d('0x18')]?_0x33dbf7[_0x898d('0x18')][_0x898d('0x19')]||null:null,'limit':_0x33dbf7['options']?_0x33dbf7[_0x898d('0x18')]['limit']||null:null,'include':_0x33dbf7[_0x898d('0x18')]?_0x33dbf7[_0x898d('0x18')][_0x898d('0x1a')]?_[_0x898d('0x1b')](_0x33dbf7[_0x898d('0x18')]['include'],function(_0x273448){return{'model':db[_0x273448['model']],'as':_0x273448['as'],'attributes':_0x273448['attributes'],'include':_0x273448[_0x898d('0x1a')]?_[_0x898d('0x1b')](_0x273448['include'],function(_0x49af25){return{'model':db[_0x49af25[_0x898d('0x1c')]],'as':_0x49af25['as'],'attributes':_0x49af25[_0x898d('0x19')],'include':_0x49af25['include']?_[_0x898d('0x1b')](_0x49af25[_0x898d('0x1a')],function(_0xe3157c){return{'model':db[_0xe3157c['model']],'as':_0xe3157c['as'],'attributes':_0xe3157c[_0x898d('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xab0977){logger[_0x898d('0xc')]('GetDeskAccount',_0x33dbf7);logger[_0x898d('0x1d')](_0x898d('0x15'),_0x33dbf7,JSON[_0x898d('0xf')](_0xab0977));_0x39694e(_0xab0977);})[_0x898d('0x14')](function(_0x4d1e30){logger[_0x898d('0x10')](_0x898d('0x15'),_0x4d1e30[_0x898d('0x12')],_0x33dbf7);_0x47b1f1(_0x5ae356[_0x898d('0x10')](0x1f4,_0x4d1e30['message']));});});};exports[_0x898d('0x1e')]=function(_0x257324){var _0x586c8a=this;return new Promise(function(_0x2b97bc,_0x23d1d7){return db[_0x898d('0x16')][_0x898d('0x1f')]({'raw':_0x257324[_0x898d('0x18')]?_0x257324['options'][_0x898d('0x20')]===undefined?!![]:![]:!![],'where':_0x257324['options']?_0x257324[_0x898d('0x18')][_0x898d('0x21')]||null:null,'attributes':_0x257324['options']?_0x257324[_0x898d('0x18')][_0x898d('0x19')]||null:null,'include':_0x257324[_0x898d('0x18')]?_0x257324[_0x898d('0x18')][_0x898d('0x1a')]?_[_0x898d('0x1b')](_0x257324['options']['include'],function(_0x5a1195){return{'model':db[_0x5a1195[_0x898d('0x1c')]],'as':_0x5a1195['as'],'attributes':_0x5a1195[_0x898d('0x19')],'include':_0x5a1195[_0x898d('0x1a')]?_[_0x898d('0x1b')](_0x5a1195[_0x898d('0x1a')],function(_0x392532){return{'model':db[_0x392532[_0x898d('0x1c')]],'as':_0x392532['as'],'attributes':_0x392532[_0x898d('0x19')],'include':_0x392532[_0x898d('0x1a')]?_[_0x898d('0x1b')](_0x392532['include'],function(_0x2dec53){return{'model':db[_0x2dec53['model']],'as':_0x2dec53['as'],'attributes':_0x2dec53[_0x898d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x898d('0xb')](function(_0x208970){logger[_0x898d('0xc')](_0x898d('0x1e'),_0x257324);logger[_0x898d('0x1d')](_0x898d('0x1e'),_0x257324,JSON['stringify'](_0x208970));_0x2b97bc(_0x208970);})[_0x898d('0x14')](function(_0x4943dd){logger[_0x898d('0x10')](_0x898d('0x1e'),_0x4943dd[_0x898d('0x12')],_0x257324);_0x23d1d7(_0x586c8a[_0x898d('0x10')](0x1f4,_0x4943dd[_0x898d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 55c24a4..1e7ae80 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x56355a,_0x138baf){var _0x573afa=function(_0x253457){while(--_0x253457){_0x56355a['push'](_0x56355a['shift']());}};_0x573afa(++_0x138baf);}(_0x55ca,0x126));var _0xa55c=function(_0x4efe55,_0x6174ea){_0x4efe55=_0x4efe55-0x0;var _0x3a15da=_0x55ca[_0x4efe55];return _0x3a15da;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _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(_0x419ccf,_0x4acfd3){var _0x1a78a2=function(_0x3d24ee){while(--_0x3d24ee){_0x419ccf['push'](_0x419ccf['shift']());}};_0x1a78a2(++_0x4acfd3);}(_0x3e74,0x175));var _0x43e7=function(_0x57ffea,_0x2427ec){_0x57ffea=_0x57ffea-0x0;var _0x412896=_0x3e74[_0x57ffea];return _0x412896;};'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 diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index df20243..bbe0096 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 _0x1878=['exports','STRING','sequelize'];(function(_0x1ebb10,_0x156b3e){var _0x20d709=function(_0x4cc093){while(--_0x4cc093){_0x1ebb10['push'](_0x1ebb10['shift']());}};_0x20d709(++_0x156b3e);}(_0x1878,0xaa));var _0x8187=function(_0x4ced2d,_0x46c50f){_0x4ced2d=_0x4ced2d-0x0;var _0x2c9a6b=_0x1878[_0x4ced2d];return _0x2c9a6b;};'use strict';var Sequelize=require(_0x8187('0x0'));module[_0x8187('0x1')]={'name':{'type':Sequelize[_0x8187('0x2')]},'description':{'type':Sequelize[_0x8187('0x2')]}}; \ No newline at end of file +var _0xfac5=['sequelize','STRING'];(function(_0xef7b01,_0x58a502){var _0x28f882=function(_0x592511){while(--_0x592511){_0xef7b01['push'](_0xef7b01['shift']());}};_0x28f882(++_0x58a502);}(_0xfac5,0x96));var _0x5fac=function(_0x58d3d6,_0xe5a425){_0x58d3d6=_0x58d3d6-0x0;var _0x2d8115=_0xfac5[_0x58d3d6];return _0x2d8115;};'use strict';var Sequelize=require(_0x5fac('0x0'));module['exports']={'name':{'type':Sequelize[_0x5fac('0x1')]},'description':{'type':Sequelize[_0x5fac('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 1ff77f3..57bacb3 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 _0x6947=['api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','stack','name','send','map','DeskConfiguration','rawAttributes','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','rows','catch','show','include','create','body','find','params','destroy','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6947,0x18d));var _0x7694=function(_0x53a44d,_0x1f0574){_0x53a44d=_0x53a44d-0x0;var _0x23475e=_0x6947[_0x53a44d];return _0x23475e;};'use strict';var emlformat=require(_0x7694('0x0'));var rimraf=require(_0x7694('0x1'));var zipdir=require(_0x7694('0x2'));var jsonpatch=require(_0x7694('0x3'));var rp=require(_0x7694('0x4'));var moment=require('moment');var BPromise=require(_0x7694('0x5'));var Mustache=require('mustache');var util=require(_0x7694('0x6'));var path=require(_0x7694('0x7'));var sox=require(_0x7694('0x8'));var csv=require(_0x7694('0x9'));var ejs=require(_0x7694('0xa'));var fs=require('fs');var fs_extra=require(_0x7694('0xb'));var _=require('lodash');var squel=require(_0x7694('0xc'));var crypto=require(_0x7694('0xd'));var jsforce=require(_0x7694('0xe'));var deskjs=require(_0x7694('0xf'));var toCsv=require(_0x7694('0x9'));var querystring=require(_0x7694('0x10'));var Papa=require(_0x7694('0x11'));var Redis=require('ioredis');var authService=require(_0x7694('0x12'));var qs=require(_0x7694('0x13'));var as=require(_0x7694('0x14'));var hardwareService=require(_0x7694('0x15'));var logger=require(_0x7694('0x16'))(_0x7694('0x17'));var utils=require(_0x7694('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7694('0x19'));var db=require(_0x7694('0x1a'))['db'];function respondWithStatusCode(_0x527c88,_0x2917fa){_0x2917fa=_0x2917fa||0xcc;return function(_0x125780){if(_0x125780){return _0x527c88['sendStatus'](_0x2917fa);}return _0x527c88[_0x7694('0x1b')](_0x2917fa)[_0x7694('0x1c')]();};}function respondWithResult(_0xb31a3f,_0x1c522c){_0x1c522c=_0x1c522c||0xc8;return function(_0x40b2d8){if(_0x40b2d8){return _0xb31a3f[_0x7694('0x1b')](_0x1c522c)[_0x7694('0x1d')](_0x40b2d8);}};}function respondWithFilteredResult(_0x52d6cc,_0x2ed5a9){return function(_0x26f38c){if(_0x26f38c){var _0x3aa977=typeof _0x2ed5a9['offset']==='undefined'&&typeof _0x2ed5a9[_0x7694('0x1e')]==='undefined';var _0x162384=_0x26f38c[_0x7694('0x1f')];var _0x37fcb9=_0x3aa977?0x0:_0x2ed5a9[_0x7694('0x20')];var _0x55a178=_0x3aa977?_0x26f38c[_0x7694('0x1f')]:_0x2ed5a9[_0x7694('0x20')]+_0x2ed5a9[_0x7694('0x1e')];var _0x583e78;if(_0x55a178>=_0x162384){_0x55a178=_0x162384;_0x583e78=0xc8;}else{_0x583e78=0xce;}_0x52d6cc['status'](_0x583e78);return _0x52d6cc[_0x7694('0x21')](_0x7694('0x22'),_0x37fcb9+'-'+_0x55a178+'/'+_0x162384)['json'](_0x26f38c);}return null;};}function patchUpdates(_0x4aab1b){return function(_0x51b3ac){try{jsonpatch[_0x7694('0x23')](_0x51b3ac,_0x4aab1b,!![]);}catch(_0x266442){return BPromise[_0x7694('0x24')](_0x266442);}return _0x51b3ac[_0x7694('0x25')]();};}function saveUpdates(_0x1af527,_0x3317fc){return function(_0x117953){if(_0x117953){return _0x117953[_0x7694('0x26')](_0x1af527)['then'](function(_0x1698be){return _0x1698be;});}return null;};}function removeEntity(_0x503caf,_0x2b85e2){return function(_0x24f109){if(_0x24f109){return _0x24f109['destroy']()['then'](function(){_0x503caf[_0x7694('0x1b')](0xcc)[_0x7694('0x1c')]();});}};}function handleEntityNotFound(_0x3dd6f9,_0x4eb07d){return function(_0x5aa851){if(!_0x5aa851){_0x3dd6f9['sendStatus'](0x194);}return _0x5aa851;};}function handleError(_0x110b20,_0x554d6c){_0x554d6c=_0x554d6c||0x1f4;return function(_0x5d1e9){logger['error'](_0x5d1e9[_0x7694('0x27')]);if(_0x5d1e9['name']){delete _0x5d1e9[_0x7694('0x28')];}_0x110b20['status'](_0x554d6c)[_0x7694('0x29')](_0x5d1e9);};}exports['index']=function(_0xce54ad,_0x36667d){var _0xf3563e={},_0x728d99={},_0x8d28b8={'count':0x0,'rows':[]};var _0x189c2b=_[_0x7694('0x2a')](db[_0x7694('0x2b')][_0x7694('0x2c')],function(_0x4b58a2){return{'name':_0x4b58a2['fieldName'],'type':_0x4b58a2[_0x7694('0x2d')]['key']};});_0x728d99['model']=_[_0x7694('0x2a')](_0x189c2b,_0x7694('0x28'));_0x728d99[_0x7694('0x2e')]=_[_0x7694('0x2f')](_0xce54ad[_0x7694('0x2e')]);_0x728d99[_0x7694('0x30')]=_[_0x7694('0x31')](_0x728d99['model'],_0x728d99[_0x7694('0x2e')]);_0xf3563e[_0x7694('0x32')]=_[_0x7694('0x31')](_0x728d99[_0x7694('0x33')],qs[_0x7694('0x34')](_0xce54ad[_0x7694('0x2e')][_0x7694('0x34')]));_0xf3563e[_0x7694('0x32')]=_0xf3563e[_0x7694('0x32')][_0x7694('0x35')]?_0xf3563e['attributes']:_0x728d99[_0x7694('0x33')];if(!_0xce54ad[_0x7694('0x2e')][_0x7694('0x36')](_0x7694('0x37'))){_0xf3563e['limit']=qs[_0x7694('0x1e')](_0xce54ad['query'][_0x7694('0x1e')]);_0xf3563e[_0x7694('0x20')]=qs['offset'](_0xce54ad['query']['offset']);}_0xf3563e[_0x7694('0x38')]=qs[_0x7694('0x39')](_0xce54ad[_0x7694('0x2e')][_0x7694('0x39')]);_0xf3563e[_0x7694('0x3a')]=qs['filters'](_[_0x7694('0x3b')](_0xce54ad['query'],_0x728d99[_0x7694('0x30')]),_0x189c2b);if(_0xce54ad[_0x7694('0x2e')][_0x7694('0x3c')]){_0xf3563e[_0x7694('0x3a')]=_[_0x7694('0x3d')](_0xf3563e[_0x7694('0x3a')],{'$or':_[_0x7694('0x2a')](_0x189c2b,function(_0x2ef8ce){if(_0x2ef8ce[_0x7694('0x2d')]!==_0x7694('0x3e')){var _0x5908d9={};_0x5908d9[_0x2ef8ce['name']]={'$like':'%'+_0xce54ad[_0x7694('0x2e')][_0x7694('0x3c')]+'%'};return _0x5908d9;}})});}_0xf3563e=_[_0x7694('0x3d')]({},_0xf3563e,_0xce54ad[_0x7694('0x3f')]);var _0x458b4f={'where':_0xf3563e[_0x7694('0x3a')]};return db[_0x7694('0x2b')][_0x7694('0x1f')](_0x458b4f)[_0x7694('0x40')](function(_0x4e67e0){_0x8d28b8[_0x7694('0x1f')]=_0x4e67e0;if(_0xce54ad[_0x7694('0x2e')][_0x7694('0x41')]){_0xf3563e['include']=[{'all':!![]}];}return db[_0x7694('0x2b')]['findAll'](_0xf3563e);})[_0x7694('0x40')](function(_0x21dd7c){_0x8d28b8[_0x7694('0x42')]=_0x21dd7c;return _0x8d28b8;})[_0x7694('0x40')](respondWithFilteredResult(_0x36667d,_0xf3563e))[_0x7694('0x43')](handleError(_0x36667d,null));};exports[_0x7694('0x44')]=function(_0x56c6ae,_0x5de415){var _0xdda8f6={'raw':![],'where':{'id':_0x56c6ae['params']['id']}},_0x53654b={};_0x53654b[_0x7694('0x33')]=_['keys'](db[_0x7694('0x2b')]['rawAttributes']);_0x53654b['query']=_[_0x7694('0x2f')](_0x56c6ae[_0x7694('0x2e')]);_0x53654b['filters']=_['intersection'](_0x53654b[_0x7694('0x33')],_0x53654b[_0x7694('0x2e')]);_0xdda8f6[_0x7694('0x32')]=_[_0x7694('0x31')](_0x53654b[_0x7694('0x33')],qs[_0x7694('0x34')](_0x56c6ae[_0x7694('0x2e')][_0x7694('0x34')]));_0xdda8f6[_0x7694('0x32')]=_0xdda8f6[_0x7694('0x32')]['length']?_0xdda8f6[_0x7694('0x32')]:_0x53654b['model'];if(_0x56c6ae[_0x7694('0x2e')]['includeAll']){_0xdda8f6[_0x7694('0x45')]=[{'all':!![]}];}_0xdda8f6=_[_0x7694('0x3d')]({},_0xdda8f6,_0x56c6ae[_0x7694('0x3f')]);return db['DeskConfiguration']['find'](_0xdda8f6)['then'](handleEntityNotFound(_0x5de415,null))[_0x7694('0x40')](respondWithResult(_0x5de415,null))[_0x7694('0x43')](handleError(_0x5de415,null));};exports[_0x7694('0x46')]=function(_0x3c316b,_0x5eaed3){return db[_0x7694('0x2b')]['create'](_0x3c316b['body'],{})['then'](respondWithResult(_0x5eaed3,0xc9))[_0x7694('0x43')](handleError(_0x5eaed3,null));};exports[_0x7694('0x26')]=function(_0xb4ee0c,_0x17eec5){if(_0xb4ee0c[_0x7694('0x47')]['id']){delete _0xb4ee0c[_0x7694('0x47')]['id'];}return db[_0x7694('0x2b')][_0x7694('0x48')]({'where':{'id':_0xb4ee0c[_0x7694('0x49')]['id']}})['then'](handleEntityNotFound(_0x17eec5,null))[_0x7694('0x40')](saveUpdates(_0xb4ee0c[_0x7694('0x47')],null))['then'](respondWithResult(_0x17eec5,null))['catch'](handleError(_0x17eec5,null));};exports[_0x7694('0x4a')]=function(_0x2b7745,_0x16e705){return db[_0x7694('0x2b')][_0x7694('0x48')]({'where':{'id':_0x2b7745[_0x7694('0x49')]['id']}})['then'](handleEntityNotFound(_0x16e705,null))[_0x7694('0x40')](removeEntity(_0x16e705,null))[_0x7694('0x43')](handleError(_0x16e705,null));};exports[_0x7694('0x4b')]=function(_0x181af8,_0x4df63d,_0x1c2a92){var _0x30b5cd={};var _0x40b032={};var _0x5509e1;var _0x43b756;return db[_0x7694('0x2b')][_0x7694('0x4c')]({'where':{'id':_0x181af8[_0x7694('0x49')]['id']}})[_0x7694('0x40')](handleEntityNotFound(_0x4df63d,null))['then'](function(_0x113509){if(_0x113509){_0x5509e1=_0x113509;_0x40b032[_0x7694('0x33')]=_['keys'](db[_0x7694('0x4d')][_0x7694('0x2c')]);_0x40b032[_0x7694('0x2e')]=_[_0x7694('0x2f')](_0x181af8[_0x7694('0x2e')]);_0x40b032['filters']=_[_0x7694('0x31')](_0x40b032[_0x7694('0x33')],_0x40b032[_0x7694('0x2e')]);_0x30b5cd[_0x7694('0x32')]=_['intersection'](_0x40b032[_0x7694('0x33')],qs[_0x7694('0x34')](_0x181af8[_0x7694('0x2e')]['fields']));_0x30b5cd[_0x7694('0x32')]=_0x30b5cd[_0x7694('0x32')][_0x7694('0x35')]?_0x30b5cd[_0x7694('0x32')]:_0x40b032[_0x7694('0x33')];_0x30b5cd['order']=qs[_0x7694('0x39')](_0x181af8[_0x7694('0x2e')][_0x7694('0x39')]);_0x30b5cd['where']=qs[_0x7694('0x30')](_[_0x7694('0x3b')](_0x181af8['query'],_0x40b032['filters']));if(_0x181af8[_0x7694('0x2e')][_0x7694('0x3c')]){_0x30b5cd[_0x7694('0x3a')]=_[_0x7694('0x3d')](_0x30b5cd[_0x7694('0x3a')],{'$or':_[_0x7694('0x2a')](_0x30b5cd[_0x7694('0x32')],function(_0x4bf664){var _0x2aa8d3={};_0x2aa8d3[_0x4bf664]={'$like':'%'+_0x181af8[_0x7694('0x2e')][_0x7694('0x3c')]+'%'};return _0x2aa8d3;})});}_0x30b5cd=_['merge']({},_0x30b5cd,_0x181af8['options']);return _0x5509e1['getFields'](_0x30b5cd);}})[_0x7694('0x40')](function(_0x44f99e){if(_0x44f99e){_0x43b756=_0x44f99e['length'];if(!_0x181af8[_0x7694('0x2e')][_0x7694('0x36')]('nolimit')){_0x30b5cd[_0x7694('0x1e')]=qs[_0x7694('0x1e')](_0x181af8[_0x7694('0x2e')][_0x7694('0x1e')]);_0x30b5cd[_0x7694('0x20')]=qs[_0x7694('0x20')](_0x181af8['query'][_0x7694('0x20')]);}return _0x5509e1[_0x7694('0x4b')](_0x30b5cd);}})[_0x7694('0x40')](function(_0x3dd440){if(_0x3dd440){return _0x3dd440?{'count':_0x43b756,'rows':_0x3dd440}:null;}})[_0x7694('0x40')](respondWithResult(_0x4df63d,null))[_0x7694('0x43')](handleError(_0x4df63d,null));};exports[_0x7694('0x4e')]=function(_0x443273,_0x37e27b,_0x5bfac7){var _0x197c74={};var _0x595475={};var _0x3964b7;var _0x1d6435;return db['DeskConfiguration']['findOne']({'where':{'id':_0x443273[_0x7694('0x49')]['id']}})[_0x7694('0x40')](handleEntityNotFound(_0x37e27b,null))['then'](function(_0x2dfcaa){if(_0x2dfcaa){_0x3964b7=_0x2dfcaa;_0x595475[_0x7694('0x33')]=_[_0x7694('0x2f')](db[_0x7694('0x4d')][_0x7694('0x2c')]);_0x595475[_0x7694('0x2e')]=_['keys'](_0x443273['query']);_0x595475[_0x7694('0x30')]=_[_0x7694('0x31')](_0x595475[_0x7694('0x33')],_0x595475[_0x7694('0x2e')]);_0x197c74[_0x7694('0x32')]=_[_0x7694('0x31')](_0x595475[_0x7694('0x33')],qs[_0x7694('0x34')](_0x443273[_0x7694('0x2e')][_0x7694('0x34')]));_0x197c74[_0x7694('0x32')]=_0x197c74[_0x7694('0x32')][_0x7694('0x35')]?_0x197c74[_0x7694('0x32')]:_0x595475[_0x7694('0x33')];_0x197c74[_0x7694('0x38')]=qs[_0x7694('0x39')](_0x443273[_0x7694('0x2e')][_0x7694('0x39')]);_0x197c74[_0x7694('0x3a')]=qs[_0x7694('0x30')](_[_0x7694('0x3b')](_0x443273[_0x7694('0x2e')],_0x595475[_0x7694('0x30')]));if(_0x443273[_0x7694('0x2e')]['filter']){_0x197c74[_0x7694('0x3a')]=_[_0x7694('0x3d')](_0x197c74[_0x7694('0x3a')],{'$or':_[_0x7694('0x2a')](_0x197c74[_0x7694('0x32')],function(_0x2f6ade){var _0x171786={};_0x171786[_0x2f6ade]={'$like':'%'+_0x443273[_0x7694('0x2e')][_0x7694('0x3c')]+'%'};return _0x171786;})});}_0x197c74=_[_0x7694('0x3d')]({},_0x197c74,_0x443273['options']);return _0x3964b7['getSubjects'](_0x197c74);}})[_0x7694('0x40')](function(_0x10f7d2){if(_0x10f7d2){_0x1d6435=_0x10f7d2[_0x7694('0x35')];if(!_0x443273[_0x7694('0x2e')]['hasOwnProperty'](_0x7694('0x37'))){_0x197c74[_0x7694('0x1e')]=qs[_0x7694('0x1e')](_0x443273[_0x7694('0x2e')]['limit']);_0x197c74[_0x7694('0x20')]=qs[_0x7694('0x20')](_0x443273[_0x7694('0x2e')][_0x7694('0x20')]);}return _0x3964b7[_0x7694('0x4e')](_0x197c74);}})['then'](function(_0x54964f){if(_0x54964f){return _0x54964f?{'count':_0x1d6435,'rows':_0x54964f}:null;}})[_0x7694('0x40')](respondWithResult(_0x37e27b,null))[_0x7694('0x43')](handleError(_0x37e27b,null));};exports[_0x7694('0x4f')]=function(_0x533af3,_0x284b86,_0x37ea21){var _0x4debc9={};var _0x3cda2b={};var _0x277b70;var _0x3b74bc;return db[_0x7694('0x2b')][_0x7694('0x4c')]({'where':{'id':_0x533af3[_0x7694('0x49')]['id']}})[_0x7694('0x40')](handleEntityNotFound(_0x284b86,null))[_0x7694('0x40')](function(_0x1621fa){if(_0x1621fa){_0x277b70=_0x1621fa;_0x3cda2b[_0x7694('0x33')]=_[_0x7694('0x2f')](db[_0x7694('0x4d')][_0x7694('0x2c')]);_0x3cda2b[_0x7694('0x2e')]=_[_0x7694('0x2f')](_0x533af3[_0x7694('0x2e')]);_0x3cda2b[_0x7694('0x30')]=_['intersection'](_0x3cda2b['model'],_0x3cda2b['query']);_0x4debc9[_0x7694('0x32')]=_[_0x7694('0x31')](_0x3cda2b[_0x7694('0x33')],qs[_0x7694('0x34')](_0x533af3[_0x7694('0x2e')][_0x7694('0x34')]));_0x4debc9[_0x7694('0x32')]=_0x4debc9[_0x7694('0x32')][_0x7694('0x35')]?_0x4debc9[_0x7694('0x32')]:_0x3cda2b[_0x7694('0x33')];_0x4debc9['order']=qs[_0x7694('0x39')](_0x533af3[_0x7694('0x2e')][_0x7694('0x39')]);_0x4debc9[_0x7694('0x3a')]=qs[_0x7694('0x30')](_[_0x7694('0x3b')](_0x533af3[_0x7694('0x2e')],_0x3cda2b[_0x7694('0x30')]));if(_0x533af3[_0x7694('0x2e')][_0x7694('0x3c')]){_0x4debc9[_0x7694('0x3a')]=_['merge'](_0x4debc9['where'],{'$or':_[_0x7694('0x2a')](_0x4debc9['attributes'],function(_0x2e3e8c){var _0x3bd383={};_0x3bd383[_0x2e3e8c]={'$like':'%'+_0x533af3['query'][_0x7694('0x3c')]+'%'};return _0x3bd383;})});}_0x4debc9=_[_0x7694('0x3d')]({},_0x4debc9,_0x533af3[_0x7694('0x3f')]);return _0x277b70[_0x7694('0x4f')](_0x4debc9);}})[_0x7694('0x40')](function(_0x9008a){if(_0x9008a){_0x3b74bc=_0x9008a[_0x7694('0x35')];if(!_0x533af3[_0x7694('0x2e')][_0x7694('0x36')](_0x7694('0x37'))){_0x4debc9[_0x7694('0x1e')]=qs[_0x7694('0x1e')](_0x533af3[_0x7694('0x2e')][_0x7694('0x1e')]);_0x4debc9[_0x7694('0x20')]=qs[_0x7694('0x20')](_0x533af3[_0x7694('0x2e')]['offset']);}return _0x277b70[_0x7694('0x4f')](_0x4debc9);}})[_0x7694('0x40')](function(_0x417b0e){if(_0x417b0e){return _0x417b0e?{'count':_0x3b74bc,'rows':_0x417b0e}:null;}})[_0x7694('0x40')](respondWithResult(_0x284b86,null))['catch'](handleError(_0x284b86,null));};exports[_0x7694('0x50')]=function(_0x253e18,_0x159ee3,_0x10fe69){var _0x539519={};var _0x3e6bad={};var _0x22a9ab;var _0x2f60e5;return db[_0x7694('0x2b')][_0x7694('0x4c')]({'where':{'id':_0x253e18[_0x7694('0x49')]['id']}})[_0x7694('0x40')](handleEntityNotFound(_0x159ee3,null))['then'](function(_0x74e0ac){if(_0x74e0ac){_0x22a9ab=_0x74e0ac;_0x3e6bad[_0x7694('0x33')]=_[_0x7694('0x2f')](db[_0x7694('0x51')][_0x7694('0x2c')]);_0x3e6bad[_0x7694('0x2e')]=_[_0x7694('0x2f')](_0x253e18[_0x7694('0x2e')]);_0x3e6bad[_0x7694('0x30')]=_[_0x7694('0x31')](_0x3e6bad['model'],_0x3e6bad['query']);_0x539519[_0x7694('0x32')]=_[_0x7694('0x31')](_0x3e6bad[_0x7694('0x33')],qs[_0x7694('0x34')](_0x253e18['query']['fields']));_0x539519[_0x7694('0x32')]=_0x539519['attributes']['length']?_0x539519['attributes']:_0x3e6bad[_0x7694('0x33')];_0x539519[_0x7694('0x38')]=qs['sort'](_0x253e18[_0x7694('0x2e')][_0x7694('0x39')]);_0x539519[_0x7694('0x3a')]=qs['filters'](_[_0x7694('0x3b')](_0x253e18[_0x7694('0x2e')],_0x3e6bad[_0x7694('0x30')]));if(_0x253e18[_0x7694('0x2e')][_0x7694('0x3c')]){_0x539519['where']=_[_0x7694('0x3d')](_0x539519['where'],{'$or':_[_0x7694('0x2a')](_0x539519['attributes'],function(_0xa33ff5){var _0xcd29bb={};_0xcd29bb[_0xa33ff5]={'$like':'%'+_0x253e18[_0x7694('0x2e')][_0x7694('0x3c')]+'%'};return _0xcd29bb;})});}_0x539519=_[_0x7694('0x3d')]({},_0x539519,_0x253e18['options']);return _0x22a9ab[_0x7694('0x50')](_0x539519);}})[_0x7694('0x40')](function(_0x3eaba6){if(_0x3eaba6){_0x2f60e5=_0x3eaba6['length'];if(!_0x253e18[_0x7694('0x2e')]['hasOwnProperty'](_0x7694('0x37'))){_0x539519[_0x7694('0x1e')]=qs[_0x7694('0x1e')](_0x253e18['query'][_0x7694('0x1e')]);_0x539519[_0x7694('0x20')]=qs[_0x7694('0x20')](_0x253e18['query'][_0x7694('0x20')]);}return _0x22a9ab['getTags'](_0x539519);}})[_0x7694('0x40')](function(_0x5ee241){if(_0x5ee241){return _0x5ee241?{'count':_0x2f60e5,'rows':_0x5ee241}:null;}})[_0x7694('0x40')](respondWithResult(_0x159ee3,null))[_0x7694('0x43')](handleError(_0x159ee3,null));};exports[_0x7694('0x52')]=function(_0x3b139b,_0x22a5b3,_0x3fad41){if(_0x3b139b[_0x7694('0x47')]['id']){delete _0x3b139b[_0x7694('0x47')]['id'];}return db[_0x7694('0x2b')][_0x7694('0x4c')]({'where':{'id':_0x3b139b['params']['id']}})['then'](handleEntityNotFound(_0x22a5b3,null))[_0x7694('0x40')](function(_0x134570){if(_0x134570){return _0x134570['setTags'](_0x3b139b['body'][_0x7694('0x53')]||[]);}return null;})[_0x7694('0x40')](respondWithResult(_0x22a5b3,null))[_0x7694('0x43')](handleError(_0x22a5b3,null));}; \ No newline at end of file +var _0x9af1=['findAll','catch','show','params','rawAttributes','merge','create','body','update','find','getFields','findOne','pick','where','hasOwnProperty','getSubjects','DeskField','getDescriptions','getTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','offset','undefined','limit','count','json','apply','save','then','destroy','error','stack','name','index','map','DeskConfiguration','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','filter','type','VIRTUAL','options','includeAll','include'];(function(_0x3feccc,_0x5534c7){var _0x2c13b5=function(_0x59a2cd){while(--_0x59a2cd){_0x3feccc['push'](_0x3feccc['shift']());}};_0x2c13b5(++_0x5534c7);}(_0x9af1,0x1f4));var _0x19af=function(_0x11fa36,_0x4f52e5){_0x11fa36=_0x11fa36-0x0;var _0xe53680=_0x9af1[_0x11fa36];return _0xe53680;};'use strict';var emlformat=require(_0x19af('0x0'));var rimraf=require(_0x19af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x19af('0x2'));var rp=require(_0x19af('0x3'));var moment=require('moment');var BPromise=require(_0x19af('0x4'));var Mustache=require(_0x19af('0x5'));var util=require(_0x19af('0x6'));var path=require(_0x19af('0x7'));var sox=require(_0x19af('0x8'));var csv=require(_0x19af('0x9'));var ejs=require(_0x19af('0xa'));var fs=require('fs');var fs_extra=require(_0x19af('0xb'));var _=require(_0x19af('0xc'));var squel=require(_0x19af('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x19af('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x19af('0xf'));var Redis=require('ioredis');var authService=require(_0x19af('0x10'));var qs=require(_0x19af('0x11'));var as=require(_0x19af('0x12'));var hardwareService=require(_0x19af('0x13'));var logger=require(_0x19af('0x14'))(_0x19af('0x15'));var utils=require(_0x19af('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x71139d,_0x3a1008){_0x3a1008=_0x3a1008||0xcc;return function(_0x99c67){if(_0x99c67){return _0x71139d[_0x19af('0x17')](_0x3a1008);}return _0x71139d['status'](_0x3a1008)[_0x19af('0x18')]();};}function respondWithResult(_0x365269,_0x591e9a){_0x591e9a=_0x591e9a||0xc8;return function(_0x54090a){if(_0x54090a){return _0x365269[_0x19af('0x19')](_0x591e9a)['json'](_0x54090a);}};}function respondWithFilteredResult(_0x1a6571,_0x47fa1c){return function(_0x5a6f0e){if(_0x5a6f0e){var _0xef6c9b=typeof _0x47fa1c[_0x19af('0x1a')]===_0x19af('0x1b')&&typeof _0x47fa1c[_0x19af('0x1c')]===_0x19af('0x1b');var _0x5b1a44=_0x5a6f0e[_0x19af('0x1d')];var _0x4ae049=_0xef6c9b?0x0:_0x47fa1c[_0x19af('0x1a')];var _0x3e158c=_0xef6c9b?_0x5a6f0e[_0x19af('0x1d')]:_0x47fa1c[_0x19af('0x1a')]+_0x47fa1c['limit'];var _0x3efd72;if(_0x3e158c>=_0x5b1a44){_0x3e158c=_0x5b1a44;_0x3efd72=0xc8;}else{_0x3efd72=0xce;}_0x1a6571['status'](_0x3efd72);return _0x1a6571['set']('Content-Range',_0x4ae049+'-'+_0x3e158c+'/'+_0x5b1a44)[_0x19af('0x1e')](_0x5a6f0e);}return null;};}function patchUpdates(_0x520bf5){return function(_0x2cec05){try{jsonpatch[_0x19af('0x1f')](_0x2cec05,_0x520bf5,!![]);}catch(_0x135f39){return BPromise['reject'](_0x135f39);}return _0x2cec05[_0x19af('0x20')]();};}function saveUpdates(_0x429be9,_0x480c7a){return function(_0x3147d3){if(_0x3147d3){return _0x3147d3['update'](_0x429be9)[_0x19af('0x21')](function(_0x3bfab6){return _0x3bfab6;});}return null;};}function removeEntity(_0x4cb0fa,_0xaec293){return function(_0x166dde){if(_0x166dde){return _0x166dde[_0x19af('0x22')]()[_0x19af('0x21')](function(){_0x4cb0fa[_0x19af('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xefab4d,_0x42bbb0){return function(_0x4f5e95){if(!_0x4f5e95){_0xefab4d[_0x19af('0x17')](0x194);}return _0x4f5e95;};}function handleError(_0x44c3c5,_0x56728f){_0x56728f=_0x56728f||0x1f4;return function(_0x2905b2){logger[_0x19af('0x23')](_0x2905b2[_0x19af('0x24')]);if(_0x2905b2['name']){delete _0x2905b2[_0x19af('0x25')];}_0x44c3c5[_0x19af('0x19')](_0x56728f)['send'](_0x2905b2);};}exports[_0x19af('0x26')]=function(_0x13b841,_0x1d4401){var _0x28f55b={},_0x2ccdcc={},_0xff4897={'count':0x0,'rows':[]};var _0x57f9de=_[_0x19af('0x27')](db[_0x19af('0x28')]['rawAttributes'],function(_0x3e3e33){return{'name':_0x3e3e33[_0x19af('0x29')],'type':_0x3e3e33['type'][_0x19af('0x2a')]};});_0x2ccdcc[_0x19af('0x2b')]=_['map'](_0x57f9de,_0x19af('0x25'));_0x2ccdcc[_0x19af('0x2c')]=_[_0x19af('0x2d')](_0x13b841[_0x19af('0x2c')]);_0x2ccdcc[_0x19af('0x2e')]=_[_0x19af('0x2f')](_0x2ccdcc['model'],_0x2ccdcc['query']);_0x28f55b['attributes']=_['intersection'](_0x2ccdcc[_0x19af('0x2b')],qs[_0x19af('0x30')](_0x13b841['query'][_0x19af('0x30')]));_0x28f55b['attributes']=_0x28f55b[_0x19af('0x31')][_0x19af('0x32')]?_0x28f55b[_0x19af('0x31')]:_0x2ccdcc[_0x19af('0x2b')];if(!_0x13b841[_0x19af('0x2c')]['hasOwnProperty'](_0x19af('0x33'))){_0x28f55b['limit']=qs[_0x19af('0x1c')](_0x13b841[_0x19af('0x2c')][_0x19af('0x1c')]);_0x28f55b[_0x19af('0x1a')]=qs[_0x19af('0x1a')](_0x13b841[_0x19af('0x2c')]['offset']);}_0x28f55b[_0x19af('0x34')]=qs[_0x19af('0x35')](_0x13b841[_0x19af('0x2c')][_0x19af('0x35')]);_0x28f55b['where']=qs['filters'](_['pick'](_0x13b841[_0x19af('0x2c')],_0x2ccdcc[_0x19af('0x2e')]),_0x57f9de);if(_0x13b841[_0x19af('0x2c')][_0x19af('0x36')]){_0x28f55b['where']=_['merge'](_0x28f55b['where'],{'$or':_[_0x19af('0x27')](_0x57f9de,function(_0x591cfe){if(_0x591cfe[_0x19af('0x37')]!==_0x19af('0x38')){var _0x233688={};_0x233688[_0x591cfe['name']]={'$like':'%'+_0x13b841[_0x19af('0x2c')]['filter']+'%'};return _0x233688;}})});}_0x28f55b=_['merge']({},_0x28f55b,_0x13b841[_0x19af('0x39')]);var _0x223dc8={'where':_0x28f55b['where']};return db[_0x19af('0x28')][_0x19af('0x1d')](_0x223dc8)['then'](function(_0x49ada3){_0xff4897[_0x19af('0x1d')]=_0x49ada3;if(_0x13b841[_0x19af('0x2c')][_0x19af('0x3a')]){_0x28f55b[_0x19af('0x3b')]=[{'all':!![]}];}return db[_0x19af('0x28')][_0x19af('0x3c')](_0x28f55b);})[_0x19af('0x21')](function(_0x4afe04){_0xff4897['rows']=_0x4afe04;return _0xff4897;})[_0x19af('0x21')](respondWithFilteredResult(_0x1d4401,_0x28f55b))[_0x19af('0x3d')](handleError(_0x1d4401,null));};exports[_0x19af('0x3e')]=function(_0x476169,_0x24963d){var _0x44c414={'raw':![],'where':{'id':_0x476169[_0x19af('0x3f')]['id']}},_0x48d619={};_0x48d619['model']=_[_0x19af('0x2d')](db[_0x19af('0x28')][_0x19af('0x40')]);_0x48d619[_0x19af('0x2c')]=_[_0x19af('0x2d')](_0x476169[_0x19af('0x2c')]);_0x48d619['filters']=_[_0x19af('0x2f')](_0x48d619[_0x19af('0x2b')],_0x48d619['query']);_0x44c414[_0x19af('0x31')]=_[_0x19af('0x2f')](_0x48d619[_0x19af('0x2b')],qs[_0x19af('0x30')](_0x476169[_0x19af('0x2c')]['fields']));_0x44c414[_0x19af('0x31')]=_0x44c414[_0x19af('0x31')][_0x19af('0x32')]?_0x44c414[_0x19af('0x31')]:_0x48d619[_0x19af('0x2b')];if(_0x476169[_0x19af('0x2c')]['includeAll']){_0x44c414[_0x19af('0x3b')]=[{'all':!![]}];}_0x44c414=_[_0x19af('0x41')]({},_0x44c414,_0x476169[_0x19af('0x39')]);return db[_0x19af('0x28')]['find'](_0x44c414)[_0x19af('0x21')](handleEntityNotFound(_0x24963d,null))[_0x19af('0x21')](respondWithResult(_0x24963d,null))[_0x19af('0x3d')](handleError(_0x24963d,null));};exports[_0x19af('0x42')]=function(_0x5d2c5b,_0x9db37f){return db[_0x19af('0x28')][_0x19af('0x42')](_0x5d2c5b[_0x19af('0x43')],{})[_0x19af('0x21')](respondWithResult(_0x9db37f,0xc9))[_0x19af('0x3d')](handleError(_0x9db37f,null));};exports[_0x19af('0x44')]=function(_0x2556ff,_0x307352){if(_0x2556ff[_0x19af('0x43')]['id']){delete _0x2556ff[_0x19af('0x43')]['id'];}return db['DeskConfiguration'][_0x19af('0x45')]({'where':{'id':_0x2556ff[_0x19af('0x3f')]['id']}})['then'](handleEntityNotFound(_0x307352,null))['then'](saveUpdates(_0x2556ff[_0x19af('0x43')],null))[_0x19af('0x21')](respondWithResult(_0x307352,null))['catch'](handleError(_0x307352,null));};exports[_0x19af('0x22')]=function(_0x1c59e6,_0x1db834){return db['DeskConfiguration'][_0x19af('0x45')]({'where':{'id':_0x1c59e6[_0x19af('0x3f')]['id']}})[_0x19af('0x21')](handleEntityNotFound(_0x1db834,null))[_0x19af('0x21')](removeEntity(_0x1db834,null))[_0x19af('0x3d')](handleError(_0x1db834,null));};exports[_0x19af('0x46')]=function(_0x5a19e4,_0x3f388c,_0x200b9a){var _0x3fa382={};var _0x15d33d={};var _0x5c1a6b;var _0x430feb;return db['DeskConfiguration'][_0x19af('0x47')]({'where':{'id':_0x5a19e4[_0x19af('0x3f')]['id']}})[_0x19af('0x21')](handleEntityNotFound(_0x3f388c,null))[_0x19af('0x21')](function(_0x4f261d){if(_0x4f261d){_0x5c1a6b=_0x4f261d;_0x15d33d[_0x19af('0x2b')]=_[_0x19af('0x2d')](db['DeskField'][_0x19af('0x40')]);_0x15d33d[_0x19af('0x2c')]=_[_0x19af('0x2d')](_0x5a19e4[_0x19af('0x2c')]);_0x15d33d[_0x19af('0x2e')]=_['intersection'](_0x15d33d['model'],_0x15d33d[_0x19af('0x2c')]);_0x3fa382[_0x19af('0x31')]=_['intersection'](_0x15d33d[_0x19af('0x2b')],qs[_0x19af('0x30')](_0x5a19e4[_0x19af('0x2c')][_0x19af('0x30')]));_0x3fa382[_0x19af('0x31')]=_0x3fa382['attributes']['length']?_0x3fa382[_0x19af('0x31')]:_0x15d33d[_0x19af('0x2b')];_0x3fa382[_0x19af('0x34')]=qs[_0x19af('0x35')](_0x5a19e4[_0x19af('0x2c')][_0x19af('0x35')]);_0x3fa382['where']=qs['filters'](_[_0x19af('0x48')](_0x5a19e4[_0x19af('0x2c')],_0x15d33d[_0x19af('0x2e')]));if(_0x5a19e4[_0x19af('0x2c')][_0x19af('0x36')]){_0x3fa382[_0x19af('0x49')]=_['merge'](_0x3fa382[_0x19af('0x49')],{'$or':_[_0x19af('0x27')](_0x3fa382['attributes'],function(_0x5c2048){var _0xc08a1b={};_0xc08a1b[_0x5c2048]={'$like':'%'+_0x5a19e4[_0x19af('0x2c')][_0x19af('0x36')]+'%'};return _0xc08a1b;})});}_0x3fa382=_[_0x19af('0x41')]({},_0x3fa382,_0x5a19e4[_0x19af('0x39')]);return _0x5c1a6b[_0x19af('0x46')](_0x3fa382);}})['then'](function(_0x10e957){if(_0x10e957){_0x430feb=_0x10e957['length'];if(!_0x5a19e4[_0x19af('0x2c')][_0x19af('0x4a')]('nolimit')){_0x3fa382[_0x19af('0x1c')]=qs['limit'](_0x5a19e4[_0x19af('0x2c')][_0x19af('0x1c')]);_0x3fa382[_0x19af('0x1a')]=qs[_0x19af('0x1a')](_0x5a19e4[_0x19af('0x2c')][_0x19af('0x1a')]);}return _0x5c1a6b[_0x19af('0x46')](_0x3fa382);}})[_0x19af('0x21')](function(_0x2361b8){if(_0x2361b8){return _0x2361b8?{'count':_0x430feb,'rows':_0x2361b8}:null;}})[_0x19af('0x21')](respondWithResult(_0x3f388c,null))[_0x19af('0x3d')](handleError(_0x3f388c,null));};exports[_0x19af('0x4b')]=function(_0x36d157,_0x2ca4ff,_0x2fecc2){var _0x4b4625={};var _0x534a37={};var _0x15d8b1;var _0x4ac9db;return db[_0x19af('0x28')]['findOne']({'where':{'id':_0x36d157[_0x19af('0x3f')]['id']}})[_0x19af('0x21')](handleEntityNotFound(_0x2ca4ff,null))[_0x19af('0x21')](function(_0x2a4341){if(_0x2a4341){_0x15d8b1=_0x2a4341;_0x534a37[_0x19af('0x2b')]=_[_0x19af('0x2d')](db[_0x19af('0x4c')][_0x19af('0x40')]);_0x534a37['query']=_[_0x19af('0x2d')](_0x36d157['query']);_0x534a37[_0x19af('0x2e')]=_[_0x19af('0x2f')](_0x534a37[_0x19af('0x2b')],_0x534a37[_0x19af('0x2c')]);_0x4b4625['attributes']=_['intersection'](_0x534a37['model'],qs[_0x19af('0x30')](_0x36d157[_0x19af('0x2c')][_0x19af('0x30')]));_0x4b4625['attributes']=_0x4b4625[_0x19af('0x31')]['length']?_0x4b4625[_0x19af('0x31')]:_0x534a37[_0x19af('0x2b')];_0x4b4625['order']=qs[_0x19af('0x35')](_0x36d157['query'][_0x19af('0x35')]);_0x4b4625[_0x19af('0x49')]=qs[_0x19af('0x2e')](_[_0x19af('0x48')](_0x36d157[_0x19af('0x2c')],_0x534a37[_0x19af('0x2e')]));if(_0x36d157[_0x19af('0x2c')][_0x19af('0x36')]){_0x4b4625['where']=_[_0x19af('0x41')](_0x4b4625[_0x19af('0x49')],{'$or':_['map'](_0x4b4625[_0x19af('0x31')],function(_0x5b208e){var _0x5da4f6={};_0x5da4f6[_0x5b208e]={'$like':'%'+_0x36d157[_0x19af('0x2c')][_0x19af('0x36')]+'%'};return _0x5da4f6;})});}_0x4b4625=_[_0x19af('0x41')]({},_0x4b4625,_0x36d157[_0x19af('0x39')]);return _0x15d8b1['getSubjects'](_0x4b4625);}})['then'](function(_0x1f755f){if(_0x1f755f){_0x4ac9db=_0x1f755f[_0x19af('0x32')];if(!_0x36d157[_0x19af('0x2c')][_0x19af('0x4a')](_0x19af('0x33'))){_0x4b4625['limit']=qs[_0x19af('0x1c')](_0x36d157[_0x19af('0x2c')][_0x19af('0x1c')]);_0x4b4625['offset']=qs[_0x19af('0x1a')](_0x36d157['query']['offset']);}return _0x15d8b1[_0x19af('0x4b')](_0x4b4625);}})['then'](function(_0x25698d){if(_0x25698d){return _0x25698d?{'count':_0x4ac9db,'rows':_0x25698d}:null;}})[_0x19af('0x21')](respondWithResult(_0x2ca4ff,null))[_0x19af('0x3d')](handleError(_0x2ca4ff,null));};exports[_0x19af('0x4d')]=function(_0x236774,_0x22d465,_0x22e1cf){var _0x250667={};var _0x9fd45e={};var _0x4c79ee;var _0x68423b;return db[_0x19af('0x28')][_0x19af('0x47')]({'where':{'id':_0x236774[_0x19af('0x3f')]['id']}})[_0x19af('0x21')](handleEntityNotFound(_0x22d465,null))[_0x19af('0x21')](function(_0x5e7ba2){if(_0x5e7ba2){_0x4c79ee=_0x5e7ba2;_0x9fd45e['model']=_['keys'](db['DeskField'][_0x19af('0x40')]);_0x9fd45e[_0x19af('0x2c')]=_[_0x19af('0x2d')](_0x236774['query']);_0x9fd45e[_0x19af('0x2e')]=_[_0x19af('0x2f')](_0x9fd45e['model'],_0x9fd45e[_0x19af('0x2c')]);_0x250667[_0x19af('0x31')]=_[_0x19af('0x2f')](_0x9fd45e[_0x19af('0x2b')],qs['fields'](_0x236774['query'][_0x19af('0x30')]));_0x250667['attributes']=_0x250667['attributes'][_0x19af('0x32')]?_0x250667[_0x19af('0x31')]:_0x9fd45e['model'];_0x250667[_0x19af('0x34')]=qs[_0x19af('0x35')](_0x236774[_0x19af('0x2c')][_0x19af('0x35')]);_0x250667[_0x19af('0x49')]=qs[_0x19af('0x2e')](_[_0x19af('0x48')](_0x236774['query'],_0x9fd45e[_0x19af('0x2e')]));if(_0x236774[_0x19af('0x2c')][_0x19af('0x36')]){_0x250667[_0x19af('0x49')]=_['merge'](_0x250667[_0x19af('0x49')],{'$or':_['map'](_0x250667['attributes'],function(_0x53a8f2){var _0x688e8a={};_0x688e8a[_0x53a8f2]={'$like':'%'+_0x236774['query']['filter']+'%'};return _0x688e8a;})});}_0x250667=_[_0x19af('0x41')]({},_0x250667,_0x236774[_0x19af('0x39')]);return _0x4c79ee['getDescriptions'](_0x250667);}})[_0x19af('0x21')](function(_0x4edc7a){if(_0x4edc7a){_0x68423b=_0x4edc7a[_0x19af('0x32')];if(!_0x236774[_0x19af('0x2c')][_0x19af('0x4a')]('nolimit')){_0x250667[_0x19af('0x1c')]=qs[_0x19af('0x1c')](_0x236774[_0x19af('0x2c')][_0x19af('0x1c')]);_0x250667[_0x19af('0x1a')]=qs[_0x19af('0x1a')](_0x236774[_0x19af('0x2c')][_0x19af('0x1a')]);}return _0x4c79ee['getDescriptions'](_0x250667);}})[_0x19af('0x21')](function(_0x305547){if(_0x305547){return _0x305547?{'count':_0x68423b,'rows':_0x305547}:null;}})[_0x19af('0x21')](respondWithResult(_0x22d465,null))[_0x19af('0x3d')](handleError(_0x22d465,null));};exports['getTags']=function(_0x164f60,_0xf931f5,_0x4b66cd){var _0x540ba4={};var _0x85a830={};var _0x4de516;var _0x3785ba;return db[_0x19af('0x28')][_0x19af('0x47')]({'where':{'id':_0x164f60['params']['id']}})['then'](handleEntityNotFound(_0xf931f5,null))[_0x19af('0x21')](function(_0x5d0a90){if(_0x5d0a90){_0x4de516=_0x5d0a90;_0x85a830[_0x19af('0x2b')]=_[_0x19af('0x2d')](db['Tag'][_0x19af('0x40')]);_0x85a830['query']=_['keys'](_0x164f60[_0x19af('0x2c')]);_0x85a830[_0x19af('0x2e')]=_['intersection'](_0x85a830[_0x19af('0x2b')],_0x85a830['query']);_0x540ba4['attributes']=_[_0x19af('0x2f')](_0x85a830['model'],qs[_0x19af('0x30')](_0x164f60[_0x19af('0x2c')][_0x19af('0x30')]));_0x540ba4[_0x19af('0x31')]=_0x540ba4[_0x19af('0x31')]['length']?_0x540ba4[_0x19af('0x31')]:_0x85a830['model'];_0x540ba4[_0x19af('0x34')]=qs[_0x19af('0x35')](_0x164f60['query'][_0x19af('0x35')]);_0x540ba4[_0x19af('0x49')]=qs['filters'](_[_0x19af('0x48')](_0x164f60['query'],_0x85a830[_0x19af('0x2e')]));if(_0x164f60[_0x19af('0x2c')][_0x19af('0x36')]){_0x540ba4[_0x19af('0x49')]=_[_0x19af('0x41')](_0x540ba4[_0x19af('0x49')],{'$or':_[_0x19af('0x27')](_0x540ba4[_0x19af('0x31')],function(_0x256525){var _0x1bad9b={};_0x1bad9b[_0x256525]={'$like':'%'+_0x164f60[_0x19af('0x2c')][_0x19af('0x36')]+'%'};return _0x1bad9b;})});}_0x540ba4=_[_0x19af('0x41')]({},_0x540ba4,_0x164f60['options']);return _0x4de516[_0x19af('0x4e')](_0x540ba4);}})[_0x19af('0x21')](function(_0xf06d9){if(_0xf06d9){_0x3785ba=_0xf06d9[_0x19af('0x32')];if(!_0x164f60[_0x19af('0x2c')][_0x19af('0x4a')](_0x19af('0x33'))){_0x540ba4[_0x19af('0x1c')]=qs['limit'](_0x164f60['query'][_0x19af('0x1c')]);_0x540ba4['offset']=qs[_0x19af('0x1a')](_0x164f60[_0x19af('0x2c')][_0x19af('0x1a')]);}return _0x4de516['getTags'](_0x540ba4);}})[_0x19af('0x21')](function(_0x33fefc){if(_0x33fefc){return _0x33fefc?{'count':_0x3785ba,'rows':_0x33fefc}:null;}})[_0x19af('0x21')](respondWithResult(_0xf931f5,null))[_0x19af('0x3d')](handleError(_0xf931f5,null));};exports['setTags']=function(_0x1e0019,_0x4f9021,_0x5bab31){if(_0x1e0019[_0x19af('0x43')]['id']){delete _0x1e0019['body']['id'];}return db[_0x19af('0x28')]['findOne']({'where':{'id':_0x1e0019['params']['id']}})[_0x19af('0x21')](handleEntityNotFound(_0x4f9021,null))[_0x19af('0x21')](function(_0x30501e){if(_0x30501e){return _0x30501e['setTags'](_0x1e0019[_0x19af('0x43')][_0x19af('0x4f')]||[]);}return null;})[_0x19af('0x21')](respondWithResult(_0x4f9021,null))[_0x19af('0x3d')](handleError(_0x4f9021,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 967b7e2..946e8ef 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 _0xc54e=['DeskConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intDeskConfiguration.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc54e,0x17d));var _0xec54=function(_0x21e97b,_0x65a77f){_0x21e97b=_0x21e97b-0x0;var _0x10ba44=_0xc54e[_0x21e97b];return _0x10ba44;};'use strict';var _=require(_0xec54('0x0'));var util=require('util');var logger=require(_0xec54('0x1'))(_0xec54('0x2'));var moment=require(_0xec54('0x3'));var BPromise=require(_0xec54('0x4'));var rp=require(_0xec54('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xec54('0x6'));var attributes=require(_0xec54('0x7'));module['exports']=function(_0xa88063,_0x48d41f){return _0xa88063[_0xec54('0x8')](_0xec54('0x9'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97b5=['int_desk_configurations','util','api','bluebird','request-promise','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration'];(function(_0x1008df,_0x445434){var _0x254da2=function(_0x46719e){while(--_0x46719e){_0x1008df['push'](_0x1008df['shift']());}};_0x254da2(++_0x445434);}(_0x97b5,0x137));var _0x597b=function(_0x2e6e12,_0x238fc4){_0x2e6e12=_0x2e6e12-0x0;var _0x4bebf6=_0x97b5[_0x2e6e12];return _0x4bebf6;};'use strict';var _=require('lodash');var util=require(_0x597b('0x0'));var logger=require('../../config/logger')(_0x597b('0x1'));var moment=require('moment');var BPromise=require(_0x597b('0x2'));var rp=require(_0x597b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x597b('0x4'));var config=require('../../config/environment');var attributes=require(_0x597b('0x5'));module[_0x597b('0x6')]=function(_0xa0e390,_0x1383d8){return _0xa0e390[_0x597b('0x7')](_0x597b('0x8'),attributes,{'tableName':_0x597b('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 ad18a02..5590718 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 _0x47cb=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x2cc1f2,_0x196c41){var _0x359e38=function(_0x438344){while(--_0x438344){_0x2cc1f2['push'](_0x2cc1f2['shift']());}};_0x359e38(++_0x196c41);}(_0x47cb,0x74));var _0xb47c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x47cb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb47c('0x0'));var util=require(_0xb47c('0x1'));var moment=require(_0xb47c('0x2'));var BPromise=require(_0xb47c('0x3'));var rs=require(_0xb47c('0x4'));var fs=require('fs');var Redis=require(_0xb47c('0x5'));var db=require(_0xb47c('0x6'))['db'];var utils=require(_0xb47c('0x7'));var logger=require('../../config/logger')(_0xb47c('0x8'));var config=require(_0xb47c('0x9'));var jayson=require(_0xb47c('0xa'));var client=jayson[_0xb47c('0xb')][_0xb47c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb61195,_0x341cce,_0x1234b5){return new BPromise(function(_0x2f25ac,_0x3fe803){return client[_0xb47c('0xd')](_0xb61195,_0x1234b5)[_0xb47c('0xe')](function(_0x126b1f){logger[_0xb47c('0xf')](_0xb47c('0x10'),_0x341cce,'request\x20sent');logger[_0xb47c('0x11')](_0xb47c('0x12'),_0x341cce,_0xb47c('0x13'),JSON['stringify'](_0x126b1f));if(_0x126b1f[_0xb47c('0x14')]){if(_0x126b1f[_0xb47c('0x14')]['code']===0x1f4){logger[_0xb47c('0x14')](_0xb47c('0x10'),_0x341cce,_0x126b1f[_0xb47c('0x14')]['message']);return _0x3fe803(_0x126b1f[_0xb47c('0x14')][_0xb47c('0x15')]);}logger[_0xb47c('0x14')](_0xb47c('0x10'),_0x341cce,_0x126b1f[_0xb47c('0x14')][_0xb47c('0x15')]);return _0x2f25ac(_0x126b1f[_0xb47c('0x14')][_0xb47c('0x15')]);}else{logger[_0xb47c('0xf')](_0xb47c('0x10'),_0x341cce,_0xb47c('0x13'));_0x2f25ac(_0x126b1f['result'][_0xb47c('0x15')]);}})[_0xb47c('0x16')](function(_0xc8c2a8){logger['error'](_0xb47c('0x10'),_0x341cce,_0xc8c2a8);_0x3fe803(_0xc8c2a8);});});} \ No newline at end of file +var _0xd232=['then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','request'];(function(_0xae5d38,_0x44c280){var _0x16c206=function(_0x2f5b35){while(--_0x2f5b35){_0xae5d38['push'](_0xae5d38['shift']());}};_0x16c206(++_0x44c280);}(_0xd232,0x74));var _0x2d23=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd232[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2d23('0x0'));var util=require('util');var moment=require(_0x2d23('0x1'));var BPromise=require(_0x2d23('0x2'));var rs=require(_0x2d23('0x3'));var fs=require('fs');var Redis=require(_0x2d23('0x4'));var db=require(_0x2d23('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2d23('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2d23('0x7')][_0x2d23('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15c735,_0x53ac18,_0x18cac8){return new BPromise(function(_0x4cf7f4,_0x2c4667){return client[_0x2d23('0x9')](_0x15c735,_0x18cac8)[_0x2d23('0xa')](function(_0x7847cb){logger[_0x2d23('0xb')](_0x2d23('0xc'),_0x53ac18,_0x2d23('0xd'));logger['debug'](_0x2d23('0xe'),_0x53ac18,_0x2d23('0xd'),JSON[_0x2d23('0xf')](_0x7847cb));if(_0x7847cb[_0x2d23('0x10')]){if(_0x7847cb[_0x2d23('0x10')][_0x2d23('0x11')]===0x1f4){logger[_0x2d23('0x10')](_0x2d23('0xc'),_0x53ac18,_0x7847cb[_0x2d23('0x10')][_0x2d23('0x12')]);return _0x2c4667(_0x7847cb[_0x2d23('0x10')][_0x2d23('0x12')]);}logger['error'](_0x2d23('0xc'),_0x53ac18,_0x7847cb[_0x2d23('0x10')][_0x2d23('0x12')]);return _0x4cf7f4(_0x7847cb[_0x2d23('0x10')][_0x2d23('0x12')]);}else{logger['info'](_0x2d23('0xc'),_0x53ac18,'request\x20sent');_0x4cf7f4(_0x7847cb[_0x2d23('0x13')]['message']);}})[_0x2d23('0x14')](function(_0x30b578){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x53ac18,_0x30b578);_0x2c4667(_0x30b578);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 4e96567..9a0e707 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 _0x1856=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','index','get','/:id','isAuthenticated','post','create','put','delete','multer','connect-timeout'];(function(_0x5f21d5,_0x18caf4){var _0x5866ad=function(_0x21da19){while(--_0x21da19){_0x5f21d5['push'](_0x5f21d5['shift']());}};_0x5866ad(++_0x18caf4);}(_0x1856,0x185));var _0x6185=function(_0x7a17be,_0x2d6d11){_0x7a17be=_0x7a17be-0x0;var _0x10b54d=_0x1856[_0x7a17be];return _0x10b54d;};'use strict';var multer=require(_0x6185('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6185('0x1'));var express=require(_0x6185('0x2'));var router=express[_0x6185('0x3')]();var fs_extra=require(_0x6185('0x4'));var auth=require(_0x6185('0x5'));var interaction=require(_0x6185('0x6'));var config=require(_0x6185('0x7'));var controller=require(_0x6185('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6185('0x9')]);router[_0x6185('0xa')](_0x6185('0xb'),auth[_0x6185('0xc')](),controller['show']);router[_0x6185('0xd')]('/',auth['isAuthenticated'](),controller[_0x6185('0xe')]);router[_0x6185('0xf')](_0x6185('0xb'),auth[_0x6185('0xc')](),controller['update']);router[_0x6185('0x10')](_0x6185('0xb'),auth[_0x6185('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3391=['show','post','create','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','isAuthenticated','index'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x3391,0x13f));var _0x1339=function(_0x37bc55,_0x515211){_0x37bc55=_0x37bc55-0x0;var _0x56e554=_0x3391[_0x37bc55];return _0x56e554;};'use strict';var multer=require('multer');var util=require(_0x1339('0x0'));var path=require(_0x1339('0x1'));var timeout=require(_0x1339('0x2'));var express=require(_0x1339('0x3'));var router=express[_0x1339('0x4')]();var fs_extra=require(_0x1339('0x5'));var auth=require(_0x1339('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1339('0x7'));var controller=require(_0x1339('0x8'));router['get']('/',auth[_0x1339('0x9')](),controller[_0x1339('0xa')]);router['get']('/:id',auth[_0x1339('0x9')](),controller[_0x1339('0xb')]);router[_0x1339('0xc')]('/',auth[_0x1339('0x9')](),controller[_0x1339('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1339('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 828be73..2c3d1d6 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 _0xb0ad=['variable','BOOLEAN','sequelize','ENUM','customVariable','keyValue','picklist','string','STRING'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xb0ad,0x92));var _0xdb0a=function(_0x2c1141,_0xda272d){_0x2c1141=_0x2c1141-0x0;var _0x48d7db=_0xb0ad[_0x2c1141];return _0x48d7db;};'use strict';var Sequelize=require(_0xdb0a('0x0'));module['exports']={'type':{'type':Sequelize[_0xdb0a('0x1')]('string','variable',_0xdb0a('0x2'),_0xdb0a('0x3'),_0xdb0a('0x4')),'defaultValue':_0xdb0a('0x5')},'content':{'type':Sequelize[_0xdb0a('0x6')]},'key':{'type':Sequelize[_0xdb0a('0x6')]},'keyType':{'type':Sequelize[_0xdb0a('0x1')]('string',_0xdb0a('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xdb0a('0x6')]},'nameField':{'type':Sequelize[_0xdb0a('0x6')]},'customField':{'type':Sequelize[_0xdb0a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdb0a('0x6')]}}; \ No newline at end of file +var _0x3692=['keyValue','picklist','string','STRING','sequelize','exports','ENUM','variable','customVariable'];(function(_0x3e4bd5,_0x1191df){var _0x261d71=function(_0x9f1a84){while(--_0x9f1a84){_0x3e4bd5['push'](_0x3e4bd5['shift']());}};_0x261d71(++_0x1191df);}(_0x3692,0x109));var _0x2369=function(_0x24af20,_0xb1b03b){_0x24af20=_0x24af20-0x0;var _0x20bbc5=_0x3692[_0x24af20];return _0x20bbc5;};'use strict';var Sequelize=require(_0x2369('0x0'));module[_0x2369('0x1')]={'type':{'type':Sequelize[_0x2369('0x2')]('string',_0x2369('0x3'),_0x2369('0x4'),_0x2369('0x5'),_0x2369('0x6')),'defaultValue':_0x2369('0x7')},'content':{'type':Sequelize[_0x2369('0x8')]},'key':{'type':Sequelize[_0x2369('0x8')]},'keyType':{'type':Sequelize[_0x2369('0x2')](_0x2369('0x7'),'variable',_0x2369('0x4'))},'keyContent':{'type':Sequelize[_0x2369('0x8')]},'idField':{'type':Sequelize[_0x2369('0x8')]},'nameField':{'type':Sequelize[_0x2369('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2369('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index fdad8c9..e701587 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 _0xf966=['merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','DeskField','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','filter','where'];(function(_0x122917,_0x33b189){var _0x58e067=function(_0x503082){while(--_0x503082){_0x122917['push'](_0x122917['shift']());}};_0x58e067(++_0x33b189);}(_0xf966,0x184));var _0x6f96=function(_0x33d970,_0x35281a){_0x33d970=_0x33d970-0x0;var _0x3efb37=_0xf966[_0x33d970];return _0x3efb37;};'use strict';var emlformat=require(_0x6f96('0x0'));var rimraf=require(_0x6f96('0x1'));var zipdir=require(_0x6f96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f96('0x3'));var moment=require(_0x6f96('0x4'));var BPromise=require(_0x6f96('0x5'));var Mustache=require('mustache');var util=require(_0x6f96('0x6'));var path=require(_0x6f96('0x7'));var sox=require(_0x6f96('0x8'));var csv=require('to-csv');var ejs=require(_0x6f96('0x9'));var fs=require('fs');var fs_extra=require(_0x6f96('0xa'));var _=require(_0x6f96('0xb'));var squel=require(_0x6f96('0xc'));var crypto=require(_0x6f96('0xd'));var jsforce=require(_0x6f96('0xe'));var deskjs=require(_0x6f96('0xf'));var toCsv=require(_0x6f96('0x10'));var querystring=require(_0x6f96('0x11'));var Papa=require(_0x6f96('0x12'));var Redis=require(_0x6f96('0x13'));var authService=require(_0x6f96('0x14'));var qs=require(_0x6f96('0x15'));var as=require(_0x6f96('0x16'));var hardwareService=require(_0x6f96('0x17'));var logger=require('../../config/logger')(_0x6f96('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6f96('0x19'));var db=require(_0x6f96('0x1a'))['db'];function respondWithStatusCode(_0x58cc34,_0x30f125){_0x30f125=_0x30f125||0xcc;return function(_0x126b6a){if(_0x126b6a){return _0x58cc34[_0x6f96('0x1b')](_0x30f125);}return _0x58cc34[_0x6f96('0x1c')](_0x30f125)[_0x6f96('0x1d')]();};}function respondWithResult(_0x3f8950,_0x169c55){_0x169c55=_0x169c55||0xc8;return function(_0x1e2467){if(_0x1e2467){return _0x3f8950['status'](_0x169c55)[_0x6f96('0x1e')](_0x1e2467);}};}function respondWithFilteredResult(_0xb1ff4,_0x5a5602){return function(_0x203054){if(_0x203054){var _0x2cd321=typeof _0x5a5602['offset']==='undefined'&&typeof _0x5a5602[_0x6f96('0x1f')]===_0x6f96('0x20');var _0x130de4=_0x203054['count'];var _0x421e59=_0x2cd321?0x0:_0x5a5602['offset'];var _0x19cd18=_0x2cd321?_0x203054[_0x6f96('0x21')]:_0x5a5602['offset']+_0x5a5602['limit'];var _0x75c2db;if(_0x19cd18>=_0x130de4){_0x19cd18=_0x130de4;_0x75c2db=0xc8;}else{_0x75c2db=0xce;}_0xb1ff4[_0x6f96('0x1c')](_0x75c2db);return _0xb1ff4['set'](_0x6f96('0x22'),_0x421e59+'-'+_0x19cd18+'/'+_0x130de4)['json'](_0x203054);}return null;};}function patchUpdates(_0x3e3f51){return function(_0x16d62a){try{jsonpatch[_0x6f96('0x23')](_0x16d62a,_0x3e3f51,!![]);}catch(_0x2515ca){return BPromise[_0x6f96('0x24')](_0x2515ca);}return _0x16d62a['save']();};}function saveUpdates(_0x1d8dc7,_0x5ec160){return function(_0x46d79b){if(_0x46d79b){return _0x46d79b[_0x6f96('0x25')](_0x1d8dc7)['then'](function(_0xa12c3b){return _0xa12c3b;});}return null;};}function removeEntity(_0x5482c8,_0x280a55){return function(_0x45c1c2){if(_0x45c1c2){return _0x45c1c2[_0x6f96('0x26')]()[_0x6f96('0x27')](function(){_0x5482c8[_0x6f96('0x1c')](0xcc)[_0x6f96('0x1d')]();});}};}function handleEntityNotFound(_0x475ee9,_0xc91322){return function(_0x3a5f09){if(!_0x3a5f09){_0x475ee9['sendStatus'](0x194);}return _0x3a5f09;};}function handleError(_0x3329a2,_0xe3cf23){_0xe3cf23=_0xe3cf23||0x1f4;return function(_0x38922d){logger[_0x6f96('0x28')](_0x38922d[_0x6f96('0x29')]);if(_0x38922d[_0x6f96('0x2a')]){delete _0x38922d['name'];}_0x3329a2['status'](_0xe3cf23)['send'](_0x38922d);};}exports[_0x6f96('0x2b')]=function(_0x105796,_0x37b404){var _0x4821a8={},_0x19941b={},_0x29c45e={'count':0x0,'rows':[]};var _0x36f0ae=_[_0x6f96('0x2c')](db[_0x6f96('0x2d')]['rawAttributes'],function(_0x38dbba){return{'name':_0x38dbba[_0x6f96('0x2e')],'type':_0x38dbba['type'][_0x6f96('0x2f')]};});_0x19941b[_0x6f96('0x30')]=_[_0x6f96('0x2c')](_0x36f0ae,_0x6f96('0x2a'));_0x19941b[_0x6f96('0x31')]=_[_0x6f96('0x32')](_0x105796[_0x6f96('0x31')]);_0x19941b[_0x6f96('0x33')]=_['intersection'](_0x19941b[_0x6f96('0x30')],_0x19941b[_0x6f96('0x31')]);_0x4821a8[_0x6f96('0x34')]=_[_0x6f96('0x35')](_0x19941b[_0x6f96('0x30')],qs[_0x6f96('0x36')](_0x105796['query'][_0x6f96('0x36')]));_0x4821a8[_0x6f96('0x34')]=_0x4821a8[_0x6f96('0x34')][_0x6f96('0x37')]?_0x4821a8[_0x6f96('0x34')]:_0x19941b[_0x6f96('0x30')];if(!_0x105796['query'][_0x6f96('0x38')]('nolimit')){_0x4821a8[_0x6f96('0x1f')]=qs[_0x6f96('0x1f')](_0x105796['query'][_0x6f96('0x1f')]);_0x4821a8['offset']=qs[_0x6f96('0x39')](_0x105796[_0x6f96('0x31')][_0x6f96('0x39')]);}_0x4821a8[_0x6f96('0x3a')]=qs[_0x6f96('0x3b')](_0x105796[_0x6f96('0x31')]['sort']);_0x4821a8['where']=qs[_0x6f96('0x33')](_['pick'](_0x105796[_0x6f96('0x31')],_0x19941b['filters']),_0x36f0ae);if(_0x105796[_0x6f96('0x31')][_0x6f96('0x3c')]){_0x4821a8[_0x6f96('0x3d')]=_[_0x6f96('0x3e')](_0x4821a8[_0x6f96('0x3d')],{'$or':_[_0x6f96('0x2c')](_0x36f0ae,function(_0x57dd3f){if(_0x57dd3f[_0x6f96('0x3f')]!==_0x6f96('0x40')){var _0x9be8f5={};_0x9be8f5[_0x57dd3f[_0x6f96('0x2a')]]={'$like':'%'+_0x105796['query'][_0x6f96('0x3c')]+'%'};return _0x9be8f5;}})});}_0x4821a8=_[_0x6f96('0x3e')]({},_0x4821a8,_0x105796[_0x6f96('0x41')]);var _0x2fa5a1={'where':_0x4821a8[_0x6f96('0x3d')]};return db[_0x6f96('0x2d')][_0x6f96('0x21')](_0x2fa5a1)[_0x6f96('0x27')](function(_0x3cb013){_0x29c45e[_0x6f96('0x21')]=_0x3cb013;if(_0x105796[_0x6f96('0x31')][_0x6f96('0x42')]){_0x4821a8[_0x6f96('0x43')]=[{'all':!![]}];}return db[_0x6f96('0x2d')][_0x6f96('0x44')](_0x4821a8);})['then'](function(_0x140475){_0x29c45e['rows']=_0x140475;return _0x29c45e;})['then'](respondWithFilteredResult(_0x37b404,_0x4821a8))[_0x6f96('0x45')](handleError(_0x37b404,null));};exports[_0x6f96('0x46')]=function(_0xa2157d,_0x1d6023){var _0xa42324={'raw':!![],'where':{'id':_0xa2157d[_0x6f96('0x47')]['id']}},_0x4e8488={};_0x4e8488[_0x6f96('0x30')]=_[_0x6f96('0x32')](db[_0x6f96('0x2d')]['rawAttributes']);_0x4e8488[_0x6f96('0x31')]=_[_0x6f96('0x32')](_0xa2157d[_0x6f96('0x31')]);_0x4e8488[_0x6f96('0x33')]=_['intersection'](_0x4e8488[_0x6f96('0x30')],_0x4e8488[_0x6f96('0x31')]);_0xa42324[_0x6f96('0x34')]=_[_0x6f96('0x35')](_0x4e8488[_0x6f96('0x30')],qs[_0x6f96('0x36')](_0xa2157d[_0x6f96('0x31')][_0x6f96('0x36')]));_0xa42324['attributes']=_0xa42324['attributes'][_0x6f96('0x37')]?_0xa42324[_0x6f96('0x34')]:_0x4e8488[_0x6f96('0x30')];if(_0xa2157d[_0x6f96('0x31')][_0x6f96('0x42')]){_0xa42324['include']=[{'all':!![]}];}_0xa42324=_[_0x6f96('0x3e')]({},_0xa42324,_0xa2157d[_0x6f96('0x41')]);return db[_0x6f96('0x2d')][_0x6f96('0x48')](_0xa42324)[_0x6f96('0x27')](handleEntityNotFound(_0x1d6023,null))[_0x6f96('0x27')](respondWithResult(_0x1d6023,null))[_0x6f96('0x45')](handleError(_0x1d6023,null));};exports[_0x6f96('0x49')]=function(_0x12d2f1,_0x3d6cce){return db[_0x6f96('0x2d')][_0x6f96('0x49')](_0x12d2f1[_0x6f96('0x4a')],{})[_0x6f96('0x27')](respondWithResult(_0x3d6cce,0xc9))[_0x6f96('0x45')](handleError(_0x3d6cce,null));};exports[_0x6f96('0x25')]=function(_0x9e28e0,_0x11ecd7){if(_0x9e28e0['body']['id']){delete _0x9e28e0[_0x6f96('0x4a')]['id'];}return db[_0x6f96('0x2d')]['find']({'where':{'id':_0x9e28e0[_0x6f96('0x47')]['id']}})[_0x6f96('0x27')](handleEntityNotFound(_0x11ecd7,null))[_0x6f96('0x27')](saveUpdates(_0x9e28e0['body'],null))[_0x6f96('0x27')](respondWithResult(_0x11ecd7,null))[_0x6f96('0x45')](handleError(_0x11ecd7,null));};exports['destroy']=function(_0x37558e,_0x4b3263){return db['DeskField'][_0x6f96('0x48')]({'where':{'id':_0x37558e[_0x6f96('0x47')]['id']}})[_0x6f96('0x27')](handleEntityNotFound(_0x4b3263,null))[_0x6f96('0x27')](removeEntity(_0x4b3263,null))[_0x6f96('0x45')](handleError(_0x4b3263,null));}; \ No newline at end of file +var _0x66c7=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','error','stack','name','DeskField','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','includeAll','include','findAll','rows','params','merge','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x66c7,0x15c));var _0x766c=function(_0x4382cf,_0x175f42){_0x4382cf=_0x4382cf-0x0;var _0x349161=_0x66c7[_0x4382cf];return _0x349161;};'use strict';var emlformat=require(_0x766c('0x0'));var rimraf=require(_0x766c('0x1'));var zipdir=require(_0x766c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x766c('0x3'));var moment=require(_0x766c('0x4'));var BPromise=require(_0x766c('0x5'));var Mustache=require(_0x766c('0x6'));var util=require(_0x766c('0x7'));var path=require(_0x766c('0x8'));var sox=require('sox');var csv=require(_0x766c('0x9'));var ejs=require(_0x766c('0xa'));var fs=require('fs');var fs_extra=require(_0x766c('0xb'));var _=require(_0x766c('0xc'));var squel=require(_0x766c('0xd'));var crypto=require(_0x766c('0xe'));var jsforce=require(_0x766c('0xf'));var deskjs=require(_0x766c('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x766c('0x11'));var Redis=require(_0x766c('0x12'));var authService=require(_0x766c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x766c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x766c('0x15'))(_0x766c('0x16'));var utils=require(_0x766c('0x17'));var config=require(_0x766c('0x18'));var licenseUtil=require(_0x766c('0x19'));var db=require(_0x766c('0x1a'))['db'];function respondWithStatusCode(_0x2dcaa6,_0x3fcdb0){_0x3fcdb0=_0x3fcdb0||0xcc;return function(_0x9cb32b){if(_0x9cb32b){return _0x2dcaa6[_0x766c('0x1b')](_0x3fcdb0);}return _0x2dcaa6[_0x766c('0x1c')](_0x3fcdb0)[_0x766c('0x1d')]();};}function respondWithResult(_0x26dbe2,_0x44365a){_0x44365a=_0x44365a||0xc8;return function(_0x186914){if(_0x186914){return _0x26dbe2['status'](_0x44365a)['json'](_0x186914);}};}function respondWithFilteredResult(_0x491b9e,_0x35fcdc){return function(_0x3e0cf0){if(_0x3e0cf0){var _0xfadbc1=typeof _0x35fcdc[_0x766c('0x1e')]===_0x766c('0x1f')&&typeof _0x35fcdc[_0x766c('0x20')]==='undefined';var _0x529811=_0x3e0cf0[_0x766c('0x21')];var _0x23c566=_0xfadbc1?0x0:_0x35fcdc[_0x766c('0x1e')];var _0x47c887=_0xfadbc1?_0x3e0cf0[_0x766c('0x21')]:_0x35fcdc[_0x766c('0x1e')]+_0x35fcdc[_0x766c('0x20')];var _0x563546;if(_0x47c887>=_0x529811){_0x47c887=_0x529811;_0x563546=0xc8;}else{_0x563546=0xce;}_0x491b9e['status'](_0x563546);return _0x491b9e['set'](_0x766c('0x22'),_0x23c566+'-'+_0x47c887+'/'+_0x529811)['json'](_0x3e0cf0);}return null;};}function patchUpdates(_0x2736d0){return function(_0x3a0601){try{jsonpatch['apply'](_0x3a0601,_0x2736d0,!![]);}catch(_0x5dd837){return BPromise[_0x766c('0x23')](_0x5dd837);}return _0x3a0601[_0x766c('0x24')]();};}function saveUpdates(_0x41fa49,_0x508ce7){return function(_0x28304f){if(_0x28304f){return _0x28304f[_0x766c('0x25')](_0x41fa49)['then'](function(_0x504b05){return _0x504b05;});}return null;};}function removeEntity(_0x577000,_0x43d91f){return function(_0x4eb83e){if(_0x4eb83e){return _0x4eb83e[_0x766c('0x26')]()[_0x766c('0x27')](function(){_0x577000[_0x766c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44659e,_0x444310){return function(_0x19cb9b){if(!_0x19cb9b){_0x44659e[_0x766c('0x1b')](0x194);}return _0x19cb9b;};}function handleError(_0x3db6b4,_0x8ce86b){_0x8ce86b=_0x8ce86b||0x1f4;return function(_0x5ad1d6){logger[_0x766c('0x28')](_0x5ad1d6[_0x766c('0x29')]);if(_0x5ad1d6[_0x766c('0x2a')]){delete _0x5ad1d6[_0x766c('0x2a')];}_0x3db6b4[_0x766c('0x1c')](_0x8ce86b)['send'](_0x5ad1d6);};}exports['index']=function(_0x2d7de6,_0x19b6e8){var _0x1d5288={},_0x549dde={},_0x9f13ba={'count':0x0,'rows':[]};var _0x463302=_['map'](db[_0x766c('0x2b')]['rawAttributes'],function(_0x5bbefd){return{'name':_0x5bbefd[_0x766c('0x2c')],'type':_0x5bbefd[_0x766c('0x2d')][_0x766c('0x2e')]};});_0x549dde['model']=_[_0x766c('0x2f')](_0x463302,_0x766c('0x2a'));_0x549dde[_0x766c('0x30')]=_[_0x766c('0x31')](_0x2d7de6[_0x766c('0x30')]);_0x549dde['filters']=_['intersection'](_0x549dde[_0x766c('0x32')],_0x549dde[_0x766c('0x30')]);_0x1d5288[_0x766c('0x33')]=_[_0x766c('0x34')](_0x549dde[_0x766c('0x32')],qs['fields'](_0x2d7de6[_0x766c('0x30')][_0x766c('0x35')]));_0x1d5288[_0x766c('0x33')]=_0x1d5288['attributes'][_0x766c('0x36')]?_0x1d5288['attributes']:_0x549dde['model'];if(!_0x2d7de6[_0x766c('0x30')][_0x766c('0x37')](_0x766c('0x38'))){_0x1d5288[_0x766c('0x20')]=qs[_0x766c('0x20')](_0x2d7de6[_0x766c('0x30')]['limit']);_0x1d5288['offset']=qs[_0x766c('0x1e')](_0x2d7de6[_0x766c('0x30')][_0x766c('0x1e')]);}_0x1d5288[_0x766c('0x39')]=qs[_0x766c('0x3a')](_0x2d7de6[_0x766c('0x30')][_0x766c('0x3a')]);_0x1d5288[_0x766c('0x3b')]=qs[_0x766c('0x3c')](_[_0x766c('0x3d')](_0x2d7de6[_0x766c('0x30')],_0x549dde[_0x766c('0x3c')]),_0x463302);if(_0x2d7de6[_0x766c('0x30')]['filter']){_0x1d5288[_0x766c('0x3b')]=_['merge'](_0x1d5288[_0x766c('0x3b')],{'$or':_['map'](_0x463302,function(_0x1e13ee){if(_0x1e13ee[_0x766c('0x2d')]!=='VIRTUAL'){var _0xfb586={};_0xfb586[_0x1e13ee[_0x766c('0x2a')]]={'$like':'%'+_0x2d7de6['query'][_0x766c('0x3e')]+'%'};return _0xfb586;}})});}_0x1d5288=_['merge']({},_0x1d5288,_0x2d7de6['options']);var _0x5c1df6={'where':_0x1d5288[_0x766c('0x3b')]};return db['DeskField'][_0x766c('0x21')](_0x5c1df6)[_0x766c('0x27')](function(_0x3b8636){_0x9f13ba[_0x766c('0x21')]=_0x3b8636;if(_0x2d7de6[_0x766c('0x30')][_0x766c('0x3f')]){_0x1d5288[_0x766c('0x40')]=[{'all':!![]}];}return db[_0x766c('0x2b')][_0x766c('0x41')](_0x1d5288);})['then'](function(_0x246348){_0x9f13ba[_0x766c('0x42')]=_0x246348;return _0x9f13ba;})['then'](respondWithFilteredResult(_0x19b6e8,_0x1d5288))['catch'](handleError(_0x19b6e8,null));};exports['show']=function(_0x256102,_0xe8d1d0){var _0x537714={'raw':!![],'where':{'id':_0x256102[_0x766c('0x43')]['id']}},_0x2b99d1={};_0x2b99d1['model']=_[_0x766c('0x31')](db[_0x766c('0x2b')]['rawAttributes']);_0x2b99d1[_0x766c('0x30')]=_['keys'](_0x256102[_0x766c('0x30')]);_0x2b99d1[_0x766c('0x3c')]=_[_0x766c('0x34')](_0x2b99d1[_0x766c('0x32')],_0x2b99d1[_0x766c('0x30')]);_0x537714['attributes']=_[_0x766c('0x34')](_0x2b99d1[_0x766c('0x32')],qs['fields'](_0x256102[_0x766c('0x30')][_0x766c('0x35')]));_0x537714['attributes']=_0x537714['attributes'][_0x766c('0x36')]?_0x537714[_0x766c('0x33')]:_0x2b99d1[_0x766c('0x32')];if(_0x256102['query'][_0x766c('0x3f')]){_0x537714[_0x766c('0x40')]=[{'all':!![]}];}_0x537714=_[_0x766c('0x44')]({},_0x537714,_0x256102['options']);return db[_0x766c('0x2b')][_0x766c('0x45')](_0x537714)['then'](handleEntityNotFound(_0xe8d1d0,null))[_0x766c('0x27')](respondWithResult(_0xe8d1d0,null))[_0x766c('0x46')](handleError(_0xe8d1d0,null));};exports[_0x766c('0x47')]=function(_0x53c225,_0x67a4ab){return db['DeskField']['create'](_0x53c225['body'],{})[_0x766c('0x27')](respondWithResult(_0x67a4ab,0xc9))[_0x766c('0x46')](handleError(_0x67a4ab,null));};exports['update']=function(_0x2b53ca,_0xcb8c71){if(_0x2b53ca[_0x766c('0x48')]['id']){delete _0x2b53ca['body']['id'];}return db[_0x766c('0x2b')]['find']({'where':{'id':_0x2b53ca[_0x766c('0x43')]['id']}})[_0x766c('0x27')](handleEntityNotFound(_0xcb8c71,null))[_0x766c('0x27')](saveUpdates(_0x2b53ca[_0x766c('0x48')],null))[_0x766c('0x27')](respondWithResult(_0xcb8c71,null))[_0x766c('0x46')](handleError(_0xcb8c71,null));};exports[_0x766c('0x26')]=function(_0x33bd20,_0x38bb8b){return db['DeskField'][_0x766c('0x45')]({'where':{'id':_0x33bd20[_0x766c('0x43')]['id']}})[_0x766c('0x27')](handleEntityNotFound(_0x38bb8b,null))[_0x766c('0x27')](removeEntity(_0x38bb8b,null))[_0x766c('0x46')](handleError(_0x38bb8b,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d07def1..f5a648b 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 _0xe9ef=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','DeskField','idField','FieldId'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xe9ef,0x150));var _0xfe9e=function(_0x5538d5,_0x190032){_0x5538d5=_0x5538d5-0x0;var _0x323b1a=_0xe9ef[_0x5538d5];return _0x323b1a;};'use strict';var _=require(_0xfe9e('0x0'));var util=require(_0xfe9e('0x1'));var logger=require('../../config/logger')(_0xfe9e('0x2'));var moment=require(_0xfe9e('0x3'));var BPromise=require(_0xfe9e('0x4'));var rp=require(_0xfe9e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe9e('0x6'));var config=require(_0xfe9e('0x7'));var attributes=require('./intDeskField.attributes');module[_0xfe9e('0x8')]=function(_0x5cf56d,_0xf88fe0){return _0x5cf56d['define'](_0xfe9e('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xfe9e('0xa'),_0xfe9e('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe49d=['int_desk_fields','desk_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x2b6600,_0x24c497){var _0x912ee2=function(_0x5d6484){while(--_0x5d6484){_0x2b6600['push'](_0x2b6600['shift']());}};_0x912ee2(++_0x24c497);}(_0xe49d,0x1ef));var _0xde49=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe49d[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xde49('0x0'));var logger=require(_0xde49('0x1'))(_0xde49('0x2'));var moment=require(_0xde49('0x3'));var BPromise=require(_0xde49('0x4'));var rp=require(_0xde49('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde49('0x6'));var config=require(_0xde49('0x7'));var attributes=require('./intDeskField.attributes');module[_0xde49('0x8')]=function(_0x3dad62,_0x14fa8a){return _0x3dad62['define']('DeskField',attributes,{'tableName':_0xde49('0x9'),'paranoid':![],'indexes':[{'name':_0xde49('0xa'),'fields':['idField',_0xde49('0xb')],'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 e17910b..588de28 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 _0x132f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x2915bf,_0x2033ba){var _0x3fe105=function(_0x59b472){while(--_0x59b472){_0x2915bf['push'](_0x2915bf['shift']());}};_0x3fe105(++_0x2033ba);}(_0x132f,0x86));var _0xf132=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0x132f[_0x326e79];return _0x37eb89;};'use strict';var _=require(_0xf132('0x0'));var util=require(_0xf132('0x1'));var moment=require(_0xf132('0x2'));var BPromise=require('bluebird');var rs=require(_0xf132('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf132('0x4'))['db'];var utils=require(_0xf132('0x5'));var logger=require(_0xf132('0x6'))(_0xf132('0x7'));var config=require(_0xf132('0x8'));var jayson=require(_0xf132('0x9'));var client=jayson[_0xf132('0xa')][_0xf132('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x560eab,_0x461f61,_0x125d86){return new BPromise(function(_0x24f932,_0x24e97c){return client[_0xf132('0xc')](_0x560eab,_0x125d86)['then'](function(_0x3d8e46){logger[_0xf132('0xd')](_0xf132('0xe'),_0x461f61,_0xf132('0xf'));logger[_0xf132('0x10')](_0xf132('0x11'),_0x461f61,'request\x20sent',JSON['stringify'](_0x3d8e46));if(_0x3d8e46[_0xf132('0x12')]){if(_0x3d8e46['error'][_0xf132('0x13')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x461f61,_0x3d8e46[_0xf132('0x12')][_0xf132('0x14')]);return _0x24e97c(_0x3d8e46[_0xf132('0x12')][_0xf132('0x14')]);}logger[_0xf132('0x12')](_0xf132('0xe'),_0x461f61,_0x3d8e46['error'][_0xf132('0x14')]);return _0x24f932(_0x3d8e46['error'][_0xf132('0x14')]);}else{logger['info'](_0xf132('0xe'),_0x461f61,_0xf132('0xf'));_0x24f932(_0x3d8e46[_0xf132('0x15')][_0xf132('0x14')]);}})[_0xf132('0x16')](function(_0x294fdd){logger[_0xf132('0x12')](_0xf132('0xe'),_0x461f61,_0x294fdd);_0x24e97c(_0x294fdd);});});} \ No newline at end of file +var _0xc7e6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x5ec6d9,_0x486730){var _0x54a848=function(_0x37f151){while(--_0x37f151){_0x5ec6d9['push'](_0x5ec6d9['shift']());}};_0x54a848(++_0x486730);}(_0xc7e6,0x113));var _0x6c7e=function(_0x181728,_0x471cc4){_0x181728=_0x181728-0x0;var _0x3525db=_0xc7e6[_0x181728];return _0x3525db;};'use strict';var _=require(_0x6c7e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6c7e('0x1'));var rs=require(_0x6c7e('0x2'));var fs=require('fs');var Redis=require(_0x6c7e('0x3'));var db=require(_0x6c7e('0x4'))['db'];var utils=require(_0x6c7e('0x5'));var logger=require(_0x6c7e('0x6'))(_0x6c7e('0x7'));var config=require(_0x6c7e('0x8'));var jayson=require(_0x6c7e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x138249,_0x1c95a7,_0x54f49e){return new BPromise(function(_0x383d0b,_0x2e497d){return client[_0x6c7e('0xa')](_0x138249,_0x54f49e)[_0x6c7e('0xb')](function(_0x297c52){logger['info'](_0x6c7e('0xc'),_0x1c95a7,_0x6c7e('0xd'));logger[_0x6c7e('0xe')](_0x6c7e('0xf'),_0x1c95a7,_0x6c7e('0xd'),JSON[_0x6c7e('0x10')](_0x297c52));if(_0x297c52['error']){if(_0x297c52[_0x6c7e('0x11')][_0x6c7e('0x12')]===0x1f4){logger[_0x6c7e('0x11')](_0x6c7e('0xc'),_0x1c95a7,_0x297c52[_0x6c7e('0x11')]['message']);return _0x2e497d(_0x297c52[_0x6c7e('0x11')]['message']);}logger[_0x6c7e('0x11')](_0x6c7e('0xc'),_0x1c95a7,_0x297c52[_0x6c7e('0x11')]['message']);return _0x383d0b(_0x297c52['error'][_0x6c7e('0x13')]);}else{logger[_0x6c7e('0x14')](_0x6c7e('0xc'),_0x1c95a7,_0x6c7e('0xd'));_0x383d0b(_0x297c52[_0x6c7e('0x15')][_0x6c7e('0x13')]);}})[_0x6c7e('0x16')](function(_0x5c13fd){logger[_0x6c7e('0x11')](_0x6c7e('0xc'),_0x1c95a7,_0x5c13fd);_0x2e497d(_0x5c13fd);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 359753c..6d92d74 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 _0x395a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x2a2d49,_0x4329c0){var _0x1302f5=function(_0x56ab1e){while(--_0x56ab1e){_0x2a2d49['push'](_0x2a2d49['shift']());}};_0x1302f5(++_0x4329c0);}(_0x395a,0x64));var _0xa395=function(_0x499210,_0x325b29){_0x499210=_0x499210-0x0;var _0x2e153d=_0x395a[_0x499210];return _0x2e153d;};'use strict';var multer=require(_0xa395('0x0'));var util=require(_0xa395('0x1'));var path=require(_0xa395('0x2'));var timeout=require(_0xa395('0x3'));var express=require(_0xa395('0x4'));var router=express[_0xa395('0x5')]();var fs_extra=require(_0xa395('0x6'));var auth=require(_0xa395('0x7'));var interaction=require(_0xa395('0x8'));var config=require(_0xa395('0x9'));var controller=require(_0xa395('0xa'));router['get']('/',auth[_0xa395('0xb')](),controller[_0xa395('0xc')]);router[_0xa395('0xd')](_0xa395('0xe'),auth['isAuthenticated'](),controller[_0xa395('0xf')]);router[_0xa395('0xd')](_0xa395('0x10'),auth[_0xa395('0xb')](),controller[_0xa395('0x11')]);router[_0xa395('0xd')](_0xa395('0x12'),auth['isAuthenticated'](),controller['getFields']);router[_0xa395('0x13')]('/',auth[_0xa395('0xb')](),controller[_0xa395('0x14')]);router[_0xa395('0x13')]('/:id/configurations',auth[_0xa395('0xb')](),controller[_0xa395('0x15')]);router[_0xa395('0x16')]('/:id',auth[_0xa395('0xb')](),controller[_0xa395('0x17')]);router[_0xa395('0x18')](_0xa395('0xe'),auth[_0xa395('0xb')](),controller[_0xa395('0x19')]);module['exports']=router; \ No newline at end of file +var _0xcc6f=['post','create','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc6f,0x1e7));var _0xfcc6=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xcc6f[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0xfcc6('0x0'));var util=require(_0xfcc6('0x1'));var path=require(_0xfcc6('0x2'));var timeout=require(_0xfcc6('0x3'));var express=require('express');var router=express[_0xfcc6('0x4')]();var fs_extra=require(_0xfcc6('0x5'));var auth=require(_0xfcc6('0x6'));var interaction=require(_0xfcc6('0x7'));var config=require(_0xfcc6('0x8'));var controller=require(_0xfcc6('0x9'));router[_0xfcc6('0xa')]('/',auth[_0xfcc6('0xb')](),controller[_0xfcc6('0xc')]);router[_0xfcc6('0xa')](_0xfcc6('0xd'),auth[_0xfcc6('0xb')](),controller[_0xfcc6('0xe')]);router[_0xfcc6('0xa')](_0xfcc6('0xf'),auth[_0xfcc6('0xb')](),controller[_0xfcc6('0x10')]);router[_0xfcc6('0xa')]('/:id/fields',auth[_0xfcc6('0xb')](),controller['getFields']);router[_0xfcc6('0x11')]('/',auth[_0xfcc6('0xb')](),controller[_0xfcc6('0x12')]);router[_0xfcc6('0x11')](_0xfcc6('0xf'),auth['isAuthenticated'](),controller[_0xfcc6('0x13')]);router[_0xfcc6('0x14')](_0xfcc6('0xd'),auth['isAuthenticated'](),controller[_0xfcc6('0x15')]);router[_0xfcc6('0x16')](_0xfcc6('0xd'),auth[_0xfcc6('0xb')](),controller['destroy']);module[_0xfcc6('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 5f43e22..619b9d7 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 _0x8ca9=['sequelize','exports','STRING','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8ca9,0x9c));var _0x98ca=function(_0x3a8ab0,_0x4c9a15){_0x3a8ab0=_0x3a8ab0-0x0;var _0x30f208=_0x8ca9[_0x3a8ab0];return _0x30f208;};'use strict';var Sequelize=require(_0x98ca('0x0'));module[_0x98ca('0x1')]={'name':{'type':Sequelize[_0x98ca('0x2')]},'username':{'type':Sequelize[_0x98ca('0x2')]},'password':{'type':Sequelize[_0x98ca('0x2')]},'remoteUri':{'type':Sequelize[_0x98ca('0x2')]},'tenantId':{'type':Sequelize[_0x98ca('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x98ca('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x98ca('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x09f4=['STRING','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x09f4,0xe4));var _0x409f=function(_0x50b9b0,_0x427e8b){_0x50b9b0=_0x50b9b0-0x0;var _0x37316f=_0x09f4[_0x50b9b0];return _0x37316f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x409f('0x0')]},'username':{'type':Sequelize[_0x409f('0x0')]},'password':{'type':Sequelize[_0x409f('0x0')]},'remoteUri':{'type':Sequelize[_0x409f('0x0')]},'tenantId':{'type':Sequelize[_0x409f('0x0')]},'clientId':{'type':Sequelize[_0x409f('0x0')]},'clientSecret':{'type':Sequelize[_0x409f('0x0')]},'serverUrl':{'type':Sequelize[_0x409f('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x409f('0x0')]},'modernAuthentication':{'type':Sequelize[_0x409f('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 4450391..31da1e2 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 _0xb93e=['%s/api/data/v9.0/','getFields','ticketType','incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdon','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','importsequencenumber','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','statecode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','username','password','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','POST','https://login.microsoftonline.com/','/oauth2/token','4.0','MetadataId','GET','EntityDefinitions(','Bearer\x20','remove','LogicalName','@odata.type','PicklistAttributeMetadata','push','forEach','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','error','stack','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','count','set','Content-Range','then','destroy','end','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','update','body','params','findOne','Dynamics365Configuration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','substring','lastIndexOf','format'];(function(_0x14047e,_0x4be847){var _0x259fb9=function(_0x27bbbe){while(--_0x27bbbe){_0x14047e['push'](_0x14047e['shift']());}};_0x259fb9(++_0x4be847);}(_0xb93e,0x6d));var _0xeb93=function(_0x4ab42b,_0x4fda61){_0x4ab42b=_0x4ab42b-0x0;var _0x3ce7fb=_0xb93e[_0x4ab42b];return _0x3ce7fb;};'use strict';var rp=require(_0xeb93('0x0'));var util=require('util');var _=require(_0xeb93('0x1'));var qs=require(_0xeb93('0x2'));var logger=require(_0xeb93('0x3'))(_0xeb93('0x4'));var db=require(_0xeb93('0x5'))['db'];var integrations=require(_0xeb93('0x6'));function respondWithResult(_0x2a3542,_0x2dbf79){_0x2dbf79=_0x2dbf79||0xc8;return function(_0x3164e0){if(_0x3164e0){return _0x2a3542[_0xeb93('0x7')](_0x2dbf79)[_0xeb93('0x8')](_0x3164e0);}};}function respondWithFilteredResult(_0x1a9a13,_0x570052){return function(_0x17ca2b){if(_0x17ca2b){var _0x5d3c63=typeof _0x570052[_0xeb93('0x9')]==='undefined'&&typeof _0x570052[_0xeb93('0xa')]==='undefined';var _0x3d1e07=_0x17ca2b[_0xeb93('0xb')];var _0xe2f165=_0x5d3c63?0x0:_0x570052[_0xeb93('0x9')];var _0x5f5271=_0x5d3c63?_0x17ca2b[_0xeb93('0xb')]:_0x570052['offset']+_0x570052[_0xeb93('0xa')];var _0x47489a;if(_0x5f5271>=_0x3d1e07){_0x5f5271=_0x3d1e07;_0x47489a=0xc8;}else{_0x47489a=0xce;}_0x1a9a13[_0xeb93('0x7')](_0x47489a);return _0x1a9a13[_0xeb93('0xc')](_0xeb93('0xd'),_0xe2f165+'-'+_0x5f5271+'/'+_0x3d1e07)[_0xeb93('0x8')](_0x17ca2b);}return null;};}function saveUpdates(_0x27e529){return function(_0x22210d){if(_0x22210d){return _0x22210d['update'](_0x27e529)[_0xeb93('0xe')](function(_0x186a56){return _0x186a56;});}return null;};}function removeEntity(_0x1b0407){return function(_0x50ff2b){if(_0x50ff2b){return _0x50ff2b[_0xeb93('0xf')]()[_0xeb93('0xe')](function(){_0x1b0407[_0xeb93('0x7')](0xcc)[_0xeb93('0x10')]();});}};}function handleEntityNotFound(_0x4c704e){return function(_0x34f714){if(!_0x34f714){_0x4c704e['sendStatus'](0x194);}return _0x34f714;};}function handleError(_0x4d1864,_0x92a46f){_0x92a46f=_0x92a46f||0x1f4;return function(_0x407e42){logger['error'](_0x407e42['stack']);if(_0x407e42[_0xeb93('0x11')]){delete _0x407e42[_0xeb93('0x11')];}_0x4d1864[_0xeb93('0x7')](_0x92a46f)[_0xeb93('0x12')](_0x407e42);};}exports[_0xeb93('0x13')]=function(_0x295c0b,_0x2c7142){var _0x55f843={},_0x2c8f03={},_0x116204={'count':0x0,'rows':[]};var _0x4242c0=_[_0xeb93('0x14')](db[_0xeb93('0x15')][_0xeb93('0x16')],function(_0x2b667a){return{'name':_0x2b667a[_0xeb93('0x17')],'type':_0x2b667a[_0xeb93('0x18')]['key']};});_0x2c8f03[_0xeb93('0x19')]=_[_0xeb93('0x14')](_0x4242c0,_0xeb93('0x11'));_0x2c8f03['query']=_[_0xeb93('0x1a')](_0x295c0b[_0xeb93('0x1b')]);_0x2c8f03[_0xeb93('0x1c')]=_['intersection'](_0x2c8f03[_0xeb93('0x19')],_0x2c8f03['query']);_0x55f843[_0xeb93('0x1d')]=_[_0xeb93('0x1e')](_0x2c8f03[_0xeb93('0x19')],qs[_0xeb93('0x1f')](_0x295c0b[_0xeb93('0x1b')][_0xeb93('0x1f')]));_0x55f843['attributes']=_0x55f843[_0xeb93('0x1d')][_0xeb93('0x20')]?_0x55f843['attributes']:_0x2c8f03['model'];if(!_0x295c0b[_0xeb93('0x1b')]['hasOwnProperty'](_0xeb93('0x21'))){_0x55f843[_0xeb93('0xa')]=qs[_0xeb93('0xa')](_0x295c0b[_0xeb93('0x1b')][_0xeb93('0xa')]);_0x55f843[_0xeb93('0x9')]=qs[_0xeb93('0x9')](_0x295c0b['query']['offset']);}_0x55f843[_0xeb93('0x22')]=qs[_0xeb93('0x23')](_0x295c0b[_0xeb93('0x1b')][_0xeb93('0x23')]);_0x55f843[_0xeb93('0x24')]=qs['filters'](_[_0xeb93('0x25')](_0x295c0b[_0xeb93('0x1b')],_0x2c8f03[_0xeb93('0x1c')]),_0x4242c0);if(_0x295c0b['query'][_0xeb93('0x26')]){_0x55f843['where']=_[_0xeb93('0x27')](_0x55f843[_0xeb93('0x24')],{'$or':_['map'](_0x4242c0,function(_0x30d1ad){if(_0x30d1ad['type']!=='VIRTUAL'){var _0x2418f4={};_0x2418f4[_0x30d1ad['name']]={'$like':'%'+_0x295c0b[_0xeb93('0x1b')][_0xeb93('0x26')]+'%'};return _0x2418f4;}})});}_0x55f843=_['merge']({},_0x55f843,_0x295c0b[_0xeb93('0x28')]);var _0x8e7cc6={'where':_0x55f843[_0xeb93('0x24')]};return db[_0xeb93('0x15')][_0xeb93('0xb')](_0x8e7cc6)['then'](function(_0xbc0ef1){_0x116204[_0xeb93('0xb')]=_0xbc0ef1;if(_0x295c0b[_0xeb93('0x1b')][_0xeb93('0x29')]){_0x55f843[_0xeb93('0x2a')]=[{'all':!![]}];}return db[_0xeb93('0x15')][_0xeb93('0x2b')](_0x55f843);})['then'](function(_0x22c8e7){_0x116204[_0xeb93('0x2c')]=_0x22c8e7;return _0x116204;})[_0xeb93('0xe')](respondWithFilteredResult(_0x2c7142,_0x55f843))[_0xeb93('0x2d')](handleError(_0x2c7142,null));};exports['show']=function(_0x55b834,_0x4ee317){var _0x580760={'raw':![],'where':{'id':_0x55b834['params']['id']}},_0x3ea034={};_0x3ea034[_0xeb93('0x19')]=_['keys'](db[_0xeb93('0x15')][_0xeb93('0x16')]);_0x3ea034['query']=_[_0xeb93('0x1a')](_0x55b834[_0xeb93('0x1b')]);_0x3ea034[_0xeb93('0x1c')]=_[_0xeb93('0x1e')](_0x3ea034['model'],_0x3ea034[_0xeb93('0x1b')]);_0x580760['attributes']=_[_0xeb93('0x1e')](_0x3ea034['model'],qs[_0xeb93('0x1f')](_0x55b834[_0xeb93('0x1b')][_0xeb93('0x1f')]));_0x580760[_0xeb93('0x1d')]=_0x580760[_0xeb93('0x1d')][_0xeb93('0x20')]?_0x580760[_0xeb93('0x1d')]:_0x3ea034[_0xeb93('0x19')];if(_0x55b834[_0xeb93('0x1b')][_0xeb93('0x29')]){_0x580760[_0xeb93('0x2a')]=[{'all':!![]}];}_0x580760=_[_0xeb93('0x27')]({},_0x580760,_0x55b834['options']);return db[_0xeb93('0x15')][_0xeb93('0x2e')](_0x580760)[_0xeb93('0xe')](handleEntityNotFound(_0x4ee317,null))[_0xeb93('0xe')](respondWithResult(_0x4ee317,null))[_0xeb93('0x2d')](handleError(_0x4ee317,null));};exports[_0xeb93('0x2f')]=function(_0x479f6f,_0x5f0ae3){return db['Dynamics365Account'][_0xeb93('0x2f')](_0x479f6f['body'],{})['then'](respondWithResult(_0x5f0ae3,0xc9))[_0xeb93('0x2d')](handleError(_0x5f0ae3,null));};exports[_0xeb93('0x30')]=function(_0x120f40,_0x1893df){if(_0x120f40[_0xeb93('0x31')]['id']){delete _0x120f40[_0xeb93('0x31')]['id'];}return db[_0xeb93('0x15')][_0xeb93('0x2e')]({'where':{'id':_0x120f40['params']['id']}})[_0xeb93('0xe')](handleEntityNotFound(_0x1893df,null))[_0xeb93('0xe')](saveUpdates(_0x120f40[_0xeb93('0x31')],null))[_0xeb93('0xe')](respondWithResult(_0x1893df,null))[_0xeb93('0x2d')](handleError(_0x1893df,null));};exports['destroy']=function(_0x351793,_0x1422cb){return db['Dynamics365Account']['find']({'where':{'id':_0x351793[_0xeb93('0x32')]['id']}})[_0xeb93('0xe')](handleEntityNotFound(_0x1422cb,null))[_0xeb93('0xe')](removeEntity(_0x1422cb,null))[_0xeb93('0x2d')](handleError(_0x1422cb,null));};exports['getConfigurations']=function(_0x351d1c,_0x120e67){var _0x526b90={};var _0x390bc1={};var _0x4b764a;var _0x4d9276;return db[_0xeb93('0x15')][_0xeb93('0x33')]({'where':{'id':_0x351d1c[_0xeb93('0x32')]['id']}})[_0xeb93('0xe')](handleEntityNotFound(_0x120e67,null))[_0xeb93('0xe')](function(_0x1ccf3a){if(_0x1ccf3a){_0x4b764a=_0x1ccf3a;_0x390bc1[_0xeb93('0x19')]=_['keys'](db[_0xeb93('0x34')][_0xeb93('0x16')]);_0x390bc1[_0xeb93('0x1b')]=_[_0xeb93('0x1a')](_0x351d1c[_0xeb93('0x1b')]);_0x390bc1[_0xeb93('0x1c')]=_[_0xeb93('0x1e')](_0x390bc1['model'],_0x390bc1[_0xeb93('0x1b')]);_0x526b90[_0xeb93('0x1d')]=_[_0xeb93('0x1e')](_0x390bc1[_0xeb93('0x19')],qs['fields'](_0x351d1c[_0xeb93('0x1b')][_0xeb93('0x1f')]));_0x526b90[_0xeb93('0x1d')]=_0x526b90[_0xeb93('0x1d')][_0xeb93('0x20')]?_0x526b90[_0xeb93('0x1d')]:_0x390bc1['model'];_0x526b90[_0xeb93('0x22')]=qs[_0xeb93('0x23')](_0x351d1c[_0xeb93('0x1b')][_0xeb93('0x23')]);_0x526b90[_0xeb93('0x24')]=qs['filters'](_['pick'](_0x351d1c[_0xeb93('0x1b')],_0x390bc1[_0xeb93('0x1c')]));if(_0x351d1c[_0xeb93('0x1b')]['filter']){_0x526b90[_0xeb93('0x24')]=_[_0xeb93('0x27')](_0x526b90[_0xeb93('0x24')],{'$or':_[_0xeb93('0x14')](_0x526b90[_0xeb93('0x1d')],function(_0x514534){var _0x39b1dc={};_0x39b1dc[_0x514534]={'$like':'%'+_0x351d1c[_0xeb93('0x1b')][_0xeb93('0x26')]+'%'};return _0x39b1dc;})});}_0x526b90=_[_0xeb93('0x27')]({},_0x526b90,_0x351d1c[_0xeb93('0x28')]);return _0x4b764a[_0xeb93('0x35')](_0x526b90);}})[_0xeb93('0xe')](function(_0x347571){if(_0x347571){_0x4d9276=_0x347571[_0xeb93('0x20')];if(!_0x351d1c[_0xeb93('0x1b')]['hasOwnProperty'](_0xeb93('0x21'))){_0x526b90[_0xeb93('0xa')]=qs[_0xeb93('0xa')](_0x351d1c['query'][_0xeb93('0xa')]);_0x526b90['offset']=qs['offset'](_0x351d1c[_0xeb93('0x1b')][_0xeb93('0x9')]);}return _0x4b764a[_0xeb93('0x35')](_0x526b90);}})[_0xeb93('0xe')](function(_0x25be9b){if(_0x25be9b){return _0x25be9b?{'count':_0x4d9276,'rows':_0x25be9b}:null;}})[_0xeb93('0xe')](respondWithResult(_0x120e67,null))[_0xeb93('0x2d')](handleError(_0x120e67,null));};exports[_0xeb93('0x36')]=function(_0xcfd481,_0x769e97){if(_0xcfd481[_0xeb93('0x31')]['id']){delete _0xcfd481[_0xeb93('0x31')]['id'];}return db[_0xeb93('0x15')][_0xeb93('0x33')]({'where':{'id':_0xcfd481[_0xeb93('0x32')]['id']}})[_0xeb93('0xe')](handleEntityNotFound(_0x769e97,null))[_0xeb93('0xe')](function(_0x43f644){if(_0x43f644){_0xcfd481[_0xeb93('0x31')][_0xeb93('0x37')]=_0x43f644['id'];_0xcfd481[_0xeb93('0x31')][_0xeb93('0x38')]=integrations[_0xeb93('0x39')](_0xcfd481[_0xeb93('0x31')][_0xeb93('0x3a')],_0xcfd481[_0xeb93('0x31')][_0xeb93('0x18')]);_0xcfd481[_0xeb93('0x31')][_0xeb93('0x3b')]=integrations['getDescriptions'](_0xcfd481[_0xeb93('0x31')][_0xeb93('0x3a')],_0xcfd481[_0xeb93('0x31')][_0xeb93('0x18')]);return db['Dynamics365Configuration'][_0xeb93('0x2f')](_0xcfd481['body'],{'include':[{'model':db[_0xeb93('0x3c')],'as':_0xeb93('0x38')},{'model':db[_0xeb93('0x3c')],'as':_0xeb93('0x3b')}]});}return null;})[_0xeb93('0xe')](respondWithResult(_0x769e97,null))[_0xeb93('0x2d')](handleError(_0x769e97,null));};function sanitizeRemoteUri(_0x1a1d15){var _0xdd81fe=_0x1a1d15['slice'](-0x1);if(_0xdd81fe==='/')return _0x1a1d15[_0xeb93('0x3d')](0x0,_0x1a1d15[_0xeb93('0x3e')](_0xdd81fe));return _0x1a1d15;}function getWebApiUrl(_0x122029){return util[_0xeb93('0x3f')](_0xeb93('0x40'),_0x122029);}exports[_0xeb93('0x41')]=function(_0x4ed905,_0xeed0a5){var _0xeff17a=_0x4ed905[_0xeb93('0x1b')][_0xeb93('0x42')];var _0x53d9f8=_0xeff17a===_0xeb93('0x43')?'Incident':_0xeb93('0x44');var _0xbf512a='';var _0x9273e0='';var _0x511cbf='';var _0x539804='';var _0x123b18='';var _0x780b9f='';var _0x196f0e='';var _0x2e5b2d='';var _0x23d3a6=[_0xeb93('0x45'),'description',_0xeb93('0x46'),_0xeb93('0x47'),_0xeb93('0x48'),_0xeb93('0x49'),'phonenumber','regardingobjectid',_0xeb93('0x4a'),_0xeb93('0x4b')];var _0x5089b5=[_0xeb93('0x4c'),_0xeb93('0x4d'),'actualserviceunits',_0xeb93('0x4e'),_0xeb93('0x4f'),'contactidyominame',_0xeb93('0x50'),_0xeb93('0x51'),_0xeb93('0x52'),'createdbyexternalpartyyominame','createdbyname','createdbyyominame',_0xeb93('0x53'),'createdonbehalfbyname',_0xeb93('0x54'),_0xeb93('0x55'),_0xeb93('0x56'),'customeridyominame',_0xeb93('0x57'),'entitlementidname',_0xeb93('0x58'),_0xeb93('0x59'),_0xeb93('0x5a'),'exchangerate','firstresponsebykpiidname','followupby',_0xeb93('0x5b'),'influencescore',_0xeb93('0x5c'),'lastonholdtime','masteridname',_0xeb93('0x5d'),_0xeb93('0x5e'),'modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname',_0xeb93('0x5f'),_0xeb93('0x60'),_0xeb93('0x61'),'numberofchildincidents','onholdtime','overriddencreatedon',_0xeb93('0x62'),_0xeb93('0x63'),_0xeb93('0x64'),_0xeb93('0x65'),_0xeb93('0x66'),'primarycontactidyominame',_0xeb93('0x67'),_0xeb93('0x68'),_0xeb93('0x69'),_0xeb93('0x6a'),_0xeb93('0x6b'),'responseby',_0xeb93('0x6c'),_0xeb93('0x6d'),_0xeb93('0x6e'),_0xeb93('0x6f'),'slaname','socialprofileidname',_0xeb93('0x70'),'statuscode','subjectidname',_0xeb93('0x71'),_0xeb93('0x72'),_0xeb93('0x73'),'traversedpath',_0xeb93('0x74'),_0xeb93('0x75')];var _0xfb4ea2=_0x23d3a6['concat'](_0x5089b5);return db['Dynamics365Account'][_0xeb93('0x33')]({'where':{'id':_0x4ed905[_0xeb93('0x32')]['id']},'attributes':['id',_0xeb93('0x76'),_0xeb93('0x77'),'remoteUri',_0xeb93('0x78'),_0xeb93('0x79'),_0xeb93('0x7a'),_0xeb93('0x7b')],'include':[{'model':db[_0xeb93('0x7c')],'as':_0xeb93('0x7c'),'attributes':['id',_0xeb93('0x7d'),'data7']}]})[_0xeb93('0xe')](handleEntityNotFound(_0xeed0a5,null))[_0xeb93('0xe')](function(_0xaf9dd3){if(_0xaf9dd3){if(_0xaf9dd3[_0xeb93('0x7b')]){_0xaf9dd3[_0xeb93('0x7e')]=_0xaf9dd3[_0xeb93('0x7c')]['data5'];_0x2e5b2d=sanitizeRemoteUri(_0xaf9dd3['CloudProvider'][_0xeb93('0x7f')]);_0x196f0e=getWebApiUrl(_0x2e5b2d);return _0xaf9dd3;}_0x2e5b2d=sanitizeRemoteUri(_0xaf9dd3['remoteUri']);_0x196f0e=getWebApiUrl(_0x2e5b2d);var _0x1618b8={'method':_0xeb93('0x80'),'uri':_0xeb93('0x81')+_0xaf9dd3[_0xeb93('0x78')]+_0xeb93('0x82'),'form':{'client_id':_0xaf9dd3['clientId'],'resource':_0x2e5b2d,'username':_0xaf9dd3[_0xeb93('0x76')],'password':_0xaf9dd3[_0xeb93('0x77')],'grant_type':'password','client_secret':_0xaf9dd3[_0xeb93('0x7a')]},'json':!![]};return rp(_0x1618b8);}})[_0xeb93('0xe')](function(_0x585b82){_0x780b9f=_0x585b82['access_token'];var _0x52d142={'method':'GET','uri':encodeURI(_0x196f0e+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x53d9f8+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x780b9f,'If-None-Match':null,'OData-Version':_0xeb93('0x83')},'json':!![]};return rp(_0x52d142);})[_0xeb93('0xe')](function(_0x2295de){var _0x1de580=_0x2295de['value'][0x0];var _0x21929d=_0x1de580[_0xeb93('0x84')];var _0x473bcd={'method':_0xeb93('0x85'),'uri':_0x196f0e+_0xeb93('0x86')+_0x21929d+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xeb93('0x87')+_0x780b9f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x473bcd);})[_0xeb93('0xe')](function(_0x30aba2){_0xbf512a=_0x30aba2;_0x9273e0=_0xbf512a['Attributes'];_0x9273e0=_[_0xeb93('0x88')](_0x9273e0,function(_0x1e0a0c){return!_0xfb4ea2['includes'](_0x1e0a0c[_0xeb93('0x89')]);});var _0x2f01c1=[];var _0x2e0396=[];_0x9273e0['forEach'](function(_0x2229b9){if(_0x2229b9[_0xeb93('0x8a')]){var _0x1fa7f1=_0x2229b9['@odata.type'][_0xeb93('0x3d')](_0x2229b9[_0xeb93('0x8a')][_0xeb93('0x3e')]('.')+0x1);if(_0x1fa7f1===_0xeb93('0x8b')){_0x2f01c1[_0xeb93('0x8c')](getSelectList(_0x196f0e,_0xeff17a,_0x2e0396,_0xbf512a[_0xeb93('0x84')],_0x2229b9[_0xeb93('0x84')],_0x780b9f));}}});return Promise['all'](_0x2f01c1);})[_0xeb93('0xe')](function(_0xc95632){_0x511cbf=_0xc95632[0x0];var _0x2dd1c3=[];var _0x11984c=[];_0x9273e0[_0xeb93('0x8d')](function(_0x58b67e){if(!_['isNil'](_0x58b67e[_0xeb93('0x8a')])){var _0x1e206f=_0x58b67e['@odata.type']['substring'](_0x58b67e[_0xeb93('0x8a')][_0xeb93('0x3e')]('.')+0x1);if(_0x1e206f===_0xeb93('0x8e')){_0x2dd1c3[_0xeb93('0x8c')](getBooleanList(_0x196f0e,_0xeff17a,_0x11984c,_0xbf512a[_0xeb93('0x84')],_0x58b67e[_0xeb93('0x84')],_0x780b9f));}}});return Promise[_0xeb93('0x8f')](_0x2dd1c3);})[_0xeb93('0xe')](function(_0x16ccce){_0x539804=_0x16ccce[0x0];var _0x28910b=[];var _0x415db3=[];_0x9273e0[_0xeb93('0x8d')](function(_0x7579b2){if(_0x7579b2[_0xeb93('0x8a')]){var _0x5a9652=_0x7579b2[_0xeb93('0x8a')][_0xeb93('0x3d')](_0x7579b2[_0xeb93('0x8a')][_0xeb93('0x3e')]('.')+0x1);if(_0x5a9652===_0xeb93('0x90')||_0x5a9652===_0xeb93('0x91')||_0x5a9652===_0xeb93('0x92')||_0x5a9652===_0xeb93('0x93')||_0x5a9652===_0xeb93('0x94')||_0x5a9652===_0xeb93('0x95')||_0x5a9652===_0xeb93('0x96')||_0x5a9652==='EntityNameAttributeMetadata'||_0x5a9652===_0xeb93('0x97')||_0x5a9652===_0xeb93('0x98')){_0x28910b['push'](getInputList(_0x196f0e,_0xeff17a,_0x5a9652,_0x415db3,_0xbf512a[_0xeb93('0x84')],_0x7579b2[_0xeb93('0x84')],_0x780b9f));}}});return Promise[_0xeb93('0x8f')](_0x28910b);})[_0xeb93('0xe')](function(_0x3badcb){_0x123b18=_0x3badcb[0x0];var _0x5d39d9=_0x511cbf[_0xeb93('0x99')](_0x539804)[_0xeb93('0x99')](_0x123b18);var _0x197734={'count':_0x5d39d9[_0xeb93('0x20')],'rows':_0x5d39d9};return _0x197734;})[_0xeb93('0xe')](respondWithResult(_0xeed0a5,null))[_0xeb93('0x2d')](function(_0x371081){var _0x506b3a=_0x4ed905[_0xeb93('0x1b')][_0xeb93('0x9a')]?0x1f4:_0x371081[_0xeb93('0x9b')]||0x1f4;logger[_0xeb93('0x9c')](_0x371081[_0xeb93('0x9d')]);delete _0x371081[_0xeb93('0x11')];if(_0x506b3a===0x191){_0x506b3a=0x190;}_0xeed0a5[_0xeb93('0x7')](_0x506b3a)[_0xeb93('0x12')](_0x4ed905[_0xeb93('0x1b')][_0xeb93('0x9a')]?{'message':_0xeb93('0x9e'),'statusCode':_0x371081[_0xeb93('0x9b')]}:_0x371081);});};function getSelectList(_0x3e815d,_0x4418e3,_0x2fbfa9,_0x3620e2,_0x4b0b9a,_0x58a5c7){var _0xbd5170={'method':'GET','uri':_0x3e815d+_0xeb93('0x86')+_0x3620e2+_0xeb93('0x9f')+_0x4b0b9a+_0xeb93('0xa0')+_0xeb93('0xa1'),'headers':{'Authorization':'Bearer\x20'+_0x58a5c7,'If-None-Match':null,'OData-Version':_0xeb93('0x83')},'json':!![]};return rp(_0xbd5170)[_0xeb93('0xe')](function(_0x5d240d){var _0x43a0a7=[];var _0x4d0ecb=_0x5d240d['OptionSet'][_0xeb93('0xa2')];_0x4d0ecb[_0xeb93('0x8d')](function(_0x346005){_0x43a0a7['push']({'name':_0x346005[_0xeb93('0xa3')][_0xeb93('0xa4')][_0xeb93('0xa3')],'value':String(_0x346005[_0xeb93('0xa5')])});});var _0x3f24db={'id':_0x4418e3+'_'+_0x5d240d['LogicalName'],'name':_0x5d240d[_0xeb93('0xa6')][_0xeb93('0xa4')]['Label'],'custom':![],'options':_0x43a0a7};_0x2fbfa9[_0xeb93('0x8c')](_0x3f24db);return _0x2fbfa9;});}function getBooleanList(_0x16adde,_0x8bd19f,_0x9b6d2f,_0x4d2a62,_0x5ef5c4,_0x5cea8b){var _0x2444a3={'method':_0xeb93('0x85'),'uri':_0x16adde+_0xeb93('0x86')+_0x4d2a62+')/Attributes('+_0x5ef5c4+_0xeb93('0xa7'),'headers':{'Authorization':_0xeb93('0x87')+_0x5cea8b,'If-None-Match':null,'OData-Version':_0xeb93('0x83')},'json':!![]};return rp(_0x2444a3)[_0xeb93('0xe')](function(_0x7886df){var _0x29118d=[];_0x29118d[_0xeb93('0x8c')]({'name':_0x7886df['OptionSet'][_0xeb93('0xa8')][_0xeb93('0xa3')][_0xeb93('0xa4')][_0xeb93('0xa3')],'value':_0xeb93('0xa9')},{'name':_0x7886df['OptionSet'][_0xeb93('0xaa')]['Label'][_0xeb93('0xa4')]['Label'],'value':'false'});var _0xe0db1e={'id':_0x8bd19f+'_'+_0x7886df[_0xeb93('0x89')],'name':_0x7886df['DisplayName'][_0xeb93('0xa4')][_0xeb93('0xa3')],'custom':![],'options':_0x29118d};_0x9b6d2f[_0xeb93('0x8c')](_0xe0db1e);return _0x9b6d2f;});}function getInputList(_0x428812,_0x35b45e,_0x2d8a57,_0x11d2ee,_0x47b901,_0x50eab7,_0x434e33){var _0x32b89c={'method':_0xeb93('0x85'),'uri':_0x428812+_0xeb93('0x86')+_0x47b901+_0xeb93('0x9f')+_0x50eab7+_0xeb93('0xab')+_0x2d8a57+_0xeb93('0xac'),'headers':{'Authorization':_0xeb93('0x87')+_0x434e33,'If-None-Match':null,'OData-Version':_0xeb93('0x83')},'json':!![]};return rp(_0x32b89c)[_0xeb93('0xe')](function(_0x2b988c){var _0x391cc1={'id':_0x35b45e+'_'+_0x2b988c[_0xeb93('0x89')],'name':_0x2b988c['DisplayName'][_0xeb93('0xa4')]?_0x2b988c[_0xeb93('0xa6')][_0xeb93('0xa4')][_0xeb93('0xa3')]:_0x2b988c['LogicalName'],'custom':![],'options':[]};_0x11d2ee[_0xeb93('0x8c')](_0x391cc1);return _0x11d2ee;});} \ No newline at end of file +var _0x2831=['StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','TrueOption','true',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','Content-Range','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','then','findAll','rows','catch','params','keys','includeAll','include','options','find','create','update','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getDescriptions','channel','Dynamics365Configuration','Dynamics365Field','Descriptions','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','password','remoteUri','tenantId','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','clientId','username','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','@odata.type','push','MetadataId','all','isNil','forEach','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x2831,0x189));var _0x1283=function(_0x200131,_0x4041e5){_0x200131=_0x200131-0x0;var _0x1f87f2=_0x2831[_0x200131];return _0x1f87f2;};'use strict';var rp=require(_0x1283('0x0'));var util=require(_0x1283('0x1'));var _=require(_0x1283('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x1283('0x3'))(_0x1283('0x4'));var db=require(_0x1283('0x5'))['db'];var integrations=require(_0x1283('0x6'));function respondWithResult(_0x407af0,_0x428d1a){_0x428d1a=_0x428d1a||0xc8;return function(_0x5bf4c6){if(_0x5bf4c6){return _0x407af0[_0x1283('0x7')](_0x428d1a)[_0x1283('0x8')](_0x5bf4c6);}};}function respondWithFilteredResult(_0x1de941,_0x6caf07){return function(_0x1258d5){if(_0x1258d5){var _0x4c8a51=typeof _0x6caf07[_0x1283('0x9')]===_0x1283('0xa')&&typeof _0x6caf07[_0x1283('0xb')]===_0x1283('0xa');var _0x2976c1=_0x1258d5['count'];var _0x1163d5=_0x4c8a51?0x0:_0x6caf07['offset'];var _0x59e610=_0x4c8a51?_0x1258d5[_0x1283('0xc')]:_0x6caf07[_0x1283('0x9')]+_0x6caf07[_0x1283('0xb')];var _0x4d00c1;if(_0x59e610>=_0x2976c1){_0x59e610=_0x2976c1;_0x4d00c1=0xc8;}else{_0x4d00c1=0xce;}_0x1de941[_0x1283('0x7')](_0x4d00c1);return _0x1de941['set'](_0x1283('0xd'),_0x1163d5+'-'+_0x59e610+'/'+_0x2976c1)[_0x1283('0x8')](_0x1258d5);}return null;};}function saveUpdates(_0x54f8dd){return function(_0x2ef6cd){if(_0x2ef6cd){return _0x2ef6cd['update'](_0x54f8dd)['then'](function(_0x10e76c){return _0x10e76c;});}return null;};}function removeEntity(_0x4855f6){return function(_0x5c924e){if(_0x5c924e){return _0x5c924e[_0x1283('0xe')]()['then'](function(){_0x4855f6[_0x1283('0x7')](0xcc)[_0x1283('0xf')]();});}};}function handleEntityNotFound(_0x57ee83){return function(_0x279e4c){if(!_0x279e4c){_0x57ee83[_0x1283('0x10')](0x194);}return _0x279e4c;};}function handleError(_0x24d818,_0x1a7bb4){_0x1a7bb4=_0x1a7bb4||0x1f4;return function(_0x401d73){logger[_0x1283('0x11')](_0x401d73[_0x1283('0x12')]);if(_0x401d73[_0x1283('0x13')]){delete _0x401d73[_0x1283('0x13')];}_0x24d818[_0x1283('0x7')](_0x1a7bb4)[_0x1283('0x14')](_0x401d73);};}exports[_0x1283('0x15')]=function(_0x3eb65e,_0xe25d0e){var _0x120efa={},_0x1efcff={},_0x333335={'count':0x0,'rows':[]};var _0x53f6ef=_[_0x1283('0x16')](db[_0x1283('0x17')][_0x1283('0x18')],function(_0x4b95d3){return{'name':_0x4b95d3[_0x1283('0x19')],'type':_0x4b95d3[_0x1283('0x1a')][_0x1283('0x1b')]};});_0x1efcff[_0x1283('0x1c')]=_[_0x1283('0x16')](_0x53f6ef,_0x1283('0x13'));_0x1efcff['query']=_['keys'](_0x3eb65e[_0x1283('0x1d')]);_0x1efcff[_0x1283('0x1e')]=_[_0x1283('0x1f')](_0x1efcff[_0x1283('0x1c')],_0x1efcff[_0x1283('0x1d')]);_0x120efa[_0x1283('0x20')]=_[_0x1283('0x1f')](_0x1efcff[_0x1283('0x1c')],qs[_0x1283('0x21')](_0x3eb65e[_0x1283('0x1d')]['fields']));_0x120efa[_0x1283('0x20')]=_0x120efa['attributes'][_0x1283('0x22')]?_0x120efa[_0x1283('0x20')]:_0x1efcff[_0x1283('0x1c')];if(!_0x3eb65e['query'][_0x1283('0x23')](_0x1283('0x24'))){_0x120efa[_0x1283('0xb')]=qs[_0x1283('0xb')](_0x3eb65e[_0x1283('0x1d')]['limit']);_0x120efa[_0x1283('0x9')]=qs[_0x1283('0x9')](_0x3eb65e[_0x1283('0x1d')]['offset']);}_0x120efa[_0x1283('0x25')]=qs[_0x1283('0x26')](_0x3eb65e[_0x1283('0x1d')][_0x1283('0x26')]);_0x120efa[_0x1283('0x27')]=qs['filters'](_[_0x1283('0x28')](_0x3eb65e[_0x1283('0x1d')],_0x1efcff[_0x1283('0x1e')]),_0x53f6ef);if(_0x3eb65e[_0x1283('0x1d')][_0x1283('0x29')]){_0x120efa[_0x1283('0x27')]=_['merge'](_0x120efa['where'],{'$or':_[_0x1283('0x16')](_0x53f6ef,function(_0x5b2457){if(_0x5b2457[_0x1283('0x1a')]!=='VIRTUAL'){var _0x5bba7d={};_0x5bba7d[_0x5b2457[_0x1283('0x13')]]={'$like':'%'+_0x3eb65e[_0x1283('0x1d')][_0x1283('0x29')]+'%'};return _0x5bba7d;}})});}_0x120efa=_[_0x1283('0x2a')]({},_0x120efa,_0x3eb65e['options']);var _0x54e56e={'where':_0x120efa[_0x1283('0x27')]};return db[_0x1283('0x17')][_0x1283('0xc')](_0x54e56e)[_0x1283('0x2b')](function(_0x158035){_0x333335[_0x1283('0xc')]=_0x158035;if(_0x3eb65e[_0x1283('0x1d')]['includeAll']){_0x120efa['include']=[{'all':!![]}];}return db[_0x1283('0x17')][_0x1283('0x2c')](_0x120efa);})[_0x1283('0x2b')](function(_0x21f842){_0x333335[_0x1283('0x2d')]=_0x21f842;return _0x333335;})[_0x1283('0x2b')](respondWithFilteredResult(_0xe25d0e,_0x120efa))[_0x1283('0x2e')](handleError(_0xe25d0e,null));};exports['show']=function(_0x387228,_0x25e9f1){var _0x73b7ec={'raw':![],'where':{'id':_0x387228[_0x1283('0x2f')]['id']}},_0x367dac={};_0x367dac[_0x1283('0x1c')]=_['keys'](db[_0x1283('0x17')][_0x1283('0x18')]);_0x367dac['query']=_[_0x1283('0x30')](_0x387228[_0x1283('0x1d')]);_0x367dac[_0x1283('0x1e')]=_[_0x1283('0x1f')](_0x367dac['model'],_0x367dac['query']);_0x73b7ec[_0x1283('0x20')]=_[_0x1283('0x1f')](_0x367dac[_0x1283('0x1c')],qs[_0x1283('0x21')](_0x387228[_0x1283('0x1d')][_0x1283('0x21')]));_0x73b7ec[_0x1283('0x20')]=_0x73b7ec['attributes'][_0x1283('0x22')]?_0x73b7ec[_0x1283('0x20')]:_0x367dac[_0x1283('0x1c')];if(_0x387228[_0x1283('0x1d')][_0x1283('0x31')]){_0x73b7ec[_0x1283('0x32')]=[{'all':!![]}];}_0x73b7ec=_['merge']({},_0x73b7ec,_0x387228[_0x1283('0x33')]);return db[_0x1283('0x17')][_0x1283('0x34')](_0x73b7ec)['then'](handleEntityNotFound(_0x25e9f1,null))[_0x1283('0x2b')](respondWithResult(_0x25e9f1,null))[_0x1283('0x2e')](handleError(_0x25e9f1,null));};exports[_0x1283('0x35')]=function(_0x2ca21c,_0xdbf72d){return db[_0x1283('0x17')][_0x1283('0x35')](_0x2ca21c['body'],{})[_0x1283('0x2b')](respondWithResult(_0xdbf72d,0xc9))['catch'](handleError(_0xdbf72d,null));};exports[_0x1283('0x36')]=function(_0x2976ad,_0x58bfe0){if(_0x2976ad[_0x1283('0x37')]['id']){delete _0x2976ad[_0x1283('0x37')]['id'];}return db[_0x1283('0x17')]['find']({'where':{'id':_0x2976ad[_0x1283('0x2f')]['id']}})[_0x1283('0x2b')](handleEntityNotFound(_0x58bfe0,null))[_0x1283('0x2b')](saveUpdates(_0x2976ad[_0x1283('0x37')],null))[_0x1283('0x2b')](respondWithResult(_0x58bfe0,null))[_0x1283('0x2e')](handleError(_0x58bfe0,null));};exports['destroy']=function(_0x49f7d6,_0x192039){return db[_0x1283('0x17')][_0x1283('0x34')]({'where':{'id':_0x49f7d6[_0x1283('0x2f')]['id']}})[_0x1283('0x2b')](handleEntityNotFound(_0x192039,null))[_0x1283('0x2b')](removeEntity(_0x192039,null))['catch'](handleError(_0x192039,null));};exports[_0x1283('0x38')]=function(_0x2ab63e,_0x2e6d88){var _0xe8a8ee={};var _0x2ad454={};var _0x1a0d86;var _0x5443d7;return db['Dynamics365Account'][_0x1283('0x39')]({'where':{'id':_0x2ab63e[_0x1283('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2e6d88,null))[_0x1283('0x2b')](function(_0x437477){if(_0x437477){_0x1a0d86=_0x437477;_0x2ad454[_0x1283('0x1c')]=_[_0x1283('0x30')](db['Dynamics365Configuration']['rawAttributes']);_0x2ad454[_0x1283('0x1d')]=_['keys'](_0x2ab63e[_0x1283('0x1d')]);_0x2ad454[_0x1283('0x1e')]=_[_0x1283('0x1f')](_0x2ad454[_0x1283('0x1c')],_0x2ad454['query']);_0xe8a8ee[_0x1283('0x20')]=_[_0x1283('0x1f')](_0x2ad454['model'],qs[_0x1283('0x21')](_0x2ab63e[_0x1283('0x1d')][_0x1283('0x21')]));_0xe8a8ee[_0x1283('0x20')]=_0xe8a8ee[_0x1283('0x20')][_0x1283('0x22')]?_0xe8a8ee[_0x1283('0x20')]:_0x2ad454['model'];_0xe8a8ee[_0x1283('0x25')]=qs[_0x1283('0x26')](_0x2ab63e['query'][_0x1283('0x26')]);_0xe8a8ee[_0x1283('0x27')]=qs[_0x1283('0x1e')](_[_0x1283('0x28')](_0x2ab63e[_0x1283('0x1d')],_0x2ad454[_0x1283('0x1e')]));if(_0x2ab63e[_0x1283('0x1d')]['filter']){_0xe8a8ee[_0x1283('0x27')]=_[_0x1283('0x2a')](_0xe8a8ee[_0x1283('0x27')],{'$or':_[_0x1283('0x16')](_0xe8a8ee['attributes'],function(_0x40ce4d){var _0x4feb2a={};_0x4feb2a[_0x40ce4d]={'$like':'%'+_0x2ab63e['query'][_0x1283('0x29')]+'%'};return _0x4feb2a;})});}_0xe8a8ee=_[_0x1283('0x2a')]({},_0xe8a8ee,_0x2ab63e[_0x1283('0x33')]);return _0x1a0d86['getConfigurations'](_0xe8a8ee);}})[_0x1283('0x2b')](function(_0xcc6b70){if(_0xcc6b70){_0x5443d7=_0xcc6b70[_0x1283('0x22')];if(!_0x2ab63e['query']['hasOwnProperty'](_0x1283('0x24'))){_0xe8a8ee[_0x1283('0xb')]=qs[_0x1283('0xb')](_0x2ab63e[_0x1283('0x1d')]['limit']);_0xe8a8ee[_0x1283('0x9')]=qs['offset'](_0x2ab63e[_0x1283('0x1d')][_0x1283('0x9')]);}return _0x1a0d86[_0x1283('0x38')](_0xe8a8ee);}})['then'](function(_0x16d0d0){if(_0x16d0d0){return _0x16d0d0?{'count':_0x5443d7,'rows':_0x16d0d0}:null;}})[_0x1283('0x2b')](respondWithResult(_0x2e6d88,null))[_0x1283('0x2e')](handleError(_0x2e6d88,null));};exports[_0x1283('0x3a')]=function(_0x372bfa,_0x84a933){if(_0x372bfa[_0x1283('0x37')]['id']){delete _0x372bfa[_0x1283('0x37')]['id'];}return db[_0x1283('0x17')][_0x1283('0x39')]({'where':{'id':_0x372bfa[_0x1283('0x2f')]['id']}})['then'](handleEntityNotFound(_0x84a933,null))[_0x1283('0x2b')](function(_0x4e99b9){if(_0x4e99b9){_0x372bfa[_0x1283('0x37')][_0x1283('0x3b')]=_0x4e99b9['id'];_0x372bfa[_0x1283('0x37')][_0x1283('0x3c')]=integrations['getSubjects'](_0x372bfa[_0x1283('0x37')]['channel'],_0x372bfa[_0x1283('0x37')][_0x1283('0x1a')]);_0x372bfa[_0x1283('0x37')]['Descriptions']=integrations[_0x1283('0x3d')](_0x372bfa[_0x1283('0x37')][_0x1283('0x3e')],_0x372bfa[_0x1283('0x37')]['type']);return db[_0x1283('0x3f')]['create'](_0x372bfa[_0x1283('0x37')],{'include':[{'model':db[_0x1283('0x40')],'as':_0x1283('0x3c')},{'model':db[_0x1283('0x40')],'as':_0x1283('0x41')}]});}return null;})[_0x1283('0x2b')](respondWithResult(_0x84a933,null))['catch'](handleError(_0x84a933,null));};function sanitizeRemoteUri(_0x47cdba){var _0x25a8f4=_0x47cdba['slice'](-0x1);if(_0x25a8f4==='/')return _0x47cdba[_0x1283('0x42')](0x0,_0x47cdba[_0x1283('0x43')](_0x25a8f4));return _0x47cdba;}function getWebApiUrl(_0x5e839b){return util[_0x1283('0x44')](_0x1283('0x45'),_0x5e839b);}exports[_0x1283('0x46')]=function(_0x530b64,_0x3bcacf){var _0x40c5fe=_0x530b64[_0x1283('0x1d')][_0x1283('0x47')];var _0x3a2b39=_0x40c5fe===_0x1283('0x48')?_0x1283('0x49'):_0x1283('0x4a');var _0x5aa8de='';var _0x316c76='';var _0x3b7a96='';var _0x4123ca='';var _0x541571='';var _0x4b9436='';var _0x29a42f='';var _0x3af2fe='';var _0x272668=[_0x1283('0x4b'),_0x1283('0x4c'),_0x1283('0x4d'),_0x1283('0x4e'),_0x1283('0x4f'),'subject',_0x1283('0x50'),_0x1283('0x51'),_0x1283('0x52'),_0x1283('0x53')];var _0x31d020=[_0x1283('0x54'),_0x1283('0x55'),_0x1283('0x56'),'billedserviceunits',_0x1283('0x57'),_0x1283('0x58'),_0x1283('0x59'),_0x1283('0x5a'),'createdbyexternalpartyname',_0x1283('0x5b'),'createdbyname',_0x1283('0x5c'),_0x1283('0x5d'),'createdonbehalfbyname',_0x1283('0x5e'),'customeridname',_0x1283('0x5f'),_0x1283('0x60'),_0x1283('0x61'),'entitlementidname',_0x1283('0x62'),_0x1283('0x63'),'escalatedon','exchangerate',_0x1283('0x64'),'followupby',_0x1283('0x65'),_0x1283('0x66'),_0x1283('0x67'),'lastonholdtime',_0x1283('0x68'),_0x1283('0x69'),_0x1283('0x6a'),_0x1283('0x6b'),'modifiedbyyominame',_0x1283('0x6c'),_0x1283('0x6d'),'modifiedonbehalfbyyominame',_0x1283('0x6e'),_0x1283('0x6f'),_0x1283('0x70'),'onholdtime',_0x1283('0x71'),'owneridname','owneridtype',_0x1283('0x72'),_0x1283('0x73'),_0x1283('0x74'),_0x1283('0x75'),_0x1283('0x76'),_0x1283('0x77'),_0x1283('0x78'),_0x1283('0x79'),_0x1283('0x7a'),'responseby','responsiblecontactidname',_0x1283('0x7b'),'sentimentvalue',_0x1283('0x7c'),_0x1283('0x7d'),_0x1283('0x7e'),_0x1283('0x7f'),_0x1283('0x80'),_0x1283('0x81'),_0x1283('0x82'),'timezoneruleversionnumber',_0x1283('0x83'),_0x1283('0x84'),_0x1283('0x85'),'versionnumber'];var _0x488ace=_0x272668[_0x1283('0x86')](_0x31d020);return db[_0x1283('0x17')][_0x1283('0x39')]({'where':{'id':_0x530b64['params']['id']},'attributes':['id','username',_0x1283('0x87'),_0x1283('0x88'),_0x1283('0x89'),'clientId','clientSecret','modernAuthentication'],'include':[{'model':db[_0x1283('0x8a')],'as':_0x1283('0x8a'),'attributes':['id',_0x1283('0x8b'),_0x1283('0x8c')]}]})['then'](handleEntityNotFound(_0x3bcacf,null))[_0x1283('0x2b')](function(_0x1c7494){if(_0x1c7494){if(_0x1c7494['modernAuthentication']){_0x1c7494['access_token']=_0x1c7494[_0x1283('0x8a')]['data5'];_0x3af2fe=sanitizeRemoteUri(_0x1c7494[_0x1283('0x8a')][_0x1283('0x8c')]);_0x29a42f=getWebApiUrl(_0x3af2fe);return _0x1c7494;}_0x3af2fe=sanitizeRemoteUri(_0x1c7494[_0x1283('0x88')]);_0x29a42f=getWebApiUrl(_0x3af2fe);var _0x4b4d82={'method':_0x1283('0x8d'),'uri':_0x1283('0x8e')+_0x1c7494['tenantId']+'/oauth2/token','form':{'client_id':_0x1c7494[_0x1283('0x8f')],'resource':_0x3af2fe,'username':_0x1c7494[_0x1283('0x90')],'password':_0x1c7494[_0x1283('0x87')],'grant_type':_0x1283('0x87'),'client_secret':_0x1c7494[_0x1283('0x91')]},'json':!![]};return rp(_0x4b4d82);}})['then'](function(_0x5f403d){_0x4b9436=_0x5f403d[_0x1283('0x92')];var _0x8d4957={'method':_0x1283('0x93'),'uri':encodeURI(_0x29a42f+_0x1283('0x94')+_0x3a2b39+'\x27'),'headers':{'Authorization':_0x1283('0x95')+_0x4b9436,'If-None-Match':null,'OData-Version':_0x1283('0x96')},'json':!![]};return rp(_0x8d4957);})[_0x1283('0x2b')](function(_0x430a9a){var _0x42bc6c=_0x430a9a[_0x1283('0x97')][0x0];var _0x10e36e=_0x42bc6c['MetadataId'];var _0x43b5b6={'method':_0x1283('0x93'),'uri':_0x29a42f+'EntityDefinitions('+_0x10e36e+_0x1283('0x98'),'headers':{'Authorization':_0x1283('0x95')+_0x4b9436,'If-None-Match':null,'OData-Version':_0x1283('0x96')},'json':!![]};return rp(_0x43b5b6);})['then'](function(_0x4492f5){_0x5aa8de=_0x4492f5;_0x316c76=_0x5aa8de['Attributes'];_0x316c76=_[_0x1283('0x99')](_0x316c76,function(_0x4ced99){return!_0x488ace[_0x1283('0x9a')](_0x4ced99[_0x1283('0x9b')]);});var _0x5b6e42=[];var _0x302628=[];_0x316c76['forEach'](function(_0x5423ec){if(_0x5423ec[_0x1283('0x9c')]){var _0x3f1c00=_0x5423ec[_0x1283('0x9c')][_0x1283('0x42')](_0x5423ec[_0x1283('0x9c')][_0x1283('0x43')]('.')+0x1);if(_0x3f1c00==='PicklistAttributeMetadata'){_0x5b6e42[_0x1283('0x9d')](getSelectList(_0x29a42f,_0x40c5fe,_0x302628,_0x5aa8de['MetadataId'],_0x5423ec[_0x1283('0x9e')],_0x4b9436));}}});return Promise[_0x1283('0x9f')](_0x5b6e42);})[_0x1283('0x2b')](function(_0x1c9e47){_0x3b7a96=_0x1c9e47[0x0];var _0x4f7e5e=[];var _0x329651=[];_0x316c76['forEach'](function(_0x3176db){if(!_[_0x1283('0xa0')](_0x3176db[_0x1283('0x9c')])){var _0x36e805=_0x3176db[_0x1283('0x9c')]['substring'](_0x3176db[_0x1283('0x9c')][_0x1283('0x43')]('.')+0x1);if(_0x36e805==='BooleanAttributeMetadata'){_0x4f7e5e[_0x1283('0x9d')](getBooleanList(_0x29a42f,_0x40c5fe,_0x329651,_0x5aa8de[_0x1283('0x9e')],_0x3176db[_0x1283('0x9e')],_0x4b9436));}}});return Promise[_0x1283('0x9f')](_0x4f7e5e);})[_0x1283('0x2b')](function(_0x1cc016){_0x4123ca=_0x1cc016[0x0];var _0x56bdea=[];var _0x58ea60=[];_0x316c76[_0x1283('0xa1')](function(_0x37378d){if(_0x37378d[_0x1283('0x9c')]){var _0x4cc87a=_0x37378d[_0x1283('0x9c')][_0x1283('0x42')](_0x37378d[_0x1283('0x9c')]['lastIndexOf']('.')+0x1);if(_0x4cc87a===_0x1283('0xa2')||_0x4cc87a===_0x1283('0xa3')||_0x4cc87a===_0x1283('0xa4')||_0x4cc87a===_0x1283('0xa5')||_0x4cc87a===_0x1283('0xa6')||_0x4cc87a===_0x1283('0xa7')||_0x4cc87a===_0x1283('0xa8')||_0x4cc87a===_0x1283('0xa9')||_0x4cc87a==='StateAttributeMetadata'||_0x4cc87a===_0x1283('0xaa')){_0x56bdea['push'](getInputList(_0x29a42f,_0x40c5fe,_0x4cc87a,_0x58ea60,_0x5aa8de[_0x1283('0x9e')],_0x37378d[_0x1283('0x9e')],_0x4b9436));}}});return Promise['all'](_0x56bdea);})[_0x1283('0x2b')](function(_0x225a83){_0x541571=_0x225a83[0x0];var _0x1d69f3=_0x3b7a96[_0x1283('0x86')](_0x4123ca)[_0x1283('0x86')](_0x541571);var _0x5e21b8={'count':_0x1d69f3['length'],'rows':_0x1d69f3};return _0x5e21b8;})[_0x1283('0x2b')](respondWithResult(_0x3bcacf,null))['catch'](function(_0x3dee1f){var _0x221e3a=_0x530b64[_0x1283('0x1d')][_0x1283('0xab')]?0x1f4:_0x3dee1f['statusCode']||0x1f4;logger[_0x1283('0x11')](_0x3dee1f[_0x1283('0x12')]);delete _0x3dee1f[_0x1283('0x13')];if(_0x221e3a===0x191){_0x221e3a=0x190;}_0x3bcacf[_0x1283('0x7')](_0x221e3a)['send'](_0x530b64[_0x1283('0x1d')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3dee1f[_0x1283('0xac')]}:_0x3dee1f);});};function getSelectList(_0x5b3313,_0x13882d,_0x4b3b79,_0x3647e4,_0x371a6a,_0x1af594){var _0x328400={'method':'GET','uri':_0x5b3313+_0x1283('0xad')+_0x3647e4+_0x1283('0xae')+_0x371a6a+_0x1283('0xaf')+_0x1283('0xb0'),'headers':{'Authorization':_0x1283('0x95')+_0x1af594,'If-None-Match':null,'OData-Version':_0x1283('0x96')},'json':!![]};return rp(_0x328400)[_0x1283('0x2b')](function(_0x4b74f2){var _0x3a1533=[];var _0x5d81df=_0x4b74f2[_0x1283('0xb1')][_0x1283('0xb2')];_0x5d81df[_0x1283('0xa1')](function(_0x223f49){_0x3a1533['push']({'name':_0x223f49[_0x1283('0xb3')][_0x1283('0xb4')]['Label'],'value':String(_0x223f49[_0x1283('0xb5')])});});var _0x3ecdb4={'id':_0x13882d+'_'+_0x4b74f2[_0x1283('0x9b')],'name':_0x4b74f2[_0x1283('0xb6')][_0x1283('0xb4')][_0x1283('0xb3')],'custom':![],'options':_0x3a1533};_0x4b3b79[_0x1283('0x9d')](_0x3ecdb4);return _0x4b3b79;});}function getBooleanList(_0x4646b2,_0x38f1ee,_0x444d68,_0x4b0535,_0x3e919a,_0x5c6ca4){var _0x2ce735={'method':_0x1283('0x93'),'uri':_0x4646b2+_0x1283('0xad')+_0x4b0535+')/Attributes('+_0x3e919a+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x1283('0x95')+_0x5c6ca4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2ce735)[_0x1283('0x2b')](function(_0x1c44c4){var _0x3a4b7b=[];_0x3a4b7b[_0x1283('0x9d')]({'name':_0x1c44c4[_0x1283('0xb1')][_0x1283('0xb7')][_0x1283('0xb3')][_0x1283('0xb4')][_0x1283('0xb3')],'value':_0x1283('0xb8')},{'name':_0x1c44c4[_0x1283('0xb1')]['FalseOption'][_0x1283('0xb3')][_0x1283('0xb4')][_0x1283('0xb3')],'value':'false'});var _0x1afff8={'id':_0x38f1ee+'_'+_0x1c44c4[_0x1283('0x9b')],'name':_0x1c44c4[_0x1283('0xb6')][_0x1283('0xb4')][_0x1283('0xb3')],'custom':![],'options':_0x3a4b7b};_0x444d68[_0x1283('0x9d')](_0x1afff8);return _0x444d68;});}function getInputList(_0xdfeae0,_0x5e26b9,_0x3b5c7c,_0x3c2ca0,_0x7ef153,_0x13fba6,_0x3e6ec8){var _0xb613ec={'method':_0x1283('0x93'),'uri':_0xdfeae0+_0x1283('0xad')+_0x7ef153+')/Attributes('+_0x13fba6+_0x1283('0xb9')+_0x3b5c7c+_0x1283('0xba'),'headers':{'Authorization':'Bearer\x20'+_0x3e6ec8,'If-None-Match':null,'OData-Version':_0x1283('0x96')},'json':!![]};return rp(_0xb613ec)['then'](function(_0x34fad1){var _0x3b8921={'id':_0x5e26b9+'_'+_0x34fad1['LogicalName'],'name':_0x34fad1[_0x1283('0xb6')][_0x1283('0xb4')]?_0x34fad1[_0x1283('0xb6')]['UserLocalizedLabel'][_0x1283('0xb3')]:_0x34fad1['LogicalName'],'custom':![],'options':[]};_0x3c2ca0[_0x1283('0x9d')](_0x3b8921);return _0x3c2ca0;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 12f66c0..b5693e4 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x3f6574,_0x1ddcac){var _0x4f819b=function(_0x5bb825){while(--_0x5bb825){_0x3f6574['push'](_0x3f6574['shift']());}};_0x4f819b(++_0x1ddcac);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x2fa8b1,_0x34af57){var _0x1b987e=function(_0xa13cd6){while(--_0xa13cd6){_0x2fa8b1['push'](_0x2fa8b1['shift']());}};_0x1b987e(++_0x34af57);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xb7e7[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 7398059..b992d8c 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 _0x3137=['raw','where','attributes','include','map','model','Dynamics365Account','find','ShowDynamics365Account','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetDynamics365Account','findAll','options'];(function(_0x597467,_0x21c1a3){var _0x289e63=function(_0x3631fb){while(--_0x3631fb){_0x597467['push'](_0x597467['shift']());}};_0x289e63(++_0x21c1a3);}(_0x3137,0x122));var _0x7313=function(_0x1e8653,_0x9d7f2d){_0x1e8653=_0x1e8653-0x0;var _0x399810=_0x3137[_0x1e8653];return _0x399810;};'use strict';var _=require(_0x7313('0x0'));var util=require(_0x7313('0x1'));var moment=require(_0x7313('0x2'));var BPromise=require(_0x7313('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7313('0x4'));var db=require(_0x7313('0x5'))['db'];var utils=require(_0x7313('0x6'));var logger=require(_0x7313('0x7'))(_0x7313('0x8'));var config=require('../../config/environment');var jayson=require(_0x7313('0x9'));var client=jayson[_0x7313('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x485c4a,_0x50f528,_0x11f1e4){return new BPromise(function(_0x44c899,_0x39fa0b){return client[_0x7313('0xb')](_0x485c4a,_0x11f1e4)[_0x7313('0xc')](function(_0x46bfa2){logger[_0x7313('0xd')](_0x7313('0xe'),_0x50f528,_0x7313('0xf'));logger[_0x7313('0x10')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x50f528,'request\x20sent',JSON[_0x7313('0x11')](_0x46bfa2));if(_0x46bfa2[_0x7313('0x12')]){if(_0x46bfa2[_0x7313('0x12')][_0x7313('0x13')]===0x1f4){logger[_0x7313('0x12')](_0x7313('0xe'),_0x50f528,_0x46bfa2[_0x7313('0x12')][_0x7313('0x14')]);return _0x39fa0b(_0x46bfa2[_0x7313('0x12')][_0x7313('0x14')]);}logger[_0x7313('0x12')](_0x7313('0xe'),_0x50f528,_0x46bfa2[_0x7313('0x12')][_0x7313('0x14')]);return _0x44c899(_0x46bfa2[_0x7313('0x12')]['message']);}else{logger[_0x7313('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x50f528,'request\x20sent');_0x44c899(_0x46bfa2[_0x7313('0x15')][_0x7313('0x14')]);}})['catch'](function(_0x40838e){logger[_0x7313('0x12')](_0x7313('0xe'),_0x50f528,_0x40838e);_0x39fa0b(_0x40838e);});});}exports[_0x7313('0x16')]=function(_0x267a6c){var _0x3078a0=this;return new Promise(function(_0x11eac4,_0x3d5a8b){return db['Dynamics365Account'][_0x7313('0x17')]({'raw':_0x267a6c[_0x7313('0x18')]?_0x267a6c[_0x7313('0x18')][_0x7313('0x19')]===undefined?!![]:![]:!![],'where':_0x267a6c['options']?_0x267a6c[_0x7313('0x18')][_0x7313('0x1a')]||null:null,'attributes':_0x267a6c[_0x7313('0x18')]?_0x267a6c[_0x7313('0x18')][_0x7313('0x1b')]||null:null,'limit':_0x267a6c[_0x7313('0x18')]?_0x267a6c[_0x7313('0x18')]['limit']||null:null,'include':_0x267a6c[_0x7313('0x18')]?_0x267a6c[_0x7313('0x18')][_0x7313('0x1c')]?_['map'](_0x267a6c[_0x7313('0x18')]['include'],function(_0x27a91c){return{'model':db[_0x27a91c['model']],'as':_0x27a91c['as'],'attributes':_0x27a91c[_0x7313('0x1b')],'include':_0x27a91c[_0x7313('0x1c')]?_[_0x7313('0x1d')](_0x27a91c[_0x7313('0x1c')],function(_0x43ab66){return{'model':db[_0x43ab66[_0x7313('0x1e')]],'as':_0x43ab66['as'],'attributes':_0x43ab66['attributes'],'include':_0x43ab66['include']?_[_0x7313('0x1d')](_0x43ab66['include'],function(_0x50cca6){return{'model':db[_0x50cca6[_0x7313('0x1e')]],'as':_0x50cca6['as'],'attributes':_0x50cca6[_0x7313('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7313('0xc')](function(_0x3d909d){logger['info'](_0x7313('0x16'),_0x267a6c);logger[_0x7313('0x10')](_0x7313('0x16'),_0x267a6c,JSON[_0x7313('0x11')](_0x3d909d));_0x11eac4(_0x3d909d);})['catch'](function(_0x1537f2){logger[_0x7313('0x12')](_0x7313('0x16'),_0x1537f2[_0x7313('0x14')],_0x267a6c);_0x3d5a8b(_0x3078a0[_0x7313('0x12')](0x1f4,_0x1537f2[_0x7313('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x43baec){var _0x1664d3=this;return new Promise(function(_0x19b37a,_0xbdad81){return db[_0x7313('0x1f')][_0x7313('0x20')]({'raw':_0x43baec[_0x7313('0x18')]?_0x43baec[_0x7313('0x18')][_0x7313('0x19')]===undefined?!![]:![]:!![],'where':_0x43baec[_0x7313('0x18')]?_0x43baec[_0x7313('0x18')][_0x7313('0x1a')]||null:null,'attributes':_0x43baec[_0x7313('0x18')]?_0x43baec[_0x7313('0x18')][_0x7313('0x1b')]||null:null,'include':_0x43baec[_0x7313('0x18')]?_0x43baec[_0x7313('0x18')][_0x7313('0x1c')]?_[_0x7313('0x1d')](_0x43baec['options'][_0x7313('0x1c')],function(_0x2f76a5){return{'model':db[_0x2f76a5['model']],'as':_0x2f76a5['as'],'attributes':_0x2f76a5[_0x7313('0x1b')],'include':_0x2f76a5[_0x7313('0x1c')]?_[_0x7313('0x1d')](_0x2f76a5[_0x7313('0x1c')],function(_0x2aba51){return{'model':db[_0x2aba51[_0x7313('0x1e')]],'as':_0x2aba51['as'],'attributes':_0x2aba51['attributes'],'include':_0x2aba51['include']?_[_0x7313('0x1d')](_0x2aba51[_0x7313('0x1c')],function(_0x39ea7c){return{'model':db[_0x39ea7c['model']],'as':_0x39ea7c['as'],'attributes':_0x39ea7c[_0x7313('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7313('0xc')](function(_0x1d8b8d){logger['info']('ShowDynamics365Account',_0x43baec);logger[_0x7313('0x10')](_0x7313('0x21'),_0x43baec,JSON[_0x7313('0x11')](_0x1d8b8d));_0x19b37a(_0x1d8b8d);})[_0x7313('0x22')](function(_0x361ce6){logger['error'](_0x7313('0x21'),_0x361ce6['message'],_0x43baec);_0xbdad81(_0x1664d3[_0x7313('0x12')](0x1f4,_0x361ce6['message']));});});}; \ No newline at end of file +var _0x0632=['util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','map','include','model','ShowDynamics365Account','find','then','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0632,0x9f));var _0x2063=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x0632[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0x2063('0x0'));var util=require(_0x2063('0x1'));var moment=require('moment');var BPromise=require(_0x2063('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2063('0x3'));var db=require(_0x2063('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2063('0x5'));var config=require(_0x2063('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2063('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x345d79,_0x4bd3eb,_0x5e8b92){return new BPromise(function(_0x58a8e8,_0x53838c){return client[_0x2063('0x8')](_0x345d79,_0x5e8b92)['then'](function(_0x1da3e1){logger[_0x2063('0x9')](_0x2063('0xa'),_0x4bd3eb,_0x2063('0xb'));logger[_0x2063('0xc')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x4bd3eb,_0x2063('0xb'),JSON[_0x2063('0xd')](_0x1da3e1));if(_0x1da3e1[_0x2063('0xe')]){if(_0x1da3e1['error']['code']===0x1f4){logger[_0x2063('0xe')](_0x2063('0xa'),_0x4bd3eb,_0x1da3e1[_0x2063('0xe')][_0x2063('0xf')]);return _0x53838c(_0x1da3e1[_0x2063('0xe')]['message']);}logger[_0x2063('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x4bd3eb,_0x1da3e1[_0x2063('0xe')][_0x2063('0xf')]);return _0x58a8e8(_0x1da3e1[_0x2063('0xe')][_0x2063('0xf')]);}else{logger[_0x2063('0x9')](_0x2063('0xa'),_0x4bd3eb,_0x2063('0xb'));_0x58a8e8(_0x1da3e1[_0x2063('0x10')][_0x2063('0xf')]);}})[_0x2063('0x11')](function(_0x44ca0c){logger[_0x2063('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x4bd3eb,_0x44ca0c);_0x53838c(_0x44ca0c);});});}exports[_0x2063('0x12')]=function(_0x22d6e1){var _0x254850=this;return new Promise(function(_0x5d57f8,_0x4e4736){return db[_0x2063('0x13')][_0x2063('0x14')]({'raw':_0x22d6e1[_0x2063('0x15')]?_0x22d6e1[_0x2063('0x15')][_0x2063('0x16')]===undefined?!![]:![]:!![],'where':_0x22d6e1[_0x2063('0x15')]?_0x22d6e1[_0x2063('0x15')][_0x2063('0x17')]||null:null,'attributes':_0x22d6e1['options']?_0x22d6e1['options'][_0x2063('0x18')]||null:null,'limit':_0x22d6e1[_0x2063('0x15')]?_0x22d6e1[_0x2063('0x15')][_0x2063('0x19')]||null:null,'include':_0x22d6e1['options']?_0x22d6e1['options']['include']?_[_0x2063('0x1a')](_0x22d6e1[_0x2063('0x15')][_0x2063('0x1b')],function(_0x566098){return{'model':db[_0x566098[_0x2063('0x1c')]],'as':_0x566098['as'],'attributes':_0x566098[_0x2063('0x18')],'include':_0x566098['include']?_['map'](_0x566098[_0x2063('0x1b')],function(_0x5b674b){return{'model':db[_0x5b674b[_0x2063('0x1c')]],'as':_0x5b674b['as'],'attributes':_0x5b674b[_0x2063('0x18')],'include':_0x5b674b['include']?_[_0x2063('0x1a')](_0x5b674b[_0x2063('0x1b')],function(_0x1be9b5){return{'model':db[_0x1be9b5[_0x2063('0x1c')]],'as':_0x1be9b5['as'],'attributes':_0x1be9b5[_0x2063('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b26c9){logger[_0x2063('0x9')](_0x2063('0x12'),_0x22d6e1);logger[_0x2063('0xc')](_0x2063('0x12'),_0x22d6e1,JSON[_0x2063('0xd')](_0x1b26c9));_0x5d57f8(_0x1b26c9);})[_0x2063('0x11')](function(_0x3156c5){logger['error'](_0x2063('0x12'),_0x3156c5[_0x2063('0xf')],_0x22d6e1);_0x4e4736(_0x254850[_0x2063('0xe')](0x1f4,_0x3156c5['message']));});});};exports[_0x2063('0x1d')]=function(_0x625621){var _0x397afb=this;return new Promise(function(_0x28c4c6,_0x1b12ab){return db['Dynamics365Account'][_0x2063('0x1e')]({'raw':_0x625621[_0x2063('0x15')]?_0x625621['options'][_0x2063('0x16')]===undefined?!![]:![]:!![],'where':_0x625621['options']?_0x625621['options'][_0x2063('0x17')]||null:null,'attributes':_0x625621['options']?_0x625621[_0x2063('0x15')][_0x2063('0x18')]||null:null,'include':_0x625621[_0x2063('0x15')]?_0x625621[_0x2063('0x15')][_0x2063('0x1b')]?_[_0x2063('0x1a')](_0x625621[_0x2063('0x15')][_0x2063('0x1b')],function(_0x1cd6e2){return{'model':db[_0x1cd6e2[_0x2063('0x1c')]],'as':_0x1cd6e2['as'],'attributes':_0x1cd6e2['attributes'],'include':_0x1cd6e2['include']?_[_0x2063('0x1a')](_0x1cd6e2['include'],function(_0x19686c){return{'model':db[_0x19686c[_0x2063('0x1c')]],'as':_0x19686c['as'],'attributes':_0x19686c[_0x2063('0x18')],'include':_0x19686c['include']?_['map'](_0x19686c[_0x2063('0x1b')],function(_0x59b9cf){return{'model':db[_0x59b9cf[_0x2063('0x1c')]],'as':_0x59b9cf['as'],'attributes':_0x59b9cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x2063('0x1f')](function(_0x16cc18){logger[_0x2063('0x9')](_0x2063('0x1d'),_0x625621);logger[_0x2063('0xc')](_0x2063('0x1d'),_0x625621,JSON[_0x2063('0xd')](_0x16cc18));_0x28c4c6(_0x16cc18);})['catch'](function(_0x5e1a40){logger['error'](_0x2063('0x1d'),_0x5e1a40[_0x2063('0xf')],_0x625621);_0x1b12ab(_0x397afb['error'](0x1f4,_0x5e1a40[_0x2063('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 4cfb40c..1dfd0e0 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 _0xb03e=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x10dd49,_0x341851){var _0x56bef5=function(_0x3159b5){while(--_0x3159b5){_0x10dd49['push'](_0x10dd49['shift']());}};_0x56bef5(++_0x341851);}(_0xb03e,0x1eb));var _0xeb03=function(_0x45efa9,_0x472bf9){_0x45efa9=_0x45efa9-0x0;var _0x44cc8e=_0xb03e[_0x45efa9];return _0x44cc8e;};'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('0x16')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x17')]);router[_0xeb03('0x18')](_0xeb03('0xc'),auth['isAuthenticated'](),controller[_0xeb03('0x19')]);module[_0xeb03('0x1a')]=router; \ No newline at end of file +var _0x4d1f=['/:id/descriptions','getDescriptions','post','create','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intDynamics365Configuration.controller','isAuthenticated','index','get','/:id','getFields','/:id/subjects','getSubjects'];(function(_0x5b66b8,_0x11f5c4){var _0x12859d=function(_0x45a052){while(--_0x45a052){_0x5b66b8['push'](_0x5b66b8['shift']());}};_0x12859d(++_0x11f5c4);}(_0x4d1f,0x141));var _0xf4d1=function(_0x1de157,_0x7e7a8b){_0x1de157=_0x1de157-0x0;var _0x28fa7d=_0x4d1f[_0x1de157];return _0x28fa7d;};'use strict';var multer=require(_0xf4d1('0x0'));var util=require(_0xf4d1('0x1'));var path=require(_0xf4d1('0x2'));var timeout=require(_0xf4d1('0x3'));var express=require(_0xf4d1('0x4'));var router=express[_0xf4d1('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf4d1('0x6'));var config=require('../../config/environment');var controller=require(_0xf4d1('0x7'));router['get']('/',auth[_0xf4d1('0x8')](),controller[_0xf4d1('0x9')]);router[_0xf4d1('0xa')](_0xf4d1('0xb'),auth[_0xf4d1('0x8')](),controller['show']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xf4d1('0xc')]);router[_0xf4d1('0xa')](_0xf4d1('0xd'),auth[_0xf4d1('0x8')](),controller[_0xf4d1('0xe')]);router[_0xf4d1('0xa')](_0xf4d1('0xf'),auth['isAuthenticated'](),controller[_0xf4d1('0x10')]);router[_0xf4d1('0x11')]('/',auth[_0xf4d1('0x8')](),controller[_0xf4d1('0x12')]);router['put'](_0xf4d1('0xb'),auth['isAuthenticated'](),controller[_0xf4d1('0x13')]);router[_0xf4d1('0x14')](_0xf4d1('0xb'),auth[_0xf4d1('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index f0519b6..615a5be 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 _0x6e1f=['ENUM','incident','phonecall','contact','nothing','sequelize','exports','STRING'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6e1f,0x16d));var _0xf6e1=function(_0x46946a,_0x3def9b){_0x46946a=_0x46946a-0x0;var _0x1032d0=_0x6e1f[_0x46946a];return _0x1032d0;};'use strict';var Sequelize=require(_0xf6e1('0x0'));module[_0xf6e1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf6e1('0x2')]},'ticketType':{'type':Sequelize[_0xf6e1('0x3')](_0xf6e1('0x4'),_0xf6e1('0x5')),'defaultValue':_0xf6e1('0x4')},'moduleCreate':{'type':Sequelize[_0xf6e1('0x3')](_0xf6e1('0x6'),_0xf6e1('0x7')),'defaultValue':_0xf6e1('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xf6e1('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xf14c=['phonecall','ENUM','contact','nothing','sequelize','exports','STRING','incident'];(function(_0x14773e,_0x536740){var _0x3e2f59=function(_0x141de4){while(--_0x141de4){_0x14773e['push'](_0x14773e['shift']());}};_0x3e2f59(++_0x536740);}(_0xf14c,0x124));var _0xcf14=function(_0x5b73cd,_0x2e478d){_0x5b73cd=_0x5b73cd-0x0;var _0x3bbd16=_0xf14c[_0x5b73cd];return _0x3bbd16;};'use strict';var Sequelize=require(_0xcf14('0x0'));module[_0xcf14('0x1')]={'name':{'type':Sequelize[_0xcf14('0x2')]},'description':{'type':Sequelize[_0xcf14('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xcf14('0x3'),_0xcf14('0x4')),'defaultValue':_0xcf14('0x3')},'moduleCreate':{'type':Sequelize[_0xcf14('0x5')](_0xcf14('0x6'),_0xcf14('0x7')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xcf14('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 30969a3..7e0ae50 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 _0xc335=['../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','save','update','then','end','sendStatus','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','destroy','getFields','Dynamics365Field','nolimit','findOne','getSubjects','getDescriptions','pick','eml-format','rimraf','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc335,0x1c5));var _0x5c33=function(_0x2b3432,_0x307757){_0x2b3432=_0x2b3432-0x0;var _0x538cba=_0xc335[_0x2b3432];return _0x538cba;};'use strict';var emlformat=require(_0x5c33('0x0'));var rimraf=require(_0x5c33('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5c33('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5c33('0x3'));var util=require(_0x5c33('0x4'));var path=require(_0x5c33('0x5'));var sox=require(_0x5c33('0x6'));var csv=require('to-csv');var ejs=require(_0x5c33('0x7'));var fs=require('fs');var fs_extra=require(_0x5c33('0x8'));var _=require(_0x5c33('0x9'));var squel=require(_0x5c33('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5c33('0xb'));var toCsv=require(_0x5c33('0xc'));var querystring=require('querystring');var Papa=require(_0x5c33('0xd'));var Redis=require(_0x5c33('0xe'));var authService=require(_0x5c33('0xf'));var qs=require(_0x5c33('0x10'));var as=require(_0x5c33('0x11'));var hardwareService=require(_0x5c33('0x12'));var logger=require(_0x5c33('0x13'))(_0x5c33('0x14'));var utils=require(_0x5c33('0x15'));var config=require(_0x5c33('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c33('0x17'))['db'];function respondWithStatusCode(_0x1d147c,_0x1ee238){_0x1ee238=_0x1ee238||0xcc;return function(_0xf53661){if(_0xf53661){return _0x1d147c['sendStatus'](_0x1ee238);}return _0x1d147c[_0x5c33('0x18')](_0x1ee238)['end']();};}function respondWithResult(_0x359e74,_0x1b7714){_0x1b7714=_0x1b7714||0xc8;return function(_0x21fb3a){if(_0x21fb3a){return _0x359e74[_0x5c33('0x18')](_0x1b7714)[_0x5c33('0x19')](_0x21fb3a);}};}function respondWithFilteredResult(_0x50f95c,_0x2a4bd3){return function(_0x5f3a03){if(_0x5f3a03){var _0x44e0aa=typeof _0x2a4bd3['offset']===_0x5c33('0x1a')&&typeof _0x2a4bd3[_0x5c33('0x1b')]===_0x5c33('0x1a');var _0x365793=_0x5f3a03[_0x5c33('0x1c')];var _0x4a0339=_0x44e0aa?0x0:_0x2a4bd3[_0x5c33('0x1d')];var _0x5573ee=_0x44e0aa?_0x5f3a03[_0x5c33('0x1c')]:_0x2a4bd3[_0x5c33('0x1d')]+_0x2a4bd3[_0x5c33('0x1b')];var _0x1cd296;if(_0x5573ee>=_0x365793){_0x5573ee=_0x365793;_0x1cd296=0xc8;}else{_0x1cd296=0xce;}_0x50f95c[_0x5c33('0x18')](_0x1cd296);return _0x50f95c['set']('Content-Range',_0x4a0339+'-'+_0x5573ee+'/'+_0x365793)[_0x5c33('0x19')](_0x5f3a03);}return null;};}function patchUpdates(_0x47e898){return function(_0x58d7cb){try{jsonpatch['apply'](_0x58d7cb,_0x47e898,!![]);}catch(_0x185ae7){return BPromise['reject'](_0x185ae7);}return _0x58d7cb[_0x5c33('0x1e')]();};}function saveUpdates(_0x308080,_0x41719c){return function(_0x47ea8a){if(_0x47ea8a){return _0x47ea8a[_0x5c33('0x1f')](_0x308080)[_0x5c33('0x20')](function(_0x3f1bc6){return _0x3f1bc6;});}return null;};}function removeEntity(_0x1e496d,_0x571b50){return function(_0x591d14){if(_0x591d14){return _0x591d14['destroy']()[_0x5c33('0x20')](function(){_0x1e496d[_0x5c33('0x18')](0xcc)[_0x5c33('0x21')]();});}};}function handleEntityNotFound(_0x1b90c4,_0x21dea9){return function(_0x539a06){if(!_0x539a06){_0x1b90c4[_0x5c33('0x22')](0x194);}return _0x539a06;};}function handleError(_0x521e06,_0x5b878c){_0x5b878c=_0x5b878c||0x1f4;return function(_0xdf2f22){logger[_0x5c33('0x23')](_0xdf2f22[_0x5c33('0x24')]);if(_0xdf2f22[_0x5c33('0x25')]){delete _0xdf2f22[_0x5c33('0x25')];}_0x521e06[_0x5c33('0x18')](_0x5b878c)[_0x5c33('0x26')](_0xdf2f22);};}exports[_0x5c33('0x27')]=function(_0x357936,_0x4ca4f6){var _0x14c047={},_0x42e91b={},_0x2bff73={'count':0x0,'rows':[]};var _0x44b8a5=_[_0x5c33('0x28')](db[_0x5c33('0x29')][_0x5c33('0x2a')],function(_0x2f0280){return{'name':_0x2f0280[_0x5c33('0x2b')],'type':_0x2f0280['type'][_0x5c33('0x2c')]};});_0x42e91b['model']=_[_0x5c33('0x28')](_0x44b8a5,_0x5c33('0x25'));_0x42e91b[_0x5c33('0x2d')]=_['keys'](_0x357936[_0x5c33('0x2d')]);_0x42e91b[_0x5c33('0x2e')]=_[_0x5c33('0x2f')](_0x42e91b[_0x5c33('0x30')],_0x42e91b['query']);_0x14c047[_0x5c33('0x31')]=_[_0x5c33('0x2f')](_0x42e91b['model'],qs['fields'](_0x357936['query'][_0x5c33('0x32')]));_0x14c047[_0x5c33('0x31')]=_0x14c047[_0x5c33('0x31')][_0x5c33('0x33')]?_0x14c047[_0x5c33('0x31')]:_0x42e91b[_0x5c33('0x30')];if(!_0x357936[_0x5c33('0x2d')][_0x5c33('0x34')]('nolimit')){_0x14c047[_0x5c33('0x1b')]=qs[_0x5c33('0x1b')](_0x357936[_0x5c33('0x2d')]['limit']);_0x14c047[_0x5c33('0x1d')]=qs[_0x5c33('0x1d')](_0x357936[_0x5c33('0x2d')][_0x5c33('0x1d')]);}_0x14c047[_0x5c33('0x35')]=qs[_0x5c33('0x36')](_0x357936[_0x5c33('0x2d')][_0x5c33('0x36')]);_0x14c047[_0x5c33('0x37')]=qs['filters'](_['pick'](_0x357936['query'],_0x42e91b[_0x5c33('0x2e')]),_0x44b8a5);if(_0x357936[_0x5c33('0x2d')][_0x5c33('0x38')]){_0x14c047[_0x5c33('0x37')]=_[_0x5c33('0x39')](_0x14c047['where'],{'$or':_[_0x5c33('0x28')](_0x44b8a5,function(_0x2ddba9){if(_0x2ddba9[_0x5c33('0x3a')]!=='VIRTUAL'){var _0x3d338d={};_0x3d338d[_0x2ddba9[_0x5c33('0x25')]]={'$like':'%'+_0x357936[_0x5c33('0x2d')]['filter']+'%'};return _0x3d338d;}})});}_0x14c047=_[_0x5c33('0x39')]({},_0x14c047,_0x357936[_0x5c33('0x3b')]);var _0x4ef04e={'where':_0x14c047['where']};return db[_0x5c33('0x29')]['count'](_0x4ef04e)[_0x5c33('0x20')](function(_0x40cdb4){_0x2bff73[_0x5c33('0x1c')]=_0x40cdb4;if(_0x357936['query']['includeAll']){_0x14c047[_0x5c33('0x3c')]=[{'all':!![]}];}return db[_0x5c33('0x29')][_0x5c33('0x3d')](_0x14c047);})['then'](function(_0x187066){_0x2bff73[_0x5c33('0x3e')]=_0x187066;return _0x2bff73;})[_0x5c33('0x20')](respondWithFilteredResult(_0x4ca4f6,_0x14c047))[_0x5c33('0x3f')](handleError(_0x4ca4f6,null));};exports[_0x5c33('0x40')]=function(_0x4e1d28,_0x4f0da3){var _0x50ba5f={'raw':![],'where':{'id':_0x4e1d28[_0x5c33('0x41')]['id']}},_0x5b1f6c={};_0x5b1f6c['model']=_[_0x5c33('0x42')](db[_0x5c33('0x29')][_0x5c33('0x2a')]);_0x5b1f6c[_0x5c33('0x2d')]=_[_0x5c33('0x42')](_0x4e1d28[_0x5c33('0x2d')]);_0x5b1f6c[_0x5c33('0x2e')]=_[_0x5c33('0x2f')](_0x5b1f6c[_0x5c33('0x30')],_0x5b1f6c[_0x5c33('0x2d')]);_0x50ba5f[_0x5c33('0x31')]=_[_0x5c33('0x2f')](_0x5b1f6c[_0x5c33('0x30')],qs[_0x5c33('0x32')](_0x4e1d28[_0x5c33('0x2d')][_0x5c33('0x32')]));_0x50ba5f[_0x5c33('0x31')]=_0x50ba5f[_0x5c33('0x31')][_0x5c33('0x33')]?_0x50ba5f[_0x5c33('0x31')]:_0x5b1f6c[_0x5c33('0x30')];if(_0x4e1d28[_0x5c33('0x2d')][_0x5c33('0x43')]){_0x50ba5f[_0x5c33('0x3c')]=[{'all':!![]}];}_0x50ba5f=_['merge']({},_0x50ba5f,_0x4e1d28[_0x5c33('0x3b')]);return db[_0x5c33('0x29')][_0x5c33('0x44')](_0x50ba5f)[_0x5c33('0x20')](handleEntityNotFound(_0x4f0da3,null))[_0x5c33('0x20')](respondWithResult(_0x4f0da3,null))['catch'](handleError(_0x4f0da3,null));};exports[_0x5c33('0x45')]=function(_0x178d48,_0x36a7e7){return db[_0x5c33('0x29')][_0x5c33('0x45')](_0x178d48[_0x5c33('0x46')],{})[_0x5c33('0x20')](respondWithResult(_0x36a7e7,0xc9))[_0x5c33('0x3f')](handleError(_0x36a7e7,null));};exports[_0x5c33('0x1f')]=function(_0x30e32e,_0x598b24){if(_0x30e32e[_0x5c33('0x46')]['id']){delete _0x30e32e[_0x5c33('0x46')]['id'];}return db['Dynamics365Configuration'][_0x5c33('0x44')]({'where':{'id':_0x30e32e[_0x5c33('0x41')]['id']}})['then'](handleEntityNotFound(_0x598b24,null))[_0x5c33('0x20')](saveUpdates(_0x30e32e[_0x5c33('0x46')],null))[_0x5c33('0x20')](respondWithResult(_0x598b24,null))['catch'](handleError(_0x598b24,null));};exports[_0x5c33('0x47')]=function(_0x58af3b,_0x4abc3f){return db['Dynamics365Configuration']['find']({'where':{'id':_0x58af3b[_0x5c33('0x41')]['id']}})[_0x5c33('0x20')](handleEntityNotFound(_0x4abc3f,null))[_0x5c33('0x20')](removeEntity(_0x4abc3f,null))[_0x5c33('0x3f')](handleError(_0x4abc3f,null));};exports[_0x5c33('0x48')]=function(_0x10359a,_0x315a27,_0x5cb86a){var _0x40540c={};var _0x5f0c90={};var _0x57a726;var _0xd9d9c7;return db[_0x5c33('0x29')]['findOne']({'where':{'id':_0x10359a['params']['id']}})[_0x5c33('0x20')](handleEntityNotFound(_0x315a27,null))[_0x5c33('0x20')](function(_0x33b0fb){if(_0x33b0fb){_0x57a726=_0x33b0fb;_0x5f0c90[_0x5c33('0x30')]=_[_0x5c33('0x42')](db[_0x5c33('0x49')][_0x5c33('0x2a')]);_0x5f0c90[_0x5c33('0x2d')]=_[_0x5c33('0x42')](_0x10359a['query']);_0x5f0c90[_0x5c33('0x2e')]=_[_0x5c33('0x2f')](_0x5f0c90[_0x5c33('0x30')],_0x5f0c90['query']);_0x40540c['attributes']=_['intersection'](_0x5f0c90[_0x5c33('0x30')],qs[_0x5c33('0x32')](_0x10359a[_0x5c33('0x2d')][_0x5c33('0x32')]));_0x40540c['attributes']=_0x40540c[_0x5c33('0x31')][_0x5c33('0x33')]?_0x40540c[_0x5c33('0x31')]:_0x5f0c90[_0x5c33('0x30')];_0x40540c[_0x5c33('0x35')]=qs['sort'](_0x10359a[_0x5c33('0x2d')][_0x5c33('0x36')]);_0x40540c[_0x5c33('0x37')]=qs[_0x5c33('0x2e')](_['pick'](_0x10359a[_0x5c33('0x2d')],_0x5f0c90[_0x5c33('0x2e')]));if(_0x10359a[_0x5c33('0x2d')]['filter']){_0x40540c[_0x5c33('0x37')]=_[_0x5c33('0x39')](_0x40540c[_0x5c33('0x37')],{'$or':_[_0x5c33('0x28')](_0x40540c[_0x5c33('0x31')],function(_0x29f0b3){var _0x4b25ed={};_0x4b25ed[_0x29f0b3]={'$like':'%'+_0x10359a[_0x5c33('0x2d')][_0x5c33('0x38')]+'%'};return _0x4b25ed;})});}_0x40540c=_[_0x5c33('0x39')]({},_0x40540c,_0x10359a[_0x5c33('0x3b')]);return _0x57a726[_0x5c33('0x48')](_0x40540c);}})['then'](function(_0x15cf57){if(_0x15cf57){_0xd9d9c7=_0x15cf57[_0x5c33('0x33')];if(!_0x10359a[_0x5c33('0x2d')][_0x5c33('0x34')](_0x5c33('0x4a'))){_0x40540c['limit']=qs[_0x5c33('0x1b')](_0x10359a[_0x5c33('0x2d')][_0x5c33('0x1b')]);_0x40540c['offset']=qs[_0x5c33('0x1d')](_0x10359a[_0x5c33('0x2d')][_0x5c33('0x1d')]);}return _0x57a726[_0x5c33('0x48')](_0x40540c);}})['then'](function(_0xbcb695){if(_0xbcb695){return _0xbcb695?{'count':_0xd9d9c7,'rows':_0xbcb695}:null;}})[_0x5c33('0x20')](respondWithResult(_0x315a27,null))['catch'](handleError(_0x315a27,null));};exports['getSubjects']=function(_0x22068c,_0x3e21d7,_0x49f455){var _0x1b147b={};var _0x506688={};var _0x259499;var _0xe6808b;return db['Dynamics365Configuration'][_0x5c33('0x4b')]({'where':{'id':_0x22068c[_0x5c33('0x41')]['id']}})[_0x5c33('0x20')](handleEntityNotFound(_0x3e21d7,null))[_0x5c33('0x20')](function(_0x2aa2d5){if(_0x2aa2d5){_0x259499=_0x2aa2d5;_0x506688[_0x5c33('0x30')]=_[_0x5c33('0x42')](db[_0x5c33('0x49')][_0x5c33('0x2a')]);_0x506688[_0x5c33('0x2d')]=_[_0x5c33('0x42')](_0x22068c['query']);_0x506688[_0x5c33('0x2e')]=_[_0x5c33('0x2f')](_0x506688[_0x5c33('0x30')],_0x506688[_0x5c33('0x2d')]);_0x1b147b[_0x5c33('0x31')]=_[_0x5c33('0x2f')](_0x506688[_0x5c33('0x30')],qs[_0x5c33('0x32')](_0x22068c['query'][_0x5c33('0x32')]));_0x1b147b[_0x5c33('0x31')]=_0x1b147b['attributes'][_0x5c33('0x33')]?_0x1b147b[_0x5c33('0x31')]:_0x506688[_0x5c33('0x30')];_0x1b147b['order']=qs[_0x5c33('0x36')](_0x22068c[_0x5c33('0x2d')][_0x5c33('0x36')]);_0x1b147b[_0x5c33('0x37')]=qs[_0x5c33('0x2e')](_['pick'](_0x22068c[_0x5c33('0x2d')],_0x506688[_0x5c33('0x2e')]));if(_0x22068c[_0x5c33('0x2d')][_0x5c33('0x38')]){_0x1b147b['where']=_[_0x5c33('0x39')](_0x1b147b[_0x5c33('0x37')],{'$or':_[_0x5c33('0x28')](_0x1b147b[_0x5c33('0x31')],function(_0x11427e){var _0x570a37={};_0x570a37[_0x11427e]={'$like':'%'+_0x22068c[_0x5c33('0x2d')][_0x5c33('0x38')]+'%'};return _0x570a37;})});}_0x1b147b=_[_0x5c33('0x39')]({},_0x1b147b,_0x22068c[_0x5c33('0x3b')]);return _0x259499[_0x5c33('0x4c')](_0x1b147b);}})[_0x5c33('0x20')](function(_0x1b0dcc){if(_0x1b0dcc){_0xe6808b=_0x1b0dcc[_0x5c33('0x33')];if(!_0x22068c[_0x5c33('0x2d')]['hasOwnProperty'](_0x5c33('0x4a'))){_0x1b147b['limit']=qs[_0x5c33('0x1b')](_0x22068c[_0x5c33('0x2d')][_0x5c33('0x1b')]);_0x1b147b['offset']=qs[_0x5c33('0x1d')](_0x22068c[_0x5c33('0x2d')][_0x5c33('0x1d')]);}return _0x259499[_0x5c33('0x4c')](_0x1b147b);}})[_0x5c33('0x20')](function(_0x3c0e48){if(_0x3c0e48){return _0x3c0e48?{'count':_0xe6808b,'rows':_0x3c0e48}:null;}})['then'](respondWithResult(_0x3e21d7,null))[_0x5c33('0x3f')](handleError(_0x3e21d7,null));};exports[_0x5c33('0x4d')]=function(_0xaf9eef,_0x215ad9,_0x39b678){var _0x100322={};var _0x29a3f5={};var _0xe33d73;var _0x592b80;return db[_0x5c33('0x29')][_0x5c33('0x4b')]({'where':{'id':_0xaf9eef['params']['id']}})['then'](handleEntityNotFound(_0x215ad9,null))[_0x5c33('0x20')](function(_0x65f9b4){if(_0x65f9b4){_0xe33d73=_0x65f9b4;_0x29a3f5[_0x5c33('0x30')]=_[_0x5c33('0x42')](db[_0x5c33('0x49')][_0x5c33('0x2a')]);_0x29a3f5['query']=_['keys'](_0xaf9eef[_0x5c33('0x2d')]);_0x29a3f5[_0x5c33('0x2e')]=_[_0x5c33('0x2f')](_0x29a3f5[_0x5c33('0x30')],_0x29a3f5[_0x5c33('0x2d')]);_0x100322[_0x5c33('0x31')]=_[_0x5c33('0x2f')](_0x29a3f5[_0x5c33('0x30')],qs[_0x5c33('0x32')](_0xaf9eef[_0x5c33('0x2d')]['fields']));_0x100322['attributes']=_0x100322[_0x5c33('0x31')][_0x5c33('0x33')]?_0x100322[_0x5c33('0x31')]:_0x29a3f5[_0x5c33('0x30')];_0x100322['order']=qs[_0x5c33('0x36')](_0xaf9eef[_0x5c33('0x2d')]['sort']);_0x100322['where']=qs[_0x5c33('0x2e')](_[_0x5c33('0x4e')](_0xaf9eef['query'],_0x29a3f5['filters']));if(_0xaf9eef['query'][_0x5c33('0x38')]){_0x100322[_0x5c33('0x37')]=_['merge'](_0x100322['where'],{'$or':_[_0x5c33('0x28')](_0x100322['attributes'],function(_0x273766){var _0x3a4094={};_0x3a4094[_0x273766]={'$like':'%'+_0xaf9eef[_0x5c33('0x2d')]['filter']+'%'};return _0x3a4094;})});}_0x100322=_['merge']({},_0x100322,_0xaf9eef[_0x5c33('0x3b')]);return _0xe33d73[_0x5c33('0x4d')](_0x100322);}})[_0x5c33('0x20')](function(_0x4daea0){if(_0x4daea0){_0x592b80=_0x4daea0['length'];if(!_0xaf9eef[_0x5c33('0x2d')][_0x5c33('0x34')](_0x5c33('0x4a'))){_0x100322[_0x5c33('0x1b')]=qs[_0x5c33('0x1b')](_0xaf9eef[_0x5c33('0x2d')][_0x5c33('0x1b')]);_0x100322[_0x5c33('0x1d')]=qs[_0x5c33('0x1d')](_0xaf9eef['query']['offset']);}return _0xe33d73[_0x5c33('0x4d')](_0x100322);}})[_0x5c33('0x20')](function(_0x34f835){if(_0x34f835){return _0x34f835?{'count':_0x592b80,'rows':_0x34f835}:null;}})[_0x5c33('0x20')](respondWithResult(_0x215ad9,null))[_0x5c33('0x3f')](handleError(_0x215ad9,null));}; \ No newline at end of file +var _0xe852=['count','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','Dynamics365Configuration','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','params','rawAttributes','options','find','create','body','destroy','getFields','findOne','Dynamics365Field','order','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xe852,0x1c7));var _0x2e85=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xe852[_0x2b7764];return _0x848dcb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e85('0x0'));var zipdir=require(_0x2e85('0x1'));var jsonpatch=require(_0x2e85('0x2'));var rp=require(_0x2e85('0x3'));var moment=require('moment');var BPromise=require(_0x2e85('0x4'));var Mustache=require(_0x2e85('0x5'));var util=require(_0x2e85('0x6'));var path=require(_0x2e85('0x7'));var sox=require(_0x2e85('0x8'));var csv=require('to-csv');var ejs=require(_0x2e85('0x9'));var fs=require('fs');var fs_extra=require(_0x2e85('0xa'));var _=require(_0x2e85('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2e85('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2e85('0xd'));var Papa=require(_0x2e85('0xe'));var Redis=require(_0x2e85('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2e85('0x10'));var as=require(_0x2e85('0x11'));var hardwareService=require(_0x2e85('0x12'));var logger=require(_0x2e85('0x13'))(_0x2e85('0x14'));var utils=require(_0x2e85('0x15'));var config=require(_0x2e85('0x16'));var licenseUtil=require(_0x2e85('0x17'));var db=require(_0x2e85('0x18'))['db'];function respondWithStatusCode(_0x50dcd1,_0x5e58bc){_0x5e58bc=_0x5e58bc||0xcc;return function(_0x16aa1a){if(_0x16aa1a){return _0x50dcd1[_0x2e85('0x19')](_0x5e58bc);}return _0x50dcd1[_0x2e85('0x1a')](_0x5e58bc)[_0x2e85('0x1b')]();};}function respondWithResult(_0x503577,_0x2811fd){_0x2811fd=_0x2811fd||0xc8;return function(_0x438e5e){if(_0x438e5e){return _0x503577[_0x2e85('0x1a')](_0x2811fd)[_0x2e85('0x1c')](_0x438e5e);}};}function respondWithFilteredResult(_0x8f4a05,_0x4bf10d){return function(_0x4cbbe9){if(_0x4cbbe9){var _0x1cc33a=typeof _0x4bf10d[_0x2e85('0x1d')]==='undefined'&&typeof _0x4bf10d['limit']===_0x2e85('0x1e');var _0x332b2a=_0x4cbbe9[_0x2e85('0x1f')];var _0x462d96=_0x1cc33a?0x0:_0x4bf10d['offset'];var _0x395a52=_0x1cc33a?_0x4cbbe9['count']:_0x4bf10d['offset']+_0x4bf10d[_0x2e85('0x20')];var _0x33c145;if(_0x395a52>=_0x332b2a){_0x395a52=_0x332b2a;_0x33c145=0xc8;}else{_0x33c145=0xce;}_0x8f4a05[_0x2e85('0x1a')](_0x33c145);return _0x8f4a05[_0x2e85('0x21')](_0x2e85('0x22'),_0x462d96+'-'+_0x395a52+'/'+_0x332b2a)['json'](_0x4cbbe9);}return null;};}function patchUpdates(_0x4e3614){return function(_0x3d0761){try{jsonpatch['apply'](_0x3d0761,_0x4e3614,!![]);}catch(_0x127a2f){return BPromise[_0x2e85('0x23')](_0x127a2f);}return _0x3d0761[_0x2e85('0x24')]();};}function saveUpdates(_0x261a88,_0x5137d0){return function(_0x178830){if(_0x178830){return _0x178830[_0x2e85('0x25')](_0x261a88)['then'](function(_0x439a57){return _0x439a57;});}return null;};}function removeEntity(_0xce6ef7,_0x3e90ec){return function(_0x4cab8f){if(_0x4cab8f){return _0x4cab8f['destroy']()[_0x2e85('0x26')](function(){_0xce6ef7['status'](0xcc)[_0x2e85('0x1b')]();});}};}function handleEntityNotFound(_0x59ec26,_0x44ae39){return function(_0xfeaea9){if(!_0xfeaea9){_0x59ec26[_0x2e85('0x19')](0x194);}return _0xfeaea9;};}function handleError(_0x2a3223,_0x4c2cc2){_0x4c2cc2=_0x4c2cc2||0x1f4;return function(_0x3efdea){logger[_0x2e85('0x27')](_0x3efdea[_0x2e85('0x28')]);if(_0x3efdea['name']){delete _0x3efdea[_0x2e85('0x29')];}_0x2a3223['status'](_0x4c2cc2)[_0x2e85('0x2a')](_0x3efdea);};}exports[_0x2e85('0x2b')]=function(_0x3b7875,_0x32a58a){var _0x28c6c2={},_0x35cccd={},_0x12a3fa={'count':0x0,'rows':[]};var _0x529d28=_[_0x2e85('0x2c')](db[_0x2e85('0x2d')]['rawAttributes'],function(_0x47481d){return{'name':_0x47481d[_0x2e85('0x2e')],'type':_0x47481d['type'][_0x2e85('0x2f')]};});_0x35cccd[_0x2e85('0x30')]=_[_0x2e85('0x2c')](_0x529d28,'name');_0x35cccd[_0x2e85('0x31')]=_[_0x2e85('0x32')](_0x3b7875[_0x2e85('0x31')]);_0x35cccd['filters']=_[_0x2e85('0x33')](_0x35cccd['model'],_0x35cccd[_0x2e85('0x31')]);_0x28c6c2[_0x2e85('0x34')]=_[_0x2e85('0x33')](_0x35cccd['model'],qs[_0x2e85('0x35')](_0x3b7875['query']['fields']));_0x28c6c2[_0x2e85('0x34')]=_0x28c6c2[_0x2e85('0x34')][_0x2e85('0x36')]?_0x28c6c2[_0x2e85('0x34')]:_0x35cccd['model'];if(!_0x3b7875[_0x2e85('0x31')][_0x2e85('0x37')](_0x2e85('0x38'))){_0x28c6c2['limit']=qs[_0x2e85('0x20')](_0x3b7875[_0x2e85('0x31')]['limit']);_0x28c6c2[_0x2e85('0x1d')]=qs[_0x2e85('0x1d')](_0x3b7875[_0x2e85('0x31')][_0x2e85('0x1d')]);}_0x28c6c2['order']=qs[_0x2e85('0x39')](_0x3b7875[_0x2e85('0x31')][_0x2e85('0x39')]);_0x28c6c2[_0x2e85('0x3a')]=qs[_0x2e85('0x3b')](_[_0x2e85('0x3c')](_0x3b7875[_0x2e85('0x31')],_0x35cccd[_0x2e85('0x3b')]),_0x529d28);if(_0x3b7875[_0x2e85('0x31')][_0x2e85('0x3d')]){_0x28c6c2[_0x2e85('0x3a')]=_['merge'](_0x28c6c2[_0x2e85('0x3a')],{'$or':_[_0x2e85('0x2c')](_0x529d28,function(_0x21caa9){if(_0x21caa9['type']!==_0x2e85('0x3e')){var _0x48f764={};_0x48f764[_0x21caa9[_0x2e85('0x29')]]={'$like':'%'+_0x3b7875['query'][_0x2e85('0x3d')]+'%'};return _0x48f764;}})});}_0x28c6c2=_[_0x2e85('0x3f')]({},_0x28c6c2,_0x3b7875['options']);var _0x14f3ce={'where':_0x28c6c2[_0x2e85('0x3a')]};return db[_0x2e85('0x2d')]['count'](_0x14f3ce)['then'](function(_0x568ac7){_0x12a3fa[_0x2e85('0x1f')]=_0x568ac7;if(_0x3b7875[_0x2e85('0x31')][_0x2e85('0x40')]){_0x28c6c2[_0x2e85('0x41')]=[{'all':!![]}];}return db[_0x2e85('0x2d')]['findAll'](_0x28c6c2);})[_0x2e85('0x26')](function(_0x2a16a6){_0x12a3fa[_0x2e85('0x42')]=_0x2a16a6;return _0x12a3fa;})[_0x2e85('0x26')](respondWithFilteredResult(_0x32a58a,_0x28c6c2))[_0x2e85('0x43')](handleError(_0x32a58a,null));};exports['show']=function(_0x32107e,_0x33aee9){var _0x4776fb={'raw':![],'where':{'id':_0x32107e[_0x2e85('0x44')]['id']}},_0x50d5a6={};_0x50d5a6[_0x2e85('0x30')]=_[_0x2e85('0x32')](db['Dynamics365Configuration'][_0x2e85('0x45')]);_0x50d5a6[_0x2e85('0x31')]=_[_0x2e85('0x32')](_0x32107e[_0x2e85('0x31')]);_0x50d5a6[_0x2e85('0x3b')]=_[_0x2e85('0x33')](_0x50d5a6[_0x2e85('0x30')],_0x50d5a6[_0x2e85('0x31')]);_0x4776fb[_0x2e85('0x34')]=_['intersection'](_0x50d5a6[_0x2e85('0x30')],qs[_0x2e85('0x35')](_0x32107e[_0x2e85('0x31')][_0x2e85('0x35')]));_0x4776fb[_0x2e85('0x34')]=_0x4776fb[_0x2e85('0x34')][_0x2e85('0x36')]?_0x4776fb[_0x2e85('0x34')]:_0x50d5a6['model'];if(_0x32107e['query'][_0x2e85('0x40')]){_0x4776fb['include']=[{'all':!![]}];}_0x4776fb=_[_0x2e85('0x3f')]({},_0x4776fb,_0x32107e[_0x2e85('0x46')]);return db['Dynamics365Configuration'][_0x2e85('0x47')](_0x4776fb)[_0x2e85('0x26')](handleEntityNotFound(_0x33aee9,null))[_0x2e85('0x26')](respondWithResult(_0x33aee9,null))[_0x2e85('0x43')](handleError(_0x33aee9,null));};exports[_0x2e85('0x48')]=function(_0x3cec6e,_0x5c4249){return db[_0x2e85('0x2d')][_0x2e85('0x48')](_0x3cec6e['body'],{})['then'](respondWithResult(_0x5c4249,0xc9))['catch'](handleError(_0x5c4249,null));};exports[_0x2e85('0x25')]=function(_0x37e5e5,_0x5993de){if(_0x37e5e5['body']['id']){delete _0x37e5e5['body']['id'];}return db[_0x2e85('0x2d')][_0x2e85('0x47')]({'where':{'id':_0x37e5e5[_0x2e85('0x44')]['id']}})[_0x2e85('0x26')](handleEntityNotFound(_0x5993de,null))[_0x2e85('0x26')](saveUpdates(_0x37e5e5[_0x2e85('0x49')],null))[_0x2e85('0x26')](respondWithResult(_0x5993de,null))[_0x2e85('0x43')](handleError(_0x5993de,null));};exports[_0x2e85('0x4a')]=function(_0x3d8793,_0x2e47fd){return db[_0x2e85('0x2d')][_0x2e85('0x47')]({'where':{'id':_0x3d8793[_0x2e85('0x44')]['id']}})[_0x2e85('0x26')](handleEntityNotFound(_0x2e47fd,null))[_0x2e85('0x26')](removeEntity(_0x2e47fd,null))[_0x2e85('0x43')](handleError(_0x2e47fd,null));};exports[_0x2e85('0x4b')]=function(_0x7b5346,_0x57761f,_0x262f88){var _0x387c70={};var _0x2b6f27={};var _0x1861ae;var _0x5d76c8;return db[_0x2e85('0x2d')][_0x2e85('0x4c')]({'where':{'id':_0x7b5346[_0x2e85('0x44')]['id']}})[_0x2e85('0x26')](handleEntityNotFound(_0x57761f,null))[_0x2e85('0x26')](function(_0x4b61d5){if(_0x4b61d5){_0x1861ae=_0x4b61d5;_0x2b6f27[_0x2e85('0x30')]=_[_0x2e85('0x32')](db[_0x2e85('0x4d')][_0x2e85('0x45')]);_0x2b6f27[_0x2e85('0x31')]=_['keys'](_0x7b5346[_0x2e85('0x31')]);_0x2b6f27[_0x2e85('0x3b')]=_[_0x2e85('0x33')](_0x2b6f27[_0x2e85('0x30')],_0x2b6f27[_0x2e85('0x31')]);_0x387c70[_0x2e85('0x34')]=_[_0x2e85('0x33')](_0x2b6f27[_0x2e85('0x30')],qs[_0x2e85('0x35')](_0x7b5346['query'][_0x2e85('0x35')]));_0x387c70[_0x2e85('0x34')]=_0x387c70[_0x2e85('0x34')][_0x2e85('0x36')]?_0x387c70[_0x2e85('0x34')]:_0x2b6f27[_0x2e85('0x30')];_0x387c70[_0x2e85('0x4e')]=qs[_0x2e85('0x39')](_0x7b5346[_0x2e85('0x31')][_0x2e85('0x39')]);_0x387c70[_0x2e85('0x3a')]=qs['filters'](_['pick'](_0x7b5346[_0x2e85('0x31')],_0x2b6f27[_0x2e85('0x3b')]));if(_0x7b5346[_0x2e85('0x31')][_0x2e85('0x3d')]){_0x387c70[_0x2e85('0x3a')]=_[_0x2e85('0x3f')](_0x387c70[_0x2e85('0x3a')],{'$or':_[_0x2e85('0x2c')](_0x387c70['attributes'],function(_0x58acfa){var _0x4f2652={};_0x4f2652[_0x58acfa]={'$like':'%'+_0x7b5346[_0x2e85('0x31')][_0x2e85('0x3d')]+'%'};return _0x4f2652;})});}_0x387c70=_[_0x2e85('0x3f')]({},_0x387c70,_0x7b5346['options']);return _0x1861ae[_0x2e85('0x4b')](_0x387c70);}})['then'](function(_0x4c399c){if(_0x4c399c){_0x5d76c8=_0x4c399c['length'];if(!_0x7b5346[_0x2e85('0x31')][_0x2e85('0x37')](_0x2e85('0x38'))){_0x387c70['limit']=qs[_0x2e85('0x20')](_0x7b5346[_0x2e85('0x31')][_0x2e85('0x20')]);_0x387c70['offset']=qs[_0x2e85('0x1d')](_0x7b5346[_0x2e85('0x31')]['offset']);}return _0x1861ae['getFields'](_0x387c70);}})[_0x2e85('0x26')](function(_0x16a40d){if(_0x16a40d){return _0x16a40d?{'count':_0x5d76c8,'rows':_0x16a40d}:null;}})[_0x2e85('0x26')](respondWithResult(_0x57761f,null))['catch'](handleError(_0x57761f,null));};exports[_0x2e85('0x4f')]=function(_0x8950be,_0x3442a0,_0x3c31e0){var _0x308b96={};var _0x1a536b={};var _0x51c4bb;var _0x2c59ea;return db[_0x2e85('0x2d')][_0x2e85('0x4c')]({'where':{'id':_0x8950be[_0x2e85('0x44')]['id']}})[_0x2e85('0x26')](handleEntityNotFound(_0x3442a0,null))[_0x2e85('0x26')](function(_0x65e59e){if(_0x65e59e){_0x51c4bb=_0x65e59e;_0x1a536b[_0x2e85('0x30')]=_[_0x2e85('0x32')](db[_0x2e85('0x4d')][_0x2e85('0x45')]);_0x1a536b[_0x2e85('0x31')]=_['keys'](_0x8950be['query']);_0x1a536b[_0x2e85('0x3b')]=_[_0x2e85('0x33')](_0x1a536b[_0x2e85('0x30')],_0x1a536b[_0x2e85('0x31')]);_0x308b96[_0x2e85('0x34')]=_['intersection'](_0x1a536b[_0x2e85('0x30')],qs[_0x2e85('0x35')](_0x8950be[_0x2e85('0x31')][_0x2e85('0x35')]));_0x308b96[_0x2e85('0x34')]=_0x308b96[_0x2e85('0x34')][_0x2e85('0x36')]?_0x308b96[_0x2e85('0x34')]:_0x1a536b[_0x2e85('0x30')];_0x308b96[_0x2e85('0x4e')]=qs[_0x2e85('0x39')](_0x8950be[_0x2e85('0x31')][_0x2e85('0x39')]);_0x308b96['where']=qs[_0x2e85('0x3b')](_[_0x2e85('0x3c')](_0x8950be[_0x2e85('0x31')],_0x1a536b[_0x2e85('0x3b')]));if(_0x8950be[_0x2e85('0x31')][_0x2e85('0x3d')]){_0x308b96['where']=_[_0x2e85('0x3f')](_0x308b96[_0x2e85('0x3a')],{'$or':_[_0x2e85('0x2c')](_0x308b96[_0x2e85('0x34')],function(_0x335599){var _0x259fd6={};_0x259fd6[_0x335599]={'$like':'%'+_0x8950be[_0x2e85('0x31')][_0x2e85('0x3d')]+'%'};return _0x259fd6;})});}_0x308b96=_[_0x2e85('0x3f')]({},_0x308b96,_0x8950be[_0x2e85('0x46')]);return _0x51c4bb[_0x2e85('0x4f')](_0x308b96);}})[_0x2e85('0x26')](function(_0x5ca1bd){if(_0x5ca1bd){_0x2c59ea=_0x5ca1bd[_0x2e85('0x36')];if(!_0x8950be[_0x2e85('0x31')][_0x2e85('0x37')](_0x2e85('0x38'))){_0x308b96[_0x2e85('0x20')]=qs['limit'](_0x8950be[_0x2e85('0x31')][_0x2e85('0x20')]);_0x308b96[_0x2e85('0x1d')]=qs[_0x2e85('0x1d')](_0x8950be[_0x2e85('0x31')]['offset']);}return _0x51c4bb[_0x2e85('0x4f')](_0x308b96);}})[_0x2e85('0x26')](function(_0x49751e){if(_0x49751e){return _0x49751e?{'count':_0x2c59ea,'rows':_0x49751e}:null;}})[_0x2e85('0x26')](respondWithResult(_0x3442a0,null))[_0x2e85('0x43')](handleError(_0x3442a0,null));};exports[_0x2e85('0x50')]=function(_0x49f180,_0x3c8f6c,_0x5531d6){var _0x3a408c={};var _0x3b2af3={};var _0x1b6224;var _0xe9a41a;return db[_0x2e85('0x2d')]['findOne']({'where':{'id':_0x49f180['params']['id']}})['then'](handleEntityNotFound(_0x3c8f6c,null))[_0x2e85('0x26')](function(_0x3b9bbd){if(_0x3b9bbd){_0x1b6224=_0x3b9bbd;_0x3b2af3['model']=_[_0x2e85('0x32')](db[_0x2e85('0x4d')]['rawAttributes']);_0x3b2af3['query']=_[_0x2e85('0x32')](_0x49f180[_0x2e85('0x31')]);_0x3b2af3[_0x2e85('0x3b')]=_[_0x2e85('0x33')](_0x3b2af3[_0x2e85('0x30')],_0x3b2af3[_0x2e85('0x31')]);_0x3a408c['attributes']=_[_0x2e85('0x33')](_0x3b2af3['model'],qs[_0x2e85('0x35')](_0x49f180[_0x2e85('0x31')][_0x2e85('0x35')]));_0x3a408c[_0x2e85('0x34')]=_0x3a408c[_0x2e85('0x34')][_0x2e85('0x36')]?_0x3a408c['attributes']:_0x3b2af3['model'];_0x3a408c[_0x2e85('0x4e')]=qs[_0x2e85('0x39')](_0x49f180[_0x2e85('0x31')][_0x2e85('0x39')]);_0x3a408c[_0x2e85('0x3a')]=qs[_0x2e85('0x3b')](_[_0x2e85('0x3c')](_0x49f180[_0x2e85('0x31')],_0x3b2af3[_0x2e85('0x3b')]));if(_0x49f180[_0x2e85('0x31')][_0x2e85('0x3d')]){_0x3a408c['where']=_[_0x2e85('0x3f')](_0x3a408c['where'],{'$or':_[_0x2e85('0x2c')](_0x3a408c['attributes'],function(_0x1b70ea){var _0x134343={};_0x134343[_0x1b70ea]={'$like':'%'+_0x49f180[_0x2e85('0x31')]['filter']+'%'};return _0x134343;})});}_0x3a408c=_['merge']({},_0x3a408c,_0x49f180['options']);return _0x1b6224['getDescriptions'](_0x3a408c);}})[_0x2e85('0x26')](function(_0x49a4b7){if(_0x49a4b7){_0xe9a41a=_0x49a4b7[_0x2e85('0x36')];if(!_0x49f180['query'][_0x2e85('0x37')](_0x2e85('0x38'))){_0x3a408c[_0x2e85('0x20')]=qs[_0x2e85('0x20')](_0x49f180[_0x2e85('0x31')][_0x2e85('0x20')]);_0x3a408c['offset']=qs['offset'](_0x49f180[_0x2e85('0x31')][_0x2e85('0x1d')]);}return _0x1b6224[_0x2e85('0x50')](_0x3a408c);}})[_0x2e85('0x26')](function(_0x370a70){if(_0x370a70){return _0x370a70?{'count':_0xe9a41a,'rows':_0x370a70}:null;}})[_0x2e85('0x26')](respondWithResult(_0x3c8f6c,null))[_0x2e85('0x43')](handleError(_0x3c8f6c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 2e7f0b0..319112e 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 _0x34e8=['int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration'];(function(_0x10261f,_0x52e19b){var _0x26d8ea=function(_0x32b59b){while(--_0x32b59b){_0x10261f['push'](_0x10261f['shift']());}};_0x26d8ea(++_0x52e19b);}(_0x34e8,0x12c));var _0x834e=function(_0x5a16d0,_0x5e3a2b){_0x5a16d0=_0x5a16d0-0x0;var _0x4d2cb8=_0x34e8[_0x5a16d0];return _0x4d2cb8;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbec5=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird'];(function(_0x43177d,_0x94a3d4){var _0x7189ea=function(_0x2c34a9){while(--_0x2c34a9){_0x43177d['push'](_0x43177d['shift']());}};_0x7189ea(++_0x94a3d4);}(_0xbec5,0xe5));var _0x5bec=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0xbec5[_0xf2628e];return _0x13863a;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 113ddba..af19fc1 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 _0x9b48=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','lodash','util','moment','bluebird'];(function(_0x57f163,_0xad2f2b){var _0x1fac71=function(_0x2fbad3){while(--_0x2fbad3){_0x57f163['push'](_0x57f163['shift']());}};_0x1fac71(++_0xad2f2b);}(_0x9b48,0x178));var _0x89b4=function(_0x2fcbc8,_0x5b194d){_0x2fcbc8=_0x2fcbc8-0x0;var _0x51f121=_0x9b48[_0x2fcbc8];return _0x51f121;};'use strict';var _=require(_0x89b4('0x0'));var util=require(_0x89b4('0x1'));var moment=require(_0x89b4('0x2'));var BPromise=require(_0x89b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89b4('0x4'));var db=require(_0x89b4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x89b4('0x6'))('rpc');var config=require(_0x89b4('0x7'));var jayson=require(_0x89b4('0x8'));var client=jayson['client'][_0x89b4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2da0d8,_0x1b14d5,_0xc73395){return new BPromise(function(_0x5d0c5a,_0x8426e4){return client[_0x89b4('0xa')](_0x2da0d8,_0xc73395)[_0x89b4('0xb')](function(_0x3edfd0){logger['info'](_0x89b4('0xc'),_0x1b14d5,_0x89b4('0xd'));logger[_0x89b4('0xe')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x1b14d5,_0x89b4('0xd'),JSON['stringify'](_0x3edfd0));if(_0x3edfd0[_0x89b4('0xf')]){if(_0x3edfd0[_0x89b4('0xf')]['code']===0x1f4){logger[_0x89b4('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1b14d5,_0x3edfd0['error']['message']);return _0x8426e4(_0x3edfd0[_0x89b4('0xf')][_0x89b4('0x10')]);}logger['error'](_0x89b4('0xc'),_0x1b14d5,_0x3edfd0[_0x89b4('0xf')][_0x89b4('0x10')]);return _0x5d0c5a(_0x3edfd0['error'][_0x89b4('0x10')]);}else{logger[_0x89b4('0x11')](_0x89b4('0xc'),_0x1b14d5,_0x89b4('0xd'));_0x5d0c5a(_0x3edfd0[_0x89b4('0x12')][_0x89b4('0x10')]);}})['catch'](function(_0x9b6007){logger[_0x89b4('0xf')](_0x89b4('0xc'),_0x1b14d5,_0x9b6007);_0x8426e4(_0x9b6007);});});} \ No newline at end of file +var _0x825f=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring'];(function(_0x50be62,_0x23d192){var _0x2a96ee=function(_0x146384){while(--_0x146384){_0x50be62['push'](_0x50be62['shift']());}};_0x2a96ee(++_0x23d192);}(_0x825f,0x164));var _0xf825=function(_0x5d1049,_0x2dc57e){_0x5d1049=_0x5d1049-0x0;var _0x51e972=_0x825f[_0x5d1049];return _0x51e972;};'use strict';var _=require(_0xf825('0x0'));var util=require(_0xf825('0x1'));var moment=require(_0xf825('0x2'));var BPromise=require('bluebird');var rs=require(_0xf825('0x3'));var fs=require('fs');var Redis=require(_0xf825('0x4'));var db=require(_0xf825('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf825('0x6'))(_0xf825('0x7'));var config=require(_0xf825('0x8'));var jayson=require(_0xf825('0x9'));var client=jayson[_0xf825('0xa')][_0xf825('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc3a368,_0x381dbe,_0x1017d3){return new BPromise(function(_0x3556fc,_0x11a54b){return client[_0xf825('0xc')](_0xc3a368,_0x1017d3)[_0xf825('0xd')](function(_0x555912){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x381dbe,'request\x20sent');logger['debug'](_0xf825('0xe'),_0x381dbe,_0xf825('0xf'),JSON[_0xf825('0x10')](_0x555912));if(_0x555912[_0xf825('0x11')]){if(_0x555912[_0xf825('0x11')][_0xf825('0x12')]===0x1f4){logger[_0xf825('0x11')](_0xf825('0x13'),_0x381dbe,_0x555912[_0xf825('0x11')][_0xf825('0x14')]);return _0x11a54b(_0x555912['error'][_0xf825('0x14')]);}logger[_0xf825('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x381dbe,_0x555912[_0xf825('0x11')][_0xf825('0x14')]);return _0x3556fc(_0x555912[_0xf825('0x11')][_0xf825('0x14')]);}else{logger[_0xf825('0x15')](_0xf825('0x13'),_0x381dbe,_0xf825('0xf'));_0x3556fc(_0x555912[_0xf825('0x16')]['message']);}})[_0xf825('0x17')](function(_0x9c587b){logger[_0xf825('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x381dbe,_0x9c587b);_0x11a54b(_0x9c587b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index ef94dbc..75399d9 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 _0xc494=['delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x2fd3ab,_0x31ec80){var _0x34a356=function(_0xa6734f){while(--_0xa6734f){_0x2fd3ab['push'](_0x2fd3ab['shift']());}};_0x34a356(++_0x31ec80);}(_0xc494,0x1ce));var _0x4c49=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0xc494[_0x11e30d];return _0x2d4e29;};'use strict';var multer=require(_0x4c49('0x0'));var util=require(_0x4c49('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4c49('0x2'));var router=express[_0x4c49('0x3')]();var fs_extra=require(_0x4c49('0x4'));var auth=require(_0x4c49('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4c49('0x6'));var controller=require(_0x4c49('0x7'));router[_0x4c49('0x8')]('/',auth[_0x4c49('0x9')](),controller[_0x4c49('0xa')]);router[_0x4c49('0x8')](_0x4c49('0xb'),auth[_0x4c49('0x9')](),controller[_0x4c49('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4c49('0xd')]);router['put'](_0x4c49('0xb'),auth[_0x4c49('0x9')](),controller['update']);router[_0x4c49('0xe')](_0x4c49('0xb'),auth['isAuthenticated'](),controller[_0x4c49('0xf')]);module[_0x4c49('0x10')]=router; \ No newline at end of file +var _0x1c34=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path'];(function(_0x53fd68,_0x508a41){var _0x9e77bb=function(_0x16f999){while(--_0x16f999){_0x53fd68['push'](_0x53fd68['shift']());}};_0x9e77bb(++_0x508a41);}(_0x1c34,0x177));var _0x41c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c34[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x41c3('0x0'));var util=require(_0x41c3('0x1'));var path=require(_0x41c3('0x2'));var timeout=require(_0x41c3('0x3'));var express=require(_0x41c3('0x4'));var router=express['Router']();var fs_extra=require(_0x41c3('0x5'));var auth=require(_0x41c3('0x6'));var interaction=require(_0x41c3('0x7'));var config=require(_0x41c3('0x8'));var controller=require(_0x41c3('0x9'));router[_0x41c3('0xa')]('/',auth[_0x41c3('0xb')](),controller[_0x41c3('0xc')]);router['get'](_0x41c3('0xd'),auth[_0x41c3('0xb')](),controller[_0x41c3('0xe')]);router[_0x41c3('0xf')]('/',auth[_0x41c3('0xb')](),controller[_0x41c3('0x10')]);router[_0x41c3('0x11')](_0x41c3('0xd'),auth[_0x41c3('0xb')](),controller[_0x41c3('0x12')]);router[_0x41c3('0x13')](_0x41c3('0xd'),auth[_0x41c3('0xb')](),controller['destroy']);module[_0x41c3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 83ddb06..c99543c 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 _0xf955=['exports','ENUM','customVariable','picklist','string','STRING','variable','BOOLEAN'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xf955,0x1c8));var _0x5f95=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xf955[_0x47e7cb];return _0x2a8874;};'use strict';var Sequelize=require('sequelize');module[_0x5f95('0x0')]={'type':{'type':Sequelize[_0x5f95('0x1')]('string','variable',_0x5f95('0x2'),'keyValue',_0x5f95('0x3')),'defaultValue':_0x5f95('0x4')},'content':{'type':Sequelize[_0x5f95('0x5')]},'key':{'type':Sequelize[_0x5f95('0x5')]},'keyType':{'type':Sequelize[_0x5f95('0x1')](_0x5f95('0x4'),_0x5f95('0x6'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5f95('0x5')]},'nameField':{'type':Sequelize[_0x5f95('0x5')]},'customField':{'type':Sequelize[_0x5f95('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5f95('0x5')]}}; \ No newline at end of file +var _0xf0b8=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xf0b8,0x1ca));var _0x8f0b=function(_0x283c56,_0x28b37b){_0x283c56=_0x283c56-0x0;var _0x162009=_0xf0b8[_0x283c56];return _0x162009;};'use strict';var Sequelize=require(_0x8f0b('0x0'));module[_0x8f0b('0x1')]={'type':{'type':Sequelize[_0x8f0b('0x2')](_0x8f0b('0x3'),_0x8f0b('0x4'),_0x8f0b('0x5'),_0x8f0b('0x6'),_0x8f0b('0x7')),'defaultValue':_0x8f0b('0x3')},'content':{'type':Sequelize[_0x8f0b('0x8')]},'key':{'type':Sequelize[_0x8f0b('0x8')]},'keyType':{'type':Sequelize[_0x8f0b('0x2')](_0x8f0b('0x3'),_0x8f0b('0x4'),_0x8f0b('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8f0b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8f0b('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 0e9b8fa..b1c8d13 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 _0x888a=['rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','then','include','findAll','rows','catch','show','includeAll','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','update','destroy','stack','name','index','map','Dynamics365Field'];(function(_0x553e33,_0x27b81d){var _0x213f93=function(_0x26940d){while(--_0x26940d){_0x553e33['push'](_0x553e33['shift']());}};_0x213f93(++_0x27b81d);}(_0x888a,0x1e7));var _0xa888=function(_0x3bfe54,_0x3f9476){_0x3bfe54=_0x3bfe54-0x0;var _0x346be4=_0x888a[_0x3bfe54];return _0x346be4;};'use strict';var emlformat=require(_0xa888('0x0'));var rimraf=require(_0xa888('0x1'));var zipdir=require(_0xa888('0x2'));var jsonpatch=require(_0xa888('0x3'));var rp=require(_0xa888('0x4'));var moment=require(_0xa888('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa888('0x6'));var util=require(_0xa888('0x7'));var path=require(_0xa888('0x8'));var sox=require(_0xa888('0x9'));var csv=require(_0xa888('0xa'));var ejs=require(_0xa888('0xb'));var fs=require('fs');var fs_extra=require(_0xa888('0xc'));var _=require(_0xa888('0xd'));var squel=require('squel');var crypto=require(_0xa888('0xe'));var jsforce=require(_0xa888('0xf'));var deskjs=require(_0xa888('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa888('0x11'));var Papa=require(_0xa888('0x12'));var Redis=require('ioredis');var authService=require(_0xa888('0x13'));var qs=require(_0xa888('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa888('0x15'));var logger=require(_0xa888('0x16'))(_0xa888('0x17'));var utils=require(_0xa888('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa888('0x19'));var db=require(_0xa888('0x1a'))['db'];function respondWithStatusCode(_0x3e140b,_0x311f96){_0x311f96=_0x311f96||0xcc;return function(_0x5ab478){if(_0x5ab478){return _0x3e140b[_0xa888('0x1b')](_0x311f96);}return _0x3e140b[_0xa888('0x1c')](_0x311f96)[_0xa888('0x1d')]();};}function respondWithResult(_0xdd5b5f,_0x2e7a29){_0x2e7a29=_0x2e7a29||0xc8;return function(_0x40d0f7){if(_0x40d0f7){return _0xdd5b5f[_0xa888('0x1c')](_0x2e7a29)['json'](_0x40d0f7);}};}function respondWithFilteredResult(_0x34373b,_0x5d2bb4){return function(_0x3232d0){if(_0x3232d0){var _0x2be19a=typeof _0x5d2bb4[_0xa888('0x1e')]==='undefined'&&typeof _0x5d2bb4[_0xa888('0x1f')]===_0xa888('0x20');var _0x363544=_0x3232d0[_0xa888('0x21')];var _0x3a37e4=_0x2be19a?0x0:_0x5d2bb4['offset'];var _0x47ea75=_0x2be19a?_0x3232d0[_0xa888('0x21')]:_0x5d2bb4[_0xa888('0x1e')]+_0x5d2bb4[_0xa888('0x1f')];var _0x3412a6;if(_0x47ea75>=_0x363544){_0x47ea75=_0x363544;_0x3412a6=0xc8;}else{_0x3412a6=0xce;}_0x34373b[_0xa888('0x1c')](_0x3412a6);return _0x34373b[_0xa888('0x22')](_0xa888('0x23'),_0x3a37e4+'-'+_0x47ea75+'/'+_0x363544)[_0xa888('0x24')](_0x3232d0);}return null;};}function patchUpdates(_0x266574){return function(_0x5d71f1){try{jsonpatch[_0xa888('0x25')](_0x5d71f1,_0x266574,!![]);}catch(_0x5c870b){return BPromise['reject'](_0x5c870b);}return _0x5d71f1['save']();};}function saveUpdates(_0x5a82d4,_0x5ae9ae){return function(_0x5896c0){if(_0x5896c0){return _0x5896c0[_0xa888('0x26')](_0x5a82d4)['then'](function(_0x45a7ef){return _0x45a7ef;});}return null;};}function removeEntity(_0x587920,_0x4d3d28){return function(_0x33bdc2){if(_0x33bdc2){return _0x33bdc2[_0xa888('0x27')]()['then'](function(){_0x587920[_0xa888('0x1c')](0xcc)[_0xa888('0x1d')]();});}};}function handleEntityNotFound(_0x5efadd,_0xdaa48e){return function(_0x226914){if(!_0x226914){_0x5efadd[_0xa888('0x1b')](0x194);}return _0x226914;};}function handleError(_0x1f813a,_0x32be88){_0x32be88=_0x32be88||0x1f4;return function(_0x21b0fe){logger['error'](_0x21b0fe[_0xa888('0x28')]);if(_0x21b0fe[_0xa888('0x29')]){delete _0x21b0fe[_0xa888('0x29')];}_0x1f813a['status'](_0x32be88)['send'](_0x21b0fe);};}exports[_0xa888('0x2a')]=function(_0x115a2d,_0xe20f20){var _0x4a717d={},_0x2c20e3={},_0x117160={'count':0x0,'rows':[]};var _0x281b56=_[_0xa888('0x2b')](db[_0xa888('0x2c')][_0xa888('0x2d')],function(_0x3b8f54){return{'name':_0x3b8f54['fieldName'],'type':_0x3b8f54[_0xa888('0x2e')][_0xa888('0x2f')]};});_0x2c20e3[_0xa888('0x30')]=_[_0xa888('0x2b')](_0x281b56,'name');_0x2c20e3[_0xa888('0x31')]=_[_0xa888('0x32')](_0x115a2d[_0xa888('0x31')]);_0x2c20e3[_0xa888('0x33')]=_[_0xa888('0x34')](_0x2c20e3['model'],_0x2c20e3['query']);_0x4a717d[_0xa888('0x35')]=_[_0xa888('0x34')](_0x2c20e3['model'],qs[_0xa888('0x36')](_0x115a2d['query']['fields']));_0x4a717d[_0xa888('0x35')]=_0x4a717d['attributes'][_0xa888('0x37')]?_0x4a717d[_0xa888('0x35')]:_0x2c20e3['model'];if(!_0x115a2d[_0xa888('0x31')][_0xa888('0x38')]('nolimit')){_0x4a717d['limit']=qs[_0xa888('0x1f')](_0x115a2d[_0xa888('0x31')][_0xa888('0x1f')]);_0x4a717d[_0xa888('0x1e')]=qs[_0xa888('0x1e')](_0x115a2d[_0xa888('0x31')]['offset']);}_0x4a717d[_0xa888('0x39')]=qs['sort'](_0x115a2d['query'][_0xa888('0x3a')]);_0x4a717d[_0xa888('0x3b')]=qs['filters'](_[_0xa888('0x3c')](_0x115a2d[_0xa888('0x31')],_0x2c20e3[_0xa888('0x33')]),_0x281b56);if(_0x115a2d[_0xa888('0x31')]['filter']){_0x4a717d[_0xa888('0x3b')]=_[_0xa888('0x3d')](_0x4a717d['where'],{'$or':_['map'](_0x281b56,function(_0xccfac6){if(_0xccfac6['type']!==_0xa888('0x3e')){var _0x1f692f={};_0x1f692f[_0xccfac6[_0xa888('0x29')]]={'$like':'%'+_0x115a2d['query'][_0xa888('0x3f')]+'%'};return _0x1f692f;}})});}_0x4a717d=_[_0xa888('0x3d')]({},_0x4a717d,_0x115a2d[_0xa888('0x40')]);var _0x474e1e={'where':_0x4a717d[_0xa888('0x3b')]};return db[_0xa888('0x2c')]['count'](_0x474e1e)[_0xa888('0x41')](function(_0x2faa5a){_0x117160[_0xa888('0x21')]=_0x2faa5a;if(_0x115a2d['query']['includeAll']){_0x4a717d[_0xa888('0x42')]=[{'all':!![]}];}return db[_0xa888('0x2c')][_0xa888('0x43')](_0x4a717d);})[_0xa888('0x41')](function(_0x4ee55f){_0x117160[_0xa888('0x44')]=_0x4ee55f;return _0x117160;})['then'](respondWithFilteredResult(_0xe20f20,_0x4a717d))[_0xa888('0x45')](handleError(_0xe20f20,null));};exports[_0xa888('0x46')]=function(_0x4f9b37,_0x59fce0){var _0x43ddbd={'raw':!![],'where':{'id':_0x4f9b37['params']['id']}},_0x49300c={};_0x49300c[_0xa888('0x30')]=_[_0xa888('0x32')](db['Dynamics365Field'][_0xa888('0x2d')]);_0x49300c[_0xa888('0x31')]=_[_0xa888('0x32')](_0x4f9b37['query']);_0x49300c[_0xa888('0x33')]=_[_0xa888('0x34')](_0x49300c['model'],_0x49300c[_0xa888('0x31')]);_0x43ddbd['attributes']=_[_0xa888('0x34')](_0x49300c[_0xa888('0x30')],qs[_0xa888('0x36')](_0x4f9b37[_0xa888('0x31')][_0xa888('0x36')]));_0x43ddbd[_0xa888('0x35')]=_0x43ddbd[_0xa888('0x35')][_0xa888('0x37')]?_0x43ddbd[_0xa888('0x35')]:_0x49300c[_0xa888('0x30')];if(_0x4f9b37[_0xa888('0x31')][_0xa888('0x47')]){_0x43ddbd[_0xa888('0x42')]=[{'all':!![]}];}_0x43ddbd=_[_0xa888('0x3d')]({},_0x43ddbd,_0x4f9b37['options']);return db[_0xa888('0x2c')]['find'](_0x43ddbd)['then'](handleEntityNotFound(_0x59fce0,null))[_0xa888('0x41')](respondWithResult(_0x59fce0,null))[_0xa888('0x45')](handleError(_0x59fce0,null));};exports[_0xa888('0x48')]=function(_0x51a621,_0x6c224c){return db['Dynamics365Field'][_0xa888('0x48')](_0x51a621['body'],{})['then'](respondWithResult(_0x6c224c,0xc9))[_0xa888('0x45')](handleError(_0x6c224c,null));};exports[_0xa888('0x26')]=function(_0x3b5284,_0x124b19){if(_0x3b5284[_0xa888('0x49')]['id']){delete _0x3b5284[_0xa888('0x49')]['id'];}return db[_0xa888('0x2c')][_0xa888('0x4a')]({'where':{'id':_0x3b5284['params']['id']}})['then'](handleEntityNotFound(_0x124b19,null))[_0xa888('0x41')](saveUpdates(_0x3b5284[_0xa888('0x49')],null))[_0xa888('0x41')](respondWithResult(_0x124b19,null))['catch'](handleError(_0x124b19,null));};exports[_0xa888('0x27')]=function(_0x5df28b,_0x54001e){return db[_0xa888('0x2c')][_0xa888('0x4a')]({'where':{'id':_0x5df28b[_0xa888('0x4b')]['id']}})['then'](handleEntityNotFound(_0x54001e,null))[_0xa888('0x41')](removeEntity(_0x54001e,null))[_0xa888('0x45')](handleError(_0x54001e,null));}; \ No newline at end of file +var _0x2dac=['attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Dynamics365Field','fieldName','type','map','query','keys','filters','model'];(function(_0x113a6c,_0x10df30){var _0x1ac632=function(_0xbd4fb9){while(--_0xbd4fb9){_0x113a6c['push'](_0x113a6c['shift']());}};_0x1ac632(++_0x10df30);}(_0x2dac,0x19d));var _0xc2da=function(_0x4ae77b,_0xb24a06){_0x4ae77b=_0x4ae77b-0x0;var _0x3e2ebc=_0x2dac[_0x4ae77b];return _0x3e2ebc;};'use strict';var emlformat=require(_0xc2da('0x0'));var rimraf=require(_0xc2da('0x1'));var zipdir=require(_0xc2da('0x2'));var jsonpatch=require(_0xc2da('0x3'));var rp=require(_0xc2da('0x4'));var moment=require('moment');var BPromise=require(_0xc2da('0x5'));var Mustache=require(_0xc2da('0x6'));var util=require(_0xc2da('0x7'));var path=require(_0xc2da('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc2da('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc2da('0xa'));var squel=require(_0xc2da('0xb'));var crypto=require(_0xc2da('0xc'));var jsforce=require(_0xc2da('0xd'));var deskjs=require(_0xc2da('0xe'));var toCsv=require(_0xc2da('0xf'));var querystring=require('querystring');var Papa=require(_0xc2da('0x10'));var Redis=require(_0xc2da('0x11'));var authService=require(_0xc2da('0x12'));var qs=require(_0xc2da('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc2da('0x14'));var logger=require(_0xc2da('0x15'))(_0xc2da('0x16'));var utils=require(_0xc2da('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc2da('0x18'));var db=require(_0xc2da('0x19'))['db'];function respondWithStatusCode(_0x579f09,_0x8b85f){_0x8b85f=_0x8b85f||0xcc;return function(_0x12ac96){if(_0x12ac96){return _0x579f09[_0xc2da('0x1a')](_0x8b85f);}return _0x579f09[_0xc2da('0x1b')](_0x8b85f)[_0xc2da('0x1c')]();};}function respondWithResult(_0x403e29,_0x301cd9){_0x301cd9=_0x301cd9||0xc8;return function(_0x513e60){if(_0x513e60){return _0x403e29[_0xc2da('0x1b')](_0x301cd9)[_0xc2da('0x1d')](_0x513e60);}};}function respondWithFilteredResult(_0x489836,_0x42c2dd){return function(_0x415d72){if(_0x415d72){var _0xc4ee9a=typeof _0x42c2dd['offset']==='undefined'&&typeof _0x42c2dd[_0xc2da('0x1e')]===_0xc2da('0x1f');var _0x4e9f54=_0x415d72[_0xc2da('0x20')];var _0x256a02=_0xc4ee9a?0x0:_0x42c2dd[_0xc2da('0x21')];var _0x48454e=_0xc4ee9a?_0x415d72[_0xc2da('0x20')]:_0x42c2dd[_0xc2da('0x21')]+_0x42c2dd['limit'];var _0x36b9fa;if(_0x48454e>=_0x4e9f54){_0x48454e=_0x4e9f54;_0x36b9fa=0xc8;}else{_0x36b9fa=0xce;}_0x489836[_0xc2da('0x1b')](_0x36b9fa);return _0x489836[_0xc2da('0x22')](_0xc2da('0x23'),_0x256a02+'-'+_0x48454e+'/'+_0x4e9f54)[_0xc2da('0x1d')](_0x415d72);}return null;};}function patchUpdates(_0x3204a9){return function(_0x27e1cf){try{jsonpatch[_0xc2da('0x24')](_0x27e1cf,_0x3204a9,!![]);}catch(_0x201cde){return BPromise[_0xc2da('0x25')](_0x201cde);}return _0x27e1cf[_0xc2da('0x26')]();};}function saveUpdates(_0x12f87c,_0x29f143){return function(_0x11758f){if(_0x11758f){return _0x11758f[_0xc2da('0x27')](_0x12f87c)[_0xc2da('0x28')](function(_0x4b0802){return _0x4b0802;});}return null;};}function removeEntity(_0x1754ab,_0x17f9d6){return function(_0x29e38d){if(_0x29e38d){return _0x29e38d[_0xc2da('0x29')]()[_0xc2da('0x28')](function(){_0x1754ab['status'](0xcc)[_0xc2da('0x1c')]();});}};}function handleEntityNotFound(_0x2e456a,_0x527b17){return function(_0x312efe){if(!_0x312efe){_0x2e456a[_0xc2da('0x1a')](0x194);}return _0x312efe;};}function handleError(_0x32fb1a,_0x5f3166){_0x5f3166=_0x5f3166||0x1f4;return function(_0x2d436c){logger[_0xc2da('0x2a')](_0x2d436c[_0xc2da('0x2b')]);if(_0x2d436c[_0xc2da('0x2c')]){delete _0x2d436c[_0xc2da('0x2c')];}_0x32fb1a['status'](_0x5f3166)[_0xc2da('0x2d')](_0x2d436c);};}exports[_0xc2da('0x2e')]=function(_0x4b4bfd,_0x3e79a5){var _0x52ee52={},_0x19347b={},_0x1967a8={'count':0x0,'rows':[]};var _0x457114=_['map'](db[_0xc2da('0x2f')]['rawAttributes'],function(_0x47f662){return{'name':_0x47f662[_0xc2da('0x30')],'type':_0x47f662[_0xc2da('0x31')]['key']};});_0x19347b['model']=_[_0xc2da('0x32')](_0x457114,_0xc2da('0x2c'));_0x19347b[_0xc2da('0x33')]=_[_0xc2da('0x34')](_0x4b4bfd['query']);_0x19347b[_0xc2da('0x35')]=_['intersection'](_0x19347b[_0xc2da('0x36')],_0x19347b[_0xc2da('0x33')]);_0x52ee52[_0xc2da('0x37')]=_[_0xc2da('0x38')](_0x19347b[_0xc2da('0x36')],qs[_0xc2da('0x39')](_0x4b4bfd[_0xc2da('0x33')][_0xc2da('0x39')]));_0x52ee52[_0xc2da('0x37')]=_0x52ee52[_0xc2da('0x37')]['length']?_0x52ee52['attributes']:_0x19347b[_0xc2da('0x36')];if(!_0x4b4bfd[_0xc2da('0x33')][_0xc2da('0x3a')](_0xc2da('0x3b'))){_0x52ee52[_0xc2da('0x1e')]=qs[_0xc2da('0x1e')](_0x4b4bfd[_0xc2da('0x33')][_0xc2da('0x1e')]);_0x52ee52[_0xc2da('0x21')]=qs['offset'](_0x4b4bfd[_0xc2da('0x33')][_0xc2da('0x21')]);}_0x52ee52[_0xc2da('0x3c')]=qs['sort'](_0x4b4bfd[_0xc2da('0x33')][_0xc2da('0x3d')]);_0x52ee52[_0xc2da('0x3e')]=qs[_0xc2da('0x35')](_[_0xc2da('0x3f')](_0x4b4bfd[_0xc2da('0x33')],_0x19347b[_0xc2da('0x35')]),_0x457114);if(_0x4b4bfd[_0xc2da('0x33')]['filter']){_0x52ee52[_0xc2da('0x3e')]=_[_0xc2da('0x40')](_0x52ee52[_0xc2da('0x3e')],{'$or':_[_0xc2da('0x32')](_0x457114,function(_0x178b22){if(_0x178b22['type']!==_0xc2da('0x41')){var _0x55ca92={};_0x55ca92[_0x178b22['name']]={'$like':'%'+_0x4b4bfd[_0xc2da('0x33')][_0xc2da('0x42')]+'%'};return _0x55ca92;}})});}_0x52ee52=_['merge']({},_0x52ee52,_0x4b4bfd[_0xc2da('0x43')]);var _0xc8e4bc={'where':_0x52ee52[_0xc2da('0x3e')]};return db[_0xc2da('0x2f')][_0xc2da('0x20')](_0xc8e4bc)[_0xc2da('0x28')](function(_0x36e32f){_0x1967a8[_0xc2da('0x20')]=_0x36e32f;if(_0x4b4bfd[_0xc2da('0x33')][_0xc2da('0x44')]){_0x52ee52[_0xc2da('0x45')]=[{'all':!![]}];}return db[_0xc2da('0x2f')][_0xc2da('0x46')](_0x52ee52);})[_0xc2da('0x28')](function(_0x2bb230){_0x1967a8['rows']=_0x2bb230;return _0x1967a8;})[_0xc2da('0x28')](respondWithFilteredResult(_0x3e79a5,_0x52ee52))['catch'](handleError(_0x3e79a5,null));};exports[_0xc2da('0x47')]=function(_0x8e7439,_0x25161e){var _0x17ba6f={'raw':!![],'where':{'id':_0x8e7439[_0xc2da('0x48')]['id']}},_0x4dd04e={};_0x4dd04e['model']=_[_0xc2da('0x34')](db['Dynamics365Field'][_0xc2da('0x49')]);_0x4dd04e['query']=_['keys'](_0x8e7439[_0xc2da('0x33')]);_0x4dd04e[_0xc2da('0x35')]=_['intersection'](_0x4dd04e['model'],_0x4dd04e[_0xc2da('0x33')]);_0x17ba6f[_0xc2da('0x37')]=_[_0xc2da('0x38')](_0x4dd04e['model'],qs[_0xc2da('0x39')](_0x8e7439[_0xc2da('0x33')][_0xc2da('0x39')]));_0x17ba6f[_0xc2da('0x37')]=_0x17ba6f[_0xc2da('0x37')]['length']?_0x17ba6f[_0xc2da('0x37')]:_0x4dd04e[_0xc2da('0x36')];if(_0x8e7439['query'][_0xc2da('0x44')]){_0x17ba6f['include']=[{'all':!![]}];}_0x17ba6f=_[_0xc2da('0x40')]({},_0x17ba6f,_0x8e7439[_0xc2da('0x43')]);return db[_0xc2da('0x2f')][_0xc2da('0x4a')](_0x17ba6f)[_0xc2da('0x28')](handleEntityNotFound(_0x25161e,null))['then'](respondWithResult(_0x25161e,null))[_0xc2da('0x4b')](handleError(_0x25161e,null));};exports[_0xc2da('0x4c')]=function(_0xd2dd4d,_0x457b04){return db['Dynamics365Field'][_0xc2da('0x4c')](_0xd2dd4d['body'],{})[_0xc2da('0x28')](respondWithResult(_0x457b04,0xc9))[_0xc2da('0x4b')](handleError(_0x457b04,null));};exports[_0xc2da('0x27')]=function(_0x269ecf,_0x4d6058){if(_0x269ecf[_0xc2da('0x4d')]['id']){delete _0x269ecf[_0xc2da('0x4d')]['id'];}return db['Dynamics365Field'][_0xc2da('0x4a')]({'where':{'id':_0x269ecf[_0xc2da('0x48')]['id']}})['then'](handleEntityNotFound(_0x4d6058,null))['then'](saveUpdates(_0x269ecf[_0xc2da('0x4d')],null))['then'](respondWithResult(_0x4d6058,null))['catch'](handleError(_0x4d6058,null));};exports[_0xc2da('0x29')]=function(_0x44dbba,_0x31e03e){return db[_0xc2da('0x2f')][_0xc2da('0x4a')]({'where':{'id':_0x44dbba[_0xc2da('0x48')]['id']}})[_0xc2da('0x28')](handleEntityNotFound(_0x31e03e,null))[_0xc2da('0x28')](removeEntity(_0x31e03e,null))[_0xc2da('0x4b')](handleError(_0x31e03e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 2d74b21..d809ba4 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 _0x8c7a=['request-promise','path','rimraf','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','FieldId','util','../../config/logger','moment'];(function(_0x2bfe32,_0x2fed4f){var _0x38b467=function(_0x1e2a9b){while(--_0x1e2a9b){_0x2bfe32['push'](_0x2bfe32['shift']());}};_0x38b467(++_0x2fed4f);}(_0x8c7a,0x168));var _0xa8c7=function(_0x1ef96e,_0x237f03){_0x1ef96e=_0x1ef96e-0x0;var _0x4f0ae9=_0x8c7a[_0x1ef96e];return _0x4f0ae9;};'use strict';var _=require('lodash');var util=require(_0xa8c7('0x0'));var logger=require(_0xa8c7('0x1'))('api');var moment=require(_0xa8c7('0x2'));var BPromise=require('bluebird');var rp=require(_0xa8c7('0x3'));var fs=require('fs');var path=require(_0xa8c7('0x4'));var rimraf=require(_0xa8c7('0x5'));var config=require('../../config/environment');var attributes=require(_0xa8c7('0x6'));module['exports']=function(_0x2f229b,_0x3f9191){return _0x2f229b[_0xa8c7('0x7')](_0xa8c7('0x8'),attributes,{'tableName':_0xa8c7('0x9'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0xa8c7('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4446=['../../config/environment','./intDynamics365Field.attributes','exports','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4446,0x11f));var _0x6444=function(_0x367921,_0x4785eb){_0x367921=_0x367921-0x0;var _0x4be157=_0x4446[_0x367921];return _0x4be157;};'use strict';var _=require('lodash');var util=require(_0x6444('0x0'));var logger=require(_0x6444('0x1'))(_0x6444('0x2'));var moment=require(_0x6444('0x3'));var BPromise=require(_0x6444('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6444('0x5'));var rimraf=require(_0x6444('0x6'));var config=require(_0x6444('0x7'));var attributes=require(_0x6444('0x8'));module[_0x6444('0x9')]=function(_0x3625f9,_0x37f6b7){return _0x3625f9['define']('Dynamics365Field',attributes,{'tableName':_0x6444('0xa'),'paranoid':![],'indexes':[{'name':_0x6444('0xb'),'fields':[_0x6444('0xc'),_0x6444('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index d4e0e71..084b82d 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 _0x0bca=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment'];(function(_0x4f01fa,_0x4de1d5){var _0xd8454e=function(_0x3e088d){while(--_0x3e088d){_0x4f01fa['push'](_0x4f01fa['shift']());}};_0xd8454e(++_0x4de1d5);}(_0x0bca,0x1b7));var _0xa0bc=function(_0x18c8dc,_0x510c11){_0x18c8dc=_0x18c8dc-0x0;var _0x5b1272=_0x0bca[_0x18c8dc];return _0x5b1272;};'use strict';var _=require(_0xa0bc('0x0'));var util=require('util');var moment=require(_0xa0bc('0x1'));var BPromise=require(_0xa0bc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa0bc('0x3'));var db=require(_0xa0bc('0x4'))['db'];var utils=require(_0xa0bc('0x5'));var logger=require(_0xa0bc('0x6'))('rpc');var config=require(_0xa0bc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa0bc('0x8')][_0xa0bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384742,_0x4c4283,_0x4c0977){return new BPromise(function(_0xad3010,_0x4ed448){return client[_0xa0bc('0xa')](_0x384742,_0x4c0977)[_0xa0bc('0xb')](function(_0x5453f6){logger[_0xa0bc('0xc')](_0xa0bc('0xd'),_0x4c4283,_0xa0bc('0xe'));logger[_0xa0bc('0xf')](_0xa0bc('0x10'),_0x4c4283,_0xa0bc('0xe'),JSON[_0xa0bc('0x11')](_0x5453f6));if(_0x5453f6[_0xa0bc('0x12')]){if(_0x5453f6['error'][_0xa0bc('0x13')]===0x1f4){logger[_0xa0bc('0x12')](_0xa0bc('0xd'),_0x4c4283,_0x5453f6['error'][_0xa0bc('0x14')]);return _0x4ed448(_0x5453f6[_0xa0bc('0x12')][_0xa0bc('0x14')]);}logger[_0xa0bc('0x12')](_0xa0bc('0xd'),_0x4c4283,_0x5453f6[_0xa0bc('0x12')][_0xa0bc('0x14')]);return _0xad3010(_0x5453f6[_0xa0bc('0x12')][_0xa0bc('0x14')]);}else{logger['info'](_0xa0bc('0xd'),_0x4c4283,_0xa0bc('0xe'));_0xad3010(_0x5453f6['result'][_0xa0bc('0x14')]);}})['catch'](function(_0x16dd79){logger[_0xa0bc('0x12')](_0xa0bc('0xd'),_0x4c4283,_0x16dd79);_0x4ed448(_0x16dd79);});});} \ No newline at end of file +var _0xa3c8=['Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x7b8ee7,_0x453a79){var _0x5cd139=function(_0x580faa){while(--_0x580faa){_0x7b8ee7['push'](_0x7b8ee7['shift']());}};_0x5cd139(++_0x453a79);}(_0xa3c8,0x1b6));var _0x8a3c=function(_0x3905d5,_0x13fb24){_0x3905d5=_0x3905d5-0x0;var _0x4500c9=_0xa3c8[_0x3905d5];return _0x4500c9;};'use strict';var _=require(_0x8a3c('0x0'));var util=require(_0x8a3c('0x1'));var moment=require(_0x8a3c('0x2'));var BPromise=require(_0x8a3c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a3c('0x4'))['db'];var utils=require(_0x8a3c('0x5'));var logger=require(_0x8a3c('0x6'))(_0x8a3c('0x7'));var config=require(_0x8a3c('0x8'));var jayson=require(_0x8a3c('0x9'));var client=jayson[_0x8a3c('0xa')][_0x8a3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46a85b,_0x1483f5,_0x3b1476){return new BPromise(function(_0x564fa9,_0x42525a){return client[_0x8a3c('0xc')](_0x46a85b,_0x3b1476)[_0x8a3c('0xd')](function(_0x27a70a){logger[_0x8a3c('0xe')](_0x8a3c('0xf'),_0x1483f5,_0x8a3c('0x10'));logger[_0x8a3c('0x11')](_0x8a3c('0x12'),_0x1483f5,_0x8a3c('0x10'),JSON['stringify'](_0x27a70a));if(_0x27a70a[_0x8a3c('0x13')]){if(_0x27a70a[_0x8a3c('0x13')][_0x8a3c('0x14')]===0x1f4){logger[_0x8a3c('0x13')](_0x8a3c('0xf'),_0x1483f5,_0x27a70a[_0x8a3c('0x13')][_0x8a3c('0x15')]);return _0x42525a(_0x27a70a['error'][_0x8a3c('0x15')]);}logger['error'](_0x8a3c('0xf'),_0x1483f5,_0x27a70a[_0x8a3c('0x13')][_0x8a3c('0x15')]);return _0x564fa9(_0x27a70a[_0x8a3c('0x13')]['message']);}else{logger[_0x8a3c('0xe')](_0x8a3c('0xf'),_0x1483f5,_0x8a3c('0x10'));_0x564fa9(_0x27a70a[_0x8a3c('0x16')][_0x8a3c('0x15')]);}})[_0x8a3c('0x17')](function(_0x5a8acb){logger[_0x8a3c('0x13')](_0x8a3c('0xf'),_0x1483f5,_0x5a8acb);_0x42525a(_0x5a8acb);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index e7c2650..db89bfd 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 _0xc711=['/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index'];(function(_0x35233d,_0x2535e6){var _0x438a5d=function(_0x3d9fbf){while(--_0x3d9fbf){_0x35233d['push'](_0x35233d['shift']());}};_0x438a5d(++_0x2535e6);}(_0xc711,0x67));var _0x1c71=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xc711[_0x494d1f];return _0x457b6e;};'use strict';var multer=require(_0x1c71('0x0'));var util=require(_0x1c71('0x1'));var path=require(_0x1c71('0x2'));var timeout=require(_0x1c71('0x3'));var express=require(_0x1c71('0x4'));var router=express['Router']();var fs_extra=require(_0x1c71('0x5'));var auth=require(_0x1c71('0x6'));var interaction=require(_0x1c71('0x7'));var config=require(_0x1c71('0x8'));var controller=require(_0x1c71('0x9'));router[_0x1c71('0xa')]('/',auth['isAuthenticated'](),controller[_0x1c71('0xb')]);router['get'](_0x1c71('0xc'),auth[_0x1c71('0xd')](),controller[_0x1c71('0xe')]);router['get'](_0x1c71('0xf'),auth[_0x1c71('0xd')](),controller[_0x1c71('0x10')]);router['get'](_0x1c71('0x11'),auth[_0x1c71('0xd')](),controller[_0x1c71('0x12')]);router[_0x1c71('0x13')]('/',auth[_0x1c71('0xd')](),controller['create']);router['post'](_0x1c71('0xf'),auth[_0x1c71('0xd')](),controller['addConfiguration']);router[_0x1c71('0x14')](_0x1c71('0xc'),auth[_0x1c71('0xd')](),controller['update']);router[_0x1c71('0x15')](_0x1c71('0xc'),auth[_0x1c71('0xd')](),controller['destroy']);module[_0x1c71('0x16')]=router; \ No newline at end of file +var _0x215e=['put','delete','destroy','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','index','/:id','/:id/configurations','isAuthenticated','getFields','post','create','addConfiguration'];(function(_0x120b0d,_0x1885ed){var _0x970527=function(_0x32ca9d){while(--_0x32ca9d){_0x120b0d['push'](_0x120b0d['shift']());}};_0x970527(++_0x1885ed);}(_0x215e,0x1f2));var _0xe215=function(_0x4c667f,_0x7c6439){_0x4c667f=_0x4c667f-0x0;var _0x436e8c=_0x215e[_0x4c667f];return _0x436e8c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe215('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe215('0x1')]();var fs_extra=require(_0xe215('0x2'));var auth=require(_0xe215('0x3'));var interaction=require(_0xe215('0x4'));var config=require('../../config/environment');var controller=require(_0xe215('0x5'));router[_0xe215('0x6')]('/',auth['isAuthenticated'](),controller[_0xe215('0x7')]);router[_0xe215('0x6')](_0xe215('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xe215('0x6')](_0xe215('0x9'),auth[_0xe215('0xa')](),controller['getConfigurations']);router[_0xe215('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0xe215('0xb')]);router[_0xe215('0xc')]('/',auth['isAuthenticated'](),controller[_0xe215('0xd')]);router[_0xe215('0xc')](_0xe215('0x9'),auth[_0xe215('0xa')](),controller[_0xe215('0xe')]);router[_0xe215('0xf')]('/:id',auth[_0xe215('0xa')](),controller['update']);router[_0xe215('0x10')](_0xe215('0x8'),auth[_0xe215('0xa')](),controller[_0xe215('0x11')]);module[_0xe215('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 94205ea..226f088 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 _0x0b0e=['STRING','username','remoteUri','sequelize'];(function(_0x149bef,_0x133bb7){var _0x3b2f7d=function(_0x69b485){while(--_0x69b485){_0x149bef['push'](_0x149bef['shift']());}};_0x3b2f7d(++_0x133bb7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x0b0e[_0x163040];return _0x364667;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0b0('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x2')},'apiKey':{'type':Sequelize[_0xe0b0('0x1')]},'remoteUri':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x3')},'serverUrl':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xeb3b=['sequelize','exports','STRING'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x469fc4,_0x427a80){_0x469fc4=_0x469fc4-0x0;var _0x11f6d4=_0xeb3b[_0x469fc4];return _0x11f6d4;};'use strict';var Sequelize=require(_0xbeb3('0x0'));module[_0xbeb3('0x1')]={'name':{'type':Sequelize[_0xbeb3('0x2')]},'description':{'type':Sequelize[_0xbeb3('0x2')]},'username':{'type':Sequelize[_0xbeb3('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbeb3('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xbeb3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index f41b87d..bbe1b05 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 _0xb688=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','index','map','FreshdeskAccount','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','name','options','findAll','rows','catch','show','includeAll','include','find','create','params','body','findOne','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','FreshdeskConfiguration','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','format','api/v2/ticket_fields','toString','requester','subject','description','priority','group','source','company','includes','default','custom_text','label','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xb688,0xcf));var _0x8b68=function(_0x3cf78d,_0x3a467a){_0x3cf78d=_0x3cf78d-0x0;var _0x35e8d6=_0xb688[_0x3cf78d];return _0x35e8d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b68('0x0'));var zipdir=require(_0x8b68('0x1'));var jsonpatch=require(_0x8b68('0x2'));var rp=require(_0x8b68('0x3'));var moment=require(_0x8b68('0x4'));var BPromise=require(_0x8b68('0x5'));var Mustache=require('mustache');var util=require(_0x8b68('0x6'));var path=require(_0x8b68('0x7'));var sox=require(_0x8b68('0x8'));var csv=require(_0x8b68('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b68('0xa'));var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0x9'));var querystring=require(_0x8b68('0xf'));var Papa=require(_0x8b68('0x10'));var Redis=require(_0x8b68('0x11'));var authService=require(_0x8b68('0x12'));var qs=require(_0x8b68('0x13'));var as=require(_0x8b68('0x14'));var hardwareService=require(_0x8b68('0x15'));var logger=require(_0x8b68('0x16'))('api');var utils=require(_0x8b68('0x17'));var config=require(_0x8b68('0x18'));var licenseUtil=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];var integrations=require(_0x8b68('0x1b'));function respondWithStatusCode(_0x2f3af4,_0xaa8725){_0xaa8725=_0xaa8725||0xcc;return function(_0x137c8e){if(_0x137c8e){return _0x2f3af4[_0x8b68('0x1c')](_0xaa8725);}return _0x2f3af4['status'](_0xaa8725)[_0x8b68('0x1d')]();};}function respondWithResult(_0x509033,_0x5e3c66){_0x5e3c66=_0x5e3c66||0xc8;return function(_0x22f75b){if(_0x22f75b){return _0x509033[_0x8b68('0x1e')](_0x5e3c66)[_0x8b68('0x1f')](_0x22f75b);}};}function respondWithFilteredResult(_0x5d3468,_0x5c8d0e){return function(_0x23bd52){if(_0x23bd52){var _0x5c1e44=typeof _0x5c8d0e[_0x8b68('0x20')]===_0x8b68('0x21')&&typeof _0x5c8d0e[_0x8b68('0x22')]===_0x8b68('0x21');var _0x491695=_0x23bd52[_0x8b68('0x23')];var _0x203dd4=_0x5c1e44?0x0:_0x5c8d0e['offset'];var _0x42b3bd=_0x5c1e44?_0x23bd52[_0x8b68('0x23')]:_0x5c8d0e[_0x8b68('0x20')]+_0x5c8d0e[_0x8b68('0x22')];var _0x38b7a7;if(_0x42b3bd>=_0x491695){_0x42b3bd=_0x491695;_0x38b7a7=0xc8;}else{_0x38b7a7=0xce;}_0x5d3468['status'](_0x38b7a7);return _0x5d3468[_0x8b68('0x24')](_0x8b68('0x25'),_0x203dd4+'-'+_0x42b3bd+'/'+_0x491695)[_0x8b68('0x1f')](_0x23bd52);}return null;};}function patchUpdates(_0x1a9788){return function(_0x35d055){try{jsonpatch[_0x8b68('0x26')](_0x35d055,_0x1a9788,!![]);}catch(_0x5603d4){return BPromise['reject'](_0x5603d4);}return _0x35d055[_0x8b68('0x27')]();};}function saveUpdates(_0x59cb26,_0x332202){return function(_0x30b6d0){if(_0x30b6d0){return _0x30b6d0[_0x8b68('0x28')](_0x59cb26)[_0x8b68('0x29')](function(_0x32ddc5){return _0x32ddc5;});}return null;};}function removeEntity(_0x173524,_0x59bb8a){return function(_0x1a6fe8){if(_0x1a6fe8){return _0x1a6fe8[_0x8b68('0x2a')]()['then'](function(){_0x173524[_0x8b68('0x1e')](0xcc)[_0x8b68('0x1d')]();});}};}function handleEntityNotFound(_0x240b0b,_0x5590ec){return function(_0x511ccf){if(!_0x511ccf){_0x240b0b['sendStatus'](0x194);}return _0x511ccf;};}function handleError(_0x92d186,_0x448e43){_0x448e43=_0x448e43||0x1f4;return function(_0x2ba2a3){logger['error'](_0x2ba2a3[_0x8b68('0x2b')]);if(_0x2ba2a3['name']){delete _0x2ba2a3['name'];}_0x92d186[_0x8b68('0x1e')](_0x448e43)['send'](_0x2ba2a3);};}exports[_0x8b68('0x2c')]=function(_0x3ac356,_0x48e2c8){var _0x494ce4={},_0x357635={},_0x1cd230={'count':0x0,'rows':[]};var _0x1e7c06=_[_0x8b68('0x2d')](db[_0x8b68('0x2e')][_0x8b68('0x2f')],function(_0x460c37){return{'name':_0x460c37['fieldName'],'type':_0x460c37[_0x8b68('0x30')]['key']};});_0x357635[_0x8b68('0x31')]=_[_0x8b68('0x2d')](_0x1e7c06,'name');_0x357635[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x3ac356[_0x8b68('0x32')]);_0x357635['filters']=_['intersection'](_0x357635[_0x8b68('0x31')],_0x357635[_0x8b68('0x32')]);_0x494ce4[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x357635[_0x8b68('0x31')],qs[_0x8b68('0x36')](_0x3ac356[_0x8b68('0x32')][_0x8b68('0x36')]));_0x494ce4[_0x8b68('0x34')]=_0x494ce4[_0x8b68('0x34')][_0x8b68('0x37')]?_0x494ce4[_0x8b68('0x34')]:_0x357635[_0x8b68('0x31')];if(!_0x3ac356[_0x8b68('0x32')][_0x8b68('0x38')](_0x8b68('0x39'))){_0x494ce4[_0x8b68('0x22')]=qs[_0x8b68('0x22')](_0x3ac356[_0x8b68('0x32')][_0x8b68('0x22')]);_0x494ce4[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x3ac356['query']['offset']);}_0x494ce4[_0x8b68('0x3a')]=qs[_0x8b68('0x3b')](_0x3ac356[_0x8b68('0x32')][_0x8b68('0x3b')]);_0x494ce4[_0x8b68('0x3c')]=qs[_0x8b68('0x3d')](_[_0x8b68('0x3e')](_0x3ac356[_0x8b68('0x32')],_0x357635['filters']),_0x1e7c06);if(_0x3ac356[_0x8b68('0x32')][_0x8b68('0x3f')]){_0x494ce4[_0x8b68('0x3c')]=_[_0x8b68('0x40')](_0x494ce4[_0x8b68('0x3c')],{'$or':_[_0x8b68('0x2d')](_0x1e7c06,function(_0xff4080){if(_0xff4080[_0x8b68('0x30')]!=='VIRTUAL'){var _0x3f874c={};_0x3f874c[_0xff4080[_0x8b68('0x41')]]={'$like':'%'+_0x3ac356[_0x8b68('0x32')][_0x8b68('0x3f')]+'%'};return _0x3f874c;}})});}_0x494ce4=_[_0x8b68('0x40')]({},_0x494ce4,_0x3ac356[_0x8b68('0x42')]);var _0xa748c2={'where':_0x494ce4['where']};return db[_0x8b68('0x2e')][_0x8b68('0x23')](_0xa748c2)['then'](function(_0x14ec40){_0x1cd230[_0x8b68('0x23')]=_0x14ec40;if(_0x3ac356['query']['includeAll']){_0x494ce4['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0x8b68('0x43')](_0x494ce4);})[_0x8b68('0x29')](function(_0x515815){_0x1cd230[_0x8b68('0x44')]=_0x515815;return _0x1cd230;})['then'](respondWithFilteredResult(_0x48e2c8,_0x494ce4))[_0x8b68('0x45')](handleError(_0x48e2c8,null));};exports[_0x8b68('0x46')]=function(_0x5a3193,_0x2f90d9){var _0x5ae345={'raw':![],'where':{'id':_0x5a3193['params']['id']}},_0x4a718c={};_0x4a718c[_0x8b68('0x31')]=_[_0x8b68('0x33')](db[_0x8b68('0x2e')][_0x8b68('0x2f')]);_0x4a718c['query']=_[_0x8b68('0x33')](_0x5a3193['query']);_0x4a718c[_0x8b68('0x3d')]=_[_0x8b68('0x35')](_0x4a718c['model'],_0x4a718c[_0x8b68('0x32')]);_0x5ae345[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x4a718c[_0x8b68('0x31')],qs['fields'](_0x5a3193[_0x8b68('0x32')][_0x8b68('0x36')]));_0x5ae345[_0x8b68('0x34')]=_0x5ae345[_0x8b68('0x34')][_0x8b68('0x37')]?_0x5ae345[_0x8b68('0x34')]:_0x4a718c[_0x8b68('0x31')];if(_0x5a3193[_0x8b68('0x32')][_0x8b68('0x47')]){_0x5ae345[_0x8b68('0x48')]=[{'all':!![]}];}_0x5ae345=_[_0x8b68('0x40')]({},_0x5ae345,_0x5a3193[_0x8b68('0x42')]);return db[_0x8b68('0x2e')][_0x8b68('0x49')](_0x5ae345)[_0x8b68('0x29')](handleEntityNotFound(_0x2f90d9,null))[_0x8b68('0x29')](respondWithResult(_0x2f90d9,null))['catch'](handleError(_0x2f90d9,null));};exports[_0x8b68('0x4a')]=function(_0x20681a,_0x5dd099){return db[_0x8b68('0x2e')]['create'](_0x20681a['body'],{})['then'](respondWithResult(_0x5dd099,0xc9))[_0x8b68('0x45')](handleError(_0x5dd099,null));};exports[_0x8b68('0x28')]=function(_0x34047c,_0x6da48b){if(_0x34047c['body']['id']){delete _0x34047c['body']['id'];}return db[_0x8b68('0x2e')][_0x8b68('0x49')]({'where':{'id':_0x34047c[_0x8b68('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6da48b,null))[_0x8b68('0x29')](saveUpdates(_0x34047c[_0x8b68('0x4c')],null))['then'](respondWithResult(_0x6da48b,null))[_0x8b68('0x45')](handleError(_0x6da48b,null));};exports[_0x8b68('0x2a')]=function(_0x595942,_0x18a9ae){return db[_0x8b68('0x2e')]['find']({'where':{'id':_0x595942[_0x8b68('0x4b')]['id']}})[_0x8b68('0x29')](handleEntityNotFound(_0x18a9ae,null))['then'](removeEntity(_0x18a9ae,null))['catch'](handleError(_0x18a9ae,null));};exports['getConfigurations']=function(_0x28f82d,_0x42eabd,_0x3718b2){var _0x3d4b4f={};var _0x55aad3={};var _0x5a1711;var _0x4492fd;return db[_0x8b68('0x2e')][_0x8b68('0x4d')]({'where':{'id':_0x28f82d['params']['id']}})[_0x8b68('0x29')](handleEntityNotFound(_0x42eabd,null))[_0x8b68('0x29')](function(_0x3f9d34){if(_0x3f9d34){_0x5a1711=_0x3f9d34;_0x55aad3['model']=_[_0x8b68('0x33')](db['FreshdeskConfiguration'][_0x8b68('0x2f')]);_0x55aad3[_0x8b68('0x32')]=_['keys'](_0x28f82d[_0x8b68('0x32')]);_0x55aad3[_0x8b68('0x3d')]=_[_0x8b68('0x35')](_0x55aad3[_0x8b68('0x31')],_0x55aad3[_0x8b68('0x32')]);_0x3d4b4f['attributes']=_[_0x8b68('0x35')](_0x55aad3[_0x8b68('0x31')],qs[_0x8b68('0x36')](_0x28f82d[_0x8b68('0x32')][_0x8b68('0x36')]));_0x3d4b4f[_0x8b68('0x34')]=_0x3d4b4f[_0x8b68('0x34')][_0x8b68('0x37')]?_0x3d4b4f['attributes']:_0x55aad3[_0x8b68('0x31')];_0x3d4b4f[_0x8b68('0x3a')]=qs[_0x8b68('0x3b')](_0x28f82d[_0x8b68('0x32')][_0x8b68('0x3b')]);_0x3d4b4f[_0x8b68('0x3c')]=qs[_0x8b68('0x3d')](_[_0x8b68('0x3e')](_0x28f82d[_0x8b68('0x32')],_0x55aad3[_0x8b68('0x3d')]));if(_0x28f82d[_0x8b68('0x32')][_0x8b68('0x3f')]){_0x3d4b4f[_0x8b68('0x3c')]=_[_0x8b68('0x40')](_0x3d4b4f[_0x8b68('0x3c')],{'$or':_[_0x8b68('0x2d')](_0x3d4b4f[_0x8b68('0x34')],function(_0x3da7b4){var _0xae90f0={};_0xae90f0[_0x3da7b4]={'$like':'%'+_0x28f82d[_0x8b68('0x32')]['filter']+'%'};return _0xae90f0;})});}_0x3d4b4f=_[_0x8b68('0x40')]({},_0x3d4b4f,_0x28f82d['options']);return _0x5a1711['getConfigurations'](_0x3d4b4f);}})[_0x8b68('0x29')](function(_0x5d2476){if(_0x5d2476){_0x4492fd=_0x5d2476[_0x8b68('0x37')];if(!_0x28f82d[_0x8b68('0x32')][_0x8b68('0x38')]('nolimit')){_0x3d4b4f[_0x8b68('0x22')]=qs[_0x8b68('0x22')](_0x28f82d[_0x8b68('0x32')][_0x8b68('0x22')]);_0x3d4b4f[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x28f82d[_0x8b68('0x32')]['offset']);}return _0x5a1711['getConfigurations'](_0x3d4b4f);}})[_0x8b68('0x29')](function(_0x4224f5){if(_0x4224f5){return _0x4224f5?{'count':_0x4492fd,'rows':_0x4224f5}:null;}})[_0x8b68('0x29')](respondWithResult(_0x42eabd,null))[_0x8b68('0x45')](handleError(_0x42eabd,null));};exports[_0x8b68('0x4e')]=function(_0x37da34,_0x2d1519,_0x314f1e){if(_0x37da34[_0x8b68('0x4c')]['id']){delete _0x37da34[_0x8b68('0x4c')]['id'];}return db[_0x8b68('0x2e')][_0x8b68('0x4d')]({'where':{'id':_0x37da34[_0x8b68('0x4b')]['id']}})[_0x8b68('0x29')](handleEntityNotFound(_0x2d1519,null))[_0x8b68('0x29')](function(_0x414096){if(_0x414096){_0x37da34[_0x8b68('0x4c')][_0x8b68('0x4f')]=_0x414096['id'];_0x37da34['body']['Subjects']=integrations[_0x8b68('0x50')](_0x37da34[_0x8b68('0x4c')]['channel'],_0x37da34['body']['type']);_0x37da34[_0x8b68('0x4c')][_0x8b68('0x51')]=integrations[_0x8b68('0x52')](_0x37da34[_0x8b68('0x4c')][_0x8b68('0x53')],_0x37da34['body'][_0x8b68('0x30')]);return db[_0x8b68('0x54')]['create'](_0x37da34[_0x8b68('0x4c')],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0x8b68('0x51')}]});}return null;})[_0x8b68('0x29')](respondWithResult(_0x2d1519,null))[_0x8b68('0x45')](handleError(_0x2d1519,null));};exports[_0x8b68('0x55')]=function(_0x864b6b,_0x1fc24c,_0x35b22b){var _0x34456d='';return db[_0x8b68('0x2e')][_0x8b68('0x4d')]({'where':{'id':_0x864b6b['params']['id']},'attributes':['id',_0x8b68('0x56'),_0x8b68('0x57')]})[_0x8b68('0x29')](handleEntityNotFound(_0x1fc24c,null))['then'](function(_0x5deaba){if(_0x5deaba){_0x34456d=_0x5deaba[_0x8b68('0x56')];var _0x1966f6=_0x34456d['slice'](-0x1);if(_0x1966f6==='/'){_0x34456d=_0x34456d[_0x8b68('0x58')](0x0,_0x34456d[_0x8b68('0x59')](_0x1966f6));}return rp({'method':_0x8b68('0x5a'),'uri':util[_0x8b68('0x5b')]('%s/%s',_0x34456d,_0x8b68('0x5c')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x8b68('0x5b')]('%s:X',_0x5deaba[_0x8b68('0x57')]))[_0x8b68('0x5d')]('base64'))},'json':!![]});}})[_0x8b68('0x29')](function(_0x11abf9){if(_0x11abf9){var _0x1525da=[_0x8b68('0x5e'),_0x8b68('0x5f'),'agent',_0x8b68('0x60'),_0x8b68('0x1e'),_0x8b68('0x61'),_0x8b68('0x62'),_0x8b68('0x63'),'ticket_type','group',_0x8b68('0x64')];_['remove'](_0x11abf9,function(_0x2d442a){return _0x1525da[_0x8b68('0x65')](_0x2d442a[_0x8b68('0x41')])||!_0x2d442a[_0x8b68('0x66')]&&_0x2d442a[_0x8b68('0x30')]!==_0x8b68('0x67')&&_0x2d442a[_0x8b68('0x30')]!=='custom_dropdown';});return{'count':_0x11abf9[_0x8b68('0x37')],'rows':_['map'](_0x11abf9,function(_0x3aaaed){return{'id':_0x3aaaed[_0x8b68('0x41')],'name':_0x3aaaed[_0x8b68('0x68')],'custom':!_0x3aaaed['default'],'options':_0x3aaaed[_0x8b68('0x69')]?_['map'](_0x3aaaed[_0x8b68('0x69')],function(_0x4bb4a5){return{'name':_[_0x8b68('0x6a')](_0x4bb4a5),'value':_0x4bb4a5};}):[]};})};}})[_0x8b68('0x29')](respondWithResult(_0x1fc24c,null))[_0x8b68('0x45')](function(_0x5ce3f8){var _0x33b775=_0x864b6b[_0x8b68('0x32')][_0x8b68('0x6b')]?0x1f4:_0x5ce3f8[_0x8b68('0x6c')]||0x1f4;logger[_0x8b68('0x6d')](_0x8b68('0x6e'),_0x8b68('0x55'),_0x33b775,JSON[_0x8b68('0x6f')](_0x5ce3f8));delete _0x5ce3f8[_0x8b68('0x41')];if(_0x33b775===0x191){_0x33b775=0x190;}_0x1fc24c['status'](_0x33b775)[_0x8b68('0x70')](_0x864b6b[_0x8b68('0x32')][_0x8b68('0x6b')]?{'message':_0x8b68('0x71'),'statusCode':_0x5ce3f8[_0x8b68('0x6c')]}:_0x5ce3f8);});}; \ No newline at end of file +var _0xd139=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','FreshdeskAccount','type','key','filters','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','keys','intersection','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','rawAttributes','pick','addConfiguration','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','base64','subject','agent','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5761a3,_0x41847e){var _0x19da15=function(_0x204948){while(--_0x204948){_0x5761a3['push'](_0x5761a3['shift']());}};_0x19da15(++_0x41847e);}(_0xd139,0x14e));var _0x9d13=function(_0x212b74,_0x566f3d){_0x212b74=_0x212b74-0x0;var _0x1e7000=_0xd139[_0x212b74];return _0x1e7000;};'use strict';var emlformat=require(_0x9d13('0x0'));var rimraf=require(_0x9d13('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9d13('0x2'));var moment=require(_0x9d13('0x3'));var BPromise=require(_0x9d13('0x4'));var Mustache=require(_0x9d13('0x5'));var util=require(_0x9d13('0x6'));var path=require(_0x9d13('0x7'));var sox=require(_0x9d13('0x8'));var csv=require('to-csv');var ejs=require(_0x9d13('0x9'));var fs=require('fs');var fs_extra=require(_0x9d13('0xa'));var _=require('lodash');var squel=require(_0x9d13('0xb'));var crypto=require('crypto');var jsforce=require(_0x9d13('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9d13('0xd'));var Redis=require(_0x9d13('0xe'));var authService=require(_0x9d13('0xf'));var qs=require(_0x9d13('0x10'));var as=require(_0x9d13('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d13('0x12'))(_0x9d13('0x13'));var utils=require(_0x9d13('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9d13('0x15'))['db'];var integrations=require(_0x9d13('0x16'));function respondWithStatusCode(_0x39020,_0x331fea){_0x331fea=_0x331fea||0xcc;return function(_0x22acf6){if(_0x22acf6){return _0x39020['sendStatus'](_0x331fea);}return _0x39020['status'](_0x331fea)[_0x9d13('0x17')]();};}function respondWithResult(_0x43bf27,_0x2f5442){_0x2f5442=_0x2f5442||0xc8;return function(_0x3ea042){if(_0x3ea042){return _0x43bf27[_0x9d13('0x18')](_0x2f5442)[_0x9d13('0x19')](_0x3ea042);}};}function respondWithFilteredResult(_0x38f368,_0x47bcd3){return function(_0x3acfc1){if(_0x3acfc1){var _0x1b473e=typeof _0x47bcd3[_0x9d13('0x1a')]===_0x9d13('0x1b')&&typeof _0x47bcd3[_0x9d13('0x1c')]===_0x9d13('0x1b');var _0x223872=_0x3acfc1[_0x9d13('0x1d')];var _0x45a07a=_0x1b473e?0x0:_0x47bcd3[_0x9d13('0x1a')];var _0xa1de89=_0x1b473e?_0x3acfc1[_0x9d13('0x1d')]:_0x47bcd3[_0x9d13('0x1a')]+_0x47bcd3['limit'];var _0x42b9c1;if(_0xa1de89>=_0x223872){_0xa1de89=_0x223872;_0x42b9c1=0xc8;}else{_0x42b9c1=0xce;}_0x38f368[_0x9d13('0x18')](_0x42b9c1);return _0x38f368[_0x9d13('0x1e')](_0x9d13('0x1f'),_0x45a07a+'-'+_0xa1de89+'/'+_0x223872)['json'](_0x3acfc1);}return null;};}function patchUpdates(_0x48ce3d){return function(_0x5c9e1a){try{jsonpatch[_0x9d13('0x20')](_0x5c9e1a,_0x48ce3d,!![]);}catch(_0x3706e7){return BPromise[_0x9d13('0x21')](_0x3706e7);}return _0x5c9e1a[_0x9d13('0x22')]();};}function saveUpdates(_0x3971e0,_0x3040e7){return function(_0xfb6245){if(_0xfb6245){return _0xfb6245[_0x9d13('0x23')](_0x3971e0)['then'](function(_0xb34817){return _0xb34817;});}return null;};}function removeEntity(_0xd5a981,_0x22963f){return function(_0x21999c){if(_0x21999c){return _0x21999c['destroy']()[_0x9d13('0x24')](function(){_0xd5a981['status'](0xcc)[_0x9d13('0x17')]();});}};}function handleEntityNotFound(_0xfaf587,_0xe0c57){return function(_0x3a3c97){if(!_0x3a3c97){_0xfaf587[_0x9d13('0x25')](0x194);}return _0x3a3c97;};}function handleError(_0x45a299,_0x1c36e5){_0x1c36e5=_0x1c36e5||0x1f4;return function(_0xb2a42d){logger['error'](_0xb2a42d[_0x9d13('0x26')]);if(_0xb2a42d['name']){delete _0xb2a42d[_0x9d13('0x27')];}_0x45a299[_0x9d13('0x18')](_0x1c36e5)[_0x9d13('0x28')](_0xb2a42d);};}exports[_0x9d13('0x29')]=function(_0x5ebfaf,_0x23c91f){var _0x441118={},_0x3dcc6c={},_0x34e5df={'count':0x0,'rows':[]};var _0x1412ca=_[_0x9d13('0x2a')](db[_0x9d13('0x2b')]['rawAttributes'],function(_0x7c953f){return{'name':_0x7c953f['fieldName'],'type':_0x7c953f[_0x9d13('0x2c')][_0x9d13('0x2d')]};});_0x3dcc6c['model']=_[_0x9d13('0x2a')](_0x1412ca,_0x9d13('0x27'));_0x3dcc6c['query']=_['keys'](_0x5ebfaf['query']);_0x3dcc6c[_0x9d13('0x2e')]=_['intersection'](_0x3dcc6c[_0x9d13('0x2f')],_0x3dcc6c[_0x9d13('0x30')]);_0x441118[_0x9d13('0x31')]=_['intersection'](_0x3dcc6c[_0x9d13('0x2f')],qs[_0x9d13('0x32')](_0x5ebfaf[_0x9d13('0x30')][_0x9d13('0x32')]));_0x441118['attributes']=_0x441118['attributes'][_0x9d13('0x33')]?_0x441118[_0x9d13('0x31')]:_0x3dcc6c['model'];if(!_0x5ebfaf[_0x9d13('0x30')][_0x9d13('0x34')](_0x9d13('0x35'))){_0x441118[_0x9d13('0x1c')]=qs[_0x9d13('0x1c')](_0x5ebfaf[_0x9d13('0x30')][_0x9d13('0x1c')]);_0x441118['offset']=qs[_0x9d13('0x1a')](_0x5ebfaf['query']['offset']);}_0x441118['order']=qs[_0x9d13('0x36')](_0x5ebfaf[_0x9d13('0x30')][_0x9d13('0x36')]);_0x441118[_0x9d13('0x37')]=qs[_0x9d13('0x2e')](_['pick'](_0x5ebfaf[_0x9d13('0x30')],_0x3dcc6c[_0x9d13('0x2e')]),_0x1412ca);if(_0x5ebfaf[_0x9d13('0x30')][_0x9d13('0x38')]){_0x441118[_0x9d13('0x37')]=_[_0x9d13('0x39')](_0x441118['where'],{'$or':_[_0x9d13('0x2a')](_0x1412ca,function(_0x2c72b1){if(_0x2c72b1[_0x9d13('0x2c')]!=='VIRTUAL'){var _0x51e025={};_0x51e025[_0x2c72b1[_0x9d13('0x27')]]={'$like':'%'+_0x5ebfaf[_0x9d13('0x30')][_0x9d13('0x38')]+'%'};return _0x51e025;}})});}_0x441118=_['merge']({},_0x441118,_0x5ebfaf[_0x9d13('0x3a')]);var _0x198fe7={'where':_0x441118['where']};return db[_0x9d13('0x2b')][_0x9d13('0x1d')](_0x198fe7)[_0x9d13('0x24')](function(_0x46ea19){_0x34e5df[_0x9d13('0x1d')]=_0x46ea19;if(_0x5ebfaf[_0x9d13('0x30')][_0x9d13('0x3b')]){_0x441118[_0x9d13('0x3c')]=[{'all':!![]}];}return db[_0x9d13('0x2b')]['findAll'](_0x441118);})[_0x9d13('0x24')](function(_0x1d2ee6){_0x34e5df[_0x9d13('0x3d')]=_0x1d2ee6;return _0x34e5df;})[_0x9d13('0x24')](respondWithFilteredResult(_0x23c91f,_0x441118))[_0x9d13('0x3e')](handleError(_0x23c91f,null));};exports[_0x9d13('0x3f')]=function(_0x395972,_0x5635f4){var _0x30114a={'raw':![],'where':{'id':_0x395972[_0x9d13('0x40')]['id']}},_0x2bc4f6={};_0x2bc4f6[_0x9d13('0x2f')]=_[_0x9d13('0x41')](db[_0x9d13('0x2b')]['rawAttributes']);_0x2bc4f6['query']=_[_0x9d13('0x41')](_0x395972['query']);_0x2bc4f6[_0x9d13('0x2e')]=_['intersection'](_0x2bc4f6[_0x9d13('0x2f')],_0x2bc4f6[_0x9d13('0x30')]);_0x30114a[_0x9d13('0x31')]=_[_0x9d13('0x42')](_0x2bc4f6[_0x9d13('0x2f')],qs['fields'](_0x395972[_0x9d13('0x30')][_0x9d13('0x32')]));_0x30114a[_0x9d13('0x31')]=_0x30114a[_0x9d13('0x31')][_0x9d13('0x33')]?_0x30114a[_0x9d13('0x31')]:_0x2bc4f6[_0x9d13('0x2f')];if(_0x395972[_0x9d13('0x30')][_0x9d13('0x3b')]){_0x30114a[_0x9d13('0x3c')]=[{'all':!![]}];}_0x30114a=_['merge']({},_0x30114a,_0x395972['options']);return db[_0x9d13('0x2b')][_0x9d13('0x43')](_0x30114a)['then'](handleEntityNotFound(_0x5635f4,null))[_0x9d13('0x24')](respondWithResult(_0x5635f4,null))['catch'](handleError(_0x5635f4,null));};exports[_0x9d13('0x44')]=function(_0x20b834,_0x503850){return db['FreshdeskAccount'][_0x9d13('0x44')](_0x20b834[_0x9d13('0x45')],{})[_0x9d13('0x24')](respondWithResult(_0x503850,0xc9))[_0x9d13('0x3e')](handleError(_0x503850,null));};exports[_0x9d13('0x23')]=function(_0x70514d,_0x35e67e){if(_0x70514d[_0x9d13('0x45')]['id']){delete _0x70514d[_0x9d13('0x45')]['id'];}return db['FreshdeskAccount'][_0x9d13('0x43')]({'where':{'id':_0x70514d['params']['id']}})['then'](handleEntityNotFound(_0x35e67e,null))[_0x9d13('0x24')](saveUpdates(_0x70514d['body'],null))[_0x9d13('0x24')](respondWithResult(_0x35e67e,null))[_0x9d13('0x3e')](handleError(_0x35e67e,null));};exports[_0x9d13('0x46')]=function(_0x5dde68,_0x1aca60){return db[_0x9d13('0x2b')]['find']({'where':{'id':_0x5dde68[_0x9d13('0x40')]['id']}})[_0x9d13('0x24')](handleEntityNotFound(_0x1aca60,null))[_0x9d13('0x24')](removeEntity(_0x1aca60,null))[_0x9d13('0x3e')](handleError(_0x1aca60,null));};exports[_0x9d13('0x47')]=function(_0x171968,_0xf26caa,_0x5878ba){var _0x1ade50={};var _0x2c4f42={};var _0x172f8a;var _0x259628;return db[_0x9d13('0x2b')][_0x9d13('0x48')]({'where':{'id':_0x171968[_0x9d13('0x40')]['id']}})[_0x9d13('0x24')](handleEntityNotFound(_0xf26caa,null))[_0x9d13('0x24')](function(_0x415629){if(_0x415629){_0x172f8a=_0x415629;_0x2c4f42['model']=_[_0x9d13('0x41')](db[_0x9d13('0x49')][_0x9d13('0x4a')]);_0x2c4f42['query']=_[_0x9d13('0x41')](_0x171968['query']);_0x2c4f42['filters']=_[_0x9d13('0x42')](_0x2c4f42['model'],_0x2c4f42[_0x9d13('0x30')]);_0x1ade50[_0x9d13('0x31')]=_[_0x9d13('0x42')](_0x2c4f42[_0x9d13('0x2f')],qs[_0x9d13('0x32')](_0x171968[_0x9d13('0x30')][_0x9d13('0x32')]));_0x1ade50[_0x9d13('0x31')]=_0x1ade50[_0x9d13('0x31')]['length']?_0x1ade50[_0x9d13('0x31')]:_0x2c4f42['model'];_0x1ade50['order']=qs[_0x9d13('0x36')](_0x171968[_0x9d13('0x30')][_0x9d13('0x36')]);_0x1ade50[_0x9d13('0x37')]=qs[_0x9d13('0x2e')](_[_0x9d13('0x4b')](_0x171968[_0x9d13('0x30')],_0x2c4f42[_0x9d13('0x2e')]));if(_0x171968[_0x9d13('0x30')][_0x9d13('0x38')]){_0x1ade50[_0x9d13('0x37')]=_[_0x9d13('0x39')](_0x1ade50[_0x9d13('0x37')],{'$or':_[_0x9d13('0x2a')](_0x1ade50[_0x9d13('0x31')],function(_0x15f646){var _0x5b5efb={};_0x5b5efb[_0x15f646]={'$like':'%'+_0x171968[_0x9d13('0x30')]['filter']+'%'};return _0x5b5efb;})});}_0x1ade50=_['merge']({},_0x1ade50,_0x171968[_0x9d13('0x3a')]);return _0x172f8a['getConfigurations'](_0x1ade50);}})[_0x9d13('0x24')](function(_0x14055b){if(_0x14055b){_0x259628=_0x14055b[_0x9d13('0x33')];if(!_0x171968[_0x9d13('0x30')][_0x9d13('0x34')]('nolimit')){_0x1ade50[_0x9d13('0x1c')]=qs['limit'](_0x171968[_0x9d13('0x30')]['limit']);_0x1ade50[_0x9d13('0x1a')]=qs[_0x9d13('0x1a')](_0x171968[_0x9d13('0x30')][_0x9d13('0x1a')]);}return _0x172f8a[_0x9d13('0x47')](_0x1ade50);}})[_0x9d13('0x24')](function(_0x241728){if(_0x241728){return _0x241728?{'count':_0x259628,'rows':_0x241728}:null;}})[_0x9d13('0x24')](respondWithResult(_0xf26caa,null))['catch'](handleError(_0xf26caa,null));};exports[_0x9d13('0x4c')]=function(_0xcc18e2,_0x5d78bd,_0x5b9ef6){if(_0xcc18e2[_0x9d13('0x45')]['id']){delete _0xcc18e2[_0x9d13('0x45')]['id'];}return db['FreshdeskAccount'][_0x9d13('0x48')]({'where':{'id':_0xcc18e2[_0x9d13('0x40')]['id']}})['then'](handleEntityNotFound(_0x5d78bd,null))[_0x9d13('0x24')](function(_0x5099f8){if(_0x5099f8){_0xcc18e2[_0x9d13('0x45')]['AccountId']=_0x5099f8['id'];_0xcc18e2[_0x9d13('0x45')][_0x9d13('0x4d')]=integrations[_0x9d13('0x4e')](_0xcc18e2[_0x9d13('0x45')][_0x9d13('0x4f')],_0xcc18e2[_0x9d13('0x45')]['type']);_0xcc18e2[_0x9d13('0x45')]['Descriptions']=integrations[_0x9d13('0x50')](_0xcc18e2['body'][_0x9d13('0x4f')],_0xcc18e2[_0x9d13('0x45')][_0x9d13('0x2c')]);return db[_0x9d13('0x49')]['create'](_0xcc18e2['body'],{'include':[{'model':db[_0x9d13('0x51')],'as':_0x9d13('0x4d')},{'model':db[_0x9d13('0x51')],'as':_0x9d13('0x52')}]});}return null;})[_0x9d13('0x24')](respondWithResult(_0x5d78bd,null))['catch'](handleError(_0x5d78bd,null));};exports['getFields']=function(_0x50c412,_0x4cec4b,_0x1d12b9){var _0x1452f3='';return db[_0x9d13('0x2b')][_0x9d13('0x48')]({'where':{'id':_0x50c412[_0x9d13('0x40')]['id']},'attributes':['id','remoteUri',_0x9d13('0x53')]})[_0x9d13('0x24')](handleEntityNotFound(_0x4cec4b,null))[_0x9d13('0x24')](function(_0x2bfb67){if(_0x2bfb67){_0x1452f3=_0x2bfb67[_0x9d13('0x54')];var _0x416c93=_0x1452f3[_0x9d13('0x55')](-0x1);if(_0x416c93==='/'){_0x1452f3=_0x1452f3[_0x9d13('0x56')](0x0,_0x1452f3[_0x9d13('0x57')](_0x416c93));}return rp({'method':_0x9d13('0x58'),'uri':util[_0x9d13('0x59')](_0x9d13('0x5a'),_0x1452f3,_0x9d13('0x5b')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x9d13('0x59')](_0x9d13('0x5c'),_0x2bfb67[_0x9d13('0x53')]))[_0x9d13('0x5d')](_0x9d13('0x5e')))},'json':!![]});}})[_0x9d13('0x24')](function(_0x37872b){if(_0x37872b){var _0x40a8c7=['requester',_0x9d13('0x5f'),_0x9d13('0x60'),'description','status',_0x9d13('0x61'),_0x9d13('0x62'),_0x9d13('0x63'),_0x9d13('0x64'),_0x9d13('0x62'),_0x9d13('0x65')];_[_0x9d13('0x66')](_0x37872b,function(_0x45b9fb){return _0x40a8c7[_0x9d13('0x67')](_0x45b9fb[_0x9d13('0x27')])||!_0x45b9fb[_0x9d13('0x68')]&&_0x45b9fb[_0x9d13('0x2c')]!==_0x9d13('0x69')&&_0x45b9fb[_0x9d13('0x2c')]!==_0x9d13('0x6a');});return{'count':_0x37872b['length'],'rows':_['map'](_0x37872b,function(_0x31fd35){return{'id':_0x31fd35[_0x9d13('0x27')],'name':_0x31fd35[_0x9d13('0x6b')],'custom':!_0x31fd35[_0x9d13('0x68')],'options':_0x31fd35[_0x9d13('0x6c')]?_['map'](_0x31fd35[_0x9d13('0x6c')],function(_0x70094a){return{'name':_[_0x9d13('0x6d')](_0x70094a),'value':_0x70094a};}):[]};})};}})[_0x9d13('0x24')](respondWithResult(_0x4cec4b,null))[_0x9d13('0x3e')](function(_0x5f4c04){var _0x29a6be=_0x50c412['query'][_0x9d13('0x6e')]?0x1f4:_0x5f4c04[_0x9d13('0x6f')]||0x1f4;logger[_0x9d13('0x70')](_0x9d13('0x71'),_0x9d13('0x72'),_0x29a6be,JSON[_0x9d13('0x73')](_0x5f4c04));delete _0x5f4c04['name'];if(_0x29a6be===0x191){_0x29a6be=0x190;}_0x4cec4b['status'](_0x29a6be)[_0x9d13('0x28')](_0x50c412['query'][_0x9d13('0x6e')]?{'message':_0x9d13('0x74'),'statusCode':_0x5f4c04['statusCode']}:_0x5f4c04);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index d239476..39b9046 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 _0x7c96=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash'];(function(_0x593d6d,_0xe25f61){var _0x14b045=function(_0x4f650e){while(--_0x4f650e){_0x593d6d['push'](_0x593d6d['shift']());}};_0x14b045(++_0xe25f61);}(_0x7c96,0xbf));var _0x67c9=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x7c96[_0x37ffea];return _0x2e2615;};'use strict';var _=require(_0x67c9('0x0'));var util=require(_0x67c9('0x1'));var logger=require(_0x67c9('0x2'))(_0x67c9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x67c9('0x4'));var fs=require('fs');var path=require(_0x67c9('0x5'));var rimraf=require(_0x67c9('0x6'));var config=require(_0x67c9('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x67c9('0x8')]=function(_0xe9c8c7,_0xe90ad2){return _0xe9c8c7[_0x67c9('0x9')](_0x67c9('0xa'),attributes,{'tableName':_0x67c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5441=['FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','exports','define'];(function(_0x5d26bf,_0x10c592){var _0x3de218=function(_0x38aa9d){while(--_0x38aa9d){_0x5d26bf['push'](_0x5d26bf['shift']());}};_0x3de218(++_0x10c592);}(_0x5441,0xc2));var _0x1544=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x5441[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x1544('0x0'));var util=require(_0x1544('0x1'));var logger=require(_0x1544('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1544('0x3'));var rp=require(_0x1544('0x4'));var fs=require('fs');var path=require(_0x1544('0x5'));var rimraf=require(_0x1544('0x6'));var config=require('../../config/environment');var attributes=require(_0x1544('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x1544('0x8')]=function(_0xba9a49,_0x21e82a){return _0xba9a49[_0x1544('0x9')](_0x1544('0xa'),attributes,{'tableName':_0x1544('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 477ab5e..73c9148 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 _0x64c4=['catch','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','limit','include','map','model','debug','stringify'];(function(_0x3fef06,_0x45cf8d){var _0x39e057=function(_0x57b045){while(--_0x57b045){_0x3fef06['push'](_0x3fef06['shift']());}};_0x39e057(++_0x45cf8d);}(_0x64c4,0x11b));var _0x464c=function(_0x169bde,_0x4ffee1){_0x169bde=_0x169bde-0x0;var _0x517fc2=_0x64c4[_0x169bde];return _0x517fc2;};'use strict';var _=require(_0x464c('0x0'));var util=require(_0x464c('0x1'));var moment=require(_0x464c('0x2'));var BPromise=require(_0x464c('0x3'));var rs=require(_0x464c('0x4'));var fs=require('fs');var Redis=require(_0x464c('0x5'));var db=require(_0x464c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x464c('0x7'))(_0x464c('0x8'));var config=require(_0x464c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x464c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5518bd,_0x26ac36,_0x126758){return new BPromise(function(_0x1100b0,_0x49f849){return client[_0x464c('0xb')](_0x5518bd,_0x126758)[_0x464c('0xc')](function(_0x5bb206){logger[_0x464c('0xd')](_0x464c('0xe'),_0x26ac36,_0x464c('0xf'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x26ac36,_0x464c('0xf'),JSON['stringify'](_0x5bb206));if(_0x5bb206[_0x464c('0x10')]){if(_0x5bb206['error'][_0x464c('0x11')]===0x1f4){logger[_0x464c('0x10')](_0x464c('0xe'),_0x26ac36,_0x5bb206['error']['message']);return _0x49f849(_0x5bb206[_0x464c('0x10')][_0x464c('0x12')]);}logger['error'](_0x464c('0xe'),_0x26ac36,_0x5bb206['error'][_0x464c('0x12')]);return _0x1100b0(_0x5bb206[_0x464c('0x10')][_0x464c('0x12')]);}else{logger[_0x464c('0xd')](_0x464c('0xe'),_0x26ac36,_0x464c('0xf'));_0x1100b0(_0x5bb206[_0x464c('0x13')][_0x464c('0x12')]);}})['catch'](function(_0x3d9419){logger[_0x464c('0x10')](_0x464c('0xe'),_0x26ac36,_0x3d9419);_0x49f849(_0x3d9419);});});}exports[_0x464c('0x14')]=function(_0x2c2134){var _0x291b4d=this;return new Promise(function(_0x3e27c7,_0x5a753e){return db[_0x464c('0x15')]['findAll']({'raw':_0x2c2134['options']?_0x2c2134[_0x464c('0x16')][_0x464c('0x17')]===undefined?!![]:![]:!![],'where':_0x2c2134[_0x464c('0x16')]?_0x2c2134[_0x464c('0x16')][_0x464c('0x18')]||null:null,'attributes':_0x2c2134[_0x464c('0x16')]?_0x2c2134['options'][_0x464c('0x19')]||null:null,'limit':_0x2c2134['options']?_0x2c2134[_0x464c('0x16')][_0x464c('0x1a')]||null:null,'include':_0x2c2134[_0x464c('0x16')]?_0x2c2134[_0x464c('0x16')][_0x464c('0x1b')]?_[_0x464c('0x1c')](_0x2c2134[_0x464c('0x16')][_0x464c('0x1b')],function(_0x3b2591){return{'model':db[_0x3b2591[_0x464c('0x1d')]],'as':_0x3b2591['as'],'attributes':_0x3b2591[_0x464c('0x19')],'include':_0x3b2591[_0x464c('0x1b')]?_[_0x464c('0x1c')](_0x3b2591['include'],function(_0x4571ad){return{'model':db[_0x4571ad['model']],'as':_0x4571ad['as'],'attributes':_0x4571ad[_0x464c('0x19')],'include':_0x4571ad[_0x464c('0x1b')]?_[_0x464c('0x1c')](_0x4571ad[_0x464c('0x1b')],function(_0x16e0b5){return{'model':db[_0x16e0b5[_0x464c('0x1d')]],'as':_0x16e0b5['as'],'attributes':_0x16e0b5[_0x464c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x464c('0xc')](function(_0x1468bd){logger[_0x464c('0xd')](_0x464c('0x14'),_0x2c2134);logger[_0x464c('0x1e')](_0x464c('0x14'),_0x2c2134,JSON[_0x464c('0x1f')](_0x1468bd));_0x3e27c7(_0x1468bd);})[_0x464c('0x20')](function(_0x234da8){logger['error'](_0x464c('0x14'),_0x234da8['message'],_0x2c2134);_0x5a753e(_0x291b4d[_0x464c('0x10')](0x1f4,_0x234da8['message']));});});};exports[_0x464c('0x21')]=function(_0x52861d){var _0x1c8430=this;return new Promise(function(_0x2971c3,_0x375c01){return db['FreshdeskAccount'][_0x464c('0x22')]({'raw':_0x52861d[_0x464c('0x16')]?_0x52861d[_0x464c('0x16')][_0x464c('0x17')]===undefined?!![]:![]:!![],'where':_0x52861d[_0x464c('0x16')]?_0x52861d[_0x464c('0x16')][_0x464c('0x18')]||null:null,'attributes':_0x52861d[_0x464c('0x16')]?_0x52861d[_0x464c('0x16')][_0x464c('0x19')]||null:null,'include':_0x52861d[_0x464c('0x16')]?_0x52861d[_0x464c('0x16')][_0x464c('0x1b')]?_['map'](_0x52861d[_0x464c('0x16')][_0x464c('0x1b')],function(_0x165cc5){return{'model':db[_0x165cc5['model']],'as':_0x165cc5['as'],'attributes':_0x165cc5['attributes'],'include':_0x165cc5[_0x464c('0x1b')]?_[_0x464c('0x1c')](_0x165cc5[_0x464c('0x1b')],function(_0x52cc19){return{'model':db[_0x52cc19[_0x464c('0x1d')]],'as':_0x52cc19['as'],'attributes':_0x52cc19[_0x464c('0x19')],'include':_0x52cc19['include']?_[_0x464c('0x1c')](_0x52cc19['include'],function(_0x83f6b3){return{'model':db[_0x83f6b3[_0x464c('0x1d')]],'as':_0x83f6b3['as'],'attributes':_0x83f6b3[_0x464c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x464c('0xc')](function(_0x67e3a3){logger[_0x464c('0xd')](_0x464c('0x21'),_0x52861d);logger[_0x464c('0x1e')]('ShowFreshdeskAccount',_0x52861d,JSON['stringify'](_0x67e3a3));_0x2971c3(_0x67e3a3);})['catch'](function(_0x101701){logger[_0x464c('0x10')](_0x464c('0x21'),_0x101701[_0x464c('0x12')],_0x52861d);_0x375c01(_0x1c8430[_0x464c('0x10')](0x1f4,_0x101701['message']));});});}; \ No newline at end of file +var _0xdf1c=['rpc','../../config/environment','jayson/promise','client','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowFreshdeskAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x1626d3,_0x563159){var _0x410374=function(_0x31d6e3){while(--_0x31d6e3){_0x1626d3['push'](_0x1626d3['shift']());}};_0x410374(++_0x563159);}(_0xdf1c,0x112));var _0xcdf1=function(_0x181f66,_0x53ce61){_0x181f66=_0x181f66-0x0;var _0x9faf8a=_0xdf1c[_0x181f66];return _0x9faf8a;};'use strict';var _=require(_0xcdf1('0x0'));var util=require(_0xcdf1('0x1'));var moment=require('moment');var BPromise=require(_0xcdf1('0x2'));var rs=require(_0xcdf1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdf1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcdf1('0x5'))(_0xcdf1('0x6'));var config=require(_0xcdf1('0x7'));var jayson=require(_0xcdf1('0x8'));var client=jayson[_0xcdf1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x760dc6,_0x4a1325,_0x5da55d){return new BPromise(function(_0x524058,_0x376dab){return client[_0xcdf1('0xa')](_0x760dc6,_0x5da55d)[_0xcdf1('0xb')](function(_0x691964){logger['info'](_0xcdf1('0xc'),_0x4a1325,_0xcdf1('0xd'));logger[_0xcdf1('0xe')](_0xcdf1('0xf'),_0x4a1325,_0xcdf1('0xd'),JSON[_0xcdf1('0x10')](_0x691964));if(_0x691964['error']){if(_0x691964['error'][_0xcdf1('0x11')]===0x1f4){logger[_0xcdf1('0x12')](_0xcdf1('0xc'),_0x4a1325,_0x691964['error'][_0xcdf1('0x13')]);return _0x376dab(_0x691964['error']['message']);}logger['error'](_0xcdf1('0xc'),_0x4a1325,_0x691964[_0xcdf1('0x12')][_0xcdf1('0x13')]);return _0x524058(_0x691964[_0xcdf1('0x12')]['message']);}else{logger[_0xcdf1('0x14')](_0xcdf1('0xc'),_0x4a1325,_0xcdf1('0xd'));_0x524058(_0x691964['result'][_0xcdf1('0x13')]);}})['catch'](function(_0x1623af){logger[_0xcdf1('0x12')](_0xcdf1('0xc'),_0x4a1325,_0x1623af);_0x376dab(_0x1623af);});});}exports[_0xcdf1('0x15')]=function(_0x3d42eb){var _0x53d429=this;return new Promise(function(_0x40fb84,_0x48b2a2){return db[_0xcdf1('0x16')][_0xcdf1('0x17')]({'raw':_0x3d42eb[_0xcdf1('0x18')]?_0x3d42eb['options'][_0xcdf1('0x19')]===undefined?!![]:![]:!![],'where':_0x3d42eb[_0xcdf1('0x18')]?_0x3d42eb['options'][_0xcdf1('0x1a')]||null:null,'attributes':_0x3d42eb[_0xcdf1('0x18')]?_0x3d42eb['options'][_0xcdf1('0x1b')]||null:null,'limit':_0x3d42eb['options']?_0x3d42eb[_0xcdf1('0x18')][_0xcdf1('0x1c')]||null:null,'include':_0x3d42eb[_0xcdf1('0x18')]?_0x3d42eb[_0xcdf1('0x18')][_0xcdf1('0x1d')]?_[_0xcdf1('0x1e')](_0x3d42eb[_0xcdf1('0x18')][_0xcdf1('0x1d')],function(_0x17d902){return{'model':db[_0x17d902[_0xcdf1('0x1f')]],'as':_0x17d902['as'],'attributes':_0x17d902[_0xcdf1('0x1b')],'include':_0x17d902[_0xcdf1('0x1d')]?_['map'](_0x17d902['include'],function(_0x490965){return{'model':db[_0x490965[_0xcdf1('0x1f')]],'as':_0x490965['as'],'attributes':_0x490965[_0xcdf1('0x1b')],'include':_0x490965['include']?_[_0xcdf1('0x1e')](_0x490965[_0xcdf1('0x1d')],function(_0x960490){return{'model':db[_0x960490[_0xcdf1('0x1f')]],'as':_0x960490['as'],'attributes':_0x960490[_0xcdf1('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x230fed){logger[_0xcdf1('0x14')](_0xcdf1('0x15'),_0x3d42eb);logger[_0xcdf1('0xe')](_0xcdf1('0x15'),_0x3d42eb,JSON[_0xcdf1('0x10')](_0x230fed));_0x40fb84(_0x230fed);})[_0xcdf1('0x20')](function(_0xfbdf47){logger[_0xcdf1('0x12')](_0xcdf1('0x15'),_0xfbdf47['message'],_0x3d42eb);_0x48b2a2(_0x53d429[_0xcdf1('0x12')](0x1f4,_0xfbdf47['message']));});});};exports[_0xcdf1('0x21')]=function(_0x24ee33){var _0x28903c=this;return new Promise(function(_0x143681,_0x4b2b9a){return db['FreshdeskAccount'][_0xcdf1('0x22')]({'raw':_0x24ee33[_0xcdf1('0x18')]?_0x24ee33[_0xcdf1('0x18')][_0xcdf1('0x19')]===undefined?!![]:![]:!![],'where':_0x24ee33['options']?_0x24ee33[_0xcdf1('0x18')]['where']||null:null,'attributes':_0x24ee33[_0xcdf1('0x18')]?_0x24ee33[_0xcdf1('0x18')][_0xcdf1('0x1b')]||null:null,'include':_0x24ee33['options']?_0x24ee33[_0xcdf1('0x18')][_0xcdf1('0x1d')]?_['map'](_0x24ee33[_0xcdf1('0x18')][_0xcdf1('0x1d')],function(_0x7b7c5c){return{'model':db[_0x7b7c5c[_0xcdf1('0x1f')]],'as':_0x7b7c5c['as'],'attributes':_0x7b7c5c[_0xcdf1('0x1b')],'include':_0x7b7c5c[_0xcdf1('0x1d')]?_[_0xcdf1('0x1e')](_0x7b7c5c[_0xcdf1('0x1d')],function(_0x20990c){return{'model':db[_0x20990c[_0xcdf1('0x1f')]],'as':_0x20990c['as'],'attributes':_0x20990c[_0xcdf1('0x1b')],'include':_0x20990c[_0xcdf1('0x1d')]?_['map'](_0x20990c['include'],function(_0x42a62d){return{'model':db[_0x42a62d[_0xcdf1('0x1f')]],'as':_0x42a62d['as'],'attributes':_0x42a62d[_0xcdf1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcdf1('0xb')](function(_0x1bf873){logger[_0xcdf1('0x14')]('ShowFreshdeskAccount',_0x24ee33);logger[_0xcdf1('0xe')](_0xcdf1('0x21'),_0x24ee33,JSON['stringify'](_0x1bf873));_0x143681(_0x1bf873);})[_0xcdf1('0x20')](function(_0x494ec5){logger[_0xcdf1('0x12')](_0xcdf1('0x21'),_0x494ec5['message'],_0x24ee33);_0x4b2b9a(_0x28903c[_0xcdf1('0x12')](0x1f4,_0x494ec5[_0xcdf1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 27422fa..7f7d861 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 _0xe1f3=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','put','/:id','delete','destroy'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe1f3,0xfb));var _0x3e1f=function(_0x5ae3e1,_0x1aca09){_0x5ae3e1=_0x5ae3e1-0x0;var _0x234f72=_0xe1f3[_0x5ae3e1];return _0x234f72;};'use strict';var multer=require(_0x3e1f('0x0'));var util=require(_0x3e1f('0x1'));var path=require(_0x3e1f('0x2'));var timeout=require(_0x3e1f('0x3'));var express=require(_0x3e1f('0x4'));var router=express[_0x3e1f('0x5')]();var fs_extra=require(_0x3e1f('0x6'));var auth=require(_0x3e1f('0x7'));var interaction=require(_0x3e1f('0x8'));var config=require(_0x3e1f('0x9'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x3e1f('0xa')](),controller['index']);router[_0x3e1f('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x3e1f('0xc')]);router[_0x3e1f('0xb')](_0x3e1f('0xd'),auth['isAuthenticated'](),controller[_0x3e1f('0xe')]);router['get']('/:id/subjects',auth[_0x3e1f('0xa')](),controller[_0x3e1f('0xf')]);router[_0x3e1f('0xb')](_0x3e1f('0x10'),auth[_0x3e1f('0xa')](),controller[_0x3e1f('0x11')]);router[_0x3e1f('0xb')](_0x3e1f('0x12'),auth['isAuthenticated'](),controller['getTags']);router[_0x3e1f('0x13')]('/',auth[_0x3e1f('0xa')](),controller['create']);router[_0x3e1f('0x13')](_0x3e1f('0x12'),auth[_0x3e1f('0xa')](),controller['setTags']);router[_0x3e1f('0x14')](_0x3e1f('0x15'),auth['isAuthenticated'](),controller['update']);router[_0x3e1f('0x16')](_0x3e1f('0x15'),auth['isAuthenticated'](),controller[_0x3e1f('0x17')]);module[_0x3e1f('0x18')]=router; \ No newline at end of file +var _0x5f04=['getTags','create','setTags','put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','show','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','/:id/tags'];(function(_0x348860,_0x4531f6){var _0x2fc2ad=function(_0x3b449f){while(--_0x3b449f){_0x348860['push'](_0x348860['shift']());}};_0x2fc2ad(++_0x4531f6);}(_0x5f04,0x125));var _0x45f0=function(_0x2dc7c9,_0x3a15f8){_0x2dc7c9=_0x2dc7c9-0x0;var _0x3e6536=_0x5f04[_0x2dc7c9];return _0x3e6536;};'use strict';var multer=require(_0x45f0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x45f0('0x1'));var express=require(_0x45f0('0x2'));var router=express[_0x45f0('0x3')]();var fs_extra=require(_0x45f0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x45f0('0x5'));var config=require(_0x45f0('0x6'));var controller=require(_0x45f0('0x7'));router[_0x45f0('0x8')]('/',auth['isAuthenticated'](),controller[_0x45f0('0x9')]);router[_0x45f0('0x8')](_0x45f0('0xa'),auth['isAuthenticated'](),controller[_0x45f0('0xb')]);router[_0x45f0('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x45f0('0xc')]);router[_0x45f0('0x8')](_0x45f0('0xd'),auth[_0x45f0('0xe')](),controller[_0x45f0('0xf')]);router[_0x45f0('0x8')](_0x45f0('0x10'),auth['isAuthenticated'](),controller[_0x45f0('0x11')]);router[_0x45f0('0x8')](_0x45f0('0x12'),auth[_0x45f0('0xe')](),controller[_0x45f0('0x13')]);router['post']('/',auth[_0x45f0('0xe')](),controller[_0x45f0('0x14')]);router['post'](_0x45f0('0x12'),auth[_0x45f0('0xe')](),controller[_0x45f0('0x15')]);router[_0x45f0('0x16')]('/:id',auth[_0x45f0('0xe')](),controller[_0x45f0('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x45f0('0x18')]);module[_0x45f0('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index a29e73f..b15a203 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 _0x70cc=['STRING','exports'];(function(_0x51c031,_0x3e48f1){var _0x950750=function(_0x15fa23){while(--_0x15fa23){_0x51c031['push'](_0x51c031['shift']());}};_0x950750(++_0x3e48f1);}(_0x70cc,0x1c7));var _0xc70c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x70cc[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0xc70c('0x0')]={'name':{'type':Sequelize[_0xc70c('0x1')]},'description':{'type':Sequelize[_0xc70c('0x1')]}}; \ No newline at end of file +var _0xcfc6=['STRING','sequelize'];(function(_0x49f67f,_0x4113a4){var _0x4779a1=function(_0x5064b0){while(--_0x5064b0){_0x49f67f['push'](_0x49f67f['shift']());}};_0x4779a1(++_0x4113a4);}(_0xcfc6,0x6d));var _0x6cfc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcfc6[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6cfc('0x0'));module['exports']={'name':{'type':Sequelize[_0x6cfc('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 1d43cb1..78ec75a 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 _0x4452=['json','limit','count','set','Content-Range','save','update','then','destroy','sendStatus','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getFields','FreshdeskField','length','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','moment','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','../../mysqldb','status','end'];(function(_0x2efbc5,_0x5052e8){var _0x3ec1d6=function(_0x1f950c){while(--_0x1f950c){_0x2efbc5['push'](_0x2efbc5['shift']());}};_0x3ec1d6(++_0x5052e8);}(_0x4452,0x183));var _0x2445=function(_0x1f0d49,_0x5afebc){_0x1f0d49=_0x1f0d49-0x0;var _0x4a1b99=_0x4452[_0x1f0d49];return _0x4a1b99;};'use strict';var emlformat=require(_0x2445('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2445('0x1'));var jsonpatch=require(_0x2445('0x2'));var rp=require('request-promise');var moment=require(_0x2445('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2445('0x4'));var util=require(_0x2445('0x5'));var path=require(_0x2445('0x6'));var sox=require(_0x2445('0x7'));var csv=require(_0x2445('0x8'));var ejs=require(_0x2445('0x9'));var fs=require('fs');var fs_extra=require(_0x2445('0xa'));var _=require(_0x2445('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2445('0xc'));var deskjs=require(_0x2445('0xd'));var toCsv=require(_0x2445('0x8'));var querystring=require(_0x2445('0xe'));var Papa=require(_0x2445('0xf'));var Redis=require(_0x2445('0x10'));var authService=require(_0x2445('0x11'));var qs=require(_0x2445('0x12'));var as=require(_0x2445('0x13'));var hardwareService=require(_0x2445('0x14'));var logger=require(_0x2445('0x15'))(_0x2445('0x16'));var utils=require(_0x2445('0x17'));var config=require(_0x2445('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2445('0x19'))['db'];function respondWithStatusCode(_0x43b479,_0x735501){_0x735501=_0x735501||0xcc;return function(_0x49b156){if(_0x49b156){return _0x43b479['sendStatus'](_0x735501);}return _0x43b479[_0x2445('0x1a')](_0x735501)[_0x2445('0x1b')]();};}function respondWithResult(_0xd3da6c,_0x32d827){_0x32d827=_0x32d827||0xc8;return function(_0x1f9808){if(_0x1f9808){return _0xd3da6c[_0x2445('0x1a')](_0x32d827)[_0x2445('0x1c')](_0x1f9808);}};}function respondWithFilteredResult(_0x56d15d,_0x2bcbe0){return function(_0x440186){if(_0x440186){var _0x3488f3=typeof _0x2bcbe0['offset']==='undefined'&&typeof _0x2bcbe0[_0x2445('0x1d')]==='undefined';var _0x5c64d8=_0x440186[_0x2445('0x1e')];var _0x557ba6=_0x3488f3?0x0:_0x2bcbe0['offset'];var _0x4850d8=_0x3488f3?_0x440186[_0x2445('0x1e')]:_0x2bcbe0['offset']+_0x2bcbe0['limit'];var _0x347c07;if(_0x4850d8>=_0x5c64d8){_0x4850d8=_0x5c64d8;_0x347c07=0xc8;}else{_0x347c07=0xce;}_0x56d15d['status'](_0x347c07);return _0x56d15d[_0x2445('0x1f')](_0x2445('0x20'),_0x557ba6+'-'+_0x4850d8+'/'+_0x5c64d8)[_0x2445('0x1c')](_0x440186);}return null;};}function patchUpdates(_0x252d6b){return function(_0x430467){try{jsonpatch['apply'](_0x430467,_0x252d6b,!![]);}catch(_0x4ff3eb){return BPromise['reject'](_0x4ff3eb);}return _0x430467[_0x2445('0x21')]();};}function saveUpdates(_0x479ce0,_0x57e054){return function(_0x42aa69){if(_0x42aa69){return _0x42aa69[_0x2445('0x22')](_0x479ce0)[_0x2445('0x23')](function(_0x4c7a61){return _0x4c7a61;});}return null;};}function removeEntity(_0x55a9ce,_0x41a239){return function(_0xa9445){if(_0xa9445){return _0xa9445[_0x2445('0x24')]()[_0x2445('0x23')](function(){_0x55a9ce[_0x2445('0x1a')](0xcc)[_0x2445('0x1b')]();});}};}function handleEntityNotFound(_0x355fdd,_0x1c8796){return function(_0x360a22){if(!_0x360a22){_0x355fdd[_0x2445('0x25')](0x194);}return _0x360a22;};}function handleError(_0x59b8e9,_0x3a4848){_0x3a4848=_0x3a4848||0x1f4;return function(_0x49884e){logger['error'](_0x49884e[_0x2445('0x26')]);if(_0x49884e[_0x2445('0x27')]){delete _0x49884e[_0x2445('0x27')];}_0x59b8e9[_0x2445('0x1a')](_0x3a4848)['send'](_0x49884e);};}exports[_0x2445('0x28')]=function(_0x2c8c4a,_0x2edb17){var _0x5bbc12={},_0x2d44f5={},_0x9780ef={'count':0x0,'rows':[]};var _0x19dc35=_[_0x2445('0x29')](db[_0x2445('0x2a')][_0x2445('0x2b')],function(_0x315276){return{'name':_0x315276[_0x2445('0x2c')],'type':_0x315276['type'][_0x2445('0x2d')]};});_0x2d44f5[_0x2445('0x2e')]=_[_0x2445('0x29')](_0x19dc35,_0x2445('0x27'));_0x2d44f5[_0x2445('0x2f')]=_[_0x2445('0x30')](_0x2c8c4a[_0x2445('0x2f')]);_0x2d44f5['filters']=_['intersection'](_0x2d44f5[_0x2445('0x2e')],_0x2d44f5[_0x2445('0x2f')]);_0x5bbc12[_0x2445('0x31')]=_[_0x2445('0x32')](_0x2d44f5[_0x2445('0x2e')],qs[_0x2445('0x33')](_0x2c8c4a[_0x2445('0x2f')][_0x2445('0x33')]));_0x5bbc12[_0x2445('0x31')]=_0x5bbc12[_0x2445('0x31')]['length']?_0x5bbc12[_0x2445('0x31')]:_0x2d44f5[_0x2445('0x2e')];if(!_0x2c8c4a['query'][_0x2445('0x34')](_0x2445('0x35'))){_0x5bbc12[_0x2445('0x1d')]=qs[_0x2445('0x1d')](_0x2c8c4a[_0x2445('0x2f')]['limit']);_0x5bbc12[_0x2445('0x36')]=qs['offset'](_0x2c8c4a['query'][_0x2445('0x36')]);}_0x5bbc12[_0x2445('0x37')]=qs[_0x2445('0x38')](_0x2c8c4a[_0x2445('0x2f')][_0x2445('0x38')]);_0x5bbc12[_0x2445('0x39')]=qs[_0x2445('0x3a')](_[_0x2445('0x3b')](_0x2c8c4a[_0x2445('0x2f')],_0x2d44f5[_0x2445('0x3a')]),_0x19dc35);if(_0x2c8c4a[_0x2445('0x2f')][_0x2445('0x3c')]){_0x5bbc12[_0x2445('0x39')]=_[_0x2445('0x3d')](_0x5bbc12[_0x2445('0x39')],{'$or':_[_0x2445('0x29')](_0x19dc35,function(_0x357bad){if(_0x357bad['type']!==_0x2445('0x3e')){var _0x5c5126={};_0x5c5126[_0x357bad[_0x2445('0x27')]]={'$like':'%'+_0x2c8c4a[_0x2445('0x2f')][_0x2445('0x3c')]+'%'};return _0x5c5126;}})});}_0x5bbc12=_[_0x2445('0x3d')]({},_0x5bbc12,_0x2c8c4a['options']);var _0x4973cc={'where':_0x5bbc12[_0x2445('0x39')]};return db[_0x2445('0x2a')][_0x2445('0x1e')](_0x4973cc)[_0x2445('0x23')](function(_0x3160dc){_0x9780ef[_0x2445('0x1e')]=_0x3160dc;if(_0x2c8c4a[_0x2445('0x2f')][_0x2445('0x3f')]){_0x5bbc12[_0x2445('0x40')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x2445('0x41')](_0x5bbc12);})['then'](function(_0x6a41b3){_0x9780ef[_0x2445('0x42')]=_0x6a41b3;return _0x9780ef;})['then'](respondWithFilteredResult(_0x2edb17,_0x5bbc12))[_0x2445('0x43')](handleError(_0x2edb17,null));};exports[_0x2445('0x44')]=function(_0x3d5390,_0x401032){var _0x13dab3={'raw':![],'where':{'id':_0x3d5390[_0x2445('0x45')]['id']}},_0x56e2c1={};_0x56e2c1['model']=_[_0x2445('0x30')](db['FreshdeskConfiguration'][_0x2445('0x2b')]);_0x56e2c1[_0x2445('0x2f')]=_[_0x2445('0x30')](_0x3d5390['query']);_0x56e2c1[_0x2445('0x3a')]=_['intersection'](_0x56e2c1[_0x2445('0x2e')],_0x56e2c1[_0x2445('0x2f')]);_0x13dab3[_0x2445('0x31')]=_['intersection'](_0x56e2c1[_0x2445('0x2e')],qs[_0x2445('0x33')](_0x3d5390[_0x2445('0x2f')][_0x2445('0x33')]));_0x13dab3[_0x2445('0x31')]=_0x13dab3[_0x2445('0x31')]['length']?_0x13dab3[_0x2445('0x31')]:_0x56e2c1[_0x2445('0x2e')];if(_0x3d5390[_0x2445('0x2f')]['includeAll']){_0x13dab3[_0x2445('0x40')]=[{'all':!![]}];}_0x13dab3=_['merge']({},_0x13dab3,_0x3d5390[_0x2445('0x46')]);return db[_0x2445('0x2a')][_0x2445('0x47')](_0x13dab3)['then'](handleEntityNotFound(_0x401032,null))[_0x2445('0x23')](respondWithResult(_0x401032,null))[_0x2445('0x43')](handleError(_0x401032,null));};exports[_0x2445('0x48')]=function(_0x5e9706,_0x33eb7d){return db[_0x2445('0x2a')][_0x2445('0x48')](_0x5e9706['body'],{})[_0x2445('0x23')](respondWithResult(_0x33eb7d,0xc9))[_0x2445('0x43')](handleError(_0x33eb7d,null));};exports[_0x2445('0x22')]=function(_0x57dc2e,_0x11b2f1){if(_0x57dc2e[_0x2445('0x49')]['id']){delete _0x57dc2e['body']['id'];}return db['FreshdeskConfiguration'][_0x2445('0x47')]({'where':{'id':_0x57dc2e[_0x2445('0x45')]['id']}})[_0x2445('0x23')](handleEntityNotFound(_0x11b2f1,null))['then'](saveUpdates(_0x57dc2e[_0x2445('0x49')],null))[_0x2445('0x23')](respondWithResult(_0x11b2f1,null))['catch'](handleError(_0x11b2f1,null));};exports[_0x2445('0x24')]=function(_0x506c8a,_0x2d6ec6){return db[_0x2445('0x2a')][_0x2445('0x47')]({'where':{'id':_0x506c8a[_0x2445('0x45')]['id']}})[_0x2445('0x23')](handleEntityNotFound(_0x2d6ec6,null))[_0x2445('0x23')](removeEntity(_0x2d6ec6,null))[_0x2445('0x43')](handleError(_0x2d6ec6,null));};exports[_0x2445('0x4a')]=function(_0x5e6d8c,_0x1a1099,_0x14e75c){var _0x206cc9={};var _0x5f185a={};var _0x5a94d7;var _0x4a6688;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x5e6d8c[_0x2445('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a1099,null))[_0x2445('0x23')](function(_0x3f4615){if(_0x3f4615){_0x5a94d7=_0x3f4615;_0x5f185a[_0x2445('0x2e')]=_['keys'](db[_0x2445('0x4b')][_0x2445('0x2b')]);_0x5f185a['query']=_[_0x2445('0x30')](_0x5e6d8c[_0x2445('0x2f')]);_0x5f185a[_0x2445('0x3a')]=_[_0x2445('0x32')](_0x5f185a[_0x2445('0x2e')],_0x5f185a['query']);_0x206cc9[_0x2445('0x31')]=_[_0x2445('0x32')](_0x5f185a[_0x2445('0x2e')],qs['fields'](_0x5e6d8c['query'][_0x2445('0x33')]));_0x206cc9[_0x2445('0x31')]=_0x206cc9['attributes'][_0x2445('0x4c')]?_0x206cc9[_0x2445('0x31')]:_0x5f185a[_0x2445('0x2e')];_0x206cc9[_0x2445('0x37')]=qs['sort'](_0x5e6d8c[_0x2445('0x2f')][_0x2445('0x38')]);_0x206cc9[_0x2445('0x39')]=qs[_0x2445('0x3a')](_[_0x2445('0x3b')](_0x5e6d8c[_0x2445('0x2f')],_0x5f185a[_0x2445('0x3a')]));if(_0x5e6d8c[_0x2445('0x2f')][_0x2445('0x3c')]){_0x206cc9[_0x2445('0x39')]=_['merge'](_0x206cc9[_0x2445('0x39')],{'$or':_[_0x2445('0x29')](_0x206cc9[_0x2445('0x31')],function(_0x2a61c2){var _0x2ec351={};_0x2ec351[_0x2a61c2]={'$like':'%'+_0x5e6d8c[_0x2445('0x2f')]['filter']+'%'};return _0x2ec351;})});}_0x206cc9=_[_0x2445('0x3d')]({},_0x206cc9,_0x5e6d8c['options']);return _0x5a94d7[_0x2445('0x4a')](_0x206cc9);}})[_0x2445('0x23')](function(_0x18db82){if(_0x18db82){_0x4a6688=_0x18db82['length'];if(!_0x5e6d8c['query'][_0x2445('0x34')]('nolimit')){_0x206cc9[_0x2445('0x1d')]=qs['limit'](_0x5e6d8c[_0x2445('0x2f')][_0x2445('0x1d')]);_0x206cc9[_0x2445('0x36')]=qs['offset'](_0x5e6d8c[_0x2445('0x2f')]['offset']);}return _0x5a94d7[_0x2445('0x4a')](_0x206cc9);}})[_0x2445('0x23')](function(_0x19fa8f){if(_0x19fa8f){return _0x19fa8f?{'count':_0x4a6688,'rows':_0x19fa8f}:null;}})[_0x2445('0x23')](respondWithResult(_0x1a1099,null))[_0x2445('0x43')](handleError(_0x1a1099,null));};exports[_0x2445('0x4d')]=function(_0x99b17c,_0x27aa98,_0x33ffb9){var _0x4536f1={};var _0x16cf73={};var _0x1d2144;var _0x2da511;return db[_0x2445('0x2a')]['findOne']({'where':{'id':_0x99b17c['params']['id']}})['then'](handleEntityNotFound(_0x27aa98,null))[_0x2445('0x23')](function(_0x4e4342){if(_0x4e4342){_0x1d2144=_0x4e4342;_0x16cf73[_0x2445('0x2e')]=_[_0x2445('0x30')](db[_0x2445('0x4b')][_0x2445('0x2b')]);_0x16cf73[_0x2445('0x2f')]=_[_0x2445('0x30')](_0x99b17c['query']);_0x16cf73[_0x2445('0x3a')]=_[_0x2445('0x32')](_0x16cf73[_0x2445('0x2e')],_0x16cf73[_0x2445('0x2f')]);_0x4536f1[_0x2445('0x31')]=_[_0x2445('0x32')](_0x16cf73['model'],qs['fields'](_0x99b17c[_0x2445('0x2f')]['fields']));_0x4536f1[_0x2445('0x31')]=_0x4536f1[_0x2445('0x31')][_0x2445('0x4c')]?_0x4536f1[_0x2445('0x31')]:_0x16cf73['model'];_0x4536f1['order']=qs[_0x2445('0x38')](_0x99b17c[_0x2445('0x2f')][_0x2445('0x38')]);_0x4536f1['where']=qs['filters'](_[_0x2445('0x3b')](_0x99b17c[_0x2445('0x2f')],_0x16cf73[_0x2445('0x3a')]));if(_0x99b17c[_0x2445('0x2f')][_0x2445('0x3c')]){_0x4536f1[_0x2445('0x39')]=_[_0x2445('0x3d')](_0x4536f1[_0x2445('0x39')],{'$or':_['map'](_0x4536f1['attributes'],function(_0x26fb33){var _0x5acae1={};_0x5acae1[_0x26fb33]={'$like':'%'+_0x99b17c[_0x2445('0x2f')]['filter']+'%'};return _0x5acae1;})});}_0x4536f1=_[_0x2445('0x3d')]({},_0x4536f1,_0x99b17c[_0x2445('0x46')]);return _0x1d2144[_0x2445('0x4d')](_0x4536f1);}})[_0x2445('0x23')](function(_0x199189){if(_0x199189){_0x2da511=_0x199189['length'];if(!_0x99b17c['query']['hasOwnProperty'](_0x2445('0x35'))){_0x4536f1['limit']=qs[_0x2445('0x1d')](_0x99b17c['query']['limit']);_0x4536f1[_0x2445('0x36')]=qs[_0x2445('0x36')](_0x99b17c[_0x2445('0x2f')]['offset']);}return _0x1d2144[_0x2445('0x4d')](_0x4536f1);}})[_0x2445('0x23')](function(_0x439bc9){if(_0x439bc9){return _0x439bc9?{'count':_0x2da511,'rows':_0x439bc9}:null;}})[_0x2445('0x23')](respondWithResult(_0x27aa98,null))[_0x2445('0x43')](handleError(_0x27aa98,null));};exports['getDescriptions']=function(_0xc72b56,_0x10cd38,_0x332a0d){var _0x29fb95={};var _0x113de8={};var _0x2f804e;var _0x42f035;return db[_0x2445('0x2a')][_0x2445('0x4e')]({'where':{'id':_0xc72b56[_0x2445('0x45')]['id']}})[_0x2445('0x23')](handleEntityNotFound(_0x10cd38,null))['then'](function(_0x337f7c){if(_0x337f7c){_0x2f804e=_0x337f7c;_0x113de8[_0x2445('0x2e')]=_[_0x2445('0x30')](db[_0x2445('0x4b')][_0x2445('0x2b')]);_0x113de8[_0x2445('0x2f')]=_[_0x2445('0x30')](_0xc72b56[_0x2445('0x2f')]);_0x113de8['filters']=_[_0x2445('0x32')](_0x113de8['model'],_0x113de8[_0x2445('0x2f')]);_0x29fb95[_0x2445('0x31')]=_[_0x2445('0x32')](_0x113de8[_0x2445('0x2e')],qs[_0x2445('0x33')](_0xc72b56[_0x2445('0x2f')]['fields']));_0x29fb95['attributes']=_0x29fb95['attributes'][_0x2445('0x4c')]?_0x29fb95['attributes']:_0x113de8[_0x2445('0x2e')];_0x29fb95['order']=qs['sort'](_0xc72b56[_0x2445('0x2f')][_0x2445('0x38')]);_0x29fb95['where']=qs[_0x2445('0x3a')](_[_0x2445('0x3b')](_0xc72b56[_0x2445('0x2f')],_0x113de8[_0x2445('0x3a')]));if(_0xc72b56[_0x2445('0x2f')][_0x2445('0x3c')]){_0x29fb95[_0x2445('0x39')]=_[_0x2445('0x3d')](_0x29fb95[_0x2445('0x39')],{'$or':_[_0x2445('0x29')](_0x29fb95[_0x2445('0x31')],function(_0x3f57de){var _0x430b85={};_0x430b85[_0x3f57de]={'$like':'%'+_0xc72b56['query']['filter']+'%'};return _0x430b85;})});}_0x29fb95=_[_0x2445('0x3d')]({},_0x29fb95,_0xc72b56[_0x2445('0x46')]);return _0x2f804e[_0x2445('0x4f')](_0x29fb95);}})[_0x2445('0x23')](function(_0x47712d){if(_0x47712d){_0x42f035=_0x47712d[_0x2445('0x4c')];if(!_0xc72b56[_0x2445('0x2f')][_0x2445('0x34')](_0x2445('0x35'))){_0x29fb95['limit']=qs['limit'](_0xc72b56[_0x2445('0x2f')][_0x2445('0x1d')]);_0x29fb95[_0x2445('0x36')]=qs[_0x2445('0x36')](_0xc72b56['query']['offset']);}return _0x2f804e[_0x2445('0x4f')](_0x29fb95);}})['then'](function(_0x292a4a){if(_0x292a4a){return _0x292a4a?{'count':_0x42f035,'rows':_0x292a4a}:null;}})['then'](respondWithResult(_0x10cd38,null))[_0x2445('0x43')](handleError(_0x10cd38,null));};exports['getTags']=function(_0x2bb911,_0x1014a3,_0x4dc83e){var _0x2ac6a0={};var _0x49c3f3={};var _0x3f223f;var _0xdcf9d8;return db['FreshdeskConfiguration'][_0x2445('0x4e')]({'where':{'id':_0x2bb911[_0x2445('0x45')]['id']}})['then'](handleEntityNotFound(_0x1014a3,null))['then'](function(_0x165cd7){if(_0x165cd7){_0x3f223f=_0x165cd7;_0x49c3f3[_0x2445('0x2e')]=_[_0x2445('0x30')](db['Tag']['rawAttributes']);_0x49c3f3[_0x2445('0x2f')]=_['keys'](_0x2bb911[_0x2445('0x2f')]);_0x49c3f3[_0x2445('0x3a')]=_[_0x2445('0x32')](_0x49c3f3[_0x2445('0x2e')],_0x49c3f3[_0x2445('0x2f')]);_0x2ac6a0[_0x2445('0x31')]=_[_0x2445('0x32')](_0x49c3f3[_0x2445('0x2e')],qs['fields'](_0x2bb911[_0x2445('0x2f')]['fields']));_0x2ac6a0[_0x2445('0x31')]=_0x2ac6a0[_0x2445('0x31')][_0x2445('0x4c')]?_0x2ac6a0['attributes']:_0x49c3f3['model'];_0x2ac6a0[_0x2445('0x37')]=qs[_0x2445('0x38')](_0x2bb911[_0x2445('0x2f')]['sort']);_0x2ac6a0['where']=qs[_0x2445('0x3a')](_[_0x2445('0x3b')](_0x2bb911['query'],_0x49c3f3['filters']));if(_0x2bb911[_0x2445('0x2f')]['filter']){_0x2ac6a0[_0x2445('0x39')]=_[_0x2445('0x3d')](_0x2ac6a0[_0x2445('0x39')],{'$or':_[_0x2445('0x29')](_0x2ac6a0['attributes'],function(_0xab1999){var _0x2694e6={};_0x2694e6[_0xab1999]={'$like':'%'+_0x2bb911[_0x2445('0x2f')][_0x2445('0x3c')]+'%'};return _0x2694e6;})});}_0x2ac6a0=_['merge']({},_0x2ac6a0,_0x2bb911[_0x2445('0x46')]);return _0x3f223f['getTags'](_0x2ac6a0);}})[_0x2445('0x23')](function(_0x3735e1){if(_0x3735e1){_0xdcf9d8=_0x3735e1['length'];if(!_0x2bb911['query'][_0x2445('0x34')](_0x2445('0x35'))){_0x2ac6a0['limit']=qs[_0x2445('0x1d')](_0x2bb911[_0x2445('0x2f')][_0x2445('0x1d')]);_0x2ac6a0['offset']=qs[_0x2445('0x36')](_0x2bb911['query'][_0x2445('0x36')]);}return _0x3f223f[_0x2445('0x50')](_0x2ac6a0);}})[_0x2445('0x23')](function(_0x117578){if(_0x117578){return _0x117578?{'count':_0xdcf9d8,'rows':_0x117578}:null;}})[_0x2445('0x23')](respondWithResult(_0x1014a3,null))[_0x2445('0x43')](handleError(_0x1014a3,null));};exports[_0x2445('0x51')]=function(_0x18df80,_0x2f7c02,_0x429f46){if(_0x18df80['body']['id']){delete _0x18df80['body']['id'];}return db[_0x2445('0x2a')]['findOne']({'where':{'id':_0x18df80['params']['id']}})[_0x2445('0x23')](handleEntityNotFound(_0x2f7c02,null))[_0x2445('0x23')](function(_0x1d2936){if(_0x1d2936){return _0x1d2936['setTags'](_0x18df80[_0x2445('0x49')][_0x2445('0x52')]||[]);}return null;})[_0x2445('0x23')](respondWithResult(_0x2f7c02,null))[_0x2445('0x43')](handleError(_0x2f7c02,null));}; \ No newline at end of file +var _0xa451=['body','getFields','findOne','FreshdeskField','order','options','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','Content-Range','apply','reject','save','update','destroy','then','stack','name','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','count','includeAll','include','catch','show','params','intersection','length','find','create'];(function(_0x595619,_0x3b7ea6){var _0x30a1e4=function(_0x354040){while(--_0x354040){_0x595619['push'](_0x595619['shift']());}};_0x30a1e4(++_0x3b7ea6);}(_0xa451,0xfc));var _0x1a45=function(_0x3b0917,_0x88251){_0x3b0917=_0x3b0917-0x0;var _0x113a68=_0xa451[_0x3b0917];return _0x113a68;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a45('0x0'));var zipdir=require(_0x1a45('0x1'));var jsonpatch=require(_0x1a45('0x2'));var rp=require('request-promise');var moment=require(_0x1a45('0x3'));var BPromise=require(_0x1a45('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1a45('0x5'));var sox=require(_0x1a45('0x6'));var csv=require('to-csv');var ejs=require(_0x1a45('0x7'));var fs=require('fs');var fs_extra=require(_0x1a45('0x8'));var _=require(_0x1a45('0x9'));var squel=require('squel');var crypto=require(_0x1a45('0xa'));var jsforce=require(_0x1a45('0xb'));var deskjs=require(_0x1a45('0xc'));var toCsv=require(_0x1a45('0xd'));var querystring=require('querystring');var Papa=require(_0x1a45('0xe'));var Redis=require('ioredis');var authService=require(_0x1a45('0xf'));var qs=require(_0x1a45('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a45('0x11'));var logger=require(_0x1a45('0x12'))(_0x1a45('0x13'));var utils=require(_0x1a45('0x14'));var config=require(_0x1a45('0x15'));var licenseUtil=require(_0x1a45('0x16'));var db=require(_0x1a45('0x17'))['db'];function respondWithStatusCode(_0x3f4e0c,_0x21c4ea){_0x21c4ea=_0x21c4ea||0xcc;return function(_0x309c96){if(_0x309c96){return _0x3f4e0c['sendStatus'](_0x21c4ea);}return _0x3f4e0c[_0x1a45('0x18')](_0x21c4ea)[_0x1a45('0x19')]();};}function respondWithResult(_0x423d1d,_0x1479b5){_0x1479b5=_0x1479b5||0xc8;return function(_0x56961f){if(_0x56961f){return _0x423d1d[_0x1a45('0x18')](_0x1479b5)[_0x1a45('0x1a')](_0x56961f);}};}function respondWithFilteredResult(_0x417d23,_0x2b8622){return function(_0x4add7d){if(_0x4add7d){var _0x12b43d=typeof _0x2b8622['offset']===_0x1a45('0x1b')&&typeof _0x2b8622[_0x1a45('0x1c')]===_0x1a45('0x1b');var _0x458557=_0x4add7d['count'];var _0xd282af=_0x12b43d?0x0:_0x2b8622[_0x1a45('0x1d')];var _0x9e76c1=_0x12b43d?_0x4add7d['count']:_0x2b8622['offset']+_0x2b8622[_0x1a45('0x1c')];var _0x58c097;if(_0x9e76c1>=_0x458557){_0x9e76c1=_0x458557;_0x58c097=0xc8;}else{_0x58c097=0xce;}_0x417d23['status'](_0x58c097);return _0x417d23['set'](_0x1a45('0x1e'),_0xd282af+'-'+_0x9e76c1+'/'+_0x458557)['json'](_0x4add7d);}return null;};}function patchUpdates(_0x40a1b9){return function(_0x1f064b){try{jsonpatch[_0x1a45('0x1f')](_0x1f064b,_0x40a1b9,!![]);}catch(_0x33c7a6){return BPromise[_0x1a45('0x20')](_0x33c7a6);}return _0x1f064b[_0x1a45('0x21')]();};}function saveUpdates(_0x268b56,_0x240369){return function(_0x4d9525){if(_0x4d9525){return _0x4d9525[_0x1a45('0x22')](_0x268b56)['then'](function(_0x2d81c5){return _0x2d81c5;});}return null;};}function removeEntity(_0x450b42,_0x870b36){return function(_0x2623a3){if(_0x2623a3){return _0x2623a3[_0x1a45('0x23')]()[_0x1a45('0x24')](function(){_0x450b42[_0x1a45('0x18')](0xcc)[_0x1a45('0x19')]();});}};}function handleEntityNotFound(_0x8efb8b,_0x29d810){return function(_0x396cf3){if(!_0x396cf3){_0x8efb8b['sendStatus'](0x194);}return _0x396cf3;};}function handleError(_0xf5662,_0x15c1d9){_0x15c1d9=_0x15c1d9||0x1f4;return function(_0x211395){logger['error'](_0x211395[_0x1a45('0x25')]);if(_0x211395[_0x1a45('0x26')]){delete _0x211395['name'];}_0xf5662['status'](_0x15c1d9)['send'](_0x211395);};}exports['index']=function(_0x331592,_0x303610){var _0xacd890={},_0x54b0af={},_0x40a34b={'count':0x0,'rows':[]};var _0x3497ff=_[_0x1a45('0x27')](db[_0x1a45('0x28')][_0x1a45('0x29')],function(_0x1f5b41){return{'name':_0x1f5b41[_0x1a45('0x2a')],'type':_0x1f5b41['type'][_0x1a45('0x2b')]};});_0x54b0af[_0x1a45('0x2c')]=_[_0x1a45('0x27')](_0x3497ff,_0x1a45('0x26'));_0x54b0af[_0x1a45('0x2d')]=_[_0x1a45('0x2e')](_0x331592['query']);_0x54b0af[_0x1a45('0x2f')]=_['intersection'](_0x54b0af['model'],_0x54b0af[_0x1a45('0x2d')]);_0xacd890[_0x1a45('0x30')]=_['intersection'](_0x54b0af[_0x1a45('0x2c')],qs[_0x1a45('0x31')](_0x331592[_0x1a45('0x2d')][_0x1a45('0x31')]));_0xacd890[_0x1a45('0x30')]=_0xacd890[_0x1a45('0x30')]['length']?_0xacd890[_0x1a45('0x30')]:_0x54b0af[_0x1a45('0x2c')];if(!_0x331592['query'][_0x1a45('0x32')](_0x1a45('0x33'))){_0xacd890['limit']=qs[_0x1a45('0x1c')](_0x331592[_0x1a45('0x2d')][_0x1a45('0x1c')]);_0xacd890[_0x1a45('0x1d')]=qs[_0x1a45('0x1d')](_0x331592[_0x1a45('0x2d')][_0x1a45('0x1d')]);}_0xacd890['order']=qs[_0x1a45('0x34')](_0x331592[_0x1a45('0x2d')][_0x1a45('0x34')]);_0xacd890['where']=qs['filters'](_[_0x1a45('0x35')](_0x331592['query'],_0x54b0af[_0x1a45('0x2f')]),_0x3497ff);if(_0x331592['query'][_0x1a45('0x36')]){_0xacd890['where']=_[_0x1a45('0x37')](_0xacd890[_0x1a45('0x38')],{'$or':_[_0x1a45('0x27')](_0x3497ff,function(_0x40f0ab){if(_0x40f0ab['type']!==_0x1a45('0x39')){var _0x4abf2b={};_0x4abf2b[_0x40f0ab[_0x1a45('0x26')]]={'$like':'%'+_0x331592[_0x1a45('0x2d')][_0x1a45('0x36')]+'%'};return _0x4abf2b;}})});}_0xacd890=_[_0x1a45('0x37')]({},_0xacd890,_0x331592['options']);var _0x347444={'where':_0xacd890[_0x1a45('0x38')]};return db['FreshdeskConfiguration'][_0x1a45('0x3a')](_0x347444)[_0x1a45('0x24')](function(_0x277dc9){_0x40a34b[_0x1a45('0x3a')]=_0x277dc9;if(_0x331592[_0x1a45('0x2d')][_0x1a45('0x3b')]){_0xacd890[_0x1a45('0x3c')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0xacd890);})[_0x1a45('0x24')](function(_0x58c3f7){_0x40a34b['rows']=_0x58c3f7;return _0x40a34b;})['then'](respondWithFilteredResult(_0x303610,_0xacd890))[_0x1a45('0x3d')](handleError(_0x303610,null));};exports[_0x1a45('0x3e')]=function(_0x386465,_0x246631){var _0x49d2d0={'raw':![],'where':{'id':_0x386465[_0x1a45('0x3f')]['id']}},_0x40696f={};_0x40696f[_0x1a45('0x2c')]=_[_0x1a45('0x2e')](db[_0x1a45('0x28')][_0x1a45('0x29')]);_0x40696f[_0x1a45('0x2d')]=_[_0x1a45('0x2e')](_0x386465[_0x1a45('0x2d')]);_0x40696f['filters']=_['intersection'](_0x40696f[_0x1a45('0x2c')],_0x40696f[_0x1a45('0x2d')]);_0x49d2d0[_0x1a45('0x30')]=_[_0x1a45('0x40')](_0x40696f[_0x1a45('0x2c')],qs[_0x1a45('0x31')](_0x386465[_0x1a45('0x2d')][_0x1a45('0x31')]));_0x49d2d0['attributes']=_0x49d2d0['attributes'][_0x1a45('0x41')]?_0x49d2d0[_0x1a45('0x30')]:_0x40696f['model'];if(_0x386465[_0x1a45('0x2d')][_0x1a45('0x3b')]){_0x49d2d0[_0x1a45('0x3c')]=[{'all':!![]}];}_0x49d2d0=_['merge']({},_0x49d2d0,_0x386465['options']);return db[_0x1a45('0x28')][_0x1a45('0x42')](_0x49d2d0)['then'](handleEntityNotFound(_0x246631,null))[_0x1a45('0x24')](respondWithResult(_0x246631,null))['catch'](handleError(_0x246631,null));};exports[_0x1a45('0x43')]=function(_0x4d53e8,_0x32c252){return db[_0x1a45('0x28')][_0x1a45('0x43')](_0x4d53e8['body'],{})[_0x1a45('0x24')](respondWithResult(_0x32c252,0xc9))['catch'](handleError(_0x32c252,null));};exports[_0x1a45('0x22')]=function(_0x34dfcc,_0x410d8e){if(_0x34dfcc[_0x1a45('0x44')]['id']){delete _0x34dfcc[_0x1a45('0x44')]['id'];}return db[_0x1a45('0x28')][_0x1a45('0x42')]({'where':{'id':_0x34dfcc[_0x1a45('0x3f')]['id']}})[_0x1a45('0x24')](handleEntityNotFound(_0x410d8e,null))[_0x1a45('0x24')](saveUpdates(_0x34dfcc['body'],null))[_0x1a45('0x24')](respondWithResult(_0x410d8e,null))[_0x1a45('0x3d')](handleError(_0x410d8e,null));};exports['destroy']=function(_0x15d85e,_0xf5133d){return db[_0x1a45('0x28')]['find']({'where':{'id':_0x15d85e[_0x1a45('0x3f')]['id']}})[_0x1a45('0x24')](handleEntityNotFound(_0xf5133d,null))['then'](removeEntity(_0xf5133d,null))[_0x1a45('0x3d')](handleError(_0xf5133d,null));};exports[_0x1a45('0x45')]=function(_0xc92e7c,_0x16b1f4,_0x4e06fd){var _0x57928d={};var _0x3bc699={};var _0x5979d5;var _0x4684a6;return db[_0x1a45('0x28')][_0x1a45('0x46')]({'where':{'id':_0xc92e7c['params']['id']}})[_0x1a45('0x24')](handleEntityNotFound(_0x16b1f4,null))[_0x1a45('0x24')](function(_0x4a60d4){if(_0x4a60d4){_0x5979d5=_0x4a60d4;_0x3bc699[_0x1a45('0x2c')]=_[_0x1a45('0x2e')](db[_0x1a45('0x47')][_0x1a45('0x29')]);_0x3bc699[_0x1a45('0x2d')]=_[_0x1a45('0x2e')](_0xc92e7c['query']);_0x3bc699[_0x1a45('0x2f')]=_['intersection'](_0x3bc699['model'],_0x3bc699['query']);_0x57928d[_0x1a45('0x30')]=_[_0x1a45('0x40')](_0x3bc699[_0x1a45('0x2c')],qs[_0x1a45('0x31')](_0xc92e7c[_0x1a45('0x2d')][_0x1a45('0x31')]));_0x57928d[_0x1a45('0x30')]=_0x57928d[_0x1a45('0x30')][_0x1a45('0x41')]?_0x57928d[_0x1a45('0x30')]:_0x3bc699[_0x1a45('0x2c')];_0x57928d[_0x1a45('0x48')]=qs['sort'](_0xc92e7c[_0x1a45('0x2d')][_0x1a45('0x34')]);_0x57928d[_0x1a45('0x38')]=qs[_0x1a45('0x2f')](_[_0x1a45('0x35')](_0xc92e7c[_0x1a45('0x2d')],_0x3bc699['filters']));if(_0xc92e7c[_0x1a45('0x2d')]['filter']){_0x57928d[_0x1a45('0x38')]=_['merge'](_0x57928d[_0x1a45('0x38')],{'$or':_[_0x1a45('0x27')](_0x57928d[_0x1a45('0x30')],function(_0x2cc491){var _0x13a4fe={};_0x13a4fe[_0x2cc491]={'$like':'%'+_0xc92e7c[_0x1a45('0x2d')][_0x1a45('0x36')]+'%'};return _0x13a4fe;})});}_0x57928d=_[_0x1a45('0x37')]({},_0x57928d,_0xc92e7c[_0x1a45('0x49')]);return _0x5979d5['getFields'](_0x57928d);}})[_0x1a45('0x24')](function(_0x2c5588){if(_0x2c5588){_0x4684a6=_0x2c5588[_0x1a45('0x41')];if(!_0xc92e7c[_0x1a45('0x2d')][_0x1a45('0x32')]('nolimit')){_0x57928d[_0x1a45('0x1c')]=qs[_0x1a45('0x1c')](_0xc92e7c['query'][_0x1a45('0x1c')]);_0x57928d[_0x1a45('0x1d')]=qs['offset'](_0xc92e7c[_0x1a45('0x2d')][_0x1a45('0x1d')]);}return _0x5979d5[_0x1a45('0x45')](_0x57928d);}})[_0x1a45('0x24')](function(_0x865f44){if(_0x865f44){return _0x865f44?{'count':_0x4684a6,'rows':_0x865f44}:null;}})[_0x1a45('0x24')](respondWithResult(_0x16b1f4,null))[_0x1a45('0x3d')](handleError(_0x16b1f4,null));};exports[_0x1a45('0x4a')]=function(_0x42dab1,_0x114576,_0x4cb212){var _0x27d926={};var _0x4ecf5a={};var _0x5f4821;var _0x5ec2e7;return db[_0x1a45('0x28')][_0x1a45('0x46')]({'where':{'id':_0x42dab1[_0x1a45('0x3f')]['id']}})[_0x1a45('0x24')](handleEntityNotFound(_0x114576,null))[_0x1a45('0x24')](function(_0x446f87){if(_0x446f87){_0x5f4821=_0x446f87;_0x4ecf5a['model']=_[_0x1a45('0x2e')](db[_0x1a45('0x47')]['rawAttributes']);_0x4ecf5a[_0x1a45('0x2d')]=_[_0x1a45('0x2e')](_0x42dab1[_0x1a45('0x2d')]);_0x4ecf5a[_0x1a45('0x2f')]=_['intersection'](_0x4ecf5a[_0x1a45('0x2c')],_0x4ecf5a[_0x1a45('0x2d')]);_0x27d926[_0x1a45('0x30')]=_[_0x1a45('0x40')](_0x4ecf5a['model'],qs[_0x1a45('0x31')](_0x42dab1[_0x1a45('0x2d')][_0x1a45('0x31')]));_0x27d926[_0x1a45('0x30')]=_0x27d926[_0x1a45('0x30')][_0x1a45('0x41')]?_0x27d926[_0x1a45('0x30')]:_0x4ecf5a[_0x1a45('0x2c')];_0x27d926[_0x1a45('0x48')]=qs['sort'](_0x42dab1['query'][_0x1a45('0x34')]);_0x27d926[_0x1a45('0x38')]=qs[_0x1a45('0x2f')](_[_0x1a45('0x35')](_0x42dab1['query'],_0x4ecf5a[_0x1a45('0x2f')]));if(_0x42dab1['query'][_0x1a45('0x36')]){_0x27d926[_0x1a45('0x38')]=_[_0x1a45('0x37')](_0x27d926['where'],{'$or':_[_0x1a45('0x27')](_0x27d926[_0x1a45('0x30')],function(_0x43cead){var _0x27c14e={};_0x27c14e[_0x43cead]={'$like':'%'+_0x42dab1[_0x1a45('0x2d')][_0x1a45('0x36')]+'%'};return _0x27c14e;})});}_0x27d926=_[_0x1a45('0x37')]({},_0x27d926,_0x42dab1['options']);return _0x5f4821[_0x1a45('0x4a')](_0x27d926);}})[_0x1a45('0x24')](function(_0x21b9f5){if(_0x21b9f5){_0x5ec2e7=_0x21b9f5[_0x1a45('0x41')];if(!_0x42dab1[_0x1a45('0x2d')]['hasOwnProperty'](_0x1a45('0x33'))){_0x27d926[_0x1a45('0x1c')]=qs[_0x1a45('0x1c')](_0x42dab1[_0x1a45('0x2d')][_0x1a45('0x1c')]);_0x27d926[_0x1a45('0x1d')]=qs[_0x1a45('0x1d')](_0x42dab1['query']['offset']);}return _0x5f4821[_0x1a45('0x4a')](_0x27d926);}})['then'](function(_0x4b3b1a){if(_0x4b3b1a){return _0x4b3b1a?{'count':_0x5ec2e7,'rows':_0x4b3b1a}:null;}})[_0x1a45('0x24')](respondWithResult(_0x114576,null))[_0x1a45('0x3d')](handleError(_0x114576,null));};exports['getDescriptions']=function(_0xfa93a1,_0x5b7be2,_0x1ff9f9){var _0x48cf39={};var _0x351277={};var _0x408251;var _0x46a05e;return db[_0x1a45('0x28')][_0x1a45('0x46')]({'where':{'id':_0xfa93a1[_0x1a45('0x3f')]['id']}})[_0x1a45('0x24')](handleEntityNotFound(_0x5b7be2,null))['then'](function(_0x45aede){if(_0x45aede){_0x408251=_0x45aede;_0x351277['model']=_[_0x1a45('0x2e')](db[_0x1a45('0x47')][_0x1a45('0x29')]);_0x351277[_0x1a45('0x2d')]=_[_0x1a45('0x2e')](_0xfa93a1[_0x1a45('0x2d')]);_0x351277[_0x1a45('0x2f')]=_[_0x1a45('0x40')](_0x351277['model'],_0x351277[_0x1a45('0x2d')]);_0x48cf39[_0x1a45('0x30')]=_[_0x1a45('0x40')](_0x351277['model'],qs[_0x1a45('0x31')](_0xfa93a1[_0x1a45('0x2d')][_0x1a45('0x31')]));_0x48cf39[_0x1a45('0x30')]=_0x48cf39[_0x1a45('0x30')][_0x1a45('0x41')]?_0x48cf39['attributes']:_0x351277[_0x1a45('0x2c')];_0x48cf39[_0x1a45('0x48')]=qs[_0x1a45('0x34')](_0xfa93a1[_0x1a45('0x2d')][_0x1a45('0x34')]);_0x48cf39[_0x1a45('0x38')]=qs[_0x1a45('0x2f')](_[_0x1a45('0x35')](_0xfa93a1[_0x1a45('0x2d')],_0x351277['filters']));if(_0xfa93a1[_0x1a45('0x2d')][_0x1a45('0x36')]){_0x48cf39['where']=_['merge'](_0x48cf39[_0x1a45('0x38')],{'$or':_['map'](_0x48cf39['attributes'],function(_0x3f52a6){var _0x328a34={};_0x328a34[_0x3f52a6]={'$like':'%'+_0xfa93a1[_0x1a45('0x2d')]['filter']+'%'};return _0x328a34;})});}_0x48cf39=_[_0x1a45('0x37')]({},_0x48cf39,_0xfa93a1['options']);return _0x408251[_0x1a45('0x4b')](_0x48cf39);}})[_0x1a45('0x24')](function(_0x202fd9){if(_0x202fd9){_0x46a05e=_0x202fd9[_0x1a45('0x41')];if(!_0xfa93a1[_0x1a45('0x2d')]['hasOwnProperty'](_0x1a45('0x33'))){_0x48cf39[_0x1a45('0x1c')]=qs[_0x1a45('0x1c')](_0xfa93a1[_0x1a45('0x2d')][_0x1a45('0x1c')]);_0x48cf39[_0x1a45('0x1d')]=qs[_0x1a45('0x1d')](_0xfa93a1[_0x1a45('0x2d')]['offset']);}return _0x408251[_0x1a45('0x4b')](_0x48cf39);}})['then'](function(_0x17f840){if(_0x17f840){return _0x17f840?{'count':_0x46a05e,'rows':_0x17f840}:null;}})[_0x1a45('0x24')](respondWithResult(_0x5b7be2,null))[_0x1a45('0x3d')](handleError(_0x5b7be2,null));};exports[_0x1a45('0x4c')]=function(_0x43c174,_0x22f802,_0x18f76e){var _0x403b73={};var _0x2ca6d9={};var _0x53692e;var _0x3726d4;return db[_0x1a45('0x28')][_0x1a45('0x46')]({'where':{'id':_0x43c174[_0x1a45('0x3f')]['id']}})[_0x1a45('0x24')](handleEntityNotFound(_0x22f802,null))[_0x1a45('0x24')](function(_0x501774){if(_0x501774){_0x53692e=_0x501774;_0x2ca6d9[_0x1a45('0x2c')]=_[_0x1a45('0x2e')](db[_0x1a45('0x4d')][_0x1a45('0x29')]);_0x2ca6d9[_0x1a45('0x2d')]=_[_0x1a45('0x2e')](_0x43c174['query']);_0x2ca6d9['filters']=_['intersection'](_0x2ca6d9[_0x1a45('0x2c')],_0x2ca6d9[_0x1a45('0x2d')]);_0x403b73['attributes']=_[_0x1a45('0x40')](_0x2ca6d9[_0x1a45('0x2c')],qs[_0x1a45('0x31')](_0x43c174[_0x1a45('0x2d')][_0x1a45('0x31')]));_0x403b73[_0x1a45('0x30')]=_0x403b73[_0x1a45('0x30')][_0x1a45('0x41')]?_0x403b73[_0x1a45('0x30')]:_0x2ca6d9[_0x1a45('0x2c')];_0x403b73['order']=qs['sort'](_0x43c174[_0x1a45('0x2d')][_0x1a45('0x34')]);_0x403b73['where']=qs[_0x1a45('0x2f')](_[_0x1a45('0x35')](_0x43c174[_0x1a45('0x2d')],_0x2ca6d9[_0x1a45('0x2f')]));if(_0x43c174[_0x1a45('0x2d')][_0x1a45('0x36')]){_0x403b73[_0x1a45('0x38')]=_[_0x1a45('0x37')](_0x403b73[_0x1a45('0x38')],{'$or':_[_0x1a45('0x27')](_0x403b73['attributes'],function(_0x4dc161){var _0x5b9408={};_0x5b9408[_0x4dc161]={'$like':'%'+_0x43c174['query'][_0x1a45('0x36')]+'%'};return _0x5b9408;})});}_0x403b73=_[_0x1a45('0x37')]({},_0x403b73,_0x43c174[_0x1a45('0x49')]);return _0x53692e[_0x1a45('0x4c')](_0x403b73);}})[_0x1a45('0x24')](function(_0x27b4ca){if(_0x27b4ca){_0x3726d4=_0x27b4ca[_0x1a45('0x41')];if(!_0x43c174[_0x1a45('0x2d')][_0x1a45('0x32')](_0x1a45('0x33'))){_0x403b73[_0x1a45('0x1c')]=qs[_0x1a45('0x1c')](_0x43c174['query'][_0x1a45('0x1c')]);_0x403b73[_0x1a45('0x1d')]=qs[_0x1a45('0x1d')](_0x43c174[_0x1a45('0x2d')]['offset']);}return _0x53692e[_0x1a45('0x4c')](_0x403b73);}})['then'](function(_0x4e527d){if(_0x4e527d){return _0x4e527d?{'count':_0x3726d4,'rows':_0x4e527d}:null;}})[_0x1a45('0x24')](respondWithResult(_0x22f802,null))[_0x1a45('0x3d')](handleError(_0x22f802,null));};exports[_0x1a45('0x4e')]=function(_0x1f39d0,_0x2d850c,_0x1d776c){if(_0x1f39d0[_0x1a45('0x44')]['id']){delete _0x1f39d0[_0x1a45('0x44')]['id'];}return db[_0x1a45('0x28')][_0x1a45('0x46')]({'where':{'id':_0x1f39d0[_0x1a45('0x3f')]['id']}})[_0x1a45('0x24')](handleEntityNotFound(_0x2d850c,null))['then'](function(_0x3fdafc){if(_0x3fdafc){return _0x3fdafc[_0x1a45('0x4e')](_0x1f39d0[_0x1a45('0x44')][_0x1a45('0x4f')]||[]);}return null;})[_0x1a45('0x24')](respondWithResult(_0x2d850c,null))['catch'](handleError(_0x2d850c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index a0a6a0f..864d9f8 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 _0xbfdb=['rimraf','./intFreshdeskConfiguration.attributes','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xe95191,_0x1513c0){var _0x2845cc=function(_0x467baf){while(--_0x467baf){_0xe95191['push'](_0xe95191['shift']());}};_0x2845cc(++_0x1513c0);}(_0xbfdb,0x138));var _0xbbfd=function(_0x2d15ad,_0x960c6f){_0x2d15ad=_0x2d15ad-0x0;var _0x597805=_0xbfdb[_0x2d15ad];return _0x597805;};'use strict';var _=require(_0xbbfd('0x0'));var util=require(_0xbbfd('0x1'));var logger=require(_0xbbfd('0x2'))(_0xbbfd('0x3'));var moment=require(_0xbbfd('0x4'));var BPromise=require(_0xbbfd('0x5'));var rp=require(_0xbbfd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbbfd('0x7'));var config=require('../../config/environment');var attributes=require(_0xbbfd('0x8'));module['exports']=function(_0x25e6d4,_0x5c657c){return _0x25e6d4['define'](_0xbbfd('0x9'),attributes,{'tableName':_0xbbfd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x352a=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','api','bluebird','path'];(function(_0x4e1bea,_0x5d4ada){var _0x4686c6=function(_0xc8ce4d){while(--_0xc8ce4d){_0x4e1bea['push'](_0x4e1bea['shift']());}};_0x4686c6(++_0x5d4ada);}(_0x352a,0x95));var _0xa352=function(_0x566667,_0x3f99c2){_0x566667=_0x566667-0x0;var _0x277136=_0x352a[_0x566667];return _0x277136;};'use strict';var _=require(_0xa352('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa352('0x1'));var moment=require('moment');var BPromise=require(_0xa352('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa352('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa352('0x4'));module[_0xa352('0x5')]=function(_0x5ea41c,_0x2362d2){return _0x5ea41c[_0xa352('0x6')](_0xa352('0x7'),attributes,{'tableName':_0xa352('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 61a5b91..329632e 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 _0xd216=['http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x545b1b,_0x5600f2){var _0x276f35=function(_0x3cd407){while(--_0x3cd407){_0x545b1b['push'](_0x545b1b['shift']());}};_0x276f35(++_0x5600f2);}(_0xd216,0xca));var _0x6d21=function(_0xb94ed8,_0x2699ee){_0xb94ed8=_0xb94ed8-0x0;var _0x212c73=_0xd216[_0xb94ed8];return _0x212c73;};'use strict';var _=require('lodash');var util=require(_0x6d21('0x0'));var moment=require('moment');var BPromise=require(_0x6d21('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d21('0x2'))['db'];var utils=require(_0x6d21('0x3'));var logger=require(_0x6d21('0x4'))(_0x6d21('0x5'));var config=require(_0x6d21('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6d21('0x7')][_0x6d21('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13766f,_0x433319,_0x41d57e){return new BPromise(function(_0x38e7b2,_0x1b9c7c){return client[_0x6d21('0x9')](_0x13766f,_0x41d57e)[_0x6d21('0xa')](function(_0x57f416){logger[_0x6d21('0xb')](_0x6d21('0xc'),_0x433319,_0x6d21('0xd'));logger[_0x6d21('0xe')](_0x6d21('0xf'),_0x433319,_0x6d21('0xd'),JSON[_0x6d21('0x10')](_0x57f416));if(_0x57f416['error']){if(_0x57f416[_0x6d21('0x11')][_0x6d21('0x12')]===0x1f4){logger[_0x6d21('0x11')](_0x6d21('0xc'),_0x433319,_0x57f416['error'][_0x6d21('0x13')]);return _0x1b9c7c(_0x57f416[_0x6d21('0x11')][_0x6d21('0x13')]);}logger[_0x6d21('0x11')](_0x6d21('0xc'),_0x433319,_0x57f416[_0x6d21('0x11')][_0x6d21('0x13')]);return _0x38e7b2(_0x57f416['error'][_0x6d21('0x13')]);}else{logger[_0x6d21('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x433319,'request\x20sent');_0x38e7b2(_0x57f416[_0x6d21('0x14')][_0x6d21('0x13')]);}})['catch'](function(_0x14e66f){logger[_0x6d21('0x11')](_0x6d21('0xc'),_0x433319,_0x14e66f);_0x1b9c7c(_0x14e66f);});});} \ No newline at end of file +var _0x0cbd=['then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x1d7004,_0x577617){var _0x5d075e=function(_0xd2a738){while(--_0xd2a738){_0x1d7004['push'](_0x1d7004['shift']());}};_0x5d075e(++_0x577617);}(_0x0cbd,0x1ec));var _0xd0cb=function(_0x535fc1,_0x4643e9){_0x535fc1=_0x535fc1-0x0;var _0x3c243b=_0x0cbd[_0x535fc1];return _0x3c243b;};'use strict';var _=require(_0xd0cb('0x0'));var util=require('util');var moment=require(_0xd0cb('0x1'));var BPromise=require(_0xd0cb('0x2'));var rs=require(_0xd0cb('0x3'));var fs=require('fs');var Redis=require(_0xd0cb('0x4'));var db=require(_0xd0cb('0x5'))['db'];var utils=require(_0xd0cb('0x6'));var logger=require('../../config/logger')(_0xd0cb('0x7'));var config=require('../../config/environment');var jayson=require(_0xd0cb('0x8'));var client=jayson[_0xd0cb('0x9')][_0xd0cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ce769,_0x46f2dd,_0x3f8ff3){return new BPromise(function(_0x30b8ee,_0x189243){return client[_0xd0cb('0xb')](_0x3ce769,_0x3f8ff3)[_0xd0cb('0xc')](function(_0x62a470){logger[_0xd0cb('0xd')](_0xd0cb('0xe'),_0x46f2dd,_0xd0cb('0xf'));logger['debug'](_0xd0cb('0x10'),_0x46f2dd,'request\x20sent',JSON[_0xd0cb('0x11')](_0x62a470));if(_0x62a470['error']){if(_0x62a470[_0xd0cb('0x12')]['code']===0x1f4){logger['error'](_0xd0cb('0xe'),_0x46f2dd,_0x62a470[_0xd0cb('0x12')][_0xd0cb('0x13')]);return _0x189243(_0x62a470[_0xd0cb('0x12')][_0xd0cb('0x13')]);}logger[_0xd0cb('0x12')](_0xd0cb('0xe'),_0x46f2dd,_0x62a470['error'][_0xd0cb('0x13')]);return _0x30b8ee(_0x62a470[_0xd0cb('0x12')][_0xd0cb('0x13')]);}else{logger[_0xd0cb('0xd')](_0xd0cb('0xe'),_0x46f2dd,'request\x20sent');_0x30b8ee(_0x62a470['result'][_0xd0cb('0x13')]);}})[_0xd0cb('0x14')](function(_0xd73207){logger[_0xd0cb('0x12')](_0xd0cb('0xe'),_0x46f2dd,_0xd73207);_0x189243(_0xd73207);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 8fa681e..1dc2735 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 _0x1602=['/:id','show','create','put','update','delete','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index'];(function(_0x56fd0e,_0x52e52c){var _0x16590d=function(_0x2b1370){while(--_0x2b1370){_0x56fd0e['push'](_0x56fd0e['shift']());}};_0x16590d(++_0x52e52c);}(_0x1602,0xf1));var _0x2160=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1602[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2160('0x0'));var timeout=require(_0x2160('0x1'));var express=require(_0x2160('0x2'));var router=express['Router']();var fs_extra=require(_0x2160('0x3'));var auth=require(_0x2160('0x4'));var interaction=require(_0x2160('0x5'));var config=require(_0x2160('0x6'));var controller=require(_0x2160('0x7'));router[_0x2160('0x8')]('/',auth[_0x2160('0x9')](),controller[_0x2160('0xa')]);router[_0x2160('0x8')](_0x2160('0xb'),auth[_0x2160('0x9')](),controller[_0x2160('0xc')]);router['post']('/',auth[_0x2160('0x9')](),controller[_0x2160('0xd')]);router[_0x2160('0xe')](_0x2160('0xb'),auth[_0x2160('0x9')](),controller[_0x2160('0xf')]);router[_0x2160('0x10')](_0x2160('0xb'),auth[_0x2160('0x9')](),controller['destroy']);module[_0x2160('0x11')]=router; \ No newline at end of file +var _0xd7c0=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','multer','util','path'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0xd7c0,0x12d));var _0x0d7c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd7c0[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x0d7c('0x0'));var util=require(_0x0d7c('0x1'));var path=require(_0x0d7c('0x2'));var timeout=require(_0x0d7c('0x3'));var express=require(_0x0d7c('0x4'));var router=express['Router']();var fs_extra=require(_0x0d7c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0d7c('0x6'));var config=require(_0x0d7c('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x0d7c('0x8')]('/',auth[_0x0d7c('0x9')](),controller[_0x0d7c('0xa')]);router[_0x0d7c('0x8')]('/:id',auth[_0x0d7c('0x9')](),controller[_0x0d7c('0xb')]);router[_0x0d7c('0xc')]('/',auth['isAuthenticated'](),controller[_0x0d7c('0xd')]);router[_0x0d7c('0xe')](_0x0d7c('0xf'),auth[_0x0d7c('0x9')](),controller[_0x0d7c('0x10')]);router['delete'](_0x0d7c('0xf'),auth[_0x0d7c('0x9')](),controller[_0x0d7c('0x11')]);module[_0x0d7c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 4a5dde1..ebca985 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 _0x1161=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x4f2e41,_0x1dd963){var _0x2507be=function(_0x47ebb5){while(--_0x47ebb5){_0x4f2e41['push'](_0x4f2e41['shift']());}};_0x2507be(++_0x1dd963);}(_0x1161,0x190));var _0x1116=function(_0x4985e5,_0x32ccb7){_0x4985e5=_0x4985e5-0x0;var _0x246c7b=_0x1161[_0x4985e5];return _0x246c7b;};'use strict';var Sequelize=require(_0x1116('0x0'));module[_0x1116('0x1')]={'type':{'type':Sequelize[_0x1116('0x2')](_0x1116('0x3'),_0x1116('0x4'),_0x1116('0x5'),_0x1116('0x6'),'picklist'),'defaultValue':_0x1116('0x3')},'content':{'type':Sequelize[_0x1116('0x7')]},'key':{'type':Sequelize[_0x1116('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x1116('0x3'),_0x1116('0x4'),_0x1116('0x5'))},'keyContent':{'type':Sequelize[_0x1116('0x7')]},'idField':{'type':Sequelize[_0x1116('0x7')]},'nameField':{'type':Sequelize[_0x1116('0x7')]},'customField':{'type':Sequelize[_0x1116('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1116('0x7')]}}; \ No newline at end of file +var _0x751e=['BOOLEAN','exports','string','variable','STRING','ENUM'];(function(_0x46eb3d,_0x375214){var _0x4cbf48=function(_0x254502){while(--_0x254502){_0x46eb3d['push'](_0x46eb3d['shift']());}};_0x4cbf48(++_0x375214);}(_0x751e,0x157));var _0xe751=function(_0xced7a5,_0x43f946){_0xced7a5=_0xced7a5-0x0;var _0x390897=_0x751e[_0xced7a5];return _0x390897;};'use strict';var Sequelize=require('sequelize');module[_0xe751('0x0')]={'type':{'type':Sequelize['ENUM'](_0xe751('0x1'),_0xe751('0x2'),'customVariable','keyValue','picklist'),'defaultValue':_0xe751('0x1')},'content':{'type':Sequelize[_0xe751('0x3')]},'key':{'type':Sequelize[_0xe751('0x3')]},'keyType':{'type':Sequelize[_0xe751('0x4')]('string',_0xe751('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe751('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe751('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe751('0x3')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index b4d0a03..09f9dda 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 _0x9d9b=['reject','save','update','then','destroy','error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','json','apply'];(function(_0x1c2255,_0x4f6c80){var _0x3ed2a0=function(_0x43cfd9){while(--_0x43cfd9){_0x1c2255['push'](_0x1c2255['shift']());}};_0x3ed2a0(++_0x4f6c80);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x357cd2,_0x2a2f6f){_0x357cd2=_0x357cd2-0x0;var _0x1f6c4f=_0x9d9b[_0x357cd2];return _0x1f6c4f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9d9('0x0'));var zipdir=require(_0xb9d9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9d9('0x2'));var moment=require('moment');var BPromise=require(_0xb9d9('0x3'));var Mustache=require(_0xb9d9('0x4'));var util=require(_0xb9d9('0x5'));var path=require('path');var sox=require(_0xb9d9('0x6'));var csv=require('to-csv');var ejs=require(_0xb9d9('0x7'));var fs=require('fs');var fs_extra=require(_0xb9d9('0x8'));var _=require('lodash');var squel=require(_0xb9d9('0x9'));var crypto=require(_0xb9d9('0xa'));var jsforce=require(_0xb9d9('0xb'));var deskjs=require(_0xb9d9('0xc'));var toCsv=require(_0xb9d9('0xd'));var querystring=require(_0xb9d9('0xe'));var Papa=require(_0xb9d9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9d9('0x10'));var logger=require(_0xb9d9('0x11'))(_0xb9d9('0x12'));var utils=require('../../config/utils');var config=require(_0xb9d9('0x13'));var licenseUtil=require(_0xb9d9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cc03d,_0x5e3782){_0x5e3782=_0x5e3782||0xcc;return function(_0x1245e0){if(_0x1245e0){return _0x3cc03d[_0xb9d9('0x15')](_0x5e3782);}return _0x3cc03d[_0xb9d9('0x16')](_0x5e3782)[_0xb9d9('0x17')]();};}function respondWithResult(_0x26ef71,_0x1d26cf){_0x1d26cf=_0x1d26cf||0xc8;return function(_0x4f0c77){if(_0x4f0c77){return _0x26ef71[_0xb9d9('0x16')](_0x1d26cf)['json'](_0x4f0c77);}};}function respondWithFilteredResult(_0x4c8864,_0x3db648){return function(_0x2c9039){if(_0x2c9039){var _0x3909ab=typeof _0x3db648[_0xb9d9('0x18')]==='undefined'&&typeof _0x3db648['limit']===_0xb9d9('0x19');var _0x5617f1=_0x2c9039['count'];var _0x2b5e26=_0x3909ab?0x0:_0x3db648[_0xb9d9('0x18')];var _0x1e775d=_0x3909ab?_0x2c9039['count']:_0x3db648[_0xb9d9('0x18')]+_0x3db648[_0xb9d9('0x1a')];var _0x493552;if(_0x1e775d>=_0x5617f1){_0x1e775d=_0x5617f1;_0x493552=0xc8;}else{_0x493552=0xce;}_0x4c8864[_0xb9d9('0x16')](_0x493552);return _0x4c8864[_0xb9d9('0x1b')]('Content-Range',_0x2b5e26+'-'+_0x1e775d+'/'+_0x5617f1)[_0xb9d9('0x1c')](_0x2c9039);}return null;};}function patchUpdates(_0x36d55e){return function(_0x50f0ec){try{jsonpatch[_0xb9d9('0x1d')](_0x50f0ec,_0x36d55e,!![]);}catch(_0x42ca87){return BPromise[_0xb9d9('0x1e')](_0x42ca87);}return _0x50f0ec[_0xb9d9('0x1f')]();};}function saveUpdates(_0x288ccd,_0x362104){return function(_0x4c4230){if(_0x4c4230){return _0x4c4230[_0xb9d9('0x20')](_0x288ccd)[_0xb9d9('0x21')](function(_0x53c82a){return _0x53c82a;});}return null;};}function removeEntity(_0x45520b,_0x3d61bf){return function(_0x43bcab){if(_0x43bcab){return _0x43bcab[_0xb9d9('0x22')]()['then'](function(){_0x45520b[_0xb9d9('0x16')](0xcc)[_0xb9d9('0x17')]();});}};}function handleEntityNotFound(_0x6fa6af,_0x436cb7){return function(_0x2650f7){if(!_0x2650f7){_0x6fa6af[_0xb9d9('0x15')](0x194);}return _0x2650f7;};}function handleError(_0x56b394,_0x321937){_0x321937=_0x321937||0x1f4;return function(_0x42181d){logger[_0xb9d9('0x23')](_0x42181d['stack']);if(_0x42181d[_0xb9d9('0x24')]){delete _0x42181d[_0xb9d9('0x24')];}_0x56b394[_0xb9d9('0x16')](_0x321937)[_0xb9d9('0x25')](_0x42181d);};}exports[_0xb9d9('0x26')]=function(_0x402968,_0x89f901){var _0x5c74eb={},_0x39f006={},_0x3e79ef={'count':0x0,'rows':[]};var _0xdf519a=_[_0xb9d9('0x27')](db[_0xb9d9('0x28')][_0xb9d9('0x29')],function(_0x5dbb27){return{'name':_0x5dbb27[_0xb9d9('0x2a')],'type':_0x5dbb27[_0xb9d9('0x2b')][_0xb9d9('0x2c')]};});_0x39f006[_0xb9d9('0x2d')]=_['map'](_0xdf519a,_0xb9d9('0x24'));_0x39f006[_0xb9d9('0x2e')]=_[_0xb9d9('0x2f')](_0x402968[_0xb9d9('0x2e')]);_0x39f006[_0xb9d9('0x30')]=_[_0xb9d9('0x31')](_0x39f006['model'],_0x39f006['query']);_0x5c74eb[_0xb9d9('0x32')]=_['intersection'](_0x39f006[_0xb9d9('0x2d')],qs[_0xb9d9('0x33')](_0x402968[_0xb9d9('0x2e')]['fields']));_0x5c74eb[_0xb9d9('0x32')]=_0x5c74eb[_0xb9d9('0x32')][_0xb9d9('0x34')]?_0x5c74eb[_0xb9d9('0x32')]:_0x39f006[_0xb9d9('0x2d')];if(!_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x35')](_0xb9d9('0x36'))){_0x5c74eb[_0xb9d9('0x1a')]=qs['limit'](_0x402968['query']['limit']);_0x5c74eb[_0xb9d9('0x18')]=qs[_0xb9d9('0x18')](_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x18')]);}_0x5c74eb[_0xb9d9('0x37')]=qs[_0xb9d9('0x38')](_0x402968['query']['sort']);_0x5c74eb['where']=qs[_0xb9d9('0x30')](_[_0xb9d9('0x39')](_0x402968[_0xb9d9('0x2e')],_0x39f006[_0xb9d9('0x30')]),_0xdf519a);if(_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x3a')]){_0x5c74eb[_0xb9d9('0x3b')]=_[_0xb9d9('0x3c')](_0x5c74eb[_0xb9d9('0x3b')],{'$or':_[_0xb9d9('0x27')](_0xdf519a,function(_0xd8b9a2){if(_0xd8b9a2[_0xb9d9('0x2b')]!==_0xb9d9('0x3d')){var _0x46d9a7={};_0x46d9a7[_0xd8b9a2[_0xb9d9('0x24')]]={'$like':'%'+_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x3a')]+'%'};return _0x46d9a7;}})});}_0x5c74eb=_[_0xb9d9('0x3c')]({},_0x5c74eb,_0x402968[_0xb9d9('0x3e')]);var _0x4d3cea={'where':_0x5c74eb[_0xb9d9('0x3b')]};return db[_0xb9d9('0x28')]['count'](_0x4d3cea)['then'](function(_0x41cf93){_0x3e79ef['count']=_0x41cf93;if(_0x402968[_0xb9d9('0x2e')]['includeAll']){_0x5c74eb['include']=[{'all':!![]}];}return db[_0xb9d9('0x28')][_0xb9d9('0x3f')](_0x5c74eb);})[_0xb9d9('0x21')](function(_0x2acfe8){_0x3e79ef[_0xb9d9('0x40')]=_0x2acfe8;return _0x3e79ef;})[_0xb9d9('0x21')](respondWithFilteredResult(_0x89f901,_0x5c74eb))[_0xb9d9('0x41')](handleError(_0x89f901,null));};exports[_0xb9d9('0x42')]=function(_0x596cd8,_0x55007a){var _0x3f4b76={'raw':!![],'where':{'id':_0x596cd8[_0xb9d9('0x43')]['id']}},_0xb7c4ec={};_0xb7c4ec['model']=_[_0xb9d9('0x2f')](db[_0xb9d9('0x28')][_0xb9d9('0x29')]);_0xb7c4ec[_0xb9d9('0x2e')]=_[_0xb9d9('0x2f')](_0x596cd8[_0xb9d9('0x2e')]);_0xb7c4ec[_0xb9d9('0x30')]=_[_0xb9d9('0x31')](_0xb7c4ec['model'],_0xb7c4ec[_0xb9d9('0x2e')]);_0x3f4b76[_0xb9d9('0x32')]=_[_0xb9d9('0x31')](_0xb7c4ec[_0xb9d9('0x2d')],qs[_0xb9d9('0x33')](_0x596cd8[_0xb9d9('0x2e')][_0xb9d9('0x33')]));_0x3f4b76[_0xb9d9('0x32')]=_0x3f4b76[_0xb9d9('0x32')][_0xb9d9('0x34')]?_0x3f4b76[_0xb9d9('0x32')]:_0xb7c4ec[_0xb9d9('0x2d')];if(_0x596cd8[_0xb9d9('0x2e')][_0xb9d9('0x44')]){_0x3f4b76[_0xb9d9('0x45')]=[{'all':!![]}];}_0x3f4b76=_[_0xb9d9('0x3c')]({},_0x3f4b76,_0x596cd8[_0xb9d9('0x3e')]);return db['FreshdeskField'][_0xb9d9('0x46')](_0x3f4b76)[_0xb9d9('0x21')](handleEntityNotFound(_0x55007a,null))['then'](respondWithResult(_0x55007a,null))[_0xb9d9('0x41')](handleError(_0x55007a,null));};exports[_0xb9d9('0x47')]=function(_0x1a4922,_0xa6ce10){return db[_0xb9d9('0x28')][_0xb9d9('0x47')](_0x1a4922['body'],{})[_0xb9d9('0x21')](respondWithResult(_0xa6ce10,0xc9))[_0xb9d9('0x41')](handleError(_0xa6ce10,null));};exports[_0xb9d9('0x20')]=function(_0x30e3b1,_0x53f7cb){if(_0x30e3b1[_0xb9d9('0x48')]['id']){delete _0x30e3b1[_0xb9d9('0x48')]['id'];}return db[_0xb9d9('0x28')]['find']({'where':{'id':_0x30e3b1[_0xb9d9('0x43')]['id']}})[_0xb9d9('0x21')](handleEntityNotFound(_0x53f7cb,null))[_0xb9d9('0x21')](saveUpdates(_0x30e3b1[_0xb9d9('0x48')],null))[_0xb9d9('0x21')](respondWithResult(_0x53f7cb,null))[_0xb9d9('0x41')](handleError(_0x53f7cb,null));};exports['destroy']=function(_0xd417b9,_0x5cf9a0){return db[_0xb9d9('0x28')][_0xb9d9('0x46')]({'where':{'id':_0xd417b9['params']['id']}})[_0xb9d9('0x21')](handleEntityNotFound(_0x5cf9a0,null))['then'](removeEntity(_0x5cf9a0,null))['catch'](handleError(_0x5cf9a0,null));}; \ No newline at end of file +var _0x1752=['name','send','index','map','type','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','FreshdeskField','includeAll','findAll','catch','show','params','fields','include','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','reject','update','then','destroy','error','stack'];(function(_0x2c1679,_0x2b3850){var _0xfebdfc=function(_0x33b473){while(--_0x33b473){_0x2c1679['push'](_0x2c1679['shift']());}};_0xfebdfc(++_0x2b3850);}(_0x1752,0xa5));var _0x2175=function(_0x2c6b4b,_0x140ac4){_0x2c6b4b=_0x2c6b4b-0x0;var _0x530a15=_0x1752[_0x2c6b4b];return _0x530a15;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2175('0x0'));var zipdir=require(_0x2175('0x1'));var jsonpatch=require(_0x2175('0x2'));var rp=require(_0x2175('0x3'));var moment=require(_0x2175('0x4'));var BPromise=require(_0x2175('0x5'));var Mustache=require('mustache');var util=require(_0x2175('0x6'));var path=require(_0x2175('0x7'));var sox=require(_0x2175('0x8'));var csv=require(_0x2175('0x9'));var ejs=require(_0x2175('0xa'));var fs=require('fs');var fs_extra=require(_0x2175('0xb'));var _=require(_0x2175('0xc'));var squel=require(_0x2175('0xd'));var crypto=require(_0x2175('0xe'));var jsforce=require(_0x2175('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2175('0x9'));var querystring=require(_0x2175('0x10'));var Papa=require(_0x2175('0x11'));var Redis=require(_0x2175('0x12'));var authService=require(_0x2175('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2175('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2175('0x15'))['db'];function respondWithStatusCode(_0x5bc446,_0x43be3c){_0x43be3c=_0x43be3c||0xcc;return function(_0x393c02){if(_0x393c02){return _0x5bc446['sendStatus'](_0x43be3c);}return _0x5bc446[_0x2175('0x16')](_0x43be3c)[_0x2175('0x17')]();};}function respondWithResult(_0x45df73,_0x3bc01f){_0x3bc01f=_0x3bc01f||0xc8;return function(_0x21d4cd){if(_0x21d4cd){return _0x45df73[_0x2175('0x16')](_0x3bc01f)[_0x2175('0x18')](_0x21d4cd);}};}function respondWithFilteredResult(_0x413688,_0x5d84db){return function(_0x55b798){if(_0x55b798){var _0x371b42=typeof _0x5d84db[_0x2175('0x19')]===_0x2175('0x1a')&&typeof _0x5d84db['limit']==='undefined';var _0x588b0b=_0x55b798[_0x2175('0x1b')];var _0x377586=_0x371b42?0x0:_0x5d84db['offset'];var _0x53576c=_0x371b42?_0x55b798[_0x2175('0x1b')]:_0x5d84db[_0x2175('0x19')]+_0x5d84db[_0x2175('0x1c')];var _0x51628d;if(_0x53576c>=_0x588b0b){_0x53576c=_0x588b0b;_0x51628d=0xc8;}else{_0x51628d=0xce;}_0x413688[_0x2175('0x16')](_0x51628d);return _0x413688['set'](_0x2175('0x1d'),_0x377586+'-'+_0x53576c+'/'+_0x588b0b)['json'](_0x55b798);}return null;};}function patchUpdates(_0x37818a){return function(_0x4ec36c){try{jsonpatch['apply'](_0x4ec36c,_0x37818a,!![]);}catch(_0x5344af){return BPromise[_0x2175('0x1e')](_0x5344af);}return _0x4ec36c['save']();};}function saveUpdates(_0x28c4b8,_0x46ea57){return function(_0x2dd77b){if(_0x2dd77b){return _0x2dd77b[_0x2175('0x1f')](_0x28c4b8)[_0x2175('0x20')](function(_0x12d150){return _0x12d150;});}return null;};}function removeEntity(_0x5ac63e,_0x49d4b9){return function(_0x3d849e){if(_0x3d849e){return _0x3d849e[_0x2175('0x21')]()[_0x2175('0x20')](function(){_0x5ac63e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9c6374,_0xe252f0){return function(_0x2204cd){if(!_0x2204cd){_0x9c6374['sendStatus'](0x194);}return _0x2204cd;};}function handleError(_0x224fa3,_0x4d2120){_0x4d2120=_0x4d2120||0x1f4;return function(_0x5e696c){logger[_0x2175('0x22')](_0x5e696c[_0x2175('0x23')]);if(_0x5e696c[_0x2175('0x24')]){delete _0x5e696c[_0x2175('0x24')];}_0x224fa3[_0x2175('0x16')](_0x4d2120)[_0x2175('0x25')](_0x5e696c);};}exports[_0x2175('0x26')]=function(_0x40d8c8,_0x1b807b){var _0x1c721d={},_0x7b6edb={},_0x56dcf9={'count':0x0,'rows':[]};var _0x20fccf=_[_0x2175('0x27')](db['FreshdeskField']['rawAttributes'],function(_0x3d64ac){return{'name':_0x3d64ac['fieldName'],'type':_0x3d64ac[_0x2175('0x28')]['key']};});_0x7b6edb['model']=_['map'](_0x20fccf,_0x2175('0x24'));_0x7b6edb[_0x2175('0x29')]=_[_0x2175('0x2a')](_0x40d8c8[_0x2175('0x29')]);_0x7b6edb['filters']=_[_0x2175('0x2b')](_0x7b6edb[_0x2175('0x2c')],_0x7b6edb['query']);_0x1c721d[_0x2175('0x2d')]=_[_0x2175('0x2b')](_0x7b6edb['model'],qs['fields'](_0x40d8c8['query']['fields']));_0x1c721d[_0x2175('0x2d')]=_0x1c721d[_0x2175('0x2d')][_0x2175('0x2e')]?_0x1c721d[_0x2175('0x2d')]:_0x7b6edb[_0x2175('0x2c')];if(!_0x40d8c8[_0x2175('0x29')][_0x2175('0x2f')](_0x2175('0x30'))){_0x1c721d['limit']=qs['limit'](_0x40d8c8['query']['limit']);_0x1c721d['offset']=qs[_0x2175('0x19')](_0x40d8c8[_0x2175('0x29')]['offset']);}_0x1c721d[_0x2175('0x31')]=qs[_0x2175('0x32')](_0x40d8c8[_0x2175('0x29')][_0x2175('0x32')]);_0x1c721d[_0x2175('0x33')]=qs[_0x2175('0x34')](_['pick'](_0x40d8c8[_0x2175('0x29')],_0x7b6edb[_0x2175('0x34')]),_0x20fccf);if(_0x40d8c8[_0x2175('0x29')][_0x2175('0x35')]){_0x1c721d[_0x2175('0x33')]=_[_0x2175('0x36')](_0x1c721d[_0x2175('0x33')],{'$or':_[_0x2175('0x27')](_0x20fccf,function(_0x38c212){if(_0x38c212[_0x2175('0x28')]!==_0x2175('0x37')){var _0x4be65c={};_0x4be65c[_0x38c212[_0x2175('0x24')]]={'$like':'%'+_0x40d8c8[_0x2175('0x29')][_0x2175('0x35')]+'%'};return _0x4be65c;}})});}_0x1c721d=_['merge']({},_0x1c721d,_0x40d8c8['options']);var _0x932bb6={'where':_0x1c721d['where']};return db[_0x2175('0x38')][_0x2175('0x1b')](_0x932bb6)[_0x2175('0x20')](function(_0x4989df){_0x56dcf9['count']=_0x4989df;if(_0x40d8c8[_0x2175('0x29')][_0x2175('0x39')]){_0x1c721d['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x2175('0x3a')](_0x1c721d);})[_0x2175('0x20')](function(_0x61784d){_0x56dcf9['rows']=_0x61784d;return _0x56dcf9;})[_0x2175('0x20')](respondWithFilteredResult(_0x1b807b,_0x1c721d))[_0x2175('0x3b')](handleError(_0x1b807b,null));};exports[_0x2175('0x3c')]=function(_0x5a6679,_0x49cf7d){var _0x459cee={'raw':!![],'where':{'id':_0x5a6679[_0x2175('0x3d')]['id']}},_0x47f60d={};_0x47f60d[_0x2175('0x2c')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x47f60d[_0x2175('0x29')]=_['keys'](_0x5a6679['query']);_0x47f60d[_0x2175('0x34')]=_['intersection'](_0x47f60d[_0x2175('0x2c')],_0x47f60d[_0x2175('0x29')]);_0x459cee[_0x2175('0x2d')]=_[_0x2175('0x2b')](_0x47f60d[_0x2175('0x2c')],qs[_0x2175('0x3e')](_0x5a6679['query'][_0x2175('0x3e')]));_0x459cee[_0x2175('0x2d')]=_0x459cee[_0x2175('0x2d')][_0x2175('0x2e')]?_0x459cee[_0x2175('0x2d')]:_0x47f60d[_0x2175('0x2c')];if(_0x5a6679['query'][_0x2175('0x39')]){_0x459cee[_0x2175('0x3f')]=[{'all':!![]}];}_0x459cee=_[_0x2175('0x36')]({},_0x459cee,_0x5a6679['options']);return db[_0x2175('0x38')]['find'](_0x459cee)['then'](handleEntityNotFound(_0x49cf7d,null))[_0x2175('0x20')](respondWithResult(_0x49cf7d,null))[_0x2175('0x3b')](handleError(_0x49cf7d,null));};exports[_0x2175('0x40')]=function(_0x5ee4aa,_0x32d6eb){return db[_0x2175('0x38')][_0x2175('0x40')](_0x5ee4aa[_0x2175('0x41')],{})[_0x2175('0x20')](respondWithResult(_0x32d6eb,0xc9))['catch'](handleError(_0x32d6eb,null));};exports['update']=function(_0xdb0a97,_0xeaabe3){if(_0xdb0a97[_0x2175('0x41')]['id']){delete _0xdb0a97[_0x2175('0x41')]['id'];}return db[_0x2175('0x38')]['find']({'where':{'id':_0xdb0a97[_0x2175('0x3d')]['id']}})[_0x2175('0x20')](handleEntityNotFound(_0xeaabe3,null))[_0x2175('0x20')](saveUpdates(_0xdb0a97['body'],null))['then'](respondWithResult(_0xeaabe3,null))[_0x2175('0x3b')](handleError(_0xeaabe3,null));};exports['destroy']=function(_0x5af419,_0x5bab81){return db['FreshdeskField'][_0x2175('0x42')]({'where':{'id':_0x5af419[_0x2175('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5bab81,null))['then'](removeEntity(_0x5bab81,null))['catch'](handleError(_0x5bab81,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 6861041..a79e1b2 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 _0xd9d4=['../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1aa049,_0x9ae13c){var _0x357f29=function(_0xfd2f83){while(--_0xfd2f83){_0x1aa049['push'](_0x1aa049['shift']());}};_0x357f29(++_0x9ae13c);}(_0xd9d4,0x15c));var _0x4d9d=function(_0x954b3a,_0x10a7c1){_0x954b3a=_0x954b3a-0x0;var _0x3a313e=_0xd9d4[_0x954b3a];return _0x3a313e;};'use strict';var _=require(_0x4d9d('0x0'));var util=require(_0x4d9d('0x1'));var logger=require(_0x4d9d('0x2'))(_0x4d9d('0x3'));var moment=require(_0x4d9d('0x4'));var BPromise=require(_0x4d9d('0x5'));var rp=require(_0x4d9d('0x6'));var fs=require('fs');var path=require(_0x4d9d('0x7'));var rimraf=require(_0x4d9d('0x8'));var config=require(_0x4d9d('0x9'));var attributes=require(_0x4d9d('0xa'));module[_0x4d9d('0xb')]=function(_0x1c72f4,_0x475ce2){return _0x1c72f4[_0x4d9d('0xc')](_0x4d9d('0xd'),attributes,{'tableName':_0x4d9d('0xe'),'paranoid':![],'indexes':[{'name':_0x4d9d('0xf'),'fields':['idField',_0x4d9d('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x645a=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','util'];(function(_0x2dba81,_0x5646d2){var _0x107132=function(_0x1285c2){while(--_0x1285c2){_0x2dba81['push'](_0x2dba81['shift']());}};_0x107132(++_0x5646d2);}(_0x645a,0x1cf));var _0xa645=function(_0x2a27d2,_0x1194e5){_0x2a27d2=_0x2a27d2-0x0;var _0x18f683=_0x645a[_0x2a27d2];return _0x18f683;};'use strict';var _=require(_0xa645('0x0'));var util=require(_0xa645('0x1'));var logger=require(_0xa645('0x2'))('api');var moment=require(_0xa645('0x3'));var BPromise=require(_0xa645('0x4'));var rp=require(_0xa645('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa645('0x6'));var config=require(_0xa645('0x7'));var attributes=require(_0xa645('0x8'));module[_0xa645('0x9')]=function(_0x333e55,_0x17914f){return _0x333e55[_0xa645('0xa')](_0xa645('0xb'),attributes,{'tableName':_0xa645('0xc'),'paranoid':![],'indexes':[{'name':_0xa645('0xd'),'fields':[_0xa645('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index df67f49..984b6dc 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 _0xcbbf=['stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xcbbf,0x1be));var _0xfcbb=function(_0x267701,_0x290b33){_0x267701=_0x267701-0x0;var _0x37402b=_0xcbbf[_0x267701];return _0x37402b;};'use strict';var _=require(_0xfcbb('0x0'));var util=require(_0xfcbb('0x1'));var moment=require(_0xfcbb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcbb('0x3'));var db=require(_0xfcbb('0x4'))['db'];var utils=require(_0xfcbb('0x5'));var logger=require(_0xfcbb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfcbb('0x7'));var client=jayson[_0xfcbb('0x8')][_0xfcbb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40aa2e,_0x41f648,_0x25598c){return new BPromise(function(_0x38d0ac,_0x4b3c4e){return client[_0xfcbb('0xa')](_0x40aa2e,_0x25598c)['then'](function(_0x425011){logger[_0xfcbb('0xb')](_0xfcbb('0xc'),_0x41f648,'request\x20sent');logger[_0xfcbb('0xd')](_0xfcbb('0xe'),_0x41f648,_0xfcbb('0xf'),JSON[_0xfcbb('0x10')](_0x425011));if(_0x425011[_0xfcbb('0x11')]){if(_0x425011[_0xfcbb('0x11')][_0xfcbb('0x12')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x41f648,_0x425011[_0xfcbb('0x11')]['message']);return _0x4b3c4e(_0x425011[_0xfcbb('0x11')][_0xfcbb('0x13')]);}logger[_0xfcbb('0x11')](_0xfcbb('0xc'),_0x41f648,_0x425011[_0xfcbb('0x11')]['message']);return _0x38d0ac(_0x425011[_0xfcbb('0x11')][_0xfcbb('0x13')]);}else{logger['info'](_0xfcbb('0xc'),_0x41f648,_0xfcbb('0xf'));_0x38d0ac(_0x425011[_0xfcbb('0x14')][_0xfcbb('0x13')]);}})[_0xfcbb('0x15')](function(_0x5d339f){logger['error'](_0xfcbb('0xc'),_0x41f648,_0x5d339f);_0x4b3c4e(_0x5d339f);});});} \ No newline at end of file +var _0x395d=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x40b687,_0x3d93e3){var _0x1a32fa=function(_0x1e0a74){while(--_0x1e0a74){_0x40b687['push'](_0x40b687['shift']());}};_0x1a32fa(++_0x3d93e3);}(_0x395d,0x1cb));var _0xd395=function(_0x5315d3,_0x27862e){_0x5315d3=_0x5315d3-0x0;var _0x45a7f7=_0x395d[_0x5315d3];return _0x45a7f7;};'use strict';var _=require(_0xd395('0x0'));var util=require(_0xd395('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd395('0x2'));var fs=require('fs');var Redis=require(_0xd395('0x3'));var db=require(_0xd395('0x4'))['db'];var utils=require(_0xd395('0x5'));var logger=require(_0xd395('0x6'))(_0xd395('0x7'));var config=require('../../config/environment');var jayson=require(_0xd395('0x8'));var client=jayson['client'][_0xd395('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c8b05,_0x2c276e,_0x255698){return new BPromise(function(_0x428162,_0x97236f){return client[_0xd395('0xa')](_0x3c8b05,_0x255698)[_0xd395('0xb')](function(_0xa5d5ca){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x2c276e,_0xd395('0xc'));logger[_0xd395('0xd')](_0xd395('0xe'),_0x2c276e,_0xd395('0xc'),JSON[_0xd395('0xf')](_0xa5d5ca));if(_0xa5d5ca['error']){if(_0xa5d5ca[_0xd395('0x10')][_0xd395('0x11')]===0x1f4){logger[_0xd395('0x10')](_0xd395('0x12'),_0x2c276e,_0xa5d5ca[_0xd395('0x10')][_0xd395('0x13')]);return _0x97236f(_0xa5d5ca[_0xd395('0x10')][_0xd395('0x13')]);}logger[_0xd395('0x10')](_0xd395('0x12'),_0x2c276e,_0xa5d5ca['error'][_0xd395('0x13')]);return _0x428162(_0xa5d5ca[_0xd395('0x10')]['message']);}else{logger[_0xd395('0x14')](_0xd395('0x12'),_0x2c276e,_0xd395('0xc'));_0x428162(_0xa5d5ca[_0xd395('0x15')][_0xd395('0x13')]);}})[_0xd395('0x16')](function(_0x524910){logger[_0xd395('0x10')](_0xd395('0x12'),_0x2c276e,_0x524910);_0x97236f(_0x524910);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index e0f60e4..524d4c4 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 _0xb9be=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x357ae5,_0x59df38){var _0x1c6db9=function(_0x5e3e6a){while(--_0x5e3e6a){_0x357ae5['push'](_0x357ae5['shift']());}};_0x1c6db9(++_0x59df38);}(_0xb9be,0xc5));var _0xeb9b=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0xb9be[_0x1daaa9];return _0x1dd221;};'use strict';var multer=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var path=require(_0xeb9b('0x2'));var timeout=require(_0xeb9b('0x3'));var express=require(_0xeb9b('0x4'));var router=express[_0xeb9b('0x5')]();var fs_extra=require(_0xeb9b('0x6'));var auth=require(_0xeb9b('0x7'));var interaction=require(_0xeb9b('0x8'));var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router[_0xeb9b('0x9')]('/',auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xb')]);router['get'](_0xeb9b('0xc'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xd')]);router[_0xeb9b('0x9')](_0xeb9b('0xe'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xf')]);router[_0xeb9b('0x9')](_0xeb9b('0x10'),auth['isAuthenticated'](),controller[_0xeb9b('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xeb9b('0x12')]);router[_0xeb9b('0x13')]('/:id/configurations',auth[_0xeb9b('0xa')](),controller[_0xeb9b('0x14')]);router[_0xeb9b('0x15')](_0xeb9b('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xeb9b('0xc'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0x16')]);module['exports']=router; \ No newline at end of file +var _0x41bb=['/:id/fields','getFields','post','addConfiguration','put','update','delete','/:id','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations'];(function(_0x3d603c,_0x58f368){var _0x3d9e98=function(_0x272219){while(--_0x272219){_0x3d603c['push'](_0x3d603c['shift']());}};_0x3d9e98(++_0x58f368);}(_0x41bb,0xc5));var _0xb41b=function(_0x47a377,_0x40c6e1){_0x47a377=_0x47a377-0x0;var _0x3df18b=_0x41bb[_0x47a377];return _0x3df18b;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var fs_extra=require(_0xb41b('0x4'));var auth=require(_0xb41b('0x5'));var interaction=require(_0xb41b('0x6'));var config=require('../../config/environment');var controller=require(_0xb41b('0x7'));router[_0xb41b('0x8')]('/',auth[_0xb41b('0x9')](),controller['index']);router['get']('/:id',auth[_0xb41b('0x9')](),controller[_0xb41b('0xa')]);router['get'](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xc')]);router[_0xb41b('0x8')](_0xb41b('0xd'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xe')]);router['post']('/',auth[_0xb41b('0x9')](),controller['create']);router[_0xb41b('0xf')](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x10')]);router[_0xb41b('0x11')]('/:id',auth[_0xb41b('0x9')](),controller[_0xb41b('0x12')]);router[_0xb41b('0x13')](_0xb41b('0x14'),auth[_0xb41b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 2567011..47fa1c4 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 _0xfff0=['username','exports','STRING'];(function(_0x31aa0d,_0x217049){var _0x53e7e0=function(_0x244397){while(--_0x244397){_0x31aa0d['push'](_0x31aa0d['shift']());}};_0x53e7e0(++_0x217049);}(_0xfff0,0x139));var _0x0fff=function(_0x4da243,_0x168207){_0x4da243=_0x4da243-0x0;var _0x19254c=_0xfff0[_0x4da243];return _0x19254c;};'use strict';var Sequelize=require('sequelize');module[_0x0fff('0x0')]={'name':{'type':Sequelize[_0x0fff('0x1')]},'description':{'type':Sequelize[_0x0fff('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x0fff('0x2')},'apiKey':{'type':Sequelize[_0x0fff('0x1')]},'remoteUri':{'type':Sequelize[_0x0fff('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x0fff('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2032=['remoteUri','exports','STRING','username'];(function(_0x58916b,_0x43fc5d){var _0x238322=function(_0x5cdf4a){while(--_0x5cdf4a){_0x58916b['push'](_0x58916b['shift']());}};_0x238322(++_0x43fc5d);}(_0x2032,0xd9));var _0x2203=function(_0x5e0848,_0x415900){_0x5e0848=_0x5e0848-0x0;var _0x1353e6=_0x2032[_0x5e0848];return _0x1353e6;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')]},'description':{'type':Sequelize[_0x2203('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x2203('0x2')},'apiKey':{'type':Sequelize[_0x2203('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2203('0x3')},'serverUrl':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 1ec07ad..55cc5cc 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 _0xa390=['sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','FreshsalesConfiguration','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','name','send','index','FreshsalesAccount','rawAttributes','map','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa390,0xfa));var _0x0a39=function(_0x3919e0,_0x3b6d09){_0x3919e0=_0x3919e0-0x0;var _0x3ce558=_0xa390[_0x3919e0];return _0x3ce558;};'use strict';var emlformat=require(_0x0a39('0x0'));var rimraf=require(_0x0a39('0x1'));var zipdir=require(_0x0a39('0x2'));var jsonpatch=require(_0x0a39('0x3'));var rp=require('request-promise');var moment=require(_0x0a39('0x4'));var BPromise=require(_0x0a39('0x5'));var Mustache=require('mustache');var util=require(_0x0a39('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0a39('0x7'));var ejs=require(_0x0a39('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a39('0x9'));var squel=require(_0x0a39('0xa'));var crypto=require('crypto');var jsforce=require(_0x0a39('0xb'));var deskjs=require(_0x0a39('0xc'));var toCsv=require(_0x0a39('0x7'));var querystring=require(_0x0a39('0xd'));var Papa=require(_0x0a39('0xe'));var Redis=require(_0x0a39('0xf'));var authService=require(_0x0a39('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0a39('0x11'));var hardwareService=require(_0x0a39('0x12'));var logger=require('../../config/logger')(_0x0a39('0x13'));var utils=require(_0x0a39('0x14'));var config=require(_0x0a39('0x15'));var licenseUtil=require(_0x0a39('0x16'));var db=require(_0x0a39('0x17'))['db'];var integrations=require(_0x0a39('0x18'));function respondWithStatusCode(_0x9b8a02,_0x50e4d3){_0x50e4d3=_0x50e4d3||0xcc;return function(_0x1bba07){if(_0x1bba07){return _0x9b8a02[_0x0a39('0x19')](_0x50e4d3);}return _0x9b8a02[_0x0a39('0x1a')](_0x50e4d3)[_0x0a39('0x1b')]();};}function respondWithResult(_0x5e64d0,_0x36a949){_0x36a949=_0x36a949||0xc8;return function(_0x348070){if(_0x348070){return _0x5e64d0[_0x0a39('0x1a')](_0x36a949)[_0x0a39('0x1c')](_0x348070);}};}function respondWithFilteredResult(_0x1c1881,_0x498c35){return function(_0x5baa4e){if(_0x5baa4e){var _0x104d51=typeof _0x498c35[_0x0a39('0x1d')]===_0x0a39('0x1e')&&typeof _0x498c35[_0x0a39('0x1f')]===_0x0a39('0x1e');var _0x227cbc=_0x5baa4e[_0x0a39('0x20')];var _0x1b5dba=_0x104d51?0x0:_0x498c35['offset'];var _0x41661d=_0x104d51?_0x5baa4e[_0x0a39('0x20')]:_0x498c35[_0x0a39('0x1d')]+_0x498c35[_0x0a39('0x1f')];var _0x52a803;if(_0x41661d>=_0x227cbc){_0x41661d=_0x227cbc;_0x52a803=0xc8;}else{_0x52a803=0xce;}_0x1c1881['status'](_0x52a803);return _0x1c1881[_0x0a39('0x21')](_0x0a39('0x22'),_0x1b5dba+'-'+_0x41661d+'/'+_0x227cbc)['json'](_0x5baa4e);}return null;};}function patchUpdates(_0x5bb733){return function(_0x5e7972){try{jsonpatch[_0x0a39('0x23')](_0x5e7972,_0x5bb733,!![]);}catch(_0x29b58b){return BPromise[_0x0a39('0x24')](_0x29b58b);}return _0x5e7972['save']();};}function saveUpdates(_0x39800e,_0x541f2e){return function(_0x5df66d){if(_0x5df66d){return _0x5df66d[_0x0a39('0x25')](_0x39800e)['then'](function(_0x5a6b70){return _0x5a6b70;});}return null;};}function removeEntity(_0x165005,_0x4cd2af){return function(_0x4ed16c){if(_0x4ed16c){return _0x4ed16c['destroy']()[_0x0a39('0x26')](function(){_0x165005[_0x0a39('0x1a')](0xcc)[_0x0a39('0x1b')]();});}};}function handleEntityNotFound(_0x4bd148,_0x5db1ea){return function(_0x26352b){if(!_0x26352b){_0x4bd148['sendStatus'](0x194);}return _0x26352b;};}function handleError(_0x470d86,_0x41cb42){_0x41cb42=_0x41cb42||0x1f4;return function(_0x12b051){logger['error'](_0x12b051['stack']);if(_0x12b051['name']){delete _0x12b051[_0x0a39('0x27')];}_0x470d86[_0x0a39('0x1a')](_0x41cb42)[_0x0a39('0x28')](_0x12b051);};}exports[_0x0a39('0x29')]=function(_0x1a6f6e,_0x1b1571){var _0x447dcc={},_0x5778b3={},_0x550a4a={'count':0x0,'rows':[]};var _0x14c1fb=_['map'](db[_0x0a39('0x2a')][_0x0a39('0x2b')],function(_0x13ff4f){return{'name':_0x13ff4f['fieldName'],'type':_0x13ff4f['type']['key']};});_0x5778b3['model']=_[_0x0a39('0x2c')](_0x14c1fb,_0x0a39('0x27'));_0x5778b3['query']=_[_0x0a39('0x2d')](_0x1a6f6e[_0x0a39('0x2e')]);_0x5778b3[_0x0a39('0x2f')]=_['intersection'](_0x5778b3[_0x0a39('0x30')],_0x5778b3[_0x0a39('0x2e')]);_0x447dcc[_0x0a39('0x31')]=_[_0x0a39('0x32')](_0x5778b3[_0x0a39('0x30')],qs['fields'](_0x1a6f6e[_0x0a39('0x2e')][_0x0a39('0x33')]));_0x447dcc[_0x0a39('0x31')]=_0x447dcc[_0x0a39('0x31')][_0x0a39('0x34')]?_0x447dcc[_0x0a39('0x31')]:_0x5778b3[_0x0a39('0x30')];if(!_0x1a6f6e[_0x0a39('0x2e')][_0x0a39('0x35')](_0x0a39('0x36'))){_0x447dcc[_0x0a39('0x1f')]=qs[_0x0a39('0x1f')](_0x1a6f6e['query'][_0x0a39('0x1f')]);_0x447dcc['offset']=qs[_0x0a39('0x1d')](_0x1a6f6e[_0x0a39('0x2e')][_0x0a39('0x1d')]);}_0x447dcc[_0x0a39('0x37')]=qs[_0x0a39('0x38')](_0x1a6f6e['query'][_0x0a39('0x38')]);_0x447dcc[_0x0a39('0x39')]=qs[_0x0a39('0x2f')](_[_0x0a39('0x3a')](_0x1a6f6e[_0x0a39('0x2e')],_0x5778b3['filters']),_0x14c1fb);if(_0x1a6f6e[_0x0a39('0x2e')][_0x0a39('0x3b')]){_0x447dcc[_0x0a39('0x39')]=_[_0x0a39('0x3c')](_0x447dcc[_0x0a39('0x39')],{'$or':_[_0x0a39('0x2c')](_0x14c1fb,function(_0x5f4106){if(_0x5f4106[_0x0a39('0x3d')]!=='VIRTUAL'){var _0x324292={};_0x324292[_0x5f4106[_0x0a39('0x27')]]={'$like':'%'+_0x1a6f6e['query'][_0x0a39('0x3b')]+'%'};return _0x324292;}})});}_0x447dcc=_['merge']({},_0x447dcc,_0x1a6f6e[_0x0a39('0x3e')]);var _0x1e4e8c={'where':_0x447dcc[_0x0a39('0x39')]};return db[_0x0a39('0x2a')][_0x0a39('0x20')](_0x1e4e8c)[_0x0a39('0x26')](function(_0x34be7b){_0x550a4a[_0x0a39('0x20')]=_0x34be7b;if(_0x1a6f6e[_0x0a39('0x2e')][_0x0a39('0x3f')]){_0x447dcc['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x0a39('0x40')](_0x447dcc);})[_0x0a39('0x26')](function(_0x2d7858){_0x550a4a[_0x0a39('0x41')]=_0x2d7858;return _0x550a4a;})[_0x0a39('0x26')](respondWithFilteredResult(_0x1b1571,_0x447dcc))[_0x0a39('0x42')](handleError(_0x1b1571,null));};exports[_0x0a39('0x43')]=function(_0x183758,_0x2e2ee3){var _0x16ec8a={'raw':![],'where':{'id':_0x183758[_0x0a39('0x44')]['id']}},_0x2af63d={};_0x2af63d[_0x0a39('0x30')]=_[_0x0a39('0x2d')](db['FreshsalesAccount'][_0x0a39('0x2b')]);_0x2af63d[_0x0a39('0x2e')]=_[_0x0a39('0x2d')](_0x183758[_0x0a39('0x2e')]);_0x2af63d[_0x0a39('0x2f')]=_['intersection'](_0x2af63d[_0x0a39('0x30')],_0x2af63d[_0x0a39('0x2e')]);_0x16ec8a[_0x0a39('0x31')]=_[_0x0a39('0x32')](_0x2af63d[_0x0a39('0x30')],qs[_0x0a39('0x33')](_0x183758[_0x0a39('0x2e')][_0x0a39('0x33')]));_0x16ec8a[_0x0a39('0x31')]=_0x16ec8a['attributes']['length']?_0x16ec8a[_0x0a39('0x31')]:_0x2af63d['model'];if(_0x183758['query'][_0x0a39('0x3f')]){_0x16ec8a['include']=[{'all':!![]}];}_0x16ec8a=_[_0x0a39('0x3c')]({},_0x16ec8a,_0x183758[_0x0a39('0x3e')]);return db[_0x0a39('0x2a')][_0x0a39('0x45')](_0x16ec8a)[_0x0a39('0x26')](handleEntityNotFound(_0x2e2ee3,null))[_0x0a39('0x26')](respondWithResult(_0x2e2ee3,null))['catch'](handleError(_0x2e2ee3,null));};exports[_0x0a39('0x46')]=function(_0x328d40,_0x363939){return db[_0x0a39('0x2a')][_0x0a39('0x46')](_0x328d40[_0x0a39('0x47')],{})[_0x0a39('0x26')](respondWithResult(_0x363939,0xc9))[_0x0a39('0x42')](handleError(_0x363939,null));};exports['update']=function(_0x2e6449,_0xd5646){if(_0x2e6449[_0x0a39('0x47')]['id']){delete _0x2e6449[_0x0a39('0x47')]['id'];}return db[_0x0a39('0x2a')][_0x0a39('0x45')]({'where':{'id':_0x2e6449[_0x0a39('0x44')]['id']}})['then'](handleEntityNotFound(_0xd5646,null))['then'](saveUpdates(_0x2e6449[_0x0a39('0x47')],null))['then'](respondWithResult(_0xd5646,null))[_0x0a39('0x42')](handleError(_0xd5646,null));};exports[_0x0a39('0x48')]=function(_0x1793ce,_0x50204d){return db[_0x0a39('0x2a')][_0x0a39('0x45')]({'where':{'id':_0x1793ce['params']['id']}})[_0x0a39('0x26')](handleEntityNotFound(_0x50204d,null))[_0x0a39('0x26')](removeEntity(_0x50204d,null))[_0x0a39('0x42')](handleError(_0x50204d,null));};exports[_0x0a39('0x49')]=function(_0x5d1b42,_0x4968b5,_0x55f945){var _0x6e62ff={};var _0x1cd157={};var _0x34449d;var _0x3c661a;return db[_0x0a39('0x2a')]['findOne']({'where':{'id':_0x5d1b42[_0x0a39('0x44')]['id']}})[_0x0a39('0x26')](handleEntityNotFound(_0x4968b5,null))[_0x0a39('0x26')](function(_0x500330){if(_0x500330){_0x34449d=_0x500330;_0x1cd157[_0x0a39('0x30')]=_[_0x0a39('0x2d')](db[_0x0a39('0x4a')][_0x0a39('0x2b')]);_0x1cd157[_0x0a39('0x2e')]=_[_0x0a39('0x2d')](_0x5d1b42['query']);_0x1cd157[_0x0a39('0x2f')]=_[_0x0a39('0x32')](_0x1cd157[_0x0a39('0x30')],_0x1cd157[_0x0a39('0x2e')]);_0x6e62ff['attributes']=_[_0x0a39('0x32')](_0x1cd157[_0x0a39('0x30')],qs[_0x0a39('0x33')](_0x5d1b42[_0x0a39('0x2e')][_0x0a39('0x33')]));_0x6e62ff[_0x0a39('0x31')]=_0x6e62ff[_0x0a39('0x31')]['length']?_0x6e62ff[_0x0a39('0x31')]:_0x1cd157[_0x0a39('0x30')];_0x6e62ff['order']=qs['sort'](_0x5d1b42[_0x0a39('0x2e')][_0x0a39('0x38')]);_0x6e62ff[_0x0a39('0x39')]=qs[_0x0a39('0x2f')](_[_0x0a39('0x3a')](_0x5d1b42[_0x0a39('0x2e')],_0x1cd157[_0x0a39('0x2f')]));if(_0x5d1b42['query'][_0x0a39('0x3b')]){_0x6e62ff[_0x0a39('0x39')]=_[_0x0a39('0x3c')](_0x6e62ff['where'],{'$or':_[_0x0a39('0x2c')](_0x6e62ff[_0x0a39('0x31')],function(_0x4fe802){var _0x4bbb70={};_0x4bbb70[_0x4fe802]={'$like':'%'+_0x5d1b42[_0x0a39('0x2e')][_0x0a39('0x3b')]+'%'};return _0x4bbb70;})});}_0x6e62ff=_['merge']({},_0x6e62ff,_0x5d1b42['options']);return _0x34449d[_0x0a39('0x49')](_0x6e62ff);}})[_0x0a39('0x26')](function(_0x4775bb){if(_0x4775bb){_0x3c661a=_0x4775bb[_0x0a39('0x34')];if(!_0x5d1b42['query'][_0x0a39('0x35')]('nolimit')){_0x6e62ff[_0x0a39('0x1f')]=qs[_0x0a39('0x1f')](_0x5d1b42['query'][_0x0a39('0x1f')]);_0x6e62ff[_0x0a39('0x1d')]=qs[_0x0a39('0x1d')](_0x5d1b42[_0x0a39('0x2e')]['offset']);}return _0x34449d['getConfigurations'](_0x6e62ff);}})[_0x0a39('0x26')](function(_0x20a700){if(_0x20a700){return _0x20a700?{'count':_0x3c661a,'rows':_0x20a700}:null;}})[_0x0a39('0x26')](respondWithResult(_0x4968b5,null))[_0x0a39('0x42')](handleError(_0x4968b5,null));};exports[_0x0a39('0x4b')]=function(_0x5a2342,_0x2e2df8,_0x51beb1){if(_0x5a2342[_0x0a39('0x47')]['id']){delete _0x5a2342[_0x0a39('0x47')]['id'];}return db[_0x0a39('0x2a')][_0x0a39('0x4c')]({'where':{'id':_0x5a2342[_0x0a39('0x44')]['id']}})[_0x0a39('0x26')](handleEntityNotFound(_0x2e2df8,null))[_0x0a39('0x26')](function(_0x182637){if(_0x182637){_0x5a2342[_0x0a39('0x47')][_0x0a39('0x4d')]=_0x182637['id'];_0x5a2342[_0x0a39('0x47')][_0x0a39('0x4e')]=integrations['getSubjects'](_0x5a2342[_0x0a39('0x47')][_0x0a39('0x4f')],_0x5a2342[_0x0a39('0x47')][_0x0a39('0x3d')]);_0x5a2342[_0x0a39('0x47')][_0x0a39('0x50')]=integrations[_0x0a39('0x51')](_0x5a2342[_0x0a39('0x47')]['channel'],_0x5a2342[_0x0a39('0x47')]['type']);return db[_0x0a39('0x4a')]['create'](_0x5a2342[_0x0a39('0x47')],{'include':[{'model':db[_0x0a39('0x52')],'as':_0x0a39('0x4e')},{'model':db[_0x0a39('0x52')],'as':_0x0a39('0x50')}]});}return null;})[_0x0a39('0x26')](respondWithResult(_0x2e2df8,null))[_0x0a39('0x42')](handleError(_0x2e2df8,null));};exports[_0x0a39('0x53')]=function(_0x4cdc94,_0x22ae62,_0x394e92){var _0x528f0e='';var _0x60e95='';return db['FreshsalesAccount'][_0x0a39('0x4c')]({'where':{'id':_0x4cdc94[_0x0a39('0x44')]['id']},'attributes':['id',_0x0a39('0x54'),_0x0a39('0x55'),_0x0a39('0x56')]})[_0x0a39('0x26')](handleEntityNotFound(_0x22ae62,null))[_0x0a39('0x26')](function(_0x542e4f){if(_0x542e4f){_0x60e95=_0x542e4f[_0x0a39('0x54')];_0x528f0e=_0x542e4f[_0x0a39('0x55')];var _0x163508=_0x542e4f['remoteUri']['slice'](-0x1);if(_0x163508==='/'){_0x528f0e=_0x528f0e[_0x0a39('0x57')](0x0,_0x528f0e[_0x0a39('0x58')](_0x163508));}return rp({'method':_0x0a39('0x59'),'uri':util[_0x0a39('0x5a')](_0x0a39('0x5b'),_0x528f0e,_0x0a39('0x5c')),'headers':{'Authorization':'Token\x20token='+_0x542e4f[_0x0a39('0x56')]},'json':!![]});}})['then'](function(_0x4b09a3){if(_0x4b09a3){var _0x5410b8=_0x4b09a3[_0x0a39('0x5d')];var _0x18560c=![];var _0x20dd9c=null;for(_0x20dd9c=0x0;_0x20dd9c<_0x5410b8[_0x0a39('0x34')];_0x20dd9c++){if(_0x5410b8[_0x20dd9c][_0x0a39('0x5e')]===_0x60e95){_0x18560c=!![];}}if(_0x18560c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0a39('0x5f')});}}})[_0x0a39('0x26')](respondWithResult(_0x22ae62,null))[_0x0a39('0x42')](function(_0x5bd59f){var _0x192aa1=_0x4cdc94['query'][_0x0a39('0x60')]?0x1f4:_0x5bd59f[_0x0a39('0x61')]||0x1f4;logger[_0x0a39('0x62')](_0x0a39('0x63'),_0x0a39('0x53'),_0x192aa1,JSON[_0x0a39('0x64')](_0x5bd59f));delete _0x5bd59f[_0x0a39('0x27')];if(_0x192aa1===0x191){_0x192aa1=0x190;}_0x22ae62[_0x0a39('0x1a')](_0x192aa1)['send'](_0x4cdc94[_0x0a39('0x2e')]['test']?{'message':_0x0a39('0x65'),'statusCode':_0x5bd59f['statusCode']}:_0x5bd59f);});}; \ No newline at end of file +var _0xbfd5=['test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','Content-Range','apply','reject','update','then','sendStatus','error','name','map','FreshsalesAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','body','params','getConfigurations','findOne','order','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','getFields','username','apiKey','remoteUri','slice','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found'];(function(_0xe374f8,_0x3c2a45){var _0x3ab4b6=function(_0x476b8a){while(--_0x476b8a){_0xe374f8['push'](_0xe374f8['shift']());}};_0x3ab4b6(++_0x3c2a45);}(_0xbfd5,0x6c));var _0x5bfd=function(_0x434199,_0x2d9df6){_0x434199=_0x434199-0x0;var _0x2c8e39=_0xbfd5[_0x434199];return _0x2c8e39;};'use strict';var emlformat=require(_0x5bfd('0x0'));var rimraf=require(_0x5bfd('0x1'));var zipdir=require(_0x5bfd('0x2'));var jsonpatch=require(_0x5bfd('0x3'));var rp=require(_0x5bfd('0x4'));var moment=require(_0x5bfd('0x5'));var BPromise=require(_0x5bfd('0x6'));var Mustache=require(_0x5bfd('0x7'));var util=require('util');var path=require(_0x5bfd('0x8'));var sox=require('sox');var csv=require(_0x5bfd('0x9'));var ejs=require(_0x5bfd('0xa'));var fs=require('fs');var fs_extra=require(_0x5bfd('0xb'));var _=require(_0x5bfd('0xc'));var squel=require(_0x5bfd('0xd'));var crypto=require(_0x5bfd('0xe'));var jsforce=require(_0x5bfd('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5bfd('0x10'));var Papa=require('papaparse');var Redis=require(_0x5bfd('0x11'));var authService=require(_0x5bfd('0x12'));var qs=require(_0x5bfd('0x13'));var as=require(_0x5bfd('0x14'));var hardwareService=require(_0x5bfd('0x15'));var logger=require('../../config/logger')(_0x5bfd('0x16'));var utils=require('../../config/utils');var config=require(_0x5bfd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bfd('0x18'))['db'];var integrations=require(_0x5bfd('0x19'));function respondWithStatusCode(_0x1e1c2e,_0x35cd8e){_0x35cd8e=_0x35cd8e||0xcc;return function(_0x77d4c1){if(_0x77d4c1){return _0x1e1c2e['sendStatus'](_0x35cd8e);}return _0x1e1c2e[_0x5bfd('0x1a')](_0x35cd8e)[_0x5bfd('0x1b')]();};}function respondWithResult(_0x454820,_0x56ef9a){_0x56ef9a=_0x56ef9a||0xc8;return function(_0x1ae8b9){if(_0x1ae8b9){return _0x454820[_0x5bfd('0x1a')](_0x56ef9a)[_0x5bfd('0x1c')](_0x1ae8b9);}};}function respondWithFilteredResult(_0x445c92,_0x51ab18){return function(_0x5c493a){if(_0x5c493a){var _0x4d376c=typeof _0x51ab18[_0x5bfd('0x1d')]===_0x5bfd('0x1e')&&typeof _0x51ab18['limit']===_0x5bfd('0x1e');var _0x9af13a=_0x5c493a[_0x5bfd('0x1f')];var _0x39a897=_0x4d376c?0x0:_0x51ab18[_0x5bfd('0x1d')];var _0x5ca5bd=_0x4d376c?_0x5c493a['count']:_0x51ab18[_0x5bfd('0x1d')]+_0x51ab18['limit'];var _0x4ae37f;if(_0x5ca5bd>=_0x9af13a){_0x5ca5bd=_0x9af13a;_0x4ae37f=0xc8;}else{_0x4ae37f=0xce;}_0x445c92['status'](_0x4ae37f);return _0x445c92['set'](_0x5bfd('0x20'),_0x39a897+'-'+_0x5ca5bd+'/'+_0x9af13a)[_0x5bfd('0x1c')](_0x5c493a);}return null;};}function patchUpdates(_0x1cf0bd){return function(_0x38519d){try{jsonpatch[_0x5bfd('0x21')](_0x38519d,_0x1cf0bd,!![]);}catch(_0x1f8ba3){return BPromise[_0x5bfd('0x22')](_0x1f8ba3);}return _0x38519d['save']();};}function saveUpdates(_0x4d65e3,_0x3ada91){return function(_0x446a3e){if(_0x446a3e){return _0x446a3e[_0x5bfd('0x23')](_0x4d65e3)[_0x5bfd('0x24')](function(_0xadb4a5){return _0xadb4a5;});}return null;};}function removeEntity(_0x41438f,_0x35288f){return function(_0x216748){if(_0x216748){return _0x216748['destroy']()[_0x5bfd('0x24')](function(){_0x41438f[_0x5bfd('0x1a')](0xcc)[_0x5bfd('0x1b')]();});}};}function handleEntityNotFound(_0x30501f,_0x1e7af6){return function(_0x47192e){if(!_0x47192e){_0x30501f[_0x5bfd('0x25')](0x194);}return _0x47192e;};}function handleError(_0x1a6f9b,_0x1dfd66){_0x1dfd66=_0x1dfd66||0x1f4;return function(_0x5b5b50){logger[_0x5bfd('0x26')](_0x5b5b50['stack']);if(_0x5b5b50[_0x5bfd('0x27')]){delete _0x5b5b50[_0x5bfd('0x27')];}_0x1a6f9b['status'](_0x1dfd66)['send'](_0x5b5b50);};}exports['index']=function(_0x9fa06d,_0x4dec09){var _0x15f619={},_0x841796={},_0x1f4647={'count':0x0,'rows':[]};var _0x82e5ca=_[_0x5bfd('0x28')](db[_0x5bfd('0x29')]['rawAttributes'],function(_0x552746){return{'name':_0x552746[_0x5bfd('0x2a')],'type':_0x552746[_0x5bfd('0x2b')][_0x5bfd('0x2c')]};});_0x841796[_0x5bfd('0x2d')]=_[_0x5bfd('0x28')](_0x82e5ca,_0x5bfd('0x27'));_0x841796['query']=_[_0x5bfd('0x2e')](_0x9fa06d[_0x5bfd('0x2f')]);_0x841796[_0x5bfd('0x30')]=_[_0x5bfd('0x31')](_0x841796[_0x5bfd('0x2d')],_0x841796['query']);_0x15f619[_0x5bfd('0x32')]=_[_0x5bfd('0x31')](_0x841796['model'],qs[_0x5bfd('0x33')](_0x9fa06d[_0x5bfd('0x2f')][_0x5bfd('0x33')]));_0x15f619['attributes']=_0x15f619[_0x5bfd('0x32')][_0x5bfd('0x34')]?_0x15f619[_0x5bfd('0x32')]:_0x841796[_0x5bfd('0x2d')];if(!_0x9fa06d[_0x5bfd('0x2f')][_0x5bfd('0x35')](_0x5bfd('0x36'))){_0x15f619['limit']=qs[_0x5bfd('0x37')](_0x9fa06d[_0x5bfd('0x2f')]['limit']);_0x15f619[_0x5bfd('0x1d')]=qs[_0x5bfd('0x1d')](_0x9fa06d[_0x5bfd('0x2f')][_0x5bfd('0x1d')]);}_0x15f619['order']=qs['sort'](_0x9fa06d[_0x5bfd('0x2f')][_0x5bfd('0x38')]);_0x15f619[_0x5bfd('0x39')]=qs[_0x5bfd('0x30')](_[_0x5bfd('0x3a')](_0x9fa06d['query'],_0x841796[_0x5bfd('0x30')]),_0x82e5ca);if(_0x9fa06d['query'][_0x5bfd('0x3b')]){_0x15f619[_0x5bfd('0x39')]=_[_0x5bfd('0x3c')](_0x15f619[_0x5bfd('0x39')],{'$or':_[_0x5bfd('0x28')](_0x82e5ca,function(_0x5d68ff){if(_0x5d68ff[_0x5bfd('0x2b')]!==_0x5bfd('0x3d')){var _0x1bb8be={};_0x1bb8be[_0x5d68ff[_0x5bfd('0x27')]]={'$like':'%'+_0x9fa06d['query']['filter']+'%'};return _0x1bb8be;}})});}_0x15f619=_[_0x5bfd('0x3c')]({},_0x15f619,_0x9fa06d[_0x5bfd('0x3e')]);var _0x24292d={'where':_0x15f619[_0x5bfd('0x39')]};return db[_0x5bfd('0x29')][_0x5bfd('0x1f')](_0x24292d)[_0x5bfd('0x24')](function(_0x2da9aa){_0x1f4647['count']=_0x2da9aa;if(_0x9fa06d[_0x5bfd('0x2f')][_0x5bfd('0x3f')]){_0x15f619[_0x5bfd('0x40')]=[{'all':!![]}];}return db[_0x5bfd('0x29')][_0x5bfd('0x41')](_0x15f619);})[_0x5bfd('0x24')](function(_0x5888ac){_0x1f4647[_0x5bfd('0x42')]=_0x5888ac;return _0x1f4647;})[_0x5bfd('0x24')](respondWithFilteredResult(_0x4dec09,_0x15f619))[_0x5bfd('0x43')](handleError(_0x4dec09,null));};exports[_0x5bfd('0x44')]=function(_0x5f143d,_0x5b44d8){var _0x3412b5={'raw':![],'where':{'id':_0x5f143d['params']['id']}},_0x53dec3={};_0x53dec3[_0x5bfd('0x2d')]=_[_0x5bfd('0x2e')](db[_0x5bfd('0x29')][_0x5bfd('0x45')]);_0x53dec3['query']=_[_0x5bfd('0x2e')](_0x5f143d[_0x5bfd('0x2f')]);_0x53dec3[_0x5bfd('0x30')]=_['intersection'](_0x53dec3[_0x5bfd('0x2d')],_0x53dec3[_0x5bfd('0x2f')]);_0x3412b5[_0x5bfd('0x32')]=_[_0x5bfd('0x31')](_0x53dec3[_0x5bfd('0x2d')],qs[_0x5bfd('0x33')](_0x5f143d['query'][_0x5bfd('0x33')]));_0x3412b5[_0x5bfd('0x32')]=_0x3412b5[_0x5bfd('0x32')]['length']?_0x3412b5[_0x5bfd('0x32')]:_0x53dec3[_0x5bfd('0x2d')];if(_0x5f143d['query'][_0x5bfd('0x3f')]){_0x3412b5[_0x5bfd('0x40')]=[{'all':!![]}];}_0x3412b5=_[_0x5bfd('0x3c')]({},_0x3412b5,_0x5f143d[_0x5bfd('0x3e')]);return db[_0x5bfd('0x29')][_0x5bfd('0x46')](_0x3412b5)[_0x5bfd('0x24')](handleEntityNotFound(_0x5b44d8,null))[_0x5bfd('0x24')](respondWithResult(_0x5b44d8,null))['catch'](handleError(_0x5b44d8,null));};exports['create']=function(_0x67828e,_0x35171d){return db[_0x5bfd('0x29')]['create'](_0x67828e[_0x5bfd('0x47')],{})[_0x5bfd('0x24')](respondWithResult(_0x35171d,0xc9))[_0x5bfd('0x43')](handleError(_0x35171d,null));};exports[_0x5bfd('0x23')]=function(_0x920ecd,_0x1d86a2){if(_0x920ecd[_0x5bfd('0x47')]['id']){delete _0x920ecd[_0x5bfd('0x47')]['id'];}return db[_0x5bfd('0x29')][_0x5bfd('0x46')]({'where':{'id':_0x920ecd[_0x5bfd('0x48')]['id']}})[_0x5bfd('0x24')](handleEntityNotFound(_0x1d86a2,null))[_0x5bfd('0x24')](saveUpdates(_0x920ecd['body'],null))[_0x5bfd('0x24')](respondWithResult(_0x1d86a2,null))[_0x5bfd('0x43')](handleError(_0x1d86a2,null));};exports['destroy']=function(_0x1089c0,_0x5d7fc7){return db[_0x5bfd('0x29')][_0x5bfd('0x46')]({'where':{'id':_0x1089c0[_0x5bfd('0x48')]['id']}})[_0x5bfd('0x24')](handleEntityNotFound(_0x5d7fc7,null))[_0x5bfd('0x24')](removeEntity(_0x5d7fc7,null))['catch'](handleError(_0x5d7fc7,null));};exports[_0x5bfd('0x49')]=function(_0x129303,_0x525020,_0x160990){var _0x124553={};var _0x3907ee={};var _0x3ce92e;var _0x597216;return db[_0x5bfd('0x29')][_0x5bfd('0x4a')]({'where':{'id':_0x129303['params']['id']}})[_0x5bfd('0x24')](handleEntityNotFound(_0x525020,null))['then'](function(_0x229495){if(_0x229495){_0x3ce92e=_0x229495;_0x3907ee[_0x5bfd('0x2d')]=_[_0x5bfd('0x2e')](db['FreshsalesConfiguration'][_0x5bfd('0x45')]);_0x3907ee[_0x5bfd('0x2f')]=_[_0x5bfd('0x2e')](_0x129303[_0x5bfd('0x2f')]);_0x3907ee[_0x5bfd('0x30')]=_[_0x5bfd('0x31')](_0x3907ee[_0x5bfd('0x2d')],_0x3907ee[_0x5bfd('0x2f')]);_0x124553['attributes']=_[_0x5bfd('0x31')](_0x3907ee[_0x5bfd('0x2d')],qs[_0x5bfd('0x33')](_0x129303[_0x5bfd('0x2f')][_0x5bfd('0x33')]));_0x124553[_0x5bfd('0x32')]=_0x124553['attributes'][_0x5bfd('0x34')]?_0x124553['attributes']:_0x3907ee[_0x5bfd('0x2d')];_0x124553[_0x5bfd('0x4b')]=qs['sort'](_0x129303[_0x5bfd('0x2f')]['sort']);_0x124553['where']=qs[_0x5bfd('0x30')](_[_0x5bfd('0x3a')](_0x129303[_0x5bfd('0x2f')],_0x3907ee[_0x5bfd('0x30')]));if(_0x129303['query'][_0x5bfd('0x3b')]){_0x124553[_0x5bfd('0x39')]=_['merge'](_0x124553[_0x5bfd('0x39')],{'$or':_['map'](_0x124553['attributes'],function(_0x29bd28){var _0x3e38a8={};_0x3e38a8[_0x29bd28]={'$like':'%'+_0x129303['query']['filter']+'%'};return _0x3e38a8;})});}_0x124553=_[_0x5bfd('0x3c')]({},_0x124553,_0x129303[_0x5bfd('0x3e')]);return _0x3ce92e['getConfigurations'](_0x124553);}})['then'](function(_0x7cafc7){if(_0x7cafc7){_0x597216=_0x7cafc7[_0x5bfd('0x34')];if(!_0x129303[_0x5bfd('0x2f')][_0x5bfd('0x35')](_0x5bfd('0x36'))){_0x124553[_0x5bfd('0x37')]=qs['limit'](_0x129303[_0x5bfd('0x2f')]['limit']);_0x124553[_0x5bfd('0x1d')]=qs[_0x5bfd('0x1d')](_0x129303[_0x5bfd('0x2f')][_0x5bfd('0x1d')]);}return _0x3ce92e[_0x5bfd('0x49')](_0x124553);}})['then'](function(_0x206637){if(_0x206637){return _0x206637?{'count':_0x597216,'rows':_0x206637}:null;}})['then'](respondWithResult(_0x525020,null))[_0x5bfd('0x43')](handleError(_0x525020,null));};exports[_0x5bfd('0x4c')]=function(_0x55d2bc,_0x32a494,_0x12e782){if(_0x55d2bc['body']['id']){delete _0x55d2bc[_0x5bfd('0x47')]['id'];}return db[_0x5bfd('0x29')][_0x5bfd('0x4a')]({'where':{'id':_0x55d2bc[_0x5bfd('0x48')]['id']}})['then'](handleEntityNotFound(_0x32a494,null))[_0x5bfd('0x24')](function(_0x1ac624){if(_0x1ac624){_0x55d2bc[_0x5bfd('0x47')]['AccountId']=_0x1ac624['id'];_0x55d2bc[_0x5bfd('0x47')][_0x5bfd('0x4d')]=integrations[_0x5bfd('0x4e')](_0x55d2bc[_0x5bfd('0x47')]['channel'],_0x55d2bc['body']['type']);_0x55d2bc[_0x5bfd('0x47')][_0x5bfd('0x4f')]=integrations[_0x5bfd('0x50')](_0x55d2bc[_0x5bfd('0x47')][_0x5bfd('0x51')],_0x55d2bc[_0x5bfd('0x47')][_0x5bfd('0x2b')]);return db[_0x5bfd('0x52')]['create'](_0x55d2bc[_0x5bfd('0x47')],{'include':[{'model':db[_0x5bfd('0x53')],'as':_0x5bfd('0x4d')},{'model':db[_0x5bfd('0x53')],'as':'Descriptions'}]});}return null;})[_0x5bfd('0x24')](respondWithResult(_0x32a494,null))[_0x5bfd('0x43')](handleError(_0x32a494,null));};exports[_0x5bfd('0x54')]=function(_0x503f62,_0x41fd23,_0x476f7e){var _0x534b46='';var _0x7ea03c='';return db[_0x5bfd('0x29')]['findOne']({'where':{'id':_0x503f62[_0x5bfd('0x48')]['id']},'attributes':['id',_0x5bfd('0x55'),'remoteUri',_0x5bfd('0x56')]})[_0x5bfd('0x24')](handleEntityNotFound(_0x41fd23,null))['then'](function(_0x49cfef){if(_0x49cfef){_0x7ea03c=_0x49cfef[_0x5bfd('0x55')];_0x534b46=_0x49cfef[_0x5bfd('0x57')];var _0x38623e=_0x49cfef[_0x5bfd('0x57')][_0x5bfd('0x58')](-0x1);if(_0x38623e==='/'){_0x534b46=_0x534b46['substring'](0x0,_0x534b46[_0x5bfd('0x59')](_0x38623e));}return rp({'method':_0x5bfd('0x5a'),'uri':util[_0x5bfd('0x5b')](_0x5bfd('0x5c'),_0x534b46,_0x5bfd('0x5d')),'headers':{'Authorization':_0x5bfd('0x5e')+_0x49cfef['apiKey']},'json':!![]});}})[_0x5bfd('0x24')](function(_0x445dd0){if(_0x445dd0){var _0xad1555=_0x445dd0[_0x5bfd('0x5f')];var _0x4e0333=![];var _0x317424=null;for(_0x317424=0x0;_0x317424<_0xad1555[_0x5bfd('0x34')];_0x317424++){if(_0xad1555[_0x317424][_0x5bfd('0x60')]===_0x7ea03c){_0x4e0333=!![];}}if(_0x4e0333){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5bfd('0x61')});}}})[_0x5bfd('0x24')](respondWithResult(_0x41fd23,null))[_0x5bfd('0x43')](function(_0x3ac52d){var _0x1746c9=_0x503f62[_0x5bfd('0x2f')][_0x5bfd('0x62')]?0x1f4:_0x3ac52d[_0x5bfd('0x63')]||0x1f4;logger[_0x5bfd('0x26')](_0x5bfd('0x64'),'getFields',_0x1746c9,JSON['stringify'](_0x3ac52d));delete _0x3ac52d['name'];if(_0x1746c9===0x191){_0x1746c9=0x190;}_0x41fd23[_0x5bfd('0x1a')](_0x1746c9)[_0x5bfd('0x65')](_0x503f62[_0x5bfd('0x2f')]['test']?{'message':_0x5bfd('0x66'),'statusCode':_0x3ac52d[_0x5bfd('0x63')]}:_0x3ac52d);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 23ffd7b..ae841a3 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 _0x1883=['../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x22b6e5,_0x2819c8){var _0x1c21e5=function(_0x18a52c){while(--_0x18a52c){_0x22b6e5['push'](_0x22b6e5['shift']());}};_0x1c21e5(++_0x2819c8);}(_0x1883,0xab));var _0x3188=function(_0x4ee915,_0x3d6216){_0x4ee915=_0x4ee915-0x0;var _0x1a3035=_0x1883[_0x4ee915];return _0x1a3035;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));var integrations=require(_0x3188('0xb'));module[_0x3188('0xc')]=function(_0x33b62d,_0x24f2f1){return _0x33b62d[_0x3188('0xd')](_0x3188('0xe'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8aad=['FreshsalesAccount','int_freshsales_accounts','lodash','util','api','bluebird','request-promise','../../config/environment','exports'];(function(_0xb9897a,_0x2730ca){var _0x5327fe=function(_0x51f5b0){while(--_0x51f5b0){_0xb9897a['push'](_0xb9897a['shift']());}};_0x5327fe(++_0x2730ca);}(_0x8aad,0x146));var _0xd8aa=function(_0xcf5959,_0x52fae7){_0xcf5959=_0xcf5959-0x0;var _0x5787b1=_0x8aad[_0xcf5959];return _0x5787b1;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var logger=require('../../config/logger')(_0xd8aa('0x2'));var moment=require('moment');var BPromise=require(_0xd8aa('0x3'));var rp=require(_0xd8aa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd8aa('0x5'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xd8aa('0x6')]=function(_0x43ddeb,_0x16ea12){return _0x43ddeb['define'](_0xd8aa('0x7'),attributes,{'tableName':_0xd8aa('0x8'),'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 694be4d..0d88a2c 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 _0x7ee1=['attributes','limit','include','map','model','info','ShowFreshsalesAccount','find','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw'];(function(_0x281e5e,_0xf320e2){var _0x5a22d2=function(_0x405ff9){while(--_0x405ff9){_0x281e5e['push'](_0x281e5e['shift']());}};_0x5a22d2(++_0xf320e2);}(_0x7ee1,0x8d));var _0x17ee=function(_0x5522cb,_0x257b8b){_0x5522cb=_0x5522cb-0x0;var _0x553d50=_0x7ee1[_0x5522cb];return _0x553d50;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17ee('0x1'));var fs=require('fs');var Redis=require(_0x17ee('0x2'));var db=require(_0x17ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x17ee('0x4'))(_0x17ee('0x5'));var config=require(_0x17ee('0x6'));var jayson=require(_0x17ee('0x7'));var client=jayson['client'][_0x17ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29b9eb,_0x54b4f6,_0x3f61af){return new BPromise(function(_0x57e1d1,_0x3d767b){return client[_0x17ee('0x9')](_0x29b9eb,_0x3f61af)[_0x17ee('0xa')](function(_0x4af369){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x54b4f6,_0x17ee('0xb'));logger['debug'](_0x17ee('0xc'),_0x54b4f6,_0x17ee('0xb'),JSON[_0x17ee('0xd')](_0x4af369));if(_0x4af369[_0x17ee('0xe')]){if(_0x4af369['error'][_0x17ee('0xf')]===0x1f4){logger['error'](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x3d767b(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x57e1d1(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x54b4f6,'request\x20sent');_0x57e1d1(_0x4af369['result'][_0x17ee('0x11')]);}})[_0x17ee('0x12')](function(_0x1b87c3){logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x1b87c3);_0x3d767b(_0x1b87c3);});});}exports[_0x17ee('0x13')]=function(_0x63d27f){var _0x587ca7=this;return new Promise(function(_0x44fe58,_0x1118a3){return db[_0x17ee('0x14')][_0x17ee('0x15')]({'raw':_0x63d27f[_0x17ee('0x16')]?_0x63d27f['options'][_0x17ee('0x17')]===undefined?!![]:![]:!![],'where':_0x63d27f['options']?_0x63d27f[_0x17ee('0x16')]['where']||null:null,'attributes':_0x63d27f[_0x17ee('0x16')]?_0x63d27f[_0x17ee('0x16')][_0x17ee('0x18')]||null:null,'limit':_0x63d27f[_0x17ee('0x16')]?_0x63d27f[_0x17ee('0x16')][_0x17ee('0x19')]||null:null,'include':_0x63d27f[_0x17ee('0x16')]?_0x63d27f[_0x17ee('0x16')][_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0x63d27f[_0x17ee('0x16')]['include'],function(_0x4b7bfe){return{'model':db[_0x4b7bfe[_0x17ee('0x1c')]],'as':_0x4b7bfe['as'],'attributes':_0x4b7bfe[_0x17ee('0x18')],'include':_0x4b7bfe[_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0x4b7bfe[_0x17ee('0x1a')],function(_0xea358f){return{'model':db[_0xea358f[_0x17ee('0x1c')]],'as':_0xea358f['as'],'attributes':_0xea358f[_0x17ee('0x18')],'include':_0xea358f[_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0xea358f[_0x17ee('0x1a')],function(_0x2a332f){return{'model':db[_0x2a332f['model']],'as':_0x2a332f['as'],'attributes':_0x2a332f[_0x17ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0x17ee('0xa')](function(_0x11ce7e){logger[_0x17ee('0x1d')](_0x17ee('0x13'),_0x63d27f);logger['debug'](_0x17ee('0x13'),_0x63d27f,JSON[_0x17ee('0xd')](_0x11ce7e));_0x44fe58(_0x11ce7e);})[_0x17ee('0x12')](function(_0x4c461b){logger[_0x17ee('0xe')](_0x17ee('0x13'),_0x4c461b['message'],_0x63d27f);_0x1118a3(_0x587ca7[_0x17ee('0xe')](0x1f4,_0x4c461b['message']));});});};exports[_0x17ee('0x1e')]=function(_0x5a44c4){var _0x141ac9=this;return new Promise(function(_0x23ca2e,_0x373c20){return db['FreshsalesAccount'][_0x17ee('0x1f')]({'raw':_0x5a44c4[_0x17ee('0x16')]?_0x5a44c4['options'][_0x17ee('0x17')]===undefined?!![]:![]:!![],'where':_0x5a44c4[_0x17ee('0x16')]?_0x5a44c4[_0x17ee('0x16')]['where']||null:null,'attributes':_0x5a44c4['options']?_0x5a44c4[_0x17ee('0x16')][_0x17ee('0x18')]||null:null,'include':_0x5a44c4[_0x17ee('0x16')]?_0x5a44c4[_0x17ee('0x16')]['include']?_['map'](_0x5a44c4[_0x17ee('0x16')][_0x17ee('0x1a')],function(_0x23578a){return{'model':db[_0x23578a[_0x17ee('0x1c')]],'as':_0x23578a['as'],'attributes':_0x23578a[_0x17ee('0x18')],'include':_0x23578a[_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0x23578a['include'],function(_0x4a6bc9){return{'model':db[_0x4a6bc9['model']],'as':_0x4a6bc9['as'],'attributes':_0x4a6bc9[_0x17ee('0x18')],'include':_0x4a6bc9['include']?_[_0x17ee('0x1b')](_0x4a6bc9[_0x17ee('0x1a')],function(_0xed7e8a){return{'model':db[_0xed7e8a['model']],'as':_0xed7e8a['as'],'attributes':_0xed7e8a[_0x17ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0x17ee('0xa')](function(_0x590d27){logger['info'](_0x17ee('0x1e'),_0x5a44c4);logger[_0x17ee('0x20')](_0x17ee('0x1e'),_0x5a44c4,JSON[_0x17ee('0xd')](_0x590d27));_0x23ca2e(_0x590d27);})[_0x17ee('0x12')](function(_0x5a2c08){logger['error'](_0x17ee('0x1e'),_0x5a2c08[_0x17ee('0x11')],_0x5a44c4);_0x373c20(_0x141ac9[_0x17ee('0xe')](0x1f4,_0x5a2c08[_0x17ee('0x11')]));});});}; \ No newline at end of file +var _0x1883=['GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','attributes','limit','include','map','model','then','info','find','where','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x139786,_0x3dcce5){var _0x57c9ba=function(_0x2e8e80){while(--_0x2e8e80){_0x139786['push'](_0x139786['shift']());}};_0x57c9ba(++_0x3dcce5);}(_0x1883,0xab));var _0x3188=function(_0x39c6bb,_0x3168e4){_0x39c6bb=_0x39c6bb-0x0;var _0x9cc25f=_0x1883[_0x39c6bb];return _0x9cc25f;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var moment=require(_0x3188('0x2'));var BPromise=require(_0x3188('0x3'));var rs=require(_0x3188('0x4'));var fs=require('fs');var Redis=require(_0x3188('0x5'));var db=require(_0x3188('0x6'))['db'];var utils=require(_0x3188('0x7'));var logger=require(_0x3188('0x8'))(_0x3188('0x9'));var config=require(_0x3188('0xa'));var jayson=require(_0x3188('0xb'));var client=jayson[_0x3188('0xc')][_0x3188('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x24f2f1,_0x3ce7fd,_0x3e3afb){return new BPromise(function(_0x5c8f26,_0x446ab7){return client[_0x3188('0xe')](_0x24f2f1,_0x3e3afb)['then'](function(_0x2213b5){logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));logger[_0x3188('0x11')](_0x3188('0x12'),_0x3ce7fd,'request\x20sent',JSON[_0x3188('0x13')](_0x2213b5));if(_0x2213b5[_0x3188('0x14')]){if(_0x2213b5['error']['code']===0x1f4){logger[_0x3188('0x14')](_0x3188('0xf'),_0x3ce7fd,_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);return _0x446ab7(_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);}logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x2213b5['error']['message']);return _0x5c8f26(_0x2213b5[_0x3188('0x14')]['message']);}else{logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));_0x5c8f26(_0x2213b5[_0x3188('0x16')][_0x3188('0x15')]);}})[_0x3188('0x17')](function(_0x259321){logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x259321);_0x446ab7(_0x259321);});});}exports[_0x3188('0x18')]=function(_0x3f5b35){var _0x37e646=this;return new Promise(function(_0x18a71a,_0x4f27b0){return db[_0x3188('0x19')][_0x3188('0x1a')]({'raw':_0x3f5b35['options']?_0x3f5b35[_0x3188('0x1b')][_0x3188('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f5b35['options']?_0x3f5b35['options']['where']||null:null,'attributes':_0x3f5b35[_0x3188('0x1b')]?_0x3f5b35[_0x3188('0x1b')][_0x3188('0x1d')]||null:null,'limit':_0x3f5b35['options']?_0x3f5b35['options'][_0x3188('0x1e')]||null:null,'include':_0x3f5b35[_0x3188('0x1b')]?_0x3f5b35[_0x3188('0x1b')][_0x3188('0x1f')]?_[_0x3188('0x20')](_0x3f5b35['options'][_0x3188('0x1f')],function(_0x33f882){return{'model':db[_0x33f882['model']],'as':_0x33f882['as'],'attributes':_0x33f882[_0x3188('0x1d')],'include':_0x33f882['include']?_['map'](_0x33f882[_0x3188('0x1f')],function(_0x129bd7){return{'model':db[_0x129bd7[_0x3188('0x21')]],'as':_0x129bd7['as'],'attributes':_0x129bd7[_0x3188('0x1d')],'include':_0x129bd7[_0x3188('0x1f')]?_[_0x3188('0x20')](_0x129bd7[_0x3188('0x1f')],function(_0x11021c){return{'model':db[_0x11021c['model']],'as':_0x11021c['as'],'attributes':_0x11021c[_0x3188('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3188('0x22')](function(_0x52bb13){logger[_0x3188('0x23')](_0x3188('0x18'),_0x3f5b35);logger[_0x3188('0x11')](_0x3188('0x18'),_0x3f5b35,JSON[_0x3188('0x13')](_0x52bb13));_0x18a71a(_0x52bb13);})[_0x3188('0x17')](function(_0x8f810f){logger[_0x3188('0x14')]('GetFreshsalesAccount',_0x8f810f[_0x3188('0x15')],_0x3f5b35);_0x4f27b0(_0x37e646['error'](0x1f4,_0x8f810f[_0x3188('0x15')]));});});};exports['ShowFreshsalesAccount']=function(_0x3f82ce){var _0x80f9a8=this;return new Promise(function(_0x3be4f7,_0xacdad7){return db[_0x3188('0x19')][_0x3188('0x24')]({'raw':_0x3f82ce[_0x3188('0x1b')]?_0x3f82ce[_0x3188('0x1b')][_0x3188('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f82ce[_0x3188('0x1b')]?_0x3f82ce[_0x3188('0x1b')][_0x3188('0x25')]||null:null,'attributes':_0x3f82ce[_0x3188('0x1b')]?_0x3f82ce[_0x3188('0x1b')][_0x3188('0x1d')]||null:null,'include':_0x3f82ce[_0x3188('0x1b')]?_0x3f82ce[_0x3188('0x1b')][_0x3188('0x1f')]?_['map'](_0x3f82ce[_0x3188('0x1b')]['include'],function(_0x1c945e){return{'model':db[_0x1c945e[_0x3188('0x21')]],'as':_0x1c945e['as'],'attributes':_0x1c945e['attributes'],'include':_0x1c945e[_0x3188('0x1f')]?_[_0x3188('0x20')](_0x1c945e[_0x3188('0x1f')],function(_0x6d503d){return{'model':db[_0x6d503d[_0x3188('0x21')]],'as':_0x6d503d['as'],'attributes':_0x6d503d[_0x3188('0x1d')],'include':_0x6d503d[_0x3188('0x1f')]?_['map'](_0x6d503d['include'],function(_0xa876c8){return{'model':db[_0xa876c8[_0x3188('0x21')]],'as':_0xa876c8['as'],'attributes':_0xa876c8[_0x3188('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3188('0x22')](function(_0x4a64a4){logger[_0x3188('0x23')](_0x3188('0x26'),_0x3f82ce);logger[_0x3188('0x11')](_0x3188('0x26'),_0x3f82ce,JSON['stringify'](_0x4a64a4));_0x3be4f7(_0x4a64a4);})[_0x3188('0x17')](function(_0x4a290f){logger[_0x3188('0x14')]('ShowFreshsalesAccount',_0x4a290f[_0x3188('0x15')],_0x3f82ce);_0xacdad7(_0x80f9a8[_0x3188('0x14')](0x1f4,_0x4a290f[_0x3188('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index bf77198..1d9dd4b 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 _0x7463=['/:id/descriptions','/:id/fields','getFields','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id/subjects','getSubjects'];(function(_0x20ef83,_0xea60f9){var _0x18c673=function(_0x57653d){while(--_0x57653d){_0x20ef83['push'](_0x20ef83['shift']());}};_0x18c673(++_0xea60f9);}(_0x7463,0x15a));var _0x3746=function(_0x5959c9,_0x2ed153){_0x5959c9=_0x5959c9-0x0;var _0x4ffcbc=_0x7463[_0x5959c9];return _0x4ffcbc;};'use strict';var multer=require(_0x3746('0x0'));var util=require(_0x3746('0x1'));var path=require(_0x3746('0x2'));var timeout=require(_0x3746('0x3'));var express=require(_0x3746('0x4'));var router=express[_0x3746('0x5')]();var fs_extra=require(_0x3746('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3746('0x7'));var config=require(_0x3746('0x8'));var controller=require(_0x3746('0x9'));router[_0x3746('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3746('0xa')]('/:id',auth[_0x3746('0xb')](),controller['show']);router[_0x3746('0xa')](_0x3746('0xc'),auth[_0x3746('0xb')](),controller[_0x3746('0xd')]);router['get'](_0x3746('0xe'),auth[_0x3746('0xb')](),controller['getDescriptions']);router['get'](_0x3746('0xf'),auth[_0x3746('0xb')](),controller[_0x3746('0x10')]);router['post']('/',auth[_0x3746('0xb')](),controller[_0x3746('0x11')]);router[_0x3746('0x12')](_0x3746('0x13'),auth[_0x3746('0xb')](),controller[_0x3746('0x14')]);router[_0x3746('0x15')](_0x3746('0x13'),auth[_0x3746('0xb')](),controller[_0x3746('0x16')]);module[_0x3746('0x17')]=router; \ No newline at end of file +var _0xd9f0=['../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','post','create','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5b895f,_0x4668d1){var _0x154cdc=function(_0x145f7f){while(--_0x145f7f){_0x5b895f['push'](_0x5b895f['shift']());}};_0x154cdc(++_0x4668d1);}(_0xd9f0,0xb1));var _0x0d9f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd9f0[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x0d9f('0x0'));var util=require(_0x0d9f('0x1'));var path=require(_0x0d9f('0x2'));var timeout=require(_0x0d9f('0x3'));var express=require(_0x0d9f('0x4'));var router=express['Router']();var fs_extra=require(_0x0d9f('0x5'));var auth=require(_0x0d9f('0x6'));var interaction=require(_0x0d9f('0x7'));var config=require(_0x0d9f('0x8'));var controller=require(_0x0d9f('0x9'));router[_0x0d9f('0xa')]('/',auth['isAuthenticated'](),controller[_0x0d9f('0xb')]);router[_0x0d9f('0xa')](_0x0d9f('0xc'),auth[_0x0d9f('0xd')](),controller['show']);router['get'](_0x0d9f('0xe'),auth[_0x0d9f('0xd')](),controller[_0x0d9f('0xf')]);router[_0x0d9f('0xa')](_0x0d9f('0x10'),auth['isAuthenticated'](),controller[_0x0d9f('0x11')]);router[_0x0d9f('0xa')]('/:id/fields',auth[_0x0d9f('0xd')](),controller[_0x0d9f('0x12')]);router[_0x0d9f('0x13')]('/',auth['isAuthenticated'](),controller[_0x0d9f('0x14')]);router['put']('/:id',auth[_0x0d9f('0xd')](),controller[_0x0d9f('0x15')]);router['delete'](_0x0d9f('0xc'),auth['isAuthenticated'](),controller[_0x0d9f('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 6d7dcbb..29e9d8e 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 _0x1a9a=['STRING','sequelize','exports'];(function(_0x336bba,_0x16c8d6){var _0x5837b3=function(_0x5193c5){while(--_0x5193c5){_0x336bba['push'](_0x336bba['shift']());}};_0x5837b3(++_0x16c8d6);}(_0x1a9a,0x9a));var _0xa1a9=function(_0x5d4a56,_0x432fd1){_0x5d4a56=_0x5d4a56-0x0;var _0x16686d=_0x1a9a[_0x5d4a56];return _0x16686d;};'use strict';var Sequelize=require(_0xa1a9('0x0'));module[_0xa1a9('0x1')]={'name':{'type':Sequelize[_0xa1a9('0x2')]},'description':{'type':Sequelize[_0xa1a9('0x2')]}}; \ No newline at end of file +var _0x02ad=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02ad,0xea));var _0xd02a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x02ad[_0x17b6e3];return _0x3906f3;};'use strict';var Sequelize=require(_0xd02a('0x0'));module['exports']={'name':{'type':Sequelize[_0xd02a('0x1')]},'description':{'type':Sequelize[_0xd02a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 0eca986..e18c574 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 _0xbcf3=['include','rows','show','params','find','catch','create','body','destroy','getSubjects','findOne','FreshsalesField','order','getDescriptions','getFields','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll'];(function(_0x2b35cc,_0x537825){var _0x4b99f6=function(_0x244682){while(--_0x244682){_0x2b35cc['push'](_0x2b35cc['shift']());}};_0x4b99f6(++_0x537825);}(_0xbcf3,0xfd));var _0x3bcf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbcf3[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x3bcf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3bcf('0x1'));var jsonpatch=require(_0x3bcf('0x2'));var rp=require(_0x3bcf('0x3'));var moment=require(_0x3bcf('0x4'));var BPromise=require(_0x3bcf('0x5'));var Mustache=require('mustache');var util=require(_0x3bcf('0x6'));var path=require(_0x3bcf('0x7'));var sox=require(_0x3bcf('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3bcf('0x9'));var _=require(_0x3bcf('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3bcf('0xb'));var deskjs=require(_0x3bcf('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3bcf('0xd'));var Redis=require(_0x3bcf('0xe'));var authService=require(_0x3bcf('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3bcf('0x10'));var hardwareService=require(_0x3bcf('0x11'));var logger=require('../../config/logger')(_0x3bcf('0x12'));var utils=require(_0x3bcf('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3bcf('0x14'));var db=require(_0x3bcf('0x15'))['db'];function respondWithStatusCode(_0x493a8b,_0x56d9c2){_0x56d9c2=_0x56d9c2||0xcc;return function(_0x472295){if(_0x472295){return _0x493a8b[_0x3bcf('0x16')](_0x56d9c2);}return _0x493a8b['status'](_0x56d9c2)[_0x3bcf('0x17')]();};}function respondWithResult(_0x6cac9a,_0x4dcd5c){_0x4dcd5c=_0x4dcd5c||0xc8;return function(_0x3f3457){if(_0x3f3457){return _0x6cac9a[_0x3bcf('0x18')](_0x4dcd5c)[_0x3bcf('0x19')](_0x3f3457);}};}function respondWithFilteredResult(_0x4476d5,_0x41da90){return function(_0x257993){if(_0x257993){var _0x1eb90c=typeof _0x41da90[_0x3bcf('0x1a')]===_0x3bcf('0x1b')&&typeof _0x41da90['limit']===_0x3bcf('0x1b');var _0x2be984=_0x257993['count'];var _0x5b52c0=_0x1eb90c?0x0:_0x41da90['offset'];var _0x1a7475=_0x1eb90c?_0x257993[_0x3bcf('0x1c')]:_0x41da90[_0x3bcf('0x1a')]+_0x41da90[_0x3bcf('0x1d')];var _0x32bde7;if(_0x1a7475>=_0x2be984){_0x1a7475=_0x2be984;_0x32bde7=0xc8;}else{_0x32bde7=0xce;}_0x4476d5[_0x3bcf('0x18')](_0x32bde7);return _0x4476d5[_0x3bcf('0x1e')](_0x3bcf('0x1f'),_0x5b52c0+'-'+_0x1a7475+'/'+_0x2be984)[_0x3bcf('0x19')](_0x257993);}return null;};}function patchUpdates(_0x2d88a1){return function(_0x1d72e0){try{jsonpatch['apply'](_0x1d72e0,_0x2d88a1,!![]);}catch(_0x2b29ee){return BPromise[_0x3bcf('0x20')](_0x2b29ee);}return _0x1d72e0['save']();};}function saveUpdates(_0x2fb056,_0x57d926){return function(_0x281d9d){if(_0x281d9d){return _0x281d9d[_0x3bcf('0x21')](_0x2fb056)[_0x3bcf('0x22')](function(_0x319925){return _0x319925;});}return null;};}function removeEntity(_0x2be557,_0x5886d8){return function(_0x2fe1df){if(_0x2fe1df){return _0x2fe1df['destroy']()['then'](function(){_0x2be557[_0x3bcf('0x18')](0xcc)[_0x3bcf('0x17')]();});}};}function handleEntityNotFound(_0x506eb5,_0x57c8b5){return function(_0x50fca1){if(!_0x50fca1){_0x506eb5[_0x3bcf('0x16')](0x194);}return _0x50fca1;};}function handleError(_0x3666c1,_0x40270c){_0x40270c=_0x40270c||0x1f4;return function(_0x239d70){logger[_0x3bcf('0x23')](_0x239d70[_0x3bcf('0x24')]);if(_0x239d70[_0x3bcf('0x25')]){delete _0x239d70[_0x3bcf('0x25')];}_0x3666c1[_0x3bcf('0x18')](_0x40270c)[_0x3bcf('0x26')](_0x239d70);};}exports[_0x3bcf('0x27')]=function(_0x1cfbe9,_0x305453){var _0x3ef10b={},_0x5f1b19={},_0x42cdfa={'count':0x0,'rows':[]};var _0x270c51=_[_0x3bcf('0x28')](db[_0x3bcf('0x29')][_0x3bcf('0x2a')],function(_0x4b584a){return{'name':_0x4b584a[_0x3bcf('0x2b')],'type':_0x4b584a['type'][_0x3bcf('0x2c')]};});_0x5f1b19[_0x3bcf('0x2d')]=_[_0x3bcf('0x28')](_0x270c51,_0x3bcf('0x25'));_0x5f1b19[_0x3bcf('0x2e')]=_[_0x3bcf('0x2f')](_0x1cfbe9['query']);_0x5f1b19[_0x3bcf('0x30')]=_[_0x3bcf('0x31')](_0x5f1b19[_0x3bcf('0x2d')],_0x5f1b19[_0x3bcf('0x2e')]);_0x3ef10b[_0x3bcf('0x32')]=_[_0x3bcf('0x31')](_0x5f1b19[_0x3bcf('0x2d')],qs[_0x3bcf('0x33')](_0x1cfbe9[_0x3bcf('0x2e')][_0x3bcf('0x33')]));_0x3ef10b['attributes']=_0x3ef10b[_0x3bcf('0x32')][_0x3bcf('0x34')]?_0x3ef10b['attributes']:_0x5f1b19[_0x3bcf('0x2d')];if(!_0x1cfbe9['query']['hasOwnProperty'](_0x3bcf('0x35'))){_0x3ef10b['limit']=qs['limit'](_0x1cfbe9['query'][_0x3bcf('0x1d')]);_0x3ef10b[_0x3bcf('0x1a')]=qs['offset'](_0x1cfbe9['query'][_0x3bcf('0x1a')]);}_0x3ef10b['order']=qs[_0x3bcf('0x36')](_0x1cfbe9['query'][_0x3bcf('0x36')]);_0x3ef10b[_0x3bcf('0x37')]=qs[_0x3bcf('0x30')](_[_0x3bcf('0x38')](_0x1cfbe9['query'],_0x5f1b19[_0x3bcf('0x30')]),_0x270c51);if(_0x1cfbe9[_0x3bcf('0x2e')][_0x3bcf('0x39')]){_0x3ef10b[_0x3bcf('0x37')]=_['merge'](_0x3ef10b[_0x3bcf('0x37')],{'$or':_[_0x3bcf('0x28')](_0x270c51,function(_0x368a9e){if(_0x368a9e[_0x3bcf('0x3a')]!==_0x3bcf('0x3b')){var _0x2d183a={};_0x2d183a[_0x368a9e[_0x3bcf('0x25')]]={'$like':'%'+_0x1cfbe9[_0x3bcf('0x2e')][_0x3bcf('0x39')]+'%'};return _0x2d183a;}})});}_0x3ef10b=_[_0x3bcf('0x3c')]({},_0x3ef10b,_0x1cfbe9[_0x3bcf('0x3d')]);var _0x2110d3={'where':_0x3ef10b[_0x3bcf('0x37')]};return db[_0x3bcf('0x29')][_0x3bcf('0x1c')](_0x2110d3)[_0x3bcf('0x22')](function(_0x1a2def){_0x42cdfa[_0x3bcf('0x1c')]=_0x1a2def;if(_0x1cfbe9[_0x3bcf('0x2e')][_0x3bcf('0x3e')]){_0x3ef10b[_0x3bcf('0x3f')]=[{'all':!![]}];}return db[_0x3bcf('0x29')]['findAll'](_0x3ef10b);})[_0x3bcf('0x22')](function(_0x3e1fea){_0x42cdfa[_0x3bcf('0x40')]=_0x3e1fea;return _0x42cdfa;})['then'](respondWithFilteredResult(_0x305453,_0x3ef10b))['catch'](handleError(_0x305453,null));};exports[_0x3bcf('0x41')]=function(_0x437c5f,_0x171c48){var _0x298db4={'raw':![],'where':{'id':_0x437c5f[_0x3bcf('0x42')]['id']}},_0xd420a2={};_0xd420a2[_0x3bcf('0x2d')]=_[_0x3bcf('0x2f')](db['FreshsalesConfiguration']['rawAttributes']);_0xd420a2['query']=_[_0x3bcf('0x2f')](_0x437c5f['query']);_0xd420a2[_0x3bcf('0x30')]=_[_0x3bcf('0x31')](_0xd420a2[_0x3bcf('0x2d')],_0xd420a2[_0x3bcf('0x2e')]);_0x298db4[_0x3bcf('0x32')]=_[_0x3bcf('0x31')](_0xd420a2['model'],qs[_0x3bcf('0x33')](_0x437c5f['query']['fields']));_0x298db4[_0x3bcf('0x32')]=_0x298db4[_0x3bcf('0x32')][_0x3bcf('0x34')]?_0x298db4['attributes']:_0xd420a2[_0x3bcf('0x2d')];if(_0x437c5f['query'][_0x3bcf('0x3e')]){_0x298db4[_0x3bcf('0x3f')]=[{'all':!![]}];}_0x298db4=_[_0x3bcf('0x3c')]({},_0x298db4,_0x437c5f[_0x3bcf('0x3d')]);return db['FreshsalesConfiguration'][_0x3bcf('0x43')](_0x298db4)[_0x3bcf('0x22')](handleEntityNotFound(_0x171c48,null))[_0x3bcf('0x22')](respondWithResult(_0x171c48,null))[_0x3bcf('0x44')](handleError(_0x171c48,null));};exports[_0x3bcf('0x45')]=function(_0x1f4d58,_0x2fda07){return db[_0x3bcf('0x29')]['create'](_0x1f4d58[_0x3bcf('0x46')],{})[_0x3bcf('0x22')](respondWithResult(_0x2fda07,0xc9))['catch'](handleError(_0x2fda07,null));};exports[_0x3bcf('0x21')]=function(_0x3674d6,_0x18e258){if(_0x3674d6['body']['id']){delete _0x3674d6[_0x3bcf('0x46')]['id'];}return db[_0x3bcf('0x29')][_0x3bcf('0x43')]({'where':{'id':_0x3674d6[_0x3bcf('0x42')]['id']}})[_0x3bcf('0x22')](handleEntityNotFound(_0x18e258,null))['then'](saveUpdates(_0x3674d6[_0x3bcf('0x46')],null))[_0x3bcf('0x22')](respondWithResult(_0x18e258,null))[_0x3bcf('0x44')](handleError(_0x18e258,null));};exports[_0x3bcf('0x47')]=function(_0x20ddfe,_0x110729){return db[_0x3bcf('0x29')]['find']({'where':{'id':_0x20ddfe[_0x3bcf('0x42')]['id']}})['then'](handleEntityNotFound(_0x110729,null))[_0x3bcf('0x22')](removeEntity(_0x110729,null))[_0x3bcf('0x44')](handleError(_0x110729,null));};exports[_0x3bcf('0x48')]=function(_0x300d55,_0x3100c5,_0x1a04b9){var _0x3d0d15={};var _0x5b377b={};var _0x1412c3;var _0x56ea40;return db[_0x3bcf('0x29')][_0x3bcf('0x49')]({'where':{'id':_0x300d55[_0x3bcf('0x42')]['id']}})[_0x3bcf('0x22')](handleEntityNotFound(_0x3100c5,null))['then'](function(_0x18b975){if(_0x18b975){_0x1412c3=_0x18b975;_0x5b377b[_0x3bcf('0x2d')]=_['keys'](db[_0x3bcf('0x4a')][_0x3bcf('0x2a')]);_0x5b377b[_0x3bcf('0x2e')]=_[_0x3bcf('0x2f')](_0x300d55[_0x3bcf('0x2e')]);_0x5b377b['filters']=_['intersection'](_0x5b377b['model'],_0x5b377b[_0x3bcf('0x2e')]);_0x3d0d15[_0x3bcf('0x32')]=_[_0x3bcf('0x31')](_0x5b377b['model'],qs['fields'](_0x300d55['query']['fields']));_0x3d0d15['attributes']=_0x3d0d15[_0x3bcf('0x32')][_0x3bcf('0x34')]?_0x3d0d15[_0x3bcf('0x32')]:_0x5b377b[_0x3bcf('0x2d')];_0x3d0d15[_0x3bcf('0x4b')]=qs[_0x3bcf('0x36')](_0x300d55[_0x3bcf('0x2e')][_0x3bcf('0x36')]);_0x3d0d15[_0x3bcf('0x37')]=qs[_0x3bcf('0x30')](_[_0x3bcf('0x38')](_0x300d55[_0x3bcf('0x2e')],_0x5b377b[_0x3bcf('0x30')]));if(_0x300d55[_0x3bcf('0x2e')]['filter']){_0x3d0d15['where']=_['merge'](_0x3d0d15[_0x3bcf('0x37')],{'$or':_[_0x3bcf('0x28')](_0x3d0d15['attributes'],function(_0x2f59ba){var _0x489c58={};_0x489c58[_0x2f59ba]={'$like':'%'+_0x300d55[_0x3bcf('0x2e')][_0x3bcf('0x39')]+'%'};return _0x489c58;})});}_0x3d0d15=_[_0x3bcf('0x3c')]({},_0x3d0d15,_0x300d55[_0x3bcf('0x3d')]);return _0x1412c3[_0x3bcf('0x48')](_0x3d0d15);}})['then'](function(_0x378869){if(_0x378869){_0x56ea40=_0x378869[_0x3bcf('0x34')];if(!_0x300d55[_0x3bcf('0x2e')]['hasOwnProperty']('nolimit')){_0x3d0d15['limit']=qs[_0x3bcf('0x1d')](_0x300d55['query'][_0x3bcf('0x1d')]);_0x3d0d15[_0x3bcf('0x1a')]=qs[_0x3bcf('0x1a')](_0x300d55[_0x3bcf('0x2e')][_0x3bcf('0x1a')]);}return _0x1412c3[_0x3bcf('0x48')](_0x3d0d15);}})[_0x3bcf('0x22')](function(_0x5eb162){if(_0x5eb162){return _0x5eb162?{'count':_0x56ea40,'rows':_0x5eb162}:null;}})['then'](respondWithResult(_0x3100c5,null))['catch'](handleError(_0x3100c5,null));};exports['getDescriptions']=function(_0x3765b0,_0x322092,_0x227f79){var _0x1cc80e={};var _0xedf1b9={};var _0x532359;var _0xb4a18;return db[_0x3bcf('0x29')][_0x3bcf('0x49')]({'where':{'id':_0x3765b0[_0x3bcf('0x42')]['id']}})['then'](handleEntityNotFound(_0x322092,null))[_0x3bcf('0x22')](function(_0x61a268){if(_0x61a268){_0x532359=_0x61a268;_0xedf1b9[_0x3bcf('0x2d')]=_['keys'](db[_0x3bcf('0x4a')][_0x3bcf('0x2a')]);_0xedf1b9[_0x3bcf('0x2e')]=_[_0x3bcf('0x2f')](_0x3765b0[_0x3bcf('0x2e')]);_0xedf1b9[_0x3bcf('0x30')]=_[_0x3bcf('0x31')](_0xedf1b9[_0x3bcf('0x2d')],_0xedf1b9[_0x3bcf('0x2e')]);_0x1cc80e[_0x3bcf('0x32')]=_['intersection'](_0xedf1b9[_0x3bcf('0x2d')],qs[_0x3bcf('0x33')](_0x3765b0[_0x3bcf('0x2e')][_0x3bcf('0x33')]));_0x1cc80e['attributes']=_0x1cc80e[_0x3bcf('0x32')][_0x3bcf('0x34')]?_0x1cc80e['attributes']:_0xedf1b9[_0x3bcf('0x2d')];_0x1cc80e[_0x3bcf('0x4b')]=qs[_0x3bcf('0x36')](_0x3765b0[_0x3bcf('0x2e')][_0x3bcf('0x36')]);_0x1cc80e[_0x3bcf('0x37')]=qs[_0x3bcf('0x30')](_[_0x3bcf('0x38')](_0x3765b0[_0x3bcf('0x2e')],_0xedf1b9['filters']));if(_0x3765b0['query'][_0x3bcf('0x39')]){_0x1cc80e[_0x3bcf('0x37')]=_[_0x3bcf('0x3c')](_0x1cc80e[_0x3bcf('0x37')],{'$or':_[_0x3bcf('0x28')](_0x1cc80e[_0x3bcf('0x32')],function(_0x13d503){var _0x2fa91f={};_0x2fa91f[_0x13d503]={'$like':'%'+_0x3765b0[_0x3bcf('0x2e')][_0x3bcf('0x39')]+'%'};return _0x2fa91f;})});}_0x1cc80e=_[_0x3bcf('0x3c')]({},_0x1cc80e,_0x3765b0['options']);return _0x532359['getDescriptions'](_0x1cc80e);}})[_0x3bcf('0x22')](function(_0x13dcae){if(_0x13dcae){_0xb4a18=_0x13dcae[_0x3bcf('0x34')];if(!_0x3765b0[_0x3bcf('0x2e')]['hasOwnProperty'](_0x3bcf('0x35'))){_0x1cc80e['limit']=qs[_0x3bcf('0x1d')](_0x3765b0[_0x3bcf('0x2e')][_0x3bcf('0x1d')]);_0x1cc80e['offset']=qs[_0x3bcf('0x1a')](_0x3765b0[_0x3bcf('0x2e')][_0x3bcf('0x1a')]);}return _0x532359[_0x3bcf('0x4c')](_0x1cc80e);}})[_0x3bcf('0x22')](function(_0x1876eb){if(_0x1876eb){return _0x1876eb?{'count':_0xb4a18,'rows':_0x1876eb}:null;}})[_0x3bcf('0x22')](respondWithResult(_0x322092,null))[_0x3bcf('0x44')](handleError(_0x322092,null));};exports[_0x3bcf('0x4d')]=function(_0x235e27,_0x11d2e0,_0x99b9d3){var _0x1673e3={};var _0x99ecdd={};var _0x1c4326;var _0x41f009;return db[_0x3bcf('0x29')]['findOne']({'where':{'id':_0x235e27[_0x3bcf('0x42')]['id']}})[_0x3bcf('0x22')](handleEntityNotFound(_0x11d2e0,null))[_0x3bcf('0x22')](function(_0x69a03e){if(_0x69a03e){_0x1c4326=_0x69a03e;_0x99ecdd['model']=_[_0x3bcf('0x2f')](db[_0x3bcf('0x4a')]['rawAttributes']);_0x99ecdd[_0x3bcf('0x2e')]=_[_0x3bcf('0x2f')](_0x235e27[_0x3bcf('0x2e')]);_0x99ecdd[_0x3bcf('0x30')]=_[_0x3bcf('0x31')](_0x99ecdd[_0x3bcf('0x2d')],_0x99ecdd[_0x3bcf('0x2e')]);_0x1673e3[_0x3bcf('0x32')]=_['intersection'](_0x99ecdd[_0x3bcf('0x2d')],qs[_0x3bcf('0x33')](_0x235e27[_0x3bcf('0x2e')][_0x3bcf('0x33')]));_0x1673e3[_0x3bcf('0x32')]=_0x1673e3[_0x3bcf('0x32')][_0x3bcf('0x34')]?_0x1673e3['attributes']:_0x99ecdd[_0x3bcf('0x2d')];_0x1673e3[_0x3bcf('0x4b')]=qs['sort'](_0x235e27[_0x3bcf('0x2e')][_0x3bcf('0x36')]);_0x1673e3[_0x3bcf('0x37')]=qs[_0x3bcf('0x30')](_[_0x3bcf('0x38')](_0x235e27[_0x3bcf('0x2e')],_0x99ecdd[_0x3bcf('0x30')]));if(_0x235e27[_0x3bcf('0x2e')][_0x3bcf('0x39')]){_0x1673e3[_0x3bcf('0x37')]=_[_0x3bcf('0x3c')](_0x1673e3[_0x3bcf('0x37')],{'$or':_[_0x3bcf('0x28')](_0x1673e3[_0x3bcf('0x32')],function(_0xd3e318){var _0x1b3759={};_0x1b3759[_0xd3e318]={'$like':'%'+_0x235e27[_0x3bcf('0x2e')][_0x3bcf('0x39')]+'%'};return _0x1b3759;})});}_0x1673e3=_[_0x3bcf('0x3c')]({},_0x1673e3,_0x235e27[_0x3bcf('0x3d')]);return _0x1c4326['getFields'](_0x1673e3);}})[_0x3bcf('0x22')](function(_0x2d8ab7){if(_0x2d8ab7){_0x41f009=_0x2d8ab7[_0x3bcf('0x34')];if(!_0x235e27[_0x3bcf('0x2e')][_0x3bcf('0x4e')](_0x3bcf('0x35'))){_0x1673e3[_0x3bcf('0x1d')]=qs[_0x3bcf('0x1d')](_0x235e27[_0x3bcf('0x2e')][_0x3bcf('0x1d')]);_0x1673e3[_0x3bcf('0x1a')]=qs[_0x3bcf('0x1a')](_0x235e27[_0x3bcf('0x2e')]['offset']);}return _0x1c4326[_0x3bcf('0x4d')](_0x1673e3);}})['then'](function(_0x37c28a){if(_0x37c28a){return _0x37c28a?{'count':_0x41f009,'rows':_0x37c28a}:null;}})[_0x3bcf('0x22')](respondWithResult(_0x11d2e0,null))['catch'](handleError(_0x11d2e0,null));}; \ No newline at end of file +var _0x890c=['key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','params','find','catch','create','body','destroy','getSubjects','order','sort','nolimit','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','error','stack','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','type'];(function(_0x5b9902,_0x3393dd){var _0x461a84=function(_0x4d4e95){while(--_0x4d4e95){_0x5b9902['push'](_0x5b9902['shift']());}};_0x461a84(++_0x3393dd);}(_0x890c,0x1b1));var _0xc890=function(_0x3f9cf4,_0x294d15){_0x3f9cf4=_0x3f9cf4-0x0;var _0x377a6f=_0x890c[_0x3f9cf4];return _0x377a6f;};'use strict';var emlformat=require(_0xc890('0x0'));var rimraf=require(_0xc890('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc890('0x2'));var rp=require(_0xc890('0x3'));var moment=require(_0xc890('0x4'));var BPromise=require(_0xc890('0x5'));var Mustache=require('mustache');var util=require(_0xc890('0x6'));var path=require(_0xc890('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc890('0x8'));var fs=require('fs');var fs_extra=require(_0xc890('0x9'));var _=require(_0xc890('0xa'));var squel=require('squel');var crypto=require(_0xc890('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc890('0xc'));var toCsv=require(_0xc890('0xd'));var querystring=require(_0xc890('0xe'));var Papa=require('papaparse');var Redis=require(_0xc890('0xf'));var authService=require(_0xc890('0x10'));var qs=require(_0xc890('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc890('0x12'));var logger=require(_0xc890('0x13'))(_0xc890('0x14'));var utils=require(_0xc890('0x15'));var config=require(_0xc890('0x16'));var licenseUtil=require(_0xc890('0x17'));var db=require(_0xc890('0x18'))['db'];function respondWithStatusCode(_0x3edb97,_0x338c81){_0x338c81=_0x338c81||0xcc;return function(_0x5e8b85){if(_0x5e8b85){return _0x3edb97[_0xc890('0x19')](_0x338c81);}return _0x3edb97['status'](_0x338c81)[_0xc890('0x1a')]();};}function respondWithResult(_0x5cc411,_0x1d6f89){_0x1d6f89=_0x1d6f89||0xc8;return function(_0x2642b8){if(_0x2642b8){return _0x5cc411[_0xc890('0x1b')](_0x1d6f89)['json'](_0x2642b8);}};}function respondWithFilteredResult(_0x265813,_0x842377){return function(_0x305882){if(_0x305882){var _0x4ad728=typeof _0x842377[_0xc890('0x1c')]===_0xc890('0x1d')&&typeof _0x842377[_0xc890('0x1e')]===_0xc890('0x1d');var _0x127b71=_0x305882[_0xc890('0x1f')];var _0x2217a5=_0x4ad728?0x0:_0x842377['offset'];var _0x2e4fcd=_0x4ad728?_0x305882[_0xc890('0x1f')]:_0x842377[_0xc890('0x1c')]+_0x842377[_0xc890('0x1e')];var _0x26e38d;if(_0x2e4fcd>=_0x127b71){_0x2e4fcd=_0x127b71;_0x26e38d=0xc8;}else{_0x26e38d=0xce;}_0x265813['status'](_0x26e38d);return _0x265813[_0xc890('0x20')](_0xc890('0x21'),_0x2217a5+'-'+_0x2e4fcd+'/'+_0x127b71)[_0xc890('0x22')](_0x305882);}return null;};}function patchUpdates(_0x21fd46){return function(_0x3193a4){try{jsonpatch[_0xc890('0x23')](_0x3193a4,_0x21fd46,!![]);}catch(_0x7f693d){return BPromise['reject'](_0x7f693d);}return _0x3193a4['save']();};}function saveUpdates(_0x37bb10,_0x381627){return function(_0x250ee7){if(_0x250ee7){return _0x250ee7[_0xc890('0x24')](_0x37bb10)['then'](function(_0x3a0cb7){return _0x3a0cb7;});}return null;};}function removeEntity(_0x52b89b,_0x553d8d){return function(_0x318e22){if(_0x318e22){return _0x318e22['destroy']()[_0xc890('0x25')](function(){_0x52b89b['status'](0xcc)[_0xc890('0x1a')]();});}};}function handleEntityNotFound(_0x26c5db,_0xd4a46a){return function(_0x41427b){if(!_0x41427b){_0x26c5db[_0xc890('0x19')](0x194);}return _0x41427b;};}function handleError(_0xe757c4,_0x5272f2){_0x5272f2=_0x5272f2||0x1f4;return function(_0x2b7769){logger[_0xc890('0x26')](_0x2b7769[_0xc890('0x27')]);if(_0x2b7769[_0xc890('0x28')]){delete _0x2b7769['name'];}_0xe757c4[_0xc890('0x1b')](_0x5272f2)[_0xc890('0x29')](_0x2b7769);};}exports['index']=function(_0x43436a,_0x119e73){var _0x10b11f={},_0x37c8fd={},_0x3a4f80={'count':0x0,'rows':[]};var _0x580b07=_[_0xc890('0x2a')](db[_0xc890('0x2b')][_0xc890('0x2c')],function(_0x1fe8db){return{'name':_0x1fe8db[_0xc890('0x2d')],'type':_0x1fe8db[_0xc890('0x2e')][_0xc890('0x2f')]};});_0x37c8fd[_0xc890('0x30')]=_[_0xc890('0x2a')](_0x580b07,_0xc890('0x28'));_0x37c8fd['query']=_[_0xc890('0x31')](_0x43436a['query']);_0x37c8fd['filters']=_[_0xc890('0x32')](_0x37c8fd[_0xc890('0x30')],_0x37c8fd[_0xc890('0x33')]);_0x10b11f['attributes']=_['intersection'](_0x37c8fd[_0xc890('0x30')],qs['fields'](_0x43436a[_0xc890('0x33')][_0xc890('0x34')]));_0x10b11f[_0xc890('0x35')]=_0x10b11f[_0xc890('0x35')][_0xc890('0x36')]?_0x10b11f['attributes']:_0x37c8fd[_0xc890('0x30')];if(!_0x43436a[_0xc890('0x33')][_0xc890('0x37')]('nolimit')){_0x10b11f[_0xc890('0x1e')]=qs[_0xc890('0x1e')](_0x43436a[_0xc890('0x33')][_0xc890('0x1e')]);_0x10b11f[_0xc890('0x1c')]=qs['offset'](_0x43436a['query'][_0xc890('0x1c')]);}_0x10b11f['order']=qs['sort'](_0x43436a[_0xc890('0x33')]['sort']);_0x10b11f[_0xc890('0x38')]=qs[_0xc890('0x39')](_[_0xc890('0x3a')](_0x43436a[_0xc890('0x33')],_0x37c8fd['filters']),_0x580b07);if(_0x43436a[_0xc890('0x33')]['filter']){_0x10b11f[_0xc890('0x38')]=_[_0xc890('0x3b')](_0x10b11f['where'],{'$or':_[_0xc890('0x2a')](_0x580b07,function(_0x50e5d3){if(_0x50e5d3[_0xc890('0x2e')]!==_0xc890('0x3c')){var _0x582e02={};_0x582e02[_0x50e5d3[_0xc890('0x28')]]={'$like':'%'+_0x43436a[_0xc890('0x33')][_0xc890('0x3d')]+'%'};return _0x582e02;}})});}_0x10b11f=_[_0xc890('0x3b')]({},_0x10b11f,_0x43436a[_0xc890('0x3e')]);var _0x10b802={'where':_0x10b11f[_0xc890('0x38')]};return db[_0xc890('0x2b')]['count'](_0x10b802)[_0xc890('0x25')](function(_0x5dd213){_0x3a4f80[_0xc890('0x1f')]=_0x5dd213;if(_0x43436a[_0xc890('0x33')][_0xc890('0x3f')]){_0x10b11f[_0xc890('0x40')]=[{'all':!![]}];}return db[_0xc890('0x2b')][_0xc890('0x41')](_0x10b11f);})['then'](function(_0x5b2427){_0x3a4f80['rows']=_0x5b2427;return _0x3a4f80;})[_0xc890('0x25')](respondWithFilteredResult(_0x119e73,_0x10b11f))['catch'](handleError(_0x119e73,null));};exports['show']=function(_0x26c637,_0x5739eb){var _0x5cce94={'raw':![],'where':{'id':_0x26c637[_0xc890('0x42')]['id']}},_0x3a9bc5={};_0x3a9bc5[_0xc890('0x30')]=_[_0xc890('0x31')](db[_0xc890('0x2b')]['rawAttributes']);_0x3a9bc5[_0xc890('0x33')]=_[_0xc890('0x31')](_0x26c637[_0xc890('0x33')]);_0x3a9bc5[_0xc890('0x39')]=_[_0xc890('0x32')](_0x3a9bc5[_0xc890('0x30')],_0x3a9bc5[_0xc890('0x33')]);_0x5cce94[_0xc890('0x35')]=_[_0xc890('0x32')](_0x3a9bc5['model'],qs[_0xc890('0x34')](_0x26c637['query'][_0xc890('0x34')]));_0x5cce94[_0xc890('0x35')]=_0x5cce94[_0xc890('0x35')]['length']?_0x5cce94['attributes']:_0x3a9bc5[_0xc890('0x30')];if(_0x26c637[_0xc890('0x33')][_0xc890('0x3f')]){_0x5cce94[_0xc890('0x40')]=[{'all':!![]}];}_0x5cce94=_['merge']({},_0x5cce94,_0x26c637[_0xc890('0x3e')]);return db[_0xc890('0x2b')][_0xc890('0x43')](_0x5cce94)[_0xc890('0x25')](handleEntityNotFound(_0x5739eb,null))[_0xc890('0x25')](respondWithResult(_0x5739eb,null))[_0xc890('0x44')](handleError(_0x5739eb,null));};exports[_0xc890('0x45')]=function(_0x2a8c39,_0x2fd1c6){return db[_0xc890('0x2b')]['create'](_0x2a8c39[_0xc890('0x46')],{})[_0xc890('0x25')](respondWithResult(_0x2fd1c6,0xc9))[_0xc890('0x44')](handleError(_0x2fd1c6,null));};exports[_0xc890('0x24')]=function(_0x59f95f,_0x3c586b){if(_0x59f95f[_0xc890('0x46')]['id']){delete _0x59f95f['body']['id'];}return db[_0xc890('0x2b')][_0xc890('0x43')]({'where':{'id':_0x59f95f['params']['id']}})[_0xc890('0x25')](handleEntityNotFound(_0x3c586b,null))[_0xc890('0x25')](saveUpdates(_0x59f95f[_0xc890('0x46')],null))[_0xc890('0x25')](respondWithResult(_0x3c586b,null))[_0xc890('0x44')](handleError(_0x3c586b,null));};exports[_0xc890('0x47')]=function(_0x35fa95,_0x3f6bc7){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x35fa95['params']['id']}})[_0xc890('0x25')](handleEntityNotFound(_0x3f6bc7,null))[_0xc890('0x25')](removeEntity(_0x3f6bc7,null))['catch'](handleError(_0x3f6bc7,null));};exports[_0xc890('0x48')]=function(_0xcc123d,_0x22976f,_0x220ce8){var _0x52ac99={};var _0x1d0361={};var _0x5d9f22;var _0x38e4c1;return db[_0xc890('0x2b')]['findOne']({'where':{'id':_0xcc123d[_0xc890('0x42')]['id']}})[_0xc890('0x25')](handleEntityNotFound(_0x22976f,null))['then'](function(_0x42a13f){if(_0x42a13f){_0x5d9f22=_0x42a13f;_0x1d0361[_0xc890('0x30')]=_[_0xc890('0x31')](db['FreshsalesField'][_0xc890('0x2c')]);_0x1d0361[_0xc890('0x33')]=_[_0xc890('0x31')](_0xcc123d['query']);_0x1d0361[_0xc890('0x39')]=_[_0xc890('0x32')](_0x1d0361[_0xc890('0x30')],_0x1d0361[_0xc890('0x33')]);_0x52ac99[_0xc890('0x35')]=_['intersection'](_0x1d0361[_0xc890('0x30')],qs['fields'](_0xcc123d[_0xc890('0x33')][_0xc890('0x34')]));_0x52ac99[_0xc890('0x35')]=_0x52ac99[_0xc890('0x35')][_0xc890('0x36')]?_0x52ac99[_0xc890('0x35')]:_0x1d0361[_0xc890('0x30')];_0x52ac99[_0xc890('0x49')]=qs[_0xc890('0x4a')](_0xcc123d[_0xc890('0x33')][_0xc890('0x4a')]);_0x52ac99[_0xc890('0x38')]=qs[_0xc890('0x39')](_[_0xc890('0x3a')](_0xcc123d['query'],_0x1d0361[_0xc890('0x39')]));if(_0xcc123d['query'][_0xc890('0x3d')]){_0x52ac99['where']=_[_0xc890('0x3b')](_0x52ac99[_0xc890('0x38')],{'$or':_[_0xc890('0x2a')](_0x52ac99[_0xc890('0x35')],function(_0x336753){var _0x3a57e2={};_0x3a57e2[_0x336753]={'$like':'%'+_0xcc123d[_0xc890('0x33')]['filter']+'%'};return _0x3a57e2;})});}_0x52ac99=_[_0xc890('0x3b')]({},_0x52ac99,_0xcc123d[_0xc890('0x3e')]);return _0x5d9f22[_0xc890('0x48')](_0x52ac99);}})[_0xc890('0x25')](function(_0x59d6ee){if(_0x59d6ee){_0x38e4c1=_0x59d6ee[_0xc890('0x36')];if(!_0xcc123d['query'][_0xc890('0x37')](_0xc890('0x4b'))){_0x52ac99[_0xc890('0x1e')]=qs[_0xc890('0x1e')](_0xcc123d[_0xc890('0x33')][_0xc890('0x1e')]);_0x52ac99[_0xc890('0x1c')]=qs[_0xc890('0x1c')](_0xcc123d[_0xc890('0x33')][_0xc890('0x1c')]);}return _0x5d9f22[_0xc890('0x48')](_0x52ac99);}})[_0xc890('0x25')](function(_0x57c69d){if(_0x57c69d){return _0x57c69d?{'count':_0x38e4c1,'rows':_0x57c69d}:null;}})[_0xc890('0x25')](respondWithResult(_0x22976f,null))[_0xc890('0x44')](handleError(_0x22976f,null));};exports['getDescriptions']=function(_0x5e9575,_0x3bda0a,_0x134177){var _0x4bab13={};var _0x78156b={};var _0x56da4e;var _0x26d7ce;return db[_0xc890('0x2b')][_0xc890('0x4c')]({'where':{'id':_0x5e9575[_0xc890('0x42')]['id']}})['then'](handleEntityNotFound(_0x3bda0a,null))[_0xc890('0x25')](function(_0x21bc45){if(_0x21bc45){_0x56da4e=_0x21bc45;_0x78156b['model']=_[_0xc890('0x31')](db[_0xc890('0x4d')]['rawAttributes']);_0x78156b['query']=_[_0xc890('0x31')](_0x5e9575[_0xc890('0x33')]);_0x78156b[_0xc890('0x39')]=_['intersection'](_0x78156b['model'],_0x78156b[_0xc890('0x33')]);_0x4bab13[_0xc890('0x35')]=_['intersection'](_0x78156b[_0xc890('0x30')],qs['fields'](_0x5e9575['query']['fields']));_0x4bab13['attributes']=_0x4bab13['attributes'][_0xc890('0x36')]?_0x4bab13[_0xc890('0x35')]:_0x78156b[_0xc890('0x30')];_0x4bab13[_0xc890('0x49')]=qs[_0xc890('0x4a')](_0x5e9575[_0xc890('0x33')][_0xc890('0x4a')]);_0x4bab13[_0xc890('0x38')]=qs['filters'](_[_0xc890('0x3a')](_0x5e9575[_0xc890('0x33')],_0x78156b[_0xc890('0x39')]));if(_0x5e9575[_0xc890('0x33')]['filter']){_0x4bab13['where']=_['merge'](_0x4bab13['where'],{'$or':_[_0xc890('0x2a')](_0x4bab13['attributes'],function(_0x5f131b){var _0x27b417={};_0x27b417[_0x5f131b]={'$like':'%'+_0x5e9575[_0xc890('0x33')][_0xc890('0x3d')]+'%'};return _0x27b417;})});}_0x4bab13=_[_0xc890('0x3b')]({},_0x4bab13,_0x5e9575['options']);return _0x56da4e[_0xc890('0x4e')](_0x4bab13);}})[_0xc890('0x25')](function(_0x29898d){if(_0x29898d){_0x26d7ce=_0x29898d[_0xc890('0x36')];if(!_0x5e9575['query']['hasOwnProperty'](_0xc890('0x4b'))){_0x4bab13[_0xc890('0x1e')]=qs['limit'](_0x5e9575[_0xc890('0x33')][_0xc890('0x1e')]);_0x4bab13['offset']=qs['offset'](_0x5e9575[_0xc890('0x33')][_0xc890('0x1c')]);}return _0x56da4e[_0xc890('0x4e')](_0x4bab13);}})[_0xc890('0x25')](function(_0x145491){if(_0x145491){return _0x145491?{'count':_0x26d7ce,'rows':_0x145491}:null;}})['then'](respondWithResult(_0x3bda0a,null))[_0xc890('0x44')](handleError(_0x3bda0a,null));};exports[_0xc890('0x4f')]=function(_0x5dccf1,_0x4f2400,_0x2ca91a){var _0x43b715={};var _0x400add={};var _0x5465f4;var _0x262363;return db[_0xc890('0x2b')][_0xc890('0x4c')]({'where':{'id':_0x5dccf1[_0xc890('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f2400,null))[_0xc890('0x25')](function(_0x5b868e){if(_0x5b868e){_0x5465f4=_0x5b868e;_0x400add[_0xc890('0x30')]=_[_0xc890('0x31')](db[_0xc890('0x4d')][_0xc890('0x2c')]);_0x400add[_0xc890('0x33')]=_[_0xc890('0x31')](_0x5dccf1['query']);_0x400add[_0xc890('0x39')]=_[_0xc890('0x32')](_0x400add[_0xc890('0x30')],_0x400add[_0xc890('0x33')]);_0x43b715[_0xc890('0x35')]=_['intersection'](_0x400add[_0xc890('0x30')],qs['fields'](_0x5dccf1['query'][_0xc890('0x34')]));_0x43b715['attributes']=_0x43b715[_0xc890('0x35')][_0xc890('0x36')]?_0x43b715[_0xc890('0x35')]:_0x400add[_0xc890('0x30')];_0x43b715['order']=qs[_0xc890('0x4a')](_0x5dccf1[_0xc890('0x33')][_0xc890('0x4a')]);_0x43b715[_0xc890('0x38')]=qs[_0xc890('0x39')](_['pick'](_0x5dccf1[_0xc890('0x33')],_0x400add[_0xc890('0x39')]));if(_0x5dccf1['query'][_0xc890('0x3d')]){_0x43b715['where']=_[_0xc890('0x3b')](_0x43b715[_0xc890('0x38')],{'$or':_[_0xc890('0x2a')](_0x43b715['attributes'],function(_0x1cc852){var _0x5d3019={};_0x5d3019[_0x1cc852]={'$like':'%'+_0x5dccf1[_0xc890('0x33')][_0xc890('0x3d')]+'%'};return _0x5d3019;})});}_0x43b715=_[_0xc890('0x3b')]({},_0x43b715,_0x5dccf1['options']);return _0x5465f4[_0xc890('0x4f')](_0x43b715);}})[_0xc890('0x25')](function(_0xab2c3b){if(_0xab2c3b){_0x262363=_0xab2c3b[_0xc890('0x36')];if(!_0x5dccf1[_0xc890('0x33')][_0xc890('0x37')]('nolimit')){_0x43b715[_0xc890('0x1e')]=qs[_0xc890('0x1e')](_0x5dccf1[_0xc890('0x33')][_0xc890('0x1e')]);_0x43b715['offset']=qs[_0xc890('0x1c')](_0x5dccf1[_0xc890('0x33')][_0xc890('0x1c')]);}return _0x5465f4[_0xc890('0x4f')](_0x43b715);}})[_0xc890('0x25')](function(_0x884b2e){if(_0x884b2e){return _0x884b2e?{'count':_0x262363,'rows':_0x884b2e}:null;}})[_0xc890('0x25')](respondWithResult(_0x4f2400,null))[_0xc890('0x44')](handleError(_0x4f2400,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index c52be7d..b335ff6 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 _0xa25d=['./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x41c216,_0x1db1e1){var _0x167762=function(_0x2da2b3){while(--_0x2da2b3){_0x41c216['push'](_0x41c216['shift']());}};_0x167762(++_0x1db1e1);}(_0xa25d,0x1da));var _0xda25=function(_0x2f6014,_0x5c65b7){_0x2f6014=_0x2f6014-0x0;var _0x21453a=_0xa25d[_0x2f6014];return _0x21453a;};'use strict';var _=require(_0xda25('0x0'));var util=require(_0xda25('0x1'));var logger=require(_0xda25('0x2'))(_0xda25('0x3'));var moment=require(_0xda25('0x4'));var BPromise=require('bluebird');var rp=require(_0xda25('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xda25('0x6'));module[_0xda25('0x7')]=function(_0xb6527d,_0x543772){return _0xb6527d['define'](_0xda25('0x8'),attributes,{'tableName':_0xda25('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81c7=['rimraf','../../config/environment','exports','define','FreshsalesConfiguration','int_freshsales_configurations','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x40124e,_0x47920b){var _0x2e8dc2=function(_0x3a6674){while(--_0x3a6674){_0x40124e['push'](_0x40124e['shift']());}};_0x2e8dc2(++_0x47920b);}(_0x81c7,0x192));var _0x781c=function(_0x44c86a,_0x211afe){_0x44c86a=_0x44c86a-0x0;var _0x1e877d=_0x81c7[_0x44c86a];return _0x1e877d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x781c('0x0'))(_0x781c('0x1'));var moment=require(_0x781c('0x2'));var BPromise=require(_0x781c('0x3'));var rp=require(_0x781c('0x4'));var fs=require('fs');var path=require(_0x781c('0x5'));var rimraf=require(_0x781c('0x6'));var config=require(_0x781c('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x781c('0x8')]=function(_0x2f9164,_0x357565){return _0x2f9164[_0x781c('0x9')](_0x781c('0xa'),attributes,{'tableName':_0x781c('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 665f72d..b0b6923 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 _0x8032=['ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring'];(function(_0x4c4686,_0x49e37a){var _0x3a0572=function(_0x2356ff){while(--_0x2356ff){_0x4c4686['push'](_0x4c4686['shift']());}};_0x3a0572(++_0x49e37a);}(_0x8032,0x14c));var _0x2803=function(_0x168765,_0x534f44){_0x168765=_0x168765-0x0;var _0x3ee3a0=_0x8032[_0x168765];return _0x3ee3a0;};'use strict';var _=require('lodash');var util=require(_0x2803('0x0'));var moment=require(_0x2803('0x1'));var BPromise=require(_0x2803('0x2'));var rs=require(_0x2803('0x3'));var fs=require('fs');var Redis=require(_0x2803('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2803('0x5'))(_0x2803('0x6'));var config=require(_0x2803('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2803('0x8')][_0x2803('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e01bb,_0x5b9167,_0xd8f3ec){return new BPromise(function(_0x346982,_0x8d9db){return client[_0x2803('0xa')](_0x4e01bb,_0xd8f3ec)[_0x2803('0xb')](function(_0x4daf56){logger[_0x2803('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5b9167,_0x2803('0xd'));logger[_0x2803('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x5b9167,_0x2803('0xd'),JSON[_0x2803('0xf')](_0x4daf56));if(_0x4daf56[_0x2803('0x10')]){if(_0x4daf56[_0x2803('0x10')][_0x2803('0x11')]===0x1f4){logger['error'](_0x2803('0x12'),_0x5b9167,_0x4daf56['error']['message']);return _0x8d9db(_0x4daf56[_0x2803('0x10')][_0x2803('0x13')]);}logger[_0x2803('0x10')](_0x2803('0x12'),_0x5b9167,_0x4daf56[_0x2803('0x10')][_0x2803('0x13')]);return _0x346982(_0x4daf56[_0x2803('0x10')][_0x2803('0x13')]);}else{logger[_0x2803('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5b9167,_0x2803('0xd'));_0x346982(_0x4daf56['result'][_0x2803('0x13')]);}})[_0x2803('0x14')](function(_0x15aea1){logger[_0x2803('0x10')](_0x2803('0x12'),_0x5b9167,_0x15aea1);_0x8d9db(_0x15aea1);});});} \ No newline at end of file +var _0x1b88=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3c578d,_0x485fe8){var _0x12d019=function(_0x2283ca){while(--_0x2283ca){_0x3c578d['push'](_0x3c578d['shift']());}};_0x12d019(++_0x485fe8);}(_0x1b88,0xfc));var _0x81b8=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x1b88[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0x81b8('0x0'));var util=require(_0x81b8('0x1'));var moment=require(_0x81b8('0x2'));var BPromise=require(_0x81b8('0x3'));var rs=require(_0x81b8('0x4'));var fs=require('fs');var Redis=require(_0x81b8('0x5'));var db=require(_0x81b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x81b8('0x7'))(_0x81b8('0x8'));var config=require(_0x81b8('0x9'));var jayson=require(_0x81b8('0xa'));var client=jayson[_0x81b8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1accd1,_0x194364,_0x260b8c){return new BPromise(function(_0x1206bd,_0x171044){return client[_0x81b8('0xc')](_0x1accd1,_0x260b8c)[_0x81b8('0xd')](function(_0x24bd41){logger[_0x81b8('0xe')](_0x81b8('0xf'),_0x194364,_0x81b8('0x10'));logger[_0x81b8('0x11')](_0x81b8('0x12'),_0x194364,_0x81b8('0x10'),JSON[_0x81b8('0x13')](_0x24bd41));if(_0x24bd41[_0x81b8('0x14')]){if(_0x24bd41[_0x81b8('0x14')][_0x81b8('0x15')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x194364,_0x24bd41[_0x81b8('0x14')][_0x81b8('0x16')]);return _0x171044(_0x24bd41[_0x81b8('0x14')][_0x81b8('0x16')]);}logger['error'](_0x81b8('0xf'),_0x194364,_0x24bd41['error'][_0x81b8('0x16')]);return _0x1206bd(_0x24bd41[_0x81b8('0x14')][_0x81b8('0x16')]);}else{logger[_0x81b8('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x194364,_0x81b8('0x10'));_0x1206bd(_0x24bd41[_0x81b8('0x17')]['message']);}})[_0x81b8('0x18')](function(_0x55aebb){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x194364,_0x55aebb);_0x171044(_0x55aebb);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 3d6def7..6b14098 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 _0x2821=['index','get','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated'];(function(_0x53558f,_0x2db8b7){var _0x2c618f=function(_0x42b98b){while(--_0x42b98b){_0x53558f['push'](_0x53558f['shift']());}};_0x2c618f(++_0x2db8b7);}(_0x2821,0x87));var _0x1282=function(_0x446ab1,_0xe59dd3){_0x446ab1=_0x446ab1-0x0;var _0x35f19f=_0x2821[_0x446ab1];return _0x35f19f;};'use strict';var multer=require(_0x1282('0x0'));var util=require(_0x1282('0x1'));var path=require(_0x1282('0x2'));var timeout=require(_0x1282('0x3'));var express=require(_0x1282('0x4'));var router=express[_0x1282('0x5')]();var fs_extra=require(_0x1282('0x6'));var auth=require(_0x1282('0x7'));var interaction=require(_0x1282('0x8'));var config=require(_0x1282('0x9'));var controller=require(_0x1282('0xa'));router['get']('/',auth[_0x1282('0xb')](),controller[_0x1282('0xc')]);router[_0x1282('0xd')](_0x1282('0xe'),auth[_0x1282('0xb')](),controller[_0x1282('0xf')]);router[_0x1282('0x10')]('/',auth[_0x1282('0xb')](),controller['create']);router[_0x1282('0x11')](_0x1282('0xe'),auth[_0x1282('0xb')](),controller[_0x1282('0x12')]);router[_0x1282('0x13')]('/:id',auth[_0x1282('0xb')](),controller[_0x1282('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5e14=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e14,0x164));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x45e1('0x0'));var util=require(_0x45e1('0x1'));var path=require(_0x45e1('0x2'));var timeout=require(_0x45e1('0x3'));var express=require(_0x45e1('0x4'));var router=express[_0x45e1('0x5')]();var fs_extra=require(_0x45e1('0x6'));var auth=require(_0x45e1('0x7'));var interaction=require(_0x45e1('0x8'));var config=require(_0x45e1('0x9'));var controller=require(_0x45e1('0xa'));router[_0x45e1('0xb')]('/',auth[_0x45e1('0xc')](),controller[_0x45e1('0xd')]);router[_0x45e1('0xb')](_0x45e1('0xe'),auth[_0x45e1('0xc')](),controller[_0x45e1('0xf')]);router[_0x45e1('0x10')]('/',auth[_0x45e1('0xc')](),controller[_0x45e1('0x11')]);router[_0x45e1('0x12')]('/:id',auth[_0x45e1('0xc')](),controller[_0x45e1('0x13')]);router[_0x45e1('0x14')]('/:id',auth[_0x45e1('0xc')](),controller['destroy']);module[_0x45e1('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 1e2b8ec..5d905c7 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 _0xcd11=['customVariable','keyValue','picklist','STRING','variable','sequelize','exports','ENUM','string'];(function(_0x2f38d2,_0x511fc2){var _0x421164=function(_0x5e4bfc){while(--_0x5e4bfc){_0x2f38d2['push'](_0x2f38d2['shift']());}};_0x421164(++_0x511fc2);}(_0xcd11,0xe6));var _0x1cd1=function(_0x1a7ac8,_0x275bdc){_0x1a7ac8=_0x1a7ac8-0x0;var _0x4e621d=_0xcd11[_0x1a7ac8];return _0x4e621d;};'use strict';var Sequelize=require(_0x1cd1('0x0'));module[_0x1cd1('0x1')]={'type':{'type':Sequelize[_0x1cd1('0x2')](_0x1cd1('0x3'),'variable',_0x1cd1('0x4'),_0x1cd1('0x5'),_0x1cd1('0x6')),'defaultValue':_0x1cd1('0x3')},'content':{'type':Sequelize[_0x1cd1('0x7')]},'key':{'type':Sequelize[_0x1cd1('0x7')]},'keyType':{'type':Sequelize[_0x1cd1('0x2')](_0x1cd1('0x3'),_0x1cd1('0x8'),_0x1cd1('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1cd1('0x7')]},'nameField':{'type':Sequelize[_0x1cd1('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd69a=['sequelize','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x40856b,_0x44287c){var _0x11abac=function(_0x520eba){while(--_0x520eba){_0x40856b['push'](_0x40856b['shift']());}};_0x11abac(++_0x44287c);}(_0xd69a,0x170));var _0xad69=function(_0x13ad47,_0x419204){_0x13ad47=_0x13ad47-0x0;var _0x5aa7bb=_0xd69a[_0x13ad47];return _0x5aa7bb;};'use strict';var Sequelize=require(_0xad69('0x0'));module['exports']={'type':{'type':Sequelize[_0xad69('0x1')](_0xad69('0x2'),_0xad69('0x3'),_0xad69('0x4'),_0xad69('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xad69('0x6')]},'key':{'type':Sequelize[_0xad69('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xad69('0x2'),_0xad69('0x3'),_0xad69('0x4'))},'keyContent':{'type':Sequelize[_0xad69('0x6')]},'idField':{'type':Sequelize[_0xad69('0x6')]},'nameField':{'type':Sequelize[_0xad69('0x6')]},'customField':{'type':Sequelize[_0xad69('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xad69('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 800ac89..8d0cef6 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 _0x0219=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','where','VIRTUAL','merge','options','include','findAll','rows','fields','length','includeAll','find','catch','create','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0x0219,0xba));var _0x9021=function(_0x8d823c,_0x4dfa8e){_0x8d823c=_0x8d823c-0x0;var _0x1399a6=_0x0219[_0x8d823c];return _0x1399a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9021('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9021('0x1'));var rp=require(_0x9021('0x2'));var moment=require(_0x9021('0x3'));var BPromise=require(_0x9021('0x4'));var Mustache=require(_0x9021('0x5'));var util=require('util');var path=require(_0x9021('0x6'));var sox=require(_0x9021('0x7'));var csv=require(_0x9021('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9021('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9021('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x9021('0x8'));var querystring=require('querystring');var Papa=require(_0x9021('0xb'));var Redis=require(_0x9021('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x9021('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9021('0xe'));var logger=require('../../config/logger')(_0x9021('0xf'));var utils=require(_0x9021('0x10'));var config=require(_0x9021('0x11'));var licenseUtil=require(_0x9021('0x12'));var db=require(_0x9021('0x13'))['db'];function respondWithStatusCode(_0x755e6d,_0x3d8950){_0x3d8950=_0x3d8950||0xcc;return function(_0x1b67c9){if(_0x1b67c9){return _0x755e6d[_0x9021('0x14')](_0x3d8950);}return _0x755e6d['status'](_0x3d8950)[_0x9021('0x15')]();};}function respondWithResult(_0x2b5fd7,_0x1a476e){_0x1a476e=_0x1a476e||0xc8;return function(_0x4bc6ca){if(_0x4bc6ca){return _0x2b5fd7[_0x9021('0x16')](_0x1a476e)[_0x9021('0x17')](_0x4bc6ca);}};}function respondWithFilteredResult(_0x4fe5b9,_0x416c57){return function(_0x5d6aa8){if(_0x5d6aa8){var _0x1ded44=typeof _0x416c57[_0x9021('0x18')]===_0x9021('0x19')&&typeof _0x416c57[_0x9021('0x1a')]===_0x9021('0x19');var _0x3f27cf=_0x5d6aa8[_0x9021('0x1b')];var _0x485925=_0x1ded44?0x0:_0x416c57[_0x9021('0x18')];var _0x131128=_0x1ded44?_0x5d6aa8['count']:_0x416c57['offset']+_0x416c57['limit'];var _0xaa16ac;if(_0x131128>=_0x3f27cf){_0x131128=_0x3f27cf;_0xaa16ac=0xc8;}else{_0xaa16ac=0xce;}_0x4fe5b9[_0x9021('0x16')](_0xaa16ac);return _0x4fe5b9['set'](_0x9021('0x1c'),_0x485925+'-'+_0x131128+'/'+_0x3f27cf)['json'](_0x5d6aa8);}return null;};}function patchUpdates(_0x2c7d52){return function(_0x4508b9){try{jsonpatch[_0x9021('0x1d')](_0x4508b9,_0x2c7d52,!![]);}catch(_0x31ac55){return BPromise['reject'](_0x31ac55);}return _0x4508b9[_0x9021('0x1e')]();};}function saveUpdates(_0x32800d,_0x42419){return function(_0x248010){if(_0x248010){return _0x248010[_0x9021('0x1f')](_0x32800d)['then'](function(_0x3e2cd7){return _0x3e2cd7;});}return null;};}function removeEntity(_0x5ad4a3,_0x31ea96){return function(_0x15a240){if(_0x15a240){return _0x15a240['destroy']()[_0x9021('0x20')](function(){_0x5ad4a3[_0x9021('0x16')](0xcc)[_0x9021('0x15')]();});}};}function handleEntityNotFound(_0xbc9716,_0x39d0cb){return function(_0xd2a483){if(!_0xd2a483){_0xbc9716[_0x9021('0x14')](0x194);}return _0xd2a483;};}function handleError(_0x2fc996,_0xd35621){_0xd35621=_0xd35621||0x1f4;return function(_0x2188da){logger[_0x9021('0x21')](_0x2188da[_0x9021('0x22')]);if(_0x2188da[_0x9021('0x23')]){delete _0x2188da[_0x9021('0x23')];}_0x2fc996[_0x9021('0x16')](_0xd35621)[_0x9021('0x24')](_0x2188da);};}exports[_0x9021('0x25')]=function(_0x78cf2,_0x5b946a){var _0x413d36={},_0x50c41e={},_0x1efef0={'count':0x0,'rows':[]};var _0x71adb9=_[_0x9021('0x26')](db[_0x9021('0x27')][_0x9021('0x28')],function(_0x4ed36f){return{'name':_0x4ed36f[_0x9021('0x29')],'type':_0x4ed36f[_0x9021('0x2a')][_0x9021('0x2b')]};});_0x50c41e[_0x9021('0x2c')]=_['map'](_0x71adb9,_0x9021('0x23'));_0x50c41e[_0x9021('0x2d')]=_[_0x9021('0x2e')](_0x78cf2[_0x9021('0x2d')]);_0x50c41e[_0x9021('0x2f')]=_[_0x9021('0x30')](_0x50c41e[_0x9021('0x2c')],_0x50c41e[_0x9021('0x2d')]);_0x413d36['attributes']=_[_0x9021('0x30')](_0x50c41e[_0x9021('0x2c')],qs['fields'](_0x78cf2[_0x9021('0x2d')]['fields']));_0x413d36[_0x9021('0x31')]=_0x413d36[_0x9021('0x31')]['length']?_0x413d36['attributes']:_0x50c41e[_0x9021('0x2c')];if(!_0x78cf2['query'][_0x9021('0x32')](_0x9021('0x33'))){_0x413d36[_0x9021('0x1a')]=qs[_0x9021('0x1a')](_0x78cf2[_0x9021('0x2d')][_0x9021('0x1a')]);_0x413d36[_0x9021('0x18')]=qs[_0x9021('0x18')](_0x78cf2['query'][_0x9021('0x18')]);}_0x413d36[_0x9021('0x34')]=qs['sort'](_0x78cf2['query']['sort']);_0x413d36['where']=qs[_0x9021('0x2f')](_['pick'](_0x78cf2[_0x9021('0x2d')],_0x50c41e['filters']),_0x71adb9);if(_0x78cf2[_0x9021('0x2d')]['filter']){_0x413d36[_0x9021('0x35')]=_['merge'](_0x413d36[_0x9021('0x35')],{'$or':_[_0x9021('0x26')](_0x71adb9,function(_0x677c5b){if(_0x677c5b['type']!==_0x9021('0x36')){var _0x2f1ddc={};_0x2f1ddc[_0x677c5b[_0x9021('0x23')]]={'$like':'%'+_0x78cf2[_0x9021('0x2d')]['filter']+'%'};return _0x2f1ddc;}})});}_0x413d36=_[_0x9021('0x37')]({},_0x413d36,_0x78cf2[_0x9021('0x38')]);var _0x2c157e={'where':_0x413d36['where']};return db[_0x9021('0x27')][_0x9021('0x1b')](_0x2c157e)[_0x9021('0x20')](function(_0x366d69){_0x1efef0[_0x9021('0x1b')]=_0x366d69;if(_0x78cf2['query']['includeAll']){_0x413d36[_0x9021('0x39')]=[{'all':!![]}];}return db['FreshsalesField'][_0x9021('0x3a')](_0x413d36);})[_0x9021('0x20')](function(_0x2cfe66){_0x1efef0[_0x9021('0x3b')]=_0x2cfe66;return _0x1efef0;})[_0x9021('0x20')](respondWithFilteredResult(_0x5b946a,_0x413d36))['catch'](handleError(_0x5b946a,null));};exports['show']=function(_0x1bf2c7,_0x4a6b0a){var _0x478e91={'raw':!![],'where':{'id':_0x1bf2c7['params']['id']}},_0x1c02e1={};_0x1c02e1['model']=_['keys'](db[_0x9021('0x27')]['rawAttributes']);_0x1c02e1[_0x9021('0x2d')]=_[_0x9021('0x2e')](_0x1bf2c7[_0x9021('0x2d')]);_0x1c02e1[_0x9021('0x2f')]=_[_0x9021('0x30')](_0x1c02e1[_0x9021('0x2c')],_0x1c02e1[_0x9021('0x2d')]);_0x478e91[_0x9021('0x31')]=_[_0x9021('0x30')](_0x1c02e1[_0x9021('0x2c')],qs[_0x9021('0x3c')](_0x1bf2c7[_0x9021('0x2d')][_0x9021('0x3c')]));_0x478e91[_0x9021('0x31')]=_0x478e91[_0x9021('0x31')][_0x9021('0x3d')]?_0x478e91[_0x9021('0x31')]:_0x1c02e1[_0x9021('0x2c')];if(_0x1bf2c7['query'][_0x9021('0x3e')]){_0x478e91[_0x9021('0x39')]=[{'all':!![]}];}_0x478e91=_['merge']({},_0x478e91,_0x1bf2c7['options']);return db[_0x9021('0x27')][_0x9021('0x3f')](_0x478e91)['then'](handleEntityNotFound(_0x4a6b0a,null))['then'](respondWithResult(_0x4a6b0a,null))[_0x9021('0x40')](handleError(_0x4a6b0a,null));};exports[_0x9021('0x41')]=function(_0x2377d9,_0x55e7fe){return db[_0x9021('0x27')][_0x9021('0x41')](_0x2377d9[_0x9021('0x42')],{})[_0x9021('0x20')](respondWithResult(_0x55e7fe,0xc9))['catch'](handleError(_0x55e7fe,null));};exports['update']=function(_0x55eb4a,_0x1f0ad1){if(_0x55eb4a[_0x9021('0x42')]['id']){delete _0x55eb4a[_0x9021('0x42')]['id'];}return db[_0x9021('0x27')]['find']({'where':{'id':_0x55eb4a['params']['id']}})[_0x9021('0x20')](handleEntityNotFound(_0x1f0ad1,null))['then'](saveUpdates(_0x55eb4a[_0x9021('0x42')],null))[_0x9021('0x20')](respondWithResult(_0x1f0ad1,null))[_0x9021('0x40')](handleError(_0x1f0ad1,null));};exports['destroy']=function(_0x44cd52,_0x2ea450){return db['FreshsalesField'][_0x9021('0x3f')]({'where':{'id':_0x44cd52[_0x9021('0x43')]['id']}})[_0x9021('0x20')](handleEntityNotFound(_0x2ea450,null))[_0x9021('0x20')](removeEntity(_0x2ea450,null))[_0x9021('0x40')](handleError(_0x2ea450,null));}; \ No newline at end of file +var _0x4be9=['Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','keys','includeAll','find','create','body','params','rimraf','zip-dir','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set'];(function(_0x79857b,_0x183337){var _0x1779da=function(_0x535eaf){while(--_0x535eaf){_0x79857b['push'](_0x79857b['shift']());}};_0x1779da(++_0x183337);}(_0x4be9,0x110));var _0x94be=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x4be9[_0x34021d];return _0x16597b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x94be('0x0'));var zipdir=require(_0x94be('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x94be('0x2'));var Mustache=require(_0x94be('0x3'));var util=require(_0x94be('0x4'));var path=require(_0x94be('0x5'));var sox=require(_0x94be('0x6'));var csv=require('to-csv');var ejs=require(_0x94be('0x7'));var fs=require('fs');var fs_extra=require(_0x94be('0x8'));var _=require(_0x94be('0x9'));var squel=require(_0x94be('0xa'));var crypto=require('crypto');var jsforce=require(_0x94be('0xb'));var deskjs=require(_0x94be('0xc'));var toCsv=require('to-csv');var querystring=require(_0x94be('0xd'));var Papa=require(_0x94be('0xe'));var Redis=require(_0x94be('0xf'));var authService=require(_0x94be('0x10'));var qs=require(_0x94be('0x11'));var as=require(_0x94be('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x94be('0x13'))(_0x94be('0x14'));var utils=require(_0x94be('0x15'));var config=require(_0x94be('0x16'));var licenseUtil=require(_0x94be('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe6afda,_0x3a6fa0){_0x3a6fa0=_0x3a6fa0||0xcc;return function(_0x15e3bb){if(_0x15e3bb){return _0xe6afda['sendStatus'](_0x3a6fa0);}return _0xe6afda[_0x94be('0x18')](_0x3a6fa0)[_0x94be('0x19')]();};}function respondWithResult(_0x222af0,_0x51799d){_0x51799d=_0x51799d||0xc8;return function(_0x5b9d1f){if(_0x5b9d1f){return _0x222af0[_0x94be('0x18')](_0x51799d)[_0x94be('0x1a')](_0x5b9d1f);}};}function respondWithFilteredResult(_0x369930,_0x4a647f){return function(_0x5c7070){if(_0x5c7070){var _0x37ff7d=typeof _0x4a647f[_0x94be('0x1b')]===_0x94be('0x1c')&&typeof _0x4a647f[_0x94be('0x1d')]==='undefined';var _0x34ed64=_0x5c7070[_0x94be('0x1e')];var _0x1efa1c=_0x37ff7d?0x0:_0x4a647f['offset'];var _0x65bebf=_0x37ff7d?_0x5c7070[_0x94be('0x1e')]:_0x4a647f['offset']+_0x4a647f[_0x94be('0x1d')];var _0x207536;if(_0x65bebf>=_0x34ed64){_0x65bebf=_0x34ed64;_0x207536=0xc8;}else{_0x207536=0xce;}_0x369930['status'](_0x207536);return _0x369930[_0x94be('0x1f')](_0x94be('0x20'),_0x1efa1c+'-'+_0x65bebf+'/'+_0x34ed64)['json'](_0x5c7070);}return null;};}function patchUpdates(_0x2e4d45){return function(_0x1fc38e){try{jsonpatch['apply'](_0x1fc38e,_0x2e4d45,!![]);}catch(_0x5ec52a){return BPromise[_0x94be('0x21')](_0x5ec52a);}return _0x1fc38e[_0x94be('0x22')]();};}function saveUpdates(_0x42b38d,_0x1e76eb){return function(_0x3b3866){if(_0x3b3866){return _0x3b3866[_0x94be('0x23')](_0x42b38d)[_0x94be('0x24')](function(_0xd39165){return _0xd39165;});}return null;};}function removeEntity(_0x1752df,_0x24b73d){return function(_0x5a24d7){if(_0x5a24d7){return _0x5a24d7[_0x94be('0x25')]()[_0x94be('0x24')](function(){_0x1752df[_0x94be('0x18')](0xcc)[_0x94be('0x19')]();});}};}function handleEntityNotFound(_0x241877,_0x1e55d5){return function(_0xbed845){if(!_0xbed845){_0x241877[_0x94be('0x26')](0x194);}return _0xbed845;};}function handleError(_0x997b74,_0x30bcd3){_0x30bcd3=_0x30bcd3||0x1f4;return function(_0x20daa7){logger[_0x94be('0x27')](_0x20daa7[_0x94be('0x28')]);if(_0x20daa7[_0x94be('0x29')]){delete _0x20daa7[_0x94be('0x29')];}_0x997b74['status'](_0x30bcd3)[_0x94be('0x2a')](_0x20daa7);};}exports[_0x94be('0x2b')]=function(_0x4f5b0d,_0x378375){var _0x2260b6={},_0x3a12e7={},_0x32a0cd={'count':0x0,'rows':[]};var _0x5f0044=_[_0x94be('0x2c')](db[_0x94be('0x2d')][_0x94be('0x2e')],function(_0x2923bb){return{'name':_0x2923bb[_0x94be('0x2f')],'type':_0x2923bb[_0x94be('0x30')][_0x94be('0x31')]};});_0x3a12e7[_0x94be('0x32')]=_[_0x94be('0x2c')](_0x5f0044,_0x94be('0x29'));_0x3a12e7['query']=_['keys'](_0x4f5b0d[_0x94be('0x33')]);_0x3a12e7[_0x94be('0x34')]=_['intersection'](_0x3a12e7['model'],_0x3a12e7[_0x94be('0x33')]);_0x2260b6[_0x94be('0x35')]=_[_0x94be('0x36')](_0x3a12e7[_0x94be('0x32')],qs[_0x94be('0x37')](_0x4f5b0d[_0x94be('0x33')][_0x94be('0x37')]));_0x2260b6['attributes']=_0x2260b6[_0x94be('0x35')][_0x94be('0x38')]?_0x2260b6[_0x94be('0x35')]:_0x3a12e7[_0x94be('0x32')];if(!_0x4f5b0d[_0x94be('0x33')][_0x94be('0x39')](_0x94be('0x3a'))){_0x2260b6['limit']=qs[_0x94be('0x1d')](_0x4f5b0d['query'][_0x94be('0x1d')]);_0x2260b6[_0x94be('0x1b')]=qs[_0x94be('0x1b')](_0x4f5b0d[_0x94be('0x33')]['offset']);}_0x2260b6['order']=qs[_0x94be('0x3b')](_0x4f5b0d['query'][_0x94be('0x3b')]);_0x2260b6[_0x94be('0x3c')]=qs[_0x94be('0x34')](_[_0x94be('0x3d')](_0x4f5b0d[_0x94be('0x33')],_0x3a12e7[_0x94be('0x34')]),_0x5f0044);if(_0x4f5b0d[_0x94be('0x33')][_0x94be('0x3e')]){_0x2260b6[_0x94be('0x3c')]=_[_0x94be('0x3f')](_0x2260b6[_0x94be('0x3c')],{'$or':_[_0x94be('0x2c')](_0x5f0044,function(_0x3c960f){if(_0x3c960f['type']!==_0x94be('0x40')){var _0x26cb34={};_0x26cb34[_0x3c960f['name']]={'$like':'%'+_0x4f5b0d[_0x94be('0x33')][_0x94be('0x3e')]+'%'};return _0x26cb34;}})});}_0x2260b6=_[_0x94be('0x3f')]({},_0x2260b6,_0x4f5b0d[_0x94be('0x41')]);var _0x5eff3e={'where':_0x2260b6[_0x94be('0x3c')]};return db[_0x94be('0x2d')]['count'](_0x5eff3e)[_0x94be('0x24')](function(_0x2c6ff7){_0x32a0cd[_0x94be('0x1e')]=_0x2c6ff7;if(_0x4f5b0d['query']['includeAll']){_0x2260b6[_0x94be('0x42')]=[{'all':!![]}];}return db[_0x94be('0x2d')]['findAll'](_0x2260b6);})[_0x94be('0x24')](function(_0x489ba7){_0x32a0cd[_0x94be('0x43')]=_0x489ba7;return _0x32a0cd;})['then'](respondWithFilteredResult(_0x378375,_0x2260b6))[_0x94be('0x44')](handleError(_0x378375,null));};exports[_0x94be('0x45')]=function(_0xbdf974,_0x5c7d71){var _0x3e9bef={'raw':!![],'where':{'id':_0xbdf974['params']['id']}},_0x5afee5={};_0x5afee5[_0x94be('0x32')]=_[_0x94be('0x46')](db[_0x94be('0x2d')][_0x94be('0x2e')]);_0x5afee5['query']=_['keys'](_0xbdf974['query']);_0x5afee5[_0x94be('0x34')]=_['intersection'](_0x5afee5[_0x94be('0x32')],_0x5afee5[_0x94be('0x33')]);_0x3e9bef[_0x94be('0x35')]=_[_0x94be('0x36')](_0x5afee5[_0x94be('0x32')],qs[_0x94be('0x37')](_0xbdf974[_0x94be('0x33')][_0x94be('0x37')]));_0x3e9bef[_0x94be('0x35')]=_0x3e9bef[_0x94be('0x35')][_0x94be('0x38')]?_0x3e9bef[_0x94be('0x35')]:_0x5afee5[_0x94be('0x32')];if(_0xbdf974[_0x94be('0x33')][_0x94be('0x47')]){_0x3e9bef[_0x94be('0x42')]=[{'all':!![]}];}_0x3e9bef=_[_0x94be('0x3f')]({},_0x3e9bef,_0xbdf974[_0x94be('0x41')]);return db['FreshsalesField'][_0x94be('0x48')](_0x3e9bef)[_0x94be('0x24')](handleEntityNotFound(_0x5c7d71,null))[_0x94be('0x24')](respondWithResult(_0x5c7d71,null))[_0x94be('0x44')](handleError(_0x5c7d71,null));};exports[_0x94be('0x49')]=function(_0x2d7ace,_0x1f071c){return db['FreshsalesField'][_0x94be('0x49')](_0x2d7ace[_0x94be('0x4a')],{})['then'](respondWithResult(_0x1f071c,0xc9))[_0x94be('0x44')](handleError(_0x1f071c,null));};exports[_0x94be('0x23')]=function(_0x273920,_0x216711){if(_0x273920[_0x94be('0x4a')]['id']){delete _0x273920[_0x94be('0x4a')]['id'];}return db[_0x94be('0x2d')][_0x94be('0x48')]({'where':{'id':_0x273920[_0x94be('0x4b')]['id']}})['then'](handleEntityNotFound(_0x216711,null))[_0x94be('0x24')](saveUpdates(_0x273920[_0x94be('0x4a')],null))[_0x94be('0x24')](respondWithResult(_0x216711,null))['catch'](handleError(_0x216711,null));};exports['destroy']=function(_0x540822,_0x32e6c5){return db[_0x94be('0x2d')][_0x94be('0x48')]({'where':{'id':_0x540822[_0x94be('0x4b')]['id']}})[_0x94be('0x24')](handleEntityNotFound(_0x32e6c5,null))[_0x94be('0x24')](removeEntity(_0x32e6c5,null))[_0x94be('0x44')](handleError(_0x32e6c5,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index d67e680..19c9e93 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 _0x7292=['rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x110bb7,_0x56c479){var _0x1e6ac2=function(_0x27ca58){while(--_0x27ca58){_0x110bb7['push'](_0x110bb7['shift']());}};_0x1e6ac2(++_0x56c479);}(_0x7292,0x107));var _0x2729=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x7292[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x2729('0x0'));var util=require(_0x2729('0x1'));var logger=require(_0x2729('0x2'))(_0x2729('0x3'));var moment=require(_0x2729('0x4'));var BPromise=require(_0x2729('0x5'));var rp=require(_0x2729('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2729('0x7'));var config=require(_0x2729('0x8'));var attributes=require(_0x2729('0x9'));module[_0x2729('0xa')]=function(_0x26a3dc,_0x176a7c){return _0x26a3dc[_0x2729('0xb')](_0x2729('0xc'),attributes,{'tableName':_0x2729('0xd'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField',_0x2729('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab75=['idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x65c903,_0x41e920){var _0x23e1d7=function(_0x4279cd){while(--_0x4279cd){_0x65c903['push'](_0x65c903['shift']());}};_0x23e1d7(++_0x41e920);}(_0xab75,0x11f));var _0x5ab7=function(_0x2ae10b,_0x10ccd2){_0x2ae10b=_0x2ae10b-0x0;var _0x3b7c2c=_0xab75[_0x2ae10b];return _0x3b7c2c;};'use strict';var _=require(_0x5ab7('0x0'));var util=require(_0x5ab7('0x1'));var logger=require(_0x5ab7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5ab7('0x3'));var rp=require(_0x5ab7('0x4'));var fs=require('fs');var path=require(_0x5ab7('0x5'));var rimraf=require('rimraf');var config=require(_0x5ab7('0x6'));var attributes=require(_0x5ab7('0x7'));module[_0x5ab7('0x8')]=function(_0x3e1c7e,_0x406ca2){return _0x3e1c7e[_0x5ab7('0x9')](_0x5ab7('0xa'),attributes,{'tableName':_0x5ab7('0xb'),'paranoid':![],'indexes':[{'name':_0x5ab7('0xc'),'fields':[_0x5ab7('0xd'),_0x5ab7('0xe')],'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 e83e8f0..e619407 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1c37a5,_0x59ee51){var _0x389d03=function(_0x51b4f4){while(--_0x51b4f4){_0x1c37a5['push'](_0x1c37a5['shift']());}};_0x389d03(++_0x59ee51);}(_0x5fab,0x177));var _0xb5fa=function(_0x7f5123,_0x3062c5){_0x7f5123=_0x7f5123-0x0;var _0x10a02a=_0x5fab[_0x7f5123];return _0x10a02a;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x4c60=['client','http','request','then','debug','request\x20sent','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise'];(function(_0x2f8c39,_0x310136){var _0xc3261d=function(_0xc2703c){while(--_0xc2703c){_0x2f8c39['push'](_0x2f8c39['shift']());}};_0xc3261d(++_0x310136);}(_0x4c60,0xc1));var _0x04c6=function(_0x4dd015,_0x3a1969){_0x4dd015=_0x4dd015-0x0;var _0x767c02=_0x4c60[_0x4dd015];return _0x767c02;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var moment=require(_0x04c6('0x2'));var BPromise=require(_0x04c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x04c6('0x5'));var jayson=require(_0x04c6('0x6'));var client=jayson[_0x04c6('0x7')][_0x04c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b9041,_0x39be2d,_0x8f9b13){return new BPromise(function(_0x530a48,_0x2a4b51){return client[_0x04c6('0x9')](_0x2b9041,_0x8f9b13)[_0x04c6('0xa')](function(_0x30b901){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x39be2d,'request\x20sent');logger[_0x04c6('0xb')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x39be2d,_0x04c6('0xc'),JSON[_0x04c6('0xd')](_0x30b901));if(_0x30b901['error']){if(_0x30b901[_0x04c6('0xe')][_0x04c6('0xf')]===0x1f4){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x30b901['error'][_0x04c6('0x11')]);return _0x2a4b51(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}logger['error'](_0x04c6('0x10'),_0x39be2d,_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);return _0x530a48(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}else{logger[_0x04c6('0x12')](_0x04c6('0x10'),_0x39be2d,_0x04c6('0xc'));_0x530a48(_0x30b901['result'][_0x04c6('0x11')]);}})[_0x04c6('0x13')](function(_0x382e58){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x382e58);_0x2a4b51(_0x382e58);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 3d1380a..6ff2106 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x4ab7af,_0x38eb6b){var _0x22746c=function(_0x333563){while(--_0x333563){_0x4ab7af['push'](_0x4ab7af['shift']());}};_0x22746c(++_0x38eb6b);}(_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['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3b5605,_0x2bafe0){var _0x1a6236=function(_0x586e67){while(--_0x586e67){_0x3b5605['push'](_0x3b5605['shift']());}};_0x1a6236(++_0x2bafe0);}(_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('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 011c4cc..c1567fb 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 _0x4d4e=['sequelize','STRING','username','ENUM'];(function(_0x20924f,_0x500606){var _0x3fdbc6=function(_0x50f72a){while(--_0x50f72a){_0x20924f['push'](_0x20924f['shift']());}};_0x3fdbc6(++_0x500606);}(_0x4d4e,0xa4));var _0xe4d4=function(_0x420d9f,_0xf1a8ce){_0x420d9f=_0x420d9f-0x0;var _0x501d3a=_0x4d4e[_0x420d9f];return _0x501d3a;};'use strict';var Sequelize=require(_0xe4d4('0x0'));module['exports']={'name':{'type':Sequelize[_0xe4d4('0x1')]},'description':{'type':Sequelize[_0xe4d4('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xe4d4('0x2')},'remoteUri':{'type':Sequelize[_0xe4d4('0x1')]},'password':{'type':Sequelize[_0xe4d4('0x1')]},'clientId':{'type':Sequelize[_0xe4d4('0x1')]},'clientSecret':{'type':Sequelize[_0xe4d4('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe4d4('0x3')]('integrationTab','newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xfa25=['STRING','username','ENUM','integrationTab','exports'];(function(_0x149ca0,_0x2ac7f5){var _0x56b6b9=function(_0x486ac3){while(--_0x486ac3){_0x149ca0['push'](_0x149ca0['shift']());}};_0x56b6b9(++_0x2ac7f5);}(_0xfa25,0xd1));var _0x5fa2=function(_0xf785ae,_0x211032){_0xf785ae=_0xf785ae-0x0;var _0x2e9f79=_0xfa25[_0xf785ae];return _0x2e9f79;};'use strict';var Sequelize=require('sequelize');module[_0x5fa2('0x0')]={'name':{'type':Sequelize[_0x5fa2('0x1')]},'description':{'type':Sequelize[_0x5fa2('0x1')]},'username':{'type':Sequelize[_0x5fa2('0x1')],'unique':_0x5fa2('0x2')},'remoteUri':{'type':Sequelize[_0x5fa2('0x1')]},'password':{'type':Sequelize[_0x5fa2('0x1')]},'clientId':{'type':Sequelize[_0x5fa2('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x5fa2('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5fa2('0x3')]('integrationTab','newTab'),'defaultValue':_0x5fa2('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 8ba0ce4..0d49ed9 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 _0x74e1=['status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','keys','include','find','catch','create','body','params','getConfigurations','findOne','SalesforceConfiguration','nolimit','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','Task','remoteUri','clientSecret','securityToken','slice','substring','Connection','clientId','login','password','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsRecurrence','Subject','Description','string','int','picklist','boolean','textarea','includes','picklistValues','value','true','False','false','test','statusCode','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x5b8041,_0x21a134){var _0x39fffa=function(_0x1534b0){while(--_0x1534b0){_0x5b8041['push'](_0x5b8041['shift']());}};_0x39fffa(++_0x21a134);}(_0x74e1,0x1c9));var _0x174e=function(_0xffaf7c,_0x3d53b8){_0xffaf7c=_0xffaf7c-0x0;var _0x324c40=_0x74e1[_0xffaf7c];return _0x324c40;};'use strict';var emlformat=require(_0x174e('0x0'));var rimraf=require(_0x174e('0x1'));var zipdir=require(_0x174e('0x2'));var jsonpatch=require(_0x174e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x174e('0x4'));var util=require(_0x174e('0x5'));var path=require(_0x174e('0x6'));var sox=require(_0x174e('0x7'));var csv=require(_0x174e('0x8'));var ejs=require(_0x174e('0x9'));var fs=require('fs');var fs_extra=require(_0x174e('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x174e('0xb'));var jsforce=require(_0x174e('0xc'));var deskjs=require(_0x174e('0xd'));var toCsv=require(_0x174e('0x8'));var querystring=require(_0x174e('0xe'));var Papa=require(_0x174e('0xf'));var Redis=require(_0x174e('0x10'));var authService=require(_0x174e('0x11'));var qs=require(_0x174e('0x12'));var as=require(_0x174e('0x13'));var hardwareService=require(_0x174e('0x14'));var logger=require(_0x174e('0x15'))(_0x174e('0x16'));var utils=require('../../config/utils');var config=require(_0x174e('0x17'));var licenseUtil=require(_0x174e('0x18'));var db=require(_0x174e('0x19'))['db'];var integrations=require(_0x174e('0x1a'));function respondWithStatusCode(_0x566a6d,_0x213710){_0x213710=_0x213710||0xcc;return function(_0x2d4b8d){if(_0x2d4b8d){return _0x566a6d['sendStatus'](_0x213710);}return _0x566a6d[_0x174e('0x1b')](_0x213710)[_0x174e('0x1c')]();};}function respondWithResult(_0x29cf11,_0x24b815){_0x24b815=_0x24b815||0xc8;return function(_0x4de6d5){if(_0x4de6d5){return _0x29cf11[_0x174e('0x1b')](_0x24b815)[_0x174e('0x1d')](_0x4de6d5);}};}function respondWithFilteredResult(_0x27139e,_0x987784){return function(_0x13f1de){if(_0x13f1de){var _0x36b587=typeof _0x987784[_0x174e('0x1e')]===_0x174e('0x1f')&&typeof _0x987784[_0x174e('0x20')]===_0x174e('0x1f');var _0xfc7e16=_0x13f1de[_0x174e('0x21')];var _0x1e054a=_0x36b587?0x0:_0x987784['offset'];var _0x405766=_0x36b587?_0x13f1de[_0x174e('0x21')]:_0x987784[_0x174e('0x1e')]+_0x987784[_0x174e('0x20')];var _0x5be1af;if(_0x405766>=_0xfc7e16){_0x405766=_0xfc7e16;_0x5be1af=0xc8;}else{_0x5be1af=0xce;}_0x27139e[_0x174e('0x1b')](_0x5be1af);return _0x27139e['set'](_0x174e('0x22'),_0x1e054a+'-'+_0x405766+'/'+_0xfc7e16)['json'](_0x13f1de);}return null;};}function patchUpdates(_0x329ca3){return function(_0x136418){try{jsonpatch[_0x174e('0x23')](_0x136418,_0x329ca3,!![]);}catch(_0xa85c5e){return BPromise[_0x174e('0x24')](_0xa85c5e);}return _0x136418['save']();};}function saveUpdates(_0x48825e,_0xcfce27){return function(_0x1eb247){if(_0x1eb247){return _0x1eb247[_0x174e('0x25')](_0x48825e)[_0x174e('0x26')](function(_0x322de4){return _0x322de4;});}return null;};}function removeEntity(_0x41d2db,_0x1607cb){return function(_0x2e66f7){if(_0x2e66f7){return _0x2e66f7[_0x174e('0x27')]()['then'](function(){_0x41d2db[_0x174e('0x1b')](0xcc)[_0x174e('0x1c')]();});}};}function handleEntityNotFound(_0x3d225b,_0x260e21){return function(_0x2e849c){if(!_0x2e849c){_0x3d225b[_0x174e('0x28')](0x194);}return _0x2e849c;};}function handleError(_0xdbb571,_0x5e39b8){_0x5e39b8=_0x5e39b8||0x1f4;return function(_0x5afde9){logger[_0x174e('0x29')](_0x5afde9[_0x174e('0x2a')]);if(_0x5afde9[_0x174e('0x2b')]){delete _0x5afde9[_0x174e('0x2b')];}_0xdbb571['status'](_0x5e39b8)[_0x174e('0x2c')](_0x5afde9);};}exports[_0x174e('0x2d')]=function(_0x1c4092,_0x2b7500){var _0x17f493={},_0x35474f={},_0x21c992={'count':0x0,'rows':[]};var _0x773ceb=_[_0x174e('0x2e')](db[_0x174e('0x2f')][_0x174e('0x30')],function(_0x522042){return{'name':_0x522042['fieldName'],'type':_0x522042[_0x174e('0x31')][_0x174e('0x32')]};});_0x35474f[_0x174e('0x33')]=_[_0x174e('0x2e')](_0x773ceb,'name');_0x35474f[_0x174e('0x34')]=_['keys'](_0x1c4092[_0x174e('0x34')]);_0x35474f[_0x174e('0x35')]=_['intersection'](_0x35474f[_0x174e('0x33')],_0x35474f['query']);_0x17f493[_0x174e('0x36')]=_[_0x174e('0x37')](_0x35474f[_0x174e('0x33')],qs[_0x174e('0x38')](_0x1c4092['query']['fields']));_0x17f493[_0x174e('0x36')]=_0x17f493[_0x174e('0x36')][_0x174e('0x39')]?_0x17f493[_0x174e('0x36')]:_0x35474f[_0x174e('0x33')];if(!_0x1c4092[_0x174e('0x34')][_0x174e('0x3a')]('nolimit')){_0x17f493[_0x174e('0x20')]=qs['limit'](_0x1c4092[_0x174e('0x34')]['limit']);_0x17f493['offset']=qs[_0x174e('0x1e')](_0x1c4092[_0x174e('0x34')][_0x174e('0x1e')]);}_0x17f493[_0x174e('0x3b')]=qs[_0x174e('0x3c')](_0x1c4092[_0x174e('0x34')][_0x174e('0x3c')]);_0x17f493[_0x174e('0x3d')]=qs[_0x174e('0x35')](_[_0x174e('0x3e')](_0x1c4092[_0x174e('0x34')],_0x35474f[_0x174e('0x35')]),_0x773ceb);if(_0x1c4092[_0x174e('0x34')][_0x174e('0x3f')]){_0x17f493[_0x174e('0x3d')]=_[_0x174e('0x40')](_0x17f493[_0x174e('0x3d')],{'$or':_[_0x174e('0x2e')](_0x773ceb,function(_0x3a24ec){if(_0x3a24ec['type']!==_0x174e('0x41')){var _0x544545={};_0x544545[_0x3a24ec[_0x174e('0x2b')]]={'$like':'%'+_0x1c4092[_0x174e('0x34')]['filter']+'%'};return _0x544545;}})});}_0x17f493=_['merge']({},_0x17f493,_0x1c4092[_0x174e('0x42')]);var _0x32167a={'where':_0x17f493[_0x174e('0x3d')]};return db['SalesforceAccount'][_0x174e('0x21')](_0x32167a)[_0x174e('0x26')](function(_0x19306a){_0x21c992[_0x174e('0x21')]=_0x19306a;if(_0x1c4092[_0x174e('0x34')][_0x174e('0x43')]){_0x17f493['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0x174e('0x44')](_0x17f493);})['then'](function(_0xf4c3e){_0x21c992['rows']=_0xf4c3e;return _0x21c992;})[_0x174e('0x26')](respondWithFilteredResult(_0x2b7500,_0x17f493))['catch'](handleError(_0x2b7500,null));};exports[_0x174e('0x45')]=function(_0xbc42aa,_0x1308c9){var _0x23b25a={'raw':![],'where':{'id':_0xbc42aa['params']['id']}},_0x2a80ea={};_0x2a80ea[_0x174e('0x33')]=_['keys'](db[_0x174e('0x2f')][_0x174e('0x30')]);_0x2a80ea['query']=_[_0x174e('0x46')](_0xbc42aa[_0x174e('0x34')]);_0x2a80ea[_0x174e('0x35')]=_[_0x174e('0x37')](_0x2a80ea[_0x174e('0x33')],_0x2a80ea[_0x174e('0x34')]);_0x23b25a[_0x174e('0x36')]=_[_0x174e('0x37')](_0x2a80ea['model'],qs[_0x174e('0x38')](_0xbc42aa[_0x174e('0x34')][_0x174e('0x38')]));_0x23b25a[_0x174e('0x36')]=_0x23b25a[_0x174e('0x36')][_0x174e('0x39')]?_0x23b25a[_0x174e('0x36')]:_0x2a80ea[_0x174e('0x33')];if(_0xbc42aa['query']['includeAll']){_0x23b25a[_0x174e('0x47')]=[{'all':!![]}];}_0x23b25a=_['merge']({},_0x23b25a,_0xbc42aa[_0x174e('0x42')]);return db[_0x174e('0x2f')][_0x174e('0x48')](_0x23b25a)['then'](handleEntityNotFound(_0x1308c9,null))['then'](respondWithResult(_0x1308c9,null))[_0x174e('0x49')](handleError(_0x1308c9,null));};exports['create']=function(_0x22f04e,_0x313ed1){return db[_0x174e('0x2f')][_0x174e('0x4a')](_0x22f04e['body'],{})[_0x174e('0x26')](respondWithResult(_0x313ed1,0xc9))['catch'](handleError(_0x313ed1,null));};exports[_0x174e('0x25')]=function(_0x23de5c,_0x1bc3bc){if(_0x23de5c[_0x174e('0x4b')]['id']){delete _0x23de5c['body']['id'];}return db[_0x174e('0x2f')]['find']({'where':{'id':_0x23de5c[_0x174e('0x4c')]['id']}})[_0x174e('0x26')](handleEntityNotFound(_0x1bc3bc,null))['then'](saveUpdates(_0x23de5c[_0x174e('0x4b')],null))[_0x174e('0x26')](respondWithResult(_0x1bc3bc,null))[_0x174e('0x49')](handleError(_0x1bc3bc,null));};exports['destroy']=function(_0x18ce4e,_0x11a9f2){return db[_0x174e('0x2f')]['find']({'where':{'id':_0x18ce4e[_0x174e('0x4c')]['id']}})[_0x174e('0x26')](handleEntityNotFound(_0x11a9f2,null))[_0x174e('0x26')](removeEntity(_0x11a9f2,null))['catch'](handleError(_0x11a9f2,null));};exports[_0x174e('0x4d')]=function(_0x5b1933,_0x41e2d4,_0x3717c4){var _0x6cd00b={};var _0xf61589={};var _0x1e7b2c;var _0x1a050f;return db[_0x174e('0x2f')][_0x174e('0x4e')]({'where':{'id':_0x5b1933[_0x174e('0x4c')]['id']}})[_0x174e('0x26')](handleEntityNotFound(_0x41e2d4,null))['then'](function(_0x1b8f7e){if(_0x1b8f7e){_0x1e7b2c=_0x1b8f7e;_0xf61589['model']=_[_0x174e('0x46')](db[_0x174e('0x4f')][_0x174e('0x30')]);_0xf61589[_0x174e('0x34')]=_[_0x174e('0x46')](_0x5b1933[_0x174e('0x34')]);_0xf61589[_0x174e('0x35')]=_[_0x174e('0x37')](_0xf61589[_0x174e('0x33')],_0xf61589[_0x174e('0x34')]);_0x6cd00b[_0x174e('0x36')]=_['intersection'](_0xf61589[_0x174e('0x33')],qs['fields'](_0x5b1933[_0x174e('0x34')][_0x174e('0x38')]));_0x6cd00b['attributes']=_0x6cd00b[_0x174e('0x36')][_0x174e('0x39')]?_0x6cd00b[_0x174e('0x36')]:_0xf61589[_0x174e('0x33')];_0x6cd00b[_0x174e('0x3b')]=qs[_0x174e('0x3c')](_0x5b1933['query'][_0x174e('0x3c')]);_0x6cd00b[_0x174e('0x3d')]=qs['filters'](_[_0x174e('0x3e')](_0x5b1933['query'],_0xf61589[_0x174e('0x35')]));if(_0x5b1933[_0x174e('0x34')]['filter']){_0x6cd00b['where']=_[_0x174e('0x40')](_0x6cd00b[_0x174e('0x3d')],{'$or':_[_0x174e('0x2e')](_0x6cd00b['attributes'],function(_0x5d6246){var _0x4f235d={};_0x4f235d[_0x5d6246]={'$like':'%'+_0x5b1933[_0x174e('0x34')]['filter']+'%'};return _0x4f235d;})});}_0x6cd00b=_[_0x174e('0x40')]({},_0x6cd00b,_0x5b1933[_0x174e('0x42')]);return _0x1e7b2c['getConfigurations'](_0x6cd00b);}})['then'](function(_0xb43c1a){if(_0xb43c1a){_0x1a050f=_0xb43c1a['length'];if(!_0x5b1933[_0x174e('0x34')][_0x174e('0x3a')](_0x174e('0x50'))){_0x6cd00b[_0x174e('0x20')]=qs['limit'](_0x5b1933['query'][_0x174e('0x20')]);_0x6cd00b['offset']=qs['offset'](_0x5b1933[_0x174e('0x34')][_0x174e('0x1e')]);}return _0x1e7b2c['getConfigurations'](_0x6cd00b);}})[_0x174e('0x26')](function(_0x5471cf){if(_0x5471cf){return _0x5471cf?{'count':_0x1a050f,'rows':_0x5471cf}:null;}})[_0x174e('0x26')](respondWithResult(_0x41e2d4,null))[_0x174e('0x49')](handleError(_0x41e2d4,null));};exports['addConfiguration']=function(_0x2e0938,_0x50d08e,_0x441585){if(_0x2e0938[_0x174e('0x4b')]['id']){delete _0x2e0938[_0x174e('0x4b')]['id'];}return db[_0x174e('0x2f')][_0x174e('0x4e')]({'where':{'id':_0x2e0938[_0x174e('0x4c')]['id']}})[_0x174e('0x26')](handleEntityNotFound(_0x50d08e,null))[_0x174e('0x26')](function(_0x239cff){if(_0x239cff){_0x2e0938[_0x174e('0x4b')]['AccountId']=_0x239cff['id'];_0x2e0938['body'][_0x174e('0x51')]=integrations[_0x174e('0x52')](_0x2e0938[_0x174e('0x4b')][_0x174e('0x53')],_0x2e0938[_0x174e('0x4b')][_0x174e('0x31')]);_0x2e0938[_0x174e('0x4b')]['Descriptions']=integrations[_0x174e('0x54')](_0x2e0938['body'][_0x174e('0x53')],_0x2e0938['body'][_0x174e('0x31')]);return db['SalesforceConfiguration'][_0x174e('0x4a')](_0x2e0938[_0x174e('0x4b')],{'include':[{'model':db[_0x174e('0x55')],'as':_0x174e('0x51')},{'model':db[_0x174e('0x55')],'as':_0x174e('0x56')}]});}return null;})[_0x174e('0x26')](respondWithResult(_0x50d08e,null))[_0x174e('0x49')](handleError(_0x50d08e,null));};exports['getFields']=function(_0x4e5b38,_0x1cbb55,_0x584ee7){var _0x2ac003;var _0x430af1='';var _0x19a60e=_0x174e('0x57');return db[_0x174e('0x2f')]['findOne']({'where':{'id':_0x4e5b38[_0x174e('0x4c')]['id']},'attributes':['id',_0x174e('0x58'),'clientId',_0x174e('0x59'),'username','password',_0x174e('0x5a')]})[_0x174e('0x26')](handleEntityNotFound(_0x1cbb55,null))['then'](function(_0xedde57){if(_0xedde57){_0x430af1=_0xedde57[_0x174e('0x58')];var _0x570982=_0x430af1[_0x174e('0x5b')](-0x1);if(_0x570982==='/'){_0x430af1=_0x430af1[_0x174e('0x5c')](0x0,_0x430af1['lastIndexOf'](_0x570982));}_0x2ac003=new jsforce[(_0x174e('0x5d'))]({'oauth2':{'loginUrl':_0x430af1,'clientId':_0xedde57[_0x174e('0x5e')],'clientSecret':_0xedde57[_0x174e('0x59')]}});return _0x2ac003[_0x174e('0x5f')](_0xedde57['username'],_0xedde57[_0x174e('0x60')]['concat'](_0xedde57[_0x174e('0x5a')]));}})[_0x174e('0x26')](function(_0x3994d0){if(_0x3994d0){if(!_[_0x174e('0x61')](_0x4e5b38[_0x174e('0x34')][_0x174e('0x62')])){_0x19a60e=_0x4e5b38['query'][_0x174e('0x62')];}return _0x2ac003[_0x174e('0x63')](_0x19a60e)[_0x174e('0x64')]();}})[_0x174e('0x26')](function(_0x5617f7){var _0x373753=[_0x174e('0x65'),_0x174e('0x66'),'IsReminderSet',_0x174e('0x67'),_0x174e('0x68'),_0x174e('0x69')];var _0x4ff766=[_0x174e('0x6a'),_0x174e('0x6b'),_0x174e('0x6c'),_0x174e('0x6d'),'email',_0x174e('0x6e'),'phone'];if(_0x5617f7){_['remove'](_0x5617f7[_0x174e('0x38')],function(_0x13d016){return _0x373753[_0x174e('0x6f')](_0x13d016[_0x174e('0x2b')])||!_0x4ff766[_0x174e('0x6f')](_0x13d016['type']);});return{'count':_0x5617f7[_0x174e('0x38')][_0x174e('0x39')],'rows':_[_0x174e('0x2e')](_0x5617f7[_0x174e('0x38')],function(_0x41445b){return{'id':_0x41445b['name'],'name':_0x41445b['label'],'custom':_0x41445b['custom'],'options':_0x41445b[_0x174e('0x70')][_0x174e('0x39')]>0x0?_[_0x174e('0x2e')](_0x41445b[_0x174e('0x70')],function(_0x4bfcd1){return{'name':_0x4bfcd1['label'],'value':_0x4bfcd1[_0x174e('0x71')]};}):_0x41445b[_0x174e('0x31')]=='boolean'?[{'name':'True','value':_0x174e('0x72')},{'name':_0x174e('0x73'),'value':_0x174e('0x74')}]:[]};})};}})[_0x174e('0x26')](respondWithResult(_0x1cbb55,null))[_0x174e('0x49')](function(_0x238170){var _0x55fdc6=_0x4e5b38['query'][_0x174e('0x75')]?0x1f4:_0x238170[_0x174e('0x76')]||0x1f4;logger[_0x174e('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0x174e('0x77'),_0x55fdc6,JSON['stringify'](_0x238170));delete _0x238170['name'];if(_0x55fdc6===0x191){_0x55fdc6=0x190;}_0x1cbb55[_0x174e('0x1b')](_0x55fdc6)[_0x174e('0x2c')](_0x4e5b38[_0x174e('0x34')][_0x174e('0x75')]?{'message':_0x174e('0x78'),'statusCode':_0x238170[_0x174e('0x76')]}:_0x238170);});}; \ No newline at end of file +var _0x1c4b=['catch','show','params','keys','rawAttributes','options','find','create','body','getConfigurations','findOne','SalesforceConfiguration','order','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','ticketType','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','phone','remove','includes','label','custom','picklistValues','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','SalesforceAccount','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x399095,_0x133dae){var _0x40a046=function(_0x1e6803){while(--_0x1e6803){_0x399095['push'](_0x399095['shift']());}};_0x40a046(++_0x133dae);}(_0x1c4b,0x1a8));var _0xb1c4=function(_0x2f926c,_0x5a3690){_0x2f926c=_0x2f926c-0x0;var _0x165430=_0x1c4b[_0x2f926c];return _0x165430;};'use strict';var emlformat=require(_0xb1c4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb1c4('0x1'));var rp=require(_0xb1c4('0x2'));var moment=require(_0xb1c4('0x3'));var BPromise=require(_0xb1c4('0x4'));var Mustache=require(_0xb1c4('0x5'));var util=require(_0xb1c4('0x6'));var path=require(_0xb1c4('0x7'));var sox=require(_0xb1c4('0x8'));var csv=require(_0xb1c4('0x9'));var ejs=require(_0xb1c4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb1c4('0xb'));var squel=require(_0xb1c4('0xc'));var crypto=require(_0xb1c4('0xd'));var jsforce=require(_0xb1c4('0xe'));var deskjs=require(_0xb1c4('0xf'));var toCsv=require(_0xb1c4('0x9'));var querystring=require(_0xb1c4('0x10'));var Papa=require('papaparse');var Redis=require(_0xb1c4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb1c4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb1c4('0x13'));var logger=require(_0xb1c4('0x14'))(_0xb1c4('0x15'));var utils=require(_0xb1c4('0x16'));var config=require(_0xb1c4('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xb1c4('0x18'));function respondWithStatusCode(_0x15cea7,_0x1339ba){_0x1339ba=_0x1339ba||0xcc;return function(_0x3d2f6a){if(_0x3d2f6a){return _0x15cea7['sendStatus'](_0x1339ba);}return _0x15cea7[_0xb1c4('0x19')](_0x1339ba)[_0xb1c4('0x1a')]();};}function respondWithResult(_0x4e9112,_0x1bd57e){_0x1bd57e=_0x1bd57e||0xc8;return function(_0x18856d){if(_0x18856d){return _0x4e9112[_0xb1c4('0x19')](_0x1bd57e)[_0xb1c4('0x1b')](_0x18856d);}};}function respondWithFilteredResult(_0x21149e,_0xf858ac){return function(_0x290143){if(_0x290143){var _0x1c21dd=typeof _0xf858ac['offset']===_0xb1c4('0x1c')&&typeof _0xf858ac[_0xb1c4('0x1d')]===_0xb1c4('0x1c');var _0x393c2c=_0x290143['count'];var _0x1be71f=_0x1c21dd?0x0:_0xf858ac[_0xb1c4('0x1e')];var _0x17b995=_0x1c21dd?_0x290143[_0xb1c4('0x1f')]:_0xf858ac[_0xb1c4('0x1e')]+_0xf858ac[_0xb1c4('0x1d')];var _0x38ccba;if(_0x17b995>=_0x393c2c){_0x17b995=_0x393c2c;_0x38ccba=0xc8;}else{_0x38ccba=0xce;}_0x21149e['status'](_0x38ccba);return _0x21149e[_0xb1c4('0x20')](_0xb1c4('0x21'),_0x1be71f+'-'+_0x17b995+'/'+_0x393c2c)[_0xb1c4('0x1b')](_0x290143);}return null;};}function patchUpdates(_0x4da15d){return function(_0x5cab46){try{jsonpatch[_0xb1c4('0x22')](_0x5cab46,_0x4da15d,!![]);}catch(_0x1b4c76){return BPromise[_0xb1c4('0x23')](_0x1b4c76);}return _0x5cab46['save']();};}function saveUpdates(_0x4474b6,_0x82ad1e){return function(_0x47b509){if(_0x47b509){return _0x47b509[_0xb1c4('0x24')](_0x4474b6)[_0xb1c4('0x25')](function(_0x130ef6){return _0x130ef6;});}return null;};}function removeEntity(_0x16e1b6,_0x4c6aeb){return function(_0xf6481f){if(_0xf6481f){return _0xf6481f[_0xb1c4('0x26')]()[_0xb1c4('0x25')](function(){_0x16e1b6[_0xb1c4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19f99e,_0x1acfd1){return function(_0xf74f0f){if(!_0xf74f0f){_0x19f99e[_0xb1c4('0x27')](0x194);}return _0xf74f0f;};}function handleError(_0x28248c,_0x20fc93){_0x20fc93=_0x20fc93||0x1f4;return function(_0x8d06d6){logger[_0xb1c4('0x28')](_0x8d06d6['stack']);if(_0x8d06d6[_0xb1c4('0x29')]){delete _0x8d06d6['name'];}_0x28248c[_0xb1c4('0x19')](_0x20fc93)[_0xb1c4('0x2a')](_0x8d06d6);};}exports['index']=function(_0x1bc2a9,_0x427faa){var _0x32c4e8={},_0x128389={},_0x5b74f1={'count':0x0,'rows':[]};var _0x44f641=_['map'](db[_0xb1c4('0x2b')]['rawAttributes'],function(_0x5be1dd){return{'name':_0x5be1dd['fieldName'],'type':_0x5be1dd[_0xb1c4('0x2c')][_0xb1c4('0x2d')]};});_0x128389[_0xb1c4('0x2e')]=_['map'](_0x44f641,'name');_0x128389[_0xb1c4('0x2f')]=_['keys'](_0x1bc2a9[_0xb1c4('0x2f')]);_0x128389[_0xb1c4('0x30')]=_[_0xb1c4('0x31')](_0x128389['model'],_0x128389['query']);_0x32c4e8['attributes']=_['intersection'](_0x128389[_0xb1c4('0x2e')],qs['fields'](_0x1bc2a9[_0xb1c4('0x2f')][_0xb1c4('0x32')]));_0x32c4e8[_0xb1c4('0x33')]=_0x32c4e8[_0xb1c4('0x33')][_0xb1c4('0x34')]?_0x32c4e8[_0xb1c4('0x33')]:_0x128389[_0xb1c4('0x2e')];if(!_0x1bc2a9[_0xb1c4('0x2f')]['hasOwnProperty'](_0xb1c4('0x35'))){_0x32c4e8['limit']=qs[_0xb1c4('0x1d')](_0x1bc2a9[_0xb1c4('0x2f')][_0xb1c4('0x1d')]);_0x32c4e8[_0xb1c4('0x1e')]=qs['offset'](_0x1bc2a9[_0xb1c4('0x2f')][_0xb1c4('0x1e')]);}_0x32c4e8['order']=qs[_0xb1c4('0x36')](_0x1bc2a9[_0xb1c4('0x2f')]['sort']);_0x32c4e8[_0xb1c4('0x37')]=qs['filters'](_['pick'](_0x1bc2a9[_0xb1c4('0x2f')],_0x128389['filters']),_0x44f641);if(_0x1bc2a9['query'][_0xb1c4('0x38')]){_0x32c4e8[_0xb1c4('0x37')]=_[_0xb1c4('0x39')](_0x32c4e8[_0xb1c4('0x37')],{'$or':_[_0xb1c4('0x3a')](_0x44f641,function(_0x23eb42){if(_0x23eb42[_0xb1c4('0x2c')]!==_0xb1c4('0x3b')){var _0x1bb5ea={};_0x1bb5ea[_0x23eb42['name']]={'$like':'%'+_0x1bc2a9[_0xb1c4('0x2f')]['filter']+'%'};return _0x1bb5ea;}})});}_0x32c4e8=_[_0xb1c4('0x39')]({},_0x32c4e8,_0x1bc2a9['options']);var _0x220893={'where':_0x32c4e8[_0xb1c4('0x37')]};return db[_0xb1c4('0x2b')][_0xb1c4('0x1f')](_0x220893)['then'](function(_0x117e95){_0x5b74f1['count']=_0x117e95;if(_0x1bc2a9[_0xb1c4('0x2f')][_0xb1c4('0x3c')]){_0x32c4e8[_0xb1c4('0x3d')]=[{'all':!![]}];}return db[_0xb1c4('0x2b')][_0xb1c4('0x3e')](_0x32c4e8);})[_0xb1c4('0x25')](function(_0xe4185d){_0x5b74f1[_0xb1c4('0x3f')]=_0xe4185d;return _0x5b74f1;})[_0xb1c4('0x25')](respondWithFilteredResult(_0x427faa,_0x32c4e8))[_0xb1c4('0x40')](handleError(_0x427faa,null));};exports[_0xb1c4('0x41')]=function(_0x86c15,_0x332443){var _0x22d5f6={'raw':![],'where':{'id':_0x86c15[_0xb1c4('0x42')]['id']}},_0x40c4c4={};_0x40c4c4['model']=_[_0xb1c4('0x43')](db[_0xb1c4('0x2b')][_0xb1c4('0x44')]);_0x40c4c4[_0xb1c4('0x2f')]=_['keys'](_0x86c15[_0xb1c4('0x2f')]);_0x40c4c4[_0xb1c4('0x30')]=_[_0xb1c4('0x31')](_0x40c4c4['model'],_0x40c4c4['query']);_0x22d5f6[_0xb1c4('0x33')]=_[_0xb1c4('0x31')](_0x40c4c4[_0xb1c4('0x2e')],qs['fields'](_0x86c15[_0xb1c4('0x2f')][_0xb1c4('0x32')]));_0x22d5f6[_0xb1c4('0x33')]=_0x22d5f6['attributes']['length']?_0x22d5f6[_0xb1c4('0x33')]:_0x40c4c4['model'];if(_0x86c15['query'][_0xb1c4('0x3c')]){_0x22d5f6['include']=[{'all':!![]}];}_0x22d5f6=_['merge']({},_0x22d5f6,_0x86c15[_0xb1c4('0x45')]);return db[_0xb1c4('0x2b')][_0xb1c4('0x46')](_0x22d5f6)[_0xb1c4('0x25')](handleEntityNotFound(_0x332443,null))[_0xb1c4('0x25')](respondWithResult(_0x332443,null))[_0xb1c4('0x40')](handleError(_0x332443,null));};exports['create']=function(_0x2f1e1c,_0x87b8ba){return db[_0xb1c4('0x2b')][_0xb1c4('0x47')](_0x2f1e1c[_0xb1c4('0x48')],{})[_0xb1c4('0x25')](respondWithResult(_0x87b8ba,0xc9))[_0xb1c4('0x40')](handleError(_0x87b8ba,null));};exports['update']=function(_0x51a225,_0x463861){if(_0x51a225[_0xb1c4('0x48')]['id']){delete _0x51a225[_0xb1c4('0x48')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x51a225[_0xb1c4('0x42')]['id']}})[_0xb1c4('0x25')](handleEntityNotFound(_0x463861,null))[_0xb1c4('0x25')](saveUpdates(_0x51a225[_0xb1c4('0x48')],null))['then'](respondWithResult(_0x463861,null))[_0xb1c4('0x40')](handleError(_0x463861,null));};exports[_0xb1c4('0x26')]=function(_0x50f3ff,_0x103fa5){return db['SalesforceAccount'][_0xb1c4('0x46')]({'where':{'id':_0x50f3ff[_0xb1c4('0x42')]['id']}})['then'](handleEntityNotFound(_0x103fa5,null))['then'](removeEntity(_0x103fa5,null))[_0xb1c4('0x40')](handleError(_0x103fa5,null));};exports[_0xb1c4('0x49')]=function(_0x223168,_0x1804be,_0x405328){var _0x33fec3={};var _0xf78c09={};var _0x3f5d71;var _0x3370a5;return db['SalesforceAccount'][_0xb1c4('0x4a')]({'where':{'id':_0x223168[_0xb1c4('0x42')]['id']}})[_0xb1c4('0x25')](handleEntityNotFound(_0x1804be,null))[_0xb1c4('0x25')](function(_0x165702){if(_0x165702){_0x3f5d71=_0x165702;_0xf78c09['model']=_['keys'](db[_0xb1c4('0x4b')][_0xb1c4('0x44')]);_0xf78c09[_0xb1c4('0x2f')]=_['keys'](_0x223168[_0xb1c4('0x2f')]);_0xf78c09[_0xb1c4('0x30')]=_['intersection'](_0xf78c09[_0xb1c4('0x2e')],_0xf78c09[_0xb1c4('0x2f')]);_0x33fec3[_0xb1c4('0x33')]=_[_0xb1c4('0x31')](_0xf78c09[_0xb1c4('0x2e')],qs[_0xb1c4('0x32')](_0x223168['query']['fields']));_0x33fec3[_0xb1c4('0x33')]=_0x33fec3['attributes'][_0xb1c4('0x34')]?_0x33fec3[_0xb1c4('0x33')]:_0xf78c09[_0xb1c4('0x2e')];_0x33fec3[_0xb1c4('0x4c')]=qs[_0xb1c4('0x36')](_0x223168[_0xb1c4('0x2f')]['sort']);_0x33fec3[_0xb1c4('0x37')]=qs[_0xb1c4('0x30')](_['pick'](_0x223168[_0xb1c4('0x2f')],_0xf78c09[_0xb1c4('0x30')]));if(_0x223168[_0xb1c4('0x2f')][_0xb1c4('0x38')]){_0x33fec3['where']=_['merge'](_0x33fec3[_0xb1c4('0x37')],{'$or':_['map'](_0x33fec3[_0xb1c4('0x33')],function(_0x1342ca){var _0x5a0f92={};_0x5a0f92[_0x1342ca]={'$like':'%'+_0x223168[_0xb1c4('0x2f')][_0xb1c4('0x38')]+'%'};return _0x5a0f92;})});}_0x33fec3=_[_0xb1c4('0x39')]({},_0x33fec3,_0x223168[_0xb1c4('0x45')]);return _0x3f5d71['getConfigurations'](_0x33fec3);}})['then'](function(_0x340b73){if(_0x340b73){_0x3370a5=_0x340b73['length'];if(!_0x223168[_0xb1c4('0x2f')][_0xb1c4('0x4d')](_0xb1c4('0x35'))){_0x33fec3['limit']=qs['limit'](_0x223168[_0xb1c4('0x2f')][_0xb1c4('0x1d')]);_0x33fec3['offset']=qs[_0xb1c4('0x1e')](_0x223168['query'][_0xb1c4('0x1e')]);}return _0x3f5d71[_0xb1c4('0x49')](_0x33fec3);}})[_0xb1c4('0x25')](function(_0x2a8290){if(_0x2a8290){return _0x2a8290?{'count':_0x3370a5,'rows':_0x2a8290}:null;}})[_0xb1c4('0x25')](respondWithResult(_0x1804be,null))[_0xb1c4('0x40')](handleError(_0x1804be,null));};exports[_0xb1c4('0x4e')]=function(_0x57ae37,_0x63e6a7,_0x3a0ec0){if(_0x57ae37[_0xb1c4('0x48')]['id']){delete _0x57ae37['body']['id'];}return db['SalesforceAccount'][_0xb1c4('0x4a')]({'where':{'id':_0x57ae37['params']['id']}})['then'](handleEntityNotFound(_0x63e6a7,null))[_0xb1c4('0x25')](function(_0x151383){if(_0x151383){_0x57ae37[_0xb1c4('0x48')]['AccountId']=_0x151383['id'];_0x57ae37[_0xb1c4('0x48')][_0xb1c4('0x4f')]=integrations[_0xb1c4('0x50')](_0x57ae37[_0xb1c4('0x48')][_0xb1c4('0x51')],_0x57ae37[_0xb1c4('0x48')][_0xb1c4('0x2c')]);_0x57ae37[_0xb1c4('0x48')][_0xb1c4('0x52')]=integrations['getDescriptions'](_0x57ae37['body']['channel'],_0x57ae37[_0xb1c4('0x48')][_0xb1c4('0x2c')]);return db[_0xb1c4('0x4b')][_0xb1c4('0x47')](_0x57ae37[_0xb1c4('0x48')],{'include':[{'model':db[_0xb1c4('0x53')],'as':_0xb1c4('0x4f')},{'model':db[_0xb1c4('0x53')],'as':_0xb1c4('0x52')}]});}return null;})[_0xb1c4('0x25')](respondWithResult(_0x63e6a7,null))[_0xb1c4('0x40')](handleError(_0x63e6a7,null));};exports[_0xb1c4('0x54')]=function(_0x5b03b0,_0x1082b1,_0x845657){var _0x23e7e7;var _0x59a57f='';var _0x46b7a6=_0xb1c4('0x55');return db['SalesforceAccount'][_0xb1c4('0x4a')]({'where':{'id':_0x5b03b0[_0xb1c4('0x42')]['id']},'attributes':['id',_0xb1c4('0x56'),_0xb1c4('0x57'),_0xb1c4('0x58'),_0xb1c4('0x59'),_0xb1c4('0x5a'),_0xb1c4('0x5b')]})['then'](handleEntityNotFound(_0x1082b1,null))[_0xb1c4('0x25')](function(_0x1d54b8){if(_0x1d54b8){_0x59a57f=_0x1d54b8[_0xb1c4('0x56')];var _0x58c299=_0x59a57f[_0xb1c4('0x5c')](-0x1);if(_0x58c299==='/'){_0x59a57f=_0x59a57f[_0xb1c4('0x5d')](0x0,_0x59a57f[_0xb1c4('0x5e')](_0x58c299));}_0x23e7e7=new jsforce[(_0xb1c4('0x5f'))]({'oauth2':{'loginUrl':_0x59a57f,'clientId':_0x1d54b8[_0xb1c4('0x57')],'clientSecret':_0x1d54b8[_0xb1c4('0x58')]}});return _0x23e7e7[_0xb1c4('0x60')](_0x1d54b8[_0xb1c4('0x59')],_0x1d54b8[_0xb1c4('0x5a')][_0xb1c4('0x61')](_0x1d54b8[_0xb1c4('0x5b')]));}})['then'](function(_0x58c690){if(_0x58c690){if(!_['isNil'](_0x5b03b0[_0xb1c4('0x2f')][_0xb1c4('0x62')])){_0x46b7a6=_0x5b03b0[_0xb1c4('0x2f')][_0xb1c4('0x62')];}return _0x23e7e7['sobject'](_0x46b7a6)['describe']();}})['then'](function(_0x5e825e){var _0x4cf58e=['OwnerId',_0xb1c4('0x63'),_0xb1c4('0x64'),_0xb1c4('0x65'),_0xb1c4('0x66'),_0xb1c4('0x67')];var _0x5f0018=[_0xb1c4('0x68'),_0xb1c4('0x69'),_0xb1c4('0x6a'),_0xb1c4('0x6b'),'email','textarea',_0xb1c4('0x6c')];if(_0x5e825e){_[_0xb1c4('0x6d')](_0x5e825e[_0xb1c4('0x32')],function(_0x184bc3){return _0x4cf58e[_0xb1c4('0x6e')](_0x184bc3['name'])||!_0x5f0018[_0xb1c4('0x6e')](_0x184bc3[_0xb1c4('0x2c')]);});return{'count':_0x5e825e[_0xb1c4('0x32')][_0xb1c4('0x34')],'rows':_[_0xb1c4('0x3a')](_0x5e825e[_0xb1c4('0x32')],function(_0x42ed4a){return{'id':_0x42ed4a[_0xb1c4('0x29')],'name':_0x42ed4a[_0xb1c4('0x6f')],'custom':_0x42ed4a[_0xb1c4('0x70')],'options':_0x42ed4a[_0xb1c4('0x71')]['length']>0x0?_[_0xb1c4('0x3a')](_0x42ed4a[_0xb1c4('0x71')],function(_0x27252a){return{'name':_0x27252a[_0xb1c4('0x6f')],'value':_0x27252a['value']};}):_0x42ed4a['type']=='boolean'?[{'name':_0xb1c4('0x72'),'value':_0xb1c4('0x73')},{'name':_0xb1c4('0x74'),'value':_0xb1c4('0x75')}]:[]};})};}})['then'](respondWithResult(_0x1082b1,null))[_0xb1c4('0x40')](function(_0x49d70f){var _0xe62a5f=_0x5b03b0[_0xb1c4('0x2f')]['test']?0x1f4:_0x49d70f[_0xb1c4('0x76')]||0x1f4;logger['error'](_0xb1c4('0x77'),'getFields',_0xe62a5f,JSON[_0xb1c4('0x78')](_0x49d70f));delete _0x49d70f[_0xb1c4('0x29')];if(_0xe62a5f===0x191){_0xe62a5f=0x190;}_0x1082b1['status'](_0xe62a5f)[_0xb1c4('0x2a')](_0x5b03b0[_0xb1c4('0x2f')]['test']?{'message':_0xb1c4('0x79'),'statusCode':_0x49d70f[_0xb1c4('0x76')]}:_0x49d70f);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index ff1a361..7723491 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 _0xbf5c=['../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x348d84,_0x366b92){_0x348d84=_0x348d84-0x0;var _0x4e3893=_0xbf5c[_0x348d84];return _0x4e3893;};'use strict';var _=require(_0xcbf5('0x0'));var util=require(_0xcbf5('0x1'));var logger=require(_0xcbf5('0x2'))('api');var moment=require(_0xcbf5('0x3'));var BPromise=require(_0xcbf5('0x4'));var rp=require(_0xcbf5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbf5('0x6'));var config=require(_0xcbf5('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xcbf5('0x8'));module[_0xcbf5('0x9')]=function(_0x43f28d,_0x522014){return _0x43f28d[_0xcbf5('0xa')](_0xcbf5('0xb'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x949d=['SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','exports'];(function(_0x454e6d,_0x1e1f38){var _0x4bc294=function(_0x2c803a){while(--_0x2c803a){_0x454e6d['push'](_0x454e6d['shift']());}};_0x4bc294(++_0x1e1f38);}(_0x949d,0x162));var _0xd949=function(_0x54c3d2,_0x5c4b98){_0x54c3d2=_0x54c3d2-0x0;var _0x3dafac=_0x949d[_0x54c3d2];return _0x3dafac;};'use strict';var _=require(_0xd949('0x0'));var util=require(_0xd949('0x1'));var logger=require(_0xd949('0x2'))(_0xd949('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd949('0x4'));var fs=require('fs');var path=require(_0xd949('0x5'));var rimraf=require('rimraf');var config=require(_0xd949('0x6'));var attributes=require(_0xd949('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xd949('0x8')]=function(_0x416d5e,_0x6e8175){return _0x416d5e['define'](_0xd949('0x9'),attributes,{'tableName':_0xd949('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 56bdb19..85bf68d 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 _0xe659=['../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','SalesforceAccount,\x20%s,\x20%s','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','include','model','map','debug','catch','ShowSalesforceAccount','find','raw','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x5511be,_0x54ab66){var _0x186fce=function(_0x52510d){while(--_0x52510d){_0x5511be['push'](_0x5511be['shift']());}};_0x186fce(++_0x54ab66);}(_0xe659,0x159));var _0x9e65=function(_0x40b645,_0x12ab5b){_0x40b645=_0x40b645-0x0;var _0x23cf9e=_0xe659[_0x40b645];return _0x23cf9e;};'use strict';var _=require(_0x9e65('0x0'));var util=require('util');var moment=require(_0x9e65('0x1'));var BPromise=require(_0x9e65('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e65('0x3'));var db=require(_0x9e65('0x4'))['db'];var utils=require(_0x9e65('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9e65('0x6'));var jayson=require(_0x9e65('0x7'));var client=jayson[_0x9e65('0x8')][_0x9e65('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x108e03,_0x4bd603,_0x808604){return new BPromise(function(_0x56cc89,_0x257934){return client[_0x9e65('0xa')](_0x108e03,_0x808604)[_0x9e65('0xb')](function(_0x2e945e){logger[_0x9e65('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x4bd603,_0x9e65('0xd'));logger['debug'](_0x9e65('0xe'),_0x4bd603,_0x9e65('0xd'),JSON[_0x9e65('0xf')](_0x2e945e));if(_0x2e945e['error']){if(_0x2e945e['error']['code']===0x1f4){logger[_0x9e65('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x4bd603,_0x2e945e[_0x9e65('0x10')][_0x9e65('0x11')]);return _0x257934(_0x2e945e[_0x9e65('0x10')][_0x9e65('0x11')]);}logger[_0x9e65('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x4bd603,_0x2e945e['error'][_0x9e65('0x11')]);return _0x56cc89(_0x2e945e[_0x9e65('0x10')][_0x9e65('0x11')]);}else{logger[_0x9e65('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x4bd603,_0x9e65('0xd'));_0x56cc89(_0x2e945e[_0x9e65('0x12')][_0x9e65('0x11')]);}})['catch'](function(_0x592363){logger[_0x9e65('0x10')](_0x9e65('0x13'),_0x4bd603,_0x592363);_0x257934(_0x592363);});});}exports[_0x9e65('0x14')]=function(_0x3fe39c){var _0x9048fc=this;return new Promise(function(_0x27f95e,_0x374e30){return db[_0x9e65('0x15')][_0x9e65('0x16')]({'raw':_0x3fe39c['options']?_0x3fe39c['options']['raw']===undefined?!![]:![]:!![],'where':_0x3fe39c[_0x9e65('0x17')]?_0x3fe39c[_0x9e65('0x17')][_0x9e65('0x18')]||null:null,'attributes':_0x3fe39c[_0x9e65('0x17')]?_0x3fe39c[_0x9e65('0x17')][_0x9e65('0x19')]||null:null,'limit':_0x3fe39c[_0x9e65('0x17')]?_0x3fe39c[_0x9e65('0x17')][_0x9e65('0x1a')]||null:null,'include':_0x3fe39c[_0x9e65('0x17')]?_0x3fe39c[_0x9e65('0x17')]['include']?_['map'](_0x3fe39c['options'][_0x9e65('0x1b')],function(_0x475f22){return{'model':db[_0x475f22[_0x9e65('0x1c')]],'as':_0x475f22['as'],'attributes':_0x475f22[_0x9e65('0x19')],'include':_0x475f22[_0x9e65('0x1b')]?_[_0x9e65('0x1d')](_0x475f22[_0x9e65('0x1b')],function(_0x5275c7){return{'model':db[_0x5275c7[_0x9e65('0x1c')]],'as':_0x5275c7['as'],'attributes':_0x5275c7['attributes'],'include':_0x5275c7['include']?_[_0x9e65('0x1d')](_0x5275c7[_0x9e65('0x1b')],function(_0x4b1e4e){return{'model':db[_0x4b1e4e[_0x9e65('0x1c')]],'as':_0x4b1e4e['as'],'attributes':_0x4b1e4e['attributes']};}):[]};}):[]};}):[]:[]})[_0x9e65('0xb')](function(_0x401b5f){logger['info'](_0x9e65('0x14'),_0x3fe39c);logger[_0x9e65('0x1e')](_0x9e65('0x14'),_0x3fe39c,JSON[_0x9e65('0xf')](_0x401b5f));_0x27f95e(_0x401b5f);})[_0x9e65('0x1f')](function(_0x231bf9){logger[_0x9e65('0x10')](_0x9e65('0x14'),_0x231bf9[_0x9e65('0x11')],_0x3fe39c);_0x374e30(_0x9048fc['error'](0x1f4,_0x231bf9[_0x9e65('0x11')]));});});};exports[_0x9e65('0x20')]=function(_0x55ea97){var _0x48c16d=this;return new Promise(function(_0x3f844b,_0x3a7361){return db['SalesforceAccount'][_0x9e65('0x21')]({'raw':_0x55ea97['options']?_0x55ea97[_0x9e65('0x17')][_0x9e65('0x22')]===undefined?!![]:![]:!![],'where':_0x55ea97[_0x9e65('0x17')]?_0x55ea97[_0x9e65('0x17')][_0x9e65('0x18')]||null:null,'attributes':_0x55ea97[_0x9e65('0x17')]?_0x55ea97['options']['attributes']||null:null,'include':_0x55ea97[_0x9e65('0x17')]?_0x55ea97[_0x9e65('0x17')][_0x9e65('0x1b')]?_['map'](_0x55ea97[_0x9e65('0x17')]['include'],function(_0x4d06da){return{'model':db[_0x4d06da[_0x9e65('0x1c')]],'as':_0x4d06da['as'],'attributes':_0x4d06da[_0x9e65('0x19')],'include':_0x4d06da['include']?_['map'](_0x4d06da[_0x9e65('0x1b')],function(_0x41b503){return{'model':db[_0x41b503[_0x9e65('0x1c')]],'as':_0x41b503['as'],'attributes':_0x41b503['attributes'],'include':_0x41b503['include']?_['map'](_0x41b503[_0x9e65('0x1b')],function(_0x92fd58){return{'model':db[_0x92fd58[_0x9e65('0x1c')]],'as':_0x92fd58['as'],'attributes':_0x92fd58[_0x9e65('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9e65('0xb')](function(_0x43e78d){logger[_0x9e65('0xc')](_0x9e65('0x20'),_0x55ea97);logger[_0x9e65('0x1e')]('ShowSalesforceAccount',_0x55ea97,JSON[_0x9e65('0xf')](_0x43e78d));_0x3f844b(_0x43e78d);})['catch'](function(_0x2d0156){logger['error'](_0x9e65('0x20'),_0x2d0156[_0x9e65('0x11')],_0x55ea97);_0x3a7361(_0x48c16d[_0x9e65('0x10')](0x1f4,_0x2d0156[_0x9e65('0x11')]));});});}; \ No newline at end of file +var _0x54b0=['map','model','ShowSalesforceAccount','find','where','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSalesforceAccount','options','raw','include','attributes'];(function(_0x5f30f7,_0x1f2f46){var _0x1208df=function(_0x3c2ae8){while(--_0x3c2ae8){_0x5f30f7['push'](_0x5f30f7['shift']());}};_0x1208df(++_0x1f2f46);}(_0x54b0,0xd2));var _0x054b=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x54b0[_0x3207aa];return _0x51758f;};'use strict';var _=require(_0x054b('0x0'));var util=require(_0x054b('0x1'));var moment=require(_0x054b('0x2'));var BPromise=require(_0x054b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x054b('0x4'));var db=require(_0x054b('0x5'))['db'];var utils=require(_0x054b('0x6'));var logger=require(_0x054b('0x7'))(_0x054b('0x8'));var config=require(_0x054b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x054b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ece76,_0x122275,_0x53da57){return new BPromise(function(_0x451916,_0x4b9dd4){return client[_0x054b('0xb')](_0x2ece76,_0x53da57)['then'](function(_0x5abcd0){logger[_0x054b('0xc')](_0x054b('0xd'),_0x122275,'request\x20sent');logger[_0x054b('0xe')](_0x054b('0xf'),_0x122275,_0x054b('0x10'),JSON[_0x054b('0x11')](_0x5abcd0));if(_0x5abcd0['error']){if(_0x5abcd0[_0x054b('0x12')][_0x054b('0x13')]===0x1f4){logger['error'](_0x054b('0xd'),_0x122275,_0x5abcd0[_0x054b('0x12')]['message']);return _0x4b9dd4(_0x5abcd0[_0x054b('0x12')][_0x054b('0x14')]);}logger[_0x054b('0x12')](_0x054b('0xd'),_0x122275,_0x5abcd0[_0x054b('0x12')][_0x054b('0x14')]);return _0x451916(_0x5abcd0[_0x054b('0x12')][_0x054b('0x14')]);}else{logger['info'](_0x054b('0xd'),_0x122275,'request\x20sent');_0x451916(_0x5abcd0[_0x054b('0x15')][_0x054b('0x14')]);}})[_0x054b('0x16')](function(_0x55caf9){logger['error'](_0x054b('0xd'),_0x122275,_0x55caf9);_0x4b9dd4(_0x55caf9);});});}exports[_0x054b('0x17')]=function(_0x1c19b5){var _0x4ffd57=this;return new Promise(function(_0xa59be3,_0x2479b0){return db['SalesforceAccount']['findAll']({'raw':_0x1c19b5[_0x054b('0x18')]?_0x1c19b5['options'][_0x054b('0x19')]===undefined?!![]:![]:!![],'where':_0x1c19b5[_0x054b('0x18')]?_0x1c19b5[_0x054b('0x18')]['where']||null:null,'attributes':_0x1c19b5[_0x054b('0x18')]?_0x1c19b5[_0x054b('0x18')]['attributes']||null:null,'limit':_0x1c19b5[_0x054b('0x18')]?_0x1c19b5[_0x054b('0x18')]['limit']||null:null,'include':_0x1c19b5['options']?_0x1c19b5[_0x054b('0x18')][_0x054b('0x1a')]?_['map'](_0x1c19b5[_0x054b('0x18')]['include'],function(_0x5cf745){return{'model':db[_0x5cf745['model']],'as':_0x5cf745['as'],'attributes':_0x5cf745[_0x054b('0x1b')],'include':_0x5cf745['include']?_[_0x054b('0x1c')](_0x5cf745['include'],function(_0x3a59d8){return{'model':db[_0x3a59d8[_0x054b('0x1d')]],'as':_0x3a59d8['as'],'attributes':_0x3a59d8[_0x054b('0x1b')],'include':_0x3a59d8[_0x054b('0x1a')]?_[_0x054b('0x1c')](_0x3a59d8[_0x054b('0x1a')],function(_0x2ce410){return{'model':db[_0x2ce410[_0x054b('0x1d')]],'as':_0x2ce410['as'],'attributes':_0x2ce410[_0x054b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x283caa){logger[_0x054b('0xc')](_0x054b('0x17'),_0x1c19b5);logger['debug'](_0x054b('0x17'),_0x1c19b5,JSON[_0x054b('0x11')](_0x283caa));_0xa59be3(_0x283caa);})['catch'](function(_0x338b27){logger[_0x054b('0x12')](_0x054b('0x17'),_0x338b27[_0x054b('0x14')],_0x1c19b5);_0x2479b0(_0x4ffd57[_0x054b('0x12')](0x1f4,_0x338b27[_0x054b('0x14')]));});});};exports[_0x054b('0x1e')]=function(_0x34b13d){var _0xbf0944=this;return new Promise(function(_0x2f1cfe,_0x439b86){return db['SalesforceAccount'][_0x054b('0x1f')]({'raw':_0x34b13d[_0x054b('0x18')]?_0x34b13d['options']['raw']===undefined?!![]:![]:!![],'where':_0x34b13d[_0x054b('0x18')]?_0x34b13d['options'][_0x054b('0x20')]||null:null,'attributes':_0x34b13d[_0x054b('0x18')]?_0x34b13d[_0x054b('0x18')][_0x054b('0x1b')]||null:null,'include':_0x34b13d[_0x054b('0x18')]?_0x34b13d['options'][_0x054b('0x1a')]?_[_0x054b('0x1c')](_0x34b13d[_0x054b('0x18')]['include'],function(_0x28ec3d){return{'model':db[_0x28ec3d[_0x054b('0x1d')]],'as':_0x28ec3d['as'],'attributes':_0x28ec3d[_0x054b('0x1b')],'include':_0x28ec3d[_0x054b('0x1a')]?_[_0x054b('0x1c')](_0x28ec3d[_0x054b('0x1a')],function(_0x5cd5ea){return{'model':db[_0x5cd5ea[_0x054b('0x1d')]],'as':_0x5cd5ea['as'],'attributes':_0x5cd5ea[_0x054b('0x1b')],'include':_0x5cd5ea[_0x054b('0x1a')]?_['map'](_0x5cd5ea[_0x054b('0x1a')],function(_0x1a80d6){return{'model':db[_0x1a80d6[_0x054b('0x1d')]],'as':_0x1a80d6['as'],'attributes':_0x1a80d6[_0x054b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x054b('0x21')](function(_0x100143){logger[_0x054b('0xc')]('ShowSalesforceAccount',_0x34b13d);logger['debug'](_0x054b('0x1e'),_0x34b13d,JSON[_0x054b('0x11')](_0x100143));_0x2f1cfe(_0x100143);})['catch'](function(_0x5b1bf2){logger[_0x054b('0x12')]('ShowSalesforceAccount',_0x5b1bf2[_0x054b('0x14')],_0x34b13d);_0x439b86(_0xbf0944[_0x054b('0x12')](0x1f4,_0x5b1bf2[_0x054b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index d104aa6..a51947d 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 _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5218c7,_0x4aa8a2){var _0x361d9c=function(_0x293a8f){while(--_0x293a8f){_0x5218c7['push'](_0x5218c7['shift']());}};_0x361d9c(++_0x4aa8a2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x408b75,_0x7a7de5){_0x408b75=_0x408b75-0x0;var _0x43d572=_0x5f2f[_0x408b75];return _0x43d572;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x31da73,_0x39b9d9){var _0x5e727b=function(_0x264a3a){while(--_0x264a3a){_0x31da73['push'](_0x31da73['shift']());}};_0x5e727b(++_0x39b9d9);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 63725f2..0ffb463 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 _0x9458=['Task','ENUM','contact_lead','contact','lead','account_contact_lead','account','nothing','STRING'];(function(_0x3fcd43,_0x2fa168){var _0x146772=function(_0x57c579){while(--_0x57c579){_0x3fcd43['push'](_0x3fcd43['shift']());}};_0x146772(++_0x2fa168);}(_0x9458,0x1b8));var _0x8945=function(_0x5d2024,_0x34fc85){_0x5d2024=_0x5d2024-0x0;var _0x4a880f=_0x9458[_0x5d2024];return _0x4a880f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8945('0x0')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x8945('0x1'),'Case'),'defaultValue':_0x8945('0x1')},'moduleSearch':{'type':Sequelize[_0x8945('0x2')](_0x8945('0x3'),_0x8945('0x4'),_0x8945('0x5'),_0x8945('0x6'),_0x8945('0x7')),'defaultValue':_0x8945('0x3')},'moduleCreate':{'type':Sequelize[_0x8945('0x2')](_0x8945('0x8'),'contact',_0x8945('0x5'),_0x8945('0x7')),'defaultValue':_0x8945('0x5')},'leadId':{'type':Sequelize[_0x8945('0x0')]},'additionalSearchAccount':{'type':Sequelize[_0x8945('0x0')]},'additionalSearchContact':{'type':Sequelize[_0x8945('0x0')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x86d6=['exports','STRING','ENUM','Task','contact_lead','lead','account_contact_lead','account','nothing'];(function(_0xe036fe,_0x436a4a){var _0x1c8bcf=function(_0x35d673){while(--_0x35d673){_0xe036fe['push'](_0xe036fe['shift']());}};_0x1c8bcf(++_0x436a4a);}(_0x86d6,0x14d));var _0x686d=function(_0x51cd38,_0x3d3e90){_0x51cd38=_0x51cd38-0x0;var _0x24f95e=_0x86d6[_0x51cd38];return _0x24f95e;};'use strict';var Sequelize=require('sequelize');module[_0x686d('0x0')]={'name':{'type':Sequelize[_0x686d('0x1')]},'description':{'type':Sequelize[_0x686d('0x1')]},'ticketType':{'type':Sequelize[_0x686d('0x2')](_0x686d('0x3'),'Case'),'defaultValue':_0x686d('0x3')},'moduleSearch':{'type':Sequelize[_0x686d('0x2')](_0x686d('0x4'),'contact',_0x686d('0x5'),_0x686d('0x6'),_0x686d('0x7')),'defaultValue':_0x686d('0x4')},'moduleCreate':{'type':Sequelize[_0x686d('0x2')](_0x686d('0x8'),'contact',_0x686d('0x5'),'account'),'defaultValue':_0x686d('0x5')},'leadId':{'type':Sequelize[_0x686d('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x686d('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x686d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 00cc987..0760f13 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 _0x888e=['index','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','length','sort','where','filters','filter','VIRTUAL','merge','count','includeAll','include','rows','catch','params','fields','options','find','create','body','getFields','findOne','SalesforceField','pick','hasOwnProperty','nolimit','order','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','then','destroy','sendStatus','error','stack','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x888e,0xc0));var _0xe888=function(_0x3c623a,_0x1d437a){_0x3c623a=_0x3c623a-0x0;var _0x432391=_0x888e[_0x3c623a];return _0x432391;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe888('0x0'));var zipdir=require(_0xe888('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe888('0x2'));var moment=require(_0xe888('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe888('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe888('0x5'));var csv=require(_0xe888('0x6'));var ejs=require(_0xe888('0x7'));var fs=require('fs');var fs_extra=require(_0xe888('0x8'));var _=require(_0xe888('0x9'));var squel=require(_0xe888('0xa'));var crypto=require(_0xe888('0xb'));var jsforce=require(_0xe888('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe888('0x6'));var querystring=require(_0xe888('0xd'));var Papa=require(_0xe888('0xe'));var Redis=require(_0xe888('0xf'));var authService=require(_0xe888('0x10'));var qs=require(_0xe888('0x11'));var as=require(_0xe888('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe888('0x13'))(_0xe888('0x14'));var utils=require('../../config/utils');var config=require(_0xe888('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b2f7e,_0x36bafc){_0x36bafc=_0x36bafc||0xcc;return function(_0x21902c){if(_0x21902c){return _0x2b2f7e['sendStatus'](_0x36bafc);}return _0x2b2f7e[_0xe888('0x16')](_0x36bafc)[_0xe888('0x17')]();};}function respondWithResult(_0x564178,_0x3f1993){_0x3f1993=_0x3f1993||0xc8;return function(_0x3720d8){if(_0x3720d8){return _0x564178[_0xe888('0x16')](_0x3f1993)['json'](_0x3720d8);}};}function respondWithFilteredResult(_0x5b40e0,_0x16a8c4){return function(_0x112870){if(_0x112870){var _0x335937=typeof _0x16a8c4[_0xe888('0x18')]===_0xe888('0x19')&&typeof _0x16a8c4[_0xe888('0x1a')]===_0xe888('0x19');var _0x17b3e4=_0x112870['count'];var _0x29af3a=_0x335937?0x0:_0x16a8c4[_0xe888('0x18')];var _0x563078=_0x335937?_0x112870['count']:_0x16a8c4[_0xe888('0x18')]+_0x16a8c4['limit'];var _0x3d6d1b;if(_0x563078>=_0x17b3e4){_0x563078=_0x17b3e4;_0x3d6d1b=0xc8;}else{_0x3d6d1b=0xce;}_0x5b40e0[_0xe888('0x16')](_0x3d6d1b);return _0x5b40e0[_0xe888('0x1b')](_0xe888('0x1c'),_0x29af3a+'-'+_0x563078+'/'+_0x17b3e4)[_0xe888('0x1d')](_0x112870);}return null;};}function patchUpdates(_0x54aea9){return function(_0x3aba83){try{jsonpatch[_0xe888('0x1e')](_0x3aba83,_0x54aea9,!![]);}catch(_0x358abc){return BPromise['reject'](_0x358abc);}return _0x3aba83[_0xe888('0x1f')]();};}function saveUpdates(_0x2508c0,_0x2a10e7){return function(_0x2ed555){if(_0x2ed555){return _0x2ed555['update'](_0x2508c0)[_0xe888('0x20')](function(_0x14e49b){return _0x14e49b;});}return null;};}function removeEntity(_0x693948,_0x2832a2){return function(_0x1e5190){if(_0x1e5190){return _0x1e5190[_0xe888('0x21')]()[_0xe888('0x20')](function(){_0x693948[_0xe888('0x16')](0xcc)[_0xe888('0x17')]();});}};}function handleEntityNotFound(_0x437453,_0x14c1b7){return function(_0x52ba44){if(!_0x52ba44){_0x437453[_0xe888('0x22')](0x194);}return _0x52ba44;};}function handleError(_0x496be5,_0x1a101e){_0x1a101e=_0x1a101e||0x1f4;return function(_0x2a6aab){logger[_0xe888('0x23')](_0x2a6aab[_0xe888('0x24')]);if(_0x2a6aab[_0xe888('0x25')]){delete _0x2a6aab['name'];}_0x496be5[_0xe888('0x16')](_0x1a101e)[_0xe888('0x26')](_0x2a6aab);};}exports[_0xe888('0x27')]=function(_0x3eb031,_0x453604){var _0x1955cb={},_0xda3523={},_0x25d406={'count':0x0,'rows':[]};var _0xaf7d5=_[_0xe888('0x28')](db[_0xe888('0x29')][_0xe888('0x2a')],function(_0x210640){return{'name':_0x210640[_0xe888('0x2b')],'type':_0x210640[_0xe888('0x2c')]['key']};});_0xda3523[_0xe888('0x2d')]=_[_0xe888('0x28')](_0xaf7d5,_0xe888('0x25'));_0xda3523[_0xe888('0x2e')]=_[_0xe888('0x2f')](_0x3eb031[_0xe888('0x2e')]);_0xda3523['filters']=_[_0xe888('0x30')](_0xda3523[_0xe888('0x2d')],_0xda3523[_0xe888('0x2e')]);_0x1955cb[_0xe888('0x31')]=_[_0xe888('0x30')](_0xda3523[_0xe888('0x2d')],qs['fields'](_0x3eb031[_0xe888('0x2e')]['fields']));_0x1955cb[_0xe888('0x31')]=_0x1955cb[_0xe888('0x31')][_0xe888('0x32')]?_0x1955cb[_0xe888('0x31')]:_0xda3523[_0xe888('0x2d')];if(!_0x3eb031[_0xe888('0x2e')]['hasOwnProperty']('nolimit')){_0x1955cb[_0xe888('0x1a')]=qs[_0xe888('0x1a')](_0x3eb031[_0xe888('0x2e')][_0xe888('0x1a')]);_0x1955cb['offset']=qs[_0xe888('0x18')](_0x3eb031[_0xe888('0x2e')][_0xe888('0x18')]);}_0x1955cb['order']=qs[_0xe888('0x33')](_0x3eb031[_0xe888('0x2e')]['sort']);_0x1955cb[_0xe888('0x34')]=qs[_0xe888('0x35')](_['pick'](_0x3eb031[_0xe888('0x2e')],_0xda3523['filters']),_0xaf7d5);if(_0x3eb031[_0xe888('0x2e')][_0xe888('0x36')]){_0x1955cb[_0xe888('0x34')]=_['merge'](_0x1955cb[_0xe888('0x34')],{'$or':_['map'](_0xaf7d5,function(_0x394037){if(_0x394037['type']!==_0xe888('0x37')){var _0x26453b={};_0x26453b[_0x394037['name']]={'$like':'%'+_0x3eb031[_0xe888('0x2e')][_0xe888('0x36')]+'%'};return _0x26453b;}})});}_0x1955cb=_[_0xe888('0x38')]({},_0x1955cb,_0x3eb031['options']);var _0x239039={'where':_0x1955cb['where']};return db[_0xe888('0x29')][_0xe888('0x39')](_0x239039)[_0xe888('0x20')](function(_0x4c43b1){_0x25d406['count']=_0x4c43b1;if(_0x3eb031[_0xe888('0x2e')][_0xe888('0x3a')]){_0x1955cb[_0xe888('0x3b')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x1955cb);})[_0xe888('0x20')](function(_0x3f782f){_0x25d406[_0xe888('0x3c')]=_0x3f782f;return _0x25d406;})['then'](respondWithFilteredResult(_0x453604,_0x1955cb))[_0xe888('0x3d')](handleError(_0x453604,null));};exports['show']=function(_0x1af33a,_0x3ab6bf){var _0x144ec4={'raw':![],'where':{'id':_0x1af33a[_0xe888('0x3e')]['id']}},_0x4ca562={};_0x4ca562[_0xe888('0x2d')]=_[_0xe888('0x2f')](db['SalesforceConfiguration'][_0xe888('0x2a')]);_0x4ca562[_0xe888('0x2e')]=_[_0xe888('0x2f')](_0x1af33a['query']);_0x4ca562[_0xe888('0x35')]=_['intersection'](_0x4ca562[_0xe888('0x2d')],_0x4ca562['query']);_0x144ec4['attributes']=_[_0xe888('0x30')](_0x4ca562['model'],qs[_0xe888('0x3f')](_0x1af33a[_0xe888('0x2e')]['fields']));_0x144ec4['attributes']=_0x144ec4[_0xe888('0x31')]['length']?_0x144ec4['attributes']:_0x4ca562['model'];if(_0x1af33a[_0xe888('0x2e')][_0xe888('0x3a')]){_0x144ec4[_0xe888('0x3b')]=[{'all':!![]}];}_0x144ec4=_[_0xe888('0x38')]({},_0x144ec4,_0x1af33a[_0xe888('0x40')]);return db[_0xe888('0x29')][_0xe888('0x41')](_0x144ec4)[_0xe888('0x20')](handleEntityNotFound(_0x3ab6bf,null))['then'](respondWithResult(_0x3ab6bf,null))['catch'](handleError(_0x3ab6bf,null));};exports[_0xe888('0x42')]=function(_0x3c806f,_0xd4cb87){return db[_0xe888('0x29')][_0xe888('0x42')](_0x3c806f[_0xe888('0x43')],{})[_0xe888('0x20')](respondWithResult(_0xd4cb87,0xc9))[_0xe888('0x3d')](handleError(_0xd4cb87,null));};exports['update']=function(_0x120ded,_0x4ff821){if(_0x120ded[_0xe888('0x43')]['id']){delete _0x120ded[_0xe888('0x43')]['id'];}return db[_0xe888('0x29')][_0xe888('0x41')]({'where':{'id':_0x120ded[_0xe888('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4ff821,null))[_0xe888('0x20')](saveUpdates(_0x120ded['body'],null))['then'](respondWithResult(_0x4ff821,null))[_0xe888('0x3d')](handleError(_0x4ff821,null));};exports[_0xe888('0x21')]=function(_0x119b31,_0x3779ba){return db[_0xe888('0x29')]['find']({'where':{'id':_0x119b31['params']['id']}})[_0xe888('0x20')](handleEntityNotFound(_0x3779ba,null))[_0xe888('0x20')](removeEntity(_0x3779ba,null))['catch'](handleError(_0x3779ba,null));};exports[_0xe888('0x44')]=function(_0x3aa162,_0x546b7b,_0x3540f2){var _0x279450={};var _0xcb7644={};var _0x210d74;var _0x114b9f;return db[_0xe888('0x29')][_0xe888('0x45')]({'where':{'id':_0x3aa162[_0xe888('0x3e')]['id']}})[_0xe888('0x20')](handleEntityNotFound(_0x546b7b,null))[_0xe888('0x20')](function(_0x6b272){if(_0x6b272){_0x210d74=_0x6b272;_0xcb7644['model']=_['keys'](db[_0xe888('0x46')][_0xe888('0x2a')]);_0xcb7644[_0xe888('0x2e')]=_[_0xe888('0x2f')](_0x3aa162[_0xe888('0x2e')]);_0xcb7644[_0xe888('0x35')]=_[_0xe888('0x30')](_0xcb7644['model'],_0xcb7644[_0xe888('0x2e')]);_0x279450[_0xe888('0x31')]=_[_0xe888('0x30')](_0xcb7644[_0xe888('0x2d')],qs[_0xe888('0x3f')](_0x3aa162['query'][_0xe888('0x3f')]));_0x279450[_0xe888('0x31')]=_0x279450[_0xe888('0x31')]['length']?_0x279450['attributes']:_0xcb7644[_0xe888('0x2d')];_0x279450['order']=qs['sort'](_0x3aa162['query'][_0xe888('0x33')]);_0x279450[_0xe888('0x34')]=qs[_0xe888('0x35')](_[_0xe888('0x47')](_0x3aa162[_0xe888('0x2e')],_0xcb7644[_0xe888('0x35')]));if(_0x3aa162[_0xe888('0x2e')]['filter']){_0x279450['where']=_[_0xe888('0x38')](_0x279450['where'],{'$or':_['map'](_0x279450[_0xe888('0x31')],function(_0x2d511b){var _0x266cca={};_0x266cca[_0x2d511b]={'$like':'%'+_0x3aa162['query'][_0xe888('0x36')]+'%'};return _0x266cca;})});}_0x279450=_[_0xe888('0x38')]({},_0x279450,_0x3aa162[_0xe888('0x40')]);return _0x210d74[_0xe888('0x44')](_0x279450);}})[_0xe888('0x20')](function(_0x78d75a){if(_0x78d75a){_0x114b9f=_0x78d75a[_0xe888('0x32')];if(!_0x3aa162[_0xe888('0x2e')][_0xe888('0x48')](_0xe888('0x49'))){_0x279450[_0xe888('0x1a')]=qs[_0xe888('0x1a')](_0x3aa162[_0xe888('0x2e')][_0xe888('0x1a')]);_0x279450['offset']=qs['offset'](_0x3aa162[_0xe888('0x2e')][_0xe888('0x18')]);}return _0x210d74[_0xe888('0x44')](_0x279450);}})[_0xe888('0x20')](function(_0x3a9fb8){if(_0x3a9fb8){return _0x3a9fb8?{'count':_0x114b9f,'rows':_0x3a9fb8}:null;}})['then'](respondWithResult(_0x546b7b,null))[_0xe888('0x3d')](handleError(_0x546b7b,null));};exports['getSubjects']=function(_0x15da52,_0x32eae3,_0x101dd8){var _0x29270e={};var _0x564fbf={};var _0x1570bf;var _0x4d1488;return db[_0xe888('0x29')]['findOne']({'where':{'id':_0x15da52[_0xe888('0x3e')]['id']}})[_0xe888('0x20')](handleEntityNotFound(_0x32eae3,null))[_0xe888('0x20')](function(_0x1fdc68){if(_0x1fdc68){_0x1570bf=_0x1fdc68;_0x564fbf[_0xe888('0x2d')]=_[_0xe888('0x2f')](db[_0xe888('0x46')][_0xe888('0x2a')]);_0x564fbf['query']=_[_0xe888('0x2f')](_0x15da52[_0xe888('0x2e')]);_0x564fbf[_0xe888('0x35')]=_['intersection'](_0x564fbf[_0xe888('0x2d')],_0x564fbf[_0xe888('0x2e')]);_0x29270e['attributes']=_[_0xe888('0x30')](_0x564fbf[_0xe888('0x2d')],qs[_0xe888('0x3f')](_0x15da52[_0xe888('0x2e')][_0xe888('0x3f')]));_0x29270e[_0xe888('0x31')]=_0x29270e[_0xe888('0x31')][_0xe888('0x32')]?_0x29270e[_0xe888('0x31')]:_0x564fbf[_0xe888('0x2d')];_0x29270e[_0xe888('0x4a')]=qs[_0xe888('0x33')](_0x15da52[_0xe888('0x2e')][_0xe888('0x33')]);_0x29270e[_0xe888('0x34')]=qs[_0xe888('0x35')](_[_0xe888('0x47')](_0x15da52[_0xe888('0x2e')],_0x564fbf[_0xe888('0x35')]));if(_0x15da52[_0xe888('0x2e')][_0xe888('0x36')]){_0x29270e[_0xe888('0x34')]=_[_0xe888('0x38')](_0x29270e[_0xe888('0x34')],{'$or':_['map'](_0x29270e['attributes'],function(_0x4256f9){var _0x2a38f2={};_0x2a38f2[_0x4256f9]={'$like':'%'+_0x15da52[_0xe888('0x2e')][_0xe888('0x36')]+'%'};return _0x2a38f2;})});}_0x29270e=_[_0xe888('0x38')]({},_0x29270e,_0x15da52[_0xe888('0x40')]);return _0x1570bf[_0xe888('0x4b')](_0x29270e);}})['then'](function(_0x3f058a){if(_0x3f058a){_0x4d1488=_0x3f058a[_0xe888('0x32')];if(!_0x15da52[_0xe888('0x2e')][_0xe888('0x48')](_0xe888('0x49'))){_0x29270e[_0xe888('0x1a')]=qs[_0xe888('0x1a')](_0x15da52[_0xe888('0x2e')][_0xe888('0x1a')]);_0x29270e[_0xe888('0x18')]=qs[_0xe888('0x18')](_0x15da52[_0xe888('0x2e')][_0xe888('0x18')]);}return _0x1570bf[_0xe888('0x4b')](_0x29270e);}})[_0xe888('0x20')](function(_0x999a73){if(_0x999a73){return _0x999a73?{'count':_0x4d1488,'rows':_0x999a73}:null;}})[_0xe888('0x20')](respondWithResult(_0x32eae3,null))['catch'](handleError(_0x32eae3,null));};exports[_0xe888('0x4c')]=function(_0x26d45f,_0x1e8036,_0x1708bb){var _0x58f057={};var _0x54659e={};var _0x1e43c6;var _0xb92a5a;return db[_0xe888('0x29')]['findOne']({'where':{'id':_0x26d45f[_0xe888('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1e8036,null))[_0xe888('0x20')](function(_0x2688ee){if(_0x2688ee){_0x1e43c6=_0x2688ee;_0x54659e[_0xe888('0x2d')]=_[_0xe888('0x2f')](db['SalesforceField']['rawAttributes']);_0x54659e[_0xe888('0x2e')]=_[_0xe888('0x2f')](_0x26d45f[_0xe888('0x2e')]);_0x54659e['filters']=_[_0xe888('0x30')](_0x54659e[_0xe888('0x2d')],_0x54659e[_0xe888('0x2e')]);_0x58f057[_0xe888('0x31')]=_['intersection'](_0x54659e['model'],qs[_0xe888('0x3f')](_0x26d45f[_0xe888('0x2e')]['fields']));_0x58f057['attributes']=_0x58f057['attributes'][_0xe888('0x32')]?_0x58f057[_0xe888('0x31')]:_0x54659e[_0xe888('0x2d')];_0x58f057[_0xe888('0x4a')]=qs[_0xe888('0x33')](_0x26d45f['query']['sort']);_0x58f057[_0xe888('0x34')]=qs[_0xe888('0x35')](_[_0xe888('0x47')](_0x26d45f['query'],_0x54659e[_0xe888('0x35')]));if(_0x26d45f[_0xe888('0x2e')][_0xe888('0x36')]){_0x58f057[_0xe888('0x34')]=_[_0xe888('0x38')](_0x58f057[_0xe888('0x34')],{'$or':_[_0xe888('0x28')](_0x58f057[_0xe888('0x31')],function(_0x2b5f86){var _0x4f4752={};_0x4f4752[_0x2b5f86]={'$like':'%'+_0x26d45f[_0xe888('0x2e')]['filter']+'%'};return _0x4f4752;})});}_0x58f057=_[_0xe888('0x38')]({},_0x58f057,_0x26d45f['options']);return _0x1e43c6[_0xe888('0x4c')](_0x58f057);}})['then'](function(_0xce1951){if(_0xce1951){_0xb92a5a=_0xce1951[_0xe888('0x32')];if(!_0x26d45f[_0xe888('0x2e')][_0xe888('0x48')](_0xe888('0x49'))){_0x58f057[_0xe888('0x1a')]=qs[_0xe888('0x1a')](_0x26d45f[_0xe888('0x2e')][_0xe888('0x1a')]);_0x58f057[_0xe888('0x18')]=qs[_0xe888('0x18')](_0x26d45f[_0xe888('0x2e')][_0xe888('0x18')]);}return _0x1e43c6['getDescriptions'](_0x58f057);}})[_0xe888('0x20')](function(_0x5575ed){if(_0x5575ed){return _0x5575ed?{'count':_0xb92a5a,'rows':_0x5575ed}:null;}})['then'](respondWithResult(_0x1e8036,null))[_0xe888('0x3d')](handleError(_0x1e8036,null));}; \ No newline at end of file +var _0xc2b8=['destroy','then','error','name','index','map','SalesforceConfiguration','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','rows','catch','keys','rawAttributes','includeAll','include','options','create','body','find','params','getFields','findOne','SalesforceField','length','pick','filter','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update'];(function(_0x26c448,_0x13221d){var _0x42c898=function(_0x4b1402){while(--_0x4b1402){_0x26c448['push'](_0x26c448['shift']());}};_0x42c898(++_0x13221d);}(_0xc2b8,0x1ab));var _0x8c2b=function(_0x1fd675,_0x587658){_0x1fd675=_0x1fd675-0x0;var _0x521d1c=_0xc2b8[_0x1fd675];return _0x521d1c;};'use strict';var emlformat=require(_0x8c2b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c2b('0x1'));var jsonpatch=require(_0x8c2b('0x2'));var rp=require(_0x8c2b('0x3'));var moment=require(_0x8c2b('0x4'));var BPromise=require(_0x8c2b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8c2b('0x6'));var csv=require(_0x8c2b('0x7'));var ejs=require(_0x8c2b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c2b('0x9'));var squel=require(_0x8c2b('0xa'));var crypto=require(_0x8c2b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8c2b('0x7'));var querystring=require(_0x8c2b('0xc'));var Papa=require(_0x8c2b('0xd'));var Redis=require(_0x8c2b('0xe'));var authService=require(_0x8c2b('0xf'));var qs=require(_0x8c2b('0x10'));var as=require(_0x8c2b('0x11'));var hardwareService=require(_0x8c2b('0x12'));var logger=require(_0x8c2b('0x13'))(_0x8c2b('0x14'));var utils=require(_0x8c2b('0x15'));var config=require(_0x8c2b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f062a,_0x14923a){_0x14923a=_0x14923a||0xcc;return function(_0x557505){if(_0x557505){return _0x2f062a[_0x8c2b('0x17')](_0x14923a);}return _0x2f062a[_0x8c2b('0x18')](_0x14923a)[_0x8c2b('0x19')]();};}function respondWithResult(_0x4f811c,_0x14e5e5){_0x14e5e5=_0x14e5e5||0xc8;return function(_0x36e945){if(_0x36e945){return _0x4f811c[_0x8c2b('0x18')](_0x14e5e5)[_0x8c2b('0x1a')](_0x36e945);}};}function respondWithFilteredResult(_0x514309,_0x47149e){return function(_0x48a9f7){if(_0x48a9f7){var _0x3f7794=typeof _0x47149e[_0x8c2b('0x1b')]===_0x8c2b('0x1c')&&typeof _0x47149e[_0x8c2b('0x1d')]===_0x8c2b('0x1c');var _0x1b8611=_0x48a9f7['count'];var _0x2028d6=_0x3f7794?0x0:_0x47149e['offset'];var _0xd40d57=_0x3f7794?_0x48a9f7[_0x8c2b('0x1e')]:_0x47149e['offset']+_0x47149e[_0x8c2b('0x1d')];var _0x348c2d;if(_0xd40d57>=_0x1b8611){_0xd40d57=_0x1b8611;_0x348c2d=0xc8;}else{_0x348c2d=0xce;}_0x514309['status'](_0x348c2d);return _0x514309['set'](_0x8c2b('0x1f'),_0x2028d6+'-'+_0xd40d57+'/'+_0x1b8611)[_0x8c2b('0x1a')](_0x48a9f7);}return null;};}function patchUpdates(_0x5e0603){return function(_0x53edca){try{jsonpatch['apply'](_0x53edca,_0x5e0603,!![]);}catch(_0x3d7fa1){return BPromise[_0x8c2b('0x20')](_0x3d7fa1);}return _0x53edca[_0x8c2b('0x21')]();};}function saveUpdates(_0x41d57e,_0x503df8){return function(_0x181ae4){if(_0x181ae4){return _0x181ae4[_0x8c2b('0x22')](_0x41d57e)['then'](function(_0x5c17c7){return _0x5c17c7;});}return null;};}function removeEntity(_0x344ae2,_0x574f6c){return function(_0x3e9556){if(_0x3e9556){return _0x3e9556[_0x8c2b('0x23')]()[_0x8c2b('0x24')](function(){_0x344ae2[_0x8c2b('0x18')](0xcc)[_0x8c2b('0x19')]();});}};}function handleEntityNotFound(_0x3aa291,_0x57e26f){return function(_0x9e9d02){if(!_0x9e9d02){_0x3aa291['sendStatus'](0x194);}return _0x9e9d02;};}function handleError(_0x58ad68,_0x524c03){_0x524c03=_0x524c03||0x1f4;return function(_0x11cbfc){logger[_0x8c2b('0x25')](_0x11cbfc['stack']);if(_0x11cbfc['name']){delete _0x11cbfc[_0x8c2b('0x26')];}_0x58ad68[_0x8c2b('0x18')](_0x524c03)['send'](_0x11cbfc);};}exports[_0x8c2b('0x27')]=function(_0x219e5c,_0x1fc968){var _0x5e91e7={},_0x435667={},_0x1516b5={'count':0x0,'rows':[]};var _0x111d6a=_[_0x8c2b('0x28')](db[_0x8c2b('0x29')]['rawAttributes'],function(_0xc6fe1d){return{'name':_0xc6fe1d[_0x8c2b('0x2a')],'type':_0xc6fe1d[_0x8c2b('0x2b')][_0x8c2b('0x2c')]};});_0x435667[_0x8c2b('0x2d')]=_['map'](_0x111d6a,_0x8c2b('0x26'));_0x435667[_0x8c2b('0x2e')]=_['keys'](_0x219e5c['query']);_0x435667[_0x8c2b('0x2f')]=_[_0x8c2b('0x30')](_0x435667[_0x8c2b('0x2d')],_0x435667[_0x8c2b('0x2e')]);_0x5e91e7['attributes']=_[_0x8c2b('0x30')](_0x435667[_0x8c2b('0x2d')],qs[_0x8c2b('0x31')](_0x219e5c[_0x8c2b('0x2e')]['fields']));_0x5e91e7[_0x8c2b('0x32')]=_0x5e91e7[_0x8c2b('0x32')]['length']?_0x5e91e7['attributes']:_0x435667[_0x8c2b('0x2d')];if(!_0x219e5c[_0x8c2b('0x2e')][_0x8c2b('0x33')](_0x8c2b('0x34'))){_0x5e91e7['limit']=qs[_0x8c2b('0x1d')](_0x219e5c['query'][_0x8c2b('0x1d')]);_0x5e91e7[_0x8c2b('0x1b')]=qs['offset'](_0x219e5c[_0x8c2b('0x2e')][_0x8c2b('0x1b')]);}_0x5e91e7[_0x8c2b('0x35')]=qs[_0x8c2b('0x36')](_0x219e5c[_0x8c2b('0x2e')][_0x8c2b('0x36')]);_0x5e91e7[_0x8c2b('0x37')]=qs[_0x8c2b('0x2f')](_['pick'](_0x219e5c[_0x8c2b('0x2e')],_0x435667[_0x8c2b('0x2f')]),_0x111d6a);if(_0x219e5c[_0x8c2b('0x2e')]['filter']){_0x5e91e7[_0x8c2b('0x37')]=_['merge'](_0x5e91e7[_0x8c2b('0x37')],{'$or':_[_0x8c2b('0x28')](_0x111d6a,function(_0x40201b){if(_0x40201b[_0x8c2b('0x2b')]!==_0x8c2b('0x38')){var _0x26c9f4={};_0x26c9f4[_0x40201b[_0x8c2b('0x26')]]={'$like':'%'+_0x219e5c[_0x8c2b('0x2e')]['filter']+'%'};return _0x26c9f4;}})});}_0x5e91e7=_[_0x8c2b('0x39')]({},_0x5e91e7,_0x219e5c['options']);var _0x32dc18={'where':_0x5e91e7[_0x8c2b('0x37')]};return db[_0x8c2b('0x29')][_0x8c2b('0x1e')](_0x32dc18)[_0x8c2b('0x24')](function(_0x40d1a4){_0x1516b5['count']=_0x40d1a4;if(_0x219e5c['query']['includeAll']){_0x5e91e7['include']=[{'all':!![]}];}return db[_0x8c2b('0x29')]['findAll'](_0x5e91e7);})[_0x8c2b('0x24')](function(_0x208b0d){_0x1516b5[_0x8c2b('0x3a')]=_0x208b0d;return _0x1516b5;})[_0x8c2b('0x24')](respondWithFilteredResult(_0x1fc968,_0x5e91e7))[_0x8c2b('0x3b')](handleError(_0x1fc968,null));};exports['show']=function(_0x12b0b4,_0x5af7b7){var _0x1faea4={'raw':![],'where':{'id':_0x12b0b4['params']['id']}},_0x59c370={};_0x59c370[_0x8c2b('0x2d')]=_[_0x8c2b('0x3c')](db[_0x8c2b('0x29')][_0x8c2b('0x3d')]);_0x59c370[_0x8c2b('0x2e')]=_[_0x8c2b('0x3c')](_0x12b0b4[_0x8c2b('0x2e')]);_0x59c370[_0x8c2b('0x2f')]=_[_0x8c2b('0x30')](_0x59c370[_0x8c2b('0x2d')],_0x59c370[_0x8c2b('0x2e')]);_0x1faea4[_0x8c2b('0x32')]=_[_0x8c2b('0x30')](_0x59c370[_0x8c2b('0x2d')],qs[_0x8c2b('0x31')](_0x12b0b4[_0x8c2b('0x2e')][_0x8c2b('0x31')]));_0x1faea4[_0x8c2b('0x32')]=_0x1faea4[_0x8c2b('0x32')]['length']?_0x1faea4[_0x8c2b('0x32')]:_0x59c370['model'];if(_0x12b0b4[_0x8c2b('0x2e')][_0x8c2b('0x3e')]){_0x1faea4[_0x8c2b('0x3f')]=[{'all':!![]}];}_0x1faea4=_['merge']({},_0x1faea4,_0x12b0b4[_0x8c2b('0x40')]);return db['SalesforceConfiguration']['find'](_0x1faea4)['then'](handleEntityNotFound(_0x5af7b7,null))[_0x8c2b('0x24')](respondWithResult(_0x5af7b7,null))[_0x8c2b('0x3b')](handleError(_0x5af7b7,null));};exports[_0x8c2b('0x41')]=function(_0xf654b3,_0x35dc7d){return db['SalesforceConfiguration'][_0x8c2b('0x41')](_0xf654b3[_0x8c2b('0x42')],{})[_0x8c2b('0x24')](respondWithResult(_0x35dc7d,0xc9))[_0x8c2b('0x3b')](handleError(_0x35dc7d,null));};exports['update']=function(_0x2d2307,_0x1b4918){if(_0x2d2307[_0x8c2b('0x42')]['id']){delete _0x2d2307['body']['id'];}return db[_0x8c2b('0x29')][_0x8c2b('0x43')]({'where':{'id':_0x2d2307[_0x8c2b('0x44')]['id']}})[_0x8c2b('0x24')](handleEntityNotFound(_0x1b4918,null))[_0x8c2b('0x24')](saveUpdates(_0x2d2307[_0x8c2b('0x42')],null))[_0x8c2b('0x24')](respondWithResult(_0x1b4918,null))[_0x8c2b('0x3b')](handleError(_0x1b4918,null));};exports[_0x8c2b('0x23')]=function(_0x4acbd5,_0x3cf961){return db[_0x8c2b('0x29')][_0x8c2b('0x43')]({'where':{'id':_0x4acbd5['params']['id']}})['then'](handleEntityNotFound(_0x3cf961,null))[_0x8c2b('0x24')](removeEntity(_0x3cf961,null))['catch'](handleError(_0x3cf961,null));};exports[_0x8c2b('0x45')]=function(_0xe0c13d,_0x1ed51b,_0x21ed2c){var _0x1c439a={};var _0x5b5933={};var _0xcc065d;var _0x858ca6;return db[_0x8c2b('0x29')][_0x8c2b('0x46')]({'where':{'id':_0xe0c13d['params']['id']}})[_0x8c2b('0x24')](handleEntityNotFound(_0x1ed51b,null))['then'](function(_0x464d8a){if(_0x464d8a){_0xcc065d=_0x464d8a;_0x5b5933[_0x8c2b('0x2d')]=_[_0x8c2b('0x3c')](db[_0x8c2b('0x47')][_0x8c2b('0x3d')]);_0x5b5933[_0x8c2b('0x2e')]=_[_0x8c2b('0x3c')](_0xe0c13d[_0x8c2b('0x2e')]);_0x5b5933[_0x8c2b('0x2f')]=_[_0x8c2b('0x30')](_0x5b5933[_0x8c2b('0x2d')],_0x5b5933[_0x8c2b('0x2e')]);_0x1c439a[_0x8c2b('0x32')]=_[_0x8c2b('0x30')](_0x5b5933[_0x8c2b('0x2d')],qs[_0x8c2b('0x31')](_0xe0c13d['query'][_0x8c2b('0x31')]));_0x1c439a[_0x8c2b('0x32')]=_0x1c439a['attributes'][_0x8c2b('0x48')]?_0x1c439a[_0x8c2b('0x32')]:_0x5b5933[_0x8c2b('0x2d')];_0x1c439a[_0x8c2b('0x35')]=qs['sort'](_0xe0c13d[_0x8c2b('0x2e')][_0x8c2b('0x36')]);_0x1c439a[_0x8c2b('0x37')]=qs[_0x8c2b('0x2f')](_[_0x8c2b('0x49')](_0xe0c13d[_0x8c2b('0x2e')],_0x5b5933[_0x8c2b('0x2f')]));if(_0xe0c13d[_0x8c2b('0x2e')][_0x8c2b('0x4a')]){_0x1c439a['where']=_[_0x8c2b('0x39')](_0x1c439a['where'],{'$or':_[_0x8c2b('0x28')](_0x1c439a[_0x8c2b('0x32')],function(_0xba5f70){var _0x5f5b93={};_0x5f5b93[_0xba5f70]={'$like':'%'+_0xe0c13d[_0x8c2b('0x2e')][_0x8c2b('0x4a')]+'%'};return _0x5f5b93;})});}_0x1c439a=_[_0x8c2b('0x39')]({},_0x1c439a,_0xe0c13d[_0x8c2b('0x40')]);return _0xcc065d[_0x8c2b('0x45')](_0x1c439a);}})[_0x8c2b('0x24')](function(_0x25fb04){if(_0x25fb04){_0x858ca6=_0x25fb04[_0x8c2b('0x48')];if(!_0xe0c13d[_0x8c2b('0x2e')][_0x8c2b('0x33')]('nolimit')){_0x1c439a['limit']=qs[_0x8c2b('0x1d')](_0xe0c13d[_0x8c2b('0x2e')][_0x8c2b('0x1d')]);_0x1c439a['offset']=qs['offset'](_0xe0c13d[_0x8c2b('0x2e')]['offset']);}return _0xcc065d[_0x8c2b('0x45')](_0x1c439a);}})['then'](function(_0x3379ac){if(_0x3379ac){return _0x3379ac?{'count':_0x858ca6,'rows':_0x3379ac}:null;}})['then'](respondWithResult(_0x1ed51b,null))[_0x8c2b('0x3b')](handleError(_0x1ed51b,null));};exports['getSubjects']=function(_0x1e30e3,_0xb85647,_0x365143){var _0x3d477a={};var _0x49b564={};var _0x250297;var _0x58141a;return db[_0x8c2b('0x29')][_0x8c2b('0x46')]({'where':{'id':_0x1e30e3[_0x8c2b('0x44')]['id']}})[_0x8c2b('0x24')](handleEntityNotFound(_0xb85647,null))[_0x8c2b('0x24')](function(_0x30f14b){if(_0x30f14b){_0x250297=_0x30f14b;_0x49b564['model']=_[_0x8c2b('0x3c')](db[_0x8c2b('0x47')]['rawAttributes']);_0x49b564['query']=_[_0x8c2b('0x3c')](_0x1e30e3[_0x8c2b('0x2e')]);_0x49b564['filters']=_[_0x8c2b('0x30')](_0x49b564['model'],_0x49b564[_0x8c2b('0x2e')]);_0x3d477a[_0x8c2b('0x32')]=_[_0x8c2b('0x30')](_0x49b564['model'],qs[_0x8c2b('0x31')](_0x1e30e3[_0x8c2b('0x2e')][_0x8c2b('0x31')]));_0x3d477a[_0x8c2b('0x32')]=_0x3d477a['attributes']['length']?_0x3d477a[_0x8c2b('0x32')]:_0x49b564[_0x8c2b('0x2d')];_0x3d477a['order']=qs[_0x8c2b('0x36')](_0x1e30e3[_0x8c2b('0x2e')][_0x8c2b('0x36')]);_0x3d477a[_0x8c2b('0x37')]=qs[_0x8c2b('0x2f')](_[_0x8c2b('0x49')](_0x1e30e3[_0x8c2b('0x2e')],_0x49b564[_0x8c2b('0x2f')]));if(_0x1e30e3[_0x8c2b('0x2e')][_0x8c2b('0x4a')]){_0x3d477a['where']=_[_0x8c2b('0x39')](_0x3d477a[_0x8c2b('0x37')],{'$or':_['map'](_0x3d477a['attributes'],function(_0x210603){var _0x3c7327={};_0x3c7327[_0x210603]={'$like':'%'+_0x1e30e3['query'][_0x8c2b('0x4a')]+'%'};return _0x3c7327;})});}_0x3d477a=_[_0x8c2b('0x39')]({},_0x3d477a,_0x1e30e3[_0x8c2b('0x40')]);return _0x250297[_0x8c2b('0x4b')](_0x3d477a);}})[_0x8c2b('0x24')](function(_0x51b4a5){if(_0x51b4a5){_0x58141a=_0x51b4a5[_0x8c2b('0x48')];if(!_0x1e30e3['query'][_0x8c2b('0x33')](_0x8c2b('0x34'))){_0x3d477a[_0x8c2b('0x1d')]=qs['limit'](_0x1e30e3['query'][_0x8c2b('0x1d')]);_0x3d477a[_0x8c2b('0x1b')]=qs[_0x8c2b('0x1b')](_0x1e30e3[_0x8c2b('0x2e')][_0x8c2b('0x1b')]);}return _0x250297['getSubjects'](_0x3d477a);}})[_0x8c2b('0x24')](function(_0x55fc35){if(_0x55fc35){return _0x55fc35?{'count':_0x58141a,'rows':_0x55fc35}:null;}})['then'](respondWithResult(_0xb85647,null))[_0x8c2b('0x3b')](handleError(_0xb85647,null));};exports[_0x8c2b('0x4c')]=function(_0xa42d36,_0x2b4cdb,_0x340537){var _0x418846={};var _0x30c412={};var _0x58de81;var _0x5d535f;return db['SalesforceConfiguration'][_0x8c2b('0x46')]({'where':{'id':_0xa42d36[_0x8c2b('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b4cdb,null))['then'](function(_0x3a65cb){if(_0x3a65cb){_0x58de81=_0x3a65cb;_0x30c412[_0x8c2b('0x2d')]=_['keys'](db[_0x8c2b('0x47')][_0x8c2b('0x3d')]);_0x30c412[_0x8c2b('0x2e')]=_[_0x8c2b('0x3c')](_0xa42d36[_0x8c2b('0x2e')]);_0x30c412[_0x8c2b('0x2f')]=_['intersection'](_0x30c412[_0x8c2b('0x2d')],_0x30c412[_0x8c2b('0x2e')]);_0x418846[_0x8c2b('0x32')]=_[_0x8c2b('0x30')](_0x30c412['model'],qs['fields'](_0xa42d36['query'][_0x8c2b('0x31')]));_0x418846['attributes']=_0x418846[_0x8c2b('0x32')][_0x8c2b('0x48')]?_0x418846['attributes']:_0x30c412[_0x8c2b('0x2d')];_0x418846[_0x8c2b('0x35')]=qs[_0x8c2b('0x36')](_0xa42d36[_0x8c2b('0x2e')][_0x8c2b('0x36')]);_0x418846[_0x8c2b('0x37')]=qs[_0x8c2b('0x2f')](_[_0x8c2b('0x49')](_0xa42d36['query'],_0x30c412[_0x8c2b('0x2f')]));if(_0xa42d36['query'][_0x8c2b('0x4a')]){_0x418846['where']=_[_0x8c2b('0x39')](_0x418846[_0x8c2b('0x37')],{'$or':_[_0x8c2b('0x28')](_0x418846['attributes'],function(_0x21b75f){var _0x34e0d4={};_0x34e0d4[_0x21b75f]={'$like':'%'+_0xa42d36[_0x8c2b('0x2e')][_0x8c2b('0x4a')]+'%'};return _0x34e0d4;})});}_0x418846=_['merge']({},_0x418846,_0xa42d36[_0x8c2b('0x40')]);return _0x58de81['getDescriptions'](_0x418846);}})['then'](function(_0x48f6ff){if(_0x48f6ff){_0x5d535f=_0x48f6ff[_0x8c2b('0x48')];if(!_0xa42d36['query'][_0x8c2b('0x33')](_0x8c2b('0x34'))){_0x418846[_0x8c2b('0x1d')]=qs[_0x8c2b('0x1d')](_0xa42d36['query'][_0x8c2b('0x1d')]);_0x418846[_0x8c2b('0x1b')]=qs[_0x8c2b('0x1b')](_0xa42d36[_0x8c2b('0x2e')][_0x8c2b('0x1b')]);}return _0x58de81[_0x8c2b('0x4c')](_0x418846);}})[_0x8c2b('0x24')](function(_0x371b7f){if(_0x371b7f){return _0x371b7f?{'count':_0x5d535f,'rows':_0x371b7f}:null;}})['then'](respondWithResult(_0x2b4cdb,null))['catch'](handleError(_0x2b4cdb,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index e304081..8be089e 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 _0x6c6f=['api','moment','bluebird','request-promise','path','rimraf','define','SalesforceConfiguration','util','../../config/logger'];(function(_0x5a1105,_0x38fd58){var _0x35107c=function(_0x3fab82){while(--_0x3fab82){_0x5a1105['push'](_0x5a1105['shift']());}};_0x35107c(++_0x38fd58);}(_0x6c6f,0x170));var _0xf6c6=function(_0x5118d3,_0x18d444){_0x5118d3=_0x5118d3-0x0;var _0x462eb3=_0x6c6f[_0x5118d3];return _0x462eb3;};'use strict';var _=require('lodash');var util=require(_0xf6c6('0x0'));var logger=require(_0xf6c6('0x1'))(_0xf6c6('0x2'));var moment=require(_0xf6c6('0x3'));var BPromise=require(_0xf6c6('0x4'));var rp=require(_0xf6c6('0x5'));var fs=require('fs');var path=require(_0xf6c6('0x6'));var rimraf=require(_0xf6c6('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x4e3a59,_0x24c051){return _0x4e3a59[_0xf6c6('0x8')](_0xf6c6('0x9'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa57e=['int_salesforce_configurations','lodash','../../config/logger','api','moment','define','SalesforceConfiguration'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xa57e,0x10b));var _0xea57=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa57e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xea57('0x0'));var util=require('util');var logger=require(_0xea57('0x1'))(_0xea57('0x2'));var moment=require(_0xea57('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('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x5b481d,_0xa5ca8e){return _0x5b481d[_0xea57('0x4')](_0xea57('0x5'),attributes,{'tableName':_0xea57('0x6'),'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 e2c3c38..6a415a5 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 _0x2139=['then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1b626b,_0x4e4c0d){var _0x55acf3=function(_0x420b05){while(--_0x420b05){_0x1b626b['push'](_0x1b626b['shift']());}};_0x55acf3(++_0x4e4c0d);}(_0x2139,0x1c2));var _0x9213=function(_0x1fd7f9,_0x3a6db0){_0x1fd7f9=_0x1fd7f9-0x0;var _0x96182f=_0x2139[_0x1fd7f9];return _0x96182f;};'use strict';var _=require(_0x9213('0x0'));var util=require(_0x9213('0x1'));var moment=require(_0x9213('0x2'));var BPromise=require('bluebird');var rs=require(_0x9213('0x3'));var fs=require('fs');var Redis=require(_0x9213('0x4'));var db=require(_0x9213('0x5'))['db'];var utils=require(_0x9213('0x6'));var logger=require(_0x9213('0x7'))(_0x9213('0x8'));var config=require(_0x9213('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9213('0xa')][_0x9213('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38664f,_0x5e4b44,_0x79bd03){return new BPromise(function(_0x49e6f0,_0xfaddf9){return client['request'](_0x38664f,_0x79bd03)[_0x9213('0xc')](function(_0x44b81e){logger[_0x9213('0xd')](_0x9213('0xe'),_0x5e4b44,_0x9213('0xf'));logger[_0x9213('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x5e4b44,_0x9213('0xf'),JSON['stringify'](_0x44b81e));if(_0x44b81e['error']){if(_0x44b81e[_0x9213('0x11')][_0x9213('0x12')]===0x1f4){logger[_0x9213('0x11')](_0x9213('0xe'),_0x5e4b44,_0x44b81e[_0x9213('0x11')][_0x9213('0x13')]);return _0xfaddf9(_0x44b81e[_0x9213('0x11')][_0x9213('0x13')]);}logger['error'](_0x9213('0xe'),_0x5e4b44,_0x44b81e[_0x9213('0x11')][_0x9213('0x13')]);return _0x49e6f0(_0x44b81e[_0x9213('0x11')]['message']);}else{logger[_0x9213('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5e4b44,_0x9213('0xf'));_0x49e6f0(_0x44b81e[_0x9213('0x14')][_0x9213('0x13')]);}})['catch'](function(_0x2b4124){logger[_0x9213('0x11')](_0x9213('0xe'),_0x5e4b44,_0x2b4124);_0xfaddf9(_0x2b4124);});});} \ No newline at end of file +var _0x22e9=['then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x22e9,0x136));var _0x922e=function(_0x119d13,_0x263cd2){_0x119d13=_0x119d13-0x0;var _0x333c35=_0x22e9[_0x119d13];return _0x333c35;};'use strict';var _=require(_0x922e('0x0'));var util=require('util');var moment=require(_0x922e('0x1'));var BPromise=require(_0x922e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x922e('0x3'));var db=require(_0x922e('0x4'))['db'];var utils=require(_0x922e('0x5'));var logger=require(_0x922e('0x6'))(_0x922e('0x7'));var config=require(_0x922e('0x8'));var jayson=require(_0x922e('0x9'));var client=jayson[_0x922e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x559b99,_0x85671,_0x3d2767){return new BPromise(function(_0x3b32c9,_0xb10455){return client[_0x922e('0xb')](_0x559b99,_0x3d2767)[_0x922e('0xc')](function(_0x187473){logger[_0x922e('0xd')](_0x922e('0xe'),_0x85671,'request\x20sent');logger[_0x922e('0xf')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x85671,_0x922e('0x10'),JSON[_0x922e('0x11')](_0x187473));if(_0x187473['error']){if(_0x187473['error'][_0x922e('0x12')]===0x1f4){logger[_0x922e('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x85671,_0x187473[_0x922e('0x13')][_0x922e('0x14')]);return _0xb10455(_0x187473[_0x922e('0x13')][_0x922e('0x14')]);}logger[_0x922e('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x85671,_0x187473['error'][_0x922e('0x14')]);return _0x3b32c9(_0x187473[_0x922e('0x13')][_0x922e('0x14')]);}else{logger[_0x922e('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x85671,_0x922e('0x10'));_0x3b32c9(_0x187473[_0x922e('0x15')]['message']);}})[_0x922e('0x16')](function(_0x4ac3b8){logger[_0x922e('0x13')](_0x922e('0xe'),_0x85671,_0x4ac3b8);_0xb10455(_0x4ac3b8);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index d8b2239..a228a5e 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 _0x95ee=['isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2ddfd9,_0x5877d0){var _0x2668f0=function(_0x70ad6f){while(--_0x70ad6f){_0x2ddfd9['push'](_0x2ddfd9['shift']());}};_0x2668f0(++_0x5877d0);}(_0x95ee,0x114));var _0xe95e=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x95ee[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0xe95e('0x0'));var util=require('util');var path=require(_0xe95e('0x1'));var timeout=require('connect-timeout');var express=require(_0xe95e('0x2'));var router=express[_0xe95e('0x3')]();var fs_extra=require(_0xe95e('0x4'));var auth=require(_0xe95e('0x5'));var interaction=require(_0xe95e('0x6'));var config=require(_0xe95e('0x7'));var controller=require('./intSalesforceField.controller');router[_0xe95e('0x8')]('/',auth[_0xe95e('0x9')](),controller[_0xe95e('0xa')]);router['get'](_0xe95e('0xb'),auth['isAuthenticated'](),controller[_0xe95e('0xc')]);router[_0xe95e('0xd')]('/',auth[_0xe95e('0x9')](),controller[_0xe95e('0xe')]);router['put'](_0xe95e('0xb'),auth[_0xe95e('0x9')](),controller[_0xe95e('0xf')]);router[_0xe95e('0x10')](_0xe95e('0xb'),auth[_0xe95e('0x9')](),controller[_0xe95e('0x11')]);module[_0xe95e('0x12')]=router; \ No newline at end of file +var _0x905a=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x905a,0x1e7));var _0xa905=function(_0x210853,_0x32af2b){_0x210853=_0x210853-0x0;var _0x14c5a1=_0x905a[_0x210853];return _0x14c5a1;};'use strict';var multer=require(_0xa905('0x0'));var util=require(_0xa905('0x1'));var path=require(_0xa905('0x2'));var timeout=require(_0xa905('0x3'));var express=require('express');var router=express[_0xa905('0x4')]();var fs_extra=require(_0xa905('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa905('0x6'));var config=require('../../config/environment');var controller=require(_0xa905('0x7'));router[_0xa905('0x8')]('/',auth[_0xa905('0x9')](),controller[_0xa905('0xa')]);router[_0xa905('0x8')](_0xa905('0xb'),auth[_0xa905('0x9')](),controller[_0xa905('0xc')]);router[_0xa905('0xd')]('/',auth[_0xa905('0x9')](),controller[_0xa905('0xe')]);router[_0xa905('0xf')](_0xa905('0xb'),auth[_0xa905('0x9')](),controller[_0xa905('0x10')]);router[_0xa905('0x11')](_0xa905('0xb'),auth[_0xa905('0x9')](),controller[_0xa905('0x12')]);module[_0xa905('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index d064753..b657ac0 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 _0x061f=['sequelize','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x50e0f1,_0x2b98c4){var _0x3c53fc=function(_0x31e27b){while(--_0x31e27b){_0x50e0f1['push'](_0x50e0f1['shift']());}};_0x3c53fc(++_0x2b98c4);}(_0x061f,0x70));var _0xf061=function(_0x244aa8,_0x18fba7){_0x244aa8=_0x244aa8-0x0;var _0x2eeb89=_0x061f[_0x244aa8];return _0x2eeb89;};'use strict';var Sequelize=require(_0xf061('0x0'));module['exports']={'type':{'type':Sequelize[_0xf061('0x1')](_0xf061('0x2'),_0xf061('0x3'),_0xf061('0x4'),_0xf061('0x5'),'picklist'),'defaultValue':_0xf061('0x2')},'content':{'type':Sequelize[_0xf061('0x6')]},'key':{'type':Sequelize[_0xf061('0x6')]},'keyType':{'type':Sequelize[_0xf061('0x1')](_0xf061('0x2'),_0xf061('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xf061('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xf061('0x6')]}}; \ No newline at end of file +var _0x1850=['string','variable','customVariable','STRING','ENUM'];(function(_0x36bbbb,_0x3f6709){var _0x3ca0eb=function(_0x299763){while(--_0x299763){_0x36bbbb['push'](_0x36bbbb['shift']());}};_0x3ca0eb(++_0x3f6709);}(_0x1850,0xe0));var _0x0185=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1850[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x0185('0x0')](_0x0185('0x1'),_0x0185('0x2'),_0x0185('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x0185('0x4')]},'key':{'type':Sequelize[_0x0185('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x0185('0x1'),_0x0185('0x2'),_0x0185('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x0185('0x4')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 4ab5ec4..f7ef0cb 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 _0x0a02=['find','create','body','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','SalesforceField','include','findAll','rows','catch','show','includeAll','options'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0x0a02,0x134));var _0x20a0=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0x0a02[_0x2962d5];return _0x273406;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20a0('0x0'));var zipdir=require(_0x20a0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x20a0('0x2'));var moment=require(_0x20a0('0x3'));var BPromise=require(_0x20a0('0x4'));var Mustache=require(_0x20a0('0x5'));var util=require(_0x20a0('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x20a0('0x7'));var ejs=require(_0x20a0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x20a0('0x9'));var squel=require(_0x20a0('0xa'));var crypto=require(_0x20a0('0xb'));var jsforce=require(_0x20a0('0xc'));var deskjs=require(_0x20a0('0xd'));var toCsv=require(_0x20a0('0x7'));var querystring=require(_0x20a0('0xe'));var Papa=require(_0x20a0('0xf'));var Redis=require('ioredis');var authService=require(_0x20a0('0x10'));var qs=require(_0x20a0('0x11'));var as=require(_0x20a0('0x12'));var hardwareService=require(_0x20a0('0x13'));var logger=require('../../config/logger')(_0x20a0('0x14'));var utils=require(_0x20a0('0x15'));var config=require(_0x20a0('0x16'));var licenseUtil=require(_0x20a0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x118604,_0x1bdc33){_0x1bdc33=_0x1bdc33||0xcc;return function(_0x1ceb01){if(_0x1ceb01){return _0x118604[_0x20a0('0x18')](_0x1bdc33);}return _0x118604[_0x20a0('0x19')](_0x1bdc33)[_0x20a0('0x1a')]();};}function respondWithResult(_0x5c9dd8,_0x226607){_0x226607=_0x226607||0xc8;return function(_0xae4786){if(_0xae4786){return _0x5c9dd8[_0x20a0('0x19')](_0x226607)[_0x20a0('0x1b')](_0xae4786);}};}function respondWithFilteredResult(_0x531dd8,_0x49f821){return function(_0x5b4c47){if(_0x5b4c47){var _0x38568b=typeof _0x49f821[_0x20a0('0x1c')]==='undefined'&&typeof _0x49f821[_0x20a0('0x1d')]===_0x20a0('0x1e');var _0x2148de=_0x5b4c47[_0x20a0('0x1f')];var _0x7d314b=_0x38568b?0x0:_0x49f821[_0x20a0('0x1c')];var _0x1f8040=_0x38568b?_0x5b4c47['count']:_0x49f821[_0x20a0('0x1c')]+_0x49f821['limit'];var _0x15d515;if(_0x1f8040>=_0x2148de){_0x1f8040=_0x2148de;_0x15d515=0xc8;}else{_0x15d515=0xce;}_0x531dd8[_0x20a0('0x19')](_0x15d515);return _0x531dd8[_0x20a0('0x20')](_0x20a0('0x21'),_0x7d314b+'-'+_0x1f8040+'/'+_0x2148de)['json'](_0x5b4c47);}return null;};}function patchUpdates(_0x50623f){return function(_0x4b3bbc){try{jsonpatch[_0x20a0('0x22')](_0x4b3bbc,_0x50623f,!![]);}catch(_0x9ec614){return BPromise[_0x20a0('0x23')](_0x9ec614);}return _0x4b3bbc[_0x20a0('0x24')]();};}function saveUpdates(_0x53f4ce,_0x4edff1){return function(_0x39fdfa){if(_0x39fdfa){return _0x39fdfa[_0x20a0('0x25')](_0x53f4ce)[_0x20a0('0x26')](function(_0x45a9c9){return _0x45a9c9;});}return null;};}function removeEntity(_0x4c0e1a,_0xb3ae1){return function(_0x3c093e){if(_0x3c093e){return _0x3c093e[_0x20a0('0x27')]()[_0x20a0('0x26')](function(){_0x4c0e1a['status'](0xcc)[_0x20a0('0x1a')]();});}};}function handleEntityNotFound(_0x4f6eba,_0x370c3e){return function(_0xe1a487){if(!_0xe1a487){_0x4f6eba[_0x20a0('0x18')](0x194);}return _0xe1a487;};}function handleError(_0x16a04c,_0x2448b9){_0x2448b9=_0x2448b9||0x1f4;return function(_0xf76722){logger[_0x20a0('0x28')](_0xf76722[_0x20a0('0x29')]);if(_0xf76722[_0x20a0('0x2a')]){delete _0xf76722[_0x20a0('0x2a')];}_0x16a04c[_0x20a0('0x19')](_0x2448b9)['send'](_0xf76722);};}exports['index']=function(_0x24eb5c,_0x330d4f){var _0x4ffa9a={},_0x3beed3={},_0x26b28f={'count':0x0,'rows':[]};var _0x2555ba=_[_0x20a0('0x2b')](db['SalesforceField'][_0x20a0('0x2c')],function(_0x378e47){return{'name':_0x378e47[_0x20a0('0x2d')],'type':_0x378e47[_0x20a0('0x2e')][_0x20a0('0x2f')]};});_0x3beed3[_0x20a0('0x30')]=_['map'](_0x2555ba,_0x20a0('0x2a'));_0x3beed3[_0x20a0('0x31')]=_[_0x20a0('0x32')](_0x24eb5c['query']);_0x3beed3[_0x20a0('0x33')]=_[_0x20a0('0x34')](_0x3beed3[_0x20a0('0x30')],_0x3beed3[_0x20a0('0x31')]);_0x4ffa9a[_0x20a0('0x35')]=_[_0x20a0('0x34')](_0x3beed3[_0x20a0('0x30')],qs['fields'](_0x24eb5c['query'][_0x20a0('0x36')]));_0x4ffa9a[_0x20a0('0x35')]=_0x4ffa9a[_0x20a0('0x35')][_0x20a0('0x37')]?_0x4ffa9a[_0x20a0('0x35')]:_0x3beed3['model'];if(!_0x24eb5c[_0x20a0('0x31')][_0x20a0('0x38')](_0x20a0('0x39'))){_0x4ffa9a[_0x20a0('0x1d')]=qs[_0x20a0('0x1d')](_0x24eb5c[_0x20a0('0x31')][_0x20a0('0x1d')]);_0x4ffa9a[_0x20a0('0x1c')]=qs[_0x20a0('0x1c')](_0x24eb5c[_0x20a0('0x31')][_0x20a0('0x1c')]);}_0x4ffa9a[_0x20a0('0x3a')]=qs[_0x20a0('0x3b')](_0x24eb5c[_0x20a0('0x31')]['sort']);_0x4ffa9a[_0x20a0('0x3c')]=qs[_0x20a0('0x33')](_['pick'](_0x24eb5c[_0x20a0('0x31')],_0x3beed3[_0x20a0('0x33')]),_0x2555ba);if(_0x24eb5c['query'][_0x20a0('0x3d')]){_0x4ffa9a[_0x20a0('0x3c')]=_[_0x20a0('0x3e')](_0x4ffa9a[_0x20a0('0x3c')],{'$or':_['map'](_0x2555ba,function(_0xe81303){if(_0xe81303[_0x20a0('0x2e')]!==_0x20a0('0x3f')){var _0x305c89={};_0x305c89[_0xe81303[_0x20a0('0x2a')]]={'$like':'%'+_0x24eb5c[_0x20a0('0x31')][_0x20a0('0x3d')]+'%'};return _0x305c89;}})});}_0x4ffa9a=_[_0x20a0('0x3e')]({},_0x4ffa9a,_0x24eb5c['options']);var _0x5914ba={'where':_0x4ffa9a['where']};return db[_0x20a0('0x40')][_0x20a0('0x1f')](_0x5914ba)[_0x20a0('0x26')](function(_0x5cb10d){_0x26b28f['count']=_0x5cb10d;if(_0x24eb5c['query']['includeAll']){_0x4ffa9a[_0x20a0('0x41')]=[{'all':!![]}];}return db[_0x20a0('0x40')][_0x20a0('0x42')](_0x4ffa9a);})['then'](function(_0x3c4172){_0x26b28f[_0x20a0('0x43')]=_0x3c4172;return _0x26b28f;})[_0x20a0('0x26')](respondWithFilteredResult(_0x330d4f,_0x4ffa9a))[_0x20a0('0x44')](handleError(_0x330d4f,null));};exports[_0x20a0('0x45')]=function(_0x5f3a6f,_0x3182a2){var _0x111a52={'raw':!![],'where':{'id':_0x5f3a6f['params']['id']}},_0x3e04b6={};_0x3e04b6[_0x20a0('0x30')]=_['keys'](db[_0x20a0('0x40')][_0x20a0('0x2c')]);_0x3e04b6[_0x20a0('0x31')]=_[_0x20a0('0x32')](_0x5f3a6f[_0x20a0('0x31')]);_0x3e04b6[_0x20a0('0x33')]=_[_0x20a0('0x34')](_0x3e04b6[_0x20a0('0x30')],_0x3e04b6[_0x20a0('0x31')]);_0x111a52[_0x20a0('0x35')]=_[_0x20a0('0x34')](_0x3e04b6[_0x20a0('0x30')],qs['fields'](_0x5f3a6f[_0x20a0('0x31')][_0x20a0('0x36')]));_0x111a52[_0x20a0('0x35')]=_0x111a52[_0x20a0('0x35')][_0x20a0('0x37')]?_0x111a52[_0x20a0('0x35')]:_0x3e04b6[_0x20a0('0x30')];if(_0x5f3a6f['query'][_0x20a0('0x46')]){_0x111a52[_0x20a0('0x41')]=[{'all':!![]}];}_0x111a52=_[_0x20a0('0x3e')]({},_0x111a52,_0x5f3a6f[_0x20a0('0x47')]);return db[_0x20a0('0x40')][_0x20a0('0x48')](_0x111a52)[_0x20a0('0x26')](handleEntityNotFound(_0x3182a2,null))[_0x20a0('0x26')](respondWithResult(_0x3182a2,null))[_0x20a0('0x44')](handleError(_0x3182a2,null));};exports[_0x20a0('0x49')]=function(_0x15fc40,_0x473d67){return db[_0x20a0('0x40')]['create'](_0x15fc40[_0x20a0('0x4a')],{})[_0x20a0('0x26')](respondWithResult(_0x473d67,0xc9))[_0x20a0('0x44')](handleError(_0x473d67,null));};exports[_0x20a0('0x25')]=function(_0x4a0161,_0x4a10e5){if(_0x4a0161['body']['id']){delete _0x4a0161[_0x20a0('0x4a')]['id'];}return db['SalesforceField'][_0x20a0('0x48')]({'where':{'id':_0x4a0161[_0x20a0('0x4b')]['id']}})[_0x20a0('0x26')](handleEntityNotFound(_0x4a10e5,null))[_0x20a0('0x26')](saveUpdates(_0x4a0161[_0x20a0('0x4a')],null))[_0x20a0('0x26')](respondWithResult(_0x4a10e5,null))[_0x20a0('0x44')](handleError(_0x4a10e5,null));};exports['destroy']=function(_0x982e98,_0x284328){return db['SalesforceField'][_0x20a0('0x48')]({'where':{'id':_0x982e98[_0x20a0('0x4b')]['id']}})[_0x20a0('0x26')](handleEntityNotFound(_0x284328,null))['then'](removeEntity(_0x284328,null))[_0x20a0('0x44')](handleError(_0x284328,null));}; \ No newline at end of file +var _0x8ffa=['Content-Range','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','SalesforceField','intersection','catch','create','body','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x8ffa,0x74));var _0xa8ff=function(_0x2c5b29,_0x550ca7){_0x2c5b29=_0x2c5b29-0x0;var _0x219db2=_0x8ffa[_0x2c5b29];return _0x219db2;};'use strict';var emlformat=require(_0xa8ff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa8ff('0x1'));var jsonpatch=require(_0xa8ff('0x2'));var rp=require(_0xa8ff('0x3'));var moment=require(_0xa8ff('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa8ff('0x5'));var path=require(_0xa8ff('0x6'));var sox=require(_0xa8ff('0x7'));var csv=require(_0xa8ff('0x8'));var ejs=require(_0xa8ff('0x9'));var fs=require('fs');var fs_extra=require(_0xa8ff('0xa'));var _=require(_0xa8ff('0xb'));var squel=require('squel');var crypto=require(_0xa8ff('0xc'));var jsforce=require(_0xa8ff('0xd'));var deskjs=require(_0xa8ff('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa8ff('0xf'));var Papa=require(_0xa8ff('0x10'));var Redis=require('ioredis');var authService=require(_0xa8ff('0x11'));var qs=require(_0xa8ff('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa8ff('0x13'));var logger=require(_0xa8ff('0x14'))('api');var utils=require(_0xa8ff('0x15'));var config=require(_0xa8ff('0x16'));var licenseUtil=require(_0xa8ff('0x17'));var db=require(_0xa8ff('0x18'))['db'];function respondWithStatusCode(_0x3cf6d9,_0x5eba0e){_0x5eba0e=_0x5eba0e||0xcc;return function(_0x410cd8){if(_0x410cd8){return _0x3cf6d9[_0xa8ff('0x19')](_0x5eba0e);}return _0x3cf6d9[_0xa8ff('0x1a')](_0x5eba0e)[_0xa8ff('0x1b')]();};}function respondWithResult(_0x13bf8c,_0x27eeee){_0x27eeee=_0x27eeee||0xc8;return function(_0x12ca8b){if(_0x12ca8b){return _0x13bf8c['status'](_0x27eeee)[_0xa8ff('0x1c')](_0x12ca8b);}};}function respondWithFilteredResult(_0x534929,_0x54d9aa){return function(_0x450f8d){if(_0x450f8d){var _0xc40078=typeof _0x54d9aa[_0xa8ff('0x1d')]===_0xa8ff('0x1e')&&typeof _0x54d9aa[_0xa8ff('0x1f')]===_0xa8ff('0x1e');var _0x138f6e=_0x450f8d[_0xa8ff('0x20')];var _0x5e622d=_0xc40078?0x0:_0x54d9aa['offset'];var _0x5f4a9e=_0xc40078?_0x450f8d[_0xa8ff('0x20')]:_0x54d9aa['offset']+_0x54d9aa[_0xa8ff('0x1f')];var _0x38d86c;if(_0x5f4a9e>=_0x138f6e){_0x5f4a9e=_0x138f6e;_0x38d86c=0xc8;}else{_0x38d86c=0xce;}_0x534929[_0xa8ff('0x1a')](_0x38d86c);return _0x534929[_0xa8ff('0x21')](_0xa8ff('0x22'),_0x5e622d+'-'+_0x5f4a9e+'/'+_0x138f6e)[_0xa8ff('0x1c')](_0x450f8d);}return null;};}function patchUpdates(_0x57fe1b){return function(_0x5d5758){try{jsonpatch['apply'](_0x5d5758,_0x57fe1b,!![]);}catch(_0x3502d9){return BPromise[_0xa8ff('0x23')](_0x3502d9);}return _0x5d5758[_0xa8ff('0x24')]();};}function saveUpdates(_0xc036f1,_0x11e852){return function(_0x234c60){if(_0x234c60){return _0x234c60[_0xa8ff('0x25')](_0xc036f1)[_0xa8ff('0x26')](function(_0x36e304){return _0x36e304;});}return null;};}function removeEntity(_0xb2012d,_0xe0ddf2){return function(_0x4de77){if(_0x4de77){return _0x4de77[_0xa8ff('0x27')]()[_0xa8ff('0x26')](function(){_0xb2012d[_0xa8ff('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e6651,_0x33a110){return function(_0x4f6b66){if(!_0x4f6b66){_0x5e6651['sendStatus'](0x194);}return _0x4f6b66;};}function handleError(_0x2ebe6c,_0x48a2ef){_0x48a2ef=_0x48a2ef||0x1f4;return function(_0x4e3fc5){logger[_0xa8ff('0x28')](_0x4e3fc5['stack']);if(_0x4e3fc5[_0xa8ff('0x29')]){delete _0x4e3fc5[_0xa8ff('0x29')];}_0x2ebe6c[_0xa8ff('0x1a')](_0x48a2ef)[_0xa8ff('0x2a')](_0x4e3fc5);};}exports[_0xa8ff('0x2b')]=function(_0x41ab86,_0x43adc0){var _0x5440ef={},_0x311bc3={},_0x1a5ca7={'count':0x0,'rows':[]};var _0x5704cf=_['map'](db['SalesforceField'][_0xa8ff('0x2c')],function(_0x185b3a){return{'name':_0x185b3a[_0xa8ff('0x2d')],'type':_0x185b3a[_0xa8ff('0x2e')][_0xa8ff('0x2f')]};});_0x311bc3[_0xa8ff('0x30')]=_[_0xa8ff('0x31')](_0x5704cf,_0xa8ff('0x29'));_0x311bc3[_0xa8ff('0x32')]=_[_0xa8ff('0x33')](_0x41ab86[_0xa8ff('0x32')]);_0x311bc3[_0xa8ff('0x34')]=_['intersection'](_0x311bc3[_0xa8ff('0x30')],_0x311bc3['query']);_0x5440ef[_0xa8ff('0x35')]=_['intersection'](_0x311bc3[_0xa8ff('0x30')],qs[_0xa8ff('0x36')](_0x41ab86[_0xa8ff('0x32')][_0xa8ff('0x36')]));_0x5440ef[_0xa8ff('0x35')]=_0x5440ef['attributes'][_0xa8ff('0x37')]?_0x5440ef[_0xa8ff('0x35')]:_0x311bc3[_0xa8ff('0x30')];if(!_0x41ab86[_0xa8ff('0x32')][_0xa8ff('0x38')](_0xa8ff('0x39'))){_0x5440ef['limit']=qs[_0xa8ff('0x1f')](_0x41ab86['query'][_0xa8ff('0x1f')]);_0x5440ef[_0xa8ff('0x1d')]=qs[_0xa8ff('0x1d')](_0x41ab86['query'][_0xa8ff('0x1d')]);}_0x5440ef[_0xa8ff('0x3a')]=qs[_0xa8ff('0x3b')](_0x41ab86[_0xa8ff('0x32')][_0xa8ff('0x3b')]);_0x5440ef[_0xa8ff('0x3c')]=qs['filters'](_[_0xa8ff('0x3d')](_0x41ab86[_0xa8ff('0x32')],_0x311bc3[_0xa8ff('0x34')]),_0x5704cf);if(_0x41ab86[_0xa8ff('0x32')][_0xa8ff('0x3e')]){_0x5440ef[_0xa8ff('0x3c')]=_['merge'](_0x5440ef[_0xa8ff('0x3c')],{'$or':_[_0xa8ff('0x31')](_0x5704cf,function(_0x541356){if(_0x541356['type']!==_0xa8ff('0x3f')){var _0x3a6c9c={};_0x3a6c9c[_0x541356[_0xa8ff('0x29')]]={'$like':'%'+_0x41ab86[_0xa8ff('0x32')]['filter']+'%'};return _0x3a6c9c;}})});}_0x5440ef=_[_0xa8ff('0x40')]({},_0x5440ef,_0x41ab86[_0xa8ff('0x41')]);var _0x547746={'where':_0x5440ef[_0xa8ff('0x3c')]};return db['SalesforceField']['count'](_0x547746)['then'](function(_0x127de9){_0x1a5ca7[_0xa8ff('0x20')]=_0x127de9;if(_0x41ab86[_0xa8ff('0x32')][_0xa8ff('0x42')]){_0x5440ef[_0xa8ff('0x43')]=[{'all':!![]}];}return db[_0xa8ff('0x44')]['findAll'](_0x5440ef);})[_0xa8ff('0x26')](function(_0x30a3bb){_0x1a5ca7['rows']=_0x30a3bb;return _0x1a5ca7;})['then'](respondWithFilteredResult(_0x43adc0,_0x5440ef))['catch'](handleError(_0x43adc0,null));};exports['show']=function(_0x2048f2,_0x23b2f9){var _0x10c50f={'raw':!![],'where':{'id':_0x2048f2['params']['id']}},_0x562e4b={};_0x562e4b[_0xa8ff('0x30')]=_[_0xa8ff('0x33')](db[_0xa8ff('0x44')][_0xa8ff('0x2c')]);_0x562e4b[_0xa8ff('0x32')]=_[_0xa8ff('0x33')](_0x2048f2['query']);_0x562e4b[_0xa8ff('0x34')]=_[_0xa8ff('0x45')](_0x562e4b[_0xa8ff('0x30')],_0x562e4b[_0xa8ff('0x32')]);_0x10c50f[_0xa8ff('0x35')]=_[_0xa8ff('0x45')](_0x562e4b[_0xa8ff('0x30')],qs[_0xa8ff('0x36')](_0x2048f2[_0xa8ff('0x32')][_0xa8ff('0x36')]));_0x10c50f[_0xa8ff('0x35')]=_0x10c50f[_0xa8ff('0x35')][_0xa8ff('0x37')]?_0x10c50f[_0xa8ff('0x35')]:_0x562e4b['model'];if(_0x2048f2['query'][_0xa8ff('0x42')]){_0x10c50f[_0xa8ff('0x43')]=[{'all':!![]}];}_0x10c50f=_[_0xa8ff('0x40')]({},_0x10c50f,_0x2048f2[_0xa8ff('0x41')]);return db[_0xa8ff('0x44')]['find'](_0x10c50f)['then'](handleEntityNotFound(_0x23b2f9,null))[_0xa8ff('0x26')](respondWithResult(_0x23b2f9,null))[_0xa8ff('0x46')](handleError(_0x23b2f9,null));};exports[_0xa8ff('0x47')]=function(_0x1eb9dc,_0x4e4377){return db[_0xa8ff('0x44')][_0xa8ff('0x47')](_0x1eb9dc[_0xa8ff('0x48')],{})[_0xa8ff('0x26')](respondWithResult(_0x4e4377,0xc9))['catch'](handleError(_0x4e4377,null));};exports['update']=function(_0x2c546f,_0x276a7c){if(_0x2c546f[_0xa8ff('0x48')]['id']){delete _0x2c546f['body']['id'];}return db[_0xa8ff('0x44')][_0xa8ff('0x49')]({'where':{'id':_0x2c546f[_0xa8ff('0x4a')]['id']}})[_0xa8ff('0x26')](handleEntityNotFound(_0x276a7c,null))[_0xa8ff('0x26')](saveUpdates(_0x2c546f['body'],null))[_0xa8ff('0x26')](respondWithResult(_0x276a7c,null))[_0xa8ff('0x46')](handleError(_0x276a7c,null));};exports[_0xa8ff('0x27')]=function(_0x5d610d,_0x5a4a95){return db[_0xa8ff('0x44')]['find']({'where':{'id':_0x5d610d[_0xa8ff('0x4a')]['id']}})[_0xa8ff('0x26')](handleEntityNotFound(_0x5a4a95,null))[_0xa8ff('0x26')](removeEntity(_0x5a4a95,null))[_0xa8ff('0x46')](handleError(_0x5a4a95,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 1605a5a..6fdb236 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 _0xcf22=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xcf22,0xf0));var _0x2cf2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xcf22[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x2cf2('0x0'));var util=require(_0x2cf2('0x1'));var logger=require(_0x2cf2('0x2'))(_0x2cf2('0x3'));var moment=require(_0x2cf2('0x4'));var BPromise=require(_0x2cf2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cf2('0x6'));var rimraf=require(_0x2cf2('0x7'));var config=require(_0x2cf2('0x8'));var attributes=require(_0x2cf2('0x9'));module[_0x2cf2('0xa')]=function(_0x3e7c9a,_0x242d51){return _0x3e7c9a[_0x2cf2('0xb')](_0x2cf2('0xc'),attributes,{'tableName':_0x2cf2('0xd'),'paranoid':![],'indexes':[{'name':_0x2cf2('0xe'),'fields':[_0x2cf2('0xf'),_0x2cf2('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb798=['exports','define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0xb798,0x1d7));var _0x8b79=function(_0x4c6f55,_0x2a3f06){_0x4c6f55=_0x4c6f55-0x0;var _0x299457=_0xb798[_0x4c6f55];return _0x299457;};'use strict';var _=require(_0x8b79('0x0'));var util=require('util');var logger=require(_0x8b79('0x1'))(_0x8b79('0x2'));var moment=require(_0x8b79('0x3'));var BPromise=require(_0x8b79('0x4'));var rp=require(_0x8b79('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b79('0x6'));var config=require(_0x8b79('0x7'));var attributes=require(_0x8b79('0x8'));module[_0x8b79('0x9')]=function(_0x140442,_0x501c8a){return _0x140442[_0x8b79('0xa')](_0x8b79('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x8b79('0xc'),'fields':[_0x8b79('0xd'),_0x8b79('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index a38a62f..547cd9c 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 _0x4699=['error','code','SalesforceField,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x1707eb,_0x520e7e){var _0x31172f=function(_0x5297a6){while(--_0x5297a6){_0x1707eb['push'](_0x1707eb['shift']());}};_0x31172f(++_0x520e7e);}(_0x4699,0x15b));var _0x9469=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4699[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9469('0x0'));var util=require(_0x9469('0x1'));var moment=require(_0x9469('0x2'));var BPromise=require('bluebird');var rs=require(_0x9469('0x3'));var fs=require('fs');var Redis=require(_0x9469('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9469('0x5'))('rpc');var config=require(_0x9469('0x6'));var jayson=require(_0x9469('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x286091,_0x241f83,_0x42931f){return new BPromise(function(_0x318808,_0x2f22cb){return client[_0x9469('0x8')](_0x286091,_0x42931f)[_0x9469('0x9')](function(_0xd75f2f){logger[_0x9469('0xa')]('SalesforceField,\x20%s,\x20%s',_0x241f83,_0x9469('0xb'));logger[_0x9469('0xc')](_0x9469('0xd'),_0x241f83,_0x9469('0xb'),JSON['stringify'](_0xd75f2f));if(_0xd75f2f[_0x9469('0xe')]){if(_0xd75f2f[_0x9469('0xe')][_0x9469('0xf')]===0x1f4){logger[_0x9469('0xe')](_0x9469('0x10'),_0x241f83,_0xd75f2f[_0x9469('0xe')][_0x9469('0x11')]);return _0x2f22cb(_0xd75f2f[_0x9469('0xe')][_0x9469('0x11')]);}logger[_0x9469('0xe')](_0x9469('0x10'),_0x241f83,_0xd75f2f[_0x9469('0xe')][_0x9469('0x11')]);return _0x318808(_0xd75f2f[_0x9469('0xe')][_0x9469('0x11')]);}else{logger[_0x9469('0xa')](_0x9469('0x10'),_0x241f83,_0x9469('0xb'));_0x318808(_0xd75f2f[_0x9469('0x12')][_0x9469('0x11')]);}})['catch'](function(_0x40ced1){logger['error'](_0x9469('0x10'),_0x241f83,_0x40ced1);_0x2f22cb(_0x40ced1);});});} \ No newline at end of file +var _0x8bed=['SalesforceField,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x545fe3,_0x3b191f){var _0x480702=function(_0x21c970){while(--_0x21c970){_0x545fe3['push'](_0x545fe3['shift']());}};_0x480702(++_0x3b191f);}(_0x8bed,0x1aa));var _0xd8be=function(_0x39e9f4,_0x7da7be){_0x39e9f4=_0x39e9f4-0x0;var _0x16b495=_0x8bed[_0x39e9f4];return _0x16b495;};'use strict';var _=require(_0xd8be('0x0'));var util=require(_0xd8be('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd8be('0x2'));var fs=require('fs');var Redis=require(_0xd8be('0x3'));var db=require(_0xd8be('0x4'))['db'];var utils=require(_0xd8be('0x5'));var logger=require(_0xd8be('0x6'))(_0xd8be('0x7'));var config=require(_0xd8be('0x8'));var jayson=require(_0xd8be('0x9'));var client=jayson['client'][_0xd8be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa10d30,_0x1a8a60,_0x14f7ce){return new BPromise(function(_0x24bf0f,_0x54d197){return client[_0xd8be('0xb')](_0xa10d30,_0x14f7ce)[_0xd8be('0xc')](function(_0x2d89f6){logger[_0xd8be('0xd')](_0xd8be('0xe'),_0x1a8a60,'request\x20sent');logger[_0xd8be('0xf')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x1a8a60,_0xd8be('0x10'),JSON['stringify'](_0x2d89f6));if(_0x2d89f6[_0xd8be('0x11')]){if(_0x2d89f6[_0xd8be('0x11')][_0xd8be('0x12')]===0x1f4){logger[_0xd8be('0x11')](_0xd8be('0xe'),_0x1a8a60,_0x2d89f6['error'][_0xd8be('0x13')]);return _0x54d197(_0x2d89f6[_0xd8be('0x11')][_0xd8be('0x13')]);}logger[_0xd8be('0x11')]('SalesforceField,\x20%s,\x20%s',_0x1a8a60,_0x2d89f6[_0xd8be('0x11')]['message']);return _0x24bf0f(_0x2d89f6[_0xd8be('0x11')][_0xd8be('0x13')]);}else{logger[_0xd8be('0xd')]('SalesforceField,\x20%s,\x20%s',_0x1a8a60,_0xd8be('0x10'));_0x24bf0f(_0x2d89f6[_0xd8be('0x14')][_0xd8be('0x13')]);}})[_0xd8be('0x15')](function(_0x81143f){logger['error'](_0xd8be('0xe'),_0x1a8a60,_0x81143f);_0x54d197(_0x81143f);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 59e563a..b227c77 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 _0xb01a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router'];(function(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0xb01a,0xe0));var _0xab01=function(_0x2dc577,_0x4eb9d4){_0x2dc577=_0x2dc577-0x0;var _0x2dbdd6=_0xb01a[_0x2dc577];return _0x2dbdd6;};'use strict';var multer=require(_0xab01('0x0'));var util=require(_0xab01('0x1'));var path=require(_0xab01('0x2'));var timeout=require(_0xab01('0x3'));var express=require(_0xab01('0x4'));var router=express[_0xab01('0x5')]();var fs_extra=require(_0xab01('0x6'));var auth=require(_0xab01('0x7'));var interaction=require(_0xab01('0x8'));var config=require(_0xab01('0x9'));var controller=require(_0xab01('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xab01('0xb')]('/:id',auth[_0xab01('0xc')](),controller[_0xab01('0xd')]);router[_0xab01('0xb')](_0xab01('0xe'),auth[_0xab01('0xc')](),controller['getConfigurations']);router[_0xab01('0xb')](_0xab01('0xf'),auth[_0xab01('0xc')](),controller[_0xab01('0x10')]);router[_0xab01('0x11')]('/',auth[_0xab01('0xc')](),controller['create']);router[_0xab01('0x11')]('/:id/configurations',auth[_0xab01('0xc')](),controller[_0xab01('0x12')]);router[_0xab01('0x13')](_0xab01('0x14'),auth[_0xab01('0xc')](),controller[_0xab01('0x15')]);router[_0xab01('0x16')]('/:id',auth[_0xab01('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1b70=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x37bf74,_0x4ba4ba){var _0x4441b1=function(_0x3bca0c){while(--_0x3bca0c){_0x37bf74['push'](_0x37bf74['shift']());}};_0x4441b1(++_0x4ba4ba);}(_0x1b70,0xa7));var _0x01b7=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x1b70[_0x2aea9e];return _0x430b92;};'use strict';var multer=require(_0x01b7('0x0'));var util=require(_0x01b7('0x1'));var path=require(_0x01b7('0x2'));var timeout=require(_0x01b7('0x3'));var express=require(_0x01b7('0x4'));var router=express[_0x01b7('0x5')]();var fs_extra=require(_0x01b7('0x6'));var auth=require(_0x01b7('0x7'));var interaction=require(_0x01b7('0x8'));var config=require(_0x01b7('0x9'));var controller=require('./intServicenowAccount.controller');router[_0x01b7('0xa')]('/',auth[_0x01b7('0xb')](),controller[_0x01b7('0xc')]);router['get'](_0x01b7('0xd'),auth['isAuthenticated'](),controller[_0x01b7('0xe')]);router[_0x01b7('0xa')](_0x01b7('0xf'),auth[_0x01b7('0xb')](),controller['getConfigurations']);router[_0x01b7('0xa')](_0x01b7('0x10'),auth['isAuthenticated'](),controller[_0x01b7('0x11')]);router[_0x01b7('0x12')]('/',auth[_0x01b7('0xb')](),controller['create']);router[_0x01b7('0x12')]('/:id/configurations',auth[_0x01b7('0xb')](),controller[_0x01b7('0x13')]);router[_0x01b7('0x14')](_0x01b7('0xd'),auth['isAuthenticated'](),controller[_0x01b7('0x15')]);router[_0x01b7('0x16')](_0x01b7('0xd'),auth[_0x01b7('0xb')](),controller[_0x01b7('0x17')]);module[_0x01b7('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index c0f4782..3ae2777 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 _0x4132=['sequelize','STRING','remoteUri'];(function(_0x113357,_0x47b852){var _0x13119c=function(_0xf2ebff){while(--_0xf2ebff){_0x113357['push'](_0x113357['shift']());}};_0x13119c(++_0x47b852);}(_0x4132,0x132));var _0x2413=function(_0x359582,_0x3010a7){_0x359582=_0x359582-0x0;var _0x4b1b76=_0x4132[_0x359582];return _0x4b1b76;};'use strict';var Sequelize=require(_0x2413('0x0'));module['exports']={'name':{'type':Sequelize[_0x2413('0x1')]},'description':{'type':Sequelize[_0x2413('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x2413('0x1')]},'email':{'type':Sequelize[_0x2413('0x1')]},'remoteUri':{'type':Sequelize[_0x2413('0x1')],'unique':_0x2413('0x2')},'serverUrl':{'type':Sequelize[_0x2413('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8dc2=['username','sequelize','exports','STRING'];(function(_0x11be52,_0x2ef4f4){var _0x5b0bf8=function(_0x3659b6){while(--_0x3659b6){_0x11be52['push'](_0x11be52['shift']());}};_0x5b0bf8(++_0x2ef4f4);}(_0x8dc2,0x7d));var _0x28dc=function(_0x5b759b,_0x3b7b66){_0x5b759b=_0x5b759b-0x0;var _0x3d43bd=_0x8dc2[_0x5b759b];return _0x3d43bd;};'use strict';var Sequelize=require(_0x28dc('0x0'));module[_0x28dc('0x1')]={'name':{'type':Sequelize[_0x28dc('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x28dc('0x2')],'unique':_0x28dc('0x3')},'password':{'type':Sequelize[_0x28dc('0x2')]},'email':{'type':Sequelize[_0x28dc('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x28dc('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index e638c11..5c0cb15 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 _0x47a4=['set','json','apply','reject','save','then','destroy','stack','name','index','ServicenowAccount','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','getConfigurations','findOne','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','category','parent','made_sla','caused_by','watch_list','upon_reject','child_incidents','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','calendar_stc','delivery_plan','impact','active','work_notes_list','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','due_date','reopen_count','sys_tags','escalation','correlation_id','location','username','password','remoteUri','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','statusCode','error','send','test','Wrong\x20credentials','boolean','True','false','value','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit'];(function(_0x287224,_0x28cd1b){var _0x466505=function(_0x61ec13){while(--_0x61ec13){_0x287224['push'](_0x287224['shift']());}};_0x466505(++_0x28cd1b);}(_0x47a4,0x150));var _0x447a=function(_0x5824db,_0x4dab10){_0x5824db=_0x5824db-0x0;var _0x8e102b=_0x47a4[_0x5824db];return _0x8e102b;};'use strict';var emlformat=require(_0x447a('0x0'));var rimraf=require(_0x447a('0x1'));var zipdir=require(_0x447a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x447a('0x3'));var moment=require('moment');var BPromise=require(_0x447a('0x4'));var Mustache=require(_0x447a('0x5'));var util=require(_0x447a('0x6'));var path=require(_0x447a('0x7'));var sox=require(_0x447a('0x8'));var csv=require(_0x447a('0x9'));var ejs=require(_0x447a('0xa'));var fs=require('fs');var fs_extra=require(_0x447a('0xb'));var _=require(_0x447a('0xc'));var squel=require('squel');var crypto=require(_0x447a('0xd'));var jsforce=require(_0x447a('0xe'));var deskjs=require(_0x447a('0xf'));var toCsv=require(_0x447a('0x9'));var querystring=require(_0x447a('0x10'));var Papa=require(_0x447a('0x11'));var Redis=require(_0x447a('0x12'));var authService=require(_0x447a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x447a('0x14'));var hardwareService=require(_0x447a('0x15'));var logger=require(_0x447a('0x16'))(_0x447a('0x17'));var utils=require(_0x447a('0x18'));var config=require(_0x447a('0x19'));var licenseUtil=require(_0x447a('0x1a'));var db=require(_0x447a('0x1b'))['db'];var integrations=require(_0x447a('0x1c'));function respondWithStatusCode(_0x5964a7,_0x142680){_0x142680=_0x142680||0xcc;return function(_0x2aad90){if(_0x2aad90){return _0x5964a7[_0x447a('0x1d')](_0x142680);}return _0x5964a7[_0x447a('0x1e')](_0x142680)[_0x447a('0x1f')]();};}function respondWithResult(_0x463721,_0x551f82){_0x551f82=_0x551f82||0xc8;return function(_0x2c85ae){if(_0x2c85ae){return _0x463721[_0x447a('0x1e')](_0x551f82)['json'](_0x2c85ae);}};}function respondWithFilteredResult(_0x5544e5,_0x560694){return function(_0x39d2f2){if(_0x39d2f2){var _0x586683=typeof _0x560694[_0x447a('0x20')]==='undefined'&&typeof _0x560694['limit']===_0x447a('0x21');var _0x1c125b=_0x39d2f2[_0x447a('0x22')];var _0x58ba0b=_0x586683?0x0:_0x560694[_0x447a('0x20')];var _0x137c7e=_0x586683?_0x39d2f2['count']:_0x560694[_0x447a('0x20')]+_0x560694[_0x447a('0x23')];var _0x109212;if(_0x137c7e>=_0x1c125b){_0x137c7e=_0x1c125b;_0x109212=0xc8;}else{_0x109212=0xce;}_0x5544e5['status'](_0x109212);return _0x5544e5[_0x447a('0x24')]('Content-Range',_0x58ba0b+'-'+_0x137c7e+'/'+_0x1c125b)[_0x447a('0x25')](_0x39d2f2);}return null;};}function patchUpdates(_0x2cb861){return function(_0x8e65bc){try{jsonpatch[_0x447a('0x26')](_0x8e65bc,_0x2cb861,!![]);}catch(_0x53275c){return BPromise[_0x447a('0x27')](_0x53275c);}return _0x8e65bc[_0x447a('0x28')]();};}function saveUpdates(_0x34121a,_0x2ddc00){return function(_0x1a3c95){if(_0x1a3c95){return _0x1a3c95['update'](_0x34121a)[_0x447a('0x29')](function(_0x487ec5){return _0x487ec5;});}return null;};}function removeEntity(_0x58047f,_0x3bdf9b){return function(_0x11a67a){if(_0x11a67a){return _0x11a67a[_0x447a('0x2a')]()[_0x447a('0x29')](function(){_0x58047f[_0x447a('0x1e')](0xcc)[_0x447a('0x1f')]();});}};}function handleEntityNotFound(_0x213980,_0x4a6003){return function(_0x41a9af){if(!_0x41a9af){_0x213980[_0x447a('0x1d')](0x194);}return _0x41a9af;};}function handleError(_0xa5defb,_0x33c533){_0x33c533=_0x33c533||0x1f4;return function(_0x4e101f){logger['error'](_0x4e101f[_0x447a('0x2b')]);if(_0x4e101f[_0x447a('0x2c')]){delete _0x4e101f[_0x447a('0x2c')];}_0xa5defb['status'](_0x33c533)['send'](_0x4e101f);};}exports[_0x447a('0x2d')]=function(_0x48eb57,_0x1c38e7){var _0xa774c5={},_0x2ec1b7={},_0x28f741={'count':0x0,'rows':[]};var _0x5e352b=_['map'](db[_0x447a('0x2e')]['rawAttributes'],function(_0x3b2bc8){return{'name':_0x3b2bc8['fieldName'],'type':_0x3b2bc8['type']['key']};});_0x2ec1b7[_0x447a('0x2f')]=_[_0x447a('0x30')](_0x5e352b,_0x447a('0x2c'));_0x2ec1b7[_0x447a('0x31')]=_[_0x447a('0x32')](_0x48eb57[_0x447a('0x31')]);_0x2ec1b7[_0x447a('0x33')]=_[_0x447a('0x34')](_0x2ec1b7[_0x447a('0x2f')],_0x2ec1b7[_0x447a('0x31')]);_0xa774c5[_0x447a('0x35')]=_[_0x447a('0x34')](_0x2ec1b7[_0x447a('0x2f')],qs[_0x447a('0x36')](_0x48eb57['query']['fields']));_0xa774c5[_0x447a('0x35')]=_0xa774c5[_0x447a('0x35')][_0x447a('0x37')]?_0xa774c5['attributes']:_0x2ec1b7[_0x447a('0x2f')];if(!_0x48eb57[_0x447a('0x31')][_0x447a('0x38')]('nolimit')){_0xa774c5[_0x447a('0x23')]=qs[_0x447a('0x23')](_0x48eb57['query'][_0x447a('0x23')]);_0xa774c5[_0x447a('0x20')]=qs['offset'](_0x48eb57[_0x447a('0x31')][_0x447a('0x20')]);}_0xa774c5['order']=qs[_0x447a('0x39')](_0x48eb57[_0x447a('0x31')][_0x447a('0x39')]);_0xa774c5[_0x447a('0x3a')]=qs[_0x447a('0x33')](_[_0x447a('0x3b')](_0x48eb57[_0x447a('0x31')],_0x2ec1b7['filters']),_0x5e352b);if(_0x48eb57['query'][_0x447a('0x3c')]){_0xa774c5[_0x447a('0x3a')]=_[_0x447a('0x3d')](_0xa774c5[_0x447a('0x3a')],{'$or':_[_0x447a('0x30')](_0x5e352b,function(_0x31a96e){if(_0x31a96e['type']!==_0x447a('0x3e')){var _0x34d977={};_0x34d977[_0x31a96e['name']]={'$like':'%'+_0x48eb57[_0x447a('0x31')][_0x447a('0x3c')]+'%'};return _0x34d977;}})});}_0xa774c5=_['merge']({},_0xa774c5,_0x48eb57['options']);var _0x6201c8={'where':_0xa774c5[_0x447a('0x3a')]};return db[_0x447a('0x2e')][_0x447a('0x22')](_0x6201c8)['then'](function(_0x39181){_0x28f741[_0x447a('0x22')]=_0x39181;if(_0x48eb57[_0x447a('0x31')][_0x447a('0x3f')]){_0xa774c5[_0x447a('0x40')]=[{'all':!![]}];}return db[_0x447a('0x2e')][_0x447a('0x41')](_0xa774c5);})[_0x447a('0x29')](function(_0x13fe15){_0x28f741[_0x447a('0x42')]=_0x13fe15;return _0x28f741;})[_0x447a('0x29')](respondWithFilteredResult(_0x1c38e7,_0xa774c5))[_0x447a('0x43')](handleError(_0x1c38e7,null));};exports[_0x447a('0x44')]=function(_0x21ec6d,_0x1c613e){var _0x5de322={'raw':![],'where':{'id':_0x21ec6d[_0x447a('0x45')]['id']}},_0x5b05fd={};_0x5b05fd[_0x447a('0x2f')]=_[_0x447a('0x32')](db[_0x447a('0x2e')][_0x447a('0x46')]);_0x5b05fd[_0x447a('0x31')]=_[_0x447a('0x32')](_0x21ec6d[_0x447a('0x31')]);_0x5b05fd['filters']=_[_0x447a('0x34')](_0x5b05fd[_0x447a('0x2f')],_0x5b05fd[_0x447a('0x31')]);_0x5de322[_0x447a('0x35')]=_[_0x447a('0x34')](_0x5b05fd[_0x447a('0x2f')],qs[_0x447a('0x36')](_0x21ec6d[_0x447a('0x31')][_0x447a('0x36')]));_0x5de322['attributes']=_0x5de322[_0x447a('0x35')][_0x447a('0x37')]?_0x5de322[_0x447a('0x35')]:_0x5b05fd[_0x447a('0x2f')];if(_0x21ec6d[_0x447a('0x31')][_0x447a('0x3f')]){_0x5de322[_0x447a('0x40')]=[{'all':!![]}];}_0x5de322=_[_0x447a('0x3d')]({},_0x5de322,_0x21ec6d[_0x447a('0x47')]);return db[_0x447a('0x2e')]['find'](_0x5de322)[_0x447a('0x29')](handleEntityNotFound(_0x1c613e,null))[_0x447a('0x29')](respondWithResult(_0x1c613e,null))[_0x447a('0x43')](handleError(_0x1c613e,null));};exports[_0x447a('0x48')]=function(_0x53f347,_0xbc777b){return db[_0x447a('0x2e')][_0x447a('0x48')](_0x53f347[_0x447a('0x49')],{})[_0x447a('0x29')](respondWithResult(_0xbc777b,0xc9))[_0x447a('0x43')](handleError(_0xbc777b,null));};exports['update']=function(_0x358e36,_0x278f30){if(_0x358e36['body']['id']){delete _0x358e36[_0x447a('0x49')]['id'];}return db[_0x447a('0x2e')][_0x447a('0x4a')]({'where':{'id':_0x358e36[_0x447a('0x45')]['id']}})[_0x447a('0x29')](handleEntityNotFound(_0x278f30,null))['then'](saveUpdates(_0x358e36[_0x447a('0x49')],null))[_0x447a('0x29')](respondWithResult(_0x278f30,null))[_0x447a('0x43')](handleError(_0x278f30,null));};exports[_0x447a('0x2a')]=function(_0x316256,_0x2b9d64){return db['ServicenowAccount'][_0x447a('0x4a')]({'where':{'id':_0x316256[_0x447a('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b9d64,null))['then'](removeEntity(_0x2b9d64,null))[_0x447a('0x43')](handleError(_0x2b9d64,null));};exports[_0x447a('0x4b')]=function(_0xbb4daf,_0x54f131,_0x28c0f5){var _0x54e69b={};var _0xe22e1c={};var _0x19bc4a;var _0x32e4a6;return db['ServicenowAccount'][_0x447a('0x4c')]({'where':{'id':_0xbb4daf['params']['id']}})[_0x447a('0x29')](handleEntityNotFound(_0x54f131,null))[_0x447a('0x29')](function(_0xf17578){if(_0xf17578){_0x19bc4a=_0xf17578;_0xe22e1c[_0x447a('0x2f')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0xe22e1c[_0x447a('0x31')]=_[_0x447a('0x32')](_0xbb4daf[_0x447a('0x31')]);_0xe22e1c[_0x447a('0x33')]=_[_0x447a('0x34')](_0xe22e1c[_0x447a('0x2f')],_0xe22e1c[_0x447a('0x31')]);_0x54e69b[_0x447a('0x35')]=_['intersection'](_0xe22e1c['model'],qs['fields'](_0xbb4daf[_0x447a('0x31')][_0x447a('0x36')]));_0x54e69b[_0x447a('0x35')]=_0x54e69b['attributes'][_0x447a('0x37')]?_0x54e69b['attributes']:_0xe22e1c[_0x447a('0x2f')];_0x54e69b[_0x447a('0x4d')]=qs[_0x447a('0x39')](_0xbb4daf['query']['sort']);_0x54e69b['where']=qs[_0x447a('0x33')](_[_0x447a('0x3b')](_0xbb4daf[_0x447a('0x31')],_0xe22e1c[_0x447a('0x33')]));if(_0xbb4daf['query']['filter']){_0x54e69b['where']=_[_0x447a('0x3d')](_0x54e69b[_0x447a('0x3a')],{'$or':_[_0x447a('0x30')](_0x54e69b['attributes'],function(_0x198374){var _0x337a83={};_0x337a83[_0x198374]={'$like':'%'+_0xbb4daf[_0x447a('0x31')][_0x447a('0x3c')]+'%'};return _0x337a83;})});}_0x54e69b=_[_0x447a('0x3d')]({},_0x54e69b,_0xbb4daf[_0x447a('0x47')]);return _0x19bc4a['getConfigurations'](_0x54e69b);}})[_0x447a('0x29')](function(_0x531a35){if(_0x531a35){_0x32e4a6=_0x531a35[_0x447a('0x37')];if(!_0xbb4daf[_0x447a('0x31')]['hasOwnProperty'](_0x447a('0x4e'))){_0x54e69b['limit']=qs[_0x447a('0x23')](_0xbb4daf[_0x447a('0x31')]['limit']);_0x54e69b[_0x447a('0x20')]=qs['offset'](_0xbb4daf[_0x447a('0x31')][_0x447a('0x20')]);}return _0x19bc4a[_0x447a('0x4b')](_0x54e69b);}})[_0x447a('0x29')](function(_0x4a1651){if(_0x4a1651){return _0x4a1651?{'count':_0x32e4a6,'rows':_0x4a1651}:null;}})[_0x447a('0x29')](respondWithResult(_0x54f131,null))[_0x447a('0x43')](handleError(_0x54f131,null));};exports[_0x447a('0x4f')]=function(_0x4909cc,_0x451a46,_0x36b504){if(_0x4909cc[_0x447a('0x49')]['id']){delete _0x4909cc[_0x447a('0x49')]['id'];}return db['ServicenowAccount'][_0x447a('0x4c')]({'where':{'id':_0x4909cc[_0x447a('0x45')]['id']}})[_0x447a('0x29')](handleEntityNotFound(_0x451a46,null))[_0x447a('0x29')](function(_0x411939){if(_0x411939){_0x4909cc[_0x447a('0x49')][_0x447a('0x50')]=_0x411939['id'];_0x4909cc[_0x447a('0x49')][_0x447a('0x51')]=integrations[_0x447a('0x52')](_0x4909cc[_0x447a('0x49')][_0x447a('0x53')],_0x4909cc[_0x447a('0x49')][_0x447a('0x54')]);_0x4909cc[_0x447a('0x49')][_0x447a('0x55')]=integrations[_0x447a('0x56')](_0x4909cc[_0x447a('0x49')][_0x447a('0x53')],_0x4909cc[_0x447a('0x49')]['type']);return db[_0x447a('0x57')][_0x447a('0x48')](_0x4909cc['body'],{'include':[{'model':db[_0x447a('0x58')],'as':_0x447a('0x51')},{'model':db[_0x447a('0x58')],'as':'Descriptions'}]});}return null;})[_0x447a('0x29')](respondWithResult(_0x451a46,null))['catch'](handleError(_0x451a46,null));};exports[_0x447a('0x59')]=function(_0x597d88,_0x5c3640,_0x2b90e2){var _0x2d1526=['made_sla',_0x447a('0x5a'),_0x447a('0x5b'),_0x447a('0x5c'),_0x447a('0x5d'),_0x447a('0x5e'),'incident_state','severity',_0x447a('0x5f')];var _0x5eedf0=[_0x447a('0x60'),_0x447a('0x61'),_0x447a('0x62'),_0x447a('0x63'),_0x447a('0x64'),'sys_updated_on',_0x447a('0x65'),_0x447a('0x5a'),'approval_history','number',_0x447a('0x66'),'sys_updated_by',_0x447a('0x67'),_0x447a('0x68'),_0x447a('0x69'),_0x447a('0x6a'),_0x447a('0x6b'),'sys_created_by',_0x447a('0x5b'),_0x447a('0x4d'),_0x447a('0x6c'),'closed_at','cmdb_ci',_0x447a('0x6d'),_0x447a('0x6e'),_0x447a('0x6f'),_0x447a('0x70'),'business_service','priority',_0x447a('0x71'),_0x447a('0x72'),_0x447a('0x73'),_0x447a('0x74'),_0x447a('0x75'),_0x447a('0x76'),_0x447a('0x77'),_0x447a('0x78'),_0x447a('0x79'),_0x447a('0x7a'),_0x447a('0x7b'),_0x447a('0x7c'),_0x447a('0x5c'),_0x447a('0x7d'),_0x447a('0x7e'),_0x447a('0x5d'),_0x447a('0x7f'),'delivery_task',_0x447a('0x80'),_0x447a('0x81'),_0x447a('0x82'),_0x447a('0x83'),'description',_0x447a('0x84'),_0x447a('0x5e'),_0x447a('0x85'),_0x447a('0x86'),_0x447a('0x87'),_0x447a('0x88'),_0x447a('0x89'),_0x447a('0x8a'),'contact_type',_0x447a('0x8b'),_0x447a('0x8c'),_0x447a('0x8d'),_0x447a('0x8e'),_0x447a('0x8f'),_0x447a('0x90'),_0x447a('0x91'),_0x447a('0x92'),'severity','comments',_0x447a('0x93'),_0x447a('0x94'),'comments_and_work_notes',_0x447a('0x95'),'sys_mod_count',_0x447a('0x96'),_0x447a('0x97'),_0x447a('0x98'),'upon_approval',_0x447a('0x99'),_0x447a('0x9a'),_0x447a('0x5f')];var _0x5d5ba4='';var _0x352f14='';var _0x1d79ae=[];var _0x137253='';var _0x3ae7be='';var _0xd0a72e=[];var _0x20d80c='';var _0x34ed44='';var _0x3f525a={};var _0x284206='';return db[_0x447a('0x2e')][_0x447a('0x4c')]({'where':{'id':_0x597d88['params']['id']},'attributes':['id',_0x447a('0x9b'),_0x447a('0x9c'),'email',_0x447a('0x9d'),'serverUrl']})[_0x447a('0x29')](handleEntityNotFound(_0x5c3640,null))[_0x447a('0x29')](function(_0x2b5a8d){if(_0x2b5a8d){_0x284206=_0x2b5a8d[_0x447a('0x9d')];var _0x2425c6=_0x284206['slice'](-0x1);if(_0x2425c6==='/'){_0x284206=_0x284206[_0x447a('0x9e')](0x0,_0x284206[_0x447a('0x9f')](_0x2425c6));}_0x34ed44=util['format'](_0x447a('0xa0'),_0x284206);_0x20d80c=util[_0x447a('0xa1')](_0x447a('0xa2'),_0x284206);_0x3f525a={'user':_0x2b5a8d[_0x447a('0x9b')],'pass':_0x2b5a8d['password']};var _0x1c5905={'method':_0x447a('0xa3'),'uri':_0x34ed44+_0x447a('0xa4'),'auth':_0x3f525a,'json':!![]};return rp(_0x1c5905);}})[_0x447a('0x29')](function(_0x20be56){if(_0x20be56[_0x447a('0xa5')]['length']>0x0){_0x5d5ba4=_0x20be56['result'];}console[_0x447a('0xa6')](_0x447a('0xa7'),_0x5d5ba4);_0xd0a72e=[];_0x352f14=Object['assign']([],_0x5d5ba4);_[_0x447a('0xa8')](_0x352f14,function(_0x5461e6){return!_0x2d1526[_0x447a('0xa9')](_0x5461e6['name']);});_0x352f14[_0x447a('0xaa')](function(_0xa1243b){var _0xff13f5=createFieldObject(_0x20d80c,_0x3f525a,_0xa1243b['internalType'],_0xa1243b[_0x447a('0x2c')],_0xa1243b[_0x447a('0xab')],![]);_0xd0a72e[_0x447a('0xac')](_0xff13f5);});return Promise[_0x447a('0xad')](_0xd0a72e);})['then'](function(_0x5865aa){_0x1d79ae=_0x5865aa;_0x137253=Object['assign']([],_0x5d5ba4);console[_0x447a('0xa6')]('TCL:\x20_object',_0x5d5ba4);_[_0x447a('0xa8')](_0x137253,function(_0x130134){return _0x5eedf0[_0x447a('0xa9')](_0x130134[_0x447a('0x2c')]);});console['log'](_0x447a('0xae'),_0x137253);_0xd0a72e=[];_0x137253['forEach'](function(_0x10b4df){var _0x2ad5fa=createFieldObject(_0x20d80c,_0x3f525a,_0x10b4df[_0x447a('0xaf')],_0x10b4df['name'],_0x10b4df[_0x447a('0xab')],!![]);_0xd0a72e[_0x447a('0xac')](_0x2ad5fa);});return Promise[_0x447a('0xad')](_0xd0a72e);})['then'](function(_0x5bfca7){_0x3ae7be=_0x5bfca7;var _0x32e293=_0x1d79ae[_0x447a('0xb0')](_0x3ae7be);return{'count':_0x32e293[_0x447a('0x37')],'rows':_0x32e293};})[_0x447a('0x29')](respondWithResult(_0x5c3640,null))[_0x447a('0x43')](function(_0x8a96e0){console['log']('ServiceNow\x20error:\x20'+_0x8a96e0);var _0x11cffd=_0x597d88[_0x447a('0x31')]['test']?0x1f4:_0x8a96e0[_0x447a('0xb1')]||0x1f4;logger[_0x447a('0xb2')](_0x8a96e0[_0x447a('0x2b')]);delete _0x8a96e0[_0x447a('0x2c')];if(_0x11cffd===0x191){_0x11cffd=0x190;}_0x5c3640[_0x447a('0x1e')](_0x11cffd)[_0x447a('0xb3')](_0x597d88[_0x447a('0x31')][_0x447a('0xb4')]?{'message':_0x447a('0xb5'),'statusCode':_0x8a96e0['statusCode']}:_0x8a96e0);});};function createFieldObject(_0x5ad23c,_0x45de24,_0x2267e7,_0x157da0,_0x4f4c95,_0x3494dc){return new Promise(function(_0x256922,_0x11a037){var _0x207dae={'id':_0x157da0,'name':_0x4f4c95,'custom':_0x3494dc};if(_0x2267e7===_0x447a('0xb6')){_0x207dae[_0x447a('0x47')]=[{'name':_0x447a('0xb7'),'value':'true'},{'name':'False','value':_0x447a('0xb8')}];_0x256922(_0x207dae);}else{var _0xd36c8d={'method':_0x447a('0xa3'),'uri':_0x5ad23c+'sys_choice?sysparm_query=name=incident^element='+_0x157da0,'auth':_0x45de24,'json':!![]};return rp(_0xd36c8d)[_0x447a('0x29')](function(_0x60acdd){var _0xd196d9=[];if(_0x60acdd['result'][_0x447a('0x37')]>0x0){_0x60acdd[_0x447a('0xa5')][_0x447a('0xaa')](function(_0x3e036d){if(_0x3e036d['inactive']===_0x447a('0xb8')){var _0x4f9aeb={'name':_0x3e036d['label'],'value':_0x3e036d[_0x447a('0xb9')]};_0xd196d9[_0x447a('0xac')](_0x4f9aeb);}});}_0x207dae[_0x447a('0x47')]=_0xd196d9;if(_0x207dae[_0x447a('0x47')][_0x447a('0x37')]>0x0){_0x256922(_0x207dae);}else{if(_0x3494dc==![]){_0x256922();}else{_0x256922(_0x207dae);}}});}});} \ No newline at end of file +var _0xd53e=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','send','index','map','rawAttributes','type','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','merge','where','VIRTUAL','ServicenowAccount','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','getConfigurations','ServicenowConfiguration','nolimit','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','hold_reason','approval_history','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','calendar_stc','closed_at','delivery_plan','impact','active','priority','rfc','expected_start','business_duration','group_list','work_end','resolved_at','caller_id','work_notes','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','assign','includes','forEach','internalType','label','push','all','TCL:\x20_object','remove','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','value','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x5bd4f6,_0xf4e45c){var _0x33a165=function(_0x37eef6){while(--_0x37eef6){_0x5bd4f6['push'](_0x5bd4f6['shift']());}};_0x33a165(++_0xf4e45c);}(_0xd53e,0xa0));var _0xed53=function(_0x71be9b,_0x4a22ab){_0x71be9b=_0x71be9b-0x0;var _0x12acff=_0xd53e[_0x71be9b];return _0x12acff;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xed53('0x0'));var rp=require(_0xed53('0x1'));var moment=require(_0xed53('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xed53('0x3'));var util=require(_0xed53('0x4'));var path=require('path');var sox=require(_0xed53('0x5'));var csv=require(_0xed53('0x6'));var ejs=require(_0xed53('0x7'));var fs=require('fs');var fs_extra=require(_0xed53('0x8'));var _=require(_0xed53('0x9'));var squel=require('squel');var crypto=require(_0xed53('0xa'));var jsforce=require(_0xed53('0xb'));var deskjs=require(_0xed53('0xc'));var toCsv=require(_0xed53('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xed53('0xd'));var authService=require(_0xed53('0xe'));var qs=require(_0xed53('0xf'));var as=require(_0xed53('0x10'));var hardwareService=require(_0xed53('0x11'));var logger=require(_0xed53('0x12'))(_0xed53('0x13'));var utils=require(_0xed53('0x14'));var config=require(_0xed53('0x15'));var licenseUtil=require(_0xed53('0x16'));var db=require(_0xed53('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x182380,_0x5623d2){_0x5623d2=_0x5623d2||0xcc;return function(_0x5d5d65){if(_0x5d5d65){return _0x182380[_0xed53('0x18')](_0x5623d2);}return _0x182380[_0xed53('0x19')](_0x5623d2)[_0xed53('0x1a')]();};}function respondWithResult(_0xdc0fb8,_0x2bcf3b){_0x2bcf3b=_0x2bcf3b||0xc8;return function(_0x13aad5){if(_0x13aad5){return _0xdc0fb8[_0xed53('0x19')](_0x2bcf3b)[_0xed53('0x1b')](_0x13aad5);}};}function respondWithFilteredResult(_0x3ef04f,_0x27f6b9){return function(_0x4eda7e){if(_0x4eda7e){var _0x549848=typeof _0x27f6b9[_0xed53('0x1c')]===_0xed53('0x1d')&&typeof _0x27f6b9[_0xed53('0x1e')]===_0xed53('0x1d');var _0x432a9a=_0x4eda7e[_0xed53('0x1f')];var _0x263670=_0x549848?0x0:_0x27f6b9[_0xed53('0x1c')];var _0x498739=_0x549848?_0x4eda7e[_0xed53('0x1f')]:_0x27f6b9[_0xed53('0x1c')]+_0x27f6b9[_0xed53('0x1e')];var _0x29ffde;if(_0x498739>=_0x432a9a){_0x498739=_0x432a9a;_0x29ffde=0xc8;}else{_0x29ffde=0xce;}_0x3ef04f[_0xed53('0x19')](_0x29ffde);return _0x3ef04f[_0xed53('0x20')](_0xed53('0x21'),_0x263670+'-'+_0x498739+'/'+_0x432a9a)[_0xed53('0x1b')](_0x4eda7e);}return null;};}function patchUpdates(_0x257985){return function(_0x44606a){try{jsonpatch[_0xed53('0x22')](_0x44606a,_0x257985,!![]);}catch(_0x4a71f7){return BPromise['reject'](_0x4a71f7);}return _0x44606a[_0xed53('0x23')]();};}function saveUpdates(_0x21e5fe,_0x4fc649){return function(_0x2b3bf5){if(_0x2b3bf5){return _0x2b3bf5[_0xed53('0x24')](_0x21e5fe)[_0xed53('0x25')](function(_0x91fc9c){return _0x91fc9c;});}return null;};}function removeEntity(_0x2b227b,_0x521dcf){return function(_0x8697c5){if(_0x8697c5){return _0x8697c5[_0xed53('0x26')]()[_0xed53('0x25')](function(){_0x2b227b[_0xed53('0x19')](0xcc)[_0xed53('0x1a')]();});}};}function handleEntityNotFound(_0x3e7187,_0x5927c7){return function(_0x7cc5a8){if(!_0x7cc5a8){_0x3e7187[_0xed53('0x18')](0x194);}return _0x7cc5a8;};}function handleError(_0x2e1cc5,_0xb2d487){_0xb2d487=_0xb2d487||0x1f4;return function(_0x54f482){logger[_0xed53('0x27')](_0x54f482[_0xed53('0x28')]);if(_0x54f482['name']){delete _0x54f482['name'];}_0x2e1cc5['status'](_0xb2d487)[_0xed53('0x29')](_0x54f482);};}exports[_0xed53('0x2a')]=function(_0x54b578,_0x328b16){var _0x55b3c6={},_0x1fa6e2={},_0x83fbc3={'count':0x0,'rows':[]};var _0x3c8695=_[_0xed53('0x2b')](db['ServicenowAccount'][_0xed53('0x2c')],function(_0x2de402){return{'name':_0x2de402['fieldName'],'type':_0x2de402[_0xed53('0x2d')]['key']};});_0x1fa6e2[_0xed53('0x2e')]=_['map'](_0x3c8695,_0xed53('0x2f'));_0x1fa6e2[_0xed53('0x30')]=_[_0xed53('0x31')](_0x54b578[_0xed53('0x30')]);_0x1fa6e2['filters']=_[_0xed53('0x32')](_0x1fa6e2[_0xed53('0x2e')],_0x1fa6e2[_0xed53('0x30')]);_0x55b3c6[_0xed53('0x33')]=_[_0xed53('0x32')](_0x1fa6e2['model'],qs[_0xed53('0x34')](_0x54b578[_0xed53('0x30')][_0xed53('0x34')]));_0x55b3c6['attributes']=_0x55b3c6[_0xed53('0x33')][_0xed53('0x35')]?_0x55b3c6[_0xed53('0x33')]:_0x1fa6e2[_0xed53('0x2e')];if(!_0x54b578[_0xed53('0x30')][_0xed53('0x36')]('nolimit')){_0x55b3c6[_0xed53('0x1e')]=qs['limit'](_0x54b578[_0xed53('0x30')]['limit']);_0x55b3c6['offset']=qs[_0xed53('0x1c')](_0x54b578[_0xed53('0x30')]['offset']);}_0x55b3c6[_0xed53('0x37')]=qs['sort'](_0x54b578[_0xed53('0x30')][_0xed53('0x38')]);_0x55b3c6['where']=qs[_0xed53('0x39')](_[_0xed53('0x3a')](_0x54b578[_0xed53('0x30')],_0x1fa6e2[_0xed53('0x39')]),_0x3c8695);if(_0x54b578[_0xed53('0x30')][_0xed53('0x3b')]){_0x55b3c6['where']=_[_0xed53('0x3c')](_0x55b3c6[_0xed53('0x3d')],{'$or':_[_0xed53('0x2b')](_0x3c8695,function(_0x55ca7e){if(_0x55ca7e['type']!==_0xed53('0x3e')){var _0x3a8018={};_0x3a8018[_0x55ca7e['name']]={'$like':'%'+_0x54b578[_0xed53('0x30')][_0xed53('0x3b')]+'%'};return _0x3a8018;}})});}_0x55b3c6=_['merge']({},_0x55b3c6,_0x54b578['options']);var _0x2f744c={'where':_0x55b3c6[_0xed53('0x3d')]};return db[_0xed53('0x3f')][_0xed53('0x1f')](_0x2f744c)['then'](function(_0xabc39a){_0x83fbc3[_0xed53('0x1f')]=_0xabc39a;if(_0x54b578[_0xed53('0x30')]['includeAll']){_0x55b3c6[_0xed53('0x40')]=[{'all':!![]}];}return db[_0xed53('0x3f')][_0xed53('0x41')](_0x55b3c6);})[_0xed53('0x25')](function(_0x41c057){_0x83fbc3[_0xed53('0x42')]=_0x41c057;return _0x83fbc3;})[_0xed53('0x25')](respondWithFilteredResult(_0x328b16,_0x55b3c6))[_0xed53('0x43')](handleError(_0x328b16,null));};exports[_0xed53('0x44')]=function(_0x3a216a,_0x99fa61){var _0xd842b3={'raw':![],'where':{'id':_0x3a216a['params']['id']}},_0x48426e={};_0x48426e['model']=_[_0xed53('0x31')](db[_0xed53('0x3f')][_0xed53('0x2c')]);_0x48426e[_0xed53('0x30')]=_[_0xed53('0x31')](_0x3a216a['query']);_0x48426e[_0xed53('0x39')]=_[_0xed53('0x32')](_0x48426e[_0xed53('0x2e')],_0x48426e[_0xed53('0x30')]);_0xd842b3[_0xed53('0x33')]=_[_0xed53('0x32')](_0x48426e['model'],qs[_0xed53('0x34')](_0x3a216a['query'][_0xed53('0x34')]));_0xd842b3['attributes']=_0xd842b3[_0xed53('0x33')][_0xed53('0x35')]?_0xd842b3[_0xed53('0x33')]:_0x48426e[_0xed53('0x2e')];if(_0x3a216a[_0xed53('0x30')][_0xed53('0x45')]){_0xd842b3[_0xed53('0x40')]=[{'all':!![]}];}_0xd842b3=_[_0xed53('0x3c')]({},_0xd842b3,_0x3a216a[_0xed53('0x46')]);return db[_0xed53('0x3f')][_0xed53('0x47')](_0xd842b3)[_0xed53('0x25')](handleEntityNotFound(_0x99fa61,null))[_0xed53('0x25')](respondWithResult(_0x99fa61,null))[_0xed53('0x43')](handleError(_0x99fa61,null));};exports['create']=function(_0x3bb522,_0x1efa04){return db[_0xed53('0x3f')][_0xed53('0x48')](_0x3bb522[_0xed53('0x49')],{})[_0xed53('0x25')](respondWithResult(_0x1efa04,0xc9))[_0xed53('0x43')](handleError(_0x1efa04,null));};exports['update']=function(_0x5aea2d,_0x43f88b){if(_0x5aea2d[_0xed53('0x49')]['id']){delete _0x5aea2d['body']['id'];}return db['ServicenowAccount'][_0xed53('0x47')]({'where':{'id':_0x5aea2d[_0xed53('0x4a')]['id']}})[_0xed53('0x25')](handleEntityNotFound(_0x43f88b,null))[_0xed53('0x25')](saveUpdates(_0x5aea2d[_0xed53('0x49')],null))[_0xed53('0x25')](respondWithResult(_0x43f88b,null))['catch'](handleError(_0x43f88b,null));};exports[_0xed53('0x26')]=function(_0x1b14ce,_0x3bf67b){return db['ServicenowAccount'][_0xed53('0x47')]({'where':{'id':_0x1b14ce['params']['id']}})['then'](handleEntityNotFound(_0x3bf67b,null))[_0xed53('0x25')](removeEntity(_0x3bf67b,null))[_0xed53('0x43')](handleError(_0x3bf67b,null));};exports[_0xed53('0x4b')]=function(_0x4aba1f,_0x598258,_0x15d1a0){var _0x594091={};var _0x45a537={};var _0x196079;var _0x1df81a;return db[_0xed53('0x3f')]['findOne']({'where':{'id':_0x4aba1f['params']['id']}})['then'](handleEntityNotFound(_0x598258,null))[_0xed53('0x25')](function(_0x35ac5d){if(_0x35ac5d){_0x196079=_0x35ac5d;_0x45a537['model']=_['keys'](db[_0xed53('0x4c')][_0xed53('0x2c')]);_0x45a537[_0xed53('0x30')]=_['keys'](_0x4aba1f[_0xed53('0x30')]);_0x45a537[_0xed53('0x39')]=_[_0xed53('0x32')](_0x45a537[_0xed53('0x2e')],_0x45a537[_0xed53('0x30')]);_0x594091[_0xed53('0x33')]=_[_0xed53('0x32')](_0x45a537[_0xed53('0x2e')],qs['fields'](_0x4aba1f[_0xed53('0x30')]['fields']));_0x594091[_0xed53('0x33')]=_0x594091[_0xed53('0x33')][_0xed53('0x35')]?_0x594091['attributes']:_0x45a537['model'];_0x594091[_0xed53('0x37')]=qs['sort'](_0x4aba1f[_0xed53('0x30')][_0xed53('0x38')]);_0x594091[_0xed53('0x3d')]=qs[_0xed53('0x39')](_[_0xed53('0x3a')](_0x4aba1f[_0xed53('0x30')],_0x45a537[_0xed53('0x39')]));if(_0x4aba1f['query'][_0xed53('0x3b')]){_0x594091[_0xed53('0x3d')]=_[_0xed53('0x3c')](_0x594091['where'],{'$or':_[_0xed53('0x2b')](_0x594091[_0xed53('0x33')],function(_0x2003a2){var _0x177e29={};_0x177e29[_0x2003a2]={'$like':'%'+_0x4aba1f[_0xed53('0x30')]['filter']+'%'};return _0x177e29;})});}_0x594091=_[_0xed53('0x3c')]({},_0x594091,_0x4aba1f[_0xed53('0x46')]);return _0x196079[_0xed53('0x4b')](_0x594091);}})[_0xed53('0x25')](function(_0x20fed9){if(_0x20fed9){_0x1df81a=_0x20fed9[_0xed53('0x35')];if(!_0x4aba1f['query'][_0xed53('0x36')](_0xed53('0x4d'))){_0x594091[_0xed53('0x1e')]=qs[_0xed53('0x1e')](_0x4aba1f[_0xed53('0x30')][_0xed53('0x1e')]);_0x594091[_0xed53('0x1c')]=qs[_0xed53('0x1c')](_0x4aba1f[_0xed53('0x30')][_0xed53('0x1c')]);}return _0x196079[_0xed53('0x4b')](_0x594091);}})[_0xed53('0x25')](function(_0x35ad01){if(_0x35ad01){return _0x35ad01?{'count':_0x1df81a,'rows':_0x35ad01}:null;}})[_0xed53('0x25')](respondWithResult(_0x598258,null))[_0xed53('0x43')](handleError(_0x598258,null));};exports[_0xed53('0x4e')]=function(_0x40aa23,_0x148e7c,_0x77f6a9){if(_0x40aa23['body']['id']){delete _0x40aa23[_0xed53('0x49')]['id'];}return db[_0xed53('0x3f')][_0xed53('0x4f')]({'where':{'id':_0x40aa23[_0xed53('0x4a')]['id']}})[_0xed53('0x25')](handleEntityNotFound(_0x148e7c,null))['then'](function(_0x1acddb){if(_0x1acddb){_0x40aa23[_0xed53('0x49')][_0xed53('0x50')]=_0x1acddb['id'];_0x40aa23[_0xed53('0x49')]['Subjects']=integrations[_0xed53('0x51')](_0x40aa23[_0xed53('0x49')][_0xed53('0x52')],_0x40aa23[_0xed53('0x49')]['type']);_0x40aa23[_0xed53('0x49')][_0xed53('0x53')]=integrations[_0xed53('0x54')](_0x40aa23[_0xed53('0x49')][_0xed53('0x52')],_0x40aa23[_0xed53('0x49')][_0xed53('0x2d')]);return db[_0xed53('0x4c')]['create'](_0x40aa23[_0xed53('0x49')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0xed53('0x55')],'as':_0xed53('0x53')}]});}return null;})[_0xed53('0x25')](respondWithResult(_0x148e7c,null))[_0xed53('0x43')](handleError(_0x148e7c,null));};exports['getFields']=function(_0x322fa3,_0x3c0565,_0x366189){var _0xbe13ae=['made_sla','hold_reason',_0xed53('0x56'),_0xed53('0x57'),_0xed53('0x58'),_0xed53('0x59'),_0xed53('0x5a'),_0xed53('0x5b'),_0xed53('0x5c')];var _0x39be05=[_0xed53('0x5d'),_0xed53('0x5e'),_0xed53('0x5f'),_0xed53('0x60'),_0xed53('0x61'),'sys_updated_on','child_incidents',_0xed53('0x62'),_0xed53('0x63'),_0xed53('0x64'),_0xed53('0x65'),_0xed53('0x66'),'opened_by',_0xed53('0x67'),_0xed53('0x68'),_0xed53('0x69'),_0xed53('0x6a'),'sys_created_by',_0xed53('0x56'),_0xed53('0x37'),_0xed53('0x6b'),_0xed53('0x6c'),'cmdb_ci',_0xed53('0x6d'),_0xed53('0x6e'),_0xed53('0x6f'),'work_notes_list','business_service',_0xed53('0x70'),'sys_domain_path',_0xed53('0x71'),'time_worked',_0xed53('0x72'),'opened_at',_0xed53('0x73'),_0xed53('0x74'),_0xed53('0x75'),'reopened_time',_0xed53('0x76'),_0xed53('0x77'),'approval_set','subcategory',_0xed53('0x78'),_0xed53('0x79'),_0xed53('0x58'),_0xed53('0x7a'),_0xed53('0x7b'),_0xed53('0x7c'),'assignment_group',_0xed53('0x7d'),_0xed53('0x7e'),_0xed53('0x7f'),_0xed53('0x80'),_0xed53('0x59'),_0xed53('0x81'),_0xed53('0x82'),'closed_by','follow_up',_0xed53('0x83'),_0xed53('0x84'),_0xed53('0x85'),_0xed53('0x86'),_0xed53('0x5a'),_0xed53('0x87'),_0xed53('0x88'),_0xed53('0x89'),_0xed53('0x8a'),'activity_due',_0xed53('0x8b'),_0xed53('0x5b'),'comments',_0xed53('0x8c'),'approval',_0xed53('0x8d'),_0xed53('0x8e'),_0xed53('0x8f'),_0xed53('0x90'),'sys_tags','escalation','upon_approval',_0xed53('0x91'),_0xed53('0x92'),_0xed53('0x5c')];var _0x29de53='';var _0xa3d24b='';var _0x5f0489=[];var _0x43b2e5='';var _0x281b40='';var _0x1da919=[];var _0x2bf65c='';var _0x52eba2='';var _0xdccfc9={};var _0x2d78a2='';return db['ServicenowAccount'][_0xed53('0x4f')]({'where':{'id':_0x322fa3['params']['id']},'attributes':['id',_0xed53('0x93'),_0xed53('0x94'),_0xed53('0x95'),_0xed53('0x96'),_0xed53('0x97')]})['then'](handleEntityNotFound(_0x3c0565,null))['then'](function(_0x2683db){if(_0x2683db){_0x2d78a2=_0x2683db[_0xed53('0x96')];var _0x4caf42=_0x2d78a2[_0xed53('0x98')](-0x1);if(_0x4caf42==='/'){_0x2d78a2=_0x2d78a2['substring'](0x0,_0x2d78a2[_0xed53('0x99')](_0x4caf42));}_0x52eba2=util[_0xed53('0x9a')](_0xed53('0x9b'),_0x2d78a2);_0x2bf65c=util[_0xed53('0x9a')](_0xed53('0x9c'),_0x2d78a2);_0xdccfc9={'user':_0x2683db[_0xed53('0x93')],'pass':_0x2683db['password']};var _0x4b60cb={'method':_0xed53('0x9d'),'uri':_0x52eba2+_0xed53('0x9e'),'auth':_0xdccfc9,'json':!![]};return rp(_0x4b60cb);}})['then'](function(_0x427032){if(_0x427032[_0xed53('0x9f')]['length']>0x0){_0x29de53=_0x427032[_0xed53('0x9f')];}console['log']('incident\x20table\x20objects',_0x29de53);_0x1da919=[];_0xa3d24b=Object[_0xed53('0xa0')]([],_0x29de53);_['remove'](_0xa3d24b,function(_0xcde0a4){return!_0xbe13ae[_0xed53('0xa1')](_0xcde0a4['name']);});_0xa3d24b[_0xed53('0xa2')](function(_0x335785){var _0x3b6f17=createFieldObject(_0x2bf65c,_0xdccfc9,_0x335785[_0xed53('0xa3')],_0x335785[_0xed53('0x2f')],_0x335785[_0xed53('0xa4')],![]);_0x1da919[_0xed53('0xa5')](_0x3b6f17);});return Promise[_0xed53('0xa6')](_0x1da919);})['then'](function(_0x418455){_0x5f0489=_0x418455;_0x43b2e5=Object[_0xed53('0xa0')]([],_0x29de53);console['log'](_0xed53('0xa7'),_0x29de53);_[_0xed53('0xa8')](_0x43b2e5,function(_0x14d0cb){return _0x39be05[_0xed53('0xa1')](_0x14d0cb['name']);});console[_0xed53('0xa9')](_0xed53('0xaa'),_0x43b2e5);_0x1da919=[];_0x43b2e5['forEach'](function(_0x1213b5){var _0x62f87e=createFieldObject(_0x2bf65c,_0xdccfc9,_0x1213b5['internalType'],_0x1213b5['name'],_0x1213b5[_0xed53('0xa4')],!![]);_0x1da919[_0xed53('0xa5')](_0x62f87e);});return Promise[_0xed53('0xa6')](_0x1da919);})[_0xed53('0x25')](function(_0x5da424){_0x281b40=_0x5da424;var _0x534cec=_0x5f0489['concat'](_0x281b40);return{'count':_0x534cec[_0xed53('0x35')],'rows':_0x534cec};})['then'](respondWithResult(_0x3c0565,null))[_0xed53('0x43')](function(_0x1249ac){console[_0xed53('0xa9')](_0xed53('0xab')+_0x1249ac);var _0x541da5=_0x322fa3['query'][_0xed53('0xac')]?0x1f4:_0x1249ac['statusCode']||0x1f4;logger[_0xed53('0x27')](_0x1249ac[_0xed53('0x28')]);delete _0x1249ac[_0xed53('0x2f')];if(_0x541da5===0x191){_0x541da5=0x190;}_0x3c0565[_0xed53('0x19')](_0x541da5)[_0xed53('0x29')](_0x322fa3[_0xed53('0x30')][_0xed53('0xac')]?{'message':_0xed53('0xad'),'statusCode':_0x1249ac[_0xed53('0xae')]}:_0x1249ac);});};function createFieldObject(_0x40942c,_0x99c5d4,_0x130b41,_0x210087,_0x34cd9f,_0x26b2c4){return new Promise(function(_0x310dee,_0x1b3dac){var _0x1e2297={'id':_0x210087,'name':_0x34cd9f,'custom':_0x26b2c4};if(_0x130b41===_0xed53('0xaf')){_0x1e2297[_0xed53('0x46')]=[{'name':_0xed53('0xb0'),'value':_0xed53('0xb1')},{'name':_0xed53('0xb2'),'value':'false'}];_0x310dee(_0x1e2297);}else{var _0xd5e900={'method':_0xed53('0x9d'),'uri':_0x40942c+_0xed53('0xb3')+_0x210087,'auth':_0x99c5d4,'json':!![]};return rp(_0xd5e900)[_0xed53('0x25')](function(_0x1e0c48){var _0x5b28f5=[];if(_0x1e0c48['result'][_0xed53('0x35')]>0x0){_0x1e0c48[_0xed53('0x9f')]['forEach'](function(_0x2f0e34){if(_0x2f0e34[_0xed53('0xb4')]==='false'){var _0xc45072={'name':_0x2f0e34[_0xed53('0xa4')],'value':_0x2f0e34[_0xed53('0xb5')]};_0x5b28f5['push'](_0xc45072);}});}_0x1e2297[_0xed53('0x46')]=_0x5b28f5;if(_0x1e2297[_0xed53('0x46')][_0xed53('0x35')]>0x0){_0x310dee(_0x1e2297);}else{if(_0x26b2c4==![]){_0x310dee();}else{_0x310dee(_0x1e2297);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f57db3b..2c9079f 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 _0x2eb2=['request-promise','rimraf','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x47e8c4,_0x483e8f){var _0x4522a4=function(_0x42a658){while(--_0x42a658){_0x47e8c4['push'](_0x47e8c4['shift']());}};_0x4522a4(++_0x483e8f);}(_0x2eb2,0x19f));var _0x22eb=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x2eb2[_0x5416db];return _0x243e35;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x22eb('0x7'));module[_0x22eb('0x8')]=function(_0x35dd5b,_0x2a9850){return _0x35dd5b[_0x22eb('0x9')](_0x22eb('0xa'),attributes,{'tableName':_0x22eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb138=['int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount'];(function(_0x41fe3d,_0x264e26){var _0x58d99d=function(_0x57c776){while(--_0x57c776){_0x41fe3d['push'](_0x41fe3d['shift']());}};_0x58d99d(++_0x264e26);}(_0xb138,0x1dd));var _0x8b13=function(_0x40719f,_0x1deaeb){_0x40719f=_0x40719f-0x0;var _0x40f007=_0xb138[_0x40719f];return _0x40f007;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x8b13('0xa')]=function(_0x13f7bd,_0x5d51b1){return _0x13f7bd[_0x8b13('0xb')](_0x8b13('0xc'),attributes,{'tableName':_0x8b13('0xd'),'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 7a7f181..5848ed5 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 _0xd19f=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowServicenowAccount','find','lodash','util','bluebird'];(function(_0x4943d7,_0x1a715e){var _0x1e8d65=function(_0x1e90d6){while(--_0x1e90d6){_0x4943d7['push'](_0x4943d7['shift']());}};_0x1e8d65(++_0x1a715e);}(_0xd19f,0xa7));var _0xfd19=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0xd19f[_0x10d34b];return _0x92b0bf;};'use strict';var _=require(_0xfd19('0x0'));var util=require(_0xfd19('0x1'));var moment=require('moment');var BPromise=require(_0xfd19('0x2'));var rs=require(_0xfd19('0x3'));var fs=require('fs');var Redis=require(_0xfd19('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd19('0x5'));var logger=require(_0xfd19('0x6'))(_0xfd19('0x7'));var config=require('../../config/environment');var jayson=require(_0xfd19('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39dd32,_0x56c2a6,_0x443183){return new BPromise(function(_0x39cee6,_0x36a2f7){return client[_0xfd19('0x9')](_0x39dd32,_0x443183)[_0xfd19('0xa')](function(_0x49f523){logger[_0xfd19('0xb')](_0xfd19('0xc'),_0x56c2a6,_0xfd19('0xd'));logger[_0xfd19('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x56c2a6,_0xfd19('0xd'),JSON['stringify'](_0x49f523));if(_0x49f523[_0xfd19('0xf')]){if(_0x49f523[_0xfd19('0xf')][_0xfd19('0x10')]===0x1f4){logger[_0xfd19('0xf')](_0xfd19('0xc'),_0x56c2a6,_0x49f523['error'][_0xfd19('0x11')]);return _0x36a2f7(_0x49f523[_0xfd19('0xf')]['message']);}logger['error'](_0xfd19('0xc'),_0x56c2a6,_0x49f523[_0xfd19('0xf')][_0xfd19('0x11')]);return _0x39cee6(_0x49f523[_0xfd19('0xf')][_0xfd19('0x11')]);}else{logger[_0xfd19('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x56c2a6,_0xfd19('0xd'));_0x39cee6(_0x49f523[_0xfd19('0x12')][_0xfd19('0x11')]);}})[_0xfd19('0x13')](function(_0x546e0a){logger[_0xfd19('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x56c2a6,_0x546e0a);_0x36a2f7(_0x546e0a);});});}exports[_0xfd19('0x14')]=function(_0x16c779){var _0x4877e2=this;return new Promise(function(_0x5cd8a7,_0xbe76c9){return db[_0xfd19('0x15')][_0xfd19('0x16')]({'raw':_0x16c779[_0xfd19('0x17')]?_0x16c779[_0xfd19('0x17')][_0xfd19('0x18')]===undefined?!![]:![]:!![],'where':_0x16c779[_0xfd19('0x17')]?_0x16c779[_0xfd19('0x17')][_0xfd19('0x19')]||null:null,'attributes':_0x16c779[_0xfd19('0x17')]?_0x16c779[_0xfd19('0x17')][_0xfd19('0x1a')]||null:null,'limit':_0x16c779[_0xfd19('0x17')]?_0x16c779[_0xfd19('0x17')][_0xfd19('0x1b')]||null:null,'include':_0x16c779['options']?_0x16c779[_0xfd19('0x17')][_0xfd19('0x1c')]?_['map'](_0x16c779[_0xfd19('0x17')][_0xfd19('0x1c')],function(_0x5ba171){return{'model':db[_0x5ba171[_0xfd19('0x1d')]],'as':_0x5ba171['as'],'attributes':_0x5ba171['attributes'],'include':_0x5ba171[_0xfd19('0x1c')]?_[_0xfd19('0x1e')](_0x5ba171[_0xfd19('0x1c')],function(_0xb76997){return{'model':db[_0xb76997[_0xfd19('0x1d')]],'as':_0xb76997['as'],'attributes':_0xb76997[_0xfd19('0x1a')],'include':_0xb76997[_0xfd19('0x1c')]?_[_0xfd19('0x1e')](_0xb76997[_0xfd19('0x1c')],function(_0x22cb10){return{'model':db[_0x22cb10[_0xfd19('0x1d')]],'as':_0x22cb10['as'],'attributes':_0x22cb10['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x58e0c8){logger[_0xfd19('0xb')](_0xfd19('0x14'),_0x16c779);logger[_0xfd19('0xe')](_0xfd19('0x14'),_0x16c779,JSON[_0xfd19('0x1f')](_0x58e0c8));_0x5cd8a7(_0x58e0c8);})['catch'](function(_0x5a9da5){logger[_0xfd19('0xf')]('GetServicenowAccount',_0x5a9da5[_0xfd19('0x11')],_0x16c779);_0xbe76c9(_0x4877e2[_0xfd19('0xf')](0x1f4,_0x5a9da5['message']));});});};exports[_0xfd19('0x20')]=function(_0x308975){var _0x5299b5=this;return new Promise(function(_0x3159d6,_0xe10f43){return db[_0xfd19('0x15')][_0xfd19('0x21')]({'raw':_0x308975[_0xfd19('0x17')]?_0x308975[_0xfd19('0x17')][_0xfd19('0x18')]===undefined?!![]:![]:!![],'where':_0x308975[_0xfd19('0x17')]?_0x308975['options'][_0xfd19('0x19')]||null:null,'attributes':_0x308975['options']?_0x308975[_0xfd19('0x17')][_0xfd19('0x1a')]||null:null,'include':_0x308975[_0xfd19('0x17')]?_0x308975[_0xfd19('0x17')]['include']?_[_0xfd19('0x1e')](_0x308975[_0xfd19('0x17')][_0xfd19('0x1c')],function(_0x916965){return{'model':db[_0x916965[_0xfd19('0x1d')]],'as':_0x916965['as'],'attributes':_0x916965[_0xfd19('0x1a')],'include':_0x916965[_0xfd19('0x1c')]?_[_0xfd19('0x1e')](_0x916965[_0xfd19('0x1c')],function(_0x3a4a78){return{'model':db[_0x3a4a78[_0xfd19('0x1d')]],'as':_0x3a4a78['as'],'attributes':_0x3a4a78[_0xfd19('0x1a')],'include':_0x3a4a78[_0xfd19('0x1c')]?_[_0xfd19('0x1e')](_0x3a4a78[_0xfd19('0x1c')],function(_0x9a2a0e){return{'model':db[_0x9a2a0e[_0xfd19('0x1d')]],'as':_0x9a2a0e['as'],'attributes':_0x9a2a0e[_0xfd19('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfd19('0xa')](function(_0x89ca65){logger[_0xfd19('0xb')](_0xfd19('0x20'),_0x308975);logger[_0xfd19('0xe')](_0xfd19('0x20'),_0x308975,JSON[_0xfd19('0x1f')](_0x89ca65));_0x3159d6(_0x89ca65);})['catch'](function(_0x1f815b){logger[_0xfd19('0xf')](_0xfd19('0x20'),_0x1f815b[_0xfd19('0x11')],_0x308975);_0xe10f43(_0x5299b5[_0xfd19('0xf')](0x1f4,_0x1f815b[_0xfd19('0x11')]));});});}; \ No newline at end of file +var _0x713d=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','include','map','model','attributes','ShowServicenowAccount','find','util','bluebird'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0x713d,0x116));var _0xd713=function(_0xa9192a,_0x22f22d){_0xa9192a=_0xa9192a-0x0;var _0x1a2fc1=_0x713d[_0xa9192a];return _0x1a2fc1;};'use strict';var _=require('lodash');var util=require(_0xd713('0x0'));var moment=require('moment');var BPromise=require(_0xd713('0x1'));var rs=require(_0xd713('0x2'));var fs=require('fs');var Redis=require(_0xd713('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd713('0x4'));var logger=require(_0xd713('0x5'))(_0xd713('0x6'));var config=require(_0xd713('0x7'));var jayson=require(_0xd713('0x8'));var client=jayson[_0xd713('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xee36e3,_0x52f1d1,_0x34939f){return new BPromise(function(_0x4be49f,_0x577185){return client[_0xd713('0xa')](_0xee36e3,_0x34939f)[_0xd713('0xb')](function(_0x151370){logger[_0xd713('0xc')](_0xd713('0xd'),_0x52f1d1,_0xd713('0xe'));logger[_0xd713('0xf')](_0xd713('0x10'),_0x52f1d1,'request\x20sent',JSON[_0xd713('0x11')](_0x151370));if(_0x151370[_0xd713('0x12')]){if(_0x151370[_0xd713('0x12')][_0xd713('0x13')]===0x1f4){logger[_0xd713('0x12')](_0xd713('0xd'),_0x52f1d1,_0x151370[_0xd713('0x12')][_0xd713('0x14')]);return _0x577185(_0x151370[_0xd713('0x12')][_0xd713('0x14')]);}logger[_0xd713('0x12')](_0xd713('0xd'),_0x52f1d1,_0x151370['error'][_0xd713('0x14')]);return _0x4be49f(_0x151370['error'][_0xd713('0x14')]);}else{logger[_0xd713('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x52f1d1,_0xd713('0xe'));_0x4be49f(_0x151370[_0xd713('0x15')]['message']);}})[_0xd713('0x16')](function(_0x53cf97){logger[_0xd713('0x12')](_0xd713('0xd'),_0x52f1d1,_0x53cf97);_0x577185(_0x53cf97);});});}exports[_0xd713('0x17')]=function(_0x11676f){var _0x26efa9=this;return new Promise(function(_0x389b4a,_0x7a24ee){return db[_0xd713('0x18')][_0xd713('0x19')]({'raw':_0x11676f[_0xd713('0x1a')]?_0x11676f[_0xd713('0x1a')][_0xd713('0x1b')]===undefined?!![]:![]:!![],'where':_0x11676f['options']?_0x11676f[_0xd713('0x1a')][_0xd713('0x1c')]||null:null,'attributes':_0x11676f[_0xd713('0x1a')]?_0x11676f[_0xd713('0x1a')]['attributes']||null:null,'limit':_0x11676f[_0xd713('0x1a')]?_0x11676f[_0xd713('0x1a')]['limit']||null:null,'include':_0x11676f[_0xd713('0x1a')]?_0x11676f[_0xd713('0x1a')][_0xd713('0x1d')]?_[_0xd713('0x1e')](_0x11676f[_0xd713('0x1a')][_0xd713('0x1d')],function(_0x119000){return{'model':db[_0x119000[_0xd713('0x1f')]],'as':_0x119000['as'],'attributes':_0x119000[_0xd713('0x20')],'include':_0x119000['include']?_[_0xd713('0x1e')](_0x119000[_0xd713('0x1d')],function(_0x11ee78){return{'model':db[_0x11ee78['model']],'as':_0x11ee78['as'],'attributes':_0x11ee78['attributes'],'include':_0x11ee78[_0xd713('0x1d')]?_[_0xd713('0x1e')](_0x11ee78[_0xd713('0x1d')],function(_0x970873){return{'model':db[_0x970873[_0xd713('0x1f')]],'as':_0x970873['as'],'attributes':_0x970873[_0xd713('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd713('0xb')](function(_0x465452){logger[_0xd713('0xc')]('GetServicenowAccount',_0x11676f);logger[_0xd713('0xf')](_0xd713('0x17'),_0x11676f,JSON[_0xd713('0x11')](_0x465452));_0x389b4a(_0x465452);})['catch'](function(_0x25b5b1){logger[_0xd713('0x12')](_0xd713('0x17'),_0x25b5b1[_0xd713('0x14')],_0x11676f);_0x7a24ee(_0x26efa9['error'](0x1f4,_0x25b5b1[_0xd713('0x14')]));});});};exports[_0xd713('0x21')]=function(_0x300f69){var _0x4162e1=this;return new Promise(function(_0x26d0e7,_0x43d74d){return db[_0xd713('0x18')][_0xd713('0x22')]({'raw':_0x300f69['options']?_0x300f69['options'][_0xd713('0x1b')]===undefined?!![]:![]:!![],'where':_0x300f69[_0xd713('0x1a')]?_0x300f69[_0xd713('0x1a')][_0xd713('0x1c')]||null:null,'attributes':_0x300f69[_0xd713('0x1a')]?_0x300f69[_0xd713('0x1a')][_0xd713('0x20')]||null:null,'include':_0x300f69['options']?_0x300f69['options']['include']?_[_0xd713('0x1e')](_0x300f69[_0xd713('0x1a')][_0xd713('0x1d')],function(_0x5874a3){return{'model':db[_0x5874a3[_0xd713('0x1f')]],'as':_0x5874a3['as'],'attributes':_0x5874a3[_0xd713('0x20')],'include':_0x5874a3['include']?_['map'](_0x5874a3[_0xd713('0x1d')],function(_0x451460){return{'model':db[_0x451460[_0xd713('0x1f')]],'as':_0x451460['as'],'attributes':_0x451460[_0xd713('0x20')],'include':_0x451460['include']?_['map'](_0x451460[_0xd713('0x1d')],function(_0x342f34){return{'model':db[_0x342f34[_0xd713('0x1f')]],'as':_0x342f34['as'],'attributes':_0x342f34[_0xd713('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd713('0xb')](function(_0x2433e1){logger['info'](_0xd713('0x21'),_0x300f69);logger[_0xd713('0xf')](_0xd713('0x21'),_0x300f69,JSON[_0xd713('0x11')](_0x2433e1));_0x26d0e7(_0x2433e1);})[_0xd713('0x16')](function(_0x1f66e1){logger['error'](_0xd713('0x21'),_0x1f66e1[_0xd713('0x14')],_0x300f69);_0x43d74d(_0x4162e1['error'](0x1f4,_0x1f66e1[_0xd713('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 38ffa1c..08ae79b 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 _0xd5b4=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','/:id','update','delete','destroy'];(function(_0xe82743,_0x10ec23){var _0x3877db=function(_0x4f7d4a){while(--_0x4f7d4a){_0xe82743['push'](_0xe82743['shift']());}};_0x3877db(++_0x10ec23);}(_0xd5b4,0x78));var _0x4d5b=function(_0x34165c,_0x3b4a9e){_0x34165c=_0x34165c-0x0;var _0x1e71d7=_0xd5b4[_0x34165c];return _0x1e71d7;};'use strict';var multer=require(_0x4d5b('0x0'));var util=require(_0x4d5b('0x1'));var path=require('path');var timeout=require(_0x4d5b('0x2'));var express=require(_0x4d5b('0x3'));var router=express['Router']();var fs_extra=require(_0x4d5b('0x4'));var auth=require(_0x4d5b('0x5'));var interaction=require(_0x4d5b('0x6'));var config=require(_0x4d5b('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0x4d5b('0x8')]('/',auth[_0x4d5b('0x9')](),controller[_0x4d5b('0xa')]);router[_0x4d5b('0x8')]('/:id',auth[_0x4d5b('0x9')](),controller[_0x4d5b('0xb')]);router[_0x4d5b('0x8')](_0x4d5b('0xc'),auth[_0x4d5b('0x9')](),controller[_0x4d5b('0xd')]);router[_0x4d5b('0x8')](_0x4d5b('0xe'),auth[_0x4d5b('0x9')](),controller[_0x4d5b('0xf')]);router[_0x4d5b('0x8')](_0x4d5b('0x10'),auth[_0x4d5b('0x9')](),controller['getDescriptions']);router[_0x4d5b('0x11')]('/',auth['isAuthenticated'](),controller[_0x4d5b('0x12')]);router[_0x4d5b('0x13')](_0x4d5b('0x14'),auth['isAuthenticated'](),controller[_0x4d5b('0x15')]);router[_0x4d5b('0x16')]('/:id',auth[_0x4d5b('0x9')](),controller[_0x4d5b('0x17')]);module['exports']=router; \ No newline at end of file +var _0x6139=['update','delete','/:id','destroy','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x20c47c,_0x443272){var _0x1cfcd7=function(_0x144ced){while(--_0x144ced){_0x20c47c['push'](_0x20c47c['shift']());}};_0x1cfcd7(++_0x443272);}(_0x6139,0xeb));var _0x9613=function(_0x1b820f,_0x425eb4){_0x1b820f=_0x1b820f-0x0;var _0x423354=_0x6139[_0x1b820f];return _0x423354;};'use strict';var multer=require('multer');var util=require(_0x9613('0x0'));var path=require(_0x9613('0x1'));var timeout=require('connect-timeout');var express=require(_0x9613('0x2'));var router=express['Router']();var fs_extra=require(_0x9613('0x3'));var auth=require(_0x9613('0x4'));var interaction=require(_0x9613('0x5'));var config=require(_0x9613('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0x9613('0x7')]('/',auth[_0x9613('0x8')](),controller[_0x9613('0x9')]);router[_0x9613('0x7')]('/:id',auth[_0x9613('0x8')](),controller[_0x9613('0xa')]);router[_0x9613('0x7')](_0x9613('0xb'),auth[_0x9613('0x8')](),controller[_0x9613('0xc')]);router[_0x9613('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x9613('0xd')]);router[_0x9613('0x7')](_0x9613('0xe'),auth[_0x9613('0x8')](),controller[_0x9613('0xf')]);router[_0x9613('0x10')]('/',auth[_0x9613('0x8')](),controller['create']);router['put']('/:id',auth[_0x9613('0x8')](),controller[_0x9613('0x11')]);router[_0x9613('0x12')](_0x9613('0x13'),auth[_0x9613('0x8')](),controller[_0x9613('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 89f7e6f..949b442 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 _0x9b48=['sequelize','exports','STRING'];(function(_0x54614a,_0x1eb862){var _0x360f8d=function(_0x48e183){while(--_0x48e183){_0x54614a['push'](_0x54614a['shift']());}};_0x360f8d(++_0x1eb862);}(_0x9b48,0x84));var _0x89b4=function(_0x3404b6,_0x54fb23){_0x3404b6=_0x3404b6-0x0;var _0x204b72=_0x9b48[_0x3404b6];return _0x204b72;};'use strict';var Sequelize=require(_0x89b4('0x0'));module[_0x89b4('0x1')]={'name':{'type':Sequelize[_0x89b4('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xba4c=['STRING','sequelize','exports'];(function(_0x193fee,_0x53b9d9){var _0x5802c6=function(_0x27dfcf){while(--_0x27dfcf){_0x193fee['push'](_0x193fee['shift']());}};_0x5802c6(++_0x53b9d9);}(_0xba4c,0x1b4));var _0xcba4=function(_0x3c6091,_0x70e2b7){_0x3c6091=_0x3c6091-0x0;var _0x24150c=_0xba4c[_0x3c6091];return _0x24150c;};'use strict';var Sequelize=require(_0xcba4('0x0'));module[_0xcba4('0x1')]={'name':{'type':Sequelize[_0xcba4('0x2')]},'description':{'type':Sequelize[_0xcba4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index ab4151f..a4196a6 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 _0x8136=['index','map','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','includeAll','ServicenowConfiguration','findAll','rows','catch','show','params','fields','include','options','find','create','body','getFields','findOne','keys','ServicenowField','rawAttributes','pick','filter','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','send'];(function(_0x9c7f6d,_0x1832fc){var _0x4ad4fa=function(_0xc45bd8){while(--_0xc45bd8){_0x9c7f6d['push'](_0x9c7f6d['shift']());}};_0x4ad4fa(++_0x1832fc);}(_0x8136,0x7b));var _0x6813=function(_0x4ad59b,_0x3773a7){_0x4ad59b=_0x4ad59b-0x0;var _0xff9451=_0x8136[_0x4ad59b];return _0xff9451;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6813('0x0'));var zipdir=require(_0x6813('0x1'));var jsonpatch=require(_0x6813('0x2'));var rp=require(_0x6813('0x3'));var moment=require(_0x6813('0x4'));var BPromise=require(_0x6813('0x5'));var Mustache=require(_0x6813('0x6'));var util=require(_0x6813('0x7'));var path=require(_0x6813('0x8'));var sox=require(_0x6813('0x9'));var csv=require(_0x6813('0xa'));var ejs=require(_0x6813('0xb'));var fs=require('fs');var fs_extra=require(_0x6813('0xc'));var _=require(_0x6813('0xd'));var squel=require('squel');var crypto=require(_0x6813('0xe'));var jsforce=require(_0x6813('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6813('0xa'));var querystring=require(_0x6813('0x10'));var Papa=require(_0x6813('0x11'));var Redis=require(_0x6813('0x12'));var authService=require(_0x6813('0x13'));var qs=require(_0x6813('0x14'));var as=require(_0x6813('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6813('0x16'))(_0x6813('0x17'));var utils=require('../../config/utils');var config=require(_0x6813('0x18'));var licenseUtil=require(_0x6813('0x19'));var db=require(_0x6813('0x1a'))['db'];function respondWithStatusCode(_0x5d2c0f,_0x2f6ae9){_0x2f6ae9=_0x2f6ae9||0xcc;return function(_0x12d303){if(_0x12d303){return _0x5d2c0f['sendStatus'](_0x2f6ae9);}return _0x5d2c0f[_0x6813('0x1b')](_0x2f6ae9)[_0x6813('0x1c')]();};}function respondWithResult(_0x19f0c0,_0x485668){_0x485668=_0x485668||0xc8;return function(_0x368923){if(_0x368923){return _0x19f0c0[_0x6813('0x1b')](_0x485668)[_0x6813('0x1d')](_0x368923);}};}function respondWithFilteredResult(_0x1832a2,_0x21d383){return function(_0x5cc978){if(_0x5cc978){var _0x332f29=typeof _0x21d383[_0x6813('0x1e')]===_0x6813('0x1f')&&typeof _0x21d383[_0x6813('0x20')]===_0x6813('0x1f');var _0x4a56e1=_0x5cc978[_0x6813('0x21')];var _0x45d348=_0x332f29?0x0:_0x21d383[_0x6813('0x1e')];var _0xbca7a6=_0x332f29?_0x5cc978[_0x6813('0x21')]:_0x21d383['offset']+_0x21d383[_0x6813('0x20')];var _0x1ba785;if(_0xbca7a6>=_0x4a56e1){_0xbca7a6=_0x4a56e1;_0x1ba785=0xc8;}else{_0x1ba785=0xce;}_0x1832a2['status'](_0x1ba785);return _0x1832a2[_0x6813('0x22')](_0x6813('0x23'),_0x45d348+'-'+_0xbca7a6+'/'+_0x4a56e1)[_0x6813('0x1d')](_0x5cc978);}return null;};}function patchUpdates(_0x5e35da){return function(_0x1a8370){try{jsonpatch['apply'](_0x1a8370,_0x5e35da,!![]);}catch(_0x475477){return BPromise[_0x6813('0x24')](_0x475477);}return _0x1a8370[_0x6813('0x25')]();};}function saveUpdates(_0x5cd86b,_0x41ba55){return function(_0xac8e0b){if(_0xac8e0b){return _0xac8e0b[_0x6813('0x26')](_0x5cd86b)[_0x6813('0x27')](function(_0x5bb880){return _0x5bb880;});}return null;};}function removeEntity(_0x18be66,_0x27877f){return function(_0xfd26a8){if(_0xfd26a8){return _0xfd26a8[_0x6813('0x28')]()[_0x6813('0x27')](function(){_0x18be66[_0x6813('0x1b')](0xcc)[_0x6813('0x1c')]();});}};}function handleEntityNotFound(_0x590acd,_0x161351){return function(_0x29c9b9){if(!_0x29c9b9){_0x590acd[_0x6813('0x29')](0x194);}return _0x29c9b9;};}function handleError(_0x5db411,_0x2782c9){_0x2782c9=_0x2782c9||0x1f4;return function(_0x1708e6){logger[_0x6813('0x2a')](_0x1708e6['stack']);if(_0x1708e6['name']){delete _0x1708e6[_0x6813('0x2b')];}_0x5db411[_0x6813('0x1b')](_0x2782c9)[_0x6813('0x2c')](_0x1708e6);};}exports[_0x6813('0x2d')]=function(_0x2f092f,_0x57ddec){var _0x174e5d={},_0x23aa81={},_0x3743ce={'count':0x0,'rows':[]};var _0x1a1c7b=_[_0x6813('0x2e')](db['ServicenowConfiguration']['rawAttributes'],function(_0x46e183){return{'name':_0x46e183['fieldName'],'type':_0x46e183['type'][_0x6813('0x2f')]};});_0x23aa81[_0x6813('0x30')]=_[_0x6813('0x2e')](_0x1a1c7b,_0x6813('0x2b'));_0x23aa81[_0x6813('0x31')]=_['keys'](_0x2f092f[_0x6813('0x31')]);_0x23aa81[_0x6813('0x32')]=_[_0x6813('0x33')](_0x23aa81[_0x6813('0x30')],_0x23aa81[_0x6813('0x31')]);_0x174e5d[_0x6813('0x34')]=_[_0x6813('0x33')](_0x23aa81['model'],qs['fields'](_0x2f092f[_0x6813('0x31')]['fields']));_0x174e5d[_0x6813('0x34')]=_0x174e5d[_0x6813('0x34')][_0x6813('0x35')]?_0x174e5d[_0x6813('0x34')]:_0x23aa81[_0x6813('0x30')];if(!_0x2f092f[_0x6813('0x31')][_0x6813('0x36')](_0x6813('0x37'))){_0x174e5d[_0x6813('0x20')]=qs['limit'](_0x2f092f[_0x6813('0x31')][_0x6813('0x20')]);_0x174e5d['offset']=qs['offset'](_0x2f092f[_0x6813('0x31')]['offset']);}_0x174e5d[_0x6813('0x38')]=qs[_0x6813('0x39')](_0x2f092f[_0x6813('0x31')][_0x6813('0x39')]);_0x174e5d[_0x6813('0x3a')]=qs[_0x6813('0x32')](_['pick'](_0x2f092f[_0x6813('0x31')],_0x23aa81[_0x6813('0x32')]),_0x1a1c7b);if(_0x2f092f['query']['filter']){_0x174e5d[_0x6813('0x3a')]=_[_0x6813('0x3b')](_0x174e5d[_0x6813('0x3a')],{'$or':_[_0x6813('0x2e')](_0x1a1c7b,function(_0x5157f3){if(_0x5157f3[_0x6813('0x3c')]!==_0x6813('0x3d')){var _0x68c6e6={};_0x68c6e6[_0x5157f3['name']]={'$like':'%'+_0x2f092f['query']['filter']+'%'};return _0x68c6e6;}})});}_0x174e5d=_[_0x6813('0x3b')]({},_0x174e5d,_0x2f092f['options']);var _0xdb7ae1={'where':_0x174e5d[_0x6813('0x3a')]};return db['ServicenowConfiguration']['count'](_0xdb7ae1)[_0x6813('0x27')](function(_0x51e7ae){_0x3743ce[_0x6813('0x21')]=_0x51e7ae;if(_0x2f092f[_0x6813('0x31')][_0x6813('0x3e')]){_0x174e5d['include']=[{'all':!![]}];}return db[_0x6813('0x3f')][_0x6813('0x40')](_0x174e5d);})[_0x6813('0x27')](function(_0x504a05){_0x3743ce[_0x6813('0x41')]=_0x504a05;return _0x3743ce;})[_0x6813('0x27')](respondWithFilteredResult(_0x57ddec,_0x174e5d))[_0x6813('0x42')](handleError(_0x57ddec,null));};exports[_0x6813('0x43')]=function(_0x172f4f,_0x28d1b0){var _0x4cdba0={'raw':![],'where':{'id':_0x172f4f[_0x6813('0x44')]['id']}},_0x4c8622={};_0x4c8622['model']=_['keys'](db[_0x6813('0x3f')]['rawAttributes']);_0x4c8622[_0x6813('0x31')]=_['keys'](_0x172f4f[_0x6813('0x31')]);_0x4c8622['filters']=_[_0x6813('0x33')](_0x4c8622[_0x6813('0x30')],_0x4c8622[_0x6813('0x31')]);_0x4cdba0[_0x6813('0x34')]=_[_0x6813('0x33')](_0x4c8622['model'],qs[_0x6813('0x45')](_0x172f4f[_0x6813('0x31')][_0x6813('0x45')]));_0x4cdba0['attributes']=_0x4cdba0['attributes']['length']?_0x4cdba0[_0x6813('0x34')]:_0x4c8622[_0x6813('0x30')];if(_0x172f4f['query']['includeAll']){_0x4cdba0[_0x6813('0x46')]=[{'all':!![]}];}_0x4cdba0=_[_0x6813('0x3b')]({},_0x4cdba0,_0x172f4f[_0x6813('0x47')]);return db[_0x6813('0x3f')][_0x6813('0x48')](_0x4cdba0)[_0x6813('0x27')](handleEntityNotFound(_0x28d1b0,null))['then'](respondWithResult(_0x28d1b0,null))[_0x6813('0x42')](handleError(_0x28d1b0,null));};exports['create']=function(_0x3fecf2,_0x861c52){return db[_0x6813('0x3f')][_0x6813('0x49')](_0x3fecf2['body'],{})[_0x6813('0x27')](respondWithResult(_0x861c52,0xc9))[_0x6813('0x42')](handleError(_0x861c52,null));};exports['update']=function(_0x4cdad8,_0x22e3b4){if(_0x4cdad8[_0x6813('0x4a')]['id']){delete _0x4cdad8[_0x6813('0x4a')]['id'];}return db['ServicenowConfiguration'][_0x6813('0x48')]({'where':{'id':_0x4cdad8[_0x6813('0x44')]['id']}})[_0x6813('0x27')](handleEntityNotFound(_0x22e3b4,null))[_0x6813('0x27')](saveUpdates(_0x4cdad8['body'],null))[_0x6813('0x27')](respondWithResult(_0x22e3b4,null))['catch'](handleError(_0x22e3b4,null));};exports['destroy']=function(_0x563bcd,_0x53bded){return db[_0x6813('0x3f')]['find']({'where':{'id':_0x563bcd[_0x6813('0x44')]['id']}})[_0x6813('0x27')](handleEntityNotFound(_0x53bded,null))[_0x6813('0x27')](removeEntity(_0x53bded,null))[_0x6813('0x42')](handleError(_0x53bded,null));};exports[_0x6813('0x4b')]=function(_0x1d550d,_0x6efc22,_0x19f0fc){var _0x1f2a25={};var _0x53edb2={};var _0x88930b;var _0x4aad3c;return db[_0x6813('0x3f')][_0x6813('0x4c')]({'where':{'id':_0x1d550d[_0x6813('0x44')]['id']}})[_0x6813('0x27')](handleEntityNotFound(_0x6efc22,null))['then'](function(_0x1972f1){if(_0x1972f1){_0x88930b=_0x1972f1;_0x53edb2[_0x6813('0x30')]=_[_0x6813('0x4d')](db[_0x6813('0x4e')][_0x6813('0x4f')]);_0x53edb2[_0x6813('0x31')]=_['keys'](_0x1d550d[_0x6813('0x31')]);_0x53edb2[_0x6813('0x32')]=_['intersection'](_0x53edb2['model'],_0x53edb2['query']);_0x1f2a25[_0x6813('0x34')]=_[_0x6813('0x33')](_0x53edb2['model'],qs[_0x6813('0x45')](_0x1d550d[_0x6813('0x31')][_0x6813('0x45')]));_0x1f2a25[_0x6813('0x34')]=_0x1f2a25[_0x6813('0x34')][_0x6813('0x35')]?_0x1f2a25[_0x6813('0x34')]:_0x53edb2[_0x6813('0x30')];_0x1f2a25['order']=qs['sort'](_0x1d550d[_0x6813('0x31')][_0x6813('0x39')]);_0x1f2a25[_0x6813('0x3a')]=qs['filters'](_[_0x6813('0x50')](_0x1d550d[_0x6813('0x31')],_0x53edb2['filters']));if(_0x1d550d[_0x6813('0x31')][_0x6813('0x51')]){_0x1f2a25[_0x6813('0x3a')]=_[_0x6813('0x3b')](_0x1f2a25[_0x6813('0x3a')],{'$or':_[_0x6813('0x2e')](_0x1f2a25[_0x6813('0x34')],function(_0x35d898){var _0x1f08a0={};_0x1f08a0[_0x35d898]={'$like':'%'+_0x1d550d[_0x6813('0x31')]['filter']+'%'};return _0x1f08a0;})});}_0x1f2a25=_[_0x6813('0x3b')]({},_0x1f2a25,_0x1d550d[_0x6813('0x47')]);return _0x88930b[_0x6813('0x4b')](_0x1f2a25);}})[_0x6813('0x27')](function(_0x5b5d6f){if(_0x5b5d6f){_0x4aad3c=_0x5b5d6f[_0x6813('0x35')];if(!_0x1d550d[_0x6813('0x31')][_0x6813('0x36')](_0x6813('0x37'))){_0x1f2a25['limit']=qs[_0x6813('0x20')](_0x1d550d[_0x6813('0x31')][_0x6813('0x20')]);_0x1f2a25[_0x6813('0x1e')]=qs['offset'](_0x1d550d['query'][_0x6813('0x1e')]);}return _0x88930b[_0x6813('0x4b')](_0x1f2a25);}})[_0x6813('0x27')](function(_0x93711d){if(_0x93711d){return _0x93711d?{'count':_0x4aad3c,'rows':_0x93711d}:null;}})[_0x6813('0x27')](respondWithResult(_0x6efc22,null))['catch'](handleError(_0x6efc22,null));};exports['getSubjects']=function(_0x25ac20,_0x4a4f2c,_0x33d7ee){var _0x1c596b={};var _0x2d2608={};var _0x591964;var _0x3926ed;return db[_0x6813('0x3f')][_0x6813('0x4c')]({'where':{'id':_0x25ac20['params']['id']}})[_0x6813('0x27')](handleEntityNotFound(_0x4a4f2c,null))[_0x6813('0x27')](function(_0x1baa2d){if(_0x1baa2d){_0x591964=_0x1baa2d;_0x2d2608[_0x6813('0x30')]=_['keys'](db[_0x6813('0x4e')][_0x6813('0x4f')]);_0x2d2608[_0x6813('0x31')]=_[_0x6813('0x4d')](_0x25ac20[_0x6813('0x31')]);_0x2d2608['filters']=_['intersection'](_0x2d2608['model'],_0x2d2608[_0x6813('0x31')]);_0x1c596b[_0x6813('0x34')]=_[_0x6813('0x33')](_0x2d2608[_0x6813('0x30')],qs[_0x6813('0x45')](_0x25ac20[_0x6813('0x31')]['fields']));_0x1c596b[_0x6813('0x34')]=_0x1c596b['attributes']['length']?_0x1c596b['attributes']:_0x2d2608[_0x6813('0x30')];_0x1c596b[_0x6813('0x38')]=qs[_0x6813('0x39')](_0x25ac20['query'][_0x6813('0x39')]);_0x1c596b['where']=qs[_0x6813('0x32')](_[_0x6813('0x50')](_0x25ac20['query'],_0x2d2608['filters']));if(_0x25ac20[_0x6813('0x31')][_0x6813('0x51')]){_0x1c596b[_0x6813('0x3a')]=_['merge'](_0x1c596b[_0x6813('0x3a')],{'$or':_['map'](_0x1c596b[_0x6813('0x34')],function(_0x3bd047){var _0x46f732={};_0x46f732[_0x3bd047]={'$like':'%'+_0x25ac20[_0x6813('0x31')][_0x6813('0x51')]+'%'};return _0x46f732;})});}_0x1c596b=_[_0x6813('0x3b')]({},_0x1c596b,_0x25ac20['options']);return _0x591964['getSubjects'](_0x1c596b);}})[_0x6813('0x27')](function(_0x5b4340){if(_0x5b4340){_0x3926ed=_0x5b4340[_0x6813('0x35')];if(!_0x25ac20[_0x6813('0x31')][_0x6813('0x36')](_0x6813('0x37'))){_0x1c596b[_0x6813('0x20')]=qs['limit'](_0x25ac20[_0x6813('0x31')][_0x6813('0x20')]);_0x1c596b[_0x6813('0x1e')]=qs[_0x6813('0x1e')](_0x25ac20[_0x6813('0x31')]['offset']);}return _0x591964[_0x6813('0x52')](_0x1c596b);}})[_0x6813('0x27')](function(_0xc4f6a6){if(_0xc4f6a6){return _0xc4f6a6?{'count':_0x3926ed,'rows':_0xc4f6a6}:null;}})['then'](respondWithResult(_0x4a4f2c,null))['catch'](handleError(_0x4a4f2c,null));};exports[_0x6813('0x53')]=function(_0x277b04,_0xc52004,_0x5d0bb3){var _0x42715d={};var _0x1b6fbc={};var _0x4083ff;var _0x30ead9;return db[_0x6813('0x3f')]['findOne']({'where':{'id':_0x277b04[_0x6813('0x44')]['id']}})[_0x6813('0x27')](handleEntityNotFound(_0xc52004,null))['then'](function(_0x3a85a2){if(_0x3a85a2){_0x4083ff=_0x3a85a2;_0x1b6fbc[_0x6813('0x30')]=_[_0x6813('0x4d')](db['ServicenowField']['rawAttributes']);_0x1b6fbc[_0x6813('0x31')]=_['keys'](_0x277b04[_0x6813('0x31')]);_0x1b6fbc[_0x6813('0x32')]=_[_0x6813('0x33')](_0x1b6fbc['model'],_0x1b6fbc[_0x6813('0x31')]);_0x42715d[_0x6813('0x34')]=_['intersection'](_0x1b6fbc[_0x6813('0x30')],qs[_0x6813('0x45')](_0x277b04['query'][_0x6813('0x45')]));_0x42715d[_0x6813('0x34')]=_0x42715d[_0x6813('0x34')]['length']?_0x42715d[_0x6813('0x34')]:_0x1b6fbc[_0x6813('0x30')];_0x42715d[_0x6813('0x38')]=qs['sort'](_0x277b04['query'][_0x6813('0x39')]);_0x42715d[_0x6813('0x3a')]=qs[_0x6813('0x32')](_[_0x6813('0x50')](_0x277b04['query'],_0x1b6fbc[_0x6813('0x32')]));if(_0x277b04[_0x6813('0x31')]['filter']){_0x42715d[_0x6813('0x3a')]=_['merge'](_0x42715d[_0x6813('0x3a')],{'$or':_['map'](_0x42715d[_0x6813('0x34')],function(_0x435a20){var _0x1e3057={};_0x1e3057[_0x435a20]={'$like':'%'+_0x277b04[_0x6813('0x31')][_0x6813('0x51')]+'%'};return _0x1e3057;})});}_0x42715d=_[_0x6813('0x3b')]({},_0x42715d,_0x277b04[_0x6813('0x47')]);return _0x4083ff[_0x6813('0x53')](_0x42715d);}})[_0x6813('0x27')](function(_0x15e3da){if(_0x15e3da){_0x30ead9=_0x15e3da[_0x6813('0x35')];if(!_0x277b04[_0x6813('0x31')][_0x6813('0x36')]('nolimit')){_0x42715d[_0x6813('0x20')]=qs[_0x6813('0x20')](_0x277b04[_0x6813('0x31')][_0x6813('0x20')]);_0x42715d['offset']=qs[_0x6813('0x1e')](_0x277b04[_0x6813('0x31')][_0x6813('0x1e')]);}return _0x4083ff['getDescriptions'](_0x42715d);}})[_0x6813('0x27')](function(_0x50931e){if(_0x50931e){return _0x50931e?{'count':_0x30ead9,'rows':_0x50931e}:null;}})[_0x6813('0x27')](respondWithResult(_0xc52004,null))[_0x6813('0x42')](handleError(_0xc52004,null));}; \ No newline at end of file +var _0x7cf2=['../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','ServicenowConfiguration','includeAll','include','findAll','catch','show','params','find','create','body','ServicenowField','length','getFields','getSubjects','findOne','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x4c3ffe,_0x457374){var _0x28d3eb=function(_0x3ae2a3){while(--_0x3ae2a3){_0x4c3ffe['push'](_0x4c3ffe['shift']());}};_0x28d3eb(++_0x457374);}(_0x7cf2,0x169));var _0x27cf=function(_0x5c8f3e,_0x33ba70){_0x5c8f3e=_0x5c8f3e-0x0;var _0xb55f35=_0x7cf2[_0x5c8f3e];return _0xb55f35;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27cf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x27cf('0x1'));var rp=require(_0x27cf('0x2'));var moment=require(_0x27cf('0x3'));var BPromise=require(_0x27cf('0x4'));var Mustache=require('mustache');var util=require(_0x27cf('0x5'));var path=require(_0x27cf('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x27cf('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x27cf('0x8'));var squel=require(_0x27cf('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x27cf('0xa'));var querystring=require(_0x27cf('0xb'));var Papa=require('papaparse');var Redis=require(_0x27cf('0xc'));var authService=require(_0x27cf('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x27cf('0xe'));var logger=require('../../config/logger')(_0x27cf('0xf'));var utils=require(_0x27cf('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x27cf('0x11'));var db=require(_0x27cf('0x12'))['db'];function respondWithStatusCode(_0x39ab9d,_0x3650f3){_0x3650f3=_0x3650f3||0xcc;return function(_0x480781){if(_0x480781){return _0x39ab9d[_0x27cf('0x13')](_0x3650f3);}return _0x39ab9d[_0x27cf('0x14')](_0x3650f3)[_0x27cf('0x15')]();};}function respondWithResult(_0x2dbb5a,_0x208cc2){_0x208cc2=_0x208cc2||0xc8;return function(_0x145229){if(_0x145229){return _0x2dbb5a[_0x27cf('0x14')](_0x208cc2)[_0x27cf('0x16')](_0x145229);}};}function respondWithFilteredResult(_0x1dfb06,_0x5de00f){return function(_0x5e483b){if(_0x5e483b){var _0x1fe419=typeof _0x5de00f[_0x27cf('0x17')]===_0x27cf('0x18')&&typeof _0x5de00f[_0x27cf('0x19')]===_0x27cf('0x18');var _0x4f229b=_0x5e483b[_0x27cf('0x1a')];var _0x35c8f9=_0x1fe419?0x0:_0x5de00f[_0x27cf('0x17')];var _0x2798a7=_0x1fe419?_0x5e483b['count']:_0x5de00f[_0x27cf('0x17')]+_0x5de00f[_0x27cf('0x19')];var _0xb71f11;if(_0x2798a7>=_0x4f229b){_0x2798a7=_0x4f229b;_0xb71f11=0xc8;}else{_0xb71f11=0xce;}_0x1dfb06[_0x27cf('0x14')](_0xb71f11);return _0x1dfb06[_0x27cf('0x1b')](_0x27cf('0x1c'),_0x35c8f9+'-'+_0x2798a7+'/'+_0x4f229b)[_0x27cf('0x16')](_0x5e483b);}return null;};}function patchUpdates(_0x5061d6){return function(_0x51f1fb){try{jsonpatch['apply'](_0x51f1fb,_0x5061d6,!![]);}catch(_0x264160){return BPromise[_0x27cf('0x1d')](_0x264160);}return _0x51f1fb[_0x27cf('0x1e')]();};}function saveUpdates(_0x31aca5,_0x3f4996){return function(_0xf04e8a){if(_0xf04e8a){return _0xf04e8a[_0x27cf('0x1f')](_0x31aca5)[_0x27cf('0x20')](function(_0x433655){return _0x433655;});}return null;};}function removeEntity(_0x12af40,_0x3f6591){return function(_0x10dc40){if(_0x10dc40){return _0x10dc40['destroy']()[_0x27cf('0x20')](function(){_0x12af40[_0x27cf('0x14')](0xcc)[_0x27cf('0x15')]();});}};}function handleEntityNotFound(_0xc2fca7,_0x241f84){return function(_0x25b931){if(!_0x25b931){_0xc2fca7[_0x27cf('0x13')](0x194);}return _0x25b931;};}function handleError(_0x2d468f,_0x5e98f4){_0x5e98f4=_0x5e98f4||0x1f4;return function(_0x1f85cf){logger[_0x27cf('0x21')](_0x1f85cf[_0x27cf('0x22')]);if(_0x1f85cf[_0x27cf('0x23')]){delete _0x1f85cf[_0x27cf('0x23')];}_0x2d468f[_0x27cf('0x14')](_0x5e98f4)[_0x27cf('0x24')](_0x1f85cf);};}exports[_0x27cf('0x25')]=function(_0x439d3d,_0x42ea80){var _0x30a71c={},_0x112bc0={},_0x215332={'count':0x0,'rows':[]};var _0x29de2d=_['map'](db['ServicenowConfiguration'][_0x27cf('0x26')],function(_0x19bc56){return{'name':_0x19bc56[_0x27cf('0x27')],'type':_0x19bc56[_0x27cf('0x28')][_0x27cf('0x29')]};});_0x112bc0[_0x27cf('0x2a')]=_[_0x27cf('0x2b')](_0x29de2d,_0x27cf('0x23'));_0x112bc0['query']=_[_0x27cf('0x2c')](_0x439d3d[_0x27cf('0x2d')]);_0x112bc0['filters']=_[_0x27cf('0x2e')](_0x112bc0[_0x27cf('0x2a')],_0x112bc0[_0x27cf('0x2d')]);_0x30a71c[_0x27cf('0x2f')]=_[_0x27cf('0x2e')](_0x112bc0['model'],qs[_0x27cf('0x30')](_0x439d3d['query'][_0x27cf('0x30')]));_0x30a71c[_0x27cf('0x2f')]=_0x30a71c[_0x27cf('0x2f')]['length']?_0x30a71c[_0x27cf('0x2f')]:_0x112bc0[_0x27cf('0x2a')];if(!_0x439d3d[_0x27cf('0x2d')][_0x27cf('0x31')](_0x27cf('0x32'))){_0x30a71c[_0x27cf('0x19')]=qs[_0x27cf('0x19')](_0x439d3d[_0x27cf('0x2d')][_0x27cf('0x19')]);_0x30a71c['offset']=qs['offset'](_0x439d3d['query'][_0x27cf('0x17')]);}_0x30a71c[_0x27cf('0x33')]=qs[_0x27cf('0x34')](_0x439d3d['query'][_0x27cf('0x34')]);_0x30a71c[_0x27cf('0x35')]=qs[_0x27cf('0x36')](_[_0x27cf('0x37')](_0x439d3d[_0x27cf('0x2d')],_0x112bc0[_0x27cf('0x36')]),_0x29de2d);if(_0x439d3d['query'][_0x27cf('0x38')]){_0x30a71c[_0x27cf('0x35')]=_['merge'](_0x30a71c['where'],{'$or':_[_0x27cf('0x2b')](_0x29de2d,function(_0x29ee6a){if(_0x29ee6a[_0x27cf('0x28')]!==_0x27cf('0x39')){var _0x2b10e3={};_0x2b10e3[_0x29ee6a[_0x27cf('0x23')]]={'$like':'%'+_0x439d3d[_0x27cf('0x2d')][_0x27cf('0x38')]+'%'};return _0x2b10e3;}})});}_0x30a71c=_[_0x27cf('0x3a')]({},_0x30a71c,_0x439d3d[_0x27cf('0x3b')]);var _0x4762b6={'where':_0x30a71c[_0x27cf('0x35')]};return db[_0x27cf('0x3c')][_0x27cf('0x1a')](_0x4762b6)[_0x27cf('0x20')](function(_0x2b0c7e){_0x215332['count']=_0x2b0c7e;if(_0x439d3d['query'][_0x27cf('0x3d')]){_0x30a71c[_0x27cf('0x3e')]=[{'all':!![]}];}return db[_0x27cf('0x3c')][_0x27cf('0x3f')](_0x30a71c);})[_0x27cf('0x20')](function(_0xb88d23){_0x215332['rows']=_0xb88d23;return _0x215332;})[_0x27cf('0x20')](respondWithFilteredResult(_0x42ea80,_0x30a71c))[_0x27cf('0x40')](handleError(_0x42ea80,null));};exports[_0x27cf('0x41')]=function(_0x249c08,_0x1a2215){var _0x3816fa={'raw':![],'where':{'id':_0x249c08[_0x27cf('0x42')]['id']}},_0x27eedf={};_0x27eedf['model']=_[_0x27cf('0x2c')](db['ServicenowConfiguration'][_0x27cf('0x26')]);_0x27eedf[_0x27cf('0x2d')]=_['keys'](_0x249c08[_0x27cf('0x2d')]);_0x27eedf[_0x27cf('0x36')]=_[_0x27cf('0x2e')](_0x27eedf[_0x27cf('0x2a')],_0x27eedf['query']);_0x3816fa['attributes']=_[_0x27cf('0x2e')](_0x27eedf[_0x27cf('0x2a')],qs[_0x27cf('0x30')](_0x249c08['query'][_0x27cf('0x30')]));_0x3816fa['attributes']=_0x3816fa[_0x27cf('0x2f')]['length']?_0x3816fa[_0x27cf('0x2f')]:_0x27eedf[_0x27cf('0x2a')];if(_0x249c08[_0x27cf('0x2d')][_0x27cf('0x3d')]){_0x3816fa[_0x27cf('0x3e')]=[{'all':!![]}];}_0x3816fa=_[_0x27cf('0x3a')]({},_0x3816fa,_0x249c08[_0x27cf('0x3b')]);return db[_0x27cf('0x3c')][_0x27cf('0x43')](_0x3816fa)['then'](handleEntityNotFound(_0x1a2215,null))[_0x27cf('0x20')](respondWithResult(_0x1a2215,null))[_0x27cf('0x40')](handleError(_0x1a2215,null));};exports[_0x27cf('0x44')]=function(_0x347647,_0x4cb275){return db[_0x27cf('0x3c')][_0x27cf('0x44')](_0x347647[_0x27cf('0x45')],{})['then'](respondWithResult(_0x4cb275,0xc9))[_0x27cf('0x40')](handleError(_0x4cb275,null));};exports[_0x27cf('0x1f')]=function(_0x433423,_0x4f6295){if(_0x433423[_0x27cf('0x45')]['id']){delete _0x433423[_0x27cf('0x45')]['id'];}return db[_0x27cf('0x3c')]['find']({'where':{'id':_0x433423['params']['id']}})[_0x27cf('0x20')](handleEntityNotFound(_0x4f6295,null))[_0x27cf('0x20')](saveUpdates(_0x433423[_0x27cf('0x45')],null))[_0x27cf('0x20')](respondWithResult(_0x4f6295,null))[_0x27cf('0x40')](handleError(_0x4f6295,null));};exports['destroy']=function(_0x5575b7,_0x44d09e){return db[_0x27cf('0x3c')][_0x27cf('0x43')]({'where':{'id':_0x5575b7[_0x27cf('0x42')]['id']}})['then'](handleEntityNotFound(_0x44d09e,null))['then'](removeEntity(_0x44d09e,null))[_0x27cf('0x40')](handleError(_0x44d09e,null));};exports['getFields']=function(_0xb24756,_0x586c6a,_0x480747){var _0x25341b={};var _0x83d3f8={};var _0x1e30fa;var _0x1bd337;return db[_0x27cf('0x3c')]['findOne']({'where':{'id':_0xb24756['params']['id']}})['then'](handleEntityNotFound(_0x586c6a,null))[_0x27cf('0x20')](function(_0x435995){if(_0x435995){_0x1e30fa=_0x435995;_0x83d3f8['model']=_['keys'](db[_0x27cf('0x46')][_0x27cf('0x26')]);_0x83d3f8[_0x27cf('0x2d')]=_[_0x27cf('0x2c')](_0xb24756['query']);_0x83d3f8[_0x27cf('0x36')]=_['intersection'](_0x83d3f8[_0x27cf('0x2a')],_0x83d3f8[_0x27cf('0x2d')]);_0x25341b['attributes']=_[_0x27cf('0x2e')](_0x83d3f8[_0x27cf('0x2a')],qs[_0x27cf('0x30')](_0xb24756['query'][_0x27cf('0x30')]));_0x25341b['attributes']=_0x25341b[_0x27cf('0x2f')][_0x27cf('0x47')]?_0x25341b[_0x27cf('0x2f')]:_0x83d3f8[_0x27cf('0x2a')];_0x25341b[_0x27cf('0x33')]=qs[_0x27cf('0x34')](_0xb24756[_0x27cf('0x2d')][_0x27cf('0x34')]);_0x25341b[_0x27cf('0x35')]=qs[_0x27cf('0x36')](_['pick'](_0xb24756[_0x27cf('0x2d')],_0x83d3f8[_0x27cf('0x36')]));if(_0xb24756[_0x27cf('0x2d')]['filter']){_0x25341b[_0x27cf('0x35')]=_[_0x27cf('0x3a')](_0x25341b[_0x27cf('0x35')],{'$or':_[_0x27cf('0x2b')](_0x25341b[_0x27cf('0x2f')],function(_0x3d636a){var _0x200ed4={};_0x200ed4[_0x3d636a]={'$like':'%'+_0xb24756[_0x27cf('0x2d')][_0x27cf('0x38')]+'%'};return _0x200ed4;})});}_0x25341b=_[_0x27cf('0x3a')]({},_0x25341b,_0xb24756[_0x27cf('0x3b')]);return _0x1e30fa[_0x27cf('0x48')](_0x25341b);}})[_0x27cf('0x20')](function(_0x49121b){if(_0x49121b){_0x1bd337=_0x49121b[_0x27cf('0x47')];if(!_0xb24756[_0x27cf('0x2d')]['hasOwnProperty'](_0x27cf('0x32'))){_0x25341b[_0x27cf('0x19')]=qs[_0x27cf('0x19')](_0xb24756[_0x27cf('0x2d')][_0x27cf('0x19')]);_0x25341b[_0x27cf('0x17')]=qs[_0x27cf('0x17')](_0xb24756[_0x27cf('0x2d')]['offset']);}return _0x1e30fa[_0x27cf('0x48')](_0x25341b);}})[_0x27cf('0x20')](function(_0x31cd76){if(_0x31cd76){return _0x31cd76?{'count':_0x1bd337,'rows':_0x31cd76}:null;}})[_0x27cf('0x20')](respondWithResult(_0x586c6a,null))[_0x27cf('0x40')](handleError(_0x586c6a,null));};exports[_0x27cf('0x49')]=function(_0x5c9386,_0x9a2895,_0x367ab1){var _0x2df6d6={};var _0x11c73b={};var _0x1f0cab;var _0x3e21f1;return db[_0x27cf('0x3c')][_0x27cf('0x4a')]({'where':{'id':_0x5c9386[_0x27cf('0x42')]['id']}})[_0x27cf('0x20')](handleEntityNotFound(_0x9a2895,null))[_0x27cf('0x20')](function(_0x1d6d8c){if(_0x1d6d8c){_0x1f0cab=_0x1d6d8c;_0x11c73b[_0x27cf('0x2a')]=_[_0x27cf('0x2c')](db['ServicenowField'][_0x27cf('0x26')]);_0x11c73b[_0x27cf('0x2d')]=_[_0x27cf('0x2c')](_0x5c9386['query']);_0x11c73b[_0x27cf('0x36')]=_[_0x27cf('0x2e')](_0x11c73b[_0x27cf('0x2a')],_0x11c73b[_0x27cf('0x2d')]);_0x2df6d6[_0x27cf('0x2f')]=_[_0x27cf('0x2e')](_0x11c73b['model'],qs['fields'](_0x5c9386[_0x27cf('0x2d')][_0x27cf('0x30')]));_0x2df6d6[_0x27cf('0x2f')]=_0x2df6d6[_0x27cf('0x2f')][_0x27cf('0x47')]?_0x2df6d6[_0x27cf('0x2f')]:_0x11c73b[_0x27cf('0x2a')];_0x2df6d6[_0x27cf('0x33')]=qs[_0x27cf('0x34')](_0x5c9386[_0x27cf('0x2d')][_0x27cf('0x34')]);_0x2df6d6[_0x27cf('0x35')]=qs[_0x27cf('0x36')](_[_0x27cf('0x37')](_0x5c9386[_0x27cf('0x2d')],_0x11c73b[_0x27cf('0x36')]));if(_0x5c9386[_0x27cf('0x2d')]['filter']){_0x2df6d6[_0x27cf('0x35')]=_[_0x27cf('0x3a')](_0x2df6d6[_0x27cf('0x35')],{'$or':_[_0x27cf('0x2b')](_0x2df6d6[_0x27cf('0x2f')],function(_0x2cdb38){var _0x4502d2={};_0x4502d2[_0x2cdb38]={'$like':'%'+_0x5c9386[_0x27cf('0x2d')][_0x27cf('0x38')]+'%'};return _0x4502d2;})});}_0x2df6d6=_[_0x27cf('0x3a')]({},_0x2df6d6,_0x5c9386[_0x27cf('0x3b')]);return _0x1f0cab[_0x27cf('0x49')](_0x2df6d6);}})[_0x27cf('0x20')](function(_0x4c2847){if(_0x4c2847){_0x3e21f1=_0x4c2847[_0x27cf('0x47')];if(!_0x5c9386['query'][_0x27cf('0x31')]('nolimit')){_0x2df6d6[_0x27cf('0x19')]=qs[_0x27cf('0x19')](_0x5c9386[_0x27cf('0x2d')][_0x27cf('0x19')]);_0x2df6d6[_0x27cf('0x17')]=qs[_0x27cf('0x17')](_0x5c9386[_0x27cf('0x2d')][_0x27cf('0x17')]);}return _0x1f0cab[_0x27cf('0x49')](_0x2df6d6);}})[_0x27cf('0x20')](function(_0x223ae0){if(_0x223ae0){return _0x223ae0?{'count':_0x3e21f1,'rows':_0x223ae0}:null;}})[_0x27cf('0x20')](respondWithResult(_0x9a2895,null))[_0x27cf('0x40')](handleError(_0x9a2895,null));};exports['getDescriptions']=function(_0x4c2c7a,_0x3970a4,_0x8ba5fe){var _0x3ab15e={};var _0x198852={};var _0x3100cf;var _0x2229b5;return db[_0x27cf('0x3c')][_0x27cf('0x4a')]({'where':{'id':_0x4c2c7a[_0x27cf('0x42')]['id']}})[_0x27cf('0x20')](handleEntityNotFound(_0x3970a4,null))[_0x27cf('0x20')](function(_0x4bb37f){if(_0x4bb37f){_0x3100cf=_0x4bb37f;_0x198852[_0x27cf('0x2a')]=_[_0x27cf('0x2c')](db[_0x27cf('0x46')][_0x27cf('0x26')]);_0x198852['query']=_['keys'](_0x4c2c7a['query']);_0x198852[_0x27cf('0x36')]=_['intersection'](_0x198852[_0x27cf('0x2a')],_0x198852[_0x27cf('0x2d')]);_0x3ab15e['attributes']=_[_0x27cf('0x2e')](_0x198852['model'],qs[_0x27cf('0x30')](_0x4c2c7a[_0x27cf('0x2d')]['fields']));_0x3ab15e[_0x27cf('0x2f')]=_0x3ab15e[_0x27cf('0x2f')]['length']?_0x3ab15e['attributes']:_0x198852[_0x27cf('0x2a')];_0x3ab15e[_0x27cf('0x33')]=qs[_0x27cf('0x34')](_0x4c2c7a[_0x27cf('0x2d')]['sort']);_0x3ab15e[_0x27cf('0x35')]=qs[_0x27cf('0x36')](_['pick'](_0x4c2c7a[_0x27cf('0x2d')],_0x198852['filters']));if(_0x4c2c7a['query'][_0x27cf('0x38')]){_0x3ab15e[_0x27cf('0x35')]=_['merge'](_0x3ab15e['where'],{'$or':_[_0x27cf('0x2b')](_0x3ab15e[_0x27cf('0x2f')],function(_0x5d510b){var _0x19912b={};_0x19912b[_0x5d510b]={'$like':'%'+_0x4c2c7a[_0x27cf('0x2d')]['filter']+'%'};return _0x19912b;})});}_0x3ab15e=_[_0x27cf('0x3a')]({},_0x3ab15e,_0x4c2c7a[_0x27cf('0x3b')]);return _0x3100cf['getDescriptions'](_0x3ab15e);}})[_0x27cf('0x20')](function(_0x1c3251){if(_0x1c3251){_0x2229b5=_0x1c3251[_0x27cf('0x47')];if(!_0x4c2c7a[_0x27cf('0x2d')][_0x27cf('0x31')](_0x27cf('0x32'))){_0x3ab15e[_0x27cf('0x19')]=qs[_0x27cf('0x19')](_0x4c2c7a[_0x27cf('0x2d')][_0x27cf('0x19')]);_0x3ab15e[_0x27cf('0x17')]=qs[_0x27cf('0x17')](_0x4c2c7a[_0x27cf('0x2d')][_0x27cf('0x17')]);}return _0x3100cf['getDescriptions'](_0x3ab15e);}})[_0x27cf('0x20')](function(_0xff811e){if(_0xff811e){return _0xff811e?{'count':_0x2229b5,'rows':_0xff811e}:null;}})['then'](respondWithResult(_0x3970a4,null))[_0x27cf('0x40')](handleError(_0x3970a4,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 0e93510..b4f24e6 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 _0x7cd6=['lodash','util','../../config/logger','api','request-promise','path','rimraf','./intServicenowConfiguration.attributes','define','ServicenowConfiguration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7cd6,0x1f4));var _0x67cd=function(_0x349a11,_0x1eecc0){_0x349a11=_0x349a11-0x0;var _0x561c49=_0x7cd6[_0x349a11];return _0x561c49;};'use strict';var _=require(_0x67cd('0x0'));var util=require(_0x67cd('0x1'));var logger=require(_0x67cd('0x2'))(_0x67cd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x67cd('0x4'));var fs=require('fs');var path=require(_0x67cd('0x5'));var rimraf=require(_0x67cd('0x6'));var config=require('../../config/environment');var attributes=require(_0x67cd('0x7'));module['exports']=function(_0x218c1c,_0x2cec15){return _0x218c1c[_0x67cd('0x8')](_0x67cd('0x9'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3014=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','api','moment','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3014,0x1d7));var _0x4301=function(_0x3db012,_0x893c3){_0x3db012=_0x3db012-0x0;var _0x164cb6=_0x3014[_0x3db012];return _0x164cb6;};'use strict';var _=require(_0x4301('0x0'));var util=require(_0x4301('0x1'));var logger=require('../../config/logger')(_0x4301('0x2'));var moment=require(_0x4301('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4301('0x4'));var rimraf=require(_0x4301('0x5'));var config=require(_0x4301('0x6'));var attributes=require(_0x4301('0x7'));module[_0x4301('0x8')]=function(_0x42ced6,_0x42ac4b){return _0x42ced6[_0x4301('0x9')](_0x4301('0xa'),attributes,{'tableName':_0x4301('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 2b1e39b..b85a594 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 _0x2e88=['then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x2e88,0x95));var _0x82e8=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x2e88[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x82e8('0x0'));var util=require(_0x82e8('0x1'));var moment=require(_0x82e8('0x2'));var BPromise=require(_0x82e8('0x3'));var rs=require(_0x82e8('0x4'));var fs=require('fs');var Redis=require(_0x82e8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x82e8('0x6'));var logger=require(_0x82e8('0x7'))('rpc');var config=require(_0x82e8('0x8'));var jayson=require(_0x82e8('0x9'));var client=jayson['client'][_0x82e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e2496,_0x3db496,_0x27df44){return new BPromise(function(_0x393c2c,_0x1ecc8f){return client[_0x82e8('0xb')](_0x1e2496,_0x27df44)[_0x82e8('0xc')](function(_0x80019f){logger[_0x82e8('0xd')](_0x82e8('0xe'),_0x3db496,'request\x20sent');logger[_0x82e8('0xf')](_0x82e8('0x10'),_0x3db496,_0x82e8('0x11'),JSON[_0x82e8('0x12')](_0x80019f));if(_0x80019f[_0x82e8('0x13')]){if(_0x80019f[_0x82e8('0x13')][_0x82e8('0x14')]===0x1f4){logger['error'](_0x82e8('0xe'),_0x3db496,_0x80019f[_0x82e8('0x13')][_0x82e8('0x15')]);return _0x1ecc8f(_0x80019f[_0x82e8('0x13')][_0x82e8('0x15')]);}logger['error'](_0x82e8('0xe'),_0x3db496,_0x80019f[_0x82e8('0x13')][_0x82e8('0x15')]);return _0x393c2c(_0x80019f[_0x82e8('0x13')]['message']);}else{logger[_0x82e8('0xd')](_0x82e8('0xe'),_0x3db496,_0x82e8('0x11'));_0x393c2c(_0x80019f[_0x82e8('0x16')][_0x82e8('0x15')]);}})['catch'](function(_0x39e7bc){logger[_0x82e8('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3db496,_0x39e7bc);_0x1ecc8f(_0x39e7bc);});});} \ No newline at end of file +var _0xcbf6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','util','moment','randomstring'];(function(_0x20497f,_0x561e57){var _0x273556=function(_0x58bdc9){while(--_0x58bdc9){_0x20497f['push'](_0x20497f['shift']());}};_0x273556(++_0x561e57);}(_0xcbf6,0x18d));var _0x6cbf=function(_0x3feec6,_0x4db012){_0x3feec6=_0x3feec6-0x0;var _0x56d5e2=_0xcbf6[_0x3feec6];return _0x56d5e2;};'use strict';var _=require('lodash');var util=require(_0x6cbf('0x0'));var moment=require(_0x6cbf('0x1'));var BPromise=require('bluebird');var rs=require(_0x6cbf('0x2'));var fs=require('fs');var Redis=require(_0x6cbf('0x3'));var db=require(_0x6cbf('0x4'))['db'];var utils=require(_0x6cbf('0x5'));var logger=require(_0x6cbf('0x6'))(_0x6cbf('0x7'));var config=require(_0x6cbf('0x8'));var jayson=require(_0x6cbf('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2924e9,_0x441c72,_0x1e1108){return new BPromise(function(_0x1b9a69,_0x527433){return client[_0x6cbf('0xa')](_0x2924e9,_0x1e1108)[_0x6cbf('0xb')](function(_0x5df65c){logger[_0x6cbf('0xc')](_0x6cbf('0xd'),_0x441c72,_0x6cbf('0xe'));logger[_0x6cbf('0xf')](_0x6cbf('0x10'),_0x441c72,_0x6cbf('0xe'),JSON['stringify'](_0x5df65c));if(_0x5df65c[_0x6cbf('0x11')]){if(_0x5df65c[_0x6cbf('0x11')]['code']===0x1f4){logger[_0x6cbf('0x11')](_0x6cbf('0xd'),_0x441c72,_0x5df65c[_0x6cbf('0x11')][_0x6cbf('0x12')]);return _0x527433(_0x5df65c[_0x6cbf('0x11')][_0x6cbf('0x12')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x441c72,_0x5df65c[_0x6cbf('0x11')]['message']);return _0x1b9a69(_0x5df65c[_0x6cbf('0x11')][_0x6cbf('0x12')]);}else{logger[_0x6cbf('0xc')](_0x6cbf('0xd'),_0x441c72,_0x6cbf('0xe'));_0x1b9a69(_0x5df65c['result'][_0x6cbf('0x12')]);}})[_0x6cbf('0x13')](function(_0x212aa5){logger[_0x6cbf('0x11')](_0x6cbf('0xd'),_0x441c72,_0x212aa5);_0x527433(_0x212aa5);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index a7de785..dab08fb 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 _0x588d=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x44ad4b,_0x13ccad){var _0x4c0516=function(_0x1a841e){while(--_0x1a841e){_0x44ad4b['push'](_0x44ad4b['shift']());}};_0x4c0516(++_0x13ccad);}(_0x588d,0xe5));var _0xd588=function(_0x446e45,_0x5314fe){_0x446e45=_0x446e45-0x0;var _0x3872fa=_0x588d[_0x446e45];return _0x3872fa;};'use strict';var multer=require(_0xd588('0x0'));var util=require(_0xd588('0x1'));var path=require(_0xd588('0x2'));var timeout=require(_0xd588('0x3'));var express=require(_0xd588('0x4'));var router=express[_0xd588('0x5')]();var fs_extra=require(_0xd588('0x6'));var auth=require(_0xd588('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd588('0x8'));var controller=require(_0xd588('0x9'));router['get']('/',auth[_0xd588('0xa')](),controller[_0xd588('0xb')]);router[_0xd588('0xc')](_0xd588('0xd'),auth[_0xd588('0xa')](),controller[_0xd588('0xe')]);router[_0xd588('0xf')]('/',auth[_0xd588('0xa')](),controller[_0xd588('0x10')]);router[_0xd588('0x11')](_0xd588('0xd'),auth[_0xd588('0xa')](),controller['update']);router['delete'](_0xd588('0xd'),auth['isAuthenticated'](),controller[_0xd588('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe570=['destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','put','update'];(function(_0x55a09b,_0x373113){var _0x47d036=function(_0x22e939){while(--_0x22e939){_0x55a09b['push'](_0x55a09b['shift']());}};_0x47d036(++_0x373113);}(_0xe570,0x1f2));var _0x0e57=function(_0x33bd25,_0x26a42c){_0x33bd25=_0x33bd25-0x0;var _0x5e8c9c=_0xe570[_0x33bd25];return _0x5e8c9c;};'use strict';var multer=require(_0x0e57('0x0'));var util=require(_0x0e57('0x1'));var path=require(_0x0e57('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0e57('0x3')]();var fs_extra=require(_0x0e57('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0e57('0x5'));var config=require(_0x0e57('0x6'));var controller=require('./intServicenowField.controller');router[_0x0e57('0x7')]('/',auth[_0x0e57('0x8')](),controller['index']);router[_0x0e57('0x7')](_0x0e57('0x9'),auth[_0x0e57('0x8')](),controller[_0x0e57('0xa')]);router['post']('/',auth[_0x0e57('0x8')](),controller[_0x0e57('0xb')]);router[_0x0e57('0xc')](_0x0e57('0x9'),auth['isAuthenticated'](),controller[_0x0e57('0xd')]);router['delete'](_0x0e57('0x9'),auth[_0x0e57('0x8')](),controller[_0x0e57('0xe')]);module[_0x0e57('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index b87e2ad..05028f1 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 _0x24b6=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x4f40da,_0x40bc86){var _0x253fdf=function(_0x4c7b54){while(--_0x4c7b54){_0x4f40da['push'](_0x4f40da['shift']());}};_0x253fdf(++_0x40bc86);}(_0x24b6,0xf7));var _0x624b=function(_0x2d6df7,_0x1baeeb){_0x2d6df7=_0x2d6df7-0x0;var _0x49ce41=_0x24b6[_0x2d6df7];return _0x49ce41;};'use strict';var Sequelize=require(_0x624b('0x0'));module[_0x624b('0x1')]={'type':{'type':Sequelize[_0x624b('0x2')](_0x624b('0x3'),_0x624b('0x4'),_0x624b('0x5'),_0x624b('0x6'),'picklist'),'defaultValue':_0x624b('0x3')},'content':{'type':Sequelize[_0x624b('0x7')]},'key':{'type':Sequelize[_0x624b('0x7')]},'keyType':{'type':Sequelize[_0x624b('0x2')](_0x624b('0x3'),_0x624b('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x624b('0x7')]},'idField':{'type':Sequelize[_0x624b('0x7')]},'nameField':{'type':Sequelize[_0x624b('0x7')]},'customField':{'type':Sequelize[_0x624b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7c95=['picklist','STRING','variable','customVariable','BOOLEAN','ENUM','string','keyValue'];(function(_0x1bcfcd,_0x587346){var _0x22e395=function(_0x840c3d){while(--_0x840c3d){_0x1bcfcd['push'](_0x1bcfcd['shift']());}};_0x22e395(++_0x587346);}(_0x7c95,0xcd));var _0x57c9=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x7c95[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x57c9('0x0')](_0x57c9('0x1'),'variable','customVariable',_0x57c9('0x2'),_0x57c9('0x3')),'defaultValue':_0x57c9('0x1')},'content':{'type':Sequelize[_0x57c9('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x57c9('0x0')](_0x57c9('0x1'),_0x57c9('0x5'),_0x57c9('0x6'))},'keyContent':{'type':Sequelize[_0x57c9('0x4')]},'idField':{'type':Sequelize[_0x57c9('0x4')]},'nameField':{'type':Sequelize[_0x57c9('0x4')]},'customField':{'type':Sequelize[_0x57c9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x57c9('0x4')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 4483de5..5974e0f 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 _0xae0d=['moment','bluebird','mustache','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ServicenowField','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','includeAll','include','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x24f3d3,_0xb13780){var _0x2b9655=function(_0xc08d16){while(--_0xc08d16){_0x24f3d3['push'](_0x24f3d3['shift']());}};_0x2b9655(++_0xb13780);}(_0xae0d,0x92));var _0xdae0=function(_0x4835d9,_0x53665b){_0x4835d9=_0x4835d9-0x0;var _0x489f97=_0xae0d[_0x4835d9];return _0x489f97;};'use strict';var emlformat=require(_0xdae0('0x0'));var rimraf=require(_0xdae0('0x1'));var zipdir=require(_0xdae0('0x2'));var jsonpatch=require(_0xdae0('0x3'));var rp=require('request-promise');var moment=require(_0xdae0('0x4'));var BPromise=require(_0xdae0('0x5'));var Mustache=require(_0xdae0('0x6'));var util=require('util');var path=require(_0xdae0('0x7'));var sox=require('sox');var csv=require(_0xdae0('0x8'));var ejs=require(_0xdae0('0x9'));var fs=require('fs');var fs_extra=require(_0xdae0('0xa'));var _=require('lodash');var squel=require(_0xdae0('0xb'));var crypto=require(_0xdae0('0xc'));var jsforce=require(_0xdae0('0xd'));var deskjs=require(_0xdae0('0xe'));var toCsv=require(_0xdae0('0x8'));var querystring=require(_0xdae0('0xf'));var Papa=require(_0xdae0('0x10'));var Redis=require(_0xdae0('0x11'));var authService=require(_0xdae0('0x12'));var qs=require(_0xdae0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdae0('0x14'));var logger=require(_0xdae0('0x15'))(_0xdae0('0x16'));var utils=require(_0xdae0('0x17'));var config=require(_0xdae0('0x18'));var licenseUtil=require(_0xdae0('0x19'));var db=require(_0xdae0('0x1a'))['db'];function respondWithStatusCode(_0x528857,_0x4da840){_0x4da840=_0x4da840||0xcc;return function(_0xcb8808){if(_0xcb8808){return _0x528857[_0xdae0('0x1b')](_0x4da840);}return _0x528857[_0xdae0('0x1c')](_0x4da840)[_0xdae0('0x1d')]();};}function respondWithResult(_0xf4c7c1,_0x38f3cf){_0x38f3cf=_0x38f3cf||0xc8;return function(_0x29684d){if(_0x29684d){return _0xf4c7c1['status'](_0x38f3cf)[_0xdae0('0x1e')](_0x29684d);}};}function respondWithFilteredResult(_0x397e09,_0x4f7b7f){return function(_0x24fbd7){if(_0x24fbd7){var _0xa5bd35=typeof _0x4f7b7f[_0xdae0('0x1f')]==='undefined'&&typeof _0x4f7b7f['limit']==='undefined';var _0x1ebb8c=_0x24fbd7[_0xdae0('0x20')];var _0x5af3b3=_0xa5bd35?0x0:_0x4f7b7f[_0xdae0('0x1f')];var _0x2688f8=_0xa5bd35?_0x24fbd7[_0xdae0('0x20')]:_0x4f7b7f[_0xdae0('0x1f')]+_0x4f7b7f[_0xdae0('0x21')];var _0x162532;if(_0x2688f8>=_0x1ebb8c){_0x2688f8=_0x1ebb8c;_0x162532=0xc8;}else{_0x162532=0xce;}_0x397e09[_0xdae0('0x1c')](_0x162532);return _0x397e09['set'](_0xdae0('0x22'),_0x5af3b3+'-'+_0x2688f8+'/'+_0x1ebb8c)[_0xdae0('0x1e')](_0x24fbd7);}return null;};}function patchUpdates(_0x2069b0){return function(_0x2b5f4d){try{jsonpatch[_0xdae0('0x23')](_0x2b5f4d,_0x2069b0,!![]);}catch(_0x154d6c){return BPromise[_0xdae0('0x24')](_0x154d6c);}return _0x2b5f4d[_0xdae0('0x25')]();};}function saveUpdates(_0x2d8098,_0x5d7732){return function(_0x5427b7){if(_0x5427b7){return _0x5427b7[_0xdae0('0x26')](_0x2d8098)[_0xdae0('0x27')](function(_0x9c8f87){return _0x9c8f87;});}return null;};}function removeEntity(_0x5e57ba,_0x28b1bc){return function(_0x1328dc){if(_0x1328dc){return _0x1328dc[_0xdae0('0x28')]()[_0xdae0('0x27')](function(){_0x5e57ba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4066af,_0x1d2f8f){return function(_0x112aa8){if(!_0x112aa8){_0x4066af[_0xdae0('0x1b')](0x194);}return _0x112aa8;};}function handleError(_0x558fd5,_0x18424d){_0x18424d=_0x18424d||0x1f4;return function(_0x4b3bad){logger[_0xdae0('0x29')](_0x4b3bad[_0xdae0('0x2a')]);if(_0x4b3bad['name']){delete _0x4b3bad[_0xdae0('0x2b')];}_0x558fd5[_0xdae0('0x1c')](_0x18424d)[_0xdae0('0x2c')](_0x4b3bad);};}exports[_0xdae0('0x2d')]=function(_0x5197ee,_0x43b8d7){var _0x5ac42d={},_0x2294f1={},_0x30ac89={'count':0x0,'rows':[]};var _0x55f1ec=_['map'](db[_0xdae0('0x2e')]['rawAttributes'],function(_0x1eee55){return{'name':_0x1eee55[_0xdae0('0x2f')],'type':_0x1eee55[_0xdae0('0x30')][_0xdae0('0x31')]};});_0x2294f1[_0xdae0('0x32')]=_[_0xdae0('0x33')](_0x55f1ec,_0xdae0('0x2b'));_0x2294f1['query']=_[_0xdae0('0x34')](_0x5197ee[_0xdae0('0x35')]);_0x2294f1[_0xdae0('0x36')]=_[_0xdae0('0x37')](_0x2294f1[_0xdae0('0x32')],_0x2294f1[_0xdae0('0x35')]);_0x5ac42d[_0xdae0('0x38')]=_['intersection'](_0x2294f1[_0xdae0('0x32')],qs['fields'](_0x5197ee['query'][_0xdae0('0x39')]));_0x5ac42d['attributes']=_0x5ac42d['attributes'][_0xdae0('0x3a')]?_0x5ac42d[_0xdae0('0x38')]:_0x2294f1[_0xdae0('0x32')];if(!_0x5197ee['query'][_0xdae0('0x3b')]('nolimit')){_0x5ac42d[_0xdae0('0x21')]=qs[_0xdae0('0x21')](_0x5197ee[_0xdae0('0x35')][_0xdae0('0x21')]);_0x5ac42d['offset']=qs[_0xdae0('0x1f')](_0x5197ee[_0xdae0('0x35')]['offset']);}_0x5ac42d[_0xdae0('0x3c')]=qs[_0xdae0('0x3d')](_0x5197ee[_0xdae0('0x35')][_0xdae0('0x3d')]);_0x5ac42d['where']=qs['filters'](_[_0xdae0('0x3e')](_0x5197ee[_0xdae0('0x35')],_0x2294f1[_0xdae0('0x36')]),_0x55f1ec);if(_0x5197ee[_0xdae0('0x35')]['filter']){_0x5ac42d[_0xdae0('0x3f')]=_[_0xdae0('0x40')](_0x5ac42d[_0xdae0('0x3f')],{'$or':_[_0xdae0('0x33')](_0x55f1ec,function(_0x5a90c7){if(_0x5a90c7[_0xdae0('0x30')]!==_0xdae0('0x41')){var _0x2eee0c={};_0x2eee0c[_0x5a90c7[_0xdae0('0x2b')]]={'$like':'%'+_0x5197ee['query']['filter']+'%'};return _0x2eee0c;}})});}_0x5ac42d=_[_0xdae0('0x40')]({},_0x5ac42d,_0x5197ee['options']);var _0x3efc16={'where':_0x5ac42d['where']};return db['ServicenowField'][_0xdae0('0x20')](_0x3efc16)['then'](function(_0x1ce569){_0x30ac89[_0xdae0('0x20')]=_0x1ce569;if(_0x5197ee[_0xdae0('0x35')][_0xdae0('0x42')]){_0x5ac42d[_0xdae0('0x43')]=[{'all':!![]}];}return db[_0xdae0('0x2e')]['findAll'](_0x5ac42d);})[_0xdae0('0x27')](function(_0x852988){_0x30ac89['rows']=_0x852988;return _0x30ac89;})[_0xdae0('0x27')](respondWithFilteredResult(_0x43b8d7,_0x5ac42d))[_0xdae0('0x44')](handleError(_0x43b8d7,null));};exports[_0xdae0('0x45')]=function(_0x4a8689,_0x5a979d){var _0x12c2d7={'raw':!![],'where':{'id':_0x4a8689['params']['id']}},_0xcb48c4={};_0xcb48c4['model']=_[_0xdae0('0x34')](db['ServicenowField']['rawAttributes']);_0xcb48c4[_0xdae0('0x35')]=_[_0xdae0('0x34')](_0x4a8689[_0xdae0('0x35')]);_0xcb48c4[_0xdae0('0x36')]=_[_0xdae0('0x37')](_0xcb48c4[_0xdae0('0x32')],_0xcb48c4[_0xdae0('0x35')]);_0x12c2d7[_0xdae0('0x38')]=_[_0xdae0('0x37')](_0xcb48c4[_0xdae0('0x32')],qs[_0xdae0('0x39')](_0x4a8689[_0xdae0('0x35')][_0xdae0('0x39')]));_0x12c2d7['attributes']=_0x12c2d7['attributes'][_0xdae0('0x3a')]?_0x12c2d7['attributes']:_0xcb48c4[_0xdae0('0x32')];if(_0x4a8689[_0xdae0('0x35')]['includeAll']){_0x12c2d7[_0xdae0('0x43')]=[{'all':!![]}];}_0x12c2d7=_['merge']({},_0x12c2d7,_0x4a8689[_0xdae0('0x46')]);return db[_0xdae0('0x2e')][_0xdae0('0x47')](_0x12c2d7)[_0xdae0('0x27')](handleEntityNotFound(_0x5a979d,null))['then'](respondWithResult(_0x5a979d,null))['catch'](handleError(_0x5a979d,null));};exports[_0xdae0('0x48')]=function(_0x3e7bc5,_0x4f5da1){return db[_0xdae0('0x2e')][_0xdae0('0x48')](_0x3e7bc5[_0xdae0('0x49')],{})['then'](respondWithResult(_0x4f5da1,0xc9))[_0xdae0('0x44')](handleError(_0x4f5da1,null));};exports['update']=function(_0x5671d2,_0x4afb2d){if(_0x5671d2[_0xdae0('0x49')]['id']){delete _0x5671d2['body']['id'];}return db[_0xdae0('0x2e')][_0xdae0('0x47')]({'where':{'id':_0x5671d2[_0xdae0('0x4a')]['id']}})[_0xdae0('0x27')](handleEntityNotFound(_0x4afb2d,null))[_0xdae0('0x27')](saveUpdates(_0x5671d2['body'],null))[_0xdae0('0x27')](respondWithResult(_0x4afb2d,null))['catch'](handleError(_0x4afb2d,null));};exports[_0xdae0('0x28')]=function(_0x26aea2,_0x370432){return db['ServicenowField'][_0xdae0('0x47')]({'where':{'id':_0x26aea2[_0xdae0('0x4a')]['id']}})[_0xdae0('0x27')](handleEntityNotFound(_0x370432,null))[_0xdae0('0x27')](removeEntity(_0x370432,null))[_0xdae0('0x44')](handleError(_0x370432,null));}; \ No newline at end of file +var _0xc935=['lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x4ee253,_0x42b7c8){var _0x4039cb=function(_0x3dcabd){while(--_0x3dcabd){_0x4ee253['push'](_0x4ee253['shift']());}};_0x4039cb(++_0x42b7c8);}(_0xc935,0xd4));var _0x5c93=function(_0x1cb420,_0x44924c){_0x1cb420=_0x1cb420-0x0;var _0x729994=_0xc935[_0x1cb420];return _0x729994;};'use strict';var emlformat=require(_0x5c93('0x0'));var rimraf=require(_0x5c93('0x1'));var zipdir=require(_0x5c93('0x2'));var jsonpatch=require(_0x5c93('0x3'));var rp=require(_0x5c93('0x4'));var moment=require(_0x5c93('0x5'));var BPromise=require(_0x5c93('0x6'));var Mustache=require(_0x5c93('0x7'));var util=require(_0x5c93('0x8'));var path=require(_0x5c93('0x9'));var sox=require(_0x5c93('0xa'));var csv=require(_0x5c93('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c93('0xc'));var _=require(_0x5c93('0xd'));var squel=require('squel');var crypto=require(_0x5c93('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5c93('0xf'));var toCsv=require(_0x5c93('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5c93('0x10'));var qs=require(_0x5c93('0x11'));var as=require(_0x5c93('0x12'));var hardwareService=require(_0x5c93('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5c93('0x14'));var config=require(_0x5c93('0x15'));var licenseUtil=require(_0x5c93('0x16'));var db=require(_0x5c93('0x17'))['db'];function respondWithStatusCode(_0x5a3fa1,_0x580e31){_0x580e31=_0x580e31||0xcc;return function(_0x409008){if(_0x409008){return _0x5a3fa1[_0x5c93('0x18')](_0x580e31);}return _0x5a3fa1[_0x5c93('0x19')](_0x580e31)[_0x5c93('0x1a')]();};}function respondWithResult(_0x5b5df5,_0x901c27){_0x901c27=_0x901c27||0xc8;return function(_0xf3da27){if(_0xf3da27){return _0x5b5df5['status'](_0x901c27)[_0x5c93('0x1b')](_0xf3da27);}};}function respondWithFilteredResult(_0xa5e3dd,_0x4071fa){return function(_0x402230){if(_0x402230){var _0x1d207b=typeof _0x4071fa['offset']==='undefined'&&typeof _0x4071fa[_0x5c93('0x1c')]===_0x5c93('0x1d');var _0x26b6b8=_0x402230[_0x5c93('0x1e')];var _0xd2b941=_0x1d207b?0x0:_0x4071fa['offset'];var _0x46959a=_0x1d207b?_0x402230[_0x5c93('0x1e')]:_0x4071fa[_0x5c93('0x1f')]+_0x4071fa['limit'];var _0x557685;if(_0x46959a>=_0x26b6b8){_0x46959a=_0x26b6b8;_0x557685=0xc8;}else{_0x557685=0xce;}_0xa5e3dd['status'](_0x557685);return _0xa5e3dd['set'](_0x5c93('0x20'),_0xd2b941+'-'+_0x46959a+'/'+_0x26b6b8)[_0x5c93('0x1b')](_0x402230);}return null;};}function patchUpdates(_0x1228e9){return function(_0x1db49f){try{jsonpatch[_0x5c93('0x21')](_0x1db49f,_0x1228e9,!![]);}catch(_0x27243a){return BPromise[_0x5c93('0x22')](_0x27243a);}return _0x1db49f[_0x5c93('0x23')]();};}function saveUpdates(_0x1f2256,_0x406047){return function(_0x49141d){if(_0x49141d){return _0x49141d[_0x5c93('0x24')](_0x1f2256)[_0x5c93('0x25')](function(_0x2fc253){return _0x2fc253;});}return null;};}function removeEntity(_0x22bbc8,_0x3ab994){return function(_0x5a67f1){if(_0x5a67f1){return _0x5a67f1['destroy']()[_0x5c93('0x25')](function(){_0x22bbc8[_0x5c93('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x172819,_0x3728ac){return function(_0x446f7b){if(!_0x446f7b){_0x172819['sendStatus'](0x194);}return _0x446f7b;};}function handleError(_0x5e2cce,_0x2da6ea){_0x2da6ea=_0x2da6ea||0x1f4;return function(_0x5c187b){logger[_0x5c93('0x26')](_0x5c187b[_0x5c93('0x27')]);if(_0x5c187b['name']){delete _0x5c187b[_0x5c93('0x28')];}_0x5e2cce['status'](_0x2da6ea)[_0x5c93('0x29')](_0x5c187b);};}exports[_0x5c93('0x2a')]=function(_0x438bae,_0x6e878a){var _0x491942={},_0x2e282d={},_0xb98dc9={'count':0x0,'rows':[]};var _0x26d553=_[_0x5c93('0x2b')](db[_0x5c93('0x2c')][_0x5c93('0x2d')],function(_0x412fda){return{'name':_0x412fda[_0x5c93('0x2e')],'type':_0x412fda[_0x5c93('0x2f')][_0x5c93('0x30')]};});_0x2e282d[_0x5c93('0x31')]=_['map'](_0x26d553,_0x5c93('0x28'));_0x2e282d['query']=_[_0x5c93('0x32')](_0x438bae[_0x5c93('0x33')]);_0x2e282d[_0x5c93('0x34')]=_[_0x5c93('0x35')](_0x2e282d[_0x5c93('0x31')],_0x2e282d['query']);_0x491942['attributes']=_[_0x5c93('0x35')](_0x2e282d[_0x5c93('0x31')],qs[_0x5c93('0x36')](_0x438bae[_0x5c93('0x33')][_0x5c93('0x36')]));_0x491942[_0x5c93('0x37')]=_0x491942[_0x5c93('0x37')][_0x5c93('0x38')]?_0x491942[_0x5c93('0x37')]:_0x2e282d['model'];if(!_0x438bae[_0x5c93('0x33')][_0x5c93('0x39')]('nolimit')){_0x491942['limit']=qs[_0x5c93('0x1c')](_0x438bae[_0x5c93('0x33')][_0x5c93('0x1c')]);_0x491942[_0x5c93('0x1f')]=qs[_0x5c93('0x1f')](_0x438bae[_0x5c93('0x33')][_0x5c93('0x1f')]);}_0x491942[_0x5c93('0x3a')]=qs[_0x5c93('0x3b')](_0x438bae[_0x5c93('0x33')]['sort']);_0x491942[_0x5c93('0x3c')]=qs[_0x5c93('0x34')](_[_0x5c93('0x3d')](_0x438bae[_0x5c93('0x33')],_0x2e282d[_0x5c93('0x34')]),_0x26d553);if(_0x438bae[_0x5c93('0x33')][_0x5c93('0x3e')]){_0x491942['where']=_[_0x5c93('0x3f')](_0x491942[_0x5c93('0x3c')],{'$or':_['map'](_0x26d553,function(_0x4ecba0){if(_0x4ecba0[_0x5c93('0x2f')]!=='VIRTUAL'){var _0x5825ca={};_0x5825ca[_0x4ecba0[_0x5c93('0x28')]]={'$like':'%'+_0x438bae[_0x5c93('0x33')][_0x5c93('0x3e')]+'%'};return _0x5825ca;}})});}_0x491942=_['merge']({},_0x491942,_0x438bae[_0x5c93('0x40')]);var _0x23b53a={'where':_0x491942['where']};return db[_0x5c93('0x2c')][_0x5c93('0x1e')](_0x23b53a)['then'](function(_0x145720){_0xb98dc9[_0x5c93('0x1e')]=_0x145720;if(_0x438bae[_0x5c93('0x33')][_0x5c93('0x41')]){_0x491942[_0x5c93('0x42')]=[{'all':!![]}];}return db[_0x5c93('0x2c')]['findAll'](_0x491942);})[_0x5c93('0x25')](function(_0x368911){_0xb98dc9[_0x5c93('0x43')]=_0x368911;return _0xb98dc9;})[_0x5c93('0x25')](respondWithFilteredResult(_0x6e878a,_0x491942))[_0x5c93('0x44')](handleError(_0x6e878a,null));};exports[_0x5c93('0x45')]=function(_0xfc98c9,_0x436d54){var _0x1bcdf3={'raw':!![],'where':{'id':_0xfc98c9[_0x5c93('0x46')]['id']}},_0x805a64={};_0x805a64[_0x5c93('0x31')]=_[_0x5c93('0x32')](db[_0x5c93('0x2c')][_0x5c93('0x2d')]);_0x805a64['query']=_[_0x5c93('0x32')](_0xfc98c9[_0x5c93('0x33')]);_0x805a64['filters']=_[_0x5c93('0x35')](_0x805a64[_0x5c93('0x31')],_0x805a64[_0x5c93('0x33')]);_0x1bcdf3[_0x5c93('0x37')]=_[_0x5c93('0x35')](_0x805a64['model'],qs[_0x5c93('0x36')](_0xfc98c9['query'][_0x5c93('0x36')]));_0x1bcdf3[_0x5c93('0x37')]=_0x1bcdf3['attributes'][_0x5c93('0x38')]?_0x1bcdf3[_0x5c93('0x37')]:_0x805a64['model'];if(_0xfc98c9[_0x5c93('0x33')][_0x5c93('0x41')]){_0x1bcdf3['include']=[{'all':!![]}];}_0x1bcdf3=_['merge']({},_0x1bcdf3,_0xfc98c9[_0x5c93('0x40')]);return db[_0x5c93('0x2c')][_0x5c93('0x47')](_0x1bcdf3)[_0x5c93('0x25')](handleEntityNotFound(_0x436d54,null))['then'](respondWithResult(_0x436d54,null))[_0x5c93('0x44')](handleError(_0x436d54,null));};exports[_0x5c93('0x48')]=function(_0x42dfb0,_0x51abe6){return db[_0x5c93('0x2c')][_0x5c93('0x48')](_0x42dfb0['body'],{})[_0x5c93('0x25')](respondWithResult(_0x51abe6,0xc9))[_0x5c93('0x44')](handleError(_0x51abe6,null));};exports[_0x5c93('0x24')]=function(_0x42cfea,_0x4e06e5){if(_0x42cfea[_0x5c93('0x49')]['id']){delete _0x42cfea['body']['id'];}return db[_0x5c93('0x2c')]['find']({'where':{'id':_0x42cfea['params']['id']}})[_0x5c93('0x25')](handleEntityNotFound(_0x4e06e5,null))[_0x5c93('0x25')](saveUpdates(_0x42cfea['body'],null))[_0x5c93('0x25')](respondWithResult(_0x4e06e5,null))[_0x5c93('0x44')](handleError(_0x4e06e5,null));};exports[_0x5c93('0x4a')]=function(_0x4f7f8a,_0x38ab93){return db[_0x5c93('0x2c')]['find']({'where':{'id':_0x4f7f8a[_0x5c93('0x46')]['id']}})[_0x5c93('0x25')](handleEntityNotFound(_0x38ab93,null))[_0x5c93('0x25')](removeEntity(_0x38ab93,null))[_0x5c93('0x44')](handleError(_0x38ab93,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 73876b1..be5ffd2 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 _0x88a8=['bluebird','../../config/environment','exports','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util'];(function(_0x502598,_0x1e95c8){var _0xbdee21=function(_0x140feb){while(--_0x140feb){_0x502598['push'](_0x502598['shift']());}};_0xbdee21(++_0x1e95c8);}(_0x88a8,0x166));var _0x888a=function(_0xa6172c,_0x2d78cf){_0xa6172c=_0xa6172c-0x0;var _0x2307ff=_0x88a8[_0xa6172c];return _0x2307ff;};'use strict';var _=require(_0x888a('0x0'));var util=require(_0x888a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x888a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x888a('0x3'));var attributes=require('./intServicenowField.attributes');module[_0x888a('0x4')]=function(_0x11103f,_0x25ade4){return _0x11103f[_0x888a('0x5')]('ServicenowField',attributes,{'tableName':_0x888a('0x6'),'paranoid':![],'indexes':[{'name':_0x888a('0x7'),'fields':[_0x888a('0x8'),_0x888a('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x74cf=['define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x38568b,_0x4217f5){var _0xb45761=function(_0x219247){while(--_0x219247){_0x38568b['push'](_0x38568b['shift']());}};_0xb45761(++_0x4217f5);}(_0x74cf,0x11e));var _0xf74c=function(_0x334763,_0x575eff){_0x334763=_0x334763-0x0;var _0x566db0=_0x74cf[_0x334763];return _0x566db0;};'use strict';var _=require(_0xf74c('0x0'));var util=require(_0xf74c('0x1'));var logger=require(_0xf74c('0x2'))('api');var moment=require(_0xf74c('0x3'));var BPromise=require('bluebird');var rp=require(_0xf74c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf74c('0x5'));var config=require(_0xf74c('0x6'));var attributes=require('./intServicenowField.attributes');module[_0xf74c('0x7')]=function(_0x299240,_0x76a5b2){return _0x299240[_0xf74c('0x8')](_0xf74c('0x9'),attributes,{'tableName':_0xf74c('0xa'),'paranoid':![],'indexes':[{'name':_0xf74c('0xb'),'fields':[_0xf74c('0xc'),_0xf74c('0xd')],'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 decbf96..b76515f 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x10c9ed,_0x17d28d){var _0x15f72c=function(_0x2a98f5){while(--_0x2a98f5){_0x10c9ed['push'](_0x10c9ed['shift']());}};_0x15f72c(++_0x17d28d);}(_0xb43b,0x1b2));var _0xbb43=function(_0x39551b,_0x312bd5){_0x39551b=_0x39551b-0x0;var _0xff6713=_0xb43b[_0x39551b];return _0xff6713;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0xda3f,0xec));var _0xfda3=function(_0x4d0199,_0x4092ac){_0x4d0199=_0x4d0199-0x0;var _0x17a7dc=_0xda3f[_0x4d0199];return _0x17a7dc;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 4cabdc1..108052b 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(_0x446b56,_0xd8a462){var _0x5b3a40=function(_0x371547){while(--_0x371547){_0x446b56['push'](_0x446b56['shift']());}};_0x5b3a40(++_0xd8a462);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x267f82,_0xb6de9c){var _0x5a7769=function(_0x4bf74f){while(--_0x4bf74f){_0x267f82['push'](_0x267f82['shift']());}};_0x5a7769(++_0xb6de9c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 0ebf083..aafd53a 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(_0x12a1e8,_0x1a982d){var _0x26a36f=function(_0x46cfaa){while(--_0x46cfaa){_0x12a1e8['push'](_0x12a1e8['shift']());}};_0x26a36f(++_0x1a982d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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(_0x4b5244,_0x3799d6){var _0x9420ba=function(_0x1f5167){while(--_0x1f5167){_0x4b5244['push'](_0x4b5244['shift']());}};_0x9420ba(++_0x3799d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 31f3e05..254eedb 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 _0x724f=['util','path','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','catch','params','options','find','create','body','SugarcrmConfiguration','pick','map','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','username','password','remoteUri','slice','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','values','module_fields','remove','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x5f2f72,_0x24c69a){var _0x432a6b=function(_0x4917f2){while(--_0x4917f2){_0x5f2f72['push'](_0x5f2f72['shift']());}};_0x432a6b(++_0x24c69a);}(_0x724f,0x1d1));var _0xf724=function(_0x12a78e,_0x371b51){_0x12a78e=_0x12a78e-0x0;var _0x4cc242=_0x724f[_0x12a78e];return _0x4cc242;};'use strict';var emlformat=require(_0xf724('0x0'));var rimraf=require(_0xf724('0x1'));var zipdir=require(_0xf724('0x2'));var jsonpatch=require(_0xf724('0x3'));var rp=require(_0xf724('0x4'));var moment=require('moment');var BPromise=require(_0xf724('0x5'));var Mustache=require(_0xf724('0x6'));var util=require(_0xf724('0x7'));var path=require(_0xf724('0x8'));var sox=require('sox');var csv=require(_0xf724('0x9'));var ejs=require(_0xf724('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf724('0xb'));var squel=require(_0xf724('0xc'));var crypto=require(_0xf724('0xd'));var jsforce=require(_0xf724('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf724('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf724('0xf'));var authService=require(_0xf724('0x10'));var qs=require(_0xf724('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf724('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xf724('0x13'));var licenseUtil=require(_0xf724('0x14'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xbe1f84,_0x3628f4){_0x3628f4=_0x3628f4||0xcc;return function(_0x5bf6a8){if(_0x5bf6a8){return _0xbe1f84[_0xf724('0x15')](_0x3628f4);}return _0xbe1f84[_0xf724('0x16')](_0x3628f4)[_0xf724('0x17')]();};}function respondWithResult(_0x3a2bee,_0x338e7d){_0x338e7d=_0x338e7d||0xc8;return function(_0x13ad52){if(_0x13ad52){return _0x3a2bee[_0xf724('0x16')](_0x338e7d)[_0xf724('0x18')](_0x13ad52);}};}function respondWithFilteredResult(_0x374a3e,_0x128dee){return function(_0x3df592){if(_0x3df592){var _0x2d97a9=typeof _0x128dee[_0xf724('0x19')]===_0xf724('0x1a')&&typeof _0x128dee['limit']==='undefined';var _0x365e66=_0x3df592[_0xf724('0x1b')];var _0x38456a=_0x2d97a9?0x0:_0x128dee['offset'];var _0xbfc97d=_0x2d97a9?_0x3df592[_0xf724('0x1b')]:_0x128dee['offset']+_0x128dee[_0xf724('0x1c')];var _0x2e1914;if(_0xbfc97d>=_0x365e66){_0xbfc97d=_0x365e66;_0x2e1914=0xc8;}else{_0x2e1914=0xce;}_0x374a3e[_0xf724('0x16')](_0x2e1914);return _0x374a3e[_0xf724('0x1d')](_0xf724('0x1e'),_0x38456a+'-'+_0xbfc97d+'/'+_0x365e66)[_0xf724('0x18')](_0x3df592);}return null;};}function patchUpdates(_0x1fef1e){return function(_0x114902){try{jsonpatch['apply'](_0x114902,_0x1fef1e,!![]);}catch(_0x472d60){return BPromise[_0xf724('0x1f')](_0x472d60);}return _0x114902[_0xf724('0x20')]();};}function saveUpdates(_0x14555f,_0x53a3c6){return function(_0x2cef7f){if(_0x2cef7f){return _0x2cef7f[_0xf724('0x21')](_0x14555f)[_0xf724('0x22')](function(_0x12e67c){return _0x12e67c;});}return null;};}function removeEntity(_0x3bd29e,_0x493d48){return function(_0x3e274f){if(_0x3e274f){return _0x3e274f[_0xf724('0x23')]()[_0xf724('0x22')](function(){_0x3bd29e[_0xf724('0x16')](0xcc)[_0xf724('0x17')]();});}};}function handleEntityNotFound(_0xc7c7b4,_0x35a812){return function(_0x297bf3){if(!_0x297bf3){_0xc7c7b4['sendStatus'](0x194);}return _0x297bf3;};}function handleError(_0x5a2056,_0x1f4ac5){_0x1f4ac5=_0x1f4ac5||0x1f4;return function(_0x12106f){logger[_0xf724('0x24')](_0x12106f[_0xf724('0x25')]);if(_0x12106f[_0xf724('0x26')]){delete _0x12106f[_0xf724('0x26')];}_0x5a2056[_0xf724('0x16')](_0x1f4ac5)[_0xf724('0x27')](_0x12106f);};}exports[_0xf724('0x28')]=function(_0x31cd53,_0x2aee40){var _0x1810d7={},_0xcaf8ee={},_0x47ae6e={'count':0x0,'rows':[]};var _0x3791a6=_['map'](db[_0xf724('0x29')][_0xf724('0x2a')],function(_0x4aeea6){return{'name':_0x4aeea6[_0xf724('0x2b')],'type':_0x4aeea6[_0xf724('0x2c')][_0xf724('0x2d')]};});_0xcaf8ee[_0xf724('0x2e')]=_['map'](_0x3791a6,_0xf724('0x26'));_0xcaf8ee[_0xf724('0x2f')]=_[_0xf724('0x30')](_0x31cd53['query']);_0xcaf8ee[_0xf724('0x31')]=_[_0xf724('0x32')](_0xcaf8ee['model'],_0xcaf8ee[_0xf724('0x2f')]);_0x1810d7[_0xf724('0x33')]=_[_0xf724('0x32')](_0xcaf8ee[_0xf724('0x2e')],qs[_0xf724('0x34')](_0x31cd53[_0xf724('0x2f')]['fields']));_0x1810d7['attributes']=_0x1810d7[_0xf724('0x33')][_0xf724('0x35')]?_0x1810d7['attributes']:_0xcaf8ee[_0xf724('0x2e')];if(!_0x31cd53[_0xf724('0x2f')][_0xf724('0x36')](_0xf724('0x37'))){_0x1810d7[_0xf724('0x1c')]=qs[_0xf724('0x1c')](_0x31cd53[_0xf724('0x2f')][_0xf724('0x1c')]);_0x1810d7['offset']=qs['offset'](_0x31cd53[_0xf724('0x2f')]['offset']);}_0x1810d7[_0xf724('0x38')]=qs[_0xf724('0x39')](_0x31cd53['query']['sort']);_0x1810d7[_0xf724('0x3a')]=qs[_0xf724('0x31')](_['pick'](_0x31cd53[_0xf724('0x2f')],_0xcaf8ee[_0xf724('0x31')]),_0x3791a6);if(_0x31cd53['query']['filter']){_0x1810d7[_0xf724('0x3a')]=_[_0xf724('0x3b')](_0x1810d7[_0xf724('0x3a')],{'$or':_['map'](_0x3791a6,function(_0x127472){if(_0x127472['type']!==_0xf724('0x3c')){var _0x4e7ce9={};_0x4e7ce9[_0x127472[_0xf724('0x26')]]={'$like':'%'+_0x31cd53[_0xf724('0x2f')][_0xf724('0x3d')]+'%'};return _0x4e7ce9;}})});}_0x1810d7=_[_0xf724('0x3b')]({},_0x1810d7,_0x31cd53['options']);var _0x80e6b0={'where':_0x1810d7['where']};return db[_0xf724('0x29')][_0xf724('0x1b')](_0x80e6b0)[_0xf724('0x22')](function(_0x1e3806){_0x47ae6e[_0xf724('0x1b')]=_0x1e3806;if(_0x31cd53[_0xf724('0x2f')][_0xf724('0x3e')]){_0x1810d7[_0xf724('0x3f')]=[{'all':!![]}];}return db[_0xf724('0x29')][_0xf724('0x40')](_0x1810d7);})[_0xf724('0x22')](function(_0x54cfd5){_0x47ae6e['rows']=_0x54cfd5;return _0x47ae6e;})[_0xf724('0x22')](respondWithFilteredResult(_0x2aee40,_0x1810d7))[_0xf724('0x41')](handleError(_0x2aee40,null));};exports['show']=function(_0xc005,_0x4f48c0){var _0x3ecf33={'raw':![],'where':{'id':_0xc005[_0xf724('0x42')]['id']}},_0x2c0520={};_0x2c0520[_0xf724('0x2e')]=_[_0xf724('0x30')](db['SugarcrmAccount'][_0xf724('0x2a')]);_0x2c0520[_0xf724('0x2f')]=_[_0xf724('0x30')](_0xc005[_0xf724('0x2f')]);_0x2c0520[_0xf724('0x31')]=_[_0xf724('0x32')](_0x2c0520['model'],_0x2c0520[_0xf724('0x2f')]);_0x3ecf33['attributes']=_[_0xf724('0x32')](_0x2c0520[_0xf724('0x2e')],qs[_0xf724('0x34')](_0xc005[_0xf724('0x2f')][_0xf724('0x34')]));_0x3ecf33[_0xf724('0x33')]=_0x3ecf33['attributes'][_0xf724('0x35')]?_0x3ecf33['attributes']:_0x2c0520[_0xf724('0x2e')];if(_0xc005[_0xf724('0x2f')]['includeAll']){_0x3ecf33[_0xf724('0x3f')]=[{'all':!![]}];}_0x3ecf33=_[_0xf724('0x3b')]({},_0x3ecf33,_0xc005[_0xf724('0x43')]);return db[_0xf724('0x29')][_0xf724('0x44')](_0x3ecf33)[_0xf724('0x22')](handleEntityNotFound(_0x4f48c0,null))[_0xf724('0x22')](respondWithResult(_0x4f48c0,null))['catch'](handleError(_0x4f48c0,null));};exports['create']=function(_0xd92d8,_0x318b4c){return db[_0xf724('0x29')][_0xf724('0x45')](_0xd92d8[_0xf724('0x46')],{})[_0xf724('0x22')](respondWithResult(_0x318b4c,0xc9))[_0xf724('0x41')](handleError(_0x318b4c,null));};exports[_0xf724('0x21')]=function(_0x268232,_0x5d3a3f){if(_0x268232['body']['id']){delete _0x268232[_0xf724('0x46')]['id'];}return db[_0xf724('0x29')]['find']({'where':{'id':_0x268232['params']['id']}})[_0xf724('0x22')](handleEntityNotFound(_0x5d3a3f,null))['then'](saveUpdates(_0x268232[_0xf724('0x46')],null))['then'](respondWithResult(_0x5d3a3f,null))[_0xf724('0x41')](handleError(_0x5d3a3f,null));};exports[_0xf724('0x23')]=function(_0xdac035,_0x152b71){return db[_0xf724('0x29')][_0xf724('0x44')]({'where':{'id':_0xdac035[_0xf724('0x42')]['id']}})[_0xf724('0x22')](handleEntityNotFound(_0x152b71,null))[_0xf724('0x22')](removeEntity(_0x152b71,null))[_0xf724('0x41')](handleError(_0x152b71,null));};exports['getConfigurations']=function(_0x3ab7eb,_0x4ac775,_0x203e3e){var _0x25095f={};var _0x471a4f={};var _0x1debed;var _0x5ac0ad;return db[_0xf724('0x29')]['findOne']({'where':{'id':_0x3ab7eb[_0xf724('0x42')]['id']}})[_0xf724('0x22')](handleEntityNotFound(_0x4ac775,null))[_0xf724('0x22')](function(_0x270cb4){if(_0x270cb4){_0x1debed=_0x270cb4;_0x471a4f[_0xf724('0x2e')]=_[_0xf724('0x30')](db[_0xf724('0x47')][_0xf724('0x2a')]);_0x471a4f[_0xf724('0x2f')]=_[_0xf724('0x30')](_0x3ab7eb['query']);_0x471a4f[_0xf724('0x31')]=_[_0xf724('0x32')](_0x471a4f[_0xf724('0x2e')],_0x471a4f['query']);_0x25095f[_0xf724('0x33')]=_[_0xf724('0x32')](_0x471a4f['model'],qs['fields'](_0x3ab7eb[_0xf724('0x2f')][_0xf724('0x34')]));_0x25095f[_0xf724('0x33')]=_0x25095f[_0xf724('0x33')]['length']?_0x25095f[_0xf724('0x33')]:_0x471a4f['model'];_0x25095f[_0xf724('0x38')]=qs[_0xf724('0x39')](_0x3ab7eb[_0xf724('0x2f')][_0xf724('0x39')]);_0x25095f[_0xf724('0x3a')]=qs[_0xf724('0x31')](_[_0xf724('0x48')](_0x3ab7eb['query'],_0x471a4f['filters']));if(_0x3ab7eb[_0xf724('0x2f')]['filter']){_0x25095f['where']=_[_0xf724('0x3b')](_0x25095f[_0xf724('0x3a')],{'$or':_[_0xf724('0x49')](_0x25095f['attributes'],function(_0xd126c5){var _0x375dba={};_0x375dba[_0xd126c5]={'$like':'%'+_0x3ab7eb[_0xf724('0x2f')][_0xf724('0x3d')]+'%'};return _0x375dba;})});}_0x25095f=_['merge']({},_0x25095f,_0x3ab7eb['options']);return _0x1debed['getConfigurations'](_0x25095f);}})[_0xf724('0x22')](function(_0x352d28){if(_0x352d28){_0x5ac0ad=_0x352d28[_0xf724('0x35')];if(!_0x3ab7eb[_0xf724('0x2f')][_0xf724('0x36')](_0xf724('0x37'))){_0x25095f[_0xf724('0x1c')]=qs['limit'](_0x3ab7eb[_0xf724('0x2f')][_0xf724('0x1c')]);_0x25095f['offset']=qs['offset'](_0x3ab7eb[_0xf724('0x2f')]['offset']);}return _0x1debed[_0xf724('0x4a')](_0x25095f);}})[_0xf724('0x22')](function(_0x3c8055){if(_0x3c8055){return _0x3c8055?{'count':_0x5ac0ad,'rows':_0x3c8055}:null;}})[_0xf724('0x22')](respondWithResult(_0x4ac775,null))['catch'](handleError(_0x4ac775,null));};exports[_0xf724('0x4b')]=function(_0x4452d3,_0x3b1174,_0x506a3a){if(_0x4452d3[_0xf724('0x46')]['id']){delete _0x4452d3['body']['id'];}return db[_0xf724('0x29')][_0xf724('0x4c')]({'where':{'id':_0x4452d3[_0xf724('0x42')]['id']}})['then'](handleEntityNotFound(_0x3b1174,null))[_0xf724('0x22')](function(_0x1b4e55){if(_0x1b4e55){_0x4452d3['body'][_0xf724('0x4d')]=_0x1b4e55['id'];_0x4452d3[_0xf724('0x46')][_0xf724('0x4e')]=integrations[_0xf724('0x4f')](_0x4452d3[_0xf724('0x46')][_0xf724('0x50')],_0x4452d3[_0xf724('0x46')]['type']);_0x4452d3[_0xf724('0x46')][_0xf724('0x51')]=integrations[_0xf724('0x52')](_0x4452d3[_0xf724('0x46')][_0xf724('0x50')],_0x4452d3[_0xf724('0x46')][_0xf724('0x2c')]);return db[_0xf724('0x47')][_0xf724('0x45')](_0x4452d3[_0xf724('0x46')],{'include':[{'model':db[_0xf724('0x53')],'as':_0xf724('0x4e')},{'model':db[_0xf724('0x53')],'as':_0xf724('0x51')}]});}return null;})['then'](respondWithResult(_0x3b1174,null))[_0xf724('0x41')](handleError(_0x3b1174,null));};exports[_0xf724('0x54')]=function(_0x231094,_0x463cca,_0x2e1d58){var _0x13bc8d='';var _0x58f357=['id',_0xf724('0x26'),_0xf724('0x55'),_0xf724('0x56'),_0xf724('0x57'),'date_start',_0xf724('0x58'),_0xf724('0x59'),_0xf724('0x5a'),_0xf724('0x5b'),'parent_name','direction'];return db[_0xf724('0x29')][_0xf724('0x4c')]({'where':{'id':_0x231094[_0xf724('0x42')]['id']},'attributes':['id',_0xf724('0x5c'),_0xf724('0x5d'),'remoteUri']})[_0xf724('0x22')](handleEntityNotFound(_0x463cca,null))[_0xf724('0x22')](function(_0x5ee9a8){if(_0x5ee9a8){_0x13bc8d=_0x5ee9a8[_0xf724('0x5e')];var _0x12d256=_0x13bc8d[_0xf724('0x5f')](-0x1);if(_0x12d256==='/'){_0x13bc8d=_0x13bc8d['substring'](0x0,_0x13bc8d[_0xf724('0x60')](_0x12d256));}return rp({'method':_0xf724('0x61'),'uri':util[_0xf724('0x62')](_0xf724('0x63'),_0x13bc8d,_0xf724('0x64')),'json':!![],'form':{'method':_0xf724('0x65'),'input_type':'JSON','response_type':_0xf724('0x66'),'rest_data':JSON[_0xf724('0x67')]({'user_auth':{'user_name':_0x5ee9a8[_0xf724('0x5c')],'password':_0x5ee9a8[_0xf724('0x5d')],'encryption':'PLAIN'},'application':_0xf724('0x68')})}});}})[_0xf724('0x22')](function(_0x224018){if(_0x224018&&_0x224018[_0xf724('0x26')]!==_0xf724('0x69')&&_0x224018[_0xf724('0x26')]!=='Password\x20Expired'){return rp({'method':_0xf724('0x61'),'uri':util[_0xf724('0x62')](_0xf724('0x63'),_0x13bc8d,_0xf724('0x64')),'json':!![],'form':{'method':_0xf724('0x6a'),'input_type':_0xf724('0x66'),'response_type':_0xf724('0x66'),'rest_data':JSON[_0xf724('0x67')]({'session':_0x224018['id'],'module_name':_0xf724('0x6b')})}})[_0xf724('0x22')](function(_0x226a96){if(_0x226a96){var _0x179adc=_[_0xf724('0x6c')](_0x226a96[_0xf724('0x6d')]);_[_0xf724('0x6e')](_0x179adc,function(_0x444a88){return _0x58f357['includes'](_0x444a88[_0xf724('0x26')]);});return{'count':_0x179adc[_0xf724('0x35')],'rows':_[_0xf724('0x49')](_0x179adc,function(_0x5efce9){return{'id':_0x5efce9[_0xf724('0x26')],'name':_0x5efce9[_0xf724('0x6f')],'custom':_[_0xf724('0x70')](_0x5efce9[_0xf724('0x26')],'_c')?!![]:![],'options':_0x5efce9[_0xf724('0x43')]?_[_0xf724('0x49')](_[_0xf724('0x6c')](_0x5efce9['options']),function(_0x32a1ba){return{'name':_0x32a1ba[_0xf724('0x71')],'value':_0x32a1ba['name']};}):[]};})};}})[_0xf724('0x22')](respondWithResult(_0x463cca,null))['catch'](function(_0x23c9c0){var _0x3ca380=_0x231094[_0xf724('0x2f')]['test']?0x1f4:_0x23c9c0[_0xf724('0x72')]||0x1f4;logger[_0xf724('0x24')](_0xf724('0x73'),_0xf724('0x54'),_0x3ca380,JSON[_0xf724('0x67')](_0x23c9c0));delete _0x23c9c0[_0xf724('0x26')];if(_0x3ca380===0x191){_0x3ca380=0x190;}_0x463cca['status'](_0x3ca380)[_0xf724('0x27')](_0x231094['query'][_0xf724('0x74')]?{'message':_0xf724('0x75'),'statusCode':_0x23c9c0[_0xf724('0x72')]}:_0x23c9c0);});}else{var _0x8799b9=0x1f4;_0x463cca['status'](_0x8799b9)[_0xf724('0x27')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xd816=['to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../components/integrations/configuration','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','SugarcrmAccount','includeAll','findAll','rows','catch','params','keys','include','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','format','get_module_fields','Calls','values','module_fields','remove','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','ejs','lodash','crypto','jsforce'];(function(_0x3733f8,_0x55324f){var _0x254358=function(_0x3ca846){while(--_0x3ca846){_0x3733f8['push'](_0x3733f8['shift']());}};_0x254358(++_0x55324f);}(_0xd816,0xd5));var _0x6d81=function(_0x58bca2,_0x335b3c){_0x58bca2=_0x58bca2-0x0;var _0x1d3856=_0xd816[_0x58bca2];return _0x1d3856;};'use strict';var emlformat=require(_0x6d81('0x0'));var rimraf=require(_0x6d81('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d81('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6d81('0x3'));var util=require(_0x6d81('0x4'));var path=require(_0x6d81('0x5'));var sox=require(_0x6d81('0x6'));var csv=require('to-csv');var ejs=require(_0x6d81('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d81('0x8'));var squel=require('squel');var crypto=require(_0x6d81('0x9'));var jsforce=require(_0x6d81('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6d81('0xb'));var querystring=require(_0x6d81('0xc'));var Papa=require(_0x6d81('0xd'));var Redis=require(_0x6d81('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6d81('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d81('0x10'));var logger=require(_0x6d81('0x11'))(_0x6d81('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x6d81('0x13'));function respondWithStatusCode(_0x452f0b,_0x4566b4){_0x4566b4=_0x4566b4||0xcc;return function(_0x121969){if(_0x121969){return _0x452f0b['sendStatus'](_0x4566b4);}return _0x452f0b[_0x6d81('0x14')](_0x4566b4)[_0x6d81('0x15')]();};}function respondWithResult(_0x43cecc,_0x55fcb7){_0x55fcb7=_0x55fcb7||0xc8;return function(_0x4bad98){if(_0x4bad98){return _0x43cecc[_0x6d81('0x14')](_0x55fcb7)['json'](_0x4bad98);}};}function respondWithFilteredResult(_0x5bbcac,_0x3867f9){return function(_0x25dd7a){if(_0x25dd7a){var _0x18b3f6=typeof _0x3867f9[_0x6d81('0x16')]===_0x6d81('0x17')&&typeof _0x3867f9[_0x6d81('0x18')]===_0x6d81('0x17');var _0x4fe5d3=_0x25dd7a[_0x6d81('0x19')];var _0x15c771=_0x18b3f6?0x0:_0x3867f9[_0x6d81('0x16')];var _0x333460=_0x18b3f6?_0x25dd7a['count']:_0x3867f9[_0x6d81('0x16')]+_0x3867f9['limit'];var _0x357795;if(_0x333460>=_0x4fe5d3){_0x333460=_0x4fe5d3;_0x357795=0xc8;}else{_0x357795=0xce;}_0x5bbcac[_0x6d81('0x14')](_0x357795);return _0x5bbcac[_0x6d81('0x1a')](_0x6d81('0x1b'),_0x15c771+'-'+_0x333460+'/'+_0x4fe5d3)[_0x6d81('0x1c')](_0x25dd7a);}return null;};}function patchUpdates(_0x28944e){return function(_0x324015){try{jsonpatch['apply'](_0x324015,_0x28944e,!![]);}catch(_0x4e1999){return BPromise[_0x6d81('0x1d')](_0x4e1999);}return _0x324015[_0x6d81('0x1e')]();};}function saveUpdates(_0xa08327,_0x7deece){return function(_0x3016bd){if(_0x3016bd){return _0x3016bd['update'](_0xa08327)[_0x6d81('0x1f')](function(_0x2a7956){return _0x2a7956;});}return null;};}function removeEntity(_0x439dd3,_0x25f587){return function(_0x21958c){if(_0x21958c){return _0x21958c[_0x6d81('0x20')]()[_0x6d81('0x1f')](function(){_0x439dd3[_0x6d81('0x14')](0xcc)[_0x6d81('0x15')]();});}};}function handleEntityNotFound(_0x10857a,_0x3594a9){return function(_0x52e614){if(!_0x52e614){_0x10857a[_0x6d81('0x21')](0x194);}return _0x52e614;};}function handleError(_0x20f21e,_0x4e1ed1){_0x4e1ed1=_0x4e1ed1||0x1f4;return function(_0x330805){logger[_0x6d81('0x22')](_0x330805[_0x6d81('0x23')]);if(_0x330805[_0x6d81('0x24')]){delete _0x330805[_0x6d81('0x24')];}_0x20f21e[_0x6d81('0x14')](_0x4e1ed1)[_0x6d81('0x25')](_0x330805);};}exports[_0x6d81('0x26')]=function(_0x2d7067,_0x35a878){var _0x12de53={},_0x108cbc={},_0x2223f9={'count':0x0,'rows':[]};var _0x4b5d71=_[_0x6d81('0x27')](db['SugarcrmAccount'][_0x6d81('0x28')],function(_0x46fde9){return{'name':_0x46fde9['fieldName'],'type':_0x46fde9['type'][_0x6d81('0x29')]};});_0x108cbc[_0x6d81('0x2a')]=_[_0x6d81('0x27')](_0x4b5d71,_0x6d81('0x24'));_0x108cbc[_0x6d81('0x2b')]=_['keys'](_0x2d7067[_0x6d81('0x2b')]);_0x108cbc['filters']=_['intersection'](_0x108cbc['model'],_0x108cbc[_0x6d81('0x2b')]);_0x12de53[_0x6d81('0x2c')]=_[_0x6d81('0x2d')](_0x108cbc[_0x6d81('0x2a')],qs[_0x6d81('0x2e')](_0x2d7067[_0x6d81('0x2b')][_0x6d81('0x2e')]));_0x12de53['attributes']=_0x12de53[_0x6d81('0x2c')][_0x6d81('0x2f')]?_0x12de53['attributes']:_0x108cbc[_0x6d81('0x2a')];if(!_0x2d7067[_0x6d81('0x2b')][_0x6d81('0x30')](_0x6d81('0x31'))){_0x12de53[_0x6d81('0x18')]=qs['limit'](_0x2d7067[_0x6d81('0x2b')]['limit']);_0x12de53[_0x6d81('0x16')]=qs[_0x6d81('0x16')](_0x2d7067[_0x6d81('0x2b')][_0x6d81('0x16')]);}_0x12de53[_0x6d81('0x32')]=qs[_0x6d81('0x33')](_0x2d7067[_0x6d81('0x2b')][_0x6d81('0x33')]);_0x12de53[_0x6d81('0x34')]=qs[_0x6d81('0x35')](_[_0x6d81('0x36')](_0x2d7067[_0x6d81('0x2b')],_0x108cbc[_0x6d81('0x35')]),_0x4b5d71);if(_0x2d7067[_0x6d81('0x2b')][_0x6d81('0x37')]){_0x12de53['where']=_[_0x6d81('0x38')](_0x12de53[_0x6d81('0x34')],{'$or':_[_0x6d81('0x27')](_0x4b5d71,function(_0x1cf965){if(_0x1cf965[_0x6d81('0x39')]!=='VIRTUAL'){var _0x42b98f={};_0x42b98f[_0x1cf965[_0x6d81('0x24')]]={'$like':'%'+_0x2d7067[_0x6d81('0x2b')][_0x6d81('0x37')]+'%'};return _0x42b98f;}})});}_0x12de53=_[_0x6d81('0x38')]({},_0x12de53,_0x2d7067[_0x6d81('0x3a')]);var _0x2ccd96={'where':_0x12de53[_0x6d81('0x34')]};return db[_0x6d81('0x3b')][_0x6d81('0x19')](_0x2ccd96)['then'](function(_0x2bfef8){_0x2223f9[_0x6d81('0x19')]=_0x2bfef8;if(_0x2d7067['query'][_0x6d81('0x3c')]){_0x12de53['include']=[{'all':!![]}];}return db[_0x6d81('0x3b')][_0x6d81('0x3d')](_0x12de53);})[_0x6d81('0x1f')](function(_0x5971cb){_0x2223f9[_0x6d81('0x3e')]=_0x5971cb;return _0x2223f9;})['then'](respondWithFilteredResult(_0x35a878,_0x12de53))[_0x6d81('0x3f')](handleError(_0x35a878,null));};exports['show']=function(_0x11fd75,_0x2e5b55){var _0x22792a={'raw':![],'where':{'id':_0x11fd75[_0x6d81('0x40')]['id']}},_0x3cb16e={};_0x3cb16e[_0x6d81('0x2a')]=_[_0x6d81('0x41')](db[_0x6d81('0x3b')][_0x6d81('0x28')]);_0x3cb16e[_0x6d81('0x2b')]=_[_0x6d81('0x41')](_0x11fd75[_0x6d81('0x2b')]);_0x3cb16e[_0x6d81('0x35')]=_[_0x6d81('0x2d')](_0x3cb16e['model'],_0x3cb16e['query']);_0x22792a[_0x6d81('0x2c')]=_[_0x6d81('0x2d')](_0x3cb16e[_0x6d81('0x2a')],qs[_0x6d81('0x2e')](_0x11fd75[_0x6d81('0x2b')][_0x6d81('0x2e')]));_0x22792a[_0x6d81('0x2c')]=_0x22792a['attributes']['length']?_0x22792a[_0x6d81('0x2c')]:_0x3cb16e[_0x6d81('0x2a')];if(_0x11fd75[_0x6d81('0x2b')][_0x6d81('0x3c')]){_0x22792a[_0x6d81('0x42')]=[{'all':!![]}];}_0x22792a=_[_0x6d81('0x38')]({},_0x22792a,_0x11fd75[_0x6d81('0x3a')]);return db[_0x6d81('0x3b')][_0x6d81('0x43')](_0x22792a)[_0x6d81('0x1f')](handleEntityNotFound(_0x2e5b55,null))['then'](respondWithResult(_0x2e5b55,null))[_0x6d81('0x3f')](handleError(_0x2e5b55,null));};exports[_0x6d81('0x44')]=function(_0x5ce2dd,_0xb1df8f){return db['SugarcrmAccount'][_0x6d81('0x44')](_0x5ce2dd['body'],{})['then'](respondWithResult(_0xb1df8f,0xc9))[_0x6d81('0x3f')](handleError(_0xb1df8f,null));};exports['update']=function(_0x2a89d2,_0x492141){if(_0x2a89d2[_0x6d81('0x45')]['id']){delete _0x2a89d2[_0x6d81('0x45')]['id'];}return db[_0x6d81('0x3b')][_0x6d81('0x43')]({'where':{'id':_0x2a89d2[_0x6d81('0x40')]['id']}})[_0x6d81('0x1f')](handleEntityNotFound(_0x492141,null))['then'](saveUpdates(_0x2a89d2[_0x6d81('0x45')],null))[_0x6d81('0x1f')](respondWithResult(_0x492141,null))[_0x6d81('0x3f')](handleError(_0x492141,null));};exports[_0x6d81('0x20')]=function(_0xe40b5a,_0x53e754){return db[_0x6d81('0x3b')][_0x6d81('0x43')]({'where':{'id':_0xe40b5a[_0x6d81('0x40')]['id']}})[_0x6d81('0x1f')](handleEntityNotFound(_0x53e754,null))[_0x6d81('0x1f')](removeEntity(_0x53e754,null))[_0x6d81('0x3f')](handleError(_0x53e754,null));};exports[_0x6d81('0x46')]=function(_0x27224f,_0x4b0d5c,_0x9c1c2a){var _0x397db4={};var _0x249ecf={};var _0x1d9bbd;var _0x27715e;return db['SugarcrmAccount'][_0x6d81('0x47')]({'where':{'id':_0x27224f[_0x6d81('0x40')]['id']}})['then'](handleEntityNotFound(_0x4b0d5c,null))[_0x6d81('0x1f')](function(_0x263745){if(_0x263745){_0x1d9bbd=_0x263745;_0x249ecf[_0x6d81('0x2a')]=_[_0x6d81('0x41')](db[_0x6d81('0x48')]['rawAttributes']);_0x249ecf[_0x6d81('0x2b')]=_[_0x6d81('0x41')](_0x27224f['query']);_0x249ecf['filters']=_[_0x6d81('0x2d')](_0x249ecf[_0x6d81('0x2a')],_0x249ecf[_0x6d81('0x2b')]);_0x397db4[_0x6d81('0x2c')]=_['intersection'](_0x249ecf['model'],qs['fields'](_0x27224f[_0x6d81('0x2b')]['fields']));_0x397db4[_0x6d81('0x2c')]=_0x397db4[_0x6d81('0x2c')][_0x6d81('0x2f')]?_0x397db4[_0x6d81('0x2c')]:_0x249ecf[_0x6d81('0x2a')];_0x397db4['order']=qs['sort'](_0x27224f[_0x6d81('0x2b')][_0x6d81('0x33')]);_0x397db4[_0x6d81('0x34')]=qs[_0x6d81('0x35')](_['pick'](_0x27224f[_0x6d81('0x2b')],_0x249ecf[_0x6d81('0x35')]));if(_0x27224f[_0x6d81('0x2b')][_0x6d81('0x37')]){_0x397db4['where']=_[_0x6d81('0x38')](_0x397db4[_0x6d81('0x34')],{'$or':_[_0x6d81('0x27')](_0x397db4[_0x6d81('0x2c')],function(_0x16349e){var _0x572960={};_0x572960[_0x16349e]={'$like':'%'+_0x27224f['query']['filter']+'%'};return _0x572960;})});}_0x397db4=_['merge']({},_0x397db4,_0x27224f['options']);return _0x1d9bbd[_0x6d81('0x46')](_0x397db4);}})[_0x6d81('0x1f')](function(_0x1158aa){if(_0x1158aa){_0x27715e=_0x1158aa[_0x6d81('0x2f')];if(!_0x27224f['query'][_0x6d81('0x30')]('nolimit')){_0x397db4[_0x6d81('0x18')]=qs[_0x6d81('0x18')](_0x27224f[_0x6d81('0x2b')][_0x6d81('0x18')]);_0x397db4[_0x6d81('0x16')]=qs['offset'](_0x27224f[_0x6d81('0x2b')][_0x6d81('0x16')]);}return _0x1d9bbd[_0x6d81('0x46')](_0x397db4);}})[_0x6d81('0x1f')](function(_0x4b8971){if(_0x4b8971){return _0x4b8971?{'count':_0x27715e,'rows':_0x4b8971}:null;}})[_0x6d81('0x1f')](respondWithResult(_0x4b0d5c,null))[_0x6d81('0x3f')](handleError(_0x4b0d5c,null));};exports['addConfiguration']=function(_0x1cd372,_0x2c5966,_0x2dcac5){if(_0x1cd372[_0x6d81('0x45')]['id']){delete _0x1cd372['body']['id'];}return db[_0x6d81('0x3b')][_0x6d81('0x47')]({'where':{'id':_0x1cd372[_0x6d81('0x40')]['id']}})[_0x6d81('0x1f')](handleEntityNotFound(_0x2c5966,null))[_0x6d81('0x1f')](function(_0xcb0739){if(_0xcb0739){_0x1cd372[_0x6d81('0x45')][_0x6d81('0x49')]=_0xcb0739['id'];_0x1cd372[_0x6d81('0x45')][_0x6d81('0x4a')]=integrations['getSubjects'](_0x1cd372[_0x6d81('0x45')][_0x6d81('0x4b')],_0x1cd372[_0x6d81('0x45')]['type']);_0x1cd372[_0x6d81('0x45')][_0x6d81('0x4c')]=integrations[_0x6d81('0x4d')](_0x1cd372[_0x6d81('0x45')][_0x6d81('0x4b')],_0x1cd372[_0x6d81('0x45')][_0x6d81('0x39')]);return db[_0x6d81('0x48')]['create'](_0x1cd372[_0x6d81('0x45')],{'include':[{'model':db[_0x6d81('0x4e')],'as':_0x6d81('0x4a')},{'model':db[_0x6d81('0x4e')],'as':_0x6d81('0x4c')}]});}return null;})['then'](respondWithResult(_0x2c5966,null))[_0x6d81('0x3f')](handleError(_0x2c5966,null));};exports[_0x6d81('0x4f')]=function(_0x257d8f,_0x539451,_0x4b40a1){var _0x622fc6='';var _0xb37103=['id',_0x6d81('0x24'),_0x6d81('0x50'),_0x6d81('0x51'),_0x6d81('0x52'),_0x6d81('0x53'),_0x6d81('0x54'),_0x6d81('0x55'),_0x6d81('0x56'),'parent_type','parent_name',_0x6d81('0x57')];return db[_0x6d81('0x3b')][_0x6d81('0x47')]({'where':{'id':_0x257d8f['params']['id']},'attributes':['id',_0x6d81('0x58'),_0x6d81('0x59'),_0x6d81('0x5a')]})[_0x6d81('0x1f')](handleEntityNotFound(_0x539451,null))[_0x6d81('0x1f')](function(_0xd2c578){if(_0xd2c578){_0x622fc6=_0xd2c578[_0x6d81('0x5a')];var _0x721ea4=_0x622fc6[_0x6d81('0x5b')](-0x1);if(_0x721ea4==='/'){_0x622fc6=_0x622fc6[_0x6d81('0x5c')](0x0,_0x622fc6[_0x6d81('0x5d')](_0x721ea4));}return rp({'method':_0x6d81('0x5e'),'uri':util['format'](_0x6d81('0x5f'),_0x622fc6,_0x6d81('0x60')),'json':!![],'form':{'method':_0x6d81('0x61'),'input_type':_0x6d81('0x62'),'response_type':_0x6d81('0x62'),'rest_data':JSON[_0x6d81('0x63')]({'user_auth':{'user_name':_0xd2c578[_0x6d81('0x58')],'password':_0xd2c578['password'],'encryption':_0x6d81('0x64')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x6d81('0x1f')](function(_0x3439bf){if(_0x3439bf&&_0x3439bf[_0x6d81('0x24')]!=='Invalid\x20Login'&&_0x3439bf[_0x6d81('0x24')]!=='Password\x20Expired'){return rp({'method':_0x6d81('0x5e'),'uri':util[_0x6d81('0x65')](_0x6d81('0x5f'),_0x622fc6,_0x6d81('0x60')),'json':!![],'form':{'method':_0x6d81('0x66'),'input_type':'JSON','response_type':_0x6d81('0x62'),'rest_data':JSON[_0x6d81('0x63')]({'session':_0x3439bf['id'],'module_name':_0x6d81('0x67')})}})[_0x6d81('0x1f')](function(_0x31f140){if(_0x31f140){var _0x2942a7=_[_0x6d81('0x68')](_0x31f140[_0x6d81('0x69')]);_[_0x6d81('0x6a')](_0x2942a7,function(_0x4e2fc7){return _0xb37103['includes'](_0x4e2fc7[_0x6d81('0x24')]);});return{'count':_0x2942a7[_0x6d81('0x2f')],'rows':_['map'](_0x2942a7,function(_0x235123){return{'id':_0x235123['name'],'name':_0x235123[_0x6d81('0x6b')],'custom':_[_0x6d81('0x6c')](_0x235123[_0x6d81('0x24')],'_c')?!![]:![],'options':_0x235123[_0x6d81('0x3a')]?_[_0x6d81('0x27')](_['values'](_0x235123[_0x6d81('0x3a')]),function(_0x19c772){return{'name':_0x19c772[_0x6d81('0x6d')],'value':_0x19c772[_0x6d81('0x24')]};}):[]};})};}})[_0x6d81('0x1f')](respondWithResult(_0x539451,null))['catch'](function(_0x531579){var _0x1a0fa0=_0x257d8f['query']['test']?0x1f4:_0x531579[_0x6d81('0x6e')]||0x1f4;logger[_0x6d81('0x22')](_0x6d81('0x6f'),_0x6d81('0x4f'),_0x1a0fa0,JSON['stringify'](_0x531579));delete _0x531579[_0x6d81('0x24')];if(_0x1a0fa0===0x191){_0x1a0fa0=0x190;}_0x539451['status'](_0x1a0fa0)['send'](_0x257d8f['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x531579['statusCode']}:_0x531579);});}else{var _0x129d96=0x1f4;_0x539451[_0x6d81('0x14')](_0x129d96)['send']({'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 fdf7be7..be5b2b2 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 _0x3958=['define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports'];(function(_0x579171,_0x5aec8e){var _0x355b84=function(_0x45d0e7){while(--_0x45d0e7){_0x579171['push'](_0x579171['shift']());}};_0x355b84(++_0x5aec8e);}(_0x3958,0xe0));var _0x8395=function(_0x19b727,_0x553230){_0x19b727=_0x19b727-0x0;var _0x1efee3=_0x3958[_0x19b727];return _0x1efee3;};'use strict';var _=require(_0x8395('0x0'));var util=require(_0x8395('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8395('0x2'));var BPromise=require(_0x8395('0x3'));var rp=require(_0x8395('0x4'));var fs=require('fs');var path=require(_0x8395('0x5'));var rimraf=require(_0x8395('0x6'));var config=require(_0x8395('0x7'));var attributes=require(_0x8395('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8395('0x9')]=function(_0x1df63d,_0x1619bb){return _0x1df63d[_0x8395('0xa')](_0x8395('0xb'),attributes,{'tableName':_0x8395('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda59=['../../components/integrations/configuration','exports','define','SugarcrmAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x359388,_0x19be98){var _0xb721e9=function(_0x5a71a4){while(--_0x5a71a4){_0x359388['push'](_0x359388['shift']());}};_0xb721e9(++_0x19be98);}(_0xda59,0x1f3));var _0x9da5=function(_0x51c722,_0x20423f){_0x51c722=_0x51c722-0x0;var _0x5cc79e=_0xda59[_0x51c722];return _0x5cc79e;};'use strict';var _=require(_0x9da5('0x0'));var util=require(_0x9da5('0x1'));var logger=require(_0x9da5('0x2'))('api');var moment=require(_0x9da5('0x3'));var BPromise=require(_0x9da5('0x4'));var rp=require(_0x9da5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9da5('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x9da5('0x7'));module[_0x9da5('0x8')]=function(_0x51b86b,_0x12ad46){return _0x51b86b[_0x9da5('0x9')](_0x9da5('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 0149855..666c5b7 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 _0xc02d=['find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include','map','model','debug','ShowSugarcrmAccount'];(function(_0x109cb5,_0x1cbd22){var _0x3256bf=function(_0x335a21){while(--_0x335a21){_0x109cb5['push'](_0x109cb5['shift']());}};_0x3256bf(++_0x1cbd22);}(_0xc02d,0x1b1));var _0xdc02=function(_0x255527,_0x2b7744){_0x255527=_0x255527-0x0;var _0x41389b=_0xc02d[_0x255527];return _0x41389b;};'use strict';var _=require(_0xdc02('0x0'));var util=require(_0xdc02('0x1'));var moment=require(_0xdc02('0x2'));var BPromise=require(_0xdc02('0x3'));var rs=require(_0xdc02('0x4'));var fs=require('fs');var Redis=require(_0xdc02('0x5'));var db=require(_0xdc02('0x6'))['db'];var utils=require(_0xdc02('0x7'));var logger=require(_0xdc02('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdc02('0x9'));var client=jayson[_0xdc02('0xa')][_0xdc02('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x518ec7,_0x129e51,_0x15ac26){return new BPromise(function(_0x1299c7,_0x452c22){return client[_0xdc02('0xc')](_0x518ec7,_0x15ac26)[_0xdc02('0xd')](function(_0x155b8c){logger[_0xdc02('0xe')](_0xdc02('0xf'),_0x129e51,_0xdc02('0x10'));logger['debug'](_0xdc02('0x11'),_0x129e51,_0xdc02('0x10'),JSON[_0xdc02('0x12')](_0x155b8c));if(_0x155b8c[_0xdc02('0x13')]){if(_0x155b8c[_0xdc02('0x13')][_0xdc02('0x14')]===0x1f4){logger[_0xdc02('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x129e51,_0x155b8c['error'][_0xdc02('0x15')]);return _0x452c22(_0x155b8c[_0xdc02('0x13')][_0xdc02('0x15')]);}logger['error'](_0xdc02('0xf'),_0x129e51,_0x155b8c[_0xdc02('0x13')][_0xdc02('0x15')]);return _0x1299c7(_0x155b8c[_0xdc02('0x13')][_0xdc02('0x15')]);}else{logger[_0xdc02('0xe')](_0xdc02('0xf'),_0x129e51,'request\x20sent');_0x1299c7(_0x155b8c['result'][_0xdc02('0x15')]);}})[_0xdc02('0x16')](function(_0x180548){logger[_0xdc02('0x13')](_0xdc02('0xf'),_0x129e51,_0x180548);_0x452c22(_0x180548);});});}exports[_0xdc02('0x17')]=function(_0x5b96e8){var _0x4a6af8=this;return new Promise(function(_0x4bb6f3,_0x54d24d){return db[_0xdc02('0x18')][_0xdc02('0x19')]({'raw':_0x5b96e8['options']?_0x5b96e8[_0xdc02('0x1a')][_0xdc02('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b96e8[_0xdc02('0x1a')]?_0x5b96e8[_0xdc02('0x1a')][_0xdc02('0x1c')]||null:null,'attributes':_0x5b96e8[_0xdc02('0x1a')]?_0x5b96e8[_0xdc02('0x1a')][_0xdc02('0x1d')]||null:null,'limit':_0x5b96e8[_0xdc02('0x1a')]?_0x5b96e8[_0xdc02('0x1a')]['limit']||null:null,'include':_0x5b96e8[_0xdc02('0x1a')]?_0x5b96e8[_0xdc02('0x1a')][_0xdc02('0x1e')]?_[_0xdc02('0x1f')](_0x5b96e8[_0xdc02('0x1a')][_0xdc02('0x1e')],function(_0x4ebf9e){return{'model':db[_0x4ebf9e[_0xdc02('0x20')]],'as':_0x4ebf9e['as'],'attributes':_0x4ebf9e['attributes'],'include':_0x4ebf9e[_0xdc02('0x1e')]?_[_0xdc02('0x1f')](_0x4ebf9e[_0xdc02('0x1e')],function(_0x5db009){return{'model':db[_0x5db009[_0xdc02('0x20')]],'as':_0x5db009['as'],'attributes':_0x5db009[_0xdc02('0x1d')],'include':_0x5db009[_0xdc02('0x1e')]?_[_0xdc02('0x1f')](_0x5db009[_0xdc02('0x1e')],function(_0x2735e9){return{'model':db[_0x2735e9[_0xdc02('0x20')]],'as':_0x2735e9['as'],'attributes':_0x2735e9['attributes']};}):[]};}):[]};}):[]:[]})[_0xdc02('0xd')](function(_0x1a3c48){logger[_0xdc02('0xe')]('GetSugarcrmAccount',_0x5b96e8);logger[_0xdc02('0x21')](_0xdc02('0x17'),_0x5b96e8,JSON['stringify'](_0x1a3c48));_0x4bb6f3(_0x1a3c48);})['catch'](function(_0x1ddca9){logger[_0xdc02('0x13')](_0xdc02('0x17'),_0x1ddca9[_0xdc02('0x15')],_0x5b96e8);_0x54d24d(_0x4a6af8[_0xdc02('0x13')](0x1f4,_0x1ddca9[_0xdc02('0x15')]));});});};exports[_0xdc02('0x22')]=function(_0x2a8148){var _0x36bb3b=this;return new Promise(function(_0x1661c5,_0x251c78){return db[_0xdc02('0x18')][_0xdc02('0x23')]({'raw':_0x2a8148['options']?_0x2a8148['options']['raw']===undefined?!![]:![]:!![],'where':_0x2a8148[_0xdc02('0x1a')]?_0x2a8148[_0xdc02('0x1a')][_0xdc02('0x1c')]||null:null,'attributes':_0x2a8148[_0xdc02('0x1a')]?_0x2a8148[_0xdc02('0x1a')]['attributes']||null:null,'include':_0x2a8148[_0xdc02('0x1a')]?_0x2a8148[_0xdc02('0x1a')][_0xdc02('0x1e')]?_[_0xdc02('0x1f')](_0x2a8148[_0xdc02('0x1a')][_0xdc02('0x1e')],function(_0x55171d){return{'model':db[_0x55171d[_0xdc02('0x20')]],'as':_0x55171d['as'],'attributes':_0x55171d[_0xdc02('0x1d')],'include':_0x55171d[_0xdc02('0x1e')]?_[_0xdc02('0x1f')](_0x55171d['include'],function(_0x32ee44){return{'model':db[_0x32ee44[_0xdc02('0x20')]],'as':_0x32ee44['as'],'attributes':_0x32ee44['attributes'],'include':_0x32ee44[_0xdc02('0x1e')]?_[_0xdc02('0x1f')](_0x32ee44[_0xdc02('0x1e')],function(_0x2d88de){return{'model':db[_0x2d88de[_0xdc02('0x20')]],'as':_0x2d88de['as'],'attributes':_0x2d88de[_0xdc02('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdc02('0xd')](function(_0x4806a9){logger[_0xdc02('0xe')]('ShowSugarcrmAccount',_0x2a8148);logger[_0xdc02('0x21')]('ShowSugarcrmAccount',_0x2a8148,JSON['stringify'](_0x4806a9));_0x1661c5(_0x4806a9);})[_0xdc02('0x16')](function(_0x5ce1fa){logger[_0xdc02('0x13')]('ShowSugarcrmAccount',_0x5ce1fa[_0xdc02('0x15')],_0x2a8148);_0x251c78(_0x36bb3b['error'](0x1f4,_0x5ce1fa[_0xdc02('0x15')]));});});}; \ No newline at end of file +var _0xc924=['raw','where','attributes','limit','include','map','model','find','info','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','options'];(function(_0x511c6c,_0x1366f0){var _0x59d285=function(_0x424a35){while(--_0x424a35){_0x511c6c['push'](_0x511c6c['shift']());}};_0x59d285(++_0x1366f0);}(_0xc924,0xb4));var _0x4c92=function(_0x3b6648,_0x2d723a){_0x3b6648=_0x3b6648-0x0;var _0x5a0a0d=_0xc924[_0x3b6648];return _0x5a0a0d;};'use strict';var _=require(_0x4c92('0x0'));var util=require(_0x4c92('0x1'));var moment=require(_0x4c92('0x2'));var BPromise=require(_0x4c92('0x3'));var rs=require(_0x4c92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c92('0x5'))['db'];var utils=require(_0x4c92('0x6'));var logger=require(_0x4c92('0x7'))(_0x4c92('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4c92('0x9')][_0x4c92('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16de0a,_0x249eeb,_0x2ab3bd){return new BPromise(function(_0x253d75,_0x1486a6){return client[_0x4c92('0xb')](_0x16de0a,_0x2ab3bd)[_0x4c92('0xc')](function(_0x2b83d7){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x249eeb,_0x4c92('0xd'));logger[_0x4c92('0xe')](_0x4c92('0xf'),_0x249eeb,_0x4c92('0xd'),JSON[_0x4c92('0x10')](_0x2b83d7));if(_0x2b83d7[_0x4c92('0x11')]){if(_0x2b83d7[_0x4c92('0x11')]['code']===0x1f4){logger[_0x4c92('0x11')](_0x4c92('0x12'),_0x249eeb,_0x2b83d7[_0x4c92('0x11')]['message']);return _0x1486a6(_0x2b83d7[_0x4c92('0x11')][_0x4c92('0x13')]);}logger[_0x4c92('0x11')](_0x4c92('0x12'),_0x249eeb,_0x2b83d7[_0x4c92('0x11')][_0x4c92('0x13')]);return _0x253d75(_0x2b83d7[_0x4c92('0x11')]['message']);}else{logger['info'](_0x4c92('0x12'),_0x249eeb,_0x4c92('0xd'));_0x253d75(_0x2b83d7[_0x4c92('0x14')][_0x4c92('0x13')]);}})[_0x4c92('0x15')](function(_0x5065f4){logger[_0x4c92('0x11')](_0x4c92('0x12'),_0x249eeb,_0x5065f4);_0x1486a6(_0x5065f4);});});}exports[_0x4c92('0x16')]=function(_0x3c448d){var _0x50411e=this;return new Promise(function(_0x53fd5e,_0x4ffaad){return db['SugarcrmAccount']['findAll']({'raw':_0x3c448d[_0x4c92('0x17')]?_0x3c448d[_0x4c92('0x17')][_0x4c92('0x18')]===undefined?!![]:![]:!![],'where':_0x3c448d[_0x4c92('0x17')]?_0x3c448d['options'][_0x4c92('0x19')]||null:null,'attributes':_0x3c448d[_0x4c92('0x17')]?_0x3c448d['options'][_0x4c92('0x1a')]||null:null,'limit':_0x3c448d[_0x4c92('0x17')]?_0x3c448d[_0x4c92('0x17')][_0x4c92('0x1b')]||null:null,'include':_0x3c448d['options']?_0x3c448d[_0x4c92('0x17')][_0x4c92('0x1c')]?_[_0x4c92('0x1d')](_0x3c448d[_0x4c92('0x17')][_0x4c92('0x1c')],function(_0x34459a){return{'model':db[_0x34459a[_0x4c92('0x1e')]],'as':_0x34459a['as'],'attributes':_0x34459a[_0x4c92('0x1a')],'include':_0x34459a['include']?_[_0x4c92('0x1d')](_0x34459a[_0x4c92('0x1c')],function(_0x249841){return{'model':db[_0x249841[_0x4c92('0x1e')]],'as':_0x249841['as'],'attributes':_0x249841[_0x4c92('0x1a')],'include':_0x249841[_0x4c92('0x1c')]?_[_0x4c92('0x1d')](_0x249841[_0x4c92('0x1c')],function(_0x310566){return{'model':db[_0x310566['model']],'as':_0x310566['as'],'attributes':_0x310566['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c92('0xc')](function(_0x3ac197){logger['info'](_0x4c92('0x16'),_0x3c448d);logger[_0x4c92('0xe')](_0x4c92('0x16'),_0x3c448d,JSON[_0x4c92('0x10')](_0x3ac197));_0x53fd5e(_0x3ac197);})[_0x4c92('0x15')](function(_0x55328b){logger['error'](_0x4c92('0x16'),_0x55328b[_0x4c92('0x13')],_0x3c448d);_0x4ffaad(_0x50411e['error'](0x1f4,_0x55328b[_0x4c92('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0x3c4711){var _0x381318=this;return new Promise(function(_0x59d0d3,_0x48e408){return db['SugarcrmAccount'][_0x4c92('0x1f')]({'raw':_0x3c4711[_0x4c92('0x17')]?_0x3c4711[_0x4c92('0x17')][_0x4c92('0x18')]===undefined?!![]:![]:!![],'where':_0x3c4711['options']?_0x3c4711[_0x4c92('0x17')][_0x4c92('0x19')]||null:null,'attributes':_0x3c4711[_0x4c92('0x17')]?_0x3c4711[_0x4c92('0x17')][_0x4c92('0x1a')]||null:null,'include':_0x3c4711[_0x4c92('0x17')]?_0x3c4711[_0x4c92('0x17')][_0x4c92('0x1c')]?_[_0x4c92('0x1d')](_0x3c4711[_0x4c92('0x17')][_0x4c92('0x1c')],function(_0x23f31f){return{'model':db[_0x23f31f[_0x4c92('0x1e')]],'as':_0x23f31f['as'],'attributes':_0x23f31f[_0x4c92('0x1a')],'include':_0x23f31f[_0x4c92('0x1c')]?_['map'](_0x23f31f['include'],function(_0x183855){return{'model':db[_0x183855['model']],'as':_0x183855['as'],'attributes':_0x183855[_0x4c92('0x1a')],'include':_0x183855['include']?_['map'](_0x183855[_0x4c92('0x1c')],function(_0x39ad88){return{'model':db[_0x39ad88[_0x4c92('0x1e')]],'as':_0x39ad88['as'],'attributes':_0x39ad88[_0x4c92('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x345bb8){logger[_0x4c92('0x20')](_0x4c92('0x21'),_0x3c4711);logger[_0x4c92('0xe')]('ShowSugarcrmAccount',_0x3c4711,JSON[_0x4c92('0x10')](_0x345bb8));_0x59d0d3(_0x345bb8);})['catch'](function(_0x36f659){logger[_0x4c92('0x11')](_0x4c92('0x21'),_0x36f659[_0x4c92('0x13')],_0x3c4711);_0x48e408(_0x381318['error'](0x1f4,_0x36f659[_0x4c92('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 33b09c2..88fc299 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 _0x264a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','index','get','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0xcc27ed,_0x44ff9c){var _0x5e744b=function(_0xea7b56){while(--_0xea7b56){_0xcc27ed['push'](_0xcc27ed['shift']());}};_0x5e744b(++_0x44ff9c);}(_0x264a,0xa2));var _0xa264=function(_0x5b355d,_0x564b23){_0x5b355d=_0x5b355d-0x0;var _0x28ab39=_0x264a[_0x5b355d];return _0x28ab39;};'use strict';var multer=require(_0xa264('0x0'));var util=require(_0xa264('0x1'));var path=require(_0xa264('0x2'));var timeout=require(_0xa264('0x3'));var express=require(_0xa264('0x4'));var router=express['Router']();var fs_extra=require(_0xa264('0x5'));var auth=require(_0xa264('0x6'));var interaction=require(_0xa264('0x7'));var config=require(_0xa264('0x8'));var controller=require(_0xa264('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xa264('0xa')]);router[_0xa264('0xb')](_0xa264('0xc'),auth[_0xa264('0xd')](),controller[_0xa264('0xe')]);router[_0xa264('0xb')](_0xa264('0xf'),auth[_0xa264('0xd')](),controller['getFields']);router['get'](_0xa264('0x10'),auth[_0xa264('0xd')](),controller[_0xa264('0x11')]);router[_0xa264('0xb')]('/:id/descriptions',auth[_0xa264('0xd')](),controller['getDescriptions']);router[_0xa264('0x12')]('/',auth[_0xa264('0xd')](),controller['create']);router[_0xa264('0x13')]('/:id',auth[_0xa264('0xd')](),controller[_0xa264('0x14')]);router[_0xa264('0x15')](_0xa264('0xc'),auth[_0xa264('0xd')](),controller[_0xa264('0x16')]);module[_0xa264('0x17')]=router; \ No newline at end of file +var _0xdc46=['show','get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id'];(function(_0x58a015,_0x2e3370){var _0x535fb4=function(_0x1c084e){while(--_0x1c084e){_0x58a015['push'](_0x58a015['shift']());}};_0x535fb4(++_0x2e3370);}(_0xdc46,0x17a));var _0x6dc4=function(_0xb5bff0,_0x5379b3){_0xb5bff0=_0xb5bff0-0x0;var _0x54c823=_0xdc46[_0xb5bff0];return _0x54c823;};'use strict';var multer=require(_0x6dc4('0x0'));var util=require(_0x6dc4('0x1'));var path=require('path');var timeout=require(_0x6dc4('0x2'));var express=require(_0x6dc4('0x3'));var router=express[_0x6dc4('0x4')]();var fs_extra=require(_0x6dc4('0x5'));var auth=require(_0x6dc4('0x6'));var interaction=require(_0x6dc4('0x7'));var config=require(_0x6dc4('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0x6dc4('0x9')](),controller[_0x6dc4('0xa')]);router['get'](_0x6dc4('0xb'),auth['isAuthenticated'](),controller[_0x6dc4('0xc')]);router[_0x6dc4('0xd')](_0x6dc4('0xe'),auth[_0x6dc4('0x9')](),controller['getFields']);router[_0x6dc4('0xd')](_0x6dc4('0xf'),auth[_0x6dc4('0x9')](),controller[_0x6dc4('0x10')]);router['get'](_0x6dc4('0x11'),auth[_0x6dc4('0x9')](),controller[_0x6dc4('0x12')]);router[_0x6dc4('0x13')]('/',auth[_0x6dc4('0x9')](),controller[_0x6dc4('0x14')]);router[_0x6dc4('0x15')](_0x6dc4('0xb'),auth[_0x6dc4('0x9')](),controller[_0x6dc4('0x16')]);router[_0x6dc4('0x17')](_0x6dc4('0xb'),auth[_0x6dc4('0x9')](),controller[_0x6dc4('0x18')]);module[_0x6dc4('0x19')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index f01d00e..e55e489 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 _0x7ad9=['exports','STRING','sequelize'];(function(_0x411c57,_0x284ba7){var _0x26afd0=function(_0x2eb0b9){while(--_0x2eb0b9){_0x411c57['push'](_0x411c57['shift']());}};_0x26afd0(++_0x284ba7);}(_0x7ad9,0x16d));var _0x97ad=function(_0x483562,_0x6efc36){_0x483562=_0x483562-0x0;var _0x491f97=_0x7ad9[_0x483562];return _0x491f97;};'use strict';var Sequelize=require(_0x97ad('0x0'));module[_0x97ad('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x97ad('0x2')]}}; \ No newline at end of file +var _0xa475=['STRING','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa475,0xb7));var _0x5a47=function(_0x11ec52,_0x16c667){_0x11ec52=_0x11ec52-0x0;var _0x3ea768=_0xa475[_0x11ec52];return _0x3ea768;};'use strict';var Sequelize=require('sequelize');module[_0x5a47('0x0')]={'name':{'type':Sequelize[_0x5a47('0x1')]},'description':{'type':Sequelize[_0x5a47('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index c067ae4..f25ef67 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 _0x08af=['filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x63864f,_0x4a9716){var _0x51fa68=function(_0x11b92b){while(--_0x11b92b){_0x63864f['push'](_0x63864f['shift']());}};_0x51fa68(++_0x4a9716);}(_0x08af,0xbf));var _0xf08a=function(_0x401b3e,_0xed8de5){_0x401b3e=_0x401b3e-0x0;var _0x4f290f=_0x08af[_0x401b3e];return _0x4f290f;};'use strict';var emlformat=require(_0xf08a('0x0'));var rimraf=require(_0xf08a('0x1'));var zipdir=require(_0xf08a('0x2'));var jsonpatch=require(_0xf08a('0x3'));var rp=require(_0xf08a('0x4'));var moment=require(_0xf08a('0x5'));var BPromise=require(_0xf08a('0x6'));var Mustache=require(_0xf08a('0x7'));var util=require(_0xf08a('0x8'));var path=require(_0xf08a('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf08a('0xa'));var fs=require('fs');var fs_extra=require(_0xf08a('0xb'));var _=require(_0xf08a('0xc'));var squel=require(_0xf08a('0xd'));var crypto=require(_0xf08a('0xe'));var jsforce=require(_0xf08a('0xf'));var deskjs=require(_0xf08a('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf08a('0x11'));var Redis=require(_0xf08a('0x12'));var authService=require(_0xf08a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf08a('0x14'));var hardwareService=require(_0xf08a('0x15'));var logger=require(_0xf08a('0x16'))(_0xf08a('0x17'));var utils=require(_0xf08a('0x18'));var config=require(_0xf08a('0x19'));var licenseUtil=require(_0xf08a('0x1a'));var db=require(_0xf08a('0x1b'))['db'];function respondWithStatusCode(_0x196599,_0x4a3904){_0x4a3904=_0x4a3904||0xcc;return function(_0x3d8150){if(_0x3d8150){return _0x196599['sendStatus'](_0x4a3904);}return _0x196599[_0xf08a('0x1c')](_0x4a3904)['end']();};}function respondWithResult(_0x524032,_0x4e46e6){_0x4e46e6=_0x4e46e6||0xc8;return function(_0x26cce9){if(_0x26cce9){return _0x524032[_0xf08a('0x1c')](_0x4e46e6)[_0xf08a('0x1d')](_0x26cce9);}};}function respondWithFilteredResult(_0x248b1b,_0x3dbb11){return function(_0x19a7f7){if(_0x19a7f7){var _0x4d6b36=typeof _0x3dbb11['offset']==='undefined'&&typeof _0x3dbb11['limit']===_0xf08a('0x1e');var _0x529ea9=_0x19a7f7[_0xf08a('0x1f')];var _0x4214b7=_0x4d6b36?0x0:_0x3dbb11[_0xf08a('0x20')];var _0x1807a7=_0x4d6b36?_0x19a7f7[_0xf08a('0x1f')]:_0x3dbb11['offset']+_0x3dbb11[_0xf08a('0x21')];var _0x330b1c;if(_0x1807a7>=_0x529ea9){_0x1807a7=_0x529ea9;_0x330b1c=0xc8;}else{_0x330b1c=0xce;}_0x248b1b[_0xf08a('0x1c')](_0x330b1c);return _0x248b1b['set'](_0xf08a('0x22'),_0x4214b7+'-'+_0x1807a7+'/'+_0x529ea9)[_0xf08a('0x1d')](_0x19a7f7);}return null;};}function patchUpdates(_0x415dff){return function(_0x1be557){try{jsonpatch[_0xf08a('0x23')](_0x1be557,_0x415dff,!![]);}catch(_0x2e7bbc){return BPromise[_0xf08a('0x24')](_0x2e7bbc);}return _0x1be557[_0xf08a('0x25')]();};}function saveUpdates(_0x3dbcd1,_0x1e1219){return function(_0x46e11c){if(_0x46e11c){return _0x46e11c[_0xf08a('0x26')](_0x3dbcd1)['then'](function(_0xae3a04){return _0xae3a04;});}return null;};}function removeEntity(_0x5c4c39,_0x5552ae){return function(_0x40bff9){if(_0x40bff9){return _0x40bff9[_0xf08a('0x27')]()['then'](function(){_0x5c4c39['status'](0xcc)[_0xf08a('0x28')]();});}};}function handleEntityNotFound(_0x58832a,_0x38dae0){return function(_0x3beccc){if(!_0x3beccc){_0x58832a['sendStatus'](0x194);}return _0x3beccc;};}function handleError(_0x25aa84,_0x372f93){_0x372f93=_0x372f93||0x1f4;return function(_0x49555d){logger[_0xf08a('0x29')](_0x49555d[_0xf08a('0x2a')]);if(_0x49555d[_0xf08a('0x2b')]){delete _0x49555d['name'];}_0x25aa84[_0xf08a('0x1c')](_0x372f93)[_0xf08a('0x2c')](_0x49555d);};}exports[_0xf08a('0x2d')]=function(_0x402ad5,_0x562baf){var _0x4e2929={},_0x568ab8={},_0x5ae37f={'count':0x0,'rows':[]};var _0x1ab77f=_[_0xf08a('0x2e')](db[_0xf08a('0x2f')][_0xf08a('0x30')],function(_0x318055){return{'name':_0x318055['fieldName'],'type':_0x318055[_0xf08a('0x31')][_0xf08a('0x32')]};});_0x568ab8[_0xf08a('0x33')]=_[_0xf08a('0x2e')](_0x1ab77f,_0xf08a('0x2b'));_0x568ab8[_0xf08a('0x34')]=_[_0xf08a('0x35')](_0x402ad5[_0xf08a('0x34')]);_0x568ab8[_0xf08a('0x36')]=_[_0xf08a('0x37')](_0x568ab8[_0xf08a('0x33')],_0x568ab8[_0xf08a('0x34')]);_0x4e2929[_0xf08a('0x38')]=_['intersection'](_0x568ab8[_0xf08a('0x33')],qs['fields'](_0x402ad5[_0xf08a('0x34')][_0xf08a('0x39')]));_0x4e2929[_0xf08a('0x38')]=_0x4e2929[_0xf08a('0x38')][_0xf08a('0x3a')]?_0x4e2929['attributes']:_0x568ab8['model'];if(!_0x402ad5[_0xf08a('0x34')][_0xf08a('0x3b')](_0xf08a('0x3c'))){_0x4e2929[_0xf08a('0x21')]=qs[_0xf08a('0x21')](_0x402ad5[_0xf08a('0x34')][_0xf08a('0x21')]);_0x4e2929[_0xf08a('0x20')]=qs[_0xf08a('0x20')](_0x402ad5[_0xf08a('0x34')]['offset']);}_0x4e2929[_0xf08a('0x3d')]=qs['sort'](_0x402ad5['query'][_0xf08a('0x3e')]);_0x4e2929['where']=qs[_0xf08a('0x36')](_[_0xf08a('0x3f')](_0x402ad5[_0xf08a('0x34')],_0x568ab8[_0xf08a('0x36')]),_0x1ab77f);if(_0x402ad5['query'][_0xf08a('0x40')]){_0x4e2929[_0xf08a('0x41')]=_[_0xf08a('0x42')](_0x4e2929[_0xf08a('0x41')],{'$or':_['map'](_0x1ab77f,function(_0x5a67dc){if(_0x5a67dc[_0xf08a('0x31')]!==_0xf08a('0x43')){var _0xee0ebf={};_0xee0ebf[_0x5a67dc[_0xf08a('0x2b')]]={'$like':'%'+_0x402ad5[_0xf08a('0x34')][_0xf08a('0x40')]+'%'};return _0xee0ebf;}})});}_0x4e2929=_[_0xf08a('0x42')]({},_0x4e2929,_0x402ad5[_0xf08a('0x44')]);var _0x298ef4={'where':_0x4e2929[_0xf08a('0x41')]};return db[_0xf08a('0x2f')][_0xf08a('0x1f')](_0x298ef4)[_0xf08a('0x45')](function(_0x10b327){_0x5ae37f['count']=_0x10b327;if(_0x402ad5[_0xf08a('0x34')][_0xf08a('0x46')]){_0x4e2929[_0xf08a('0x47')]=[{'all':!![]}];}return db[_0xf08a('0x2f')][_0xf08a('0x48')](_0x4e2929);})[_0xf08a('0x45')](function(_0x58285d){_0x5ae37f[_0xf08a('0x49')]=_0x58285d;return _0x5ae37f;})['then'](respondWithFilteredResult(_0x562baf,_0x4e2929))[_0xf08a('0x4a')](handleError(_0x562baf,null));};exports[_0xf08a('0x4b')]=function(_0x296fd3,_0x294a81){var _0x4dbfb3={'raw':![],'where':{'id':_0x296fd3[_0xf08a('0x4c')]['id']}},_0x19e2b3={};_0x19e2b3[_0xf08a('0x33')]=_['keys'](db[_0xf08a('0x2f')]['rawAttributes']);_0x19e2b3[_0xf08a('0x34')]=_[_0xf08a('0x35')](_0x296fd3[_0xf08a('0x34')]);_0x19e2b3[_0xf08a('0x36')]=_[_0xf08a('0x37')](_0x19e2b3[_0xf08a('0x33')],_0x19e2b3['query']);_0x4dbfb3['attributes']=_['intersection'](_0x19e2b3[_0xf08a('0x33')],qs[_0xf08a('0x39')](_0x296fd3['query'][_0xf08a('0x39')]));_0x4dbfb3[_0xf08a('0x38')]=_0x4dbfb3[_0xf08a('0x38')][_0xf08a('0x3a')]?_0x4dbfb3['attributes']:_0x19e2b3[_0xf08a('0x33')];if(_0x296fd3[_0xf08a('0x34')][_0xf08a('0x46')]){_0x4dbfb3[_0xf08a('0x47')]=[{'all':!![]}];}_0x4dbfb3=_[_0xf08a('0x42')]({},_0x4dbfb3,_0x296fd3[_0xf08a('0x44')]);return db['SugarcrmConfiguration'][_0xf08a('0x4d')](_0x4dbfb3)[_0xf08a('0x45')](handleEntityNotFound(_0x294a81,null))['then'](respondWithResult(_0x294a81,null))[_0xf08a('0x4a')](handleError(_0x294a81,null));};exports[_0xf08a('0x4e')]=function(_0x52e143,_0x470fae){return db[_0xf08a('0x2f')]['create'](_0x52e143[_0xf08a('0x4f')],{})[_0xf08a('0x45')](respondWithResult(_0x470fae,0xc9))[_0xf08a('0x4a')](handleError(_0x470fae,null));};exports['update']=function(_0x527847,_0x39669a){if(_0x527847['body']['id']){delete _0x527847[_0xf08a('0x4f')]['id'];}return db[_0xf08a('0x2f')][_0xf08a('0x4d')]({'where':{'id':_0x527847['params']['id']}})[_0xf08a('0x45')](handleEntityNotFound(_0x39669a,null))[_0xf08a('0x45')](saveUpdates(_0x527847[_0xf08a('0x4f')],null))[_0xf08a('0x45')](respondWithResult(_0x39669a,null))[_0xf08a('0x4a')](handleError(_0x39669a,null));};exports[_0xf08a('0x27')]=function(_0x51409d,_0x3c689b){return db[_0xf08a('0x2f')][_0xf08a('0x4d')]({'where':{'id':_0x51409d[_0xf08a('0x4c')]['id']}})[_0xf08a('0x45')](handleEntityNotFound(_0x3c689b,null))[_0xf08a('0x45')](removeEntity(_0x3c689b,null))['catch'](handleError(_0x3c689b,null));};exports[_0xf08a('0x50')]=function(_0x2300a4,_0x220bc8,_0x5b1e19){var _0x2263ae={};var _0x23a7bd={};var _0xb5bb64;var _0x393868;return db['SugarcrmConfiguration'][_0xf08a('0x51')]({'where':{'id':_0x2300a4[_0xf08a('0x4c')]['id']}})[_0xf08a('0x45')](handleEntityNotFound(_0x220bc8,null))[_0xf08a('0x45')](function(_0x293a85){if(_0x293a85){_0xb5bb64=_0x293a85;_0x23a7bd[_0xf08a('0x33')]=_[_0xf08a('0x35')](db[_0xf08a('0x52')]['rawAttributes']);_0x23a7bd['query']=_[_0xf08a('0x35')](_0x2300a4[_0xf08a('0x34')]);_0x23a7bd[_0xf08a('0x36')]=_[_0xf08a('0x37')](_0x23a7bd[_0xf08a('0x33')],_0x23a7bd[_0xf08a('0x34')]);_0x2263ae[_0xf08a('0x38')]=_['intersection'](_0x23a7bd[_0xf08a('0x33')],qs['fields'](_0x2300a4['query'][_0xf08a('0x39')]));_0x2263ae[_0xf08a('0x38')]=_0x2263ae['attributes']['length']?_0x2263ae[_0xf08a('0x38')]:_0x23a7bd[_0xf08a('0x33')];_0x2263ae[_0xf08a('0x3d')]=qs['sort'](_0x2300a4[_0xf08a('0x34')]['sort']);_0x2263ae[_0xf08a('0x41')]=qs[_0xf08a('0x36')](_[_0xf08a('0x3f')](_0x2300a4[_0xf08a('0x34')],_0x23a7bd[_0xf08a('0x36')]));if(_0x2300a4[_0xf08a('0x34')]['filter']){_0x2263ae[_0xf08a('0x41')]=_[_0xf08a('0x42')](_0x2263ae[_0xf08a('0x41')],{'$or':_[_0xf08a('0x2e')](_0x2263ae[_0xf08a('0x38')],function(_0x4360f8){var _0x3dec62={};_0x3dec62[_0x4360f8]={'$like':'%'+_0x2300a4['query'][_0xf08a('0x40')]+'%'};return _0x3dec62;})});}_0x2263ae=_[_0xf08a('0x42')]({},_0x2263ae,_0x2300a4[_0xf08a('0x44')]);return _0xb5bb64['getFields'](_0x2263ae);}})['then'](function(_0x560ab3){if(_0x560ab3){_0x393868=_0x560ab3['length'];if(!_0x2300a4[_0xf08a('0x34')][_0xf08a('0x3b')](_0xf08a('0x3c'))){_0x2263ae[_0xf08a('0x21')]=qs['limit'](_0x2300a4[_0xf08a('0x34')][_0xf08a('0x21')]);_0x2263ae[_0xf08a('0x20')]=qs[_0xf08a('0x20')](_0x2300a4[_0xf08a('0x34')]['offset']);}return _0xb5bb64[_0xf08a('0x50')](_0x2263ae);}})['then'](function(_0x452de5){if(_0x452de5){return _0x452de5?{'count':_0x393868,'rows':_0x452de5}:null;}})[_0xf08a('0x45')](respondWithResult(_0x220bc8,null))['catch'](handleError(_0x220bc8,null));};exports[_0xf08a('0x53')]=function(_0x1ced94,_0x3e9fd1,_0x1f9f27){var _0xb3878d={};var _0x27095c={};var _0x3996ec;var _0x4c6be1;return db[_0xf08a('0x2f')]['findOne']({'where':{'id':_0x1ced94[_0xf08a('0x4c')]['id']}})[_0xf08a('0x45')](handleEntityNotFound(_0x3e9fd1,null))[_0xf08a('0x45')](function(_0x4a7d5b){if(_0x4a7d5b){_0x3996ec=_0x4a7d5b;_0x27095c[_0xf08a('0x33')]=_[_0xf08a('0x35')](db['SugarcrmField'][_0xf08a('0x30')]);_0x27095c[_0xf08a('0x34')]=_['keys'](_0x1ced94[_0xf08a('0x34')]);_0x27095c['filters']=_[_0xf08a('0x37')](_0x27095c[_0xf08a('0x33')],_0x27095c[_0xf08a('0x34')]);_0xb3878d[_0xf08a('0x38')]=_[_0xf08a('0x37')](_0x27095c['model'],qs[_0xf08a('0x39')](_0x1ced94[_0xf08a('0x34')][_0xf08a('0x39')]));_0xb3878d[_0xf08a('0x38')]=_0xb3878d['attributes']['length']?_0xb3878d[_0xf08a('0x38')]:_0x27095c['model'];_0xb3878d[_0xf08a('0x3d')]=qs[_0xf08a('0x3e')](_0x1ced94[_0xf08a('0x34')][_0xf08a('0x3e')]);_0xb3878d[_0xf08a('0x41')]=qs[_0xf08a('0x36')](_[_0xf08a('0x3f')](_0x1ced94[_0xf08a('0x34')],_0x27095c['filters']));if(_0x1ced94[_0xf08a('0x34')][_0xf08a('0x40')]){_0xb3878d[_0xf08a('0x41')]=_['merge'](_0xb3878d[_0xf08a('0x41')],{'$or':_['map'](_0xb3878d[_0xf08a('0x38')],function(_0x14d3da){var _0x2174b0={};_0x2174b0[_0x14d3da]={'$like':'%'+_0x1ced94[_0xf08a('0x34')][_0xf08a('0x40')]+'%'};return _0x2174b0;})});}_0xb3878d=_['merge']({},_0xb3878d,_0x1ced94[_0xf08a('0x44')]);return _0x3996ec[_0xf08a('0x53')](_0xb3878d);}})[_0xf08a('0x45')](function(_0xc5d122){if(_0xc5d122){_0x4c6be1=_0xc5d122[_0xf08a('0x3a')];if(!_0x1ced94['query'][_0xf08a('0x3b')](_0xf08a('0x3c'))){_0xb3878d[_0xf08a('0x21')]=qs[_0xf08a('0x21')](_0x1ced94['query'][_0xf08a('0x21')]);_0xb3878d[_0xf08a('0x20')]=qs[_0xf08a('0x20')](_0x1ced94[_0xf08a('0x34')]['offset']);}return _0x3996ec['getSubjects'](_0xb3878d);}})[_0xf08a('0x45')](function(_0x33e165){if(_0x33e165){return _0x33e165?{'count':_0x4c6be1,'rows':_0x33e165}:null;}})[_0xf08a('0x45')](respondWithResult(_0x3e9fd1,null))['catch'](handleError(_0x3e9fd1,null));};exports[_0xf08a('0x54')]=function(_0x11a470,_0xb6be41,_0x17229){var _0x54a0e7={};var _0x3f1497={};var _0x5c9a28;var _0x262b0e;return db['SugarcrmConfiguration'][_0xf08a('0x51')]({'where':{'id':_0x11a470[_0xf08a('0x4c')]['id']}})[_0xf08a('0x45')](handleEntityNotFound(_0xb6be41,null))[_0xf08a('0x45')](function(_0x59ac46){if(_0x59ac46){_0x5c9a28=_0x59ac46;_0x3f1497['model']=_['keys'](db[_0xf08a('0x52')][_0xf08a('0x30')]);_0x3f1497['query']=_[_0xf08a('0x35')](_0x11a470[_0xf08a('0x34')]);_0x3f1497[_0xf08a('0x36')]=_[_0xf08a('0x37')](_0x3f1497[_0xf08a('0x33')],_0x3f1497[_0xf08a('0x34')]);_0x54a0e7[_0xf08a('0x38')]=_[_0xf08a('0x37')](_0x3f1497[_0xf08a('0x33')],qs[_0xf08a('0x39')](_0x11a470[_0xf08a('0x34')][_0xf08a('0x39')]));_0x54a0e7[_0xf08a('0x38')]=_0x54a0e7['attributes']['length']?_0x54a0e7[_0xf08a('0x38')]:_0x3f1497[_0xf08a('0x33')];_0x54a0e7[_0xf08a('0x3d')]=qs[_0xf08a('0x3e')](_0x11a470['query'][_0xf08a('0x3e')]);_0x54a0e7['where']=qs['filters'](_[_0xf08a('0x3f')](_0x11a470[_0xf08a('0x34')],_0x3f1497['filters']));if(_0x11a470[_0xf08a('0x34')][_0xf08a('0x40')]){_0x54a0e7['where']=_[_0xf08a('0x42')](_0x54a0e7[_0xf08a('0x41')],{'$or':_[_0xf08a('0x2e')](_0x54a0e7[_0xf08a('0x38')],function(_0x125523){var _0x11a66b={};_0x11a66b[_0x125523]={'$like':'%'+_0x11a470[_0xf08a('0x34')][_0xf08a('0x40')]+'%'};return _0x11a66b;})});}_0x54a0e7=_[_0xf08a('0x42')]({},_0x54a0e7,_0x11a470[_0xf08a('0x44')]);return _0x5c9a28[_0xf08a('0x54')](_0x54a0e7);}})[_0xf08a('0x45')](function(_0x3858b4){if(_0x3858b4){_0x262b0e=_0x3858b4[_0xf08a('0x3a')];if(!_0x11a470[_0xf08a('0x34')][_0xf08a('0x3b')](_0xf08a('0x3c'))){_0x54a0e7[_0xf08a('0x21')]=qs[_0xf08a('0x21')](_0x11a470[_0xf08a('0x34')]['limit']);_0x54a0e7[_0xf08a('0x20')]=qs[_0xf08a('0x20')](_0x11a470[_0xf08a('0x34')][_0xf08a('0x20')]);}return _0x5c9a28[_0xf08a('0x54')](_0x54a0e7);}})[_0xf08a('0x45')](function(_0x5c2043){if(_0x5c2043){return _0x5c2043?{'count':_0x262b0e,'rows':_0x5c2043}:null;}})['then'](respondWithResult(_0xb6be41,null))['catch'](handleError(_0xb6be41,null));}; \ No newline at end of file +var _0x5cc7=['SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','SugarcrmField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','apply','reject','save','destroy','stack','name','index','map'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x5cc7,0x76));var _0x75cc=function(_0x115191,_0x655a2){_0x115191=_0x115191-0x0;var _0x4b7af1=_0x5cc7[_0x115191];return _0x4b7af1;};'use strict';var emlformat=require(_0x75cc('0x0'));var rimraf=require(_0x75cc('0x1'));var zipdir=require(_0x75cc('0x2'));var jsonpatch=require(_0x75cc('0x3'));var rp=require(_0x75cc('0x4'));var moment=require(_0x75cc('0x5'));var BPromise=require(_0x75cc('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x75cc('0x7'));var sox=require(_0x75cc('0x8'));var csv=require('to-csv');var ejs=require(_0x75cc('0x9'));var fs=require('fs');var fs_extra=require(_0x75cc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x75cc('0xb'));var jsforce=require(_0x75cc('0xc'));var deskjs=require(_0x75cc('0xd'));var toCsv=require(_0x75cc('0xe'));var querystring=require('querystring');var Papa=require(_0x75cc('0xf'));var Redis=require(_0x75cc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x75cc('0x11'));var as=require(_0x75cc('0x12'));var hardwareService=require(_0x75cc('0x13'));var logger=require(_0x75cc('0x14'))(_0x75cc('0x15'));var utils=require(_0x75cc('0x16'));var config=require(_0x75cc('0x17'));var licenseUtil=require(_0x75cc('0x18'));var db=require(_0x75cc('0x19'))['db'];function respondWithStatusCode(_0x525666,_0x539139){_0x539139=_0x539139||0xcc;return function(_0x340e08){if(_0x340e08){return _0x525666[_0x75cc('0x1a')](_0x539139);}return _0x525666['status'](_0x539139)[_0x75cc('0x1b')]();};}function respondWithResult(_0x499422,_0x2cb870){_0x2cb870=_0x2cb870||0xc8;return function(_0x6a863c){if(_0x6a863c){return _0x499422[_0x75cc('0x1c')](_0x2cb870)[_0x75cc('0x1d')](_0x6a863c);}};}function respondWithFilteredResult(_0x202bad,_0x426827){return function(_0x1ac8e5){if(_0x1ac8e5){var _0x967e46=typeof _0x426827['offset']===_0x75cc('0x1e')&&typeof _0x426827[_0x75cc('0x1f')]===_0x75cc('0x1e');var _0x381951=_0x1ac8e5[_0x75cc('0x20')];var _0x5dbed5=_0x967e46?0x0:_0x426827[_0x75cc('0x21')];var _0x56c542=_0x967e46?_0x1ac8e5[_0x75cc('0x20')]:_0x426827[_0x75cc('0x21')]+_0x426827[_0x75cc('0x1f')];var _0x467864;if(_0x56c542>=_0x381951){_0x56c542=_0x381951;_0x467864=0xc8;}else{_0x467864=0xce;}_0x202bad[_0x75cc('0x1c')](_0x467864);return _0x202bad['set']('Content-Range',_0x5dbed5+'-'+_0x56c542+'/'+_0x381951)['json'](_0x1ac8e5);}return null;};}function patchUpdates(_0x2e3a40){return function(_0x2a3514){try{jsonpatch[_0x75cc('0x22')](_0x2a3514,_0x2e3a40,!![]);}catch(_0x8139b){return BPromise[_0x75cc('0x23')](_0x8139b);}return _0x2a3514[_0x75cc('0x24')]();};}function saveUpdates(_0x3f9e37,_0x2a93cd){return function(_0x4ade08){if(_0x4ade08){return _0x4ade08['update'](_0x3f9e37)['then'](function(_0xb868ef){return _0xb868ef;});}return null;};}function removeEntity(_0x353684,_0x1fff8f){return function(_0x4c0980){if(_0x4c0980){return _0x4c0980[_0x75cc('0x25')]()['then'](function(){_0x353684[_0x75cc('0x1c')](0xcc)[_0x75cc('0x1b')]();});}};}function handleEntityNotFound(_0x730815,_0x3b7976){return function(_0x551f0d){if(!_0x551f0d){_0x730815[_0x75cc('0x1a')](0x194);}return _0x551f0d;};}function handleError(_0x3d7434,_0x12ed79){_0x12ed79=_0x12ed79||0x1f4;return function(_0x12792e){logger['error'](_0x12792e[_0x75cc('0x26')]);if(_0x12792e[_0x75cc('0x27')]){delete _0x12792e[_0x75cc('0x27')];}_0x3d7434[_0x75cc('0x1c')](_0x12ed79)['send'](_0x12792e);};}exports[_0x75cc('0x28')]=function(_0x520b51,_0xd10aef){var _0x285252={},_0x437d40={},_0x3e3676={'count':0x0,'rows':[]};var _0x23a23b=_[_0x75cc('0x29')](db[_0x75cc('0x2a')][_0x75cc('0x2b')],function(_0x3b1d1f){return{'name':_0x3b1d1f[_0x75cc('0x2c')],'type':_0x3b1d1f[_0x75cc('0x2d')][_0x75cc('0x2e')]};});_0x437d40[_0x75cc('0x2f')]=_[_0x75cc('0x29')](_0x23a23b,_0x75cc('0x27'));_0x437d40[_0x75cc('0x30')]=_[_0x75cc('0x31')](_0x520b51[_0x75cc('0x30')]);_0x437d40[_0x75cc('0x32')]=_[_0x75cc('0x33')](_0x437d40['model'],_0x437d40['query']);_0x285252[_0x75cc('0x34')]=_[_0x75cc('0x33')](_0x437d40[_0x75cc('0x2f')],qs[_0x75cc('0x35')](_0x520b51[_0x75cc('0x30')][_0x75cc('0x35')]));_0x285252[_0x75cc('0x34')]=_0x285252[_0x75cc('0x34')][_0x75cc('0x36')]?_0x285252[_0x75cc('0x34')]:_0x437d40[_0x75cc('0x2f')];if(!_0x520b51[_0x75cc('0x30')][_0x75cc('0x37')](_0x75cc('0x38'))){_0x285252['limit']=qs[_0x75cc('0x1f')](_0x520b51[_0x75cc('0x30')][_0x75cc('0x1f')]);_0x285252[_0x75cc('0x21')]=qs[_0x75cc('0x21')](_0x520b51[_0x75cc('0x30')][_0x75cc('0x21')]);}_0x285252[_0x75cc('0x39')]=qs[_0x75cc('0x3a')](_0x520b51[_0x75cc('0x30')][_0x75cc('0x3a')]);_0x285252[_0x75cc('0x3b')]=qs[_0x75cc('0x32')](_['pick'](_0x520b51['query'],_0x437d40[_0x75cc('0x32')]),_0x23a23b);if(_0x520b51['query'][_0x75cc('0x3c')]){_0x285252['where']=_[_0x75cc('0x3d')](_0x285252[_0x75cc('0x3b')],{'$or':_[_0x75cc('0x29')](_0x23a23b,function(_0x20c902){if(_0x20c902[_0x75cc('0x2d')]!==_0x75cc('0x3e')){var _0x12a557={};_0x12a557[_0x20c902[_0x75cc('0x27')]]={'$like':'%'+_0x520b51[_0x75cc('0x30')][_0x75cc('0x3c')]+'%'};return _0x12a557;}})});}_0x285252=_['merge']({},_0x285252,_0x520b51[_0x75cc('0x3f')]);var _0xc0ddb={'where':_0x285252[_0x75cc('0x3b')]};return db[_0x75cc('0x2a')][_0x75cc('0x20')](_0xc0ddb)[_0x75cc('0x40')](function(_0x29567c){_0x3e3676[_0x75cc('0x20')]=_0x29567c;if(_0x520b51[_0x75cc('0x30')][_0x75cc('0x41')]){_0x285252[_0x75cc('0x42')]=[{'all':!![]}];}return db[_0x75cc('0x2a')][_0x75cc('0x43')](_0x285252);})[_0x75cc('0x40')](function(_0x4fcff9){_0x3e3676[_0x75cc('0x44')]=_0x4fcff9;return _0x3e3676;})[_0x75cc('0x40')](respondWithFilteredResult(_0xd10aef,_0x285252))[_0x75cc('0x45')](handleError(_0xd10aef,null));};exports['show']=function(_0x2213f0,_0x1cc5a0){var _0x1c27b0={'raw':![],'where':{'id':_0x2213f0[_0x75cc('0x46')]['id']}},_0x4402fe={};_0x4402fe['model']=_[_0x75cc('0x31')](db[_0x75cc('0x2a')][_0x75cc('0x2b')]);_0x4402fe[_0x75cc('0x30')]=_[_0x75cc('0x31')](_0x2213f0[_0x75cc('0x30')]);_0x4402fe[_0x75cc('0x32')]=_['intersection'](_0x4402fe[_0x75cc('0x2f')],_0x4402fe[_0x75cc('0x30')]);_0x1c27b0['attributes']=_[_0x75cc('0x33')](_0x4402fe['model'],qs[_0x75cc('0x35')](_0x2213f0['query'][_0x75cc('0x35')]));_0x1c27b0[_0x75cc('0x34')]=_0x1c27b0['attributes'][_0x75cc('0x36')]?_0x1c27b0[_0x75cc('0x34')]:_0x4402fe[_0x75cc('0x2f')];if(_0x2213f0['query'][_0x75cc('0x41')]){_0x1c27b0['include']=[{'all':!![]}];}_0x1c27b0=_[_0x75cc('0x3d')]({},_0x1c27b0,_0x2213f0[_0x75cc('0x3f')]);return db[_0x75cc('0x2a')][_0x75cc('0x47')](_0x1c27b0)[_0x75cc('0x40')](handleEntityNotFound(_0x1cc5a0,null))[_0x75cc('0x40')](respondWithResult(_0x1cc5a0,null))['catch'](handleError(_0x1cc5a0,null));};exports['create']=function(_0x2e4588,_0xa8e8ef){return db['SugarcrmConfiguration'][_0x75cc('0x48')](_0x2e4588[_0x75cc('0x49')],{})[_0x75cc('0x40')](respondWithResult(_0xa8e8ef,0xc9))['catch'](handleError(_0xa8e8ef,null));};exports['update']=function(_0x486568,_0x587d6f){if(_0x486568[_0x75cc('0x49')]['id']){delete _0x486568[_0x75cc('0x49')]['id'];}return db[_0x75cc('0x2a')][_0x75cc('0x47')]({'where':{'id':_0x486568[_0x75cc('0x46')]['id']}})[_0x75cc('0x40')](handleEntityNotFound(_0x587d6f,null))[_0x75cc('0x40')](saveUpdates(_0x486568[_0x75cc('0x49')],null))[_0x75cc('0x40')](respondWithResult(_0x587d6f,null))[_0x75cc('0x45')](handleError(_0x587d6f,null));};exports['destroy']=function(_0x474aea,_0x3f19e4){return db[_0x75cc('0x2a')][_0x75cc('0x47')]({'where':{'id':_0x474aea[_0x75cc('0x46')]['id']}})[_0x75cc('0x40')](handleEntityNotFound(_0x3f19e4,null))[_0x75cc('0x40')](removeEntity(_0x3f19e4,null))[_0x75cc('0x45')](handleError(_0x3f19e4,null));};exports[_0x75cc('0x4a')]=function(_0x31e229,_0x50426c,_0x48bc19){var _0x20f6da={};var _0x41ad5d={};var _0x540f2a;var _0x11a237;return db[_0x75cc('0x2a')][_0x75cc('0x4b')]({'where':{'id':_0x31e229[_0x75cc('0x46')]['id']}})['then'](handleEntityNotFound(_0x50426c,null))[_0x75cc('0x40')](function(_0x33a8aa){if(_0x33a8aa){_0x540f2a=_0x33a8aa;_0x41ad5d[_0x75cc('0x2f')]=_[_0x75cc('0x31')](db[_0x75cc('0x4c')][_0x75cc('0x2b')]);_0x41ad5d[_0x75cc('0x30')]=_[_0x75cc('0x31')](_0x31e229[_0x75cc('0x30')]);_0x41ad5d['filters']=_[_0x75cc('0x33')](_0x41ad5d['model'],_0x41ad5d[_0x75cc('0x30')]);_0x20f6da[_0x75cc('0x34')]=_['intersection'](_0x41ad5d[_0x75cc('0x2f')],qs['fields'](_0x31e229[_0x75cc('0x30')][_0x75cc('0x35')]));_0x20f6da[_0x75cc('0x34')]=_0x20f6da['attributes'][_0x75cc('0x36')]?_0x20f6da['attributes']:_0x41ad5d[_0x75cc('0x2f')];_0x20f6da[_0x75cc('0x39')]=qs[_0x75cc('0x3a')](_0x31e229[_0x75cc('0x30')][_0x75cc('0x3a')]);_0x20f6da[_0x75cc('0x3b')]=qs[_0x75cc('0x32')](_[_0x75cc('0x4d')](_0x31e229['query'],_0x41ad5d[_0x75cc('0x32')]));if(_0x31e229[_0x75cc('0x30')][_0x75cc('0x3c')]){_0x20f6da[_0x75cc('0x3b')]=_[_0x75cc('0x3d')](_0x20f6da[_0x75cc('0x3b')],{'$or':_['map'](_0x20f6da[_0x75cc('0x34')],function(_0xc311c3){var _0x426973={};_0x426973[_0xc311c3]={'$like':'%'+_0x31e229['query'][_0x75cc('0x3c')]+'%'};return _0x426973;})});}_0x20f6da=_[_0x75cc('0x3d')]({},_0x20f6da,_0x31e229['options']);return _0x540f2a[_0x75cc('0x4a')](_0x20f6da);}})[_0x75cc('0x40')](function(_0x43cc66){if(_0x43cc66){_0x11a237=_0x43cc66[_0x75cc('0x36')];if(!_0x31e229[_0x75cc('0x30')]['hasOwnProperty']('nolimit')){_0x20f6da[_0x75cc('0x1f')]=qs[_0x75cc('0x1f')](_0x31e229[_0x75cc('0x30')]['limit']);_0x20f6da[_0x75cc('0x21')]=qs['offset'](_0x31e229[_0x75cc('0x30')][_0x75cc('0x21')]);}return _0x540f2a[_0x75cc('0x4a')](_0x20f6da);}})[_0x75cc('0x40')](function(_0x1a6f1f){if(_0x1a6f1f){return _0x1a6f1f?{'count':_0x11a237,'rows':_0x1a6f1f}:null;}})[_0x75cc('0x40')](respondWithResult(_0x50426c,null))['catch'](handleError(_0x50426c,null));};exports[_0x75cc('0x4e')]=function(_0x4a6e62,_0x21cf38,_0x3521c9){var _0x271b7c={};var _0x2b2972={};var _0x4c3405;var _0x138a02;return db[_0x75cc('0x2a')][_0x75cc('0x4b')]({'where':{'id':_0x4a6e62[_0x75cc('0x46')]['id']}})[_0x75cc('0x40')](handleEntityNotFound(_0x21cf38,null))['then'](function(_0x299ebe){if(_0x299ebe){_0x4c3405=_0x299ebe;_0x2b2972[_0x75cc('0x2f')]=_[_0x75cc('0x31')](db['SugarcrmField'][_0x75cc('0x2b')]);_0x2b2972[_0x75cc('0x30')]=_[_0x75cc('0x31')](_0x4a6e62[_0x75cc('0x30')]);_0x2b2972[_0x75cc('0x32')]=_[_0x75cc('0x33')](_0x2b2972[_0x75cc('0x2f')],_0x2b2972[_0x75cc('0x30')]);_0x271b7c['attributes']=_[_0x75cc('0x33')](_0x2b2972[_0x75cc('0x2f')],qs['fields'](_0x4a6e62['query'][_0x75cc('0x35')]));_0x271b7c[_0x75cc('0x34')]=_0x271b7c[_0x75cc('0x34')][_0x75cc('0x36')]?_0x271b7c[_0x75cc('0x34')]:_0x2b2972[_0x75cc('0x2f')];_0x271b7c[_0x75cc('0x39')]=qs[_0x75cc('0x3a')](_0x4a6e62[_0x75cc('0x30')][_0x75cc('0x3a')]);_0x271b7c[_0x75cc('0x3b')]=qs[_0x75cc('0x32')](_[_0x75cc('0x4d')](_0x4a6e62[_0x75cc('0x30')],_0x2b2972[_0x75cc('0x32')]));if(_0x4a6e62[_0x75cc('0x30')][_0x75cc('0x3c')]){_0x271b7c[_0x75cc('0x3b')]=_[_0x75cc('0x3d')](_0x271b7c['where'],{'$or':_[_0x75cc('0x29')](_0x271b7c[_0x75cc('0x34')],function(_0x1d5441){var _0xd99eb3={};_0xd99eb3[_0x1d5441]={'$like':'%'+_0x4a6e62[_0x75cc('0x30')][_0x75cc('0x3c')]+'%'};return _0xd99eb3;})});}_0x271b7c=_[_0x75cc('0x3d')]({},_0x271b7c,_0x4a6e62[_0x75cc('0x3f')]);return _0x4c3405[_0x75cc('0x4e')](_0x271b7c);}})[_0x75cc('0x40')](function(_0x136c8e){if(_0x136c8e){_0x138a02=_0x136c8e[_0x75cc('0x36')];if(!_0x4a6e62[_0x75cc('0x30')][_0x75cc('0x37')](_0x75cc('0x38'))){_0x271b7c[_0x75cc('0x1f')]=qs[_0x75cc('0x1f')](_0x4a6e62[_0x75cc('0x30')]['limit']);_0x271b7c['offset']=qs['offset'](_0x4a6e62[_0x75cc('0x30')][_0x75cc('0x21')]);}return _0x4c3405[_0x75cc('0x4e')](_0x271b7c);}})['then'](function(_0xfdb862){if(_0xfdb862){return _0xfdb862?{'count':_0x138a02,'rows':_0xfdb862}:null;}})[_0x75cc('0x40')](respondWithResult(_0x21cf38,null))[_0x75cc('0x45')](handleError(_0x21cf38,null));};exports[_0x75cc('0x4f')]=function(_0x42ec3f,_0x64cdb9,_0x55f03d){var _0x18fe83={};var _0xd80eb9={};var _0x7030ed;var _0x5a3045;return db[_0x75cc('0x2a')][_0x75cc('0x4b')]({'where':{'id':_0x42ec3f[_0x75cc('0x46')]['id']}})['then'](handleEntityNotFound(_0x64cdb9,null))[_0x75cc('0x40')](function(_0x1d8a05){if(_0x1d8a05){_0x7030ed=_0x1d8a05;_0xd80eb9['model']=_[_0x75cc('0x31')](db['SugarcrmField'][_0x75cc('0x2b')]);_0xd80eb9['query']=_[_0x75cc('0x31')](_0x42ec3f[_0x75cc('0x30')]);_0xd80eb9[_0x75cc('0x32')]=_[_0x75cc('0x33')](_0xd80eb9['model'],_0xd80eb9[_0x75cc('0x30')]);_0x18fe83['attributes']=_[_0x75cc('0x33')](_0xd80eb9[_0x75cc('0x2f')],qs[_0x75cc('0x35')](_0x42ec3f[_0x75cc('0x30')][_0x75cc('0x35')]));_0x18fe83['attributes']=_0x18fe83[_0x75cc('0x34')][_0x75cc('0x36')]?_0x18fe83[_0x75cc('0x34')]:_0xd80eb9[_0x75cc('0x2f')];_0x18fe83[_0x75cc('0x39')]=qs[_0x75cc('0x3a')](_0x42ec3f[_0x75cc('0x30')]['sort']);_0x18fe83[_0x75cc('0x3b')]=qs['filters'](_[_0x75cc('0x4d')](_0x42ec3f[_0x75cc('0x30')],_0xd80eb9['filters']));if(_0x42ec3f[_0x75cc('0x30')][_0x75cc('0x3c')]){_0x18fe83[_0x75cc('0x3b')]=_['merge'](_0x18fe83[_0x75cc('0x3b')],{'$or':_['map'](_0x18fe83['attributes'],function(_0x226af3){var _0x26cf7c={};_0x26cf7c[_0x226af3]={'$like':'%'+_0x42ec3f[_0x75cc('0x30')]['filter']+'%'};return _0x26cf7c;})});}_0x18fe83=_[_0x75cc('0x3d')]({},_0x18fe83,_0x42ec3f['options']);return _0x7030ed['getDescriptions'](_0x18fe83);}})[_0x75cc('0x40')](function(_0x22e843){if(_0x22e843){_0x5a3045=_0x22e843['length'];if(!_0x42ec3f['query'][_0x75cc('0x37')](_0x75cc('0x38'))){_0x18fe83[_0x75cc('0x1f')]=qs[_0x75cc('0x1f')](_0x42ec3f[_0x75cc('0x30')]['limit']);_0x18fe83[_0x75cc('0x21')]=qs[_0x75cc('0x21')](_0x42ec3f['query']['offset']);}return _0x7030ed[_0x75cc('0x4f')](_0x18fe83);}})[_0x75cc('0x40')](function(_0x356f62){if(_0x356f62){return _0x356f62?{'count':_0x5a3045,'rows':_0x356f62}:null;}})['then'](respondWithResult(_0x64cdb9,null))[_0x75cc('0x45')](handleError(_0x64cdb9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 5345171..850c572 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 _0x0f71=['./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x501035,_0x3c1742){var _0x4dd166=function(_0x2679d3){while(--_0x2679d3){_0x501035['push'](_0x501035['shift']());}};_0x4dd166(++_0x3c1742);}(_0x0f71,0x89));var _0x10f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f71[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x10f7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x10f7('0x1'));var moment=require(_0x10f7('0x2'));var BPromise=require(_0x10f7('0x3'));var rp=require(_0x10f7('0x4'));var fs=require('fs');var path=require(_0x10f7('0x5'));var rimraf=require(_0x10f7('0x6'));var config=require('../../config/environment');var attributes=require(_0x10f7('0x7'));module[_0x10f7('0x8')]=function(_0x3e8435,_0x24810e){return _0x3e8435[_0x10f7('0x9')](_0x10f7('0xa'),attributes,{'tableName':_0x10f7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x395d=['util','request-promise','path','rimraf','../../config/environment','define','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x395d,0x1a8));var _0xd395=function(_0x4caa71,_0x258a33){_0x4caa71=_0x4caa71-0x0;var _0x3ed75b=_0x395d[_0x4caa71];return _0x3ed75b;};'use strict';var _=require('lodash');var util=require(_0xd395('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd395('0x1'));var fs=require('fs');var path=require(_0xd395('0x2'));var rimraf=require(_0xd395('0x3'));var config=require(_0xd395('0x4'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x1d0ebf,_0x5465cb){return _0x1d0ebf[_0xd395('0x5')](_0xd395('0x6'),attributes,{'tableName':_0xd395('0x7'),'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 ac76338..340e83c 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 _0x2145=['rpc','../../config/environment','jayson/promise','client','then','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x2c3255,_0x4e00ae){var _0x282aba=function(_0x5721d5){while(--_0x5721d5){_0x2c3255['push'](_0x2c3255['shift']());}};_0x282aba(++_0x4e00ae);}(_0x2145,0x105));var _0x5214=function(_0x55696b,_0x144dea){_0x55696b=_0x55696b-0x0;var _0x25215c=_0x2145[_0x55696b];return _0x25215c;};'use strict';var _=require(_0x5214('0x0'));var util=require('util');var moment=require(_0x5214('0x1'));var BPromise=require('bluebird');var rs=require(_0x5214('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5214('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5214('0x4'))(_0x5214('0x5'));var config=require(_0x5214('0x6'));var jayson=require(_0x5214('0x7'));var client=jayson[_0x5214('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3342c0,_0x224523,_0x8c2496){return new BPromise(function(_0x5b10bd,_0x4d625d){return client['request'](_0x3342c0,_0x8c2496)[_0x5214('0x9')](function(_0x35533c){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x224523,_0x5214('0xa'));logger['debug'](_0x5214('0xb'),_0x224523,_0x5214('0xa'),JSON['stringify'](_0x35533c));if(_0x35533c[_0x5214('0xc')]){if(_0x35533c[_0x5214('0xc')][_0x5214('0xd')]===0x1f4){logger[_0x5214('0xc')](_0x5214('0xe'),_0x224523,_0x35533c['error'][_0x5214('0xf')]);return _0x4d625d(_0x35533c[_0x5214('0xc')][_0x5214('0xf')]);}logger[_0x5214('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x224523,_0x35533c[_0x5214('0xc')][_0x5214('0xf')]);return _0x5b10bd(_0x35533c[_0x5214('0xc')][_0x5214('0xf')]);}else{logger[_0x5214('0x10')](_0x5214('0xe'),_0x224523,_0x5214('0xa'));_0x5b10bd(_0x35533c[_0x5214('0x11')][_0x5214('0xf')]);}})[_0x5214('0x12')](function(_0x3d95f5){logger[_0x5214('0xc')](_0x5214('0xe'),_0x224523,_0x3d95f5);_0x4d625d(_0x3d95f5);});});} \ No newline at end of file +var _0x9cb0=['randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1338a1,_0x546a1f){var _0x26c201=function(_0x22544a){while(--_0x22544a){_0x1338a1['push'](_0x1338a1['shift']());}};_0x26c201(++_0x546a1f);}(_0x9cb0,0x114));var _0x09cb=function(_0x45b625,_0x165113){_0x45b625=_0x45b625-0x0;var _0x2a1e5c=_0x9cb0[_0x45b625];return _0x2a1e5c;};'use strict';var _=require(_0x09cb('0x0'));var util=require(_0x09cb('0x1'));var moment=require(_0x09cb('0x2'));var BPromise=require(_0x09cb('0x3'));var rs=require(_0x09cb('0x4'));var fs=require('fs');var Redis=require(_0x09cb('0x5'));var db=require(_0x09cb('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x09cb('0x7'));var jayson=require(_0x09cb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5471ae,_0x1bd5d9,_0x48c04d){return new BPromise(function(_0x138e08,_0x582b9d){return client[_0x09cb('0x9')](_0x5471ae,_0x48c04d)[_0x09cb('0xa')](function(_0x5627bc){logger[_0x09cb('0xb')](_0x09cb('0xc'),_0x1bd5d9,'request\x20sent');logger[_0x09cb('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x1bd5d9,_0x09cb('0xe'),JSON['stringify'](_0x5627bc));if(_0x5627bc[_0x09cb('0xf')]){if(_0x5627bc[_0x09cb('0xf')][_0x09cb('0x10')]===0x1f4){logger[_0x09cb('0xf')](_0x09cb('0xc'),_0x1bd5d9,_0x5627bc['error'][_0x09cb('0x11')]);return _0x582b9d(_0x5627bc[_0x09cb('0xf')][_0x09cb('0x11')]);}logger[_0x09cb('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1bd5d9,_0x5627bc[_0x09cb('0xf')][_0x09cb('0x11')]);return _0x138e08(_0x5627bc[_0x09cb('0xf')][_0x09cb('0x11')]);}else{logger[_0x09cb('0xb')](_0x09cb('0xc'),_0x1bd5d9,_0x09cb('0xe'));_0x138e08(_0x5627bc[_0x09cb('0x12')][_0x09cb('0x11')]);}})[_0x09cb('0x13')](function(_0x43ce70){logger[_0x09cb('0xf')](_0x09cb('0xc'),_0x1bd5d9,_0x43ce70);_0x582b9d(_0x43ce70);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index f511ef1..df76cf8 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 _0xa357=['destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x543410,_0x459093){var _0x4f26ac=function(_0x207f52){while(--_0x207f52){_0x543410['push'](_0x543410['shift']());}};_0x4f26ac(++_0x459093);}(_0xa357,0x134));var _0x7a35=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xa357[_0x1d87fc];return _0x492b56;};'use strict';var multer=require(_0x7a35('0x0'));var util=require('util');var path=require(_0x7a35('0x1'));var timeout=require('connect-timeout');var express=require(_0x7a35('0x2'));var router=express['Router']();var fs_extra=require(_0x7a35('0x3'));var auth=require(_0x7a35('0x4'));var interaction=require(_0x7a35('0x5'));var config=require('../../config/environment');var controller=require(_0x7a35('0x6'));router[_0x7a35('0x7')]('/',auth[_0x7a35('0x8')](),controller[_0x7a35('0x9')]);router[_0x7a35('0x7')](_0x7a35('0xa'),auth[_0x7a35('0x8')](),controller[_0x7a35('0xb')]);router[_0x7a35('0xc')]('/',auth[_0x7a35('0x8')](),controller['create']);router[_0x7a35('0xd')](_0x7a35('0xa'),auth[_0x7a35('0x8')](),controller[_0x7a35('0xe')]);router[_0x7a35('0xf')](_0x7a35('0xa'),auth[_0x7a35('0x8')](),controller[_0x7a35('0x10')]);module[_0x7a35('0x11')]=router; \ No newline at end of file +var _0x5436=['put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','create'];(function(_0x4c0692,_0x47fc15){var _0x293e50=function(_0x9278af){while(--_0x9278af){_0x4c0692['push'](_0x4c0692['shift']());}};_0x293e50(++_0x47fc15);}(_0x5436,0x1c6));var _0x6543=function(_0x1d292b,_0x55c638){_0x1d292b=_0x1d292b-0x0;var _0x6e8a54=_0x5436[_0x1d292b];return _0x6e8a54;};'use strict';var multer=require(_0x6543('0x0'));var util=require(_0x6543('0x1'));var path=require(_0x6543('0x2'));var timeout=require(_0x6543('0x3'));var express=require('express');var router=express[_0x6543('0x4')]();var fs_extra=require(_0x6543('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6543('0x6'));var config=require(_0x6543('0x7'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth[_0x6543('0x8')](),controller['index']);router[_0x6543('0x9')](_0x6543('0xa'),auth[_0x6543('0x8')](),controller[_0x6543('0xb')]);router[_0x6543('0xc')]('/',auth[_0x6543('0x8')](),controller[_0x6543('0xd')]);router[_0x6543('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6543('0xf')]('/:id',auth[_0x6543('0x8')](),controller[_0x6543('0x10')]);module[_0x6543('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 93164c2..a1cc73d 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 _0xb5c6=['sequelize','exports','ENUM','variable','keyValue','picklist','STRING'];(function(_0x28fd53,_0x56721e){var _0x231642=function(_0xbaef52){while(--_0xbaef52){_0x28fd53['push'](_0x28fd53['shift']());}};_0x231642(++_0x56721e);}(_0xb5c6,0xcb));var _0x6b5c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb5c6[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x6b5c('0x0'));module[_0x6b5c('0x1')]={'type':{'type':Sequelize[_0x6b5c('0x2')]('string',_0x6b5c('0x3'),'customVariable',_0x6b5c('0x4'),_0x6b5c('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6b5c('0x6')]},'key':{'type':Sequelize[_0x6b5c('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x6b5c('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x6b5c('0x6')]},'idField':{'type':Sequelize[_0x6b5c('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5edd=['variable','BOOLEAN','sequelize','ENUM','string','customVariable','keyValue','STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5edd,0x7a));var _0xd5ed=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x5edd[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0xd5ed('0x0'));module['exports']={'type':{'type':Sequelize[_0xd5ed('0x1')](_0xd5ed('0x2'),'variable',_0xd5ed('0x3'),_0xd5ed('0x4'),'picklist'),'defaultValue':_0xd5ed('0x2')},'content':{'type':Sequelize[_0xd5ed('0x5')]},'key':{'type':Sequelize[_0xd5ed('0x5')]},'keyType':{'type':Sequelize[_0xd5ed('0x1')](_0xd5ed('0x2'),_0xd5ed('0x6'),_0xd5ed('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd5ed('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd5ed('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd5ed('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index ac6f60d..399ef22 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 _0x6c16=['fields','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','rows','catch','show','params','keys','length','options','create','body','find','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','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','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model'];(function(_0x468481,_0x3d8b88){var _0x363252=function(_0x32e2a9){while(--_0x32e2a9){_0x468481['push'](_0x468481['shift']());}};_0x363252(++_0x3d8b88);}(_0x6c16,0x144));var _0x66c1=function(_0x528153,_0x4eee6d){_0x528153=_0x528153-0x0;var _0x4b7c74=_0x6c16[_0x528153];return _0x4b7c74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x66c1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x66c1('0x1'));var rp=require(_0x66c1('0x2'));var moment=require(_0x66c1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x66c1('0x4'));var util=require(_0x66c1('0x5'));var path=require('path');var sox=require(_0x66c1('0x6'));var csv=require('to-csv');var ejs=require(_0x66c1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66c1('0x8'));var squel=require('squel');var crypto=require(_0x66c1('0x9'));var jsforce=require(_0x66c1('0xa'));var deskjs=require(_0x66c1('0xb'));var toCsv=require(_0x66c1('0xc'));var querystring=require(_0x66c1('0xd'));var Papa=require(_0x66c1('0xe'));var Redis=require(_0x66c1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x66c1('0x10'));var hardwareService=require(_0x66c1('0x11'));var logger=require(_0x66c1('0x12'))(_0x66c1('0x13'));var utils=require(_0x66c1('0x14'));var config=require(_0x66c1('0x15'));var licenseUtil=require(_0x66c1('0x16'));var db=require(_0x66c1('0x17'))['db'];function respondWithStatusCode(_0x5b9f05,_0x580b58){_0x580b58=_0x580b58||0xcc;return function(_0x50828d){if(_0x50828d){return _0x5b9f05[_0x66c1('0x18')](_0x580b58);}return _0x5b9f05[_0x66c1('0x19')](_0x580b58)['end']();};}function respondWithResult(_0x1b5537,_0x1604df){_0x1604df=_0x1604df||0xc8;return function(_0x2d6ad2){if(_0x2d6ad2){return _0x1b5537['status'](_0x1604df)[_0x66c1('0x1a')](_0x2d6ad2);}};}function respondWithFilteredResult(_0x75ab6d,_0x488f69){return function(_0xa7091d){if(_0xa7091d){var _0x590aca=typeof _0x488f69[_0x66c1('0x1b')]===_0x66c1('0x1c')&&typeof _0x488f69[_0x66c1('0x1d')]==='undefined';var _0x604b98=_0xa7091d[_0x66c1('0x1e')];var _0x1339f6=_0x590aca?0x0:_0x488f69['offset'];var _0xaa0149=_0x590aca?_0xa7091d['count']:_0x488f69[_0x66c1('0x1b')]+_0x488f69[_0x66c1('0x1d')];var _0x1ea4f8;if(_0xaa0149>=_0x604b98){_0xaa0149=_0x604b98;_0x1ea4f8=0xc8;}else{_0x1ea4f8=0xce;}_0x75ab6d[_0x66c1('0x19')](_0x1ea4f8);return _0x75ab6d[_0x66c1('0x1f')](_0x66c1('0x20'),_0x1339f6+'-'+_0xaa0149+'/'+_0x604b98)[_0x66c1('0x1a')](_0xa7091d);}return null;};}function patchUpdates(_0x21a929){return function(_0x485752){try{jsonpatch[_0x66c1('0x21')](_0x485752,_0x21a929,!![]);}catch(_0x4a631d){return BPromise[_0x66c1('0x22')](_0x4a631d);}return _0x485752[_0x66c1('0x23')]();};}function saveUpdates(_0x27fc3d,_0x273885){return function(_0x24e65d){if(_0x24e65d){return _0x24e65d[_0x66c1('0x24')](_0x27fc3d)[_0x66c1('0x25')](function(_0x4f874b){return _0x4f874b;});}return null;};}function removeEntity(_0x1b3dc0,_0x415a38){return function(_0x213523){if(_0x213523){return _0x213523[_0x66c1('0x26')]()[_0x66c1('0x25')](function(){_0x1b3dc0[_0x66c1('0x19')](0xcc)[_0x66c1('0x27')]();});}};}function handleEntityNotFound(_0x1d60ba,_0x4e1e8a){return function(_0x5ab92b){if(!_0x5ab92b){_0x1d60ba[_0x66c1('0x18')](0x194);}return _0x5ab92b;};}function handleError(_0x3c0fd2,_0x255e8a){_0x255e8a=_0x255e8a||0x1f4;return function(_0x4a8256){logger[_0x66c1('0x28')](_0x4a8256[_0x66c1('0x29')]);if(_0x4a8256[_0x66c1('0x2a')]){delete _0x4a8256[_0x66c1('0x2a')];}_0x3c0fd2[_0x66c1('0x19')](_0x255e8a)[_0x66c1('0x2b')](_0x4a8256);};}exports[_0x66c1('0x2c')]=function(_0x2e2ab0,_0x301c19){var _0x3e6f14={},_0x2059fd={},_0x365650={'count':0x0,'rows':[]};var _0x26b083=_[_0x66c1('0x2d')](db[_0x66c1('0x2e')][_0x66c1('0x2f')],function(_0x5551f1){return{'name':_0x5551f1[_0x66c1('0x30')],'type':_0x5551f1[_0x66c1('0x31')][_0x66c1('0x32')]};});_0x2059fd['model']=_[_0x66c1('0x2d')](_0x26b083,_0x66c1('0x2a'));_0x2059fd[_0x66c1('0x33')]=_['keys'](_0x2e2ab0[_0x66c1('0x33')]);_0x2059fd[_0x66c1('0x34')]=_[_0x66c1('0x35')](_0x2059fd['model'],_0x2059fd['query']);_0x3e6f14[_0x66c1('0x36')]=_[_0x66c1('0x35')](_0x2059fd[_0x66c1('0x37')],qs['fields'](_0x2e2ab0['query'][_0x66c1('0x38')]));_0x3e6f14['attributes']=_0x3e6f14[_0x66c1('0x36')]['length']?_0x3e6f14[_0x66c1('0x36')]:_0x2059fd[_0x66c1('0x37')];if(!_0x2e2ab0[_0x66c1('0x33')][_0x66c1('0x39')]('nolimit')){_0x3e6f14[_0x66c1('0x1d')]=qs[_0x66c1('0x1d')](_0x2e2ab0['query'][_0x66c1('0x1d')]);_0x3e6f14['offset']=qs['offset'](_0x2e2ab0[_0x66c1('0x33')][_0x66c1('0x1b')]);}_0x3e6f14['order']=qs[_0x66c1('0x3a')](_0x2e2ab0['query'][_0x66c1('0x3a')]);_0x3e6f14['where']=qs['filters'](_[_0x66c1('0x3b')](_0x2e2ab0[_0x66c1('0x33')],_0x2059fd[_0x66c1('0x34')]),_0x26b083);if(_0x2e2ab0[_0x66c1('0x33')][_0x66c1('0x3c')]){_0x3e6f14[_0x66c1('0x3d')]=_['merge'](_0x3e6f14[_0x66c1('0x3d')],{'$or':_[_0x66c1('0x2d')](_0x26b083,function(_0x4bf293){if(_0x4bf293['type']!==_0x66c1('0x3e')){var _0x581240={};_0x581240[_0x4bf293[_0x66c1('0x2a')]]={'$like':'%'+_0x2e2ab0[_0x66c1('0x33')][_0x66c1('0x3c')]+'%'};return _0x581240;}})});}_0x3e6f14=_[_0x66c1('0x3f')]({},_0x3e6f14,_0x2e2ab0['options']);var _0x5b9de6={'where':_0x3e6f14[_0x66c1('0x3d')]};return db[_0x66c1('0x2e')][_0x66c1('0x1e')](_0x5b9de6)['then'](function(_0x2fd81d){_0x365650[_0x66c1('0x1e')]=_0x2fd81d;if(_0x2e2ab0['query'][_0x66c1('0x40')]){_0x3e6f14[_0x66c1('0x41')]=[{'all':!![]}];}return db[_0x66c1('0x2e')]['findAll'](_0x3e6f14);})[_0x66c1('0x25')](function(_0x5ba2c0){_0x365650[_0x66c1('0x42')]=_0x5ba2c0;return _0x365650;})[_0x66c1('0x25')](respondWithFilteredResult(_0x301c19,_0x3e6f14))[_0x66c1('0x43')](handleError(_0x301c19,null));};exports[_0x66c1('0x44')]=function(_0x4bf34e,_0x5a23da){var _0x19042b={'raw':!![],'where':{'id':_0x4bf34e[_0x66c1('0x45')]['id']}},_0x5e544e={};_0x5e544e[_0x66c1('0x37')]=_[_0x66c1('0x46')](db['SugarcrmField']['rawAttributes']);_0x5e544e['query']=_[_0x66c1('0x46')](_0x4bf34e['query']);_0x5e544e[_0x66c1('0x34')]=_[_0x66c1('0x35')](_0x5e544e[_0x66c1('0x37')],_0x5e544e['query']);_0x19042b[_0x66c1('0x36')]=_[_0x66c1('0x35')](_0x5e544e[_0x66c1('0x37')],qs[_0x66c1('0x38')](_0x4bf34e[_0x66c1('0x33')][_0x66c1('0x38')]));_0x19042b[_0x66c1('0x36')]=_0x19042b[_0x66c1('0x36')][_0x66c1('0x47')]?_0x19042b[_0x66c1('0x36')]:_0x5e544e[_0x66c1('0x37')];if(_0x4bf34e[_0x66c1('0x33')]['includeAll']){_0x19042b[_0x66c1('0x41')]=[{'all':!![]}];}_0x19042b=_[_0x66c1('0x3f')]({},_0x19042b,_0x4bf34e[_0x66c1('0x48')]);return db[_0x66c1('0x2e')]['find'](_0x19042b)[_0x66c1('0x25')](handleEntityNotFound(_0x5a23da,null))[_0x66c1('0x25')](respondWithResult(_0x5a23da,null))['catch'](handleError(_0x5a23da,null));};exports[_0x66c1('0x49')]=function(_0x5ab614,_0x3c0f86){return db[_0x66c1('0x2e')][_0x66c1('0x49')](_0x5ab614[_0x66c1('0x4a')],{})[_0x66c1('0x25')](respondWithResult(_0x3c0f86,0xc9))[_0x66c1('0x43')](handleError(_0x3c0f86,null));};exports[_0x66c1('0x24')]=function(_0x3f2125,_0x24b05b){if(_0x3f2125[_0x66c1('0x4a')]['id']){delete _0x3f2125['body']['id'];}return db['SugarcrmField'][_0x66c1('0x4b')]({'where':{'id':_0x3f2125[_0x66c1('0x45')]['id']}})[_0x66c1('0x25')](handleEntityNotFound(_0x24b05b,null))[_0x66c1('0x25')](saveUpdates(_0x3f2125[_0x66c1('0x4a')],null))['then'](respondWithResult(_0x24b05b,null))[_0x66c1('0x43')](handleError(_0x24b05b,null));};exports['destroy']=function(_0x5d9d8b,_0x1ba758){return db[_0x66c1('0x2e')][_0x66c1('0x4b')]({'where':{'id':_0x5d9d8b[_0x66c1('0x45')]['id']}})[_0x66c1('0x25')](handleEntityNotFound(_0x1ba758,null))[_0x66c1('0x25')](removeEntity(_0x1ba758,null))[_0x66c1('0x43')](handleError(_0x1ba758,null));}; \ No newline at end of file +var _0x1218=['where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','update','destroy','find','eml-format','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','limit','undefined','count','set','apply','reject','then','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','order'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x1218,0xde));var _0x8121=function(_0x80794b,_0x5c4699){_0x80794b=_0x80794b-0x0;var _0x1c7079=_0x1218[_0x80794b];return _0x1c7079;};'use strict';var emlformat=require(_0x8121('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8121('0x1'));var rp=require('request-promise');var moment=require(_0x8121('0x2'));var BPromise=require(_0x8121('0x3'));var Mustache=require(_0x8121('0x4'));var util=require('util');var path=require(_0x8121('0x5'));var sox=require('sox');var csv=require(_0x8121('0x6'));var ejs=require(_0x8121('0x7'));var fs=require('fs');var fs_extra=require(_0x8121('0x8'));var _=require(_0x8121('0x9'));var squel=require(_0x8121('0xa'));var crypto=require('crypto');var jsforce=require(_0x8121('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8121('0x6'));var querystring=require('querystring');var Papa=require(_0x8121('0xc'));var Redis=require(_0x8121('0xd'));var authService=require(_0x8121('0xe'));var qs=require(_0x8121('0xf'));var as=require(_0x8121('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8121('0x11'))(_0x8121('0x12'));var utils=require(_0x8121('0x13'));var config=require(_0x8121('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x583e4a,_0x1e815c){_0x1e815c=_0x1e815c||0xcc;return function(_0x58b777){if(_0x58b777){return _0x583e4a['sendStatus'](_0x1e815c);}return _0x583e4a[_0x8121('0x15')](_0x1e815c)[_0x8121('0x16')]();};}function respondWithResult(_0x3a36fd,_0x2ffb15){_0x2ffb15=_0x2ffb15||0xc8;return function(_0x23136f){if(_0x23136f){return _0x3a36fd[_0x8121('0x15')](_0x2ffb15)[_0x8121('0x17')](_0x23136f);}};}function respondWithFilteredResult(_0x4d8f35,_0x26aaee){return function(_0x5f5d89){if(_0x5f5d89){var _0x3b2660=typeof _0x26aaee[_0x8121('0x18')]==='undefined'&&typeof _0x26aaee[_0x8121('0x19')]===_0x8121('0x1a');var _0x446f2f=_0x5f5d89[_0x8121('0x1b')];var _0x571075=_0x3b2660?0x0:_0x26aaee[_0x8121('0x18')];var _0x29c8b7=_0x3b2660?_0x5f5d89[_0x8121('0x1b')]:_0x26aaee['offset']+_0x26aaee['limit'];var _0x3dd2e9;if(_0x29c8b7>=_0x446f2f){_0x29c8b7=_0x446f2f;_0x3dd2e9=0xc8;}else{_0x3dd2e9=0xce;}_0x4d8f35[_0x8121('0x15')](_0x3dd2e9);return _0x4d8f35[_0x8121('0x1c')]('Content-Range',_0x571075+'-'+_0x29c8b7+'/'+_0x446f2f)[_0x8121('0x17')](_0x5f5d89);}return null;};}function patchUpdates(_0x474f9d){return function(_0x2c23ba){try{jsonpatch[_0x8121('0x1d')](_0x2c23ba,_0x474f9d,!![]);}catch(_0x1d1277){return BPromise[_0x8121('0x1e')](_0x1d1277);}return _0x2c23ba['save']();};}function saveUpdates(_0x17a436,_0x4c0119){return function(_0x48793f){if(_0x48793f){return _0x48793f['update'](_0x17a436)[_0x8121('0x1f')](function(_0x2ecf83){return _0x2ecf83;});}return null;};}function removeEntity(_0x442009,_0x39ef61){return function(_0x46f2d1){if(_0x46f2d1){return _0x46f2d1['destroy']()[_0x8121('0x1f')](function(){_0x442009[_0x8121('0x15')](0xcc)[_0x8121('0x16')]();});}};}function handleEntityNotFound(_0x4e7565,_0x46bac0){return function(_0x5ae917){if(!_0x5ae917){_0x4e7565['sendStatus'](0x194);}return _0x5ae917;};}function handleError(_0x56655b,_0x19038b){_0x19038b=_0x19038b||0x1f4;return function(_0x23cba9){logger['error'](_0x23cba9[_0x8121('0x20')]);if(_0x23cba9[_0x8121('0x21')]){delete _0x23cba9['name'];}_0x56655b['status'](_0x19038b)[_0x8121('0x22')](_0x23cba9);};}exports['index']=function(_0xbb21fc,_0x5856e0){var _0x551b4a={},_0xf0e86e={},_0x3fe564={'count':0x0,'rows':[]};var _0x5ca386=_[_0x8121('0x23')](db[_0x8121('0x24')][_0x8121('0x25')],function(_0x4d2a71){return{'name':_0x4d2a71[_0x8121('0x26')],'type':_0x4d2a71[_0x8121('0x27')][_0x8121('0x28')]};});_0xf0e86e['model']=_['map'](_0x5ca386,'name');_0xf0e86e['query']=_[_0x8121('0x29')](_0xbb21fc[_0x8121('0x2a')]);_0xf0e86e[_0x8121('0x2b')]=_[_0x8121('0x2c')](_0xf0e86e[_0x8121('0x2d')],_0xf0e86e[_0x8121('0x2a')]);_0x551b4a['attributes']=_[_0x8121('0x2c')](_0xf0e86e[_0x8121('0x2d')],qs[_0x8121('0x2e')](_0xbb21fc[_0x8121('0x2a')]['fields']));_0x551b4a[_0x8121('0x2f')]=_0x551b4a[_0x8121('0x2f')][_0x8121('0x30')]?_0x551b4a['attributes']:_0xf0e86e['model'];if(!_0xbb21fc[_0x8121('0x2a')]['hasOwnProperty']('nolimit')){_0x551b4a[_0x8121('0x19')]=qs[_0x8121('0x19')](_0xbb21fc[_0x8121('0x2a')]['limit']);_0x551b4a['offset']=qs[_0x8121('0x18')](_0xbb21fc[_0x8121('0x2a')][_0x8121('0x18')]);}_0x551b4a[_0x8121('0x31')]=qs['sort'](_0xbb21fc[_0x8121('0x2a')]['sort']);_0x551b4a[_0x8121('0x32')]=qs['filters'](_[_0x8121('0x33')](_0xbb21fc[_0x8121('0x2a')],_0xf0e86e['filters']),_0x5ca386);if(_0xbb21fc[_0x8121('0x2a')][_0x8121('0x34')]){_0x551b4a[_0x8121('0x32')]=_[_0x8121('0x35')](_0x551b4a[_0x8121('0x32')],{'$or':_['map'](_0x5ca386,function(_0x19076b){if(_0x19076b['type']!==_0x8121('0x36')){var _0x3716ff={};_0x3716ff[_0x19076b[_0x8121('0x21')]]={'$like':'%'+_0xbb21fc[_0x8121('0x2a')]['filter']+'%'};return _0x3716ff;}})});}_0x551b4a=_[_0x8121('0x35')]({},_0x551b4a,_0xbb21fc['options']);var _0x6b9e54={'where':_0x551b4a[_0x8121('0x32')]};return db['SugarcrmField'][_0x8121('0x1b')](_0x6b9e54)['then'](function(_0x135028){_0x3fe564['count']=_0x135028;if(_0xbb21fc[_0x8121('0x2a')][_0x8121('0x37')]){_0x551b4a[_0x8121('0x38')]=[{'all':!![]}];}return db[_0x8121('0x24')][_0x8121('0x39')](_0x551b4a);})[_0x8121('0x1f')](function(_0x3c2367){_0x3fe564[_0x8121('0x3a')]=_0x3c2367;return _0x3fe564;})[_0x8121('0x1f')](respondWithFilteredResult(_0x5856e0,_0x551b4a))[_0x8121('0x3b')](handleError(_0x5856e0,null));};exports[_0x8121('0x3c')]=function(_0x26590c,_0x2f02e1){var _0x49ceaa={'raw':!![],'where':{'id':_0x26590c[_0x8121('0x3d')]['id']}},_0x56a505={};_0x56a505[_0x8121('0x2d')]=_[_0x8121('0x29')](db[_0x8121('0x24')][_0x8121('0x25')]);_0x56a505[_0x8121('0x2a')]=_[_0x8121('0x29')](_0x26590c[_0x8121('0x2a')]);_0x56a505[_0x8121('0x2b')]=_[_0x8121('0x2c')](_0x56a505[_0x8121('0x2d')],_0x56a505[_0x8121('0x2a')]);_0x49ceaa[_0x8121('0x2f')]=_[_0x8121('0x2c')](_0x56a505[_0x8121('0x2d')],qs['fields'](_0x26590c[_0x8121('0x2a')][_0x8121('0x2e')]));_0x49ceaa[_0x8121('0x2f')]=_0x49ceaa[_0x8121('0x2f')]['length']?_0x49ceaa[_0x8121('0x2f')]:_0x56a505[_0x8121('0x2d')];if(_0x26590c[_0x8121('0x2a')][_0x8121('0x37')]){_0x49ceaa['include']=[{'all':!![]}];}_0x49ceaa=_[_0x8121('0x35')]({},_0x49ceaa,_0x26590c[_0x8121('0x3e')]);return db[_0x8121('0x24')]['find'](_0x49ceaa)[_0x8121('0x1f')](handleEntityNotFound(_0x2f02e1,null))[_0x8121('0x1f')](respondWithResult(_0x2f02e1,null))[_0x8121('0x3b')](handleError(_0x2f02e1,null));};exports[_0x8121('0x3f')]=function(_0x47ae4b,_0x2c700a){return db[_0x8121('0x24')][_0x8121('0x3f')](_0x47ae4b[_0x8121('0x40')],{})['then'](respondWithResult(_0x2c700a,0xc9))['catch'](handleError(_0x2c700a,null));};exports[_0x8121('0x41')]=function(_0x11b94b,_0x1145e5){if(_0x11b94b[_0x8121('0x40')]['id']){delete _0x11b94b[_0x8121('0x40')]['id'];}return db[_0x8121('0x24')]['find']({'where':{'id':_0x11b94b['params']['id']}})[_0x8121('0x1f')](handleEntityNotFound(_0x1145e5,null))[_0x8121('0x1f')](saveUpdates(_0x11b94b[_0x8121('0x40')],null))[_0x8121('0x1f')](respondWithResult(_0x1145e5,null))[_0x8121('0x3b')](handleError(_0x1145e5,null));};exports[_0x8121('0x42')]=function(_0x35b213,_0x1b7d5c){return db[_0x8121('0x24')][_0x8121('0x43')]({'where':{'id':_0x35b213[_0x8121('0x3d')]['id']}})[_0x8121('0x1f')](handleEntityNotFound(_0x1b7d5c,null))[_0x8121('0x1f')](removeEntity(_0x1b7d5c,null))['catch'](handleError(_0x1b7d5c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 1fa15c5..b7307ca 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 _0xb9fe=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','sugarcrm_unique_index','idField','FieldId'];(function(_0x193773,_0x3ad302){var _0x3b38c7=function(_0x12bbb3){while(--_0x12bbb3){_0x193773['push'](_0x193773['shift']());}};_0x3b38c7(++_0x3ad302);}(_0xb9fe,0x142));var _0xeb9f=function(_0x17f7fc,_0x2d0370){_0x17f7fc=_0x17f7fc-0x0;var _0x2ca361=_0xb9fe[_0x17f7fc];return _0x2ca361;};'use strict';var _=require(_0xeb9f('0x0'));var util=require(_0xeb9f('0x1'));var logger=require(_0xeb9f('0x2'))(_0xeb9f('0x3'));var moment=require(_0xeb9f('0x4'));var BPromise=require(_0xeb9f('0x5'));var rp=require(_0xeb9f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeb9f('0x7'));var attributes=require(_0xeb9f('0x8'));module[_0xeb9f('0x9')]=function(_0x1ee2b0,_0x59feed){return _0x1ee2b0['define'](_0xeb9f('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xeb9f('0xb'),'fields':[_0xeb9f('0xc'),_0xeb9f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb4bf=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util'];(function(_0x17a203,_0x1e7f1f){var _0x500501=function(_0x1dc852){while(--_0x1dc852){_0x17a203['push'](_0x17a203['shift']());}};_0x500501(++_0x1e7f1f);}(_0xb4bf,0xbe));var _0xfb4b=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xb4bf[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0xfb4b('0x0'));var util=require(_0xfb4b('0x1'));var logger=require('../../config/logger')(_0xfb4b('0x2'));var moment=require(_0xfb4b('0x3'));var BPromise=require(_0xfb4b('0x4'));var rp=require(_0xfb4b('0x5'));var fs=require('fs');var path=require(_0xfb4b('0x6'));var rimraf=require(_0xfb4b('0x7'));var config=require(_0xfb4b('0x8'));var attributes=require(_0xfb4b('0x9'));module[_0xfb4b('0xa')]=function(_0x29383a,_0x17c66f){return _0x29383a['define'](_0xfb4b('0xb'),attributes,{'tableName':_0xfb4b('0xc'),'paranoid':![],'indexes':[{'name':_0xfb4b('0xd'),'fields':[_0xfb4b('0xe'),_0xfb4b('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 47e4940..ba72039 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 _0x4947=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x4947,0xa8));var _0x7494=function(_0x5192de,_0x4e91cd){_0x5192de=_0x5192de-0x0;var _0x4e287e=_0x4947[_0x5192de];return _0x4e287e;};'use strict';var _=require(_0x7494('0x0'));var util=require(_0x7494('0x1'));var moment=require(_0x7494('0x2'));var BPromise=require('bluebird');var rs=require(_0x7494('0x3'));var fs=require('fs');var Redis=require(_0x7494('0x4'));var db=require(_0x7494('0x5'))['db'];var utils=require(_0x7494('0x6'));var logger=require(_0x7494('0x7'))(_0x7494('0x8'));var config=require(_0x7494('0x9'));var jayson=require(_0x7494('0xa'));var client=jayson[_0x7494('0xb')][_0x7494('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x394107,_0x33b86a,_0x53bdbe){return new BPromise(function(_0x30b905,_0x42af74){return client[_0x7494('0xd')](_0x394107,_0x53bdbe)[_0x7494('0xe')](function(_0x2086ba){logger[_0x7494('0xf')](_0x7494('0x10'),_0x33b86a,'request\x20sent');logger['debug'](_0x7494('0x11'),_0x33b86a,_0x7494('0x12'),JSON[_0x7494('0x13')](_0x2086ba));if(_0x2086ba[_0x7494('0x14')]){if(_0x2086ba[_0x7494('0x14')][_0x7494('0x15')]===0x1f4){logger[_0x7494('0x14')](_0x7494('0x10'),_0x33b86a,_0x2086ba[_0x7494('0x14')][_0x7494('0x16')]);return _0x42af74(_0x2086ba[_0x7494('0x14')][_0x7494('0x16')]);}logger[_0x7494('0x14')]('SugarcrmField,\x20%s,\x20%s',_0x33b86a,_0x2086ba['error'][_0x7494('0x16')]);return _0x30b905(_0x2086ba[_0x7494('0x14')][_0x7494('0x16')]);}else{logger[_0x7494('0xf')](_0x7494('0x10'),_0x33b86a,_0x7494('0x12'));_0x30b905(_0x2086ba['result'][_0x7494('0x16')]);}})[_0x7494('0x17')](function(_0x4fdc66){logger[_0x7494('0x14')]('SugarcrmField,\x20%s,\x20%s',_0x33b86a,_0x4fdc66);_0x42af74(_0x4fdc66);});});} \ No newline at end of file +var _0xd3c8=['../../config/logger','../../config/environment','client','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x32f463,_0x5d5382){var _0x10e8f8=function(_0x275f42){while(--_0x275f42){_0x32f463['push'](_0x32f463['shift']());}};_0x10e8f8(++_0x5d5382);}(_0xd3c8,0x82));var _0x8d3c=function(_0x27b678,_0x5541f1){_0x27b678=_0x27b678-0x0;var _0x1dd817=_0xd3c8[_0x27b678];return _0x1dd817;};'use strict';var _=require(_0x8d3c('0x0'));var util=require(_0x8d3c('0x1'));var moment=require(_0x8d3c('0x2'));var BPromise=require(_0x8d3c('0x3'));var rs=require(_0x8d3c('0x4'));var fs=require('fs');var Redis=require(_0x8d3c('0x5'));var db=require(_0x8d3c('0x6'))['db'];var utils=require(_0x8d3c('0x7'));var logger=require(_0x8d3c('0x8'))('rpc');var config=require(_0x8d3c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8d3c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31d1eb,_0x1ab82e,_0x4702c1){return new BPromise(function(_0x340c68,_0x42e60d){return client[_0x8d3c('0xb')](_0x31d1eb,_0x4702c1)[_0x8d3c('0xc')](function(_0x1a87e7){logger[_0x8d3c('0xd')](_0x8d3c('0xe'),_0x1ab82e,'request\x20sent');logger[_0x8d3c('0xf')](_0x8d3c('0x10'),_0x1ab82e,_0x8d3c('0x11'),JSON[_0x8d3c('0x12')](_0x1a87e7));if(_0x1a87e7[_0x8d3c('0x13')]){if(_0x1a87e7[_0x8d3c('0x13')][_0x8d3c('0x14')]===0x1f4){logger[_0x8d3c('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x1ab82e,_0x1a87e7[_0x8d3c('0x13')][_0x8d3c('0x15')]);return _0x42e60d(_0x1a87e7[_0x8d3c('0x13')][_0x8d3c('0x15')]);}logger[_0x8d3c('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x1ab82e,_0x1a87e7[_0x8d3c('0x13')]['message']);return _0x340c68(_0x1a87e7[_0x8d3c('0x13')][_0x8d3c('0x15')]);}else{logger[_0x8d3c('0xd')](_0x8d3c('0xe'),_0x1ab82e,_0x8d3c('0x11'));_0x340c68(_0x1a87e7[_0x8d3c('0x16')][_0x8d3c('0x15')]);}})['catch'](function(_0xabc69d){logger['error'](_0x8d3c('0xe'),_0x1ab82e,_0xabc69d);_0x42e60d(_0xabc69d);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 05776bf..5240654 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 _0xf980=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','create','/:id/configurations','update','delete','destroy'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xf980,0x1cf));var _0x0f98=function(_0x25be63,_0x4b335e){_0x25be63=_0x25be63-0x0;var _0x4daaa8=_0xf980[_0x25be63];return _0x4daaa8;};'use strict';var multer=require('multer');var util=require(_0x0f98('0x0'));var path=require(_0x0f98('0x1'));var timeout=require(_0x0f98('0x2'));var express=require('express');var router=express[_0x0f98('0x3')]();var fs_extra=require(_0x0f98('0x4'));var auth=require(_0x0f98('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0f98('0x6'));var controller=require(_0x0f98('0x7'));router[_0x0f98('0x8')]('/',auth[_0x0f98('0x9')](),controller[_0x0f98('0xa')]);router[_0x0f98('0x8')](_0x0f98('0xb'),auth[_0x0f98('0x9')](),controller[_0x0f98('0xc')]);router[_0x0f98('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0f98('0xd')]);router['get'](_0x0f98('0xe'),auth['isAuthenticated'](),controller[_0x0f98('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0f98('0x10')]);router['post'](_0x0f98('0x11'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x0f98('0xb'),auth['isAuthenticated'](),controller[_0x0f98('0x12')]);router[_0x0f98('0x13')](_0x0f98('0xb'),auth[_0x0f98('0x9')](),controller[_0x0f98('0x14')]);module[_0x0f98('0x15')]=router; \ No newline at end of file +var _0x6fad=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x6fad,0x174));var _0xd6fa=function(_0x3f3153,_0x4c9c78){_0x3f3153=_0x3f3153-0x0;var _0x2a50f8=_0x6fad[_0x3f3153];return _0x2a50f8;};'use strict';var multer=require(_0xd6fa('0x0'));var util=require(_0xd6fa('0x1'));var path=require(_0xd6fa('0x2'));var timeout=require(_0xd6fa('0x3'));var express=require('express');var router=express[_0xd6fa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd6fa('0x5'));var interaction=require(_0xd6fa('0x6'));var config=require(_0xd6fa('0x7'));var controller=require(_0xd6fa('0x8'));router['get']('/',auth[_0xd6fa('0x9')](),controller[_0xd6fa('0xa')]);router[_0xd6fa('0xb')](_0xd6fa('0xc'),auth['isAuthenticated'](),controller[_0xd6fa('0xd')]);router['get'](_0xd6fa('0xe'),auth[_0xd6fa('0x9')](),controller[_0xd6fa('0xf')]);router[_0xd6fa('0xb')](_0xd6fa('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0xd6fa('0x11')]('/',auth[_0xd6fa('0x9')](),controller[_0xd6fa('0x12')]);router[_0xd6fa('0x11')](_0xd6fa('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xd6fa('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xd6fa('0x14')]);router[_0xd6fa('0x15')](_0xd6fa('0xc'),auth[_0xd6fa('0x9')](),controller[_0xd6fa('0x16')]);module[_0xd6fa('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 015cca8..083c87c 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 _0x9223=['sequelize','STRING','HelpDesk'];(function(_0x5d9772,_0x392357){var _0x1cc6a8=function(_0x1942aa){while(--_0x1942aa){_0x5d9772['push'](_0x5d9772['shift']());}};_0x1cc6a8(++_0x392357);}(_0x9223,0xb4));var _0x3922=function(_0x4c8a8f,_0x997ef){_0x4c8a8f=_0x4c8a8f-0x0;var _0x404500=_0x9223[_0x4c8a8f];return _0x404500;};'use strict';var Sequelize=require(_0x3922('0x0'));module['exports']={'name':{'type':Sequelize[_0x3922('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3922('0x1')]},'username':{'type':Sequelize[_0x3922('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3922('0x1')],'allowNull':![],'defaultValue':_0x3922('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3922('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x6265=['exports','STRING','sequelize'];(function(_0x4c7b20,_0x361515){var _0x4872bd=function(_0x358e19){while(--_0x358e19){_0x4c7b20['push'](_0x4c7b20['shift']());}};_0x4872bd(++_0x361515);}(_0x6265,0x89));var _0x5626=function(_0xa609f9,_0x2eed8d){_0xa609f9=_0xa609f9-0x0;var _0x4057f1=_0x6265[_0xa609f9];return _0x4057f1;};'use strict';var Sequelize=require(_0x5626('0x0'));module[_0x5626('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5626('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x5626('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x5626('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5626('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x5626('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index ecf37b7..3ad30e2 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 _0xbc78=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','length','options','VtigerAccount','find','create','body','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','result','token','describe','sessionName','autogenerated','reference','owner','includes','false','label','startsWith','cf_','picklist','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','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','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbc78,0x157));var _0x8bc7=function(_0x13c82f,_0x353a63){_0x13c82f=_0x13c82f-0x0;var _0x117e17=_0xbc78[_0x13c82f];return _0x117e17;};'use strict';var emlformat=require(_0x8bc7('0x0'));var rimraf=require(_0x8bc7('0x1'));var zipdir=require(_0x8bc7('0x2'));var jsonpatch=require(_0x8bc7('0x3'));var rp=require('request-promise');var moment=require(_0x8bc7('0x4'));var BPromise=require(_0x8bc7('0x5'));var Mustache=require(_0x8bc7('0x6'));var util=require(_0x8bc7('0x7'));var path=require(_0x8bc7('0x8'));var sox=require(_0x8bc7('0x9'));var csv=require(_0x8bc7('0xa'));var ejs=require(_0x8bc7('0xb'));var fs=require('fs');var fs_extra=require(_0x8bc7('0xc'));var _=require('lodash');var squel=require(_0x8bc7('0xd'));var crypto=require(_0x8bc7('0xe'));var jsforce=require(_0x8bc7('0xf'));var deskjs=require(_0x8bc7('0x10'));var toCsv=require(_0x8bc7('0xa'));var querystring=require(_0x8bc7('0x11'));var Papa=require('papaparse');var Redis=require(_0x8bc7('0x12'));var authService=require(_0x8bc7('0x13'));var qs=require(_0x8bc7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8bc7('0x15'));var utils=require(_0x8bc7('0x16'));var config=require(_0x8bc7('0x17'));var licenseUtil=require(_0x8bc7('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x10cc0d,_0x4aefdf){_0x4aefdf=_0x4aefdf||0xcc;return function(_0x339746){if(_0x339746){return _0x10cc0d[_0x8bc7('0x19')](_0x4aefdf);}return _0x10cc0d['status'](_0x4aefdf)[_0x8bc7('0x1a')]();};}function respondWithResult(_0x55c510,_0x25e9f5){_0x25e9f5=_0x25e9f5||0xc8;return function(_0x34a610){if(_0x34a610){return _0x55c510[_0x8bc7('0x1b')](_0x25e9f5)[_0x8bc7('0x1c')](_0x34a610);}};}function respondWithFilteredResult(_0x1bf302,_0x59f6ee){return function(_0x3c2e2d){if(_0x3c2e2d){var _0x58c96a=typeof _0x59f6ee[_0x8bc7('0x1d')]===_0x8bc7('0x1e')&&typeof _0x59f6ee[_0x8bc7('0x1f')]===_0x8bc7('0x1e');var _0x5eb5d8=_0x3c2e2d[_0x8bc7('0x20')];var _0x4e9e27=_0x58c96a?0x0:_0x59f6ee[_0x8bc7('0x1d')];var _0x506c71=_0x58c96a?_0x3c2e2d[_0x8bc7('0x20')]:_0x59f6ee['offset']+_0x59f6ee[_0x8bc7('0x1f')];var _0x1ccfda;if(_0x506c71>=_0x5eb5d8){_0x506c71=_0x5eb5d8;_0x1ccfda=0xc8;}else{_0x1ccfda=0xce;}_0x1bf302[_0x8bc7('0x1b')](_0x1ccfda);return _0x1bf302[_0x8bc7('0x21')](_0x8bc7('0x22'),_0x4e9e27+'-'+_0x506c71+'/'+_0x5eb5d8)[_0x8bc7('0x1c')](_0x3c2e2d);}return null;};}function patchUpdates(_0x4edd27){return function(_0x3c6439){try{jsonpatch[_0x8bc7('0x23')](_0x3c6439,_0x4edd27,!![]);}catch(_0x42ff5c){return BPromise[_0x8bc7('0x24')](_0x42ff5c);}return _0x3c6439[_0x8bc7('0x25')]();};}function saveUpdates(_0x46670a,_0x18a5eb){return function(_0x4d7f5f){if(_0x4d7f5f){return _0x4d7f5f[_0x8bc7('0x26')](_0x46670a)[_0x8bc7('0x27')](function(_0x22346b){return _0x22346b;});}return null;};}function removeEntity(_0x2a262c,_0x5a6701){return function(_0x34510b){if(_0x34510b){return _0x34510b[_0x8bc7('0x28')]()[_0x8bc7('0x27')](function(){_0x2a262c[_0x8bc7('0x1b')](0xcc)[_0x8bc7('0x1a')]();});}};}function handleEntityNotFound(_0x579a79,_0x51648c){return function(_0x3c9123){if(!_0x3c9123){_0x579a79[_0x8bc7('0x19')](0x194);}return _0x3c9123;};}function handleError(_0x3775a9,_0x592cf3){_0x592cf3=_0x592cf3||0x1f4;return function(_0x5b0514){logger[_0x8bc7('0x29')](_0x5b0514['stack']);if(_0x5b0514['name']){delete _0x5b0514[_0x8bc7('0x2a')];}_0x3775a9['status'](_0x592cf3)[_0x8bc7('0x2b')](_0x5b0514);};}exports[_0x8bc7('0x2c')]=function(_0x1d0fad,_0x59f59c){var _0x5f4efc={},_0x416a61={},_0x1f196e={'count':0x0,'rows':[]};var _0x2c5a70=_[_0x8bc7('0x2d')](db['VtigerAccount'][_0x8bc7('0x2e')],function(_0x4d3f6e){return{'name':_0x4d3f6e[_0x8bc7('0x2f')],'type':_0x4d3f6e['type']['key']};});_0x416a61[_0x8bc7('0x30')]=_['map'](_0x2c5a70,_0x8bc7('0x2a'));_0x416a61['query']=_[_0x8bc7('0x31')](_0x1d0fad[_0x8bc7('0x32')]);_0x416a61['filters']=_[_0x8bc7('0x33')](_0x416a61[_0x8bc7('0x30')],_0x416a61[_0x8bc7('0x32')]);_0x5f4efc['attributes']=_['intersection'](_0x416a61[_0x8bc7('0x30')],qs['fields'](_0x1d0fad[_0x8bc7('0x32')][_0x8bc7('0x34')]));_0x5f4efc['attributes']=_0x5f4efc[_0x8bc7('0x35')]['length']?_0x5f4efc[_0x8bc7('0x35')]:_0x416a61[_0x8bc7('0x30')];if(!_0x1d0fad[_0x8bc7('0x32')][_0x8bc7('0x36')](_0x8bc7('0x37'))){_0x5f4efc[_0x8bc7('0x1f')]=qs[_0x8bc7('0x1f')](_0x1d0fad['query'][_0x8bc7('0x1f')]);_0x5f4efc[_0x8bc7('0x1d')]=qs[_0x8bc7('0x1d')](_0x1d0fad['query'][_0x8bc7('0x1d')]);}_0x5f4efc[_0x8bc7('0x38')]=qs[_0x8bc7('0x39')](_0x1d0fad['query'][_0x8bc7('0x39')]);_0x5f4efc[_0x8bc7('0x3a')]=qs[_0x8bc7('0x3b')](_[_0x8bc7('0x3c')](_0x1d0fad[_0x8bc7('0x32')],_0x416a61[_0x8bc7('0x3b')]),_0x2c5a70);if(_0x1d0fad[_0x8bc7('0x32')][_0x8bc7('0x3d')]){_0x5f4efc['where']=_['merge'](_0x5f4efc[_0x8bc7('0x3a')],{'$or':_['map'](_0x2c5a70,function(_0x2b61d8){if(_0x2b61d8['type']!==_0x8bc7('0x3e')){var _0x230dac={};_0x230dac[_0x2b61d8[_0x8bc7('0x2a')]]={'$like':'%'+_0x1d0fad['query']['filter']+'%'};return _0x230dac;}})});}_0x5f4efc=_[_0x8bc7('0x3f')]({},_0x5f4efc,_0x1d0fad['options']);var _0x26cecc={'where':_0x5f4efc[_0x8bc7('0x3a')]};return db['VtigerAccount']['count'](_0x26cecc)['then'](function(_0x2e02ae){_0x1f196e[_0x8bc7('0x20')]=_0x2e02ae;if(_0x1d0fad['query'][_0x8bc7('0x40')]){_0x5f4efc[_0x8bc7('0x41')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x5f4efc);})[_0x8bc7('0x27')](function(_0x3ba4c0){_0x1f196e[_0x8bc7('0x42')]=_0x3ba4c0;return _0x1f196e;})[_0x8bc7('0x27')](respondWithFilteredResult(_0x59f59c,_0x5f4efc))[_0x8bc7('0x43')](handleError(_0x59f59c,null));};exports[_0x8bc7('0x44')]=function(_0x2e9015,_0x304939){var _0x4b26ef={'raw':![],'where':{'id':_0x2e9015[_0x8bc7('0x45')]['id']}},_0xa64adf={};_0xa64adf[_0x8bc7('0x30')]=_['keys'](db['VtigerAccount'][_0x8bc7('0x2e')]);_0xa64adf[_0x8bc7('0x32')]=_[_0x8bc7('0x31')](_0x2e9015['query']);_0xa64adf[_0x8bc7('0x3b')]=_['intersection'](_0xa64adf[_0x8bc7('0x30')],_0xa64adf[_0x8bc7('0x32')]);_0x4b26ef['attributes']=_[_0x8bc7('0x33')](_0xa64adf[_0x8bc7('0x30')],qs[_0x8bc7('0x34')](_0x2e9015[_0x8bc7('0x32')][_0x8bc7('0x34')]));_0x4b26ef[_0x8bc7('0x35')]=_0x4b26ef[_0x8bc7('0x35')][_0x8bc7('0x46')]?_0x4b26ef[_0x8bc7('0x35')]:_0xa64adf[_0x8bc7('0x30')];if(_0x2e9015[_0x8bc7('0x32')][_0x8bc7('0x40')]){_0x4b26ef[_0x8bc7('0x41')]=[{'all':!![]}];}_0x4b26ef=_[_0x8bc7('0x3f')]({},_0x4b26ef,_0x2e9015[_0x8bc7('0x47')]);return db[_0x8bc7('0x48')][_0x8bc7('0x49')](_0x4b26ef)[_0x8bc7('0x27')](handleEntityNotFound(_0x304939,null))[_0x8bc7('0x27')](respondWithResult(_0x304939,null))[_0x8bc7('0x43')](handleError(_0x304939,null));};exports[_0x8bc7('0x4a')]=function(_0x538e02,_0xec3852){return db['VtigerAccount'][_0x8bc7('0x4a')](_0x538e02[_0x8bc7('0x4b')],{})['then'](respondWithResult(_0xec3852,0xc9))[_0x8bc7('0x43')](handleError(_0xec3852,null));};exports[_0x8bc7('0x26')]=function(_0x4af848,_0xfc76d3){if(_0x4af848[_0x8bc7('0x4b')]['id']){delete _0x4af848[_0x8bc7('0x4b')]['id'];}return db[_0x8bc7('0x48')][_0x8bc7('0x49')]({'where':{'id':_0x4af848[_0x8bc7('0x45')]['id']}})['then'](handleEntityNotFound(_0xfc76d3,null))[_0x8bc7('0x27')](saveUpdates(_0x4af848[_0x8bc7('0x4b')],null))[_0x8bc7('0x27')](respondWithResult(_0xfc76d3,null))['catch'](handleError(_0xfc76d3,null));};exports['destroy']=function(_0x4971d4,_0x1f5969){return db[_0x8bc7('0x48')][_0x8bc7('0x49')]({'where':{'id':_0x4971d4[_0x8bc7('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f5969,null))[_0x8bc7('0x27')](removeEntity(_0x1f5969,null))[_0x8bc7('0x43')](handleError(_0x1f5969,null));};exports[_0x8bc7('0x4c')]=function(_0x324117,_0x6de45,_0x98682e){var _0xdcef7f={};var _0x232a49={};var _0x4f5f6f;var _0x7141d0;return db['VtigerAccount'][_0x8bc7('0x4d')]({'where':{'id':_0x324117['params']['id']}})[_0x8bc7('0x27')](handleEntityNotFound(_0x6de45,null))[_0x8bc7('0x27')](function(_0x320a58){if(_0x320a58){_0x4f5f6f=_0x320a58;_0x232a49[_0x8bc7('0x30')]=_[_0x8bc7('0x31')](db[_0x8bc7('0x4e')][_0x8bc7('0x2e')]);_0x232a49[_0x8bc7('0x32')]=_[_0x8bc7('0x31')](_0x324117[_0x8bc7('0x32')]);_0x232a49[_0x8bc7('0x3b')]=_[_0x8bc7('0x33')](_0x232a49[_0x8bc7('0x30')],_0x232a49[_0x8bc7('0x32')]);_0xdcef7f[_0x8bc7('0x35')]=_[_0x8bc7('0x33')](_0x232a49[_0x8bc7('0x30')],qs[_0x8bc7('0x34')](_0x324117[_0x8bc7('0x32')]['fields']));_0xdcef7f[_0x8bc7('0x35')]=_0xdcef7f[_0x8bc7('0x35')][_0x8bc7('0x46')]?_0xdcef7f[_0x8bc7('0x35')]:_0x232a49['model'];_0xdcef7f['order']=qs[_0x8bc7('0x39')](_0x324117['query']['sort']);_0xdcef7f[_0x8bc7('0x3a')]=qs[_0x8bc7('0x3b')](_[_0x8bc7('0x3c')](_0x324117[_0x8bc7('0x32')],_0x232a49['filters']));if(_0x324117[_0x8bc7('0x32')][_0x8bc7('0x3d')]){_0xdcef7f['where']=_[_0x8bc7('0x3f')](_0xdcef7f[_0x8bc7('0x3a')],{'$or':_[_0x8bc7('0x2d')](_0xdcef7f['attributes'],function(_0x27d415){var _0x1de8ba={};_0x1de8ba[_0x27d415]={'$like':'%'+_0x324117[_0x8bc7('0x32')][_0x8bc7('0x3d')]+'%'};return _0x1de8ba;})});}_0xdcef7f=_[_0x8bc7('0x3f')]({},_0xdcef7f,_0x324117[_0x8bc7('0x47')]);return _0x4f5f6f['getConfigurations'](_0xdcef7f);}})['then'](function(_0x3f42b7){if(_0x3f42b7){_0x7141d0=_0x3f42b7[_0x8bc7('0x46')];if(!_0x324117[_0x8bc7('0x32')]['hasOwnProperty']('nolimit')){_0xdcef7f[_0x8bc7('0x1f')]=qs['limit'](_0x324117[_0x8bc7('0x32')]['limit']);_0xdcef7f[_0x8bc7('0x1d')]=qs[_0x8bc7('0x1d')](_0x324117['query'][_0x8bc7('0x1d')]);}return _0x4f5f6f[_0x8bc7('0x4c')](_0xdcef7f);}})[_0x8bc7('0x27')](function(_0x3955e1){if(_0x3955e1){return _0x3955e1?{'count':_0x7141d0,'rows':_0x3955e1}:null;}})[_0x8bc7('0x27')](respondWithResult(_0x6de45,null))[_0x8bc7('0x43')](handleError(_0x6de45,null));};exports[_0x8bc7('0x4f')]=function(_0x204ed4,_0x5023c8,_0x1cf103){if(_0x204ed4[_0x8bc7('0x4b')]['id']){delete _0x204ed4[_0x8bc7('0x4b')]['id'];}return db[_0x8bc7('0x48')][_0x8bc7('0x4d')]({'where':{'id':_0x204ed4['params']['id']}})[_0x8bc7('0x27')](handleEntityNotFound(_0x5023c8,null))[_0x8bc7('0x27')](function(_0x5301e7){if(_0x5301e7){_0x204ed4[_0x8bc7('0x4b')][_0x8bc7('0x50')]=_0x5301e7['id'];_0x204ed4[_0x8bc7('0x4b')][_0x8bc7('0x51')]=integrations[_0x8bc7('0x52')](_0x204ed4[_0x8bc7('0x4b')][_0x8bc7('0x53')],_0x204ed4[_0x8bc7('0x4b')][_0x8bc7('0x54')]);_0x204ed4[_0x8bc7('0x4b')][_0x8bc7('0x55')]=integrations[_0x8bc7('0x56')](_0x204ed4[_0x8bc7('0x4b')][_0x8bc7('0x53')],_0x204ed4[_0x8bc7('0x4b')][_0x8bc7('0x54')]);return db[_0x8bc7('0x4e')][_0x8bc7('0x4a')](_0x204ed4[_0x8bc7('0x4b')],{'include':[{'model':db[_0x8bc7('0x57')],'as':_0x8bc7('0x51')},{'model':db[_0x8bc7('0x57')],'as':_0x8bc7('0x55')}]});}return null;})[_0x8bc7('0x27')](respondWithResult(_0x5023c8,null))[_0x8bc7('0x43')](handleError(_0x5023c8,null));};var md5=require(_0x8bc7('0x58'));exports[_0x8bc7('0x59')]=function(_0x5ee757,_0xb1e5a6,_0x812b89){var _0x37aeef=null;var _0xf6d236=null;var _0x4270b8=null;var _0x85bea6=null;var _0x34809f='';return db[_0x8bc7('0x48')][_0x8bc7('0x4d')]({'where':{'id':_0x5ee757[_0x8bc7('0x45')]['id']},'attributes':['id',_0x8bc7('0x2a'),_0x8bc7('0x5a'),_0x8bc7('0x5b'),_0x8bc7('0x5c'),_0x8bc7('0x5d'),'serverUrl','accessKey']})[_0x8bc7('0x27')](handleEntityNotFound(_0xb1e5a6,null))[_0x8bc7('0x27')](function(_0x317991){if(_0x317991){_0x37aeef=_0x317991[_0x8bc7('0x5a')];_0xf6d236=_0x317991[_0x8bc7('0x5e')];_0x4270b8=_0x317991[_0x8bc7('0x5c')];_0x34809f=_0x317991[_0x8bc7('0x5d')];var _0x29d7c6=_0x34809f[_0x8bc7('0x5f')](-0x1);if(_0x29d7c6==='/'){_0x34809f=_0x34809f[_0x8bc7('0x60')](0x0,_0x34809f[_0x8bc7('0x61')](_0x29d7c6));}_0x85bea6=util[_0x8bc7('0x62')](_0x8bc7('0x63'),_0x34809f);var _0x5e540c={'method':_0x8bc7('0x64'),'uri':_0x85bea6,'qs':{'operation':_0x8bc7('0x65'),'username':_0x317991[_0x8bc7('0x5a')]},'json':!![]};return rp(_0x5e540c);}})[_0x8bc7('0x27')](function(_0x4902de){if(_0x4902de[_0x8bc7('0x66')]){var _0x232431={'method':'POST','uri':_0x85bea6,'form':{'operation':'login','username':_0x37aeef,'accessKey':md5(_0x4902de[_0x8bc7('0x67')][_0x8bc7('0x68')]+_0xf6d236)},'json':!![]};return rp(_0x232431);}})[_0x8bc7('0x27')](function(_0x32b418){if(_0x32b418[_0x8bc7('0x66')]){var _0x268f64={'method':_0x8bc7('0x64'),'uri':_0x85bea6,'qs':{'operation':_0x8bc7('0x69'),'username':_0x37aeef,'sessionName':_0x32b418['result'][_0x8bc7('0x6a')],'elementType':_0x4270b8},'json':!![]};return rp(_0x268f64);}})['then'](function(_0x25e21b){if(_0x25e21b[_0x8bc7('0x66')]){var _0x3c714a=[_0x8bc7('0x6b'),_0x8bc7('0x6c'),_0x8bc7('0x6d')];_['remove'](_0x25e21b['result'][_0x8bc7('0x34')],function(_0x46272b){return _0x3c714a[_0x8bc7('0x6e')](_0x46272b['type'][_0x8bc7('0x2a')]);});_['remove'](_0x25e21b['result'][_0x8bc7('0x34')],function(_0x111391){return _0x111391['editable']===_0x8bc7('0x6f');});return{'count':_0x25e21b[_0x8bc7('0x67')]['fields'][_0x8bc7('0x46')],'rows':_[_0x8bc7('0x2d')](_0x25e21b['result'][_0x8bc7('0x34')],function(_0x597598){return{'id':_0x597598[_0x8bc7('0x2a')],'name':_0x597598[_0x8bc7('0x70')],'custom':_[_0x8bc7('0x71')](_0x597598[_0x8bc7('0x2a')],_0x8bc7('0x72'))?!![]:![],'options':_0x597598[_0x8bc7('0x54')][_0x8bc7('0x2a')]===_0x8bc7('0x73')&&_0x597598[_0x8bc7('0x54')]['picklistValues'][_0x8bc7('0x46')]>0x0?_['map'](_0x597598['type']['picklistValues'],function(_0x37fad){return{'name':_0x37fad[_0x8bc7('0x70')],'value':_0x37fad[_0x8bc7('0x74')]};}):[]};})};}})[_0x8bc7('0x27')](respondWithResult(_0xb1e5a6,null))[_0x8bc7('0x43')](function(_0x1e05f7){console[_0x8bc7('0x75')](_0x8bc7('0x76')+_0x1e05f7);var _0x4f9c11=_0x5ee757[_0x8bc7('0x32')][_0x8bc7('0x77')]?0x1f4:_0x1e05f7[_0x8bc7('0x78')]||0x1f4;logger[_0x8bc7('0x29')](_0x8bc7('0x79'),_0x8bc7('0x59'),_0x4f9c11,JSON[_0x8bc7('0x7a')](_0x1e05f7));delete _0x1e05f7[_0x8bc7('0x2a')];if(_0x4f9c11===0x191){_0x4f9c11=0x190;}_0xb1e5a6[_0x8bc7('0x1b')](_0x4f9c11)[_0x8bc7('0x2b')](_0x5ee757[_0x8bc7('0x32')][_0x8bc7('0x77')]?{'message':_0x8bc7('0x7b'),'statusCode':_0x1e05f7[_0x8bc7('0x78')]}:_0x1e05f7);});}; \ No newline at end of file +var _0xe33c=['count','set','Content-Range','reject','save','update','destroy','then','error','name','send','map','VtigerAccount','rawAttributes','fieldName','type','model','filters','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','params','keys','intersection','includeAll','options','catch','create','body','find','findOne','VtigerConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','username','description','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','GET','success','POST','login','result','token','describe','sessionName','autogenerated','reference','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','stringify','test','Wrong\x20credentials','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe33c,0x14d));var _0xce33=function(_0x284eed,_0x52042b){_0x284eed=_0x284eed-0x0;var _0x267d75=_0xe33c[_0x284eed];return _0x267d75;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xce33('0x0'));var jsonpatch=require(_0xce33('0x1'));var rp=require('request-promise');var moment=require(_0xce33('0x2'));var BPromise=require(_0xce33('0x3'));var Mustache=require(_0xce33('0x4'));var util=require(_0xce33('0x5'));var path=require(_0xce33('0x6'));var sox=require(_0xce33('0x7'));var csv=require(_0xce33('0x8'));var ejs=require(_0xce33('0x9'));var fs=require('fs');var fs_extra=require(_0xce33('0xa'));var _=require(_0xce33('0xb'));var squel=require(_0xce33('0xc'));var crypto=require(_0xce33('0xd'));var jsforce=require(_0xce33('0xe'));var deskjs=require(_0xce33('0xf'));var toCsv=require(_0xce33('0x8'));var querystring=require(_0xce33('0x10'));var Papa=require('papaparse');var Redis=require(_0xce33('0x11'));var authService=require(_0xce33('0x12'));var qs=require(_0xce33('0x13'));var as=require(_0xce33('0x14'));var hardwareService=require(_0xce33('0x15'));var logger=require(_0xce33('0x16'))('api');var utils=require(_0xce33('0x17'));var config=require(_0xce33('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xce33('0x19'))['db'];var integrations=require(_0xce33('0x1a'));function respondWithStatusCode(_0x45c159,_0x2385e8){_0x2385e8=_0x2385e8||0xcc;return function(_0x29b12d){if(_0x29b12d){return _0x45c159[_0xce33('0x1b')](_0x2385e8);}return _0x45c159[_0xce33('0x1c')](_0x2385e8)['end']();};}function respondWithResult(_0x5686d3,_0x234bd1){_0x234bd1=_0x234bd1||0xc8;return function(_0xd942d7){if(_0xd942d7){return _0x5686d3[_0xce33('0x1c')](_0x234bd1)[_0xce33('0x1d')](_0xd942d7);}};}function respondWithFilteredResult(_0x485642,_0xb96145){return function(_0x3033f9){if(_0x3033f9){var _0x24c9ef=typeof _0xb96145[_0xce33('0x1e')]===_0xce33('0x1f')&&typeof _0xb96145[_0xce33('0x20')]==='undefined';var _0x2b569f=_0x3033f9[_0xce33('0x21')];var _0x147101=_0x24c9ef?0x0:_0xb96145[_0xce33('0x1e')];var _0xda7414=_0x24c9ef?_0x3033f9[_0xce33('0x21')]:_0xb96145['offset']+_0xb96145[_0xce33('0x20')];var _0x27abd1;if(_0xda7414>=_0x2b569f){_0xda7414=_0x2b569f;_0x27abd1=0xc8;}else{_0x27abd1=0xce;}_0x485642[_0xce33('0x1c')](_0x27abd1);return _0x485642[_0xce33('0x22')](_0xce33('0x23'),_0x147101+'-'+_0xda7414+'/'+_0x2b569f)[_0xce33('0x1d')](_0x3033f9);}return null;};}function patchUpdates(_0x382ae9){return function(_0x5360fd){try{jsonpatch['apply'](_0x5360fd,_0x382ae9,!![]);}catch(_0x5423a1){return BPromise[_0xce33('0x24')](_0x5423a1);}return _0x5360fd[_0xce33('0x25')]();};}function saveUpdates(_0x316d22,_0x50320b){return function(_0x5153f3){if(_0x5153f3){return _0x5153f3[_0xce33('0x26')](_0x316d22)['then'](function(_0x2bdb97){return _0x2bdb97;});}return null;};}function removeEntity(_0x288abc,_0x355a8a){return function(_0x2f3f6b){if(_0x2f3f6b){return _0x2f3f6b[_0xce33('0x27')]()[_0xce33('0x28')](function(){_0x288abc[_0xce33('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b99a,_0x5d9346){return function(_0x4d206f){if(!_0x4d206f){_0x16b99a[_0xce33('0x1b')](0x194);}return _0x4d206f;};}function handleError(_0x5bd133,_0x2e8073){_0x2e8073=_0x2e8073||0x1f4;return function(_0x4b6a9c){logger[_0xce33('0x29')](_0x4b6a9c['stack']);if(_0x4b6a9c[_0xce33('0x2a')]){delete _0x4b6a9c['name'];}_0x5bd133[_0xce33('0x1c')](_0x2e8073)[_0xce33('0x2b')](_0x4b6a9c);};}exports['index']=function(_0x5a2839,_0x379944){var _0x14bafd={},_0xe58aff={},_0x2826d7={'count':0x0,'rows':[]};var _0x4268a0=_[_0xce33('0x2c')](db[_0xce33('0x2d')][_0xce33('0x2e')],function(_0x58f879){return{'name':_0x58f879[_0xce33('0x2f')],'type':_0x58f879[_0xce33('0x30')]['key']};});_0xe58aff[_0xce33('0x31')]=_[_0xce33('0x2c')](_0x4268a0,_0xce33('0x2a'));_0xe58aff['query']=_['keys'](_0x5a2839['query']);_0xe58aff[_0xce33('0x32')]=_['intersection'](_0xe58aff[_0xce33('0x31')],_0xe58aff['query']);_0x14bafd[_0xce33('0x33')]=_['intersection'](_0xe58aff[_0xce33('0x31')],qs[_0xce33('0x34')](_0x5a2839[_0xce33('0x35')]['fields']));_0x14bafd[_0xce33('0x33')]=_0x14bafd[_0xce33('0x33')][_0xce33('0x36')]?_0x14bafd[_0xce33('0x33')]:_0xe58aff[_0xce33('0x31')];if(!_0x5a2839[_0xce33('0x35')][_0xce33('0x37')](_0xce33('0x38'))){_0x14bafd[_0xce33('0x20')]=qs[_0xce33('0x20')](_0x5a2839['query'][_0xce33('0x20')]);_0x14bafd[_0xce33('0x1e')]=qs[_0xce33('0x1e')](_0x5a2839['query']['offset']);}_0x14bafd[_0xce33('0x39')]=qs[_0xce33('0x3a')](_0x5a2839[_0xce33('0x35')]['sort']);_0x14bafd[_0xce33('0x3b')]=qs['filters'](_[_0xce33('0x3c')](_0x5a2839[_0xce33('0x35')],_0xe58aff['filters']),_0x4268a0);if(_0x5a2839[_0xce33('0x35')][_0xce33('0x3d')]){_0x14bafd['where']=_[_0xce33('0x3e')](_0x14bafd['where'],{'$or':_[_0xce33('0x2c')](_0x4268a0,function(_0x2cf0ba){if(_0x2cf0ba['type']!==_0xce33('0x3f')){var _0x1d627b={};_0x1d627b[_0x2cf0ba[_0xce33('0x2a')]]={'$like':'%'+_0x5a2839[_0xce33('0x35')]['filter']+'%'};return _0x1d627b;}})});}_0x14bafd=_[_0xce33('0x3e')]({},_0x14bafd,_0x5a2839['options']);var _0xf99cb8={'where':_0x14bafd['where']};return db[_0xce33('0x2d')]['count'](_0xf99cb8)[_0xce33('0x28')](function(_0xc73879){_0x2826d7['count']=_0xc73879;if(_0x5a2839[_0xce33('0x35')]['includeAll']){_0x14bafd[_0xce33('0x40')]=[{'all':!![]}];}return db['VtigerAccount'][_0xce33('0x41')](_0x14bafd);})['then'](function(_0x49e4b9){_0x2826d7[_0xce33('0x42')]=_0x49e4b9;return _0x2826d7;})[_0xce33('0x28')](respondWithFilteredResult(_0x379944,_0x14bafd))['catch'](handleError(_0x379944,null));};exports['show']=function(_0x509a1a,_0x52339f){var _0xc0ffba={'raw':![],'where':{'id':_0x509a1a[_0xce33('0x43')]['id']}},_0x161415={};_0x161415['model']=_[_0xce33('0x44')](db[_0xce33('0x2d')][_0xce33('0x2e')]);_0x161415['query']=_[_0xce33('0x44')](_0x509a1a[_0xce33('0x35')]);_0x161415[_0xce33('0x32')]=_[_0xce33('0x45')](_0x161415[_0xce33('0x31')],_0x161415[_0xce33('0x35')]);_0xc0ffba['attributes']=_[_0xce33('0x45')](_0x161415[_0xce33('0x31')],qs[_0xce33('0x34')](_0x509a1a[_0xce33('0x35')][_0xce33('0x34')]));_0xc0ffba[_0xce33('0x33')]=_0xc0ffba['attributes'][_0xce33('0x36')]?_0xc0ffba[_0xce33('0x33')]:_0x161415[_0xce33('0x31')];if(_0x509a1a[_0xce33('0x35')][_0xce33('0x46')]){_0xc0ffba[_0xce33('0x40')]=[{'all':!![]}];}_0xc0ffba=_[_0xce33('0x3e')]({},_0xc0ffba,_0x509a1a[_0xce33('0x47')]);return db['VtigerAccount']['find'](_0xc0ffba)[_0xce33('0x28')](handleEntityNotFound(_0x52339f,null))[_0xce33('0x28')](respondWithResult(_0x52339f,null))[_0xce33('0x48')](handleError(_0x52339f,null));};exports[_0xce33('0x49')]=function(_0x3e07ad,_0x206f1f){return db[_0xce33('0x2d')]['create'](_0x3e07ad['body'],{})[_0xce33('0x28')](respondWithResult(_0x206f1f,0xc9))['catch'](handleError(_0x206f1f,null));};exports['update']=function(_0x333e6c,_0x590ef2){if(_0x333e6c[_0xce33('0x4a')]['id']){delete _0x333e6c[_0xce33('0x4a')]['id'];}return db[_0xce33('0x2d')][_0xce33('0x4b')]({'where':{'id':_0x333e6c['params']['id']}})['then'](handleEntityNotFound(_0x590ef2,null))[_0xce33('0x28')](saveUpdates(_0x333e6c[_0xce33('0x4a')],null))[_0xce33('0x28')](respondWithResult(_0x590ef2,null))[_0xce33('0x48')](handleError(_0x590ef2,null));};exports[_0xce33('0x27')]=function(_0x1eff92,_0x30bc2c){return db['VtigerAccount'][_0xce33('0x4b')]({'where':{'id':_0x1eff92[_0xce33('0x43')]['id']}})[_0xce33('0x28')](handleEntityNotFound(_0x30bc2c,null))[_0xce33('0x28')](removeEntity(_0x30bc2c,null))[_0xce33('0x48')](handleError(_0x30bc2c,null));};exports['getConfigurations']=function(_0xd598e3,_0xfe9abd,_0x49ecb8){var _0x1bd0ae={};var _0x131f66={};var _0x19e7e1;var _0x411f60;return db['VtigerAccount'][_0xce33('0x4c')]({'where':{'id':_0xd598e3[_0xce33('0x43')]['id']}})['then'](handleEntityNotFound(_0xfe9abd,null))['then'](function(_0x1f2d3d){if(_0x1f2d3d){_0x19e7e1=_0x1f2d3d;_0x131f66[_0xce33('0x31')]=_[_0xce33('0x44')](db[_0xce33('0x4d')]['rawAttributes']);_0x131f66[_0xce33('0x35')]=_[_0xce33('0x44')](_0xd598e3[_0xce33('0x35')]);_0x131f66['filters']=_[_0xce33('0x45')](_0x131f66[_0xce33('0x31')],_0x131f66['query']);_0x1bd0ae[_0xce33('0x33')]=_[_0xce33('0x45')](_0x131f66[_0xce33('0x31')],qs[_0xce33('0x34')](_0xd598e3[_0xce33('0x35')][_0xce33('0x34')]));_0x1bd0ae[_0xce33('0x33')]=_0x1bd0ae[_0xce33('0x33')][_0xce33('0x36')]?_0x1bd0ae['attributes']:_0x131f66['model'];_0x1bd0ae['order']=qs['sort'](_0xd598e3[_0xce33('0x35')][_0xce33('0x3a')]);_0x1bd0ae['where']=qs[_0xce33('0x32')](_['pick'](_0xd598e3[_0xce33('0x35')],_0x131f66['filters']));if(_0xd598e3['query'][_0xce33('0x3d')]){_0x1bd0ae['where']=_[_0xce33('0x3e')](_0x1bd0ae['where'],{'$or':_[_0xce33('0x2c')](_0x1bd0ae[_0xce33('0x33')],function(_0x1331da){var _0x4a0c8d={};_0x4a0c8d[_0x1331da]={'$like':'%'+_0xd598e3[_0xce33('0x35')][_0xce33('0x3d')]+'%'};return _0x4a0c8d;})});}_0x1bd0ae=_[_0xce33('0x3e')]({},_0x1bd0ae,_0xd598e3[_0xce33('0x47')]);return _0x19e7e1[_0xce33('0x4e')](_0x1bd0ae);}})[_0xce33('0x28')](function(_0x1dc659){if(_0x1dc659){_0x411f60=_0x1dc659[_0xce33('0x36')];if(!_0xd598e3['query'][_0xce33('0x37')](_0xce33('0x38'))){_0x1bd0ae[_0xce33('0x20')]=qs[_0xce33('0x20')](_0xd598e3[_0xce33('0x35')][_0xce33('0x20')]);_0x1bd0ae[_0xce33('0x1e')]=qs[_0xce33('0x1e')](_0xd598e3[_0xce33('0x35')][_0xce33('0x1e')]);}return _0x19e7e1[_0xce33('0x4e')](_0x1bd0ae);}})[_0xce33('0x28')](function(_0x3f4ce6){if(_0x3f4ce6){return _0x3f4ce6?{'count':_0x411f60,'rows':_0x3f4ce6}:null;}})[_0xce33('0x28')](respondWithResult(_0xfe9abd,null))[_0xce33('0x48')](handleError(_0xfe9abd,null));};exports[_0xce33('0x4f')]=function(_0x24fc1a,_0x5e79b6,_0x45d7b4){if(_0x24fc1a[_0xce33('0x4a')]['id']){delete _0x24fc1a[_0xce33('0x4a')]['id'];}return db[_0xce33('0x2d')][_0xce33('0x4c')]({'where':{'id':_0x24fc1a['params']['id']}})[_0xce33('0x28')](handleEntityNotFound(_0x5e79b6,null))[_0xce33('0x28')](function(_0x3112c0){if(_0x3112c0){_0x24fc1a[_0xce33('0x4a')]['AccountId']=_0x3112c0['id'];_0x24fc1a[_0xce33('0x4a')][_0xce33('0x50')]=integrations[_0xce33('0x51')](_0x24fc1a['body']['channel'],_0x24fc1a[_0xce33('0x4a')][_0xce33('0x30')]);_0x24fc1a[_0xce33('0x4a')][_0xce33('0x52')]=integrations[_0xce33('0x53')](_0x24fc1a['body'][_0xce33('0x54')],_0x24fc1a[_0xce33('0x4a')][_0xce33('0x30')]);return db['VtigerConfiguration']['create'](_0x24fc1a['body'],{'include':[{'model':db[_0xce33('0x55')],'as':_0xce33('0x50')},{'model':db['VtigerField'],'as':_0xce33('0x52')}]});}return null;})[_0xce33('0x28')](respondWithResult(_0x5e79b6,null))[_0xce33('0x48')](handleError(_0x5e79b6,null));};var md5=require(_0xce33('0x56'));exports[_0xce33('0x57')]=function(_0x36339b,_0x5cee64,_0x4a2cc4){var _0x5508dd=null;var _0x28398e=null;var _0x3a713b=null;var _0x5cdd98=null;var _0x2102cb='';return db[_0xce33('0x2d')][_0xce33('0x4c')]({'where':{'id':_0x36339b[_0xce33('0x43')]['id']},'attributes':['id',_0xce33('0x2a'),_0xce33('0x58'),_0xce33('0x59'),_0xce33('0x5a'),_0xce33('0x5b'),'serverUrl',_0xce33('0x5c')]})[_0xce33('0x28')](handleEntityNotFound(_0x5cee64,null))['then'](function(_0x1f5bfd){if(_0x1f5bfd){_0x5508dd=_0x1f5bfd[_0xce33('0x58')];_0x28398e=_0x1f5bfd[_0xce33('0x5c')];_0x3a713b=_0x1f5bfd[_0xce33('0x5a')];_0x2102cb=_0x1f5bfd[_0xce33('0x5b')];var _0x518b5e=_0x2102cb[_0xce33('0x5d')](-0x1);if(_0x518b5e==='/'){_0x2102cb=_0x2102cb[_0xce33('0x5e')](0x0,_0x2102cb[_0xce33('0x5f')](_0x518b5e));}_0x5cdd98=util['format']('%s/webservice.php',_0x2102cb);var _0x30afd4={'method':_0xce33('0x60'),'uri':_0x5cdd98,'qs':{'operation':'getchallenge','username':_0x1f5bfd[_0xce33('0x58')]},'json':!![]};return rp(_0x30afd4);}})[_0xce33('0x28')](function(_0x131f6a){if(_0x131f6a[_0xce33('0x61')]){var _0x5b3f3a={'method':_0xce33('0x62'),'uri':_0x5cdd98,'form':{'operation':_0xce33('0x63'),'username':_0x5508dd,'accessKey':md5(_0x131f6a[_0xce33('0x64')][_0xce33('0x65')]+_0x28398e)},'json':!![]};return rp(_0x5b3f3a);}})[_0xce33('0x28')](function(_0x1c1d63){if(_0x1c1d63[_0xce33('0x61')]){var _0x21e3bd={'method':_0xce33('0x60'),'uri':_0x5cdd98,'qs':{'operation':_0xce33('0x66'),'username':_0x5508dd,'sessionName':_0x1c1d63[_0xce33('0x64')][_0xce33('0x67')],'elementType':_0x3a713b},'json':!![]};return rp(_0x21e3bd);}})['then'](function(_0x1d5f6b){if(_0x1d5f6b[_0xce33('0x61')]){var _0x21fa4f=[_0xce33('0x68'),_0xce33('0x69'),'owner'];_[_0xce33('0x6a')](_0x1d5f6b[_0xce33('0x64')]['fields'],function(_0x3b661b){return _0x21fa4f[_0xce33('0x6b')](_0x3b661b[_0xce33('0x30')][_0xce33('0x2a')]);});_[_0xce33('0x6a')](_0x1d5f6b['result'][_0xce33('0x34')],function(_0x545c78){return _0x545c78[_0xce33('0x6c')]===_0xce33('0x6d');});return{'count':_0x1d5f6b['result'][_0xce33('0x34')][_0xce33('0x36')],'rows':_[_0xce33('0x2c')](_0x1d5f6b[_0xce33('0x64')][_0xce33('0x34')],function(_0x264bc0){return{'id':_0x264bc0['name'],'name':_0x264bc0[_0xce33('0x6e')],'custom':_[_0xce33('0x6f')](_0x264bc0[_0xce33('0x2a')],_0xce33('0x70'))?!![]:![],'options':_0x264bc0['type']['name']===_0xce33('0x71')&&_0x264bc0[_0xce33('0x30')][_0xce33('0x72')][_0xce33('0x36')]>0x0?_[_0xce33('0x2c')](_0x264bc0[_0xce33('0x30')]['picklistValues'],function(_0x21b832){return{'name':_0x21b832[_0xce33('0x6e')],'value':_0x21b832[_0xce33('0x73')]};}):[]};})};}})[_0xce33('0x28')](respondWithResult(_0x5cee64,null))[_0xce33('0x48')](function(_0x42e9ba){console[_0xce33('0x74')](_0xce33('0x75')+_0x42e9ba);var _0x471db1=_0x36339b['query']['test']?0x1f4:_0x42e9ba[_0xce33('0x76')]||0x1f4;logger[_0xce33('0x29')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x471db1,JSON[_0xce33('0x77')](_0x42e9ba));delete _0x42e9ba[_0xce33('0x2a')];if(_0x471db1===0x191){_0x471db1=0x190;}_0x5cee64[_0xce33('0x1c')](_0x471db1)[_0xce33('0x2b')](_0x36339b[_0xce33('0x35')][_0xce33('0x78')]?{'message':_0xce33('0x79'),'statusCode':_0x42e9ba[_0xce33('0x76')]}:_0x42e9ba);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 7c17f75..ab1db30 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 _0x198b=['int_vtiger_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x3af704,_0x58486b){var _0x4ac16c=function(_0x1a49b8){while(--_0x1a49b8){_0x3af704['push'](_0x3af704['shift']());}};_0x4ac16c(++_0x58486b);}(_0x198b,0x160));var _0xb198=function(_0x208fa8,_0x58d1f2){_0x208fa8=_0x208fa8-0x0;var _0x43c719=_0x198b[_0x208fa8];return _0x43c719;};'use strict';var _=require(_0xb198('0x0'));var util=require(_0xb198('0x1'));var logger=require(_0xb198('0x2'))('api');var moment=require(_0xb198('0x3'));var BPromise=require(_0xb198('0x4'));var rp=require(_0xb198('0x5'));var fs=require('fs');var path=require(_0xb198('0x6'));var rimraf=require('rimraf');var config=require(_0xb198('0x7'));var attributes=require(_0xb198('0x8'));var integrations=require(_0xb198('0x9'));module[_0xb198('0xa')]=function(_0x139371,_0x444f7e){return _0x139371[_0xb198('0xb')]('VtigerAccount',attributes,{'tableName':_0xb198('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6cd6=['define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x3f3b97,_0x395d93){var _0xb6ab0c=function(_0x330c5a){while(--_0x330c5a){_0x3f3b97['push'](_0x3f3b97['shift']());}};_0xb6ab0c(++_0x395d93);}(_0x6cd6,0xb7));var _0x66cd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6cd6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x66cd('0x0'));var util=require(_0x66cd('0x1'));var logger=require(_0x66cd('0x2'))(_0x66cd('0x3'));var moment=require(_0x66cd('0x4'));var BPromise=require(_0x66cd('0x5'));var rp=require(_0x66cd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x66cd('0x7'));var config=require(_0x66cd('0x8'));var attributes=require(_0x66cd('0x9'));var integrations=require(_0x66cd('0xa'));module[_0x66cd('0xb')]=function(_0x22584d,_0x14d43e){return _0x22584d[_0x66cd('0xc')](_0x66cd('0xd'),attributes,{'tableName':_0x66cd('0xe'),'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 1dd1565..d7ba7bd 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 _0x1775=['stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','attributes','limit','map','include','model','ShowVtigerAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3f2cc0,_0x2bc849){var _0x1883c3=function(_0x275290){while(--_0x275290){_0x3f2cc0['push'](_0x3f2cc0['shift']());}};_0x1883c3(++_0x2bc849);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var config=require(_0x5177('0x9'));var jayson=require(_0x5177('0xa'));var client=jayson[_0x5177('0xb')][_0x5177('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ac1c6,_0x300b43,_0x245c12){return new BPromise(function(_0x363611,_0x3ce288){return client[_0x5177('0xd')](_0x2ac1c6,_0x245c12)[_0x5177('0xe')](function(_0x2c23d8){logger[_0x5177('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x300b43,'request\x20sent');logger[_0x5177('0x10')](_0x5177('0x11'),_0x300b43,_0x5177('0x12'),JSON[_0x5177('0x13')](_0x2c23d8));if(_0x2c23d8[_0x5177('0x14')]){if(_0x2c23d8['error'][_0x5177('0x15')]===0x1f4){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x3ce288(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x363611(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}else{logger[_0x5177('0xf')](_0x5177('0x16'),_0x300b43,_0x5177('0x12'));_0x363611(_0x2c23d8[_0x5177('0x18')][_0x5177('0x17')]);}})[_0x5177('0x19')](function(_0x50ce2c){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x50ce2c);_0x3ce288(_0x50ce2c);});});}exports[_0x5177('0x1a')]=function(_0x1b4102){var _0x5f5bd4=this;return new Promise(function(_0x3e6944,_0x2ebf91){return db[_0x5177('0x1b')]['findAll']({'raw':_0x1b4102[_0x5177('0x1c')]?_0x1b4102['options'][_0x5177('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')][_0x5177('0x1e')]||null:null,'attributes':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')][_0x5177('0x1f')]||null:null,'limit':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')][_0x5177('0x20')]||null:null,'include':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')]['include']?_[_0x5177('0x21')](_0x1b4102['options'][_0x5177('0x22')],function(_0x2c68d8){return{'model':db[_0x2c68d8[_0x5177('0x23')]],'as':_0x2c68d8['as'],'attributes':_0x2c68d8[_0x5177('0x1f')],'include':_0x2c68d8['include']?_[_0x5177('0x21')](_0x2c68d8['include'],function(_0x564139){return{'model':db[_0x564139[_0x5177('0x23')]],'as':_0x564139['as'],'attributes':_0x564139[_0x5177('0x1f')],'include':_0x564139['include']?_[_0x5177('0x21')](_0x564139['include'],function(_0x231d35){return{'model':db[_0x231d35[_0x5177('0x23')]],'as':_0x231d35['as'],'attributes':_0x231d35['attributes']};}):[]};}):[]};}):[]:[]})[_0x5177('0xe')](function(_0x2554ec){logger[_0x5177('0xf')](_0x5177('0x1a'),_0x1b4102);logger[_0x5177('0x10')](_0x5177('0x1a'),_0x1b4102,JSON['stringify'](_0x2554ec));_0x3e6944(_0x2554ec);})['catch'](function(_0x45cf20){logger[_0x5177('0x14')](_0x5177('0x1a'),_0x45cf20[_0x5177('0x17')],_0x1b4102);_0x2ebf91(_0x5f5bd4[_0x5177('0x14')](0x1f4,_0x45cf20[_0x5177('0x17')]));});});};exports[_0x5177('0x24')]=function(_0x72dced){var _0x49f6f1=this;return new Promise(function(_0x42e1db,_0x2233a2){return db['VtigerAccount'][_0x5177('0x25')]({'raw':_0x72dced['options']?_0x72dced[_0x5177('0x1c')][_0x5177('0x1d')]===undefined?!![]:![]:!![],'where':_0x72dced[_0x5177('0x1c')]?_0x72dced['options']['where']||null:null,'attributes':_0x72dced[_0x5177('0x1c')]?_0x72dced[_0x5177('0x1c')][_0x5177('0x1f')]||null:null,'include':_0x72dced[_0x5177('0x1c')]?_0x72dced[_0x5177('0x1c')][_0x5177('0x22')]?_[_0x5177('0x21')](_0x72dced[_0x5177('0x1c')]['include'],function(_0x459ac6){return{'model':db[_0x459ac6[_0x5177('0x23')]],'as':_0x459ac6['as'],'attributes':_0x459ac6['attributes'],'include':_0x459ac6[_0x5177('0x22')]?_[_0x5177('0x21')](_0x459ac6[_0x5177('0x22')],function(_0x8727c6){return{'model':db[_0x8727c6[_0x5177('0x23')]],'as':_0x8727c6['as'],'attributes':_0x8727c6[_0x5177('0x1f')],'include':_0x8727c6['include']?_[_0x5177('0x21')](_0x8727c6[_0x5177('0x22')],function(_0x28b1d5){return{'model':db[_0x28b1d5[_0x5177('0x23')]],'as':_0x28b1d5['as'],'attributes':_0x28b1d5[_0x5177('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5177('0xe')](function(_0x1bb1e3){logger['info'](_0x5177('0x24'),_0x72dced);logger[_0x5177('0x10')]('ShowVtigerAccount',_0x72dced,JSON['stringify'](_0x1bb1e3));_0x42e1db(_0x1bb1e3);})[_0x5177('0x19')](function(_0x188cec){logger[_0x5177('0x14')](_0x5177('0x24'),_0x188cec[_0x5177('0x17')],_0x72dced);_0x2233a2(_0x49f6f1[_0x5177('0x14')](0x1f4,_0x188cec[_0x5177('0x17')]));});});}; \ No newline at end of file +var _0x0102=['util','moment','bluebird','randomstring','../../config/environment','jayson/promise','client','http','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','include','model','map','find','ShowVtigerAccount'];(function(_0x1829d2,_0x3ab0ec){var _0x49a348=function(_0x10850a){while(--_0x10850a){_0x1829d2['push'](_0x1829d2['shift']());}};_0x49a348(++_0x3ab0ec);}(_0x0102,0x186));var _0x2010=function(_0x32fa77,_0x211b86){_0x32fa77=_0x32fa77-0x0;var _0x4888d6=_0x0102[_0x32fa77];return _0x4888d6;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var moment=require(_0x2010('0x1'));var BPromise=require(_0x2010('0x2'));var rs=require(_0x2010('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2010('0x4'));var jayson=require(_0x2010('0x5'));var client=jayson[_0x2010('0x6')][_0x2010('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4eeb67,_0x453fc0,_0x495d98){return new BPromise(function(_0x4728c0,_0x160e41){return client['request'](_0x4eeb67,_0x495d98)[_0x2010('0x8')](function(_0x3c2d98){logger[_0x2010('0x9')](_0x2010('0xa'),_0x453fc0,_0x2010('0xb'));logger[_0x2010('0xc')](_0x2010('0xd'),_0x453fc0,_0x2010('0xb'),JSON[_0x2010('0xe')](_0x3c2d98));if(_0x3c2d98[_0x2010('0xf')]){if(_0x3c2d98[_0x2010('0xf')][_0x2010('0x10')]===0x1f4){logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);return _0x160e41(_0x3c2d98['error']['message']);}logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);return _0x4728c0(_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);}else{logger['info'](_0x2010('0xa'),_0x453fc0,_0x2010('0xb'));_0x4728c0(_0x3c2d98['result'][_0x2010('0x11')]);}})[_0x2010('0x12')](function(_0x410889){logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x410889);_0x160e41(_0x410889);});});}exports[_0x2010('0x13')]=function(_0x83cd35){var _0x1476c0=this;return new Promise(function(_0x309477,_0x569de2){return db['VtigerAccount'][_0x2010('0x14')]({'raw':_0x83cd35[_0x2010('0x15')]?_0x83cd35[_0x2010('0x15')][_0x2010('0x16')]===undefined?!![]:![]:!![],'where':_0x83cd35['options']?_0x83cd35['options'][_0x2010('0x17')]||null:null,'attributes':_0x83cd35[_0x2010('0x15')]?_0x83cd35[_0x2010('0x15')][_0x2010('0x18')]||null:null,'limit':_0x83cd35[_0x2010('0x15')]?_0x83cd35[_0x2010('0x15')]['limit']||null:null,'include':_0x83cd35[_0x2010('0x15')]?_0x83cd35[_0x2010('0x15')]['include']?_['map'](_0x83cd35['options'][_0x2010('0x19')],function(_0x574719){return{'model':db[_0x574719[_0x2010('0x1a')]],'as':_0x574719['as'],'attributes':_0x574719['attributes'],'include':_0x574719['include']?_[_0x2010('0x1b')](_0x574719[_0x2010('0x19')],function(_0x52b4fe){return{'model':db[_0x52b4fe[_0x2010('0x1a')]],'as':_0x52b4fe['as'],'attributes':_0x52b4fe['attributes'],'include':_0x52b4fe[_0x2010('0x19')]?_[_0x2010('0x1b')](_0x52b4fe[_0x2010('0x19')],function(_0x3dcea4){return{'model':db[_0x3dcea4[_0x2010('0x1a')]],'as':_0x3dcea4['as'],'attributes':_0x3dcea4[_0x2010('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2010('0x8')](function(_0x3eb4dc){logger[_0x2010('0x9')](_0x2010('0x13'),_0x83cd35);logger[_0x2010('0xc')](_0x2010('0x13'),_0x83cd35,JSON['stringify'](_0x3eb4dc));_0x309477(_0x3eb4dc);})[_0x2010('0x12')](function(_0x52fe5e){logger[_0x2010('0xf')](_0x2010('0x13'),_0x52fe5e[_0x2010('0x11')],_0x83cd35);_0x569de2(_0x1476c0[_0x2010('0xf')](0x1f4,_0x52fe5e['message']));});});};exports['ShowVtigerAccount']=function(_0x136d5f){var _0x48d9f2=this;return new Promise(function(_0x2839f2,_0x1d5d7a){return db['VtigerAccount'][_0x2010('0x1c')]({'raw':_0x136d5f[_0x2010('0x15')]?_0x136d5f[_0x2010('0x15')][_0x2010('0x16')]===undefined?!![]:![]:!![],'where':_0x136d5f[_0x2010('0x15')]?_0x136d5f['options'][_0x2010('0x17')]||null:null,'attributes':_0x136d5f[_0x2010('0x15')]?_0x136d5f[_0x2010('0x15')]['attributes']||null:null,'include':_0x136d5f['options']?_0x136d5f[_0x2010('0x15')][_0x2010('0x19')]?_[_0x2010('0x1b')](_0x136d5f['options']['include'],function(_0xac64e1){return{'model':db[_0xac64e1[_0x2010('0x1a')]],'as':_0xac64e1['as'],'attributes':_0xac64e1[_0x2010('0x18')],'include':_0xac64e1[_0x2010('0x19')]?_[_0x2010('0x1b')](_0xac64e1['include'],function(_0x569e13){return{'model':db[_0x569e13['model']],'as':_0x569e13['as'],'attributes':_0x569e13[_0x2010('0x18')],'include':_0x569e13[_0x2010('0x19')]?_[_0x2010('0x1b')](_0x569e13['include'],function(_0x1f7f49){return{'model':db[_0x1f7f49[_0x2010('0x1a')]],'as':_0x1f7f49['as'],'attributes':_0x1f7f49[_0x2010('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2010('0x8')](function(_0x4f5106){logger[_0x2010('0x9')](_0x2010('0x1d'),_0x136d5f);logger[_0x2010('0xc')]('ShowVtigerAccount',_0x136d5f,JSON[_0x2010('0xe')](_0x4f5106));_0x2839f2(_0x4f5106);})['catch'](function(_0x13f88a){logger[_0x2010('0xf')](_0x2010('0x1d'),_0x13f88a[_0x2010('0x11')],_0x136d5f);_0x1d5d7a(_0x48d9f2[_0x2010('0xf')](0x1f4,_0x13f88a[_0x2010('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 4653eff..88d031e 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 _0x3f69=['create','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x3f69,0xf3));var _0x93f6=function(_0x2ce0a1,_0xec4d94){_0x2ce0a1=_0x2ce0a1-0x0;var _0x40774d=_0x3f69[_0x2ce0a1];return _0x40774d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x93f6('0x0'));var timeout=require('connect-timeout');var express=require(_0x93f6('0x1'));var router=express[_0x93f6('0x2')]();var fs_extra=require(_0x93f6('0x3'));var auth=require(_0x93f6('0x4'));var interaction=require(_0x93f6('0x5'));var config=require('../../config/environment');var controller=require(_0x93f6('0x6'));router[_0x93f6('0x7')]('/',auth[_0x93f6('0x8')](),controller[_0x93f6('0x9')]);router['get'](_0x93f6('0xa'),auth[_0x93f6('0x8')](),controller[_0x93f6('0xb')]);router[_0x93f6('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['get'](_0x93f6('0xc'),auth[_0x93f6('0x8')](),controller[_0x93f6('0xd')]);router['get'](_0x93f6('0xe'),auth['isAuthenticated'](),controller[_0x93f6('0xf')]);router[_0x93f6('0x10')]('/',auth[_0x93f6('0x8')](),controller[_0x93f6('0x11')]);router['put']('/:id',auth[_0x93f6('0x8')](),controller['update']);router['delete']('/:id',auth[_0x93f6('0x8')](),controller[_0x93f6('0x12')]);module[_0x93f6('0x13')]=router; \ No newline at end of file +var _0xbd3c=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../config/environment','./intVtigerConfiguration.controller','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects'];(function(_0x53cd00,_0x5055ce){var _0x3659c8=function(_0x49f58f){while(--_0x49f58f){_0x53cd00['push'](_0x53cd00['shift']());}};_0x3659c8(++_0x5055ce);}(_0xbd3c,0x8c));var _0xcbd3=function(_0x45f672,_0xdb7d8e){_0x45f672=_0x45f672-0x0;var _0x5211b8=_0xbd3c[_0x45f672];return _0x5211b8;};'use strict';var multer=require(_0xcbd3('0x0'));var util=require(_0xcbd3('0x1'));var path=require(_0xcbd3('0x2'));var timeout=require(_0xcbd3('0x3'));var express=require(_0xcbd3('0x4'));var router=express[_0xcbd3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcbd3('0x6'));var controller=require(_0xcbd3('0x7'));router[_0xcbd3('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xcbd3('0x9'),auth[_0xcbd3('0xa')](),controller['show']);router[_0xcbd3('0x8')](_0xcbd3('0xb'),auth[_0xcbd3('0xa')](),controller[_0xcbd3('0xc')]);router['get'](_0xcbd3('0xd'),auth['isAuthenticated'](),controller[_0xcbd3('0xe')]);router['get'](_0xcbd3('0xf'),auth[_0xcbd3('0xa')](),controller[_0xcbd3('0x10')]);router[_0xcbd3('0x11')]('/',auth[_0xcbd3('0xa')](),controller[_0xcbd3('0x12')]);router[_0xcbd3('0x13')]('/:id',auth[_0xcbd3('0xa')](),controller[_0xcbd3('0x14')]);router[_0xcbd3('0x15')](_0xcbd3('0x9'),auth[_0xcbd3('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index fb6f049..d33ec35 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 _0x1fd5=['sequelize','exports'];(function(_0x3da707,_0x30c36d){var _0x342ee7=function(_0x175135){while(--_0x175135){_0x3da707['push'](_0x3da707['shift']());}};_0x342ee7(++_0x30c36d);}(_0x1fd5,0x108));var _0x51fd=function(_0x56338a,_0x1d112e){_0x56338a=_0x56338a-0x0;var _0x404efd=_0x1fd5[_0x56338a];return _0x404efd;};'use strict';var Sequelize=require(_0x51fd('0x0'));module[_0x51fd('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xccea=['STRING','sequelize','exports'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xccea,0x196));var _0xacce=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xccea[_0xa6cc5c];return _0x44803d;};'use strict';var Sequelize=require(_0xacce('0x0'));module[_0xacce('0x1')]={'name':{'type':Sequelize[_0xacce('0x2')]},'description':{'type':Sequelize[_0xacce('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 00179bc..c7dee35 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 _0x1fe2=['map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','hasOwnProperty','getSubjects','getDescriptions','VtigerField','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model'];(function(_0x17073a,_0x49b061){var _0x4c4259=function(_0xaf556d){while(--_0xaf556d){_0x17073a['push'](_0x17073a['shift']());}};_0x4c4259(++_0x49b061);}(_0x1fe2,0x72));var _0x21fe=function(_0x38897b,_0x2e748f){_0x38897b=_0x38897b-0x0;var _0x27ccc4=_0x1fe2[_0x38897b];return _0x27ccc4;};'use strict';var emlformat=require(_0x21fe('0x0'));var rimraf=require(_0x21fe('0x1'));var zipdir=require(_0x21fe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21fe('0x3'));var moment=require(_0x21fe('0x4'));var BPromise=require(_0x21fe('0x5'));var Mustache=require(_0x21fe('0x6'));var util=require(_0x21fe('0x7'));var path=require('path');var sox=require(_0x21fe('0x8'));var csv=require(_0x21fe('0x9'));var ejs=require(_0x21fe('0xa'));var fs=require('fs');var fs_extra=require(_0x21fe('0xb'));var _=require(_0x21fe('0xc'));var squel=require('squel');var crypto=require(_0x21fe('0xd'));var jsforce=require(_0x21fe('0xe'));var deskjs=require(_0x21fe('0xf'));var toCsv=require(_0x21fe('0x9'));var querystring=require('querystring');var Papa=require(_0x21fe('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x21fe('0x11'));var logger=require(_0x21fe('0x12'))(_0x21fe('0x13'));var utils=require('../../config/utils');var config=require(_0x21fe('0x14'));var licenseUtil=require(_0x21fe('0x15'));var db=require(_0x21fe('0x16'))['db'];function respondWithStatusCode(_0x5cb17e,_0x257be5){_0x257be5=_0x257be5||0xcc;return function(_0xb5260e){if(_0xb5260e){return _0x5cb17e[_0x21fe('0x17')](_0x257be5);}return _0x5cb17e['status'](_0x257be5)[_0x21fe('0x18')]();};}function respondWithResult(_0x2ec17d,_0x12a383){_0x12a383=_0x12a383||0xc8;return function(_0x3edea7){if(_0x3edea7){return _0x2ec17d[_0x21fe('0x19')](_0x12a383)[_0x21fe('0x1a')](_0x3edea7);}};}function respondWithFilteredResult(_0x1fa00c,_0x38d9ab){return function(_0x5cff2a){if(_0x5cff2a){var _0x15f42c=typeof _0x38d9ab['offset']===_0x21fe('0x1b')&&typeof _0x38d9ab[_0x21fe('0x1c')]===_0x21fe('0x1b');var _0x24cfd5=_0x5cff2a[_0x21fe('0x1d')];var _0x433887=_0x15f42c?0x0:_0x38d9ab[_0x21fe('0x1e')];var _0x2fed82=_0x15f42c?_0x5cff2a[_0x21fe('0x1d')]:_0x38d9ab['offset']+_0x38d9ab[_0x21fe('0x1c')];var _0x4d1801;if(_0x2fed82>=_0x24cfd5){_0x2fed82=_0x24cfd5;_0x4d1801=0xc8;}else{_0x4d1801=0xce;}_0x1fa00c[_0x21fe('0x19')](_0x4d1801);return _0x1fa00c[_0x21fe('0x1f')](_0x21fe('0x20'),_0x433887+'-'+_0x2fed82+'/'+_0x24cfd5)[_0x21fe('0x1a')](_0x5cff2a);}return null;};}function patchUpdates(_0x19fee3){return function(_0x1e7ced){try{jsonpatch[_0x21fe('0x21')](_0x1e7ced,_0x19fee3,!![]);}catch(_0x4d7d05){return BPromise[_0x21fe('0x22')](_0x4d7d05);}return _0x1e7ced[_0x21fe('0x23')]();};}function saveUpdates(_0xdfcf8b,_0x17f0a7){return function(_0x244d44){if(_0x244d44){return _0x244d44[_0x21fe('0x24')](_0xdfcf8b)[_0x21fe('0x25')](function(_0x47d287){return _0x47d287;});}return null;};}function removeEntity(_0x12db1d,_0x2229bc){return function(_0xc71dac){if(_0xc71dac){return _0xc71dac[_0x21fe('0x26')]()[_0x21fe('0x25')](function(){_0x12db1d[_0x21fe('0x19')](0xcc)[_0x21fe('0x18')]();});}};}function handleEntityNotFound(_0x10729e,_0x249185){return function(_0x32e2bd){if(!_0x32e2bd){_0x10729e[_0x21fe('0x17')](0x194);}return _0x32e2bd;};}function handleError(_0x215afe,_0x19b389){_0x19b389=_0x19b389||0x1f4;return function(_0x1092cc){logger[_0x21fe('0x27')](_0x1092cc['stack']);if(_0x1092cc[_0x21fe('0x28')]){delete _0x1092cc[_0x21fe('0x28')];}_0x215afe['status'](_0x19b389)['send'](_0x1092cc);};}exports[_0x21fe('0x29')]=function(_0x3732b5,_0x5cc120){var _0x3d16dd={},_0x566a97={},_0x5acd67={'count':0x0,'rows':[]};var _0x9385ee=_['map'](db[_0x21fe('0x2a')][_0x21fe('0x2b')],function(_0x3a9947){return{'name':_0x3a9947[_0x21fe('0x2c')],'type':_0x3a9947[_0x21fe('0x2d')][_0x21fe('0x2e')]};});_0x566a97[_0x21fe('0x2f')]=_[_0x21fe('0x30')](_0x9385ee,_0x21fe('0x28'));_0x566a97[_0x21fe('0x31')]=_[_0x21fe('0x32')](_0x3732b5[_0x21fe('0x31')]);_0x566a97[_0x21fe('0x33')]=_['intersection'](_0x566a97[_0x21fe('0x2f')],_0x566a97['query']);_0x3d16dd[_0x21fe('0x34')]=_[_0x21fe('0x35')](_0x566a97[_0x21fe('0x2f')],qs[_0x21fe('0x36')](_0x3732b5['query'][_0x21fe('0x36')]));_0x3d16dd[_0x21fe('0x34')]=_0x3d16dd[_0x21fe('0x34')][_0x21fe('0x37')]?_0x3d16dd[_0x21fe('0x34')]:_0x566a97[_0x21fe('0x2f')];if(!_0x3732b5[_0x21fe('0x31')]['hasOwnProperty'](_0x21fe('0x38'))){_0x3d16dd[_0x21fe('0x1c')]=qs['limit'](_0x3732b5['query'][_0x21fe('0x1c')]);_0x3d16dd[_0x21fe('0x1e')]=qs['offset'](_0x3732b5[_0x21fe('0x31')][_0x21fe('0x1e')]);}_0x3d16dd[_0x21fe('0x39')]=qs[_0x21fe('0x3a')](_0x3732b5[_0x21fe('0x31')]['sort']);_0x3d16dd['where']=qs[_0x21fe('0x33')](_[_0x21fe('0x3b')](_0x3732b5[_0x21fe('0x31')],_0x566a97[_0x21fe('0x33')]),_0x9385ee);if(_0x3732b5[_0x21fe('0x31')]['filter']){_0x3d16dd[_0x21fe('0x3c')]=_[_0x21fe('0x3d')](_0x3d16dd[_0x21fe('0x3c')],{'$or':_[_0x21fe('0x30')](_0x9385ee,function(_0x5f556c){if(_0x5f556c[_0x21fe('0x2d')]!==_0x21fe('0x3e')){var _0x4b8aeb={};_0x4b8aeb[_0x5f556c[_0x21fe('0x28')]]={'$like':'%'+_0x3732b5[_0x21fe('0x31')][_0x21fe('0x3f')]+'%'};return _0x4b8aeb;}})});}_0x3d16dd=_[_0x21fe('0x3d')]({},_0x3d16dd,_0x3732b5[_0x21fe('0x40')]);var _0x236bd1={'where':_0x3d16dd['where']};return db[_0x21fe('0x2a')][_0x21fe('0x1d')](_0x236bd1)['then'](function(_0x35a486){_0x5acd67[_0x21fe('0x1d')]=_0x35a486;if(_0x3732b5[_0x21fe('0x31')][_0x21fe('0x41')]){_0x3d16dd[_0x21fe('0x42')]=[{'all':!![]}];}return db[_0x21fe('0x2a')][_0x21fe('0x43')](_0x3d16dd);})[_0x21fe('0x25')](function(_0x46c5b8){_0x5acd67[_0x21fe('0x44')]=_0x46c5b8;return _0x5acd67;})['then'](respondWithFilteredResult(_0x5cc120,_0x3d16dd))[_0x21fe('0x45')](handleError(_0x5cc120,null));};exports[_0x21fe('0x46')]=function(_0x2d4737,_0x31e749){var _0x572d9a={'raw':![],'where':{'id':_0x2d4737[_0x21fe('0x47')]['id']}},_0x460d8f={};_0x460d8f[_0x21fe('0x2f')]=_[_0x21fe('0x32')](db[_0x21fe('0x2a')][_0x21fe('0x2b')]);_0x460d8f['query']=_[_0x21fe('0x32')](_0x2d4737[_0x21fe('0x31')]);_0x460d8f['filters']=_[_0x21fe('0x35')](_0x460d8f[_0x21fe('0x2f')],_0x460d8f[_0x21fe('0x31')]);_0x572d9a[_0x21fe('0x34')]=_['intersection'](_0x460d8f[_0x21fe('0x2f')],qs['fields'](_0x2d4737['query'][_0x21fe('0x36')]));_0x572d9a[_0x21fe('0x34')]=_0x572d9a['attributes'][_0x21fe('0x37')]?_0x572d9a[_0x21fe('0x34')]:_0x460d8f[_0x21fe('0x2f')];if(_0x2d4737[_0x21fe('0x31')][_0x21fe('0x41')]){_0x572d9a[_0x21fe('0x42')]=[{'all':!![]}];}_0x572d9a=_[_0x21fe('0x3d')]({},_0x572d9a,_0x2d4737['options']);return db['VtigerConfiguration'][_0x21fe('0x48')](_0x572d9a)['then'](handleEntityNotFound(_0x31e749,null))[_0x21fe('0x25')](respondWithResult(_0x31e749,null))[_0x21fe('0x45')](handleError(_0x31e749,null));};exports[_0x21fe('0x49')]=function(_0x4e7c3e,_0x451df9){return db['VtigerConfiguration']['create'](_0x4e7c3e['body'],{})[_0x21fe('0x25')](respondWithResult(_0x451df9,0xc9))[_0x21fe('0x45')](handleError(_0x451df9,null));};exports[_0x21fe('0x24')]=function(_0x4b91f5,_0x42ba11){if(_0x4b91f5[_0x21fe('0x4a')]['id']){delete _0x4b91f5[_0x21fe('0x4a')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x4b91f5[_0x21fe('0x47')]['id']}})[_0x21fe('0x25')](handleEntityNotFound(_0x42ba11,null))[_0x21fe('0x25')](saveUpdates(_0x4b91f5[_0x21fe('0x4a')],null))[_0x21fe('0x25')](respondWithResult(_0x42ba11,null))[_0x21fe('0x45')](handleError(_0x42ba11,null));};exports[_0x21fe('0x26')]=function(_0x534da7,_0x3a06ad){return db[_0x21fe('0x2a')][_0x21fe('0x48')]({'where':{'id':_0x534da7[_0x21fe('0x47')]['id']}})[_0x21fe('0x25')](handleEntityNotFound(_0x3a06ad,null))[_0x21fe('0x25')](removeEntity(_0x3a06ad,null))['catch'](handleError(_0x3a06ad,null));};exports[_0x21fe('0x4b')]=function(_0x56235d,_0x15233a,_0x5b83d5){var _0x5130eb={};var _0x566f11={};var _0x4ff8f3;var _0x127eb4;return db[_0x21fe('0x2a')][_0x21fe('0x4c')]({'where':{'id':_0x56235d['params']['id']}})[_0x21fe('0x25')](handleEntityNotFound(_0x15233a,null))['then'](function(_0x5b5458){if(_0x5b5458){_0x4ff8f3=_0x5b5458;_0x566f11[_0x21fe('0x2f')]=_[_0x21fe('0x32')](db['VtigerField'][_0x21fe('0x2b')]);_0x566f11[_0x21fe('0x31')]=_[_0x21fe('0x32')](_0x56235d[_0x21fe('0x31')]);_0x566f11[_0x21fe('0x33')]=_['intersection'](_0x566f11[_0x21fe('0x2f')],_0x566f11[_0x21fe('0x31')]);_0x5130eb['attributes']=_[_0x21fe('0x35')](_0x566f11[_0x21fe('0x2f')],qs[_0x21fe('0x36')](_0x56235d['query'][_0x21fe('0x36')]));_0x5130eb[_0x21fe('0x34')]=_0x5130eb[_0x21fe('0x34')][_0x21fe('0x37')]?_0x5130eb[_0x21fe('0x34')]:_0x566f11[_0x21fe('0x2f')];_0x5130eb[_0x21fe('0x39')]=qs[_0x21fe('0x3a')](_0x56235d[_0x21fe('0x31')][_0x21fe('0x3a')]);_0x5130eb[_0x21fe('0x3c')]=qs['filters'](_['pick'](_0x56235d[_0x21fe('0x31')],_0x566f11[_0x21fe('0x33')]));if(_0x56235d['query'][_0x21fe('0x3f')]){_0x5130eb[_0x21fe('0x3c')]=_[_0x21fe('0x3d')](_0x5130eb[_0x21fe('0x3c')],{'$or':_['map'](_0x5130eb[_0x21fe('0x34')],function(_0x29ee4b){var _0x57745e={};_0x57745e[_0x29ee4b]={'$like':'%'+_0x56235d['query'][_0x21fe('0x3f')]+'%'};return _0x57745e;})});}_0x5130eb=_[_0x21fe('0x3d')]({},_0x5130eb,_0x56235d[_0x21fe('0x40')]);return _0x4ff8f3[_0x21fe('0x4b')](_0x5130eb);}})[_0x21fe('0x25')](function(_0x292e43){if(_0x292e43){_0x127eb4=_0x292e43['length'];if(!_0x56235d[_0x21fe('0x31')][_0x21fe('0x4d')](_0x21fe('0x38'))){_0x5130eb['limit']=qs[_0x21fe('0x1c')](_0x56235d[_0x21fe('0x31')][_0x21fe('0x1c')]);_0x5130eb[_0x21fe('0x1e')]=qs[_0x21fe('0x1e')](_0x56235d[_0x21fe('0x31')][_0x21fe('0x1e')]);}return _0x4ff8f3[_0x21fe('0x4b')](_0x5130eb);}})[_0x21fe('0x25')](function(_0x502bd7){if(_0x502bd7){return _0x502bd7?{'count':_0x127eb4,'rows':_0x502bd7}:null;}})['then'](respondWithResult(_0x15233a,null))[_0x21fe('0x45')](handleError(_0x15233a,null));};exports[_0x21fe('0x4e')]=function(_0x168ca9,_0x8299f6,_0x3c69d9){var _0x54becd={};var _0x54c2fc={};var _0x88ee11;var _0x1af880;return db[_0x21fe('0x2a')][_0x21fe('0x4c')]({'where':{'id':_0x168ca9[_0x21fe('0x47')]['id']}})[_0x21fe('0x25')](handleEntityNotFound(_0x8299f6,null))['then'](function(_0x28de7e){if(_0x28de7e){_0x88ee11=_0x28de7e;_0x54c2fc[_0x21fe('0x2f')]=_[_0x21fe('0x32')](db['VtigerField']['rawAttributes']);_0x54c2fc[_0x21fe('0x31')]=_[_0x21fe('0x32')](_0x168ca9[_0x21fe('0x31')]);_0x54c2fc['filters']=_['intersection'](_0x54c2fc[_0x21fe('0x2f')],_0x54c2fc[_0x21fe('0x31')]);_0x54becd[_0x21fe('0x34')]=_[_0x21fe('0x35')](_0x54c2fc[_0x21fe('0x2f')],qs[_0x21fe('0x36')](_0x168ca9[_0x21fe('0x31')]['fields']));_0x54becd['attributes']=_0x54becd[_0x21fe('0x34')][_0x21fe('0x37')]?_0x54becd[_0x21fe('0x34')]:_0x54c2fc[_0x21fe('0x2f')];_0x54becd[_0x21fe('0x39')]=qs[_0x21fe('0x3a')](_0x168ca9[_0x21fe('0x31')][_0x21fe('0x3a')]);_0x54becd[_0x21fe('0x3c')]=qs['filters'](_['pick'](_0x168ca9[_0x21fe('0x31')],_0x54c2fc[_0x21fe('0x33')]));if(_0x168ca9[_0x21fe('0x31')][_0x21fe('0x3f')]){_0x54becd['where']=_[_0x21fe('0x3d')](_0x54becd[_0x21fe('0x3c')],{'$or':_[_0x21fe('0x30')](_0x54becd[_0x21fe('0x34')],function(_0x1997ca){var _0x188006={};_0x188006[_0x1997ca]={'$like':'%'+_0x168ca9[_0x21fe('0x31')][_0x21fe('0x3f')]+'%'};return _0x188006;})});}_0x54becd=_[_0x21fe('0x3d')]({},_0x54becd,_0x168ca9['options']);return _0x88ee11[_0x21fe('0x4e')](_0x54becd);}})[_0x21fe('0x25')](function(_0x478608){if(_0x478608){_0x1af880=_0x478608[_0x21fe('0x37')];if(!_0x168ca9[_0x21fe('0x31')]['hasOwnProperty'](_0x21fe('0x38'))){_0x54becd[_0x21fe('0x1c')]=qs['limit'](_0x168ca9[_0x21fe('0x31')]['limit']);_0x54becd[_0x21fe('0x1e')]=qs[_0x21fe('0x1e')](_0x168ca9[_0x21fe('0x31')][_0x21fe('0x1e')]);}return _0x88ee11[_0x21fe('0x4e')](_0x54becd);}})['then'](function(_0x4dfcb9){if(_0x4dfcb9){return _0x4dfcb9?{'count':_0x1af880,'rows':_0x4dfcb9}:null;}})[_0x21fe('0x25')](respondWithResult(_0x8299f6,null))[_0x21fe('0x45')](handleError(_0x8299f6,null));};exports[_0x21fe('0x4f')]=function(_0x1d9054,_0x19540b,_0x2fedb2){var _0x3a9bcd={};var _0x189d82={};var _0x83acc2;var _0x10ed2d;return db['VtigerConfiguration'][_0x21fe('0x4c')]({'where':{'id':_0x1d9054['params']['id']}})['then'](handleEntityNotFound(_0x19540b,null))[_0x21fe('0x25')](function(_0x19407f){if(_0x19407f){_0x83acc2=_0x19407f;_0x189d82[_0x21fe('0x2f')]=_[_0x21fe('0x32')](db[_0x21fe('0x50')][_0x21fe('0x2b')]);_0x189d82[_0x21fe('0x31')]=_[_0x21fe('0x32')](_0x1d9054[_0x21fe('0x31')]);_0x189d82['filters']=_['intersection'](_0x189d82[_0x21fe('0x2f')],_0x189d82[_0x21fe('0x31')]);_0x3a9bcd['attributes']=_[_0x21fe('0x35')](_0x189d82[_0x21fe('0x2f')],qs['fields'](_0x1d9054[_0x21fe('0x31')][_0x21fe('0x36')]));_0x3a9bcd[_0x21fe('0x34')]=_0x3a9bcd['attributes'][_0x21fe('0x37')]?_0x3a9bcd[_0x21fe('0x34')]:_0x189d82[_0x21fe('0x2f')];_0x3a9bcd[_0x21fe('0x39')]=qs[_0x21fe('0x3a')](_0x1d9054[_0x21fe('0x31')]['sort']);_0x3a9bcd[_0x21fe('0x3c')]=qs[_0x21fe('0x33')](_[_0x21fe('0x3b')](_0x1d9054['query'],_0x189d82[_0x21fe('0x33')]));if(_0x1d9054[_0x21fe('0x31')][_0x21fe('0x3f')]){_0x3a9bcd[_0x21fe('0x3c')]=_[_0x21fe('0x3d')](_0x3a9bcd[_0x21fe('0x3c')],{'$or':_[_0x21fe('0x30')](_0x3a9bcd['attributes'],function(_0x211300){var _0x1ca845={};_0x1ca845[_0x211300]={'$like':'%'+_0x1d9054[_0x21fe('0x31')]['filter']+'%'};return _0x1ca845;})});}_0x3a9bcd=_[_0x21fe('0x3d')]({},_0x3a9bcd,_0x1d9054[_0x21fe('0x40')]);return _0x83acc2[_0x21fe('0x4f')](_0x3a9bcd);}})[_0x21fe('0x25')](function(_0x1f6379){if(_0x1f6379){_0x10ed2d=_0x1f6379[_0x21fe('0x37')];if(!_0x1d9054['query'][_0x21fe('0x4d')](_0x21fe('0x38'))){_0x3a9bcd[_0x21fe('0x1c')]=qs[_0x21fe('0x1c')](_0x1d9054[_0x21fe('0x31')]['limit']);_0x3a9bcd['offset']=qs[_0x21fe('0x1e')](_0x1d9054[_0x21fe('0x31')][_0x21fe('0x1e')]);}return _0x83acc2[_0x21fe('0x4f')](_0x3a9bcd);}})[_0x21fe('0x25')](function(_0x5e004b){if(_0x5e004b){return _0x5e004b?{'count':_0x10ed2d,'rows':_0x5e004b}:null;}})['then'](respondWithResult(_0x19540b,null))[_0x21fe('0x45')](handleError(_0x19540b,null));}; \ No newline at end of file +var _0x516b=['bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','error','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','nolimit','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','intersection','create','body','params','find','getFields','findOne','order','sort','hasOwnProperty','getSubjects','VtigerField','getDescriptions','eml-format','zip-dir','moment'];(function(_0x200608,_0x2d64c6){var _0x5a5772=function(_0x434e6e){while(--_0x434e6e){_0x200608['push'](_0x200608['shift']());}};_0x5a5772(++_0x2d64c6);}(_0x516b,0x1dd));var _0xb516=function(_0x19a61d,_0x55d5da){_0x19a61d=_0x19a61d-0x0;var _0xe7b18a=_0x516b[_0x19a61d];return _0xe7b18a;};'use strict';var emlformat=require(_0xb516('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb516('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb516('0x2'));var BPromise=require(_0xb516('0x3'));var Mustache=require(_0xb516('0x4'));var util=require(_0xb516('0x5'));var path=require(_0xb516('0x6'));var sox=require(_0xb516('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb516('0x8'));var _=require(_0xb516('0x9'));var squel=require(_0xb516('0xa'));var crypto=require('crypto');var jsforce=require(_0xb516('0xb'));var deskjs=require(_0xb516('0xc'));var toCsv=require(_0xb516('0xd'));var querystring=require(_0xb516('0xe'));var Papa=require(_0xb516('0xf'));var Redis=require(_0xb516('0x10'));var authService=require(_0xb516('0x11'));var qs=require(_0xb516('0x12'));var as=require(_0xb516('0x13'));var hardwareService=require(_0xb516('0x14'));var logger=require(_0xb516('0x15'))(_0xb516('0x16'));var utils=require(_0xb516('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb516('0x18'));var db=require(_0xb516('0x19'))['db'];function respondWithStatusCode(_0x12f5b2,_0x523468){_0x523468=_0x523468||0xcc;return function(_0x9e9264){if(_0x9e9264){return _0x12f5b2[_0xb516('0x1a')](_0x523468);}return _0x12f5b2[_0xb516('0x1b')](_0x523468)[_0xb516('0x1c')]();};}function respondWithResult(_0x393314,_0x297f0f){_0x297f0f=_0x297f0f||0xc8;return function(_0x24430){if(_0x24430){return _0x393314[_0xb516('0x1b')](_0x297f0f)['json'](_0x24430);}};}function respondWithFilteredResult(_0x265880,_0x2eae0b){return function(_0x3811ec){if(_0x3811ec){var _0x33937e=typeof _0x2eae0b[_0xb516('0x1d')]===_0xb516('0x1e')&&typeof _0x2eae0b[_0xb516('0x1f')]===_0xb516('0x1e');var _0x560e52=_0x3811ec[_0xb516('0x20')];var _0x6466e8=_0x33937e?0x0:_0x2eae0b[_0xb516('0x1d')];var _0x1b32d6=_0x33937e?_0x3811ec[_0xb516('0x20')]:_0x2eae0b[_0xb516('0x1d')]+_0x2eae0b[_0xb516('0x1f')];var _0x404f85;if(_0x1b32d6>=_0x560e52){_0x1b32d6=_0x560e52;_0x404f85=0xc8;}else{_0x404f85=0xce;}_0x265880[_0xb516('0x1b')](_0x404f85);return _0x265880[_0xb516('0x21')](_0xb516('0x22'),_0x6466e8+'-'+_0x1b32d6+'/'+_0x560e52)[_0xb516('0x23')](_0x3811ec);}return null;};}function patchUpdates(_0xbef853){return function(_0x2aa519){try{jsonpatch['apply'](_0x2aa519,_0xbef853,!![]);}catch(_0x31d66b){return BPromise[_0xb516('0x24')](_0x31d66b);}return _0x2aa519[_0xb516('0x25')]();};}function saveUpdates(_0xaf06ee,_0x14e644){return function(_0x1fe67d){if(_0x1fe67d){return _0x1fe67d[_0xb516('0x26')](_0xaf06ee)['then'](function(_0x9be8a0){return _0x9be8a0;});}return null;};}function removeEntity(_0x3fb361,_0x5334a5){return function(_0x4335a4){if(_0x4335a4){return _0x4335a4[_0xb516('0x27')]()[_0xb516('0x28')](function(){_0x3fb361[_0xb516('0x1b')](0xcc)[_0xb516('0x1c')]();});}};}function handleEntityNotFound(_0x5c07d2,_0x116fd2){return function(_0x508a0b){if(!_0x508a0b){_0x5c07d2[_0xb516('0x1a')](0x194);}return _0x508a0b;};}function handleError(_0x30e1cc,_0x4c5d6b){_0x4c5d6b=_0x4c5d6b||0x1f4;return function(_0x2f803c){logger[_0xb516('0x29')](_0x2f803c['stack']);if(_0x2f803c[_0xb516('0x2a')]){delete _0x2f803c[_0xb516('0x2a')];}_0x30e1cc['status'](_0x4c5d6b)['send'](_0x2f803c);};}exports[_0xb516('0x2b')]=function(_0x385ba7,_0x363143){var _0x29a392={},_0x51992c={},_0x1a8073={'count':0x0,'rows':[]};var _0x4cf425=_[_0xb516('0x2c')](db[_0xb516('0x2d')][_0xb516('0x2e')],function(_0x2ff9a6){return{'name':_0x2ff9a6[_0xb516('0x2f')],'type':_0x2ff9a6[_0xb516('0x30')]['key']};});_0x51992c[_0xb516('0x31')]=_[_0xb516('0x2c')](_0x4cf425,'name');_0x51992c[_0xb516('0x32')]=_[_0xb516('0x33')](_0x385ba7['query']);_0x51992c[_0xb516('0x34')]=_['intersection'](_0x51992c[_0xb516('0x31')],_0x51992c[_0xb516('0x32')]);_0x29a392[_0xb516('0x35')]=_['intersection'](_0x51992c[_0xb516('0x31')],qs[_0xb516('0x36')](_0x385ba7[_0xb516('0x32')][_0xb516('0x36')]));_0x29a392[_0xb516('0x35')]=_0x29a392[_0xb516('0x35')][_0xb516('0x37')]?_0x29a392[_0xb516('0x35')]:_0x51992c[_0xb516('0x31')];if(!_0x385ba7[_0xb516('0x32')]['hasOwnProperty'](_0xb516('0x38'))){_0x29a392[_0xb516('0x1f')]=qs['limit'](_0x385ba7[_0xb516('0x32')]['limit']);_0x29a392[_0xb516('0x1d')]=qs[_0xb516('0x1d')](_0x385ba7[_0xb516('0x32')][_0xb516('0x1d')]);}_0x29a392['order']=qs['sort'](_0x385ba7[_0xb516('0x32')]['sort']);_0x29a392[_0xb516('0x39')]=qs[_0xb516('0x34')](_[_0xb516('0x3a')](_0x385ba7[_0xb516('0x32')],_0x51992c[_0xb516('0x34')]),_0x4cf425);if(_0x385ba7[_0xb516('0x32')][_0xb516('0x3b')]){_0x29a392[_0xb516('0x39')]=_['merge'](_0x29a392[_0xb516('0x39')],{'$or':_[_0xb516('0x2c')](_0x4cf425,function(_0x539499){if(_0x539499[_0xb516('0x30')]!=='VIRTUAL'){var _0x126822={};_0x126822[_0x539499[_0xb516('0x2a')]]={'$like':'%'+_0x385ba7[_0xb516('0x32')]['filter']+'%'};return _0x126822;}})});}_0x29a392=_[_0xb516('0x3c')]({},_0x29a392,_0x385ba7[_0xb516('0x3d')]);var _0x1b9af6={'where':_0x29a392['where']};return db[_0xb516('0x2d')][_0xb516('0x20')](_0x1b9af6)[_0xb516('0x28')](function(_0x2ccc83){_0x1a8073[_0xb516('0x20')]=_0x2ccc83;if(_0x385ba7['query'][_0xb516('0x3e')]){_0x29a392[_0xb516('0x3f')]=[{'all':!![]}];}return db[_0xb516('0x2d')][_0xb516('0x40')](_0x29a392);})['then'](function(_0x105aba){_0x1a8073['rows']=_0x105aba;return _0x1a8073;})['then'](respondWithFilteredResult(_0x363143,_0x29a392))[_0xb516('0x41')](handleError(_0x363143,null));};exports[_0xb516('0x42')]=function(_0x2ce439,_0x4f8117){var _0x444578={'raw':![],'where':{'id':_0x2ce439['params']['id']}},_0x13f5d2={};_0x13f5d2[_0xb516('0x31')]=_[_0xb516('0x33')](db['VtigerConfiguration']['rawAttributes']);_0x13f5d2[_0xb516('0x32')]=_['keys'](_0x2ce439['query']);_0x13f5d2[_0xb516('0x34')]=_[_0xb516('0x43')](_0x13f5d2[_0xb516('0x31')],_0x13f5d2[_0xb516('0x32')]);_0x444578[_0xb516('0x35')]=_[_0xb516('0x43')](_0x13f5d2[_0xb516('0x31')],qs[_0xb516('0x36')](_0x2ce439[_0xb516('0x32')][_0xb516('0x36')]));_0x444578[_0xb516('0x35')]=_0x444578[_0xb516('0x35')][_0xb516('0x37')]?_0x444578[_0xb516('0x35')]:_0x13f5d2[_0xb516('0x31')];if(_0x2ce439[_0xb516('0x32')][_0xb516('0x3e')]){_0x444578['include']=[{'all':!![]}];}_0x444578=_[_0xb516('0x3c')]({},_0x444578,_0x2ce439[_0xb516('0x3d')]);return db['VtigerConfiguration']['find'](_0x444578)[_0xb516('0x28')](handleEntityNotFound(_0x4f8117,null))['then'](respondWithResult(_0x4f8117,null))[_0xb516('0x41')](handleError(_0x4f8117,null));};exports[_0xb516('0x44')]=function(_0x4f3230,_0x51769d){return db['VtigerConfiguration'][_0xb516('0x44')](_0x4f3230[_0xb516('0x45')],{})['then'](respondWithResult(_0x51769d,0xc9))[_0xb516('0x41')](handleError(_0x51769d,null));};exports[_0xb516('0x26')]=function(_0x4175b2,_0x28973c){if(_0x4175b2['body']['id']){delete _0x4175b2[_0xb516('0x45')]['id'];}return db[_0xb516('0x2d')]['find']({'where':{'id':_0x4175b2[_0xb516('0x46')]['id']}})[_0xb516('0x28')](handleEntityNotFound(_0x28973c,null))['then'](saveUpdates(_0x4175b2[_0xb516('0x45')],null))[_0xb516('0x28')](respondWithResult(_0x28973c,null))['catch'](handleError(_0x28973c,null));};exports[_0xb516('0x27')]=function(_0x9262d8,_0x2303a7){return db['VtigerConfiguration'][_0xb516('0x47')]({'where':{'id':_0x9262d8[_0xb516('0x46')]['id']}})[_0xb516('0x28')](handleEntityNotFound(_0x2303a7,null))[_0xb516('0x28')](removeEntity(_0x2303a7,null))[_0xb516('0x41')](handleError(_0x2303a7,null));};exports[_0xb516('0x48')]=function(_0x1b2adc,_0x22db94,_0x380f27){var _0x4ac8cd={};var _0x23b32a={};var _0xfa7843;var _0xb66b75;return db['VtigerConfiguration'][_0xb516('0x49')]({'where':{'id':_0x1b2adc[_0xb516('0x46')]['id']}})['then'](handleEntityNotFound(_0x22db94,null))[_0xb516('0x28')](function(_0x14ab47){if(_0x14ab47){_0xfa7843=_0x14ab47;_0x23b32a[_0xb516('0x31')]=_[_0xb516('0x33')](db['VtigerField'][_0xb516('0x2e')]);_0x23b32a['query']=_[_0xb516('0x33')](_0x1b2adc[_0xb516('0x32')]);_0x23b32a[_0xb516('0x34')]=_[_0xb516('0x43')](_0x23b32a[_0xb516('0x31')],_0x23b32a[_0xb516('0x32')]);_0x4ac8cd[_0xb516('0x35')]=_[_0xb516('0x43')](_0x23b32a['model'],qs[_0xb516('0x36')](_0x1b2adc[_0xb516('0x32')]['fields']));_0x4ac8cd[_0xb516('0x35')]=_0x4ac8cd[_0xb516('0x35')]['length']?_0x4ac8cd[_0xb516('0x35')]:_0x23b32a[_0xb516('0x31')];_0x4ac8cd[_0xb516('0x4a')]=qs[_0xb516('0x4b')](_0x1b2adc[_0xb516('0x32')][_0xb516('0x4b')]);_0x4ac8cd[_0xb516('0x39')]=qs['filters'](_['pick'](_0x1b2adc[_0xb516('0x32')],_0x23b32a[_0xb516('0x34')]));if(_0x1b2adc['query']['filter']){_0x4ac8cd[_0xb516('0x39')]=_[_0xb516('0x3c')](_0x4ac8cd[_0xb516('0x39')],{'$or':_['map'](_0x4ac8cd[_0xb516('0x35')],function(_0x8ea566){var _0x27180d={};_0x27180d[_0x8ea566]={'$like':'%'+_0x1b2adc[_0xb516('0x32')][_0xb516('0x3b')]+'%'};return _0x27180d;})});}_0x4ac8cd=_[_0xb516('0x3c')]({},_0x4ac8cd,_0x1b2adc[_0xb516('0x3d')]);return _0xfa7843[_0xb516('0x48')](_0x4ac8cd);}})[_0xb516('0x28')](function(_0x3a7e4b){if(_0x3a7e4b){_0xb66b75=_0x3a7e4b[_0xb516('0x37')];if(!_0x1b2adc['query'][_0xb516('0x4c')](_0xb516('0x38'))){_0x4ac8cd['limit']=qs['limit'](_0x1b2adc[_0xb516('0x32')][_0xb516('0x1f')]);_0x4ac8cd[_0xb516('0x1d')]=qs['offset'](_0x1b2adc[_0xb516('0x32')][_0xb516('0x1d')]);}return _0xfa7843['getFields'](_0x4ac8cd);}})['then'](function(_0x529078){if(_0x529078){return _0x529078?{'count':_0xb66b75,'rows':_0x529078}:null;}})['then'](respondWithResult(_0x22db94,null))[_0xb516('0x41')](handleError(_0x22db94,null));};exports[_0xb516('0x4d')]=function(_0x116fee,_0x1967ac,_0x132482){var _0x6e3665={};var _0x43b3e9={};var _0x105fba;var _0x1f7702;return db[_0xb516('0x2d')]['findOne']({'where':{'id':_0x116fee[_0xb516('0x46')]['id']}})[_0xb516('0x28')](handleEntityNotFound(_0x1967ac,null))[_0xb516('0x28')](function(_0x5c1fc0){if(_0x5c1fc0){_0x105fba=_0x5c1fc0;_0x43b3e9[_0xb516('0x31')]=_['keys'](db[_0xb516('0x4e')][_0xb516('0x2e')]);_0x43b3e9[_0xb516('0x32')]=_[_0xb516('0x33')](_0x116fee[_0xb516('0x32')]);_0x43b3e9[_0xb516('0x34')]=_['intersection'](_0x43b3e9[_0xb516('0x31')],_0x43b3e9[_0xb516('0x32')]);_0x6e3665[_0xb516('0x35')]=_[_0xb516('0x43')](_0x43b3e9['model'],qs['fields'](_0x116fee[_0xb516('0x32')][_0xb516('0x36')]));_0x6e3665[_0xb516('0x35')]=_0x6e3665[_0xb516('0x35')][_0xb516('0x37')]?_0x6e3665[_0xb516('0x35')]:_0x43b3e9[_0xb516('0x31')];_0x6e3665[_0xb516('0x4a')]=qs[_0xb516('0x4b')](_0x116fee[_0xb516('0x32')][_0xb516('0x4b')]);_0x6e3665[_0xb516('0x39')]=qs[_0xb516('0x34')](_['pick'](_0x116fee[_0xb516('0x32')],_0x43b3e9[_0xb516('0x34')]));if(_0x116fee['query']['filter']){_0x6e3665[_0xb516('0x39')]=_[_0xb516('0x3c')](_0x6e3665['where'],{'$or':_[_0xb516('0x2c')](_0x6e3665[_0xb516('0x35')],function(_0x55c767){var _0xbfb2c3={};_0xbfb2c3[_0x55c767]={'$like':'%'+_0x116fee[_0xb516('0x32')][_0xb516('0x3b')]+'%'};return _0xbfb2c3;})});}_0x6e3665=_[_0xb516('0x3c')]({},_0x6e3665,_0x116fee['options']);return _0x105fba[_0xb516('0x4d')](_0x6e3665);}})[_0xb516('0x28')](function(_0x3654a4){if(_0x3654a4){_0x1f7702=_0x3654a4[_0xb516('0x37')];if(!_0x116fee['query'][_0xb516('0x4c')](_0xb516('0x38'))){_0x6e3665['limit']=qs[_0xb516('0x1f')](_0x116fee[_0xb516('0x32')][_0xb516('0x1f')]);_0x6e3665[_0xb516('0x1d')]=qs[_0xb516('0x1d')](_0x116fee['query']['offset']);}return _0x105fba['getSubjects'](_0x6e3665);}})[_0xb516('0x28')](function(_0x4c731e){if(_0x4c731e){return _0x4c731e?{'count':_0x1f7702,'rows':_0x4c731e}:null;}})['then'](respondWithResult(_0x1967ac,null))[_0xb516('0x41')](handleError(_0x1967ac,null));};exports[_0xb516('0x4f')]=function(_0x3d765e,_0x135981,_0x5bb343){var _0x401cd3={};var _0x4955b6={};var _0x4e2a8b;var _0x5235cb;return db[_0xb516('0x2d')]['findOne']({'where':{'id':_0x3d765e[_0xb516('0x46')]['id']}})[_0xb516('0x28')](handleEntityNotFound(_0x135981,null))[_0xb516('0x28')](function(_0x29f471){if(_0x29f471){_0x4e2a8b=_0x29f471;_0x4955b6[_0xb516('0x31')]=_[_0xb516('0x33')](db[_0xb516('0x4e')]['rawAttributes']);_0x4955b6['query']=_['keys'](_0x3d765e[_0xb516('0x32')]);_0x4955b6['filters']=_[_0xb516('0x43')](_0x4955b6[_0xb516('0x31')],_0x4955b6['query']);_0x401cd3[_0xb516('0x35')]=_[_0xb516('0x43')](_0x4955b6['model'],qs['fields'](_0x3d765e['query'][_0xb516('0x36')]));_0x401cd3[_0xb516('0x35')]=_0x401cd3[_0xb516('0x35')][_0xb516('0x37')]?_0x401cd3[_0xb516('0x35')]:_0x4955b6[_0xb516('0x31')];_0x401cd3[_0xb516('0x4a')]=qs[_0xb516('0x4b')](_0x3d765e['query'][_0xb516('0x4b')]);_0x401cd3['where']=qs[_0xb516('0x34')](_[_0xb516('0x3a')](_0x3d765e['query'],_0x4955b6[_0xb516('0x34')]));if(_0x3d765e[_0xb516('0x32')]['filter']){_0x401cd3[_0xb516('0x39')]=_[_0xb516('0x3c')](_0x401cd3[_0xb516('0x39')],{'$or':_[_0xb516('0x2c')](_0x401cd3[_0xb516('0x35')],function(_0x3aace9){var _0x2cd133={};_0x2cd133[_0x3aace9]={'$like':'%'+_0x3d765e[_0xb516('0x32')][_0xb516('0x3b')]+'%'};return _0x2cd133;})});}_0x401cd3=_[_0xb516('0x3c')]({},_0x401cd3,_0x3d765e['options']);return _0x4e2a8b[_0xb516('0x4f')](_0x401cd3);}})[_0xb516('0x28')](function(_0x5bdb18){if(_0x5bdb18){_0x5235cb=_0x5bdb18[_0xb516('0x37')];if(!_0x3d765e['query']['hasOwnProperty'](_0xb516('0x38'))){_0x401cd3['limit']=qs[_0xb516('0x1f')](_0x3d765e[_0xb516('0x32')][_0xb516('0x1f')]);_0x401cd3[_0xb516('0x1d')]=qs[_0xb516('0x1d')](_0x3d765e[_0xb516('0x32')]['offset']);}return _0x4e2a8b[_0xb516('0x4f')](_0x401cd3);}})[_0xb516('0x28')](function(_0x4321d6){if(_0x4321d6){return _0x4321d6?{'count':_0x5235cb,'rows':_0x4321d6}:null;}})[_0xb516('0x28')](respondWithResult(_0x135981,null))[_0xb516('0x41')](handleError(_0x135981,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index e4d9edb..491128e 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 _0x69f7=['int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x4740cd,_0x13a0d1){var _0x429189=function(_0x456149){while(--_0x456149){_0x4740cd['push'](_0x4740cd['shift']());}};_0x429189(++_0x13a0d1);}(_0x69f7,0x109));var _0x769f=function(_0x3fc122,_0x5f5e08){_0x3fc122=_0x3fc122-0x0;var _0x31f8a8=_0x69f7[_0x3fc122];return _0x31f8a8;};'use strict';var _=require(_0x769f('0x0'));var util=require(_0x769f('0x1'));var logger=require(_0x769f('0x2'))(_0x769f('0x3'));var moment=require(_0x769f('0x4'));var BPromise=require(_0x769f('0x5'));var rp=require(_0x769f('0x6'));var fs=require('fs');var path=require(_0x769f('0x7'));var rimraf=require('rimraf');var config=require(_0x769f('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x384038,_0x22e426){return _0x384038[_0x769f('0x9')]('VtigerConfiguration',attributes,{'tableName':_0x769f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4b2=['moment','path','rimraf','exports','define','int_vtiger_configurations','lodash','util','../../config/logger','api'];(function(_0x2fd0f0,_0x4b634e){var _0x57f71a=function(_0x400d6f){while(--_0x400d6f){_0x2fd0f0['push'](_0x2fd0f0['shift']());}};_0x57f71a(++_0x4b634e);}(_0xd4b2,0x92));var _0x2d4b=function(_0x4f6c26,_0x5c2c54){_0x4f6c26=_0x4f6c26-0x0;var _0x4809a0=_0xd4b2[_0x4f6c26];return _0x4809a0;};'use strict';var _=require(_0x2d4b('0x0'));var util=require(_0x2d4b('0x1'));var logger=require(_0x2d4b('0x2'))(_0x2d4b('0x3'));var moment=require(_0x2d4b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d4b('0x5'));var rimraf=require(_0x2d4b('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x2d4b('0x7')]=function(_0x2192f4,_0x525703){return _0x2192f4[_0x2d4b('0x8')]('VtigerConfiguration',attributes,{'tableName':_0x2d4b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 12a61a3..faf1f72 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 _0xf180=['message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x112e26,_0x5387d0){var _0x431eff=function(_0x4d2035){while(--_0x4d2035){_0x112e26['push'](_0x112e26['shift']());}};_0x431eff(++_0x5387d0);}(_0xf180,0x1a7));var _0x0f18=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xf180[_0x5783f4];return _0x28e380;};'use strict';var _=require('lodash');var util=require(_0x0f18('0x0'));var moment=require(_0x0f18('0x1'));var BPromise=require(_0x0f18('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f18('0x3'));var db=require(_0x0f18('0x4'))['db'];var utils=require(_0x0f18('0x5'));var logger=require('../../config/logger')(_0x0f18('0x6'));var config=require(_0x0f18('0x7'));var jayson=require(_0x0f18('0x8'));var client=jayson[_0x0f18('0x9')][_0x0f18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5caaee,_0x2103fc,_0x266abe){return new BPromise(function(_0x3bafe2,_0x435784){return client['request'](_0x5caaee,_0x266abe)['then'](function(_0x3a37a8){logger[_0x0f18('0xb')](_0x0f18('0xc'),_0x2103fc,_0x0f18('0xd'));logger['debug'](_0x0f18('0xe'),_0x2103fc,_0x0f18('0xd'),JSON[_0x0f18('0xf')](_0x3a37a8));if(_0x3a37a8[_0x0f18('0x10')]){if(_0x3a37a8[_0x0f18('0x10')][_0x0f18('0x11')]===0x1f4){logger['error'](_0x0f18('0xc'),_0x2103fc,_0x3a37a8[_0x0f18('0x10')][_0x0f18('0x12')]);return _0x435784(_0x3a37a8[_0x0f18('0x10')]['message']);}logger[_0x0f18('0x10')](_0x0f18('0xc'),_0x2103fc,_0x3a37a8[_0x0f18('0x10')][_0x0f18('0x12')]);return _0x3bafe2(_0x3a37a8[_0x0f18('0x10')]['message']);}else{logger[_0x0f18('0xb')](_0x0f18('0xc'),_0x2103fc,_0x0f18('0xd'));_0x3bafe2(_0x3a37a8[_0x0f18('0x13')][_0x0f18('0x12')]);}})[_0x0f18('0x14')](function(_0xc7b5f7){logger[_0x0f18('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x2103fc,_0xc7b5f7);_0x435784(_0xc7b5f7);});});} \ No newline at end of file +var _0x53cd=['info','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','VtigerConfiguration,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x53cd,0x197));var _0xd53c=function(_0x273e90,_0x322ad6){_0x273e90=_0x273e90-0x0;var _0x19867e=_0x53cd[_0x273e90];return _0x19867e;};'use strict';var _=require('lodash');var util=require(_0xd53c('0x0'));var moment=require(_0xd53c('0x1'));var BPromise=require(_0xd53c('0x2'));var rs=require(_0xd53c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd53c('0x4'))['db'];var utils=require(_0xd53c('0x5'));var logger=require(_0xd53c('0x6'))(_0xd53c('0x7'));var config=require(_0xd53c('0x8'));var jayson=require(_0xd53c('0x9'));var client=jayson[_0xd53c('0xa')][_0xd53c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x223ff7,_0x12fbcd,_0x38e84a){return new BPromise(function(_0x44af38,_0x5f491b){return client[_0xd53c('0xc')](_0x223ff7,_0x38e84a)['then'](function(_0x13ad14){logger[_0xd53c('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x12fbcd,_0xd53c('0xe'));logger['debug'](_0xd53c('0xf'),_0x12fbcd,_0xd53c('0xe'),JSON['stringify'](_0x13ad14));if(_0x13ad14[_0xd53c('0x10')]){if(_0x13ad14[_0xd53c('0x10')]['code']===0x1f4){logger[_0xd53c('0x10')](_0xd53c('0x11'),_0x12fbcd,_0x13ad14[_0xd53c('0x10')][_0xd53c('0x12')]);return _0x5f491b(_0x13ad14[_0xd53c('0x10')][_0xd53c('0x12')]);}logger[_0xd53c('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x12fbcd,_0x13ad14['error'][_0xd53c('0x12')]);return _0x44af38(_0x13ad14[_0xd53c('0x10')][_0xd53c('0x12')]);}else{logger['info'](_0xd53c('0x11'),_0x12fbcd,_0xd53c('0xe'));_0x44af38(_0x13ad14[_0xd53c('0x13')]['message']);}})['catch'](function(_0x143bd1){logger[_0xd53c('0x10')](_0xd53c('0x11'),_0x12fbcd,_0x143bd1);_0x5f491b(_0x143bd1);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 609dac1..6f6c549 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 _0x1470=['isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get'];(function(_0xcddcd2,_0x620bf1){var _0x2a7e53=function(_0x1a48df){while(--_0x1a48df){_0xcddcd2['push'](_0xcddcd2['shift']());}};_0x2a7e53(++_0x620bf1);}(_0x1470,0x1d1));var _0x0147=function(_0x918eb4,_0x1e2eca){_0x918eb4=_0x918eb4-0x0;var _0x5b07db=_0x1470[_0x918eb4];return _0x5b07db;};'use strict';var multer=require(_0x0147('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0147('0x1'));var express=require(_0x0147('0x2'));var router=express[_0x0147('0x3')]();var fs_extra=require(_0x0147('0x4'));var auth=require(_0x0147('0x5'));var interaction=require(_0x0147('0x6'));var config=require(_0x0147('0x7'));var controller=require(_0x0147('0x8'));router[_0x0147('0x9')]('/',auth[_0x0147('0xa')](),controller[_0x0147('0xb')]);router[_0x0147('0x9')](_0x0147('0xc'),auth[_0x0147('0xa')](),controller[_0x0147('0xd')]);router[_0x0147('0xe')]('/',auth[_0x0147('0xa')](),controller['create']);router[_0x0147('0xf')]('/:id',auth[_0x0147('0xa')](),controller[_0x0147('0x10')]);router['delete'](_0x0147('0xc'),auth[_0x0147('0xa')](),controller[_0x0147('0x11')]);module[_0x0147('0x12')]=router; \ No newline at end of file +var _0xade0=['show','post','create','put','delete','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id'];(function(_0x2138ac,_0x38853e){var _0xa3d82e=function(_0x1dc377){while(--_0x1dc377){_0x2138ac['push'](_0x2138ac['shift']());}};_0xa3d82e(++_0x38853e);}(_0xade0,0x175));var _0x0ade=function(_0x33c637,_0x597c26){_0x33c637=_0x33c637-0x0;var _0x14aa20=_0xade0[_0x33c637];return _0x14aa20;};'use strict';var multer=require(_0x0ade('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0ade('0x1')]();var fs_extra=require(_0x0ade('0x2'));var auth=require(_0x0ade('0x3'));var interaction=require(_0x0ade('0x4'));var config=require(_0x0ade('0x5'));var controller=require(_0x0ade('0x6'));router[_0x0ade('0x7')]('/',auth[_0x0ade('0x8')](),controller[_0x0ade('0x9')]);router[_0x0ade('0x7')](_0x0ade('0xa'),auth[_0x0ade('0x8')](),controller[_0x0ade('0xb')]);router[_0x0ade('0xc')]('/',auth[_0x0ade('0x8')](),controller[_0x0ade('0xd')]);router[_0x0ade('0xe')](_0x0ade('0xa'),auth[_0x0ade('0x8')](),controller['update']);router[_0x0ade('0xf')](_0x0ade('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 60528d9..9f46dca 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 _0x8e14=['keyValue','STRING','ENUM','BOOLEAN','sequelize','exports','string'];(function(_0x2f100b,_0x2b5511){var _0x4c40e5=function(_0x2ca500){while(--_0x2ca500){_0x2f100b['push'](_0x2f100b['shift']());}};_0x4c40e5(++_0x2b5511);}(_0x8e14,0x193));var _0x48e1=function(_0x4effd9,_0x2aff76){_0x4effd9=_0x4effd9-0x0;var _0x17763d=_0x8e14[_0x4effd9];return _0x17763d;};'use strict';var Sequelize=require(_0x48e1('0x0'));module[_0x48e1('0x1')]={'type':{'type':Sequelize['ENUM'](_0x48e1('0x2'),'variable','customVariable',_0x48e1('0x3'),'picklist'),'defaultValue':_0x48e1('0x2')},'content':{'type':Sequelize[_0x48e1('0x4')]},'key':{'type':Sequelize[_0x48e1('0x4')]},'keyType':{'type':Sequelize[_0x48e1('0x5')]('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x48e1('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x48e1('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0365=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x0365,0x107));var _0x5036=function(_0x19e928,_0x26a0e4){_0x19e928=_0x19e928-0x0;var _0x4e941f=_0x0365[_0x19e928];return _0x4e941f;};'use strict';var Sequelize=require(_0x5036('0x0'));module[_0x5036('0x1')]={'type':{'type':Sequelize[_0x5036('0x2')](_0x5036('0x3'),_0x5036('0x4'),_0x5036('0x5'),_0x5036('0x6'),_0x5036('0x7')),'defaultValue':_0x5036('0x3')},'content':{'type':Sequelize[_0x5036('0x8')]},'key':{'type':Sequelize[_0x5036('0x8')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x5036('0x5'))},'keyContent':{'type':Sequelize[_0x5036('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5036('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5036('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 107c9a9..e25de7a 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 _0x055a=['findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','update','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','VtigerField','fieldName','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','include'];(function(_0x2e3fe9,_0x7a4ee2){var _0x4c39f2=function(_0xe5ba4e){while(--_0xe5ba4e){_0x2e3fe9['push'](_0x2e3fe9['shift']());}};_0x4c39f2(++_0x7a4ee2);}(_0x055a,0x1c7));var _0xa055=function(_0x20ea26,_0x5512f8){_0x20ea26=_0x20ea26-0x0;var _0xcbc4d7=_0x055a[_0x20ea26];return _0xcbc4d7;};'use strict';var emlformat=require(_0xa055('0x0'));var rimraf=require(_0xa055('0x1'));var zipdir=require(_0xa055('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa055('0x3'));var BPromise=require(_0xa055('0x4'));var Mustache=require(_0xa055('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa055('0x6'));var csv=require('to-csv');var ejs=require(_0xa055('0x7'));var fs=require('fs');var fs_extra=require(_0xa055('0x8'));var _=require(_0xa055('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa055('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa055('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa055('0xc'));var qs=require(_0xa055('0xd'));var as=require(_0xa055('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa055('0xf'));var utils=require(_0xa055('0x10'));var config=require(_0xa055('0x11'));var licenseUtil=require(_0xa055('0x12'));var db=require(_0xa055('0x13'))['db'];function respondWithStatusCode(_0x3c6024,_0x19f8ce){_0x19f8ce=_0x19f8ce||0xcc;return function(_0x3c8b30){if(_0x3c8b30){return _0x3c6024[_0xa055('0x14')](_0x19f8ce);}return _0x3c6024[_0xa055('0x15')](_0x19f8ce)[_0xa055('0x16')]();};}function respondWithResult(_0x29cec4,_0x297110){_0x297110=_0x297110||0xc8;return function(_0xf34685){if(_0xf34685){return _0x29cec4[_0xa055('0x15')](_0x297110)[_0xa055('0x17')](_0xf34685);}};}function respondWithFilteredResult(_0x53961f,_0x525a3b){return function(_0x4e40f1){if(_0x4e40f1){var _0x1e02d7=typeof _0x525a3b[_0xa055('0x18')]===_0xa055('0x19')&&typeof _0x525a3b['limit']==='undefined';var _0x1c04c3=_0x4e40f1[_0xa055('0x1a')];var _0x2002f2=_0x1e02d7?0x0:_0x525a3b[_0xa055('0x18')];var _0x59cc8d=_0x1e02d7?_0x4e40f1[_0xa055('0x1a')]:_0x525a3b[_0xa055('0x18')]+_0x525a3b['limit'];var _0x47e02d;if(_0x59cc8d>=_0x1c04c3){_0x59cc8d=_0x1c04c3;_0x47e02d=0xc8;}else{_0x47e02d=0xce;}_0x53961f[_0xa055('0x15')](_0x47e02d);return _0x53961f[_0xa055('0x1b')](_0xa055('0x1c'),_0x2002f2+'-'+_0x59cc8d+'/'+_0x1c04c3)['json'](_0x4e40f1);}return null;};}function patchUpdates(_0x3db7ba){return function(_0x1a2ce3){try{jsonpatch[_0xa055('0x1d')](_0x1a2ce3,_0x3db7ba,!![]);}catch(_0x5440a3){return BPromise[_0xa055('0x1e')](_0x5440a3);}return _0x1a2ce3[_0xa055('0x1f')]();};}function saveUpdates(_0x636fb8,_0x5c2a6f){return function(_0x15d5f5){if(_0x15d5f5){return _0x15d5f5['update'](_0x636fb8)[_0xa055('0x20')](function(_0x2fa5eb){return _0x2fa5eb;});}return null;};}function removeEntity(_0x2af527,_0x8afe68){return function(_0x33f915){if(_0x33f915){return _0x33f915[_0xa055('0x21')]()['then'](function(){_0x2af527[_0xa055('0x15')](0xcc)[_0xa055('0x16')]();});}};}function handleEntityNotFound(_0xf29736,_0x2d6f3a){return function(_0x3fb699){if(!_0x3fb699){_0xf29736[_0xa055('0x14')](0x194);}return _0x3fb699;};}function handleError(_0x53277f,_0x10efe2){_0x10efe2=_0x10efe2||0x1f4;return function(_0x1e104a){logger[_0xa055('0x22')](_0x1e104a[_0xa055('0x23')]);if(_0x1e104a[_0xa055('0x24')]){delete _0x1e104a[_0xa055('0x24')];}_0x53277f[_0xa055('0x15')](_0x10efe2)[_0xa055('0x25')](_0x1e104a);};}exports[_0xa055('0x26')]=function(_0x115fc3,_0xf05f7){var _0x17434b={},_0x21f320={},_0x22d181={'count':0x0,'rows':[]};var _0x3b521d=_['map'](db[_0xa055('0x27')]['rawAttributes'],function(_0x3d3866){return{'name':_0x3d3866[_0xa055('0x28')],'type':_0x3d3866['type'][_0xa055('0x29')]};});_0x21f320[_0xa055('0x2a')]=_[_0xa055('0x2b')](_0x3b521d,_0xa055('0x24'));_0x21f320['query']=_[_0xa055('0x2c')](_0x115fc3[_0xa055('0x2d')]);_0x21f320['filters']=_['intersection'](_0x21f320[_0xa055('0x2a')],_0x21f320[_0xa055('0x2d')]);_0x17434b[_0xa055('0x2e')]=_[_0xa055('0x2f')](_0x21f320['model'],qs[_0xa055('0x30')](_0x115fc3[_0xa055('0x2d')][_0xa055('0x30')]));_0x17434b[_0xa055('0x2e')]=_0x17434b['attributes'][_0xa055('0x31')]?_0x17434b['attributes']:_0x21f320[_0xa055('0x2a')];if(!_0x115fc3[_0xa055('0x2d')][_0xa055('0x32')](_0xa055('0x33'))){_0x17434b[_0xa055('0x34')]=qs[_0xa055('0x34')](_0x115fc3[_0xa055('0x2d')][_0xa055('0x34')]);_0x17434b['offset']=qs[_0xa055('0x18')](_0x115fc3[_0xa055('0x2d')][_0xa055('0x18')]);}_0x17434b[_0xa055('0x35')]=qs[_0xa055('0x36')](_0x115fc3[_0xa055('0x2d')][_0xa055('0x36')]);_0x17434b[_0xa055('0x37')]=qs[_0xa055('0x38')](_['pick'](_0x115fc3['query'],_0x21f320[_0xa055('0x38')]),_0x3b521d);if(_0x115fc3[_0xa055('0x2d')][_0xa055('0x39')]){_0x17434b[_0xa055('0x37')]=_[_0xa055('0x3a')](_0x17434b[_0xa055('0x37')],{'$or':_['map'](_0x3b521d,function(_0x454294){if(_0x454294[_0xa055('0x3b')]!==_0xa055('0x3c')){var _0x2a479e={};_0x2a479e[_0x454294['name']]={'$like':'%'+_0x115fc3['query'][_0xa055('0x39')]+'%'};return _0x2a479e;}})});}_0x17434b=_[_0xa055('0x3a')]({},_0x17434b,_0x115fc3[_0xa055('0x3d')]);var _0x948c32={'where':_0x17434b[_0xa055('0x37')]};return db[_0xa055('0x27')]['count'](_0x948c32)[_0xa055('0x20')](function(_0x9dec94){_0x22d181['count']=_0x9dec94;if(_0x115fc3[_0xa055('0x2d')]['includeAll']){_0x17434b[_0xa055('0x3e')]=[{'all':!![]}];}return db[_0xa055('0x27')][_0xa055('0x3f')](_0x17434b);})[_0xa055('0x20')](function(_0x24ebca){_0x22d181[_0xa055('0x40')]=_0x24ebca;return _0x22d181;})[_0xa055('0x20')](respondWithFilteredResult(_0xf05f7,_0x17434b))[_0xa055('0x41')](handleError(_0xf05f7,null));};exports[_0xa055('0x42')]=function(_0x34d01c,_0x326351){var _0x4a71f2={'raw':!![],'where':{'id':_0x34d01c[_0xa055('0x43')]['id']}},_0x4380a3={};_0x4380a3[_0xa055('0x2a')]=_[_0xa055('0x2c')](db[_0xa055('0x27')][_0xa055('0x44')]);_0x4380a3[_0xa055('0x2d')]=_['keys'](_0x34d01c['query']);_0x4380a3[_0xa055('0x38')]=_[_0xa055('0x2f')](_0x4380a3[_0xa055('0x2a')],_0x4380a3[_0xa055('0x2d')]);_0x4a71f2['attributes']=_[_0xa055('0x2f')](_0x4380a3[_0xa055('0x2a')],qs[_0xa055('0x30')](_0x34d01c[_0xa055('0x2d')][_0xa055('0x30')]));_0x4a71f2['attributes']=_0x4a71f2[_0xa055('0x2e')][_0xa055('0x31')]?_0x4a71f2['attributes']:_0x4380a3[_0xa055('0x2a')];if(_0x34d01c[_0xa055('0x2d')][_0xa055('0x45')]){_0x4a71f2[_0xa055('0x3e')]=[{'all':!![]}];}_0x4a71f2=_['merge']({},_0x4a71f2,_0x34d01c[_0xa055('0x3d')]);return db[_0xa055('0x27')][_0xa055('0x46')](_0x4a71f2)[_0xa055('0x20')](handleEntityNotFound(_0x326351,null))[_0xa055('0x20')](respondWithResult(_0x326351,null))['catch'](handleError(_0x326351,null));};exports[_0xa055('0x47')]=function(_0x37684a,_0x4216f1){return db['VtigerField']['create'](_0x37684a[_0xa055('0x48')],{})[_0xa055('0x20')](respondWithResult(_0x4216f1,0xc9))[_0xa055('0x41')](handleError(_0x4216f1,null));};exports[_0xa055('0x49')]=function(_0x315ce0,_0x5ccb4b){if(_0x315ce0['body']['id']){delete _0x315ce0[_0xa055('0x48')]['id'];}return db[_0xa055('0x27')][_0xa055('0x46')]({'where':{'id':_0x315ce0[_0xa055('0x43')]['id']}})['then'](handleEntityNotFound(_0x5ccb4b,null))[_0xa055('0x20')](saveUpdates(_0x315ce0[_0xa055('0x48')],null))[_0xa055('0x20')](respondWithResult(_0x5ccb4b,null))[_0xa055('0x41')](handleError(_0x5ccb4b,null));};exports[_0xa055('0x21')]=function(_0x29d2a3,_0x4b6bec){return db[_0xa055('0x27')][_0xa055('0x46')]({'where':{'id':_0x29d2a3[_0xa055('0x43')]['id']}})[_0xa055('0x20')](handleEntityNotFound(_0x4b6bec,null))[_0xa055('0x20')](removeEntity(_0x4b6bec,null))[_0xa055('0x41')](handleError(_0x4b6bec,null));}; \ No newline at end of file +var _0x18bf=['name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack'];(function(_0x1f41dd,_0x5ae579){var _0x427535=function(_0x25a76a){while(--_0x25a76a){_0x1f41dd['push'](_0x1f41dd['shift']());}};_0x427535(++_0x5ae579);}(_0x18bf,0x6f));var _0xf18b=function(_0x1e707e,_0x13f351){_0x1e707e=_0x1e707e-0x0;var _0x2aa433=_0x18bf[_0x1e707e];return _0x2aa433;};'use strict';var emlformat=require(_0xf18b('0x0'));var rimraf=require(_0xf18b('0x1'));var zipdir=require(_0xf18b('0x2'));var jsonpatch=require(_0xf18b('0x3'));var rp=require('request-promise');var moment=require(_0xf18b('0x4'));var BPromise=require(_0xf18b('0x5'));var Mustache=require(_0xf18b('0x6'));var util=require(_0xf18b('0x7'));var path=require(_0xf18b('0x8'));var sox=require(_0xf18b('0x9'));var csv=require('to-csv');var ejs=require(_0xf18b('0xa'));var fs=require('fs');var fs_extra=require(_0xf18b('0xb'));var _=require(_0xf18b('0xc'));var squel=require(_0xf18b('0xd'));var crypto=require(_0xf18b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf18b('0xf'));var toCsv=require(_0xf18b('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf18b('0x11'));var authService=require(_0xf18b('0x12'));var qs=require(_0xf18b('0x13'));var as=require(_0xf18b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf18b('0x15'))(_0xf18b('0x16'));var utils=require(_0xf18b('0x17'));var config=require(_0xf18b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf18b('0x19'))['db'];function respondWithStatusCode(_0x55a06c,_0x3eb5df){_0x3eb5df=_0x3eb5df||0xcc;return function(_0x1f0339){if(_0x1f0339){return _0x55a06c['sendStatus'](_0x3eb5df);}return _0x55a06c[_0xf18b('0x1a')](_0x3eb5df)[_0xf18b('0x1b')]();};}function respondWithResult(_0x14d72a,_0x1459f4){_0x1459f4=_0x1459f4||0xc8;return function(_0x4b94f3){if(_0x4b94f3){return _0x14d72a[_0xf18b('0x1a')](_0x1459f4)['json'](_0x4b94f3);}};}function respondWithFilteredResult(_0x46ddc9,_0x48b471){return function(_0x268f0c){if(_0x268f0c){var _0x20190d=typeof _0x48b471[_0xf18b('0x1c')]===_0xf18b('0x1d')&&typeof _0x48b471['limit']===_0xf18b('0x1d');var _0x8b4939=_0x268f0c['count'];var _0x5d655d=_0x20190d?0x0:_0x48b471['offset'];var _0x504405=_0x20190d?_0x268f0c[_0xf18b('0x1e')]:_0x48b471['offset']+_0x48b471[_0xf18b('0x1f')];var _0x19a221;if(_0x504405>=_0x8b4939){_0x504405=_0x8b4939;_0x19a221=0xc8;}else{_0x19a221=0xce;}_0x46ddc9[_0xf18b('0x1a')](_0x19a221);return _0x46ddc9[_0xf18b('0x20')](_0xf18b('0x21'),_0x5d655d+'-'+_0x504405+'/'+_0x8b4939)['json'](_0x268f0c);}return null;};}function patchUpdates(_0x41895c){return function(_0x3eaf66){try{jsonpatch[_0xf18b('0x22')](_0x3eaf66,_0x41895c,!![]);}catch(_0x47a39c){return BPromise[_0xf18b('0x23')](_0x47a39c);}return _0x3eaf66[_0xf18b('0x24')]();};}function saveUpdates(_0x55be4e,_0x4f1c4a){return function(_0x592542){if(_0x592542){return _0x592542[_0xf18b('0x25')](_0x55be4e)[_0xf18b('0x26')](function(_0x1ca26d){return _0x1ca26d;});}return null;};}function removeEntity(_0x41be88,_0x5e58a9){return function(_0x485244){if(_0x485244){return _0x485244[_0xf18b('0x27')]()[_0xf18b('0x26')](function(){_0x41be88['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x559803,_0x2f3496){return function(_0x320d35){if(!_0x320d35){_0x559803[_0xf18b('0x28')](0x194);}return _0x320d35;};}function handleError(_0x55ad68,_0x26e54b){_0x26e54b=_0x26e54b||0x1f4;return function(_0x5ced41){logger[_0xf18b('0x29')](_0x5ced41[_0xf18b('0x2a')]);if(_0x5ced41[_0xf18b('0x2b')]){delete _0x5ced41[_0xf18b('0x2b')];}_0x55ad68[_0xf18b('0x1a')](_0x26e54b)[_0xf18b('0x2c')](_0x5ced41);};}exports[_0xf18b('0x2d')]=function(_0x49f9b6,_0x491479){var _0x5501b5={},_0x3a07fb={},_0x3a2659={'count':0x0,'rows':[]};var _0x29d04c=_[_0xf18b('0x2e')](db[_0xf18b('0x2f')][_0xf18b('0x30')],function(_0x124a2c){return{'name':_0x124a2c[_0xf18b('0x31')],'type':_0x124a2c['type'][_0xf18b('0x32')]};});_0x3a07fb[_0xf18b('0x33')]=_['map'](_0x29d04c,_0xf18b('0x2b'));_0x3a07fb[_0xf18b('0x34')]=_[_0xf18b('0x35')](_0x49f9b6[_0xf18b('0x34')]);_0x3a07fb[_0xf18b('0x36')]=_['intersection'](_0x3a07fb['model'],_0x3a07fb[_0xf18b('0x34')]);_0x5501b5[_0xf18b('0x37')]=_[_0xf18b('0x38')](_0x3a07fb[_0xf18b('0x33')],qs['fields'](_0x49f9b6[_0xf18b('0x34')][_0xf18b('0x39')]));_0x5501b5[_0xf18b('0x37')]=_0x5501b5[_0xf18b('0x37')][_0xf18b('0x3a')]?_0x5501b5[_0xf18b('0x37')]:_0x3a07fb[_0xf18b('0x33')];if(!_0x49f9b6[_0xf18b('0x34')][_0xf18b('0x3b')](_0xf18b('0x3c'))){_0x5501b5['limit']=qs[_0xf18b('0x1f')](_0x49f9b6[_0xf18b('0x34')][_0xf18b('0x1f')]);_0x5501b5[_0xf18b('0x1c')]=qs[_0xf18b('0x1c')](_0x49f9b6[_0xf18b('0x34')]['offset']);}_0x5501b5['order']=qs[_0xf18b('0x3d')](_0x49f9b6[_0xf18b('0x34')][_0xf18b('0x3d')]);_0x5501b5[_0xf18b('0x3e')]=qs[_0xf18b('0x36')](_[_0xf18b('0x3f')](_0x49f9b6[_0xf18b('0x34')],_0x3a07fb[_0xf18b('0x36')]),_0x29d04c);if(_0x49f9b6[_0xf18b('0x34')][_0xf18b('0x40')]){_0x5501b5[_0xf18b('0x3e')]=_[_0xf18b('0x41')](_0x5501b5['where'],{'$or':_[_0xf18b('0x2e')](_0x29d04c,function(_0x595f4c){if(_0x595f4c['type']!==_0xf18b('0x42')){var _0x186315={};_0x186315[_0x595f4c['name']]={'$like':'%'+_0x49f9b6['query']['filter']+'%'};return _0x186315;}})});}_0x5501b5=_[_0xf18b('0x41')]({},_0x5501b5,_0x49f9b6[_0xf18b('0x43')]);var _0xd249ad={'where':_0x5501b5[_0xf18b('0x3e')]};return db['VtigerField'][_0xf18b('0x1e')](_0xd249ad)['then'](function(_0x19c7ca){_0x3a2659[_0xf18b('0x1e')]=_0x19c7ca;if(_0x49f9b6[_0xf18b('0x34')]['includeAll']){_0x5501b5[_0xf18b('0x44')]=[{'all':!![]}];}return db[_0xf18b('0x2f')][_0xf18b('0x45')](_0x5501b5);})['then'](function(_0x321fbd){_0x3a2659[_0xf18b('0x46')]=_0x321fbd;return _0x3a2659;})[_0xf18b('0x26')](respondWithFilteredResult(_0x491479,_0x5501b5))[_0xf18b('0x47')](handleError(_0x491479,null));};exports['show']=function(_0x2ebe0d,_0x21973d){var _0x5b06f4={'raw':!![],'where':{'id':_0x2ebe0d[_0xf18b('0x48')]['id']}},_0x2e6659={};_0x2e6659[_0xf18b('0x33')]=_[_0xf18b('0x35')](db[_0xf18b('0x2f')][_0xf18b('0x30')]);_0x2e6659[_0xf18b('0x34')]=_[_0xf18b('0x35')](_0x2ebe0d['query']);_0x2e6659['filters']=_[_0xf18b('0x38')](_0x2e6659[_0xf18b('0x33')],_0x2e6659[_0xf18b('0x34')]);_0x5b06f4[_0xf18b('0x37')]=_[_0xf18b('0x38')](_0x2e6659['model'],qs[_0xf18b('0x39')](_0x2ebe0d[_0xf18b('0x34')][_0xf18b('0x39')]));_0x5b06f4[_0xf18b('0x37')]=_0x5b06f4[_0xf18b('0x37')][_0xf18b('0x3a')]?_0x5b06f4[_0xf18b('0x37')]:_0x2e6659[_0xf18b('0x33')];if(_0x2ebe0d[_0xf18b('0x34')][_0xf18b('0x49')]){_0x5b06f4[_0xf18b('0x44')]=[{'all':!![]}];}_0x5b06f4=_[_0xf18b('0x41')]({},_0x5b06f4,_0x2ebe0d[_0xf18b('0x43')]);return db[_0xf18b('0x2f')][_0xf18b('0x4a')](_0x5b06f4)[_0xf18b('0x26')](handleEntityNotFound(_0x21973d,null))[_0xf18b('0x26')](respondWithResult(_0x21973d,null))[_0xf18b('0x47')](handleError(_0x21973d,null));};exports[_0xf18b('0x4b')]=function(_0x37d86c,_0x32590f){return db[_0xf18b('0x2f')][_0xf18b('0x4b')](_0x37d86c[_0xf18b('0x4c')],{})[_0xf18b('0x26')](respondWithResult(_0x32590f,0xc9))[_0xf18b('0x47')](handleError(_0x32590f,null));};exports['update']=function(_0x5cb58c,_0x388d92){if(_0x5cb58c[_0xf18b('0x4c')]['id']){delete _0x5cb58c['body']['id'];}return db[_0xf18b('0x2f')][_0xf18b('0x4a')]({'where':{'id':_0x5cb58c[_0xf18b('0x48')]['id']}})[_0xf18b('0x26')](handleEntityNotFound(_0x388d92,null))[_0xf18b('0x26')](saveUpdates(_0x5cb58c[_0xf18b('0x4c')],null))[_0xf18b('0x26')](respondWithResult(_0x388d92,null))[_0xf18b('0x47')](handleError(_0x388d92,null));};exports['destroy']=function(_0x202124,_0x42750e){return db[_0xf18b('0x2f')][_0xf18b('0x4a')]({'where':{'id':_0x202124[_0xf18b('0x48')]['id']}})[_0xf18b('0x26')](handleEntityNotFound(_0x42750e,null))[_0xf18b('0x26')](removeEntity(_0x42750e,null))['catch'](handleError(_0x42750e,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index a96f7ca..22778ff 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 _0x7e79=['idField','FieldId','lodash','api','moment','bluebird','request-promise','rimraf','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index'];(function(_0x42c8e6,_0x317867){var _0x4319a1=function(_0x1762de){while(--_0x1762de){_0x42c8e6['push'](_0x42c8e6['shift']());}};_0x4319a1(++_0x317867);}(_0x7e79,0x188));var _0x97e7=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x7e79[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x97e7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x97e7('0x1'));var moment=require(_0x97e7('0x2'));var BPromise=require(_0x97e7('0x3'));var rp=require(_0x97e7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x97e7('0x5'));var config=require('../../config/environment');var attributes=require(_0x97e7('0x6'));module['exports']=function(_0x3c8054,_0x4a4848){return _0x3c8054[_0x97e7('0x7')](_0x97e7('0x8'),attributes,{'tableName':_0x97e7('0x9'),'paranoid':![],'indexes':[{'name':_0x97e7('0xa'),'fields':[_0x97e7('0xb'),_0x97e7('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50a8=['VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','moment','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x45225f,_0x32af97){var _0x58fd6e=function(_0x50f6b5){while(--_0x50f6b5){_0x45225f['push'](_0x45225f['shift']());}};_0x58fd6e(++_0x32af97);}(_0x50a8,0x89));var _0x850a=function(_0x5162ed,_0x386cb7){_0x5162ed=_0x5162ed-0x0;var _0x4c579b=_0x50a8[_0x5162ed];return _0x4c579b;};'use strict';var _=require(_0x850a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x850a('0x1'));var BPromise=require(_0x850a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x850a('0x3'));var config=require(_0x850a('0x4'));var attributes=require('./intVtigerField.attributes');module[_0x850a('0x5')]=function(_0x3a5435,_0xe561fe){return _0x3a5435[_0x850a('0x6')](_0x850a('0x7'),attributes,{'tableName':_0x850a('0x8'),'paranoid':![],'indexes':[{'name':_0x850a('0x9'),'fields':[_0x850a('0xa'),_0x850a('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 38328d8..abb8ea8 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 _0x0616=['ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird'];(function(_0x119d25,_0x588c8){var _0x39cf30=function(_0x31c68c){while(--_0x31c68c){_0x119d25['push'](_0x119d25['shift']());}};_0x39cf30(++_0x588c8);}(_0x0616,0xfd));var _0x6061=function(_0x1d8f95,_0xcd1d0e){_0x1d8f95=_0x1d8f95-0x0;var _0x4cb618=_0x0616[_0x1d8f95];return _0x4cb618;};'use strict';var _=require(_0x6061('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6061('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6061('0x2'));var db=require(_0x6061('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6061('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6061('0x5'));var client=jayson[_0x6061('0x6')][_0x6061('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1cf92f,_0x647228,_0x18648d){return new BPromise(function(_0x5f3e1e,_0x3694c1){return client['request'](_0x1cf92f,_0x18648d)['then'](function(_0x1fa1e4){logger['info'](_0x6061('0x8'),_0x647228,_0x6061('0x9'));logger[_0x6061('0xa')](_0x6061('0xb'),_0x647228,_0x6061('0x9'),JSON[_0x6061('0xc')](_0x1fa1e4));if(_0x1fa1e4[_0x6061('0xd')]){if(_0x1fa1e4['error'][_0x6061('0xe')]===0x1f4){logger[_0x6061('0xd')](_0x6061('0x8'),_0x647228,_0x1fa1e4[_0x6061('0xd')][_0x6061('0xf')]);return _0x3694c1(_0x1fa1e4[_0x6061('0xd')][_0x6061('0xf')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x647228,_0x1fa1e4[_0x6061('0xd')][_0x6061('0xf')]);return _0x5f3e1e(_0x1fa1e4['error'][_0x6061('0xf')]);}else{logger['info'](_0x6061('0x8'),_0x647228,_0x6061('0x9'));_0x5f3e1e(_0x1fa1e4[_0x6061('0x10')][_0x6061('0xf')]);}})['catch'](function(_0x30a359){logger[_0x6061('0xd')](_0x6061('0x8'),_0x647228,_0x30a359);_0x3694c1(_0x30a359);});});} \ No newline at end of file +var _0xdd89=['client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3788f5,_0x2b91f2){var _0x576589=function(_0x4f49dd){while(--_0x4f49dd){_0x3788f5['push'](_0x3788f5['shift']());}};_0x576589(++_0x2b91f2);}(_0xdd89,0xc5));var _0x9dd8=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xdd89[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x9dd8('0x0'));var util=require(_0x9dd8('0x1'));var moment=require(_0x9dd8('0x2'));var BPromise=require(_0x9dd8('0x3'));var rs=require(_0x9dd8('0x4'));var fs=require('fs');var Redis=require(_0x9dd8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9dd8('0x6'))(_0x9dd8('0x7'));var config=require(_0x9dd8('0x8'));var jayson=require(_0x9dd8('0x9'));var client=jayson[_0x9dd8('0xa')][_0x9dd8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ebe31,_0x166b60,_0x4198fe){return new BPromise(function(_0xd2480b,_0x4e5e9a){return client[_0x9dd8('0xc')](_0x3ebe31,_0x4198fe)[_0x9dd8('0xd')](function(_0x2192fb){logger[_0x9dd8('0xe')](_0x9dd8('0xf'),_0x166b60,_0x9dd8('0x10'));logger[_0x9dd8('0x11')](_0x9dd8('0x12'),_0x166b60,'request\x20sent',JSON[_0x9dd8('0x13')](_0x2192fb));if(_0x2192fb[_0x9dd8('0x14')]){if(_0x2192fb[_0x9dd8('0x14')]['code']===0x1f4){logger[_0x9dd8('0x14')](_0x9dd8('0xf'),_0x166b60,_0x2192fb[_0x9dd8('0x14')]['message']);return _0x4e5e9a(_0x2192fb['error']['message']);}logger[_0x9dd8('0x14')]('VtigerField,\x20%s,\x20%s',_0x166b60,_0x2192fb['error'][_0x9dd8('0x15')]);return _0xd2480b(_0x2192fb[_0x9dd8('0x14')][_0x9dd8('0x15')]);}else{logger[_0x9dd8('0xe')](_0x9dd8('0xf'),_0x166b60,_0x9dd8('0x10'));_0xd2480b(_0x2192fb['result'][_0x9dd8('0x15')]);}})[_0x9dd8('0x16')](function(_0x238354){logger[_0x9dd8('0x14')](_0x9dd8('0xf'),_0x166b60,_0x238354);_0x4e5e9a(_0x238354);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index b2eabda..677d71c 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 _0x387c=['getFields','post','create','/:id/configurations','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields'];(function(_0x5ee767,_0x4cf6bf){var _0x428a89=function(_0x2a2fe2){while(--_0x2a2fe2){_0x5ee767['push'](_0x5ee767['shift']());}};_0x428a89(++_0x4cf6bf);}(_0x387c,0x17e));var _0xc387=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0x387c[_0x1f71d8];return _0x10b045;};'use strict';var multer=require(_0xc387('0x0'));var util=require(_0xc387('0x1'));var path=require(_0xc387('0x2'));var timeout=require(_0xc387('0x3'));var express=require('express');var router=express[_0xc387('0x4')]();var fs_extra=require(_0xc387('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc387('0x6'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0xc387('0x7')]('/',auth[_0xc387('0x8')](),controller[_0xc387('0x9')]);router[_0xc387('0x7')](_0xc387('0xa'),auth[_0xc387('0x8')](),controller[_0xc387('0xb')]);router[_0xc387('0x7')]('/:id/configurations',auth[_0xc387('0x8')](),controller[_0xc387('0xc')]);router[_0xc387('0x7')](_0xc387('0xd'),auth[_0xc387('0x8')](),controller[_0xc387('0xe')]);router[_0xc387('0xf')]('/',auth[_0xc387('0x8')](),controller[_0xc387('0x10')]);router[_0xc387('0xf')](_0xc387('0x11'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xc387('0x12')](_0xc387('0xa'),auth[_0xc387('0x8')](),controller[_0xc387('0x13')]);router[_0xc387('0x14')]('/:id',auth[_0xc387('0x8')](),controller[_0xc387('0x15')]);module['exports']=router; \ No newline at end of file +var _0x2fa9=['../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/configurations','post','create','addConfiguration','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2fa9,0x1ee));var _0x92fa=function(_0x2ed4ab,_0x520fb8){_0x2ed4ab=_0x2ed4ab-0x0;var _0x4afa89=_0x2fa9[_0x2ed4ab];return _0x4afa89;};'use strict';var multer=require('multer');var util=require(_0x92fa('0x0'));var path=require(_0x92fa('0x1'));var timeout=require(_0x92fa('0x2'));var express=require(_0x92fa('0x3'));var router=express[_0x92fa('0x4')]();var fs_extra=require(_0x92fa('0x5'));var auth=require(_0x92fa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x92fa('0x7'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x92fa('0x8')](),controller['index']);router[_0x92fa('0x9')](_0x92fa('0xa'),auth[_0x92fa('0x8')](),controller[_0x92fa('0xb')]);router[_0x92fa('0x9')](_0x92fa('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x92fa('0x9')]('/:id/fields',auth[_0x92fa('0x8')](),controller['getFields']);router[_0x92fa('0xd')]('/',auth['isAuthenticated'](),controller[_0x92fa('0xe')]);router[_0x92fa('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x92fa('0xf')]);router[_0x92fa('0x10')](_0x92fa('0xa'),auth['isAuthenticated'](),controller[_0x92fa('0x11')]);router[_0x92fa('0x12')](_0x92fa('0xa'),auth[_0x92fa('0x8')](),controller['destroy']);module[_0x92fa('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index c901284..1f4dd72 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 _0x4c60=['integrationTab','sequelize','exports','STRING','username','ENUM','password','token'];(function(_0x2edf95,_0x9d7386){var _0x22adad=function(_0x460227){while(--_0x460227){_0x2edf95['push'](_0x2edf95['shift']());}};_0x22adad(++_0x9d7386);}(_0x4c60,0xc1));var _0x04c6=function(_0x6fedd9,_0x2b6515){_0x6fedd9=_0x6fedd9-0x0;var _0x1fc06a=_0x4c60[_0x6fedd9];return _0x1fc06a;};'use strict';var Sequelize=require(_0x04c6('0x0'));module[_0x04c6('0x1')]={'name':{'type':Sequelize[_0x04c6('0x2')]},'description':{'type':Sequelize[_0x04c6('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x04c6('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x04c6('0x4')](_0x04c6('0x5'),_0x04c6('0x6')),'defaultValue':_0x04c6('0x5')},'serverUrl':{'type':Sequelize[_0x04c6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x04c6('0x4')](_0x04c6('0x7'),'newTab'),'defaultValue':_0x04c6('0x7')}}; \ No newline at end of file +var _0x7524=['username','ENUM','password','token','integrationTab','newTab','exports','STRING'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x7524,0xce));var _0x4752=function(_0x56573d,_0x3049a3){_0x56573d=_0x56573d-0x0;var _0x335014=_0x7524[_0x56573d];return _0x335014;};'use strict';var Sequelize=require('sequelize');module[_0x4752('0x0')]={'name':{'type':Sequelize[_0x4752('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4752('0x1')],'unique':_0x4752('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4752('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x4752('0x3')](_0x4752('0x4'),_0x4752('0x5')),'defaultValue':_0x4752('0x4')},'serverUrl':{'type':Sequelize[_0x4752('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4752('0x6'),_0x4752('0x7')),'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 28488bf..5dffc5a 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 _0x9ffd=['catch','show','params','rawAttributes','find','create','body','destroy','getConfigurations','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','findOne','username','password','token','authType','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','toString','Sequelize','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','update','then','stack','name','index','map','ZendeskAccount','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x1b5ebd,_0x1b89d0){var _0x3932=function(_0x24e900){while(--_0x24e900){_0x1b5ebd['push'](_0x1b5ebd['shift']());}};_0x3932(++_0x1b89d0);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x16f810,_0x277c2f){_0x16f810=_0x16f810-0x0;var _0xdf3079=_0x9ffd[_0x16f810];return _0xdf3079;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require(_0xd9ff('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x47b0d7,_0xaaf7af){_0xaaf7af=_0xaaf7af||0xcc;return function(_0x16a0d9){if(_0x16a0d9){return _0x47b0d7[_0xd9ff('0x1a')](_0xaaf7af);}return _0x47b0d7[_0xd9ff('0x1b')](_0xaaf7af)[_0xd9ff('0x1c')]();};}function respondWithResult(_0x556aa4,_0x2f78c1){_0x2f78c1=_0x2f78c1||0xc8;return function(_0x3c9ace){if(_0x3c9ace){return _0x556aa4['status'](_0x2f78c1)[_0xd9ff('0x1d')](_0x3c9ace);}};}function respondWithFilteredResult(_0x5db010,_0x4ffe54){return function(_0x547e28){if(_0x547e28){var _0x4c5718=typeof _0x4ffe54[_0xd9ff('0x1e')]==='undefined'&&typeof _0x4ffe54[_0xd9ff('0x1f')]===_0xd9ff('0x20');var _0x39c6ce=_0x547e28[_0xd9ff('0x21')];var _0x5f45c4=_0x4c5718?0x0:_0x4ffe54[_0xd9ff('0x1e')];var _0x3ccf15=_0x4c5718?_0x547e28[_0xd9ff('0x21')]:_0x4ffe54[_0xd9ff('0x1e')]+_0x4ffe54[_0xd9ff('0x1f')];var _0x3ea97d;if(_0x3ccf15>=_0x39c6ce){_0x3ccf15=_0x39c6ce;_0x3ea97d=0xc8;}else{_0x3ea97d=0xce;}_0x5db010[_0xd9ff('0x1b')](_0x3ea97d);return _0x5db010[_0xd9ff('0x22')]('Content-Range',_0x5f45c4+'-'+_0x3ccf15+'/'+_0x39c6ce)['json'](_0x547e28);}return null;};}function patchUpdates(_0x264a3d){return function(_0x3eed13){try{jsonpatch['apply'](_0x3eed13,_0x264a3d,!![]);}catch(_0x588151){return BPromise['reject'](_0x588151);}return _0x3eed13['save']();};}function saveUpdates(_0x1f4d9e,_0x58eb5f){return function(_0x4c486a){if(_0x4c486a){return _0x4c486a[_0xd9ff('0x23')](_0x1f4d9e)[_0xd9ff('0x24')](function(_0x9f074e){return _0x9f074e;});}return null;};}function removeEntity(_0x278b66,_0x42a828){return function(_0x4b058a){if(_0x4b058a){return _0x4b058a['destroy']()[_0xd9ff('0x24')](function(){_0x278b66['status'](0xcc)[_0xd9ff('0x1c')]();});}};}function handleEntityNotFound(_0x4d86fe,_0x285002){return function(_0x5d45b3){if(!_0x5d45b3){_0x4d86fe[_0xd9ff('0x1a')](0x194);}return _0x5d45b3;};}function handleError(_0x159e56,_0x2138b4){_0x2138b4=_0x2138b4||0x1f4;return function(_0x2970e8){logger['error'](_0x2970e8[_0xd9ff('0x25')]);if(_0x2970e8[_0xd9ff('0x26')]){delete _0x2970e8[_0xd9ff('0x26')];}_0x159e56[_0xd9ff('0x1b')](_0x2138b4)['send'](_0x2970e8);};}exports[_0xd9ff('0x27')]=function(_0x3792d9,_0x44b5a7){var _0x45fb63={},_0x263d3a={},_0xe516e2={'count':0x0,'rows':[]};var _0x420ffa=_[_0xd9ff('0x28')](db[_0xd9ff('0x29')]['rawAttributes'],function(_0xcea5db){return{'name':_0xcea5db['fieldName'],'type':_0xcea5db[_0xd9ff('0x2a')][_0xd9ff('0x2b')]};});_0x263d3a[_0xd9ff('0x2c')]=_['map'](_0x420ffa,_0xd9ff('0x26'));_0x263d3a[_0xd9ff('0x2d')]=_[_0xd9ff('0x2e')](_0x3792d9[_0xd9ff('0x2d')]);_0x263d3a['filters']=_[_0xd9ff('0x2f')](_0x263d3a['model'],_0x263d3a[_0xd9ff('0x2d')]);_0x45fb63[_0xd9ff('0x30')]=_[_0xd9ff('0x2f')](_0x263d3a[_0xd9ff('0x2c')],qs[_0xd9ff('0x31')](_0x3792d9[_0xd9ff('0x2d')][_0xd9ff('0x31')]));_0x45fb63[_0xd9ff('0x30')]=_0x45fb63[_0xd9ff('0x30')][_0xd9ff('0x32')]?_0x45fb63[_0xd9ff('0x30')]:_0x263d3a[_0xd9ff('0x2c')];if(!_0x3792d9[_0xd9ff('0x2d')][_0xd9ff('0x33')]('nolimit')){_0x45fb63[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x3792d9[_0xd9ff('0x2d')]['limit']);_0x45fb63[_0xd9ff('0x1e')]=qs['offset'](_0x3792d9[_0xd9ff('0x2d')]['offset']);}_0x45fb63[_0xd9ff('0x34')]=qs['sort'](_0x3792d9[_0xd9ff('0x2d')][_0xd9ff('0x35')]);_0x45fb63[_0xd9ff('0x36')]=qs['filters'](_['pick'](_0x3792d9['query'],_0x263d3a[_0xd9ff('0x37')]),_0x420ffa);if(_0x3792d9[_0xd9ff('0x2d')][_0xd9ff('0x38')]){_0x45fb63[_0xd9ff('0x36')]=_[_0xd9ff('0x39')](_0x45fb63[_0xd9ff('0x36')],{'$or':_['map'](_0x420ffa,function(_0x4c00c2){if(_0x4c00c2['type']!==_0xd9ff('0x3a')){var _0x252edc={};_0x252edc[_0x4c00c2[_0xd9ff('0x26')]]={'$like':'%'+_0x3792d9[_0xd9ff('0x2d')]['filter']+'%'};return _0x252edc;}})});}_0x45fb63=_[_0xd9ff('0x39')]({},_0x45fb63,_0x3792d9['options']);var _0x3cff52={'where':_0x45fb63[_0xd9ff('0x36')]};return db[_0xd9ff('0x29')][_0xd9ff('0x21')](_0x3cff52)['then'](function(_0x1e34da){_0xe516e2[_0xd9ff('0x21')]=_0x1e34da;if(_0x3792d9['query'][_0xd9ff('0x3b')]){_0x45fb63[_0xd9ff('0x3c')]=[{'all':!![]}];}return db[_0xd9ff('0x29')][_0xd9ff('0x3d')](_0x45fb63);})[_0xd9ff('0x24')](function(_0x1cc848){_0xe516e2['rows']=_0x1cc848;return _0xe516e2;})[_0xd9ff('0x24')](respondWithFilteredResult(_0x44b5a7,_0x45fb63))[_0xd9ff('0x3e')](handleError(_0x44b5a7,null));};exports[_0xd9ff('0x3f')]=function(_0x39fbbb,_0x472724){var _0x52aab8={'raw':![],'where':{'id':_0x39fbbb[_0xd9ff('0x40')]['id']}},_0x3178cd={};_0x3178cd[_0xd9ff('0x2c')]=_['keys'](db['ZendeskAccount'][_0xd9ff('0x41')]);_0x3178cd[_0xd9ff('0x2d')]=_[_0xd9ff('0x2e')](_0x39fbbb[_0xd9ff('0x2d')]);_0x3178cd[_0xd9ff('0x37')]=_[_0xd9ff('0x2f')](_0x3178cd['model'],_0x3178cd[_0xd9ff('0x2d')]);_0x52aab8[_0xd9ff('0x30')]=_['intersection'](_0x3178cd[_0xd9ff('0x2c')],qs[_0xd9ff('0x31')](_0x39fbbb[_0xd9ff('0x2d')][_0xd9ff('0x31')]));_0x52aab8[_0xd9ff('0x30')]=_0x52aab8['attributes']['length']?_0x52aab8['attributes']:_0x3178cd[_0xd9ff('0x2c')];if(_0x39fbbb['query'][_0xd9ff('0x3b')]){_0x52aab8[_0xd9ff('0x3c')]=[{'all':!![]}];}_0x52aab8=_[_0xd9ff('0x39')]({},_0x52aab8,_0x39fbbb['options']);return db[_0xd9ff('0x29')][_0xd9ff('0x42')](_0x52aab8)['then'](handleEntityNotFound(_0x472724,null))[_0xd9ff('0x24')](respondWithResult(_0x472724,null))[_0xd9ff('0x3e')](handleError(_0x472724,null));};exports[_0xd9ff('0x43')]=function(_0x316854,_0x559101){return db[_0xd9ff('0x29')]['create'](_0x316854[_0xd9ff('0x44')],{})['then'](respondWithResult(_0x559101,0xc9))[_0xd9ff('0x3e')](handleError(_0x559101,null));};exports[_0xd9ff('0x23')]=function(_0x2bf37a,_0x1760c3){if(_0x2bf37a[_0xd9ff('0x44')]['id']){delete _0x2bf37a['body']['id'];}return db[_0xd9ff('0x29')][_0xd9ff('0x42')]({'where':{'id':_0x2bf37a[_0xd9ff('0x40')]['id']}})[_0xd9ff('0x24')](handleEntityNotFound(_0x1760c3,null))['then'](saveUpdates(_0x2bf37a['body'],null))['then'](respondWithResult(_0x1760c3,null))[_0xd9ff('0x3e')](handleError(_0x1760c3,null));};exports[_0xd9ff('0x45')]=function(_0x29c6bd,_0x572618){return db[_0xd9ff('0x29')][_0xd9ff('0x42')]({'where':{'id':_0x29c6bd[_0xd9ff('0x40')]['id']}})[_0xd9ff('0x24')](handleEntityNotFound(_0x572618,null))[_0xd9ff('0x24')](removeEntity(_0x572618,null))[_0xd9ff('0x3e')](handleError(_0x572618,null));};exports[_0xd9ff('0x46')]=function(_0x1e1364,_0x1ad160,_0x10d9d0){var _0x5dcb5={};var _0x3d6143={};var _0x2533d7;var _0x487b07;return db[_0xd9ff('0x29')]['findOne']({'where':{'id':_0x1e1364[_0xd9ff('0x40')]['id']}})['then'](handleEntityNotFound(_0x1ad160,null))[_0xd9ff('0x24')](function(_0x49623d){if(_0x49623d){_0x2533d7=_0x49623d;_0x3d6143[_0xd9ff('0x2c')]=_['keys'](db[_0xd9ff('0x47')]['rawAttributes']);_0x3d6143[_0xd9ff('0x2d')]=_['keys'](_0x1e1364[_0xd9ff('0x2d')]);_0x3d6143['filters']=_[_0xd9ff('0x2f')](_0x3d6143[_0xd9ff('0x2c')],_0x3d6143[_0xd9ff('0x2d')]);_0x5dcb5[_0xd9ff('0x30')]=_['intersection'](_0x3d6143[_0xd9ff('0x2c')],qs[_0xd9ff('0x31')](_0x1e1364[_0xd9ff('0x2d')]['fields']));_0x5dcb5[_0xd9ff('0x30')]=_0x5dcb5[_0xd9ff('0x30')][_0xd9ff('0x32')]?_0x5dcb5[_0xd9ff('0x30')]:_0x3d6143[_0xd9ff('0x2c')];_0x5dcb5['order']=qs[_0xd9ff('0x35')](_0x1e1364[_0xd9ff('0x2d')][_0xd9ff('0x35')]);_0x5dcb5[_0xd9ff('0x36')]=qs[_0xd9ff('0x37')](_[_0xd9ff('0x48')](_0x1e1364[_0xd9ff('0x2d')],_0x3d6143['filters']));if(_0x1e1364[_0xd9ff('0x2d')][_0xd9ff('0x38')]){_0x5dcb5['where']=_[_0xd9ff('0x39')](_0x5dcb5[_0xd9ff('0x36')],{'$or':_['map'](_0x5dcb5[_0xd9ff('0x30')],function(_0x36d5c2){var _0x25d8d1={};_0x25d8d1[_0x36d5c2]={'$like':'%'+_0x1e1364['query']['filter']+'%'};return _0x25d8d1;})});}_0x5dcb5=_[_0xd9ff('0x39')]({},_0x5dcb5,_0x1e1364['options']);return _0x2533d7[_0xd9ff('0x46')](_0x5dcb5);}})[_0xd9ff('0x24')](function(_0x31907e){if(_0x31907e){_0x487b07=_0x31907e[_0xd9ff('0x32')];if(!_0x1e1364['query']['hasOwnProperty']('nolimit')){_0x5dcb5[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x1e1364[_0xd9ff('0x2d')][_0xd9ff('0x1f')]);_0x5dcb5[_0xd9ff('0x1e')]=qs['offset'](_0x1e1364[_0xd9ff('0x2d')]['offset']);}return _0x2533d7[_0xd9ff('0x46')](_0x5dcb5);}})[_0xd9ff('0x24')](function(_0x3f92c3){if(_0x3f92c3){return _0x3f92c3?{'count':_0x487b07,'rows':_0x3f92c3}:null;}})[_0xd9ff('0x24')](respondWithResult(_0x1ad160,null))[_0xd9ff('0x3e')](handleError(_0x1ad160,null));};exports[_0xd9ff('0x49')]=function(_0xed12df,_0xfcafbe,_0x5d633b){if(_0xed12df[_0xd9ff('0x44')]['id']){delete _0xed12df[_0xd9ff('0x44')]['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0xed12df[_0xd9ff('0x40')]['id']}})['then'](handleEntityNotFound(_0xfcafbe,null))[_0xd9ff('0x24')](function(_0x34fca4){if(_0x34fca4){_0xed12df['body'][_0xd9ff('0x4a')]=_0x34fca4['id'];_0xed12df[_0xd9ff('0x44')][_0xd9ff('0x4b')]=integrations[_0xd9ff('0x4c')](_0xed12df[_0xd9ff('0x44')]['channel'],_0xed12df[_0xd9ff('0x44')]['type']);_0xed12df['body'][_0xd9ff('0x4d')]=integrations[_0xd9ff('0x4e')](_0xed12df[_0xd9ff('0x44')][_0xd9ff('0x4f')],_0xed12df['body'][_0xd9ff('0x2a')]);return db[_0xd9ff('0x47')][_0xd9ff('0x43')](_0xed12df[_0xd9ff('0x44')],{'include':[{'model':db[_0xd9ff('0x50')],'as':_0xd9ff('0x4b')},{'model':db[_0xd9ff('0x50')],'as':_0xd9ff('0x4d')}]});}return null;})['then'](respondWithResult(_0xfcafbe,null))['catch'](handleError(_0xfcafbe,null));};exports['getFields']=function(_0x275fb9,_0x31db27,_0x514d59){var _0x196670='';return db[_0xd9ff('0x29')][_0xd9ff('0x51')]({'where':{'id':_0x275fb9[_0xd9ff('0x40')]['id']},'attributes':['id',_0xd9ff('0x52'),_0xd9ff('0x53'),_0xd9ff('0x54'),_0xd9ff('0x55'),'remoteUri']})[_0xd9ff('0x24')](handleEntityNotFound(_0x31db27,null))[_0xd9ff('0x24')](function(_0x228413){if(_0x228413){_0x196670=_0x228413['remoteUri'];var _0x14e936=_0x196670['slice'](-0x1);if(_0x14e936==='/'){_0x196670=_0x196670[_0xd9ff('0x56')](0x0,_0x196670[_0xd9ff('0x57')](_0x14e936));}var _0x25ee82={'method':'GET','uri':util[_0xd9ff('0x58')](_0xd9ff('0x59'),_0x196670,_0xd9ff('0x5a')),'json':!![]};switch(_0x228413[_0xd9ff('0x55')]){case'password':_0x25ee82[_0xd9ff('0x5b')]={'Authorization':util[_0xd9ff('0x58')](_0xd9ff('0x5c'),new Buffer(util['format'](_0xd9ff('0x5d'),_0x228413[_0xd9ff('0x52')],_0x228413[_0xd9ff('0x53')]))['toString'](_0xd9ff('0x5e')))};break;case _0xd9ff('0x54'):_0x25ee82[_0xd9ff('0x5b')]={'Authorization':util[_0xd9ff('0x58')](_0xd9ff('0x5c'),new Buffer(util['format'](_0xd9ff('0x5f'),_0x228413[_0xd9ff('0x52')],_0x228413['token']))[_0xd9ff('0x60')](_0xd9ff('0x5e')))};break;default:throw new db[(_0xd9ff('0x61'))]['ValidationError'](_0xd9ff('0x62'));}return rp(_0x25ee82);}})['then'](function(_0x1e46fc){if(_0x1e46fc){var _0x478e0d=[_0xd9ff('0x63'),_0xd9ff('0x64'),_0xd9ff('0x65'),_0xd9ff('0x66')];_[_0xd9ff('0x67')](_0x1e46fc[_0xd9ff('0x5a')],function(_0xda0003){return _0x478e0d[_0xd9ff('0x68')](_0xda0003[_0xd9ff('0x2a')]);});return{'count':_0x1e46fc[_0xd9ff('0x5a')]['length'],'rows':_[_0xd9ff('0x28')](_0x1e46fc[_0xd9ff('0x5a')],function(_0x1f6cb9){return{'id':_0x1f6cb9['id'],'name':_0x1f6cb9[_0xd9ff('0x69')]>0x7?_0x1f6cb9[_0xd9ff('0x6a')]:_0x1f6cb9[_0xd9ff('0x2a')],'custom':_0x1f6cb9['position']>0x7?!![]:![],'options':_0x1f6cb9['system_field_options']?_0x1f6cb9[_0xd9ff('0x6b')]:_0x1f6cb9[_0xd9ff('0x6c')]?_0x1f6cb9[_0xd9ff('0x6c')]:[]};})};}})[_0xd9ff('0x24')](respondWithResult(_0x31db27,null))[_0xd9ff('0x3e')](function(_0x183199){var _0x5b234c=_0x275fb9[_0xd9ff('0x2d')][_0xd9ff('0x6d')]?0x1f4:_0x183199[_0xd9ff('0x6e')]||0x1f4;logger[_0xd9ff('0x6f')](_0xd9ff('0x70'),_0xd9ff('0x71'),_0x5b234c,JSON['stringify'](_0x183199));delete _0x183199[_0xd9ff('0x26')];if(_0x5b234c===0x191){_0x5b234c=0x190;}_0x31db27[_0xd9ff('0x1b')](_0x5b234c)[_0xd9ff('0x72')](_0x275fb9[_0xd9ff('0x2d')][_0xd9ff('0x6d')]?{'message':_0xd9ff('0x73'),'statusCode':_0x183199[_0xd9ff('0x6e')]}:_0x183199);});}; \ No newline at end of file +var _0x351d=['Subjects','Descriptions','getFields','password','token','remoteUri','slice','substring','lastIndexOf','format','%s/%s','authType','headers','Basic\x20%s','%s:%s','username','toString','base64','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','ticket_fields','position','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../components/integrations/configuration','status','end','json','undefined','count','offset','Content-Range','apply','reject','then','destroy','sendStatus','stack','index','rawAttributes','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','where','pick','filter','merge','options','ZendeskAccount','includeAll','findAll','catch','params','include','find','create','body','update','findOne','ZendeskConfiguration','order','sort','getConfigurations','addConfiguration','AccountId','getSubjects','getDescriptions','channel','ZendeskField'];(function(_0x5bab45,_0x259f94){var _0x19080d=function(_0x3aa9ef){while(--_0x3aa9ef){_0x5bab45['push'](_0x5bab45['shift']());}};_0x19080d(++_0x259f94);}(_0x351d,0x90));var _0xd351=function(_0x5b03a9,_0x186abf){_0x5b03a9=_0x5b03a9-0x0;var _0x2b8afe=_0x351d[_0x5b03a9];return _0x2b8afe;};'use strict';var emlformat=require(_0xd351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd351('0x1'));var jsonpatch=require(_0xd351('0x2'));var rp=require(_0xd351('0x3'));var moment=require('moment');var BPromise=require(_0xd351('0x4'));var Mustache=require('mustache');var util=require(_0xd351('0x5'));var path=require(_0xd351('0x6'));var sox=require('sox');var csv=require(_0xd351('0x7'));var ejs=require(_0xd351('0x8'));var fs=require('fs');var fs_extra=require(_0xd351('0x9'));var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd351('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd351('0xe'));var as=require(_0xd351('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd351('0x10'))(_0xd351('0x11'));var utils=require('../../config/utils');var config=require(_0xd351('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xd351('0x13'));function respondWithStatusCode(_0x15549a,_0x23445f){_0x23445f=_0x23445f||0xcc;return function(_0x1eb2a9){if(_0x1eb2a9){return _0x15549a['sendStatus'](_0x23445f);}return _0x15549a[_0xd351('0x14')](_0x23445f)[_0xd351('0x15')]();};}function respondWithResult(_0x597d7c,_0xc5a145){_0xc5a145=_0xc5a145||0xc8;return function(_0xb106ef){if(_0xb106ef){return _0x597d7c[_0xd351('0x14')](_0xc5a145)[_0xd351('0x16')](_0xb106ef);}};}function respondWithFilteredResult(_0x3867fb,_0x4d238c){return function(_0x9f790f){if(_0x9f790f){var _0x49d8bb=typeof _0x4d238c['offset']===_0xd351('0x17')&&typeof _0x4d238c['limit']===_0xd351('0x17');var _0x1de35f=_0x9f790f[_0xd351('0x18')];var _0x4c6693=_0x49d8bb?0x0:_0x4d238c[_0xd351('0x19')];var _0x2bfc53=_0x49d8bb?_0x9f790f[_0xd351('0x18')]:_0x4d238c[_0xd351('0x19')]+_0x4d238c['limit'];var _0xc2d2c0;if(_0x2bfc53>=_0x1de35f){_0x2bfc53=_0x1de35f;_0xc2d2c0=0xc8;}else{_0xc2d2c0=0xce;}_0x3867fb['status'](_0xc2d2c0);return _0x3867fb['set'](_0xd351('0x1a'),_0x4c6693+'-'+_0x2bfc53+'/'+_0x1de35f)['json'](_0x9f790f);}return null;};}function patchUpdates(_0x33b1e5){return function(_0x2d75dd){try{jsonpatch[_0xd351('0x1b')](_0x2d75dd,_0x33b1e5,!![]);}catch(_0x42631b){return BPromise[_0xd351('0x1c')](_0x42631b);}return _0x2d75dd['save']();};}function saveUpdates(_0x18625b,_0xbbc58){return function(_0x241265){if(_0x241265){return _0x241265['update'](_0x18625b)[_0xd351('0x1d')](function(_0x2d9aa0){return _0x2d9aa0;});}return null;};}function removeEntity(_0x365bbc,_0x59fb6d){return function(_0x1ce279){if(_0x1ce279){return _0x1ce279[_0xd351('0x1e')]()[_0xd351('0x1d')](function(){_0x365bbc[_0xd351('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40f7f3,_0x483c92){return function(_0x358bff){if(!_0x358bff){_0x40f7f3[_0xd351('0x1f')](0x194);}return _0x358bff;};}function handleError(_0x54f471,_0x2648d0){_0x2648d0=_0x2648d0||0x1f4;return function(_0x55b4d3){logger['error'](_0x55b4d3[_0xd351('0x20')]);if(_0x55b4d3['name']){delete _0x55b4d3['name'];}_0x54f471[_0xd351('0x14')](_0x2648d0)['send'](_0x55b4d3);};}exports[_0xd351('0x21')]=function(_0x2ddae8,_0x407b50){var _0x4d3f48={},_0x71ce9c={},_0x4aa902={'count':0x0,'rows':[]};var _0x1c826b=_['map'](db['ZendeskAccount'][_0xd351('0x22')],function(_0x38c82f){return{'name':_0x38c82f[_0xd351('0x23')],'type':_0x38c82f[_0xd351('0x24')]['key']};});_0x71ce9c[_0xd351('0x25')]=_[_0xd351('0x26')](_0x1c826b,_0xd351('0x27'));_0x71ce9c[_0xd351('0x28')]=_[_0xd351('0x29')](_0x2ddae8[_0xd351('0x28')]);_0x71ce9c[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x71ce9c[_0xd351('0x25')],_0x71ce9c['query']);_0x4d3f48[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x71ce9c[_0xd351('0x25')],qs[_0xd351('0x2d')](_0x2ddae8['query'][_0xd351('0x2d')]));_0x4d3f48[_0xd351('0x2c')]=_0x4d3f48[_0xd351('0x2c')][_0xd351('0x2e')]?_0x4d3f48[_0xd351('0x2c')]:_0x71ce9c[_0xd351('0x25')];if(!_0x2ddae8[_0xd351('0x28')][_0xd351('0x2f')](_0xd351('0x30'))){_0x4d3f48['limit']=qs['limit'](_0x2ddae8[_0xd351('0x28')][_0xd351('0x31')]);_0x4d3f48[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x2ddae8[_0xd351('0x28')][_0xd351('0x19')]);}_0x4d3f48['order']=qs['sort'](_0x2ddae8[_0xd351('0x28')]['sort']);_0x4d3f48[_0xd351('0x32')]=qs[_0xd351('0x2a')](_[_0xd351('0x33')](_0x2ddae8[_0xd351('0x28')],_0x71ce9c[_0xd351('0x2a')]),_0x1c826b);if(_0x2ddae8[_0xd351('0x28')][_0xd351('0x34')]){_0x4d3f48[_0xd351('0x32')]=_[_0xd351('0x35')](_0x4d3f48[_0xd351('0x32')],{'$or':_[_0xd351('0x26')](_0x1c826b,function(_0x4b15db){if(_0x4b15db[_0xd351('0x24')]!=='VIRTUAL'){var _0x22631={};_0x22631[_0x4b15db[_0xd351('0x27')]]={'$like':'%'+_0x2ddae8[_0xd351('0x28')][_0xd351('0x34')]+'%'};return _0x22631;}})});}_0x4d3f48=_[_0xd351('0x35')]({},_0x4d3f48,_0x2ddae8[_0xd351('0x36')]);var _0x545bfc={'where':_0x4d3f48[_0xd351('0x32')]};return db[_0xd351('0x37')]['count'](_0x545bfc)[_0xd351('0x1d')](function(_0x2d8ea8){_0x4aa902[_0xd351('0x18')]=_0x2d8ea8;if(_0x2ddae8[_0xd351('0x28')][_0xd351('0x38')]){_0x4d3f48['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0xd351('0x39')](_0x4d3f48);})[_0xd351('0x1d')](function(_0x5dae6d){_0x4aa902['rows']=_0x5dae6d;return _0x4aa902;})[_0xd351('0x1d')](respondWithFilteredResult(_0x407b50,_0x4d3f48))[_0xd351('0x3a')](handleError(_0x407b50,null));};exports['show']=function(_0x570d57,_0x46af23){var _0x18f9d1={'raw':![],'where':{'id':_0x570d57[_0xd351('0x3b')]['id']}},_0x3b8526={};_0x3b8526[_0xd351('0x25')]=_[_0xd351('0x29')](db[_0xd351('0x37')][_0xd351('0x22')]);_0x3b8526[_0xd351('0x28')]=_['keys'](_0x570d57['query']);_0x3b8526[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x3b8526[_0xd351('0x25')],_0x3b8526[_0xd351('0x28')]);_0x18f9d1[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x3b8526[_0xd351('0x25')],qs[_0xd351('0x2d')](_0x570d57[_0xd351('0x28')][_0xd351('0x2d')]));_0x18f9d1[_0xd351('0x2c')]=_0x18f9d1[_0xd351('0x2c')][_0xd351('0x2e')]?_0x18f9d1[_0xd351('0x2c')]:_0x3b8526[_0xd351('0x25')];if(_0x570d57[_0xd351('0x28')]['includeAll']){_0x18f9d1[_0xd351('0x3c')]=[{'all':!![]}];}_0x18f9d1=_[_0xd351('0x35')]({},_0x18f9d1,_0x570d57[_0xd351('0x36')]);return db['ZendeskAccount'][_0xd351('0x3d')](_0x18f9d1)[_0xd351('0x1d')](handleEntityNotFound(_0x46af23,null))[_0xd351('0x1d')](respondWithResult(_0x46af23,null))[_0xd351('0x3a')](handleError(_0x46af23,null));};exports[_0xd351('0x3e')]=function(_0x5bc86a,_0x5adea4){return db['ZendeskAccount'][_0xd351('0x3e')](_0x5bc86a[_0xd351('0x3f')],{})['then'](respondWithResult(_0x5adea4,0xc9))['catch'](handleError(_0x5adea4,null));};exports[_0xd351('0x40')]=function(_0x444206,_0x2af877){if(_0x444206['body']['id']){delete _0x444206[_0xd351('0x3f')]['id'];}return db[_0xd351('0x37')]['find']({'where':{'id':_0x444206[_0xd351('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2af877,null))[_0xd351('0x1d')](saveUpdates(_0x444206[_0xd351('0x3f')],null))['then'](respondWithResult(_0x2af877,null))['catch'](handleError(_0x2af877,null));};exports[_0xd351('0x1e')]=function(_0x58ce5a,_0xf9f375){return db[_0xd351('0x37')][_0xd351('0x3d')]({'where':{'id':_0x58ce5a['params']['id']}})[_0xd351('0x1d')](handleEntityNotFound(_0xf9f375,null))['then'](removeEntity(_0xf9f375,null))['catch'](handleError(_0xf9f375,null));};exports['getConfigurations']=function(_0x7e4bad,_0x292af3,_0x334029){var _0x5a2e9b={};var _0x554e3a={};var _0x1748f0;var _0x42f248;return db['ZendeskAccount'][_0xd351('0x41')]({'where':{'id':_0x7e4bad[_0xd351('0x3b')]['id']}})['then'](handleEntityNotFound(_0x292af3,null))[_0xd351('0x1d')](function(_0x59ab0f){if(_0x59ab0f){_0x1748f0=_0x59ab0f;_0x554e3a[_0xd351('0x25')]=_['keys'](db[_0xd351('0x42')][_0xd351('0x22')]);_0x554e3a[_0xd351('0x28')]=_[_0xd351('0x29')](_0x7e4bad[_0xd351('0x28')]);_0x554e3a[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x554e3a['model'],_0x554e3a['query']);_0x5a2e9b[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x554e3a['model'],qs[_0xd351('0x2d')](_0x7e4bad[_0xd351('0x28')][_0xd351('0x2d')]));_0x5a2e9b['attributes']=_0x5a2e9b[_0xd351('0x2c')]['length']?_0x5a2e9b['attributes']:_0x554e3a[_0xd351('0x25')];_0x5a2e9b[_0xd351('0x43')]=qs['sort'](_0x7e4bad[_0xd351('0x28')][_0xd351('0x44')]);_0x5a2e9b[_0xd351('0x32')]=qs[_0xd351('0x2a')](_[_0xd351('0x33')](_0x7e4bad[_0xd351('0x28')],_0x554e3a['filters']));if(_0x7e4bad[_0xd351('0x28')][_0xd351('0x34')]){_0x5a2e9b[_0xd351('0x32')]=_[_0xd351('0x35')](_0x5a2e9b[_0xd351('0x32')],{'$or':_[_0xd351('0x26')](_0x5a2e9b[_0xd351('0x2c')],function(_0x4b2029){var _0x24dcdb={};_0x24dcdb[_0x4b2029]={'$like':'%'+_0x7e4bad['query'][_0xd351('0x34')]+'%'};return _0x24dcdb;})});}_0x5a2e9b=_[_0xd351('0x35')]({},_0x5a2e9b,_0x7e4bad[_0xd351('0x36')]);return _0x1748f0[_0xd351('0x45')](_0x5a2e9b);}})[_0xd351('0x1d')](function(_0x4eaf18){if(_0x4eaf18){_0x42f248=_0x4eaf18[_0xd351('0x2e')];if(!_0x7e4bad['query'][_0xd351('0x2f')](_0xd351('0x30'))){_0x5a2e9b[_0xd351('0x31')]=qs[_0xd351('0x31')](_0x7e4bad[_0xd351('0x28')]['limit']);_0x5a2e9b['offset']=qs[_0xd351('0x19')](_0x7e4bad[_0xd351('0x28')]['offset']);}return _0x1748f0[_0xd351('0x45')](_0x5a2e9b);}})[_0xd351('0x1d')](function(_0x2718e9){if(_0x2718e9){return _0x2718e9?{'count':_0x42f248,'rows':_0x2718e9}:null;}})['then'](respondWithResult(_0x292af3,null))[_0xd351('0x3a')](handleError(_0x292af3,null));};exports[_0xd351('0x46')]=function(_0x284d12,_0x5dbdef,_0x5d13ec){if(_0x284d12['body']['id']){delete _0x284d12[_0xd351('0x3f')]['id'];}return db[_0xd351('0x37')][_0xd351('0x41')]({'where':{'id':_0x284d12[_0xd351('0x3b')]['id']}})[_0xd351('0x1d')](handleEntityNotFound(_0x5dbdef,null))[_0xd351('0x1d')](function(_0x2c83fe){if(_0x2c83fe){_0x284d12['body'][_0xd351('0x47')]=_0x2c83fe['id'];_0x284d12['body']['Subjects']=integrations[_0xd351('0x48')](_0x284d12[_0xd351('0x3f')]['channel'],_0x284d12[_0xd351('0x3f')]['type']);_0x284d12['body']['Descriptions']=integrations[_0xd351('0x49')](_0x284d12[_0xd351('0x3f')][_0xd351('0x4a')],_0x284d12['body'][_0xd351('0x24')]);return db[_0xd351('0x42')][_0xd351('0x3e')](_0x284d12[_0xd351('0x3f')],{'include':[{'model':db[_0xd351('0x4b')],'as':_0xd351('0x4c')},{'model':db[_0xd351('0x4b')],'as':_0xd351('0x4d')}]});}return null;})[_0xd351('0x1d')](respondWithResult(_0x5dbdef,null))[_0xd351('0x3a')](handleError(_0x5dbdef,null));};exports[_0xd351('0x4e')]=function(_0x4d20af,_0x2fcede,_0x2d59a5){var _0x431e91='';return db[_0xd351('0x37')][_0xd351('0x41')]({'where':{'id':_0x4d20af[_0xd351('0x3b')]['id']},'attributes':['id','username',_0xd351('0x4f'),_0xd351('0x50'),'authType','remoteUri']})[_0xd351('0x1d')](handleEntityNotFound(_0x2fcede,null))[_0xd351('0x1d')](function(_0x44dc58){if(_0x44dc58){_0x431e91=_0x44dc58[_0xd351('0x51')];var _0x1db455=_0x431e91[_0xd351('0x52')](-0x1);if(_0x1db455==='/'){_0x431e91=_0x431e91[_0xd351('0x53')](0x0,_0x431e91[_0xd351('0x54')](_0x1db455));}var _0x3ce2b9={'method':'GET','uri':util[_0xd351('0x55')](_0xd351('0x56'),_0x431e91,'ticket_fields'),'json':!![]};switch(_0x44dc58[_0xd351('0x57')]){case'password':_0x3ce2b9[_0xd351('0x58')]={'Authorization':util['format'](_0xd351('0x59'),new Buffer(util[_0xd351('0x55')](_0xd351('0x5a'),_0x44dc58[_0xd351('0x5b')],_0x44dc58[_0xd351('0x4f')]))[_0xd351('0x5c')](_0xd351('0x5d')))};break;case'token':_0x3ce2b9[_0xd351('0x58')]={'Authorization':util[_0xd351('0x55')](_0xd351('0x59'),new Buffer(util[_0xd351('0x55')](_0xd351('0x5e'),_0x44dc58['username'],_0x44dc58[_0xd351('0x50')]))[_0xd351('0x5c')](_0xd351('0x5d')))};break;default:throw new db['Sequelize'][(_0xd351('0x5f'))](_0xd351('0x60'));}return rp(_0x3ce2b9);}})[_0xd351('0x1d')](function(_0x3f0d27){if(_0x3f0d27){var _0x3635ad=[_0xd351('0x61'),_0xd351('0x62'),_0xd351('0x63'),_0xd351('0x64')];_['remove'](_0x3f0d27[_0xd351('0x65')],function(_0x190a00){return _0x3635ad['includes'](_0x190a00[_0xd351('0x24')]);});return{'count':_0x3f0d27['ticket_fields']['length'],'rows':_['map'](_0x3f0d27[_0xd351('0x65')],function(_0x3367f8){return{'id':_0x3367f8['id'],'name':_0x3367f8[_0xd351('0x66')]>0x7?_0x3367f8['title']:_0x3367f8[_0xd351('0x24')],'custom':_0x3367f8['position']>0x7?!![]:![],'options':_0x3367f8[_0xd351('0x67')]?_0x3367f8['system_field_options']:_0x3367f8[_0xd351('0x68')]?_0x3367f8[_0xd351('0x68')]:[]};})};}})[_0xd351('0x1d')](respondWithResult(_0x2fcede,null))[_0xd351('0x3a')](function(_0x35b148){var _0x1bb955=_0x4d20af[_0xd351('0x28')][_0xd351('0x69')]?0x1f4:_0x35b148[_0xd351('0x6a')]||0x1f4;logger[_0xd351('0x6b')](_0xd351('0x6c'),_0xd351('0x4e'),_0x1bb955,JSON['stringify'](_0x35b148));delete _0x35b148[_0xd351('0x27')];if(_0x1bb955===0x191){_0x1bb955=0x190;}_0x2fcede[_0xd351('0x14')](_0x1bb955)[_0xd351('0x6d')](_0x4d20af[_0xd351('0x28')][_0xd351('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x35b148[_0xd351('0x6a')]}:_0x35b148);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index d64acf8..b987fb7 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 _0xeaac=['exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./intZendeskAccount.attributes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xeaac,0x88));var _0xceaa=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xeaac[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xceaa('0x0'));var util=require(_0xceaa('0x1'));var logger=require(_0xceaa('0x2'))('api');var moment=require(_0xceaa('0x3'));var BPromise=require('bluebird');var rp=require(_0xceaa('0x4'));var fs=require('fs');var path=require(_0xceaa('0x5'));var rimraf=require(_0xceaa('0x6'));var config=require('../../config/environment');var attributes=require(_0xceaa('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xceaa('0x8')]=function(_0x5e7003,_0x586a8b){return _0x5e7003[_0xceaa('0x9')](_0xceaa('0xa'),attributes,{'tableName':_0xceaa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1354=['ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x24ede0,_0x2cb415){var _0x9b5b31=function(_0x40f3a9){while(--_0x40f3a9){_0x24ede0['push'](_0x24ede0['shift']());}};_0x9b5b31(++_0x2cb415);}(_0x1354,0x19a));var _0x4135=function(_0x4dd063,_0x386d0c){_0x4dd063=_0x4dd063-0x0;var _0x2b8747=_0x1354[_0x4dd063];return _0x2b8747;};'use strict';var _=require(_0x4135('0x0'));var util=require(_0x4135('0x1'));var logger=require(_0x4135('0x2'))('api');var moment=require(_0x4135('0x3'));var BPromise=require('bluebird');var rp=require(_0x4135('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4135('0x5'));var attributes=require(_0x4135('0x6'));var integrations=require(_0x4135('0x7'));module[_0x4135('0x8')]=function(_0x3e2072,_0x5326e9){return _0x3e2072[_0x4135('0x9')](_0x4135('0xa'),attributes,{'tableName':_0x4135('0xb'),'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 89da37c..fa21456 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 _0x4f88=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','options','where','attributes','limit','include','map','model','info','GetZendeskAccount','catch','raw','ShowZendeskAccount','lodash'];(function(_0x4d09f8,_0x34e225){var _0x7d1097=function(_0xef4ec4){while(--_0xef4ec4){_0x4d09f8['push'](_0x4d09f8['shift']());}};_0x7d1097(++_0x34e225);}(_0x4f88,0x9a));var _0x84f8=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0x4f88[_0x100e36];return _0x1df0c9;};'use strict';var _=require(_0x84f8('0x0'));var util=require(_0x84f8('0x1'));var moment=require(_0x84f8('0x2'));var BPromise=require('bluebird');var rs=require(_0x84f8('0x3'));var fs=require('fs');var Redis=require(_0x84f8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x84f8('0x5'));var logger=require(_0x84f8('0x6'))(_0x84f8('0x7'));var config=require('../../config/environment');var jayson=require(_0x84f8('0x8'));var client=jayson[_0x84f8('0x9')][_0x84f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47e5ce,_0x1f1b26,_0x24858c){return new BPromise(function(_0x56b93d,_0x4deb88){return client['request'](_0x47e5ce,_0x24858c)[_0x84f8('0xb')](function(_0x27ebbf){logger['info'](_0x84f8('0xc'),_0x1f1b26,_0x84f8('0xd'));logger[_0x84f8('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x1f1b26,_0x84f8('0xd'),JSON[_0x84f8('0xf')](_0x27ebbf));if(_0x27ebbf['error']){if(_0x27ebbf[_0x84f8('0x10')][_0x84f8('0x11')]===0x1f4){logger[_0x84f8('0x10')](_0x84f8('0xc'),_0x1f1b26,_0x27ebbf[_0x84f8('0x10')][_0x84f8('0x12')]);return _0x4deb88(_0x27ebbf[_0x84f8('0x10')][_0x84f8('0x12')]);}logger[_0x84f8('0x10')](_0x84f8('0xc'),_0x1f1b26,_0x27ebbf['error'][_0x84f8('0x12')]);return _0x56b93d(_0x27ebbf[_0x84f8('0x10')][_0x84f8('0x12')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x1f1b26,_0x84f8('0xd'));_0x56b93d(_0x27ebbf['result'][_0x84f8('0x12')]);}})['catch'](function(_0x56be4e){logger[_0x84f8('0x10')](_0x84f8('0xc'),_0x1f1b26,_0x56be4e);_0x4deb88(_0x56be4e);});});}exports['GetZendeskAccount']=function(_0x4eb874){var _0x2704b5=this;return new Promise(function(_0xcae64b,_0x3c8dba){return db['ZendeskAccount']['findAll']({'raw':_0x4eb874[_0x84f8('0x13')]?_0x4eb874[_0x84f8('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x4eb874['options']?_0x4eb874[_0x84f8('0x13')][_0x84f8('0x14')]||null:null,'attributes':_0x4eb874[_0x84f8('0x13')]?_0x4eb874[_0x84f8('0x13')][_0x84f8('0x15')]||null:null,'limit':_0x4eb874[_0x84f8('0x13')]?_0x4eb874['options'][_0x84f8('0x16')]||null:null,'include':_0x4eb874[_0x84f8('0x13')]?_0x4eb874[_0x84f8('0x13')][_0x84f8('0x17')]?_[_0x84f8('0x18')](_0x4eb874['options'][_0x84f8('0x17')],function(_0x57da04){return{'model':db[_0x57da04['model']],'as':_0x57da04['as'],'attributes':_0x57da04['attributes'],'include':_0x57da04[_0x84f8('0x17')]?_['map'](_0x57da04[_0x84f8('0x17')],function(_0x2d44ee){return{'model':db[_0x2d44ee[_0x84f8('0x19')]],'as':_0x2d44ee['as'],'attributes':_0x2d44ee['attributes'],'include':_0x2d44ee['include']?_['map'](_0x2d44ee['include'],function(_0x49eb09){return{'model':db[_0x49eb09['model']],'as':_0x49eb09['as'],'attributes':_0x49eb09[_0x84f8('0x15')]};}):[]};}):[]};}):[]:[]})[_0x84f8('0xb')](function(_0x201101){logger[_0x84f8('0x1a')](_0x84f8('0x1b'),_0x4eb874);logger[_0x84f8('0xe')](_0x84f8('0x1b'),_0x4eb874,JSON[_0x84f8('0xf')](_0x201101));_0xcae64b(_0x201101);})[_0x84f8('0x1c')](function(_0x41f061){logger[_0x84f8('0x10')]('GetZendeskAccount',_0x41f061[_0x84f8('0x12')],_0x4eb874);_0x3c8dba(_0x2704b5[_0x84f8('0x10')](0x1f4,_0x41f061[_0x84f8('0x12')]));});});};exports['ShowZendeskAccount']=function(_0x29ae1d){var _0x3d2260=this;return new Promise(function(_0x4a9ef1,_0x31bb48){return db['ZendeskAccount']['find']({'raw':_0x29ae1d['options']?_0x29ae1d[_0x84f8('0x13')][_0x84f8('0x1d')]===undefined?!![]:![]:!![],'where':_0x29ae1d[_0x84f8('0x13')]?_0x29ae1d[_0x84f8('0x13')][_0x84f8('0x14')]||null:null,'attributes':_0x29ae1d[_0x84f8('0x13')]?_0x29ae1d[_0x84f8('0x13')][_0x84f8('0x15')]||null:null,'include':_0x29ae1d[_0x84f8('0x13')]?_0x29ae1d['options']['include']?_['map'](_0x29ae1d['options'][_0x84f8('0x17')],function(_0xfb33c5){return{'model':db[_0xfb33c5[_0x84f8('0x19')]],'as':_0xfb33c5['as'],'attributes':_0xfb33c5[_0x84f8('0x15')],'include':_0xfb33c5['include']?_[_0x84f8('0x18')](_0xfb33c5[_0x84f8('0x17')],function(_0xf40c2d){return{'model':db[_0xf40c2d[_0x84f8('0x19')]],'as':_0xf40c2d['as'],'attributes':_0xf40c2d['attributes'],'include':_0xf40c2d[_0x84f8('0x17')]?_[_0x84f8('0x18')](_0xf40c2d[_0x84f8('0x17')],function(_0x401ecc){return{'model':db[_0x401ecc[_0x84f8('0x19')]],'as':_0x401ecc['as'],'attributes':_0x401ecc[_0x84f8('0x15')]};}):[]};}):[]};}):[]:[]})[_0x84f8('0xb')](function(_0x14b964){logger[_0x84f8('0x1a')](_0x84f8('0x1e'),_0x29ae1d);logger[_0x84f8('0xe')]('ShowZendeskAccount',_0x29ae1d,JSON['stringify'](_0x14b964));_0x4a9ef1(_0x14b964);})[_0x84f8('0x1c')](function(_0xbfed98){logger['error'](_0x84f8('0x1e'),_0xbfed98['message'],_0x29ae1d);_0x31bb48(_0x3d2260[_0x84f8('0x10')](0x1f4,_0xbfed98[_0x84f8('0x12')]));});});}; \ No newline at end of file +var _0x4dcf=['model','then','ShowZendeskAccount','find','where','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','client','http','request','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','GetZendeskAccount','ZendeskAccount','options','raw','attributes','include','map'];(function(_0x37b3e5,_0x33b516){var _0x207f20=function(_0x5237fa){while(--_0x5237fa){_0x37b3e5['push'](_0x37b3e5['shift']());}};_0x207f20(++_0x33b516);}(_0x4dcf,0x106));var _0xf4dc=function(_0x3dffb5,_0x1964ac){_0x3dffb5=_0x3dffb5-0x0;var _0x252404=_0x4dcf[_0x3dffb5];return _0x252404;};'use strict';var _=require(_0xf4dc('0x0'));var util=require(_0xf4dc('0x1'));var moment=require(_0xf4dc('0x2'));var BPromise=require(_0xf4dc('0x3'));var rs=require(_0xf4dc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4dc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf4dc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf4dc('0x7')][_0xf4dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57551d,_0x231066,_0x1dbe5d){return new BPromise(function(_0x1d05fd,_0x9efb1){return client[_0xf4dc('0x9')](_0x57551d,_0x1dbe5d)['then'](function(_0x4e86fe){logger[_0xf4dc('0xa')]('ZendeskAccount,\x20%s,\x20%s',_0x231066,_0xf4dc('0xb'));logger[_0xf4dc('0xc')](_0xf4dc('0xd'),_0x231066,_0xf4dc('0xb'),JSON[_0xf4dc('0xe')](_0x4e86fe));if(_0x4e86fe['error']){if(_0x4e86fe[_0xf4dc('0xf')][_0xf4dc('0x10')]===0x1f4){logger['error'](_0xf4dc('0x11'),_0x231066,_0x4e86fe[_0xf4dc('0xf')][_0xf4dc('0x12')]);return _0x9efb1(_0x4e86fe[_0xf4dc('0xf')]['message']);}logger[_0xf4dc('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x231066,_0x4e86fe[_0xf4dc('0xf')][_0xf4dc('0x12')]);return _0x1d05fd(_0x4e86fe[_0xf4dc('0xf')][_0xf4dc('0x12')]);}else{logger[_0xf4dc('0xa')]('ZendeskAccount,\x20%s,\x20%s',_0x231066,_0xf4dc('0xb'));_0x1d05fd(_0x4e86fe['result'][_0xf4dc('0x12')]);}})['catch'](function(_0x56e082){logger[_0xf4dc('0xf')](_0xf4dc('0x11'),_0x231066,_0x56e082);_0x9efb1(_0x56e082);});});}exports[_0xf4dc('0x13')]=function(_0x2b88bf){var _0x5f0113=this;return new Promise(function(_0x56a72a,_0x10c79e){return db[_0xf4dc('0x14')]['findAll']({'raw':_0x2b88bf[_0xf4dc('0x15')]?_0x2b88bf['options'][_0xf4dc('0x16')]===undefined?!![]:![]:!![],'where':_0x2b88bf[_0xf4dc('0x15')]?_0x2b88bf[_0xf4dc('0x15')]['where']||null:null,'attributes':_0x2b88bf[_0xf4dc('0x15')]?_0x2b88bf[_0xf4dc('0x15')][_0xf4dc('0x17')]||null:null,'limit':_0x2b88bf['options']?_0x2b88bf[_0xf4dc('0x15')]['limit']||null:null,'include':_0x2b88bf[_0xf4dc('0x15')]?_0x2b88bf[_0xf4dc('0x15')][_0xf4dc('0x18')]?_[_0xf4dc('0x19')](_0x2b88bf[_0xf4dc('0x15')][_0xf4dc('0x18')],function(_0x340068){return{'model':db[_0x340068[_0xf4dc('0x1a')]],'as':_0x340068['as'],'attributes':_0x340068[_0xf4dc('0x17')],'include':_0x340068[_0xf4dc('0x18')]?_['map'](_0x340068[_0xf4dc('0x18')],function(_0x5a91ac){return{'model':db[_0x5a91ac[_0xf4dc('0x1a')]],'as':_0x5a91ac['as'],'attributes':_0x5a91ac[_0xf4dc('0x17')],'include':_0x5a91ac['include']?_['map'](_0x5a91ac[_0xf4dc('0x18')],function(_0x24249d){return{'model':db[_0x24249d['model']],'as':_0x24249d['as'],'attributes':_0x24249d[_0xf4dc('0x17')]};}):[]};}):[]};}):[]:[]})[_0xf4dc('0x1b')](function(_0x1ffb3f){logger[_0xf4dc('0xa')](_0xf4dc('0x13'),_0x2b88bf);logger[_0xf4dc('0xc')](_0xf4dc('0x13'),_0x2b88bf,JSON[_0xf4dc('0xe')](_0x1ffb3f));_0x56a72a(_0x1ffb3f);})['catch'](function(_0x8dad8c){logger[_0xf4dc('0xf')](_0xf4dc('0x13'),_0x8dad8c['message'],_0x2b88bf);_0x10c79e(_0x5f0113[_0xf4dc('0xf')](0x1f4,_0x8dad8c['message']));});});};exports[_0xf4dc('0x1c')]=function(_0x13f01f){var _0x45170f=this;return new Promise(function(_0x502e78,_0x4da29c){return db['ZendeskAccount'][_0xf4dc('0x1d')]({'raw':_0x13f01f['options']?_0x13f01f[_0xf4dc('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x13f01f[_0xf4dc('0x15')]?_0x13f01f[_0xf4dc('0x15')][_0xf4dc('0x1e')]||null:null,'attributes':_0x13f01f[_0xf4dc('0x15')]?_0x13f01f['options'][_0xf4dc('0x17')]||null:null,'include':_0x13f01f['options']?_0x13f01f['options'][_0xf4dc('0x18')]?_[_0xf4dc('0x19')](_0x13f01f[_0xf4dc('0x15')][_0xf4dc('0x18')],function(_0x513990){return{'model':db[_0x513990[_0xf4dc('0x1a')]],'as':_0x513990['as'],'attributes':_0x513990[_0xf4dc('0x17')],'include':_0x513990['include']?_['map'](_0x513990[_0xf4dc('0x18')],function(_0x4b4123){return{'model':db[_0x4b4123[_0xf4dc('0x1a')]],'as':_0x4b4123['as'],'attributes':_0x4b4123['attributes'],'include':_0x4b4123[_0xf4dc('0x18')]?_[_0xf4dc('0x19')](_0x4b4123['include'],function(_0xfc9cb){return{'model':db[_0xfc9cb['model']],'as':_0xfc9cb['as'],'attributes':_0xfc9cb[_0xf4dc('0x17')]};}):[]};}):[]};}):[]:[]})[_0xf4dc('0x1b')](function(_0x2b8a45){logger[_0xf4dc('0xa')](_0xf4dc('0x1c'),_0x13f01f);logger[_0xf4dc('0xc')](_0xf4dc('0x1c'),_0x13f01f,JSON['stringify'](_0x2b8a45));_0x502e78(_0x2b8a45);})[_0xf4dc('0x1f')](function(_0x5a526d){logger[_0xf4dc('0xf')]('ShowZendeskAccount',_0x5a526d[_0xf4dc('0x12')],_0x13f01f);_0x4da29c(_0x45170f[_0xf4dc('0xf')](0x1f4,_0x5a526d[_0xf4dc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 1c91f33..795324c 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 _0x087b=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x191869,_0x3a8b52){var _0x5d93e4=function(_0x3e86f3){while(--_0x3e86f3){_0x191869['push'](_0x191869['shift']());}};_0x5d93e4(++_0x3a8b52);}(_0x087b,0x11a));var _0xb087=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x087b[_0x819464];return _0x49dcc0;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/subjects',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x8')]('/:id/tags',auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);router[_0xb087('0x13')]('/',auth['isAuthenticated'](),controller[_0xb087('0x14')]);router[_0xb087('0x13')](_0xb087('0x15'),auth[_0xb087('0x9')](),controller[_0xb087('0x16')]);router[_0xb087('0x17')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x18')]);router[_0xb087('0x19')]('/:id',auth[_0xb087('0x9')](),controller[_0xb087('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x0713=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','setTags','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x492115,_0x43cb4b){var _0x24cba8=function(_0x25ef55){while(--_0x25ef55){_0x492115['push'](_0x492115['shift']());}};_0x24cba8(++_0x43cb4b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['getFields']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/descriptions',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x8')](_0x3071('0x11'),auth[_0x3071('0x9')](),controller['getTags']);router['post']('/',auth[_0x3071('0x9')](),controller['create']);router[_0x3071('0x12')](_0x3071('0x11'),auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['put'](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x14')]);router[_0x3071('0x15')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x16')]);module[_0x3071('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 77fe1c1..4a3175e 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 _0x4ec9=['sequelize','STRING'];(function(_0x2023e1,_0xeca985){var _0x1fe133=function(_0x526d5f){while(--_0x526d5f){_0x2023e1['push'](_0x2023e1['shift']());}};_0x1fe133(++_0xeca985);}(_0x4ec9,0x19c));var _0x94ec=function(_0x2f2d88,_0x32815c){_0x2f2d88=_0x2f2d88-0x0;var _0x4742ee=_0x4ec9[_0x2f2d88];return _0x4742ee;};'use strict';var Sequelize=require(_0x94ec('0x0'));module['exports']={'name':{'type':Sequelize[_0x94ec('0x1')]},'description':{'type':Sequelize[_0x94ec('0x1')]}}; \ No newline at end of file +var _0x8c89=['STRING','sequelize','exports'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x8c89,0xf1));var _0x98c8=function(_0x4d5bc9,_0x1462a6){_0x4d5bc9=_0x4d5bc9-0x0;var _0x57f8a8=_0x8c89[_0x4d5bc9];return _0x57f8a8;};'use strict';var Sequelize=require(_0x98c8('0x0'));module[_0x98c8('0x1')]={'name':{'type':Sequelize[_0x98c8('0x2')]},'description':{'type':Sequelize[_0x98c8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index b208024..6b0d007 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 _0x749a=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','then','stack','name','index','map','ZendeskConfiguration','fieldName','type','keys','query','intersection','attributes','model','length','order','sort','filters','pick','filter','VIRTUAL','merge','options','where','include','findAll','rows','show','params','rawAttributes','fields','catch','create','update','find','findOne','ZendeskField','getFields','hasOwnProperty','getSubjects','nolimit','getDescriptions','getTags','setTags','body','ids','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5b165c,_0x2779c8){var _0x2f4008=function(_0x38fd36){while(--_0x38fd36){_0x5b165c['push'](_0x5b165c['shift']());}};_0x2f4008(++_0x2779c8);}(_0x749a,0x91));var _0xa749=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x749a[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa749('0x0'));var jsonpatch=require(_0xa749('0x1'));var rp=require('request-promise');var moment=require(_0xa749('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa749('0x3'));var util=require(_0xa749('0x4'));var path=require(_0xa749('0x5'));var sox=require('sox');var csv=require(_0xa749('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa749('0x7'));var _=require(_0xa749('0x8'));var squel=require(_0xa749('0x9'));var crypto=require(_0xa749('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa749('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa749('0xc'));var Papa=require(_0xa749('0xd'));var Redis=require(_0xa749('0xe'));var authService=require(_0xa749('0xf'));var qs=require(_0xa749('0x10'));var as=require(_0xa749('0x11'));var hardwareService=require(_0xa749('0x12'));var logger=require(_0xa749('0x13'))(_0xa749('0x14'));var utils=require(_0xa749('0x15'));var config=require(_0xa749('0x16'));var licenseUtil=require(_0xa749('0x17'));var db=require(_0xa749('0x18'))['db'];function respondWithStatusCode(_0x2284ed,_0x578792){_0x578792=_0x578792||0xcc;return function(_0xe0d962){if(_0xe0d962){return _0x2284ed[_0xa749('0x19')](_0x578792);}return _0x2284ed[_0xa749('0x1a')](_0x578792)[_0xa749('0x1b')]();};}function respondWithResult(_0x4009e7,_0x14d910){_0x14d910=_0x14d910||0xc8;return function(_0x2da8d6){if(_0x2da8d6){return _0x4009e7[_0xa749('0x1a')](_0x14d910)[_0xa749('0x1c')](_0x2da8d6);}};}function respondWithFilteredResult(_0x12a06d,_0x5b358c){return function(_0x40883c){if(_0x40883c){var _0x1f409f=typeof _0x5b358c[_0xa749('0x1d')]===_0xa749('0x1e')&&typeof _0x5b358c['limit']===_0xa749('0x1e');var _0x58799e=_0x40883c[_0xa749('0x1f')];var _0x3acb17=_0x1f409f?0x0:_0x5b358c[_0xa749('0x1d')];var _0x3e9caf=_0x1f409f?_0x40883c[_0xa749('0x1f')]:_0x5b358c[_0xa749('0x1d')]+_0x5b358c[_0xa749('0x20')];var _0x321b80;if(_0x3e9caf>=_0x58799e){_0x3e9caf=_0x58799e;_0x321b80=0xc8;}else{_0x321b80=0xce;}_0x12a06d['status'](_0x321b80);return _0x12a06d['set'](_0xa749('0x21'),_0x3acb17+'-'+_0x3e9caf+'/'+_0x58799e)[_0xa749('0x1c')](_0x40883c);}return null;};}function patchUpdates(_0x5461e9){return function(_0x1a05dd){try{jsonpatch[_0xa749('0x22')](_0x1a05dd,_0x5461e9,!![]);}catch(_0x157759){return BPromise['reject'](_0x157759);}return _0x1a05dd[_0xa749('0x23')]();};}function saveUpdates(_0x529b6b,_0x20fa9a){return function(_0xe38fbf){if(_0xe38fbf){return _0xe38fbf['update'](_0x529b6b)[_0xa749('0x24')](function(_0xfd28ad){return _0xfd28ad;});}return null;};}function removeEntity(_0x5daf48,_0x5825bf){return function(_0x2b1768){if(_0x2b1768){return _0x2b1768['destroy']()[_0xa749('0x24')](function(){_0x5daf48[_0xa749('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fe7dc,_0x2f2257){return function(_0x4e732e){if(!_0x4e732e){_0x4fe7dc[_0xa749('0x19')](0x194);}return _0x4e732e;};}function handleError(_0x3761ad,_0x1435df){_0x1435df=_0x1435df||0x1f4;return function(_0x31b76c){logger['error'](_0x31b76c[_0xa749('0x25')]);if(_0x31b76c[_0xa749('0x26')]){delete _0x31b76c['name'];}_0x3761ad[_0xa749('0x1a')](_0x1435df)['send'](_0x31b76c);};}exports[_0xa749('0x27')]=function(_0x566b2d,_0x55f2a0){var _0x3eb98e={},_0xea908f={},_0x5bfafe={'count':0x0,'rows':[]};var _0x41a605=_[_0xa749('0x28')](db[_0xa749('0x29')]['rawAttributes'],function(_0x25b44a){return{'name':_0x25b44a[_0xa749('0x2a')],'type':_0x25b44a[_0xa749('0x2b')]['key']};});_0xea908f['model']=_[_0xa749('0x28')](_0x41a605,_0xa749('0x26'));_0xea908f['query']=_[_0xa749('0x2c')](_0x566b2d[_0xa749('0x2d')]);_0xea908f['filters']=_[_0xa749('0x2e')](_0xea908f['model'],_0xea908f[_0xa749('0x2d')]);_0x3eb98e[_0xa749('0x2f')]=_[_0xa749('0x2e')](_0xea908f[_0xa749('0x30')],qs['fields'](_0x566b2d['query']['fields']));_0x3eb98e[_0xa749('0x2f')]=_0x3eb98e[_0xa749('0x2f')][_0xa749('0x31')]?_0x3eb98e[_0xa749('0x2f')]:_0xea908f['model'];if(!_0x566b2d['query']['hasOwnProperty']('nolimit')){_0x3eb98e[_0xa749('0x20')]=qs[_0xa749('0x20')](_0x566b2d[_0xa749('0x2d')][_0xa749('0x20')]);_0x3eb98e[_0xa749('0x1d')]=qs[_0xa749('0x1d')](_0x566b2d[_0xa749('0x2d')][_0xa749('0x1d')]);}_0x3eb98e[_0xa749('0x32')]=qs[_0xa749('0x33')](_0x566b2d[_0xa749('0x2d')][_0xa749('0x33')]);_0x3eb98e['where']=qs[_0xa749('0x34')](_[_0xa749('0x35')](_0x566b2d[_0xa749('0x2d')],_0xea908f[_0xa749('0x34')]),_0x41a605);if(_0x566b2d[_0xa749('0x2d')][_0xa749('0x36')]){_0x3eb98e['where']=_['merge'](_0x3eb98e['where'],{'$or':_[_0xa749('0x28')](_0x41a605,function(_0x5db2c3){if(_0x5db2c3[_0xa749('0x2b')]!==_0xa749('0x37')){var _0x6b29b={};_0x6b29b[_0x5db2c3[_0xa749('0x26')]]={'$like':'%'+_0x566b2d[_0xa749('0x2d')][_0xa749('0x36')]+'%'};return _0x6b29b;}})});}_0x3eb98e=_[_0xa749('0x38')]({},_0x3eb98e,_0x566b2d[_0xa749('0x39')]);var _0x4b972c={'where':_0x3eb98e[_0xa749('0x3a')]};return db['ZendeskConfiguration'][_0xa749('0x1f')](_0x4b972c)[_0xa749('0x24')](function(_0xf8bfe){_0x5bfafe['count']=_0xf8bfe;if(_0x566b2d[_0xa749('0x2d')]['includeAll']){_0x3eb98e[_0xa749('0x3b')]=[{'all':!![]}];}return db[_0xa749('0x29')][_0xa749('0x3c')](_0x3eb98e);})[_0xa749('0x24')](function(_0x3f5010){_0x5bfafe[_0xa749('0x3d')]=_0x3f5010;return _0x5bfafe;})[_0xa749('0x24')](respondWithFilteredResult(_0x55f2a0,_0x3eb98e))['catch'](handleError(_0x55f2a0,null));};exports[_0xa749('0x3e')]=function(_0x19fbc4,_0x30dbc5){var _0x37a2da={'raw':![],'where':{'id':_0x19fbc4[_0xa749('0x3f')]['id']}},_0x3e5796={};_0x3e5796[_0xa749('0x30')]=_['keys'](db['ZendeskConfiguration'][_0xa749('0x40')]);_0x3e5796[_0xa749('0x2d')]=_['keys'](_0x19fbc4['query']);_0x3e5796['filters']=_['intersection'](_0x3e5796[_0xa749('0x30')],_0x3e5796['query']);_0x37a2da[_0xa749('0x2f')]=_['intersection'](_0x3e5796[_0xa749('0x30')],qs[_0xa749('0x41')](_0x19fbc4['query'][_0xa749('0x41')]));_0x37a2da[_0xa749('0x2f')]=_0x37a2da[_0xa749('0x2f')][_0xa749('0x31')]?_0x37a2da[_0xa749('0x2f')]:_0x3e5796['model'];if(_0x19fbc4['query']['includeAll']){_0x37a2da[_0xa749('0x3b')]=[{'all':!![]}];}_0x37a2da=_[_0xa749('0x38')]({},_0x37a2da,_0x19fbc4['options']);return db[_0xa749('0x29')]['find'](_0x37a2da)[_0xa749('0x24')](handleEntityNotFound(_0x30dbc5,null))[_0xa749('0x24')](respondWithResult(_0x30dbc5,null))[_0xa749('0x42')](handleError(_0x30dbc5,null));};exports[_0xa749('0x43')]=function(_0x4e855d,_0x22332c){return db[_0xa749('0x29')][_0xa749('0x43')](_0x4e855d['body'],{})['then'](respondWithResult(_0x22332c,0xc9))[_0xa749('0x42')](handleError(_0x22332c,null));};exports[_0xa749('0x44')]=function(_0x42f434,_0x1d9184){if(_0x42f434['body']['id']){delete _0x42f434['body']['id'];}return db['ZendeskConfiguration'][_0xa749('0x45')]({'where':{'id':_0x42f434[_0xa749('0x3f')]['id']}})[_0xa749('0x24')](handleEntityNotFound(_0x1d9184,null))['then'](saveUpdates(_0x42f434['body'],null))['then'](respondWithResult(_0x1d9184,null))[_0xa749('0x42')](handleError(_0x1d9184,null));};exports['destroy']=function(_0x14cde5,_0x1ca47f){return db[_0xa749('0x29')][_0xa749('0x45')]({'where':{'id':_0x14cde5[_0xa749('0x3f')]['id']}})[_0xa749('0x24')](handleEntityNotFound(_0x1ca47f,null))[_0xa749('0x24')](removeEntity(_0x1ca47f,null))[_0xa749('0x42')](handleError(_0x1ca47f,null));};exports['getFields']=function(_0x867c20,_0xa5cbfb,_0x26d545){var _0x3c708c={};var _0x116ba7={};var _0x3d0c5c;var _0x4149d9;return db[_0xa749('0x29')][_0xa749('0x46')]({'where':{'id':_0x867c20[_0xa749('0x3f')]['id']}})[_0xa749('0x24')](handleEntityNotFound(_0xa5cbfb,null))[_0xa749('0x24')](function(_0x57e1d8){if(_0x57e1d8){_0x3d0c5c=_0x57e1d8;_0x116ba7[_0xa749('0x30')]=_[_0xa749('0x2c')](db[_0xa749('0x47')][_0xa749('0x40')]);_0x116ba7[_0xa749('0x2d')]=_['keys'](_0x867c20[_0xa749('0x2d')]);_0x116ba7[_0xa749('0x34')]=_[_0xa749('0x2e')](_0x116ba7[_0xa749('0x30')],_0x116ba7[_0xa749('0x2d')]);_0x3c708c['attributes']=_[_0xa749('0x2e')](_0x116ba7['model'],qs[_0xa749('0x41')](_0x867c20['query'][_0xa749('0x41')]));_0x3c708c[_0xa749('0x2f')]=_0x3c708c[_0xa749('0x2f')][_0xa749('0x31')]?_0x3c708c['attributes']:_0x116ba7[_0xa749('0x30')];_0x3c708c['order']=qs[_0xa749('0x33')](_0x867c20[_0xa749('0x2d')][_0xa749('0x33')]);_0x3c708c[_0xa749('0x3a')]=qs[_0xa749('0x34')](_[_0xa749('0x35')](_0x867c20[_0xa749('0x2d')],_0x116ba7[_0xa749('0x34')]));if(_0x867c20[_0xa749('0x2d')][_0xa749('0x36')]){_0x3c708c[_0xa749('0x3a')]=_['merge'](_0x3c708c[_0xa749('0x3a')],{'$or':_['map'](_0x3c708c[_0xa749('0x2f')],function(_0x5558f1){var _0xf89396={};_0xf89396[_0x5558f1]={'$like':'%'+_0x867c20[_0xa749('0x2d')][_0xa749('0x36')]+'%'};return _0xf89396;})});}_0x3c708c=_[_0xa749('0x38')]({},_0x3c708c,_0x867c20[_0xa749('0x39')]);return _0x3d0c5c[_0xa749('0x48')](_0x3c708c);}})[_0xa749('0x24')](function(_0x46b3c6){if(_0x46b3c6){_0x4149d9=_0x46b3c6[_0xa749('0x31')];if(!_0x867c20['query'][_0xa749('0x49')]('nolimit')){_0x3c708c[_0xa749('0x20')]=qs[_0xa749('0x20')](_0x867c20[_0xa749('0x2d')][_0xa749('0x20')]);_0x3c708c[_0xa749('0x1d')]=qs[_0xa749('0x1d')](_0x867c20[_0xa749('0x2d')]['offset']);}return _0x3d0c5c[_0xa749('0x48')](_0x3c708c);}})[_0xa749('0x24')](function(_0x3d4925){if(_0x3d4925){return _0x3d4925?{'count':_0x4149d9,'rows':_0x3d4925}:null;}})[_0xa749('0x24')](respondWithResult(_0xa5cbfb,null))[_0xa749('0x42')](handleError(_0xa5cbfb,null));};exports['getSubjects']=function(_0x347cce,_0x422900,_0x86c2d6){var _0x378c9b={};var _0x54a57b={};var _0x4ff6c4;var _0x441a9c;return db[_0xa749('0x29')][_0xa749('0x46')]({'where':{'id':_0x347cce[_0xa749('0x3f')]['id']}})[_0xa749('0x24')](handleEntityNotFound(_0x422900,null))[_0xa749('0x24')](function(_0x46945e){if(_0x46945e){_0x4ff6c4=_0x46945e;_0x54a57b['model']=_[_0xa749('0x2c')](db[_0xa749('0x47')][_0xa749('0x40')]);_0x54a57b[_0xa749('0x2d')]=_[_0xa749('0x2c')](_0x347cce[_0xa749('0x2d')]);_0x54a57b[_0xa749('0x34')]=_['intersection'](_0x54a57b[_0xa749('0x30')],_0x54a57b['query']);_0x378c9b[_0xa749('0x2f')]=_[_0xa749('0x2e')](_0x54a57b[_0xa749('0x30')],qs[_0xa749('0x41')](_0x347cce[_0xa749('0x2d')][_0xa749('0x41')]));_0x378c9b['attributes']=_0x378c9b[_0xa749('0x2f')][_0xa749('0x31')]?_0x378c9b[_0xa749('0x2f')]:_0x54a57b[_0xa749('0x30')];_0x378c9b[_0xa749('0x32')]=qs[_0xa749('0x33')](_0x347cce['query'][_0xa749('0x33')]);_0x378c9b[_0xa749('0x3a')]=qs['filters'](_[_0xa749('0x35')](_0x347cce[_0xa749('0x2d')],_0x54a57b[_0xa749('0x34')]));if(_0x347cce[_0xa749('0x2d')][_0xa749('0x36')]){_0x378c9b['where']=_[_0xa749('0x38')](_0x378c9b[_0xa749('0x3a')],{'$or':_['map'](_0x378c9b[_0xa749('0x2f')],function(_0x27f056){var _0x5379eb={};_0x5379eb[_0x27f056]={'$like':'%'+_0x347cce[_0xa749('0x2d')]['filter']+'%'};return _0x5379eb;})});}_0x378c9b=_[_0xa749('0x38')]({},_0x378c9b,_0x347cce[_0xa749('0x39')]);return _0x4ff6c4[_0xa749('0x4a')](_0x378c9b);}})['then'](function(_0x1a8c02){if(_0x1a8c02){_0x441a9c=_0x1a8c02[_0xa749('0x31')];if(!_0x347cce[_0xa749('0x2d')]['hasOwnProperty'](_0xa749('0x4b'))){_0x378c9b[_0xa749('0x20')]=qs['limit'](_0x347cce['query'][_0xa749('0x20')]);_0x378c9b[_0xa749('0x1d')]=qs['offset'](_0x347cce['query'][_0xa749('0x1d')]);}return _0x4ff6c4[_0xa749('0x4a')](_0x378c9b);}})['then'](function(_0x530e8d){if(_0x530e8d){return _0x530e8d?{'count':_0x441a9c,'rows':_0x530e8d}:null;}})['then'](respondWithResult(_0x422900,null))[_0xa749('0x42')](handleError(_0x422900,null));};exports[_0xa749('0x4c')]=function(_0x26084b,_0x59b4a7,_0x2ef4fa){var _0x22969b={};var _0x3b67c5={};var _0x3e5abc;var _0x30a84e;return db['ZendeskConfiguration'][_0xa749('0x46')]({'where':{'id':_0x26084b[_0xa749('0x3f')]['id']}})['then'](handleEntityNotFound(_0x59b4a7,null))[_0xa749('0x24')](function(_0x56db92){if(_0x56db92){_0x3e5abc=_0x56db92;_0x3b67c5[_0xa749('0x30')]=_[_0xa749('0x2c')](db[_0xa749('0x47')][_0xa749('0x40')]);_0x3b67c5[_0xa749('0x2d')]=_[_0xa749('0x2c')](_0x26084b[_0xa749('0x2d')]);_0x3b67c5[_0xa749('0x34')]=_[_0xa749('0x2e')](_0x3b67c5[_0xa749('0x30')],_0x3b67c5[_0xa749('0x2d')]);_0x22969b['attributes']=_[_0xa749('0x2e')](_0x3b67c5[_0xa749('0x30')],qs['fields'](_0x26084b[_0xa749('0x2d')][_0xa749('0x41')]));_0x22969b[_0xa749('0x2f')]=_0x22969b['attributes'][_0xa749('0x31')]?_0x22969b['attributes']:_0x3b67c5[_0xa749('0x30')];_0x22969b[_0xa749('0x32')]=qs[_0xa749('0x33')](_0x26084b['query'][_0xa749('0x33')]);_0x22969b['where']=qs[_0xa749('0x34')](_['pick'](_0x26084b[_0xa749('0x2d')],_0x3b67c5[_0xa749('0x34')]));if(_0x26084b[_0xa749('0x2d')]['filter']){_0x22969b[_0xa749('0x3a')]=_[_0xa749('0x38')](_0x22969b[_0xa749('0x3a')],{'$or':_[_0xa749('0x28')](_0x22969b[_0xa749('0x2f')],function(_0x580116){var _0x4b023e={};_0x4b023e[_0x580116]={'$like':'%'+_0x26084b[_0xa749('0x2d')]['filter']+'%'};return _0x4b023e;})});}_0x22969b=_[_0xa749('0x38')]({},_0x22969b,_0x26084b[_0xa749('0x39')]);return _0x3e5abc[_0xa749('0x4c')](_0x22969b);}})[_0xa749('0x24')](function(_0x1c438c){if(_0x1c438c){_0x30a84e=_0x1c438c[_0xa749('0x31')];if(!_0x26084b['query']['hasOwnProperty']('nolimit')){_0x22969b[_0xa749('0x20')]=qs[_0xa749('0x20')](_0x26084b['query']['limit']);_0x22969b['offset']=qs[_0xa749('0x1d')](_0x26084b['query'][_0xa749('0x1d')]);}return _0x3e5abc[_0xa749('0x4c')](_0x22969b);}})[_0xa749('0x24')](function(_0x5d0995){if(_0x5d0995){return _0x5d0995?{'count':_0x30a84e,'rows':_0x5d0995}:null;}})[_0xa749('0x24')](respondWithResult(_0x59b4a7,null))[_0xa749('0x42')](handleError(_0x59b4a7,null));};exports[_0xa749('0x4d')]=function(_0x40db3e,_0x260625,_0x3fa900){var _0x2ad352={};var _0x4943ad={};var _0x284f6e;var _0x19c1ea;return db[_0xa749('0x29')][_0xa749('0x46')]({'where':{'id':_0x40db3e[_0xa749('0x3f')]['id']}})[_0xa749('0x24')](handleEntityNotFound(_0x260625,null))[_0xa749('0x24')](function(_0x5412f9){if(_0x5412f9){_0x284f6e=_0x5412f9;_0x4943ad[_0xa749('0x30')]=_[_0xa749('0x2c')](db['Tag']['rawAttributes']);_0x4943ad[_0xa749('0x2d')]=_[_0xa749('0x2c')](_0x40db3e[_0xa749('0x2d')]);_0x4943ad['filters']=_[_0xa749('0x2e')](_0x4943ad[_0xa749('0x30')],_0x4943ad['query']);_0x2ad352[_0xa749('0x2f')]=_['intersection'](_0x4943ad[_0xa749('0x30')],qs[_0xa749('0x41')](_0x40db3e[_0xa749('0x2d')][_0xa749('0x41')]));_0x2ad352['attributes']=_0x2ad352[_0xa749('0x2f')][_0xa749('0x31')]?_0x2ad352[_0xa749('0x2f')]:_0x4943ad[_0xa749('0x30')];_0x2ad352[_0xa749('0x32')]=qs[_0xa749('0x33')](_0x40db3e[_0xa749('0x2d')][_0xa749('0x33')]);_0x2ad352[_0xa749('0x3a')]=qs[_0xa749('0x34')](_['pick'](_0x40db3e[_0xa749('0x2d')],_0x4943ad[_0xa749('0x34')]));if(_0x40db3e[_0xa749('0x2d')][_0xa749('0x36')]){_0x2ad352[_0xa749('0x3a')]=_[_0xa749('0x38')](_0x2ad352['where'],{'$or':_[_0xa749('0x28')](_0x2ad352[_0xa749('0x2f')],function(_0x41a386){var _0x26ee76={};_0x26ee76[_0x41a386]={'$like':'%'+_0x40db3e[_0xa749('0x2d')][_0xa749('0x36')]+'%'};return _0x26ee76;})});}_0x2ad352=_[_0xa749('0x38')]({},_0x2ad352,_0x40db3e['options']);return _0x284f6e[_0xa749('0x4d')](_0x2ad352);}})[_0xa749('0x24')](function(_0x343185){if(_0x343185){_0x19c1ea=_0x343185[_0xa749('0x31')];if(!_0x40db3e[_0xa749('0x2d')][_0xa749('0x49')](_0xa749('0x4b'))){_0x2ad352['limit']=qs[_0xa749('0x20')](_0x40db3e['query']['limit']);_0x2ad352[_0xa749('0x1d')]=qs[_0xa749('0x1d')](_0x40db3e[_0xa749('0x2d')][_0xa749('0x1d')]);}return _0x284f6e[_0xa749('0x4d')](_0x2ad352);}})[_0xa749('0x24')](function(_0x2c8b0c){if(_0x2c8b0c){return _0x2c8b0c?{'count':_0x19c1ea,'rows':_0x2c8b0c}:null;}})['then'](respondWithResult(_0x260625,null))[_0xa749('0x42')](handleError(_0x260625,null));};exports[_0xa749('0x4e')]=function(_0x1908ed,_0x54c72d,_0x325db8){if(_0x1908ed[_0xa749('0x4f')]['id']){delete _0x1908ed[_0xa749('0x4f')]['id'];}return db[_0xa749('0x29')][_0xa749('0x46')]({'where':{'id':_0x1908ed[_0xa749('0x3f')]['id']}})['then'](handleEntityNotFound(_0x54c72d,null))[_0xa749('0x24')](function(_0x2a8068){if(_0x2a8068){return _0x2a8068[_0xa749('0x4e')](_0x1908ed[_0xa749('0x4f')][_0xa749('0x50')]||[]);}return null;})[_0xa749('0x24')](respondWithResult(_0x54c72d,null))[_0xa749('0x42')](handleError(_0x54c72d,null));}; \ No newline at end of file +var _0x7097=['rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','show','length','catch','create','body','find','params','getFields','ZendeskField','getSubjects','hasOwnProperty','getDescriptions','findOne','getTags','Tag','ids','eml-format','request-promise','moment','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','ZendeskConfiguration'];(function(_0x2d6ade,_0x4d7588){var _0x24774f=function(_0x158d86){while(--_0x158d86){_0x2d6ade['push'](_0x2d6ade['shift']());}};_0x24774f(++_0x4d7588);}(_0x7097,0x1b6));var _0x7709=function(_0x509bfc,_0x3c1164){_0x509bfc=_0x509bfc-0x0;var _0x42ac86=_0x7097[_0x509bfc];return _0x42ac86;};'use strict';var emlformat=require(_0x7709('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7709('0x1'));var moment=require(_0x7709('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7709('0x3'));var fs=require('fs');var fs_extra=require(_0x7709('0x4'));var _=require(_0x7709('0x5'));var squel=require('squel');var crypto=require(_0x7709('0x6'));var jsforce=require(_0x7709('0x7'));var deskjs=require(_0x7709('0x8'));var toCsv=require(_0x7709('0x9'));var querystring=require(_0x7709('0xa'));var Papa=require(_0x7709('0xb'));var Redis=require(_0x7709('0xc'));var authService=require(_0x7709('0xd'));var qs=require(_0x7709('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7709('0xf'));var logger=require(_0x7709('0x10'))(_0x7709('0x11'));var utils=require(_0x7709('0x12'));var config=require(_0x7709('0x13'));var licenseUtil=require(_0x7709('0x14'));var db=require(_0x7709('0x15'))['db'];function respondWithStatusCode(_0x54c99e,_0x5c98a0){_0x5c98a0=_0x5c98a0||0xcc;return function(_0x2386de){if(_0x2386de){return _0x54c99e[_0x7709('0x16')](_0x5c98a0);}return _0x54c99e['status'](_0x5c98a0)['end']();};}function respondWithResult(_0x107079,_0x2ca35d){_0x2ca35d=_0x2ca35d||0xc8;return function(_0x383e4a){if(_0x383e4a){return _0x107079[_0x7709('0x17')](_0x2ca35d)[_0x7709('0x18')](_0x383e4a);}};}function respondWithFilteredResult(_0x21f144,_0x283f19){return function(_0x226291){if(_0x226291){var _0xdac7e7=typeof _0x283f19[_0x7709('0x19')]===_0x7709('0x1a')&&typeof _0x283f19[_0x7709('0x1b')]===_0x7709('0x1a');var _0xed8448=_0x226291[_0x7709('0x1c')];var _0x521c0c=_0xdac7e7?0x0:_0x283f19[_0x7709('0x19')];var _0xc3d706=_0xdac7e7?_0x226291[_0x7709('0x1c')]:_0x283f19[_0x7709('0x19')]+_0x283f19['limit'];var _0xe3712f;if(_0xc3d706>=_0xed8448){_0xc3d706=_0xed8448;_0xe3712f=0xc8;}else{_0xe3712f=0xce;}_0x21f144['status'](_0xe3712f);return _0x21f144[_0x7709('0x1d')](_0x7709('0x1e'),_0x521c0c+'-'+_0xc3d706+'/'+_0xed8448)[_0x7709('0x18')](_0x226291);}return null;};}function patchUpdates(_0x4e5185){return function(_0xba1aa8){try{jsonpatch['apply'](_0xba1aa8,_0x4e5185,!![]);}catch(_0xe394b5){return BPromise['reject'](_0xe394b5);}return _0xba1aa8[_0x7709('0x1f')]();};}function saveUpdates(_0x21a3c6,_0x3c5501){return function(_0x161b9f){if(_0x161b9f){return _0x161b9f[_0x7709('0x20')](_0x21a3c6)[_0x7709('0x21')](function(_0x45d163){return _0x45d163;});}return null;};}function removeEntity(_0x191134,_0x5c2896){return function(_0x4bfd44){if(_0x4bfd44){return _0x4bfd44[_0x7709('0x22')]()[_0x7709('0x21')](function(){_0x191134['status'](0xcc)[_0x7709('0x23')]();});}};}function handleEntityNotFound(_0x29e83e,_0x18b7db){return function(_0x9772f){if(!_0x9772f){_0x29e83e[_0x7709('0x16')](0x194);}return _0x9772f;};}function handleError(_0x384f75,_0x39ec61){_0x39ec61=_0x39ec61||0x1f4;return function(_0x169d68){logger[_0x7709('0x24')](_0x169d68[_0x7709('0x25')]);if(_0x169d68['name']){delete _0x169d68[_0x7709('0x26')];}_0x384f75[_0x7709('0x17')](_0x39ec61)[_0x7709('0x27')](_0x169d68);};}exports[_0x7709('0x28')]=function(_0x39fcd7,_0x5c6588){var _0x399ed3={},_0x1d216a={},_0x42602e={'count':0x0,'rows':[]};var _0x16d155=_['map'](db[_0x7709('0x29')][_0x7709('0x2a')],function(_0x35a751){return{'name':_0x35a751[_0x7709('0x2b')],'type':_0x35a751[_0x7709('0x2c')][_0x7709('0x2d')]};});_0x1d216a[_0x7709('0x2e')]=_[_0x7709('0x2f')](_0x16d155,_0x7709('0x26'));_0x1d216a[_0x7709('0x30')]=_[_0x7709('0x31')](_0x39fcd7[_0x7709('0x30')]);_0x1d216a[_0x7709('0x32')]=_[_0x7709('0x33')](_0x1d216a[_0x7709('0x2e')],_0x1d216a['query']);_0x399ed3[_0x7709('0x34')]=_[_0x7709('0x33')](_0x1d216a[_0x7709('0x2e')],qs[_0x7709('0x35')](_0x39fcd7[_0x7709('0x30')]['fields']));_0x399ed3['attributes']=_0x399ed3[_0x7709('0x34')]['length']?_0x399ed3[_0x7709('0x34')]:_0x1d216a[_0x7709('0x2e')];if(!_0x39fcd7[_0x7709('0x30')]['hasOwnProperty'](_0x7709('0x36'))){_0x399ed3[_0x7709('0x1b')]=qs[_0x7709('0x1b')](_0x39fcd7[_0x7709('0x30')][_0x7709('0x1b')]);_0x399ed3[_0x7709('0x19')]=qs[_0x7709('0x19')](_0x39fcd7[_0x7709('0x30')]['offset']);}_0x399ed3[_0x7709('0x37')]=qs[_0x7709('0x38')](_0x39fcd7['query'][_0x7709('0x38')]);_0x399ed3[_0x7709('0x39')]=qs[_0x7709('0x32')](_[_0x7709('0x3a')](_0x39fcd7[_0x7709('0x30')],_0x1d216a['filters']),_0x16d155);if(_0x39fcd7[_0x7709('0x30')]['filter']){_0x399ed3[_0x7709('0x39')]=_[_0x7709('0x3b')](_0x399ed3[_0x7709('0x39')],{'$or':_[_0x7709('0x2f')](_0x16d155,function(_0x4141e4){if(_0x4141e4['type']!=='VIRTUAL'){var _0x593784={};_0x593784[_0x4141e4[_0x7709('0x26')]]={'$like':'%'+_0x39fcd7['query'][_0x7709('0x3c')]+'%'};return _0x593784;}})});}_0x399ed3=_['merge']({},_0x399ed3,_0x39fcd7[_0x7709('0x3d')]);var _0x3ec5fe={'where':_0x399ed3[_0x7709('0x39')]};return db[_0x7709('0x29')][_0x7709('0x1c')](_0x3ec5fe)['then'](function(_0x5ad2ab){_0x42602e['count']=_0x5ad2ab;if(_0x39fcd7['query'][_0x7709('0x3e')]){_0x399ed3[_0x7709('0x3f')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x399ed3);})[_0x7709('0x21')](function(_0xe4a531){_0x42602e['rows']=_0xe4a531;return _0x42602e;})['then'](respondWithFilteredResult(_0x5c6588,_0x399ed3))['catch'](handleError(_0x5c6588,null));};exports[_0x7709('0x40')]=function(_0x402f7f,_0x5ea0cf){var _0x4a66c8={'raw':![],'where':{'id':_0x402f7f['params']['id']}},_0x1c81c0={};_0x1c81c0[_0x7709('0x2e')]=_[_0x7709('0x31')](db[_0x7709('0x29')][_0x7709('0x2a')]);_0x1c81c0[_0x7709('0x30')]=_[_0x7709('0x31')](_0x402f7f[_0x7709('0x30')]);_0x1c81c0[_0x7709('0x32')]=_['intersection'](_0x1c81c0[_0x7709('0x2e')],_0x1c81c0[_0x7709('0x30')]);_0x4a66c8[_0x7709('0x34')]=_[_0x7709('0x33')](_0x1c81c0['model'],qs['fields'](_0x402f7f[_0x7709('0x30')][_0x7709('0x35')]));_0x4a66c8[_0x7709('0x34')]=_0x4a66c8['attributes'][_0x7709('0x41')]?_0x4a66c8[_0x7709('0x34')]:_0x1c81c0[_0x7709('0x2e')];if(_0x402f7f[_0x7709('0x30')][_0x7709('0x3e')]){_0x4a66c8[_0x7709('0x3f')]=[{'all':!![]}];}_0x4a66c8=_[_0x7709('0x3b')]({},_0x4a66c8,_0x402f7f['options']);return db[_0x7709('0x29')]['find'](_0x4a66c8)['then'](handleEntityNotFound(_0x5ea0cf,null))[_0x7709('0x21')](respondWithResult(_0x5ea0cf,null))[_0x7709('0x42')](handleError(_0x5ea0cf,null));};exports[_0x7709('0x43')]=function(_0x4ad42c,_0x33f33f){return db[_0x7709('0x29')][_0x7709('0x43')](_0x4ad42c[_0x7709('0x44')],{})['then'](respondWithResult(_0x33f33f,0xc9))['catch'](handleError(_0x33f33f,null));};exports[_0x7709('0x20')]=function(_0x1bbdf2,_0x3f8cf7){if(_0x1bbdf2['body']['id']){delete _0x1bbdf2[_0x7709('0x44')]['id'];}return db[_0x7709('0x29')][_0x7709('0x45')]({'where':{'id':_0x1bbdf2[_0x7709('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f8cf7,null))[_0x7709('0x21')](saveUpdates(_0x1bbdf2[_0x7709('0x44')],null))[_0x7709('0x21')](respondWithResult(_0x3f8cf7,null))[_0x7709('0x42')](handleError(_0x3f8cf7,null));};exports[_0x7709('0x22')]=function(_0x1a9c91,_0x583555){return db['ZendeskConfiguration'][_0x7709('0x45')]({'where':{'id':_0x1a9c91[_0x7709('0x46')]['id']}})[_0x7709('0x21')](handleEntityNotFound(_0x583555,null))[_0x7709('0x21')](removeEntity(_0x583555,null))['catch'](handleError(_0x583555,null));};exports[_0x7709('0x47')]=function(_0x1b0ea,_0x4945cd,_0x1e972c){var _0x5917e9={};var _0x2168f8={};var _0x5c9c56;var _0x3d0fc3;return db[_0x7709('0x29')]['findOne']({'where':{'id':_0x1b0ea[_0x7709('0x46')]['id']}})[_0x7709('0x21')](handleEntityNotFound(_0x4945cd,null))[_0x7709('0x21')](function(_0x392497){if(_0x392497){_0x5c9c56=_0x392497;_0x2168f8['model']=_['keys'](db[_0x7709('0x48')][_0x7709('0x2a')]);_0x2168f8[_0x7709('0x30')]=_[_0x7709('0x31')](_0x1b0ea[_0x7709('0x30')]);_0x2168f8['filters']=_[_0x7709('0x33')](_0x2168f8[_0x7709('0x2e')],_0x2168f8[_0x7709('0x30')]);_0x5917e9[_0x7709('0x34')]=_[_0x7709('0x33')](_0x2168f8[_0x7709('0x2e')],qs['fields'](_0x1b0ea[_0x7709('0x30')]['fields']));_0x5917e9['attributes']=_0x5917e9[_0x7709('0x34')][_0x7709('0x41')]?_0x5917e9[_0x7709('0x34')]:_0x2168f8[_0x7709('0x2e')];_0x5917e9[_0x7709('0x37')]=qs[_0x7709('0x38')](_0x1b0ea['query']['sort']);_0x5917e9[_0x7709('0x39')]=qs['filters'](_[_0x7709('0x3a')](_0x1b0ea[_0x7709('0x30')],_0x2168f8['filters']));if(_0x1b0ea[_0x7709('0x30')]['filter']){_0x5917e9[_0x7709('0x39')]=_[_0x7709('0x3b')](_0x5917e9[_0x7709('0x39')],{'$or':_[_0x7709('0x2f')](_0x5917e9[_0x7709('0x34')],function(_0x2d3372){var _0x6fc7ef={};_0x6fc7ef[_0x2d3372]={'$like':'%'+_0x1b0ea['query']['filter']+'%'};return _0x6fc7ef;})});}_0x5917e9=_[_0x7709('0x3b')]({},_0x5917e9,_0x1b0ea[_0x7709('0x3d')]);return _0x5c9c56['getFields'](_0x5917e9);}})[_0x7709('0x21')](function(_0x121ea6){if(_0x121ea6){_0x3d0fc3=_0x121ea6[_0x7709('0x41')];if(!_0x1b0ea[_0x7709('0x30')]['hasOwnProperty'](_0x7709('0x36'))){_0x5917e9['limit']=qs[_0x7709('0x1b')](_0x1b0ea[_0x7709('0x30')][_0x7709('0x1b')]);_0x5917e9[_0x7709('0x19')]=qs[_0x7709('0x19')](_0x1b0ea[_0x7709('0x30')][_0x7709('0x19')]);}return _0x5c9c56[_0x7709('0x47')](_0x5917e9);}})[_0x7709('0x21')](function(_0x15f22f){if(_0x15f22f){return _0x15f22f?{'count':_0x3d0fc3,'rows':_0x15f22f}:null;}})[_0x7709('0x21')](respondWithResult(_0x4945cd,null))[_0x7709('0x42')](handleError(_0x4945cd,null));};exports['getSubjects']=function(_0x11c3a1,_0x4701e4,_0x17d739){var _0x10681a={};var _0x3f9a76={};var _0x2ec5a7;var _0x35bc;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x11c3a1[_0x7709('0x46')]['id']}})[_0x7709('0x21')](handleEntityNotFound(_0x4701e4,null))[_0x7709('0x21')](function(_0x4c8bb3){if(_0x4c8bb3){_0x2ec5a7=_0x4c8bb3;_0x3f9a76[_0x7709('0x2e')]=_[_0x7709('0x31')](db[_0x7709('0x48')][_0x7709('0x2a')]);_0x3f9a76['query']=_[_0x7709('0x31')](_0x11c3a1['query']);_0x3f9a76[_0x7709('0x32')]=_[_0x7709('0x33')](_0x3f9a76[_0x7709('0x2e')],_0x3f9a76['query']);_0x10681a[_0x7709('0x34')]=_['intersection'](_0x3f9a76[_0x7709('0x2e')],qs['fields'](_0x11c3a1[_0x7709('0x30')][_0x7709('0x35')]));_0x10681a[_0x7709('0x34')]=_0x10681a[_0x7709('0x34')][_0x7709('0x41')]?_0x10681a[_0x7709('0x34')]:_0x3f9a76[_0x7709('0x2e')];_0x10681a[_0x7709('0x37')]=qs[_0x7709('0x38')](_0x11c3a1[_0x7709('0x30')][_0x7709('0x38')]);_0x10681a[_0x7709('0x39')]=qs['filters'](_['pick'](_0x11c3a1[_0x7709('0x30')],_0x3f9a76[_0x7709('0x32')]));if(_0x11c3a1[_0x7709('0x30')][_0x7709('0x3c')]){_0x10681a[_0x7709('0x39')]=_[_0x7709('0x3b')](_0x10681a[_0x7709('0x39')],{'$or':_[_0x7709('0x2f')](_0x10681a[_0x7709('0x34')],function(_0x53c60a){var _0x19bb83={};_0x19bb83[_0x53c60a]={'$like':'%'+_0x11c3a1[_0x7709('0x30')][_0x7709('0x3c')]+'%'};return _0x19bb83;})});}_0x10681a=_[_0x7709('0x3b')]({},_0x10681a,_0x11c3a1[_0x7709('0x3d')]);return _0x2ec5a7[_0x7709('0x49')](_0x10681a);}})[_0x7709('0x21')](function(_0x3998b1){if(_0x3998b1){_0x35bc=_0x3998b1[_0x7709('0x41')];if(!_0x11c3a1[_0x7709('0x30')][_0x7709('0x4a')](_0x7709('0x36'))){_0x10681a[_0x7709('0x1b')]=qs['limit'](_0x11c3a1['query']['limit']);_0x10681a[_0x7709('0x19')]=qs[_0x7709('0x19')](_0x11c3a1[_0x7709('0x30')][_0x7709('0x19')]);}return _0x2ec5a7[_0x7709('0x49')](_0x10681a);}})['then'](function(_0x2eb53e){if(_0x2eb53e){return _0x2eb53e?{'count':_0x35bc,'rows':_0x2eb53e}:null;}})['then'](respondWithResult(_0x4701e4,null))['catch'](handleError(_0x4701e4,null));};exports[_0x7709('0x4b')]=function(_0x760ddb,_0x2847b3,_0x340843){var _0x58d665={};var _0x4a3b00={};var _0x41aca4;var _0x4a185e;return db[_0x7709('0x29')][_0x7709('0x4c')]({'where':{'id':_0x760ddb[_0x7709('0x46')]['id']}})[_0x7709('0x21')](handleEntityNotFound(_0x2847b3,null))[_0x7709('0x21')](function(_0x38c69b){if(_0x38c69b){_0x41aca4=_0x38c69b;_0x4a3b00['model']=_['keys'](db[_0x7709('0x48')][_0x7709('0x2a')]);_0x4a3b00['query']=_[_0x7709('0x31')](_0x760ddb[_0x7709('0x30')]);_0x4a3b00[_0x7709('0x32')]=_['intersection'](_0x4a3b00[_0x7709('0x2e')],_0x4a3b00[_0x7709('0x30')]);_0x58d665[_0x7709('0x34')]=_['intersection'](_0x4a3b00[_0x7709('0x2e')],qs['fields'](_0x760ddb[_0x7709('0x30')][_0x7709('0x35')]));_0x58d665[_0x7709('0x34')]=_0x58d665[_0x7709('0x34')][_0x7709('0x41')]?_0x58d665[_0x7709('0x34')]:_0x4a3b00['model'];_0x58d665[_0x7709('0x37')]=qs[_0x7709('0x38')](_0x760ddb[_0x7709('0x30')][_0x7709('0x38')]);_0x58d665[_0x7709('0x39')]=qs[_0x7709('0x32')](_[_0x7709('0x3a')](_0x760ddb[_0x7709('0x30')],_0x4a3b00['filters']));if(_0x760ddb[_0x7709('0x30')][_0x7709('0x3c')]){_0x58d665[_0x7709('0x39')]=_['merge'](_0x58d665[_0x7709('0x39')],{'$or':_[_0x7709('0x2f')](_0x58d665[_0x7709('0x34')],function(_0x314f12){var _0x47e105={};_0x47e105[_0x314f12]={'$like':'%'+_0x760ddb[_0x7709('0x30')][_0x7709('0x3c')]+'%'};return _0x47e105;})});}_0x58d665=_[_0x7709('0x3b')]({},_0x58d665,_0x760ddb['options']);return _0x41aca4['getDescriptions'](_0x58d665);}})[_0x7709('0x21')](function(_0x2c8e02){if(_0x2c8e02){_0x4a185e=_0x2c8e02[_0x7709('0x41')];if(!_0x760ddb[_0x7709('0x30')][_0x7709('0x4a')]('nolimit')){_0x58d665['limit']=qs[_0x7709('0x1b')](_0x760ddb['query'][_0x7709('0x1b')]);_0x58d665[_0x7709('0x19')]=qs['offset'](_0x760ddb['query'][_0x7709('0x19')]);}return _0x41aca4[_0x7709('0x4b')](_0x58d665);}})['then'](function(_0x53a608){if(_0x53a608){return _0x53a608?{'count':_0x4a185e,'rows':_0x53a608}:null;}})[_0x7709('0x21')](respondWithResult(_0x2847b3,null))[_0x7709('0x42')](handleError(_0x2847b3,null));};exports[_0x7709('0x4d')]=function(_0x3b7d7b,_0x26a096,_0x5b272f){var _0x3ac834={};var _0x5f3a56={};var _0x1029bc;var _0xae2bee;return db[_0x7709('0x29')]['findOne']({'where':{'id':_0x3b7d7b[_0x7709('0x46')]['id']}})[_0x7709('0x21')](handleEntityNotFound(_0x26a096,null))['then'](function(_0x201fae){if(_0x201fae){_0x1029bc=_0x201fae;_0x5f3a56[_0x7709('0x2e')]=_['keys'](db[_0x7709('0x4e')][_0x7709('0x2a')]);_0x5f3a56[_0x7709('0x30')]=_[_0x7709('0x31')](_0x3b7d7b[_0x7709('0x30')]);_0x5f3a56[_0x7709('0x32')]=_['intersection'](_0x5f3a56['model'],_0x5f3a56['query']);_0x3ac834[_0x7709('0x34')]=_['intersection'](_0x5f3a56[_0x7709('0x2e')],qs[_0x7709('0x35')](_0x3b7d7b['query'][_0x7709('0x35')]));_0x3ac834[_0x7709('0x34')]=_0x3ac834['attributes']['length']?_0x3ac834['attributes']:_0x5f3a56[_0x7709('0x2e')];_0x3ac834[_0x7709('0x37')]=qs[_0x7709('0x38')](_0x3b7d7b[_0x7709('0x30')]['sort']);_0x3ac834[_0x7709('0x39')]=qs[_0x7709('0x32')](_['pick'](_0x3b7d7b['query'],_0x5f3a56['filters']));if(_0x3b7d7b[_0x7709('0x30')][_0x7709('0x3c')]){_0x3ac834[_0x7709('0x39')]=_['merge'](_0x3ac834[_0x7709('0x39')],{'$or':_[_0x7709('0x2f')](_0x3ac834['attributes'],function(_0x26669c){var _0x41e5c6={};_0x41e5c6[_0x26669c]={'$like':'%'+_0x3b7d7b[_0x7709('0x30')][_0x7709('0x3c')]+'%'};return _0x41e5c6;})});}_0x3ac834=_[_0x7709('0x3b')]({},_0x3ac834,_0x3b7d7b[_0x7709('0x3d')]);return _0x1029bc[_0x7709('0x4d')](_0x3ac834);}})[_0x7709('0x21')](function(_0x42852d){if(_0x42852d){_0xae2bee=_0x42852d[_0x7709('0x41')];if(!_0x3b7d7b['query'][_0x7709('0x4a')](_0x7709('0x36'))){_0x3ac834['limit']=qs[_0x7709('0x1b')](_0x3b7d7b['query'][_0x7709('0x1b')]);_0x3ac834[_0x7709('0x19')]=qs[_0x7709('0x19')](_0x3b7d7b['query'][_0x7709('0x19')]);}return _0x1029bc['getTags'](_0x3ac834);}})['then'](function(_0x1d1b16){if(_0x1d1b16){return _0x1d1b16?{'count':_0xae2bee,'rows':_0x1d1b16}:null;}})[_0x7709('0x21')](respondWithResult(_0x26a096,null))[_0x7709('0x42')](handleError(_0x26a096,null));};exports['setTags']=function(_0x26c837,_0x1a6984,_0x2a3fe1){if(_0x26c837[_0x7709('0x44')]['id']){delete _0x26c837[_0x7709('0x44')]['id'];}return db[_0x7709('0x29')][_0x7709('0x4c')]({'where':{'id':_0x26c837[_0x7709('0x46')]['id']}})[_0x7709('0x21')](handleEntityNotFound(_0x1a6984,null))[_0x7709('0x21')](function(_0x5dd7be){if(_0x5dd7be){return _0x5dd7be['setTags'](_0x26c837[_0x7709('0x44')][_0x7709('0x4f')]||[]);}return null;})[_0x7709('0x21')](respondWithResult(_0x1a6984,null))['catch'](handleError(_0x1a6984,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index c9b6059..fb20e00 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb3b=['moment','path','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api'];(function(_0x6ab267,_0x46f3b1){var _0x5c10df=function(_0x1d5561){while(--_0x1d5561){_0x6ab267['push'](_0x6ab267['shift']());}};_0x5c10df(++_0x46f3b1);}(_0xeb3b,0x19e));var _0xbeb3=function(_0xe51964,_0x433b90){_0xe51964=_0xe51964-0x0;var _0x2c2366=_0xeb3b[_0xe51964];return _0x2c2366;};'use strict';var _=require(_0xbeb3('0x0'));var util=require(_0xbeb3('0x1'));var logger=require(_0xbeb3('0x2'))(_0xbeb3('0x3'));var moment=require(_0xbeb3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbeb3('0x5'));var rimraf=require('rimraf');var config=require(_0xbeb3('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xbeb3('0x7')]=function(_0x5ae6f9,_0x8d8cce){return _0x5ae6f9[_0xbeb3('0x8')](_0xbeb3('0x9'),attributes,{'tableName':_0xbeb3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4f4=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x4e0ac8,_0x3fde90){_0x4e0ac8=_0x4e0ac8-0x0;var _0x42a5b5=_0xf4f4[_0x4e0ac8];return _0x42a5b5;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var logger=require('../../config/logger')(_0x4f4f('0x2'));var moment=require(_0x4f4f('0x3'));var BPromise=require(_0x4f4f('0x4'));var rp=require(_0x4f4f('0x5'));var fs=require('fs');var path=require(_0x4f4f('0x6'));var rimraf=require('rimraf');var config=require(_0x4f4f('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x4f4f('0x8')]=function(_0x132d5c,_0x20ee6e){return _0x132d5c[_0x4f4f('0x9')](_0x4f4f('0xa'),attributes,{'tableName':_0x4f4f('0xb'),'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 67ff5bf..3d11052 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 _0x284f=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x409ef4,_0x435589){var _0x50036b=function(_0x4d12ff){while(--_0x4d12ff){_0x409ef4['push'](_0x409ef4['shift']());}};_0x50036b(++_0x435589);}(_0x284f,0x1e6));var _0xf284=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x284f[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0xf284('0x0'));var moment=require(_0xf284('0x1'));var BPromise=require(_0xf284('0x2'));var rs=require(_0xf284('0x3'));var fs=require('fs');var Redis=require(_0xf284('0x4'));var db=require(_0xf284('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf284('0x6'))(_0xf284('0x7'));var config=require(_0xf284('0x8'));var jayson=require(_0xf284('0x9'));var client=jayson[_0xf284('0xa')][_0xf284('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31e2df,_0x38fab5,_0x5f00dc){return new BPromise(function(_0x1afdb0,_0x5ca5d3){return client['request'](_0x31e2df,_0x5f00dc)[_0xf284('0xc')](function(_0x3e5ac2){logger[_0xf284('0xd')](_0xf284('0xe'),_0x38fab5,'request\x20sent');logger[_0xf284('0xf')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x38fab5,_0xf284('0x10'),JSON[_0xf284('0x11')](_0x3e5ac2));if(_0x3e5ac2[_0xf284('0x12')]){if(_0x3e5ac2[_0xf284('0x12')][_0xf284('0x13')]===0x1f4){logger[_0xf284('0x12')](_0xf284('0xe'),_0x38fab5,_0x3e5ac2['error'][_0xf284('0x14')]);return _0x5ca5d3(_0x3e5ac2[_0xf284('0x12')]['message']);}logger['error'](_0xf284('0xe'),_0x38fab5,_0x3e5ac2[_0xf284('0x12')][_0xf284('0x14')]);return _0x1afdb0(_0x3e5ac2['error']['message']);}else{logger[_0xf284('0xd')](_0xf284('0xe'),_0x38fab5,_0xf284('0x10'));_0x1afdb0(_0x3e5ac2[_0xf284('0x15')][_0xf284('0x14')]);}})[_0xf284('0x16')](function(_0x38c954){logger[_0xf284('0x12')](_0xf284('0xe'),_0x38fab5,_0x38c954);_0x5ca5d3(_0x38c954);});});} \ No newline at end of file +var _0xb0e0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x45b479,_0x3e6574){var _0x1c3cbe=function(_0xd53e52){while(--_0xd53e52){_0x45b479['push'](_0x45b479['shift']());}};_0x1c3cbe(++_0x3e6574);}(_0xb0e0,0x189));var _0x0b0e=function(_0x13b7ae,_0x2f6110){_0x13b7ae=_0x13b7ae-0x0;var _0x58795e=_0xb0e0[_0x13b7ae];return _0x58795e;};'use strict';var _=require(_0x0b0e('0x0'));var util=require(_0x0b0e('0x1'));var moment=require(_0x0b0e('0x2'));var BPromise=require(_0x0b0e('0x3'));var rs=require(_0x0b0e('0x4'));var fs=require('fs');var Redis=require(_0x0b0e('0x5'));var db=require(_0x0b0e('0x6'))['db'];var utils=require(_0x0b0e('0x7'));var logger=require(_0x0b0e('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0b0e('0x9'));var client=jayson['client'][_0x0b0e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47923a,_0x46a39b,_0x4bca05){return new BPromise(function(_0x9e870,_0x398ae4){return client[_0x0b0e('0xb')](_0x47923a,_0x4bca05)['then'](function(_0x56f77f){logger[_0x0b0e('0xc')](_0x0b0e('0xd'),_0x46a39b,_0x0b0e('0xe'));logger['debug'](_0x0b0e('0xf'),_0x46a39b,'request\x20sent',JSON[_0x0b0e('0x10')](_0x56f77f));if(_0x56f77f[_0x0b0e('0x11')]){if(_0x56f77f['error'][_0x0b0e('0x12')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x46a39b,_0x56f77f[_0x0b0e('0x11')]['message']);return _0x398ae4(_0x56f77f['error'][_0x0b0e('0x13')]);}logger['error'](_0x0b0e('0xd'),_0x46a39b,_0x56f77f[_0x0b0e('0x11')]['message']);return _0x9e870(_0x56f77f[_0x0b0e('0x11')][_0x0b0e('0x13')]);}else{logger[_0x0b0e('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x46a39b,_0x0b0e('0xe'));_0x9e870(_0x56f77f[_0x0b0e('0x14')][_0x0b0e('0x13')]);}})[_0x0b0e('0x15')](function(_0x1c7268){logger[_0x0b0e('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x46a39b,_0x1c7268);_0x398ae4(_0x1c7268);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index c1aefed..7811d28 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 _0xe969=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe969,0xed));var _0x9e96=function(_0x225f22,_0x4c3c2d){_0x225f22=_0x225f22-0x0;var _0x6a3234=_0xe969[_0x225f22];return _0x6a3234;};'use strict';var multer=require(_0x9e96('0x0'));var util=require(_0x9e96('0x1'));var path=require(_0x9e96('0x2'));var timeout=require(_0x9e96('0x3'));var express=require(_0x9e96('0x4'));var router=express[_0x9e96('0x5')]();var fs_extra=require(_0x9e96('0x6'));var auth=require(_0x9e96('0x7'));var interaction=require(_0x9e96('0x8'));var config=require('../../config/environment');var controller=require(_0x9e96('0x9'));router[_0x9e96('0xa')]('/',auth[_0x9e96('0xb')](),controller[_0x9e96('0xc')]);router[_0x9e96('0xa')](_0x9e96('0xd'),auth[_0x9e96('0xb')](),controller['show']);router['post']('/',auth[_0x9e96('0xb')](),controller[_0x9e96('0xe')]);router[_0x9e96('0xf')](_0x9e96('0xd'),auth[_0x9e96('0xb')](),controller[_0x9e96('0x10')]);router[_0x9e96('0x11')](_0x9e96('0xd'),auth[_0x9e96('0xb')](),controller[_0x9e96('0x12')]);module[_0x9e96('0x13')]=router; \ No newline at end of file +var _0x8fbc=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5db343,_0x321f0d){var _0x3003d0=function(_0x1c5ef4){while(--_0x1c5ef4){_0x5db343['push'](_0x5db343['shift']());}};_0x3003d0(++_0x321f0d);}(_0x8fbc,0x135));var _0xc8fb=function(_0x102dbb,_0x1ecd9a){_0x102dbb=_0x102dbb-0x0;var _0x16b50c=_0x8fbc[_0x102dbb];return _0x16b50c;};'use strict';var multer=require(_0xc8fb('0x0'));var util=require(_0xc8fb('0x1'));var path=require(_0xc8fb('0x2'));var timeout=require(_0xc8fb('0x3'));var express=require(_0xc8fb('0x4'));var router=express[_0xc8fb('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8fb('0x6'));var interaction=require(_0xc8fb('0x7'));var config=require(_0xc8fb('0x8'));var controller=require(_0xc8fb('0x9'));router[_0xc8fb('0xa')]('/',auth[_0xc8fb('0xb')](),controller[_0xc8fb('0xc')]);router[_0xc8fb('0xa')](_0xc8fb('0xd'),auth[_0xc8fb('0xb')](),controller[_0xc8fb('0xe')]);router['post']('/',auth[_0xc8fb('0xb')](),controller[_0xc8fb('0xf')]);router[_0xc8fb('0x10')](_0xc8fb('0xd'),auth[_0xc8fb('0xb')](),controller[_0xc8fb('0x11')]);router[_0xc8fb('0x12')](_0xc8fb('0xd'),auth[_0xc8fb('0xb')](),controller[_0xc8fb('0x13')]);module[_0xc8fb('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index b2dc599..1fdee65 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 _0xeac1=['keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x165fa6,_0x3d27b1){var _0x4b2994=function(_0x3fa7d3){while(--_0x3fa7d3){_0x165fa6['push'](_0x165fa6['shift']());}};_0x4b2994(++_0x3d27b1);}(_0xeac1,0x163));var _0x1eac=function(_0x52ecbc,_0x276092){_0x52ecbc=_0x52ecbc-0x0;var _0x3abd51=_0xeac1[_0x52ecbc];return _0x3abd51;};'use strict';var Sequelize=require(_0x1eac('0x0'));module[_0x1eac('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1eac('0x2'),_0x1eac('0x3'),_0x1eac('0x4'),_0x1eac('0x5'),_0x1eac('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1eac('0x7')]},'key':{'type':Sequelize[_0x1eac('0x7')]},'keyType':{'type':Sequelize[_0x1eac('0x8')](_0x1eac('0x2'),_0x1eac('0x3'),_0x1eac('0x4'))},'keyContent':{'type':Sequelize[_0x1eac('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1eac('0x7')]},'customField':{'type':Sequelize[_0x1eac('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1eac('0x7')]}}; \ No newline at end of file +var _0x6287=['BOOLEAN','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x21001b,_0x2fc679){var _0x38a25e=function(_0x1fb332){while(--_0x1fb332){_0x21001b['push'](_0x21001b['shift']());}};_0x38a25e(++_0x2fc679);}(_0x6287,0xd1));var _0x7628=function(_0xc8b400,_0x4ef3e4){_0xc8b400=_0xc8b400-0x0;var _0x135f09=_0x6287[_0xc8b400];return _0x135f09;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x7628('0x0'),_0x7628('0x1'),_0x7628('0x2'),_0x7628('0x3'),_0x7628('0x4')),'defaultValue':_0x7628('0x0')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7628('0x5')]},'keyType':{'type':Sequelize[_0x7628('0x6')](_0x7628('0x0'),_0x7628('0x1'),'customVariable')},'keyContent':{'type':Sequelize[_0x7628('0x5')]},'idField':{'type':Sequelize[_0x7628('0x5')]},'nameField':{'type':Sequelize[_0x7628('0x5')]},'customField':{'type':Sequelize[_0x7628('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index e56b3f5..80c4534 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 _0xdafd=['update','then','destroy','end','sendStatus','error','stack','name','send','index','map','ZendeskField','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','count','apply','reject','save'];(function(_0x41ca10,_0x44942e){var _0x33ee75=function(_0x534502){while(--_0x534502){_0x41ca10['push'](_0x41ca10['shift']());}};_0x33ee75(++_0x44942e);}(_0xdafd,0x146));var _0xddaf=function(_0x4c3a53,_0x58a525){_0x4c3a53=_0x4c3a53-0x0;var _0x1ce7f6=_0xdafd[_0x4c3a53];return _0x1ce7f6;};'use strict';var emlformat=require(_0xddaf('0x0'));var rimraf=require(_0xddaf('0x1'));var zipdir=require(_0xddaf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xddaf('0x3'));var moment=require(_0xddaf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xddaf('0x5'));var util=require('util');var path=require(_0xddaf('0x6'));var sox=require('sox');var csv=require(_0xddaf('0x7'));var ejs=require(_0xddaf('0x8'));var fs=require('fs');var fs_extra=require(_0xddaf('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xddaf('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xddaf('0xb'));var Papa=require(_0xddaf('0xc'));var Redis=require('ioredis');var authService=require(_0xddaf('0xd'));var qs=require(_0xddaf('0xe'));var as=require(_0xddaf('0xf'));var hardwareService=require(_0xddaf('0x10'));var logger=require(_0xddaf('0x11'))('api');var utils=require(_0xddaf('0x12'));var config=require(_0xddaf('0x13'));var licenseUtil=require(_0xddaf('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59f567,_0x323f5c){_0x323f5c=_0x323f5c||0xcc;return function(_0x4a3096){if(_0x4a3096){return _0x59f567['sendStatus'](_0x323f5c);}return _0x59f567[_0xddaf('0x15')](_0x323f5c)['end']();};}function respondWithResult(_0x25104b,_0x2c0f8d){_0x2c0f8d=_0x2c0f8d||0xc8;return function(_0x5087cd){if(_0x5087cd){return _0x25104b[_0xddaf('0x15')](_0x2c0f8d)[_0xddaf('0x16')](_0x5087cd);}};}function respondWithFilteredResult(_0x48d719,_0x1f0af1){return function(_0xfe5f0b){if(_0xfe5f0b){var _0x30d99b=typeof _0x1f0af1['offset']===_0xddaf('0x17')&&typeof _0x1f0af1[_0xddaf('0x18')]===_0xddaf('0x17');var _0x2df60d=_0xfe5f0b[_0xddaf('0x19')];var _0x1a8087=_0x30d99b?0x0:_0x1f0af1['offset'];var _0x8ef5db=_0x30d99b?_0xfe5f0b[_0xddaf('0x19')]:_0x1f0af1['offset']+_0x1f0af1[_0xddaf('0x18')];var _0x2c9f47;if(_0x8ef5db>=_0x2df60d){_0x8ef5db=_0x2df60d;_0x2c9f47=0xc8;}else{_0x2c9f47=0xce;}_0x48d719[_0xddaf('0x15')](_0x2c9f47);return _0x48d719['set']('Content-Range',_0x1a8087+'-'+_0x8ef5db+'/'+_0x2df60d)['json'](_0xfe5f0b);}return null;};}function patchUpdates(_0x5addd2){return function(_0x13db55){try{jsonpatch[_0xddaf('0x1a')](_0x13db55,_0x5addd2,!![]);}catch(_0x370dcf){return BPromise[_0xddaf('0x1b')](_0x370dcf);}return _0x13db55[_0xddaf('0x1c')]();};}function saveUpdates(_0x2f9c87,_0x17924a){return function(_0x13ea86){if(_0x13ea86){return _0x13ea86[_0xddaf('0x1d')](_0x2f9c87)[_0xddaf('0x1e')](function(_0x1e477d){return _0x1e477d;});}return null;};}function removeEntity(_0x563076,_0x166c74){return function(_0x3feae1){if(_0x3feae1){return _0x3feae1[_0xddaf('0x1f')]()[_0xddaf('0x1e')](function(){_0x563076['status'](0xcc)[_0xddaf('0x20')]();});}};}function handleEntityNotFound(_0x9f6037,_0x269094){return function(_0x1e2a75){if(!_0x1e2a75){_0x9f6037[_0xddaf('0x21')](0x194);}return _0x1e2a75;};}function handleError(_0x563014,_0x3ac694){_0x3ac694=_0x3ac694||0x1f4;return function(_0x119e10){logger[_0xddaf('0x22')](_0x119e10[_0xddaf('0x23')]);if(_0x119e10[_0xddaf('0x24')]){delete _0x119e10[_0xddaf('0x24')];}_0x563014[_0xddaf('0x15')](_0x3ac694)[_0xddaf('0x25')](_0x119e10);};}exports[_0xddaf('0x26')]=function(_0x579bce,_0x5d9b8d){var _0x546cc7={},_0x40f908={},_0x3e1bc0={'count':0x0,'rows':[]};var _0x1673ea=_[_0xddaf('0x27')](db[_0xddaf('0x28')]['rawAttributes'],function(_0x53804e){return{'name':_0x53804e['fieldName'],'type':_0x53804e[_0xddaf('0x29')][_0xddaf('0x2a')]};});_0x40f908[_0xddaf('0x2b')]=_[_0xddaf('0x27')](_0x1673ea,_0xddaf('0x24'));_0x40f908['query']=_[_0xddaf('0x2c')](_0x579bce[_0xddaf('0x2d')]);_0x40f908[_0xddaf('0x2e')]=_[_0xddaf('0x2f')](_0x40f908[_0xddaf('0x2b')],_0x40f908[_0xddaf('0x2d')]);_0x546cc7['attributes']=_[_0xddaf('0x2f')](_0x40f908[_0xddaf('0x2b')],qs['fields'](_0x579bce['query'][_0xddaf('0x30')]));_0x546cc7[_0xddaf('0x31')]=_0x546cc7[_0xddaf('0x31')][_0xddaf('0x32')]?_0x546cc7[_0xddaf('0x31')]:_0x40f908['model'];if(!_0x579bce[_0xddaf('0x2d')][_0xddaf('0x33')](_0xddaf('0x34'))){_0x546cc7[_0xddaf('0x18')]=qs[_0xddaf('0x18')](_0x579bce['query'][_0xddaf('0x18')]);_0x546cc7[_0xddaf('0x35')]=qs[_0xddaf('0x35')](_0x579bce[_0xddaf('0x2d')][_0xddaf('0x35')]);}_0x546cc7[_0xddaf('0x36')]=qs[_0xddaf('0x37')](_0x579bce[_0xddaf('0x2d')][_0xddaf('0x37')]);_0x546cc7[_0xddaf('0x38')]=qs[_0xddaf('0x2e')](_['pick'](_0x579bce['query'],_0x40f908['filters']),_0x1673ea);if(_0x579bce[_0xddaf('0x2d')][_0xddaf('0x39')]){_0x546cc7[_0xddaf('0x38')]=_[_0xddaf('0x3a')](_0x546cc7[_0xddaf('0x38')],{'$or':_['map'](_0x1673ea,function(_0x250422){if(_0x250422[_0xddaf('0x29')]!==_0xddaf('0x3b')){var _0x461b23={};_0x461b23[_0x250422[_0xddaf('0x24')]]={'$like':'%'+_0x579bce['query'][_0xddaf('0x39')]+'%'};return _0x461b23;}})});}_0x546cc7=_[_0xddaf('0x3a')]({},_0x546cc7,_0x579bce['options']);var _0x214e54={'where':_0x546cc7[_0xddaf('0x38')]};return db[_0xddaf('0x28')]['count'](_0x214e54)[_0xddaf('0x1e')](function(_0xf4052f){_0x3e1bc0[_0xddaf('0x19')]=_0xf4052f;if(_0x579bce[_0xddaf('0x2d')][_0xddaf('0x3c')]){_0x546cc7[_0xddaf('0x3d')]=[{'all':!![]}];}return db['ZendeskField'][_0xddaf('0x3e')](_0x546cc7);})[_0xddaf('0x1e')](function(_0x3df1b9){_0x3e1bc0[_0xddaf('0x3f')]=_0x3df1b9;return _0x3e1bc0;})['then'](respondWithFilteredResult(_0x5d9b8d,_0x546cc7))[_0xddaf('0x40')](handleError(_0x5d9b8d,null));};exports['show']=function(_0x2cd574,_0x10b726){var _0x2d355c={'raw':!![],'where':{'id':_0x2cd574[_0xddaf('0x41')]['id']}},_0x463a5a={};_0x463a5a['model']=_[_0xddaf('0x2c')](db['ZendeskField'][_0xddaf('0x42')]);_0x463a5a['query']=_[_0xddaf('0x2c')](_0x2cd574[_0xddaf('0x2d')]);_0x463a5a['filters']=_[_0xddaf('0x2f')](_0x463a5a[_0xddaf('0x2b')],_0x463a5a[_0xddaf('0x2d')]);_0x2d355c[_0xddaf('0x31')]=_[_0xddaf('0x2f')](_0x463a5a[_0xddaf('0x2b')],qs['fields'](_0x2cd574[_0xddaf('0x2d')][_0xddaf('0x30')]));_0x2d355c[_0xddaf('0x31')]=_0x2d355c[_0xddaf('0x31')][_0xddaf('0x32')]?_0x2d355c[_0xddaf('0x31')]:_0x463a5a[_0xddaf('0x2b')];if(_0x2cd574[_0xddaf('0x2d')][_0xddaf('0x3c')]){_0x2d355c[_0xddaf('0x3d')]=[{'all':!![]}];}_0x2d355c=_[_0xddaf('0x3a')]({},_0x2d355c,_0x2cd574[_0xddaf('0x43')]);return db[_0xddaf('0x28')][_0xddaf('0x44')](_0x2d355c)[_0xddaf('0x1e')](handleEntityNotFound(_0x10b726,null))['then'](respondWithResult(_0x10b726,null))[_0xddaf('0x40')](handleError(_0x10b726,null));};exports[_0xddaf('0x45')]=function(_0x3950bc,_0x9b2da0){return db[_0xddaf('0x28')][_0xddaf('0x45')](_0x3950bc['body'],{})[_0xddaf('0x1e')](respondWithResult(_0x9b2da0,0xc9))[_0xddaf('0x40')](handleError(_0x9b2da0,null));};exports[_0xddaf('0x1d')]=function(_0x391f28,_0x470312){if(_0x391f28[_0xddaf('0x46')]['id']){delete _0x391f28[_0xddaf('0x46')]['id'];}return db['ZendeskField'][_0xddaf('0x44')]({'where':{'id':_0x391f28[_0xddaf('0x41')]['id']}})['then'](handleEntityNotFound(_0x470312,null))[_0xddaf('0x1e')](saveUpdates(_0x391f28[_0xddaf('0x46')],null))[_0xddaf('0x1e')](respondWithResult(_0x470312,null))[_0xddaf('0x40')](handleError(_0x470312,null));};exports[_0xddaf('0x1f')]=function(_0x4665cf,_0x5a546f){return db[_0xddaf('0x28')][_0xddaf('0x44')]({'where':{'id':_0x4665cf[_0xddaf('0x41')]['id']}})[_0xddaf('0x1e')](handleEntityNotFound(_0x5a546f,null))[_0xddaf('0x1e')](removeEntity(_0x5a546f,null))[_0xddaf('0x40')](handleError(_0x5a546f,null));}; \ No newline at end of file +var _0x04a8=['where','filters','pick','merge','type','filter','options','then','include','catch','params','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','error','stack','name','index','map','ZendeskField','rawAttributes','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x1504f7,_0x4f2266){var _0x15058f=function(_0x314a48){while(--_0x314a48){_0x1504f7['push'](_0x1504f7['shift']());}};_0x15058f(++_0x4f2266);}(_0x04a8,0x1e4));var _0x804a=function(_0x4c400f,_0x801e79){_0x4c400f=_0x4c400f-0x0;var _0x50d0e8=_0x04a8[_0x4c400f];return _0x50d0e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x804a('0x0'));var zipdir=require(_0x804a('0x1'));var jsonpatch=require(_0x804a('0x2'));var rp=require(_0x804a('0x3'));var moment=require(_0x804a('0x4'));var BPromise=require(_0x804a('0x5'));var Mustache=require(_0x804a('0x6'));var util=require(_0x804a('0x7'));var path=require(_0x804a('0x8'));var sox=require('sox');var csv=require(_0x804a('0x9'));var ejs=require(_0x804a('0xa'));var fs=require('fs');var fs_extra=require(_0x804a('0xb'));var _=require('lodash');var squel=require(_0x804a('0xc'));var crypto=require('crypto');var jsforce=require(_0x804a('0xd'));var deskjs=require(_0x804a('0xe'));var toCsv=require(_0x804a('0x9'));var querystring=require(_0x804a('0xf'));var Papa=require(_0x804a('0x10'));var Redis=require(_0x804a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x804a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x804a('0x13'));var logger=require('../../config/logger')(_0x804a('0x14'));var utils=require('../../config/utils');var config=require(_0x804a('0x15'));var licenseUtil=require(_0x804a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10924c,_0x10f8eb){_0x10f8eb=_0x10f8eb||0xcc;return function(_0x4ef683){if(_0x4ef683){return _0x10924c['sendStatus'](_0x10f8eb);}return _0x10924c[_0x804a('0x17')](_0x10f8eb)[_0x804a('0x18')]();};}function respondWithResult(_0x4b6203,_0x415cc3){_0x415cc3=_0x415cc3||0xc8;return function(_0x4b8ccf){if(_0x4b8ccf){return _0x4b6203[_0x804a('0x17')](_0x415cc3)['json'](_0x4b8ccf);}};}function respondWithFilteredResult(_0x25b42f,_0x4670a8){return function(_0x327e23){if(_0x327e23){var _0x31c982=typeof _0x4670a8[_0x804a('0x19')]==='undefined'&&typeof _0x4670a8[_0x804a('0x1a')]===_0x804a('0x1b');var _0x12b267=_0x327e23[_0x804a('0x1c')];var _0x5953bc=_0x31c982?0x0:_0x4670a8[_0x804a('0x19')];var _0x558048=_0x31c982?_0x327e23['count']:_0x4670a8[_0x804a('0x19')]+_0x4670a8[_0x804a('0x1a')];var _0x43661d;if(_0x558048>=_0x12b267){_0x558048=_0x12b267;_0x43661d=0xc8;}else{_0x43661d=0xce;}_0x25b42f[_0x804a('0x17')](_0x43661d);return _0x25b42f[_0x804a('0x1d')](_0x804a('0x1e'),_0x5953bc+'-'+_0x558048+'/'+_0x12b267)['json'](_0x327e23);}return null;};}function patchUpdates(_0x1f6768){return function(_0x466731){try{jsonpatch[_0x804a('0x1f')](_0x466731,_0x1f6768,!![]);}catch(_0x33f603){return BPromise[_0x804a('0x20')](_0x33f603);}return _0x466731['save']();};}function saveUpdates(_0x5e2ab5,_0x19f8ef){return function(_0x24eeb1){if(_0x24eeb1){return _0x24eeb1[_0x804a('0x21')](_0x5e2ab5)['then'](function(_0x3f7fcd){return _0x3f7fcd;});}return null;};}function removeEntity(_0x1deb5e,_0x1b03bd){return function(_0xf76a05){if(_0xf76a05){return _0xf76a05[_0x804a('0x22')]()['then'](function(){_0x1deb5e['status'](0xcc)[_0x804a('0x18')]();});}};}function handleEntityNotFound(_0x3a40fe,_0x45fde6){return function(_0x323bdc){if(!_0x323bdc){_0x3a40fe['sendStatus'](0x194);}return _0x323bdc;};}function handleError(_0x10ec51,_0x57165c){_0x57165c=_0x57165c||0x1f4;return function(_0x2b9806){logger[_0x804a('0x23')](_0x2b9806[_0x804a('0x24')]);if(_0x2b9806['name']){delete _0x2b9806[_0x804a('0x25')];}_0x10ec51[_0x804a('0x17')](_0x57165c)['send'](_0x2b9806);};}exports[_0x804a('0x26')]=function(_0x450834,_0x15de14){var _0x2ec2dd={},_0x2d32f9={},_0x43f968={'count':0x0,'rows':[]};var _0x1ecca0=_[_0x804a('0x27')](db[_0x804a('0x28')][_0x804a('0x29')],function(_0x12f73a){return{'name':_0x12f73a['fieldName'],'type':_0x12f73a['type']['key']};});_0x2d32f9[_0x804a('0x2a')]=_[_0x804a('0x27')](_0x1ecca0,'name');_0x2d32f9[_0x804a('0x2b')]=_[_0x804a('0x2c')](_0x450834[_0x804a('0x2b')]);_0x2d32f9['filters']=_['intersection'](_0x2d32f9['model'],_0x2d32f9[_0x804a('0x2b')]);_0x2ec2dd[_0x804a('0x2d')]=_[_0x804a('0x2e')](_0x2d32f9[_0x804a('0x2a')],qs[_0x804a('0x2f')](_0x450834[_0x804a('0x2b')][_0x804a('0x2f')]));_0x2ec2dd['attributes']=_0x2ec2dd[_0x804a('0x2d')][_0x804a('0x30')]?_0x2ec2dd[_0x804a('0x2d')]:_0x2d32f9[_0x804a('0x2a')];if(!_0x450834[_0x804a('0x2b')][_0x804a('0x31')](_0x804a('0x32'))){_0x2ec2dd[_0x804a('0x1a')]=qs[_0x804a('0x1a')](_0x450834['query'][_0x804a('0x1a')]);_0x2ec2dd['offset']=qs[_0x804a('0x19')](_0x450834[_0x804a('0x2b')][_0x804a('0x19')]);}_0x2ec2dd[_0x804a('0x33')]=qs['sort'](_0x450834['query']['sort']);_0x2ec2dd[_0x804a('0x34')]=qs[_0x804a('0x35')](_[_0x804a('0x36')](_0x450834[_0x804a('0x2b')],_0x2d32f9[_0x804a('0x35')]),_0x1ecca0);if(_0x450834[_0x804a('0x2b')]['filter']){_0x2ec2dd['where']=_[_0x804a('0x37')](_0x2ec2dd[_0x804a('0x34')],{'$or':_[_0x804a('0x27')](_0x1ecca0,function(_0x270a8b){if(_0x270a8b[_0x804a('0x38')]!=='VIRTUAL'){var _0x579a00={};_0x579a00[_0x270a8b[_0x804a('0x25')]]={'$like':'%'+_0x450834['query'][_0x804a('0x39')]+'%'};return _0x579a00;}})});}_0x2ec2dd=_['merge']({},_0x2ec2dd,_0x450834[_0x804a('0x3a')]);var _0x365ff1={'where':_0x2ec2dd[_0x804a('0x34')]};return db[_0x804a('0x28')][_0x804a('0x1c')](_0x365ff1)[_0x804a('0x3b')](function(_0x408320){_0x43f968[_0x804a('0x1c')]=_0x408320;if(_0x450834[_0x804a('0x2b')]['includeAll']){_0x2ec2dd[_0x804a('0x3c')]=[{'all':!![]}];}return db[_0x804a('0x28')]['findAll'](_0x2ec2dd);})[_0x804a('0x3b')](function(_0x1f73f5){_0x43f968['rows']=_0x1f73f5;return _0x43f968;})[_0x804a('0x3b')](respondWithFilteredResult(_0x15de14,_0x2ec2dd))[_0x804a('0x3d')](handleError(_0x15de14,null));};exports['show']=function(_0x36a851,_0x41b9a9){var _0x19a5de={'raw':!![],'where':{'id':_0x36a851[_0x804a('0x3e')]['id']}},_0x474dfd={};_0x474dfd['model']=_[_0x804a('0x2c')](db[_0x804a('0x28')][_0x804a('0x29')]);_0x474dfd[_0x804a('0x2b')]=_[_0x804a('0x2c')](_0x36a851[_0x804a('0x2b')]);_0x474dfd[_0x804a('0x35')]=_['intersection'](_0x474dfd['model'],_0x474dfd[_0x804a('0x2b')]);_0x19a5de[_0x804a('0x2d')]=_[_0x804a('0x2e')](_0x474dfd[_0x804a('0x2a')],qs[_0x804a('0x2f')](_0x36a851[_0x804a('0x2b')]['fields']));_0x19a5de['attributes']=_0x19a5de['attributes'][_0x804a('0x30')]?_0x19a5de[_0x804a('0x2d')]:_0x474dfd[_0x804a('0x2a')];if(_0x36a851[_0x804a('0x2b')][_0x804a('0x3f')]){_0x19a5de[_0x804a('0x3c')]=[{'all':!![]}];}_0x19a5de=_[_0x804a('0x37')]({},_0x19a5de,_0x36a851['options']);return db[_0x804a('0x28')][_0x804a('0x40')](_0x19a5de)['then'](handleEntityNotFound(_0x41b9a9,null))[_0x804a('0x3b')](respondWithResult(_0x41b9a9,null))[_0x804a('0x3d')](handleError(_0x41b9a9,null));};exports[_0x804a('0x41')]=function(_0x25bde,_0x597daa){return db[_0x804a('0x28')][_0x804a('0x41')](_0x25bde[_0x804a('0x42')],{})[_0x804a('0x3b')](respondWithResult(_0x597daa,0xc9))[_0x804a('0x3d')](handleError(_0x597daa,null));};exports[_0x804a('0x21')]=function(_0x23ca61,_0x558eca){if(_0x23ca61[_0x804a('0x42')]['id']){delete _0x23ca61[_0x804a('0x42')]['id'];}return db[_0x804a('0x28')]['find']({'where':{'id':_0x23ca61[_0x804a('0x3e')]['id']}})[_0x804a('0x3b')](handleEntityNotFound(_0x558eca,null))[_0x804a('0x3b')](saveUpdates(_0x23ca61[_0x804a('0x42')],null))[_0x804a('0x3b')](respondWithResult(_0x558eca,null))[_0x804a('0x3d')](handleError(_0x558eca,null));};exports[_0x804a('0x22')]=function(_0x5d107f,_0x313513){return db['ZendeskField'][_0x804a('0x40')]({'where':{'id':_0x5d107f[_0x804a('0x3e')]['id']}})['then'](handleEntityNotFound(_0x313513,null))[_0x804a('0x3b')](removeEntity(_0x313513,null))[_0x804a('0x3d')](handleError(_0x313513,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 24e92d5..1479f20 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 _0x1fee=['define','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1fee,0xb9));var _0xe1fe=function(_0x43bd3f,_0x45d3cb){_0x43bd3f=_0x43bd3f-0x0;var _0x5b6477=_0x1fee[_0x43bd3f];return _0x5b6477;};'use strict';var _=require(_0xe1fe('0x0'));var util=require(_0xe1fe('0x1'));var logger=require('../../config/logger')(_0xe1fe('0x2'));var moment=require(_0xe1fe('0x3'));var BPromise=require('bluebird');var rp=require(_0xe1fe('0x4'));var fs=require('fs');var path=require(_0xe1fe('0x5'));var rimraf=require(_0xe1fe('0x6'));var config=require(_0xe1fe('0x7'));var attributes=require(_0xe1fe('0x8'));module[_0xe1fe('0x9')]=function(_0x3dd134,_0x2b063b){return _0x3dd134[_0xe1fe('0xa')](_0xe1fe('0xb'),attributes,{'tableName':_0xe1fe('0xc'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xe1fe('0xd'),_0xe1fe('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9320=['./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2ee26e,_0x583da3){var _0x4364c1=function(_0x2c404b){while(--_0x2c404b){_0x2ee26e['push'](_0x2ee26e['shift']());}};_0x4364c1(++_0x583da3);}(_0x9320,0xe4));var _0x0932=function(_0x1fc8c5,_0x4cf324){_0x1fc8c5=_0x1fc8c5-0x0;var _0x559576=_0x9320[_0x1fc8c5];return _0x559576;};'use strict';var _=require(_0x0932('0x0'));var util=require(_0x0932('0x1'));var logger=require(_0x0932('0x2'))(_0x0932('0x3'));var moment=require(_0x0932('0x4'));var BPromise=require(_0x0932('0x5'));var rp=require(_0x0932('0x6'));var fs=require('fs');var path=require(_0x0932('0x7'));var rimraf=require(_0x0932('0x8'));var config=require(_0x0932('0x9'));var attributes=require(_0x0932('0xa'));module[_0x0932('0xb')]=function(_0x4bde70,_0x5ef711){return _0x4bde70['define'](_0x0932('0xc'),attributes,{'tableName':_0x0932('0xd'),'paranoid':![],'indexes':[{'name':_0x0932('0xe'),'fields':[_0x0932('0xf'),_0x0932('0x10')],'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 b8f2789..4336517 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 _0xa62f=['../../config/environment','jayson/promise','client','http','then','info','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x329d8d,_0x57a2b5){var _0x211dba=function(_0x299da2){while(--_0x299da2){_0x329d8d['push'](_0x329d8d['shift']());}};_0x211dba(++_0x57a2b5);}(_0xa62f,0xdd));var _0xfa62=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa62f[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xfa62('0x0'));var util=require(_0xfa62('0x1'));var moment=require(_0xfa62('0x2'));var BPromise=require(_0xfa62('0x3'));var rs=require(_0xfa62('0x4'));var fs=require('fs');var Redis=require(_0xfa62('0x5'));var db=require(_0xfa62('0x6'))['db'];var utils=require(_0xfa62('0x7'));var logger=require(_0xfa62('0x8'))('rpc');var config=require(_0xfa62('0x9'));var jayson=require(_0xfa62('0xa'));var client=jayson[_0xfa62('0xb')][_0xfa62('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1464ed,_0x9c0c0d,_0x346fdb){return new BPromise(function(_0x343fff,_0x56aeaa){return client['request'](_0x1464ed,_0x346fdb)[_0xfa62('0xd')](function(_0x50a796){logger[_0xfa62('0xe')](_0xfa62('0xf'),_0x9c0c0d,'request\x20sent');logger[_0xfa62('0x10')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x9c0c0d,_0xfa62('0x11'),JSON['stringify'](_0x50a796));if(_0x50a796[_0xfa62('0x12')]){if(_0x50a796['error'][_0xfa62('0x13')]===0x1f4){logger[_0xfa62('0x12')](_0xfa62('0xf'),_0x9c0c0d,_0x50a796[_0xfa62('0x12')][_0xfa62('0x14')]);return _0x56aeaa(_0x50a796['error'][_0xfa62('0x14')]);}logger[_0xfa62('0x12')]('ZendeskField,\x20%s,\x20%s',_0x9c0c0d,_0x50a796[_0xfa62('0x12')][_0xfa62('0x14')]);return _0x343fff(_0x50a796[_0xfa62('0x12')][_0xfa62('0x14')]);}else{logger[_0xfa62('0xe')]('ZendeskField,\x20%s,\x20%s',_0x9c0c0d,_0xfa62('0x11'));_0x343fff(_0x50a796[_0xfa62('0x15')]['message']);}})[_0xfa62('0x16')](function(_0x31cf57){logger[_0xfa62('0x12')](_0xfa62('0xf'),_0x9c0c0d,_0x31cf57);_0x56aeaa(_0x31cf57);});});} \ No newline at end of file +var _0xcef6=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x55fa6a,_0x1bb002){var _0x3f6277=function(_0x641868){while(--_0x641868){_0x55fa6a['push'](_0x55fa6a['shift']());}};_0x3f6277(++_0x1bb002);}(_0xcef6,0x1a0));var _0x6cef=function(_0x4b1665,_0xb0c095){_0x4b1665=_0x4b1665-0x0;var _0x5850c0=_0xcef6[_0x4b1665];return _0x5850c0;};'use strict';var _=require(_0x6cef('0x0'));var util=require(_0x6cef('0x1'));var moment=require(_0x6cef('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cef('0x3'));var fs=require('fs');var Redis=require(_0x6cef('0x4'));var db=require(_0x6cef('0x5'))['db'];var utils=require(_0x6cef('0x6'));var logger=require(_0x6cef('0x7'))(_0x6cef('0x8'));var config=require(_0x6cef('0x9'));var jayson=require(_0x6cef('0xa'));var client=jayson[_0x6cef('0xb')][_0x6cef('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x556312,_0x53756a,_0x2beb82){return new BPromise(function(_0x1303ea,_0x35ba6c){return client[_0x6cef('0xd')](_0x556312,_0x2beb82)[_0x6cef('0xe')](function(_0xd1e37e){logger['info'](_0x6cef('0xf'),_0x53756a,_0x6cef('0x10'));logger[_0x6cef('0x11')](_0x6cef('0x12'),_0x53756a,_0x6cef('0x10'),JSON[_0x6cef('0x13')](_0xd1e37e));if(_0xd1e37e[_0x6cef('0x14')]){if(_0xd1e37e['error'][_0x6cef('0x15')]===0x1f4){logger[_0x6cef('0x14')](_0x6cef('0xf'),_0x53756a,_0xd1e37e[_0x6cef('0x14')]['message']);return _0x35ba6c(_0xd1e37e[_0x6cef('0x14')][_0x6cef('0x16')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x53756a,_0xd1e37e[_0x6cef('0x14')][_0x6cef('0x16')]);return _0x1303ea(_0xd1e37e['error'][_0x6cef('0x16')]);}else{logger[_0x6cef('0x17')](_0x6cef('0xf'),_0x53756a,_0x6cef('0x10'));_0x1303ea(_0xd1e37e[_0x6cef('0x18')]['message']);}})[_0x6cef('0x19')](function(_0x155081){logger[_0x6cef('0x14')](_0x6cef('0xf'),_0x53756a,_0x155081);_0x35ba6c(_0x155081);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index e820b4e..3853cbe 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 _0xfbb0=['get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','/:id','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xfbb0,0x112));var _0x0fbb=function(_0x38012e,_0x15c6e4){_0x38012e=_0x38012e-0x0;var _0xf41fdc=_0xfbb0[_0x38012e];return _0xf41fdc;};'use strict';var multer=require('multer');var util=require(_0x0fbb('0x0'));var path=require('path');var timeout=require(_0x0fbb('0x1'));var express=require(_0x0fbb('0x2'));var router=express['Router']();var fs_extra=require(_0x0fbb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0fbb('0x4'));var config=require(_0x0fbb('0x5'));var controller=require('./intZohoAccount.controller');router[_0x0fbb('0x6')]('/',auth['isAuthenticated'](),controller[_0x0fbb('0x7')]);router[_0x0fbb('0x6')]('/:id',auth[_0x0fbb('0x8')](),controller[_0x0fbb('0x9')]);router[_0x0fbb('0x6')](_0x0fbb('0xa'),auth['isAuthenticated'](),controller[_0x0fbb('0xb')]);router['get'](_0x0fbb('0xc'),auth[_0x0fbb('0x8')](),controller[_0x0fbb('0xd')]);router['post']('/',auth[_0x0fbb('0x8')](),controller['create']);router['post'](_0x0fbb('0xa'),auth[_0x0fbb('0x8')](),controller[_0x0fbb('0xe')]);router['put'](_0x0fbb('0xf'),auth[_0x0fbb('0x8')](),controller[_0x0fbb('0x10')]);router[_0x0fbb('0x11')](_0x0fbb('0xf'),auth['isAuthenticated'](),controller[_0x0fbb('0x12')]);module[_0x0fbb('0x13')]=router; \ No newline at end of file +var _0x900f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','exports','path','connect-timeout'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x900f,0x140));var _0xf900=function(_0x353bbb,_0x56e1ab){_0x353bbb=_0x353bbb-0x0;var _0x4e6a0e=_0x900f[_0x353bbb];return _0x4e6a0e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf900('0x0'));var timeout=require(_0xf900('0x1'));var express=require('express');var router=express[_0xf900('0x2')]();var fs_extra=require(_0xf900('0x3'));var auth=require(_0xf900('0x4'));var interaction=require(_0xf900('0x5'));var config=require('../../config/environment');var controller=require(_0xf900('0x6'));router[_0xf900('0x7')]('/',auth[_0xf900('0x8')](),controller[_0xf900('0x9')]);router[_0xf900('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xf900('0xa')]);router['get'](_0xf900('0xb'),auth[_0xf900('0x8')](),controller[_0xf900('0xc')]);router[_0xf900('0x7')](_0xf900('0xd'),auth[_0xf900('0x8')](),controller[_0xf900('0xe')]);router[_0xf900('0xf')]('/',auth['isAuthenticated'](),controller[_0xf900('0x10')]);router[_0xf900('0xf')](_0xf900('0xb'),auth['isAuthenticated'](),controller[_0xf900('0x11')]);router['put'](_0xf900('0x12'),auth[_0xf900('0x8')](),controller[_0xf900('0x13')]);router[_0xf900('0x14')](_0xf900('0x12'),auth[_0xf900('0x8')](),controller[_0xf900('0x15')]);module[_0xf900('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 3701463..de6ce2f 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 _0x668b=['exports','STRING','sequelize'];(function(_0x146a97,_0x2d8483){var _0x259d5c=function(_0x3ca436){while(--_0x3ca436){_0x146a97['push'](_0x146a97['shift']());}};_0x259d5c(++_0x2d8483);}(_0x668b,0x140));var _0xb668=function(_0xdeac17,_0x19ad66){_0xdeac17=_0xdeac17-0x0;var _0x33aabd=_0x668b[_0xdeac17];return _0x33aabd;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb668('0x2')]},'host':{'type':Sequelize[_0xb668('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb668('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb668('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xb668('0x2')]},'refreshToken':{'type':Sequelize[_0xb668('0x2')]}}; \ No newline at end of file +var _0x5b02=['exports','STRING','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5b02,0xe9));var _0x25b0=function(_0x26a6fa,_0x3125d0){_0x26a6fa=_0x26a6fa-0x0;var _0x374d0a=_0x5b02[_0x26a6fa];return _0x374d0a;};'use strict';var Sequelize=require(_0x25b0('0x0'));module[_0x25b0('0x1')]={'name':{'type':Sequelize[_0x25b0('0x2')]},'description':{'type':Sequelize[_0x25b0('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x25b0('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x25b0('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x25b0('0x2')]},'refreshToken':{'type':Sequelize[_0x25b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a0202c1..93aa48d 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 _0x6b54=['system_mandatory','display_label','custom_field','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','send','index','map','ZohoAccount','fieldName','type','key','model','name','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','intersection','length','find','create','body','destroy','getConfigurations','findOne','pick','filter','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com.au','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','getFields','host','serverUrl','code','refreshToken','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','response','error','message','Description','WhoId','Call_Result','Call_Start_Time','remove','includes'];(function(_0x35ae3d,_0x3465b9){var _0x1c7f4c=function(_0xc52df7){while(--_0xc52df7){_0x35ae3d['push'](_0x35ae3d['shift']());}};_0x1c7f4c(++_0x3465b9);}(_0x6b54,0x86));var _0x46b5=function(_0x169c01,_0x59f28d){_0x169c01=_0x169c01-0x0;var _0x2c3be4=_0x6b54[_0x169c01];return _0x2c3be4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46b5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46b5('0x1'));var rp=require(_0x46b5('0x2'));var moment=require(_0x46b5('0x3'));var BPromise=require(_0x46b5('0x4'));var Mustache=require(_0x46b5('0x5'));var util=require(_0x46b5('0x6'));var path=require(_0x46b5('0x7'));var sox=require(_0x46b5('0x8'));var csv=require(_0x46b5('0x9'));var ejs=require(_0x46b5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x46b5('0xb'));var crypto=require(_0x46b5('0xc'));var jsforce=require(_0x46b5('0xd'));var deskjs=require(_0x46b5('0xe'));var toCsv=require(_0x46b5('0x9'));var querystring=require(_0x46b5('0xf'));var Papa=require(_0x46b5('0x10'));var Redis=require(_0x46b5('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x46b5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46b5('0x13'))(_0x46b5('0x14'));var utils=require(_0x46b5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x46b5('0x16'));var db=require(_0x46b5('0x17'))['db'];var integrations=require(_0x46b5('0x18'));function respondWithStatusCode(_0x7cbc96,_0x5c42fd){_0x5c42fd=_0x5c42fd||0xcc;return function(_0x9353fb){if(_0x9353fb){return _0x7cbc96['sendStatus'](_0x5c42fd);}return _0x7cbc96[_0x46b5('0x19')](_0x5c42fd)[_0x46b5('0x1a')]();};}function respondWithResult(_0x508b3a,_0x365912){_0x365912=_0x365912||0xc8;return function(_0x153d19){if(_0x153d19){return _0x508b3a[_0x46b5('0x19')](_0x365912)[_0x46b5('0x1b')](_0x153d19);}};}function respondWithFilteredResult(_0x3825c4,_0x155d51){return function(_0x54ef9e){if(_0x54ef9e){var _0x4f2906=typeof _0x155d51['offset']===_0x46b5('0x1c')&&typeof _0x155d51[_0x46b5('0x1d')]==='undefined';var _0xa3faa7=_0x54ef9e[_0x46b5('0x1e')];var _0x47c098=_0x4f2906?0x0:_0x155d51[_0x46b5('0x1f')];var _0x425aea=_0x4f2906?_0x54ef9e[_0x46b5('0x1e')]:_0x155d51[_0x46b5('0x1f')]+_0x155d51['limit'];var _0x4291cc;if(_0x425aea>=_0xa3faa7){_0x425aea=_0xa3faa7;_0x4291cc=0xc8;}else{_0x4291cc=0xce;}_0x3825c4['status'](_0x4291cc);return _0x3825c4[_0x46b5('0x20')](_0x46b5('0x21'),_0x47c098+'-'+_0x425aea+'/'+_0xa3faa7)[_0x46b5('0x1b')](_0x54ef9e);}return null;};}function patchUpdates(_0x4f134a){return function(_0x30ac18){try{jsonpatch[_0x46b5('0x22')](_0x30ac18,_0x4f134a,!![]);}catch(_0x44a639){return BPromise[_0x46b5('0x23')](_0x44a639);}return _0x30ac18[_0x46b5('0x24')]();};}function saveUpdates(_0xffc90f,_0x1b19a0){return function(_0x192d95){if(_0x192d95){return _0x192d95[_0x46b5('0x25')](_0xffc90f)['then'](function(_0x29db1f){return _0x29db1f;});}return null;};}function removeEntity(_0x10bbfc,_0x205593){return function(_0x28ca07){if(_0x28ca07){return _0x28ca07['destroy']()[_0x46b5('0x26')](function(){_0x10bbfc[_0x46b5('0x19')](0xcc)[_0x46b5('0x1a')]();});}};}function handleEntityNotFound(_0x2c6c22,_0x47ffdf){return function(_0x3038e1){if(!_0x3038e1){_0x2c6c22['sendStatus'](0x194);}return _0x3038e1;};}function handleError(_0x404ac0,_0x518089){_0x518089=_0x518089||0x1f4;return function(_0x5c7d33){logger['error'](_0x5c7d33[_0x46b5('0x27')]);if(_0x5c7d33['name']){delete _0x5c7d33['name'];}_0x404ac0[_0x46b5('0x19')](_0x518089)[_0x46b5('0x28')](_0x5c7d33);};}exports[_0x46b5('0x29')]=function(_0x3e675c,_0x3fd6d7){var _0xab195c={},_0x59a28b={},_0x1345fb={'count':0x0,'rows':[]};var _0x1587e6=_[_0x46b5('0x2a')](db[_0x46b5('0x2b')]['rawAttributes'],function(_0x19dff1){return{'name':_0x19dff1[_0x46b5('0x2c')],'type':_0x19dff1[_0x46b5('0x2d')][_0x46b5('0x2e')]};});_0x59a28b[_0x46b5('0x2f')]=_[_0x46b5('0x2a')](_0x1587e6,_0x46b5('0x30'));_0x59a28b[_0x46b5('0x31')]=_[_0x46b5('0x32')](_0x3e675c[_0x46b5('0x31')]);_0x59a28b[_0x46b5('0x33')]=_['intersection'](_0x59a28b[_0x46b5('0x2f')],_0x59a28b[_0x46b5('0x31')]);_0xab195c[_0x46b5('0x34')]=_['intersection'](_0x59a28b[_0x46b5('0x2f')],qs[_0x46b5('0x35')](_0x3e675c['query'][_0x46b5('0x35')]));_0xab195c['attributes']=_0xab195c[_0x46b5('0x34')]['length']?_0xab195c[_0x46b5('0x34')]:_0x59a28b[_0x46b5('0x2f')];if(!_0x3e675c['query'][_0x46b5('0x36')](_0x46b5('0x37'))){_0xab195c['limit']=qs[_0x46b5('0x1d')](_0x3e675c[_0x46b5('0x31')][_0x46b5('0x1d')]);_0xab195c[_0x46b5('0x1f')]=qs['offset'](_0x3e675c[_0x46b5('0x31')][_0x46b5('0x1f')]);}_0xab195c[_0x46b5('0x38')]=qs['sort'](_0x3e675c[_0x46b5('0x31')][_0x46b5('0x39')]);_0xab195c[_0x46b5('0x3a')]=qs[_0x46b5('0x33')](_['pick'](_0x3e675c['query'],_0x59a28b[_0x46b5('0x33')]),_0x1587e6);if(_0x3e675c[_0x46b5('0x31')]['filter']){_0xab195c[_0x46b5('0x3a')]=_[_0x46b5('0x3b')](_0xab195c['where'],{'$or':_[_0x46b5('0x2a')](_0x1587e6,function(_0x4a5ceb){if(_0x4a5ceb[_0x46b5('0x2d')]!==_0x46b5('0x3c')){var _0x3d853e={};_0x3d853e[_0x4a5ceb[_0x46b5('0x30')]]={'$like':'%'+_0x3e675c[_0x46b5('0x31')]['filter']+'%'};return _0x3d853e;}})});}_0xab195c=_[_0x46b5('0x3b')]({},_0xab195c,_0x3e675c[_0x46b5('0x3d')]);var _0x47da9a={'where':_0xab195c[_0x46b5('0x3a')]};return db['ZohoAccount']['count'](_0x47da9a)[_0x46b5('0x26')](function(_0x53b3a9){_0x1345fb[_0x46b5('0x1e')]=_0x53b3a9;if(_0x3e675c['query'][_0x46b5('0x3e')]){_0xab195c[_0x46b5('0x3f')]=[{'all':!![]}];}return db['ZohoAccount'][_0x46b5('0x40')](_0xab195c);})['then'](function(_0x41179b){_0x1345fb['rows']=_0x41179b;return _0x1345fb;})['then'](respondWithFilteredResult(_0x3fd6d7,_0xab195c))[_0x46b5('0x41')](handleError(_0x3fd6d7,null));};exports[_0x46b5('0x42')]=function(_0x36c02d,_0x127497){var _0x9bf9de={'raw':![],'where':{'id':_0x36c02d[_0x46b5('0x43')]['id']}},_0x1b0c21={};_0x1b0c21['model']=_[_0x46b5('0x32')](db[_0x46b5('0x2b')][_0x46b5('0x44')]);_0x1b0c21[_0x46b5('0x31')]=_['keys'](_0x36c02d[_0x46b5('0x31')]);_0x1b0c21[_0x46b5('0x33')]=_[_0x46b5('0x45')](_0x1b0c21[_0x46b5('0x2f')],_0x1b0c21[_0x46b5('0x31')]);_0x9bf9de[_0x46b5('0x34')]=_[_0x46b5('0x45')](_0x1b0c21['model'],qs[_0x46b5('0x35')](_0x36c02d[_0x46b5('0x31')][_0x46b5('0x35')]));_0x9bf9de['attributes']=_0x9bf9de[_0x46b5('0x34')][_0x46b5('0x46')]?_0x9bf9de[_0x46b5('0x34')]:_0x1b0c21['model'];if(_0x36c02d[_0x46b5('0x31')][_0x46b5('0x3e')]){_0x9bf9de[_0x46b5('0x3f')]=[{'all':!![]}];}_0x9bf9de=_[_0x46b5('0x3b')]({},_0x9bf9de,_0x36c02d[_0x46b5('0x3d')]);return db[_0x46b5('0x2b')][_0x46b5('0x47')](_0x9bf9de)[_0x46b5('0x26')](handleEntityNotFound(_0x127497,null))[_0x46b5('0x26')](respondWithResult(_0x127497,null))[_0x46b5('0x41')](handleError(_0x127497,null));};exports[_0x46b5('0x48')]=function(_0x2fc5aa,_0x26d8ea){return db[_0x46b5('0x2b')][_0x46b5('0x48')](_0x2fc5aa['body'],{})['then'](respondWithResult(_0x26d8ea,0xc9))[_0x46b5('0x41')](handleError(_0x26d8ea,null));};exports[_0x46b5('0x25')]=function(_0x323057,_0xe4ae9a){if(_0x323057[_0x46b5('0x49')]['id']){delete _0x323057[_0x46b5('0x49')]['id'];}return db[_0x46b5('0x2b')][_0x46b5('0x47')]({'where':{'id':_0x323057[_0x46b5('0x43')]['id']}})[_0x46b5('0x26')](handleEntityNotFound(_0xe4ae9a,null))['then'](saveUpdates(_0x323057[_0x46b5('0x49')],null))[_0x46b5('0x26')](respondWithResult(_0xe4ae9a,null))[_0x46b5('0x41')](handleError(_0xe4ae9a,null));};exports[_0x46b5('0x4a')]=function(_0x160a26,_0x397832){return db[_0x46b5('0x2b')][_0x46b5('0x47')]({'where':{'id':_0x160a26[_0x46b5('0x43')]['id']}})['then'](handleEntityNotFound(_0x397832,null))[_0x46b5('0x26')](removeEntity(_0x397832,null))[_0x46b5('0x41')](handleError(_0x397832,null));};exports[_0x46b5('0x4b')]=function(_0x19fe44,_0x1eb921,_0x180533){var _0xdb1283={};var _0x5b402c={};var _0x29daf9;var _0x538fc8;return db[_0x46b5('0x2b')][_0x46b5('0x4c')]({'where':{'id':_0x19fe44[_0x46b5('0x43')]['id']}})[_0x46b5('0x26')](handleEntityNotFound(_0x1eb921,null))['then'](function(_0x4ea8fa){if(_0x4ea8fa){_0x29daf9=_0x4ea8fa;_0x5b402c[_0x46b5('0x2f')]=_[_0x46b5('0x32')](db['ZohoConfiguration'][_0x46b5('0x44')]);_0x5b402c[_0x46b5('0x31')]=_[_0x46b5('0x32')](_0x19fe44[_0x46b5('0x31')]);_0x5b402c[_0x46b5('0x33')]=_[_0x46b5('0x45')](_0x5b402c['model'],_0x5b402c[_0x46b5('0x31')]);_0xdb1283[_0x46b5('0x34')]=_[_0x46b5('0x45')](_0x5b402c[_0x46b5('0x2f')],qs['fields'](_0x19fe44[_0x46b5('0x31')]['fields']));_0xdb1283[_0x46b5('0x34')]=_0xdb1283[_0x46b5('0x34')][_0x46b5('0x46')]?_0xdb1283['attributes']:_0x5b402c['model'];_0xdb1283[_0x46b5('0x38')]=qs[_0x46b5('0x39')](_0x19fe44[_0x46b5('0x31')][_0x46b5('0x39')]);_0xdb1283[_0x46b5('0x3a')]=qs[_0x46b5('0x33')](_[_0x46b5('0x4d')](_0x19fe44[_0x46b5('0x31')],_0x5b402c['filters']));if(_0x19fe44[_0x46b5('0x31')][_0x46b5('0x4e')]){_0xdb1283[_0x46b5('0x3a')]=_[_0x46b5('0x3b')](_0xdb1283[_0x46b5('0x3a')],{'$or':_['map'](_0xdb1283[_0x46b5('0x34')],function(_0xaa676f){var _0x32e4c4={};_0x32e4c4[_0xaa676f]={'$like':'%'+_0x19fe44[_0x46b5('0x31')]['filter']+'%'};return _0x32e4c4;})});}_0xdb1283=_[_0x46b5('0x3b')]({},_0xdb1283,_0x19fe44[_0x46b5('0x3d')]);return _0x29daf9[_0x46b5('0x4b')](_0xdb1283);}})[_0x46b5('0x26')](function(_0x1fbe73){if(_0x1fbe73){_0x538fc8=_0x1fbe73['length'];if(!_0x19fe44[_0x46b5('0x31')][_0x46b5('0x36')](_0x46b5('0x37'))){_0xdb1283[_0x46b5('0x1d')]=qs[_0x46b5('0x1d')](_0x19fe44[_0x46b5('0x31')][_0x46b5('0x1d')]);_0xdb1283[_0x46b5('0x1f')]=qs[_0x46b5('0x1f')](_0x19fe44['query'][_0x46b5('0x1f')]);}return _0x29daf9['getConfigurations'](_0xdb1283);}})[_0x46b5('0x26')](function(_0x48de7b){if(_0x48de7b){return _0x48de7b?{'count':_0x538fc8,'rows':_0x48de7b}:null;}})[_0x46b5('0x26')](respondWithResult(_0x1eb921,null))[_0x46b5('0x41')](handleError(_0x1eb921,null));};exports['addConfiguration']=function(_0x3265ed,_0x3e6e55,_0x339ee2){if(_0x3265ed['body']['id']){delete _0x3265ed[_0x46b5('0x49')]['id'];}return db[_0x46b5('0x2b')]['findOne']({'where':{'id':_0x3265ed[_0x46b5('0x43')]['id']}})[_0x46b5('0x26')](handleEntityNotFound(_0x3e6e55,null))[_0x46b5('0x26')](function(_0x1a4e5c){if(_0x1a4e5c){_0x3265ed[_0x46b5('0x49')]['AccountId']=_0x1a4e5c['id'];_0x3265ed[_0x46b5('0x49')][_0x46b5('0x4f')]=integrations[_0x46b5('0x50')](_0x3265ed[_0x46b5('0x49')][_0x46b5('0x51')],_0x3265ed['body'][_0x46b5('0x2d')]);_0x3265ed[_0x46b5('0x49')][_0x46b5('0x52')]=integrations[_0x46b5('0x53')](_0x3265ed['body'][_0x46b5('0x51')],_0x3265ed[_0x46b5('0x49')][_0x46b5('0x2d')]);return db[_0x46b5('0x54')][_0x46b5('0x48')](_0x3265ed['body'],{'include':[{'model':db[_0x46b5('0x55')],'as':_0x46b5('0x4f')},{'model':db[_0x46b5('0x55')],'as':_0x46b5('0x52')}]});}return null;})['then'](respondWithResult(_0x3e6e55,null))['catch'](handleError(_0x3e6e55,null));};function getAccessToken(_0x57b88f){return new Promise(function(_0x3879ab,_0x3a7ce0){var _0x12c67d;switch(_0x57b88f[_0x46b5('0x56')]){case'US':_0x12c67d='https://accounts.zoho.com';break;case'AU':_0x12c67d=_0x46b5('0x57');break;case'EU':_0x12c67d=_0x46b5('0x58');break;case'IN':_0x12c67d=_0x46b5('0x59');break;case'CN':_0x12c67d=_0x46b5('0x5a');break;default:_0x12c67d=_0x46b5('0x58');break;}var _0x1a5d1a={'method':_0x46b5('0x5b'),'uri':_0x12c67d+_0x46b5('0x5c'),'qs':{'refresh_token':_0x57b88f['refreshToken'],'client_id':_0x57b88f[_0x46b5('0x5d')],'client_secret':_0x57b88f[_0x46b5('0x5e')],'grant_type':_0x46b5('0x5f')},'json':!![]};return rp(_0x1a5d1a)[_0x46b5('0x26')](function(_0x284e21){if(_0x284e21[_0x46b5('0x60')]){_0x3879ab(_0x284e21['access_token']);}else{_0x3a7ce0(_0x46b5('0x61'));}})[_0x46b5('0x41')](function(_0x539815){_0x3a7ce0(_0x539815);});});}exports[_0x46b5('0x62')]=function(_0x5620b1,_0x54c14e,_0x3587b8){var _0x46c1de,_0x356bf4,_0x932ae2,_0xd9c4f6,_0x422d34;return db[_0x46b5('0x2b')][_0x46b5('0x4c')]({'where':{'id':_0x5620b1['params']['id']},'attributes':['id',_0x46b5('0x63'),'zone',_0x46b5('0x5d'),'clientSecret',_0x46b5('0x64'),_0x46b5('0x65'),_0x46b5('0x66')]})[_0x46b5('0x26')](handleEntityNotFound(_0x54c14e,null))['then'](function(_0x58e258){_0x422d34=_0x58e258;_0x46c1de=_0x422d34[_0x46b5('0x63')];_0x356bf4=_0x46c1de==='zoho.eu'?'eu':'com';_0x932ae2=_0x422d34[_0x46b5('0x64')];var _0x4365c4=_0x932ae2[_0x46b5('0x67')](-0x1);if(_0x4365c4==='/'||_0x4365c4==='\x5c'||_0x4365c4===':'){_0x932ae2=_0x932ae2['substring'](0x0,_0x932ae2[_0x46b5('0x68')](_0x4365c4));}if(!_0x422d34['refreshToken']){throw new Error(_0x46b5('0x69'));}return getAccessToken(_0x422d34);})['then'](function(_0x298c75){if(_0x298c75){return rp({'method':_0x46b5('0x6a'),'uri':util[_0x46b5('0x6b')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x356bf4),'qs':{'module':_0x46b5('0x6c')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x298c75},'json':!![]});}})[_0x46b5('0x26')](function(_0xd642ad){if(_0xd642ad){if(_0xd642ad['response']&&_0xd642ad[_0x46b5('0x6d')][_0x46b5('0x6e')]){throw new Error(_0xd642ad['response'][_0x46b5('0x6e')][_0x46b5('0x6f')]);}var _0x1d18c0=[];var _0x51feaf=[];var _0x5149de=['Owner','Subject',_0x46b5('0x70'),_0x46b5('0x71'),'Call_Duration',_0x46b5('0x72'),_0x46b5('0x73'),'Call_Type'];_0x51feaf=_[_0x46b5('0x74')](_0xd642ad[_0x46b5('0x35')],function(_0x4727a8){return _0x5149de[_0x46b5('0x75')](_0x4727a8['api_name']);});for(var _0x44a2c9=0x0;_0x44a2c9<_0x51feaf[_0x46b5('0x46')];_0x44a2c9++){if(_0x51feaf[_0x44a2c9][_0x46b5('0x76')]===![]){_0x1d18c0['push']({'id':_0x51feaf[_0x44a2c9]['id'],'name':_0x51feaf[_0x44a2c9][_0x46b5('0x77')],'custom':_0x51feaf[_0x44a2c9][_0x46b5('0x78')],'options':_0x51feaf[_0x44a2c9]['data_type']===_0x46b5('0x79')&&_0x51feaf[_0x44a2c9][_0x46b5('0x7a')][_0x46b5('0x46')]>-0x1?_[_0x46b5('0x2a')](_0x51feaf[_0x44a2c9][_0x46b5('0x7a')],function(_0x180730){return{'name':_0x180730,'value':_0x180730};}):[]});}}return{'count':_0x1d18c0[_0x46b5('0x46')],'rows':_0x1d18c0};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x54c14e,null))['catch'](function(_0xff3689){var _0x11e1a2=_0x5620b1[_0x46b5('0x31')]['test']?0x1f4:_0xff3689[_0x46b5('0x7b')]||0x1f4;logger[_0x46b5('0x6e')](_0x46b5('0x7c'),_0x46b5('0x62'),_0x11e1a2,JSON[_0x46b5('0x7d')](_0xff3689));delete _0xff3689[_0x46b5('0x30')];if(_0x11e1a2===0x191){_0x11e1a2=0x190;}_0x54c14e['status'](_0x11e1a2)[_0x46b5('0x28')](_0x5620b1[_0x46b5('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0xff3689[_0x46b5('0x7b')]}:_0xff3689);});}; \ No newline at end of file +var _0xc053=['status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','index','map','ZohoAccount','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','find','catch','create','body','params','getConfigurations','hasOwnProperty','addConfiguration','findOne','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','substring','lastIndexOf','format','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','remove','includes','api_name','push','display_label','custom_field','data_type','picklist','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus'];(function(_0x28d4a2,_0x578d0e){var _0x189fa9=function(_0x4c426a){while(--_0x4c426a){_0x28d4a2['push'](_0x28d4a2['shift']());}};_0x189fa9(++_0x578d0e);}(_0xc053,0x64));var _0x3c05=function(_0x56339e,_0x4f7a63){_0x56339e=_0x56339e-0x0;var _0x2a028f=_0xc053[_0x56339e];return _0x2a028f;};'use strict';var emlformat=require(_0x3c05('0x0'));var rimraf=require(_0x3c05('0x1'));var zipdir=require(_0x3c05('0x2'));var jsonpatch=require(_0x3c05('0x3'));var rp=require(_0x3c05('0x4'));var moment=require(_0x3c05('0x5'));var BPromise=require(_0x3c05('0x6'));var Mustache=require(_0x3c05('0x7'));var util=require(_0x3c05('0x8'));var path=require('path');var sox=require(_0x3c05('0x9'));var csv=require('to-csv');var ejs=require(_0x3c05('0xa'));var fs=require('fs');var fs_extra=require(_0x3c05('0xb'));var _=require(_0x3c05('0xc'));var squel=require(_0x3c05('0xd'));var crypto=require(_0x3c05('0xe'));var jsforce=require(_0x3c05('0xf'));var deskjs=require(_0x3c05('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3c05('0x11'));var Papa=require(_0x3c05('0x12'));var Redis=require(_0x3c05('0x13'));var authService=require(_0x3c05('0x14'));var qs=require(_0x3c05('0x15'));var as=require(_0x3c05('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c05('0x17'))(_0x3c05('0x18'));var utils=require(_0x3c05('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x3c05('0x1a'));var db=require(_0x3c05('0x1b'))['db'];var integrations=require(_0x3c05('0x1c'));function respondWithStatusCode(_0x4dc8dc,_0x2e1223){_0x2e1223=_0x2e1223||0xcc;return function(_0x2d055b){if(_0x2d055b){return _0x4dc8dc[_0x3c05('0x1d')](_0x2e1223);}return _0x4dc8dc[_0x3c05('0x1e')](_0x2e1223)[_0x3c05('0x1f')]();};}function respondWithResult(_0x2d87db,_0x4b4541){_0x4b4541=_0x4b4541||0xc8;return function(_0x20c4f1){if(_0x20c4f1){return _0x2d87db[_0x3c05('0x1e')](_0x4b4541)[_0x3c05('0x20')](_0x20c4f1);}};}function respondWithFilteredResult(_0x1b2ad0,_0x3d2f7a){return function(_0x3b5d7e){if(_0x3b5d7e){var _0x54044a=typeof _0x3d2f7a[_0x3c05('0x21')]===_0x3c05('0x22')&&typeof _0x3d2f7a[_0x3c05('0x23')]===_0x3c05('0x22');var _0x52f2c0=_0x3b5d7e[_0x3c05('0x24')];var _0x4272ef=_0x54044a?0x0:_0x3d2f7a[_0x3c05('0x21')];var _0x5ad3bf=_0x54044a?_0x3b5d7e[_0x3c05('0x24')]:_0x3d2f7a[_0x3c05('0x21')]+_0x3d2f7a[_0x3c05('0x23')];var _0x3f2096;if(_0x5ad3bf>=_0x52f2c0){_0x5ad3bf=_0x52f2c0;_0x3f2096=0xc8;}else{_0x3f2096=0xce;}_0x1b2ad0[_0x3c05('0x1e')](_0x3f2096);return _0x1b2ad0[_0x3c05('0x25')]('Content-Range',_0x4272ef+'-'+_0x5ad3bf+'/'+_0x52f2c0)[_0x3c05('0x20')](_0x3b5d7e);}return null;};}function patchUpdates(_0x4c24ca){return function(_0xc86b9){try{jsonpatch[_0x3c05('0x26')](_0xc86b9,_0x4c24ca,!![]);}catch(_0xe50e27){return BPromise['reject'](_0xe50e27);}return _0xc86b9[_0x3c05('0x27')]();};}function saveUpdates(_0x35c15e,_0x7ede41){return function(_0x3d0fd1){if(_0x3d0fd1){return _0x3d0fd1[_0x3c05('0x28')](_0x35c15e)[_0x3c05('0x29')](function(_0x3980d0){return _0x3980d0;});}return null;};}function removeEntity(_0xfb26c,_0x5ca7be){return function(_0x2d0f86){if(_0x2d0f86){return _0x2d0f86[_0x3c05('0x2a')]()['then'](function(){_0xfb26c[_0x3c05('0x1e')](0xcc)[_0x3c05('0x1f')]();});}};}function handleEntityNotFound(_0x40a9ec,_0x49b9fb){return function(_0x1fd335){if(!_0x1fd335){_0x40a9ec[_0x3c05('0x1d')](0x194);}return _0x1fd335;};}function handleError(_0x14f71c,_0x4bfdc1){_0x4bfdc1=_0x4bfdc1||0x1f4;return function(_0x3e3adf){logger[_0x3c05('0x2b')](_0x3e3adf[_0x3c05('0x2c')]);if(_0x3e3adf['name']){delete _0x3e3adf[_0x3c05('0x2d')];}_0x14f71c[_0x3c05('0x1e')](_0x4bfdc1)[_0x3c05('0x2e')](_0x3e3adf);};}exports[_0x3c05('0x2f')]=function(_0x31a8ef,_0x4a2359){var _0x6a38f7={},_0x4a2e99={},_0x195037={'count':0x0,'rows':[]};var _0x5324c4=_[_0x3c05('0x30')](db[_0x3c05('0x31')][_0x3c05('0x32')],function(_0x31e197){return{'name':_0x31e197['fieldName'],'type':_0x31e197[_0x3c05('0x33')]['key']};});_0x4a2e99['model']=_[_0x3c05('0x30')](_0x5324c4,_0x3c05('0x2d'));_0x4a2e99['query']=_[_0x3c05('0x34')](_0x31a8ef[_0x3c05('0x35')]);_0x4a2e99[_0x3c05('0x36')]=_[_0x3c05('0x37')](_0x4a2e99[_0x3c05('0x38')],_0x4a2e99[_0x3c05('0x35')]);_0x6a38f7[_0x3c05('0x39')]=_[_0x3c05('0x37')](_0x4a2e99['model'],qs[_0x3c05('0x3a')](_0x31a8ef['query'][_0x3c05('0x3a')]));_0x6a38f7['attributes']=_0x6a38f7[_0x3c05('0x39')][_0x3c05('0x3b')]?_0x6a38f7[_0x3c05('0x39')]:_0x4a2e99[_0x3c05('0x38')];if(!_0x31a8ef[_0x3c05('0x35')]['hasOwnProperty'](_0x3c05('0x3c'))){_0x6a38f7[_0x3c05('0x23')]=qs[_0x3c05('0x23')](_0x31a8ef['query'][_0x3c05('0x23')]);_0x6a38f7[_0x3c05('0x21')]=qs[_0x3c05('0x21')](_0x31a8ef[_0x3c05('0x35')][_0x3c05('0x21')]);}_0x6a38f7[_0x3c05('0x3d')]=qs[_0x3c05('0x3e')](_0x31a8ef[_0x3c05('0x35')][_0x3c05('0x3e')]);_0x6a38f7[_0x3c05('0x3f')]=qs[_0x3c05('0x36')](_[_0x3c05('0x40')](_0x31a8ef['query'],_0x4a2e99[_0x3c05('0x36')]),_0x5324c4);if(_0x31a8ef[_0x3c05('0x35')][_0x3c05('0x41')]){_0x6a38f7[_0x3c05('0x3f')]=_['merge'](_0x6a38f7[_0x3c05('0x3f')],{'$or':_['map'](_0x5324c4,function(_0x3e4ac3){if(_0x3e4ac3[_0x3c05('0x33')]!==_0x3c05('0x42')){var _0x47445c={};_0x47445c[_0x3e4ac3['name']]={'$like':'%'+_0x31a8ef['query'][_0x3c05('0x41')]+'%'};return _0x47445c;}})});}_0x6a38f7=_[_0x3c05('0x43')]({},_0x6a38f7,_0x31a8ef[_0x3c05('0x44')]);var _0x1ca5df={'where':_0x6a38f7[_0x3c05('0x3f')]};return db[_0x3c05('0x31')][_0x3c05('0x24')](_0x1ca5df)['then'](function(_0x2f5381){_0x195037[_0x3c05('0x24')]=_0x2f5381;if(_0x31a8ef['query'][_0x3c05('0x45')]){_0x6a38f7[_0x3c05('0x46')]=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x6a38f7);})[_0x3c05('0x29')](function(_0x4c9011){_0x195037[_0x3c05('0x47')]=_0x4c9011;return _0x195037;})['then'](respondWithFilteredResult(_0x4a2359,_0x6a38f7))['catch'](handleError(_0x4a2359,null));};exports['show']=function(_0xf5ca24,_0x31c717){var _0x41904e={'raw':![],'where':{'id':_0xf5ca24['params']['id']}},_0x17f6b8={};_0x17f6b8[_0x3c05('0x38')]=_[_0x3c05('0x34')](db['ZohoAccount'][_0x3c05('0x32')]);_0x17f6b8['query']=_[_0x3c05('0x34')](_0xf5ca24[_0x3c05('0x35')]);_0x17f6b8[_0x3c05('0x36')]=_[_0x3c05('0x37')](_0x17f6b8[_0x3c05('0x38')],_0x17f6b8['query']);_0x41904e[_0x3c05('0x39')]=_[_0x3c05('0x37')](_0x17f6b8[_0x3c05('0x38')],qs[_0x3c05('0x3a')](_0xf5ca24[_0x3c05('0x35')][_0x3c05('0x3a')]));_0x41904e[_0x3c05('0x39')]=_0x41904e[_0x3c05('0x39')][_0x3c05('0x3b')]?_0x41904e['attributes']:_0x17f6b8[_0x3c05('0x38')];if(_0xf5ca24[_0x3c05('0x35')]['includeAll']){_0x41904e[_0x3c05('0x46')]=[{'all':!![]}];}_0x41904e=_['merge']({},_0x41904e,_0xf5ca24[_0x3c05('0x44')]);return db[_0x3c05('0x31')][_0x3c05('0x48')](_0x41904e)[_0x3c05('0x29')](handleEntityNotFound(_0x31c717,null))[_0x3c05('0x29')](respondWithResult(_0x31c717,null))[_0x3c05('0x49')](handleError(_0x31c717,null));};exports[_0x3c05('0x4a')]=function(_0x23891c,_0x2ec4ef){return db[_0x3c05('0x31')][_0x3c05('0x4a')](_0x23891c[_0x3c05('0x4b')],{})['then'](respondWithResult(_0x2ec4ef,0xc9))[_0x3c05('0x49')](handleError(_0x2ec4ef,null));};exports['update']=function(_0x2a044a,_0x47d7d7){if(_0x2a044a[_0x3c05('0x4b')]['id']){delete _0x2a044a['body']['id'];}return db[_0x3c05('0x31')][_0x3c05('0x48')]({'where':{'id':_0x2a044a[_0x3c05('0x4c')]['id']}})[_0x3c05('0x29')](handleEntityNotFound(_0x47d7d7,null))['then'](saveUpdates(_0x2a044a['body'],null))['then'](respondWithResult(_0x47d7d7,null))[_0x3c05('0x49')](handleError(_0x47d7d7,null));};exports[_0x3c05('0x2a')]=function(_0x1c6c20,_0x1663e5){return db[_0x3c05('0x31')][_0x3c05('0x48')]({'where':{'id':_0x1c6c20[_0x3c05('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1663e5,null))[_0x3c05('0x29')](removeEntity(_0x1663e5,null))[_0x3c05('0x49')](handleError(_0x1663e5,null));};exports[_0x3c05('0x4d')]=function(_0x509ce8,_0x368bac,_0x5e9245){var _0x233329={};var _0x8b6d96={};var _0xb76cc5;var _0x25a7aa;return db[_0x3c05('0x31')]['findOne']({'where':{'id':_0x509ce8[_0x3c05('0x4c')]['id']}})[_0x3c05('0x29')](handleEntityNotFound(_0x368bac,null))[_0x3c05('0x29')](function(_0x122a7b){if(_0x122a7b){_0xb76cc5=_0x122a7b;_0x8b6d96[_0x3c05('0x38')]=_[_0x3c05('0x34')](db['ZohoConfiguration'][_0x3c05('0x32')]);_0x8b6d96['query']=_[_0x3c05('0x34')](_0x509ce8[_0x3c05('0x35')]);_0x8b6d96[_0x3c05('0x36')]=_['intersection'](_0x8b6d96[_0x3c05('0x38')],_0x8b6d96[_0x3c05('0x35')]);_0x233329['attributes']=_[_0x3c05('0x37')](_0x8b6d96['model'],qs[_0x3c05('0x3a')](_0x509ce8[_0x3c05('0x35')][_0x3c05('0x3a')]));_0x233329['attributes']=_0x233329[_0x3c05('0x39')][_0x3c05('0x3b')]?_0x233329['attributes']:_0x8b6d96[_0x3c05('0x38')];_0x233329[_0x3c05('0x3d')]=qs[_0x3c05('0x3e')](_0x509ce8[_0x3c05('0x35')][_0x3c05('0x3e')]);_0x233329['where']=qs[_0x3c05('0x36')](_[_0x3c05('0x40')](_0x509ce8[_0x3c05('0x35')],_0x8b6d96[_0x3c05('0x36')]));if(_0x509ce8[_0x3c05('0x35')]['filter']){_0x233329[_0x3c05('0x3f')]=_['merge'](_0x233329[_0x3c05('0x3f')],{'$or':_[_0x3c05('0x30')](_0x233329[_0x3c05('0x39')],function(_0x55facb){var _0x43c75e={};_0x43c75e[_0x55facb]={'$like':'%'+_0x509ce8[_0x3c05('0x35')][_0x3c05('0x41')]+'%'};return _0x43c75e;})});}_0x233329=_[_0x3c05('0x43')]({},_0x233329,_0x509ce8['options']);return _0xb76cc5[_0x3c05('0x4d')](_0x233329);}})[_0x3c05('0x29')](function(_0x4f9037){if(_0x4f9037){_0x25a7aa=_0x4f9037[_0x3c05('0x3b')];if(!_0x509ce8[_0x3c05('0x35')][_0x3c05('0x4e')]('nolimit')){_0x233329[_0x3c05('0x23')]=qs[_0x3c05('0x23')](_0x509ce8['query']['limit']);_0x233329[_0x3c05('0x21')]=qs[_0x3c05('0x21')](_0x509ce8['query'][_0x3c05('0x21')]);}return _0xb76cc5[_0x3c05('0x4d')](_0x233329);}})[_0x3c05('0x29')](function(_0x557b1c){if(_0x557b1c){return _0x557b1c?{'count':_0x25a7aa,'rows':_0x557b1c}:null;}})[_0x3c05('0x29')](respondWithResult(_0x368bac,null))['catch'](handleError(_0x368bac,null));};exports[_0x3c05('0x4f')]=function(_0x31220b,_0x2126ce,_0x2fa202){if(_0x31220b[_0x3c05('0x4b')]['id']){delete _0x31220b[_0x3c05('0x4b')]['id'];}return db[_0x3c05('0x31')][_0x3c05('0x50')]({'where':{'id':_0x31220b[_0x3c05('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2126ce,null))[_0x3c05('0x29')](function(_0x3154c7){if(_0x3154c7){_0x31220b[_0x3c05('0x4b')]['AccountId']=_0x3154c7['id'];_0x31220b[_0x3c05('0x4b')][_0x3c05('0x51')]=integrations[_0x3c05('0x52')](_0x31220b[_0x3c05('0x4b')]['channel'],_0x31220b[_0x3c05('0x4b')][_0x3c05('0x33')]);_0x31220b[_0x3c05('0x4b')][_0x3c05('0x53')]=integrations[_0x3c05('0x54')](_0x31220b[_0x3c05('0x4b')][_0x3c05('0x55')],_0x31220b[_0x3c05('0x4b')][_0x3c05('0x33')]);return db['ZohoConfiguration']['create'](_0x31220b[_0x3c05('0x4b')],{'include':[{'model':db[_0x3c05('0x56')],'as':'Subjects'},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2126ce,null))[_0x3c05('0x49')](handleError(_0x2126ce,null));};function getAccessToken(_0x486a0c){return new Promise(function(_0x3c45f9,_0x17ae9d){var _0x3a391c;switch(_0x486a0c[_0x3c05('0x57')]){case'US':_0x3a391c=_0x3c05('0x58');break;case'AU':_0x3a391c='https://accounts.zoho.com.au';break;case'EU':_0x3a391c='https://accounts.zoho.eu';break;case'IN':_0x3a391c=_0x3c05('0x59');break;case'CN':_0x3a391c=_0x3c05('0x5a');break;default:_0x3a391c=_0x3c05('0x5b');break;}var _0x52db94={'method':_0x3c05('0x5c'),'uri':_0x3a391c+_0x3c05('0x5d'),'qs':{'refresh_token':_0x486a0c[_0x3c05('0x5e')],'client_id':_0x486a0c[_0x3c05('0x5f')],'client_secret':_0x486a0c[_0x3c05('0x60')],'grant_type':_0x3c05('0x61')},'json':!![]};return rp(_0x52db94)[_0x3c05('0x29')](function(_0xa6109){if(_0xa6109['access_token']){_0x3c45f9(_0xa6109[_0x3c05('0x62')]);}else{_0x17ae9d(_0x3c05('0x63'));}})[_0x3c05('0x49')](function(_0x8eed05){_0x17ae9d(_0x8eed05);});});}exports[_0x3c05('0x64')]=function(_0x47e912,_0xa3401b,_0x55053f){var _0x474cbb,_0x3a8376,_0x55c591,_0x5b6977,_0x228000;return db[_0x3c05('0x31')][_0x3c05('0x50')]({'where':{'id':_0x47e912['params']['id']},'attributes':['id',_0x3c05('0x65'),_0x3c05('0x57'),_0x3c05('0x5f'),'clientSecret',_0x3c05('0x66'),_0x3c05('0x67'),_0x3c05('0x5e')]})[_0x3c05('0x29')](handleEntityNotFound(_0xa3401b,null))['then'](function(_0x52dcfb){_0x228000=_0x52dcfb;_0x474cbb=_0x228000['host'];_0x3a8376=_0x474cbb===_0x3c05('0x68')?'eu':_0x3c05('0x69');_0x55c591=_0x228000['serverUrl'];var _0x4f1c15=_0x55c591['slice'](-0x1);if(_0x4f1c15==='/'||_0x4f1c15==='\x5c'||_0x4f1c15===':'){_0x55c591=_0x55c591[_0x3c05('0x6a')](0x0,_0x55c591[_0x3c05('0x6b')](_0x4f1c15));}if(!_0x228000[_0x3c05('0x5e')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x228000);})['then'](function(_0x193f9d){if(_0x193f9d){return rp({'method':'GET','uri':util[_0x3c05('0x6c')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x3a8376),'qs':{'module':'Calls'},'headers':{'Authorization':_0x3c05('0x6d')+_0x193f9d},'json':!![]});}})[_0x3c05('0x29')](function(_0x165f56){if(_0x165f56){if(_0x165f56[_0x3c05('0x6e')]&&_0x165f56['response'][_0x3c05('0x2b')]){throw new Error(_0x165f56[_0x3c05('0x6e')][_0x3c05('0x2b')][_0x3c05('0x6f')]);}var _0x3e1c7a=[];var _0x2a48e6=[];var _0xad1579=[_0x3c05('0x70'),_0x3c05('0x71'),_0x3c05('0x72'),_0x3c05('0x73'),'Call_Duration',_0x3c05('0x74'),_0x3c05('0x75'),'Call_Type'];_0x2a48e6=_[_0x3c05('0x76')](_0x165f56[_0x3c05('0x3a')],function(_0x39ded7){return _0xad1579[_0x3c05('0x77')](_0x39ded7[_0x3c05('0x78')]);});for(var _0x3f0a88=0x0;_0x3f0a88<_0x2a48e6['length'];_0x3f0a88++){if(_0x2a48e6[_0x3f0a88]['system_mandatory']===![]){_0x3e1c7a[_0x3c05('0x79')]({'id':_0x2a48e6[_0x3f0a88]['id'],'name':_0x2a48e6[_0x3f0a88][_0x3c05('0x7a')],'custom':_0x2a48e6[_0x3f0a88][_0x3c05('0x7b')],'options':_0x2a48e6[_0x3f0a88][_0x3c05('0x7c')]===_0x3c05('0x7d')&&_0x2a48e6[_0x3f0a88]['pick_list_values'][_0x3c05('0x3b')]>-0x1?_['map'](_0x2a48e6[_0x3f0a88]['pick_list_values'],function(_0x4b650a){return{'name':_0x4b650a,'value':_0x4b650a};}):[]});}}return{'count':_0x3e1c7a[_0x3c05('0x3b')],'rows':_0x3e1c7a};}else{return{'count':0x0,'rows':[]};}})[_0x3c05('0x29')](respondWithResult(_0xa3401b,null))[_0x3c05('0x49')](function(_0x1b5102){var _0x57dd75=_0x47e912[_0x3c05('0x35')]['test']?0x1f4:_0x1b5102[_0x3c05('0x7e')]||0x1f4;logger[_0x3c05('0x2b')](_0x3c05('0x7f'),_0x3c05('0x64'),_0x57dd75,JSON[_0x3c05('0x80')](_0x1b5102));delete _0x1b5102[_0x3c05('0x2d')];if(_0x57dd75===0x191){_0x57dd75=0x190;}_0xa3401b[_0x3c05('0x1e')](_0x57dd75)[_0x3c05('0x2e')](_0x47e912['query'][_0x3c05('0x81')]?{'message':'Wrong\x20credentials','statusCode':_0x1b5102[_0x3c05('0x7e')]}:_0x1b5102);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index ada3686..2ed3807 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 _0xdcbc=['clientId','clientSecret','code','substring','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','serverUrl','application/x-www-form-urlencoded','then','parse','refreshToken','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','/oauth/v2/token','refresh_token','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','zone'];(function(_0x4e71f2,_0x3ea25c){var _0x456936=function(_0x816279){while(--_0x816279){_0x4e71f2['push'](_0x4e71f2['shift']());}};_0x456936(++_0x3ea25c);}(_0xdcbc,0x16c));var _0xcdcb=function(_0xedb96,_0x3bb26a){_0xedb96=_0xedb96-0x0;var _0x2f1175=_0xdcbc[_0xedb96];return _0x2f1175;};'use strict';var _=require(_0xcdcb('0x0'));var util=require(_0xcdcb('0x1'));var logger=require(_0xcdcb('0x2'))('api');var moment=require(_0xcdcb('0x3'));var BPromise=require(_0xcdcb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdcb('0x5'));var rimraf=require(_0xcdcb('0x6'));var config=require('../../config/environment');var attributes=require(_0xcdcb('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xcdcb('0x8')]=function(_0x4ebdf1,_0x21b62e){return _0x4ebdf1[_0xcdcb('0x9')](_0xcdcb('0xa'),attributes,{'tableName':_0xcdcb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x13ce0b,_0x8118ae,_0x237c31){if(_0x13ce0b[_0xcdcb('0xc')](_0xcdcb('0xd'))||_0x13ce0b[_0xcdcb('0xc')]('serverUrl')||_0x13ce0b[_0xcdcb('0xc')](_0xcdcb('0xe'))||_0x13ce0b[_0xcdcb('0xc')](_0xcdcb('0xf'))||_0x13ce0b['changed'](_0xcdcb('0x10'))||_0x13ce0b[_0xcdcb('0xc')]('host')){var _0x410dd6,_0x5b52ca;_0x410dd6=_0x13ce0b['serverUrl'];var _0x57ef3c=_0x410dd6['slice'](-0x1);if(_0x57ef3c==='/'||_0x57ef3c==='\x5c'||_0x57ef3c===':'){_0x410dd6=_0x410dd6[_0xcdcb('0x11')](0x0,_0x410dd6['lastIndexOf'](_0x57ef3c));}switch(_0x13ce0b['zone']){case'US':_0x5b52ca='https://accounts.zoho.com';break;case'AU':_0x5b52ca=_0xcdcb('0x12');break;case'IN':_0x5b52ca='https://accounts.zoho.in';break;case'CN':_0x5b52ca=_0xcdcb('0x13');break;default:_0x5b52ca=_0xcdcb('0x14');break;}var _0x106324={'method':_0xcdcb('0x15'),'uri':_0x5b52ca+'/oauth/v2/token','form':{'grant_type':_0xcdcb('0x16'),'client_id':_0x13ce0b['clientId'],'client_secret':_0x13ce0b[_0xcdcb('0xf')],'redirect_uri':_0x13ce0b[_0xcdcb('0x17')],'code':_0x13ce0b[_0xcdcb('0x10')]},'headers':{'Content-Type':_0xcdcb('0x18')}};return rp(_0x106324)[_0xcdcb('0x19')](function(_0x395279){var _0x3b87d4=JSON[_0xcdcb('0x1a')](_0x395279);if(_0x3b87d4['refresh_token']){_0x13ce0b[_0xcdcb('0x1b')]=_0x3b87d4['refresh_token'];logger[_0xcdcb('0x1c')](util[_0xcdcb('0x1d')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x13ce0b[_0xcdcb('0x1e')],_0x13ce0b['id']));}else{logger[_0xcdcb('0x1f')](util[_0xcdcb('0x1d')](_0xcdcb('0x20'),_0x13ce0b[_0xcdcb('0x1e')],_0x13ce0b['id']),util[_0xcdcb('0x21')](_0x3b87d4,{'showHidden':![],'depth':null}));}return _0x237c31(null,_0x8118ae);})[_0xcdcb('0x22')](function(_0x15306b){logger[_0xcdcb('0x1f')](util[_0xcdcb('0x1d')](_0xcdcb('0x20'),_0x13ce0b[_0xcdcb('0x1e')],_0x13ce0b['id']),util[_0xcdcb('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x237c31(_0x15306b);});}else{return _0x237c31(null,_0x8118ae);}},'beforeUpdate':function(_0x3e24d4,_0x23686e,_0x20a1a7){if(_0x3e24d4['changed'](_0xcdcb('0xd'))||_0x3e24d4[_0xcdcb('0xc')](_0xcdcb('0x17'))||_0x3e24d4[_0xcdcb('0xc')]('clientId')||_0x3e24d4['changed'](_0xcdcb('0xf'))||_0x3e24d4[_0xcdcb('0xc')]('code')||_0x3e24d4['changed'](_0xcdcb('0x23'))){var _0x300e14,_0x22bb03;_0x300e14=_0x3e24d4['serverUrl'];var _0x59956d=_0x300e14[_0xcdcb('0x24')](-0x1);if(_0x59956d==='/'||_0x59956d==='\x5c'||_0x59956d===':'){_0x300e14=_0x300e14['substring'](0x0,_0x300e14[_0xcdcb('0x25')](_0x59956d));}switch(_0x3e24d4[_0xcdcb('0xd')]){case'US':_0x22bb03=_0xcdcb('0x26');break;case'AU':_0x22bb03=_0xcdcb('0x12');break;case'IN':_0x22bb03=_0xcdcb('0x27');break;case'CN':_0x22bb03=_0xcdcb('0x13');break;default:_0x22bb03=_0xcdcb('0x14');break;}var _0x58b2e4={'method':_0xcdcb('0x15'),'uri':_0x22bb03+_0xcdcb('0x28'),'form':{'grant_type':_0xcdcb('0x16'),'client_id':_0x3e24d4['clientId'],'client_secret':_0x3e24d4[_0xcdcb('0xf')],'redirect_uri':_0x3e24d4[_0xcdcb('0x17')],'code':_0x3e24d4['code']},'headers':{'Content-Type':_0xcdcb('0x18')}};return rp(_0x58b2e4)[_0xcdcb('0x19')](function(_0x58f89f){var _0x274976=JSON['parse'](_0x58f89f);if(_0x274976[_0xcdcb('0x29')]){_0x3e24d4['refreshToken']=_0x274976[_0xcdcb('0x29')];logger['info'](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3e24d4['name'],_0x3e24d4['id']));}else{logger[_0xcdcb('0x1f')](util['format'](_0xcdcb('0x20'),_0x3e24d4['name'],_0x3e24d4['id']),util[_0xcdcb('0x21')](_0x274976,{'showHidden':![],'depth':null}));}return _0x20a1a7(null,_0x23686e);})[_0xcdcb('0x22')](function(_0x39a883){logger[_0xcdcb('0x1f')](util[_0xcdcb('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3e24d4['name'],_0x3e24d4['id']),util[_0xcdcb('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x20a1a7(_0x39a883);});}else{return _0x20a1a7(null,_0x23686e);}}}});}; \ No newline at end of file +var _0x19d7=['exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','host','POST','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration'];(function(_0x4c6e03,_0x5b8435){var _0x1ad5c7=function(_0x143937){while(--_0x143937){_0x4c6e03['push'](_0x4c6e03['shift']());}};_0x1ad5c7(++_0x5b8435);}(_0x19d7,0x1e5));var _0x719d=function(_0x54cdf5,_0x21f772){_0x54cdf5=_0x54cdf5-0x0;var _0x586e44=_0x19d7[_0x54cdf5];return _0x586e44;};'use strict';var _=require('lodash');var util=require(_0x719d('0x0'));var logger=require(_0x719d('0x1'))(_0x719d('0x2'));var moment=require(_0x719d('0x3'));var BPromise=require(_0x719d('0x4'));var rp=require(_0x719d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x719d('0x6'));var config=require(_0x719d('0x7'));var attributes=require(_0x719d('0x8'));var integrations=require(_0x719d('0x9'));module[_0x719d('0xa')]=function(_0x2f5fb4,_0x419c53){return _0x2f5fb4[_0x719d('0xb')](_0x719d('0xc'),attributes,{'tableName':_0x719d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1a620c,_0x4bc513,_0x22f62){if(_0x1a620c[_0x719d('0xe')](_0x719d('0xf'))||_0x1a620c[_0x719d('0xe')](_0x719d('0x10'))||_0x1a620c[_0x719d('0xe')](_0x719d('0x11'))||_0x1a620c['changed'](_0x719d('0x12'))||_0x1a620c[_0x719d('0xe')](_0x719d('0x13'))||_0x1a620c['changed']('host')){var _0x3b30db,_0xf3bac2;_0x3b30db=_0x1a620c[_0x719d('0x10')];var _0x34b828=_0x3b30db[_0x719d('0x14')](-0x1);if(_0x34b828==='/'||_0x34b828==='\x5c'||_0x34b828===':'){_0x3b30db=_0x3b30db[_0x719d('0x15')](0x0,_0x3b30db[_0x719d('0x16')](_0x34b828));}switch(_0x1a620c[_0x719d('0xf')]){case'US':_0xf3bac2=_0x719d('0x17');break;case'AU':_0xf3bac2=_0x719d('0x18');break;case'IN':_0xf3bac2=_0x719d('0x19');break;case'CN':_0xf3bac2=_0x719d('0x1a');break;default:_0xf3bac2=_0x719d('0x1b');break;}var _0x39ef22={'method':'POST','uri':_0xf3bac2+_0x719d('0x1c'),'form':{'grant_type':_0x719d('0x1d'),'client_id':_0x1a620c[_0x719d('0x11')],'client_secret':_0x1a620c[_0x719d('0x12')],'redirect_uri':_0x1a620c[_0x719d('0x10')],'code':_0x1a620c[_0x719d('0x13')]},'headers':{'Content-Type':_0x719d('0x1e')}};return rp(_0x39ef22)[_0x719d('0x1f')](function(_0x13b777){var _0x3249a5=JSON[_0x719d('0x20')](_0x13b777);if(_0x3249a5[_0x719d('0x21')]){_0x1a620c[_0x719d('0x22')]=_0x3249a5[_0x719d('0x21')];logger[_0x719d('0x23')](util[_0x719d('0x24')](_0x719d('0x25'),_0x1a620c[_0x719d('0x26')],_0x1a620c['id']));}else{logger[_0x719d('0x27')](util[_0x719d('0x24')](_0x719d('0x28'),_0x1a620c[_0x719d('0x26')],_0x1a620c['id']),util[_0x719d('0x29')](_0x3249a5,{'showHidden':![],'depth':null}));}return _0x22f62(null,_0x4bc513);})[_0x719d('0x2a')](function(_0x3ecae3){logger[_0x719d('0x27')](util[_0x719d('0x24')](_0x719d('0x28'),_0x1a620c[_0x719d('0x26')],_0x1a620c['id']),util[_0x719d('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0x22f62(_0x3ecae3);});}else{return _0x22f62(null,_0x4bc513);}},'beforeUpdate':function(_0x195041,_0x587a14,_0x5dce11){if(_0x195041[_0x719d('0xe')](_0x719d('0xf'))||_0x195041[_0x719d('0xe')](_0x719d('0x10'))||_0x195041['changed'](_0x719d('0x11'))||_0x195041[_0x719d('0xe')](_0x719d('0x12'))||_0x195041['changed'](_0x719d('0x13'))||_0x195041[_0x719d('0xe')](_0x719d('0x2b'))){var _0x957d15,_0x348f35;_0x957d15=_0x195041[_0x719d('0x10')];var _0x3debf8=_0x957d15['slice'](-0x1);if(_0x3debf8==='/'||_0x3debf8==='\x5c'||_0x3debf8===':'){_0x957d15=_0x957d15['substring'](0x0,_0x957d15[_0x719d('0x16')](_0x3debf8));}switch(_0x195041[_0x719d('0xf')]){case'US':_0x348f35=_0x719d('0x17');break;case'AU':_0x348f35=_0x719d('0x18');break;case'IN':_0x348f35='https://accounts.zoho.in';break;case'CN':_0x348f35=_0x719d('0x1a');break;default:_0x348f35=_0x719d('0x1b');break;}var _0x3bcb69={'method':_0x719d('0x2c'),'uri':_0x348f35+_0x719d('0x1c'),'form':{'grant_type':_0x719d('0x1d'),'client_id':_0x195041[_0x719d('0x11')],'client_secret':_0x195041[_0x719d('0x12')],'redirect_uri':_0x195041[_0x719d('0x10')],'code':_0x195041['code']},'headers':{'Content-Type':_0x719d('0x1e')}};return rp(_0x3bcb69)['then'](function(_0x4f9e48){var _0x24f681=JSON[_0x719d('0x20')](_0x4f9e48);if(_0x24f681['refresh_token']){_0x195041[_0x719d('0x22')]=_0x24f681['refresh_token'];logger[_0x719d('0x23')](util[_0x719d('0x24')](_0x719d('0x25'),_0x195041[_0x719d('0x26')],_0x195041['id']));}else{logger[_0x719d('0x27')](util[_0x719d('0x24')](_0x719d('0x28'),_0x195041[_0x719d('0x26')],_0x195041['id']),util['inspect'](_0x24f681,{'showHidden':![],'depth':null}));}return _0x5dce11(null,_0x587a14);})['catch'](function(_0x3fc2eb){logger['error'](util[_0x719d('0x24')](_0x719d('0x28'),_0x195041['name'],_0x195041['id']),util[_0x719d('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0x5dce11(_0x3fc2eb);});}else{return _0x5dce11(null,_0x587a14);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 987d897..cbf03e2 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 _0xa908=['info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','ZohoAccount,\x20%s,\x20%s','message','result','GetZohoAccount','findAll','options','raw','where','attributes','map','model','include','ShowZohoAccount','ZohoAccount','find','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then'];(function(_0x120123,_0x4eff59){var _0x3bec4c=function(_0x182818){while(--_0x182818){_0x120123['push'](_0x120123['shift']());}};_0x3bec4c(++_0x4eff59);}(_0xa908,0x1c3));var _0x8a90=function(_0x1e0de7,_0x28b328){_0x1e0de7=_0x1e0de7-0x0;var _0x212ce6=_0xa908[_0x1e0de7];return _0x212ce6;};'use strict';var _=require(_0x8a90('0x0'));var util=require('util');var moment=require(_0x8a90('0x1'));var BPromise=require('bluebird');var rs=require(_0x8a90('0x2'));var fs=require('fs');var Redis=require(_0x8a90('0x3'));var db=require(_0x8a90('0x4'))['db'];var utils=require(_0x8a90('0x5'));var logger=require(_0x8a90('0x6'))('rpc');var config=require(_0x8a90('0x7'));var jayson=require(_0x8a90('0x8'));var client=jayson['client'][_0x8a90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dc8f9,_0x12d376,_0x3faf88){return new BPromise(function(_0x20f8bf,_0x200f95){return client['request'](_0x1dc8f9,_0x3faf88)[_0x8a90('0xa')](function(_0x485401){logger[_0x8a90('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x12d376,_0x8a90('0xc'));logger[_0x8a90('0xd')](_0x8a90('0xe'),_0x12d376,_0x8a90('0xc'),JSON[_0x8a90('0xf')](_0x485401));if(_0x485401[_0x8a90('0x10')]){if(_0x485401[_0x8a90('0x10')]['code']===0x1f4){logger['error'](_0x8a90('0x11'),_0x12d376,_0x485401[_0x8a90('0x10')][_0x8a90('0x12')]);return _0x200f95(_0x485401['error'][_0x8a90('0x12')]);}logger[_0x8a90('0x10')](_0x8a90('0x11'),_0x12d376,_0x485401['error'][_0x8a90('0x12')]);return _0x20f8bf(_0x485401[_0x8a90('0x10')]['message']);}else{logger[_0x8a90('0xb')](_0x8a90('0x11'),_0x12d376,_0x8a90('0xc'));_0x20f8bf(_0x485401[_0x8a90('0x13')]['message']);}})['catch'](function(_0x14db82){logger[_0x8a90('0x10')](_0x8a90('0x11'),_0x12d376,_0x14db82);_0x200f95(_0x14db82);});});}exports[_0x8a90('0x14')]=function(_0x17ba83){var _0x2f8c34=this;return new Promise(function(_0x2808c2,_0x1cfce7){return db['ZohoAccount'][_0x8a90('0x15')]({'raw':_0x17ba83['options']?_0x17ba83[_0x8a90('0x16')][_0x8a90('0x17')]===undefined?!![]:![]:!![],'where':_0x17ba83[_0x8a90('0x16')]?_0x17ba83[_0x8a90('0x16')][_0x8a90('0x18')]||null:null,'attributes':_0x17ba83[_0x8a90('0x16')]?_0x17ba83['options'][_0x8a90('0x19')]||null:null,'limit':_0x17ba83[_0x8a90('0x16')]?_0x17ba83[_0x8a90('0x16')]['limit']||null:null,'include':_0x17ba83[_0x8a90('0x16')]?_0x17ba83[_0x8a90('0x16')]['include']?_[_0x8a90('0x1a')](_0x17ba83[_0x8a90('0x16')]['include'],function(_0x457c46){return{'model':db[_0x457c46[_0x8a90('0x1b')]],'as':_0x457c46['as'],'attributes':_0x457c46[_0x8a90('0x19')],'include':_0x457c46[_0x8a90('0x1c')]?_['map'](_0x457c46['include'],function(_0x22fd3f){return{'model':db[_0x22fd3f[_0x8a90('0x1b')]],'as':_0x22fd3f['as'],'attributes':_0x22fd3f[_0x8a90('0x19')],'include':_0x22fd3f[_0x8a90('0x1c')]?_[_0x8a90('0x1a')](_0x22fd3f['include'],function(_0x16a228){return{'model':db[_0x16a228[_0x8a90('0x1b')]],'as':_0x16a228['as'],'attributes':_0x16a228[_0x8a90('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8a90('0xa')](function(_0x5a8639){logger[_0x8a90('0xb')]('GetZohoAccount',_0x17ba83);logger[_0x8a90('0xd')](_0x8a90('0x14'),_0x17ba83,JSON[_0x8a90('0xf')](_0x5a8639));_0x2808c2(_0x5a8639);})['catch'](function(_0x17aafd){logger[_0x8a90('0x10')](_0x8a90('0x14'),_0x17aafd['message'],_0x17ba83);_0x1cfce7(_0x2f8c34[_0x8a90('0x10')](0x1f4,_0x17aafd[_0x8a90('0x12')]));});});};exports[_0x8a90('0x1d')]=function(_0x153154){var _0x2bfb1c=this;return new Promise(function(_0xd3db18,_0x5c0c05){return db[_0x8a90('0x1e')][_0x8a90('0x1f')]({'raw':_0x153154['options']?_0x153154['options']['raw']===undefined?!![]:![]:!![],'where':_0x153154[_0x8a90('0x16')]?_0x153154[_0x8a90('0x16')][_0x8a90('0x18')]||null:null,'attributes':_0x153154[_0x8a90('0x16')]?_0x153154[_0x8a90('0x16')]['attributes']||null:null,'include':_0x153154[_0x8a90('0x16')]?_0x153154[_0x8a90('0x16')][_0x8a90('0x1c')]?_[_0x8a90('0x1a')](_0x153154['options']['include'],function(_0x262bba){return{'model':db[_0x262bba['model']],'as':_0x262bba['as'],'attributes':_0x262bba[_0x8a90('0x19')],'include':_0x262bba[_0x8a90('0x1c')]?_['map'](_0x262bba[_0x8a90('0x1c')],function(_0x5a3f04){return{'model':db[_0x5a3f04[_0x8a90('0x1b')]],'as':_0x5a3f04['as'],'attributes':_0x5a3f04['attributes'],'include':_0x5a3f04[_0x8a90('0x1c')]?_[_0x8a90('0x1a')](_0x5a3f04[_0x8a90('0x1c')],function(_0xaa2980){return{'model':db[_0xaa2980[_0x8a90('0x1b')]],'as':_0xaa2980['as'],'attributes':_0xaa2980[_0x8a90('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8a90('0xa')](function(_0x95485a){logger[_0x8a90('0xb')](_0x8a90('0x1d'),_0x153154);logger[_0x8a90('0xd')]('ShowZohoAccount',_0x153154,JSON[_0x8a90('0xf')](_0x95485a));_0xd3db18(_0x95485a);})[_0x8a90('0x20')](function(_0x2a025f){logger[_0x8a90('0x10')](_0x8a90('0x1d'),_0x2a025f['message'],_0x153154);_0x5c0c05(_0x2bfb1c[_0x8a90('0x10')](0x1f4,_0x2a025f[_0x8a90('0x12')]));});});}; \ No newline at end of file +var _0x583c=['raw','where','attributes','limit','map','include','model','debug','stringify','catch','ShowZohoAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetZohoAccount','ZohoAccount','options'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0x583c,0x12b));var _0xc583=function(_0x2e819c,_0x3f99a5){_0x2e819c=_0x2e819c-0x0;var _0x24e271=_0x583c[_0x2e819c];return _0x24e271;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var moment=require(_0xc583('0x2'));var BPromise=require(_0xc583('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc583('0x4'));var db=require(_0xc583('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc583('0x6'));var config=require(_0xc583('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc583('0x8')][_0xc583('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2719df,_0x1dd37c,_0x48a8d4){return new BPromise(function(_0x21ed88,_0x26cec0){return client['request'](_0x2719df,_0x48a8d4)[_0xc583('0xa')](function(_0x24ab4f){logger[_0xc583('0xb')](_0xc583('0xc'),_0x1dd37c,_0xc583('0xd'));logger['debug'](_0xc583('0xe'),_0x1dd37c,_0xc583('0xd'),JSON['stringify'](_0x24ab4f));if(_0x24ab4f[_0xc583('0xf')]){if(_0x24ab4f[_0xc583('0xf')]['code']===0x1f4){logger[_0xc583('0xf')](_0xc583('0xc'),_0x1dd37c,_0x24ab4f[_0xc583('0xf')][_0xc583('0x10')]);return _0x26cec0(_0x24ab4f[_0xc583('0xf')][_0xc583('0x10')]);}logger[_0xc583('0xf')](_0xc583('0xc'),_0x1dd37c,_0x24ab4f[_0xc583('0xf')]['message']);return _0x21ed88(_0x24ab4f[_0xc583('0xf')]['message']);}else{logger[_0xc583('0xb')](_0xc583('0xc'),_0x1dd37c,'request\x20sent');_0x21ed88(_0x24ab4f[_0xc583('0x11')][_0xc583('0x10')]);}})['catch'](function(_0x7d1690){logger[_0xc583('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x1dd37c,_0x7d1690);_0x26cec0(_0x7d1690);});});}exports[_0xc583('0x12')]=function(_0x8a2d84){var _0x12aac2=this;return new Promise(function(_0x36e0fd,_0x5433ec){return db[_0xc583('0x13')]['findAll']({'raw':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84[_0xc583('0x14')][_0xc583('0x15')]===undefined?!![]:![]:!![],'where':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84[_0xc583('0x14')][_0xc583('0x16')]||null:null,'attributes':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84[_0xc583('0x14')][_0xc583('0x17')]||null:null,'limit':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84[_0xc583('0x14')][_0xc583('0x18')]||null:null,'include':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84['options']['include']?_[_0xc583('0x19')](_0x8a2d84[_0xc583('0x14')][_0xc583('0x1a')],function(_0x5ceef1){return{'model':db[_0x5ceef1[_0xc583('0x1b')]],'as':_0x5ceef1['as'],'attributes':_0x5ceef1[_0xc583('0x17')],'include':_0x5ceef1[_0xc583('0x1a')]?_[_0xc583('0x19')](_0x5ceef1[_0xc583('0x1a')],function(_0x48c95e){return{'model':db[_0x48c95e['model']],'as':_0x48c95e['as'],'attributes':_0x48c95e[_0xc583('0x17')],'include':_0x48c95e['include']?_[_0xc583('0x19')](_0x48c95e[_0xc583('0x1a')],function(_0xbabf24){return{'model':db[_0xbabf24[_0xc583('0x1b')]],'as':_0xbabf24['as'],'attributes':_0xbabf24[_0xc583('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2dafb4){logger[_0xc583('0xb')]('GetZohoAccount',_0x8a2d84);logger[_0xc583('0x1c')]('GetZohoAccount',_0x8a2d84,JSON[_0xc583('0x1d')](_0x2dafb4));_0x36e0fd(_0x2dafb4);})[_0xc583('0x1e')](function(_0x1c80b1){logger[_0xc583('0xf')](_0xc583('0x12'),_0x1c80b1[_0xc583('0x10')],_0x8a2d84);_0x5433ec(_0x12aac2[_0xc583('0xf')](0x1f4,_0x1c80b1['message']));});});};exports[_0xc583('0x1f')]=function(_0x390bc3){var _0x23f3a4=this;return new Promise(function(_0xcbf1f1,_0x1dd665){return db[_0xc583('0x13')]['find']({'raw':_0x390bc3[_0xc583('0x14')]?_0x390bc3['options']['raw']===undefined?!![]:![]:!![],'where':_0x390bc3[_0xc583('0x14')]?_0x390bc3[_0xc583('0x14')][_0xc583('0x16')]||null:null,'attributes':_0x390bc3[_0xc583('0x14')]?_0x390bc3[_0xc583('0x14')]['attributes']||null:null,'include':_0x390bc3[_0xc583('0x14')]?_0x390bc3[_0xc583('0x14')][_0xc583('0x1a')]?_['map'](_0x390bc3[_0xc583('0x14')]['include'],function(_0x1aa62a){return{'model':db[_0x1aa62a[_0xc583('0x1b')]],'as':_0x1aa62a['as'],'attributes':_0x1aa62a[_0xc583('0x17')],'include':_0x1aa62a[_0xc583('0x1a')]?_[_0xc583('0x19')](_0x1aa62a['include'],function(_0x242728){return{'model':db[_0x242728['model']],'as':_0x242728['as'],'attributes':_0x242728[_0xc583('0x17')],'include':_0x242728['include']?_[_0xc583('0x19')](_0x242728[_0xc583('0x1a')],function(_0x7d89d0){return{'model':db[_0x7d89d0[_0xc583('0x1b')]],'as':_0x7d89d0['as'],'attributes':_0x7d89d0[_0xc583('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc583('0xa')](function(_0x54200c){logger['info'](_0xc583('0x1f'),_0x390bc3);logger[_0xc583('0x1c')]('ShowZohoAccount',_0x390bc3,JSON[_0xc583('0x1d')](_0x54200c));_0xcbf1f1(_0x54200c);})[_0xc583('0x1e')](function(_0x22de5a){logger[_0xc583('0xf')](_0xc583('0x1f'),_0x22de5a[_0xc583('0x10')],_0x390bc3);_0x1dd665(_0x23f3a4['error'](0x1f4,_0x22de5a[_0xc583('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index bd973dc..eaf75df 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 _0xb32f=['index','show','/:id/fields','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','update','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get'];(function(_0x587445,_0x37dfb6){var _0x27fb18=function(_0x1bceac){while(--_0x1bceac){_0x587445['push'](_0x587445['shift']());}};_0x27fb18(++_0x37dfb6);}(_0xb32f,0x81));var _0xfb32=function(_0x435364,_0x507dae){_0x435364=_0x435364-0x0;var _0x457fd9=_0xb32f[_0x435364];return _0x457fd9;};'use strict';var multer=require(_0xfb32('0x0'));var util=require('util');var path=require(_0xfb32('0x1'));var timeout=require(_0xfb32('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfb32('0x3'));var auth=require(_0xfb32('0x4'));var interaction=require(_0xfb32('0x5'));var config=require(_0xfb32('0x6'));var controller=require(_0xfb32('0x7'));router[_0xfb32('0x8')]('/',auth['isAuthenticated'](),controller[_0xfb32('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xfb32('0xa')]);router[_0xfb32('0x8')](_0xfb32('0xb'),auth['isAuthenticated'](),controller[_0xfb32('0xc')]);router[_0xfb32('0x8')](_0xfb32('0xd'),auth[_0xfb32('0xe')](),controller[_0xfb32('0xf')]);router[_0xfb32('0x8')](_0xfb32('0x10'),auth[_0xfb32('0xe')](),controller[_0xfb32('0x11')]);router[_0xfb32('0x12')]('/',auth['isAuthenticated'](),controller[_0xfb32('0x13')]);router['put'](_0xfb32('0x14'),auth['isAuthenticated'](),controller[_0xfb32('0x15')]);router['delete'](_0xfb32('0x14'),auth[_0xfb32('0xe')](),controller['destroy']);module[_0xfb32('0x16')]=router; \ No newline at end of file +var _0x3976=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','get','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3b27d1,_0x4d1890){var _0xba7b32=function(_0x29c743){while(--_0x29c743){_0x3b27d1['push'](_0x3b27d1['shift']());}};_0xba7b32(++_0x4d1890);}(_0x3976,0x103));var _0x6397=function(_0x2b1eaa,_0x44fd05){_0x2b1eaa=_0x2b1eaa-0x0;var _0x3c2433=_0x3976[_0x2b1eaa];return _0x3c2433;};'use strict';var multer=require(_0x6397('0x0'));var util=require(_0x6397('0x1'));var path=require(_0x6397('0x2'));var timeout=require(_0x6397('0x3'));var express=require(_0x6397('0x4'));var router=express[_0x6397('0x5')]();var fs_extra=require(_0x6397('0x6'));var auth=require(_0x6397('0x7'));var interaction=require(_0x6397('0x8'));var config=require(_0x6397('0x9'));var controller=require(_0x6397('0xa'));router['get']('/',auth[_0x6397('0xb')](),controller['index']);router[_0x6397('0xc')]('/:id',auth[_0x6397('0xb')](),controller[_0x6397('0xd')]);router[_0x6397('0xc')]('/:id/fields',auth[_0x6397('0xb')](),controller[_0x6397('0xe')]);router[_0x6397('0xc')](_0x6397('0xf'),auth['isAuthenticated'](),controller[_0x6397('0x10')]);router[_0x6397('0xc')](_0x6397('0x11'),auth['isAuthenticated'](),controller[_0x6397('0x12')]);router[_0x6397('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6397('0x14')]('/:id',auth[_0x6397('0xb')](),controller['update']);router[_0x6397('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x6397('0x16')]);module[_0x6397('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index b65998b..5c67bd0 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 _0x5b84=['nothing','contact_lead','exports','STRING','ENUM','contact'];(function(_0x19b272,_0x5975bc){var _0x2fe8de=function(_0x10b7cb){while(--_0x10b7cb){_0x19b272['push'](_0x19b272['shift']());}};_0x2fe8de(++_0x5975bc);}(_0x5b84,0x1ac));var _0x45b8=function(_0xe82bb6,_0x17aff4){_0xe82bb6=_0xe82bb6-0x0;var _0x5c3e85=_0x5b84[_0xe82bb6];return _0x5c3e85;};'use strict';var Sequelize=require('sequelize');module[_0x45b8('0x0')]={'name':{'type':Sequelize[_0x45b8('0x1')]},'moduleCreate':{'type':Sequelize[_0x45b8('0x2')]('lead',_0x45b8('0x3'),_0x45b8('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x45b8('0x2')](_0x45b8('0x5'),_0x45b8('0x3'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x45b8('0x1')]}}; \ No newline at end of file +var _0xafb4=['sequelize','exports','ENUM','lead','contact','nothing','contact_lead','STRING'];(function(_0x4e2cae,_0x28b0f7){var _0x23b147=function(_0x5db252){while(--_0x5db252){_0x4e2cae['push'](_0x4e2cae['shift']());}};_0x23b147(++_0x28b0f7);}(_0xafb4,0x78));var _0x4afb=function(_0x499007,_0x419d2c){_0x499007=_0x499007-0x0;var _0x15f9ea=_0xafb4[_0x499007];return _0x15f9ea;};'use strict';var Sequelize=require(_0x4afb('0x0'));module[_0x4afb('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x4afb('0x2')](_0x4afb('0x3'),_0x4afb('0x4'),_0x4afb('0x5')),'defaultValue':_0x4afb('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x4afb('0x6'),_0x4afb('0x4'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x4afb('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 9f1d6bc..a906779 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 _0x55f7=['getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','getFields','findOne','ZohoField','order','pick'];(function(_0x10bae6,_0x41d85f){var _0x251123=function(_0x548886){while(--_0x548886){_0x10bae6['push'](_0x10bae6['shift']());}};_0x251123(++_0x41d85f);}(_0x55f7,0x1f4));var _0x755f=function(_0x5acaa9,_0x285a70){_0x5acaa9=_0x5acaa9-0x0;var _0x2739b3=_0x55f7[_0x5acaa9];return _0x2739b3;};'use strict';var emlformat=require(_0x755f('0x0'));var rimraf=require(_0x755f('0x1'));var zipdir=require(_0x755f('0x2'));var jsonpatch=require(_0x755f('0x3'));var rp=require('request-promise');var moment=require(_0x755f('0x4'));var BPromise=require(_0x755f('0x5'));var Mustache=require(_0x755f('0x6'));var util=require(_0x755f('0x7'));var path=require(_0x755f('0x8'));var sox=require(_0x755f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x755f('0xa'));var _=require('lodash');var squel=require(_0x755f('0xb'));var crypto=require(_0x755f('0xc'));var jsforce=require(_0x755f('0xd'));var deskjs=require(_0x755f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x755f('0xf'));var Papa=require(_0x755f('0x10'));var Redis=require('ioredis');var authService=require(_0x755f('0x11'));var qs=require(_0x755f('0x12'));var as=require(_0x755f('0x13'));var hardwareService=require(_0x755f('0x14'));var logger=require('../../config/logger')(_0x755f('0x15'));var utils=require(_0x755f('0x16'));var config=require(_0x755f('0x17'));var licenseUtil=require(_0x755f('0x18'));var db=require(_0x755f('0x19'))['db'];function respondWithStatusCode(_0x2a7fa5,_0x54137b){_0x54137b=_0x54137b||0xcc;return function(_0x2a98e8){if(_0x2a98e8){return _0x2a7fa5[_0x755f('0x1a')](_0x54137b);}return _0x2a7fa5['status'](_0x54137b)['end']();};}function respondWithResult(_0x2d400f,_0x39b640){_0x39b640=_0x39b640||0xc8;return function(_0x1dac00){if(_0x1dac00){return _0x2d400f['status'](_0x39b640)[_0x755f('0x1b')](_0x1dac00);}};}function respondWithFilteredResult(_0x36ea41,_0x545374){return function(_0x1bfaa7){if(_0x1bfaa7){var _0x232d57=typeof _0x545374[_0x755f('0x1c')]===_0x755f('0x1d')&&typeof _0x545374[_0x755f('0x1e')]==='undefined';var _0x579f8e=_0x1bfaa7[_0x755f('0x1f')];var _0x5a7f29=_0x232d57?0x0:_0x545374[_0x755f('0x1c')];var _0x48fb05=_0x232d57?_0x1bfaa7['count']:_0x545374[_0x755f('0x1c')]+_0x545374[_0x755f('0x1e')];var _0x3a1e17;if(_0x48fb05>=_0x579f8e){_0x48fb05=_0x579f8e;_0x3a1e17=0xc8;}else{_0x3a1e17=0xce;}_0x36ea41[_0x755f('0x20')](_0x3a1e17);return _0x36ea41['set'](_0x755f('0x21'),_0x5a7f29+'-'+_0x48fb05+'/'+_0x579f8e)[_0x755f('0x1b')](_0x1bfaa7);}return null;};}function patchUpdates(_0x2ded96){return function(_0x2cb2f0){try{jsonpatch[_0x755f('0x22')](_0x2cb2f0,_0x2ded96,!![]);}catch(_0x552737){return BPromise[_0x755f('0x23')](_0x552737);}return _0x2cb2f0[_0x755f('0x24')]();};}function saveUpdates(_0x5e2785,_0x176197){return function(_0x49bea8){if(_0x49bea8){return _0x49bea8[_0x755f('0x25')](_0x5e2785)[_0x755f('0x26')](function(_0x3de591){return _0x3de591;});}return null;};}function removeEntity(_0x13af36,_0x381e19){return function(_0x4325ca){if(_0x4325ca){return _0x4325ca[_0x755f('0x27')]()[_0x755f('0x26')](function(){_0x13af36[_0x755f('0x20')](0xcc)[_0x755f('0x28')]();});}};}function handleEntityNotFound(_0x45b295,_0x28d02d){return function(_0x589d2f){if(!_0x589d2f){_0x45b295[_0x755f('0x1a')](0x194);}return _0x589d2f;};}function handleError(_0x48dfb0,_0x16cb62){_0x16cb62=_0x16cb62||0x1f4;return function(_0x30e168){logger[_0x755f('0x29')](_0x30e168[_0x755f('0x2a')]);if(_0x30e168[_0x755f('0x2b')]){delete _0x30e168[_0x755f('0x2b')];}_0x48dfb0['status'](_0x16cb62)[_0x755f('0x2c')](_0x30e168);};}exports['index']=function(_0x3f4567,_0x265a1b){var _0x21bf0e={},_0x2f920b={},_0x5c2994={'count':0x0,'rows':[]};var _0x2c8c08=_[_0x755f('0x2d')](db[_0x755f('0x2e')][_0x755f('0x2f')],function(_0x2a6a31){return{'name':_0x2a6a31[_0x755f('0x30')],'type':_0x2a6a31['type']['key']};});_0x2f920b['model']=_['map'](_0x2c8c08,_0x755f('0x2b'));_0x2f920b['query']=_[_0x755f('0x31')](_0x3f4567['query']);_0x2f920b[_0x755f('0x32')]=_[_0x755f('0x33')](_0x2f920b[_0x755f('0x34')],_0x2f920b[_0x755f('0x35')]);_0x21bf0e[_0x755f('0x36')]=_['intersection'](_0x2f920b[_0x755f('0x34')],qs[_0x755f('0x37')](_0x3f4567['query']['fields']));_0x21bf0e[_0x755f('0x36')]=_0x21bf0e[_0x755f('0x36')][_0x755f('0x38')]?_0x21bf0e['attributes']:_0x2f920b[_0x755f('0x34')];if(!_0x3f4567[_0x755f('0x35')][_0x755f('0x39')](_0x755f('0x3a'))){_0x21bf0e[_0x755f('0x1e')]=qs[_0x755f('0x1e')](_0x3f4567[_0x755f('0x35')][_0x755f('0x1e')]);_0x21bf0e[_0x755f('0x1c')]=qs[_0x755f('0x1c')](_0x3f4567[_0x755f('0x35')][_0x755f('0x1c')]);}_0x21bf0e['order']=qs[_0x755f('0x3b')](_0x3f4567[_0x755f('0x35')][_0x755f('0x3b')]);_0x21bf0e['where']=qs[_0x755f('0x32')](_['pick'](_0x3f4567[_0x755f('0x35')],_0x2f920b[_0x755f('0x32')]),_0x2c8c08);if(_0x3f4567[_0x755f('0x35')][_0x755f('0x3c')]){_0x21bf0e[_0x755f('0x3d')]=_[_0x755f('0x3e')](_0x21bf0e[_0x755f('0x3d')],{'$or':_['map'](_0x2c8c08,function(_0x10cce5){if(_0x10cce5[_0x755f('0x3f')]!==_0x755f('0x40')){var _0x29b925={};_0x29b925[_0x10cce5[_0x755f('0x2b')]]={'$like':'%'+_0x3f4567[_0x755f('0x35')][_0x755f('0x3c')]+'%'};return _0x29b925;}})});}_0x21bf0e=_[_0x755f('0x3e')]({},_0x21bf0e,_0x3f4567['options']);var _0x1415cb={'where':_0x21bf0e['where']};return db['ZohoConfiguration'][_0x755f('0x1f')](_0x1415cb)[_0x755f('0x26')](function(_0x17470b){_0x5c2994[_0x755f('0x1f')]=_0x17470b;if(_0x3f4567[_0x755f('0x35')]['includeAll']){_0x21bf0e[_0x755f('0x41')]=[{'all':!![]}];}return db[_0x755f('0x2e')][_0x755f('0x42')](_0x21bf0e);})['then'](function(_0xbebca4){_0x5c2994[_0x755f('0x43')]=_0xbebca4;return _0x5c2994;})[_0x755f('0x26')](respondWithFilteredResult(_0x265a1b,_0x21bf0e))[_0x755f('0x44')](handleError(_0x265a1b,null));};exports[_0x755f('0x45')]=function(_0x48cab5,_0x3e83ba){var _0x1a87d2={'raw':![],'where':{'id':_0x48cab5[_0x755f('0x46')]['id']}},_0x52b7cb={};_0x52b7cb[_0x755f('0x34')]=_[_0x755f('0x31')](db[_0x755f('0x2e')][_0x755f('0x2f')]);_0x52b7cb[_0x755f('0x35')]=_[_0x755f('0x31')](_0x48cab5[_0x755f('0x35')]);_0x52b7cb[_0x755f('0x32')]=_[_0x755f('0x33')](_0x52b7cb[_0x755f('0x34')],_0x52b7cb[_0x755f('0x35')]);_0x1a87d2['attributes']=_[_0x755f('0x33')](_0x52b7cb[_0x755f('0x34')],qs['fields'](_0x48cab5[_0x755f('0x35')][_0x755f('0x37')]));_0x1a87d2[_0x755f('0x36')]=_0x1a87d2[_0x755f('0x36')][_0x755f('0x38')]?_0x1a87d2['attributes']:_0x52b7cb[_0x755f('0x34')];if(_0x48cab5[_0x755f('0x35')][_0x755f('0x47')]){_0x1a87d2[_0x755f('0x41')]=[{'all':!![]}];}_0x1a87d2=_['merge']({},_0x1a87d2,_0x48cab5[_0x755f('0x48')]);return db[_0x755f('0x2e')][_0x755f('0x49')](_0x1a87d2)[_0x755f('0x26')](handleEntityNotFound(_0x3e83ba,null))[_0x755f('0x26')](respondWithResult(_0x3e83ba,null))[_0x755f('0x44')](handleError(_0x3e83ba,null));};exports[_0x755f('0x4a')]=function(_0x1b7666,_0x4acaad){return db[_0x755f('0x2e')][_0x755f('0x4a')](_0x1b7666[_0x755f('0x4b')],{})[_0x755f('0x26')](respondWithResult(_0x4acaad,0xc9))[_0x755f('0x44')](handleError(_0x4acaad,null));};exports[_0x755f('0x25')]=function(_0x513775,_0x116e59){if(_0x513775['body']['id']){delete _0x513775[_0x755f('0x4b')]['id'];}return db[_0x755f('0x2e')][_0x755f('0x49')]({'where':{'id':_0x513775[_0x755f('0x46')]['id']}})[_0x755f('0x26')](handleEntityNotFound(_0x116e59,null))[_0x755f('0x26')](saveUpdates(_0x513775[_0x755f('0x4b')],null))[_0x755f('0x26')](respondWithResult(_0x116e59,null))['catch'](handleError(_0x116e59,null));};exports[_0x755f('0x27')]=function(_0x4b2074,_0x5263f2){return db[_0x755f('0x2e')][_0x755f('0x49')]({'where':{'id':_0x4b2074[_0x755f('0x46')]['id']}})[_0x755f('0x26')](handleEntityNotFound(_0x5263f2,null))[_0x755f('0x26')](removeEntity(_0x5263f2,null))[_0x755f('0x44')](handleError(_0x5263f2,null));};exports[_0x755f('0x4c')]=function(_0x4f2a56,_0x624b37,_0x187570){var _0x4de711={};var _0x50a56f={};var _0x59fb7a;var _0x480d7f;return db[_0x755f('0x2e')][_0x755f('0x4d')]({'where':{'id':_0x4f2a56[_0x755f('0x46')]['id']}})[_0x755f('0x26')](handleEntityNotFound(_0x624b37,null))[_0x755f('0x26')](function(_0x9283a1){if(_0x9283a1){_0x59fb7a=_0x9283a1;_0x50a56f[_0x755f('0x34')]=_['keys'](db[_0x755f('0x4e')][_0x755f('0x2f')]);_0x50a56f[_0x755f('0x35')]=_['keys'](_0x4f2a56[_0x755f('0x35')]);_0x50a56f[_0x755f('0x32')]=_[_0x755f('0x33')](_0x50a56f[_0x755f('0x34')],_0x50a56f[_0x755f('0x35')]);_0x4de711['attributes']=_[_0x755f('0x33')](_0x50a56f[_0x755f('0x34')],qs['fields'](_0x4f2a56[_0x755f('0x35')]['fields']));_0x4de711[_0x755f('0x36')]=_0x4de711[_0x755f('0x36')][_0x755f('0x38')]?_0x4de711[_0x755f('0x36')]:_0x50a56f[_0x755f('0x34')];_0x4de711[_0x755f('0x4f')]=qs[_0x755f('0x3b')](_0x4f2a56[_0x755f('0x35')][_0x755f('0x3b')]);_0x4de711['where']=qs[_0x755f('0x32')](_[_0x755f('0x50')](_0x4f2a56[_0x755f('0x35')],_0x50a56f[_0x755f('0x32')]));if(_0x4f2a56[_0x755f('0x35')][_0x755f('0x3c')]){_0x4de711[_0x755f('0x3d')]=_['merge'](_0x4de711[_0x755f('0x3d')],{'$or':_[_0x755f('0x2d')](_0x4de711['attributes'],function(_0x28498e){var _0xa9943f={};_0xa9943f[_0x28498e]={'$like':'%'+_0x4f2a56[_0x755f('0x35')][_0x755f('0x3c')]+'%'};return _0xa9943f;})});}_0x4de711=_['merge']({},_0x4de711,_0x4f2a56[_0x755f('0x48')]);return _0x59fb7a[_0x755f('0x4c')](_0x4de711);}})[_0x755f('0x26')](function(_0x450950){if(_0x450950){_0x480d7f=_0x450950[_0x755f('0x38')];if(!_0x4f2a56[_0x755f('0x35')][_0x755f('0x39')](_0x755f('0x3a'))){_0x4de711[_0x755f('0x1e')]=qs['limit'](_0x4f2a56[_0x755f('0x35')]['limit']);_0x4de711[_0x755f('0x1c')]=qs[_0x755f('0x1c')](_0x4f2a56['query'][_0x755f('0x1c')]);}return _0x59fb7a[_0x755f('0x4c')](_0x4de711);}})['then'](function(_0x4f5996){if(_0x4f5996){return _0x4f5996?{'count':_0x480d7f,'rows':_0x4f5996}:null;}})[_0x755f('0x26')](respondWithResult(_0x624b37,null))['catch'](handleError(_0x624b37,null));};exports[_0x755f('0x51')]=function(_0x95a644,_0x19cd51,_0x368880){var _0x3441be={};var _0x1334db={};var _0x1e3ec8;var _0x515387;return db[_0x755f('0x2e')][_0x755f('0x4d')]({'where':{'id':_0x95a644[_0x755f('0x46')]['id']}})['then'](handleEntityNotFound(_0x19cd51,null))[_0x755f('0x26')](function(_0x1a6cd1){if(_0x1a6cd1){_0x1e3ec8=_0x1a6cd1;_0x1334db['model']=_[_0x755f('0x31')](db[_0x755f('0x4e')][_0x755f('0x2f')]);_0x1334db['query']=_[_0x755f('0x31')](_0x95a644[_0x755f('0x35')]);_0x1334db[_0x755f('0x32')]=_[_0x755f('0x33')](_0x1334db['model'],_0x1334db['query']);_0x3441be['attributes']=_[_0x755f('0x33')](_0x1334db[_0x755f('0x34')],qs[_0x755f('0x37')](_0x95a644[_0x755f('0x35')]['fields']));_0x3441be[_0x755f('0x36')]=_0x3441be[_0x755f('0x36')]['length']?_0x3441be[_0x755f('0x36')]:_0x1334db[_0x755f('0x34')];_0x3441be['order']=qs[_0x755f('0x3b')](_0x95a644[_0x755f('0x35')][_0x755f('0x3b')]);_0x3441be[_0x755f('0x3d')]=qs[_0x755f('0x32')](_[_0x755f('0x50')](_0x95a644[_0x755f('0x35')],_0x1334db[_0x755f('0x32')]));if(_0x95a644[_0x755f('0x35')][_0x755f('0x3c')]){_0x3441be['where']=_[_0x755f('0x3e')](_0x3441be[_0x755f('0x3d')],{'$or':_[_0x755f('0x2d')](_0x3441be[_0x755f('0x36')],function(_0x49b788){var _0x5af94c={};_0x5af94c[_0x49b788]={'$like':'%'+_0x95a644[_0x755f('0x35')]['filter']+'%'};return _0x5af94c;})});}_0x3441be=_['merge']({},_0x3441be,_0x95a644[_0x755f('0x48')]);return _0x1e3ec8[_0x755f('0x51')](_0x3441be);}})[_0x755f('0x26')](function(_0x1329c6){if(_0x1329c6){_0x515387=_0x1329c6[_0x755f('0x38')];if(!_0x95a644['query'][_0x755f('0x39')](_0x755f('0x3a'))){_0x3441be[_0x755f('0x1e')]=qs[_0x755f('0x1e')](_0x95a644[_0x755f('0x35')][_0x755f('0x1e')]);_0x3441be['offset']=qs[_0x755f('0x1c')](_0x95a644['query'][_0x755f('0x1c')]);}return _0x1e3ec8[_0x755f('0x51')](_0x3441be);}})['then'](function(_0x3037d8){if(_0x3037d8){return _0x3037d8?{'count':_0x515387,'rows':_0x3037d8}:null;}})[_0x755f('0x26')](respondWithResult(_0x19cd51,null))[_0x755f('0x44')](handleError(_0x19cd51,null));};exports[_0x755f('0x52')]=function(_0x496130,_0x4fb73d,_0x440dc7){var _0x5a399c={};var _0x5d75f0={};var _0x2c03c8;var _0x47ec9c;return db['ZohoConfiguration'][_0x755f('0x4d')]({'where':{'id':_0x496130['params']['id']}})[_0x755f('0x26')](handleEntityNotFound(_0x4fb73d,null))[_0x755f('0x26')](function(_0x3b2c0d){if(_0x3b2c0d){_0x2c03c8=_0x3b2c0d;_0x5d75f0[_0x755f('0x34')]=_[_0x755f('0x31')](db[_0x755f('0x4e')][_0x755f('0x2f')]);_0x5d75f0[_0x755f('0x35')]=_[_0x755f('0x31')](_0x496130['query']);_0x5d75f0[_0x755f('0x32')]=_[_0x755f('0x33')](_0x5d75f0[_0x755f('0x34')],_0x5d75f0[_0x755f('0x35')]);_0x5a399c['attributes']=_[_0x755f('0x33')](_0x5d75f0[_0x755f('0x34')],qs[_0x755f('0x37')](_0x496130[_0x755f('0x35')][_0x755f('0x37')]));_0x5a399c[_0x755f('0x36')]=_0x5a399c['attributes'][_0x755f('0x38')]?_0x5a399c[_0x755f('0x36')]:_0x5d75f0[_0x755f('0x34')];_0x5a399c[_0x755f('0x4f')]=qs[_0x755f('0x3b')](_0x496130[_0x755f('0x35')][_0x755f('0x3b')]);_0x5a399c['where']=qs['filters'](_[_0x755f('0x50')](_0x496130[_0x755f('0x35')],_0x5d75f0[_0x755f('0x32')]));if(_0x496130[_0x755f('0x35')][_0x755f('0x3c')]){_0x5a399c[_0x755f('0x3d')]=_['merge'](_0x5a399c['where'],{'$or':_['map'](_0x5a399c[_0x755f('0x36')],function(_0x1eaa45){var _0x2cdc5d={};_0x2cdc5d[_0x1eaa45]={'$like':'%'+_0x496130[_0x755f('0x35')][_0x755f('0x3c')]+'%'};return _0x2cdc5d;})});}_0x5a399c=_['merge']({},_0x5a399c,_0x496130[_0x755f('0x48')]);return _0x2c03c8[_0x755f('0x52')](_0x5a399c);}})['then'](function(_0x79f743){if(_0x79f743){_0x47ec9c=_0x79f743[_0x755f('0x38')];if(!_0x496130[_0x755f('0x35')][_0x755f('0x39')](_0x755f('0x3a'))){_0x5a399c['limit']=qs[_0x755f('0x1e')](_0x496130[_0x755f('0x35')][_0x755f('0x1e')]);_0x5a399c[_0x755f('0x1c')]=qs[_0x755f('0x1c')](_0x496130[_0x755f('0x35')][_0x755f('0x1c')]);}return _0x2c03c8[_0x755f('0x52')](_0x5a399c);}})[_0x755f('0x26')](function(_0x3695b8){if(_0x3695b8){return _0x3695b8?{'count':_0x47ec9c,'rows':_0x3695b8}:null;}})['then'](respondWithResult(_0x4fb73d,null))[_0x755f('0x44')](handleError(_0x4fb73d,null));}; \ No newline at end of file +var _0x7547=['sendStatus','error','stack','name','send','index','ZohoConfiguration','rawAttributes','fieldName','type','key','map','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','create','body','getFields','findOne','ZohoField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy'];(function(_0x149ca0,_0x2ac7f5){var _0x56b6b9=function(_0x486ac3){while(--_0x486ac3){_0x149ca0['push'](_0x149ca0['shift']());}};_0x56b6b9(++_0x2ac7f5);}(_0x7547,0x1c6));var _0x7754=function(_0x51868d,_0x2d0a9e){_0x51868d=_0x51868d-0x0;var _0x21e310=_0x7547[_0x51868d];return _0x21e310;};'use strict';var emlformat=require(_0x7754('0x0'));var rimraf=require(_0x7754('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7754('0x2'));var rp=require(_0x7754('0x3'));var moment=require(_0x7754('0x4'));var BPromise=require(_0x7754('0x5'));var Mustache=require(_0x7754('0x6'));var util=require(_0x7754('0x7'));var path=require('path');var sox=require(_0x7754('0x8'));var csv=require(_0x7754('0x9'));var ejs=require(_0x7754('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7754('0xb'));var crypto=require(_0x7754('0xc'));var jsforce=require(_0x7754('0xd'));var deskjs=require(_0x7754('0xe'));var toCsv=require(_0x7754('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7754('0xf'));var authService=require(_0x7754('0x10'));var qs=require(_0x7754('0x11'));var as=require(_0x7754('0x12'));var hardwareService=require(_0x7754('0x13'));var logger=require(_0x7754('0x14'))(_0x7754('0x15'));var utils=require(_0x7754('0x16'));var config=require(_0x7754('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c2f3b,_0xd0a2ac){_0xd0a2ac=_0xd0a2ac||0xcc;return function(_0x136ea2){if(_0x136ea2){return _0x1c2f3b['sendStatus'](_0xd0a2ac);}return _0x1c2f3b[_0x7754('0x18')](_0xd0a2ac)[_0x7754('0x19')]();};}function respondWithResult(_0x522fac,_0x532cee){_0x532cee=_0x532cee||0xc8;return function(_0x30c4af){if(_0x30c4af){return _0x522fac[_0x7754('0x18')](_0x532cee)['json'](_0x30c4af);}};}function respondWithFilteredResult(_0x14a35d,_0x9e209e){return function(_0x3d357c){if(_0x3d357c){var _0x3cf6db=typeof _0x9e209e['offset']==='undefined'&&typeof _0x9e209e[_0x7754('0x1a')]==='undefined';var _0x53c2c2=_0x3d357c[_0x7754('0x1b')];var _0x44493d=_0x3cf6db?0x0:_0x9e209e[_0x7754('0x1c')];var _0x456932=_0x3cf6db?_0x3d357c[_0x7754('0x1b')]:_0x9e209e['offset']+_0x9e209e[_0x7754('0x1a')];var _0x3361e7;if(_0x456932>=_0x53c2c2){_0x456932=_0x53c2c2;_0x3361e7=0xc8;}else{_0x3361e7=0xce;}_0x14a35d[_0x7754('0x18')](_0x3361e7);return _0x14a35d[_0x7754('0x1d')](_0x7754('0x1e'),_0x44493d+'-'+_0x456932+'/'+_0x53c2c2)[_0x7754('0x1f')](_0x3d357c);}return null;};}function patchUpdates(_0x4e5892){return function(_0x3355c6){try{jsonpatch[_0x7754('0x20')](_0x3355c6,_0x4e5892,!![]);}catch(_0x5969fb){return BPromise[_0x7754('0x21')](_0x5969fb);}return _0x3355c6[_0x7754('0x22')]();};}function saveUpdates(_0x15e27e,_0x4e154f){return function(_0x2ff5f0){if(_0x2ff5f0){return _0x2ff5f0[_0x7754('0x23')](_0x15e27e)[_0x7754('0x24')](function(_0x15d281){return _0x15d281;});}return null;};}function removeEntity(_0x3f55a6,_0x153a39){return function(_0x496943){if(_0x496943){return _0x496943[_0x7754('0x25')]()[_0x7754('0x24')](function(){_0x3f55a6[_0x7754('0x18')](0xcc)[_0x7754('0x19')]();});}};}function handleEntityNotFound(_0x5b5b77,_0x1f9d48){return function(_0x4ed086){if(!_0x4ed086){_0x5b5b77[_0x7754('0x26')](0x194);}return _0x4ed086;};}function handleError(_0x416c66,_0x573d8a){_0x573d8a=_0x573d8a||0x1f4;return function(_0x38c019){logger[_0x7754('0x27')](_0x38c019[_0x7754('0x28')]);if(_0x38c019[_0x7754('0x29')]){delete _0x38c019[_0x7754('0x29')];}_0x416c66[_0x7754('0x18')](_0x573d8a)[_0x7754('0x2a')](_0x38c019);};}exports[_0x7754('0x2b')]=function(_0xefb35a,_0x2ac6ea){var _0x3dc1f5={},_0x3c0a0d={},_0x45230b={'count':0x0,'rows':[]};var _0x20674f=_['map'](db[_0x7754('0x2c')][_0x7754('0x2d')],function(_0x55f700){return{'name':_0x55f700[_0x7754('0x2e')],'type':_0x55f700[_0x7754('0x2f')][_0x7754('0x30')]};});_0x3c0a0d['model']=_[_0x7754('0x31')](_0x20674f,_0x7754('0x29'));_0x3c0a0d['query']=_[_0x7754('0x32')](_0xefb35a['query']);_0x3c0a0d[_0x7754('0x33')]=_[_0x7754('0x34')](_0x3c0a0d[_0x7754('0x35')],_0x3c0a0d[_0x7754('0x36')]);_0x3dc1f5[_0x7754('0x37')]=_[_0x7754('0x34')](_0x3c0a0d[_0x7754('0x35')],qs['fields'](_0xefb35a['query'][_0x7754('0x38')]));_0x3dc1f5[_0x7754('0x37')]=_0x3dc1f5[_0x7754('0x37')][_0x7754('0x39')]?_0x3dc1f5[_0x7754('0x37')]:_0x3c0a0d[_0x7754('0x35')];if(!_0xefb35a[_0x7754('0x36')][_0x7754('0x3a')]('nolimit')){_0x3dc1f5[_0x7754('0x1a')]=qs['limit'](_0xefb35a[_0x7754('0x36')][_0x7754('0x1a')]);_0x3dc1f5[_0x7754('0x1c')]=qs[_0x7754('0x1c')](_0xefb35a['query'][_0x7754('0x1c')]);}_0x3dc1f5[_0x7754('0x3b')]=qs['sort'](_0xefb35a[_0x7754('0x36')][_0x7754('0x3c')]);_0x3dc1f5['where']=qs[_0x7754('0x33')](_[_0x7754('0x3d')](_0xefb35a[_0x7754('0x36')],_0x3c0a0d[_0x7754('0x33')]),_0x20674f);if(_0xefb35a[_0x7754('0x36')]['filter']){_0x3dc1f5[_0x7754('0x3e')]=_[_0x7754('0x3f')](_0x3dc1f5[_0x7754('0x3e')],{'$or':_['map'](_0x20674f,function(_0x14353d){if(_0x14353d[_0x7754('0x2f')]!==_0x7754('0x40')){var _0x21ee8d={};_0x21ee8d[_0x14353d[_0x7754('0x29')]]={'$like':'%'+_0xefb35a[_0x7754('0x36')][_0x7754('0x41')]+'%'};return _0x21ee8d;}})});}_0x3dc1f5=_['merge']({},_0x3dc1f5,_0xefb35a[_0x7754('0x42')]);var _0x296af9={'where':_0x3dc1f5[_0x7754('0x3e')]};return db['ZohoConfiguration'][_0x7754('0x1b')](_0x296af9)[_0x7754('0x24')](function(_0x5c8a68){_0x45230b[_0x7754('0x1b')]=_0x5c8a68;if(_0xefb35a[_0x7754('0x36')]['includeAll']){_0x3dc1f5[_0x7754('0x43')]=[{'all':!![]}];}return db[_0x7754('0x2c')]['findAll'](_0x3dc1f5);})[_0x7754('0x24')](function(_0x1f778b){_0x45230b[_0x7754('0x44')]=_0x1f778b;return _0x45230b;})['then'](respondWithFilteredResult(_0x2ac6ea,_0x3dc1f5))[_0x7754('0x45')](handleError(_0x2ac6ea,null));};exports[_0x7754('0x46')]=function(_0x355272,_0x5f0724){var _0x50f9a1={'raw':![],'where':{'id':_0x355272[_0x7754('0x47')]['id']}},_0x5a01d5={};_0x5a01d5[_0x7754('0x35')]=_[_0x7754('0x32')](db[_0x7754('0x2c')]['rawAttributes']);_0x5a01d5['query']=_[_0x7754('0x32')](_0x355272['query']);_0x5a01d5[_0x7754('0x33')]=_['intersection'](_0x5a01d5['model'],_0x5a01d5[_0x7754('0x36')]);_0x50f9a1['attributes']=_[_0x7754('0x34')](_0x5a01d5[_0x7754('0x35')],qs[_0x7754('0x38')](_0x355272['query'][_0x7754('0x38')]));_0x50f9a1[_0x7754('0x37')]=_0x50f9a1[_0x7754('0x37')][_0x7754('0x39')]?_0x50f9a1[_0x7754('0x37')]:_0x5a01d5['model'];if(_0x355272[_0x7754('0x36')][_0x7754('0x48')]){_0x50f9a1[_0x7754('0x43')]=[{'all':!![]}];}_0x50f9a1=_[_0x7754('0x3f')]({},_0x50f9a1,_0x355272['options']);return db[_0x7754('0x2c')][_0x7754('0x49')](_0x50f9a1)[_0x7754('0x24')](handleEntityNotFound(_0x5f0724,null))[_0x7754('0x24')](respondWithResult(_0x5f0724,null))[_0x7754('0x45')](handleError(_0x5f0724,null));};exports[_0x7754('0x4a')]=function(_0x1f8108,_0x3fa9f8){return db['ZohoConfiguration'][_0x7754('0x4a')](_0x1f8108[_0x7754('0x4b')],{})[_0x7754('0x24')](respondWithResult(_0x3fa9f8,0xc9))[_0x7754('0x45')](handleError(_0x3fa9f8,null));};exports[_0x7754('0x23')]=function(_0x5aa75f,_0x295285){if(_0x5aa75f[_0x7754('0x4b')]['id']){delete _0x5aa75f[_0x7754('0x4b')]['id'];}return db[_0x7754('0x2c')]['find']({'where':{'id':_0x5aa75f[_0x7754('0x47')]['id']}})[_0x7754('0x24')](handleEntityNotFound(_0x295285,null))['then'](saveUpdates(_0x5aa75f[_0x7754('0x4b')],null))[_0x7754('0x24')](respondWithResult(_0x295285,null))[_0x7754('0x45')](handleError(_0x295285,null));};exports['destroy']=function(_0x2f95a7,_0x4b1703){return db['ZohoConfiguration']['find']({'where':{'id':_0x2f95a7['params']['id']}})[_0x7754('0x24')](handleEntityNotFound(_0x4b1703,null))[_0x7754('0x24')](removeEntity(_0x4b1703,null))[_0x7754('0x45')](handleError(_0x4b1703,null));};exports[_0x7754('0x4c')]=function(_0x193de0,_0x329747,_0x1e7a10){var _0xc9def2={};var _0x54b2ff={};var _0x5e1aee;var _0x9fe85a;return db['ZohoConfiguration'][_0x7754('0x4d')]({'where':{'id':_0x193de0[_0x7754('0x47')]['id']}})[_0x7754('0x24')](handleEntityNotFound(_0x329747,null))[_0x7754('0x24')](function(_0x5d6369){if(_0x5d6369){_0x5e1aee=_0x5d6369;_0x54b2ff[_0x7754('0x35')]=_[_0x7754('0x32')](db[_0x7754('0x4e')][_0x7754('0x2d')]);_0x54b2ff[_0x7754('0x36')]=_[_0x7754('0x32')](_0x193de0['query']);_0x54b2ff['filters']=_[_0x7754('0x34')](_0x54b2ff[_0x7754('0x35')],_0x54b2ff[_0x7754('0x36')]);_0xc9def2[_0x7754('0x37')]=_[_0x7754('0x34')](_0x54b2ff[_0x7754('0x35')],qs['fields'](_0x193de0[_0x7754('0x36')][_0x7754('0x38')]));_0xc9def2[_0x7754('0x37')]=_0xc9def2['attributes']['length']?_0xc9def2[_0x7754('0x37')]:_0x54b2ff[_0x7754('0x35')];_0xc9def2[_0x7754('0x3b')]=qs[_0x7754('0x3c')](_0x193de0['query'][_0x7754('0x3c')]);_0xc9def2[_0x7754('0x3e')]=qs[_0x7754('0x33')](_['pick'](_0x193de0[_0x7754('0x36')],_0x54b2ff['filters']));if(_0x193de0[_0x7754('0x36')][_0x7754('0x41')]){_0xc9def2[_0x7754('0x3e')]=_['merge'](_0xc9def2[_0x7754('0x3e')],{'$or':_[_0x7754('0x31')](_0xc9def2[_0x7754('0x37')],function(_0x572dec){var _0x5b223d={};_0x5b223d[_0x572dec]={'$like':'%'+_0x193de0['query'][_0x7754('0x41')]+'%'};return _0x5b223d;})});}_0xc9def2=_['merge']({},_0xc9def2,_0x193de0['options']);return _0x5e1aee[_0x7754('0x4c')](_0xc9def2);}})[_0x7754('0x24')](function(_0x2b9388){if(_0x2b9388){_0x9fe85a=_0x2b9388[_0x7754('0x39')];if(!_0x193de0[_0x7754('0x36')][_0x7754('0x3a')](_0x7754('0x4f'))){_0xc9def2[_0x7754('0x1a')]=qs[_0x7754('0x1a')](_0x193de0[_0x7754('0x36')]['limit']);_0xc9def2['offset']=qs[_0x7754('0x1c')](_0x193de0[_0x7754('0x36')]['offset']);}return _0x5e1aee[_0x7754('0x4c')](_0xc9def2);}})[_0x7754('0x24')](function(_0x37e778){if(_0x37e778){return _0x37e778?{'count':_0x9fe85a,'rows':_0x37e778}:null;}})[_0x7754('0x24')](respondWithResult(_0x329747,null))[_0x7754('0x45')](handleError(_0x329747,null));};exports[_0x7754('0x50')]=function(_0x478403,_0x528e9f,_0x36209c){var _0x10ca1d={};var _0x15016e={};var _0x14168a;var _0x12093b;return db['ZohoConfiguration'][_0x7754('0x4d')]({'where':{'id':_0x478403['params']['id']}})[_0x7754('0x24')](handleEntityNotFound(_0x528e9f,null))[_0x7754('0x24')](function(_0x3d8d72){if(_0x3d8d72){_0x14168a=_0x3d8d72;_0x15016e[_0x7754('0x35')]=_[_0x7754('0x32')](db[_0x7754('0x4e')][_0x7754('0x2d')]);_0x15016e[_0x7754('0x36')]=_[_0x7754('0x32')](_0x478403[_0x7754('0x36')]);_0x15016e[_0x7754('0x33')]=_['intersection'](_0x15016e['model'],_0x15016e[_0x7754('0x36')]);_0x10ca1d['attributes']=_[_0x7754('0x34')](_0x15016e['model'],qs[_0x7754('0x38')](_0x478403[_0x7754('0x36')][_0x7754('0x38')]));_0x10ca1d[_0x7754('0x37')]=_0x10ca1d[_0x7754('0x37')]['length']?_0x10ca1d[_0x7754('0x37')]:_0x15016e[_0x7754('0x35')];_0x10ca1d['order']=qs[_0x7754('0x3c')](_0x478403[_0x7754('0x36')][_0x7754('0x3c')]);_0x10ca1d['where']=qs[_0x7754('0x33')](_[_0x7754('0x3d')](_0x478403[_0x7754('0x36')],_0x15016e[_0x7754('0x33')]));if(_0x478403[_0x7754('0x36')][_0x7754('0x41')]){_0x10ca1d[_0x7754('0x3e')]=_['merge'](_0x10ca1d[_0x7754('0x3e')],{'$or':_['map'](_0x10ca1d[_0x7754('0x37')],function(_0x6bc246){var _0x2cb3e7={};_0x2cb3e7[_0x6bc246]={'$like':'%'+_0x478403[_0x7754('0x36')][_0x7754('0x41')]+'%'};return _0x2cb3e7;})});}_0x10ca1d=_[_0x7754('0x3f')]({},_0x10ca1d,_0x478403['options']);return _0x14168a[_0x7754('0x50')](_0x10ca1d);}})['then'](function(_0xf2ff68){if(_0xf2ff68){_0x12093b=_0xf2ff68[_0x7754('0x39')];if(!_0x478403[_0x7754('0x36')][_0x7754('0x3a')]('nolimit')){_0x10ca1d[_0x7754('0x1a')]=qs['limit'](_0x478403[_0x7754('0x36')][_0x7754('0x1a')]);_0x10ca1d[_0x7754('0x1c')]=qs[_0x7754('0x1c')](_0x478403[_0x7754('0x36')][_0x7754('0x1c')]);}return _0x14168a[_0x7754('0x50')](_0x10ca1d);}})[_0x7754('0x24')](function(_0x407e79){if(_0x407e79){return _0x407e79?{'count':_0x12093b,'rows':_0x407e79}:null;}})[_0x7754('0x24')](respondWithResult(_0x528e9f,null))[_0x7754('0x45')](handleError(_0x528e9f,null));};exports['getDescriptions']=function(_0x455fb1,_0x4dc830,_0x179db1){var _0x258f44={};var _0x139553={};var _0x2a4598;var _0x3a4fad;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x455fb1[_0x7754('0x47')]['id']}})[_0x7754('0x24')](handleEntityNotFound(_0x4dc830,null))[_0x7754('0x24')](function(_0x29f49f){if(_0x29f49f){_0x2a4598=_0x29f49f;_0x139553[_0x7754('0x35')]=_[_0x7754('0x32')](db['ZohoField']['rawAttributes']);_0x139553[_0x7754('0x36')]=_[_0x7754('0x32')](_0x455fb1['query']);_0x139553['filters']=_[_0x7754('0x34')](_0x139553[_0x7754('0x35')],_0x139553[_0x7754('0x36')]);_0x258f44[_0x7754('0x37')]=_[_0x7754('0x34')](_0x139553[_0x7754('0x35')],qs[_0x7754('0x38')](_0x455fb1[_0x7754('0x36')][_0x7754('0x38')]));_0x258f44[_0x7754('0x37')]=_0x258f44['attributes'][_0x7754('0x39')]?_0x258f44['attributes']:_0x139553['model'];_0x258f44['order']=qs['sort'](_0x455fb1['query'][_0x7754('0x3c')]);_0x258f44[_0x7754('0x3e')]=qs[_0x7754('0x33')](_['pick'](_0x455fb1[_0x7754('0x36')],_0x139553[_0x7754('0x33')]));if(_0x455fb1['query'][_0x7754('0x41')]){_0x258f44[_0x7754('0x3e')]=_[_0x7754('0x3f')](_0x258f44[_0x7754('0x3e')],{'$or':_[_0x7754('0x31')](_0x258f44[_0x7754('0x37')],function(_0x3f2516){var _0xe697ad={};_0xe697ad[_0x3f2516]={'$like':'%'+_0x455fb1[_0x7754('0x36')]['filter']+'%'};return _0xe697ad;})});}_0x258f44=_[_0x7754('0x3f')]({},_0x258f44,_0x455fb1[_0x7754('0x42')]);return _0x2a4598['getDescriptions'](_0x258f44);}})[_0x7754('0x24')](function(_0x3877a2){if(_0x3877a2){_0x3a4fad=_0x3877a2[_0x7754('0x39')];if(!_0x455fb1[_0x7754('0x36')][_0x7754('0x3a')](_0x7754('0x4f'))){_0x258f44[_0x7754('0x1a')]=qs[_0x7754('0x1a')](_0x455fb1[_0x7754('0x36')]['limit']);_0x258f44['offset']=qs[_0x7754('0x1c')](_0x455fb1[_0x7754('0x36')][_0x7754('0x1c')]);}return _0x2a4598[_0x7754('0x51')](_0x258f44);}})[_0x7754('0x24')](function(_0x515f2a){if(_0x515f2a){return _0x515f2a?{'count':_0x3a4fad,'rows':_0x515f2a}:null;}})[_0x7754('0x24')](respondWithResult(_0x4dc830,null))['catch'](handleError(_0x4dc830,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 53fdbce..26bf1cf 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 _0x0fbb=['request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x459e45,_0x2d0905){var _0x3976bf=function(_0x3711bc){while(--_0x3711bc){_0x459e45['push'](_0x459e45['shift']());}};_0x3976bf(++_0x2d0905);}(_0x0fbb,0x13d));var _0xb0fb=function(_0x1a892f,_0x47b370){_0x1a892f=_0x1a892f-0x0;var _0x7334a5=_0x0fbb[_0x1a892f];return _0x7334a5;};'use strict';var _=require('lodash');var util=require(_0xb0fb('0x0'));var logger=require(_0xb0fb('0x1'))(_0xb0fb('0x2'));var moment=require(_0xb0fb('0x3'));var BPromise=require(_0xb0fb('0x4'));var rp=require(_0xb0fb('0x5'));var fs=require('fs');var path=require(_0xb0fb('0x6'));var rimraf=require(_0xb0fb('0x7'));var config=require(_0xb0fb('0x8'));var attributes=require(_0xb0fb('0x9'));module[_0xb0fb('0xa')]=function(_0x19acc7,_0x1cdb5e){return _0x19acc7[_0xb0fb('0xb')](_0xb0fb('0xc'),attributes,{'tableName':_0xb0fb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d40=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration'];(function(_0xbea9c,_0x587aca){var _0x163627=function(_0x4c7ed9){while(--_0x4c7ed9){_0xbea9c['push'](_0xbea9c['shift']());}};_0x163627(++_0x587aca);}(_0x8d40,0x129));var _0x08d4=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8d40[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x08d4('0x0'));var util=require(_0x08d4('0x1'));var logger=require(_0x08d4('0x2'))('api');var moment=require(_0x08d4('0x3'));var BPromise=require('bluebird');var rp=require(_0x08d4('0x4'));var fs=require('fs');var path=require(_0x08d4('0x5'));var rimraf=require(_0x08d4('0x6'));var config=require('../../config/environment');var attributes=require(_0x08d4('0x7'));module[_0x08d4('0x8')]=function(_0x16ca0d,_0x2e48fe){return _0x16ca0d[_0x08d4('0x9')](_0x08d4('0xa'),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 52bd4a8..d8bb8ec 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 _0x3e8c=['error','code','message','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1b6eff,_0x4efb5a){var _0x37ddca=function(_0x1bd1dd){while(--_0x1bd1dd){_0x1b6eff['push'](_0x1b6eff['shift']());}};_0x37ddca(++_0x4efb5a);}(_0x3e8c,0x1ad));var _0xc3e8=function(_0x5f3e3c,_0x5e0529){_0x5f3e3c=_0x5f3e3c-0x0;var _0x3c53d1=_0x3e8c[_0x5f3e3c];return _0x3c53d1;};'use strict';var _=require(_0xc3e8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc3e8('0x1'));var rs=require(_0xc3e8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc3e8('0x3'));var logger=require(_0xc3e8('0x4'))('rpc');var config=require(_0xc3e8('0x5'));var jayson=require(_0xc3e8('0x6'));var client=jayson['client'][_0xc3e8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3adfb1,_0x243273,_0x49fbfa){return new BPromise(function(_0x31bc55,_0x1ed7dd){return client[_0xc3e8('0x8')](_0x3adfb1,_0x49fbfa)[_0xc3e8('0x9')](function(_0x426ea1){logger['info'](_0xc3e8('0xa'),_0x243273,_0xc3e8('0xb'));logger[_0xc3e8('0xc')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x243273,_0xc3e8('0xb'),JSON['stringify'](_0x426ea1));if(_0x426ea1[_0xc3e8('0xd')]){if(_0x426ea1['error'][_0xc3e8('0xe')]===0x1f4){logger[_0xc3e8('0xd')](_0xc3e8('0xa'),_0x243273,_0x426ea1['error'][_0xc3e8('0xf')]);return _0x1ed7dd(_0x426ea1[_0xc3e8('0xd')][_0xc3e8('0xf')]);}logger[_0xc3e8('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x243273,_0x426ea1[_0xc3e8('0xd')]['message']);return _0x31bc55(_0x426ea1[_0xc3e8('0xd')][_0xc3e8('0xf')]);}else{logger['info'](_0xc3e8('0xa'),_0x243273,'request\x20sent');_0x31bc55(_0x426ea1['result'][_0xc3e8('0xf')]);}})[_0xc3e8('0x10')](function(_0x432337){logger['error'](_0xc3e8('0xa'),_0x243273,_0x432337);_0x1ed7dd(_0x432337);});});} \ No newline at end of file +var _0xb450=['http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x5f0118,_0xc00d6a){var _0xd8b4da=function(_0x2832ab){while(--_0x2832ab){_0x5f0118['push'](_0x5f0118['shift']());}};_0xd8b4da(++_0xc00d6a);}(_0xb450,0x175));var _0x0b45=function(_0x2932e0,_0x50e3d5){_0x2932e0=_0x2932e0-0x0;var _0x20e7da=_0xb450[_0x2932e0];return _0x20e7da;};'use strict';var _=require(_0x0b45('0x0'));var util=require(_0x0b45('0x1'));var moment=require(_0x0b45('0x2'));var BPromise=require(_0x0b45('0x3'));var rs=require(_0x0b45('0x4'));var fs=require('fs');var Redis=require(_0x0b45('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b45('0x6'));var logger=require(_0x0b45('0x7'))('rpc');var config=require(_0x0b45('0x8'));var jayson=require(_0x0b45('0x9'));var client=jayson[_0x0b45('0xa')][_0x0b45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bd2eb,_0x463a14,_0x2adf8e){return new BPromise(function(_0x21fbbe,_0x1811cc){return client[_0x0b45('0xc')](_0x3bd2eb,_0x2adf8e)[_0x0b45('0xd')](function(_0x5aa7cf){logger['info'](_0x0b45('0xe'),_0x463a14,_0x0b45('0xf'));logger['debug'](_0x0b45('0x10'),_0x463a14,'request\x20sent',JSON[_0x0b45('0x11')](_0x5aa7cf));if(_0x5aa7cf[_0x0b45('0x12')]){if(_0x5aa7cf[_0x0b45('0x12')][_0x0b45('0x13')]===0x1f4){logger['error'](_0x0b45('0xe'),_0x463a14,_0x5aa7cf[_0x0b45('0x12')][_0x0b45('0x14')]);return _0x1811cc(_0x5aa7cf[_0x0b45('0x12')][_0x0b45('0x14')]);}logger[_0x0b45('0x12')](_0x0b45('0xe'),_0x463a14,_0x5aa7cf[_0x0b45('0x12')][_0x0b45('0x14')]);return _0x21fbbe(_0x5aa7cf[_0x0b45('0x12')][_0x0b45('0x14')]);}else{logger[_0x0b45('0x15')]('ZohoConfiguration,\x20%s,\x20%s',_0x463a14,_0x0b45('0xf'));_0x21fbbe(_0x5aa7cf[_0x0b45('0x16')][_0x0b45('0x14')]);}})[_0x0b45('0x17')](function(_0x32e236){logger[_0x0b45('0x12')](_0x0b45('0xe'),_0x463a14,_0x32e236);_0x1811cc(_0x32e236);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index d8e8289..1d8e833 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 _0xb521=['../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x54083b,_0x4649d2){var _0x525878=function(_0x2ab334){while(--_0x2ab334){_0x54083b['push'](_0x54083b['shift']());}};_0x525878(++_0x4649d2);}(_0xb521,0x13d));var _0x1b52=function(_0x49a8cb,_0x34a7be){_0x49a8cb=_0x49a8cb-0x0;var _0x3a622f=_0xb521[_0x49a8cb];return _0x3a622f;};'use strict';var multer=require('multer');var util=require(_0x1b52('0x0'));var path=require(_0x1b52('0x1'));var timeout=require(_0x1b52('0x2'));var express=require(_0x1b52('0x3'));var router=express[_0x1b52('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1b52('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1b52('0x6'));var controller=require(_0x1b52('0x7'));router[_0x1b52('0x8')]('/',auth[_0x1b52('0x9')](),controller[_0x1b52('0xa')]);router[_0x1b52('0x8')](_0x1b52('0xb'),auth[_0x1b52('0x9')](),controller[_0x1b52('0xc')]);router[_0x1b52('0xd')]('/',auth['isAuthenticated'](),controller[_0x1b52('0xe')]);router[_0x1b52('0xf')](_0x1b52('0xb'),auth[_0x1b52('0x9')](),controller[_0x1b52('0x10')]);router['delete'](_0x1b52('0xb'),auth[_0x1b52('0x9')](),controller[_0x1b52('0x11')]);module[_0x1b52('0x12')]=router; \ No newline at end of file +var _0xc860=['create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','show','post'];(function(_0x5341a7,_0x425c70){var _0x17ca4a=function(_0x3a517a){while(--_0x3a517a){_0x5341a7['push'](_0x5341a7['shift']());}};_0x17ca4a(++_0x425c70);}(_0xc860,0x78));var _0x0c86=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0xc860[_0x1fafa5];return _0xcf08c9;};'use strict';var multer=require(_0x0c86('0x0'));var util=require('util');var path=require(_0x0c86('0x1'));var timeout=require(_0x0c86('0x2'));var express=require('express');var router=express[_0x0c86('0x3')]();var fs_extra=require(_0x0c86('0x4'));var auth=require(_0x0c86('0x5'));var interaction=require(_0x0c86('0x6'));var config=require(_0x0c86('0x7'));var controller=require(_0x0c86('0x8'));router['get']('/',auth[_0x0c86('0x9')](),controller[_0x0c86('0xa')]);router['get']('/:id',auth[_0x0c86('0x9')](),controller[_0x0c86('0xb')]);router[_0x0c86('0xc')]('/',auth[_0x0c86('0x9')](),controller[_0x0c86('0xd')]);router[_0x0c86('0xe')](_0x0c86('0xf'),auth[_0x0c86('0x9')](),controller['update']);router[_0x0c86('0x10')]('/:id',auth[_0x0c86('0x9')](),controller[_0x0c86('0x11')]);module[_0x0c86('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 2d8c217..585ddba 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 _0xf129=['picklist','string','STRING','ENUM','customVariable','sequelize','exports','variable','keyValue'];(function(_0x369aea,_0x40d1c1){var _0x5460ac=function(_0x385232){while(--_0x385232){_0x369aea['push'](_0x369aea['shift']());}};_0x5460ac(++_0x40d1c1);}(_0xf129,0x188));var _0x9f12=function(_0x32d565,_0x539300){_0x32d565=_0x32d565-0x0;var _0x2ca327=_0xf129[_0x32d565];return _0x2ca327;};'use strict';var Sequelize=require(_0x9f12('0x0'));module[_0x9f12('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x9f12('0x2'),'customVariable',_0x9f12('0x3'),_0x9f12('0x4')),'defaultValue':_0x9f12('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9f12('0x6')]},'keyType':{'type':Sequelize[_0x9f12('0x7')]('string',_0x9f12('0x2'),_0x9f12('0x8'))},'keyContent':{'type':Sequelize[_0x9f12('0x6')]},'idField':{'type':Sequelize[_0x9f12('0x6')]},'nameField':{'type':Sequelize[_0x9f12('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9f12('0x6')]}}; \ No newline at end of file +var _0x0a76=['exports','ENUM','string','customVariable','keyValue','STRING','variable','sequelize'];(function(_0x5c08ed,_0x15e0e7){var _0x33b3fb=function(_0x1b28bb){while(--_0x1b28bb){_0x5c08ed['push'](_0x5c08ed['shift']());}};_0x33b3fb(++_0x15e0e7);}(_0x0a76,0x1bf));var _0x60a7=function(_0x37d133,_0x3a9431){_0x37d133=_0x37d133-0x0;var _0x17b96c=_0x0a76[_0x37d133];return _0x17b96c;};'use strict';var Sequelize=require(_0x60a7('0x0'));module[_0x60a7('0x1')]={'type':{'type':Sequelize[_0x60a7('0x2')](_0x60a7('0x3'),'variable',_0x60a7('0x4'),_0x60a7('0x5'),'picklist'),'defaultValue':_0x60a7('0x3')},'content':{'type':Sequelize[_0x60a7('0x6')]},'key':{'type':Sequelize[_0x60a7('0x6')]},'keyType':{'type':Sequelize[_0x60a7('0x2')](_0x60a7('0x3'),_0x60a7('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x60a7('0x6')]},'idField':{'type':Sequelize[_0x60a7('0x6')]},'nameField':{'type':Sequelize[_0x60a7('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x60a7('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index c1bc010..f829b5f 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 _0xca8a=['fields','length','attributes','hasOwnProperty','sort','pick','filter','where','merge','options','includeAll','include','findAll','show','params','catch','create','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','stack','name','map','ZohoField','rawAttributes','fieldName','type','model','keys','query','filters','intersection'];(function(_0xd04b50,_0x3d635d){var _0x5de236=function(_0x9129b1){while(--_0x9129b1){_0xd04b50['push'](_0xd04b50['shift']());}};_0x5de236(++_0x3d635d);}(_0xca8a,0xa3));var _0xaca8=function(_0x1e548d,_0x56c6ac){_0x1e548d=_0x1e548d-0x0;var _0x4d2a76=_0xca8a[_0x1e548d];return _0x4d2a76;};'use strict';var emlformat=require(_0xaca8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaca8('0x1'));var jsonpatch=require(_0xaca8('0x2'));var rp=require('request-promise');var moment=require(_0xaca8('0x3'));var BPromise=require(_0xaca8('0x4'));var Mustache=require(_0xaca8('0x5'));var util=require('util');var path=require(_0xaca8('0x6'));var sox=require(_0xaca8('0x7'));var csv=require(_0xaca8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaca8('0x9'));var _=require(_0xaca8('0xa'));var squel=require(_0xaca8('0xb'));var crypto=require(_0xaca8('0xc'));var jsforce=require(_0xaca8('0xd'));var deskjs=require(_0xaca8('0xe'));var toCsv=require(_0xaca8('0x8'));var querystring=require(_0xaca8('0xf'));var Papa=require(_0xaca8('0x10'));var Redis=require(_0xaca8('0x11'));var authService=require(_0xaca8('0x12'));var qs=require(_0xaca8('0x13'));var as=require(_0xaca8('0x14'));var hardwareService=require(_0xaca8('0x15'));var logger=require(_0xaca8('0x16'))(_0xaca8('0x17'));var utils=require(_0xaca8('0x18'));var config=require(_0xaca8('0x19'));var licenseUtil=require(_0xaca8('0x1a'));var db=require(_0xaca8('0x1b'))['db'];function respondWithStatusCode(_0x30aa22,_0x2c7647){_0x2c7647=_0x2c7647||0xcc;return function(_0x27eaf8){if(_0x27eaf8){return _0x30aa22[_0xaca8('0x1c')](_0x2c7647);}return _0x30aa22[_0xaca8('0x1d')](_0x2c7647)['end']();};}function respondWithResult(_0x510016,_0x2d8f2c){_0x2d8f2c=_0x2d8f2c||0xc8;return function(_0x413602){if(_0x413602){return _0x510016[_0xaca8('0x1d')](_0x2d8f2c)[_0xaca8('0x1e')](_0x413602);}};}function respondWithFilteredResult(_0x5970e6,_0x378c89){return function(_0x2a9e55){if(_0x2a9e55){var _0x174b34=typeof _0x378c89[_0xaca8('0x1f')]===_0xaca8('0x20')&&typeof _0x378c89[_0xaca8('0x21')]===_0xaca8('0x20');var _0x3386c9=_0x2a9e55[_0xaca8('0x22')];var _0x30c881=_0x174b34?0x0:_0x378c89['offset'];var _0x5408dd=_0x174b34?_0x2a9e55[_0xaca8('0x22')]:_0x378c89[_0xaca8('0x1f')]+_0x378c89[_0xaca8('0x21')];var _0xa68ac2;if(_0x5408dd>=_0x3386c9){_0x5408dd=_0x3386c9;_0xa68ac2=0xc8;}else{_0xa68ac2=0xce;}_0x5970e6[_0xaca8('0x1d')](_0xa68ac2);return _0x5970e6[_0xaca8('0x23')](_0xaca8('0x24'),_0x30c881+'-'+_0x5408dd+'/'+_0x3386c9)['json'](_0x2a9e55);}return null;};}function patchUpdates(_0x113108){return function(_0x19a5b3){try{jsonpatch['apply'](_0x19a5b3,_0x113108,!![]);}catch(_0x1fb91c){return BPromise['reject'](_0x1fb91c);}return _0x19a5b3[_0xaca8('0x25')]();};}function saveUpdates(_0x24a6ed,_0x386eeb){return function(_0x4a7cbf){if(_0x4a7cbf){return _0x4a7cbf[_0xaca8('0x26')](_0x24a6ed)[_0xaca8('0x27')](function(_0x15d330){return _0x15d330;});}return null;};}function removeEntity(_0x55eca7,_0xd8b143){return function(_0x21a4e8){if(_0x21a4e8){return _0x21a4e8[_0xaca8('0x28')]()[_0xaca8('0x27')](function(){_0x55eca7[_0xaca8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55d14d,_0x422a4b){return function(_0x2e9dfc){if(!_0x2e9dfc){_0x55d14d[_0xaca8('0x1c')](0x194);}return _0x2e9dfc;};}function handleError(_0x176fb9,_0x42319c){_0x42319c=_0x42319c||0x1f4;return function(_0x7029d9){logger['error'](_0x7029d9[_0xaca8('0x29')]);if(_0x7029d9[_0xaca8('0x2a')]){delete _0x7029d9[_0xaca8('0x2a')];}_0x176fb9[_0xaca8('0x1d')](_0x42319c)['send'](_0x7029d9);};}exports['index']=function(_0x45bb19,_0xfd388f){var _0x54325e={},_0x2c9dc3={},_0x1fa5c6={'count':0x0,'rows':[]};var _0x2fbcdc=_[_0xaca8('0x2b')](db[_0xaca8('0x2c')][_0xaca8('0x2d')],function(_0x4c5cd5){return{'name':_0x4c5cd5[_0xaca8('0x2e')],'type':_0x4c5cd5[_0xaca8('0x2f')]['key']};});_0x2c9dc3[_0xaca8('0x30')]=_['map'](_0x2fbcdc,_0xaca8('0x2a'));_0x2c9dc3['query']=_[_0xaca8('0x31')](_0x45bb19[_0xaca8('0x32')]);_0x2c9dc3[_0xaca8('0x33')]=_[_0xaca8('0x34')](_0x2c9dc3[_0xaca8('0x30')],_0x2c9dc3[_0xaca8('0x32')]);_0x54325e['attributes']=_['intersection'](_0x2c9dc3[_0xaca8('0x30')],qs[_0xaca8('0x35')](_0x45bb19['query'][_0xaca8('0x35')]));_0x54325e['attributes']=_0x54325e['attributes'][_0xaca8('0x36')]?_0x54325e[_0xaca8('0x37')]:_0x2c9dc3['model'];if(!_0x45bb19[_0xaca8('0x32')][_0xaca8('0x38')]('nolimit')){_0x54325e[_0xaca8('0x21')]=qs['limit'](_0x45bb19[_0xaca8('0x32')][_0xaca8('0x21')]);_0x54325e['offset']=qs['offset'](_0x45bb19[_0xaca8('0x32')]['offset']);}_0x54325e['order']=qs[_0xaca8('0x39')](_0x45bb19[_0xaca8('0x32')][_0xaca8('0x39')]);_0x54325e['where']=qs[_0xaca8('0x33')](_[_0xaca8('0x3a')](_0x45bb19[_0xaca8('0x32')],_0x2c9dc3[_0xaca8('0x33')]),_0x2fbcdc);if(_0x45bb19[_0xaca8('0x32')][_0xaca8('0x3b')]){_0x54325e[_0xaca8('0x3c')]=_[_0xaca8('0x3d')](_0x54325e[_0xaca8('0x3c')],{'$or':_[_0xaca8('0x2b')](_0x2fbcdc,function(_0x4333c2){if(_0x4333c2[_0xaca8('0x2f')]!=='VIRTUAL'){var _0x310e60={};_0x310e60[_0x4333c2['name']]={'$like':'%'+_0x45bb19[_0xaca8('0x32')][_0xaca8('0x3b')]+'%'};return _0x310e60;}})});}_0x54325e=_[_0xaca8('0x3d')]({},_0x54325e,_0x45bb19[_0xaca8('0x3e')]);var _0xb51a56={'where':_0x54325e[_0xaca8('0x3c')]};return db['ZohoField'][_0xaca8('0x22')](_0xb51a56)[_0xaca8('0x27')](function(_0x473693){_0x1fa5c6[_0xaca8('0x22')]=_0x473693;if(_0x45bb19[_0xaca8('0x32')][_0xaca8('0x3f')]){_0x54325e[_0xaca8('0x40')]=[{'all':!![]}];}return db[_0xaca8('0x2c')][_0xaca8('0x41')](_0x54325e);})['then'](function(_0x16874b){_0x1fa5c6['rows']=_0x16874b;return _0x1fa5c6;})['then'](respondWithFilteredResult(_0xfd388f,_0x54325e))['catch'](handleError(_0xfd388f,null));};exports[_0xaca8('0x42')]=function(_0x11900f,_0x590d4e){var _0x4d7e3d={'raw':!![],'where':{'id':_0x11900f[_0xaca8('0x43')]['id']}},_0x595910={};_0x595910['model']=_[_0xaca8('0x31')](db[_0xaca8('0x2c')][_0xaca8('0x2d')]);_0x595910[_0xaca8('0x32')]=_[_0xaca8('0x31')](_0x11900f['query']);_0x595910[_0xaca8('0x33')]=_['intersection'](_0x595910[_0xaca8('0x30')],_0x595910[_0xaca8('0x32')]);_0x4d7e3d[_0xaca8('0x37')]=_[_0xaca8('0x34')](_0x595910['model'],qs[_0xaca8('0x35')](_0x11900f[_0xaca8('0x32')][_0xaca8('0x35')]));_0x4d7e3d['attributes']=_0x4d7e3d[_0xaca8('0x37')][_0xaca8('0x36')]?_0x4d7e3d[_0xaca8('0x37')]:_0x595910[_0xaca8('0x30')];if(_0x11900f[_0xaca8('0x32')][_0xaca8('0x3f')]){_0x4d7e3d[_0xaca8('0x40')]=[{'all':!![]}];}_0x4d7e3d=_[_0xaca8('0x3d')]({},_0x4d7e3d,_0x11900f['options']);return db[_0xaca8('0x2c')]['find'](_0x4d7e3d)['then'](handleEntityNotFound(_0x590d4e,null))[_0xaca8('0x27')](respondWithResult(_0x590d4e,null))[_0xaca8('0x44')](handleError(_0x590d4e,null));};exports[_0xaca8('0x45')]=function(_0x4293c2,_0x1a5881){return db[_0xaca8('0x2c')]['create'](_0x4293c2[_0xaca8('0x46')],{})[_0xaca8('0x27')](respondWithResult(_0x1a5881,0xc9))[_0xaca8('0x44')](handleError(_0x1a5881,null));};exports[_0xaca8('0x26')]=function(_0x3340d5,_0xc0539c){if(_0x3340d5['body']['id']){delete _0x3340d5['body']['id'];}return db['ZohoField']['find']({'where':{'id':_0x3340d5[_0xaca8('0x43')]['id']}})['then'](handleEntityNotFound(_0xc0539c,null))[_0xaca8('0x27')](saveUpdates(_0x3340d5['body'],null))[_0xaca8('0x27')](respondWithResult(_0xc0539c,null))[_0xaca8('0x44')](handleError(_0xc0539c,null));};exports[_0xaca8('0x28')]=function(_0x4ad7ae,_0x2162f2){return db[_0xaca8('0x2c')][_0xaca8('0x47')]({'where':{'id':_0x4ad7ae[_0xaca8('0x43')]['id']}})[_0xaca8('0x27')](handleEntityNotFound(_0x2162f2,null))[_0xaca8('0x27')](removeEntity(_0x2162f2,null))[_0xaca8('0x44')](handleError(_0x2162f2,null));}; \ No newline at end of file +var _0x1485=['apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','includeAll','find','catch','create','params','body','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','Content-Range','json'];(function(_0x22a135,_0x5790b9){var _0x13f3dd=function(_0x3ca0d9){while(--_0x3ca0d9){_0x22a135['push'](_0x22a135['shift']());}};_0x13f3dd(++_0x5790b9);}(_0x1485,0x77));var _0x5148=function(_0x2fbd8f,_0x20c69e){_0x2fbd8f=_0x2fbd8f-0x0;var _0x445789=_0x1485[_0x2fbd8f];return _0x445789;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5148('0x0'));var zipdir=require(_0x5148('0x1'));var jsonpatch=require(_0x5148('0x2'));var rp=require('request-promise');var moment=require(_0x5148('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5148('0x4'));var util=require(_0x5148('0x5'));var path=require(_0x5148('0x6'));var sox=require(_0x5148('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5148('0x8'));var _=require(_0x5148('0x9'));var squel=require(_0x5148('0xa'));var crypto=require(_0x5148('0xb'));var jsforce=require(_0x5148('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5148('0xd'));var querystring=require(_0x5148('0xe'));var Papa=require(_0x5148('0xf'));var Redis=require(_0x5148('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5148('0x11'));var as=require(_0x5148('0x12'));var hardwareService=require(_0x5148('0x13'));var logger=require(_0x5148('0x14'))('api');var utils=require(_0x5148('0x15'));var config=require(_0x5148('0x16'));var licenseUtil=require(_0x5148('0x17'));var db=require(_0x5148('0x18'))['db'];function respondWithStatusCode(_0x2c09f7,_0x3b5704){_0x3b5704=_0x3b5704||0xcc;return function(_0x2292e4){if(_0x2292e4){return _0x2c09f7[_0x5148('0x19')](_0x3b5704);}return _0x2c09f7['status'](_0x3b5704)['end']();};}function respondWithResult(_0x45c766,_0xd16b0e){_0xd16b0e=_0xd16b0e||0xc8;return function(_0x330e7d){if(_0x330e7d){return _0x45c766[_0x5148('0x1a')](_0xd16b0e)['json'](_0x330e7d);}};}function respondWithFilteredResult(_0x52d82d,_0x35255){return function(_0x22c875){if(_0x22c875){var _0xb4fd64=typeof _0x35255[_0x5148('0x1b')]===_0x5148('0x1c')&&typeof _0x35255['limit']===_0x5148('0x1c');var _0x34a7b9=_0x22c875[_0x5148('0x1d')];var _0x48f122=_0xb4fd64?0x0:_0x35255['offset'];var _0x15f869=_0xb4fd64?_0x22c875['count']:_0x35255['offset']+_0x35255[_0x5148('0x1e')];var _0x5ec7c1;if(_0x15f869>=_0x34a7b9){_0x15f869=_0x34a7b9;_0x5ec7c1=0xc8;}else{_0x5ec7c1=0xce;}_0x52d82d[_0x5148('0x1a')](_0x5ec7c1);return _0x52d82d['set'](_0x5148('0x1f'),_0x48f122+'-'+_0x15f869+'/'+_0x34a7b9)[_0x5148('0x20')](_0x22c875);}return null;};}function patchUpdates(_0x5209ca){return function(_0x34c28c){try{jsonpatch[_0x5148('0x21')](_0x34c28c,_0x5209ca,!![]);}catch(_0x40af5c){return BPromise[_0x5148('0x22')](_0x40af5c);}return _0x34c28c[_0x5148('0x23')]();};}function saveUpdates(_0x34e0de,_0x337ca4){return function(_0x3a7efa){if(_0x3a7efa){return _0x3a7efa[_0x5148('0x24')](_0x34e0de)['then'](function(_0x3dc4c0){return _0x3dc4c0;});}return null;};}function removeEntity(_0x1c29c2,_0x2bcf77){return function(_0x2b12f0){if(_0x2b12f0){return _0x2b12f0[_0x5148('0x25')]()[_0x5148('0x26')](function(){_0x1c29c2[_0x5148('0x1a')](0xcc)[_0x5148('0x27')]();});}};}function handleEntityNotFound(_0x211be4,_0xd17f31){return function(_0x1b52c6){if(!_0x1b52c6){_0x211be4[_0x5148('0x19')](0x194);}return _0x1b52c6;};}function handleError(_0x317915,_0x45ef9f){_0x45ef9f=_0x45ef9f||0x1f4;return function(_0xd2eb8e){logger[_0x5148('0x28')](_0xd2eb8e[_0x5148('0x29')]);if(_0xd2eb8e[_0x5148('0x2a')]){delete _0xd2eb8e[_0x5148('0x2a')];}_0x317915[_0x5148('0x1a')](_0x45ef9f)[_0x5148('0x2b')](_0xd2eb8e);};}exports[_0x5148('0x2c')]=function(_0x2007d0,_0x55b4f2){var _0x1e9123={},_0x2a37aa={},_0x49daab={'count':0x0,'rows':[]};var _0x1a80ba=_[_0x5148('0x2d')](db[_0x5148('0x2e')][_0x5148('0x2f')],function(_0x4cc4ba){return{'name':_0x4cc4ba[_0x5148('0x30')],'type':_0x4cc4ba[_0x5148('0x31')]['key']};});_0x2a37aa[_0x5148('0x32')]=_[_0x5148('0x2d')](_0x1a80ba,_0x5148('0x2a'));_0x2a37aa['query']=_[_0x5148('0x33')](_0x2007d0[_0x5148('0x34')]);_0x2a37aa[_0x5148('0x35')]=_['intersection'](_0x2a37aa[_0x5148('0x32')],_0x2a37aa[_0x5148('0x34')]);_0x1e9123[_0x5148('0x36')]=_[_0x5148('0x37')](_0x2a37aa[_0x5148('0x32')],qs[_0x5148('0x38')](_0x2007d0[_0x5148('0x34')][_0x5148('0x38')]));_0x1e9123[_0x5148('0x36')]=_0x1e9123[_0x5148('0x36')][_0x5148('0x39')]?_0x1e9123[_0x5148('0x36')]:_0x2a37aa[_0x5148('0x32')];if(!_0x2007d0[_0x5148('0x34')]['hasOwnProperty'](_0x5148('0x3a'))){_0x1e9123[_0x5148('0x1e')]=qs['limit'](_0x2007d0['query'][_0x5148('0x1e')]);_0x1e9123[_0x5148('0x1b')]=qs[_0x5148('0x1b')](_0x2007d0['query']['offset']);}_0x1e9123[_0x5148('0x3b')]=qs['sort'](_0x2007d0['query'][_0x5148('0x3c')]);_0x1e9123[_0x5148('0x3d')]=qs[_0x5148('0x35')](_[_0x5148('0x3e')](_0x2007d0[_0x5148('0x34')],_0x2a37aa[_0x5148('0x35')]),_0x1a80ba);if(_0x2007d0[_0x5148('0x34')][_0x5148('0x3f')]){_0x1e9123[_0x5148('0x3d')]=_[_0x5148('0x40')](_0x1e9123[_0x5148('0x3d')],{'$or':_[_0x5148('0x2d')](_0x1a80ba,function(_0xe9d8fe){if(_0xe9d8fe[_0x5148('0x31')]!==_0x5148('0x41')){var _0xe681b1={};_0xe681b1[_0xe9d8fe[_0x5148('0x2a')]]={'$like':'%'+_0x2007d0[_0x5148('0x34')]['filter']+'%'};return _0xe681b1;}})});}_0x1e9123=_[_0x5148('0x40')]({},_0x1e9123,_0x2007d0['options']);var _0x340b82={'where':_0x1e9123[_0x5148('0x3d')]};return db['ZohoField']['count'](_0x340b82)[_0x5148('0x26')](function(_0x30c640){_0x49daab[_0x5148('0x1d')]=_0x30c640;if(_0x2007d0[_0x5148('0x34')]['includeAll']){_0x1e9123[_0x5148('0x42')]=[{'all':!![]}];}return db['ZohoField'][_0x5148('0x43')](_0x1e9123);})[_0x5148('0x26')](function(_0x39df91){_0x49daab[_0x5148('0x44')]=_0x39df91;return _0x49daab;})[_0x5148('0x26')](respondWithFilteredResult(_0x55b4f2,_0x1e9123))['catch'](handleError(_0x55b4f2,null));};exports[_0x5148('0x45')]=function(_0x4a0a5c,_0x39567e){var _0x24c4e6={'raw':!![],'where':{'id':_0x4a0a5c['params']['id']}},_0x3413cb={};_0x3413cb[_0x5148('0x32')]=_['keys'](db[_0x5148('0x2e')]['rawAttributes']);_0x3413cb['query']=_['keys'](_0x4a0a5c['query']);_0x3413cb['filters']=_[_0x5148('0x37')](_0x3413cb[_0x5148('0x32')],_0x3413cb[_0x5148('0x34')]);_0x24c4e6['attributes']=_[_0x5148('0x37')](_0x3413cb[_0x5148('0x32')],qs[_0x5148('0x38')](_0x4a0a5c[_0x5148('0x34')][_0x5148('0x38')]));_0x24c4e6[_0x5148('0x36')]=_0x24c4e6[_0x5148('0x36')][_0x5148('0x39')]?_0x24c4e6[_0x5148('0x36')]:_0x3413cb[_0x5148('0x32')];if(_0x4a0a5c['query'][_0x5148('0x46')]){_0x24c4e6[_0x5148('0x42')]=[{'all':!![]}];}_0x24c4e6=_[_0x5148('0x40')]({},_0x24c4e6,_0x4a0a5c['options']);return db['ZohoField'][_0x5148('0x47')](_0x24c4e6)['then'](handleEntityNotFound(_0x39567e,null))[_0x5148('0x26')](respondWithResult(_0x39567e,null))[_0x5148('0x48')](handleError(_0x39567e,null));};exports['create']=function(_0x2af42a,_0x4e467f){return db[_0x5148('0x2e')][_0x5148('0x49')](_0x2af42a['body'],{})['then'](respondWithResult(_0x4e467f,0xc9))['catch'](handleError(_0x4e467f,null));};exports[_0x5148('0x24')]=function(_0x11243d,_0x8a873a){if(_0x11243d['body']['id']){delete _0x11243d['body']['id'];}return db['ZohoField'][_0x5148('0x47')]({'where':{'id':_0x11243d[_0x5148('0x4a')]['id']}})[_0x5148('0x26')](handleEntityNotFound(_0x8a873a,null))['then'](saveUpdates(_0x11243d[_0x5148('0x4b')],null))[_0x5148('0x26')](respondWithResult(_0x8a873a,null))[_0x5148('0x48')](handleError(_0x8a873a,null));};exports[_0x5148('0x25')]=function(_0x4cf0c2,_0x7cc179){return db['ZohoField'][_0x5148('0x47')]({'where':{'id':_0x4cf0c2[_0x5148('0x4a')]['id']}})[_0x5148('0x26')](handleEntityNotFound(_0x7cc179,null))[_0x5148('0x26')](removeEntity(_0x7cc179,null))[_0x5148('0x48')](handleError(_0x7cc179,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 4a6f897..8854633 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 _0xc4aa=['api','moment','bluebird','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','FieldId','lodash','util','../../config/logger'];(function(_0x151132,_0x32026a){var _0x13c2ad=function(_0x4dcd81){while(--_0x4dcd81){_0x151132['push'](_0x151132['shift']());}};_0x13c2ad(++_0x32026a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc4aa[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0xac4a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf61e=['idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields','zoho_unique_index'];(function(_0x136dbb,_0x2b0666){var _0x6a5309=function(_0x2635af){while(--_0x2635af){_0x136dbb['push'](_0x136dbb['shift']());}};_0x6a5309(++_0x2b0666);}(_0xf61e,0x191));var _0xef61=function(_0x59fe0a,_0x5b8d93){_0x59fe0a=_0x59fe0a-0x0;var _0xa951c0=_0xf61e[_0x59fe0a];return _0xa951c0;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var logger=require(_0xef61('0x2'))(_0xef61('0x3'));var moment=require(_0xef61('0x4'));var BPromise=require(_0xef61('0x5'));var rp=require(_0xef61('0x6'));var fs=require('fs');var path=require(_0xef61('0x7'));var rimraf=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var attributes=require(_0xef61('0xa'));module[_0xef61('0xb')]=function(_0x5b00b2,_0x9e17f4){return _0x5b00b2[_0xef61('0xc')]('ZohoField',attributes,{'tableName':_0xef61('0xd'),'paranoid':![],'indexes':[{'name':_0xef61('0xe'),'fields':[_0xef61('0xf'),'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 5c1d2c7..c69d7b2 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 _0x61e1=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x53d96f,_0x5d61b9){var _0x2cbe14=function(_0xf2b258){while(--_0xf2b258){_0x53d96f['push'](_0x53d96f['shift']());}};_0x2cbe14(++_0x5d61b9);}(_0x61e1,0x1f4));var _0x161e=function(_0x55afe3,_0x37774c){_0x55afe3=_0x55afe3-0x0;var _0x1b93c1=_0x61e1[_0x55afe3];return _0x1b93c1;};'use strict';var _=require(_0x161e('0x0'));var util=require(_0x161e('0x1'));var moment=require(_0x161e('0x2'));var BPromise=require(_0x161e('0x3'));var rs=require(_0x161e('0x4'));var fs=require('fs');var Redis=require(_0x161e('0x5'));var db=require(_0x161e('0x6'))['db'];var utils=require(_0x161e('0x7'));var logger=require(_0x161e('0x8'))('rpc');var config=require(_0x161e('0x9'));var jayson=require(_0x161e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xcd005b,_0x4b938f,_0x40bf33){return new BPromise(function(_0x53acb3,_0x5a9b10){return client[_0x161e('0xb')](_0xcd005b,_0x40bf33)[_0x161e('0xc')](function(_0x249375){logger[_0x161e('0xd')](_0x161e('0xe'),_0x4b938f,_0x161e('0xf'));logger[_0x161e('0x10')](_0x161e('0x11'),_0x4b938f,_0x161e('0xf'),JSON[_0x161e('0x12')](_0x249375));if(_0x249375['error']){if(_0x249375['error'][_0x161e('0x13')]===0x1f4){logger['error'](_0x161e('0xe'),_0x4b938f,_0x249375[_0x161e('0x14')][_0x161e('0x15')]);return _0x5a9b10(_0x249375[_0x161e('0x14')][_0x161e('0x15')]);}logger[_0x161e('0x14')]('ZohoField,\x20%s,\x20%s',_0x4b938f,_0x249375['error']['message']);return _0x53acb3(_0x249375[_0x161e('0x14')][_0x161e('0x15')]);}else{logger[_0x161e('0xd')]('ZohoField,\x20%s,\x20%s',_0x4b938f,_0x161e('0xf'));_0x53acb3(_0x249375[_0x161e('0x16')][_0x161e('0x15')]);}})['catch'](function(_0x26986c){logger[_0x161e('0x14')](_0x161e('0xe'),_0x4b938f,_0x26986c);_0x5a9b10(_0x26986c);});});} \ No newline at end of file +var _0x4415=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x3024ac,_0x53f458){var _0x459e28=function(_0x14469c){while(--_0x14469c){_0x3024ac['push'](_0x3024ac['shift']());}};_0x459e28(++_0x53f458);}(_0x4415,0x83));var _0x5441=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x4415[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x5441('0x0'));var util=require(_0x5441('0x1'));var moment=require(_0x5441('0x2'));var BPromise=require(_0x5441('0x3'));var rs=require(_0x5441('0x4'));var fs=require('fs');var Redis=require(_0x5441('0x5'));var db=require(_0x5441('0x6'))['db'];var utils=require(_0x5441('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5441('0x8'));var client=jayson[_0x5441('0x9')][_0x5441('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2debdc,_0x3e3660,_0x3f5ea5){return new BPromise(function(_0x5b1669,_0x7248ce){return client[_0x5441('0xb')](_0x2debdc,_0x3f5ea5)['then'](function(_0x14703d){logger[_0x5441('0xc')](_0x5441('0xd'),_0x3e3660,'request\x20sent');logger[_0x5441('0xe')](_0x5441('0xf'),_0x3e3660,_0x5441('0x10'),JSON['stringify'](_0x14703d));if(_0x14703d[_0x5441('0x11')]){if(_0x14703d[_0x5441('0x11')][_0x5441('0x12')]===0x1f4){logger[_0x5441('0x11')](_0x5441('0xd'),_0x3e3660,_0x14703d['error']['message']);return _0x7248ce(_0x14703d[_0x5441('0x11')][_0x5441('0x13')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x3e3660,_0x14703d[_0x5441('0x11')][_0x5441('0x13')]);return _0x5b1669(_0x14703d[_0x5441('0x11')][_0x5441('0x13')]);}else{logger[_0x5441('0xc')](_0x5441('0xd'),_0x3e3660,'request\x20sent');_0x5b1669(_0x14703d[_0x5441('0x14')][_0x5441('0x13')]);}})[_0x5441('0x15')](function(_0x354ae3){logger[_0x5441('0x11')](_0x5441('0xd'),_0x3e3660,_0x354ae3);_0x7248ce(_0x354ae3);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index aa6a1c4..dd970f6 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x43cf19,_0x28c10b){var _0x97a427=function(_0x1579b4){while(--_0x1579b4){_0x43cf19['push'](_0x43cf19['shift']());}};_0x97a427(++_0x28c10b);}(_0xe706,0xa3));var _0x6e70=function(_0x50f9ab,_0x5009b4){_0x50f9ab=_0x50f9ab-0x0;var _0x58dda4=_0xe706[_0x50f9ab];return _0x58dda4;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3f761d,_0x5d907d){var _0x49d6e3=function(_0x39ab43){while(--_0x39ab43){_0x3f761d['push'](_0x3f761d['shift']());}};_0x49d6e3(++_0x5d907d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 7ba2ade..39946f9 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 _0x6cf8=['STRING','unique_name_and_version','INTEGER','BOOLEAN','sequelize'];(function(_0x2365db,_0x4ea500){var _0x2bee41=function(_0x617f7b){while(--_0x617f7b){_0x2365db['push'](_0x2365db['shift']());}};_0x2bee41(++_0x4ea500);}(_0x6cf8,0x185));var _0x86cf=function(_0x1a2257,_0x2e70c2){_0x1a2257=_0x1a2257-0x0;var _0x30e9d5=_0x6cf8[_0x1a2257];return _0x30e9d5;};'use strict';var Sequelize=require(_0x86cf('0x0'));module['exports']={'name':{'type':Sequelize[_0x86cf('0x1')],'allowNull':![],'unique':_0x86cf('0x2')},'version':{'type':Sequelize[_0x86cf('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x86cf('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x86cf('0x1')]},'path':{'type':Sequelize[_0x86cf('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x86cf('0x3')]},'active':{'type':Sequelize[_0x86cf('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x86cf('0x1')]},'logo':{'type':Sequelize[_0x86cf('0x1')]},'state':{'type':Sequelize[_0x86cf('0x1')],'unique':'state'},'description':{'type':Sequelize[_0x86cf('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x86cf('0x1')]},'link':{'type':Sequelize[_0x86cf('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x24a9=['STRING','INTEGER','BOOLEAN','sequelize','exports','unique_name_and_version'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x24a9,0xf9));var _0x924a=function(_0x19353f,_0x5b84c1){_0x19353f=_0x19353f-0x0;var _0x3d5364=_0x24a9[_0x19353f];return _0x3d5364;};'use strict';var Sequelize=require(_0x924a('0x0'));module[_0x924a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x924a('0x2')},'version':{'type':Sequelize[_0x924a('0x3')],'allowNull':![],'unique':_0x924a('0x2')},'main':{'type':Sequelize[_0x924a('0x3')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x924a('0x3')]},'path':{'type':Sequelize[_0x924a('0x3')]},'type':{'type':Sequelize[_0x924a('0x3')]},'size':{'type':Sequelize[_0x924a('0x4')]},'active':{'type':Sequelize[_0x924a('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x924a('0x3')]},'state':{'type':Sequelize[_0x924a('0x3')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x924a('0x3')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 39dd7da..2d6fb32 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 _0x47c5=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','Integration'];(function(_0x4669e3,_0x2d63d2){var _0x5992fb=function(_0xc532ae){while(--_0xc532ae){_0x4669e3['push'](_0x4669e3['shift']());}};_0x5992fb(++_0x2d63d2);}(_0x47c5,0x165));var _0x547c=function(_0x36940e,_0x11f338){_0x36940e=_0x36940e-0x0;var _0x3283f2=_0x47c5[_0x36940e];return _0x3283f2;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['Integration'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['Integration']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['Integration'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['Integration'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));}; \ No newline at end of file +var _0x6d38=['sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','filters','intersection','create','catch','body','find','params','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','Integration','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order'];(function(_0x215393,_0x4c406d){var _0x595198=function(_0x5d641f){while(--_0x5d641f){_0x215393['push'](_0x215393['shift']());}};_0x595198(++_0x4c406d);}(_0x6d38,0x1ef));var _0x86d3=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x6d38[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['Integration'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')](_0x412d0e['body'],{})[_0x86d3('0x20')](respondWithResult(_0xd20863,0xc9))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x14fa58,_0x369b75){if(_0x14fa58[_0x86d3('0x41')]['id']){delete _0x14fa58[_0x86d3('0x41')]['id'];}return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x14fa58[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x369b75,null))[_0x86d3('0x20')](saveUpdates(_0x14fa58['body'],null))[_0x86d3('0x20')](respondWithResult(_0x369b75,null))[_0x86d3('0x40')](handleError(_0x369b75,null));};exports['destroy']=function(_0x43290d,_0x23a6ee){return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x43290d[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x23a6ee,null))['then'](removeEntity(_0x23a6ee,null))['catch'](handleError(_0x23a6ee,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 2f47531..9da11ee 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 _0xb61c=['exports','define','Integration','integrations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes'];(function(_0x500a65,_0x1a392e){var _0x27d597=function(_0x5b2aa5){while(--_0x5b2aa5){_0x500a65['push'](_0x500a65['shift']());}};_0x27d597(++_0x1a392e);}(_0xb61c,0x1e0));var _0xcb61=function(_0x4c21d1,_0x48401e){_0x4c21d1=_0x4c21d1-0x0;var _0xeda8cb=_0xb61c[_0x4c21d1];return _0xeda8cb;};'use strict';var _=require('lodash');var util=require(_0xcb61('0x0'));var logger=require(_0xcb61('0x1'))(_0xcb61('0x2'));var moment=require(_0xcb61('0x3'));var BPromise=require(_0xcb61('0x4'));var rp=require(_0xcb61('0x5'));var fs=require('fs');var path=require(_0xcb61('0x6'));var rimraf=require(_0xcb61('0x7'));var config=require(_0xcb61('0x8'));var attributes=require(_0xcb61('0x9'));module[_0xcb61('0xa')]=function(_0x15034b,_0x1ad9de){return _0x15034b[_0xcb61('0xb')](_0xcb61('0xc'),attributes,{'tableName':_0xcb61('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6839=['bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','Integration','integrations','util','api','moment'];(function(_0x58eaf2,_0x35d243){var _0x5466d1=function(_0x401fcb){while(--_0x401fcb){_0x58eaf2['push'](_0x58eaf2['shift']());}};_0x5466d1(++_0x35d243);}(_0x6839,0x13c));var _0x9683=function(_0x29c2f7,_0x1ffb8b){_0x29c2f7=_0x29c2f7-0x0;var _0x3582e6=_0x6839[_0x29c2f7];return _0x3582e6;};'use strict';var _=require('lodash');var util=require(_0x9683('0x0'));var logger=require('../../config/logger')(_0x9683('0x1'));var moment=require(_0x9683('0x2'));var BPromise=require(_0x9683('0x3'));var rp=require(_0x9683('0x4'));var fs=require('fs');var path=require(_0x9683('0x5'));var rimraf=require(_0x9683('0x6'));var config=require(_0x9683('0x7'));var attributes=require(_0x9683('0x8'));module['exports']=function(_0x52da5a,_0x40afdb){return _0x52da5a['define'](_0x9683('0x9'),attributes,{'tableName':_0x9683('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 f80fe75..7dd0491 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(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x4975,0x86));var _0x5497=function(_0x16dba3,_0x517f2b){_0x16dba3=_0x16dba3-0x0;var _0x544ed5=_0x4975[_0x16dba3];return _0x544ed5;};'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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x505684,_0x2c1dc9){var _0x4389b0=function(_0x86b26e){while(--_0x86b26e){_0x505684['push'](_0x505684['shift']());}};_0x4389b0(++_0x2c1dc9);}(_0xadb5,0xad));var _0x5adb=function(_0x102142,_0x34a4b3){_0x102142=_0x102142-0x0;var _0x3ecf94=_0xadb5[_0x102142];return _0x3ecf94;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index d1e76e5..a219cca 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 _0xef0f=['update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x3c9826,_0x2ab042){var _0x57090e=function(_0x487501){while(--_0x487501){_0x3c9826['push'](_0x3c9826['shift']());}};_0x57090e(++_0x2ab042);}(_0xef0f,0x168));var _0xfef0=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0xef0f[_0x4207f4];return _0x29a621;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['get'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xe')]);router[_0xfef0('0xf')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x11')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x13')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x14')]);module['exports']=router; \ No newline at end of file +var _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xdb28,0x106));var _0x8db2=function(_0x32a2ce,_0x25e7f0){_0x32a2ce=_0x32a2ce-0x0;var _0xba4907=_0xdb28[_0x32a2ce];return _0xba4907;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./integrationReport.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post']('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x11')]);router['delete'](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x12')]);module[_0x8db2('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 7bf719e..44a26c4 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 _0x23b7=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','FAILED','sequelize','STRING'];(function(_0x22ffbf,_0x16f31e){var _0x360c17=function(_0x40807f){while(--_0x40807f){_0x22ffbf['push'](_0x22ffbf['shift']());}};_0x360c17(++_0x16f31e);}(_0x23b7,0xbc));var _0x723b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x23b7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x723b('0x0'));module['exports']={'integration':{'type':Sequelize[_0x723b('0x1')]},'eventChannel':{'type':Sequelize[_0x723b('0x1')]},'exitStatus':{'type':Sequelize[_0x723b('0x1')]},'ticketId':{'type':Sequelize[_0x723b('0x1')]},'integrationId':{'type':Sequelize[_0x723b('0x2')]},'contacts':{'type':Sequelize[_0x723b('0x1')]},'uniqueid':{'type':Sequelize[_0x723b('0x1')]},'calleridnum':{'type':Sequelize[_0x723b('0x1')]},'calleridname':{'type':Sequelize[_0x723b('0x1')]},'queue':{'type':Sequelize[_0x723b('0x1')]},'interface':{'type':Sequelize[_0x723b('0x1')]},'membername':{'type':Sequelize[_0x723b('0x1')]},'agentcalledAt':{'type':Sequelize[_0x723b('0x3')]},'agentconnectAt':{'type':Sequelize[_0x723b('0x3')]},'holdtime':{'type':Sequelize[_0x723b('0x2')]},'agentcomplete':{'type':Sequelize[_0x723b('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x723b('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x723b('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x723b('0x2')]},'reason':{'type':Sequelize[_0x723b('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x723b('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x723b('0x3')]},'agentdump':{'type':Sequelize[_0x723b('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x723b('0x3')]},'lastevent':{'type':Sequelize[_0x723b('0x1')]},'channel':{'type':Sequelize[_0x723b('0x1')]},'channelstate':{'type':Sequelize[_0x723b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x723b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x723b('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x723b('0x1')]},'accountcode':{'type':Sequelize[_0x723b('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x723b('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x723b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x723b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x723b('0x1')]},'destlanguage':{'type':Sequelize[_0x723b('0x1')]},'destaccountcode':{'type':Sequelize[_0x723b('0x1')]},'destcontext':{'type':Sequelize[_0x723b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x723b('0x1')]},'destuniqueid':{'type':Sequelize[_0x723b('0x1')]},'messageId':{'type':Sequelize[_0x723b('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x723b('0x1')]},'from':{'type':Sequelize[_0x723b('0x1')]},'to':{'type':Sequelize[_0x723b('0x1')]},'cc':{'type':Sequelize[_0x723b('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x723b('0x5')]},'status':{'type':Sequelize[_0x723b('0x6')](_0x723b('0x7'),_0x723b('0x8'),'RECEIVED',_0x723b('0x9'))},'url':{'type':Sequelize[_0x723b('0x1')]},'app':{'type':Sequelize[_0x723b('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3a56=['BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x4a4d65,_0x40f693){var _0x3f9905=function(_0x1e0b8f){while(--_0x1e0b8f){_0x4a4d65['push'](_0x4a4d65['shift']());}};_0x3f9905(++_0x40f693);}(_0x3a56,0xed));var _0x63a5=function(_0x3eb630,_0x552586){_0x3eb630=_0x3eb630-0x0;var _0x1b840d=_0x3a56[_0x3eb630];return _0x1b840d;};'use strict';var Sequelize=require(_0x63a5('0x0'));module[_0x63a5('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x63a5('0x2')]},'exitStatus':{'type':Sequelize[_0x63a5('0x2')]},'ticketId':{'type':Sequelize[_0x63a5('0x2')]},'integrationId':{'type':Sequelize[_0x63a5('0x3')]},'contacts':{'type':Sequelize[_0x63a5('0x2')]},'uniqueid':{'type':Sequelize[_0x63a5('0x2')]},'calleridnum':{'type':Sequelize[_0x63a5('0x2')]},'calleridname':{'type':Sequelize[_0x63a5('0x2')]},'queue':{'type':Sequelize[_0x63a5('0x2')]},'interface':{'type':Sequelize[_0x63a5('0x2')]},'membername':{'type':Sequelize[_0x63a5('0x2')]},'agentcalledAt':{'type':Sequelize[_0x63a5('0x4')]},'agentconnectAt':{'type':Sequelize[_0x63a5('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x63a5('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x63a5('0x4')]},'talktime':{'type':Sequelize[_0x63a5('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x63a5('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x63a5('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x63a5('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x63a5('0x2')]},'channel':{'type':Sequelize[_0x63a5('0x2')]},'channelstate':{'type':Sequelize[_0x63a5('0x3')]},'channelstatedesc':{'type':Sequelize[_0x63a5('0x2')]},'connectedlinenum':{'type':Sequelize[_0x63a5('0x2')]},'connectedlinename':{'type':Sequelize[_0x63a5('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x63a5('0x2')]},'context':{'type':Sequelize[_0x63a5('0x2')]},'exten':{'type':Sequelize[_0x63a5('0x2')]},'priority':{'type':Sequelize[_0x63a5('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x63a5('0x2')]},'destcalleridnum':{'type':Sequelize[_0x63a5('0x2')]},'destcalleridname':{'type':Sequelize[_0x63a5('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x63a5('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x63a5('0x2')]},'destlanguage':{'type':Sequelize[_0x63a5('0x2')]},'destaccountcode':{'type':Sequelize[_0x63a5('0x2')]},'destcontext':{'type':Sequelize[_0x63a5('0x2')]},'destexten':{'type':Sequelize[_0x63a5('0x2')]},'destpriority':{'type':Sequelize[_0x63a5('0x2')]},'destuniqueid':{'type':Sequelize[_0x63a5('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x63a5('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x63a5('0x2')]},'attachment':{'type':Sequelize[_0x63a5('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x63a5('0x6')]},'status':{'type':Sequelize['ENUM'](_0x63a5('0x7'),_0x63a5('0x8'),_0x63a5('0x9'),_0x63a5('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x63a5('0x2')]},'appdata':{'type':Sequelize[_0x63a5('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 faf71e9..f8a3775 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 _0x5e5d=['path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','rawAttributes','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','IntegrationReport','includeAll','include','findAll','rows','show','intersection','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x5e5d,0x192));var _0xd5e5=function(_0x2c6510,_0x5dcf4b){_0x2c6510=_0x2c6510-0x0;var _0x1e8e37=_0x5e5d[_0x2c6510];return _0x1e8e37;};'use strict';var emlformat=require(_0xd5e5('0x0'));var rimraf=require(_0xd5e5('0x1'));var zipdir=require(_0xd5e5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd5e5('0x3'));var moment=require(_0xd5e5('0x4'));var BPromise=require(_0xd5e5('0x5'));var Mustache=require(_0xd5e5('0x6'));var util=require(_0xd5e5('0x7'));var path=require(_0xd5e5('0x8'));var sox=require('sox');var csv=require(_0xd5e5('0x9'));var ejs=require(_0xd5e5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5e5('0xb'));var squel=require(_0xd5e5('0xc'));var crypto=require(_0xd5e5('0xd'));var jsforce=require(_0xd5e5('0xe'));var deskjs=require(_0xd5e5('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd5e5('0x10'));var Papa=require(_0xd5e5('0x11'));var Redis=require(_0xd5e5('0x12'));var authService=require(_0xd5e5('0x13'));var qs=require(_0xd5e5('0x14'));var as=require(_0xd5e5('0x15'));var hardwareService=require(_0xd5e5('0x16'));var logger=require(_0xd5e5('0x17'))(_0xd5e5('0x18'));var utils=require(_0xd5e5('0x19'));var config=require(_0xd5e5('0x1a'));var licenseUtil=require(_0xd5e5('0x1b'));var db=require(_0xd5e5('0x1c'))['db'];function respondWithStatusCode(_0x2e3a49,_0x3801c2){_0x3801c2=_0x3801c2||0xcc;return function(_0x5e2cb2){if(_0x5e2cb2){return _0x2e3a49[_0xd5e5('0x1d')](_0x3801c2);}return _0x2e3a49['status'](_0x3801c2)[_0xd5e5('0x1e')]();};}function respondWithResult(_0x442dbe,_0x4e1a08){_0x4e1a08=_0x4e1a08||0xc8;return function(_0x24110b){if(_0x24110b){return _0x442dbe[_0xd5e5('0x1f')](_0x4e1a08)[_0xd5e5('0x20')](_0x24110b);}};}function respondWithFilteredResult(_0x3f2536,_0xf4324c){return function(_0xa1d84e){if(_0xa1d84e){var _0x417e04=typeof _0xf4324c['offset']==='undefined'&&typeof _0xf4324c[_0xd5e5('0x21')]===_0xd5e5('0x22');var _0x5d4d9c=_0xa1d84e[_0xd5e5('0x23')];var _0x12c8a6=_0x417e04?0x0:_0xf4324c['offset'];var _0x146b8a=_0x417e04?_0xa1d84e[_0xd5e5('0x23')]:_0xf4324c[_0xd5e5('0x24')]+_0xf4324c['limit'];var _0x3660ad;if(_0x146b8a>=_0x5d4d9c){_0x146b8a=_0x5d4d9c;_0x3660ad=0xc8;}else{_0x3660ad=0xce;}_0x3f2536[_0xd5e5('0x1f')](_0x3660ad);return _0x3f2536[_0xd5e5('0x25')](_0xd5e5('0x26'),_0x12c8a6+'-'+_0x146b8a+'/'+_0x5d4d9c)[_0xd5e5('0x20')](_0xa1d84e);}return null;};}function patchUpdates(_0x2275e0){return function(_0x2f5307){try{jsonpatch[_0xd5e5('0x27')](_0x2f5307,_0x2275e0,!![]);}catch(_0x5eeef5){return BPromise['reject'](_0x5eeef5);}return _0x2f5307[_0xd5e5('0x28')]();};}function saveUpdates(_0x1341ce,_0x48bb30){return function(_0x197c15){if(_0x197c15){return _0x197c15[_0xd5e5('0x29')](_0x1341ce)[_0xd5e5('0x2a')](function(_0x2dfeb4){return _0x2dfeb4;});}return null;};}function removeEntity(_0x3fa704,_0x5306ef){return function(_0x4bd354){if(_0x4bd354){return _0x4bd354[_0xd5e5('0x2b')]()[_0xd5e5('0x2a')](function(){_0x3fa704[_0xd5e5('0x1f')](0xcc)[_0xd5e5('0x1e')]();});}};}function handleEntityNotFound(_0x27f3d1,_0x1cc7e1){return function(_0x4a26a4){if(!_0x4a26a4){_0x27f3d1[_0xd5e5('0x1d')](0x194);}return _0x4a26a4;};}function handleError(_0x16f67c,_0x25e775){_0x25e775=_0x25e775||0x1f4;return function(_0x44a048){logger[_0xd5e5('0x2c')](_0x44a048[_0xd5e5('0x2d')]);if(_0x44a048[_0xd5e5('0x2e')]){delete _0x44a048['name'];}_0x16f67c[_0xd5e5('0x1f')](_0x25e775)['send'](_0x44a048);};}exports[_0xd5e5('0x2f')]=function(_0x4185da,_0x47fac5){var _0x3d68ed={},_0x1fc259={},_0x1f3fad={'count':0x0,'rows':[]};var _0x4ac5b1=_[_0xd5e5('0x30')](db['IntegrationReport'][_0xd5e5('0x31')],function(_0x3ead5c){return{'name':_0x3ead5c['fieldName'],'type':_0x3ead5c['type'][_0xd5e5('0x32')]};});_0x1fc259[_0xd5e5('0x33')]=_[_0xd5e5('0x30')](_0x4ac5b1,'name');_0x1fc259[_0xd5e5('0x34')]=_[_0xd5e5('0x35')](_0x4185da[_0xd5e5('0x34')]);_0x1fc259[_0xd5e5('0x36')]=_['intersection'](_0x1fc259['model'],_0x1fc259[_0xd5e5('0x34')]);_0x3d68ed['attributes']=_['intersection'](_0x1fc259[_0xd5e5('0x33')],qs[_0xd5e5('0x37')](_0x4185da[_0xd5e5('0x34')][_0xd5e5('0x37')]));_0x3d68ed[_0xd5e5('0x38')]=_0x3d68ed[_0xd5e5('0x38')][_0xd5e5('0x39')]?_0x3d68ed['attributes']:_0x1fc259[_0xd5e5('0x33')];if(!_0x4185da[_0xd5e5('0x34')][_0xd5e5('0x3a')](_0xd5e5('0x3b'))){_0x3d68ed[_0xd5e5('0x21')]=qs['limit'](_0x4185da[_0xd5e5('0x34')][_0xd5e5('0x21')]);_0x3d68ed[_0xd5e5('0x24')]=qs[_0xd5e5('0x24')](_0x4185da['query'][_0xd5e5('0x24')]);}_0x3d68ed[_0xd5e5('0x3c')]=qs[_0xd5e5('0x3d')](_0x4185da[_0xd5e5('0x34')][_0xd5e5('0x3d')]);_0x3d68ed[_0xd5e5('0x3e')]=qs['filters'](_[_0xd5e5('0x3f')](_0x4185da['query'],_0x1fc259['filters']),_0x4ac5b1);if(_0x4185da['query'][_0xd5e5('0x40')]){_0x3d68ed['where']=_[_0xd5e5('0x41')](_0x3d68ed[_0xd5e5('0x3e')],{'$or':_[_0xd5e5('0x30')](_0x4ac5b1,function(_0x343d72){if(_0x343d72[_0xd5e5('0x42')]!==_0xd5e5('0x43')){var _0x5b9cd9={};_0x5b9cd9[_0x343d72[_0xd5e5('0x2e')]]={'$like':'%'+_0x4185da[_0xd5e5('0x34')][_0xd5e5('0x40')]+'%'};return _0x5b9cd9;}})});}_0x3d68ed=_[_0xd5e5('0x41')]({},_0x3d68ed,_0x4185da[_0xd5e5('0x44')]);var _0x58c2f2={'where':_0x3d68ed['where']};return db[_0xd5e5('0x45')]['count'](_0x58c2f2)[_0xd5e5('0x2a')](function(_0x51701c){_0x1f3fad['count']=_0x51701c;if(_0x4185da[_0xd5e5('0x34')][_0xd5e5('0x46')]){_0x3d68ed[_0xd5e5('0x47')]=[{'all':!![]}];}return db['IntegrationReport'][_0xd5e5('0x48')](_0x3d68ed);})['then'](function(_0x53abf7){_0x1f3fad[_0xd5e5('0x49')]=_0x53abf7;return _0x1f3fad;})['then'](respondWithFilteredResult(_0x47fac5,_0x3d68ed))['catch'](handleError(_0x47fac5,null));};exports[_0xd5e5('0x4a')]=function(_0x23ea89,_0x1b2e0e){var _0xc8dec={'raw':![],'where':{'id':_0x23ea89['params']['id']}},_0x1fdffd={};_0x1fdffd['model']=_[_0xd5e5('0x35')](db[_0xd5e5('0x45')][_0xd5e5('0x31')]);_0x1fdffd[_0xd5e5('0x34')]=_[_0xd5e5('0x35')](_0x23ea89[_0xd5e5('0x34')]);_0x1fdffd['filters']=_[_0xd5e5('0x4b')](_0x1fdffd[_0xd5e5('0x33')],_0x1fdffd[_0xd5e5('0x34')]);_0xc8dec['attributes']=_[_0xd5e5('0x4b')](_0x1fdffd[_0xd5e5('0x33')],qs[_0xd5e5('0x37')](_0x23ea89[_0xd5e5('0x34')][_0xd5e5('0x37')]));_0xc8dec['attributes']=_0xc8dec[_0xd5e5('0x38')][_0xd5e5('0x39')]?_0xc8dec[_0xd5e5('0x38')]:_0x1fdffd[_0xd5e5('0x33')];if(_0x23ea89['query']['includeAll']){_0xc8dec[_0xd5e5('0x47')]=[{'all':!![]}];}_0xc8dec=_[_0xd5e5('0x41')]({},_0xc8dec,_0x23ea89['options']);return db[_0xd5e5('0x45')]['find'](_0xc8dec)[_0xd5e5('0x2a')](handleEntityNotFound(_0x1b2e0e,null))[_0xd5e5('0x2a')](respondWithResult(_0x1b2e0e,null))[_0xd5e5('0x4c')](handleError(_0x1b2e0e,null));};exports[_0xd5e5('0x4d')]=function(_0x28e165,_0x289cbd){return db[_0xd5e5('0x45')]['create'](_0x28e165['body'],{})[_0xd5e5('0x2a')](respondWithResult(_0x289cbd,0xc9))[_0xd5e5('0x4c')](handleError(_0x289cbd,null));};exports[_0xd5e5('0x29')]=function(_0x54dfac,_0x5da12c){if(_0x54dfac[_0xd5e5('0x4e')]['id']){delete _0x54dfac[_0xd5e5('0x4e')]['id'];}return db[_0xd5e5('0x45')][_0xd5e5('0x4f')]({'where':{'id':_0x54dfac[_0xd5e5('0x50')]['id']}})[_0xd5e5('0x2a')](handleEntityNotFound(_0x5da12c,null))[_0xd5e5('0x2a')](saveUpdates(_0x54dfac['body'],null))[_0xd5e5('0x2a')](respondWithResult(_0x5da12c,null))[_0xd5e5('0x4c')](handleError(_0x5da12c,null));};exports[_0xd5e5('0x2b')]=function(_0x2b8301,_0x539d6c){return db[_0xd5e5('0x45')][_0xd5e5('0x4f')]({'where':{'id':_0x2b8301[_0xd5e5('0x50')]['id']}})[_0xd5e5('0x2a')](handleEntityNotFound(_0x539d6c,null))['then'](removeEntity(_0x539d6c,null))['catch'](handleError(_0x539d6c,null));};exports['describe']=function(_0x2328b6,_0x139416){return db['IntegrationReport'][_0xd5e5('0x51')]()['then'](respondWithResult(_0x139416,null))['catch'](handleError(_0x139416,null));}; \ No newline at end of file +var _0x60e6=['undefined','limit','offset','Content-Range','apply','reject','update','destroy','end','error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','then','includeAll','include','findAll','rows','catch','show','params','filters','intersection','length','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x3eaed3,_0x575569){var _0x23397c=function(_0x1941f4){while(--_0x1941f4){_0x3eaed3['push'](_0x3eaed3['shift']());}};_0x23397c(++_0x575569);}(_0x60e6,0x15e));var _0x660e=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x60e6[_0x11c573];return _0x6b72de;};'use strict';var emlformat=require(_0x660e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x660e('0x1'));var jsonpatch=require(_0x660e('0x2'));var rp=require('request-promise');var moment=require(_0x660e('0x3'));var BPromise=require(_0x660e('0x4'));var Mustache=require(_0x660e('0x5'));var util=require(_0x660e('0x6'));var path=require(_0x660e('0x7'));var sox=require(_0x660e('0x8'));var csv=require('to-csv');var ejs=require(_0x660e('0x9'));var fs=require('fs');var fs_extra=require(_0x660e('0xa'));var _=require(_0x660e('0xb'));var squel=require(_0x660e('0xc'));var crypto=require('crypto');var jsforce=require(_0x660e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x660e('0xe'));var querystring=require(_0x660e('0xf'));var Papa=require(_0x660e('0x10'));var Redis=require(_0x660e('0x11'));var authService=require(_0x660e('0x12'));var qs=require(_0x660e('0x13'));var as=require(_0x660e('0x14'));var hardwareService=require(_0x660e('0x15'));var logger=require('../../config/logger')(_0x660e('0x16'));var utils=require(_0x660e('0x17'));var config=require(_0x660e('0x18'));var licenseUtil=require(_0x660e('0x19'));var db=require(_0x660e('0x1a'))['db'];function respondWithStatusCode(_0x3b8366,_0x5bee93){_0x5bee93=_0x5bee93||0xcc;return function(_0xebea67){if(_0xebea67){return _0x3b8366[_0x660e('0x1b')](_0x5bee93);}return _0x3b8366[_0x660e('0x1c')](_0x5bee93)['end']();};}function respondWithResult(_0x106b17,_0x549544){_0x549544=_0x549544||0xc8;return function(_0x5832dd){if(_0x5832dd){return _0x106b17[_0x660e('0x1c')](_0x549544)[_0x660e('0x1d')](_0x5832dd);}};}function respondWithFilteredResult(_0x456cd8,_0x54a380){return function(_0x3dd6c1){if(_0x3dd6c1){var _0x455a83=typeof _0x54a380['offset']===_0x660e('0x1e')&&typeof _0x54a380[_0x660e('0x1f')]==='undefined';var _0x44d1a4=_0x3dd6c1['count'];var _0x2c6589=_0x455a83?0x0:_0x54a380['offset'];var _0x4e0190=_0x455a83?_0x3dd6c1['count']:_0x54a380[_0x660e('0x20')]+_0x54a380[_0x660e('0x1f')];var _0x2935b6;if(_0x4e0190>=_0x44d1a4){_0x4e0190=_0x44d1a4;_0x2935b6=0xc8;}else{_0x2935b6=0xce;}_0x456cd8[_0x660e('0x1c')](_0x2935b6);return _0x456cd8['set'](_0x660e('0x21'),_0x2c6589+'-'+_0x4e0190+'/'+_0x44d1a4)[_0x660e('0x1d')](_0x3dd6c1);}return null;};}function patchUpdates(_0x455ce1){return function(_0x5e3717){try{jsonpatch[_0x660e('0x22')](_0x5e3717,_0x455ce1,!![]);}catch(_0x3069fa){return BPromise[_0x660e('0x23')](_0x3069fa);}return _0x5e3717['save']();};}function saveUpdates(_0x24b8d3,_0x191c1a){return function(_0x5adc0d){if(_0x5adc0d){return _0x5adc0d[_0x660e('0x24')](_0x24b8d3)['then'](function(_0x5c19d1){return _0x5c19d1;});}return null;};}function removeEntity(_0x59f87e,_0x2c336c){return function(_0x223443){if(_0x223443){return _0x223443[_0x660e('0x25')]()['then'](function(){_0x59f87e['status'](0xcc)[_0x660e('0x26')]();});}};}function handleEntityNotFound(_0x38c177,_0x4c9d70){return function(_0x545fc0){if(!_0x545fc0){_0x38c177[_0x660e('0x1b')](0x194);}return _0x545fc0;};}function handleError(_0x58f643,_0x1e4618){_0x1e4618=_0x1e4618||0x1f4;return function(_0x972ad2){logger[_0x660e('0x27')](_0x972ad2[_0x660e('0x28')]);if(_0x972ad2[_0x660e('0x29')]){delete _0x972ad2[_0x660e('0x29')];}_0x58f643[_0x660e('0x1c')](_0x1e4618)[_0x660e('0x2a')](_0x972ad2);};}exports['index']=function(_0x132163,_0x14237e){var _0x2ecfa2={},_0x3b3e0f={},_0x5c8de0={'count':0x0,'rows':[]};var _0x261867=_[_0x660e('0x2b')](db[_0x660e('0x2c')][_0x660e('0x2d')],function(_0x4a5612){return{'name':_0x4a5612[_0x660e('0x2e')],'type':_0x4a5612[_0x660e('0x2f')]['key']};});_0x3b3e0f[_0x660e('0x30')]=_[_0x660e('0x2b')](_0x261867,_0x660e('0x29'));_0x3b3e0f[_0x660e('0x31')]=_[_0x660e('0x32')](_0x132163['query']);_0x3b3e0f['filters']=_['intersection'](_0x3b3e0f[_0x660e('0x30')],_0x3b3e0f[_0x660e('0x31')]);_0x2ecfa2[_0x660e('0x33')]=_['intersection'](_0x3b3e0f[_0x660e('0x30')],qs[_0x660e('0x34')](_0x132163['query'][_0x660e('0x34')]));_0x2ecfa2[_0x660e('0x33')]=_0x2ecfa2[_0x660e('0x33')]['length']?_0x2ecfa2[_0x660e('0x33')]:_0x3b3e0f[_0x660e('0x30')];if(!_0x132163['query'][_0x660e('0x35')]('nolimit')){_0x2ecfa2[_0x660e('0x1f')]=qs['limit'](_0x132163[_0x660e('0x31')][_0x660e('0x1f')]);_0x2ecfa2[_0x660e('0x20')]=qs[_0x660e('0x20')](_0x132163[_0x660e('0x31')][_0x660e('0x20')]);}_0x2ecfa2[_0x660e('0x36')]=qs[_0x660e('0x37')](_0x132163['query'][_0x660e('0x37')]);_0x2ecfa2[_0x660e('0x38')]=qs['filters'](_[_0x660e('0x39')](_0x132163[_0x660e('0x31')],_0x3b3e0f['filters']),_0x261867);if(_0x132163[_0x660e('0x31')][_0x660e('0x3a')]){_0x2ecfa2['where']=_[_0x660e('0x3b')](_0x2ecfa2[_0x660e('0x38')],{'$or':_['map'](_0x261867,function(_0xdbbb8){if(_0xdbbb8[_0x660e('0x2f')]!==_0x660e('0x3c')){var _0xe49b83={};_0xe49b83[_0xdbbb8['name']]={'$like':'%'+_0x132163[_0x660e('0x31')][_0x660e('0x3a')]+'%'};return _0xe49b83;}})});}_0x2ecfa2=_[_0x660e('0x3b')]({},_0x2ecfa2,_0x132163['options']);var _0x10286a={'where':_0x2ecfa2['where']};return db[_0x660e('0x2c')][_0x660e('0x3d')](_0x10286a)[_0x660e('0x3e')](function(_0x3ca320){_0x5c8de0[_0x660e('0x3d')]=_0x3ca320;if(_0x132163[_0x660e('0x31')][_0x660e('0x3f')]){_0x2ecfa2[_0x660e('0x40')]=[{'all':!![]}];}return db['IntegrationReport'][_0x660e('0x41')](_0x2ecfa2);})['then'](function(_0x9cdde2){_0x5c8de0[_0x660e('0x42')]=_0x9cdde2;return _0x5c8de0;})[_0x660e('0x3e')](respondWithFilteredResult(_0x14237e,_0x2ecfa2))[_0x660e('0x43')](handleError(_0x14237e,null));};exports[_0x660e('0x44')]=function(_0x43ef9b,_0x4a04c4){var _0xdf3331={'raw':![],'where':{'id':_0x43ef9b[_0x660e('0x45')]['id']}},_0x538f2e={};_0x538f2e[_0x660e('0x30')]=_[_0x660e('0x32')](db[_0x660e('0x2c')]['rawAttributes']);_0x538f2e[_0x660e('0x31')]=_[_0x660e('0x32')](_0x43ef9b[_0x660e('0x31')]);_0x538f2e[_0x660e('0x46')]=_[_0x660e('0x47')](_0x538f2e['model'],_0x538f2e[_0x660e('0x31')]);_0xdf3331['attributes']=_['intersection'](_0x538f2e[_0x660e('0x30')],qs[_0x660e('0x34')](_0x43ef9b[_0x660e('0x31')][_0x660e('0x34')]));_0xdf3331[_0x660e('0x33')]=_0xdf3331[_0x660e('0x33')][_0x660e('0x48')]?_0xdf3331['attributes']:_0x538f2e[_0x660e('0x30')];if(_0x43ef9b[_0x660e('0x31')][_0x660e('0x3f')]){_0xdf3331['include']=[{'all':!![]}];}_0xdf3331=_[_0x660e('0x3b')]({},_0xdf3331,_0x43ef9b['options']);return db[_0x660e('0x2c')]['find'](_0xdf3331)[_0x660e('0x3e')](handleEntityNotFound(_0x4a04c4,null))[_0x660e('0x3e')](respondWithResult(_0x4a04c4,null))[_0x660e('0x43')](handleError(_0x4a04c4,null));};exports['create']=function(_0x59b985,_0x47f7cb){return db['IntegrationReport']['create'](_0x59b985['body'],{})[_0x660e('0x3e')](respondWithResult(_0x47f7cb,0xc9))[_0x660e('0x43')](handleError(_0x47f7cb,null));};exports[_0x660e('0x24')]=function(_0x51c5ed,_0x1c444c){if(_0x51c5ed[_0x660e('0x49')]['id']){delete _0x51c5ed[_0x660e('0x49')]['id'];}return db[_0x660e('0x2c')][_0x660e('0x4a')]({'where':{'id':_0x51c5ed[_0x660e('0x45')]['id']}})['then'](handleEntityNotFound(_0x1c444c,null))[_0x660e('0x3e')](saveUpdates(_0x51c5ed[_0x660e('0x49')],null))[_0x660e('0x3e')](respondWithResult(_0x1c444c,null))[_0x660e('0x43')](handleError(_0x1c444c,null));};exports[_0x660e('0x25')]=function(_0x3218d6,_0x501b94){return db[_0x660e('0x2c')][_0x660e('0x4a')]({'where':{'id':_0x3218d6[_0x660e('0x45')]['id']}})[_0x660e('0x3e')](handleEntityNotFound(_0x501b94,null))['then'](removeEntity(_0x501b94,null))[_0x660e('0x43')](handleError(_0x501b94,null));};exports[_0x660e('0x4b')]=function(_0x3b9798,_0x2366f3){return db[_0x660e('0x2c')][_0x660e('0x4b')]()[_0x660e('0x3e')](respondWithResult(_0x2366f3,null))[_0x660e('0x43')](handleError(_0x2366f3,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 5d491a8..c03c098 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 _0x27c6=['rimraf','exports','IntegrationReport','report_integration','lodash','api','moment','bluebird','request-promise','path'];(function(_0x92e92b,_0x4fe9b9){var _0x55276c=function(_0x102099){while(--_0x102099){_0x92e92b['push'](_0x92e92b['shift']());}};_0x55276c(++_0x4fe9b9);}(_0x27c6,0x108));var _0x627c=function(_0x4bbcc2,_0xa345ce){_0x4bbcc2=_0x4bbcc2-0x0;var _0x1cbc6a=_0x27c6[_0x4bbcc2];return _0x1cbc6a;};'use strict';var _=require(_0x627c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x627c('0x1'));var moment=require(_0x627c('0x2'));var BPromise=require(_0x627c('0x3'));var rp=require(_0x627c('0x4'));var fs=require('fs');var path=require(_0x627c('0x5'));var rimraf=require(_0x627c('0x6'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x627c('0x7')]=function(_0x160ac6,_0x405b8f){return _0x160ac6['define'](_0x627c('0x8'),attributes,{'tableName':_0x627c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4342=['lodash','util','../../config/logger','api','moment','bluebird','path','exports','define','IntegrationReport'];(function(_0x2bf999,_0x4645b1){var _0x4cf8f8=function(_0x5a4cf8){while(--_0x5a4cf8){_0x2bf999['push'](_0x2bf999['shift']());}};_0x4cf8f8(++_0x4645b1);}(_0x4342,0x186));var _0x2434=function(_0x32aa68,_0x102e89){_0x32aa68=_0x32aa68-0x0;var _0x292133=_0x4342[_0x32aa68];return _0x292133;};'use strict';var _=require(_0x2434('0x0'));var util=require(_0x2434('0x1'));var logger=require(_0x2434('0x2'))(_0x2434('0x3'));var moment=require(_0x2434('0x4'));var BPromise=require(_0x2434('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2434('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x2434('0x7')]=function(_0x3903e9,_0x4f2798){return _0x3903e9[_0x2434('0x8')](_0x2434('0x9'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index ac9a436..1e1f374 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 _0x2675=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis'];(function(_0x5e3fdd,_0x525da0){var _0x5ea2d3=function(_0x3afd13){while(--_0x3afd13){_0x5e3fdd['push'](_0x5e3fdd['shift']());}};_0x5ea2d3(++_0x525da0);}(_0x2675,0x75));var _0x5267=function(_0x1c6494,_0x4346e5){_0x1c6494=_0x1c6494-0x0;var _0x3e3fd0=_0x2675[_0x1c6494];return _0x3e3fd0;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var Redis=require(_0x5267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('rpc');var config=require(_0x5267('0x5'));var jayson=require(_0x5267('0x6'));var client=jayson[_0x5267('0x7')][_0x5267('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){return client['request'](_0x20f065,_0x527c16)[_0x5267('0x9')](function(_0x5d6645){logger[_0x5267('0xa')](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));logger['debug'](_0x5267('0xd'),_0xc56cd5,'request\x20sent',JSON[_0x5267('0xe')](_0x5d6645));if(_0x5d6645['error']){if(_0x5d6645[_0x5267('0xf')][_0x5267('0x10')]===0x1f4){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x46bfdf(_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);}logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x9e0a27(_0x5d6645[_0x5267('0xf')]['message']);}else{logger['info'](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));_0x9e0a27(_0x5d6645[_0x5267('0x12')][_0x5267('0x11')]);}})[_0x5267('0x13')](function(_0x27e5c6){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x27e5c6);_0x46bfdf(_0x27e5c6);});});} \ No newline at end of file +var _0x1967=['then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x1967,0x173));var _0x7196=function(_0x318537,_0x17a058){_0x318537=_0x318537-0x0;var _0x388c9c=_0x1967[_0x318537];return _0x388c9c;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 0bf0252..13e1eed 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 _0x282a=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./interval.controller','isAuthenticated','get','/:id','getIntervals','post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy'];(function(_0x17d786,_0x4206c4){var _0x526ec5=function(_0x5c7281){while(--_0x5c7281){_0x17d786['push'](_0x17d786['shift']());}};_0x526ec5(++_0x4206c4);}(_0x282a,0xa2));var _0xa282=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x282a[_0x411017];return _0x2adeea;};'use strict';var multer=require('multer');var util=require(_0xa282('0x0'));var path=require(_0xa282('0x1'));var timeout=require(_0xa282('0x2'));var express=require(_0xa282('0x3'));var router=express[_0xa282('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa282('0x5'));var interaction=require(_0xa282('0x6'));var config=require('../../config/environment');var controller=require(_0xa282('0x7'));router['get']('/',auth[_0xa282('0x8')](),controller['index']);router[_0xa282('0x9')](_0xa282('0xa'),auth[_0xa282('0x8')](),controller['show']);router[_0xa282('0x9')]('/:id/sub_intervals',auth[_0xa282('0x8')](),controller[_0xa282('0xb')]);router[_0xa282('0xc')]('/',auth[_0xa282('0x8')](),controller[_0xa282('0xd')]);router[_0xa282('0xc')](_0xa282('0xe'),auth[_0xa282('0x8')](),controller[_0xa282('0xf')]);router[_0xa282('0xc')](_0xa282('0x10'),auth[_0xa282('0x8')](),controller[_0xa282('0x11')]);router[_0xa282('0x12')](_0xa282('0xa'),auth[_0xa282('0x8')](),controller[_0xa282('0x13')]);router[_0xa282('0x14')]('/:id',auth[_0xa282('0x8')](),controller[_0xa282('0x15')]);module[_0xa282('0x16')]=router; \ No newline at end of file +var _0x41d9=['create','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/sub_intervals','post'];(function(_0x555cd9,_0x3c89a9){var _0x40bb82=function(_0x189424){while(--_0x189424){_0x555cd9['push'](_0x555cd9['shift']());}};_0x40bb82(++_0x3c89a9);}(_0x41d9,0x13c));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x941d('0x0'));var util=require(_0x941d('0x1'));var path=require(_0x941d('0x2'));var timeout=require(_0x941d('0x3'));var express=require(_0x941d('0x4'));var router=express[_0x941d('0x5')]();var fs_extra=require(_0x941d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x941d('0x7'));var config=require(_0x941d('0x8'));var controller=require('./interval.controller');router[_0x941d('0x9')]('/',auth[_0x941d('0xa')](),controller['index']);router[_0x941d('0x9')]('/:id',auth[_0x941d('0xa')](),controller[_0x941d('0xb')]);router[_0x941d('0x9')](_0x941d('0xc'),auth[_0x941d('0xa')](),controller['getIntervals']);router[_0x941d('0xd')]('/',auth[_0x941d('0xa')](),controller[_0x941d('0xe')]);router[_0x941d('0xd')]('/:id/sub_intervals',auth[_0x941d('0xa')](),controller[_0x941d('0xf')]);router[_0x941d('0xd')](_0x941d('0x10'),auth[_0x941d('0xa')](),controller[_0x941d('0x11')]);router['put'](_0x941d('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x941d('0x13')](_0x941d('0x12'),auth[_0x941d('0xa')](),controller[_0x941d('0x14')]);module[_0x941d('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 07d4055..5a3bb7c 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 _0x309c=['exports','STRING','sequelize'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x309c,0x143));var _0xc309=function(_0xc598fd,_0x2b2f28){_0xc598fd=_0xc598fd-0x0;var _0x3e67f8=_0x309c[_0xc598fd];return _0x3e67f8;};'use strict';var Sequelize=require(_0xc309('0x0'));module[_0xc309('0x1')]={'name':{'type':Sequelize[_0xc309('0x2')]},'description':{'type':Sequelize[_0xc309('0x2')]},'interval':{'type':Sequelize[_0xc309('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xefdb=['sequelize','exports','STRING'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xefdb,0x147));var _0xbefd=function(_0x298b6e,_0x1220e5){_0x298b6e=_0x298b6e-0x0;var _0x4e7006=_0xefdb[_0x298b6e];return _0x4e7006;};'use strict';var Sequelize=require(_0xbefd('0x0'));module[_0xbefd('0x1')]={'name':{'type':Sequelize[_0xbefd('0x2')]},'description':{'type':Sequelize[_0xbefd('0x2')]},'interval':{'type':Sequelize[_0xbefd('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 0cb9687..11c3e14 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 _0x355f=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/extensions/rewrite','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Interval','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','findOne','addIntervals','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x190a13,_0x5315a3){var _0x3f9b79=function(_0x25dc6f){while(--_0x25dc6f){_0x190a13['push'](_0x190a13['shift']());}};_0x3f9b79(++_0x5315a3);}(_0x355f,0x108));var _0xf355=function(_0x10d271,_0x50f43d){_0x10d271=_0x10d271-0x0;var _0xce69e5=_0x355f[_0x10d271];return _0xce69e5;};'use strict';var emlformat=require(_0xf355('0x0'));var rimraf=require(_0xf355('0x1'));var zipdir=require(_0xf355('0x2'));var jsonpatch=require(_0xf355('0x3'));var rp=require(_0xf355('0x4'));var moment=require(_0xf355('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf355('0x6'));var util=require(_0xf355('0x7'));var path=require('path');var sox=require(_0xf355('0x8'));var csv=require(_0xf355('0x9'));var ejs=require(_0xf355('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf355('0xb'));var squel=require(_0xf355('0xc'));var crypto=require(_0xf355('0xd'));var jsforce=require(_0xf355('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf355('0xf'));var Papa=require(_0xf355('0x10'));var Redis=require(_0xf355('0x11'));var authService=require(_0xf355('0x12'));var qs=require(_0xf355('0x13'));var as=require(_0xf355('0x14'));var hardwareService=require(_0xf355('0x15'));var logger=require(_0xf355('0x16'))(_0xf355('0x17'));var utils=require(_0xf355('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf355('0x19'))['db'];var extensions=require(_0xf355('0x1a'));function respondWithStatusCode(_0x3a069d,_0x35d493){_0x35d493=_0x35d493||0xcc;return function(_0x5eed65){if(_0x5eed65){return _0x3a069d['sendStatus'](_0x35d493);}return _0x3a069d[_0xf355('0x1b')](_0x35d493)[_0xf355('0x1c')]();};}function respondWithResult(_0x31a814,_0x28e431){_0x28e431=_0x28e431||0xc8;return function(_0x32f104){if(_0x32f104){return _0x31a814[_0xf355('0x1b')](_0x28e431)[_0xf355('0x1d')](_0x32f104);}};}function respondWithFilteredResult(_0x1f9a7d,_0x489559){return function(_0xf34cdc){if(_0xf34cdc){var _0x44d82f=typeof _0x489559['offset']===_0xf355('0x1e')&&typeof _0x489559[_0xf355('0x1f')]===_0xf355('0x1e');var _0x13f190=_0xf34cdc[_0xf355('0x20')];var _0x5829fb=_0x44d82f?0x0:_0x489559[_0xf355('0x21')];var _0x571b7c=_0x44d82f?_0xf34cdc[_0xf355('0x20')]:_0x489559[_0xf355('0x21')]+_0x489559[_0xf355('0x1f')];var _0xd8718d;if(_0x571b7c>=_0x13f190){_0x571b7c=_0x13f190;_0xd8718d=0xc8;}else{_0xd8718d=0xce;}_0x1f9a7d['status'](_0xd8718d);return _0x1f9a7d[_0xf355('0x22')](_0xf355('0x23'),_0x5829fb+'-'+_0x571b7c+'/'+_0x13f190)['json'](_0xf34cdc);}return null;};}function patchUpdates(_0x13b19b){return function(_0x3c6f96){try{jsonpatch[_0xf355('0x24')](_0x3c6f96,_0x13b19b,!![]);}catch(_0x54a4bb){return BPromise['reject'](_0x54a4bb);}return _0x3c6f96['save']();};}function saveUpdates(_0x23a317,_0x181fa7){return function(_0x357dc0){if(_0x357dc0){return _0x357dc0['update'](_0x23a317)[_0xf355('0x25')](function(_0xad17cb){return _0xad17cb;});}return null;};}function removeEntity(_0xfd7d65,_0x4e9a1f){return function(_0x2aa941){if(_0x2aa941){return _0x2aa941[_0xf355('0x26')]()[_0xf355('0x25')](function(){var _0x43d37c=_0x2aa941[_0xf355('0x27')]({'plain':!![]});var _0x36922c='Intervals';return db[_0xf355('0x28')][_0xf355('0x26')]({'where':{'type':_0x36922c,'resourceId':_0x43d37c['id']}})[_0xf355('0x25')](function(){return _0x2aa941;});})[_0xf355('0x25')](function(){_0xfd7d65[_0xf355('0x1b')](0xcc)[_0xf355('0x1c')]();});}};}function handleEntityNotFound(_0x54c3cd,_0x3c2a20){return function(_0xe4f91e){if(!_0xe4f91e){_0x54c3cd[_0xf355('0x29')](0x194);}return _0xe4f91e;};}function handleError(_0x5401b9,_0x33184a){_0x33184a=_0x33184a||0x1f4;return function(_0x34c38c){logger['error'](_0x34c38c[_0xf355('0x2a')]);if(_0x34c38c['name']){delete _0x34c38c[_0xf355('0x2b')];}_0x5401b9[_0xf355('0x1b')](_0x33184a)[_0xf355('0x2c')](_0x34c38c);};}exports[_0xf355('0x2d')]=function(_0x7832,_0x25a931){var _0x231568={},_0x38c382={},_0x2755f9={'count':0x0,'rows':[]};var _0x427dac=_[_0xf355('0x2e')](db['Interval'][_0xf355('0x2f')],function(_0x2c1fc2){return{'name':_0x2c1fc2[_0xf355('0x30')],'type':_0x2c1fc2[_0xf355('0x31')][_0xf355('0x32')]};});_0x38c382['model']=_[_0xf355('0x2e')](_0x427dac,'name');_0x38c382[_0xf355('0x33')]=_[_0xf355('0x34')](_0x7832['query']);_0x38c382[_0xf355('0x35')]=_['intersection'](_0x38c382[_0xf355('0x36')],_0x38c382['query']);_0x231568['attributes']=_[_0xf355('0x37')](_0x38c382[_0xf355('0x36')],qs[_0xf355('0x38')](_0x7832[_0xf355('0x33')][_0xf355('0x38')]));_0x231568['attributes']=_0x231568['attributes'][_0xf355('0x39')]?_0x231568[_0xf355('0x3a')]:_0x38c382[_0xf355('0x36')];if(!_0x7832['query'][_0xf355('0x3b')](_0xf355('0x3c'))){_0x231568[_0xf355('0x1f')]=qs[_0xf355('0x1f')](_0x7832[_0xf355('0x33')]['limit']);_0x231568['offset']=qs['offset'](_0x7832[_0xf355('0x33')][_0xf355('0x21')]);}_0x231568[_0xf355('0x3d')]=qs[_0xf355('0x3e')](_0x7832[_0xf355('0x33')][_0xf355('0x3e')]);_0x231568['where']=qs[_0xf355('0x35')](_['pick'](_0x7832[_0xf355('0x33')],_0x38c382[_0xf355('0x35')]),_0x427dac);if(_0x7832['query'][_0xf355('0x3f')]){_0x231568[_0xf355('0x40')]=_['merge'](_0x231568[_0xf355('0x40')],{'$or':_[_0xf355('0x2e')](_0x427dac,function(_0x144b6c){if(_0x144b6c['type']!==_0xf355('0x41')){var _0x19fa82={};_0x19fa82[_0x144b6c['name']]={'$like':'%'+_0x7832[_0xf355('0x33')]['filter']+'%'};return _0x19fa82;}})});}_0x231568=_['merge']({},_0x231568,_0x7832[_0xf355('0x42')]);var _0x4d5ec3={'where':_0x231568[_0xf355('0x40')]};return db['Interval'][_0xf355('0x20')](_0x4d5ec3)['then'](function(_0x4f4f8f){_0x2755f9['count']=_0x4f4f8f;if(_0x7832[_0xf355('0x33')][_0xf355('0x43')]){_0x231568[_0xf355('0x44')]=[{'all':!![]}];}return db['Interval'][_0xf355('0x45')](_0x231568);})['then'](function(_0x1cd5a6){_0x2755f9[_0xf355('0x46')]=_0x1cd5a6;return _0x2755f9;})[_0xf355('0x25')](respondWithFilteredResult(_0x25a931,_0x231568))['catch'](handleError(_0x25a931,null));};exports[_0xf355('0x47')]=function(_0x1702d0,_0x4e13df){var _0x1e367e={'raw':!![],'where':{'id':_0x1702d0[_0xf355('0x48')]['id']}},_0x5dafd1={};_0x5dafd1[_0xf355('0x36')]=_[_0xf355('0x34')](db[_0xf355('0x49')]['rawAttributes']);_0x5dafd1['query']=_[_0xf355('0x34')](_0x1702d0[_0xf355('0x33')]);_0x5dafd1[_0xf355('0x35')]=_[_0xf355('0x37')](_0x5dafd1[_0xf355('0x36')],_0x5dafd1[_0xf355('0x33')]);_0x1e367e[_0xf355('0x3a')]=_[_0xf355('0x37')](_0x5dafd1[_0xf355('0x36')],qs[_0xf355('0x38')](_0x1702d0[_0xf355('0x33')][_0xf355('0x38')]));_0x1e367e[_0xf355('0x3a')]=_0x1e367e[_0xf355('0x3a')][_0xf355('0x39')]?_0x1e367e[_0xf355('0x3a')]:_0x5dafd1[_0xf355('0x36')];if(_0x1702d0[_0xf355('0x33')][_0xf355('0x43')]){_0x1e367e['include']=[{'all':!![]}];}_0x1e367e=_[_0xf355('0x4a')]({},_0x1e367e,_0x1702d0[_0xf355('0x42')]);return db['Interval'][_0xf355('0x4b')](_0x1e367e)[_0xf355('0x25')](handleEntityNotFound(_0x4e13df,null))[_0xf355('0x25')](respondWithResult(_0x4e13df,null))[_0xf355('0x4c')](handleError(_0x4e13df,null));};exports[_0xf355('0x4d')]=function(_0x22a71f,_0x5b6e5b){return db[_0xf355('0x49')][_0xf355('0x4d')](_0x22a71f[_0xf355('0x4e')],{})[_0xf355('0x25')](function(_0x17a1b1){var _0x574dac=_0x22a71f[_0xf355('0x4f')][_0xf355('0x27')]({'plain':!![]});if(!_0x574dac)throw new Error(_0xf355('0x50'));if(_0x574dac[_0xf355('0x51')]===_0xf355('0x4f')){var _0x507bac=_0x17a1b1[_0xf355('0x27')]({'plain':!![]});var _0x142d49=_0xf355('0x52');return db['UserProfileSection'][_0xf355('0x4b')]({'where':{'name':_0x142d49,'userProfileId':_0x574dac['userProfileId']},'raw':!![]})[_0xf355('0x25')](function(_0x4e2499){if(_0x4e2499&&_0x4e2499[_0xf355('0x53')]===0x0){return db[_0xf355('0x28')]['create']({'name':_0x507bac[_0xf355('0x2b')],'resourceId':_0x507bac['id'],'type':_0x4e2499[_0xf355('0x2b')],'sectionId':_0x4e2499['id']},{})[_0xf355('0x25')](function(){return _0x17a1b1;});}else{return _0x17a1b1;}})[_0xf355('0x4c')](function(_0x4fe120){logger[_0xf355('0x54')](_0xf355('0x55'),_0x4fe120);throw _0x4fe120;});}return _0x17a1b1;})[_0xf355('0x25')](respondWithResult(_0x5b6e5b,0xc9))[_0xf355('0x4c')](handleError(_0x5b6e5b,null));};exports[_0xf355('0x56')]=function(_0x34aeb6,_0x1639ff){if(_0x34aeb6[_0xf355('0x4e')]['id']){delete _0x34aeb6[_0xf355('0x4e')]['id'];}return db[_0xf355('0x49')]['find']({'where':{'id':_0x34aeb6[_0xf355('0x48')]['id']}})[_0xf355('0x25')](handleEntityNotFound(_0x1639ff,null))[_0xf355('0x25')](saveUpdates(_0x34aeb6[_0xf355('0x4e')],null))[_0xf355('0x25')](respondWithResult(_0x1639ff,null))[_0xf355('0x4c')](handleError(_0x1639ff,null));};exports[_0xf355('0x26')]=function(_0x58b801,_0x29f38e){return db[_0xf355('0x49')][_0xf355('0x4b')]({'where':{'id':_0x58b801[_0xf355('0x48')]['id']}})[_0xf355('0x25')](handleEntityNotFound(_0x29f38e,null))[_0xf355('0x25')](removeEntity(_0x29f38e,null))['catch'](handleError(_0x29f38e,null));};exports[_0xf355('0x57')]=function(_0x1d4a83,_0x529ded,_0xa933bd){if(_0x1d4a83['body']['id']){delete _0x1d4a83['body']['id'];}return db['Interval'][_0xf355('0x4b')]({'where':{'id':_0x1d4a83['params']['id']}})[_0xf355('0x25')](handleEntityNotFound(_0x529ded,null))['then'](function(_0x60329b){if(_0x60329b){_0x1d4a83[_0xf355('0x4e')][_0xf355('0x58')]=_0x60329b['id'];return db[_0xf355('0x49')][_0xf355('0x4d')](_0x1d4a83[_0xf355('0x4e')]);}})[_0xf355('0x25')](respondWithResult(_0x529ded,null))[_0xf355('0x4c')](handleError(_0x529ded,null));};exports[_0xf355('0x59')]=function(_0x44dbe6,_0x40f5db,_0x5ca521){var _0x162056={};var _0x32418e={};var _0x2aa88a;var _0x3635a4;return db[_0xf355('0x49')][_0xf355('0x5a')]({'where':{'id':_0x44dbe6[_0xf355('0x48')]['id']}})[_0xf355('0x25')](handleEntityNotFound(_0x40f5db,null))[_0xf355('0x25')](function(_0x2808be){if(_0x2808be){_0x2aa88a=_0x2808be;_0x32418e[_0xf355('0x36')]=_['keys'](db[_0xf355('0x49')][_0xf355('0x2f')]);_0x32418e['query']=_[_0xf355('0x34')](_0x44dbe6['query']);_0x32418e[_0xf355('0x35')]=_[_0xf355('0x37')](_0x32418e[_0xf355('0x36')],_0x32418e[_0xf355('0x33')]);_0x162056['attributes']=_[_0xf355('0x37')](_0x32418e['model'],qs['fields'](_0x44dbe6[_0xf355('0x33')]['fields']));_0x162056[_0xf355('0x3a')]=_0x162056[_0xf355('0x3a')][_0xf355('0x39')]?_0x162056[_0xf355('0x3a')]:_0x32418e[_0xf355('0x36')];_0x162056[_0xf355('0x3d')]=qs[_0xf355('0x3e')](_0x44dbe6[_0xf355('0x33')][_0xf355('0x3e')]);_0x162056[_0xf355('0x40')]=qs[_0xf355('0x35')](_['pick'](_0x44dbe6[_0xf355('0x33')],_0x32418e[_0xf355('0x35')]));if(_0x44dbe6[_0xf355('0x33')][_0xf355('0x3f')]){_0x162056[_0xf355('0x40')]=_[_0xf355('0x4a')](_0x162056[_0xf355('0x40')],{'$or':_[_0xf355('0x2e')](_0x162056[_0xf355('0x3a')],function(_0x58799c){var _0x5e6a5f={};_0x5e6a5f[_0x58799c]={'$like':'%'+_0x44dbe6['query'][_0xf355('0x3f')]+'%'};return _0x5e6a5f;})});}_0x162056=_['merge']({},_0x162056,_0x44dbe6['options']);return _0x2aa88a[_0xf355('0x59')](_0x162056);}})[_0xf355('0x25')](function(_0x17af1f){if(_0x17af1f){_0x3635a4=_0x17af1f[_0xf355('0x39')];if(!_0x44dbe6[_0xf355('0x33')]['hasOwnProperty'](_0xf355('0x3c'))){_0x162056[_0xf355('0x1f')]=qs[_0xf355('0x1f')](_0x44dbe6[_0xf355('0x33')][_0xf355('0x1f')]);_0x162056[_0xf355('0x21')]=qs['offset'](_0x44dbe6['query'][_0xf355('0x21')]);}return _0x2aa88a[_0xf355('0x59')](_0x162056);}})['then'](function(_0x1e1ee6){if(_0x1e1ee6){return _0x1e1ee6?{'count':_0x3635a4,'rows':_0x1e1ee6}:null;}})[_0xf355('0x25')](respondWithResult(_0x40f5db,null))['catch'](handleError(_0x40f5db,null));};exports[_0xf355('0x5b')]=function(_0x51943b,_0x11f00f,_0x5bd370){return db[_0xf355('0x49')][_0xf355('0x5a')]({'where':{'id':_0x51943b['params']['id']}})['then'](handleEntityNotFound(_0x11f00f,null))[_0xf355('0x25')](function(_0x4e3a46){if(_0x4e3a46){return db['sequelize'][_0xf355('0x5c')](function(_0x82725){return db[_0xf355('0x49')]['destroy']({'where':{'IntervalId':_0x51943b[_0xf355('0x48')]['id']},'transaction':_0x82725})['then'](function(_0x2cf39f){var _0x5440ab=_[_0xf355('0x2e')](_0x51943b[_0xf355('0x4e')],function(_0x376ac1){delete _0x376ac1['id'];_0x376ac1[_0xf355('0x58')]=_0x51943b[_0xf355('0x48')]['id'];return _0x376ac1;});return db[_0xf355('0x49')][_0xf355('0x5d')](_0x5440ab,{'transaction':_0x82725});});})['then'](function(){return db[_0xf355('0x49')][_0xf355('0x45')]({'where':{'IntervalId':_0x51943b[_0xf355('0x48')]['id']}});});}})['then'](respondWithResult(_0x11f00f,null))[_0xf355('0x4c')](handleError(_0x11f00f,null));}; \ No newline at end of file +var _0xf84c=['desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','get','Intervals','end','name','send','map','Interval','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','error','destroy','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0xf8c50c,_0x3e98ff){var _0x55a6fb=function(_0x374171){while(--_0x374171){_0xf8c50c['push'](_0xf8c50c['shift']());}};_0x55a6fb(++_0x3e98ff);}(_0xf84c,0x104));var _0xcf84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf84c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xcf84('0x0'));var rimraf=require(_0xcf84('0x1'));var zipdir=require(_0xcf84('0x2'));var jsonpatch=require(_0xcf84('0x3'));var rp=require(_0xcf84('0x4'));var moment=require(_0xcf84('0x5'));var BPromise=require(_0xcf84('0x6'));var Mustache=require(_0xcf84('0x7'));var util=require(_0xcf84('0x8'));var path=require(_0xcf84('0x9'));var sox=require(_0xcf84('0xa'));var csv=require(_0xcf84('0xb'));var ejs=require(_0xcf84('0xc'));var fs=require('fs');var fs_extra=require(_0xcf84('0xd'));var _=require('lodash');var squel=require(_0xcf84('0xe'));var crypto=require(_0xcf84('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xcf84('0x10'));var toCsv=require(_0xcf84('0xb'));var querystring=require(_0xcf84('0x11'));var Papa=require(_0xcf84('0x12'));var Redis=require('ioredis');var authService=require(_0xcf84('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf84('0x14'));var logger=require(_0xcf84('0x15'))(_0xcf84('0x16'));var utils=require('../../config/utils');var config=require(_0xcf84('0x17'));var licenseUtil=require(_0xcf84('0x18'));var db=require(_0xcf84('0x19'))['db'];var extensions=require(_0xcf84('0x1a'));function respondWithStatusCode(_0x160dd6,_0x3d6fb3){_0x3d6fb3=_0x3d6fb3||0xcc;return function(_0x415559){if(_0x415559){return _0x160dd6[_0xcf84('0x1b')](_0x3d6fb3);}return _0x160dd6[_0xcf84('0x1c')](_0x3d6fb3)['end']();};}function respondWithResult(_0x114700,_0x4afe76){_0x4afe76=_0x4afe76||0xc8;return function(_0x49d084){if(_0x49d084){return _0x114700[_0xcf84('0x1c')](_0x4afe76)[_0xcf84('0x1d')](_0x49d084);}};}function respondWithFilteredResult(_0x150921,_0x155d1a){return function(_0x22359c){if(_0x22359c){var _0x3fa7e7=typeof _0x155d1a['offset']===_0xcf84('0x1e')&&typeof _0x155d1a[_0xcf84('0x1f')]===_0xcf84('0x1e');var _0x538b25=_0x22359c[_0xcf84('0x20')];var _0x4b5427=_0x3fa7e7?0x0:_0x155d1a[_0xcf84('0x21')];var _0x1f9d16=_0x3fa7e7?_0x22359c[_0xcf84('0x20')]:_0x155d1a[_0xcf84('0x21')]+_0x155d1a[_0xcf84('0x1f')];var _0x4bb316;if(_0x1f9d16>=_0x538b25){_0x1f9d16=_0x538b25;_0x4bb316=0xc8;}else{_0x4bb316=0xce;}_0x150921[_0xcf84('0x1c')](_0x4bb316);return _0x150921[_0xcf84('0x22')](_0xcf84('0x23'),_0x4b5427+'-'+_0x1f9d16+'/'+_0x538b25)['json'](_0x22359c);}return null;};}function patchUpdates(_0x11f123){return function(_0x226a32){try{jsonpatch['apply'](_0x226a32,_0x11f123,!![]);}catch(_0x8e2441){return BPromise[_0xcf84('0x24')](_0x8e2441);}return _0x226a32[_0xcf84('0x25')]();};}function saveUpdates(_0xd0d56a,_0x32e3eb){return function(_0x4a3b73){if(_0x4a3b73){return _0x4a3b73[_0xcf84('0x26')](_0xd0d56a)[_0xcf84('0x27')](function(_0x58ada2){return _0x58ada2;});}return null;};}function removeEntity(_0x49dcd7,_0x3b11c5){return function(_0x2fdbb9){if(_0x2fdbb9){return _0x2fdbb9['destroy']()[_0xcf84('0x27')](function(){var _0x17d911=_0x2fdbb9[_0xcf84('0x28')]({'plain':!![]});var _0x124570=_0xcf84('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x124570,'resourceId':_0x17d911['id']}})['then'](function(){return _0x2fdbb9;});})[_0xcf84('0x27')](function(){_0x49dcd7[_0xcf84('0x1c')](0xcc)[_0xcf84('0x2a')]();});}};}function handleEntityNotFound(_0x69aa0,_0x2fa212){return function(_0x5535e){if(!_0x5535e){_0x69aa0[_0xcf84('0x1b')](0x194);}return _0x5535e;};}function handleError(_0x3bcd70,_0x47be20){_0x47be20=_0x47be20||0x1f4;return function(_0x176048){logger['error'](_0x176048['stack']);if(_0x176048[_0xcf84('0x2b')]){delete _0x176048[_0xcf84('0x2b')];}_0x3bcd70[_0xcf84('0x1c')](_0x47be20)[_0xcf84('0x2c')](_0x176048);};}exports['index']=function(_0x48363b,_0x31d253){var _0x3376c6={},_0x4ff24e={},_0x26a674={'count':0x0,'rows':[]};var _0x1306ef=_[_0xcf84('0x2d')](db[_0xcf84('0x2e')][_0xcf84('0x2f')],function(_0x349f1d){return{'name':_0x349f1d[_0xcf84('0x30')],'type':_0x349f1d[_0xcf84('0x31')]['key']};});_0x4ff24e[_0xcf84('0x32')]=_['map'](_0x1306ef,_0xcf84('0x2b'));_0x4ff24e[_0xcf84('0x33')]=_[_0xcf84('0x34')](_0x48363b[_0xcf84('0x33')]);_0x4ff24e[_0xcf84('0x35')]=_[_0xcf84('0x36')](_0x4ff24e[_0xcf84('0x32')],_0x4ff24e[_0xcf84('0x33')]);_0x3376c6[_0xcf84('0x37')]=_['intersection'](_0x4ff24e['model'],qs['fields'](_0x48363b[_0xcf84('0x33')][_0xcf84('0x38')]));_0x3376c6['attributes']=_0x3376c6[_0xcf84('0x37')]['length']?_0x3376c6['attributes']:_0x4ff24e[_0xcf84('0x32')];if(!_0x48363b[_0xcf84('0x33')][_0xcf84('0x39')](_0xcf84('0x3a'))){_0x3376c6[_0xcf84('0x1f')]=qs[_0xcf84('0x1f')](_0x48363b[_0xcf84('0x33')][_0xcf84('0x1f')]);_0x3376c6['offset']=qs[_0xcf84('0x21')](_0x48363b[_0xcf84('0x33')][_0xcf84('0x21')]);}_0x3376c6[_0xcf84('0x3b')]=qs['sort'](_0x48363b['query'][_0xcf84('0x3c')]);_0x3376c6[_0xcf84('0x3d')]=qs[_0xcf84('0x35')](_[_0xcf84('0x3e')](_0x48363b['query'],_0x4ff24e[_0xcf84('0x35')]),_0x1306ef);if(_0x48363b[_0xcf84('0x33')]['filter']){_0x3376c6[_0xcf84('0x3d')]=_[_0xcf84('0x3f')](_0x3376c6[_0xcf84('0x3d')],{'$or':_[_0xcf84('0x2d')](_0x1306ef,function(_0x29c181){if(_0x29c181[_0xcf84('0x31')]!==_0xcf84('0x40')){var _0x2e7696={};_0x2e7696[_0x29c181['name']]={'$like':'%'+_0x48363b[_0xcf84('0x33')][_0xcf84('0x41')]+'%'};return _0x2e7696;}})});}_0x3376c6=_[_0xcf84('0x3f')]({},_0x3376c6,_0x48363b['options']);var _0x5b466c={'where':_0x3376c6['where']};return db['Interval'][_0xcf84('0x20')](_0x5b466c)[_0xcf84('0x27')](function(_0x45dccb){_0x26a674[_0xcf84('0x20')]=_0x45dccb;if(_0x48363b[_0xcf84('0x33')][_0xcf84('0x42')]){_0x3376c6[_0xcf84('0x43')]=[{'all':!![]}];}return db['Interval'][_0xcf84('0x44')](_0x3376c6);})[_0xcf84('0x27')](function(_0x2c8b7e){_0x26a674[_0xcf84('0x45')]=_0x2c8b7e;return _0x26a674;})[_0xcf84('0x27')](respondWithFilteredResult(_0x31d253,_0x3376c6))[_0xcf84('0x46')](handleError(_0x31d253,null));};exports[_0xcf84('0x47')]=function(_0x533ce2,_0x153405){var _0x1f8994={'raw':!![],'where':{'id':_0x533ce2[_0xcf84('0x48')]['id']}},_0xc3e182={};_0xc3e182[_0xcf84('0x32')]=_[_0xcf84('0x34')](db[_0xcf84('0x2e')][_0xcf84('0x2f')]);_0xc3e182[_0xcf84('0x33')]=_[_0xcf84('0x34')](_0x533ce2[_0xcf84('0x33')]);_0xc3e182['filters']=_[_0xcf84('0x36')](_0xc3e182[_0xcf84('0x32')],_0xc3e182['query']);_0x1f8994['attributes']=_[_0xcf84('0x36')](_0xc3e182[_0xcf84('0x32')],qs[_0xcf84('0x38')](_0x533ce2[_0xcf84('0x33')][_0xcf84('0x38')]));_0x1f8994[_0xcf84('0x37')]=_0x1f8994[_0xcf84('0x37')][_0xcf84('0x49')]?_0x1f8994[_0xcf84('0x37')]:_0xc3e182['model'];if(_0x533ce2[_0xcf84('0x33')][_0xcf84('0x42')]){_0x1f8994[_0xcf84('0x43')]=[{'all':!![]}];}_0x1f8994=_[_0xcf84('0x3f')]({},_0x1f8994,_0x533ce2[_0xcf84('0x4a')]);return db[_0xcf84('0x2e')][_0xcf84('0x4b')](_0x1f8994)['then'](handleEntityNotFound(_0x153405,null))['then'](respondWithResult(_0x153405,null))[_0xcf84('0x46')](handleError(_0x153405,null));};exports[_0xcf84('0x4c')]=function(_0x2da8ac,_0xda2fb4){return db[_0xcf84('0x2e')][_0xcf84('0x4c')](_0x2da8ac[_0xcf84('0x4d')],{})[_0xcf84('0x27')](function(_0x4d6c7d){var _0x50f52a=_0x2da8ac[_0xcf84('0x4e')]['get']({'plain':!![]});if(!_0x50f52a)throw new Error(_0xcf84('0x4f'));if(_0x50f52a[_0xcf84('0x50')]===_0xcf84('0x4e')){var _0x1fb7b7=_0x4d6c7d[_0xcf84('0x28')]({'plain':!![]});var _0x4de6aa=_0xcf84('0x29');return db[_0xcf84('0x51')][_0xcf84('0x4b')]({'where':{'name':_0x4de6aa,'userProfileId':_0x50f52a[_0xcf84('0x52')]},'raw':!![]})[_0xcf84('0x27')](function(_0x25804d){if(_0x25804d&&_0x25804d['autoAssociation']===0x0){return db[_0xcf84('0x53')]['create']({'name':_0x1fb7b7[_0xcf84('0x2b')],'resourceId':_0x1fb7b7['id'],'type':_0x25804d[_0xcf84('0x2b')],'sectionId':_0x25804d['id']},{})[_0xcf84('0x27')](function(){return _0x4d6c7d;});}else{return _0x4d6c7d;}})[_0xcf84('0x46')](function(_0x229b48){logger[_0xcf84('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x229b48);throw _0x229b48;});}return _0x4d6c7d;})[_0xcf84('0x27')](respondWithResult(_0xda2fb4,0xc9))[_0xcf84('0x46')](handleError(_0xda2fb4,null));};exports[_0xcf84('0x26')]=function(_0x19dc80,_0x34619e){if(_0x19dc80['body']['id']){delete _0x19dc80[_0xcf84('0x4d')]['id'];}return db['Interval']['find']({'where':{'id':_0x19dc80[_0xcf84('0x48')]['id']}})[_0xcf84('0x27')](handleEntityNotFound(_0x34619e,null))[_0xcf84('0x27')](saveUpdates(_0x19dc80[_0xcf84('0x4d')],null))['then'](respondWithResult(_0x34619e,null))['catch'](handleError(_0x34619e,null));};exports[_0xcf84('0x55')]=function(_0x58894c,_0x2d1fc8){return db['Interval'][_0xcf84('0x4b')]({'where':{'id':_0x58894c[_0xcf84('0x48')]['id']}})[_0xcf84('0x27')](handleEntityNotFound(_0x2d1fc8,null))[_0xcf84('0x27')](removeEntity(_0x2d1fc8,null))[_0xcf84('0x46')](handleError(_0x2d1fc8,null));};exports[_0xcf84('0x56')]=function(_0x453086,_0x2885dc,_0x23d836){if(_0x453086['body']['id']){delete _0x453086[_0xcf84('0x4d')]['id'];}return db['Interval'][_0xcf84('0x4b')]({'where':{'id':_0x453086[_0xcf84('0x48')]['id']}})[_0xcf84('0x27')](handleEntityNotFound(_0x2885dc,null))['then'](function(_0xb74d27){if(_0xb74d27){_0x453086[_0xcf84('0x4d')][_0xcf84('0x57')]=_0xb74d27['id'];return db['Interval'][_0xcf84('0x4c')](_0x453086[_0xcf84('0x4d')]);}})[_0xcf84('0x27')](respondWithResult(_0x2885dc,null))['catch'](handleError(_0x2885dc,null));};exports[_0xcf84('0x58')]=function(_0x5db614,_0x5722d4,_0x5aec56){var _0x65aa={};var _0x25e364={};var _0x3ba433;var _0x32b33f;return db[_0xcf84('0x2e')][_0xcf84('0x59')]({'where':{'id':_0x5db614[_0xcf84('0x48')]['id']}})[_0xcf84('0x27')](handleEntityNotFound(_0x5722d4,null))[_0xcf84('0x27')](function(_0x540f90){if(_0x540f90){_0x3ba433=_0x540f90;_0x25e364[_0xcf84('0x32')]=_[_0xcf84('0x34')](db[_0xcf84('0x2e')][_0xcf84('0x2f')]);_0x25e364[_0xcf84('0x33')]=_[_0xcf84('0x34')](_0x5db614['query']);_0x25e364[_0xcf84('0x35')]=_[_0xcf84('0x36')](_0x25e364[_0xcf84('0x32')],_0x25e364[_0xcf84('0x33')]);_0x65aa['attributes']=_[_0xcf84('0x36')](_0x25e364[_0xcf84('0x32')],qs[_0xcf84('0x38')](_0x5db614[_0xcf84('0x33')][_0xcf84('0x38')]));_0x65aa['attributes']=_0x65aa['attributes'][_0xcf84('0x49')]?_0x65aa[_0xcf84('0x37')]:_0x25e364[_0xcf84('0x32')];_0x65aa['order']=qs[_0xcf84('0x3c')](_0x5db614[_0xcf84('0x33')][_0xcf84('0x3c')]);_0x65aa[_0xcf84('0x3d')]=qs[_0xcf84('0x35')](_[_0xcf84('0x3e')](_0x5db614['query'],_0x25e364[_0xcf84('0x35')]));if(_0x5db614[_0xcf84('0x33')][_0xcf84('0x41')]){_0x65aa['where']=_[_0xcf84('0x3f')](_0x65aa[_0xcf84('0x3d')],{'$or':_['map'](_0x65aa[_0xcf84('0x37')],function(_0x1efade){var _0x555914={};_0x555914[_0x1efade]={'$like':'%'+_0x5db614[_0xcf84('0x33')][_0xcf84('0x41')]+'%'};return _0x555914;})});}_0x65aa=_[_0xcf84('0x3f')]({},_0x65aa,_0x5db614[_0xcf84('0x4a')]);return _0x3ba433[_0xcf84('0x58')](_0x65aa);}})[_0xcf84('0x27')](function(_0x3de498){if(_0x3de498){_0x32b33f=_0x3de498[_0xcf84('0x49')];if(!_0x5db614[_0xcf84('0x33')]['hasOwnProperty'](_0xcf84('0x3a'))){_0x65aa[_0xcf84('0x1f')]=qs['limit'](_0x5db614[_0xcf84('0x33')][_0xcf84('0x1f')]);_0x65aa[_0xcf84('0x21')]=qs[_0xcf84('0x21')](_0x5db614[_0xcf84('0x33')]['offset']);}return _0x3ba433[_0xcf84('0x58')](_0x65aa);}})[_0xcf84('0x27')](function(_0x6102a2){if(_0x6102a2){return _0x6102a2?{'count':_0x32b33f,'rows':_0x6102a2}:null;}})[_0xcf84('0x27')](respondWithResult(_0x5722d4,null))[_0xcf84('0x46')](handleError(_0x5722d4,null));};exports[_0xcf84('0x5a')]=function(_0x177c9c,_0x4f8bfa,_0x17ed7a){return db[_0xcf84('0x2e')][_0xcf84('0x59')]({'where':{'id':_0x177c9c[_0xcf84('0x48')]['id']}})['then'](handleEntityNotFound(_0x4f8bfa,null))['then'](function(_0x107421){if(_0x107421){return db[_0xcf84('0x5b')]['transaction'](function(_0x22c516){return db['Interval']['destroy']({'where':{'IntervalId':_0x177c9c[_0xcf84('0x48')]['id']},'transaction':_0x22c516})[_0xcf84('0x27')](function(_0x3b37c8){var _0x1bf520=_[_0xcf84('0x2d')](_0x177c9c['body'],function(_0x2737ad){delete _0x2737ad['id'];_0x2737ad[_0xcf84('0x57')]=_0x177c9c[_0xcf84('0x48')]['id'];return _0x2737ad;});return db['Interval']['bulkCreate'](_0x1bf520,{'transaction':_0x22c516});});})[_0xcf84('0x27')](function(){return db[_0xcf84('0x2e')]['findAll']({'where':{'IntervalId':_0x177c9c[_0xcf84('0x48')]['id']}});});}})[_0xcf84('0x27')](respondWithResult(_0x4f8bfa,null))[_0xcf84('0x46')](handleError(_0x4f8bfa,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index f5bf27c..37df0b1 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 _0xa707=['bluebird','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment'];(function(_0x22ffae,_0x185c52){var _0x19f241=function(_0xc150a9){while(--_0xc150a9){_0x22ffae['push'](_0x22ffae['shift']());}};_0x19f241(++_0x185c52);}(_0xa707,0x136));var _0x7a70=function(_0x771ee1,_0x2ec43c){_0x771ee1=_0x771ee1-0x0;var _0x2665e1=_0xa707[_0x771ee1];return _0x2665e1;};'use strict';var _=require(_0x7a70('0x0'));var util=require(_0x7a70('0x1'));var logger=require(_0x7a70('0x2'))(_0x7a70('0x3'));var moment=require(_0x7a70('0x4'));var BPromise=require(_0x7a70('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a70('0x6'));var rimraf=require(_0x7a70('0x7'));var config=require(_0x7a70('0x8'));var attributes=require(_0x7a70('0x9'));var extensions=require(_0x7a70('0xa'));module[_0x7a70('0xb')]=function(_0x257173,_0x446776){return _0x257173['define'](_0x7a70('0xc'),attributes,{'tableName':_0x7a70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4dd158,_0x122567){extensions[_0x7a70('0xe')](_0x257173,_0x4dd158);},'afterBulkCreate':function(_0x58053d,_0x3ad0d7,_0x12a6e2){_0x12a6e2();extensions['rewrite'](_0x257173,_0x58053d[0x0]);},'afterUpdate':function(_0x57dbdd,_0x5b7b22){extensions['rewrite'](_0x257173,_0x57dbdd);},'afterDestroy':function(_0x31cd2a,_0x4b3c56){extensions[_0x7a70('0xe')](_0x257173,_0x31cd2a);}}});}; \ No newline at end of file +var _0xd6bc=['request-promise','path','rimraf','./interval.attributes','../../components/extensions/rewrite','exports','Interval','rewrite','lodash','util','../../config/logger','api','bluebird'];(function(_0x138697,_0x2cf1f4){var _0x24b07a=function(_0x3ff19b){while(--_0x3ff19b){_0x138697['push'](_0x138697['shift']());}};_0x24b07a(++_0x2cf1f4);}(_0xd6bc,0x126));var _0xcd6b=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd6bc[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xcd6b('0x0'));var util=require(_0xcd6b('0x1'));var logger=require(_0xcd6b('0x2'))(_0xcd6b('0x3'));var moment=require('moment');var BPromise=require(_0xcd6b('0x4'));var rp=require(_0xcd6b('0x5'));var fs=require('fs');var path=require(_0xcd6b('0x6'));var rimraf=require(_0xcd6b('0x7'));var config=require('../../config/environment');var attributes=require(_0xcd6b('0x8'));var extensions=require(_0xcd6b('0x9'));module[_0xcd6b('0xa')]=function(_0x3dc942,_0x52787d){return _0x3dc942['define'](_0xcd6b('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3bcfa2,_0x12da3d){extensions['rewrite'](_0x3dc942,_0x3bcfa2);},'afterBulkCreate':function(_0xa35da2,_0x55f965,_0x358b2e){_0x358b2e();extensions['rewrite'](_0x3dc942,_0xa35da2[0x0]);},'afterUpdate':function(_0x5a00fa,_0x2ba090){extensions[_0xcd6b('0xc')](_0x3dc942,_0x5a00fa);},'afterDestroy':function(_0x4a714d,_0xd45cd5){extensions[_0xcd6b('0xc')](_0x3dc942,_0x4a714d);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index c240381..425097f 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 83bd967..02b633c 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x2a9d59,_0x821b78){var _0x4f624f=function(_0x3e8ff1){while(--_0x3e8ff1){_0x2a9d59['push'](_0x2a9d59['shift']());}};_0x4f624f(++_0x821b78);}(_0xadb5,0xad));var _0x5adb=function(_0x37423a,_0x4175fc){_0x37423a=_0x37423a-0x0;var _0x1f954c=_0xadb5[_0x37423a];return _0x1f954c;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x4eaf35,_0xd11da0){var _0x525743=function(_0xcd5839){while(--_0xcd5839){_0x4eaf35['push'](_0x4eaf35['shift']());}};_0x525743(++_0xd11da0);}(_0x2032,0xd9));var _0x2203=function(_0x5f8ed8,_0x30503a){_0x5f8ed8=_0x5f8ed8-0x0;var _0x97db97=_0x2032[_0x5f8ed8];return _0x97db97;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 8e91fbd..9c8ce8d 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 _0x7827=['toString','base64','stringify','request','setEncoding','data','end','json','parse','error','status','api.jira','send','body','x-forwarded-for','remoteAddress','socket','connection','bluebird','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','application/json','Basic\x20'];(function(_0xdbb6cb,_0x3b8fda){var _0x476b50=function(_0x470ebb){while(--_0x470ebb){_0xdbb6cb['push'](_0xdbb6cb['shift']());}};_0x476b50(++_0x3b8fda);}(_0x7827,0x1d5));var _0x7782=function(_0x4cb819,_0x382986){_0x4cb819=_0x4cb819-0x0;var _0x33fb18=_0x7827[_0x4cb819];return _0x33fb18;};'use strict';var BPromise=require(_0x7782('0x0'));var https=require('https');var logger=require('../../config/logger')('api');var USERNAME=_0x7782('0x1');var PASSWORD=_0x7782('0x2');function openIssue(_0x52a117,_0x3bc121){var _0x3ca686={'fields':{'project':{'key':_0x52a117[_0x7782('0x3')]||_0x7782('0x4')},'summary':(_0x52a117[_0x7782('0x5')]||'Report')+_0x7782('0x6')+_0x52a117['ip'],'description':_0x52a117[_0x7782('0x7')]||JSON['stringify'](_0x52a117),'issuetype':{'name':_0x52a117[_0x7782('0x8')]||_0x7782('0x9')}}};_0x3ca686[_0x7782('0xa')][_0x7782('0xb')]=_0x52a117[_0x7782('0xc')];_0x3ca686['fields'][_0x7782('0xd')]=_0x52a117['oldToken'];_0x3ca686['fields'][_0x7782('0xe')]=_0x52a117[_0x7782('0xf')];_0x3ca686[_0x7782('0xa')]['customfield_11503']=_0x52a117[_0x7782('0x10')];_0x3ca686[_0x7782('0xa')][_0x7782('0x11')]=_0x52a117[_0x7782('0x12')];_0x3ca686[_0x7782('0xa')][_0x7782('0x13')]=_0x52a117['ip'];var _0x512ee6={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x7782('0x14'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x7782('0x15'),'Authorization':_0x7782('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x7782('0x17')](_0x7782('0x18'))}};var _0x216a71=JSON[_0x7782('0x19')](_0x3ca686);var _0x3bdaec=https[_0x7782('0x1a')](_0x512ee6,function(_0xffef44){_0xffef44[_0x7782('0x1b')]('utf8');var _0x38565d='';_0xffef44['on'](_0x7782('0x1c'),function(_0x5d93c2){_0x38565d+=_0x5d93c2;});_0xffef44['on'](_0x7782('0x1d'),function(){if(_0x3bc121){return _0x3bc121['status'](_0xffef44['statusCode'])[_0x7782('0x1e')](JSON[_0x7782('0x1f')](_0x38565d));}});});_0x3bdaec['on'](_0x7782('0x20'),function(_0x35afec){if(_0x3bc121){return _0x3bc121[_0x7782('0x21')](0x1f4)[_0x7782('0x1e')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x7782('0x22')}]});}});_0x3bdaec['write'](_0x216a71);_0x3bdaec[_0x7782('0x1d')]();}exports['openIssue']=openIssue;exports[_0x7782('0x23')]=function(_0x5e1c3e,_0x1704de){_0x5e1c3e[_0x7782('0x24')]['ip']=_0x5e1c3e['headers'][_0x7782('0x25')]||_0x5e1c3e['connection'][_0x7782('0x26')]||_0x5e1c3e[_0x7782('0x27')]['remoteAddress']||_0x5e1c3e[_0x7782('0x28')][_0x7782('0x27')][_0x7782('0x26')];return openIssue(_0x5e1c3e[_0x7782('0x24')],_0x1704de);}; \ No newline at end of file +var _0x8c2a=['track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','request','setEncoding','data','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','connection','remoteAddress','socket','../../config/logger','support','key','MOTGUI','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x8c2a,0x93));var _0xa8c2=function(_0x2f3f3a,_0x574a87){_0x2f3f3a=_0x2f3f3a-0x0;var _0x4c0485=_0x8c2a[_0x2f3f3a];return _0x4c0485;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0xa8c2('0x0'))('api');var USERNAME=_0xa8c2('0x1');var PASSWORD='3eAmWpBVP0';function openIssue(_0x4223ba,_0x2b7df2){var _0x1b94de={'fields':{'project':{'key':_0x4223ba[_0xa8c2('0x2')]||_0xa8c2('0x3')},'summary':(_0x4223ba['summary']||_0xa8c2('0x4'))+_0xa8c2('0x5')+_0x4223ba['ip'],'description':_0x4223ba[_0xa8c2('0x6')]||JSON[_0xa8c2('0x7')](_0x4223ba),'issuetype':{'name':_0x4223ba['issuetype']||_0xa8c2('0x8')}}};_0x1b94de[_0xa8c2('0x9')][_0xa8c2('0xa')]=_0x4223ba[_0xa8c2('0xb')];_0x1b94de[_0xa8c2('0x9')][_0xa8c2('0xc')]=_0x4223ba[_0xa8c2('0xd')];_0x1b94de[_0xa8c2('0x9')][_0xa8c2('0xe')]=_0x4223ba[_0xa8c2('0xf')];_0x1b94de[_0xa8c2('0x9')][_0xa8c2('0x10')]=_0x4223ba[_0xa8c2('0x11')];_0x1b94de['fields'][_0xa8c2('0x12')]=_0x4223ba[_0xa8c2('0x13')];_0x1b94de[_0xa8c2('0x9')][_0xa8c2('0x14')]=_0x4223ba['ip'];var _0x5ad21e={'host':_0xa8c2('0x15'),'port':0x1bb,'path':_0xa8c2('0x16'),'method':_0xa8c2('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xa8c2('0x18'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xa8c2('0x19')]('base64')}};var _0x2c7598=JSON[_0xa8c2('0x7')](_0x1b94de);var _0x14d760=https[_0xa8c2('0x1a')](_0x5ad21e,function(_0x5d789d){_0x5d789d[_0xa8c2('0x1b')]('utf8');var _0x5a1829='';_0x5d789d['on'](_0xa8c2('0x1c'),function(_0x10844d){_0x5a1829+=_0x10844d;});_0x5d789d['on'](_0xa8c2('0x1d'),function(){if(_0x2b7df2){return _0x2b7df2[_0xa8c2('0x1e')](_0x5d789d[_0xa8c2('0x1f')])[_0xa8c2('0x20')](JSON[_0xa8c2('0x21')](_0x5a1829));}});});_0x14d760['on']('error',function(_0x3d926d){if(_0x2b7df2){return _0x2b7df2[_0xa8c2('0x1e')](0x1f4)['json']({'errors':[{'message':_0xa8c2('0x22'),'type':_0xa8c2('0x23')}]});}});_0x14d760[_0xa8c2('0x24')](_0x2c7598);_0x14d760[_0xa8c2('0x1d')]();}exports[_0xa8c2('0x25')]=openIssue;exports['send']=function(_0x1a5639,_0x58c406){_0x1a5639[_0xa8c2('0x26')]['ip']=_0x1a5639['headers']['x-forwarded-for']||_0x1a5639[_0xa8c2('0x27')]['remoteAddress']||_0x1a5639['socket'][_0xa8c2('0x28')]||_0x1a5639['connection'][_0xa8c2('0x29')]['remoteAddress'];return openIssue(_0x1a5639[_0xa8c2('0x26')],_0x58c406);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index cb631f7..b46fe57 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 _0x9bde=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','delete','destroy','util','connect-timeout','Router'];(function(_0x434815,_0x43286f){var _0x205f5=function(_0x1d22c8){while(--_0x1d22c8){_0x434815['push'](_0x434815['shift']());}};_0x205f5(++_0x43286f);}(_0x9bde,0xe1));var _0xe9bd=function(_0x9da8b2,_0x492627){_0x9da8b2=_0x9da8b2-0x0;var _0x1f0ae8=_0x9bde[_0x9da8b2];return _0x1f0ae8;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xc')]);router[_0xe9bd('0x8')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe9bd('0x10')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller['update']);router[_0xe9bd('0x11')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x17ba=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x17ba,0xab));var _0xa17b=function(_0x2f3c11,_0x357ee2){_0x2f3c11=_0x2f3c11-0x0;var _0x51ba37=_0x17ba[_0x2f3c11];return _0x51ba37;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),auth[_0xa17b('0xb')](),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router['post']('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x13')]);router[_0xa17b('0x14')]('/:id',auth[_0xa17b('0xb')](),controller[_0xa17b('0x15')]);module[_0xa17b('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 0c9a7d2..e7aaa36 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(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7a54,0x106));var _0x47a5=function(_0x5dd8ab,_0x10fb2d){_0x5dd8ab=_0x5dd8ab-0x0;var _0x13371a=_0x7a54[_0x5dd8ab];return _0x13371a;};'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(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a54,0x106));var _0x47a5=function(_0x17a3ad,_0x11f74){_0x17a3ad=_0x17a3ad-0x0;var _0x58353b=_0x7a54[_0x17a3ad];return _0x58353b;};'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 a27fa70..98aab6f 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 _0x1696=['count','limit','Content-Range','apply','reject','save','update','then','end','error','send','map','JscriptyAnswerReport','fieldName','type','model','keys','attributes','intersection','fields','hasOwnProperty','nolimit','query','order','sort','where','filters','pick','filter','merge','VIRTUAL','name','options','include','rows','show','length','includeAll','find','catch','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x1696,0x79));var _0x6169=function(_0xf25713,_0x2eeb1c){_0xf25713=_0xf25713-0x0;var _0x2c0839=_0x1696[_0xf25713];return _0x2c0839;};'use strict';var emlformat=require(_0x6169('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6169('0x1'));var jsonpatch=require(_0x6169('0x2'));var rp=require(_0x6169('0x3'));var moment=require(_0x6169('0x4'));var BPromise=require(_0x6169('0x5'));var Mustache=require(_0x6169('0x6'));var util=require(_0x6169('0x7'));var path=require(_0x6169('0x8'));var sox=require(_0x6169('0x9'));var csv=require('to-csv');var ejs=require(_0x6169('0xa'));var fs=require('fs');var fs_extra=require(_0x6169('0xb'));var _=require(_0x6169('0xc'));var squel=require(_0x6169('0xd'));var crypto=require(_0x6169('0xe'));var jsforce=require(_0x6169('0xf'));var deskjs=require(_0x6169('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6169('0x11'));var Papa=require('papaparse');var Redis=require(_0x6169('0x12'));var authService=require(_0x6169('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6169('0x14'));var hardwareService=require(_0x6169('0x15'));var logger=require(_0x6169('0x16'))(_0x6169('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6169('0x18'));var db=require(_0x6169('0x19'))['db'];function respondWithStatusCode(_0x5f342e,_0x9288c4){_0x9288c4=_0x9288c4||0xcc;return function(_0x2d6570){if(_0x2d6570){return _0x5f342e[_0x6169('0x1a')](_0x9288c4);}return _0x5f342e['status'](_0x9288c4)['end']();};}function respondWithResult(_0x4ba7bf,_0x2829cf){_0x2829cf=_0x2829cf||0xc8;return function(_0x2171d1){if(_0x2171d1){return _0x4ba7bf[_0x6169('0x1b')](_0x2829cf)[_0x6169('0x1c')](_0x2171d1);}};}function respondWithFilteredResult(_0x3ffa76,_0x5837d8){return function(_0x461294){if(_0x461294){var _0x3e2eb4=typeof _0x5837d8['offset']===_0x6169('0x1d')&&typeof _0x5837d8['limit']===_0x6169('0x1d');var _0x1e3b4e=_0x461294['count'];var _0xdfe11e=_0x3e2eb4?0x0:_0x5837d8[_0x6169('0x1e')];var _0xd47fea=_0x3e2eb4?_0x461294[_0x6169('0x1f')]:_0x5837d8[_0x6169('0x1e')]+_0x5837d8[_0x6169('0x20')];var _0x2b2e20;if(_0xd47fea>=_0x1e3b4e){_0xd47fea=_0x1e3b4e;_0x2b2e20=0xc8;}else{_0x2b2e20=0xce;}_0x3ffa76['status'](_0x2b2e20);return _0x3ffa76['set'](_0x6169('0x21'),_0xdfe11e+'-'+_0xd47fea+'/'+_0x1e3b4e)[_0x6169('0x1c')](_0x461294);}return null;};}function patchUpdates(_0x486186){return function(_0x34675a){try{jsonpatch[_0x6169('0x22')](_0x34675a,_0x486186,!![]);}catch(_0x2f3ef3){return BPromise[_0x6169('0x23')](_0x2f3ef3);}return _0x34675a[_0x6169('0x24')]();};}function saveUpdates(_0x51598d,_0x2506bb){return function(_0x5579b9){if(_0x5579b9){return _0x5579b9[_0x6169('0x25')](_0x51598d)[_0x6169('0x26')](function(_0x13e390){return _0x13e390;});}return null;};}function removeEntity(_0x4b35ca,_0x3b0e8a){return function(_0x1f90aa){if(_0x1f90aa){return _0x1f90aa['destroy']()['then'](function(){_0x4b35ca[_0x6169('0x1b')](0xcc)[_0x6169('0x27')]();});}};}function handleEntityNotFound(_0x3e706c,_0x20b40c){return function(_0x1b207e){if(!_0x1b207e){_0x3e706c[_0x6169('0x1a')](0x194);}return _0x1b207e;};}function handleError(_0x647f57,_0x3010f7){_0x3010f7=_0x3010f7||0x1f4;return function(_0x5f2e3b){logger[_0x6169('0x28')](_0x5f2e3b['stack']);if(_0x5f2e3b['name']){delete _0x5f2e3b['name'];}_0x647f57['status'](_0x3010f7)[_0x6169('0x29')](_0x5f2e3b);};}exports['index']=function(_0x4466f3,_0x136d11){var _0x15bef9={},_0x512977={},_0x51e2ea={'count':0x0,'rows':[]};var _0x544dcc=_[_0x6169('0x2a')](db[_0x6169('0x2b')]['rawAttributes'],function(_0x4c6036){return{'name':_0x4c6036[_0x6169('0x2c')],'type':_0x4c6036[_0x6169('0x2d')]['key']};});_0x512977[_0x6169('0x2e')]=_[_0x6169('0x2a')](_0x544dcc,'name');_0x512977['query']=_[_0x6169('0x2f')](_0x4466f3['query']);_0x512977['filters']=_['intersection'](_0x512977[_0x6169('0x2e')],_0x512977['query']);_0x15bef9[_0x6169('0x30')]=_[_0x6169('0x31')](_0x512977['model'],qs[_0x6169('0x32')](_0x4466f3['query'][_0x6169('0x32')]));_0x15bef9[_0x6169('0x30')]=_0x15bef9[_0x6169('0x30')]['length']?_0x15bef9['attributes']:_0x512977['model'];if(!_0x4466f3['query'][_0x6169('0x33')](_0x6169('0x34'))){_0x15bef9['limit']=qs[_0x6169('0x20')](_0x4466f3[_0x6169('0x35')][_0x6169('0x20')]);_0x15bef9['offset']=qs[_0x6169('0x1e')](_0x4466f3[_0x6169('0x35')][_0x6169('0x1e')]);}_0x15bef9[_0x6169('0x36')]=qs[_0x6169('0x37')](_0x4466f3[_0x6169('0x35')][_0x6169('0x37')]);_0x15bef9[_0x6169('0x38')]=qs[_0x6169('0x39')](_[_0x6169('0x3a')](_0x4466f3[_0x6169('0x35')],_0x512977['filters']),_0x544dcc);if(_0x4466f3[_0x6169('0x35')][_0x6169('0x3b')]){_0x15bef9['where']=_[_0x6169('0x3c')](_0x15bef9[_0x6169('0x38')],{'$or':_[_0x6169('0x2a')](_0x544dcc,function(_0xdfce5f){if(_0xdfce5f[_0x6169('0x2d')]!==_0x6169('0x3d')){var _0x388ca5={};_0x388ca5[_0xdfce5f[_0x6169('0x3e')]]={'$like':'%'+_0x4466f3[_0x6169('0x35')]['filter']+'%'};return _0x388ca5;}})});}_0x15bef9=_[_0x6169('0x3c')]({},_0x15bef9,_0x4466f3[_0x6169('0x3f')]);var _0x273730={'where':_0x15bef9['where']};return db[_0x6169('0x2b')][_0x6169('0x1f')](_0x273730)['then'](function(_0x3026d7){_0x51e2ea['count']=_0x3026d7;if(_0x4466f3[_0x6169('0x35')]['includeAll']){_0x15bef9[_0x6169('0x40')]=[{'all':!![]}];}return db[_0x6169('0x2b')]['findAll'](_0x15bef9);})[_0x6169('0x26')](function(_0x4969e3){_0x51e2ea[_0x6169('0x41')]=_0x4969e3;return _0x51e2ea;})[_0x6169('0x26')](respondWithFilteredResult(_0x136d11,_0x15bef9))['catch'](handleError(_0x136d11,null));};exports[_0x6169('0x42')]=function(_0x4b07e8,_0x34ad06){var _0x545863={'raw':!![],'where':{'id':_0x4b07e8['params']['id']}},_0x1a7849={};_0x1a7849['model']=_[_0x6169('0x2f')](db[_0x6169('0x2b')]['rawAttributes']);_0x1a7849[_0x6169('0x35')]=_['keys'](_0x4b07e8[_0x6169('0x35')]);_0x1a7849[_0x6169('0x39')]=_['intersection'](_0x1a7849[_0x6169('0x2e')],_0x1a7849['query']);_0x545863['attributes']=_[_0x6169('0x31')](_0x1a7849[_0x6169('0x2e')],qs['fields'](_0x4b07e8[_0x6169('0x35')]['fields']));_0x545863[_0x6169('0x30')]=_0x545863[_0x6169('0x30')][_0x6169('0x43')]?_0x545863['attributes']:_0x1a7849[_0x6169('0x2e')];if(_0x4b07e8[_0x6169('0x35')][_0x6169('0x44')]){_0x545863[_0x6169('0x40')]=[{'all':!![]}];}_0x545863=_[_0x6169('0x3c')]({},_0x545863,_0x4b07e8[_0x6169('0x3f')]);return db['JscriptyAnswerReport'][_0x6169('0x45')](_0x545863)[_0x6169('0x26')](handleEntityNotFound(_0x34ad06,null))[_0x6169('0x26')](respondWithResult(_0x34ad06,null))[_0x6169('0x46')](handleError(_0x34ad06,null));};exports[_0x6169('0x47')]=function(_0x4d004e,_0x4ab194){return db[_0x6169('0x2b')][_0x6169('0x47')](_0x4d004e[_0x6169('0x48')],{})[_0x6169('0x26')](respondWithResult(_0x4ab194,0xc9))[_0x6169('0x46')](handleError(_0x4ab194,null));};exports[_0x6169('0x25')]=function(_0x11bc4b,_0xcffe00){if(_0x11bc4b[_0x6169('0x48')]['id']){delete _0x11bc4b[_0x6169('0x48')]['id'];}return db[_0x6169('0x2b')]['find']({'where':{'id':_0x11bc4b[_0x6169('0x49')]['id']}})['then'](handleEntityNotFound(_0xcffe00,null))[_0x6169('0x26')](saveUpdates(_0x11bc4b[_0x6169('0x48')],null))['then'](respondWithResult(_0xcffe00,null))[_0x6169('0x46')](handleError(_0xcffe00,null));};exports[_0x6169('0x4a')]=function(_0x291a5b,_0x1dd004){return db['JscriptyAnswerReport'][_0x6169('0x45')]({'where':{'id':_0x291a5b['params']['id']}})[_0x6169('0x26')](handleEntityNotFound(_0x1dd004,null))[_0x6169('0x26')](removeEntity(_0x1dd004,null))[_0x6169('0x46')](handleError(_0x1dd004,null));};exports[_0x6169('0x4b')]=function(_0x38c8cd,_0x559522){return db[_0x6169('0x2b')]['describe']()[_0x6169('0x26')](respondWithResult(_0x559522,null))[_0x6169('0x46')](handleError(_0x559522,null));}; \ No newline at end of file +var _0x938d=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','merge','type','VIRTUAL','filter','JscriptyAnswerReport','includeAll','findAll','rows','catch','params','include','options','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x3e5f6d,_0x121db6){var _0x1bea6e=function(_0x435c7c){while(--_0x435c7c){_0x3e5f6d['push'](_0x3e5f6d['shift']());}};_0x1bea6e(++_0x121db6);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd938('0x0'));var rimraf=require(_0xd938('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd938('0x2'));var rp=require(_0xd938('0x3'));var moment=require(_0xd938('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd938('0x5'));var path=require(_0xd938('0x6'));var sox=require(_0xd938('0x7'));var csv=require('to-csv');var ejs=require(_0xd938('0x8'));var fs=require('fs');var fs_extra=require(_0xd938('0x9'));var _=require(_0xd938('0xa'));var squel=require(_0xd938('0xb'));var crypto=require(_0xd938('0xc'));var jsforce=require(_0xd938('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd938('0xe'));var querystring=require(_0xd938('0xf'));var Papa=require(_0xd938('0x10'));var Redis=require(_0xd938('0x11'));var authService=require(_0xd938('0x12'));var qs=require(_0xd938('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd938('0x14'));var logger=require(_0xd938('0x15'))(_0xd938('0x16'));var utils=require(_0xd938('0x17'));var config=require(_0xd938('0x18'));var licenseUtil=require(_0xd938('0x19'));var db=require(_0xd938('0x1a'))['db'];function respondWithStatusCode(_0x47327e,_0x464c6d){_0x464c6d=_0x464c6d||0xcc;return function(_0x9033a9){if(_0x9033a9){return _0x47327e[_0xd938('0x1b')](_0x464c6d);}return _0x47327e[_0xd938('0x1c')](_0x464c6d)[_0xd938('0x1d')]();};}function respondWithResult(_0x542312,_0x4bebac){_0x4bebac=_0x4bebac||0xc8;return function(_0x5c9f99){if(_0x5c9f99){return _0x542312[_0xd938('0x1c')](_0x4bebac)[_0xd938('0x1e')](_0x5c9f99);}};}function respondWithFilteredResult(_0x217728,_0x559050){return function(_0x525bce){if(_0x525bce){var _0x9ab113=typeof _0x559050[_0xd938('0x1f')]==='undefined'&&typeof _0x559050['limit']==='undefined';var _0x352648=_0x525bce[_0xd938('0x20')];var _0x355185=_0x9ab113?0x0:_0x559050['offset'];var _0x103e84=_0x9ab113?_0x525bce[_0xd938('0x20')]:_0x559050[_0xd938('0x1f')]+_0x559050[_0xd938('0x21')];var _0x1f31bc;if(_0x103e84>=_0x352648){_0x103e84=_0x352648;_0x1f31bc=0xc8;}else{_0x1f31bc=0xce;}_0x217728['status'](_0x1f31bc);return _0x217728[_0xd938('0x22')]('Content-Range',_0x355185+'-'+_0x103e84+'/'+_0x352648)['json'](_0x525bce);}return null;};}function patchUpdates(_0x2c46b9){return function(_0x5d0241){try{jsonpatch[_0xd938('0x23')](_0x5d0241,_0x2c46b9,!![]);}catch(_0x2f8bf2){return BPromise[_0xd938('0x24')](_0x2f8bf2);}return _0x5d0241[_0xd938('0x25')]();};}function saveUpdates(_0xf2a559,_0x589229){return function(_0x20e9f9){if(_0x20e9f9){return _0x20e9f9[_0xd938('0x26')](_0xf2a559)[_0xd938('0x27')](function(_0x3afd46){return _0x3afd46;});}return null;};}function removeEntity(_0x2a1b2f,_0x28f56a){return function(_0x2f571b){if(_0x2f571b){return _0x2f571b[_0xd938('0x28')]()[_0xd938('0x27')](function(){_0x2a1b2f[_0xd938('0x1c')](0xcc)[_0xd938('0x1d')]();});}};}function handleEntityNotFound(_0x5bc216,_0x595d85){return function(_0x30dbd7){if(!_0x30dbd7){_0x5bc216[_0xd938('0x1b')](0x194);}return _0x30dbd7;};}function handleError(_0x3d98b9,_0x5f2a67){_0x5f2a67=_0x5f2a67||0x1f4;return function(_0x10044c){logger['error'](_0x10044c[_0xd938('0x29')]);if(_0x10044c['name']){delete _0x10044c[_0xd938('0x2a')];}_0x3d98b9['status'](_0x5f2a67)[_0xd938('0x2b')](_0x10044c);};}exports[_0xd938('0x2c')]=function(_0x37c08f,_0x372b50){var _0x483d11={},_0x20a873={},_0x450134={'count':0x0,'rows':[]};var _0x207549=_[_0xd938('0x2d')](db['JscriptyAnswerReport'][_0xd938('0x2e')],function(_0x350e6e){return{'name':_0x350e6e[_0xd938('0x2f')],'type':_0x350e6e['type'][_0xd938('0x30')]};});_0x20a873[_0xd938('0x31')]=_[_0xd938('0x2d')](_0x207549,_0xd938('0x2a'));_0x20a873[_0xd938('0x32')]=_[_0xd938('0x33')](_0x37c08f[_0xd938('0x32')]);_0x20a873[_0xd938('0x34')]=_['intersection'](_0x20a873[_0xd938('0x31')],_0x20a873[_0xd938('0x32')]);_0x483d11[_0xd938('0x35')]=_[_0xd938('0x36')](_0x20a873['model'],qs[_0xd938('0x37')](_0x37c08f[_0xd938('0x32')][_0xd938('0x37')]));_0x483d11[_0xd938('0x35')]=_0x483d11['attributes'][_0xd938('0x38')]?_0x483d11[_0xd938('0x35')]:_0x20a873[_0xd938('0x31')];if(!_0x37c08f[_0xd938('0x32')]['hasOwnProperty'](_0xd938('0x39'))){_0x483d11[_0xd938('0x21')]=qs['limit'](_0x37c08f[_0xd938('0x32')]['limit']);_0x483d11['offset']=qs[_0xd938('0x1f')](_0x37c08f[_0xd938('0x32')][_0xd938('0x1f')]);}_0x483d11['order']=qs[_0xd938('0x3a')](_0x37c08f[_0xd938('0x32')][_0xd938('0x3a')]);_0x483d11[_0xd938('0x3b')]=qs['filters'](_['pick'](_0x37c08f[_0xd938('0x32')],_0x20a873[_0xd938('0x34')]),_0x207549);if(_0x37c08f['query']['filter']){_0x483d11['where']=_[_0xd938('0x3c')](_0x483d11[_0xd938('0x3b')],{'$or':_[_0xd938('0x2d')](_0x207549,function(_0x339fc7){if(_0x339fc7[_0xd938('0x3d')]!==_0xd938('0x3e')){var _0x4ca304={};_0x4ca304[_0x339fc7[_0xd938('0x2a')]]={'$like':'%'+_0x37c08f[_0xd938('0x32')][_0xd938('0x3f')]+'%'};return _0x4ca304;}})});}_0x483d11=_['merge']({},_0x483d11,_0x37c08f['options']);var _0x1a4d76={'where':_0x483d11['where']};return db[_0xd938('0x40')][_0xd938('0x20')](_0x1a4d76)[_0xd938('0x27')](function(_0x449f1a){_0x450134[_0xd938('0x20')]=_0x449f1a;if(_0x37c08f[_0xd938('0x32')][_0xd938('0x41')]){_0x483d11['include']=[{'all':!![]}];}return db[_0xd938('0x40')][_0xd938('0x42')](_0x483d11);})[_0xd938('0x27')](function(_0x284359){_0x450134[_0xd938('0x43')]=_0x284359;return _0x450134;})[_0xd938('0x27')](respondWithFilteredResult(_0x372b50,_0x483d11))[_0xd938('0x44')](handleError(_0x372b50,null));};exports['show']=function(_0x177d24,_0x2db702){var _0x545925={'raw':!![],'where':{'id':_0x177d24[_0xd938('0x45')]['id']}},_0x215409={};_0x215409['model']=_[_0xd938('0x33')](db[_0xd938('0x40')][_0xd938('0x2e')]);_0x215409[_0xd938('0x32')]=_['keys'](_0x177d24['query']);_0x215409[_0xd938('0x34')]=_[_0xd938('0x36')](_0x215409[_0xd938('0x31')],_0x215409[_0xd938('0x32')]);_0x545925[_0xd938('0x35')]=_['intersection'](_0x215409[_0xd938('0x31')],qs[_0xd938('0x37')](_0x177d24['query'][_0xd938('0x37')]));_0x545925['attributes']=_0x545925[_0xd938('0x35')]['length']?_0x545925['attributes']:_0x215409[_0xd938('0x31')];if(_0x177d24['query'][_0xd938('0x41')]){_0x545925[_0xd938('0x46')]=[{'all':!![]}];}_0x545925=_['merge']({},_0x545925,_0x177d24[_0xd938('0x47')]);return db[_0xd938('0x40')]['find'](_0x545925)[_0xd938('0x27')](handleEntityNotFound(_0x2db702,null))[_0xd938('0x27')](respondWithResult(_0x2db702,null))['catch'](handleError(_0x2db702,null));};exports[_0xd938('0x48')]=function(_0x381309,_0x7bdc2a){return db[_0xd938('0x40')][_0xd938('0x48')](_0x381309[_0xd938('0x49')],{})[_0xd938('0x27')](respondWithResult(_0x7bdc2a,0xc9))['catch'](handleError(_0x7bdc2a,null));};exports[_0xd938('0x26')]=function(_0xdc5d41,_0x2242be){if(_0xdc5d41[_0xd938('0x49')]['id']){delete _0xdc5d41[_0xd938('0x49')]['id'];}return db[_0xd938('0x40')]['find']({'where':{'id':_0xdc5d41[_0xd938('0x45')]['id']}})[_0xd938('0x27')](handleEntityNotFound(_0x2242be,null))[_0xd938('0x27')](saveUpdates(_0xdc5d41[_0xd938('0x49')],null))[_0xd938('0x27')](respondWithResult(_0x2242be,null))[_0xd938('0x44')](handleError(_0x2242be,null));};exports[_0xd938('0x28')]=function(_0xf1f17d,_0x2c1e18){return db[_0xd938('0x40')][_0xd938('0x4a')]({'where':{'id':_0xf1f17d[_0xd938('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c1e18,null))['then'](removeEntity(_0x2c1e18,null))['catch'](handleError(_0x2c1e18,null));};exports[_0xd938('0x4b')]=function(_0x20ee09,_0x17d5ce){return db[_0xd938('0x40')][_0xd938('0x4b')]()[_0xd938('0x27')](respondWithResult(_0x17d5ce,null))[_0xd938('0x44')](handleError(_0x17d5ce,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 882a3b2..60b75d3 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 _0x0329=['../../config/environment','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0329,0x16d));var _0x9032=function(_0x3496d3,_0x4467a2){_0x3496d3=_0x3496d3-0x0;var _0x509096=_0x0329[_0x3496d3];return _0x509096;};'use strict';var _=require(_0x9032('0x0'));var util=require(_0x9032('0x1'));var logger=require(_0x9032('0x2'))(_0x9032('0x3'));var moment=require(_0x9032('0x4'));var BPromise=require(_0x9032('0x5'));var rp=require(_0x9032('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9032('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x9032('0x8')]=function(_0x2d00cc,_0xd4d662){return _0x2d00cc[_0x9032('0x9')](_0x9032('0xa'),attributes,{'tableName':_0x9032('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5bf=['define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x409251,_0x40f525){var _0x216f47=function(_0x517895){while(--_0x517895){_0x409251['push'](_0x409251['shift']());}};_0x216f47(++_0x40f525);}(_0xb5bf,0x1d7));var _0xfb5b=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xb5bf[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0xfb5b('0x0'));var util=require(_0xfb5b('0x1'));var logger=require(_0xfb5b('0x2'))('api');var moment=require(_0xfb5b('0x3'));var BPromise=require('bluebird');var rp=require(_0xfb5b('0x4'));var fs=require('fs');var path=require(_0xfb5b('0x5'));var rimraf=require(_0xfb5b('0x6'));var config=require(_0xfb5b('0x7'));var attributes=require(_0xfb5b('0x8'));module[_0xfb5b('0x9')]=function(_0x5a9c12,_0x42b1c5){return _0x5a9c12[_0xfb5b('0xa')](_0xfb5b('0xb'),attributes,{'tableName':_0xfb5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 5facaf2..1f6055d 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 _0xd123=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','catch','util'];(function(_0x1ebc88,_0x638cd6){var _0xcef294=function(_0x5104bb){while(--_0x5104bb){_0x1ebc88['push'](_0x1ebc88['shift']());}};_0xcef294(++_0x638cd6);}(_0xd123,0xfb));var _0x3d12=function(_0x30f020,_0x7d2cfa){_0x30f020=_0x30f020-0x0;var _0x3933c0=_0xd123[_0x30f020];return _0x3933c0;};'use strict';var _=require('lodash');var util=require(_0x3d12('0x0'));var moment=require(_0x3d12('0x1'));var BPromise=require('bluebird');var rs=require(_0x3d12('0x2'));var fs=require('fs');var Redis=require(_0x3d12('0x3'));var db=require(_0x3d12('0x4'))['db'];var utils=require(_0x3d12('0x5'));var logger=require(_0x3d12('0x6'))(_0x3d12('0x7'));var config=require(_0x3d12('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3d12('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2851ac,_0x15f475,_0x192667){return new BPromise(function(_0x3cdcb7,_0x5419ae){return client[_0x3d12('0xa')](_0x2851ac,_0x192667)['then'](function(_0x43b228){logger[_0x3d12('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x15f475,'request\x20sent');logger[_0x3d12('0xc')](_0x3d12('0xd'),_0x15f475,_0x3d12('0xe'),JSON[_0x3d12('0xf')](_0x43b228));if(_0x43b228['error']){if(_0x43b228[_0x3d12('0x10')][_0x3d12('0x11')]===0x1f4){logger[_0x3d12('0x10')](_0x3d12('0x12'),_0x15f475,_0x43b228[_0x3d12('0x10')]['message']);return _0x5419ae(_0x43b228[_0x3d12('0x10')]['message']);}logger['error'](_0x3d12('0x12'),_0x15f475,_0x43b228[_0x3d12('0x10')][_0x3d12('0x13')]);return _0x3cdcb7(_0x43b228[_0x3d12('0x10')][_0x3d12('0x13')]);}else{logger[_0x3d12('0xb')](_0x3d12('0x12'),_0x15f475,_0x3d12('0xe'));_0x3cdcb7(_0x43b228['result'][_0x3d12('0x13')]);}})[_0x3d12('0x14')](function(_0x556002){logger['error'](_0x3d12('0x12'),_0x15f475,_0x556002);_0x5419ae(_0x556002);});});} \ No newline at end of file +var _0x6353=['debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent'];(function(_0x135188,_0x1afd71){var _0x371f9e=function(_0x48a4bf){while(--_0x48a4bf){_0x135188['push'](_0x135188['shift']());}};_0x371f9e(++_0x1afd71);}(_0x6353,0x196));var _0x3635=function(_0x14f8f0,_0x5e2d51){_0x14f8f0=_0x14f8f0-0x0;var _0x5a1286=_0x6353[_0x14f8f0];return _0x5a1286;};'use strict';var _=require(_0x3635('0x0'));var util=require(_0x3635('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3635('0x2'));var fs=require('fs');var Redis=require(_0x3635('0x3'));var db=require(_0x3635('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3635('0x5'))(_0x3635('0x6'));var config=require(_0x3635('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3635('0x8')][_0x3635('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x130aa6,_0x39ce72,_0x16b304){return new BPromise(function(_0x986c47,_0x3c33ae){return client[_0x3635('0xa')](_0x130aa6,_0x16b304)[_0x3635('0xb')](function(_0x4ac391){logger['info'](_0x3635('0xc'),_0x39ce72,_0x3635('0xd'));logger[_0x3635('0xe')](_0x3635('0xf'),_0x39ce72,'request\x20sent',JSON[_0x3635('0x10')](_0x4ac391));if(_0x4ac391[_0x3635('0x11')]){if(_0x4ac391[_0x3635('0x11')]['code']===0x1f4){logger[_0x3635('0x11')](_0x3635('0xc'),_0x39ce72,_0x4ac391[_0x3635('0x11')][_0x3635('0x12')]);return _0x3c33ae(_0x4ac391['error'][_0x3635('0x12')]);}logger[_0x3635('0x11')](_0x3635('0xc'),_0x39ce72,_0x4ac391['error'][_0x3635('0x12')]);return _0x986c47(_0x4ac391[_0x3635('0x11')][_0x3635('0x12')]);}else{logger[_0x3635('0x13')](_0x3635('0xc'),_0x39ce72,_0x3635('0xd'));_0x986c47(_0x4ac391['result'][_0x3635('0x12')]);}})[_0x3635('0x14')](function(_0x1b8e30){logger[_0x3635('0x11')](_0x3635('0xc'),_0x39ce72,_0x1b8e30);_0x3c33ae(_0x1b8e30);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 724407b..5e29b7f 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 _0x8d25=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','/:id/sessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','/:id/clone','clone','put','update','delete'];(function(_0x264edd,_0x5a65cb){var _0xcad74c=function(_0x454967){while(--_0x454967){_0x264edd['push'](_0x264edd['shift']());}};_0xcad74c(++_0x5a65cb);}(_0x8d25,0x1a1));var _0x58d2=function(_0x150eca,_0x3663c3){_0x150eca=_0x150eca-0x0;var _0xa75e1b=_0x8d25[_0x150eca];return _0xa75e1b;};'use strict';var multer=require(_0x58d2('0x0'));var util=require(_0x58d2('0x1'));var path=require(_0x58d2('0x2'));var timeout=require(_0x58d2('0x3'));var express=require(_0x58d2('0x4'));var router=express[_0x58d2('0x5')]();var fs_extra=require(_0x58d2('0x6'));var auth=require(_0x58d2('0x7'));var interaction=require(_0x58d2('0x8'));var config=require('../../config/environment');var controller=require(_0x58d2('0x9'));router[_0x58d2('0xa')]('/',auth[_0x58d2('0xb')](),controller[_0x58d2('0xc')]);router[_0x58d2('0xa')](_0x58d2('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x58d2('0xa')](_0x58d2('0xe'),auth[_0x58d2('0xb')](),controller['getSessions']);router['get'](_0x58d2('0xf'),auth[_0x58d2('0xb')](),controller[_0x58d2('0x10')]);router[_0x58d2('0xa')](_0x58d2('0x11'),auth['isAuthenticated'](),timeout('30s'),controller[_0x58d2('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x58d2('0x13')](_0x58d2('0x14'),auth[_0x58d2('0xb')](),controller[_0x58d2('0x15')]);router[_0x58d2('0x16')]('/:id',auth[_0x58d2('0xb')](),controller[_0x58d2('0x17')]);router[_0x58d2('0x18')](_0x58d2('0xd'),auth[_0x58d2('0xb')](),controller['destroy']);module[_0x58d2('0x19')]=router; \ No newline at end of file +var _0x7f0e=['getSummary','post','create','/:id/clone','clone','put','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0x7f0e,0x1d5));var _0xe7f0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7f0e[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7f0('0x0'));var timeout=require(_0xe7f0('0x1'));var express=require(_0xe7f0('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe7f0('0x3'));var interaction=require(_0xe7f0('0x4'));var config=require(_0xe7f0('0x5'));var controller=require(_0xe7f0('0x6'));router[_0xe7f0('0x7')]('/',auth['isAuthenticated'](),controller[_0xe7f0('0x8')]);router[_0xe7f0('0x7')](_0xe7f0('0x9'),auth[_0xe7f0('0xa')](),controller[_0xe7f0('0xb')]);router[_0xe7f0('0x7')](_0xe7f0('0xc'),auth[_0xe7f0('0xa')](),controller[_0xe7f0('0xd')]);router['get'](_0xe7f0('0xe'),auth[_0xe7f0('0xa')](),controller[_0xe7f0('0xf')]);router[_0xe7f0('0x7')](_0xe7f0('0x10'),auth[_0xe7f0('0xa')](),timeout('30s'),controller[_0xe7f0('0x11')]);router[_0xe7f0('0x12')]('/',auth[_0xe7f0('0xa')](),controller[_0xe7f0('0x13')]);router[_0xe7f0('0x12')](_0xe7f0('0x14'),auth[_0xe7f0('0xa')](),controller[_0xe7f0('0x15')]);router[_0xe7f0('0x16')](_0xe7f0('0x9'),auth[_0xe7f0('0xa')](),controller[_0xe7f0('0x17')]);router[_0xe7f0('0x18')](_0xe7f0('0x9'),auth[_0xe7f0('0xa')](),controller[_0xe7f0('0x19')]);module[_0xe7f0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 002638d..e6f809e 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 _0xe31c=['setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT','long','isObjectLike'];(function(_0x1bce91,_0x2b6500){var _0x3c20c2=function(_0x1eeb06){while(--_0x1eeb06){_0x1bce91['push'](_0x1bce91['shift']());}};_0x3c20c2(++_0x2b6500);}(_0xe31c,0x106));var _0xce31=function(_0x564b62,_0x1aaf5b){_0x564b62=_0x564b62-0x0;var _0x4b33cf=_0xe31c[_0x564b62];return _0x4b33cf;};'use strict';var Sequelize=require(_0xce31('0x0'));var _=require(_0xce31('0x1'));var util=require(_0xce31('0x2'));module[_0xce31('0x3')]={'name':{'type':Sequelize[_0xce31('0x4')],'unique':'name'},'description':{'type':Sequelize[_0xce31('0x4')]},'formData':{'type':Sequelize[_0xce31('0x5')](_0xce31('0x6')),'set':function(_0x1a8be3){if(_[_0xce31('0x7')](_0x1a8be3)){this[_0xce31('0x8')](_0xce31('0x9'),JSON[_0xce31('0xa')](_0x1a8be3));}else if(_[_0xce31('0xb')](_0x1a8be3)){this[_0xce31('0x8')]('formData',_0x1a8be3);}else{this[_0xce31('0x8')](_0xce31('0x9'),util[_0xce31('0xc')](_0xce31('0xd'),this[_0xce31('0xe')](_0xce31('0xf'))||'',this[_0xce31('0xe')](_0xce31('0x10'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xce31('0x11')],'defaultValue':![]}}; \ No newline at end of file +var _0x0ef2=['getDataValue','description','BOOLEAN','util','STRING','TEXT','long','isObjectLike','setDataValue','formData','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x0ef2,0x12e));var _0x20ef=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x0ef2[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x20ef('0x0'));module['exports']={'name':{'type':Sequelize[_0x20ef('0x1')],'unique':'name'},'description':{'type':Sequelize[_0x20ef('0x1')]},'formData':{'type':Sequelize[_0x20ef('0x2')](_0x20ef('0x3')),'set':function(_0x1f17c5){if(_[_0x20ef('0x4')](_0x1f17c5)){this[_0x20ef('0x5')](_0x20ef('0x6'),JSON['stringify'](_0x1f17c5));}else if(_[_0x20ef('0x7')](_0x1f17c5)){this['setDataValue'](_0x20ef('0x6'),_0x1f17c5);}else{this[_0x20ef('0x5')](_0x20ef('0x6'),util[_0x20ef('0x8')](_0x20ef('0x9'),this[_0x20ef('0xa')]('name')||'',this[_0x20ef('0xa')](_0x20ef('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x20ef('0xc')],'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 7c679de..f212bbb 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 _0xd1d3=['sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','Projects','UserProfileResource','error','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','findOne','sort','ProjectId','JscriptySessionReport','findAll','order','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0xd1d3,0xd7));var _0x3d1d=function(_0x582f9b,_0x53a2ba){_0x582f9b=_0x582f9b-0x0;var _0x3ebf12=_0xd1d3[_0x582f9b];return _0x3ebf12;};'use strict';var emlformat=require(_0x3d1d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3d1d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d1d('0x2'));var moment=require(_0x3d1d('0x3'));var BPromise=require(_0x3d1d('0x4'));var Mustache=require(_0x3d1d('0x5'));var util=require(_0x3d1d('0x6'));var path=require('path');var sox=require(_0x3d1d('0x7'));var csv=require(_0x3d1d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d1d('0x9'));var _=require(_0x3d1d('0xa'));var squel=require('squel');var crypto=require(_0x3d1d('0xb'));var jsforce=require(_0x3d1d('0xc'));var deskjs=require(_0x3d1d('0xd'));var toCsv=require(_0x3d1d('0x8'));var querystring=require(_0x3d1d('0xe'));var Papa=require(_0x3d1d('0xf'));var Redis=require(_0x3d1d('0x10'));var authService=require(_0x3d1d('0x11'));var qs=require(_0x3d1d('0x12'));var as=require(_0x3d1d('0x13'));var hardwareService=require(_0x3d1d('0x14'));var logger=require(_0x3d1d('0x15'))(_0x3d1d('0x16'));var utils=require(_0x3d1d('0x17'));var config=require(_0x3d1d('0x18'));var licenseUtil=require(_0x3d1d('0x19'));var db=require(_0x3d1d('0x1a'))['db'];function respondWithStatusCode(_0x24b002,_0x8a7a6e){_0x8a7a6e=_0x8a7a6e||0xcc;return function(_0x5d7db5){if(_0x5d7db5){return _0x24b002[_0x3d1d('0x1b')](_0x8a7a6e);}return _0x24b002[_0x3d1d('0x1c')](_0x8a7a6e)[_0x3d1d('0x1d')]();};}function respondWithResult(_0x277ada,_0x461a0a){_0x461a0a=_0x461a0a||0xc8;return function(_0x12dd84){if(_0x12dd84){return _0x277ada[_0x3d1d('0x1c')](_0x461a0a)[_0x3d1d('0x1e')](_0x12dd84);}};}function respondWithFilteredResult(_0x59fa63,_0x325e90){return function(_0x128f51){if(_0x128f51){var _0x5d6a51=typeof _0x325e90['offset']===_0x3d1d('0x1f')&&typeof _0x325e90[_0x3d1d('0x20')]===_0x3d1d('0x1f');var _0x2f984c=_0x128f51['count'];var _0x1898ce=_0x5d6a51?0x0:_0x325e90[_0x3d1d('0x21')];var _0x1f6035=_0x5d6a51?_0x128f51[_0x3d1d('0x22')]:_0x325e90[_0x3d1d('0x21')]+_0x325e90[_0x3d1d('0x20')];var _0x4b1f8f;if(_0x1f6035>=_0x2f984c){_0x1f6035=_0x2f984c;_0x4b1f8f=0xc8;}else{_0x4b1f8f=0xce;}_0x59fa63['status'](_0x4b1f8f);return _0x59fa63['set'](_0x3d1d('0x23'),_0x1898ce+'-'+_0x1f6035+'/'+_0x2f984c)[_0x3d1d('0x1e')](_0x128f51);}return null;};}function patchUpdates(_0x982a88){return function(_0xedf825){try{jsonpatch[_0x3d1d('0x24')](_0xedf825,_0x982a88,!![]);}catch(_0x4737f4){return BPromise[_0x3d1d('0x25')](_0x4737f4);}return _0xedf825[_0x3d1d('0x26')]();};}function saveUpdates(_0x3f1543,_0x4bbb58){return function(_0x553fa1){if(_0x553fa1){return _0x553fa1[_0x3d1d('0x27')](_0x3f1543)[_0x3d1d('0x28')](function(_0x36331f){return _0x36331f;});}return null;};}function removeEntity(_0x550bb5,_0x228735){return function(_0x3dae29){if(_0x3dae29){return _0x3dae29[_0x3d1d('0x29')]()[_0x3d1d('0x28')](function(){var _0x12f5ab=_0x3dae29['get']({'plain':!![]});var _0xb56ae1=_0x3d1d('0x2a');return db[_0x3d1d('0x2b')][_0x3d1d('0x29')]({'where':{'type':_0xb56ae1,'resourceId':_0x12f5ab['id']}})[_0x3d1d('0x28')](function(){return _0x3dae29;});})[_0x3d1d('0x28')](function(){_0x550bb5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4efc5c,_0x2feb04){return function(_0x2a983f){if(!_0x2a983f){_0x4efc5c[_0x3d1d('0x1b')](0x194);}return _0x2a983f;};}function handleError(_0xf7687d,_0x54d7d5){_0x54d7d5=_0x54d7d5||0x1f4;return function(_0x4a4623){logger[_0x3d1d('0x2c')](_0x4a4623['stack']);if(_0x4a4623[_0x3d1d('0x2d')]){delete _0x4a4623[_0x3d1d('0x2d')];}_0xf7687d[_0x3d1d('0x1c')](_0x54d7d5)[_0x3d1d('0x2e')](_0x4a4623);};}exports[_0x3d1d('0x2f')]=function(_0x151ded,_0x1d2bb5){var _0x635ca5={},_0x33bbed={},_0x58b541={'count':0x0,'rows':[]};var _0x1de5cf=_[_0x3d1d('0x30')](db[_0x3d1d('0x31')][_0x3d1d('0x32')],function(_0x262e6e){return{'name':_0x262e6e[_0x3d1d('0x33')],'type':_0x262e6e[_0x3d1d('0x34')][_0x3d1d('0x35')]};});_0x33bbed['model']=_[_0x3d1d('0x30')](_0x1de5cf,_0x3d1d('0x2d'));_0x33bbed[_0x3d1d('0x36')]=_[_0x3d1d('0x37')](_0x151ded[_0x3d1d('0x36')]);_0x33bbed[_0x3d1d('0x38')]=_[_0x3d1d('0x39')](_0x33bbed[_0x3d1d('0x3a')],_0x33bbed[_0x3d1d('0x36')]);_0x635ca5[_0x3d1d('0x3b')]=_['intersection'](_0x33bbed[_0x3d1d('0x3a')],qs[_0x3d1d('0x3c')](_0x151ded[_0x3d1d('0x36')][_0x3d1d('0x3c')]));_0x635ca5[_0x3d1d('0x3b')]=_0x635ca5[_0x3d1d('0x3b')][_0x3d1d('0x3d')]?_0x635ca5[_0x3d1d('0x3b')]:_0x33bbed[_0x3d1d('0x3a')];if(!_0x151ded[_0x3d1d('0x36')][_0x3d1d('0x3e')](_0x3d1d('0x3f'))){_0x635ca5['limit']=qs[_0x3d1d('0x20')](_0x151ded[_0x3d1d('0x36')][_0x3d1d('0x20')]);_0x635ca5['offset']=qs[_0x3d1d('0x21')](_0x151ded[_0x3d1d('0x36')][_0x3d1d('0x21')]);}_0x635ca5['order']=qs['sort'](_0x151ded[_0x3d1d('0x36')]['sort']);_0x635ca5['where']=qs[_0x3d1d('0x38')](_[_0x3d1d('0x40')](_0x151ded[_0x3d1d('0x36')],_0x33bbed[_0x3d1d('0x38')]),_0x1de5cf);if(_0x151ded['query'][_0x3d1d('0x41')]){_0x635ca5[_0x3d1d('0x42')]=_[_0x3d1d('0x43')](_0x635ca5['where'],{'$or':_[_0x3d1d('0x30')](_0x1de5cf,function(_0x16661d){if(_0x16661d[_0x3d1d('0x34')]!==_0x3d1d('0x44')){var _0x1e34bc={};_0x1e34bc[_0x16661d[_0x3d1d('0x2d')]]={'$like':'%'+_0x151ded[_0x3d1d('0x36')]['filter']+'%'};return _0x1e34bc;}})});}_0x635ca5=_[_0x3d1d('0x43')]({},_0x635ca5,_0x151ded[_0x3d1d('0x45')]);var _0x1aa04b={'where':_0x635ca5[_0x3d1d('0x42')]};return db[_0x3d1d('0x31')][_0x3d1d('0x22')](_0x1aa04b)[_0x3d1d('0x28')](function(_0x102b18){_0x58b541[_0x3d1d('0x22')]=_0x102b18;if(_0x151ded[_0x3d1d('0x36')][_0x3d1d('0x46')]){_0x635ca5[_0x3d1d('0x47')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x635ca5);})[_0x3d1d('0x28')](function(_0x493175){_0x58b541[_0x3d1d('0x48')]=_0x493175;return _0x58b541;})['then'](respondWithFilteredResult(_0x1d2bb5,_0x635ca5))['catch'](handleError(_0x1d2bb5,null));};exports[_0x3d1d('0x49')]=function(_0x12a8e3,_0x60066e){var _0x13b618={'raw':![],'where':{'id':_0x12a8e3[_0x3d1d('0x4a')]['id']}},_0x44e43e={};_0x44e43e[_0x3d1d('0x3a')]=_[_0x3d1d('0x37')](db[_0x3d1d('0x31')][_0x3d1d('0x32')]);_0x44e43e[_0x3d1d('0x36')]=_[_0x3d1d('0x37')](_0x12a8e3[_0x3d1d('0x36')]);_0x44e43e['filters']=_[_0x3d1d('0x39')](_0x44e43e[_0x3d1d('0x3a')],_0x44e43e[_0x3d1d('0x36')]);_0x13b618[_0x3d1d('0x3b')]=_[_0x3d1d('0x39')](_0x44e43e[_0x3d1d('0x3a')],qs[_0x3d1d('0x3c')](_0x12a8e3['query']['fields']));_0x13b618['attributes']=_0x13b618[_0x3d1d('0x3b')][_0x3d1d('0x3d')]?_0x13b618[_0x3d1d('0x3b')]:_0x44e43e['model'];if(_0x12a8e3[_0x3d1d('0x36')][_0x3d1d('0x46')]){_0x13b618[_0x3d1d('0x47')]=[{'all':!![]}];}_0x13b618=_[_0x3d1d('0x43')]({},_0x13b618,_0x12a8e3[_0x3d1d('0x45')]);return db[_0x3d1d('0x31')][_0x3d1d('0x4b')](_0x13b618)[_0x3d1d('0x28')](handleEntityNotFound(_0x60066e,null))[_0x3d1d('0x28')](respondWithResult(_0x60066e,null))[_0x3d1d('0x4c')](handleError(_0x60066e,null));};exports[_0x3d1d('0x4d')]=function(_0x1b3c71,_0x2330fe){return db['JscriptyProject']['create'](_0x1b3c71[_0x3d1d('0x4e')],{})[_0x3d1d('0x28')](function(_0x5579ad){var _0x1a4ff0=_0x1b3c71[_0x3d1d('0x4f')][_0x3d1d('0x50')]({'plain':!![]});if(!_0x1a4ff0)throw new Error(_0x3d1d('0x51'));if(_0x1a4ff0[_0x3d1d('0x52')]===_0x3d1d('0x4f')){var _0x110738=_0x5579ad[_0x3d1d('0x50')]({'plain':!![]});var _0x1d7d9f=_0x3d1d('0x2a');return db['UserProfileSection'][_0x3d1d('0x4b')]({'where':{'name':_0x1d7d9f,'userProfileId':_0x1a4ff0[_0x3d1d('0x53')]},'raw':!![]})['then'](function(_0x3a2a6c){if(_0x3a2a6c&&_0x3a2a6c[_0x3d1d('0x54')]===0x0){return db[_0x3d1d('0x2b')]['create']({'name':_0x110738[_0x3d1d('0x2d')],'resourceId':_0x110738['id'],'type':_0x3a2a6c['name'],'sectionId':_0x3a2a6c['id']},{})['then'](function(){return _0x5579ad;});}else{return _0x5579ad;}})['catch'](function(_0x250e43){logger[_0x3d1d('0x2c')](_0x3d1d('0x55'),_0x250e43);throw _0x250e43;});}return _0x5579ad;})[_0x3d1d('0x28')](respondWithResult(_0x2330fe,0xc9))[_0x3d1d('0x4c')](handleError(_0x2330fe,null));};exports['clone']=function(_0x63702f,_0x3a1ba9){var _0x493aa7={'where':{'id':_0x63702f[_0x3d1d('0x4a')]['id']}},_0x4b8170={};_0x4b8170[_0x3d1d('0x3a')]=_[_0x3d1d('0x37')](db['JscriptyProject'][_0x3d1d('0x32')]);_0x493aa7[_0x3d1d('0x3b')]=_['intersection'](_0x4b8170[_0x3d1d('0x3a')],qs[_0x3d1d('0x3c')](_0x63702f[_0x3d1d('0x36')]['fields']));_0x493aa7[_0x3d1d('0x3b')]=_0x493aa7[_0x3d1d('0x3b')][_0x3d1d('0x3d')]?_0x493aa7['attributes']:_0x4b8170[_0x3d1d('0x3a')];if(_0x63702f['query']['includeAll']){_0x493aa7[_0x3d1d('0x47')]=[{'all':!![]}];}_0x493aa7=_[_0x3d1d('0x43')]({},_0x493aa7,_0x63702f['options']);return db[_0x3d1d('0x31')]['find'](_0x493aa7)[_0x3d1d('0x28')](handleEntityNotFound(_0x3a1ba9,null))['then'](function(_0x1a15aa){if(_0x1a15aa){var _0x4a222d=_0x1a15aa[_0x3d1d('0x50')]({'plain':!![]});_0x4a222d=qs['omit'](_0x4a222d,['id',_0x3d1d('0x56'),_0x3d1d('0x57')]);_0x63702f[_0x3d1d('0x4e')]=_[_0x3d1d('0x58')](_0x63702f[_0x3d1d('0x4e')],['id',_0x3d1d('0x56'),'updatedAt']);return db[_0x3d1d('0x31')][_0x3d1d('0x4d')](_[_0x3d1d('0x43')](_0x4a222d,_0x63702f[_0x3d1d('0x4e')]),{'include':_0x63702f['query'][_0x3d1d('0x46')]?[{'all':!![]}]:undefined})[_0x3d1d('0x28')](function(_0x274a6b){var _0x1ace4a=_0x63702f[_0x3d1d('0x4f')][_0x3d1d('0x50')]({'plain':!![]});if(!_0x1ace4a)throw new Error(_0x3d1d('0x51'));if(_0x1ace4a[_0x3d1d('0x52')]===_0x3d1d('0x4f')){var _0x474d6f=_0x274a6b[_0x3d1d('0x50')]({'plain':!![]});var _0x26c51e=_0x3d1d('0x2a');return db['UserProfileSection'][_0x3d1d('0x4b')]({'where':{'name':_0x26c51e,'userProfileId':_0x1ace4a[_0x3d1d('0x53')]},'raw':!![]})['then'](function(_0x344700){if(_0x344700&&_0x344700[_0x3d1d('0x54')]===0x0){return db[_0x3d1d('0x2b')][_0x3d1d('0x4d')]({'name':_0x474d6f[_0x3d1d('0x2d')],'resourceId':_0x474d6f['id'],'type':_0x344700['name'],'sectionId':_0x344700['id']},{})[_0x3d1d('0x28')](function(){return _0x274a6b;});}else{return _0x274a6b;}})['catch'](function(_0x334d6b){logger[_0x3d1d('0x2c')](_0x3d1d('0x55'),_0x334d6b);throw _0x334d6b;});}return _0x274a6b;});}})[_0x3d1d('0x28')](respondWithResult(_0x3a1ba9,0xc9))['catch'](handleError(_0x3a1ba9,null));};exports['update']=function(_0x5222cb,_0x3097ac){if(_0x5222cb['body']['id']){delete _0x5222cb[_0x3d1d('0x4e')]['id'];}return db['JscriptyProject'][_0x3d1d('0x4b')]({'where':{'id':_0x5222cb[_0x3d1d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3097ac,null))[_0x3d1d('0x28')](saveUpdates(_0x5222cb[_0x3d1d('0x4e')],null))['then'](respondWithResult(_0x3097ac,null))[_0x3d1d('0x4c')](handleError(_0x3097ac,null));};exports[_0x3d1d('0x29')]=function(_0x1f5b43,_0x4ad96e){return db['JscriptyProject'][_0x3d1d('0x4b')]({'where':{'id':_0x1f5b43[_0x3d1d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ad96e,null))['then'](removeEntity(_0x4ad96e,null))['catch'](handleError(_0x4ad96e,null));};exports['getSessions']=function(_0x119f45,_0x40d393,_0x5d8609){var _0x205c4a={'raw':!![],'where':{}};var _0x1ae110={};var _0x1c46ad={'count':0x0,'rows':[]};return db[_0x3d1d('0x31')][_0x3d1d('0x59')]({'where':{'id':_0x119f45[_0x3d1d('0x4a')]['id']}})[_0x3d1d('0x28')](handleEntityNotFound(_0x40d393,null))['then'](function(_0x19fde5){if(_0x19fde5){_0x1ae110[_0x3d1d('0x3a')]=_[_0x3d1d('0x37')](db['JscriptySessionReport']['rawAttributes']);_0x1ae110[_0x3d1d('0x36')]=_[_0x3d1d('0x37')](_0x119f45[_0x3d1d('0x36')]);_0x1ae110[_0x3d1d('0x38')]=_[_0x3d1d('0x39')](_0x1ae110[_0x3d1d('0x3a')],_0x1ae110[_0x3d1d('0x36')]);_0x205c4a['attributes']=_['intersection'](_0x1ae110[_0x3d1d('0x3a')],qs[_0x3d1d('0x3c')](_0x119f45[_0x3d1d('0x36')]['fields']));_0x205c4a[_0x3d1d('0x3b')]=_0x205c4a['attributes']['length']?_0x205c4a[_0x3d1d('0x3b')]:_0x1ae110[_0x3d1d('0x3a')];if(!_0x119f45[_0x3d1d('0x36')][_0x3d1d('0x3e')](_0x3d1d('0x3f'))){_0x205c4a['limit']=qs[_0x3d1d('0x20')](_0x119f45[_0x3d1d('0x36')]['limit']);_0x205c4a[_0x3d1d('0x21')]=qs['offset'](_0x119f45['query']['offset']);}_0x205c4a['order']=qs[_0x3d1d('0x5a')](_0x119f45[_0x3d1d('0x36')][_0x3d1d('0x5a')]);_0x205c4a[_0x3d1d('0x42')]=qs[_0x3d1d('0x38')](_[_0x3d1d('0x40')](_0x119f45[_0x3d1d('0x36')],_0x1ae110[_0x3d1d('0x38')]));_0x205c4a[_0x3d1d('0x42')][_0x3d1d('0x5b')]=_0x19fde5['id'];if(_0x119f45['query'][_0x3d1d('0x41')]){_0x205c4a['where']=_[_0x3d1d('0x43')](_0x205c4a['where'],{'$or':_[_0x3d1d('0x30')](_0x205c4a[_0x3d1d('0x3b')],function(_0x16d5c3){var _0x146a46={};_0x146a46[_0x16d5c3]={'$like':'%'+_0x119f45['query'][_0x3d1d('0x41')]+'%'};return _0x146a46;})});}_0x205c4a=_[_0x3d1d('0x43')]({},_0x205c4a,_0x119f45['options']);return db[_0x3d1d('0x5c')][_0x3d1d('0x22')]({'where':_0x205c4a[_0x3d1d('0x42')]})['then'](function(_0x859b55){_0x1c46ad[_0x3d1d('0x22')]=_0x859b55;if(_0x119f45[_0x3d1d('0x36')]['includeAll']){_0x205c4a[_0x3d1d('0x47')]=[{'all':!![]}];}return db[_0x3d1d('0x5c')][_0x3d1d('0x5d')](_0x205c4a);})[_0x3d1d('0x28')](function(_0x5cd169){_0x1c46ad[_0x3d1d('0x48')]=_0x5cd169;return _0x1c46ad;});}})[_0x3d1d('0x28')](respondWithFilteredResult(_0x40d393,_0x205c4a))[_0x3d1d('0x4c')](handleError(_0x40d393,null));};exports['getAnswers']=function(_0x4fc823,_0x206967,_0x516146){var _0x50479e={'raw':!![],'where':{}};var _0x315788={};var _0x2cf63d={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x3d1d('0x59')]({'where':{'id':_0x4fc823[_0x3d1d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x206967,null))[_0x3d1d('0x28')](function(_0x1b901f){if(_0x1b901f){_0x315788[_0x3d1d('0x3a')]=_[_0x3d1d('0x37')](db['JscriptyAnswerReport']['rawAttributes']);_0x315788['query']=_[_0x3d1d('0x37')](_0x4fc823[_0x3d1d('0x36')]);_0x315788[_0x3d1d('0x38')]=_[_0x3d1d('0x39')](_0x315788[_0x3d1d('0x3a')],_0x315788['query']);_0x50479e['attributes']=_['intersection'](_0x315788[_0x3d1d('0x3a')],qs[_0x3d1d('0x3c')](_0x4fc823[_0x3d1d('0x36')][_0x3d1d('0x3c')]));_0x50479e[_0x3d1d('0x3b')]=_0x50479e[_0x3d1d('0x3b')]['length']?_0x50479e[_0x3d1d('0x3b')]:_0x315788['model'];if(!_0x4fc823[_0x3d1d('0x36')][_0x3d1d('0x3e')]('nolimit')){_0x50479e[_0x3d1d('0x20')]=qs['limit'](_0x4fc823[_0x3d1d('0x36')]['limit']);_0x50479e[_0x3d1d('0x21')]=qs[_0x3d1d('0x21')](_0x4fc823[_0x3d1d('0x36')]['offset']);}_0x50479e[_0x3d1d('0x5e')]=qs[_0x3d1d('0x5a')](_0x4fc823[_0x3d1d('0x36')][_0x3d1d('0x5a')]);_0x50479e[_0x3d1d('0x42')]=qs[_0x3d1d('0x38')](_[_0x3d1d('0x40')](_0x4fc823[_0x3d1d('0x36')],_0x315788['filters']));_0x50479e[_0x3d1d('0x42')][_0x3d1d('0x5b')]=_0x1b901f['id'];if(_0x4fc823[_0x3d1d('0x36')]['filter']){_0x50479e[_0x3d1d('0x42')]=_['merge'](_0x50479e[_0x3d1d('0x42')],{'$or':_[_0x3d1d('0x30')](_0x50479e[_0x3d1d('0x3b')],function(_0x19bdb8){var _0x5379fb={};_0x5379fb[_0x19bdb8]={'$like':'%'+_0x4fc823[_0x3d1d('0x36')][_0x3d1d('0x41')]+'%'};return _0x5379fb;})});}_0x50479e=_['merge']({},_0x50479e,_0x4fc823[_0x3d1d('0x45')]);return db['JscriptyAnswerReport'][_0x3d1d('0x22')]({'where':_0x50479e['where']})['then'](function(_0x1a26f2){_0x2cf63d['count']=_0x1a26f2;if(_0x4fc823[_0x3d1d('0x36')][_0x3d1d('0x46')]){_0x50479e[_0x3d1d('0x47')]=[{'all':!![]}];}return db[_0x3d1d('0x5f')][_0x3d1d('0x5d')](_0x50479e);})[_0x3d1d('0x28')](function(_0x22de2f){_0x2cf63d[_0x3d1d('0x48')]=_0x22de2f;return _0x2cf63d;});}})[_0x3d1d('0x28')](respondWithFilteredResult(_0x206967,_0x50479e))['catch'](handleError(_0x206967,null));};function char(_0x338302){return'number'===typeof _0x338302?String[_0x3d1d('0x60')][_0x3d1d('0x24')](null,arguments):_0x338302;}function needsEncapsulation(_0x460382){return!!_0x460382&&(_0x460382[_0x3d1d('0x61')]()['indexOf'](char(0xd))>=0x0||_0x460382[_0x3d1d('0x61')]()[_0x3d1d('0x62')](char(0xa))>=0x0||_0x460382[_0x3d1d('0x61')]()[_0x3d1d('0x62')](char(0x2c))>=0x0||_0x460382[_0x3d1d('0x61')]()[_0x3d1d('0x62')](char(0x22))>=0x0);}function encapsulate(_0x2e77d0){var _0x46511c=char(0x22),_0x329e78='\x5c'+char(0x22),_0x164831=_0x2e77d0['toString']()[_0x3d1d('0x63')](new RegExp(_0x46511c,'g'),_0x329e78);return _0x46511c+_0x164831+_0x46511c;}exports[_0x3d1d('0x64')]=function(_0x1c2ae9,_0x38ecd9,_0xafe17a){var _0x3e3427,_0x2483ea;var _0x3928af={'where':{'ProjectId':_0x1c2ae9['params']['id']}};if(_0x1c2ae9[_0x3d1d('0x36')][_0x3d1d('0x65')]){_0x3928af[_0x3d1d('0x42')][_0x3d1d('0x66')]=JSON[_0x3d1d('0x67')](_0x1c2ae9[_0x3d1d('0x36')]['startTime']);}return db[_0x3d1d('0x5c')][_0x3d1d('0x5d')](_0x3928af)[_0x3d1d('0x28')](handleEntityNotFound(_0x38ecd9,null))['then'](function(_0x40622a){if(_0x40622a){_0x3e3427=_0x40622a;return db['JscriptyQuestionReport'][_0x3d1d('0x5d')]({'where':{'SessionId':{'$in':_[_0x3d1d('0x30')](_0x3e3427,'id')},'ProjectId':_0x1c2ae9[_0x3d1d('0x4a')]['id']},'order':_0x3d1d('0x68')});}})[_0x3d1d('0x28')](handleEntityNotFound(_0x38ecd9,null))[_0x3d1d('0x28')](function(_0x52091d){if(_0x52091d){_0x2483ea=_0x52091d;var _0xd96f98={};for(var _0x8dc454=0x0,_0x5ad7cd=_0x2483ea['length'];_0x8dc454<_0x5ad7cd;_0x8dc454++){if(!_0xd96f98[_0x3d1d('0x3e')](_0x2483ea[_0x8dc454][_0x3d1d('0x69')])){_0xd96f98[_0x2483ea[_0x8dc454][_0x3d1d('0x69')]]=needsEncapsulation(_0x2483ea[_0x8dc454][_0x3d1d('0x6a')])?encapsulate(_0x2483ea[_0x8dc454][_0x3d1d('0x6a')]):_0x2483ea[_0x8dc454][_0x3d1d('0x6a')];}}var _0x274983=[],_0x4a1cd7={};for(var _0x5b1e9e=0x0,_0x52b32f=_0x3e3427['length'];_0x5b1e9e<_0x52b32f;_0x5b1e9e++){_0x4a1cd7={'ProjectId':_0x1c2ae9[_0x3d1d('0x4a')]['id'],'SessionId':_0x3e3427[_0x5b1e9e]['id'],'StartTime':moment(_0x3e3427[_0x5b1e9e]['starttime'])[_0x3d1d('0x6b')](_0x3d1d('0x6c'))};for(var _0x1a9925=0x0,_0x34cc7a=_0x2483ea['length'];_0x1a9925<_0x34cc7a;_0x1a9925++){if(_0x2483ea[_0x1a9925][_0x3d1d('0x6d')]==_0x3e3427[_0x5b1e9e]['id']&&_0xd96f98['hasOwnProperty'](_0x2483ea[_0x1a9925][_0x3d1d('0x69')])){_0x4a1cd7[_0xd96f98[_0x2483ea[_0x1a9925][_0x3d1d('0x69')]]]=_0x2483ea[_0x1a9925][_0x3d1d('0x6e')];}}for(var _0xf18151 in _0xd96f98){if(!_0x4a1cd7['hasOwnProperty'](_0xd96f98[_0xf18151])){_0x4a1cd7[_0xd96f98[_0xf18151]]=null;}}_0x274983['push'](_0x4a1cd7);}return _0x274983;}})[_0x3d1d('0x28')](function(_0x1a0c8e){if(!_[_0x3d1d('0x6f')](_0x1a0c8e)){var _0x40dcd7=toCsv(_0x1a0c8e);var _0x3cbed5=Date[_0x3d1d('0x70')]();fs[_0x3d1d('0x71')](util[_0x3d1d('0x6b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1c2ae9['params']['id'],_0x3cbed5),_0x40dcd7);_0x38ecd9[_0x3d1d('0x72')](_0x3d1d('0x73'),_0x3d1d('0x74')+util['format'](_0x3d1d('0x75'),_0x1c2ae9['params']['id'],_0x3cbed5));_0x38ecd9[_0x3d1d('0x72')](_0x3d1d('0x76'),_0x3d1d('0x77'));return _0x38ecd9[_0x3d1d('0x78')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1c2ae9[_0x3d1d('0x4a')]['id'],_0x3cbed5));}else{return _0x38ecd9[_0x3d1d('0x1b')](0xcc);}})[_0x3d1d('0x4c')](handleError(_0x38ecd9,null));}; \ No newline at end of file +var _0x9c02=['includeAll','rows','catch','show','find','create','body','user','get','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','include','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','update','getSessions','findOne','nolimit','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','findAll','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','rimraf','zip-dir','mustache','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','Projects','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x56b04e,_0x471ebc){var _0x4149b9=function(_0x591220){while(--_0x591220){_0x56b04e['push'](_0x56b04e['shift']());}};_0x4149b9(++_0x471ebc);}(_0x9c02,0x196));var _0x29c0=function(_0x4d097c,_0x3211f7){_0x4d097c=_0x4d097c-0x0;var _0x8f14db=_0x9c02[_0x4d097c];return _0x8f14db;};'use strict';var emlformat=require(_0x29c0('0x0'));var rimraf=require(_0x29c0('0x1'));var zipdir=require(_0x29c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x29c0('0x3'));var util=require('util');var path=require(_0x29c0('0x4'));var sox=require('sox');var csv=require(_0x29c0('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29c0('0x6'));var _=require(_0x29c0('0x7'));var squel=require(_0x29c0('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x29c0('0x9'));var toCsv=require(_0x29c0('0x5'));var querystring=require(_0x29c0('0xa'));var Papa=require(_0x29c0('0xb'));var Redis=require(_0x29c0('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x29c0('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x29c0('0xe'))(_0x29c0('0xf'));var utils=require(_0x29c0('0x10'));var config=require(_0x29c0('0x11'));var licenseUtil=require(_0x29c0('0x12'));var db=require(_0x29c0('0x13'))['db'];function respondWithStatusCode(_0x5b4ef2,_0x7a6a5e){_0x7a6a5e=_0x7a6a5e||0xcc;return function(_0x350922){if(_0x350922){return _0x5b4ef2[_0x29c0('0x14')](_0x7a6a5e);}return _0x5b4ef2[_0x29c0('0x15')](_0x7a6a5e)[_0x29c0('0x16')]();};}function respondWithResult(_0x28cc02,_0x1e622a){_0x1e622a=_0x1e622a||0xc8;return function(_0x2947da){if(_0x2947da){return _0x28cc02[_0x29c0('0x15')](_0x1e622a)[_0x29c0('0x17')](_0x2947da);}};}function respondWithFilteredResult(_0x4721f0,_0xccb222){return function(_0x235725){if(_0x235725){var _0x1ce122=typeof _0xccb222[_0x29c0('0x18')]===_0x29c0('0x19')&&typeof _0xccb222[_0x29c0('0x1a')]===_0x29c0('0x19');var _0x4309fc=_0x235725[_0x29c0('0x1b')];var _0x627c4c=_0x1ce122?0x0:_0xccb222[_0x29c0('0x18')];var _0x2bfa71=_0x1ce122?_0x235725[_0x29c0('0x1b')]:_0xccb222[_0x29c0('0x18')]+_0xccb222[_0x29c0('0x1a')];var _0x311c9b;if(_0x2bfa71>=_0x4309fc){_0x2bfa71=_0x4309fc;_0x311c9b=0xc8;}else{_0x311c9b=0xce;}_0x4721f0['status'](_0x311c9b);return _0x4721f0[_0x29c0('0x1c')](_0x29c0('0x1d'),_0x627c4c+'-'+_0x2bfa71+'/'+_0x4309fc)[_0x29c0('0x17')](_0x235725);}return null;};}function patchUpdates(_0x3c3eb2){return function(_0x38eab0){try{jsonpatch[_0x29c0('0x1e')](_0x38eab0,_0x3c3eb2,!![]);}catch(_0x54f8f1){return BPromise[_0x29c0('0x1f')](_0x54f8f1);}return _0x38eab0[_0x29c0('0x20')]();};}function saveUpdates(_0x45a6cb,_0x26bf2e){return function(_0x1f962f){if(_0x1f962f){return _0x1f962f['update'](_0x45a6cb)[_0x29c0('0x21')](function(_0x42b082){return _0x42b082;});}return null;};}function removeEntity(_0x5846d0,_0x1114a8){return function(_0x402c54){if(_0x402c54){return _0x402c54[_0x29c0('0x22')]()['then'](function(){var _0x1993a5=_0x402c54['get']({'plain':!![]});var _0x161b39=_0x29c0('0x23');return db['UserProfileResource'][_0x29c0('0x22')]({'where':{'type':_0x161b39,'resourceId':_0x1993a5['id']}})[_0x29c0('0x21')](function(){return _0x402c54;});})[_0x29c0('0x21')](function(){_0x5846d0[_0x29c0('0x15')](0xcc)[_0x29c0('0x16')]();});}};}function handleEntityNotFound(_0x46be76,_0x4d11b3){return function(_0x531c2c){if(!_0x531c2c){_0x46be76['sendStatus'](0x194);}return _0x531c2c;};}function handleError(_0x3a684c,_0x9803d5){_0x9803d5=_0x9803d5||0x1f4;return function(_0x4cdf7c){logger['error'](_0x4cdf7c[_0x29c0('0x24')]);if(_0x4cdf7c[_0x29c0('0x25')]){delete _0x4cdf7c['name'];}_0x3a684c['status'](_0x9803d5)['send'](_0x4cdf7c);};}exports[_0x29c0('0x26')]=function(_0x193e55,_0x322c86){var _0x4edead={},_0x19dd04={},_0x291748={'count':0x0,'rows':[]};var _0x598bc4=_[_0x29c0('0x27')](db[_0x29c0('0x28')][_0x29c0('0x29')],function(_0x188910){return{'name':_0x188910[_0x29c0('0x2a')],'type':_0x188910[_0x29c0('0x2b')][_0x29c0('0x2c')]};});_0x19dd04['model']=_['map'](_0x598bc4,_0x29c0('0x25'));_0x19dd04[_0x29c0('0x2d')]=_[_0x29c0('0x2e')](_0x193e55['query']);_0x19dd04[_0x29c0('0x2f')]=_[_0x29c0('0x30')](_0x19dd04['model'],_0x19dd04['query']);_0x4edead[_0x29c0('0x31')]=_[_0x29c0('0x30')](_0x19dd04[_0x29c0('0x32')],qs[_0x29c0('0x33')](_0x193e55[_0x29c0('0x2d')][_0x29c0('0x33')]));_0x4edead[_0x29c0('0x31')]=_0x4edead['attributes'][_0x29c0('0x34')]?_0x4edead['attributes']:_0x19dd04[_0x29c0('0x32')];if(!_0x193e55[_0x29c0('0x2d')][_0x29c0('0x35')]('nolimit')){_0x4edead[_0x29c0('0x1a')]=qs[_0x29c0('0x1a')](_0x193e55['query'][_0x29c0('0x1a')]);_0x4edead[_0x29c0('0x18')]=qs[_0x29c0('0x18')](_0x193e55[_0x29c0('0x2d')][_0x29c0('0x18')]);}_0x4edead[_0x29c0('0x36')]=qs[_0x29c0('0x37')](_0x193e55[_0x29c0('0x2d')][_0x29c0('0x37')]);_0x4edead[_0x29c0('0x38')]=qs[_0x29c0('0x2f')](_[_0x29c0('0x39')](_0x193e55[_0x29c0('0x2d')],_0x19dd04[_0x29c0('0x2f')]),_0x598bc4);if(_0x193e55[_0x29c0('0x2d')][_0x29c0('0x3a')]){_0x4edead[_0x29c0('0x38')]=_[_0x29c0('0x3b')](_0x4edead[_0x29c0('0x38')],{'$or':_[_0x29c0('0x27')](_0x598bc4,function(_0x12df6a){if(_0x12df6a[_0x29c0('0x2b')]!==_0x29c0('0x3c')){var _0x5d42f6={};_0x5d42f6[_0x12df6a[_0x29c0('0x25')]]={'$like':'%'+_0x193e55[_0x29c0('0x2d')][_0x29c0('0x3a')]+'%'};return _0x5d42f6;}})});}_0x4edead=_[_0x29c0('0x3b')]({},_0x4edead,_0x193e55[_0x29c0('0x3d')]);var _0x4f1900={'where':_0x4edead[_0x29c0('0x38')]};return db[_0x29c0('0x28')][_0x29c0('0x1b')](_0x4f1900)['then'](function(_0x42d7b9){_0x291748[_0x29c0('0x1b')]=_0x42d7b9;if(_0x193e55['query'][_0x29c0('0x3e')]){_0x4edead['include']=[{'all':!![]}];}return db[_0x29c0('0x28')]['findAll'](_0x4edead);})[_0x29c0('0x21')](function(_0x406a23){_0x291748[_0x29c0('0x3f')]=_0x406a23;return _0x291748;})[_0x29c0('0x21')](respondWithFilteredResult(_0x322c86,_0x4edead))[_0x29c0('0x40')](handleError(_0x322c86,null));};exports[_0x29c0('0x41')]=function(_0x4b1d0d,_0x4a277b){var _0x2dfcb7={'raw':![],'where':{'id':_0x4b1d0d['params']['id']}},_0x44bb0d={};_0x44bb0d[_0x29c0('0x32')]=_[_0x29c0('0x2e')](db[_0x29c0('0x28')][_0x29c0('0x29')]);_0x44bb0d[_0x29c0('0x2d')]=_[_0x29c0('0x2e')](_0x4b1d0d[_0x29c0('0x2d')]);_0x44bb0d[_0x29c0('0x2f')]=_[_0x29c0('0x30')](_0x44bb0d[_0x29c0('0x32')],_0x44bb0d[_0x29c0('0x2d')]);_0x2dfcb7[_0x29c0('0x31')]=_[_0x29c0('0x30')](_0x44bb0d[_0x29c0('0x32')],qs[_0x29c0('0x33')](_0x4b1d0d[_0x29c0('0x2d')]['fields']));_0x2dfcb7[_0x29c0('0x31')]=_0x2dfcb7[_0x29c0('0x31')]['length']?_0x2dfcb7[_0x29c0('0x31')]:_0x44bb0d[_0x29c0('0x32')];if(_0x4b1d0d['query'][_0x29c0('0x3e')]){_0x2dfcb7['include']=[{'all':!![]}];}_0x2dfcb7=_[_0x29c0('0x3b')]({},_0x2dfcb7,_0x4b1d0d['options']);return db[_0x29c0('0x28')][_0x29c0('0x42')](_0x2dfcb7)[_0x29c0('0x21')](handleEntityNotFound(_0x4a277b,null))['then'](respondWithResult(_0x4a277b,null))[_0x29c0('0x40')](handleError(_0x4a277b,null));};exports['create']=function(_0x3e1386,_0x4bc495){return db[_0x29c0('0x28')][_0x29c0('0x43')](_0x3e1386[_0x29c0('0x44')],{})[_0x29c0('0x21')](function(_0x55b2b3){var _0x53edae=_0x3e1386[_0x29c0('0x45')][_0x29c0('0x46')]({'plain':!![]});if(!_0x53edae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53edae[_0x29c0('0x47')]===_0x29c0('0x45')){var _0x32e3ca=_0x55b2b3[_0x29c0('0x46')]({'plain':!![]});var _0x1d2578=_0x29c0('0x23');return db['UserProfileSection'][_0x29c0('0x42')]({'where':{'name':_0x1d2578,'userProfileId':_0x53edae[_0x29c0('0x48')]},'raw':!![]})['then'](function(_0x473072){if(_0x473072&&_0x473072[_0x29c0('0x49')]===0x0){return db['UserProfileResource'][_0x29c0('0x43')]({'name':_0x32e3ca['name'],'resourceId':_0x32e3ca['id'],'type':_0x473072['name'],'sectionId':_0x473072['id']},{})[_0x29c0('0x21')](function(){return _0x55b2b3;});}else{return _0x55b2b3;}})['catch'](function(_0x271709){logger[_0x29c0('0x4a')](_0x29c0('0x4b'),_0x271709);throw _0x271709;});}return _0x55b2b3;})[_0x29c0('0x21')](respondWithResult(_0x4bc495,0xc9))[_0x29c0('0x40')](handleError(_0x4bc495,null));};exports['clone']=function(_0x4f3d30,_0x2e3f93){var _0x4bfdb6={'where':{'id':_0x4f3d30[_0x29c0('0x4c')]['id']}},_0x36afb={};_0x36afb['model']=_[_0x29c0('0x2e')](db['JscriptyProject'][_0x29c0('0x29')]);_0x4bfdb6['attributes']=_[_0x29c0('0x30')](_0x36afb[_0x29c0('0x32')],qs['fields'](_0x4f3d30['query']['fields']));_0x4bfdb6[_0x29c0('0x31')]=_0x4bfdb6[_0x29c0('0x31')]['length']?_0x4bfdb6['attributes']:_0x36afb[_0x29c0('0x32')];if(_0x4f3d30[_0x29c0('0x2d')][_0x29c0('0x3e')]){_0x4bfdb6[_0x29c0('0x4d')]=[{'all':!![]}];}_0x4bfdb6=_[_0x29c0('0x3b')]({},_0x4bfdb6,_0x4f3d30['options']);return db[_0x29c0('0x28')]['find'](_0x4bfdb6)[_0x29c0('0x21')](handleEntityNotFound(_0x2e3f93,null))[_0x29c0('0x21')](function(_0x203641){if(_0x203641){var _0x8bd093=_0x203641[_0x29c0('0x46')]({'plain':!![]});_0x8bd093=qs[_0x29c0('0x4e')](_0x8bd093,['id',_0x29c0('0x4f'),_0x29c0('0x50')]);_0x4f3d30[_0x29c0('0x44')]=_['omit'](_0x4f3d30['body'],['id',_0x29c0('0x4f'),_0x29c0('0x50')]);return db[_0x29c0('0x28')][_0x29c0('0x43')](_['merge'](_0x8bd093,_0x4f3d30['body']),{'include':_0x4f3d30[_0x29c0('0x2d')][_0x29c0('0x3e')]?[{'all':!![]}]:undefined})[_0x29c0('0x21')](function(_0x5a393d){var _0x4fc1bc=_0x4f3d30[_0x29c0('0x45')]['get']({'plain':!![]});if(!_0x4fc1bc)throw new Error(_0x29c0('0x51'));if(_0x4fc1bc[_0x29c0('0x47')]===_0x29c0('0x45')){var _0x2afda9=_0x5a393d[_0x29c0('0x46')]({'plain':!![]});var _0x1fecd8=_0x29c0('0x23');return db[_0x29c0('0x52')]['find']({'where':{'name':_0x1fecd8,'userProfileId':_0x4fc1bc[_0x29c0('0x48')]},'raw':!![]})['then'](function(_0x18f619){if(_0x18f619&&_0x18f619[_0x29c0('0x49')]===0x0){return db[_0x29c0('0x53')][_0x29c0('0x43')]({'name':_0x2afda9[_0x29c0('0x25')],'resourceId':_0x2afda9['id'],'type':_0x18f619[_0x29c0('0x25')],'sectionId':_0x18f619['id']},{})[_0x29c0('0x21')](function(){return _0x5a393d;});}else{return _0x5a393d;}})[_0x29c0('0x40')](function(_0x1a686f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a686f);throw _0x1a686f;});}return _0x5a393d;});}})[_0x29c0('0x21')](respondWithResult(_0x2e3f93,0xc9))[_0x29c0('0x40')](handleError(_0x2e3f93,null));};exports[_0x29c0('0x54')]=function(_0x28c970,_0x2006fd){if(_0x28c970[_0x29c0('0x44')]['id']){delete _0x28c970['body']['id'];}return db['JscriptyProject'][_0x29c0('0x42')]({'where':{'id':_0x28c970['params']['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x2006fd,null))['then'](saveUpdates(_0x28c970['body'],null))[_0x29c0('0x21')](respondWithResult(_0x2006fd,null))['catch'](handleError(_0x2006fd,null));};exports[_0x29c0('0x22')]=function(_0x4465b9,_0x19ef14){return db[_0x29c0('0x28')][_0x29c0('0x42')]({'where':{'id':_0x4465b9['params']['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x19ef14,null))[_0x29c0('0x21')](removeEntity(_0x19ef14,null))[_0x29c0('0x40')](handleError(_0x19ef14,null));};exports[_0x29c0('0x55')]=function(_0x28fb45,_0x1acd75,_0x146a41){var _0x1001e1={'raw':!![],'where':{}};var _0x1adafe={};var _0x15eabe={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x29c0('0x56')]({'where':{'id':_0x28fb45[_0x29c0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1acd75,null))[_0x29c0('0x21')](function(_0x1ab96a){if(_0x1ab96a){_0x1adafe['model']=_[_0x29c0('0x2e')](db['JscriptySessionReport']['rawAttributes']);_0x1adafe['query']=_[_0x29c0('0x2e')](_0x28fb45[_0x29c0('0x2d')]);_0x1adafe['filters']=_[_0x29c0('0x30')](_0x1adafe['model'],_0x1adafe[_0x29c0('0x2d')]);_0x1001e1[_0x29c0('0x31')]=_[_0x29c0('0x30')](_0x1adafe[_0x29c0('0x32')],qs[_0x29c0('0x33')](_0x28fb45[_0x29c0('0x2d')][_0x29c0('0x33')]));_0x1001e1[_0x29c0('0x31')]=_0x1001e1[_0x29c0('0x31')][_0x29c0('0x34')]?_0x1001e1[_0x29c0('0x31')]:_0x1adafe[_0x29c0('0x32')];if(!_0x28fb45['query'][_0x29c0('0x35')](_0x29c0('0x57'))){_0x1001e1[_0x29c0('0x1a')]=qs[_0x29c0('0x1a')](_0x28fb45[_0x29c0('0x2d')][_0x29c0('0x1a')]);_0x1001e1[_0x29c0('0x18')]=qs['offset'](_0x28fb45[_0x29c0('0x2d')][_0x29c0('0x18')]);}_0x1001e1[_0x29c0('0x36')]=qs[_0x29c0('0x37')](_0x28fb45[_0x29c0('0x2d')][_0x29c0('0x37')]);_0x1001e1['where']=qs[_0x29c0('0x2f')](_[_0x29c0('0x39')](_0x28fb45['query'],_0x1adafe[_0x29c0('0x2f')]));_0x1001e1[_0x29c0('0x38')][_0x29c0('0x58')]=_0x1ab96a['id'];if(_0x28fb45[_0x29c0('0x2d')][_0x29c0('0x3a')]){_0x1001e1[_0x29c0('0x38')]=_[_0x29c0('0x3b')](_0x1001e1[_0x29c0('0x38')],{'$or':_['map'](_0x1001e1['attributes'],function(_0x5d4097){var _0x23d4a6={};_0x23d4a6[_0x5d4097]={'$like':'%'+_0x28fb45['query']['filter']+'%'};return _0x23d4a6;})});}_0x1001e1=_['merge']({},_0x1001e1,_0x28fb45['options']);return db['JscriptySessionReport'][_0x29c0('0x1b')]({'where':_0x1001e1['where']})[_0x29c0('0x21')](function(_0xa45593){_0x15eabe[_0x29c0('0x1b')]=_0xa45593;if(_0x28fb45['query'][_0x29c0('0x3e')]){_0x1001e1['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x1001e1);})[_0x29c0('0x21')](function(_0x43bad4){_0x15eabe[_0x29c0('0x3f')]=_0x43bad4;return _0x15eabe;});}})[_0x29c0('0x21')](respondWithFilteredResult(_0x1acd75,_0x1001e1))[_0x29c0('0x40')](handleError(_0x1acd75,null));};exports[_0x29c0('0x59')]=function(_0x483427,_0x7920d5,_0x237359){var _0x5ce488={'raw':!![],'where':{}};var _0x244a09={};var _0x212940={'count':0x0,'rows':[]};return db[_0x29c0('0x28')][_0x29c0('0x56')]({'where':{'id':_0x483427[_0x29c0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x7920d5,null))[_0x29c0('0x21')](function(_0x1941ba){if(_0x1941ba){_0x244a09[_0x29c0('0x32')]=_[_0x29c0('0x2e')](db['JscriptyAnswerReport'][_0x29c0('0x29')]);_0x244a09[_0x29c0('0x2d')]=_[_0x29c0('0x2e')](_0x483427['query']);_0x244a09['filters']=_[_0x29c0('0x30')](_0x244a09[_0x29c0('0x32')],_0x244a09[_0x29c0('0x2d')]);_0x5ce488[_0x29c0('0x31')]=_[_0x29c0('0x30')](_0x244a09[_0x29c0('0x32')],qs[_0x29c0('0x33')](_0x483427[_0x29c0('0x2d')][_0x29c0('0x33')]));_0x5ce488['attributes']=_0x5ce488['attributes'][_0x29c0('0x34')]?_0x5ce488[_0x29c0('0x31')]:_0x244a09[_0x29c0('0x32')];if(!_0x483427[_0x29c0('0x2d')][_0x29c0('0x35')](_0x29c0('0x57'))){_0x5ce488[_0x29c0('0x1a')]=qs[_0x29c0('0x1a')](_0x483427[_0x29c0('0x2d')][_0x29c0('0x1a')]);_0x5ce488['offset']=qs[_0x29c0('0x18')](_0x483427[_0x29c0('0x2d')][_0x29c0('0x18')]);}_0x5ce488['order']=qs['sort'](_0x483427[_0x29c0('0x2d')][_0x29c0('0x37')]);_0x5ce488['where']=qs['filters'](_[_0x29c0('0x39')](_0x483427[_0x29c0('0x2d')],_0x244a09[_0x29c0('0x2f')]));_0x5ce488[_0x29c0('0x38')][_0x29c0('0x58')]=_0x1941ba['id'];if(_0x483427['query'][_0x29c0('0x3a')]){_0x5ce488['where']=_[_0x29c0('0x3b')](_0x5ce488[_0x29c0('0x38')],{'$or':_['map'](_0x5ce488[_0x29c0('0x31')],function(_0x28e32e){var _0x95cb56={};_0x95cb56[_0x28e32e]={'$like':'%'+_0x483427[_0x29c0('0x2d')]['filter']+'%'};return _0x95cb56;})});}_0x5ce488=_['merge']({},_0x5ce488,_0x483427[_0x29c0('0x3d')]);return db[_0x29c0('0x5a')][_0x29c0('0x1b')]({'where':_0x5ce488[_0x29c0('0x38')]})[_0x29c0('0x21')](function(_0x308170){_0x212940['count']=_0x308170;if(_0x483427['query'][_0x29c0('0x3e')]){_0x5ce488[_0x29c0('0x4d')]=[{'all':!![]}];}return db[_0x29c0('0x5a')]['findAll'](_0x5ce488);})[_0x29c0('0x21')](function(_0x432035){_0x212940[_0x29c0('0x3f')]=_0x432035;return _0x212940;});}})[_0x29c0('0x21')](respondWithFilteredResult(_0x7920d5,_0x5ce488))[_0x29c0('0x40')](handleError(_0x7920d5,null));};function char(_0x1f910c){return _0x29c0('0x5b')===typeof _0x1f910c?String[_0x29c0('0x5c')][_0x29c0('0x1e')](null,arguments):_0x1f910c;}function needsEncapsulation(_0x2350c7){return!!_0x2350c7&&(_0x2350c7[_0x29c0('0x5d')]()[_0x29c0('0x5e')](char(0xd))>=0x0||_0x2350c7[_0x29c0('0x5d')]()[_0x29c0('0x5e')](char(0xa))>=0x0||_0x2350c7[_0x29c0('0x5d')]()[_0x29c0('0x5e')](char(0x2c))>=0x0||_0x2350c7['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x313d00){var _0x61017b=char(0x22),_0x5ee4b0='\x5c'+char(0x22),_0x27bdd6=_0x313d00['toString']()[_0x29c0('0x5f')](new RegExp(_0x61017b,'g'),_0x5ee4b0);return _0x61017b+_0x27bdd6+_0x61017b;}exports[_0x29c0('0x60')]=function(_0x12714a,_0x555502,_0x54c664){var _0x28fefe,_0x4d84c1;var _0x32fb66={'where':{'ProjectId':_0x12714a[_0x29c0('0x4c')]['id']}};if(_0x12714a[_0x29c0('0x2d')][_0x29c0('0x61')]){_0x32fb66[_0x29c0('0x38')][_0x29c0('0x62')]=JSON['parse'](_0x12714a['query']['startTime']);}return db['JscriptySessionReport']['findAll'](_0x32fb66)[_0x29c0('0x21')](handleEntityNotFound(_0x555502,null))[_0x29c0('0x21')](function(_0x1dd9a9){if(_0x1dd9a9){_0x28fefe=_0x1dd9a9;return db[_0x29c0('0x63')][_0x29c0('0x64')]({'where':{'SessionId':{'$in':_[_0x29c0('0x27')](_0x28fefe,'id')},'ProjectId':_0x12714a[_0x29c0('0x4c')]['id']},'order':_0x29c0('0x65')});}})[_0x29c0('0x21')](handleEntityNotFound(_0x555502,null))['then'](function(_0x4b1919){if(_0x4b1919){_0x4d84c1=_0x4b1919;var _0x218514={};for(var _0x51905c=0x0,_0x1cc81b=_0x4d84c1[_0x29c0('0x34')];_0x51905c<_0x1cc81b;_0x51905c++){if(!_0x218514['hasOwnProperty'](_0x4d84c1[_0x51905c][_0x29c0('0x66')])){_0x218514[_0x4d84c1[_0x51905c]['questionId']]=needsEncapsulation(_0x4d84c1[_0x51905c][_0x29c0('0x67')])?encapsulate(_0x4d84c1[_0x51905c][_0x29c0('0x67')]):_0x4d84c1[_0x51905c][_0x29c0('0x67')];}}var _0x2ea2c3=[],_0x2dd333={};for(var _0x1f8dc5=0x0,_0x5980fd=_0x28fefe[_0x29c0('0x34')];_0x1f8dc5<_0x5980fd;_0x1f8dc5++){_0x2dd333={'ProjectId':_0x12714a[_0x29c0('0x4c')]['id'],'SessionId':_0x28fefe[_0x1f8dc5]['id'],'StartTime':moment(_0x28fefe[_0x1f8dc5][_0x29c0('0x62')])['format'](_0x29c0('0x68'))};for(var _0x1df7f8=0x0,_0x23ac62=_0x4d84c1['length'];_0x1df7f8<_0x23ac62;_0x1df7f8++){if(_0x4d84c1[_0x1df7f8][_0x29c0('0x69')]==_0x28fefe[_0x1f8dc5]['id']&&_0x218514[_0x29c0('0x35')](_0x4d84c1[_0x1df7f8]['questionId'])){_0x2dd333[_0x218514[_0x4d84c1[_0x1df7f8]['questionId']]]=_0x4d84c1[_0x1df7f8][_0x29c0('0x6a')];}}for(var _0x22a01a in _0x218514){if(!_0x2dd333[_0x29c0('0x35')](_0x218514[_0x22a01a])){_0x2dd333[_0x218514[_0x22a01a]]=null;}}_0x2ea2c3[_0x29c0('0x6b')](_0x2dd333);}return _0x2ea2c3;}})[_0x29c0('0x21')](function(_0x2674be){if(!_[_0x29c0('0x6c')](_0x2674be)){var _0x474802=toCsv(_0x2674be);var _0x5d205a=Date[_0x29c0('0x6d')]();fs['writeFileSync'](util['format'](_0x29c0('0x6e'),_0x12714a[_0x29c0('0x4c')]['id'],_0x5d205a),_0x474802);_0x555502[_0x29c0('0x6f')](_0x29c0('0x70'),_0x29c0('0x71')+util['format'](_0x29c0('0x72'),_0x12714a[_0x29c0('0x4c')]['id'],_0x5d205a));_0x555502[_0x29c0('0x6f')]('Content-type',_0x29c0('0x73'));return _0x555502[_0x29c0('0x74')](util['format'](_0x29c0('0x6e'),_0x12714a[_0x29c0('0x4c')]['id'],_0x5d205a));}else{return _0x555502[_0x29c0('0x14')](0xcc);}})['catch'](handleError(_0x555502,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 134f1ba..96cf8d2 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 _0x2070=['../../config/environment','./jscriptyProject.attributes','JscriptyProject','jscripty_projects','../../config/logger','api','moment','request-promise','path'];(function(_0x2e4ef1,_0x30c6e6){var _0x17d1ae=function(_0x2754a8){while(--_0x2754a8){_0x2e4ef1['push'](_0x2e4ef1['shift']());}};_0x17d1ae(++_0x30c6e6);}(_0x2070,0x1a2));var _0x0207=function(_0x57266e,_0xdb0e2d){_0x57266e=_0x57266e-0x0;var _0x153939=_0x2070[_0x57266e];return _0x153939;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0207('0x0'))(_0x0207('0x1'));var moment=require(_0x0207('0x2'));var BPromise=require('bluebird');var rp=require(_0x0207('0x3'));var fs=require('fs');var path=require(_0x0207('0x4'));var rimraf=require('rimraf');var config=require(_0x0207('0x5'));var attributes=require(_0x0207('0x6'));module['exports']=function(_0x5573e8,_0x5cf734){return _0x5573e8['define'](_0x0207('0x7'),attributes,{'tableName':_0x0207('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ab0=['api','moment','bluebird','request-promise','path','rimraf','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x9ab0,0x195));var _0x09ab=function(_0x47b91f,_0x32e247){_0x47b91f=_0x47b91f-0x0;var _0x34dd54=_0x9ab0[_0x47b91f];return _0x34dd54;};'use strict';var _=require(_0x09ab('0x0'));var util=require(_0x09ab('0x1'));var logger=require(_0x09ab('0x2'))(_0x09ab('0x3'));var moment=require(_0x09ab('0x4'));var BPromise=require(_0x09ab('0x5'));var rp=require(_0x09ab('0x6'));var fs=require('fs');var path=require(_0x09ab('0x7'));var rimraf=require(_0x09ab('0x8'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x3144ec,_0x387ac8){return _0x3144ec[_0x09ab('0x9')](_0x09ab('0xa'),attributes,{'tableName':_0x09ab('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 2556eb5..796cdb2 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0xda3f,0xec));var _0xfda3=function(_0xe2feba,_0x1b3370){_0xe2feba=_0xe2feba-0x0;var _0x31717b=_0xda3f[_0xe2feba];return _0x31717b;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x419f0f,_0x48cfaa){var _0x5b5eed=function(_0x17b679){while(--_0x17b679){_0x419f0f['push'](_0x419f0f['shift']());}};_0x5b5eed(++_0x48cfaa);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 88bea63..d348ead 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 _0xa40e=['put','update','delete','/:id','destroy','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','show','post','create'];(function(_0x397a5d,_0x44a883){var _0x4492c2=function(_0x4ebd59){while(--_0x4ebd59){_0x397a5d['push'](_0x397a5d['shift']());}};_0x4492c2(++_0x44a883);}(_0xa40e,0x19d));var _0xea40=function(_0x2a5eea,_0x52df9e){_0x2a5eea=_0x2a5eea-0x0;var _0x1925b9=_0xa40e[_0x2a5eea];return _0x1925b9;};'use strict';var multer=require(_0xea40('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xea40('0x1'));var express=require('express');var router=express[_0xea40('0x2')]();var fs_extra=require(_0xea40('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xea40('0x4'));var config=require(_0xea40('0x5'));var controller=require('./jscriptyQuestionReport.controller');router[_0xea40('0x6')]('/',auth[_0xea40('0x7')](),controller['index']);router[_0xea40('0x6')]('/describe',auth[_0xea40('0x7')](),controller[_0xea40('0x8')]);router[_0xea40('0x6')]('/:id',auth[_0xea40('0x7')](),controller[_0xea40('0x9')]);router[_0xea40('0xa')]('/',auth[_0xea40('0x7')](),controller[_0xea40('0xb')]);router[_0xea40('0xc')]('/:id',auth[_0xea40('0x7')](),controller[_0xea40('0xd')]);router[_0xea40('0xe')](_0xea40('0xf'),auth[_0xea40('0x7')](),controller[_0xea40('0x10')]);module['exports']=router; \ No newline at end of file +var _0xd5bb=['isAuthenticated','index','get','/describe','describe','/:id','show','create','update','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xd5bb,0xa3));var _0xbd5b=function(_0x1337d9,_0x31d17e){_0x1337d9=_0x1337d9-0x0;var _0x2b75e5=_0xd5bb[_0x1337d9];return _0x2b75e5;};'use strict';var multer=require('multer');var util=require(_0xbd5b('0x0'));var path=require(_0xbd5b('0x1'));var timeout=require('connect-timeout');var express=require(_0xbd5b('0x2'));var router=express['Router']();var fs_extra=require(_0xbd5b('0x3'));var auth=require(_0xbd5b('0x4'));var interaction=require(_0xbd5b('0x5'));var config=require('../../config/environment');var controller=require(_0xbd5b('0x6'));router['get']('/',auth[_0xbd5b('0x7')](),controller[_0xbd5b('0x8')]);router[_0xbd5b('0x9')](_0xbd5b('0xa'),auth[_0xbd5b('0x7')](),controller[_0xbd5b('0xb')]);router[_0xbd5b('0x9')](_0xbd5b('0xc'),auth[_0xbd5b('0x7')](),controller[_0xbd5b('0xd')]);router['post']('/',auth[_0xbd5b('0x7')](),controller[_0xbd5b('0xe')]);router['put'](_0xbd5b('0xc'),auth[_0xbd5b('0x7')](),controller[_0xbd5b('0xf')]);router['delete'](_0xbd5b('0xc'),auth[_0xbd5b('0x7')](),controller['destroy']);module[_0xbd5b('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index ac000cb..6c72525 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7a54,0x106));var _0x47a5=function(_0x3046fa,_0x46278b){_0x3046fa=_0x3046fa-0x0;var _0x30f640=_0x7a54[_0x3046fa];return _0x30f640;};'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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0x5480de,_0x427ca4){_0x5480de=_0x5480de-0x0;var _0x2638e8=_0x7a54[_0x5480de];return _0x2638e8;};'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 bcd1950..02aa072 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 _0x36ce=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x38d9a5,_0x343da9){var _0x67b950=function(_0xb104d2){while(--_0xb104d2){_0x38d9a5['push'](_0x38d9a5['shift']());}};_0x67b950(++_0x343da9);}(_0x36ce,0x11c));var _0xe36c=function(_0xfb57fd,_0x5b7a86){_0xfb57fd=_0xfb57fd-0x0;var _0x2c1b0c=_0x36ce[_0xfb57fd];return _0x2c1b0c;};'use strict';var emlformat=require(_0xe36c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe36c('0x1'));var jsonpatch=require(_0xe36c('0x2'));var rp=require(_0xe36c('0x3'));var moment=require('moment');var BPromise=require(_0xe36c('0x4'));var Mustache=require(_0xe36c('0x5'));var util=require(_0xe36c('0x6'));var path=require(_0xe36c('0x7'));var sox=require('sox');var csv=require(_0xe36c('0x8'));var ejs=require(_0xe36c('0x9'));var fs=require('fs');var fs_extra=require(_0xe36c('0xa'));var _=require(_0xe36c('0xb'));var squel=require('squel');var crypto=require(_0xe36c('0xc'));var jsforce=require(_0xe36c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe36c('0xe'));var Papa=require('papaparse');var Redis=require(_0xe36c('0xf'));var authService=require(_0xe36c('0x10'));var qs=require(_0xe36c('0x11'));var as=require(_0xe36c('0x12'));var hardwareService=require(_0xe36c('0x13'));var logger=require(_0xe36c('0x14'))(_0xe36c('0x15'));var utils=require(_0xe36c('0x16'));var config=require(_0xe36c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bff6e,_0x50baa6){_0x50baa6=_0x50baa6||0xcc;return function(_0x1df89e){if(_0x1df89e){return _0x1bff6e[_0xe36c('0x18')](_0x50baa6);}return _0x1bff6e[_0xe36c('0x19')](_0x50baa6)[_0xe36c('0x1a')]();};}function respondWithResult(_0x2bcbcf,_0x1f8189){_0x1f8189=_0x1f8189||0xc8;return function(_0x3d2dc9){if(_0x3d2dc9){return _0x2bcbcf[_0xe36c('0x19')](_0x1f8189)['json'](_0x3d2dc9);}};}function respondWithFilteredResult(_0x502c43,_0x807ba0){return function(_0x55fd77){if(_0x55fd77){var _0x29ded6=typeof _0x807ba0[_0xe36c('0x1b')]===_0xe36c('0x1c')&&typeof _0x807ba0[_0xe36c('0x1d')]===_0xe36c('0x1c');var _0xd61461=_0x55fd77[_0xe36c('0x1e')];var _0x5a763b=_0x29ded6?0x0:_0x807ba0[_0xe36c('0x1b')];var _0xc91d5e=_0x29ded6?_0x55fd77['count']:_0x807ba0[_0xe36c('0x1b')]+_0x807ba0[_0xe36c('0x1d')];var _0x3492fa;if(_0xc91d5e>=_0xd61461){_0xc91d5e=_0xd61461;_0x3492fa=0xc8;}else{_0x3492fa=0xce;}_0x502c43[_0xe36c('0x19')](_0x3492fa);return _0x502c43[_0xe36c('0x1f')](_0xe36c('0x20'),_0x5a763b+'-'+_0xc91d5e+'/'+_0xd61461)[_0xe36c('0x21')](_0x55fd77);}return null;};}function patchUpdates(_0xaf4dc0){return function(_0x14a268){try{jsonpatch['apply'](_0x14a268,_0xaf4dc0,!![]);}catch(_0x3b1ded){return BPromise[_0xe36c('0x22')](_0x3b1ded);}return _0x14a268[_0xe36c('0x23')]();};}function saveUpdates(_0x44a555,_0x4ec7ca){return function(_0x5d9831){if(_0x5d9831){return _0x5d9831['update'](_0x44a555)[_0xe36c('0x24')](function(_0x1281ed){return _0x1281ed;});}return null;};}function removeEntity(_0x19ca11,_0x421349){return function(_0x54a7ee){if(_0x54a7ee){return _0x54a7ee[_0xe36c('0x25')]()[_0xe36c('0x24')](function(){_0x19ca11[_0xe36c('0x19')](0xcc)[_0xe36c('0x1a')]();});}};}function handleEntityNotFound(_0x935791,_0x1b8635){return function(_0x10f96c){if(!_0x10f96c){_0x935791[_0xe36c('0x18')](0x194);}return _0x10f96c;};}function handleError(_0xc1dcfd,_0x312f94){_0x312f94=_0x312f94||0x1f4;return function(_0xdb20ee){logger[_0xe36c('0x26')](_0xdb20ee[_0xe36c('0x27')]);if(_0xdb20ee[_0xe36c('0x28')]){delete _0xdb20ee[_0xe36c('0x28')];}_0xc1dcfd[_0xe36c('0x19')](_0x312f94)[_0xe36c('0x29')](_0xdb20ee);};}exports[_0xe36c('0x2a')]=function(_0x353661,_0x5d2915){var _0x252ba5={},_0x383dad={},_0x3372cd={'count':0x0,'rows':[]};var _0x28a1bf=_[_0xe36c('0x2b')](db[_0xe36c('0x2c')]['rawAttributes'],function(_0x5ccabc){return{'name':_0x5ccabc['fieldName'],'type':_0x5ccabc[_0xe36c('0x2d')][_0xe36c('0x2e')]};});_0x383dad[_0xe36c('0x2f')]=_['map'](_0x28a1bf,_0xe36c('0x28'));_0x383dad[_0xe36c('0x30')]=_[_0xe36c('0x31')](_0x353661['query']);_0x383dad[_0xe36c('0x32')]=_[_0xe36c('0x33')](_0x383dad[_0xe36c('0x2f')],_0x383dad[_0xe36c('0x30')]);_0x252ba5[_0xe36c('0x34')]=_['intersection'](_0x383dad['model'],qs[_0xe36c('0x35')](_0x353661[_0xe36c('0x30')][_0xe36c('0x35')]));_0x252ba5[_0xe36c('0x34')]=_0x252ba5[_0xe36c('0x34')][_0xe36c('0x36')]?_0x252ba5[_0xe36c('0x34')]:_0x383dad[_0xe36c('0x2f')];if(!_0x353661[_0xe36c('0x30')][_0xe36c('0x37')](_0xe36c('0x38'))){_0x252ba5[_0xe36c('0x1d')]=qs[_0xe36c('0x1d')](_0x353661[_0xe36c('0x30')][_0xe36c('0x1d')]);_0x252ba5[_0xe36c('0x1b')]=qs[_0xe36c('0x1b')](_0x353661[_0xe36c('0x30')][_0xe36c('0x1b')]);}_0x252ba5[_0xe36c('0x39')]=qs[_0xe36c('0x3a')](_0x353661['query'][_0xe36c('0x3a')]);_0x252ba5['where']=qs[_0xe36c('0x32')](_[_0xe36c('0x3b')](_0x353661[_0xe36c('0x30')],_0x383dad[_0xe36c('0x32')]),_0x28a1bf);if(_0x353661['query'][_0xe36c('0x3c')]){_0x252ba5[_0xe36c('0x3d')]=_[_0xe36c('0x3e')](_0x252ba5[_0xe36c('0x3d')],{'$or':_[_0xe36c('0x2b')](_0x28a1bf,function(_0x5a9afb){if(_0x5a9afb[_0xe36c('0x2d')]!==_0xe36c('0x3f')){var _0x4ab98a={};_0x4ab98a[_0x5a9afb[_0xe36c('0x28')]]={'$like':'%'+_0x353661[_0xe36c('0x30')][_0xe36c('0x3c')]+'%'};return _0x4ab98a;}})});}_0x252ba5=_['merge']({},_0x252ba5,_0x353661[_0xe36c('0x40')]);var _0x47555c={'where':_0x252ba5[_0xe36c('0x3d')]};return db[_0xe36c('0x2c')][_0xe36c('0x1e')](_0x47555c)[_0xe36c('0x24')](function(_0x2ea927){_0x3372cd['count']=_0x2ea927;if(_0x353661[_0xe36c('0x30')][_0xe36c('0x41')]){_0x252ba5[_0xe36c('0x42')]=[{'all':!![]}];}return db[_0xe36c('0x2c')][_0xe36c('0x43')](_0x252ba5);})[_0xe36c('0x24')](function(_0x4b7242){_0x3372cd[_0xe36c('0x44')]=_0x4b7242;return _0x3372cd;})[_0xe36c('0x24')](respondWithFilteredResult(_0x5d2915,_0x252ba5))[_0xe36c('0x45')](handleError(_0x5d2915,null));};exports[_0xe36c('0x46')]=function(_0x24faca,_0x10243b){var _0x3ce81d={'raw':!![],'where':{'id':_0x24faca[_0xe36c('0x47')]['id']}},_0x8bdfc5={};_0x8bdfc5[_0xe36c('0x2f')]=_[_0xe36c('0x31')](db['JscriptyQuestionReport'][_0xe36c('0x48')]);_0x8bdfc5[_0xe36c('0x30')]=_[_0xe36c('0x31')](_0x24faca[_0xe36c('0x30')]);_0x8bdfc5[_0xe36c('0x32')]=_[_0xe36c('0x33')](_0x8bdfc5[_0xe36c('0x2f')],_0x8bdfc5[_0xe36c('0x30')]);_0x3ce81d[_0xe36c('0x34')]=_['intersection'](_0x8bdfc5[_0xe36c('0x2f')],qs[_0xe36c('0x35')](_0x24faca['query'][_0xe36c('0x35')]));_0x3ce81d[_0xe36c('0x34')]=_0x3ce81d[_0xe36c('0x34')][_0xe36c('0x36')]?_0x3ce81d[_0xe36c('0x34')]:_0x8bdfc5['model'];if(_0x24faca[_0xe36c('0x30')][_0xe36c('0x41')]){_0x3ce81d[_0xe36c('0x42')]=[{'all':!![]}];}_0x3ce81d=_[_0xe36c('0x3e')]({},_0x3ce81d,_0x24faca[_0xe36c('0x40')]);return db[_0xe36c('0x2c')]['find'](_0x3ce81d)[_0xe36c('0x24')](handleEntityNotFound(_0x10243b,null))[_0xe36c('0x24')](respondWithResult(_0x10243b,null))[_0xe36c('0x45')](handleError(_0x10243b,null));};exports[_0xe36c('0x49')]=function(_0x466c4c,_0x1a840c){return db[_0xe36c('0x2c')][_0xe36c('0x49')](_0x466c4c[_0xe36c('0x4a')],{})[_0xe36c('0x24')](respondWithResult(_0x1a840c,0xc9))[_0xe36c('0x45')](handleError(_0x1a840c,null));};exports[_0xe36c('0x4b')]=function(_0x1928a1,_0x166aaa){if(_0x1928a1[_0xe36c('0x4a')]['id']){delete _0x1928a1[_0xe36c('0x4a')]['id'];}return db[_0xe36c('0x2c')]['find']({'where':{'id':_0x1928a1[_0xe36c('0x47')]['id']}})['then'](handleEntityNotFound(_0x166aaa,null))[_0xe36c('0x24')](saveUpdates(_0x1928a1[_0xe36c('0x4a')],null))[_0xe36c('0x24')](respondWithResult(_0x166aaa,null))[_0xe36c('0x45')](handleError(_0x166aaa,null));};exports[_0xe36c('0x25')]=function(_0x41b2c9,_0x295539){return db[_0xe36c('0x2c')]['find']({'where':{'id':_0x41b2c9[_0xe36c('0x47')]['id']}})[_0xe36c('0x24')](handleEntityNotFound(_0x295539,null))[_0xe36c('0x24')](removeEntity(_0x295539,null))[_0xe36c('0x45')](handleError(_0x295539,null));};exports['describe']=function(_0x1b3bdc,_0xd84b0){return db['JscriptyQuestionReport'][_0xe36c('0x4c')]()[_0xe36c('0x24')](respondWithResult(_0xd84b0,null))['catch'](handleError(_0xd84b0,null));}; \ No newline at end of file +var _0x467a=['type','VIRTUAL','include','findAll','rows','catch','params','length','includeAll','options','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge'];(function(_0x50afb6,_0x1d2f36){var _0x4397a=function(_0x2e4448){while(--_0x2e4448){_0x50afb6['push'](_0x50afb6['shift']());}};_0x4397a(++_0x1d2f36);}(_0x467a,0xa4));var _0xa467=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x467a[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xa467('0x0'));var rimraf=require(_0xa467('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa467('0x2'));var moment=require(_0xa467('0x3'));var BPromise=require(_0xa467('0x4'));var Mustache=require(_0xa467('0x5'));var util=require('util');var path=require(_0xa467('0x6'));var sox=require(_0xa467('0x7'));var csv=require('to-csv');var ejs=require(_0xa467('0x8'));var fs=require('fs');var fs_extra=require(_0xa467('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa467('0xa'));var jsforce=require(_0xa467('0xb'));var deskjs=require(_0xa467('0xc'));var toCsv=require(_0xa467('0xd'));var querystring=require('querystring');var Papa=require(_0xa467('0xe'));var Redis=require(_0xa467('0xf'));var authService=require(_0xa467('0x10'));var qs=require(_0xa467('0x11'));var as=require(_0xa467('0x12'));var hardwareService=require(_0xa467('0x13'));var logger=require(_0xa467('0x14'))(_0xa467('0x15'));var utils=require('../../config/utils');var config=require(_0xa467('0x16'));var licenseUtil=require(_0xa467('0x17'));var db=require(_0xa467('0x18'))['db'];function respondWithStatusCode(_0x4413e6,_0x18751e){_0x18751e=_0x18751e||0xcc;return function(_0x5def18){if(_0x5def18){return _0x4413e6[_0xa467('0x19')](_0x18751e);}return _0x4413e6[_0xa467('0x1a')](_0x18751e)[_0xa467('0x1b')]();};}function respondWithResult(_0x1a86a3,_0xf4ae81){_0xf4ae81=_0xf4ae81||0xc8;return function(_0x24fcd2){if(_0x24fcd2){return _0x1a86a3[_0xa467('0x1a')](_0xf4ae81)[_0xa467('0x1c')](_0x24fcd2);}};}function respondWithFilteredResult(_0x4b2334,_0x104381){return function(_0x2d9d99){if(_0x2d9d99){var _0x3660d8=typeof _0x104381[_0xa467('0x1d')]==='undefined'&&typeof _0x104381[_0xa467('0x1e')]==='undefined';var _0x42d6e3=_0x2d9d99['count'];var _0x468427=_0x3660d8?0x0:_0x104381[_0xa467('0x1d')];var _0x112177=_0x3660d8?_0x2d9d99[_0xa467('0x1f')]:_0x104381[_0xa467('0x1d')]+_0x104381[_0xa467('0x1e')];var _0x3a1f3c;if(_0x112177>=_0x42d6e3){_0x112177=_0x42d6e3;_0x3a1f3c=0xc8;}else{_0x3a1f3c=0xce;}_0x4b2334['status'](_0x3a1f3c);return _0x4b2334[_0xa467('0x20')](_0xa467('0x21'),_0x468427+'-'+_0x112177+'/'+_0x42d6e3)[_0xa467('0x1c')](_0x2d9d99);}return null;};}function patchUpdates(_0x4d3d68){return function(_0x537753){try{jsonpatch['apply'](_0x537753,_0x4d3d68,!![]);}catch(_0xc265d6){return BPromise['reject'](_0xc265d6);}return _0x537753[_0xa467('0x22')]();};}function saveUpdates(_0x46a682,_0x4f3576){return function(_0x217add){if(_0x217add){return _0x217add[_0xa467('0x23')](_0x46a682)[_0xa467('0x24')](function(_0x219e18){return _0x219e18;});}return null;};}function removeEntity(_0x13c05d,_0xd7fa33){return function(_0x4525bd){if(_0x4525bd){return _0x4525bd[_0xa467('0x25')]()['then'](function(){_0x13c05d[_0xa467('0x1a')](0xcc)[_0xa467('0x1b')]();});}};}function handleEntityNotFound(_0x364ac5,_0x1035d5){return function(_0x57bfbd){if(!_0x57bfbd){_0x364ac5[_0xa467('0x19')](0x194);}return _0x57bfbd;};}function handleError(_0x4b5063,_0x51cce){_0x51cce=_0x51cce||0x1f4;return function(_0x16c781){logger[_0xa467('0x26')](_0x16c781[_0xa467('0x27')]);if(_0x16c781[_0xa467('0x28')]){delete _0x16c781[_0xa467('0x28')];}_0x4b5063[_0xa467('0x1a')](_0x51cce)[_0xa467('0x29')](_0x16c781);};}exports[_0xa467('0x2a')]=function(_0x440f0c,_0x4e8c8a){var _0x3763ba={},_0x12342e={},_0x436fe2={'count':0x0,'rows':[]};var _0x364065=_['map'](db[_0xa467('0x2b')][_0xa467('0x2c')],function(_0x45c43c){return{'name':_0x45c43c[_0xa467('0x2d')],'type':_0x45c43c['type'][_0xa467('0x2e')]};});_0x12342e[_0xa467('0x2f')]=_[_0xa467('0x30')](_0x364065,_0xa467('0x28'));_0x12342e[_0xa467('0x31')]=_[_0xa467('0x32')](_0x440f0c[_0xa467('0x31')]);_0x12342e[_0xa467('0x33')]=_['intersection'](_0x12342e[_0xa467('0x2f')],_0x12342e[_0xa467('0x31')]);_0x3763ba['attributes']=_[_0xa467('0x34')](_0x12342e[_0xa467('0x2f')],qs[_0xa467('0x35')](_0x440f0c['query'][_0xa467('0x35')]));_0x3763ba[_0xa467('0x36')]=_0x3763ba[_0xa467('0x36')]['length']?_0x3763ba['attributes']:_0x12342e[_0xa467('0x2f')];if(!_0x440f0c[_0xa467('0x31')][_0xa467('0x37')]('nolimit')){_0x3763ba[_0xa467('0x1e')]=qs[_0xa467('0x1e')](_0x440f0c['query'][_0xa467('0x1e')]);_0x3763ba[_0xa467('0x1d')]=qs[_0xa467('0x1d')](_0x440f0c[_0xa467('0x31')]['offset']);}_0x3763ba[_0xa467('0x38')]=qs['sort'](_0x440f0c['query'][_0xa467('0x39')]);_0x3763ba[_0xa467('0x3a')]=qs[_0xa467('0x33')](_['pick'](_0x440f0c[_0xa467('0x31')],_0x12342e[_0xa467('0x33')]),_0x364065);if(_0x440f0c[_0xa467('0x31')][_0xa467('0x3b')]){_0x3763ba[_0xa467('0x3a')]=_[_0xa467('0x3c')](_0x3763ba[_0xa467('0x3a')],{'$or':_[_0xa467('0x30')](_0x364065,function(_0x18ff31){if(_0x18ff31[_0xa467('0x3d')]!==_0xa467('0x3e')){var _0x213ba8={};_0x213ba8[_0x18ff31[_0xa467('0x28')]]={'$like':'%'+_0x440f0c['query']['filter']+'%'};return _0x213ba8;}})});}_0x3763ba=_[_0xa467('0x3c')]({},_0x3763ba,_0x440f0c['options']);var _0x223d9d={'where':_0x3763ba[_0xa467('0x3a')]};return db[_0xa467('0x2b')][_0xa467('0x1f')](_0x223d9d)[_0xa467('0x24')](function(_0x79b386){_0x436fe2['count']=_0x79b386;if(_0x440f0c[_0xa467('0x31')]['includeAll']){_0x3763ba[_0xa467('0x3f')]=[{'all':!![]}];}return db[_0xa467('0x2b')][_0xa467('0x40')](_0x3763ba);})[_0xa467('0x24')](function(_0x275ce6){_0x436fe2[_0xa467('0x41')]=_0x275ce6;return _0x436fe2;})[_0xa467('0x24')](respondWithFilteredResult(_0x4e8c8a,_0x3763ba))[_0xa467('0x42')](handleError(_0x4e8c8a,null));};exports['show']=function(_0x192bc0,_0x9e5dd7){var _0x2d2ce6={'raw':!![],'where':{'id':_0x192bc0[_0xa467('0x43')]['id']}},_0x55b9f3={};_0x55b9f3[_0xa467('0x2f')]=_[_0xa467('0x32')](db[_0xa467('0x2b')][_0xa467('0x2c')]);_0x55b9f3['query']=_[_0xa467('0x32')](_0x192bc0[_0xa467('0x31')]);_0x55b9f3[_0xa467('0x33')]=_['intersection'](_0x55b9f3[_0xa467('0x2f')],_0x55b9f3[_0xa467('0x31')]);_0x2d2ce6[_0xa467('0x36')]=_[_0xa467('0x34')](_0x55b9f3[_0xa467('0x2f')],qs[_0xa467('0x35')](_0x192bc0['query']['fields']));_0x2d2ce6[_0xa467('0x36')]=_0x2d2ce6[_0xa467('0x36')][_0xa467('0x44')]?_0x2d2ce6[_0xa467('0x36')]:_0x55b9f3[_0xa467('0x2f')];if(_0x192bc0['query'][_0xa467('0x45')]){_0x2d2ce6['include']=[{'all':!![]}];}_0x2d2ce6=_[_0xa467('0x3c')]({},_0x2d2ce6,_0x192bc0[_0xa467('0x46')]);return db[_0xa467('0x2b')][_0xa467('0x47')](_0x2d2ce6)[_0xa467('0x24')](handleEntityNotFound(_0x9e5dd7,null))[_0xa467('0x24')](respondWithResult(_0x9e5dd7,null))['catch'](handleError(_0x9e5dd7,null));};exports[_0xa467('0x48')]=function(_0x19b263,_0xd9e475){return db[_0xa467('0x2b')][_0xa467('0x48')](_0x19b263[_0xa467('0x49')],{})[_0xa467('0x24')](respondWithResult(_0xd9e475,0xc9))[_0xa467('0x42')](handleError(_0xd9e475,null));};exports[_0xa467('0x23')]=function(_0x58a933,_0x2bc8e9){if(_0x58a933['body']['id']){delete _0x58a933[_0xa467('0x49')]['id'];}return db[_0xa467('0x2b')][_0xa467('0x47')]({'where':{'id':_0x58a933[_0xa467('0x43')]['id']}})[_0xa467('0x24')](handleEntityNotFound(_0x2bc8e9,null))[_0xa467('0x24')](saveUpdates(_0x58a933[_0xa467('0x49')],null))[_0xa467('0x24')](respondWithResult(_0x2bc8e9,null))[_0xa467('0x42')](handleError(_0x2bc8e9,null));};exports[_0xa467('0x25')]=function(_0x52a6b9,_0x1a98fc){return db[_0xa467('0x2b')][_0xa467('0x47')]({'where':{'id':_0x52a6b9[_0xa467('0x43')]['id']}})[_0xa467('0x24')](handleEntityNotFound(_0x1a98fc,null))[_0xa467('0x24')](removeEntity(_0x1a98fc,null))[_0xa467('0x42')](handleError(_0x1a98fc,null));};exports['describe']=function(_0x4466c3,_0x3ef7bb){return db[_0xa467('0x2b')][_0xa467('0x4a')]()[_0xa467('0x24')](respondWithResult(_0x3ef7bb,null))[_0xa467('0x42')](handleError(_0x3ef7bb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 4b7a483..0cb71e5 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 _0x8b8b=['report_jscripty_questions','util','moment','bluebird','request-promise','rimraf','exports','JscriptyQuestionReport'];(function(_0x2dc0e0,_0x23bb63){var _0x1c2959=function(_0x127bf0){while(--_0x127bf0){_0x2dc0e0['push'](_0x2dc0e0['shift']());}};_0x1c2959(++_0x23bb63);}(_0x8b8b,0x1c9));var _0xb8b8=function(_0x3ffcc0,_0x85b1f0){_0x3ffcc0=_0x3ffcc0-0x0;var _0x2437f8=_0x8b8b[_0x3ffcc0];return _0x2437f8;};'use strict';var _=require('lodash');var util=require(_0xb8b8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb8b8('0x1'));var BPromise=require(_0xb8b8('0x2'));var rp=require(_0xb8b8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb8b8('0x4'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module[_0xb8b8('0x5')]=function(_0x3bac1d,_0x396cfc){return _0x3bac1d['define'](_0xb8b8('0x6'),attributes,{'tableName':_0xb8b8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35f1=['../../config/environment','./jscriptyQuestionReport.attributes','report_jscripty_questions','lodash','util','api','request-promise','path','rimraf'];(function(_0x123450,_0x491c01){var _0x23b29d=function(_0x2c23cb){while(--_0x2c23cb){_0x123450['push'](_0x123450['shift']());}};_0x23b29d(++_0x491c01);}(_0x35f1,0x12c));var _0x135f=function(_0x18c55f,_0x327651){_0x18c55f=_0x18c55f-0x0;var _0x334690=_0x35f1[_0x18c55f];return _0x334690;};'use strict';var _=require(_0x135f('0x0'));var util=require(_0x135f('0x1'));var logger=require('../../config/logger')(_0x135f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x135f('0x3'));var fs=require('fs');var path=require(_0x135f('0x4'));var rimraf=require(_0x135f('0x5'));var config=require(_0x135f('0x6'));var attributes=require(_0x135f('0x7'));module['exports']=function(_0x2499e1,_0x22379d){return _0x2499e1['define']('JscriptyQuestionReport',attributes,{'tableName':_0x135f('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 c9137a5..378d6aa 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 _0xbde8=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbde8,0x1b6));var _0x8bde=function(_0x2e7a43,_0x3b3df4){_0x2e7a43=_0x2e7a43-0x0;var _0x52e9e1=_0xbde8[_0x2e7a43];return _0x52e9e1;};'use strict';var _=require(_0x8bde('0x0'));var util=require(_0x8bde('0x1'));var moment=require('moment');var BPromise=require(_0x8bde('0x2'));var rs=require(_0x8bde('0x3'));var fs=require('fs');var Redis=require(_0x8bde('0x4'));var db=require(_0x8bde('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8bde('0x6'))(_0x8bde('0x7'));var config=require(_0x8bde('0x8'));var jayson=require(_0x8bde('0x9'));var client=jayson[_0x8bde('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa07241,_0x1a99f7,_0x303e0f){return new BPromise(function(_0x27ceb2,_0x1ec3a8){return client[_0x8bde('0xb')](_0xa07241,_0x303e0f)[_0x8bde('0xc')](function(_0x1d057d){logger[_0x8bde('0xd')](_0x8bde('0xe'),_0x1a99f7,'request\x20sent');logger[_0x8bde('0xf')](_0x8bde('0x10'),_0x1a99f7,_0x8bde('0x11'),JSON['stringify'](_0x1d057d));if(_0x1d057d[_0x8bde('0x12')]){if(_0x1d057d[_0x8bde('0x12')][_0x8bde('0x13')]===0x1f4){logger[_0x8bde('0x12')](_0x8bde('0xe'),_0x1a99f7,_0x1d057d['error'][_0x8bde('0x14')]);return _0x1ec3a8(_0x1d057d[_0x8bde('0x12')][_0x8bde('0x14')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x1a99f7,_0x1d057d[_0x8bde('0x12')]['message']);return _0x27ceb2(_0x1d057d[_0x8bde('0x12')][_0x8bde('0x14')]);}else{logger['info'](_0x8bde('0xe'),_0x1a99f7,_0x8bde('0x11'));_0x27ceb2(_0x1d057d[_0x8bde('0x15')][_0x8bde('0x14')]);}})[_0x8bde('0x16')](function(_0x391949){logger[_0x8bde('0x12')](_0x8bde('0xe'),_0x1a99f7,_0x391949);_0x1ec3a8(_0x391949);});});} \ No newline at end of file +var _0xdaba=['request\x20sent','stringify','error','message','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s'];(function(_0x14c88c,_0x1ec594){var _0x40f567=function(_0x52a584){while(--_0x52a584){_0x14c88c['push'](_0x14c88c['shift']());}};_0x40f567(++_0x1ec594);}(_0xdaba,0x15a));var _0xadab=function(_0x5dc34d,_0x60d420){_0x5dc34d=_0x5dc34d-0x0;var _0x2afadb=_0xdaba[_0x5dc34d];return _0x2afadb;};'use strict';var _=require(_0xadab('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xadab('0x1'));var rs=require(_0xadab('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xadab('0x3'));var logger=require(_0xadab('0x4'))(_0xadab('0x5'));var config=require(_0xadab('0x6'));var jayson=require(_0xadab('0x7'));var client=jayson['client'][_0xadab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30f16f,_0x343020,_0x292e73){return new BPromise(function(_0x490c0a,_0x25efda){return client[_0xadab('0x9')](_0x30f16f,_0x292e73)[_0xadab('0xa')](function(_0xe70674){logger[_0xadab('0xb')](_0xadab('0xc'),_0x343020,'request\x20sent');logger['debug'](_0xadab('0xd'),_0x343020,_0xadab('0xe'),JSON[_0xadab('0xf')](_0xe70674));if(_0xe70674[_0xadab('0x10')]){if(_0xe70674[_0xadab('0x10')]['code']===0x1f4){logger[_0xadab('0x10')](_0xadab('0xc'),_0x343020,_0xe70674[_0xadab('0x10')][_0xadab('0x11')]);return _0x25efda(_0xe70674[_0xadab('0x10')][_0xadab('0x11')]);}logger[_0xadab('0x10')](_0xadab('0xc'),_0x343020,_0xe70674[_0xadab('0x10')][_0xadab('0x11')]);return _0x490c0a(_0xe70674[_0xadab('0x10')]['message']);}else{logger['info'](_0xadab('0xc'),_0x343020,'request\x20sent');_0x490c0a(_0xe70674[_0xadab('0x12')][_0xadab('0x11')]);}})[_0xadab('0x13')](function(_0x2a33a1){logger[_0xadab('0x10')](_0xadab('0xc'),_0x343020,_0x2a33a1);_0x25efda(_0x2a33a1);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 1b91ba3..43ead71 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 _0xcaac=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','post','create','put','update','delete','destroy'];(function(_0x5ad07c,_0x324dcd){var _0x204bae=function(_0x1245bc){while(--_0x1245bc){_0x5ad07c['push'](_0x5ad07c['shift']());}};_0x204bae(++_0x324dcd);}(_0xcaac,0x1c9));var _0xccaa=function(_0x1cc2ed,_0xa50bd7){_0x1cc2ed=_0x1cc2ed-0x0;var _0x1ae625=_0xcaac[_0x1cc2ed];return _0x1ae625;};'use strict';var multer=require(_0xccaa('0x0'));var util=require('util');var path=require(_0xccaa('0x1'));var timeout=require('connect-timeout');var express=require(_0xccaa('0x2'));var router=express[_0xccaa('0x3')]();var fs_extra=require(_0xccaa('0x4'));var auth=require(_0xccaa('0x5'));var interaction=require(_0xccaa('0x6'));var config=require(_0xccaa('0x7'));var controller=require(_0xccaa('0x8'));router[_0xccaa('0x9')]('/',auth[_0xccaa('0xa')](),controller[_0xccaa('0xb')]);router[_0xccaa('0x9')](_0xccaa('0xc'),auth[_0xccaa('0xa')](),controller[_0xccaa('0xd')]);router[_0xccaa('0x9')](_0xccaa('0xe'),auth['isAuthenticated'](),controller[_0xccaa('0xf')]);router['get'](_0xccaa('0x10'),auth['isAuthenticated'](),controller['getQuestions']);router[_0xccaa('0x11')]('/',auth[_0xccaa('0xa')](),controller[_0xccaa('0x12')]);router[_0xccaa('0x13')]('/:id',auth[_0xccaa('0xa')](),controller[_0xccaa('0x14')]);router[_0xccaa('0x15')](_0xccaa('0xe'),auth['isAuthenticated'](),controller[_0xccaa('0x16')]);module[_0xccaa('0x17')]=router; \ No newline at end of file +var _0xbdea=['describe','/:id','show','/:id/questions','getQuestions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe'];(function(_0xdc1df1,_0x26a2bf){var _0x5c9993=function(_0x82ba1c){while(--_0x82ba1c){_0xdc1df1['push'](_0xdc1df1['shift']());}};_0x5c9993(++_0x26a2bf);}(_0xbdea,0xb2));var _0xabde=function(_0x32efcb,_0x55523f){_0x32efcb=_0x32efcb-0x0;var _0x1dae88=_0xbdea[_0x32efcb];return _0x1dae88;};'use strict';var multer=require(_0xabde('0x0'));var util=require(_0xabde('0x1'));var path=require(_0xabde('0x2'));var timeout=require(_0xabde('0x3'));var express=require(_0xabde('0x4'));var router=express[_0xabde('0x5')]();var fs_extra=require(_0xabde('0x6'));var auth=require(_0xabde('0x7'));var interaction=require(_0xabde('0x8'));var config=require('../../config/environment');var controller=require(_0xabde('0x9'));router['get']('/',auth[_0xabde('0xa')](),controller[_0xabde('0xb')]);router[_0xabde('0xc')](_0xabde('0xd'),auth[_0xabde('0xa')](),controller[_0xabde('0xe')]);router['get'](_0xabde('0xf'),auth[_0xabde('0xa')](),controller[_0xabde('0x10')]);router[_0xabde('0xc')](_0xabde('0x11'),auth[_0xabde('0xa')](),controller[_0xabde('0x12')]);router['post']('/',auth[_0xabde('0xa')](),controller[_0xabde('0x13')]);router[_0xabde('0x14')](_0xabde('0xf'),auth['isAuthenticated'](),controller[_0xabde('0x15')]);router['delete'](_0xabde('0xf'),auth['isAuthenticated'](),controller[_0xabde('0x16')]);module[_0xabde('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 439f8c6..cbe684f 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 _0xedc0=['STRING','BOOLEAN','moment','exports','DATE','starttime','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x33fa3a,_0x44ebd4){var _0x2d454f=function(_0x529774){while(--_0x529774){_0x33fa3a['push'](_0x33fa3a['shift']());}};_0x2d454f(++_0x44ebd4);}(_0xedc0,0xf5));var _0x0edc=function(_0x350277,_0x25d306){_0x350277=_0x350277-0x0;var _0x5e418b=_0xedc0[_0x350277];return _0x5e418b;};'use strict';var moment=require(_0x0edc('0x0'));var Sequelize=require('sequelize');module[_0x0edc('0x1')]={'starttime':{'type':Sequelize[_0x0edc('0x2')],'set':function(_0x483ddb){this['setDataValue'](_0x0edc('0x3'),_0x483ddb);this[_0x0edc('0x4')]('endtime',moment()[_0x0edc('0x5')](_0x0edc('0x6')));}},'endtime':{'type':Sequelize[_0x0edc('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x0edc('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0edc('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x0edc('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x5b0f=['setDataValue','starttime','endtime','format','STRING','BOOLEAN','sequelize','DATE'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x5b0f,0xde));var _0xf5b0=function(_0x52071d,_0x1a6e5f){_0x52071d=_0x52071d-0x0;var _0x437165=_0x5b0f[_0x52071d];return _0x437165;};'use strict';var moment=require('moment');var Sequelize=require(_0xf5b0('0x0'));module['exports']={'starttime':{'type':Sequelize[_0xf5b0('0x1')],'set':function(_0x1e6fa9){this[_0xf5b0('0x2')](_0xf5b0('0x3'),_0x1e6fa9);this[_0xf5b0('0x2')](_0xf5b0('0x4'),moment()[_0xf5b0('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xf5b0('0x6')]},'projectname':{'type':Sequelize[_0xf5b0('0x6')]},'queue':{'type':Sequelize[_0xf5b0('0x6')]},'uniqueid':{'type':Sequelize[_0xf5b0('0x6')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf5b0('0x6')]},'completed':{'type':Sequelize[_0xf5b0('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 8938d73..e7034f0 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 _0x328f=['filter','merge','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','params','find','create','body','describe','getQuestions','JscriptyQuestionReport','SessionId','eml-format','rimraf','zip-dir','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x4e5482,_0x102734){var _0x5856b4=function(_0x1d9a0e){while(--_0x1d9a0e){_0x4e5482['push'](_0x4e5482['shift']());}};_0x5856b4(++_0x102734);}(_0x328f,0xb8));var _0xf328=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0x328f[_0x31172e];return _0x414ada;};'use strict';var emlformat=require(_0xf328('0x0'));var rimraf=require(_0xf328('0x1'));var zipdir=require(_0xf328('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf328('0x3'));var moment=require(_0xf328('0x4'));var BPromise=require(_0xf328('0x5'));var Mustache=require(_0xf328('0x6'));var util=require(_0xf328('0x7'));var path=require(_0xf328('0x8'));var sox=require(_0xf328('0x9'));var csv=require(_0xf328('0xa'));var ejs=require(_0xf328('0xb'));var fs=require('fs');var fs_extra=require(_0xf328('0xc'));var _=require(_0xf328('0xd'));var squel=require(_0xf328('0xe'));var crypto=require(_0xf328('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf328('0x10'));var toCsv=require(_0xf328('0xa'));var querystring=require(_0xf328('0x11'));var Papa=require(_0xf328('0x12'));var Redis=require(_0xf328('0x13'));var authService=require(_0xf328('0x14'));var qs=require(_0xf328('0x15'));var as=require(_0xf328('0x16'));var hardwareService=require(_0xf328('0x17'));var logger=require(_0xf328('0x18'))(_0xf328('0x19'));var utils=require(_0xf328('0x1a'));var config=require(_0xf328('0x1b'));var licenseUtil=require(_0xf328('0x1c'));var db=require(_0xf328('0x1d'))['db'];function respondWithStatusCode(_0xaea014,_0x2d79f2){_0x2d79f2=_0x2d79f2||0xcc;return function(_0x4b34a1){if(_0x4b34a1){return _0xaea014[_0xf328('0x1e')](_0x2d79f2);}return _0xaea014[_0xf328('0x1f')](_0x2d79f2)['end']();};}function respondWithResult(_0x26cffa,_0x57dd40){_0x57dd40=_0x57dd40||0xc8;return function(_0x573b9f){if(_0x573b9f){return _0x26cffa[_0xf328('0x1f')](_0x57dd40)[_0xf328('0x20')](_0x573b9f);}};}function respondWithFilteredResult(_0x1c084a,_0x14f8c0){return function(_0x37d650){if(_0x37d650){var _0x3d846f=typeof _0x14f8c0['offset']===_0xf328('0x21')&&typeof _0x14f8c0[_0xf328('0x22')]===_0xf328('0x21');var _0x33db5b=_0x37d650[_0xf328('0x23')];var _0x21c971=_0x3d846f?0x0:_0x14f8c0[_0xf328('0x24')];var _0x200cbb=_0x3d846f?_0x37d650[_0xf328('0x23')]:_0x14f8c0[_0xf328('0x24')]+_0x14f8c0[_0xf328('0x22')];var _0x26b21c;if(_0x200cbb>=_0x33db5b){_0x200cbb=_0x33db5b;_0x26b21c=0xc8;}else{_0x26b21c=0xce;}_0x1c084a[_0xf328('0x1f')](_0x26b21c);return _0x1c084a[_0xf328('0x25')](_0xf328('0x26'),_0x21c971+'-'+_0x200cbb+'/'+_0x33db5b)[_0xf328('0x20')](_0x37d650);}return null;};}function patchUpdates(_0x38c72b){return function(_0x23d446){try{jsonpatch[_0xf328('0x27')](_0x23d446,_0x38c72b,!![]);}catch(_0x2bbf2a){return BPromise['reject'](_0x2bbf2a);}return _0x23d446[_0xf328('0x28')]();};}function saveUpdates(_0x328bdc,_0x118e9c){return function(_0x37a508){if(_0x37a508){return _0x37a508['update'](_0x328bdc)[_0xf328('0x29')](function(_0x27e826){return _0x27e826;});}return null;};}function removeEntity(_0x217bc5,_0x15d456){return function(_0x1b2c94){if(_0x1b2c94){return _0x1b2c94['destroy']()[_0xf328('0x29')](function(){_0x217bc5[_0xf328('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54699f,_0x31a58a){return function(_0x2c95fd){if(!_0x2c95fd){_0x54699f[_0xf328('0x1e')](0x194);}return _0x2c95fd;};}function handleError(_0x1fc422,_0x4aad9d){_0x4aad9d=_0x4aad9d||0x1f4;return function(_0x407a8e){logger[_0xf328('0x2a')](_0x407a8e[_0xf328('0x2b')]);if(_0x407a8e['name']){delete _0x407a8e[_0xf328('0x2c')];}_0x1fc422[_0xf328('0x1f')](_0x4aad9d)['send'](_0x407a8e);};}exports[_0xf328('0x2d')]=function(_0x535370,_0x359513){var _0x220384={},_0x39c739={},_0x1ff482={'count':0x0,'rows':[]};var _0x5e8edd=_[_0xf328('0x2e')](db['JscriptySessionReport'][_0xf328('0x2f')],function(_0x3f880c){return{'name':_0x3f880c[_0xf328('0x30')],'type':_0x3f880c[_0xf328('0x31')][_0xf328('0x32')]};});_0x39c739['model']=_[_0xf328('0x2e')](_0x5e8edd,_0xf328('0x2c'));_0x39c739[_0xf328('0x33')]=_[_0xf328('0x34')](_0x535370[_0xf328('0x33')]);_0x39c739[_0xf328('0x35')]=_[_0xf328('0x36')](_0x39c739[_0xf328('0x37')],_0x39c739[_0xf328('0x33')]);_0x220384[_0xf328('0x38')]=_[_0xf328('0x36')](_0x39c739[_0xf328('0x37')],qs[_0xf328('0x39')](_0x535370[_0xf328('0x33')][_0xf328('0x39')]));_0x220384['attributes']=_0x220384[_0xf328('0x38')][_0xf328('0x3a')]?_0x220384[_0xf328('0x38')]:_0x39c739['model'];if(!_0x535370[_0xf328('0x33')][_0xf328('0x3b')](_0xf328('0x3c'))){_0x220384['limit']=qs[_0xf328('0x22')](_0x535370[_0xf328('0x33')][_0xf328('0x22')]);_0x220384[_0xf328('0x24')]=qs['offset'](_0x535370[_0xf328('0x33')][_0xf328('0x24')]);}_0x220384[_0xf328('0x3d')]=qs[_0xf328('0x3e')](_0x535370[_0xf328('0x33')][_0xf328('0x3e')]);_0x220384[_0xf328('0x3f')]=qs[_0xf328('0x35')](_[_0xf328('0x40')](_0x535370[_0xf328('0x33')],_0x39c739['filters']),_0x5e8edd);if(_0x535370[_0xf328('0x33')][_0xf328('0x41')]){_0x220384[_0xf328('0x3f')]=_[_0xf328('0x42')](_0x220384[_0xf328('0x3f')],{'$or':_[_0xf328('0x2e')](_0x5e8edd,function(_0x30fe4d){if(_0x30fe4d[_0xf328('0x31')]!==_0xf328('0x43')){var _0x38bb3d={};_0x38bb3d[_0x30fe4d[_0xf328('0x2c')]]={'$like':'%'+_0x535370[_0xf328('0x33')]['filter']+'%'};return _0x38bb3d;}})});}_0x220384=_['merge']({},_0x220384,_0x535370[_0xf328('0x44')]);var _0x303857={'where':_0x220384[_0xf328('0x3f')]};return db[_0xf328('0x45')][_0xf328('0x23')](_0x303857)['then'](function(_0x370ed8){_0x1ff482[_0xf328('0x23')]=_0x370ed8;if(_0x535370['query'][_0xf328('0x46')]){_0x220384[_0xf328('0x47')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xf328('0x48')](_0x220384);})[_0xf328('0x29')](function(_0x56c3b1){_0x1ff482[_0xf328('0x49')]=_0x56c3b1;return _0x1ff482;})['then'](respondWithFilteredResult(_0x359513,_0x220384))[_0xf328('0x4a')](handleError(_0x359513,null));};exports['show']=function(_0x47e4f5,_0x5cdf04){var _0x280a77={'raw':!![],'where':{'id':_0x47e4f5[_0xf328('0x4b')]['id']}},_0xe59b40={};_0xe59b40['model']=_['keys'](db['JscriptySessionReport'][_0xf328('0x2f')]);_0xe59b40[_0xf328('0x33')]=_[_0xf328('0x34')](_0x47e4f5[_0xf328('0x33')]);_0xe59b40[_0xf328('0x35')]=_[_0xf328('0x36')](_0xe59b40[_0xf328('0x37')],_0xe59b40[_0xf328('0x33')]);_0x280a77[_0xf328('0x38')]=_[_0xf328('0x36')](_0xe59b40['model'],qs[_0xf328('0x39')](_0x47e4f5[_0xf328('0x33')]['fields']));_0x280a77[_0xf328('0x38')]=_0x280a77['attributes'][_0xf328('0x3a')]?_0x280a77['attributes']:_0xe59b40['model'];if(_0x47e4f5[_0xf328('0x33')][_0xf328('0x46')]){_0x280a77[_0xf328('0x47')]=[{'all':!![]}];}_0x280a77=_['merge']({},_0x280a77,_0x47e4f5[_0xf328('0x44')]);return db[_0xf328('0x45')][_0xf328('0x4c')](_0x280a77)['then'](handleEntityNotFound(_0x5cdf04,null))[_0xf328('0x29')](respondWithResult(_0x5cdf04,null))[_0xf328('0x4a')](handleError(_0x5cdf04,null));};exports[_0xf328('0x4d')]=function(_0x1d8bea,_0x1ec0c6){return db[_0xf328('0x45')]['create'](_0x1d8bea['body'],{})[_0xf328('0x29')](respondWithResult(_0x1ec0c6,0xc9))[_0xf328('0x4a')](handleError(_0x1ec0c6,null));};exports['update']=function(_0x5d2e49,_0x116b44){if(_0x5d2e49['body']['id']){delete _0x5d2e49['body']['id'];}return db['JscriptySessionReport'][_0xf328('0x4c')]({'where':{'id':_0x5d2e49[_0xf328('0x4b')]['id']}})[_0xf328('0x29')](handleEntityNotFound(_0x116b44,null))['then'](saveUpdates(_0x5d2e49[_0xf328('0x4e')],null))[_0xf328('0x29')](respondWithResult(_0x116b44,null))['catch'](handleError(_0x116b44,null));};exports['destroy']=function(_0x50e9f1,_0x483842){return db[_0xf328('0x45')][_0xf328('0x4c')]({'where':{'id':_0x50e9f1[_0xf328('0x4b')]['id']}})[_0xf328('0x29')](handleEntityNotFound(_0x483842,null))[_0xf328('0x29')](removeEntity(_0x483842,null))['catch'](handleError(_0x483842,null));};exports['describe']=function(_0x3e5e63,_0x256175){return db[_0xf328('0x45')][_0xf328('0x4f')]()[_0xf328('0x29')](respondWithResult(_0x256175,null))[_0xf328('0x4a')](handleError(_0x256175,null));};exports[_0xf328('0x50')]=function(_0x4788de,_0x3a6a43,_0x2296aa){var _0x736186={'raw':!![],'where':{}};var _0x345a0e={};var _0x19d9f7={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x4788de[_0xf328('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3a6a43,null))['then'](function(_0x387ce1){if(_0x387ce1){_0x345a0e[_0xf328('0x37')]=_[_0xf328('0x34')](db[_0xf328('0x51')][_0xf328('0x2f')]);_0x345a0e['query']=_[_0xf328('0x34')](_0x4788de[_0xf328('0x33')]);_0x345a0e[_0xf328('0x35')]=_['intersection'](_0x345a0e['model'],_0x345a0e[_0xf328('0x33')]);_0x736186[_0xf328('0x38')]=_[_0xf328('0x36')](_0x345a0e[_0xf328('0x37')],qs['fields'](_0x4788de['query'][_0xf328('0x39')]));_0x736186[_0xf328('0x38')]=_0x736186[_0xf328('0x38')][_0xf328('0x3a')]?_0x736186[_0xf328('0x38')]:_0x345a0e[_0xf328('0x37')];if(!_0x4788de[_0xf328('0x33')][_0xf328('0x3b')]('nolimit')){_0x736186[_0xf328('0x22')]=qs[_0xf328('0x22')](_0x4788de[_0xf328('0x33')][_0xf328('0x22')]);_0x736186[_0xf328('0x24')]=qs[_0xf328('0x24')](_0x4788de[_0xf328('0x33')][_0xf328('0x24')]);}_0x736186['order']=qs['sort'](_0x4788de[_0xf328('0x33')][_0xf328('0x3e')]);_0x736186[_0xf328('0x3f')]=qs['filters'](_[_0xf328('0x40')](_0x4788de['query'],_0x345a0e[_0xf328('0x35')]));_0x736186[_0xf328('0x3f')][_0xf328('0x52')]=_0x387ce1['id'];if(_0x4788de[_0xf328('0x33')][_0xf328('0x41')]){_0x736186[_0xf328('0x3f')]=_['merge'](_0x736186['where'],{'$or':_['map'](_0x736186[_0xf328('0x38')],function(_0x1ca6d3){var _0xa45048={};_0xa45048[_0x1ca6d3]={'$like':'%'+_0x4788de['query']['filter']+'%'};return _0xa45048;})});}_0x736186=_['merge']({},_0x736186,_0x4788de[_0xf328('0x44')]);return db[_0xf328('0x51')][_0xf328('0x23')]({'where':_0x736186['where']})['then'](function(_0x59a458){_0x19d9f7[_0xf328('0x23')]=_0x59a458;if(_0x4788de[_0xf328('0x33')][_0xf328('0x46')]){_0x736186[_0xf328('0x47')]=[{'all':!![]}];}return db[_0xf328('0x51')][_0xf328('0x48')](_0x736186);})[_0xf328('0x29')](function(_0x16671c){_0x19d9f7[_0xf328('0x49')]=_0x16671c;return _0x19d9f7;});}})[_0xf328('0x29')](respondWithFilteredResult(_0x3a6a43,_0x736186))[_0xf328('0x4a')](handleError(_0x3a6a43,null));}; \ No newline at end of file +var _0xdcc5=['hasOwnProperty','nolimit','pick','SessionId','JscriptyQuestionReport','rows','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','status','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','attributes','fields','length','sort','where','filters','filter','merge','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','catch','show','keys','intersection','find','create','body','params','describe','findOne'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdcc5,0xa4));var _0x5dcc=function(_0x2b593d,_0x2f3e7d){_0x2b593d=_0x2b593d-0x0;var _0x19d9ad=_0xdcc5[_0x2b593d];return _0x19d9ad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dcc('0x0'));var zipdir=require(_0x5dcc('0x1'));var jsonpatch=require(_0x5dcc('0x2'));var rp=require(_0x5dcc('0x3'));var moment=require(_0x5dcc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5dcc('0x5'));var path=require('path');var sox=require(_0x5dcc('0x6'));var csv=require(_0x5dcc('0x7'));var ejs=require(_0x5dcc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5dcc('0x9'));var crypto=require(_0x5dcc('0xa'));var jsforce=require(_0x5dcc('0xb'));var deskjs=require(_0x5dcc('0xc'));var toCsv=require(_0x5dcc('0x7'));var querystring=require('querystring');var Papa=require(_0x5dcc('0xd'));var Redis=require(_0x5dcc('0xe'));var authService=require(_0x5dcc('0xf'));var qs=require(_0x5dcc('0x10'));var as=require(_0x5dcc('0x11'));var hardwareService=require(_0x5dcc('0x12'));var logger=require('../../config/logger')(_0x5dcc('0x13'));var utils=require(_0x5dcc('0x14'));var config=require(_0x5dcc('0x15'));var licenseUtil=require(_0x5dcc('0x16'));var db=require(_0x5dcc('0x17'))['db'];function respondWithStatusCode(_0x309e6c,_0x4b7568){_0x4b7568=_0x4b7568||0xcc;return function(_0x4fb17b){if(_0x4fb17b){return _0x309e6c[_0x5dcc('0x18')](_0x4b7568);}return _0x309e6c['status'](_0x4b7568)[_0x5dcc('0x19')]();};}function respondWithResult(_0x3a953c,_0x3918a1){_0x3918a1=_0x3918a1||0xc8;return function(_0x5a2c9d){if(_0x5a2c9d){return _0x3a953c['status'](_0x3918a1)['json'](_0x5a2c9d);}};}function respondWithFilteredResult(_0x1b18ff,_0x492aee){return function(_0x59bbeb){if(_0x59bbeb){var _0x1cb1d6=typeof _0x492aee[_0x5dcc('0x1a')]==='undefined'&&typeof _0x492aee['limit']===_0x5dcc('0x1b');var _0x39a04b=_0x59bbeb['count'];var _0x2d5bd1=_0x1cb1d6?0x0:_0x492aee['offset'];var _0x5d910d=_0x1cb1d6?_0x59bbeb[_0x5dcc('0x1c')]:_0x492aee[_0x5dcc('0x1a')]+_0x492aee[_0x5dcc('0x1d')];var _0x21cd12;if(_0x5d910d>=_0x39a04b){_0x5d910d=_0x39a04b;_0x21cd12=0xc8;}else{_0x21cd12=0xce;}_0x1b18ff['status'](_0x21cd12);return _0x1b18ff[_0x5dcc('0x1e')](_0x5dcc('0x1f'),_0x2d5bd1+'-'+_0x5d910d+'/'+_0x39a04b)[_0x5dcc('0x20')](_0x59bbeb);}return null;};}function patchUpdates(_0x5f5da3){return function(_0x1cb1a5){try{jsonpatch[_0x5dcc('0x21')](_0x1cb1a5,_0x5f5da3,!![]);}catch(_0x2e4a02){return BPromise[_0x5dcc('0x22')](_0x2e4a02);}return _0x1cb1a5[_0x5dcc('0x23')]();};}function saveUpdates(_0x2ce098,_0xb6b792){return function(_0x1a81d9){if(_0x1a81d9){return _0x1a81d9['update'](_0x2ce098)[_0x5dcc('0x24')](function(_0x2cd0c6){return _0x2cd0c6;});}return null;};}function removeEntity(_0x4b8859,_0x13f8f5){return function(_0x5ae5d2){if(_0x5ae5d2){return _0x5ae5d2['destroy']()['then'](function(){_0x4b8859[_0x5dcc('0x25')](0xcc)[_0x5dcc('0x19')]();});}};}function handleEntityNotFound(_0x434afa,_0x3e0921){return function(_0x463115){if(!_0x463115){_0x434afa['sendStatus'](0x194);}return _0x463115;};}function handleError(_0x1cb0e2,_0x119fb3){_0x119fb3=_0x119fb3||0x1f4;return function(_0x3c21ac){logger[_0x5dcc('0x26')](_0x3c21ac[_0x5dcc('0x27')]);if(_0x3c21ac[_0x5dcc('0x28')]){delete _0x3c21ac[_0x5dcc('0x28')];}_0x1cb0e2[_0x5dcc('0x25')](_0x119fb3)[_0x5dcc('0x29')](_0x3c21ac);};}exports[_0x5dcc('0x2a')]=function(_0x5e427e,_0x3cac69){var _0x51207e={},_0x207bd5={},_0x5ecdf9={'count':0x0,'rows':[]};var _0x1f37e6=_['map'](db['JscriptySessionReport'][_0x5dcc('0x2b')],function(_0xb756be){return{'name':_0xb756be[_0x5dcc('0x2c')],'type':_0xb756be[_0x5dcc('0x2d')]['key']};});_0x207bd5[_0x5dcc('0x2e')]=_[_0x5dcc('0x2f')](_0x1f37e6,_0x5dcc('0x28'));_0x207bd5[_0x5dcc('0x30')]=_['keys'](_0x5e427e['query']);_0x207bd5['filters']=_['intersection'](_0x207bd5['model'],_0x207bd5[_0x5dcc('0x30')]);_0x51207e[_0x5dcc('0x31')]=_['intersection'](_0x207bd5[_0x5dcc('0x2e')],qs['fields'](_0x5e427e['query'][_0x5dcc('0x32')]));_0x51207e[_0x5dcc('0x31')]=_0x51207e[_0x5dcc('0x31')][_0x5dcc('0x33')]?_0x51207e[_0x5dcc('0x31')]:_0x207bd5[_0x5dcc('0x2e')];if(!_0x5e427e[_0x5dcc('0x30')]['hasOwnProperty']('nolimit')){_0x51207e[_0x5dcc('0x1d')]=qs[_0x5dcc('0x1d')](_0x5e427e['query'][_0x5dcc('0x1d')]);_0x51207e[_0x5dcc('0x1a')]=qs[_0x5dcc('0x1a')](_0x5e427e['query'][_0x5dcc('0x1a')]);}_0x51207e['order']=qs[_0x5dcc('0x34')](_0x5e427e[_0x5dcc('0x30')][_0x5dcc('0x34')]);_0x51207e[_0x5dcc('0x35')]=qs[_0x5dcc('0x36')](_['pick'](_0x5e427e[_0x5dcc('0x30')],_0x207bd5[_0x5dcc('0x36')]),_0x1f37e6);if(_0x5e427e['query'][_0x5dcc('0x37')]){_0x51207e['where']=_[_0x5dcc('0x38')](_0x51207e[_0x5dcc('0x35')],{'$or':_[_0x5dcc('0x2f')](_0x1f37e6,function(_0x298656){if(_0x298656[_0x5dcc('0x2d')]!==_0x5dcc('0x39')){var _0x29712b={};_0x29712b[_0x298656['name']]={'$like':'%'+_0x5e427e[_0x5dcc('0x30')][_0x5dcc('0x37')]+'%'};return _0x29712b;}})});}_0x51207e=_[_0x5dcc('0x38')]({},_0x51207e,_0x5e427e[_0x5dcc('0x3a')]);var _0x4a0a19={'where':_0x51207e[_0x5dcc('0x35')]};return db[_0x5dcc('0x3b')]['count'](_0x4a0a19)[_0x5dcc('0x24')](function(_0xd06c8a){_0x5ecdf9['count']=_0xd06c8a;if(_0x5e427e[_0x5dcc('0x30')][_0x5dcc('0x3c')]){_0x51207e[_0x5dcc('0x3d')]=[{'all':!![]}];}return db[_0x5dcc('0x3b')][_0x5dcc('0x3e')](_0x51207e);})[_0x5dcc('0x24')](function(_0x1cc436){_0x5ecdf9['rows']=_0x1cc436;return _0x5ecdf9;})['then'](respondWithFilteredResult(_0x3cac69,_0x51207e))[_0x5dcc('0x3f')](handleError(_0x3cac69,null));};exports[_0x5dcc('0x40')]=function(_0x2f2f9f,_0x3f5423){var _0x1a6d9b={'raw':!![],'where':{'id':_0x2f2f9f['params']['id']}},_0x41c289={};_0x41c289[_0x5dcc('0x2e')]=_[_0x5dcc('0x41')](db[_0x5dcc('0x3b')][_0x5dcc('0x2b')]);_0x41c289[_0x5dcc('0x30')]=_['keys'](_0x2f2f9f['query']);_0x41c289[_0x5dcc('0x36')]=_[_0x5dcc('0x42')](_0x41c289[_0x5dcc('0x2e')],_0x41c289[_0x5dcc('0x30')]);_0x1a6d9b[_0x5dcc('0x31')]=_['intersection'](_0x41c289[_0x5dcc('0x2e')],qs[_0x5dcc('0x32')](_0x2f2f9f[_0x5dcc('0x30')][_0x5dcc('0x32')]));_0x1a6d9b[_0x5dcc('0x31')]=_0x1a6d9b[_0x5dcc('0x31')][_0x5dcc('0x33')]?_0x1a6d9b['attributes']:_0x41c289[_0x5dcc('0x2e')];if(_0x2f2f9f['query']['includeAll']){_0x1a6d9b['include']=[{'all':!![]}];}_0x1a6d9b=_[_0x5dcc('0x38')]({},_0x1a6d9b,_0x2f2f9f['options']);return db['JscriptySessionReport'][_0x5dcc('0x43')](_0x1a6d9b)[_0x5dcc('0x24')](handleEntityNotFound(_0x3f5423,null))[_0x5dcc('0x24')](respondWithResult(_0x3f5423,null))[_0x5dcc('0x3f')](handleError(_0x3f5423,null));};exports['create']=function(_0x492d31,_0x534730){return db[_0x5dcc('0x3b')][_0x5dcc('0x44')](_0x492d31[_0x5dcc('0x45')],{})[_0x5dcc('0x24')](respondWithResult(_0x534730,0xc9))[_0x5dcc('0x3f')](handleError(_0x534730,null));};exports['update']=function(_0x2ccc1f,_0x23d969){if(_0x2ccc1f[_0x5dcc('0x45')]['id']){delete _0x2ccc1f[_0x5dcc('0x45')]['id'];}return db[_0x5dcc('0x3b')][_0x5dcc('0x43')]({'where':{'id':_0x2ccc1f[_0x5dcc('0x46')]['id']}})[_0x5dcc('0x24')](handleEntityNotFound(_0x23d969,null))[_0x5dcc('0x24')](saveUpdates(_0x2ccc1f[_0x5dcc('0x45')],null))[_0x5dcc('0x24')](respondWithResult(_0x23d969,null))['catch'](handleError(_0x23d969,null));};exports['destroy']=function(_0x4784d3,_0x39644d){return db[_0x5dcc('0x3b')][_0x5dcc('0x43')]({'where':{'id':_0x4784d3[_0x5dcc('0x46')]['id']}})['then'](handleEntityNotFound(_0x39644d,null))[_0x5dcc('0x24')](removeEntity(_0x39644d,null))[_0x5dcc('0x3f')](handleError(_0x39644d,null));};exports[_0x5dcc('0x47')]=function(_0x3f976c,_0x8397a4){return db[_0x5dcc('0x3b')]['describe']()[_0x5dcc('0x24')](respondWithResult(_0x8397a4,null))['catch'](handleError(_0x8397a4,null));};exports['getQuestions']=function(_0x347e7a,_0x4bcdf5,_0x3722b6){var _0x197a13={'raw':!![],'where':{}};var _0x2a2ca2={};var _0x3ff0d6={'count':0x0,'rows':[]};return db[_0x5dcc('0x3b')][_0x5dcc('0x48')]({'where':{'id':_0x347e7a['params']['id']}})[_0x5dcc('0x24')](handleEntityNotFound(_0x4bcdf5,null))[_0x5dcc('0x24')](function(_0x46b7d5){if(_0x46b7d5){_0x2a2ca2[_0x5dcc('0x2e')]=_[_0x5dcc('0x41')](db['JscriptyQuestionReport']['rawAttributes']);_0x2a2ca2['query']=_[_0x5dcc('0x41')](_0x347e7a[_0x5dcc('0x30')]);_0x2a2ca2[_0x5dcc('0x36')]=_['intersection'](_0x2a2ca2[_0x5dcc('0x2e')],_0x2a2ca2['query']);_0x197a13[_0x5dcc('0x31')]=_[_0x5dcc('0x42')](_0x2a2ca2[_0x5dcc('0x2e')],qs[_0x5dcc('0x32')](_0x347e7a[_0x5dcc('0x30')]['fields']));_0x197a13['attributes']=_0x197a13[_0x5dcc('0x31')]['length']?_0x197a13['attributes']:_0x2a2ca2[_0x5dcc('0x2e')];if(!_0x347e7a[_0x5dcc('0x30')][_0x5dcc('0x49')](_0x5dcc('0x4a'))){_0x197a13['limit']=qs[_0x5dcc('0x1d')](_0x347e7a[_0x5dcc('0x30')][_0x5dcc('0x1d')]);_0x197a13['offset']=qs[_0x5dcc('0x1a')](_0x347e7a[_0x5dcc('0x30')][_0x5dcc('0x1a')]);}_0x197a13['order']=qs['sort'](_0x347e7a[_0x5dcc('0x30')][_0x5dcc('0x34')]);_0x197a13[_0x5dcc('0x35')]=qs[_0x5dcc('0x36')](_[_0x5dcc('0x4b')](_0x347e7a[_0x5dcc('0x30')],_0x2a2ca2[_0x5dcc('0x36')]));_0x197a13[_0x5dcc('0x35')][_0x5dcc('0x4c')]=_0x46b7d5['id'];if(_0x347e7a['query']['filter']){_0x197a13[_0x5dcc('0x35')]=_['merge'](_0x197a13[_0x5dcc('0x35')],{'$or':_[_0x5dcc('0x2f')](_0x197a13['attributes'],function(_0x5d6b0a){var _0x327364={};_0x327364[_0x5d6b0a]={'$like':'%'+_0x347e7a['query'][_0x5dcc('0x37')]+'%'};return _0x327364;})});}_0x197a13=_[_0x5dcc('0x38')]({},_0x197a13,_0x347e7a[_0x5dcc('0x3a')]);return db[_0x5dcc('0x4d')][_0x5dcc('0x1c')]({'where':_0x197a13[_0x5dcc('0x35')]})['then'](function(_0x547490){_0x3ff0d6[_0x5dcc('0x1c')]=_0x547490;if(_0x347e7a[_0x5dcc('0x30')]['includeAll']){_0x197a13['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x5dcc('0x3e')](_0x197a13);})[_0x5dcc('0x24')](function(_0x5966d9){_0x3ff0d6[_0x5dcc('0x4e')]=_0x5966d9;return _0x3ff0d6;});}})[_0x5dcc('0x24')](respondWithFilteredResult(_0x4bcdf5,_0x197a13))['catch'](handleError(_0x4bcdf5,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 01c0d28..5ae7776 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 _0x187d=['define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x44106b,_0x328dcf){var _0x4c423a=function(_0x343d82){while(--_0x343d82){_0x44106b['push'](_0x44106b['shift']());}};_0x4c423a(++_0x328dcf);}(_0x187d,0x93));var _0xd187=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x187d[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['path','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xafc4,0x69));var _0x4afc=function(_0x192f62,_0x166e57){_0x192f62=_0x192f62-0x0;var _0x4a2fc6=_0xafc4[_0x192f62];return _0x4a2fc6;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 70f7ed0..7dbf795 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 _0x32f4=['info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x254d9f,_0x54ddb5){var _0x1eedb9=function(_0x2d05f1){while(--_0x2d05f1){_0x254d9f['push'](_0x254d9f['shift']());}};_0x1eedb9(++_0x54ddb5);}(_0x32f4,0x154));var _0x432f=function(_0x469852,_0x532e8c){_0x469852=_0x469852-0x0;var _0xa844b9=_0x32f4[_0x469852];return _0xa844b9;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x432f('0x6'))(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b5f08,_0x2f66fd,_0x32b062){return new BPromise(function(_0x4a5b56,_0x2a2ef6){return client['request'](_0x5b5f08,_0x32b062)[_0x432f('0xb')](function(_0x340fe9){logger[_0x432f('0xc')](_0x432f('0xd'),_0x2f66fd,_0x432f('0xe'));logger['debug'](_0x432f('0xf'),_0x2f66fd,'request\x20sent',JSON[_0x432f('0x10')](_0x340fe9));if(_0x340fe9['error']){if(_0x340fe9[_0x432f('0x11')][_0x432f('0x12')]===0x1f4){logger['error'](_0x432f('0xd'),_0x2f66fd,_0x340fe9[_0x432f('0x11')]['message']);return _0x2a2ef6(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x2f66fd,_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);return _0x4a5b56(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}else{logger[_0x432f('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x2f66fd,_0x432f('0xe'));_0x4a5b56(_0x340fe9[_0x432f('0x14')][_0x432f('0x13')]);}})[_0x432f('0x15')](function(_0x5bae29){logger[_0x432f('0x11')](_0x432f('0xd'),_0x2f66fd,_0x5bae29);_0x2a2ef6(_0x5bae29);});});} \ No newline at end of file +var _0xfb11=['info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x40f46f,_0x16bba2){var _0x9d21a=function(_0x2ad948){while(--_0x2ad948){_0x40f46f['push'](_0x40f46f['shift']());}};_0x9d21a(++_0x16bba2);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfb11[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var moment=require(_0x1fb1('0x1'));var BPromise=require(_0x1fb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fb1('0x4'));var logger=require('../../config/logger')(_0x1fb1('0x5'));var config=require(_0x1fb1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1fb1('0x7')][_0x1fb1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c098d,_0x1859da,_0x2596c2){return new BPromise(function(_0x34e61a,_0x236b20){return client[_0x1fb1('0x9')](_0x4c098d,_0x2596c2)[_0x1fb1('0xa')](function(_0x438d15){logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,_0x1fb1('0xd'));logger['debug'](_0x1fb1('0xe'),_0x1859da,'request\x20sent',JSON[_0x1fb1('0xf')](_0x438d15));if(_0x438d15['error']){if(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x11')]===0x1f4){logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x236b20(_0x438d15['error'][_0x1fb1('0x12')]);}logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x34e61a(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);}else{logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,'request\x20sent');_0x34e61a(_0x438d15['result'][_0x1fb1('0x12')]);}})[_0x1fb1('0x13')](function(_0x3924ab){logger['error'](_0x1fb1('0xc'),_0x1859da,_0x3924ab);_0x236b20(_0x3924ab);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index b99c37e..dd48709 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 _0xc8c4=['multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','/:id','isAuthenticated','downloadLogFile','exports'];(function(_0x1929cd,_0x5c0cee){var _0x484f2f=function(_0x248c89){while(--_0x248c89){_0x1929cd['push'](_0x1929cd['shift']());}};_0x484f2f(++_0x5c0cee);}(_0xc8c4,0xee));var _0x4c8c=function(_0xd06a8b,_0x3ce43e){_0xd06a8b=_0xd06a8b-0x0;var _0xe9b203=_0xc8c4[_0xd06a8b];return _0xe9b203;};'use strict';var multer=require(_0x4c8c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4c8c('0x1'));var express=require('express');var router=express[_0x4c8c('0x2')]();var fs_extra=require(_0x4c8c('0x3'));var auth=require(_0x4c8c('0x4'));var interaction=require(_0x4c8c('0x5'));var config=require(_0x4c8c('0x6'));var controller=require(_0x4c8c('0x7'));router[_0x4c8c('0x8')]('/',controller[_0x4c8c('0x9')]);router['put'](_0x4c8c('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4c8c('0x8')]('/download_log_file',auth[_0x4c8c('0xb')](),controller[_0x4c8c('0xc')]);module[_0x4c8c('0xd')]=router; \ No newline at end of file +var _0x025b=['fs-extra','../../components/auth/service','../../config/environment','./license.controller','index','put','isAuthenticated','update','get','/download_log_file','downloadLogFile','exports','multer','util','connect-timeout','express','Router'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x025b,0x182));var _0xb025=function(_0x9806cc,_0x132596){_0x9806cc=_0x9806cc-0x0;var _0x1718ac=_0x025b[_0x9806cc];return _0x1718ac;};'use strict';var multer=require(_0xb025('0x0'));var util=require(_0xb025('0x1'));var path=require('path');var timeout=require(_0xb025('0x2'));var express=require(_0xb025('0x3'));var router=express[_0xb025('0x4')]();var fs_extra=require(_0xb025('0x5'));var auth=require(_0xb025('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb025('0x7'));var controller=require(_0xb025('0x8'));router['get']('/',controller[_0xb025('0x9')]);router[_0xb025('0xa')]('/:id',auth[_0xb025('0xb')](),controller[_0xb025('0xc')]);router[_0xb025('0xd')](_0xb025('0xe'),auth[_0xb025('0xb')](),controller[_0xb025('0xf')]);module[_0xb025('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 5ef4890..fc7fe4d 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 _0xf8be=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x3270e6,_0x21fae4){var _0x5374ff=function(_0x314684){while(--_0x314684){_0x3270e6['push'](_0x3270e6['shift']());}};_0x5374ff(++_0x21fae4);}(_0xf8be,0x185));var _0xef8b=function(_0x5aef23,_0x3daa94){_0x5aef23=_0x5aef23-0x0;var _0x53270f=_0xf8be[_0x5aef23];return _0x53270f;};'use strict';var Sequelize=require(_0xef8b('0x0'));module[_0xef8b('0x1')]={'license':{'type':Sequelize[_0xef8b('0x2')]},'data1':{'type':Sequelize[_0xef8b('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xef8b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x487b=['sequelize','exports','TEXT','STRING'];(function(_0x36284b,_0x2b7436){var _0x23c34a=function(_0x14f579){while(--_0x14f579){_0x36284b['push'](_0x36284b['shift']());}};_0x23c34a(++_0x2b7436);}(_0x487b,0x8c));var _0xb487=function(_0x16e727,_0x3e6a5b){_0x16e727=_0x16e727-0x0;var _0x49bd04=_0x487b[_0x16e727];return _0x49bd04;};'use strict';var Sequelize=require(_0xb487('0x0'));module[_0xb487('0x1')]={'license':{'type':Sequelize[_0xb487('0x2')]},'data1':{'type':Sequelize[_0xb487('0x3')]},'data2':{'type':Sequelize[_0xb487('0x3')]},'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 203d108..dd574f3 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 _0xa731=['to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','set','Content-Range','apply','reject','save','error','stack','name','send','../../config/license/util','index','License','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','merge','getLicense','then','catch','body','find','params','checkLicense','key','demo','downloadLogFile','join','/var','xcally','Content-disposition','Content-Type','text/plain','download','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xa731,0x17f));var _0x1a73=function(_0x4c901c,_0x39f7c2){_0x4c901c=_0x4c901c-0x0;var _0x434418=_0xa731[_0x4c901c];return _0x434418;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a73('0x0'));var zipdir=require(_0x1a73('0x1'));var jsonpatch=require(_0x1a73('0x2'));var rp=require(_0x1a73('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1a73('0x4'));var path=require(_0x1a73('0x5'));var sox=require(_0x1a73('0x6'));var csv=require(_0x1a73('0x7'));var ejs=require(_0x1a73('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1a73('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1a73('0xa'));var toCsv=require(_0x1a73('0x7'));var querystring=require(_0x1a73('0xb'));var Papa=require(_0x1a73('0xc'));var Redis=require(_0x1a73('0xd'));var authService=require(_0x1a73('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1a73('0xf'));var hardwareService=require(_0x1a73('0x10'));var logger=require('../../config/logger')(_0x1a73('0x11'));var utils=require(_0x1a73('0x12'));var config=require(_0x1a73('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1a73('0x14'))['db'];function respondWithStatusCode(_0x1ee4bd,_0x22008c){_0x22008c=_0x22008c||0xcc;return function(_0x3d9ff5){if(_0x3d9ff5){return _0x1ee4bd['sendStatus'](_0x22008c);}return _0x1ee4bd[_0x1a73('0x15')](_0x22008c)[_0x1a73('0x16')]();};}function respondWithResult(_0x5d22ff,_0x3b4cf2){_0x3b4cf2=_0x3b4cf2||0xc8;return function(_0x2af040){if(_0x2af040){return _0x5d22ff[_0x1a73('0x15')](_0x3b4cf2)[_0x1a73('0x17')](_0x2af040);}};}function respondWithFilteredResult(_0x41813f,_0x48c3ac){return function(_0x43ef3f){if(_0x43ef3f){var _0x181218=typeof _0x48c3ac['offset']===_0x1a73('0x18')&&typeof _0x48c3ac[_0x1a73('0x19')]===_0x1a73('0x18');var _0x1cd251=_0x43ef3f['count'];var _0x5f1c2d=_0x181218?0x0:_0x48c3ac['offset'];var _0x392241=_0x181218?_0x43ef3f['count']:_0x48c3ac['offset']+_0x48c3ac[_0x1a73('0x19')];var _0x38d33f;if(_0x392241>=_0x1cd251){_0x392241=_0x1cd251;_0x38d33f=0xc8;}else{_0x38d33f=0xce;}_0x41813f[_0x1a73('0x15')](_0x38d33f);return _0x41813f[_0x1a73('0x1a')](_0x1a73('0x1b'),_0x5f1c2d+'-'+_0x392241+'/'+_0x1cd251)[_0x1a73('0x17')](_0x43ef3f);}return null;};}function patchUpdates(_0x295e38){return function(_0x342c03){try{jsonpatch[_0x1a73('0x1c')](_0x342c03,_0x295e38,!![]);}catch(_0x543f0d){return BPromise[_0x1a73('0x1d')](_0x543f0d);}return _0x342c03[_0x1a73('0x1e')]();};}function saveUpdates(_0x2a6dd1,_0x3d4273){return function(_0x1037e5){if(_0x1037e5){return _0x1037e5['update'](_0x2a6dd1)['then'](function(_0x127e3f){return _0x127e3f;});}return null;};}function removeEntity(_0x335a3b,_0xa56c20){return function(_0x4d3b09){if(_0x4d3b09){return _0x4d3b09['destroy']()['then'](function(){_0x335a3b[_0x1a73('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x237b46,_0x2defdb){return function(_0x199019){if(!_0x199019){_0x237b46['sendStatus'](0x194);}return _0x199019;};}function handleError(_0x2b9303,_0x34171c){_0x34171c=_0x34171c||0x1f4;return function(_0x373f06){logger[_0x1a73('0x1f')](_0x373f06[_0x1a73('0x20')]);if(_0x373f06['name']){delete _0x373f06[_0x1a73('0x21')];}_0x2b9303[_0x1a73('0x15')](_0x34171c)[_0x1a73('0x22')](_0x373f06);};}var utilLicense=require(_0x1a73('0x23'));exports[_0x1a73('0x24')]=function(_0x36cf99,_0x47d8a5){var _0x15fc35={'raw':!![],'where':{'id':0x1}},_0x36f94d={};_0x36f94d['model']=_['keys'](db[_0x1a73('0x25')][_0x1a73('0x26')]);_0x36f94d[_0x1a73('0x27')]=_[_0x1a73('0x28')](_0x36cf99[_0x1a73('0x27')]);_0x36f94d[_0x1a73('0x29')]=_[_0x1a73('0x2a')](_0x36f94d[_0x1a73('0x2b')],_0x36f94d[_0x1a73('0x27')]);_0x15fc35[_0x1a73('0x2c')]=_[_0x1a73('0x2a')](_0x36f94d[_0x1a73('0x2b')],qs['fields'](_0x36cf99[_0x1a73('0x27')][_0x1a73('0x2d')]));_0x15fc35[_0x1a73('0x2c')]=_0x15fc35[_0x1a73('0x2c')][_0x1a73('0x2e')]?_0x15fc35[_0x1a73('0x2c')]:_0x36f94d[_0x1a73('0x2b')];_0x15fc35=_[_0x1a73('0x2f')]({},_0x15fc35,_0x36cf99['options']);return utilLicense[_0x1a73('0x30')](_0x15fc35)[_0x1a73('0x31')](respondWithResult(_0x47d8a5,null))[_0x1a73('0x32')](handleError(_0x47d8a5,null));};exports['update']=function(_0xb96278,_0x35ad88){if(_0xb96278['body']['id']){delete _0xb96278[_0x1a73('0x33')]['id'];}return db[_0x1a73('0x25')][_0x1a73('0x34')]({'where':{'id':_0xb96278[_0x1a73('0x35')]['id']}})[_0x1a73('0x31')](handleEntityNotFound(_0x35ad88,null))[_0x1a73('0x31')](function(_0x286260){var _0x55e716=_0x286260['get']({'plain':!![]});return utilLicense[_0x1a73('0x36')](_0x55e716,_0xb96278[_0x1a73('0x33')][_0x1a73('0x37')]);})['then'](function(_0x51c1f4){if(!_0x51c1f4[_0x1a73('0x38')]){return saveUpdates(_0xb96278[_0x1a73('0x33')],null);}return _0x51c1f4;})[_0x1a73('0x31')](respondWithResult(_0x35ad88,null))['catch'](handleError(_0x35ad88,null));};exports[_0x1a73('0x39')]=function(_0x563bea,_0xab667c){var _0x4b143d='license-info.log';var _0x3d1a6f=path[_0x1a73('0x3a')](_0x1a73('0x3b'),'log',_0x1a73('0x3c'),_0x4b143d);_0xab667c['setHeader'](_0x1a73('0x3d'),'attachment;\x20filename='+_0x4b143d);_0xab667c[_0x1a73('0x1a')](_0x1a73('0x3e'),_0x1a73('0x3f'));_0xab667c[_0x1a73('0x40')](_0x3d1a6f);}; \ No newline at end of file +var _0x7ac4=['status','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','model','License','keys','intersection','query','attributes','fields','length','merge','getLicense','catch','body','find','get','checkLicense','key','demo','downloadLogFile','license-info.log','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','ejs','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','sendStatus','json','offset','undefined','count','limit'];(function(_0x514b53,_0x5333da){var _0x43d5ee=function(_0x2b52e3){while(--_0x2b52e3){_0x514b53['push'](_0x514b53['shift']());}};_0x43d5ee(++_0x5333da);}(_0x7ac4,0xb6));var _0x47ac=function(_0x160cff,_0xe68fe3){_0x160cff=_0x160cff-0x0;var _0x14b4db=_0x7ac4[_0x160cff];return _0x14b4db;};'use strict';var emlformat=require(_0x47ac('0x0'));var rimraf=require(_0x47ac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47ac('0x2'));var rp=require(_0x47ac('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x47ac('0x4'));var util=require(_0x47ac('0x5'));var path=require('path');var sox=require(_0x47ac('0x6'));var csv=require('to-csv');var ejs=require(_0x47ac('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x47ac('0x8'));var crypto=require(_0x47ac('0x9'));var jsforce=require(_0x47ac('0xa'));var deskjs=require(_0x47ac('0xb'));var toCsv=require(_0x47ac('0xc'));var querystring=require(_0x47ac('0xd'));var Papa=require(_0x47ac('0xe'));var Redis=require(_0x47ac('0xf'));var authService=require(_0x47ac('0x10'));var qs=require(_0x47ac('0x11'));var as=require(_0x47ac('0x12'));var hardwareService=require(_0x47ac('0x13'));var logger=require(_0x47ac('0x14'))(_0x47ac('0x15'));var utils=require(_0x47ac('0x16'));var config=require(_0x47ac('0x17'));var licenseUtil=require(_0x47ac('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18cd16,_0x3f939b){_0x3f939b=_0x3f939b||0xcc;return function(_0x4db302){if(_0x4db302){return _0x18cd16[_0x47ac('0x19')](_0x3f939b);}return _0x18cd16['status'](_0x3f939b)['end']();};}function respondWithResult(_0x2108e8,_0x45e100){_0x45e100=_0x45e100||0xc8;return function(_0x5c969f){if(_0x5c969f){return _0x2108e8['status'](_0x45e100)[_0x47ac('0x1a')](_0x5c969f);}};}function respondWithFilteredResult(_0x386368,_0x2c6ca0){return function(_0x566625){if(_0x566625){var _0x197ff8=typeof _0x2c6ca0[_0x47ac('0x1b')]===_0x47ac('0x1c')&&typeof _0x2c6ca0['limit']===_0x47ac('0x1c');var _0x92c1cb=_0x566625['count'];var _0x7053d=_0x197ff8?0x0:_0x2c6ca0[_0x47ac('0x1b')];var _0x42541d=_0x197ff8?_0x566625[_0x47ac('0x1d')]:_0x2c6ca0['offset']+_0x2c6ca0[_0x47ac('0x1e')];var _0x421a5d;if(_0x42541d>=_0x92c1cb){_0x42541d=_0x92c1cb;_0x421a5d=0xc8;}else{_0x421a5d=0xce;}_0x386368[_0x47ac('0x1f')](_0x421a5d);return _0x386368[_0x47ac('0x20')](_0x47ac('0x21'),_0x7053d+'-'+_0x42541d+'/'+_0x92c1cb)['json'](_0x566625);}return null;};}function patchUpdates(_0x8053d1){return function(_0x51bc42){try{jsonpatch[_0x47ac('0x22')](_0x51bc42,_0x8053d1,!![]);}catch(_0x3dd44c){return BPromise[_0x47ac('0x23')](_0x3dd44c);}return _0x51bc42[_0x47ac('0x24')]();};}function saveUpdates(_0x1e4793,_0x3132d1){return function(_0x4d4c25){if(_0x4d4c25){return _0x4d4c25['update'](_0x1e4793)[_0x47ac('0x25')](function(_0x2c78c7){return _0x2c78c7;});}return null;};}function removeEntity(_0x381d3b,_0x4829e6){return function(_0x4005d9){if(_0x4005d9){return _0x4005d9[_0x47ac('0x26')]()['then'](function(){_0x381d3b[_0x47ac('0x1f')](0xcc)[_0x47ac('0x27')]();});}};}function handleEntityNotFound(_0x38097c,_0x4b2b70){return function(_0x57d388){if(!_0x57d388){_0x38097c[_0x47ac('0x19')](0x194);}return _0x57d388;};}function handleError(_0x37d9a5,_0x528805){_0x528805=_0x528805||0x1f4;return function(_0x3320df){logger['error'](_0x3320df[_0x47ac('0x28')]);if(_0x3320df[_0x47ac('0x29')]){delete _0x3320df[_0x47ac('0x29')];}_0x37d9a5[_0x47ac('0x1f')](_0x528805)[_0x47ac('0x2a')](_0x3320df);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x239b9c,_0x5daff9){var _0x40afdd={'raw':!![],'where':{'id':0x1}},_0x4aa9d3={};_0x4aa9d3[_0x47ac('0x2b')]=_['keys'](db[_0x47ac('0x2c')]['rawAttributes']);_0x4aa9d3['query']=_[_0x47ac('0x2d')](_0x239b9c['query']);_0x4aa9d3['filters']=_[_0x47ac('0x2e')](_0x4aa9d3['model'],_0x4aa9d3[_0x47ac('0x2f')]);_0x40afdd[_0x47ac('0x30')]=_[_0x47ac('0x2e')](_0x4aa9d3[_0x47ac('0x2b')],qs[_0x47ac('0x31')](_0x239b9c[_0x47ac('0x2f')]['fields']));_0x40afdd[_0x47ac('0x30')]=_0x40afdd[_0x47ac('0x30')][_0x47ac('0x32')]?_0x40afdd['attributes']:_0x4aa9d3[_0x47ac('0x2b')];_0x40afdd=_[_0x47ac('0x33')]({},_0x40afdd,_0x239b9c['options']);return utilLicense[_0x47ac('0x34')](_0x40afdd)[_0x47ac('0x25')](respondWithResult(_0x5daff9,null))[_0x47ac('0x35')](handleError(_0x5daff9,null));};exports['update']=function(_0x5f34c5,_0x4590f0){if(_0x5f34c5[_0x47ac('0x36')]['id']){delete _0x5f34c5[_0x47ac('0x36')]['id'];}return db['License'][_0x47ac('0x37')]({'where':{'id':_0x5f34c5['params']['id']}})[_0x47ac('0x25')](handleEntityNotFound(_0x4590f0,null))[_0x47ac('0x25')](function(_0x5798c8){var _0xce3b19=_0x5798c8[_0x47ac('0x38')]({'plain':!![]});return utilLicense[_0x47ac('0x39')](_0xce3b19,_0x5f34c5[_0x47ac('0x36')][_0x47ac('0x3a')]);})[_0x47ac('0x25')](function(_0x44f96d){if(!_0x44f96d[_0x47ac('0x3b')]){return saveUpdates(_0x5f34c5[_0x47ac('0x36')],null);}return _0x44f96d;})['then'](respondWithResult(_0x4590f0,null))[_0x47ac('0x35')](handleError(_0x4590f0,null));};exports[_0x47ac('0x3c')]=function(_0x351d7b,_0x4019e7){var _0x4fa50b=_0x47ac('0x3d');var _0x41bdb5=path['join'](_0x47ac('0x3e'),_0x47ac('0x3f'),_0x47ac('0x40'),_0x4fa50b);_0x4019e7[_0x47ac('0x41')](_0x47ac('0x42'),_0x47ac('0x43')+_0x4fa50b);_0x4019e7[_0x47ac('0x20')](_0x47ac('0x44'),_0x47ac('0x45'));_0x4019e7[_0x47ac('0x46')](_0x41bdb5);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 905b69c..db848c1 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 _0x490e=['./license.attributes','exports','define','license','lodash','util','../../config/logger','api','moment','path'];(function(_0xafc4ef,_0x427dae){var _0x2d48e5=function(_0x12290c){while(--_0x12290c){_0xafc4ef['push'](_0xafc4ef['shift']());}};_0x2d48e5(++_0x427dae);}(_0x490e,0x19e));var _0xe490=function(_0x1f9d1f,_0x19595b){_0x1f9d1f=_0x1f9d1f-0x0;var _0x8d6f77=_0x490e[_0x1f9d1f];return _0x8d6f77;};'use strict';var _=require(_0xe490('0x0'));var util=require(_0xe490('0x1'));var logger=require(_0xe490('0x2'))(_0xe490('0x3'));var moment=require(_0xe490('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe490('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe490('0x6'));module[_0xe490('0x7')]=function(_0x40fdc0,_0x52be5a){return _0x40fdc0[_0xe490('0x8')]('License',attributes,{'tableName':_0xe490('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf03d=['define','License','license','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0xf03d,0x13b));var _0xdf03=function(_0x1aff2d,_0x4262ac){_0x1aff2d=_0x1aff2d-0x0;var _0x9b38ce=_0xf03d[_0x1aff2d];return _0x9b38ce;};'use strict';var _=require('lodash');var util=require(_0xdf03('0x0'));var logger=require('../../config/logger')(_0xdf03('0x1'));var moment=require(_0xdf03('0x2'));var BPromise=require(_0xdf03('0x3'));var rp=require(_0xdf03('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf03('0x5'));var config=require(_0xdf03('0x6'));var attributes=require(_0xdf03('0x7'));module[_0xdf03('0x8')]=function(_0x52c27c,_0x54a8a1){return _0x52c27c[_0xdf03('0x9')](_0xdf03('0xa'),attributes,{'tableName':_0xdf03('0xb'),'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 28a595a..cd6d93e 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 _0xfb87=['debug','License,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','License,\x20%s,\x20%s','request\x20sent'];(function(_0x259e02,_0x3cb426){var _0x2f5b8e=function(_0x1fda57){while(--_0x1fda57){_0x259e02['push'](_0x259e02['shift']());}};_0x2f5b8e(++_0x3cb426);}(_0xfb87,0x156));var _0x7fb8=function(_0x53f5ec,_0x34bca9){_0x53f5ec=_0x53f5ec-0x0;var _0x4e2d6a=_0xfb87[_0x53f5ec];return _0x4e2d6a;};'use strict';var _=require(_0x7fb8('0x0'));var util=require('util');var moment=require(_0x7fb8('0x1'));var BPromise=require('bluebird');var rs=require(_0x7fb8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7fb8('0x3'))['db'];var utils=require(_0x7fb8('0x4'));var logger=require(_0x7fb8('0x5'))(_0x7fb8('0x6'));var config=require(_0x7fb8('0x7'));var jayson=require(_0x7fb8('0x8'));var client=jayson[_0x7fb8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32d82e,_0x2c791f,_0x28a001){return new BPromise(function(_0x2e5790,_0x3247a8){return client[_0x7fb8('0xa')](_0x32d82e,_0x28a001)[_0x7fb8('0xb')](function(_0x2f16b9){logger[_0x7fb8('0xc')](_0x7fb8('0xd'),_0x2c791f,_0x7fb8('0xe'));logger[_0x7fb8('0xf')](_0x7fb8('0x10'),_0x2c791f,'request\x20sent',JSON['stringify'](_0x2f16b9));if(_0x2f16b9[_0x7fb8('0x11')]){if(_0x2f16b9['error']['code']===0x1f4){logger[_0x7fb8('0x11')]('License,\x20%s,\x20%s',_0x2c791f,_0x2f16b9[_0x7fb8('0x11')][_0x7fb8('0x12')]);return _0x3247a8(_0x2f16b9[_0x7fb8('0x11')][_0x7fb8('0x12')]);}logger[_0x7fb8('0x11')]('License,\x20%s,\x20%s',_0x2c791f,_0x2f16b9['error'][_0x7fb8('0x12')]);return _0x2e5790(_0x2f16b9[_0x7fb8('0x11')][_0x7fb8('0x12')]);}else{logger[_0x7fb8('0xc')](_0x7fb8('0xd'),_0x2c791f,_0x7fb8('0xe'));_0x2e5790(_0x2f16b9[_0x7fb8('0x13')][_0x7fb8('0x12')]);}})[_0x7fb8('0x14')](function(_0x1b9a56){logger[_0x7fb8('0x11')]('License,\x20%s,\x20%s',_0x2c791f,_0x1b9a56);_0x3247a8(_0x1b9a56);});});} \ No newline at end of file +var _0x0a76=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x2ef0b9,_0x3f3c10){var _0x22c61f=function(_0x2589f0){while(--_0x2589f0){_0x2ef0b9['push'](_0x2ef0b9['shift']());}};_0x22c61f(++_0x3f3c10);}(_0x0a76,0x92));var _0x60a7=function(_0x5cb05d,_0x518c2b){_0x5cb05d=_0x5cb05d-0x0;var _0x1d77ba=_0x0a76[_0x5cb05d];return _0x1d77ba;};'use strict';var _=require(_0x60a7('0x0'));var util=require(_0x60a7('0x1'));var moment=require(_0x60a7('0x2'));var BPromise=require(_0x60a7('0x3'));var rs=require(_0x60a7('0x4'));var fs=require('fs');var Redis=require(_0x60a7('0x5'));var db=require(_0x60a7('0x6'))['db'];var utils=require(_0x60a7('0x7'));var logger=require(_0x60a7('0x8'))(_0x60a7('0x9'));var config=require(_0x60a7('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x60a7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x188d32,_0xb31c0d,_0x3a8dbd){return new BPromise(function(_0xd18f6b,_0x3ccf2c){return client[_0x60a7('0xc')](_0x188d32,_0x3a8dbd)[_0x60a7('0xd')](function(_0x4487af){logger['info'](_0x60a7('0xe'),_0xb31c0d,'request\x20sent');logger[_0x60a7('0xf')](_0x60a7('0x10'),_0xb31c0d,_0x60a7('0x11'),JSON[_0x60a7('0x12')](_0x4487af));if(_0x4487af[_0x60a7('0x13')]){if(_0x4487af[_0x60a7('0x13')][_0x60a7('0x14')]===0x1f4){logger[_0x60a7('0x13')](_0x60a7('0xe'),_0xb31c0d,_0x4487af[_0x60a7('0x13')][_0x60a7('0x15')]);return _0x3ccf2c(_0x4487af[_0x60a7('0x13')]['message']);}logger['error'](_0x60a7('0xe'),_0xb31c0d,_0x4487af[_0x60a7('0x13')][_0x60a7('0x15')]);return _0xd18f6b(_0x4487af[_0x60a7('0x13')][_0x60a7('0x15')]);}else{logger[_0x60a7('0x16')]('License,\x20%s,\x20%s',_0xb31c0d,_0x60a7('0x11'));_0xd18f6b(_0x4487af[_0x60a7('0x17')][_0x60a7('0x15')]);}})[_0x60a7('0x18')](function(_0x3020ef){logger['error'](_0x60a7('0xe'),_0xb31c0d,_0x3020ef);_0x3ccf2c(_0x3020ef);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 6f7c871..5020d9f 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 _0x7c6a=['get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','/:id/interactions','getInteractions','getApplications','/:id/verify','/:id/users','getAgents','post','create','addImap','/:id/out_servers','addSmtp','addApplications','/:id/send','send','addAgents','put','update','removeDispositions','/:id/canned_answers','removeAnswers','removeImap','removeSmtp','delete','destroy','removeAgents','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./mailAccount.controller'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0x7c6a,0x173));var _0xa7c6=function(_0x4c9389,_0x19a921){_0x4c9389=_0x4c9389-0x0;var _0x2082ef=_0x7c6a[_0x4c9389];return _0x2082ef;};'use strict';var multer=require(_0xa7c6('0x0'));var util=require(_0xa7c6('0x1'));var path=require('path');var timeout=require(_0xa7c6('0x2'));var express=require(_0xa7c6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa7c6('0x4'));var interaction=require(_0xa7c6('0x5'));var config=require('../../config/environment');var controller=require(_0xa7c6('0x6'));router[_0xa7c6('0x7')]('/',auth[_0xa7c6('0x8')](),controller[_0xa7c6('0x9')]);router['get'](_0xa7c6('0xa'),auth[_0xa7c6('0x8')](),controller[_0xa7c6('0xb')]);router[_0xa7c6('0x7')]('/:id',auth[_0xa7c6('0x8')](),controller[_0xa7c6('0xc')]);router['get'](_0xa7c6('0xd'),auth[_0xa7c6('0x8')](),controller[_0xa7c6('0xe')]);router[_0xa7c6('0x7')]('/:id/canned_answers',auth[_0xa7c6('0x8')](),controller[_0xa7c6('0xf')]);router[_0xa7c6('0x7')](_0xa7c6('0x10'),auth['isAuthenticated'](),controller['getImap']);router['get']('/:id/out_servers',auth[_0xa7c6('0x8')](),controller['getSmtp']);router['get'](_0xa7c6('0x11'),auth[_0xa7c6('0x8')](),controller[_0xa7c6('0x12')]);router['get']('/:id/applications',auth[_0xa7c6('0x8')](),controller[_0xa7c6('0x13')]);router[_0xa7c6('0x7')]('/:id/messages',auth[_0xa7c6('0x8')](),controller['getMessages']);router['get'](_0xa7c6('0x14'),auth[_0xa7c6('0x8')](),controller['verifySmtp']);router[_0xa7c6('0x7')](_0xa7c6('0x15'),auth['isAuthenticated'](),controller[_0xa7c6('0x16')]);router[_0xa7c6('0x17')](_0xa7c6('0xd'),auth[_0xa7c6('0x8')](),controller['addDisposition']);router[_0xa7c6('0x17')]('/:id/canned_answers',auth[_0xa7c6('0x8')](),controller['addAnswer']);router[_0xa7c6('0x17')]('/',auth['isAuthenticated'](),controller[_0xa7c6('0x18')]);router[_0xa7c6('0x17')](_0xa7c6('0x10'),auth[_0xa7c6('0x8')](),controller[_0xa7c6('0x19')]);router[_0xa7c6('0x17')](_0xa7c6('0x1a'),auth[_0xa7c6('0x8')](),controller[_0xa7c6('0x1b')]);router[_0xa7c6('0x17')](_0xa7c6('0x11'),auth[_0xa7c6('0x8')](),controller['addInteraction']);router[_0xa7c6('0x17')]('/:id/applications',auth['isAuthenticated'](),controller[_0xa7c6('0x1c')]);router[_0xa7c6('0x17')](_0xa7c6('0x1d'),auth[_0xa7c6('0x8')](),controller[_0xa7c6('0x1e')]);router[_0xa7c6('0x17')](_0xa7c6('0x15'),auth[_0xa7c6('0x8')](),controller[_0xa7c6('0x1f')]);router[_0xa7c6('0x20')]('/:id',auth[_0xa7c6('0x8')](),controller[_0xa7c6('0x21')]);router['delete'](_0xa7c6('0xd'),auth[_0xa7c6('0x8')](),controller[_0xa7c6('0x22')]);router['delete'](_0xa7c6('0x23'),auth['isAuthenticated'](),controller[_0xa7c6('0x24')]);router['delete']('/:id/in_servers',auth[_0xa7c6('0x8')](),controller[_0xa7c6('0x25')]);router['delete']('/:id/out_servers',auth['isAuthenticated'](),controller[_0xa7c6('0x26')]);router[_0xa7c6('0x27')]('/:id',auth[_0xa7c6('0x8')](),controller[_0xa7c6('0x28')]);router[_0xa7c6('0x27')](_0xa7c6('0x15'),auth[_0xa7c6('0x8')](),controller[_0xa7c6('0x29')]);module['exports']=router; \ No newline at end of file +var _0xc74b=['/:id','update','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','post','/:id/canned_answers','addAnswer','addImap','addSmtp','addInteraction','addApplications','/:id/send','addAgents','put'];(function(_0x567378,_0x40a94c){var _0x57b5bb=function(_0x5cbdc4){while(--_0x5cbdc4){_0x567378['push'](_0x567378['shift']());}};_0x57b5bb(++_0x40a94c);}(_0xc74b,0x190));var _0xbc74=function(_0x5dc23b,_0x3b0e29){_0x5dc23b=_0x5dc23b-0x0;var _0x398d85=_0xc74b[_0x5dc23b];return _0x398d85;};'use strict';var multer=require(_0xbc74('0x0'));var util=require(_0xbc74('0x1'));var path=require(_0xbc74('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbc74('0x3')]();var fs_extra=require(_0xbc74('0x4'));var auth=require(_0xbc74('0x5'));var interaction=require(_0xbc74('0x6'));var config=require(_0xbc74('0x7'));var controller=require('./mailAccount.controller');router[_0xbc74('0x8')]('/',auth[_0xbc74('0x9')](),controller[_0xbc74('0xa')]);router[_0xbc74('0x8')](_0xbc74('0xb'),auth['isAuthenticated'](),controller[_0xbc74('0xc')]);router[_0xbc74('0x8')]('/:id',auth[_0xbc74('0x9')](),controller[_0xbc74('0xd')]);router[_0xbc74('0x8')](_0xbc74('0xe'),auth[_0xbc74('0x9')](),controller['getDispositions']);router[_0xbc74('0x8')]('/:id/canned_answers',auth[_0xbc74('0x9')](),controller[_0xbc74('0xf')]);router[_0xbc74('0x8')](_0xbc74('0x10'),auth['isAuthenticated'](),controller[_0xbc74('0x11')]);router[_0xbc74('0x8')](_0xbc74('0x12'),auth['isAuthenticated'](),controller[_0xbc74('0x13')]);router['get'](_0xbc74('0x14'),auth['isAuthenticated'](),controller[_0xbc74('0x15')]);router[_0xbc74('0x8')](_0xbc74('0x16'),auth[_0xbc74('0x9')](),controller[_0xbc74('0x17')]);router[_0xbc74('0x8')](_0xbc74('0x18'),auth['isAuthenticated'](),controller[_0xbc74('0x19')]);router['get'](_0xbc74('0x1a'),auth[_0xbc74('0x9')](),controller[_0xbc74('0x1b')]);router[_0xbc74('0x8')](_0xbc74('0x1c'),auth[_0xbc74('0x9')](),controller[_0xbc74('0x1d')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xbc74('0x1e')]);router[_0xbc74('0x1f')](_0xbc74('0x20'),auth[_0xbc74('0x9')](),controller[_0xbc74('0x21')]);router['post']('/',auth[_0xbc74('0x9')](),controller['create']);router[_0xbc74('0x1f')]('/:id/in_servers',auth[_0xbc74('0x9')](),controller[_0xbc74('0x22')]);router['post'](_0xbc74('0x12'),auth[_0xbc74('0x9')](),controller[_0xbc74('0x23')]);router['post'](_0xbc74('0x14'),auth[_0xbc74('0x9')](),controller[_0xbc74('0x24')]);router[_0xbc74('0x1f')]('/:id/applications',auth[_0xbc74('0x9')](),controller[_0xbc74('0x25')]);router[_0xbc74('0x1f')](_0xbc74('0x26'),auth[_0xbc74('0x9')](),controller['send']);router[_0xbc74('0x1f')](_0xbc74('0x1c'),auth['isAuthenticated'](),controller[_0xbc74('0x27')]);router[_0xbc74('0x28')](_0xbc74('0x29'),auth[_0xbc74('0x9')](),controller[_0xbc74('0x2a')]);router['delete'](_0xbc74('0xe'),auth[_0xbc74('0x9')](),controller[_0xbc74('0x2b')]);router['delete'](_0xbc74('0x20'),auth[_0xbc74('0x9')](),controller[_0xbc74('0x2c')]);router['delete'](_0xbc74('0x10'),auth[_0xbc74('0x9')](),controller[_0xbc74('0x2d')]);router['delete'](_0xbc74('0x12'),auth[_0xbc74('0x9')](),controller[_0xbc74('0x2e')]);router['delete'](_0xbc74('0x29'),auth[_0xbc74('0x9')](),controller[_0xbc74('0x2f')]);router['delete'](_0xbc74('0x1c'),auth[_0xbc74('0x9')](),controller[_0xbc74('0x30')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 55d4d89..3f075d4 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 _0x337c=['yahoo','outlook365','custom','getDataValue','provider','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','hotmail'];(function(_0x16d644,_0x46545e){var _0xf808cc=function(_0x4024ef){while(--_0x4024ef){_0x16d644['push'](_0x16d644['shift']());}};_0xf808cc(++_0x46545e);}(_0x337c,0xb9));var _0xc337=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x337c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc337('0x0'));module[_0xc337('0x1')]={'description':{'type':Sequelize[_0xc337('0x2')]},'name':{'type':Sequelize[_0xc337('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xc337('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xc337('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xc337('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xc337('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xc337('0x4')]},'markAsUnread':{'type':Sequelize[_0xc337('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xc337('0x2')],'allowNull':![],'defaultValue':_0xc337('0x5')},'fontSize':{'type':Sequelize[_0xc337('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xc337('0x4')],'defaultValue':function(){return _0xc337('0x7');}},'notificationSound':{'type':Sequelize[_0xc337('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc337('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc337('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc337('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc337('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc337('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc337('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc337('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xc337('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xc337('0x3')],'defaultValue':![],'comment':_0xc337('0x9'),'set':function(_0x3575d5){if(!_0x3575d5)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xc337('0xa')](_0xc337('0xb'),_0x3575d5);}},'provider':{'type':Sequelize['ENUM']('gmail',_0xc337('0xc'),_0xc337('0xd'),_0xc337('0xe')),'defaultValue':null,'get':function(){if(!this['getDataValue']('provider'))return _0xc337('0xf');return this[_0xc337('0x10')](_0xc337('0x11'));},'set':function(_0xbbe919){if(_0xbbe919===_0xc337('0xf'))_0xbbe919=null;return this[_0xc337('0xa')](_0xc337('0x11'),_0xbbe919);}}}; \ No newline at end of file +var _0x8da5=['mandatoryDisposition','gmail','hotmail','outlook365','getDataValue','provider','custom','setDataValue','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3edb5d,_0x850915){var _0x14e109=function(_0x2f51a6){while(--_0x2f51a6){_0x3edb5d['push'](_0x3edb5d['shift']());}};_0x14e109(++_0x850915);}(_0x8da5,0x6e));var _0x58da=function(_0x17ba5e,_0x4988a8){_0x17ba5e=_0x17ba5e-0x0;var _0x11f70d=_0x8da5[_0x17ba5e];return _0x11f70d;};'use strict';var Sequelize=require(_0x58da('0x0'));module[_0x58da('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x58da('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x58da('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x58da('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x58da('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x58da('0x4')]},'markAsUnread':{'type':Sequelize[_0x58da('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x58da('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x58da('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x58da('0x4')],'defaultValue':function(){return _0x58da('0x6');}},'notificationSound':{'type':Sequelize[_0x58da('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x58da('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x58da('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x58da('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x58da('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x58da('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x58da('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x58da('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x58da('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x58da('0x3')],'defaultValue':![],'comment':_0x58da('0x8'),'set':function(_0xbb4fed){if(!_0xbb4fed)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x58da('0x9'),_0xbb4fed);}},'provider':{'type':Sequelize['ENUM'](_0x58da('0xa'),_0x58da('0xb'),'yahoo',_0x58da('0xc')),'defaultValue':null,'get':function(){if(!this[_0x58da('0xd')](_0x58da('0xe')))return'custom';return this[_0x58da('0xd')](_0x58da('0xe'));},'set':function(_0x4dd223){if(_0x4dd223===_0x58da('0xf'))_0x4dd223=null;return this[_0x58da('0x10')](_0x58da('0xe'),_0x4dd223);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 77273b8..292ae26 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 _0x254c=['addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','update','destroy','MailAccounts','UserProfileResource','stack','name','send','gmail','imap.gmail.com','yahoo','hotmail','outlook365','outlook.office365.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','MailAccount','include','findAll','rows','includeAll','merge','find','body','provider','custom','params','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','create','getDispositions','findOne','MailAccountId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','User','Owner','fullname','Tag','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','MailApplication','priority','finally','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','attach','out','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account'];(function(_0x30fffb,_0x51a19c){var _0x32ce67=function(_0x251e29){while(--_0x251e29){_0x30fffb['push'](_0x30fffb['shift']());}};_0x32ce67(++_0x51a19c);}(_0x254c,0x18d));var _0xc254=function(_0x50f777,_0xf91aa7){_0x50f777=_0x50f777-0x0;var _0x585f00=_0x254c[_0x50f777];return _0x585f00;};'use strict';var moment=require(_0xc254('0x0'));var BPromise=require(_0xc254('0x1'));var util=require(_0xc254('0x2'));var path=require(_0xc254('0x3'));var _=require(_0xc254('0x4'));var juice=require(_0xc254('0x5'));var Redis=require(_0xc254('0x6'));var qs=require(_0xc254('0x7'));var logger=require(_0xc254('0x8'))(_0xc254('0x9'));var config=require(_0xc254('0xa'));var db=require(_0xc254('0xb'))['db'];config[_0xc254('0xc')]=_[_0xc254('0xd')](config[_0xc254('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc254('0xe'))(new Redis(config['redis']));require(_0xc254('0xf'))['register'](socket);var jayson=require(_0xc254('0x10'));var client=jayson[_0xc254('0x11')][_0xc254('0x12')]({'port':0x232b});function respondWithRpcPromise(_0x2cd1c0,_0x253b85,_0x328986,_0xca6c2f){return new BPromise(function(_0x7fcff2,_0x5837b6){var _0x2c6b34=_0xca6c2f||client;return _0x2c6b34[_0xc254('0x13')](_0x2cd1c0,_0x328986)[_0xc254('0x14')](function(_0xdbdef4){logger[_0xc254('0x15')](_0xc254('0x16'),_0x253b85,_0xc254('0x17'));logger[_0xc254('0x18')](_0xc254('0x19'),_0x253b85,_0xc254('0x17'),JSON[_0xc254('0x1a')](_0xdbdef4));if(_0xdbdef4[_0xc254('0x1b')]){if(_0xdbdef4['error'][_0xc254('0x1c')]===0x1f4){logger[_0xc254('0x1b')]('MailAccount,\x20%s,\x20%s',_0x253b85,_0xdbdef4[_0xc254('0x1b')][_0xc254('0x1d')]);return _0x5837b6(_0xdbdef4[_0xc254('0x1b')][_0xc254('0x1d')]);}logger['error'](_0xc254('0x16'),_0x253b85,_0xdbdef4[_0xc254('0x1b')][_0xc254('0x1d')]);return _0x7fcff2(_0xdbdef4[_0xc254('0x1b')][_0xc254('0x1d')]);}else{logger[_0xc254('0x15')](_0xc254('0x16'),_0x253b85,_0xc254('0x17'));_0x7fcff2(_0xdbdef4[_0xc254('0x1e')][_0xc254('0x1d')]);}})[_0xc254('0x1f')](function(_0x3142c8){logger[_0xc254('0x1b')](_0xc254('0x16'),_0x253b85,_0x3142c8);_0x5837b6(_0x3142c8);});});}function respondWithStatusCode(_0x4def4c,_0x4613fa){_0x4613fa=_0x4613fa||0xcc;return function(_0x189de7){if(_0x189de7){return _0x4def4c[_0xc254('0x20')](_0x4613fa);}return _0x4def4c[_0xc254('0x21')](_0x4613fa)[_0xc254('0x22')]();};}function respondWithResult(_0x295b07,_0x22fe1a){_0x22fe1a=_0x22fe1a||0xc8;return function(_0x35f766){if(_0x35f766){return _0x295b07[_0xc254('0x21')](_0x22fe1a)[_0xc254('0x23')](_0x35f766);}};}function respondWithFilteredResult(_0xcf60e5,_0x5c02c2){return function(_0xf757d6){if(_0xf757d6){var _0x48973b=typeof _0x5c02c2['offset']===_0xc254('0x24')&&typeof _0x5c02c2[_0xc254('0x25')]===_0xc254('0x24');var _0x33c7f5=_0xf757d6[_0xc254('0x26')];var _0x7cedfc=_0x48973b?0x0:_0x5c02c2['offset'];var _0x3ee164=_0x48973b?_0xf757d6[_0xc254('0x26')]:_0x5c02c2[_0xc254('0x27')]+_0x5c02c2[_0xc254('0x25')];var _0x3d8463;if(_0x3ee164>=_0x33c7f5){_0x3ee164=_0x33c7f5;_0x3d8463=0xc8;}else{_0x3d8463=0xce;}_0xcf60e5['status'](_0x3d8463);return _0xcf60e5[_0xc254('0x28')]('Content-Range',_0x7cedfc+'-'+_0x3ee164+'/'+_0x33c7f5)[_0xc254('0x23')](_0xf757d6);}return null;};}function saveUpdates(_0x976f0f){return function(_0x5e44ba){if(_0x5e44ba){return _0x5e44ba[_0xc254('0x29')](_0x976f0f)['then'](function(_0x24247d){return _0x24247d;});}return null;};}function removeEntity(_0x3958df){return function(_0x23927b){if(_0x23927b){return _0x23927b[_0xc254('0x2a')]()[_0xc254('0x14')](function(){var _0x4069b0=_0x23927b['get']({'plain':!![]});var _0x4564bf=_0xc254('0x2b');return db[_0xc254('0x2c')][_0xc254('0x2a')]({'where':{'type':_0x4564bf,'resourceId':_0x4069b0['id']}})[_0xc254('0x14')](function(){return _0x23927b;});})[_0xc254('0x14')](function(){_0x3958df[_0xc254('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fe130){return function(_0x28f264){if(!_0x28f264){_0x4fe130[_0xc254('0x20')](0x194);}return _0x28f264;};}function handleError(_0x34c7d5,_0xaf15af){_0xaf15af=_0xaf15af||0x1f4;return function(_0x4f4d31){logger['error'](_0x4f4d31[_0xc254('0x2d')]);if(_0x4f4d31[_0xc254('0x2e')]){delete _0x4f4d31[_0xc254('0x2e')];}_0x34c7d5['status'](_0xaf15af)[_0xc254('0x2f')](_0x4f4d31);};}function getImapHost(_0x491897){switch(_0x491897){case _0xc254('0x30'):return _0xc254('0x31');case _0xc254('0x32'):return'imap.mail.yahoo.com';case _0xc254('0x33'):return'imap-mail.outlook.com';case _0xc254('0x34'):return _0xc254('0x35');}throw new Error('Unknown\x20email\x20service\x20provider',_0x491897);}function getSmtpHost(_0x840db4){switch(_0x840db4){case _0xc254('0x30'):return'smtp.gmail.com';case'yahoo':return _0xc254('0x36');case _0xc254('0x33'):return _0xc254('0x37');case _0xc254('0x34'):return'smtp.office365.com';}throw new Error(_0xc254('0x38'),_0x840db4);}function getAuthenticationOptions(_0x48ef5c,_0x2dbd74){var _0x4b75d4={};var _0xac603f={};if(_0x48ef5c){_0x4b75d4[_0xc254('0x39')]=_0xac603f[_0xc254('0x39')]=_0x2dbd74[_0xc254('0x3a')];_0x4b75d4[_0xc254('0x3b')]=_0xac603f[_0xc254('0x3c')]=_0x2dbd74['password'];if(_0x2dbd74[_0xc254('0x3d')]){_0x4b75d4[_0xc254('0x3d')]=_0xac603f[_0xc254('0x3d')]=!![];_0x4b75d4[_0xc254('0x3e')]=_0xac603f[_0xc254('0x3e')]=_0x2dbd74[_0xc254('0x3e')];_0x4b75d4[_0xc254('0x3b')]=_0xac603f[_0xc254('0x3c')]=null;}else{_0x4b75d4['CloudProviderId']=_0xac603f[_0xc254('0x3e')]=null;}_0x4b75d4[_0xc254('0x3f')]=getImapHost(_0x48ef5c);_0x4b75d4[_0xc254('0x40')]=0x3e1;_0xac603f[_0xc254('0x3f')]=getSmtpHost(_0x48ef5c);_0xac603f['port']=0x24b;_0xac603f[_0xc254('0x41')]=![];_0x4b75d4[_0xc254('0x42')]=_0xac603f[_0xc254('0x42')]=null;}else{if(_0x2dbd74[_0xc254('0x43')]){_0x4b75d4[_0xc254('0x39')]=_0xac603f[_0xc254('0x39')]=_0x2dbd74[_0xc254('0x3a')];_0x4b75d4['password']=_0xac603f['pass']=_0x2dbd74['password'];}else{_0x4b75d4[_0xc254('0x43')]=_0xac603f[_0xc254('0x43')]=![];_0x4b75d4[_0xc254('0x39')]=_0xac603f[_0xc254('0x39')]=null;_0x4b75d4['password']=_0xac603f['pass']=null;}_0x4b75d4[_0xc254('0x3f')]=_0x2dbd74[_0xc254('0x44')][_0xc254('0x3f')];_0x4b75d4['port']=_0x2dbd74[_0xc254('0x44')][_0xc254('0x40')];_0xac603f[_0xc254('0x3f')]=_0x2dbd74[_0xc254('0x45')][_0xc254('0x3f')];_0xac603f[_0xc254('0x40')]=_0x2dbd74['Smtp'][_0xc254('0x40')];}return{'Imap':_0x4b75d4,'Smtp':_0xac603f};}exports[_0xc254('0x46')]=function(_0x10a801,_0xe740f4){var _0x258ccd={'include':[{'model':db[_0xc254('0x47')],'as':_0xc254('0x44')},{'model':db[_0xc254('0x48')],'as':_0xc254('0x45')},{'model':db[_0xc254('0x49')],'as':_0xc254('0x4a')}]},_0x25f59d={},_0x4f74b9={'count':0x0,'rows':[]};var _0x3c78cb=_[_0xc254('0x4b')](db['MailAccount'][_0xc254('0x4c')],function(_0x3e8eea){return{'name':_0x3e8eea[_0xc254('0x4d')],'type':_0x3e8eea['type'][_0xc254('0x4e')]};});_0x25f59d[_0xc254('0x4f')]=_['map'](_0x3c78cb,_0xc254('0x2e'));_0x25f59d['query']=_[_0xc254('0x50')](_0x10a801['query']);_0x25f59d['filters']=_[_0xc254('0x51')](_0x25f59d[_0xc254('0x4f')],_0x25f59d[_0xc254('0x52')]);_0x258ccd['attributes']=_[_0xc254('0x51')](_0x25f59d[_0xc254('0x4f')],qs[_0xc254('0x53')](_0x10a801[_0xc254('0x52')][_0xc254('0x53')]));_0x258ccd['attributes']=_0x258ccd[_0xc254('0x54')][_0xc254('0x55')]?_0x258ccd[_0xc254('0x54')]:_0x25f59d[_0xc254('0x4f')];if(!_0x10a801[_0xc254('0x52')][_0xc254('0x56')](_0xc254('0x57'))){_0x258ccd[_0xc254('0x25')]=qs['limit'](_0x10a801['query']['limit']);_0x258ccd['offset']=qs[_0xc254('0x27')](_0x10a801[_0xc254('0x52')][_0xc254('0x27')]);}_0x258ccd[_0xc254('0x58')]=qs[_0xc254('0x59')](_0x10a801[_0xc254('0x52')][_0xc254('0x59')]);_0x258ccd[_0xc254('0x5a')]=qs[_0xc254('0x5b')](_[_0xc254('0x5c')](_0x10a801['query'],_0x25f59d[_0xc254('0x5b')]),_0x3c78cb);if(_0x10a801[_0xc254('0x52')][_0xc254('0x5d')]){_0x258ccd[_0xc254('0x5a')]=_['merge'](_0x258ccd[_0xc254('0x5a')],{'$or':_['map'](_0x3c78cb,function(_0x2c3840){if(_0x2c3840['type']!==_0xc254('0x5e')){var _0x27e384={};_0x27e384[_0x2c3840['name']]={'$like':'%'+_0x10a801['query'][_0xc254('0x5d')]+'%'};return _0x27e384;}})});}_0x258ccd=_['merge']({},_0x258ccd,_0x10a801[_0xc254('0x5f')]);var _0x19b669={'where':_0x258ccd[_0xc254('0x5a')]};return db[_0xc254('0x60')][_0xc254('0x26')](_0x19b669)[_0xc254('0x14')](function(_0xa3b36b){_0x4f74b9['count']=_0xa3b36b;if(_0x10a801[_0xc254('0x52')]['includeAll']){_0x258ccd[_0xc254('0x61')]=[{'all':!![]}];}return db[_0xc254('0x60')][_0xc254('0x62')](_0x258ccd);})[_0xc254('0x14')](function(_0x107bbe){_0x4f74b9[_0xc254('0x63')]=_0x107bbe;return _0x4f74b9;})[_0xc254('0x14')](respondWithFilteredResult(_0xe740f4,_0x258ccd))[_0xc254('0x1f')](handleError(_0xe740f4,null));};exports['show']=function(_0x8b270c,_0x268348){var _0x3e653e={'raw':![],'where':{'id':_0x8b270c['params']['id']},'include':[{'model':db[_0xc254('0x47')],'as':_0xc254('0x44')},{'model':db[_0xc254('0x48')],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4a920e={};_0x4a920e[_0xc254('0x4f')]=_[_0xc254('0x50')](db[_0xc254('0x60')][_0xc254('0x4c')]);_0x4a920e[_0xc254('0x52')]=_[_0xc254('0x50')](_0x8b270c[_0xc254('0x52')]);_0x4a920e[_0xc254('0x5b')]=_[_0xc254('0x51')](_0x4a920e[_0xc254('0x4f')],_0x4a920e[_0xc254('0x52')]);_0x3e653e['attributes']=_['intersection'](_0x4a920e['model'],qs['fields'](_0x8b270c[_0xc254('0x52')]['fields']));_0x3e653e[_0xc254('0x54')]=_0x3e653e[_0xc254('0x54')]['length']?_0x3e653e[_0xc254('0x54')]:_0x4a920e[_0xc254('0x4f')];if(_0x8b270c[_0xc254('0x52')][_0xc254('0x64')]){_0x3e653e['include']=[{'all':!![]}];}_0x3e653e=_[_0xc254('0x65')]({},_0x3e653e,_0x8b270c['options']);return db[_0xc254('0x60')][_0xc254('0x66')](_0x3e653e)[_0xc254('0x14')](handleEntityNotFound(_0x268348,null))[_0xc254('0x14')](respondWithResult(_0x268348,null))[_0xc254('0x1f')](handleError(_0x268348,null));};exports[_0xc254('0x29')]=function(_0x693ce2,_0x424076){if(_0x693ce2[_0xc254('0x67')]['id']){delete _0x693ce2[_0xc254('0x67')]['id'];}var _0x2cc0a3=_0x693ce2[_0xc254('0x67')][_0xc254('0x68')]===_0xc254('0x69')?null:_0x693ce2[_0xc254('0x67')][_0xc254('0x68')];var _0x59e5c4=_0x693ce2[_0xc254('0x67')]['Imap']||{};var _0xa98ecc=_0x693ce2[_0xc254('0x67')][_0xc254('0x45')]||{};if(_0x2cc0a3){_0x59e5c4[_0xc254('0x3f')]=getImapHost(_0x2cc0a3);_0x59e5c4[_0xc254('0x40')]=0x3e1;_0xa98ecc[_0xc254('0x3f')]=getSmtpHost(_0x2cc0a3);_0xa98ecc['port']=0x24b;_0xa98ecc[_0xc254('0x41')]=![];}if(_0xa98ecc[_0xc254('0x3d')]){_0xa98ecc[_0xc254('0x41')]=![];}else{_0xa98ecc[_0xc254('0x3e')]=null;}if(!_0x59e5c4[_0xc254('0x3d')])_0x59e5c4[_0xc254('0x3e')]=null;_0x693ce2[_0xc254('0x67')][_0xc254('0x44')]=_0x59e5c4;_0x693ce2[_0xc254('0x67')][_0xc254('0x45')]=_0xa98ecc;return db['MailAccount']['find']({'where':{'id':_0x693ce2[_0xc254('0x6a')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xc254('0x48')],'as':_0xc254('0x45')},{'model':db[_0xc254('0x49')],'as':_0xc254('0x4a')}]})[_0xc254('0x14')](handleEntityNotFound(_0x424076,null))[_0xc254('0x14')](function(_0x45c9ea){if(!_0x45c9ea)throw new Error(_0xc254('0x6b'));if(_0x45c9ea['service'])delete _0x693ce2[_0xc254('0x67')][_0xc254('0x44')];return _0x45c9ea;})[_0xc254('0x14')](saveUpdates(_0x693ce2[_0xc254('0x67')],null))[_0xc254('0x14')](function(_0x8ad442){if(!_0x693ce2[_0xc254('0x67')][_0xc254('0x44')])return _0x8ad442;return db[_0xc254('0x47')][_0xc254('0x29')](_0x693ce2[_0xc254('0x67')]['Imap'],{'where':{'MailAccountId':_0x8ad442['id']}})['then'](function(){return _0x8ad442;});})[_0xc254('0x14')](function(_0x7bffab){if(!_0x693ce2[_0xc254('0x67')]['Smtp'])return _0x7bffab;return db[_0xc254('0x48')][_0xc254('0x29')](_0x693ce2[_0xc254('0x67')][_0xc254('0x45')],{'where':{'MailAccountId':_0x7bffab['id']}})[_0xc254('0x14')](function(){return _0x7bffab;});})[_0xc254('0x14')](respondWithResult(_0x424076,null))[_0xc254('0x1f')](handleError(_0x424076,null));};exports[_0xc254('0x6c')]=function(_0x34e8ad,_0x16515d){return db[_0xc254('0x60')]['describe']()[_0xc254('0x14')](respondWithResult(_0x16515d,null))[_0xc254('0x1f')](handleError(_0x16515d,null));};exports[_0xc254('0x6d')]=function(_0x74e957,_0x4741ff){if(_0x74e957[_0xc254('0x67')]['id']){delete _0x74e957[_0xc254('0x67')]['id'];}return db[_0xc254('0x60')]['find']({'where':{'id':_0x74e957[_0xc254('0x6a')]['id']}})[_0xc254('0x14')](handleEntityNotFound(_0x4741ff,null))[_0xc254('0x14')](function(_0x15011b){if(_0x15011b){_0x74e957['body']['MailAccountId']=_0x15011b['id'];return db[_0xc254('0x6e')][_0xc254('0x6f')](_0x74e957[_0xc254('0x67')]);}})[_0xc254('0x14')](respondWithResult(_0x4741ff,null))[_0xc254('0x1f')](handleError(_0x4741ff,null));};exports[_0xc254('0x70')]=function(_0x2a73c4,_0x5ec4b5){var _0x330fd1={'raw':![],'where':{}};var _0x382964={};var _0x2d1171={'count':0x0,'rows':[]};return db[_0xc254('0x60')][_0xc254('0x71')]({'where':{'id':_0x2a73c4['params']['id']}})[_0xc254('0x14')](handleEntityNotFound(_0x5ec4b5,null))[_0xc254('0x14')](function(_0x18fec0){if(_0x18fec0){_0x382964[_0xc254('0x4f')]=_[_0xc254('0x50')](db[_0xc254('0x6e')][_0xc254('0x4c')]);_0x382964['query']=_[_0xc254('0x50')](_0x2a73c4[_0xc254('0x52')]);_0x382964[_0xc254('0x5b')]=_[_0xc254('0x51')](_0x382964['model'],_0x382964[_0xc254('0x52')]);_0x330fd1['attributes']=_[_0xc254('0x51')](_0x382964[_0xc254('0x4f')],qs['fields'](_0x2a73c4[_0xc254('0x52')][_0xc254('0x53')]));_0x330fd1[_0xc254('0x54')]=_0x330fd1[_0xc254('0x54')][_0xc254('0x55')]?_0x330fd1[_0xc254('0x54')]:_0x382964[_0xc254('0x4f')];if(!_0x2a73c4[_0xc254('0x52')][_0xc254('0x56')]('nolimit')){_0x330fd1[_0xc254('0x25')]=qs[_0xc254('0x25')](_0x2a73c4[_0xc254('0x52')][_0xc254('0x25')]);_0x330fd1[_0xc254('0x27')]=qs['offset'](_0x2a73c4[_0xc254('0x52')][_0xc254('0x27')]);}_0x330fd1[_0xc254('0x58')]=qs['sort'](_0x2a73c4[_0xc254('0x52')][_0xc254('0x59')]);_0x330fd1['where']=qs['filters'](_[_0xc254('0x5c')](_0x2a73c4[_0xc254('0x52')],_0x382964[_0xc254('0x5b')]));_0x330fd1[_0xc254('0x5a')][_0xc254('0x72')]=_0x18fec0['id'];if(_0x2a73c4['query'][_0xc254('0x5d')]){_0x330fd1[_0xc254('0x5a')]=_['merge'](_0x330fd1[_0xc254('0x5a')],{'$or':_['map'](_0x330fd1[_0xc254('0x54')],function(_0x2c609c){var _0x26b2bb={};_0x26b2bb[_0x2c609c]={'$like':'%'+_0x2a73c4['query'][_0xc254('0x5d')]+'%'};return _0x26b2bb;})});}_0x330fd1=_[_0xc254('0x65')]({},_0x330fd1,_0x2a73c4['options']);return db['Disposition'][_0xc254('0x26')]({'where':_0x330fd1['where']})[_0xc254('0x14')](function(_0x31463e){_0x2d1171[_0xc254('0x26')]=_0x31463e;if(_0x2a73c4[_0xc254('0x52')][_0xc254('0x64')]){_0x330fd1[_0xc254('0x61')]=[{'all':!![]}];}return db[_0xc254('0x6e')][_0xc254('0x62')](_0x330fd1);})['then'](function(_0x2f29dd){_0x2d1171[_0xc254('0x63')]=_0x2f29dd;return _0x2d1171;});}})['then'](respondWithFilteredResult(_0x5ec4b5,_0x330fd1))[_0xc254('0x1f')](handleError(_0x5ec4b5,null));};exports['removeDispositions']=function(_0x1dd69c,_0x5caa3d){return db[_0xc254('0x60')][_0xc254('0x66')]({'where':{'id':_0x1dd69c['params']['id']}})[_0xc254('0x14')](handleEntityNotFound(_0x5caa3d,null))[_0xc254('0x14')](function(_0x145ba5){if(_0x145ba5){return _0x145ba5[_0xc254('0x73')](_0x1dd69c[_0xc254('0x52')][_0xc254('0x74')]);}})[_0xc254('0x14')](respondWithStatusCode(_0x5caa3d,null))[_0xc254('0x1f')](handleError(_0x5caa3d,null));};exports[_0xc254('0x75')]=function(_0x1a1a01,_0xa7a716){if(_0x1a1a01[_0xc254('0x67')]['id']){delete _0x1a1a01[_0xc254('0x67')]['id'];}return db[_0xc254('0x60')]['find']({'where':{'id':_0x1a1a01[_0xc254('0x6a')]['id']}})[_0xc254('0x14')](handleEntityNotFound(_0xa7a716,null))[_0xc254('0x14')](function(_0x557f8d){if(_0x557f8d){_0x1a1a01[_0xc254('0x67')][_0xc254('0x72')]=_0x557f8d['id'];return db[_0xc254('0x76')][_0xc254('0x6f')](_0x1a1a01[_0xc254('0x67')]);}})[_0xc254('0x14')](respondWithResult(_0xa7a716,null))[_0xc254('0x1f')](handleError(_0xa7a716,null));};exports['getAnswers']=function(_0x2a6fd6,_0x5e846e){var _0x38e338={'raw':![],'where':{}};var _0x2d4a38={};var _0x29ae17={'count':0x0,'rows':[]};return db['MailAccount'][_0xc254('0x71')]({'where':{'id':_0x2a6fd6['params']['id']}})[_0xc254('0x14')](handleEntityNotFound(_0x5e846e,null))['then'](function(_0x5e622b){if(_0x5e622b){_0x2d4a38['model']=_[_0xc254('0x50')](db[_0xc254('0x76')]['rawAttributes']);_0x2d4a38[_0xc254('0x52')]=_[_0xc254('0x50')](_0x2a6fd6[_0xc254('0x52')]);_0x2d4a38[_0xc254('0x5b')]=_['intersection'](_0x2d4a38[_0xc254('0x4f')],_0x2d4a38['query']);_0x38e338[_0xc254('0x54')]=_[_0xc254('0x51')](_0x2d4a38[_0xc254('0x4f')],qs[_0xc254('0x53')](_0x2a6fd6[_0xc254('0x52')][_0xc254('0x53')]));_0x38e338[_0xc254('0x54')]=_0x38e338[_0xc254('0x54')][_0xc254('0x55')]?_0x38e338[_0xc254('0x54')]:_0x2d4a38['model'];if(!_0x2a6fd6[_0xc254('0x52')][_0xc254('0x56')]('nolimit')){_0x38e338[_0xc254('0x25')]=qs['limit'](_0x2a6fd6[_0xc254('0x52')]['limit']);_0x38e338['offset']=qs[_0xc254('0x27')](_0x2a6fd6['query'][_0xc254('0x27')]);}_0x38e338[_0xc254('0x58')]=qs[_0xc254('0x59')](_0x2a6fd6[_0xc254('0x52')]['sort']);_0x38e338[_0xc254('0x5a')]=qs[_0xc254('0x5b')](_[_0xc254('0x5c')](_0x2a6fd6[_0xc254('0x52')],_0x2d4a38[_0xc254('0x5b')]));_0x38e338[_0xc254('0x5a')][_0xc254('0x72')]=_0x5e622b['id'];if(_0x2a6fd6[_0xc254('0x52')][_0xc254('0x5d')]){_0x38e338['where']=_[_0xc254('0x65')](_0x38e338[_0xc254('0x5a')],{'$or':_[_0xc254('0x4b')](_0x38e338[_0xc254('0x54')],function(_0x22d41a){var _0x59d6bc={};_0x59d6bc[_0x22d41a]={'$like':'%'+_0x2a6fd6[_0xc254('0x52')][_0xc254('0x5d')]+'%'};return _0x59d6bc;})});}_0x38e338=_[_0xc254('0x65')]({},_0x38e338,_0x2a6fd6[_0xc254('0x5f')]);return db['CannedAnswer']['count']({'where':_0x38e338[_0xc254('0x5a')]})[_0xc254('0x14')](function(_0x8cdc05){_0x29ae17[_0xc254('0x26')]=_0x8cdc05;if(_0x2a6fd6[_0xc254('0x52')][_0xc254('0x64')]){_0x38e338[_0xc254('0x61')]=[{'all':!![]}];}return db[_0xc254('0x76')]['findAll'](_0x38e338);})[_0xc254('0x14')](function(_0xc7a5ee){_0x29ae17[_0xc254('0x63')]=_0xc7a5ee;return _0x29ae17;});}})['then'](respondWithFilteredResult(_0x5e846e,_0x38e338))[_0xc254('0x1f')](handleError(_0x5e846e,null));};exports['removeAnswers']=function(_0x45bea9,_0x4b0c43){return db[_0xc254('0x60')]['find']({'where':{'id':_0x45bea9[_0xc254('0x6a')]['id']}})[_0xc254('0x14')](handleEntityNotFound(_0x4b0c43,null))[_0xc254('0x14')](function(_0x25dfcc){if(_0x25dfcc){return _0x25dfcc[_0xc254('0x77')](_0x45bea9[_0xc254('0x52')][_0xc254('0x74')]);}})[_0xc254('0x14')](respondWithStatusCode(_0x4b0c43,null))[_0xc254('0x1f')](handleError(_0x4b0c43,null));};exports['create']=function(_0x26f859,_0x56a6f3){var _0x16a42b={'name':_0x26f859[_0xc254('0x67')]['name'],'key':_0x26f859['body'][_0xc254('0x4e')],'provider':_0x26f859['body'][_0xc254('0x68')]===_0xc254('0x69')?null:_0x26f859[_0xc254('0x67')][_0xc254('0x68')],'email':_0x26f859[_0xc254('0x67')][_0xc254('0x78')],'ListId':_0x26f859[_0xc254('0x67')][_0xc254('0x79')],'active':!_[_0xc254('0x7a')](_0x26f859[_0xc254('0x67')]['active'])?_0x26f859['body'][_0xc254('0x7b')]:!![],'description':_0x26f859[_0xc254('0x67')][_0xc254('0x7c')]||null};var _0x3cf1a6=getAuthenticationOptions(_0x16a42b[_0xc254('0x68')],_0x26f859[_0xc254('0x67')]);_0x16a42b['Imap']=_0x3cf1a6[_0xc254('0x44')];_0x16a42b[_0xc254('0x45')]=_0x3cf1a6[_0xc254('0x45')];return db[_0xc254('0x60')][_0xc254('0x6f')](_0x16a42b,{'include':[{'model':db[_0xc254('0x48')],'as':_0xc254('0x45')},{'model':db[_0xc254('0x47')],'as':'Imap'}]})['then'](function(_0x442782){var _0x352c9c=_0x26f859[_0xc254('0x39')][_0xc254('0x7d')]({'plain':!![]});if(!_0x352c9c)throw new Error(_0xc254('0x7e'));if(_0x352c9c[_0xc254('0x7f')]==='user'){var _0x329434=_0x442782[_0xc254('0x7d')]({'plain':!![]});return db[_0xc254('0x80')]['find']({'where':{'name':_0xc254('0x2b'),'userProfileId':_0x352c9c[_0xc254('0x81')]},'raw':!![]})[_0xc254('0x14')](function(_0x3afbd0){if(_0x3afbd0&&_0x3afbd0[_0xc254('0x82')]===0x0){return db[_0xc254('0x2c')][_0xc254('0x6f')]({'name':_0x329434[_0xc254('0x2e')],'resourceId':_0x329434['id'],'type':_0x3afbd0[_0xc254('0x2e')],'sectionId':_0x3afbd0['id']},{})[_0xc254('0x14')](function(){return _0x442782;});}else{return _0x442782;}})['catch'](function(_0x181668){logger[_0xc254('0x1b')](_0xc254('0x83'),_0x181668);throw _0x181668;});}return _0x442782;})[_0xc254('0x14')](respondWithResult(_0x56a6f3,0xc9))[_0xc254('0x1f')](handleError(_0x56a6f3,null));};exports[_0xc254('0x84')]=function(_0x122582,_0x41551f){return db[_0xc254('0x60')]['findOne']({'where':{'id':_0x122582['params']['id']}})[_0xc254('0x14')](handleEntityNotFound(_0x41551f,null))[_0xc254('0x14')](function(_0x1c2d87){if(_0x1c2d87){return _0x1c2d87[_0xc254('0x84')]();}return null;})[_0xc254('0x14')](respondWithResult(_0x41551f,null))[_0xc254('0x1f')](handleError(_0x41551f,null));};exports['addImap']=function(_0x108353,_0x477f27){if(_0x108353[_0xc254('0x67')]['id']){delete _0x108353[_0xc254('0x67')]['id'];}return db['MailAccount'][_0xc254('0x66')]({'where':{'id':_0x108353[_0xc254('0x6a')]['id']}})[_0xc254('0x14')](handleEntityNotFound(_0x477f27,null))[_0xc254('0x14')](function(_0x52ff48){if(_0x52ff48){_0x108353[_0xc254('0x67')]['MailAccountId']=_0x52ff48['id'];return db[_0xc254('0x47')][_0xc254('0x6f')](_0x108353['body']);}})[_0xc254('0x14')](respondWithResult(_0x477f27,null))[_0xc254('0x1f')](handleError(_0x477f27,null));};exports[_0xc254('0x85')]=function(_0x2110a2,_0x2cf40b){return db[_0xc254('0x60')][_0xc254('0x71')]({'where':{'id':_0x2110a2[_0xc254('0x6a')]['id']}})[_0xc254('0x14')](handleEntityNotFound(_0x2cf40b,null))[_0xc254('0x14')](function(_0x5995be){if(_0x5995be){return _0x5995be[_0xc254('0x86')](null);}return null;})['then'](respondWithStatusCode(_0x2cf40b,null))['catch'](handleError(_0x2cf40b,null));};exports[_0xc254('0x87')]=function(_0x121778,_0x128397){return db[_0xc254('0x60')][_0xc254('0x71')]({'where':{'id':_0x121778['params']['id']}})[_0xc254('0x14')](handleEntityNotFound(_0x128397,null))[_0xc254('0x14')](function(_0x4304b5){if(_0x4304b5){return _0x4304b5[_0xc254('0x87')]();}return null;})[_0xc254('0x14')](respondWithResult(_0x128397,null))['catch'](handleError(_0x128397,null));};exports[_0xc254('0x88')]=function(_0x1b089e,_0x20e0f0){if(_0x1b089e['body']['id']){delete _0x1b089e['body']['id'];}return db['MailAccount'][_0xc254('0x66')]({'where':{'id':_0x1b089e[_0xc254('0x6a')]['id']}})['then'](handleEntityNotFound(_0x20e0f0,null))['then'](function(_0x37bf51){if(_0x37bf51){_0x1b089e[_0xc254('0x67')]['MailAccountId']=_0x37bf51['id'];return db[_0xc254('0x48')]['create'](_0x1b089e['body']);}})[_0xc254('0x14')](respondWithResult(_0x20e0f0,null))['catch'](handleError(_0x20e0f0,null));};exports['removeSmtp']=function(_0x22d277,_0x8a9562){return db[_0xc254('0x60')][_0xc254('0x71')]({'where':{'id':_0x22d277['params']['id']}})[_0xc254('0x14')](handleEntityNotFound(_0x8a9562,null))['then'](function(_0x4596ef){if(_0x4596ef){return _0x4596ef[_0xc254('0x89')](null);}return null;})[_0xc254('0x14')](respondWithStatusCode(_0x8a9562,null))[_0xc254('0x1f')](handleError(_0x8a9562,null));};exports[_0xc254('0x8a')]=function(_0x1549c2,_0x3cfe73){return db[_0xc254('0x8b')][_0xc254('0x66')]({'where':{'id':_0x1549c2['params']['id']}})['then'](handleEntityNotFound(_0x3cfe73,null))['then'](function(_0x524342){if(_0x524342){return _0x524342['addInteraction'](_0x1549c2[_0xc254('0x67')][_0xc254('0x74')],_[_0xc254('0x8c')](_0x1549c2[_0xc254('0x67')],[_0xc254('0x74'),'id'])||{});}})[_0xc254('0x14')](respondWithResult(_0x3cfe73,null))[_0xc254('0x1f')](handleError(_0x3cfe73,null));};exports[_0xc254('0x8d')]=function(_0x41c469,_0x46fa80){var _0x3d69c3={'raw':![],'where':{}};var _0x45c2c4={};var _0x2c2b3e={'count':0x0,'rows':[]};return db[_0xc254('0x60')][_0xc254('0x71')]({'where':{'id':_0x41c469[_0xc254('0x6a')]['id']}})[_0xc254('0x14')](handleEntityNotFound(_0x46fa80,null))[_0xc254('0x14')](function(_0xecb2a){if(_0xecb2a){_0x45c2c4[_0xc254('0x4f')]=_[_0xc254('0x50')](db[_0xc254('0x8b')][_0xc254('0x4c')]);_0x45c2c4[_0xc254('0x52')]=_['keys'](_0x41c469[_0xc254('0x52')]);_0x45c2c4[_0xc254('0x5b')]=_[_0xc254('0x51')](_0x45c2c4[_0xc254('0x4f')],_0x45c2c4[_0xc254('0x52')]);_0x3d69c3['attributes']=_['intersection'](_0x45c2c4[_0xc254('0x4f')],qs[_0xc254('0x53')](_0x41c469['query'][_0xc254('0x53')]));_0x3d69c3[_0xc254('0x54')]=_0x3d69c3[_0xc254('0x54')][_0xc254('0x55')]?_0x3d69c3[_0xc254('0x54')]:_0x45c2c4['model'];if(!_0x41c469[_0xc254('0x52')]['hasOwnProperty'](_0xc254('0x57'))){_0x3d69c3[_0xc254('0x25')]=qs[_0xc254('0x25')](_0x41c469['query'][_0xc254('0x25')]);_0x3d69c3[_0xc254('0x27')]=qs[_0xc254('0x27')](_0x41c469[_0xc254('0x52')][_0xc254('0x27')]);}_0x3d69c3[_0xc254('0x58')]=qs[_0xc254('0x59')](_0x41c469[_0xc254('0x52')][_0xc254('0x59')]);_0x3d69c3[_0xc254('0x5a')]=qs[_0xc254('0x5b')](_[_0xc254('0x5c')](_0x41c469[_0xc254('0x52')],_0x45c2c4[_0xc254('0x5b')]));_0x3d69c3[_0xc254('0x5a')][_0xc254('0x72')]=_0xecb2a['id'];if(_0x41c469['query'][_0xc254('0x5d')]){_0x3d69c3[_0xc254('0x5a')]=_['merge'](_0x3d69c3['where'],{'$or':_[_0xc254('0x4b')](_0x3d69c3[_0xc254('0x54')],function(_0x525a03){var _0xa3a278={};_0xa3a278[_0x525a03]={'$like':'%'+_0x41c469[_0xc254('0x52')]['filter']+'%'};return _0xa3a278;})});}_0x3d69c3=_[_0xc254('0x65')]({},_0x3d69c3,_0x41c469[_0xc254('0x5f')]);return db[_0xc254('0x8b')][_0xc254('0x26')]({'where':_0x3d69c3[_0xc254('0x5a')]})[_0xc254('0x14')](function(_0x117bad){_0x2c2b3e['count']=_0x117bad;if(_0x41c469[_0xc254('0x52')][_0xc254('0x64')]){_0x3d69c3['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xc254('0x8e')],'as':_0xc254('0x8f'),'attributes':[_0xc254('0x2e'),_0xc254('0x90'),'internal'],'required':![]},{'model':db[_0xc254('0x91')],'as':'Tags','attributes':['id',_0xc254('0x2e'),_0xc254('0x92')],'where':_0x41c469[_0xc254('0x52')][_0xc254('0x93')]?{'id':_0x41c469['query'][_0xc254('0x93')]}:undefined,'required':_0x41c469[_0xc254('0x52')]['tag']?!![]:![]}];}return db[_0xc254('0x8b')]['findAll'](_0x3d69c3);})['then'](function(_0x89a553){_0x2c2b3e['rows']=_0x89a553;return _0x2c2b3e;});}})[_0xc254('0x14')](respondWithFilteredResult(_0x46fa80,_0x3d69c3))[_0xc254('0x1f')](handleError(_0x46fa80,null));};exports[_0xc254('0x94')]=function addApplications(_0x247d4b,_0x114cd4){var _0xd1df8b=_0x247d4b[_0xc254('0x6a')]['id'];var _0x22c729=_0x247d4b['body'];var _0x5a391c=0xc8;var _0x10c316=null;return db['sequelize'][_0xc254('0x95')]({'isolationLevel':db[_0xc254('0x96')][_0xc254('0x97')][_0xc254('0x98')]['READ_COMMITTED']},function(_0x5f362f){return db[_0xc254('0x60')]['findOne']({'where':{'id':_0xd1df8b},'transaction':_0x5f362f})[_0xc254('0x14')](function(_0xb7901){if(_0xb7901){return db[_0xc254('0x99')][_0xc254('0x2a')]({'where':{'MailAccountId':_0xd1df8b},'transaction':_0x5f362f})[_0xc254('0x14')](function(){var _0x166c1e=_['map'](_0x22c729,function(_0xf48ecd){_0xf48ecd[_0xc254('0x72')]=_0xd1df8b;return _0xf48ecd;});return db[_0xc254('0x99')]['bulkCreate'](_0x166c1e,{'transaction':_0x5f362f});});}else{_0x5a391c=0x194;_0x10c316=[];}});})[_0xc254('0x14')](function(){if(_0x5a391c!==0x194){return db[_0xc254('0x99')]['findAndCountAll']({'where':{'MailAccountId':_0xd1df8b},'order':_0xc254('0x9a')})[_0xc254('0x14')](function(_0x3d0b39){_0x10c316=_0x3d0b39;});}})['catch'](function(_0x18595d){_0x5a391c=0x1f4;logger[_0xc254('0x1b')](_0x18595d['stack']);if(_0x18595d['name']){delete _0x18595d[_0xc254('0x2e')];}_0x10c316=_0x18595d;})[_0xc254('0x9b')](function(){if(_0x10c316===null){_0x114cd4[_0xc254('0x20')](_0x5a391c);}else{if(_0x5a391c===0x1f4){_0x114cd4[_0xc254('0x21')](_0x5a391c)[_0xc254('0x2f')](_0x10c316);}else{_0x114cd4[_0xc254('0x21')](_0x5a391c)[_0xc254('0x23')](_0x10c316);}}});};exports[_0xc254('0x9c')]=function(_0x14b09,_0x1f0559){var _0x1732bd={};var _0x57cde5={};var _0x5864c5;var _0x17cbbe;return db[_0xc254('0x60')][_0xc254('0x71')]({'where':{'id':_0x14b09[_0xc254('0x6a')]['id']}})[_0xc254('0x14')](handleEntityNotFound(_0x1f0559,null))['then'](function(_0x58bb42){if(_0x58bb42){_0x5864c5=_0x58bb42;_0x57cde5[_0xc254('0x4f')]=_[_0xc254('0x50')](db['MailApplication'][_0xc254('0x4c')]);_0x57cde5[_0xc254('0x52')]=_[_0xc254('0x50')](_0x14b09[_0xc254('0x52')]);_0x57cde5['filters']=_[_0xc254('0x51')](_0x57cde5[_0xc254('0x4f')],_0x57cde5[_0xc254('0x52')]);_0x1732bd[_0xc254('0x54')]=_['intersection'](_0x57cde5['model'],qs[_0xc254('0x53')](_0x14b09[_0xc254('0x52')][_0xc254('0x53')]));_0x1732bd['attributes']=_0x1732bd[_0xc254('0x54')][_0xc254('0x55')]?_0x1732bd[_0xc254('0x54')]:_0x57cde5[_0xc254('0x4f')];_0x1732bd[_0xc254('0x58')]=qs['sort'](_0x14b09[_0xc254('0x52')][_0xc254('0x59')]);_0x1732bd[_0xc254('0x5a')]=qs[_0xc254('0x5b')](_[_0xc254('0x5c')](_0x14b09[_0xc254('0x52')],_0x57cde5[_0xc254('0x5b')]));if(_0x14b09[_0xc254('0x52')][_0xc254('0x5d')]){_0x1732bd[_0xc254('0x5a')]=_[_0xc254('0x65')](_0x1732bd[_0xc254('0x5a')],{'$or':_['map'](_0x1732bd['attributes'],function(_0x42ca10){var _0x3531b6={};_0x3531b6[_0x42ca10]={'$like':'%'+_0x14b09[_0xc254('0x52')][_0xc254('0x5d')]+'%'};return _0x3531b6;})});}_0x1732bd=_['merge']({},_0x1732bd,_0x14b09[_0xc254('0x5f')]);return _0x5864c5[_0xc254('0x9c')](_0x1732bd);}})[_0xc254('0x14')](function(_0x5b354a){if(_0x5b354a){_0x17cbbe=_0x5b354a['length'];if(!_0x14b09[_0xc254('0x52')]['hasOwnProperty']('nolimit')){_0x1732bd[_0xc254('0x25')]=qs[_0xc254('0x25')](_0x14b09[_0xc254('0x52')][_0xc254('0x25')]);_0x1732bd[_0xc254('0x27')]=qs['offset'](_0x14b09[_0xc254('0x52')]['offset']);}return _0x5864c5[_0xc254('0x9c')](_0x1732bd);}})[_0xc254('0x14')](function(_0xa251e7){if(_0xa251e7){return _0xa251e7?{'count':_0x17cbbe,'rows':_0xa251e7}:null;}})[_0xc254('0x14')](respondWithResult(_0x1f0559,null))[_0xc254('0x1f')](handleError(_0x1f0559,null));};exports['getMessages']=function(_0x18e3e9,_0x3267f3){var _0x2510ee={'raw':!![],'where':{}};var _0x343bca={};var _0x3cd6f6={'count':0x0,'rows':[]};return db[_0xc254('0x60')][_0xc254('0x71')]({'where':{'id':_0x18e3e9[_0xc254('0x6a')]['id']}})[_0xc254('0x14')](handleEntityNotFound(_0x3267f3,null))[_0xc254('0x14')](function(_0x5b243e){if(_0x5b243e){_0x343bca['model']=_[_0xc254('0x50')](db[_0xc254('0x9d')]['rawAttributes']);_0x343bca[_0xc254('0x52')]=_['keys'](_0x18e3e9['query']);_0x343bca['filters']=_[_0xc254('0x51')](_0x343bca['model'],_0x343bca[_0xc254('0x52')]);_0x2510ee['attributes']=_[_0xc254('0x51')](_0x343bca[_0xc254('0x4f')],qs['fields'](_0x18e3e9[_0xc254('0x52')]['fields']));_0x2510ee[_0xc254('0x54')]=_0x2510ee[_0xc254('0x54')]['length']?_0x2510ee[_0xc254('0x54')]:_0x343bca[_0xc254('0x4f')];if(!_0x18e3e9[_0xc254('0x52')][_0xc254('0x56')](_0xc254('0x57'))){_0x2510ee['limit']=qs[_0xc254('0x25')](_0x18e3e9[_0xc254('0x52')][_0xc254('0x25')]);_0x2510ee['offset']=qs[_0xc254('0x27')](_0x18e3e9[_0xc254('0x52')][_0xc254('0x27')]);}_0x2510ee[_0xc254('0x58')]=qs[_0xc254('0x59')](_0x18e3e9[_0xc254('0x52')][_0xc254('0x59')]);_0x2510ee[_0xc254('0x5a')]=qs[_0xc254('0x5b')](_[_0xc254('0x5c')](_0x18e3e9['query'],_0x343bca[_0xc254('0x5b')]));_0x2510ee[_0xc254('0x5a')]['MailAccountId']=_0x5b243e['id'];if(_0x18e3e9['query'][_0xc254('0x5d')]){_0x2510ee['where']=_[_0xc254('0x65')](_0x2510ee['where'],{'$or':_[_0xc254('0x4b')](_0x2510ee[_0xc254('0x54')],function(_0x92a086){var _0x338f47={};_0x338f47[_0x92a086]={'$like':'%'+_0x18e3e9[_0xc254('0x52')][_0xc254('0x5d')]+'%'};return _0x338f47;})});}if(_0x18e3e9[_0xc254('0x52')]['$gte']){var _0x189b6b=_0x18e3e9[_0xc254('0x52')][_0xc254('0x9e')][_0xc254('0x9f')](',');var _0x3d4880={};_0x3d4880[_0x189b6b[0x0]]={'$gte':moment(_0x189b6b[0x1])[_0xc254('0xa0')](_0xc254('0xa1'))};_0x2510ee[_0xc254('0x5a')]=_[_0xc254('0x65')](_0x2510ee[_0xc254('0x5a')],_0x3d4880);}_0x2510ee=_[_0xc254('0x65')]({},_0x2510ee,_0x18e3e9[_0xc254('0x5f')]);return db[_0xc254('0x9d')]['count']({'where':_0x2510ee[_0xc254('0x5a')]})[_0xc254('0x14')](function(_0x3b1998){_0x3cd6f6['count']=_0x3b1998;if(_0x18e3e9[_0xc254('0x52')][_0xc254('0x64')]){_0x2510ee[_0xc254('0x61')]=[{'all':!![]}];}return db['MailMessage'][_0xc254('0x62')](_0x2510ee);})[_0xc254('0x14')](function(_0x1ca16a){if(_0x18e3e9[_0xc254('0x52')][_0xc254('0xa2')]===_0xc254('0xa3')){for(var _0x5436fa=0x0;_0x5436fa<_0x1ca16a[_0xc254('0x55')];_0x5436fa++){_0x1ca16a[_0x5436fa][_0xc254('0x67')]=juice(_0x1ca16a[_0x5436fa][_0xc254('0x67')]);}}_0x3cd6f6[_0xc254('0x63')]=_0x1ca16a;return _0x3cd6f6;});}})[_0xc254('0x14')](respondWithFilteredResult(_0x3267f3,_0x2510ee))[_0xc254('0x1f')](handleError(_0x3267f3,null));};exports[_0xc254('0x2f')]=function(_0x58f5f3,_0x389866){var _0x159c71,_0x1187a5={},_0x3d7cab;if(_0x58f5f3[_0xc254('0x67')]['to']){_0x3d7cab=_0x58f5f3[_0xc254('0x67')]['to']['split'](',')[0x0];}return db[_0xc254('0x60')]['find']({'where':{'id':_0x58f5f3[_0xc254('0x6a')]['id']},'include':[{'model':db[_0xc254('0xa4')],'as':_0xc254('0xa5'),'include':[{'model':db[_0xc254('0xa6')],'as':_0xc254('0xa7'),'where':{'email':_0x3d7cab},'limit':0x1,'order':[[_0xc254('0xa8'),_0xc254('0xa9')]]}]},{'model':db[_0xc254('0x48')],'as':_0xc254('0x45'),'raw':!![],'include':[{'model':db[_0xc254('0xaa')],'as':_0xc254('0xaa'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x389866,null))[_0xc254('0x14')](function(_0x7c96e6){if(!_0x7c96e6)return;_0x159c71=_0x7c96e6;if(!_0x7c96e6[_0xc254('0x45')])throw new Error(_0xc254('0xab'));if(_[_0xc254('0x7a')](_0x58f5f3['body'][_0xc254('0xac')])){_0x58f5f3[_0xc254('0x67')][_0xc254('0xac')]=util[_0xc254('0xa0')]('%s\x20<%s>',_0x7c96e6[_0xc254('0x2e')],_0x7c96e6[_0xc254('0x78')]||_0x7c96e6['Smtp'][_0xc254('0x39')]);}if(_0x58f5f3['body']['attachments']&&_0x58f5f3['body'][_0xc254('0xad')][_0xc254('0x55')]){for(var _0x346823=0x0;_0x346823<_0x58f5f3[_0xc254('0x67')][_0xc254('0xad')]['length'];_0x346823+=0x1){_0x58f5f3[_0xc254('0x67')][_0xc254('0xad')][_0x346823]={'filename':_0x58f5f3['body'][_0xc254('0xad')][_0x346823][_0xc254('0x2e')],'path':path['join'](config[_0xc254('0xae')],_0xc254('0xaf'),_0x58f5f3['body'][_0xc254('0xad')][_0x346823][_0xc254('0xb0')])};}}var _0x534cc2=_0x7c96e6[_0xc254('0xb1')]();return respondWithRpcPromise(_0xc254('0xb2'),_0xc254('0xb3'),{'account':_0x534cc2,'message':_0x58f5f3['body']});})[_0xc254('0x14')](function(_0x4daafe){if(!_0x4daafe)return;_0x1187a5=_0x4daafe;if(!_0x159c71[_0xc254('0xa5')])throw new Error(_0xc254('0xb4'));if(_0x159c71[_0xc254('0xa5')][_0xc254('0xa7')][_0xc254('0x55')])return _0x159c71[_0xc254('0xa5')][_0xc254('0xa7')][0x0];return db[_0xc254('0xa6')][_0xc254('0x6f')](_[_0xc254('0xd')](_0x58f5f3['body'],{'firstName':_0x58f5f3[_0xc254('0x67')]['to'],'email':_0x58f5f3[_0xc254('0x67')]['to'],'phone':_0x58f5f3[_0xc254('0x67')]['to'],'ListId':_0x159c71[_0xc254('0x79')]}));})[_0xc254('0x14')](function(_0x1d6529){if(!_0x1d6529)return;var _0x36a679={'UserId':_0x58f5f3[_0xc254('0x39')]['id'],'ContactId':_0x1d6529['id'],'MailAccountId':_0x159c71['id'],'inReplyTo':_0x1187a5[_0xc254('0xb5')],'to':_0x58f5f3[_0xc254('0x67')][_0xc254('0xac')],'cc':_0x58f5f3[_0xc254('0x67')]['cc'],'subject':_0x58f5f3[_0xc254('0x67')]['subject'],'attach':_0x58f5f3[_0xc254('0x67')][_0xc254('0xb6')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0xc254('0xa1')),'lastMsgDirection':_0xc254('0xb7'),'Messages':[_[_0xc254('0x65')](_0x58f5f3[_0xc254('0x67')],{'messageId':_0x1187a5[_0xc254('0xb5')],'sentAt':moment()[_0xc254('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x159c71['id'],'UserId':_0x58f5f3['user']['id'],'ContactId':_0x1d6529['id']})]};if(_0x58f5f3[_0xc254('0x67')]['Interaction']){_0x36a679=_[_0xc254('0x65')](_0x36a679,_0x58f5f3[_0xc254('0x67')]['Interaction']);}return db[_0xc254('0x8b')][_0xc254('0x6f')](_0x36a679,{'include':[{'model':db['MailMessage'],'as':_0xc254('0xb8')}]});})[_0xc254('0x14')](respondWithResult(_0x389866,null))['catch'](handleError(_0x389866,null));};exports[_0xc254('0xb9')]=function(_0x329dd1,_0x18325d){return db[_0xc254('0x60')][_0xc254('0x66')]({'where':{'id':_0x329dd1[_0xc254('0x6a')]['id']},'include':[{'model':db[_0xc254('0x48')],'as':_0xc254('0x45'),'raw':!![],'include':[{'model':db[_0xc254('0xaa')],'as':_0xc254('0xaa'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x18325d,null))['then'](function(_0xbe066e){if(!_0xbe066e[_0xc254('0x45')])return;var _0x257430=_0xbe066e[_0xc254('0xb1')]();return respondWithRpcPromise(_0xc254('0xba'),_0xc254('0xb9'),{'account':_0x257430});})[_0xc254('0x14')](respondWithResult(_0x18325d,null))['catch'](handleError(_0x18325d,null));};exports[_0xc254('0x2a')]=function(_0x9088ea,_0x3f0517){return db[_0xc254('0x60')][_0xc254('0x66')]({'where':{'id':_0x9088ea['params']['id']}})[_0xc254('0x14')](handleEntityNotFound(_0x3f0517,null))['then'](function(_0x128489){if(_0x128489&&_0x128489['service']){throw new db['Sequelize']['ValidationError'](_0xc254('0xbb'));}return _0x128489;})[_0xc254('0x14')](removeEntity(_0x3f0517,null))[_0xc254('0x1f')](handleError(_0x3f0517,null));};exports[_0xc254('0xbc')]=function(_0x5d616f,_0x2ad5e7){return db['MailAccount']['find']({'where':{'id':_0x5d616f[_0xc254('0x6a')]['id']}})['then'](handleEntityNotFound(_0x2ad5e7,null))['then'](function(_0x2069bd){if(_0x2069bd){return _0x2069bd[_0xc254('0xbc')](_0x5d616f[_0xc254('0x67')]['ids'],_[_0xc254('0x8c')](_0x5d616f[_0xc254('0x67')],[_0xc254('0x74'),'id'])||{})['spread'](function(_0x176de6){for(var _0x12dc14=0x0;_0x12dc14<_0x5d616f[_0xc254('0x67')][_0xc254('0x74')][_0xc254('0x55')];_0x12dc14+=0x1){socket[_0xc254('0xbd')](_0xc254('0xbe'),{'UserId':Number(_0x5d616f[_0xc254('0x67')][_0xc254('0x74')][_0x12dc14]),'MailAccountId':Number(_0x5d616f[_0xc254('0x6a')]['id'])});}return _0x176de6;});}})['then'](respondWithResult(_0x2ad5e7,null))[_0xc254('0x1f')](handleError(_0x2ad5e7,null));};exports[_0xc254('0xbf')]=function(_0x5beee4,_0x3f1bcc){return db[_0xc254('0x60')][_0xc254('0x66')]({'where':{'id':_0x5beee4[_0xc254('0x6a')]['id']}})[_0xc254('0x14')](handleEntityNotFound(_0x3f1bcc,null))[_0xc254('0x14')](function(_0x4257a8){if(_0x4257a8){return _0x4257a8[_0xc254('0xbf')](_0x5beee4[_0xc254('0x52')][_0xc254('0x74')])[_0xc254('0x14')](function(){if(_[_0xc254('0xc0')](_0x5beee4['query'][_0xc254('0x74')])){for(var _0x1b22d7=0x0;_0x1b22d7<_0x5beee4[_0xc254('0x52')]['ids'][_0xc254('0x55')];_0x1b22d7+=0x1){socket[_0xc254('0xbd')]('userMailAccount:remove',{'UserId':Number(_0x5beee4[_0xc254('0x52')][_0xc254('0x74')][_0x1b22d7]),'MailAccountId':Number(_0x5beee4[_0xc254('0x6a')]['id'])});}}else{socket[_0xc254('0xbd')](_0xc254('0xc1'),{'UserId':Number(_0x5beee4[_0xc254('0x52')][_0xc254('0x74')]),'MailAccountId':Number(_0x5beee4[_0xc254('0x6a')]['id'])});}});}})[_0xc254('0x14')](respondWithStatusCode(_0x3f1bcc,null))[_0xc254('0x1f')](handleError(_0x3f1bcc,null));};exports[_0xc254('0xc2')]=function(_0xbf51f4,_0x20fa68){var _0x21c77d={};var _0x4d7992={};var _0x51ddde;var _0x1eec7f;return db['MailAccount'][_0xc254('0x71')]({'where':{'id':_0xbf51f4[_0xc254('0x6a')]['id']}})[_0xc254('0x14')](handleEntityNotFound(_0x20fa68,null))[_0xc254('0x14')](function(_0x2e8d87){if(_0x2e8d87){_0x51ddde=_0x2e8d87;_0x4d7992[_0xc254('0x4f')]=_[_0xc254('0x50')](db[_0xc254('0x8e')][_0xc254('0x4c')]);_0x4d7992[_0xc254('0x52')]=_[_0xc254('0x50')](_0xbf51f4[_0xc254('0x52')]);_0x4d7992['filters']=_[_0xc254('0x51')](_0x4d7992[_0xc254('0x4f')],_0x4d7992['query']);_0x21c77d[_0xc254('0x54')]=_[_0xc254('0x51')](_0x4d7992[_0xc254('0x4f')],qs['fields'](_0xbf51f4[_0xc254('0x52')][_0xc254('0x53')]));_0x21c77d['attributes']=_0x21c77d['attributes']['length']?_0x21c77d[_0xc254('0x54')]:_0x4d7992[_0xc254('0x4f')];_0x21c77d[_0xc254('0x58')]=qs[_0xc254('0x59')](_0xbf51f4[_0xc254('0x52')]['sort']);_0x21c77d[_0xc254('0x5a')]=qs['filters'](_[_0xc254('0x5c')](_0xbf51f4[_0xc254('0x52')],_0x4d7992[_0xc254('0x5b')]));if(_0xbf51f4[_0xc254('0x52')][_0xc254('0x5d')]){_0x21c77d[_0xc254('0x5a')]=_['merge'](_0x21c77d[_0xc254('0x5a')],{'$or':_[_0xc254('0x4b')](_0x21c77d[_0xc254('0x54')],function(_0x17f8ab){var _0x2c1b7d={};_0x2c1b7d[_0x17f8ab]={'$like':'%'+_0xbf51f4['query'][_0xc254('0x5d')]+'%'};return _0x2c1b7d;})});}_0x21c77d=_['merge']({},_0x21c77d,_0xbf51f4['options']);return _0x51ddde[_0xc254('0xc2')](_0x21c77d);}})[_0xc254('0x14')](function(_0x1a8d01){if(_0x1a8d01){_0x1eec7f=_0x1a8d01['length'];if(!_0xbf51f4[_0xc254('0x52')][_0xc254('0x56')](_0xc254('0x57'))){_0x21c77d[_0xc254('0x25')]=qs[_0xc254('0x25')](_0xbf51f4[_0xc254('0x52')][_0xc254('0x25')]);_0x21c77d[_0xc254('0x27')]=qs['offset'](_0xbf51f4[_0xc254('0x52')]['offset']);}return _0x51ddde[_0xc254('0xc2')](_0x21c77d);}})['then'](function(_0xd9ac84){if(_0xd9ac84){return _0xd9ac84?{'count':_0x1eec7f,'rows':_0xd9ac84}:null;}})[_0xc254('0x14')](respondWithResult(_0x20fa68,null))['catch'](handleError(_0x20fa68,null));}; \ No newline at end of file +var _0xcb82=['UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','User','Tag','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','update','get','MailAccounts','destroy','stack','name','send','imap.gmail.com','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp.office365.com','user','username','pass','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','password','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','type','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','MailAccount','findAll','rows','show','model','rawAttributes','catch','provider','custom','body','find','params','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','getDispositions','order','removeDispositions','ids','addAnswer','CannedAnswer','create','findOne','hasOwnProperty','removeAnswers','key','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x2ecbfd,_0x5bacbc){var _0x2c65a2=function(_0x569338){while(--_0x569338){_0x2ecbfd['push'](_0x2ecbfd['shift']());}};_0x2c65a2(++_0x5bacbc);}(_0xcb82,0x10b));var _0x2cb8=function(_0x330305,_0x49dd5d){_0x330305=_0x330305-0x0;var _0x52c652=_0xcb82[_0x330305];return _0x52c652;};'use strict';var moment=require(_0x2cb8('0x0'));var BPromise=require(_0x2cb8('0x1'));var util=require(_0x2cb8('0x2'));var path=require(_0x2cb8('0x3'));var _=require(_0x2cb8('0x4'));var juice=require(_0x2cb8('0x5'));var Redis=require(_0x2cb8('0x6'));var qs=require(_0x2cb8('0x7'));var logger=require(_0x2cb8('0x8'))(_0x2cb8('0x9'));var config=require(_0x2cb8('0xa'));var db=require(_0x2cb8('0xb'))['db'];config[_0x2cb8('0xc')]=_[_0x2cb8('0xd')](config[_0x2cb8('0xc')],{'host':_0x2cb8('0xe'),'port':0x18eb});var socket=require(_0x2cb8('0xf'))(new Redis(config[_0x2cb8('0xc')]));require('./mailAccount.socket')[_0x2cb8('0x10')](socket);var jayson=require(_0x2cb8('0x11'));var client=jayson[_0x2cb8('0x12')][_0x2cb8('0x13')]({'port':0x232b});function respondWithRpcPromise(_0xcb8168,_0x5547e6,_0x135ffd,_0x146531){return new BPromise(function(_0x579112,_0x5a65bd){var _0x4dbf5f=_0x146531||client;return _0x4dbf5f['request'](_0xcb8168,_0x135ffd)[_0x2cb8('0x14')](function(_0x287499){logger[_0x2cb8('0x15')](_0x2cb8('0x16'),_0x5547e6,_0x2cb8('0x17'));logger[_0x2cb8('0x18')](_0x2cb8('0x19'),_0x5547e6,'request\x20sent',JSON[_0x2cb8('0x1a')](_0x287499));if(_0x287499[_0x2cb8('0x1b')]){if(_0x287499[_0x2cb8('0x1b')][_0x2cb8('0x1c')]===0x1f4){logger[_0x2cb8('0x1b')](_0x2cb8('0x16'),_0x5547e6,_0x287499[_0x2cb8('0x1b')][_0x2cb8('0x1d')]);return _0x5a65bd(_0x287499[_0x2cb8('0x1b')]['message']);}logger[_0x2cb8('0x1b')](_0x2cb8('0x16'),_0x5547e6,_0x287499['error'][_0x2cb8('0x1d')]);return _0x579112(_0x287499[_0x2cb8('0x1b')]['message']);}else{logger['info'](_0x2cb8('0x16'),_0x5547e6,'request\x20sent');_0x579112(_0x287499['result'][_0x2cb8('0x1d')]);}})['catch'](function(_0x292f0b){logger[_0x2cb8('0x1b')](_0x2cb8('0x16'),_0x5547e6,_0x292f0b);_0x5a65bd(_0x292f0b);});});}function respondWithStatusCode(_0x319a6a,_0x424091){_0x424091=_0x424091||0xcc;return function(_0x1d4027){if(_0x1d4027){return _0x319a6a[_0x2cb8('0x1e')](_0x424091);}return _0x319a6a[_0x2cb8('0x1f')](_0x424091)[_0x2cb8('0x20')]();};}function respondWithResult(_0x5a9674,_0x57d95c){_0x57d95c=_0x57d95c||0xc8;return function(_0x3f00ef){if(_0x3f00ef){return _0x5a9674[_0x2cb8('0x1f')](_0x57d95c)[_0x2cb8('0x21')](_0x3f00ef);}};}function respondWithFilteredResult(_0x1f9865,_0x4acd33){return function(_0x44c701){if(_0x44c701){var _0x3358f6=typeof _0x4acd33['offset']===_0x2cb8('0x22')&&typeof _0x4acd33[_0x2cb8('0x23')]===_0x2cb8('0x22');var _0x85dd7=_0x44c701['count'];var _0x5ef41e=_0x3358f6?0x0:_0x4acd33['offset'];var _0x3b689c=_0x3358f6?_0x44c701['count']:_0x4acd33[_0x2cb8('0x24')]+_0x4acd33['limit'];var _0x465a1b;if(_0x3b689c>=_0x85dd7){_0x3b689c=_0x85dd7;_0x465a1b=0xc8;}else{_0x465a1b=0xce;}_0x1f9865[_0x2cb8('0x1f')](_0x465a1b);return _0x1f9865[_0x2cb8('0x25')](_0x2cb8('0x26'),_0x5ef41e+'-'+_0x3b689c+'/'+_0x85dd7)[_0x2cb8('0x21')](_0x44c701);}return null;};}function saveUpdates(_0x278f97){return function(_0x37c095){if(_0x37c095){return _0x37c095[_0x2cb8('0x27')](_0x278f97)[_0x2cb8('0x14')](function(_0x59e4b5){return _0x59e4b5;});}return null;};}function removeEntity(_0x380449){return function(_0xdfa459){if(_0xdfa459){return _0xdfa459['destroy']()[_0x2cb8('0x14')](function(){var _0x970ce3=_0xdfa459[_0x2cb8('0x28')]({'plain':!![]});var _0x19a868=_0x2cb8('0x29');return db['UserProfileResource'][_0x2cb8('0x2a')]({'where':{'type':_0x19a868,'resourceId':_0x970ce3['id']}})[_0x2cb8('0x14')](function(){return _0xdfa459;});})['then'](function(){_0x380449[_0x2cb8('0x1f')](0xcc)[_0x2cb8('0x20')]();});}};}function handleEntityNotFound(_0x573ed6){return function(_0x4c64a3){if(!_0x4c64a3){_0x573ed6[_0x2cb8('0x1e')](0x194);}return _0x4c64a3;};}function handleError(_0x363119,_0x22e755){_0x22e755=_0x22e755||0x1f4;return function(_0x4f6ac8){logger[_0x2cb8('0x1b')](_0x4f6ac8[_0x2cb8('0x2b')]);if(_0x4f6ac8[_0x2cb8('0x2c')]){delete _0x4f6ac8[_0x2cb8('0x2c')];}_0x363119[_0x2cb8('0x1f')](_0x22e755)[_0x2cb8('0x2d')](_0x4f6ac8);};}function getImapHost(_0x33c25a){switch(_0x33c25a){case'gmail':return _0x2cb8('0x2e');case'yahoo':return _0x2cb8('0x2f');case'hotmail':return _0x2cb8('0x30');case _0x2cb8('0x31'):return _0x2cb8('0x32');}throw new Error(_0x2cb8('0x33'),_0x33c25a);}function getSmtpHost(_0x5322a1){switch(_0x5322a1){case _0x2cb8('0x34'):return _0x2cb8('0x35');case _0x2cb8('0x36'):return _0x2cb8('0x37');case'hotmail':return'smtp-mail.outlook.com';case _0x2cb8('0x31'):return _0x2cb8('0x38');}throw new Error('Unknown\x20email\x20service\x20provider',_0x5322a1);}function getAuthenticationOptions(_0x17b02d,_0x456917){var _0x543355={};var _0x307d06={};if(_0x17b02d){_0x543355[_0x2cb8('0x39')]=_0x307d06['user']=_0x456917[_0x2cb8('0x3a')];_0x543355['password']=_0x307d06[_0x2cb8('0x3b')]=_0x456917['password'];if(_0x456917[_0x2cb8('0x3c')]){_0x543355[_0x2cb8('0x3c')]=_0x307d06['modernAuthentication']=!![];_0x543355[_0x2cb8('0x3d')]=_0x307d06['CloudProviderId']=_0x456917[_0x2cb8('0x3d')];_0x543355['password']=_0x307d06[_0x2cb8('0x3b')]=null;}else{_0x543355[_0x2cb8('0x3d')]=_0x307d06['CloudProviderId']=null;}_0x543355['host']=getImapHost(_0x17b02d);_0x543355[_0x2cb8('0x3e')]=0x3e1;_0x307d06[_0x2cb8('0x3f')]=getSmtpHost(_0x17b02d);_0x307d06['port']=0x24b;_0x307d06[_0x2cb8('0x40')]=![];_0x543355[_0x2cb8('0x41')]=_0x307d06[_0x2cb8('0x41')]=null;}else{if(_0x456917[_0x2cb8('0x42')]){_0x543355[_0x2cb8('0x39')]=_0x307d06['user']=_0x456917[_0x2cb8('0x3a')];_0x543355[_0x2cb8('0x43')]=_0x307d06[_0x2cb8('0x3b')]=_0x456917[_0x2cb8('0x43')];}else{_0x543355[_0x2cb8('0x42')]=_0x307d06[_0x2cb8('0x42')]=![];_0x543355[_0x2cb8('0x39')]=_0x307d06[_0x2cb8('0x39')]=null;_0x543355[_0x2cb8('0x43')]=_0x307d06[_0x2cb8('0x3b')]=null;}_0x543355['host']=_0x456917[_0x2cb8('0x44')][_0x2cb8('0x3f')];_0x543355[_0x2cb8('0x3e')]=_0x456917[_0x2cb8('0x44')][_0x2cb8('0x3e')];_0x307d06[_0x2cb8('0x3f')]=_0x456917[_0x2cb8('0x45')]['host'];_0x307d06[_0x2cb8('0x3e')]=_0x456917[_0x2cb8('0x45')]['port'];}return{'Imap':_0x543355,'Smtp':_0x307d06};}exports[_0x2cb8('0x46')]=function(_0x953cb2,_0x28fc56){var _0x2826f7={'include':[{'model':db[_0x2cb8('0x47')],'as':_0x2cb8('0x44')},{'model':db[_0x2cb8('0x48')],'as':_0x2cb8('0x45')},{'model':db[_0x2cb8('0x49')],'as':_0x2cb8('0x4a')}]},_0x4c821f={},_0x155b4a={'count':0x0,'rows':[]};var _0x1a965a=_[_0x2cb8('0x4b')](db['MailAccount']['rawAttributes'],function(_0x36058e){return{'name':_0x36058e['fieldName'],'type':_0x36058e[_0x2cb8('0x4c')]['key']};});_0x4c821f['model']=_[_0x2cb8('0x4b')](_0x1a965a,_0x2cb8('0x2c'));_0x4c821f[_0x2cb8('0x4d')]=_[_0x2cb8('0x4e')](_0x953cb2[_0x2cb8('0x4d')]);_0x4c821f[_0x2cb8('0x4f')]=_[_0x2cb8('0x50')](_0x4c821f['model'],_0x4c821f[_0x2cb8('0x4d')]);_0x2826f7['attributes']=_['intersection'](_0x4c821f['model'],qs[_0x2cb8('0x51')](_0x953cb2['query'][_0x2cb8('0x51')]));_0x2826f7['attributes']=_0x2826f7[_0x2cb8('0x52')][_0x2cb8('0x53')]?_0x2826f7['attributes']:_0x4c821f['model'];if(!_0x953cb2[_0x2cb8('0x4d')]['hasOwnProperty'](_0x2cb8('0x54'))){_0x2826f7['limit']=qs[_0x2cb8('0x23')](_0x953cb2['query']['limit']);_0x2826f7[_0x2cb8('0x24')]=qs['offset'](_0x953cb2[_0x2cb8('0x4d')][_0x2cb8('0x24')]);}_0x2826f7['order']=qs[_0x2cb8('0x55')](_0x953cb2[_0x2cb8('0x4d')][_0x2cb8('0x55')]);_0x2826f7[_0x2cb8('0x56')]=qs[_0x2cb8('0x4f')](_[_0x2cb8('0x57')](_0x953cb2[_0x2cb8('0x4d')],_0x4c821f['filters']),_0x1a965a);if(_0x953cb2[_0x2cb8('0x4d')][_0x2cb8('0x58')]){_0x2826f7['where']=_[_0x2cb8('0x59')](_0x2826f7[_0x2cb8('0x56')],{'$or':_[_0x2cb8('0x4b')](_0x1a965a,function(_0x2d21){if(_0x2d21[_0x2cb8('0x4c')]!==_0x2cb8('0x5a')){var _0x52dff7={};_0x52dff7[_0x2d21[_0x2cb8('0x2c')]]={'$like':'%'+_0x953cb2[_0x2cb8('0x4d')]['filter']+'%'};return _0x52dff7;}})});}_0x2826f7=_[_0x2cb8('0x59')]({},_0x2826f7,_0x953cb2[_0x2cb8('0x5b')]);var _0x2e471a={'where':_0x2826f7['where']};return db['MailAccount'][_0x2cb8('0x5c')](_0x2e471a)[_0x2cb8('0x14')](function(_0x2730f6){_0x155b4a['count']=_0x2730f6;if(_0x953cb2[_0x2cb8('0x4d')][_0x2cb8('0x5d')]){_0x2826f7[_0x2cb8('0x5e')]=[{'all':!![]}];}return db[_0x2cb8('0x5f')][_0x2cb8('0x60')](_0x2826f7);})[_0x2cb8('0x14')](function(_0x5eca69){_0x155b4a[_0x2cb8('0x61')]=_0x5eca69;return _0x155b4a;})[_0x2cb8('0x14')](respondWithFilteredResult(_0x28fc56,_0x2826f7))['catch'](handleError(_0x28fc56,null));};exports[_0x2cb8('0x62')]=function(_0x6d8492,_0xcf93d3){var _0xac4985={'raw':![],'where':{'id':_0x6d8492['params']['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x2cb8('0x48')],'as':'Smtp'},{'model':db[_0x2cb8('0x49')],'as':_0x2cb8('0x4a')}]},_0x2c3fc0={};_0x2c3fc0[_0x2cb8('0x63')]=_[_0x2cb8('0x4e')](db[_0x2cb8('0x5f')][_0x2cb8('0x64')]);_0x2c3fc0[_0x2cb8('0x4d')]=_[_0x2cb8('0x4e')](_0x6d8492[_0x2cb8('0x4d')]);_0x2c3fc0[_0x2cb8('0x4f')]=_[_0x2cb8('0x50')](_0x2c3fc0[_0x2cb8('0x63')],_0x2c3fc0[_0x2cb8('0x4d')]);_0xac4985[_0x2cb8('0x52')]=_[_0x2cb8('0x50')](_0x2c3fc0['model'],qs[_0x2cb8('0x51')](_0x6d8492[_0x2cb8('0x4d')][_0x2cb8('0x51')]));_0xac4985[_0x2cb8('0x52')]=_0xac4985[_0x2cb8('0x52')][_0x2cb8('0x53')]?_0xac4985[_0x2cb8('0x52')]:_0x2c3fc0['model'];if(_0x6d8492['query'][_0x2cb8('0x5d')]){_0xac4985[_0x2cb8('0x5e')]=[{'all':!![]}];}_0xac4985=_[_0x2cb8('0x59')]({},_0xac4985,_0x6d8492['options']);return db[_0x2cb8('0x5f')]['find'](_0xac4985)[_0x2cb8('0x14')](handleEntityNotFound(_0xcf93d3,null))[_0x2cb8('0x14')](respondWithResult(_0xcf93d3,null))[_0x2cb8('0x65')](handleError(_0xcf93d3,null));};exports['update']=function(_0x7cc078,_0xec6780){if(_0x7cc078['body']['id']){delete _0x7cc078['body']['id'];}var _0x4d03bf=_0x7cc078['body'][_0x2cb8('0x66')]===_0x2cb8('0x67')?null:_0x7cc078['body'][_0x2cb8('0x66')];var _0x446ac5=_0x7cc078['body'][_0x2cb8('0x44')]||{};var _0x3b7d9e=_0x7cc078['body'][_0x2cb8('0x45')]||{};if(_0x4d03bf){_0x446ac5[_0x2cb8('0x3f')]=getImapHost(_0x4d03bf);_0x446ac5[_0x2cb8('0x3e')]=0x3e1;_0x3b7d9e[_0x2cb8('0x3f')]=getSmtpHost(_0x4d03bf);_0x3b7d9e[_0x2cb8('0x3e')]=0x24b;_0x3b7d9e['secure']=![];}if(_0x3b7d9e[_0x2cb8('0x3c')]){_0x3b7d9e[_0x2cb8('0x40')]=![];}else{_0x3b7d9e[_0x2cb8('0x3d')]=null;}if(!_0x446ac5['modernAuthentication'])_0x446ac5['CloudProviderId']=null;_0x7cc078[_0x2cb8('0x68')][_0x2cb8('0x44')]=_0x446ac5;_0x7cc078[_0x2cb8('0x68')][_0x2cb8('0x45')]=_0x3b7d9e;return db[_0x2cb8('0x5f')][_0x2cb8('0x69')]({'where':{'id':_0x7cc078[_0x2cb8('0x6a')]['id']},'include':[{'model':db[_0x2cb8('0x47')],'as':_0x2cb8('0x44')},{'model':db[_0x2cb8('0x48')],'as':'Smtp'},{'model':db[_0x2cb8('0x49')],'as':'mandatoryDispositionPause'}]})[_0x2cb8('0x14')](handleEntityNotFound(_0xec6780,null))[_0x2cb8('0x14')](function(_0x303697){if(!_0x303697)throw new Error(_0x2cb8('0x6b'));if(_0x303697[_0x2cb8('0x41')])delete _0x7cc078['body']['Imap'];return _0x303697;})[_0x2cb8('0x14')](saveUpdates(_0x7cc078['body'],null))[_0x2cb8('0x14')](function(_0x35b01a){if(!_0x7cc078[_0x2cb8('0x68')][_0x2cb8('0x44')])return _0x35b01a;return db['MailServerIn'][_0x2cb8('0x27')](_0x7cc078[_0x2cb8('0x68')][_0x2cb8('0x44')],{'where':{'MailAccountId':_0x35b01a['id']}})[_0x2cb8('0x14')](function(){return _0x35b01a;});})[_0x2cb8('0x14')](function(_0x392ccb){if(!_0x7cc078['body'][_0x2cb8('0x45')])return _0x392ccb;return db[_0x2cb8('0x48')][_0x2cb8('0x27')](_0x7cc078['body'][_0x2cb8('0x45')],{'where':{'MailAccountId':_0x392ccb['id']}})[_0x2cb8('0x14')](function(){return _0x392ccb;});})[_0x2cb8('0x14')](respondWithResult(_0xec6780,null))['catch'](handleError(_0xec6780,null));};exports[_0x2cb8('0x6c')]=function(_0x5cc3bc,_0x1aa61e){return db['MailAccount'][_0x2cb8('0x6c')]()[_0x2cb8('0x14')](respondWithResult(_0x1aa61e,null))[_0x2cb8('0x65')](handleError(_0x1aa61e,null));};exports[_0x2cb8('0x6d')]=function(_0x29285d,_0x3816fa){if(_0x29285d[_0x2cb8('0x68')]['id']){delete _0x29285d[_0x2cb8('0x68')]['id'];}return db[_0x2cb8('0x5f')][_0x2cb8('0x69')]({'where':{'id':_0x29285d[_0x2cb8('0x6a')]['id']}})[_0x2cb8('0x14')](handleEntityNotFound(_0x3816fa,null))[_0x2cb8('0x14')](function(_0xa369e7){if(_0xa369e7){_0x29285d[_0x2cb8('0x68')][_0x2cb8('0x6e')]=_0xa369e7['id'];return db[_0x2cb8('0x6f')]['create'](_0x29285d[_0x2cb8('0x68')]);}})[_0x2cb8('0x14')](respondWithResult(_0x3816fa,null))[_0x2cb8('0x65')](handleError(_0x3816fa,null));};exports[_0x2cb8('0x70')]=function(_0xd1d0c0,_0x34930b){var _0x138a5b={'raw':![],'where':{}};var _0xe6edd={};var _0x20ffc0={'count':0x0,'rows':[]};return db[_0x2cb8('0x5f')]['findOne']({'where':{'id':_0xd1d0c0[_0x2cb8('0x6a')]['id']}})[_0x2cb8('0x14')](handleEntityNotFound(_0x34930b,null))[_0x2cb8('0x14')](function(_0x567484){if(_0x567484){_0xe6edd[_0x2cb8('0x63')]=_[_0x2cb8('0x4e')](db[_0x2cb8('0x6f')][_0x2cb8('0x64')]);_0xe6edd[_0x2cb8('0x4d')]=_[_0x2cb8('0x4e')](_0xd1d0c0[_0x2cb8('0x4d')]);_0xe6edd[_0x2cb8('0x4f')]=_[_0x2cb8('0x50')](_0xe6edd[_0x2cb8('0x63')],_0xe6edd[_0x2cb8('0x4d')]);_0x138a5b[_0x2cb8('0x52')]=_['intersection'](_0xe6edd[_0x2cb8('0x63')],qs['fields'](_0xd1d0c0[_0x2cb8('0x4d')][_0x2cb8('0x51')]));_0x138a5b[_0x2cb8('0x52')]=_0x138a5b['attributes'][_0x2cb8('0x53')]?_0x138a5b[_0x2cb8('0x52')]:_0xe6edd[_0x2cb8('0x63')];if(!_0xd1d0c0[_0x2cb8('0x4d')]['hasOwnProperty'](_0x2cb8('0x54'))){_0x138a5b['limit']=qs[_0x2cb8('0x23')](_0xd1d0c0[_0x2cb8('0x4d')][_0x2cb8('0x23')]);_0x138a5b['offset']=qs[_0x2cb8('0x24')](_0xd1d0c0[_0x2cb8('0x4d')][_0x2cb8('0x24')]);}_0x138a5b[_0x2cb8('0x71')]=qs['sort'](_0xd1d0c0[_0x2cb8('0x4d')]['sort']);_0x138a5b[_0x2cb8('0x56')]=qs[_0x2cb8('0x4f')](_[_0x2cb8('0x57')](_0xd1d0c0['query'],_0xe6edd[_0x2cb8('0x4f')]));_0x138a5b[_0x2cb8('0x56')][_0x2cb8('0x6e')]=_0x567484['id'];if(_0xd1d0c0[_0x2cb8('0x4d')][_0x2cb8('0x58')]){_0x138a5b[_0x2cb8('0x56')]=_[_0x2cb8('0x59')](_0x138a5b[_0x2cb8('0x56')],{'$or':_['map'](_0x138a5b[_0x2cb8('0x52')],function(_0x11e4df){var _0x3dd992={};_0x3dd992[_0x11e4df]={'$like':'%'+_0xd1d0c0[_0x2cb8('0x4d')][_0x2cb8('0x58')]+'%'};return _0x3dd992;})});}_0x138a5b=_[_0x2cb8('0x59')]({},_0x138a5b,_0xd1d0c0['options']);return db[_0x2cb8('0x6f')][_0x2cb8('0x5c')]({'where':_0x138a5b[_0x2cb8('0x56')]})[_0x2cb8('0x14')](function(_0x546b75){_0x20ffc0[_0x2cb8('0x5c')]=_0x546b75;if(_0xd1d0c0['query']['includeAll']){_0x138a5b[_0x2cb8('0x5e')]=[{'all':!![]}];}return db[_0x2cb8('0x6f')][_0x2cb8('0x60')](_0x138a5b);})[_0x2cb8('0x14')](function(_0x376224){_0x20ffc0[_0x2cb8('0x61')]=_0x376224;return _0x20ffc0;});}})['then'](respondWithFilteredResult(_0x34930b,_0x138a5b))[_0x2cb8('0x65')](handleError(_0x34930b,null));};exports[_0x2cb8('0x72')]=function(_0x1a6a4c,_0x4a254c){return db['MailAccount'][_0x2cb8('0x69')]({'where':{'id':_0x1a6a4c['params']['id']}})['then'](handleEntityNotFound(_0x4a254c,null))[_0x2cb8('0x14')](function(_0x56d4e9){if(_0x56d4e9){return _0x56d4e9[_0x2cb8('0x72')](_0x1a6a4c[_0x2cb8('0x4d')][_0x2cb8('0x73')]);}})[_0x2cb8('0x14')](respondWithStatusCode(_0x4a254c,null))[_0x2cb8('0x65')](handleError(_0x4a254c,null));};exports[_0x2cb8('0x74')]=function(_0x17c04b,_0x43fb62){if(_0x17c04b[_0x2cb8('0x68')]['id']){delete _0x17c04b[_0x2cb8('0x68')]['id'];}return db['MailAccount'][_0x2cb8('0x69')]({'where':{'id':_0x17c04b[_0x2cb8('0x6a')]['id']}})['then'](handleEntityNotFound(_0x43fb62,null))[_0x2cb8('0x14')](function(_0x2aac83){if(_0x2aac83){_0x17c04b[_0x2cb8('0x68')][_0x2cb8('0x6e')]=_0x2aac83['id'];return db[_0x2cb8('0x75')][_0x2cb8('0x76')](_0x17c04b[_0x2cb8('0x68')]);}})['then'](respondWithResult(_0x43fb62,null))[_0x2cb8('0x65')](handleError(_0x43fb62,null));};exports['getAnswers']=function(_0x1922e9,_0x2c665c){var _0x165ec3={'raw':![],'where':{}};var _0x177257={};var _0x298ff0={'count':0x0,'rows':[]};return db[_0x2cb8('0x5f')][_0x2cb8('0x77')]({'where':{'id':_0x1922e9[_0x2cb8('0x6a')]['id']}})[_0x2cb8('0x14')](handleEntityNotFound(_0x2c665c,null))[_0x2cb8('0x14')](function(_0x4bafa3){if(_0x4bafa3){_0x177257[_0x2cb8('0x63')]=_[_0x2cb8('0x4e')](db[_0x2cb8('0x75')][_0x2cb8('0x64')]);_0x177257[_0x2cb8('0x4d')]=_['keys'](_0x1922e9[_0x2cb8('0x4d')]);_0x177257[_0x2cb8('0x4f')]=_['intersection'](_0x177257[_0x2cb8('0x63')],_0x177257[_0x2cb8('0x4d')]);_0x165ec3[_0x2cb8('0x52')]=_['intersection'](_0x177257[_0x2cb8('0x63')],qs['fields'](_0x1922e9[_0x2cb8('0x4d')][_0x2cb8('0x51')]));_0x165ec3['attributes']=_0x165ec3[_0x2cb8('0x52')][_0x2cb8('0x53')]?_0x165ec3[_0x2cb8('0x52')]:_0x177257[_0x2cb8('0x63')];if(!_0x1922e9[_0x2cb8('0x4d')][_0x2cb8('0x78')](_0x2cb8('0x54'))){_0x165ec3['limit']=qs[_0x2cb8('0x23')](_0x1922e9[_0x2cb8('0x4d')][_0x2cb8('0x23')]);_0x165ec3['offset']=qs[_0x2cb8('0x24')](_0x1922e9['query'][_0x2cb8('0x24')]);}_0x165ec3[_0x2cb8('0x71')]=qs[_0x2cb8('0x55')](_0x1922e9[_0x2cb8('0x4d')][_0x2cb8('0x55')]);_0x165ec3[_0x2cb8('0x56')]=qs[_0x2cb8('0x4f')](_[_0x2cb8('0x57')](_0x1922e9[_0x2cb8('0x4d')],_0x177257[_0x2cb8('0x4f')]));_0x165ec3['where'][_0x2cb8('0x6e')]=_0x4bafa3['id'];if(_0x1922e9[_0x2cb8('0x4d')]['filter']){_0x165ec3[_0x2cb8('0x56')]=_[_0x2cb8('0x59')](_0x165ec3[_0x2cb8('0x56')],{'$or':_[_0x2cb8('0x4b')](_0x165ec3['attributes'],function(_0xca86ea){var _0x17da5b={};_0x17da5b[_0xca86ea]={'$like':'%'+_0x1922e9[_0x2cb8('0x4d')][_0x2cb8('0x58')]+'%'};return _0x17da5b;})});}_0x165ec3=_['merge']({},_0x165ec3,_0x1922e9[_0x2cb8('0x5b')]);return db['CannedAnswer'][_0x2cb8('0x5c')]({'where':_0x165ec3['where']})[_0x2cb8('0x14')](function(_0xd90de4){_0x298ff0[_0x2cb8('0x5c')]=_0xd90de4;if(_0x1922e9[_0x2cb8('0x4d')][_0x2cb8('0x5d')]){_0x165ec3[_0x2cb8('0x5e')]=[{'all':!![]}];}return db[_0x2cb8('0x75')][_0x2cb8('0x60')](_0x165ec3);})[_0x2cb8('0x14')](function(_0x5c10a9){_0x298ff0[_0x2cb8('0x61')]=_0x5c10a9;return _0x298ff0;});}})['then'](respondWithFilteredResult(_0x2c665c,_0x165ec3))[_0x2cb8('0x65')](handleError(_0x2c665c,null));};exports[_0x2cb8('0x79')]=function(_0x5cdb5d,_0x168ae7){return db['MailAccount']['find']({'where':{'id':_0x5cdb5d[_0x2cb8('0x6a')]['id']}})[_0x2cb8('0x14')](handleEntityNotFound(_0x168ae7,null))[_0x2cb8('0x14')](function(_0x1d90d9){if(_0x1d90d9){return _0x1d90d9[_0x2cb8('0x79')](_0x5cdb5d[_0x2cb8('0x4d')][_0x2cb8('0x73')]);}})[_0x2cb8('0x14')](respondWithStatusCode(_0x168ae7,null))[_0x2cb8('0x65')](handleError(_0x168ae7,null));};exports[_0x2cb8('0x76')]=function(_0x54ea8c,_0x3872ec){var _0xf71ef4={'name':_0x54ea8c[_0x2cb8('0x68')]['name'],'key':_0x54ea8c[_0x2cb8('0x68')][_0x2cb8('0x7a')],'provider':_0x54ea8c[_0x2cb8('0x68')][_0x2cb8('0x66')]==='custom'?null:_0x54ea8c[_0x2cb8('0x68')]['provider'],'email':_0x54ea8c[_0x2cb8('0x68')][_0x2cb8('0x7b')],'ListId':_0x54ea8c['body'][_0x2cb8('0x7c')],'active':!_[_0x2cb8('0x7d')](_0x54ea8c[_0x2cb8('0x68')]['active'])?_0x54ea8c[_0x2cb8('0x68')][_0x2cb8('0x7e')]:!![],'description':_0x54ea8c[_0x2cb8('0x68')]['description']||null};var _0x5b0c0f=getAuthenticationOptions(_0xf71ef4[_0x2cb8('0x66')],_0x54ea8c[_0x2cb8('0x68')]);_0xf71ef4[_0x2cb8('0x44')]=_0x5b0c0f[_0x2cb8('0x44')];_0xf71ef4[_0x2cb8('0x45')]=_0x5b0c0f[_0x2cb8('0x45')];return db[_0x2cb8('0x5f')][_0x2cb8('0x76')](_0xf71ef4,{'include':[{'model':db['MailServerOut'],'as':_0x2cb8('0x45')},{'model':db['MailServerIn'],'as':_0x2cb8('0x44')}]})[_0x2cb8('0x14')](function(_0x3c7a74){var _0xffff2b=_0x54ea8c[_0x2cb8('0x39')][_0x2cb8('0x28')]({'plain':!![]});if(!_0xffff2b)throw new Error(_0x2cb8('0x7f'));if(_0xffff2b[_0x2cb8('0x80')]===_0x2cb8('0x39')){var _0x5cd4fc=_0x3c7a74[_0x2cb8('0x28')]({'plain':!![]});return db[_0x2cb8('0x81')][_0x2cb8('0x69')]({'where':{'name':'MailAccounts','userProfileId':_0xffff2b[_0x2cb8('0x82')]},'raw':!![]})[_0x2cb8('0x14')](function(_0x58a221){if(_0x58a221&&_0x58a221[_0x2cb8('0x83')]===0x0){return db[_0x2cb8('0x84')][_0x2cb8('0x76')]({'name':_0x5cd4fc[_0x2cb8('0x2c')],'resourceId':_0x5cd4fc['id'],'type':_0x58a221[_0x2cb8('0x2c')],'sectionId':_0x58a221['id']},{})[_0x2cb8('0x14')](function(){return _0x3c7a74;});}else{return _0x3c7a74;}})[_0x2cb8('0x65')](function(_0x2eb2ef){logger[_0x2cb8('0x1b')](_0x2cb8('0x85'),_0x2eb2ef);throw _0x2eb2ef;});}return _0x3c7a74;})[_0x2cb8('0x14')](respondWithResult(_0x3872ec,0xc9))[_0x2cb8('0x65')](handleError(_0x3872ec,null));};exports[_0x2cb8('0x86')]=function(_0x528382,_0x37d96e){return db['MailAccount'][_0x2cb8('0x77')]({'where':{'id':_0x528382[_0x2cb8('0x6a')]['id']}})[_0x2cb8('0x14')](handleEntityNotFound(_0x37d96e,null))[_0x2cb8('0x14')](function(_0x2f5804){if(_0x2f5804){return _0x2f5804[_0x2cb8('0x86')]();}return null;})[_0x2cb8('0x14')](respondWithResult(_0x37d96e,null))['catch'](handleError(_0x37d96e,null));};exports[_0x2cb8('0x87')]=function(_0x2ac76d,_0x2b4fc6){if(_0x2ac76d[_0x2cb8('0x68')]['id']){delete _0x2ac76d[_0x2cb8('0x68')]['id'];}return db[_0x2cb8('0x5f')][_0x2cb8('0x69')]({'where':{'id':_0x2ac76d['params']['id']}})[_0x2cb8('0x14')](handleEntityNotFound(_0x2b4fc6,null))[_0x2cb8('0x14')](function(_0x5a7474){if(_0x5a7474){_0x2ac76d[_0x2cb8('0x68')]['MailAccountId']=_0x5a7474['id'];return db[_0x2cb8('0x47')][_0x2cb8('0x76')](_0x2ac76d['body']);}})[_0x2cb8('0x14')](respondWithResult(_0x2b4fc6,null))[_0x2cb8('0x65')](handleError(_0x2b4fc6,null));};exports[_0x2cb8('0x88')]=function(_0x4fc038,_0x42b94e){return db[_0x2cb8('0x5f')][_0x2cb8('0x77')]({'where':{'id':_0x4fc038[_0x2cb8('0x6a')]['id']}})['then'](handleEntityNotFound(_0x42b94e,null))['then'](function(_0x265085){if(_0x265085){return _0x265085['setImap'](null);}return null;})[_0x2cb8('0x14')](respondWithStatusCode(_0x42b94e,null))[_0x2cb8('0x65')](handleError(_0x42b94e,null));};exports[_0x2cb8('0x89')]=function(_0x180df0,_0x12c4ac){return db['MailAccount'][_0x2cb8('0x77')]({'where':{'id':_0x180df0[_0x2cb8('0x6a')]['id']}})[_0x2cb8('0x14')](handleEntityNotFound(_0x12c4ac,null))[_0x2cb8('0x14')](function(_0x599286){if(_0x599286){return _0x599286['getSmtp']();}return null;})['then'](respondWithResult(_0x12c4ac,null))[_0x2cb8('0x65')](handleError(_0x12c4ac,null));};exports[_0x2cb8('0x8a')]=function(_0x393ba3,_0x2eba90){if(_0x393ba3[_0x2cb8('0x68')]['id']){delete _0x393ba3[_0x2cb8('0x68')]['id'];}return db[_0x2cb8('0x5f')][_0x2cb8('0x69')]({'where':{'id':_0x393ba3['params']['id']}})['then'](handleEntityNotFound(_0x2eba90,null))[_0x2cb8('0x14')](function(_0xa4dff4){if(_0xa4dff4){_0x393ba3[_0x2cb8('0x68')][_0x2cb8('0x6e')]=_0xa4dff4['id'];return db[_0x2cb8('0x48')][_0x2cb8('0x76')](_0x393ba3[_0x2cb8('0x68')]);}})['then'](respondWithResult(_0x2eba90,null))['catch'](handleError(_0x2eba90,null));};exports[_0x2cb8('0x8b')]=function(_0x8ed1e1,_0x4c6add){return db[_0x2cb8('0x5f')][_0x2cb8('0x77')]({'where':{'id':_0x8ed1e1[_0x2cb8('0x6a')]['id']}})[_0x2cb8('0x14')](handleEntityNotFound(_0x4c6add,null))[_0x2cb8('0x14')](function(_0x19f7d7){if(_0x19f7d7){return _0x19f7d7['setSmtp'](null);}return null;})[_0x2cb8('0x14')](respondWithStatusCode(_0x4c6add,null))[_0x2cb8('0x65')](handleError(_0x4c6add,null));};exports['addInteraction']=function(_0x56a19d,_0x57340d){return db[_0x2cb8('0x8c')][_0x2cb8('0x69')]({'where':{'id':_0x56a19d['params']['id']}})[_0x2cb8('0x14')](handleEntityNotFound(_0x57340d,null))['then'](function(_0x3a9b20){if(_0x3a9b20){return _0x3a9b20[_0x2cb8('0x8d')](_0x56a19d[_0x2cb8('0x68')]['ids'],_[_0x2cb8('0x8e')](_0x56a19d[_0x2cb8('0x68')],[_0x2cb8('0x73'),'id'])||{});}})[_0x2cb8('0x14')](respondWithResult(_0x57340d,null))[_0x2cb8('0x65')](handleError(_0x57340d,null));};exports[_0x2cb8('0x8f')]=function(_0x54628c,_0x215e79){var _0x42117a={'raw':![],'where':{}};var _0x4527e2={};var _0x227fd6={'count':0x0,'rows':[]};return db['MailAccount'][_0x2cb8('0x77')]({'where':{'id':_0x54628c['params']['id']}})[_0x2cb8('0x14')](handleEntityNotFound(_0x215e79,null))[_0x2cb8('0x14')](function(_0x440c44){if(_0x440c44){_0x4527e2['model']=_['keys'](db[_0x2cb8('0x8c')][_0x2cb8('0x64')]);_0x4527e2[_0x2cb8('0x4d')]=_['keys'](_0x54628c[_0x2cb8('0x4d')]);_0x4527e2[_0x2cb8('0x4f')]=_[_0x2cb8('0x50')](_0x4527e2[_0x2cb8('0x63')],_0x4527e2[_0x2cb8('0x4d')]);_0x42117a[_0x2cb8('0x52')]=_['intersection'](_0x4527e2[_0x2cb8('0x63')],qs[_0x2cb8('0x51')](_0x54628c[_0x2cb8('0x4d')][_0x2cb8('0x51')]));_0x42117a[_0x2cb8('0x52')]=_0x42117a['attributes'][_0x2cb8('0x53')]?_0x42117a[_0x2cb8('0x52')]:_0x4527e2[_0x2cb8('0x63')];if(!_0x54628c[_0x2cb8('0x4d')][_0x2cb8('0x78')](_0x2cb8('0x54'))){_0x42117a[_0x2cb8('0x23')]=qs[_0x2cb8('0x23')](_0x54628c[_0x2cb8('0x4d')]['limit']);_0x42117a[_0x2cb8('0x24')]=qs[_0x2cb8('0x24')](_0x54628c['query'][_0x2cb8('0x24')]);}_0x42117a[_0x2cb8('0x71')]=qs[_0x2cb8('0x55')](_0x54628c[_0x2cb8('0x4d')][_0x2cb8('0x55')]);_0x42117a['where']=qs[_0x2cb8('0x4f')](_[_0x2cb8('0x57')](_0x54628c[_0x2cb8('0x4d')],_0x4527e2['filters']));_0x42117a[_0x2cb8('0x56')][_0x2cb8('0x6e')]=_0x440c44['id'];if(_0x54628c['query']['filter']){_0x42117a[_0x2cb8('0x56')]=_['merge'](_0x42117a[_0x2cb8('0x56')],{'$or':_[_0x2cb8('0x4b')](_0x42117a[_0x2cb8('0x52')],function(_0x26ad47){var _0x145286={};_0x145286[_0x26ad47]={'$like':'%'+_0x54628c['query'][_0x2cb8('0x58')]+'%'};return _0x145286;})});}_0x42117a=_[_0x2cb8('0x59')]({},_0x42117a,_0x54628c[_0x2cb8('0x5b')]);return db['MailInteraction']['count']({'where':_0x42117a[_0x2cb8('0x56')]})[_0x2cb8('0x14')](function(_0x11bd28){_0x227fd6[_0x2cb8('0x5c')]=_0x11bd28;if(_0x54628c['query'][_0x2cb8('0x5d')]){_0x42117a[_0x2cb8('0x5e')]=[{'model':db[_0x2cb8('0x90')],'as':'Contact','required':![]},{'model':db[_0x2cb8('0x91')],'as':'Owner','attributes':['name','fullname','internal'],'required':![]},{'model':db[_0x2cb8('0x92')],'as':'Tags','attributes':['id',_0x2cb8('0x2c'),_0x2cb8('0x93')],'where':_0x54628c[_0x2cb8('0x4d')][_0x2cb8('0x94')]?{'id':_0x54628c[_0x2cb8('0x4d')]['tag']}:undefined,'required':_0x54628c[_0x2cb8('0x4d')][_0x2cb8('0x94')]?!![]:![]}];}return db['MailInteraction'][_0x2cb8('0x60')](_0x42117a);})[_0x2cb8('0x14')](function(_0x23c38c){_0x227fd6[_0x2cb8('0x61')]=_0x23c38c;return _0x227fd6;});}})['then'](respondWithFilteredResult(_0x215e79,_0x42117a))[_0x2cb8('0x65')](handleError(_0x215e79,null));};exports[_0x2cb8('0x95')]=function addApplications(_0x2e1726,_0x55f7fd){var _0x193ea4=_0x2e1726[_0x2cb8('0x6a')]['id'];var _0xb2af12=_0x2e1726['body'];var _0x360d75=0xc8;var _0x58458c=null;return db[_0x2cb8('0x96')][_0x2cb8('0x97')]({'isolationLevel':db['sequelize'][_0x2cb8('0x98')][_0x2cb8('0x99')]['READ_COMMITTED']},function(_0x3a80e0){return db['MailAccount']['findOne']({'where':{'id':_0x193ea4},'transaction':_0x3a80e0})[_0x2cb8('0x14')](function(_0x33e6b4){if(_0x33e6b4){return db[_0x2cb8('0x9a')][_0x2cb8('0x2a')]({'where':{'MailAccountId':_0x193ea4},'transaction':_0x3a80e0})['then'](function(){var _0x3843f2=_[_0x2cb8('0x4b')](_0xb2af12,function(_0x197280){_0x197280[_0x2cb8('0x6e')]=_0x193ea4;return _0x197280;});return db[_0x2cb8('0x9a')]['bulkCreate'](_0x3843f2,{'transaction':_0x3a80e0});});}else{_0x360d75=0x194;_0x58458c=[];}});})[_0x2cb8('0x14')](function(){if(_0x360d75!==0x194){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x193ea4},'order':_0x2cb8('0x9b')})[_0x2cb8('0x14')](function(_0x1b89de){_0x58458c=_0x1b89de;});}})[_0x2cb8('0x65')](function(_0x18dd1c){_0x360d75=0x1f4;logger[_0x2cb8('0x1b')](_0x18dd1c[_0x2cb8('0x2b')]);if(_0x18dd1c[_0x2cb8('0x2c')]){delete _0x18dd1c[_0x2cb8('0x2c')];}_0x58458c=_0x18dd1c;})[_0x2cb8('0x9c')](function(){if(_0x58458c===null){_0x55f7fd['sendStatus'](_0x360d75);}else{if(_0x360d75===0x1f4){_0x55f7fd[_0x2cb8('0x1f')](_0x360d75)[_0x2cb8('0x2d')](_0x58458c);}else{_0x55f7fd[_0x2cb8('0x1f')](_0x360d75)[_0x2cb8('0x21')](_0x58458c);}}});};exports['getApplications']=function(_0x24a208,_0x4a4c15){var _0x29ab71={};var _0x1edde9={};var _0x21447e;var _0x3ce1a5;return db[_0x2cb8('0x5f')][_0x2cb8('0x77')]({'where':{'id':_0x24a208[_0x2cb8('0x6a')]['id']}})[_0x2cb8('0x14')](handleEntityNotFound(_0x4a4c15,null))['then'](function(_0x4bacf9){if(_0x4bacf9){_0x21447e=_0x4bacf9;_0x1edde9[_0x2cb8('0x63')]=_[_0x2cb8('0x4e')](db[_0x2cb8('0x9a')]['rawAttributes']);_0x1edde9[_0x2cb8('0x4d')]=_['keys'](_0x24a208[_0x2cb8('0x4d')]);_0x1edde9[_0x2cb8('0x4f')]=_['intersection'](_0x1edde9[_0x2cb8('0x63')],_0x1edde9[_0x2cb8('0x4d')]);_0x29ab71[_0x2cb8('0x52')]=_['intersection'](_0x1edde9[_0x2cb8('0x63')],qs[_0x2cb8('0x51')](_0x24a208[_0x2cb8('0x4d')][_0x2cb8('0x51')]));_0x29ab71[_0x2cb8('0x52')]=_0x29ab71[_0x2cb8('0x52')][_0x2cb8('0x53')]?_0x29ab71['attributes']:_0x1edde9[_0x2cb8('0x63')];_0x29ab71[_0x2cb8('0x71')]=qs[_0x2cb8('0x55')](_0x24a208[_0x2cb8('0x4d')]['sort']);_0x29ab71['where']=qs[_0x2cb8('0x4f')](_[_0x2cb8('0x57')](_0x24a208[_0x2cb8('0x4d')],_0x1edde9[_0x2cb8('0x4f')]));if(_0x24a208[_0x2cb8('0x4d')][_0x2cb8('0x58')]){_0x29ab71[_0x2cb8('0x56')]=_[_0x2cb8('0x59')](_0x29ab71[_0x2cb8('0x56')],{'$or':_[_0x2cb8('0x4b')](_0x29ab71[_0x2cb8('0x52')],function(_0x266cbe){var _0x43134f={};_0x43134f[_0x266cbe]={'$like':'%'+_0x24a208[_0x2cb8('0x4d')]['filter']+'%'};return _0x43134f;})});}_0x29ab71=_['merge']({},_0x29ab71,_0x24a208['options']);return _0x21447e[_0x2cb8('0x9d')](_0x29ab71);}})[_0x2cb8('0x14')](function(_0x32b0b7){if(_0x32b0b7){_0x3ce1a5=_0x32b0b7[_0x2cb8('0x53')];if(!_0x24a208[_0x2cb8('0x4d')]['hasOwnProperty'](_0x2cb8('0x54'))){_0x29ab71[_0x2cb8('0x23')]=qs[_0x2cb8('0x23')](_0x24a208[_0x2cb8('0x4d')][_0x2cb8('0x23')]);_0x29ab71[_0x2cb8('0x24')]=qs[_0x2cb8('0x24')](_0x24a208['query'][_0x2cb8('0x24')]);}return _0x21447e[_0x2cb8('0x9d')](_0x29ab71);}})[_0x2cb8('0x14')](function(_0x42b810){if(_0x42b810){return _0x42b810?{'count':_0x3ce1a5,'rows':_0x42b810}:null;}})['then'](respondWithResult(_0x4a4c15,null))[_0x2cb8('0x65')](handleError(_0x4a4c15,null));};exports[_0x2cb8('0x9e')]=function(_0x20adb5,_0x41efed){var _0x40fb53={'raw':!![],'where':{}};var _0x3b2570={};var _0x5a35a4={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x20adb5['params']['id']}})[_0x2cb8('0x14')](handleEntityNotFound(_0x41efed,null))['then'](function(_0x5b64fe){if(_0x5b64fe){_0x3b2570[_0x2cb8('0x63')]=_['keys'](db[_0x2cb8('0x9f')][_0x2cb8('0x64')]);_0x3b2570[_0x2cb8('0x4d')]=_[_0x2cb8('0x4e')](_0x20adb5['query']);_0x3b2570[_0x2cb8('0x4f')]=_[_0x2cb8('0x50')](_0x3b2570[_0x2cb8('0x63')],_0x3b2570[_0x2cb8('0x4d')]);_0x40fb53[_0x2cb8('0x52')]=_['intersection'](_0x3b2570[_0x2cb8('0x63')],qs['fields'](_0x20adb5[_0x2cb8('0x4d')][_0x2cb8('0x51')]));_0x40fb53[_0x2cb8('0x52')]=_0x40fb53[_0x2cb8('0x52')][_0x2cb8('0x53')]?_0x40fb53[_0x2cb8('0x52')]:_0x3b2570[_0x2cb8('0x63')];if(!_0x20adb5[_0x2cb8('0x4d')][_0x2cb8('0x78')]('nolimit')){_0x40fb53['limit']=qs[_0x2cb8('0x23')](_0x20adb5['query']['limit']);_0x40fb53[_0x2cb8('0x24')]=qs[_0x2cb8('0x24')](_0x20adb5[_0x2cb8('0x4d')]['offset']);}_0x40fb53[_0x2cb8('0x71')]=qs[_0x2cb8('0x55')](_0x20adb5[_0x2cb8('0x4d')]['sort']);_0x40fb53[_0x2cb8('0x56')]=qs[_0x2cb8('0x4f')](_[_0x2cb8('0x57')](_0x20adb5['query'],_0x3b2570['filters']));_0x40fb53[_0x2cb8('0x56')][_0x2cb8('0x6e')]=_0x5b64fe['id'];if(_0x20adb5[_0x2cb8('0x4d')]['filter']){_0x40fb53[_0x2cb8('0x56')]=_[_0x2cb8('0x59')](_0x40fb53[_0x2cb8('0x56')],{'$or':_[_0x2cb8('0x4b')](_0x40fb53[_0x2cb8('0x52')],function(_0x5ce1ae){var _0x17259d={};_0x17259d[_0x5ce1ae]={'$like':'%'+_0x20adb5[_0x2cb8('0x4d')]['filter']+'%'};return _0x17259d;})});}if(_0x20adb5[_0x2cb8('0x4d')][_0x2cb8('0xa0')]){var _0x334e44=_0x20adb5['query'][_0x2cb8('0xa0')][_0x2cb8('0xa1')](',');var _0x18dc45={};_0x18dc45[_0x334e44[0x0]]={'$gte':moment(_0x334e44[0x1])[_0x2cb8('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x40fb53[_0x2cb8('0x56')]=_[_0x2cb8('0x59')](_0x40fb53[_0x2cb8('0x56')],_0x18dc45);}_0x40fb53=_[_0x2cb8('0x59')]({},_0x40fb53,_0x20adb5['options']);return db['MailMessage'][_0x2cb8('0x5c')]({'where':_0x40fb53[_0x2cb8('0x56')]})[_0x2cb8('0x14')](function(_0x39d577){_0x5a35a4[_0x2cb8('0x5c')]=_0x39d577;if(_0x20adb5[_0x2cb8('0x4d')]['includeAll']){_0x40fb53['include']=[{'all':!![]}];}return db[_0x2cb8('0x9f')]['findAll'](_0x40fb53);})[_0x2cb8('0x14')](function(_0x2cda11){if(_0x20adb5['query'][_0x2cb8('0xa3')]===_0x2cb8('0xa4')){for(var _0x37171a=0x0;_0x37171a<_0x2cda11['length'];_0x37171a++){_0x2cda11[_0x37171a][_0x2cb8('0x68')]=juice(_0x2cda11[_0x37171a][_0x2cb8('0x68')]);}}_0x5a35a4['rows']=_0x2cda11;return _0x5a35a4;});}})[_0x2cb8('0x14')](respondWithFilteredResult(_0x41efed,_0x40fb53))['catch'](handleError(_0x41efed,null));};exports['send']=function(_0x5af6ca,_0x503df7){var _0x5984fb,_0x3b157a={},_0x1ee6c8;if(_0x5af6ca[_0x2cb8('0x68')]['to']){_0x1ee6c8=_0x5af6ca['body']['to'][_0x2cb8('0xa1')](',')[0x0];}return db[_0x2cb8('0x5f')][_0x2cb8('0x69')]({'where':{'id':_0x5af6ca[_0x2cb8('0x6a')]['id']},'include':[{'model':db[_0x2cb8('0xa5')],'as':_0x2cb8('0xa6'),'include':[{'model':db[_0x2cb8('0x90')],'as':_0x2cb8('0xa7'),'where':{'email':_0x1ee6c8},'limit':0x1,'order':[[_0x2cb8('0xa8'),_0x2cb8('0xa9')]]}]},{'model':db[_0x2cb8('0x48')],'as':_0x2cb8('0x45'),'raw':!![],'include':[{'model':db[_0x2cb8('0xaa')],'as':'CloudProvider','raw':!![]}]}]})[_0x2cb8('0x14')](handleEntityNotFound(_0x503df7,null))[_0x2cb8('0x14')](function(_0x5c3002){if(!_0x5c3002)return;_0x5984fb=_0x5c3002;if(!_0x5c3002[_0x2cb8('0x45')])throw new Error(_0x2cb8('0xab'));if(_[_0x2cb8('0x7d')](_0x5af6ca[_0x2cb8('0x68')]['from'])){_0x5af6ca[_0x2cb8('0x68')][_0x2cb8('0xac')]=util[_0x2cb8('0xa2')](_0x2cb8('0xad'),_0x5c3002[_0x2cb8('0x2c')],_0x5c3002[_0x2cb8('0x7b')]||_0x5c3002[_0x2cb8('0x45')][_0x2cb8('0x39')]);}if(_0x5af6ca[_0x2cb8('0x68')][_0x2cb8('0xae')]&&_0x5af6ca['body'][_0x2cb8('0xae')][_0x2cb8('0x53')]){for(var _0x1e429a=0x0;_0x1e429a<_0x5af6ca[_0x2cb8('0x68')][_0x2cb8('0xae')][_0x2cb8('0x53')];_0x1e429a+=0x1){_0x5af6ca[_0x2cb8('0x68')][_0x2cb8('0xae')][_0x1e429a]={'filename':_0x5af6ca['body'][_0x2cb8('0xae')][_0x1e429a]['name'],'path':path[_0x2cb8('0xaf')](config['root'],_0x2cb8('0xb0'),_0x5af6ca[_0x2cb8('0x68')][_0x2cb8('0xae')][_0x1e429a][_0x2cb8('0xb1')])};}}var _0x257f26=_0x5c3002[_0x2cb8('0xb2')]();return respondWithRpcPromise(_0x2cb8('0xb3'),_0x2cb8('0xb4'),{'account':_0x257f26,'message':_0x5af6ca['body']});})[_0x2cb8('0x14')](function(_0x1e3ec3){if(!_0x1e3ec3)return;_0x3b157a=_0x1e3ec3;if(!_0x5984fb[_0x2cb8('0xa6')])throw new Error(_0x2cb8('0xb5'));if(_0x5984fb[_0x2cb8('0xa6')][_0x2cb8('0xa7')]['length'])return _0x5984fb[_0x2cb8('0xa6')][_0x2cb8('0xa7')][0x0];return db[_0x2cb8('0x90')][_0x2cb8('0x76')](_[_0x2cb8('0xd')](_0x5af6ca['body'],{'firstName':_0x5af6ca[_0x2cb8('0x68')]['to'],'email':_0x5af6ca[_0x2cb8('0x68')]['to'],'phone':_0x5af6ca['body']['to'],'ListId':_0x5984fb[_0x2cb8('0x7c')]}));})[_0x2cb8('0x14')](function(_0x452608){if(!_0x452608)return;var _0x38dd6a={'UserId':_0x5af6ca['user']['id'],'ContactId':_0x452608['id'],'MailAccountId':_0x5984fb['id'],'inReplyTo':_0x3b157a[_0x2cb8('0xb6')],'to':_0x5af6ca[_0x2cb8('0x68')][_0x2cb8('0xac')],'cc':_0x5af6ca['body']['cc'],'subject':_0x5af6ca[_0x2cb8('0x68')][_0x2cb8('0xb7')],'attach':_0x5af6ca['body']['attach'],'firstMsgDirection':_0x2cb8('0xb8'),'lastMsgAt':moment()[_0x2cb8('0xa2')](_0x2cb8('0xb9')),'lastMsgDirection':_0x2cb8('0xb8'),'Messages':[_[_0x2cb8('0x59')](_0x5af6ca[_0x2cb8('0x68')],{'messageId':_0x3b157a[_0x2cb8('0xb6')],'sentAt':moment()[_0x2cb8('0xa2')](_0x2cb8('0xb9')),'read':!![],'MailAccountId':_0x5984fb['id'],'UserId':_0x5af6ca[_0x2cb8('0x39')]['id'],'ContactId':_0x452608['id']})]};if(_0x5af6ca['body']['Interaction']){_0x38dd6a=_[_0x2cb8('0x59')](_0x38dd6a,_0x5af6ca[_0x2cb8('0x68')][_0x2cb8('0xba')]);}return db[_0x2cb8('0x8c')][_0x2cb8('0x76')](_0x38dd6a,{'include':[{'model':db[_0x2cb8('0x9f')],'as':_0x2cb8('0xbb')}]});})[_0x2cb8('0x14')](respondWithResult(_0x503df7,null))[_0x2cb8('0x65')](handleError(_0x503df7,null));};exports[_0x2cb8('0xbc')]=function(_0x4a6868,_0x147423){return db['MailAccount'][_0x2cb8('0x69')]({'where':{'id':_0x4a6868['params']['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x2cb8('0xaa')],'as':_0x2cb8('0xaa'),'raw':!![]}]}]})[_0x2cb8('0x14')](handleEntityNotFound(_0x147423,null))[_0x2cb8('0x14')](function(_0x58ac70){if(!_0x58ac70[_0x2cb8('0x45')])return;var _0x5793e2=_0x58ac70[_0x2cb8('0xb2')]();return respondWithRpcPromise(_0x2cb8('0xbd'),_0x2cb8('0xbc'),{'account':_0x5793e2});})['then'](respondWithResult(_0x147423,null))['catch'](handleError(_0x147423,null));};exports[_0x2cb8('0x2a')]=function(_0x1d607e,_0x17d0b4){return db[_0x2cb8('0x5f')]['find']({'where':{'id':_0x1d607e[_0x2cb8('0x6a')]['id']}})[_0x2cb8('0x14')](handleEntityNotFound(_0x17d0b4,null))['then'](function(_0x45f876){if(_0x45f876&&_0x45f876[_0x2cb8('0x41')]){throw new db[(_0x2cb8('0xbe'))]['ValidationError'](_0x2cb8('0xbf'));}return _0x45f876;})[_0x2cb8('0x14')](removeEntity(_0x17d0b4,null))['catch'](handleError(_0x17d0b4,null));};exports[_0x2cb8('0xc0')]=function(_0xbdf51a,_0x25b376){return db[_0x2cb8('0x5f')][_0x2cb8('0x69')]({'where':{'id':_0xbdf51a['params']['id']}})[_0x2cb8('0x14')](handleEntityNotFound(_0x25b376,null))[_0x2cb8('0x14')](function(_0x5d9b98){if(_0x5d9b98){return _0x5d9b98['addAgents'](_0xbdf51a[_0x2cb8('0x68')][_0x2cb8('0x73')],_[_0x2cb8('0x8e')](_0xbdf51a[_0x2cb8('0x68')],['ids','id'])||{})['spread'](function(_0x23a9d3){for(var _0x4b564e=0x0;_0x4b564e<_0xbdf51a[_0x2cb8('0x68')][_0x2cb8('0x73')]['length'];_0x4b564e+=0x1){socket[_0x2cb8('0xc1')](_0x2cb8('0xc2'),{'UserId':Number(_0xbdf51a[_0x2cb8('0x68')]['ids'][_0x4b564e]),'MailAccountId':Number(_0xbdf51a[_0x2cb8('0x6a')]['id'])});}return _0x23a9d3;});}})[_0x2cb8('0x14')](respondWithResult(_0x25b376,null))['catch'](handleError(_0x25b376,null));};exports[_0x2cb8('0xc3')]=function(_0x5eea99,_0x1dd068){return db[_0x2cb8('0x5f')]['find']({'where':{'id':_0x5eea99[_0x2cb8('0x6a')]['id']}})[_0x2cb8('0x14')](handleEntityNotFound(_0x1dd068,null))[_0x2cb8('0x14')](function(_0x4ceb7b){if(_0x4ceb7b){return _0x4ceb7b['removeAgents'](_0x5eea99[_0x2cb8('0x4d')]['ids'])[_0x2cb8('0x14')](function(){if(_['isArray'](_0x5eea99[_0x2cb8('0x4d')][_0x2cb8('0x73')])){for(var _0x6b6faf=0x0;_0x6b6faf<_0x5eea99[_0x2cb8('0x4d')][_0x2cb8('0x73')][_0x2cb8('0x53')];_0x6b6faf+=0x1){socket[_0x2cb8('0xc1')]('userMailAccount:remove',{'UserId':Number(_0x5eea99[_0x2cb8('0x4d')][_0x2cb8('0x73')][_0x6b6faf]),'MailAccountId':Number(_0x5eea99[_0x2cb8('0x6a')]['id'])});}}else{socket[_0x2cb8('0xc1')](_0x2cb8('0xc4'),{'UserId':Number(_0x5eea99[_0x2cb8('0x4d')][_0x2cb8('0x73')]),'MailAccountId':Number(_0x5eea99['params']['id'])});}});}})[_0x2cb8('0x14')](respondWithStatusCode(_0x1dd068,null))[_0x2cb8('0x65')](handleError(_0x1dd068,null));};exports[_0x2cb8('0xc5')]=function(_0x308cad,_0x153cc1){var _0x26c7a4={};var _0x2085a8={};var _0x247a0e;var _0x22eb55;return db[_0x2cb8('0x5f')]['findOne']({'where':{'id':_0x308cad[_0x2cb8('0x6a')]['id']}})[_0x2cb8('0x14')](handleEntityNotFound(_0x153cc1,null))[_0x2cb8('0x14')](function(_0x2c96a0){if(_0x2c96a0){_0x247a0e=_0x2c96a0;_0x2085a8[_0x2cb8('0x63')]=_[_0x2cb8('0x4e')](db['User'][_0x2cb8('0x64')]);_0x2085a8[_0x2cb8('0x4d')]=_[_0x2cb8('0x4e')](_0x308cad['query']);_0x2085a8[_0x2cb8('0x4f')]=_[_0x2cb8('0x50')](_0x2085a8[_0x2cb8('0x63')],_0x2085a8[_0x2cb8('0x4d')]);_0x26c7a4[_0x2cb8('0x52')]=_[_0x2cb8('0x50')](_0x2085a8[_0x2cb8('0x63')],qs[_0x2cb8('0x51')](_0x308cad[_0x2cb8('0x4d')][_0x2cb8('0x51')]));_0x26c7a4[_0x2cb8('0x52')]=_0x26c7a4[_0x2cb8('0x52')][_0x2cb8('0x53')]?_0x26c7a4[_0x2cb8('0x52')]:_0x2085a8[_0x2cb8('0x63')];_0x26c7a4[_0x2cb8('0x71')]=qs['sort'](_0x308cad['query'][_0x2cb8('0x55')]);_0x26c7a4[_0x2cb8('0x56')]=qs[_0x2cb8('0x4f')](_[_0x2cb8('0x57')](_0x308cad[_0x2cb8('0x4d')],_0x2085a8[_0x2cb8('0x4f')]));if(_0x308cad[_0x2cb8('0x4d')]['filter']){_0x26c7a4['where']=_[_0x2cb8('0x59')](_0x26c7a4[_0x2cb8('0x56')],{'$or':_[_0x2cb8('0x4b')](_0x26c7a4[_0x2cb8('0x52')],function(_0x5af97d){var _0x4eda97={};_0x4eda97[_0x5af97d]={'$like':'%'+_0x308cad[_0x2cb8('0x4d')][_0x2cb8('0x58')]+'%'};return _0x4eda97;})});}_0x26c7a4=_['merge']({},_0x26c7a4,_0x308cad[_0x2cb8('0x5b')]);return _0x247a0e[_0x2cb8('0xc5')](_0x26c7a4);}})[_0x2cb8('0x14')](function(_0x28972d){if(_0x28972d){_0x22eb55=_0x28972d[_0x2cb8('0x53')];if(!_0x308cad[_0x2cb8('0x4d')]['hasOwnProperty']('nolimit')){_0x26c7a4[_0x2cb8('0x23')]=qs[_0x2cb8('0x23')](_0x308cad[_0x2cb8('0x4d')][_0x2cb8('0x23')]);_0x26c7a4[_0x2cb8('0x24')]=qs[_0x2cb8('0x24')](_0x308cad[_0x2cb8('0x4d')]['offset']);}return _0x247a0e[_0x2cb8('0xc5')](_0x26c7a4);}})[_0x2cb8('0x14')](function(_0x361ed7){if(_0x361ed7){return _0x361ed7?{'count':_0x22eb55,'rows':_0x361ed7}:null;}})[_0x2cb8('0x14')](respondWithResult(_0x153cc1,null))[_0x2cb8('0x65')](handleError(_0x153cc1,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 3dab18f..834b7be 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 _0xee3c=['events','../../mysqldb','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xee3c,0x14a));var _0xcee3=function(_0xe12c5,_0x4b3200){_0xe12c5=_0xe12c5-0x0;var _0x49bcd2=_0xee3c[_0xe12c5];return _0x49bcd2;};'use strict';var EventEmitter=require(_0xcee3('0x0'));var MailAccount=require(_0xcee3('0x1'))['db'][_0xcee3('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xcee3('0x3')](0x0);var events={'afterCreate':_0xcee3('0x4'),'afterUpdate':_0xcee3('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4a7681){return function(_0x435892,_0x4cd398,_0x39d2a8){MailAccountEvents[_0xcee3('0x6')](_0x4a7681+':'+_0x435892['id'],_0x435892);MailAccountEvents[_0xcee3('0x6')](_0x4a7681,_0x435892);_0x39d2a8(null);};}for(var e in events){if(events[_0xcee3('0x7')](e)){var event=events[e];MailAccount[_0xcee3('0x8')](e,emitEvent(event));}}module[_0xcee3('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x7d2a=['exports','events','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7d2a,0x171));var _0xa7d2=function(_0x25ebb9,_0x22f211){_0x25ebb9=_0x25ebb9-0x0;var _0x4d33db=_0x7d2a[_0x25ebb9];return _0x4d33db;};'use strict';var EventEmitter=require(_0xa7d2('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa7d2('0x1')](0x0);var events={'afterCreate':_0xa7d2('0x2'),'afterUpdate':'update','afterDestroy':_0xa7d2('0x3')};function emitEvent(_0xe4ec5c){return function(_0x85249b,_0x581ad3,_0x4f2e92){MailAccountEvents[_0xa7d2('0x4')](_0xe4ec5c+':'+_0x85249b['id'],_0x85249b);MailAccountEvents[_0xa7d2('0x4')](_0xe4ec5c,_0x85249b);_0x4f2e92(null);};}for(var e in events){if(events[_0xa7d2('0x5')](e)){var event=events[e];MailAccount[_0xa7d2('0x6')](e,emitEvent(event));}}module[_0xa7d2('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 1708894..f2b6cdf 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 _0x4f09=['Smtp','authentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','./mailAccount.attributes','exports','define','provider','custom','service','host','port','secure'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4f09,0x105));var _0x94f0=function(_0x22e837,_0x422c68){_0x22e837=_0x22e837-0x0;var _0x4e87cc=_0x4f09[_0x22e837];return _0x4e87cc;};'use strict';var attributes=require(_0x94f0('0x0'));module[_0x94f0('0x1')]=function(_0x397efe){return _0x397efe[_0x94f0('0x2')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2b26f6=this;var _0x58864a={'id':_0x2b26f6['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2b26f6[_0x94f0('0x3')]!==_0x94f0('0x4')){_0x58864a[_0x94f0('0x5')]=_0x2b26f6[_0x94f0('0x3')];}else{_0x58864a[_0x94f0('0x6')]=_0x2b26f6['Smtp']['host'];_0x58864a[_0x94f0('0x7')]=_0x2b26f6['Smtp'][_0x94f0('0x7')];_0x58864a[_0x94f0('0x8')]=_0x2b26f6[_0x94f0('0x9')][_0x94f0('0x8')];}if(_0x2b26f6['Smtp'][_0x94f0('0xa')]){if(_0x2b26f6[_0x94f0('0x9')]['modernAuthentication']){if(!_0x2b26f6[_0x94f0('0x9')][_0x94f0('0xb')])throw new Error(_0x94f0('0xc'));_0x58864a[_0x94f0('0xd')]={'type':'OAuth2','user':_0x2b26f6[_0x94f0('0x9')][_0x94f0('0xe')],'accessToken':_0x2b26f6['Smtp'][_0x94f0('0xb')]['data5']};}else{_0x58864a[_0x94f0('0xd')]={'user':_0x2b26f6[_0x94f0('0x9')]['user'],'pass':_0x2b26f6['Smtp']['pass']};}}return _0x58864a;}}});}; \ No newline at end of file +var _0x1ac8=['Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','Smtp','data5','user','pass','./mailAccount.attributes','define','MailAccount','mail_accounts','service','provider','host','port','secure','authentication','CloudProvider'];(function(_0x385d93,_0x1e95c3){var _0x1f30ba=function(_0x8695bc){while(--_0x8695bc){_0x385d93['push'](_0x385d93['shift']());}};_0x1f30ba(++_0x1e95c3);}(_0x1ac8,0x16f));var _0x81ac=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1ac8[_0x4a9fb1];return _0x348672;};'use strict';var attributes=require(_0x81ac('0x0'));module['exports']=function(_0xc41f4){return _0xc41f4[_0x81ac('0x1')](_0x81ac('0x2'),attributes,{'tableName':_0x81ac('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x39bbb5=this;var _0x522175={'id':_0x39bbb5['id'],'tls':{'rejectUnauthorized':![]}};if(_0x39bbb5['provider']!=='custom'){_0x522175[_0x81ac('0x4')]=_0x39bbb5[_0x81ac('0x5')];}else{_0x522175[_0x81ac('0x6')]=_0x39bbb5['Smtp']['host'];_0x522175[_0x81ac('0x7')]=_0x39bbb5['Smtp'][_0x81ac('0x7')];_0x522175[_0x81ac('0x8')]=_0x39bbb5['Smtp']['secure'];}if(_0x39bbb5['Smtp'][_0x81ac('0x9')]){if(_0x39bbb5['Smtp']['modernAuthentication']){if(!_0x39bbb5['Smtp'][_0x81ac('0xa')])throw new Error(_0x81ac('0xb'));_0x522175[_0x81ac('0xc')]={'type':_0x81ac('0xd'),'user':_0x39bbb5[_0x81ac('0xe')]['user'],'accessToken':_0x39bbb5[_0x81ac('0xe')]['CloudProvider'][_0x81ac('0xf')]};}else{_0x522175['auth']={'user':_0x39bbb5[_0x81ac('0xe')][_0x81ac('0x10')],'pass':_0x39bbb5[_0x81ac('0xe')][_0x81ac('0x11')]};}}return _0x522175;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index ed01d3b..bd51125 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 _0x2542=['MailServerOut','Smtp','CloudProvider','get','omit','getSmtpOptions','applications','list','orderBy','priority','asc','push','length','*,*,*,*','Contacts','contact','messageId','generate','attach','format','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','originCc','ChatWebsiteId','originChannel','Email','Attachment','UserId','User','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','map','include','model','ShowMailAccount','find','where','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','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','account','CmList','List','CmContact','DESC','MailApplication','Applications'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x2542,0x169));var _0x2254=function(_0x5da05b,_0x282251){_0x5da05b=_0x5da05b-0x0;var _0x2d5689=_0x2542[_0x5da05b];return _0x2d5689;};'use strict';var _=require(_0x2254('0x0'));var moment=require(_0x2254('0x1'));var BPromise=require(_0x2254('0x2'));var rs=require(_0x2254('0x3'));var Redis=require('ioredis');var db=require(_0x2254('0x4'))['db'];var logger=require('../../config/logger')(_0x2254('0x5'));var config=require(_0x2254('0x6'));var jayson=require(_0x2254('0x7'));var client=jayson[_0x2254('0x8')][_0x2254('0x9')]({'port':0x232c});config['redis']=_[_0x2254('0xa')](config[_0x2254('0xb')],{'host':_0x2254('0xc'),'port':0x18eb});var socket=require(_0x2254('0xd'))(new Redis(config[_0x2254('0xb')]));require(_0x2254('0xe'))[_0x2254('0xf')](socket);function respondWithRpcPromise(_0xbf1c18,_0xb395da,_0x1ae415){return new BPromise(function(_0x38fb2b,_0x5b1ab9){return client[_0x2254('0x10')](_0xbf1c18,_0x1ae415)[_0x2254('0x11')](function(_0x506abe){logger[_0x2254('0x12')]('MailAccount,\x20%s,\x20%s',_0xb395da,'request\x20sent');logger[_0x2254('0x13')](_0x2254('0x14'),_0xb395da,_0x2254('0x15'),JSON[_0x2254('0x16')](_0x506abe));if(_0x506abe[_0x2254('0x17')]){if(_0x506abe[_0x2254('0x17')]['code']===0x1f4){logger[_0x2254('0x17')](_0x2254('0x18'),_0xb395da,_0x506abe['error'][_0x2254('0x19')]);return _0x5b1ab9(_0x506abe[_0x2254('0x17')][_0x2254('0x19')]);}logger[_0x2254('0x17')](_0x2254('0x18'),_0xb395da,_0x506abe[_0x2254('0x17')]['message']);return _0x38fb2b(_0x506abe[_0x2254('0x17')]['message']);}else{logger[_0x2254('0x12')](_0x2254('0x18'),_0xb395da,_0x2254('0x15'));_0x38fb2b(_0x506abe[_0x2254('0x1a')][_0x2254('0x19')]);}})[_0x2254('0x1b')](function(_0x497724){logger['error']('MailAccount,\x20%s,\x20%s',_0xb395da,_0x497724);_0x5b1ab9(_0x497724);});});}exports[_0x2254('0x1c')]=function(_0x3a79f8){var _0x3c3a98=this;return new Promise(function(_0x1f1163,_0x2801d9){return db[_0x2254('0x1d')]['findAll']({'raw':_0x3a79f8[_0x2254('0x1e')]?_0x3a79f8[_0x2254('0x1e')][_0x2254('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a79f8['options']?_0x3a79f8['options']['where']||null:null,'attributes':_0x3a79f8[_0x2254('0x1e')]?_0x3a79f8[_0x2254('0x1e')][_0x2254('0x20')]||null:null,'limit':_0x3a79f8['options']?_0x3a79f8['options']['limit']||null:null,'include':_0x3a79f8['options']?_0x3a79f8['options']['include']?_[_0x2254('0x21')](_0x3a79f8[_0x2254('0x1e')][_0x2254('0x22')],function(_0x265467){return{'model':db[_0x265467[_0x2254('0x23')]],'as':_0x265467['as'],'attributes':_0x265467[_0x2254('0x20')],'include':_0x265467['include']?_['map'](_0x265467[_0x2254('0x22')],function(_0x4f6877){return{'model':db[_0x4f6877[_0x2254('0x23')]],'as':_0x4f6877['as'],'attributes':_0x4f6877[_0x2254('0x20')],'include':_0x4f6877[_0x2254('0x22')]?_[_0x2254('0x21')](_0x4f6877[_0x2254('0x22')],function(_0x482688){return{'model':db[_0x482688[_0x2254('0x23')]],'as':_0x482688['as'],'attributes':_0x482688[_0x2254('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2254('0x11')](function(_0x37af8b){logger[_0x2254('0x12')](_0x2254('0x1c'),_0x3a79f8);logger[_0x2254('0x13')](_0x2254('0x1c'),_0x3a79f8,JSON[_0x2254('0x16')](_0x37af8b));_0x1f1163(_0x37af8b);})[_0x2254('0x1b')](function(_0x21c641){logger[_0x2254('0x17')](_0x2254('0x1c'),_0x21c641[_0x2254('0x19')],_0x3a79f8);_0x2801d9(_0x3c3a98[_0x2254('0x17')](0x1f4,_0x21c641[_0x2254('0x19')]));});});};exports[_0x2254('0x24')]=function(_0x291894){var _0x2f32f8=this;return new Promise(function(_0x4e3658,_0xe29526){return db[_0x2254('0x1d')][_0x2254('0x25')]({'raw':_0x291894[_0x2254('0x1e')]?_0x291894[_0x2254('0x1e')][_0x2254('0x1f')]===undefined?!![]:![]:!![],'where':_0x291894[_0x2254('0x1e')]?_0x291894[_0x2254('0x1e')][_0x2254('0x26')]||null:null,'attributes':_0x291894['options']?_0x291894[_0x2254('0x1e')][_0x2254('0x20')]||null:null,'include':_0x291894['options']?_0x291894[_0x2254('0x1e')][_0x2254('0x22')]?_[_0x2254('0x21')](_0x291894[_0x2254('0x1e')]['include'],function(_0x4a2df0){return{'model':db[_0x4a2df0[_0x2254('0x23')]],'as':_0x4a2df0['as'],'attributes':_0x4a2df0['attributes'],'include':_0x4a2df0[_0x2254('0x22')]?_[_0x2254('0x21')](_0x4a2df0[_0x2254('0x22')],function(_0x141ddc){return{'model':db[_0x141ddc[_0x2254('0x23')]],'as':_0x141ddc['as'],'attributes':_0x141ddc[_0x2254('0x20')],'include':_0x141ddc[_0x2254('0x22')]?_['map'](_0x141ddc[_0x2254('0x22')],function(_0x192e9f){return{'model':db[_0x192e9f[_0x2254('0x23')]],'as':_0x192e9f['as'],'attributes':_0x192e9f[_0x2254('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2254('0x11')](function(_0x3f6007){if(_0x291894[_0x2254('0x1e')][_0x2254('0x27')]===!![])_0x3f6007[_0x2254('0x28')](_0x2254('0x29'),_0x3f6007['getSmtpOptions']());logger[_0x2254('0x12')](_0x2254('0x24'),_0x291894);logger[_0x2254('0x13')](_0x2254('0x24'),_0x291894,JSON['stringify'](_0x3f6007));_0x4e3658(_0x3f6007);})[_0x2254('0x1b')](function(_0x160fec){logger[_0x2254('0x17')](_0x2254('0x24'),_0x160fec[_0x2254('0x19')],_0x291894);_0xe29526(_0x2f32f8[_0x2254('0x17')](0x1f4,_0x160fec[_0x2254('0x19')]));});});};exports[_0x2254('0x2a')]=function(_0x4db9a8){var _0x362ad1=this;return new Promise(function(_0x5c15d7,_0x1df9c3){var _0x19b580={'body':_0x4db9a8[_0x2254('0x2b')],'channel':_0x2254('0x2c')};var _0x460bb3=_[_0x2254('0x2d')](_[_0x2254('0x2e')](db['CmContact'][_0x2254('0x2f')]),[_0x2254('0x30'),_0x2254('0x31'),_0x2254('0x32'),_0x2254('0x33')]);var _0x57cda2=![];if(_0x4db9a8[_0x2254('0x2b')]['id']){delete _0x4db9a8[_0x2254('0x2b')]['id'];}if(_[_0x2254('0x34')](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')])){return _0x1df9c3(_0x362ad1['error'](0x1f4,_0x2254('0x36')));}if(_['isNil'](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x2b')])||_0x4db9a8[_0x2254('0x2b')][_0x2254('0x2b')]===''){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x37')));}if(_[_0x2254('0x34')](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x38')])){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x39')+_0x460bb3));}if(!_[_0x2254('0x3a')](_0x460bb3,_0x4db9a8[_0x2254('0x2b')]['mapKey'])){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x3b')+_0x460bb3));}var _0x2c5609={};_0x2c5609[_0x4db9a8['body'][_0x2254('0x38')]]=_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')];return db[_0x2254('0x1d')][_0x2254('0x25')]({'where':{'id':_0x4db9a8[_0x2254('0x3c')]['id']},'include':[{'model':db[_0x2254('0x3d')],'as':_0x2254('0x3e'),'include':[{'model':db[_0x2254('0x3f')],'as':'Contacts','where':_0x2c5609,'limit':0x1,'order':[[_0x2254('0x31'),_0x2254('0x40')]]}]},{'model':db[_0x2254('0x41')],'as':_0x2254('0x42')},{'model':db[_0x2254('0x43')],'as':_0x2254('0x44'),'include':[{'model':db[_0x2254('0x45')],'as':_0x2254('0x45')}]}]})[_0x2254('0x11')](function(_0xa103ea){if(_0xa103ea&&_0xa103ea['List']){var _0x36b977=_0xa103ea[_0x2254('0x46')]({'plain':!![]});_0x19b580['account']=_[_0x2254('0x47')](_0x36b977,[_0x2254('0x42'),_0x2254('0x3e')]);_0x19b580[_0x2254('0x3c')]['smtpOptions']=_0xa103ea[_0x2254('0x48')]();_0x19b580[_0x2254('0x49')]=_0x36b977['Applications'];_0x19b580[_0x2254('0x4a')]=_0x36b977[_0x2254('0x3e')];_0x19b580[_0x2254('0x49')]=_[_0x2254('0x4b')](_0x19b580['applications'],[_0x2254('0x4c')],[_0x2254('0x4d')]);if(_0x19b580[_0x2254('0x3c')]&&_0x19b580['account']['autoclose']){_0x19b580[_0x2254('0x49')][_0x2254('0x4e')]({'id':0x0,'priority':_0x19b580['applications'][_0x2254('0x4f')]+0x1,'app':'close','appdata':'autoclose','interval':_0x2254('0x50')});}if(_0x19b580[_0x2254('0x3c')][_0x2254('0x42')]){delete _0x19b580[_0x2254('0x3c')][_0x2254('0x42')];}if(_0x19b580['account']['List']){delete _0x19b580[_0x2254('0x3c')]['List'];}if(_0x36b977[_0x2254('0x3e')][_0x2254('0x51')][_0x2254('0x4f')]){return _0x36b977[_0x2254('0x3e')]['Contacts'][0x0];}var _0xd5fb20=_[_0x2254('0xa')](_0x4db9a8['body'],{'firstName':_0x4db9a8['body'][_0x2254('0x35')],'ListId':_0x36b977['ListId']});_0xd5fb20[_0x4db9a8[_0x2254('0x2b')][_0x2254('0x38')]]=_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')];return db[_0x2254('0x3f')]['create'](_0xd5fb20);}else{throw new Error('List\x20not\x20found');}})[_0x2254('0x11')](function(_0x5b1bd8){_0x19b580[_0x2254('0x52')]=_0x5b1bd8;if(_0x5b1bd8){if(!_0x4db9a8['body']['message']['messageId']){_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x53')]=rs[_0x2254('0x54')]()+'\x20'+_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x35')];}var _0x25137c={'ContactId':_0x5b1bd8['id'],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id'],'inReplyTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x53')],'to':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x35')],'cc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['cc'],'subject':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['subject'],'attach':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'lastMsgAt':moment()[_0x2254('0x56')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x2254('0x25')]({'where':{'closed':![],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id']},'include':[{'model':db[_0x2254('0x57')],'as':_0x2254('0x58'),'attributes':[_0x2254('0x53')],'where':{'messageId':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x59')]}}]})[_0x2254('0x11')](function(_0x4a7d36){if(_0x4a7d36){return[_0x4a7d36,![]];}return db['MailInteraction'][_0x2254('0x5a')](_0x25137c)['then'](function(_0x294931){return[_0x294931,!![]];});});}else{throw new Error(_0x2254('0x5b'));}})['spread'](function(_0x3c091e,_0x1b154f){if(_0x3c091e){_0x57cda2=_0x1b154f;if(!_0x1b154f){return _0x3c091e['update']({'inReplyTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['messageId'],'to':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x35')],'cc':_0x4db9a8['body']['message']['cc'],'subject':_0x4db9a8[_0x2254('0x2b')]['message'][_0x2254('0x5c')],'attach':_0x3c091e['attach']?_0x3c091e[_0x2254('0x55')]:_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'substatus':null,'substatusAt':moment()['format'](_0x2254('0x5d')),'lastMsgAt':moment()['format'](_0x2254('0x5d')),'lastMsgDirection':'in'});}else{return _0x3c091e;}}})[_0x2254('0x11')](function(_0x5ed07f){_0x19b580[_0x2254('0x5e')]=_0x5ed07f[_0x2254('0x46')]({'plain':!![]});_0x19b580['interaction'][_0x2254('0x5f')]=_0x57cda2;return db[_0x2254('0x57')][_0x2254('0x5a')]({'body':_0x4db9a8[_0x2254('0x2b')]['body'],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id'],'MailInteractionId':_0x5ed07f['id'],'direction':'in','ContactId':_0x19b580[_0x2254('0x52')]['id'],'messageId':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x53')],'from':_0x4db9a8['body'][_0x2254('0x19')]['from'],'to':_0x4db9a8[_0x2254('0x2b')]['message']['to'],'cc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['cc'],'subject':_0x4db9a8['body'][_0x2254('0x19')]['subject'],'attach':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'Attachments':_0x4db9a8['body'][_0x2254('0x19')]['attachments'],'originTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['originTo'],'originCc':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x60')],'bcc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['bcc'],'ChatWebsiteId':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x61')]||null,'originChannel':_0x4db9a8[_0x2254('0x2b')]['message'][_0x2254('0x62')]||_0x2254('0x63'),'ChatOfflineMessageId':_0x4db9a8['body'][_0x2254('0x19')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x2254('0x64')],'as':'Attachments'}]});})['then'](function(_0x4efb07){_0x19b580[_0x2254('0x19')]=_0x4efb07;if(_0x19b580['interaction'][_0x2254('0x65')]){return db[_0x2254('0x66')]['find']({'attributes':['id',_0x2254('0x67')],'where':{'id':_0x19b580[_0x2254('0x5e')][_0x2254('0x65')]}})[_0x2254('0x11')](function(_0x259e10){if(_0x259e10){_0x19b580[_0x2254('0x49')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x259e10[_0x2254('0x67')]+','+(_0x19b580[_0x2254('0x3c')][_0x2254('0x68')]||0xa),'interval':_0x2254('0x50')});}return respondWithRpcPromise(_0x2254('0x69'),_0x2254('0x6a'),_0x19b580);});}return respondWithRpcPromise(_0x2254('0x69'),_0x2254('0x6a'),_0x19b580);})[_0x2254('0x11')](function(_0x39b95b){_0x5c15d7(_0x39b95b);})['catch'](function(_0x25eb17){_0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x25eb17['message']));});});}; \ No newline at end of file +var _0xc6ac=['update','interaction','created','contact','attachments','originTo','bcc','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','limit','include','map','attributes','model','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','applications','list','orderBy','priority','asc','autoclose','length','*,*,*,*','Contacts','create','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread'];(function(_0x179a0c,_0x2ca073){var _0x1c8b9a=function(_0xfa6124){while(--_0xfa6124){_0x179a0c['push'](_0x179a0c['shift']());}};_0x1c8b9a(++_0x2ca073);}(_0xc6ac,0x15b));var _0xcc6a=function(_0xb8baf6,_0x37a7c2){_0xb8baf6=_0xb8baf6-0x0;var _0x26a568=_0xc6ac[_0xb8baf6];return _0x26a568;};'use strict';var _=require(_0xcc6a('0x0'));var moment=require(_0xcc6a('0x1'));var BPromise=require(_0xcc6a('0x2'));var rs=require(_0xcc6a('0x3'));var Redis=require(_0xcc6a('0x4'));var db=require(_0xcc6a('0x5'))['db'];var logger=require(_0xcc6a('0x6'))(_0xcc6a('0x7'));var config=require(_0xcc6a('0x8'));var jayson=require(_0xcc6a('0x9'));var client=jayson[_0xcc6a('0xa')][_0xcc6a('0xb')]({'port':0x232c});config[_0xcc6a('0xc')]=_[_0xcc6a('0xd')](config['redis'],{'host':_0xcc6a('0xe'),'port':0x18eb});var socket=require(_0xcc6a('0xf'))(new Redis(config[_0xcc6a('0xc')]));require('./mailAccount.socket')[_0xcc6a('0x10')](socket);function respondWithRpcPromise(_0x210f63,_0x7806a0,_0x463ebb){return new BPromise(function(_0x3eb04a,_0x5e91a2){return client[_0xcc6a('0x11')](_0x210f63,_0x463ebb)[_0xcc6a('0x12')](function(_0x109693){logger['info'](_0xcc6a('0x13'),_0x7806a0,_0xcc6a('0x14'));logger[_0xcc6a('0x15')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x7806a0,'request\x20sent',JSON[_0xcc6a('0x16')](_0x109693));if(_0x109693[_0xcc6a('0x17')]){if(_0x109693[_0xcc6a('0x17')]['code']===0x1f4){logger['error'](_0xcc6a('0x13'),_0x7806a0,_0x109693[_0xcc6a('0x17')][_0xcc6a('0x18')]);return _0x5e91a2(_0x109693[_0xcc6a('0x17')][_0xcc6a('0x18')]);}logger[_0xcc6a('0x17')](_0xcc6a('0x13'),_0x7806a0,_0x109693[_0xcc6a('0x17')]['message']);return _0x3eb04a(_0x109693['error']['message']);}else{logger[_0xcc6a('0x19')](_0xcc6a('0x13'),_0x7806a0,_0xcc6a('0x14'));_0x3eb04a(_0x109693[_0xcc6a('0x1a')][_0xcc6a('0x18')]);}})[_0xcc6a('0x1b')](function(_0x2d9585){logger[_0xcc6a('0x17')](_0xcc6a('0x13'),_0x7806a0,_0x2d9585);_0x5e91a2(_0x2d9585);});});}exports[_0xcc6a('0x1c')]=function(_0x1d20a3){var _0x5b657e=this;return new Promise(function(_0xfec60f,_0x3e1fda){return db[_0xcc6a('0x1d')][_0xcc6a('0x1e')]({'raw':_0x1d20a3[_0xcc6a('0x1f')]?_0x1d20a3[_0xcc6a('0x1f')][_0xcc6a('0x20')]===undefined?!![]:![]:!![],'where':_0x1d20a3[_0xcc6a('0x1f')]?_0x1d20a3[_0xcc6a('0x1f')][_0xcc6a('0x21')]||null:null,'attributes':_0x1d20a3[_0xcc6a('0x1f')]?_0x1d20a3[_0xcc6a('0x1f')]['attributes']||null:null,'limit':_0x1d20a3[_0xcc6a('0x1f')]?_0x1d20a3[_0xcc6a('0x1f')][_0xcc6a('0x22')]||null:null,'include':_0x1d20a3['options']?_0x1d20a3[_0xcc6a('0x1f')][_0xcc6a('0x23')]?_[_0xcc6a('0x24')](_0x1d20a3[_0xcc6a('0x1f')][_0xcc6a('0x23')],function(_0x5fc697){return{'model':db[_0x5fc697['model']],'as':_0x5fc697['as'],'attributes':_0x5fc697[_0xcc6a('0x25')],'include':_0x5fc697[_0xcc6a('0x23')]?_[_0xcc6a('0x24')](_0x5fc697['include'],function(_0x3afb3a){return{'model':db[_0x3afb3a[_0xcc6a('0x26')]],'as':_0x3afb3a['as'],'attributes':_0x3afb3a['attributes'],'include':_0x3afb3a[_0xcc6a('0x23')]?_[_0xcc6a('0x24')](_0x3afb3a[_0xcc6a('0x23')],function(_0x473f88){return{'model':db[_0x473f88['model']],'as':_0x473f88['as'],'attributes':_0x473f88[_0xcc6a('0x25')]};}):[]};}):[]};}):[]:[]})[_0xcc6a('0x12')](function(_0x2c6d88){logger['info'](_0xcc6a('0x1c'),_0x1d20a3);logger['debug']('GetMailAccount',_0x1d20a3,JSON[_0xcc6a('0x16')](_0x2c6d88));_0xfec60f(_0x2c6d88);})[_0xcc6a('0x1b')](function(_0x3aa315){logger[_0xcc6a('0x17')](_0xcc6a('0x1c'),_0x3aa315[_0xcc6a('0x18')],_0x1d20a3);_0x3e1fda(_0x5b657e['error'](0x1f4,_0x3aa315[_0xcc6a('0x18')]));});});};exports[_0xcc6a('0x27')]=function(_0x147aff){var _0x2faeb5=this;return new Promise(function(_0x211a8c,_0x152ebd){return db[_0xcc6a('0x1d')][_0xcc6a('0x28')]({'raw':_0x147aff['options']?_0x147aff[_0xcc6a('0x1f')][_0xcc6a('0x20')]===undefined?!![]:![]:!![],'where':_0x147aff[_0xcc6a('0x1f')]?_0x147aff[_0xcc6a('0x1f')][_0xcc6a('0x21')]||null:null,'attributes':_0x147aff[_0xcc6a('0x1f')]?_0x147aff[_0xcc6a('0x1f')]['attributes']||null:null,'include':_0x147aff[_0xcc6a('0x1f')]?_0x147aff['options']['include']?_['map'](_0x147aff[_0xcc6a('0x1f')][_0xcc6a('0x23')],function(_0x1101ec){return{'model':db[_0x1101ec[_0xcc6a('0x26')]],'as':_0x1101ec['as'],'attributes':_0x1101ec[_0xcc6a('0x25')],'include':_0x1101ec['include']?_['map'](_0x1101ec[_0xcc6a('0x23')],function(_0x11173a){return{'model':db[_0x11173a[_0xcc6a('0x26')]],'as':_0x11173a['as'],'attributes':_0x11173a['attributes'],'include':_0x11173a[_0xcc6a('0x23')]?_[_0xcc6a('0x24')](_0x11173a[_0xcc6a('0x23')],function(_0xa326b2){return{'model':db[_0xa326b2[_0xcc6a('0x26')]],'as':_0xa326b2['as'],'attributes':_0xa326b2[_0xcc6a('0x25')]};}):[]};}):[]};}):[]:[]})[_0xcc6a('0x12')](function(_0x18a252){if(_0x147aff[_0xcc6a('0x1f')][_0xcc6a('0x29')]===!![])_0x18a252[_0xcc6a('0x2a')](_0xcc6a('0x2b'),_0x18a252[_0xcc6a('0x2c')]());logger[_0xcc6a('0x19')](_0xcc6a('0x27'),_0x147aff);logger[_0xcc6a('0x15')](_0xcc6a('0x27'),_0x147aff,JSON[_0xcc6a('0x16')](_0x18a252));_0x211a8c(_0x18a252);})['catch'](function(_0x553e66){logger[_0xcc6a('0x17')](_0xcc6a('0x27'),_0x553e66[_0xcc6a('0x18')],_0x147aff);_0x152ebd(_0x2faeb5[_0xcc6a('0x17')](0x1f4,_0x553e66[_0xcc6a('0x18')]));});});};exports[_0xcc6a('0x2d')]=function(_0x3273bc){var _0x1199f1=this;return new Promise(function(_0x49b65c,_0x56bc7d){var _0x470e3b={'body':_0x3273bc['body'],'channel':'mail'};var _0x5cf1ba=_[_0xcc6a('0x2e')](_[_0xcc6a('0x2f')](db[_0xcc6a('0x30')][_0xcc6a('0x31')]),[_0xcc6a('0x32'),'updatedAt',_0xcc6a('0x33'),_0xcc6a('0x34')]);var _0x17e5a0=![];if(_0x3273bc[_0xcc6a('0x35')]['id']){delete _0x3273bc[_0xcc6a('0x35')]['id'];}if(_[_0xcc6a('0x36')](_0x3273bc['body'][_0xcc6a('0x37')])){return _0x56bc7d(_0x1199f1[_0xcc6a('0x17')](0x1f4,_0xcc6a('0x38')));}if(_[_0xcc6a('0x36')](_0x3273bc['body'][_0xcc6a('0x35')])||_0x3273bc['body'][_0xcc6a('0x35')]===''){return _0x56bc7d(_0x1199f1[_0xcc6a('0x17')](0x1f4,_0xcc6a('0x39')));}if(_['isNil'](_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x3a')])){return _0x56bc7d(_0x1199f1[_0xcc6a('0x17')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5cf1ba));}if(!_['includes'](_0x5cf1ba,_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x3a')])){return _0x56bc7d(_0x1199f1[_0xcc6a('0x17')](0x1f4,_0xcc6a('0x3b')+_0x5cf1ba));}var _0x345e94={};_0x345e94[_0x3273bc['body'][_0xcc6a('0x3a')]]=_0x3273bc[_0xcc6a('0x35')]['from'];return db[_0xcc6a('0x1d')][_0xcc6a('0x28')]({'where':{'id':_0x3273bc[_0xcc6a('0x3c')]['id']},'include':[{'model':db[_0xcc6a('0x3d')],'as':_0xcc6a('0x3e'),'include':[{'model':db[_0xcc6a('0x30')],'as':'Contacts','where':_0x345e94,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xcc6a('0x3f')],'as':_0xcc6a('0x40')},{'model':db[_0xcc6a('0x41')],'as':_0xcc6a('0x42'),'include':[{'model':db['CloudProvider'],'as':_0xcc6a('0x43')}]}]})['then'](function(_0x3aa7dd){if(_0x3aa7dd&&_0x3aa7dd[_0xcc6a('0x3e')]){var _0xcfc540=_0x3aa7dd[_0xcc6a('0x44')]({'plain':!![]});_0x470e3b[_0xcc6a('0x3c')]=_[_0xcc6a('0x45')](_0xcfc540,['Applications',_0xcc6a('0x3e')]);_0x470e3b[_0xcc6a('0x3c')][_0xcc6a('0x2b')]=_0x3aa7dd[_0xcc6a('0x2c')]();_0x470e3b[_0xcc6a('0x46')]=_0xcfc540[_0xcc6a('0x40')];_0x470e3b[_0xcc6a('0x47')]=_0xcfc540[_0xcc6a('0x3e')];_0x470e3b[_0xcc6a('0x46')]=_[_0xcc6a('0x48')](_0x470e3b['applications'],[_0xcc6a('0x49')],[_0xcc6a('0x4a')]);if(_0x470e3b[_0xcc6a('0x3c')]&&_0x470e3b[_0xcc6a('0x3c')][_0xcc6a('0x4b')]){_0x470e3b[_0xcc6a('0x46')]['push']({'id':0x0,'priority':_0x470e3b['applications'][_0xcc6a('0x4c')]+0x1,'app':'close','appdata':_0xcc6a('0x4b'),'interval':_0xcc6a('0x4d')});}if(_0x470e3b[_0xcc6a('0x3c')][_0xcc6a('0x40')]){delete _0x470e3b[_0xcc6a('0x3c')][_0xcc6a('0x40')];}if(_0x470e3b[_0xcc6a('0x3c')][_0xcc6a('0x3e')]){delete _0x470e3b[_0xcc6a('0x3c')][_0xcc6a('0x3e')];}if(_0xcfc540[_0xcc6a('0x3e')]['Contacts'][_0xcc6a('0x4c')]){return _0xcfc540['List'][_0xcc6a('0x4e')][0x0];}var _0x1570fe=_[_0xcc6a('0xd')](_0x3273bc['body'],{'firstName':_0x3273bc[_0xcc6a('0x35')]['from'],'ListId':_0xcfc540[_0xcc6a('0x34')]});_0x1570fe[_0x3273bc['body'][_0xcc6a('0x3a')]]=_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x37')];return db[_0xcc6a('0x30')][_0xcc6a('0x4f')](_0x1570fe);}else{throw new Error(_0xcc6a('0x50'));}})[_0xcc6a('0x12')](function(_0x11459f){_0x470e3b['contact']=_0x11459f;if(_0x11459f){if(!_0x3273bc[_0xcc6a('0x35')]['message'][_0xcc6a('0x51')]){_0x3273bc['body'][_0xcc6a('0x18')][_0xcc6a('0x51')]=rs[_0xcc6a('0x52')]()+'\x20'+_0x3273bc['body'][_0xcc6a('0x18')]['from'];}var _0x5e53e4={'ContactId':_0x11459f['id'],'MailAccountId':_0x3273bc[_0xcc6a('0x3c')]['id'],'inReplyTo':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')][_0xcc6a('0x51')],'to':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')][_0xcc6a('0x37')],'cc':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')]['cc'],'subject':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')][_0xcc6a('0x53')],'attach':_0x3273bc[_0xcc6a('0x35')]['message'][_0xcc6a('0x54')],'lastMsgAt':moment()[_0xcc6a('0x55')](_0xcc6a('0x56')),'lastMsgDirection':'in'};return db[_0xcc6a('0x57')]['find']({'where':{'closed':![],'MailAccountId':_0x3273bc[_0xcc6a('0x3c')]['id']},'include':[{'model':db[_0xcc6a('0x58')],'as':_0xcc6a('0x59'),'attributes':[_0xcc6a('0x51')],'where':{'messageId':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')][_0xcc6a('0x5a')]}}]})[_0xcc6a('0x12')](function(_0x2686c8){if(_0x2686c8){return[_0x2686c8,![]];}return db[_0xcc6a('0x57')]['create'](_0x5e53e4)['then'](function(_0x4fe041){return[_0x4fe041,!![]];});});}else{throw new Error(_0xcc6a('0x5b'));}})[_0xcc6a('0x5c')](function(_0x9c444,_0x4a9f34){if(_0x9c444){_0x17e5a0=_0x4a9f34;if(!_0x4a9f34){return _0x9c444[_0xcc6a('0x5d')]({'inReplyTo':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')][_0xcc6a('0x51')],'to':_0x3273bc['body']['message'][_0xcc6a('0x37')],'cc':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')]['cc'],'subject':_0x3273bc[_0xcc6a('0x35')]['message'][_0xcc6a('0x53')],'attach':_0x9c444[_0xcc6a('0x54')]?_0x9c444[_0xcc6a('0x54')]:_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')]['attach'],'substatus':null,'substatusAt':moment()['format'](_0xcc6a('0x56')),'lastMsgAt':moment()[_0xcc6a('0x55')](_0xcc6a('0x56')),'lastMsgDirection':'in'});}else{return _0x9c444;}}})[_0xcc6a('0x12')](function(_0x56a3a0){_0x470e3b['interaction']=_0x56a3a0[_0xcc6a('0x44')]({'plain':!![]});_0x470e3b[_0xcc6a('0x5e')][_0xcc6a('0x5f')]=_0x17e5a0;return db[_0xcc6a('0x58')]['create']({'body':_0x3273bc['body']['body'],'MailAccountId':_0x3273bc[_0xcc6a('0x3c')]['id'],'MailInteractionId':_0x56a3a0['id'],'direction':'in','ContactId':_0x470e3b[_0xcc6a('0x60')]['id'],'messageId':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')]['messageId'],'from':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')]['from'],'to':_0x3273bc[_0xcc6a('0x35')]['message']['to'],'cc':_0x3273bc[_0xcc6a('0x35')]['message']['cc'],'subject':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')][_0xcc6a('0x53')],'attach':_0x3273bc['body'][_0xcc6a('0x18')]['attach'],'Attachments':_0x3273bc[_0xcc6a('0x35')]['message'][_0xcc6a('0x61')],'originTo':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')][_0xcc6a('0x62')],'originCc':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')]['originCc'],'bcc':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')][_0xcc6a('0x63')],'ChatWebsiteId':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')]['ChatWebsiteId']||null,'originChannel':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')]['originChannel']||'Email','ChatOfflineMessageId':_0x3273bc[_0xcc6a('0x35')][_0xcc6a('0x18')][_0xcc6a('0x64')]||null},{'include':[{'model':db[_0xcc6a('0x65')],'as':_0xcc6a('0x66')}]});})[_0xcc6a('0x12')](function(_0x598833){_0x470e3b[_0xcc6a('0x18')]=_0x598833;if(_0x470e3b[_0xcc6a('0x5e')][_0xcc6a('0x67')]){return db[_0xcc6a('0x68')][_0xcc6a('0x28')]({'attributes':['id',_0xcc6a('0x69')],'where':{'id':_0x470e3b['interaction']['UserId']}})[_0xcc6a('0x12')](function(_0x43cbee){if(_0x43cbee){_0x470e3b[_0xcc6a('0x46')][_0xcc6a('0x6a')]({'id':0x0,'priority':0x0,'app':_0xcc6a('0x6b'),'appdata':_0x43cbee[_0xcc6a('0x69')]+','+(_0x470e3b[_0xcc6a('0x3c')]['waitForTheAssignedAgent']||0xa),'interval':_0xcc6a('0x4d')});}return respondWithRpcPromise(_0xcc6a('0x6c'),_0xcc6a('0x6d'),_0x470e3b);});}return respondWithRpcPromise(_0xcc6a('0x6c'),_0xcc6a('0x6d'),_0x470e3b);})[_0xcc6a('0x12')](function(_0x5e8e19){_0x49b65c(_0x5e8e19);})[_0xcc6a('0x1b')](function(_0x4688d3){_0x56bc7d(_0x1199f1[_0xcc6a('0x17')](0x1f4,_0x4688d3['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 35df37f..106897d 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 _0xd9b6=['length','./mailAccount.events','save','remove','update','removeListener','register'];(function(_0x304834,_0x41e056){var _0x44d0b6=function(_0x99a365){while(--_0x99a365){_0x304834['push'](_0x304834['shift']());}};_0x44d0b6(++_0x41e056);}(_0xd9b6,0x135));var _0x6d9b=function(_0x4a73dd,_0x58e46c){_0x4a73dd=_0x4a73dd-0x0;var _0x279e6b=_0xd9b6[_0x4a73dd];return _0x279e6b;};'use strict';var MailAccountEvents=require(_0x6d9b('0x0'));var events=[_0x6d9b('0x1'),_0x6d9b('0x2'),_0x6d9b('0x3')];function createListener(_0x3068f2,_0x48b63f){return function(_0x214ce4){_0x48b63f['emit'](_0x3068f2,_0x214ce4);};}function removeListener(_0x4e9ae2,_0x4d6808){return function(){MailAccountEvents[_0x6d9b('0x4')](_0x4e9ae2,_0x4d6808);};}exports[_0x6d9b('0x5')]=function(_0x20674a){for(var _0x3d22eb=0x0,_0x1a4899=events[_0x6d9b('0x6')];_0x3d22eb<_0x1a4899;_0x3d22eb++){var _0x21ab10=events[_0x3d22eb];var _0x52b2c0=createListener('mailAccount:'+_0x21ab10,_0x20674a);MailAccountEvents['on'](_0x21ab10,_0x52b2c0);}}; \ No newline at end of file +var _0x38d2=['update','register','length','mailAccount:','save','remove'];(function(_0x5db59c,_0x11cc79){var _0x2a1f41=function(_0x35cfa4){while(--_0x35cfa4){_0x5db59c['push'](_0x5db59c['shift']());}};_0x2a1f41(++_0x11cc79);}(_0x38d2,0x112));var _0x238d=function(_0x3735af,_0x359b66){_0x3735af=_0x3735af-0x0;var _0x1dca7b=_0x38d2[_0x3735af];return _0x1dca7b;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x238d('0x0'),_0x238d('0x1'),_0x238d('0x2')];function createListener(_0x1951ec,_0x1e84e7){return function(_0x37ef75){_0x1e84e7['emit'](_0x1951ec,_0x37ef75);};}function removeListener(_0x69ec5b,_0x3294e2){return function(){MailAccountEvents['removeListener'](_0x69ec5b,_0x3294e2);};}exports[_0x238d('0x3')]=function(_0x4cf1c9){for(var _0x478cbe=0x0,_0x2f1118=events[_0x238d('0x4')];_0x478cbe<_0x2f1118;_0x478cbe++){var _0x12f95e=events[_0x478cbe];var _0x25f9ab=createListener(_0x238d('0x5')+_0x12f95e,_0x4cf1c9);MailAccountEvents['on'](_0x12f95e,_0x25f9ab);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 9632cf2..27f0835 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 _0x6e3b=['exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./mailApplication.controller','get','isAuthenticated','show','/:id','delete','destroy'];(function(_0x4177c3,_0x5d9d8e){var _0xa97840=function(_0x42ceb0){while(--_0x42ceb0){_0x4177c3['push'](_0x4177c3['shift']());}};_0xa97840(++_0x5d9d8e);}(_0x6e3b,0x11e));var _0xb6e3=function(_0x194f2d,_0x3d4425){_0x194f2d=_0x194f2d-0x0;var _0x4e8580=_0x6e3b[_0x194f2d];return _0x4e8580;};'use strict';var multer=require(_0xb6e3('0x0'));var util=require(_0xb6e3('0x1'));var path=require(_0xb6e3('0x2'));var timeout=require(_0xb6e3('0x3'));var express=require(_0xb6e3('0x4'));var router=express[_0xb6e3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb6e3('0x6'));var controller=require(_0xb6e3('0x7'));router[_0xb6e3('0x8')]('/:id',auth[_0xb6e3('0x9')](),controller[_0xb6e3('0xa')]);router['put'](_0xb6e3('0xb'),auth[_0xb6e3('0x9')](),controller['update']);router[_0xb6e3('0xc')]('/:id',auth[_0xb6e3('0x9')](),controller[_0xb6e3('0xd')]);module[_0xb6e3('0xe')]=router; \ No newline at end of file +var _0x5f6e=['get','/:id','show','put','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x5f6e,0x124));var _0xe5f6=function(_0x1a87b3,_0x45ba68){_0x1a87b3=_0x1a87b3-0x0;var _0x37e84d=_0x5f6e[_0x1a87b3];return _0x37e84d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe5f6('0x0'));var timeout=require(_0xe5f6('0x1'));var express=require(_0xe5f6('0x2'));var router=express[_0xe5f6('0x3')]();var fs_extra=require(_0xe5f6('0x4'));var auth=require(_0xe5f6('0x5'));var interaction=require(_0xe5f6('0x6'));var config=require(_0xe5f6('0x7'));var controller=require('./mailApplication.controller');router[_0xe5f6('0x8')](_0xe5f6('0x9'),auth['isAuthenticated'](),controller[_0xe5f6('0xa')]);router[_0xe5f6('0xb')](_0xe5f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xe5f6('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xe5f6('0xd')]);module[_0xe5f6('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 4ffb79a..1716c97 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 _0xa72e=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x3e2857,_0x103fc3){var _0x39e0a4=function(_0x4f8838){while(--_0x4f8838){_0x3e2857['push'](_0x3e2857['shift']());}};_0x39e0a4(++_0x103fc3);}(_0xa72e,0x150));var _0xea72=function(_0x1d7d07,_0x6447fe){_0x1d7d07=_0x1d7d07-0x0;var _0x38c15c=_0xa72e[_0x1d7d07];return _0x38c15c;};'use strict';var Sequelize=require(_0xea72('0x0'));module[_0xea72('0x1')]={'priority':{'type':Sequelize[_0xea72('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xea72('0x3')],'allowNull':![],'defaultValue':_0xea72('0x4')},'appdata':{'type':Sequelize[_0xea72('0x5')]()},'description':{'type':Sequelize[_0xea72('0x3')]},'interval':{'type':Sequelize[_0xea72('0x3')],'defaultValue':_0xea72('0x6')}}; \ No newline at end of file +var _0x25b1=['noop','TEXT','STRING','sequelize','exports'];(function(_0x34f545,_0x2bd2ee){var _0x1ff6b8=function(_0x582e3b){while(--_0x582e3b){_0x34f545['push'](_0x34f545['shift']());}};_0x1ff6b8(++_0x2bd2ee);}(_0x25b1,0xd5));var _0x125b=function(_0x112d1b,_0x1121ad){_0x112d1b=_0x112d1b-0x0;var _0x3d55f8=_0x25b1[_0x112d1b];return _0x3d55f8;};'use strict';var Sequelize=require(_0x125b('0x0'));module[_0x125b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x125b('0x2')},'appdata':{'type':Sequelize[_0x125b('0x3')]()},'description':{'type':Sequelize[_0x125b('0x4')]},'interval':{'type':Sequelize[_0x125b('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 2190624..e5b0b9c 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x1a72b8,_0x1e4f4b){var _0x39f72d=function(_0x35aef1){while(--_0x35aef1){_0x1a72b8['push'](_0x1a72b8['shift']());}};_0x39f72d(++_0x1e4f4b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file +var _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x59671f,_0x5a667c){var _0x220d6b=function(_0xcec168){while(--_0xcec168){_0x59671f['push'](_0x59671f['shift']());}};_0x220d6b(++_0x5a667c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 5c0483e..f7402d8 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 _0xd292=['request-promise','../../config/environment','./mailApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird'];(function(_0x441f56,_0x1df75a){var _0x441064=function(_0x557afe){while(--_0x557afe){_0x441f56['push'](_0x441f56['shift']());}};_0x441064(++_0x1df75a);}(_0xd292,0x1f3));var _0x2d29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd292[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2d29('0x0'));var util=require(_0x2d29('0x1'));var logger=require(_0x2d29('0x2'))('api');var moment=require(_0x2d29('0x3'));var BPromise=require(_0x2d29('0x4'));var rp=require(_0x2d29('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2d29('0x6'));var attributes=require(_0x2d29('0x7'));module[_0x2d29('0x8')]=function(_0x42bad7,_0x5cbab5){return _0x42bad7[_0x2d29('0x9')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2d29('0xa'),'collate':_0x2d29('0xb')});}; \ No newline at end of file +var _0xdf5f=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0xdd4cc3,_0x337c8f){var _0x76f72d=function(_0x194850){while(--_0x194850){_0xdd4cc3['push'](_0xdd4cc3['shift']());}};_0x76f72d(++_0x337c8f);}(_0xdf5f,0x115));var _0xfdf5=function(_0x3c9118,_0x1d87db){_0x3c9118=_0x3c9118-0x0;var _0x130c71=_0xdf5f[_0x3c9118];return _0x130c71;};'use strict';var _=require(_0xfdf5('0x0'));var util=require(_0xfdf5('0x1'));var logger=require(_0xfdf5('0x2'))(_0xfdf5('0x3'));var moment=require(_0xfdf5('0x4'));var BPromise=require(_0xfdf5('0x5'));var rp=require(_0xfdf5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfdf5('0x7'));var config=require(_0xfdf5('0x8'));var attributes=require(_0xfdf5('0x9'));module[_0xfdf5('0xa')]=function(_0x3e25de,_0x49f78b){return _0x3e25de[_0xfdf5('0xb')](_0xfdf5('0xc'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfdf5('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 643c39c..843aa49 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 _0x09fb=['update','body','options','attributes','limit','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateMailApplication','MailApplication'];(function(_0x3d657c,_0x3c3d1d){var _0x17a979=function(_0x9c26b0){while(--_0x9c26b0){_0x3d657c['push'](_0x3d657c['shift']());}};_0x17a979(++_0x3c3d1d);}(_0x09fb,0xae));var _0xb09f=function(_0x59f0a9,_0x524c01){_0x59f0a9=_0x59f0a9-0x0;var _0x5b3297=_0x09fb[_0x59f0a9];return _0x5b3297;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb09f('0x0'));var BPromise=require(_0xb09f('0x1'));var rs=require(_0xb09f('0x2'));var fs=require('fs');var Redis=require(_0xb09f('0x3'));var db=require(_0xb09f('0x4'))['db'];var utils=require(_0xb09f('0x5'));var logger=require('../../config/logger')(_0xb09f('0x6'));var config=require(_0xb09f('0x7'));var jayson=require(_0xb09f('0x8'));var client=jayson[_0xb09f('0x9')][_0xb09f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43bba3,_0x44bf6f,_0x56a8de){return new BPromise(function(_0xcad29d,_0x1e13c5){return client['request'](_0x43bba3,_0x56a8de)['then'](function(_0x37aaef){logger[_0xb09f('0xb')](_0xb09f('0xc'),_0x44bf6f,'request\x20sent');logger['debug'](_0xb09f('0xd'),_0x44bf6f,_0xb09f('0xe'),JSON[_0xb09f('0xf')](_0x37aaef));if(_0x37aaef[_0xb09f('0x10')]){if(_0x37aaef['error'][_0xb09f('0x11')]===0x1f4){logger['error'](_0xb09f('0xc'),_0x44bf6f,_0x37aaef[_0xb09f('0x10')][_0xb09f('0x12')]);return _0x1e13c5(_0x37aaef[_0xb09f('0x10')][_0xb09f('0x12')]);}logger['error'](_0xb09f('0xc'),_0x44bf6f,_0x37aaef[_0xb09f('0x10')]['message']);return _0xcad29d(_0x37aaef[_0xb09f('0x10')][_0xb09f('0x12')]);}else{logger[_0xb09f('0xb')](_0xb09f('0xc'),_0x44bf6f,'request\x20sent');_0xcad29d(_0x37aaef['result']['message']);}})[_0xb09f('0x13')](function(_0xf243e5){logger[_0xb09f('0x10')](_0xb09f('0xc'),_0x44bf6f,_0xf243e5);_0x1e13c5(_0xf243e5);});});}exports[_0xb09f('0x14')]=function(_0x412ea3){var _0x5c553a=this;return new Promise(function(_0x4776aa,_0x55502b){return db[_0xb09f('0x15')][_0xb09f('0x16')](_0x412ea3[_0xb09f('0x17')],{'raw':_0x412ea3['options']?_0x412ea3[_0xb09f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x412ea3['options']?_0x412ea3[_0xb09f('0x18')]['where']||null:null,'attributes':_0x412ea3['options']?_0x412ea3[_0xb09f('0x18')][_0xb09f('0x19')]||null:null,'limit':_0x412ea3[_0xb09f('0x18')]?_0x412ea3[_0xb09f('0x18')][_0xb09f('0x1a')]||null:null})[_0xb09f('0x1b')](function(_0x259e4c){logger[_0xb09f('0xb')](_0xb09f('0x14'),_0x412ea3);logger['debug'](_0xb09f('0x14'),_0x412ea3,JSON[_0xb09f('0xf')](_0x259e4c));_0x4776aa(_0x259e4c);})['catch'](function(_0x16b3af){logger[_0xb09f('0x10')](_0xb09f('0x14'),_0x16b3af['message'],_0x412ea3);_0x55502b(_0x5c553a[_0xb09f('0x10')](0x1f4,_0x16b3af['message']));});});}; \ No newline at end of file +var _0x29c9=['stringify','error','code','message','result','catch','UpdateMailApplication','update','raw','options','limit','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x29c9,0x16b));var _0x929c=function(_0xaa50a6,_0x5a15fa){_0xaa50a6=_0xaa50a6-0x0;var _0x4c91dd=_0x29c9[_0xaa50a6];return _0x4c91dd;};'use strict';var _=require(_0x929c('0x0'));var util=require(_0x929c('0x1'));var moment=require('moment');var BPromise=require(_0x929c('0x2'));var rs=require(_0x929c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x929c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x929c('0x5'))(_0x929c('0x6'));var config=require(_0x929c('0x7'));var jayson=require(_0x929c('0x8'));var client=jayson[_0x929c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23fd8e,_0x37856e,_0x137e94){return new BPromise(function(_0x3c2dc1,_0x3e98af){return client[_0x929c('0xa')](_0x23fd8e,_0x137e94)[_0x929c('0xb')](function(_0x386d98){logger[_0x929c('0xc')](_0x929c('0xd'),_0x37856e,_0x929c('0xe'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x37856e,_0x929c('0xe'),JSON[_0x929c('0xf')](_0x386d98));if(_0x386d98[_0x929c('0x10')]){if(_0x386d98['error'][_0x929c('0x11')]===0x1f4){logger[_0x929c('0x10')](_0x929c('0xd'),_0x37856e,_0x386d98['error']['message']);return _0x3e98af(_0x386d98['error'][_0x929c('0x12')]);}logger[_0x929c('0x10')](_0x929c('0xd'),_0x37856e,_0x386d98['error'][_0x929c('0x12')]);return _0x3c2dc1(_0x386d98[_0x929c('0x10')][_0x929c('0x12')]);}else{logger['info'](_0x929c('0xd'),_0x37856e,'request\x20sent');_0x3c2dc1(_0x386d98[_0x929c('0x13')][_0x929c('0x12')]);}})[_0x929c('0x14')](function(_0x2c9930){logger[_0x929c('0x10')](_0x929c('0xd'),_0x37856e,_0x2c9930);_0x3e98af(_0x2c9930);});});}exports[_0x929c('0x15')]=function(_0x3fe9ba){var _0x378f3d=this;return new Promise(function(_0x1ee26a,_0x3ee28a){return db['MailApplication'][_0x929c('0x16')](_0x3fe9ba['body'],{'raw':_0x3fe9ba['options']?_0x3fe9ba['options'][_0x929c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fe9ba['options']?_0x3fe9ba[_0x929c('0x18')]['where']||null:null,'attributes':_0x3fe9ba[_0x929c('0x18')]?_0x3fe9ba[_0x929c('0x18')]['attributes']||null:null,'limit':_0x3fe9ba[_0x929c('0x18')]?_0x3fe9ba[_0x929c('0x18')][_0x929c('0x19')]||null:null})[_0x929c('0xb')](function(_0x41a6c6){logger[_0x929c('0xc')](_0x929c('0x15'),_0x3fe9ba);logger[_0x929c('0x1a')](_0x929c('0x15'),_0x3fe9ba,JSON['stringify'](_0x41a6c6));_0x1ee26a(_0x41a6c6);})[_0x929c('0x14')](function(_0x4d24ba){logger['error']('UpdateMailApplication',_0x4d24ba[_0x929c('0x12')],_0x3fe9ba);_0x3ee28a(_0x378f3d[_0x929c('0x10')](0x1f4,_0x4d24ba[_0x929c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 101200e..48e4576 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 _0xc325=['/:id/tags','removeTags','exports','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','/describe','isAuthenticated','/:id','show','/:id/messages','getMessages','/:id/download','download','addMessage','post','tracked','mail','addTags','put','update','delete','mailinteraction:destroy','destroy'];(function(_0x556c96,_0x3c6ec0){var _0x1e9f84=function(_0x2496f1){while(--_0x2496f1){_0x556c96['push'](_0x556c96['shift']());}};_0x1e9f84(++_0x3c6ec0);}(_0xc325,0x1bd));var _0x5c32=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc325[_0x397e5f];return _0x5302b8;};'use strict';var express=require('express');var router=express[_0x5c32('0x0')]();var auth=require(_0x5c32('0x1'));var interaction=require(_0x5c32('0x2'));var controller=require(_0x5c32('0x3'));router[_0x5c32('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5c32('0x4')](_0x5c32('0x5'),auth[_0x5c32('0x6')](),controller['describe']);router[_0x5c32('0x4')](_0x5c32('0x7'),auth[_0x5c32('0x6')](),controller[_0x5c32('0x8')]);router[_0x5c32('0x4')](_0x5c32('0x9'),auth['isAuthenticated'](),controller[_0x5c32('0xa')]);router[_0x5c32('0x4')](_0x5c32('0xb'),auth[_0x5c32('0x6')](),controller[_0x5c32('0xc')]);router['post']('/',auth[_0x5c32('0x6')](),controller['create']);router['post']('/:id/messages',auth[_0x5c32('0x6')](),controller[_0x5c32('0xd')]);router[_0x5c32('0xe')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x5c32('0xf')](_0x5c32('0x10'),'mailinteraction:addtags'),controller[_0x5c32('0x11')]);router[_0x5c32('0x12')](_0x5c32('0x7'),auth['isAuthenticated'](),interaction[_0x5c32('0xf')]('mail','mailinteraction:update'),controller[_0x5c32('0x13')]);router[_0x5c32('0x14')](_0x5c32('0x7'),auth[_0x5c32('0x6')](),interaction['tracked']('mail',_0x5c32('0x15')),controller[_0x5c32('0x16')]);router[_0x5c32('0x14')](_0x5c32('0x17'),auth['isAuthenticated'](),controller[_0x5c32('0x18')]);module[_0x5c32('0x19')]=router; \ No newline at end of file +var _0x3bba=['removeTags','exports','express','../../components/auth/service','./mailInteraction.controller','index','describe','get','/:id','show','/:id/messages','isAuthenticated','getMessages','/:id/download','download','post','create','/:id/tags','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete','mailinteraction:destroy'];(function(_0x3333bb,_0x1df222){var _0x273d39=function(_0x5c411b){while(--_0x5c411b){_0x3333bb['push'](_0x3333bb['shift']());}};_0x273d39(++_0x1df222);}(_0x3bba,0xb1));var _0xa3bb=function(_0x2d014c,_0x87ec7e){_0x2d014c=_0x2d014c-0x0;var _0x1e2ef4=_0x3bba[_0x2d014c];return _0x1e2ef4;};'use strict';var express=require(_0xa3bb('0x0'));var router=express['Router']();var auth=require(_0xa3bb('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0xa3bb('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0xa3bb('0x3')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xa3bb('0x4')]);router[_0xa3bb('0x5')](_0xa3bb('0x6'),auth['isAuthenticated'](),controller[_0xa3bb('0x7')]);router[_0xa3bb('0x5')](_0xa3bb('0x8'),auth[_0xa3bb('0x9')](),controller[_0xa3bb('0xa')]);router[_0xa3bb('0x5')](_0xa3bb('0xb'),auth[_0xa3bb('0x9')](),controller[_0xa3bb('0xc')]);router[_0xa3bb('0xd')]('/',auth[_0xa3bb('0x9')](),controller[_0xa3bb('0xe')]);router[_0xa3bb('0xd')](_0xa3bb('0x8'),auth['isAuthenticated'](),controller['addMessage']);router['post'](_0xa3bb('0xf'),auth[_0xa3bb('0x9')](),interaction['tracked'](_0xa3bb('0x10'),_0xa3bb('0x11')),controller[_0xa3bb('0x12')]);router[_0xa3bb('0x13')]('/:id',auth[_0xa3bb('0x9')](),interaction['tracked'](_0xa3bb('0x10'),_0xa3bb('0x14')),controller['update']);router[_0xa3bb('0x15')](_0xa3bb('0x6'),auth[_0xa3bb('0x9')](),interaction['tracked'](_0xa3bb('0x10'),_0xa3bb('0x16')),controller['destroy']);router[_0xa3bb('0x15')](_0xa3bb('0xf'),auth['isAuthenticated'](),controller[_0xa3bb('0x17')]);module[_0xa3bb('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 9a68bcc..afeca61 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 _0x7d8a=['ENUM','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','out'];(function(_0x5a92ad,_0x2219a6){var _0x2466f8=function(_0x4ad04e){while(--_0x4ad04e){_0x5a92ad['push'](_0x5a92ad['shift']());}};_0x2466f8(++_0x2219a6);}(_0x7d8a,0x1e1));var _0xa7d8=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x7d8a[_0x65c50e];return _0x4573e7;};'use strict';var Sequelize=require(_0xa7d8('0x0'));var iconv=require(_0xa7d8('0x1'));module[_0xa7d8('0x2')]={'closed':{'type':Sequelize[_0xa7d8('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa7d8('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa7d8('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa7d8('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xa7d8('0x5')]},'cc':{'type':Sequelize[_0xa7d8('0x6')](_0xa7d8('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xa7d8('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xa7d8('0x4')]},'substatus':{'type':Sequelize[_0xa7d8('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa7d8('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa7d8('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xa7d8('0x9')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa7d8('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1f50=['STRING','TEXT','BOOLEAN','ENUM','out','sequelize','iconv','exports','DATE'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x1f50,0xb9));var _0x01f5=function(_0x47ea39,_0x569093){_0x47ea39=_0x47ea39-0x0;var _0x3bd6cc=_0x1f50[_0x47ea39];return _0x3bd6cc;};'use strict';var Sequelize=require(_0x01f5('0x0'));var iconv=require(_0x01f5('0x1'));module[_0x01f5('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x01f5('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x01f5('0x4')]},'thirdDisposition':{'type':Sequelize[_0x01f5('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x01f5('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x01f5('0x5')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x01f5('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x01f5('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x01f5('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x01f5('0x7')]('in',_0x01f5('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x01f5('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x01f5('0x7')]('in',_0x01f5('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index a0502c4..26d798a 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 _0xb0df=['union','User','$substring','some','compact','isEmpty','MailAccountId','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','order','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','MailInteraction','includeAll','include','merge','options','create','body','describe','MailMessage','addMessage','ids','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','omit','spread','emit','mailInteractionTags:save','removeTags','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','squel','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','send','Users','map','fullname','Tags','TagIds','forEach','push','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','waiting','talking','answered','unmanaged','closed','UserId','total','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag'];(function(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0xb0df,0x85));var _0xfb0d=function(_0x333767,_0x3e6f9c){_0x333767=_0x333767-0x0;var _0x51661b=_0xb0df[_0x333767];return _0x51661b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb0d('0x0'));var zipdir=require(_0xfb0d('0x1'));var moment=require(_0xfb0d('0x2'));var BPromise=require(_0xfb0d('0x3'));var util=require(_0xfb0d('0x4'));var path=require(_0xfb0d('0x5'));var fs=require('fs');var _=require(_0xfb0d('0x6'));var squel=require(_0xfb0d('0x7'));var juice=require(_0xfb0d('0x8'));var Redis=require('ioredis');var qs=require(_0xfb0d('0x9'));var as=require(_0xfb0d('0xa'));var logger=require('../../config/logger')('api');var config=require(_0xfb0d('0xb'));var db=require(_0xfb0d('0xc'))['db'];var htmlEntities=require('html-entities');config['redis']=_[_0xfb0d('0xd')](config[_0xfb0d('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xfb0d('0xf'))(new Redis(config[_0xfb0d('0xe')]));require(_0xfb0d('0x10'))[_0xfb0d('0x11')](socket);function respondWithStatusCode(_0xf6ee9b,_0x154c31){_0x154c31=_0x154c31||0xcc;return function(_0x4936a1){if(_0x4936a1){return _0xf6ee9b[_0xfb0d('0x12')](_0x154c31);}return _0xf6ee9b['status'](_0x154c31)[_0xfb0d('0x13')]();};}function respondWithResult(_0x335172,_0x254576){_0x254576=_0x254576||0xc8;return function(_0x2e9f20){if(_0x2e9f20){return _0x335172[_0xfb0d('0x14')](_0x254576)[_0xfb0d('0x15')](_0x2e9f20);}};}function respondWithFilteredResult(_0x303aa3,_0x587b3a){return function(_0x505e22){if(_0x505e22){var _0x5b7e54=typeof _0x587b3a[_0xfb0d('0x16')]===_0xfb0d('0x17')&&typeof _0x587b3a[_0xfb0d('0x18')]===_0xfb0d('0x17');var _0x38c64b=_0x505e22[_0xfb0d('0x19')];var _0xced21c=_0x5b7e54?0x0:_0x587b3a['offset'];var _0x77e8e7=_0x5b7e54?_0x505e22[_0xfb0d('0x19')]:_0x587b3a[_0xfb0d('0x16')]+_0x587b3a[_0xfb0d('0x18')];var _0x58b1cc;if(_0x77e8e7>=_0x38c64b){_0x77e8e7=_0x38c64b;_0x58b1cc=0xc8;}else{_0x58b1cc=0xce;}_0x303aa3[_0xfb0d('0x14')](_0x58b1cc);return _0x303aa3[_0xfb0d('0x1a')](_0xfb0d('0x1b'),_0xced21c+'-'+_0x77e8e7+'/'+_0x38c64b)[_0xfb0d('0x15')](_0x505e22);}return null;};}function saveUpdates(_0x190c64){return function(_0x1d4217){if(_0x1d4217){return _0x1d4217[_0xfb0d('0x1c')](_0x190c64)['then'](function(_0x1b869f){return _0x1b869f;});}return null;};}function removeEntity(_0xa5da11){return function(_0x2baa88){if(_0x2baa88){return _0x2baa88[_0xfb0d('0x1d')]()[_0xfb0d('0x1e')](function(){_0xa5da11[_0xfb0d('0x14')](0xcc)[_0xfb0d('0x13')]();});}};}function handleEntityNotFound(_0x27a5cf){return function(_0x391ec6){if(!_0x391ec6){_0x27a5cf[_0xfb0d('0x12')](0x194);}return _0x391ec6;};}function handleError(_0x3411cb,_0x5ef220){_0x5ef220=_0x5ef220||0x1f4;return function(_0x4f605a){logger[_0xfb0d('0x1f')](_0x4f605a[_0xfb0d('0x20')]);if(_0x4f605a['name']){delete _0x4f605a['name'];}_0x3411cb[_0xfb0d('0x14')](_0x5ef220)[_0xfb0d('0x21')](_0x4f605a);};}function getInteractionUsers(_0x5a1e63,_0x85663a){return new BPromise(function(_0x29be8f,_0x1c234c){try{if(_0x85663a[_0x5a1e63['id']]){_0x5a1e63[_0xfb0d('0x22')]=_[_0xfb0d('0x23')](_0x85663a[_0x5a1e63['id']],function(_0x10c1f9){return{'id':_0x10c1f9['id'],'fullname':_0x10c1f9[_0xfb0d('0x24')]};});}}catch(_0x373373){_0x1c234c(_0x373373);}_0x29be8f(_0x5a1e63);});}function getInteractionTags(_0x2d5f75,_0x31496e){return new BPromise(function(_0x1c6770,_0x803bdd){try{if(_0x2d5f75['TagIds']){_0x2d5f75[_0xfb0d('0x25')]=[];_0x2d5f75[_0xfb0d('0x26')]['split'](',')[_0xfb0d('0x27')](function(_0x2a2838){_0x2d5f75[_0xfb0d('0x25')][_0xfb0d('0x28')](_0x31496e[_0x2a2838]);});}delete _0x2d5f75['TagIds'];}catch(_0x4fb6ba){_0x803bdd(_0x4fb6ba);}_0x1c6770(_0x2d5f75);});}function getLastMessageText(_0x421a23){return new BPromise(function(_0x4c4c8f,_0x21f005){return db['MailMessage'][_0xfb0d('0x29')]({'where':{'$and':[{'MailInteractionId':_0x421a23['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xfb0d('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xfb0d('0x2b')],'order':_0xfb0d('0x2c'),'raw':!![]})['then'](function(_0x4839e7){if(_0x4839e7&&_0x4839e7[_0xfb0d('0x2b')]){_0x421a23[_0xfb0d('0x2d')]=_[_0xfb0d('0x2e')](_0x4839e7[_0xfb0d('0x2b')]);}_0x4c4c8f(_0x421a23);})['catch'](function(_0x162d86){_0x21f005(_0x162d86);});});}function updateMailInteraction(_0x4e2c40,_0xc54535,_0x5987db,_0x2640a6){return new BPromise(function(_0x45e7e9,_0x470071){return getInteractionUsers(_0x4e2c40,_0x5987db)[_0xfb0d('0x1e')](function(_0x608b28){return getInteractionTags(_0x608b28,_0xc54535);})[_0xfb0d('0x1e')](function(_0x5a1c0d){return getStateInteraction(_0x5a1c0d);})[_0xfb0d('0x1e')](function(_0x3e9206){if(_0x2640a6){_0x45e7e9(getLastMessageText(_0x3e9206));}else{_0x45e7e9(_0x3e9206);}})[_0xfb0d('0x2f')](function(_0x394c85){_0x470071(_0x394c85);});});}function getStateInteraction(_0x404e26){return new BPromise(function(_0x5278aa){_0x404e26[_0xfb0d('0x30')]=0x0;_0x404e26[_0xfb0d('0x31')]=0x0;_0x404e26[_0xfb0d('0x32')]=0x0;_0x404e26[_0xfb0d('0x33')]=0x0;_0x404e26['total']=0x0;if(!_0x404e26['closed']&&!_0x404e26['UserId']){_0x404e26[_0xfb0d('0x30')]+=0x1;}if(!_0x404e26[_0xfb0d('0x34')]&&_0x404e26[_0xfb0d('0x35')]){_0x404e26[_0xfb0d('0x31')]+=0x1;if(_0x404e26[_0xfb0d('0x30')]){_0x404e26[_0xfb0d('0x30')]-=0x1;}}if(_0x404e26[_0xfb0d('0x34')]&&_0x404e26['UserId']){_0x404e26[_0xfb0d('0x32')]+=0x1;if(_0x404e26[_0xfb0d('0x31')]){_0x404e26['talking']-=0x1;}}if(_0x404e26['closed']&&!_0x404e26[_0xfb0d('0x35')]){_0x404e26[_0xfb0d('0x33')]+=0x1;if(_0x404e26[_0xfb0d('0x30')]){_0x404e26[_0xfb0d('0x30')]-=0x1;}}_0x404e26[_0xfb0d('0x36')]+=0x1;_0x5278aa(_0x404e26);});}exports['index']=function(_0x6113e6,_0x211db5){var _0x3e1072={},_0x3020b4={},_0x4e8a83={'count':0x0,'rows':[]};var _0x46dc01=_[_0xfb0d('0x23')](db['MailInteraction'][_0xfb0d('0x37')],function(_0x3415ca){return{'name':_0x3415ca[_0xfb0d('0x38')],'type':_0x3415ca[_0xfb0d('0x39')][_0xfb0d('0x3a')]};});_0x3020b4[_0xfb0d('0x3b')]=_['map'](_0x46dc01,_0xfb0d('0x3c'));_0x3020b4[_0xfb0d('0x3d')]=_[_0xfb0d('0x3e')](_0x6113e6['query']);_0x3020b4[_0xfb0d('0x3f')]=_[_0xfb0d('0x40')](_0x3020b4['model'],_0x3020b4[_0xfb0d('0x3d')]);_0x3e1072['attributes']=_[_0xfb0d('0x40')](_0x3020b4[_0xfb0d('0x3b')],qs['fields'](_0x6113e6['query'][_0xfb0d('0x41')]));_0x3e1072['attributes']=_0x3e1072[_0xfb0d('0x42')][_0xfb0d('0x43')]?_0x3e1072[_0xfb0d('0x42')]:_0x3020b4[_0xfb0d('0x3b')];if(!_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x44')](_0xfb0d('0x45'))){_0x3e1072['limit']=qs[_0xfb0d('0x18')](_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x18')]);_0x3e1072[_0xfb0d('0x16')]=qs[_0xfb0d('0x16')](_0x6113e6['query'][_0xfb0d('0x16')]);}_0x3e1072['order']=qs[_0xfb0d('0x46')](_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x46')]);_0x3e1072[_0xfb0d('0x47')]=qs[_0xfb0d('0x3f')](_[_0xfb0d('0x48')](_0x6113e6[_0xfb0d('0x3d')],_0x3020b4['filters']),_0x46dc01);var _0x356f7c=[];var _0x34fbd0=squel[_0xfb0d('0x49')]()[_0xfb0d('0x4a')]('id')[_0xfb0d('0x4a')](_0xfb0d('0x3c'))['field'](_0xfb0d('0x4b'))[_0xfb0d('0x4c')]('tools_tags');var _0x23d3cf=squel['select']()['field'](_0xfb0d('0x4d'))[_0xfb0d('0x4a')](_0xfb0d('0x4e'))['field'](_0xfb0d('0x4f'))[_0xfb0d('0x4c')](_0xfb0d('0x50'),'ui')[_0xfb0d('0x51')](_0xfb0d('0x52'),'u',_0xfb0d('0x53'));var _0x25ba79=squel[_0xfb0d('0x49')]()[_0xfb0d('0x4c')]('mail_interactions','i')[_0xfb0d('0x51')]('cm_contacts','c',_0xfb0d('0x54'))['left_join'](_0xfb0d('0x52'),'o','o.id\x20=\x20i.UserId')[_0xfb0d('0x51')]('mail_accounts','a',_0xfb0d('0x55'))[_0xfb0d('0x51')]('mail_messages','me',_0xfb0d('0x56'))[_0xfb0d('0x51')](_0xfb0d('0x57'),'it',_0xfb0d('0x58'))[_0xfb0d('0x51')]('tools_tags','t',_0xfb0d('0x59'));var _0x5735bb=squel[_0xfb0d('0x5a')]();var _0x27923b=[];var _0x453f3f=squel['expr']();var _0x32e1f8;if(_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x5b')]){_0x32e1f8=as[_0xfb0d('0x5c')](_0x6113e6['query'][_0xfb0d('0x5b')]);var _0x30f6f4=_0x32e1f8[_0xfb0d('0x5d')];for(var _0x38674a=0x0;_0x38674a<_0x32e1f8[_0xfb0d('0x5e')][_0xfb0d('0x43')];_0x38674a++){var _0x3a4433=_0x32e1f8[_0xfb0d('0x5e')][_0x38674a];var _0x4d2b4b='i';var _0x312ada=_[_0xfb0d('0x5f')](_0x46dc01,[_0xfb0d('0x3c'),_0x3a4433['field']]);if(!_0x312ada){switch(_0x3a4433[_0xfb0d('0x4a')]){case _0xfb0d('0x60'):if(_0x3a4433[_0xfb0d('0x61')]==0x1){_0x25ba79[_0xfb0d('0x62')]('`'+_0x3a4433['field']+_0xfb0d('0x63'));}else{_0x25ba79['having']('`'+_0x3a4433[_0xfb0d('0x4a')]+'`\x20>\x200');}break;case _0xfb0d('0x64'):if(_0x3a4433[_0xfb0d('0x65')]==='$substring'){if(_0x3a4433[_0xfb0d('0x61')][_0xfb0d('0x66')]('\x20')[_0xfb0d('0x43')]>0x1){_0x5735bb[_0x30f6f4](_0xfb0d('0x67'),qs[_0xfb0d('0x68')](_0x3a4433[_0xfb0d('0x61')]),null);}else{var _0x43c72f='%'+_0x3a4433['value']+'%';_0x5735bb[_0x30f6f4](_0xfb0d('0x69'),_0x43c72f,_0x43c72f,_0x43c72f);}}else{_0x312ada=_[_0xfb0d('0x5f')](_0x46dc01,['name','ContactId']);_0x3a4433[_0xfb0d('0x4a')]=_0xfb0d('0x6a');_0x4e27e8=as[_0xfb0d('0x6b')](_0x4d2b4b,_0x312ada[_0xfb0d('0x39')],_0x3a4433);_0x5735bb[_0x30f6f4](_0x4e27e8[_0xfb0d('0x6c')],_0x4e27e8['value'][_0xfb0d('0x6d')],_0x4e27e8['value'][_0xfb0d('0x13')]);}break;case _0xfb0d('0x6e'):var _0x2461fb=_0x3a4433['value']['split'](',')[_0xfb0d('0x23')](function(_0x28b103){return Number(_0x28b103);});_0x2461fb[_0xfb0d('0x27')](function(_0x569da9){_0x453f3f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x569da9+',%');});_0x27923b=_[_0xfb0d('0x6f')](_0x27923b,_0x2461fb);break;case _0xfb0d('0x70'):if(_0x3a4433[_0xfb0d('0x65')]===_0xfb0d('0x71')){_0x5735bb[_0x30f6f4]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3a4433[_0xfb0d('0x61')]+'%',null);}else{_0x312ada=_[_0xfb0d('0x5f')](_0x46dc01,['name',_0xfb0d('0x35')]);_0x3a4433['field']=_0xfb0d('0x35');_0x4e27e8=as[_0xfb0d('0x6b')](_0x4d2b4b,_0x312ada[_0xfb0d('0x39')],_0x3a4433);_0x5735bb[_0x30f6f4](_0x4e27e8['text'],_0x4e27e8[_0xfb0d('0x61')][_0xfb0d('0x6d')],_0x4e27e8[_0xfb0d('0x61')]['end']);}break;case'plainBody':_0x4e27e8=as['buildExpression']('me',null,_0x3a4433);_0x5735bb[_0x30f6f4](_0x4e27e8[_0xfb0d('0x6c')],_0x4e27e8[_0xfb0d('0x61')]['start'],_0x4e27e8['value'][_0xfb0d('0x13')]);break;}}else{var _0x4e27e8=as[_0xfb0d('0x6b')](_0x4d2b4b,_0x312ada[_0xfb0d('0x39')],_0x3a4433);_0x5735bb[_0x30f6f4](_0x4e27e8['text'],_0x4e27e8[_0xfb0d('0x61')][_0xfb0d('0x6d')],_0x4e27e8['value'][_0xfb0d('0x13')]);}}}else{var _0x4dea17=_(_0x6113e6[_0xfb0d('0x3d')])[_0xfb0d('0x3e')]()[_0xfb0d('0x23')](function(_0xbc2b73){return _[_0xfb0d('0x72')](_0x46dc01,[_0xfb0d('0x3c'),_0xbc2b73])?_0xbc2b73:undefined;})[_0xfb0d('0x73')]()['value']();if(!_[_0xfb0d('0x74')](_0x4dea17)){_0x4dea17['forEach'](function(_0x1ad8a0){if(_0x1ad8a0===_0xfb0d('0x75')){_0x25ba79[_0xfb0d('0x47')]('i.MailAccountId\x20IN\x20?',[]['concat'](_0x6113e6[_0xfb0d('0x3d')][_0x1ad8a0]));}else if(_0x1ad8a0==='createdAt'){var _0x2c8dcc=JSON[_0xfb0d('0x76')](_0x6113e6[_0xfb0d('0x3d')][_0x1ad8a0])[_0xfb0d('0x77')];var _0x500bbb=JSON[_0xfb0d('0x76')](_0x6113e6['query'][_0x1ad8a0])['$lte'];_0x25ba79[_0xfb0d('0x47')](_0xfb0d('0x78'),_0x2c8dcc,_0x500bbb);}else{if(_0x6113e6[_0xfb0d('0x3d')][_0x1ad8a0]==='null'){_0x25ba79[_0xfb0d('0x47')]('i.'+_0x1ad8a0+_0xfb0d('0x79'));}else{_0x25ba79[_0xfb0d('0x47')]('i.'+_0x1ad8a0+'\x20=\x20?',_0x6113e6['query'][_0x1ad8a0]);}}});}if(_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x7a')]){if(_0x6113e6['query'][_0xfb0d('0x7a')]==0x1){_0x25ba79[_0xfb0d('0x62')](_0xfb0d('0x7b'));}else{_0x25ba79[_0xfb0d('0x62')](_0xfb0d('0x7c'));}}if(_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x7d')]){_0x27923b=_[_0xfb0d('0x7e')](_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x7d')])?_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x7d')]:new Array(_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x7d')]);_0x27923b[_0xfb0d('0x27')](function(_0x47cc17){_0x453f3f['or'](_0xfb0d('0x7f'),'%,'+_0x47cc17+',%');});}if(_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x80')]){var _0x139aef=_0x6113e6[_0xfb0d('0x3d')]['filter'][_0xfb0d('0x81')]('\x5c','\x5c\x5c')[_0xfb0d('0x81')](/'/g,'\x27\x27');if(qs[_0xfb0d('0x82')](_0x139aef)){_0x5735bb['or'](_0xfb0d('0x83'),_0x139aef+'%');}else if(qs[_0xfb0d('0x84')](_0x139aef)){_0x5735bb['or'](_0xfb0d('0x85'),_0x139aef+'%');}else{_0x5735bb['or'](_0xfb0d('0x86'),qs[_0xfb0d('0x68')](_0x139aef))['or'](_0xfb0d('0x87'),qs[_0xfb0d('0x68')](_0x139aef));}}}_0x25ba79[_0xfb0d('0x47')](_0x5735bb);_0x25ba79[_0xfb0d('0x88')](_0xfb0d('0x89'));var _0x4050a7={'type':db['Sequelize'][_0xfb0d('0x8a')][_0xfb0d('0x8b')],'raw':!![]};var _0x30cf71=_0x25ba79[_0xfb0d('0x8c')]();_0x30cf71[_0xfb0d('0x4a')](_0xfb0d('0x89'));_0x30cf71['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x3e1072['order']){_0x3e1072[_0xfb0d('0x8d')]['forEach'](function(_0x26aebb){var _0xfd5b23=_0x26aebb[0x0]==='contactName'?_0x26aebb[0x0]:'i.'+_0x26aebb[0x0];_0x25ba79[_0xfb0d('0x8d')](_0xfd5b23,_0x26aebb[0x1]===_0xfb0d('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x27923b)){_0x25ba79[_0xfb0d('0x62')](_0x453f3f);_0x30cf71[_0xfb0d('0x47')](_0xfb0d('0x8f'),_0x27923b);}BPromise[_0xfb0d('0x90')]()['then'](function(){if(!_0x32e1f8){if(_0x6113e6[_0xfb0d('0x3d')]['MailAccountId'])return;_0x30cf71[_0xfb0d('0x47')](_0xfb0d('0x91'));_0x25ba79[_0xfb0d('0x47')](_0xfb0d('0x91'));return;}if(_0x6113e6['user']['role']!==_0xfb0d('0x92'))return;return _0x6113e6[_0xfb0d('0x93')][_0xfb0d('0x94')]({'attributes':['id'],'raw':!![]})[_0xfb0d('0x1e')](function(_0x4ce28c){if(_['isEmpty'](_0x4ce28c)){_0x30cf71[_0xfb0d('0x47')](_0xfb0d('0x95'));_0x25ba79[_0xfb0d('0x47')](_0xfb0d('0x95'));}else{_0x30cf71['where'](_0xfb0d('0x96'),_['map'](_0x4ce28c,'id'));_0x25ba79[_0xfb0d('0x47')](_0xfb0d('0x96'),_['map'](_0x4ce28c,'id'));}});})[_0xfb0d('0x1e')](function(){if(_0x6113e6['user']['role']===_0xfb0d('0x92')&&!_0x32e1f8&&!_0x6113e6['query']['MailAccountId'])return[];return db[_0xfb0d('0x97')]['query'](_0x30cf71[_0xfb0d('0x98')](),_0x4050a7);})['then'](function(_0x5a2d50){_0x4e8a83[_0xfb0d('0x19')]=_0x5a2d50[_0xfb0d('0x43')];if(_0x4e8a83[_0xfb0d('0x19')]===0x0)return[];return db[_0xfb0d('0x97')][_0xfb0d('0x3d')](_0x34fbd0[_0xfb0d('0x98')](),_0x4050a7)['then'](function(_0x297dd5){_0x356f7c=_['keyBy'](_0x297dd5,'id');_0x4050a7=_['merge'](_0x4050a7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x41')]){_0x3e1072[_0xfb0d('0x42')]['forEach'](function(_0x5650ea){_0x25ba79[_0xfb0d('0x4a')]('i.'+_0x5650ea);});}else{_0x25ba79['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xfb0d('0x60'));_0x25ba79['field'](_0xfb0d('0x99'),_0xfb0d('0x9a'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0x9b'),_0xfb0d('0x9c'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0x9d'),_0xfb0d('0x9e'));_0x25ba79['field'](_0xfb0d('0x89'));_0x25ba79['field'](_0xfb0d('0x9f'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa0'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa1'));_0x25ba79[_0xfb0d('0x4a')]('i.closedAt');_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa2'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa3'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa4'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa5'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa6'));_0x25ba79[_0xfb0d('0x4a')]('i.secondDisposition');_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa7'));_0x25ba79[_0xfb0d('0x4a')]('i.substatus');_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa8'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa9'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xaa'));_0x25ba79['field'](_0xfb0d('0xab'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xac'),_0xfb0d('0xad'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xae'),_0xfb0d('0xaf'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xb0'),_0xfb0d('0xb1'));_0x25ba79['field'](_0xfb0d('0xb2'),_0xfb0d('0xb3'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xb4'),'Contact.mobile');_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xb5'),'Contact.fax');_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xb6'),_0xfb0d('0xb7'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xb8'),_0xfb0d('0xb9'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xba'),_0xfb0d('0x26'));}if(_0x3e1072[_0xfb0d('0x18')])_0x25ba79[_0xfb0d('0x18')](_0x3e1072[_0xfb0d('0x18')]);if(_0x3e1072[_0xfb0d('0x16')])_0x25ba79['offset'](_0x3e1072['offset']);return db[_0xfb0d('0x97')]['query'](_0x25ba79[_0xfb0d('0x98')](),_0x4050a7);})[_0xfb0d('0x1e')](function(_0xed5a8a){if(_0xed5a8a[_0xfb0d('0x43')]>0x0)_0x23d3cf[_0xfb0d('0x47')](_0xfb0d('0xbb'),_['map'](_0xed5a8a,'id'));return db['sequelize'][_0xfb0d('0x3d')](_0x23d3cf[_0xfb0d('0x98')](),_0x4050a7)[_0xfb0d('0x1e')](function(_0x177950){var _0x5e80c0=_[_0xfb0d('0xbc')](_0x177950,_0xfb0d('0xbd'));var _0x1b5223=[];return db[_0xfb0d('0xbe')][_0xfb0d('0x29')]({'attributes':[_0xfb0d('0xbf')],'raw':!![]})[_0xfb0d('0x1e')](function(_0x5b59f4){var _0x2c1c55=_0x5b59f4[_0xfb0d('0xbf')];_0xed5a8a[_0xfb0d('0x27')](function(_0x555736){_0x1b5223[_0xfb0d('0x28')](updateMailInteraction(_0x555736,_0x356f7c,_0x5e80c0,_0x2c1c55));});return BPromise[_0xfb0d('0xc0')](_0x1b5223);});});});})[_0xfb0d('0x1e')](function(_0x529468){_0x4e8a83[_0xfb0d('0xc1')]=_0x529468;return _0x4e8a83;})[_0xfb0d('0x1e')](respondWithFilteredResult(_0x211db5,_0x3e1072))[_0xfb0d('0x2f')](handleError(_0x211db5,null));};exports[_0xfb0d('0xc2')]=function(_0x3b4289,_0x10d640){var _0x5f13bc={'raw':![],'where':{'id':_0x3b4289[_0xfb0d('0xc3')]['id']}},_0xea7404={};_0xea7404[_0xfb0d('0x3b')]=_['keys'](db[_0xfb0d('0xc4')][_0xfb0d('0x37')]);_0xea7404[_0xfb0d('0x3d')]=_[_0xfb0d('0x3e')](_0x3b4289[_0xfb0d('0x3d')]);_0xea7404['filters']=_[_0xfb0d('0x40')](_0xea7404[_0xfb0d('0x3b')],_0xea7404[_0xfb0d('0x3d')]);_0x5f13bc[_0xfb0d('0x42')]=_[_0xfb0d('0x40')](_0xea7404[_0xfb0d('0x3b')],qs[_0xfb0d('0x41')](_0x3b4289[_0xfb0d('0x3d')]['fields']));_0x5f13bc[_0xfb0d('0x42')]=_0x5f13bc['attributes'][_0xfb0d('0x43')]?_0x5f13bc[_0xfb0d('0x42')]:_0xea7404[_0xfb0d('0x3b')];if(_0x3b4289[_0xfb0d('0x3d')][_0xfb0d('0xc5')]){_0x5f13bc[_0xfb0d('0xc6')]=[{'all':!![]}];}_0x5f13bc=_[_0xfb0d('0xc7')]({},_0x5f13bc,_0x3b4289[_0xfb0d('0xc8')]);return db[_0xfb0d('0xc4')][_0xfb0d('0x5f')](_0x5f13bc)[_0xfb0d('0x1e')](handleEntityNotFound(_0x10d640,null))[_0xfb0d('0x1e')](respondWithResult(_0x10d640,null))[_0xfb0d('0x2f')](handleError(_0x10d640,null));};exports[_0xfb0d('0xc9')]=function(_0x31c5a5,_0x37c2c3){return db[_0xfb0d('0xc4')]['create'](_0x31c5a5[_0xfb0d('0xca')],{})[_0xfb0d('0x1e')](respondWithResult(_0x37c2c3,0xc9))[_0xfb0d('0x2f')](handleError(_0x37c2c3,null));};exports[_0xfb0d('0x1c')]=function(_0x175fd7,_0x1010b4){if(_0x175fd7[_0xfb0d('0xca')]['id']){delete _0x175fd7['body']['id'];}return db[_0xfb0d('0xc4')][_0xfb0d('0x5f')]({'where':{'id':_0x175fd7[_0xfb0d('0xc3')]['id']}})[_0xfb0d('0x1e')](handleEntityNotFound(_0x1010b4,null))[_0xfb0d('0x1e')](saveUpdates(_0x175fd7['body'],null))['then'](respondWithResult(_0x1010b4,null))[_0xfb0d('0x2f')](handleError(_0x1010b4,null));};exports[_0xfb0d('0x1d')]=function(_0x416e2d,_0x1dd2c6){return db[_0xfb0d('0xc4')][_0xfb0d('0x5f')]({'where':{'id':_0x416e2d[_0xfb0d('0xc3')]['id']}})[_0xfb0d('0x1e')](handleEntityNotFound(_0x1dd2c6,null))[_0xfb0d('0x1e')](removeEntity(_0x1dd2c6,null))[_0xfb0d('0x2f')](handleError(_0x1dd2c6,null));};exports[_0xfb0d('0xcb')]=function(_0x2aea7d,_0x42cff1){return db[_0xfb0d('0xc4')][_0xfb0d('0xcb')]()[_0xfb0d('0x1e')](respondWithResult(_0x42cff1,null))[_0xfb0d('0x2f')](handleError(_0x42cff1,null));};exports['addMessage']=function(_0x1eeacc,_0x4bf73e){return db[_0xfb0d('0xcc')][_0xfb0d('0x5f')]({'where':{'id':_0x1eeacc['params']['id']}})[_0xfb0d('0x1e')](handleEntityNotFound(_0x4bf73e,null))[_0xfb0d('0x1e')](function(_0x6f7f7){if(_0x6f7f7){return _0x6f7f7[_0xfb0d('0xcd')](_0x1eeacc[_0xfb0d('0xca')]['ids'],_['omit'](_0x1eeacc[_0xfb0d('0xca')],[_0xfb0d('0xce'),'id'])||{});}})['then'](respondWithResult(_0x4bf73e,null))['catch'](handleError(_0x4bf73e,null));};exports[_0xfb0d('0xcf')]=function(_0x20ec1c,_0x14ab5a){var _0x50c636={'raw':![],'where':{}};var _0x30bc4b={};var _0x337024={'count':0x0,'rows':[]};return db[_0xfb0d('0xc4')][_0xfb0d('0x29')]({'where':{'id':_0x20ec1c['params']['id']}})[_0xfb0d('0x1e')](handleEntityNotFound(_0x14ab5a,null))[_0xfb0d('0x1e')](function(_0x23b84f){if(_0x23b84f){_0x30bc4b['model']=_[_0xfb0d('0x3e')](db[_0xfb0d('0xcc')][_0xfb0d('0x37')]);_0x30bc4b[_0xfb0d('0x3d')]=_['keys'](_0x20ec1c[_0xfb0d('0x3d')]);_0x30bc4b[_0xfb0d('0x3f')]=_['intersection'](_0x30bc4b[_0xfb0d('0x3b')],_0x30bc4b[_0xfb0d('0x3d')]);_0x50c636[_0xfb0d('0x42')]=_[_0xfb0d('0x40')](_0x30bc4b['model'],qs['fields'](_0x20ec1c['query'][_0xfb0d('0x41')]));_0x50c636[_0xfb0d('0x42')]=_0x50c636['attributes'][_0xfb0d('0x43')]?_0x50c636[_0xfb0d('0x42')]:_0x30bc4b['model'];if(!_0x20ec1c[_0xfb0d('0x3d')][_0xfb0d('0x44')]('nolimit')){_0x50c636[_0xfb0d('0x18')]=qs['limit'](_0x20ec1c[_0xfb0d('0x3d')][_0xfb0d('0x18')]);_0x50c636[_0xfb0d('0x16')]=qs[_0xfb0d('0x16')](_0x20ec1c['query']['offset']);}_0x50c636[_0xfb0d('0x8d')]=qs[_0xfb0d('0x46')](_0x20ec1c['query'][_0xfb0d('0x46')]);_0x50c636[_0xfb0d('0x47')]=qs[_0xfb0d('0x3f')](_['pick'](_0x20ec1c[_0xfb0d('0x3d')],_0x30bc4b['filters']));_0x50c636[_0xfb0d('0x47')][_0xfb0d('0xbd')]=_0x23b84f['id'];if(_0x20ec1c['query'][_0xfb0d('0x80')]){_0x50c636['where']=_[_0xfb0d('0xc7')](_0x50c636[_0xfb0d('0x47')],{'$or':_[_0xfb0d('0x23')](_0x50c636['attributes'],function(_0x116d55){var _0x3fba44={};_0x3fba44[_0x116d55]={'$like':'%'+_0x20ec1c[_0xfb0d('0x3d')]['filter']+'%'};return _0x3fba44;})});}if(_0x20ec1c[_0xfb0d('0x3d')][_0xfb0d('0x77')]){var _0x4f1f7d=_0x20ec1c[_0xfb0d('0x3d')][_0xfb0d('0x77')]['split'](',');var _0x67a5ec={};_0x67a5ec[_0x4f1f7d[0x0]]={'$gte':moment(_0x4f1f7d[0x1])['format'](_0xfb0d('0xd0'))};_0x50c636['where']=_[_0xfb0d('0xc7')](_0x50c636[_0xfb0d('0x47')],_0x67a5ec);}_0x50c636=_[_0xfb0d('0xc7')]({},_0x50c636,_0x20ec1c[_0xfb0d('0xc8')]);return db[_0xfb0d('0xcc')][_0xfb0d('0x19')]({'where':_0x50c636[_0xfb0d('0x47')]})[_0xfb0d('0x1e')](function(_0x5955b2){_0x337024[_0xfb0d('0x19')]=_0x5955b2;if(_0x20ec1c['query']['includeAll']){_0x50c636[_0xfb0d('0xc6')]=[{'all':!![]}];}return db[_0xfb0d('0xcc')][_0xfb0d('0xd1')](_0x50c636);})[_0xfb0d('0x1e')](function(_0x15f75b){if(_0x20ec1c['query'][_0xfb0d('0xd2')]===_0xfb0d('0xd3')){for(var _0x82c15d=0x0;_0x82c15d<_0x15f75b[_0xfb0d('0x43')];_0x82c15d++){_0x15f75b[_0x82c15d][_0xfb0d('0xca')]=juice(_0x15f75b[_0x82c15d][_0xfb0d('0xca')]);}}_0x337024[_0xfb0d('0xc1')]=_0x15f75b;return _0x337024;});}})[_0xfb0d('0x1e')](respondWithFilteredResult(_0x14ab5a,_0x50c636))[_0xfb0d('0x2f')](handleError(_0x14ab5a,null));};exports[_0xfb0d('0xd4')]=function(_0x29a253,_0x2bb6d9){return db['MailInteraction'][_0xfb0d('0x5f')]({'where':{'id':_0x29a253[_0xfb0d('0xc3')]['id']}})[_0xfb0d('0x1e')](handleEntityNotFound(_0x2bb6d9,null))['then'](function(_0xdd40e5){if(_0xdd40e5){return _0xdd40e5[_0xfb0d('0xd5')](_0x29a253[_0xfb0d('0xca')][_0xfb0d('0xce')],_[_0xfb0d('0xd6')](_0x29a253[_0xfb0d('0xca')],[_0xfb0d('0xce'),'id'])||{})[_0xfb0d('0xd7')](function(){return db[_0xfb0d('0x6e')][_0xfb0d('0xd1')]({'attributes':['id',_0xfb0d('0x3c'),'color'],'where':{'id':_0x29a253[_0xfb0d('0xca')][_0xfb0d('0xce')]}});})[_0xfb0d('0x1e')](function(_0x2932be){socket[_0xfb0d('0xd8')](_0xfb0d('0xd9'),{'id':Number(_0x29a253[_0xfb0d('0xc3')]['id']),'tags':_0x2932be||[]});return{'id':Number(_0x29a253[_0xfb0d('0xc3')]['id']),'tags':_0x2932be||[]};});}})[_0xfb0d('0x1e')](respondWithResult(_0x2bb6d9,null))[_0xfb0d('0x2f')](handleError(_0x2bb6d9,null));};exports[_0xfb0d('0xda')]=function(_0x3d4fe4,_0x2f2f3b){return db[_0xfb0d('0xc4')]['find']({'where':{'id':_0x3d4fe4['params']['id']}})[_0xfb0d('0x1e')](handleEntityNotFound(_0x2f2f3b,null))[_0xfb0d('0x1e')](function(_0x179e00){if(_0x179e00){return _0x179e00[_0xfb0d('0xda')](_0x3d4fe4[_0xfb0d('0x3d')][_0xfb0d('0xce')]);}})[_0xfb0d('0x1e')](respondWithStatusCode(_0x2f2f3b,null))['catch'](handleError(_0x2f2f3b,null));};exports['download']=function(_0xe5d916,_0x39eb3e){var _0x3762e1=moment()[_0xfb0d('0xdb')]()['toString']();var _0x542693=path[_0xfb0d('0xdc')](config[_0xfb0d('0xdd')],_0xfb0d('0xde'),'files','tmp');var _0x2b36d8=path[_0xfb0d('0xdc')](config[_0xfb0d('0xdd')],_0xfb0d('0xde'),_0xfb0d('0xdf'),_0xfb0d('0xe0'));var _0x173a70=path[_0xfb0d('0xdc')](_0x542693,_0x3762e1);var _0x46629f=util['format'](_0xfb0d('0xe1'),_0xe5d916[_0xfb0d('0xc3')]['id'],_0x3762e1);var _0xdb10aa=path[_0xfb0d('0xdc')](_0x542693,_0x46629f);var _0x1c5ebc=[];if(_0xe5d916[_0xfb0d('0x3d')]['attachments']){_0x1c5ebc[_0xfb0d('0x28')]({'model':db['Attachment'],'as':_0xfb0d('0xe2'),'raw':!![]});}var _0x45668e=[{'model':db[_0xfb0d('0xcc')],'as':_0xfb0d('0xe3'),'attributes':['id',_0xfb0d('0xca'),'from','to','cc',_0xfb0d('0xe4'),_0xfb0d('0xe5'),_0xfb0d('0xe6')],'where':{'secret':![]},'order':qs[_0xfb0d('0x46')]('id'),'include':_0x1c5ebc}];return db[_0xfb0d('0xc4')]['find']({'where':{'id':_0xe5d916[_0xfb0d('0xc3')]['id']},'include':_0x45668e})[_0xfb0d('0x1e')](handleEntityNotFound(_0x39eb3e,null))[_0xfb0d('0x1e')](function(_0x255d15){if(_0x255d15&&_0x255d15[_0xfb0d('0xe3')]){var _0xa9d2a=_0x255d15[_0xfb0d('0xe7')]({'plain':!![]});fs[_0xfb0d('0xe8')](_0x173a70);return BPromise[_0xfb0d('0xe9')](_0xa9d2a[_0xfb0d('0xe3')],function(_0x523241,_0x1aae66){var _0x336e87={'from':_0x523241[_0xfb0d('0x4c')],'to':_0x523241['to'],'subject':_0x523241[_0xfb0d('0xe5')],'html':htmlEntities[_0xfb0d('0xea')](_0x523241['body']),'headers':{'Date':moment(_0x523241[_0xfb0d('0xe6')])['format'](_0xfb0d('0xeb'))},'attachments':[]};if(_0x523241['cc']){_0x336e87['headers']['Cc']=_0x523241['cc'];}if(_0x523241['bcc']){_0x336e87[_0xfb0d('0xec')][_0xfb0d('0xed')]=_0x523241[_0xfb0d('0xe4')];}return new BPromise(function(_0x2be77b,_0x251f2d){if(_0x523241[_0xfb0d('0xe2')]){for(var _0x3090d5=0x0;_0x3090d5<_0x523241[_0xfb0d('0xe2')][_0xfb0d('0x43')];_0x3090d5++){var _0x5c08f3=_0x523241[_0xfb0d('0xe2')][_0x3090d5];var _0x520a9e=path['join'](_0x2b36d8,_0x5c08f3[_0xfb0d('0xee')]);if(fs[_0xfb0d('0xef')](_0x520a9e)){_0x336e87[_0xfb0d('0xe0')][_0xfb0d('0x28')]({'name':_0x5c08f3[_0xfb0d('0x3c')],'contentType':_0x5c08f3['type'],'data':fs[_0xfb0d('0xf0')](_0x520a9e)});}}}emlformat[_0xfb0d('0xf1')](_0x336e87,function(_0x23d10a,_0x38feb5){if(_0x23d10a)return _0x251f2d(_0x23d10a);fs[_0xfb0d('0xf2')](path[_0xfb0d('0xdc')](_0x173a70,util['format']('message%d.eml',_0x1aae66)),_0x38feb5);return _0x2be77b(_0x38feb5);});});})['then'](function(){return new BPromise(function(_0x57835b,_0x15c2b5){zipdir(_0x173a70,{'saveTo':_0xdb10aa},function(_0x2844ba,_0x26453e){if(_0x2844ba)return _0x15c2b5(_0x2844ba);return _0x57835b(_0x26453e);});})[_0xfb0d('0x1e')](function(){return new BPromise(function(_0x410666,_0x323c12){rimraf(_0x173a70,function(_0x52fdba){if(_0x52fdba)_0x323c12(_0x52fdba);return _0x410666();});});})[_0xfb0d('0x1e')](function(){return _0x39eb3e['download'](_0xdb10aa,_0x46629f,function(_0x2f70b0){if(!_0x2f70b0)fs[_0xfb0d('0xf3')](_0xdb10aa);});});});}else{return _0x39eb3e['sendStatus'](0xc8);}})[_0xfb0d('0x2f')](handleError(_0x39eb3e,null));}; \ No newline at end of file +var _0x77d4=['ids','omit','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','inlineCss','addTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','files','transcript-%d-%s.zip','attachments','Attachments','subject','createdAt','Messages','get','mkdirSync','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','rimraf','moment','util','path','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','html-entities','redis','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','update','destroy','then','error','stack','name','map','fullname','Tags','TagIds','split','forEach','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','waiting','talking','unmanaged','total','closed','UserId','answered','MailInteraction','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','where','select','field','color','from','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','Contact','$substring','value','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','some','compact','MailAccountId','concat','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','having','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','options','create','body','describe'];(function(_0x516bd9,_0x2709d2){var _0x2fcf89=function(_0x225cd2){while(--_0x225cd2){_0x516bd9['push'](_0x516bd9['shift']());}};_0x2fcf89(++_0x2709d2);}(_0x77d4,0x108));var _0x477d=function(_0x57d546,_0x5e1f6f){_0x57d546=_0x57d546-0x0;var _0xf3ce3b=_0x77d4[_0x57d546];return _0xf3ce3b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x477d('0x0'));var zipdir=require('zip-dir');var moment=require(_0x477d('0x1'));var BPromise=require('bluebird');var util=require(_0x477d('0x2'));var path=require(_0x477d('0x3'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var juice=require(_0x477d('0x4'));var Redis=require(_0x477d('0x5'));var qs=require(_0x477d('0x6'));var as=require(_0x477d('0x7'));var logger=require(_0x477d('0x8'))(_0x477d('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x477d('0xa'));config['redis']=_['defaults'](config[_0x477d('0xb')],{'host':_0x477d('0xc'),'port':0x18eb});var socket=require(_0x477d('0xd'))(new Redis(config[_0x477d('0xb')]));require(_0x477d('0xe'))['register'](socket);function respondWithStatusCode(_0x932cc9,_0x4f11bc){_0x4f11bc=_0x4f11bc||0xcc;return function(_0x295ad){if(_0x295ad){return _0x932cc9[_0x477d('0xf')](_0x4f11bc);}return _0x932cc9['status'](_0x4f11bc)[_0x477d('0x10')]();};}function respondWithResult(_0x3d362a,_0x5a190c){_0x5a190c=_0x5a190c||0xc8;return function(_0x5dd33c){if(_0x5dd33c){return _0x3d362a[_0x477d('0x11')](_0x5a190c)[_0x477d('0x12')](_0x5dd33c);}};}function respondWithFilteredResult(_0x55bdfd,_0x290d46){return function(_0x1d5699){if(_0x1d5699){var _0x48c73a=typeof _0x290d46['offset']===_0x477d('0x13')&&typeof _0x290d46['limit']===_0x477d('0x13');var _0x234b99=_0x1d5699[_0x477d('0x14')];var _0x5985b5=_0x48c73a?0x0:_0x290d46[_0x477d('0x15')];var _0x78d1f2=_0x48c73a?_0x1d5699[_0x477d('0x14')]:_0x290d46[_0x477d('0x15')]+_0x290d46['limit'];var _0x28f17a;if(_0x78d1f2>=_0x234b99){_0x78d1f2=_0x234b99;_0x28f17a=0xc8;}else{_0x28f17a=0xce;}_0x55bdfd['status'](_0x28f17a);return _0x55bdfd[_0x477d('0x16')](_0x477d('0x17'),_0x5985b5+'-'+_0x78d1f2+'/'+_0x234b99)[_0x477d('0x12')](_0x1d5699);}return null;};}function saveUpdates(_0x458489){return function(_0x37bcb3){if(_0x37bcb3){return _0x37bcb3[_0x477d('0x18')](_0x458489)['then'](function(_0x33db7a){return _0x33db7a;});}return null;};}function removeEntity(_0x49c442){return function(_0xe934a7){if(_0xe934a7){return _0xe934a7[_0x477d('0x19')]()[_0x477d('0x1a')](function(){_0x49c442[_0x477d('0x11')](0xcc)[_0x477d('0x10')]();});}};}function handleEntityNotFound(_0x3b3cda){return function(_0x435a3b){if(!_0x435a3b){_0x3b3cda[_0x477d('0xf')](0x194);}return _0x435a3b;};}function handleError(_0x45a8bd,_0x5981a){_0x5981a=_0x5981a||0x1f4;return function(_0x3d2943){logger[_0x477d('0x1b')](_0x3d2943[_0x477d('0x1c')]);if(_0x3d2943[_0x477d('0x1d')]){delete _0x3d2943['name'];}_0x45a8bd[_0x477d('0x11')](_0x5981a)['send'](_0x3d2943);};}function getInteractionUsers(_0x239b56,_0x2506d8){return new BPromise(function(_0x26a4b2,_0x2287b4){try{if(_0x2506d8[_0x239b56['id']]){_0x239b56['Users']=_[_0x477d('0x1e')](_0x2506d8[_0x239b56['id']],function(_0x2dfa90){return{'id':_0x2dfa90['id'],'fullname':_0x2dfa90[_0x477d('0x1f')]};});}}catch(_0x48ee5e){_0x2287b4(_0x48ee5e);}_0x26a4b2(_0x239b56);});}function getInteractionTags(_0x585648,_0x198697){return new BPromise(function(_0x3c6270,_0x386df5){try{if(_0x585648['TagIds']){_0x585648[_0x477d('0x20')]=[];_0x585648[_0x477d('0x21')][_0x477d('0x22')](',')[_0x477d('0x23')](function(_0x37b332){_0x585648['Tags'][_0x477d('0x24')](_0x198697[_0x37b332]);});}delete _0x585648[_0x477d('0x21')];}catch(_0x17dd16){_0x386df5(_0x17dd16);}_0x3c6270(_0x585648);});}function getLastMessageText(_0x25a329){return new BPromise(function(_0x32c5d7,_0x385eb4){return db[_0x477d('0x25')][_0x477d('0x26')]({'where':{'$and':[{'MailInteractionId':_0x25a329['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x477d('0x27')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x477d('0x28')],'order':_0x477d('0x29'),'raw':!![]})[_0x477d('0x1a')](function(_0x138c6d){if(_0x138c6d&&_0x138c6d[_0x477d('0x28')]){_0x25a329[_0x477d('0x2a')]=_[_0x477d('0x2b')](_0x138c6d[_0x477d('0x28')]);}_0x32c5d7(_0x25a329);})[_0x477d('0x2c')](function(_0x1aba28){_0x385eb4(_0x1aba28);});});}function updateMailInteraction(_0x266dbf,_0x49851b,_0x304d25,_0x598e46){return new BPromise(function(_0x25fd60,_0x28ed1e){return getInteractionUsers(_0x266dbf,_0x304d25)[_0x477d('0x1a')](function(_0x582021){return getInteractionTags(_0x582021,_0x49851b);})[_0x477d('0x1a')](function(_0x1201a9){return getStateInteraction(_0x1201a9);})[_0x477d('0x1a')](function(_0x3d34e4){if(_0x598e46){_0x25fd60(getLastMessageText(_0x3d34e4));}else{_0x25fd60(_0x3d34e4);}})[_0x477d('0x2c')](function(_0x463fca){_0x28ed1e(_0x463fca);});});}function getStateInteraction(_0xca8bf){return new BPromise(function(_0xf84c4c){_0xca8bf[_0x477d('0x2d')]=0x0;_0xca8bf[_0x477d('0x2e')]=0x0;_0xca8bf['answered']=0x0;_0xca8bf[_0x477d('0x2f')]=0x0;_0xca8bf[_0x477d('0x30')]=0x0;if(!_0xca8bf[_0x477d('0x31')]&&!_0xca8bf['UserId']){_0xca8bf[_0x477d('0x2d')]+=0x1;}if(!_0xca8bf[_0x477d('0x31')]&&_0xca8bf[_0x477d('0x32')]){_0xca8bf['talking']+=0x1;if(_0xca8bf['waiting']){_0xca8bf[_0x477d('0x2d')]-=0x1;}}if(_0xca8bf[_0x477d('0x31')]&&_0xca8bf[_0x477d('0x32')]){_0xca8bf[_0x477d('0x33')]+=0x1;if(_0xca8bf[_0x477d('0x2e')]){_0xca8bf['talking']-=0x1;}}if(_0xca8bf[_0x477d('0x31')]&&!_0xca8bf['UserId']){_0xca8bf[_0x477d('0x2f')]+=0x1;if(_0xca8bf[_0x477d('0x2d')]){_0xca8bf[_0x477d('0x2d')]-=0x1;}}_0xca8bf['total']+=0x1;_0xf84c4c(_0xca8bf);});}exports['index']=function(_0x184d50,_0x2c7089){var _0x91b02b={},_0x4758a5={},_0x4b263d={'count':0x0,'rows':[]};var _0x24a59e=_[_0x477d('0x1e')](db[_0x477d('0x34')][_0x477d('0x35')],function(_0x90924){return{'name':_0x90924['fieldName'],'type':_0x90924[_0x477d('0x36')][_0x477d('0x37')]};});_0x4758a5['model']=_[_0x477d('0x1e')](_0x24a59e,'name');_0x4758a5[_0x477d('0x38')]=_[_0x477d('0x39')](_0x184d50[_0x477d('0x38')]);_0x4758a5[_0x477d('0x3a')]=_[_0x477d('0x3b')](_0x4758a5[_0x477d('0x3c')],_0x4758a5[_0x477d('0x38')]);_0x91b02b[_0x477d('0x3d')]=_[_0x477d('0x3b')](_0x4758a5['model'],qs[_0x477d('0x3e')](_0x184d50[_0x477d('0x38')][_0x477d('0x3e')]));_0x91b02b[_0x477d('0x3d')]=_0x91b02b['attributes']['length']?_0x91b02b[_0x477d('0x3d')]:_0x4758a5[_0x477d('0x3c')];if(!_0x184d50['query'][_0x477d('0x3f')]('nolimit')){_0x91b02b['limit']=qs[_0x477d('0x40')](_0x184d50[_0x477d('0x38')][_0x477d('0x40')]);_0x91b02b[_0x477d('0x15')]=qs[_0x477d('0x15')](_0x184d50[_0x477d('0x38')]['offset']);}_0x91b02b[_0x477d('0x41')]=qs[_0x477d('0x42')](_0x184d50[_0x477d('0x38')][_0x477d('0x42')]);_0x91b02b[_0x477d('0x43')]=qs['filters'](_['pick'](_0x184d50[_0x477d('0x38')],_0x4758a5[_0x477d('0x3a')]),_0x24a59e);var _0x13638f=[];var _0x59dc4c=squel[_0x477d('0x44')]()[_0x477d('0x45')]('id')[_0x477d('0x45')](_0x477d('0x1d'))[_0x477d('0x45')](_0x477d('0x46'))[_0x477d('0x47')]('tools_tags');var _0xe24968=squel[_0x477d('0x44')]()[_0x477d('0x45')](_0x477d('0x48'))[_0x477d('0x45')](_0x477d('0x49'))[_0x477d('0x45')](_0x477d('0x4a'))[_0x477d('0x47')](_0x477d('0x4b'),'ui')[_0x477d('0x4c')](_0x477d('0x4d'),'u',_0x477d('0x4e'));var _0x2b23c0=squel[_0x477d('0x44')]()['from'](_0x477d('0x4f'),'i')[_0x477d('0x4c')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x477d('0x4d'),'o',_0x477d('0x50'))[_0x477d('0x4c')](_0x477d('0x51'),'a',_0x477d('0x52'))[_0x477d('0x4c')](_0x477d('0x53'),'me',_0x477d('0x54'))['left_join'](_0x477d('0x55'),'it',_0x477d('0x56'))[_0x477d('0x4c')](_0x477d('0x57'),'t',_0x477d('0x58'));var _0xaae88d=squel[_0x477d('0x59')]();var _0x20e6b1=[];var _0x5d9114=squel[_0x477d('0x59')]();var _0xfa7e26;if(_0x184d50[_0x477d('0x38')][_0x477d('0x5a')]){_0xfa7e26=as[_0x477d('0x5b')](_0x184d50['query'][_0x477d('0x5a')]);var _0x215f73=_0xfa7e26[_0x477d('0x5c')];for(var _0x239ece=0x0;_0x239ece<_0xfa7e26[_0x477d('0x5d')]['length'];_0x239ece++){var _0x5cd970=_0xfa7e26[_0x477d('0x5d')][_0x239ece];var _0xb175d1='i';var _0x95f9e0=_[_0x477d('0x5e')](_0x24a59e,[_0x477d('0x1d'),_0x5cd970[_0x477d('0x45')]]);if(!_0x95f9e0){switch(_0x5cd970[_0x477d('0x45')]){case _0x477d('0x5f'):if(_0x5cd970['value']==0x1){_0x2b23c0['having']('`'+_0x5cd970['field']+'`\x20=\x200');}else{_0x2b23c0['having']('`'+_0x5cd970[_0x477d('0x45')]+'`\x20>\x200');}break;case _0x477d('0x60'):if(_0x5cd970['operator']===_0x477d('0x61')){if(_0x5cd970[_0x477d('0x62')]['split']('\x20')[_0x477d('0x63')]>0x1){_0xaae88d[_0x215f73](_0x477d('0x64'),qs[_0x477d('0x65')](_0x5cd970[_0x477d('0x62')]),null);}else{var _0x5e5e09='%'+_0x5cd970['value']+'%';_0xaae88d[_0x215f73](_0x477d('0x66'),_0x5e5e09,_0x5e5e09,_0x5e5e09);}}else{_0x95f9e0=_[_0x477d('0x5e')](_0x24a59e,['name',_0x477d('0x67')]);_0x5cd970[_0x477d('0x45')]=_0x477d('0x67');_0x3f5c88=as[_0x477d('0x68')](_0xb175d1,_0x95f9e0[_0x477d('0x36')],_0x5cd970);_0xaae88d[_0x215f73](_0x3f5c88['text'],_0x3f5c88['value'][_0x477d('0x69')],_0x3f5c88[_0x477d('0x62')]['end']);}break;case _0x477d('0x6a'):var _0x4fdd04=_0x5cd970['value'][_0x477d('0x22')](',')[_0x477d('0x1e')](function(_0x3a5f8e){return Number(_0x3a5f8e);});_0x4fdd04[_0x477d('0x23')](function(_0x6873d7){_0x5d9114['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x6873d7+',%');});_0x20e6b1=_['union'](_0x20e6b1,_0x4fdd04);break;case _0x477d('0x6b'):if(_0x5cd970[_0x477d('0x6c')]===_0x477d('0x61')){_0xaae88d[_0x215f73](_0x477d('0x6d'),'%'+_0x5cd970[_0x477d('0x62')]+'%',null);}else{_0x95f9e0=_[_0x477d('0x5e')](_0x24a59e,[_0x477d('0x1d'),_0x477d('0x32')]);_0x5cd970[_0x477d('0x45')]='UserId';_0x3f5c88=as['buildExpression'](_0xb175d1,_0x95f9e0[_0x477d('0x36')],_0x5cd970);_0xaae88d[_0x215f73](_0x3f5c88['text'],_0x3f5c88[_0x477d('0x62')][_0x477d('0x69')],_0x3f5c88[_0x477d('0x62')]['end']);}break;case _0x477d('0x28'):_0x3f5c88=as[_0x477d('0x68')]('me',null,_0x5cd970);_0xaae88d[_0x215f73](_0x3f5c88['text'],_0x3f5c88[_0x477d('0x62')][_0x477d('0x69')],_0x3f5c88[_0x477d('0x62')][_0x477d('0x10')]);break;}}else{var _0x3f5c88=as[_0x477d('0x68')](_0xb175d1,_0x95f9e0['type'],_0x5cd970);_0xaae88d[_0x215f73](_0x3f5c88[_0x477d('0x6e')],_0x3f5c88[_0x477d('0x62')][_0x477d('0x69')],_0x3f5c88[_0x477d('0x62')]['end']);}}}else{var _0x2e39f7=_(_0x184d50['query'])[_0x477d('0x39')]()[_0x477d('0x1e')](function(_0x48597a){return _[_0x477d('0x6f')](_0x24a59e,[_0x477d('0x1d'),_0x48597a])?_0x48597a:undefined;})[_0x477d('0x70')]()['value']();if(!_['isEmpty'](_0x2e39f7)){_0x2e39f7[_0x477d('0x23')](function(_0x542235){if(_0x542235===_0x477d('0x71')){_0x2b23c0[_0x477d('0x43')]('i.MailAccountId\x20IN\x20?',[][_0x477d('0x72')](_0x184d50[_0x477d('0x38')][_0x542235]));}else if(_0x542235==='createdAt'){var _0x38e06f=JSON[_0x477d('0x73')](_0x184d50[_0x477d('0x38')][_0x542235])['$gte'];var _0x1f2c3e=JSON[_0x477d('0x73')](_0x184d50[_0x477d('0x38')][_0x542235])['$lte'];_0x2b23c0[_0x477d('0x43')](_0x477d('0x74'),_0x38e06f,_0x1f2c3e);}else{if(_0x184d50[_0x477d('0x38')][_0x542235]===_0x477d('0x75')){_0x2b23c0[_0x477d('0x43')]('i.'+_0x542235+_0x477d('0x76'));}else{_0x2b23c0[_0x477d('0x43')]('i.'+_0x542235+_0x477d('0x77'),_0x184d50[_0x477d('0x38')][_0x542235]);}}});}if(_0x184d50['query']['read']){if(_0x184d50[_0x477d('0x38')]['read']==0x1){_0x2b23c0[_0x477d('0x78')]('`unreadMessages`\x20=\x200');}else{_0x2b23c0[_0x477d('0x78')]('`unreadMessages`\x20>\x200');}}if(_0x184d50[_0x477d('0x38')][_0x477d('0x79')]){_0x20e6b1=_[_0x477d('0x7a')](_0x184d50[_0x477d('0x38')]['tag'])?_0x184d50['query']['tag']:new Array(_0x184d50['query']['tag']);_0x20e6b1[_0x477d('0x23')](function(_0x32fb4d){_0x5d9114['or'](_0x477d('0x7b'),'%,'+_0x32fb4d+',%');});}if(_0x184d50[_0x477d('0x38')][_0x477d('0x7c')]){var _0x1a09f8=_0x184d50['query'][_0x477d('0x7c')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x477d('0x7d')](_0x1a09f8)){_0xaae88d['or'](_0x477d('0x7e'),_0x1a09f8+'%');}else if(qs[_0x477d('0x7f')](_0x1a09f8)){_0xaae88d['or'](_0x477d('0x80'),_0x1a09f8+'%');}else{_0xaae88d['or'](_0x477d('0x81'),qs[_0x477d('0x65')](_0x1a09f8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1a09f8));}}}_0x2b23c0[_0x477d('0x43')](_0xaae88d);_0x2b23c0[_0x477d('0x82')](_0x477d('0x83'));var _0x506d9b={'type':db['Sequelize'][_0x477d('0x84')][_0x477d('0x85')],'raw':!![]};var _0x4e15f9=_0x2b23c0[_0x477d('0x86')]();_0x4e15f9[_0x477d('0x45')](_0x477d('0x83'));_0x4e15f9[_0x477d('0x45')](_0x477d('0x87'),_0x477d('0x5f'));if(_0x91b02b['order']){_0x91b02b[_0x477d('0x41')][_0x477d('0x23')](function(_0x524c5c){var _0x2380cf=_0x524c5c[0x0]===_0x477d('0x88')?_0x524c5c[0x0]:'i.'+_0x524c5c[0x0];_0x2b23c0[_0x477d('0x41')](_0x2380cf,_0x524c5c[0x1]===_0x477d('0x89')?![]:!![]);});}if(!_[_0x477d('0x8a')](_0x20e6b1)){_0x2b23c0['having'](_0x5d9114);_0x4e15f9[_0x477d('0x43')]('t.id\x20IN\x20?',_0x20e6b1);}BPromise[_0x477d('0x8b')]()[_0x477d('0x1a')](function(){if(!_0xfa7e26){if(_0x184d50['query'][_0x477d('0x71')])return;_0x4e15f9[_0x477d('0x43')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x2b23c0[_0x477d('0x43')](_0x477d('0x8c'));return;}if(_0x184d50['user'][_0x477d('0x8d')]!==_0x477d('0x8e'))return;return _0x184d50[_0x477d('0x8f')][_0x477d('0x90')]({'attributes':['id'],'raw':!![]})[_0x477d('0x1a')](function(_0x231db4){if(_[_0x477d('0x8a')](_0x231db4)){_0x4e15f9[_0x477d('0x43')](_0x477d('0x91'));_0x2b23c0[_0x477d('0x43')](_0x477d('0x91'));}else{_0x4e15f9[_0x477d('0x43')](_0x477d('0x92'),_[_0x477d('0x1e')](_0x231db4,'id'));_0x2b23c0[_0x477d('0x43')]('i.MailAccountId\x20IN\x20?',_[_0x477d('0x1e')](_0x231db4,'id'));}});})['then'](function(){if(_0x184d50['user'][_0x477d('0x8d')]===_0x477d('0x8e')&&!_0xfa7e26&&!_0x184d50['query'][_0x477d('0x71')])return[];return db[_0x477d('0x93')][_0x477d('0x38')](_0x4e15f9[_0x477d('0x94')](),_0x506d9b);})[_0x477d('0x1a')](function(_0x1a4d12){_0x4b263d[_0x477d('0x14')]=_0x1a4d12['length'];if(_0x4b263d[_0x477d('0x14')]===0x0)return[];return db[_0x477d('0x93')]['query'](_0x59dc4c[_0x477d('0x94')](),_0x506d9b)[_0x477d('0x1a')](function(_0x4c1902){_0x13638f=_[_0x477d('0x95')](_0x4c1902,'id');_0x506d9b=_[_0x477d('0x96')](_0x506d9b,{'model':db[_0x477d('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x184d50[_0x477d('0x38')][_0x477d('0x3e')]){_0x91b02b[_0x477d('0x3d')][_0x477d('0x23')](function(_0x20fc0c){_0x2b23c0[_0x477d('0x45')]('i.'+_0x20fc0c);});}else{_0x2b23c0[_0x477d('0x45')](_0x477d('0x87'),_0x477d('0x5f'));_0x2b23c0[_0x477d('0x45')]('a.key','Account.key');_0x2b23c0[_0x477d('0x45')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x2b23c0['field'](_0x477d('0x97'),_0x477d('0x88'));_0x2b23c0['field'](_0x477d('0x83'));_0x2b23c0[_0x477d('0x45')](_0x477d('0x98'));_0x2b23c0[_0x477d('0x45')](_0x477d('0x99'));_0x2b23c0['field']('i.closed');_0x2b23c0[_0x477d('0x45')](_0x477d('0x9a'));_0x2b23c0[_0x477d('0x45')](_0x477d('0x9b'));_0x2b23c0[_0x477d('0x45')]('i.lastMsgAt');_0x2b23c0['field']('i.lastMsgDirection');_0x2b23c0[_0x477d('0x45')](_0x477d('0x9c'));_0x2b23c0['field'](_0x477d('0x9d'));_0x2b23c0[_0x477d('0x45')](_0x477d('0x9e'));_0x2b23c0[_0x477d('0x45')](_0x477d('0x9f'));_0x2b23c0[_0x477d('0x45')](_0x477d('0xa0'));_0x2b23c0['field'](_0x477d('0xa1'));_0x2b23c0['field'](_0x477d('0xa2'));_0x2b23c0[_0x477d('0x45')](_0x477d('0xa3'));_0x2b23c0[_0x477d('0x45')](_0x477d('0xa4'));_0x2b23c0[_0x477d('0x45')](_0x477d('0xa5'),'Contact.firstName');_0x2b23c0[_0x477d('0x45')](_0x477d('0xa6'),_0x477d('0xa7'));_0x2b23c0[_0x477d('0x45')]('c.email',_0x477d('0xa8'));_0x2b23c0['field'](_0x477d('0xa9'),_0x477d('0xaa'));_0x2b23c0[_0x477d('0x45')](_0x477d('0xab'),_0x477d('0xac'));_0x2b23c0['field'](_0x477d('0xad'),'Contact.fax');_0x2b23c0[_0x477d('0x45')](_0x477d('0xae'),_0x477d('0xaf'));_0x2b23c0['field'](_0x477d('0xb0'),_0x477d('0xb1'));_0x2b23c0[_0x477d('0x45')](_0x477d('0xb2'),_0x477d('0x21'));}if(_0x91b02b[_0x477d('0x40')])_0x2b23c0[_0x477d('0x40')](_0x91b02b[_0x477d('0x40')]);if(_0x91b02b[_0x477d('0x15')])_0x2b23c0[_0x477d('0x15')](_0x91b02b[_0x477d('0x15')]);return db[_0x477d('0x93')]['query'](_0x2b23c0['toString'](),_0x506d9b);})[_0x477d('0x1a')](function(_0x236526){if(_0x236526[_0x477d('0x63')]>0x0)_0xe24968['where']('ui.MailInteractionId\x20IN\x20?',_['map'](_0x236526,'id'));return db['sequelize'][_0x477d('0x38')](_0xe24968[_0x477d('0x94')](),_0x506d9b)[_0x477d('0x1a')](function(_0x3ef9f2){var _0x2b3632=_['groupBy'](_0x3ef9f2,_0x477d('0xb3'));var _0xba9363=[];return db[_0x477d('0xb4')][_0x477d('0x26')]({'attributes':[_0x477d('0xb5')],'raw':!![]})[_0x477d('0x1a')](function(_0x53f88a){var _0x17053e=_0x53f88a[_0x477d('0xb5')];_0x236526[_0x477d('0x23')](function(_0x5a4acc){_0xba9363[_0x477d('0x24')](updateMailInteraction(_0x5a4acc,_0x13638f,_0x2b3632,_0x17053e));});return BPromise[_0x477d('0xb6')](_0xba9363);});});});})[_0x477d('0x1a')](function(_0x82a63e){_0x4b263d[_0x477d('0xb7')]=_0x82a63e;return _0x4b263d;})['then'](respondWithFilteredResult(_0x2c7089,_0x91b02b))[_0x477d('0x2c')](handleError(_0x2c7089,null));};exports[_0x477d('0xb8')]=function(_0x4a9b25,_0x1aa1b9){var _0xa84f02={'raw':![],'where':{'id':_0x4a9b25[_0x477d('0xb9')]['id']}},_0x1a78ab={};_0x1a78ab['model']=_[_0x477d('0x39')](db['MailInteraction']['rawAttributes']);_0x1a78ab[_0x477d('0x38')]=_[_0x477d('0x39')](_0x4a9b25['query']);_0x1a78ab['filters']=_['intersection'](_0x1a78ab[_0x477d('0x3c')],_0x1a78ab[_0x477d('0x38')]);_0xa84f02[_0x477d('0x3d')]=_[_0x477d('0x3b')](_0x1a78ab['model'],qs['fields'](_0x4a9b25[_0x477d('0x38')][_0x477d('0x3e')]));_0xa84f02[_0x477d('0x3d')]=_0xa84f02[_0x477d('0x3d')][_0x477d('0x63')]?_0xa84f02['attributes']:_0x1a78ab[_0x477d('0x3c')];if(_0x4a9b25[_0x477d('0x38')]['includeAll']){_0xa84f02['include']=[{'all':!![]}];}_0xa84f02=_['merge']({},_0xa84f02,_0x4a9b25[_0x477d('0xba')]);return db[_0x477d('0x34')][_0x477d('0x5e')](_0xa84f02)[_0x477d('0x1a')](handleEntityNotFound(_0x1aa1b9,null))[_0x477d('0x1a')](respondWithResult(_0x1aa1b9,null))[_0x477d('0x2c')](handleError(_0x1aa1b9,null));};exports[_0x477d('0xbb')]=function(_0x36a815,_0x50e82f){return db[_0x477d('0x34')][_0x477d('0xbb')](_0x36a815['body'],{})[_0x477d('0x1a')](respondWithResult(_0x50e82f,0xc9))[_0x477d('0x2c')](handleError(_0x50e82f,null));};exports[_0x477d('0x18')]=function(_0x307248,_0x87d5ad){if(_0x307248[_0x477d('0xbc')]['id']){delete _0x307248[_0x477d('0xbc')]['id'];}return db[_0x477d('0x34')][_0x477d('0x5e')]({'where':{'id':_0x307248[_0x477d('0xb9')]['id']}})['then'](handleEntityNotFound(_0x87d5ad,null))['then'](saveUpdates(_0x307248['body'],null))[_0x477d('0x1a')](respondWithResult(_0x87d5ad,null))[_0x477d('0x2c')](handleError(_0x87d5ad,null));};exports[_0x477d('0x19')]=function(_0x3919ab,_0xe829b0){return db[_0x477d('0x34')]['find']({'where':{'id':_0x3919ab[_0x477d('0xb9')]['id']}})['then'](handleEntityNotFound(_0xe829b0,null))[_0x477d('0x1a')](removeEntity(_0xe829b0,null))[_0x477d('0x2c')](handleError(_0xe829b0,null));};exports[_0x477d('0xbd')]=function(_0x5a5d14,_0x137de9){return db['MailInteraction']['describe']()['then'](respondWithResult(_0x137de9,null))['catch'](handleError(_0x137de9,null));};exports['addMessage']=function(_0x44c7bf,_0x5029fb){return db[_0x477d('0x25')]['find']({'where':{'id':_0x44c7bf[_0x477d('0xb9')]['id']}})['then'](handleEntityNotFound(_0x5029fb,null))[_0x477d('0x1a')](function(_0x14a050){if(_0x14a050){return _0x14a050['addMessage'](_0x44c7bf[_0x477d('0xbc')][_0x477d('0xbe')],_[_0x477d('0xbf')](_0x44c7bf[_0x477d('0xbc')],['ids','id'])||{});}})[_0x477d('0x1a')](respondWithResult(_0x5029fb,null))[_0x477d('0x2c')](handleError(_0x5029fb,null));};exports['getMessages']=function(_0x4551cf,_0x27fe54){var _0x2bb3d6={'raw':![],'where':{}};var _0x4037d1={};var _0x2d70d9={'count':0x0,'rows':[]};return db[_0x477d('0x34')][_0x477d('0x26')]({'where':{'id':_0x4551cf[_0x477d('0xb9')]['id']}})[_0x477d('0x1a')](handleEntityNotFound(_0x27fe54,null))[_0x477d('0x1a')](function(_0x1a49fe){if(_0x1a49fe){_0x4037d1[_0x477d('0x3c')]=_[_0x477d('0x39')](db[_0x477d('0x25')][_0x477d('0x35')]);_0x4037d1[_0x477d('0x38')]=_[_0x477d('0x39')](_0x4551cf[_0x477d('0x38')]);_0x4037d1[_0x477d('0x3a')]=_['intersection'](_0x4037d1['model'],_0x4037d1[_0x477d('0x38')]);_0x2bb3d6[_0x477d('0x3d')]=_[_0x477d('0x3b')](_0x4037d1['model'],qs['fields'](_0x4551cf[_0x477d('0x38')][_0x477d('0x3e')]));_0x2bb3d6['attributes']=_0x2bb3d6['attributes'][_0x477d('0x63')]?_0x2bb3d6[_0x477d('0x3d')]:_0x4037d1[_0x477d('0x3c')];if(!_0x4551cf[_0x477d('0x38')][_0x477d('0x3f')](_0x477d('0xc0'))){_0x2bb3d6[_0x477d('0x40')]=qs[_0x477d('0x40')](_0x4551cf[_0x477d('0x38')]['limit']);_0x2bb3d6[_0x477d('0x15')]=qs[_0x477d('0x15')](_0x4551cf[_0x477d('0x38')][_0x477d('0x15')]);}_0x2bb3d6[_0x477d('0x41')]=qs['sort'](_0x4551cf[_0x477d('0x38')][_0x477d('0x42')]);_0x2bb3d6[_0x477d('0x43')]=qs[_0x477d('0x3a')](_['pick'](_0x4551cf[_0x477d('0x38')],_0x4037d1[_0x477d('0x3a')]));_0x2bb3d6['where'][_0x477d('0xb3')]=_0x1a49fe['id'];if(_0x4551cf['query']['filter']){_0x2bb3d6['where']=_['merge'](_0x2bb3d6['where'],{'$or':_[_0x477d('0x1e')](_0x2bb3d6['attributes'],function(_0x2b60ce){var _0x1d3674={};_0x1d3674[_0x2b60ce]={'$like':'%'+_0x4551cf[_0x477d('0x38')][_0x477d('0x7c')]+'%'};return _0x1d3674;})});}if(_0x4551cf[_0x477d('0x38')]['$gte']){var _0x1f2dac=_0x4551cf[_0x477d('0x38')][_0x477d('0xc1')][_0x477d('0x22')](',');var _0x4154d4={};_0x4154d4[_0x1f2dac[0x0]]={'$gte':moment(_0x1f2dac[0x1])[_0x477d('0xc2')](_0x477d('0xc3'))};_0x2bb3d6[_0x477d('0x43')]=_[_0x477d('0x96')](_0x2bb3d6[_0x477d('0x43')],_0x4154d4);}_0x2bb3d6=_['merge']({},_0x2bb3d6,_0x4551cf[_0x477d('0xba')]);return db[_0x477d('0x25')][_0x477d('0x14')]({'where':_0x2bb3d6[_0x477d('0x43')]})[_0x477d('0x1a')](function(_0x1e89b7){_0x2d70d9['count']=_0x1e89b7;if(_0x4551cf['query'][_0x477d('0xc4')]){_0x2bb3d6['include']=[{'all':!![]}];}return db[_0x477d('0x25')][_0x477d('0xc5')](_0x2bb3d6);})['then'](function(_0x2025e2){if(_0x4551cf[_0x477d('0x38')][_0x477d('0xc6')]==='true'){for(var _0x1a6726=0x0;_0x1a6726<_0x2025e2[_0x477d('0x63')];_0x1a6726++){_0x2025e2[_0x1a6726][_0x477d('0xbc')]=juice(_0x2025e2[_0x1a6726][_0x477d('0xbc')]);}}_0x2d70d9[_0x477d('0xb7')]=_0x2025e2;return _0x2d70d9;});}})[_0x477d('0x1a')](respondWithFilteredResult(_0x27fe54,_0x2bb3d6))[_0x477d('0x2c')](handleError(_0x27fe54,null));};exports[_0x477d('0xc7')]=function(_0x31585a,_0x5cc5aa){return db[_0x477d('0x34')]['find']({'where':{'id':_0x31585a[_0x477d('0xb9')]['id']}})[_0x477d('0x1a')](handleEntityNotFound(_0x5cc5aa,null))[_0x477d('0x1a')](function(_0x4472dc){if(_0x4472dc){return _0x4472dc['setTags'](_0x31585a[_0x477d('0xbc')][_0x477d('0xbe')],_['omit'](_0x31585a[_0x477d('0xbc')],[_0x477d('0xbe'),'id'])||{})[_0x477d('0xc8')](function(){return db[_0x477d('0x6a')][_0x477d('0xc5')]({'attributes':['id',_0x477d('0x1d'),_0x477d('0x46')],'where':{'id':_0x31585a[_0x477d('0xbc')][_0x477d('0xbe')]}});})['then'](function(_0x421470){socket[_0x477d('0xc9')](_0x477d('0xca'),{'id':Number(_0x31585a[_0x477d('0xb9')]['id']),'tags':_0x421470||[]});return{'id':Number(_0x31585a[_0x477d('0xb9')]['id']),'tags':_0x421470||[]};});}})[_0x477d('0x1a')](respondWithResult(_0x5cc5aa,null))[_0x477d('0x2c')](handleError(_0x5cc5aa,null));};exports[_0x477d('0xcb')]=function(_0x519754,_0x1bdb46){return db['MailInteraction'][_0x477d('0x5e')]({'where':{'id':_0x519754[_0x477d('0xb9')]['id']}})[_0x477d('0x1a')](handleEntityNotFound(_0x1bdb46,null))['then'](function(_0x5e6a37){if(_0x5e6a37){return _0x5e6a37['removeTags'](_0x519754[_0x477d('0x38')][_0x477d('0xbe')]);}})['then'](respondWithStatusCode(_0x1bdb46,null))[_0x477d('0x2c')](handleError(_0x1bdb46,null));};exports[_0x477d('0xcc')]=function(_0x18769f,_0x374539){var _0x5c61aa=moment()[_0x477d('0xcd')]()[_0x477d('0x94')]();var _0x36b530=path[_0x477d('0xce')](config['root'],_0x477d('0xcf'),_0x477d('0xd0'),'tmp');var _0x259046=path[_0x477d('0xce')](config['root'],'server',_0x477d('0xd0'),'attachments');var _0x53a5d9=path['join'](_0x36b530,_0x5c61aa);var _0xd5793e=util[_0x477d('0xc2')](_0x477d('0xd1'),_0x18769f[_0x477d('0xb9')]['id'],_0x5c61aa);var _0x48c206=path[_0x477d('0xce')](_0x36b530,_0xd5793e);var _0x412878=[];if(_0x18769f[_0x477d('0x38')][_0x477d('0xd2')]){_0x412878[_0x477d('0x24')]({'model':db['Attachment'],'as':_0x477d('0xd3'),'raw':!![]});}var _0x44b13d=[{'model':db[_0x477d('0x25')],'as':'Messages','attributes':['id','body','from','to','cc','bcc',_0x477d('0xd4'),_0x477d('0xd5')],'where':{'secret':![]},'order':qs[_0x477d('0x42')]('id'),'include':_0x412878}];return db[_0x477d('0x34')][_0x477d('0x5e')]({'where':{'id':_0x18769f[_0x477d('0xb9')]['id']},'include':_0x44b13d})[_0x477d('0x1a')](handleEntityNotFound(_0x374539,null))[_0x477d('0x1a')](function(_0x13672a){if(_0x13672a&&_0x13672a[_0x477d('0xd6')]){var _0x586922=_0x13672a[_0x477d('0xd7')]({'plain':!![]});fs[_0x477d('0xd8')](_0x53a5d9);return BPromise['each'](_0x586922['Messages'],function(_0x1e4f03,_0x280860){var _0x511f54={'from':_0x1e4f03[_0x477d('0x47')],'to':_0x1e4f03['to'],'subject':_0x1e4f03['subject'],'html':htmlEntities[_0x477d('0xd9')](_0x1e4f03[_0x477d('0xbc')]),'headers':{'Date':moment(_0x1e4f03['createdAt'])[_0x477d('0xc2')](_0x477d('0xda'))},'attachments':[]};if(_0x1e4f03['cc']){_0x511f54['headers']['Cc']=_0x1e4f03['cc'];}if(_0x1e4f03[_0x477d('0xdb')]){_0x511f54[_0x477d('0xdc')]['Bcc']=_0x1e4f03['bcc'];}return new BPromise(function(_0x23af18,_0x138caa){if(_0x1e4f03[_0x477d('0xd3')]){for(var _0x227052=0x0;_0x227052<_0x1e4f03[_0x477d('0xd3')]['length'];_0x227052++){var _0x182999=_0x1e4f03['Attachments'][_0x227052];var _0xb4000c=path[_0x477d('0xce')](_0x259046,_0x182999[_0x477d('0xdd')]);if(fs[_0x477d('0xde')](_0xb4000c)){_0x511f54[_0x477d('0xd2')][_0x477d('0x24')]({'name':_0x182999['name'],'contentType':_0x182999[_0x477d('0x36')],'data':fs[_0x477d('0xdf')](_0xb4000c)});}}}emlformat['build'](_0x511f54,function(_0x505301,_0x4bcda6){if(_0x505301)return _0x138caa(_0x505301);fs[_0x477d('0xe0')](path['join'](_0x53a5d9,util[_0x477d('0xc2')](_0x477d('0xe1'),_0x280860)),_0x4bcda6);return _0x23af18(_0x4bcda6);});});})[_0x477d('0x1a')](function(){return new BPromise(function(_0x2976b5,_0x14f3e4){zipdir(_0x53a5d9,{'saveTo':_0x48c206},function(_0x2efb9d,_0x3bb6ce){if(_0x2efb9d)return _0x14f3e4(_0x2efb9d);return _0x2976b5(_0x3bb6ce);});})[_0x477d('0x1a')](function(){return new BPromise(function(_0x423a45,_0x59f31f){rimraf(_0x53a5d9,function(_0x41baa1){if(_0x41baa1)_0x59f31f(_0x41baa1);return _0x423a45();});});})[_0x477d('0x1a')](function(){return _0x374539[_0x477d('0xcc')](_0x48c206,_0xd5793e,function(_0x133eb6){if(!_0x133eb6)fs[_0x477d('0xe2')](_0x48c206);});});});}else{return _0x374539['sendStatus'](0xc8);}})[_0x477d('0x2c')](handleError(_0x374539,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 3b12804..157a3a3 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 _0xa7ee=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage'];(function(_0x54d49e,_0x5d9911){var _0x4af0f1=function(_0xf117b3){while(--_0xf117b3){_0x54d49e['push'](_0x54d49e['shift']());}};_0x4af0f1(++_0x5d9911);}(_0xa7ee,0x119));var _0xea7e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa7ee[_0x4baae2];return _0x1a2285;};'use strict';var EventEmitter=require(_0xea7e('0x0'));var MailInteraction=require(_0xea7e('0x1'))['db'][_0xea7e('0x2')];var MailMessage=require(_0xea7e('0x1'))['db'][_0xea7e('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xea7e('0x4')](0x0);var events={'afterCreate':_0xea7e('0x5'),'afterUpdate':_0xea7e('0x6'),'afterDestroy':_0xea7e('0x7')};function emitEvent(_0x419698){return function(_0x2952e7,_0xf9017,_0xc6b99d){_0x2952e7[_0xea7e('0x8')]({'attributes':['id'],'raw':!![]})[_0xea7e('0x9')](function(_0x58a845){_0x2952e7[_0xea7e('0xa')](_0xea7e('0xb'),_0x58a845[_0xea7e('0xc')](function(_0x39f1b4){return{'id':_0x39f1b4['id']};}));return MailMessage[_0xea7e('0xd')]({'where':{'MailInteractionId':_0x2952e7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xea7e('0x9')](function(_0x10665b){_0x2952e7['setDataValue'](_0xea7e('0xe'),_0x10665b['length']);MailInteractionEvents[_0xea7e('0xf')](_0x419698+':'+_0x2952e7['id'],_0x2952e7);MailInteractionEvents[_0xea7e('0xf')](_0x419698,_0x2952e7);_0xc6b99d(null);})['catch'](_0xc6b99d(null));};}for(var e in events){if(events[_0xea7e('0x10')](e)){var event=events[e];MailInteraction[_0xea7e('0x11')](e,emitEvent(event));}}module[_0xea7e('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0xdf43=['MailMessage','setMaxListeners','save','update','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb'];(function(_0x275969,_0x3c5038){var _0x5d52f0=function(_0x4f3303){while(--_0x4f3303){_0x275969['push'](_0x275969['shift']());}};_0x5d52f0(++_0x3c5038);}(_0xdf43,0x64));var _0x3df4=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xdf43[_0x11005e];return _0x29338f;};'use strict';var EventEmitter=require(_0x3df4('0x0'));var MailInteraction=require(_0x3df4('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0x3df4('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x3df4('0x3')](0x0);var events={'afterCreate':_0x3df4('0x4'),'afterUpdate':_0x3df4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3207ec){return function(_0x58d53a,_0x34535a,_0xeadd92){_0x58d53a[_0x3df4('0x6')]({'attributes':['id'],'raw':!![]})[_0x3df4('0x7')](function(_0x5bcf1d){_0x58d53a[_0x3df4('0x8')]('Users',_0x5bcf1d[_0x3df4('0x9')](function(_0x2a0ed8){return{'id':_0x2a0ed8['id']};}));return MailMessage[_0x3df4('0xa')]({'where':{'MailInteractionId':_0x58d53a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3df4('0x7')](function(_0x212ec4){_0x58d53a['setDataValue'](_0x3df4('0xb'),_0x212ec4[_0x3df4('0xc')]);MailInteractionEvents[_0x3df4('0xd')](_0x3207ec+':'+_0x58d53a['id'],_0x58d53a);MailInteractionEvents['emit'](_0x3207ec,_0x58d53a);_0xeadd92(null);})[_0x3df4('0xe')](_0xeadd92(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x3df4('0xf')](e,emitEvent(event));}}module[_0x3df4('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index de03ac0..1baa8c1 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 _0x4f4d=['update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','get'];(function(_0x3a3d20,_0x244316){var _0x33bc94=function(_0x215ba9){while(--_0x215ba9){_0x3a3d20['push'](_0x3a3d20['shift']());}};_0x33bc94(++_0x244316);}(_0x4f4d,0x19a));var _0xd4f4=function(_0x5e410d,_0x4eaf38){_0x5e410d=_0x5e410d-0x0;var _0xa97676=_0x4f4d[_0x5e410d];return _0xa97676;};'use strict';var _=require(_0xd4f4('0x0'));var util=require('util');var logger=require(_0xd4f4('0x1'))('api');var moment=require(_0xd4f4('0x2'));var BPromise=require(_0xd4f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4f4('0x4'));var rimraf=require(_0xd4f4('0x5'));var config=require(_0xd4f4('0x6'));var attributes=require(_0xd4f4('0x7'));module[_0xd4f4('0x8')]=function(_0x969e82,_0x140d9b){return _0x969e82[_0xd4f4('0x9')](_0xd4f4('0xa'),attributes,{'tableName':_0xd4f4('0xb'),'paranoid':![],'indexes':[{'name':_0xd4f4('0xc'),'fields':[_0xd4f4('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2caad2,_0x3a42ad,_0x23656b){if(_0x2caad2[_0xd4f4('0xe')]){_0x2caad2[_0xd4f4('0xf')]=moment()[_0xd4f4('0x10')](_0xd4f4('0x11'));}if(_0x2caad2[_0xd4f4('0x12')]){_0x2caad2[_0xd4f4('0x13')]=moment()[_0xd4f4('0x10')](_0xd4f4('0x11'));}_0x23656b(null,_0x3a42ad);},'beforeUpdate':function(_0x2b2043,_0x392b46,_0x315950){if(_0x2b2043[_0xd4f4('0x14')](_0xd4f4('0xe'))){_0x2b2043[_0xd4f4('0xf')]=_0x2b2043[_0xd4f4('0xe')]?moment()['format'](_0xd4f4('0x11')):null;}if(_0x2b2043['changed'](_0xd4f4('0x12'))){_0x2b2043[_0xd4f4('0x13')]=moment()[_0xd4f4('0x10')](_0xd4f4('0x11'));_0x2b2043[_0xd4f4('0xe')]=null;_0x2b2043['substatusAt']=null;}_0x315950(null,_0x2b2043);},'afterUpdate':function(_0x43ed6a,_0x18a833,_0x34f334){var _0x22bc55=_0x969e82['models'];var _0xbc877d=_0x43ed6a[_0xd4f4('0x15')]({'plain':!![]});if(_0xbc877d['closed']){return _0x22bc55['MailMessage'][_0xd4f4('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0xbc877d['id']}})[_0xd4f4('0x17')](function(){_0x34f334();})[_0xd4f4('0x18')](function(_0x14043c){_0x34f334(_0x14043c);});}else{_0x34f334();}}},'charset':_0xd4f4('0x19'),'collate':_0xd4f4('0x1a')});}; \ No newline at end of file +var _0xdeb8=['rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','closed','closedAt','models','MailMessage','update','catch','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path'];(function(_0x2adf89,_0x4286bb){var _0x37698e=function(_0x36da5b){while(--_0x36da5b){_0x2adf89['push'](_0x2adf89['shift']());}};_0x37698e(++_0x4286bb);}(_0xdeb8,0x6a));var _0x8deb=function(_0x2e68ff,_0x24a20b){_0x2e68ff=_0x2e68ff-0x0;var _0x4abd2f=_0xdeb8[_0x2e68ff];return _0x4abd2f;};'use strict';var _=require(_0x8deb('0x0'));var util=require(_0x8deb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8deb('0x2'));var BPromise=require(_0x8deb('0x3'));var rp=require(_0x8deb('0x4'));var fs=require('fs');var path=require(_0x8deb('0x5'));var rimraf=require(_0x8deb('0x6'));var config=require(_0x8deb('0x7'));var attributes=require(_0x8deb('0x8'));module[_0x8deb('0x9')]=function(_0x90b30f,_0x3d021e){return _0x90b30f[_0x8deb('0xa')](_0x8deb('0xb'),attributes,{'tableName':_0x8deb('0xc'),'paranoid':![],'indexes':[{'name':_0x8deb('0xd'),'fields':[_0x8deb('0xe'),'to'],'type':_0x8deb('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x35404f,_0x281082,_0xf06cb0){if(_0x35404f[_0x8deb('0x10')]){_0x35404f[_0x8deb('0x11')]=moment()[_0x8deb('0x12')](_0x8deb('0x13'));}if(_0x35404f['closed']){_0x35404f['closedAt']=moment()[_0x8deb('0x12')](_0x8deb('0x13'));}_0xf06cb0(null,_0x281082);},'beforeUpdate':function(_0x556e74,_0x33037d,_0x24af56){if(_0x556e74['changed'](_0x8deb('0x10'))){_0x556e74[_0x8deb('0x11')]=_0x556e74[_0x8deb('0x10')]?moment()[_0x8deb('0x12')](_0x8deb('0x13')):null;}if(_0x556e74[_0x8deb('0x14')](_0x8deb('0x15'))){_0x556e74[_0x8deb('0x16')]=moment()[_0x8deb('0x12')](_0x8deb('0x13'));_0x556e74[_0x8deb('0x10')]=null;_0x556e74['substatusAt']=null;}_0x24af56(null,_0x556e74);},'afterUpdate':function(_0x295ec7,_0x2fd429,_0x137261){var _0x51d951=_0x90b30f[_0x8deb('0x17')];var _0x5b5055=_0x295ec7['get']({'plain':!![]});if(_0x5b5055['closed']){return _0x51d951[_0x8deb('0x18')][_0x8deb('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x5b5055['id']}})['then'](function(){_0x137261();})[_0x8deb('0x1a')](function(_0x5bd1ab){_0x137261(_0x5bd1ab);});}else{_0x137261();}}},'charset':'utf8mb4','collate':_0x8deb('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 0ef0334..c1f093e 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 _0xe55d=['catch','update','options','raw','where','attributes','UpdateMailInteraction','MailInteraction','find','addTags','body','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x56e6ea,_0x476716){var _0x228e7a=function(_0x2f7d01){while(--_0x2f7d01){_0x56e6ea['push'](_0x56e6ea['shift']());}};_0x228e7a(++_0x476716);}(_0xe55d,0x126));var _0xde55=function(_0x3033c1,_0x28cf6a){_0x3033c1=_0x3033c1-0x0;var _0x107c9d=_0xe55d[_0x3033c1];return _0x107c9d;};'use strict';var _=require(_0xde55('0x0'));var util=require(_0xde55('0x1'));var moment=require('moment');var BPromise=require(_0xde55('0x2'));var rs=require(_0xde55('0x3'));var fs=require('fs');var Redis=require(_0xde55('0x4'));var db=require(_0xde55('0x5'))['db'];var utils=require(_0xde55('0x6'));var logger=require(_0xde55('0x7'))('rpc');var config=require(_0xde55('0x8'));var jayson=require(_0xde55('0x9'));var client=jayson[_0xde55('0xa')]['http']({'port':0x232a});config[_0xde55('0xb')]=_[_0xde55('0xc')](config[_0xde55('0xb')],{'host':_0xde55('0xd'),'port':0x18eb});var socket=require(_0xde55('0xe'))(new Redis(config[_0xde55('0xb')]));require('./mailInteraction.socket')[_0xde55('0xf')](socket);function respondWithRpcPromise(_0x170817,_0x4cceb0,_0x4da24f){return new BPromise(function(_0x752d81,_0x1bb15b){return client['request'](_0x170817,_0x4da24f)[_0xde55('0x10')](function(_0x23edbf){logger['info'](_0xde55('0x11'),_0x4cceb0,_0xde55('0x12'));logger[_0xde55('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x4cceb0,_0xde55('0x12'),JSON[_0xde55('0x14')](_0x23edbf));if(_0x23edbf[_0xde55('0x15')]){if(_0x23edbf[_0xde55('0x15')][_0xde55('0x16')]===0x1f4){logger[_0xde55('0x15')]('MailInteraction,\x20%s,\x20%s',_0x4cceb0,_0x23edbf['error'][_0xde55('0x17')]);return _0x1bb15b(_0x23edbf[_0xde55('0x15')]['message']);}logger[_0xde55('0x15')](_0xde55('0x11'),_0x4cceb0,_0x23edbf[_0xde55('0x15')][_0xde55('0x17')]);return _0x752d81(_0x23edbf[_0xde55('0x15')][_0xde55('0x17')]);}else{logger[_0xde55('0x18')](_0xde55('0x11'),_0x4cceb0,_0xde55('0x12'));_0x752d81(_0x23edbf[_0xde55('0x19')][_0xde55('0x17')]);}})[_0xde55('0x1a')](function(_0x4605d0){logger['error'](_0xde55('0x11'),_0x4cceb0,_0x4605d0);_0x1bb15b(_0x4605d0);});});}exports['UpdateMailInteraction']=function(_0x45a7e5){var _0x435356=this;return new Promise(function(_0x5c0a7e,_0x2dc9b9){return db['MailInteraction'][_0xde55('0x1b')](_0x45a7e5['body'],{'raw':_0x45a7e5[_0xde55('0x1c')]?_0x45a7e5['options'][_0xde55('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45a7e5[_0xde55('0x1c')]?_0x45a7e5[_0xde55('0x1c')][_0xde55('0x1e')]||null:null,'attributes':_0x45a7e5[_0xde55('0x1c')]?_0x45a7e5[_0xde55('0x1c')][_0xde55('0x1f')]||null:null,'limit':_0x45a7e5[_0xde55('0x1c')]?_0x45a7e5[_0xde55('0x1c')]['limit']||null:null})['then'](function(_0x409881){logger[_0xde55('0x18')](_0xde55('0x20'),_0x45a7e5);logger[_0xde55('0x13')](_0xde55('0x20'),_0x45a7e5,JSON[_0xde55('0x14')](_0x409881));_0x5c0a7e(_0x409881);})[_0xde55('0x1a')](function(_0x443b12){logger[_0xde55('0x15')](_0xde55('0x20'),_0x443b12[_0xde55('0x17')],_0x45a7e5);_0x2dc9b9(_0x435356[_0xde55('0x15')](0x1f4,_0x443b12[_0xde55('0x17')]));});});};exports['AddTagsToMailInteraction']=function(_0x498706){return new Promise(function(_0x2073c1,_0x51334d){return db[_0xde55('0x21')][_0xde55('0x22')]({'where':_0x498706[_0xde55('0x1c')]?_0x498706['options'][_0xde55('0x1e')]||null:null})[_0xde55('0x10')](function(_0x5babe1){if(_0x5babe1){return _0x5babe1[_0xde55('0x23')](_0x498706[_0xde55('0x24')][_0xde55('0x25')],_['omit'](_0x498706['body'],[_0xde55('0x25'),'id'])||{});}})[_0xde55('0x26')](function(_0x6e4d03){logger[_0xde55('0x18')](_0xde55('0x27'),_0x498706);logger[_0xde55('0x13')]('AddTags',_0x498706,JSON[_0xde55('0x14')](_0x6e4d03));_0x2073c1(_0x6e4d03);})[_0xde55('0x1a')](function(_0xfb293c){logger['error'](_0xde55('0x27'),_0xfb293c[_0xde55('0x17')],_0x498706);_0x51334d(_this[_0xde55('0x15')](0x1f4,_0xfb293c[_0xde55('0x17')]));});});}; \ No newline at end of file +var _0xb296=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./mailInteraction.socket','register','then','info','request\x20sent','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','update','body','options','raw','where','attributes','debug','stringify','AddTagsToMailInteraction','MailInteraction','find','addTags','ids','spread','AddTags','lodash'];(function(_0x3b70c6,_0x47f216){var _0x50fd6f=function(_0x36568a){while(--_0x36568a){_0x3b70c6['push'](_0x3b70c6['shift']());}};_0x50fd6f(++_0x47f216);}(_0xb296,0xa3));var _0x6b29=function(_0x2b9ed8,_0x2af310){_0x2b9ed8=_0x2b9ed8-0x0;var _0x4da2fa=_0xb296[_0x2b9ed8];return _0x4da2fa;};'use strict';var _=require(_0x6b29('0x0'));var util=require(_0x6b29('0x1'));var moment=require(_0x6b29('0x2'));var BPromise=require(_0x6b29('0x3'));var rs=require(_0x6b29('0x4'));var fs=require('fs');var Redis=require(_0x6b29('0x5'));var db=require(_0x6b29('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b29('0x7'))('rpc');var config=require(_0x6b29('0x8'));var jayson=require(_0x6b29('0x9'));var client=jayson['client'][_0x6b29('0xa')]({'port':0x232a});config[_0x6b29('0xb')]=_[_0x6b29('0xc')](config[_0x6b29('0xb')],{'host':_0x6b29('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b29('0xb')]));require(_0x6b29('0xe'))[_0x6b29('0xf')](socket);function respondWithRpcPromise(_0x39d65c,_0x1eb87c,_0x3c6e6f){return new BPromise(function(_0x2c2823,_0x3ece8b){return client['request'](_0x39d65c,_0x3c6e6f)[_0x6b29('0x10')](function(_0x754be9){logger[_0x6b29('0x11')]('MailInteraction,\x20%s,\x20%s',_0x1eb87c,_0x6b29('0x12'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x1eb87c,_0x6b29('0x12'),JSON['stringify'](_0x754be9));if(_0x754be9['error']){if(_0x754be9[_0x6b29('0x13')][_0x6b29('0x14')]===0x1f4){logger['error'](_0x6b29('0x15'),_0x1eb87c,_0x754be9[_0x6b29('0x13')][_0x6b29('0x16')]);return _0x3ece8b(_0x754be9[_0x6b29('0x13')][_0x6b29('0x16')]);}logger[_0x6b29('0x13')](_0x6b29('0x15'),_0x1eb87c,_0x754be9['error'][_0x6b29('0x16')]);return _0x2c2823(_0x754be9[_0x6b29('0x13')][_0x6b29('0x16')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x1eb87c,_0x6b29('0x12'));_0x2c2823(_0x754be9[_0x6b29('0x17')][_0x6b29('0x16')]);}})[_0x6b29('0x18')](function(_0x18b4c8){logger[_0x6b29('0x13')](_0x6b29('0x15'),_0x1eb87c,_0x18b4c8);_0x3ece8b(_0x18b4c8);});});}exports[_0x6b29('0x19')]=function(_0x555008){var _0x18da5b=this;return new Promise(function(_0xdf69a8,_0x237eba){return db['MailInteraction'][_0x6b29('0x1a')](_0x555008[_0x6b29('0x1b')],{'raw':_0x555008['options']?_0x555008[_0x6b29('0x1c')][_0x6b29('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x555008['options']?_0x555008[_0x6b29('0x1c')][_0x6b29('0x1e')]||null:null,'attributes':_0x555008[_0x6b29('0x1c')]?_0x555008[_0x6b29('0x1c')][_0x6b29('0x1f')]||null:null,'limit':_0x555008['options']?_0x555008[_0x6b29('0x1c')]['limit']||null:null})[_0x6b29('0x10')](function(_0x4178e6){logger[_0x6b29('0x11')](_0x6b29('0x19'),_0x555008);logger[_0x6b29('0x20')](_0x6b29('0x19'),_0x555008,JSON[_0x6b29('0x21')](_0x4178e6));_0xdf69a8(_0x4178e6);})['catch'](function(_0x8eb15f){logger[_0x6b29('0x13')](_0x6b29('0x19'),_0x8eb15f[_0x6b29('0x16')],_0x555008);_0x237eba(_0x18da5b['error'](0x1f4,_0x8eb15f['message']));});});};exports[_0x6b29('0x22')]=function(_0x207c39){return new Promise(function(_0x330a6d,_0x18ea35){return db[_0x6b29('0x23')][_0x6b29('0x24')]({'where':_0x207c39[_0x6b29('0x1c')]?_0x207c39['options'][_0x6b29('0x1e')]||null:null})[_0x6b29('0x10')](function(_0x2123d4){if(_0x2123d4){return _0x2123d4[_0x6b29('0x25')](_0x207c39[_0x6b29('0x1b')][_0x6b29('0x26')],_['omit'](_0x207c39[_0x6b29('0x1b')],[_0x6b29('0x26'),'id'])||{});}})[_0x6b29('0x27')](function(_0x225d84){logger[_0x6b29('0x11')](_0x6b29('0x28'),_0x207c39);logger[_0x6b29('0x20')]('AddTags',_0x207c39,JSON[_0x6b29('0x21')](_0x225d84));_0x330a6d(_0x225d84);})[_0x6b29('0x18')](function(_0x2e3477){logger[_0x6b29('0x13')](_0x6b29('0x28'),_0x2e3477[_0x6b29('0x16')],_0x207c39);_0x18ea35(_this[_0x6b29('0x13')](0x1f4,_0x2e3477[_0x6b29('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index cefc6af..cbb1e3a 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 _0xd213=['save','update','emit','length','mailInteraction:','./mailInteraction.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd213,0x83));var _0x3d21=function(_0x4fde34,_0x296390){_0x4fde34=_0x4fde34-0x0;var _0x194c0f=_0xd213[_0x4fde34];return _0x194c0f;};'use strict';var MailInteractionEvents=require(_0x3d21('0x0'));var events=[_0x3d21('0x1'),'remove',_0x3d21('0x2')];function createListener(_0xe633f1,_0x1babf7){return function(_0xd6356b){_0x1babf7[_0x3d21('0x3')](_0xe633f1,_0xd6356b);};}function removeListener(_0x11942a,_0x1103bb){return function(){MailInteractionEvents['removeListener'](_0x11942a,_0x1103bb);};}exports['register']=function(_0x1b6bee){for(var _0x2eb9ab=0x0,_0x4bd35c=events[_0x3d21('0x4')];_0x2eb9ab<_0x4bd35c;_0x2eb9ab++){var _0x175535=events[_0x2eb9ab];var _0x432bd8=createListener(_0x3d21('0x5')+_0x175535,_0x1b6bee);MailInteractionEvents['on'](_0x175535,_0x432bd8);}}; \ No newline at end of file +var _0x5016=['removeListener','register','mailInteraction:','save','remove','update'];(function(_0x531569,_0x37dd75){var _0x34d342=function(_0x492456){while(--_0x492456){_0x531569['push'](_0x531569['shift']());}};_0x34d342(++_0x37dd75);}(_0x5016,0x153));var _0x6501=function(_0x2feb53,_0x264ef7){_0x2feb53=_0x2feb53-0x0;var _0x5700ee=_0x5016[_0x2feb53];return _0x5700ee;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x6501('0x0'),_0x6501('0x1'),_0x6501('0x2')];function createListener(_0x22cdfa,_0x26c8a5){return function(_0x156f49){_0x26c8a5['emit'](_0x22cdfa,_0x156f49);};}function removeListener(_0x1d9a4c,_0xd4711e){return function(){MailInteractionEvents[_0x6501('0x3')](_0x1d9a4c,_0xd4711e);};}exports[_0x6501('0x4')]=function(_0x5087c7){for(var _0x12c24c=0x0,_0x5c930d=events['length'];_0x12c24c<_0x5c930d;_0x12c24c++){var _0x55204e=events[_0x12c24c];var _0x5e9309=createListener(_0x6501('0x5')+_0x55204e,_0x5087c7);MailInteractionEvents['on'](_0x55204e,_0x5e9309);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index dda563d..ee863a9 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 _0x4c48=['describe','show','/:id/download','post','tracked','mailmessage:create','create','put','/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe'];(function(_0x130fff,_0x476e){var _0x13c1aa=function(_0xd6c191){while(--_0xd6c191){_0x130fff['push'](_0x130fff['shift']());}};_0x13c1aa(++_0x476e);}(_0x4c48,0x1e4));var _0x84c4=function(_0xbc4659,_0x578fba){_0xbc4659=_0xbc4659-0x0;var _0x5831f9=_0x4c48[_0xbc4659];return _0x5831f9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x84c4('0x0'));var timeout=require(_0x84c4('0x1'));var express=require(_0x84c4('0x2'));var router=express[_0x84c4('0x3')]();var fs_extra=require(_0x84c4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x84c4('0x5'));var controller=require(_0x84c4('0x6'));router[_0x84c4('0x7')]('/',auth[_0x84c4('0x8')](),controller['index']);router[_0x84c4('0x7')](_0x84c4('0x9'),auth['isAuthenticated'](),controller[_0x84c4('0xa')]);router['get']('/:id',auth[_0x84c4('0x8')](),controller[_0x84c4('0xb')]);router[_0x84c4('0x7')](_0x84c4('0xc'),auth[_0x84c4('0x8')](),controller['download']);router[_0x84c4('0xd')]('/',auth[_0x84c4('0x8')](),interaction[_0x84c4('0xe')]('mail',_0x84c4('0xf')),controller[_0x84c4('0x10')]);router[_0x84c4('0x11')](_0x84c4('0x12'),auth['isAuthenticated'](),controller[_0x84c4('0x13')]);router['put'](_0x84c4('0x14'),auth[_0x84c4('0x8')](),controller['accept']);router['put'](_0x84c4('0x15'),auth['isAuthenticated'](),controller[_0x84c4('0x16')]);router[_0x84c4('0x17')]('/:id',auth[_0x84c4('0x8')](),controller[_0x84c4('0x18')]);module[_0x84c4('0x19')]=router; \ No newline at end of file +var _0xaecf=['util','path','express','fs-extra','../../components/auth/service','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','download','post','mailmessage:create','put','update','/:id/accept','accept','destroy','exports','multer'];(function(_0x403230,_0x100c91){var _0x246eb3=function(_0x2aa681){while(--_0x2aa681){_0x403230['push'](_0x403230['shift']());}};_0x246eb3(++_0x100c91);}(_0xaecf,0x149));var _0xfaec=function(_0x14d086,_0x2ad1e6){_0x14d086=_0x14d086-0x0;var _0x5a0a73=_0xaecf[_0x14d086];return _0x5a0a73;};'use strict';var multer=require(_0xfaec('0x0'));var util=require(_0xfaec('0x1'));var path=require(_0xfaec('0x2'));var timeout=require('connect-timeout');var express=require(_0xfaec('0x3'));var router=express['Router']();var fs_extra=require(_0xfaec('0x4'));var auth=require(_0xfaec('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfaec('0x6'));router[_0xfaec('0x7')]('/',auth[_0xfaec('0x8')](),controller[_0xfaec('0x9')]);router['get'](_0xfaec('0xa'),auth['isAuthenticated'](),controller[_0xfaec('0xb')]);router['get'](_0xfaec('0xc'),auth[_0xfaec('0x8')](),controller['show']);router[_0xfaec('0x7')]('/:id/download',auth[_0xfaec('0x8')](),controller[_0xfaec('0xd')]);router[_0xfaec('0xe')]('/',auth[_0xfaec('0x8')](),interaction['tracked']('mail',_0xfaec('0xf')),controller['create']);router[_0xfaec('0x10')](_0xfaec('0xc'),auth[_0xfaec('0x8')](),controller[_0xfaec('0x11')]);router[_0xfaec('0x10')](_0xfaec('0x12'),auth[_0xfaec('0x8')](),controller[_0xfaec('0x13')]);router[_0xfaec('0x10')]('/:id/reject',auth[_0xfaec('0x8')](),controller['reject']);router['delete'](_0xfaec('0xc'),auth[_0xfaec('0x8')](),controller[_0xfaec('0x14')]);module[_0xfaec('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 88695d3..bf887a1 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 _0x0302=['INTEGER','Email','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x27fa65,_0x4e02ee){var _0x456594=function(_0x43b6da){while(--_0x43b6da){_0x27fa65['push'](_0x27fa65['shift']());}};_0x456594(++_0x4e02ee);}(_0x0302,0x1e3));var _0x2030=function(_0x39843a,_0x5288b3){_0x39843a=_0x39843a-0x0;var _0x175eb6=_0x0302[_0x39843a];return _0x175eb6;};'use strict';var Sequelize=require(_0x2030('0x0'));var _=require(_0x2030('0x1'));module[_0x2030('0x2')]={'body':{'type':Sequelize[_0x2030('0x3')](_0x2030('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x2030('0x3')](_0x2030('0x5'))},'read':{'type':Sequelize[_0x2030('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2030('0x7')]('in',_0x2030('0x8')),'defaultValue':_0x2030('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2030('0x9')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x2030('0x3')](_0x2030('0x4'))},'cc':{'type':Sequelize[_0x2030('0x3')](_0x2030('0x4'))},'bcc':{'type':Sequelize['TEXT'](_0x2030('0x4'))},'subject':{'type':Sequelize[_0x2030('0x3')]},'sentAt':{'type':Sequelize[_0x2030('0xa')]},'attach':{'type':Sequelize[_0x2030('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2030('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x2030('0x3')](_0x2030('0x4'))},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize[_0x2030('0x7')](_0x2030('0xc'),'Chat'),'defaultValue':_0x2030('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0x6387=['DATE','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','STRING'];(function(_0xf0ab7c,_0x23bbc2){var _0x198144=function(_0x1c3a40){while(--_0x1c3a40){_0xf0ab7c['push'](_0xf0ab7c['shift']());}};_0x198144(++_0x23bbc2);}(_0x6387,0x87));var _0x7638=function(_0x508259,_0x32d390){_0x508259=_0x508259-0x0;var _0x1d669e=_0x6387[_0x508259];return _0x1d669e;};'use strict';var Sequelize=require(_0x7638('0x0'));var _=require(_0x7638('0x1'));module[_0x7638('0x2')]={'body':{'type':Sequelize[_0x7638('0x3')](_0x7638('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x7638('0x5'))},'read':{'type':Sequelize[_0x7638('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7638('0x7')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x7638('0x8')](0x1fe)},'from':{'type':Sequelize[_0x7638('0x8')]},'to':{'type':Sequelize['TEXT'](_0x7638('0x4'))},'cc':{'type':Sequelize[_0x7638('0x3')](_0x7638('0x4'))},'bcc':{'type':Sequelize['TEXT'](_0x7638('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7638('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7638('0x9')]},'originTo':{'type':Sequelize[_0x7638('0x3')](_0x7638('0x4'))},'originCc':{'type':Sequelize[_0x7638('0x3')]('long')},'originChannel':{'type':Sequelize['ENUM'](_0x7638('0xa'),_0x7638('0xb')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 1738b8c..31f5ee4 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 _0x62ce=['stack','map','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','MailMessage','include','findAll','rows','params','rawAttributes','includeAll','find','update','body','describe','create','direction','out','split','MailAccount','findOne','CmList','List','CmContact','Contacts','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','MailInteraction','MailInteractionId','isNil','read1stAt','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','channel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','motionChannel','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','Attachments','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','build','writeFileSync','bluebird','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','./mailMessage.socket','register','jayson/promise','http','client','request','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','status','offset','undefined','limit','set','Content-Range','then','end'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0x62ce,0x1a2));var _0xe62c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x62ce[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0xe62c('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xe62c('0x1'));var Redis=require(_0xe62c('0x2'));var htmlToText=require(_0xe62c('0x3'));var qs=require(_0xe62c('0x4'));var logger=require(_0xe62c('0x5'))(_0xe62c('0x6'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0xe62c('0x7'));var db=require('../../mysqldb')['db'];config[_0xe62c('0x8')]=_['defaults'](config['redis'],{'host':_0xe62c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe62c('0x8')]));var htmlEntities=require('html-entities');require(_0xe62c('0xa'))[_0xe62c('0xb')](socket);var jayson=require(_0xe62c('0xc'));var client=jayson['client'][_0xe62c('0xd')]({'port':0x232c});var client9003=jayson['client'][_0xe62c('0xd')]({'port':0x232b});var client9002=jayson[_0xe62c('0xe')][_0xe62c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3e6960,_0x4831ba,_0x3db5bd,_0x515e23){return new BPromise(function(_0x2e27c6,_0x3599f7){var _0x3daae1=_0x515e23||client;return _0x3daae1[_0xe62c('0xf')](_0x3e6960,_0x3db5bd)['then'](function(_0x5daf23){logger[_0xe62c('0x10')]('MailMessage,\x20%s,\x20%s',_0x4831ba,'request\x20sent');logger[_0xe62c('0x11')](_0xe62c('0x12'),_0x4831ba,_0xe62c('0x13'),JSON[_0xe62c('0x14')](_0x5daf23));if(_0x5daf23['error']){if(_0x5daf23[_0xe62c('0x15')][_0xe62c('0x16')]===0x1f4){logger[_0xe62c('0x15')](_0xe62c('0x17'),_0x4831ba,_0x5daf23[_0xe62c('0x15')][_0xe62c('0x18')]);return _0x3599f7(_0x5daf23[_0xe62c('0x15')][_0xe62c('0x18')]);}logger['error'](_0xe62c('0x17'),_0x4831ba,_0x5daf23[_0xe62c('0x15')][_0xe62c('0x18')]);return _0x2e27c6(_0x5daf23[_0xe62c('0x15')][_0xe62c('0x18')]);}else{logger[_0xe62c('0x10')](_0xe62c('0x17'),_0x4831ba,'request\x20sent');_0x2e27c6(_0x5daf23[_0xe62c('0x19')][_0xe62c('0x18')]);}})[_0xe62c('0x1a')](function(_0x44e4cf){logger[_0xe62c('0x15')](_0xe62c('0x17'),_0x4831ba,_0x44e4cf);_0x3599f7(_0x44e4cf);});});}function respondWithResult(_0x4ecb27,_0x3d8231){_0x3d8231=_0x3d8231||0xc8;return function(_0x36ea8f){if(_0x36ea8f){return _0x4ecb27[_0xe62c('0x1b')](_0x3d8231)['json'](_0x36ea8f);}};}function respondWithFilteredResult(_0xf4d775,_0x81dcfa){return function(_0x6a20f1){if(_0x6a20f1){var _0x62a5b1=typeof _0x81dcfa[_0xe62c('0x1c')]===_0xe62c('0x1d')&&typeof _0x81dcfa['limit']==='undefined';var _0x449cad=_0x6a20f1['count'];var _0x41bcb3=_0x62a5b1?0x0:_0x81dcfa[_0xe62c('0x1c')];var _0x5a1797=_0x62a5b1?_0x6a20f1['count']:_0x81dcfa[_0xe62c('0x1c')]+_0x81dcfa[_0xe62c('0x1e')];var _0x50fe4f;if(_0x5a1797>=_0x449cad){_0x5a1797=_0x449cad;_0x50fe4f=0xc8;}else{_0x50fe4f=0xce;}_0xf4d775[_0xe62c('0x1b')](_0x50fe4f);return _0xf4d775[_0xe62c('0x1f')](_0xe62c('0x20'),_0x41bcb3+'-'+_0x5a1797+'/'+_0x449cad)['json'](_0x6a20f1);}return null;};}function saveUpdates(_0x58aa35){return function(_0x57af6d){if(_0x57af6d){return _0x57af6d['update'](_0x58aa35)[_0xe62c('0x21')](function(_0x491bf8){return _0x491bf8;});}return null;};}function removeEntity(_0x36877e){return function(_0x5ddd07){if(_0x5ddd07){return _0x5ddd07['destroy']()[_0xe62c('0x21')](function(){_0x36877e['status'](0xcc)[_0xe62c('0x22')]();});}};}function handleEntityNotFound(_0x33a17b){return function(_0x27aefa){if(!_0x27aefa){_0x33a17b['sendStatus'](0x194);}return _0x27aefa;};}function handleError(_0x25b3d0,_0xafb8c9){_0xafb8c9=_0xafb8c9||0x1f4;return function(_0xf271a7){logger[_0xe62c('0x15')](_0xf271a7[_0xe62c('0x23')]);if(_0xf271a7['name']){delete _0xf271a7['name'];}_0x25b3d0[_0xe62c('0x1b')](_0xafb8c9)['send'](_0xf271a7);};}exports['index']=function(_0x34864b,_0x4e2859){var _0x5e4f3a={},_0x5173a4={},_0x51b39c={'count':0x0,'rows':[]};var _0x31cc0f=_[_0xe62c('0x24')](db['MailMessage']['rawAttributes'],function(_0x17e47d){return{'name':_0x17e47d[_0xe62c('0x25')],'type':_0x17e47d[_0xe62c('0x26')][_0xe62c('0x27')]};});_0x5173a4['model']=_[_0xe62c('0x24')](_0x31cc0f,_0xe62c('0x28'));_0x5173a4[_0xe62c('0x29')]=_[_0xe62c('0x2a')](_0x34864b[_0xe62c('0x29')]);_0x5173a4[_0xe62c('0x2b')]=_[_0xe62c('0x2c')](_0x5173a4[_0xe62c('0x2d')],_0x5173a4[_0xe62c('0x29')]);_0x5e4f3a[_0xe62c('0x2e')]=_[_0xe62c('0x2c')](_0x5173a4[_0xe62c('0x2d')],qs[_0xe62c('0x2f')](_0x34864b[_0xe62c('0x29')][_0xe62c('0x2f')]));_0x5e4f3a['attributes']=_0x5e4f3a[_0xe62c('0x2e')][_0xe62c('0x30')]?_0x5e4f3a['attributes']:_0x5173a4['model'];if(!_0x34864b['query'][_0xe62c('0x31')](_0xe62c('0x32'))){_0x5e4f3a[_0xe62c('0x1e')]=qs[_0xe62c('0x1e')](_0x34864b[_0xe62c('0x29')][_0xe62c('0x1e')]);_0x5e4f3a[_0xe62c('0x1c')]=qs[_0xe62c('0x1c')](_0x34864b[_0xe62c('0x29')]['offset']);}_0x5e4f3a[_0xe62c('0x33')]=qs['sort'](_0x34864b[_0xe62c('0x29')][_0xe62c('0x34')]);_0x5e4f3a[_0xe62c('0x35')]=qs[_0xe62c('0x2b')](_[_0xe62c('0x36')](_0x34864b[_0xe62c('0x29')],_0x5173a4[_0xe62c('0x2b')]),_0x31cc0f);if(_0x34864b['query']['filter']){_0x5e4f3a['where']=_[_0xe62c('0x37')](_0x5e4f3a[_0xe62c('0x35')],{'$or':_[_0xe62c('0x24')](_0x31cc0f,function(_0x2ba775){if(_0x2ba775['type']!==_0xe62c('0x38')){var _0x4770a9={};_0x4770a9[_0x2ba775['name']]={'$like':'%'+_0x34864b[_0xe62c('0x29')][_0xe62c('0x39')]+'%'};return _0x4770a9;}})});}_0x5e4f3a=_[_0xe62c('0x37')]({},_0x5e4f3a,_0x34864b[_0xe62c('0x3a')]);var _0x8ab3b3={'where':_0x5e4f3a[_0xe62c('0x35')]};return db[_0xe62c('0x3b')]['count'](_0x8ab3b3)[_0xe62c('0x21')](function(_0x1dfc1e){_0x51b39c['count']=_0x1dfc1e;if(_0x34864b[_0xe62c('0x29')]['includeAll']){_0x5e4f3a[_0xe62c('0x3c')]=[{'all':!![]}];}return db[_0xe62c('0x3b')][_0xe62c('0x3d')](_0x5e4f3a);})[_0xe62c('0x21')](function(_0x255b4d){_0x51b39c[_0xe62c('0x3e')]=_0x255b4d;return _0x51b39c;})['then'](respondWithFilteredResult(_0x4e2859,_0x5e4f3a))[_0xe62c('0x1a')](handleError(_0x4e2859,null));};exports['show']=function(_0x57ff0d,_0x19656b){var _0x3f451f={'raw':!![],'where':{'id':_0x57ff0d[_0xe62c('0x3f')]['id']}},_0x1161f9={};_0x1161f9[_0xe62c('0x2d')]=_[_0xe62c('0x2a')](db['MailMessage'][_0xe62c('0x40')]);_0x1161f9[_0xe62c('0x29')]=_['keys'](_0x57ff0d[_0xe62c('0x29')]);_0x1161f9[_0xe62c('0x2b')]=_[_0xe62c('0x2c')](_0x1161f9[_0xe62c('0x2d')],_0x1161f9[_0xe62c('0x29')]);_0x3f451f[_0xe62c('0x2e')]=_[_0xe62c('0x2c')](_0x1161f9[_0xe62c('0x2d')],qs['fields'](_0x57ff0d[_0xe62c('0x29')]['fields']));_0x3f451f[_0xe62c('0x2e')]=_0x3f451f[_0xe62c('0x2e')][_0xe62c('0x30')]?_0x3f451f['attributes']:_0x1161f9[_0xe62c('0x2d')];if(_0x57ff0d[_0xe62c('0x29')][_0xe62c('0x41')]){_0x3f451f[_0xe62c('0x3c')]=[{'all':!![]}];}_0x3f451f=_['merge']({},_0x3f451f,_0x57ff0d[_0xe62c('0x3a')]);return db['MailMessage'][_0xe62c('0x42')](_0x3f451f)[_0xe62c('0x21')](handleEntityNotFound(_0x19656b,null))[_0xe62c('0x21')](respondWithResult(_0x19656b,null))[_0xe62c('0x1a')](handleError(_0x19656b,null));};exports[_0xe62c('0x43')]=function(_0x5c5a9d,_0x426d22){if(_0x5c5a9d[_0xe62c('0x44')]['id']){delete _0x5c5a9d[_0xe62c('0x44')]['id'];}return db['MailMessage'][_0xe62c('0x42')]({'where':{'id':_0x5c5a9d[_0xe62c('0x3f')]['id']}})[_0xe62c('0x21')](handleEntityNotFound(_0x426d22,null))[_0xe62c('0x21')](saveUpdates(_0x5c5a9d[_0xe62c('0x44')],null))[_0xe62c('0x21')](respondWithResult(_0x426d22,null))[_0xe62c('0x1a')](handleError(_0x426d22,null));};exports['destroy']=function(_0x37f3a5,_0x113a05){return db['MailMessage'][_0xe62c('0x42')]({'where':{'id':_0x37f3a5[_0xe62c('0x3f')]['id']}})[_0xe62c('0x21')](handleEntityNotFound(_0x113a05,null))['then'](removeEntity(_0x113a05,null))['catch'](handleError(_0x113a05,null));};exports[_0xe62c('0x45')]=function(_0x790f29,_0x2b6a6c){return db['MailMessage'][_0xe62c('0x45')]()[_0xe62c('0x21')](respondWithResult(_0x2b6a6c,null))[_0xe62c('0x1a')](handleError(_0x2b6a6c,null));};exports[_0xe62c('0x46')]=function(_0x51dba6,_0x4f6529){return db[_0xe62c('0x3b')][_0xe62c('0x46')](_0x51dba6[_0xe62c('0x44')])[_0xe62c('0x21')](function(_0x19f627){if(_0x19f627){if(_0x19f627[_0xe62c('0x47')]===_0xe62c('0x48')&&!_0x19f627['secret']){var _0x4c5299,_0x2ac629,_0x40af51;if(_0x51dba6['body']['to']){_0x2ac629=_0x51dba6[_0xe62c('0x44')]['to'][_0xe62c('0x49')](',')[0x0];}return db[_0xe62c('0x4a')][_0xe62c('0x4b')]({'where':{'id':_0x19f627['MailAccountId']},'include':[{'model':db[_0xe62c('0x4c')],'as':_0xe62c('0x4d'),'include':[{'model':db[_0xe62c('0x4e')],'as':_0xe62c('0x4f'),'where':{'email':_0x2ac629},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailServerOut'],'as':_0xe62c('0x50'),'raw':!![],'include':[{'model':db[_0xe62c('0x51')],'as':_0xe62c('0x51'),'raw':!![]}]}]})[_0xe62c('0x21')](function(_0x8e47d){_0x4c5299=_0x8e47d;if(!_0x4c5299||!_0x4c5299[_0xe62c('0x50')])return;var _0x476cb5=_0x4c5299[_0xe62c('0x52')]();if(_0x51dba6[_0xe62c('0x44')][_0xe62c('0x53')]&&_0x51dba6['body'][_0xe62c('0x53')][_0xe62c('0x30')]){for(var _0x43ef61=0x0;_0x43ef61<_0x51dba6['body'][_0xe62c('0x53')][_0xe62c('0x30')];_0x43ef61+=0x1){_0x51dba6['body'][_0xe62c('0x53')][_0x43ef61]={'filename':_0x51dba6['body'][_0xe62c('0x53')][_0x43ef61]['name'],'path':path[_0xe62c('0x54')](config[_0xe62c('0x55')],_0xe62c('0x56'),_0x51dba6[_0xe62c('0x44')][_0xe62c('0x53')][_0x43ef61][_0xe62c('0x57')])};}}_0x40af51={'account':_0x476cb5,'message':_0x51dba6[_0xe62c('0x44')]};return;})[_0xe62c('0x21')](function(){if(_0x4c5299['List']){if(_0x4c5299['List'][_0xe62c('0x4f')]['length']){return _0x4c5299[_0xe62c('0x4d')][_0xe62c('0x4f')][0x0];}else{return db[_0xe62c('0x4e')][_0xe62c('0x46')](_['defaults'](_0x51dba6[_0xe62c('0x44')],{'firstName':_0x51dba6[_0xe62c('0x44')]['to'],'email':_0x51dba6[_0xe62c('0x44')]['to'],'phone':_0x51dba6[_0xe62c('0x44')]['to'],'ListId':_0x4c5299[_0xe62c('0x58')]}));}}else{throw new Error(_0xe62c('0x59'));}})[_0xe62c('0x21')](function(){if(_0x40af51){return respondWithRpcPromise(_0xe62c('0x5a'),_0xe62c('0x5b'),_0x40af51,client9003)[_0xe62c('0x21')](function(_0xe0fdd8){return _0x19f627[_0xe62c('0x43')]({'read':!![],'messageId':_0xe0fdd8['messageId'],'sentAt':moment()[_0xe62c('0x5c')](_0xe62c('0x5d'))});})[_0xe62c('0x1a')](function(_0x367c37){logger[_0xe62c('0x15')]('%s',JSON[_0xe62c('0x14')](_0x367c37));return _0x19f627;});}return _0x19f627;});}return _0x19f627;}})[_0xe62c('0x21')](respondWithResult(_0x4f6529,0xc9))[_0xe62c('0x1a')](handleError(_0x4f6529,null));};exports[_0xe62c('0x5e')]=function(_0x2842cb,_0x5d8071){var _0x2209ae={'agent':{},'channel':_0xe62c('0x5f')};if(_0x2842cb[_0xe62c('0x44')]['id']){delete _0x2842cb[_0xe62c('0x44')]['id'];}_0x2842cb[_0xe62c('0x44')][_0xe62c('0x60')]=!![];_0x2842cb['body'][_0xe62c('0x61')]=moment()[_0xe62c('0x5c')](_0xe62c('0x5d'));_0x2842cb[_0xe62c('0x44')]['UserId']=_0x2842cb['body'][_0xe62c('0x62')]||_0x2842cb['user']['id'];_0x2209ae[_0xe62c('0x63')]['id']=_0x2842cb[_0xe62c('0x44')]['UserId'];return db['MailMessage'][_0xe62c('0x42')]({'where':{'id':_0x2842cb[_0xe62c('0x3f')]['id'],'UserId':null}})[_0xe62c('0x21')](handleEntityNotFound(_0x5d8071,null))[_0xe62c('0x21')](saveUpdates(_0x2842cb[_0xe62c('0x44')],null))[_0xe62c('0x21')](function(_0x1f9198){if(_0x1f9198){_0x2209ae['message']=_0x1f9198['get']({'plain':!![]});return db[_0xe62c('0x64')][_0xe62c('0x42')]({'where':{'id':_0x1f9198[_0xe62c('0x65')]}});}return null;})[_0xe62c('0x21')](handleEntityNotFound(_0x5d8071,null))[_0xe62c('0x21')](function(_0x44efb3){if(_0x44efb3){return _0x44efb3[_0xe62c('0x43')]({'UserId':_0x2842cb[_0xe62c('0x44')][_0xe62c('0x62')],'read1stAt':_[_0xe62c('0x66')](_0x44efb3[_0xe62c('0x67')])?moment()[_0xe62c('0x5c')](_0xe62c('0x5d')):undefined});}return null;})[_0xe62c('0x21')](function(_0x25a7b6){if(_0x25a7b6){_0x2209ae['interaction']=_0x25a7b6[_0xe62c('0x68')]({'plain':!![]});interaction_log[_0xe62c('0x10')](_0xe62c('0x69'),_0x2842cb[_0xe62c('0x6a')]['id'],_0x2842cb[_0xe62c('0x6a')]['name'],_0x2842cb['user'][_0xe62c('0x6b')],_0x2209ae[_0xe62c('0x6c')]['id'],_0x2842cb['body']?JSON[_0xe62c('0x14')](_0x2842cb['body']):_0xe62c('0x6d'));return respondWithRpcPromise('AcceptMessage',_0xe62c('0x6e'),_0x2209ae);}return null;})['then'](function(_0x3f68e9){var _0x3aa817=_0xe62c('0x6f')+_0x3f68e9[_0xe62c('0x18')][_0xe62c('0x70')];return db[_0xe62c('0x71')][_0xe62c('0x29')](_0x3aa817,{'type':db[_0xe62c('0x72')][_0xe62c('0x73')][_0xe62c('0x74')],'raw':!![]})[_0xe62c('0x21')](function(_0x250c3d){return _0x250c3d;});})['then'](function(_0xdf281b){if(_0xdf281b){_0x2209ae[_0xe62c('0x18')][_0xe62c('0x75')]=_0xdf281b[0x0];if(!_0x2842cb[_0xe62c('0x44')]['UserId'])return;return db[_0xe62c('0x76')][_0xe62c('0x42')]({'where':{'id':_0x2842cb[_0xe62c('0x44')][_0xe62c('0x62')],'role':'agent'},'attributes':['id',_0xe62c('0x28'),'fullname',_0xe62c('0x77'),_0xe62c('0x78')],'raw':!![]});}return null;})[_0xe62c('0x21')](function(_0x4e980a){if(!_0x4e980a)return null;_0x2209ae['message'][_0xe62c('0x63')]=_0x4e980a;return _0x2209ae;})['then'](function(_0x134e4f){if(_0x134e4f){if(_0x2842cb['body']['manual']){_0x2209ae[_0xe62c('0x18')]['interface']=util[_0xe62c('0x5c')]('SIP/%s',_0x2842cb[_0xe62c('0x6a')][_0xe62c('0x28')]);_0x2209ae[_0xe62c('0x18')]['channel']=_0x2209ae[_0xe62c('0x79')];_0x2209ae[_0xe62c('0x18')]['motionChannel']=_0x2209ae['channel'];_0x2209ae[_0xe62c('0x18')][_0xe62c('0x7a')]='accept';_0x2209ae[_0xe62c('0x18')][_0xe62c('0x44')]=htmlToText[_0xe62c('0x7b')](_0x2209ae[_0xe62c('0x18')]['body']);return respondWithRpcPromise('EventManager',_0xe62c('0x7c'),{'event':_0xe62c('0x7d'),'message':_0x2209ae['message']},client9002)['then'](function(){return _0x2209ae;});}return _0x2209ae;}return null;})[_0xe62c('0x21')](respondWithResult(_0x5d8071,null))[_0xe62c('0x1a')](handleError(_0x5d8071,null));};exports[_0xe62c('0x7e')]=function(_0x573535,_0x3d6784){var _0x20ae73={'agent':{},'channel':_0xe62c('0x5f')};if(_0x573535['body']['id']){delete _0x573535[_0xe62c('0x44')]['id'];}_0x573535[_0xe62c('0x44')][_0xe62c('0x62')]=_0x573535['body'][_0xe62c('0x62')]||_0x573535[_0xe62c('0x6a')]['id'];_0x20ae73[_0xe62c('0x63')]['id']=_0x573535['body'][_0xe62c('0x62')];return db['MailMessage'][_0xe62c('0x42')]({'where':{'id':_0x573535[_0xe62c('0x3f')]['id'],'UserId':null}})[_0xe62c('0x21')](handleEntityNotFound(_0x3d6784,null))['then'](function(_0x5ddd98){if(_0x5ddd98){_0x20ae73[_0xe62c('0x18')]=_0x5ddd98['get']({'plain':!![]});return db[_0xe62c('0x64')][_0xe62c('0x42')]({'where':{'id':_0x5ddd98[_0xe62c('0x65')]}});}return null;})[_0xe62c('0x21')](handleEntityNotFound(_0x3d6784,null))[_0xe62c('0x21')](function(_0x1421b2){if(_0x1421b2){_0x20ae73[_0xe62c('0x6c')]=_0x1421b2[_0xe62c('0x68')]({'plain':!![]});interaction_log[_0xe62c('0x10')](_0xe62c('0x7f'),_0x573535[_0xe62c('0x6a')]['id'],_0x573535[_0xe62c('0x6a')][_0xe62c('0x28')],_0x573535['user'][_0xe62c('0x6b')],_0x20ae73['interaction']['id'],_0x573535[_0xe62c('0x44')]?JSON[_0xe62c('0x14')](_0x573535['body']):'null');return respondWithRpcPromise(_0xe62c('0x80'),_0xe62c('0x81'),_0x20ae73);}return null;})['then'](function(_0x43c44a){var _0x4ccedb=_0xe62c('0x6f')+_0x43c44a[_0xe62c('0x18')]['ContactId'];return db[_0xe62c('0x71')][_0xe62c('0x29')](_0x4ccedb,{'type':db[_0xe62c('0x72')][_0xe62c('0x73')][_0xe62c('0x74')],'raw':!![]})[_0xe62c('0x21')](function(_0x13e747){return _0x13e747;});})[_0xe62c('0x21')](function(_0x7ed2b9){if(_0x7ed2b9){_0x20ae73['message'][_0xe62c('0x75')]=_0x7ed2b9[0x0];if(!_0x573535['body'][_0xe62c('0x62')])return;return db[_0xe62c('0x76')]['find']({'where':{'id':_0x573535[_0xe62c('0x44')]['UserId'],'role':_0xe62c('0x63')},'attributes':['id',_0xe62c('0x28'),_0xe62c('0x82'),_0xe62c('0x77'),_0xe62c('0x78')],'raw':!![]});}return null;})[_0xe62c('0x21')](function(_0x17ee97){if(!_0x17ee97)return null;_0x20ae73[_0xe62c('0x18')][_0xe62c('0x63')]=_0x17ee97;return _0x20ae73;})['then'](function(_0x33adb4){if(_0x33adb4){_0x33adb4[_0xe62c('0x18')]['interface']=util[_0xe62c('0x5c')]('SIP/%s',_0x573535[_0xe62c('0x6a')]['name']);_0x33adb4['message']['channel']=_0x20ae73['channel'];_0x33adb4[_0xe62c('0x18')][_0xe62c('0x83')]=_0x20ae73[_0xe62c('0x79')];_0x33adb4[_0xe62c('0x18')][_0xe62c('0x7a')]=_0xe62c('0x7e');_0x33adb4[_0xe62c('0x18')][_0xe62c('0x44')]=htmlToText['fromString'](_0x20ae73[_0xe62c('0x18')][_0xe62c('0x44')]);respondWithRpcPromise(_0xe62c('0x7c'),'EventManager',{'event':_0xe62c('0x84'),'message':_0x33adb4[_0xe62c('0x18')]},client9002);return _0x20ae73;}return null;})[_0xe62c('0x21')](respondWithResult(_0x3d6784,null))['catch'](handleError(_0x3d6784,null));};exports[_0xe62c('0x85')]=function(_0x40df5c,_0x22908a){var _0x5923b3=moment()[_0xe62c('0x86')]()[_0xe62c('0x87')]();var _0x2e02ec=path[_0xe62c('0x54')](config[_0xe62c('0x55')],_0xe62c('0x88'),_0xe62c('0x89'),_0xe62c('0x8a'));var _0x32eb05=path[_0xe62c('0x54')](config[_0xe62c('0x55')],'server',_0xe62c('0x89'),_0xe62c('0x53'));var _0x491f82=util[_0xe62c('0x5c')](_0xe62c('0x8b'),_0x5923b3);return db[_0xe62c('0x3b')][_0xe62c('0x42')]({'where':{'id':_0x40df5c[_0xe62c('0x3f')]['id']},'attributes':['id','body',_0xe62c('0x8c'),'to','cc',_0xe62c('0x8d'),_0xe62c('0x8e'),'createdAt'],'include':_0x40df5c[_0xe62c('0x29')][_0xe62c('0x53')]?[{'model':db['Attachment'],'as':_0xe62c('0x8f')}]:undefined})['then'](handleEntityNotFound(_0x22908a,null))[_0xe62c('0x21')](function(_0x479e13){if(_0x479e13){var _0x36058c=_0x479e13;var _0x4ccb7b={'from':_0x36058c[_0xe62c('0x8c')],'to':_0x36058c['to'],'subject':_0x36058c[_0xe62c('0x8e')],'html':htmlEntities['decode'](_0x36058c[_0xe62c('0x44')]),'headers':{'Date':moment(_0x36058c[_0xe62c('0x90')])[_0xe62c('0x5c')](_0xe62c('0x91'))},'attachments':[]};if(_0x479e13['cc']){_0x4ccb7b['headers']['Cc']=_0x479e13['cc'];}if(_0x479e13['bcc']){_0x4ccb7b[_0xe62c('0x92')]['Bcc']=_0x479e13[_0xe62c('0x8d')];}return new BPromise(function(_0x2044ff,_0x45de98){if(_0x479e13[_0xe62c('0x8f')]){for(var _0x28ff=0x0;_0x28ff<_0x479e13[_0xe62c('0x8f')]['length'];_0x28ff++){var _0x2995d1=_0x479e13[_0xe62c('0x8f')][_0x28ff];var _0x2658ec=path[_0xe62c('0x54')](_0x32eb05,_0x2995d1[_0xe62c('0x57')]);if(fs[_0xe62c('0x93')](_0x2658ec)){_0x4ccb7b[_0xe62c('0x53')][_0xe62c('0x94')]({'name':_0x2995d1[_0xe62c('0x28')],'contentType':_0x2995d1['type'],'data':fs['readFileSync'](_0x2658ec)});}}}emlformat[_0xe62c('0x95')](_0x4ccb7b,function(_0x4c2370,_0x225e66){if(_0x4c2370)return _0x45de98(_0x4c2370);fs[_0xe62c('0x96')](path[_0xe62c('0x54')](_0x2e02ec,_0x491f82),_0x225e66);return _0x2044ff(_0x225e66);});});}})[_0xe62c('0x21')](function(_0x37e215){if(_0x37e215){return _0x22908a[_0xe62c('0x85')](path['join'](_0x2e02ec,_0x491f82),_0x491f82,function(_0x4124ae){if(!_0x4124ae)fs['unlinkSync'](path[_0xe62c('0x54')](_0x2e02ec,_0x491f82));});}})[_0xe62c('0x1a')](handleError(_0x22908a,null));}; \ No newline at end of file +var _0xe43e=['attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','include','findAll','rows','show','params','fields','length','includeAll','body','find','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','Contacts','CmContact','defaults','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','mail','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','motionChannel','channel','event','accept','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','internal','fromString','rejectmessage','download','unix','toString','files','tmp','server','message-%s.eml','from','bcc','createdAt','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','build','unlinkSync','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise','http','client','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','sendStatus','stack','name','index','MailMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection'];(function(_0x1b7ff6,_0x3f13fd){var _0x3e2d49=function(_0x1bc0d8){while(--_0x1bc0d8){_0x1b7ff6['push'](_0x1b7ff6['shift']());}};_0x3e2d49(++_0x3f13fd);}(_0xe43e,0x10f));var _0xee43=function(_0x35cff0,_0x2e162c){_0x35cff0=_0x35cff0-0x0;var _0x4a9414=_0xe43e[_0x35cff0];return _0x4a9414;};'use strict';var emlformat=require('eml-format');var moment=require(_0xee43('0x0'));var BPromise=require('bluebird');var util=require(_0xee43('0x1'));var path=require(_0xee43('0x2'));var fs=require('fs');var _=require(_0xee43('0x3'));var Redis=require(_0xee43('0x4'));var htmlToText=require(_0xee43('0x5'));var qs=require(_0xee43('0x6'));var logger=require(_0xee43('0x7'))('api');var interaction_log=require(_0xee43('0x7'))('mail-interactions');var config=require(_0xee43('0x8'));var db=require(_0xee43('0x9'))['db'];config[_0xee43('0xa')]=_['defaults'](config[_0xee43('0xa')],{'host':_0xee43('0xb'),'port':0x18eb});var socket=require(_0xee43('0xc'))(new Redis(config[_0xee43('0xa')]));var htmlEntities=require(_0xee43('0xd'));require(_0xee43('0xe'))['register'](socket);var jayson=require(_0xee43('0xf'));var client=jayson['client'][_0xee43('0x10')]({'port':0x232c});var client9003=jayson[_0xee43('0x11')][_0xee43('0x10')]({'port':0x232b});var client9002=jayson[_0xee43('0x11')][_0xee43('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x1aa07b,_0xeafefa,_0x3e760d,_0x43f927){return new BPromise(function(_0x5b2752,_0x5cb4f9){var _0x4ce119=_0x43f927||client;return _0x4ce119['request'](_0x1aa07b,_0x3e760d)[_0xee43('0x12')](function(_0x33e9bb){logger[_0xee43('0x13')]('MailMessage,\x20%s,\x20%s',_0xeafefa,_0xee43('0x14'));logger[_0xee43('0x15')](_0xee43('0x16'),_0xeafefa,_0xee43('0x14'),JSON[_0xee43('0x17')](_0x33e9bb));if(_0x33e9bb[_0xee43('0x18')]){if(_0x33e9bb[_0xee43('0x18')]['code']===0x1f4){logger[_0xee43('0x18')](_0xee43('0x19'),_0xeafefa,_0x33e9bb['error'][_0xee43('0x1a')]);return _0x5cb4f9(_0x33e9bb[_0xee43('0x18')][_0xee43('0x1a')]);}logger[_0xee43('0x18')]('MailMessage,\x20%s,\x20%s',_0xeafefa,_0x33e9bb['error'][_0xee43('0x1a')]);return _0x5b2752(_0x33e9bb[_0xee43('0x18')][_0xee43('0x1a')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0xeafefa,'request\x20sent');_0x5b2752(_0x33e9bb[_0xee43('0x1b')]['message']);}})[_0xee43('0x1c')](function(_0x389458){logger[_0xee43('0x18')](_0xee43('0x19'),_0xeafefa,_0x389458);_0x5cb4f9(_0x389458);});});}function respondWithResult(_0x4df803,_0x479a1f){_0x479a1f=_0x479a1f||0xc8;return function(_0xfec62){if(_0xfec62){return _0x4df803[_0xee43('0x1d')](_0x479a1f)[_0xee43('0x1e')](_0xfec62);}};}function respondWithFilteredResult(_0xfcdd75,_0x44b045){return function(_0x2bf515){if(_0x2bf515){var _0x5553e6=typeof _0x44b045[_0xee43('0x1f')]===_0xee43('0x20')&&typeof _0x44b045[_0xee43('0x21')]===_0xee43('0x20');var _0x5093d6=_0x2bf515['count'];var _0x3e4b23=_0x5553e6?0x0:_0x44b045['offset'];var _0x139fdb=_0x5553e6?_0x2bf515[_0xee43('0x22')]:_0x44b045[_0xee43('0x1f')]+_0x44b045[_0xee43('0x21')];var _0x503e24;if(_0x139fdb>=_0x5093d6){_0x139fdb=_0x5093d6;_0x503e24=0xc8;}else{_0x503e24=0xce;}_0xfcdd75[_0xee43('0x1d')](_0x503e24);return _0xfcdd75[_0xee43('0x23')](_0xee43('0x24'),_0x3e4b23+'-'+_0x139fdb+'/'+_0x5093d6)['json'](_0x2bf515);}return null;};}function saveUpdates(_0x136302){return function(_0x2e55e1){if(_0x2e55e1){return _0x2e55e1[_0xee43('0x25')](_0x136302)['then'](function(_0x389b47){return _0x389b47;});}return null;};}function removeEntity(_0xf21f1a){return function(_0x201710){if(_0x201710){return _0x201710[_0xee43('0x26')]()[_0xee43('0x12')](function(){_0xf21f1a[_0xee43('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18c2a0){return function(_0x56d670){if(!_0x56d670){_0x18c2a0[_0xee43('0x27')](0x194);}return _0x56d670;};}function handleError(_0xced8b9,_0x2d9daf){_0x2d9daf=_0x2d9daf||0x1f4;return function(_0x3acf45){logger[_0xee43('0x18')](_0x3acf45[_0xee43('0x28')]);if(_0x3acf45[_0xee43('0x29')]){delete _0x3acf45[_0xee43('0x29')];}_0xced8b9[_0xee43('0x1d')](_0x2d9daf)['send'](_0x3acf45);};}exports[_0xee43('0x2a')]=function(_0xfb4a1e,_0x6b00fa){var _0x307cbe={},_0x29da74={},_0x817471={'count':0x0,'rows':[]};var _0x52d7a5=_['map'](db[_0xee43('0x2b')][_0xee43('0x2c')],function(_0x4a8723){return{'name':_0x4a8723['fieldName'],'type':_0x4a8723[_0xee43('0x2d')][_0xee43('0x2e')]};});_0x29da74[_0xee43('0x2f')]=_[_0xee43('0x30')](_0x52d7a5,_0xee43('0x29'));_0x29da74[_0xee43('0x31')]=_[_0xee43('0x32')](_0xfb4a1e['query']);_0x29da74[_0xee43('0x33')]=_[_0xee43('0x34')](_0x29da74[_0xee43('0x2f')],_0x29da74[_0xee43('0x31')]);_0x307cbe['attributes']=_[_0xee43('0x34')](_0x29da74[_0xee43('0x2f')],qs['fields'](_0xfb4a1e[_0xee43('0x31')]['fields']));_0x307cbe['attributes']=_0x307cbe[_0xee43('0x35')]['length']?_0x307cbe['attributes']:_0x29da74[_0xee43('0x2f')];if(!_0xfb4a1e['query'][_0xee43('0x36')](_0xee43('0x37'))){_0x307cbe[_0xee43('0x21')]=qs['limit'](_0xfb4a1e[_0xee43('0x31')][_0xee43('0x21')]);_0x307cbe['offset']=qs['offset'](_0xfb4a1e[_0xee43('0x31')][_0xee43('0x1f')]);}_0x307cbe[_0xee43('0x38')]=qs[_0xee43('0x39')](_0xfb4a1e[_0xee43('0x31')][_0xee43('0x39')]);_0x307cbe[_0xee43('0x3a')]=qs['filters'](_[_0xee43('0x3b')](_0xfb4a1e[_0xee43('0x31')],_0x29da74['filters']),_0x52d7a5);if(_0xfb4a1e[_0xee43('0x31')]['filter']){_0x307cbe[_0xee43('0x3a')]=_['merge'](_0x307cbe[_0xee43('0x3a')],{'$or':_[_0xee43('0x30')](_0x52d7a5,function(_0x3dbd37){if(_0x3dbd37[_0xee43('0x2d')]!==_0xee43('0x3c')){var _0x36574a={};_0x36574a[_0x3dbd37[_0xee43('0x29')]]={'$like':'%'+_0xfb4a1e['query']['filter']+'%'};return _0x36574a;}})});}_0x307cbe=_[_0xee43('0x3d')]({},_0x307cbe,_0xfb4a1e[_0xee43('0x3e')]);var _0x379d46={'where':_0x307cbe[_0xee43('0x3a')]};return db[_0xee43('0x2b')][_0xee43('0x22')](_0x379d46)[_0xee43('0x12')](function(_0x3cd407){_0x817471[_0xee43('0x22')]=_0x3cd407;if(_0xfb4a1e[_0xee43('0x31')]['includeAll']){_0x307cbe[_0xee43('0x3f')]=[{'all':!![]}];}return db[_0xee43('0x2b')][_0xee43('0x40')](_0x307cbe);})['then'](function(_0x1d51ca){_0x817471[_0xee43('0x41')]=_0x1d51ca;return _0x817471;})[_0xee43('0x12')](respondWithFilteredResult(_0x6b00fa,_0x307cbe))[_0xee43('0x1c')](handleError(_0x6b00fa,null));};exports[_0xee43('0x42')]=function(_0x37cae1,_0x5a97ec){var _0x47de1a={'raw':!![],'where':{'id':_0x37cae1[_0xee43('0x43')]['id']}},_0x42c9ef={};_0x42c9ef[_0xee43('0x2f')]=_[_0xee43('0x32')](db[_0xee43('0x2b')]['rawAttributes']);_0x42c9ef[_0xee43('0x31')]=_[_0xee43('0x32')](_0x37cae1[_0xee43('0x31')]);_0x42c9ef[_0xee43('0x33')]=_[_0xee43('0x34')](_0x42c9ef['model'],_0x42c9ef[_0xee43('0x31')]);_0x47de1a[_0xee43('0x35')]=_[_0xee43('0x34')](_0x42c9ef[_0xee43('0x2f')],qs[_0xee43('0x44')](_0x37cae1[_0xee43('0x31')][_0xee43('0x44')]));_0x47de1a[_0xee43('0x35')]=_0x47de1a[_0xee43('0x35')][_0xee43('0x45')]?_0x47de1a['attributes']:_0x42c9ef['model'];if(_0x37cae1['query'][_0xee43('0x46')]){_0x47de1a[_0xee43('0x3f')]=[{'all':!![]}];}_0x47de1a=_[_0xee43('0x3d')]({},_0x47de1a,_0x37cae1[_0xee43('0x3e')]);return db[_0xee43('0x2b')]['find'](_0x47de1a)[_0xee43('0x12')](handleEntityNotFound(_0x5a97ec,null))[_0xee43('0x12')](respondWithResult(_0x5a97ec,null))['catch'](handleError(_0x5a97ec,null));};exports[_0xee43('0x25')]=function(_0x18bea3,_0x566019){if(_0x18bea3[_0xee43('0x47')]['id']){delete _0x18bea3[_0xee43('0x47')]['id'];}return db[_0xee43('0x2b')]['find']({'where':{'id':_0x18bea3[_0xee43('0x43')]['id']}})[_0xee43('0x12')](handleEntityNotFound(_0x566019,null))[_0xee43('0x12')](saveUpdates(_0x18bea3[_0xee43('0x47')],null))[_0xee43('0x12')](respondWithResult(_0x566019,null))[_0xee43('0x1c')](handleError(_0x566019,null));};exports[_0xee43('0x26')]=function(_0x255ee4,_0x55b4f9){return db[_0xee43('0x2b')][_0xee43('0x48')]({'where':{'id':_0x255ee4[_0xee43('0x43')]['id']}})[_0xee43('0x12')](handleEntityNotFound(_0x55b4f9,null))[_0xee43('0x12')](removeEntity(_0x55b4f9,null))[_0xee43('0x1c')](handleError(_0x55b4f9,null));};exports[_0xee43('0x49')]=function(_0x4dbdcd,_0x4cb5cf){return db[_0xee43('0x2b')][_0xee43('0x49')]()[_0xee43('0x12')](respondWithResult(_0x4cb5cf,null))[_0xee43('0x1c')](handleError(_0x4cb5cf,null));};exports[_0xee43('0x4a')]=function(_0x247d05,_0x20b41f){return db['MailMessage'][_0xee43('0x4a')](_0x247d05[_0xee43('0x47')])[_0xee43('0x12')](function(_0x3afae8){if(_0x3afae8){if(_0x3afae8[_0xee43('0x4b')]===_0xee43('0x4c')&&!_0x3afae8[_0xee43('0x4d')]){var _0x4b25c2,_0x4958a7,_0x546700;if(_0x247d05[_0xee43('0x47')]['to']){_0x4958a7=_0x247d05[_0xee43('0x47')]['to'][_0xee43('0x4e')](',')[0x0];}return db[_0xee43('0x4f')][_0xee43('0x50')]({'where':{'id':_0x3afae8[_0xee43('0x51')]},'include':[{'model':db[_0xee43('0x52')],'as':_0xee43('0x53'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x4958a7},'limit':0x1,'order':[[_0xee43('0x54'),_0xee43('0x55')]]}]},{'model':db[_0xee43('0x56')],'as':_0xee43('0x57'),'raw':!![],'include':[{'model':db[_0xee43('0x58')],'as':_0xee43('0x58'),'raw':!![]}]}]})[_0xee43('0x12')](function(_0x2ed932){_0x4b25c2=_0x2ed932;if(!_0x4b25c2||!_0x4b25c2[_0xee43('0x57')])return;var _0x34544a=_0x4b25c2[_0xee43('0x59')]();if(_0x247d05[_0xee43('0x47')][_0xee43('0x5a')]&&_0x247d05['body'][_0xee43('0x5a')]['length']){for(var _0x4d9bad=0x0;_0x4d9bad<_0x247d05['body'][_0xee43('0x5a')]['length'];_0x4d9bad+=0x1){_0x247d05[_0xee43('0x47')]['attachments'][_0x4d9bad]={'filename':_0x247d05[_0xee43('0x47')][_0xee43('0x5a')][_0x4d9bad]['name'],'path':path[_0xee43('0x5b')](config[_0xee43('0x5c')],'server/files/attachments',_0x247d05['body'][_0xee43('0x5a')][_0x4d9bad][_0xee43('0x5d')])};}}_0x546700={'account':_0x34544a,'message':_0x247d05[_0xee43('0x47')]};return;})[_0xee43('0x12')](function(){if(_0x4b25c2[_0xee43('0x53')]){if(_0x4b25c2['List'][_0xee43('0x5e')][_0xee43('0x45')]){return _0x4b25c2[_0xee43('0x53')][_0xee43('0x5e')][0x0];}else{return db[_0xee43('0x5f')][_0xee43('0x4a')](_[_0xee43('0x60')](_0x247d05[_0xee43('0x47')],{'firstName':_0x247d05[_0xee43('0x47')]['to'],'email':_0x247d05[_0xee43('0x47')]['to'],'phone':_0x247d05[_0xee43('0x47')]['to'],'ListId':_0x4b25c2[_0xee43('0x61')]}));}}else{throw new Error(_0xee43('0x62'));}})[_0xee43('0x12')](function(){if(_0x546700){return respondWithRpcPromise(_0xee43('0x63'),_0xee43('0x64'),_0x546700,client9003)['then'](function(_0x2c1654){return _0x3afae8['update']({'read':!![],'messageId':_0x2c1654[_0xee43('0x65')],'sentAt':moment()[_0xee43('0x66')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x541c58){logger['error']('%s',JSON[_0xee43('0x17')](_0x541c58));return _0x3afae8;});}return _0x3afae8;});}return _0x3afae8;}})['then'](respondWithResult(_0x20b41f,0xc9))[_0xee43('0x1c')](handleError(_0x20b41f,null));};exports['accept']=function(_0x444b5e,_0x2f4b81){var _0x25524d={'agent':{},'channel':_0xee43('0x67')};if(_0x444b5e['body']['id']){delete _0x444b5e[_0xee43('0x47')]['id'];}_0x444b5e['body']['read']=!![];_0x444b5e[_0xee43('0x47')][_0xee43('0x68')]=moment()['format'](_0xee43('0x69'));_0x444b5e[_0xee43('0x47')][_0xee43('0x6a')]=_0x444b5e[_0xee43('0x47')]['UserId']||_0x444b5e[_0xee43('0x6b')]['id'];_0x25524d[_0xee43('0x6c')]['id']=_0x444b5e['body'][_0xee43('0x6a')];return db[_0xee43('0x2b')]['find']({'where':{'id':_0x444b5e[_0xee43('0x43')]['id'],'UserId':null}})[_0xee43('0x12')](handleEntityNotFound(_0x2f4b81,null))[_0xee43('0x12')](saveUpdates(_0x444b5e[_0xee43('0x47')],null))[_0xee43('0x12')](function(_0x1f78a8){if(_0x1f78a8){_0x25524d[_0xee43('0x1a')]=_0x1f78a8[_0xee43('0x6d')]({'plain':!![]});return db['MailInteraction'][_0xee43('0x48')]({'where':{'id':_0x1f78a8[_0xee43('0x6e')]}});}return null;})[_0xee43('0x12')](handleEntityNotFound(_0x2f4b81,null))['then'](function(_0x4f1107){if(_0x4f1107){return _0x4f1107[_0xee43('0x25')]({'UserId':_0x444b5e[_0xee43('0x47')]['UserId'],'read1stAt':_['isNil'](_0x4f1107[_0xee43('0x6f')])?moment()['format'](_0xee43('0x69')):undefined});}return null;})[_0xee43('0x12')](function(_0x400d1d){if(_0x400d1d){_0x25524d[_0xee43('0x70')]=_0x400d1d[_0xee43('0x6d')]({'plain':!![]});interaction_log[_0xee43('0x13')](_0xee43('0x71'),_0x444b5e[_0xee43('0x6b')]['id'],_0x444b5e[_0xee43('0x6b')][_0xee43('0x29')],_0x444b5e[_0xee43('0x6b')]['role'],_0x25524d['interaction']['id'],_0x444b5e['body']?JSON['stringify'](_0x444b5e[_0xee43('0x47')]):_0xee43('0x72'));return respondWithRpcPromise(_0xee43('0x73'),_0xee43('0x74'),_0x25524d);}return null;})['then'](function(_0x3b963f){var _0x495e18='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3b963f[_0xee43('0x1a')]['ContactId'];return db['sequelize'][_0xee43('0x31')](_0x495e18,{'type':db[_0xee43('0x75')][_0xee43('0x76')][_0xee43('0x77')],'raw':!![]})['then'](function(_0x5b897e){return _0x5b897e;});})[_0xee43('0x12')](function(_0x51708f){if(_0x51708f){_0x25524d[_0xee43('0x1a')][_0xee43('0x78')]=_0x51708f[0x0];if(!_0x444b5e[_0xee43('0x47')][_0xee43('0x6a')])return;return db[_0xee43('0x79')][_0xee43('0x48')]({'where':{'id':_0x444b5e[_0xee43('0x47')][_0xee43('0x6a')],'role':_0xee43('0x6c')},'attributes':['id','name',_0xee43('0x7a'),_0xee43('0x7b'),'internal'],'raw':!![]});}return null;})[_0xee43('0x12')](function(_0x22ffc6){if(!_0x22ffc6)return null;_0x25524d[_0xee43('0x1a')][_0xee43('0x6c')]=_0x22ffc6;return _0x25524d;})['then'](function(_0x1e5c0a){if(_0x1e5c0a){if(_0x444b5e[_0xee43('0x47')][_0xee43('0x7c')]){_0x25524d[_0xee43('0x1a')][_0xee43('0x7d')]=util['format'](_0xee43('0x7e'),_0x444b5e[_0xee43('0x6b')][_0xee43('0x29')]);_0x25524d[_0xee43('0x1a')]['channel']=_0x25524d['channel'];_0x25524d[_0xee43('0x1a')][_0xee43('0x7f')]=_0x25524d[_0xee43('0x80')];_0x25524d[_0xee43('0x1a')][_0xee43('0x81')]=_0xee43('0x82');_0x25524d[_0xee43('0x1a')][_0xee43('0x47')]=htmlToText['fromString'](_0x25524d['message'][_0xee43('0x47')]);return respondWithRpcPromise('EventManager',_0xee43('0x83'),{'event':_0xee43('0x84'),'message':_0x25524d['message']},client9002)[_0xee43('0x12')](function(){return _0x25524d;});}return _0x25524d;}return null;})['then'](respondWithResult(_0x2f4b81,null))['catch'](handleError(_0x2f4b81,null));};exports[_0xee43('0x85')]=function(_0x2bba38,_0x58500f){var _0x518338={'agent':{},'channel':'mail'};if(_0x2bba38[_0xee43('0x47')]['id']){delete _0x2bba38[_0xee43('0x47')]['id'];}_0x2bba38['body'][_0xee43('0x6a')]=_0x2bba38[_0xee43('0x47')][_0xee43('0x6a')]||_0x2bba38[_0xee43('0x6b')]['id'];_0x518338[_0xee43('0x6c')]['id']=_0x2bba38[_0xee43('0x47')][_0xee43('0x6a')];return db[_0xee43('0x2b')]['find']({'where':{'id':_0x2bba38[_0xee43('0x43')]['id'],'UserId':null}})[_0xee43('0x12')](handleEntityNotFound(_0x58500f,null))[_0xee43('0x12')](function(_0x1d9a9a){if(_0x1d9a9a){_0x518338['message']=_0x1d9a9a[_0xee43('0x6d')]({'plain':!![]});return db['MailInteraction'][_0xee43('0x48')]({'where':{'id':_0x1d9a9a['MailInteractionId']}});}return null;})[_0xee43('0x12')](handleEntityNotFound(_0x58500f,null))[_0xee43('0x12')](function(_0x53f43b){if(_0x53f43b){_0x518338[_0xee43('0x70')]=_0x53f43b[_0xee43('0x6d')]({'plain':!![]});interaction_log[_0xee43('0x13')](_0xee43('0x86'),_0x2bba38[_0xee43('0x6b')]['id'],_0x2bba38[_0xee43('0x6b')][_0xee43('0x29')],_0x2bba38[_0xee43('0x6b')]['role'],_0x518338[_0xee43('0x70')]['id'],_0x2bba38[_0xee43('0x47')]?JSON['stringify'](_0x2bba38[_0xee43('0x47')]):_0xee43('0x72'));return respondWithRpcPromise(_0xee43('0x87'),_0xee43('0x88'),_0x518338);}return null;})[_0xee43('0x12')](function(_0x26427d){var _0x1315aa=_0xee43('0x89')+_0x26427d[_0xee43('0x1a')]['ContactId'];return db[_0xee43('0x8a')][_0xee43('0x31')](_0x1315aa,{'type':db[_0xee43('0x75')][_0xee43('0x76')][_0xee43('0x77')],'raw':!![]})[_0xee43('0x12')](function(_0x5d9c75){return _0x5d9c75;});})['then'](function(_0x42d2f0){if(_0x42d2f0){_0x518338[_0xee43('0x1a')]['contact']=_0x42d2f0[0x0];if(!_0x2bba38['body'][_0xee43('0x6a')])return;return db[_0xee43('0x79')][_0xee43('0x48')]({'where':{'id':_0x2bba38[_0xee43('0x47')][_0xee43('0x6a')],'role':_0xee43('0x6c')},'attributes':['id',_0xee43('0x29'),'fullname','email',_0xee43('0x8b')],'raw':!![]});}return null;})['then'](function(_0x12c122){if(!_0x12c122)return null;_0x518338[_0xee43('0x1a')][_0xee43('0x6c')]=_0x12c122;return _0x518338;})[_0xee43('0x12')](function(_0x48fa69){if(_0x48fa69){_0x48fa69[_0xee43('0x1a')][_0xee43('0x7d')]=util[_0xee43('0x66')](_0xee43('0x7e'),_0x2bba38[_0xee43('0x6b')][_0xee43('0x29')]);_0x48fa69[_0xee43('0x1a')][_0xee43('0x80')]=_0x518338[_0xee43('0x80')];_0x48fa69[_0xee43('0x1a')][_0xee43('0x7f')]=_0x518338[_0xee43('0x80')];_0x48fa69[_0xee43('0x1a')][_0xee43('0x81')]='reject';_0x48fa69['message']['body']=htmlToText[_0xee43('0x8c')](_0x518338[_0xee43('0x1a')]['body']);respondWithRpcPromise(_0xee43('0x83'),'EventManager',{'event':_0xee43('0x8d'),'message':_0x48fa69[_0xee43('0x1a')]},client9002);return _0x518338;}return null;})[_0xee43('0x12')](respondWithResult(_0x58500f,null))['catch'](handleError(_0x58500f,null));};exports[_0xee43('0x8e')]=function(_0x53e4b9,_0x3a1a1a){var _0x69d672=moment()[_0xee43('0x8f')]()[_0xee43('0x90')]();var _0xeb0c26=path[_0xee43('0x5b')](config[_0xee43('0x5c')],'server',_0xee43('0x91'),_0xee43('0x92'));var _0x1935a3=path['join'](config['root'],_0xee43('0x93'),_0xee43('0x91'),_0xee43('0x5a'));var _0x11c757=util[_0xee43('0x66')](_0xee43('0x94'),_0x69d672);return db[_0xee43('0x2b')][_0xee43('0x48')]({'where':{'id':_0x53e4b9[_0xee43('0x43')]['id']},'attributes':['id',_0xee43('0x47'),_0xee43('0x95'),'to','cc',_0xee43('0x96'),'subject',_0xee43('0x97')],'include':_0x53e4b9[_0xee43('0x31')][_0xee43('0x5a')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x3a1a1a,null))[_0xee43('0x12')](function(_0x3a25e){if(_0x3a25e){var _0x4ea13c=_0x3a25e;var _0x1bdf60={'from':_0x4ea13c[_0xee43('0x95')],'to':_0x4ea13c['to'],'subject':_0x4ea13c[_0xee43('0x98')],'html':htmlEntities[_0xee43('0x99')](_0x4ea13c['body']),'headers':{'Date':moment(_0x4ea13c[_0xee43('0x97')])[_0xee43('0x66')](_0xee43('0x9a'))},'attachments':[]};if(_0x3a25e['cc']){_0x1bdf60[_0xee43('0x9b')]['Cc']=_0x3a25e['cc'];}if(_0x3a25e['bcc']){_0x1bdf60[_0xee43('0x9b')][_0xee43('0x9c')]=_0x3a25e[_0xee43('0x96')];}return new BPromise(function(_0x56b0c4,_0x194f5b){if(_0x3a25e[_0xee43('0x9d')]){for(var _0x9b385=0x0;_0x9b385<_0x3a25e['Attachments'][_0xee43('0x45')];_0x9b385++){var _0x1d4269=_0x3a25e[_0xee43('0x9d')][_0x9b385];var _0x3d3848=path[_0xee43('0x5b')](_0x1935a3,_0x1d4269[_0xee43('0x5d')]);if(fs[_0xee43('0x9e')](_0x3d3848)){_0x1bdf60[_0xee43('0x5a')][_0xee43('0x9f')]({'name':_0x1d4269[_0xee43('0x29')],'contentType':_0x1d4269[_0xee43('0x2d')],'data':fs['readFileSync'](_0x3d3848)});}}}emlformat[_0xee43('0xa0')](_0x1bdf60,function(_0x15ee55,_0x464f2d){if(_0x15ee55)return _0x194f5b(_0x15ee55);fs['writeFileSync'](path[_0xee43('0x5b')](_0xeb0c26,_0x11c757),_0x464f2d);return _0x56b0c4(_0x464f2d);});});}})['then'](function(_0x2a9979){if(_0x2a9979){return _0x3a1a1a['download'](path['join'](_0xeb0c26,_0x11c757),_0x11c757,function(_0x94b05a){if(!_0x94b05a)fs[_0xee43('0xa1')](path['join'](_0xeb0c26,_0x11c757));});}})['catch'](handleError(_0x3a1a1a,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index e3acd67..223af77 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 _0x0cef=['update','remove','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x4be3ec,_0x218441){var _0x44b79f=function(_0x56d3c1){while(--_0x56d3c1){_0x4be3ec['push'](_0x4be3ec['shift']());}};_0x44b79f(++_0x218441);}(_0x0cef,0x164));var _0xf0ce=function(_0x3d9312,_0x3363fc){_0x3d9312=_0x3d9312-0x0;var _0x3a0a42=_0x0cef[_0x3d9312];return _0x3a0a42;};'use strict';var EventEmitter=require(_0xf0ce('0x0'));var MailMessage=require(_0xf0ce('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf0ce('0x2')](0x0);var events={'afterCreate':_0xf0ce('0x3'),'afterUpdate':_0xf0ce('0x4'),'afterDestroy':_0xf0ce('0x5')};function emitEvent(_0x1df728){return function(_0x28642d,_0x4c850f,_0x341705){MailMessageEvents['emit'](_0x1df728+':'+_0x28642d['id'],_0x28642d);MailMessageEvents['emit'](_0x1df728,_0x28642d);_0x341705(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xf0ce('0x6')](e,emitEvent(event));}}module[_0xf0ce('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xddec=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x4202bc,_0x2ed6cf){var _0x319148=function(_0x537d36){while(--_0x537d36){_0x4202bc['push'](_0x4202bc['shift']());}};_0x319148(++_0x2ed6cf);}(_0xddec,0xef));var _0xcdde=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xddec[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require(_0xcdde('0x0'));var MailMessage=require(_0xcdde('0x1'))['db'][_0xcdde('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xcdde('0x3')](0x0);var events={'afterCreate':_0xcdde('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xad0017){return function(_0x5420cf,_0x3d43c5,_0x4286da){MailMessageEvents[_0xcdde('0x5')](_0xad0017+':'+_0x5420cf['id'],_0x5420cf);MailMessageEvents[_0xcdde('0x5')](_0xad0017,_0x5420cf);_0x4286da(null);};}for(var e in events){if(events[_0xcdde('0x6')](e)){var event=events[e];MailMessage[_0xcdde('0x7')](e,emitEvent(event));}}module[_0xcdde('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 02b39f1..1faab91 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 _0x95f3=['rimraf','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','plainBody','body','fromString','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','catch','error','lodash','util','../../config/logger','moment','bluebird','request-promise','html-to-text','path'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0x95f3,0x18b));var _0x395f=function(_0x4b09f4,_0x2ba844){_0x4b09f4=_0x4b09f4-0x0;var _0x5ea197=_0x95f3[_0x4b09f4];return _0x5ea197;};'use strict';var _=require(_0x395f('0x0'));var util=require(_0x395f('0x1'));var logger=require(_0x395f('0x2'))('api');var moment=require(_0x395f('0x3'));var BPromise=require(_0x395f('0x4'));var rp=require(_0x395f('0x5'));var htmlToText=require(_0x395f('0x6'));var fs=require('fs');var path=require(_0x395f('0x7'));var rimraf=require(_0x395f('0x8'));var config=require('../../config/environment');var attributes=require(_0x395f('0x9'));module['exports']=function(_0x32539d,_0x16477c){return _0x32539d[_0x395f('0xa')](_0x395f('0xb'),attributes,{'tableName':_0x395f('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x395f('0xd')]},{'name':'fti_mail_messages','fields':[_0x395f('0xe'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4d2fbb,_0xc7fabb,_0x4dff19){if(_0x4d2fbb[_0x395f('0xf')]){_0x4d2fbb[_0x395f('0xe')]=htmlToText[_0x395f('0x10')](_0x4d2fbb[_0x395f('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4dff19(null,_0xc7fabb);},'afterCreate':function(_0x5ba759,_0xa804ca,_0x506698){var _0x5b7607=_0x32539d['models'];var _0x5a3317=_0x5ba759[_0x395f('0x11')]({'plain':!![]});if(_0x5a3317[_0x395f('0x12')][_0x395f('0x13')]()==='in'||_0x5a3317['direction'][_0x395f('0x13')]()===_0x395f('0x14')&&!_0x5a3317[_0x395f('0x15')]&&!_[_0x395f('0x16')](_0x5a3317[_0x395f('0x17')])){_0x5b7607[_0x395f('0x18')][_0x395f('0x19')]({'where':{'id':_0x5a3317[_0x395f('0x1a')]}})[_0x395f('0x1b')](function(_0x556a2e){if(_0x556a2e){_0x556a2e[_0x395f('0x1c')]({'lastMsgAt':_0x5a3317['createdAt'],'lastMsgDirection':_0x5a3317[_0x395f('0x12')][_0x395f('0x13')]()});}})[_0x395f('0x1d')](function(_0x56f4e9){console[_0x395f('0x1e')](_0x56f4e9);});}_0x506698();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x17a1=['toLowerCase','isNil','UserId','MailInteraction','findOne','MailInteractionId','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','html-to-text','path','../../config/environment','./mailMessage.attributes','define','mail_messages','messageId','plainBody','subject','body','fromString','get','direction'];(function(_0x4d2ed7,_0x1999e5){var _0x12af27=function(_0x28e2d4){while(--_0x28e2d4){_0x4d2ed7['push'](_0x4d2ed7['shift']());}};_0x12af27(++_0x1999e5);}(_0x17a1,0xb9));var _0x117a=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x17a1[_0x288f5e];return _0x476cc9;};'use strict';var _=require('lodash');var util=require(_0x117a('0x0'));var logger=require(_0x117a('0x1'))(_0x117a('0x2'));var moment=require(_0x117a('0x3'));var BPromise=require(_0x117a('0x4'));var rp=require('request-promise');var htmlToText=require(_0x117a('0x5'));var fs=require('fs');var path=require(_0x117a('0x6'));var rimraf=require('rimraf');var config=require(_0x117a('0x7'));var attributes=require(_0x117a('0x8'));module['exports']=function(_0x1c680f,_0x5271dc){return _0x1c680f[_0x117a('0x9')]('MailMessage',attributes,{'tableName':_0x117a('0xa'),'paranoid':![],'indexes':[{'name':_0x117a('0xb'),'fields':[_0x117a('0xb')]},{'name':'fti_mail_messages','fields':[_0x117a('0xc'),_0x117a('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xf1dd93,_0x52f5cb,_0x246ca2){if(_0xf1dd93[_0x117a('0xe')]){_0xf1dd93[_0x117a('0xc')]=htmlToText[_0x117a('0xf')](_0xf1dd93[_0x117a('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x246ca2(null,_0x52f5cb);},'afterCreate':function(_0x88ecc5,_0x4ee723,_0x563f73){var _0x17c405=_0x1c680f['models'];var _0x2ca038=_0x88ecc5[_0x117a('0x10')]({'plain':!![]});if(_0x2ca038['direction']['toLowerCase']()==='in'||_0x2ca038[_0x117a('0x11')][_0x117a('0x12')]()==='out'&&!_0x2ca038['secret']&&!_[_0x117a('0x13')](_0x2ca038[_0x117a('0x14')])){_0x17c405[_0x117a('0x15')][_0x117a('0x16')]({'where':{'id':_0x2ca038[_0x117a('0x17')]}})['then'](function(_0x20951b){if(_0x20951b){_0x20951b[_0x117a('0x18')]({'lastMsgAt':_0x2ca038[_0x117a('0x19')],'lastMsgDirection':_0x2ca038[_0x117a('0x11')][_0x117a('0x12')]()});}})['catch'](function(_0x522647){console[_0x117a('0x1a')](_0x522647);});}_0x563f73();}},'charset':_0x117a('0x1b'),'collate':_0x117a('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index cef0d20..0501c07 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 _0x7880=['redis','defaults','localhost','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MailMessage','create','body','options','CreateMailMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x74556d,_0x44220b){var _0x156f1b=function(_0x4b16d6){while(--_0x4b16d6){_0x74556d['push'](_0x74556d['shift']());}};_0x156f1b(++_0x44220b);}(_0x7880,0x1f4));var _0x0788=function(_0x3f06c7,_0xd58ada){_0x3f06c7=_0x3f06c7-0x0;var _0x4aa19f=_0x7880[_0x3f06c7];return _0x4aa19f;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});config[_0x0788('0xc')]=_[_0x0788('0xd')](config[_0x0788('0xc')],{'host':_0x0788('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0788('0xc')]));require('./mailMessage.socket')[_0x0788('0xf')](socket);function respondWithRpcPromise(_0x53b2f2,_0x433c26,_0x3c6d18){return new BPromise(function(_0x1f9ff6,_0xee8670){return client[_0x0788('0x10')](_0x53b2f2,_0x3c6d18)['then'](function(_0x1920b3){logger[_0x0788('0x11')](_0x0788('0x12'),_0x433c26,_0x0788('0x13'));logger[_0x0788('0x14')](_0x0788('0x15'),_0x433c26,_0x0788('0x13'),JSON['stringify'](_0x1920b3));if(_0x1920b3[_0x0788('0x16')]){if(_0x1920b3[_0x0788('0x16')][_0x0788('0x17')]===0x1f4){logger[_0x0788('0x16')]('MailMessage,\x20%s,\x20%s',_0x433c26,_0x1920b3[_0x0788('0x16')]['message']);return _0xee8670(_0x1920b3[_0x0788('0x16')][_0x0788('0x18')]);}logger[_0x0788('0x16')](_0x0788('0x12'),_0x433c26,_0x1920b3[_0x0788('0x16')][_0x0788('0x18')]);return _0x1f9ff6(_0x1920b3['error']['message']);}else{logger[_0x0788('0x11')](_0x0788('0x12'),_0x433c26,'request\x20sent');_0x1f9ff6(_0x1920b3[_0x0788('0x19')][_0x0788('0x18')]);}})[_0x0788('0x1a')](function(_0x52c339){logger[_0x0788('0x16')](_0x0788('0x12'),_0x433c26,_0x52c339);_0xee8670(_0x52c339);});});}exports['CreateMailMessage']=function(_0x11ea01){var _0x5173d6=this;return new Promise(function(_0x7d0869,_0x48bc5f){return db[_0x0788('0x1b')][_0x0788('0x1c')](_0x11ea01[_0x0788('0x1d')],{'raw':_0x11ea01[_0x0788('0x1e')]?_0x11ea01[_0x0788('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2270d4){logger[_0x0788('0x11')](_0x0788('0x1f'),_0x11ea01);logger[_0x0788('0x14')]('CreateMailMessage',_0x11ea01,JSON['stringify'](_0x2270d4));_0x7d0869(_0x2270d4);})[_0x0788('0x1a')](function(_0x18cc33){logger[_0x0788('0x16')]('CreateMailMessage',_0x18cc33['message'],_0x11ea01);_0x48bc5f(_0x5173d6[_0x0788('0x16')](0x1f4,_0x18cc33[_0x0788('0x18')]));});});}; \ No newline at end of file +var _0x1a85=['info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','then'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x1a85,0x178));var _0x51a8=function(_0x521b61,_0x47e2b4){_0x521b61=_0x521b61-0x0;var _0x476cdf=_0x1a85[_0x521b61];return _0x476cdf;};'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});config['redis']=_[_0x51a8('0x8')](config[_0x51a8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x51a8('0xa'))(new Redis(config['redis']));require('./mailMessage.socket')[_0x51a8('0xb')](socket);function respondWithRpcPromise(_0x2f276b,_0x1a476d,_0x45a3f4){return new BPromise(function(_0x418f06,_0x421fa4){return client[_0x51a8('0xc')](_0x2f276b,_0x45a3f4)[_0x51a8('0xd')](function(_0x34c887){logger[_0x51a8('0xe')](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));logger[_0x51a8('0x11')](_0x51a8('0x12'),_0x1a476d,_0x51a8('0x10'),JSON[_0x51a8('0x13')](_0x34c887));if(_0x34c887[_0x51a8('0x14')]){if(_0x34c887['error'][_0x51a8('0x15')]===0x1f4){logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887['error'][_0x51a8('0x16')]);return _0x421fa4(_0x34c887['error'][_0x51a8('0x16')]);}logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);return _0x418f06(_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);}else{logger['info'](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));_0x418f06(_0x34c887[_0x51a8('0x17')][_0x51a8('0x16')]);}})[_0x51a8('0x18')](function(_0x544886){logger['error'](_0x51a8('0xf'),_0x1a476d,_0x544886);_0x421fa4(_0x544886);});});}exports[_0x51a8('0x19')]=function(_0x2217ce){var _0x2f2681=this;return new Promise(function(_0x2a4c4c,_0x3bc044){return db[_0x51a8('0x1a')][_0x51a8('0x1b')](_0x2217ce['body'],{'raw':_0x2217ce[_0x51a8('0x1c')]?_0x2217ce['options'][_0x51a8('0x1d')]===undefined?!![]:![]:!![]})[_0x51a8('0xd')](function(_0x8bda40){logger[_0x51a8('0xe')]('CreateMailMessage',_0x2217ce);logger[_0x51a8('0x11')]('CreateMailMessage',_0x2217ce,JSON['stringify'](_0x8bda40));_0x2a4c4c(_0x8bda40);})[_0x51a8('0x18')](function(_0x52e503){logger[_0x51a8('0x14')](_0x51a8('0x19'),_0x52e503[_0x51a8('0x16')],_0x2217ce);_0x3bc044(_0x2f2681[_0x51a8('0x14')](0x1f4,_0x52e503[_0x51a8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 5a29468..4233da0 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 _0x190b=['./mailMessage.events','save','remove','emit','removeListener','register','mailMessage:'];(function(_0x364425,_0x6ab8ff){var _0x206a96=function(_0x866b80){while(--_0x866b80){_0x364425['push'](_0x364425['shift']());}};_0x206a96(++_0x6ab8ff);}(_0x190b,0x1ab));var _0xb190=function(_0x45ae0e,_0x56936f){_0x45ae0e=_0x45ae0e-0x0;var _0x51f204=_0x190b[_0x45ae0e];return _0x51f204;};'use strict';var MailMessageEvents=require(_0xb190('0x0'));var events=[_0xb190('0x1'),_0xb190('0x2'),'update'];function createListener(_0x1f356f,_0x39f291){return function(_0x386bac){_0x39f291[_0xb190('0x3')](_0x1f356f,_0x386bac);};}function removeListener(_0x5bdfef,_0x2516db){return function(){MailMessageEvents[_0xb190('0x4')](_0x5bdfef,_0x2516db);};}exports[_0xb190('0x5')]=function(_0x2afdbb){for(var _0x17fffa=0x0,_0x25624a=events['length'];_0x17fffa<_0x25624a;_0x17fffa++){var _0x5a2c63=events[_0x17fffa];var _0x244745=createListener(_0xb190('0x6')+_0x5a2c63,_0x2afdbb);MailMessageEvents['on'](_0x5a2c63,_0x244745);}}; \ No newline at end of file +var _0xc326=['./mailMessage.events','save','remove','emit','removeListener','register','length','mailMessage:'];(function(_0x5ce0e5,_0x26c7ca){var _0x33e556=function(_0xcbcf50){while(--_0xcbcf50){_0x5ce0e5['push'](_0x5ce0e5['shift']());}};_0x33e556(++_0x26c7ca);}(_0xc326,0x138));var _0x6c32=function(_0x572b10,_0x38b63d){_0x572b10=_0x572b10-0x0;var _0x34924b=_0xc326[_0x572b10];return _0x34924b;};'use strict';var MailMessageEvents=require(_0x6c32('0x0'));var events=[_0x6c32('0x1'),_0x6c32('0x2'),'update'];function createListener(_0x1d375e,_0x2efdb8){return function(_0x152e58){_0x2efdb8[_0x6c32('0x3')](_0x1d375e,_0x152e58);};}function removeListener(_0x5f1d2a,_0x159c72){return function(){MailMessageEvents[_0x6c32('0x4')](_0x5f1d2a,_0x159c72);};}exports[_0x6c32('0x5')]=function(_0x4caf77){for(var _0x59a784=0x0,_0x1c19f2=events[_0x6c32('0x6')];_0x59a784<_0x1c19f2;_0x59a784++){var _0x40d008=events[_0x59a784];var _0x396d11=createListener(_0x6c32('0x7')+_0x40d008,_0x4caf77);MailMessageEvents['on'](_0x40d008,_0x396d11);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index f5d93cc..f9f023f 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 _0x5ae5=['fs-extra','../../components/auth/service','./mailQueue.controller','isAuthenticated','index','describe','get','/:id','show','/:id/members','getTeams','/:id/users','post','create','addTeams','put','update','delete','/:id/teams','removeTeams','removeAgents','util','path','connect-timeout','Router'];(function(_0x2e488e,_0x50b586){var _0x2b0900=function(_0x2b7990){while(--_0x2b7990){_0x2e488e['push'](_0x2e488e['shift']());}};_0x2b0900(++_0x50b586);}(_0x5ae5,0xc4));var _0x55ae=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0x5ae5[_0x1fb1c1];return _0x1622df;};'use strict';var multer=require('multer');var util=require(_0x55ae('0x0'));var path=require(_0x55ae('0x1'));var timeout=require(_0x55ae('0x2'));var express=require('express');var router=express[_0x55ae('0x3')]();var fs_extra=require(_0x55ae('0x4'));var auth=require(_0x55ae('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x55ae('0x6'));router['get']('/',auth[_0x55ae('0x7')](),controller[_0x55ae('0x8')]);router['get']('/describe',auth[_0x55ae('0x7')](),controller[_0x55ae('0x9')]);router[_0x55ae('0xa')](_0x55ae('0xb'),auth[_0x55ae('0x7')](),controller[_0x55ae('0xc')]);router[_0x55ae('0xa')](_0x55ae('0xd'),auth[_0x55ae('0x7')](),controller['getMembers']);router[_0x55ae('0xa')]('/:id/teams',auth[_0x55ae('0x7')](),controller[_0x55ae('0xe')]);router['get'](_0x55ae('0xf'),auth[_0x55ae('0x7')](),controller['getAgents']);router[_0x55ae('0x10')]('/',auth[_0x55ae('0x7')](),controller[_0x55ae('0x11')]);router[_0x55ae('0x10')]('/:id/teams',auth[_0x55ae('0x7')](),controller[_0x55ae('0x12')]);router[_0x55ae('0x10')](_0x55ae('0xf'),auth['isAuthenticated'](),controller['addAgents']);router[_0x55ae('0x13')](_0x55ae('0xb'),auth[_0x55ae('0x7')](),controller[_0x55ae('0x14')]);router[_0x55ae('0x15')](_0x55ae('0xb'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x55ae('0x16'),auth['isAuthenticated'](),controller[_0x55ae('0x17')]);router[_0x55ae('0x15')](_0x55ae('0xf'),auth['isAuthenticated'](),controller[_0x55ae('0x18')]);module['exports']=router; \ No newline at end of file +var _0x264b=['describe','/:id','isAuthenticated','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index'];(function(_0x3df0ef,_0x3876f5){var _0x309f73=function(_0x1e1448){while(--_0x1e1448){_0x3df0ef['push'](_0x3df0ef['shift']());}};_0x309f73(++_0x3876f5);}(_0x264b,0x117));var _0xb264=function(_0x2d2574,_0x4c0684){_0x2d2574=_0x2d2574-0x0;var _0x45c0da=_0x264b[_0x2d2574];return _0x45c0da;};'use strict';var multer=require(_0xb264('0x0'));var util=require(_0xb264('0x1'));var path=require(_0xb264('0x2'));var timeout=require(_0xb264('0x3'));var express=require('express');var router=express[_0xb264('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb264('0x5'));var interaction=require(_0xb264('0x6'));var config=require(_0xb264('0x7'));var controller=require(_0xb264('0x8'));router[_0xb264('0x9')]('/',auth['isAuthenticated'](),controller[_0xb264('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb264('0xb')]);router[_0xb264('0x9')](_0xb264('0xc'),auth[_0xb264('0xd')](),controller['show']);router['get'](_0xb264('0xe'),auth[_0xb264('0xd')](),controller[_0xb264('0xf')]);router['get'](_0xb264('0x10'),auth[_0xb264('0xd')](),controller[_0xb264('0x11')]);router[_0xb264('0x9')]('/:id/users',auth[_0xb264('0xd')](),controller[_0xb264('0x12')]);router[_0xb264('0x13')]('/',auth['isAuthenticated'](),controller[_0xb264('0x14')]);router['post'](_0xb264('0x10'),auth[_0xb264('0xd')](),controller[_0xb264('0x15')]);router['post'](_0xb264('0x16'),auth[_0xb264('0xd')](),controller['addAgents']);router['put'](_0xb264('0xc'),auth[_0xb264('0xd')](),controller[_0xb264('0x17')]);router[_0xb264('0x18')](_0xb264('0xc'),auth['isAuthenticated'](),controller[_0xb264('0x19')]);router['delete'](_0xb264('0x10'),auth[_0xb264('0xd')](),controller[_0xb264('0x1a')]);router[_0xb264('0x18')](_0xb264('0x16'),auth[_0xb264('0xd')](),controller[_0xb264('0x1b')]);module[_0xb264('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 10484f6..026b4cd 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 _0x9620=['beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x2fd18f,_0x51d00c){var _0x74e7f3=function(_0x471629){while(--_0x471629){_0x2fd18f['push'](_0x2fd18f['shift']());}};_0x74e7f3(++_0x51d00c);}(_0x9620,0xe2));var _0x0962=function(_0x4b77a6,_0x186b16){_0x4b77a6=_0x4b77a6-0x0;var _0x4957c8=_0x9620[_0x4b77a6];return _0x4957c8;};'use strict';var Sequelize=require(_0x0962('0x0'));module[_0x0962('0x1')]={'name':{'type':Sequelize[_0x0962('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0962('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0962('0x4')]('rrmemory',_0x0962('0x5'),_0x0962('0x6'))}}; \ No newline at end of file +var _0x0866=['STRING','name','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x0866,0x186));var _0x6086=function(_0x1713e4,_0x4222de){_0x1713e4=_0x1713e4-0x0;var _0x1d20ca=_0x0866[_0x1713e4];return _0x1d20ca;};'use strict';var Sequelize=require(_0x6086('0x0'));module[_0x6086('0x1')]={'name':{'type':Sequelize[_0x6086('0x2')],'unique':_0x6086('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6086('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6086('0x4')]('rrmemory',_0x6086('0x5'),_0x6086('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 6ed7db2..88aa16d 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 _0x36ad=['userMailQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','then','get','MailQueues','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','getMembers','findOne','UserMailQueue','length','findAll','User','findAndCountAll','UserId','agent','mailPause','createdAt','rows','format','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','toString','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','emit'];(function(_0xa65bc3,_0x2bd50c){var _0x1ab82c=function(_0x4dc6a4){while(--_0x4dc6a4){_0xa65bc3['push'](_0xa65bc3['shift']());}};_0x1ab82c(++_0x2bd50c);}(_0x36ad,0x95));var _0xd36a=function(_0x2c750f,_0x4b8844){_0x2c750f=_0x2c750f-0x0;var _0x25df80=_0x36ad[_0x2c750f];return _0x25df80;};'use strict';var emlformat=require(_0xd36a('0x0'));var rimraf=require(_0xd36a('0x1'));var zipdir=require(_0xd36a('0x2'));var jsonpatch=require(_0xd36a('0x3'));var rp=require(_0xd36a('0x4'));var moment=require(_0xd36a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd36a('0x6'));var util=require('util');var path=require(_0xd36a('0x7'));var sox=require(_0xd36a('0x8'));var csv=require(_0xd36a('0x9'));var ejs=require(_0xd36a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd36a('0xb'));var squel=require(_0xd36a('0xc'));var crypto=require(_0xd36a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd36a('0xe'));var toCsv=require(_0xd36a('0x9'));var querystring=require(_0xd36a('0xf'));var Papa=require(_0xd36a('0x10'));var Redis=require(_0xd36a('0x11'));var authService=require(_0xd36a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd36a('0x13'));var hardwareService=require(_0xd36a('0x14'));var logger=require(_0xd36a('0x15'))(_0xd36a('0x16'));var utils=require('../../config/utils');var config=require(_0xd36a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd36a('0x18'))['db'];config[_0xd36a('0x19')]=_[_0xd36a('0x1a')](config['redis'],{'host':_0xd36a('0x1b'),'port':0x18eb});var socket=require(_0xd36a('0x1c'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xd36a('0x1d')](socket);function respondWithStatusCode(_0x435613,_0x5afdef){_0x5afdef=_0x5afdef||0xcc;return function(_0x5289fa){if(_0x5289fa){return _0x435613[_0xd36a('0x1e')](_0x5afdef);}return _0x435613[_0xd36a('0x1f')](_0x5afdef)[_0xd36a('0x20')]();};}function respondWithResult(_0x24393c,_0x5e17b3){_0x5e17b3=_0x5e17b3||0xc8;return function(_0x3b22cf){if(_0x3b22cf){return _0x24393c[_0xd36a('0x1f')](_0x5e17b3)['json'](_0x3b22cf);}};}function respondWithFilteredResult(_0x542c8d,_0x211681){return function(_0x307b43){if(_0x307b43){var _0x151a7c=typeof _0x211681[_0xd36a('0x21')]===_0xd36a('0x22')&&typeof _0x211681[_0xd36a('0x23')]===_0xd36a('0x22');var _0x4f6f10=_0x307b43[_0xd36a('0x24')];var _0x1f99ee=_0x151a7c?0x0:_0x211681['offset'];var _0x364a16=_0x151a7c?_0x307b43['count']:_0x211681[_0xd36a('0x21')]+_0x211681[_0xd36a('0x23')];var _0x4ad884;if(_0x364a16>=_0x4f6f10){_0x364a16=_0x4f6f10;_0x4ad884=0xc8;}else{_0x4ad884=0xce;}_0x542c8d[_0xd36a('0x1f')](_0x4ad884);return _0x542c8d['set'](_0xd36a('0x25'),_0x1f99ee+'-'+_0x364a16+'/'+_0x4f6f10)[_0xd36a('0x26')](_0x307b43);}return null;};}function patchUpdates(_0x23a033){return function(_0x499185){try{jsonpatch[_0xd36a('0x27')](_0x499185,_0x23a033,!![]);}catch(_0x4e7765){return BPromise['reject'](_0x4e7765);}return _0x499185[_0xd36a('0x28')]();};}function saveUpdates(_0x343676,_0x124417){return function(_0x3df847){if(_0x3df847){return _0x3df847['update'](_0x343676)['then'](function(_0x2b7e48){return _0x2b7e48;});}return null;};}function removeEntity(_0x2b6c62,_0x4cef94){return function(_0x2e1308){if(_0x2e1308){return _0x2e1308['destroy']()[_0xd36a('0x29')](function(){var _0x439ff9=_0x2e1308[_0xd36a('0x2a')]({'plain':!![]});var _0x146f38=_0xd36a('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x146f38,'resourceId':_0x439ff9['id']}})[_0xd36a('0x29')](function(){return _0x2e1308;});})['then'](function(){_0x2b6c62[_0xd36a('0x1f')](0xcc)[_0xd36a('0x20')]();});}};}function handleEntityNotFound(_0x1dc080,_0x3c27bc){return function(_0x40f54c){if(!_0x40f54c){_0x1dc080[_0xd36a('0x1e')](0x194);}return _0x40f54c;};}function handleError(_0x3693e1,_0x5587e8){_0x5587e8=_0x5587e8||0x1f4;return function(_0xe6e6db){logger[_0xd36a('0x2c')](_0xe6e6db[_0xd36a('0x2d')]);if(_0xe6e6db[_0xd36a('0x2e')]){delete _0xe6e6db['name'];}_0x3693e1[_0xd36a('0x1f')](_0x5587e8)[_0xd36a('0x2f')](_0xe6e6db);};}exports[_0xd36a('0x30')]=function(_0x167577,_0xb5b266){var _0x2cee20={},_0x5301d8={},_0x254238={'count':0x0,'rows':[]};var _0x4c7f97=_[_0xd36a('0x31')](db[_0xd36a('0x32')][_0xd36a('0x33')],function(_0x5bff8b){return{'name':_0x5bff8b[_0xd36a('0x34')],'type':_0x5bff8b['type'][_0xd36a('0x35')]};});_0x5301d8[_0xd36a('0x36')]=_[_0xd36a('0x31')](_0x4c7f97,_0xd36a('0x2e'));_0x5301d8['query']=_[_0xd36a('0x37')](_0x167577[_0xd36a('0x38')]);_0x5301d8['filters']=_[_0xd36a('0x39')](_0x5301d8['model'],_0x5301d8[_0xd36a('0x38')]);_0x2cee20[_0xd36a('0x3a')]=_[_0xd36a('0x39')](_0x5301d8[_0xd36a('0x36')],qs[_0xd36a('0x3b')](_0x167577[_0xd36a('0x38')][_0xd36a('0x3b')]));_0x2cee20[_0xd36a('0x3a')]=_0x2cee20[_0xd36a('0x3a')]['length']?_0x2cee20['attributes']:_0x5301d8['model'];if(!_0x167577[_0xd36a('0x38')][_0xd36a('0x3c')](_0xd36a('0x3d'))){_0x2cee20[_0xd36a('0x23')]=qs[_0xd36a('0x23')](_0x167577[_0xd36a('0x38')][_0xd36a('0x23')]);_0x2cee20['offset']=qs[_0xd36a('0x21')](_0x167577['query']['offset']);}_0x2cee20[_0xd36a('0x3e')]=qs[_0xd36a('0x3f')](_0x167577['query'][_0xd36a('0x3f')]);_0x2cee20[_0xd36a('0x40')]=qs[_0xd36a('0x41')](_[_0xd36a('0x42')](_0x167577[_0xd36a('0x38')],_0x5301d8[_0xd36a('0x41')]),_0x4c7f97);if(_0x167577[_0xd36a('0x38')][_0xd36a('0x43')]){_0x2cee20['where']=_[_0xd36a('0x44')](_0x2cee20[_0xd36a('0x40')],{'$or':_['map'](_0x4c7f97,function(_0x14dfc9){if(_0x14dfc9[_0xd36a('0x45')]!==_0xd36a('0x46')){var _0x10bf8c={};_0x10bf8c[_0x14dfc9[_0xd36a('0x2e')]]={'$like':'%'+_0x167577['query'][_0xd36a('0x43')]+'%'};return _0x10bf8c;}})});}_0x2cee20=_[_0xd36a('0x44')]({},_0x2cee20,_0x167577[_0xd36a('0x47')]);var _0x53de66={'where':_0x2cee20[_0xd36a('0x40')]};return db[_0xd36a('0x32')][_0xd36a('0x24')](_0x53de66)[_0xd36a('0x29')](function(_0x4c8731){_0x254238[_0xd36a('0x24')]=_0x4c8731;if(_0x167577['query'][_0xd36a('0x48')]){_0x2cee20[_0xd36a('0x49')]=[{'all':!![]}];}return db[_0xd36a('0x32')]['findAll'](_0x2cee20);})[_0xd36a('0x29')](function(_0x56584d){_0x254238['rows']=_0x56584d;return _0x254238;})['then'](respondWithFilteredResult(_0xb5b266,_0x2cee20))['catch'](handleError(_0xb5b266,null));};exports[_0xd36a('0x4a')]=function(_0x545b46,_0x5dd253){var _0x5f1812={'raw':!![],'where':{'id':_0x545b46[_0xd36a('0x4b')]['id']}},_0x47b785={};_0x47b785[_0xd36a('0x36')]=_['keys'](db[_0xd36a('0x32')][_0xd36a('0x33')]);_0x47b785['query']=_[_0xd36a('0x37')](_0x545b46[_0xd36a('0x38')]);_0x47b785['filters']=_[_0xd36a('0x39')](_0x47b785[_0xd36a('0x36')],_0x47b785[_0xd36a('0x38')]);_0x5f1812[_0xd36a('0x3a')]=_[_0xd36a('0x39')](_0x47b785[_0xd36a('0x36')],qs[_0xd36a('0x3b')](_0x545b46[_0xd36a('0x38')][_0xd36a('0x3b')]));_0x5f1812[_0xd36a('0x3a')]=_0x5f1812['attributes']['length']?_0x5f1812[_0xd36a('0x3a')]:_0x47b785[_0xd36a('0x36')];if(_0x545b46[_0xd36a('0x38')][_0xd36a('0x48')]){_0x5f1812[_0xd36a('0x49')]=[{'all':!![]}];}_0x5f1812=_[_0xd36a('0x44')]({},_0x5f1812,_0x545b46['options']);return db[_0xd36a('0x32')]['find'](_0x5f1812)['then'](handleEntityNotFound(_0x5dd253,null))[_0xd36a('0x29')](respondWithResult(_0x5dd253,null))[_0xd36a('0x4c')](handleError(_0x5dd253,null));};exports[_0xd36a('0x4d')]=function(_0x594d7e,_0xeefeb){return db[_0xd36a('0x32')][_0xd36a('0x4d')](_0x594d7e[_0xd36a('0x4e')],{})[_0xd36a('0x29')](function(_0x7c9260){var _0x5cd054=_0x594d7e[_0xd36a('0x4f')][_0xd36a('0x2a')]({'plain':!![]});if(!_0x5cd054)throw new Error(_0xd36a('0x50'));if(_0x5cd054[_0xd36a('0x51')]===_0xd36a('0x4f')){var _0x5d2ed1=_0x7c9260['get']({'plain':!![]});var _0x416550=_0xd36a('0x2b');return db[_0xd36a('0x52')][_0xd36a('0x53')]({'where':{'name':_0x416550,'userProfileId':_0x5cd054[_0xd36a('0x54')]},'raw':!![]})[_0xd36a('0x29')](function(_0x196d4a){if(_0x196d4a&&_0x196d4a[_0xd36a('0x55')]===0x0){return db[_0xd36a('0x56')][_0xd36a('0x4d')]({'name':_0x5d2ed1[_0xd36a('0x2e')],'resourceId':_0x5d2ed1['id'],'type':_0x196d4a[_0xd36a('0x2e')],'sectionId':_0x196d4a['id']},{})['then'](function(){return _0x7c9260;});}else{return _0x7c9260;}})['catch'](function(_0x127402){logger['error'](_0xd36a('0x57'),_0x127402);throw _0x127402;});}return _0x7c9260;})['then'](respondWithResult(_0xeefeb,0xc9))['catch'](handleError(_0xeefeb,null));};exports[_0xd36a('0x58')]=function(_0x189393,_0x1ed27f){if(_0x189393['body']['id']){delete _0x189393['body']['id'];}return db['MailQueue']['find']({'where':{'id':_0x189393['params']['id']}})[_0xd36a('0x29')](handleEntityNotFound(_0x1ed27f,null))['then'](saveUpdates(_0x189393[_0xd36a('0x4e')],null))[_0xd36a('0x29')](respondWithResult(_0x1ed27f,null))['catch'](handleError(_0x1ed27f,null));};exports[_0xd36a('0x59')]=function(_0xc0a687,_0x3d865e){return db[_0xd36a('0x32')][_0xd36a('0x53')]({'where':{'id':_0xc0a687['params']['id']}})[_0xd36a('0x29')](handleEntityNotFound(_0x3d865e,null))[_0xd36a('0x29')](removeEntity(_0x3d865e,null))[_0xd36a('0x4c')](handleError(_0x3d865e,null));};exports['describe']=function(_0x413259,_0x334ffb){return db[_0xd36a('0x32')][_0xd36a('0x5a')]()['then'](respondWithResult(_0x334ffb,null))[_0xd36a('0x4c')](handleError(_0x334ffb,null));};exports[_0xd36a('0x5b')]=function(_0x340673,_0x3c2031,_0x2507e4){var _0x2188d9={'raw':!![],'where':{}},_0x438b3c={},_0x5267f4;return db[_0xd36a('0x32')][_0xd36a('0x5c')]({'where':{'id':_0x340673['params']['id']}})[_0xd36a('0x29')](handleEntityNotFound(_0x3c2031,null))['then'](function(_0x26ea74){if(_0x26ea74){_0x5267f4=_0x26ea74[_0xd36a('0x2a')]({'plain':!![]});_0x438b3c[_0xd36a('0x36')]=_[_0xd36a('0x37')](db[_0xd36a('0x5d')]['rawAttributes']);_0x438b3c[_0xd36a('0x38')]=_[_0xd36a('0x37')](_0x340673['query']);_0x438b3c[_0xd36a('0x41')]=_['intersection'](_0x438b3c[_0xd36a('0x36')],_0x438b3c['query']);_0x2188d9[_0xd36a('0x3a')]=_[_0xd36a('0x39')](_0x438b3c[_0xd36a('0x36')],qs['fields'](_0x340673[_0xd36a('0x38')][_0xd36a('0x3b')]));_0x2188d9[_0xd36a('0x3a')]=_0x2188d9['attributes'][_0xd36a('0x5e')]?_0x2188d9[_0xd36a('0x3a')]:_0x438b3c[_0xd36a('0x36')];if(!_0x340673[_0xd36a('0x38')][_0xd36a('0x3c')]('nolimit')){_0x2188d9[_0xd36a('0x23')]=qs[_0xd36a('0x23')](_0x340673[_0xd36a('0x38')][_0xd36a('0x23')]);_0x2188d9[_0xd36a('0x21')]=qs[_0xd36a('0x21')](_0x340673[_0xd36a('0x38')][_0xd36a('0x21')]);}_0x2188d9[_0xd36a('0x3e')]=qs[_0xd36a('0x3f')](_0x340673[_0xd36a('0x38')]['sort']);_0x2188d9[_0xd36a('0x40')]=qs['filters'](_[_0xd36a('0x42')](_0x340673[_0xd36a('0x38')],_0x438b3c[_0xd36a('0x41')]));_0x2188d9['where']['MailQueueId']=_0x26ea74['id'];if(_0x340673[_0xd36a('0x38')][_0xd36a('0x43')]){_0x2188d9[_0xd36a('0x40')]=_[_0xd36a('0x44')](_0x2188d9[_0xd36a('0x40')],{'$or':_['map'](_0x2188d9[_0xd36a('0x3a')],function(_0x129b78){var _0x10a919={};_0x10a919[_0x129b78]={'$like':'%'+_0x340673['query'][_0xd36a('0x43')]+'%'};return _0x10a919;})});}_0x2188d9=_[_0xd36a('0x44')]({},_0x2188d9,_0x340673['options']);return db[_0xd36a('0x5d')][_0xd36a('0x5f')](_0x2188d9);}})[_0xd36a('0x29')](function(_0x568086){if(_0x568086){return db[_0xd36a('0x60')][_0xd36a('0x61')]({'where':{'id':_[_0xd36a('0x31')](_0x568086,_0xd36a('0x62')),'role':_0xd36a('0x63')},'attributes':['id',_0xd36a('0x2e'),_0xd36a('0x64'),'updatedAt',_0xd36a('0x65')]});}})[_0xd36a('0x29')](function(_0x389d52){if(_0x389d52){return{'count':_0x389d52['count'],'rows':_[_0xd36a('0x31')](_0x389d52[_0xd36a('0x66')],function(_0xeb9cc7){return{'membername':_0xeb9cc7['name'],'UserId':_0xeb9cc7['id'],'queue_name':_0x5267f4[_0xd36a('0x2e')],'MailQueueId':_0x5267f4['id'],'interface':util[_0xd36a('0x67')]('%s/%s',_0xd36a('0x68'),_0xeb9cc7['name']),'penalty':0x0,'paused':_0xeb9cc7[_0xd36a('0x64')],'createdAt':_0xeb9cc7['createdAt'],'updatedAt':_0xeb9cc7[_0xd36a('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3c2031,_0x2188d9))['catch'](handleError(_0x3c2031,null));};exports[_0xd36a('0x6a')]=function(_0x2fc387,_0x3ea856,_0x4fcc49){var _0x1dc817={};var _0x25b7fc={};var _0x52f941;var _0x2c3e48;return db[_0xd36a('0x32')][_0xd36a('0x5c')]({'where':{'id':_0x2fc387['params']['id']}})[_0xd36a('0x29')](handleEntityNotFound(_0x3ea856,null))[_0xd36a('0x29')](function(_0x3e5662){if(_0x3e5662){_0x52f941=_0x3e5662;_0x25b7fc[_0xd36a('0x36')]=_[_0xd36a('0x37')](db[_0xd36a('0x6b')][_0xd36a('0x33')]);_0x25b7fc[_0xd36a('0x38')]=_[_0xd36a('0x37')](_0x2fc387[_0xd36a('0x38')]);_0x25b7fc[_0xd36a('0x41')]=_['intersection'](_0x25b7fc[_0xd36a('0x36')],_0x25b7fc[_0xd36a('0x38')]);_0x1dc817[_0xd36a('0x3a')]=_[_0xd36a('0x39')](_0x25b7fc[_0xd36a('0x36')],qs[_0xd36a('0x3b')](_0x2fc387[_0xd36a('0x38')][_0xd36a('0x3b')]));_0x1dc817[_0xd36a('0x3a')]=_0x1dc817[_0xd36a('0x3a')]['length']?_0x1dc817[_0xd36a('0x3a')]:_0x25b7fc[_0xd36a('0x36')];_0x1dc817[_0xd36a('0x3e')]=qs['sort'](_0x2fc387[_0xd36a('0x38')][_0xd36a('0x3f')]);_0x1dc817[_0xd36a('0x40')]=qs['filters'](_[_0xd36a('0x42')](_0x2fc387[_0xd36a('0x38')],_0x25b7fc[_0xd36a('0x41')]));if(_0x2fc387[_0xd36a('0x38')]['filter']){_0x1dc817[_0xd36a('0x40')]=_['merge'](_0x1dc817[_0xd36a('0x40')],{'$or':_[_0xd36a('0x31')](_0x1dc817[_0xd36a('0x3a')],function(_0x154ecf){var _0x38ba48={};_0x38ba48[_0x154ecf]={'$like':'%'+_0x2fc387[_0xd36a('0x38')][_0xd36a('0x43')]+'%'};return _0x38ba48;})});}_0x1dc817=_[_0xd36a('0x44')]({},_0x1dc817,_0x2fc387['options']);return _0x52f941['getTeams'](_0x1dc817);}})['then'](function(_0x104a6f){if(_0x104a6f){_0x2c3e48=_0x104a6f[_0xd36a('0x5e')];if(!_0x2fc387[_0xd36a('0x38')][_0xd36a('0x3c')](_0xd36a('0x3d'))){_0x1dc817[_0xd36a('0x23')]=qs[_0xd36a('0x23')](_0x2fc387[_0xd36a('0x38')]['limit']);_0x1dc817[_0xd36a('0x21')]=qs[_0xd36a('0x21')](_0x2fc387[_0xd36a('0x38')][_0xd36a('0x21')]);}return _0x52f941[_0xd36a('0x6a')](_0x1dc817);}})[_0xd36a('0x29')](function(_0x49c845){if(_0x49c845){return _0x49c845?{'count':_0x2c3e48,'rows':_0x49c845}:null;}})['then'](respondWithResult(_0x3ea856,null))['catch'](handleError(_0x3ea856,null));};exports[_0xd36a('0x6c')]=function(_0x400fb9,_0x1c3f4b,_0xa6bbfa){var _0x408928=_0x400fb9[_0xd36a('0x4e')][_0xd36a('0x6d')];return db[_0xd36a('0x6b')]['findAll']({'where':{'id':_0x408928},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd36a('0x6e'),'attributes':['id',_0xd36a('0x2e'),_0xd36a('0x6f'),'voicePause','interface'],'raw':!![]}]})[_0xd36a('0x29')](function(_0x5700e2){if(_0x5700e2){var _0x3844e2=_[_0xd36a('0x70')](_0x5700e2,function(_0x1f052b){var _0x9ee218=_0x1f052b[_0xd36a('0x2a')]({'plain':!![]});return _0x9ee218[_0xd36a('0x6e')];});return db[_0xd36a('0x32')][_0xd36a('0x53')]({'where':{'id':_0x400fb9[_0xd36a('0x4b')]['id']}})[_0xd36a('0x29')](function(_0x19680c){return db[_0xd36a('0x71')][_0xd36a('0x72')](function(_0x5d3c46){return _0x19680c[_0xd36a('0x6c')](_0x408928,{'transaction':_0x5d3c46})[_0xd36a('0x29')](function(){return BPromise[_0xd36a('0x73')](_0x3844e2,function(_0x4ccb92){return db[_0xd36a('0x5d')][_0xd36a('0x74')]({'where':{'UserId':_0x4ccb92['id'],'MailQueueId':_0x400fb9[_0xd36a('0x4b')]['id']},'transaction':_0x5d3c46});});})[_0xd36a('0x29')](function(){_0x3844e2[_0xd36a('0x75')](function(_0x5967b3){socket['emit'](_0xd36a('0x76'),{'UserId':_0x5967b3['id'],'MailQueueId':_0x19680c['id']});});});});});}})[_0xd36a('0x29')](respondWithStatusCode(_0x1c3f4b,null))['catch'](handleError(_0x1c3f4b,null));};exports[_0xd36a('0x77')]=function(_0x48a26f,_0x2489dd,_0x3d4c21){return db['Team'][_0xd36a('0x5f')]({'where':{'id':_0x48a26f[_0xd36a('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd36a('0x60')],'as':_0xd36a('0x6e'),'attributes':['id'],'raw':!![]}]})[_0xd36a('0x29')](handleEntityNotFound(_0x2489dd,null))[_0xd36a('0x29')](function(_0x10d931){var _0x36c2ee=_[_0xd36a('0x31')](_0x10d931,'id');var _0x7b0241=[];var _0x3da776=[];var _0x2ce3f6=squel[_0xd36a('0x78')]();_0x2ce3f6['field'](_0xd36a('0x79'))[_0xd36a('0x7a')](_0xd36a('0x7b'),'tq')['join'](_0xd36a('0x7c'),'ut',_0xd36a('0x7d'))[_0xd36a('0x40')](_0xd36a('0x7e'),_0x48a26f[_0xd36a('0x4b')]['id']);for(var _0xf5073d=0x0;_0xf5073d<_0x10d931[_0xd36a('0x5e')];_0xf5073d+=0x1){let _0x4e4935=_0x10d931[_0xf5073d];for(var _0x2b544b=0x0;_0x2b544b<_0x4e4935[_0xd36a('0x6e')][_0xd36a('0x5e')];_0x2b544b+=0x1){let _0x264692=_0x4e4935[_0xd36a('0x6e')][_0x2b544b];var _0x196332=_0x2ce3f6[_0xd36a('0x7f')]();_0x196332[_0xd36a('0x40')]('ut.UserId\x20=\x20?',_0x264692['id']);_0x3da776['push'](db[_0xd36a('0x71')]['query'](_0x196332[_0xd36a('0x80')](),{'type':db[_0xd36a('0x71')]['QueryTypes'][_0xd36a('0x81')]})[_0xd36a('0x29')](function(_0x5c02d5){if(_0x5c02d5[_0xd36a('0x5e')]===0x1){return _0x264692['id'];}else{var _0x1aed70=_[_0xd36a('0x82')](_[_0xd36a('0x31')](_0x5c02d5,_0xd36a('0x83')),function(_0x4c927b){return _[_0xd36a('0x84')](_0x36c2ee,_0x4c927b);});if(_0x1aed70){return _0x264692['id'];}}}));}}return BPromise['all'](_0x3da776)[_0xd36a('0x29')](function(_0x4471f1){_0x7b0241=_(_0x7b0241)[_0xd36a('0x85')](_0x4471f1)[_0xd36a('0x86')]()[_0xd36a('0x87')]();return db['MailQueue']['find']({'where':{'id':_0x48a26f[_0xd36a('0x4b')]['id']}})['then'](function(_0x47b2e2){return db[_0xd36a('0x71')][_0xd36a('0x72')](function(_0x65d7ce){return _0x47b2e2['removeTeams'](_0x48a26f[_0xd36a('0x38')][_0xd36a('0x6d')],{'transaction':_0x65d7ce})[_0xd36a('0x29')](function(){if(!_[_0xd36a('0x88')](_0x7b0241)){return _0x47b2e2[_0xd36a('0x89')](_0x7b0241,{'transaction':_0x65d7ce});}})[_0xd36a('0x29')](function(){_0x7b0241[_0xd36a('0x75')](function(_0x2e4e12){socket[_0xd36a('0x8a')](_0xd36a('0x8b'),{'UserId':_0x2e4e12,'MailQueueId':_0x47b2e2['id']});});});});});});})[_0xd36a('0x29')](respondWithStatusCode(_0x2489dd,null))['catch'](handleError(_0x2489dd,null));};exports[_0xd36a('0x8c')]=function(_0x1983b6,_0x5359aa,_0x5f7a01){return db[_0xd36a('0x32')][_0xd36a('0x53')]({'where':{'id':_0x1983b6[_0xd36a('0x4b')]['id']}})[_0xd36a('0x29')](handleEntityNotFound(_0x5359aa,null))[_0xd36a('0x29')](function(_0x307be4){if(_0x307be4){return _0x307be4['addAgents'](_0x1983b6[_0xd36a('0x4e')][_0xd36a('0x6d')],_[_0xd36a('0x8d')](_0x1983b6[_0xd36a('0x4e')],['ids','id'])||{})['spread'](function(_0x4de589){for(var _0x49145d=0x0;_0x49145d<_0x1983b6['body'][_0xd36a('0x6d')][_0xd36a('0x5e')];_0x49145d+=0x1){socket[_0xd36a('0x8a')](_0xd36a('0x76'),{'UserId':Number(_0x1983b6['body'][_0xd36a('0x6d')][_0x49145d]),'MailQueueId':Number(_0x1983b6[_0xd36a('0x4b')]['id'])});}return _0x4de589;});}})[_0xd36a('0x29')](respondWithResult(_0x5359aa,null))['catch'](handleError(_0x5359aa,null));};exports[_0xd36a('0x89')]=function(_0x1b667a,_0xc770cd,_0x102b9f){return db['MailQueue'][_0xd36a('0x53')]({'where':{'id':_0x1b667a[_0xd36a('0x4b')]['id']}})[_0xd36a('0x29')](handleEntityNotFound(_0xc770cd,null))[_0xd36a('0x29')](function(_0x54d188){if(_0x54d188){return _0x54d188['removeAgents'](_0x1b667a['query'][_0xd36a('0x6d')])[_0xd36a('0x29')](function(){if(_[_0xd36a('0x8e')](_0x1b667a['query']['ids'])){for(var _0xace19e=0x0;_0xace19e<_0x1b667a[_0xd36a('0x38')][_0xd36a('0x6d')]['length'];_0xace19e+=0x1){socket[_0xd36a('0x8a')](_0xd36a('0x8b'),{'UserId':Number(_0x1b667a[_0xd36a('0x38')][_0xd36a('0x6d')][_0xace19e]),'MailQueueId':Number(_0x1b667a['params']['id'])});}}else{socket[_0xd36a('0x8a')]('userMailQueue:remove',{'UserId':Number(_0x1b667a[_0xd36a('0x38')][_0xd36a('0x6d')]),'MailQueueId':Number(_0x1b667a[_0xd36a('0x4b')]['id'])});}});}})[_0xd36a('0x29')](respondWithStatusCode(_0xc770cd,null))[_0xd36a('0x4c')](handleError(_0xc770cd,null));};exports['getAgents']=function(_0x2fa122,_0x124771,_0x1ca2b7){var _0x1c6c03={};var _0x35a368={};var _0x433ceb;var _0x492825;return db['MailQueue'][_0xd36a('0x5c')]({'where':{'id':_0x2fa122[_0xd36a('0x4b')]['id']}})[_0xd36a('0x29')](handleEntityNotFound(_0x124771,null))[_0xd36a('0x29')](function(_0x4c39ee){if(_0x4c39ee){_0x433ceb=_0x4c39ee;_0x35a368[_0xd36a('0x36')]=_[_0xd36a('0x37')](db[_0xd36a('0x60')][_0xd36a('0x33')]);_0x35a368[_0xd36a('0x38')]=_[_0xd36a('0x37')](_0x2fa122[_0xd36a('0x38')]);_0x35a368[_0xd36a('0x41')]=_[_0xd36a('0x39')](_0x35a368[_0xd36a('0x36')],_0x35a368['query']);_0x1c6c03[_0xd36a('0x3a')]=_['intersection'](_0x35a368[_0xd36a('0x36')],qs[_0xd36a('0x3b')](_0x2fa122['query'][_0xd36a('0x3b')]));_0x1c6c03[_0xd36a('0x3a')]=_0x1c6c03[_0xd36a('0x3a')][_0xd36a('0x5e')]?_0x1c6c03[_0xd36a('0x3a')]:_0x35a368[_0xd36a('0x36')];_0x1c6c03['order']=qs[_0xd36a('0x3f')](_0x2fa122[_0xd36a('0x38')][_0xd36a('0x3f')]);_0x1c6c03[_0xd36a('0x40')]=qs[_0xd36a('0x41')](_[_0xd36a('0x42')](_0x2fa122[_0xd36a('0x38')],_0x35a368[_0xd36a('0x41')]));if(_0x2fa122[_0xd36a('0x38')][_0xd36a('0x43')]){_0x1c6c03[_0xd36a('0x40')]=_[_0xd36a('0x44')](_0x1c6c03[_0xd36a('0x40')],{'$or':_[_0xd36a('0x31')](_0x1c6c03[_0xd36a('0x3a')],function(_0x3c5918){var _0x3b2d6e={};_0x3b2d6e[_0x3c5918]={'$like':'%'+_0x2fa122[_0xd36a('0x38')]['filter']+'%'};return _0x3b2d6e;})});}_0x1c6c03=_[_0xd36a('0x44')]({},_0x1c6c03,_0x2fa122[_0xd36a('0x47')]);return _0x433ceb['getAgents'](_0x1c6c03);}})[_0xd36a('0x29')](function(_0xbd8a99){if(_0xbd8a99){_0x492825=_0xbd8a99['length'];if(!_0x2fa122[_0xd36a('0x38')][_0xd36a('0x3c')](_0xd36a('0x3d'))){_0x1c6c03[_0xd36a('0x23')]=qs[_0xd36a('0x23')](_0x2fa122[_0xd36a('0x38')]['limit']);_0x1c6c03[_0xd36a('0x21')]=qs['offset'](_0x2fa122[_0xd36a('0x38')][_0xd36a('0x21')]);}return _0x433ceb[_0xd36a('0x8f')](_0x1c6c03);}})['then'](function(_0x4d1cf3){if(_0x4d1cf3){return _0x4d1cf3?{'count':_0x492825,'rows':_0x4d1cf3}:null;}})[_0xd36a('0x29')](respondWithResult(_0x124771,null))['catch'](handleError(_0x124771,null));}; \ No newline at end of file +var _0xf81b=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','get','MailQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','VIRTUAL','filter','merge','MailQueue','findAll','catch','show','params','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserMailQueue','sort','MailQueueId','User','findAndCountAll','updatedAt','createdAt','rows','format','%s/%s','SIP','mailPause','getTeams','addTeams','ids','Team','Agents','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','findOne','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x174a74,_0x5ae956){var _0x1e4e14=function(_0x52976b){while(--_0x52976b){_0x174a74['push'](_0x174a74['shift']());}};_0x1e4e14(++_0x5ae956);}(_0xf81b,0x81));var _0xbf81=function(_0x4ffe35,_0x22610f){_0x4ffe35=_0x4ffe35-0x0;var _0x1b7ea8=_0xf81b[_0x4ffe35];return _0x1b7ea8;};'use strict';var emlformat=require(_0xbf81('0x0'));var rimraf=require(_0xbf81('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf81('0x2'));var rp=require(_0xbf81('0x3'));var moment=require('moment');var BPromise=require(_0xbf81('0x4'));var Mustache=require(_0xbf81('0x5'));var util=require(_0xbf81('0x6'));var path=require(_0xbf81('0x7'));var sox=require(_0xbf81('0x8'));var csv=require(_0xbf81('0x9'));var ejs=require(_0xbf81('0xa'));var fs=require('fs');var fs_extra=require(_0xbf81('0xb'));var _=require(_0xbf81('0xc'));var squel=require(_0xbf81('0xd'));var crypto=require(_0xbf81('0xe'));var jsforce=require(_0xbf81('0xf'));var deskjs=require(_0xbf81('0x10'));var toCsv=require(_0xbf81('0x9'));var querystring=require(_0xbf81('0x11'));var Papa=require(_0xbf81('0x12'));var Redis=require(_0xbf81('0x13'));var authService=require(_0xbf81('0x14'));var qs=require(_0xbf81('0x15'));var as=require(_0xbf81('0x16'));var hardwareService=require(_0xbf81('0x17'));var logger=require(_0xbf81('0x18'))(_0xbf81('0x19'));var utils=require(_0xbf81('0x1a'));var config=require(_0xbf81('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf81('0x1c'))['db'];config[_0xbf81('0x1d')]=_[_0xbf81('0x1e')](config['redis'],{'host':_0xbf81('0x1f'),'port':0x18eb});var socket=require(_0xbf81('0x20'))(new Redis(config[_0xbf81('0x1d')]));require(_0xbf81('0x21'))[_0xbf81('0x22')](socket);function respondWithStatusCode(_0x33d0d8,_0x261bc1){_0x261bc1=_0x261bc1||0xcc;return function(_0x40fedf){if(_0x40fedf){return _0x33d0d8[_0xbf81('0x23')](_0x261bc1);}return _0x33d0d8[_0xbf81('0x24')](_0x261bc1)[_0xbf81('0x25')]();};}function respondWithResult(_0x30f774,_0x53810c){_0x53810c=_0x53810c||0xc8;return function(_0x88507e){if(_0x88507e){return _0x30f774[_0xbf81('0x24')](_0x53810c)[_0xbf81('0x26')](_0x88507e);}};}function respondWithFilteredResult(_0xf7da36,_0x1c86a9){return function(_0x3d4b2b){if(_0x3d4b2b){var _0x504f0a=typeof _0x1c86a9[_0xbf81('0x27')]==='undefined'&&typeof _0x1c86a9[_0xbf81('0x28')]===_0xbf81('0x29');var _0x1a2e99=_0x3d4b2b[_0xbf81('0x2a')];var _0x102f64=_0x504f0a?0x0:_0x1c86a9['offset'];var _0x53caf4=_0x504f0a?_0x3d4b2b[_0xbf81('0x2a')]:_0x1c86a9['offset']+_0x1c86a9['limit'];var _0x10d8f2;if(_0x53caf4>=_0x1a2e99){_0x53caf4=_0x1a2e99;_0x10d8f2=0xc8;}else{_0x10d8f2=0xce;}_0xf7da36['status'](_0x10d8f2);return _0xf7da36[_0xbf81('0x2b')](_0xbf81('0x2c'),_0x102f64+'-'+_0x53caf4+'/'+_0x1a2e99)[_0xbf81('0x26')](_0x3d4b2b);}return null;};}function patchUpdates(_0x55ac70){return function(_0x265acd){try{jsonpatch[_0xbf81('0x2d')](_0x265acd,_0x55ac70,!![]);}catch(_0x51e383){return BPromise[_0xbf81('0x2e')](_0x51e383);}return _0x265acd[_0xbf81('0x2f')]();};}function saveUpdates(_0x41d6dc,_0x5629ca){return function(_0x4d7a56){if(_0x4d7a56){return _0x4d7a56['update'](_0x41d6dc)['then'](function(_0x1cb87a){return _0x1cb87a;});}return null;};}function removeEntity(_0xf68e0f,_0x6284e1){return function(_0x3b4d5c){if(_0x3b4d5c){return _0x3b4d5c[_0xbf81('0x30')]()[_0xbf81('0x31')](function(){var _0x34ff74=_0x3b4d5c[_0xbf81('0x32')]({'plain':!![]});var _0x2fb45d=_0xbf81('0x33');return db[_0xbf81('0x34')][_0xbf81('0x30')]({'where':{'type':_0x2fb45d,'resourceId':_0x34ff74['id']}})[_0xbf81('0x31')](function(){return _0x3b4d5c;});})[_0xbf81('0x31')](function(){_0xf68e0f['status'](0xcc)[_0xbf81('0x25')]();});}};}function handleEntityNotFound(_0x4d7529,_0xdc186a){return function(_0x4452bd){if(!_0x4452bd){_0x4d7529[_0xbf81('0x23')](0x194);}return _0x4452bd;};}function handleError(_0x1f9ed7,_0x2fa90b){_0x2fa90b=_0x2fa90b||0x1f4;return function(_0x5a8de8){logger[_0xbf81('0x35')](_0x5a8de8[_0xbf81('0x36')]);if(_0x5a8de8[_0xbf81('0x37')]){delete _0x5a8de8[_0xbf81('0x37')];}_0x1f9ed7[_0xbf81('0x24')](_0x2fa90b)[_0xbf81('0x38')](_0x5a8de8);};}exports[_0xbf81('0x39')]=function(_0x5d888a,_0x56ab5b){var _0x18749={},_0x101740={},_0x104f12={'count':0x0,'rows':[]};var _0x57cd41=_[_0xbf81('0x3a')](db['MailQueue'][_0xbf81('0x3b')],function(_0x455017){return{'name':_0x455017[_0xbf81('0x3c')],'type':_0x455017[_0xbf81('0x3d')][_0xbf81('0x3e')]};});_0x101740[_0xbf81('0x3f')]=_[_0xbf81('0x3a')](_0x57cd41,_0xbf81('0x37'));_0x101740[_0xbf81('0x40')]=_[_0xbf81('0x41')](_0x5d888a[_0xbf81('0x40')]);_0x101740[_0xbf81('0x42')]=_[_0xbf81('0x43')](_0x101740['model'],_0x101740['query']);_0x18749[_0xbf81('0x44')]=_['intersection'](_0x101740['model'],qs['fields'](_0x5d888a['query'][_0xbf81('0x45')]));_0x18749[_0xbf81('0x44')]=_0x18749['attributes'][_0xbf81('0x46')]?_0x18749[_0xbf81('0x44')]:_0x101740[_0xbf81('0x3f')];if(!_0x5d888a[_0xbf81('0x40')][_0xbf81('0x47')](_0xbf81('0x48'))){_0x18749[_0xbf81('0x28')]=qs['limit'](_0x5d888a['query']['limit']);_0x18749[_0xbf81('0x27')]=qs['offset'](_0x5d888a[_0xbf81('0x40')][_0xbf81('0x27')]);}_0x18749[_0xbf81('0x49')]=qs['sort'](_0x5d888a['query']['sort']);_0x18749[_0xbf81('0x4a')]=qs['filters'](_[_0xbf81('0x4b')](_0x5d888a[_0xbf81('0x40')],_0x101740[_0xbf81('0x42')]),_0x57cd41);if(_0x5d888a['query']['filter']){_0x18749[_0xbf81('0x4a')]=_['merge'](_0x18749[_0xbf81('0x4a')],{'$or':_[_0xbf81('0x3a')](_0x57cd41,function(_0x4eb9e8){if(_0x4eb9e8[_0xbf81('0x3d')]!==_0xbf81('0x4c')){var _0x1f6e6c={};_0x1f6e6c[_0x4eb9e8[_0xbf81('0x37')]]={'$like':'%'+_0x5d888a[_0xbf81('0x40')][_0xbf81('0x4d')]+'%'};return _0x1f6e6c;}})});}_0x18749=_[_0xbf81('0x4e')]({},_0x18749,_0x5d888a['options']);var _0xc36e07={'where':_0x18749[_0xbf81('0x4a')]};return db[_0xbf81('0x4f')][_0xbf81('0x2a')](_0xc36e07)[_0xbf81('0x31')](function(_0x39e458){_0x104f12['count']=_0x39e458;if(_0x5d888a['query']['includeAll']){_0x18749['include']=[{'all':!![]}];}return db[_0xbf81('0x4f')][_0xbf81('0x50')](_0x18749);})[_0xbf81('0x31')](function(_0x279c56){_0x104f12['rows']=_0x279c56;return _0x104f12;})[_0xbf81('0x31')](respondWithFilteredResult(_0x56ab5b,_0x18749))[_0xbf81('0x51')](handleError(_0x56ab5b,null));};exports[_0xbf81('0x52')]=function(_0xcfbab4,_0x10715f){var _0x5528e4={'raw':!![],'where':{'id':_0xcfbab4[_0xbf81('0x53')]['id']}},_0x3c6b7e={};_0x3c6b7e[_0xbf81('0x3f')]=_[_0xbf81('0x41')](db['MailQueue'][_0xbf81('0x3b')]);_0x3c6b7e[_0xbf81('0x40')]=_['keys'](_0xcfbab4[_0xbf81('0x40')]);_0x3c6b7e[_0xbf81('0x42')]=_[_0xbf81('0x43')](_0x3c6b7e[_0xbf81('0x3f')],_0x3c6b7e[_0xbf81('0x40')]);_0x5528e4[_0xbf81('0x44')]=_[_0xbf81('0x43')](_0x3c6b7e[_0xbf81('0x3f')],qs['fields'](_0xcfbab4[_0xbf81('0x40')][_0xbf81('0x45')]));_0x5528e4[_0xbf81('0x44')]=_0x5528e4[_0xbf81('0x44')]['length']?_0x5528e4[_0xbf81('0x44')]:_0x3c6b7e[_0xbf81('0x3f')];if(_0xcfbab4['query'][_0xbf81('0x54')]){_0x5528e4[_0xbf81('0x55')]=[{'all':!![]}];}_0x5528e4=_[_0xbf81('0x4e')]({},_0x5528e4,_0xcfbab4[_0xbf81('0x56')]);return db['MailQueue'][_0xbf81('0x57')](_0x5528e4)[_0xbf81('0x31')](handleEntityNotFound(_0x10715f,null))['then'](respondWithResult(_0x10715f,null))[_0xbf81('0x51')](handleError(_0x10715f,null));};exports[_0xbf81('0x58')]=function(_0x5008c8,_0x2a65fa){return db[_0xbf81('0x4f')]['create'](_0x5008c8[_0xbf81('0x59')],{})['then'](function(_0x31ba09){var _0x202f50=_0x5008c8[_0xbf81('0x5a')]['get']({'plain':!![]});if(!_0x202f50)throw new Error(_0xbf81('0x5b'));if(_0x202f50[_0xbf81('0x5c')]===_0xbf81('0x5a')){var _0x2f97fb=_0x31ba09['get']({'plain':!![]});var _0x123c7a=_0xbf81('0x33');return db[_0xbf81('0x5d')][_0xbf81('0x57')]({'where':{'name':_0x123c7a,'userProfileId':_0x202f50['userProfileId']},'raw':!![]})[_0xbf81('0x31')](function(_0x2d415b){if(_0x2d415b&&_0x2d415b[_0xbf81('0x5e')]===0x0){return db['UserProfileResource']['create']({'name':_0x2f97fb[_0xbf81('0x37')],'resourceId':_0x2f97fb['id'],'type':_0x2d415b['name'],'sectionId':_0x2d415b['id']},{})[_0xbf81('0x31')](function(){return _0x31ba09;});}else{return _0x31ba09;}})['catch'](function(_0x4232ba){logger['error'](_0xbf81('0x5f'),_0x4232ba);throw _0x4232ba;});}return _0x31ba09;})[_0xbf81('0x31')](respondWithResult(_0x2a65fa,0xc9))['catch'](handleError(_0x2a65fa,null));};exports[_0xbf81('0x60')]=function(_0x3ce410,_0x19c9dd){if(_0x3ce410[_0xbf81('0x59')]['id']){delete _0x3ce410['body']['id'];}return db['MailQueue'][_0xbf81('0x57')]({'where':{'id':_0x3ce410[_0xbf81('0x53')]['id']}})[_0xbf81('0x31')](handleEntityNotFound(_0x19c9dd,null))[_0xbf81('0x31')](saveUpdates(_0x3ce410['body'],null))[_0xbf81('0x31')](respondWithResult(_0x19c9dd,null))[_0xbf81('0x51')](handleError(_0x19c9dd,null));};exports['destroy']=function(_0x129481,_0x1f6576){return db[_0xbf81('0x4f')][_0xbf81('0x57')]({'where':{'id':_0x129481['params']['id']}})[_0xbf81('0x31')](handleEntityNotFound(_0x1f6576,null))[_0xbf81('0x31')](removeEntity(_0x1f6576,null))['catch'](handleError(_0x1f6576,null));};exports[_0xbf81('0x61')]=function(_0x583d9c,_0x29c2cc){return db[_0xbf81('0x4f')][_0xbf81('0x61')]()['then'](respondWithResult(_0x29c2cc,null))[_0xbf81('0x51')](handleError(_0x29c2cc,null));};exports[_0xbf81('0x62')]=function(_0x315372,_0x2f810b,_0x585c7b){var _0x217e63={'raw':!![],'where':{}},_0x44a3e1={},_0x4220e8;return db[_0xbf81('0x4f')]['findOne']({'where':{'id':_0x315372[_0xbf81('0x53')]['id']}})['then'](handleEntityNotFound(_0x2f810b,null))[_0xbf81('0x31')](function(_0x4c2ad4){if(_0x4c2ad4){_0x4220e8=_0x4c2ad4[_0xbf81('0x32')]({'plain':!![]});_0x44a3e1[_0xbf81('0x3f')]=_[_0xbf81('0x41')](db[_0xbf81('0x63')][_0xbf81('0x3b')]);_0x44a3e1[_0xbf81('0x40')]=_['keys'](_0x315372[_0xbf81('0x40')]);_0x44a3e1[_0xbf81('0x42')]=_[_0xbf81('0x43')](_0x44a3e1[_0xbf81('0x3f')],_0x44a3e1['query']);_0x217e63['attributes']=_['intersection'](_0x44a3e1[_0xbf81('0x3f')],qs[_0xbf81('0x45')](_0x315372[_0xbf81('0x40')]['fields']));_0x217e63[_0xbf81('0x44')]=_0x217e63[_0xbf81('0x44')][_0xbf81('0x46')]?_0x217e63[_0xbf81('0x44')]:_0x44a3e1[_0xbf81('0x3f')];if(!_0x315372[_0xbf81('0x40')]['hasOwnProperty'](_0xbf81('0x48'))){_0x217e63[_0xbf81('0x28')]=qs[_0xbf81('0x28')](_0x315372['query'][_0xbf81('0x28')]);_0x217e63[_0xbf81('0x27')]=qs[_0xbf81('0x27')](_0x315372[_0xbf81('0x40')][_0xbf81('0x27')]);}_0x217e63[_0xbf81('0x49')]=qs[_0xbf81('0x64')](_0x315372[_0xbf81('0x40')]['sort']);_0x217e63[_0xbf81('0x4a')]=qs[_0xbf81('0x42')](_[_0xbf81('0x4b')](_0x315372[_0xbf81('0x40')],_0x44a3e1['filters']));_0x217e63[_0xbf81('0x4a')][_0xbf81('0x65')]=_0x4c2ad4['id'];if(_0x315372[_0xbf81('0x40')][_0xbf81('0x4d')]){_0x217e63[_0xbf81('0x4a')]=_['merge'](_0x217e63[_0xbf81('0x4a')],{'$or':_[_0xbf81('0x3a')](_0x217e63['attributes'],function(_0x2940b7){var _0x5a694a={};_0x5a694a[_0x2940b7]={'$like':'%'+_0x315372[_0xbf81('0x40')][_0xbf81('0x4d')]+'%'};return _0x5a694a;})});}_0x217e63=_[_0xbf81('0x4e')]({},_0x217e63,_0x315372[_0xbf81('0x56')]);return db[_0xbf81('0x63')]['findAll'](_0x217e63);}})[_0xbf81('0x31')](function(_0x38bbca){if(_0x38bbca){return db[_0xbf81('0x66')][_0xbf81('0x67')]({'where':{'id':_[_0xbf81('0x3a')](_0x38bbca,'UserId'),'role':'agent'},'attributes':['id',_0xbf81('0x37'),'mailPause',_0xbf81('0x68'),_0xbf81('0x69')]});}})[_0xbf81('0x31')](function(_0x531b3f){if(_0x531b3f){return{'count':_0x531b3f[_0xbf81('0x2a')],'rows':_[_0xbf81('0x3a')](_0x531b3f[_0xbf81('0x6a')],function(_0x242a5c){return{'membername':_0x242a5c[_0xbf81('0x37')],'UserId':_0x242a5c['id'],'queue_name':_0x4220e8[_0xbf81('0x37')],'MailQueueId':_0x4220e8['id'],'interface':util[_0xbf81('0x6b')](_0xbf81('0x6c'),_0xbf81('0x6d'),_0x242a5c[_0xbf81('0x37')]),'penalty':0x0,'paused':_0x242a5c[_0xbf81('0x6e')],'createdAt':_0x242a5c[_0xbf81('0x69')],'updatedAt':_0x242a5c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xbf81('0x31')](respondWithFilteredResult(_0x2f810b,_0x217e63))[_0xbf81('0x51')](handleError(_0x2f810b,null));};exports[_0xbf81('0x6f')]=function(_0xf8b46e,_0x1fa79e,_0xa48cd2){var _0x5e1d0e={};var _0x8271cb={};var _0x1e26c4;var _0x54bc5b;return db[_0xbf81('0x4f')]['findOne']({'where':{'id':_0xf8b46e[_0xbf81('0x53')]['id']}})[_0xbf81('0x31')](handleEntityNotFound(_0x1fa79e,null))[_0xbf81('0x31')](function(_0x4e200c){if(_0x4e200c){_0x1e26c4=_0x4e200c;_0x8271cb[_0xbf81('0x3f')]=_[_0xbf81('0x41')](db['Team'][_0xbf81('0x3b')]);_0x8271cb[_0xbf81('0x40')]=_[_0xbf81('0x41')](_0xf8b46e[_0xbf81('0x40')]);_0x8271cb['filters']=_[_0xbf81('0x43')](_0x8271cb[_0xbf81('0x3f')],_0x8271cb[_0xbf81('0x40')]);_0x5e1d0e[_0xbf81('0x44')]=_['intersection'](_0x8271cb[_0xbf81('0x3f')],qs[_0xbf81('0x45')](_0xf8b46e[_0xbf81('0x40')]['fields']));_0x5e1d0e[_0xbf81('0x44')]=_0x5e1d0e[_0xbf81('0x44')][_0xbf81('0x46')]?_0x5e1d0e[_0xbf81('0x44')]:_0x8271cb[_0xbf81('0x3f')];_0x5e1d0e['order']=qs[_0xbf81('0x64')](_0xf8b46e[_0xbf81('0x40')]['sort']);_0x5e1d0e[_0xbf81('0x4a')]=qs[_0xbf81('0x42')](_[_0xbf81('0x4b')](_0xf8b46e[_0xbf81('0x40')],_0x8271cb[_0xbf81('0x42')]));if(_0xf8b46e[_0xbf81('0x40')][_0xbf81('0x4d')]){_0x5e1d0e[_0xbf81('0x4a')]=_['merge'](_0x5e1d0e[_0xbf81('0x4a')],{'$or':_[_0xbf81('0x3a')](_0x5e1d0e[_0xbf81('0x44')],function(_0xbbc1f2){var _0x4df8f0={};_0x4df8f0[_0xbbc1f2]={'$like':'%'+_0xf8b46e[_0xbf81('0x40')][_0xbf81('0x4d')]+'%'};return _0x4df8f0;})});}_0x5e1d0e=_['merge']({},_0x5e1d0e,_0xf8b46e['options']);return _0x1e26c4[_0xbf81('0x6f')](_0x5e1d0e);}})['then'](function(_0x201a36){if(_0x201a36){_0x54bc5b=_0x201a36[_0xbf81('0x46')];if(!_0xf8b46e[_0xbf81('0x40')][_0xbf81('0x47')]('nolimit')){_0x5e1d0e[_0xbf81('0x28')]=qs[_0xbf81('0x28')](_0xf8b46e[_0xbf81('0x40')][_0xbf81('0x28')]);_0x5e1d0e[_0xbf81('0x27')]=qs[_0xbf81('0x27')](_0xf8b46e[_0xbf81('0x40')][_0xbf81('0x27')]);}return _0x1e26c4[_0xbf81('0x6f')](_0x5e1d0e);}})['then'](function(_0x532943){if(_0x532943){return _0x532943?{'count':_0x54bc5b,'rows':_0x532943}:null;}})[_0xbf81('0x31')](respondWithResult(_0x1fa79e,null))['catch'](handleError(_0x1fa79e,null));};exports[_0xbf81('0x70')]=function(_0x3614d7,_0x107002,_0x500473){var _0x369a6c=_0x3614d7[_0xbf81('0x59')][_0xbf81('0x71')];return db[_0xbf81('0x72')][_0xbf81('0x50')]({'where':{'id':_0x369a6c},'attributes':['id'],'include':[{'model':db[_0xbf81('0x66')],'as':_0xbf81('0x73'),'attributes':['id',_0xbf81('0x37'),'online',_0xbf81('0x74'),'interface'],'raw':!![]}]})[_0xbf81('0x31')](function(_0x18b00a){if(_0x18b00a){var _0x3761aa=_['flatMap'](_0x18b00a,function(_0x2010a9){var _0x17d909=_0x2010a9[_0xbf81('0x32')]({'plain':!![]});return _0x17d909[_0xbf81('0x73')];});return db['MailQueue'][_0xbf81('0x57')]({'where':{'id':_0x3614d7[_0xbf81('0x53')]['id']}})['then'](function(_0x24c06a){return db[_0xbf81('0x75')][_0xbf81('0x76')](function(_0x1bba16){return _0x24c06a[_0xbf81('0x70')](_0x369a6c,{'transaction':_0x1bba16})['then'](function(){return BPromise[_0xbf81('0x77')](_0x3761aa,function(_0x23f024){return db['UserMailQueue'][_0xbf81('0x78')]({'where':{'UserId':_0x23f024['id'],'MailQueueId':_0x3614d7[_0xbf81('0x53')]['id']},'transaction':_0x1bba16});});})[_0xbf81('0x31')](function(){_0x3761aa[_0xbf81('0x79')](function(_0x2975e1){socket[_0xbf81('0x7a')](_0xbf81('0x7b'),{'UserId':_0x2975e1['id'],'MailQueueId':_0x24c06a['id']});});});});});}})[_0xbf81('0x31')](respondWithStatusCode(_0x107002,null))[_0xbf81('0x51')](handleError(_0x107002,null));};exports[_0xbf81('0x7c')]=function(_0x727a88,_0x56f131,_0x4c7287){return db[_0xbf81('0x72')]['findAll']({'where':{'id':_0x727a88[_0xbf81('0x40')][_0xbf81('0x71')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x56f131,null))[_0xbf81('0x31')](function(_0x547ed4){var _0x302f4f=_[_0xbf81('0x3a')](_0x547ed4,'id');var _0x5e8723=[];var _0x187f93=[];var _0x2e2e51=squel[_0xbf81('0x7d')]();_0x2e2e51['field'](_0xbf81('0x7e'))[_0xbf81('0x7f')]('team_has_mail_queues','tq')[_0xbf81('0x80')](_0xbf81('0x81'),'ut',_0xbf81('0x82'))[_0xbf81('0x4a')](_0xbf81('0x83'),_0x727a88[_0xbf81('0x53')]['id']);for(var _0x3dc5dc=0x0;_0x3dc5dc<_0x547ed4['length'];_0x3dc5dc+=0x1){let _0x3cfffa=_0x547ed4[_0x3dc5dc];for(var _0x5ab4e4=0x0;_0x5ab4e4<_0x3cfffa['Agents']['length'];_0x5ab4e4+=0x1){let _0x3b43be=_0x3cfffa[_0xbf81('0x73')][_0x5ab4e4];var _0x55f73f=_0x2e2e51[_0xbf81('0x84')]();_0x55f73f['where'](_0xbf81('0x85'),_0x3b43be['id']);_0x187f93['push'](db[_0xbf81('0x75')][_0xbf81('0x40')](_0x55f73f[_0xbf81('0x86')](),{'type':db[_0xbf81('0x75')]['QueryTypes'][_0xbf81('0x87')]})[_0xbf81('0x31')](function(_0x12e06b){if(_0x12e06b[_0xbf81('0x46')]===0x1){return _0x3b43be['id'];}else{var _0x5e2a10=_['every'](_['map'](_0x12e06b,_0xbf81('0x88')),function(_0x1f93b8){return _[_0xbf81('0x89')](_0x302f4f,_0x1f93b8);});if(_0x5e2a10){return _0x3b43be['id'];}}}));}}return BPromise[_0xbf81('0x8a')](_0x187f93)[_0xbf81('0x31')](function(_0x517308){_0x5e8723=_(_0x5e8723)[_0xbf81('0x8b')](_0x517308)[_0xbf81('0x8c')]()[_0xbf81('0x8d')]();return db[_0xbf81('0x4f')][_0xbf81('0x57')]({'where':{'id':_0x727a88[_0xbf81('0x53')]['id']}})[_0xbf81('0x31')](function(_0x2820e0){return db[_0xbf81('0x75')][_0xbf81('0x76')](function(_0x2c48fb){return _0x2820e0['removeTeams'](_0x727a88[_0xbf81('0x40')][_0xbf81('0x71')],{'transaction':_0x2c48fb})['then'](function(){if(!_[_0xbf81('0x8e')](_0x5e8723)){return _0x2820e0[_0xbf81('0x8f')](_0x5e8723,{'transaction':_0x2c48fb});}})[_0xbf81('0x31')](function(){_0x5e8723[_0xbf81('0x79')](function(_0x1c43eb){socket[_0xbf81('0x7a')](_0xbf81('0x90'),{'UserId':_0x1c43eb,'MailQueueId':_0x2820e0['id']});});});});});});})[_0xbf81('0x31')](respondWithStatusCode(_0x56f131,null))[_0xbf81('0x51')](handleError(_0x56f131,null));};exports[_0xbf81('0x91')]=function(_0x234824,_0x101840,_0x2fbe0a){return db[_0xbf81('0x4f')][_0xbf81('0x57')]({'where':{'id':_0x234824[_0xbf81('0x53')]['id']}})[_0xbf81('0x31')](handleEntityNotFound(_0x101840,null))[_0xbf81('0x31')](function(_0x3ca946){if(_0x3ca946){return _0x3ca946[_0xbf81('0x91')](_0x234824[_0xbf81('0x59')]['ids'],_[_0xbf81('0x92')](_0x234824[_0xbf81('0x59')],[_0xbf81('0x71'),'id'])||{})[_0xbf81('0x93')](function(_0x307c37){for(var _0x4b7aab=0x0;_0x4b7aab<_0x234824[_0xbf81('0x59')][_0xbf81('0x71')]['length'];_0x4b7aab+=0x1){socket[_0xbf81('0x7a')](_0xbf81('0x7b'),{'UserId':Number(_0x234824[_0xbf81('0x59')][_0xbf81('0x71')][_0x4b7aab]),'MailQueueId':Number(_0x234824['params']['id'])});}return _0x307c37;});}})['then'](respondWithResult(_0x101840,null))[_0xbf81('0x51')](handleError(_0x101840,null));};exports['removeAgents']=function(_0x3b5524,_0x202cd1,_0x579c53){return db[_0xbf81('0x4f')][_0xbf81('0x57')]({'where':{'id':_0x3b5524[_0xbf81('0x53')]['id']}})[_0xbf81('0x31')](handleEntityNotFound(_0x202cd1,null))[_0xbf81('0x31')](function(_0xb3b3c3){if(_0xb3b3c3){return _0xb3b3c3['removeAgents'](_0x3b5524[_0xbf81('0x40')][_0xbf81('0x71')])['then'](function(){if(_['isArray'](_0x3b5524['query']['ids'])){for(var _0x45a52f=0x0;_0x45a52f<_0x3b5524['query']['ids'][_0xbf81('0x46')];_0x45a52f+=0x1){socket[_0xbf81('0x7a')](_0xbf81('0x90'),{'UserId':Number(_0x3b5524[_0xbf81('0x40')]['ids'][_0x45a52f]),'MailQueueId':Number(_0x3b5524[_0xbf81('0x53')]['id'])});}}else{socket['emit'](_0xbf81('0x90'),{'UserId':Number(_0x3b5524[_0xbf81('0x40')][_0xbf81('0x71')]),'MailQueueId':Number(_0x3b5524[_0xbf81('0x53')]['id'])});}});}})[_0xbf81('0x31')](respondWithStatusCode(_0x202cd1,null))['catch'](handleError(_0x202cd1,null));};exports['getAgents']=function(_0xf4424,_0x1e89ca,_0xd045ab){var _0x3935cf={};var _0x550531={};var _0x2e7260;var _0x353b37;return db['MailQueue'][_0xbf81('0x94')]({'where':{'id':_0xf4424['params']['id']}})['then'](handleEntityNotFound(_0x1e89ca,null))[_0xbf81('0x31')](function(_0x89c623){if(_0x89c623){_0x2e7260=_0x89c623;_0x550531[_0xbf81('0x3f')]=_['keys'](db[_0xbf81('0x66')][_0xbf81('0x3b')]);_0x550531[_0xbf81('0x40')]=_['keys'](_0xf4424['query']);_0x550531[_0xbf81('0x42')]=_['intersection'](_0x550531[_0xbf81('0x3f')],_0x550531['query']);_0x3935cf['attributes']=_[_0xbf81('0x43')](_0x550531[_0xbf81('0x3f')],qs[_0xbf81('0x45')](_0xf4424[_0xbf81('0x40')][_0xbf81('0x45')]));_0x3935cf[_0xbf81('0x44')]=_0x3935cf[_0xbf81('0x44')][_0xbf81('0x46')]?_0x3935cf[_0xbf81('0x44')]:_0x550531[_0xbf81('0x3f')];_0x3935cf[_0xbf81('0x49')]=qs[_0xbf81('0x64')](_0xf4424['query'][_0xbf81('0x64')]);_0x3935cf['where']=qs[_0xbf81('0x42')](_[_0xbf81('0x4b')](_0xf4424[_0xbf81('0x40')],_0x550531[_0xbf81('0x42')]));if(_0xf4424[_0xbf81('0x40')][_0xbf81('0x4d')]){_0x3935cf['where']=_[_0xbf81('0x4e')](_0x3935cf[_0xbf81('0x4a')],{'$or':_['map'](_0x3935cf[_0xbf81('0x44')],function(_0x4bcd58){var _0x4fcb2a={};_0x4fcb2a[_0x4bcd58]={'$like':'%'+_0xf4424[_0xbf81('0x40')][_0xbf81('0x4d')]+'%'};return _0x4fcb2a;})});}_0x3935cf=_['merge']({},_0x3935cf,_0xf4424['options']);return _0x2e7260[_0xbf81('0x95')](_0x3935cf);}})[_0xbf81('0x31')](function(_0x59c772){if(_0x59c772){_0x353b37=_0x59c772['length'];if(!_0xf4424[_0xbf81('0x40')][_0xbf81('0x47')](_0xbf81('0x48'))){_0x3935cf[_0xbf81('0x28')]=qs[_0xbf81('0x28')](_0xf4424[_0xbf81('0x40')][_0xbf81('0x28')]);_0x3935cf[_0xbf81('0x27')]=qs[_0xbf81('0x27')](_0xf4424[_0xbf81('0x40')][_0xbf81('0x27')]);}return _0x2e7260['getAgents'](_0x3935cf);}})[_0xbf81('0x31')](function(_0x443fbb){if(_0x443fbb){return _0x443fbb?{'count':_0x353b37,'rows':_0x443fbb}:null;}})[_0xbf81('0x31')](respondWithResult(_0x1e89ca,null))[_0xbf81('0x51')](handleError(_0x1e89ca,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index c973a82..ed5a97c 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 _0x5a24=['hook','exports','events','MailQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x5a24,0x1c4));var _0x45a2=function(_0x25c3e5,_0x4bd1c8){_0x25c3e5=_0x25c3e5-0x0;var _0x25adad=_0x5a24[_0x25c3e5];return _0x25adad;};'use strict';var EventEmitter=require(_0x45a2('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x45a2('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x45a2('0x2'),'afterUpdate':_0x45a2('0x3'),'afterDestroy':_0x45a2('0x4')};function emitEvent(_0x4ff6b2){return function(_0x35066c,_0x101dc1,_0x4a4b2f){MailQueueEvents[_0x45a2('0x5')](_0x4ff6b2+':'+_0x35066c['id'],_0x35066c);MailQueueEvents[_0x45a2('0x5')](_0x4ff6b2,_0x35066c);_0x4a4b2f(null);};}for(var e in events){if(events[_0x45a2('0x6')](e)){var event=events[e];MailQueue[_0x45a2('0x7')](e,emitEvent(event));}}module[_0x45a2('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xb7f9=['hook','exports','setMaxListeners','save','update','remove','emit'];(function(_0x51a4cc,_0x254fa1){var _0x7c6a71=function(_0x53a557){while(--_0x53a557){_0x51a4cc['push'](_0x51a4cc['shift']());}};_0x7c6a71(++_0x254fa1);}(_0xb7f9,0x1d7));var _0x9b7f=function(_0x2d6faa,_0x442cd3){_0x2d6faa=_0x2d6faa-0x0;var _0x4f0bc0=_0xb7f9[_0x2d6faa];return _0x4f0bc0;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x9b7f('0x0')](0x0);var events={'afterCreate':_0x9b7f('0x1'),'afterUpdate':_0x9b7f('0x2'),'afterDestroy':_0x9b7f('0x3')};function emitEvent(_0x43d2e5){return function(_0x2806a5,_0x1e69c9,_0x3fd913){MailQueueEvents[_0x9b7f('0x4')](_0x43d2e5+':'+_0x2806a5['id'],_0x2806a5);MailQueueEvents[_0x9b7f('0x4')](_0x43d2e5,_0x2806a5);_0x3fd913(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x9b7f('0x5')](e,emitEvent(event));}}module[_0x9b7f('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 049ba58..d724337 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 _0x729a=['../../config/environment','./mailQueue.attributes','exports','define','MailQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x55cb9a,_0x2ff04d){var _0x2a0ff6=function(_0x213f51){while(--_0x213f51){_0x55cb9a['push'](_0x55cb9a['shift']());}};_0x2a0ff6(++_0x2ff04d);}(_0x729a,0xdd));var _0xa729=function(_0x185774,_0x58faf4){_0x185774=_0x185774-0x0;var _0x5cc850=_0x729a[_0x185774];return _0x5cc850;};'use strict';var _=require(_0xa729('0x0'));var util=require('util');var logger=require(_0xa729('0x1'))(_0xa729('0x2'));var moment=require(_0xa729('0x3'));var BPromise=require(_0xa729('0x4'));var rp=require(_0xa729('0x5'));var fs=require('fs');var path=require(_0xa729('0x6'));var rimraf=require('rimraf');var config=require(_0xa729('0x7'));var attributes=require(_0xa729('0x8'));module[_0xa729('0x9')]=function(_0x420c3e,_0x31106b){return _0x420c3e[_0xa729('0xa')](_0xa729('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf410=['lodash','util','api','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues'];(function(_0x91ae2,_0x43bbf5){var _0x9c07da=function(_0x236267){while(--_0x236267){_0x91ae2['push'](_0x91ae2['shift']());}};_0x9c07da(++_0x43bbf5);}(_0xf410,0x114));var _0x0f41=function(_0x519589,_0x159c12){_0x519589=_0x519589-0x0;var _0xde3587=_0xf410[_0x519589];return _0xde3587;};'use strict';var _=require(_0x0f41('0x0'));var util=require(_0x0f41('0x1'));var logger=require('../../config/logger')(_0x0f41('0x2'));var moment=require('moment');var BPromise=require(_0x0f41('0x3'));var rp=require(_0x0f41('0x4'));var fs=require('fs');var path=require(_0x0f41('0x5'));var rimraf=require('rimraf');var config=require(_0x0f41('0x6'));var attributes=require(_0x0f41('0x7'));module[_0x0f41('0x8')]=function(_0x4a7561,_0x2080fb){return _0x4a7561[_0x0f41('0x9')](_0x0f41('0xa'),attributes,{'tableName':_0x0f41('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 99388d8..84a597b 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 _0x921b=['defaults','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','catch','find','ShowMailQueue','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0xb27f65,_0x2d80df){var _0x555d61=function(_0x46343a){while(--_0x46343a){_0xb27f65['push'](_0xb27f65['shift']());}};_0x555d61(++_0x2d80df);}(_0x921b,0x10d));var _0xb921=function(_0x64881f,_0x4a0a77){_0x64881f=_0x64881f-0x0;var _0x310c21=_0x921b[_0x64881f];return _0x310c21;};'use strict';var _=require(_0xb921('0x0'));var util=require(_0xb921('0x1'));var moment=require(_0xb921('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb921('0x3'));var db=require(_0xb921('0x4'))['db'];var utils=require(_0xb921('0x5'));var logger=require(_0xb921('0x6'))(_0xb921('0x7'));var config=require(_0xb921('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb921('0x9')]['http']({'port':0x232a});config[_0xb921('0xa')]=_[_0xb921('0xb')](config[_0xb921('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb921('0xc'))(new Redis(config[_0xb921('0xa')]));require(_0xb921('0xd'))[_0xb921('0xe')](socket);function respondWithRpcPromise(_0x50e6d5,_0x22daf0,_0xd0e53b){return new BPromise(function(_0x127d1e,_0x3a763e){return client['request'](_0x50e6d5,_0xd0e53b)[_0xb921('0xf')](function(_0x31da4a){logger[_0xb921('0x10')](_0xb921('0x11'),_0x22daf0,_0xb921('0x12'));logger['debug'](_0xb921('0x13'),_0x22daf0,_0xb921('0x12'),JSON[_0xb921('0x14')](_0x31da4a));if(_0x31da4a[_0xb921('0x15')]){if(_0x31da4a[_0xb921('0x15')][_0xb921('0x16')]===0x1f4){logger[_0xb921('0x15')](_0xb921('0x11'),_0x22daf0,_0x31da4a[_0xb921('0x15')][_0xb921('0x17')]);return _0x3a763e(_0x31da4a[_0xb921('0x15')]['message']);}logger[_0xb921('0x15')](_0xb921('0x11'),_0x22daf0,_0x31da4a[_0xb921('0x15')][_0xb921('0x17')]);return _0x127d1e(_0x31da4a[_0xb921('0x15')][_0xb921('0x17')]);}else{logger[_0xb921('0x10')](_0xb921('0x11'),_0x22daf0,'request\x20sent');_0x127d1e(_0x31da4a[_0xb921('0x18')][_0xb921('0x17')]);}})['catch'](function(_0x4bee97){logger[_0xb921('0x15')](_0xb921('0x11'),_0x22daf0,_0x4bee97);_0x3a763e(_0x4bee97);});});}exports[_0xb921('0x19')]=function(_0x3319d8){var _0x20808e=this;return new Promise(function(_0x1a019a,_0x3f75f8){return db[_0xb921('0x1a')][_0xb921('0x1b')]({'raw':_0x3319d8[_0xb921('0x1c')]?_0x3319d8[_0xb921('0x1c')][_0xb921('0x1d')]===undefined?!![]:![]:!![],'where':_0x3319d8['options']?_0x3319d8[_0xb921('0x1c')][_0xb921('0x1e')]||null:null,'attributes':_0x3319d8[_0xb921('0x1c')]?_0x3319d8[_0xb921('0x1c')][_0xb921('0x1f')]||null:null,'limit':_0x3319d8['options']?_0x3319d8[_0xb921('0x1c')][_0xb921('0x20')]||null:null,'include':_0x3319d8['options']?_0x3319d8[_0xb921('0x1c')][_0xb921('0x21')]?_[_0xb921('0x22')](_0x3319d8['options'][_0xb921('0x21')],function(_0x57c45c){return{'model':db[_0x57c45c['model']],'as':_0x57c45c['as'],'attributes':_0x57c45c[_0xb921('0x1f')],'include':_0x57c45c['include']?_[_0xb921('0x22')](_0x57c45c[_0xb921('0x21')],function(_0x4eff7f){return{'model':db[_0x4eff7f[_0xb921('0x23')]],'as':_0x4eff7f['as'],'attributes':_0x4eff7f[_0xb921('0x1f')],'include':_0x4eff7f[_0xb921('0x21')]?_[_0xb921('0x22')](_0x4eff7f[_0xb921('0x21')],function(_0x392d65){return{'model':db[_0x392d65['model']],'as':_0x392d65['as'],'attributes':_0x392d65[_0xb921('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a34de){logger[_0xb921('0x10')]('GetMailQueue',_0x3319d8);logger[_0xb921('0x24')](_0xb921('0x19'),_0x3319d8,JSON[_0xb921('0x14')](_0x1a34de));_0x1a019a(_0x1a34de);})[_0xb921('0x25')](function(_0x54a2d8){logger[_0xb921('0x15')](_0xb921('0x19'),_0x54a2d8[_0xb921('0x17')],_0x3319d8);_0x3f75f8(_0x20808e['error'](0x1f4,_0x54a2d8[_0xb921('0x17')]));});});};exports['ShowMailQueue']=function(_0x4dcc30){var _0x49f53f=this;return new Promise(function(_0x570fed,_0x4918ae){return db['MailQueue'][_0xb921('0x26')]({'raw':_0x4dcc30['options']?_0x4dcc30['options'][_0xb921('0x1d')]===undefined?!![]:![]:!![],'where':_0x4dcc30['options']?_0x4dcc30[_0xb921('0x1c')]['where']||null:null,'attributes':_0x4dcc30['options']?_0x4dcc30['options'][_0xb921('0x1f')]||null:null,'include':_0x4dcc30[_0xb921('0x1c')]?_0x4dcc30[_0xb921('0x1c')][_0xb921('0x21')]?_[_0xb921('0x22')](_0x4dcc30['options'][_0xb921('0x21')],function(_0x57fbbb){return{'model':db[_0x57fbbb[_0xb921('0x23')]],'as':_0x57fbbb['as'],'attributes':_0x57fbbb[_0xb921('0x1f')],'include':_0x57fbbb[_0xb921('0x21')]?_[_0xb921('0x22')](_0x57fbbb[_0xb921('0x21')],function(_0xa5402c){return{'model':db[_0xa5402c[_0xb921('0x23')]],'as':_0xa5402c['as'],'attributes':_0xa5402c['attributes'],'include':_0xa5402c['include']?_[_0xb921('0x22')](_0xa5402c[_0xb921('0x21')],function(_0x8878bf){return{'model':db[_0x8878bf[_0xb921('0x23')]],'as':_0x8878bf['as'],'attributes':_0x8878bf['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2778ce){logger[_0xb921('0x10')](_0xb921('0x27'),_0x4dcc30);logger[_0xb921('0x24')](_0xb921('0x27'),_0x4dcc30,JSON[_0xb921('0x14')](_0x2778ce));_0x570fed(_0x2778ce);})[_0xb921('0x25')](function(_0x25c05d){logger['error'](_0xb921('0x27'),_0x25c05d[_0xb921('0x17')],_0x4dcc30);_0x4918ae(_0x49f53f['error'](0x1f4,_0x25c05d['message']));});});}; \ No newline at end of file +var _0x2035=['map','model','debug','stringify','ShowMailQueue','MailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetMailQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x2d92e2,_0x5815d0){var _0x30892f=function(_0x4e2ccd){while(--_0x4e2ccd){_0x2d92e2['push'](_0x2d92e2['shift']());}};_0x30892f(++_0x5815d0);}(_0x2035,0xb2));var _0x5203=function(_0x2073a8,_0x141825){_0x2073a8=_0x2073a8-0x0;var _0x11044a=_0x2035[_0x2073a8];return _0x11044a;};'use strict';var _=require(_0x5203('0x0'));var util=require(_0x5203('0x1'));var moment=require(_0x5203('0x2'));var BPromise=require(_0x5203('0x3'));var rs=require(_0x5203('0x4'));var fs=require('fs');var Redis=require(_0x5203('0x5'));var db=require(_0x5203('0x6'))['db'];var utils=require(_0x5203('0x7'));var logger=require(_0x5203('0x8'))(_0x5203('0x9'));var config=require(_0x5203('0xa'));var jayson=require(_0x5203('0xb'));var client=jayson[_0x5203('0xc')][_0x5203('0xd')]({'port':0x232a});config[_0x5203('0xe')]=_[_0x5203('0xf')](config['redis'],{'host':_0x5203('0x10'),'port':0x18eb});var socket=require(_0x5203('0x11'))(new Redis(config['redis']));require(_0x5203('0x12'))['register'](socket);function respondWithRpcPromise(_0x32cb14,_0x4e4bf8,_0x43dca6){return new BPromise(function(_0x58b1c0,_0x39a144){return client[_0x5203('0x13')](_0x32cb14,_0x43dca6)[_0x5203('0x14')](function(_0x67f3a4){logger[_0x5203('0x15')](_0x5203('0x16'),_0x4e4bf8,'request\x20sent');logger['debug'](_0x5203('0x17'),_0x4e4bf8,_0x5203('0x18'),JSON['stringify'](_0x67f3a4));if(_0x67f3a4[_0x5203('0x19')]){if(_0x67f3a4[_0x5203('0x19')]['code']===0x1f4){logger['error'](_0x5203('0x16'),_0x4e4bf8,_0x67f3a4[_0x5203('0x19')][_0x5203('0x1a')]);return _0x39a144(_0x67f3a4[_0x5203('0x19')][_0x5203('0x1a')]);}logger[_0x5203('0x19')]('MailQueue,\x20%s,\x20%s',_0x4e4bf8,_0x67f3a4[_0x5203('0x19')]['message']);return _0x58b1c0(_0x67f3a4['error'][_0x5203('0x1a')]);}else{logger[_0x5203('0x15')]('MailQueue,\x20%s,\x20%s',_0x4e4bf8,_0x5203('0x18'));_0x58b1c0(_0x67f3a4[_0x5203('0x1b')][_0x5203('0x1a')]);}})[_0x5203('0x1c')](function(_0x3fe21f){logger[_0x5203('0x19')]('MailQueue,\x20%s,\x20%s',_0x4e4bf8,_0x3fe21f);_0x39a144(_0x3fe21f);});});}exports[_0x5203('0x1d')]=function(_0x5a4ddc){var _0x5bd4cc=this;return new Promise(function(_0x4538bb,_0x542416){return db['MailQueue'][_0x5203('0x1e')]({'raw':_0x5a4ddc[_0x5203('0x1f')]?_0x5a4ddc['options'][_0x5203('0x20')]===undefined?!![]:![]:!![],'where':_0x5a4ddc[_0x5203('0x1f')]?_0x5a4ddc[_0x5203('0x1f')][_0x5203('0x21')]||null:null,'attributes':_0x5a4ddc[_0x5203('0x1f')]?_0x5a4ddc['options'][_0x5203('0x22')]||null:null,'limit':_0x5a4ddc['options']?_0x5a4ddc[_0x5203('0x1f')][_0x5203('0x23')]||null:null,'include':_0x5a4ddc['options']?_0x5a4ddc['options'][_0x5203('0x24')]?_[_0x5203('0x25')](_0x5a4ddc[_0x5203('0x1f')]['include'],function(_0x165f69){return{'model':db[_0x165f69[_0x5203('0x26')]],'as':_0x165f69['as'],'attributes':_0x165f69[_0x5203('0x22')],'include':_0x165f69[_0x5203('0x24')]?_['map'](_0x165f69['include'],function(_0x42c4d4){return{'model':db[_0x42c4d4[_0x5203('0x26')]],'as':_0x42c4d4['as'],'attributes':_0x42c4d4[_0x5203('0x22')],'include':_0x42c4d4[_0x5203('0x24')]?_[_0x5203('0x25')](_0x42c4d4[_0x5203('0x24')],function(_0x295a20){return{'model':db[_0x295a20['model']],'as':_0x295a20['as'],'attributes':_0x295a20['attributes']};}):[]};}):[]};}):[]:[]})[_0x5203('0x14')](function(_0x53c911){logger[_0x5203('0x15')](_0x5203('0x1d'),_0x5a4ddc);logger[_0x5203('0x27')](_0x5203('0x1d'),_0x5a4ddc,JSON[_0x5203('0x28')](_0x53c911));_0x4538bb(_0x53c911);})[_0x5203('0x1c')](function(_0x1c37b4){logger['error'](_0x5203('0x1d'),_0x1c37b4['message'],_0x5a4ddc);_0x542416(_0x5bd4cc[_0x5203('0x19')](0x1f4,_0x1c37b4['message']));});});};exports[_0x5203('0x29')]=function(_0x429166){var _0x31d4d2=this;return new Promise(function(_0x5dfc66,_0x33bd29){return db[_0x5203('0x2a')]['find']({'raw':_0x429166['options']?_0x429166['options'][_0x5203('0x20')]===undefined?!![]:![]:!![],'where':_0x429166[_0x5203('0x1f')]?_0x429166[_0x5203('0x1f')]['where']||null:null,'attributes':_0x429166['options']?_0x429166[_0x5203('0x1f')][_0x5203('0x22')]||null:null,'include':_0x429166[_0x5203('0x1f')]?_0x429166[_0x5203('0x1f')][_0x5203('0x24')]?_[_0x5203('0x25')](_0x429166[_0x5203('0x1f')]['include'],function(_0x37c7de){return{'model':db[_0x37c7de[_0x5203('0x26')]],'as':_0x37c7de['as'],'attributes':_0x37c7de[_0x5203('0x22')],'include':_0x37c7de[_0x5203('0x24')]?_[_0x5203('0x25')](_0x37c7de[_0x5203('0x24')],function(_0x51a4f0){return{'model':db[_0x51a4f0[_0x5203('0x26')]],'as':_0x51a4f0['as'],'attributes':_0x51a4f0[_0x5203('0x22')],'include':_0x51a4f0['include']?_[_0x5203('0x25')](_0x51a4f0['include'],function(_0x48acef){return{'model':db[_0x48acef[_0x5203('0x26')]],'as':_0x48acef['as'],'attributes':_0x48acef[_0x5203('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5203('0x14')](function(_0x734262){logger[_0x5203('0x15')](_0x5203('0x29'),_0x429166);logger[_0x5203('0x27')](_0x5203('0x29'),_0x429166,JSON['stringify'](_0x734262));_0x5dfc66(_0x734262);})[_0x5203('0x1c')](function(_0x125298){logger['error']('ShowMailQueue',_0x125298[_0x5203('0x1a')],_0x429166);_0x33bd29(_0x31d4d2['error'](0x1f4,_0x125298[_0x5203('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 82720e7..7314a15 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 _0x7c93=['register','length','mailQueue:','save','update','emit','removeListener'];(function(_0x227c9b,_0x34d983){var _0x37f247=function(_0x1adc5a){while(--_0x1adc5a){_0x227c9b['push'](_0x227c9b['shift']());}};_0x37f247(++_0x34d983);}(_0x7c93,0xb9));var _0x37c9=function(_0x5d2a37,_0x3bd1d4){_0x5d2a37=_0x5d2a37-0x0;var _0xb8370=_0x7c93[_0x5d2a37];return _0xb8370;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x37c9('0x0'),'remove',_0x37c9('0x1')];function createListener(_0x476086,_0x5230d0){return function(_0x12ae04){_0x5230d0[_0x37c9('0x2')](_0x476086,_0x12ae04);};}function removeListener(_0x3bbccf,_0x884652){return function(){MailQueueEvents[_0x37c9('0x3')](_0x3bbccf,_0x884652);};}exports[_0x37c9('0x4')]=function(_0x6b62ea){for(var _0x298fd5=0x0,_0x59313a=events[_0x37c9('0x5')];_0x298fd5<_0x59313a;_0x298fd5++){var _0x518549=events[_0x298fd5];var _0x58d3c3=createListener(_0x37c9('0x6')+_0x518549,_0x6b62ea);MailQueueEvents['on'](_0x518549,_0x58d3c3);}}; \ No newline at end of file +var _0xcd2c=['./mailQueue.events','save','remove','update','emit','removeListener','register','length','mailQueue:'];(function(_0x4e1daf,_0x5166c7){var _0x553bbd=function(_0x5e1e6d){while(--_0x5e1e6d){_0x4e1daf['push'](_0x4e1daf['shift']());}};_0x553bbd(++_0x5166c7);}(_0xcd2c,0x195));var _0xccd2=function(_0x17d621,_0x1cc002){_0x17d621=_0x17d621-0x0;var _0x2ccdcd=_0xcd2c[_0x17d621];return _0x2ccdcd;};'use strict';var MailQueueEvents=require(_0xccd2('0x0'));var events=[_0xccd2('0x1'),_0xccd2('0x2'),_0xccd2('0x3')];function createListener(_0x52a9e5,_0xb3ee9c){return function(_0x5379a4){_0xb3ee9c[_0xccd2('0x4')](_0x52a9e5,_0x5379a4);};}function removeListener(_0x2b208,_0x410d85){return function(){MailQueueEvents[_0xccd2('0x5')](_0x2b208,_0x410d85);};}exports[_0xccd2('0x6')]=function(_0x182eae){for(var _0x40999d=0x0,_0x1a1fec=events[_0xccd2('0x7')];_0x40999d<_0x1a1fec;_0x40999d++){var _0x2fbd19=events[_0x40999d];var _0x4b2ac2=createListener(_0xccd2('0x8')+_0x2fbd19,_0x182eae);MailQueueEvents['on'](_0x2fbd19,_0x4b2ac2);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index fea0c8e..93d9caa 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 _0xe84e=['fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x2663bb,_0x5d9e73){var _0xf55ba9=function(_0x220115){while(--_0x220115){_0x2663bb['push'](_0x2663bb['shift']());}};_0xf55ba9(++_0x5d9e73);}(_0xe84e,0x19e));var _0xee84=function(_0x572165,_0x6a45cc){_0x572165=_0x572165-0x0;var _0x8c8709=_0xe84e[_0x572165];return _0x8c8709;};'use strict';var multer=require(_0xee84('0x0'));var util=require('util');var path=require(_0xee84('0x1'));var timeout=require('connect-timeout');var express=require(_0xee84('0x2'));var router=express[_0xee84('0x3')]();var fs_extra=require(_0xee84('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xee84('0x5'));var config=require(_0xee84('0x6'));var controller=require(_0xee84('0x7'));router[_0xee84('0x8')]('/',auth[_0xee84('0x9')](),controller[_0xee84('0xa')]);router['get']('/describe',auth[_0xee84('0x9')](),controller['describe']);router[_0xee84('0x8')](_0xee84('0xb'),auth['isAuthenticated'](),controller[_0xee84('0xc')]);router[_0xee84('0xd')]('/',auth[_0xee84('0x9')](),controller[_0xee84('0xe')]);router['put'](_0xee84('0xb'),auth[_0xee84('0x9')](),controller[_0xee84('0xf')]);router[_0xee84('0x10')](_0xee84('0xb'),auth[_0xee84('0x9')](),controller[_0xee84('0x11')]);module[_0xee84('0x12')]=router; \ No newline at end of file +var _0x4163=['./mailQueueReport.controller','get','describe','/:id','post','create','put','update','isAuthenticated','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0x4163,0x1e6));var _0x3416=function(_0x5a7f64,_0x347d57){_0x5a7f64=_0x5a7f64-0x0;var _0x3d30f1=_0x4163[_0x5a7f64];return _0x3d30f1;};'use strict';var multer=require('multer');var util=require(_0x3416('0x0'));var path=require('path');var timeout=require(_0x3416('0x1'));var express=require(_0x3416('0x2'));var router=express[_0x3416('0x3')]();var fs_extra=require(_0x3416('0x4'));var auth=require(_0x3416('0x5'));var interaction=require(_0x3416('0x6'));var config=require('../../config/environment');var controller=require(_0x3416('0x7'));router[_0x3416('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x3416('0x9')]);router['get'](_0x3416('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x3416('0xb')]('/',auth['isAuthenticated'](),controller[_0x3416('0xc')]);router[_0x3416('0xd')](_0x3416('0xa'),auth['isAuthenticated'](),controller[_0x3416('0xe')]);router['delete'](_0x3416('0xa'),auth[_0x3416('0xf')](),controller['destroy']);module[_0x3416('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 3e908e0..e79c0b7 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 _0x24dc=['STRING','DATE','exports'];(function(_0x3b6648,_0x2d723a){var _0x5a0a0d=function(_0x133dea){while(--_0x133dea){_0x3b6648['push'](_0x3b6648['shift']());}};_0x5a0a0d(++_0x2d723a);}(_0x24dc,0x65));var _0xc24d=function(_0x154932,_0x5ab719){_0x154932=_0x154932-0x0;var _0x3805f5=_0x24dc[_0x154932];return _0x3805f5;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xc24d('0x0')]={'uniqueid':{'type':Sequelize[_0xc24d('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xc24d('0x1')]},'joinAt':{'type':Sequelize[_0xc24d('0x2')]},'leaveAt':{'type':Sequelize[_0xc24d('0x2')]},'acceptAt':{'type':Sequelize[_0xc24d('0x2')]},'exitAt':{'type':Sequelize[_0xc24d('0x2')]},'reason':{'type':Sequelize[_0xc24d('0x1')]}}; \ No newline at end of file +var _0x3baf=['STRING','DATE','moment','sequelize','exports'];(function(_0x449678,_0x288abd){var _0x58ef92=function(_0x58694c){while(--_0x58694c){_0x449678['push'](_0x449678['shift']());}};_0x58ef92(++_0x288abd);}(_0x3baf,0xf7));var _0xf3ba=function(_0x4d9d4e,_0x23d33f){_0x4d9d4e=_0x4d9d4e-0x0;var _0x57238c=_0x3baf[_0x4d9d4e];return _0x57238c;};'use strict';var moment=require(_0xf3ba('0x0'));var Sequelize=require(_0xf3ba('0x1'));module[_0xf3ba('0x2')]={'uniqueid':{'type':Sequelize[_0xf3ba('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xf3ba('0x3')]},'joinAt':{'type':Sequelize[_0xf3ba('0x4')]},'leaveAt':{'type':Sequelize[_0xf3ba('0x4')]},'acceptAt':{'type':Sequelize[_0xf3ba('0x4')]},'exitAt':{'type':Sequelize[_0xf3ba('0x4')]},'reason':{'type':Sequelize[_0xf3ba('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 0b535e6..481a098 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 _0x955f=['reject','update','then','destroy','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply'];(function(_0x21f12f,_0x1f6338){var _0x523409=function(_0x16cdc3){while(--_0x16cdc3){_0x21f12f['push'](_0x21f12f['shift']());}};_0x523409(++_0x1f6338);}(_0x955f,0x1eb));var _0xf955=function(_0x2a649c,_0x3cb7e0){_0x2a649c=_0x2a649c-0x0;var _0x924b83=_0x955f[_0x2a649c];return _0x924b83;};'use strict';var emlformat=require(_0xf955('0x0'));var rimraf=require(_0xf955('0x1'));var zipdir=require(_0xf955('0x2'));var jsonpatch=require(_0xf955('0x3'));var rp=require(_0xf955('0x4'));var moment=require('moment');var BPromise=require(_0xf955('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf955('0x6'));var sox=require('sox');var csv=require(_0xf955('0x7'));var ejs=require(_0xf955('0x8'));var fs=require('fs');var fs_extra=require(_0xf955('0x9'));var _=require('lodash');var squel=require(_0xf955('0xa'));var crypto=require(_0xf955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf955('0xc'));var toCsv=require(_0xf955('0x7'));var querystring=require(_0xf955('0xd'));var Papa=require(_0xf955('0xe'));var Redis=require(_0xf955('0xf'));var authService=require(_0xf955('0x10'));var qs=require(_0xf955('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf955('0x12'));var logger=require('../../config/logger')(_0xf955('0x13'));var utils=require(_0xf955('0x14'));var config=require(_0xf955('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf955('0x16'))['db'];function respondWithStatusCode(_0x542347,_0x23e0c6){_0x23e0c6=_0x23e0c6||0xcc;return function(_0x50d9a9){if(_0x50d9a9){return _0x542347[_0xf955('0x17')](_0x23e0c6);}return _0x542347[_0xf955('0x18')](_0x23e0c6)[_0xf955('0x19')]();};}function respondWithResult(_0x109bc5,_0x2080c4){_0x2080c4=_0x2080c4||0xc8;return function(_0x341b8c){if(_0x341b8c){return _0x109bc5[_0xf955('0x18')](_0x2080c4)[_0xf955('0x1a')](_0x341b8c);}};}function respondWithFilteredResult(_0x3c6af7,_0x24e75c){return function(_0x5350e4){if(_0x5350e4){var _0xc29b35=typeof _0x24e75c['offset']===_0xf955('0x1b')&&typeof _0x24e75c[_0xf955('0x1c')]===_0xf955('0x1b');var _0x15c07c=_0x5350e4['count'];var _0x5ac6cb=_0xc29b35?0x0:_0x24e75c[_0xf955('0x1d')];var _0xe6de5c=_0xc29b35?_0x5350e4[_0xf955('0x1e')]:_0x24e75c['offset']+_0x24e75c[_0xf955('0x1c')];var _0x3576fa;if(_0xe6de5c>=_0x15c07c){_0xe6de5c=_0x15c07c;_0x3576fa=0xc8;}else{_0x3576fa=0xce;}_0x3c6af7[_0xf955('0x18')](_0x3576fa);return _0x3c6af7[_0xf955('0x1f')](_0xf955('0x20'),_0x5ac6cb+'-'+_0xe6de5c+'/'+_0x15c07c)['json'](_0x5350e4);}return null;};}function patchUpdates(_0x17d86a){return function(_0x3dbbe8){try{jsonpatch[_0xf955('0x21')](_0x3dbbe8,_0x17d86a,!![]);}catch(_0x488d04){return BPromise[_0xf955('0x22')](_0x488d04);}return _0x3dbbe8['save']();};}function saveUpdates(_0x21ae24,_0x43b078){return function(_0x37143d){if(_0x37143d){return _0x37143d[_0xf955('0x23')](_0x21ae24)[_0xf955('0x24')](function(_0x565641){return _0x565641;});}return null;};}function removeEntity(_0x25f4f2,_0x5fab1c){return function(_0x3585c7){if(_0x3585c7){return _0x3585c7[_0xf955('0x25')]()[_0xf955('0x24')](function(){_0x25f4f2[_0xf955('0x18')](0xcc)[_0xf955('0x19')]();});}};}function handleEntityNotFound(_0x552cf3,_0x18f435){return function(_0x1acf33){if(!_0x1acf33){_0x552cf3[_0xf955('0x17')](0x194);}return _0x1acf33;};}function handleError(_0x406632,_0x2dcd55){_0x2dcd55=_0x2dcd55||0x1f4;return function(_0x13a86d){logger[_0xf955('0x26')](_0x13a86d['stack']);if(_0x13a86d[_0xf955('0x27')]){delete _0x13a86d[_0xf955('0x27')];}_0x406632[_0xf955('0x18')](_0x2dcd55)[_0xf955('0x28')](_0x13a86d);};}exports[_0xf955('0x29')]=function(_0x264f6d,_0x4d4af0){var _0x2232a7={},_0x1e5d37={},_0x4ec3e8={'count':0x0,'rows':[]};var _0x256df5=_[_0xf955('0x2a')](db[_0xf955('0x2b')][_0xf955('0x2c')],function(_0x59bfb5){return{'name':_0x59bfb5[_0xf955('0x2d')],'type':_0x59bfb5['type'][_0xf955('0x2e')]};});_0x1e5d37[_0xf955('0x2f')]=_[_0xf955('0x2a')](_0x256df5,_0xf955('0x27'));_0x1e5d37[_0xf955('0x30')]=_[_0xf955('0x31')](_0x264f6d[_0xf955('0x30')]);_0x1e5d37[_0xf955('0x32')]=_['intersection'](_0x1e5d37[_0xf955('0x2f')],_0x1e5d37[_0xf955('0x30')]);_0x2232a7[_0xf955('0x33')]=_[_0xf955('0x34')](_0x1e5d37['model'],qs[_0xf955('0x35')](_0x264f6d[_0xf955('0x30')][_0xf955('0x35')]));_0x2232a7[_0xf955('0x33')]=_0x2232a7[_0xf955('0x33')]['length']?_0x2232a7['attributes']:_0x1e5d37['model'];if(!_0x264f6d[_0xf955('0x30')][_0xf955('0x36')](_0xf955('0x37'))){_0x2232a7[_0xf955('0x1c')]=qs[_0xf955('0x1c')](_0x264f6d[_0xf955('0x30')]['limit']);_0x2232a7[_0xf955('0x1d')]=qs['offset'](_0x264f6d[_0xf955('0x30')][_0xf955('0x1d')]);}_0x2232a7[_0xf955('0x38')]=qs['sort'](_0x264f6d[_0xf955('0x30')]['sort']);_0x2232a7[_0xf955('0x39')]=qs[_0xf955('0x32')](_[_0xf955('0x3a')](_0x264f6d[_0xf955('0x30')],_0x1e5d37['filters']),_0x256df5);if(_0x264f6d[_0xf955('0x30')][_0xf955('0x3b')]){_0x2232a7['where']=_[_0xf955('0x3c')](_0x2232a7[_0xf955('0x39')],{'$or':_[_0xf955('0x2a')](_0x256df5,function(_0x547ed9){if(_0x547ed9[_0xf955('0x3d')]!==_0xf955('0x3e')){var _0x11b7e2={};_0x11b7e2[_0x547ed9['name']]={'$like':'%'+_0x264f6d[_0xf955('0x30')][_0xf955('0x3b')]+'%'};return _0x11b7e2;}})});}_0x2232a7=_[_0xf955('0x3c')]({},_0x2232a7,_0x264f6d[_0xf955('0x3f')]);var _0x2bfbe4={'where':_0x2232a7[_0xf955('0x39')]};return db[_0xf955('0x2b')][_0xf955('0x1e')](_0x2bfbe4)['then'](function(_0x8fa41b){_0x4ec3e8[_0xf955('0x1e')]=_0x8fa41b;if(_0x264f6d[_0xf955('0x30')][_0xf955('0x40')]){_0x2232a7[_0xf955('0x41')]=[{'all':!![]}];}return db[_0xf955('0x2b')][_0xf955('0x42')](_0x2232a7);})[_0xf955('0x24')](function(_0x47651b){_0x4ec3e8[_0xf955('0x43')]=_0x47651b;return _0x4ec3e8;})[_0xf955('0x24')](respondWithFilteredResult(_0x4d4af0,_0x2232a7))[_0xf955('0x44')](handleError(_0x4d4af0,null));};exports[_0xf955('0x45')]=function(_0x159ae3,_0x3557b5){var _0x248f60={'raw':!![],'where':{'id':_0x159ae3[_0xf955('0x46')]['id']}},_0x356ec2={};_0x356ec2[_0xf955('0x2f')]=_['keys'](db[_0xf955('0x2b')][_0xf955('0x2c')]);_0x356ec2[_0xf955('0x30')]=_['keys'](_0x159ae3[_0xf955('0x30')]);_0x356ec2['filters']=_[_0xf955('0x34')](_0x356ec2['model'],_0x356ec2[_0xf955('0x30')]);_0x248f60[_0xf955('0x33')]=_[_0xf955('0x34')](_0x356ec2[_0xf955('0x2f')],qs['fields'](_0x159ae3[_0xf955('0x30')][_0xf955('0x35')]));_0x248f60[_0xf955('0x33')]=_0x248f60['attributes']['length']?_0x248f60[_0xf955('0x33')]:_0x356ec2[_0xf955('0x2f')];if(_0x159ae3[_0xf955('0x30')][_0xf955('0x40')]){_0x248f60['include']=[{'all':!![]}];}_0x248f60=_[_0xf955('0x3c')]({},_0x248f60,_0x159ae3[_0xf955('0x3f')]);return db[_0xf955('0x2b')]['find'](_0x248f60)[_0xf955('0x24')](handleEntityNotFound(_0x3557b5,null))['then'](respondWithResult(_0x3557b5,null))[_0xf955('0x44')](handleError(_0x3557b5,null));};exports[_0xf955('0x47')]=function(_0x2c867f,_0x4dd592){return db[_0xf955('0x2b')][_0xf955('0x47')](_0x2c867f[_0xf955('0x48')],{})[_0xf955('0x24')](respondWithResult(_0x4dd592,0xc9))['catch'](handleError(_0x4dd592,null));};exports[_0xf955('0x23')]=function(_0x4ff0f1,_0x1c6d76){if(_0x4ff0f1[_0xf955('0x48')]['id']){delete _0x4ff0f1[_0xf955('0x48')]['id'];}return db['MailQueueReport'][_0xf955('0x49')]({'where':{'id':_0x4ff0f1['params']['id']}})[_0xf955('0x24')](handleEntityNotFound(_0x1c6d76,null))['then'](saveUpdates(_0x4ff0f1[_0xf955('0x48')],null))['then'](respondWithResult(_0x1c6d76,null))['catch'](handleError(_0x1c6d76,null));};exports[_0xf955('0x25')]=function(_0x45c7fe,_0x4961cc){return db[_0xf955('0x2b')]['find']({'where':{'id':_0x45c7fe['params']['id']}})['then'](handleEntityNotFound(_0x4961cc,null))['then'](removeEntity(_0x4961cc,null))[_0xf955('0x44')](handleError(_0x4961cc,null));};exports[_0xf955('0x4a')]=function(_0x4a7aee,_0x4c4b6d){return db[_0xf955('0x2b')][_0xf955('0x4a')]()[_0xf955('0x24')](respondWithResult(_0x4c4b6d,null))[_0xf955('0x44')](handleError(_0x4c4b6d,null));}; \ No newline at end of file +var _0x6d11=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','reject','then','destroy','stack','name','send','index','map','MailQueueReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','length','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','show','params','fields','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6d11,0xbf));var _0x16d1=function(_0x2ce189,_0x170d30){_0x2ce189=_0x2ce189-0x0;var _0x4744ef=_0x6d11[_0x2ce189];return _0x4744ef;};'use strict';var emlformat=require(_0x16d1('0x0'));var rimraf=require(_0x16d1('0x1'));var zipdir=require(_0x16d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16d1('0x3'));var moment=require('moment');var BPromise=require(_0x16d1('0x4'));var Mustache=require(_0x16d1('0x5'));var util=require('util');var path=require('path');var sox=require(_0x16d1('0x6'));var csv=require(_0x16d1('0x7'));var ejs=require(_0x16d1('0x8'));var fs=require('fs');var fs_extra=require(_0x16d1('0x9'));var _=require(_0x16d1('0xa'));var squel=require(_0x16d1('0xb'));var crypto=require(_0x16d1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x16d1('0xd'));var Papa=require(_0x16d1('0xe'));var Redis=require(_0x16d1('0xf'));var authService=require(_0x16d1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x16d1('0x11'));var hardwareService=require(_0x16d1('0x12'));var logger=require(_0x16d1('0x13'))(_0x16d1('0x14'));var utils=require(_0x16d1('0x15'));var config=require(_0x16d1('0x16'));var licenseUtil=require(_0x16d1('0x17'));var db=require(_0x16d1('0x18'))['db'];function respondWithStatusCode(_0x4de260,_0x32fa68){_0x32fa68=_0x32fa68||0xcc;return function(_0x2e71fa){if(_0x2e71fa){return _0x4de260[_0x16d1('0x19')](_0x32fa68);}return _0x4de260[_0x16d1('0x1a')](_0x32fa68)[_0x16d1('0x1b')]();};}function respondWithResult(_0x5a1429,_0xc034b7){_0xc034b7=_0xc034b7||0xc8;return function(_0x1b71d3){if(_0x1b71d3){return _0x5a1429[_0x16d1('0x1a')](_0xc034b7)[_0x16d1('0x1c')](_0x1b71d3);}};}function respondWithFilteredResult(_0x29ebba,_0x173e16){return function(_0x2d7e8a){if(_0x2d7e8a){var _0x4ee46c=typeof _0x173e16[_0x16d1('0x1d')]===_0x16d1('0x1e')&&typeof _0x173e16['limit']==='undefined';var _0x1a9ec8=_0x2d7e8a['count'];var _0x46a25e=_0x4ee46c?0x0:_0x173e16['offset'];var _0x1da1b8=_0x4ee46c?_0x2d7e8a['count']:_0x173e16[_0x16d1('0x1d')]+_0x173e16[_0x16d1('0x1f')];var _0x48cd70;if(_0x1da1b8>=_0x1a9ec8){_0x1da1b8=_0x1a9ec8;_0x48cd70=0xc8;}else{_0x48cd70=0xce;}_0x29ebba['status'](_0x48cd70);return _0x29ebba['set']('Content-Range',_0x46a25e+'-'+_0x1da1b8+'/'+_0x1a9ec8)[_0x16d1('0x1c')](_0x2d7e8a);}return null;};}function patchUpdates(_0x55a0e0){return function(_0x34b88f){try{jsonpatch[_0x16d1('0x20')](_0x34b88f,_0x55a0e0,!![]);}catch(_0x1f6add){return BPromise[_0x16d1('0x21')](_0x1f6add);}return _0x34b88f['save']();};}function saveUpdates(_0x2c7825,_0x58a03b){return function(_0x2a897d){if(_0x2a897d){return _0x2a897d['update'](_0x2c7825)[_0x16d1('0x22')](function(_0x8c7266){return _0x8c7266;});}return null;};}function removeEntity(_0x17e038,_0x47cad4){return function(_0x215c23){if(_0x215c23){return _0x215c23[_0x16d1('0x23')]()[_0x16d1('0x22')](function(){_0x17e038[_0x16d1('0x1a')](0xcc)[_0x16d1('0x1b')]();});}};}function handleEntityNotFound(_0x335c24,_0x4b2b5c){return function(_0x15203b){if(!_0x15203b){_0x335c24[_0x16d1('0x19')](0x194);}return _0x15203b;};}function handleError(_0x262f89,_0x346b69){_0x346b69=_0x346b69||0x1f4;return function(_0x2b8403){logger['error'](_0x2b8403[_0x16d1('0x24')]);if(_0x2b8403[_0x16d1('0x25')]){delete _0x2b8403[_0x16d1('0x25')];}_0x262f89['status'](_0x346b69)[_0x16d1('0x26')](_0x2b8403);};}exports[_0x16d1('0x27')]=function(_0x364bf7,_0x22e5b3){var _0x6396fc={},_0x462e5b={},_0x1dd574={'count':0x0,'rows':[]};var _0x562908=_[_0x16d1('0x28')](db[_0x16d1('0x29')][_0x16d1('0x2a')],function(_0x30cd8f){return{'name':_0x30cd8f['fieldName'],'type':_0x30cd8f['type'][_0x16d1('0x2b')]};});_0x462e5b[_0x16d1('0x2c')]=_[_0x16d1('0x28')](_0x562908,_0x16d1('0x25'));_0x462e5b[_0x16d1('0x2d')]=_[_0x16d1('0x2e')](_0x364bf7[_0x16d1('0x2d')]);_0x462e5b[_0x16d1('0x2f')]=_[_0x16d1('0x30')](_0x462e5b[_0x16d1('0x2c')],_0x462e5b[_0x16d1('0x2d')]);_0x6396fc[_0x16d1('0x31')]=_[_0x16d1('0x30')](_0x462e5b[_0x16d1('0x2c')],qs['fields'](_0x364bf7[_0x16d1('0x2d')]['fields']));_0x6396fc[_0x16d1('0x31')]=_0x6396fc[_0x16d1('0x31')][_0x16d1('0x32')]?_0x6396fc[_0x16d1('0x31')]:_0x462e5b[_0x16d1('0x2c')];if(!_0x364bf7[_0x16d1('0x2d')]['hasOwnProperty']('nolimit')){_0x6396fc['limit']=qs[_0x16d1('0x1f')](_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x1f')]);_0x6396fc[_0x16d1('0x1d')]=qs['offset'](_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x1d')]);}_0x6396fc['order']=qs['sort'](_0x364bf7['query'][_0x16d1('0x33')]);_0x6396fc[_0x16d1('0x34')]=qs[_0x16d1('0x2f')](_['pick'](_0x364bf7[_0x16d1('0x2d')],_0x462e5b[_0x16d1('0x2f')]),_0x562908);if(_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x35')]){_0x6396fc[_0x16d1('0x34')]=_[_0x16d1('0x36')](_0x6396fc[_0x16d1('0x34')],{'$or':_['map'](_0x562908,function(_0x50267b){if(_0x50267b['type']!==_0x16d1('0x37')){var _0x2306d3={};_0x2306d3[_0x50267b[_0x16d1('0x25')]]={'$like':'%'+_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x35')]+'%'};return _0x2306d3;}})});}_0x6396fc=_[_0x16d1('0x36')]({},_0x6396fc,_0x364bf7[_0x16d1('0x38')]);var _0x369b1c={'where':_0x6396fc['where']};return db[_0x16d1('0x29')]['count'](_0x369b1c)['then'](function(_0x352c5b){_0x1dd574[_0x16d1('0x39')]=_0x352c5b;if(_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x3a')]){_0x6396fc[_0x16d1('0x3b')]=[{'all':!![]}];}return db[_0x16d1('0x29')]['findAll'](_0x6396fc);})[_0x16d1('0x22')](function(_0x525212){_0x1dd574['rows']=_0x525212;return _0x1dd574;})['then'](respondWithFilteredResult(_0x22e5b3,_0x6396fc))['catch'](handleError(_0x22e5b3,null));};exports[_0x16d1('0x3c')]=function(_0x168e14,_0x24038b){var _0x1eb761={'raw':!![],'where':{'id':_0x168e14[_0x16d1('0x3d')]['id']}},_0x53de06={};_0x53de06['model']=_[_0x16d1('0x2e')](db[_0x16d1('0x29')][_0x16d1('0x2a')]);_0x53de06[_0x16d1('0x2d')]=_[_0x16d1('0x2e')](_0x168e14[_0x16d1('0x2d')]);_0x53de06[_0x16d1('0x2f')]=_[_0x16d1('0x30')](_0x53de06[_0x16d1('0x2c')],_0x53de06[_0x16d1('0x2d')]);_0x1eb761[_0x16d1('0x31')]=_[_0x16d1('0x30')](_0x53de06[_0x16d1('0x2c')],qs[_0x16d1('0x3e')](_0x168e14[_0x16d1('0x2d')]['fields']));_0x1eb761['attributes']=_0x1eb761[_0x16d1('0x31')][_0x16d1('0x32')]?_0x1eb761[_0x16d1('0x31')]:_0x53de06[_0x16d1('0x2c')];if(_0x168e14[_0x16d1('0x2d')][_0x16d1('0x3a')]){_0x1eb761['include']=[{'all':!![]}];}_0x1eb761=_[_0x16d1('0x36')]({},_0x1eb761,_0x168e14[_0x16d1('0x38')]);return db[_0x16d1('0x29')]['find'](_0x1eb761)['then'](handleEntityNotFound(_0x24038b,null))[_0x16d1('0x22')](respondWithResult(_0x24038b,null))[_0x16d1('0x3f')](handleError(_0x24038b,null));};exports['create']=function(_0x1cc137,_0x583151){return db[_0x16d1('0x29')][_0x16d1('0x40')](_0x1cc137[_0x16d1('0x41')],{})[_0x16d1('0x22')](respondWithResult(_0x583151,0xc9))['catch'](handleError(_0x583151,null));};exports['update']=function(_0x1d92cd,_0x8bb0c1){if(_0x1d92cd['body']['id']){delete _0x1d92cd[_0x16d1('0x41')]['id'];}return db[_0x16d1('0x29')][_0x16d1('0x42')]({'where':{'id':_0x1d92cd[_0x16d1('0x3d')]['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0x8bb0c1,null))['then'](saveUpdates(_0x1d92cd[_0x16d1('0x41')],null))['then'](respondWithResult(_0x8bb0c1,null))[_0x16d1('0x3f')](handleError(_0x8bb0c1,null));};exports[_0x16d1('0x23')]=function(_0x5d384c,_0x413acd){return db[_0x16d1('0x29')][_0x16d1('0x42')]({'where':{'id':_0x5d384c[_0x16d1('0x3d')]['id']}})['then'](handleEntityNotFound(_0x413acd,null))['then'](removeEntity(_0x413acd,null))['catch'](handleError(_0x413acd,null));};exports[_0x16d1('0x43')]=function(_0xbf100f,_0x39fd41){return db[_0x16d1('0x29')]['describe']()[_0x16d1('0x22')](respondWithResult(_0x39fd41,null))[_0x16d1('0x3f')](handleError(_0x39fd41,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 1d01b9a..067d72a 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 _0x9c17=['exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x1fb99b,_0x594fdc){var _0x5613d3=function(_0x441ee7){while(--_0x441ee7){_0x1fb99b['push'](_0x1fb99b['shift']());}};_0x5613d3(++_0x594fdc);}(_0x9c17,0x1e5));var _0x79c1=function(_0x57a670,_0x30e402){_0x57a670=_0x57a670-0x0;var _0x41ce21=_0x9c17[_0x57a670];return _0x41ce21;};'use strict';var _=require(_0x79c1('0x0'));var util=require('util');var logger=require(_0x79c1('0x1'))(_0x79c1('0x2'));var moment=require(_0x79c1('0x3'));var BPromise=require(_0x79c1('0x4'));var rp=require(_0x79c1('0x5'));var fs=require('fs');var path=require(_0x79c1('0x6'));var rimraf=require(_0x79c1('0x7'));var config=require(_0x79c1('0x8'));var attributes=require(_0x79c1('0x9'));module[_0x79c1('0xa')]=function(_0x436fd9,_0x2f5ff4){return _0x436fd9[_0x79c1('0xb')](_0x79c1('0xc'),attributes,{'tableName':_0x79c1('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x79c1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x99a7=['request-promise','rimraf','../../config/environment','MailQueueReport','report_mail_queue','uniqueid','util','moment','bluebird'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x99a7,0x19b));var _0x799a=function(_0x49b14d,_0x578d07){_0x49b14d=_0x49b14d-0x0;var _0x3d2488=_0x99a7[_0x49b14d];return _0x3d2488;};'use strict';var _=require('lodash');var util=require(_0x799a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x799a('0x1'));var BPromise=require(_0x799a('0x2'));var rp=require(_0x799a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x799a('0x4'));var config=require(_0x799a('0x5'));var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x58189b,_0x166d46){return _0x58189b['define'](_0x799a('0x6'),attributes,{'tableName':_0x799a('0x7'),'paranoid':![],'indexes':[{'name':_0x799a('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 8491c0f..11702ff 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x83d08e,_0x228942){var _0x404d4f=function(_0x161ce){while(--_0x161ce){_0x83d08e['push'](_0x83d08e['shift']());}};_0x404d4f(++_0x228942);}(_0x2ef3,0xba));var _0x32ef=function(_0x4e9b2e,_0x555ee2){_0x4e9b2e=_0x4e9b2e-0x0;var _0x2819c0=_0x2ef3[_0x4e9b2e];return _0x2819c0;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _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(_0x3da3d6,_0x39d399){var _0x203757=function(_0x4c70d7){while(--_0x4c70d7){_0x3da3d6['push'](_0x3da3d6['shift']());}};_0x203757(++_0x39d399);}(_0x1261,0x144));var _0x1126=function(_0xfc7019,_0x277c9e){_0xfc7019=_0xfc7019-0x0;var _0x2af8f4=_0x1261[_0xfc7019];return _0x2af8f4;};'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 6ec791f..2016424 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x276c70,_0x593869){var _0x1a20c4=function(_0x9b5c3){while(--_0x9b5c3){_0x276c70['push'](_0x276c70['shift']());}};_0x1a20c4(++_0x593869);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x12c1e7,_0xa87f43){var _0x41be52=function(_0xce2ca9){while(--_0xce2ca9){_0x12c1e7['push'](_0x12c1e7['shift']());}};_0x41be52(++_0xa87f43);}(_0x70e0,0x17b));var _0x070e=function(_0x21d88c,_0xb31201){_0x21d88c=_0x21d88c-0x0;var _0x1dabc4=_0x70e0[_0x21d88c];return _0x1dabc4;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 6319007..2240638 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 _0x896f=['exports','STRING','BOOLEAN','INBOX','INTEGER'];(function(_0x530fe9,_0x13e3c7){var _0x115ee3=function(_0x4f1704){while(--_0x4f1704){_0x530fe9['push'](_0x530fe9['shift']());}};_0x115ee3(++_0x13e3c7);}(_0x896f,0xe6));var _0xf896=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0x896f[_0x4d674b];return _0x535a1f;};'use strict';var Sequelize=require('sequelize');module[_0xf896('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf896('0x1')]},'authentication':{'type':Sequelize[_0xf896('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xf896('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xf896('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf896('0x1')],'defaultValue':_0xf896('0x3')},'connTimeout':{'type':Sequelize[_0xf896('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xf896('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xf896('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1655=['sequelize','exports','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0xcaed06,_0x2d6596){var _0x400bea=function(_0x5a329a){while(--_0x5a329a){_0xcaed06['push'](_0xcaed06['shift']());}};_0x400bea(++_0x2d6596);}(_0x1655,0xc6));var _0x5165=function(_0x4075b1,_0x3283b7){_0x4075b1=_0x4075b1-0x0;var _0x31d1c4=_0x1655[_0x4075b1];return _0x31d1c4;};'use strict';var Sequelize=require(_0x5165('0x0'));module[_0x5165('0x1')]={'description':{'type':Sequelize[_0x5165('0x2')]},'host':{'type':Sequelize[_0x5165('0x2')]},'authentication':{'type':Sequelize[_0x5165('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x5165('0x4')]},'tls':{'type':Sequelize[_0x5165('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5165('0x2')],'defaultValue':_0x5165('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x5165('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x5165('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index feafca2..2ae842e 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 _0x9f93=['rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x397d1d,_0x56d001){var _0x33e1f5=function(_0x529595){while(--_0x529595){_0x397d1d['push'](_0x397d1d['shift']());}};_0x33e1f5(++_0x56d001);}(_0x9f93,0x1f1));var _0x39f9=function(_0x1fd7d5,_0x31ac26){_0x1fd7d5=_0x1fd7d5-0x0;var _0x419de5=_0x9f93[_0x1fd7d5];return _0x419de5;};'use strict';var _=require('lodash');var util=require(_0x39f9('0x0'));var logger=require(_0x39f9('0x1'))(_0x39f9('0x2'));var moment=require(_0x39f9('0x3'));var BPromise=require(_0x39f9('0x4'));var rp=require(_0x39f9('0x5'));var fs=require('fs');var path=require(_0x39f9('0x6'));var rimraf=require(_0x39f9('0x7'));var config=require(_0x39f9('0x8'));var attributes=require(_0x39f9('0x9'));module[_0x39f9('0xa')]=function(_0x5c7bf2,_0x48714b){return _0x5c7bf2[_0x39f9('0xb')](_0x39f9('0xc'),attributes,{'tableName':_0x39f9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8aa4=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','define','MailServerIn','mail_servers_in'];(function(_0x468288,_0x47476d){var _0x3080c7=function(_0x5d1b85){while(--_0x5d1b85){_0x468288['push'](_0x468288['shift']());}};_0x3080c7(++_0x47476d);}(_0x8aa4,0x1ee));var _0x48aa=function(_0x55550f,_0x4311c0){_0x55550f=_0x55550f-0x0;var _0x306237=_0x8aa4[_0x55550f];return _0x306237;};'use strict';var _=require(_0x48aa('0x0'));var util=require(_0x48aa('0x1'));var logger=require(_0x48aa('0x2'))(_0x48aa('0x3'));var moment=require('moment');var BPromise=require(_0x48aa('0x4'));var rp=require(_0x48aa('0x5'));var fs=require('fs');var path=require(_0x48aa('0x6'));var rimraf=require(_0x48aa('0x7'));var config=require(_0x48aa('0x8'));var attributes=require(_0x48aa('0x9'));module['exports']=function(_0x4d5ed7,_0x41b2a1){return _0x4d5ed7[_0x48aa('0xa')](_0x48aa('0xb'),attributes,{'tableName':_0x48aa('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 08a1f6e..8d9912e 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 _0x4ded=['message','info','result','GetMailServerIn','MailServerIn','findAll','options','where','attributes','limit','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','error','code','MailServerIn,\x20%s,\x20%s'];(function(_0x3e5427,_0x42fb95){var _0x49d1f4=function(_0x2b0e4f){while(--_0x2b0e4f){_0x3e5427['push'](_0x3e5427['shift']());}};_0x49d1f4(++_0x42fb95);}(_0x4ded,0x116));var _0xd4de=function(_0x514fa8,_0x486398){_0x514fa8=_0x514fa8-0x0;var _0x3be49b=_0x4ded[_0x514fa8];return _0x3be49b;};'use strict';var _=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var moment=require(_0xd4de('0x2'));var BPromise=require(_0xd4de('0x3'));var rs=require(_0xd4de('0x4'));var fs=require('fs');var Redis=require(_0xd4de('0x5'));var db=require(_0xd4de('0x6'))['db'];var utils=require(_0xd4de('0x7'));var logger=require(_0xd4de('0x8'))(_0xd4de('0x9'));var config=require(_0xd4de('0xa'));var jayson=require(_0xd4de('0xb'));var client=jayson['client'][_0xd4de('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2433b8,_0x15eb91,_0x2c56d5){return new BPromise(function(_0x4453c2,_0x1e8c35){return client['request'](_0x2433b8,_0x2c56d5)[_0xd4de('0xd')](function(_0x5ebcf3){logger['info']('MailServerIn,\x20%s,\x20%s',_0x15eb91,_0xd4de('0xe'));logger[_0xd4de('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x15eb91,'request\x20sent',JSON['stringify'](_0x5ebcf3));if(_0x5ebcf3[_0xd4de('0x10')]){if(_0x5ebcf3['error'][_0xd4de('0x11')]===0x1f4){logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);return _0x1e8c35(_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);}logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);return _0x4453c2(_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);}else{logger[_0xd4de('0x14')](_0xd4de('0x12'),_0x15eb91,_0xd4de('0xe'));_0x4453c2(_0x5ebcf3[_0xd4de('0x15')]['message']);}})['catch'](function(_0x3df820){logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x3df820);_0x1e8c35(_0x3df820);});});}exports[_0xd4de('0x16')]=function(_0x5b1d1c){var _0x4d0df6=this;return new Promise(function(_0x1e91d5,_0x54b757){return db[_0xd4de('0x17')][_0xd4de('0x18')]({'raw':_0x5b1d1c['options']?_0x5b1d1c[_0xd4de('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5b1d1c[_0xd4de('0x19')]?_0x5b1d1c[_0xd4de('0x19')][_0xd4de('0x1a')]||null:null,'attributes':_0x5b1d1c[_0xd4de('0x19')]?_0x5b1d1c['options'][_0xd4de('0x1b')]||null:null,'limit':_0x5b1d1c[_0xd4de('0x19')]?_0x5b1d1c[_0xd4de('0x19')][_0xd4de('0x1c')]||null:null,'include':_0x5b1d1c[_0xd4de('0x19')]?_0x5b1d1c[_0xd4de('0x19')][_0xd4de('0x1d')]?_[_0xd4de('0x1e')](_0x5b1d1c[_0xd4de('0x19')][_0xd4de('0x1d')],function(_0x534b37){return{'model':db[_0x534b37[_0xd4de('0x1f')]],'as':_0x534b37['as'],'attributes':_0x534b37[_0xd4de('0x1b')],'include':_0x534b37[_0xd4de('0x1d')]?_[_0xd4de('0x1e')](_0x534b37[_0xd4de('0x1d')],function(_0x984904){return{'model':db[_0x984904[_0xd4de('0x1f')]],'as':_0x984904['as'],'attributes':_0x984904[_0xd4de('0x1b')],'include':_0x984904[_0xd4de('0x1d')]?_[_0xd4de('0x1e')](_0x984904[_0xd4de('0x1d')],function(_0xb2d8a1){return{'model':db[_0xb2d8a1['model']],'as':_0xb2d8a1['as'],'attributes':_0xb2d8a1[_0xd4de('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd4de('0xd')](function(_0x5005b0){logger[_0xd4de('0x14')]('GetMailServerIn',_0x5b1d1c);logger[_0xd4de('0xf')](_0xd4de('0x16'),_0x5b1d1c,JSON[_0xd4de('0x20')](_0x5005b0));_0x1e91d5(_0x5005b0);})['catch'](function(_0xd4de93){logger[_0xd4de('0x10')](_0xd4de('0x16'),_0xd4de93['message'],_0x5b1d1c);_0x54b757(_0x4d0df6[_0xd4de('0x10')](0x1f4,_0xd4de93[_0xd4de('0x13')]));});});}; \ No newline at end of file +var _0x2a92=['attributes','limit','include','map','model','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetMailServerIn','MailServerIn','options','raw','where'];(function(_0x5f04be,_0x37bc5e){var _0x5d37d3=function(_0x392eac){while(--_0x392eac){_0x5f04be['push'](_0x5f04be['shift']());}};_0x5d37d3(++_0x37bc5e);}(_0x2a92,0xbf));var _0x22a9=function(_0x3e5bc8,_0x457d89){_0x3e5bc8=_0x3e5bc8-0x0;var _0xfd84bc=_0x2a92[_0x3e5bc8];return _0xfd84bc;};'use strict';var _=require(_0x22a9('0x0'));var util=require(_0x22a9('0x1'));var moment=require(_0x22a9('0x2'));var BPromise=require(_0x22a9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22a9('0x4'))['db'];var utils=require(_0x22a9('0x5'));var logger=require(_0x22a9('0x6'))(_0x22a9('0x7'));var config=require(_0x22a9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x22a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xea1cf5,_0x2fb564,_0x332f84){return new BPromise(function(_0x3dd2f0,_0x45d7bf){return client['request'](_0xea1cf5,_0x332f84)[_0x22a9('0xa')](function(_0x3d2863){logger[_0x22a9('0xb')](_0x22a9('0xc'),_0x2fb564,'request\x20sent');logger[_0x22a9('0xd')](_0x22a9('0xe'),_0x2fb564,_0x22a9('0xf'),JSON[_0x22a9('0x10')](_0x3d2863));if(_0x3d2863[_0x22a9('0x11')]){if(_0x3d2863[_0x22a9('0x11')]['code']===0x1f4){logger[_0x22a9('0x11')](_0x22a9('0xc'),_0x2fb564,_0x3d2863[_0x22a9('0x11')][_0x22a9('0x12')]);return _0x45d7bf(_0x3d2863['error']['message']);}logger['error'](_0x22a9('0xc'),_0x2fb564,_0x3d2863[_0x22a9('0x11')][_0x22a9('0x12')]);return _0x3dd2f0(_0x3d2863[_0x22a9('0x11')]['message']);}else{logger[_0x22a9('0xb')](_0x22a9('0xc'),_0x2fb564,_0x22a9('0xf'));_0x3dd2f0(_0x3d2863[_0x22a9('0x13')]['message']);}})[_0x22a9('0x14')](function(_0x1bdd33){logger[_0x22a9('0x11')]('MailServerIn,\x20%s,\x20%s',_0x2fb564,_0x1bdd33);_0x45d7bf(_0x1bdd33);});});}exports[_0x22a9('0x15')]=function(_0x51951f){var _0x30433a=this;return new Promise(function(_0x597cab,_0x4653fb){return db[_0x22a9('0x16')]['findAll']({'raw':_0x51951f[_0x22a9('0x17')]?_0x51951f[_0x22a9('0x17')][_0x22a9('0x18')]===undefined?!![]:![]:!![],'where':_0x51951f[_0x22a9('0x17')]?_0x51951f[_0x22a9('0x17')][_0x22a9('0x19')]||null:null,'attributes':_0x51951f[_0x22a9('0x17')]?_0x51951f[_0x22a9('0x17')][_0x22a9('0x1a')]||null:null,'limit':_0x51951f['options']?_0x51951f[_0x22a9('0x17')][_0x22a9('0x1b')]||null:null,'include':_0x51951f[_0x22a9('0x17')]?_0x51951f[_0x22a9('0x17')][_0x22a9('0x1c')]?_[_0x22a9('0x1d')](_0x51951f[_0x22a9('0x17')][_0x22a9('0x1c')],function(_0x575f67){return{'model':db[_0x575f67[_0x22a9('0x1e')]],'as':_0x575f67['as'],'attributes':_0x575f67[_0x22a9('0x1a')],'include':_0x575f67[_0x22a9('0x1c')]?_[_0x22a9('0x1d')](_0x575f67[_0x22a9('0x1c')],function(_0x47416d){return{'model':db[_0x47416d[_0x22a9('0x1e')]],'as':_0x47416d['as'],'attributes':_0x47416d[_0x22a9('0x1a')],'include':_0x47416d[_0x22a9('0x1c')]?_[_0x22a9('0x1d')](_0x47416d[_0x22a9('0x1c')],function(_0x361d31){return{'model':db[_0x361d31[_0x22a9('0x1e')]],'as':_0x361d31['as'],'attributes':_0x361d31[_0x22a9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x22a9('0xa')](function(_0x1bc79e){logger[_0x22a9('0xb')](_0x22a9('0x15'),_0x51951f);logger[_0x22a9('0xd')](_0x22a9('0x15'),_0x51951f,JSON[_0x22a9('0x10')](_0x1bc79e));_0x597cab(_0x1bc79e);})[_0x22a9('0x14')](function(_0x3401ef){logger[_0x22a9('0x11')](_0x22a9('0x15'),_0x3401ef[_0x22a9('0x12')],_0x51951f);_0x4653fb(_0x30433a[_0x22a9('0x11')](0x1f4,_0x3401ef[_0x22a9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 2c31574..0ae143d 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x7a54,0x106));var _0x47a5=function(_0x3aaa57,_0x5a443b){_0x3aaa57=_0x3aaa57-0x0;var _0x55562c=_0x7a54[_0x3aaa57];return _0x55562c;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 5eb2758..f8b8114 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 _0xed3c=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x410cc2,_0x144434){var _0x4f4e56=function(_0xae68ec){while(--_0xae68ec){_0x410cc2['push'](_0x410cc2['shift']());}};_0x4f4e56(++_0x144434);}(_0xed3c,0x1a6));var _0xced3=function(_0x1c73b1,_0x5c6f36){_0x1c73b1=_0x1c73b1-0x0;var _0x4b9c7c=_0xed3c[_0x1c73b1];return _0x4b9c7c;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'description':{'type':Sequelize[_0xced3('0x2')]},'host':{'type':Sequelize[_0xced3('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xced3('0x2')]},'port':{'type':Sequelize[_0xced3('0x3')]},'secure':{'type':Sequelize[_0xced3('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xced3('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x0abf=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x1157f3,_0x3f170d){var _0x489e8d=function(_0x7332f8){while(--_0x7332f8){_0x1157f3['push'](_0x1157f3['shift']());}};_0x489e8d(++_0x3f170d);}(_0x0abf,0xe8));var _0xf0ab=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0abf[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'description':{'type':Sequelize[_0xf0ab('0x1')]},'host':{'type':Sequelize[_0xf0ab('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf0ab('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xf0ab('0x1')]},'authentication':{'type':Sequelize[_0xf0ab('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xf0ab('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index e359bbc..d9a1943 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 _0x63da=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','MailServerOut','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort'];(function(_0x70acfe,_0x4f6aa5){var _0x1fba77=function(_0x42f155){while(--_0x42f155){_0x70acfe['push'](_0x70acfe['shift']());}};_0x1fba77(++_0x4f6aa5);}(_0x63da,0x18c));var _0xa63d=function(_0x361e5d,_0x15e1a4){_0x361e5d=_0x361e5d-0x0;var _0x4c303d=_0x63da[_0x361e5d];return _0x4c303d;};'use strict';var emlformat=require(_0xa63d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa63d('0x1'));var jsonpatch=require(_0xa63d('0x2'));var rp=require('request-promise');var moment=require(_0xa63d('0x3'));var BPromise=require(_0xa63d('0x4'));var Mustache=require('mustache');var util=require(_0xa63d('0x5'));var path=require(_0xa63d('0x6'));var sox=require(_0xa63d('0x7'));var csv=require('to-csv');var ejs=require(_0xa63d('0x8'));var fs=require('fs');var fs_extra=require(_0xa63d('0x9'));var _=require(_0xa63d('0xa'));var squel=require(_0xa63d('0xb'));var crypto=require(_0xa63d('0xc'));var jsforce=require(_0xa63d('0xd'));var deskjs=require(_0xa63d('0xe'));var toCsv=require(_0xa63d('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa63d('0x10'));var qs=require(_0xa63d('0x11'));var as=require(_0xa63d('0x12'));var hardwareService=require(_0xa63d('0x13'));var logger=require('../../config/logger')(_0xa63d('0x14'));var utils=require(_0xa63d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa63d('0x16'));var db=require(_0xa63d('0x17'))['db'];function respondWithStatusCode(_0x4de0dd,_0xeafc4b){_0xeafc4b=_0xeafc4b||0xcc;return function(_0x107a5b){if(_0x107a5b){return _0x4de0dd['sendStatus'](_0xeafc4b);}return _0x4de0dd[_0xa63d('0x18')](_0xeafc4b)[_0xa63d('0x19')]();};}function respondWithResult(_0x31516b,_0xf9d3be){_0xf9d3be=_0xf9d3be||0xc8;return function(_0xdde6ea){if(_0xdde6ea){return _0x31516b[_0xa63d('0x18')](_0xf9d3be)[_0xa63d('0x1a')](_0xdde6ea);}};}function respondWithFilteredResult(_0x1f7a82,_0x44b988){return function(_0x29b4fa){if(_0x29b4fa){var _0x201e47=typeof _0x44b988['offset']===_0xa63d('0x1b')&&typeof _0x44b988[_0xa63d('0x1c')]==='undefined';var _0x2383b2=_0x29b4fa['count'];var _0x56975b=_0x201e47?0x0:_0x44b988['offset'];var _0x2af97a=_0x201e47?_0x29b4fa[_0xa63d('0x1d')]:_0x44b988['offset']+_0x44b988[_0xa63d('0x1c')];var _0x10805c;if(_0x2af97a>=_0x2383b2){_0x2af97a=_0x2383b2;_0x10805c=0xc8;}else{_0x10805c=0xce;}_0x1f7a82[_0xa63d('0x18')](_0x10805c);return _0x1f7a82[_0xa63d('0x1e')](_0xa63d('0x1f'),_0x56975b+'-'+_0x2af97a+'/'+_0x2383b2)[_0xa63d('0x1a')](_0x29b4fa);}return null;};}function patchUpdates(_0x3e08a9){return function(_0x15ca5c){try{jsonpatch[_0xa63d('0x20')](_0x15ca5c,_0x3e08a9,!![]);}catch(_0x23202a){return BPromise[_0xa63d('0x21')](_0x23202a);}return _0x15ca5c[_0xa63d('0x22')]();};}function saveUpdates(_0x207758,_0x538aa1){return function(_0x4d90e5){if(_0x4d90e5){return _0x4d90e5[_0xa63d('0x23')](_0x207758)[_0xa63d('0x24')](function(_0x5887d8){return _0x5887d8;});}return null;};}function removeEntity(_0x498943,_0x2e7058){return function(_0x4b6e21){if(_0x4b6e21){return _0x4b6e21[_0xa63d('0x25')]()[_0xa63d('0x24')](function(){_0x498943['status'](0xcc)[_0xa63d('0x19')]();});}};}function handleEntityNotFound(_0x5d4a3e,_0x140c31){return function(_0x1f7f27){if(!_0x1f7f27){_0x5d4a3e[_0xa63d('0x26')](0x194);}return _0x1f7f27;};}function handleError(_0x54b96e,_0x267b0a){_0x267b0a=_0x267b0a||0x1f4;return function(_0xa1a9df){logger[_0xa63d('0x27')](_0xa1a9df[_0xa63d('0x28')]);if(_0xa1a9df[_0xa63d('0x29')]){delete _0xa1a9df[_0xa63d('0x29')];}_0x54b96e[_0xa63d('0x18')](_0x267b0a)['send'](_0xa1a9df);};}exports['index']=function(_0x39a62f,_0x4240ae){var _0x3340a1={},_0xa0707f={},_0x61dd69={'count':0x0,'rows':[]};var _0x27ce30=_['map'](db[_0xa63d('0x2a')][_0xa63d('0x2b')],function(_0x545419){return{'name':_0x545419[_0xa63d('0x2c')],'type':_0x545419[_0xa63d('0x2d')]['key']};});_0xa0707f['model']=_[_0xa63d('0x2e')](_0x27ce30,_0xa63d('0x29'));_0xa0707f[_0xa63d('0x2f')]=_[_0xa63d('0x30')](_0x39a62f[_0xa63d('0x2f')]);_0xa0707f[_0xa63d('0x31')]=_[_0xa63d('0x32')](_0xa0707f['model'],_0xa0707f[_0xa63d('0x2f')]);_0x3340a1['attributes']=_[_0xa63d('0x32')](_0xa0707f[_0xa63d('0x33')],qs[_0xa63d('0x34')](_0x39a62f[_0xa63d('0x2f')]['fields']));_0x3340a1['attributes']=_0x3340a1[_0xa63d('0x35')][_0xa63d('0x36')]?_0x3340a1[_0xa63d('0x35')]:_0xa0707f[_0xa63d('0x33')];if(!_0x39a62f[_0xa63d('0x2f')][_0xa63d('0x37')](_0xa63d('0x38'))){_0x3340a1[_0xa63d('0x1c')]=qs[_0xa63d('0x1c')](_0x39a62f[_0xa63d('0x2f')][_0xa63d('0x1c')]);_0x3340a1['offset']=qs[_0xa63d('0x39')](_0x39a62f[_0xa63d('0x2f')]['offset']);}_0x3340a1[_0xa63d('0x3a')]=qs['sort'](_0x39a62f[_0xa63d('0x2f')][_0xa63d('0x3b')]);_0x3340a1[_0xa63d('0x3c')]=qs[_0xa63d('0x31')](_[_0xa63d('0x3d')](_0x39a62f[_0xa63d('0x2f')],_0xa0707f[_0xa63d('0x31')]),_0x27ce30);if(_0x39a62f[_0xa63d('0x2f')][_0xa63d('0x3e')]){_0x3340a1[_0xa63d('0x3c')]=_[_0xa63d('0x3f')](_0x3340a1['where'],{'$or':_[_0xa63d('0x2e')](_0x27ce30,function(_0x4ea769){if(_0x4ea769[_0xa63d('0x2d')]!==_0xa63d('0x40')){var _0x5acf3b={};_0x5acf3b[_0x4ea769[_0xa63d('0x29')]]={'$like':'%'+_0x39a62f['query'][_0xa63d('0x3e')]+'%'};return _0x5acf3b;}})});}_0x3340a1=_[_0xa63d('0x3f')]({},_0x3340a1,_0x39a62f[_0xa63d('0x41')]);var _0x113255={'where':_0x3340a1[_0xa63d('0x3c')]};return db['MailServerOut'][_0xa63d('0x1d')](_0x113255)[_0xa63d('0x24')](function(_0x526e97){_0x61dd69[_0xa63d('0x1d')]=_0x526e97;if(_0x39a62f[_0xa63d('0x2f')][_0xa63d('0x42')]){_0x3340a1[_0xa63d('0x43')]=[{'all':!![]}];}return db['MailServerOut'][_0xa63d('0x44')](_0x3340a1);})['then'](function(_0x7a6a3a){_0x61dd69[_0xa63d('0x45')]=_0x7a6a3a;return _0x61dd69;})['then'](respondWithFilteredResult(_0x4240ae,_0x3340a1))[_0xa63d('0x46')](handleError(_0x4240ae,null));};exports[_0xa63d('0x47')]=function(_0x35c00e,_0x2ceabd){var _0x37b1a6={'raw':!![],'where':{'id':_0x35c00e[_0xa63d('0x48')]['id']}},_0x4f6d10={};_0x4f6d10['model']=_[_0xa63d('0x30')](db[_0xa63d('0x2a')][_0xa63d('0x2b')]);_0x4f6d10[_0xa63d('0x2f')]=_['keys'](_0x35c00e[_0xa63d('0x2f')]);_0x4f6d10[_0xa63d('0x31')]=_[_0xa63d('0x32')](_0x4f6d10[_0xa63d('0x33')],_0x4f6d10[_0xa63d('0x2f')]);_0x37b1a6[_0xa63d('0x35')]=_[_0xa63d('0x32')](_0x4f6d10[_0xa63d('0x33')],qs[_0xa63d('0x34')](_0x35c00e[_0xa63d('0x2f')][_0xa63d('0x34')]));_0x37b1a6[_0xa63d('0x35')]=_0x37b1a6[_0xa63d('0x35')][_0xa63d('0x36')]?_0x37b1a6[_0xa63d('0x35')]:_0x4f6d10[_0xa63d('0x33')];if(_0x35c00e[_0xa63d('0x2f')]['includeAll']){_0x37b1a6[_0xa63d('0x43')]=[{'all':!![]}];}_0x37b1a6=_['merge']({},_0x37b1a6,_0x35c00e[_0xa63d('0x41')]);return db[_0xa63d('0x2a')][_0xa63d('0x49')](_0x37b1a6)[_0xa63d('0x24')](handleEntityNotFound(_0x2ceabd,null))[_0xa63d('0x24')](respondWithResult(_0x2ceabd,null))['catch'](handleError(_0x2ceabd,null));};exports[_0xa63d('0x4a')]=function(_0x3257d0,_0x8066ac){return db[_0xa63d('0x2a')][_0xa63d('0x4a')](_0x3257d0[_0xa63d('0x4b')],{})[_0xa63d('0x24')](respondWithResult(_0x8066ac,0xc9))['catch'](handleError(_0x8066ac,null));};exports[_0xa63d('0x23')]=function(_0x1dbc36,_0x3de72d){if(_0x1dbc36[_0xa63d('0x4b')]['id']){delete _0x1dbc36[_0xa63d('0x4b')]['id'];}return db[_0xa63d('0x2a')][_0xa63d('0x49')]({'where':{'id':_0x1dbc36['params']['id']}})[_0xa63d('0x24')](handleEntityNotFound(_0x3de72d,null))[_0xa63d('0x24')](saveUpdates(_0x1dbc36[_0xa63d('0x4b')],null))[_0xa63d('0x24')](respondWithResult(_0x3de72d,null))['catch'](handleError(_0x3de72d,null));};exports[_0xa63d('0x25')]=function(_0x4d120b,_0x2204dd){return db[_0xa63d('0x2a')][_0xa63d('0x49')]({'where':{'id':_0x4d120b['params']['id']}})[_0xa63d('0x24')](handleEntityNotFound(_0x2204dd,null))[_0xa63d('0x24')](removeEntity(_0x2204dd,null))[_0xa63d('0x46')](handleError(_0x2204dd,null));}; \ No newline at end of file +var _0x7ff6=['filter','VIRTUAL','merge','options','where','includeAll','include','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','MailServerOut','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters'];(function(_0x5a36dd,_0x5b2d2c){var _0x15503d=function(_0x59d3c7){while(--_0x59d3c7){_0x5a36dd['push'](_0x5a36dd['shift']());}};_0x15503d(++_0x5b2d2c);}(_0x7ff6,0x12e));var _0x67ff=function(_0x494f0f,_0x1e594d){_0x494f0f=_0x494f0f-0x0;var _0x26bf3c=_0x7ff6[_0x494f0f];return _0x26bf3c;};'use strict';var emlformat=require(_0x67ff('0x0'));var rimraf=require(_0x67ff('0x1'));var zipdir=require(_0x67ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x67ff('0x3'));var moment=require(_0x67ff('0x4'));var BPromise=require(_0x67ff('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x67ff('0x6'));var sox=require(_0x67ff('0x7'));var csv=require(_0x67ff('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x67ff('0x9'));var squel=require(_0x67ff('0xa'));var crypto=require('crypto');var jsforce=require(_0x67ff('0xb'));var deskjs=require(_0x67ff('0xc'));var toCsv=require(_0x67ff('0x8'));var querystring=require(_0x67ff('0xd'));var Papa=require('papaparse');var Redis=require(_0x67ff('0xe'));var authService=require(_0x67ff('0xf'));var qs=require(_0x67ff('0x10'));var as=require(_0x67ff('0x11'));var hardwareService=require(_0x67ff('0x12'));var logger=require(_0x67ff('0x13'))('api');var utils=require(_0x67ff('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x67ff('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x413af0,_0x567581){_0x567581=_0x567581||0xcc;return function(_0x51f338){if(_0x51f338){return _0x413af0[_0x67ff('0x16')](_0x567581);}return _0x413af0[_0x67ff('0x17')](_0x567581)['end']();};}function respondWithResult(_0x3a9873,_0x4141b8){_0x4141b8=_0x4141b8||0xc8;return function(_0x27c944){if(_0x27c944){return _0x3a9873[_0x67ff('0x17')](_0x4141b8)[_0x67ff('0x18')](_0x27c944);}};}function respondWithFilteredResult(_0x58cfc4,_0x4967ac){return function(_0x55dc89){if(_0x55dc89){var _0x36d044=typeof _0x4967ac['offset']===_0x67ff('0x19')&&typeof _0x4967ac[_0x67ff('0x1a')]===_0x67ff('0x19');var _0xdc9cbd=_0x55dc89[_0x67ff('0x1b')];var _0x54cfd6=_0x36d044?0x0:_0x4967ac['offset'];var _0x4afd7d=_0x36d044?_0x55dc89[_0x67ff('0x1b')]:_0x4967ac[_0x67ff('0x1c')]+_0x4967ac[_0x67ff('0x1a')];var _0x1d0f5e;if(_0x4afd7d>=_0xdc9cbd){_0x4afd7d=_0xdc9cbd;_0x1d0f5e=0xc8;}else{_0x1d0f5e=0xce;}_0x58cfc4['status'](_0x1d0f5e);return _0x58cfc4['set'](_0x67ff('0x1d'),_0x54cfd6+'-'+_0x4afd7d+'/'+_0xdc9cbd)[_0x67ff('0x18')](_0x55dc89);}return null;};}function patchUpdates(_0x119826){return function(_0x5add1d){try{jsonpatch[_0x67ff('0x1e')](_0x5add1d,_0x119826,!![]);}catch(_0x5ec0ed){return BPromise[_0x67ff('0x1f')](_0x5ec0ed);}return _0x5add1d[_0x67ff('0x20')]();};}function saveUpdates(_0x257c20,_0x47a61d){return function(_0x30186d){if(_0x30186d){return _0x30186d[_0x67ff('0x21')](_0x257c20)[_0x67ff('0x22')](function(_0x1872d6){return _0x1872d6;});}return null;};}function removeEntity(_0xd2f80f,_0x5f3a4b){return function(_0x227312){if(_0x227312){return _0x227312[_0x67ff('0x23')]()[_0x67ff('0x22')](function(){_0xd2f80f[_0x67ff('0x17')](0xcc)[_0x67ff('0x24')]();});}};}function handleEntityNotFound(_0x5c252a,_0x5f0ad9){return function(_0x37835e){if(!_0x37835e){_0x5c252a[_0x67ff('0x16')](0x194);}return _0x37835e;};}function handleError(_0x4748ce,_0x4794a5){_0x4794a5=_0x4794a5||0x1f4;return function(_0x5366a3){logger[_0x67ff('0x25')](_0x5366a3[_0x67ff('0x26')]);if(_0x5366a3[_0x67ff('0x27')]){delete _0x5366a3[_0x67ff('0x27')];}_0x4748ce[_0x67ff('0x17')](_0x4794a5)[_0x67ff('0x28')](_0x5366a3);};}exports[_0x67ff('0x29')]=function(_0x178c72,_0x613fdf){var _0x2c5f13={},_0x4e5b40={},_0x17363d={'count':0x0,'rows':[]};var _0x3b8595=_[_0x67ff('0x2a')](db[_0x67ff('0x2b')]['rawAttributes'],function(_0x23eacd){return{'name':_0x23eacd[_0x67ff('0x2c')],'type':_0x23eacd[_0x67ff('0x2d')][_0x67ff('0x2e')]};});_0x4e5b40[_0x67ff('0x2f')]=_[_0x67ff('0x2a')](_0x3b8595,_0x67ff('0x27'));_0x4e5b40[_0x67ff('0x30')]=_[_0x67ff('0x31')](_0x178c72['query']);_0x4e5b40['filters']=_['intersection'](_0x4e5b40['model'],_0x4e5b40['query']);_0x2c5f13[_0x67ff('0x32')]=_[_0x67ff('0x33')](_0x4e5b40[_0x67ff('0x2f')],qs[_0x67ff('0x34')](_0x178c72[_0x67ff('0x30')]['fields']));_0x2c5f13[_0x67ff('0x32')]=_0x2c5f13[_0x67ff('0x32')][_0x67ff('0x35')]?_0x2c5f13[_0x67ff('0x32')]:_0x4e5b40[_0x67ff('0x2f')];if(!_0x178c72[_0x67ff('0x30')][_0x67ff('0x36')](_0x67ff('0x37'))){_0x2c5f13[_0x67ff('0x1a')]=qs[_0x67ff('0x1a')](_0x178c72['query']['limit']);_0x2c5f13[_0x67ff('0x1c')]=qs[_0x67ff('0x1c')](_0x178c72['query']['offset']);}_0x2c5f13['order']=qs[_0x67ff('0x38')](_0x178c72['query']['sort']);_0x2c5f13['where']=qs['filters'](_['pick'](_0x178c72[_0x67ff('0x30')],_0x4e5b40[_0x67ff('0x39')]),_0x3b8595);if(_0x178c72['query'][_0x67ff('0x3a')]){_0x2c5f13['where']=_['merge'](_0x2c5f13['where'],{'$or':_[_0x67ff('0x2a')](_0x3b8595,function(_0x556bfc){if(_0x556bfc['type']!==_0x67ff('0x3b')){var _0x41fde7={};_0x41fde7[_0x556bfc[_0x67ff('0x27')]]={'$like':'%'+_0x178c72[_0x67ff('0x30')][_0x67ff('0x3a')]+'%'};return _0x41fde7;}})});}_0x2c5f13=_[_0x67ff('0x3c')]({},_0x2c5f13,_0x178c72[_0x67ff('0x3d')]);var _0x221034={'where':_0x2c5f13[_0x67ff('0x3e')]};return db[_0x67ff('0x2b')][_0x67ff('0x1b')](_0x221034)['then'](function(_0x4dde25){_0x17363d['count']=_0x4dde25;if(_0x178c72[_0x67ff('0x30')][_0x67ff('0x3f')]){_0x2c5f13[_0x67ff('0x40')]=[{'all':!![]}];}return db[_0x67ff('0x2b')]['findAll'](_0x2c5f13);})['then'](function(_0x269670){_0x17363d['rows']=_0x269670;return _0x17363d;})[_0x67ff('0x22')](respondWithFilteredResult(_0x613fdf,_0x2c5f13))[_0x67ff('0x41')](handleError(_0x613fdf,null));};exports[_0x67ff('0x42')]=function(_0x4de9b7,_0x54131c){var _0x1ae6b1={'raw':!![],'where':{'id':_0x4de9b7[_0x67ff('0x43')]['id']}},_0x2dbe93={};_0x2dbe93['model']=_[_0x67ff('0x31')](db[_0x67ff('0x2b')][_0x67ff('0x44')]);_0x2dbe93['query']=_[_0x67ff('0x31')](_0x4de9b7[_0x67ff('0x30')]);_0x2dbe93[_0x67ff('0x39')]=_[_0x67ff('0x33')](_0x2dbe93[_0x67ff('0x2f')],_0x2dbe93[_0x67ff('0x30')]);_0x1ae6b1[_0x67ff('0x32')]=_['intersection'](_0x2dbe93[_0x67ff('0x2f')],qs[_0x67ff('0x34')](_0x4de9b7[_0x67ff('0x30')][_0x67ff('0x34')]));_0x1ae6b1[_0x67ff('0x32')]=_0x1ae6b1[_0x67ff('0x32')][_0x67ff('0x35')]?_0x1ae6b1['attributes']:_0x2dbe93['model'];if(_0x4de9b7[_0x67ff('0x30')][_0x67ff('0x3f')]){_0x1ae6b1[_0x67ff('0x40')]=[{'all':!![]}];}_0x1ae6b1=_['merge']({},_0x1ae6b1,_0x4de9b7[_0x67ff('0x3d')]);return db[_0x67ff('0x2b')][_0x67ff('0x45')](_0x1ae6b1)[_0x67ff('0x22')](handleEntityNotFound(_0x54131c,null))['then'](respondWithResult(_0x54131c,null))[_0x67ff('0x41')](handleError(_0x54131c,null));};exports[_0x67ff('0x46')]=function(_0x13edcc,_0x4f4028){return db['MailServerOut']['create'](_0x13edcc[_0x67ff('0x47')],{})[_0x67ff('0x22')](respondWithResult(_0x4f4028,0xc9))[_0x67ff('0x41')](handleError(_0x4f4028,null));};exports[_0x67ff('0x21')]=function(_0x35030f,_0x54f022){if(_0x35030f[_0x67ff('0x47')]['id']){delete _0x35030f[_0x67ff('0x47')]['id'];}return db[_0x67ff('0x2b')][_0x67ff('0x45')]({'where':{'id':_0x35030f[_0x67ff('0x43')]['id']}})[_0x67ff('0x22')](handleEntityNotFound(_0x54f022,null))['then'](saveUpdates(_0x35030f['body'],null))[_0x67ff('0x22')](respondWithResult(_0x54f022,null))[_0x67ff('0x41')](handleError(_0x54f022,null));};exports[_0x67ff('0x23')]=function(_0x5125ec,_0x77e186){return db[_0x67ff('0x2b')][_0x67ff('0x45')]({'where':{'id':_0x5125ec['params']['id']}})[_0x67ff('0x22')](handleEntityNotFound(_0x77e186,null))['then'](removeEntity(_0x77e186,null))[_0x67ff('0x41')](handleError(_0x77e186,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 4aebc28..2b59f1a 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 _0xb9d6=['request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','define','util','../../config/logger','moment','bluebird'];(function(_0x461c92,_0x54b4ce){var _0x2c53f0=function(_0x4181e1){while(--_0x4181e1){_0x461c92['push'](_0x461c92['shift']());}};_0x2c53f0(++_0x54b4ce);}(_0xb9d6,0x182));var _0x6b9d=function(_0x9d9183,_0x4704df){_0x9d9183=_0x9d9183-0x0;var _0x3bec8e=_0xb9d6[_0x9d9183];return _0x3bec8e;};'use strict';var _=require('lodash');var util=require(_0x6b9d('0x0'));var logger=require(_0x6b9d('0x1'))('api');var moment=require(_0x6b9d('0x2'));var BPromise=require(_0x6b9d('0x3'));var rp=require(_0x6b9d('0x4'));var fs=require('fs');var path=require(_0x6b9d('0x5'));var rimraf=require(_0x6b9d('0x6'));var config=require(_0x6b9d('0x7'));var attributes=require(_0x6b9d('0x8'));module['exports']=function(_0x2eea0f,_0x2a2c40){return _0x2eea0f[_0x6b9d('0x9')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd0=['define','MailServerOut','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x337696,_0x7a58a5){var _0x365169=function(_0x53e94c){while(--_0x53e94c){_0x337696['push'](_0x337696['shift']());}};_0x365169(++_0x7a58a5);}(_0xedd0,0x16d));var _0x0edd=function(_0x551ecf,_0x3a986c){_0x551ecf=_0x551ecf-0x0;var _0x368424=_0xedd0[_0x551ecf];return _0x368424;};'use strict';var _=require(_0x0edd('0x0'));var util=require(_0x0edd('0x1'));var logger=require(_0x0edd('0x2'))(_0x0edd('0x3'));var moment=require(_0x0edd('0x4'));var BPromise=require(_0x0edd('0x5'));var rp=require(_0x0edd('0x6'));var fs=require('fs');var path=require(_0x0edd('0x7'));var rimraf=require('rimraf');var config=require(_0x0edd('0x8'));var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x3e13e9,_0x2c6311){return _0x3e13e9[_0x0edd('0x9')](_0x0edd('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 15c924c..8fd6497 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0xab6520,_0x44558a){var _0x3fb5f3=function(_0x215e39){while(--_0x215e39){_0xab6520['push'](_0xab6520['shift']());}};_0x3fb5f3(++_0x44558a);}(_0xdb28,0x106));var _0x8db2=function(_0x38b262,_0x4c5bda){_0x38b262=_0x38b262-0x0;var _0x5cf5f3=_0xdb28[_0x38b262];return _0x5cf5f3;};'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')]('MailServerOut,\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 +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x4ce7c2,_0x529db9){var _0x3a5f32=function(_0x4d87b7){while(--_0x4d87b7){_0x4ce7c2['push'](_0x4ce7c2['shift']());}};_0x3a5f32(++_0x529db9);}(_0xdb28,0x106));var _0x8db2=function(_0x9a295c,_0x821e51){_0x9a295c=_0x9a295c-0x0;var _0xbc807c=_0xdb28[_0x9a295c];return _0xbc807c;};'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')]('MailServerOut,\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/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 1ea3ee9..a7dfcc4 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 _0x2bf8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0x293164,_0x15f92d){var _0x19a971=function(_0x19d88b){while(--_0x19d88b){_0x293164['push'](_0x293164['shift']());}};_0x19a971(++_0x15f92d);}(_0x2bf8,0x19d));var _0x82bf=function(_0xafc73c,_0x5e053a){_0xafc73c=_0xafc73c-0x0;var _0x22505c=_0x2bf8[_0xafc73c];return _0x22505c;};'use strict';var multer=require(_0x82bf('0x0'));var util=require(_0x82bf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x82bf('0x2'));var router=express[_0x82bf('0x3')]();var fs_extra=require(_0x82bf('0x4'));var auth=require(_0x82bf('0x5'));var interaction=require(_0x82bf('0x6'));var config=require(_0x82bf('0x7'));var controller=require(_0x82bf('0x8'));router[_0x82bf('0x9')]('/',auth[_0x82bf('0xa')](),controller[_0x82bf('0xb')]);router[_0x82bf('0x9')](_0x82bf('0xc'),auth[_0x82bf('0xa')](),controller[_0x82bf('0xd')]);router[_0x82bf('0x9')](_0x82bf('0xe'),auth[_0x82bf('0xa')](),controller[_0x82bf('0xf')]);router[_0x82bf('0x10')]('/',auth[_0x82bf('0xa')](),controller[_0x82bf('0x11')]);router[_0x82bf('0x12')](_0x82bf('0xe'),auth[_0x82bf('0xa')](),controller['update']);router[_0x82bf('0x13')](_0x82bf('0xe'),auth['isAuthenticated'](),controller[_0x82bf('0x14')]);module[_0x82bf('0x15')]=router; \ No newline at end of file +var _0x28f6=['show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated','/describe','describe'];(function(_0x326e79,_0x33dc91){var _0x37eb89=function(_0xbaef25){while(--_0xbaef25){_0x326e79['push'](_0x326e79['shift']());}};_0x37eb89(++_0x33dc91);}(_0x28f6,0x113));var _0x628f=function(_0x2908e1,_0x6f4a47){_0x2908e1=_0x2908e1-0x0;var _0x26e16f=_0x28f6[_0x2908e1];return _0x26e16f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x628f('0x0'));var timeout=require(_0x628f('0x1'));var express=require('express');var router=express[_0x628f('0x2')]();var fs_extra=require(_0x628f('0x3'));var auth=require(_0x628f('0x4'));var interaction=require(_0x628f('0x5'));var config=require('../../config/environment');var controller=require(_0x628f('0x6'));router['get']('/',auth[_0x628f('0x7')](),controller['index']);router['get'](_0x628f('0x8'),auth[_0x628f('0x7')](),controller[_0x628f('0x9')]);router['get']('/:id',auth[_0x628f('0x7')](),controller[_0x628f('0xa')]);router[_0x628f('0xb')]('/',auth[_0x628f('0x7')](),controller[_0x628f('0xc')]);router[_0x628f('0xd')](_0x628f('0xe'),auth['isAuthenticated'](),controller[_0x628f('0xf')]);router[_0x628f('0x10')](_0x628f('0xe'),auth[_0x628f('0x7')](),controller[_0x628f('0x11')]);module[_0x628f('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 7a9e1ad..77e7c1f 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 _0x236d=['sequelize','exports','name'];(function(_0x13e300,_0x1bcb41){var _0x5a3eea=function(_0x2dfd2a){while(--_0x2dfd2a){_0x13e300['push'](_0x13e300['shift']());}};_0x5a3eea(++_0x1bcb41);}(_0x236d,0x7e));var _0xd236=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x236d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd236('0x0'));module[_0xd236('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd236('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x741c=['STRING','name','sequelize','exports'];(function(_0x143914,_0x362984){var _0xccf7b0=function(_0x368e83){while(--_0x368e83){_0x143914['push'](_0x143914['shift']());}};_0xccf7b0(++_0x362984);}(_0x741c,0x196));var _0xc741=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x741c[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xc741('0x0'));module[_0xc741('0x1')]={'name':{'type':Sequelize[_0xc741('0x2')],'unique':_0xc741('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc741('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 8dca4fa..0f3ce32 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 _0x3e40=['apply','reject','save','update','then','destroy','end','error','stack','name','send','index','type','key','map','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','MailSubstatus','includeAll','findAll','rows','show','params','include','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x402bf3,_0x190030){var _0x29b896=function(_0xddf863){while(--_0xddf863){_0x402bf3['push'](_0x402bf3['shift']());}};_0x29b896(++_0x190030);}(_0x3e40,0xc7));var _0x03e4=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x3e40[_0x3ce3c];return _0x55a2c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x03e4('0x0'));var zipdir=require(_0x03e4('0x1'));var jsonpatch=require(_0x03e4('0x2'));var rp=require(_0x03e4('0x3'));var moment=require(_0x03e4('0x4'));var BPromise=require(_0x03e4('0x5'));var Mustache=require(_0x03e4('0x6'));var util=require('util');var path=require(_0x03e4('0x7'));var sox=require('sox');var csv=require(_0x03e4('0x8'));var ejs=require(_0x03e4('0x9'));var fs=require('fs');var fs_extra=require(_0x03e4('0xa'));var _=require(_0x03e4('0xb'));var squel=require('squel');var crypto=require(_0x03e4('0xc'));var jsforce=require(_0x03e4('0xd'));var deskjs=require(_0x03e4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x03e4('0xf'));var Papa=require(_0x03e4('0x10'));var Redis=require(_0x03e4('0x11'));var authService=require(_0x03e4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x03e4('0x13'));var hardwareService=require(_0x03e4('0x14'));var logger=require(_0x03e4('0x15'))(_0x03e4('0x16'));var utils=require(_0x03e4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x03e4('0x18'));var db=require(_0x03e4('0x19'))['db'];function respondWithStatusCode(_0x94f974,_0x3fad19){_0x3fad19=_0x3fad19||0xcc;return function(_0xcc6299){if(_0xcc6299){return _0x94f974[_0x03e4('0x1a')](_0x3fad19);}return _0x94f974[_0x03e4('0x1b')](_0x3fad19)['end']();};}function respondWithResult(_0x1c4a0c,_0x79fa95){_0x79fa95=_0x79fa95||0xc8;return function(_0xa053ce){if(_0xa053ce){return _0x1c4a0c[_0x03e4('0x1b')](_0x79fa95)[_0x03e4('0x1c')](_0xa053ce);}};}function respondWithFilteredResult(_0x1036cb,_0x2f6c6c){return function(_0x5cb35f){if(_0x5cb35f){var _0x2daffa=typeof _0x2f6c6c[_0x03e4('0x1d')]===_0x03e4('0x1e')&&typeof _0x2f6c6c[_0x03e4('0x1f')]==='undefined';var _0x46a146=_0x5cb35f[_0x03e4('0x20')];var _0x4f5ce8=_0x2daffa?0x0:_0x2f6c6c[_0x03e4('0x1d')];var _0x53133a=_0x2daffa?_0x5cb35f[_0x03e4('0x20')]:_0x2f6c6c[_0x03e4('0x1d')]+_0x2f6c6c[_0x03e4('0x1f')];var _0x44a9b9;if(_0x53133a>=_0x46a146){_0x53133a=_0x46a146;_0x44a9b9=0xc8;}else{_0x44a9b9=0xce;}_0x1036cb['status'](_0x44a9b9);return _0x1036cb[_0x03e4('0x21')](_0x03e4('0x22'),_0x4f5ce8+'-'+_0x53133a+'/'+_0x46a146)[_0x03e4('0x1c')](_0x5cb35f);}return null;};}function patchUpdates(_0x32b5b2){return function(_0x303482){try{jsonpatch[_0x03e4('0x23')](_0x303482,_0x32b5b2,!![]);}catch(_0x43f7c9){return BPromise[_0x03e4('0x24')](_0x43f7c9);}return _0x303482[_0x03e4('0x25')]();};}function saveUpdates(_0x250d1d,_0x98bc27){return function(_0x559c19){if(_0x559c19){return _0x559c19[_0x03e4('0x26')](_0x250d1d)[_0x03e4('0x27')](function(_0x57ff9f){return _0x57ff9f;});}return null;};}function removeEntity(_0x1c185f,_0x5abf3a){return function(_0x59b414){if(_0x59b414){return _0x59b414[_0x03e4('0x28')]()[_0x03e4('0x27')](function(){_0x1c185f['status'](0xcc)[_0x03e4('0x29')]();});}};}function handleEntityNotFound(_0x187331,_0x169d0f){return function(_0x59bd66){if(!_0x59bd66){_0x187331[_0x03e4('0x1a')](0x194);}return _0x59bd66;};}function handleError(_0x595a5c,_0x5e3ad0){_0x5e3ad0=_0x5e3ad0||0x1f4;return function(_0x40bf89){logger[_0x03e4('0x2a')](_0x40bf89[_0x03e4('0x2b')]);if(_0x40bf89[_0x03e4('0x2c')]){delete _0x40bf89[_0x03e4('0x2c')];}_0x595a5c['status'](_0x5e3ad0)[_0x03e4('0x2d')](_0x40bf89);};}exports[_0x03e4('0x2e')]=function(_0x2b6695,_0x5c09f6){var _0x3375ae={},_0x1ec7bc={},_0x468430={'count':0x0,'rows':[]};var _0x2539c7=_['map'](db['MailSubstatus']['rawAttributes'],function(_0x593d5f){return{'name':_0x593d5f['fieldName'],'type':_0x593d5f[_0x03e4('0x2f')][_0x03e4('0x30')]};});_0x1ec7bc['model']=_[_0x03e4('0x31')](_0x2539c7,'name');_0x1ec7bc['query']=_[_0x03e4('0x32')](_0x2b6695['query']);_0x1ec7bc[_0x03e4('0x33')]=_[_0x03e4('0x34')](_0x1ec7bc[_0x03e4('0x35')],_0x1ec7bc[_0x03e4('0x36')]);_0x3375ae['attributes']=_['intersection'](_0x1ec7bc[_0x03e4('0x35')],qs[_0x03e4('0x37')](_0x2b6695[_0x03e4('0x36')]['fields']));_0x3375ae[_0x03e4('0x38')]=_0x3375ae[_0x03e4('0x38')][_0x03e4('0x39')]?_0x3375ae[_0x03e4('0x38')]:_0x1ec7bc['model'];if(!_0x2b6695[_0x03e4('0x36')][_0x03e4('0x3a')](_0x03e4('0x3b'))){_0x3375ae[_0x03e4('0x1f')]=qs[_0x03e4('0x1f')](_0x2b6695[_0x03e4('0x36')][_0x03e4('0x1f')]);_0x3375ae[_0x03e4('0x1d')]=qs[_0x03e4('0x1d')](_0x2b6695[_0x03e4('0x36')]['offset']);}_0x3375ae[_0x03e4('0x3c')]=qs[_0x03e4('0x3d')](_0x2b6695[_0x03e4('0x36')][_0x03e4('0x3d')]);_0x3375ae[_0x03e4('0x3e')]=qs[_0x03e4('0x33')](_['pick'](_0x2b6695['query'],_0x1ec7bc[_0x03e4('0x33')]),_0x2539c7);if(_0x2b6695['query'][_0x03e4('0x3f')]){_0x3375ae['where']=_[_0x03e4('0x40')](_0x3375ae[_0x03e4('0x3e')],{'$or':_[_0x03e4('0x31')](_0x2539c7,function(_0x472f92){if(_0x472f92[_0x03e4('0x2f')]!==_0x03e4('0x41')){var _0x5356c2={};_0x5356c2[_0x472f92['name']]={'$like':'%'+_0x2b6695[_0x03e4('0x36')][_0x03e4('0x3f')]+'%'};return _0x5356c2;}})});}_0x3375ae=_[_0x03e4('0x40')]({},_0x3375ae,_0x2b6695[_0x03e4('0x42')]);var _0x2c6b9d={'where':_0x3375ae[_0x03e4('0x3e')]};return db[_0x03e4('0x43')][_0x03e4('0x20')](_0x2c6b9d)['then'](function(_0x3fdf6b){_0x468430['count']=_0x3fdf6b;if(_0x2b6695[_0x03e4('0x36')][_0x03e4('0x44')]){_0x3375ae['include']=[{'all':!![]}];}return db[_0x03e4('0x43')][_0x03e4('0x45')](_0x3375ae);})['then'](function(_0x2cdc5b){_0x468430[_0x03e4('0x46')]=_0x2cdc5b;return _0x468430;})[_0x03e4('0x27')](respondWithFilteredResult(_0x5c09f6,_0x3375ae))['catch'](handleError(_0x5c09f6,null));};exports[_0x03e4('0x47')]=function(_0x55b3e8,_0x7d4fc4){var _0x4091b3={'raw':!![],'where':{'id':_0x55b3e8[_0x03e4('0x48')]['id']}},_0x40a7d8={};_0x40a7d8[_0x03e4('0x35')]=_[_0x03e4('0x32')](db[_0x03e4('0x43')]['rawAttributes']);_0x40a7d8[_0x03e4('0x36')]=_[_0x03e4('0x32')](_0x55b3e8['query']);_0x40a7d8['filters']=_[_0x03e4('0x34')](_0x40a7d8[_0x03e4('0x35')],_0x40a7d8[_0x03e4('0x36')]);_0x4091b3[_0x03e4('0x38')]=_[_0x03e4('0x34')](_0x40a7d8[_0x03e4('0x35')],qs[_0x03e4('0x37')](_0x55b3e8[_0x03e4('0x36')][_0x03e4('0x37')]));_0x4091b3[_0x03e4('0x38')]=_0x4091b3[_0x03e4('0x38')][_0x03e4('0x39')]?_0x4091b3[_0x03e4('0x38')]:_0x40a7d8[_0x03e4('0x35')];if(_0x55b3e8['query'][_0x03e4('0x44')]){_0x4091b3[_0x03e4('0x49')]=[{'all':!![]}];}_0x4091b3=_[_0x03e4('0x40')]({},_0x4091b3,_0x55b3e8[_0x03e4('0x42')]);return db[_0x03e4('0x43')]['find'](_0x4091b3)[_0x03e4('0x27')](handleEntityNotFound(_0x7d4fc4,null))['then'](respondWithResult(_0x7d4fc4,null))['catch'](handleError(_0x7d4fc4,null));};exports[_0x03e4('0x4a')]=function(_0x44d80d,_0xa9c2b9){return db[_0x03e4('0x43')]['create'](_0x44d80d[_0x03e4('0x4b')],{})[_0x03e4('0x27')](respondWithResult(_0xa9c2b9,0xc9))[_0x03e4('0x4c')](handleError(_0xa9c2b9,null));};exports[_0x03e4('0x26')]=function(_0x11920d,_0x4bf9d3){if(_0x11920d[_0x03e4('0x4b')]['id']){delete _0x11920d['body']['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x11920d[_0x03e4('0x48')]['id']}})[_0x03e4('0x27')](handleEntityNotFound(_0x4bf9d3,null))[_0x03e4('0x27')](saveUpdates(_0x11920d[_0x03e4('0x4b')],null))[_0x03e4('0x27')](respondWithResult(_0x4bf9d3,null))['catch'](handleError(_0x4bf9d3,null));};exports[_0x03e4('0x28')]=function(_0x358f25,_0x51fe91){return db['MailSubstatus']['find']({'where':{'id':_0x358f25['params']['id']}})[_0x03e4('0x27')](handleEntityNotFound(_0x51fe91,null))[_0x03e4('0x27')](removeEntity(_0x51fe91,null))['catch'](handleError(_0x51fe91,null));};exports['describe']=function(_0x423ee9,_0x766bc0){return db[_0x03e4('0x43')][_0x03e4('0x4d')]()[_0x03e4('0x27')](respondWithResult(_0x766bc0,null))[_0x03e4('0x4c')](handleError(_0x766bc0,null));}; \ No newline at end of file +var _0x8a87=['error','stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','filter','where','merge','VIRTUAL','MailSubstatus','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x2730da,_0x1098bd){var _0xfe9991=function(_0x2ea521){while(--_0x2ea521){_0x2730da['push'](_0x2730da['shift']());}};_0xfe9991(++_0x1098bd);}(_0x8a87,0x160));var _0x78a8=function(_0x53f125,_0x4ba12e){_0x53f125=_0x53f125-0x0;var _0x209b38=_0x8a87[_0x53f125];return _0x209b38;};'use strict';var emlformat=require(_0x78a8('0x0'));var rimraf=require(_0x78a8('0x1'));var zipdir=require(_0x78a8('0x2'));var jsonpatch=require(_0x78a8('0x3'));var rp=require(_0x78a8('0x4'));var moment=require(_0x78a8('0x5'));var BPromise=require(_0x78a8('0x6'));var Mustache=require(_0x78a8('0x7'));var util=require(_0x78a8('0x8'));var path=require(_0x78a8('0x9'));var sox=require(_0x78a8('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78a8('0xb'));var _=require(_0x78a8('0xc'));var squel=require('squel');var crypto=require(_0x78a8('0xd'));var jsforce=require(_0x78a8('0xe'));var deskjs=require(_0x78a8('0xf'));var toCsv=require(_0x78a8('0x10'));var querystring=require(_0x78a8('0x11'));var Papa=require(_0x78a8('0x12'));var Redis=require(_0x78a8('0x13'));var authService=require(_0x78a8('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x78a8('0x15'));var hardwareService=require(_0x78a8('0x16'));var logger=require(_0x78a8('0x17'))(_0x78a8('0x18'));var utils=require('../../config/utils');var config=require(_0x78a8('0x19'));var licenseUtil=require(_0x78a8('0x1a'));var db=require(_0x78a8('0x1b'))['db'];function respondWithStatusCode(_0x176618,_0x1be7c0){_0x1be7c0=_0x1be7c0||0xcc;return function(_0x160ca1){if(_0x160ca1){return _0x176618[_0x78a8('0x1c')](_0x1be7c0);}return _0x176618['status'](_0x1be7c0)[_0x78a8('0x1d')]();};}function respondWithResult(_0x12e565,_0x57afa6){_0x57afa6=_0x57afa6||0xc8;return function(_0x2a63f6){if(_0x2a63f6){return _0x12e565[_0x78a8('0x1e')](_0x57afa6)[_0x78a8('0x1f')](_0x2a63f6);}};}function respondWithFilteredResult(_0x1c6f62,_0x4871ad){return function(_0x21b9f5){if(_0x21b9f5){var _0x4f7caf=typeof _0x4871ad['offset']===_0x78a8('0x20')&&typeof _0x4871ad[_0x78a8('0x21')]===_0x78a8('0x20');var _0x2495dd=_0x21b9f5[_0x78a8('0x22')];var _0x1f482e=_0x4f7caf?0x0:_0x4871ad['offset'];var _0x169f06=_0x4f7caf?_0x21b9f5[_0x78a8('0x22')]:_0x4871ad['offset']+_0x4871ad[_0x78a8('0x21')];var _0x521501;if(_0x169f06>=_0x2495dd){_0x169f06=_0x2495dd;_0x521501=0xc8;}else{_0x521501=0xce;}_0x1c6f62[_0x78a8('0x1e')](_0x521501);return _0x1c6f62[_0x78a8('0x23')](_0x78a8('0x24'),_0x1f482e+'-'+_0x169f06+'/'+_0x2495dd)['json'](_0x21b9f5);}return null;};}function patchUpdates(_0x4c64d1){return function(_0x2bfb07){try{jsonpatch[_0x78a8('0x25')](_0x2bfb07,_0x4c64d1,!![]);}catch(_0x182073){return BPromise[_0x78a8('0x26')](_0x182073);}return _0x2bfb07[_0x78a8('0x27')]();};}function saveUpdates(_0x5410c5,_0x57036d){return function(_0xf4529d){if(_0xf4529d){return _0xf4529d[_0x78a8('0x28')](_0x5410c5)[_0x78a8('0x29')](function(_0x45f7e8){return _0x45f7e8;});}return null;};}function removeEntity(_0x4b4f40,_0x155a9f){return function(_0x1c998e){if(_0x1c998e){return _0x1c998e[_0x78a8('0x2a')]()[_0x78a8('0x29')](function(){_0x4b4f40['status'](0xcc)[_0x78a8('0x1d')]();});}};}function handleEntityNotFound(_0x9d8e8a,_0x5294e3){return function(_0x313573){if(!_0x313573){_0x9d8e8a[_0x78a8('0x1c')](0x194);}return _0x313573;};}function handleError(_0xec7ede,_0x370143){_0x370143=_0x370143||0x1f4;return function(_0xe452ac){logger[_0x78a8('0x2b')](_0xe452ac[_0x78a8('0x2c')]);if(_0xe452ac[_0x78a8('0x2d')]){delete _0xe452ac[_0x78a8('0x2d')];}_0xec7ede['status'](_0x370143)[_0x78a8('0x2e')](_0xe452ac);};}exports['index']=function(_0x277c2e,_0x5c2ced){var _0x127b2e={},_0x16a504={},_0x2bf1df={'count':0x0,'rows':[]};var _0x10cd3e=_[_0x78a8('0x2f')](db['MailSubstatus']['rawAttributes'],function(_0x17571e){return{'name':_0x17571e[_0x78a8('0x30')],'type':_0x17571e[_0x78a8('0x31')][_0x78a8('0x32')]};});_0x16a504[_0x78a8('0x33')]=_[_0x78a8('0x2f')](_0x10cd3e,_0x78a8('0x2d'));_0x16a504[_0x78a8('0x34')]=_[_0x78a8('0x35')](_0x277c2e[_0x78a8('0x34')]);_0x16a504[_0x78a8('0x36')]=_[_0x78a8('0x37')](_0x16a504[_0x78a8('0x33')],_0x16a504['query']);_0x127b2e[_0x78a8('0x38')]=_[_0x78a8('0x37')](_0x16a504[_0x78a8('0x33')],qs['fields'](_0x277c2e['query'][_0x78a8('0x39')]));_0x127b2e[_0x78a8('0x38')]=_0x127b2e[_0x78a8('0x38')][_0x78a8('0x3a')]?_0x127b2e[_0x78a8('0x38')]:_0x16a504[_0x78a8('0x33')];if(!_0x277c2e[_0x78a8('0x34')][_0x78a8('0x3b')]('nolimit')){_0x127b2e[_0x78a8('0x21')]=qs[_0x78a8('0x21')](_0x277c2e[_0x78a8('0x34')][_0x78a8('0x21')]);_0x127b2e[_0x78a8('0x3c')]=qs[_0x78a8('0x3c')](_0x277c2e[_0x78a8('0x34')][_0x78a8('0x3c')]);}_0x127b2e['order']=qs[_0x78a8('0x3d')](_0x277c2e['query'][_0x78a8('0x3d')]);_0x127b2e['where']=qs[_0x78a8('0x36')](_['pick'](_0x277c2e['query'],_0x16a504[_0x78a8('0x36')]),_0x10cd3e);if(_0x277c2e[_0x78a8('0x34')][_0x78a8('0x3e')]){_0x127b2e[_0x78a8('0x3f')]=_[_0x78a8('0x40')](_0x127b2e['where'],{'$or':_['map'](_0x10cd3e,function(_0xb5723){if(_0xb5723[_0x78a8('0x31')]!==_0x78a8('0x41')){var _0x494360={};_0x494360[_0xb5723[_0x78a8('0x2d')]]={'$like':'%'+_0x277c2e['query']['filter']+'%'};return _0x494360;}})});}_0x127b2e=_[_0x78a8('0x40')]({},_0x127b2e,_0x277c2e['options']);var _0x27fc2b={'where':_0x127b2e[_0x78a8('0x3f')]};return db[_0x78a8('0x42')]['count'](_0x27fc2b)[_0x78a8('0x29')](function(_0x50e3aa){_0x2bf1df[_0x78a8('0x22')]=_0x50e3aa;if(_0x277c2e['query'][_0x78a8('0x43')]){_0x127b2e[_0x78a8('0x44')]=[{'all':!![]}];}return db[_0x78a8('0x42')][_0x78a8('0x45')](_0x127b2e);})['then'](function(_0x560ec2){_0x2bf1df[_0x78a8('0x46')]=_0x560ec2;return _0x2bf1df;})[_0x78a8('0x29')](respondWithFilteredResult(_0x5c2ced,_0x127b2e))['catch'](handleError(_0x5c2ced,null));};exports[_0x78a8('0x47')]=function(_0x697e1b,_0x5aaf16){var _0x4330f4={'raw':!![],'where':{'id':_0x697e1b[_0x78a8('0x48')]['id']}},_0x3d864f={};_0x3d864f[_0x78a8('0x33')]=_['keys'](db[_0x78a8('0x42')][_0x78a8('0x49')]);_0x3d864f[_0x78a8('0x34')]=_[_0x78a8('0x35')](_0x697e1b['query']);_0x3d864f[_0x78a8('0x36')]=_[_0x78a8('0x37')](_0x3d864f[_0x78a8('0x33')],_0x3d864f['query']);_0x4330f4[_0x78a8('0x38')]=_['intersection'](_0x3d864f[_0x78a8('0x33')],qs[_0x78a8('0x39')](_0x697e1b[_0x78a8('0x34')][_0x78a8('0x39')]));_0x4330f4[_0x78a8('0x38')]=_0x4330f4['attributes'][_0x78a8('0x3a')]?_0x4330f4[_0x78a8('0x38')]:_0x3d864f['model'];if(_0x697e1b['query']['includeAll']){_0x4330f4[_0x78a8('0x44')]=[{'all':!![]}];}_0x4330f4=_[_0x78a8('0x40')]({},_0x4330f4,_0x697e1b[_0x78a8('0x4a')]);return db[_0x78a8('0x42')][_0x78a8('0x4b')](_0x4330f4)[_0x78a8('0x29')](handleEntityNotFound(_0x5aaf16,null))[_0x78a8('0x29')](respondWithResult(_0x5aaf16,null))[_0x78a8('0x4c')](handleError(_0x5aaf16,null));};exports['create']=function(_0x33183c,_0x36df54){return db[_0x78a8('0x42')]['create'](_0x33183c[_0x78a8('0x4d')],{})[_0x78a8('0x29')](respondWithResult(_0x36df54,0xc9))[_0x78a8('0x4c')](handleError(_0x36df54,null));};exports[_0x78a8('0x28')]=function(_0x2dea72,_0x33f2bb){if(_0x2dea72[_0x78a8('0x4d')]['id']){delete _0x2dea72['body']['id'];}return db[_0x78a8('0x42')]['find']({'where':{'id':_0x2dea72[_0x78a8('0x48')]['id']}})[_0x78a8('0x29')](handleEntityNotFound(_0x33f2bb,null))[_0x78a8('0x29')](saveUpdates(_0x2dea72['body'],null))[_0x78a8('0x29')](respondWithResult(_0x33f2bb,null))['catch'](handleError(_0x33f2bb,null));};exports[_0x78a8('0x2a')]=function(_0x2279e4,_0x56c970){return db[_0x78a8('0x42')][_0x78a8('0x4b')]({'where':{'id':_0x2279e4[_0x78a8('0x48')]['id']}})[_0x78a8('0x29')](handleEntityNotFound(_0x56c970,null))[_0x78a8('0x29')](removeEntity(_0x56c970,null))[_0x78a8('0x4c')](handleError(_0x56c970,null));};exports[_0x78a8('0x4e')]=function(_0x3e1b9a,_0x5921a0){return db[_0x78a8('0x42')][_0x78a8('0x4e')]()['then'](respondWithResult(_0x5921a0,null))[_0x78a8('0x4c')](handleError(_0x5921a0,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 8463afc..65fc176 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 _0xa958=['setMaxListeners','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus'];(function(_0x2179f0,_0x51d2ef){var _0xd585d6=function(_0x2c9f18){while(--_0x2c9f18){_0x2179f0['push'](_0x2179f0['shift']());}};_0xd585d6(++_0x51d2ef);}(_0xa958,0xad));var _0x8a95=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xa958[_0x21549c];return _0x426cbd;};'use strict';var EventEmitter=require(_0x8a95('0x0'));var MailSubstatus=require(_0x8a95('0x1'))['db'][_0x8a95('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x8a95('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x4bb73d){return function(_0x4d1f7b,_0x3911f3,_0x12fb13){MailSubstatusEvents[_0x8a95('0x4')](_0x4bb73d+':'+_0x4d1f7b['id'],_0x4d1f7b);MailSubstatusEvents[_0x8a95('0x4')](_0x4bb73d,_0x4d1f7b);_0x12fb13(null);};}for(var e in events){if(events[_0x8a95('0x5')](e)){var event=events[e];MailSubstatus[_0x8a95('0x6')](e,emitEvent(event));}}module[_0x8a95('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0xe7d1=['emit','hasOwnProperty','hook','events','../../mysqldb','MailSubstatus','setMaxListeners','update'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe7d1,0x10b));var _0x1e7d=function(_0x577f92,_0x613c50){_0x577f92=_0x577f92-0x0;var _0x413ffe=_0xe7d1[_0x577f92];return _0x413ffe;};'use strict';var EventEmitter=require(_0x1e7d('0x0'));var MailSubstatus=require(_0x1e7d('0x1'))['db'][_0x1e7d('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x1e7d('0x3')](0x0);var events={'afterUpdate':_0x1e7d('0x4')};function emitEvent(_0x3ac444){return function(_0x5bcc0c,_0x51ca7a,_0x375435){MailSubstatusEvents[_0x1e7d('0x5')](_0x3ac444+':'+_0x5bcc0c['id'],_0x5bcc0c);MailSubstatusEvents['emit'](_0x3ac444,_0x5bcc0c);_0x375435(null);};}for(var e in events){if(events[_0x1e7d('0x6')](e)){var event=events[e];MailSubstatus[_0x1e7d('0x7')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index d7f22fb..ad5903a 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 _0xf0a8=['name','mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','exports','models','define','MailSubstatus','Condition','update'];(function(_0x3151b8,_0x1503c7){var _0x6427fa=function(_0x1b1180){while(--_0x1b1180){_0x3151b8['push'](_0x3151b8['shift']());}};_0x6427fa(++_0x1503c7);}(_0xf0a8,0xb4));var _0x8f0a=function(_0x147e25,_0x1fee9b){_0x147e25=_0x147e25-0x0;var _0x1ca456=_0xf0a8[_0x147e25];return _0x1ca456;};'use strict';var attributes=require(_0x8f0a('0x0'));module[_0x8f0a('0x1')]=function(_0x308d94){var _0x1b1e93=_0x308d94[_0x8f0a('0x2')];return _0x308d94[_0x8f0a('0x3')](_0x8f0a('0x4'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x223da8,_0x387986,_0x284d21){return _0x1b1e93[_0x8f0a('0x5')][_0x8f0a('0x6')]({'value':_0x223da8[_0x8f0a('0x7')]},{'where':{'field':_0x8f0a('0x8'),'value':_0x223da8[_0x8f0a('0x9')]['name']}})[_0x8f0a('0xa')](function(){_0x284d21();})['catch'](function(_0x290087){_0x284d21(_0x290087);});}}});}; \ No newline at end of file +var _0x541b=['exports','MailSubstatus','mail_substatuses','name','_previousDataValues','then','catch','./mailSubstatus.attributes'];(function(_0x353330,_0x42a477){var _0x44ce3d=function(_0x15e6f1){while(--_0x15e6f1){_0x353330['push'](_0x353330['shift']());}};_0x44ce3d(++_0x42a477);}(_0x541b,0x197));var _0xb541=function(_0x7d5b1b,_0x20e692){_0x7d5b1b=_0x7d5b1b-0x0;var _0x51988c=_0x541b[_0x7d5b1b];return _0x51988c;};'use strict';var attributes=require(_0xb541('0x0'));module[_0xb541('0x1')]=function(_0x42c2ce){var _0x1efbd9=_0x42c2ce['models'];return _0x42c2ce['define'](_0xb541('0x2'),attributes,{'tableName':_0xb541('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xa88d0c,_0x595bd4,_0x29ebc9){return _0x1efbd9['Condition']['update']({'value':_0xa88d0c[_0xb541('0x4')]},{'where':{'field':'mailSubstatus','value':_0xa88d0c[_0xb541('0x5')][_0xb541('0x4')]}})[_0xb541('0x6')](function(){_0x29ebc9();})[_0xb541('0x7')](function(_0x289c9a){_0x29ebc9(_0x289c9a);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 39c65a8..95d6679 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 _0x9439=['client','request','then','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x615527,_0x22a79a){var _0x488003=function(_0x1a0e46){while(--_0x1a0e46){_0x615527['push'](_0x615527['shift']());}};_0x488003(++_0x22a79a);}(_0x9439,0xb4));var _0x9943=function(_0x2e5e9b,_0x5c9a00){_0x2e5e9b=_0x2e5e9b-0x0;var _0x5c3447=_0x9439[_0x2e5e9b];return _0x5c3447;};'use strict';var _=require(_0x9943('0x0'));var util=require('util');var moment=require(_0x9943('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9943('0x2'));var db=require(_0x9943('0x3'))['db'];var utils=require(_0x9943('0x4'));var logger=require(_0x9943('0x5'))(_0x9943('0x6'));var config=require(_0x9943('0x7'));var jayson=require(_0x9943('0x8'));var client=jayson[_0x9943('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a815d,_0x5cdf40,_0x2dbc30){return new BPromise(function(_0x4c997b,_0x3fd4db){return client[_0x9943('0xa')](_0x5a815d,_0x2dbc30)[_0x9943('0xb')](function(_0x108058){logger['info'](_0x9943('0xc'),_0x5cdf40,'request\x20sent');logger[_0x9943('0xd')](_0x9943('0xe'),_0x5cdf40,_0x9943('0xf'),JSON['stringify'](_0x108058));if(_0x108058[_0x9943('0x10')]){if(_0x108058[_0x9943('0x10')][_0x9943('0x11')]===0x1f4){logger[_0x9943('0x10')](_0x9943('0xc'),_0x5cdf40,_0x108058[_0x9943('0x10')][_0x9943('0x12')]);return _0x3fd4db(_0x108058[_0x9943('0x10')]['message']);}logger[_0x9943('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x5cdf40,_0x108058['error']['message']);return _0x4c997b(_0x108058[_0x9943('0x10')][_0x9943('0x12')]);}else{logger[_0x9943('0x13')](_0x9943('0xc'),_0x5cdf40,'request\x20sent');_0x4c997b(_0x108058[_0x9943('0x14')][_0x9943('0x12')]);}})['catch'](function(_0x239cb3){logger[_0x9943('0x10')](_0x9943('0xc'),_0x5cdf40,_0x239cb3);_0x3fd4db(_0x239cb3);});});} \ No newline at end of file +var _0xd22e=['rpc','../../config/environment','client','http','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x411f3b,_0x87a543){var _0x4bc446=function(_0x40170b){while(--_0x40170b){_0x411f3b['push'](_0x411f3b['shift']());}};_0x4bc446(++_0x87a543);}(_0xd22e,0x16d));var _0xed22=function(_0x4dcc68,_0x5bcf40){_0x4dcc68=_0x4dcc68-0x0;var _0x36cf3f=_0xd22e[_0x4dcc68];return _0x36cf3f;};'use strict';var _=require(_0xed22('0x0'));var util=require(_0xed22('0x1'));var moment=require(_0xed22('0x2'));var BPromise=require(_0xed22('0x3'));var rs=require(_0xed22('0x4'));var fs=require('fs');var Redis=require(_0xed22('0x5'));var db=require(_0xed22('0x6'))['db'];var utils=require(_0xed22('0x7'));var logger=require(_0xed22('0x8'))(_0xed22('0x9'));var config=require(_0xed22('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xed22('0xb')][_0xed22('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x541c1e,_0xadecb3,_0x130f05){return new BPromise(function(_0x905a6b,_0x3068c4){return client['request'](_0x541c1e,_0x130f05)[_0xed22('0xd')](function(_0x5bf13d){logger['info'](_0xed22('0xe'),_0xadecb3,_0xed22('0xf'));logger[_0xed22('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0xadecb3,_0xed22('0xf'),JSON[_0xed22('0x11')](_0x5bf13d));if(_0x5bf13d[_0xed22('0x12')]){if(_0x5bf13d[_0xed22('0x12')]['code']===0x1f4){logger[_0xed22('0x12')](_0xed22('0xe'),_0xadecb3,_0x5bf13d[_0xed22('0x12')][_0xed22('0x13')]);return _0x3068c4(_0x5bf13d['error'][_0xed22('0x13')]);}logger[_0xed22('0x12')](_0xed22('0xe'),_0xadecb3,_0x5bf13d[_0xed22('0x12')]['message']);return _0x905a6b(_0x5bf13d[_0xed22('0x12')][_0xed22('0x13')]);}else{logger['info'](_0xed22('0xe'),_0xadecb3,_0xed22('0xf'));_0x905a6b(_0x5bf13d[_0xed22('0x14')]['message']);}})[_0xed22('0x15')](function(_0x3e3c68){logger['error'](_0xed22('0xe'),_0xadecb3,_0x3e3c68);_0x3068c4(_0x3e3c68);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 3d24ab9..f38cc05 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 _0x298c=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','post','create','put','update','exports'];(function(_0x19bf5f,_0x1ca6b9){var _0x237efa=function(_0x18f2a3){while(--_0x18f2a3){_0x19bf5f['push'](_0x19bf5f['shift']());}};_0x237efa(++_0x1ca6b9);}(_0x298c,0x168));var _0xc298=function(_0x592bc8,_0x36c852){_0x592bc8=_0x592bc8-0x0;var _0x4aae09=_0x298c[_0x592bc8];return _0x4aae09;};'use strict';var multer=require(_0xc298('0x0'));var util=require(_0xc298('0x1'));var path=require(_0xc298('0x2'));var timeout=require(_0xc298('0x3'));var express=require(_0xc298('0x4'));var router=express['Router']();var fs_extra=require(_0xc298('0x5'));var auth=require(_0xc298('0x6'));var interaction=require(_0xc298('0x7'));var config=require(_0xc298('0x8'));var controller=require('./mailTransferReport.controller');router[_0xc298('0x9')]('/',auth[_0xc298('0xa')](),controller['index']);router[_0xc298('0x9')](_0xc298('0xb'),auth[_0xc298('0xa')](),controller['describe']);router['get'](_0xc298('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc298('0xd')]('/',auth[_0xc298('0xa')](),controller[_0xc298('0xe')]);router[_0xc298('0xf')](_0xc298('0xc'),auth[_0xc298('0xa')](),controller[_0xc298('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc298('0x11')]=router; \ No newline at end of file +var _0x7892=['/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index','get','isAuthenticated','describe'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x7892,0x8b));var _0x2789=function(_0xe9cd2a,_0x208c97){_0xe9cd2a=_0xe9cd2a-0x0;var _0x24a94a=_0x7892[_0xe9cd2a];return _0x24a94a;};'use strict';var multer=require(_0x2789('0x0'));var util=require(_0x2789('0x1'));var path=require(_0x2789('0x2'));var timeout=require(_0x2789('0x3'));var express=require(_0x2789('0x4'));var router=express[_0x2789('0x5')]();var fs_extra=require(_0x2789('0x6'));var auth=require(_0x2789('0x7'));var interaction=require(_0x2789('0x8'));var config=require(_0x2789('0x9'));var controller=require(_0x2789('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x2789('0xb')]);router[_0x2789('0xc')]('/describe',auth[_0x2789('0xd')](),controller[_0x2789('0xe')]);router['get'](_0x2789('0xf'),auth['isAuthenticated'](),controller[_0x2789('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2789('0x11')](_0x2789('0xf'),auth['isAuthenticated'](),controller[_0x2789('0x12')]);router[_0x2789('0x13')](_0x2789('0xf'),auth['isAuthenticated'](),controller[_0x2789('0x14')]);module[_0x2789('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 5cc5281..f9c46a9 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x471c5b,_0x1c6b75){var _0x40e752=function(_0x41facf){while(--_0x41facf){_0x471c5b['push'](_0x471c5b['shift']());}};_0x40e752(++_0x1c6b75);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5d8631,_0x44944b){_0x5d8631=_0x5d8631-0x0;var _0x34c15e=_0xcb91[_0x5d8631];return _0x34c15e;};'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 +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x2b5b44,_0x17189c){var _0x32cb66=function(_0x4ce183){while(--_0x4ce183){_0x2b5b44['push'](_0x2b5b44['shift']());}};_0x32cb66(++_0x17189c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2efcc5,_0x106a93){_0x2efcc5=_0x2efcc5-0x0;var _0x4376cb=_0x9bde[_0x2efcc5];return _0x4376cb;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 6480fe0..4ca4b97 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 _0x45be=['error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset','count','set','Content-Range','reject','save','update','then','destroy'];(function(_0x38f4c8,_0x3ab116){var _0x226e89=function(_0x17dddc){while(--_0x17dddc){_0x38f4c8['push'](_0x38f4c8['shift']());}};_0x226e89(++_0x3ab116);}(_0x45be,0x72));var _0xe45b=function(_0x308f41,_0x365c40){_0x308f41=_0x308f41-0x0;var _0xcd21c7=_0x45be[_0x308f41];return _0xcd21c7;};'use strict';var emlformat=require(_0xe45b('0x0'));var rimraf=require(_0xe45b('0x1'));var zipdir=require(_0xe45b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe45b('0x3'));var moment=require(_0xe45b('0x4'));var BPromise=require(_0xe45b('0x5'));var Mustache=require('mustache');var util=require(_0xe45b('0x6'));var path=require(_0xe45b('0x7'));var sox=require(_0xe45b('0x8'));var csv=require('to-csv');var ejs=require(_0xe45b('0x9'));var fs=require('fs');var fs_extra=require(_0xe45b('0xa'));var _=require('lodash');var squel=require(_0xe45b('0xb'));var crypto=require(_0xe45b('0xc'));var jsforce=require(_0xe45b('0xd'));var deskjs=require(_0xe45b('0xe'));var toCsv=require(_0xe45b('0xf'));var querystring=require(_0xe45b('0x10'));var Papa=require('papaparse');var Redis=require(_0xe45b('0x11'));var authService=require(_0xe45b('0x12'));var qs=require(_0xe45b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe45b('0x14'));var logger=require('../../config/logger')(_0xe45b('0x15'));var utils=require(_0xe45b('0x16'));var config=require(_0xe45b('0x17'));var licenseUtil=require(_0xe45b('0x18'));var db=require(_0xe45b('0x19'))['db'];function respondWithStatusCode(_0x1fd91b,_0x56aa20){_0x56aa20=_0x56aa20||0xcc;return function(_0x3647f5){if(_0x3647f5){return _0x1fd91b[_0xe45b('0x1a')](_0x56aa20);}return _0x1fd91b[_0xe45b('0x1b')](_0x56aa20)[_0xe45b('0x1c')]();};}function respondWithResult(_0x183172,_0x27a281){_0x27a281=_0x27a281||0xc8;return function(_0x5281a8){if(_0x5281a8){return _0x183172[_0xe45b('0x1b')](_0x27a281)[_0xe45b('0x1d')](_0x5281a8);}};}function respondWithFilteredResult(_0x40ac6f,_0x3020a2){return function(_0x7b4acb){if(_0x7b4acb){var _0x5070c7=typeof _0x3020a2['offset']==='undefined'&&typeof _0x3020a2[_0xe45b('0x1e')]==='undefined';var _0x37c6e5=_0x7b4acb['count'];var _0x56c62a=_0x5070c7?0x0:_0x3020a2[_0xe45b('0x1f')];var _0x2ade51=_0x5070c7?_0x7b4acb[_0xe45b('0x20')]:_0x3020a2[_0xe45b('0x1f')]+_0x3020a2[_0xe45b('0x1e')];var _0xce745;if(_0x2ade51>=_0x37c6e5){_0x2ade51=_0x37c6e5;_0xce745=0xc8;}else{_0xce745=0xce;}_0x40ac6f[_0xe45b('0x1b')](_0xce745);return _0x40ac6f[_0xe45b('0x21')](_0xe45b('0x22'),_0x56c62a+'-'+_0x2ade51+'/'+_0x37c6e5)[_0xe45b('0x1d')](_0x7b4acb);}return null;};}function patchUpdates(_0x170c9b){return function(_0x496d49){try{jsonpatch['apply'](_0x496d49,_0x170c9b,!![]);}catch(_0x215378){return BPromise[_0xe45b('0x23')](_0x215378);}return _0x496d49[_0xe45b('0x24')]();};}function saveUpdates(_0x4fa644,_0x304c85){return function(_0x1bf414){if(_0x1bf414){return _0x1bf414[_0xe45b('0x25')](_0x4fa644)[_0xe45b('0x26')](function(_0x492b4a){return _0x492b4a;});}return null;};}function removeEntity(_0x586acd,_0x43f793){return function(_0x4f93c2){if(_0x4f93c2){return _0x4f93c2[_0xe45b('0x27')]()['then'](function(){_0x586acd[_0xe45b('0x1b')](0xcc)[_0xe45b('0x1c')]();});}};}function handleEntityNotFound(_0x3d03cf,_0x20a23e){return function(_0x146796){if(!_0x146796){_0x3d03cf[_0xe45b('0x1a')](0x194);}return _0x146796;};}function handleError(_0x20a50e,_0x13247f){_0x13247f=_0x13247f||0x1f4;return function(_0x55ba96){logger[_0xe45b('0x28')](_0x55ba96[_0xe45b('0x29')]);if(_0x55ba96[_0xe45b('0x2a')]){delete _0x55ba96[_0xe45b('0x2a')];}_0x20a50e[_0xe45b('0x1b')](_0x13247f)[_0xe45b('0x2b')](_0x55ba96);};}exports[_0xe45b('0x2c')]=function(_0x39313d,_0x768f43){var _0x349ea5={},_0x5f1cd3={},_0x369735={'count':0x0,'rows':[]};var _0x47419e=_[_0xe45b('0x2d')](db[_0xe45b('0x2e')][_0xe45b('0x2f')],function(_0x5ae8a6){return{'name':_0x5ae8a6[_0xe45b('0x30')],'type':_0x5ae8a6[_0xe45b('0x31')][_0xe45b('0x32')]};});_0x5f1cd3[_0xe45b('0x33')]=_[_0xe45b('0x2d')](_0x47419e,_0xe45b('0x2a'));_0x5f1cd3['query']=_['keys'](_0x39313d['query']);_0x5f1cd3[_0xe45b('0x34')]=_['intersection'](_0x5f1cd3['model'],_0x5f1cd3[_0xe45b('0x35')]);_0x349ea5[_0xe45b('0x36')]=_[_0xe45b('0x37')](_0x5f1cd3['model'],qs[_0xe45b('0x38')](_0x39313d[_0xe45b('0x35')][_0xe45b('0x38')]));_0x349ea5[_0xe45b('0x36')]=_0x349ea5['attributes'][_0xe45b('0x39')]?_0x349ea5['attributes']:_0x5f1cd3['model'];if(!_0x39313d[_0xe45b('0x35')][_0xe45b('0x3a')](_0xe45b('0x3b'))){_0x349ea5[_0xe45b('0x1e')]=qs['limit'](_0x39313d[_0xe45b('0x35')][_0xe45b('0x1e')]);_0x349ea5[_0xe45b('0x1f')]=qs[_0xe45b('0x1f')](_0x39313d[_0xe45b('0x35')]['offset']);}_0x349ea5[_0xe45b('0x3c')]=qs[_0xe45b('0x3d')](_0x39313d['query'][_0xe45b('0x3d')]);_0x349ea5[_0xe45b('0x3e')]=qs[_0xe45b('0x34')](_[_0xe45b('0x3f')](_0x39313d[_0xe45b('0x35')],_0x5f1cd3[_0xe45b('0x34')]),_0x47419e);if(_0x39313d['query'][_0xe45b('0x40')]){_0x349ea5[_0xe45b('0x3e')]=_['merge'](_0x349ea5[_0xe45b('0x3e')],{'$or':_[_0xe45b('0x2d')](_0x47419e,function(_0xa296e9){if(_0xa296e9[_0xe45b('0x31')]!=='VIRTUAL'){var _0x2346c9={};_0x2346c9[_0xa296e9[_0xe45b('0x2a')]]={'$like':'%'+_0x39313d[_0xe45b('0x35')]['filter']+'%'};return _0x2346c9;}})});}_0x349ea5=_['merge']({},_0x349ea5,_0x39313d['options']);var _0x54461e={'where':_0x349ea5[_0xe45b('0x3e')]};return db[_0xe45b('0x2e')]['count'](_0x54461e)[_0xe45b('0x26')](function(_0x62962){_0x369735[_0xe45b('0x20')]=_0x62962;if(_0x39313d[_0xe45b('0x35')][_0xe45b('0x41')]){_0x349ea5[_0xe45b('0x42')]=[{'all':!![]}];}return db[_0xe45b('0x2e')][_0xe45b('0x43')](_0x349ea5);})[_0xe45b('0x26')](function(_0x1a55af){_0x369735[_0xe45b('0x44')]=_0x1a55af;return _0x369735;})[_0xe45b('0x26')](respondWithFilteredResult(_0x768f43,_0x349ea5))[_0xe45b('0x45')](handleError(_0x768f43,null));};exports[_0xe45b('0x46')]=function(_0x4d1d5e,_0x395e01){var _0x1f9b6e={'raw':!![],'where':{'id':_0x4d1d5e[_0xe45b('0x47')]['id']}},_0x485d41={};_0x485d41[_0xe45b('0x33')]=_[_0xe45b('0x48')](db['MailTransferReport'][_0xe45b('0x2f')]);_0x485d41[_0xe45b('0x35')]=_['keys'](_0x4d1d5e[_0xe45b('0x35')]);_0x485d41['filters']=_['intersection'](_0x485d41['model'],_0x485d41[_0xe45b('0x35')]);_0x1f9b6e[_0xe45b('0x36')]=_[_0xe45b('0x37')](_0x485d41['model'],qs[_0xe45b('0x38')](_0x4d1d5e[_0xe45b('0x35')][_0xe45b('0x38')]));_0x1f9b6e['attributes']=_0x1f9b6e[_0xe45b('0x36')][_0xe45b('0x39')]?_0x1f9b6e[_0xe45b('0x36')]:_0x485d41[_0xe45b('0x33')];if(_0x4d1d5e[_0xe45b('0x35')][_0xe45b('0x41')]){_0x1f9b6e[_0xe45b('0x42')]=[{'all':!![]}];}_0x1f9b6e=_['merge']({},_0x1f9b6e,_0x4d1d5e['options']);return db['MailTransferReport'][_0xe45b('0x49')](_0x1f9b6e)['then'](handleEntityNotFound(_0x395e01,null))['then'](respondWithResult(_0x395e01,null))[_0xe45b('0x45')](handleError(_0x395e01,null));};exports[_0xe45b('0x4a')]=function(_0x5652b5,_0x4fcccd){return db[_0xe45b('0x2e')][_0xe45b('0x4a')](_0x5652b5['body'],{})[_0xe45b('0x26')](respondWithResult(_0x4fcccd,0xc9))[_0xe45b('0x45')](handleError(_0x4fcccd,null));};exports['update']=function(_0x8ce51c,_0x5eac0a){if(_0x8ce51c['body']['id']){delete _0x8ce51c[_0xe45b('0x4b')]['id'];}return db[_0xe45b('0x2e')][_0xe45b('0x49')]({'where':{'id':_0x8ce51c[_0xe45b('0x47')]['id']}})[_0xe45b('0x26')](handleEntityNotFound(_0x5eac0a,null))[_0xe45b('0x26')](saveUpdates(_0x8ce51c[_0xe45b('0x4b')],null))[_0xe45b('0x26')](respondWithResult(_0x5eac0a,null))[_0xe45b('0x45')](handleError(_0x5eac0a,null));};exports[_0xe45b('0x27')]=function(_0x3dfc3e,_0x25417e){return db['MailTransferReport'][_0xe45b('0x49')]({'where':{'id':_0x3dfc3e[_0xe45b('0x47')]['id']}})[_0xe45b('0x26')](handleEntityNotFound(_0x25417e,null))[_0xe45b('0x26')](removeEntity(_0x25417e,null))[_0xe45b('0x45')](handleError(_0x25417e,null));};exports[_0xe45b('0x4c')]=function(_0x402400,_0x4fb83c){return db['MailTransferReport'][_0xe45b('0x4c')]()[_0xe45b('0x26')](respondWithResult(_0x4fb83c,null))[_0xe45b('0x45')](handleError(_0x4fb83c,null));}; \ No newline at end of file +var _0x3aa3=['intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','error','stack','name','send','map','MailTransferReport','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0x4d2263,_0x3fbf0d){var _0x24aba0=function(_0x389a59){while(--_0x389a59){_0x4d2263['push'](_0x4d2263['shift']());}};_0x24aba0(++_0x3fbf0d);}(_0x3aa3,0x65));var _0x33aa=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0x3aa3[_0x18b5e8];return _0x25baed;};'use strict';var emlformat=require(_0x33aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x33aa('0x1'));var jsonpatch=require(_0x33aa('0x2'));var rp=require(_0x33aa('0x3'));var moment=require(_0x33aa('0x4'));var BPromise=require(_0x33aa('0x5'));var Mustache=require(_0x33aa('0x6'));var util=require(_0x33aa('0x7'));var path=require(_0x33aa('0x8'));var sox=require(_0x33aa('0x9'));var csv=require(_0x33aa('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33aa('0xb'));var _=require('lodash');var squel=require(_0x33aa('0xc'));var crypto=require(_0x33aa('0xd'));var jsforce=require(_0x33aa('0xe'));var deskjs=require(_0x33aa('0xf'));var toCsv=require('to-csv');var querystring=require(_0x33aa('0x10'));var Papa=require(_0x33aa('0x11'));var Redis=require(_0x33aa('0x12'));var authService=require(_0x33aa('0x13'));var qs=require(_0x33aa('0x14'));var as=require(_0x33aa('0x15'));var hardwareService=require(_0x33aa('0x16'));var logger=require(_0x33aa('0x17'))(_0x33aa('0x18'));var utils=require(_0x33aa('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x33aa('0x1a'));var db=require(_0x33aa('0x1b'))['db'];function respondWithStatusCode(_0x29e778,_0x47eb0f){_0x47eb0f=_0x47eb0f||0xcc;return function(_0x57a552){if(_0x57a552){return _0x29e778[_0x33aa('0x1c')](_0x47eb0f);}return _0x29e778[_0x33aa('0x1d')](_0x47eb0f)[_0x33aa('0x1e')]();};}function respondWithResult(_0x4db4ac,_0x54b38b){_0x54b38b=_0x54b38b||0xc8;return function(_0x551b7e){if(_0x551b7e){return _0x4db4ac[_0x33aa('0x1d')](_0x54b38b)[_0x33aa('0x1f')](_0x551b7e);}};}function respondWithFilteredResult(_0x38d34a,_0x6448c7){return function(_0x127ace){if(_0x127ace){var _0xbce308=typeof _0x6448c7['offset']===_0x33aa('0x20')&&typeof _0x6448c7[_0x33aa('0x21')]===_0x33aa('0x20');var _0x2c1dd6=_0x127ace[_0x33aa('0x22')];var _0x547f86=_0xbce308?0x0:_0x6448c7[_0x33aa('0x23')];var _0x165a17=_0xbce308?_0x127ace[_0x33aa('0x22')]:_0x6448c7['offset']+_0x6448c7['limit'];var _0x3b6f95;if(_0x165a17>=_0x2c1dd6){_0x165a17=_0x2c1dd6;_0x3b6f95=0xc8;}else{_0x3b6f95=0xce;}_0x38d34a[_0x33aa('0x1d')](_0x3b6f95);return _0x38d34a[_0x33aa('0x24')]('Content-Range',_0x547f86+'-'+_0x165a17+'/'+_0x2c1dd6)['json'](_0x127ace);}return null;};}function patchUpdates(_0x448131){return function(_0x31ce54){try{jsonpatch[_0x33aa('0x25')](_0x31ce54,_0x448131,!![]);}catch(_0x1bd80e){return BPromise['reject'](_0x1bd80e);}return _0x31ce54[_0x33aa('0x26')]();};}function saveUpdates(_0x4a5823,_0x45fe8a){return function(_0x4ce879){if(_0x4ce879){return _0x4ce879[_0x33aa('0x27')](_0x4a5823)[_0x33aa('0x28')](function(_0x5b5a33){return _0x5b5a33;});}return null;};}function removeEntity(_0x168f94,_0x57d6ac){return function(_0x3e3bde){if(_0x3e3bde){return _0x3e3bde[_0x33aa('0x29')]()['then'](function(){_0x168f94[_0x33aa('0x1d')](0xcc)[_0x33aa('0x1e')]();});}};}function handleEntityNotFound(_0x28247f,_0x2d0428){return function(_0x4ce725){if(!_0x4ce725){_0x28247f['sendStatus'](0x194);}return _0x4ce725;};}function handleError(_0x141392,_0x56c5a2){_0x56c5a2=_0x56c5a2||0x1f4;return function(_0x4e092f){logger[_0x33aa('0x2a')](_0x4e092f[_0x33aa('0x2b')]);if(_0x4e092f[_0x33aa('0x2c')]){delete _0x4e092f[_0x33aa('0x2c')];}_0x141392['status'](_0x56c5a2)[_0x33aa('0x2d')](_0x4e092f);};}exports['index']=function(_0x3bde95,_0x7ac34e){var _0x9db263={},_0x1967f7={},_0x31f106={'count':0x0,'rows':[]};var _0x8cd462=_[_0x33aa('0x2e')](db[_0x33aa('0x2f')][_0x33aa('0x30')],function(_0x3691ae){return{'name':_0x3691ae[_0x33aa('0x31')],'type':_0x3691ae['type'][_0x33aa('0x32')]};});_0x1967f7[_0x33aa('0x33')]=_[_0x33aa('0x2e')](_0x8cd462,'name');_0x1967f7[_0x33aa('0x34')]=_[_0x33aa('0x35')](_0x3bde95[_0x33aa('0x34')]);_0x1967f7[_0x33aa('0x36')]=_[_0x33aa('0x37')](_0x1967f7[_0x33aa('0x33')],_0x1967f7['query']);_0x9db263[_0x33aa('0x38')]=_[_0x33aa('0x37')](_0x1967f7['model'],qs[_0x33aa('0x39')](_0x3bde95[_0x33aa('0x34')][_0x33aa('0x39')]));_0x9db263[_0x33aa('0x38')]=_0x9db263['attributes'][_0x33aa('0x3a')]?_0x9db263[_0x33aa('0x38')]:_0x1967f7[_0x33aa('0x33')];if(!_0x3bde95['query'][_0x33aa('0x3b')](_0x33aa('0x3c'))){_0x9db263[_0x33aa('0x21')]=qs[_0x33aa('0x21')](_0x3bde95[_0x33aa('0x34')][_0x33aa('0x21')]);_0x9db263['offset']=qs['offset'](_0x3bde95['query'][_0x33aa('0x23')]);}_0x9db263['order']=qs['sort'](_0x3bde95[_0x33aa('0x34')][_0x33aa('0x3d')]);_0x9db263[_0x33aa('0x3e')]=qs[_0x33aa('0x36')](_['pick'](_0x3bde95[_0x33aa('0x34')],_0x1967f7[_0x33aa('0x36')]),_0x8cd462);if(_0x3bde95[_0x33aa('0x34')][_0x33aa('0x3f')]){_0x9db263[_0x33aa('0x3e')]=_[_0x33aa('0x40')](_0x9db263['where'],{'$or':_[_0x33aa('0x2e')](_0x8cd462,function(_0x328cd8){if(_0x328cd8[_0x33aa('0x41')]!==_0x33aa('0x42')){var _0x246ae9={};_0x246ae9[_0x328cd8[_0x33aa('0x2c')]]={'$like':'%'+_0x3bde95[_0x33aa('0x34')][_0x33aa('0x3f')]+'%'};return _0x246ae9;}})});}_0x9db263=_[_0x33aa('0x40')]({},_0x9db263,_0x3bde95[_0x33aa('0x43')]);var _0x528ac5={'where':_0x9db263[_0x33aa('0x3e')]};return db['MailTransferReport'][_0x33aa('0x22')](_0x528ac5)[_0x33aa('0x28')](function(_0x110386){_0x31f106[_0x33aa('0x22')]=_0x110386;if(_0x3bde95[_0x33aa('0x34')][_0x33aa('0x44')]){_0x9db263[_0x33aa('0x45')]=[{'all':!![]}];}return db['MailTransferReport'][_0x33aa('0x46')](_0x9db263);})['then'](function(_0x5315b4){_0x31f106[_0x33aa('0x47')]=_0x5315b4;return _0x31f106;})['then'](respondWithFilteredResult(_0x7ac34e,_0x9db263))['catch'](handleError(_0x7ac34e,null));};exports['show']=function(_0x1dd23c,_0x15e92e){var _0x324187={'raw':!![],'where':{'id':_0x1dd23c[_0x33aa('0x48')]['id']}},_0x4514bc={};_0x4514bc['model']=_['keys'](db[_0x33aa('0x2f')][_0x33aa('0x30')]);_0x4514bc['query']=_['keys'](_0x1dd23c['query']);_0x4514bc[_0x33aa('0x36')]=_[_0x33aa('0x37')](_0x4514bc[_0x33aa('0x33')],_0x4514bc['query']);_0x324187[_0x33aa('0x38')]=_[_0x33aa('0x37')](_0x4514bc[_0x33aa('0x33')],qs['fields'](_0x1dd23c[_0x33aa('0x34')]['fields']));_0x324187[_0x33aa('0x38')]=_0x324187[_0x33aa('0x38')][_0x33aa('0x3a')]?_0x324187[_0x33aa('0x38')]:_0x4514bc[_0x33aa('0x33')];if(_0x1dd23c[_0x33aa('0x34')]['includeAll']){_0x324187[_0x33aa('0x45')]=[{'all':!![]}];}_0x324187=_[_0x33aa('0x40')]({},_0x324187,_0x1dd23c[_0x33aa('0x43')]);return db[_0x33aa('0x2f')]['find'](_0x324187)[_0x33aa('0x28')](handleEntityNotFound(_0x15e92e,null))[_0x33aa('0x28')](respondWithResult(_0x15e92e,null))[_0x33aa('0x49')](handleError(_0x15e92e,null));};exports[_0x33aa('0x4a')]=function(_0x28dac2,_0x996bc4){return db[_0x33aa('0x2f')][_0x33aa('0x4a')](_0x28dac2[_0x33aa('0x4b')],{})['then'](respondWithResult(_0x996bc4,0xc9))['catch'](handleError(_0x996bc4,null));};exports[_0x33aa('0x27')]=function(_0x56b9b4,_0x53e045){if(_0x56b9b4[_0x33aa('0x4b')]['id']){delete _0x56b9b4[_0x33aa('0x4b')]['id'];}return db[_0x33aa('0x2f')][_0x33aa('0x4c')]({'where':{'id':_0x56b9b4[_0x33aa('0x48')]['id']}})[_0x33aa('0x28')](handleEntityNotFound(_0x53e045,null))[_0x33aa('0x28')](saveUpdates(_0x56b9b4[_0x33aa('0x4b')],null))[_0x33aa('0x28')](respondWithResult(_0x53e045,null))[_0x33aa('0x49')](handleError(_0x53e045,null));};exports[_0x33aa('0x29')]=function(_0x4fb976,_0x53c29f){return db[_0x33aa('0x2f')][_0x33aa('0x4c')]({'where':{'id':_0x4fb976[_0x33aa('0x48')]['id']}})[_0x33aa('0x28')](handleEntityNotFound(_0x53c29f,null))[_0x33aa('0x28')](removeEntity(_0x53c29f,null))['catch'](handleError(_0x53c29f,null));};exports[_0x33aa('0x4d')]=function(_0x12a9b2,_0x3b2051){return db[_0x33aa('0x2f')][_0x33aa('0x4d')]()[_0x33aa('0x28')](respondWithResult(_0x3b2051,null))[_0x33aa('0x49')](handleError(_0x3b2051,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 0a7a7f4..73c6903 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 _0x38fb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x1462c1,_0xb8199c){var _0xdd8da=function(_0x48f4e8){while(--_0x48f4e8){_0x1462c1['push'](_0x1462c1['shift']());}};_0xdd8da(++_0xb8199c);}(_0x38fb,0x1b0));var _0xb38f=function(_0x4ecd76,_0x79f1f3){_0x4ecd76=_0x4ecd76-0x0;var _0x240f34=_0x38fb[_0x4ecd76];return _0x240f34;};'use strict';var _=require(_0xb38f('0x0'));var util=require(_0xb38f('0x1'));var logger=require(_0xb38f('0x2'))(_0xb38f('0x3'));var moment=require(_0xb38f('0x4'));var BPromise=require(_0xb38f('0x5'));var rp=require(_0xb38f('0x6'));var fs=require('fs');var path=require(_0xb38f('0x7'));var rimraf=require(_0xb38f('0x8'));var config=require(_0xb38f('0x9'));var attributes=require(_0xb38f('0xa'));module[_0xb38f('0xb')]=function(_0x4674f7,_0x3ad4be){return _0x4674f7[_0xb38f('0xc')](_0xb38f('0xd'),attributes,{'tableName':_0xb38f('0xe'),'paranoid':![],'indexes':[{'name':_0xb38f('0xf'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x761e=['../../config/logger','api','moment','bluebird','request-promise','path','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0x761e,0x14e));var _0xe761=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x761e[_0x51fe5f];return _0x4abce9;};'use strict';var _=require(_0xe761('0x0'));var util=require(_0xe761('0x1'));var logger=require(_0xe761('0x2'))(_0xe761('0x3'));var moment=require(_0xe761('0x4'));var BPromise=require(_0xe761('0x5'));var rp=require(_0xe761('0x6'));var fs=require('fs');var path=require(_0xe761('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe761('0x8'));module[_0xe761('0x9')]=function(_0x4c35b7,_0xbe7b6d){return _0x4c35b7[_0xe761('0xa')](_0xe761('0xb'),attributes,{'tableName':_0xe761('0xc'),'paranoid':![],'indexes':[{'name':_0xe761('0xd'),'fields':[_0xe761('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index e86f16f..3531ba0 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 _0x2973=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','MailTransferReport,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x37e25,_0x31c389){var _0xc05dfd=function(_0x5d2055){while(--_0x5d2055){_0x37e25['push'](_0x37e25['shift']());}};_0xc05dfd(++_0x31c389);}(_0x2973,0x1dc));var _0x3297=function(_0xdd45,_0x2daf10){_0xdd45=_0xdd45-0x0;var _0x106736=_0x2973[_0xdd45];return _0x106736;};'use strict';var _=require(_0x3297('0x0'));var util=require(_0x3297('0x1'));var moment=require(_0x3297('0x2'));var BPromise=require(_0x3297('0x3'));var rs=require(_0x3297('0x4'));var fs=require('fs');var Redis=require(_0x3297('0x5'));var db=require(_0x3297('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3297('0x7'))(_0x3297('0x8'));var config=require(_0x3297('0x9'));var jayson=require(_0x3297('0xa'));var client=jayson[_0x3297('0xb')][_0x3297('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54bc37,_0x9bfef8,_0x432299){return new BPromise(function(_0x45cb53,_0x29d2c4){return client['request'](_0x54bc37,_0x432299)[_0x3297('0xd')](function(_0x237b38){logger[_0x3297('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x9bfef8,_0x3297('0xf'));logger[_0x3297('0x10')](_0x3297('0x11'),_0x9bfef8,'request\x20sent',JSON['stringify'](_0x237b38));if(_0x237b38[_0x3297('0x12')]){if(_0x237b38['error'][_0x3297('0x13')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x9bfef8,_0x237b38[_0x3297('0x12')][_0x3297('0x14')]);return _0x29d2c4(_0x237b38[_0x3297('0x12')]['message']);}logger[_0x3297('0x12')](_0x3297('0x15'),_0x9bfef8,_0x237b38['error']['message']);return _0x45cb53(_0x237b38[_0x3297('0x12')][_0x3297('0x14')]);}else{logger['info'](_0x3297('0x15'),_0x9bfef8,_0x3297('0xf'));_0x45cb53(_0x237b38['result'][_0x3297('0x14')]);}})['catch'](function(_0x40c5f1){logger['error'](_0x3297('0x15'),_0x9bfef8,_0x40c5f1);_0x29d2c4(_0x40c5f1);});});} \ No newline at end of file +var _0x7181=['../../config/environment','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5a7dd3,_0x26b7cf){var _0x2f4d07=function(_0x280510){while(--_0x280510){_0x5a7dd3['push'](_0x5a7dd3['shift']());}};_0x2f4d07(++_0x26b7cf);}(_0x7181,0xb1));var _0x1718=function(_0x2e33d3,_0x4375d2){_0x2e33d3=_0x2e33d3-0x0;var _0x5cd87d=_0x7181[_0x2e33d3];return _0x5cd87d;};'use strict';var _=require('lodash');var util=require(_0x1718('0x0'));var moment=require('moment');var BPromise=require(_0x1718('0x1'));var rs=require(_0x1718('0x2'));var fs=require('fs');var Redis=require(_0x1718('0x3'));var db=require(_0x1718('0x4'))['db'];var utils=require(_0x1718('0x5'));var logger=require('../../config/logger')(_0x1718('0x6'));var config=require(_0x1718('0x7'));var jayson=require(_0x1718('0x8'));var client=jayson[_0x1718('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ba5a5,_0x87b910,_0x10c076){return new BPromise(function(_0x5dc8c4,_0x3ec935){return client[_0x1718('0xa')](_0x1ba5a5,_0x10c076)[_0x1718('0xb')](function(_0x273550){logger[_0x1718('0xc')](_0x1718('0xd'),_0x87b910,_0x1718('0xe'));logger[_0x1718('0xf')](_0x1718('0x10'),_0x87b910,_0x1718('0xe'),JSON[_0x1718('0x11')](_0x273550));if(_0x273550[_0x1718('0x12')]){if(_0x273550[_0x1718('0x12')][_0x1718('0x13')]===0x1f4){logger[_0x1718('0x12')](_0x1718('0xd'),_0x87b910,_0x273550[_0x1718('0x12')]['message']);return _0x3ec935(_0x273550[_0x1718('0x12')][_0x1718('0x14')]);}logger[_0x1718('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x87b910,_0x273550['error']['message']);return _0x5dc8c4(_0x273550[_0x1718('0x12')][_0x1718('0x14')]);}else{logger['info'](_0x1718('0xd'),_0x87b910,'request\x20sent');_0x5dc8c4(_0x273550[_0x1718('0x15')][_0x1718('0x14')]);}})[_0x1718('0x16')](function(_0x36702e){logger[_0x1718('0x12')](_0x1718('0xd'),_0x87b910,_0x36702e);_0x3ec935(_0x36702e);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 6228473..69a8ce2 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 _0x796a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','update','delete','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x796a,0x126));var _0xa796=function(_0x329406,_0x34ff27){_0x329406=_0x329406-0x0;var _0x42176f=_0x796a[_0x329406];return _0x42176f;};'use strict';var multer=require(_0xa796('0x0'));var util=require(_0xa796('0x1'));var path=require(_0xa796('0x2'));var timeout=require(_0xa796('0x3'));var express=require('express');var router=express[_0xa796('0x4')]();var fs_extra=require(_0xa796('0x5'));var auth=require(_0xa796('0x6'));var interaction=require(_0xa796('0x7'));var config=require(_0xa796('0x8'));var controller=require(_0xa796('0x9'));router[_0xa796('0xa')]('/',auth['isAuthenticated'](),controller[_0xa796('0xb')]);router[_0xa796('0xa')](_0xa796('0xc'),auth[_0xa796('0xd')](),controller[_0xa796('0xe')]);router['get'](_0xa796('0xf'),auth[_0xa796('0xd')](),controller[_0xa796('0x10')]);router[_0xa796('0x11')]('/',auth[_0xa796('0xd')](),controller['create']);router['put'](_0xa796('0xf'),auth[_0xa796('0xd')](),controller[_0xa796('0x12')]);router[_0xa796('0x13')](_0xa796('0xf'),auth[_0xa796('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5dc6=['Router','fs-extra','isAuthenticated','index','/:id','show','create','destroy','exports','util','path','connect-timeout','express'];(function(_0x1833a4,_0xc92fb4){var _0x2108a5=function(_0x666dce){while(--_0x666dce){_0x1833a4['push'](_0x1833a4['shift']());}};_0x2108a5(++_0xc92fb4);}(_0x5dc6,0x127));var _0x65dc=function(_0xa9cf1e,_0x2a2c9f){_0xa9cf1e=_0xa9cf1e-0x0;var _0x4a1735=_0x5dc6[_0xa9cf1e];return _0x4a1735;};'use strict';var multer=require('multer');var util=require(_0x65dc('0x0'));var path=require(_0x65dc('0x1'));var timeout=require(_0x65dc('0x2'));var express=require(_0x65dc('0x3'));var router=express[_0x65dc('0x4')]();var fs_extra=require(_0x65dc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./memberReport.controller');router['get']('/',auth[_0x65dc('0x6')](),controller[_0x65dc('0x7')]);router['get']('/describe',auth[_0x65dc('0x6')](),controller['describe']);router['get'](_0x65dc('0x8'),auth['isAuthenticated'](),controller[_0x65dc('0x9')]);router['post']('/',auth[_0x65dc('0x6')](),controller[_0x65dc('0xa')]);router['put'](_0x65dc('0x8'),auth[_0x65dc('0x6')](),controller['update']);router['delete'](_0x65dc('0x8'),auth[_0x65dc('0x6')](),controller[_0x65dc('0xb')]);module[_0x65dc('0xc')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 50d0408..1acf303 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 _0x6788=['exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','getDataValue','enterAt','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment'];(function(_0x2d7ece,_0x51ad56){var _0x35cf28=function(_0x2da2b5){while(--_0x2da2b5){_0x2d7ece['push'](_0x2d7ece['shift']());}};_0x35cf28(++_0x51ad56);}(_0x6788,0x15e));var _0x8678=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6788[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x8678('0x0'));var moment=require(_0x8678('0x1'));module[_0x8678('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8678('0x3')]},'interface':{'type':Sequelize[_0x8678('0x3')]},'type':{'type':Sequelize[_0x8678('0x3')],'defaultValue':_0x8678('0x4'),'comment':_0x8678('0x5')},'duration':{'type':Sequelize[_0x8678('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x242230){var _0x1028f7=moment(_0x242230);var _0x4d015f=moment(this[_0x8678('0x7')](_0x8678('0x8')));var _0x11f432=_0x1028f7['diff'](_0x4d015f,_0x8678('0x9'));this[_0x8678('0xa')](_0x8678('0xb'),_0x242230);this['setDataValue'](_0x8678('0xc'),_0x11f432>=0x0?_0x11f432:null);}},'data1':{'type':Sequelize[_0x8678('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0x8678('0xd')},'data3':{'type':Sequelize[_0x8678('0x3')],'comment':_0x8678('0xe')},'data4':{'type':Sequelize[_0x8678('0x3')],'comment':_0x8678('0xf')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x8678('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x8678('0x3')]}}; \ No newline at end of file +var _0xb676=['moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','INTEGER','sequelize'];(function(_0x3c04ef,_0x9d110c){var _0x6a3a69=function(_0x333514){while(--_0x333514){_0x3c04ef['push'](_0x3c04ef['shift']());}};_0x6a3a69(++_0x9d110c);}(_0xb676,0x1bf));var _0x6b67=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xb676[_0x10004e];return _0x5af990;};'use strict';var Sequelize=require(_0x6b67('0x0'));var moment=require(_0x6b67('0x1'));module[_0x6b67('0x2')]={'channel':{'type':Sequelize[_0x6b67('0x3')]},'membername':{'type':Sequelize[_0x6b67('0x3')]},'interface':{'type':Sequelize[_0x6b67('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x6b67('0x4'),'comment':_0x6b67('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x6b67('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x40ae92){var _0x100c26=moment(_0x40ae92);var _0x108bb5=moment(this[_0x6b67('0x7')]('enterAt'));var _0x10225f=_0x100c26['diff'](_0x108bb5,_0x6b67('0x8'));this[_0x6b67('0x9')](_0x6b67('0xa'),_0x40ae92);this[_0x6b67('0x9')](_0x6b67('0xb'),_0x10225f>=0x0?_0x10225f:null);}},'data1':{'type':Sequelize[_0x6b67('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0x6b67('0xc')},'data3':{'type':Sequelize[_0x6b67('0x3')],'comment':_0x6b67('0xd')},'data4':{'type':Sequelize[_0x6b67('0x3')],'comment':_0x6b67('0xe')},'data5':{'type':Sequelize[_0x6b67('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x6b67('0x3')]},'internal':{'type':Sequelize[_0x6b67('0xf')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 92500a5..d7d17f3 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x49bf3c,_0x52edfd){var _0x504669=function(_0x31972e){while(--_0x31972e){_0x49bf3c['push'](_0x49bf3c['shift']());}};_0x504669(++_0x52edfd);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _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(_0x335b77,_0x273122){var _0x27114a=function(_0x558285){while(--_0x558285){_0x335b77['push'](_0x335b77['shift']());}};_0x27114a(++_0x273122);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 80ae1aa..3eaf77d 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 _0xaa3f=['bluebird','request-promise','path','rimraf','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment'];(function(_0x405713,_0x3e8b58){var _0x2c4af0=function(_0x569ae2){while(--_0x569ae2){_0x405713['push'](_0x405713['shift']());}};_0x2c4af0(++_0x3e8b58);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x5ee1b7,_0x37d873){_0x5ee1b7=_0x5ee1b7-0x0;var _0x12ada3=_0xaa3f[_0x5ee1b7];return _0x12ada3;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var logger=require(_0xfaa3('0x2'))(_0xfaa3('0x3'));var moment=require(_0xfaa3('0x4'));var BPromise=require(_0xfaa3('0x5'));var rp=require(_0xfaa3('0x6'));var fs=require('fs');var path=require(_0xfaa3('0x7'));var rimraf=require(_0xfaa3('0x8'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0xfaa3('0x9')]=function(_0x4bac92,_0x3d09aa){return _0x4bac92[_0xfaa3('0xa')](_0xfaa3('0xb'),attributes,{'tableName':_0xfaa3('0xc'),'paranoid':![],'indexes':[{'name':_0xfaa3('0xd'),'fields':[_0xfaa3('0xe'),_0xfaa3('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc741=['util','../../config/logger','bluebird','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','lodash'];(function(_0x3b27b4,_0xad209e){var _0x5eb3b4=function(_0x50770f){while(--_0x50770f){_0x3b27b4['push'](_0x3b27b4['shift']());}};_0x5eb3b4(++_0xad209e);}(_0xc741,0x137));var _0x1c74=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xc741[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0x1c74('0x0'));var util=require(_0x1c74('0x1'));var logger=require(_0x1c74('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1c74('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1c74('0x4'));var config=require(_0x1c74('0x5'));var attributes=require(_0x1c74('0x6'));module['exports']=function(_0x33d3d2,_0x5adecc){return _0x33d3d2[_0x1c74('0x7')](_0x1c74('0x8'),attributes,{'tableName':_0x1c74('0x9'),'paranoid':![],'indexes':[{'name':_0x1c74('0xa'),'fields':[_0x1c74('0xb'),_0x1c74('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 6ee93cd..1e518e6 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 _0x9ca0=['MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','limit','include','map','model','attributes','create','body','CreateMemberReport','UpdateMemberReport','update','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','then'];(function(_0xac4b08,_0x5596f4){var _0x4ce998=function(_0xdc22e9){while(--_0xdc22e9){_0xac4b08['push'](_0xac4b08['shift']());}};_0x4ce998(++_0x5596f4);}(_0x9ca0,0x65));var _0x09ca=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x9ca0[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x09ca('0x0'));var util=require(_0x09ca('0x1'));var moment=require(_0x09ca('0x2'));var BPromise=require('bluebird');var rs=require(_0x09ca('0x3'));var fs=require('fs');var Redis=require(_0x09ca('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x09ca('0x5'));var logger=require(_0x09ca('0x6'))('rpc');var config=require(_0x09ca('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x09ca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f8649,_0x3bf4d9,_0x224661){return new BPromise(function(_0x35e94d,_0x498d91){return client['request'](_0x1f8649,_0x224661)[_0x09ca('0x9')](function(_0x44b875){logger['info'](_0x09ca('0xa'),_0x3bf4d9,_0x09ca('0xb'));logger[_0x09ca('0xc')](_0x09ca('0xd'),_0x3bf4d9,_0x09ca('0xb'),JSON[_0x09ca('0xe')](_0x44b875));if(_0x44b875['error']){if(_0x44b875[_0x09ca('0xf')][_0x09ca('0x10')]===0x1f4){logger['error'](_0x09ca('0xa'),_0x3bf4d9,_0x44b875['error'][_0x09ca('0x11')]);return _0x498d91(_0x44b875[_0x09ca('0xf')][_0x09ca('0x11')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x3bf4d9,_0x44b875[_0x09ca('0xf')][_0x09ca('0x11')]);return _0x35e94d(_0x44b875['error'][_0x09ca('0x11')]);}else{logger[_0x09ca('0x12')](_0x09ca('0xa'),_0x3bf4d9,_0x09ca('0xb'));_0x35e94d(_0x44b875[_0x09ca('0x13')][_0x09ca('0x11')]);}})[_0x09ca('0x14')](function(_0x118c6c){logger[_0x09ca('0xf')](_0x09ca('0xa'),_0x3bf4d9,_0x118c6c);_0x498d91(_0x118c6c);});});}exports[_0x09ca('0x15')]=function(_0x3d8f28){var _0x53ecd4=this;return new Promise(function(_0x62be0c,_0x23c9ea){return db[_0x09ca('0x16')][_0x09ca('0x17')]({'raw':_0x3d8f28[_0x09ca('0x18')]?_0x3d8f28[_0x09ca('0x18')][_0x09ca('0x19')]===undefined?!![]:![]:!![],'where':_0x3d8f28[_0x09ca('0x18')]?_0x3d8f28['options'][_0x09ca('0x1a')]||null:null,'attributes':_0x3d8f28[_0x09ca('0x18')]?_0x3d8f28[_0x09ca('0x18')]['attributes']||null:null,'limit':_0x3d8f28[_0x09ca('0x18')]?_0x3d8f28[_0x09ca('0x18')][_0x09ca('0x1b')]||null:null,'include':_0x3d8f28[_0x09ca('0x18')]?_0x3d8f28['options'][_0x09ca('0x1c')]?_[_0x09ca('0x1d')](_0x3d8f28[_0x09ca('0x18')][_0x09ca('0x1c')],function(_0x44f036){return{'model':db[_0x44f036[_0x09ca('0x1e')]],'as':_0x44f036['as'],'attributes':_0x44f036[_0x09ca('0x1f')],'include':_0x44f036['include']?_[_0x09ca('0x1d')](_0x44f036[_0x09ca('0x1c')],function(_0x459822){return{'model':db[_0x459822[_0x09ca('0x1e')]],'as':_0x459822['as'],'attributes':_0x459822[_0x09ca('0x1f')],'include':_0x459822[_0x09ca('0x1c')]?_[_0x09ca('0x1d')](_0x459822[_0x09ca('0x1c')],function(_0x576466){return{'model':db[_0x576466[_0x09ca('0x1e')]],'as':_0x576466['as'],'attributes':_0x576466[_0x09ca('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x09ca('0x9')](function(_0x4b3da5){logger['info'](_0x09ca('0x15'),_0x3d8f28);logger[_0x09ca('0xc')](_0x09ca('0x15'),_0x3d8f28,JSON[_0x09ca('0xe')](_0x4b3da5));_0x62be0c(_0x4b3da5);})['catch'](function(_0x2d2f54){logger['error'](_0x09ca('0x15'),_0x2d2f54[_0x09ca('0x11')],_0x3d8f28);_0x23c9ea(_0x53ecd4[_0x09ca('0xf')](0x1f4,_0x2d2f54['message']));});});};exports['CreateMemberReport']=function(_0x2d6280){var _0x476134=this;return new Promise(function(_0x4b5f00,_0x490dc4){return db[_0x09ca('0x16')][_0x09ca('0x20')](_0x2d6280[_0x09ca('0x21')],{'raw':_0x2d6280[_0x09ca('0x18')]?_0x2d6280[_0x09ca('0x18')][_0x09ca('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xbeec46){logger['info'](_0x09ca('0x22'),_0x2d6280);logger[_0x09ca('0xc')](_0x09ca('0x22'),_0x2d6280,JSON['stringify'](_0xbeec46));_0x4b5f00(_0xbeec46);})[_0x09ca('0x14')](function(_0x53f472){logger[_0x09ca('0xf')]('CreateMemberReport',_0x53f472[_0x09ca('0x11')],_0x2d6280);_0x490dc4(_0x476134[_0x09ca('0xf')](0x1f4,_0x53f472['message']));});});};exports[_0x09ca('0x23')]=function(_0x11cb3b){var _0x46f089=this;return new Promise(function(_0x4e1dd9,_0x3ae5de){return db[_0x09ca('0x16')][_0x09ca('0x24')](_0x11cb3b[_0x09ca('0x21')],{'raw':_0x11cb3b['options']?_0x11cb3b[_0x09ca('0x18')][_0x09ca('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11cb3b[_0x09ca('0x18')]?_0x11cb3b[_0x09ca('0x18')]['where']||null:null,'attributes':_0x11cb3b[_0x09ca('0x18')]?_0x11cb3b['options']['attributes']||null:null,'limit':_0x11cb3b[_0x09ca('0x18')]?_0x11cb3b['options'][_0x09ca('0x1b')]||null:null})[_0x09ca('0x9')](function(_0x10fcb7){logger[_0x09ca('0x12')]('UpdateMemberReport',_0x11cb3b);logger[_0x09ca('0xc')]('UpdateMemberReport',_0x11cb3b,JSON['stringify'](_0x10fcb7));_0x4e1dd9(_0x10fcb7);})[_0x09ca('0x14')](function(_0x140f70){logger['error'](_0x09ca('0x23'),_0x140f70[_0x09ca('0x11')],_0x11cb3b);_0x3ae5de(_0x46f089['error'](0x1f4,_0x140f70[_0x09ca('0x11')]));});});}; \ No newline at end of file +var _0x3c6c=['raw','where','attributes','limit','include','map','model','CreateMemberReport','create','body','UpdateMemberReport','MemberReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMemberReport','findAll','options'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x4b7eec,_0x55aa9c){_0x4b7eec=_0x4b7eec-0x0;var _0x2aabd6=_0x3c6c[_0x4b7eec];return _0x2aabd6;};'use strict';var _=require(_0xc3c6('0x0'));var util=require('util');var moment=require(_0xc3c6('0x1'));var BPromise=require(_0xc3c6('0x2'));var rs=require(_0xc3c6('0x3'));var fs=require('fs');var Redis=require(_0xc3c6('0x4'));var db=require(_0xc3c6('0x5'))['db'];var utils=require(_0xc3c6('0x6'));var logger=require(_0xc3c6('0x7'))(_0xc3c6('0x8'));var config=require('../../config/environment');var jayson=require(_0xc3c6('0x9'));var client=jayson['client'][_0xc3c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d7ae6,_0x50cd05,_0x4aed87){return new BPromise(function(_0x5185c3,_0x4f39dd){return client[_0xc3c6('0xb')](_0x4d7ae6,_0x4aed87)[_0xc3c6('0xc')](function(_0x5bc1c1){logger[_0xc3c6('0xd')](_0xc3c6('0xe'),_0x50cd05,_0xc3c6('0xf'));logger[_0xc3c6('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x50cd05,_0xc3c6('0xf'),JSON[_0xc3c6('0x11')](_0x5bc1c1));if(_0x5bc1c1[_0xc3c6('0x12')]){if(_0x5bc1c1['error']['code']===0x1f4){logger[_0xc3c6('0x12')](_0xc3c6('0xe'),_0x50cd05,_0x5bc1c1[_0xc3c6('0x12')][_0xc3c6('0x13')]);return _0x4f39dd(_0x5bc1c1[_0xc3c6('0x12')][_0xc3c6('0x13')]);}logger[_0xc3c6('0x12')](_0xc3c6('0xe'),_0x50cd05,_0x5bc1c1[_0xc3c6('0x12')][_0xc3c6('0x13')]);return _0x5185c3(_0x5bc1c1[_0xc3c6('0x12')][_0xc3c6('0x13')]);}else{logger[_0xc3c6('0xd')](_0xc3c6('0xe'),_0x50cd05,_0xc3c6('0xf'));_0x5185c3(_0x5bc1c1[_0xc3c6('0x14')][_0xc3c6('0x13')]);}})[_0xc3c6('0x15')](function(_0x33920c){logger[_0xc3c6('0x12')](_0xc3c6('0xe'),_0x50cd05,_0x33920c);_0x4f39dd(_0x33920c);});});}exports[_0xc3c6('0x16')]=function(_0x26c9b0){var _0x11df9a=this;return new Promise(function(_0x3003e1,_0x470592){return db['MemberReport'][_0xc3c6('0x17')]({'raw':_0x26c9b0[_0xc3c6('0x18')]?_0x26c9b0[_0xc3c6('0x18')][_0xc3c6('0x19')]===undefined?!![]:![]:!![],'where':_0x26c9b0[_0xc3c6('0x18')]?_0x26c9b0[_0xc3c6('0x18')][_0xc3c6('0x1a')]||null:null,'attributes':_0x26c9b0[_0xc3c6('0x18')]?_0x26c9b0[_0xc3c6('0x18')][_0xc3c6('0x1b')]||null:null,'limit':_0x26c9b0[_0xc3c6('0x18')]?_0x26c9b0[_0xc3c6('0x18')][_0xc3c6('0x1c')]||null:null,'include':_0x26c9b0[_0xc3c6('0x18')]?_0x26c9b0[_0xc3c6('0x18')][_0xc3c6('0x1d')]?_['map'](_0x26c9b0[_0xc3c6('0x18')][_0xc3c6('0x1d')],function(_0x2bced6){return{'model':db[_0x2bced6['model']],'as':_0x2bced6['as'],'attributes':_0x2bced6[_0xc3c6('0x1b')],'include':_0x2bced6[_0xc3c6('0x1d')]?_[_0xc3c6('0x1e')](_0x2bced6[_0xc3c6('0x1d')],function(_0x2bc9bf){return{'model':db[_0x2bc9bf[_0xc3c6('0x1f')]],'as':_0x2bc9bf['as'],'attributes':_0x2bc9bf[_0xc3c6('0x1b')],'include':_0x2bc9bf['include']?_[_0xc3c6('0x1e')](_0x2bc9bf[_0xc3c6('0x1d')],function(_0x4ca76f){return{'model':db[_0x4ca76f[_0xc3c6('0x1f')]],'as':_0x4ca76f['as'],'attributes':_0x4ca76f[_0xc3c6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc3c6('0xc')](function(_0xdad009){logger[_0xc3c6('0xd')](_0xc3c6('0x16'),_0x26c9b0);logger[_0xc3c6('0x10')](_0xc3c6('0x16'),_0x26c9b0,JSON[_0xc3c6('0x11')](_0xdad009));_0x3003e1(_0xdad009);})['catch'](function(_0xb047b1){logger[_0xc3c6('0x12')](_0xc3c6('0x16'),_0xb047b1[_0xc3c6('0x13')],_0x26c9b0);_0x470592(_0x11df9a['error'](0x1f4,_0xb047b1[_0xc3c6('0x13')]));});});};exports[_0xc3c6('0x20')]=function(_0x223d34){var _0x75066f=this;return new Promise(function(_0x3189dd,_0x354797){return db['MemberReport'][_0xc3c6('0x21')](_0x223d34[_0xc3c6('0x22')],{'raw':_0x223d34[_0xc3c6('0x18')]?_0x223d34[_0xc3c6('0x18')][_0xc3c6('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x34453d){logger[_0xc3c6('0xd')](_0xc3c6('0x20'),_0x223d34);logger[_0xc3c6('0x10')](_0xc3c6('0x20'),_0x223d34,JSON[_0xc3c6('0x11')](_0x34453d));_0x3189dd(_0x34453d);})[_0xc3c6('0x15')](function(_0x53b4c6){logger[_0xc3c6('0x12')]('CreateMemberReport',_0x53b4c6[_0xc3c6('0x13')],_0x223d34);_0x354797(_0x75066f[_0xc3c6('0x12')](0x1f4,_0x53b4c6[_0xc3c6('0x13')]));});});};exports[_0xc3c6('0x23')]=function(_0x1c96d0){var _0x1b8e52=this;return new Promise(function(_0x4ba1ae,_0x36562e){return db[_0xc3c6('0x24')]['update'](_0x1c96d0[_0xc3c6('0x22')],{'raw':_0x1c96d0[_0xc3c6('0x18')]?_0x1c96d0[_0xc3c6('0x18')][_0xc3c6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c96d0[_0xc3c6('0x18')]?_0x1c96d0[_0xc3c6('0x18')][_0xc3c6('0x1a')]||null:null,'attributes':_0x1c96d0['options']?_0x1c96d0['options'][_0xc3c6('0x1b')]||null:null,'limit':_0x1c96d0[_0xc3c6('0x18')]?_0x1c96d0[_0xc3c6('0x18')][_0xc3c6('0x1c')]||null:null})[_0xc3c6('0xc')](function(_0x5cbbe3){logger[_0xc3c6('0xd')](_0xc3c6('0x23'),_0x1c96d0);logger[_0xc3c6('0x10')](_0xc3c6('0x23'),_0x1c96d0,JSON[_0xc3c6('0x11')](_0x5cbbe3));_0x4ba1ae(_0x5cbbe3);})[_0xc3c6('0x15')](function(_0x2b69fd){logger[_0xc3c6('0x12')](_0xc3c6('0x23'),_0x2b69fd['message'],_0x1c96d0);_0x36562e(_0x1b8e52[_0xc3c6('0x12')](0x1f4,_0x2b69fd[_0xc3c6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index f9935cc..b230f0a 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 _0x2b34=['../../config/environment','./migration.controller','get','index','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x41b3d6,_0x21daa8){var _0x3e60ca=function(_0xee2395){while(--_0xee2395){_0x41b3d6['push'](_0x41b3d6['shift']());}};_0x3e60ca(++_0x21daa8);}(_0x2b34,0x165));var _0x42b3=function(_0xfbb2c4,_0x26b45a){_0xfbb2c4=_0xfbb2c4-0x0;var _0x440158=_0x2b34[_0xfbb2c4];return _0x440158;};'use strict';var multer=require(_0x42b3('0x0'));var util=require(_0x42b3('0x1'));var path=require('path');var timeout=require(_0x42b3('0x2'));var express=require('express');var router=express[_0x42b3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x42b3('0x4'));var interaction=require(_0x42b3('0x5'));var config=require(_0x42b3('0x6'));var controller=require(_0x42b3('0x7'));router[_0x42b3('0x8')]('/',controller[_0x42b3('0x9')]);module[_0x42b3('0xa')]=router; \ No newline at end of file +var _0x3469=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','exports','multer','util','connect-timeout','express'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x3469,0x19e));var _0x9346=function(_0x7c8d0f,_0x1bb281){_0x7c8d0f=_0x7c8d0f-0x0;var _0x3b3166=_0x3469[_0x7c8d0f];return _0x3b3166;};'use strict';var multer=require(_0x9346('0x0'));var util=require(_0x9346('0x1'));var path=require('path');var timeout=require(_0x9346('0x2'));var express=require(_0x9346('0x3'));var router=express[_0x9346('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9346('0x5'));var interaction=require(_0x9346('0x6'));var config=require(_0x9346('0x7'));var controller=require(_0x9346('0x8'));router['get']('/',controller[_0x9346('0x9')]);module[_0x9346('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 88c86a5..de9ba39 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 _0xd61e=['STRING','version','exports'];(function(_0x10203c,_0xdc43bd){var _0x5e45c7=function(_0x33625d){while(--_0x33625d){_0x10203c['push'](_0x10203c['shift']());}};_0x5e45c7(++_0xdc43bd);}(_0xd61e,0x161));var _0xed61=function(_0x106aee,_0x28ed2e){_0x106aee=_0x106aee-0x0;var _0x525ef7=_0xd61e[_0x106aee];return _0x525ef7;};'use strict';var Sequelize=require('sequelize');module[_0xed61('0x0')]={'version':{'type':Sequelize[_0xed61('0x1')],'unique':_0xed61('0x2')}}; \ No newline at end of file +var _0x4a2b=['STRING','version','sequelize'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x4a2b,0xb9));var _0xb4a2=function(_0x3bc47a,_0xeb4400){_0x3bc47a=_0x3bc47a-0x0;var _0x4b542f=_0x4a2b[_0x3bc47a];return _0x4b542f;};'use strict';var Sequelize=require(_0xb4a2('0x0'));module['exports']={'version':{'type':Sequelize[_0xb4a2('0x1')],'unique':_0xb4a2('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 083d204..6db10bd 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 _0x9543=['json','apply','reject','save','update','then','destroy','name','send','index','map','Migration','rawAttributes','type','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range'];(function(_0x2b271f,_0x5712f3){var _0x13d8c2=function(_0x3d0ad0){while(--_0x3d0ad0){_0x2b271f['push'](_0x2b271f['shift']());}};_0x13d8c2(++_0x5712f3);}(_0x9543,0xad));var _0x3954=function(_0x24c450,_0xcbb01d){_0x24c450=_0x24c450-0x0;var _0x22f620=_0x9543[_0x24c450];return _0x22f620;};'use strict';var emlformat=require(_0x3954('0x0'));var rimraf=require(_0x3954('0x1'));var zipdir=require(_0x3954('0x2'));var jsonpatch=require(_0x3954('0x3'));var rp=require(_0x3954('0x4'));var moment=require('moment');var BPromise=require(_0x3954('0x5'));var Mustache=require(_0x3954('0x6'));var util=require(_0x3954('0x7'));var path=require(_0x3954('0x8'));var sox=require(_0x3954('0x9'));var csv=require(_0x3954('0xa'));var ejs=require(_0x3954('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3954('0xc'));var squel=require(_0x3954('0xd'));var crypto=require(_0x3954('0xe'));var jsforce=require(_0x3954('0xf'));var deskjs=require(_0x3954('0x10'));var toCsv=require(_0x3954('0xa'));var querystring=require('querystring');var Papa=require(_0x3954('0x11'));var Redis=require(_0x3954('0x12'));var authService=require(_0x3954('0x13'));var qs=require(_0x3954('0x14'));var as=require(_0x3954('0x15'));var hardwareService=require(_0x3954('0x16'));var logger=require(_0x3954('0x17'))(_0x3954('0x18'));var utils=require('../../config/utils');var config=require(_0x3954('0x19'));var licenseUtil=require(_0x3954('0x1a'));var db=require(_0x3954('0x1b'))['db'];function respondWithStatusCode(_0x55d2fa,_0x4db4ee){_0x4db4ee=_0x4db4ee||0xcc;return function(_0x57c09d){if(_0x57c09d){return _0x55d2fa[_0x3954('0x1c')](_0x4db4ee);}return _0x55d2fa[_0x3954('0x1d')](_0x4db4ee)[_0x3954('0x1e')]();};}function respondWithResult(_0x4ff6fa,_0x195cb0){_0x195cb0=_0x195cb0||0xc8;return function(_0x733134){if(_0x733134){return _0x4ff6fa[_0x3954('0x1d')](_0x195cb0)['json'](_0x733134);}};}function respondWithFilteredResult(_0x53d88d,_0xee6584){return function(_0x12a879){if(_0x12a879){var _0x24190b=typeof _0xee6584[_0x3954('0x1f')]==='undefined'&&typeof _0xee6584[_0x3954('0x20')]===_0x3954('0x21');var _0x5db55f=_0x12a879[_0x3954('0x22')];var _0xeb81ee=_0x24190b?0x0:_0xee6584[_0x3954('0x1f')];var _0x50530e=_0x24190b?_0x12a879[_0x3954('0x22')]:_0xee6584[_0x3954('0x1f')]+_0xee6584[_0x3954('0x20')];var _0x26cde4;if(_0x50530e>=_0x5db55f){_0x50530e=_0x5db55f;_0x26cde4=0xc8;}else{_0x26cde4=0xce;}_0x53d88d[_0x3954('0x1d')](_0x26cde4);return _0x53d88d[_0x3954('0x23')](_0x3954('0x24'),_0xeb81ee+'-'+_0x50530e+'/'+_0x5db55f)[_0x3954('0x25')](_0x12a879);}return null;};}function patchUpdates(_0x697522){return function(_0x10ee92){try{jsonpatch[_0x3954('0x26')](_0x10ee92,_0x697522,!![]);}catch(_0x244b2d){return BPromise[_0x3954('0x27')](_0x244b2d);}return _0x10ee92[_0x3954('0x28')]();};}function saveUpdates(_0x381add,_0x24a325){return function(_0x505a5a){if(_0x505a5a){return _0x505a5a[_0x3954('0x29')](_0x381add)[_0x3954('0x2a')](function(_0x540100){return _0x540100;});}return null;};}function removeEntity(_0x39f87d,_0xdf1a15){return function(_0x3af80c){if(_0x3af80c){return _0x3af80c[_0x3954('0x2b')]()[_0x3954('0x2a')](function(){_0x39f87d[_0x3954('0x1d')](0xcc)[_0x3954('0x1e')]();});}};}function handleEntityNotFound(_0x520237,_0x1e35fc){return function(_0x47dd50){if(!_0x47dd50){_0x520237[_0x3954('0x1c')](0x194);}return _0x47dd50;};}function handleError(_0x24e48e,_0x21b980){_0x21b980=_0x21b980||0x1f4;return function(_0x434b1e){logger['error'](_0x434b1e['stack']);if(_0x434b1e[_0x3954('0x2c')]){delete _0x434b1e[_0x3954('0x2c')];}_0x24e48e[_0x3954('0x1d')](_0x21b980)[_0x3954('0x2d')](_0x434b1e);};}exports[_0x3954('0x2e')]=function(_0x2a0581,_0x327273){var _0x13ecdb={},_0x4807dd={},_0x130d6b={'count':0x0,'rows':[]};var _0x93b66a=_[_0x3954('0x2f')](db[_0x3954('0x30')][_0x3954('0x31')],function(_0x4de0da){return{'name':_0x4de0da['fieldName'],'type':_0x4de0da[_0x3954('0x32')]['key']};});_0x4807dd[_0x3954('0x33')]=_[_0x3954('0x2f')](_0x93b66a,_0x3954('0x2c'));_0x4807dd[_0x3954('0x34')]=_[_0x3954('0x35')](_0x2a0581['query']);_0x4807dd[_0x3954('0x36')]=_['intersection'](_0x4807dd[_0x3954('0x33')],_0x4807dd['query']);_0x13ecdb[_0x3954('0x37')]=_['intersection'](_0x4807dd[_0x3954('0x33')],qs['fields'](_0x2a0581[_0x3954('0x34')]['fields']));_0x13ecdb[_0x3954('0x37')]=_0x13ecdb[_0x3954('0x37')][_0x3954('0x38')]?_0x13ecdb['attributes']:_0x4807dd[_0x3954('0x33')];if(!_0x2a0581[_0x3954('0x34')][_0x3954('0x39')](_0x3954('0x3a'))){_0x13ecdb[_0x3954('0x20')]=qs['limit'](_0x2a0581[_0x3954('0x34')][_0x3954('0x20')]);_0x13ecdb[_0x3954('0x1f')]=qs[_0x3954('0x1f')](_0x2a0581[_0x3954('0x34')]['offset']);}_0x13ecdb['order']=qs[_0x3954('0x3b')](_0x2a0581['query']['sort']);_0x13ecdb['where']=qs['filters'](_[_0x3954('0x3c')](_0x2a0581[_0x3954('0x34')],_0x4807dd[_0x3954('0x36')]),_0x93b66a);if(_0x2a0581[_0x3954('0x34')][_0x3954('0x3d')]){_0x13ecdb[_0x3954('0x3e')]=_[_0x3954('0x3f')](_0x13ecdb['where'],{'$or':_[_0x3954('0x2f')](_0x93b66a,function(_0x227494){if(_0x227494[_0x3954('0x32')]!==_0x3954('0x40')){var _0xc73571={};_0xc73571[_0x227494[_0x3954('0x2c')]]={'$like':'%'+_0x2a0581[_0x3954('0x34')][_0x3954('0x3d')]+'%'};return _0xc73571;}})});}_0x13ecdb=_[_0x3954('0x3f')]({},_0x13ecdb,_0x2a0581['options']);var _0x149de0={'where':_0x13ecdb[_0x3954('0x3e')]};return db[_0x3954('0x30')][_0x3954('0x22')](_0x149de0)[_0x3954('0x2a')](function(_0x259699){_0x130d6b[_0x3954('0x22')]=_0x259699;if(_0x2a0581[_0x3954('0x34')][_0x3954('0x41')]){_0x13ecdb[_0x3954('0x42')]=[{'all':!![]}];}return db[_0x3954('0x30')][_0x3954('0x43')](_0x13ecdb);})[_0x3954('0x2a')](function(_0x11e78f){_0x130d6b[_0x3954('0x44')]=_0x11e78f;return _0x130d6b;})[_0x3954('0x2a')](respondWithFilteredResult(_0x327273,_0x13ecdb))[_0x3954('0x45')](handleError(_0x327273,null));}; \ No newline at end of file +var _0x789c=['undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','send','index','map','Migration','fieldName','type','key','model','name','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit'];(function(_0x29349e,_0x2bfa3e){var _0x33a3bc=function(_0x1fe094){while(--_0x1fe094){_0x29349e['push'](_0x29349e['shift']());}};_0x33a3bc(++_0x2bfa3e);}(_0x789c,0x1e6));var _0xc789=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x789c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc789('0x0'));var zipdir=require(_0xc789('0x1'));var jsonpatch=require(_0xc789('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc789('0x3'));var Mustache=require('mustache');var util=require(_0xc789('0x4'));var path=require(_0xc789('0x5'));var sox=require(_0xc789('0x6'));var csv=require(_0xc789('0x7'));var ejs=require(_0xc789('0x8'));var fs=require('fs');var fs_extra=require(_0xc789('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc789('0xa'));var deskjs=require(_0xc789('0xb'));var toCsv=require(_0xc789('0x7'));var querystring=require(_0xc789('0xc'));var Papa=require('papaparse');var Redis=require(_0xc789('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc789('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc789('0xf'));var logger=require(_0xc789('0x10'))(_0xc789('0x11'));var utils=require(_0xc789('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc789('0x13'));var db=require(_0xc789('0x14'))['db'];function respondWithStatusCode(_0x19764b,_0x75ad72){_0x75ad72=_0x75ad72||0xcc;return function(_0x3cba6d){if(_0x3cba6d){return _0x19764b['sendStatus'](_0x75ad72);}return _0x19764b['status'](_0x75ad72)[_0xc789('0x15')]();};}function respondWithResult(_0x464c97,_0x324d27){_0x324d27=_0x324d27||0xc8;return function(_0x147a0e){if(_0x147a0e){return _0x464c97[_0xc789('0x16')](_0x324d27)[_0xc789('0x17')](_0x147a0e);}};}function respondWithFilteredResult(_0x434611,_0xd9a831){return function(_0x38a69a){if(_0x38a69a){var _0xe97e01=typeof _0xd9a831[_0xc789('0x18')]==='undefined'&&typeof _0xd9a831[_0xc789('0x19')]===_0xc789('0x1a');var _0x265f14=_0x38a69a[_0xc789('0x1b')];var _0x5b6d26=_0xe97e01?0x0:_0xd9a831['offset'];var _0x5eed8f=_0xe97e01?_0x38a69a['count']:_0xd9a831['offset']+_0xd9a831[_0xc789('0x19')];var _0x5d2cc9;if(_0x5eed8f>=_0x265f14){_0x5eed8f=_0x265f14;_0x5d2cc9=0xc8;}else{_0x5d2cc9=0xce;}_0x434611['status'](_0x5d2cc9);return _0x434611[_0xc789('0x1c')](_0xc789('0x1d'),_0x5b6d26+'-'+_0x5eed8f+'/'+_0x265f14)['json'](_0x38a69a);}return null;};}function patchUpdates(_0x33512a){return function(_0x3458cf){try{jsonpatch[_0xc789('0x1e')](_0x3458cf,_0x33512a,!![]);}catch(_0xa12855){return BPromise[_0xc789('0x1f')](_0xa12855);}return _0x3458cf[_0xc789('0x20')]();};}function saveUpdates(_0x321d08,_0x2f43c2){return function(_0x3768c6){if(_0x3768c6){return _0x3768c6[_0xc789('0x21')](_0x321d08)['then'](function(_0x18b2c0){return _0x18b2c0;});}return null;};}function removeEntity(_0x3fa27e,_0x2233f6){return function(_0x41a8ab){if(_0x41a8ab){return _0x41a8ab['destroy']()[_0xc789('0x22')](function(){_0x3fa27e[_0xc789('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xad53f8,_0x293e22){return function(_0x15eeaf){if(!_0x15eeaf){_0xad53f8[_0xc789('0x23')](0x194);}return _0x15eeaf;};}function handleError(_0x25cf61,_0x245c7c){_0x245c7c=_0x245c7c||0x1f4;return function(_0x2d84b2){logger[_0xc789('0x24')](_0x2d84b2[_0xc789('0x25')]);if(_0x2d84b2['name']){delete _0x2d84b2['name'];}_0x25cf61[_0xc789('0x16')](_0x245c7c)[_0xc789('0x26')](_0x2d84b2);};}exports[_0xc789('0x27')]=function(_0x471848,_0x2cf123){var _0x41fd31={},_0x44a950={},_0x43be52={'count':0x0,'rows':[]};var _0x381785=_[_0xc789('0x28')](db[_0xc789('0x29')]['rawAttributes'],function(_0x230e93){return{'name':_0x230e93[_0xc789('0x2a')],'type':_0x230e93[_0xc789('0x2b')][_0xc789('0x2c')]};});_0x44a950[_0xc789('0x2d')]=_['map'](_0x381785,_0xc789('0x2e'));_0x44a950[_0xc789('0x2f')]=_['keys'](_0x471848[_0xc789('0x2f')]);_0x44a950['filters']=_[_0xc789('0x30')](_0x44a950[_0xc789('0x2d')],_0x44a950[_0xc789('0x2f')]);_0x41fd31[_0xc789('0x31')]=_[_0xc789('0x30')](_0x44a950[_0xc789('0x2d')],qs[_0xc789('0x32')](_0x471848[_0xc789('0x2f')][_0xc789('0x32')]));_0x41fd31['attributes']=_0x41fd31[_0xc789('0x31')]['length']?_0x41fd31['attributes']:_0x44a950[_0xc789('0x2d')];if(!_0x471848[_0xc789('0x2f')][_0xc789('0x33')](_0xc789('0x34'))){_0x41fd31[_0xc789('0x19')]=qs[_0xc789('0x19')](_0x471848[_0xc789('0x2f')][_0xc789('0x19')]);_0x41fd31['offset']=qs[_0xc789('0x18')](_0x471848[_0xc789('0x2f')][_0xc789('0x18')]);}_0x41fd31[_0xc789('0x35')]=qs[_0xc789('0x36')](_0x471848[_0xc789('0x2f')][_0xc789('0x36')]);_0x41fd31[_0xc789('0x37')]=qs['filters'](_[_0xc789('0x38')](_0x471848[_0xc789('0x2f')],_0x44a950['filters']),_0x381785);if(_0x471848[_0xc789('0x2f')][_0xc789('0x39')]){_0x41fd31[_0xc789('0x37')]=_[_0xc789('0x3a')](_0x41fd31[_0xc789('0x37')],{'$or':_[_0xc789('0x28')](_0x381785,function(_0xf1dbe6){if(_0xf1dbe6[_0xc789('0x2b')]!==_0xc789('0x3b')){var _0xa47947={};_0xa47947[_0xf1dbe6[_0xc789('0x2e')]]={'$like':'%'+_0x471848['query'][_0xc789('0x39')]+'%'};return _0xa47947;}})});}_0x41fd31=_['merge']({},_0x41fd31,_0x471848['options']);var _0x16ba6e={'where':_0x41fd31[_0xc789('0x37')]};return db['Migration'][_0xc789('0x1b')](_0x16ba6e)['then'](function(_0x109bc1){_0x43be52[_0xc789('0x1b')]=_0x109bc1;if(_0x471848[_0xc789('0x2f')][_0xc789('0x3c')]){_0x41fd31[_0xc789('0x3d')]=[{'all':!![]}];}return db[_0xc789('0x29')]['findAll'](_0x41fd31);})['then'](function(_0x1cd02c){_0x43be52[_0xc789('0x3e')]=_0x1cd02c;return _0x43be52;})['then'](respondWithFilteredResult(_0x2cf123,_0x41fd31))[_0xc789('0x3f')](handleError(_0x2cf123,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index efcfbb0..2524c15 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 _0xacc4=['define','Migration','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x242096,_0x4d2735){var _0x2cc445=function(_0x122c19){while(--_0x122c19){_0x242096['push'](_0x242096['shift']());}};_0x2cc445(++_0x4d2735);}(_0xacc4,0x70));var _0x4acc=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0xacc4[_0x19babd];return _0x314eaf;};'use strict';var _=require(_0x4acc('0x0'));var util=require(_0x4acc('0x1'));var logger=require(_0x4acc('0x2'))(_0x4acc('0x3'));var moment=require('moment');var BPromise=require(_0x4acc('0x4'));var rp=require(_0x4acc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4acc('0x6'));var config=require(_0x4acc('0x7'));var attributes=require('./migration.attributes');module[_0x4acc('0x8')]=function(_0xb84c44,_0x580ed0){return _0xb84c44[_0x4acc('0x9')](_0x4acc('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e34=['./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1823f3,_0xfd0bd1){var _0x52c1ff=function(_0x47a458){while(--_0x47a458){_0x1823f3['push'](_0x1823f3['shift']());}};_0x52c1ff(++_0xfd0bd1);}(_0x1e34,0x147));var _0x41e3=function(_0x33f57e,_0x4a38ff){_0x33f57e=_0x33f57e-0x0;var _0x18403c=_0x1e34[_0x33f57e];return _0x18403c;};'use strict';var _=require(_0x41e3('0x0'));var util=require(_0x41e3('0x1'));var logger=require(_0x41e3('0x2'))(_0x41e3('0x3'));var moment=require(_0x41e3('0x4'));var BPromise=require(_0x41e3('0x5'));var rp=require(_0x41e3('0x6'));var fs=require('fs');var path=require(_0x41e3('0x7'));var rimraf=require(_0x41e3('0x8'));var config=require('../../config/environment');var attributes=require(_0x41e3('0x9'));module[_0x41e3('0xa')]=function(_0x25b4bd,_0x75ade7){return _0x25b4bd[_0x41e3('0xb')](_0x41e3('0xc'),attributes,{'tableName':_0x41e3('0xd'),'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 0f8fa0a..cafe363 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 _0x3ce4=['../../config/environment','jayson/promise','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x42cc1f,_0xe9eb20){var _0x175df5=function(_0x2f3e22){while(--_0x2f3e22){_0x42cc1f['push'](_0x42cc1f['shift']());}};_0x175df5(++_0xe9eb20);}(_0x3ce4,0xcb));var _0x43ce=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3ce4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x43ce('0x0'));var util=require('util');var moment=require(_0x43ce('0x1'));var BPromise=require('bluebird');var rs=require(_0x43ce('0x2'));var fs=require('fs');var Redis=require(_0x43ce('0x3'));var db=require(_0x43ce('0x4'))['db'];var utils=require(_0x43ce('0x5'));var logger=require(_0x43ce('0x6'))('rpc');var config=require(_0x43ce('0x7'));var jayson=require(_0x43ce('0x8'));var client=jayson['client'][_0x43ce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51e29b,_0x1f93c9,_0x2fd0e2){return new BPromise(function(_0x189654,_0x20c136){return client['request'](_0x51e29b,_0x2fd0e2)[_0x43ce('0xa')](function(_0x13dbc6){logger[_0x43ce('0xb')](_0x43ce('0xc'),_0x1f93c9,_0x43ce('0xd'));logger[_0x43ce('0xe')](_0x43ce('0xf'),_0x1f93c9,_0x43ce('0xd'),JSON['stringify'](_0x13dbc6));if(_0x13dbc6[_0x43ce('0x10')]){if(_0x13dbc6['error'][_0x43ce('0x11')]===0x1f4){logger[_0x43ce('0x10')](_0x43ce('0xc'),_0x1f93c9,_0x13dbc6[_0x43ce('0x10')][_0x43ce('0x12')]);return _0x20c136(_0x13dbc6[_0x43ce('0x10')][_0x43ce('0x12')]);}logger['error'](_0x43ce('0xc'),_0x1f93c9,_0x13dbc6['error'][_0x43ce('0x12')]);return _0x189654(_0x13dbc6[_0x43ce('0x10')][_0x43ce('0x12')]);}else{logger['info'](_0x43ce('0xc'),_0x1f93c9,_0x43ce('0xd'));_0x189654(_0x13dbc6[_0x43ce('0x13')][_0x43ce('0x12')]);}})[_0x43ce('0x14')](function(_0x34b84b){logger[_0x43ce('0x10')](_0x43ce('0xc'),_0x1f93c9,_0x34b84b);_0x20c136(_0x34b84b);});});} \ No newline at end of file +var _0xe28e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','Migration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x262f44,_0x3847ba){var _0x33b27c=function(_0x5db154){while(--_0x5db154){_0x262f44['push'](_0x262f44['shift']());}};_0x33b27c(++_0x3847ba);}(_0xe28e,0x1ba));var _0xee28=function(_0xf30798,_0x2230d7){_0xf30798=_0xf30798-0x0;var _0x46bf8d=_0xe28e[_0xf30798];return _0x46bf8d;};'use strict';var _=require(_0xee28('0x0'));var util=require(_0xee28('0x1'));var moment=require(_0xee28('0x2'));var BPromise=require(_0xee28('0x3'));var rs=require(_0xee28('0x4'));var fs=require('fs');var Redis=require(_0xee28('0x5'));var db=require(_0xee28('0x6'))['db'];var utils=require(_0xee28('0x7'));var logger=require(_0xee28('0x8'))(_0xee28('0x9'));var config=require(_0xee28('0xa'));var jayson=require(_0xee28('0xb'));var client=jayson[_0xee28('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39b337,_0x30224a,_0x3f9bd9){return new BPromise(function(_0x66d0b6,_0x156aad){return client[_0xee28('0xd')](_0x39b337,_0x3f9bd9)[_0xee28('0xe')](function(_0x5d7562){logger['info']('Migration,\x20%s,\x20%s',_0x30224a,_0xee28('0xf'));logger[_0xee28('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x30224a,_0xee28('0xf'),JSON[_0xee28('0x11')](_0x5d7562));if(_0x5d7562['error']){if(_0x5d7562[_0xee28('0x12')][_0xee28('0x13')]===0x1f4){logger[_0xee28('0x12')](_0xee28('0x14'),_0x30224a,_0x5d7562[_0xee28('0x12')][_0xee28('0x15')]);return _0x156aad(_0x5d7562[_0xee28('0x12')]['message']);}logger[_0xee28('0x12')](_0xee28('0x14'),_0x30224a,_0x5d7562[_0xee28('0x12')][_0xee28('0x15')]);return _0x66d0b6(_0x5d7562[_0xee28('0x12')]['message']);}else{logger[_0xee28('0x16')](_0xee28('0x14'),_0x30224a,_0xee28('0xf'));_0x66d0b6(_0x5d7562[_0xee28('0x17')][_0xee28('0x15')]);}})[_0xee28('0x18')](function(_0x4c0eb9){logger[_0xee28('0x12')]('Migration,\x20%s,\x20%s',_0x30224a,_0x4c0eb9);_0x156aad(_0x4c0eb9);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index ad8fd9f..a2d56b0 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 _0x56fd=['isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x56fd,0x15f));var _0xd56f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x56fd[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xd56f('0x0'));var util=require(_0xd56f('0x1'));var path=require(_0xd56f('0x2'));var timeout=require('connect-timeout');var express=require(_0xd56f('0x3'));var router=express[_0xd56f('0x4')]();var fs_extra=require(_0xd56f('0x5'));var auth=require(_0xd56f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd56f('0x7'));var controller=require(_0xd56f('0x8'));router[_0xd56f('0x9')]('/',auth[_0xd56f('0xa')](),controller['index']);router['get'](_0xd56f('0xb'),auth[_0xd56f('0xa')](),controller[_0xd56f('0xc')]);router['post']('/',auth[_0xd56f('0xa')](),controller[_0xd56f('0xd')]);router[_0xd56f('0xe')]('/:id',auth[_0xd56f('0xa')](),controller[_0xd56f('0xf')]);router[_0xd56f('0x10')]('/:id',auth[_0xd56f('0xa')](),controller[_0xd56f('0x11')]);module[_0xd56f('0x12')]=router; \ No newline at end of file +var _0x3dc2=['index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5dd5ce,_0x163ad4){var _0x3715a9=function(_0x575a37){while(--_0x575a37){_0x5dd5ce['push'](_0x5dd5ce['shift']());}};_0x3715a9(++_0x163ad4);}(_0x3dc2,0xa9));var _0x23dc=function(_0x4a3f25,_0x2912f4){_0x4a3f25=_0x4a3f25-0x0;var _0x2be437=_0x3dc2[_0x4a3f25];return _0x2be437;};'use strict';var multer=require(_0x23dc('0x0'));var util=require('util');var path=require(_0x23dc('0x1'));var timeout=require(_0x23dc('0x2'));var express=require(_0x23dc('0x3'));var router=express[_0x23dc('0x4')]();var fs_extra=require(_0x23dc('0x5'));var auth=require(_0x23dc('0x6'));var interaction=require(_0x23dc('0x7'));var config=require(_0x23dc('0x8'));var controller=require('./network.controller');router[_0x23dc('0x9')]('/',auth[_0x23dc('0xa')](),controller[_0x23dc('0xb')]);router[_0x23dc('0x9')](_0x23dc('0xc'),auth[_0x23dc('0xa')](),controller[_0x23dc('0xd')]);router[_0x23dc('0xe')]('/',auth[_0x23dc('0xa')](),controller[_0x23dc('0xf')]);router[_0x23dc('0x10')](_0x23dc('0xc'),auth[_0x23dc('0xa')](),controller['update']);router[_0x23dc('0x11')](_0x23dc('0xc'),auth[_0x23dc('0xa')](),controller[_0x23dc('0x12')]);module[_0x23dc('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 e9ac00f..e572dbe 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 _0xc551=['STRING','sequelize','exports','ENUM','localnet','stun','turn'];(function(_0x4c8c4d,_0x170fc3){var _0x7c72d2=function(_0x249fd1){while(--_0x249fd1){_0x4c8c4d['push'](_0x4c8c4d['shift']());}};_0x7c72d2(++_0x170fc3);}(_0xc551,0xf6));var _0x1c55=function(_0x51716a,_0x32dce3){_0x51716a=_0x51716a-0x0;var _0x51bc68=_0xc551[_0x51716a];return _0x51bc68;};'use strict';var Sequelize=require(_0x1c55('0x0'));module[_0x1c55('0x1')]={'type':{'type':Sequelize[_0x1c55('0x2')](_0x1c55('0x3'),'externip',_0x1c55('0x4'),_0x1c55('0x5'))},'value':{'type':Sequelize[_0x1c55('0x6')]},'username':{'type':Sequelize[_0x1c55('0x6')]},'password':{'type':Sequelize[_0x1c55('0x6')]}}; \ No newline at end of file +var _0xfc7a=['stun','turn','STRING','exports','ENUM','localnet'];(function(_0x579b3c,_0x3feadf){var _0x5c5ee5=function(_0xd349b4){while(--_0xd349b4){_0x579b3c['push'](_0x579b3c['shift']());}};_0x5c5ee5(++_0x3feadf);}(_0xfc7a,0xcf));var _0xafc7=function(_0x40f09a,_0x3743b6){_0x40f09a=_0x40f09a-0x0;var _0x2eb96c=_0xfc7a[_0x40f09a];return _0x2eb96c;};'use strict';var Sequelize=require('sequelize');module[_0xafc7('0x0')]={'type':{'type':Sequelize[_0xafc7('0x1')](_0xafc7('0x2'),'externip',_0xafc7('0x3'),_0xafc7('0x4'))},'value':{'type':Sequelize[_0xafc7('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index ec95f8c..d724556 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 _0x4059=['message','info','result','catch','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','status','stack','name','send','map','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','show','params','include','find','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','utf8','writeFileSync','Reload','create','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','root','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','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','client','http','request','then','Network,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x79c3,_0x3035d7){var _0x2e2f49=function(_0x28f1c0){while(--_0x28f1c0){_0x79c3['push'](_0x79c3['shift']());}};_0x2e2f49(++_0x3035d7);}(_0x4059,0xb2));var _0x9405=function(_0x4c2690,_0x345cba){_0x4c2690=_0x4c2690-0x0;var _0x54211e=_0x4059[_0x4c2690];return _0x54211e;};'use strict';var emlformat=require(_0x9405('0x0'));var rimraf=require(_0x9405('0x1'));var zipdir=require(_0x9405('0x2'));var jsonpatch=require(_0x9405('0x3'));var rp=require(_0x9405('0x4'));var moment=require('moment');var BPromise=require(_0x9405('0x5'));var Mustache=require(_0x9405('0x6'));var util=require(_0x9405('0x7'));var path=require(_0x9405('0x8'));var sox=require(_0x9405('0x9'));var csv=require('to-csv');var ejs=require(_0x9405('0xa'));var fs=require('fs');var fs_extra=require(_0x9405('0xb'));var _=require('lodash');var squel=require(_0x9405('0xc'));var crypto=require(_0x9405('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9405('0xe'));var toCsv=require(_0x9405('0xf'));var querystring=require(_0x9405('0x10'));var Papa=require(_0x9405('0x11'));var Redis=require(_0x9405('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9405('0x13'));var as=require(_0x9405('0x14'));var hardwareService=require(_0x9405('0x15'));var logger=require('../../config/logger')(_0x9405('0x16'));var utils=require(_0x9405('0x17'));var config=require(_0x9405('0x18'));var licenseUtil=require(_0x9405('0x19'));var db=require(_0x9405('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9405('0x1b')][_0x9405('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x22e8e4,_0x4b755c,_0x20a3b9,_0x22a268){return new BPromise(function(_0x53ed49,_0x464bd3){var _0xd71d79=_0x22a268||client;return _0xd71d79[_0x9405('0x1d')](_0x22e8e4,_0x20a3b9)[_0x9405('0x1e')](function(_0x2d1871){logger['info'](_0x9405('0x1f'),_0x4b755c,'request\x20sent');logger[_0x9405('0x20')]('Network,\x20%s,\x20%s,\x20%s',_0x4b755c,_0x9405('0x21'),JSON[_0x9405('0x22')](_0x2d1871));if(_0x2d1871[_0x9405('0x23')]){if(_0x2d1871['error']['code']===0x1f4){logger[_0x9405('0x23')](_0x9405('0x1f'),_0x4b755c,_0x2d1871['error'][_0x9405('0x24')]);return _0x464bd3(_0x2d1871['error'][_0x9405('0x24')]);}logger[_0x9405('0x23')]('Network,\x20%s,\x20%s',_0x4b755c,_0x2d1871[_0x9405('0x23')]['message']);return _0x53ed49(_0x2d1871[_0x9405('0x23')]['message']);}else{logger[_0x9405('0x25')](_0x9405('0x1f'),_0x4b755c,_0x9405('0x21'));_0x53ed49(_0x2d1871[_0x9405('0x26')][_0x9405('0x24')]);}})[_0x9405('0x27')](function(_0x3d1e79){logger[_0x9405('0x23')](_0x9405('0x1f'),_0x4b755c,_0x3d1e79);_0x464bd3(_0x3d1e79);});});}function respondWithStatusCode(_0x3c2478,_0x3ef0aa){_0x3ef0aa=_0x3ef0aa||0xcc;return function(_0x4d13de){if(_0x4d13de){return _0x3c2478[_0x9405('0x28')](_0x3ef0aa);}return _0x3c2478['status'](_0x3ef0aa)[_0x9405('0x29')]();};}function respondWithResult(_0x47467b,_0x5ef661){_0x5ef661=_0x5ef661||0xc8;return function(_0x28c361){if(_0x28c361){return _0x47467b['status'](_0x5ef661)[_0x9405('0x2a')](_0x28c361);}};}function respondWithFilteredResult(_0x2cf5eb,_0x5f1481){return function(_0x4b468e){if(_0x4b468e){var _0x2bef61=typeof _0x5f1481[_0x9405('0x2b')]===_0x9405('0x2c')&&typeof _0x5f1481[_0x9405('0x2d')]===_0x9405('0x2c');var _0x3d8b9e=_0x4b468e[_0x9405('0x2e')];var _0x512cde=_0x2bef61?0x0:_0x5f1481[_0x9405('0x2b')];var _0x4be695=_0x2bef61?_0x4b468e[_0x9405('0x2e')]:_0x5f1481['offset']+_0x5f1481[_0x9405('0x2d')];var _0xec48ee;if(_0x4be695>=_0x3d8b9e){_0x4be695=_0x3d8b9e;_0xec48ee=0xc8;}else{_0xec48ee=0xce;}_0x2cf5eb['status'](_0xec48ee);return _0x2cf5eb[_0x9405('0x2f')](_0x9405('0x30'),_0x512cde+'-'+_0x4be695+'/'+_0x3d8b9e)['json'](_0x4b468e);}return null;};}function patchUpdates(_0x12d617){return function(_0x5ce627){try{jsonpatch[_0x9405('0x31')](_0x5ce627,_0x12d617,!![]);}catch(_0x4cf6b5){return BPromise['reject'](_0x4cf6b5);}return _0x5ce627['save']();};}function saveUpdates(_0x56156b,_0x3819bf){return function(_0xb84633){if(_0xb84633){return _0xb84633[_0x9405('0x32')](_0x56156b)[_0x9405('0x1e')](function(_0x2e9713){return _0x2e9713;});}return null;};}function removeEntity(_0x295199,_0x37732c){return function(_0xae5220){if(_0xae5220){return _0xae5220[_0x9405('0x33')]()['then'](function(){_0x295199[_0x9405('0x34')](0xcc)[_0x9405('0x29')]();});}};}function handleEntityNotFound(_0x42d048,_0xb8907){return function(_0x1793af){if(!_0x1793af){_0x42d048['sendStatus'](0x194);}return _0x1793af;};}function handleError(_0x5adf44,_0x388f3c){_0x388f3c=_0x388f3c||0x1f4;return function(_0x1708e7){logger[_0x9405('0x23')](_0x1708e7[_0x9405('0x35')]);if(_0x1708e7[_0x9405('0x36')]){delete _0x1708e7[_0x9405('0x36')];}_0x5adf44['status'](_0x388f3c)[_0x9405('0x37')](_0x1708e7);};}exports['index']=function(_0x4a28a2,_0x57df8b){var _0x596b1d={},_0x4f95d7={},_0x4b209f={'count':0x0,'rows':[]};var _0x47272e=_[_0x9405('0x38')](db[_0x9405('0x39')][_0x9405('0x3a')],function(_0x4262a8){return{'name':_0x4262a8[_0x9405('0x3b')],'type':_0x4262a8[_0x9405('0x3c')][_0x9405('0x3d')]};});_0x4f95d7[_0x9405('0x3e')]=_[_0x9405('0x38')](_0x47272e,_0x9405('0x36'));_0x4f95d7[_0x9405('0x3f')]=_[_0x9405('0x40')](_0x4a28a2[_0x9405('0x3f')]);_0x4f95d7[_0x9405('0x41')]=_[_0x9405('0x42')](_0x4f95d7[_0x9405('0x3e')],_0x4f95d7[_0x9405('0x3f')]);_0x596b1d[_0x9405('0x43')]=_[_0x9405('0x42')](_0x4f95d7[_0x9405('0x3e')],qs[_0x9405('0x44')](_0x4a28a2['query']['fields']));_0x596b1d[_0x9405('0x43')]=_0x596b1d[_0x9405('0x43')]['length']?_0x596b1d[_0x9405('0x43')]:_0x4f95d7[_0x9405('0x3e')];if(!_0x4a28a2[_0x9405('0x3f')]['hasOwnProperty'](_0x9405('0x45'))){_0x596b1d['limit']=qs[_0x9405('0x2d')](_0x4a28a2[_0x9405('0x3f')][_0x9405('0x2d')]);_0x596b1d[_0x9405('0x2b')]=qs[_0x9405('0x2b')](_0x4a28a2[_0x9405('0x3f')][_0x9405('0x2b')]);}_0x596b1d[_0x9405('0x46')]=qs[_0x9405('0x47')](_0x4a28a2[_0x9405('0x3f')][_0x9405('0x47')]);_0x596b1d[_0x9405('0x48')]=qs['filters'](_[_0x9405('0x49')](_0x4a28a2['query'],_0x4f95d7[_0x9405('0x41')]),_0x47272e);if(_0x4a28a2[_0x9405('0x3f')][_0x9405('0x4a')]){_0x596b1d[_0x9405('0x48')]=_[_0x9405('0x4b')](_0x596b1d[_0x9405('0x48')],{'$or':_['map'](_0x47272e,function(_0x43dd08){if(_0x43dd08[_0x9405('0x3c')]!=='VIRTUAL'){var _0x17b769={};_0x17b769[_0x43dd08[_0x9405('0x36')]]={'$like':'%'+_0x4a28a2[_0x9405('0x3f')][_0x9405('0x4a')]+'%'};return _0x17b769;}})});}_0x596b1d=_['merge']({},_0x596b1d,_0x4a28a2['options']);var _0x3dbd6f={'where':_0x596b1d[_0x9405('0x48')]};return db[_0x9405('0x39')][_0x9405('0x2e')](_0x3dbd6f)[_0x9405('0x1e')](function(_0x5bcf52){_0x4b209f[_0x9405('0x2e')]=_0x5bcf52;if(_0x4a28a2[_0x9405('0x3f')][_0x9405('0x4c')]){_0x596b1d['include']=[{'all':!![]}];}return db[_0x9405('0x39')][_0x9405('0x4d')](_0x596b1d);})[_0x9405('0x1e')](function(_0x36c1de){_0x4b209f[_0x9405('0x4e')]=_0x36c1de;return _0x4b209f;})['then'](respondWithFilteredResult(_0x57df8b,_0x596b1d))[_0x9405('0x27')](handleError(_0x57df8b,null));};exports[_0x9405('0x4f')]=function(_0x454b9b,_0x27ca94){var _0x12f667={'raw':!![],'where':{'id':_0x454b9b[_0x9405('0x50')]['id']}},_0x534cc7={};_0x534cc7[_0x9405('0x3e')]=_['keys'](db[_0x9405('0x39')]['rawAttributes']);_0x534cc7[_0x9405('0x3f')]=_[_0x9405('0x40')](_0x454b9b['query']);_0x534cc7[_0x9405('0x41')]=_[_0x9405('0x42')](_0x534cc7[_0x9405('0x3e')],_0x534cc7['query']);_0x12f667[_0x9405('0x43')]=_['intersection'](_0x534cc7['model'],qs[_0x9405('0x44')](_0x454b9b['query'][_0x9405('0x44')]));_0x12f667[_0x9405('0x43')]=_0x12f667[_0x9405('0x43')]['length']?_0x12f667[_0x9405('0x43')]:_0x534cc7[_0x9405('0x3e')];if(_0x454b9b[_0x9405('0x3f')][_0x9405('0x4c')]){_0x12f667[_0x9405('0x51')]=[{'all':!![]}];}_0x12f667=_['merge']({},_0x12f667,_0x454b9b['options']);return db[_0x9405('0x39')][_0x9405('0x52')](_0x12f667)[_0x9405('0x1e')](handleEntityNotFound(_0x27ca94,null))[_0x9405('0x1e')](respondWithResult(_0x27ca94,null))[_0x9405('0x27')](handleError(_0x27ca94,null));};exports['create']=function(_0x221dae,_0x46dd35,_0x582ccb){var _0x29d381;return db[_0x9405('0x53')][_0x9405('0x54')](function(_0x1bc021){return db[_0x9405('0x39')]['create'](_0x221dae[_0x9405('0x55')],{'raw':!![]})[_0x9405('0x1e')](function(_0x4d0f6a){_0x29d381=_0x4d0f6a;return db[_0x9405('0x39')][_0x9405('0x4d')]({'where':{'type':_0x221dae[_0x9405('0x55')][_0x9405('0x3c')]},'raw':!![]});})['then'](function(_0x2da957){if(_0x29d381[_0x9405('0x3c')][_0x9405('0x56')]()==_0x9405('0x57')){var _0x586710=fs[_0x9405('0x58')](path[_0x9405('0x59')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x9405('0x5a'));var _0x1e7a5b=ejs['render'](_0x586710,{'networks':_0x2da957||[]});fs[_0x9405('0x5b')]('/etc/asterisk/stun_xcally.conf',_0x1e7a5b);return respondWithRpcPromise(_0x9405('0x5c'),_0x9405('0x5d'),{'module':_0x9405('0x5e')});}else if(_0x29d381[_0x9405('0x3c')]['toUpperCase']()==_0x9405('0x5f')){var _0x497d6e=fs['readFileSync'](path[_0x9405('0x59')](config['root'],_0x9405('0x60')),'utf8');var _0x2252d6=ejs[_0x9405('0x61')](_0x497d6e,{'networks':_0x2da957||[]});fs[_0x9405('0x5b')](_0x9405('0x62'),_0x2252d6);return respondWithRpcPromise(_0x9405('0x5c'),_0x9405('0x5d'),{'module':_0x9405('0x5e')});}else{var _0x41c22d=fs['readFileSync'](path[_0x9405('0x59')](config[_0x9405('0x63')],_0x9405('0x64')),_0x9405('0x5a'));var _0x4cf3b0=ejs['render'](_0x41c22d,{'networks':_0x2da957||[]});fs[_0x9405('0x5b')](util[_0x9405('0x65')]('/etc/asterisk/sip_xcally_%s.conf',_0x221dae[_0x9405('0x55')][_0x9405('0x3c')][_0x9405('0x66')]()),_0x4cf3b0);return respondWithRpcPromise('Reload',_0x9405('0x5d'),{'module':_0x9405('0x67')});}return null;})[_0x9405('0x1e')](function(){return _0x29d381;});})[_0x9405('0x1e')](respondWithResult(_0x46dd35,0xc9))[_0x9405('0x27')](handleError(_0x46dd35,null));};exports[_0x9405('0x32')]=function(_0x500663,_0x515333,_0x181710){var _0x46e1af;return db[_0x9405('0x53')][_0x9405('0x54')](function(_0xab56a2){return db['Network'][_0x9405('0x52')]({'where':{'id':_0x500663[_0x9405('0x50')]['id']}})[_0x9405('0x1e')](handleEntityNotFound(_0x515333,null))[_0x9405('0x1e')](saveUpdates(_0x500663[_0x9405('0x55')],null))['then'](function(_0x18e4f2){if(_0x18e4f2){_0x46e1af=_0x18e4f2;return db[_0x9405('0x39')][_0x9405('0x4d')]({'where':{'type':_0x46e1af[_0x9405('0x3c')]},'raw':!![]});}return null;})[_0x9405('0x1e')](function(_0xa0b842){if(_0x46e1af['type'][_0x9405('0x56')]()=='STUN'){var _0x90336f=fs[_0x9405('0x58')](path[_0x9405('0x59')](config[_0x9405('0x63')],_0x9405('0x68')),_0x9405('0x5a'));var _0x4989aa=ejs[_0x9405('0x61')](_0x90336f,{'networks':_0xa0b842||[]});fs[_0x9405('0x5b')](_0x9405('0x69'),_0x4989aa);return respondWithRpcPromise('Reload','update',{'module':_0x9405('0x5e')});}else if(_0x46e1af[_0x9405('0x3c')][_0x9405('0x56')]()==_0x9405('0x5f')){var _0x348214=fs[_0x9405('0x58')](path[_0x9405('0x59')](config[_0x9405('0x63')],_0x9405('0x60')),_0x9405('0x5a'));var _0x18a8d1=ejs[_0x9405('0x61')](_0x348214,{'networks':_0xa0b842||[]});fs['writeFileSync'](_0x9405('0x62'),_0x18a8d1);return respondWithRpcPromise(_0x9405('0x5c'),'update',{'module':_0x9405('0x5e')});}else{var _0x3e3039=fs[_0x9405('0x58')](path[_0x9405('0x59')](config[_0x9405('0x63')],_0x9405('0x64')),'utf8');var _0x2ee778=ejs['render'](_0x3e3039,{'networks':_0xa0b842||[]});fs['writeFileSync'](util[_0x9405('0x65')]('/etc/asterisk/sip_xcally_%s.conf',_0x500663[_0x9405('0x55')][_0x9405('0x3c')][_0x9405('0x66')]()),_0x2ee778);return respondWithRpcPromise(_0x9405('0x5c'),_0x9405('0x32'),{'module':'chan_sip.so'});}return null;})[_0x9405('0x1e')](function(_0x28e3fd){if(_0x28e3fd){return _0x46e1af;}return null;});})[_0x9405('0x1e')](respondWithResult(_0x515333,null))['catch'](handleError(_0x515333,null));};exports[_0x9405('0x33')]=function(_0x4bf174,_0x3fd026,_0x2b9bbb){var _0x31b17b;return db[_0x9405('0x39')]['find']({'where':{'id':_0x4bf174[_0x9405('0x50')]['id']}})['then'](function(_0x58a596){_0x31b17b=_0x58a596;return _0x58a596;})[_0x9405('0x1e')](handleEntityNotFound(_0x3fd026,null))['then'](removeEntity(_0x3fd026,null))['then'](function(){if(_0x31b17b){return db[_0x9405('0x39')][_0x9405('0x4d')]({'where':{'type':_0x31b17b[_0x9405('0x3c')]},'raw':!![]});}})[_0x9405('0x1e')](function(_0x3c4832){if(_0x31b17b[_0x9405('0x3c')][_0x9405('0x56')]()==_0x9405('0x57')){var _0x4acea1=fs[_0x9405('0x58')](path['join'](config[_0x9405('0x63')],_0x9405('0x68')),_0x9405('0x5a'));var _0x149595=ejs[_0x9405('0x61')](_0x4acea1,{'networks':_0x3c4832||[]});fs[_0x9405('0x5b')](_0x9405('0x69'),_0x149595);return respondWithRpcPromise(_0x9405('0x5c'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x31b17b[_0x9405('0x3c')][_0x9405('0x56')]()==_0x9405('0x5f')){var _0x3dcca1=fs['readFileSync'](path['join'](config['root'],_0x9405('0x60')),_0x9405('0x5a'));var _0x524fe6=ejs[_0x9405('0x61')](_0x3dcca1,{'networks':_0x3c4832||[]});fs['writeFileSync'](_0x9405('0x62'),_0x524fe6);return respondWithRpcPromise('Reload','destroy',{'module':'res_stun_monitor.so'});}else{var _0x39b23a=fs['readFileSync'](path['join'](config[_0x9405('0x63')],_0x9405('0x64')),_0x9405('0x5a'));var _0x5b3162=ejs[_0x9405('0x61')](_0x39b23a,{'networks':_0x3c4832||[]});fs['writeFileSync'](util[_0x9405('0x65')](_0x9405('0x6a'),_0x4bf174[_0x9405('0x55')][_0x9405('0x3c')]['toLowerCase']()),_0x5b3162);return respondWithRpcPromise(_0x9405('0x5c'),_0x9405('0x33'),{'module':_0x9405('0x67')});}return null;})[_0x9405('0x27')](handleError(_0x3fd026,null));}; \ No newline at end of file +var _0xde5f=['order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','params','options','find','create','sequelize','transaction','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','utf8','toLowerCase','update','STUN','server/files/templates/network.ejs','format','chan_sip.so','destroy','/etc/asterisk/sip_xcally_%s.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','undefined','count','offset','set','Content-Range','json','save','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit'];(function(_0x4b9971,_0x483c69){var _0x92df28=function(_0x2b67da){while(--_0x2b67da){_0x4b9971['push'](_0x4b9971['shift']());}};_0x92df28(++_0x483c69);}(_0xde5f,0x97));var _0xfde5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde5f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfde5('0x0'));var rimraf=require(_0xfde5('0x1'));var zipdir=require(_0xfde5('0x2'));var jsonpatch=require(_0xfde5('0x3'));var rp=require(_0xfde5('0x4'));var moment=require(_0xfde5('0x5'));var BPromise=require(_0xfde5('0x6'));var Mustache=require(_0xfde5('0x7'));var util=require(_0xfde5('0x8'));var path=require(_0xfde5('0x9'));var sox=require(_0xfde5('0xa'));var csv=require(_0xfde5('0xb'));var ejs=require(_0xfde5('0xc'));var fs=require('fs');var fs_extra=require(_0xfde5('0xd'));var _=require('lodash');var squel=require(_0xfde5('0xe'));var crypto=require('crypto');var jsforce=require(_0xfde5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfde5('0xb'));var querystring=require(_0xfde5('0x10'));var Papa=require(_0xfde5('0x11'));var Redis=require(_0xfde5('0x12'));var authService=require(_0xfde5('0x13'));var qs=require(_0xfde5('0x14'));var as=require(_0xfde5('0x15'));var hardwareService=require(_0xfde5('0x16'));var logger=require(_0xfde5('0x17'))(_0xfde5('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfde5('0x19'));var db=require(_0xfde5('0x1a'))['db'];var jayson=require(_0xfde5('0x1b'));var client=jayson[_0xfde5('0x1c')][_0xfde5('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5743f3,_0x1213c1,_0x2ac41a,_0xa8239f){return new BPromise(function(_0x147603,_0x303e96){var _0x29758e=_0xa8239f||client;return _0x29758e[_0xfde5('0x1e')](_0x5743f3,_0x2ac41a)[_0xfde5('0x1f')](function(_0x1d64f6){logger[_0xfde5('0x20')](_0xfde5('0x21'),_0x1213c1,_0xfde5('0x22'));logger[_0xfde5('0x23')](_0xfde5('0x24'),_0x1213c1,_0xfde5('0x22'),JSON[_0xfde5('0x25')](_0x1d64f6));if(_0x1d64f6[_0xfde5('0x26')]){if(_0x1d64f6[_0xfde5('0x26')][_0xfde5('0x27')]===0x1f4){logger['error'](_0xfde5('0x21'),_0x1213c1,_0x1d64f6['error'][_0xfde5('0x28')]);return _0x303e96(_0x1d64f6['error'][_0xfde5('0x28')]);}logger['error']('Network,\x20%s,\x20%s',_0x1213c1,_0x1d64f6['error']['message']);return _0x147603(_0x1d64f6[_0xfde5('0x26')][_0xfde5('0x28')]);}else{logger[_0xfde5('0x20')](_0xfde5('0x21'),_0x1213c1,_0xfde5('0x22'));_0x147603(_0x1d64f6[_0xfde5('0x29')][_0xfde5('0x28')]);}})['catch'](function(_0x4bb150){logger[_0xfde5('0x26')](_0xfde5('0x21'),_0x1213c1,_0x4bb150);_0x303e96(_0x4bb150);});});}function respondWithStatusCode(_0x5a5ea0,_0xa6f44f){_0xa6f44f=_0xa6f44f||0xcc;return function(_0x278e0d){if(_0x278e0d){return _0x5a5ea0['sendStatus'](_0xa6f44f);}return _0x5a5ea0[_0xfde5('0x2a')](_0xa6f44f)[_0xfde5('0x2b')]();};}function respondWithResult(_0x49bd81,_0x5376cb){_0x5376cb=_0x5376cb||0xc8;return function(_0x15a802){if(_0x15a802){return _0x49bd81[_0xfde5('0x2a')](_0x5376cb)['json'](_0x15a802);}};}function respondWithFilteredResult(_0x58152d,_0x5870d0){return function(_0xafdb6c){if(_0xafdb6c){var _0x1bfcd2=typeof _0x5870d0['offset']===_0xfde5('0x2c')&&typeof _0x5870d0['limit']==='undefined';var _0x571c44=_0xafdb6c[_0xfde5('0x2d')];var _0x3a060b=_0x1bfcd2?0x0:_0x5870d0['offset'];var _0x226978=_0x1bfcd2?_0xafdb6c[_0xfde5('0x2d')]:_0x5870d0[_0xfde5('0x2e')]+_0x5870d0['limit'];var _0x142f82;if(_0x226978>=_0x571c44){_0x226978=_0x571c44;_0x142f82=0xc8;}else{_0x142f82=0xce;}_0x58152d['status'](_0x142f82);return _0x58152d[_0xfde5('0x2f')](_0xfde5('0x30'),_0x3a060b+'-'+_0x226978+'/'+_0x571c44)[_0xfde5('0x31')](_0xafdb6c);}return null;};}function patchUpdates(_0x191cd6){return function(_0x27c10e){try{jsonpatch['apply'](_0x27c10e,_0x191cd6,!![]);}catch(_0x4c2aef){return BPromise['reject'](_0x4c2aef);}return _0x27c10e[_0xfde5('0x32')]();};}function saveUpdates(_0x15245f,_0x5e9f52){return function(_0x291f91){if(_0x291f91){return _0x291f91['update'](_0x15245f)['then'](function(_0x539fe0){return _0x539fe0;});}return null;};}function removeEntity(_0x3e38a4,_0x3001e5){return function(_0x2cc7e0){if(_0x2cc7e0){return _0x2cc7e0['destroy']()[_0xfde5('0x1f')](function(){_0x3e38a4[_0xfde5('0x2a')](0xcc)[_0xfde5('0x2b')]();});}};}function handleEntityNotFound(_0x483c52,_0x5a5599){return function(_0x157261){if(!_0x157261){_0x483c52['sendStatus'](0x194);}return _0x157261;};}function handleError(_0x140600,_0x34ed6a){_0x34ed6a=_0x34ed6a||0x1f4;return function(_0x556794){logger['error'](_0x556794[_0xfde5('0x33')]);if(_0x556794[_0xfde5('0x34')]){delete _0x556794['name'];}_0x140600['status'](_0x34ed6a)[_0xfde5('0x35')](_0x556794);};}exports[_0xfde5('0x36')]=function(_0x32e2c5,_0x17f71a){var _0x5b3d6c={},_0x29a70c={},_0x821017={'count':0x0,'rows':[]};var _0x1389d2=_[_0xfde5('0x37')](db[_0xfde5('0x38')][_0xfde5('0x39')],function(_0x53ed10){return{'name':_0x53ed10[_0xfde5('0x3a')],'type':_0x53ed10[_0xfde5('0x3b')][_0xfde5('0x3c')]};});_0x29a70c['model']=_[_0xfde5('0x37')](_0x1389d2,'name');_0x29a70c[_0xfde5('0x3d')]=_[_0xfde5('0x3e')](_0x32e2c5[_0xfde5('0x3d')]);_0x29a70c['filters']=_[_0xfde5('0x3f')](_0x29a70c[_0xfde5('0x40')],_0x29a70c[_0xfde5('0x3d')]);_0x5b3d6c[_0xfde5('0x41')]=_[_0xfde5('0x3f')](_0x29a70c[_0xfde5('0x40')],qs['fields'](_0x32e2c5[_0xfde5('0x3d')][_0xfde5('0x42')]));_0x5b3d6c['attributes']=_0x5b3d6c[_0xfde5('0x41')][_0xfde5('0x43')]?_0x5b3d6c[_0xfde5('0x41')]:_0x29a70c[_0xfde5('0x40')];if(!_0x32e2c5[_0xfde5('0x3d')][_0xfde5('0x44')](_0xfde5('0x45'))){_0x5b3d6c[_0xfde5('0x46')]=qs[_0xfde5('0x46')](_0x32e2c5['query']['limit']);_0x5b3d6c[_0xfde5('0x2e')]=qs[_0xfde5('0x2e')](_0x32e2c5[_0xfde5('0x3d')][_0xfde5('0x2e')]);}_0x5b3d6c[_0xfde5('0x47')]=qs[_0xfde5('0x48')](_0x32e2c5[_0xfde5('0x3d')][_0xfde5('0x48')]);_0x5b3d6c[_0xfde5('0x49')]=qs[_0xfde5('0x4a')](_[_0xfde5('0x4b')](_0x32e2c5[_0xfde5('0x3d')],_0x29a70c[_0xfde5('0x4a')]),_0x1389d2);if(_0x32e2c5['query'][_0xfde5('0x4c')]){_0x5b3d6c['where']=_[_0xfde5('0x4d')](_0x5b3d6c[_0xfde5('0x49')],{'$or':_[_0xfde5('0x37')](_0x1389d2,function(_0x2987af){if(_0x2987af[_0xfde5('0x3b')]!=='VIRTUAL'){var _0x3a522a={};_0x3a522a[_0x2987af['name']]={'$like':'%'+_0x32e2c5[_0xfde5('0x3d')][_0xfde5('0x4c')]+'%'};return _0x3a522a;}})});}_0x5b3d6c=_[_0xfde5('0x4d')]({},_0x5b3d6c,_0x32e2c5['options']);var _0x4fca63={'where':_0x5b3d6c[_0xfde5('0x49')]};return db[_0xfde5('0x38')][_0xfde5('0x2d')](_0x4fca63)[_0xfde5('0x1f')](function(_0x5206d0){_0x821017[_0xfde5('0x2d')]=_0x5206d0;if(_0x32e2c5[_0xfde5('0x3d')][_0xfde5('0x4e')]){_0x5b3d6c[_0xfde5('0x4f')]=[{'all':!![]}];}return db['Network'][_0xfde5('0x50')](_0x5b3d6c);})[_0xfde5('0x1f')](function(_0xfac45f){_0x821017[_0xfde5('0x51')]=_0xfac45f;return _0x821017;})['then'](respondWithFilteredResult(_0x17f71a,_0x5b3d6c))[_0xfde5('0x52')](handleError(_0x17f71a,null));};exports['show']=function(_0x533f11,_0x434929){var _0x125c51={'raw':!![],'where':{'id':_0x533f11[_0xfde5('0x53')]['id']}},_0x230c2e={};_0x230c2e[_0xfde5('0x40')]=_[_0xfde5('0x3e')](db[_0xfde5('0x38')][_0xfde5('0x39')]);_0x230c2e['query']=_[_0xfde5('0x3e')](_0x533f11[_0xfde5('0x3d')]);_0x230c2e['filters']=_[_0xfde5('0x3f')](_0x230c2e[_0xfde5('0x40')],_0x230c2e[_0xfde5('0x3d')]);_0x125c51[_0xfde5('0x41')]=_[_0xfde5('0x3f')](_0x230c2e['model'],qs[_0xfde5('0x42')](_0x533f11['query']['fields']));_0x125c51[_0xfde5('0x41')]=_0x125c51[_0xfde5('0x41')]['length']?_0x125c51[_0xfde5('0x41')]:_0x230c2e[_0xfde5('0x40')];if(_0x533f11['query'][_0xfde5('0x4e')]){_0x125c51[_0xfde5('0x4f')]=[{'all':!![]}];}_0x125c51=_['merge']({},_0x125c51,_0x533f11[_0xfde5('0x54')]);return db['Network'][_0xfde5('0x55')](_0x125c51)['then'](handleEntityNotFound(_0x434929,null))[_0xfde5('0x1f')](respondWithResult(_0x434929,null))[_0xfde5('0x52')](handleError(_0x434929,null));};exports[_0xfde5('0x56')]=function(_0x4658df,_0x130796,_0x136d17){var _0x1b3ca4;return db[_0xfde5('0x57')][_0xfde5('0x58')](function(_0x11a7db){return db[_0xfde5('0x38')][_0xfde5('0x56')](_0x4658df[_0xfde5('0x59')],{'raw':!![]})['then'](function(_0x4f10ae){_0x1b3ca4=_0x4f10ae;return db[_0xfde5('0x38')][_0xfde5('0x50')]({'where':{'type':_0x4658df[_0xfde5('0x59')]['type']},'raw':!![]});})[_0xfde5('0x1f')](function(_0x22d181){if(_0x1b3ca4[_0xfde5('0x3b')][_0xfde5('0x5a')]()=='STUN'){var _0x4057f3=fs[_0xfde5('0x5b')](path[_0xfde5('0x5c')](config[_0xfde5('0x5d')],_0xfde5('0x5e')),'utf8');var _0x3564eb=ejs[_0xfde5('0x5f')](_0x4057f3,{'networks':_0x22d181||[]});fs[_0xfde5('0x60')](_0xfde5('0x61'),_0x3564eb);return respondWithRpcPromise(_0xfde5('0x62'),_0xfde5('0x56'),{'module':_0xfde5('0x63')});}else if(_0x1b3ca4[_0xfde5('0x3b')][_0xfde5('0x5a')]()=='TURN'){var _0x79476e=fs[_0xfde5('0x5b')](path[_0xfde5('0x5c')](config[_0xfde5('0x5d')],_0xfde5('0x64')),'utf8');var _0x100fde=ejs[_0xfde5('0x5f')](_0x79476e,{'networks':_0x22d181||[]});fs[_0xfde5('0x60')](_0xfde5('0x65'),_0x100fde);return respondWithRpcPromise('Reload',_0xfde5('0x56'),{'module':_0xfde5('0x63')});}else{var _0x5f1031=fs[_0xfde5('0x5b')](path[_0xfde5('0x5c')](config['root'],'server/files/templates/network.ejs'),_0xfde5('0x66'));var _0x5382c0=ejs[_0xfde5('0x5f')](_0x5f1031,{'networks':_0x22d181||[]});fs[_0xfde5('0x60')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x4658df['body']['type'][_0xfde5('0x67')]()),_0x5382c0);return respondWithRpcPromise(_0xfde5('0x62'),_0xfde5('0x56'),{'module':'chan_sip.so'});}return null;})[_0xfde5('0x1f')](function(){return _0x1b3ca4;});})[_0xfde5('0x1f')](respondWithResult(_0x130796,0xc9))['catch'](handleError(_0x130796,null));};exports[_0xfde5('0x68')]=function(_0xd5f71b,_0x3185ac,_0x57ac2d){var _0x53ea3f;return db[_0xfde5('0x57')][_0xfde5('0x58')](function(_0x502053){return db['Network'][_0xfde5('0x55')]({'where':{'id':_0xd5f71b[_0xfde5('0x53')]['id']}})[_0xfde5('0x1f')](handleEntityNotFound(_0x3185ac,null))[_0xfde5('0x1f')](saveUpdates(_0xd5f71b['body'],null))['then'](function(_0x1d59a8){if(_0x1d59a8){_0x53ea3f=_0x1d59a8;return db['Network'][_0xfde5('0x50')]({'where':{'type':_0x53ea3f[_0xfde5('0x3b')]},'raw':!![]});}return null;})[_0xfde5('0x1f')](function(_0x3a8667){if(_0x53ea3f[_0xfde5('0x3b')]['toUpperCase']()==_0xfde5('0x69')){var _0x28bdc0=fs['readFileSync'](path[_0xfde5('0x5c')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xfde5('0x66'));var _0x2393c3=ejs[_0xfde5('0x5f')](_0x28bdc0,{'networks':_0x3a8667||[]});fs[_0xfde5('0x60')](_0xfde5('0x61'),_0x2393c3);return respondWithRpcPromise(_0xfde5('0x62'),_0xfde5('0x68'),{'module':_0xfde5('0x63')});}else if(_0x53ea3f['type'][_0xfde5('0x5a')]()=='TURN'){var _0x16f487=fs[_0xfde5('0x5b')](path[_0xfde5('0x5c')](config['root'],_0xfde5('0x64')),_0xfde5('0x66'));var _0x98d9b5=ejs[_0xfde5('0x5f')](_0x16f487,{'networks':_0x3a8667||[]});fs[_0xfde5('0x60')]('/etc/asterisk/turn_xcally.conf',_0x98d9b5);return respondWithRpcPromise(_0xfde5('0x62'),_0xfde5('0x68'),{'module':_0xfde5('0x63')});}else{var _0x280c56=fs[_0xfde5('0x5b')](path[_0xfde5('0x5c')](config[_0xfde5('0x5d')],_0xfde5('0x6a')),_0xfde5('0x66'));var _0x1af6ef=ejs[_0xfde5('0x5f')](_0x280c56,{'networks':_0x3a8667||[]});fs[_0xfde5('0x60')](util[_0xfde5('0x6b')]('/etc/asterisk/sip_xcally_%s.conf',_0xd5f71b[_0xfde5('0x59')][_0xfde5('0x3b')][_0xfde5('0x67')]()),_0x1af6ef);return respondWithRpcPromise(_0xfde5('0x62'),_0xfde5('0x68'),{'module':_0xfde5('0x6c')});}return null;})[_0xfde5('0x1f')](function(_0x2a9cfc){if(_0x2a9cfc){return _0x53ea3f;}return null;});})[_0xfde5('0x1f')](respondWithResult(_0x3185ac,null))[_0xfde5('0x52')](handleError(_0x3185ac,null));};exports[_0xfde5('0x6d')]=function(_0x45c778,_0x45ca17,_0x2d9941){var _0x129e9c;return db[_0xfde5('0x38')]['find']({'where':{'id':_0x45c778[_0xfde5('0x53')]['id']}})[_0xfde5('0x1f')](function(_0x22b2da){_0x129e9c=_0x22b2da;return _0x22b2da;})[_0xfde5('0x1f')](handleEntityNotFound(_0x45ca17,null))[_0xfde5('0x1f')](removeEntity(_0x45ca17,null))[_0xfde5('0x1f')](function(){if(_0x129e9c){return db[_0xfde5('0x38')][_0xfde5('0x50')]({'where':{'type':_0x129e9c[_0xfde5('0x3b')]},'raw':!![]});}})[_0xfde5('0x1f')](function(_0xe5e639){if(_0x129e9c[_0xfde5('0x3b')]['toUpperCase']()==_0xfde5('0x69')){var _0x44fee2=fs[_0xfde5('0x5b')](path[_0xfde5('0x5c')](config['root'],_0xfde5('0x5e')),_0xfde5('0x66'));var _0x3cb581=ejs[_0xfde5('0x5f')](_0x44fee2,{'networks':_0xe5e639||[]});fs[_0xfde5('0x60')](_0xfde5('0x61'),_0x3cb581);return respondWithRpcPromise('Reload','destroy',{'module':_0xfde5('0x63')});}else if(_0x129e9c['type'][_0xfde5('0x5a')]()=='TURN'){var _0x20b1c8=fs['readFileSync'](path[_0xfde5('0x5c')](config[_0xfde5('0x5d')],_0xfde5('0x64')),_0xfde5('0x66'));var _0x2e599a=ejs[_0xfde5('0x5f')](_0x20b1c8,{'networks':_0xe5e639||[]});fs['writeFileSync'](_0xfde5('0x65'),_0x2e599a);return respondWithRpcPromise(_0xfde5('0x62'),_0xfde5('0x6d'),{'module':_0xfde5('0x63')});}else{var _0x420369=fs['readFileSync'](path[_0xfde5('0x5c')](config[_0xfde5('0x5d')],'server/files/templates/network.ejs'),'utf8');var _0x4fd533=ejs['render'](_0x420369,{'networks':_0xe5e639||[]});fs['writeFileSync'](util[_0xfde5('0x6b')](_0xfde5('0x6e'),_0x45c778[_0xfde5('0x59')]['type']['toLowerCase']()),_0x4fd533);return respondWithRpcPromise(_0xfde5('0x62'),_0xfde5('0x6d'),{'module':_0xfde5('0x6c')});}return null;})[_0xfde5('0x52')](handleError(_0x45ca17,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index ba210d1..c31413e 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 _0xac55=['path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x37e5b3,_0x2f00a7){var _0x54cf02=function(_0x57eaf2){while(--_0x57eaf2){_0x37e5b3['push'](_0x37e5b3['shift']());}};_0x54cf02(++_0x2f00a7);}(_0xac55,0x1c8));var _0x5ac5=function(_0x3b65d1,_0x1c223c){_0x3b65d1=_0x3b65d1-0x0;var _0x19880a=_0xac55[_0x3b65d1];return _0x19880a;};'use strict';var _=require(_0x5ac5('0x0'));var util=require(_0x5ac5('0x1'));var logger=require(_0x5ac5('0x2'))(_0x5ac5('0x3'));var moment=require('moment');var BPromise=require(_0x5ac5('0x4'));var rp=require(_0x5ac5('0x5'));var fs=require('fs');var path=require(_0x5ac5('0x6'));var rimraf=require(_0x5ac5('0x7'));var config=require(_0x5ac5('0x8'));var attributes=require(_0x5ac5('0x9'));module[_0x5ac5('0xa')]=function(_0x52e117,_0x57f615){return _0x52e117[_0x5ac5('0xb')](_0x5ac5('0xc'),attributes,{'tableName':_0x5ac5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./network.attributes','define','Network','network','../../config/logger','api','moment','bluebird'];(function(_0x46e15e,_0x41252b){var _0x3ce845=function(_0x31331d){while(--_0x31331d){_0x46e15e['push'](_0x46e15e['shift']());}};_0x3ce845(++_0x41252b);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index e4e65c9..aab53bf 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x32d31b,_0x4cf0e5){_0x32d31b=_0x32d31b-0x0;var _0x46828c=_0x7a54[_0x32d31b];return _0x46828c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4fdeea,_0x5bff14){var _0x7d3294=function(_0x1f8198){while(--_0x1f8198){_0x4fdeea['push'](_0x4fdeea['shift']());}};_0x7d3294(++_0x5bff14);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index c1fe2bf..bcedba8 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 _0xe564=['../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','/:id/notify','notify','addAgents','/:id/send','put','delete','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x17e25b,_0x43b90c){var _0x161e75=function(_0x5972fe){while(--_0x5972fe){_0x17e25b['push'](_0x17e25b['shift']());}};_0x161e75(++_0x43b90c);}(_0xe564,0x185));var _0x4e56=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe564[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4e56('0x0'));var util=require(_0x4e56('0x1'));var path=require(_0x4e56('0x2'));var timeout=require(_0x4e56('0x3'));var express=require(_0x4e56('0x4'));var router=express['Router']();var fs_extra=require(_0x4e56('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4e56('0x6'));var config=require(_0x4e56('0x7'));var controller=require(_0x4e56('0x8'));router[_0x4e56('0x9')]('/',auth[_0x4e56('0xa')](),controller[_0x4e56('0xb')]);router[_0x4e56('0x9')](_0x4e56('0xc'),auth[_0x4e56('0xa')](),controller[_0x4e56('0xd')]);router[_0x4e56('0x9')](_0x4e56('0xe'),auth[_0x4e56('0xa')](),controller[_0x4e56('0xf')]);router[_0x4e56('0x9')](_0x4e56('0x10'),auth[_0x4e56('0xa')](),controller[_0x4e56('0x11')]);router[_0x4e56('0x9')](_0x4e56('0x12'),auth[_0x4e56('0xa')](),controller[_0x4e56('0x13')]);router[_0x4e56('0x9')]('/:id/applications',auth[_0x4e56('0xa')](),controller[_0x4e56('0x14')]);router[_0x4e56('0x9')](_0x4e56('0x15'),auth[_0x4e56('0xa')](),controller[_0x4e56('0x16')]);router['get'](_0x4e56('0x17'),auth['isAuthenticated'](),controller[_0x4e56('0x18')]);router[_0x4e56('0x19')]('/',auth['isAuthenticated'](),controller[_0x4e56('0x1a')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4e56('0x1b')]);router[_0x4e56('0x19')](_0x4e56('0x12'),auth[_0x4e56('0xa')](),controller['addAnswer']);router[_0x4e56('0x19')](_0x4e56('0x1c'),controller[_0x4e56('0x1d')]);router[_0x4e56('0x19')]('/:id/applications',auth[_0x4e56('0xa')](),controller['addApplications']);router[_0x4e56('0x19')](_0x4e56('0x17'),auth[_0x4e56('0xa')](),controller[_0x4e56('0x1e')]);router[_0x4e56('0x19')](_0x4e56('0x1f'),auth[_0x4e56('0xa')](),controller['send']);router[_0x4e56('0x20')](_0x4e56('0xe'),auth[_0x4e56('0xa')](),controller['update']);router[_0x4e56('0x21')](_0x4e56('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x4e56('0x21')](_0x4e56('0x10'),auth['isAuthenticated'](),controller[_0x4e56('0x22')]);router['delete'](_0x4e56('0x12'),auth['isAuthenticated'](),controller[_0x4e56('0x23')]);router['delete'](_0x4e56('0x17'),auth[_0x4e56('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xa9cb=['post','create','addAnswer','addApplications','addAgents','/:id/send','send','put','update','delete','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents'];(function(_0x521df7,_0x277fd6){var _0x4b57b5=function(_0x345f75){while(--_0x345f75){_0x521df7['push'](_0x521df7['shift']());}};_0x4b57b5(++_0x277fd6);}(_0xa9cb,0x133));var _0xba9c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9cb[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xba9c('0x0'));var util=require(_0xba9c('0x1'));var path=require(_0xba9c('0x2'));var timeout=require(_0xba9c('0x3'));var express=require(_0xba9c('0x4'));var router=express[_0xba9c('0x5')]();var fs_extra=require(_0xba9c('0x6'));var auth=require(_0xba9c('0x7'));var interaction=require(_0xba9c('0x8'));var config=require(_0xba9c('0x9'));var controller=require(_0xba9c('0xa'));router[_0xba9c('0xb')]('/',auth['isAuthenticated'](),controller[_0xba9c('0xc')]);router[_0xba9c('0xb')]('/describe',auth[_0xba9c('0xd')](),controller[_0xba9c('0xe')]);router[_0xba9c('0xb')](_0xba9c('0xf'),auth[_0xba9c('0xd')](),controller[_0xba9c('0x10')]);router[_0xba9c('0xb')](_0xba9c('0x11'),auth[_0xba9c('0xd')](),controller[_0xba9c('0x12')]);router['get'](_0xba9c('0x13'),auth['isAuthenticated'](),controller[_0xba9c('0x14')]);router[_0xba9c('0xb')](_0xba9c('0x15'),auth['isAuthenticated'](),controller['getApplications']);router[_0xba9c('0xb')](_0xba9c('0x16'),auth[_0xba9c('0xd')](),controller[_0xba9c('0x17')]);router[_0xba9c('0xb')](_0xba9c('0x18'),auth[_0xba9c('0xd')](),controller[_0xba9c('0x19')]);router[_0xba9c('0x1a')]('/',auth['isAuthenticated'](),controller[_0xba9c('0x1b')]);router['post'](_0xba9c('0x11'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xba9c('0x1a')](_0xba9c('0x13'),auth[_0xba9c('0xd')](),controller[_0xba9c('0x1c')]);router[_0xba9c('0x1a')]('/:id/notify',controller['notify']);router['post']('/:id/applications',auth[_0xba9c('0xd')](),controller[_0xba9c('0x1d')]);router['post'](_0xba9c('0x18'),auth[_0xba9c('0xd')](),controller[_0xba9c('0x1e')]);router[_0xba9c('0x1a')](_0xba9c('0x1f'),auth[_0xba9c('0xd')](),controller[_0xba9c('0x20')]);router[_0xba9c('0x21')](_0xba9c('0xf'),auth[_0xba9c('0xd')](),controller[_0xba9c('0x22')]);router[_0xba9c('0x23')](_0xba9c('0xf'),auth[_0xba9c('0xd')](),controller['destroy']);router['delete'](_0xba9c('0x11'),auth[_0xba9c('0xd')](),controller['removeDispositions']);router[_0xba9c('0x23')](_0xba9c('0x13'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xba9c('0x23')](_0xba9c('0x18'),auth[_0xba9c('0xd')](),controller[_0xba9c('0x24')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 6e4b92c..97c22a6 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 _0x6d22=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT'];(function(_0x4cd9d1,_0x56b34f){var _0x1c3794=function(_0x4a2a58){while(--_0x4a2a58){_0x4cd9d1['push'](_0x4cd9d1['shift']());}};_0x1c3794(++_0x56b34f);}(_0x6d22,0x1e7));var _0x26d2=function(_0x531be7,_0x20e028){_0x531be7=_0x531be7-0x0;var _0x2a513f=_0x6d22[_0x531be7];return _0x2a513f;};'use strict';var Sequelize=require(_0x26d2('0x0'));var rs=require(_0x26d2('0x1'));module[_0x26d2('0x2')]={'name':{'type':Sequelize[_0x26d2('0x3')],'unique':_0x26d2('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x26d2('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x26d2('0x5')]();}},'replyUri':{'type':Sequelize[_0x26d2('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x26d2('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x26d2('0x6')],'defaultValue':function(){return _0x26d2('0x7');}},'notificationSound':{'type':Sequelize[_0x26d2('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x26d2('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x26d2('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x26d2('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x26d2('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x26d2('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x26d2('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x26d2('0x9')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x26d2('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x813a0f){if(!_0x813a0f)this[_0x26d2('0xa')](_0x26d2('0xb'),null);this[_0x26d2('0xa')](_0x26d2('0xc'),_0x813a0f);}}}; \ No newline at end of file +var _0x0b22=['name','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x3522c8,_0x1e7c82){var _0x22f498=function(_0x5bf143){while(--_0x5bf143){_0x3522c8['push'](_0x3522c8['shift']());}};_0x22f498(++_0x1e7c82);}(_0x0b22,0x193));var _0x20b2=function(_0x5e1dcd,_0x15240e){_0x5e1dcd=_0x5e1dcd-0x0;var _0x26d791=_0x0b22[_0x5e1dcd];return _0x26d791;};'use strict';var Sequelize=require(_0x20b2('0x0'));var rs=require(_0x20b2('0x1'));module[_0x20b2('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x20b2('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x20b2('0x4')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x20b2('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x20b2('0x5')],'defaultValue':function(){return _0x20b2('0x6');}},'notificationSound':{'type':Sequelize[_0x20b2('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x20b2('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x20b2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x20b2('0x4')]},'queueTransfer':{'type':Sequelize[_0x20b2('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x20b2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x20b2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x20b2('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x20b2('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x20b2('0xa'),'set':function(_0x302eee){if(!_0x302eee)this[_0x20b2('0xb')](_0x20b2('0xc'),null);this[_0x20b2('0xb')](_0x20b2('0xd'),_0x302eee);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 2f60431..57a4043 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 _0xf072=['filter','type','VIRTUAL','options','includeAll','include','findAll','rows','params','Pause','rawAttributes','intersection','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getDispositions','findOne','Disposition','OpenchannelAccountId','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','from','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','OpenchannelApplication','Applications','account','applications','list','orderBy','asc','Contacts','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','sequelize','Transaction','READ_COMMITTED','findAndCountAll','priority','getApplications','getInteractions','Contact','User','Owner','internal','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','offset','limit','count','status','set','json','reject','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x1989f0,_0x2035a8){var _0x441907=function(_0x555197){while(--_0x555197){_0x1989f0['push'](_0x1989f0['shift']());}};_0x441907(++_0x2035a8);}(_0xf072,0x1d6));var _0x2f07=function(_0x5d386f,_0x400791){_0x5d386f=_0x5d386f-0x0;var _0xe86cc=_0xf072[_0x5d386f];return _0xe86cc;};'use strict';var emlformat=require(_0x2f07('0x0'));var rimraf=require(_0x2f07('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2f07('0x2'));var rp=require(_0x2f07('0x3'));var moment=require(_0x2f07('0x4'));var BPromise=require(_0x2f07('0x5'));var Mustache=require(_0x2f07('0x6'));var util=require('util');var path=require(_0x2f07('0x7'));var sox=require(_0x2f07('0x8'));var csv=require('to-csv');var ejs=require(_0x2f07('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2f07('0xa'));var crypto=require('crypto');var jsforce=require(_0x2f07('0xb'));var deskjs=require(_0x2f07('0xc'));var toCsv=require(_0x2f07('0xd'));var querystring=require(_0x2f07('0xe'));var Papa=require(_0x2f07('0xf'));var Redis=require(_0x2f07('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2f07('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2f07('0x12'));var db=require('../../mysqldb')['db'];config[_0x2f07('0x13')]=_[_0x2f07('0x14')](config[_0x2f07('0x13')],{'host':_0x2f07('0x15'),'port':0x18eb});var socket=require(_0x2f07('0x16'))(new Redis(config['redis']));require(_0x2f07('0x17'))[_0x2f07('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2f07('0x19')][_0x2f07('0x1a')]({'port':0x232c});var client9002=jayson[_0x2f07('0x19')][_0x2f07('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xff16a0,_0x5d9f34,_0x3f02f9,_0x15ee34){return new BPromise(function(_0x1e2222,_0x1d97c3){var _0x56329c=_0x15ee34||client;return _0x56329c[_0x2f07('0x1b')](_0xff16a0,_0x3f02f9)[_0x2f07('0x1c')](function(_0x3630d4){logger['info'](_0x2f07('0x1d'),_0x5d9f34,_0x2f07('0x1e'));logger[_0x2f07('0x1f')](_0x2f07('0x20'),_0x5d9f34,_0x2f07('0x1e'),JSON[_0x2f07('0x21')](_0x3630d4));if(_0x3630d4[_0x2f07('0x22')]){if(_0x3630d4[_0x2f07('0x22')]['code']===0x1f4){logger[_0x2f07('0x22')](_0x2f07('0x1d'),_0x5d9f34,_0x3630d4['error'][_0x2f07('0x23')]);return _0x1d97c3(_0x3630d4['error'][_0x2f07('0x23')]);}logger[_0x2f07('0x22')](_0x2f07('0x1d'),_0x5d9f34,_0x3630d4[_0x2f07('0x22')][_0x2f07('0x23')]);return _0x1e2222(_0x3630d4[_0x2f07('0x22')][_0x2f07('0x23')]);}else{logger['info'](_0x2f07('0x1d'),_0x5d9f34,_0x2f07('0x1e'));_0x1e2222(_0x3630d4['result'][_0x2f07('0x23')]);}})[_0x2f07('0x24')](function(_0x11e5bc){logger[_0x2f07('0x22')](_0x2f07('0x1d'),_0x5d9f34,_0x11e5bc);_0x1d97c3(_0x11e5bc);});});}function respondWithStatusCode(_0xb704cf,_0xd13cf3){_0xd13cf3=_0xd13cf3||0xcc;return function(_0x14bbfe){if(_0x14bbfe){return _0xb704cf[_0x2f07('0x25')](_0xd13cf3);}return _0xb704cf['status'](_0xd13cf3)['end']();};}function respondWithResult(_0x1136c1,_0x4ee3a1){_0x4ee3a1=_0x4ee3a1||0xc8;return function(_0x400726){if(_0x400726){return _0x1136c1['status'](_0x4ee3a1)['json'](_0x400726);}};}function respondWithFilteredResult(_0x3b5e89,_0x52aa9c){return function(_0x12dbbd){if(_0x12dbbd){var _0x199440=typeof _0x52aa9c[_0x2f07('0x26')]==='undefined'&&typeof _0x52aa9c[_0x2f07('0x27')]==='undefined';var _0x2c40d4=_0x12dbbd[_0x2f07('0x28')];var _0x5af1b9=_0x199440?0x0:_0x52aa9c[_0x2f07('0x26')];var _0x543519=_0x199440?_0x12dbbd[_0x2f07('0x28')]:_0x52aa9c['offset']+_0x52aa9c[_0x2f07('0x27')];var _0x1a054e;if(_0x543519>=_0x2c40d4){_0x543519=_0x2c40d4;_0x1a054e=0xc8;}else{_0x1a054e=0xce;}_0x3b5e89[_0x2f07('0x29')](_0x1a054e);return _0x3b5e89[_0x2f07('0x2a')]('Content-Range',_0x5af1b9+'-'+_0x543519+'/'+_0x2c40d4)[_0x2f07('0x2b')](_0x12dbbd);}return null;};}function patchUpdates(_0x500706){return function(_0x5e50c6){try{jsonpatch['apply'](_0x5e50c6,_0x500706,!![]);}catch(_0x5b8131){return BPromise[_0x2f07('0x2c')](_0x5b8131);}return _0x5e50c6['save']();};}function saveUpdates(_0x5713c0,_0x54269e){return function(_0x1d98b2){if(_0x1d98b2){return _0x1d98b2['update'](_0x5713c0)[_0x2f07('0x1c')](function(_0x30faea){return _0x30faea;});}return null;};}function removeEntity(_0x382b4a,_0x241edc){return function(_0x399372){if(_0x399372){return _0x399372[_0x2f07('0x2d')]()[_0x2f07('0x1c')](function(){var _0x3f4c76=_0x399372[_0x2f07('0x2e')]({'plain':!![]});var _0x3a2131=_0x2f07('0x2f');return db[_0x2f07('0x30')][_0x2f07('0x2d')]({'where':{'type':_0x3a2131,'resourceId':_0x3f4c76['id']}})['then'](function(){return _0x399372;});})['then'](function(){_0x382b4a[_0x2f07('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f7c75,_0x561e69){return function(_0xb3ebe6){if(!_0xb3ebe6){_0x2f7c75[_0x2f07('0x25')](0x194);}return _0xb3ebe6;};}function handleError(_0x1fc49c,_0x55c00a){_0x55c00a=_0x55c00a||0x1f4;return function(_0xbd32d1){logger['error'](_0xbd32d1['stack']);if(_0xbd32d1[_0x2f07('0x31')]){delete _0xbd32d1['name'];}_0x1fc49c['status'](_0x55c00a)[_0x2f07('0x32')](_0xbd32d1);};}exports[_0x2f07('0x33')]=function(_0x45c126,_0x27ed15){var _0x45cc24={'include':[{'model':db['Pause'],'as':_0x2f07('0x34')}]},_0xe602a0={},_0x1f408d={'count':0x0,'rows':[]};var _0x4b2701=_[_0x2f07('0x35')](db[_0x2f07('0x36')]['rawAttributes'],function(_0x2ca2ce){return{'name':_0x2ca2ce[_0x2f07('0x37')],'type':_0x2ca2ce['type'][_0x2f07('0x38')]};});_0xe602a0[_0x2f07('0x39')]=_['map'](_0x4b2701,_0x2f07('0x31'));_0xe602a0[_0x2f07('0x3a')]=_[_0x2f07('0x3b')](_0x45c126[_0x2f07('0x3a')]);_0xe602a0['filters']=_['intersection'](_0xe602a0[_0x2f07('0x39')],_0xe602a0['query']);_0x45cc24[_0x2f07('0x3c')]=_['intersection'](_0xe602a0[_0x2f07('0x39')],qs['fields'](_0x45c126['query'][_0x2f07('0x3d')]));_0x45cc24[_0x2f07('0x3c')]=_0x45cc24['attributes'][_0x2f07('0x3e')]?_0x45cc24[_0x2f07('0x3c')]:_0xe602a0[_0x2f07('0x39')];if(!_0x45c126['query'][_0x2f07('0x3f')](_0x2f07('0x40'))){_0x45cc24[_0x2f07('0x27')]=qs['limit'](_0x45c126['query'][_0x2f07('0x27')]);_0x45cc24[_0x2f07('0x26')]=qs['offset'](_0x45c126[_0x2f07('0x3a')][_0x2f07('0x26')]);}_0x45cc24[_0x2f07('0x41')]=qs[_0x2f07('0x42')](_0x45c126[_0x2f07('0x3a')]['sort']);_0x45cc24[_0x2f07('0x43')]=qs[_0x2f07('0x44')](_[_0x2f07('0x45')](_0x45c126[_0x2f07('0x3a')],_0xe602a0[_0x2f07('0x44')]),_0x4b2701);if(_0x45c126['query'][_0x2f07('0x46')]){_0x45cc24['where']=_['merge'](_0x45cc24['where'],{'$or':_[_0x2f07('0x35')](_0x4b2701,function(_0x54a113){if(_0x54a113[_0x2f07('0x47')]!==_0x2f07('0x48')){var _0x2212d2={};_0x2212d2[_0x54a113[_0x2f07('0x31')]]={'$like':'%'+_0x45c126[_0x2f07('0x3a')]['filter']+'%'};return _0x2212d2;}})});}_0x45cc24=_['merge']({},_0x45cc24,_0x45c126[_0x2f07('0x49')]);var _0x561da4={'where':_0x45cc24[_0x2f07('0x43')]};return db['OpenchannelAccount'][_0x2f07('0x28')](_0x561da4)['then'](function(_0x3f6f5a){_0x1f408d[_0x2f07('0x28')]=_0x3f6f5a;if(_0x45c126[_0x2f07('0x3a')][_0x2f07('0x4a')]){_0x45cc24[_0x2f07('0x4b')]=[{'all':!![]}];}return db[_0x2f07('0x36')][_0x2f07('0x4c')](_0x45cc24);})[_0x2f07('0x1c')](function(_0x2c4815){_0x1f408d[_0x2f07('0x4d')]=_0x2c4815;return _0x1f408d;})[_0x2f07('0x1c')](respondWithFilteredResult(_0x27ed15,_0x45cc24))[_0x2f07('0x24')](handleError(_0x27ed15,null));};exports['show']=function(_0x2b7cf7,_0x10f2c9){var _0x2691f6={'raw':![],'where':{'id':_0x2b7cf7[_0x2f07('0x4e')]['id']},'include':[{'model':db[_0x2f07('0x4f')],'as':'mandatoryDispositionPause'}]},_0x341dc5={};_0x341dc5['model']=_[_0x2f07('0x3b')](db[_0x2f07('0x36')][_0x2f07('0x50')]);_0x341dc5[_0x2f07('0x3a')]=_[_0x2f07('0x3b')](_0x2b7cf7['query']);_0x341dc5[_0x2f07('0x44')]=_[_0x2f07('0x51')](_0x341dc5[_0x2f07('0x39')],_0x341dc5[_0x2f07('0x3a')]);_0x2691f6[_0x2f07('0x3c')]=_[_0x2f07('0x51')](_0x341dc5[_0x2f07('0x39')],qs[_0x2f07('0x3d')](_0x2b7cf7[_0x2f07('0x3a')][_0x2f07('0x3d')]));_0x2691f6[_0x2f07('0x3c')]=_0x2691f6[_0x2f07('0x3c')][_0x2f07('0x3e')]?_0x2691f6[_0x2f07('0x3c')]:_0x341dc5[_0x2f07('0x39')];if(_0x2b7cf7[_0x2f07('0x3a')][_0x2f07('0x4a')]){_0x2691f6[_0x2f07('0x4b')]=[{'all':!![]}];}_0x2691f6=_[_0x2f07('0x52')]({},_0x2691f6,_0x2b7cf7[_0x2f07('0x49')]);return db[_0x2f07('0x36')][_0x2f07('0x53')](_0x2691f6)[_0x2f07('0x1c')](handleEntityNotFound(_0x10f2c9,null))['then'](respondWithResult(_0x10f2c9,null))[_0x2f07('0x24')](handleError(_0x10f2c9,null));};exports[_0x2f07('0x54')]=function(_0x1dd6db,_0x46b803){return db[_0x2f07('0x36')][_0x2f07('0x54')](_0x1dd6db['body'],{})[_0x2f07('0x1c')](function(_0x10f0a4){var _0xd65110=_0x1dd6db['user']['get']({'plain':!![]});if(!_0xd65110)throw new Error(_0x2f07('0x55'));if(_0xd65110[_0x2f07('0x56')]===_0x2f07('0x57')){var _0x2e8241=_0x10f0a4[_0x2f07('0x2e')]({'plain':!![]});var _0xde9789=_0x2f07('0x2f');return db[_0x2f07('0x58')][_0x2f07('0x53')]({'where':{'name':_0xde9789,'userProfileId':_0xd65110[_0x2f07('0x59')]},'raw':!![]})[_0x2f07('0x1c')](function(_0x3dfd72){if(_0x3dfd72&&_0x3dfd72[_0x2f07('0x5a')]===0x0){return db['UserProfileResource'][_0x2f07('0x54')]({'name':_0x2e8241[_0x2f07('0x31')],'resourceId':_0x2e8241['id'],'type':_0x3dfd72['name'],'sectionId':_0x3dfd72['id']},{})[_0x2f07('0x1c')](function(){return _0x10f0a4;});}else{return _0x10f0a4;}})[_0x2f07('0x24')](function(_0x2d5667){logger['error'](_0x2f07('0x5b'),_0x2d5667);throw _0x2d5667;});}return _0x10f0a4;})[_0x2f07('0x1c')](respondWithResult(_0x46b803,0xc9))['catch'](handleError(_0x46b803,null));};exports[_0x2f07('0x5c')]=function(_0x1d2b42,_0x4849a9){if(_0x1d2b42[_0x2f07('0x5d')]['id']){delete _0x1d2b42[_0x2f07('0x5d')]['id'];}return db[_0x2f07('0x36')][_0x2f07('0x53')]({'where':{'id':_0x1d2b42['params']['id']},'include':[{'model':db[_0x2f07('0x4f')],'as':_0x2f07('0x34')}]})['then'](handleEntityNotFound(_0x4849a9,null))[_0x2f07('0x1c')](saveUpdates(_0x1d2b42[_0x2f07('0x5d')],null))[_0x2f07('0x1c')](respondWithResult(_0x4849a9,null))['catch'](handleError(_0x4849a9,null));};exports[_0x2f07('0x2d')]=function(_0x1b47d6,_0x98c1ed){return db[_0x2f07('0x36')][_0x2f07('0x53')]({'where':{'id':_0x1b47d6[_0x2f07('0x4e')]['id']}})['then'](handleEntityNotFound(_0x98c1ed,null))[_0x2f07('0x1c')](removeEntity(_0x98c1ed,null))[_0x2f07('0x24')](handleError(_0x98c1ed,null));};exports[_0x2f07('0x5e')]=function(_0x144c0d,_0x3b3698){return db['OpenchannelAccount'][_0x2f07('0x5e')]()[_0x2f07('0x1c')](respondWithResult(_0x3b3698,null))[_0x2f07('0x24')](handleError(_0x3b3698,null));};exports['addDisposition']=function(_0x287c5a,_0x2aaf0c,_0x524fed){if(_0x287c5a[_0x2f07('0x5d')]['id']){delete _0x287c5a[_0x2f07('0x5d')]['id'];}return db[_0x2f07('0x36')][_0x2f07('0x53')]({'where':{'id':_0x287c5a[_0x2f07('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2aaf0c,null))[_0x2f07('0x1c')](function(_0x445750){if(_0x445750){_0x287c5a[_0x2f07('0x5d')]['OpenchannelAccountId']=_0x445750['id'];return db['Disposition'][_0x2f07('0x54')](_0x287c5a[_0x2f07('0x5d')]);}})[_0x2f07('0x1c')](respondWithResult(_0x2aaf0c,null))[_0x2f07('0x24')](handleError(_0x2aaf0c,null));};exports[_0x2f07('0x5f')]=function(_0x4868a2,_0x3bf1f3,_0x40d808){var _0xdffd88={'raw':![],'where':{}};var _0xa72cda={};var _0x3067b9={'count':0x0,'rows':[]};return db[_0x2f07('0x36')][_0x2f07('0x60')]({'where':{'id':_0x4868a2[_0x2f07('0x4e')]['id']}})[_0x2f07('0x1c')](handleEntityNotFound(_0x3bf1f3,null))[_0x2f07('0x1c')](function(_0x5adbe4){if(_0x5adbe4){_0xa72cda[_0x2f07('0x39')]=_[_0x2f07('0x3b')](db[_0x2f07('0x61')][_0x2f07('0x50')]);_0xa72cda['query']=_[_0x2f07('0x3b')](_0x4868a2[_0x2f07('0x3a')]);_0xa72cda['filters']=_['intersection'](_0xa72cda[_0x2f07('0x39')],_0xa72cda[_0x2f07('0x3a')]);_0xdffd88[_0x2f07('0x3c')]=_[_0x2f07('0x51')](_0xa72cda[_0x2f07('0x39')],qs[_0x2f07('0x3d')](_0x4868a2['query'][_0x2f07('0x3d')]));_0xdffd88['attributes']=_0xdffd88[_0x2f07('0x3c')][_0x2f07('0x3e')]?_0xdffd88[_0x2f07('0x3c')]:_0xa72cda['model'];if(!_0x4868a2[_0x2f07('0x3a')]['hasOwnProperty']('nolimit')){_0xdffd88['limit']=qs[_0x2f07('0x27')](_0x4868a2[_0x2f07('0x3a')][_0x2f07('0x27')]);_0xdffd88['offset']=qs['offset'](_0x4868a2[_0x2f07('0x3a')][_0x2f07('0x26')]);}_0xdffd88['order']=qs[_0x2f07('0x42')](_0x4868a2[_0x2f07('0x3a')][_0x2f07('0x42')]);_0xdffd88['where']=qs[_0x2f07('0x44')](_[_0x2f07('0x45')](_0x4868a2[_0x2f07('0x3a')],_0xa72cda['filters']));_0xdffd88['where'][_0x2f07('0x62')]=_0x5adbe4['id'];if(_0x4868a2['query'][_0x2f07('0x46')]){_0xdffd88[_0x2f07('0x43')]=_['merge'](_0xdffd88[_0x2f07('0x43')],{'$or':_[_0x2f07('0x35')](_0xdffd88[_0x2f07('0x3c')],function(_0x16eb3c){var _0x2f88e4={};_0x2f88e4[_0x16eb3c]={'$like':'%'+_0x4868a2[_0x2f07('0x3a')][_0x2f07('0x46')]+'%'};return _0x2f88e4;})});}_0xdffd88=_[_0x2f07('0x52')]({},_0xdffd88,_0x4868a2[_0x2f07('0x49')]);return db[_0x2f07('0x61')][_0x2f07('0x28')]({'where':_0xdffd88['where']})[_0x2f07('0x1c')](function(_0x103968){_0x3067b9[_0x2f07('0x28')]=_0x103968;if(_0x4868a2[_0x2f07('0x3a')][_0x2f07('0x4a')]){_0xdffd88[_0x2f07('0x4b')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0xdffd88);})[_0x2f07('0x1c')](function(_0x2280da){_0x3067b9['rows']=_0x2280da;return _0x3067b9;});}})['then'](respondWithFilteredResult(_0x3bf1f3,_0xdffd88))[_0x2f07('0x24')](handleError(_0x3bf1f3,null));};exports[_0x2f07('0x63')]=function(_0x457122,_0x51977b,_0x257374){return db[_0x2f07('0x36')][_0x2f07('0x53')]({'where':{'id':_0x457122[_0x2f07('0x4e')]['id']}})[_0x2f07('0x1c')](handleEntityNotFound(_0x51977b,null))['then'](function(_0x3fd376){if(_0x3fd376){return _0x3fd376[_0x2f07('0x63')](_0x457122['query']['ids']);}})[_0x2f07('0x1c')](respondWithStatusCode(_0x51977b,null))[_0x2f07('0x24')](handleError(_0x51977b,null));};exports[_0x2f07('0x64')]=function(_0x18c536,_0x1597f6,_0xeeb5ea){if(_0x18c536[_0x2f07('0x5d')]['id']){delete _0x18c536[_0x2f07('0x5d')]['id'];}return db[_0x2f07('0x36')][_0x2f07('0x53')]({'where':{'id':_0x18c536[_0x2f07('0x4e')]['id']}})[_0x2f07('0x1c')](handleEntityNotFound(_0x1597f6,null))[_0x2f07('0x1c')](function(_0x539e40){if(_0x539e40){_0x18c536['body'][_0x2f07('0x62')]=_0x539e40['id'];return db['CannedAnswer'][_0x2f07('0x54')](_0x18c536['body']);}})['then'](respondWithResult(_0x1597f6,null))[_0x2f07('0x24')](handleError(_0x1597f6,null));};exports['getAnswers']=function(_0xc6c5a2,_0x59963f,_0x272174){var _0x364175={'raw':![],'where':{}};var _0x5ec401={};var _0x251f1c={'count':0x0,'rows':[]};return db[_0x2f07('0x36')][_0x2f07('0x60')]({'where':{'id':_0xc6c5a2['params']['id']}})[_0x2f07('0x1c')](handleEntityNotFound(_0x59963f,null))[_0x2f07('0x1c')](function(_0x1471cf){if(_0x1471cf){_0x5ec401['model']=_[_0x2f07('0x3b')](db[_0x2f07('0x65')][_0x2f07('0x50')]);_0x5ec401[_0x2f07('0x3a')]=_[_0x2f07('0x3b')](_0xc6c5a2[_0x2f07('0x3a')]);_0x5ec401[_0x2f07('0x44')]=_[_0x2f07('0x51')](_0x5ec401[_0x2f07('0x39')],_0x5ec401[_0x2f07('0x3a')]);_0x364175['attributes']=_['intersection'](_0x5ec401[_0x2f07('0x39')],qs[_0x2f07('0x3d')](_0xc6c5a2['query']['fields']));_0x364175[_0x2f07('0x3c')]=_0x364175['attributes'][_0x2f07('0x3e')]?_0x364175['attributes']:_0x5ec401['model'];if(!_0xc6c5a2[_0x2f07('0x3a')][_0x2f07('0x3f')](_0x2f07('0x40'))){_0x364175[_0x2f07('0x27')]=qs[_0x2f07('0x27')](_0xc6c5a2['query'][_0x2f07('0x27')]);_0x364175[_0x2f07('0x26')]=qs[_0x2f07('0x26')](_0xc6c5a2[_0x2f07('0x3a')][_0x2f07('0x26')]);}_0x364175['order']=qs[_0x2f07('0x42')](_0xc6c5a2[_0x2f07('0x3a')]['sort']);_0x364175['where']=qs[_0x2f07('0x44')](_[_0x2f07('0x45')](_0xc6c5a2[_0x2f07('0x3a')],_0x5ec401[_0x2f07('0x44')]));_0x364175[_0x2f07('0x43')][_0x2f07('0x62')]=_0x1471cf['id'];if(_0xc6c5a2[_0x2f07('0x3a')][_0x2f07('0x46')]){_0x364175[_0x2f07('0x43')]=_[_0x2f07('0x52')](_0x364175[_0x2f07('0x43')],{'$or':_['map'](_0x364175[_0x2f07('0x3c')],function(_0x1ee8b7){var _0x10e65e={};_0x10e65e[_0x1ee8b7]={'$like':'%'+_0xc6c5a2[_0x2f07('0x3a')][_0x2f07('0x46')]+'%'};return _0x10e65e;})});}_0x364175=_['merge']({},_0x364175,_0xc6c5a2[_0x2f07('0x49')]);return db['CannedAnswer'][_0x2f07('0x28')]({'where':_0x364175[_0x2f07('0x43')]})['then'](function(_0x512d02){_0x251f1c[_0x2f07('0x28')]=_0x512d02;if(_0xc6c5a2[_0x2f07('0x3a')][_0x2f07('0x4a')]){_0x364175[_0x2f07('0x4b')]=[{'all':!![]}];}return db[_0x2f07('0x65')][_0x2f07('0x4c')](_0x364175);})[_0x2f07('0x1c')](function(_0x1c1b28){_0x251f1c['rows']=_0x1c1b28;return _0x251f1c;});}})[_0x2f07('0x1c')](respondWithFilteredResult(_0x59963f,_0x364175))['catch'](handleError(_0x59963f,null));};exports[_0x2f07('0x66')]=function(_0x2e7ea2,_0x349f31,_0x3e7c3b){return db['OpenchannelAccount'][_0x2f07('0x53')]({'where':{'id':_0x2e7ea2[_0x2f07('0x4e')]['id']}})[_0x2f07('0x1c')](handleEntityNotFound(_0x349f31,null))[_0x2f07('0x1c')](function(_0x19a77c){if(_0x19a77c){return _0x19a77c[_0x2f07('0x66')](_0x2e7ea2['query'][_0x2f07('0x67')]);}})[_0x2f07('0x1c')](respondWithStatusCode(_0x349f31,null))[_0x2f07('0x24')](handleError(_0x349f31,null));};exports[_0x2f07('0x68')]=function(_0x223c4b,_0x555538,_0x42e59b){var _0x49ba8e={'body':_0x223c4b['body'],'channel':_0x2f07('0x69')};var _0x9435d9=[];var _0x16d284=[];var _0x1204a9={};var _0x1a2ca0=![];return db['CmContact'][_0x2f07('0x5e')]()[_0x2f07('0x1c')](function(_0x26d77a){if(!_0x26d77a){throw new db[(_0x2f07('0x6a'))][(_0x2f07('0x6b'))](_0x2f07('0x6c'));}_0x9435d9=_[_0x2f07('0x6d')](_[_0x2f07('0x3b')](_0x26d77a),[_0x2f07('0x6e'),_0x2f07('0x6f')]);_0x16d284=_[_0x2f07('0x6d')](_[_0x2f07('0x3b')](_0x26d77a),[_0x2f07('0x6e'),'updatedAt','CompanyId','ListId']);if(_0x223c4b[_0x2f07('0x5d')]['id']){delete _0x223c4b[_0x2f07('0x5d')]['id'];}if(_['isNil'](_0x223c4b[_0x2f07('0x5d')][_0x2f07('0x70')])){throw new db[(_0x2f07('0x6a'))][(_0x2f07('0x6b'))](_0x2f07('0x71'));}if(_[_0x2f07('0x72')](_0x223c4b[_0x2f07('0x5d')][_0x2f07('0x5d')])||_0x223c4b[_0x2f07('0x5d')][_0x2f07('0x5d')]===''){throw new db[(_0x2f07('0x6a'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2f07('0x72')](_0x223c4b[_0x2f07('0x5d')][_0x2f07('0x73')])){throw new db[(_0x2f07('0x6a'))]['ValidationError'](_0x2f07('0x74')+_0x16d284);}if(!_[_0x2f07('0x75')](_0x16d284,_0x223c4b['body'][_0x2f07('0x73')])){throw new db[(_0x2f07('0x6a'))][(_0x2f07('0x6b'))](_0x2f07('0x76')+_0x16d284);}_0x1204a9[_0x223c4b[_0x2f07('0x5d')][_0x2f07('0x73')]]=_0x223c4b[_0x2f07('0x5d')][_0x2f07('0x70')];})[_0x2f07('0x1c')](function(){return db['OpenchannelAccount'][_0x2f07('0x53')]({'where':{'id':_0x223c4b[_0x2f07('0x4e')]['id']},'include':[{'model':db['CmList'],'as':_0x2f07('0x77'),'include':[{'model':db[_0x2f07('0x78')],'as':'Contacts','where':_0x1204a9,'limit':0x1,'order':[[_0x2f07('0x6f'),'DESC']]}]},{'model':db[_0x2f07('0x79')],'as':_0x2f07('0x7a')}]});})[_0x2f07('0x1c')](handleEntityNotFound(_0x555538,null))['then'](function(_0x15cee7){if(_0x15cee7&&_0x15cee7['List']){_0x49ba8e[_0x2f07('0x7b')]=_0x15cee7;_0x49ba8e[_0x2f07('0x7c')]=_0x15cee7[_0x2f07('0x7a')];_0x49ba8e[_0x2f07('0x7d')]=_0x15cee7[_0x2f07('0x77')];_0x49ba8e[_0x2f07('0x7c')]=_[_0x2f07('0x7e')](_0x49ba8e[_0x2f07('0x7c')],['priority'],[_0x2f07('0x7f')]);if(_0x49ba8e[_0x2f07('0x7b')][_0x2f07('0x7a')]){delete _0x49ba8e[_0x2f07('0x7b')][_0x2f07('0x7a')];}if(_0x49ba8e[_0x2f07('0x7b')]['List']&&_0x49ba8e['account']['List'][_0x2f07('0x80')][_0x2f07('0x3e')]){return _0x49ba8e[_0x2f07('0x7b')][_0x2f07('0x77')]['Contacts'][0x0];}var _0x578085=_[_0x2f07('0x14')](_0x223c4b['body'],{'firstName':_0x223c4b[_0x2f07('0x5d')][_0x2f07('0x70')],'ListId':_0x15cee7[_0x2f07('0x81')]});_0x578085[_0x223c4b['body'][_0x2f07('0x73')]]=_0x223c4b['body'][_0x2f07('0x70')];return db[_0x2f07('0x78')]['create'](_0x578085,{'fields':_0x9435d9,'raw':!![]});}})[_0x2f07('0x1c')](handleEntityNotFound(_0x555538,null))['then'](function(_0x4ae097){_0x49ba8e[_0x2f07('0x82')]=_0x4ae097;if(_0x4ae097){var _0x55f1f7={'ContactId':_0x4ae097['id'],'OpenchannelAccountId':_0x223c4b[_0x2f07('0x4e')]['id'],'from':(_0x4ae097[_0x2f07('0x83')]||'')+'\x20'+(_0x4ae097[_0x2f07('0x84')]||'')};var _0x450069={'OpenchannelAccountId':_0x223c4b['params']['id'],'closed':![]};if(_0x223c4b[_0x2f07('0x5d')]['threadId']){_0x450069[_0x2f07('0x85')]=_0x223c4b[_0x2f07('0x5d')][_0x2f07('0x85')];return db[_0x2f07('0x86')][_0x2f07('0x53')]({'where':_0x450069})['then'](function(_0x33d600){if(_0x33d600){return[_0x33d600,![]];}_0x55f1f7['threadId']=_0x223c4b[_0x2f07('0x5d')][_0x2f07('0x85')];_0x55f1f7[_0x2f07('0x87')]=_0x223c4b['body'][_0x2f07('0x87')];return db[_0x2f07('0x86')][_0x2f07('0x54')](_0x55f1f7)[_0x2f07('0x1c')](function(_0x1e27c8){return[_0x1e27c8,!![]];});});}else{_0x450069[_0x2f07('0x85')]=null;}_0x450069[_0x2f07('0x88')]=_0x4ae097['id'];return db['OpenchannelInteraction'][_0x2f07('0x53')]({'where':_0x450069})[_0x2f07('0x1c')](function(_0x6f235b){if(_0x6f235b){return[_0x6f235b,![]];}return db['OpenchannelInteraction'][_0x2f07('0x54')](_0x55f1f7)[_0x2f07('0x1c')](function(_0x4920b8){return[_0x4920b8,!![]];});});}})[_0x2f07('0x89')](function(_0x5dfd90,_0x4501d){if(_0x5dfd90){_0x1a2ca0=_0x4501d;if(!_0x4501d){var _0x37e863={'from':(_0x49ba8e[_0x2f07('0x82')][_0x2f07('0x83')]||'')+'\x20'+(_0x49ba8e[_0x2f07('0x82')][_0x2f07('0x84')]||'')};if(_0x223c4b[_0x2f07('0x5d')]['threadId']&&_0x223c4b['body'][_0x2f07('0x8a')]&&_0x223c4b[_0x2f07('0x5d')]['threadId']!=_0x223c4b[_0x2f07('0x5d')][_0x2f07('0x8a')]){_0x37e863['threadId']=_0x223c4b['body'][_0x2f07('0x8a')];}return _0x5dfd90['update'](_0x37e863);}else{return _0x5dfd90;}}})[_0x2f07('0x1c')](function(_0x4afbd5){_0x49ba8e[_0x2f07('0x8b')]=_0x4afbd5[_0x2f07('0x2e')]({'plain':!![]});_0x49ba8e[_0x2f07('0x8b')][_0x2f07('0x8c')]=_0x1a2ca0;if(_0x49ba8e[_0x2f07('0x8b')][_0x2f07('0x8c')]){if(_0x49ba8e[_0x2f07('0x7b')][_0x2f07('0x8d')]){_0x49ba8e[_0x2f07('0x7c')][_0x2f07('0x8e')]({'id':0x0,'priority':_0x49ba8e[_0x2f07('0x7c')][_0x2f07('0x3e')]+0x1,'app':'close','appdata':_0x2f07('0x8f'),'interval':_0x2f07('0x90')});}}return db[_0x2f07('0x91')][_0x2f07('0x54')]({'body':_0x223c4b[_0x2f07('0x5d')][_0x2f07('0x5d')],'OpenchannelAccountId':_0x223c4b[_0x2f07('0x4e')]['id'],'OpenchannelInteractionId':_0x4afbd5['id'],'direction':'in','ContactId':_0x49ba8e[_0x2f07('0x82')]['id'],'AttachmentId':_0x223c4b[_0x2f07('0x5d')]['AttachmentId']});})[_0x2f07('0x1c')](function(_0x4e0731){_0x49ba8e[_0x2f07('0x23')]=_0x4e0731;if(_0x49ba8e['interaction'][_0x2f07('0x92')]){return db['User'][_0x2f07('0x53')]({'attributes':['id','name'],'where':{'id':_0x49ba8e[_0x2f07('0x8b')][_0x2f07('0x92')]}})[_0x2f07('0x1c')](function(_0x3df62f){if(_0x3df62f){_0x49ba8e[_0x2f07('0x7c')][_0x2f07('0x93')]({'id':0x0,'priority':0x0,'app':_0x2f07('0x94'),'appdata':_0x3df62f[_0x2f07('0x31')]+','+(_0x49ba8e[_0x2f07('0x7b')][_0x2f07('0x95')]||0xa),'interval':'*,*,*,*'});_0x49ba8e[_0x2f07('0x96')]=![];}return respondWithRpcPromise(_0x2f07('0x97'),_0x2f07('0x98'),_0x49ba8e);});}return respondWithRpcPromise(_0x2f07('0x97'),'startRouting',_0x49ba8e);})[_0x2f07('0x1c')](function(_0x29ee07){respondWithRpcPromise('EventManager',_0x2f07('0x99'),{'event':'notify','message':_0x29ee07},client9002);return _0x29ee07;})[_0x2f07('0x1c')](respondWithResult(_0x555538,null))[_0x2f07('0x24')](handleError(_0x555538,null));};exports['addApplications']=function(_0x3461a4,_0x53c5da){var _0x4a42ff=_0x3461a4['params']['id'];var _0x27e23f=_0x3461a4[_0x2f07('0x5d')];var _0x4c71c2=0xc8;var _0x1d91d9=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x2f07('0x9a')][_0x2f07('0x9b')]['ISOLATION_LEVELS'][_0x2f07('0x9c')]},function(_0x2b6896){return db[_0x2f07('0x36')][_0x2f07('0x60')]({'where':{'id':_0x4a42ff},'transaction':_0x2b6896})[_0x2f07('0x1c')](function(_0x1af6b1){if(_0x1af6b1){return db['OpenchannelApplication'][_0x2f07('0x2d')]({'where':{'OpenchannelAccountId':_0x4a42ff},'transaction':_0x2b6896})[_0x2f07('0x1c')](function(){var _0x40f7cf=_['map'](_0x27e23f,function(_0x17e4a0){_0x17e4a0['OpenchannelAccountId']=_0x4a42ff;return _0x17e4a0;});return db[_0x2f07('0x79')]['bulkCreate'](_0x40f7cf,{'transaction':_0x2b6896});});}else{_0x4c71c2=0x194;_0x1d91d9=[];}});})[_0x2f07('0x1c')](function(){if(_0x4c71c2!==0x194){return db['OpenchannelApplication'][_0x2f07('0x9d')]({'where':{'OpenchannelAccountId':_0x4a42ff},'order':_0x2f07('0x9e')})[_0x2f07('0x1c')](function(_0x58bcae){_0x1d91d9=_0x58bcae;});}})[_0x2f07('0x24')](function(_0x132416){_0x4c71c2=0x1f4;logger[_0x2f07('0x22')](_0x132416['stack']);if(_0x132416[_0x2f07('0x31')]){delete _0x132416['name'];}_0x1d91d9=_0x132416;})['finally'](function(){if(_0x1d91d9===null){_0x53c5da['sendStatus'](_0x4c71c2);}else{if(_0x4c71c2===0x1f4){_0x53c5da[_0x2f07('0x29')](_0x4c71c2)[_0x2f07('0x32')](_0x1d91d9);}else{_0x53c5da[_0x2f07('0x29')](_0x4c71c2)[_0x2f07('0x2b')](_0x1d91d9);}}});};exports[_0x2f07('0x9f')]=function(_0x1277f0,_0x5c3c4e,_0x682e8f){var _0x4b88a0={};var _0xf6427a={};var _0x462cbf;var _0x326712;return db[_0x2f07('0x36')]['findOne']({'where':{'id':_0x1277f0['params']['id']}})[_0x2f07('0x1c')](handleEntityNotFound(_0x5c3c4e,null))[_0x2f07('0x1c')](function(_0x2e6d4f){if(_0x2e6d4f){_0x462cbf=_0x2e6d4f;_0xf6427a['model']=_[_0x2f07('0x3b')](db[_0x2f07('0x79')][_0x2f07('0x50')]);_0xf6427a[_0x2f07('0x3a')]=_['keys'](_0x1277f0[_0x2f07('0x3a')]);_0xf6427a['filters']=_[_0x2f07('0x51')](_0xf6427a['model'],_0xf6427a[_0x2f07('0x3a')]);_0x4b88a0['attributes']=_[_0x2f07('0x51')](_0xf6427a[_0x2f07('0x39')],qs[_0x2f07('0x3d')](_0x1277f0['query'][_0x2f07('0x3d')]));_0x4b88a0[_0x2f07('0x3c')]=_0x4b88a0[_0x2f07('0x3c')]['length']?_0x4b88a0[_0x2f07('0x3c')]:_0xf6427a[_0x2f07('0x39')];_0x4b88a0[_0x2f07('0x41')]=qs[_0x2f07('0x42')](_0x1277f0[_0x2f07('0x3a')][_0x2f07('0x42')]);_0x4b88a0[_0x2f07('0x43')]=qs[_0x2f07('0x44')](_['pick'](_0x1277f0[_0x2f07('0x3a')],_0xf6427a[_0x2f07('0x44')]));if(_0x1277f0[_0x2f07('0x3a')][_0x2f07('0x46')]){_0x4b88a0[_0x2f07('0x43')]=_[_0x2f07('0x52')](_0x4b88a0[_0x2f07('0x43')],{'$or':_['map'](_0x4b88a0[_0x2f07('0x3c')],function(_0x24baea){var _0x47ceac={};_0x47ceac[_0x24baea]={'$like':'%'+_0x1277f0[_0x2f07('0x3a')][_0x2f07('0x46')]+'%'};return _0x47ceac;})});}_0x4b88a0=_[_0x2f07('0x52')]({},_0x4b88a0,_0x1277f0[_0x2f07('0x49')]);return _0x462cbf[_0x2f07('0x9f')](_0x4b88a0);}})['then'](function(_0x17204c){if(_0x17204c){_0x326712=_0x17204c['length'];if(!_0x1277f0[_0x2f07('0x3a')][_0x2f07('0x3f')](_0x2f07('0x40'))){_0x4b88a0['limit']=qs[_0x2f07('0x27')](_0x1277f0[_0x2f07('0x3a')][_0x2f07('0x27')]);_0x4b88a0[_0x2f07('0x26')]=qs[_0x2f07('0x26')](_0x1277f0[_0x2f07('0x3a')][_0x2f07('0x26')]);}return _0x462cbf[_0x2f07('0x9f')](_0x4b88a0);}})[_0x2f07('0x1c')](function(_0x2048d4){if(_0x2048d4){return _0x2048d4?{'count':_0x326712,'rows':_0x2048d4}:null;}})[_0x2f07('0x1c')](respondWithResult(_0x5c3c4e,null))[_0x2f07('0x24')](handleError(_0x5c3c4e,null));};exports[_0x2f07('0xa0')]=function(_0x1de670,_0x21fa9e,_0x51574a){var _0x4d1971={'raw':![],'where':{}};var _0x200fe5={};var _0x2e8f51={'count':0x0,'rows':[]};return db[_0x2f07('0x36')][_0x2f07('0x60')]({'where':{'id':_0x1de670[_0x2f07('0x4e')]['id']}})['then'](handleEntityNotFound(_0x21fa9e,null))[_0x2f07('0x1c')](function(_0x1acbff){if(_0x1acbff){_0x200fe5['model']=_[_0x2f07('0x3b')](db[_0x2f07('0x86')][_0x2f07('0x50')]);_0x200fe5['query']=_[_0x2f07('0x3b')](_0x1de670[_0x2f07('0x3a')]);_0x200fe5[_0x2f07('0x44')]=_[_0x2f07('0x51')](_0x200fe5[_0x2f07('0x39')],_0x200fe5[_0x2f07('0x3a')]);_0x4d1971[_0x2f07('0x3c')]=_[_0x2f07('0x51')](_0x200fe5['model'],qs[_0x2f07('0x3d')](_0x1de670[_0x2f07('0x3a')][_0x2f07('0x3d')]));_0x4d1971['attributes']=_0x4d1971[_0x2f07('0x3c')][_0x2f07('0x3e')]?_0x4d1971[_0x2f07('0x3c')]:_0x200fe5[_0x2f07('0x39')];if(!_0x1de670[_0x2f07('0x3a')][_0x2f07('0x3f')]('nolimit')){_0x4d1971[_0x2f07('0x27')]=qs[_0x2f07('0x27')](_0x1de670[_0x2f07('0x3a')]['limit']);_0x4d1971[_0x2f07('0x26')]=qs[_0x2f07('0x26')](_0x1de670[_0x2f07('0x3a')][_0x2f07('0x26')]);}_0x4d1971[_0x2f07('0x41')]=qs[_0x2f07('0x42')](_0x1de670[_0x2f07('0x3a')]['sort']);_0x4d1971[_0x2f07('0x43')]=qs[_0x2f07('0x44')](_[_0x2f07('0x45')](_0x1de670[_0x2f07('0x3a')],_0x200fe5[_0x2f07('0x44')]));_0x4d1971[_0x2f07('0x43')][_0x2f07('0x62')]=_0x1acbff['id'];if(_0x1de670[_0x2f07('0x3a')][_0x2f07('0x46')]){_0x4d1971[_0x2f07('0x43')]=_[_0x2f07('0x52')](_0x4d1971[_0x2f07('0x43')],{'$or':_[_0x2f07('0x35')](_0x4d1971['attributes'],function(_0x55f1e7){var _0x4a54fb={};_0x4a54fb[_0x55f1e7]={'$like':'%'+_0x1de670[_0x2f07('0x3a')][_0x2f07('0x46')]+'%'};return _0x4a54fb;})});}_0x4d1971=_['merge']({},_0x4d1971,_0x1de670[_0x2f07('0x49')]);return db[_0x2f07('0x86')]['count']({'where':_0x4d1971[_0x2f07('0x43')]})[_0x2f07('0x1c')](function(_0x3d7e5d){_0x2e8f51['count']=_0x3d7e5d;if(_0x1de670['query'][_0x2f07('0x4a')]){_0x4d1971[_0x2f07('0x4b')]=[{'model':db['CmContact'],'as':_0x2f07('0xa1'),'required':![]},{'model':db[_0x2f07('0xa2')],'as':_0x2f07('0xa3'),'attributes':[_0x2f07('0x31'),'fullname',_0x2f07('0xa4')],'required':![]},{'model':db[_0x2f07('0xa5')],'as':'Tags','attributes':['id',_0x2f07('0x31'),_0x2f07('0xa6')],'where':_0x1de670[_0x2f07('0x3a')]['tag']?{'id':_0x1de670[_0x2f07('0x3a')]['tag']}:undefined,'required':_0x1de670[_0x2f07('0x3a')][_0x2f07('0xa7')]?!![]:![]}];}return db[_0x2f07('0x86')][_0x2f07('0x4c')](_0x4d1971);})[_0x2f07('0x1c')](function(_0x94ce1){_0x2e8f51[_0x2f07('0x4d')]=_0x94ce1;return _0x2e8f51;});}})[_0x2f07('0x1c')](respondWithFilteredResult(_0x21fa9e,_0x4d1971))['catch'](handleError(_0x21fa9e,null));};exports[_0x2f07('0xa8')]=function(_0x173a2c,_0x49c82f,_0x3e7fd6){return db[_0x2f07('0x36')]['find']({'where':{'id':_0x173a2c[_0x2f07('0x4e')]['id']}})[_0x2f07('0x1c')](handleEntityNotFound(_0x49c82f,null))[_0x2f07('0x1c')](function(_0x5ed592){if(_0x5ed592){return _0x5ed592['addAgents'](_0x173a2c[_0x2f07('0x5d')][_0x2f07('0x67')],_[_0x2f07('0xa9')](_0x173a2c[_0x2f07('0x5d')],['ids','id'])||{})[_0x2f07('0x89')](function(_0x46d80a){for(var _0x5871c0=0x0;_0x5871c0<_0x173a2c[_0x2f07('0x5d')][_0x2f07('0x67')]['length'];_0x5871c0+=0x1){socket[_0x2f07('0xaa')](_0x2f07('0xab'),{'UserId':Number(_0x173a2c[_0x2f07('0x5d')][_0x2f07('0x67')][_0x5871c0]),'OpenchannelAccountId':Number(_0x173a2c[_0x2f07('0x4e')]['id'])});}return _0x46d80a;});}})[_0x2f07('0x1c')](respondWithResult(_0x49c82f,null))[_0x2f07('0x24')](handleError(_0x49c82f,null));};exports[_0x2f07('0xac')]=function(_0x140c98,_0x3ec751,_0x2528d1){return db[_0x2f07('0x36')][_0x2f07('0x53')]({'where':{'id':_0x140c98[_0x2f07('0x4e')]['id']}})[_0x2f07('0x1c')](handleEntityNotFound(_0x3ec751,null))[_0x2f07('0x1c')](function(_0x3b308b){if(_0x3b308b){return _0x3b308b[_0x2f07('0xac')](_0x140c98[_0x2f07('0x3a')]['ids'])[_0x2f07('0x1c')](function(){if(_[_0x2f07('0xad')](_0x140c98['query']['ids'])){for(var _0x41382e=0x0;_0x41382e<_0x140c98[_0x2f07('0x3a')][_0x2f07('0x67')][_0x2f07('0x3e')];_0x41382e+=0x1){socket[_0x2f07('0xaa')](_0x2f07('0xae'),{'UserId':Number(_0x140c98[_0x2f07('0x3a')][_0x2f07('0x67')][_0x41382e]),'OpenchannelAccountId':Number(_0x140c98['params']['id'])});}}else{socket[_0x2f07('0xaa')]('userOpenchannelAccount:remove',{'UserId':Number(_0x140c98[_0x2f07('0x3a')][_0x2f07('0x67')]),'OpenchannelAccountId':Number(_0x140c98[_0x2f07('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ec751,null))[_0x2f07('0x24')](handleError(_0x3ec751,null));};exports[_0x2f07('0xaf')]=function(_0x3c33d4,_0x1050b0,_0x12c8af){var _0x304044={};var _0xe7724f={};var _0x5c9e00;var _0x78dce;return db['OpenchannelAccount'][_0x2f07('0x60')]({'where':{'id':_0x3c33d4['params']['id']}})[_0x2f07('0x1c')](handleEntityNotFound(_0x1050b0,null))[_0x2f07('0x1c')](function(_0x124395){if(_0x124395){_0x5c9e00=_0x124395;_0xe7724f[_0x2f07('0x39')]=_[_0x2f07('0x3b')](db['User'][_0x2f07('0x50')]);_0xe7724f[_0x2f07('0x3a')]=_['keys'](_0x3c33d4['query']);_0xe7724f[_0x2f07('0x44')]=_[_0x2f07('0x51')](_0xe7724f[_0x2f07('0x39')],_0xe7724f['query']);_0x304044['attributes']=_[_0x2f07('0x51')](_0xe7724f[_0x2f07('0x39')],qs['fields'](_0x3c33d4[_0x2f07('0x3a')][_0x2f07('0x3d')]));_0x304044[_0x2f07('0x3c')]=_0x304044[_0x2f07('0x3c')]['length']?_0x304044['attributes']:_0xe7724f[_0x2f07('0x39')];_0x304044['order']=qs[_0x2f07('0x42')](_0x3c33d4[_0x2f07('0x3a')][_0x2f07('0x42')]);_0x304044[_0x2f07('0x43')]=qs[_0x2f07('0x44')](_['pick'](_0x3c33d4[_0x2f07('0x3a')],_0xe7724f['filters']));if(_0x3c33d4['query'][_0x2f07('0x46')]){_0x304044['where']=_[_0x2f07('0x52')](_0x304044[_0x2f07('0x43')],{'$or':_[_0x2f07('0x35')](_0x304044[_0x2f07('0x3c')],function(_0x2700c0){var _0x2ce9b9={};_0x2ce9b9[_0x2700c0]={'$like':'%'+_0x3c33d4['query'][_0x2f07('0x46')]+'%'};return _0x2ce9b9;})});}_0x304044=_[_0x2f07('0x52')]({},_0x304044,_0x3c33d4['options']);return _0x5c9e00[_0x2f07('0xaf')](_0x304044);}})[_0x2f07('0x1c')](function(_0x31561e){if(_0x31561e){_0x78dce=_0x31561e[_0x2f07('0x3e')];if(!_0x3c33d4[_0x2f07('0x3a')][_0x2f07('0x3f')](_0x2f07('0x40'))){_0x304044[_0x2f07('0x27')]=qs['limit'](_0x3c33d4['query'][_0x2f07('0x27')]);_0x304044[_0x2f07('0x26')]=qs['offset'](_0x3c33d4[_0x2f07('0x3a')][_0x2f07('0x26')]);}return _0x5c9e00['getAgents'](_0x304044);}})[_0x2f07('0x1c')](function(_0x456b78){if(_0x456b78){return _0x456b78?{'count':_0x78dce,'rows':_0x456b78}:null;}})['then'](respondWithResult(_0x1050b0,null))[_0x2f07('0x24')](handleError(_0x1050b0,null));};exports[_0x2f07('0x32')]=function(_0x78a543,_0x2db38d,_0x1264db){var _0x3027ed,_0x416cba,_0x2c6e79;if(_[_0x2f07('0x72')](_0x78a543[_0x2f07('0x5d')][_0x2f07('0x5d')])||_0x78a543[_0x2f07('0x5d')][_0x2f07('0x5d')]===''){throw new db[(_0x2f07('0x6a'))]['ValidationError'](_0x2f07('0xb0'));}if(_[_0x2f07('0x72')](_0x78a543[_0x2f07('0x5d')]['to'])){}_0x3027ed=_0x78a543[_0x2f07('0x5d')]['to'];return db[_0x2f07('0x36')][_0x2f07('0x60')]({'where':{'id':_0x78a543[_0x2f07('0x4e')]['id']}})[_0x2f07('0x1c')](handleEntityNotFound(_0x2db38d,null))['then'](function(_0x463ed7){if(_0x463ed7){return db[_0x2f07('0x36')][_0x2f07('0x53')]({'where':{'id':_0x463ed7['id']},'include':[{'model':db['CmList'],'as':_0x2f07('0x77'),'include':[{'model':db[_0x2f07('0x78')],'as':'Contacts','where':{[_0x463ed7[_0x2f07('0x73')]]:_0x3027ed},'limit':0x1,'order':[['updatedAt',_0x2f07('0xb1')]]}]}]})[_0x2f07('0x1c')](handleEntityNotFound(_0x2db38d,null))['then'](function(_0x387d1a){if(_0x387d1a&&_0x387d1a[_0x2f07('0x77')]){_0x416cba=_0x387d1a[_0x2f07('0x2e')]({'plain':!![]});if(_0x416cba[_0x2f07('0x77')]&&_0x416cba[_0x2f07('0x77')][_0x2f07('0x80')][_0x2f07('0x3e')]){return _0x416cba['List'][_0x2f07('0x80')][0x0];}return db[_0x2f07('0x78')][_0x2f07('0x54')](_[_0x2f07('0x14')](_0x78a543[_0x2f07('0x5d')],{'firstName':_0x3027ed,[_0x387d1a[_0x2f07('0x73')]]:_0x3027ed,'phone':_0x3027ed,'ListId':_0x416cba[_0x2f07('0x81')]}));}})['then'](handleEntityNotFound(_0x2db38d,null))[_0x2f07('0x1c')](function(_0x24d0de){if(_0x24d0de){_0x2c6e79=_0x24d0de;return db[_0x2f07('0x86')][_0x2f07('0x53')]({'where':{'ContactId':_0x2c6e79['id'],'closed':![],'OpenchannelAccountId':_0x416cba['id']}})['then'](function(_0x186d6c){if(_0x186d6c){return[_0x186d6c,![]];}return db['OpenchannelInteraction'][_0x2f07('0x54')]({'UserId':_0x78a543[_0x2f07('0x57')]['id'],'ContactId':_0x2c6e79['id'],'OpenchannelAccountId':_0x416cba['id'],'lastMsgDirection':'out','Messages':[_[_0x2f07('0x52')](_0x78a543[_0x2f07('0x5d')],{'read':![],'body':_0x78a543[_0x2f07('0x5d')][_0x2f07('0x5d')],'OpenchannelAccountId':_0x416cba['id'],'UserId':_0x78a543[_0x2f07('0x57')]['id'],'ContactId':_0x2c6e79['id']})]},{'include':[{'model':db[_0x2f07('0x91')],'as':_0x2f07('0xb2')}]})[_0x2f07('0x1c')](function(_0x5306a6){return[_0x5306a6,!![]];});});}})[_0x2f07('0x89')](function(_0x227da3,_0x4e966e){if(_0x4e966e){return _0x227da3;}return db[_0x2f07('0x91')][_0x2f07('0x54')](_[_0x2f07('0x52')](_0x78a543[_0x2f07('0x5d')],{'read':![],'body':_0x78a543[_0x2f07('0x5d')][_0x2f07('0x5d')],'OpenchannelAccountId':_0x416cba['id'],'OpenchannelInteractionId':_0x227da3['id'],'UserId':_0x78a543[_0x2f07('0x57')]['id'],'ContactId':_0x2c6e79['id']}))[_0x2f07('0x1c')](function(_0x492caa){_0x227da3['dataValues'][_0x2f07('0xb2')]=[];_0x227da3[_0x2f07('0xb3')][_0x2f07('0xb2')][_0x2f07('0x8e')](_0x492caa['dataValues']);return _0x227da3;});});}})[_0x2f07('0x1c')](respondWithResult(_0x2db38d,null))[_0x2f07('0x24')](handleError(_0x2db38d,null));}; \ No newline at end of file +var _0x12da=['include','rows','show','params','keys','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','OpenchannelAccountId','Disposition','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','DESC','OpenchannelApplication','Applications','List','list','applications','priority','asc','account','defaults','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','EventManager','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','Contact','fullname','Tag','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','isNil','out','dataValues','Messages','push','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','redis','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','json','offset','undefined','count','limit','status','set','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll'];(function(_0x53b55f,_0x7980d0){var _0x71d9fa=function(_0x1c30c2){while(--_0x1c30c2){_0x53b55f['push'](_0x53b55f['shift']());}};_0x71d9fa(++_0x7980d0);}(_0x12da,0x67));var _0xa12d=function(_0x2f8920,_0x42674a){_0x2f8920=_0x2f8920-0x0;var _0x56ff01=_0x12da[_0x2f8920];return _0x56ff01;};'use strict';var emlformat=require(_0xa12d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa12d('0x1'));var jsonpatch=require(_0xa12d('0x2'));var rp=require(_0xa12d('0x3'));var moment=require(_0xa12d('0x4'));var BPromise=require(_0xa12d('0x5'));var Mustache=require(_0xa12d('0x6'));var util=require('util');var path=require(_0xa12d('0x7'));var sox=require(_0xa12d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa12d('0x9'));var _=require(_0xa12d('0xa'));var squel=require(_0xa12d('0xb'));var crypto=require(_0xa12d('0xc'));var jsforce=require(_0xa12d('0xd'));var deskjs=require(_0xa12d('0xe'));var toCsv=require(_0xa12d('0xf'));var querystring=require('querystring');var Papa=require(_0xa12d('0x10'));var Redis=require('ioredis');var authService=require(_0xa12d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa12d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa12d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa12d('0x14'));var db=require(_0xa12d('0x15'))['db'];config[_0xa12d('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa12d('0x17'))[_0xa12d('0x18')](socket);var jayson=require(_0xa12d('0x19'));var client=jayson[_0xa12d('0x1a')][_0xa12d('0x1b')]({'port':0x232c});var client9002=jayson[_0xa12d('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5613ea,_0x2c4ad0,_0x42799b,_0x79a2da){return new BPromise(function(_0x68ad3b,_0x5b5a3d){var _0x38dd3b=_0x79a2da||client;return _0x38dd3b[_0xa12d('0x1c')](_0x5613ea,_0x42799b)[_0xa12d('0x1d')](function(_0x3b9ffa){logger[_0xa12d('0x1e')](_0xa12d('0x1f'),_0x2c4ad0,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2c4ad0,_0xa12d('0x20'),JSON[_0xa12d('0x21')](_0x3b9ffa));if(_0x3b9ffa[_0xa12d('0x22')]){if(_0x3b9ffa[_0xa12d('0x22')]['code']===0x1f4){logger['error'](_0xa12d('0x1f'),_0x2c4ad0,_0x3b9ffa['error']['message']);return _0x5b5a3d(_0x3b9ffa[_0xa12d('0x22')][_0xa12d('0x23')]);}logger[_0xa12d('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x2c4ad0,_0x3b9ffa['error']['message']);return _0x68ad3b(_0x3b9ffa[_0xa12d('0x22')][_0xa12d('0x23')]);}else{logger['info'](_0xa12d('0x1f'),_0x2c4ad0,_0xa12d('0x20'));_0x68ad3b(_0x3b9ffa[_0xa12d('0x24')][_0xa12d('0x23')]);}})[_0xa12d('0x25')](function(_0xcb7bf5){logger[_0xa12d('0x22')](_0xa12d('0x1f'),_0x2c4ad0,_0xcb7bf5);_0x5b5a3d(_0xcb7bf5);});});}function respondWithStatusCode(_0x257365,_0x28d080){_0x28d080=_0x28d080||0xcc;return function(_0xd4bfeb){if(_0xd4bfeb){return _0x257365[_0xa12d('0x26')](_0x28d080);}return _0x257365['status'](_0x28d080)[_0xa12d('0x27')]();};}function respondWithResult(_0x57fd2b,_0x2c0146){_0x2c0146=_0x2c0146||0xc8;return function(_0x54f27c){if(_0x54f27c){return _0x57fd2b['status'](_0x2c0146)[_0xa12d('0x28')](_0x54f27c);}};}function respondWithFilteredResult(_0x837455,_0x752c43){return function(_0x30f069){if(_0x30f069){var _0x392c3c=typeof _0x752c43[_0xa12d('0x29')]===_0xa12d('0x2a')&&typeof _0x752c43['limit']===_0xa12d('0x2a');var _0x5bc060=_0x30f069[_0xa12d('0x2b')];var _0x47bd74=_0x392c3c?0x0:_0x752c43[_0xa12d('0x29')];var _0x3f98a6=_0x392c3c?_0x30f069[_0xa12d('0x2b')]:_0x752c43[_0xa12d('0x29')]+_0x752c43[_0xa12d('0x2c')];var _0x10c87e;if(_0x3f98a6>=_0x5bc060){_0x3f98a6=_0x5bc060;_0x10c87e=0xc8;}else{_0x10c87e=0xce;}_0x837455[_0xa12d('0x2d')](_0x10c87e);return _0x837455[_0xa12d('0x2e')]('Content-Range',_0x47bd74+'-'+_0x3f98a6+'/'+_0x5bc060)[_0xa12d('0x28')](_0x30f069);}return null;};}function patchUpdates(_0x4e74a4){return function(_0x28c61f){try{jsonpatch['apply'](_0x28c61f,_0x4e74a4,!![]);}catch(_0x5998f8){return BPromise[_0xa12d('0x2f')](_0x5998f8);}return _0x28c61f['save']();};}function saveUpdates(_0x498a6f,_0x90529f){return function(_0x5162a3){if(_0x5162a3){return _0x5162a3[_0xa12d('0x30')](_0x498a6f)[_0xa12d('0x1d')](function(_0xdd3857){return _0xdd3857;});}return null;};}function removeEntity(_0xdaece5,_0x51b32a){return function(_0x31dc58){if(_0x31dc58){return _0x31dc58[_0xa12d('0x31')]()['then'](function(){var _0x3faff4=_0x31dc58[_0xa12d('0x32')]({'plain':!![]});var _0x4cdfb7=_0xa12d('0x33');return db[_0xa12d('0x34')][_0xa12d('0x31')]({'where':{'type':_0x4cdfb7,'resourceId':_0x3faff4['id']}})[_0xa12d('0x1d')](function(){return _0x31dc58;});})[_0xa12d('0x1d')](function(){_0xdaece5[_0xa12d('0x2d')](0xcc)[_0xa12d('0x27')]();});}};}function handleEntityNotFound(_0x4470a2,_0x14ddf2){return function(_0x3350e4){if(!_0x3350e4){_0x4470a2['sendStatus'](0x194);}return _0x3350e4;};}function handleError(_0x41ad09,_0x15ae78){_0x15ae78=_0x15ae78||0x1f4;return function(_0x742975){logger[_0xa12d('0x22')](_0x742975[_0xa12d('0x35')]);if(_0x742975['name']){delete _0x742975[_0xa12d('0x36')];}_0x41ad09[_0xa12d('0x2d')](_0x15ae78)[_0xa12d('0x37')](_0x742975);};}exports[_0xa12d('0x38')]=function(_0x4c9e88,_0xa449cf){var _0x5edf6d={'include':[{'model':db[_0xa12d('0x39')],'as':_0xa12d('0x3a')}]},_0x47368e={},_0x110838={'count':0x0,'rows':[]};var _0x50af2c=_[_0xa12d('0x3b')](db[_0xa12d('0x3c')][_0xa12d('0x3d')],function(_0x4779f0){return{'name':_0x4779f0['fieldName'],'type':_0x4779f0[_0xa12d('0x3e')][_0xa12d('0x3f')]};});_0x47368e[_0xa12d('0x40')]=_['map'](_0x50af2c,_0xa12d('0x36'));_0x47368e['query']=_['keys'](_0x4c9e88[_0xa12d('0x41')]);_0x47368e['filters']=_[_0xa12d('0x42')](_0x47368e[_0xa12d('0x40')],_0x47368e[_0xa12d('0x41')]);_0x5edf6d[_0xa12d('0x43')]=_['intersection'](_0x47368e[_0xa12d('0x40')],qs[_0xa12d('0x44')](_0x4c9e88[_0xa12d('0x41')]['fields']));_0x5edf6d[_0xa12d('0x43')]=_0x5edf6d[_0xa12d('0x43')]['length']?_0x5edf6d[_0xa12d('0x43')]:_0x47368e[_0xa12d('0x40')];if(!_0x4c9e88[_0xa12d('0x41')][_0xa12d('0x45')](_0xa12d('0x46'))){_0x5edf6d['limit']=qs[_0xa12d('0x2c')](_0x4c9e88['query']['limit']);_0x5edf6d['offset']=qs[_0xa12d('0x29')](_0x4c9e88[_0xa12d('0x41')]['offset']);}_0x5edf6d[_0xa12d('0x47')]=qs[_0xa12d('0x48')](_0x4c9e88['query'][_0xa12d('0x48')]);_0x5edf6d[_0xa12d('0x49')]=qs[_0xa12d('0x4a')](_[_0xa12d('0x4b')](_0x4c9e88[_0xa12d('0x41')],_0x47368e[_0xa12d('0x4a')]),_0x50af2c);if(_0x4c9e88[_0xa12d('0x41')][_0xa12d('0x4c')]){_0x5edf6d['where']=_[_0xa12d('0x4d')](_0x5edf6d[_0xa12d('0x49')],{'$or':_[_0xa12d('0x3b')](_0x50af2c,function(_0x457040){if(_0x457040[_0xa12d('0x3e')]!==_0xa12d('0x4e')){var _0x5d3698={};_0x5d3698[_0x457040[_0xa12d('0x36')]]={'$like':'%'+_0x4c9e88[_0xa12d('0x41')][_0xa12d('0x4c')]+'%'};return _0x5d3698;}})});}_0x5edf6d=_[_0xa12d('0x4d')]({},_0x5edf6d,_0x4c9e88['options']);var _0x26936b={'where':_0x5edf6d[_0xa12d('0x49')]};return db[_0xa12d('0x3c')][_0xa12d('0x2b')](_0x26936b)[_0xa12d('0x1d')](function(_0x3465fc){_0x110838[_0xa12d('0x2b')]=_0x3465fc;if(_0x4c9e88[_0xa12d('0x41')][_0xa12d('0x4f')]){_0x5edf6d[_0xa12d('0x50')]=[{'all':!![]}];}return db[_0xa12d('0x3c')]['findAll'](_0x5edf6d);})[_0xa12d('0x1d')](function(_0x6c8d27){_0x110838[_0xa12d('0x51')]=_0x6c8d27;return _0x110838;})[_0xa12d('0x1d')](respondWithFilteredResult(_0xa449cf,_0x5edf6d))['catch'](handleError(_0xa449cf,null));};exports[_0xa12d('0x52')]=function(_0x5ea048,_0x1b98e1){var _0x3ada19={'raw':![],'where':{'id':_0x5ea048[_0xa12d('0x53')]['id']},'include':[{'model':db[_0xa12d('0x39')],'as':'mandatoryDispositionPause'}]},_0x2c7e76={};_0x2c7e76[_0xa12d('0x40')]=_[_0xa12d('0x54')](db['OpenchannelAccount'][_0xa12d('0x3d')]);_0x2c7e76[_0xa12d('0x41')]=_[_0xa12d('0x54')](_0x5ea048[_0xa12d('0x41')]);_0x2c7e76['filters']=_[_0xa12d('0x42')](_0x2c7e76[_0xa12d('0x40')],_0x2c7e76[_0xa12d('0x41')]);_0x3ada19['attributes']=_[_0xa12d('0x42')](_0x2c7e76[_0xa12d('0x40')],qs[_0xa12d('0x44')](_0x5ea048[_0xa12d('0x41')]['fields']));_0x3ada19[_0xa12d('0x43')]=_0x3ada19[_0xa12d('0x43')][_0xa12d('0x55')]?_0x3ada19[_0xa12d('0x43')]:_0x2c7e76['model'];if(_0x5ea048[_0xa12d('0x41')][_0xa12d('0x4f')]){_0x3ada19['include']=[{'all':!![]}];}_0x3ada19=_[_0xa12d('0x4d')]({},_0x3ada19,_0x5ea048[_0xa12d('0x56')]);return db[_0xa12d('0x3c')][_0xa12d('0x57')](_0x3ada19)[_0xa12d('0x1d')](handleEntityNotFound(_0x1b98e1,null))[_0xa12d('0x1d')](respondWithResult(_0x1b98e1,null))[_0xa12d('0x25')](handleError(_0x1b98e1,null));};exports[_0xa12d('0x58')]=function(_0x3c08eb,_0x17b36c){return db[_0xa12d('0x3c')][_0xa12d('0x58')](_0x3c08eb[_0xa12d('0x59')],{})[_0xa12d('0x1d')](function(_0x19afb7){var _0x20ac7d=_0x3c08eb['user']['get']({'plain':!![]});if(!_0x20ac7d)throw new Error(_0xa12d('0x5a'));if(_0x20ac7d[_0xa12d('0x5b')]===_0xa12d('0x5c')){var _0x33c2bb=_0x19afb7[_0xa12d('0x32')]({'plain':!![]});var _0x47eb4e=_0xa12d('0x33');return db[_0xa12d('0x5d')][_0xa12d('0x57')]({'where':{'name':_0x47eb4e,'userProfileId':_0x20ac7d['userProfileId']},'raw':!![]})['then'](function(_0x235dff){if(_0x235dff&&_0x235dff['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x33c2bb['name'],'resourceId':_0x33c2bb['id'],'type':_0x235dff[_0xa12d('0x36')],'sectionId':_0x235dff['id']},{})['then'](function(){return _0x19afb7;});}else{return _0x19afb7;}})['catch'](function(_0x2689a9){logger[_0xa12d('0x22')](_0xa12d('0x5e'),_0x2689a9);throw _0x2689a9;});}return _0x19afb7;})[_0xa12d('0x1d')](respondWithResult(_0x17b36c,0xc9))[_0xa12d('0x25')](handleError(_0x17b36c,null));};exports['update']=function(_0x286482,_0x2bf0ba){if(_0x286482[_0xa12d('0x59')]['id']){delete _0x286482[_0xa12d('0x59')]['id'];}return db[_0xa12d('0x3c')][_0xa12d('0x57')]({'where':{'id':_0x286482[_0xa12d('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0xa12d('0x3a')}]})[_0xa12d('0x1d')](handleEntityNotFound(_0x2bf0ba,null))[_0xa12d('0x1d')](saveUpdates(_0x286482[_0xa12d('0x59')],null))[_0xa12d('0x1d')](respondWithResult(_0x2bf0ba,null))[_0xa12d('0x25')](handleError(_0x2bf0ba,null));};exports[_0xa12d('0x31')]=function(_0x5bf575,_0x497d19){return db['OpenchannelAccount'][_0xa12d('0x57')]({'where':{'id':_0x5bf575[_0xa12d('0x53')]['id']}})[_0xa12d('0x1d')](handleEntityNotFound(_0x497d19,null))[_0xa12d('0x1d')](removeEntity(_0x497d19,null))['catch'](handleError(_0x497d19,null));};exports[_0xa12d('0x5f')]=function(_0x17c7c6,_0x53de39){return db[_0xa12d('0x3c')]['describe']()[_0xa12d('0x1d')](respondWithResult(_0x53de39,null))[_0xa12d('0x25')](handleError(_0x53de39,null));};exports[_0xa12d('0x60')]=function(_0x1201d1,_0x484309,_0xd01630){if(_0x1201d1[_0xa12d('0x59')]['id']){delete _0x1201d1[_0xa12d('0x59')]['id'];}return db[_0xa12d('0x3c')]['find']({'where':{'id':_0x1201d1[_0xa12d('0x53')]['id']}})['then'](handleEntityNotFound(_0x484309,null))[_0xa12d('0x1d')](function(_0x5e4bbe){if(_0x5e4bbe){_0x1201d1[_0xa12d('0x59')]['OpenchannelAccountId']=_0x5e4bbe['id'];return db['Disposition'][_0xa12d('0x58')](_0x1201d1[_0xa12d('0x59')]);}})['then'](respondWithResult(_0x484309,null))[_0xa12d('0x25')](handleError(_0x484309,null));};exports[_0xa12d('0x61')]=function(_0x3a5b35,_0x37f5a5,_0x51b9bd){var _0x4f5d74={'raw':![],'where':{}};var _0x437de4={};var _0x17117a={'count':0x0,'rows':[]};return db[_0xa12d('0x3c')][_0xa12d('0x62')]({'where':{'id':_0x3a5b35[_0xa12d('0x53')]['id']}})[_0xa12d('0x1d')](handleEntityNotFound(_0x37f5a5,null))[_0xa12d('0x1d')](function(_0x15c82a){if(_0x15c82a){_0x437de4['model']=_[_0xa12d('0x54')](db['Disposition'][_0xa12d('0x3d')]);_0x437de4['query']=_[_0xa12d('0x54')](_0x3a5b35[_0xa12d('0x41')]);_0x437de4[_0xa12d('0x4a')]=_[_0xa12d('0x42')](_0x437de4[_0xa12d('0x40')],_0x437de4[_0xa12d('0x41')]);_0x4f5d74[_0xa12d('0x43')]=_[_0xa12d('0x42')](_0x437de4[_0xa12d('0x40')],qs[_0xa12d('0x44')](_0x3a5b35[_0xa12d('0x41')][_0xa12d('0x44')]));_0x4f5d74['attributes']=_0x4f5d74['attributes']['length']?_0x4f5d74[_0xa12d('0x43')]:_0x437de4['model'];if(!_0x3a5b35[_0xa12d('0x41')][_0xa12d('0x45')]('nolimit')){_0x4f5d74[_0xa12d('0x2c')]=qs[_0xa12d('0x2c')](_0x3a5b35[_0xa12d('0x41')][_0xa12d('0x2c')]);_0x4f5d74[_0xa12d('0x29')]=qs['offset'](_0x3a5b35['query'][_0xa12d('0x29')]);}_0x4f5d74[_0xa12d('0x47')]=qs['sort'](_0x3a5b35[_0xa12d('0x41')][_0xa12d('0x48')]);_0x4f5d74[_0xa12d('0x49')]=qs[_0xa12d('0x4a')](_[_0xa12d('0x4b')](_0x3a5b35[_0xa12d('0x41')],_0x437de4[_0xa12d('0x4a')]));_0x4f5d74[_0xa12d('0x49')][_0xa12d('0x63')]=_0x15c82a['id'];if(_0x3a5b35[_0xa12d('0x41')]['filter']){_0x4f5d74[_0xa12d('0x49')]=_[_0xa12d('0x4d')](_0x4f5d74[_0xa12d('0x49')],{'$or':_[_0xa12d('0x3b')](_0x4f5d74[_0xa12d('0x43')],function(_0x563432){var _0x1dc81b={};_0x1dc81b[_0x563432]={'$like':'%'+_0x3a5b35['query'][_0xa12d('0x4c')]+'%'};return _0x1dc81b;})});}_0x4f5d74=_[_0xa12d('0x4d')]({},_0x4f5d74,_0x3a5b35['options']);return db['Disposition']['count']({'where':_0x4f5d74[_0xa12d('0x49')]})[_0xa12d('0x1d')](function(_0x2144d6){_0x17117a[_0xa12d('0x2b')]=_0x2144d6;if(_0x3a5b35['query'][_0xa12d('0x4f')]){_0x4f5d74[_0xa12d('0x50')]=[{'all':!![]}];}return db[_0xa12d('0x64')][_0xa12d('0x65')](_0x4f5d74);})['then'](function(_0x3e6929){_0x17117a[_0xa12d('0x51')]=_0x3e6929;return _0x17117a;});}})[_0xa12d('0x1d')](respondWithFilteredResult(_0x37f5a5,_0x4f5d74))['catch'](handleError(_0x37f5a5,null));};exports[_0xa12d('0x66')]=function(_0x3f04e8,_0x15d12e,_0x5a6e59){return db['OpenchannelAccount'][_0xa12d('0x57')]({'where':{'id':_0x3f04e8[_0xa12d('0x53')]['id']}})[_0xa12d('0x1d')](handleEntityNotFound(_0x15d12e,null))['then'](function(_0x5f31ec){if(_0x5f31ec){return _0x5f31ec['removeDispositions'](_0x3f04e8['query'][_0xa12d('0x67')]);}})[_0xa12d('0x1d')](respondWithStatusCode(_0x15d12e,null))[_0xa12d('0x25')](handleError(_0x15d12e,null));};exports['addAnswer']=function(_0xc27029,_0x40ab10,_0x24825f){if(_0xc27029[_0xa12d('0x59')]['id']){delete _0xc27029[_0xa12d('0x59')]['id'];}return db['OpenchannelAccount'][_0xa12d('0x57')]({'where':{'id':_0xc27029[_0xa12d('0x53')]['id']}})['then'](handleEntityNotFound(_0x40ab10,null))[_0xa12d('0x1d')](function(_0x2fc378){if(_0x2fc378){_0xc27029[_0xa12d('0x59')][_0xa12d('0x63')]=_0x2fc378['id'];return db[_0xa12d('0x68')][_0xa12d('0x58')](_0xc27029[_0xa12d('0x59')]);}})[_0xa12d('0x1d')](respondWithResult(_0x40ab10,null))['catch'](handleError(_0x40ab10,null));};exports[_0xa12d('0x69')]=function(_0xcec32b,_0x2bbe90,_0x3f8c1c){var _0x5e4643={'raw':![],'where':{}};var _0x3f0ee0={};var _0x1ee87d={'count':0x0,'rows':[]};return db[_0xa12d('0x3c')][_0xa12d('0x62')]({'where':{'id':_0xcec32b[_0xa12d('0x53')]['id']}})[_0xa12d('0x1d')](handleEntityNotFound(_0x2bbe90,null))[_0xa12d('0x1d')](function(_0x1b8a0a){if(_0x1b8a0a){_0x3f0ee0[_0xa12d('0x40')]=_[_0xa12d('0x54')](db[_0xa12d('0x68')][_0xa12d('0x3d')]);_0x3f0ee0[_0xa12d('0x41')]=_[_0xa12d('0x54')](_0xcec32b[_0xa12d('0x41')]);_0x3f0ee0[_0xa12d('0x4a')]=_[_0xa12d('0x42')](_0x3f0ee0[_0xa12d('0x40')],_0x3f0ee0[_0xa12d('0x41')]);_0x5e4643['attributes']=_[_0xa12d('0x42')](_0x3f0ee0['model'],qs['fields'](_0xcec32b[_0xa12d('0x41')][_0xa12d('0x44')]));_0x5e4643[_0xa12d('0x43')]=_0x5e4643[_0xa12d('0x43')][_0xa12d('0x55')]?_0x5e4643[_0xa12d('0x43')]:_0x3f0ee0[_0xa12d('0x40')];if(!_0xcec32b['query'][_0xa12d('0x45')](_0xa12d('0x46'))){_0x5e4643[_0xa12d('0x2c')]=qs[_0xa12d('0x2c')](_0xcec32b[_0xa12d('0x41')]['limit']);_0x5e4643[_0xa12d('0x29')]=qs[_0xa12d('0x29')](_0xcec32b[_0xa12d('0x41')][_0xa12d('0x29')]);}_0x5e4643[_0xa12d('0x47')]=qs[_0xa12d('0x48')](_0xcec32b['query'][_0xa12d('0x48')]);_0x5e4643['where']=qs['filters'](_[_0xa12d('0x4b')](_0xcec32b['query'],_0x3f0ee0['filters']));_0x5e4643[_0xa12d('0x49')][_0xa12d('0x63')]=_0x1b8a0a['id'];if(_0xcec32b[_0xa12d('0x41')]['filter']){_0x5e4643['where']=_[_0xa12d('0x4d')](_0x5e4643[_0xa12d('0x49')],{'$or':_[_0xa12d('0x3b')](_0x5e4643['attributes'],function(_0x4a294f){var _0x399d00={};_0x399d00[_0x4a294f]={'$like':'%'+_0xcec32b[_0xa12d('0x41')][_0xa12d('0x4c')]+'%'};return _0x399d00;})});}_0x5e4643=_['merge']({},_0x5e4643,_0xcec32b[_0xa12d('0x56')]);return db[_0xa12d('0x68')]['count']({'where':_0x5e4643[_0xa12d('0x49')]})[_0xa12d('0x1d')](function(_0x2781b4){_0x1ee87d[_0xa12d('0x2b')]=_0x2781b4;if(_0xcec32b['query'][_0xa12d('0x4f')]){_0x5e4643['include']=[{'all':!![]}];}return db[_0xa12d('0x68')][_0xa12d('0x65')](_0x5e4643);})[_0xa12d('0x1d')](function(_0x3bcbbe){_0x1ee87d[_0xa12d('0x51')]=_0x3bcbbe;return _0x1ee87d;});}})[_0xa12d('0x1d')](respondWithFilteredResult(_0x2bbe90,_0x5e4643))['catch'](handleError(_0x2bbe90,null));};exports['removeAnswers']=function(_0x587cc9,_0x248ba2,_0x6afc14){return db['OpenchannelAccount']['find']({'where':{'id':_0x587cc9[_0xa12d('0x53')]['id']}})[_0xa12d('0x1d')](handleEntityNotFound(_0x248ba2,null))[_0xa12d('0x1d')](function(_0x478b4a){if(_0x478b4a){return _0x478b4a[_0xa12d('0x6a')](_0x587cc9[_0xa12d('0x41')][_0xa12d('0x67')]);}})['then'](respondWithStatusCode(_0x248ba2,null))['catch'](handleError(_0x248ba2,null));};exports[_0xa12d('0x6b')]=function(_0x3a4383,_0x158f2d,_0x53d6e7){var _0x4c066b={'body':_0x3a4383[_0xa12d('0x59')],'channel':_0xa12d('0x6c')};var _0x5aa0e0=[];var _0x148452=[];var _0x11db40={};var _0xa5b3e1=![];return db[_0xa12d('0x6d')][_0xa12d('0x5f')]()[_0xa12d('0x1d')](function(_0x50ed51){if(!_0x50ed51){throw new db[(_0xa12d('0x6e'))][(_0xa12d('0x6f'))](_0xa12d('0x70'));}_0x5aa0e0=_[_0xa12d('0x71')](_[_0xa12d('0x54')](_0x50ed51),[_0xa12d('0x72'),_0xa12d('0x73')]);_0x148452=_['difference'](_['keys'](_0x50ed51),['createdAt',_0xa12d('0x73'),_0xa12d('0x74'),_0xa12d('0x75')]);if(_0x3a4383[_0xa12d('0x59')]['id']){delete _0x3a4383['body']['id'];}if(_['isNil'](_0x3a4383[_0xa12d('0x59')]['from'])){throw new db['Sequelize']['ValidationError'](_0xa12d('0x76'));}if(_['isNil'](_0x3a4383['body'][_0xa12d('0x59')])||_0x3a4383[_0xa12d('0x59')][_0xa12d('0x59')]===''){throw new db[(_0xa12d('0x6e'))][(_0xa12d('0x6f'))](_0xa12d('0x77'));}if(_['isNil'](_0x3a4383[_0xa12d('0x59')][_0xa12d('0x78')])){throw new db[(_0xa12d('0x6e'))][(_0xa12d('0x6f'))](_0xa12d('0x79')+_0x148452);}if(!_['includes'](_0x148452,_0x3a4383['body']['mapKey'])){throw new db['Sequelize'][(_0xa12d('0x6f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x148452);}_0x11db40[_0x3a4383[_0xa12d('0x59')][_0xa12d('0x78')]]=_0x3a4383[_0xa12d('0x59')][_0xa12d('0x7a')];})[_0xa12d('0x1d')](function(){return db[_0xa12d('0x3c')][_0xa12d('0x57')]({'where':{'id':_0x3a4383[_0xa12d('0x53')]['id']},'include':[{'model':db[_0xa12d('0x7b')],'as':'List','include':[{'model':db[_0xa12d('0x6d')],'as':_0xa12d('0x7c'),'where':_0x11db40,'limit':0x1,'order':[[_0xa12d('0x73'),_0xa12d('0x7d')]]}]},{'model':db[_0xa12d('0x7e')],'as':_0xa12d('0x7f')}]});})['then'](handleEntityNotFound(_0x158f2d,null))[_0xa12d('0x1d')](function(_0x4ac006){if(_0x4ac006&&_0x4ac006[_0xa12d('0x80')]){_0x4c066b['account']=_0x4ac006;_0x4c066b['applications']=_0x4ac006[_0xa12d('0x7f')];_0x4c066b[_0xa12d('0x81')]=_0x4ac006['List'];_0x4c066b['applications']=_['orderBy'](_0x4c066b[_0xa12d('0x82')],[_0xa12d('0x83')],[_0xa12d('0x84')]);if(_0x4c066b[_0xa12d('0x85')][_0xa12d('0x7f')]){delete _0x4c066b['account'][_0xa12d('0x7f')];}if(_0x4c066b[_0xa12d('0x85')][_0xa12d('0x80')]&&_0x4c066b['account'][_0xa12d('0x80')]['Contacts'][_0xa12d('0x55')]){return _0x4c066b[_0xa12d('0x85')][_0xa12d('0x80')][_0xa12d('0x7c')][0x0];}var _0x2fe318=_[_0xa12d('0x86')](_0x3a4383['body'],{'firstName':_0x3a4383[_0xa12d('0x59')][_0xa12d('0x7a')],'ListId':_0x4ac006['ListId']});_0x2fe318[_0x3a4383[_0xa12d('0x59')]['mapKey']]=_0x3a4383[_0xa12d('0x59')]['from'];return db[_0xa12d('0x6d')][_0xa12d('0x58')](_0x2fe318,{'fields':_0x5aa0e0,'raw':!![]});}})['then'](handleEntityNotFound(_0x158f2d,null))['then'](function(_0x59ff5f){_0x4c066b[_0xa12d('0x87')]=_0x59ff5f;if(_0x59ff5f){var _0x2f165f={'ContactId':_0x59ff5f['id'],'OpenchannelAccountId':_0x3a4383['params']['id'],'from':(_0x59ff5f['firstName']||'')+'\x20'+(_0x59ff5f[_0xa12d('0x88')]||'')};var _0x185cad={'OpenchannelAccountId':_0x3a4383[_0xa12d('0x53')]['id'],'closed':![]};if(_0x3a4383['body'][_0xa12d('0x89')]){_0x185cad['threadId']=_0x3a4383[_0xa12d('0x59')][_0xa12d('0x89')];return db[_0xa12d('0x8a')][_0xa12d('0x57')]({'where':_0x185cad})[_0xa12d('0x1d')](function(_0x2a5668){if(_0x2a5668){return[_0x2a5668,![]];}_0x2f165f[_0xa12d('0x89')]=_0x3a4383['body']['threadId'];_0x2f165f[_0xa12d('0x8b')]=_0x3a4383['body'][_0xa12d('0x8b')];return db[_0xa12d('0x8a')]['create'](_0x2f165f)['then'](function(_0x4b1dc5){return[_0x4b1dc5,!![]];});});}else{_0x185cad['threadId']=null;}_0x185cad[_0xa12d('0x8c')]=_0x59ff5f['id'];return db[_0xa12d('0x8a')][_0xa12d('0x57')]({'where':_0x185cad})[_0xa12d('0x1d')](function(_0x162193){if(_0x162193){return[_0x162193,![]];}return db[_0xa12d('0x8a')][_0xa12d('0x58')](_0x2f165f)[_0xa12d('0x1d')](function(_0x2871f5){return[_0x2871f5,!![]];});});}})[_0xa12d('0x8d')](function(_0x318885,_0x2cae4f){if(_0x318885){_0xa5b3e1=_0x2cae4f;if(!_0x2cae4f){var _0x37232b={'from':(_0x4c066b['contact'][_0xa12d('0x8e')]||'')+'\x20'+(_0x4c066b[_0xa12d('0x87')][_0xa12d('0x88')]||'')};if(_0x3a4383[_0xa12d('0x59')]['threadId']&&_0x3a4383[_0xa12d('0x59')][_0xa12d('0x8f')]&&_0x3a4383[_0xa12d('0x59')][_0xa12d('0x89')]!=_0x3a4383[_0xa12d('0x59')]['messageId']){_0x37232b[_0xa12d('0x89')]=_0x3a4383[_0xa12d('0x59')][_0xa12d('0x8f')];}return _0x318885[_0xa12d('0x30')](_0x37232b);}else{return _0x318885;}}})['then'](function(_0x4036f1){_0x4c066b[_0xa12d('0x90')]=_0x4036f1[_0xa12d('0x32')]({'plain':!![]});_0x4c066b[_0xa12d('0x90')][_0xa12d('0x91')]=_0xa5b3e1;if(_0x4c066b[_0xa12d('0x90')][_0xa12d('0x91')]){if(_0x4c066b[_0xa12d('0x85')]['autoclose']){_0x4c066b[_0xa12d('0x82')]['push']({'id':0x0,'priority':_0x4c066b['applications'][_0xa12d('0x55')]+0x1,'app':_0xa12d('0x92'),'appdata':_0xa12d('0x93'),'interval':_0xa12d('0x94')});}}return db[_0xa12d('0x95')][_0xa12d('0x58')]({'body':_0x3a4383['body']['body'],'OpenchannelAccountId':_0x3a4383[_0xa12d('0x53')]['id'],'OpenchannelInteractionId':_0x4036f1['id'],'direction':'in','ContactId':_0x4c066b[_0xa12d('0x87')]['id'],'AttachmentId':_0x3a4383[_0xa12d('0x59')][_0xa12d('0x96')]});})[_0xa12d('0x1d')](function(_0x426fa6){_0x4c066b['message']=_0x426fa6;if(_0x4c066b[_0xa12d('0x90')][_0xa12d('0x97')]){return db[_0xa12d('0x98')][_0xa12d('0x57')]({'attributes':['id',_0xa12d('0x36')],'where':{'id':_0x4c066b[_0xa12d('0x90')][_0xa12d('0x97')]}})['then'](function(_0x56bd2){if(_0x56bd2){_0x4c066b[_0xa12d('0x82')][_0xa12d('0x99')]({'id':0x0,'priority':0x0,'app':_0xa12d('0x9a'),'appdata':_0x56bd2[_0xa12d('0x36')]+','+(_0x4c066b['account'][_0xa12d('0x9b')]||0xa),'interval':_0xa12d('0x94')});_0x4c066b[_0xa12d('0x9c')]=![];}return respondWithRpcPromise('Start',_0xa12d('0x9d'),_0x4c066b);});}return respondWithRpcPromise('Start',_0xa12d('0x9d'),_0x4c066b);})[_0xa12d('0x1d')](function(_0x720001){respondWithRpcPromise('EventManager',_0xa12d('0x9e'),{'event':'notify','message':_0x720001},client9002);return _0x720001;})['then'](respondWithResult(_0x158f2d,null))['catch'](handleError(_0x158f2d,null));};exports['addApplications']=function(_0xa3f204,_0x5240db){var _0xdba155=_0xa3f204[_0xa12d('0x53')]['id'];var _0x4d11fe=_0xa3f204[_0xa12d('0x59')];var _0xd358a8=0xc8;var _0x466196=null;return db[_0xa12d('0x9f')]['transaction']({'isolationLevel':db[_0xa12d('0x9f')][_0xa12d('0xa0')]['ISOLATION_LEVELS'][_0xa12d('0xa1')]},function(_0x4c7c2d){return db[_0xa12d('0x3c')][_0xa12d('0x62')]({'where':{'id':_0xdba155},'transaction':_0x4c7c2d})[_0xa12d('0x1d')](function(_0x4eb520){if(_0x4eb520){return db[_0xa12d('0x7e')][_0xa12d('0x31')]({'where':{'OpenchannelAccountId':_0xdba155},'transaction':_0x4c7c2d})[_0xa12d('0x1d')](function(){var _0x22febf=_[_0xa12d('0x3b')](_0x4d11fe,function(_0x2d4db2){_0x2d4db2[_0xa12d('0x63')]=_0xdba155;return _0x2d4db2;});return db[_0xa12d('0x7e')][_0xa12d('0xa2')](_0x22febf,{'transaction':_0x4c7c2d});});}else{_0xd358a8=0x194;_0x466196=[];}});})['then'](function(){if(_0xd358a8!==0x194){return db['OpenchannelApplication'][_0xa12d('0xa3')]({'where':{'OpenchannelAccountId':_0xdba155},'order':'priority'})[_0xa12d('0x1d')](function(_0x128705){_0x466196=_0x128705;});}})[_0xa12d('0x25')](function(_0x219225){_0xd358a8=0x1f4;logger[_0xa12d('0x22')](_0x219225[_0xa12d('0x35')]);if(_0x219225[_0xa12d('0x36')]){delete _0x219225['name'];}_0x466196=_0x219225;})[_0xa12d('0xa4')](function(){if(_0x466196===null){_0x5240db[_0xa12d('0x26')](_0xd358a8);}else{if(_0xd358a8===0x1f4){_0x5240db[_0xa12d('0x2d')](_0xd358a8)[_0xa12d('0x37')](_0x466196);}else{_0x5240db[_0xa12d('0x2d')](_0xd358a8)[_0xa12d('0x28')](_0x466196);}}});};exports[_0xa12d('0xa5')]=function(_0x156b06,_0x6be78b,_0x390eaf){var _0x1121b1={};var _0x264cb1={};var _0x5c38a1;var _0x17bbe0;return db[_0xa12d('0x3c')][_0xa12d('0x62')]({'where':{'id':_0x156b06[_0xa12d('0x53')]['id']}})[_0xa12d('0x1d')](handleEntityNotFound(_0x6be78b,null))[_0xa12d('0x1d')](function(_0x99ca4){if(_0x99ca4){_0x5c38a1=_0x99ca4;_0x264cb1[_0xa12d('0x40')]=_[_0xa12d('0x54')](db[_0xa12d('0x7e')][_0xa12d('0x3d')]);_0x264cb1[_0xa12d('0x41')]=_['keys'](_0x156b06['query']);_0x264cb1[_0xa12d('0x4a')]=_[_0xa12d('0x42')](_0x264cb1['model'],_0x264cb1[_0xa12d('0x41')]);_0x1121b1[_0xa12d('0x43')]=_[_0xa12d('0x42')](_0x264cb1[_0xa12d('0x40')],qs[_0xa12d('0x44')](_0x156b06[_0xa12d('0x41')][_0xa12d('0x44')]));_0x1121b1[_0xa12d('0x43')]=_0x1121b1['attributes']['length']?_0x1121b1['attributes']:_0x264cb1[_0xa12d('0x40')];_0x1121b1[_0xa12d('0x47')]=qs[_0xa12d('0x48')](_0x156b06[_0xa12d('0x41')]['sort']);_0x1121b1[_0xa12d('0x49')]=qs[_0xa12d('0x4a')](_[_0xa12d('0x4b')](_0x156b06[_0xa12d('0x41')],_0x264cb1[_0xa12d('0x4a')]));if(_0x156b06[_0xa12d('0x41')][_0xa12d('0x4c')]){_0x1121b1['where']=_[_0xa12d('0x4d')](_0x1121b1[_0xa12d('0x49')],{'$or':_['map'](_0x1121b1[_0xa12d('0x43')],function(_0x2fa447){var _0x562f08={};_0x562f08[_0x2fa447]={'$like':'%'+_0x156b06[_0xa12d('0x41')]['filter']+'%'};return _0x562f08;})});}_0x1121b1=_[_0xa12d('0x4d')]({},_0x1121b1,_0x156b06['options']);return _0x5c38a1[_0xa12d('0xa5')](_0x1121b1);}})[_0xa12d('0x1d')](function(_0x239a8c){if(_0x239a8c){_0x17bbe0=_0x239a8c[_0xa12d('0x55')];if(!_0x156b06[_0xa12d('0x41')][_0xa12d('0x45')](_0xa12d('0x46'))){_0x1121b1[_0xa12d('0x2c')]=qs[_0xa12d('0x2c')](_0x156b06['query']['limit']);_0x1121b1[_0xa12d('0x29')]=qs[_0xa12d('0x29')](_0x156b06['query']['offset']);}return _0x5c38a1[_0xa12d('0xa5')](_0x1121b1);}})['then'](function(_0x82240b){if(_0x82240b){return _0x82240b?{'count':_0x17bbe0,'rows':_0x82240b}:null;}})[_0xa12d('0x1d')](respondWithResult(_0x6be78b,null))[_0xa12d('0x25')](handleError(_0x6be78b,null));};exports['getInteractions']=function(_0x59e5a8,_0x1b999e,_0x3846a1){var _0x2fc4a8={'raw':![],'where':{}};var _0xd27bc3={};var _0x5041e5={'count':0x0,'rows':[]};return db[_0xa12d('0x3c')][_0xa12d('0x62')]({'where':{'id':_0x59e5a8[_0xa12d('0x53')]['id']}})['then'](handleEntityNotFound(_0x1b999e,null))[_0xa12d('0x1d')](function(_0x5da76f){if(_0x5da76f){_0xd27bc3[_0xa12d('0x40')]=_[_0xa12d('0x54')](db[_0xa12d('0x8a')][_0xa12d('0x3d')]);_0xd27bc3[_0xa12d('0x41')]=_[_0xa12d('0x54')](_0x59e5a8['query']);_0xd27bc3['filters']=_[_0xa12d('0x42')](_0xd27bc3[_0xa12d('0x40')],_0xd27bc3['query']);_0x2fc4a8[_0xa12d('0x43')]=_[_0xa12d('0x42')](_0xd27bc3[_0xa12d('0x40')],qs[_0xa12d('0x44')](_0x59e5a8[_0xa12d('0x41')][_0xa12d('0x44')]));_0x2fc4a8[_0xa12d('0x43')]=_0x2fc4a8['attributes'][_0xa12d('0x55')]?_0x2fc4a8[_0xa12d('0x43')]:_0xd27bc3[_0xa12d('0x40')];if(!_0x59e5a8[_0xa12d('0x41')][_0xa12d('0x45')](_0xa12d('0x46'))){_0x2fc4a8[_0xa12d('0x2c')]=qs[_0xa12d('0x2c')](_0x59e5a8[_0xa12d('0x41')][_0xa12d('0x2c')]);_0x2fc4a8[_0xa12d('0x29')]=qs[_0xa12d('0x29')](_0x59e5a8[_0xa12d('0x41')][_0xa12d('0x29')]);}_0x2fc4a8[_0xa12d('0x47')]=qs['sort'](_0x59e5a8[_0xa12d('0x41')][_0xa12d('0x48')]);_0x2fc4a8['where']=qs[_0xa12d('0x4a')](_[_0xa12d('0x4b')](_0x59e5a8['query'],_0xd27bc3[_0xa12d('0x4a')]));_0x2fc4a8[_0xa12d('0x49')][_0xa12d('0x63')]=_0x5da76f['id'];if(_0x59e5a8['query']['filter']){_0x2fc4a8[_0xa12d('0x49')]=_[_0xa12d('0x4d')](_0x2fc4a8['where'],{'$or':_[_0xa12d('0x3b')](_0x2fc4a8[_0xa12d('0x43')],function(_0x27558b){var _0x18af2e={};_0x18af2e[_0x27558b]={'$like':'%'+_0x59e5a8[_0xa12d('0x41')][_0xa12d('0x4c')]+'%'};return _0x18af2e;})});}_0x2fc4a8=_['merge']({},_0x2fc4a8,_0x59e5a8[_0xa12d('0x56')]);return db[_0xa12d('0x8a')][_0xa12d('0x2b')]({'where':_0x2fc4a8[_0xa12d('0x49')]})[_0xa12d('0x1d')](function(_0x325d49){_0x5041e5['count']=_0x325d49;if(_0x59e5a8[_0xa12d('0x41')][_0xa12d('0x4f')]){_0x2fc4a8[_0xa12d('0x50')]=[{'model':db[_0xa12d('0x6d')],'as':_0xa12d('0xa6'),'required':![]},{'model':db[_0xa12d('0x98')],'as':'Owner','attributes':['name',_0xa12d('0xa7'),'internal'],'required':![]},{'model':db[_0xa12d('0xa8')],'as':'Tags','attributes':['id',_0xa12d('0x36'),_0xa12d('0xa9')],'where':_0x59e5a8[_0xa12d('0x41')][_0xa12d('0xaa')]?{'id':_0x59e5a8['query'][_0xa12d('0xaa')]}:undefined,'required':_0x59e5a8[_0xa12d('0x41')][_0xa12d('0xaa')]?!![]:![]}];}return db[_0xa12d('0x8a')][_0xa12d('0x65')](_0x2fc4a8);})['then'](function(_0x309cab){_0x5041e5[_0xa12d('0x51')]=_0x309cab;return _0x5041e5;});}})[_0xa12d('0x1d')](respondWithFilteredResult(_0x1b999e,_0x2fc4a8))[_0xa12d('0x25')](handleError(_0x1b999e,null));};exports[_0xa12d('0xab')]=function(_0x22b78e,_0x2b9900,_0x3d6028){return db[_0xa12d('0x3c')][_0xa12d('0x57')]({'where':{'id':_0x22b78e[_0xa12d('0x53')]['id']}})['then'](handleEntityNotFound(_0x2b9900,null))[_0xa12d('0x1d')](function(_0x43be36){if(_0x43be36){return _0x43be36[_0xa12d('0xab')](_0x22b78e[_0xa12d('0x59')]['ids'],_[_0xa12d('0xac')](_0x22b78e[_0xa12d('0x59')],[_0xa12d('0x67'),'id'])||{})[_0xa12d('0x8d')](function(_0x566b68){for(var _0x512378=0x0;_0x512378<_0x22b78e[_0xa12d('0x59')][_0xa12d('0x67')][_0xa12d('0x55')];_0x512378+=0x1){socket[_0xa12d('0xad')]('userOpenchannelAccount:save',{'UserId':Number(_0x22b78e[_0xa12d('0x59')][_0xa12d('0x67')][_0x512378]),'OpenchannelAccountId':Number(_0x22b78e[_0xa12d('0x53')]['id'])});}return _0x566b68;});}})[_0xa12d('0x1d')](respondWithResult(_0x2b9900,null))[_0xa12d('0x25')](handleError(_0x2b9900,null));};exports['removeAgents']=function(_0x1366e4,_0x455fe9,_0x214798){return db[_0xa12d('0x3c')][_0xa12d('0x57')]({'where':{'id':_0x1366e4[_0xa12d('0x53')]['id']}})[_0xa12d('0x1d')](handleEntityNotFound(_0x455fe9,null))[_0xa12d('0x1d')](function(_0x214775){if(_0x214775){return _0x214775[_0xa12d('0xae')](_0x1366e4[_0xa12d('0x41')][_0xa12d('0x67')])[_0xa12d('0x1d')](function(){if(_[_0xa12d('0xaf')](_0x1366e4[_0xa12d('0x41')]['ids'])){for(var _0x804b43=0x0;_0x804b43<_0x1366e4[_0xa12d('0x41')][_0xa12d('0x67')][_0xa12d('0x55')];_0x804b43+=0x1){socket[_0xa12d('0xad')](_0xa12d('0xb0'),{'UserId':Number(_0x1366e4[_0xa12d('0x41')][_0xa12d('0x67')][_0x804b43]),'OpenchannelAccountId':Number(_0x1366e4[_0xa12d('0x53')]['id'])});}}else{socket[_0xa12d('0xad')]('userOpenchannelAccount:remove',{'UserId':Number(_0x1366e4[_0xa12d('0x41')][_0xa12d('0x67')]),'OpenchannelAccountId':Number(_0x1366e4[_0xa12d('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x455fe9,null))[_0xa12d('0x25')](handleError(_0x455fe9,null));};exports['getAgents']=function(_0xa28fa4,_0x584b72,_0x5c4e6d){var _0x1d1aad={};var _0x5977ba={};var _0x4e3197;var _0x287cd3;return db['OpenchannelAccount'][_0xa12d('0x62')]({'where':{'id':_0xa28fa4['params']['id']}})[_0xa12d('0x1d')](handleEntityNotFound(_0x584b72,null))[_0xa12d('0x1d')](function(_0x14dfd7){if(_0x14dfd7){_0x4e3197=_0x14dfd7;_0x5977ba[_0xa12d('0x40')]=_[_0xa12d('0x54')](db[_0xa12d('0x98')][_0xa12d('0x3d')]);_0x5977ba[_0xa12d('0x41')]=_['keys'](_0xa28fa4[_0xa12d('0x41')]);_0x5977ba['filters']=_[_0xa12d('0x42')](_0x5977ba['model'],_0x5977ba['query']);_0x1d1aad['attributes']=_['intersection'](_0x5977ba[_0xa12d('0x40')],qs[_0xa12d('0x44')](_0xa28fa4['query'][_0xa12d('0x44')]));_0x1d1aad['attributes']=_0x1d1aad[_0xa12d('0x43')]['length']?_0x1d1aad[_0xa12d('0x43')]:_0x5977ba[_0xa12d('0x40')];_0x1d1aad['order']=qs['sort'](_0xa28fa4[_0xa12d('0x41')][_0xa12d('0x48')]);_0x1d1aad[_0xa12d('0x49')]=qs[_0xa12d('0x4a')](_[_0xa12d('0x4b')](_0xa28fa4[_0xa12d('0x41')],_0x5977ba[_0xa12d('0x4a')]));if(_0xa28fa4[_0xa12d('0x41')]['filter']){_0x1d1aad[_0xa12d('0x49')]=_[_0xa12d('0x4d')](_0x1d1aad[_0xa12d('0x49')],{'$or':_[_0xa12d('0x3b')](_0x1d1aad['attributes'],function(_0xc5298c){var _0xb213d4={};_0xb213d4[_0xc5298c]={'$like':'%'+_0xa28fa4['query'][_0xa12d('0x4c')]+'%'};return _0xb213d4;})});}_0x1d1aad=_[_0xa12d('0x4d')]({},_0x1d1aad,_0xa28fa4['options']);return _0x4e3197[_0xa12d('0xb1')](_0x1d1aad);}})[_0xa12d('0x1d')](function(_0x3e5f9e){if(_0x3e5f9e){_0x287cd3=_0x3e5f9e[_0xa12d('0x55')];if(!_0xa28fa4['query'][_0xa12d('0x45')](_0xa12d('0x46'))){_0x1d1aad[_0xa12d('0x2c')]=qs['limit'](_0xa28fa4[_0xa12d('0x41')][_0xa12d('0x2c')]);_0x1d1aad['offset']=qs[_0xa12d('0x29')](_0xa28fa4[_0xa12d('0x41')][_0xa12d('0x29')]);}return _0x4e3197['getAgents'](_0x1d1aad);}})[_0xa12d('0x1d')](function(_0x336de7){if(_0x336de7){return _0x336de7?{'count':_0x287cd3,'rows':_0x336de7}:null;}})[_0xa12d('0x1d')](respondWithResult(_0x584b72,null))[_0xa12d('0x25')](handleError(_0x584b72,null));};exports[_0xa12d('0x37')]=function(_0x585562,_0x22e980,_0x260b23){var _0x2b8829,_0x6aca7f,_0x28a75b;if(_[_0xa12d('0xb2')](_0x585562[_0xa12d('0x59')][_0xa12d('0x59')])||_0x585562[_0xa12d('0x59')][_0xa12d('0x59')]===''){throw new db[(_0xa12d('0x6e'))][(_0xa12d('0x6f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa12d('0xb2')](_0x585562[_0xa12d('0x59')]['to'])){}_0x2b8829=_0x585562[_0xa12d('0x59')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x585562['params']['id']}})['then'](handleEntityNotFound(_0x22e980,null))[_0xa12d('0x1d')](function(_0x25fe65){if(_0x25fe65){return db['OpenchannelAccount'][_0xa12d('0x57')]({'where':{'id':_0x25fe65['id']},'include':[{'model':db[_0xa12d('0x7b')],'as':_0xa12d('0x80'),'include':[{'model':db[_0xa12d('0x6d')],'as':_0xa12d('0x7c'),'where':{[_0x25fe65[_0xa12d('0x78')]]:_0x2b8829},'limit':0x1,'order':[['updatedAt',_0xa12d('0x7d')]]}]}]})[_0xa12d('0x1d')](handleEntityNotFound(_0x22e980,null))[_0xa12d('0x1d')](function(_0x3cbfd8){if(_0x3cbfd8&&_0x3cbfd8[_0xa12d('0x80')]){_0x6aca7f=_0x3cbfd8[_0xa12d('0x32')]({'plain':!![]});if(_0x6aca7f[_0xa12d('0x80')]&&_0x6aca7f['List'][_0xa12d('0x7c')][_0xa12d('0x55')]){return _0x6aca7f[_0xa12d('0x80')]['Contacts'][0x0];}return db[_0xa12d('0x6d')][_0xa12d('0x58')](_[_0xa12d('0x86')](_0x585562[_0xa12d('0x59')],{'firstName':_0x2b8829,[_0x3cbfd8['mapKey']]:_0x2b8829,'phone':_0x2b8829,'ListId':_0x6aca7f[_0xa12d('0x75')]}));}})[_0xa12d('0x1d')](handleEntityNotFound(_0x22e980,null))[_0xa12d('0x1d')](function(_0x159302){if(_0x159302){_0x28a75b=_0x159302;return db[_0xa12d('0x8a')]['find']({'where':{'ContactId':_0x28a75b['id'],'closed':![],'OpenchannelAccountId':_0x6aca7f['id']}})[_0xa12d('0x1d')](function(_0x230edd){if(_0x230edd){return[_0x230edd,![]];}return db[_0xa12d('0x8a')][_0xa12d('0x58')]({'UserId':_0x585562[_0xa12d('0x5c')]['id'],'ContactId':_0x28a75b['id'],'OpenchannelAccountId':_0x6aca7f['id'],'lastMsgDirection':_0xa12d('0xb3'),'Messages':[_[_0xa12d('0x4d')](_0x585562[_0xa12d('0x59')],{'read':![],'body':_0x585562['body'][_0xa12d('0x59')],'OpenchannelAccountId':_0x6aca7f['id'],'UserId':_0x585562[_0xa12d('0x5c')]['id'],'ContactId':_0x28a75b['id']})]},{'include':[{'model':db[_0xa12d('0x95')],'as':'Messages'}]})[_0xa12d('0x1d')](function(_0x11c28f){return[_0x11c28f,!![]];});});}})[_0xa12d('0x8d')](function(_0x1425e7,_0x559516){if(_0x559516){return _0x1425e7;}return db['OpenchannelMessage'][_0xa12d('0x58')](_[_0xa12d('0x4d')](_0x585562['body'],{'read':![],'body':_0x585562[_0xa12d('0x59')][_0xa12d('0x59')],'OpenchannelAccountId':_0x6aca7f['id'],'OpenchannelInteractionId':_0x1425e7['id'],'UserId':_0x585562[_0xa12d('0x5c')]['id'],'ContactId':_0x28a75b['id']}))[_0xa12d('0x1d')](function(_0x59e73c){_0x1425e7[_0xa12d('0xb4')][_0xa12d('0xb5')]=[];_0x1425e7[_0xa12d('0xb4')][_0xa12d('0xb5')][_0xa12d('0xb6')](_0x59e73c['dataValues']);return _0x1425e7;});});}})[_0xa12d('0x1d')](respondWithResult(_0x22e980,null))['catch'](handleError(_0x22e980,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 61b1c1e..a798365 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 _0x1339=['update','remove','emit','hasOwnProperty','exports','OpenchannelAccount','setMaxListeners','save'];(function(_0x4eae21,_0x5af866){var _0x3163eb=function(_0x5ba394){while(--_0x5ba394){_0x4eae21['push'](_0x4eae21['shift']());}};_0x3163eb(++_0x5af866);}(_0x1339,0x1ed));var _0x9133=function(_0x28a11c,_0x2f168c){_0x28a11c=_0x28a11c-0x0;var _0x1dbd99=_0x1339[_0x28a11c];return _0x1dbd99;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x9133('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x9133('0x1')](0x0);var events={'afterCreate':_0x9133('0x2'),'afterUpdate':_0x9133('0x3'),'afterDestroy':_0x9133('0x4')};function emitEvent(_0x192d48){return function(_0x176e80,_0x110c51,_0x558345){OpenchannelAccountEvents[_0x9133('0x5')](_0x192d48+':'+_0x176e80['id'],_0x176e80);OpenchannelAccountEvents[_0x9133('0x5')](_0x192d48,_0x176e80);_0x558345(null);};}for(var e in events){if(events[_0x9133('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x9133('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x2547=['hasOwnProperty','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x478087,_0x109fb2){var _0x54bff1=function(_0x4589b3){while(--_0x4589b3){_0x478087['push'](_0x478087['shift']());}};_0x54bff1(++_0x109fb2);}(_0x2547,0x1cd));var _0x7254=function(_0x4e1099,_0x2bd3bf){_0x4e1099=_0x4e1099-0x0;var _0xc0256c=_0x2547[_0x4e1099];return _0xc0256c;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x7254('0x0'))['db'][_0x7254('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x7254('0x2')](0x0);var events={'afterCreate':_0x7254('0x3'),'afterUpdate':_0x7254('0x4'),'afterDestroy':_0x7254('0x5')};function emitEvent(_0x9f3435){return function(_0x265ebf,_0x53a02f,_0x2ddeae){OpenchannelAccountEvents[_0x7254('0x6')](_0x9f3435+':'+_0x265ebf['id'],_0x265ebf);OpenchannelAccountEvents[_0x7254('0x6')](_0x9f3435,_0x265ebf);_0x2ddeae(null);};}for(var e in events){if(events[_0x7254('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x7254('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 8b7d9ab..3b65a8f 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(_0x3067a3,_0x40f7b9){var _0x49e6a5=function(_0x331fb3){while(--_0x331fb3){_0x3067a3['push'](_0x3067a3['shift']());}};_0x49e6a5(++_0x40f7b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x3bc7c5,_0xf05378){var _0x384e89=function(_0x348a5e){while(--_0x348a5e){_0x3bc7c5['push'](_0x3bc7c5['shift']());}};_0x384e89(++_0xf05378);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 db6e359..6a5f0e1 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 _0x4b0f=['http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x597e20,_0x1c7adc){var _0x458454=function(_0x5d8b24){while(--_0x5d8b24){_0x597e20['push'](_0x597e20['shift']());}};_0x458454(++_0x1c7adc);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x2f0510,_0x193e90){_0x2f0510=_0x2f0510-0x0;var _0x2ef5b8=_0x4b0f[_0x2f0510];return _0x2ef5b8;};'use strict';var _=require('lodash');var util=require(_0xf4b0('0x0'));var moment=require(_0xf4b0('0x1'));var BPromise=require(_0xf4b0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4b0('0x3'));var db=require(_0xf4b0('0x4'))['db'];var utils=require(_0xf4b0('0x5'));var logger=require(_0xf4b0('0x6'))(_0xf4b0('0x7'));var config=require(_0xf4b0('0x8'));var jayson=require(_0xf4b0('0x9'));var client=jayson[_0xf4b0('0xa')][_0xf4b0('0xb')]({'port':0x232a});config[_0xf4b0('0xc')]=_[_0xf4b0('0xd')](config[_0xf4b0('0xc')],{'host':_0xf4b0('0xe'),'port':0x18eb});var socket=require(_0xf4b0('0xf'))(new Redis(config[_0xf4b0('0xc')]));require(_0xf4b0('0x10'))['register'](socket);function respondWithRpcPromise(_0x22b65c,_0x996ea8,_0x25ad2c){return new BPromise(function(_0x21db22,_0x35e838){return client[_0xf4b0('0x11')](_0x22b65c,_0x25ad2c)[_0xf4b0('0x12')](function(_0x10d7a7){logger[_0xf4b0('0x13')](_0xf4b0('0x14'),_0x996ea8,_0xf4b0('0x15'));logger[_0xf4b0('0x16')](_0xf4b0('0x17'),_0x996ea8,_0xf4b0('0x15'),JSON[_0xf4b0('0x18')](_0x10d7a7));if(_0x10d7a7[_0xf4b0('0x19')]){if(_0x10d7a7[_0xf4b0('0x19')][_0xf4b0('0x1a')]===0x1f4){logger[_0xf4b0('0x19')](_0xf4b0('0x14'),_0x996ea8,_0x10d7a7[_0xf4b0('0x19')][_0xf4b0('0x1b')]);return _0x35e838(_0x10d7a7['error'][_0xf4b0('0x1b')]);}logger[_0xf4b0('0x19')](_0xf4b0('0x14'),_0x996ea8,_0x10d7a7['error'][_0xf4b0('0x1b')]);return _0x21db22(_0x10d7a7[_0xf4b0('0x19')][_0xf4b0('0x1b')]);}else{logger['info'](_0xf4b0('0x14'),_0x996ea8,_0xf4b0('0x15'));_0x21db22(_0x10d7a7[_0xf4b0('0x1c')]['message']);}})['catch'](function(_0x1ec2b0){logger[_0xf4b0('0x19')]('OpenchannelAccount,\x20%s,\x20%s',_0x996ea8,_0x1ec2b0);_0x35e838(_0x1ec2b0);});});} \ No newline at end of file +var _0x705f=['jayson/promise','client','http','redis','localhost','./openchannelAccount.socket','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','OpenchannelAccount,\x20%s,\x20%s','message','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2c9983,_0x107b4f){var _0xc04422=function(_0x2e698c){while(--_0x2e698c){_0x2c9983['push'](_0x2c9983['shift']());}};_0xc04422(++_0x107b4f);}(_0x705f,0x75));var _0xf705=function(_0x569caa,_0x5174ce){_0x569caa=_0x569caa-0x0;var _0x44cb5a=_0x705f[_0x569caa];return _0x44cb5a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf705('0x0'));var BPromise=require('bluebird');var rs=require(_0xf705('0x1'));var fs=require('fs');var Redis=require(_0xf705('0x2'));var db=require(_0xf705('0x3'))['db'];var utils=require(_0xf705('0x4'));var logger=require(_0xf705('0x5'))(_0xf705('0x6'));var config=require(_0xf705('0x7'));var jayson=require(_0xf705('0x8'));var client=jayson[_0xf705('0x9')][_0xf705('0xa')]({'port':0x232a});config[_0xf705('0xb')]=_['defaults'](config['redis'],{'host':_0xf705('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf705('0xb')]));require(_0xf705('0xd'))['register'](socket);function respondWithRpcPromise(_0x4bd6fd,_0x1f9ab1,_0xc6fbde){return new BPromise(function(_0xfe67fe,_0x45316b){return client[_0xf705('0xe')](_0x4bd6fd,_0xc6fbde)[_0xf705('0xf')](function(_0x13db14){logger[_0xf705('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x1f9ab1,_0xf705('0x11'));logger[_0xf705('0x12')](_0xf705('0x13'),_0x1f9ab1,_0xf705('0x11'),JSON[_0xf705('0x14')](_0x13db14));if(_0x13db14['error']){if(_0x13db14['error'][_0xf705('0x15')]===0x1f4){logger[_0xf705('0x16')](_0xf705('0x17'),_0x1f9ab1,_0x13db14[_0xf705('0x16')]['message']);return _0x45316b(_0x13db14[_0xf705('0x16')][_0xf705('0x18')]);}logger[_0xf705('0x16')](_0xf705('0x17'),_0x1f9ab1,_0x13db14['error'][_0xf705('0x18')]);return _0xfe67fe(_0x13db14['error'][_0xf705('0x18')]);}else{logger[_0xf705('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x1f9ab1,_0xf705('0x11'));_0xfe67fe(_0x13db14['result'][_0xf705('0x18')]);}})['catch'](function(_0x57d537){logger[_0xf705('0x16')](_0xf705('0x17'),_0x1f9ab1,_0x57d537);_0x45316b(_0x57d537);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index aab381e..fca65ce 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 _0x149c=['register','length','openchannelAccount:','./openchannelAccount.events','remove','update','emit','removeListener'];(function(_0x4dbb2f,_0x4a5fc7){var _0x1fa0ed=function(_0x4d8f16){while(--_0x4d8f16){_0x4dbb2f['push'](_0x4dbb2f['shift']());}};_0x1fa0ed(++_0x4a5fc7);}(_0x149c,0x143));var _0xc149=function(_0x5c91c7,_0x1c02b8){_0x5c91c7=_0x5c91c7-0x0;var _0x2726dd=_0x149c[_0x5c91c7];return _0x2726dd;};'use strict';var OpenchannelAccountEvents=require(_0xc149('0x0'));var events=['save',_0xc149('0x1'),_0xc149('0x2')];function createListener(_0x35e9b8,_0x4f5a90){return function(_0x3b8ac6){_0x4f5a90[_0xc149('0x3')](_0x35e9b8,_0x3b8ac6);};}function removeListener(_0x19a7cb,_0x298415){return function(){OpenchannelAccountEvents[_0xc149('0x4')](_0x19a7cb,_0x298415);};}exports[_0xc149('0x5')]=function(_0x3b5e34){for(var _0x5e9b5c=0x0,_0x578cec=events[_0xc149('0x6')];_0x5e9b5c<_0x578cec;_0x5e9b5c++){var _0x34710e=events[_0x5e9b5c];var _0x3a1739=createListener(_0xc149('0x7')+_0x34710e,_0x3b5e34);OpenchannelAccountEvents['on'](_0x34710e,_0x3a1739);}}; \ No newline at end of file +var _0x3dd5=['removeListener','length','openchannelAccount:','./openchannelAccount.events','remove','update','emit'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3dd5,0x73));var _0x53dd=function(_0x35b642,_0x312eef){_0x35b642=_0x35b642-0x0;var _0x588553=_0x3dd5[_0x35b642];return _0x588553;};'use strict';var OpenchannelAccountEvents=require(_0x53dd('0x0'));var events=['save',_0x53dd('0x1'),_0x53dd('0x2')];function createListener(_0x45d521,_0x3b6401){return function(_0xfa7c49){_0x3b6401[_0x53dd('0x3')](_0x45d521,_0xfa7c49);};}function removeListener(_0x2ac886,_0x378841){return function(){OpenchannelAccountEvents[_0x53dd('0x4')](_0x2ac886,_0x378841);};}exports['register']=function(_0x3c8f9e){for(var _0x26c218=0x0,_0x37e012=events[_0x53dd('0x5')];_0x26c218<_0x37e012;_0x26c218++){var _0x4d3132=events[_0x26c218];var _0x561ded=createListener(_0x53dd('0x6')+_0x4d3132,_0x3c8f9e);OpenchannelAccountEvents['on'](_0x4d3132,_0x561ded);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 4c43f39..2c711e5 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 _0xebcd=['update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','post','isAuthenticated','create','put'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xebcd,0x1bb));var _0xdebc=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0xebcd[_0x231dda];return _0x3f88cb;};'use strict';var multer=require(_0xdebc('0x0'));var util=require(_0xdebc('0x1'));var path=require(_0xdebc('0x2'));var timeout=require(_0xdebc('0x3'));var express=require('express');var router=express[_0xdebc('0x4')]();var fs_extra=require(_0xdebc('0x5'));var auth=require(_0xdebc('0x6'));var interaction=require(_0xdebc('0x7'));var config=require(_0xdebc('0x8'));var controller=require(_0xdebc('0x9'));router[_0xdebc('0xa')]('/',auth['isAuthenticated'](),controller[_0xdebc('0xb')]);router[_0xdebc('0xa')](_0xdebc('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xdebc('0xd')]('/',auth[_0xdebc('0xe')](),controller[_0xdebc('0xf')]);router[_0xdebc('0x10')](_0xdebc('0xc'),auth[_0xdebc('0xe')](),controller[_0xdebc('0x11')]);router['delete'](_0xdebc('0xc'),auth['isAuthenticated'](),controller[_0xdebc('0x12')]);module[_0xdebc('0x13')]=router; \ No newline at end of file +var _0x0062=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x0062,0xeb));var _0x2006=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0x0062[_0x1ebce2];return _0x4a330c;};'use strict';var multer=require('multer');var util=require(_0x2006('0x0'));var path=require(_0x2006('0x1'));var timeout=require(_0x2006('0x2'));var express=require(_0x2006('0x3'));var router=express[_0x2006('0x4')]();var fs_extra=require(_0x2006('0x5'));var auth=require(_0x2006('0x6'));var interaction=require(_0x2006('0x7'));var config=require(_0x2006('0x8'));var controller=require(_0x2006('0x9'));router[_0x2006('0xa')]('/',auth[_0x2006('0xb')](),controller[_0x2006('0xc')]);router[_0x2006('0xa')](_0x2006('0xd'),auth[_0x2006('0xb')](),controller[_0x2006('0xe')]);router['post']('/',auth[_0x2006('0xb')](),controller[_0x2006('0xf')]);router[_0x2006('0x10')](_0x2006('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x2006('0x11')](_0x2006('0xd'),auth[_0x2006('0xb')](),controller[_0x2006('0x12')]);module[_0x2006('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index f546259..95ddf5c 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 _0x2fc4=['sequelize','exports','STRING','noop','TEXT'];(function(_0x3abdf8,_0x1d1aef){var _0xd62e3d=function(_0x5cfaae){while(--_0x5cfaae){_0x3abdf8['push'](_0x3abdf8['shift']());}};_0xd62e3d(++_0x1d1aef);}(_0x2fc4,0x1c7));var _0x42fc=function(_0x2f7de9,_0x1216c7){_0x2f7de9=_0x2f7de9-0x0;var _0x59cea1=_0x2fc4[_0x2f7de9];return _0x59cea1;};'use strict';var Sequelize=require(_0x42fc('0x0'));module[_0x42fc('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x42fc('0x2')],'allowNull':![],'defaultValue':_0x42fc('0x3')},'appdata':{'type':Sequelize[_0x42fc('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x14d0=['sequelize','exports','INTEGER','STRING','*,*,*,*'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x14d0,0x127));var _0x014d=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x14d0[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0x014d('0x0'));module[_0x014d('0x1')]={'priority':{'type':Sequelize[_0x014d('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x014d('0x3')]},'interval':{'type':Sequelize[_0x014d('0x3')],'defaultValue':_0x014d('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 7ffc458..d74f874 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 _0xb134=['limit','set','Content-Range','apply','save','destroy','then','end','error','stack','send','map','OpenchannelApplication','rawAttributes','fieldName','type','model','name','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','length','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb134,0x7e));var _0x4b13=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xb134[_0x44bcb0];return _0xfaf881;};'use strict';var emlformat=require(_0x4b13('0x0'));var rimraf=require(_0x4b13('0x1'));var zipdir=require(_0x4b13('0x2'));var jsonpatch=require(_0x4b13('0x3'));var rp=require(_0x4b13('0x4'));var moment=require(_0x4b13('0x5'));var BPromise=require(_0x4b13('0x6'));var Mustache=require(_0x4b13('0x7'));var util=require(_0x4b13('0x8'));var path=require(_0x4b13('0x9'));var sox=require('sox');var csv=require(_0x4b13('0xa'));var ejs=require(_0x4b13('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b13('0xc'));var squel=require(_0x4b13('0xd'));var crypto=require(_0x4b13('0xe'));var jsforce=require(_0x4b13('0xf'));var deskjs=require(_0x4b13('0x10'));var toCsv=require(_0x4b13('0xa'));var querystring=require(_0x4b13('0x11'));var Papa=require(_0x4b13('0x12'));var Redis=require(_0x4b13('0x13'));var authService=require(_0x4b13('0x14'));var qs=require(_0x4b13('0x15'));var as=require(_0x4b13('0x16'));var hardwareService=require(_0x4b13('0x17'));var logger=require(_0x4b13('0x18'))(_0x4b13('0x19'));var utils=require(_0x4b13('0x1a'));var config=require(_0x4b13('0x1b'));var licenseUtil=require(_0x4b13('0x1c'));var db=require(_0x4b13('0x1d'))['db'];function respondWithStatusCode(_0xd9b8bf,_0x2ac81f){_0x2ac81f=_0x2ac81f||0xcc;return function(_0x335da6){if(_0x335da6){return _0xd9b8bf[_0x4b13('0x1e')](_0x2ac81f);}return _0xd9b8bf[_0x4b13('0x1f')](_0x2ac81f)['end']();};}function respondWithResult(_0x3cb1c1,_0x4e47a1){_0x4e47a1=_0x4e47a1||0xc8;return function(_0x5c54be){if(_0x5c54be){return _0x3cb1c1[_0x4b13('0x1f')](_0x4e47a1)[_0x4b13('0x20')](_0x5c54be);}};}function respondWithFilteredResult(_0x2a6ec6,_0x25fdbc){return function(_0x2c5f11){if(_0x2c5f11){var _0x4ab8f6=typeof _0x25fdbc[_0x4b13('0x21')]===_0x4b13('0x22')&&typeof _0x25fdbc['limit']===_0x4b13('0x22');var _0x3d45be=_0x2c5f11[_0x4b13('0x23')];var _0x5ec692=_0x4ab8f6?0x0:_0x25fdbc['offset'];var _0x4ceefc=_0x4ab8f6?_0x2c5f11['count']:_0x25fdbc['offset']+_0x25fdbc[_0x4b13('0x24')];var _0x68f212;if(_0x4ceefc>=_0x3d45be){_0x4ceefc=_0x3d45be;_0x68f212=0xc8;}else{_0x68f212=0xce;}_0x2a6ec6[_0x4b13('0x1f')](_0x68f212);return _0x2a6ec6[_0x4b13('0x25')](_0x4b13('0x26'),_0x5ec692+'-'+_0x4ceefc+'/'+_0x3d45be)[_0x4b13('0x20')](_0x2c5f11);}return null;};}function patchUpdates(_0x4e2734){return function(_0x426909){try{jsonpatch[_0x4b13('0x27')](_0x426909,_0x4e2734,!![]);}catch(_0x53a9c5){return BPromise['reject'](_0x53a9c5);}return _0x426909[_0x4b13('0x28')]();};}function saveUpdates(_0x10fbdc,_0x94b3f3){return function(_0x4ec848){if(_0x4ec848){return _0x4ec848['update'](_0x10fbdc)['then'](function(_0x23bcd2){return _0x23bcd2;});}return null;};}function removeEntity(_0xbfd61d,_0x49b1dd){return function(_0x3f78dc){if(_0x3f78dc){return _0x3f78dc[_0x4b13('0x29')]()[_0x4b13('0x2a')](function(){_0xbfd61d[_0x4b13('0x1f')](0xcc)[_0x4b13('0x2b')]();});}};}function handleEntityNotFound(_0x13fada,_0x4f5996){return function(_0x2cfcba){if(!_0x2cfcba){_0x13fada['sendStatus'](0x194);}return _0x2cfcba;};}function handleError(_0x27f504,_0x1046f6){_0x1046f6=_0x1046f6||0x1f4;return function(_0x3daff6){logger[_0x4b13('0x2c')](_0x3daff6[_0x4b13('0x2d')]);if(_0x3daff6['name']){delete _0x3daff6['name'];}_0x27f504[_0x4b13('0x1f')](_0x1046f6)[_0x4b13('0x2e')](_0x3daff6);};}exports['index']=function(_0x3ea8c1,_0x26c9e6){var _0x431209={},_0x3084d1={},_0x25ea11={'count':0x0,'rows':[]};var _0x36ba25=_[_0x4b13('0x2f')](db[_0x4b13('0x30')][_0x4b13('0x31')],function(_0x483597){return{'name':_0x483597[_0x4b13('0x32')],'type':_0x483597[_0x4b13('0x33')]['key']};});_0x3084d1[_0x4b13('0x34')]=_[_0x4b13('0x2f')](_0x36ba25,_0x4b13('0x35'));_0x3084d1[_0x4b13('0x36')]=_[_0x4b13('0x37')](_0x3ea8c1[_0x4b13('0x36')]);_0x3084d1['filters']=_[_0x4b13('0x38')](_0x3084d1[_0x4b13('0x34')],_0x3084d1[_0x4b13('0x36')]);_0x431209['attributes']=_['intersection'](_0x3084d1['model'],qs['fields'](_0x3ea8c1[_0x4b13('0x36')]['fields']));_0x431209[_0x4b13('0x39')]=_0x431209[_0x4b13('0x39')]['length']?_0x431209[_0x4b13('0x39')]:_0x3084d1[_0x4b13('0x34')];if(!_0x3ea8c1[_0x4b13('0x36')][_0x4b13('0x3a')](_0x4b13('0x3b'))){_0x431209[_0x4b13('0x24')]=qs[_0x4b13('0x24')](_0x3ea8c1[_0x4b13('0x36')]['limit']);_0x431209[_0x4b13('0x21')]=qs[_0x4b13('0x21')](_0x3ea8c1[_0x4b13('0x36')][_0x4b13('0x21')]);}_0x431209[_0x4b13('0x3c')]=qs[_0x4b13('0x3d')](_0x3ea8c1[_0x4b13('0x36')]['sort']);_0x431209[_0x4b13('0x3e')]=qs[_0x4b13('0x3f')](_['pick'](_0x3ea8c1['query'],_0x3084d1[_0x4b13('0x3f')]),_0x36ba25);if(_0x3ea8c1[_0x4b13('0x36')][_0x4b13('0x40')]){_0x431209[_0x4b13('0x3e')]=_['merge'](_0x431209['where'],{'$or':_[_0x4b13('0x2f')](_0x36ba25,function(_0x495fbc){if(_0x495fbc[_0x4b13('0x33')]!==_0x4b13('0x41')){var _0x71043b={};_0x71043b[_0x495fbc['name']]={'$like':'%'+_0x3ea8c1[_0x4b13('0x36')][_0x4b13('0x40')]+'%'};return _0x71043b;}})});}_0x431209=_[_0x4b13('0x42')]({},_0x431209,_0x3ea8c1[_0x4b13('0x43')]);var _0x1fcc03={'where':_0x431209[_0x4b13('0x3e')]};return db[_0x4b13('0x30')][_0x4b13('0x23')](_0x1fcc03)[_0x4b13('0x2a')](function(_0x136788){_0x25ea11['count']=_0x136788;if(_0x3ea8c1[_0x4b13('0x36')][_0x4b13('0x44')]){_0x431209[_0x4b13('0x45')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x4b13('0x46')](_0x431209);})[_0x4b13('0x2a')](function(_0x3a69ea){_0x25ea11[_0x4b13('0x47')]=_0x3a69ea;return _0x25ea11;})[_0x4b13('0x2a')](respondWithFilteredResult(_0x26c9e6,_0x431209))[_0x4b13('0x48')](handleError(_0x26c9e6,null));};exports[_0x4b13('0x49')]=function(_0x49316d,_0x259e9a){var _0x40514c={'raw':!![],'where':{'id':_0x49316d[_0x4b13('0x4a')]['id']}},_0x4b7e91={};_0x4b7e91['model']=_['keys'](db[_0x4b13('0x30')][_0x4b13('0x31')]);_0x4b7e91['query']=_[_0x4b13('0x37')](_0x49316d['query']);_0x4b7e91[_0x4b13('0x3f')]=_['intersection'](_0x4b7e91[_0x4b13('0x34')],_0x4b7e91[_0x4b13('0x36')]);_0x40514c['attributes']=_[_0x4b13('0x38')](_0x4b7e91['model'],qs[_0x4b13('0x4b')](_0x49316d[_0x4b13('0x36')][_0x4b13('0x4b')]));_0x40514c['attributes']=_0x40514c[_0x4b13('0x39')][_0x4b13('0x4c')]?_0x40514c['attributes']:_0x4b7e91[_0x4b13('0x34')];if(_0x49316d[_0x4b13('0x36')][_0x4b13('0x44')]){_0x40514c[_0x4b13('0x45')]=[{'all':!![]}];}_0x40514c=_[_0x4b13('0x42')]({},_0x40514c,_0x49316d[_0x4b13('0x43')]);return db[_0x4b13('0x30')]['find'](_0x40514c)[_0x4b13('0x2a')](handleEntityNotFound(_0x259e9a,null))[_0x4b13('0x2a')](respondWithResult(_0x259e9a,null))['catch'](handleError(_0x259e9a,null));};exports[_0x4b13('0x4d')]=function(_0x36e556,_0x53eba0){return db[_0x4b13('0x30')][_0x4b13('0x4d')](_0x36e556[_0x4b13('0x4e')],{})[_0x4b13('0x2a')](respondWithResult(_0x53eba0,0xc9))[_0x4b13('0x48')](handleError(_0x53eba0,null));};exports[_0x4b13('0x4f')]=function(_0x4c1518,_0x31fc7e){if(_0x4c1518[_0x4b13('0x4e')]['id']){delete _0x4c1518[_0x4b13('0x4e')]['id'];}return db[_0x4b13('0x30')]['find']({'where':{'id':_0x4c1518[_0x4b13('0x4a')]['id']}})[_0x4b13('0x2a')](handleEntityNotFound(_0x31fc7e,null))[_0x4b13('0x2a')](saveUpdates(_0x4c1518['body'],null))['then'](respondWithResult(_0x31fc7e,null))[_0x4b13('0x48')](handleError(_0x31fc7e,null));};exports[_0x4b13('0x29')]=function(_0x4a105c,_0x3d9641){return db[_0x4b13('0x30')][_0x4b13('0x50')]({'where':{'id':_0x4a105c[_0x4b13('0x4a')]['id']}})[_0x4b13('0x2a')](handleEntityNotFound(_0x3d9641,null))['then'](removeEntity(_0x3d9641,null))[_0x4b13('0x48')](handleError(_0x3d9641,null));}; \ No newline at end of file +var _0x5cd9=['send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelApplication','includeAll','include','findAll','show','params','fields','find','create','body','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','Content-Range','json','apply','reject','save','then','destroy','error','stack','name'];(function(_0x28e714,_0x1ca825){var _0x2c3bf2=function(_0x2e0af6){while(--_0x2e0af6){_0x28e714['push'](_0x28e714['shift']());}};_0x2c3bf2(++_0x1ca825);}(_0x5cd9,0x75));var _0x95cd=function(_0x51e393,_0x3be714){_0x51e393=_0x51e393-0x0;var _0x24c473=_0x5cd9[_0x51e393];return _0x24c473;};'use strict';var emlformat=require(_0x95cd('0x0'));var rimraf=require(_0x95cd('0x1'));var zipdir=require(_0x95cd('0x2'));var jsonpatch=require(_0x95cd('0x3'));var rp=require(_0x95cd('0x4'));var moment=require(_0x95cd('0x5'));var BPromise=require(_0x95cd('0x6'));var Mustache=require(_0x95cd('0x7'));var util=require(_0x95cd('0x8'));var path=require(_0x95cd('0x9'));var sox=require(_0x95cd('0xa'));var csv=require(_0x95cd('0xb'));var ejs=require(_0x95cd('0xc'));var fs=require('fs');var fs_extra=require(_0x95cd('0xd'));var _=require(_0x95cd('0xe'));var squel=require(_0x95cd('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x95cd('0x10'));var toCsv=require(_0x95cd('0xb'));var querystring=require('querystring');var Papa=require(_0x95cd('0x11'));var Redis=require(_0x95cd('0x12'));var authService=require(_0x95cd('0x13'));var qs=require(_0x95cd('0x14'));var as=require(_0x95cd('0x15'));var hardwareService=require(_0x95cd('0x16'));var logger=require(_0x95cd('0x17'))(_0x95cd('0x18'));var utils=require('../../config/utils');var config=require(_0x95cd('0x19'));var licenseUtil=require(_0x95cd('0x1a'));var db=require(_0x95cd('0x1b'))['db'];function respondWithStatusCode(_0x29179d,_0x523186){_0x523186=_0x523186||0xcc;return function(_0x56b11d){if(_0x56b11d){return _0x29179d[_0x95cd('0x1c')](_0x523186);}return _0x29179d['status'](_0x523186)['end']();};}function respondWithResult(_0x3eeabf,_0x1ee050){_0x1ee050=_0x1ee050||0xc8;return function(_0x22f578){if(_0x22f578){return _0x3eeabf[_0x95cd('0x1d')](_0x1ee050)['json'](_0x22f578);}};}function respondWithFilteredResult(_0x5aeace,_0xadbdc6){return function(_0xcf5c84){if(_0xcf5c84){var _0x427cd3=typeof _0xadbdc6[_0x95cd('0x1e')]===_0x95cd('0x1f')&&typeof _0xadbdc6['limit']===_0x95cd('0x1f');var _0x1035c6=_0xcf5c84[_0x95cd('0x20')];var _0x391df1=_0x427cd3?0x0:_0xadbdc6[_0x95cd('0x1e')];var _0x323dd6=_0x427cd3?_0xcf5c84['count']:_0xadbdc6[_0x95cd('0x1e')]+_0xadbdc6['limit'];var _0x2ccedf;if(_0x323dd6>=_0x1035c6){_0x323dd6=_0x1035c6;_0x2ccedf=0xc8;}else{_0x2ccedf=0xce;}_0x5aeace[_0x95cd('0x1d')](_0x2ccedf);return _0x5aeace['set'](_0x95cd('0x21'),_0x391df1+'-'+_0x323dd6+'/'+_0x1035c6)[_0x95cd('0x22')](_0xcf5c84);}return null;};}function patchUpdates(_0x41e1ef){return function(_0x2f8daf){try{jsonpatch[_0x95cd('0x23')](_0x2f8daf,_0x41e1ef,!![]);}catch(_0x35f618){return BPromise[_0x95cd('0x24')](_0x35f618);}return _0x2f8daf[_0x95cd('0x25')]();};}function saveUpdates(_0x52bb99,_0x3861a8){return function(_0x50d28d){if(_0x50d28d){return _0x50d28d['update'](_0x52bb99)[_0x95cd('0x26')](function(_0x1ed3e5){return _0x1ed3e5;});}return null;};}function removeEntity(_0x1c7a79,_0x3e76a0){return function(_0x4f3806){if(_0x4f3806){return _0x4f3806[_0x95cd('0x27')]()[_0x95cd('0x26')](function(){_0x1c7a79[_0x95cd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dc5eb,_0x4922b5){return function(_0x4a4aa4){if(!_0x4a4aa4){_0x2dc5eb[_0x95cd('0x1c')](0x194);}return _0x4a4aa4;};}function handleError(_0xa7b902,_0x413bb0){_0x413bb0=_0x413bb0||0x1f4;return function(_0x5f23f4){logger[_0x95cd('0x28')](_0x5f23f4[_0x95cd('0x29')]);if(_0x5f23f4['name']){delete _0x5f23f4[_0x95cd('0x2a')];}_0xa7b902[_0x95cd('0x1d')](_0x413bb0)[_0x95cd('0x2b')](_0x5f23f4);};}exports[_0x95cd('0x2c')]=function(_0x5346f9,_0x50ded8){var _0x3357f2={},_0xb730b6={},_0x378382={'count':0x0,'rows':[]};var _0x5d01cc=_[_0x95cd('0x2d')](db['OpenchannelApplication'][_0x95cd('0x2e')],function(_0x5643e3){return{'name':_0x5643e3[_0x95cd('0x2f')],'type':_0x5643e3[_0x95cd('0x30')][_0x95cd('0x31')]};});_0xb730b6[_0x95cd('0x32')]=_['map'](_0x5d01cc,'name');_0xb730b6[_0x95cd('0x33')]=_[_0x95cd('0x34')](_0x5346f9['query']);_0xb730b6[_0x95cd('0x35')]=_[_0x95cd('0x36')](_0xb730b6['model'],_0xb730b6[_0x95cd('0x33')]);_0x3357f2[_0x95cd('0x37')]=_['intersection'](_0xb730b6[_0x95cd('0x32')],qs['fields'](_0x5346f9[_0x95cd('0x33')]['fields']));_0x3357f2[_0x95cd('0x37')]=_0x3357f2[_0x95cd('0x37')][_0x95cd('0x38')]?_0x3357f2[_0x95cd('0x37')]:_0xb730b6['model'];if(!_0x5346f9[_0x95cd('0x33')][_0x95cd('0x39')](_0x95cd('0x3a'))){_0x3357f2[_0x95cd('0x3b')]=qs[_0x95cd('0x3b')](_0x5346f9[_0x95cd('0x33')][_0x95cd('0x3b')]);_0x3357f2[_0x95cd('0x1e')]=qs[_0x95cd('0x1e')](_0x5346f9[_0x95cd('0x33')][_0x95cd('0x1e')]);}_0x3357f2[_0x95cd('0x3c')]=qs[_0x95cd('0x3d')](_0x5346f9[_0x95cd('0x33')]['sort']);_0x3357f2[_0x95cd('0x3e')]=qs[_0x95cd('0x35')](_[_0x95cd('0x3f')](_0x5346f9[_0x95cd('0x33')],_0xb730b6[_0x95cd('0x35')]),_0x5d01cc);if(_0x5346f9['query'][_0x95cd('0x40')]){_0x3357f2[_0x95cd('0x3e')]=_[_0x95cd('0x41')](_0x3357f2[_0x95cd('0x3e')],{'$or':_[_0x95cd('0x2d')](_0x5d01cc,function(_0x28b864){if(_0x28b864[_0x95cd('0x30')]!==_0x95cd('0x42')){var _0x3fe19e={};_0x3fe19e[_0x28b864[_0x95cd('0x2a')]]={'$like':'%'+_0x5346f9[_0x95cd('0x33')][_0x95cd('0x40')]+'%'};return _0x3fe19e;}})});}_0x3357f2=_[_0x95cd('0x41')]({},_0x3357f2,_0x5346f9[_0x95cd('0x43')]);var _0x473c9d={'where':_0x3357f2[_0x95cd('0x3e')]};return db[_0x95cd('0x44')][_0x95cd('0x20')](_0x473c9d)[_0x95cd('0x26')](function(_0x320ad1){_0x378382[_0x95cd('0x20')]=_0x320ad1;if(_0x5346f9[_0x95cd('0x33')][_0x95cd('0x45')]){_0x3357f2[_0x95cd('0x46')]=[{'all':!![]}];}return db[_0x95cd('0x44')][_0x95cd('0x47')](_0x3357f2);})['then'](function(_0x3afeba){_0x378382['rows']=_0x3afeba;return _0x378382;})[_0x95cd('0x26')](respondWithFilteredResult(_0x50ded8,_0x3357f2))['catch'](handleError(_0x50ded8,null));};exports[_0x95cd('0x48')]=function(_0x1acdc4,_0x26c656){var _0x375377={'raw':!![],'where':{'id':_0x1acdc4[_0x95cd('0x49')]['id']}},_0x20d977={};_0x20d977['model']=_[_0x95cd('0x34')](db['OpenchannelApplication'][_0x95cd('0x2e')]);_0x20d977[_0x95cd('0x33')]=_[_0x95cd('0x34')](_0x1acdc4[_0x95cd('0x33')]);_0x20d977[_0x95cd('0x35')]=_[_0x95cd('0x36')](_0x20d977[_0x95cd('0x32')],_0x20d977['query']);_0x375377[_0x95cd('0x37')]=_[_0x95cd('0x36')](_0x20d977[_0x95cd('0x32')],qs['fields'](_0x1acdc4[_0x95cd('0x33')][_0x95cd('0x4a')]));_0x375377['attributes']=_0x375377['attributes'][_0x95cd('0x38')]?_0x375377['attributes']:_0x20d977['model'];if(_0x1acdc4[_0x95cd('0x33')][_0x95cd('0x45')]){_0x375377[_0x95cd('0x46')]=[{'all':!![]}];}_0x375377=_[_0x95cd('0x41')]({},_0x375377,_0x1acdc4[_0x95cd('0x43')]);return db['OpenchannelApplication'][_0x95cd('0x4b')](_0x375377)[_0x95cd('0x26')](handleEntityNotFound(_0x26c656,null))[_0x95cd('0x26')](respondWithResult(_0x26c656,null))['catch'](handleError(_0x26c656,null));};exports['create']=function(_0x478c88,_0x1ba101){return db[_0x95cd('0x44')][_0x95cd('0x4c')](_0x478c88[_0x95cd('0x4d')],{})['then'](respondWithResult(_0x1ba101,0xc9))[_0x95cd('0x4e')](handleError(_0x1ba101,null));};exports[_0x95cd('0x4f')]=function(_0x103f73,_0xe8de14){if(_0x103f73[_0x95cd('0x4d')]['id']){delete _0x103f73[_0x95cd('0x4d')]['id'];}return db[_0x95cd('0x44')][_0x95cd('0x4b')]({'where':{'id':_0x103f73[_0x95cd('0x49')]['id']}})[_0x95cd('0x26')](handleEntityNotFound(_0xe8de14,null))[_0x95cd('0x26')](saveUpdates(_0x103f73[_0x95cd('0x4d')],null))[_0x95cd('0x26')](respondWithResult(_0xe8de14,null))[_0x95cd('0x4e')](handleError(_0xe8de14,null));};exports[_0x95cd('0x27')]=function(_0x3a6e11,_0x14a71d){return db[_0x95cd('0x44')][_0x95cd('0x4b')]({'where':{'id':_0x3a6e11[_0x95cd('0x49')]['id']}})[_0x95cd('0x26')](handleEntityNotFound(_0x14a71d,null))[_0x95cd('0x26')](removeEntity(_0x14a71d,null))[_0x95cd('0x4e')](handleError(_0x14a71d,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 4aac853..45a0a11 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 _0xe2bb=['define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xe2bb,0x1a8));var _0xbe2b=function(_0x6487e3,_0x3ef5ac){_0x6487e3=_0x6487e3-0x0;var _0x4c1f77=_0xe2bb[_0x6487e3];return _0x4c1f77;};'use strict';var _=require(_0xbe2b('0x0'));var util=require('util');var logger=require(_0xbe2b('0x1'))('api');var moment=require(_0xbe2b('0x2'));var BPromise=require(_0xbe2b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbe2b('0x4'));var config=require(_0xbe2b('0x5'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x16b384,_0x142a4e){return _0x16b384[_0xbe2b('0x6')](_0xbe2b('0x7'),attributes,{'tableName':_0xbe2b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbe2b('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6ddc=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','define','OpenchannelApplication','openchannel_applications'];(function(_0x5b876b,_0x538750){var _0x4add6c=function(_0x4a2fa9){while(--_0x4a2fa9){_0x5b876b['push'](_0x5b876b['shift']());}};_0x4add6c(++_0x538750);}(_0x6ddc,0xec));var _0xc6dd=function(_0x2afc3b,_0x5a0e25){_0x2afc3b=_0x2afc3b-0x0;var _0xa99f1f=_0x6ddc[_0x2afc3b];return _0xa99f1f;};'use strict';var _=require(_0xc6dd('0x0'));var util=require(_0xc6dd('0x1'));var logger=require(_0xc6dd('0x2'))(_0xc6dd('0x3'));var moment=require('moment');var BPromise=require(_0xc6dd('0x4'));var rp=require(_0xc6dd('0x5'));var fs=require('fs');var path=require(_0xc6dd('0x6'));var rimraf=require(_0xc6dd('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x1f6d4d,_0x1cc411){return _0x1f6d4d[_0xc6dd('0x8')](_0xc6dd('0x9'),attributes,{'tableName':_0xc6dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc6dd('0xb'),'collate':_0xc6dd('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 4b8e74f..ac6ea1c 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 _0x28a3=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','options','where','attributes','lodash','util'];(function(_0x3575e6,_0x1eb6c0){var _0x595f22=function(_0xae14cf){while(--_0xae14cf){_0x3575e6['push'](_0x3575e6['shift']());}};_0x595f22(++_0x1eb6c0);}(_0x28a3,0x116));var _0x328a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x28a3[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x328a('0x0'));var util=require(_0x328a('0x1'));var moment=require(_0x328a('0x2'));var BPromise=require('bluebird');var rs=require(_0x328a('0x3'));var fs=require('fs');var Redis=require(_0x328a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x328a('0x5'));var logger=require(_0x328a('0x6'))(_0x328a('0x7'));var config=require(_0x328a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x328a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x444df0,_0x4b70c6,_0xaf8b8a){return new BPromise(function(_0x3cdd1b,_0x4e80c2){return client[_0x328a('0xa')](_0x444df0,_0xaf8b8a)[_0x328a('0xb')](function(_0x49c344){logger[_0x328a('0xc')](_0x328a('0xd'),_0x4b70c6,'request\x20sent');logger[_0x328a('0xe')](_0x328a('0xf'),_0x4b70c6,_0x328a('0x10'),JSON[_0x328a('0x11')](_0x49c344));if(_0x49c344[_0x328a('0x12')]){if(_0x49c344[_0x328a('0x12')][_0x328a('0x13')]===0x1f4){logger[_0x328a('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x4b70c6,_0x49c344[_0x328a('0x12')]['message']);return _0x4e80c2(_0x49c344[_0x328a('0x12')]['message']);}logger['error'](_0x328a('0xd'),_0x4b70c6,_0x49c344['error'][_0x328a('0x14')]);return _0x3cdd1b(_0x49c344[_0x328a('0x12')][_0x328a('0x14')]);}else{logger[_0x328a('0xc')](_0x328a('0xd'),_0x4b70c6,_0x328a('0x10'));_0x3cdd1b(_0x49c344[_0x328a('0x15')]['message']);}})[_0x328a('0x16')](function(_0x4df535){logger[_0x328a('0x12')](_0x328a('0xd'),_0x4b70c6,_0x4df535);_0x4e80c2(_0x4df535);});});}exports[_0x328a('0x17')]=function(_0x141d75){var _0x4e8456=this;return new Promise(function(_0x1a6b23,_0x3f2e9f){return db[_0x328a('0x18')]['update'](_0x141d75['body'],{'raw':_0x141d75[_0x328a('0x19')]?_0x141d75['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x141d75[_0x328a('0x19')]?_0x141d75[_0x328a('0x19')][_0x328a('0x1a')]||null:null,'attributes':_0x141d75[_0x328a('0x19')]?_0x141d75[_0x328a('0x19')][_0x328a('0x1b')]||null:null,'limit':_0x141d75[_0x328a('0x19')]?_0x141d75[_0x328a('0x19')]['limit']||null:null})[_0x328a('0xb')](function(_0x5a44fc){logger[_0x328a('0xc')](_0x328a('0x17'),_0x141d75);logger[_0x328a('0xe')](_0x328a('0x17'),_0x141d75,JSON[_0x328a('0x11')](_0x5a44fc));_0x1a6b23(_0x5a44fc);})['catch'](function(_0xc3b957){logger['error'](_0x328a('0x17'),_0xc3b957[_0x328a('0x14')],_0x141d75);_0x3f2e9f(_0x4e8456['error'](0x1f4,_0xc3b957[_0x328a('0x14')]));});});}; \ No newline at end of file +var _0xfdbb=['update','body','options','where','limit','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','UpdateOpenchannelApplication'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xfdbb,0x18c));var _0xbfdb=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xfdbb[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0xbfdb('0x0'));var util=require('util');var moment=require(_0xbfdb('0x1'));var BPromise=require('bluebird');var rs=require(_0xbfdb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbfdb('0x3'));var logger=require(_0xbfdb('0x4'))(_0xbfdb('0x5'));var config=require(_0xbfdb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbfdb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fbf19,_0x45c3be,_0x1bb46f){return new BPromise(function(_0x928790,_0x4f49b8){return client[_0xbfdb('0x8')](_0x4fbf19,_0x1bb46f)[_0xbfdb('0x9')](function(_0x5f2853){logger['info'](_0xbfdb('0xa'),_0x45c3be,_0xbfdb('0xb'));logger[_0xbfdb('0xc')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x45c3be,_0xbfdb('0xb'),JSON[_0xbfdb('0xd')](_0x5f2853));if(_0x5f2853[_0xbfdb('0xe')]){if(_0x5f2853['error'][_0xbfdb('0xf')]===0x1f4){logger['error'](_0xbfdb('0xa'),_0x45c3be,_0x5f2853[_0xbfdb('0xe')][_0xbfdb('0x10')]);return _0x4f49b8(_0x5f2853[_0xbfdb('0xe')][_0xbfdb('0x10')]);}logger['error'](_0xbfdb('0xa'),_0x45c3be,_0x5f2853[_0xbfdb('0xe')][_0xbfdb('0x10')]);return _0x928790(_0x5f2853[_0xbfdb('0xe')][_0xbfdb('0x10')]);}else{logger[_0xbfdb('0x11')](_0xbfdb('0xa'),_0x45c3be,_0xbfdb('0xb'));_0x928790(_0x5f2853[_0xbfdb('0x12')]['message']);}})['catch'](function(_0x2d0de5){logger[_0xbfdb('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x45c3be,_0x2d0de5);_0x4f49b8(_0x2d0de5);});});}exports[_0xbfdb('0x13')]=function(_0x320e03){var _0x35a67e=this;return new Promise(function(_0x4a1630,_0x5d9c09){return db['OpenchannelApplication'][_0xbfdb('0x14')](_0x320e03[_0xbfdb('0x15')],{'raw':_0x320e03[_0xbfdb('0x16')]?_0x320e03[_0xbfdb('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x320e03[_0xbfdb('0x16')]?_0x320e03[_0xbfdb('0x16')][_0xbfdb('0x17')]||null:null,'attributes':_0x320e03[_0xbfdb('0x16')]?_0x320e03[_0xbfdb('0x16')]['attributes']||null:null,'limit':_0x320e03['options']?_0x320e03[_0xbfdb('0x16')][_0xbfdb('0x18')]||null:null})['then'](function(_0x121758){logger['info'](_0xbfdb('0x13'),_0x320e03);logger['debug'](_0xbfdb('0x13'),_0x320e03,JSON[_0xbfdb('0xd')](_0x121758));_0x4a1630(_0x121758);})[_0xbfdb('0x19')](function(_0x572d5f){logger['error']('UpdateOpenchannelApplication',_0x572d5f[_0xbfdb('0x10')],_0x320e03);_0x5d9c09(_0x35a67e[_0xbfdb('0xe')](0x1f4,_0x572d5f[_0xbfdb('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index b091b01..90283e8 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 _0x6725=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','index','/describe','isAuthenticated','describe','get','/:id','show','getMessages','/:id/download','post','/:id/messages','addMessage','tracked','openchannelinteraction:addtags','addTags','openchannel','openchannelinteraction:update','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6725,0xf4));var _0x5672=function(_0xe393d6,_0x2268c3){_0xe393d6=_0xe393d6-0x0;var _0x4ea265=_0x6725[_0xe393d6];return _0x4ea265;};'use strict';var multer=require(_0x5672('0x0'));var util=require(_0x5672('0x1'));var path=require(_0x5672('0x2'));var timeout=require(_0x5672('0x3'));var express=require(_0x5672('0x4'));var router=express[_0x5672('0x5')]();var fs_extra=require(_0x5672('0x6'));var auth=require(_0x5672('0x7'));var interaction=require(_0x5672('0x8'));var config=require(_0x5672('0x9'));var controller=require(_0x5672('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x5672('0xb')]);router['get'](_0x5672('0xc'),auth[_0x5672('0xd')](),controller[_0x5672('0xe')]);router[_0x5672('0xf')](_0x5672('0x10'),auth['isAuthenticated'](),controller[_0x5672('0x11')]);router[_0x5672('0xf')]('/:id/messages',auth[_0x5672('0xd')](),controller[_0x5672('0x12')]);router['get'](_0x5672('0x13'),auth[_0x5672('0xd')](),controller['download']);router[_0x5672('0x14')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x5672('0x15'),auth[_0x5672('0xd')](),controller[_0x5672('0x16')]);router['post']('/:id/tags',auth[_0x5672('0xd')](),interaction[_0x5672('0x17')]('openchannel',_0x5672('0x18')),controller[_0x5672('0x19')]);router['put']('/:id',auth[_0x5672('0xd')](),interaction[_0x5672('0x17')](_0x5672('0x1a'),_0x5672('0x1b')),controller[_0x5672('0x1c')]);router[_0x5672('0x1d')]('/:id',auth[_0x5672('0xd')](),interaction[_0x5672('0x17')](_0x5672('0x1a'),'openchannelinteraction:destroy'),controller['destroy']);router['delete']('/:id/tags',auth[_0x5672('0xd')](),controller['removeTags']);module[_0x5672('0x1e')]=router; \ No newline at end of file +var _0x2392=['removeTags','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','addTags','put','tracked','openchannel','update','/:id','openchannelinteraction:destroy','destroy','delete'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x2392,0x140));var _0x2239=function(_0x369f40,_0xe7e218){_0x369f40=_0x369f40-0x0;var _0x459003=_0x2392[_0x369f40];return _0x459003;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2239('0x0'));var timeout=require(_0x2239('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2239('0x2'));var interaction=require(_0x2239('0x3'));var config=require(_0x2239('0x4'));var controller=require(_0x2239('0x5'));router[_0x2239('0x6')]('/',auth['isAuthenticated'](),controller[_0x2239('0x7')]);router['get'](_0x2239('0x8'),auth[_0x2239('0x9')](),controller[_0x2239('0xa')]);router['get']('/:id',auth[_0x2239('0x9')](),controller[_0x2239('0xb')]);router[_0x2239('0x6')](_0x2239('0xc'),auth[_0x2239('0x9')](),controller[_0x2239('0xd')]);router[_0x2239('0x6')]('/:id/download',auth[_0x2239('0x9')](),controller[_0x2239('0xe')]);router[_0x2239('0xf')]('/',auth[_0x2239('0x9')](),controller[_0x2239('0x10')]);router[_0x2239('0xf')](_0x2239('0xc'),auth[_0x2239('0x9')](),controller[_0x2239('0x11')]);router[_0x2239('0xf')](_0x2239('0x12'),auth[_0x2239('0x9')](),interaction['tracked']('openchannel','openchannelinteraction:addtags'),controller[_0x2239('0x13')]);router[_0x2239('0x14')]('/:id',auth[_0x2239('0x9')](),interaction[_0x2239('0x15')](_0x2239('0x16'),'openchannelinteraction:update'),controller[_0x2239('0x17')]);router['delete'](_0x2239('0x18'),auth[_0x2239('0x9')](),interaction['tracked'](_0x2239('0x16'),_0x2239('0x19')),controller[_0x2239('0x1a')]);router[_0x2239('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller[_0x2239('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 1198de2..58280e4 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 _0x25ad=['STRING','sequelize','BOOLEAN','DATE'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x25ad,0x1b1));var _0xd25a=function(_0x1eee76,_0x5f4bcf){_0x1eee76=_0x1eee76-0x0;var _0x49f47e=_0x25ad[_0x1eee76];return _0x49f47e;};'use strict';var Sequelize=require(_0xd25a('0x0'));module['exports']={'closed':{'type':Sequelize[_0xd25a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd25a('0x2')]},'disposition':{'type':Sequelize[_0xd25a('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd25a('0x3')]},'note':{'type':Sequelize[_0xd25a('0x3')]},'read1stAt':{'type':Sequelize[_0xd25a('0x2')]},'threadId':{'type':Sequelize[_0xd25a('0x3')]},'externalUrl':{'type':Sequelize[_0xd25a('0x3')]},'lastMsgAt':{'type':Sequelize[_0xd25a('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd25a('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xd25a('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xb55e=['BOOLEAN','DATE','STRING','out','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb55e,0x106));var _0xeb55=function(_0x484274,_0x163ffe){_0x484274=_0x484274-0x0;var _0x5cc57b=_0xb55e[_0x484274];return _0x5cc57b;};'use strict';var Sequelize=require(_0xeb55('0x0'));module[_0xeb55('0x1')]={'closed':{'type':Sequelize[_0xeb55('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xeb55('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xeb55('0x4')]},'note':{'type':Sequelize[_0xeb55('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xeb55('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xeb55('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xeb55('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xeb55('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index bbb46ca..2462be2 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 _0xbd8d=['read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','merge','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','rawAttributes','includeAll','include','options','create','addMessage','OpenchannelMessage','ids','getMessages','findOne','nolimit','findAll','setTags','omit','spread','emit','openchannelInteractionTags:save','removeTags','download','join','root','server','files','attachments','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','direction','secret','Account','Owner','mkdirSync','Openchannel','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','disposition','threadId','Public','Private','basename','existsSync','createReadStream','createWriteStream','out','System','Contact','views','downloadInteraction.ejs','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','catch','answered','unmanaged','closed','UserId','waiting','talking','total','OpenchannelInteraction','fieldName','type','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','users','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','buildExpression','body','keys','some','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?'];(function(_0x4c843f,_0x33ffd0){var _0x4ad013=function(_0x2d6f26){while(--_0x2d6f26){_0x4c843f['push'](_0x4c843f['shift']());}};_0x4ad013(++_0x33ffd0);}(_0xbd8d,0x161));var _0xdbd8=function(_0x44ca3c,_0x159153){_0x44ca3c=_0x44ca3c-0x0;var _0x6a734e=_0xbd8d[_0x44ca3c];return _0x6a734e;};'use strict';var emlformat=require(_0xdbd8('0x0'));var rimraf=require(_0xdbd8('0x1'));var zipdir=require(_0xdbd8('0x2'));var jsonpatch=require(_0xdbd8('0x3'));var rp=require(_0xdbd8('0x4'));var moment=require(_0xdbd8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdbd8('0x6'));var util=require(_0xdbd8('0x7'));var path=require(_0xdbd8('0x8'));var sox=require('sox');var csv=require(_0xdbd8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdbd8('0xa'));var _=require(_0xdbd8('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdbd8('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdbd8('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdbd8('0xe'));var as=require(_0xdbd8('0xf'));var pdf=require(_0xdbd8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdbd8('0x11'));var config=require(_0xdbd8('0x12'));var licenseUtil=require(_0xdbd8('0x13'));var db=require(_0xdbd8('0x14'))['db'];config[_0xdbd8('0x15')]=_[_0xdbd8('0x16')](config[_0xdbd8('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdbd8('0x15')]));require(_0xdbd8('0x17'))[_0xdbd8('0x18')](socket);function respondWithStatusCode(_0x44df5e,_0x1d9821){_0x1d9821=_0x1d9821||0xcc;return function(_0x414505){if(_0x414505){return _0x44df5e[_0xdbd8('0x19')](_0x1d9821);}return _0x44df5e[_0xdbd8('0x1a')](_0x1d9821)['end']();};}function respondWithResult(_0x31c137,_0x20346a){_0x20346a=_0x20346a||0xc8;return function(_0x444e83){if(_0x444e83){return _0x31c137[_0xdbd8('0x1a')](_0x20346a)[_0xdbd8('0x1b')](_0x444e83);}};}function respondWithFilteredResult(_0x909cd8,_0x3f42f7){return function(_0x5a3d1b){if(_0x5a3d1b){var _0x27786b=typeof _0x3f42f7[_0xdbd8('0x1c')]===_0xdbd8('0x1d')&&typeof _0x3f42f7[_0xdbd8('0x1e')]==='undefined';var _0x1315dc=_0x5a3d1b[_0xdbd8('0x1f')];var _0x20e33c=_0x27786b?0x0:_0x3f42f7['offset'];var _0x458a90=_0x27786b?_0x5a3d1b[_0xdbd8('0x1f')]:_0x3f42f7[_0xdbd8('0x1c')]+_0x3f42f7[_0xdbd8('0x1e')];var _0x39c542;if(_0x458a90>=_0x1315dc){_0x458a90=_0x1315dc;_0x39c542=0xc8;}else{_0x39c542=0xce;}_0x909cd8[_0xdbd8('0x1a')](_0x39c542);return _0x909cd8[_0xdbd8('0x20')](_0xdbd8('0x21'),_0x20e33c+'-'+_0x458a90+'/'+_0x1315dc)['json'](_0x5a3d1b);}return null;};}function patchUpdates(_0x30f029){return function(_0x1697a0){try{jsonpatch[_0xdbd8('0x22')](_0x1697a0,_0x30f029,!![]);}catch(_0x8b44d2){return BPromise[_0xdbd8('0x23')](_0x8b44d2);}return _0x1697a0[_0xdbd8('0x24')]();};}function saveUpdates(_0x2d3d4c,_0x1a40dd){return function(_0x2c1242){if(_0x2c1242){return _0x2c1242[_0xdbd8('0x25')](_0x2d3d4c)[_0xdbd8('0x26')](function(_0x5cdc2e){return _0x5cdc2e;});}return null;};}function removeEntity(_0x5571e5,_0x4d1851){return function(_0x6765d6){if(_0x6765d6){return _0x6765d6[_0xdbd8('0x27')]()[_0xdbd8('0x26')](function(){_0x5571e5[_0xdbd8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cb790,_0x346acc){return function(_0x2cc41a){if(!_0x2cc41a){_0x3cb790[_0xdbd8('0x19')](0x194);}return _0x2cc41a;};}function handleError(_0x428660,_0x5653d6){_0x5653d6=_0x5653d6||0x1f4;return function(_0x42a920){logger[_0xdbd8('0x28')](_0x42a920[_0xdbd8('0x29')]);if(_0x42a920[_0xdbd8('0x2a')]){delete _0x42a920['name'];}_0x428660[_0xdbd8('0x1a')](_0x5653d6)[_0xdbd8('0x2b')](_0x42a920);};}function getInteractionUsers(_0x2a6c39,_0x486578){return new BPromise(function(_0x46615e,_0x4075a5){try{if(_0x486578[_0x2a6c39['id']]){_0x2a6c39[_0xdbd8('0x2c')]=_['map'](_0x486578[_0x2a6c39['id']],function(_0x2d34b6){return{'id':_0x2d34b6['id'],'fullname':_0x2d34b6[_0xdbd8('0x2d')]};});}}catch(_0x1dfb65){_0x4075a5(_0x1dfb65);}_0x46615e(_0x2a6c39);});}function getInteractionTags(_0x11ecfa,_0x70d73a){return new BPromise(function(_0x449070,_0x23e0a4){try{if(_0x11ecfa[_0xdbd8('0x2e')]){_0x11ecfa[_0xdbd8('0x2f')]=[];_0x11ecfa[_0xdbd8('0x2e')][_0xdbd8('0x30')](',')[_0xdbd8('0x31')](function(_0x266bb9){_0x11ecfa[_0xdbd8('0x2f')][_0xdbd8('0x32')](_0x70d73a[_0x266bb9]);});}delete _0x11ecfa[_0xdbd8('0x2e')];}catch(_0x210ee9){_0x23e0a4(_0x210ee9);}_0x449070(_0x11ecfa);});}function updateOpenchannelInteraction(_0x16eed2,_0xab3e2b,_0x20454d){return new BPromise(function(_0x46702d,_0x592c46){return getInteractionUsers(_0x16eed2,_0x20454d)[_0xdbd8('0x26')](function(_0x116bef){return getInteractionTags(_0x116bef,_0xab3e2b);})[_0xdbd8('0x26')](function(_0x54c949){return getStateInteraction(_0x54c949);})['then'](function(_0x369810){_0x46702d(_0x369810);})[_0xdbd8('0x33')](function(_0x5a848c){_0x592c46(_0x5a848c);});});}function getStateInteraction(_0x8c85ee){return new BPromise(function(_0x18530e){_0x8c85ee['waiting']=0x0;_0x8c85ee['talking']=0x0;_0x8c85ee[_0xdbd8('0x34')]=0x0;_0x8c85ee[_0xdbd8('0x35')]=0x0;_0x8c85ee['total']=0x0;if(!_0x8c85ee[_0xdbd8('0x36')]&&!_0x8c85ee[_0xdbd8('0x37')]){_0x8c85ee[_0xdbd8('0x38')]+=0x1;}if(!_0x8c85ee[_0xdbd8('0x36')]&&_0x8c85ee[_0xdbd8('0x37')]){_0x8c85ee['talking']+=0x1;if(_0x8c85ee[_0xdbd8('0x38')]){_0x8c85ee['waiting']-=0x1;}}if(_0x8c85ee[_0xdbd8('0x36')]&&_0x8c85ee[_0xdbd8('0x37')]){_0x8c85ee[_0xdbd8('0x34')]+=0x1;if(_0x8c85ee[_0xdbd8('0x39')]){_0x8c85ee[_0xdbd8('0x39')]-=0x1;}}if(_0x8c85ee[_0xdbd8('0x36')]&&!_0x8c85ee[_0xdbd8('0x37')]){_0x8c85ee['unmanaged']+=0x1;if(_0x8c85ee[_0xdbd8('0x38')]){_0x8c85ee[_0xdbd8('0x38')]-=0x1;}}_0x8c85ee[_0xdbd8('0x3a')]+=0x1;_0x18530e(_0x8c85ee);});}exports['index']=function(_0xc57bc0,_0xe206c7){var _0x292ec3={},_0x242759={},_0x5f55ab={'count':0x0,'rows':[]};var _0x3af287=_['map'](db[_0xdbd8('0x3b')]['rawAttributes'],function(_0x2d60bb){return{'name':_0x2d60bb[_0xdbd8('0x3c')],'type':_0x2d60bb[_0xdbd8('0x3d')][_0xdbd8('0x3e')]};});_0x242759['model']=_[_0xdbd8('0x3f')](_0x3af287,'name');_0x242759[_0xdbd8('0x40')]=_['keys'](_0xc57bc0[_0xdbd8('0x40')]);_0x242759['filters']=_[_0xdbd8('0x41')](_0x242759[_0xdbd8('0x42')],_0x242759[_0xdbd8('0x40')]);_0x292ec3[_0xdbd8('0x43')]=_[_0xdbd8('0x41')](_0x242759[_0xdbd8('0x42')],qs[_0xdbd8('0x44')](_0xc57bc0[_0xdbd8('0x40')][_0xdbd8('0x44')]));_0x292ec3[_0xdbd8('0x43')]=_0x292ec3['attributes'][_0xdbd8('0x45')]?_0x292ec3['attributes']:_0x242759[_0xdbd8('0x42')];if(!_0xc57bc0[_0xdbd8('0x40')][_0xdbd8('0x46')]('nolimit')){_0x292ec3[_0xdbd8('0x1e')]=qs[_0xdbd8('0x1e')](_0xc57bc0[_0xdbd8('0x40')]['limit']);_0x292ec3['offset']=qs[_0xdbd8('0x1c')](_0xc57bc0['query'][_0xdbd8('0x1c')]);}_0x292ec3['order']=qs[_0xdbd8('0x47')](_0xc57bc0['query'][_0xdbd8('0x47')]);_0x292ec3['where']=qs[_0xdbd8('0x48')](_[_0xdbd8('0x49')](_0xc57bc0['query'],_0x242759['filters']),_0x3af287);var _0x5cc1a7=[];var _0x72fbf2=squel[_0xdbd8('0x4a')]()[_0xdbd8('0x4b')]('id')[_0xdbd8('0x4b')](_0xdbd8('0x2a'))['field'](_0xdbd8('0x4c'))['from'](_0xdbd8('0x4d'));var _0x5e0879=squel[_0xdbd8('0x4a')]()[_0xdbd8('0x4b')](_0xdbd8('0x4e'))['field'](_0xdbd8('0x4f'))[_0xdbd8('0x4b')](_0xdbd8('0x50'))[_0xdbd8('0x51')](_0xdbd8('0x52'),'ui')[_0xdbd8('0x53')](_0xdbd8('0x54'),'u','u.id\x20=\x20ui.UserId');var _0x37c7e1=squel[_0xdbd8('0x4a')]()[_0xdbd8('0x51')](_0xdbd8('0x55'),'i')[_0xdbd8('0x53')](_0xdbd8('0x56'),'c',_0xdbd8('0x57'))[_0xdbd8('0x53')](_0xdbd8('0x54'),'o',_0xdbd8('0x58'))[_0xdbd8('0x53')]('openchannel_accounts','a',_0xdbd8('0x59'))[_0xdbd8('0x53')](_0xdbd8('0x5a'),'me',_0xdbd8('0x5b'))[_0xdbd8('0x53')](_0xdbd8('0x5c'),'it',_0xdbd8('0x5d'))[_0xdbd8('0x53')]('tools_tags','t',_0xdbd8('0x5e'));var _0x57a5f0=squel[_0xdbd8('0x5f')]();var _0x5d3114=[];var _0x4952b3=squel['expr']();var _0x45c477;if(_0xc57bc0['query'][_0xdbd8('0x60')]){_0x45c477=as[_0xdbd8('0x61')](_0xc57bc0[_0xdbd8('0x40')]['search']);var _0x5de576=_0x45c477[_0xdbd8('0x62')];for(var _0x2f0e32=0x0;_0x2f0e32<_0x45c477[_0xdbd8('0x63')][_0xdbd8('0x45')];_0x2f0e32++){var _0x38116c=_0x45c477[_0xdbd8('0x63')][_0x2f0e32];var _0x510942='i';var _0xeb768d=_[_0xdbd8('0x64')](_0x3af287,[_0xdbd8('0x2a'),_0x38116c[_0xdbd8('0x4b')]]);if(!_0xeb768d){switch(_0x38116c['field']){case _0xdbd8('0x65'):if(_0x38116c['value']==0x1){_0x37c7e1[_0xdbd8('0x66')]('`'+_0x38116c[_0xdbd8('0x4b')]+_0xdbd8('0x67'));}else{_0x37c7e1[_0xdbd8('0x66')]('`'+_0x38116c[_0xdbd8('0x4b')]+_0xdbd8('0x68'));}break;case'Contact':if(_0x38116c[_0xdbd8('0x69')]===_0xdbd8('0x6a')){if(_0x38116c[_0xdbd8('0x6b')][_0xdbd8('0x30')]('\x20')[_0xdbd8('0x45')]>0x1){_0x57a5f0[_0x5de576](_0xdbd8('0x6c'),qs[_0xdbd8('0x6d')](_0x38116c[_0xdbd8('0x6b')]),null);}else{var _0x4d8c80='%'+_0x38116c[_0xdbd8('0x6b')]+'%';_0x57a5f0[_0x5de576](_0xdbd8('0x6e'),_0x4d8c80,_0x4d8c80,_0x4d8c80);}}else{_0xeb768d=_[_0xdbd8('0x64')](_0x3af287,['name',_0xdbd8('0x6f')]);_0x38116c[_0xdbd8('0x4b')]=_0xdbd8('0x6f');_0x456ca2=as['buildExpression'](_0x510942,_0xeb768d[_0xdbd8('0x3d')],_0x38116c);_0x57a5f0[_0x5de576](_0x456ca2[_0xdbd8('0x70')],_0x456ca2['value'][_0xdbd8('0x71')],_0x456ca2['value'][_0xdbd8('0x72')]);}break;case _0xdbd8('0x73'):var _0x58e46e=_0x38116c['value'][_0xdbd8('0x30')](',')[_0xdbd8('0x3f')](function(_0x103c0f){return Number(_0x103c0f);});_0x58e46e[_0xdbd8('0x31')](function(_0xb6f1d5){_0x4952b3['or'](_0xdbd8('0x74'),'%,'+_0xb6f1d5+',%');});_0x5d3114=_['union'](_0x5d3114,_0x58e46e);break;case _0xdbd8('0x75'):if(_0x38116c[_0xdbd8('0x69')]===_0xdbd8('0x6a')){_0x57a5f0[_0x5de576]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x38116c['value']+'%',null);}else{_0xeb768d=_[_0xdbd8('0x64')](_0x3af287,['name',_0xdbd8('0x37')]);_0x38116c[_0xdbd8('0x4b')]=_0xdbd8('0x37');_0x456ca2=as[_0xdbd8('0x76')](_0x510942,_0xeb768d['type'],_0x38116c);_0x57a5f0[_0x5de576](_0x456ca2['text'],_0x456ca2[_0xdbd8('0x6b')][_0xdbd8('0x71')],_0x456ca2['value'][_0xdbd8('0x72')]);}break;case _0xdbd8('0x77'):_0x456ca2=as[_0xdbd8('0x76')]('me',null,_0x38116c);_0x57a5f0[_0x5de576](_0x456ca2[_0xdbd8('0x70')],_0x456ca2[_0xdbd8('0x6b')][_0xdbd8('0x71')],_0x456ca2[_0xdbd8('0x6b')][_0xdbd8('0x72')]);break;}}else{var _0x456ca2=as[_0xdbd8('0x76')](_0x510942,_0xeb768d[_0xdbd8('0x3d')],_0x38116c);_0x57a5f0[_0x5de576](_0x456ca2['text'],_0x456ca2['value'][_0xdbd8('0x71')],_0x456ca2['value']['end']);}}}else{var _0x3782c0=_(_0xc57bc0[_0xdbd8('0x40')])[_0xdbd8('0x78')]()[_0xdbd8('0x3f')](function(_0x562d28){return _[_0xdbd8('0x79')](_0x3af287,[_0xdbd8('0x2a'),_0x562d28])?_0x562d28:undefined;})[_0xdbd8('0x7a')]()[_0xdbd8('0x6b')]();if(!_[_0xdbd8('0x7b')](_0x3782c0)){_0x3782c0['forEach'](function(_0x220713){if(_0x220713===_0xdbd8('0x7c')){_0x37c7e1[_0xdbd8('0x7d')](_0xdbd8('0x7e'),[][_0xdbd8('0x7f')](_0xc57bc0['query'][_0x220713]));}else if(_0x220713==='createdAt'){var _0x1971b8=JSON[_0xdbd8('0x80')](_0xc57bc0[_0xdbd8('0x40')][_0x220713])[_0xdbd8('0x81')];var _0x42dca4=JSON[_0xdbd8('0x80')](_0xc57bc0[_0xdbd8('0x40')][_0x220713])['$lte'];_0x37c7e1[_0xdbd8('0x7d')](_0xdbd8('0x82'),_0x1971b8,_0x42dca4);}else{if(_0xc57bc0[_0xdbd8('0x40')][_0x220713]==='null'){_0x37c7e1[_0xdbd8('0x7d')]('i.'+_0x220713+_0xdbd8('0x83'));}else{_0x37c7e1[_0xdbd8('0x7d')]('i.'+_0x220713+_0xdbd8('0x84'),_0xc57bc0['query'][_0x220713]);}}});}if(_0xc57bc0[_0xdbd8('0x40')][_0xdbd8('0x85')]){if(_0xc57bc0[_0xdbd8('0x40')]['read']==0x1){_0x37c7e1[_0xdbd8('0x66')]('`unreadMessages`\x20=\x200');}else{_0x37c7e1['having'](_0xdbd8('0x86'));}}if(_0xc57bc0[_0xdbd8('0x40')]['tag']){_0x5d3114=_[_0xdbd8('0x87')](_0xc57bc0[_0xdbd8('0x40')][_0xdbd8('0x88')])?_0xc57bc0[_0xdbd8('0x40')][_0xdbd8('0x88')]:new Array(_0xc57bc0[_0xdbd8('0x40')][_0xdbd8('0x88')]);_0x5d3114[_0xdbd8('0x31')](function(_0x2cb11b){_0x4952b3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2cb11b+',%');});}if(_0xc57bc0[_0xdbd8('0x40')][_0xdbd8('0x89')]){var _0x360d4=_0xc57bc0[_0xdbd8('0x40')][_0xdbd8('0x89')][_0xdbd8('0x8a')]('\x5c','\x5c\x5c')[_0xdbd8('0x8a')](/'/g,'\x27\x27');if(qs[_0xdbd8('0x8b')](_0x360d4)){_0x57a5f0['or'](_0xdbd8('0x8c'),_0x360d4+'%');}else{_0x57a5f0['or'](_0xdbd8('0x8d'),qs[_0xdbd8('0x6d')](_0x360d4))['or'](_0xdbd8('0x8e'),_0x360d4+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x360d4+'%');}}}_0x37c7e1[_0xdbd8('0x7d')](_0x57a5f0);_0x37c7e1[_0xdbd8('0x8f')]('i.id');var _0x531524={'type':db[_0xdbd8('0x90')][_0xdbd8('0x91')]['SELECT'],'raw':!![]};var _0x1a6078=_0x37c7e1['clone']();_0x1a6078[_0xdbd8('0x4b')]('i.id');_0x1a6078['field'](_0xdbd8('0x92'),_0xdbd8('0x65'));if(_0x292ec3['order']){_0x292ec3[_0xdbd8('0x93')][_0xdbd8('0x31')](function(_0x26a001){var _0x490950=_0x26a001[0x0]===_0xdbd8('0x94')?_0x26a001[0x0]:'i.'+_0x26a001[0x0];_0x37c7e1[_0xdbd8('0x93')](_0x490950,_0x26a001[0x1]===_0xdbd8('0x95')?![]:!![]);});}if(!_[_0xdbd8('0x7b')](_0x5d3114)){_0x37c7e1['having'](_0x4952b3);_0x1a6078[_0xdbd8('0x7d')](_0xdbd8('0x96'),_0x5d3114);}BPromise[_0xdbd8('0x97')]()['then'](function(){if(!_0x45c477){if(_0xc57bc0['query']['OpenchannelAccountId'])return;_0x1a6078[_0xdbd8('0x7d')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x37c7e1['where'](_0xdbd8('0x98'));return;}if(_0xc57bc0['user'][_0xdbd8('0x99')]!=='agent')return;return _0xc57bc0[_0xdbd8('0x9a')][_0xdbd8('0x9b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x745cd){if(_[_0xdbd8('0x7b')](_0x745cd)){_0x1a6078[_0xdbd8('0x7d')](_0xdbd8('0x9c'));_0x37c7e1[_0xdbd8('0x7d')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x1a6078['where'](_0xdbd8('0x7e'),_[_0xdbd8('0x3f')](_0x745cd,'id'));_0x37c7e1[_0xdbd8('0x7d')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xdbd8('0x3f')](_0x745cd,'id'));}});})[_0xdbd8('0x26')](function(){if(_0xc57bc0[_0xdbd8('0x9a')]['role']===_0xdbd8('0x9d')&&!_0x45c477&&!_0xc57bc0[_0xdbd8('0x40')][_0xdbd8('0x7c')])return[];return db['sequelize'][_0xdbd8('0x40')](_0x1a6078[_0xdbd8('0x9e')](),_0x531524);})[_0xdbd8('0x26')](function(_0xcba43){_0x5f55ab['count']=_0xcba43[_0xdbd8('0x45')];if(_0x5f55ab[_0xdbd8('0x1f')]===0x0)return[];return db[_0xdbd8('0x9f')][_0xdbd8('0x40')](_0x72fbf2[_0xdbd8('0x9e')](),_0x531524)[_0xdbd8('0x26')](function(_0x162db8){_0x5cc1a7=_[_0xdbd8('0xa0')](_0x162db8,'id');_0x531524=_[_0xdbd8('0xa1')](_0x531524,{'model':db[_0xdbd8('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xc57bc0[_0xdbd8('0x40')]['fields']){_0x292ec3[_0xdbd8('0x43')]['forEach'](function(_0x2b4112){_0x37c7e1['field']('i.'+_0x2b4112);});}else{_0x37c7e1[_0xdbd8('0x4b')](_0xdbd8('0x92'),'unreadMessages');_0x37c7e1['field'](_0xdbd8('0xa2'),'Account.key');_0x37c7e1[_0xdbd8('0x4b')]('a.mandatoryDisposition',_0xdbd8('0xa3'));_0x37c7e1['field'](_0xdbd8('0xa4'),_0xdbd8('0x94'));_0x37c7e1[_0xdbd8('0x4b')](_0xdbd8('0xa5'));_0x37c7e1['field']('c.firstName',_0xdbd8('0xa6'));_0x37c7e1[_0xdbd8('0x4b')]('c.lastName',_0xdbd8('0xa7'));_0x37c7e1[_0xdbd8('0x4b')](_0xdbd8('0xa8'),_0xdbd8('0xa9'));_0x37c7e1[_0xdbd8('0x4b')](_0xdbd8('0xaa'),'Contact.phone');_0x37c7e1['field'](_0xdbd8('0xab'),_0xdbd8('0xac'));_0x37c7e1[_0xdbd8('0x4b')]('c.fax',_0xdbd8('0xad'));_0x37c7e1['field'](_0xdbd8('0xae'),_0xdbd8('0xaf'));_0x37c7e1[_0xdbd8('0x4b')](_0xdbd8('0xb0'),_0xdbd8('0xb1'));_0x37c7e1[_0xdbd8('0x4b')](_0xdbd8('0xb2'),_0xdbd8('0x2e'));}if(_0x292ec3[_0xdbd8('0x1e')])_0x37c7e1[_0xdbd8('0x1e')](_0x292ec3[_0xdbd8('0x1e')]);if(_0x292ec3[_0xdbd8('0x1c')])_0x37c7e1[_0xdbd8('0x1c')](_0x292ec3[_0xdbd8('0x1c')]);return db[_0xdbd8('0x9f')]['query'](_0x37c7e1[_0xdbd8('0x9e')](),_0x531524);})[_0xdbd8('0x26')](function(_0x4b16c1){if(_0x4b16c1['length']>0x0)_0x5e0879[_0xdbd8('0x7d')](_0xdbd8('0xb3'),_[_0xdbd8('0x3f')](_0x4b16c1,'id'));return db[_0xdbd8('0x9f')][_0xdbd8('0x40')](_0x5e0879[_0xdbd8('0x9e')](),_0x531524)['then'](function(_0x1e8dac){var _0x2c5e13=_[_0xdbd8('0xb4')](_0x1e8dac,_0xdbd8('0xb5'));var _0xe8002a=[];_0x4b16c1['forEach'](function(_0x3383be){_0xe8002a[_0xdbd8('0x32')](updateOpenchannelInteraction(_0x3383be,_0x5cc1a7,_0x2c5e13));});return BPromise[_0xdbd8('0xb6')](_0xe8002a);});});})[_0xdbd8('0x26')](function(_0x416099){_0x5f55ab[_0xdbd8('0xb7')]=_0x416099;return _0x5f55ab;})['then'](respondWithFilteredResult(_0xe206c7,_0x292ec3))[_0xdbd8('0x33')](handleError(_0xe206c7,null));};exports[_0xdbd8('0xb8')]=function(_0x509720,_0x1bce22){var _0x185d49={};if(_0x509720[_0xdbd8('0x40')][_0xdbd8('0x3d')]&&_0x509720[_0xdbd8('0x40')][_0xdbd8('0x3d')]==='from'){_0x185d49['from']=_0x509720[_0xdbd8('0xb9')]['id'];}else{_0x185d49['id']=_0x509720[_0xdbd8('0xb9')]['id'];}var _0x40cb03={'raw':![],'where':_0x185d49},_0x544b02={};_0x544b02[_0xdbd8('0x42')]=_[_0xdbd8('0x78')](db[_0xdbd8('0x3b')][_0xdbd8('0xba')]);_0x544b02[_0xdbd8('0x40')]=_[_0xdbd8('0x78')](_0x509720[_0xdbd8('0x40')]);_0x544b02[_0xdbd8('0x48')]=_['intersection'](_0x544b02[_0xdbd8('0x42')],_0x544b02[_0xdbd8('0x40')]);_0x40cb03[_0xdbd8('0x43')]=_[_0xdbd8('0x41')](_0x544b02[_0xdbd8('0x42')],qs[_0xdbd8('0x44')](_0x509720['query'][_0xdbd8('0x44')]));_0x40cb03[_0xdbd8('0x43')]=_0x40cb03['attributes'][_0xdbd8('0x45')]?_0x40cb03[_0xdbd8('0x43')]:_0x544b02[_0xdbd8('0x42')];if(_0x509720[_0xdbd8('0x40')][_0xdbd8('0xbb')]){_0x40cb03[_0xdbd8('0xbc')]=[{'all':!![]}];}_0x40cb03=_[_0xdbd8('0xa1')]({},_0x40cb03,_0x509720[_0xdbd8('0xbd')]);return db['OpenchannelInteraction'][_0xdbd8('0x64')](_0x40cb03)[_0xdbd8('0x26')](handleEntityNotFound(_0x1bce22,null))[_0xdbd8('0x26')](respondWithResult(_0x1bce22,null))['catch'](handleError(_0x1bce22,null));};exports[_0xdbd8('0xbe')]=function(_0x5d6a36,_0x584de3){return db[_0xdbd8('0x3b')]['create'](_0x5d6a36[_0xdbd8('0x77')],{})[_0xdbd8('0x26')](respondWithResult(_0x584de3,0xc9))['catch'](handleError(_0x584de3,null));};exports[_0xdbd8('0x25')]=function(_0x4a905a,_0xb5a7e7){if(_0x4a905a[_0xdbd8('0x77')]['id']){delete _0x4a905a[_0xdbd8('0x77')]['id'];}return db[_0xdbd8('0x3b')][_0xdbd8('0x64')]({'where':{'id':_0x4a905a[_0xdbd8('0xb9')]['id']}})[_0xdbd8('0x26')](handleEntityNotFound(_0xb5a7e7,null))['then'](saveUpdates(_0x4a905a[_0xdbd8('0x77')],null))[_0xdbd8('0x26')](respondWithResult(_0xb5a7e7,null))['catch'](handleError(_0xb5a7e7,null));};exports[_0xdbd8('0x27')]=function(_0x5d21a6,_0x348bb7){return db[_0xdbd8('0x3b')][_0xdbd8('0x64')]({'where':{'id':_0x5d21a6[_0xdbd8('0xb9')]['id']}})[_0xdbd8('0x26')](handleEntityNotFound(_0x348bb7,null))[_0xdbd8('0x26')](removeEntity(_0x348bb7,null))[_0xdbd8('0x33')](handleError(_0x348bb7,null));};exports['describe']=function(_0x1038e0,_0x23ceb4){return db['OpenchannelInteraction']['describe']()[_0xdbd8('0x26')](respondWithResult(_0x23ceb4,null))[_0xdbd8('0x33')](handleError(_0x23ceb4,null));};exports[_0xdbd8('0xbf')]=function(_0x511174,_0x388630,_0x374f38){return db[_0xdbd8('0xc0')][_0xdbd8('0x64')]({'where':{'id':_0x511174[_0xdbd8('0xb9')]['id']}})['then'](handleEntityNotFound(_0x388630,null))['then'](function(_0x471184){if(_0x471184){return _0x471184[_0xdbd8('0xbf')](_0x511174['body']['ids'],_['omit'](_0x511174['body'],[_0xdbd8('0xc1'),'id'])||{});}})[_0xdbd8('0x26')](respondWithResult(_0x388630,null))[_0xdbd8('0x33')](handleError(_0x388630,null));};exports[_0xdbd8('0xc2')]=function(_0x32f4cc,_0x5cfd81,_0x50eb90){var _0x48271d={'raw':![],'where':{}};var _0x13456c={};var _0x55fd9f={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xdbd8('0xc3')]({'where':{'id':_0x32f4cc[_0xdbd8('0xb9')]['id']}})[_0xdbd8('0x26')](handleEntityNotFound(_0x5cfd81,null))[_0xdbd8('0x26')](function(_0x47fae7){if(_0x47fae7){_0x13456c[_0xdbd8('0x42')]=_[_0xdbd8('0x78')](db[_0xdbd8('0xc0')][_0xdbd8('0xba')]);_0x13456c[_0xdbd8('0x40')]=_[_0xdbd8('0x78')](_0x32f4cc[_0xdbd8('0x40')]);_0x13456c[_0xdbd8('0x48')]=_['intersection'](_0x13456c[_0xdbd8('0x42')],_0x13456c['query']);_0x48271d[_0xdbd8('0x43')]=_[_0xdbd8('0x41')](_0x13456c['model'],qs[_0xdbd8('0x44')](_0x32f4cc[_0xdbd8('0x40')][_0xdbd8('0x44')]));_0x48271d[_0xdbd8('0x43')]=_0x48271d['attributes'][_0xdbd8('0x45')]?_0x48271d['attributes']:_0x13456c[_0xdbd8('0x42')];if(!_0x32f4cc['query'][_0xdbd8('0x46')](_0xdbd8('0xc4'))){_0x48271d[_0xdbd8('0x1e')]=qs[_0xdbd8('0x1e')](_0x32f4cc[_0xdbd8('0x40')][_0xdbd8('0x1e')]);_0x48271d['offset']=qs[_0xdbd8('0x1c')](_0x32f4cc[_0xdbd8('0x40')][_0xdbd8('0x1c')]);}_0x48271d[_0xdbd8('0x93')]=qs[_0xdbd8('0x47')](_0x32f4cc[_0xdbd8('0x40')]['sort']);_0x48271d[_0xdbd8('0x7d')]=qs['filters'](_[_0xdbd8('0x49')](_0x32f4cc[_0xdbd8('0x40')],_0x13456c[_0xdbd8('0x48')]));_0x48271d['where'][_0xdbd8('0xb5')]=_0x47fae7['id'];if(_0x32f4cc['query']['filter']){_0x48271d[_0xdbd8('0x7d')]=_[_0xdbd8('0xa1')](_0x48271d[_0xdbd8('0x7d')],{'$or':_[_0xdbd8('0x3f')](_0x48271d[_0xdbd8('0x43')],function(_0x2e4604){var _0x4d84cd={};_0x4d84cd[_0x2e4604]={'$like':'%'+_0x32f4cc[_0xdbd8('0x40')][_0xdbd8('0x89')]+'%'};return _0x4d84cd;})});}if(_0x32f4cc[_0xdbd8('0x40')]['$gte']){var _0x23b69f=_0x32f4cc[_0xdbd8('0x40')][_0xdbd8('0x81')][_0xdbd8('0x30')](',');var _0x684726={};_0x684726[_0x23b69f[0x0]]={'$gte':moment(_0x23b69f[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x48271d[_0xdbd8('0x7d')]=_[_0xdbd8('0xa1')](_0x48271d[_0xdbd8('0x7d')],_0x684726);}_0x48271d=_[_0xdbd8('0xa1')]({},_0x48271d,_0x32f4cc[_0xdbd8('0xbd')]);return db[_0xdbd8('0xc0')]['count']({'where':_0x48271d[_0xdbd8('0x7d')]})[_0xdbd8('0x26')](function(_0x2dfe87){_0x55fd9f[_0xdbd8('0x1f')]=_0x2dfe87;if(_0x32f4cc[_0xdbd8('0x40')][_0xdbd8('0xbb')]){_0x48271d[_0xdbd8('0xbc')]=[{'all':!![]}];}return db[_0xdbd8('0xc0')][_0xdbd8('0xc5')](_0x48271d);})[_0xdbd8('0x26')](function(_0x54f6c7){_0x55fd9f['rows']=_0x54f6c7;return _0x55fd9f;});}})[_0xdbd8('0x26')](respondWithFilteredResult(_0x5cfd81,_0x48271d))[_0xdbd8('0x33')](handleError(_0x5cfd81,null));};exports['addTags']=function(_0x3678c7,_0x4b7ca8,_0x3ebb5f){return db[_0xdbd8('0x3b')][_0xdbd8('0x64')]({'where':{'id':_0x3678c7[_0xdbd8('0xb9')]['id']}})['then'](handleEntityNotFound(_0x4b7ca8,null))['then'](function(_0x42f05b){if(_0x42f05b){return _0x42f05b[_0xdbd8('0xc6')](_0x3678c7['body']['ids'],_[_0xdbd8('0xc7')](_0x3678c7[_0xdbd8('0x77')],[_0xdbd8('0xc1'),'id'])||{})[_0xdbd8('0xc8')](function(){return db[_0xdbd8('0x73')][_0xdbd8('0xc5')]({'attributes':['id',_0xdbd8('0x2a'),_0xdbd8('0x4c')],'where':{'id':_0x3678c7['body'][_0xdbd8('0xc1')]}});})[_0xdbd8('0x26')](function(_0x405c7a){socket[_0xdbd8('0xc9')](_0xdbd8('0xca'),{'id':Number(_0x3678c7[_0xdbd8('0xb9')]['id']),'tags':_0x405c7a||[]});return{'id':Number(_0x3678c7[_0xdbd8('0xb9')]['id']),'tags':_0x405c7a||[]};});}})['then'](respondWithResult(_0x4b7ca8,null))[_0xdbd8('0x33')](handleError(_0x4b7ca8,null));};exports[_0xdbd8('0xcb')]=function(_0x1e1e4b,_0x11ebf7,_0x431ef1){return db[_0xdbd8('0x3b')][_0xdbd8('0x64')]({'where':{'id':_0x1e1e4b[_0xdbd8('0xb9')]['id']}})[_0xdbd8('0x26')](handleEntityNotFound(_0x11ebf7,null))[_0xdbd8('0x26')](function(_0x1d8a0a){if(_0x1d8a0a){return _0x1d8a0a[_0xdbd8('0xcb')](_0x1e1e4b[_0xdbd8('0x40')][_0xdbd8('0xc1')]);}})[_0xdbd8('0x26')](respondWithStatusCode(_0x11ebf7,null))[_0xdbd8('0x33')](handleError(_0x11ebf7,null));};exports[_0xdbd8('0xcc')]=function(_0x306c4c,_0x3ebd48){var _0x1254e9=moment()['unix']()['toString']();var _0x165bf1=path[_0xdbd8('0xcd')](config[_0xdbd8('0xce')],'server','files','tmp');var _0x11c85e=path[_0xdbd8('0xcd')](config[_0xdbd8('0xce')],_0xdbd8('0xcf'),_0xdbd8('0xd0'),_0xdbd8('0xd1'));var _0x2999f7=path['join'](_0x165bf1,_0x1254e9);var _0x128288=util[_0xdbd8('0xd2')](_0xdbd8('0xd3'),_0x306c4c[_0xdbd8('0xb9')]['id'],_0x1254e9);var _0x4c643c=path[_0xdbd8('0xcd')](_0x165bf1,_0x128288);var _0x267252=[];_0x267252['push']({'model':db[_0xdbd8('0x75')],'as':'User','attributes':['id',_0xdbd8('0x2d')],'raw':!![]});_0x267252[_0xdbd8('0x32')]({'model':db[_0xdbd8('0xd4')],'as':'Contact','attributes':['id',_0xdbd8('0xd5'),_0xdbd8('0xd6')],'raw':!![]});if(_0x306c4c[_0xdbd8('0x40')][_0xdbd8('0xd1')]){_0x267252['push']({'model':db[_0xdbd8('0xd7')],'as':_0xdbd8('0xd7'),'raw':!![]});}var _0x2266b7=[{'model':db[_0xdbd8('0xc0')],'as':_0xdbd8('0xd8'),'attributes':['id','body','createdAt',_0xdbd8('0xd9'),_0xdbd8('0xda'),_0xdbd8('0x85')],'include':_0x267252}];_0x2266b7[_0xdbd8('0x32')]({'model':db['OpenchannelAccount'],'as':_0xdbd8('0xdb'),'attributes':['id',_0xdbd8('0x2a')]});_0x2266b7[_0xdbd8('0x32')]({'model':db[_0xdbd8('0x75')],'as':_0xdbd8('0xdc'),'attributes':['id',_0xdbd8('0x2d')]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x306c4c[_0xdbd8('0xb9')]['id']},'include':_0x2266b7})[_0xdbd8('0x26')](handleEntityNotFound(_0x3ebd48,null))[_0xdbd8('0x26')](function(_0x4c5f56){if(_0x4c5f56){var _0x16f2aa=_0x4c5f56['get']({'plain':!![]});fs[_0xdbd8('0xdd')](_0x2999f7);var _0x38895a={'channel':_0xdbd8('0xde'),'account':_0x16f2aa['Account'][_0xdbd8('0x2a')],'agent':_0x16f2aa[_0xdbd8('0xdc')]?_0x16f2aa['Owner'][_0xdbd8('0x2d')]:_0xdbd8('0xdf'),'createdAt':moment(_0x16f2aa[_0xdbd8('0xe0')])[_0xdbd8('0xd2')](_0xdbd8('0xe1'))[_0xdbd8('0x9e')](),'closedAt':_0x16f2aa[_0xdbd8('0x36')]?moment(_0x16f2aa['closedAt'])[_0xdbd8('0xd2')](_0xdbd8('0xe1'))[_0xdbd8('0x9e')]():'','disposition':_0x16f2aa[_0xdbd8('0xe2')],'visibility':_0x16f2aa[_0xdbd8('0xe3')]?_0xdbd8('0xe4'):_0xdbd8('0xe5'),'messages':_(_0x16f2aa['Messages'])[_0xdbd8('0x89')]({'secret':![]})[_0xdbd8('0x3f')](function(_0x4b96ba){if(_0x4b96ba[_0xdbd8('0xd7')]){var _0x319f73=path[_0xdbd8('0xcd')](_0x11c85e,_0x4b96ba[_0xdbd8('0xd7')][_0xdbd8('0xe6')]);if(fs[_0xdbd8('0xe7')](_0x319f73)){fs[_0xdbd8('0xe8')](_0x319f73)['pipe'](fs[_0xdbd8('0xe9')](path[_0xdbd8('0xcd')](_0x2999f7,_0x4b96ba[_0xdbd8('0xd7')][_0xdbd8('0xe6')])));}}return{'date':moment(_0x4b96ba[_0xdbd8('0xe0')])[_0xdbd8('0xd2')](_0xdbd8('0xe1'))[_0xdbd8('0x9e')](),'sender':_0x4b96ba[_0xdbd8('0xd9')]===_0xdbd8('0xea')?_0x4b96ba[_0xdbd8('0x75')]?_0x4b96ba[_0xdbd8('0x75')][_0xdbd8('0x2d')]:_0xdbd8('0xeb'):_0x4b96ba[_0xdbd8('0xec')][_0xdbd8('0xd5')]+(_0x4b96ba['Contact'][_0xdbd8('0xd6')]?'\x20'+_0x4b96ba[_0xdbd8('0xec')][_0xdbd8('0xd6')]:''),'body':_0x4b96ba[_0xdbd8('0xd7')]?_0x4b96ba[_0xdbd8('0xd7')][_0xdbd8('0xe6')]:_0x4b96ba[_0xdbd8('0x77')],'direction':_0x4b96ba['direction']===_0xdbd8('0xea')?'A':'C','secret':_0x4b96ba[_0xdbd8('0xda')],'read':_0x4b96ba[_0xdbd8('0x85')],'attachment':_0x4b96ba[_0xdbd8('0xd7')]};})[_0xdbd8('0x6b')]()};return ejs['renderFile'](path[_0xdbd8('0xcd')](config['root'],_0xdbd8('0xcf'),_0xdbd8('0xed'),_0xdbd8('0xee')),{'interaction':_0x38895a})[_0xdbd8('0x26')](function(_0x32dd63){var _0x526cc1=path['join'](_0x2999f7,'transcript-'+_0x16f2aa['id']+'-'+_0x1254e9+'.pdf');var _0x4793b1={'path':_0x526cc1,'channel':_0xdbd8('0xde'),'interactionId':_0x16f2aa['id']};return pdf[_0xdbd8('0xef')](_0x32dd63,_0x4793b1);})[_0xdbd8('0x26')](function(){return new BPromise(function(_0x1ccc10,_0x44febc){zipdir(_0x2999f7,{'saveTo':_0x4c643c},function(_0x1197fe,_0x44d4a2){if(_0x1197fe)return _0x44febc(_0x1197fe);return _0x1ccc10(_0x44d4a2);});})[_0xdbd8('0x26')](function(){return new BPromise(function(_0x21fd0c,_0x46ae08){rimraf(_0x2999f7,function(_0x5e14a6){if(_0x5e14a6)_0x46ae08(_0x5e14a6);return _0x21fd0c();});});})[_0xdbd8('0x26')](function(){return _0x3ebd48['download'](_0x4c643c,_0x128288,function(_0x5366b0){if(_0x5366b0){console[_0xdbd8('0xf0')](_0xdbd8('0xf1'),_0x5366b0);}else{fs[_0xdbd8('0xf2')](_0x4c643c);}});});});}else{return _0x3ebd48[_0xdbd8('0x19')](0xc8);}})[_0xdbd8('0x33')](handleError(_0x3ebd48,null));}; \ No newline at end of file +var _0xc52d=['join','files','tmp','root','server','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','createdAt','direction','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','closedAt','disposition','threadId','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','secret','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./openchannelInteraction.socket','register','status','end','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','sendStatus','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','waiting','talking','answered','unmanaged','total','UserId','closed','index','OpenchannelInteraction','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','parseSearch','sqlOperator','conditions','length','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','some','isEmpty','OpenchannelAccountId','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','role','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','rows','catch','show','params','include','merge','options','create','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','nolimit','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','unix'];(function(_0x59b439,_0x14ae7b){var _0x521ea3=function(_0x5af627){while(--_0x5af627){_0x59b439['push'](_0x59b439['shift']());}};_0x521ea3(++_0x14ae7b);}(_0xc52d,0x11d));var _0xdc52=function(_0x46bc16,_0x493478){_0x46bc16=_0x46bc16-0x0;var _0x48fe48=_0xc52d[_0x46bc16];return _0x48fe48;};'use strict';var emlformat=require(_0xdc52('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdc52('0x1'));var rp=require(_0xdc52('0x2'));var moment=require('moment');var BPromise=require(_0xdc52('0x3'));var Mustache=require(_0xdc52('0x4'));var util=require(_0xdc52('0x5'));var path=require(_0xdc52('0x6'));var sox=require(_0xdc52('0x7'));var csv=require('to-csv');var ejs=require(_0xdc52('0x8'));var fs=require('fs');var fs_extra=require(_0xdc52('0x9'));var _=require('lodash');var squel=require(_0xdc52('0xa'));var crypto=require(_0xdc52('0xb'));var jsforce=require(_0xdc52('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdc52('0xd'));var Papa=require('papaparse');var Redis=require(_0xdc52('0xe'));var authService=require(_0xdc52('0xf'));var qs=require(_0xdc52('0x10'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xdc52('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc52('0x12'))('api');var utils=require(_0xdc52('0x13'));var config=require(_0xdc52('0x14'));var licenseUtil=require(_0xdc52('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xdc52('0x16')](config[_0xdc52('0x17')],{'host':_0xdc52('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc52('0x17')]));require(_0xdc52('0x19'))[_0xdc52('0x1a')](socket);function respondWithStatusCode(_0x37f020,_0x4f10f1){_0x4f10f1=_0x4f10f1||0xcc;return function(_0x492046){if(_0x492046){return _0x37f020['sendStatus'](_0x4f10f1);}return _0x37f020[_0xdc52('0x1b')](_0x4f10f1)[_0xdc52('0x1c')]();};}function respondWithResult(_0x45da50,_0x12af4b){_0x12af4b=_0x12af4b||0xc8;return function(_0xb45cb3){if(_0xb45cb3){return _0x45da50[_0xdc52('0x1b')](_0x12af4b)['json'](_0xb45cb3);}};}function respondWithFilteredResult(_0x3b9f43,_0x4dad28){return function(_0x3d1387){if(_0x3d1387){var _0x169692=typeof _0x4dad28[_0xdc52('0x1d')]===_0xdc52('0x1e')&&typeof _0x4dad28['limit']===_0xdc52('0x1e');var _0x17f229=_0x3d1387['count'];var _0x38cbee=_0x169692?0x0:_0x4dad28[_0xdc52('0x1d')];var _0x4f2fc4=_0x169692?_0x3d1387[_0xdc52('0x1f')]:_0x4dad28[_0xdc52('0x1d')]+_0x4dad28[_0xdc52('0x20')];var _0x4a1b7c;if(_0x4f2fc4>=_0x17f229){_0x4f2fc4=_0x17f229;_0x4a1b7c=0xc8;}else{_0x4a1b7c=0xce;}_0x3b9f43[_0xdc52('0x1b')](_0x4a1b7c);return _0x3b9f43[_0xdc52('0x21')](_0xdc52('0x22'),_0x38cbee+'-'+_0x4f2fc4+'/'+_0x17f229)['json'](_0x3d1387);}return null;};}function patchUpdates(_0x50eb80){return function(_0x587d86){try{jsonpatch['apply'](_0x587d86,_0x50eb80,!![]);}catch(_0x3bcf96){return BPromise['reject'](_0x3bcf96);}return _0x587d86[_0xdc52('0x23')]();};}function saveUpdates(_0x252c30,_0x374089){return function(_0x4a6218){if(_0x4a6218){return _0x4a6218[_0xdc52('0x24')](_0x252c30)[_0xdc52('0x25')](function(_0x4cd612){return _0x4cd612;});}return null;};}function removeEntity(_0x2a1cba,_0x42b4b0){return function(_0x4d4a7f){if(_0x4d4a7f){return _0x4d4a7f[_0xdc52('0x26')]()[_0xdc52('0x25')](function(){_0x2a1cba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x361b31,_0xb53047){return function(_0x2845b4){if(!_0x2845b4){_0x361b31[_0xdc52('0x27')](0x194);}return _0x2845b4;};}function handleError(_0x3ed705,_0x2f3025){_0x2f3025=_0x2f3025||0x1f4;return function(_0x5a4384){logger['error'](_0x5a4384[_0xdc52('0x28')]);if(_0x5a4384[_0xdc52('0x29')]){delete _0x5a4384[_0xdc52('0x29')];}_0x3ed705[_0xdc52('0x1b')](_0x2f3025)[_0xdc52('0x2a')](_0x5a4384);};}function getInteractionUsers(_0x4bdbde,_0xc3f074){return new BPromise(function(_0x1ec6b5,_0x5256fc){try{if(_0xc3f074[_0x4bdbde['id']]){_0x4bdbde[_0xdc52('0x2b')]=_[_0xdc52('0x2c')](_0xc3f074[_0x4bdbde['id']],function(_0x36b9f2){return{'id':_0x36b9f2['id'],'fullname':_0x36b9f2[_0xdc52('0x2d')]};});}}catch(_0x14a2f7){_0x5256fc(_0x14a2f7);}_0x1ec6b5(_0x4bdbde);});}function getInteractionTags(_0x2c3fa5,_0xa2829c){return new BPromise(function(_0x14580c,_0x44b465){try{if(_0x2c3fa5['TagIds']){_0x2c3fa5[_0xdc52('0x2e')]=[];_0x2c3fa5[_0xdc52('0x2f')][_0xdc52('0x30')](',')[_0xdc52('0x31')](function(_0x34733d){_0x2c3fa5['Tags'][_0xdc52('0x32')](_0xa2829c[_0x34733d]);});}delete _0x2c3fa5[_0xdc52('0x2f')];}catch(_0x1c570f){_0x44b465(_0x1c570f);}_0x14580c(_0x2c3fa5);});}function updateOpenchannelInteraction(_0x1bf4d5,_0x2b7aff,_0x568b45){return new BPromise(function(_0x3ed42d,_0x392ef3){return getInteractionUsers(_0x1bf4d5,_0x568b45)[_0xdc52('0x25')](function(_0x502c99){return getInteractionTags(_0x502c99,_0x2b7aff);})[_0xdc52('0x25')](function(_0x7370c1){return getStateInteraction(_0x7370c1);})[_0xdc52('0x25')](function(_0x2d758b){_0x3ed42d(_0x2d758b);})['catch'](function(_0xff0f85){_0x392ef3(_0xff0f85);});});}function getStateInteraction(_0x3950f2){return new BPromise(function(_0x2371cd){_0x3950f2[_0xdc52('0x33')]=0x0;_0x3950f2[_0xdc52('0x34')]=0x0;_0x3950f2[_0xdc52('0x35')]=0x0;_0x3950f2[_0xdc52('0x36')]=0x0;_0x3950f2[_0xdc52('0x37')]=0x0;if(!_0x3950f2['closed']&&!_0x3950f2[_0xdc52('0x38')]){_0x3950f2[_0xdc52('0x33')]+=0x1;}if(!_0x3950f2[_0xdc52('0x39')]&&_0x3950f2[_0xdc52('0x38')]){_0x3950f2[_0xdc52('0x34')]+=0x1;if(_0x3950f2[_0xdc52('0x33')]){_0x3950f2['waiting']-=0x1;}}if(_0x3950f2[_0xdc52('0x39')]&&_0x3950f2[_0xdc52('0x38')]){_0x3950f2[_0xdc52('0x35')]+=0x1;if(_0x3950f2[_0xdc52('0x34')]){_0x3950f2['talking']-=0x1;}}if(_0x3950f2[_0xdc52('0x39')]&&!_0x3950f2['UserId']){_0x3950f2[_0xdc52('0x36')]+=0x1;if(_0x3950f2[_0xdc52('0x33')]){_0x3950f2[_0xdc52('0x33')]-=0x1;}}_0x3950f2[_0xdc52('0x37')]+=0x1;_0x2371cd(_0x3950f2);});}exports[_0xdc52('0x3a')]=function(_0x51ec7d,_0x28639e){var _0x4de564={},_0x816ea8={},_0x389974={'count':0x0,'rows':[]};var _0x3f0644=_['map'](db[_0xdc52('0x3b')][_0xdc52('0x3c')],function(_0xbdc5aa){return{'name':_0xbdc5aa[_0xdc52('0x3d')],'type':_0xbdc5aa['type']['key']};});_0x816ea8['model']=_['map'](_0x3f0644,'name');_0x816ea8[_0xdc52('0x3e')]=_[_0xdc52('0x3f')](_0x51ec7d[_0xdc52('0x3e')]);_0x816ea8[_0xdc52('0x40')]=_[_0xdc52('0x41')](_0x816ea8[_0xdc52('0x42')],_0x816ea8[_0xdc52('0x3e')]);_0x4de564[_0xdc52('0x43')]=_[_0xdc52('0x41')](_0x816ea8[_0xdc52('0x42')],qs[_0xdc52('0x44')](_0x51ec7d[_0xdc52('0x3e')][_0xdc52('0x44')]));_0x4de564[_0xdc52('0x43')]=_0x4de564['attributes']['length']?_0x4de564['attributes']:_0x816ea8[_0xdc52('0x42')];if(!_0x51ec7d['query'][_0xdc52('0x45')]('nolimit')){_0x4de564[_0xdc52('0x20')]=qs[_0xdc52('0x20')](_0x51ec7d[_0xdc52('0x3e')]['limit']);_0x4de564['offset']=qs[_0xdc52('0x1d')](_0x51ec7d[_0xdc52('0x3e')]['offset']);}_0x4de564[_0xdc52('0x46')]=qs[_0xdc52('0x47')](_0x51ec7d[_0xdc52('0x3e')][_0xdc52('0x47')]);_0x4de564[_0xdc52('0x48')]=qs[_0xdc52('0x40')](_['pick'](_0x51ec7d['query'],_0x816ea8[_0xdc52('0x40')]),_0x3f0644);var _0x1f4e50=[];var _0x2c8585=squel[_0xdc52('0x49')]()[_0xdc52('0x4a')]('id')[_0xdc52('0x4a')]('name')[_0xdc52('0x4a')](_0xdc52('0x4b'))[_0xdc52('0x4c')](_0xdc52('0x4d'));var _0x88c82f=squel[_0xdc52('0x49')]()[_0xdc52('0x4a')](_0xdc52('0x4e'))[_0xdc52('0x4a')](_0xdc52('0x4f'))[_0xdc52('0x4a')](_0xdc52('0x50'))['from'](_0xdc52('0x51'),'ui')[_0xdc52('0x52')](_0xdc52('0x53'),'u',_0xdc52('0x54'));var _0x4b8d9a=squel[_0xdc52('0x49')]()[_0xdc52('0x4c')](_0xdc52('0x55'),'i')['left_join'](_0xdc52('0x56'),'c',_0xdc52('0x57'))['left_join'](_0xdc52('0x53'),'o',_0xdc52('0x58'))[_0xdc52('0x52')](_0xdc52('0x59'),'a',_0xdc52('0x5a'))['left_join']('openchannel_messages','me',_0xdc52('0x5b'))[_0xdc52('0x52')](_0xdc52('0x5c'),'it',_0xdc52('0x5d'))[_0xdc52('0x52')](_0xdc52('0x4d'),'t',_0xdc52('0x5e'));var _0x1018ed=squel['expr']();var _0x1c0dd6=[];var _0x463159=squel['expr']();var _0x1bce8d;if(_0x51ec7d[_0xdc52('0x3e')]['search']){_0x1bce8d=as[_0xdc52('0x5f')](_0x51ec7d[_0xdc52('0x3e')]['search']);var _0x6ed7fb=_0x1bce8d[_0xdc52('0x60')];for(var _0x462b37=0x0;_0x462b37<_0x1bce8d[_0xdc52('0x61')][_0xdc52('0x62')];_0x462b37++){var _0x2fc68d=_0x1bce8d['conditions'][_0x462b37];var _0x30d1aa='i';var _0x4143ae=_[_0xdc52('0x63')](_0x3f0644,[_0xdc52('0x29'),_0x2fc68d[_0xdc52('0x4a')]]);if(!_0x4143ae){switch(_0x2fc68d[_0xdc52('0x4a')]){case _0xdc52('0x64'):if(_0x2fc68d['value']==0x1){_0x4b8d9a[_0xdc52('0x65')]('`'+_0x2fc68d['field']+_0xdc52('0x66'));}else{_0x4b8d9a[_0xdc52('0x65')]('`'+_0x2fc68d[_0xdc52('0x4a')]+_0xdc52('0x67'));}break;case _0xdc52('0x68'):if(_0x2fc68d[_0xdc52('0x69')]===_0xdc52('0x6a')){if(_0x2fc68d[_0xdc52('0x6b')][_0xdc52('0x30')]('\x20')[_0xdc52('0x62')]>0x1){_0x1018ed[_0x6ed7fb](_0xdc52('0x6c'),qs[_0xdc52('0x6d')](_0x2fc68d[_0xdc52('0x6b')]),null);}else{var _0x47722f='%'+_0x2fc68d[_0xdc52('0x6b')]+'%';_0x1018ed[_0x6ed7fb](_0xdc52('0x6e'),_0x47722f,_0x47722f,_0x47722f);}}else{_0x4143ae=_[_0xdc52('0x63')](_0x3f0644,[_0xdc52('0x29'),_0xdc52('0x6f')]);_0x2fc68d['field']=_0xdc52('0x6f');_0x18637e=as[_0xdc52('0x70')](_0x30d1aa,_0x4143ae[_0xdc52('0x71')],_0x2fc68d);_0x1018ed[_0x6ed7fb](_0x18637e['text'],_0x18637e[_0xdc52('0x6b')][_0xdc52('0x72')],_0x18637e[_0xdc52('0x6b')][_0xdc52('0x1c')]);}break;case _0xdc52('0x73'):var _0x19915e=_0x2fc68d[_0xdc52('0x6b')][_0xdc52('0x30')](',')[_0xdc52('0x2c')](function(_0x4fd0c2){return Number(_0x4fd0c2);});_0x19915e[_0xdc52('0x31')](function(_0x58cf5b){_0x463159['or'](_0xdc52('0x74'),'%,'+_0x58cf5b+',%');});_0x1c0dd6=_[_0xdc52('0x75')](_0x1c0dd6,_0x19915e);break;case _0xdc52('0x76'):if(_0x2fc68d[_0xdc52('0x69')]===_0xdc52('0x6a')){_0x1018ed[_0x6ed7fb](_0xdc52('0x77'),'%'+_0x2fc68d[_0xdc52('0x6b')]+'%',null);}else{_0x4143ae=_['find'](_0x3f0644,[_0xdc52('0x29'),_0xdc52('0x38')]);_0x2fc68d[_0xdc52('0x4a')]=_0xdc52('0x38');_0x18637e=as[_0xdc52('0x70')](_0x30d1aa,_0x4143ae[_0xdc52('0x71')],_0x2fc68d);_0x1018ed[_0x6ed7fb](_0x18637e[_0xdc52('0x78')],_0x18637e[_0xdc52('0x6b')][_0xdc52('0x72')],_0x18637e['value'][_0xdc52('0x1c')]);}break;case _0xdc52('0x79'):_0x18637e=as[_0xdc52('0x70')]('me',null,_0x2fc68d);_0x1018ed[_0x6ed7fb](_0x18637e[_0xdc52('0x78')],_0x18637e['value'][_0xdc52('0x72')],_0x18637e[_0xdc52('0x6b')][_0xdc52('0x1c')]);break;}}else{var _0x18637e=as[_0xdc52('0x70')](_0x30d1aa,_0x4143ae[_0xdc52('0x71')],_0x2fc68d);_0x1018ed[_0x6ed7fb](_0x18637e[_0xdc52('0x78')],_0x18637e[_0xdc52('0x6b')][_0xdc52('0x72')],_0x18637e['value'][_0xdc52('0x1c')]);}}}else{var _0x55ba5b=_(_0x51ec7d[_0xdc52('0x3e')])[_0xdc52('0x3f')]()[_0xdc52('0x2c')](function(_0x139bc4){return _[_0xdc52('0x7a')](_0x3f0644,[_0xdc52('0x29'),_0x139bc4])?_0x139bc4:undefined;})['compact']()[_0xdc52('0x6b')]();if(!_[_0xdc52('0x7b')](_0x55ba5b)){_0x55ba5b['forEach'](function(_0x3b1f56){if(_0x3b1f56===_0xdc52('0x7c')){_0x4b8d9a['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0xdc52('0x7d')](_0x51ec7d[_0xdc52('0x3e')][_0x3b1f56]));}else if(_0x3b1f56==='createdAt'){var _0x35fd36=JSON[_0xdc52('0x7e')](_0x51ec7d[_0xdc52('0x3e')][_0x3b1f56])[_0xdc52('0x7f')];var _0x1d84eb=JSON[_0xdc52('0x7e')](_0x51ec7d[_0xdc52('0x3e')][_0x3b1f56])[_0xdc52('0x80')];_0x4b8d9a[_0xdc52('0x48')](_0xdc52('0x81'),_0x35fd36,_0x1d84eb);}else{if(_0x51ec7d['query'][_0x3b1f56]===_0xdc52('0x82')){_0x4b8d9a[_0xdc52('0x48')]('i.'+_0x3b1f56+_0xdc52('0x83'));}else{_0x4b8d9a[_0xdc52('0x48')]('i.'+_0x3b1f56+_0xdc52('0x84'),_0x51ec7d[_0xdc52('0x3e')][_0x3b1f56]);}}});}if(_0x51ec7d[_0xdc52('0x3e')][_0xdc52('0x85')]){if(_0x51ec7d[_0xdc52('0x3e')][_0xdc52('0x85')]==0x1){_0x4b8d9a['having']('`unreadMessages`\x20=\x200');}else{_0x4b8d9a[_0xdc52('0x65')]('`unreadMessages`\x20>\x200');}}if(_0x51ec7d[_0xdc52('0x3e')][_0xdc52('0x86')]){_0x1c0dd6=_[_0xdc52('0x87')](_0x51ec7d[_0xdc52('0x3e')][_0xdc52('0x86')])?_0x51ec7d[_0xdc52('0x3e')][_0xdc52('0x86')]:new Array(_0x51ec7d[_0xdc52('0x3e')][_0xdc52('0x86')]);_0x1c0dd6['forEach'](function(_0x4a9e5f){_0x463159['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4a9e5f+',%');});}if(_0x51ec7d[_0xdc52('0x3e')][_0xdc52('0x88')]){var _0x37336b=_0x51ec7d[_0xdc52('0x3e')][_0xdc52('0x88')][_0xdc52('0x89')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xdc52('0x8a')](_0x37336b)){_0x1018ed['or']('i.id\x20LIKE\x20?',_0x37336b+'%');}else{_0x1018ed['or'](_0xdc52('0x8b'),qs[_0xdc52('0x6d')](_0x37336b))['or'](_0xdc52('0x8c'),_0x37336b+'%')['or'](_0xdc52('0x8d'),_0x37336b+'%');}}}_0x4b8d9a[_0xdc52('0x48')](_0x1018ed);_0x4b8d9a['group'](_0xdc52('0x8e'));var _0x41c9c3={'type':db[_0xdc52('0x8f')][_0xdc52('0x90')][_0xdc52('0x91')],'raw':!![]};var _0x792cd7=_0x4b8d9a['clone']();_0x792cd7[_0xdc52('0x4a')](_0xdc52('0x8e'));_0x792cd7[_0xdc52('0x4a')](_0xdc52('0x92'),_0xdc52('0x64'));if(_0x4de564['order']){_0x4de564['order'][_0xdc52('0x31')](function(_0x15b658){var _0x373d40=_0x15b658[0x0]===_0xdc52('0x93')?_0x15b658[0x0]:'i.'+_0x15b658[0x0];_0x4b8d9a[_0xdc52('0x46')](_0x373d40,_0x15b658[0x1]===_0xdc52('0x94')?![]:!![]);});}if(!_['isEmpty'](_0x1c0dd6)){_0x4b8d9a[_0xdc52('0x65')](_0x463159);_0x792cd7[_0xdc52('0x48')]('t.id\x20IN\x20?',_0x1c0dd6);}BPromise[_0xdc52('0x95')]()['then'](function(){if(!_0x1bce8d){if(_0x51ec7d[_0xdc52('0x3e')][_0xdc52('0x7c')])return;_0x792cd7[_0xdc52('0x48')](_0xdc52('0x96'));_0x4b8d9a['where'](_0xdc52('0x96'));return;}if(_0x51ec7d[_0xdc52('0x97')]['role']!==_0xdc52('0x98'))return;return _0x51ec7d[_0xdc52('0x97')][_0xdc52('0x99')]({'attributes':['id'],'raw':!![]})[_0xdc52('0x25')](function(_0x58a3ea){if(_['isEmpty'](_0x58a3ea)){_0x792cd7[_0xdc52('0x48')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x4b8d9a['where'](_0xdc52('0x9a'));}else{_0x792cd7[_0xdc52('0x48')](_0xdc52('0x9b'),_['map'](_0x58a3ea,'id'));_0x4b8d9a['where'](_0xdc52('0x9b'),_['map'](_0x58a3ea,'id'));}});})['then'](function(){if(_0x51ec7d['user'][_0xdc52('0x9c')]==='agent'&&!_0x1bce8d&&!_0x51ec7d[_0xdc52('0x3e')]['OpenchannelAccountId'])return[];return db[_0xdc52('0x9d')][_0xdc52('0x3e')](_0x792cd7[_0xdc52('0x9e')](),_0x41c9c3);})[_0xdc52('0x25')](function(_0x252e28){_0x389974['count']=_0x252e28[_0xdc52('0x62')];if(_0x389974[_0xdc52('0x1f')]===0x0)return[];return db[_0xdc52('0x9d')][_0xdc52('0x3e')](_0x2c8585[_0xdc52('0x9e')](),_0x41c9c3)[_0xdc52('0x25')](function(_0x7032c9){_0x1f4e50=_[_0xdc52('0x9f')](_0x7032c9,'id');_0x41c9c3=_['merge'](_0x41c9c3,{'model':db[_0xdc52('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x51ec7d[_0xdc52('0x3e')][_0xdc52('0x44')]){_0x4de564[_0xdc52('0x43')][_0xdc52('0x31')](function(_0x389252){_0x4b8d9a[_0xdc52('0x4a')]('i.'+_0x389252);});}else{_0x4b8d9a['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xdc52('0x64'));_0x4b8d9a[_0xdc52('0x4a')](_0xdc52('0xa0'),_0xdc52('0xa1'));_0x4b8d9a['field']('a.mandatoryDisposition',_0xdc52('0xa2'));_0x4b8d9a[_0xdc52('0x4a')]('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',_0xdc52('0x93'));_0x4b8d9a['field']('i.*');_0x4b8d9a['field']('c.firstName',_0xdc52('0xa3'));_0x4b8d9a[_0xdc52('0x4a')](_0xdc52('0xa4'),_0xdc52('0xa5'));_0x4b8d9a[_0xdc52('0x4a')](_0xdc52('0xa6'),_0xdc52('0xa7'));_0x4b8d9a['field'](_0xdc52('0xa8'),_0xdc52('0xa9'));_0x4b8d9a['field'](_0xdc52('0xaa'),_0xdc52('0xab'));_0x4b8d9a[_0xdc52('0x4a')](_0xdc52('0xac'),_0xdc52('0xad'));_0x4b8d9a[_0xdc52('0x4a')](_0xdc52('0xae'),'Owner.fullname');_0x4b8d9a[_0xdc52('0x4a')]('o.internal','Owner.internal');_0x4b8d9a[_0xdc52('0x4a')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x4de564['limit'])_0x4b8d9a[_0xdc52('0x20')](_0x4de564[_0xdc52('0x20')]);if(_0x4de564[_0xdc52('0x1d')])_0x4b8d9a[_0xdc52('0x1d')](_0x4de564['offset']);return db['sequelize']['query'](_0x4b8d9a[_0xdc52('0x9e')](),_0x41c9c3);})[_0xdc52('0x25')](function(_0x1c3a3b){if(_0x1c3a3b['length']>0x0)_0x88c82f[_0xdc52('0x48')](_0xdc52('0xaf'),_[_0xdc52('0x2c')](_0x1c3a3b,'id'));return db['sequelize'][_0xdc52('0x3e')](_0x88c82f[_0xdc52('0x9e')](),_0x41c9c3)[_0xdc52('0x25')](function(_0x40b442){var _0x18832c=_[_0xdc52('0xb0')](_0x40b442,_0xdc52('0xb1'));var _0x483a32=[];_0x1c3a3b[_0xdc52('0x31')](function(_0xc6592f){_0x483a32[_0xdc52('0x32')](updateOpenchannelInteraction(_0xc6592f,_0x1f4e50,_0x18832c));});return BPromise['all'](_0x483a32);});});})[_0xdc52('0x25')](function(_0x3eb302){_0x389974[_0xdc52('0xb2')]=_0x3eb302;return _0x389974;})[_0xdc52('0x25')](respondWithFilteredResult(_0x28639e,_0x4de564))[_0xdc52('0xb3')](handleError(_0x28639e,null));};exports[_0xdc52('0xb4')]=function(_0x6cff25,_0xc441c5){var _0x4ea7cf={};if(_0x6cff25[_0xdc52('0x3e')][_0xdc52('0x71')]&&_0x6cff25[_0xdc52('0x3e')][_0xdc52('0x71')]===_0xdc52('0x4c')){_0x4ea7cf[_0xdc52('0x4c')]=_0x6cff25['params']['id'];}else{_0x4ea7cf['id']=_0x6cff25[_0xdc52('0xb5')]['id'];}var _0x599f4e={'raw':![],'where':_0x4ea7cf},_0x27e4b7={};_0x27e4b7['model']=_[_0xdc52('0x3f')](db[_0xdc52('0x3b')][_0xdc52('0x3c')]);_0x27e4b7['query']=_[_0xdc52('0x3f')](_0x6cff25[_0xdc52('0x3e')]);_0x27e4b7['filters']=_[_0xdc52('0x41')](_0x27e4b7[_0xdc52('0x42')],_0x27e4b7[_0xdc52('0x3e')]);_0x599f4e['attributes']=_[_0xdc52('0x41')](_0x27e4b7[_0xdc52('0x42')],qs[_0xdc52('0x44')](_0x6cff25['query']['fields']));_0x599f4e[_0xdc52('0x43')]=_0x599f4e[_0xdc52('0x43')][_0xdc52('0x62')]?_0x599f4e[_0xdc52('0x43')]:_0x27e4b7['model'];if(_0x6cff25[_0xdc52('0x3e')]['includeAll']){_0x599f4e[_0xdc52('0xb6')]=[{'all':!![]}];}_0x599f4e=_[_0xdc52('0xb7')]({},_0x599f4e,_0x6cff25[_0xdc52('0xb8')]);return db['OpenchannelInteraction'][_0xdc52('0x63')](_0x599f4e)[_0xdc52('0x25')](handleEntityNotFound(_0xc441c5,null))[_0xdc52('0x25')](respondWithResult(_0xc441c5,null))[_0xdc52('0xb3')](handleError(_0xc441c5,null));};exports[_0xdc52('0xb9')]=function(_0x43a1ba,_0x36b96b){return db[_0xdc52('0x3b')][_0xdc52('0xb9')](_0x43a1ba['body'],{})[_0xdc52('0x25')](respondWithResult(_0x36b96b,0xc9))['catch'](handleError(_0x36b96b,null));};exports[_0xdc52('0x24')]=function(_0x3a4bd0,_0x2b2199){if(_0x3a4bd0[_0xdc52('0x79')]['id']){delete _0x3a4bd0['body']['id'];}return db['OpenchannelInteraction'][_0xdc52('0x63')]({'where':{'id':_0x3a4bd0[_0xdc52('0xb5')]['id']}})['then'](handleEntityNotFound(_0x2b2199,null))[_0xdc52('0x25')](saveUpdates(_0x3a4bd0['body'],null))[_0xdc52('0x25')](respondWithResult(_0x2b2199,null))[_0xdc52('0xb3')](handleError(_0x2b2199,null));};exports[_0xdc52('0x26')]=function(_0x474527,_0x4d512c){return db['OpenchannelInteraction'][_0xdc52('0x63')]({'where':{'id':_0x474527[_0xdc52('0xb5')]['id']}})[_0xdc52('0x25')](handleEntityNotFound(_0x4d512c,null))[_0xdc52('0x25')](removeEntity(_0x4d512c,null))['catch'](handleError(_0x4d512c,null));};exports['describe']=function(_0x37a975,_0x4a3984){return db[_0xdc52('0x3b')][_0xdc52('0xba')]()[_0xdc52('0x25')](respondWithResult(_0x4a3984,null))['catch'](handleError(_0x4a3984,null));};exports[_0xdc52('0xbb')]=function(_0x5bfd6e,_0x616703,_0x24634b){return db['OpenchannelMessage'][_0xdc52('0x63')]({'where':{'id':_0x5bfd6e['params']['id']}})[_0xdc52('0x25')](handleEntityNotFound(_0x616703,null))['then'](function(_0x5b4a17){if(_0x5b4a17){return _0x5b4a17['addMessage'](_0x5bfd6e['body'][_0xdc52('0xbc')],_[_0xdc52('0xbd')](_0x5bfd6e['body'],[_0xdc52('0xbc'),'id'])||{});}})[_0xdc52('0x25')](respondWithResult(_0x616703,null))[_0xdc52('0xb3')](handleError(_0x616703,null));};exports[_0xdc52('0xbe')]=function(_0x31dac7,_0x14e580,_0x3ca327){var _0x217fb0={'raw':![],'where':{}};var _0x46f9a0={};var _0x59b51e={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xdc52('0xbf')]({'where':{'id':_0x31dac7[_0xdc52('0xb5')]['id']}})['then'](handleEntityNotFound(_0x14e580,null))[_0xdc52('0x25')](function(_0x17ed01){if(_0x17ed01){_0x46f9a0[_0xdc52('0x42')]=_[_0xdc52('0x3f')](db[_0xdc52('0xc0')][_0xdc52('0x3c')]);_0x46f9a0[_0xdc52('0x3e')]=_['keys'](_0x31dac7[_0xdc52('0x3e')]);_0x46f9a0[_0xdc52('0x40')]=_[_0xdc52('0x41')](_0x46f9a0['model'],_0x46f9a0[_0xdc52('0x3e')]);_0x217fb0['attributes']=_[_0xdc52('0x41')](_0x46f9a0[_0xdc52('0x42')],qs[_0xdc52('0x44')](_0x31dac7['query']['fields']));_0x217fb0['attributes']=_0x217fb0[_0xdc52('0x43')][_0xdc52('0x62')]?_0x217fb0[_0xdc52('0x43')]:_0x46f9a0['model'];if(!_0x31dac7[_0xdc52('0x3e')][_0xdc52('0x45')](_0xdc52('0xc1'))){_0x217fb0[_0xdc52('0x20')]=qs[_0xdc52('0x20')](_0x31dac7[_0xdc52('0x3e')][_0xdc52('0x20')]);_0x217fb0[_0xdc52('0x1d')]=qs[_0xdc52('0x1d')](_0x31dac7[_0xdc52('0x3e')][_0xdc52('0x1d')]);}_0x217fb0[_0xdc52('0x46')]=qs[_0xdc52('0x47')](_0x31dac7[_0xdc52('0x3e')][_0xdc52('0x47')]);_0x217fb0[_0xdc52('0x48')]=qs[_0xdc52('0x40')](_[_0xdc52('0xc2')](_0x31dac7[_0xdc52('0x3e')],_0x46f9a0[_0xdc52('0x40')]));_0x217fb0[_0xdc52('0x48')][_0xdc52('0xb1')]=_0x17ed01['id'];if(_0x31dac7[_0xdc52('0x3e')]['filter']){_0x217fb0[_0xdc52('0x48')]=_[_0xdc52('0xb7')](_0x217fb0[_0xdc52('0x48')],{'$or':_[_0xdc52('0x2c')](_0x217fb0['attributes'],function(_0x27a610){var _0x2174cd={};_0x2174cd[_0x27a610]={'$like':'%'+_0x31dac7[_0xdc52('0x3e')][_0xdc52('0x88')]+'%'};return _0x2174cd;})});}if(_0x31dac7[_0xdc52('0x3e')][_0xdc52('0x7f')]){var _0xbfd6ab=_0x31dac7[_0xdc52('0x3e')][_0xdc52('0x7f')][_0xdc52('0x30')](',');var _0xc03f4a={};_0xc03f4a[_0xbfd6ab[0x0]]={'$gte':moment(_0xbfd6ab[0x1])[_0xdc52('0xc3')](_0xdc52('0xc4'))};_0x217fb0[_0xdc52('0x48')]=_['merge'](_0x217fb0[_0xdc52('0x48')],_0xc03f4a);}_0x217fb0=_[_0xdc52('0xb7')]({},_0x217fb0,_0x31dac7[_0xdc52('0xb8')]);return db[_0xdc52('0xc0')][_0xdc52('0x1f')]({'where':_0x217fb0[_0xdc52('0x48')]})[_0xdc52('0x25')](function(_0x59b4ee){_0x59b51e[_0xdc52('0x1f')]=_0x59b4ee;if(_0x31dac7[_0xdc52('0x3e')]['includeAll']){_0x217fb0['include']=[{'all':!![]}];}return db[_0xdc52('0xc0')][_0xdc52('0xc5')](_0x217fb0);})[_0xdc52('0x25')](function(_0x3fcc2b){_0x59b51e['rows']=_0x3fcc2b;return _0x59b51e;});}})[_0xdc52('0x25')](respondWithFilteredResult(_0x14e580,_0x217fb0))['catch'](handleError(_0x14e580,null));};exports[_0xdc52('0xc6')]=function(_0x459128,_0x166ab2,_0x5db9ed){return db[_0xdc52('0x3b')][_0xdc52('0x63')]({'where':{'id':_0x459128[_0xdc52('0xb5')]['id']}})[_0xdc52('0x25')](handleEntityNotFound(_0x166ab2,null))[_0xdc52('0x25')](function(_0x5c2f3a){if(_0x5c2f3a){return _0x5c2f3a[_0xdc52('0xc7')](_0x459128['body'][_0xdc52('0xbc')],_[_0xdc52('0xbd')](_0x459128[_0xdc52('0x79')],['ids','id'])||{})[_0xdc52('0xc8')](function(){return db[_0xdc52('0x73')][_0xdc52('0xc5')]({'attributes':['id','name',_0xdc52('0x4b')],'where':{'id':_0x459128[_0xdc52('0x79')][_0xdc52('0xbc')]}});})['then'](function(_0x24f95e){socket[_0xdc52('0xc9')](_0xdc52('0xca'),{'id':Number(_0x459128[_0xdc52('0xb5')]['id']),'tags':_0x24f95e||[]});return{'id':Number(_0x459128[_0xdc52('0xb5')]['id']),'tags':_0x24f95e||[]};});}})['then'](respondWithResult(_0x166ab2,null))[_0xdc52('0xb3')](handleError(_0x166ab2,null));};exports[_0xdc52('0xcb')]=function(_0x42772c,_0x21a3f8,_0x552f87){return db[_0xdc52('0x3b')]['find']({'where':{'id':_0x42772c[_0xdc52('0xb5')]['id']}})[_0xdc52('0x25')](handleEntityNotFound(_0x21a3f8,null))[_0xdc52('0x25')](function(_0x260aa2){if(_0x260aa2){return _0x260aa2[_0xdc52('0xcb')](_0x42772c[_0xdc52('0x3e')]['ids']);}})[_0xdc52('0x25')](respondWithStatusCode(_0x21a3f8,null))['catch'](handleError(_0x21a3f8,null));};exports['download']=function(_0x5b19df,_0x595016){var _0x26be8e=moment()[_0xdc52('0xcc')]()[_0xdc52('0x9e')]();var _0x303667=path[_0xdc52('0xcd')](config['root'],'server',_0xdc52('0xce'),_0xdc52('0xcf'));var _0x2cc2d2=path[_0xdc52('0xcd')](config[_0xdc52('0xd0')],_0xdc52('0xd1'),_0xdc52('0xce'),_0xdc52('0xd2'));var _0x206daf=path['join'](_0x303667,_0x26be8e);var _0x442657=util['format'](_0xdc52('0xd3'),_0x5b19df[_0xdc52('0xb5')]['id'],_0x26be8e);var _0x200e46=path['join'](_0x303667,_0x442657);var _0x36a92e=[];_0x36a92e[_0xdc52('0x32')]({'model':db[_0xdc52('0x76')],'as':_0xdc52('0x76'),'attributes':['id',_0xdc52('0x2d')],'raw':!![]});_0x36a92e[_0xdc52('0x32')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xdc52('0xd4'),_0xdc52('0xd5')],'raw':!![]});if(_0x5b19df['query'][_0xdc52('0xd2')]){_0x36a92e[_0xdc52('0x32')]({'model':db['Attachment'],'as':_0xdc52('0xd6'),'raw':!![]});}var _0x191094=[{'model':db[_0xdc52('0xc0')],'as':_0xdc52('0xd7'),'attributes':['id',_0xdc52('0x79'),_0xdc52('0xd8'),_0xdc52('0xd9'),'secret',_0xdc52('0x85')],'include':_0x36a92e}];_0x191094[_0xdc52('0x32')]({'model':db[_0xdc52('0xda')],'as':_0xdc52('0xdb'),'attributes':['id',_0xdc52('0x29')]});_0x191094['push']({'model':db[_0xdc52('0x76')],'as':_0xdc52('0xdc'),'attributes':['id',_0xdc52('0x2d')]});return db[_0xdc52('0x3b')][_0xdc52('0x63')]({'where':{'id':_0x5b19df[_0xdc52('0xb5')]['id']},'include':_0x191094})[_0xdc52('0x25')](handleEntityNotFound(_0x595016,null))[_0xdc52('0x25')](function(_0x2a622a){if(_0x2a622a){var _0x31b5f5=_0x2a622a[_0xdc52('0xdd')]({'plain':!![]});fs[_0xdc52('0xde')](_0x206daf);var _0x1c050a={'channel':_0xdc52('0xdf'),'account':_0x31b5f5[_0xdc52('0xdb')][_0xdc52('0x29')],'agent':_0x31b5f5['Owner']?_0x31b5f5[_0xdc52('0xdc')][_0xdc52('0x2d')]:'N.A.','createdAt':moment(_0x31b5f5['createdAt'])[_0xdc52('0xc3')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdc52('0x9e')](),'closedAt':_0x31b5f5[_0xdc52('0x39')]?moment(_0x31b5f5[_0xdc52('0xe0')])[_0xdc52('0xc3')](_0xdc52('0xc4'))[_0xdc52('0x9e')]():'','disposition':_0x31b5f5[_0xdc52('0xe1')],'visibility':_0x31b5f5[_0xdc52('0xe2')]?'Public':_0xdc52('0xe3'),'messages':_(_0x31b5f5['Messages'])[_0xdc52('0x88')]({'secret':![]})['map'](function(_0x31db23){if(_0x31db23['Attachment']){var _0x335615=path['join'](_0x2cc2d2,_0x31db23['Attachment'][_0xdc52('0xe4')]);if(fs[_0xdc52('0xe5')](_0x335615)){fs[_0xdc52('0xe6')](_0x335615)[_0xdc52('0xe7')](fs[_0xdc52('0xe8')](path['join'](_0x206daf,_0x31db23[_0xdc52('0xd6')]['basename'])));}}return{'date':moment(_0x31db23[_0xdc52('0xd8')])[_0xdc52('0xc3')](_0xdc52('0xc4'))['toString'](),'sender':_0x31db23[_0xdc52('0xd9')]===_0xdc52('0xe9')?_0x31db23[_0xdc52('0x76')]?_0x31db23[_0xdc52('0x76')][_0xdc52('0x2d')]:_0xdc52('0xea'):_0x31db23[_0xdc52('0x68')][_0xdc52('0xd4')]+(_0x31db23[_0xdc52('0x68')][_0xdc52('0xd5')]?'\x20'+_0x31db23['Contact'][_0xdc52('0xd5')]:''),'body':_0x31db23['Attachment']?_0x31db23['Attachment']['basename']:_0x31db23[_0xdc52('0x79')],'direction':_0x31db23[_0xdc52('0xd9')]===_0xdc52('0xe9')?'A':'C','secret':_0x31db23[_0xdc52('0xeb')],'read':_0x31db23[_0xdc52('0x85')],'attachment':_0x31db23[_0xdc52('0xd6')]};})['value']()};return ejs[_0xdc52('0xec')](path[_0xdc52('0xcd')](config['root'],_0xdc52('0xd1'),_0xdc52('0xed'),_0xdc52('0xee')),{'interaction':_0x1c050a})[_0xdc52('0x25')](function(_0x369ad7){var _0x1c1097=path[_0xdc52('0xcd')](_0x206daf,'transcript-'+_0x31b5f5['id']+'-'+_0x26be8e+_0xdc52('0xef'));var _0x1cae65={'path':_0x1c1097,'channel':_0xdc52('0xdf'),'interactionId':_0x31b5f5['id']};return pdf[_0xdc52('0xf0')](_0x369ad7,_0x1cae65);})[_0xdc52('0x25')](function(){return new BPromise(function(_0x3597c5,_0x4964bf){zipdir(_0x206daf,{'saveTo':_0x200e46},function(_0x1a1ad5,_0x302f5c){if(_0x1a1ad5)return _0x4964bf(_0x1a1ad5);return _0x3597c5(_0x302f5c);});})[_0xdc52('0x25')](function(){return new BPromise(function(_0x21cb78,_0x5c9f6a){rimraf(_0x206daf,function(_0x5820b4){if(_0x5820b4)_0x5c9f6a(_0x5820b4);return _0x21cb78();});});})[_0xdc52('0x25')](function(){return _0x595016[_0xdc52('0xf1')](_0x200e46,_0x442657,function(_0x477b9b){if(_0x477b9b){console[_0xdc52('0xf2')](_0xdc52('0xf3'),_0x477b9b);}else{fs[_0xdc52('0xf4')](_0x200e46);}});});});}else{return _0x595016[_0xdc52('0x27')](0xc8);}})[_0xdc52('0xb3')](handleError(_0x595016,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 2668da6..90aa9d1 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 _0x1745=['then','setDataValue','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove','map','findAll'];(function(_0xdb9d08,_0xcdd19b){var _0x2a2a2e=function(_0x20cbaf){while(--_0x20cbaf){_0xdb9d08['push'](_0xdb9d08['shift']());}};_0x2a2a2e(++_0xcdd19b);}(_0x1745,0x1e7));var _0x5174=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x1745[_0xbca1b1];return _0x4e1686;};'use strict';var EventEmitter=require(_0x5174('0x0'));var OpenchannelInteraction=require(_0x5174('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x5174('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x5174('0x2')](0x0);var events={'afterCreate':_0x5174('0x3'),'afterUpdate':_0x5174('0x4'),'afterDestroy':_0x5174('0x5')};function emitEvent(_0x2ed209){return function(_0x12836a,_0x15d65e,_0x6d3e40){_0x12836a['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x417033){_0x12836a['setDataValue']('Users',_0x417033[_0x5174('0x6')](function(_0x4670c4){return{'id':_0x4670c4['id']};}));return OpenchannelMessage[_0x5174('0x7')]({'where':{'OpenchannelInteractionId':_0x12836a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5174('0x8')](function(_0x321ae5){_0x12836a[_0x5174('0x9')](_0x5174('0xa'),_0x321ae5['length']);OpenchannelInteractionEvents[_0x5174('0xb')](_0x2ed209+':'+_0x12836a['id'],_0x12836a);OpenchannelInteractionEvents[_0x5174('0xb')](_0x2ed209,_0x12836a);_0x6d3e40(null);})[_0x5174('0xc')](_0x6d3e40(null));};}for(var e in events){if(events[_0x5174('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x5174('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x2d98=['update','remove','then','setDataValue','unreadMessages','length','emit','catch','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners'];(function(_0x48c2ae,_0x4cea90){var _0x8f7531=function(_0x126458){while(--_0x126458){_0x48c2ae['push'](_0x48c2ae['shift']());}};_0x8f7531(++_0x4cea90);}(_0x2d98,0x14b));var _0x82d9=function(_0x12d041,_0x4a10fb){_0x12d041=_0x12d041-0x0;var _0x19acdf=_0x2d98[_0x12d041];return _0x19acdf;};'use strict';var EventEmitter=require(_0x82d9('0x0'));var OpenchannelInteraction=require(_0x82d9('0x1'))['db'][_0x82d9('0x2')];var OpenchannelMessage=require(_0x82d9('0x1'))['db'][_0x82d9('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x82d9('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x82d9('0x5'),'afterDestroy':_0x82d9('0x6')};function emitEvent(_0x3e208d){return function(_0x3ec117,_0x7163e2,_0x340208){_0x3ec117['getUsers']({'attributes':['id'],'raw':!![]})[_0x82d9('0x7')](function(_0x2175d4){_0x3ec117[_0x82d9('0x8')]('Users',_0x2175d4['map'](function(_0x1f13e0){return{'id':_0x1f13e0['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x3ec117['id'],'direction':'in','read':![]},'raw':!![]});})[_0x82d9('0x7')](function(_0x5a0ff3){_0x3ec117[_0x82d9('0x8')](_0x82d9('0x9'),_0x5a0ff3[_0x82d9('0xa')]);OpenchannelInteractionEvents[_0x82d9('0xb')](_0x3e208d+':'+_0x3ec117['id'],_0x3ec117);OpenchannelInteractionEvents[_0x82d9('0xb')](_0x3e208d,_0x3ec117);_0x340208(null);})[_0x82d9('0xc')](_0x340208(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x82d9('0xd')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 722a642..3970575 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 _0xc2f7=['api','moment','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc2f7,0x10e));var _0x7c2f=function(_0x286fd6,_0x429045){_0x286fd6=_0x286fd6-0x0;var _0xf11b18=_0xc2f7[_0x286fd6];return _0xf11b18;};'use strict';var _=require(_0x7c2f('0x0'));var util=require('util');var logger=require(_0x7c2f('0x1'))(_0x7c2f('0x2'));var moment=require(_0x7c2f('0x3'));var BPromise=require(_0x7c2f('0x4'));var rp=require(_0x7c2f('0x5'));var fs=require('fs');var path=require(_0x7c2f('0x6'));var rimraf=require('rimraf');var config=require(_0x7c2f('0x7'));var attributes=require(_0x7c2f('0x8'));module['exports']=function(_0x2f8d2a,_0x335f21){return _0x2f8d2a[_0x7c2f('0x9')](_0x7c2f('0xa'),attributes,{'tableName':_0x7c2f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7c2f('0xc'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x535af8,_0x1f5631,_0x364364){if(_0x535af8[_0x7c2f('0xd')](_0x7c2f('0xe'))){_0x535af8['closedAt']=moment()['format'](_0x7c2f('0xf'));}_0x364364(null,_0x535af8);}}});}; \ No newline at end of file +var _0x9b1a=['closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed'];(function(_0x492cf6,_0x48ddd3){var _0x5de5b7=function(_0x2965a2){while(--_0x2965a2){_0x492cf6['push'](_0x492cf6['shift']());}};_0x5de5b7(++_0x48ddd3);}(_0x9b1a,0x66));var _0xa9b1=function(_0x26b622,_0x237e9e){_0x26b622=_0x26b622-0x0;var _0x58a028=_0x9b1a[_0x26b622];return _0x58a028;};'use strict';var _=require(_0xa9b1('0x0'));var util=require(_0xa9b1('0x1'));var logger=require(_0xa9b1('0x2'))(_0xa9b1('0x3'));var moment=require(_0xa9b1('0x4'));var BPromise=require(_0xa9b1('0x5'));var rp=require(_0xa9b1('0x6'));var fs=require('fs');var path=require(_0xa9b1('0x7'));var rimraf=require(_0xa9b1('0x8'));var config=require(_0xa9b1('0x9'));var attributes=require(_0xa9b1('0xa'));module[_0xa9b1('0xb')]=function(_0x3361af,_0x2f6a41){return _0x3361af[_0xa9b1('0xc')](_0xa9b1('0xd'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa9b1('0xe'),'collate':_0xa9b1('0xf'),'hooks':{'beforeUpdate':function(_0xf082a8,_0xf5540b,_0x40c565){if(_0xf082a8[_0xa9b1('0x10')](_0xa9b1('0x11'))){_0xf082a8[_0xa9b1('0x12')]=moment()[_0xa9b1('0x13')]('YYYY-MM-DD\x20HH:mm:ss');}_0x40c565(null,_0xf082a8);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index d7946fd..956a4a8 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 _0xd193=['spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','limit','AddTagsToOpenchannelInteraction','find','addTags','ids','omit'];(function(_0x353730,_0x504fdf){var _0x901b87=function(_0x3adf24){while(--_0x3adf24){_0x353730['push'](_0x353730['shift']());}};_0x901b87(++_0x504fdf);}(_0xd193,0x80));var _0x3d19=function(_0x5576b1,_0x44459b){_0x5576b1=_0x5576b1-0x0;var _0x2475ef=_0xd193[_0x5576b1];return _0x2475ef;};'use strict';var _=require('lodash');var util=require(_0x3d19('0x0'));var moment=require(_0x3d19('0x1'));var BPromise=require(_0x3d19('0x2'));var rs=require(_0x3d19('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d19('0x4'))['db'];var utils=require(_0x3d19('0x5'));var logger=require('../../config/logger')(_0x3d19('0x6'));var config=require(_0x3d19('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3d19('0x8')][_0x3d19('0x9')]({'port':0x232a});config['redis']=_[_0x3d19('0xa')](config[_0x3d19('0xb')],{'host':_0x3d19('0xc'),'port':0x18eb});var socket=require(_0x3d19('0xd'))(new Redis(config[_0x3d19('0xb')]));require(_0x3d19('0xe'))[_0x3d19('0xf')](socket);function respondWithRpcPromise(_0x490bdb,_0xc8e9ce,_0x3c5916){return new BPromise(function(_0x3f02e3,_0x5b388d){return client[_0x3d19('0x10')](_0x490bdb,_0x3c5916)[_0x3d19('0x11')](function(_0x29a5de){logger[_0x3d19('0x12')](_0x3d19('0x13'),_0xc8e9ce,_0x3d19('0x14'));logger[_0x3d19('0x15')](_0x3d19('0x16'),_0xc8e9ce,'request\x20sent',JSON[_0x3d19('0x17')](_0x29a5de));if(_0x29a5de[_0x3d19('0x18')]){if(_0x29a5de[_0x3d19('0x18')]['code']===0x1f4){logger[_0x3d19('0x18')](_0x3d19('0x13'),_0xc8e9ce,_0x29a5de[_0x3d19('0x18')][_0x3d19('0x19')]);return _0x5b388d(_0x29a5de[_0x3d19('0x18')]['message']);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0xc8e9ce,_0x29a5de[_0x3d19('0x18')]['message']);return _0x3f02e3(_0x29a5de[_0x3d19('0x18')][_0x3d19('0x19')]);}else{logger['info'](_0x3d19('0x13'),_0xc8e9ce,_0x3d19('0x14'));_0x3f02e3(_0x29a5de['result']['message']);}})[_0x3d19('0x1a')](function(_0x2d1c1c){logger[_0x3d19('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0xc8e9ce,_0x2d1c1c);_0x5b388d(_0x2d1c1c);});});}exports[_0x3d19('0x1b')]=function(_0x297a1a){var _0x1b6069=this;return new Promise(function(_0x1b2b0c,_0x18be8e){return db[_0x3d19('0x1c')][_0x3d19('0x1d')](_0x297a1a[_0x3d19('0x1e')],{'raw':_0x297a1a[_0x3d19('0x1f')]?_0x297a1a[_0x3d19('0x1f')][_0x3d19('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x297a1a[_0x3d19('0x1f')]?_0x297a1a[_0x3d19('0x1f')][_0x3d19('0x21')]||null:null,'attributes':_0x297a1a[_0x3d19('0x1f')]?_0x297a1a[_0x3d19('0x1f')]['attributes']||null:null,'limit':_0x297a1a[_0x3d19('0x1f')]?_0x297a1a[_0x3d19('0x1f')][_0x3d19('0x22')]||null:null})[_0x3d19('0x11')](function(_0x432b2c){logger['info'](_0x3d19('0x1b'),_0x297a1a);logger[_0x3d19('0x15')](_0x3d19('0x1b'),_0x297a1a,JSON[_0x3d19('0x17')](_0x432b2c));_0x1b2b0c(_0x432b2c);})[_0x3d19('0x1a')](function(_0x25390d){logger['error'](_0x3d19('0x1b'),_0x25390d[_0x3d19('0x19')],_0x297a1a);_0x18be8e(_0x1b6069[_0x3d19('0x18')](0x1f4,_0x25390d[_0x3d19('0x19')]));});});};exports[_0x3d19('0x23')]=function(_0x5cf616){return new Promise(function(_0x1d1e98,_0x4c757a){return db[_0x3d19('0x1c')][_0x3d19('0x24')]({'where':_0x5cf616[_0x3d19('0x1f')]?_0x5cf616['options'][_0x3d19('0x21')]||null:null})[_0x3d19('0x11')](function(_0x2cb744){if(_0x2cb744){return _0x2cb744[_0x3d19('0x25')](_0x5cf616[_0x3d19('0x1e')][_0x3d19('0x26')],_[_0x3d19('0x27')](_0x5cf616[_0x3d19('0x1e')],[_0x3d19('0x26'),'id'])||{});}})[_0x3d19('0x28')](function(_0x4f906a){logger['info']('AddTags',_0x5cf616);logger[_0x3d19('0x15')](_0x3d19('0x29'),_0x5cf616,JSON['stringify'](_0x4f906a));_0x1d1e98(_0x4f906a);})['catch'](function(_0x131ee3){logger[_0x3d19('0x18')](_0x3d19('0x29'),_0x131ee3[_0x3d19('0x19')],_0x5cf616);_0x4c757a(_this[_0x3d19('0x18')](0x1f4,_0x131ee3[_0x3d19('0x19')]));});});}; \ No newline at end of file +var _0x68d4=['AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','debug','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','info','request\x20sent','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','then','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread'];(function(_0x508688,_0x2647f0){var _0x1fbae4=function(_0x3b6af2){while(--_0x3b6af2){_0x508688['push'](_0x508688['shift']());}};_0x1fbae4(++_0x2647f0);}(_0x68d4,0x127));var _0x468d=function(_0x338442,_0x1974d1){_0x338442=_0x338442-0x0;var _0x11179b=_0x68d4[_0x338442];return _0x11179b;};'use strict';var _=require(_0x468d('0x0'));var util=require(_0x468d('0x1'));var moment=require('moment');var BPromise=require(_0x468d('0x2'));var rs=require(_0x468d('0x3'));var fs=require('fs');var Redis=require(_0x468d('0x4'));var db=require(_0x468d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x468d('0x6'))(_0x468d('0x7'));var config=require(_0x468d('0x8'));var jayson=require(_0x468d('0x9'));var client=jayson[_0x468d('0xa')][_0x468d('0xb')]({'port':0x232a});config[_0x468d('0xc')]=_[_0x468d('0xd')](config['redis'],{'host':_0x468d('0xe'),'port':0x18eb});var socket=require(_0x468d('0xf'))(new Redis(config[_0x468d('0xc')]));require(_0x468d('0x10'))['register'](socket);function respondWithRpcPromise(_0x23f138,_0xba45a5,_0x55637a){return new BPromise(function(_0x2caf47,_0x4082d8){return client[_0x468d('0x11')](_0x23f138,_0x55637a)['then'](function(_0x11a456){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0xba45a5,'request\x20sent');logger[_0x468d('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0xba45a5,'request\x20sent',JSON[_0x468d('0x13')](_0x11a456));if(_0x11a456[_0x468d('0x14')]){if(_0x11a456[_0x468d('0x14')][_0x468d('0x15')]===0x1f4){logger['error'](_0x468d('0x16'),_0xba45a5,_0x11a456[_0x468d('0x14')][_0x468d('0x17')]);return _0x4082d8(_0x11a456['error'][_0x468d('0x17')]);}logger[_0x468d('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0xba45a5,_0x11a456[_0x468d('0x14')][_0x468d('0x17')]);return _0x2caf47(_0x11a456['error']['message']);}else{logger[_0x468d('0x18')](_0x468d('0x16'),_0xba45a5,_0x468d('0x19'));_0x2caf47(_0x11a456['result']['message']);}})[_0x468d('0x1a')](function(_0x638ea7){logger['error'](_0x468d('0x16'),_0xba45a5,_0x638ea7);_0x4082d8(_0x638ea7);});});}exports[_0x468d('0x1b')]=function(_0x46c0f1){var _0x560014=this;return new Promise(function(_0x54283c,_0x3a6bdb){return db[_0x468d('0x1c')][_0x468d('0x1d')](_0x46c0f1[_0x468d('0x1e')],{'raw':_0x46c0f1['options']?_0x46c0f1[_0x468d('0x1f')][_0x468d('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46c0f1['options']?_0x46c0f1['options'][_0x468d('0x21')]||null:null,'attributes':_0x46c0f1[_0x468d('0x1f')]?_0x46c0f1[_0x468d('0x1f')]['attributes']||null:null,'limit':_0x46c0f1[_0x468d('0x1f')]?_0x46c0f1['options']['limit']||null:null})[_0x468d('0x22')](function(_0x3c4966){logger[_0x468d('0x18')](_0x468d('0x1b'),_0x46c0f1);logger[_0x468d('0x12')]('UpdateOpenchannelInteraction',_0x46c0f1,JSON[_0x468d('0x13')](_0x3c4966));_0x54283c(_0x3c4966);})['catch'](function(_0x174dcb){logger['error']('UpdateOpenchannelInteraction',_0x174dcb['message'],_0x46c0f1);_0x3a6bdb(_0x560014[_0x468d('0x14')](0x1f4,_0x174dcb[_0x468d('0x17')]));});});};exports[_0x468d('0x23')]=function(_0x14e098){return new Promise(function(_0xb72bc4,_0x4a33a0){return db[_0x468d('0x1c')][_0x468d('0x24')]({'where':_0x14e098[_0x468d('0x1f')]?_0x14e098[_0x468d('0x1f')][_0x468d('0x21')]||null:null})[_0x468d('0x22')](function(_0x3a4918){if(_0x3a4918){return _0x3a4918[_0x468d('0x25')](_0x14e098[_0x468d('0x1e')][_0x468d('0x26')],_[_0x468d('0x27')](_0x14e098[_0x468d('0x1e')],[_0x468d('0x26'),'id'])||{});}})[_0x468d('0x28')](function(_0x3046b6){logger[_0x468d('0x18')](_0x468d('0x29'),_0x14e098);logger[_0x468d('0x12')](_0x468d('0x29'),_0x14e098,JSON[_0x468d('0x13')](_0x3046b6));_0xb72bc4(_0x3046b6);})[_0x468d('0x1a')](function(_0x9fc4bd){logger[_0x468d('0x14')]('AddTags',_0x9fc4bd['message'],_0x14e098);_0x4a33a0(_this[_0x468d('0x14')](0x1f4,_0x9fc4bd[_0x468d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 7ced6bc..c9a17c1 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 _0x0c11=['openchannelInteraction:','save','remove','emit','register','length'];(function(_0x314079,_0x2b98a0){var _0x423351=function(_0x501dcc){while(--_0x501dcc){_0x314079['push'](_0x314079['shift']());}};_0x423351(++_0x2b98a0);}(_0x0c11,0x1ed));var _0x10c1=function(_0x2df1f2,_0x58d388){_0x2df1f2=_0x2df1f2-0x0;var _0x38652b=_0x0c11[_0x2df1f2];return _0x38652b;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x10c1('0x0'),_0x10c1('0x1'),'update'];function createListener(_0x26bcb2,_0x52e3aa){return function(_0x1a0c47){_0x52e3aa[_0x10c1('0x2')](_0x26bcb2,_0x1a0c47);};}function removeListener(_0x5e1f9c,_0x4cdc90){return function(){OpenchannelInteractionEvents['removeListener'](_0x5e1f9c,_0x4cdc90);};}exports[_0x10c1('0x3')]=function(_0x4a86ca){for(var _0x248355=0x0,_0x808bb3=events[_0x10c1('0x4')];_0x248355<_0x808bb3;_0x248355++){var _0x5afc86=events[_0x248355];var _0x3bd4ec=createListener(_0x10c1('0x5')+_0x5afc86,_0x4a86ca);OpenchannelInteractionEvents['on'](_0x5afc86,_0x3bd4ec);}}; \ No newline at end of file +var _0x4a97=['length','update','emit','removeListener','register'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x4a97,0x15a));var _0x74a9=function(_0xf852,_0x4ddd76){_0xf852=_0xf852-0x0;var _0x5b2550=_0x4a97[_0xf852];return _0x5b2550;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save','remove',_0x74a9('0x0')];function createListener(_0x30af44,_0x5c1a76){return function(_0x532e41){_0x5c1a76[_0x74a9('0x1')](_0x30af44,_0x532e41);};}function removeListener(_0x3658e2,_0x4ab711){return function(){OpenchannelInteractionEvents[_0x74a9('0x2')](_0x3658e2,_0x4ab711);};}exports[_0x74a9('0x3')]=function(_0x1c9c79){for(var _0x36ce35=0x0,_0x5c0020=events[_0x74a9('0x4')];_0x36ce35<_0x5c0020;_0x36ce35++){var _0x22845c=events[_0x36ce35];var _0x3a3980=createListener('openchannelInteraction:'+_0x22845c,_0x1c9c79);OpenchannelInteractionEvents['on'](_0x22845c,_0x3a3980);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 13086d0..383a3ac 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 _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0xa66c1,_0x20f3e4){var _0x8693e7=function(_0x571790){while(--_0x571790){_0xa66c1['push'](_0xa66c1['shift']());}};_0x8693e7(++_0x20f3e4);}(_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('./openchannelMessage.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')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('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 2e6906e..195af91 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 _0x4c4d=['out','DATE','STRING','TEXT','sequelize','BOOLEAN'];(function(_0x13ddbd,_0x50602d){var _0x1c8a66=function(_0x19c73c){while(--_0x19c73c){_0x13ddbd['push'](_0x13ddbd['shift']());}};_0x1c8a66(++_0x50602d);}(_0x4c4d,0x1a2));var _0xd4c4=function(_0x1f763d,_0x1fd760){_0x1f763d=_0x1f763d-0x0;var _0x1523a1=_0x4c4d[_0x1f763d];return _0x1523a1;};'use strict';var Sequelize=require(_0xd4c4('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xd4c4('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd4c4('0x2')),'defaultValue':_0xd4c4('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd4c4('0x3')]},'providerName':{'type':Sequelize[_0xd4c4('0x4')]},'providerResponse':{'type':Sequelize[_0xd4c4('0x5')]}}; \ No newline at end of file +var _0x38c9=['STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x4abf86,_0x419086){var _0x4188a9=function(_0x3173ce){while(--_0x3173ce){_0x4abf86['push'](_0x4abf86['shift']());}};_0x4188a9(++_0x419086);}(_0x38c9,0x199));var _0x938c=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0x38c9[_0x3cc9d9];return _0x1a425d;};'use strict';var Sequelize=require(_0x938c('0x0'));module[_0x938c('0x1')]={'body':{'type':Sequelize[_0x938c('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x938c('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x938c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x938c('0x4')]('in',_0x938c('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x938c('0x6')]},'providerName':{'type':Sequelize[_0x938c('0x7')]},'providerResponse':{'type':Sequelize[_0x938c('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 1c61292..0508463 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 _0xd76a=['internal','SIP/%s','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','jayson/promise','http','request','then','info','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','limit','count','offset','apply','save','update','destroy','sendStatus','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','include','rows','params','keys','includeAll','create','body','find','describe','../../config/logger','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','role','ContactId','sequelize','QueryTypes','contact','User','fullname','email','manual','interface','format','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','Sequelize','SELECT'];(function(_0x24f04d,_0x198dc7){var _0x2930f0=function(_0x4f3f7c){while(--_0x4f3f7c){_0x24f04d['push'](_0x24f04d['shift']());}};_0x2930f0(++_0x198dc7);}(_0xd76a,0x105));var _0xad76=function(_0x1b76c6,_0x4379f4){_0x1b76c6=_0x1b76c6-0x0;var _0x2419a2=_0xd76a[_0x1b76c6];return _0x2419a2;};'use strict';var emlformat=require(_0xad76('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xad76('0x1'));var jsonpatch=require(_0xad76('0x2'));var rp=require(_0xad76('0x3'));var moment=require(_0xad76('0x4'));var BPromise=require(_0xad76('0x5'));var Mustache=require('mustache');var util=require(_0xad76('0x6'));var path=require(_0xad76('0x7'));var sox=require(_0xad76('0x8'));var csv=require(_0xad76('0x9'));var ejs=require(_0xad76('0xa'));var fs=require('fs');var fs_extra=require(_0xad76('0xb'));var _=require(_0xad76('0xc'));var squel=require(_0xad76('0xd'));var crypto=require(_0xad76('0xe'));var jsforce=require(_0xad76('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xad76('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xad76('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xad76('0x12'));var hardwareService=require(_0xad76('0x13'));var logger=require('../../config/logger')(_0xad76('0x14'));var utils=require('../../config/utils');var config=require(_0xad76('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xad76('0x16'))['db'];config['redis']=_[_0xad76('0x17')](config[_0xad76('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xad76('0x19'))(new Redis(config[_0xad76('0x18')]));require('./openchannelMessage.socket')[_0xad76('0x1a')](socket);var jayson=require(_0xad76('0x1b'));var client=jayson['client'][_0xad76('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xad76('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x451ceb,_0x201acb,_0x4b1f7a,_0x4309c2){return new BPromise(function(_0x5705a3,_0x54b428){var _0x4fe63c=_0x4309c2||client;return _0x4fe63c[_0xad76('0x1d')](_0x451ceb,_0x4b1f7a)[_0xad76('0x1e')](function(_0x2f83c1){logger[_0xad76('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x201acb,_0xad76('0x20'));logger['debug'](_0xad76('0x21'),_0x201acb,_0xad76('0x20'),JSON[_0xad76('0x22')](_0x2f83c1));if(_0x2f83c1[_0xad76('0x23')]){if(_0x2f83c1[_0xad76('0x23')][_0xad76('0x24')]===0x1f4){logger['error'](_0xad76('0x25'),_0x201acb,_0x2f83c1['error']['message']);return _0x54b428(_0x2f83c1[_0xad76('0x23')]['message']);}logger[_0xad76('0x23')](_0xad76('0x25'),_0x201acb,_0x2f83c1[_0xad76('0x23')][_0xad76('0x26')]);return _0x5705a3(_0x2f83c1[_0xad76('0x23')]['message']);}else{logger[_0xad76('0x1f')](_0xad76('0x25'),_0x201acb,_0xad76('0x20'));_0x5705a3(_0x2f83c1[_0xad76('0x27')][_0xad76('0x26')]);}})[_0xad76('0x28')](function(_0x3af2cd){logger['error'](_0xad76('0x25'),_0x201acb,_0x3af2cd);_0x54b428(_0x3af2cd);});});}function respondWithStatusCode(_0x507780,_0x422eec){_0x422eec=_0x422eec||0xcc;return function(_0x2eaea3){if(_0x2eaea3){return _0x507780['sendStatus'](_0x422eec);}return _0x507780[_0xad76('0x29')](_0x422eec)[_0xad76('0x2a')]();};}function respondWithResult(_0x35febb,_0x373a64){_0x373a64=_0x373a64||0xc8;return function(_0x4fd212){if(_0x4fd212){return _0x35febb[_0xad76('0x29')](_0x373a64)[_0xad76('0x2b')](_0x4fd212);}};}function respondWithFilteredResult(_0xf61132,_0x49c564){return function(_0x5de1ae){if(_0x5de1ae){var _0x4188f8=typeof _0x49c564['offset']===_0xad76('0x2c')&&typeof _0x49c564[_0xad76('0x2d')]===_0xad76('0x2c');var _0x261917=_0x5de1ae[_0xad76('0x2e')];var _0x168fa7=_0x4188f8?0x0:_0x49c564['offset'];var _0x17211b=_0x4188f8?_0x5de1ae[_0xad76('0x2e')]:_0x49c564[_0xad76('0x2f')]+_0x49c564['limit'];var _0x507d8e;if(_0x17211b>=_0x261917){_0x17211b=_0x261917;_0x507d8e=0xc8;}else{_0x507d8e=0xce;}_0xf61132['status'](_0x507d8e);return _0xf61132['set']('Content-Range',_0x168fa7+'-'+_0x17211b+'/'+_0x261917)[_0xad76('0x2b')](_0x5de1ae);}return null;};}function patchUpdates(_0xf0a034){return function(_0x3d5462){try{jsonpatch[_0xad76('0x30')](_0x3d5462,_0xf0a034,!![]);}catch(_0x12cbd6){return BPromise['reject'](_0x12cbd6);}return _0x3d5462[_0xad76('0x31')]();};}function saveUpdates(_0x563b48,_0x507d6f){return function(_0x57f09d){if(_0x57f09d){return _0x57f09d[_0xad76('0x32')](_0x563b48)[_0xad76('0x1e')](function(_0x419303){return _0x419303;});}return null;};}function removeEntity(_0x544f8d,_0xf092ba){return function(_0x2ab94d){if(_0x2ab94d){return _0x2ab94d[_0xad76('0x33')]()[_0xad76('0x1e')](function(){_0x544f8d[_0xad76('0x29')](0xcc)[_0xad76('0x2a')]();});}};}function handleEntityNotFound(_0x44d623,_0x4ba901){return function(_0x1fe761){if(!_0x1fe761){_0x44d623[_0xad76('0x34')](0x194);}return _0x1fe761;};}function handleError(_0x483dbb,_0x41919f){_0x41919f=_0x41919f||0x1f4;return function(_0xaaeef6){logger['error'](_0xaaeef6[_0xad76('0x35')]);if(_0xaaeef6[_0xad76('0x36')]){delete _0xaaeef6['name'];}_0x483dbb[_0xad76('0x29')](_0x41919f)[_0xad76('0x37')](_0xaaeef6);};}exports[_0xad76('0x38')]=function(_0x3cbb6e,_0x414685){var _0x1ec112={},_0xebddb3={},_0x2ca8ff={'count':0x0,'rows':[]};var _0x506ef2=_['map'](db[_0xad76('0x39')][_0xad76('0x3a')],function(_0x5c86d){return{'name':_0x5c86d[_0xad76('0x3b')],'type':_0x5c86d['type'][_0xad76('0x3c')]};});_0xebddb3[_0xad76('0x3d')]=_[_0xad76('0x3e')](_0x506ef2,_0xad76('0x36'));_0xebddb3[_0xad76('0x3f')]=_['keys'](_0x3cbb6e['query']);_0xebddb3[_0xad76('0x40')]=_['intersection'](_0xebddb3[_0xad76('0x3d')],_0xebddb3[_0xad76('0x3f')]);_0x1ec112[_0xad76('0x41')]=_[_0xad76('0x42')](_0xebddb3[_0xad76('0x3d')],qs[_0xad76('0x43')](_0x3cbb6e[_0xad76('0x3f')]['fields']));_0x1ec112[_0xad76('0x41')]=_0x1ec112[_0xad76('0x41')][_0xad76('0x44')]?_0x1ec112[_0xad76('0x41')]:_0xebddb3['model'];if(!_0x3cbb6e[_0xad76('0x3f')][_0xad76('0x45')](_0xad76('0x46'))){_0x1ec112[_0xad76('0x2d')]=qs[_0xad76('0x2d')](_0x3cbb6e[_0xad76('0x3f')][_0xad76('0x2d')]);_0x1ec112[_0xad76('0x2f')]=qs[_0xad76('0x2f')](_0x3cbb6e['query'][_0xad76('0x2f')]);}_0x1ec112['order']=qs[_0xad76('0x47')](_0x3cbb6e[_0xad76('0x3f')][_0xad76('0x47')]);_0x1ec112[_0xad76('0x48')]=qs[_0xad76('0x40')](_['pick'](_0x3cbb6e['query'],_0xebddb3[_0xad76('0x40')]),_0x506ef2);if(_0x3cbb6e['query']['filter']){_0x1ec112[_0xad76('0x48')]=_[_0xad76('0x49')](_0x1ec112['where'],{'$or':_[_0xad76('0x3e')](_0x506ef2,function(_0x4fbecf){if(_0x4fbecf[_0xad76('0x4a')]!==_0xad76('0x4b')){var _0x577f33={};_0x577f33[_0x4fbecf[_0xad76('0x36')]]={'$like':'%'+_0x3cbb6e[_0xad76('0x3f')][_0xad76('0x4c')]+'%'};return _0x577f33;}})});}_0x1ec112=_['merge']({},_0x1ec112,_0x3cbb6e[_0xad76('0x4d')]);var _0x4521ff={'where':_0x1ec112['where']};return db[_0xad76('0x39')][_0xad76('0x2e')](_0x4521ff)[_0xad76('0x1e')](function(_0x13dd1f){_0x2ca8ff[_0xad76('0x2e')]=_0x13dd1f;if(_0x3cbb6e['query']['includeAll']){_0x1ec112[_0xad76('0x4e')]=[{'all':!![]}];}return db[_0xad76('0x39')]['findAll'](_0x1ec112);})['then'](function(_0x956c1){_0x2ca8ff[_0xad76('0x4f')]=_0x956c1;return _0x2ca8ff;})[_0xad76('0x1e')](respondWithFilteredResult(_0x414685,_0x1ec112))[_0xad76('0x28')](handleError(_0x414685,null));};exports['show']=function(_0x5a5f0c,_0x5e7668){var _0x70f30b={'raw':!![],'where':{'id':_0x5a5f0c[_0xad76('0x50')]['id']}},_0x4f9666={};_0x4f9666['model']=_[_0xad76('0x51')](db[_0xad76('0x39')]['rawAttributes']);_0x4f9666[_0xad76('0x3f')]=_[_0xad76('0x51')](_0x5a5f0c['query']);_0x4f9666[_0xad76('0x40')]=_[_0xad76('0x42')](_0x4f9666['model'],_0x4f9666[_0xad76('0x3f')]);_0x70f30b[_0xad76('0x41')]=_[_0xad76('0x42')](_0x4f9666[_0xad76('0x3d')],qs[_0xad76('0x43')](_0x5a5f0c[_0xad76('0x3f')][_0xad76('0x43')]));_0x70f30b[_0xad76('0x41')]=_0x70f30b[_0xad76('0x41')][_0xad76('0x44')]?_0x70f30b[_0xad76('0x41')]:_0x4f9666['model'];if(_0x5a5f0c[_0xad76('0x3f')][_0xad76('0x52')]){_0x70f30b[_0xad76('0x4e')]=[{'all':!![]}];}_0x70f30b=_[_0xad76('0x49')]({},_0x70f30b,_0x5a5f0c[_0xad76('0x4d')]);return db['OpenchannelMessage']['find'](_0x70f30b)[_0xad76('0x1e')](handleEntityNotFound(_0x5e7668,null))[_0xad76('0x1e')](respondWithResult(_0x5e7668,null))[_0xad76('0x28')](handleError(_0x5e7668,null));};exports[_0xad76('0x53')]=function(_0x4526b5,_0x3a8c29){return db[_0xad76('0x39')][_0xad76('0x53')](_0x4526b5[_0xad76('0x54')],{})[_0xad76('0x1e')](respondWithResult(_0x3a8c29,0xc9))[_0xad76('0x28')](handleError(_0x3a8c29,null));};exports[_0xad76('0x32')]=function(_0x771a9b,_0x455116){if(_0x771a9b['body']['id']){delete _0x771a9b[_0xad76('0x54')]['id'];}return db[_0xad76('0x39')][_0xad76('0x55')]({'where':{'id':_0x771a9b['params']['id']}})[_0xad76('0x1e')](handleEntityNotFound(_0x455116,null))[_0xad76('0x1e')](saveUpdates(_0x771a9b[_0xad76('0x54')],null))[_0xad76('0x1e')](respondWithResult(_0x455116,null))[_0xad76('0x28')](handleError(_0x455116,null));};exports[_0xad76('0x33')]=function(_0x33e4bb,_0x293ad7){return db[_0xad76('0x39')][_0xad76('0x55')]({'where':{'id':_0x33e4bb['params']['id']}})[_0xad76('0x1e')](handleEntityNotFound(_0x293ad7,null))[_0xad76('0x1e')](removeEntity(_0x293ad7,null))[_0xad76('0x28')](handleError(_0x293ad7,null));};exports['describe']=function(_0xf0ada5,_0x593928){return db[_0xad76('0x39')][_0xad76('0x56')]()[_0xad76('0x1e')](respondWithResult(_0x593928,null))[_0xad76('0x28')](handleError(_0x593928,null));};var interaction_log=require(_0xad76('0x57'))('openchannel-interactions');exports[_0xad76('0x58')]=function(_0x56c446,_0x4fdf3f,_0x3b4f5f){var _0x14a28d={'agent':{},'channel':_0xad76('0x59')};if(_0x56c446['body']['id']){delete _0x56c446[_0xad76('0x54')]['id'];}_0x56c446[_0xad76('0x54')][_0xad76('0x5a')]=!![];_0x56c446[_0xad76('0x54')][_0xad76('0x5b')]=moment()['format'](_0xad76('0x5c'));_0x56c446['body'][_0xad76('0x5d')]=_0x56c446[_0xad76('0x54')][_0xad76('0x5d')]||_0x56c446[_0xad76('0x5e')]['id'];_0x14a28d[_0xad76('0x5f')]['id']=_0x56c446[_0xad76('0x54')][_0xad76('0x5d')];return db[_0xad76('0x39')]['find']({'where':{'id':_0x56c446['params']['id'],'UserId':null}})[_0xad76('0x1e')](handleEntityNotFound(_0x4fdf3f,null))[_0xad76('0x1e')](saveUpdates(_0x56c446[_0xad76('0x54')],null))[_0xad76('0x1e')](function(_0x47ca4e){if(_0x47ca4e){_0x14a28d[_0xad76('0x26')]=_0x47ca4e[_0xad76('0x60')]({'plain':!![]});return db[_0xad76('0x61')]['find']({'where':{'id':_0x47ca4e[_0xad76('0x62')]}});}return null;})[_0xad76('0x1e')](handleEntityNotFound(_0x4fdf3f,null))[_0xad76('0x1e')](function(_0x35cc17){if(_0x35cc17){return _0x35cc17[_0xad76('0x32')]({'UserId':_0x56c446['body'][_0xad76('0x5d')],'read1stAt':_[_0xad76('0x63')](_0x35cc17[_0xad76('0x64')])?moment()['format'](_0xad76('0x5c')):undefined});}return null;})['then'](function(_0x3df5b4){if(_0x3df5b4){_0x14a28d[_0xad76('0x65')]=_0x3df5b4[_0xad76('0x60')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x56c446['user']['id'],_0x56c446[_0xad76('0x5e')][_0xad76('0x36')],_0x56c446[_0xad76('0x5e')][_0xad76('0x66')],_0x14a28d[_0xad76('0x65')]['id'],_0x56c446[_0xad76('0x54')]?JSON[_0xad76('0x22')](_0x56c446[_0xad76('0x54')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x14a28d);}return null;})[_0xad76('0x1e')](function(_0x455566){var _0x485c38='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x455566[_0xad76('0x26')][_0xad76('0x67')];return db[_0xad76('0x68')][_0xad76('0x3f')](_0x485c38,{'type':db['Sequelize'][_0xad76('0x69')]['SELECT'],'raw':!![]})[_0xad76('0x1e')](function(_0x1cd466){return _0x1cd466;});})[_0xad76('0x1e')](function(_0x27c6df){if(_0x27c6df){_0x14a28d[_0xad76('0x26')][_0xad76('0x6a')]=_0x27c6df[0x0];if(!_0x56c446[_0xad76('0x54')][_0xad76('0x5d')])return;return db[_0xad76('0x6b')][_0xad76('0x55')]({'where':{'id':_0x56c446[_0xad76('0x54')][_0xad76('0x5d')],'role':_0xad76('0x5f')},'attributes':['id','name',_0xad76('0x6c'),_0xad76('0x6d'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4cc904){if(!_0x4cc904)return null;_0x14a28d[_0xad76('0x26')][_0xad76('0x5f')]=_0x4cc904;return _0x14a28d;})[_0xad76('0x1e')](function(_0x58fbad){if(_0x58fbad){if(_0x56c446['body'][_0xad76('0x6e')]){_0x14a28d[_0xad76('0x26')][_0xad76('0x6f')]=util[_0xad76('0x70')]('SIP/%s',_0x56c446[_0xad76('0x5e')][_0xad76('0x36')]);_0x14a28d['message'][_0xad76('0x71')]=_0x14a28d[_0xad76('0x71')];_0x14a28d['message'][_0xad76('0x72')]=_0x14a28d['channel'];_0x14a28d['message'][_0xad76('0x73')]=_0xad76('0x58');return respondWithRpcPromise('EventManager',_0xad76('0x74'),{'event':_0xad76('0x75'),'message':_0x14a28d[_0xad76('0x26')]},client9002)[_0xad76('0x1e')](function(){return _0x14a28d;});}return _0x14a28d;}return null;})[_0xad76('0x1e')](respondWithResult(_0x4fdf3f,null))['catch'](handleError(_0x4fdf3f,null));};var interaction_log=require(_0xad76('0x57'))(_0xad76('0x76'));exports[_0xad76('0x77')]=function(_0x408d37,_0x816ed4,_0x3d5664){var _0x5734c9={'agent':{},'channel':_0xad76('0x59')};if(_0x408d37[_0xad76('0x54')]['id']){delete _0x408d37[_0xad76('0x54')]['id'];}_0x408d37[_0xad76('0x54')][_0xad76('0x5d')]=_0x408d37[_0xad76('0x54')][_0xad76('0x5d')]||_0x408d37[_0xad76('0x5e')]['id'];_0x5734c9[_0xad76('0x5f')]['id']=_0x408d37[_0xad76('0x54')][_0xad76('0x5d')];return db['OpenchannelMessage']['find']({'where':{'id':_0x408d37['params']['id'],'UserId':null}})[_0xad76('0x1e')](handleEntityNotFound(_0x816ed4,null))[_0xad76('0x1e')](function(_0x5813e2){if(_0x5813e2){_0x5734c9[_0xad76('0x26')]=_0x5813e2[_0xad76('0x60')]({'plain':!![]});return db[_0xad76('0x61')]['find']({'where':{'id':_0x5813e2[_0xad76('0x62')]}});}return null;})[_0xad76('0x1e')](handleEntityNotFound(_0x816ed4,null))[_0xad76('0x1e')](function(_0x3a400a){if(_0x3a400a){_0x5734c9['interaction']=_0x3a400a[_0xad76('0x60')]({'plain':!![]});interaction_log['info'](_0xad76('0x78'),_0x408d37[_0xad76('0x5e')]['id'],_0x408d37[_0xad76('0x5e')][_0xad76('0x36')],_0x408d37['user'][_0xad76('0x66')],_0x5734c9[_0xad76('0x65')]['id'],_0x408d37[_0xad76('0x54')]?JSON[_0xad76('0x22')](_0x408d37[_0xad76('0x54')]):_0xad76('0x79'));return respondWithRpcPromise(_0xad76('0x7a'),_0xad76('0x7b'),_0x5734c9);}return null;})[_0xad76('0x1e')](function(_0x504211){var _0x32f0d6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x504211[_0xad76('0x26')][_0xad76('0x67')];return db[_0xad76('0x68')]['query'](_0x32f0d6,{'type':db[_0xad76('0x7c')][_0xad76('0x69')][_0xad76('0x7d')],'raw':!![]})[_0xad76('0x1e')](function(_0x5a7523){return _0x5a7523;});})[_0xad76('0x1e')](function(_0x13494d){if(_0x13494d){_0x5734c9[_0xad76('0x26')]['contact']=_0x13494d[0x0];if(!_0x408d37[_0xad76('0x54')][_0xad76('0x5d')])return;return db[_0xad76('0x6b')][_0xad76('0x55')]({'where':{'id':_0x408d37['body'][_0xad76('0x5d')],'role':_0xad76('0x5f')},'attributes':['id',_0xad76('0x36'),_0xad76('0x6c'),_0xad76('0x6d'),_0xad76('0x7e')],'raw':!![]});}return null;})['then'](function(_0x1cc817){if(!_0x1cc817)return null;_0x5734c9[_0xad76('0x26')][_0xad76('0x5f')]=_0x1cc817;return _0x5734c9;})['then'](function(_0x53ce1c){if(_0x53ce1c){_0x53ce1c['message'][_0xad76('0x6f')]=util[_0xad76('0x70')](_0xad76('0x7f'),_0x408d37[_0xad76('0x5e')]['name']);_0x53ce1c['message'][_0xad76('0x71')]=_0x5734c9['channel'];_0x53ce1c[_0xad76('0x26')][_0xad76('0x72')]=_0x5734c9[_0xad76('0x71')];_0x53ce1c[_0xad76('0x26')][_0xad76('0x73')]=_0xad76('0x77');respondWithRpcPromise(_0xad76('0x74'),_0xad76('0x74'),{'event':_0xad76('0x80'),'message':_0x53ce1c[_0xad76('0x26')]},client9002);return _0x5734c9;}return null;})[_0xad76('0x1e')](respondWithResult(_0x816ed4,null))['catch'](handleError(_0x816ed4,null));}; \ No newline at end of file +var _0xf4d2=['options','include','rows','params','includeAll','find','create','body','describe','../../config/logger','openchannel-interactions','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','User','fullname','email','internal','agent','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','OpenchannelInteractionId','RejectMessage','rejectMessage','QueryTypes','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','register','client','http','request','info','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0xb5c10c,_0x33d4e6){var _0x309636=function(_0x4f87c7){while(--_0x4f87c7){_0xb5c10c['push'](_0xb5c10c['shift']());}};_0x309636(++_0x33d4e6);}(_0xf4d2,0x130));var _0x2f4d=function(_0x2dec70,_0x46171d){_0x2dec70=_0x2dec70-0x0;var _0x6cee09=_0xf4d2[_0x2dec70];return _0x6cee09;};'use strict';var emlformat=require(_0x2f4d('0x0'));var rimraf=require(_0x2f4d('0x1'));var zipdir=require(_0x2f4d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2f4d('0x3'));var moment=require(_0x2f4d('0x4'));var BPromise=require(_0x2f4d('0x5'));var Mustache=require(_0x2f4d('0x6'));var util=require(_0x2f4d('0x7'));var path=require(_0x2f4d('0x8'));var sox=require(_0x2f4d('0x9'));var csv=require('to-csv');var ejs=require(_0x2f4d('0xa'));var fs=require('fs');var fs_extra=require(_0x2f4d('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2f4d('0xc'));var deskjs=require(_0x2f4d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2f4d('0xe'));var Papa=require(_0x2f4d('0xf'));var Redis=require(_0x2f4d('0x10'));var authService=require(_0x2f4d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f4d('0x12'));var logger=require('../../config/logger')(_0x2f4d('0x13'));var utils=require(_0x2f4d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2f4d('0x15'));var db=require(_0x2f4d('0x16'))['db'];config['redis']=_[_0x2f4d('0x17')](config[_0x2f4d('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelMessage.socket')[_0x2f4d('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2f4d('0x1a')][_0x2f4d('0x1b')]({'port':0x232c});var client9002=jayson[_0x2f4d('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2960c0,_0x560652,_0x19c7cb,_0x27c4b5){return new BPromise(function(_0x43a8e2,_0x7005f3){var _0xabea10=_0x27c4b5||client;return _0xabea10[_0x2f4d('0x1c')](_0x2960c0,_0x19c7cb)['then'](function(_0x472100){logger[_0x2f4d('0x1d')]('OpenchannelMessage,\x20%s,\x20%s',_0x560652,_0x2f4d('0x1e'));logger['debug'](_0x2f4d('0x1f'),_0x560652,_0x2f4d('0x1e'),JSON[_0x2f4d('0x20')](_0x472100));if(_0x472100[_0x2f4d('0x21')]){if(_0x472100['error'][_0x2f4d('0x22')]===0x1f4){logger[_0x2f4d('0x21')](_0x2f4d('0x23'),_0x560652,_0x472100['error']['message']);return _0x7005f3(_0x472100['error'][_0x2f4d('0x24')]);}logger[_0x2f4d('0x21')](_0x2f4d('0x23'),_0x560652,_0x472100[_0x2f4d('0x21')][_0x2f4d('0x24')]);return _0x43a8e2(_0x472100[_0x2f4d('0x21')][_0x2f4d('0x24')]);}else{logger['info'](_0x2f4d('0x23'),_0x560652,'request\x20sent');_0x43a8e2(_0x472100[_0x2f4d('0x25')][_0x2f4d('0x24')]);}})[_0x2f4d('0x26')](function(_0x45b364){logger['error'](_0x2f4d('0x23'),_0x560652,_0x45b364);_0x7005f3(_0x45b364);});});}function respondWithStatusCode(_0x183b40,_0x47a725){_0x47a725=_0x47a725||0xcc;return function(_0x25f7eb){if(_0x25f7eb){return _0x183b40[_0x2f4d('0x27')](_0x47a725);}return _0x183b40[_0x2f4d('0x28')](_0x47a725)[_0x2f4d('0x29')]();};}function respondWithResult(_0x4e6412,_0x72db6b){_0x72db6b=_0x72db6b||0xc8;return function(_0x4c1498){if(_0x4c1498){return _0x4e6412[_0x2f4d('0x28')](_0x72db6b)[_0x2f4d('0x2a')](_0x4c1498);}};}function respondWithFilteredResult(_0x582511,_0x505fe0){return function(_0x1d18dc){if(_0x1d18dc){var _0x1d8133=typeof _0x505fe0[_0x2f4d('0x2b')]===_0x2f4d('0x2c')&&typeof _0x505fe0['limit']===_0x2f4d('0x2c');var _0x13b03c=_0x1d18dc[_0x2f4d('0x2d')];var _0x5e112e=_0x1d8133?0x0:_0x505fe0[_0x2f4d('0x2b')];var _0x2859eb=_0x1d8133?_0x1d18dc[_0x2f4d('0x2d')]:_0x505fe0['offset']+_0x505fe0['limit'];var _0x5eb866;if(_0x2859eb>=_0x13b03c){_0x2859eb=_0x13b03c;_0x5eb866=0xc8;}else{_0x5eb866=0xce;}_0x582511[_0x2f4d('0x28')](_0x5eb866);return _0x582511[_0x2f4d('0x2e')](_0x2f4d('0x2f'),_0x5e112e+'-'+_0x2859eb+'/'+_0x13b03c)['json'](_0x1d18dc);}return null;};}function patchUpdates(_0x311262){return function(_0x14c3be){try{jsonpatch['apply'](_0x14c3be,_0x311262,!![]);}catch(_0x170edf){return BPromise[_0x2f4d('0x30')](_0x170edf);}return _0x14c3be[_0x2f4d('0x31')]();};}function saveUpdates(_0x57cda2,_0x3d9d1e){return function(_0x9dcf60){if(_0x9dcf60){return _0x9dcf60[_0x2f4d('0x32')](_0x57cda2)[_0x2f4d('0x33')](function(_0x202682){return _0x202682;});}return null;};}function removeEntity(_0x1ccce2,_0x26cd9b){return function(_0x595dee){if(_0x595dee){return _0x595dee[_0x2f4d('0x34')]()[_0x2f4d('0x33')](function(){_0x1ccce2[_0x2f4d('0x28')](0xcc)[_0x2f4d('0x29')]();});}};}function handleEntityNotFound(_0x50881f,_0x21c4e2){return function(_0x4c310e){if(!_0x4c310e){_0x50881f['sendStatus'](0x194);}return _0x4c310e;};}function handleError(_0x2711fc,_0x43ddaa){_0x43ddaa=_0x43ddaa||0x1f4;return function(_0x217cd3){logger['error'](_0x217cd3[_0x2f4d('0x35')]);if(_0x217cd3[_0x2f4d('0x36')]){delete _0x217cd3[_0x2f4d('0x36')];}_0x2711fc[_0x2f4d('0x28')](_0x43ddaa)[_0x2f4d('0x37')](_0x217cd3);};}exports['index']=function(_0x30ae1d,_0x48ac06){var _0x3d933a={},_0x260348={},_0x58709d={'count':0x0,'rows':[]};var _0x4badb4=_[_0x2f4d('0x38')](db[_0x2f4d('0x39')][_0x2f4d('0x3a')],function(_0x1d7f18){return{'name':_0x1d7f18[_0x2f4d('0x3b')],'type':_0x1d7f18[_0x2f4d('0x3c')][_0x2f4d('0x3d')]};});_0x260348[_0x2f4d('0x3e')]=_['map'](_0x4badb4,'name');_0x260348[_0x2f4d('0x3f')]=_[_0x2f4d('0x40')](_0x30ae1d[_0x2f4d('0x3f')]);_0x260348[_0x2f4d('0x41')]=_[_0x2f4d('0x42')](_0x260348['model'],_0x260348[_0x2f4d('0x3f')]);_0x3d933a[_0x2f4d('0x43')]=_['intersection'](_0x260348['model'],qs['fields'](_0x30ae1d[_0x2f4d('0x3f')][_0x2f4d('0x44')]));_0x3d933a[_0x2f4d('0x43')]=_0x3d933a[_0x2f4d('0x43')][_0x2f4d('0x45')]?_0x3d933a[_0x2f4d('0x43')]:_0x260348[_0x2f4d('0x3e')];if(!_0x30ae1d['query'][_0x2f4d('0x46')](_0x2f4d('0x47'))){_0x3d933a[_0x2f4d('0x48')]=qs[_0x2f4d('0x48')](_0x30ae1d[_0x2f4d('0x3f')][_0x2f4d('0x48')]);_0x3d933a[_0x2f4d('0x2b')]=qs['offset'](_0x30ae1d[_0x2f4d('0x3f')]['offset']);}_0x3d933a[_0x2f4d('0x49')]=qs[_0x2f4d('0x4a')](_0x30ae1d[_0x2f4d('0x3f')]['sort']);_0x3d933a[_0x2f4d('0x4b')]=qs[_0x2f4d('0x41')](_[_0x2f4d('0x4c')](_0x30ae1d['query'],_0x260348[_0x2f4d('0x41')]),_0x4badb4);if(_0x30ae1d[_0x2f4d('0x3f')][_0x2f4d('0x4d')]){_0x3d933a[_0x2f4d('0x4b')]=_[_0x2f4d('0x4e')](_0x3d933a[_0x2f4d('0x4b')],{'$or':_[_0x2f4d('0x38')](_0x4badb4,function(_0x217616){if(_0x217616['type']!==_0x2f4d('0x4f')){var _0x10795e={};_0x10795e[_0x217616[_0x2f4d('0x36')]]={'$like':'%'+_0x30ae1d[_0x2f4d('0x3f')][_0x2f4d('0x4d')]+'%'};return _0x10795e;}})});}_0x3d933a=_[_0x2f4d('0x4e')]({},_0x3d933a,_0x30ae1d[_0x2f4d('0x50')]);var _0x39f8b9={'where':_0x3d933a[_0x2f4d('0x4b')]};return db[_0x2f4d('0x39')][_0x2f4d('0x2d')](_0x39f8b9)[_0x2f4d('0x33')](function(_0x300b51){_0x58709d[_0x2f4d('0x2d')]=_0x300b51;if(_0x30ae1d['query']['includeAll']){_0x3d933a[_0x2f4d('0x51')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x3d933a);})[_0x2f4d('0x33')](function(_0x565a61){_0x58709d[_0x2f4d('0x52')]=_0x565a61;return _0x58709d;})['then'](respondWithFilteredResult(_0x48ac06,_0x3d933a))[_0x2f4d('0x26')](handleError(_0x48ac06,null));};exports['show']=function(_0x4a4bd3,_0x50626e){var _0x4770cf={'raw':!![],'where':{'id':_0x4a4bd3[_0x2f4d('0x53')]['id']}},_0x35bb0c={};_0x35bb0c[_0x2f4d('0x3e')]=_[_0x2f4d('0x40')](db['OpenchannelMessage'][_0x2f4d('0x3a')]);_0x35bb0c[_0x2f4d('0x3f')]=_[_0x2f4d('0x40')](_0x4a4bd3[_0x2f4d('0x3f')]);_0x35bb0c[_0x2f4d('0x41')]=_['intersection'](_0x35bb0c['model'],_0x35bb0c[_0x2f4d('0x3f')]);_0x4770cf[_0x2f4d('0x43')]=_[_0x2f4d('0x42')](_0x35bb0c[_0x2f4d('0x3e')],qs[_0x2f4d('0x44')](_0x4a4bd3[_0x2f4d('0x3f')]['fields']));_0x4770cf[_0x2f4d('0x43')]=_0x4770cf[_0x2f4d('0x43')][_0x2f4d('0x45')]?_0x4770cf[_0x2f4d('0x43')]:_0x35bb0c[_0x2f4d('0x3e')];if(_0x4a4bd3[_0x2f4d('0x3f')][_0x2f4d('0x54')]){_0x4770cf[_0x2f4d('0x51')]=[{'all':!![]}];}_0x4770cf=_[_0x2f4d('0x4e')]({},_0x4770cf,_0x4a4bd3[_0x2f4d('0x50')]);return db[_0x2f4d('0x39')][_0x2f4d('0x55')](_0x4770cf)['then'](handleEntityNotFound(_0x50626e,null))[_0x2f4d('0x33')](respondWithResult(_0x50626e,null))['catch'](handleError(_0x50626e,null));};exports[_0x2f4d('0x56')]=function(_0x32807a,_0x3f812e){return db[_0x2f4d('0x39')]['create'](_0x32807a[_0x2f4d('0x57')],{})[_0x2f4d('0x33')](respondWithResult(_0x3f812e,0xc9))['catch'](handleError(_0x3f812e,null));};exports['update']=function(_0x4a7190,_0x54d777){if(_0x4a7190['body']['id']){delete _0x4a7190[_0x2f4d('0x57')]['id'];}return db[_0x2f4d('0x39')][_0x2f4d('0x55')]({'where':{'id':_0x4a7190[_0x2f4d('0x53')]['id']}})[_0x2f4d('0x33')](handleEntityNotFound(_0x54d777,null))[_0x2f4d('0x33')](saveUpdates(_0x4a7190['body'],null))['then'](respondWithResult(_0x54d777,null))[_0x2f4d('0x26')](handleError(_0x54d777,null));};exports[_0x2f4d('0x34')]=function(_0x12d8e2,_0x8465e2){return db[_0x2f4d('0x39')]['find']({'where':{'id':_0x12d8e2[_0x2f4d('0x53')]['id']}})[_0x2f4d('0x33')](handleEntityNotFound(_0x8465e2,null))[_0x2f4d('0x33')](removeEntity(_0x8465e2,null))[_0x2f4d('0x26')](handleError(_0x8465e2,null));};exports[_0x2f4d('0x58')]=function(_0x1f1d17,_0x2c8d1c){return db[_0x2f4d('0x39')][_0x2f4d('0x58')]()['then'](respondWithResult(_0x2c8d1c,null))['catch'](handleError(_0x2c8d1c,null));};var interaction_log=require(_0x2f4d('0x59'))(_0x2f4d('0x5a'));exports['accept']=function(_0x5bb09e,_0x408d9c,_0x5c3907){var _0x4f1041={'agent':{},'channel':_0x2f4d('0x5b')};if(_0x5bb09e[_0x2f4d('0x57')]['id']){delete _0x5bb09e[_0x2f4d('0x57')]['id'];}_0x5bb09e[_0x2f4d('0x57')]['read']=!![];_0x5bb09e['body'][_0x2f4d('0x5c')]=moment()[_0x2f4d('0x5d')](_0x2f4d('0x5e'));_0x5bb09e['body'][_0x2f4d('0x5f')]=_0x5bb09e[_0x2f4d('0x57')][_0x2f4d('0x5f')]||_0x5bb09e[_0x2f4d('0x60')]['id'];_0x4f1041['agent']['id']=_0x5bb09e[_0x2f4d('0x57')][_0x2f4d('0x5f')];return db['OpenchannelMessage'][_0x2f4d('0x55')]({'where':{'id':_0x5bb09e[_0x2f4d('0x53')]['id'],'UserId':null}})[_0x2f4d('0x33')](handleEntityNotFound(_0x408d9c,null))[_0x2f4d('0x33')](saveUpdates(_0x5bb09e['body'],null))['then'](function(_0x426f2a){if(_0x426f2a){_0x4f1041['message']=_0x426f2a[_0x2f4d('0x61')]({'plain':!![]});return db[_0x2f4d('0x62')][_0x2f4d('0x55')]({'where':{'id':_0x426f2a['OpenchannelInteractionId']}});}return null;})[_0x2f4d('0x33')](handleEntityNotFound(_0x408d9c,null))[_0x2f4d('0x33')](function(_0x438ff7){if(_0x438ff7){return _0x438ff7[_0x2f4d('0x32')]({'UserId':_0x5bb09e['body']['UserId'],'read1stAt':_[_0x2f4d('0x63')](_0x438ff7['read1stAt'])?moment()[_0x2f4d('0x5d')](_0x2f4d('0x5e')):undefined});}return null;})['then'](function(_0x48ed27){if(_0x48ed27){_0x4f1041[_0x2f4d('0x64')]=_0x48ed27[_0x2f4d('0x61')]({'plain':!![]});interaction_log['info'](_0x2f4d('0x65'),_0x5bb09e[_0x2f4d('0x60')]['id'],_0x5bb09e['user'][_0x2f4d('0x36')],_0x5bb09e['user'][_0x2f4d('0x66')],_0x4f1041[_0x2f4d('0x64')]['id'],_0x5bb09e[_0x2f4d('0x57')]?JSON[_0x2f4d('0x20')](_0x5bb09e[_0x2f4d('0x57')]):_0x2f4d('0x67'));return respondWithRpcPromise('AcceptMessage',_0x2f4d('0x68'),_0x4f1041);}return null;})['then'](function(_0x112255){var _0x21b634=_0x2f4d('0x69')+_0x112255[_0x2f4d('0x24')][_0x2f4d('0x6a')];return db[_0x2f4d('0x6b')][_0x2f4d('0x3f')](_0x21b634,{'type':db['Sequelize']['QueryTypes'][_0x2f4d('0x6c')],'raw':!![]})[_0x2f4d('0x33')](function(_0x533417){return _0x533417;});})[_0x2f4d('0x33')](function(_0x253779){if(_0x253779){_0x4f1041['message'][_0x2f4d('0x6d')]=_0x253779[0x0];if(!_0x5bb09e[_0x2f4d('0x57')]['UserId'])return;return db[_0x2f4d('0x6e')][_0x2f4d('0x55')]({'where':{'id':_0x5bb09e[_0x2f4d('0x57')][_0x2f4d('0x5f')],'role':'agent'},'attributes':['id',_0x2f4d('0x36'),_0x2f4d('0x6f'),_0x2f4d('0x70'),_0x2f4d('0x71')],'raw':!![]});}return null;})[_0x2f4d('0x33')](function(_0x56776d){if(!_0x56776d)return null;_0x4f1041[_0x2f4d('0x24')][_0x2f4d('0x72')]=_0x56776d;return _0x4f1041;})[_0x2f4d('0x33')](function(_0x7e31d3){if(_0x7e31d3){if(_0x5bb09e['body'][_0x2f4d('0x73')]){_0x4f1041[_0x2f4d('0x24')][_0x2f4d('0x74')]=util[_0x2f4d('0x5d')](_0x2f4d('0x75'),_0x5bb09e[_0x2f4d('0x60')][_0x2f4d('0x36')]);_0x4f1041[_0x2f4d('0x24')][_0x2f4d('0x76')]=_0x4f1041['channel'];_0x4f1041[_0x2f4d('0x24')][_0x2f4d('0x77')]=_0x4f1041['channel'];_0x4f1041['message'][_0x2f4d('0x78')]=_0x2f4d('0x79');return respondWithRpcPromise(_0x2f4d('0x7a'),_0x2f4d('0x7a'),{'event':_0x2f4d('0x7b'),'message':_0x4f1041[_0x2f4d('0x24')]},client9002)[_0x2f4d('0x33')](function(){return _0x4f1041;});}return _0x4f1041;}return null;})[_0x2f4d('0x33')](respondWithResult(_0x408d9c,null))[_0x2f4d('0x26')](handleError(_0x408d9c,null));};var interaction_log=require(_0x2f4d('0x59'))(_0x2f4d('0x5a'));exports['reject']=function(_0x555d3b,_0x19b34b,_0x5190f6){var _0x256324={'agent':{},'channel':_0x2f4d('0x5b')};if(_0x555d3b[_0x2f4d('0x57')]['id']){delete _0x555d3b[_0x2f4d('0x57')]['id'];}_0x555d3b['body']['UserId']=_0x555d3b[_0x2f4d('0x57')][_0x2f4d('0x5f')]||_0x555d3b['user']['id'];_0x256324[_0x2f4d('0x72')]['id']=_0x555d3b[_0x2f4d('0x57')]['UserId'];return db['OpenchannelMessage'][_0x2f4d('0x55')]({'where':{'id':_0x555d3b['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x19b34b,null))[_0x2f4d('0x33')](function(_0x14c2db){if(_0x14c2db){_0x256324[_0x2f4d('0x24')]=_0x14c2db[_0x2f4d('0x61')]({'plain':!![]});return db[_0x2f4d('0x62')][_0x2f4d('0x55')]({'where':{'id':_0x14c2db[_0x2f4d('0x7c')]}});}return null;})[_0x2f4d('0x33')](handleEntityNotFound(_0x19b34b,null))[_0x2f4d('0x33')](function(_0x4acc81){if(_0x4acc81){_0x256324[_0x2f4d('0x64')]=_0x4acc81[_0x2f4d('0x61')]({'plain':!![]});interaction_log[_0x2f4d('0x1d')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x555d3b['user']['id'],_0x555d3b[_0x2f4d('0x60')][_0x2f4d('0x36')],_0x555d3b[_0x2f4d('0x60')][_0x2f4d('0x66')],_0x256324['interaction']['id'],_0x555d3b[_0x2f4d('0x57')]?JSON[_0x2f4d('0x20')](_0x555d3b[_0x2f4d('0x57')]):_0x2f4d('0x67'));return respondWithRpcPromise(_0x2f4d('0x7d'),_0x2f4d('0x7e'),_0x256324);}return null;})[_0x2f4d('0x33')](function(_0xc05111){var _0x3e62f1=_0x2f4d('0x69')+_0xc05111[_0x2f4d('0x24')]['ContactId'];return db['sequelize'][_0x2f4d('0x3f')](_0x3e62f1,{'type':db['Sequelize'][_0x2f4d('0x7f')][_0x2f4d('0x6c')],'raw':!![]})[_0x2f4d('0x33')](function(_0xf042b5){return _0xf042b5;});})[_0x2f4d('0x33')](function(_0x4ec0bb){if(_0x4ec0bb){_0x256324['message'][_0x2f4d('0x6d')]=_0x4ec0bb[0x0];if(!_0x555d3b[_0x2f4d('0x57')]['UserId'])return;return db[_0x2f4d('0x6e')]['find']({'where':{'id':_0x555d3b[_0x2f4d('0x57')][_0x2f4d('0x5f')],'role':_0x2f4d('0x72')},'attributes':['id',_0x2f4d('0x36'),_0x2f4d('0x6f'),_0x2f4d('0x70'),_0x2f4d('0x71')],'raw':!![]});}return null;})['then'](function(_0x5c1b9f){if(!_0x5c1b9f)return null;_0x256324[_0x2f4d('0x24')][_0x2f4d('0x72')]=_0x5c1b9f;return _0x256324;})['then'](function(_0x52abd9){if(_0x52abd9){_0x52abd9[_0x2f4d('0x24')][_0x2f4d('0x74')]=util[_0x2f4d('0x5d')](_0x2f4d('0x75'),_0x555d3b['user'][_0x2f4d('0x36')]);_0x52abd9[_0x2f4d('0x24')][_0x2f4d('0x76')]=_0x256324['channel'];_0x52abd9[_0x2f4d('0x24')][_0x2f4d('0x77')]=_0x256324[_0x2f4d('0x76')];_0x52abd9['message'][_0x2f4d('0x78')]=_0x2f4d('0x30');respondWithRpcPromise(_0x2f4d('0x7a'),_0x2f4d('0x7a'),{'event':'rejectmessage','message':_0x52abd9[_0x2f4d('0x24')]},client9002);return _0x256324;}return null;})[_0x2f4d('0x33')](respondWithResult(_0x19b34b,null))[_0x2f4d('0x26')](handleError(_0x19b34b,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index c0955d2..b2c73ea 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 _0x4a9d=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x38d0ac,_0x34c2be){var _0x35066c=function(_0x2a4df1){while(--_0x2a4df1){_0x38d0ac['push'](_0x38d0ac['shift']());}};_0x35066c(++_0x34c2be);}(_0x4a9d,0x89));var _0xd4a9=function(_0x389af6,_0x5b9b93){_0x389af6=_0x389af6-0x0;var _0xd02de9=_0x4a9d[_0x389af6];return _0xd02de9;};'use strict';var EventEmitter=require(_0xd4a9('0x0'));var OpenchannelMessage=require(_0xd4a9('0x1'))['db'][_0xd4a9('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xd4a9('0x3')](0x0);var events={'afterCreate':_0xd4a9('0x4'),'afterUpdate':_0xd4a9('0x5'),'afterDestroy':_0xd4a9('0x6')};function emitEvent(_0x2ff521){return function(_0x544386,_0x5da2fe,_0x14779c){OpenchannelMessageEvents[_0xd4a9('0x7')](_0x2ff521+':'+_0x544386['id'],_0x544386);OpenchannelMessageEvents[_0xd4a9('0x7')](_0x2ff521,_0x544386);_0x14779c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xd4a9('0x8')](e,emitEvent(event));}}module[_0xd4a9('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xdc24=['update','emit','hook','exports','../../mysqldb'];(function(_0x200bb0,_0x142769){var _0x3bddb5=function(_0x55d77d){while(--_0x55d77d){_0x200bb0['push'](_0x200bb0['shift']());}};_0x3bddb5(++_0x142769);}(_0xdc24,0x1d0));var _0x4dc2=function(_0x4ae056,_0x1d730e){_0x4ae056=_0x4ae056-0x0;var _0x57b50a=_0xdc24[_0x4ae056];return _0x57b50a;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x4dc2('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4dc2('0x1'),'afterDestroy':'remove'};function emitEvent(_0x2ef185){return function(_0x3e5c0c,_0xf657df,_0x532508){OpenchannelMessageEvents[_0x4dc2('0x2')](_0x2ef185+':'+_0x3e5c0c['id'],_0x3e5c0c);OpenchannelMessageEvents[_0x4dc2('0x2')](_0x2ef185,_0x3e5c0c);_0x532508(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x4dc2('0x3')](e,emitEvent(event));}}module[_0x4dc2('0x4')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 4a2bc6b..846ec89 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 _0x9ffd=['OpenchannelAccountId','Interactions','Contact','keys','replyUri','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','GET','POST','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','threadId','update','error','inspect','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt','catch','CmContact','describe','OpenchannelAccount','find'];(function(_0x46b1af,_0x4ab973){var _0x494611=function(_0x284ac2){while(--_0x284ac2){_0x46b1af['push'](_0x46b1af['shift']());}};_0x494611(++_0x4ab973);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x3a77ac,_0x5d49fc){_0x3a77ac=_0x3a77ac-0x0;var _0x18c8aa=_0x9ffd[_0x3a77ac];return _0x18c8aa;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('api');var moment=require(_0xd9ff('0x3'));var BPromise=require(_0xd9ff('0x4'));var rp=require(_0xd9ff('0x5'));var fs=require('fs');var path=require(_0xd9ff('0x6'));var rimraf=require('rimraf');var config=require(_0xd9ff('0x7'));var attributes=require(_0xd9ff('0x8'));module['exports']=function(_0x3aa26b,_0x2982c3){return _0x3aa26b[_0xd9ff('0x9')](_0xd9ff('0xa'),attributes,{'tableName':_0xd9ff('0xb'),'paranoid':![],'indexes':[{'name':_0xd9ff('0xc'),'fields':[_0xd9ff('0xd')],'type':_0xd9ff('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x977487,_0x58e728,_0x54a555){var _0x567f79=_0x3aa26b['models'];var _0x2355ab=_0x977487[_0xd9ff('0xf')]({'plain':!![]});if(_0x2355ab[_0xd9ff('0x10')][_0xd9ff('0x11')]()==='in'||_0x2355ab[_0xd9ff('0x10')][_0xd9ff('0x11')]()===_0xd9ff('0x12')&&!_0x2355ab[_0xd9ff('0x13')]&&!_['isNil'](_0x2355ab['UserId'])){_0x567f79[_0xd9ff('0x14')][_0xd9ff('0x15')]({'where':{'id':_0x2355ab[_0xd9ff('0x16')]}})[_0xd9ff('0x17')](function(_0x12c39a){if(_0x12c39a){_0x12c39a['update']({'lastMsgAt':_0x2355ab[_0xd9ff('0x18')],'lastMsgDirection':_0x2355ab[_0xd9ff('0x10')]['toLowerCase']()});}})[_0xd9ff('0x19')](function(_0x5db010){console['error'](_0x5db010);});}if(_0x2355ab['direction']==='out'&&!_0x2355ab[_0xd9ff('0x13')]){var _0x4f9d6d;_0x567f79[_0xd9ff('0x1a')][_0xd9ff('0x1b')]()[_0xd9ff('0x17')](function(_0x3afd19){return _0x567f79[_0xd9ff('0x1c')][_0xd9ff('0x1d')]({'where':{'id':_0x2355ab[_0xd9ff('0x1e')]},'include':[{'model':_0x567f79[_0xd9ff('0x14')],'as':_0xd9ff('0x1f'),'where':{'id':_0x2355ab[_0xd9ff('0x16')]},'limit':0x1,'include':[{'model':_0x567f79[_0xd9ff('0x1a')],'as':_0xd9ff('0x20'),'attributes':_[_0xd9ff('0x21')](_0x3afd19)}]}]});})['then'](function(_0x4cf8ec){_0x4f9d6d=_0x4cf8ec[_0xd9ff('0xf')]({'plain':!![]});if(_0x4f9d6d&&_0x4f9d6d[_0xd9ff('0x22')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['format'](_0xd9ff('0x23'),_0x2355ab['id'],_0x4f9d6d['replyUri']));if(_0x4f9d6d[_0xd9ff('0x1f')]&&_0x4f9d6d[_0xd9ff('0x1f')][_0xd9ff('0x24')]){_0x2355ab[_0xd9ff('0x25')]=_[_0xd9ff('0x26')](_0x4f9d6d[_0xd9ff('0x1f')][0x0],'Contact');_0x2355ab['Contact']=_0x4f9d6d[_0xd9ff('0x1f')][0x0]['Contact'];}var _0x58e728={'method':'POST','uri':encodeURI(_0x4f9d6d[_0xd9ff('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x58e728['method']){case _0xd9ff('0x27'):_0x58e728['qs']=_0x2355ab;break;case _0xd9ff('0x28'):_0x58e728[_0xd9ff('0xd')]=_0x2355ab;break;}return rp(_0x58e728)[_0xd9ff('0x17')](function(_0x5d685e){logger[_0xd9ff('0x29')](_0xd9ff('0x2a'),_0xd9ff('0x2b'),util[_0xd9ff('0x2c')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x2355ab['id'],_0x4f9d6d[_0xd9ff('0x22')]));if(_0x5d685e[_0xd9ff('0xd')][_0xd9ff('0x2d')]&&_0x5d685e[_0xd9ff('0xd')][_0xd9ff('0x2d')]!=_0x2355ab[_0xd9ff('0x25')][_0xd9ff('0x2d')]){return _0x567f79[_0xd9ff('0x14')][_0xd9ff('0x2e')]({'threadId':_0x5d685e['body'][_0xd9ff('0x2d')]},{'logging':!![],'where':{'id':_0x2355ab['Interaction']['id']}});}else{return;}})[_0xd9ff('0x17')](function(){return _0x977487[_0xd9ff('0x2e')]({'read':!![]});})[_0xd9ff('0x19')](function(_0x552d08){logger[_0xd9ff('0x2f')](_0xd9ff('0x2a'),_0xd9ff('0x2b'),util[_0xd9ff('0x30')](_0x552d08,{'showHidden':![],'depth':null}));_0x54a555();});}else{_0x54a555();}})['finally'](function(){_0x54a555();});}else{_0x54a555();}}},'charset':_0xd9ff('0x31'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xefda=['request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','error','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','omit','POST','method','GET','format','threadId','inspect','finally','utf8mb4','lodash','api','moment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xefda,0x96));var _0xaefd=function(_0x4c914a,_0x217d99){_0x4c914a=_0x4c914a-0x0;var _0x531e3d=_0xefda[_0x4c914a];return _0x531e3d;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xaefd('0xc')],'type':_0xaefd('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x463ce7,_0x4d44ed,_0x48a255){var _0x54a3b1=_0x497258[_0xaefd('0xe')];var _0x16b36e=_0x463ce7[_0xaefd('0xf')]({'plain':!![]});if(_0x16b36e[_0xaefd('0x10')][_0xaefd('0x11')]()==='in'||_0x16b36e[_0xaefd('0x10')][_0xaefd('0x11')]()===_0xaefd('0x12')&&!_0x16b36e[_0xaefd('0x13')]&&!_[_0xaefd('0x14')](_0x16b36e[_0xaefd('0x15')])){_0x54a3b1['OpenchannelInteraction'][_0xaefd('0x16')]({'where':{'id':_0x16b36e['OpenchannelInteractionId']}})[_0xaefd('0x17')](function(_0x1725af){if(_0x1725af){_0x1725af[_0xaefd('0x18')]({'lastMsgAt':_0x16b36e[_0xaefd('0x19')],'lastMsgDirection':_0x16b36e['direction'][_0xaefd('0x11')]()});}})[_0xaefd('0x1a')](function(_0x41f345){console[_0xaefd('0x1b')](_0x41f345);});}if(_0x16b36e[_0xaefd('0x10')]===_0xaefd('0x12')&&!_0x16b36e[_0xaefd('0x13')]){var _0x23d736;_0x54a3b1['CmContact'][_0xaefd('0x1c')]()[_0xaefd('0x17')](function(_0x9748f4){return _0x54a3b1[_0xaefd('0x1d')][_0xaefd('0x1e')]({'where':{'id':_0x16b36e[_0xaefd('0x1f')]},'include':[{'model':_0x54a3b1['OpenchannelInteraction'],'as':_0xaefd('0x20'),'where':{'id':_0x16b36e[_0xaefd('0x21')]},'limit':0x1,'include':[{'model':_0x54a3b1[_0xaefd('0x22')],'as':_0xaefd('0x23'),'attributes':_[_0xaefd('0x24')](_0x9748f4)}]}]});})[_0xaefd('0x17')](function(_0x5282ed){_0x23d736=_0x5282ed[_0xaefd('0xf')]({'plain':!![]});if(_0x23d736&&_0x23d736[_0xaefd('0x25')]){logger[_0xaefd('0x26')](_0xaefd('0x27'),_0xaefd('0x28'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x16b36e['id'],_0x23d736['replyUri']));if(_0x23d736[_0xaefd('0x20')]&&_0x23d736[_0xaefd('0x20')][_0xaefd('0x29')]){_0x16b36e['Interaction']=_[_0xaefd('0x2a')](_0x23d736['Interactions'][0x0],_0xaefd('0x23'));_0x16b36e[_0xaefd('0x23')]=_0x23d736[_0xaefd('0x20')][0x0]['Contact'];}var _0x4d44ed={'method':_0xaefd('0x2b'),'uri':encodeURI(_0x23d736[_0xaefd('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4d44ed[_0xaefd('0x2c')]){case _0xaefd('0x2d'):_0x4d44ed['qs']=_0x16b36e;break;case'POST':_0x4d44ed[_0xaefd('0xc')]=_0x16b36e;break;}return rp(_0x4d44ed)['then'](function(_0x810bf){logger[_0xaefd('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0xaefd('0x28'),util[_0xaefd('0x2e')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x16b36e['id'],_0x23d736[_0xaefd('0x25')]));if(_0x810bf[_0xaefd('0xc')][_0xaefd('0x2f')]&&_0x810bf['body'][_0xaefd('0x2f')]!=_0x16b36e['Interaction'][_0xaefd('0x2f')]){return _0x54a3b1['OpenchannelInteraction']['update']({'threadId':_0x810bf[_0xaefd('0xc')][_0xaefd('0x2f')]},{'logging':!![],'where':{'id':_0x16b36e['Interaction']['id']}});}else{return;}})['then'](function(){return _0x463ce7['update']({'read':!![]});})[_0xaefd('0x1a')](function(_0x280eab){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xaefd('0x28'),util[_0xaefd('0x30')](_0x280eab,{'showHidden':![],'depth':null}));_0x48a255();});}else{_0x48a255();}})[_0xaefd('0x31')](function(){_0x48a255();});}else{_0x48a255();}}},'charset':_0xaefd('0x32'),'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 c1f5fda..c631f02 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x4586ac,_0x440adf){var _0x4df333=function(_0x2272ab){while(--_0x2272ab){_0x4586ac['push'](_0x4586ac['shift']());}};_0x4df333(++_0x440adf);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x257b97,_0x1339de){var _0x26e3ff=function(_0x237d07){while(--_0x237d07){_0x257b97['push'](_0x257b97['shift']());}};_0x26e3ff(++_0x1339de);}(_0x2ef3,0xba));var _0x32ef=function(_0x5f3dc2,_0x2befbe){_0x5f3dc2=_0x5f3dc2-0x0;var _0x244c28=_0x2ef3[_0x5f3dc2];return _0x244c28;};'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 82b94a1..e6a7823 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 _0x9a8d=['remove','update','removeListener','register','length','./openchannelMessage.events','save'];(function(_0x20432d,_0x162aef){var _0x3d47db=function(_0x463525){while(--_0x463525){_0x20432d['push'](_0x20432d['shift']());}};_0x3d47db(++_0x162aef);}(_0x9a8d,0xec));var _0xd9a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a8d[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require(_0xd9a8('0x0'));var events=[_0xd9a8('0x1'),_0xd9a8('0x2'),_0xd9a8('0x3')];function createListener(_0xb78551,_0x23b5d4){return function(_0x1052cb){_0x23b5d4['emit'](_0xb78551,_0x1052cb);};}function removeListener(_0x277eaf,_0x2c26ac){return function(){OpenchannelMessageEvents[_0xd9a8('0x4')](_0x277eaf,_0x2c26ac);};}exports[_0xd9a8('0x5')]=function(_0x5977fc){for(var _0xa1b818=0x0,_0x45d9d9=events[_0xd9a8('0x6')];_0xa1b818<_0x45d9d9;_0xa1b818++){var _0x510cae=events[_0xa1b818];var _0x19fb6d=createListener('openchannelMessage:'+_0x510cae,_0x5977fc);OpenchannelMessageEvents['on'](_0x510cae,_0x19fb6d);}}; \ No newline at end of file +var _0x958f=['save','remove','update','emit','removeListener','openchannelMessage:'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x958f,0x16e));var _0xf958=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x958f[_0x4ae6ef];return _0x3cbb4e;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xf958('0x0'),_0xf958('0x1'),_0xf958('0x2')];function createListener(_0x35758a,_0xbd09d9){return function(_0x4d8410){_0xbd09d9[_0xf958('0x3')](_0x35758a,_0x4d8410);};}function removeListener(_0x38b3f7,_0x5cf322){return function(){OpenchannelMessageEvents[_0xf958('0x4')](_0x38b3f7,_0x5cf322);};}exports['register']=function(_0x204612){for(var _0x1e0718=0x0,_0x7c19f4=events['length'];_0x1e0718<_0x7c19f4;_0x1e0718++){var _0x4f5a7a=events[_0x1e0718];var _0x4769ad=createListener(_0xf958('0x5')+_0x4f5a7a,_0x204612);OpenchannelMessageEvents['on'](_0x4f5a7a,_0x4769ad);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index ff654ce..950cc61 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 _0x11c2=['get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','getAgents','post','create','/:id/teams','addTeams','/:id/users','update','delete','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller'];(function(_0x53062a,_0x23dbe2){var _0x4aa1df=function(_0x354408){while(--_0x354408){_0x53062a['push'](_0x53062a['shift']());}};_0x4aa1df(++_0x23dbe2);}(_0x11c2,0xf2));var _0x211c=function(_0x48a07e,_0x49b0e0){_0x48a07e=_0x48a07e-0x0;var _0x1c435e=_0x11c2[_0x48a07e];return _0x1c435e;};'use strict';var multer=require('multer');var util=require(_0x211c('0x0'));var path=require(_0x211c('0x1'));var timeout=require(_0x211c('0x2'));var express=require(_0x211c('0x3'));var router=express[_0x211c('0x4')]();var fs_extra=require(_0x211c('0x5'));var auth=require(_0x211c('0x6'));var interaction=require(_0x211c('0x7'));var config=require(_0x211c('0x8'));var controller=require(_0x211c('0x9'));router[_0x211c('0xa')]('/',auth[_0x211c('0xb')](),controller[_0x211c('0xc')]);router[_0x211c('0xa')](_0x211c('0xd'),auth[_0x211c('0xb')](),controller[_0x211c('0xe')]);router[_0x211c('0xa')](_0x211c('0xf'),auth['isAuthenticated'](),controller[_0x211c('0x10')]);router[_0x211c('0xa')]('/:id/members',auth[_0x211c('0xb')](),controller[_0x211c('0x11')]);router[_0x211c('0xa')]('/:id/teams',auth[_0x211c('0xb')](),controller['getTeams']);router[_0x211c('0xa')]('/:id/users',auth[_0x211c('0xb')](),controller[_0x211c('0x12')]);router[_0x211c('0x13')]('/',auth[_0x211c('0xb')](),controller[_0x211c('0x14')]);router[_0x211c('0x13')](_0x211c('0x15'),auth[_0x211c('0xb')](),controller[_0x211c('0x16')]);router['post'](_0x211c('0x17'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0x211c('0xb')](),controller[_0x211c('0x18')]);router[_0x211c('0x19')]('/:id',auth[_0x211c('0xb')](),controller['destroy']);router[_0x211c('0x19')]('/:id/teams',auth[_0x211c('0xb')](),controller['removeTeams']);router[_0x211c('0x19')](_0x211c('0x17'),auth[_0x211c('0xb')](),controller[_0x211c('0x1a')]);module[_0x211c('0x1b')]=router; \ No newline at end of file +var _0x6d82=['update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelQueue.controller','index','get','/describe','isAuthenticated','describe','show','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d82,0x11c));var _0x26d8=function(_0x1c316c,_0x4095d8){_0x1c316c=_0x1c316c-0x0;var _0x45e867=_0x6d82[_0x1c316c];return _0x45e867;};'use strict';var multer=require(_0x26d8('0x0'));var util=require(_0x26d8('0x1'));var path=require(_0x26d8('0x2'));var timeout=require(_0x26d8('0x3'));var express=require(_0x26d8('0x4'));var router=express[_0x26d8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x26d8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x26d8('0x7'));var controller=require(_0x26d8('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x26d8('0x9')]);router[_0x26d8('0xa')](_0x26d8('0xb'),auth[_0x26d8('0xc')](),controller[_0x26d8('0xd')]);router[_0x26d8('0xa')]('/:id',auth[_0x26d8('0xc')](),controller[_0x26d8('0xe')]);router['get']('/:id/members',auth[_0x26d8('0xc')](),controller['getMembers']);router[_0x26d8('0xa')]('/:id/teams',auth[_0x26d8('0xc')](),controller[_0x26d8('0xf')]);router[_0x26d8('0xa')](_0x26d8('0x10'),auth[_0x26d8('0xc')](),controller[_0x26d8('0x11')]);router[_0x26d8('0x12')]('/',auth[_0x26d8('0xc')](),controller[_0x26d8('0x13')]);router['post']('/:id/teams',auth[_0x26d8('0xc')](),controller[_0x26d8('0x14')]);router[_0x26d8('0x12')](_0x26d8('0x10'),auth['isAuthenticated'](),controller[_0x26d8('0x15')]);router[_0x26d8('0x16')](_0x26d8('0x17'),auth[_0x26d8('0xc')](),controller[_0x26d8('0x18')]);router[_0x26d8('0x19')](_0x26d8('0x17'),auth[_0x26d8('0xc')](),controller[_0x26d8('0x1a')]);router[_0x26d8('0x19')]('/:id/teams',auth[_0x26d8('0xc')](),controller['removeTeams']);router[_0x26d8('0x19')](_0x26d8('0x10'),auth['isAuthenticated'](),controller[_0x26d8('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index c4c6758..1c099e6 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 _0x3b24=['sequelize','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x1347de,_0x15ed4d){var _0x26d3df=function(_0x3cdc01){while(--_0x3cdc01){_0x1347de['push'](_0x1347de['shift']());}};_0x26d3df(++_0x15ed4d);}(_0x3b24,0x1e6));var _0x43b2=function(_0x1bb02f,_0x5652d4){_0x1bb02f=_0x1bb02f-0x0;var _0x1bb5ad=_0x3b24[_0x1bb02f];return _0x1bb5ad;};'use strict';var Sequelize=require(_0x43b2('0x0'));module['exports']={'name':{'type':Sequelize[_0x43b2('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x43b2('0x1')]},'timeout':{'type':Sequelize[_0x43b2('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x43b2('0x3')](_0x43b2('0x4'),_0x43b2('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x5b94=['name','INTEGER','ENUM','rrmemory','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5b94,0xeb));var _0x45b9=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x5b94[_0x45783c];return _0x1161da;};'use strict';var Sequelize=require(_0x45b9('0x0'));module[_0x45b9('0x1')]={'name':{'type':Sequelize[_0x45b9('0x2')],'unique':_0x45b9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x45b9('0x2')]},'timeout':{'type':Sequelize[_0x45b9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x45b9('0x5')](_0x45b9('0x6'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index ede4dd5..e65247b 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 _0x95c7=['order','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','zip-dir','fast-json-patch','request-promise','util','sox','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','OpenchannelQueues','UserProfileResource','error','stack','name','index','map','OpenchannelQueue','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','user','role','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team'];(function(_0x3f62f0,_0x33555f){var _0xfd835a=function(_0x18b972){while(--_0x18b972){_0x3f62f0['push'](_0x3f62f0['shift']());}};_0xfd835a(++_0x33555f);}(_0x95c7,0x1ba));var _0x795c=function(_0x2e7460,_0x328a5f){_0x2e7460=_0x2e7460-0x0;var _0x258c14=_0x95c7[_0x2e7460];return _0x258c14;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x795c('0x0'));var jsonpatch=require(_0x795c('0x1'));var rp=require(_0x795c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x795c('0x3'));var path=require('path');var sox=require(_0x795c('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x795c('0x5'));var _=require(_0x795c('0x6'));var squel=require('squel');var crypto=require(_0x795c('0x7'));var jsforce=require(_0x795c('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x795c('0x9'));var querystring=require(_0x795c('0xa'));var Papa=require(_0x795c('0xb'));var Redis=require('ioredis');var authService=require(_0x795c('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x795c('0xd'));var logger=require(_0x795c('0xe'))(_0x795c('0xf'));var utils=require(_0x795c('0x10'));var config=require(_0x795c('0x11'));var licenseUtil=require(_0x795c('0x12'));var db=require('../../mysqldb')['db'];config[_0x795c('0x13')]=_[_0x795c('0x14')](config['redis'],{'host':_0x795c('0x15'),'port':0x18eb});var socket=require(_0x795c('0x16'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x795c('0x17')](socket);function respondWithStatusCode(_0xf9cd90,_0xf22840){_0xf22840=_0xf22840||0xcc;return function(_0x493305){if(_0x493305){return _0xf9cd90[_0x795c('0x18')](_0xf22840);}return _0xf9cd90[_0x795c('0x19')](_0xf22840)[_0x795c('0x1a')]();};}function respondWithResult(_0x320460,_0xdcb658){_0xdcb658=_0xdcb658||0xc8;return function(_0x3609f7){if(_0x3609f7){return _0x320460[_0x795c('0x19')](_0xdcb658)[_0x795c('0x1b')](_0x3609f7);}};}function respondWithFilteredResult(_0x23bb9c,_0x4d20a0){return function(_0x75739e){if(_0x75739e){var _0x4c1d1f=typeof _0x4d20a0[_0x795c('0x1c')]===_0x795c('0x1d')&&typeof _0x4d20a0[_0x795c('0x1e')]===_0x795c('0x1d');var _0x462e54=_0x75739e['count'];var _0x2e6359=_0x4c1d1f?0x0:_0x4d20a0[_0x795c('0x1c')];var _0x5e3214=_0x4c1d1f?_0x75739e[_0x795c('0x1f')]:_0x4d20a0['offset']+_0x4d20a0['limit'];var _0x257099;if(_0x5e3214>=_0x462e54){_0x5e3214=_0x462e54;_0x257099=0xc8;}else{_0x257099=0xce;}_0x23bb9c[_0x795c('0x19')](_0x257099);return _0x23bb9c[_0x795c('0x20')](_0x795c('0x21'),_0x2e6359+'-'+_0x5e3214+'/'+_0x462e54)['json'](_0x75739e);}return null;};}function patchUpdates(_0x35a812){return function(_0x5819a2){try{jsonpatch['apply'](_0x5819a2,_0x35a812,!![]);}catch(_0x81a862){return BPromise[_0x795c('0x22')](_0x81a862);}return _0x5819a2['save']();};}function saveUpdates(_0x11ee9c,_0x262011){return function(_0x2130d1){if(_0x2130d1){return _0x2130d1[_0x795c('0x23')](_0x11ee9c)[_0x795c('0x24')](function(_0x23b768){return _0x23b768;});}return null;};}function removeEntity(_0x2bd4d7,_0x422958){return function(_0x959638){if(_0x959638){return _0x959638['destroy']()[_0x795c('0x24')](function(){var _0x13ddfc=_0x959638['get']({'plain':!![]});var _0xbb90ed=_0x795c('0x25');return db[_0x795c('0x26')]['destroy']({'where':{'type':_0xbb90ed,'resourceId':_0x13ddfc['id']}})[_0x795c('0x24')](function(){return _0x959638;});})[_0x795c('0x24')](function(){_0x2bd4d7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ebcd9,_0x1fa6e0){return function(_0x4a56e4){if(!_0x4a56e4){_0x1ebcd9['sendStatus'](0x194);}return _0x4a56e4;};}function handleError(_0xd13edd,_0x382384){_0x382384=_0x382384||0x1f4;return function(_0x3fe8c9){logger[_0x795c('0x27')](_0x3fe8c9[_0x795c('0x28')]);if(_0x3fe8c9[_0x795c('0x29')]){delete _0x3fe8c9['name'];}_0xd13edd['status'](_0x382384)['send'](_0x3fe8c9);};}exports[_0x795c('0x2a')]=function(_0x31fd84,_0x413c10){var _0x4f1c7f={},_0xd32256={},_0x241231={'count':0x0,'rows':[]};var _0x51ee6b=_[_0x795c('0x2b')](db[_0x795c('0x2c')][_0x795c('0x2d')],function(_0x2686df){return{'name':_0x2686df['fieldName'],'type':_0x2686df[_0x795c('0x2e')][_0x795c('0x2f')]};});_0xd32256[_0x795c('0x30')]=_['map'](_0x51ee6b,_0x795c('0x29'));_0xd32256[_0x795c('0x31')]=_[_0x795c('0x32')](_0x31fd84['query']);_0xd32256['filters']=_[_0x795c('0x33')](_0xd32256[_0x795c('0x30')],_0xd32256['query']);_0x4f1c7f[_0x795c('0x34')]=_['intersection'](_0xd32256[_0x795c('0x30')],qs[_0x795c('0x35')](_0x31fd84['query'][_0x795c('0x35')]));_0x4f1c7f['attributes']=_0x4f1c7f['attributes'][_0x795c('0x36')]?_0x4f1c7f[_0x795c('0x34')]:_0xd32256[_0x795c('0x30')];if(!_0x31fd84['query'][_0x795c('0x37')](_0x795c('0x38'))){_0x4f1c7f[_0x795c('0x1e')]=qs[_0x795c('0x1e')](_0x31fd84[_0x795c('0x31')][_0x795c('0x1e')]);_0x4f1c7f[_0x795c('0x1c')]=qs[_0x795c('0x1c')](_0x31fd84['query']['offset']);}_0x4f1c7f['order']=qs[_0x795c('0x39')](_0x31fd84[_0x795c('0x31')][_0x795c('0x39')]);_0x4f1c7f[_0x795c('0x3a')]=qs[_0x795c('0x3b')](_[_0x795c('0x3c')](_0x31fd84['query'],_0xd32256[_0x795c('0x3b')]),_0x51ee6b);if(_0x31fd84['query'][_0x795c('0x3d')]){_0x4f1c7f['where']=_[_0x795c('0x3e')](_0x4f1c7f['where'],{'$or':_[_0x795c('0x2b')](_0x51ee6b,function(_0xc1be42){if(_0xc1be42[_0x795c('0x2e')]!==_0x795c('0x3f')){var _0x13ffd8={};_0x13ffd8[_0xc1be42['name']]={'$like':'%'+_0x31fd84['query'][_0x795c('0x3d')]+'%'};return _0x13ffd8;}})});}_0x4f1c7f=_[_0x795c('0x3e')]({},_0x4f1c7f,_0x31fd84[_0x795c('0x40')]);var _0xc940c0={'where':_0x4f1c7f[_0x795c('0x3a')]};return db[_0x795c('0x2c')][_0x795c('0x1f')](_0xc940c0)[_0x795c('0x24')](function(_0x352062){_0x241231[_0x795c('0x1f')]=_0x352062;if(_0x31fd84[_0x795c('0x31')][_0x795c('0x41')]){_0x4f1c7f[_0x795c('0x42')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x795c('0x43')](_0x4f1c7f);})[_0x795c('0x24')](function(_0x2cbce8){_0x241231[_0x795c('0x44')]=_0x2cbce8;return _0x241231;})[_0x795c('0x24')](respondWithFilteredResult(_0x413c10,_0x4f1c7f))['catch'](handleError(_0x413c10,null));};exports['show']=function(_0x7a8bb6,_0x1807f9){var _0xbeb79a={'raw':!![],'where':{'id':_0x7a8bb6[_0x795c('0x45')]['id']}},_0xc66f90={};_0xc66f90[_0x795c('0x30')]=_['keys'](db[_0x795c('0x2c')][_0x795c('0x2d')]);_0xc66f90['query']=_[_0x795c('0x32')](_0x7a8bb6['query']);_0xc66f90['filters']=_[_0x795c('0x33')](_0xc66f90[_0x795c('0x30')],_0xc66f90[_0x795c('0x31')]);_0xbeb79a[_0x795c('0x34')]=_[_0x795c('0x33')](_0xc66f90['model'],qs[_0x795c('0x35')](_0x7a8bb6['query']['fields']));_0xbeb79a[_0x795c('0x34')]=_0xbeb79a[_0x795c('0x34')][_0x795c('0x36')]?_0xbeb79a[_0x795c('0x34')]:_0xc66f90['model'];if(_0x7a8bb6[_0x795c('0x31')][_0x795c('0x41')]){_0xbeb79a[_0x795c('0x42')]=[{'all':!![]}];}_0xbeb79a=_[_0x795c('0x3e')]({},_0xbeb79a,_0x7a8bb6['options']);return db[_0x795c('0x2c')][_0x795c('0x46')](_0xbeb79a)[_0x795c('0x24')](handleEntityNotFound(_0x1807f9,null))[_0x795c('0x24')](respondWithResult(_0x1807f9,null))[_0x795c('0x47')](handleError(_0x1807f9,null));};exports[_0x795c('0x48')]=function(_0x245d54,_0x49ac87){return db[_0x795c('0x2c')]['create'](_0x245d54[_0x795c('0x49')],{})['then'](function(_0x490980){var _0xf13f07=_0x245d54[_0x795c('0x4a')]['get']({'plain':!![]});if(!_0xf13f07)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf13f07[_0x795c('0x4b')]===_0x795c('0x4a')){var _0x4c31ed=_0x490980[_0x795c('0x4c')]({'plain':!![]});var _0x4c6c62='OpenchannelQueues';return db['UserProfileSection']['find']({'where':{'name':_0x4c6c62,'userProfileId':_0xf13f07['userProfileId']},'raw':!![]})[_0x795c('0x24')](function(_0x4d288e){if(_0x4d288e&&_0x4d288e[_0x795c('0x4d')]===0x0){return db[_0x795c('0x26')][_0x795c('0x48')]({'name':_0x4c31ed[_0x795c('0x29')],'resourceId':_0x4c31ed['id'],'type':_0x4d288e[_0x795c('0x29')],'sectionId':_0x4d288e['id']},{})['then'](function(){return _0x490980;});}else{return _0x490980;}})[_0x795c('0x47')](function(_0x149b2e){logger[_0x795c('0x27')](_0x795c('0x4e'),_0x149b2e);throw _0x149b2e;});}return _0x490980;})['then'](respondWithResult(_0x49ac87,0xc9))[_0x795c('0x47')](handleError(_0x49ac87,null));};exports[_0x795c('0x23')]=function(_0x27ded7,_0x55c771){if(_0x27ded7[_0x795c('0x49')]['id']){delete _0x27ded7['body']['id'];}return db[_0x795c('0x2c')][_0x795c('0x46')]({'where':{'id':_0x27ded7['params']['id']}})['then'](handleEntityNotFound(_0x55c771,null))[_0x795c('0x24')](saveUpdates(_0x27ded7['body'],null))['then'](respondWithResult(_0x55c771,null))[_0x795c('0x47')](handleError(_0x55c771,null));};exports['destroy']=function(_0x495d19,_0x405f61){return db[_0x795c('0x2c')][_0x795c('0x46')]({'where':{'id':_0x495d19[_0x795c('0x45')]['id']}})[_0x795c('0x24')](handleEntityNotFound(_0x405f61,null))[_0x795c('0x24')](removeEntity(_0x405f61,null))[_0x795c('0x47')](handleError(_0x405f61,null));};exports['describe']=function(_0x3447e0,_0x208e66){return db['OpenchannelQueue'][_0x795c('0x4f')]()[_0x795c('0x24')](respondWithResult(_0x208e66,null))['catch'](handleError(_0x208e66,null));};exports[_0x795c('0x50')]=function(_0x1f0de1,_0x44e3a9,_0x1252f8){var _0x4201c6={'raw':!![],'where':{}},_0x520bad={},_0x4cc271;return db[_0x795c('0x2c')]['findOne']({'where':{'id':_0x1f0de1[_0x795c('0x45')]['id']}})[_0x795c('0x24')](handleEntityNotFound(_0x44e3a9,null))[_0x795c('0x24')](function(_0x420532){if(_0x420532){_0x4cc271=_0x420532[_0x795c('0x4c')]({'plain':!![]});_0x520bad['model']=_[_0x795c('0x32')](db[_0x795c('0x51')][_0x795c('0x2d')]);_0x520bad['query']=_[_0x795c('0x32')](_0x1f0de1[_0x795c('0x31')]);_0x520bad['filters']=_[_0x795c('0x33')](_0x520bad[_0x795c('0x30')],_0x520bad[_0x795c('0x31')]);_0x4201c6['attributes']=_['intersection'](_0x520bad[_0x795c('0x30')],qs[_0x795c('0x35')](_0x1f0de1[_0x795c('0x31')][_0x795c('0x35')]));_0x4201c6['attributes']=_0x4201c6[_0x795c('0x34')][_0x795c('0x36')]?_0x4201c6['attributes']:_0x520bad[_0x795c('0x30')];if(!_0x1f0de1[_0x795c('0x31')][_0x795c('0x37')](_0x795c('0x38'))){_0x4201c6[_0x795c('0x1e')]=qs[_0x795c('0x1e')](_0x1f0de1[_0x795c('0x31')]['limit']);_0x4201c6[_0x795c('0x1c')]=qs[_0x795c('0x1c')](_0x1f0de1[_0x795c('0x31')][_0x795c('0x1c')]);}_0x4201c6['order']=qs['sort'](_0x1f0de1[_0x795c('0x31')][_0x795c('0x39')]);_0x4201c6['where']=qs['filters'](_[_0x795c('0x3c')](_0x1f0de1[_0x795c('0x31')],_0x520bad[_0x795c('0x3b')]));_0x4201c6[_0x795c('0x3a')][_0x795c('0x52')]=_0x420532['id'];if(_0x1f0de1[_0x795c('0x31')][_0x795c('0x3d')]){_0x4201c6[_0x795c('0x3a')]=_[_0x795c('0x3e')](_0x4201c6['where'],{'$or':_[_0x795c('0x2b')](_0x4201c6[_0x795c('0x34')],function(_0x4a0872){var _0x73714f={};_0x73714f[_0x4a0872]={'$like':'%'+_0x1f0de1[_0x795c('0x31')][_0x795c('0x3d')]+'%'};return _0x73714f;})});}_0x4201c6=_[_0x795c('0x3e')]({},_0x4201c6,_0x1f0de1[_0x795c('0x40')]);return db[_0x795c('0x51')][_0x795c('0x43')](_0x4201c6);}})[_0x795c('0x24')](function(_0x49ac98){if(_0x49ac98){return db[_0x795c('0x53')][_0x795c('0x54')]({'where':{'id':_[_0x795c('0x2b')](_0x49ac98,_0x795c('0x55')),'role':_0x795c('0x56')},'attributes':['id',_0x795c('0x29'),_0x795c('0x57'),_0x795c('0x58'),_0x795c('0x59')]});}})['then'](function(_0x2251a3){if(_0x2251a3){return{'count':_0x2251a3[_0x795c('0x1f')],'rows':_[_0x795c('0x2b')](_0x2251a3[_0x795c('0x44')],function(_0x3a4f76){return{'membername':_0x3a4f76[_0x795c('0x29')],'UserId':_0x3a4f76['id'],'queue_name':_0x4cc271['name'],'OpenchannelQueueId':_0x4cc271['id'],'interface':util['format'](_0x795c('0x5a'),_0x795c('0x5b'),_0x3a4f76[_0x795c('0x29')]),'penalty':0x0,'paused':_0x3a4f76[_0x795c('0x57')],'createdAt':_0x3a4f76[_0x795c('0x59')],'updatedAt':_0x3a4f76['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x795c('0x24')](respondWithFilteredResult(_0x44e3a9,_0x4201c6))[_0x795c('0x47')](handleError(_0x44e3a9,null));};exports['getTeams']=function(_0x868be8,_0x1b08ad,_0x50b193){var _0x80f20e={};var _0x2346dc={};var _0x5147a9;var _0x49361f;return db[_0x795c('0x2c')][_0x795c('0x5c')]({'where':{'id':_0x868be8[_0x795c('0x45')]['id']}})[_0x795c('0x24')](handleEntityNotFound(_0x1b08ad,null))[_0x795c('0x24')](function(_0x2e781f){if(_0x2e781f){_0x5147a9=_0x2e781f;_0x2346dc[_0x795c('0x30')]=_[_0x795c('0x32')](db[_0x795c('0x5d')]['rawAttributes']);_0x2346dc[_0x795c('0x31')]=_[_0x795c('0x32')](_0x868be8[_0x795c('0x31')]);_0x2346dc['filters']=_[_0x795c('0x33')](_0x2346dc[_0x795c('0x30')],_0x2346dc[_0x795c('0x31')]);_0x80f20e[_0x795c('0x34')]=_[_0x795c('0x33')](_0x2346dc[_0x795c('0x30')],qs[_0x795c('0x35')](_0x868be8[_0x795c('0x31')][_0x795c('0x35')]));_0x80f20e[_0x795c('0x34')]=_0x80f20e[_0x795c('0x34')][_0x795c('0x36')]?_0x80f20e[_0x795c('0x34')]:_0x2346dc[_0x795c('0x30')];_0x80f20e[_0x795c('0x5e')]=qs[_0x795c('0x39')](_0x868be8[_0x795c('0x31')]['sort']);_0x80f20e[_0x795c('0x3a')]=qs[_0x795c('0x3b')](_[_0x795c('0x3c')](_0x868be8[_0x795c('0x31')],_0x2346dc[_0x795c('0x3b')]));if(_0x868be8['query'][_0x795c('0x3d')]){_0x80f20e[_0x795c('0x3a')]=_[_0x795c('0x3e')](_0x80f20e['where'],{'$or':_['map'](_0x80f20e[_0x795c('0x34')],function(_0x442b4b){var _0x51288d={};_0x51288d[_0x442b4b]={'$like':'%'+_0x868be8[_0x795c('0x31')][_0x795c('0x3d')]+'%'};return _0x51288d;})});}_0x80f20e=_[_0x795c('0x3e')]({},_0x80f20e,_0x868be8['options']);return _0x5147a9[_0x795c('0x5f')](_0x80f20e);}})['then'](function(_0x546b4d){if(_0x546b4d){_0x49361f=_0x546b4d[_0x795c('0x36')];if(!_0x868be8[_0x795c('0x31')][_0x795c('0x37')](_0x795c('0x38'))){_0x80f20e[_0x795c('0x1e')]=qs[_0x795c('0x1e')](_0x868be8[_0x795c('0x31')][_0x795c('0x1e')]);_0x80f20e[_0x795c('0x1c')]=qs[_0x795c('0x1c')](_0x868be8[_0x795c('0x31')]['offset']);}return _0x5147a9[_0x795c('0x5f')](_0x80f20e);}})[_0x795c('0x24')](function(_0x52c277){if(_0x52c277){return _0x52c277?{'count':_0x49361f,'rows':_0x52c277}:null;}})['then'](respondWithResult(_0x1b08ad,null))[_0x795c('0x47')](handleError(_0x1b08ad,null));};exports[_0x795c('0x60')]=function(_0x180cea,_0x2cd906,_0x313e77){var _0x317a02=_0x180cea[_0x795c('0x49')][_0x795c('0x61')];return db[_0x795c('0x5d')][_0x795c('0x43')]({'where':{'id':_0x317a02},'attributes':['id'],'include':[{'model':db[_0x795c('0x53')],'as':_0x795c('0x62'),'attributes':['id',_0x795c('0x29'),_0x795c('0x63'),_0x795c('0x64'),_0x795c('0x65')],'raw':!![]}]})[_0x795c('0x24')](function(_0x554e02){if(_0x554e02){var _0x3a2440=_[_0x795c('0x66')](_0x554e02,function(_0xae6655){var _0xefc6bd=_0xae6655[_0x795c('0x4c')]({'plain':!![]});return _0xefc6bd[_0x795c('0x62')];});return db[_0x795c('0x2c')]['find']({'where':{'id':_0x180cea[_0x795c('0x45')]['id']}})[_0x795c('0x24')](function(_0x3c5da4){return db[_0x795c('0x67')][_0x795c('0x68')](function(_0x44cf2c){return _0x3c5da4['addTeams'](_0x317a02,{'transaction':_0x44cf2c})[_0x795c('0x24')](function(){return BPromise[_0x795c('0x69')](_0x3a2440,function(_0x1c63f1){return db[_0x795c('0x51')][_0x795c('0x6a')]({'where':{'UserId':_0x1c63f1['id'],'OpenchannelQueueId':_0x180cea[_0x795c('0x45')]['id']},'transaction':_0x44cf2c});});})['then'](function(){_0x3a2440['forEach'](function(_0x3fe897){socket[_0x795c('0x6b')](_0x795c('0x6c'),{'UserId':_0x3fe897['id'],'OpenchannelQueueId':_0x3c5da4['id']});});});});});}})[_0x795c('0x24')](respondWithStatusCode(_0x2cd906,null))[_0x795c('0x47')](handleError(_0x2cd906,null));};exports[_0x795c('0x6d')]=function(_0x4c5459,_0x34694d,_0x374fa7){return db[_0x795c('0x5d')]['findAll']({'where':{'id':_0x4c5459[_0x795c('0x31')]['ids']},'attributes':['id'],'include':[{'model':db[_0x795c('0x53')],'as':_0x795c('0x62'),'attributes':['id'],'raw':!![]}]})[_0x795c('0x24')](handleEntityNotFound(_0x34694d,null))[_0x795c('0x24')](function(_0x310783){var _0xd7e751=_[_0x795c('0x2b')](_0x310783,'id');var _0xe53db3=[];var _0x30a02e=[];var _0x4a96e6=squel['select']();_0x4a96e6[_0x795c('0x6e')](_0x795c('0x6f'))[_0x795c('0x70')]('team_has_openchannel_queues','tq')[_0x795c('0x71')]('user_has_teams','ut',_0x795c('0x72'))[_0x795c('0x3a')](_0x795c('0x73'),_0x4c5459[_0x795c('0x45')]['id']);for(var _0x239b95=0x0;_0x239b95<_0x310783[_0x795c('0x36')];_0x239b95+=0x1){let _0x55636d=_0x310783[_0x239b95];for(var _0x50c4dc=0x0;_0x50c4dc<_0x55636d[_0x795c('0x62')][_0x795c('0x36')];_0x50c4dc+=0x1){let _0x3eb1ed=_0x55636d[_0x795c('0x62')][_0x50c4dc];var _0x5258a3=_0x4a96e6[_0x795c('0x74')]();_0x5258a3[_0x795c('0x3a')]('ut.UserId\x20=\x20?',_0x3eb1ed['id']);_0x30a02e[_0x795c('0x75')](db[_0x795c('0x67')][_0x795c('0x31')](_0x5258a3[_0x795c('0x76')](),{'type':db[_0x795c('0x67')][_0x795c('0x77')][_0x795c('0x78')]})['then'](function(_0x1e66ce){if(_0x1e66ce['length']===0x1){return _0x3eb1ed['id'];}else{var _0x441fd4=_[_0x795c('0x79')](_[_0x795c('0x2b')](_0x1e66ce,_0x795c('0x7a')),function(_0x1ac85b){return _['includes'](_0xd7e751,_0x1ac85b);});if(_0x441fd4){return _0x3eb1ed['id'];}}}));}}return BPromise[_0x795c('0x7b')](_0x30a02e)[_0x795c('0x24')](function(_0x4c5d86){_0xe53db3=_(_0xe53db3)['union'](_0x4c5d86)[_0x795c('0x7c')]()[_0x795c('0x7d')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x4c5459[_0x795c('0x45')]['id']}})[_0x795c('0x24')](function(_0x18943d){return db[_0x795c('0x67')]['transaction'](function(_0x749f46){return _0x18943d[_0x795c('0x6d')](_0x4c5459[_0x795c('0x31')]['ids'],{'transaction':_0x749f46})[_0x795c('0x24')](function(){if(!_['isEmpty'](_0xe53db3)){return _0x18943d[_0x795c('0x7e')](_0xe53db3,{'transaction':_0x749f46});}})['then'](function(){_0xe53db3[_0x795c('0x7f')](function(_0x4ab0db){socket[_0x795c('0x6b')](_0x795c('0x80'),{'UserId':_0x4ab0db,'OpenchannelQueueId':_0x18943d['id']});});});});});});})[_0x795c('0x24')](respondWithStatusCode(_0x34694d,null))[_0x795c('0x47')](handleError(_0x34694d,null));};exports[_0x795c('0x81')]=function(_0x119746,_0x67f15d,_0x13276b){return db[_0x795c('0x2c')][_0x795c('0x46')]({'where':{'id':_0x119746['params']['id']}})['then'](handleEntityNotFound(_0x67f15d,null))['then'](function(_0xd46e74){if(_0xd46e74){return _0xd46e74[_0x795c('0x81')](_0x119746[_0x795c('0x49')][_0x795c('0x61')],_[_0x795c('0x82')](_0x119746[_0x795c('0x49')],['ids','id'])||{})[_0x795c('0x83')](function(_0x2fc565){for(var _0x33edd9=0x0;_0x33edd9<_0x119746[_0x795c('0x49')]['ids'][_0x795c('0x36')];_0x33edd9+=0x1){socket[_0x795c('0x6b')](_0x795c('0x6c'),{'UserId':Number(_0x119746[_0x795c('0x49')][_0x795c('0x61')][_0x33edd9]),'OpenchannelQueueId':Number(_0x119746[_0x795c('0x45')]['id'])});}return _0x2fc565;});}})['then'](respondWithResult(_0x67f15d,null))['catch'](handleError(_0x67f15d,null));};exports['removeAgents']=function(_0x28ee78,_0x27a6da,_0x321f6e){return db[_0x795c('0x2c')][_0x795c('0x46')]({'where':{'id':_0x28ee78[_0x795c('0x45')]['id']}})[_0x795c('0x24')](handleEntityNotFound(_0x27a6da,null))[_0x795c('0x24')](function(_0x257111){if(_0x257111){return _0x257111[_0x795c('0x7e')](_0x28ee78[_0x795c('0x31')][_0x795c('0x61')])[_0x795c('0x24')](function(){if(_[_0x795c('0x84')](_0x28ee78[_0x795c('0x31')][_0x795c('0x61')])){for(var _0x22982a=0x0;_0x22982a<_0x28ee78[_0x795c('0x31')][_0x795c('0x61')][_0x795c('0x36')];_0x22982a+=0x1){socket[_0x795c('0x6b')](_0x795c('0x80'),{'UserId':Number(_0x28ee78[_0x795c('0x31')][_0x795c('0x61')][_0x22982a]),'OpenchannelQueueId':Number(_0x28ee78[_0x795c('0x45')]['id'])});}}else{socket[_0x795c('0x6b')]('userOpenchannelQueue:remove',{'UserId':Number(_0x28ee78[_0x795c('0x31')][_0x795c('0x61')]),'OpenchannelQueueId':Number(_0x28ee78[_0x795c('0x45')]['id'])});}});}})[_0x795c('0x24')](respondWithStatusCode(_0x27a6da,null))[_0x795c('0x47')](handleError(_0x27a6da,null));};exports['getAgents']=function(_0x1e04f1,_0x3300f5,_0x6e61b1){var _0x36d835={};var _0x1e6350={};var _0x17fb0b;var _0x4fe12f;return db[_0x795c('0x2c')][_0x795c('0x5c')]({'where':{'id':_0x1e04f1['params']['id']}})[_0x795c('0x24')](handleEntityNotFound(_0x3300f5,null))[_0x795c('0x24')](function(_0x26722c){if(_0x26722c){_0x17fb0b=_0x26722c;_0x1e6350[_0x795c('0x30')]=_['keys'](db['User'][_0x795c('0x2d')]);_0x1e6350[_0x795c('0x31')]=_[_0x795c('0x32')](_0x1e04f1[_0x795c('0x31')]);_0x1e6350[_0x795c('0x3b')]=_['intersection'](_0x1e6350[_0x795c('0x30')],_0x1e6350[_0x795c('0x31')]);_0x36d835['attributes']=_[_0x795c('0x33')](_0x1e6350[_0x795c('0x30')],qs[_0x795c('0x35')](_0x1e04f1['query'][_0x795c('0x35')]));_0x36d835[_0x795c('0x34')]=_0x36d835[_0x795c('0x34')][_0x795c('0x36')]?_0x36d835['attributes']:_0x1e6350[_0x795c('0x30')];_0x36d835[_0x795c('0x5e')]=qs[_0x795c('0x39')](_0x1e04f1['query'][_0x795c('0x39')]);_0x36d835[_0x795c('0x3a')]=qs[_0x795c('0x3b')](_['pick'](_0x1e04f1[_0x795c('0x31')],_0x1e6350['filters']));if(_0x1e04f1[_0x795c('0x31')][_0x795c('0x3d')]){_0x36d835[_0x795c('0x3a')]=_[_0x795c('0x3e')](_0x36d835[_0x795c('0x3a')],{'$or':_['map'](_0x36d835['attributes'],function(_0x3f6e01){var _0x1a55a8={};_0x1a55a8[_0x3f6e01]={'$like':'%'+_0x1e04f1['query']['filter']+'%'};return _0x1a55a8;})});}_0x36d835=_[_0x795c('0x3e')]({},_0x36d835,_0x1e04f1[_0x795c('0x40')]);return _0x17fb0b[_0x795c('0x85')](_0x36d835);}})[_0x795c('0x24')](function(_0xfea729){if(_0xfea729){_0x4fe12f=_0xfea729[_0x795c('0x36')];if(!_0x1e04f1[_0x795c('0x31')]['hasOwnProperty'](_0x795c('0x38'))){_0x36d835['limit']=qs[_0x795c('0x1e')](_0x1e04f1[_0x795c('0x31')]['limit']);_0x36d835[_0x795c('0x1c')]=qs['offset'](_0x1e04f1[_0x795c('0x31')][_0x795c('0x1c')]);}return _0x17fb0b[_0x795c('0x85')](_0x36d835);}})[_0x795c('0x24')](function(_0x28fe3c){if(_0x28fe3c){return _0x28fe3c?{'count':_0x4fe12f,'rows':_0x28fe3c}:null;}})[_0x795c('0x24')](respondWithResult(_0x3300f5,null))[_0x795c('0x47')](handleError(_0x3300f5,null));}; \ No newline at end of file +var _0xb626=['reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','send','map','OpenchannelQueue','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','get','role','user','UserProfileSection','userProfileId','autoAssociation','body','describe','getMembers','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','openchannelPause','getTeams','Team','voicePause','flatMap','Agents','sequelize','transaction','addTeams','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','compact','value','isEmpty','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply'];(function(_0x2fc113,_0x45ec6e){var _0x5144ce=function(_0x47fd29){while(--_0x47fd29){_0x2fc113['push'](_0x2fc113['shift']());}};_0x5144ce(++_0x45ec6e);}(_0xb626,0xf7));var _0x6b62=function(_0x10fb34,_0x51681f){_0x10fb34=_0x10fb34-0x0;var _0x1ea8b1=_0xb626[_0x10fb34];return _0x1ea8b1;};'use strict';var emlformat=require(_0x6b62('0x0'));var rimraf=require(_0x6b62('0x1'));var zipdir=require(_0x6b62('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6b62('0x3'));var BPromise=require(_0x6b62('0x4'));var Mustache=require(_0x6b62('0x5'));var util=require('util');var path=require(_0x6b62('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6b62('0x7'));var fs=require('fs');var fs_extra=require(_0x6b62('0x8'));var _=require(_0x6b62('0x9'));var squel=require('squel');var crypto=require(_0x6b62('0xa'));var jsforce=require(_0x6b62('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6b62('0xc'));var querystring=require(_0x6b62('0xd'));var Papa=require(_0x6b62('0xe'));var Redis=require(_0x6b62('0xf'));var authService=require(_0x6b62('0x10'));var qs=require(_0x6b62('0x11'));var as=require(_0x6b62('0x12'));var hardwareService=require(_0x6b62('0x13'));var logger=require(_0x6b62('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6b62('0x15'));var licenseUtil=require(_0x6b62('0x16'));var db=require(_0x6b62('0x17'))['db'];config[_0x6b62('0x18')]=_[_0x6b62('0x19')](config['redis'],{'host':_0x6b62('0x1a'),'port':0x18eb});var socket=require(_0x6b62('0x1b'))(new Redis(config[_0x6b62('0x18')]));require(_0x6b62('0x1c'))[_0x6b62('0x1d')](socket);function respondWithStatusCode(_0x475bd3,_0x21e5ec){_0x21e5ec=_0x21e5ec||0xcc;return function(_0x542dca){if(_0x542dca){return _0x475bd3[_0x6b62('0x1e')](_0x21e5ec);}return _0x475bd3[_0x6b62('0x1f')](_0x21e5ec)[_0x6b62('0x20')]();};}function respondWithResult(_0x38a4e5,_0x25a5ca){_0x25a5ca=_0x25a5ca||0xc8;return function(_0x1ccf1d){if(_0x1ccf1d){return _0x38a4e5[_0x6b62('0x1f')](_0x25a5ca)['json'](_0x1ccf1d);}};}function respondWithFilteredResult(_0x2fd88e,_0x2d29d1){return function(_0x3e67ee){if(_0x3e67ee){var _0x208b2f=typeof _0x2d29d1[_0x6b62('0x21')]===_0x6b62('0x22')&&typeof _0x2d29d1['limit']===_0x6b62('0x22');var _0x42f25e=_0x3e67ee[_0x6b62('0x23')];var _0x485c3d=_0x208b2f?0x0:_0x2d29d1[_0x6b62('0x21')];var _0x112f93=_0x208b2f?_0x3e67ee[_0x6b62('0x23')]:_0x2d29d1[_0x6b62('0x21')]+_0x2d29d1[_0x6b62('0x24')];var _0x2df998;if(_0x112f93>=_0x42f25e){_0x112f93=_0x42f25e;_0x2df998=0xc8;}else{_0x2df998=0xce;}_0x2fd88e['status'](_0x2df998);return _0x2fd88e[_0x6b62('0x25')](_0x6b62('0x26'),_0x485c3d+'-'+_0x112f93+'/'+_0x42f25e)[_0x6b62('0x27')](_0x3e67ee);}return null;};}function patchUpdates(_0x16bbff){return function(_0x2f808e){try{jsonpatch[_0x6b62('0x28')](_0x2f808e,_0x16bbff,!![]);}catch(_0xf96ff3){return BPromise[_0x6b62('0x29')](_0xf96ff3);}return _0x2f808e[_0x6b62('0x2a')]();};}function saveUpdates(_0x39caa3,_0x19d2a3){return function(_0xa0d151){if(_0xa0d151){return _0xa0d151[_0x6b62('0x2b')](_0x39caa3)[_0x6b62('0x2c')](function(_0x5b4617){return _0x5b4617;});}return null;};}function removeEntity(_0x1301b1,_0x29de43){return function(_0x438e0a){if(_0x438e0a){return _0x438e0a[_0x6b62('0x2d')]()['then'](function(){var _0x1d7ae4=_0x438e0a['get']({'plain':!![]});var _0x32e1a0=_0x6b62('0x2e');return db[_0x6b62('0x2f')]['destroy']({'where':{'type':_0x32e1a0,'resourceId':_0x1d7ae4['id']}})['then'](function(){return _0x438e0a;});})[_0x6b62('0x2c')](function(){_0x1301b1['status'](0xcc)[_0x6b62('0x20')]();});}};}function handleEntityNotFound(_0x126ac5,_0x2fd6dd){return function(_0x1bd663){if(!_0x1bd663){_0x126ac5[_0x6b62('0x1e')](0x194);}return _0x1bd663;};}function handleError(_0x529ff9,_0x353ee8){_0x353ee8=_0x353ee8||0x1f4;return function(_0x74f40){logger[_0x6b62('0x30')](_0x74f40[_0x6b62('0x31')]);if(_0x74f40[_0x6b62('0x32')]){delete _0x74f40[_0x6b62('0x32')];}_0x529ff9[_0x6b62('0x1f')](_0x353ee8)[_0x6b62('0x33')](_0x74f40);};}exports['index']=function(_0x1f0454,_0x450955){var _0x1876db={},_0x3e3b85={},_0x14aa52={'count':0x0,'rows':[]};var _0x5961e8=_[_0x6b62('0x34')](db[_0x6b62('0x35')]['rawAttributes'],function(_0x34176b){return{'name':_0x34176b[_0x6b62('0x36')],'type':_0x34176b[_0x6b62('0x37')][_0x6b62('0x38')]};});_0x3e3b85['model']=_['map'](_0x5961e8,_0x6b62('0x32'));_0x3e3b85[_0x6b62('0x39')]=_[_0x6b62('0x3a')](_0x1f0454[_0x6b62('0x39')]);_0x3e3b85[_0x6b62('0x3b')]=_[_0x6b62('0x3c')](_0x3e3b85[_0x6b62('0x3d')],_0x3e3b85['query']);_0x1876db[_0x6b62('0x3e')]=_[_0x6b62('0x3c')](_0x3e3b85[_0x6b62('0x3d')],qs[_0x6b62('0x3f')](_0x1f0454[_0x6b62('0x39')][_0x6b62('0x3f')]));_0x1876db[_0x6b62('0x3e')]=_0x1876db['attributes']['length']?_0x1876db[_0x6b62('0x3e')]:_0x3e3b85[_0x6b62('0x3d')];if(!_0x1f0454[_0x6b62('0x39')][_0x6b62('0x40')](_0x6b62('0x41'))){_0x1876db['limit']=qs[_0x6b62('0x24')](_0x1f0454[_0x6b62('0x39')][_0x6b62('0x24')]);_0x1876db[_0x6b62('0x21')]=qs[_0x6b62('0x21')](_0x1f0454[_0x6b62('0x39')][_0x6b62('0x21')]);}_0x1876db[_0x6b62('0x42')]=qs[_0x6b62('0x43')](_0x1f0454[_0x6b62('0x39')][_0x6b62('0x43')]);_0x1876db[_0x6b62('0x44')]=qs[_0x6b62('0x3b')](_['pick'](_0x1f0454[_0x6b62('0x39')],_0x3e3b85[_0x6b62('0x3b')]),_0x5961e8);if(_0x1f0454['query'][_0x6b62('0x45')]){_0x1876db[_0x6b62('0x44')]=_[_0x6b62('0x46')](_0x1876db[_0x6b62('0x44')],{'$or':_[_0x6b62('0x34')](_0x5961e8,function(_0x1df4c7){if(_0x1df4c7['type']!==_0x6b62('0x47')){var _0x555729={};_0x555729[_0x1df4c7[_0x6b62('0x32')]]={'$like':'%'+_0x1f0454[_0x6b62('0x39')][_0x6b62('0x45')]+'%'};return _0x555729;}})});}_0x1876db=_[_0x6b62('0x46')]({},_0x1876db,_0x1f0454[_0x6b62('0x48')]);var _0x243d74={'where':_0x1876db[_0x6b62('0x44')]};return db[_0x6b62('0x35')][_0x6b62('0x23')](_0x243d74)[_0x6b62('0x2c')](function(_0x1e8bde){_0x14aa52['count']=_0x1e8bde;if(_0x1f0454[_0x6b62('0x39')][_0x6b62('0x49')]){_0x1876db['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0x6b62('0x4a')](_0x1876db);})[_0x6b62('0x2c')](function(_0xdc4d86){_0x14aa52[_0x6b62('0x4b')]=_0xdc4d86;return _0x14aa52;})[_0x6b62('0x2c')](respondWithFilteredResult(_0x450955,_0x1876db))[_0x6b62('0x4c')](handleError(_0x450955,null));};exports[_0x6b62('0x4d')]=function(_0x376a2c,_0x32fe04){var _0xe5c483={'raw':!![],'where':{'id':_0x376a2c[_0x6b62('0x4e')]['id']}},_0x45f01f={};_0x45f01f[_0x6b62('0x3d')]=_['keys'](db[_0x6b62('0x35')][_0x6b62('0x4f')]);_0x45f01f[_0x6b62('0x39')]=_[_0x6b62('0x3a')](_0x376a2c[_0x6b62('0x39')]);_0x45f01f[_0x6b62('0x3b')]=_[_0x6b62('0x3c')](_0x45f01f[_0x6b62('0x3d')],_0x45f01f[_0x6b62('0x39')]);_0xe5c483[_0x6b62('0x3e')]=_[_0x6b62('0x3c')](_0x45f01f[_0x6b62('0x3d')],qs['fields'](_0x376a2c[_0x6b62('0x39')]['fields']));_0xe5c483['attributes']=_0xe5c483[_0x6b62('0x3e')][_0x6b62('0x50')]?_0xe5c483[_0x6b62('0x3e')]:_0x45f01f[_0x6b62('0x3d')];if(_0x376a2c[_0x6b62('0x39')]['includeAll']){_0xe5c483[_0x6b62('0x51')]=[{'all':!![]}];}_0xe5c483=_[_0x6b62('0x46')]({},_0xe5c483,_0x376a2c[_0x6b62('0x48')]);return db[_0x6b62('0x35')][_0x6b62('0x52')](_0xe5c483)[_0x6b62('0x2c')](handleEntityNotFound(_0x32fe04,null))[_0x6b62('0x2c')](respondWithResult(_0x32fe04,null))[_0x6b62('0x4c')](handleError(_0x32fe04,null));};exports[_0x6b62('0x53')]=function(_0x33db64,_0x3f0a3b){return db[_0x6b62('0x35')]['create'](_0x33db64['body'],{})[_0x6b62('0x2c')](function(_0x3d7949){var _0x486b37=_0x33db64['user'][_0x6b62('0x54')]({'plain':!![]});if(!_0x486b37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x486b37[_0x6b62('0x55')]===_0x6b62('0x56')){var _0x5aec73=_0x3d7949[_0x6b62('0x54')]({'plain':!![]});var _0x68d2b6=_0x6b62('0x2e');return db[_0x6b62('0x57')][_0x6b62('0x52')]({'where':{'name':_0x68d2b6,'userProfileId':_0x486b37[_0x6b62('0x58')]},'raw':!![]})['then'](function(_0x5d9226){if(_0x5d9226&&_0x5d9226[_0x6b62('0x59')]===0x0){return db[_0x6b62('0x2f')][_0x6b62('0x53')]({'name':_0x5aec73[_0x6b62('0x32')],'resourceId':_0x5aec73['id'],'type':_0x5d9226[_0x6b62('0x32')],'sectionId':_0x5d9226['id']},{})[_0x6b62('0x2c')](function(){return _0x3d7949;});}else{return _0x3d7949;}})[_0x6b62('0x4c')](function(_0x251d26){logger[_0x6b62('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x251d26);throw _0x251d26;});}return _0x3d7949;})[_0x6b62('0x2c')](respondWithResult(_0x3f0a3b,0xc9))[_0x6b62('0x4c')](handleError(_0x3f0a3b,null));};exports['update']=function(_0x45f0d1,_0x572fe9){if(_0x45f0d1['body']['id']){delete _0x45f0d1[_0x6b62('0x5a')]['id'];}return db[_0x6b62('0x35')][_0x6b62('0x52')]({'where':{'id':_0x45f0d1[_0x6b62('0x4e')]['id']}})[_0x6b62('0x2c')](handleEntityNotFound(_0x572fe9,null))[_0x6b62('0x2c')](saveUpdates(_0x45f0d1[_0x6b62('0x5a')],null))[_0x6b62('0x2c')](respondWithResult(_0x572fe9,null))[_0x6b62('0x4c')](handleError(_0x572fe9,null));};exports[_0x6b62('0x2d')]=function(_0x4b4563,_0x292c80){return db[_0x6b62('0x35')][_0x6b62('0x52')]({'where':{'id':_0x4b4563['params']['id']}})[_0x6b62('0x2c')](handleEntityNotFound(_0x292c80,null))[_0x6b62('0x2c')](removeEntity(_0x292c80,null))[_0x6b62('0x4c')](handleError(_0x292c80,null));};exports[_0x6b62('0x5b')]=function(_0x231532,_0x450e71){return db[_0x6b62('0x35')][_0x6b62('0x5b')]()['then'](respondWithResult(_0x450e71,null))[_0x6b62('0x4c')](handleError(_0x450e71,null));};exports[_0x6b62('0x5c')]=function(_0x93966d,_0x17097f,_0x2416f5){var _0x1924aa={'raw':!![],'where':{}},_0x14496a={},_0x1975a7;return db[_0x6b62('0x35')][_0x6b62('0x5d')]({'where':{'id':_0x93966d[_0x6b62('0x4e')]['id']}})[_0x6b62('0x2c')](handleEntityNotFound(_0x17097f,null))[_0x6b62('0x2c')](function(_0x15534d){if(_0x15534d){_0x1975a7=_0x15534d[_0x6b62('0x54')]({'plain':!![]});_0x14496a[_0x6b62('0x3d')]=_[_0x6b62('0x3a')](db[_0x6b62('0x5e')][_0x6b62('0x4f')]);_0x14496a[_0x6b62('0x39')]=_[_0x6b62('0x3a')](_0x93966d['query']);_0x14496a['filters']=_['intersection'](_0x14496a[_0x6b62('0x3d')],_0x14496a[_0x6b62('0x39')]);_0x1924aa[_0x6b62('0x3e')]=_[_0x6b62('0x3c')](_0x14496a[_0x6b62('0x3d')],qs['fields'](_0x93966d[_0x6b62('0x39')][_0x6b62('0x3f')]));_0x1924aa[_0x6b62('0x3e')]=_0x1924aa['attributes'][_0x6b62('0x50')]?_0x1924aa[_0x6b62('0x3e')]:_0x14496a[_0x6b62('0x3d')];if(!_0x93966d[_0x6b62('0x39')]['hasOwnProperty']('nolimit')){_0x1924aa[_0x6b62('0x24')]=qs[_0x6b62('0x24')](_0x93966d[_0x6b62('0x39')]['limit']);_0x1924aa[_0x6b62('0x21')]=qs[_0x6b62('0x21')](_0x93966d[_0x6b62('0x39')][_0x6b62('0x21')]);}_0x1924aa['order']=qs[_0x6b62('0x43')](_0x93966d['query']['sort']);_0x1924aa[_0x6b62('0x44')]=qs[_0x6b62('0x3b')](_[_0x6b62('0x5f')](_0x93966d[_0x6b62('0x39')],_0x14496a[_0x6b62('0x3b')]));_0x1924aa['where'][_0x6b62('0x60')]=_0x15534d['id'];if(_0x93966d[_0x6b62('0x39')][_0x6b62('0x45')]){_0x1924aa[_0x6b62('0x44')]=_[_0x6b62('0x46')](_0x1924aa[_0x6b62('0x44')],{'$or':_[_0x6b62('0x34')](_0x1924aa[_0x6b62('0x3e')],function(_0x5abb8d){var _0x580a6b={};_0x580a6b[_0x5abb8d]={'$like':'%'+_0x93966d[_0x6b62('0x39')][_0x6b62('0x45')]+'%'};return _0x580a6b;})});}_0x1924aa=_[_0x6b62('0x46')]({},_0x1924aa,_0x93966d[_0x6b62('0x48')]);return db['UserOpenchannelQueue'][_0x6b62('0x4a')](_0x1924aa);}})[_0x6b62('0x2c')](function(_0x36779b){if(_0x36779b){return db[_0x6b62('0x61')][_0x6b62('0x62')]({'where':{'id':_[_0x6b62('0x34')](_0x36779b,_0x6b62('0x63')),'role':_0x6b62('0x64')},'attributes':['id',_0x6b62('0x32'),'openchannelPause',_0x6b62('0x65'),_0x6b62('0x66')]});}})[_0x6b62('0x2c')](function(_0x1897a0){if(_0x1897a0){return{'count':_0x1897a0[_0x6b62('0x23')],'rows':_[_0x6b62('0x34')](_0x1897a0[_0x6b62('0x4b')],function(_0x433e33){return{'membername':_0x433e33[_0x6b62('0x32')],'UserId':_0x433e33['id'],'queue_name':_0x1975a7['name'],'OpenchannelQueueId':_0x1975a7['id'],'interface':util[_0x6b62('0x67')](_0x6b62('0x68'),_0x6b62('0x69'),_0x433e33[_0x6b62('0x32')]),'penalty':0x0,'paused':_0x433e33[_0x6b62('0x6a')],'createdAt':_0x433e33[_0x6b62('0x66')],'updatedAt':_0x433e33[_0x6b62('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6b62('0x2c')](respondWithFilteredResult(_0x17097f,_0x1924aa))[_0x6b62('0x4c')](handleError(_0x17097f,null));};exports[_0x6b62('0x6b')]=function(_0x5ca5f7,_0xf63e3a,_0x18279d){var _0x16ca16={};var _0xf09f26={};var _0x4368a7;var _0x97e6ee;return db[_0x6b62('0x35')][_0x6b62('0x5d')]({'where':{'id':_0x5ca5f7['params']['id']}})['then'](handleEntityNotFound(_0xf63e3a,null))[_0x6b62('0x2c')](function(_0x355eb3){if(_0x355eb3){_0x4368a7=_0x355eb3;_0xf09f26[_0x6b62('0x3d')]=_['keys'](db[_0x6b62('0x6c')][_0x6b62('0x4f')]);_0xf09f26['query']=_[_0x6b62('0x3a')](_0x5ca5f7[_0x6b62('0x39')]);_0xf09f26[_0x6b62('0x3b')]=_[_0x6b62('0x3c')](_0xf09f26[_0x6b62('0x3d')],_0xf09f26[_0x6b62('0x39')]);_0x16ca16[_0x6b62('0x3e')]=_['intersection'](_0xf09f26['model'],qs[_0x6b62('0x3f')](_0x5ca5f7[_0x6b62('0x39')][_0x6b62('0x3f')]));_0x16ca16[_0x6b62('0x3e')]=_0x16ca16['attributes'][_0x6b62('0x50')]?_0x16ca16[_0x6b62('0x3e')]:_0xf09f26[_0x6b62('0x3d')];_0x16ca16[_0x6b62('0x42')]=qs[_0x6b62('0x43')](_0x5ca5f7[_0x6b62('0x39')][_0x6b62('0x43')]);_0x16ca16[_0x6b62('0x44')]=qs[_0x6b62('0x3b')](_[_0x6b62('0x5f')](_0x5ca5f7[_0x6b62('0x39')],_0xf09f26[_0x6b62('0x3b')]));if(_0x5ca5f7[_0x6b62('0x39')][_0x6b62('0x45')]){_0x16ca16[_0x6b62('0x44')]=_[_0x6b62('0x46')](_0x16ca16['where'],{'$or':_[_0x6b62('0x34')](_0x16ca16[_0x6b62('0x3e')],function(_0x41be41){var _0x2d354b={};_0x2d354b[_0x41be41]={'$like':'%'+_0x5ca5f7[_0x6b62('0x39')][_0x6b62('0x45')]+'%'};return _0x2d354b;})});}_0x16ca16=_[_0x6b62('0x46')]({},_0x16ca16,_0x5ca5f7[_0x6b62('0x48')]);return _0x4368a7[_0x6b62('0x6b')](_0x16ca16);}})[_0x6b62('0x2c')](function(_0x1c0533){if(_0x1c0533){_0x97e6ee=_0x1c0533[_0x6b62('0x50')];if(!_0x5ca5f7[_0x6b62('0x39')][_0x6b62('0x40')](_0x6b62('0x41'))){_0x16ca16[_0x6b62('0x24')]=qs['limit'](_0x5ca5f7[_0x6b62('0x39')][_0x6b62('0x24')]);_0x16ca16[_0x6b62('0x21')]=qs[_0x6b62('0x21')](_0x5ca5f7['query'][_0x6b62('0x21')]);}return _0x4368a7[_0x6b62('0x6b')](_0x16ca16);}})[_0x6b62('0x2c')](function(_0x229ed2){if(_0x229ed2){return _0x229ed2?{'count':_0x97e6ee,'rows':_0x229ed2}:null;}})[_0x6b62('0x2c')](respondWithResult(_0xf63e3a,null))[_0x6b62('0x4c')](handleError(_0xf63e3a,null));};exports['addTeams']=function(_0x3881ba,_0x2fcc9d,_0x5c291e){var _0x5307fc=_0x3881ba['body']['ids'];return db[_0x6b62('0x6c')][_0x6b62('0x4a')]({'where':{'id':_0x5307fc},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x6b62('0x32'),'online',_0x6b62('0x6d'),'interface'],'raw':!![]}]})[_0x6b62('0x2c')](function(_0x531440){if(_0x531440){var _0x455cf8=_[_0x6b62('0x6e')](_0x531440,function(_0xffd191){var _0xefa3be=_0xffd191['get']({'plain':!![]});return _0xefa3be[_0x6b62('0x6f')];});return db[_0x6b62('0x35')][_0x6b62('0x52')]({'where':{'id':_0x3881ba['params']['id']}})['then'](function(_0x55668b){return db[_0x6b62('0x70')][_0x6b62('0x71')](function(_0x4d97a3){return _0x55668b[_0x6b62('0x72')](_0x5307fc,{'transaction':_0x4d97a3})[_0x6b62('0x2c')](function(){return BPromise[_0x6b62('0x73')](_0x455cf8,function(_0x59ea9b){return db['UserOpenchannelQueue'][_0x6b62('0x74')]({'where':{'UserId':_0x59ea9b['id'],'OpenchannelQueueId':_0x3881ba['params']['id']},'transaction':_0x4d97a3});});})[_0x6b62('0x2c')](function(){_0x455cf8['forEach'](function(_0xff3b16){socket[_0x6b62('0x75')](_0x6b62('0x76'),{'UserId':_0xff3b16['id'],'OpenchannelQueueId':_0x55668b['id']});});});});});}})['then'](respondWithStatusCode(_0x2fcc9d,null))[_0x6b62('0x4c')](handleError(_0x2fcc9d,null));};exports[_0x6b62('0x77')]=function(_0x2838b8,_0x593ef9,_0x1ad4ff){return db[_0x6b62('0x6c')][_0x6b62('0x4a')]({'where':{'id':_0x2838b8[_0x6b62('0x39')][_0x6b62('0x78')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6b62('0x2c')](handleEntityNotFound(_0x593ef9,null))[_0x6b62('0x2c')](function(_0x2d0c4f){var _0x324840=_['map'](_0x2d0c4f,'id');var _0xe13e6=[];var _0x23bce2=[];var _0x51e338=squel['select']();_0x51e338[_0x6b62('0x79')](_0x6b62('0x7a'))[_0x6b62('0x7b')](_0x6b62('0x7c'),'tq')[_0x6b62('0x7d')](_0x6b62('0x7e'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6b62('0x44')](_0x6b62('0x7f'),_0x2838b8[_0x6b62('0x4e')]['id']);for(var _0x5207ee=0x0;_0x5207ee<_0x2d0c4f[_0x6b62('0x50')];_0x5207ee+=0x1){let _0x474b73=_0x2d0c4f[_0x5207ee];for(var _0x56eca4=0x0;_0x56eca4<_0x474b73[_0x6b62('0x6f')][_0x6b62('0x50')];_0x56eca4+=0x1){let _0x307c5f=_0x474b73[_0x6b62('0x6f')][_0x56eca4];var _0x199654=_0x51e338[_0x6b62('0x80')]();_0x199654[_0x6b62('0x44')](_0x6b62('0x81'),_0x307c5f['id']);_0x23bce2[_0x6b62('0x82')](db[_0x6b62('0x70')][_0x6b62('0x39')](_0x199654[_0x6b62('0x83')](),{'type':db[_0x6b62('0x70')]['QueryTypes'][_0x6b62('0x84')]})['then'](function(_0x4aaab8){if(_0x4aaab8['length']===0x1){return _0x307c5f['id'];}else{var _0x408c75=_[_0x6b62('0x85')](_[_0x6b62('0x34')](_0x4aaab8,'TeamId'),function(_0x2eb301){return _['includes'](_0x324840,_0x2eb301);});if(_0x408c75){return _0x307c5f['id'];}}}));}}return BPromise['all'](_0x23bce2)[_0x6b62('0x2c')](function(_0x3bc8ef){_0xe13e6=_(_0xe13e6)['union'](_0x3bc8ef)[_0x6b62('0x86')]()[_0x6b62('0x87')]();return db[_0x6b62('0x35')][_0x6b62('0x52')]({'where':{'id':_0x2838b8[_0x6b62('0x4e')]['id']}})[_0x6b62('0x2c')](function(_0x557601){return db[_0x6b62('0x70')]['transaction'](function(_0x3a5d89){return _0x557601[_0x6b62('0x77')](_0x2838b8[_0x6b62('0x39')][_0x6b62('0x78')],{'transaction':_0x3a5d89})['then'](function(){if(!_[_0x6b62('0x88')](_0xe13e6)){return _0x557601['removeAgents'](_0xe13e6,{'transaction':_0x3a5d89});}})['then'](function(){_0xe13e6[_0x6b62('0x89')](function(_0x120de7){socket[_0x6b62('0x75')](_0x6b62('0x8a'),{'UserId':_0x120de7,'OpenchannelQueueId':_0x557601['id']});});});});});});})[_0x6b62('0x2c')](respondWithStatusCode(_0x593ef9,null))[_0x6b62('0x4c')](handleError(_0x593ef9,null));};exports[_0x6b62('0x8b')]=function(_0x3d867f,_0x1545d0,_0xcb7a4d){return db[_0x6b62('0x35')][_0x6b62('0x52')]({'where':{'id':_0x3d867f[_0x6b62('0x4e')]['id']}})[_0x6b62('0x2c')](handleEntityNotFound(_0x1545d0,null))[_0x6b62('0x2c')](function(_0x12ddf2){if(_0x12ddf2){return _0x12ddf2[_0x6b62('0x8b')](_0x3d867f[_0x6b62('0x5a')]['ids'],_[_0x6b62('0x8c')](_0x3d867f[_0x6b62('0x5a')],[_0x6b62('0x78'),'id'])||{})[_0x6b62('0x8d')](function(_0x11f777){for(var _0x703cdf=0x0;_0x703cdf<_0x3d867f[_0x6b62('0x5a')][_0x6b62('0x78')][_0x6b62('0x50')];_0x703cdf+=0x1){socket[_0x6b62('0x75')]('userOpenchannelQueue:save',{'UserId':Number(_0x3d867f['body'][_0x6b62('0x78')][_0x703cdf]),'OpenchannelQueueId':Number(_0x3d867f['params']['id'])});}return _0x11f777;});}})[_0x6b62('0x2c')](respondWithResult(_0x1545d0,null))[_0x6b62('0x4c')](handleError(_0x1545d0,null));};exports['removeAgents']=function(_0x3f46e0,_0x1e0460,_0x2e148c){return db['OpenchannelQueue'][_0x6b62('0x52')]({'where':{'id':_0x3f46e0[_0x6b62('0x4e')]['id']}})[_0x6b62('0x2c')](handleEntityNotFound(_0x1e0460,null))[_0x6b62('0x2c')](function(_0x505642){if(_0x505642){return _0x505642[_0x6b62('0x8e')](_0x3f46e0[_0x6b62('0x39')][_0x6b62('0x78')])[_0x6b62('0x2c')](function(){if(_['isArray'](_0x3f46e0[_0x6b62('0x39')][_0x6b62('0x78')])){for(var _0x2e9a61=0x0;_0x2e9a61<_0x3f46e0[_0x6b62('0x39')][_0x6b62('0x78')][_0x6b62('0x50')];_0x2e9a61+=0x1){socket[_0x6b62('0x75')]('userOpenchannelQueue:remove',{'UserId':Number(_0x3f46e0[_0x6b62('0x39')][_0x6b62('0x78')][_0x2e9a61]),'OpenchannelQueueId':Number(_0x3f46e0[_0x6b62('0x4e')]['id'])});}}else{socket[_0x6b62('0x75')](_0x6b62('0x8a'),{'UserId':Number(_0x3f46e0[_0x6b62('0x39')][_0x6b62('0x78')]),'OpenchannelQueueId':Number(_0x3f46e0[_0x6b62('0x4e')]['id'])});}});}})[_0x6b62('0x2c')](respondWithStatusCode(_0x1e0460,null))[_0x6b62('0x4c')](handleError(_0x1e0460,null));};exports['getAgents']=function(_0x2525b4,_0x3516cf,_0x5aec3d){var _0x2d477b={};var _0x2bf381={};var _0x1ed692;var _0xbfb492;return db[_0x6b62('0x35')][_0x6b62('0x5d')]({'where':{'id':_0x2525b4[_0x6b62('0x4e')]['id']}})[_0x6b62('0x2c')](handleEntityNotFound(_0x3516cf,null))['then'](function(_0x505f07){if(_0x505f07){_0x1ed692=_0x505f07;_0x2bf381[_0x6b62('0x3d')]=_['keys'](db['User']['rawAttributes']);_0x2bf381['query']=_['keys'](_0x2525b4['query']);_0x2bf381[_0x6b62('0x3b')]=_[_0x6b62('0x3c')](_0x2bf381[_0x6b62('0x3d')],_0x2bf381[_0x6b62('0x39')]);_0x2d477b[_0x6b62('0x3e')]=_['intersection'](_0x2bf381[_0x6b62('0x3d')],qs['fields'](_0x2525b4['query'][_0x6b62('0x3f')]));_0x2d477b['attributes']=_0x2d477b[_0x6b62('0x3e')][_0x6b62('0x50')]?_0x2d477b[_0x6b62('0x3e')]:_0x2bf381[_0x6b62('0x3d')];_0x2d477b[_0x6b62('0x42')]=qs[_0x6b62('0x43')](_0x2525b4[_0x6b62('0x39')][_0x6b62('0x43')]);_0x2d477b['where']=qs['filters'](_[_0x6b62('0x5f')](_0x2525b4[_0x6b62('0x39')],_0x2bf381[_0x6b62('0x3b')]));if(_0x2525b4[_0x6b62('0x39')][_0x6b62('0x45')]){_0x2d477b['where']=_[_0x6b62('0x46')](_0x2d477b[_0x6b62('0x44')],{'$or':_[_0x6b62('0x34')](_0x2d477b['attributes'],function(_0x14e68d){var _0x4f33c0={};_0x4f33c0[_0x14e68d]={'$like':'%'+_0x2525b4['query']['filter']+'%'};return _0x4f33c0;})});}_0x2d477b=_['merge']({},_0x2d477b,_0x2525b4[_0x6b62('0x48')]);return _0x1ed692['getAgents'](_0x2d477b);}})['then'](function(_0x26932c){if(_0x26932c){_0xbfb492=_0x26932c['length'];if(!_0x2525b4[_0x6b62('0x39')][_0x6b62('0x40')](_0x6b62('0x41'))){_0x2d477b[_0x6b62('0x24')]=qs[_0x6b62('0x24')](_0x2525b4[_0x6b62('0x39')][_0x6b62('0x24')]);_0x2d477b[_0x6b62('0x21')]=qs[_0x6b62('0x21')](_0x2525b4[_0x6b62('0x39')]['offset']);}return _0x1ed692[_0x6b62('0x8f')](_0x2d477b);}})[_0x6b62('0x2c')](function(_0x543fa6){if(_0x543fa6){return _0x543fa6?{'count':_0xbfb492,'rows':_0x543fa6}:null;}})[_0x6b62('0x2c')](respondWithResult(_0x3516cf,null))[_0x6b62('0x4c')](handleError(_0x3516cf,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 61c8e8e..58521d3 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 _0x6470=['hook','exports','events','OpenchannelQueue','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x4178b6,_0x443b9f){var _0x4b34bb=function(_0xd4bbe2){while(--_0xd4bbe2){_0x4178b6['push'](_0x4178b6['shift']());}};_0x4b34bb(++_0x443b9f);}(_0x6470,0x16a));var _0x0647=function(_0x19eeb4,_0x556632){_0x19eeb4=_0x19eeb4-0x0;var _0x502b4b=_0x6470[_0x19eeb4];return _0x502b4b;};'use strict';var EventEmitter=require(_0x0647('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x0647('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0647('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0647('0x3')};function emitEvent(_0x2e6fd8){return function(_0x45c9ff,_0x300431,_0x2a5885){OpenchannelQueueEvents[_0x0647('0x4')](_0x2e6fd8+':'+_0x45c9ff['id'],_0x45c9ff);OpenchannelQueueEvents[_0x0647('0x4')](_0x2e6fd8,_0x45c9ff);_0x2a5885(null);};}for(var e in events){if(events[_0x0647('0x5')](e)){var event=events[e];OpenchannelQueue[_0x0647('0x6')](e,emitEvent(event));}}module[_0x0647('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x1070=['save','update','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1070,0x139));var _0x0107=function(_0xfd6652,_0x2868d5){_0xfd6652=_0xfd6652-0x0;var _0x419137=_0x1070[_0xfd6652];return _0x419137;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x0107('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0107('0x1')](0x0);var events={'afterCreate':_0x0107('0x2'),'afterUpdate':_0x0107('0x3'),'afterDestroy':'remove'};function emitEvent(_0x38c6bc){return function(_0x22cbdf,_0x14b752,_0x216a50){OpenchannelQueueEvents['emit'](_0x38c6bc+':'+_0x22cbdf['id'],_0x22cbdf);OpenchannelQueueEvents[_0x0107('0x4')](_0x38c6bc,_0x22cbdf);_0x216a50(null);};}for(var e in events){if(events[_0x0107('0x5')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x0107('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index ce93bd6..0ae0545 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 _0xac2d=['../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','api','bluebird','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac2d,0xe1));var _0xdac2=function(_0x53a307,_0x3ba22b){_0x53a307=_0x53a307-0x0;var _0x1a0269=_0xac2d[_0x53a307];return _0x1a0269;};'use strict';var _=require(_0xdac2('0x0'));var util=require(_0xdac2('0x1'));var logger=require('../../config/logger')(_0xdac2('0x2'));var moment=require('moment');var BPromise=require(_0xdac2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdac2('0x4'));var rimraf=require(_0xdac2('0x5'));var config=require(_0xdac2('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0xdac2('0x7')]=function(_0x1561c7,_0x4b7aa6){return _0x1561c7[_0xdac2('0x8')](_0xdac2('0x9'),attributes,{'tableName':_0xdac2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ba1=['./openchannelQueue.attributes','exports','define','openchannel_queues','util','../../config/logger','moment','request-promise','../../config/environment'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x7ba1,0x175));var _0x17ba=function(_0xa78d92,_0x514c75){_0xa78d92=_0xa78d92-0x0;var _0x4a527a=_0x7ba1[_0xa78d92];return _0x4a527a;};'use strict';var _=require('lodash');var util=require(_0x17ba('0x0'));var logger=require(_0x17ba('0x1'))('api');var moment=require(_0x17ba('0x2'));var BPromise=require('bluebird');var rp=require(_0x17ba('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x17ba('0x4'));var attributes=require(_0x17ba('0x5'));module[_0x17ba('0x6')]=function(_0x428dc7,_0x39a337){return _0x428dc7[_0x17ba('0x7')]('OpenchannelQueue',attributes,{'tableName':_0x17ba('0x8'),'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 ddebad4..fc546e7 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 _0xa012=['include','map','model','attributes','debug','stringify','catch','ShowOpenchannelQueue','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','limit'];(function(_0x23b042,_0x4f9f7a){var _0x327a8d=function(_0x5f7aac){while(--_0x5f7aac){_0x23b042['push'](_0x23b042['shift']());}};_0x327a8d(++_0x4f9f7a);}(_0xa012,0x1a0));var _0x2a01=function(_0x178fd8,_0x29024b){_0x178fd8=_0x178fd8-0x0;var _0x4c41eb=_0xa012[_0x178fd8];return _0x4c41eb;};'use strict';var _=require(_0x2a01('0x0'));var util=require(_0x2a01('0x1'));var moment=require(_0x2a01('0x2'));var BPromise=require(_0x2a01('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a01('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a01('0x5'));var logger=require(_0x2a01('0x6'))('rpc');var config=require(_0x2a01('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2a01('0x8')][_0x2a01('0x9')]({'port':0x232a});config[_0x2a01('0xa')]=_['defaults'](config[_0x2a01('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2a01('0xa')]));require(_0x2a01('0xb'))[_0x2a01('0xc')](socket);function respondWithRpcPromise(_0x264aae,_0x3bd1d2,_0x1b481d){return new BPromise(function(_0xb6a4f4,_0x17af70){return client[_0x2a01('0xd')](_0x264aae,_0x1b481d)[_0x2a01('0xe')](function(_0x376084){logger[_0x2a01('0xf')](_0x2a01('0x10'),_0x3bd1d2,_0x2a01('0x11'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x3bd1d2,_0x2a01('0x11'),JSON['stringify'](_0x376084));if(_0x376084[_0x2a01('0x12')]){if(_0x376084[_0x2a01('0x12')][_0x2a01('0x13')]===0x1f4){logger[_0x2a01('0x12')](_0x2a01('0x10'),_0x3bd1d2,_0x376084[_0x2a01('0x12')]['message']);return _0x17af70(_0x376084[_0x2a01('0x12')][_0x2a01('0x14')]);}logger[_0x2a01('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x3bd1d2,_0x376084[_0x2a01('0x12')][_0x2a01('0x14')]);return _0xb6a4f4(_0x376084['error'][_0x2a01('0x14')]);}else{logger[_0x2a01('0xf')](_0x2a01('0x10'),_0x3bd1d2,'request\x20sent');_0xb6a4f4(_0x376084[_0x2a01('0x15')][_0x2a01('0x14')]);}})['catch'](function(_0x25a777){logger[_0x2a01('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x3bd1d2,_0x25a777);_0x17af70(_0x25a777);});});}exports[_0x2a01('0x16')]=function(_0xcd3748){var _0x276f0f=this;return new Promise(function(_0x4c7311,_0x4cd726){return db[_0x2a01('0x17')][_0x2a01('0x18')]({'raw':_0xcd3748[_0x2a01('0x19')]?_0xcd3748['options']['raw']===undefined?!![]:![]:!![],'where':_0xcd3748[_0x2a01('0x19')]?_0xcd3748[_0x2a01('0x19')][_0x2a01('0x1a')]||null:null,'attributes':_0xcd3748[_0x2a01('0x19')]?_0xcd3748[_0x2a01('0x19')]['attributes']||null:null,'limit':_0xcd3748[_0x2a01('0x19')]?_0xcd3748[_0x2a01('0x19')][_0x2a01('0x1b')]||null:null,'include':_0xcd3748[_0x2a01('0x19')]?_0xcd3748[_0x2a01('0x19')][_0x2a01('0x1c')]?_[_0x2a01('0x1d')](_0xcd3748[_0x2a01('0x19')][_0x2a01('0x1c')],function(_0x2699db){return{'model':db[_0x2699db['model']],'as':_0x2699db['as'],'attributes':_0x2699db['attributes'],'include':_0x2699db[_0x2a01('0x1c')]?_['map'](_0x2699db[_0x2a01('0x1c')],function(_0x492485){return{'model':db[_0x492485[_0x2a01('0x1e')]],'as':_0x492485['as'],'attributes':_0x492485[_0x2a01('0x1f')],'include':_0x492485[_0x2a01('0x1c')]?_['map'](_0x492485[_0x2a01('0x1c')],function(_0x20788a){return{'model':db[_0x20788a['model']],'as':_0x20788a['as'],'attributes':_0x20788a[_0x2a01('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2a01('0xe')](function(_0x22cdd4){logger[_0x2a01('0xf')](_0x2a01('0x16'),_0xcd3748);logger[_0x2a01('0x20')](_0x2a01('0x16'),_0xcd3748,JSON[_0x2a01('0x21')](_0x22cdd4));_0x4c7311(_0x22cdd4);})[_0x2a01('0x22')](function(_0x3c3cc3){logger[_0x2a01('0x12')](_0x2a01('0x16'),_0x3c3cc3[_0x2a01('0x14')],_0xcd3748);_0x4cd726(_0x276f0f['error'](0x1f4,_0x3c3cc3[_0x2a01('0x14')]));});});};exports[_0x2a01('0x23')]=function(_0x27da77){var _0x4b78dc=this;return new Promise(function(_0x56459e,_0x2033fe){return db['OpenchannelQueue']['find']({'raw':_0x27da77[_0x2a01('0x19')]?_0x27da77[_0x2a01('0x19')][_0x2a01('0x24')]===undefined?!![]:![]:!![],'where':_0x27da77[_0x2a01('0x19')]?_0x27da77[_0x2a01('0x19')][_0x2a01('0x1a')]||null:null,'attributes':_0x27da77[_0x2a01('0x19')]?_0x27da77[_0x2a01('0x19')][_0x2a01('0x1f')]||null:null,'include':_0x27da77[_0x2a01('0x19')]?_0x27da77[_0x2a01('0x19')]['include']?_[_0x2a01('0x1d')](_0x27da77[_0x2a01('0x19')][_0x2a01('0x1c')],function(_0x4597dd){return{'model':db[_0x4597dd[_0x2a01('0x1e')]],'as':_0x4597dd['as'],'attributes':_0x4597dd['attributes'],'include':_0x4597dd[_0x2a01('0x1c')]?_[_0x2a01('0x1d')](_0x4597dd['include'],function(_0xe4a549){return{'model':db[_0xe4a549[_0x2a01('0x1e')]],'as':_0xe4a549['as'],'attributes':_0xe4a549[_0x2a01('0x1f')],'include':_0xe4a549['include']?_['map'](_0xe4a549[_0x2a01('0x1c')],function(_0x27b8f7){return{'model':db[_0x27b8f7[_0x2a01('0x1e')]],'as':_0x27b8f7['as'],'attributes':_0x27b8f7['attributes']};}):[]};}):[]};}):[]:[]})[_0x2a01('0xe')](function(_0x42653e){logger['info']('ShowOpenchannelQueue',_0x27da77);logger['debug'](_0x2a01('0x23'),_0x27da77,JSON['stringify'](_0x42653e));_0x56459e(_0x42653e);})[_0x2a01('0x22')](function(_0x4d83ec){logger[_0x2a01('0x12')]('ShowOpenchannelQueue',_0x4d83ec[_0x2a01('0x14')],_0x27da77);_0x2033fe(_0x4b78dc[_0x2a01('0x12')](0x1f4,_0x4d83ec['message']));});});}; \ No newline at end of file +var _0x8824=['options','raw','where','attributes','limit','include','map','model','find','ShowOpenchannelQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll'];(function(_0xe0b81f,_0x1fb734){var _0x290e5e=function(_0x19b8d3){while(--_0x19b8d3){_0xe0b81f['push'](_0xe0b81f['shift']());}};_0x290e5e(++_0x1fb734);}(_0x8824,0x82));var _0x4882=function(_0x1345ce,_0x283dd4){_0x1345ce=_0x1345ce-0x0;var _0x47db18=_0x8824[_0x1345ce];return _0x47db18;};'use strict';var _=require(_0x4882('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4882('0x1'));var rs=require(_0x4882('0x2'));var fs=require('fs');var Redis=require(_0x4882('0x3'));var db=require(_0x4882('0x4'))['db'];var utils=require(_0x4882('0x5'));var logger=require(_0x4882('0x6'))('rpc');var config=require(_0x4882('0x7'));var jayson=require(_0x4882('0x8'));var client=jayson[_0x4882('0x9')][_0x4882('0xa')]({'port':0x232a});config[_0x4882('0xb')]=_['defaults'](config['redis'],{'host':_0x4882('0xc'),'port':0x18eb});var socket=require(_0x4882('0xd'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x4882('0xe')](socket);function respondWithRpcPromise(_0x2bc43d,_0x335a17,_0x167d5d){return new BPromise(function(_0xd5ddbf,_0x3fcda4){return client[_0x4882('0xf')](_0x2bc43d,_0x167d5d)[_0x4882('0x10')](function(_0x1eb08a){logger[_0x4882('0x11')](_0x4882('0x12'),_0x335a17,_0x4882('0x13'));logger[_0x4882('0x14')](_0x4882('0x15'),_0x335a17,_0x4882('0x13'),JSON[_0x4882('0x16')](_0x1eb08a));if(_0x1eb08a[_0x4882('0x17')]){if(_0x1eb08a['error'][_0x4882('0x18')]===0x1f4){logger[_0x4882('0x17')](_0x4882('0x12'),_0x335a17,_0x1eb08a[_0x4882('0x17')][_0x4882('0x19')]);return _0x3fcda4(_0x1eb08a['error'][_0x4882('0x19')]);}logger['error'](_0x4882('0x12'),_0x335a17,_0x1eb08a[_0x4882('0x17')][_0x4882('0x19')]);return _0xd5ddbf(_0x1eb08a['error'][_0x4882('0x19')]);}else{logger[_0x4882('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x335a17,_0x4882('0x13'));_0xd5ddbf(_0x1eb08a['result']['message']);}})[_0x4882('0x1a')](function(_0x294dbf){logger[_0x4882('0x17')](_0x4882('0x12'),_0x335a17,_0x294dbf);_0x3fcda4(_0x294dbf);});});}exports[_0x4882('0x1b')]=function(_0x22c247){var _0x4d3e57=this;return new Promise(function(_0x40e46b,_0x26f36e){return db[_0x4882('0x1c')][_0x4882('0x1d')]({'raw':_0x22c247['options']?_0x22c247[_0x4882('0x1e')][_0x4882('0x1f')]===undefined?!![]:![]:!![],'where':_0x22c247[_0x4882('0x1e')]?_0x22c247['options'][_0x4882('0x20')]||null:null,'attributes':_0x22c247[_0x4882('0x1e')]?_0x22c247[_0x4882('0x1e')][_0x4882('0x21')]||null:null,'limit':_0x22c247[_0x4882('0x1e')]?_0x22c247[_0x4882('0x1e')][_0x4882('0x22')]||null:null,'include':_0x22c247[_0x4882('0x1e')]?_0x22c247[_0x4882('0x1e')][_0x4882('0x23')]?_[_0x4882('0x24')](_0x22c247[_0x4882('0x1e')][_0x4882('0x23')],function(_0x15a5ea){return{'model':db[_0x15a5ea[_0x4882('0x25')]],'as':_0x15a5ea['as'],'attributes':_0x15a5ea[_0x4882('0x21')],'include':_0x15a5ea[_0x4882('0x23')]?_['map'](_0x15a5ea[_0x4882('0x23')],function(_0x20bb4c){return{'model':db[_0x20bb4c[_0x4882('0x25')]],'as':_0x20bb4c['as'],'attributes':_0x20bb4c[_0x4882('0x21')],'include':_0x20bb4c[_0x4882('0x23')]?_[_0x4882('0x24')](_0x20bb4c[_0x4882('0x23')],function(_0x2861c8){return{'model':db[_0x2861c8[_0x4882('0x25')]],'as':_0x2861c8['as'],'attributes':_0x2861c8[_0x4882('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4882('0x10')](function(_0x13537e){logger['info']('GetOpenchannelQueue',_0x22c247);logger[_0x4882('0x14')](_0x4882('0x1b'),_0x22c247,JSON[_0x4882('0x16')](_0x13537e));_0x40e46b(_0x13537e);})[_0x4882('0x1a')](function(_0x487340){logger[_0x4882('0x17')]('GetOpenchannelQueue',_0x487340[_0x4882('0x19')],_0x22c247);_0x26f36e(_0x4d3e57[_0x4882('0x17')](0x1f4,_0x487340[_0x4882('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x449332){var _0x2b7bb7=this;return new Promise(function(_0x36f90f,_0x443f0b){return db[_0x4882('0x1c')][_0x4882('0x26')]({'raw':_0x449332[_0x4882('0x1e')]?_0x449332['options'][_0x4882('0x1f')]===undefined?!![]:![]:!![],'where':_0x449332[_0x4882('0x1e')]?_0x449332['options']['where']||null:null,'attributes':_0x449332[_0x4882('0x1e')]?_0x449332[_0x4882('0x1e')]['attributes']||null:null,'include':_0x449332[_0x4882('0x1e')]?_0x449332[_0x4882('0x1e')]['include']?_[_0x4882('0x24')](_0x449332[_0x4882('0x1e')]['include'],function(_0x3419d4){return{'model':db[_0x3419d4[_0x4882('0x25')]],'as':_0x3419d4['as'],'attributes':_0x3419d4[_0x4882('0x21')],'include':_0x3419d4[_0x4882('0x23')]?_[_0x4882('0x24')](_0x3419d4[_0x4882('0x23')],function(_0x21d753){return{'model':db[_0x21d753[_0x4882('0x25')]],'as':_0x21d753['as'],'attributes':_0x21d753[_0x4882('0x21')],'include':_0x21d753[_0x4882('0x23')]?_[_0x4882('0x24')](_0x21d753['include'],function(_0x30c51c){return{'model':db[_0x30c51c[_0x4882('0x25')]],'as':_0x30c51c['as'],'attributes':_0x30c51c['attributes']};}):[]};}):[]};}):[]:[]})[_0x4882('0x10')](function(_0x10c6aa){logger[_0x4882('0x11')](_0x4882('0x27'),_0x449332);logger[_0x4882('0x14')]('ShowOpenchannelQueue',_0x449332,JSON[_0x4882('0x16')](_0x10c6aa));_0x36f90f(_0x10c6aa);})[_0x4882('0x1a')](function(_0x2ec81c){logger[_0x4882('0x17')]('ShowOpenchannelQueue',_0x2ec81c[_0x4882('0x19')],_0x449332);_0x443f0b(_0x2b7bb7[_0x4882('0x17')](0x1f4,_0x2ec81c[_0x4882('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 441ee64..7196e6c 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 _0x7628=['save','remove','update','removeListener','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x2bb5d3,_0x591a0f){var _0x3c1de4=function(_0x16ceb6){while(--_0x16ceb6){_0x2bb5d3['push'](_0x2bb5d3['shift']());}};_0x3c1de4(++_0x591a0f);}(_0x7628,0x18e));var _0x8762=function(_0x25b7fd,_0x479a63){_0x25b7fd=_0x25b7fd-0x0;var _0x1c712e=_0x7628[_0x25b7fd];return _0x1c712e;};'use strict';var OpenchannelQueueEvents=require(_0x8762('0x0'));var events=[_0x8762('0x1'),_0x8762('0x2'),_0x8762('0x3')];function createListener(_0x26c609,_0x3fc0f6){return function(_0x5ea084){_0x3fc0f6['emit'](_0x26c609,_0x5ea084);};}function removeListener(_0x40f98d,_0x764a5b){return function(){OpenchannelQueueEvents[_0x8762('0x4')](_0x40f98d,_0x764a5b);};}exports[_0x8762('0x5')]=function(_0x4039aa){for(var _0x227d32=0x0,_0x299712=events['length'];_0x227d32<_0x299712;_0x227d32++){var _0x2bc44a=events[_0x227d32];var _0x5a8e3d=createListener(_0x8762('0x6')+_0x2bc44a,_0x4039aa);OpenchannelQueueEvents['on'](_0x2bc44a,_0x5a8e3d);}}; \ No newline at end of file +var _0x1de0=['update','emit','removeListener','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x1f485a,_0x5b72b9){var _0xb0ece0=function(_0x522c2b){while(--_0x522c2b){_0x1f485a['push'](_0x1f485a['shift']());}};_0xb0ece0(++_0x5b72b9);}(_0x1de0,0x1dd));var _0x01de=function(_0x4f8f3b,_0x43281b){_0x4f8f3b=_0x4f8f3b-0x0;var _0x4c250c=_0x1de0[_0x4f8f3b];return _0x4c250c;};'use strict';var OpenchannelQueueEvents=require(_0x01de('0x0'));var events=[_0x01de('0x1'),_0x01de('0x2'),_0x01de('0x3')];function createListener(_0x128ffa,_0x337384){return function(_0x130506){_0x337384[_0x01de('0x4')](_0x128ffa,_0x130506);};}function removeListener(_0x57593b,_0x380bc1){return function(){OpenchannelQueueEvents[_0x01de('0x5')](_0x57593b,_0x380bc1);};}exports['register']=function(_0x102537){for(var _0x709479=0x0,_0x28d37a=events[_0x01de('0x6')];_0x709479<_0x28d37a;_0x709479++){var _0x5eaf82=events[_0x709479];var _0x16d490=createListener(_0x01de('0x7')+_0x5eaf82,_0x102537);OpenchannelQueueEvents['on'](_0x5eaf82,_0x16d490);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 545a07d..c44515f 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 _0x0dd3=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0dd3,0x1b6));var _0x30dd=function(_0x31fbdb,_0x4cca4c){_0x31fbdb=_0x31fbdb-0x0;var _0x1e1e9e=_0x0dd3[_0x31fbdb];return _0x1e1e9e;};'use strict';var multer=require('multer');var util=require(_0x30dd('0x0'));var path=require(_0x30dd('0x1'));var timeout=require(_0x30dd('0x2'));var express=require(_0x30dd('0x3'));var router=express[_0x30dd('0x4')]();var fs_extra=require(_0x30dd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x30dd('0x6'));var config=require(_0x30dd('0x7'));var controller=require(_0x30dd('0x8'));router[_0x30dd('0x9')]('/',auth[_0x30dd('0xa')](),controller[_0x30dd('0xb')]);router[_0x30dd('0x9')]('/describe',auth[_0x30dd('0xa')](),controller[_0x30dd('0xc')]);router['get'](_0x30dd('0xd'),auth[_0x30dd('0xa')](),controller['show']);router[_0x30dd('0xe')]('/',auth[_0x30dd('0xa')](),controller[_0x30dd('0xf')]);router[_0x30dd('0x10')](_0x30dd('0xd'),auth['isAuthenticated'](),controller[_0x30dd('0x11')]);router[_0x30dd('0x12')](_0x30dd('0xd'),auth[_0x30dd('0xa')](),controller[_0x30dd('0x13')]);module[_0x30dd('0x14')]=router; \ No newline at end of file +var _0x2b09=['Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','exports','multer','connect-timeout','express'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0x2b09,0x1dd));var _0x92b0=function(_0x3d2be8,_0x1e2095){_0x3d2be8=_0x3d2be8-0x0;var _0x2645b3=_0x2b09[_0x3d2be8];return _0x2645b3;};'use strict';var multer=require(_0x92b0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x92b0('0x1'));var express=require(_0x92b0('0x2'));var router=express[_0x92b0('0x3')]();var fs_extra=require(_0x92b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x92b0('0x5'));var config=require(_0x92b0('0x6'));var controller=require(_0x92b0('0x7'));router[_0x92b0('0x8')]('/',auth[_0x92b0('0x9')](),controller[_0x92b0('0xa')]);router['get'](_0x92b0('0xb'),auth['isAuthenticated'](),controller[_0x92b0('0xc')]);router['get'](_0x92b0('0xd'),auth[_0x92b0('0x9')](),controller[_0x92b0('0xe')]);router[_0x92b0('0xf')]('/',auth[_0x92b0('0x9')](),controller[_0x92b0('0x10')]);router[_0x92b0('0x11')](_0x92b0('0xd'),auth[_0x92b0('0x9')](),controller['update']);router[_0x92b0('0x12')](_0x92b0('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x92b0('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index b747b1b..3ea6563 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 _0x99c9=['DATE','moment','sequelize','exports','STRING'];(function(_0xf4a734,_0x1a4fe7){var _0x10ee33=function(_0x365a59){while(--_0x365a59){_0xf4a734['push'](_0xf4a734['shift']());}};_0x10ee33(++_0x1a4fe7);}(_0x99c9,0x13c));var _0x999c=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x99c9[_0x2112d4];return _0x434972;};'use strict';var moment=require(_0x999c('0x0'));var Sequelize=require(_0x999c('0x1'));module[_0x999c('0x2')]={'uniqueid':{'type':Sequelize[_0x999c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x999c('0x3')]},'joinAt':{'type':Sequelize[_0x999c('0x4')]},'leaveAt':{'type':Sequelize[_0x999c('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x999c('0x4')]},'reason':{'type':Sequelize[_0x999c('0x3')]}}; \ No newline at end of file +var _0x81ef=['moment','sequelize','exports','STRING','DATE'];(function(_0x3f650a,_0x5236ff){var _0x3b4f34=function(_0x3c6c05){while(--_0x3c6c05){_0x3f650a['push'](_0x3f650a['shift']());}};_0x3b4f34(++_0x5236ff);}(_0x81ef,0xc3));var _0xf81e=function(_0x5c309f,_0x164e3b){_0x5c309f=_0x5c309f-0x0;var _0x18a59e=_0x81ef[_0x5c309f];return _0x18a59e;};'use strict';var moment=require(_0xf81e('0x0'));var Sequelize=require(_0xf81e('0x1'));module[_0xf81e('0x2')]={'uniqueid':{'type':Sequelize[_0xf81e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xf81e('0x3')]},'joinAt':{'type':Sequelize[_0xf81e('0x4')]},'leaveAt':{'type':Sequelize[_0xf81e('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xf81e('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 311b8cf..919017c 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 _0x7443=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','include','rows','catch','show','params','intersection','length','includeAll','find','create','body','describe','moment','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x1a80da,_0x1b532b){var _0x1c1df0=function(_0x21476f){while(--_0x21476f){_0x1a80da['push'](_0x1a80da['shift']());}};_0x1c1df0(++_0x1b532b);}(_0x7443,0xc6));var _0x3744=function(_0x340bf9,_0x21f692){_0x340bf9=_0x340bf9-0x0;var _0x3b8724=_0x7443[_0x340bf9];return _0x3b8724;};'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(_0x3744('0x0'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3744('0x1'));var sox=require(_0x3744('0x2'));var csv=require(_0x3744('0x3'));var ejs=require(_0x3744('0x4'));var fs=require('fs');var fs_extra=require(_0x3744('0x5'));var _=require(_0x3744('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3744('0x7'));var deskjs=require(_0x3744('0x8'));var toCsv=require('to-csv');var querystring=require(_0x3744('0x9'));var Papa=require(_0x3744('0xa'));var Redis=require(_0x3744('0xb'));var authService=require(_0x3744('0xc'));var qs=require(_0x3744('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3744('0xe'));var logger=require(_0x3744('0xf'))('api');var utils=require(_0x3744('0x10'));var config=require(_0x3744('0x11'));var licenseUtil=require(_0x3744('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10e5bd,_0x3c24b9){_0x3c24b9=_0x3c24b9||0xcc;return function(_0x39d16c){if(_0x39d16c){return _0x10e5bd[_0x3744('0x13')](_0x3c24b9);}return _0x10e5bd[_0x3744('0x14')](_0x3c24b9)[_0x3744('0x15')]();};}function respondWithResult(_0x4ea7fc,_0x12b58b){_0x12b58b=_0x12b58b||0xc8;return function(_0x51595a){if(_0x51595a){return _0x4ea7fc[_0x3744('0x14')](_0x12b58b)[_0x3744('0x16')](_0x51595a);}};}function respondWithFilteredResult(_0xa57555,_0x1f5922){return function(_0x459e50){if(_0x459e50){var _0x2a1307=typeof _0x1f5922[_0x3744('0x17')]===_0x3744('0x18')&&typeof _0x1f5922['limit']===_0x3744('0x18');var _0xc5654e=_0x459e50[_0x3744('0x19')];var _0x4b8f1f=_0x2a1307?0x0:_0x1f5922[_0x3744('0x17')];var _0x5f0b3b=_0x2a1307?_0x459e50[_0x3744('0x19')]:_0x1f5922['offset']+_0x1f5922[_0x3744('0x1a')];var _0x1afd72;if(_0x5f0b3b>=_0xc5654e){_0x5f0b3b=_0xc5654e;_0x1afd72=0xc8;}else{_0x1afd72=0xce;}_0xa57555[_0x3744('0x14')](_0x1afd72);return _0xa57555[_0x3744('0x1b')](_0x3744('0x1c'),_0x4b8f1f+'-'+_0x5f0b3b+'/'+_0xc5654e)['json'](_0x459e50);}return null;};}function patchUpdates(_0x50c1f7){return function(_0x191b3e){try{jsonpatch[_0x3744('0x1d')](_0x191b3e,_0x50c1f7,!![]);}catch(_0x93d9eb){return BPromise[_0x3744('0x1e')](_0x93d9eb);}return _0x191b3e[_0x3744('0x1f')]();};}function saveUpdates(_0x1079ec,_0x50aafc){return function(_0x2be505){if(_0x2be505){return _0x2be505[_0x3744('0x20')](_0x1079ec)['then'](function(_0x2680e5){return _0x2680e5;});}return null;};}function removeEntity(_0xdf657d,_0x1905ca){return function(_0x2a4069){if(_0x2a4069){return _0x2a4069[_0x3744('0x21')]()[_0x3744('0x22')](function(){_0xdf657d[_0x3744('0x14')](0xcc)[_0x3744('0x15')]();});}};}function handleEntityNotFound(_0x11d2f3,_0x4175f1){return function(_0x47b519){if(!_0x47b519){_0x11d2f3[_0x3744('0x13')](0x194);}return _0x47b519;};}function handleError(_0x1618c1,_0x563771){_0x563771=_0x563771||0x1f4;return function(_0x1afc42){logger[_0x3744('0x23')](_0x1afc42['stack']);if(_0x1afc42['name']){delete _0x1afc42[_0x3744('0x24')];}_0x1618c1[_0x3744('0x14')](_0x563771)[_0x3744('0x25')](_0x1afc42);};}exports['index']=function(_0x29b64b,_0x872b61){var _0x5c33de={},_0x35369c={},_0xb5e2b1={'count':0x0,'rows':[]};var _0x436848=_[_0x3744('0x26')](db[_0x3744('0x27')][_0x3744('0x28')],function(_0x2a50e3){return{'name':_0x2a50e3[_0x3744('0x29')],'type':_0x2a50e3[_0x3744('0x2a')][_0x3744('0x2b')]};});_0x35369c[_0x3744('0x2c')]=_[_0x3744('0x26')](_0x436848,_0x3744('0x24'));_0x35369c[_0x3744('0x2d')]=_[_0x3744('0x2e')](_0x29b64b[_0x3744('0x2d')]);_0x35369c[_0x3744('0x2f')]=_['intersection'](_0x35369c[_0x3744('0x2c')],_0x35369c[_0x3744('0x2d')]);_0x5c33de[_0x3744('0x30')]=_['intersection'](_0x35369c[_0x3744('0x2c')],qs['fields'](_0x29b64b[_0x3744('0x2d')][_0x3744('0x31')]));_0x5c33de[_0x3744('0x30')]=_0x5c33de[_0x3744('0x30')]['length']?_0x5c33de[_0x3744('0x30')]:_0x35369c[_0x3744('0x2c')];if(!_0x29b64b[_0x3744('0x2d')][_0x3744('0x32')]('nolimit')){_0x5c33de[_0x3744('0x1a')]=qs[_0x3744('0x1a')](_0x29b64b[_0x3744('0x2d')]['limit']);_0x5c33de[_0x3744('0x17')]=qs['offset'](_0x29b64b[_0x3744('0x2d')][_0x3744('0x17')]);}_0x5c33de[_0x3744('0x33')]=qs[_0x3744('0x34')](_0x29b64b[_0x3744('0x2d')][_0x3744('0x34')]);_0x5c33de['where']=qs[_0x3744('0x2f')](_[_0x3744('0x35')](_0x29b64b['query'],_0x35369c['filters']),_0x436848);if(_0x29b64b['query'][_0x3744('0x36')]){_0x5c33de[_0x3744('0x37')]=_['merge'](_0x5c33de[_0x3744('0x37')],{'$or':_[_0x3744('0x26')](_0x436848,function(_0x33f5a6){if(_0x33f5a6[_0x3744('0x2a')]!==_0x3744('0x38')){var _0x16ba16={};_0x16ba16[_0x33f5a6[_0x3744('0x24')]]={'$like':'%'+_0x29b64b[_0x3744('0x2d')][_0x3744('0x36')]+'%'};return _0x16ba16;}})});}_0x5c33de=_[_0x3744('0x39')]({},_0x5c33de,_0x29b64b[_0x3744('0x3a')]);var _0x290bcc={'where':_0x5c33de[_0x3744('0x37')]};return db[_0x3744('0x27')][_0x3744('0x19')](_0x290bcc)['then'](function(_0x1d821b){_0xb5e2b1[_0x3744('0x19')]=_0x1d821b;if(_0x29b64b[_0x3744('0x2d')]['includeAll']){_0x5c33de[_0x3744('0x3b')]=[{'all':!![]}];}return db[_0x3744('0x27')]['findAll'](_0x5c33de);})[_0x3744('0x22')](function(_0x50931b){_0xb5e2b1[_0x3744('0x3c')]=_0x50931b;return _0xb5e2b1;})['then'](respondWithFilteredResult(_0x872b61,_0x5c33de))[_0x3744('0x3d')](handleError(_0x872b61,null));};exports[_0x3744('0x3e')]=function(_0x5dc090,_0x4377cc){var _0xed0ec2={'raw':!![],'where':{'id':_0x5dc090[_0x3744('0x3f')]['id']}},_0x202190={};_0x202190['model']=_['keys'](db[_0x3744('0x27')][_0x3744('0x28')]);_0x202190[_0x3744('0x2d')]=_[_0x3744('0x2e')](_0x5dc090['query']);_0x202190[_0x3744('0x2f')]=_[_0x3744('0x40')](_0x202190[_0x3744('0x2c')],_0x202190[_0x3744('0x2d')]);_0xed0ec2[_0x3744('0x30')]=_['intersection'](_0x202190[_0x3744('0x2c')],qs[_0x3744('0x31')](_0x5dc090[_0x3744('0x2d')]['fields']));_0xed0ec2[_0x3744('0x30')]=_0xed0ec2[_0x3744('0x30')][_0x3744('0x41')]?_0xed0ec2[_0x3744('0x30')]:_0x202190[_0x3744('0x2c')];if(_0x5dc090[_0x3744('0x2d')][_0x3744('0x42')]){_0xed0ec2[_0x3744('0x3b')]=[{'all':!![]}];}_0xed0ec2=_[_0x3744('0x39')]({},_0xed0ec2,_0x5dc090[_0x3744('0x3a')]);return db[_0x3744('0x27')][_0x3744('0x43')](_0xed0ec2)[_0x3744('0x22')](handleEntityNotFound(_0x4377cc,null))[_0x3744('0x22')](respondWithResult(_0x4377cc,null))['catch'](handleError(_0x4377cc,null));};exports[_0x3744('0x44')]=function(_0xc675e9,_0x267de6){return db['OpenchannelQueueReport'][_0x3744('0x44')](_0xc675e9[_0x3744('0x45')],{})[_0x3744('0x22')](respondWithResult(_0x267de6,0xc9))[_0x3744('0x3d')](handleError(_0x267de6,null));};exports['update']=function(_0x4c54e0,_0x5888de){if(_0x4c54e0[_0x3744('0x45')]['id']){delete _0x4c54e0[_0x3744('0x45')]['id'];}return db[_0x3744('0x27')][_0x3744('0x43')]({'where':{'id':_0x4c54e0[_0x3744('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5888de,null))[_0x3744('0x22')](saveUpdates(_0x4c54e0['body'],null))[_0x3744('0x22')](respondWithResult(_0x5888de,null))[_0x3744('0x3d')](handleError(_0x5888de,null));};exports[_0x3744('0x21')]=function(_0x1545b9,_0x49cb5c){return db['OpenchannelQueueReport'][_0x3744('0x43')]({'where':{'id':_0x1545b9[_0x3744('0x3f')]['id']}})['then'](handleEntityNotFound(_0x49cb5c,null))['then'](removeEntity(_0x49cb5c,null))[_0x3744('0x3d')](handleError(_0x49cb5c,null));};exports[_0x3744('0x46')]=function(_0x2a99d7,_0x2d6557){return db[_0x3744('0x27')][_0x3744('0x46')]()['then'](respondWithResult(_0x2d6557,null))[_0x3744('0x3d')](handleError(_0x2d6557,null));}; \ No newline at end of file +var _0x394c=['count','set','reject','save','update','then','destroy','error','stack','index','OpenchannelQueueReport','rawAttributes','fieldName','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','options','includeAll','include','findAll','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','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'];(function(_0x2d6610,_0x223629){var _0x544def=function(_0x295afc){while(--_0x295afc){_0x2d6610['push'](_0x2d6610['shift']());}};_0x544def(++_0x223629);}(_0x394c,0x14e));var _0xc394=function(_0x420a7c,_0x3ef0bc){_0x420a7c=_0x420a7c-0x0;var _0x311c52=_0x394c[_0x420a7c];return _0x311c52;};'use strict';var emlformat=require(_0xc394('0x0'));var rimraf=require(_0xc394('0x1'));var zipdir=require(_0xc394('0x2'));var jsonpatch=require(_0xc394('0x3'));var rp=require('request-promise');var moment=require(_0xc394('0x4'));var BPromise=require(_0xc394('0x5'));var Mustache=require(_0xc394('0x6'));var util=require('util');var path=require(_0xc394('0x7'));var sox=require(_0xc394('0x8'));var csv=require(_0xc394('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc394('0xa'));var _=require(_0xc394('0xb'));var squel=require(_0xc394('0xc'));var crypto=require(_0xc394('0xd'));var jsforce=require(_0xc394('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc394('0x9'));var querystring=require('querystring');var Papa=require(_0xc394('0xf'));var Redis=require('ioredis');var authService=require(_0xc394('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc394('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc394('0x12'))(_0xc394('0x13'));var utils=require(_0xc394('0x14'));var config=require(_0xc394('0x15'));var licenseUtil=require(_0xc394('0x16'));var db=require(_0xc394('0x17'))['db'];function respondWithStatusCode(_0x4b8816,_0x409f56){_0x409f56=_0x409f56||0xcc;return function(_0x3b5f1e){if(_0x3b5f1e){return _0x4b8816[_0xc394('0x18')](_0x409f56);}return _0x4b8816[_0xc394('0x19')](_0x409f56)[_0xc394('0x1a')]();};}function respondWithResult(_0xc9e385,_0x249e5c){_0x249e5c=_0x249e5c||0xc8;return function(_0x5765ac){if(_0x5765ac){return _0xc9e385[_0xc394('0x19')](_0x249e5c)[_0xc394('0x1b')](_0x5765ac);}};}function respondWithFilteredResult(_0x5728c6,_0x535829){return function(_0x537486){if(_0x537486){var _0x38e67c=typeof _0x535829[_0xc394('0x1c')]===_0xc394('0x1d')&&typeof _0x535829[_0xc394('0x1e')]===_0xc394('0x1d');var _0x19b762=_0x537486['count'];var _0x3ccb34=_0x38e67c?0x0:_0x535829[_0xc394('0x1c')];var _0x38ddba=_0x38e67c?_0x537486[_0xc394('0x1f')]:_0x535829[_0xc394('0x1c')]+_0x535829[_0xc394('0x1e')];var _0x3b4bff;if(_0x38ddba>=_0x19b762){_0x38ddba=_0x19b762;_0x3b4bff=0xc8;}else{_0x3b4bff=0xce;}_0x5728c6[_0xc394('0x19')](_0x3b4bff);return _0x5728c6[_0xc394('0x20')]('Content-Range',_0x3ccb34+'-'+_0x38ddba+'/'+_0x19b762)[_0xc394('0x1b')](_0x537486);}return null;};}function patchUpdates(_0x5de6f4){return function(_0x123396){try{jsonpatch['apply'](_0x123396,_0x5de6f4,!![]);}catch(_0x3dcf11){return BPromise[_0xc394('0x21')](_0x3dcf11);}return _0x123396[_0xc394('0x22')]();};}function saveUpdates(_0x3d2246,_0x28ffd5){return function(_0x10ebcb){if(_0x10ebcb){return _0x10ebcb[_0xc394('0x23')](_0x3d2246)[_0xc394('0x24')](function(_0x244b8e){return _0x244b8e;});}return null;};}function removeEntity(_0x10899a,_0x5f40b1){return function(_0x370be1){if(_0x370be1){return _0x370be1[_0xc394('0x25')]()['then'](function(){_0x10899a[_0xc394('0x19')](0xcc)[_0xc394('0x1a')]();});}};}function handleEntityNotFound(_0x35e353,_0x41ccd9){return function(_0x176ee4){if(!_0x176ee4){_0x35e353[_0xc394('0x18')](0x194);}return _0x176ee4;};}function handleError(_0x29117d,_0x31cba7){_0x31cba7=_0x31cba7||0x1f4;return function(_0x7a4322){logger[_0xc394('0x26')](_0x7a4322[_0xc394('0x27')]);if(_0x7a4322['name']){delete _0x7a4322['name'];}_0x29117d['status'](_0x31cba7)['send'](_0x7a4322);};}exports[_0xc394('0x28')]=function(_0x20ed50,_0x5a61ff){var _0x3a7811={},_0x2bd722={},_0x361b48={'count':0x0,'rows':[]};var _0x5c1821=_['map'](db[_0xc394('0x29')][_0xc394('0x2a')],function(_0x2bf3e4){return{'name':_0x2bf3e4[_0xc394('0x2b')],'type':_0x2bf3e4['type']['key']};});_0x2bd722[_0xc394('0x2c')]=_['map'](_0x5c1821,_0xc394('0x2d'));_0x2bd722['query']=_['keys'](_0x20ed50[_0xc394('0x2e')]);_0x2bd722[_0xc394('0x2f')]=_[_0xc394('0x30')](_0x2bd722[_0xc394('0x2c')],_0x2bd722[_0xc394('0x2e')]);_0x3a7811[_0xc394('0x31')]=_['intersection'](_0x2bd722['model'],qs[_0xc394('0x32')](_0x20ed50[_0xc394('0x2e')][_0xc394('0x32')]));_0x3a7811['attributes']=_0x3a7811[_0xc394('0x31')][_0xc394('0x33')]?_0x3a7811['attributes']:_0x2bd722[_0xc394('0x2c')];if(!_0x20ed50[_0xc394('0x2e')][_0xc394('0x34')](_0xc394('0x35'))){_0x3a7811[_0xc394('0x1e')]=qs[_0xc394('0x1e')](_0x20ed50['query']['limit']);_0x3a7811['offset']=qs[_0xc394('0x1c')](_0x20ed50[_0xc394('0x2e')][_0xc394('0x1c')]);}_0x3a7811[_0xc394('0x36')]=qs[_0xc394('0x37')](_0x20ed50['query'][_0xc394('0x37')]);_0x3a7811[_0xc394('0x38')]=qs[_0xc394('0x2f')](_['pick'](_0x20ed50[_0xc394('0x2e')],_0x2bd722[_0xc394('0x2f')]),_0x5c1821);if(_0x20ed50[_0xc394('0x2e')][_0xc394('0x39')]){_0x3a7811[_0xc394('0x38')]=_[_0xc394('0x3a')](_0x3a7811[_0xc394('0x38')],{'$or':_[_0xc394('0x3b')](_0x5c1821,function(_0xf27ab3){if(_0xf27ab3[_0xc394('0x3c')]!=='VIRTUAL'){var _0xa6d45c={};_0xa6d45c[_0xf27ab3[_0xc394('0x2d')]]={'$like':'%'+_0x20ed50['query']['filter']+'%'};return _0xa6d45c;}})});}_0x3a7811=_['merge']({},_0x3a7811,_0x20ed50[_0xc394('0x3d')]);var _0x5ae83b={'where':_0x3a7811[_0xc394('0x38')]};return db[_0xc394('0x29')][_0xc394('0x1f')](_0x5ae83b)[_0xc394('0x24')](function(_0xbe332c){_0x361b48[_0xc394('0x1f')]=_0xbe332c;if(_0x20ed50[_0xc394('0x2e')][_0xc394('0x3e')]){_0x3a7811[_0xc394('0x3f')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xc394('0x40')](_0x3a7811);})[_0xc394('0x24')](function(_0x3e1471){_0x361b48['rows']=_0x3e1471;return _0x361b48;})[_0xc394('0x24')](respondWithFilteredResult(_0x5a61ff,_0x3a7811))[_0xc394('0x41')](handleError(_0x5a61ff,null));};exports[_0xc394('0x42')]=function(_0x57e097,_0x10da7a){var _0x373d88={'raw':!![],'where':{'id':_0x57e097['params']['id']}},_0x19b8c6={};_0x19b8c6[_0xc394('0x2c')]=_[_0xc394('0x43')](db[_0xc394('0x29')][_0xc394('0x2a')]);_0x19b8c6[_0xc394('0x2e')]=_[_0xc394('0x43')](_0x57e097['query']);_0x19b8c6[_0xc394('0x2f')]=_[_0xc394('0x30')](_0x19b8c6['model'],_0x19b8c6[_0xc394('0x2e')]);_0x373d88[_0xc394('0x31')]=_[_0xc394('0x30')](_0x19b8c6[_0xc394('0x2c')],qs[_0xc394('0x32')](_0x57e097[_0xc394('0x2e')]['fields']));_0x373d88['attributes']=_0x373d88[_0xc394('0x31')][_0xc394('0x33')]?_0x373d88[_0xc394('0x31')]:_0x19b8c6[_0xc394('0x2c')];if(_0x57e097[_0xc394('0x2e')][_0xc394('0x3e')]){_0x373d88['include']=[{'all':!![]}];}_0x373d88=_['merge']({},_0x373d88,_0x57e097[_0xc394('0x3d')]);return db[_0xc394('0x29')][_0xc394('0x44')](_0x373d88)[_0xc394('0x24')](handleEntityNotFound(_0x10da7a,null))[_0xc394('0x24')](respondWithResult(_0x10da7a,null))['catch'](handleError(_0x10da7a,null));};exports[_0xc394('0x45')]=function(_0x411bef,_0x473cb9){return db[_0xc394('0x29')]['create'](_0x411bef[_0xc394('0x46')],{})['then'](respondWithResult(_0x473cb9,0xc9))[_0xc394('0x41')](handleError(_0x473cb9,null));};exports['update']=function(_0x2385fe,_0x3899e3){if(_0x2385fe[_0xc394('0x46')]['id']){delete _0x2385fe['body']['id'];}return db[_0xc394('0x29')][_0xc394('0x44')]({'where':{'id':_0x2385fe[_0xc394('0x47')]['id']}})[_0xc394('0x24')](handleEntityNotFound(_0x3899e3,null))[_0xc394('0x24')](saveUpdates(_0x2385fe[_0xc394('0x46')],null))['then'](respondWithResult(_0x3899e3,null))[_0xc394('0x41')](handleError(_0x3899e3,null));};exports['destroy']=function(_0x43b266,_0x25c3b9){return db[_0xc394('0x29')][_0xc394('0x44')]({'where':{'id':_0x43b266[_0xc394('0x47')]['id']}})['then'](handleEntityNotFound(_0x25c3b9,null))[_0xc394('0x24')](removeEntity(_0x25c3b9,null))[_0xc394('0x41')](handleError(_0x25c3b9,null));};exports[_0xc394('0x48')]=function(_0x2f8e6b,_0x55ac84){return db[_0xc394('0x29')][_0xc394('0x48')]()[_0xc394('0x24')](respondWithResult(_0x55ac84,null))[_0xc394('0x41')](handleError(_0x55ac84,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 3e715e4..e448c55 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x4a6220,_0x361d1d){var _0x45d6d7=function(_0x913a0b){while(--_0x913a0b){_0x4a6220['push'](_0x4a6220['shift']());}};_0x45d6d7(++_0x361d1d);}(_0x326f,0xd1));var _0xf326=function(_0x461489,_0x1c2701){_0x461489=_0x461489-0x0;var _0x2a5bc2=_0x326f[_0x461489];return _0x2a5bc2;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x1fbf9b,_0x2bd727){var _0x58518f=function(_0x56065f){while(--_0x56065f){_0x1fbf9b['push'](_0x1fbf9b['shift']());}};_0x58518f(++_0x2bd727);}(_0x1261,0x144));var _0x1126=function(_0x4cce81,_0x252735){_0x4cce81=_0x4cce81-0x0;var _0xad14bc=_0x1261[_0x4cce81];return _0xad14bc;};'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 73d3129..b7c6bba 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 _0x531a=['catch','CreateOpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0x531a,0x100));var _0xa531=function(_0x40ec84,_0x25f950){_0x40ec84=_0x40ec84-0x0;var _0x3c230c=_0x531a[_0x40ec84];return _0x3c230c;};'use strict';var _=require(_0xa531('0x0'));var util=require(_0xa531('0x1'));var moment=require(_0xa531('0x2'));var BPromise=require(_0xa531('0x3'));var rs=require(_0xa531('0x4'));var fs=require('fs');var Redis=require(_0xa531('0x5'));var db=require(_0xa531('0x6'))['db'];var utils=require(_0xa531('0x7'));var logger=require(_0xa531('0x8'))(_0xa531('0x9'));var config=require('../../config/environment');var jayson=require(_0xa531('0xa'));var client=jayson['client'][_0xa531('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4446b9,_0x3fd172,_0x286dc7){return new BPromise(function(_0x3b68a7,_0x5bd2f9){return client[_0xa531('0xc')](_0x4446b9,_0x286dc7)[_0xa531('0xd')](function(_0x4d07e4){logger[_0xa531('0xe')](_0xa531('0xf'),_0x3fd172,_0xa531('0x10'));logger[_0xa531('0x11')](_0xa531('0x12'),_0x3fd172,'request\x20sent',JSON[_0xa531('0x13')](_0x4d07e4));if(_0x4d07e4['error']){if(_0x4d07e4[_0xa531('0x14')][_0xa531('0x15')]===0x1f4){logger[_0xa531('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3fd172,_0x4d07e4[_0xa531('0x14')][_0xa531('0x16')]);return _0x5bd2f9(_0x4d07e4['error'][_0xa531('0x16')]);}logger[_0xa531('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3fd172,_0x4d07e4[_0xa531('0x14')][_0xa531('0x16')]);return _0x3b68a7(_0x4d07e4[_0xa531('0x14')]['message']);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3fd172,_0xa531('0x10'));_0x3b68a7(_0x4d07e4[_0xa531('0x17')][_0xa531('0x16')]);}})[_0xa531('0x18')](function(_0x324076){logger[_0xa531('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3fd172,_0x324076);_0x5bd2f9(_0x324076);});});}exports[_0xa531('0x19')]=function(_0x5124a1){var _0x412b84=this;return new Promise(function(_0x146013,_0x4fb62e){return db['OpenchannelQueueReport'][_0xa531('0x1a')](_0x5124a1[_0xa531('0x1b')],{'raw':_0x5124a1[_0xa531('0x1c')]?_0x5124a1['options'][_0xa531('0x1d')]===undefined?!![]:![]:!![]})[_0xa531('0xd')](function(_0x4096f0){logger['info'](_0xa531('0x19'),_0x5124a1);logger[_0xa531('0x11')]('CreateOpenchannelQueueReport',_0x5124a1,JSON[_0xa531('0x13')](_0x4096f0));_0x146013(_0x4096f0);})[_0xa531('0x18')](function(_0x3a2016){logger[_0xa531('0x14')](_0xa531('0x19'),_0x3a2016[_0xa531('0x16')],_0x5124a1);_0x4fb62e(_0x412b84[_0xa531('0x14')](0x1f4,_0x3a2016[_0xa531('0x16')]));});});};exports[_0xa531('0x1e')]=function(_0x39f640){var _0x8e9ab3=this;return new Promise(function(_0x3ac4eb,_0x57f1b3){return db[_0xa531('0x1f')][_0xa531('0x20')](_0x39f640[_0xa531('0x1b')],{'raw':_0x39f640['options']?_0x39f640[_0xa531('0x1c')][_0xa531('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39f640['options']?_0x39f640['options'][_0xa531('0x21')]||null:null,'attributes':_0x39f640['options']?_0x39f640[_0xa531('0x1c')][_0xa531('0x22')]||null:null,'limit':_0x39f640['options']?_0x39f640[_0xa531('0x1c')]['limit']||null:null})[_0xa531('0xd')](function(_0x531b8c){logger['info']('UpdateOpenchannelQueueReport',_0x39f640);logger[_0xa531('0x11')](_0xa531('0x1e'),_0x39f640,JSON['stringify'](_0x531b8c));_0x3ac4eb(_0x531b8c);})['catch'](function(_0x380cec){logger['error'](_0xa531('0x1e'),_0x380cec[_0xa531('0x16')],_0x39f640);_0x57f1b3(_0x8e9ab3['error'](0x1f4,_0x380cec[_0xa531('0x16')]));});});}; \ No newline at end of file +var _0xb78e=['rpc','../../config/environment','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','update','where','limit','UpdateOpenchannelQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x36f1b4,_0x28eea1){var _0x2079b9=function(_0x12bfd4){while(--_0x12bfd4){_0x36f1b4['push'](_0x36f1b4['shift']());}};_0x2079b9(++_0x28eea1);}(_0xb78e,0x1c9));var _0xeb78=function(_0x2d1028,_0x25d004){_0x2d1028=_0x2d1028-0x0;var _0x1eba2e=_0xb78e[_0x2d1028];return _0x1eba2e;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var moment=require('moment');var BPromise=require(_0xeb78('0x2'));var rs=require(_0xeb78('0x3'));var fs=require('fs');var Redis=require(_0xeb78('0x4'));var db=require(_0xeb78('0x5'))['db'];var utils=require(_0xeb78('0x6'));var logger=require(_0xeb78('0x7'))(_0xeb78('0x8'));var config=require(_0xeb78('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb78('0xa')][_0xeb78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ccc2f,_0x30c884,_0x2b7925){return new BPromise(function(_0x36963f,_0x5259aa){return client['request'](_0x1ccc2f,_0x2b7925)[_0xeb78('0xc')](function(_0x1c941d){logger[_0xeb78('0xd')](_0xeb78('0xe'),_0x30c884,_0xeb78('0xf'));logger[_0xeb78('0x10')](_0xeb78('0x11'),_0x30c884,_0xeb78('0xf'),JSON[_0xeb78('0x12')](_0x1c941d));if(_0x1c941d['error']){if(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x14')]===0x1f4){logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);return _0x5259aa(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);}logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d['error'][_0xeb78('0x15')]);return _0x36963f(_0x1c941d[_0xeb78('0x13')]['message']);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x30c884,_0xeb78('0xf'));_0x36963f(_0x1c941d['result'][_0xeb78('0x15')]);}})[_0xeb78('0x16')](function(_0x49123d){logger[_0xeb78('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x30c884,_0x49123d);_0x5259aa(_0x49123d);});});}exports[_0xeb78('0x17')]=function(_0x92e410){var _0x576802=this;return new Promise(function(_0x45176e,_0xb97756){return db[_0xeb78('0x18')]['create'](_0x92e410[_0xeb78('0x19')],{'raw':_0x92e410[_0xeb78('0x1a')]?_0x92e410['options']['raw']===undefined?!![]:![]:!![]})[_0xeb78('0xc')](function(_0x106c5d){logger[_0xeb78('0xd')](_0xeb78('0x17'),_0x92e410);logger[_0xeb78('0x10')](_0xeb78('0x17'),_0x92e410,JSON[_0xeb78('0x12')](_0x106c5d));_0x45176e(_0x106c5d);})[_0xeb78('0x16')](function(_0x18f08d){logger['error']('CreateOpenchannelQueueReport',_0x18f08d['message'],_0x92e410);_0xb97756(_0x576802['error'](0x1f4,_0x18f08d[_0xeb78('0x15')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2159c1){var _0x1fbf2f=this;return new Promise(function(_0x566336,_0x777ca3){return db['OpenchannelQueueReport'][_0xeb78('0x1b')](_0x2159c1[_0xeb78('0x19')],{'raw':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1[_0xeb78('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1['options'][_0xeb78('0x1c')]||null:null,'attributes':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1[_0xeb78('0x1a')]['attributes']||null:null,'limit':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1[_0xeb78('0x1a')][_0xeb78('0x1d')]||null:null})[_0xeb78('0xc')](function(_0x3d4a97){logger[_0xeb78('0xd')](_0xeb78('0x1e'),_0x2159c1);logger[_0xeb78('0x10')](_0xeb78('0x1e'),_0x2159c1,JSON[_0xeb78('0x12')](_0x3d4a97));_0x566336(_0x3d4a97);})[_0xeb78('0x16')](function(_0x505468){logger['error']('UpdateOpenchannelQueueReport',_0x505468[_0xeb78('0x15')],_0x2159c1);_0x777ca3(_0x1fbf2f[_0xeb78('0x13')](0x1f4,_0x505468[_0xeb78('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 5034646..36583b7 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 _0xd35e=['./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','/:id','post','create','put','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd35e,0x187));var _0xed35=function(_0x144db7,_0x592719){_0x144db7=_0x144db7-0x0;var _0x3efe6a=_0xd35e[_0x144db7];return _0x3efe6a;};'use strict';var multer=require(_0xed35('0x0'));var util=require('util');var path=require(_0xed35('0x1'));var timeout=require(_0xed35('0x2'));var express=require(_0xed35('0x3'));var router=express[_0xed35('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xed35('0x5'));var interaction=require(_0xed35('0x6'));var config=require(_0xed35('0x7'));var controller=require(_0xed35('0x8'));router[_0xed35('0x9')]('/',auth['isAuthenticated'](),controller[_0xed35('0xa')]);router[_0xed35('0x9')](_0xed35('0xb'),auth[_0xed35('0xc')](),controller['describe']);router[_0xed35('0x9')](_0xed35('0xd'),auth[_0xed35('0xc')](),controller['show']);router[_0xed35('0xe')]('/',auth[_0xed35('0xc')](),controller[_0xed35('0xf')]);router[_0xed35('0x10')](_0xed35('0xd'),auth['isAuthenticated'](),controller[_0xed35('0x11')]);router[_0xed35('0x12')](_0xed35('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x092d=['isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0x092d,0x1bb));var _0xd092=function(_0x13b796,_0x19507b){_0x13b796=_0x13b796-0x0;var _0x54757d=_0x092d[_0x13b796];return _0x54757d;};'use strict';var multer=require('multer');var util=require(_0xd092('0x0'));var path=require(_0xd092('0x1'));var timeout=require(_0xd092('0x2'));var express=require(_0xd092('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd092('0x4'));var interaction=require(_0xd092('0x5'));var config=require('../../config/environment');var controller=require(_0xd092('0x6'));router['get']('/',auth[_0xd092('0x7')](),controller[_0xd092('0x8')]);router['get'](_0xd092('0x9'),auth['isAuthenticated'](),controller[_0xd092('0xa')]);router['get'](_0xd092('0xb'),auth[_0xd092('0x7')](),controller[_0xd092('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd092('0xd')]);router[_0xd092('0xe')](_0xd092('0xb'),auth['isAuthenticated'](),controller[_0xd092('0xf')]);router[_0xd092('0x10')]('/:id',auth[_0xd092('0x7')](),controller['destroy']);module[_0xd092('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index fc075dc..2641647 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x47ea7b,_0x5693e4){var _0x53d729=function(_0x269360){while(--_0x269360){_0x47ea7b['push'](_0x47ea7b['shift']());}};_0x53d729(++_0x5693e4);}(_0x70e0,0x17b));var _0x070e=function(_0x4ac6b6,_0x3d9ca1){_0x4ac6b6=_0x4ac6b6-0x0;var _0x209ba0=_0x70e0[_0x4ac6b6];return _0x209ba0;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x279368,_0x41c002){var _0x40b6d0=function(_0x493776){while(--_0x493776){_0x279368['push'](_0x279368['shift']());}};_0x40b6d0(++_0x41c002);}(_0x008c,0x188));var _0xc008=function(_0x2c2f35,_0x20cda1){_0x2c2f35=_0x2c2f35-0x0;var _0x543b7e=_0x008c[_0x2c2f35];return _0x543b7e;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index b9d032d..b794755 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 _0x5c40=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelTransferReport','includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','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','count','set','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','name','send','index','map','rawAttributes','type','key','keys','query','filters','intersection','model','attributes'];(function(_0x4ebf6a,_0xfd0a40){var _0x1e7a72=function(_0x5978e8){while(--_0x5978e8){_0x4ebf6a['push'](_0x4ebf6a['shift']());}};_0x1e7a72(++_0xfd0a40);}(_0x5c40,0x67));var _0x05c4=function(_0xad5585,_0x45ef6f){_0xad5585=_0xad5585-0x0;var _0x2e3af9=_0x5c40[_0xad5585];return _0x2e3af9;};'use strict';var emlformat=require(_0x05c4('0x0'));var rimraf=require(_0x05c4('0x1'));var zipdir=require(_0x05c4('0x2'));var jsonpatch=require(_0x05c4('0x3'));var rp=require(_0x05c4('0x4'));var moment=require(_0x05c4('0x5'));var BPromise=require(_0x05c4('0x6'));var Mustache=require('mustache');var util=require(_0x05c4('0x7'));var path=require(_0x05c4('0x8'));var sox=require(_0x05c4('0x9'));var csv=require('to-csv');var ejs=require(_0x05c4('0xa'));var fs=require('fs');var fs_extra=require(_0x05c4('0xb'));var _=require(_0x05c4('0xc'));var squel=require(_0x05c4('0xd'));var crypto=require(_0x05c4('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x05c4('0xf'));var querystring=require('querystring');var Papa=require(_0x05c4('0x10'));var Redis=require(_0x05c4('0x11'));var authService=require(_0x05c4('0x12'));var qs=require(_0x05c4('0x13'));var as=require(_0x05c4('0x14'));var hardwareService=require(_0x05c4('0x15'));var logger=require(_0x05c4('0x16'))(_0x05c4('0x17'));var utils=require('../../config/utils');var config=require(_0x05c4('0x18'));var licenseUtil=require(_0x05c4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db758,_0x2ae7c6){_0x2ae7c6=_0x2ae7c6||0xcc;return function(_0x8c539c){if(_0x8c539c){return _0x4db758['sendStatus'](_0x2ae7c6);}return _0x4db758[_0x05c4('0x1a')](_0x2ae7c6)[_0x05c4('0x1b')]();};}function respondWithResult(_0x28207f,_0x5d8cd2){_0x5d8cd2=_0x5d8cd2||0xc8;return function(_0xe42b4b){if(_0xe42b4b){return _0x28207f[_0x05c4('0x1a')](_0x5d8cd2)[_0x05c4('0x1c')](_0xe42b4b);}};}function respondWithFilteredResult(_0x1b8c83,_0x32bed8){return function(_0x2429c6){if(_0x2429c6){var _0x3b369e=typeof _0x32bed8[_0x05c4('0x1d')]===_0x05c4('0x1e')&&typeof _0x32bed8[_0x05c4('0x1f')]===_0x05c4('0x1e');var _0x53cbc9=_0x2429c6[_0x05c4('0x20')];var _0x4dab64=_0x3b369e?0x0:_0x32bed8[_0x05c4('0x1d')];var _0x4a4cb5=_0x3b369e?_0x2429c6[_0x05c4('0x20')]:_0x32bed8['offset']+_0x32bed8[_0x05c4('0x1f')];var _0x4d639b;if(_0x4a4cb5>=_0x53cbc9){_0x4a4cb5=_0x53cbc9;_0x4d639b=0xc8;}else{_0x4d639b=0xce;}_0x1b8c83[_0x05c4('0x1a')](_0x4d639b);return _0x1b8c83[_0x05c4('0x21')](_0x05c4('0x22'),_0x4dab64+'-'+_0x4a4cb5+'/'+_0x53cbc9)[_0x05c4('0x1c')](_0x2429c6);}return null;};}function patchUpdates(_0x3415a){return function(_0x341bd0){try{jsonpatch[_0x05c4('0x23')](_0x341bd0,_0x3415a,!![]);}catch(_0x393e19){return BPromise[_0x05c4('0x24')](_0x393e19);}return _0x341bd0['save']();};}function saveUpdates(_0x293d97,_0x3a8f94){return function(_0x25cc2e){if(_0x25cc2e){return _0x25cc2e[_0x05c4('0x25')](_0x293d97)['then'](function(_0x2a4af2){return _0x2a4af2;});}return null;};}function removeEntity(_0x46255e,_0x55e31d){return function(_0x19c089){if(_0x19c089){return _0x19c089[_0x05c4('0x26')]()[_0x05c4('0x27')](function(){_0x46255e[_0x05c4('0x1a')](0xcc)[_0x05c4('0x1b')]();});}};}function handleEntityNotFound(_0x4c7af8,_0xd396f4){return function(_0x1e33e3){if(!_0x1e33e3){_0x4c7af8[_0x05c4('0x28')](0x194);}return _0x1e33e3;};}function handleError(_0x12a9f5,_0x13d46c){_0x13d46c=_0x13d46c||0x1f4;return function(_0xe6624c){logger['error'](_0xe6624c[_0x05c4('0x29')]);if(_0xe6624c['name']){delete _0xe6624c[_0x05c4('0x2a')];}_0x12a9f5[_0x05c4('0x1a')](_0x13d46c)[_0x05c4('0x2b')](_0xe6624c);};}exports[_0x05c4('0x2c')]=function(_0x52bdf3,_0x15e15f){var _0x37d91={},_0x4c8f22={},_0x39f9a3={'count':0x0,'rows':[]};var _0x2242e3=_[_0x05c4('0x2d')](db['OpenchannelTransferReport'][_0x05c4('0x2e')],function(_0x5ea0ad){return{'name':_0x5ea0ad['fieldName'],'type':_0x5ea0ad[_0x05c4('0x2f')][_0x05c4('0x30')]};});_0x4c8f22['model']=_[_0x05c4('0x2d')](_0x2242e3,'name');_0x4c8f22['query']=_[_0x05c4('0x31')](_0x52bdf3[_0x05c4('0x32')]);_0x4c8f22[_0x05c4('0x33')]=_[_0x05c4('0x34')](_0x4c8f22[_0x05c4('0x35')],_0x4c8f22[_0x05c4('0x32')]);_0x37d91[_0x05c4('0x36')]=_['intersection'](_0x4c8f22['model'],qs['fields'](_0x52bdf3[_0x05c4('0x32')][_0x05c4('0x37')]));_0x37d91[_0x05c4('0x36')]=_0x37d91['attributes'][_0x05c4('0x38')]?_0x37d91['attributes']:_0x4c8f22[_0x05c4('0x35')];if(!_0x52bdf3[_0x05c4('0x32')][_0x05c4('0x39')](_0x05c4('0x3a'))){_0x37d91['limit']=qs[_0x05c4('0x1f')](_0x52bdf3[_0x05c4('0x32')][_0x05c4('0x1f')]);_0x37d91[_0x05c4('0x1d')]=qs['offset'](_0x52bdf3[_0x05c4('0x32')][_0x05c4('0x1d')]);}_0x37d91[_0x05c4('0x3b')]=qs[_0x05c4('0x3c')](_0x52bdf3['query'][_0x05c4('0x3c')]);_0x37d91[_0x05c4('0x3d')]=qs[_0x05c4('0x33')](_[_0x05c4('0x3e')](_0x52bdf3[_0x05c4('0x32')],_0x4c8f22[_0x05c4('0x33')]),_0x2242e3);if(_0x52bdf3[_0x05c4('0x32')][_0x05c4('0x3f')]){_0x37d91['where']=_[_0x05c4('0x40')](_0x37d91[_0x05c4('0x3d')],{'$or':_[_0x05c4('0x2d')](_0x2242e3,function(_0x4b3238){if(_0x4b3238['type']!==_0x05c4('0x41')){var _0x34d924={};_0x34d924[_0x4b3238[_0x05c4('0x2a')]]={'$like':'%'+_0x52bdf3[_0x05c4('0x32')][_0x05c4('0x3f')]+'%'};return _0x34d924;}})});}_0x37d91=_[_0x05c4('0x40')]({},_0x37d91,_0x52bdf3[_0x05c4('0x42')]);var _0x2d5f3d={'where':_0x37d91[_0x05c4('0x3d')]};return db[_0x05c4('0x43')]['count'](_0x2d5f3d)[_0x05c4('0x27')](function(_0x364e06){_0x39f9a3['count']=_0x364e06;if(_0x52bdf3[_0x05c4('0x32')][_0x05c4('0x44')]){_0x37d91['include']=[{'all':!![]}];}return db[_0x05c4('0x43')][_0x05c4('0x45')](_0x37d91);})[_0x05c4('0x27')](function(_0x2c99b9){_0x39f9a3[_0x05c4('0x46')]=_0x2c99b9;return _0x39f9a3;})['then'](respondWithFilteredResult(_0x15e15f,_0x37d91))['catch'](handleError(_0x15e15f,null));};exports[_0x05c4('0x47')]=function(_0x168229,_0x25ac1d){var _0x72aba9={'raw':!![],'where':{'id':_0x168229[_0x05c4('0x48')]['id']}},_0x4d997e={};_0x4d997e[_0x05c4('0x35')]=_[_0x05c4('0x31')](db[_0x05c4('0x43')]['rawAttributes']);_0x4d997e[_0x05c4('0x32')]=_[_0x05c4('0x31')](_0x168229[_0x05c4('0x32')]);_0x4d997e[_0x05c4('0x33')]=_['intersection'](_0x4d997e[_0x05c4('0x35')],_0x4d997e[_0x05c4('0x32')]);_0x72aba9['attributes']=_['intersection'](_0x4d997e[_0x05c4('0x35')],qs[_0x05c4('0x37')](_0x168229[_0x05c4('0x32')][_0x05c4('0x37')]));_0x72aba9[_0x05c4('0x36')]=_0x72aba9[_0x05c4('0x36')]['length']?_0x72aba9[_0x05c4('0x36')]:_0x4d997e[_0x05c4('0x35')];if(_0x168229[_0x05c4('0x32')]['includeAll']){_0x72aba9[_0x05c4('0x49')]=[{'all':!![]}];}_0x72aba9=_[_0x05c4('0x40')]({},_0x72aba9,_0x168229[_0x05c4('0x42')]);return db[_0x05c4('0x43')][_0x05c4('0x4a')](_0x72aba9)[_0x05c4('0x27')](handleEntityNotFound(_0x25ac1d,null))[_0x05c4('0x27')](respondWithResult(_0x25ac1d,null))[_0x05c4('0x4b')](handleError(_0x25ac1d,null));};exports[_0x05c4('0x4c')]=function(_0x4fa88b,_0xc94ab6){return db[_0x05c4('0x43')][_0x05c4('0x4c')](_0x4fa88b[_0x05c4('0x4d')],{})[_0x05c4('0x27')](respondWithResult(_0xc94ab6,0xc9))[_0x05c4('0x4b')](handleError(_0xc94ab6,null));};exports['update']=function(_0x4a39fe,_0x16e4e8){if(_0x4a39fe[_0x05c4('0x4d')]['id']){delete _0x4a39fe[_0x05c4('0x4d')]['id'];}return db[_0x05c4('0x43')][_0x05c4('0x4a')]({'where':{'id':_0x4a39fe['params']['id']}})[_0x05c4('0x27')](handleEntityNotFound(_0x16e4e8,null))[_0x05c4('0x27')](saveUpdates(_0x4a39fe[_0x05c4('0x4d')],null))[_0x05c4('0x27')](respondWithResult(_0x16e4e8,null))['catch'](handleError(_0x16e4e8,null));};exports[_0x05c4('0x26')]=function(_0x285648,_0x583c80){return db[_0x05c4('0x43')]['find']({'where':{'id':_0x285648[_0x05c4('0x48')]['id']}})[_0x05c4('0x27')](handleEntityNotFound(_0x583c80,null))[_0x05c4('0x27')](removeEntity(_0x583c80,null))[_0x05c4('0x4b')](handleError(_0x583c80,null));};exports[_0x05c4('0x4e')]=function(_0x2c3d17,_0x90f6c6){return db[_0x05c4('0x43')][_0x05c4('0x4e')]()[_0x05c4('0x27')](respondWithResult(_0x90f6c6,null))[_0x05c4('0x4b')](handleError(_0x90f6c6,null));}; \ No newline at end of file +var _0x78ec=['apply','reject','update','then','destroy','stack','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json'];(function(_0x208f68,_0x10c6bf){var _0x468bd6=function(_0x4dbc20){while(--_0x4dbc20){_0x208f68['push'](_0x208f68['shift']());}};_0x468bd6(++_0x10c6bf);}(_0x78ec,0x71));var _0xc78e=function(_0x2b1e47,_0x3aef51){_0x2b1e47=_0x2b1e47-0x0;var _0x193d50=_0x78ec[_0x2b1e47];return _0x193d50;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc78e('0x0'));var zipdir=require(_0xc78e('0x1'));var jsonpatch=require(_0xc78e('0x2'));var rp=require(_0xc78e('0x3'));var moment=require(_0xc78e('0x4'));var BPromise=require(_0xc78e('0x5'));var Mustache=require(_0xc78e('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc78e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc78e('0x8'));var _=require(_0xc78e('0x9'));var squel=require(_0xc78e('0xa'));var crypto=require(_0xc78e('0xb'));var jsforce=require(_0xc78e('0xc'));var deskjs=require(_0xc78e('0xd'));var toCsv=require(_0xc78e('0x7'));var querystring=require(_0xc78e('0xe'));var Papa=require(_0xc78e('0xf'));var Redis=require('ioredis');var authService=require(_0xc78e('0x10'));var qs=require(_0xc78e('0x11'));var as=require(_0xc78e('0x12'));var hardwareService=require(_0xc78e('0x13'));var logger=require(_0xc78e('0x14'))(_0xc78e('0x15'));var utils=require('../../config/utils');var config=require(_0xc78e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc78e('0x17'))['db'];function respondWithStatusCode(_0x17a78a,_0x3f8df6){_0x3f8df6=_0x3f8df6||0xcc;return function(_0x1a1e6d){if(_0x1a1e6d){return _0x17a78a[_0xc78e('0x18')](_0x3f8df6);}return _0x17a78a[_0xc78e('0x19')](_0x3f8df6)[_0xc78e('0x1a')]();};}function respondWithResult(_0x8bc94d,_0x124f26){_0x124f26=_0x124f26||0xc8;return function(_0x1430a3){if(_0x1430a3){return _0x8bc94d[_0xc78e('0x19')](_0x124f26)['json'](_0x1430a3);}};}function respondWithFilteredResult(_0x402b9b,_0x4c63b1){return function(_0x149bf7){if(_0x149bf7){var _0x3088bf=typeof _0x4c63b1[_0xc78e('0x1b')]==='undefined'&&typeof _0x4c63b1[_0xc78e('0x1c')]===_0xc78e('0x1d');var _0x404bac=_0x149bf7[_0xc78e('0x1e')];var _0x22fa29=_0x3088bf?0x0:_0x4c63b1[_0xc78e('0x1b')];var _0x381cfb=_0x3088bf?_0x149bf7[_0xc78e('0x1e')]:_0x4c63b1[_0xc78e('0x1b')]+_0x4c63b1['limit'];var _0x561340;if(_0x381cfb>=_0x404bac){_0x381cfb=_0x404bac;_0x561340=0xc8;}else{_0x561340=0xce;}_0x402b9b[_0xc78e('0x19')](_0x561340);return _0x402b9b['set'](_0xc78e('0x1f'),_0x22fa29+'-'+_0x381cfb+'/'+_0x404bac)[_0xc78e('0x20')](_0x149bf7);}return null;};}function patchUpdates(_0x38d066){return function(_0x4d3134){try{jsonpatch[_0xc78e('0x21')](_0x4d3134,_0x38d066,!![]);}catch(_0x5462a2){return BPromise[_0xc78e('0x22')](_0x5462a2);}return _0x4d3134['save']();};}function saveUpdates(_0x35f396,_0x3b914c){return function(_0x284c57){if(_0x284c57){return _0x284c57[_0xc78e('0x23')](_0x35f396)[_0xc78e('0x24')](function(_0x3e0e94){return _0x3e0e94;});}return null;};}function removeEntity(_0x4ad8ef,_0x3470b7){return function(_0x58ee8e){if(_0x58ee8e){return _0x58ee8e[_0xc78e('0x25')]()[_0xc78e('0x24')](function(){_0x4ad8ef[_0xc78e('0x19')](0xcc)[_0xc78e('0x1a')]();});}};}function handleEntityNotFound(_0x35a088,_0x79db9c){return function(_0x5c86d5){if(!_0x5c86d5){_0x35a088['sendStatus'](0x194);}return _0x5c86d5;};}function handleError(_0x3311e9,_0xa0cca9){_0xa0cca9=_0xa0cca9||0x1f4;return function(_0x2bf12e){logger['error'](_0x2bf12e[_0xc78e('0x26')]);if(_0x2bf12e['name']){delete _0x2bf12e['name'];}_0x3311e9[_0xc78e('0x19')](_0xa0cca9)[_0xc78e('0x27')](_0x2bf12e);};}exports[_0xc78e('0x28')]=function(_0x5c7c03,_0x8ed276){var _0x47f91d={},_0x5ba5db={},_0x4b284f={'count':0x0,'rows':[]};var _0xf90265=_[_0xc78e('0x29')](db[_0xc78e('0x2a')][_0xc78e('0x2b')],function(_0x2e0f77){return{'name':_0x2e0f77[_0xc78e('0x2c')],'type':_0x2e0f77[_0xc78e('0x2d')]['key']};});_0x5ba5db[_0xc78e('0x2e')]=_[_0xc78e('0x29')](_0xf90265,_0xc78e('0x2f'));_0x5ba5db[_0xc78e('0x30')]=_[_0xc78e('0x31')](_0x5c7c03[_0xc78e('0x30')]);_0x5ba5db['filters']=_[_0xc78e('0x32')](_0x5ba5db[_0xc78e('0x2e')],_0x5ba5db[_0xc78e('0x30')]);_0x47f91d[_0xc78e('0x33')]=_[_0xc78e('0x32')](_0x5ba5db[_0xc78e('0x2e')],qs[_0xc78e('0x34')](_0x5c7c03[_0xc78e('0x30')][_0xc78e('0x34')]));_0x47f91d[_0xc78e('0x33')]=_0x47f91d['attributes']['length']?_0x47f91d[_0xc78e('0x33')]:_0x5ba5db[_0xc78e('0x2e')];if(!_0x5c7c03[_0xc78e('0x30')][_0xc78e('0x35')](_0xc78e('0x36'))){_0x47f91d[_0xc78e('0x1c')]=qs[_0xc78e('0x1c')](_0x5c7c03[_0xc78e('0x30')]['limit']);_0x47f91d[_0xc78e('0x1b')]=qs[_0xc78e('0x1b')](_0x5c7c03[_0xc78e('0x30')]['offset']);}_0x47f91d['order']=qs[_0xc78e('0x37')](_0x5c7c03[_0xc78e('0x30')]['sort']);_0x47f91d[_0xc78e('0x38')]=qs[_0xc78e('0x39')](_['pick'](_0x5c7c03[_0xc78e('0x30')],_0x5ba5db[_0xc78e('0x39')]),_0xf90265);if(_0x5c7c03[_0xc78e('0x30')]['filter']){_0x47f91d[_0xc78e('0x38')]=_[_0xc78e('0x3a')](_0x47f91d['where'],{'$or':_['map'](_0xf90265,function(_0x1bf1f6){if(_0x1bf1f6[_0xc78e('0x2d')]!==_0xc78e('0x3b')){var _0x46d03b={};_0x46d03b[_0x1bf1f6[_0xc78e('0x2f')]]={'$like':'%'+_0x5c7c03['query'][_0xc78e('0x3c')]+'%'};return _0x46d03b;}})});}_0x47f91d=_['merge']({},_0x47f91d,_0x5c7c03[_0xc78e('0x3d')]);var _0x546ca9={'where':_0x47f91d[_0xc78e('0x38')]};return db[_0xc78e('0x2a')][_0xc78e('0x1e')](_0x546ca9)[_0xc78e('0x24')](function(_0x1ace66){_0x4b284f[_0xc78e('0x1e')]=_0x1ace66;if(_0x5c7c03[_0xc78e('0x30')][_0xc78e('0x3e')]){_0x47f91d[_0xc78e('0x3f')]=[{'all':!![]}];}return db[_0xc78e('0x2a')][_0xc78e('0x40')](_0x47f91d);})['then'](function(_0x2b3fe8){_0x4b284f[_0xc78e('0x41')]=_0x2b3fe8;return _0x4b284f;})[_0xc78e('0x24')](respondWithFilteredResult(_0x8ed276,_0x47f91d))[_0xc78e('0x42')](handleError(_0x8ed276,null));};exports[_0xc78e('0x43')]=function(_0x3ce7b1,_0x448c2c){var _0xa05906={'raw':!![],'where':{'id':_0x3ce7b1[_0xc78e('0x44')]['id']}},_0x56e420={};_0x56e420['model']=_[_0xc78e('0x31')](db['OpenchannelTransferReport']['rawAttributes']);_0x56e420[_0xc78e('0x30')]=_['keys'](_0x3ce7b1[_0xc78e('0x30')]);_0x56e420['filters']=_[_0xc78e('0x32')](_0x56e420['model'],_0x56e420[_0xc78e('0x30')]);_0xa05906[_0xc78e('0x33')]=_[_0xc78e('0x32')](_0x56e420['model'],qs[_0xc78e('0x34')](_0x3ce7b1[_0xc78e('0x30')]['fields']));_0xa05906['attributes']=_0xa05906['attributes']['length']?_0xa05906[_0xc78e('0x33')]:_0x56e420[_0xc78e('0x2e')];if(_0x3ce7b1[_0xc78e('0x30')][_0xc78e('0x3e')]){_0xa05906[_0xc78e('0x3f')]=[{'all':!![]}];}_0xa05906=_[_0xc78e('0x3a')]({},_0xa05906,_0x3ce7b1[_0xc78e('0x3d')]);return db['OpenchannelTransferReport'][_0xc78e('0x45')](_0xa05906)['then'](handleEntityNotFound(_0x448c2c,null))[_0xc78e('0x24')](respondWithResult(_0x448c2c,null))[_0xc78e('0x42')](handleError(_0x448c2c,null));};exports['create']=function(_0x5bd97b,_0x1915e7){return db[_0xc78e('0x2a')][_0xc78e('0x46')](_0x5bd97b['body'],{})['then'](respondWithResult(_0x1915e7,0xc9))[_0xc78e('0x42')](handleError(_0x1915e7,null));};exports[_0xc78e('0x23')]=function(_0x418414,_0x288a57){if(_0x418414[_0xc78e('0x47')]['id']){delete _0x418414[_0xc78e('0x47')]['id'];}return db[_0xc78e('0x2a')][_0xc78e('0x45')]({'where':{'id':_0x418414[_0xc78e('0x44')]['id']}})[_0xc78e('0x24')](handleEntityNotFound(_0x288a57,null))[_0xc78e('0x24')](saveUpdates(_0x418414['body'],null))[_0xc78e('0x24')](respondWithResult(_0x288a57,null))[_0xc78e('0x42')](handleError(_0x288a57,null));};exports[_0xc78e('0x25')]=function(_0x1943e6,_0x1bb1b5){return db[_0xc78e('0x2a')]['find']({'where':{'id':_0x1943e6[_0xc78e('0x44')]['id']}})['then'](handleEntityNotFound(_0x1bb1b5,null))[_0xc78e('0x24')](removeEntity(_0x1bb1b5,null))[_0xc78e('0x42')](handleError(_0x1bb1b5,null));};exports[_0xc78e('0x48')]=function(_0x347e37,_0x37c392){return db[_0xc78e('0x2a')][_0xc78e('0x48')]()[_0xc78e('0x24')](respondWithResult(_0x37c392,null))[_0xc78e('0x42')](handleError(_0x37c392,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 74cc37e..aea516b 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 _0x64fb=['moment','bluebird','request-promise','path','../../config/environment','./openchannelTransferReport.attributes','OpenchannelTransferReport','uniqueid','lodash','../../config/logger','api'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x64fb,0x189));var _0xb64f=function(_0x1424c6,_0x1ea921){_0x1424c6=_0x1424c6-0x0;var _0x28ea19=_0x64fb[_0x1424c6];return _0x28ea19;};'use strict';var _=require(_0xb64f('0x0'));var util=require('util');var logger=require(_0xb64f('0x1'))(_0xb64f('0x2'));var moment=require(_0xb64f('0x3'));var BPromise=require(_0xb64f('0x4'));var rp=require(_0xb64f('0x5'));var fs=require('fs');var path=require(_0xb64f('0x6'));var rimraf=require('rimraf');var config=require(_0xb64f('0x7'));var attributes=require(_0xb64f('0x8'));module['exports']=function(_0x17089e,_0x585bbd){return _0x17089e['define'](_0xb64f('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xb64f('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x830a=['request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','api','moment','bluebird'];(function(_0x3add47,_0x52ea82){var _0x51b042=function(_0x58aef0){while(--_0x58aef0){_0x3add47['push'](_0x3add47['shift']());}};_0x51b042(++_0x52ea82);}(_0x830a,0xb2));var _0xa830=function(_0x49cafd,_0x599cf8){_0x49cafd=_0x49cafd-0x0;var _0x1c7b81=_0x830a[_0x49cafd];return _0x1c7b81;};'use strict';var _=require('lodash');var util=require(_0xa830('0x0'));var logger=require('../../config/logger')(_0xa830('0x1'));var moment=require(_0xa830('0x2'));var BPromise=require(_0xa830('0x3'));var rp=require(_0xa830('0x4'));var fs=require('fs');var path=require(_0xa830('0x5'));var rimraf=require(_0xa830('0x6'));var config=require(_0xa830('0x7'));var attributes=require(_0xa830('0x8'));module['exports']=function(_0x23f916,_0x48fab6){return _0x23f916[_0xa830('0x9')](_0xa830('0xa'),attributes,{'tableName':_0xa830('0xb'),'paranoid':![],'indexes':[{'name':_0xa830('0xc'),'fields':[_0xa830('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 7e3eeea..897d702 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 _0x8c52=['result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x43109a,_0x1539ee){var _0x7d63da=function(_0x4aacd1){while(--_0x4aacd1){_0x43109a['push'](_0x43109a['shift']());}};_0x7d63da(++_0x1539ee);}(_0x8c52,0x7e));var _0x28c5=function(_0x4132d1,_0x41fbbd){_0x4132d1=_0x4132d1-0x0;var _0x27d9cb=_0x8c52[_0x4132d1];return _0x27d9cb;};'use strict';var _=require(_0x28c5('0x0'));var util=require('util');var moment=require(_0x28c5('0x1'));var BPromise=require(_0x28c5('0x2'));var rs=require(_0x28c5('0x3'));var fs=require('fs');var Redis=require(_0x28c5('0x4'));var db=require(_0x28c5('0x5'))['db'];var utils=require(_0x28c5('0x6'));var logger=require(_0x28c5('0x7'))(_0x28c5('0x8'));var config=require(_0x28c5('0x9'));var jayson=require(_0x28c5('0xa'));var client=jayson[_0x28c5('0xb')][_0x28c5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53584d,_0x4f213c,_0x5d9299){return new BPromise(function(_0x5099e8,_0x31f24f){return client[_0x28c5('0xd')](_0x53584d,_0x5d9299)[_0x28c5('0xe')](function(_0x530260){logger[_0x28c5('0xf')](_0x28c5('0x10'),_0x4f213c,'request\x20sent');logger[_0x28c5('0x11')](_0x28c5('0x12'),_0x4f213c,_0x28c5('0x13'),JSON[_0x28c5('0x14')](_0x530260));if(_0x530260[_0x28c5('0x15')]){if(_0x530260[_0x28c5('0x15')][_0x28c5('0x16')]===0x1f4){logger[_0x28c5('0x15')](_0x28c5('0x10'),_0x4f213c,_0x530260[_0x28c5('0x15')]['message']);return _0x31f24f(_0x530260[_0x28c5('0x15')][_0x28c5('0x17')]);}logger[_0x28c5('0x15')](_0x28c5('0x10'),_0x4f213c,_0x530260['error'][_0x28c5('0x17')]);return _0x5099e8(_0x530260[_0x28c5('0x15')][_0x28c5('0x17')]);}else{logger[_0x28c5('0xf')](_0x28c5('0x10'),_0x4f213c,_0x28c5('0x13'));_0x5099e8(_0x530260[_0x28c5('0x18')][_0x28c5('0x17')]);}})['catch'](function(_0x36d820){logger[_0x28c5('0x15')](_0x28c5('0x10'),_0x4f213c,_0x36d820);_0x31f24f(_0x36d820);});});} \ No newline at end of file +var _0x7923=['randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird'];(function(_0x35de69,_0x446320){var _0x3c7af9=function(_0x1a9e7a){while(--_0x1a9e7a){_0x35de69['push'](_0x35de69['shift']());}};_0x3c7af9(++_0x446320);}(_0x7923,0x8f));var _0x3792=function(_0x49e363,_0x4376da){_0x49e363=_0x49e363-0x0;var _0x39335c=_0x7923[_0x49e363];return _0x39335c;};'use strict';var _=require(_0x3792('0x0'));var util=require(_0x3792('0x1'));var moment=require(_0x3792('0x2'));var BPromise=require(_0x3792('0x3'));var rs=require(_0x3792('0x4'));var fs=require('fs');var Redis=require(_0x3792('0x5'));var db=require(_0x3792('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3792('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3792('0x8'));var client=jayson['client'][_0x3792('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18b993,_0x1e065a,_0x5b55f8){return new BPromise(function(_0x5b453a,_0x297f6f){return client[_0x3792('0xa')](_0x18b993,_0x5b55f8)['then'](function(_0x19d6e5){logger[_0x3792('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1e065a,_0x3792('0xc'));logger[_0x3792('0xd')](_0x3792('0xe'),_0x1e065a,'request\x20sent',JSON['stringify'](_0x19d6e5));if(_0x19d6e5[_0x3792('0xf')]){if(_0x19d6e5[_0x3792('0xf')][_0x3792('0x10')]===0x1f4){logger[_0x3792('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1e065a,_0x19d6e5['error'][_0x3792('0x11')]);return _0x297f6f(_0x19d6e5[_0x3792('0xf')][_0x3792('0x11')]);}logger[_0x3792('0xf')](_0x3792('0x12'),_0x1e065a,_0x19d6e5[_0x3792('0xf')][_0x3792('0x11')]);return _0x5b453a(_0x19d6e5[_0x3792('0xf')][_0x3792('0x11')]);}else{logger[_0x3792('0xb')](_0x3792('0x12'),_0x1e065a,_0x3792('0xc'));_0x5b453a(_0x19d6e5[_0x3792('0x13')][_0x3792('0x11')]);}})[_0x3792('0x14')](function(_0x683ede){logger[_0x3792('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1e065a,_0x683ede);_0x297f6f(_0x683ede);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index ce7f04a..0642fc7 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 _0x7956=['express','fs-extra','../../components/interaction/service','./pause.controller','index','get','/:id','isAuthenticated','create','put','update','exports','multer','util','path','connect-timeout'];(function(_0x2fad6d,_0x1a3066){var _0x27db66=function(_0x411f53){while(--_0x411f53){_0x2fad6d['push'](_0x2fad6d['shift']());}};_0x27db66(++_0x1a3066);}(_0x7956,0x1cc));var _0x6795=function(_0x37b019,_0x26f4a5){_0x37b019=_0x37b019-0x0;var _0x198edb=_0x7956[_0x37b019];return _0x198edb;};'use strict';var multer=require(_0x6795('0x0'));var util=require(_0x6795('0x1'));var path=require(_0x6795('0x2'));var timeout=require(_0x6795('0x3'));var express=require(_0x6795('0x4'));var router=express['Router']();var fs_extra=require(_0x6795('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6795('0x6'));var config=require('../../config/environment');var controller=require(_0x6795('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6795('0x8')]);router[_0x6795('0x9')](_0x6795('0xa'),auth[_0x6795('0xb')](),controller['show']);router['post']('/',auth[_0x6795('0xb')](),controller[_0x6795('0xc')]);router[_0x6795('0xd')](_0x6795('0xa'),auth[_0x6795('0xb')](),controller[_0x6795('0xe')]);router['delete'](_0x6795('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x6795('0xf')]=router; \ No newline at end of file +var _0x6102=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x12acd7,_0x103b6f){var _0x4ad520=function(_0x25ef57){while(--_0x25ef57){_0x12acd7['push'](_0x12acd7['shift']());}};_0x4ad520(++_0x103b6f);}(_0x6102,0x14d));var _0x2610=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x6102[_0x35da42];return _0x370035;};'use strict';var multer=require(_0x2610('0x0'));var util=require(_0x2610('0x1'));var path=require(_0x2610('0x2'));var timeout=require('connect-timeout');var express=require(_0x2610('0x3'));var router=express[_0x2610('0x4')]();var fs_extra=require(_0x2610('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2610('0x6'));var config=require(_0x2610('0x7'));var controller=require(_0x2610('0x8'));router[_0x2610('0x9')]('/',auth[_0x2610('0xa')](),controller[_0x2610('0xb')]);router['get'](_0x2610('0xc'),auth[_0x2610('0xa')](),controller[_0x2610('0xd')]);router[_0x2610('0xe')]('/',auth[_0x2610('0xa')](),controller[_0x2610('0xf')]);router[_0x2610('0x10')](_0x2610('0xc'),auth[_0x2610('0xa')](),controller[_0x2610('0x11')]);router[_0x2610('0x12')](_0x2610('0xc'),auth[_0x2610('0xa')](),controller[_0x2610('0x13')]);module[_0x2610('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index dfe583a..54157b5 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 _0xdf12=['sequelize','exports','name','STRING'];(function(_0xb74c89,_0x246040){var _0xe4ccef=function(_0x12b652){while(--_0x12b652){_0xb74c89['push'](_0xb74c89['shift']());}};_0xe4ccef(++_0x246040);}(_0xdf12,0x194));var _0x2df1=function(_0x599f16,_0x967c1c){_0x599f16=_0x599f16-0x0;var _0x2f0274=_0xdf12[_0x599f16];return _0x2f0274;};'use strict';var Sequelize=require(_0x2df1('0x0'));module[_0x2df1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2df1('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x2df1('0x3')]}}; \ No newline at end of file +var _0xbad4=['exports','STRING','name','sequelize'];(function(_0x4b5fe9,_0x572406){var _0x20548c=function(_0x246649){while(--_0x246649){_0x4b5fe9['push'](_0x4b5fe9['shift']());}};_0x20548c(++_0x572406);}(_0xbad4,0x1cf));var _0x4bad=function(_0xfce16c,_0x3c3dfb){_0xfce16c=_0xfce16c-0x0;var _0x5515d8=_0xbad4[_0xfce16c];return _0x5515d8;};'use strict';var Sequelize=require(_0x4bad('0x0'));module[_0x4bad('0x1')]={'name':{'type':Sequelize[_0x4bad('0x2')],'unique':_0x4bad('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x4bad('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 3e3ba37..391d461 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 _0x3ac9=['show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','Pauses','error','stack','name','send','Pause','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x16d81d,_0x5490b1){var _0x414aee=function(_0x2bebb0){while(--_0x2bebb0){_0x16d81d['push'](_0x16d81d['shift']());}};_0x414aee(++_0x5490b1);}(_0x3ac9,0x160));var _0x93ac=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0x3ac9[_0x29ae80];return _0x5d6d71;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x93ac('0x0'));var jsonpatch=require(_0x93ac('0x1'));var rp=require(_0x93ac('0x2'));var moment=require(_0x93ac('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x93ac('0x4'));var util=require('util');var path=require(_0x93ac('0x5'));var sox=require(_0x93ac('0x6'));var csv=require(_0x93ac('0x7'));var ejs=require(_0x93ac('0x8'));var fs=require('fs');var fs_extra=require(_0x93ac('0x9'));var _=require(_0x93ac('0xa'));var squel=require(_0x93ac('0xb'));var crypto=require(_0x93ac('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x93ac('0xd'));var toCsv=require(_0x93ac('0x7'));var querystring=require(_0x93ac('0xe'));var Papa=require('papaparse');var Redis=require(_0x93ac('0xf'));var authService=require(_0x93ac('0x10'));var qs=require(_0x93ac('0x11'));var as=require(_0x93ac('0x12'));var hardwareService=require(_0x93ac('0x13'));var logger=require(_0x93ac('0x14'))('api');var utils=require(_0x93ac('0x15'));var config=require(_0x93ac('0x16'));var licenseUtil=require(_0x93ac('0x17'));var db=require(_0x93ac('0x18'))['db'];function respondWithStatusCode(_0xb6ee9a,_0x5e6f3f){_0x5e6f3f=_0x5e6f3f||0xcc;return function(_0x5a7016){if(_0x5a7016){return _0xb6ee9a[_0x93ac('0x19')](_0x5e6f3f);}return _0xb6ee9a[_0x93ac('0x1a')](_0x5e6f3f)[_0x93ac('0x1b')]();};}function respondWithResult(_0x30772c,_0x36acfd){_0x36acfd=_0x36acfd||0xc8;return function(_0x55866a){if(_0x55866a){return _0x30772c['status'](_0x36acfd)[_0x93ac('0x1c')](_0x55866a);}};}function respondWithFilteredResult(_0xa2afe3,_0x29dccf){return function(_0x616209){if(_0x616209){var _0x286c63=typeof _0x29dccf[_0x93ac('0x1d')]===_0x93ac('0x1e')&&typeof _0x29dccf['limit']===_0x93ac('0x1e');var _0x37b91a=_0x616209[_0x93ac('0x1f')];var _0x81af97=_0x286c63?0x0:_0x29dccf[_0x93ac('0x1d')];var _0x160493=_0x286c63?_0x616209[_0x93ac('0x1f')]:_0x29dccf[_0x93ac('0x1d')]+_0x29dccf[_0x93ac('0x20')];var _0xe34f02;if(_0x160493>=_0x37b91a){_0x160493=_0x37b91a;_0xe34f02=0xc8;}else{_0xe34f02=0xce;}_0xa2afe3['status'](_0xe34f02);return _0xa2afe3[_0x93ac('0x21')]('Content-Range',_0x81af97+'-'+_0x160493+'/'+_0x37b91a)['json'](_0x616209);}return null;};}function patchUpdates(_0x3dd5b4){return function(_0x2fe6c2){try{jsonpatch[_0x93ac('0x22')](_0x2fe6c2,_0x3dd5b4,!![]);}catch(_0x54da05){return BPromise[_0x93ac('0x23')](_0x54da05);}return _0x2fe6c2[_0x93ac('0x24')]();};}function saveUpdates(_0x399590,_0x2f30a4){return function(_0x57c765){if(_0x57c765){return _0x57c765[_0x93ac('0x25')](_0x399590)[_0x93ac('0x26')](function(_0x574066){return _0x574066;});}return null;};}function removeEntity(_0x5ecd69,_0x2c720a){return function(_0x5d4efb){if(_0x5d4efb){return _0x5d4efb[_0x93ac('0x27')]()[_0x93ac('0x26')](function(){var _0x5753e7=_0x5d4efb['get']({'plain':!![]});var _0x5333f5=_0x93ac('0x28');return db['UserProfileResource'][_0x93ac('0x27')]({'where':{'type':_0x5333f5,'resourceId':_0x5753e7['id']}})[_0x93ac('0x26')](function(){return _0x5d4efb;});})['then'](function(){_0x5ecd69[_0x93ac('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59e512,_0x34b4ca){return function(_0x5f0826){if(!_0x5f0826){_0x59e512['sendStatus'](0x194);}return _0x5f0826;};}function handleError(_0x1fbf3b,_0x24390c){_0x24390c=_0x24390c||0x1f4;return function(_0x259b6d){logger[_0x93ac('0x29')](_0x259b6d[_0x93ac('0x2a')]);if(_0x259b6d[_0x93ac('0x2b')]){delete _0x259b6d['name'];}_0x1fbf3b[_0x93ac('0x1a')](_0x24390c)[_0x93ac('0x2c')](_0x259b6d);};}exports['index']=function(_0x9bb53e,_0x3aa9a7){var _0x366ec3={},_0x270736={},_0x355bca={'count':0x0,'rows':[]};var _0x85db4a=_['map'](db[_0x93ac('0x2d')][_0x93ac('0x2e')],function(_0x12b243){return{'name':_0x12b243['fieldName'],'type':_0x12b243[_0x93ac('0x2f')][_0x93ac('0x30')]};});_0x270736[_0x93ac('0x31')]=_[_0x93ac('0x32')](_0x85db4a,_0x93ac('0x2b'));_0x270736[_0x93ac('0x33')]=_[_0x93ac('0x34')](_0x9bb53e['query']);_0x270736[_0x93ac('0x35')]=_[_0x93ac('0x36')](_0x270736[_0x93ac('0x31')],_0x270736['query']);_0x366ec3[_0x93ac('0x37')]=_[_0x93ac('0x36')](_0x270736['model'],qs[_0x93ac('0x38')](_0x9bb53e[_0x93ac('0x33')][_0x93ac('0x38')]));_0x366ec3[_0x93ac('0x37')]=_0x366ec3[_0x93ac('0x37')][_0x93ac('0x39')]?_0x366ec3['attributes']:_0x270736[_0x93ac('0x31')];if(!_0x9bb53e['query'][_0x93ac('0x3a')](_0x93ac('0x3b'))){_0x366ec3[_0x93ac('0x20')]=qs[_0x93ac('0x20')](_0x9bb53e[_0x93ac('0x33')][_0x93ac('0x20')]);_0x366ec3[_0x93ac('0x1d')]=qs['offset'](_0x9bb53e[_0x93ac('0x33')][_0x93ac('0x1d')]);}_0x366ec3[_0x93ac('0x3c')]=qs['sort'](_0x9bb53e[_0x93ac('0x33')][_0x93ac('0x3d')]);_0x366ec3[_0x93ac('0x3e')]=qs['filters'](_[_0x93ac('0x3f')](_0x9bb53e[_0x93ac('0x33')],_0x270736[_0x93ac('0x35')]),_0x85db4a);if(_0x9bb53e[_0x93ac('0x33')][_0x93ac('0x40')]){_0x366ec3[_0x93ac('0x3e')]=_[_0x93ac('0x41')](_0x366ec3[_0x93ac('0x3e')],{'$or':_[_0x93ac('0x32')](_0x85db4a,function(_0x597e8e){if(_0x597e8e['type']!==_0x93ac('0x42')){var _0x42662b={};_0x42662b[_0x597e8e[_0x93ac('0x2b')]]={'$like':'%'+_0x9bb53e['query'][_0x93ac('0x40')]+'%'};return _0x42662b;}})});}_0x366ec3=_['merge']({},_0x366ec3,_0x9bb53e[_0x93ac('0x43')]);var _0x198433={'where':_0x366ec3[_0x93ac('0x3e')]};return db['Pause'][_0x93ac('0x1f')](_0x198433)[_0x93ac('0x26')](function(_0x6dd99f){_0x355bca[_0x93ac('0x1f')]=_0x6dd99f;if(_0x9bb53e[_0x93ac('0x33')][_0x93ac('0x44')]){_0x366ec3[_0x93ac('0x45')]=[{'all':!![]}];}return db['Pause'][_0x93ac('0x46')](_0x366ec3);})[_0x93ac('0x26')](function(_0x21f348){_0x355bca[_0x93ac('0x47')]=_0x21f348;return _0x355bca;})[_0x93ac('0x26')](respondWithFilteredResult(_0x3aa9a7,_0x366ec3))[_0x93ac('0x48')](handleError(_0x3aa9a7,null));};exports[_0x93ac('0x49')]=function(_0x431c85,_0x4e3f0b){var _0x522a9d={'raw':!![],'where':{'id':_0x431c85[_0x93ac('0x4a')]['id']}},_0x576ac6={};_0x576ac6[_0x93ac('0x31')]=_['keys'](db['Pause']['rawAttributes']);_0x576ac6[_0x93ac('0x33')]=_['keys'](_0x431c85[_0x93ac('0x33')]);_0x576ac6[_0x93ac('0x35')]=_[_0x93ac('0x36')](_0x576ac6[_0x93ac('0x31')],_0x576ac6[_0x93ac('0x33')]);_0x522a9d[_0x93ac('0x37')]=_['intersection'](_0x576ac6[_0x93ac('0x31')],qs[_0x93ac('0x38')](_0x431c85['query'][_0x93ac('0x38')]));_0x522a9d[_0x93ac('0x37')]=_0x522a9d[_0x93ac('0x37')]['length']?_0x522a9d[_0x93ac('0x37')]:_0x576ac6[_0x93ac('0x31')];if(_0x431c85['query'][_0x93ac('0x44')]){_0x522a9d[_0x93ac('0x45')]=[{'all':!![]}];}_0x522a9d=_[_0x93ac('0x41')]({},_0x522a9d,_0x431c85[_0x93ac('0x43')]);return db[_0x93ac('0x2d')][_0x93ac('0x4b')](_0x522a9d)['then'](handleEntityNotFound(_0x4e3f0b,null))[_0x93ac('0x26')](respondWithResult(_0x4e3f0b,null))[_0x93ac('0x48')](handleError(_0x4e3f0b,null));};exports['create']=function(_0x4b1c8e,_0x485973){return db[_0x93ac('0x2d')][_0x93ac('0x4c')](_0x4b1c8e[_0x93ac('0x4d')],{})[_0x93ac('0x26')](function(_0x26e9ad){var _0x1828de=_0x4b1c8e['user']['get']({'plain':!![]});if(!_0x1828de)throw new Error(_0x93ac('0x4e'));if(_0x1828de[_0x93ac('0x4f')]===_0x93ac('0x50')){var _0x2cfd9b=_0x26e9ad['get']({'plain':!![]});var _0xe01eae=_0x93ac('0x28');return db[_0x93ac('0x51')]['find']({'where':{'name':_0xe01eae,'userProfileId':_0x1828de[_0x93ac('0x52')]},'raw':!![]})['then'](function(_0x3b1a28){if(_0x3b1a28&&_0x3b1a28[_0x93ac('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x2cfd9b[_0x93ac('0x2b')],'resourceId':_0x2cfd9b['id'],'type':_0x3b1a28[_0x93ac('0x2b')],'sectionId':_0x3b1a28['id']},{})[_0x93ac('0x26')](function(){return _0x26e9ad;});}else{return _0x26e9ad;}})[_0x93ac('0x48')](function(_0x388fa8){logger[_0x93ac('0x29')](_0x93ac('0x54'),_0x388fa8);throw _0x388fa8;});}return _0x26e9ad;})[_0x93ac('0x26')](respondWithResult(_0x485973,0xc9))['catch'](handleError(_0x485973,null));};exports['update']=function(_0x2bec22,_0x23a9a1){if(_0x2bec22[_0x93ac('0x4d')]['id']){delete _0x2bec22[_0x93ac('0x4d')]['id'];}return db['Pause']['find']({'where':{'id':_0x2bec22['params']['id']}})[_0x93ac('0x26')](handleEntityNotFound(_0x23a9a1,null))[_0x93ac('0x26')](saveUpdates(_0x2bec22[_0x93ac('0x4d')],null))[_0x93ac('0x26')](respondWithResult(_0x23a9a1,null))[_0x93ac('0x48')](handleError(_0x23a9a1,null));};exports[_0x93ac('0x27')]=function(_0xd06d15,_0x4da9ed){return db[_0x93ac('0x2d')][_0x93ac('0x4b')]({'where':{'id':_0xd06d15['params']['id']}})[_0x93ac('0x26')](handleEntityNotFound(_0x4da9ed,null))['then'](removeEntity(_0x4da9ed,null))['catch'](handleError(_0x4da9ed,null));}; \ No newline at end of file +var _0x3514=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','get','Pauses','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','find','create'];(function(_0x3ea291,_0x46f5db){var _0x390ec7=function(_0x4558a5){while(--_0x4558a5){_0x3ea291['push'](_0x3ea291['shift']());}};_0x390ec7(++_0x46f5db);}(_0x3514,0xfe));var _0x4351=function(_0x3bf8ba,_0x56c7f8){_0x3bf8ba=_0x3bf8ba-0x0;var _0x3f1283=_0x3514[_0x3bf8ba];return _0x3f1283;};'use strict';var emlformat=require(_0x4351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4351('0x1'));var jsonpatch=require(_0x4351('0x2'));var rp=require(_0x4351('0x3'));var moment=require(_0x4351('0x4'));var BPromise=require(_0x4351('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4351('0x6'));var sox=require(_0x4351('0x7'));var csv=require('to-csv');var ejs=require(_0x4351('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4351('0x9'));var squel=require(_0x4351('0xa'));var crypto=require(_0x4351('0xb'));var jsforce=require(_0x4351('0xc'));var deskjs=require(_0x4351('0xd'));var toCsv=require(_0x4351('0xe'));var querystring=require(_0x4351('0xf'));var Papa=require(_0x4351('0x10'));var Redis=require(_0x4351('0x11'));var authService=require(_0x4351('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4351('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x4351('0x14'));var config=require(_0x4351('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4351('0x16'))['db'];function respondWithStatusCode(_0x1ded31,_0x410218){_0x410218=_0x410218||0xcc;return function(_0x12c56a){if(_0x12c56a){return _0x1ded31[_0x4351('0x17')](_0x410218);}return _0x1ded31[_0x4351('0x18')](_0x410218)[_0x4351('0x19')]();};}function respondWithResult(_0x323354,_0x161b9a){_0x161b9a=_0x161b9a||0xc8;return function(_0x39e13a){if(_0x39e13a){return _0x323354[_0x4351('0x18')](_0x161b9a)[_0x4351('0x1a')](_0x39e13a);}};}function respondWithFilteredResult(_0x132408,_0x10db62){return function(_0x3deb46){if(_0x3deb46){var _0x5338c9=typeof _0x10db62[_0x4351('0x1b')]===_0x4351('0x1c')&&typeof _0x10db62[_0x4351('0x1d')]===_0x4351('0x1c');var _0x3e0370=_0x3deb46[_0x4351('0x1e')];var _0x2053b7=_0x5338c9?0x0:_0x10db62[_0x4351('0x1b')];var _0x51e60c=_0x5338c9?_0x3deb46[_0x4351('0x1e')]:_0x10db62[_0x4351('0x1b')]+_0x10db62[_0x4351('0x1d')];var _0x470711;if(_0x51e60c>=_0x3e0370){_0x51e60c=_0x3e0370;_0x470711=0xc8;}else{_0x470711=0xce;}_0x132408['status'](_0x470711);return _0x132408['set'](_0x4351('0x1f'),_0x2053b7+'-'+_0x51e60c+'/'+_0x3e0370)[_0x4351('0x1a')](_0x3deb46);}return null;};}function patchUpdates(_0x3f4942){return function(_0x400aac){try{jsonpatch['apply'](_0x400aac,_0x3f4942,!![]);}catch(_0x3f4d5a){return BPromise[_0x4351('0x20')](_0x3f4d5a);}return _0x400aac[_0x4351('0x21')]();};}function saveUpdates(_0x2a4530,_0x3e3530){return function(_0x196221){if(_0x196221){return _0x196221[_0x4351('0x22')](_0x2a4530)['then'](function(_0x2adf59){return _0x2adf59;});}return null;};}function removeEntity(_0x524d75,_0x46df0d){return function(_0x339c07){if(_0x339c07){return _0x339c07[_0x4351('0x23')]()[_0x4351('0x24')](function(){var _0x3eb780=_0x339c07[_0x4351('0x25')]({'plain':!![]});var _0x41ecba=_0x4351('0x26');return db['UserProfileResource'][_0x4351('0x23')]({'where':{'type':_0x41ecba,'resourceId':_0x3eb780['id']}})['then'](function(){return _0x339c07;});})[_0x4351('0x24')](function(){_0x524d75[_0x4351('0x18')](0xcc)[_0x4351('0x19')]();});}};}function handleEntityNotFound(_0x49c0ea,_0x1aff9c){return function(_0x47e333){if(!_0x47e333){_0x49c0ea[_0x4351('0x17')](0x194);}return _0x47e333;};}function handleError(_0x53da8e,_0x1b9c96){_0x1b9c96=_0x1b9c96||0x1f4;return function(_0x58d436){logger[_0x4351('0x27')](_0x58d436[_0x4351('0x28')]);if(_0x58d436[_0x4351('0x29')]){delete _0x58d436[_0x4351('0x29')];}_0x53da8e[_0x4351('0x18')](_0x1b9c96)[_0x4351('0x2a')](_0x58d436);};}exports[_0x4351('0x2b')]=function(_0x2924c4,_0x46257f){var _0x293dad={},_0x42e7c={},_0x2e3a03={'count':0x0,'rows':[]};var _0x55bd47=_[_0x4351('0x2c')](db[_0x4351('0x2d')][_0x4351('0x2e')],function(_0x15d5be){return{'name':_0x15d5be[_0x4351('0x2f')],'type':_0x15d5be[_0x4351('0x30')][_0x4351('0x31')]};});_0x42e7c['model']=_[_0x4351('0x2c')](_0x55bd47,_0x4351('0x29'));_0x42e7c['query']=_['keys'](_0x2924c4[_0x4351('0x32')]);_0x42e7c[_0x4351('0x33')]=_[_0x4351('0x34')](_0x42e7c[_0x4351('0x35')],_0x42e7c['query']);_0x293dad['attributes']=_[_0x4351('0x34')](_0x42e7c[_0x4351('0x35')],qs[_0x4351('0x36')](_0x2924c4[_0x4351('0x32')][_0x4351('0x36')]));_0x293dad['attributes']=_0x293dad[_0x4351('0x37')][_0x4351('0x38')]?_0x293dad[_0x4351('0x37')]:_0x42e7c[_0x4351('0x35')];if(!_0x2924c4[_0x4351('0x32')]['hasOwnProperty'](_0x4351('0x39'))){_0x293dad[_0x4351('0x1d')]=qs[_0x4351('0x1d')](_0x2924c4[_0x4351('0x32')]['limit']);_0x293dad[_0x4351('0x1b')]=qs[_0x4351('0x1b')](_0x2924c4[_0x4351('0x32')][_0x4351('0x1b')]);}_0x293dad[_0x4351('0x3a')]=qs[_0x4351('0x3b')](_0x2924c4['query'][_0x4351('0x3b')]);_0x293dad[_0x4351('0x3c')]=qs[_0x4351('0x33')](_[_0x4351('0x3d')](_0x2924c4[_0x4351('0x32')],_0x42e7c[_0x4351('0x33')]),_0x55bd47);if(_0x2924c4[_0x4351('0x32')][_0x4351('0x3e')]){_0x293dad['where']=_[_0x4351('0x3f')](_0x293dad['where'],{'$or':_[_0x4351('0x2c')](_0x55bd47,function(_0x5cae8e){if(_0x5cae8e['type']!==_0x4351('0x40')){var _0x47ab73={};_0x47ab73[_0x5cae8e[_0x4351('0x29')]]={'$like':'%'+_0x2924c4[_0x4351('0x32')][_0x4351('0x3e')]+'%'};return _0x47ab73;}})});}_0x293dad=_[_0x4351('0x3f')]({},_0x293dad,_0x2924c4[_0x4351('0x41')]);var _0x2c23b8={'where':_0x293dad['where']};return db[_0x4351('0x2d')][_0x4351('0x1e')](_0x2c23b8)['then'](function(_0x1e418a){_0x2e3a03[_0x4351('0x1e')]=_0x1e418a;if(_0x2924c4[_0x4351('0x32')][_0x4351('0x42')]){_0x293dad[_0x4351('0x43')]=[{'all':!![]}];}return db['Pause']['findAll'](_0x293dad);})[_0x4351('0x24')](function(_0x5bc7f0){_0x2e3a03[_0x4351('0x44')]=_0x5bc7f0;return _0x2e3a03;})[_0x4351('0x24')](respondWithFilteredResult(_0x46257f,_0x293dad))[_0x4351('0x45')](handleError(_0x46257f,null));};exports[_0x4351('0x46')]=function(_0x10441e,_0x15c0a5){var _0x2c94b6={'raw':!![],'where':{'id':_0x10441e['params']['id']}},_0x5a43c1={};_0x5a43c1[_0x4351('0x35')]=_[_0x4351('0x47')](db[_0x4351('0x2d')][_0x4351('0x2e')]);_0x5a43c1[_0x4351('0x32')]=_[_0x4351('0x47')](_0x10441e[_0x4351('0x32')]);_0x5a43c1[_0x4351('0x33')]=_[_0x4351('0x34')](_0x5a43c1[_0x4351('0x35')],_0x5a43c1[_0x4351('0x32')]);_0x2c94b6['attributes']=_['intersection'](_0x5a43c1[_0x4351('0x35')],qs['fields'](_0x10441e['query'][_0x4351('0x36')]));_0x2c94b6[_0x4351('0x37')]=_0x2c94b6[_0x4351('0x37')][_0x4351('0x38')]?_0x2c94b6[_0x4351('0x37')]:_0x5a43c1[_0x4351('0x35')];if(_0x10441e[_0x4351('0x32')][_0x4351('0x42')]){_0x2c94b6[_0x4351('0x43')]=[{'all':!![]}];}_0x2c94b6=_[_0x4351('0x3f')]({},_0x2c94b6,_0x10441e[_0x4351('0x41')]);return db[_0x4351('0x2d')][_0x4351('0x48')](_0x2c94b6)[_0x4351('0x24')](handleEntityNotFound(_0x15c0a5,null))[_0x4351('0x24')](respondWithResult(_0x15c0a5,null))[_0x4351('0x45')](handleError(_0x15c0a5,null));};exports[_0x4351('0x49')]=function(_0x25bd7f,_0x483f80){return db[_0x4351('0x2d')][_0x4351('0x49')](_0x25bd7f[_0x4351('0x4a')],{})[_0x4351('0x24')](function(_0x3dd26d){var _0x3942ba=_0x25bd7f[_0x4351('0x4b')][_0x4351('0x25')]({'plain':!![]});if(!_0x3942ba)throw new Error(_0x4351('0x4c'));if(_0x3942ba[_0x4351('0x4d')]===_0x4351('0x4b')){var _0x3b39ba=_0x3dd26d[_0x4351('0x25')]({'plain':!![]});var _0xd15d4e=_0x4351('0x26');return db[_0x4351('0x4e')][_0x4351('0x48')]({'where':{'name':_0xd15d4e,'userProfileId':_0x3942ba['userProfileId']},'raw':!![]})[_0x4351('0x24')](function(_0x4e4ed6){if(_0x4e4ed6&&_0x4e4ed6[_0x4351('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x3b39ba['name'],'resourceId':_0x3b39ba['id'],'type':_0x4e4ed6[_0x4351('0x29')],'sectionId':_0x4e4ed6['id']},{})['then'](function(){return _0x3dd26d;});}else{return _0x3dd26d;}})[_0x4351('0x45')](function(_0x50e8eb){logger[_0x4351('0x27')](_0x4351('0x50'),_0x50e8eb);throw _0x50e8eb;});}return _0x3dd26d;})[_0x4351('0x24')](respondWithResult(_0x483f80,0xc9))[_0x4351('0x45')](handleError(_0x483f80,null));};exports[_0x4351('0x22')]=function(_0x458c9f,_0xa05301){if(_0x458c9f[_0x4351('0x4a')]['id']){delete _0x458c9f[_0x4351('0x4a')]['id'];}return db['Pause'][_0x4351('0x48')]({'where':{'id':_0x458c9f['params']['id']}})[_0x4351('0x24')](handleEntityNotFound(_0xa05301,null))['then'](saveUpdates(_0x458c9f[_0x4351('0x4a')],null))[_0x4351('0x24')](respondWithResult(_0xa05301,null))[_0x4351('0x45')](handleError(_0xa05301,null));};exports['destroy']=function(_0xd9e8cd,_0x77a300){return db[_0x4351('0x2d')]['find']({'where':{'id':_0xd9e8cd[_0x4351('0x51')]['id']}})[_0x4351('0x24')](handleEntityNotFound(_0x77a300,null))['then'](removeEntity(_0x77a300,null))['catch'](handleError(_0x77a300,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index b82e591..d0949b0 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 _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x4a4320,_0x5794a1){var _0x4b0508=function(_0x43883d){while(--_0x43883d){_0x4a4320['push'](_0x4a4320['shift']());}};_0x4b0508(++_0x5794a1);}(_0x8ef6,0xf2));var _0x68ef=function(_0x341b35,_0x4f8c61){_0x341b35=_0x341b35-0x0;var _0x36a62e=_0x8ef6[_0x341b35];return _0x36a62e;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x422543,_0x1bc55d){var _0x2ab93d=function(_0x1d8655){while(--_0x1d8655){_0x422543['push'](_0x422543['shift']());}};_0x2ab93d(++_0x1bc55d);}(_0xf494,0x1c6));var _0x4f49=function(_0xf00215,_0x4805a5){_0xf00215=_0xf00215-0x0;var _0x36bd7e=_0xf494[_0xf00215];return _0x36bd7e;};'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')]('Pause',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 2316111..5c7dd8f 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x3a6685,_0x4c6316){var _0x9ed413=function(_0x399d55){while(--_0x399d55){_0x3a6685['push'](_0x3a6685['shift']());}};_0x9ed413(++_0x4c6316);}(_0x7a54,0x106));var _0x47a5=function(_0x20a76d,_0x543fb1){_0x20a76d=_0x20a76d-0x0;var _0x2adaeb=_0x7a54[_0x20a76d];return _0x2adaeb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x192c3f,_0xdc5039){var _0xf1a6ed=function(_0x1a372a){while(--_0x1a372a){_0x192c3f['push'](_0x192c3f['shift']());}};_0xf1a6ed(++_0xdc5039);}(_0x7a54,0x106));var _0x47a5=function(_0x5b5244,_0x4fe020){_0x5b5244=_0x5b5244-0x0;var _0x599aa9=_0x7a54[_0x5b5244];return _0x599aa9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 268886f..97161be 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 _0xe13a=['./plugin.controller','get','isAuthenticated','index','webhookGet','/:id','show','/:id/download','download','join','root','server/files/plugins','originalname','extname','now','single','upload','post','/webhook','webhookPost','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x21ec98,_0x54d0a4){var _0x4bc6e4=function(_0x493091){while(--_0x493091){_0x21ec98['push'](_0x21ec98['shift']());}};_0x4bc6e4(++_0x54d0a4);}(_0xe13a,0x178));var _0xae13=function(_0x2336f8,_0x54c863){_0x2336f8=_0x2336f8-0x0;var _0xe96537=_0xe13a[_0x2336f8];return _0xe96537;};'use strict';var multer=require('multer');var util=require(_0xae13('0x0'));var path=require(_0xae13('0x1'));var timeout=require(_0xae13('0x2'));var express=require(_0xae13('0x3'));var router=express['Router']();var fs_extra=require(_0xae13('0x4'));var auth=require(_0xae13('0x5'));var interaction=require(_0xae13('0x6'));var config=require(_0xae13('0x7'));var controller=require(_0xae13('0x8'));router[_0xae13('0x9')]('/',auth[_0xae13('0xa')](),controller[_0xae13('0xb')]);router[_0xae13('0x9')]('/webhook',controller[_0xae13('0xc')]);router[_0xae13('0x9')](_0xae13('0xd'),auth[_0xae13('0xa')](),controller[_0xae13('0xe')]);router[_0xae13('0x9')](_0xae13('0xf'),auth[_0xae13('0xa')](),controller[_0xae13('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x404b0e,_0x83de98,_0x3d6a85){_0x3d6a85(null,path[_0xae13('0x11')](config[_0xae13('0x12')],_0xae13('0x13')));},'filename':function(_0x1505c5,_0x4dd599,_0x42d869){_0x4dd599[_0xae13('0x14')]=_0x4dd599['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x42d869(null,util['format']('%s-%s%s',path['basename'](_0x4dd599[_0xae13('0x14')],path[_0xae13('0x15')](_0x4dd599[_0xae13('0x14')])),Date[_0xae13('0x16')](),path[_0xae13('0x15')](_0x4dd599[_0xae13('0x14')])));}})});router['post']('/',upload[_0xae13('0x17')]('file'),controller[_0xae13('0x18')]);router[_0xae13('0x19')](_0xae13('0x1a'),controller[_0xae13('0x1b')]);router[_0xae13('0x1c')](_0xae13('0xd'),auth[_0xae13('0xa')](),controller[_0xae13('0x1d')]);router[_0xae13('0x1e')]('/:id',auth[_0xae13('0xa')](),controller['delete']);module[_0xae13('0x1f')]=router; \ No newline at end of file +var _0x4c4e=['webhookGet','/:id','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','basename','now','extname','post','single','file','upload','webhookPost','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','index','get','/webhook'];(function(_0x3a68a0,_0x5a26d7){var _0x3db8ff=function(_0x15d852){while(--_0x15d852){_0x3a68a0['push'](_0x3a68a0['shift']());}};_0x3db8ff(++_0x5a26d7);}(_0x4c4e,0x152));var _0xe4c4=function(_0x3dd299,_0x32c76e){_0x3dd299=_0x3dd299-0x0;var _0x42b654=_0x4c4e[_0x3dd299];return _0x42b654;};'use strict';var multer=require(_0xe4c4('0x0'));var util=require('util');var path=require(_0xe4c4('0x1'));var timeout=require(_0xe4c4('0x2'));var express=require(_0xe4c4('0x3'));var router=express['Router']();var fs_extra=require(_0xe4c4('0x4'));var auth=require(_0xe4c4('0x5'));var interaction=require(_0xe4c4('0x6'));var config=require('../../config/environment');var controller=require(_0xe4c4('0x7'));router['get']('/',auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x9')]);router[_0xe4c4('0xa')](_0xe4c4('0xb'),controller[_0xe4c4('0xc')]);router[_0xe4c4('0xa')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller['show']);router['get'](_0xe4c4('0xe'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0xf')]);var upload=multer({'storage':multer[_0xe4c4('0x10')]({'destination':function(_0x333c08,_0x2f4d5f,_0x50264f){_0x50264f(null,path[_0xe4c4('0x11')](config[_0xe4c4('0x12')],_0xe4c4('0x13')));},'filename':function(_0x2483d0,_0x50bfab,_0x262083){_0x50bfab[_0xe4c4('0x14')]=_0x50bfab['originalname'][_0xe4c4('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x262083(null,util[_0xe4c4('0x16')]('%s-%s%s',path[_0xe4c4('0x17')](_0x50bfab[_0xe4c4('0x14')],path['extname'](_0x50bfab[_0xe4c4('0x14')])),Date[_0xe4c4('0x18')](),path[_0xe4c4('0x19')](_0x50bfab[_0xe4c4('0x14')])));}})});router[_0xe4c4('0x1a')]('/',upload[_0xe4c4('0x1b')](_0xe4c4('0x1c')),controller[_0xe4c4('0x1d')]);router[_0xe4c4('0x1a')](_0xe4c4('0xb'),controller[_0xe4c4('0x1e')]);router[_0xe4c4('0x1f')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x20')]);router['delete'](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x21')]);module[_0xe4c4('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 2ece871..d1bdb0b 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 _0x6856=['agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','html','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM'];(function(_0x19645a,_0x270b70){var _0x1c8ccc=function(_0x27fde8){while(--_0x27fde8){_0x19645a['push'](_0x19645a['shift']());}};_0x1c8ccc(++_0x270b70);}(_0x6856,0x1cb));var _0x6685=function(_0x370671,_0x1741ea){_0x370671=_0x370671-0x0;var _0x40e453=_0x6856[_0x370671];return _0x40e453;};'use strict';var Sequelize=require(_0x6685('0x0'));module[_0x6685('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x6685('0x2'),'script')},'description':{'type':Sequelize[_0x6685('0x3')]},'version':{'type':Sequelize[_0x6685('0x3')]},'path':{'type':Sequelize[_0x6685('0x4')],'comment':_0x6685('0x5')},'active':{'type':Sequelize[_0x6685('0x6')],'defaultValue':0x0,'comment':_0x6685('0x7')},'sidebar':{'type':Sequelize[_0x6685('0x8')]('adminOnly',_0x6685('0x9'),_0x6685('0xa'),'never'),'defaultValue':'always','comment':_0x6685('0xb')},'icon':{'type':Sequelize[_0x6685('0x4')]},'adminUrl':{'type':Sequelize[_0x6685('0x4')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x6685('0x4')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf5a3=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html'];(function(_0x1b8b95,_0x3ea343){var _0x3657ae=function(_0x3703e1){while(--_0x3703e1){_0x1b8b95['push'](_0x1b8b95['shift']());}};_0x3657ae(++_0x3ea343);}(_0xf5a3,0x1ab));var _0x3f5a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf5a3[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x3f5a('0x0'));module[_0x3f5a('0x1')]={'name':{'type':Sequelize[_0x3f5a('0x2')]},'type':{'type':Sequelize[_0x3f5a('0x3')](_0x3f5a('0x4'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x3f5a('0x5')]},'path':{'type':Sequelize[_0x3f5a('0x2')],'comment':_0x3f5a('0x6')},'active':{'type':Sequelize[_0x3f5a('0x7')],'defaultValue':0x0,'comment':_0x3f5a('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0x3f5a('0x9'),'agentOnly',_0x3f5a('0xa'),'never'),'defaultValue':'always','comment':_0x3f5a('0xb')},'icon':{'type':Sequelize[_0x3f5a('0x2')]},'adminUrl':{'type':Sequelize[_0x3f5a('0x2')]},'agentUrl':{'type':Sequelize[_0x3f5a('0x2')]},'scriptName':{'type':Sequelize[_0x3f5a('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 15d2692..3cee8c3 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 _0xf164=['glob','**/*','server/files/plugins','dirname','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','root','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isDirectory','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','plugins','agent','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','%s%s','eml-format','rimraf','zip-dir','request-promise','moment','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','Plugins','UserProfileResource','end','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','pick','filter','where','merge','VIRTUAL','options','Plugin','includeAll','findAll','rows','catch','show','params','include','download','find','join','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe'];(function(_0x1c688d,_0x267b89){var _0xd3948e=function(_0xdcd58c){while(--_0xdcd58c){_0x1c688d['push'](_0x1c688d['shift']());}};_0xd3948e(++_0x267b89);}(_0xf164,0x1ae));var _0x4f16=function(_0x3d0e12,_0x41e165){_0x3d0e12=_0x3d0e12-0x0;var _0x22da51=_0xf164[_0x3d0e12];return _0x22da51;};'use strict';var emlformat=require(_0x4f16('0x0'));var rimraf=require(_0x4f16('0x1'));var zipdir=require(_0x4f16('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f16('0x3'));var moment=require(_0x4f16('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4f16('0x5'));var sox=require('sox');var csv=require(_0x4f16('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4f16('0x7'));var _=require('lodash');var squel=require(_0x4f16('0x8'));var crypto=require(_0x4f16('0x9'));var jsforce=require(_0x4f16('0xa'));var deskjs=require(_0x4f16('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4f16('0xc'));var Papa=require(_0x4f16('0xd'));var extract=require(_0x4f16('0xe'));var rimraf=require(_0x4f16('0x1'));var archiver=require('archiver');var Redis=require(_0x4f16('0xf'));var authService=require(_0x4f16('0x10'));var qs=require(_0x4f16('0x11'));var as=require(_0x4f16('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4f16('0x13'));var utils=require('../../config/utils');var config=require(_0x4f16('0x14'));var licenseUtil=require(_0x4f16('0x15'));var db=require(_0x4f16('0x16'))['db'];config[_0x4f16('0x17')]=_['defaults'](config[_0x4f16('0x17')],{'host':_0x4f16('0x18'),'port':0x18eb});var socket=require(_0x4f16('0x19'))(new Redis(config['redis']));require('./plugin.socket')[_0x4f16('0x1a')](socket);function respondWithStatusCode(_0x180f30,_0x3beb57){_0x3beb57=_0x3beb57||0xcc;return function(_0x1cb57e){if(_0x1cb57e){return _0x180f30['sendStatus'](_0x3beb57);}return _0x180f30['status'](_0x3beb57)['end']();};}function respondWithResult(_0xaf2dcd,_0x109a99){_0x109a99=_0x109a99||0xc8;return function(_0x24c3e5){if(_0x24c3e5){return _0xaf2dcd[_0x4f16('0x1b')](_0x109a99)[_0x4f16('0x1c')](_0x24c3e5);}};}function respondWithFilteredResult(_0x213a52,_0x52cf3d){return function(_0x1d9509){if(_0x1d9509){var _0x450cc6=typeof _0x52cf3d[_0x4f16('0x1d')]===_0x4f16('0x1e')&&typeof _0x52cf3d['limit']===_0x4f16('0x1e');var _0x2319b6=_0x1d9509[_0x4f16('0x1f')];var _0xc3781c=_0x450cc6?0x0:_0x52cf3d[_0x4f16('0x1d')];var _0x5090b0=_0x450cc6?_0x1d9509[_0x4f16('0x1f')]:_0x52cf3d[_0x4f16('0x1d')]+_0x52cf3d['limit'];var _0x38eee3;if(_0x5090b0>=_0x2319b6){_0x5090b0=_0x2319b6;_0x38eee3=0xc8;}else{_0x38eee3=0xce;}_0x213a52[_0x4f16('0x1b')](_0x38eee3);return _0x213a52[_0x4f16('0x20')](_0x4f16('0x21'),_0xc3781c+'-'+_0x5090b0+'/'+_0x2319b6)[_0x4f16('0x1c')](_0x1d9509);}return null;};}function patchUpdates(_0x43499e){return function(_0x1ac476){try{jsonpatch[_0x4f16('0x22')](_0x1ac476,_0x43499e,!![]);}catch(_0x4bed81){return BPromise[_0x4f16('0x23')](_0x4bed81);}return _0x1ac476[_0x4f16('0x24')]();};}function saveUpdates(_0x349f43,_0x52724e){return function(_0x53f9aa){if(_0x53f9aa){return _0x53f9aa['update'](_0x349f43)[_0x4f16('0x25')](function(_0x5f4ebb){return _0x5f4ebb;});}return null;};}function removeEntity(_0x3156b2,_0x1aeea7){return function(_0x4859a5){if(_0x4859a5){return _0x4859a5[_0x4f16('0x26')]()[_0x4f16('0x25')](function(){var _0x5e08fd=_0x4859a5['get']({'plain':!![]});var _0x3d257a=_0x4f16('0x27');return db[_0x4f16('0x28')][_0x4f16('0x26')]({'where':{'type':_0x3d257a,'resourceId':_0x5e08fd['id']}})[_0x4f16('0x25')](function(){return _0x4859a5;});})[_0x4f16('0x25')](function(){_0x3156b2[_0x4f16('0x1b')](0xcc)[_0x4f16('0x29')]();});}};}function handleEntityNotFound(_0x27f0a3,_0x4181dc){return function(_0x4c97de){if(!_0x4c97de){_0x27f0a3[_0x4f16('0x2a')](0x194);}return _0x4c97de;};}function handleError(_0x2888ef,_0x52d382){_0x52d382=_0x52d382||0x1f4;return function(_0xaf9f4c){logger[_0x4f16('0x2b')](_0xaf9f4c[_0x4f16('0x2c')]);if(_0xaf9f4c[_0x4f16('0x2d')]){delete _0xaf9f4c[_0x4f16('0x2d')];}_0x2888ef['status'](_0x52d382)['send'](_0xaf9f4c);};}exports[_0x4f16('0x2e')]=function(_0x19f038,_0x1aedf0){var _0x459a00={},_0x3c7489={},_0x2e21a8={'count':0x0,'rows':[]};var _0x4bfb0e=_[_0x4f16('0x2f')](db['Plugin'][_0x4f16('0x30')],function(_0x12363f){return{'name':_0x12363f[_0x4f16('0x31')],'type':_0x12363f[_0x4f16('0x32')][_0x4f16('0x33')]};});_0x3c7489[_0x4f16('0x34')]=_['map'](_0x4bfb0e,_0x4f16('0x2d'));_0x3c7489['query']=_[_0x4f16('0x35')](_0x19f038[_0x4f16('0x36')]);_0x3c7489[_0x4f16('0x37')]=_['intersection'](_0x3c7489[_0x4f16('0x34')],_0x3c7489[_0x4f16('0x36')]);_0x459a00[_0x4f16('0x38')]=_[_0x4f16('0x39')](_0x3c7489[_0x4f16('0x34')],qs['fields'](_0x19f038[_0x4f16('0x36')][_0x4f16('0x3a')]));_0x459a00[_0x4f16('0x38')]=_0x459a00[_0x4f16('0x38')][_0x4f16('0x3b')]?_0x459a00[_0x4f16('0x38')]:_0x3c7489[_0x4f16('0x34')];if(!_0x19f038['query'][_0x4f16('0x3c')](_0x4f16('0x3d'))){_0x459a00[_0x4f16('0x3e')]=qs[_0x4f16('0x3e')](_0x19f038['query']['limit']);_0x459a00['offset']=qs[_0x4f16('0x1d')](_0x19f038[_0x4f16('0x36')][_0x4f16('0x1d')]);}_0x459a00[_0x4f16('0x3f')]=qs['sort'](_0x19f038[_0x4f16('0x36')]['sort']);_0x459a00['where']=qs[_0x4f16('0x37')](_[_0x4f16('0x40')](_0x19f038[_0x4f16('0x36')],_0x3c7489[_0x4f16('0x37')]),_0x4bfb0e);if(_0x19f038[_0x4f16('0x36')][_0x4f16('0x41')]){_0x459a00[_0x4f16('0x42')]=_[_0x4f16('0x43')](_0x459a00[_0x4f16('0x42')],{'$or':_[_0x4f16('0x2f')](_0x4bfb0e,function(_0x3bafa5){if(_0x3bafa5['type']!==_0x4f16('0x44')){var _0x43a5e8={};_0x43a5e8[_0x3bafa5[_0x4f16('0x2d')]]={'$like':'%'+_0x19f038[_0x4f16('0x36')]['filter']+'%'};return _0x43a5e8;}})});}_0x459a00=_['merge']({},_0x459a00,_0x19f038[_0x4f16('0x45')]);var _0x11d4cd={'where':_0x459a00[_0x4f16('0x42')]};return db[_0x4f16('0x46')][_0x4f16('0x1f')](_0x11d4cd)['then'](function(_0x4cca27){_0x2e21a8[_0x4f16('0x1f')]=_0x4cca27;if(_0x19f038[_0x4f16('0x36')][_0x4f16('0x47')]){_0x459a00['include']=[{'all':!![]}];}return db[_0x4f16('0x46')][_0x4f16('0x48')](_0x459a00);})['then'](function(_0x4fe0ba){_0x2e21a8[_0x4f16('0x49')]=_0x4fe0ba;return _0x2e21a8;})[_0x4f16('0x25')](respondWithFilteredResult(_0x1aedf0,_0x459a00))[_0x4f16('0x4a')](handleError(_0x1aedf0,null));};exports[_0x4f16('0x4b')]=function(_0x2ac51a,_0x2f80ee){var _0x272421={'raw':!![],'where':{'id':_0x2ac51a[_0x4f16('0x4c')]['id']}},_0x47e3d3={};_0x47e3d3['model']=_['keys'](db['Plugin']['rawAttributes']);_0x47e3d3[_0x4f16('0x36')]=_['keys'](_0x2ac51a['query']);_0x47e3d3[_0x4f16('0x37')]=_['intersection'](_0x47e3d3[_0x4f16('0x34')],_0x47e3d3[_0x4f16('0x36')]);_0x272421[_0x4f16('0x38')]=_[_0x4f16('0x39')](_0x47e3d3[_0x4f16('0x34')],qs[_0x4f16('0x3a')](_0x2ac51a['query'][_0x4f16('0x3a')]));_0x272421['attributes']=_0x272421[_0x4f16('0x38')][_0x4f16('0x3b')]?_0x272421[_0x4f16('0x38')]:_0x47e3d3[_0x4f16('0x34')];if(_0x2ac51a['query'][_0x4f16('0x47')]){_0x272421[_0x4f16('0x4d')]=[{'all':!![]}];}_0x272421=_[_0x4f16('0x43')]({},_0x272421,_0x2ac51a[_0x4f16('0x45')]);return db[_0x4f16('0x46')]['find'](_0x272421)[_0x4f16('0x25')](handleEntityNotFound(_0x2f80ee,null))[_0x4f16('0x25')](respondWithResult(_0x2f80ee,null))[_0x4f16('0x4a')](handleError(_0x2f80ee,null));};exports[_0x4f16('0x4e')]=function(_0x1b2628,_0x4db058,_0x20e05c){return db[_0x4f16('0x46')][_0x4f16('0x4f')]({'where':{'id':_0x1b2628[_0x4f16('0x4c')]['id']},'attributes':[_0x4f16('0x2d'),_0x4f16('0x5')],'raw':!![]})['then'](handleEntityNotFound(_0x4db058,null))[_0x4f16('0x25')](function(_0x2c912a){if(_0x2c912a){var _0x41b59b=path[_0x4f16('0x50')](config['root'],'server/files/plugins',util[_0x4f16('0x51')](_0x4f16('0x52'),path[_0x4f16('0x53')](_0x2c912a[_0x4f16('0x5')])));var _0x1f0654=fs[_0x4f16('0x54')](_0x41b59b);var _0xc044d0=archiver('zip',{'zlib':{'level':0x9}});_0xc044d0['on'](_0x4f16('0x55'),function(_0x251e14){if(_0x251e14[_0x4f16('0x56')]===_0x4f16('0x57')){logger[_0x4f16('0x2b')](_0x251e14);}else{throw new db[(_0x4f16('0x58'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0xc044d0['on'](_0x4f16('0x2b'),function(_0x3ea436){throw new db['Sequelize'][(_0x4f16('0x59'))](_0x4f16('0x5a'));});_0xc044d0[_0x4f16('0x5b')](_0x1f0654);_0xc044d0[_0x4f16('0x5c')](_0x4f16('0x5d'),{'cwd':path[_0x4f16('0x50')](config['root'],_0x4f16('0x5e'),path[_0x4f16('0x5f')](_0x2c912a[_0x4f16('0x5')])),'ignore':[path[_0x4f16('0x50')](path[_0x4f16('0x53')](_0x2c912a[_0x4f16('0x5')]),_0x4f16('0x60')),path[_0x4f16('0x50')](path[_0x4f16('0x53')](_0x2c912a[_0x4f16('0x5')]),'attachments/**/*')],'nodir':!![]})[_0x4f16('0x61')]();_0x1f0654['on'](_0x4f16('0x62'),function(){if(!fs[_0x4f16('0x63')](_0x41b59b)){throw new db[(_0x4f16('0x58'))]['Error'](_0x4f16('0x64'));}return _0x4db058[_0x4f16('0x4e')](_0x41b59b,util['format'](_0x4f16('0x52'),path[_0x4f16('0x53')](_0x2c912a[_0x4f16('0x5')])),function(_0x23886c){if(_0x23886c){throw new db[(_0x4f16('0x58'))][(_0x4f16('0x59'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x4f16('0x65')](_0x41b59b);logger[_0x4f16('0x66')](_0x4f16('0x67'));logger[_0x4f16('0x66')](_0x4f16('0x68'));});});}return null;})['catch'](handleError(_0x4db058,null));};exports[_0x4f16('0x69')]=function(_0x7f97ed,_0x1fa000,_0x1b654e){var _0xb1a8ca=path[_0x4f16('0x53')](_0x7f97ed[_0x4f16('0x6a')][_0x4f16('0x6b')],path[_0x4f16('0x6c')](_0x7f97ed['file'][_0x4f16('0x6b')]));var _0x5eae5a=path[_0x4f16('0x50')](config[_0x4f16('0x6d')],_0x4f16('0x5e'),_0x7f97ed[_0x4f16('0x6a')][_0x4f16('0x6b')]);var _0x100bcf=path['join'](config[_0x4f16('0x6d')],'server/files/plugins',_0xb1a8ca);logger['info'](_0x4f16('0x6e'),_0x5eae5a);logger[_0x4f16('0x66')](_0x4f16('0x6f'),_0x100bcf);try{fs[_0x4f16('0x70')](_0x5eae5a,parseInt(_0x4f16('0x71'),0x8));extract(_0x5eae5a,{'dir':_0x100bcf},function(_0x226e1c){if(_0x226e1c){logger[_0x4f16('0x2b')](_0x226e1c);handleError(_0x226e1c,!![]);};var _0x5a0a30=fs[_0x4f16('0x72')](_0x100bcf);if(_0x5a0a30[_0x4f16('0x3b')]>0x1){removeReferences(_0x5eae5a,_0x100bcf);logger['error']('Invalid\x20plugin\x20structure');return _0x1b654e(new Error(_0x4f16('0x73')));}var _0x3149b6=fs['lstatSync'](path['join'](_0x100bcf,_0x5a0a30[0x0]));if(_0x3149b6['isFile']()){removeReferences(_0x5eae5a,_0x100bcf);logger[_0x4f16('0x2b')](_0x4f16('0x73'));return _0x1b654e(new Error(_0x4f16('0x73')));}if(_0x3149b6[_0x4f16('0x74')]()){var _0x2a447f=fs[_0x4f16('0x72')](path[_0x4f16('0x50')](_0x100bcf,_0x5a0a30[0x0]));if(_0x2a447f[_0x4f16('0x3b')]===0x0){removeReferences(_0x5eae5a,_0x100bcf);logger['error'](_0x4f16('0x73'));return _0x1b654e(new Error(_0x4f16('0x73')));}var _0xaeccfc=_0x2a447f['some'](function(_0x3904d1){return _0x3904d1===_0x4f16('0x75');});if(!_0xaeccfc){return _0x1b654e(new Error('Plugin\x20manifest\x20missing'));}var _0x10924e=fs[_0x4f16('0x76')](path[_0x4f16('0x50')](_0x100bcf,_0x5a0a30[0x0],_0x4f16('0x75')));var _0x24dfa3=JSON[_0x4f16('0x77')](_0x10924e);if(_0x4f16('0x1e')==typeof _0x24dfa3[_0x4f16('0x2d')]){return _0x1b654e(new Error(_0x4f16('0x78')));}if(_0x4f16('0x1e')==typeof _0x24dfa3['type']){return _0x1b654e(new Error(_0x4f16('0x79')));}if(_0x4f16('0x1e')==typeof _0x24dfa3[_0x4f16('0x7a')]){return _0x1b654e(new Error(_0x4f16('0x7b')));}if(_0x4f16('0x1e')==typeof _0x24dfa3['parameters']){return _0x1b654e(new Error(_0x4f16('0x7c')));}if(_0x24dfa3[_0x4f16('0x32')]===_0x4f16('0x7d')){if(_0x4f16('0x1e')==typeof _0x24dfa3[_0x4f16('0x7e')][_0x4f16('0x7f')]){return _0x1b654e(new Error(_0x4f16('0x80')));}if(_0x4f16('0x1e')==typeof _0x24dfa3['parameters'][_0x4f16('0x7f')][_0x4f16('0x81')]&&_0x4f16('0x1e')==typeof _0x24dfa3[_0x4f16('0x7e')][_0x4f16('0x7f')]['agent']){return _0x1b654e(new Error(_0x4f16('0x82')));}}else if(_0x24dfa3['type']===_0x4f16('0x83')){if(_0x4f16('0x1e')==typeof _0x24dfa3[_0x4f16('0x7e')][_0x4f16('0x84')]){return _0x1b654e(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x4f16('0x1e')==typeof _0x24dfa3[_0x4f16('0x7e')][_0x4f16('0x85')]){return _0x1b654e(new Error(_0x4f16('0x86')));}}else{return _0x1b654e(new Error(_0x4f16('0x87')));}var _0x266d12=_0x24dfa3[_0x4f16('0x2d')];var _0x131e4e=_0x24dfa3[_0x4f16('0x88')];var _0x272f9a=_0x24dfa3[_0x4f16('0x32')];var _0x55c0cf=_0x24dfa3[_0x4f16('0x89')]?_0x24dfa3[_0x4f16('0x89')]:_0x4f16('0x8a');var _0x18ca56=_0x24dfa3[_0x4f16('0x8b')]?_0x24dfa3[_0x4f16('0x8b')]:'icon-apps';var _0x525ff0='';var _0x1ac30c='';var _0x49f3fe='';var _0x39c01a='';var _0x1334f7=_0x24dfa3['version'];if(_0x272f9a==='html'){if(_0x4f16('0x1e')!=typeof _0x24dfa3[_0x4f16('0x7e')][_0x4f16('0x7f')]['admin']){var _0x5c5760=_0x24dfa3[_0x4f16('0x7e')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x4f16('0x8c')](_0x5c5760)){_0x525ff0=path[_0x4f16('0x50')](_0x4f16('0x8d'),_0xb1a8ca,_0x5a0a30[0x0],_0x5c5760);}else{_0x525ff0=_0x5c5760;}}else{logger[_0x4f16('0x66')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x4f16('0x1e')!=typeof _0x24dfa3[_0x4f16('0x7e')][_0x4f16('0x7f')][_0x4f16('0x8e')]){var _0x2fe6f5=_0x24dfa3[_0x4f16('0x7e')][_0x4f16('0x7f')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x4f16('0x8c')](_0x2fe6f5)){_0x1ac30c=path[_0x4f16('0x50')](_0x4f16('0x8d'),_0xb1a8ca,_0x5a0a30[0x0],_0x2fe6f5);}else{_0x1ac30c=_0x2fe6f5;}}else{logger['info'](_0x4f16('0x8f'));}}else if(_0x272f9a==='script'){_0x49f3fe=_0x24dfa3[_0x4f16('0x7e')]['scriptName'];_0x39c01a=_0x24dfa3['parameters'][_0x4f16('0x85')];if(_0x4f16('0x1e')!=typeof _0x24dfa3[_0x4f16('0x7e')][_0x4f16('0x7f')]){if(_0x4f16('0x1e')!=typeof _0x24dfa3[_0x4f16('0x7e')][_0x4f16('0x7f')][_0x4f16('0x81')]){var _0x5c5760=_0x24dfa3[_0x4f16('0x7e')][_0x4f16('0x7f')][_0x4f16('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x4f16('0x8c')](_0x5c5760)){_0x525ff0=path['join']('plugins',_0xb1a8ca,_0x5a0a30[0x0],_0x5c5760);}else{_0x525ff0=_0x5c5760;}}if(_0x4f16('0x1e')!=typeof _0x24dfa3[_0x4f16('0x7e')][_0x4f16('0x7f')][_0x4f16('0x8e')]){var _0x2fe6f5=_0x24dfa3[_0x4f16('0x7e')][_0x4f16('0x7f')][_0x4f16('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0x4f16('0x8c')](_0x2fe6f5)){_0x1ac30c=path[_0x4f16('0x50')](_0x4f16('0x8d'),_0xb1a8ca,_0x5a0a30[0x0],_0x2fe6f5);}else{_0x1ac30c=_0x2fe6f5;}}}}var _0x1d299c={'name':_0x266d12,'description':_0x131e4e,'path':path[_0x4f16('0x50')](_0xb1a8ca,_0x5a0a30[0x0]),'type':_0x272f9a,'sidebar':_0x55c0cf,'icon':_0x18ca56,'adminUrl':_0x525ff0,'agentUrl':_0x1ac30c,'scriptName':_0x49f3fe,'scriptPath':_0x39c01a,'version':_0x1334f7};removeReferences(_0x5eae5a,null);return db[_0x4f16('0x46')][_0x4f16('0x90')](_0x1d299c)['then'](function(_0x1c65af){var _0x399ee1={'role':_0x7f97ed['body'][_0x4f16('0x91')],'userProfileId':_0x7f97ed[_0x4f16('0x92')][_0x4f16('0x93')]};if(!_0x399ee1)throw new Error(_0x4f16('0x94'));if(_0x399ee1['role']===_0x4f16('0x95')){var _0x1d902a=_0x1c65af[_0x4f16('0x96')]({'plain':!![]});return db[_0x4f16('0x97')][_0x4f16('0x4f')]({'where':{'name':'Plugins','userProfileId':_0x399ee1[_0x4f16('0x93')]},'raw':!![]})['then'](function(_0x18f3ee){if(_0x18f3ee&&_0x18f3ee[_0x4f16('0x98')]===0x0){return db['UserProfileResource'][_0x4f16('0x90')]({'name':_0x1d902a[_0x4f16('0x2d')],'resourceId':_0x1d902a['id'],'type':_0x18f3ee[_0x4f16('0x2d')],'sectionId':_0x18f3ee['id']},{})['then'](function(){return _0x1c65af;});}else{return _0x1c65af;}})[_0x4f16('0x4a')](function(_0x17a8f0){logger[_0x4f16('0x2b')](_0x4f16('0x99'),_0x17a8f0);throw _0x17a8f0;});}return _0x1c65af;})['then'](respondWithResult(_0x1fa000,null))[_0x4f16('0x4a')](handleError(_0x1fa000,null));}});}catch(_0x45a8a0){_0x1fa000[_0x4f16('0x1b')](0x1f4)[_0x4f16('0x9a')](_0x45a8a0);}};function removeReferences(_0x58c66b,_0x486a4e){try{if(_0x58c66b){fs[_0x4f16('0x65')](_0x58c66b);logger['info'](_0x4f16('0x9b'));}if(_0x486a4e){rimraf(_0x486a4e,function(){});logger[_0x4f16('0x66')](_0x4f16('0x9c'));}}catch(_0x5f4230){logger[_0x4f16('0x2b')](_0x5f4230);}}exports[_0x4f16('0x9d')]=function(_0x506a18,_0x2d5a54,_0x32bb50){return db[_0x4f16('0x46')][_0x4f16('0x4f')]({'where':{'id':_0x506a18['params']['id']}})[_0x4f16('0x25')](handleEntityNotFound(_0x2d5a54,null))['then'](saveUpdates(_0x506a18[_0x4f16('0x92')],null))[_0x4f16('0x25')](respondWithResult(_0x2d5a54,null))[_0x4f16('0x4a')](handleError(_0x2d5a54,null));};exports[_0x4f16('0x9e')]=function(_0x5c05bc,_0x542e83,_0x5c7edc){return db[_0x4f16('0x46')][_0x4f16('0x4f')]({'where':{'id':_0x5c05bc[_0x4f16('0x4c')]['id']}})[_0x4f16('0x25')](function(_0x44ef95){if(_0x44ef95){return _0x44ef95[_0x4f16('0x26')]();}})[_0x4f16('0x25')](function(_0x125f10){rimraf(path[_0x4f16('0x50')](config[_0x4f16('0x6d')],'server/files/plugins',path[_0x4f16('0x5f')](_0x125f10[_0x4f16('0x5')])),function(){});return _0x125f10;})['then'](handleEntityNotFound(_0x542e83,null))[_0x4f16('0x25')](respondWithStatusCode(_0x542e83,null))[_0x4f16('0x4a')](handleError(_0x542e83,null));};exports['webhookGet']=function(_0xc5679e,_0x13e4b5,_0x1e8f42){return BPromise[_0x4f16('0x9f')]()[_0x4f16('0x25')](function(){if(!_0xc5679e[_0x4f16('0x36')][_0x4f16('0x5')]){throw new Error(_0x4f16('0xa0'));}if(!_0xc5679e[_0x4f16('0x36')][_0x4f16('0xa1')]){throw new Error(_0x4f16('0xa2'));}var _0x4f0af1=_0xc5679e[_0x4f16('0x36')]['hostname']?_0xc5679e[_0x4f16('0x36')][_0x4f16('0xa3')]+':'+_0xc5679e[_0x4f16('0x36')][_0x4f16('0xa1')]:_0x4f16('0xa4')+_0xc5679e['query'][_0x4f16('0xa1')];var _0x80c801=_0xc5679e[_0x4f16('0x36')][_0x4f16('0x1c')]?_0xc5679e[_0x4f16('0x36')]['json']:!![];var _0xd17b7f=_0xc5679e[_0x4f16('0x36')][_0x4f16('0xa5')]?_0xc5679e[_0x4f16('0x36')][_0x4f16('0xa5')]:null;var _0x1f7c14={'method':_0xc5679e[_0x4f16('0xa6')],'uri':util[_0x4f16('0x51')]('%s%s',_0x4f0af1,_0xc5679e[_0x4f16('0x36')][_0x4f16('0x5')]),'json':_0x80c801,'resolveWithFullResponse':!![],'encoding':_0xd17b7f,'qs':_0xc5679e[_0x4f16('0x36')]};if(_0xc5679e[_0x4f16('0xa7')]){_0x1f7c14[_0x4f16('0xa7')]=_0xc5679e['headers'];if(_0x1f7c14[_0x4f16('0xa7')][_0x4f16('0xa8')]){delete _0x1f7c14[_0x4f16('0xa7')][_0x4f16('0xa8')];}}if(_0x1f7c14['headers'][_0x4f16('0xa9')]){delete _0x1f7c14['headers'][_0x4f16('0xa9')];}return rp(_0x1f7c14);})[_0x4f16('0x25')](function(_0x3b9190){if(_0x3b9190){_0x13e4b5[_0x4f16('0x20')](_0x3b9190['headers']);logger[_0x4f16('0x66')](_0x3b9190[_0x4f16('0x92')]);if(_[_0x4f16('0xaa')](_0xc5679e['query'][_0x4f16('0x5')],_0x4f16('0x4e'))&&_0x3b9190[_0x4f16('0xab')]==0x1f4){return _0x13e4b5[_0x4f16('0x2a')](_0x3b9190[_0x4f16('0xab')]);}else{return _0x13e4b5[_0x4f16('0x1b')](_0x3b9190[_0x4f16('0xab')])['send'](_0x3b9190[_0x4f16('0x92')]);}}else{return _0x13e4b5['sendStatus'](0xc8);}})[_0x4f16('0x4a')](handleError(_0x13e4b5,null));};exports[_0x4f16('0xac')]=function(_0x1782b8,_0x326a38,_0xec7e00){return BPromise[_0x4f16('0x9f')]()[_0x4f16('0x25')](function(){if(!_0x1782b8[_0x4f16('0x36')][_0x4f16('0x5')]){throw new Error(_0x4f16('0xa0'));}if(!_0x1782b8[_0x4f16('0x36')]['port']){throw new Error(_0x4f16('0xa2'));}var _0x5d0a68=_0x1782b8[_0x4f16('0x36')]['hostname']?_0x1782b8[_0x4f16('0x36')][_0x4f16('0xa3')]+':'+_0x1782b8[_0x4f16('0x36')]['port']:_0x4f16('0xa4')+_0x1782b8[_0x4f16('0x36')][_0x4f16('0xa1')];var _0x4c24d1=_0x1782b8[_0x4f16('0x36')][_0x4f16('0x1c')]?_0x1782b8[_0x4f16('0x36')][_0x4f16('0x1c')]:!![];var _0x5f4779=_0x1782b8['query']['encoding']?_0x1782b8[_0x4f16('0x36')][_0x4f16('0xa5')]:null;var _0x5ca562={'method':_0x1782b8['method'],'uri':util[_0x4f16('0x51')](_0x4f16('0xad'),_0x5d0a68,_0x1782b8[_0x4f16('0x36')][_0x4f16('0x5')]),'json':_0x4c24d1,'resolveWithFullResponse':!![],'encoding':_0x5f4779,'body':_0x1782b8['body']};if(_0x1782b8[_0x4f16('0xa7')]){_0x5ca562[_0x4f16('0xa7')]=_0x1782b8['headers'];if(_0x5ca562[_0x4f16('0xa7')][_0x4f16('0xa8')]){delete _0x5ca562[_0x4f16('0xa7')][_0x4f16('0xa8')];}}if(_0x5ca562[_0x4f16('0xa7')][_0x4f16('0xa9')]){delete _0x5ca562[_0x4f16('0xa7')][_0x4f16('0xa9')];}return rp(_0x5ca562);})[_0x4f16('0x25')](function(_0x5719b7){if(_0x5719b7){_0x326a38[_0x4f16('0x20')](_0x5719b7[_0x4f16('0xa7')]);logger[_0x4f16('0x66')](_0x5719b7[_0x4f16('0x92')]);return _0x326a38[_0x4f16('0x1b')](_0x5719b7['statusCode'])[_0x4f16('0x9a')](_0x5719b7[_0x4f16('0x92')]);}else{return _0x326a38['sendStatus'](0xc8);}})[_0x4f16('0x4a')](handleError(_0x326a38,null));}; \ No newline at end of file +var _0x3399=['Content-Range','reject','save','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','Plugin','rawAttributes','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','manifest.json','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','dirname','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','undefined','limit','count','offset'];(function(_0xcb8ab,_0x252f1e){var _0x3c5d2b=function(_0x488e22){while(--_0x488e22){_0xcb8ab['push'](_0xcb8ab['shift']());}};_0x3c5d2b(++_0x252f1e);}(_0x3399,0x82));var _0x9339=function(_0x1a88a4,_0x5bb5b8){_0x1a88a4=_0x1a88a4-0x0;var _0x394f7c=_0x3399[_0x1a88a4];return _0x394f7c;};'use strict';var emlformat=require(_0x9339('0x0'));var rimraf=require(_0x9339('0x1'));var zipdir=require(_0x9339('0x2'));var jsonpatch=require(_0x9339('0x3'));var rp=require(_0x9339('0x4'));var moment=require('moment');var BPromise=require(_0x9339('0x5'));var Mustache=require(_0x9339('0x6'));var util=require('util');var path=require(_0x9339('0x7'));var sox=require(_0x9339('0x8'));var csv=require(_0x9339('0x9'));var ejs=require(_0x9339('0xa'));var fs=require('fs');var fs_extra=require(_0x9339('0xb'));var _=require(_0x9339('0xc'));var squel=require('squel');var crypto=require(_0x9339('0xd'));var jsforce=require(_0x9339('0xe'));var deskjs=require(_0x9339('0xf'));var toCsv=require(_0x9339('0x9'));var querystring=require('querystring');var Papa=require(_0x9339('0x10'));var extract=require(_0x9339('0x11'));var rimraf=require(_0x9339('0x1'));var archiver=require(_0x9339('0x12'));var Redis=require(_0x9339('0x13'));var authService=require(_0x9339('0x14'));var qs=require(_0x9339('0x15'));var as=require(_0x9339('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9339('0x17'))(_0x9339('0x18'));var utils=require(_0x9339('0x19'));var config=require(_0x9339('0x1a'));var licenseUtil=require(_0x9339('0x1b'));var db=require('../../mysqldb')['db'];config[_0x9339('0x1c')]=_['defaults'](config[_0x9339('0x1c')],{'host':_0x9339('0x1d'),'port':0x18eb});var socket=require(_0x9339('0x1e'))(new Redis(config['redis']));require(_0x9339('0x1f'))[_0x9339('0x20')](socket);function respondWithStatusCode(_0x178ba0,_0x378008){_0x378008=_0x378008||0xcc;return function(_0x261976){if(_0x261976){return _0x178ba0[_0x9339('0x21')](_0x378008);}return _0x178ba0['status'](_0x378008)['end']();};}function respondWithResult(_0x103492,_0x307874){_0x307874=_0x307874||0xc8;return function(_0x5f274c){if(_0x5f274c){return _0x103492[_0x9339('0x22')](_0x307874)[_0x9339('0x23')](_0x5f274c);}};}function respondWithFilteredResult(_0x17f45c,_0x1a834f){return function(_0x4289c5){if(_0x4289c5){var _0x35fb5a=typeof _0x1a834f['offset']===_0x9339('0x24')&&typeof _0x1a834f[_0x9339('0x25')]===_0x9339('0x24');var _0x374105=_0x4289c5[_0x9339('0x26')];var _0x5869fa=_0x35fb5a?0x0:_0x1a834f['offset'];var _0x2d32e1=_0x35fb5a?_0x4289c5[_0x9339('0x26')]:_0x1a834f[_0x9339('0x27')]+_0x1a834f[_0x9339('0x25')];var _0x23b673;if(_0x2d32e1>=_0x374105){_0x2d32e1=_0x374105;_0x23b673=0xc8;}else{_0x23b673=0xce;}_0x17f45c[_0x9339('0x22')](_0x23b673);return _0x17f45c['set'](_0x9339('0x28'),_0x5869fa+'-'+_0x2d32e1+'/'+_0x374105)[_0x9339('0x23')](_0x4289c5);}return null;};}function patchUpdates(_0x2514eb){return function(_0x169dde){try{jsonpatch['apply'](_0x169dde,_0x2514eb,!![]);}catch(_0x3062e7){return BPromise[_0x9339('0x29')](_0x3062e7);}return _0x169dde[_0x9339('0x2a')]();};}function saveUpdates(_0x428d76,_0x2dc090){return function(_0x51767d){if(_0x51767d){return _0x51767d['update'](_0x428d76)[_0x9339('0x2b')](function(_0x37112a){return _0x37112a;});}return null;};}function removeEntity(_0x4be670,_0x455667){return function(_0x1c5558){if(_0x1c5558){return _0x1c5558[_0x9339('0x2c')]()[_0x9339('0x2b')](function(){var _0x26ab9e=_0x1c5558[_0x9339('0x2d')]({'plain':!![]});var _0x3a17b9=_0x9339('0x2e');return db[_0x9339('0x2f')]['destroy']({'where':{'type':_0x3a17b9,'resourceId':_0x26ab9e['id']}})[_0x9339('0x2b')](function(){return _0x1c5558;});})[_0x9339('0x2b')](function(){_0x4be670[_0x9339('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cf460,_0x3cacd9){return function(_0x901563){if(!_0x901563){_0x5cf460[_0x9339('0x21')](0x194);}return _0x901563;};}function handleError(_0x1047ed,_0x393a05){_0x393a05=_0x393a05||0x1f4;return function(_0x4e4ce7){logger[_0x9339('0x30')](_0x4e4ce7[_0x9339('0x31')]);if(_0x4e4ce7[_0x9339('0x32')]){delete _0x4e4ce7[_0x9339('0x32')];}_0x1047ed['status'](_0x393a05)[_0x9339('0x33')](_0x4e4ce7);};}exports[_0x9339('0x34')]=function(_0xf78a54,_0x54d512){var _0x552d7c={},_0x3ffda8={},_0xf0ff13={'count':0x0,'rows':[]};var _0x39147d=_['map'](db[_0x9339('0x35')][_0x9339('0x36')],function(_0x3fd77f){return{'name':_0x3fd77f['fieldName'],'type':_0x3fd77f[_0x9339('0x37')][_0x9339('0x38')]};});_0x3ffda8[_0x9339('0x39')]=_[_0x9339('0x3a')](_0x39147d,_0x9339('0x32'));_0x3ffda8[_0x9339('0x3b')]=_['keys'](_0xf78a54['query']);_0x3ffda8[_0x9339('0x3c')]=_['intersection'](_0x3ffda8['model'],_0x3ffda8[_0x9339('0x3b')]);_0x552d7c[_0x9339('0x3d')]=_[_0x9339('0x3e')](_0x3ffda8[_0x9339('0x39')],qs['fields'](_0xf78a54[_0x9339('0x3b')][_0x9339('0x3f')]));_0x552d7c[_0x9339('0x3d')]=_0x552d7c[_0x9339('0x3d')][_0x9339('0x40')]?_0x552d7c[_0x9339('0x3d')]:_0x3ffda8['model'];if(!_0xf78a54[_0x9339('0x3b')][_0x9339('0x41')]('nolimit')){_0x552d7c[_0x9339('0x25')]=qs['limit'](_0xf78a54[_0x9339('0x3b')][_0x9339('0x25')]);_0x552d7c[_0x9339('0x27')]=qs[_0x9339('0x27')](_0xf78a54[_0x9339('0x3b')][_0x9339('0x27')]);}_0x552d7c[_0x9339('0x42')]=qs['sort'](_0xf78a54['query'][_0x9339('0x43')]);_0x552d7c[_0x9339('0x44')]=qs[_0x9339('0x3c')](_[_0x9339('0x45')](_0xf78a54['query'],_0x3ffda8[_0x9339('0x3c')]),_0x39147d);if(_0xf78a54[_0x9339('0x3b')][_0x9339('0x46')]){_0x552d7c[_0x9339('0x44')]=_[_0x9339('0x47')](_0x552d7c['where'],{'$or':_['map'](_0x39147d,function(_0x4852d1){if(_0x4852d1[_0x9339('0x37')]!=='VIRTUAL'){var _0x3e8fd0={};_0x3e8fd0[_0x4852d1[_0x9339('0x32')]]={'$like':'%'+_0xf78a54[_0x9339('0x3b')]['filter']+'%'};return _0x3e8fd0;}})});}_0x552d7c=_[_0x9339('0x47')]({},_0x552d7c,_0xf78a54[_0x9339('0x48')]);var _0x59da6f={'where':_0x552d7c[_0x9339('0x44')]};return db[_0x9339('0x35')][_0x9339('0x26')](_0x59da6f)[_0x9339('0x2b')](function(_0x169508){_0xf0ff13[_0x9339('0x26')]=_0x169508;if(_0xf78a54[_0x9339('0x3b')][_0x9339('0x49')]){_0x552d7c[_0x9339('0x4a')]=[{'all':!![]}];}return db[_0x9339('0x35')][_0x9339('0x4b')](_0x552d7c);})[_0x9339('0x2b')](function(_0x5194df){_0xf0ff13[_0x9339('0x4c')]=_0x5194df;return _0xf0ff13;})[_0x9339('0x2b')](respondWithFilteredResult(_0x54d512,_0x552d7c))[_0x9339('0x4d')](handleError(_0x54d512,null));};exports[_0x9339('0x4e')]=function(_0x331c32,_0x3ab435){var _0x1ce406={'raw':!![],'where':{'id':_0x331c32[_0x9339('0x4f')]['id']}},_0x3b8985={};_0x3b8985['model']=_[_0x9339('0x50')](db[_0x9339('0x35')][_0x9339('0x36')]);_0x3b8985[_0x9339('0x3b')]=_[_0x9339('0x50')](_0x331c32[_0x9339('0x3b')]);_0x3b8985[_0x9339('0x3c')]=_[_0x9339('0x3e')](_0x3b8985[_0x9339('0x39')],_0x3b8985['query']);_0x1ce406[_0x9339('0x3d')]=_[_0x9339('0x3e')](_0x3b8985['model'],qs[_0x9339('0x3f')](_0x331c32[_0x9339('0x3b')]['fields']));_0x1ce406[_0x9339('0x3d')]=_0x1ce406[_0x9339('0x3d')][_0x9339('0x40')]?_0x1ce406[_0x9339('0x3d')]:_0x3b8985[_0x9339('0x39')];if(_0x331c32[_0x9339('0x3b')][_0x9339('0x49')]){_0x1ce406[_0x9339('0x4a')]=[{'all':!![]}];}_0x1ce406=_[_0x9339('0x47')]({},_0x1ce406,_0x331c32[_0x9339('0x48')]);return db[_0x9339('0x35')][_0x9339('0x51')](_0x1ce406)[_0x9339('0x2b')](handleEntityNotFound(_0x3ab435,null))[_0x9339('0x2b')](respondWithResult(_0x3ab435,null))[_0x9339('0x4d')](handleError(_0x3ab435,null));};exports[_0x9339('0x52')]=function(_0x456e13,_0x2cfc16,_0x15dec7){return db[_0x9339('0x35')][_0x9339('0x51')]({'where':{'id':_0x456e13[_0x9339('0x4f')]['id']},'attributes':[_0x9339('0x32'),_0x9339('0x7')],'raw':!![]})[_0x9339('0x2b')](handleEntityNotFound(_0x2cfc16,null))[_0x9339('0x2b')](function(_0x14e1b5){if(_0x14e1b5){var _0x4e4233=path[_0x9339('0x53')](config[_0x9339('0x54')],_0x9339('0x55'),util[_0x9339('0x56')](_0x9339('0x57'),path[_0x9339('0x58')](_0x14e1b5[_0x9339('0x7')])));var _0x296b5c=fs[_0x9339('0x59')](_0x4e4233);var _0x416dcc=archiver(_0x9339('0x5a'),{'zlib':{'level':0x9}});_0x416dcc['on'](_0x9339('0x5b'),function(_0x409d1c){if(_0x409d1c[_0x9339('0x5c')]===_0x9339('0x5d')){logger[_0x9339('0x30')](_0x409d1c);}else{throw new db[(_0x9339('0x5e'))][(_0x9339('0x5f'))](_0x9339('0x60'));}});_0x416dcc['on'](_0x9339('0x30'),function(_0x351ec2){throw new db[(_0x9339('0x5e'))][(_0x9339('0x5f'))](_0x9339('0x60'));});_0x416dcc[_0x9339('0x61')](_0x296b5c);_0x416dcc['glob']('**/*',{'cwd':path[_0x9339('0x53')](config['root'],'server/files/plugins',path['dirname'](_0x14e1b5['path'])),'ignore':[path[_0x9339('0x53')](path['basename'](_0x14e1b5[_0x9339('0x7')]),_0x9339('0x62')),path['join'](path['basename'](_0x14e1b5[_0x9339('0x7')]),'attachments/**/*')],'nodir':!![]})[_0x9339('0x63')]();_0x296b5c['on'](_0x9339('0x64'),function(){if(!fs[_0x9339('0x65')](_0x4e4233)){throw new db[(_0x9339('0x5e'))]['Error'](_0x9339('0x66'));}return _0x2cfc16['download'](_0x4e4233,util[_0x9339('0x56')](_0x9339('0x57'),path[_0x9339('0x58')](_0x14e1b5['path'])),function(_0x597204){if(_0x597204){throw new db[(_0x9339('0x5e'))][(_0x9339('0x5f'))](_0x9339('0x67'));}fs[_0x9339('0x68')](_0x4e4233);logger[_0x9339('0x69')](_0x9339('0x6a'));logger['info'](_0x9339('0x6b'));});});}return null;})['catch'](handleError(_0x2cfc16,null));};exports[_0x9339('0x6c')]=function(_0x3e1eaf,_0x52e1df,_0x515b05){var _0x246d66=path['basename'](_0x3e1eaf['file'][_0x9339('0x6d')],path[_0x9339('0x6e')](_0x3e1eaf['file']['filename']));var _0xfa7a8a=path[_0x9339('0x53')](config[_0x9339('0x54')],_0x9339('0x55'),_0x3e1eaf[_0x9339('0x6f')]['filename']);var _0x217fe0=path[_0x9339('0x53')](config[_0x9339('0x54')],'server/files/plugins',_0x246d66);logger[_0x9339('0x69')]('Plugin\x20upload\x20filepath:\x20%s',_0xfa7a8a);logger[_0x9339('0x69')](_0x9339('0x70'),_0x217fe0);try{fs['chmodSync'](_0xfa7a8a,parseInt(_0x9339('0x71'),0x8));extract(_0xfa7a8a,{'dir':_0x217fe0},function(_0x32596a){if(_0x32596a){logger[_0x9339('0x30')](_0x32596a);handleError(_0x32596a,!![]);};var _0x106015=fs[_0x9339('0x72')](_0x217fe0);if(_0x106015[_0x9339('0x40')]>0x1){removeReferences(_0xfa7a8a,_0x217fe0);logger['error'](_0x9339('0x73'));return _0x515b05(new Error(_0x9339('0x73')));}var _0xc993ee=fs[_0x9339('0x74')](path['join'](_0x217fe0,_0x106015[0x0]));if(_0xc993ee[_0x9339('0x75')]()){removeReferences(_0xfa7a8a,_0x217fe0);logger[_0x9339('0x30')]('Invalid\x20plugin\x20structure');return _0x515b05(new Error(_0x9339('0x73')));}if(_0xc993ee[_0x9339('0x76')]()){var _0x4f15b3=fs[_0x9339('0x72')](path[_0x9339('0x53')](_0x217fe0,_0x106015[0x0]));if(_0x4f15b3[_0x9339('0x40')]===0x0){removeReferences(_0xfa7a8a,_0x217fe0);logger[_0x9339('0x30')]('Invalid\x20plugin\x20structure');return _0x515b05(new Error(_0x9339('0x73')));}var _0x37e3fc=_0x4f15b3[_0x9339('0x77')](function(_0x189ac1){return _0x189ac1==='manifest.json';});if(!_0x37e3fc){return _0x515b05(new Error(_0x9339('0x78')));}var _0xa3db32=fs['readFileSync'](path[_0x9339('0x53')](_0x217fe0,_0x106015[0x0],_0x9339('0x79')));var _0x216206=JSON['parse'](_0xa3db32);if(_0x9339('0x24')==typeof _0x216206[_0x9339('0x32')]){return _0x515b05(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x9339('0x24')==typeof _0x216206[_0x9339('0x37')]){return _0x515b05(new Error(_0x9339('0x7a')));}if(_0x9339('0x24')==typeof _0x216206[_0x9339('0x7b')]){return _0x515b05(new Error(_0x9339('0x7c')));}if('undefined'==typeof _0x216206[_0x9339('0x7d')]){return _0x515b05(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x216206[_0x9339('0x37')]===_0x9339('0x7e')){if(_0x9339('0x24')==typeof _0x216206[_0x9339('0x7d')][_0x9339('0x7f')]){return _0x515b05(new Error(_0x9339('0x80')));}if(_0x9339('0x24')==typeof _0x216206[_0x9339('0x7d')][_0x9339('0x7f')][_0x9339('0x81')]&&_0x9339('0x24')==typeof _0x216206[_0x9339('0x7d')][_0x9339('0x7f')]['agent']){return _0x515b05(new Error(_0x9339('0x82')));}}else if(_0x216206[_0x9339('0x37')]===_0x9339('0x83')){if(_0x9339('0x24')==typeof _0x216206[_0x9339('0x7d')][_0x9339('0x84')]){return _0x515b05(new Error(_0x9339('0x85')));}if(_0x9339('0x24')==typeof _0x216206['parameters'][_0x9339('0x86')]){return _0x515b05(new Error(_0x9339('0x87')));}}else{return _0x515b05(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x1096ea=_0x216206[_0x9339('0x32')];var _0x1d31a3=_0x216206[_0x9339('0x88')];var _0x30a741=_0x216206[_0x9339('0x37')];var _0x4eabe4=_0x216206['sidebar']?_0x216206['sidebar']:'always';var _0x35701f=_0x216206[_0x9339('0x89')]?_0x216206[_0x9339('0x89')]:_0x9339('0x8a');var _0x258936='';var _0x444364='';var _0x104b33='';var _0x1b475c='';var _0xd870d0=_0x216206[_0x9339('0x7b')];if(_0x30a741==='html'){if(_0x9339('0x24')!=typeof _0x216206[_0x9339('0x7d')]['views'][_0x9339('0x81')]){var _0x270ef1=_0x216206[_0x9339('0x7d')][_0x9339('0x7f')][_0x9339('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x9339('0x8b')](_0x270ef1)){_0x258936=path['join']('plugins',_0x246d66,_0x106015[0x0],_0x270ef1);}else{_0x258936=_0x270ef1;}}else{logger[_0x9339('0x69')](_0x9339('0x8c'));}if(_0x9339('0x24')!=typeof _0x216206[_0x9339('0x7d')][_0x9339('0x7f')]['agent']){var _0x37f1fb=_0x216206['parameters'][_0x9339('0x7f')][_0x9339('0x8d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x37f1fb)){_0x444364=path[_0x9339('0x53')](_0x9339('0x8e'),_0x246d66,_0x106015[0x0],_0x37f1fb);}else{_0x444364=_0x37f1fb;}}else{logger['info'](_0x9339('0x8f'));}}else if(_0x30a741===_0x9339('0x83')){_0x104b33=_0x216206[_0x9339('0x7d')]['scriptName'];_0x1b475c=_0x216206[_0x9339('0x7d')][_0x9339('0x86')];if(_0x9339('0x24')!=typeof _0x216206[_0x9339('0x7d')][_0x9339('0x7f')]){if(_0x9339('0x24')!=typeof _0x216206['parameters']['views']['admin']){var _0x270ef1=_0x216206[_0x9339('0x7d')][_0x9339('0x7f')][_0x9339('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x270ef1)){_0x258936=path[_0x9339('0x53')](_0x9339('0x8e'),_0x246d66,_0x106015[0x0],_0x270ef1);}else{_0x258936=_0x270ef1;}}if(_0x9339('0x24')!=typeof _0x216206[_0x9339('0x7d')][_0x9339('0x7f')]['agent']){var _0x37f1fb=_0x216206['parameters'][_0x9339('0x7f')][_0x9339('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x9339('0x8b')](_0x37f1fb)){_0x444364=path['join'](_0x9339('0x8e'),_0x246d66,_0x106015[0x0],_0x37f1fb);}else{_0x444364=_0x37f1fb;}}}}var _0x569aa1={'name':_0x1096ea,'description':_0x1d31a3,'path':path['join'](_0x246d66,_0x106015[0x0]),'type':_0x30a741,'sidebar':_0x4eabe4,'icon':_0x35701f,'adminUrl':_0x258936,'agentUrl':_0x444364,'scriptName':_0x104b33,'scriptPath':_0x1b475c,'version':_0xd870d0};removeReferences(_0xfa7a8a,null);return db[_0x9339('0x35')][_0x9339('0x90')](_0x569aa1)[_0x9339('0x2b')](function(_0x287a26){var _0x4d7e5f={'role':_0x3e1eaf[_0x9339('0x91')][_0x9339('0x92')],'userProfileId':_0x3e1eaf[_0x9339('0x91')][_0x9339('0x93')]};if(!_0x4d7e5f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d7e5f[_0x9339('0x92')]===_0x9339('0x94')){var _0x36e8e6=_0x287a26[_0x9339('0x2d')]({'plain':!![]});return db[_0x9339('0x95')][_0x9339('0x51')]({'where':{'name':_0x9339('0x2e'),'userProfileId':_0x4d7e5f[_0x9339('0x93')]},'raw':!![]})[_0x9339('0x2b')](function(_0x5d79a1){if(_0x5d79a1&&_0x5d79a1[_0x9339('0x96')]===0x0){return db[_0x9339('0x2f')][_0x9339('0x90')]({'name':_0x36e8e6[_0x9339('0x32')],'resourceId':_0x36e8e6['id'],'type':_0x5d79a1[_0x9339('0x32')],'sectionId':_0x5d79a1['id']},{})[_0x9339('0x2b')](function(){return _0x287a26;});}else{return _0x287a26;}})[_0x9339('0x4d')](function(_0x34d56c){logger[_0x9339('0x30')](_0x9339('0x97'),_0x34d56c);throw _0x34d56c;});}return _0x287a26;})[_0x9339('0x2b')](respondWithResult(_0x52e1df,null))[_0x9339('0x4d')](handleError(_0x52e1df,null));}});}catch(_0x265619){_0x52e1df['status'](0x1f4)[_0x9339('0x33')](_0x265619);}};function removeReferences(_0x3e2fba,_0x279c4a){try{if(_0x3e2fba){fs[_0x9339('0x68')](_0x3e2fba);logger[_0x9339('0x69')]('Zip\x20archive\x20removed');}if(_0x279c4a){rimraf(_0x279c4a,function(){});logger[_0x9339('0x69')](_0x9339('0x98'));}}catch(_0x11721d){logger[_0x9339('0x30')](_0x11721d);}}exports['update']=function(_0x43224e,_0x454936,_0x435d76){return db[_0x9339('0x35')][_0x9339('0x51')]({'where':{'id':_0x43224e[_0x9339('0x4f')]['id']}})['then'](handleEntityNotFound(_0x454936,null))[_0x9339('0x2b')](saveUpdates(_0x43224e[_0x9339('0x91')],null))[_0x9339('0x2b')](respondWithResult(_0x454936,null))[_0x9339('0x4d')](handleError(_0x454936,null));};exports['delete']=function(_0x515d8c,_0x2f3239,_0x29fc0c){return db[_0x9339('0x35')]['find']({'where':{'id':_0x515d8c[_0x9339('0x4f')]['id']}})['then'](function(_0x1f60bf){if(_0x1f60bf){return _0x1f60bf['destroy']();}})[_0x9339('0x2b')](function(_0x2c8f41){rimraf(path[_0x9339('0x53')](config[_0x9339('0x54')],_0x9339('0x55'),path[_0x9339('0x99')](_0x2c8f41[_0x9339('0x7')])),function(){});return _0x2c8f41;})[_0x9339('0x2b')](handleEntityNotFound(_0x2f3239,null))[_0x9339('0x2b')](respondWithStatusCode(_0x2f3239,null))[_0x9339('0x4d')](handleError(_0x2f3239,null));};exports['webhookGet']=function(_0x27cfb4,_0x4db4ab,_0xc3065b){return BPromise[_0x9339('0x9a')]()['then'](function(){if(!_0x27cfb4[_0x9339('0x3b')]['path']){throw new Error(_0x9339('0x9b'));}if(!_0x27cfb4[_0x9339('0x3b')][_0x9339('0x9c')]){throw new Error(_0x9339('0x9d'));}var _0x55255b=_0x27cfb4[_0x9339('0x3b')][_0x9339('0x9e')]?_0x27cfb4[_0x9339('0x3b')][_0x9339('0x9e')]+':'+_0x27cfb4[_0x9339('0x3b')][_0x9339('0x9c')]:_0x9339('0x9f')+_0x27cfb4[_0x9339('0x3b')][_0x9339('0x9c')];var _0x572904=_0x27cfb4[_0x9339('0x3b')][_0x9339('0x23')]?_0x27cfb4[_0x9339('0x3b')]['json']:!![];var _0x1201e1=_0x27cfb4[_0x9339('0x3b')][_0x9339('0xa0')]?_0x27cfb4[_0x9339('0x3b')][_0x9339('0xa0')]:null;var _0x57881f={'method':_0x27cfb4[_0x9339('0xa1')],'uri':util[_0x9339('0x56')](_0x9339('0xa2'),_0x55255b,_0x27cfb4[_0x9339('0x3b')][_0x9339('0x7')]),'json':_0x572904,'resolveWithFullResponse':!![],'encoding':_0x1201e1,'qs':_0x27cfb4[_0x9339('0x3b')]};if(_0x27cfb4['headers']){_0x57881f[_0x9339('0xa3')]=_0x27cfb4['headers'];if(_0x57881f[_0x9339('0xa3')][_0x9339('0xa4')]){delete _0x57881f[_0x9339('0xa3')]['content-length'];}}if(_0x57881f[_0x9339('0xa3')][_0x9339('0xa5')]){delete _0x57881f['headers'][_0x9339('0xa5')];}return rp(_0x57881f);})[_0x9339('0x2b')](function(_0x1291c7){if(_0x1291c7){_0x4db4ab[_0x9339('0xa6')](_0x1291c7[_0x9339('0xa3')]);logger[_0x9339('0x69')](_0x1291c7[_0x9339('0x91')]);if(_[_0x9339('0xa7')](_0x27cfb4[_0x9339('0x3b')]['path'],_0x9339('0x52'))&&_0x1291c7[_0x9339('0xa8')]==0x1f4){return _0x4db4ab[_0x9339('0x21')](_0x1291c7[_0x9339('0xa8')]);}else{return _0x4db4ab['status'](_0x1291c7[_0x9339('0xa8')])[_0x9339('0x33')](_0x1291c7[_0x9339('0x91')]);}}else{return _0x4db4ab['sendStatus'](0xc8);}})[_0x9339('0x4d')](handleError(_0x4db4ab,null));};exports[_0x9339('0xa9')]=function(_0x3fd4f9,_0x24b040,_0x972492){return BPromise[_0x9339('0x9a')]()['then'](function(){if(!_0x3fd4f9[_0x9339('0x3b')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3fd4f9['query']['port']){throw new Error(_0x9339('0x9d'));}var _0x2ea523=_0x3fd4f9['query'][_0x9339('0x9e')]?_0x3fd4f9[_0x9339('0x3b')][_0x9339('0x9e')]+':'+_0x3fd4f9[_0x9339('0x3b')][_0x9339('0x9c')]:_0x9339('0x9f')+_0x3fd4f9[_0x9339('0x3b')]['port'];var _0x372163=_0x3fd4f9['query'][_0x9339('0x23')]?_0x3fd4f9['query']['json']:!![];var _0x40f584=_0x3fd4f9[_0x9339('0x3b')][_0x9339('0xa0')]?_0x3fd4f9['query'][_0x9339('0xa0')]:null;var _0x3cfbf3={'method':_0x3fd4f9['method'],'uri':util[_0x9339('0x56')](_0x9339('0xa2'),_0x2ea523,_0x3fd4f9[_0x9339('0x3b')]['path']),'json':_0x372163,'resolveWithFullResponse':!![],'encoding':_0x40f584,'body':_0x3fd4f9['body']};if(_0x3fd4f9[_0x9339('0xa3')]){_0x3cfbf3[_0x9339('0xa3')]=_0x3fd4f9[_0x9339('0xa3')];if(_0x3cfbf3['headers'][_0x9339('0xa4')]){delete _0x3cfbf3[_0x9339('0xa3')][_0x9339('0xa4')];}}if(_0x3cfbf3['headers'][_0x9339('0xa5')]){delete _0x3cfbf3[_0x9339('0xa3')][_0x9339('0xa5')];}return rp(_0x3cfbf3);})[_0x9339('0x2b')](function(_0x17b1d6){if(_0x17b1d6){_0x24b040[_0x9339('0xa6')](_0x17b1d6['headers']);logger[_0x9339('0x69')](_0x17b1d6['body']);return _0x24b040[_0x9339('0x22')](_0x17b1d6['statusCode'])[_0x9339('0x33')](_0x17b1d6['body']);}else{return _0x24b040['sendStatus'](0xc8);}})[_0x9339('0x4d')](handleError(_0x24b040,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index e6adf48..09f91e1 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 _0x251b=['../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x43359c,_0x5010b1){var _0x1ee0a5=function(_0x2e914f){while(--_0x2e914f){_0x43359c['push'](_0x43359c['shift']());}};_0x1ee0a5(++_0x5010b1);}(_0x251b,0x185));var _0xb251=function(_0x2b45b5,_0x474458){_0x2b45b5=_0x2b45b5-0x0;var _0x1d9c06=_0x251b[_0x2b45b5];return _0x1d9c06;};'use strict';var EventEmitter=require(_0xb251('0x0'));var Plugin=require(_0xb251('0x1'))['db'][_0xb251('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xb251('0x3')](0x0);var events={'afterCreate':_0xb251('0x4'),'afterUpdate':_0xb251('0x5'),'afterDestroy':_0xb251('0x6')};function emitEvent(_0x978a09){return function(_0x304446,_0x334010,_0xb35470){PluginEvents[_0xb251('0x7')](_0x978a09+':'+_0x304446['id'],_0x304446);PluginEvents['emit'](_0x978a09,_0x304446);_0xb35470(null);};}for(var e in events){if(events[_0xb251('0x8')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xb251('0x9')]=PluginEvents; \ No newline at end of file +var _0x1115=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x47c8a7,_0x1706cc){var _0x350704=function(_0x6b483f){while(--_0x6b483f){_0x47c8a7['push'](_0x47c8a7['shift']());}};_0x350704(++_0x1706cc);}(_0x1115,0x1b6));var _0x5111=function(_0xae5b1e,_0x401d72){_0xae5b1e=_0xae5b1e-0x0;var _0x471581=_0x1115[_0xae5b1e];return _0x471581;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x5111('0x0'))['db'][_0x5111('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x5111('0x2')](0x0);var events={'afterCreate':_0x5111('0x3'),'afterUpdate':_0x5111('0x4'),'afterDestroy':_0x5111('0x5')};function emitEvent(_0x301d43){return function(_0x2cd14a,_0xe7b51f,_0x4b0f15){PluginEvents['emit'](_0x301d43+':'+_0x2cd14a['id'],_0x2cd14a);PluginEvents[_0x5111('0x6')](_0x301d43,_0x2cd14a);_0x4b0f15(null);};}for(var e in events){if(events[_0x5111('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x5111('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 9df0a2c..e26452a 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 _0x7e2d=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash'];(function(_0x1ab023,_0x43d59b){var _0xdbb907=function(_0x328a6e){while(--_0x328a6e){_0x1ab023['push'](_0x1ab023['shift']());}};_0xdbb907(++_0x43d59b);}(_0x7e2d,0x109));var _0xd7e2=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x7e2d[_0x5416db];return _0x243e35;};'use strict';var _=require(_0xd7e2('0x0'));var util=require(_0xd7e2('0x1'));var logger=require(_0xd7e2('0x2'))(_0xd7e2('0x3'));var moment=require('moment');var BPromise=require(_0xd7e2('0x4'));var rp=require(_0xd7e2('0x5'));var fs=require('fs');var path=require(_0xd7e2('0x6'));var rimraf=require(_0xd7e2('0x7'));var config=require(_0xd7e2('0x8'));var attributes=require(_0xd7e2('0x9'));module[_0xd7e2('0xa')]=function(_0x3c4edd,_0x233f39){return _0x3c4edd[_0xd7e2('0xb')](_0xd7e2('0xc'),attributes,{'tableName':_0xd7e2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70d8=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./plugin.attributes','define','Plugin','plugins'];(function(_0xe7d655,_0x184955){var _0x3e4804=function(_0x5cebfb){while(--_0x5cebfb){_0xe7d655['push'](_0xe7d655['shift']());}};_0x3e4804(++_0x184955);}(_0x70d8,0xa9));var _0x870d=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x70d8[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x870d('0x0'));var util=require(_0x870d('0x1'));var logger=require(_0x870d('0x2'))(_0x870d('0x3'));var moment=require(_0x870d('0x4'));var BPromise=require(_0x870d('0x5'));var rp=require(_0x870d('0x6'));var fs=require('fs');var path=require(_0x870d('0x7'));var rimraf=require(_0x870d('0x8'));var config=require('../../config/environment');var attributes=require(_0x870d('0x9'));module['exports']=function(_0x5b131d,_0x161ad6){return _0x5b131d[_0x870d('0xa')](_0x870d('0xb'),attributes,{'tableName':_0x870d('0xc'),'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 d82960f..ffd5e6f 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 _0x4c6b=['code','message','result','catch','CreatePlugin','Plugin','create','body','options','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4c6b,0x111));var _0xb4c6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4c6b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xb4c6('0x0'));var moment=require(_0xb4c6('0x1'));var BPromise=require(_0xb4c6('0x2'));var rs=require(_0xb4c6('0x3'));var fs=require('fs');var Redis=require(_0xb4c6('0x4'));var db=require(_0xb4c6('0x5'))['db'];var utils=require(_0xb4c6('0x6'));var logger=require(_0xb4c6('0x7'))(_0xb4c6('0x8'));var config=require(_0xb4c6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb4c6('0xa')]['http']({'port':0x232a});config[_0xb4c6('0xb')]=_['defaults'](config[_0xb4c6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb4c6('0xc'))(new Redis(config['redis']));require(_0xb4c6('0xd'))[_0xb4c6('0xe')](socket);function respondWithRpcPromise(_0x4b3724,_0x56faa9,_0x31b65c){return new BPromise(function(_0x2e940b,_0x1c9497){return client[_0xb4c6('0xf')](_0x4b3724,_0x31b65c)[_0xb4c6('0x10')](function(_0x30bc04){logger[_0xb4c6('0x11')](_0xb4c6('0x12'),_0x56faa9,_0xb4c6('0x13'));logger[_0xb4c6('0x14')](_0xb4c6('0x15'),_0x56faa9,_0xb4c6('0x13'),JSON[_0xb4c6('0x16')](_0x30bc04));if(_0x30bc04[_0xb4c6('0x17')]){if(_0x30bc04['error'][_0xb4c6('0x18')]===0x1f4){logger[_0xb4c6('0x17')](_0xb4c6('0x12'),_0x56faa9,_0x30bc04['error']['message']);return _0x1c9497(_0x30bc04[_0xb4c6('0x17')]['message']);}logger['error'](_0xb4c6('0x12'),_0x56faa9,_0x30bc04['error'][_0xb4c6('0x19')]);return _0x2e940b(_0x30bc04[_0xb4c6('0x17')]['message']);}else{logger['info'](_0xb4c6('0x12'),_0x56faa9,_0xb4c6('0x13'));_0x2e940b(_0x30bc04[_0xb4c6('0x1a')][_0xb4c6('0x19')]);}})[_0xb4c6('0x1b')](function(_0x296bac){logger['error'](_0xb4c6('0x12'),_0x56faa9,_0x296bac);_0x1c9497(_0x296bac);});});}exports[_0xb4c6('0x1c')]=function(_0x12ca92){var _0x3b97cc=this;return new Promise(function(_0x498319,_0x3b5a53){return db[_0xb4c6('0x1d')][_0xb4c6('0x1e')](_0x12ca92[_0xb4c6('0x1f')],{'raw':_0x12ca92['options']?_0x12ca92[_0xb4c6('0x20')]['raw']===undefined?!![]:![]:!![]})[_0xb4c6('0x10')](function(_0xc69812){logger[_0xb4c6('0x11')]('CreatePlugin',_0x12ca92);logger[_0xb4c6('0x14')](_0xb4c6('0x1c'),_0x12ca92,JSON[_0xb4c6('0x16')](_0xc69812));_0x498319(_0xc69812);})[_0xb4c6('0x1b')](function(_0x4e2874){logger['error'](_0xb4c6('0x1c'),_0x4e2874[_0xb4c6('0x19')],_0x12ca92);_0x3b5a53(_0x3b97cc[_0xb4c6('0x17')](0x1f4,_0x4e2874['message']));});});}; \ No newline at end of file +var _0xa786=['Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','info'];(function(_0x29c2f7,_0x1ffb8b){var _0x3582e6=function(_0x4e91dc){while(--_0x4e91dc){_0x29c2f7['push'](_0x29c2f7['shift']());}};_0x3582e6(++_0x1ffb8b);}(_0xa786,0x1a9));var _0x6a78=function(_0x3425f7,_0x2fe7b2){_0x3425f7=_0x3425f7-0x0;var _0x39519a=_0xa786[_0x3425f7];return _0x39519a;};'use strict';var _=require(_0x6a78('0x0'));var util=require(_0x6a78('0x1'));var moment=require('moment');var BPromise=require(_0x6a78('0x2'));var rs=require(_0x6a78('0x3'));var fs=require('fs');var Redis=require(_0x6a78('0x4'));var db=require(_0x6a78('0x5'))['db'];var utils=require(_0x6a78('0x6'));var logger=require(_0x6a78('0x7'))('rpc');var config=require(_0x6a78('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6a78('0x9')]['http']({'port':0x232a});config[_0x6a78('0xa')]=_[_0x6a78('0xb')](config[_0x6a78('0xa')],{'host':_0x6a78('0xc'),'port':0x18eb});var socket=require(_0x6a78('0xd'))(new Redis(config[_0x6a78('0xa')]));require(_0x6a78('0xe'))[_0x6a78('0xf')](socket);function respondWithRpcPromise(_0xfe8ded,_0x46c99a,_0x4a16c8){return new BPromise(function(_0x2d5c7e,_0xd0aa8a){return client['request'](_0xfe8ded,_0x4a16c8)['then'](function(_0xb7ebfd){logger[_0x6a78('0x10')](_0x6a78('0x11'),_0x46c99a,_0x6a78('0x12'));logger[_0x6a78('0x13')](_0x6a78('0x14'),_0x46c99a,'request\x20sent',JSON[_0x6a78('0x15')](_0xb7ebfd));if(_0xb7ebfd['error']){if(_0xb7ebfd[_0x6a78('0x16')][_0x6a78('0x17')]===0x1f4){logger['error'](_0x6a78('0x11'),_0x46c99a,_0xb7ebfd[_0x6a78('0x16')]['message']);return _0xd0aa8a(_0xb7ebfd[_0x6a78('0x16')][_0x6a78('0x18')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x46c99a,_0xb7ebfd['error'][_0x6a78('0x18')]);return _0x2d5c7e(_0xb7ebfd['error'][_0x6a78('0x18')]);}else{logger[_0x6a78('0x10')]('Plugin,\x20%s,\x20%s',_0x46c99a,_0x6a78('0x12'));_0x2d5c7e(_0xb7ebfd[_0x6a78('0x19')][_0x6a78('0x18')]);}})[_0x6a78('0x1a')](function(_0x2e248e){logger[_0x6a78('0x16')](_0x6a78('0x11'),_0x46c99a,_0x2e248e);_0xd0aa8a(_0x2e248e);});});}exports[_0x6a78('0x1b')]=function(_0x357f87){var _0x371bb8=this;return new Promise(function(_0x5caa7a,_0x337aee){return db[_0x6a78('0x1c')][_0x6a78('0x1d')](_0x357f87[_0x6a78('0x1e')],{'raw':_0x357f87['options']?_0x357f87[_0x6a78('0x1f')][_0x6a78('0x20')]===undefined?!![]:![]:!![]})[_0x6a78('0x21')](function(_0x427947){logger['info']('CreatePlugin',_0x357f87);logger[_0x6a78('0x13')](_0x6a78('0x1b'),_0x357f87,JSON[_0x6a78('0x15')](_0x427947));_0x5caa7a(_0x427947);})['catch'](function(_0x5af813){logger[_0x6a78('0x16')](_0x6a78('0x1b'),_0x5af813[_0x6a78('0x18')],_0x357f87);_0x337aee(_0x371bb8[_0x6a78('0x16')](0x1f4,_0x5af813['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index be0389c..9ce7239 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 _0x23df=['emit','removeListener','length','plugin:','./plugin.events'];(function(_0x45397c,_0x24c4f5){var _0x41c704=function(_0x4c830b){while(--_0x4c830b){_0x45397c['push'](_0x45397c['shift']());}};_0x41c704(++_0x24c4f5);}(_0x23df,0x6d));var _0xf23d=function(_0x5c587a,_0x4dba89){_0x5c587a=_0x5c587a-0x0;var _0x28d19e=_0x23df[_0x5c587a];return _0x28d19e;};'use strict';var PluginEvents=require(_0xf23d('0x0'));var events=['save','remove','update'];function createListener(_0xfec912,_0x19e341){return function(_0x2bb7ba){_0x19e341[_0xf23d('0x1')](_0xfec912,_0x2bb7ba);};}function removeListener(_0x291a32,_0x5c35ba){return function(){PluginEvents[_0xf23d('0x2')](_0x291a32,_0x5c35ba);};}exports['register']=function(_0x5c0e8e){for(var _0x3c8bda=0x0,_0x4c58d7=events[_0xf23d('0x3')];_0x3c8bda<_0x4c58d7;_0x3c8bda++){var _0x392cfd=events[_0x3c8bda];var _0x2d80a9=createListener(_0xf23d('0x4')+_0x392cfd,_0x5c0e8e);PluginEvents['on'](_0x392cfd,_0x2d80a9);}}; \ No newline at end of file +var _0xb68c=['removeListener','length','./plugin.events','update','emit'];(function(_0x53dcb0,_0x4fb30a){var _0x2620cb=function(_0x52c738){while(--_0x52c738){_0x53dcb0['push'](_0x53dcb0['shift']());}};_0x2620cb(++_0x4fb30a);}(_0xb68c,0x9d));var _0xcb68=function(_0x14635,_0x42b4d9){_0x14635=_0x14635-0x0;var _0x3e532=_0xb68c[_0x14635];return _0x3e532;};'use strict';var PluginEvents=require(_0xcb68('0x0'));var events=['save','remove',_0xcb68('0x1')];function createListener(_0x43046d,_0x2074a6){return function(_0x4188db){_0x2074a6[_0xcb68('0x2')](_0x43046d,_0x4188db);};}function removeListener(_0x43b9b1,_0x1a29e5){return function(){PluginEvents[_0xcb68('0x3')](_0x43b9b1,_0x1a29e5);};}exports['register']=function(_0x54331b){for(var _0x14ef8f=0x0,_0x19de87=events[_0xcb68('0x4')];_0x14ef8f<_0x19de87;_0x14ef8f++){var _0x1d87b0=events[_0x14ef8f];var _0x496171=createListener('plugin:'+_0x1d87b0,_0x54331b);PluginEvents['on'](_0x1d87b0,_0x496171);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 8dc28cf..3893f48 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(_0x51bafe,_0x326e05){var _0x25165d=function(_0x238d22){while(--_0x238d22){_0x51bafe['push'](_0x51bafe['shift']());}};_0x25165d(++_0x326e05);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x2c15c7,_0x341796){var _0x54e999=function(_0x1d752a){while(--_0x1d752a){_0x2c15c7['push'](_0x2c15c7['shift']());}};_0x54e999(++_0x341796);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 e299cc3..26fdec1 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 _0xbdb7=['status','send','npm\x20install','info','index','list','then','express','motion2','length','catch','describe','params','body','join','../../files/plugins','script','cwd','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','stack','name'];(function(_0x39fa62,_0x486fd3){var _0x533b22=function(_0xef694a){while(--_0xef694a){_0x39fa62['push'](_0x39fa62['shift']());}};_0x533b22(++_0x486fd3);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2bd0d5,_0x4ace31){_0x2bd0d5=_0x2bd0d5-0x0;var _0x3a963e=_0xbdb7[_0x2bd0d5];return _0x3a963e;};'use strict';var _=require(_0x7bdb('0x0'));var pm2=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var path=require(_0x7bdb('0x4'));var exec=require(_0x7bdb('0x5'))[_0x7bdb('0x6')];var BPromise=require(_0x7bdb('0x7'));function handleEntityNotFound(_0x46c068,_0x47aec5){return function(_0x28542c){if(!_0x28542c){_0x46c068['sendStatus'](0x194);;}return _0x28542c;};}function respondWithResult(_0x4b5fff,_0xffdc86){_0xffdc86=_0xffdc86||0xc8;return function(_0x1e23a3){if(_0x1e23a3){return _0x4b5fff['status'](_0xffdc86)['json'](_0x1e23a3);}return null;};}function handleError(_0x468041,_0x11a877){_0x11a877=_0x11a877||0x1f4;return function(_0x530f81){logger['error'](_0x530f81[_0x7bdb('0x8')]);if(_0x530f81[_0x7bdb('0x9')]){delete _0x530f81[_0x7bdb('0x9')];}_0x468041[_0x7bdb('0xa')](_0x11a877)[_0x7bdb('0xb')](_0x530f81);};}function execChildProcess(){return new BPromise(function(_0x144ff7,_0x297724){exec(_0x7bdb('0xc'),function(_0x5462da,_0x4e5b8e,_0x52b9b9){logger[_0x7bdb('0xd')](_0x4e5b8e);logger[_0x7bdb('0xd')](_0x52b9b9);if(_0x5462da){logger['error'](_0x5462da);return _0x297724(_0x5462da);}return _0x144ff7(_0x4e5b8e);});});}exports[_0x7bdb('0xe')]=function(_0x53021d,_0x5898c1){return pm2[_0x7bdb('0xf')]()[_0x7bdb('0x10')](function(_0x4fd91a){if(_0x4fd91a){var _0x50eeca=_['reject'](_0x4fd91a,function(_0x4476ff){return _0x4476ff[_0x7bdb('0x9')]===_0x7bdb('0x11')||_0x4476ff[_0x7bdb('0x9')]===_0x7bdb('0x12');});return{'rows':_0x50eeca,'count':_0x50eeca[_0x7bdb('0x13')]};}return null;})[_0x7bdb('0x10')](respondWithResult(_0x5898c1,null))[_0x7bdb('0x14')](handleError(_0x5898c1,null));};exports['show']=function(_0x1c5750,_0x43f352){return pm2[_0x7bdb('0x15')](_0x1c5750[_0x7bdb('0x16')]['id'])['then'](respondWithResult(_0x43f352,null))[_0x7bdb('0x10')](handleEntityNotFound(_0x43f352,null))[_0x7bdb('0x14')](handleError(_0x43f352,null));};exports['create']=function(_0x3e5f8e,_0x31f78e){if(_0x3e5f8e[_0x7bdb('0x17')][_0x7bdb('0x9')]&&_0x3e5f8e[_0x7bdb('0x17')]['script']){var _0x49f353=path[_0x7bdb('0x18')](__dirname,_0x7bdb('0x19'),_0x3e5f8e['body'][_0x7bdb('0x1a')]);var _0x118ea1=process[_0x7bdb('0x1b')]();process[_0x7bdb('0x1c')](path[_0x7bdb('0x1d')](_0x49f353));return execChildProcess()['then'](function(_0x1d37ac){process[_0x7bdb('0x1c')](_0x118ea1);return pm2[_0x7bdb('0x1e')]({'name':_0x3e5f8e[_0x7bdb('0x17')]['name'],'script':_0x49f353});})['then'](function(_0x3c423f){pm2['dump']();return _0x3c423f[0x0];})['then'](respondWithResult(_0x31f78e,0xc9))['catch'](handleError(_0x31f78e,null));}else{return _0x31f78e[_0x7bdb('0xa')](0x1f4)['send']({'message':_0x7bdb('0x1f')});}};exports[_0x7bdb('0x20')]=function(_0x3ec129,_0x7c09cf){if(_0x3ec129[_0x7bdb('0x17')]['id']){delete _0x3ec129['body']['id'];}var _0x10e818={'online':_0x7bdb('0x21'),'stopped':_0x7bdb('0x22')};if(_0x10e818[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x17')][_0x7bdb('0xa')])){return pm2[_0x10e818[_0x3ec129[_0x7bdb('0x17')][_0x7bdb('0xa')]]](_0x3ec129[_0x7bdb('0x16')]['id'])[_0x7bdb('0x10')](respondWithResult(_0x7c09cf,0xc8))[_0x7bdb('0x14')](handleError(_0x7c09cf,null));}else{return _0x7c09cf[_0x7bdb('0xa')](0x1f4)['send']({'message':_0x7bdb('0x24')});}};exports[_0x7bdb('0x25')]=function(_0x8f7672,_0x9f5c1){if(_0x8f7672[_0x7bdb('0x17')]['id']){delete _0x8f7672['body']['id'];}if(_0x8f7672[_0x7bdb('0x16')]['id']){return pm2[_0x7bdb('0x26')](_0x8f7672[_0x7bdb('0x16')]['id'])[_0x7bdb('0x10')](function(_0x58c6b7){pm2['dump']();return _0x58c6b7[0x0];})['then'](respondWithResult(_0x9f5c1,null))[_0x7bdb('0x14')](handleError(_0x9f5c1,null));}else{return _0x9f5c1['status'](0x1f4)[_0x7bdb('0xb')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xa8a8=['dirname','start','dump','update','restart','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird','sendStatus','status','json','name','send','npm\x20install','info','error','list','then','reject','length','catch','show','describe','params','create','script','join','../../files/plugins','body','cwd','chdir'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0xa8a8,0xec));var _0x8a8a=function(_0x46b6e8,_0x42a5d3){_0x46b6e8=_0x46b6e8-0x0;var _0x5c6397=_0xa8a8[_0x46b6e8];return _0x5c6397;};'use strict';var _=require(_0x8a8a('0x0'));var pm2=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var path=require('path');var exec=require(_0x8a8a('0x4'))[_0x8a8a('0x5')];var BPromise=require(_0x8a8a('0x6'));function handleEntityNotFound(_0x3ed1de,_0x45515d){return function(_0x1cecd4){if(!_0x1cecd4){_0x3ed1de[_0x8a8a('0x7')](0x194);;}return _0x1cecd4;};}function respondWithResult(_0x12db82,_0x2e8193){_0x2e8193=_0x2e8193||0xc8;return function(_0x315fe9){if(_0x315fe9){return _0x12db82[_0x8a8a('0x8')](_0x2e8193)[_0x8a8a('0x9')](_0x315fe9);}return null;};}function handleError(_0x4225b9,_0xecaa6f){_0xecaa6f=_0xecaa6f||0x1f4;return function(_0x3287f5){logger['error'](_0x3287f5['stack']);if(_0x3287f5[_0x8a8a('0xa')]){delete _0x3287f5['name'];}_0x4225b9[_0x8a8a('0x8')](_0xecaa6f)[_0x8a8a('0xb')](_0x3287f5);};}function execChildProcess(){return new BPromise(function(_0x532621,_0x118380){exec(_0x8a8a('0xc'),function(_0xb13fca,_0x5e448d,_0x679da2){logger[_0x8a8a('0xd')](_0x5e448d);logger[_0x8a8a('0xd')](_0x679da2);if(_0xb13fca){logger[_0x8a8a('0xe')](_0xb13fca);return _0x118380(_0xb13fca);}return _0x532621(_0x5e448d);});});}exports['index']=function(_0x23febf,_0x4e5d74){return pm2[_0x8a8a('0xf')]()[_0x8a8a('0x10')](function(_0x787eec){if(_0x787eec){var _0x2f6e33=_[_0x8a8a('0x11')](_0x787eec,function(_0x78b0f0){return _0x78b0f0[_0x8a8a('0xa')]==='express'||_0x78b0f0[_0x8a8a('0xa')]==='motion2';});return{'rows':_0x2f6e33,'count':_0x2f6e33[_0x8a8a('0x12')]};}return null;})[_0x8a8a('0x10')](respondWithResult(_0x4e5d74,null))[_0x8a8a('0x13')](handleError(_0x4e5d74,null));};exports[_0x8a8a('0x14')]=function(_0x42e8b6,_0x5dd616){return pm2[_0x8a8a('0x15')](_0x42e8b6[_0x8a8a('0x16')]['id'])[_0x8a8a('0x10')](respondWithResult(_0x5dd616,null))[_0x8a8a('0x10')](handleEntityNotFound(_0x5dd616,null))[_0x8a8a('0x13')](handleError(_0x5dd616,null));};exports[_0x8a8a('0x17')]=function(_0x4d7a45,_0x5dc5ae){if(_0x4d7a45['body']['name']&&_0x4d7a45['body'][_0x8a8a('0x18')]){var _0x45095b=path[_0x8a8a('0x19')](__dirname,_0x8a8a('0x1a'),_0x4d7a45[_0x8a8a('0x1b')][_0x8a8a('0x18')]);var _0x242bac=process[_0x8a8a('0x1c')]();process[_0x8a8a('0x1d')](path[_0x8a8a('0x1e')](_0x45095b));return execChildProcess()[_0x8a8a('0x10')](function(_0x3aa2bb){process[_0x8a8a('0x1d')](_0x242bac);return pm2[_0x8a8a('0x1f')]({'name':_0x4d7a45[_0x8a8a('0x1b')]['name'],'script':_0x45095b});})[_0x8a8a('0x10')](function(_0x16c55b){pm2[_0x8a8a('0x20')]();return _0x16c55b[0x0];})[_0x8a8a('0x10')](respondWithResult(_0x5dc5ae,0xc9))[_0x8a8a('0x13')](handleError(_0x5dc5ae,null));}else{return _0x5dc5ae[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x8a8a('0x21')]=function(_0x38c1e0,_0x2e217a){if(_0x38c1e0['body']['id']){delete _0x38c1e0['body']['id'];}var _0x2dafcd={'online':_0x8a8a('0x22'),'stopped':'stop'};if(_0x2dafcd['hasOwnProperty'](_0x38c1e0['body'][_0x8a8a('0x8')])){return pm2[_0x2dafcd[_0x38c1e0['body'][_0x8a8a('0x8')]]](_0x38c1e0[_0x8a8a('0x16')]['id'])['then'](respondWithResult(_0x2e217a,0xc8))[_0x8a8a('0x13')](handleError(_0x2e217a,null));}else{return _0x2e217a[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':_0x8a8a('0x23')});}};exports[_0x8a8a('0x24')]=function(_0x3d6594,_0x3e73b1){if(_0x3d6594[_0x8a8a('0x1b')]['id']){delete _0x3d6594['body']['id'];}if(_0x3d6594['params']['id']){return pm2['delete'](_0x3d6594[_0x8a8a('0x16')]['id'])[_0x8a8a('0x10')](function(_0x5f301e){pm2[_0x8a8a('0x20')]();return _0x5f301e[0x0];})[_0x8a8a('0x10')](respondWithResult(_0x3e73b1,null))['catch'](handleError(_0x3e73b1,null));}else{return _0x3e73b1[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':_0x8a8a('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 1844a05..f0f879c 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 _0x7b58=['get','/queues','getQueues','exports','Router','../../components/auth/service','./realtime.controller','isAuthenticated','getAgents'];(function(_0x22a790,_0x4e0865){var _0x3329c2=function(_0x279d62){while(--_0x279d62){_0x22a790['push'](_0x22a790['shift']());}};_0x3329c2(++_0x4e0865);}(_0x7b58,0x124));var _0x87b5=function(_0x3ccdb0,_0x4adc30){_0x3ccdb0=_0x3ccdb0-0x0;var _0x58aa5b=_0x7b58[_0x3ccdb0];return _0x58aa5b;};'use strict';var express=require('express');var router=express[_0x87b5('0x0')]();var auth=require(_0x87b5('0x1'));var controller=require(_0x87b5('0x2'));router['get']('/agents',auth[_0x87b5('0x3')](),controller[_0x87b5('0x4')]);router[_0x87b5('0x5')](_0x87b5('0x6'),auth[_0x87b5('0x3')](),controller[_0x87b5('0x7')]);module[_0x87b5('0x8')]=router; \ No newline at end of file +var _0x6c4d=['./realtime.controller','get','/agents','/queues','getQueues','express','Router','../../components/auth/service'];(function(_0x5cc556,_0x158710){var _0x12103b=function(_0x13ff4a){while(--_0x13ff4a){_0x5cc556['push'](_0x5cc556['shift']());}};_0x12103b(++_0x158710);}(_0x6c4d,0x1a5));var _0xd6c4=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x6c4d[_0x4243a3];return _0x1b2a33;};'use strict';var express=require(_0xd6c4('0x0'));var router=express[_0xd6c4('0x1')]();var auth=require(_0xd6c4('0x2'));var controller=require(_0xd6c4('0x3'));router[_0xd6c4('0x4')](_0xd6c4('0x5'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0xd6c4('0x6'),auth['isAuthenticated'](),controller[_0xd6c4('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index b193691..9d229e0 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 _0xde1f=['erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','agents','loggedInDb','busy','find','pick','length','some','connectedlinenum','internal','toString','UserId','accountcode','online','voiceStatus','User','Queue','Pause','QueueId','unknown','unavailable','isNil','chatPause','faxPause','openchannelPause','smsPause','voicePause','filter','idle','pause','mailStatus','whatsappStatus','*pause','mail','sms','openchannel','fax','whatsapp','includes','toLowerCase','getAgents','all','flatten','uniq','split','fields','order','startsWith','DESC','ASC','sort','globalStatus','pauseType','userpic','lastLoginAt','lastPauseAt','whatsappPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','openchannelStatus','smsStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','mailPause','resolve','query','channel','globalQueueFilter','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','isEmpty','where','user','userProfileId','getResources','findAndCountAll','rows','omit','globalStatusFilter','pauseTypeFilter','getQueues','UserProfile','util','lodash','jayson/promise','../../config/logger','../../mysqldb','client','http','offset','undefined','limit','count','status','Content-Range','json','error','stack','name','Agents','then','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','voice','request','startCase','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','talking','paused','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate'];(function(_0x34e08b,_0x5b1d78){var _0x633196=function(_0xf4ca27){while(--_0xf4ca27){_0x34e08b['push'](_0x34e08b['shift']());}};_0x633196(++_0x5b1d78);}(_0xde1f,0x10e));var _0xfde1=function(_0x23ed5d,_0x25c460){_0x23ed5d=_0x23ed5d-0x0;var _0x12fbdd=_0xde1f[_0x23ed5d];return _0x12fbdd;};'use strict';var util=require(_0xfde1('0x0'));var _=require(_0xfde1('0x1'));var jayson=require(_0xfde1('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xfde1('0x3'))('api');var db=require(_0xfde1('0x4'))['db'];var amiClient=jayson[_0xfde1('0x5')][_0xfde1('0x6')]({'port':0x232a});var routingClient=jayson[_0xfde1('0x5')][_0xfde1('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x5cb2c5,_0x2ad3be){return function(_0x45fd8d){if(_0x45fd8d){var _0x2ae5ed=typeof _0x2ad3be[_0xfde1('0x7')]===_0xfde1('0x8')&&typeof _0x2ad3be[_0xfde1('0x9')]==='undefined';var _0x543d06=_0x45fd8d['count'];var _0x544af2=_0x2ae5ed?0x0:_0x2ad3be[_0xfde1('0x7')];var _0x42f9a8=_0x2ae5ed?_0x45fd8d[_0xfde1('0xa')]:_0x2ad3be[_0xfde1('0x7')]+_0x2ad3be[_0xfde1('0x9')];var _0x489604;if(_0x42f9a8>=_0x543d06){_0x42f9a8=_0x543d06;_0x489604=0xc8;}else{_0x489604=0xce;}_0x5cb2c5[_0xfde1('0xb')](_0x489604);return _0x5cb2c5['set'](_0xfde1('0xc'),_0x544af2+'-'+_0x42f9a8+'/'+_0x543d06)[_0xfde1('0xd')](_0x45fd8d);}return null;};}function handleError(_0x49c62e,_0x273598){_0x273598=_0x273598||0x1f4;return function(_0x57cf4b){logger[_0xfde1('0xe')](_0x57cf4b[_0xfde1('0xf')]);if(_0x57cf4b[_0xfde1('0x10')]){delete _0x57cf4b[_0xfde1('0x10')];}_0x49c62e['status'](_0x273598)['send'](_0x57cf4b);};}function getRealtimeAgents(){return new Promise(function(_0x959840,_0x3d712d){return amiClient['request'](_0xfde1('0x11'),{})[_0xfde1('0x12')](function(_0x33d9c2){if(_0x33d9c2['error'])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x5b8359=_0x33d9c2[_0xfde1('0x13')];return routingClient['request'](_0xfde1('0x11'),{})[_0xfde1('0x12')](function(_0x3a7604){if(_0x3a7604[_0xfde1('0xe')])throw new Error(_0xfde1('0x14'));var _0x28dfb3=_0x3a7604[_0xfde1('0x13')];return _0x959840(_[_0xfde1('0x15')]({},_0x5b8359,_0x28dfb3));});})['catch'](function(_0x1e1af8){_0x3d712d(_0x1e1af8);});});}function getRealtimeQueues(_0xd018d4,_0x5be0d7){return new Promise(function(_0x41ca38,_0x16e1d8){var _0x43e877=_0x5be0d7===_0xfde1('0x16')?amiClient:routingClient;return _0x43e877[_0xfde1('0x17')](_[_0xfde1('0x18')](_0x5be0d7)+'Queues',_0xd018d4)[_0xfde1('0x12')](function(_0x31800c){if(_0x31800c['error'])throw new Error(util['format'](_0xfde1('0x19'),_0x5be0d7));return _0x41ca38(_0x31800c[_0xfde1('0x13')]);})[_0xfde1('0x1a')](function(_0x20a34e){_0x16e1d8(_0x20a34e);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x141696,_0x3f8d5c){return amiClient[_0xfde1('0x17')](_0xfde1('0x1b'),{})[_0xfde1('0x12')](function(_0x40aafe){if(_0x40aafe[_0xfde1('0xe')])throw new Error(_0xfde1('0x1c'));return _0x141696(_0x40aafe[_0xfde1('0x13')]);})[_0xfde1('0x1a')](function(_0x361769){_0x3f8d5c(_0x361769);});});}function initializeQueues(_0x3ffa91,_0x283142,_0x2550ee,_0x14cb7a){var _0x351f92=[_0xfde1('0x1d'),_0xfde1('0x1e'),'waiting',_0xfde1('0x1f'),_0xfde1('0x20')];if(_0x2550ee===_0xfde1('0x16')&&_0x14cb7a===_0xfde1('0x21')){_0x351f92[_0xfde1('0x22')](_0xfde1('0x23'),_0xfde1('0x24'),_0xfde1('0x25'),_0xfde1('0x26'),_0xfde1('0x27'),_0xfde1('0x28'),_0xfde1('0x29'),_0xfde1('0x2a'),_0xfde1('0x2b'),_0xfde1('0x2c'),_0xfde1('0x2d'),_0xfde1('0x2e'),'dialPredictiveInterval',_0xfde1('0x2f'),_0xfde1('0x30'),'predictiveIntervalAvailable',_0xfde1('0x31'),'predictiveIntervalAnsweredCalls',_0xfde1('0x32'),'predictiveIntervalDroppedCallsCallersExit',_0xfde1('0x33'),_0xfde1('0x34'));}return _0x3ffa91[_0xfde1('0x35')](function(_0x4ae3d0){var _0x56b8a8=_0x4ae3d0['get']({'plain':!![]});_0x56b8a8[_0xfde1('0x36')]=[];_0x56b8a8['paused']=0x0;_0x56b8a8[_0xfde1('0x37')]=0x0;_0x56b8a8[_0xfde1('0x1d')]=0x0;_0x56b8a8['available']=0x0;_0x56b8a8['waiting']=0x0;if(_0x2550ee===_0xfde1('0x16')){_0x56b8a8[_0xfde1('0x1f')]=0x0;_0x56b8a8[_0xfde1('0x38')]=0x0;if(_0x14cb7a===_0xfde1('0x21')){_0x56b8a8[_0xfde1('0x23')]=0x0;_0x56b8a8['originated']=0x0;}}var _0x4db3c3=_[_0xfde1('0x39')](_0x283142,['id',_0x56b8a8['id']]);if(_0x4db3c3)_[_0xfde1('0x15')](_0x56b8a8,_[_0xfde1('0x3a')](_0x4db3c3,_0x351f92));return _0x56b8a8;});}function updateAgentVoiceStatus(_0x47a4b5,_0x50d39a,_0x37b873){var _0x18b021=_['filter'](_0x37b873,['queue',_0x50d39a[_0xfde1('0x10')]]);if(_0x18b021[_0xfde1('0x3b')]===0x0)return _0x47a4b5['busy']=!![];if(_[_0xfde1('0x3c')](_0x18b021,[_0xfde1('0x3d'),_0x47a4b5[_0xfde1('0x3e')][_0xfde1('0x3f')]()]))return _0x47a4b5[_0xfde1('0x1f')]=!![];if(!_0x47a4b5['talking'])return _0x47a4b5[_0xfde1('0x38')]=!![];}function getVoiceQueueAgents(_0x157260,_0x3329c6,_0x54c80c,_0xf306fb){var _0x4b560b=_[_0xfde1('0x39')](_0x3329c6,['id',_0x157260['id']]);if(!_0x4b560b)return _0x157260;return _0x4b560b['getMembers']({'raw':!![]})[_0xfde1('0x12')](function(_0x2a7f24){for(var _0x40bd83=0x0;_0x40bd83<_0x2a7f24['length'];_0x40bd83++){var _0x2a66c2=_['find'](_0x54c80c,['id',_0x2a7f24[_0x40bd83][_0xfde1('0x40')]]);if(!_0x2a66c2){_0x2a66c2={'id':_0x2a7f24[_0x40bd83][_0xfde1('0x40')],'name':_0x2a7f24[_0x40bd83][_0xfde1('0x40')],'accountcode':'','online':![]};}var _0x88a775={'id':_0x2a66c2['id'],'name':_0x2a66c2[_0xfde1('0x10')],'internal':_0x2a66c2[_0xfde1('0x41')],'online':Boolean(_0x2a66c2[_0xfde1('0x42')]),'paused':Boolean(_0x2a7f24[_0x40bd83][_0xfde1('0x20')])};if(_0x2a66c2[_0xfde1('0x43')]===_0xfde1('0x1f'))updateAgentVoiceStatus(_0x88a775,_0x157260,_0xf306fb);if(_0x88a775['online'])_0x157260[_0xfde1('0x37')]++;if(_0x88a775['busy'])_0x157260[_0xfde1('0x38')]++;if(_0x88a775[_0xfde1('0x20')]&&!_0x88a775[_0xfde1('0x38')]&&!_0x88a775[_0xfde1('0x1f')])_0x157260[_0xfde1('0x20')]++;_0x157260[_0xfde1('0x36')]['push'](_0x88a775);}return _0x157260;});}function getQueueAgents(_0x3fde26,_0x4bba4b,_0x58de0d){var _0x456adc=_0xfde1('0x44')+_['startCase'](_0x58de0d)+_0xfde1('0x45');var _0x14bca0=_0x58de0d+_0xfde1('0x46');return db[_0x456adc]['findAll']({'where':{[_['startCase'](_0x58de0d)+_0xfde1('0x47')]:_0x3fde26['id']},'raw':!![]})[_0xfde1('0x12')](function(_0x22812d){for(var _0x41889d=0x0;_0x41889d<_0x22812d['length'];_0x41889d++){var _0x5b2cdd=_[_0xfde1('0x39')](_0x4bba4b,['id',_0x22812d[_0x41889d][_0xfde1('0x40')]]);if(!_0x5b2cdd){_0x5b2cdd={'id':_0x22812d[_0x41889d][_0xfde1('0x40')],'name':_0x22812d[_0x41889d]['UserId'],'online':![],['pauseField']:![]};}var _0x5cb67c={'id':_0x5b2cdd['id'],'name':_0x5b2cdd['name'],'online':Boolean(_0x5b2cdd[_0xfde1('0x42')]),'paused':Boolean(_0x5b2cdd[_0x14bca0])};if(_0x5cb67c[_0xfde1('0x42')])_0x3fde26[_0xfde1('0x37')]++;_0x3fde26['agents'][_0xfde1('0x22')](_0x5cb67c);}return _0x3fde26;});}function isIdle(_0x356ec2){return _0x356ec2==='idle'||_0x356ec2===_0xfde1('0x48')||_0x356ec2===_0xfde1('0x49')||_0x356ec2==='ringing'||_[_0xfde1('0x4a')](_0x356ec2);}function isAgentPaused(_0x2e759a,_0x45ff3d){var _0x378f52=[_0x2e759a[_0xfde1('0x4b')],_0x2e759a[_0xfde1('0x4c')],_0x2e759a['mailPause'],_0x2e759a[_0xfde1('0x4d')],_0x2e759a[_0xfde1('0x4e')],_0x2e759a[_0xfde1('0x4f')],_0x2e759a['whatsappPause']];if(!_0x45ff3d)return _['every'](_0x378f52);var _0x28247a=_[_0xfde1('0x50')](_0x378f52);return _0x28247a[_0xfde1('0x3b')]>0x0&&_0x28247a[_0xfde1('0x3b')]<_0x378f52[_0xfde1('0x3b')]?!![]:![];}function isAgentIdle(_0x404e9b){if(_0x404e9b[_0xfde1('0x43')]!==_0xfde1('0x51')&&_0x404e9b[_0xfde1('0x4f')]){_0x404e9b[_0xfde1('0x43')]=_0xfde1('0x52');return![];}return _['every']([_0x404e9b['chatStatus'],_0x404e9b['faxStatus'],_0x404e9b[_0xfde1('0x53')],_0x404e9b['openchannelStatus'],_0x404e9b['smsStatus'],_0x404e9b[_0xfde1('0x43')],_0x404e9b[_0xfde1('0x54')]],isIdle);}function getAgentStatus(_0x5c04fa){var _0x35ef44=_0xfde1('0x48');if(isAgentPaused(_0x5c04fa))_0x35ef44=_0xfde1('0x52');else if(isAgentPaused(_0x5c04fa,!![]))_0x35ef44=_0xfde1('0x55');else if(isAgentIdle(_0x5c04fa))_0x35ef44=_0xfde1('0x51');else _0x35ef44='busy';return _0x35ef44;}function validateChannel(_0xb7fb41){var _0x599964=[_0xfde1('0x56'),'chat',_0xfde1('0x57'),_0xfde1('0x58'),_0xfde1('0x59'),_0xfde1('0x5a'),_0xfde1('0x16')];if(!_[_0xfde1('0x5b')](_0x599964,_0xb7fb41[_0xfde1('0x5c')]()))throw new Error('Invalid\x20channel');return _0xb7fb41[_0xfde1('0x5c')]();}function getFilteredAgentIds(_0x26a94f,_0x408cd1){var _0xe5418a=_['isArray'](_0x26a94f)?_0x26a94f:[_0x26a94f];var _0x519bad=_[_0xfde1('0x35')](_0xe5418a,function(_0x184f0d){return db[_0x408cd1]['findOne']({'where':{'name':_0x184f0d}})[_0xfde1('0x12')](function(_0x19fd77){if(!_0x19fd77)return[];return _0x19fd77[_0xfde1('0x5d')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xfde1('0x5e')](_0x519bad)[_0xfde1('0x12')](function(_0x546fa0){var _0x2dbc38=_(_0x546fa0)[_0xfde1('0x5f')]()[_0xfde1('0x35')]('id')[_0xfde1('0x60')]()['value']();return _0x2dbc38;});}function getUpdatedSortOptions(_0x26b617){var _0x25f2eb={'fields':[],'order':null};var _0x4df18f=_0x26b617[_0xfde1('0x61')](',');_0x25f2eb[_0xfde1('0x62')]=_[_0xfde1('0x50')](_0x4df18f,function(_0x137e1a){if(!_0x137e1a[_0xfde1('0x5b')]('globalStatus'))return!![];_0x25f2eb[_0xfde1('0x63')]=_[_0xfde1('0x64')](_0x137e1a,'-')?_0xfde1('0x65'):_0xfde1('0x66');return![];});return _0x25f2eb;}function orderAgentsByStatus(_0x3b27ec,_0x118f4c){return _0x3b27ec[_0xfde1('0x67')](function(_0x47c5a6,_0x35e993){if(_0x47c5a6[_0xfde1('0x68')]===_0x35e993[_0xfde1('0x68')]&&_0x47c5a6[_0xfde1('0x68')]===_0xfde1('0x52')){if(_0x118f4c===_0xfde1('0x65'))return(_0x47c5a6[_0xfde1('0x69')]||'')<(_0x35e993[_0xfde1('0x69')]||'')?0x1:-0x1;return _0x47c5a6[_0xfde1('0x69')]<_0x35e993[_0xfde1('0x69')]?-0x1:0x1;}else{if(_0x118f4c===_0xfde1('0x65'))return _0x47c5a6[_0xfde1('0x68')]<_0x35e993[_0xfde1('0x68')]?0x1:-0x1;return _0x47c5a6[_0xfde1('0x68')]<_0x35e993[_0xfde1('0x68')]?-0x1:0x1;}});}exports['getAgents']=function(_0x317af3,_0x2e99be){var _0x5918bc={'count':0x0,'rows':[]},_0x22c4e2={},_0xdfd342,_0x562175,_0x53f9e6,_0xc78d1f,_0x2cdbe9=[_0xfde1('0x6a'),_0xfde1('0x42'),_0xfde1('0x6b'),_0xfde1('0x6c'),_0xfde1('0x69'),_0xfde1('0x6c'),'internal','address',_0xfde1('0x4b'),_0xfde1('0x4d'),'mailPause',_0xfde1('0x4e'),_0xfde1('0x6d'),'faxPause','voicePause',_0xfde1('0x6e'),'openchannelCapacity',_0xfde1('0x6f'),_0xfde1('0x70'),_0xfde1('0x71'),'faxCapacity',_0xfde1('0x72'),_0xfde1('0x73'),_0xfde1('0x74'),_0xfde1('0x75'),_0xfde1('0x76'),_0xfde1('0x77'),_0xfde1('0x78'),_0xfde1('0x79'),_0xfde1('0x53'),_0xfde1('0x7a'),_0xfde1('0x54'),'faxStatus',_0xfde1('0x43'),_0xfde1('0x7b'),_0xfde1('0x7c'),_0xfde1('0x7d'),'smsStatusTime',_0xfde1('0x7e'),_0xfde1('0x7f'),'voiceStatusTime',_0xfde1('0x80'),_0xfde1('0x81'),_0xfde1('0x82'),'phoneBarEnableScreenRecordingByAgent',_0xfde1('0x83'),_0xfde1('0x84')],_0x1679a5=[_0xfde1('0x4b'),'openchannelPause',_0xfde1('0x85'),_0xfde1('0x4e'),_0xfde1('0x6d'),'faxPause',_0xfde1('0x4f'),_0xfde1('0x42')];Promise[_0xfde1('0x86')]()['then'](function(){if(_0x317af3[_0xfde1('0x87')]['channel'])_0xdfd342=validateChannel(_0x317af3[_0xfde1('0x87')][_0xfde1('0x88')]);if(!_0x317af3['query'][_0xfde1('0x67')]||!_0x317af3['query'][_0xfde1('0x67')][_0xfde1('0x5b')](_0xfde1('0x68')))return;var _0x536b74=getUpdatedSortOptions(_0x317af3[_0xfde1('0x87')][_0xfde1('0x67')]);_0x317af3[_0xfde1('0x87')][_0xfde1('0x67')]=_0x536b74[_0xfde1('0x62')]['join'](',');_0x562175=_0x536b74['order'];})[_0xfde1('0x12')](function(){if(!_0x317af3[_0xfde1('0x87')][_0xfde1('0x89')])return[];var _0x1ea500=_['startCase'](_0xdfd342)+_0xfde1('0x45');return getFilteredAgentIds(_0x317af3[_0xfde1('0x87')][_0xfde1('0x89')],_0x1ea500);})['then'](function(_0x4e9c60){var _0x38ed94=_['map'](db[_0xfde1('0x44')][_0xfde1('0x8a')],function(_0x2a6e7c){return{'name':_0x2a6e7c[_0xfde1('0x8b')],'type':_0x2a6e7c[_0xfde1('0x8c')][_0xfde1('0x8d')]};});_0x317af3['query'][_0xfde1('0x8e')]=_0xfde1('0x8f');_0x317af3['query']['online']=!![];_0x22c4e2=qs[_0xfde1('0x90')](_0x38ed94,_0x317af3);_0x22c4e2[_0xfde1('0x91')]=!![];if(!_[_0xfde1('0x92')](_0x4e9c60)){_0x22c4e2[_0xfde1('0x93')]=_[_0xfde1('0x15')](_0x22c4e2[_0xfde1('0x93')],{'$and':[{'id':{'$in':_0x4e9c60}}]});}else if(!_[_0xfde1('0x92')](_0x317af3[_0xfde1('0x87')]['globalQueueFilter'])){return _0x5918bc;}if(_0x317af3[_0xfde1('0x94')]['role']==='user'){var _0x257641={'params':{'id':_0x317af3[_0xfde1('0x94')][_0xfde1('0x95')]},'query':{'section':_0xfde1('0x11'),'role':_0xfde1('0x8f'),'online':!![],'nolimit':_0x317af3[_0xfde1('0x87')]['nolimit'],'sort':_0x317af3[_0xfde1('0x87')]['sort'],'filter':_0x317af3[_0xfde1('0x87')][_0xfde1('0x50')],'raw':!![],'ids':_0x4e9c60}};return db['UserProfile'][_0xfde1('0x96')](_0x257641);}return db[_0xfde1('0x44')][_0xfde1('0x97')](_0x22c4e2);})['then'](function(_0x3fde35){_0x5918bc['count']=_0x3fde35[_0xfde1('0xa')];_0x53f9e6=_0x3fde35[_0xfde1('0x98')];return getRealtimeAgents();})['then'](function(_0x2813ca){_0xc78d1f=_0x2813ca[_0xfde1('0x98')];return _0x53f9e6[_0xfde1('0x35')](function(_0x355a76){var _0x43555f=_['find'](_0xc78d1f,['id',_0x355a76['id']]);if(_0x43555f)_[_0xfde1('0x15')](_0x355a76,_[_0xfde1('0x3a')](_[_0xfde1('0x99')](_0x43555f,_0x1679a5),_0x2cdbe9));_0x355a76[_0xfde1('0x68')]=getAgentStatus(_0x355a76);return _0x355a76;});})[_0xfde1('0x12')](function(_0x167bf6){var _0x6d6f66;if(_0x317af3[_0xfde1('0x87')][_0xfde1('0x9a')]){_0x6d6f66=_['filter'](_0x167bf6,[_0xfde1('0x68'),_0x317af3[_0xfde1('0x87')][_0xfde1('0x9a')]]);if(_0x317af3[_0xfde1('0x87')][_0xfde1('0x9b')]){_0x6d6f66=_[_0xfde1('0x50')](_0x6d6f66,['pauseType',_0x317af3['query'][_0xfde1('0x9b')]]);}}if(_0x6d6f66)_0x167bf6=_0x6d6f66;if(!_0x562175)return _0x167bf6;return orderAgentsByStatus(_0x167bf6,_0x562175);})[_0xfde1('0x12')](function(_0x4339d4){_0x5918bc['rows']=_0x4339d4;return _0x5918bc;})['then'](respondWithFilteredResult(_0x2e99be,_0x22c4e2))['catch'](handleError(_0x2e99be,null));};exports[_0xfde1('0x9c')]=function(_0x41f650,_0x2c46ad){var _0x40b4dc={'count':0x0,'rows':[]},_0x567aea={},_0x108b2a,_0x1c78a3,_0xbd65f4,_0x146c56,_0x5f4c56;Promise[_0xfde1('0x86')]()[_0xfde1('0x12')](function(){if(_0x41f650[_0xfde1('0x87')]['channel'])_0x108b2a=validateChannel(_0x41f650['query']['channel']);var _0x58f0ff=_[_0xfde1('0x18')](_0x108b2a)+'Queue';var _0x11a695=_[_0xfde1('0x35')](db[_0x58f0ff][_0xfde1('0x8a')],function(_0x315ab9){return{'name':_0x315ab9['fieldName'],'type':_0x315ab9[_0xfde1('0x8c')]['key']};});_0x567aea=qs['getOptions'](_0x11a695,_0x41f650);if(_0x41f650[_0xfde1('0x94')][_0xfde1('0x8e')]===_0xfde1('0x94')){var _0x14b5ad={'params':{'id':_0x41f650[_0xfde1('0x94')][_0xfde1('0x95')]},'query':{'section':_0x108b2a===_0xfde1('0x16')&&_0x41f650[_0xfde1('0x87')]['type']===_0xfde1('0x21')?'QueueCampaigns':_[_0xfde1('0x18')](_0x108b2a)+'Queues','type':_0x41f650[_0xfde1('0x87')][_0xfde1('0x8c')],'nolimit':!![],'sort':_0xfde1('0x10'),'filter':_0x41f650[_0xfde1('0x87')][_0xfde1('0x50')]}};return db[_0xfde1('0x9d')]['getResources'](_0x14b5ad);}return db[_0x58f0ff]['findAndCountAll'](_0x567aea);})[_0xfde1('0x12')](function(_0x5ecda0){_0x40b4dc['count']=_0x5ecda0[_0xfde1('0xa')];_0x1c78a3=_0x5ecda0[_0xfde1('0x98')];return getRealtimeQueues(_0x41f650,_0x108b2a);})[_0xfde1('0x12')](function(_0x5084de){_0x146c56=_0x5084de[_0xfde1('0x98')];return getRealtimeAgents();})[_0xfde1('0x12')](function(_0x59ea79){_0xbd65f4=_0x59ea79[_0xfde1('0x98')];if(_0x108b2a!=_0xfde1('0x16'))return;return getRealtimeVoiceQueueChannels();})[_0xfde1('0x12')](function(_0x433d53){_0x5f4c56=_0x433d53?_0x433d53['rows']:[];return initializeQueues(_0x1c78a3,_0x146c56,_0x108b2a,_0x41f650[_0xfde1('0x87')][_0xfde1('0x8c')]);})[_0xfde1('0x12')](function(_0x594325){var _0x54aea9=_0x594325[_0xfde1('0x35')](function(_0x57f8e2){if(_0x108b2a==='voice')return getVoiceQueueAgents(_0x57f8e2,_0x1c78a3,_0xbd65f4,_0x5f4c56);else return getQueueAgents(_0x57f8e2,_0xbd65f4,_0x108b2a);});return Promise[_0xfde1('0x5e')](_0x54aea9);})[_0xfde1('0x12')](function(_0x416620){_0x40b4dc[_0xfde1('0x98')]=_0x416620;return _0x40b4dc;})[_0xfde1('0x12')](respondWithFilteredResult(_0x2c46ad,_0x567aea))[_0xfde1('0x1a')](handleError(_0x2c46ad,null));}; \ No newline at end of file +var _0x97a9=['mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','sms','fax','includes','toLowerCase','Invalid\x20channel','isArray','findOne','getAgents','all','flatten','uniq','value','split','filter','order','startsWith','DESC','sort','globalStatus','pause','pauseType','lastPauseAt','address','chatPause','smsPause','chatCapacity','openchannelCapacity','mailCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','faxCurrentCapacity','chatStatus','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','channel','query','fields','join','globalQueueFilter','Queue','rawAttributes','fieldName','type','key','role','getOptions','raw','isEmpty','where','user','userProfileId','agent','findAndCountAll','omit','globalStatusFilter','pauseTypeFilter','rows','getQueues','QueueCampaigns','UserProfile','getResources','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','count','status','set','Content-Range','json','error','stack','name','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','voice','startCase','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','VoiceQueuesChannels','loggedIn','available','waiting','talking','paused','outbound','push','pTalking','originated','message','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','busy','find','pick','length','connectedlinenum','internal','toString','getMembers','UserId','accountcode','online','voiceStatus','User','findAll','QueueId','idle','unknown','unavailable','ringing','isNil','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','every'];(function(_0xd3701a,_0x3186d1){var _0x26aa91=function(_0x36867f){while(--_0x36867f){_0xd3701a['push'](_0xd3701a['shift']());}};_0x26aa91(++_0x3186d1);}(_0x97a9,0xf3));var _0x997a=function(_0x28ad58,_0x44aaa4){_0x28ad58=_0x28ad58-0x0;var _0x4a2534=_0x97a9[_0x28ad58];return _0x4a2534;};'use strict';var util=require('util');var _=require(_0x997a('0x0'));var jayson=require('jayson/promise');var qs=require(_0x997a('0x1'));var logger=require(_0x997a('0x2'))(_0x997a('0x3'));var db=require(_0x997a('0x4'))['db'];var amiClient=jayson[_0x997a('0x5')]['http']({'port':0x232a});var routingClient=jayson[_0x997a('0x5')][_0x997a('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x2911b4,_0x146788){return function(_0x15067f){if(_0x15067f){var _0x4c0195=typeof _0x146788[_0x997a('0x7')]===_0x997a('0x8')&&typeof _0x146788['limit']===_0x997a('0x8');var _0x30f7bd=_0x15067f['count'];var _0x410bc7=_0x4c0195?0x0:_0x146788['offset'];var _0x232f2c=_0x4c0195?_0x15067f[_0x997a('0x9')]:_0x146788['offset']+_0x146788['limit'];var _0x2cc9be;if(_0x232f2c>=_0x30f7bd){_0x232f2c=_0x30f7bd;_0x2cc9be=0xc8;}else{_0x2cc9be=0xce;}_0x2911b4[_0x997a('0xa')](_0x2cc9be);return _0x2911b4[_0x997a('0xb')](_0x997a('0xc'),_0x410bc7+'-'+_0x232f2c+'/'+_0x30f7bd)[_0x997a('0xd')](_0x15067f);}return null;};}function handleError(_0x54e01f,_0x116497){_0x116497=_0x116497||0x1f4;return function(_0x1fc017){logger[_0x997a('0xe')](_0x1fc017[_0x997a('0xf')]);if(_0x1fc017['name']){delete _0x1fc017[_0x997a('0x10')];}_0x54e01f[_0x997a('0xa')](_0x116497)['send'](_0x1fc017);};}function getRealtimeAgents(){return new Promise(function(_0xf39e92,_0x445bd2){return amiClient[_0x997a('0x11')](_0x997a('0x12'),{})[_0x997a('0x13')](function(_0x22fe31){if(_0x22fe31[_0x997a('0xe')])throw new Error(_0x997a('0x14'));var _0x2a22e3=_0x22fe31[_0x997a('0x15')];return routingClient[_0x997a('0x11')]('Agents',{})[_0x997a('0x13')](function(_0x5058ac){if(_0x5058ac[_0x997a('0xe')])throw new Error(_0x997a('0x16'));var _0x4637e8=_0x5058ac[_0x997a('0x15')];return _0xf39e92(_[_0x997a('0x17')]({},_0x2a22e3,_0x4637e8));});})['catch'](function(_0x1194e7){_0x445bd2(_0x1194e7);});});}function getRealtimeQueues(_0x530889,_0x57c9a6){return new Promise(function(_0xce2f0c,_0x376aec){var _0x5df0cb=_0x57c9a6===_0x997a('0x18')?amiClient:routingClient;return _0x5df0cb[_0x997a('0x11')](_[_0x997a('0x19')](_0x57c9a6)+_0x997a('0x1a'),_0x530889)[_0x997a('0x13')](function(_0x118d77){if(_0x118d77[_0x997a('0xe')])throw new Error(util['format'](_0x997a('0x1b'),_0x57c9a6));return _0xce2f0c(_0x118d77[_0x997a('0x15')]);})[_0x997a('0x1c')](function(_0xb33228){_0x376aec(_0xb33228);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x202f72,_0x104f5a){return amiClient[_0x997a('0x11')](_0x997a('0x1d'),{})[_0x997a('0x13')](function(_0x28470f){if(_0x28470f[_0x997a('0xe')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x202f72(_0x28470f[_0x997a('0x15')]);})[_0x997a('0x1c')](function(_0x5baced){_0x104f5a(_0x5baced);});});}function initializeQueues(_0xe4809,_0x316b0a,_0x1d843c,_0x1e28cf){var _0x1f733e=[_0x997a('0x1e'),_0x997a('0x1f'),_0x997a('0x20'),_0x997a('0x21'),_0x997a('0x22')];if(_0x1d843c===_0x997a('0x18')&&_0x1e28cf===_0x997a('0x23')){_0x1f733e[_0x997a('0x24')](_0x997a('0x25'),_0x997a('0x26'),_0x997a('0x27'),_0x997a('0x28'),'dialMethod',_0x997a('0x29'),_0x997a('0x2a'),_0x997a('0x2b'),_0x997a('0x2c'),_0x997a('0x2d'),_0x997a('0x2e'),_0x997a('0x2f'),'dialPredictiveInterval',_0x997a('0x30'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0x997a('0x31'),_0x997a('0x32'),'predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0x997a('0x33'),_0x997a('0x34'));}return _0xe4809[_0x997a('0x35')](function(_0x15618e){var _0x3dcb82=_0x15618e[_0x997a('0x36')]({'plain':!![]});_0x3dcb82[_0x997a('0x37')]=[];_0x3dcb82[_0x997a('0x22')]=0x0;_0x3dcb82[_0x997a('0x38')]=0x0;_0x3dcb82[_0x997a('0x1e')]=0x0;_0x3dcb82[_0x997a('0x1f')]=0x0;_0x3dcb82['waiting']=0x0;if(_0x1d843c===_0x997a('0x18')){_0x3dcb82[_0x997a('0x21')]=0x0;_0x3dcb82[_0x997a('0x39')]=0x0;if(_0x1e28cf===_0x997a('0x23')){_0x3dcb82['pTalking']=0x0;_0x3dcb82[_0x997a('0x26')]=0x0;}}var _0x33cbfb=_[_0x997a('0x3a')](_0x316b0a,['id',_0x3dcb82['id']]);if(_0x33cbfb)_['merge'](_0x3dcb82,_[_0x997a('0x3b')](_0x33cbfb,_0x1f733e));return _0x3dcb82;});}function updateAgentVoiceStatus(_0x14aa3a,_0x14cc1c,_0x4ac921){var _0x52d069=_['filter'](_0x4ac921,['queue',_0x14cc1c[_0x997a('0x10')]]);if(_0x52d069[_0x997a('0x3c')]===0x0)return _0x14aa3a['busy']=!![];if(_['some'](_0x52d069,[_0x997a('0x3d'),_0x14aa3a[_0x997a('0x3e')][_0x997a('0x3f')]()]))return _0x14aa3a[_0x997a('0x21')]=!![];if(!_0x14aa3a[_0x997a('0x21')])return _0x14aa3a[_0x997a('0x39')]=!![];}function getVoiceQueueAgents(_0x20b1ff,_0x47cf5f,_0x39014c,_0x43a680){var _0x137325=_[_0x997a('0x3a')](_0x47cf5f,['id',_0x20b1ff['id']]);if(!_0x137325)return _0x20b1ff;return _0x137325[_0x997a('0x40')]({'raw':!![]})[_0x997a('0x13')](function(_0x112499){for(var _0x450037=0x0;_0x450037<_0x112499[_0x997a('0x3c')];_0x450037++){var _0x3047d4=_['find'](_0x39014c,['id',_0x112499[_0x450037][_0x997a('0x41')]]);if(!_0x3047d4){_0x3047d4={'id':_0x112499[_0x450037][_0x997a('0x41')],'name':_0x112499[_0x450037]['UserId'],'accountcode':'','online':![]};}var _0x4c9e57={'id':_0x3047d4['id'],'name':_0x3047d4[_0x997a('0x10')],'internal':_0x3047d4[_0x997a('0x42')],'online':Boolean(_0x3047d4[_0x997a('0x43')]),'paused':Boolean(_0x112499[_0x450037][_0x997a('0x22')])};if(_0x3047d4[_0x997a('0x44')]===_0x997a('0x21'))updateAgentVoiceStatus(_0x4c9e57,_0x20b1ff,_0x43a680);if(_0x4c9e57['online'])_0x20b1ff['loggedInDb']++;if(_0x4c9e57[_0x997a('0x39')])_0x20b1ff[_0x997a('0x39')]++;if(_0x4c9e57['paused']&&!_0x4c9e57['busy']&&!_0x4c9e57[_0x997a('0x21')])_0x20b1ff[_0x997a('0x22')]++;_0x20b1ff[_0x997a('0x37')][_0x997a('0x24')](_0x4c9e57);}return _0x20b1ff;});}function getQueueAgents(_0x2f73ed,_0x1f9a14,_0x539cae){var _0x573a30=_0x997a('0x45')+_['startCase'](_0x539cae)+'Queue';var _0x3bbfb5=_0x539cae+'Pause';return db[_0x573a30][_0x997a('0x46')]({'where':{[_[_0x997a('0x19')](_0x539cae)+_0x997a('0x47')]:_0x2f73ed['id']},'raw':!![]})[_0x997a('0x13')](function(_0x34dbca){for(var _0x1f621f=0x0;_0x1f621f<_0x34dbca[_0x997a('0x3c')];_0x1f621f++){var _0x3608a1=_[_0x997a('0x3a')](_0x1f9a14,['id',_0x34dbca[_0x1f621f][_0x997a('0x41')]]);if(!_0x3608a1){_0x3608a1={'id':_0x34dbca[_0x1f621f][_0x997a('0x41')],'name':_0x34dbca[_0x1f621f][_0x997a('0x41')],'online':![],['pauseField']:![]};}var _0x37aed9={'id':_0x3608a1['id'],'name':_0x3608a1[_0x997a('0x10')],'online':Boolean(_0x3608a1[_0x997a('0x43')]),'paused':Boolean(_0x3608a1[_0x3bbfb5])};if(_0x37aed9[_0x997a('0x43')])_0x2f73ed[_0x997a('0x38')]++;_0x2f73ed[_0x997a('0x37')][_0x997a('0x24')](_0x37aed9);}return _0x2f73ed;});}function isIdle(_0x4ef809){return _0x4ef809===_0x997a('0x48')||_0x4ef809===_0x997a('0x49')||_0x4ef809===_0x997a('0x4a')||_0x4ef809===_0x997a('0x4b')||_[_0x997a('0x4c')](_0x4ef809);}function isAgentPaused(_0x2f3a57,_0x2adb72){var _0x5b58d9=[_0x2f3a57['chatPause'],_0x2f3a57[_0x997a('0x4d')],_0x2f3a57[_0x997a('0x4e')],_0x2f3a57[_0x997a('0x4f')],_0x2f3a57['smsPause'],_0x2f3a57[_0x997a('0x50')],_0x2f3a57[_0x997a('0x51')]];if(!_0x2adb72)return _[_0x997a('0x52')](_0x5b58d9);var _0x7376e3=_['filter'](_0x5b58d9);return _0x7376e3[_0x997a('0x3c')]>0x0&&_0x7376e3[_0x997a('0x3c')]<_0x5b58d9[_0x997a('0x3c')]?!![]:![];}function isAgentIdle(_0x455e55){if(_0x455e55[_0x997a('0x44')]!=='idle'&&_0x455e55[_0x997a('0x50')]){_0x455e55['voiceStatus']='pause';return![];}return _[_0x997a('0x52')]([_0x455e55['chatStatus'],_0x455e55['faxStatus'],_0x455e55[_0x997a('0x53')],_0x455e55[_0x997a('0x54')],_0x455e55[_0x997a('0x55')],_0x455e55[_0x997a('0x44')],_0x455e55[_0x997a('0x56')]],isIdle);}function getAgentStatus(_0x1b42bc){var _0x1084f3='unknown';if(isAgentPaused(_0x1b42bc))_0x1084f3='pause';else if(isAgentPaused(_0x1b42bc,!![]))_0x1084f3=_0x997a('0x57');else if(isAgentIdle(_0x1b42bc))_0x1084f3=_0x997a('0x48');else _0x1084f3='busy';return _0x1084f3;}function validateChannel(_0x18a904){var _0x29fb0d=['mail','chat',_0x997a('0x58'),'openchannel',_0x997a('0x59'),'whatsapp',_0x997a('0x18')];if(!_[_0x997a('0x5a')](_0x29fb0d,_0x18a904[_0x997a('0x5b')]()))throw new Error(_0x997a('0x5c'));return _0x18a904[_0x997a('0x5b')]();}function getFilteredAgentIds(_0x2765ff,_0x559dd1){var _0x49b9a1=_[_0x997a('0x5d')](_0x2765ff)?_0x2765ff:[_0x2765ff];var _0x460669=_[_0x997a('0x35')](_0x49b9a1,function(_0x134ae0){return db[_0x559dd1][_0x997a('0x5e')]({'where':{'name':_0x134ae0}})[_0x997a('0x13')](function(_0x5b25c6){if(!_0x5b25c6)return[];return _0x5b25c6[_0x997a('0x5f')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x997a('0x60')](_0x460669)[_0x997a('0x13')](function(_0x449fa6){var _0x1149f9=_(_0x449fa6)[_0x997a('0x61')]()[_0x997a('0x35')]('id')[_0x997a('0x62')]()[_0x997a('0x63')]();return _0x1149f9;});}function getUpdatedSortOptions(_0xb3e878){var _0x2623e0={'fields':[],'order':null};var _0x2ff2d6=_0xb3e878[_0x997a('0x64')](',');_0x2623e0['fields']=_[_0x997a('0x65')](_0x2ff2d6,function(_0x1ac668){if(!_0x1ac668[_0x997a('0x5a')]('globalStatus'))return!![];_0x2623e0[_0x997a('0x66')]=_[_0x997a('0x67')](_0x1ac668,'-')?_0x997a('0x68'):'ASC';return![];});return _0x2623e0;}function orderAgentsByStatus(_0x292dbd,_0x5b87d0){return _0x292dbd[_0x997a('0x69')](function(_0xdf98b5,_0x158156){if(_0xdf98b5[_0x997a('0x6a')]===_0x158156[_0x997a('0x6a')]&&_0xdf98b5[_0x997a('0x6a')]===_0x997a('0x6b')){if(_0x5b87d0===_0x997a('0x68'))return(_0xdf98b5[_0x997a('0x6c')]||'')<(_0x158156[_0x997a('0x6c')]||'')?0x1:-0x1;return _0xdf98b5[_0x997a('0x6c')]<_0x158156[_0x997a('0x6c')]?-0x1:0x1;}else{if(_0x5b87d0==='DESC')return _0xdf98b5['globalStatus']<_0x158156[_0x997a('0x6a')]?0x1:-0x1;return _0xdf98b5['globalStatus']<_0x158156[_0x997a('0x6a')]?-0x1:0x1;}});}exports[_0x997a('0x5f')]=function(_0x143321,_0x55de2a){var _0xbd4917={'count':0x0,'rows':[]},_0x19ecf6={},_0x47b4dc,_0x4fe7c6,_0x3043f9,_0x4ce316,_0x2a72d6=['userpic',_0x997a('0x43'),'lastLoginAt',_0x997a('0x6d'),_0x997a('0x6c'),_0x997a('0x6d'),_0x997a('0x3e'),_0x997a('0x6e'),_0x997a('0x6f'),_0x997a('0x4f'),_0x997a('0x4e'),_0x997a('0x70'),_0x997a('0x51'),_0x997a('0x4d'),_0x997a('0x50'),_0x997a('0x71'),_0x997a('0x72'),_0x997a('0x73'),'smsCapacity','whatsappCapacity',_0x997a('0x74'),'chatCurrentCapacity',_0x997a('0x75'),_0x997a('0x76'),'smsCurrentCapacity','whatsappCurrentCapacity',_0x997a('0x77'),_0x997a('0x78'),_0x997a('0x54'),'mailStatus','smsStatus',_0x997a('0x56'),_0x997a('0x79'),'voiceStatus',_0x997a('0x7a'),_0x997a('0x7b'),_0x997a('0x7c'),_0x997a('0x7d'),_0x997a('0x7e'),_0x997a('0x7f'),_0x997a('0x80'),_0x997a('0x81'),_0x997a('0x82'),_0x997a('0x83'),_0x997a('0x84'),_0x997a('0x85'),_0x997a('0x86')],_0x12e81d=['chatPause',_0x997a('0x4f'),_0x997a('0x4e'),_0x997a('0x70'),_0x997a('0x51'),_0x997a('0x4d'),_0x997a('0x50'),_0x997a('0x43')];Promise[_0x997a('0x87')]()['then'](function(){if(_0x143321['query'][_0x997a('0x88')])_0x47b4dc=validateChannel(_0x143321[_0x997a('0x89')]['channel']);if(!_0x143321[_0x997a('0x89')][_0x997a('0x69')]||!_0x143321[_0x997a('0x89')][_0x997a('0x69')][_0x997a('0x5a')](_0x997a('0x6a')))return;var _0x16ff18=getUpdatedSortOptions(_0x143321[_0x997a('0x89')]['sort']);_0x143321[_0x997a('0x89')][_0x997a('0x69')]=_0x16ff18[_0x997a('0x8a')][_0x997a('0x8b')](',');_0x4fe7c6=_0x16ff18[_0x997a('0x66')];})[_0x997a('0x13')](function(){if(!_0x143321[_0x997a('0x89')][_0x997a('0x8c')])return[];var _0xedc363=_['startCase'](_0x47b4dc)+_0x997a('0x8d');return getFilteredAgentIds(_0x143321[_0x997a('0x89')][_0x997a('0x8c')],_0xedc363);})[_0x997a('0x13')](function(_0x411bf5){var _0x2d58de=_['map'](db[_0x997a('0x45')][_0x997a('0x8e')],function(_0x56b223){return{'name':_0x56b223[_0x997a('0x8f')],'type':_0x56b223[_0x997a('0x90')][_0x997a('0x91')]};});_0x143321[_0x997a('0x89')][_0x997a('0x92')]='agent';_0x143321[_0x997a('0x89')]['online']=!![];_0x19ecf6=qs[_0x997a('0x93')](_0x2d58de,_0x143321);_0x19ecf6[_0x997a('0x94')]=!![];if(!_[_0x997a('0x95')](_0x411bf5)){_0x19ecf6[_0x997a('0x96')]=_[_0x997a('0x17')](_0x19ecf6[_0x997a('0x96')],{'$and':[{'id':{'$in':_0x411bf5}}]});}else if(!_[_0x997a('0x95')](_0x143321[_0x997a('0x89')][_0x997a('0x8c')])){return _0xbd4917;}if(_0x143321[_0x997a('0x97')][_0x997a('0x92')]===_0x997a('0x97')){var _0x3d9bc9={'params':{'id':_0x143321[_0x997a('0x97')][_0x997a('0x98')]},'query':{'section':_0x997a('0x12'),'role':_0x997a('0x99'),'online':!![],'nolimit':_0x143321['query']['nolimit'],'sort':_0x143321['query'][_0x997a('0x69')],'filter':_0x143321['query']['filter'],'raw':!![],'ids':_0x411bf5}};return db['UserProfile']['getResources'](_0x3d9bc9);}return db[_0x997a('0x45')][_0x997a('0x9a')](_0x19ecf6);})['then'](function(_0x2a9684){_0xbd4917[_0x997a('0x9')]=_0x2a9684['count'];_0x3043f9=_0x2a9684['rows'];return getRealtimeAgents();})[_0x997a('0x13')](function(_0x55d99e){_0x4ce316=_0x55d99e['rows'];return _0x3043f9[_0x997a('0x35')](function(_0x6c1581){var _0x59b3c2=_['find'](_0x4ce316,['id',_0x6c1581['id']]);if(_0x59b3c2)_[_0x997a('0x17')](_0x6c1581,_[_0x997a('0x3b')](_[_0x997a('0x9b')](_0x59b3c2,_0x12e81d),_0x2a72d6));_0x6c1581[_0x997a('0x6a')]=getAgentStatus(_0x6c1581);return _0x6c1581;});})['then'](function(_0x5b192f){var _0x142737;if(_0x143321[_0x997a('0x89')][_0x997a('0x9c')]){_0x142737=_[_0x997a('0x65')](_0x5b192f,['globalStatus',_0x143321[_0x997a('0x89')]['globalStatusFilter']]);if(_0x143321[_0x997a('0x89')][_0x997a('0x9d')]){_0x142737=_[_0x997a('0x65')](_0x142737,['pauseType',_0x143321[_0x997a('0x89')][_0x997a('0x9d')]]);}}if(_0x142737)_0x5b192f=_0x142737;if(!_0x4fe7c6)return _0x5b192f;return orderAgentsByStatus(_0x5b192f,_0x4fe7c6);})['then'](function(_0x2c467c){_0xbd4917[_0x997a('0x9e')]=_0x2c467c;return _0xbd4917;})[_0x997a('0x13')](respondWithFilteredResult(_0x55de2a,_0x19ecf6))[_0x997a('0x1c')](handleError(_0x55de2a,null));};exports[_0x997a('0x9f')]=function(_0x21e4bb,_0xb9b3ec){var _0x4804df={'count':0x0,'rows':[]},_0x4812b7={},_0x1ff92e,_0x30245c,_0x2da8c8,_0x16e91e,_0x32c329;Promise['resolve']()[_0x997a('0x13')](function(){if(_0x21e4bb[_0x997a('0x89')][_0x997a('0x88')])_0x1ff92e=validateChannel(_0x21e4bb[_0x997a('0x89')][_0x997a('0x88')]);var _0x490c79=_[_0x997a('0x19')](_0x1ff92e)+'Queue';var _0x35d2e7=_[_0x997a('0x35')](db[_0x490c79][_0x997a('0x8e')],function(_0x122e65){return{'name':_0x122e65['fieldName'],'type':_0x122e65['type']['key']};});_0x4812b7=qs[_0x997a('0x93')](_0x35d2e7,_0x21e4bb);if(_0x21e4bb[_0x997a('0x97')][_0x997a('0x92')]===_0x997a('0x97')){var _0x4f47a9={'params':{'id':_0x21e4bb[_0x997a('0x97')][_0x997a('0x98')]},'query':{'section':_0x1ff92e==='voice'&&_0x21e4bb['query'][_0x997a('0x90')]===_0x997a('0x23')?_0x997a('0xa0'):_[_0x997a('0x19')](_0x1ff92e)+_0x997a('0x1a'),'type':_0x21e4bb['query']['type'],'nolimit':!![],'sort':_0x997a('0x10'),'filter':_0x21e4bb[_0x997a('0x89')]['filter']}};return db[_0x997a('0xa1')][_0x997a('0xa2')](_0x4f47a9);}return db[_0x490c79][_0x997a('0x9a')](_0x4812b7);})[_0x997a('0x13')](function(_0x2e089b){_0x4804df[_0x997a('0x9')]=_0x2e089b[_0x997a('0x9')];_0x30245c=_0x2e089b['rows'];return getRealtimeQueues(_0x21e4bb,_0x1ff92e);})[_0x997a('0x13')](function(_0x4a119d){_0x16e91e=_0x4a119d[_0x997a('0x9e')];return getRealtimeAgents();})['then'](function(_0x58d557){_0x2da8c8=_0x58d557[_0x997a('0x9e')];if(_0x1ff92e!='voice')return;return getRealtimeVoiceQueueChannels();})[_0x997a('0x13')](function(_0x4a80c1){_0x32c329=_0x4a80c1?_0x4a80c1[_0x997a('0x9e')]:[];return initializeQueues(_0x30245c,_0x16e91e,_0x1ff92e,_0x21e4bb['query'][_0x997a('0x90')]);})[_0x997a('0x13')](function(_0x91b2dd){var _0x18d49b=_0x91b2dd[_0x997a('0x35')](function(_0x31398e){if(_0x1ff92e===_0x997a('0x18'))return getVoiceQueueAgents(_0x31398e,_0x30245c,_0x2da8c8,_0x32c329);else return getQueueAgents(_0x31398e,_0x2da8c8,_0x1ff92e);});return Promise['all'](_0x18d49b);})['then'](function(_0xe4cddb){_0x4804df[_0x997a('0x9e')]=_0xe4cddb;return _0x4804df;})['then'](respondWithFilteredResult(_0xb9b3ec,_0x4812b7))['catch'](handleError(_0xb9b3ec,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 0aa72d9..03b07f4 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3b729e,_0x4c7341){var _0x281539=function(_0x578957){while(--_0x578957){_0x3b729e['push'](_0x3b729e['shift']());}};_0x281539(++_0x4c7341);}(_0xe706,0xa3));var _0x6e70=function(_0x38a792,_0x5a21a5){_0x38a792=_0x38a792-0x0;var _0x2cee7b=_0xe706[_0x38a792];return _0x2cee7b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 79a94ce..569ac96 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 _0x3dd6=['STRING','DATE','INTEGER'];(function(_0x59d5ad,_0x5c1173){var _0x241f56=function(_0x3ac63c){while(--_0x3ac63c){_0x59d5ad['push'](_0x59d5ad['shift']());}};_0x241f56(++_0x5c1173);}(_0x3dd6,0xcf));var _0x63dd=function(_0x2a3b3e,_0x415238){_0x2a3b3e=_0x2a3b3e-0x0;var _0x3bb5f6=_0x3dd6[_0x2a3b3e];return _0x3bb5f6;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x63dd('0x0')]},'scheduledat':{'type':Sequelize[_0x63dd('0x1')]},'uniqueid':{'type':Sequelize[_0x63dd('0x0')]},'starttime':{'type':Sequelize[_0x63dd('0x1')]},'responsetime':{'type':Sequelize[_0x63dd('0x1')]},'ringtime':{'type':Sequelize[_0x63dd('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x63dd('0x0')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe14b=['exports','DATE','STRING','sequelize'];(function(_0x2af053,_0x4f6d28){var _0x4b4001=function(_0x9200c1){while(--_0x9200c1){_0x2af053['push'](_0x2af053['shift']());}};_0x4b4001(++_0x4f6d28);}(_0xe14b,0x93));var _0xbe14=function(_0x26bc18,_0x533495){_0x26bc18=_0x26bc18-0x0;var _0x34798e=_0xe14b[_0x26bc18];return _0x34798e;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xbe14('0x2')]},'uniqueid':{'type':Sequelize[_0xbe14('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xbe14('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xbe14('0x3')]},'membername':{'type':Sequelize[_0xbe14('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 576b712..2c7b106 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 _0x5d54=['api','moment','bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5d54,0x183));var _0x45d5=function(_0x395155,_0x192ffd){_0x395155=_0x395155-0x0;var _0x179767=_0x5d54[_0x395155];return _0x179767;};'use strict';var _=require(_0x45d5('0x0'));var util=require(_0x45d5('0x1'));var logger=require(_0x45d5('0x2'))(_0x45d5('0x3'));var moment=require(_0x45d5('0x4'));var BPromise=require(_0x45d5('0x5'));var rp=require(_0x45d5('0x6'));var fs=require('fs');var path=require(_0x45d5('0x7'));var rimraf=require(_0x45d5('0x8'));var config=require('../../config/environment');var attributes=require(_0x45d5('0x9'));module[_0x45d5('0xa')]=function(_0x41cde2,_0x3a6d5b){return _0x41cde2['define'](_0x45d5('0xb'),attributes,{'tableName':_0x45d5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x067a=['../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x067a,0x84));var _0xa067=function(_0x10d231,_0x55cd8a){_0x10d231=_0x10d231-0x0;var _0xceed5=_0x067a[_0x10d231];return _0xceed5;};'use strict';var _=require(_0xa067('0x0'));var util=require('util');var logger=require(_0xa067('0x1'))(_0xa067('0x2'));var moment=require(_0xa067('0x3'));var BPromise=require(_0xa067('0x4'));var rp=require(_0xa067('0x5'));var fs=require('fs');var path=require(_0xa067('0x6'));var rimraf=require(_0xa067('0x7'));var config=require(_0xa067('0x8'));var attributes=require(_0xa067('0x9'));module[_0xa067('0xa')]=function(_0x5f25b4,_0x3049d1){return _0x5f25b4[_0xa067('0xb')](_0xa067('0xc'),attributes,{'tableName':_0xa067('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index e23bbfe..c241bfa 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 _0xf05d=['info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then'];(function(_0x12e037,_0x5c8a8a){var _0x564f67=function(_0x188900){while(--_0x188900){_0x12e037['push'](_0x12e037['shift']());}};_0x564f67(++_0x5c8a8a);}(_0xf05d,0x16d));var _0xdf05=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf05d[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xdf05('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdf05('0x1'));var rs=require(_0xdf05('0x2'));var fs=require('fs');var Redis=require(_0xdf05('0x3'));var db=require(_0xdf05('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf05('0x5'))(_0xdf05('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdf05('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x251a63,_0x2e8347,_0x230ccb){return new BPromise(function(_0x2ccdfa,_0x2bd29e){return client[_0xdf05('0x8')](_0x251a63,_0x230ccb)[_0xdf05('0x9')](function(_0x1e692a){logger[_0xdf05('0xa')](_0xdf05('0xb'),_0x2e8347,_0xdf05('0xc'));logger[_0xdf05('0xd')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x2e8347,_0xdf05('0xc'),JSON[_0xdf05('0xe')](_0x1e692a));if(_0x1e692a[_0xdf05('0xf')]){if(_0x1e692a['error'][_0xdf05('0x10')]===0x1f4){logger[_0xdf05('0xf')](_0xdf05('0xb'),_0x2e8347,_0x1e692a['error'][_0xdf05('0x11')]);return _0x2bd29e(_0x1e692a[_0xdf05('0xf')][_0xdf05('0x11')]);}logger[_0xdf05('0xf')](_0xdf05('0xb'),_0x2e8347,_0x1e692a[_0xdf05('0xf')][_0xdf05('0x11')]);return _0x2ccdfa(_0x1e692a[_0xdf05('0xf')][_0xdf05('0x11')]);}else{logger[_0xdf05('0xa')](_0xdf05('0xb'),_0x2e8347,_0xdf05('0xc'));_0x2ccdfa(_0x1e692a[_0xdf05('0x12')][_0xdf05('0x11')]);}})[_0xdf05('0x13')](function(_0x4f75b6){logger[_0xdf05('0xf')](_0xdf05('0xb'),_0x2e8347,_0x4f75b6);_0x2bd29e(_0x4f75b6);});});}exports[_0xdf05('0x14')]=function(_0x452859){var _0x2f3dc9=this;return new Promise(function(_0x35ab53,_0x403a10){return db[_0xdf05('0x15')]['create'](_0x452859[_0xdf05('0x16')],{'raw':_0x452859['options']?_0x452859[_0xdf05('0x17')][_0xdf05('0x18')]===undefined?!![]:![]:!![]})[_0xdf05('0x9')](function(_0x5f0fb4){logger[_0xdf05('0xa')]('CreateReportAgentPreview',_0x452859);logger[_0xdf05('0xd')](_0xdf05('0x14'),_0x452859,JSON[_0xdf05('0xe')](_0x5f0fb4));_0x35ab53(_0x5f0fb4);})[_0xdf05('0x13')](function(_0x2021bd){logger[_0xdf05('0xf')](_0xdf05('0x14'),_0x2021bd[_0xdf05('0x11')],_0x452859);_0x403a10(_0x2f3dc9[_0xdf05('0xf')](0x1f4,_0x2021bd[_0xdf05('0x11')]));});});}; \ No newline at end of file +var _0xf448=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','debug'];(function(_0x4568bc,_0x19ff13){var _0x50c5bb=function(_0x5d6b16){while(--_0x5d6b16){_0x4568bc['push'](_0x4568bc['shift']());}};_0x50c5bb(++_0x19ff13);}(_0xf448,0x186));var _0x8f44=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0xf448[_0x2d486b];return _0x4291d1;};'use strict';var _=require(_0x8f44('0x0'));var util=require(_0x8f44('0x1'));var moment=require('moment');var BPromise=require(_0x8f44('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f44('0x3'));var db=require(_0x8f44('0x4'))['db'];var utils=require(_0x8f44('0x5'));var logger=require('../../config/logger')(_0x8f44('0x6'));var config=require(_0x8f44('0x7'));var jayson=require(_0x8f44('0x8'));var client=jayson[_0x8f44('0x9')][_0x8f44('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x222aa0,_0x396e8c,_0x5093fd){return new BPromise(function(_0x222395,_0x36b3f3){return client['request'](_0x222aa0,_0x5093fd)[_0x8f44('0xb')](function(_0x38b158){logger[_0x8f44('0xc')](_0x8f44('0xd'),_0x396e8c,'request\x20sent');logger[_0x8f44('0xe')](_0x8f44('0xf'),_0x396e8c,_0x8f44('0x10'),JSON[_0x8f44('0x11')](_0x38b158));if(_0x38b158['error']){if(_0x38b158[_0x8f44('0x12')]['code']===0x1f4){logger[_0x8f44('0x12')](_0x8f44('0xd'),_0x396e8c,_0x38b158[_0x8f44('0x12')][_0x8f44('0x13')]);return _0x36b3f3(_0x38b158[_0x8f44('0x12')][_0x8f44('0x13')]);}logger[_0x8f44('0x12')](_0x8f44('0xd'),_0x396e8c,_0x38b158[_0x8f44('0x12')]['message']);return _0x222395(_0x38b158[_0x8f44('0x12')]['message']);}else{logger[_0x8f44('0xc')](_0x8f44('0xd'),_0x396e8c,_0x8f44('0x10'));_0x222395(_0x38b158['result'][_0x8f44('0x13')]);}})['catch'](function(_0x2f0df1){logger[_0x8f44('0x12')](_0x8f44('0xd'),_0x396e8c,_0x2f0df1);_0x36b3f3(_0x2f0df1);});});}exports[_0x8f44('0x14')]=function(_0x23aa81){var _0x2510fc=this;return new Promise(function(_0x3fb1de,_0x514827){return db[_0x8f44('0x15')][_0x8f44('0x16')](_0x23aa81[_0x8f44('0x17')],{'raw':_0x23aa81[_0x8f44('0x18')]?_0x23aa81[_0x8f44('0x18')][_0x8f44('0x19')]===undefined?!![]:![]:!![]})[_0x8f44('0xb')](function(_0xf22606){logger['info']('CreateReportAgentPreview',_0x23aa81);logger[_0x8f44('0xe')](_0x8f44('0x14'),_0x23aa81,JSON[_0x8f44('0x11')](_0xf22606));_0x3fb1de(_0xf22606);})[_0x8f44('0x1a')](function(_0xfa9180){logger[_0x8f44('0x12')](_0x8f44('0x14'),_0xfa9180['message'],_0x23aa81);_0x514827(_0x2510fc[_0x8f44('0x12')](0x1f4,_0xfa9180[_0x8f44('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 483b546..f442c52 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 _0xf94c=['openchannel','showOpenchannelQueues','/sms/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','express','Router','../../components/auth/service','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outboundChannels','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','chatQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify'];(function(_0x43f048,_0x1c7bfd){var _0x1bc4dc=function(_0x3cc360){while(--_0x3cc360){_0x43f048['push'](_0x43f048['shift']());}};_0x1bc4dc(++_0x1c7bfd);}(_0xf94c,0xa6));var _0xcf94=function(_0x238466,_0x25909e){_0x238466=_0x238466-0x0;var _0x4a90a5=_0xf94c[_0x238466];return _0x4a90a5;};'use strict';var multer=require(_0xcf94('0x0'));var util=require('util');var path=require('path');var express=require(_0xcf94('0x1'));var router=express[_0xcf94('0x2')]();var auth=require(_0xcf94('0x3'));var controller=require('./rpc.controller');router[_0xcf94('0x4')](_0xcf94('0x5'),auth['isAuthenticated'](),controller['voiceChannels']);router['get'](_0xcf94('0x6'),auth[_0xcf94('0x7')](),controller['voiceChannelMixMonitor']);router[_0xcf94('0x4')](_0xcf94('0x8'),auth[_0xcf94('0x7')](),controller[_0xcf94('0x9')]);router[_0xcf94('0x4')](_0xcf94('0xa'),auth['isAuthenticated'](),controller[_0xcf94('0xb')]);router[_0xcf94('0x4')](_0xcf94('0xc'),auth[_0xcf94('0x7')](),controller[_0xcf94('0xd')]);router[_0xcf94('0x4')](_0xcf94('0xe'),auth[_0xcf94('0x7')](),controller[_0xcf94('0xf')]);router['get']('/mail/accounts',auth[_0xcf94('0x7')](),controller[_0xcf94('0x10')]);router['get']('/openchannel/queues',auth[_0xcf94('0x7')](),controller[_0xcf94('0x11')]);router[_0xcf94('0x4')](_0xcf94('0x12'),auth[_0xcf94('0x7')](),controller[_0xcf94('0x13')]);router[_0xcf94('0x4')](_0xcf94('0x14'),auth[_0xcf94('0x7')](),controller[_0xcf94('0x15')]);router[_0xcf94('0x4')]('/fax/queues',auth['isAuthenticated'](),controller[_0xcf94('0x16')]);router[_0xcf94('0x4')](_0xcf94('0x17'),auth['isAuthenticated'](),controller[_0xcf94('0x18')]);router[_0xcf94('0x4')]('/voice/queues/channels',auth['isAuthenticated'](),controller[_0xcf94('0x19')]);router['get'](_0xcf94('0x1a'),auth[_0xcf94('0x7')](),controller[_0xcf94('0x1b')]);router[_0xcf94('0x4')](_0xcf94('0x1c'),auth[_0xcf94('0x7')](),controller['voiceQueuesChannelHangup']);router[_0xcf94('0x4')](_0xcf94('0x1d'),auth[_0xcf94('0x7')](),controller[_0xcf94('0x1e')]);router[_0xcf94('0x4')]('/voice/queues/:id',auth[_0xcf94('0x7')](),controller[_0xcf94('0x1f')]);router[_0xcf94('0x20')](_0xcf94('0x21'),auth['isAuthenticated'](),controller[_0xcf94('0x22')]);router[_0xcf94('0x4')](_0xcf94('0x23'),auth['isAuthenticated'](),controller['outbound']);router[_0xcf94('0x4')]('/outbound/channels',auth[_0xcf94('0x7')](),controller[_0xcf94('0x24')]);router[_0xcf94('0x4')]('/agents',auth[_0xcf94('0x7')](),controller['agents']);router[_0xcf94('0x20')]('/agents/:id/capacity',auth[_0xcf94('0x7')](),controller[_0xcf94('0x25')]);router['get'](_0xcf94('0x26'),auth[_0xcf94('0x7')](),controller['telephones']);router[_0xcf94('0x4')](_0xcf94('0x27'),auth[_0xcf94('0x7')](),controller[_0xcf94('0x28')]);router[_0xcf94('0x4')](_0xcf94('0x29'),auth[_0xcf94('0x7')](),controller[_0xcf94('0x2a')]);router[_0xcf94('0x4')](_0xcf94('0x2b'),auth[_0xcf94('0x7')](),controller['faxAccounts']);router[_0xcf94('0x4')]('/chat/queues/waitinginteractions',auth[_0xcf94('0x7')](),controller[_0xcf94('0x2c')]);router[_0xcf94('0x4')]('/mail/queues/waitinginteractions',auth[_0xcf94('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0xcf94('0x4')](_0xcf94('0x2d'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0xcf94('0x2e'),auth[_0xcf94('0x7')](),controller[_0xcf94('0x2f')]);router[_0xcf94('0x4')](_0xcf94('0x30'),auth[_0xcf94('0x7')](),controller[_0xcf94('0x31')]);router[_0xcf94('0x4')](_0xcf94('0x32'),auth[_0xcf94('0x7')](),controller[_0xcf94('0x33')]);router['get'](_0xcf94('0x34'),auth[_0xcf94('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0xcf94('0x35')](_0xcf94('0x36'),auth['isAuthenticated'](),controller[_0xcf94('0x37')](_0xcf94('0x38')));router[_0xcf94('0x4')](_0xcf94('0x39'),auth[_0xcf94('0x7')](),controller[_0xcf94('0x3a')]);router[_0xcf94('0x35')](_0xcf94('0x3b'),auth[_0xcf94('0x7')](),controller[_0xcf94('0x37')](_0xcf94('0x3c')));router[_0xcf94('0x4')](_0xcf94('0x3d'),auth['isAuthenticated'](),controller[_0xcf94('0x3e')]);router[_0xcf94('0x35')](_0xcf94('0x3f'),auth['isAuthenticated'](),controller[_0xcf94('0x37')](_0xcf94('0x40')));router['get'](_0xcf94('0x41'),auth[_0xcf94('0x7')](),controller[_0xcf94('0x42')]);router[_0xcf94('0x35')](_0xcf94('0x43'),auth['isAuthenticated'](),controller['queueNotify'](_0xcf94('0x44')));router[_0xcf94('0x4')]('/openchannel/queues/:id',auth[_0xcf94('0x7')](),controller[_0xcf94('0x45')]);router[_0xcf94('0x35')](_0xcf94('0x46'),auth[_0xcf94('0x7')](),controller[_0xcf94('0x37')]('sms'));router[_0xcf94('0x35')]('/whatsapp/queues/:id/notify',auth[_0xcf94('0x7')](),controller[_0xcf94('0x37')](_0xcf94('0x47')));router[_0xcf94('0x4')](_0xcf94('0x48'),auth[_0xcf94('0x7')](),controller[_0xcf94('0x49')]);router['get']('/whatsapp/queues/:id',auth[_0xcf94('0x7')](),controller[_0xcf94('0x4a')]);router[_0xcf94('0x35')](_0xcf94('0x4b'),auth[_0xcf94('0x7')](),controller[_0xcf94('0x4c')]);module[_0xcf94('0x4d')]=router; \ No newline at end of file +var _0x25e9=['/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','/voice/queues','voiceQueues','/chat/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0x25e9,0x1a3));var _0x925e=function(_0x11a287,_0x57df55){_0x11a287=_0x11a287-0x0;var _0x111e64=_0x25e9[_0x11a287];return _0x111e64;};'use strict';var multer=require(_0x925e('0x0'));var util=require(_0x925e('0x1'));var path=require(_0x925e('0x2'));var express=require(_0x925e('0x3'));var router=express[_0x925e('0x4')]();var auth=require(_0x925e('0x5'));var controller=require(_0x925e('0x6'));router[_0x925e('0x7')](_0x925e('0x8'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0x925e('0x7')](_0x925e('0x9'),auth[_0x925e('0xa')](),controller['voiceChannelMixMonitor']);router[_0x925e('0x7')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router['get'](_0x925e('0xb'),auth[_0x925e('0xa')](),controller[_0x925e('0xc')]);router['get'](_0x925e('0xd'),auth[_0x925e('0xa')](),controller['chatQueues']);router[_0x925e('0x7')]('/mail/queues',auth[_0x925e('0xa')](),controller['mailQueues']);router[_0x925e('0x7')](_0x925e('0xe'),auth[_0x925e('0xa')](),controller[_0x925e('0xf')]);router['get'](_0x925e('0x10'),auth[_0x925e('0xa')](),controller[_0x925e('0x11')]);router[_0x925e('0x7')](_0x925e('0x12'),auth['isAuthenticated'](),controller[_0x925e('0x13')]);router['get']('/whatsapp/queues',auth[_0x925e('0xa')](),controller[_0x925e('0x14')]);router['get'](_0x925e('0x15'),auth[_0x925e('0xa')](),controller[_0x925e('0x16')]);router['get'](_0x925e('0x17'),auth['isAuthenticated'](),controller[_0x925e('0x18')]);router[_0x925e('0x7')](_0x925e('0x19'),auth['isAuthenticated'](),controller[_0x925e('0x1a')]);router[_0x925e('0x7')](_0x925e('0x1b'),auth[_0x925e('0xa')](),controller['voiceQueuesChannel']);router[_0x925e('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x925e('0xa')](),controller[_0x925e('0x1c')]);router[_0x925e('0x7')](_0x925e('0x1d'),auth[_0x925e('0xa')](),controller[_0x925e('0x1e')]);router[_0x925e('0x7')](_0x925e('0x1f'),auth[_0x925e('0xa')](),controller[_0x925e('0x20')]);router[_0x925e('0x21')](_0x925e('0x1f'),auth[_0x925e('0xa')](),controller[_0x925e('0x22')]);router['get'](_0x925e('0x23'),auth['isAuthenticated'](),controller['outbound']);router['get']('/outbound/channels',auth[_0x925e('0xa')](),controller[_0x925e('0x24')]);router[_0x925e('0x7')](_0x925e('0x25'),auth[_0x925e('0xa')](),controller[_0x925e('0x26')]);router['put'](_0x925e('0x27'),auth['isAuthenticated'](),controller[_0x925e('0x28')]);router['get'](_0x925e('0x29'),auth[_0x925e('0xa')](),controller['telephones']);router[_0x925e('0x7')](_0x925e('0x2a'),auth[_0x925e('0xa')](),controller['trunks']);router['get'](_0x925e('0x2b'),auth[_0x925e('0xa')](),controller['campaigns']);router[_0x925e('0x7')](_0x925e('0x2c'),auth['isAuthenticated'](),controller[_0x925e('0x2d')]);router[_0x925e('0x7')](_0x925e('0x2e'),auth[_0x925e('0xa')](),controller[_0x925e('0x2f')]);router[_0x925e('0x7')]('/mail/queues/waitinginteractions',auth[_0x925e('0xa')](),controller['mailQueuesWaitingInteractions']);router[_0x925e('0x7')](_0x925e('0x30'),auth['isAuthenticated'](),controller[_0x925e('0x31')]);router[_0x925e('0x7')]('/openchannel/queues/:id/waitinginteractions',auth[_0x925e('0xa')](),controller[_0x925e('0x32')]);router[_0x925e('0x7')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x925e('0x33')]);router[_0x925e('0x7')]('/whatsapp/queues/waitinginteractions',auth[_0x925e('0xa')](),controller['whatsappQueuesWaitingInteractions']);router[_0x925e('0x7')](_0x925e('0x34'),auth[_0x925e('0xa')](),controller[_0x925e('0x35')]);router[_0x925e('0x36')](_0x925e('0x37'),auth['isAuthenticated'](),controller[_0x925e('0x38')](_0x925e('0x39')));router[_0x925e('0x7')](_0x925e('0x3a'),auth['isAuthenticated'](),controller[_0x925e('0x3b')]);router[_0x925e('0x36')]('/chat/queues/:id/notify',auth[_0x925e('0xa')](),controller[_0x925e('0x38')](_0x925e('0x3c')));router['get'](_0x925e('0x3d'),auth[_0x925e('0xa')](),controller[_0x925e('0x3e')]);router[_0x925e('0x36')](_0x925e('0x3f'),auth[_0x925e('0xa')](),controller[_0x925e('0x38')](_0x925e('0x40')));router['get'](_0x925e('0x41'),auth['isAuthenticated'](),controller[_0x925e('0x42')]);router[_0x925e('0x36')]('/openchannel/queues/:id/notify',auth[_0x925e('0xa')](),controller['queueNotify'](_0x925e('0x43')));router[_0x925e('0x7')](_0x925e('0x44'),auth[_0x925e('0xa')](),controller['showOpenchannelQueues']);router['post'](_0x925e('0x45'),auth[_0x925e('0xa')](),controller[_0x925e('0x38')](_0x925e('0x46')));router[_0x925e('0x36')](_0x925e('0x47'),auth['isAuthenticated'](),controller[_0x925e('0x38')]('whatsapp'));router[_0x925e('0x7')](_0x925e('0x48'),auth[_0x925e('0xa')](),controller[_0x925e('0x49')]);router['get'](_0x925e('0x4a'),auth[_0x925e('0xa')](),controller['showWhatsappQueues']);router[_0x925e('0x36')](_0x925e('0x4b'),auth[_0x925e('0xa')](),controller['agentNotify']);module[_0x925e('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 9c06f7a..28c82a3 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 _0x9c5a=['Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','filter','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','QueueId','TransferReport','create','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','From','Start','bluebird','moment','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','merge','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','updateAttributes','findOrCreate','SIP/%s','format','agent','internal','AgentCapacity','telephones','Telephones','trunks','Trunks'];(function(_0x3db122,_0x5e6bee){var _0x325b67=function(_0x5095af){while(--_0x5095af){_0x3db122['push'](_0x3db122['shift']());}};_0x325b67(++_0x5e6bee);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x485e1a,_0x96c5dd){_0x485e1a=_0x485e1a-0x0;var _0x39b37f=_0x9c5a[_0x485e1a];return _0x39b37f;};'use strict';var BPromise=require(_0xa9c5('0x0'));var moment=require(_0xa9c5('0x1'));var _=require('lodash');var util=require(_0xa9c5('0x2'));var db=require(_0xa9c5('0x3'))['db'];var logger=require(_0xa9c5('0x4'))(_0xa9c5('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xa9c5('0x6')][_0xa9c5('0x7')]({'port':0x232a});var mailClient=jayson['client'][_0xa9c5('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0xa9c5('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3df556,_0x4cb597,_0x4b6db6){return new BPromise(function(_0x3d6b50,_0x16f331){var _0x52afb2=_0x4b6db6?_0x4b6db6:amiClient;return _0x52afb2[_0xa9c5('0x8')](_0x3df556,_0x4cb597)[_0xa9c5('0x9')](function(_0x51c14c){if(_0x51c14c[_0xa9c5('0xa')]){if(_0x51c14c[_0xa9c5('0xa')]['code']===0x1f4){return _0x16f331(_0x51c14c['error'][_0xa9c5('0xb')]);}return _0x3d6b50(_0x51c14c[_0xa9c5('0xa')][_0xa9c5('0xb')]);}else{_0x3d6b50(_0x51c14c[_0xa9c5('0xc')]);}})[_0xa9c5('0xd')](function(_0x4492a4){_0x16f331(_0x4492a4);});});}function respondWithResult(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xc8;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0xe')](_0x42d5cf)['json'](_0x3c5ac7);}return _0x51c8d[_0xa9c5('0xf')](0x194);};}function handleError(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0x1f4;return function(_0x3806c4){logger[_0xa9c5('0xa')](_0x3806c4[_0xa9c5('0x10')]);if(_0x3806c4[_0xa9c5('0x11')]){delete _0x3806c4[_0xa9c5('0x11')];}_0x1276d2[_0xa9c5('0xe')](_0x7df76d)[_0xa9c5('0x12')](_0x3806c4);};}function findById(_0x4bb57e){return function(_0x2b0d73){if(!_[_0xa9c5('0x13')](_0x4bb57e)&&!_[_0xa9c5('0x13')](_0x2b0d73)&&!_['isNil'](_0x2b0d73[_0xa9c5('0x14')])){return _[_0xa9c5('0x15')](_0x2b0d73[_0xa9c5('0x14')],function(_0x3b8cf7){return _0x3b8cf7['id']==_0x4bb57e;});}return null;};}exports[_0xa9c5('0x16')]=function(_0x349f27,_0x3b8d4d){return respondWithRpcPromise(_0xa9c5('0x17'),_0x349f27[_0xa9c5('0x18')])[_0xa9c5('0x9')](respondWithResult(_0x3b8d4d,null))[_0xa9c5('0xd')](handleError(_0x3b8d4d,null));};exports[_0xa9c5('0x19')]=function(_0x54f8b9,_0x1115ad){return respondWithRpcPromise(_0xa9c5('0x1a'),_['merge'](_0x54f8b9['query'],_0x54f8b9[_0xa9c5('0x1b')]))[_0xa9c5('0x9')](respondWithResult(_0x1115ad,null))[_0xa9c5('0xd')](handleError(_0x1115ad,null));};exports[_0xa9c5('0x1c')]=function(_0xc0bca3,_0xd4b8a1){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0xc0bca3[_0xa9c5('0x18')],_0xc0bca3[_0xa9c5('0x1b')]))['then'](respondWithResult(_0xd4b8a1,null))[_0xa9c5('0xd')](handleError(_0xd4b8a1,null));};exports[_0xa9c5('0x1d')]=function(_0x306c9b,_0x32fc7d){return respondWithRpcPromise(_0xa9c5('0x1e'),_0x306c9b[_0xa9c5('0x18')])[_0xa9c5('0x9')](respondWithResult(_0x32fc7d,null))['catch'](handleError(_0x32fc7d,null));};exports['showVoiceQueues']=function(_0x242771,_0x4cd5e6){return respondWithRpcPromise(_0xa9c5('0x1e'),_0x242771[_0xa9c5('0x18')])['then'](findById(_0x242771[_0xa9c5('0x1b')]['id']))[_0xa9c5('0x9')](respondWithResult(_0x4cd5e6,null))['catch'](handleError(_0x4cd5e6,null));};exports[_0xa9c5('0x1f')]=function(_0x32baf9,_0x198cdf){return respondWithRpcPromise(_0xa9c5('0x20'),_[_0xa9c5('0x21')](_0x32baf9['body'],_0x32baf9[_0xa9c5('0x1b')]))['then'](respondWithResult(_0x198cdf,null))[_0xa9c5('0xd')](handleError(_0x198cdf,null));};exports[_0xa9c5('0x22')]=function(_0x2eeed1,_0x541475){return respondWithRpcPromise(_0xa9c5('0x23'),_[_0xa9c5('0x21')](_0x2eeed1['query'],_0x2eeed1[_0xa9c5('0x1b')]))[_0xa9c5('0x9')](respondWithResult(_0x541475,null))[_0xa9c5('0xd')](handleError(_0x541475,null));};exports[_0xa9c5('0x24')]=function(_0x22ee21,_0x3392d0){return respondWithRpcPromise(_0xa9c5('0x25'),_0x22ee21['query'])[_0xa9c5('0x9')](respondWithResult(_0x3392d0,null))[_0xa9c5('0xd')](handleError(_0x3392d0,null));};exports[_0xa9c5('0x26')]=function(_0x1c01f9,_0x1c617c){return respondWithRpcPromise(_0xa9c5('0x27'),_[_0xa9c5('0x21')](_0x1c01f9[_0xa9c5('0x18')],_0x1c01f9['params']))['then'](respondWithResult(_0x1c617c,null))[_0xa9c5('0xd')](handleError(_0x1c617c,null));};exports[_0xa9c5('0x28')]=function(_0xf2bebc,_0x1313b2){return respondWithRpcPromise(_0xa9c5('0x29'),_[_0xa9c5('0x21')](_0xf2bebc['query'],_0xf2bebc['params']))['then'](respondWithResult(_0x1313b2,null))[_0xa9c5('0xd')](handleError(_0x1313b2,null));};exports[_0xa9c5('0x2a')]=function(_0x5087e4,_0x13a1f5){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xa9c5('0x21')](_0x5087e4[_0xa9c5('0x18')],_0x5087e4[_0xa9c5('0x1b')]))[_0xa9c5('0x9')](respondWithResult(_0x13a1f5,null))['catch'](handleError(_0x13a1f5,null));};exports[_0xa9c5('0x2b')]=function(_0x2cd721,_0x191153){return respondWithRpcPromise(_0xa9c5('0x2c'),_0x2cd721[_0xa9c5('0x18')])[_0xa9c5('0x9')](respondWithResult(_0x191153,null))[_0xa9c5('0xd')](handleError(_0x191153,null));};exports[_0xa9c5('0x2d')]=function(_0x573fc0,_0x11b2b2){return respondWithRpcPromise(_0xa9c5('0x2e'),_0x573fc0[_0xa9c5('0x18')])[_0xa9c5('0x9')](respondWithResult(_0x11b2b2,null))[_0xa9c5('0xd')](handleError(_0x11b2b2,null));};exports[_0xa9c5('0x2f')]=function(_0x493b20,_0x307736){var _0x5b7a0a;return respondWithRpcPromise(_0xa9c5('0x30'),_0x493b20['query'])[_0xa9c5('0x9')](function(_0xd4305d){_0x5b7a0a=_0xd4305d;return respondWithRpcPromise(_0xa9c5('0x30'),_0x493b20['query'],routingClient);})[_0xa9c5('0x9')](function(_0x1ddd72){return _[_0xa9c5('0x21')]({},_0x1ddd72,_0x5b7a0a);})[_0xa9c5('0x9')](respondWithResult(_0x307736,null))['catch'](handleError(_0x307736,null));};exports[_0xa9c5('0x31')]=function(_0x97803f,_0x3db918){if(_0x97803f[_0xa9c5('0x32')]&&_0x97803f[_0xa9c5('0x32')]['interaction']&&_0x97803f[_0xa9c5('0x33')]&&_0x97803f['user'][_0xa9c5('0x11')]){for(var _0x397614 in _0x97803f[_0xa9c5('0x32')][_0xa9c5('0x34')]){if(_0x97803f[_0xa9c5('0x32')][_0xa9c5('0x34')][_0xa9c5('0x35')](_0x397614)){db[_0xa9c5('0x36')][_0xa9c5('0x37')]({'where':{'channel':_0x397614,'membername':_0x97803f[_0xa9c5('0x33')]['name'],'type':_0xa9c5('0x38'),'exitAt':null,'uniqueid':_0x97803f[_0xa9c5('0x32')][_0xa9c5('0x34')][_0x397614]&&_0x97803f[_0xa9c5('0x32')][_0xa9c5('0x34')][_0x397614][_0xa9c5('0x39')]?{'$notIn':_0x97803f['body'][_0xa9c5('0x34')][_0x397614]}:{'$ne':null}}})[_0xa9c5('0x9')](function(_0x557c21){var _0x52cfbf=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4e97bf=0x0,_0x160020=_0x557c21[_0xa9c5('0x39')];_0x4e97bf<_0x160020;_0x4e97bf+=0x1){_0x557c21[_0x4e97bf][_0xa9c5('0x3a')]({'exitAt':_0x52cfbf});}});for(var _0x1e8f5f=0x0;_0x1e8f5f<_0x97803f[_0xa9c5('0x32')][_0xa9c5('0x34')][_0x397614][_0xa9c5('0x39')];_0x1e8f5f+=0x1){db[_0xa9c5('0x36')][_0xa9c5('0x3b')]({'where':{'channel':_0x397614,'membername':_0x97803f[_0xa9c5('0x33')][_0xa9c5('0x11')],'type':_0xa9c5('0x38'),'uniqueid':_0x97803f[_0xa9c5('0x32')]['interaction'][_0x397614][_0x1e8f5f],'exitAt':null},'defaults':{'channel':_0x397614,'membername':_0x97803f[_0xa9c5('0x33')]['name'],'interface':_[_0xa9c5('0x13')](_0x97803f[_0xa9c5('0x33')]['interface'])?util['format'](_0xa9c5('0x3c'),_0x97803f[_0xa9c5('0x33')][_0xa9c5('0x11')]):_0x97803f['user']['interface'],'type':_0xa9c5('0x38'),'enterAt':moment()[_0xa9c5('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xa9c5('0x3e'),'internal':_0x97803f[_0xa9c5('0x33')][_0xa9c5('0x3f')],'uniqueid':_0x97803f[_0xa9c5('0x32')][_0xa9c5('0x34')][_0x397614][_0x1e8f5f]}});}}}}return respondWithRpcPromise(_0xa9c5('0x40'),{'id':_0x97803f['params']['id'],'capacity':_0x97803f['body']['capacity']},routingClient)[_0xa9c5('0x9')](respondWithResult(_0x3db918,null))[_0xa9c5('0xd')](handleError(_0x3db918,null));};exports[_0xa9c5('0x41')]=function(_0xef4d2,_0x380266){return respondWithRpcPromise(_0xa9c5('0x42'),_0xef4d2['query'])[_0xa9c5('0x9')](respondWithResult(_0x380266,null))[_0xa9c5('0xd')](handleError(_0x380266,null));};exports[_0xa9c5('0x43')]=function(_0x2bdc77,_0xa0b458){return respondWithRpcPromise(_0xa9c5('0x44'),_0x2bdc77['query'])['then'](respondWithResult(_0xa0b458,null))[_0xa9c5('0xd')](handleError(_0xa0b458,null));};exports['campaigns']=function(_0x1b158f,_0x5ea9b0){return respondWithRpcPromise(_0xa9c5('0x45'),_0x1b158f[_0xa9c5('0x18')])[_0xa9c5('0x9')](respondWithResult(_0x5ea9b0,null))['catch'](handleError(_0x5ea9b0,null));};exports[_0xa9c5('0x46')]=function(_0xe5390f,_0x1a75f3){return respondWithRpcPromise(_0xa9c5('0x47'),_0xe5390f['query'],routingClient)['then'](respondWithResult(_0x1a75f3,null))[_0xa9c5('0xd')](handleError(_0x1a75f3,null));};exports[_0xa9c5('0x48')]=function(_0x3205f2,_0x5b4323){return respondWithRpcPromise(_0xa9c5('0x47'),_0x3205f2[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](findById(_0x3205f2[_0xa9c5('0x1b')]['id']))[_0xa9c5('0x9')](respondWithResult(_0x5b4323,null))[_0xa9c5('0xd')](handleError(_0x5b4323,null));};exports[_0xa9c5('0x49')]=function(_0x298b3d,_0x5a7f0a){return respondWithRpcPromise(_0xa9c5('0x4a'),_0x298b3d['query'],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x5a7f0a,null))[_0xa9c5('0xd')](handleError(_0x5a7f0a,null));};exports[_0xa9c5('0x4b')]=function(_0x4dfe3a,_0x4d475a){return respondWithRpcPromise(_0xa9c5('0x4a'),_0x4dfe3a['query'],routingClient)[_0xa9c5('0x9')](findById(_0x4dfe3a[_0xa9c5('0x1b')]['id']))[_0xa9c5('0x9')](respondWithResult(_0x4d475a,null))[_0xa9c5('0xd')](handleError(_0x4d475a,null));};exports['mailAccounts']=function(_0x3505d3,_0x222091){return respondWithRpcPromise(_0xa9c5('0x4c'),_0x3505d3[_0xa9c5('0x18')],mailClient)['then'](respondWithResult(_0x222091,null))['catch'](handleError(_0x222091,null));};exports[_0xa9c5('0x4d')]=function(_0x3deb64,_0x67c1f8){return respondWithRpcPromise(_0xa9c5('0x4e'),_0x3deb64[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x67c1f8,null))['catch'](handleError(_0x67c1f8,null));};exports[_0xa9c5('0x4f')]=function(_0x1e787e,_0x2497e1){return respondWithRpcPromise(_0xa9c5('0x4e'),_0x1e787e[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](findById(_0x1e787e[_0xa9c5('0x1b')]['id']))[_0xa9c5('0x9')](respondWithResult(_0x2497e1,null))[_0xa9c5('0xd')](handleError(_0x2497e1,null));};exports[_0xa9c5('0x50')]=function(_0x50d438,_0x5e17a2){return respondWithRpcPromise(_0xa9c5('0x51'),_0x50d438[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x5e17a2,null))[_0xa9c5('0xd')](handleError(_0x5e17a2,null));};exports['showSmsQueues']=function(_0x1c2478,_0x4aa699){return respondWithRpcPromise(_0xa9c5('0x51'),_0x1c2478[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](findById(_0x1c2478[_0xa9c5('0x1b')]['id']))[_0xa9c5('0x9')](respondWithResult(_0x4aa699,null))[_0xa9c5('0xd')](handleError(_0x4aa699,null));};exports[_0xa9c5('0x52')]=function(_0x3890b4,_0x2f323e){return respondWithRpcPromise(_0xa9c5('0x53'),_0x3890b4[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x2f323e,null))['catch'](handleError(_0x2f323e,null));};exports[_0xa9c5('0x54')]=function(_0x1a4aa7,_0x15eb25){return respondWithRpcPromise(_0xa9c5('0x53'),_0x1a4aa7[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](findById(_0x1a4aa7[_0xa9c5('0x1b')]['id']))['then'](respondWithResult(_0x15eb25,null))['catch'](handleError(_0x15eb25,null));};exports[_0xa9c5('0x55')]=function(_0x502a00,_0x2ae087){return respondWithRpcPromise(_0xa9c5('0x56'),_0x502a00['query'],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x2ae087,null))[_0xa9c5('0xd')](handleError(_0x2ae087,null));};exports['showFaxQueues']=function(_0x4f8d9e,_0x14c4f2){return respondWithRpcPromise(_0xa9c5('0x56'),_0x4f8d9e[_0xa9c5('0x18')],routingClient)['then'](findById(_0x4f8d9e['params']['id']))[_0xa9c5('0x9')](respondWithResult(_0x14c4f2,null))[_0xa9c5('0xd')](handleError(_0x14c4f2,null));};exports['faxAccounts']=function(_0xd0371c,_0x393b00){return respondWithRpcPromise(_0xa9c5('0x57'),_0xd0371c[_0xa9c5('0x18')])[_0xa9c5('0x9')](respondWithResult(_0x393b00,null))[_0xa9c5('0xd')](handleError(_0x393b00,null));};exports['chatQueuesWaitingInteractions']=function(_0x44d969,_0x3aeb3c){return respondWithRpcPromise(_0xa9c5('0x58'),_0x44d969[_0xa9c5('0x18')],routingClient)['then'](respondWithResult(_0x3aeb3c,null))[_0xa9c5('0xd')](handleError(_0x3aeb3c,null));};exports[_0xa9c5('0x59')]=function(_0x59e917,_0x112d64){return respondWithRpcPromise(_0xa9c5('0x5a'),_0x59e917[_0xa9c5('0x18')],routingClient)['then'](respondWithResult(_0x112d64,null))[_0xa9c5('0xd')](handleError(_0x112d64,null));};exports[_0xa9c5('0x5b')]=function(_0x18dbfa,_0x2e00f5){return respondWithRpcPromise(_0xa9c5('0x5c'),_0x18dbfa[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x2e00f5,null))['catch'](handleError(_0x2e00f5,null));};exports[_0xa9c5('0x5d')]=function(_0x40468b,_0x7f9e83){return respondWithRpcPromise(_0xa9c5('0x5c'),_0x40468b[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](function(_0x39fae1){if(_0x40468b[_0xa9c5('0x18')][_0xa9c5('0x5e')]!==undefined){var _0x7d0e85=_(_0x39fae1[_0xa9c5('0x14')])['filter']([_0x40468b[_0xa9c5('0x18')][_0xa9c5('0x5e')],_0x40468b['params']['id']])[_0xa9c5('0x5f')](_0xa9c5('0x60'))[_0xa9c5('0x61')]()['value']();return _0x39fae1[_0xa9c5('0x14')][_0xa9c5('0x62')](function(_0x22dfd7){return _0x7d0e85[_0xa9c5('0x63')](_0x22dfd7['queue_id'])>-0x1;});}else{return _0x39fae1[_0xa9c5('0x14')][_0xa9c5('0x62')](function(_0x4f4fa1){return _0x4f4fa1['queue_id']===parseInt(_0x40468b['params']['id']);});}})['then'](respondWithResult(_0x7f9e83,null))['catch'](handleError(_0x7f9e83,null));};exports['smsQueuesWaitingInteractions']=function(_0x5277ee,_0x54c8f5){return respondWithRpcPromise(_0xa9c5('0x64'),_0x5277ee[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x54c8f5,null))[_0xa9c5('0xd')](handleError(_0x54c8f5,null));};exports[_0xa9c5('0x65')]=function(_0x592594,_0x4d7772){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x592594['query'],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x4d7772,null))[_0xa9c5('0xd')](handleError(_0x4d7772,null));};exports[_0xa9c5('0x66')]=function(_0x2eda17,_0x5253e8){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x2eda17[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x5253e8,null))[_0xa9c5('0xd')](handleError(_0x5253e8,null));};exports[_0xa9c5('0x67')]=function(_0x1d89ec){return function(_0x5673f1,_0x2b69b9){var _0x43ae9,_0xd063cf;var _0x58de52=_[_0xa9c5('0x68')](_0x1d89ec);var _0x2741df=_0x1d89ec===_0xa9c5('0x69')?_0xa9c5('0x6a'):'Account';return db[_0x58de52+_0xa9c5('0x6b')][_0xa9c5('0x6c')]({'raw':!![],'where':{'id':_0x5673f1['params']['id']}})['then'](function(_0x2f1e9f){if(_['isNil'](_0x2f1e9f)){throw new Error(_0x58de52+'\x20Queue\x20not\x20found');}_0x43ae9=_0x2f1e9f;return db[_0x58de52+_0xa9c5('0x6d')][_0xa9c5('0x6c')]({'where':{'id':_0x5673f1[_0xa9c5('0x32')][_0xa9c5('0x6e')]},'include':[{'model':db[_0x58de52+_0xa9c5('0x6f')],'as':'Interaction'},{'model':db[_0x58de52+_0x2741df],'as':_0xa9c5('0x70')}]});})['then'](function(_0x129157){if(_[_0xa9c5('0x13')](_0x129157)){throw new Error(_0x58de52+_0xa9c5('0x71'));}_0xd063cf=_0x129157;return _0x129157[_0xa9c5('0x72')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4b056e={'uniqueid':_0x1d89ec+'.'+_0xd063cf['id']+'.'+_0xd063cf[_0xa9c5('0x6f')]['id'],'FromUserId':_0x5673f1['user']['id'],'type':'queue'};_0x4b056e[_0x58de52+_0xa9c5('0x73')]=_0xd063cf['id'];_0x4b056e[_0x58de52+_0xa9c5('0x74')]=_0xd063cf['Interaction']['id'];_0x4b056e['From'+_0x58de52+_0x2741df+'Id']=_0xd063cf[_0xa9c5('0x70')]['id'];_0x4b056e['To'+_0x58de52+_0xa9c5('0x75')]=_0x43ae9['id'];return db[_0x58de52+_0xa9c5('0x76')][_0xa9c5('0x77')](_0x4b056e);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x1d89ec,'interaction':_0xd063cf[_0xa9c5('0x6f')],'message':_0xd063cf,'account':_0xd063cf[_0xa9c5('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa9c5('0x78'),'appdata':_0x43ae9[_0xa9c5('0x11')]+','+(_0xd063cf[_0xa9c5('0x70')][_0xa9c5('0x79')]||0x12c),'interval':_0xa9c5('0x7a')}]},routingClient);})['then'](respondWithResult(_0x2b69b9,null))[_0xa9c5('0xd')](handleError(_0x2b69b9,null));};};exports[_0xa9c5('0x7b')]=function(_0x5065e2,_0x328869){var _0x2488aa,_0x5544d8;if(_[_0xa9c5('0x13')](_0x5065e2[_0xa9c5('0x32')][_0xa9c5('0x7c')])){throw new Error(_0xa9c5('0x7d'));}var _0x21e3ba=_0x5065e2[_0xa9c5('0x32')][_0xa9c5('0x7c')];var _0x13e233=_[_0xa9c5('0x68')](_0x21e3ba);var _0x24a6d3=_0x21e3ba===_0xa9c5('0x69')?_0xa9c5('0x6a'):_0xa9c5('0x70');return db[_0xa9c5('0x7e')][_0xa9c5('0x6c')]({'raw':!![],'where':{'id':_0x5065e2[_0xa9c5('0x1b')]['id'],'role':_0xa9c5('0x3e')}})['then'](function(_0x425b92){if(_[_0xa9c5('0x13')](_0x425b92)){throw new Error(_0xa9c5('0x7f'));}_0x2488aa=_0x425b92;return db[_0x13e233+'Message'][_0xa9c5('0x6c')]({'where':{'id':_0x5065e2[_0xa9c5('0x32')]['messageId']},'include':[{'model':db[_0x13e233+_0xa9c5('0x6f')],'as':_0xa9c5('0x6f')},{'model':db[_0x13e233+_0x24a6d3],'as':_0xa9c5('0x70')}]});})[_0xa9c5('0x9')](function(_0x343b35){if(_[_0xa9c5('0x13')](_0x343b35)){throw new Error(_0x13e233+_0xa9c5('0x71'));}_0x5544d8=_0x343b35;return _0x343b35[_0xa9c5('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa9c5('0x9')](function(){var _0xb09d88={'uniqueid':_0x21e3ba+'.'+_0x5544d8['id']+'.'+_0x5544d8[_0xa9c5('0x6f')]['id'],'FromUserId':_0x5065e2[_0xa9c5('0x33')]['id'],'type':_0xa9c5('0x78'),'ToUserId':_0x2488aa['id']};_0xb09d88[_0x13e233+'MessageId']=_0x5544d8['id'];_0xb09d88[_0x13e233+'InteractionId']=_0x5544d8[_0xa9c5('0x6f')]['id'];_0xb09d88[_0xa9c5('0x80')+_0x13e233+_0x24a6d3+'Id']=_0x5544d8['Account']['id'];return db[_0x13e233+_0xa9c5('0x76')][_0xa9c5('0x77')](_0xb09d88);})[_0xa9c5('0x9')](function(){return respondWithRpcPromise(_0xa9c5('0x81'),{'channel':_0x21e3ba,'interaction':_0x5544d8['Interaction'],'message':_0x5544d8,'account':_0x5544d8['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xa9c5('0x3e'),'appdata':_0x2488aa[_0xa9c5('0x11')]+','+(_0x5544d8[_0xa9c5('0x70')]['agentTransferTimeout']||0x12c),'interval':_0xa9c5('0x7a')}]},routingClient);})[_0xa9c5('0x9')](respondWithResult(_0x328869,null))[_0xa9c5('0xd')](handleError(_0x328869,null));}; \ No newline at end of file +var _0xf2ca=['voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','findAll','INTERACTION','length','findOrCreate','interface','format','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','map','uniq','value','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','QueueId','*,*,*,*','agentNotify','channel','User','Agent\x20not\x20found','Message','TransferReport','create','Start','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','find','rows','VoiceChannels','query','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0xf2ca[_0x9cfe28];return _0x54a1d0;};'use strict';var BPromise=require(_0xaf2c('0x0'));var moment=require(_0xaf2c('0x1'));var _=require(_0xaf2c('0x2'));var util=require('util');var db=require(_0xaf2c('0x3'))['db'];var logger=require(_0xaf2c('0x4'))(_0xaf2c('0x5'));var jayson=require(_0xaf2c('0x6'));var amiClient=jayson[_0xaf2c('0x7')][_0xaf2c('0x8')]({'port':0x232a});var mailClient=jayson['client'][_0xaf2c('0x8')]({'port':0x232b});var routingClient=jayson[_0xaf2c('0x7')][_0xaf2c('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1f9531,_0x58351f,_0x37fedd){return new BPromise(function(_0x3c0421,_0x4a7397){var _0x2a011d=_0x37fedd?_0x37fedd:amiClient;return _0x2a011d['request'](_0x1f9531,_0x58351f)[_0xaf2c('0x9')](function(_0x4a0064){if(_0x4a0064[_0xaf2c('0xa')]){if(_0x4a0064[_0xaf2c('0xa')][_0xaf2c('0xb')]===0x1f4){return _0x4a7397(_0x4a0064[_0xaf2c('0xa')]['message']);}return _0x3c0421(_0x4a0064['error'][_0xaf2c('0xc')]);}else{_0x3c0421(_0x4a0064[_0xaf2c('0xd')]);}})[_0xaf2c('0xe')](function(_0xd56a5d){_0x4a7397(_0xd56a5d);});});}function respondWithResult(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xc8;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0xf')](_0x59a59b)[_0xaf2c('0x10')](_0x590126);}return _0x285dac[_0xaf2c('0x11')](0x194);};}function handleError(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0x1f4;return function(_0x152c73){logger[_0xaf2c('0xa')](_0x152c73[_0xaf2c('0x12')]);if(_0x152c73[_0xaf2c('0x13')]){delete _0x152c73[_0xaf2c('0x13')];}_0x18a8a5[_0xaf2c('0xf')](_0x293ca6)[_0xaf2c('0x14')](_0x152c73);};}function findById(_0x26bf7b){return function(_0x3432e4){if(!_[_0xaf2c('0x15')](_0x26bf7b)&&!_['isNil'](_0x3432e4)&&!_[_0xaf2c('0x15')](_0x3432e4['rows'])){return _[_0xaf2c('0x16')](_0x3432e4[_0xaf2c('0x17')],function(_0x1d544a){return _0x1d544a['id']==_0x26bf7b;});}return null;};}exports['voiceChannels']=function(_0x28ae7b,_0x297bcd){return respondWithRpcPromise(_0xaf2c('0x18'),_0x28ae7b[_0xaf2c('0x19')])[_0xaf2c('0x9')](respondWithResult(_0x297bcd,null))[_0xaf2c('0xe')](handleError(_0x297bcd,null));};exports['voiceChannelMixMonitor']=function(_0x35e712,_0x164bcb){return respondWithRpcPromise(_0xaf2c('0x1a'),_[_0xaf2c('0x1b')](_0x35e712[_0xaf2c('0x19')],_0x35e712['params']))[_0xaf2c('0x9')](respondWithResult(_0x164bcb,null))[_0xaf2c('0xe')](handleError(_0x164bcb,null));};exports[_0xaf2c('0x1c')]=function(_0x4be6ed,_0x59b113){return respondWithRpcPromise(_0xaf2c('0x1d'),_[_0xaf2c('0x1b')](_0x4be6ed[_0xaf2c('0x19')],_0x4be6ed[_0xaf2c('0x1e')]))['then'](respondWithResult(_0x59b113,null))[_0xaf2c('0xe')](handleError(_0x59b113,null));};exports[_0xaf2c('0x1f')]=function(_0x3a0145,_0x3c1ae6){return respondWithRpcPromise(_0xaf2c('0x20'),_0x3a0145[_0xaf2c('0x19')])[_0xaf2c('0x9')](respondWithResult(_0x3c1ae6,null))['catch'](handleError(_0x3c1ae6,null));};exports[_0xaf2c('0x21')]=function(_0x2051be,_0x36f37c){return respondWithRpcPromise(_0xaf2c('0x20'),_0x2051be['query'])[_0xaf2c('0x9')](findById(_0x2051be['params']['id']))[_0xaf2c('0x9')](respondWithResult(_0x36f37c,null))[_0xaf2c('0xe')](handleError(_0x36f37c,null));};exports[_0xaf2c('0x22')]=function(_0x5d685a,_0x2747bb){return respondWithRpcPromise(_0xaf2c('0x23'),_[_0xaf2c('0x1b')](_0x5d685a['body'],_0x5d685a[_0xaf2c('0x1e')]))[_0xaf2c('0x9')](respondWithResult(_0x2747bb,null))[_0xaf2c('0xe')](handleError(_0x2747bb,null));};exports[_0xaf2c('0x24')]=function(_0x59d858,_0x3da072){return respondWithRpcPromise(_0xaf2c('0x25'),_[_0xaf2c('0x1b')](_0x59d858['query'],_0x59d858['params']))[_0xaf2c('0x9')](respondWithResult(_0x3da072,null))['catch'](handleError(_0x3da072,null));};exports[_0xaf2c('0x26')]=function(_0x5e7247,_0x337cea){return respondWithRpcPromise(_0xaf2c('0x27'),_0x5e7247['query'])[_0xaf2c('0x9')](respondWithResult(_0x337cea,null))[_0xaf2c('0xe')](handleError(_0x337cea,null));};exports['voiceQueuesChannel']=function(_0x13ced2,_0xbec302){return respondWithRpcPromise(_0xaf2c('0x28'),_[_0xaf2c('0x1b')](_0x13ced2[_0xaf2c('0x19')],_0x13ced2[_0xaf2c('0x1e')]))['then'](respondWithResult(_0xbec302,null))[_0xaf2c('0xe')](handleError(_0xbec302,null));};exports['voiceQueuesChannelHangup']=function(_0x321f7c,_0x514bff){return respondWithRpcPromise(_0xaf2c('0x29'),_['merge'](_0x321f7c[_0xaf2c('0x19')],_0x321f7c['params']))[_0xaf2c('0x9')](respondWithResult(_0x514bff,null))['catch'](handleError(_0x514bff,null));};exports[_0xaf2c('0x2a')]=function(_0x356402,_0x1a6929){return respondWithRpcPromise(_0xaf2c('0x2b'),_[_0xaf2c('0x1b')](_0x356402['query'],_0x356402['params']))[_0xaf2c('0x9')](respondWithResult(_0x1a6929,null))[_0xaf2c('0xe')](handleError(_0x1a6929,null));};exports[_0xaf2c('0x2c')]=function(_0xa44813,_0x4eeecf){return respondWithRpcPromise(_0xaf2c('0x2d'),_0xa44813['query'])[_0xaf2c('0x9')](respondWithResult(_0x4eeecf,null))[_0xaf2c('0xe')](handleError(_0x4eeecf,null));};exports['outboundChannels']=function(_0x36081a,_0x24668d){return respondWithRpcPromise(_0xaf2c('0x2e'),_0x36081a[_0xaf2c('0x19')])[_0xaf2c('0x9')](respondWithResult(_0x24668d,null))[_0xaf2c('0xe')](handleError(_0x24668d,null));};exports[_0xaf2c('0x2f')]=function(_0x310d3b,_0x296ca8){var _0x106eb9;return respondWithRpcPromise(_0xaf2c('0x30'),_0x310d3b[_0xaf2c('0x19')])[_0xaf2c('0x9')](function(_0x4b524d){_0x106eb9=_0x4b524d;return respondWithRpcPromise('Agents',_0x310d3b['query'],routingClient);})[_0xaf2c('0x9')](function(_0x3cb075){return _[_0xaf2c('0x1b')]({},_0x3cb075,_0x106eb9);})[_0xaf2c('0x9')](respondWithResult(_0x296ca8,null))[_0xaf2c('0xe')](handleError(_0x296ca8,null));};exports[_0xaf2c('0x31')]=function(_0x51c441,_0x1d58bd){if(_0x51c441[_0xaf2c('0x32')]&&_0x51c441[_0xaf2c('0x32')]['interaction']&&_0x51c441['user']&&_0x51c441[_0xaf2c('0x33')]['name']){for(var _0x181787 in _0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')]){if(_0x51c441[_0xaf2c('0x32')]['interaction'][_0xaf2c('0x35')](_0x181787)){db['MemberReport'][_0xaf2c('0x36')]({'where':{'channel':_0x181787,'membername':_0x51c441[_0xaf2c('0x33')]['name'],'type':_0xaf2c('0x37'),'exitAt':null,'uniqueid':_0x51c441['body'][_0xaf2c('0x34')][_0x181787]&&_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787][_0xaf2c('0x38')]?{'$notIn':_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787]}:{'$ne':null}}})[_0xaf2c('0x9')](function(_0x16b469){var _0x922b9=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x18e62b=0x0,_0x4d0977=_0x16b469['length'];_0x18e62b<_0x4d0977;_0x18e62b+=0x1){_0x16b469[_0x18e62b]['updateAttributes']({'exitAt':_0x922b9});}});for(var _0x11a90a=0x0;_0x11a90a<_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787][_0xaf2c('0x38')];_0x11a90a+=0x1){db['MemberReport'][_0xaf2c('0x39')]({'where':{'channel':_0x181787,'membername':_0x51c441['user'][_0xaf2c('0x13')],'type':'INTERACTION','uniqueid':_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787][_0x11a90a],'exitAt':null},'defaults':{'channel':_0x181787,'membername':_0x51c441[_0xaf2c('0x33')][_0xaf2c('0x13')],'interface':_[_0xaf2c('0x15')](_0x51c441['user'][_0xaf2c('0x3a')])?util[_0xaf2c('0x3b')]('SIP/%s',_0x51c441['user'][_0xaf2c('0x13')]):_0x51c441['user'][_0xaf2c('0x3a')],'type':_0xaf2c('0x37'),'enterAt':moment()[_0xaf2c('0x3b')](_0xaf2c('0x3c')),'role':_0xaf2c('0x3d'),'internal':_0x51c441[_0xaf2c('0x33')][_0xaf2c('0x3e')],'uniqueid':_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787][_0x11a90a]}});}}}}return respondWithRpcPromise(_0xaf2c('0x3f'),{'id':_0x51c441[_0xaf2c('0x1e')]['id'],'capacity':_0x51c441['body'][_0xaf2c('0x40')]},routingClient)[_0xaf2c('0x9')](respondWithResult(_0x1d58bd,null))['catch'](handleError(_0x1d58bd,null));};exports['telephones']=function(_0x56d7ce,_0x7ddca0){return respondWithRpcPromise(_0xaf2c('0x41'),_0x56d7ce['query'])[_0xaf2c('0x9')](respondWithResult(_0x7ddca0,null))[_0xaf2c('0xe')](handleError(_0x7ddca0,null));};exports[_0xaf2c('0x42')]=function(_0x3085e5,_0x265748){return respondWithRpcPromise(_0xaf2c('0x43'),_0x3085e5[_0xaf2c('0x19')])['then'](respondWithResult(_0x265748,null))[_0xaf2c('0xe')](handleError(_0x265748,null));};exports[_0xaf2c('0x44')]=function(_0x5771e5,_0x245797){return respondWithRpcPromise(_0xaf2c('0x45'),_0x5771e5[_0xaf2c('0x19')])[_0xaf2c('0x9')](respondWithResult(_0x245797,null))[_0xaf2c('0xe')](handleError(_0x245797,null));};exports[_0xaf2c('0x46')]=function(_0x332340,_0x15a335){return respondWithRpcPromise(_0xaf2c('0x47'),_0x332340[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x15a335,null))[_0xaf2c('0xe')](handleError(_0x15a335,null));};exports[_0xaf2c('0x48')]=function(_0x2356a0,_0x297a22){return respondWithRpcPromise(_0xaf2c('0x47'),_0x2356a0[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0x2356a0[_0xaf2c('0x1e')]['id']))[_0xaf2c('0x9')](respondWithResult(_0x297a22,null))['catch'](handleError(_0x297a22,null));};exports[_0xaf2c('0x49')]=function(_0x3ac79c,_0xfe5928){return respondWithRpcPromise('MailQueues',_0x3ac79c[_0xaf2c('0x19')],routingClient)['then'](respondWithResult(_0xfe5928,null))[_0xaf2c('0xe')](handleError(_0xfe5928,null));};exports[_0xaf2c('0x4a')]=function(_0xb3ad9,_0x45918b){return respondWithRpcPromise(_0xaf2c('0x4b'),_0xb3ad9[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0xb3ad9[_0xaf2c('0x1e')]['id']))[_0xaf2c('0x9')](respondWithResult(_0x45918b,null))['catch'](handleError(_0x45918b,null));};exports[_0xaf2c('0x4c')]=function(_0x400dcd,_0x262937){return respondWithRpcPromise(_0xaf2c('0x4d'),_0x400dcd[_0xaf2c('0x19')],mailClient)['then'](respondWithResult(_0x262937,null))[_0xaf2c('0xe')](handleError(_0x262937,null));};exports[_0xaf2c('0x4e')]=function(_0x506000,_0x33aa67){return respondWithRpcPromise(_0xaf2c('0x4f'),_0x506000['query'],routingClient)['then'](respondWithResult(_0x33aa67,null))[_0xaf2c('0xe')](handleError(_0x33aa67,null));};exports[_0xaf2c('0x50')]=function(_0xc83d19,_0x39c5d2){return respondWithRpcPromise('OpenchannelQueues',_0xc83d19[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0xc83d19['params']['id']))[_0xaf2c('0x9')](respondWithResult(_0x39c5d2,null))['catch'](handleError(_0x39c5d2,null));};exports[_0xaf2c('0x51')]=function(_0xe6a251,_0x16e9f4){return respondWithRpcPromise(_0xaf2c('0x52'),_0xe6a251[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x16e9f4,null))[_0xaf2c('0xe')](handleError(_0x16e9f4,null));};exports[_0xaf2c('0x53')]=function(_0x1520ec,_0xc27601){return respondWithRpcPromise('SmsQueues',_0x1520ec[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0x1520ec[_0xaf2c('0x1e')]['id']))[_0xaf2c('0x9')](respondWithResult(_0xc27601,null))[_0xaf2c('0xe')](handleError(_0xc27601,null));};exports['whatsappQueues']=function(_0xbfb776,_0x28b09f){return respondWithRpcPromise(_0xaf2c('0x54'),_0xbfb776[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x28b09f,null))['catch'](handleError(_0x28b09f,null));};exports['showWhatsappQueues']=function(_0x1166c9,_0x1ead61){return respondWithRpcPromise('WhatsappQueues',_0x1166c9[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0x1166c9[_0xaf2c('0x1e')]['id']))['then'](respondWithResult(_0x1ead61,null))[_0xaf2c('0xe')](handleError(_0x1ead61,null));};exports[_0xaf2c('0x55')]=function(_0x18dcde,_0x2aae3a){return respondWithRpcPromise('FaxQueues',_0x18dcde[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x2aae3a,null))[_0xaf2c('0xe')](handleError(_0x2aae3a,null));};exports[_0xaf2c('0x56')]=function(_0x20c120,_0x1ecf97){return respondWithRpcPromise(_0xaf2c('0x57'),_0x20c120[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0x20c120[_0xaf2c('0x1e')]['id']))[_0xaf2c('0x9')](respondWithResult(_0x1ecf97,null))['catch'](handleError(_0x1ecf97,null));};exports[_0xaf2c('0x58')]=function(_0x5d965c,_0x1a0795){return respondWithRpcPromise(_0xaf2c('0x59'),_0x5d965c['query'])[_0xaf2c('0x9')](respondWithResult(_0x1a0795,null))['catch'](handleError(_0x1a0795,null));};exports['chatQueuesWaitingInteractions']=function(_0x316333,_0x1d73ef){return respondWithRpcPromise(_0xaf2c('0x5a'),_0x316333['query'],routingClient)['then'](respondWithResult(_0x1d73ef,null))['catch'](handleError(_0x1d73ef,null));};exports[_0xaf2c('0x5b')]=function(_0x3e972c,_0x517f8d){return respondWithRpcPromise(_0xaf2c('0x5c'),_0x3e972c[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x517f8d,null))[_0xaf2c('0xe')](handleError(_0x517f8d,null));};exports[_0xaf2c('0x5d')]=function(_0x44303c,_0x4be47b){return respondWithRpcPromise(_0xaf2c('0x5e'),_0x44303c[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x4be47b,null))['catch'](handleError(_0x4be47b,null));};exports[_0xaf2c('0x5f')]=function(_0x3c53ff,_0x37ee02){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x3c53ff[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](function(_0x433f9e){if(_0x3c53ff[_0xaf2c('0x19')]['type']!==undefined){var _0x286a40=_(_0x433f9e[_0xaf2c('0x17')])[_0xaf2c('0x60')]([_0x3c53ff['query']['type'],_0x3c53ff[_0xaf2c('0x1e')]['id']])[_0xaf2c('0x61')]('queue_id')[_0xaf2c('0x62')]()[_0xaf2c('0x63')]();return _0x433f9e['rows'][_0xaf2c('0x60')](function(_0x31cf3e){return _0x286a40[_0xaf2c('0x64')](_0x31cf3e[_0xaf2c('0x65')])>-0x1;});}else{return _0x433f9e[_0xaf2c('0x17')]['filter'](function(_0x5831c9){return _0x5831c9[_0xaf2c('0x65')]===parseInt(_0x3c53ff[_0xaf2c('0x1e')]['id']);});}})[_0xaf2c('0x9')](respondWithResult(_0x37ee02,null))['catch'](handleError(_0x37ee02,null));};exports[_0xaf2c('0x66')]=function(_0x467a36,_0x3d8471){return respondWithRpcPromise(_0xaf2c('0x67'),_0x467a36[_0xaf2c('0x19')],routingClient)['then'](respondWithResult(_0x3d8471,null))[_0xaf2c('0xe')](handleError(_0x3d8471,null));};exports[_0xaf2c('0x68')]=function(_0x154f69,_0x1ef61f){return respondWithRpcPromise(_0xaf2c('0x69'),_0x154f69[_0xaf2c('0x19')],routingClient)['then'](respondWithResult(_0x1ef61f,null))[_0xaf2c('0xe')](handleError(_0x1ef61f,null));};exports[_0xaf2c('0x6a')]=function(_0x483774,_0x5beb89){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x483774[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x5beb89,null))[_0xaf2c('0xe')](handleError(_0x5beb89,null));};exports[_0xaf2c('0x6b')]=function(_0x499bbe){return function(_0x19fbd5,_0x2d7ca5){var _0x2b57d2,_0x430567;var _0x4ddf95=_[_0xaf2c('0x6c')](_0x499bbe);var _0x23aeac=_0x499bbe===_0xaf2c('0x6d')?_0xaf2c('0x6e'):_0xaf2c('0x6f');return db[_0x4ddf95+'Queue'][_0xaf2c('0x70')]({'raw':!![],'where':{'id':_0x19fbd5[_0xaf2c('0x1e')]['id']}})['then'](function(_0x516193){if(_[_0xaf2c('0x15')](_0x516193)){throw new Error(_0x4ddf95+_0xaf2c('0x71'));}_0x2b57d2=_0x516193;return db[_0x4ddf95+'Message'][_0xaf2c('0x70')]({'where':{'id':_0x19fbd5[_0xaf2c('0x32')][_0xaf2c('0x72')]},'include':[{'model':db[_0x4ddf95+_0xaf2c('0x73')],'as':_0xaf2c('0x73')},{'model':db[_0x4ddf95+_0x23aeac],'as':_0xaf2c('0x6f')}]});})[_0xaf2c('0x9')](function(_0x43c174){if(_['isNil'](_0x43c174)){throw new Error(_0x4ddf95+_0xaf2c('0x74'));}_0x430567=_0x43c174;return _0x43c174['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xaf2c('0x9')](function(){var _0x7724cc={'uniqueid':_0x499bbe+'.'+_0x430567['id']+'.'+_0x430567['Interaction']['id'],'FromUserId':_0x19fbd5['user']['id'],'type':_0xaf2c('0x75')};_0x7724cc[_0x4ddf95+_0xaf2c('0x76')]=_0x430567['id'];_0x7724cc[_0x4ddf95+_0xaf2c('0x77')]=_0x430567['Interaction']['id'];_0x7724cc[_0xaf2c('0x78')+_0x4ddf95+_0x23aeac+'Id']=_0x430567[_0xaf2c('0x6f')]['id'];_0x7724cc['To'+_0x4ddf95+_0xaf2c('0x79')]=_0x2b57d2['id'];return db[_0x4ddf95+'TransferReport']['create'](_0x7724cc);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x499bbe,'interaction':_0x430567[_0xaf2c('0x73')],'message':_0x430567,'account':_0x430567[_0xaf2c('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0xaf2c('0x75'),'appdata':_0x2b57d2[_0xaf2c('0x13')]+','+(_0x430567[_0xaf2c('0x6f')]['queueTransferTimeout']||0x12c),'interval':_0xaf2c('0x7a')}]},routingClient);})[_0xaf2c('0x9')](respondWithResult(_0x2d7ca5,null))['catch'](handleError(_0x2d7ca5,null));};};exports[_0xaf2c('0x7b')]=function(_0x4a3a61,_0x31f1d3){var _0x25d49c,_0x1e403a;if(_[_0xaf2c('0x15')](_0x4a3a61[_0xaf2c('0x32')][_0xaf2c('0x7c')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x47b971=_0x4a3a61[_0xaf2c('0x32')][_0xaf2c('0x7c')];var _0x1bc548=_[_0xaf2c('0x6c')](_0x47b971);var _0x118e78=_0x47b971===_0xaf2c('0x6d')?'Website':'Account';return db[_0xaf2c('0x7d')]['findOne']({'raw':!![],'where':{'id':_0x4a3a61[_0xaf2c('0x1e')]['id'],'role':'agent'}})[_0xaf2c('0x9')](function(_0x639b4b){if(_['isNil'](_0x639b4b)){throw new Error(_0xaf2c('0x7e'));}_0x25d49c=_0x639b4b;return db[_0x1bc548+_0xaf2c('0x7f')][_0xaf2c('0x70')]({'where':{'id':_0x4a3a61['body'][_0xaf2c('0x72')]},'include':[{'model':db[_0x1bc548+_0xaf2c('0x73')],'as':_0xaf2c('0x73')},{'model':db[_0x1bc548+_0x118e78],'as':_0xaf2c('0x6f')}]});})[_0xaf2c('0x9')](function(_0xb311e1){if(_['isNil'](_0xb311e1)){throw new Error(_0x1bc548+'\x20Message\x20not\x20found');}_0x1e403a=_0xb311e1;return _0xb311e1['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2db412={'uniqueid':_0x47b971+'.'+_0x1e403a['id']+'.'+_0x1e403a['Interaction']['id'],'FromUserId':_0x4a3a61[_0xaf2c('0x33')]['id'],'type':'queue','ToUserId':_0x25d49c['id']};_0x2db412[_0x1bc548+'MessageId']=_0x1e403a['id'];_0x2db412[_0x1bc548+_0xaf2c('0x77')]=_0x1e403a[_0xaf2c('0x73')]['id'];_0x2db412['From'+_0x1bc548+_0x118e78+'Id']=_0x1e403a[_0xaf2c('0x6f')]['id'];return db[_0x1bc548+_0xaf2c('0x80')][_0xaf2c('0x81')](_0x2db412);})[_0xaf2c('0x9')](function(){return respondWithRpcPromise(_0xaf2c('0x82'),{'channel':_0x47b971,'interaction':_0x1e403a[_0xaf2c('0x73')],'message':_0x1e403a,'account':_0x1e403a[_0xaf2c('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0xaf2c('0x3d'),'appdata':_0x25d49c[_0xaf2c('0x13')]+','+(_0x1e403a[_0xaf2c('0x6f')]['agentTransferTimeout']||0x12c),'interval':_0xaf2c('0x7a')}]},routingClient);})['then'](respondWithResult(_0x31f1d3,null))[_0xaf2c('0xe')](handleError(_0x31f1d3,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index d8ae0b1..e57e5e3 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 _0x55db=['run','post','create','put','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','/:id/run'];(function(_0x1a07ef,_0x57325f){var _0x5b4edb=function(_0x1eee30){while(--_0x1eee30){_0x1a07ef['push'](_0x1a07ef['shift']());}};_0x5b4edb(++_0x57325f);}(_0x55db,0xba));var _0xb55d=function(_0x15fd04,_0x446a35){_0x15fd04=_0x15fd04-0x0;var _0x10eee3=_0x55db[_0x15fd04];return _0x10eee3;};'use strict';var multer=require('multer');var util=require(_0xb55d('0x0'));var path=require(_0xb55d('0x1'));var timeout=require(_0xb55d('0x2'));var express=require('express');var router=express[_0xb55d('0x3')]();var fs_extra=require(_0xb55d('0x4'));var auth=require(_0xb55d('0x5'));var interaction=require(_0xb55d('0x6'));var config=require(_0xb55d('0x7'));var controller=require(_0xb55d('0x8'));router['get']('/',auth[_0xb55d('0x9')](),controller[_0xb55d('0xa')]);router[_0xb55d('0xb')](_0xb55d('0xc'),auth[_0xb55d('0x9')](),controller['show']);router[_0xb55d('0xb')](_0xb55d('0xd'),auth[_0xb55d('0x9')](),controller[_0xb55d('0xe')]);router[_0xb55d('0xf')]('/',auth[_0xb55d('0x9')](),controller[_0xb55d('0x10')]);router[_0xb55d('0x11')](_0xb55d('0xc'),auth[_0xb55d('0x9')](),controller['update']);router[_0xb55d('0x12')](_0xb55d('0xc'),auth[_0xb55d('0x9')](),controller['destroy']);module[_0xb55d('0x13')]=router; \ No newline at end of file +var _0x5087=['../../components/interaction/service','./schedule.controller','isAuthenticated','get','/:id','show','/:id/run','run','post','create','put','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x1256ca,_0x29a6c2){var _0x55fa8c=function(_0x5a173e){while(--_0x5a173e){_0x1256ca['push'](_0x1256ca['shift']());}};_0x55fa8c(++_0x29a6c2);}(_0x5087,0x13d));var _0x7508=function(_0x1f62c3,_0x1ff95b){_0x1f62c3=_0x1f62c3-0x0;var _0x385c1c=_0x5087[_0x1f62c3];return _0x385c1c;};'use strict';var multer=require(_0x7508('0x0'));var util=require(_0x7508('0x1'));var path=require('path');var timeout=require(_0x7508('0x2'));var express=require('express');var router=express[_0x7508('0x3')]();var fs_extra=require(_0x7508('0x4'));var auth=require(_0x7508('0x5'));var interaction=require(_0x7508('0x6'));var config=require('../../config/environment');var controller=require(_0x7508('0x7'));router['get']('/',auth[_0x7508('0x8')](),controller['index']);router[_0x7508('0x9')](_0x7508('0xa'),auth[_0x7508('0x8')](),controller[_0x7508('0xb')]);router['get'](_0x7508('0xc'),auth[_0x7508('0x8')](),controller[_0x7508('0xd')]);router[_0x7508('0xe')]('/',auth['isAuthenticated'](),controller[_0x7508('0xf')]);router[_0x7508('0x10')](_0x7508('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x7508('0x11')](_0x7508('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x7508('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 133ab78..851645a 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 _0x15f6=['custom','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','months','weeks','days','hours','csv','default'];(function(_0x5a3d49,_0x24b21a){var _0x4d5c23=function(_0x4f62b0){while(--_0x4f62b0){_0x5a3d49['push'](_0x5a3d49['shift']());}};_0x4d5c23(++_0x24b21a);}(_0x15f6,0x9c));var _0x615f=function(_0x5da06f,_0x3dcd03){_0x5da06f=_0x5da06f-0x0;var _0x853a39=_0x15f6[_0x5da06f];return _0x853a39;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x615f('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x615f('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x615f('0x0')],'allowNull':![],'defaultValue':_0x615f('0x2')},'startAt':{'type':Sequelize[_0x615f('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x615f('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x615f('0x4')](_0x615f('0x5'),'quarters',_0x615f('0x6'),_0x615f('0x7'),_0x615f('0x8'),_0x615f('0x9'),'minutes'),'allowNull':![],'defaultValue':_0x615f('0x8')},'output':{'type':Sequelize[_0x615f('0x4')](_0x615f('0xa'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0x615f('0xa')},'type':{'type':Sequelize['ENUM']('custom',_0x615f('0xb')),'allowNull':![],'defaultValue':_0x615f('0xc')},'sendMail':{'type':Sequelize[_0x615f('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x615f('0x0')]},'cc':{'type':Sequelize[_0x615f('0xd')]},'bcc':{'type':Sequelize[_0x615f('0xd')]},'sendIfEmpty':{'type':Sequelize[_0x615f('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xccc3=['xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','INTEGER','ENUM','years','quarters','months','days','hours','csv','pdf'];(function(_0x538f68,_0x220e16){var _0x1467d5=function(_0x67e640){while(--_0x67e640){_0x538f68['push'](_0x538f68['shift']());}};_0x1467d5(++_0x220e16);}(_0xccc3,0x1b4));var _0x3ccc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xccc3[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x3ccc('0x0'));module[_0x3ccc('0x1')]={'name':{'type':Sequelize[_0x3ccc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3ccc('0x2')]},'active':{'type':Sequelize[_0x3ccc('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x3ccc('0x2')],'allowNull':![],'defaultValue':_0x3ccc('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x3ccc('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x3ccc('0x6')](_0x3ccc('0x7'),_0x3ccc('0x8'),_0x3ccc('0x9'),'weeks',_0x3ccc('0xa'),_0x3ccc('0xb'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x3ccc('0x6')](_0x3ccc('0xc'),_0x3ccc('0xd'),_0x3ccc('0xe')),'allowNull':![],'defaultValue':_0x3ccc('0xc')},'type':{'type':Sequelize[_0x3ccc('0x6')](_0x3ccc('0xf'),_0x3ccc('0x10')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x3ccc('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x3ccc('0x2')]},'cc':{'type':Sequelize[_0x3ccc('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x3ccc('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 774ad0f..62109da 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 _0x3ed7=['filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','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','update','params','run','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','then','destroy','get','Scheduler','UserProfileResource','stack','name','send','map','Schedule','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick'];(function(_0x5c40c9,_0x4c4a67){var _0x1906c4=function(_0x4d4e78){while(--_0x4d4e78){_0x5c40c9['push'](_0x5c40c9['shift']());}};_0x1906c4(++_0x4c4a67);}(_0x3ed7,0xc2));var _0x73ed=function(_0x16dffa,_0x17009d){_0x16dffa=_0x16dffa-0x0;var _0x16ae09=_0x3ed7[_0x16dffa];return _0x16ae09;};'use strict';var emlformat=require(_0x73ed('0x0'));var rimraf=require(_0x73ed('0x1'));var zipdir=require(_0x73ed('0x2'));var jsonpatch=require(_0x73ed('0x3'));var rp=require('request-promise');var moment=require(_0x73ed('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x73ed('0x5'));var util=require('util');var path=require('path');var sox=require(_0x73ed('0x6'));var csv=require(_0x73ed('0x7'));var ejs=require(_0x73ed('0x8'));var fs=require('fs');var fs_extra=require(_0x73ed('0x9'));var _=require('lodash');var squel=require(_0x73ed('0xa'));var crypto=require(_0x73ed('0xb'));var jsforce=require(_0x73ed('0xc'));var deskjs=require(_0x73ed('0xd'));var toCsv=require('to-csv');var querystring=require(_0x73ed('0xe'));var Papa=require(_0x73ed('0xf'));var Redis=require(_0x73ed('0x10'));var authService=require(_0x73ed('0x11'));var qs=require(_0x73ed('0x12'));var as=require(_0x73ed('0x13'));var hardwareService=require(_0x73ed('0x14'));var logger=require(_0x73ed('0x15'))('api');var utils=require(_0x73ed('0x16'));var config=require(_0x73ed('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2260a6,_0x2c33fa){_0x2c33fa=_0x2c33fa||0xcc;return function(_0x40c84f){if(_0x40c84f){return _0x2260a6[_0x73ed('0x18')](_0x2c33fa);}return _0x2260a6[_0x73ed('0x19')](_0x2c33fa)[_0x73ed('0x1a')]();};}function respondWithResult(_0x25a3ee,_0x394236){_0x394236=_0x394236||0xc8;return function(_0x3a059d){if(_0x3a059d){return _0x25a3ee[_0x73ed('0x19')](_0x394236)['json'](_0x3a059d);}};}function respondWithFilteredResult(_0x20b179,_0x54219d){return function(_0x303963){if(_0x303963){var _0x21bb92=typeof _0x54219d[_0x73ed('0x1b')]==='undefined'&&typeof _0x54219d[_0x73ed('0x1c')]===_0x73ed('0x1d');var _0xe53d97=_0x303963[_0x73ed('0x1e')];var _0x1164b0=_0x21bb92?0x0:_0x54219d[_0x73ed('0x1b')];var _0x2cb729=_0x21bb92?_0x303963['count']:_0x54219d['offset']+_0x54219d[_0x73ed('0x1c')];var _0x87f769;if(_0x2cb729>=_0xe53d97){_0x2cb729=_0xe53d97;_0x87f769=0xc8;}else{_0x87f769=0xce;}_0x20b179[_0x73ed('0x19')](_0x87f769);return _0x20b179[_0x73ed('0x1f')](_0x73ed('0x20'),_0x1164b0+'-'+_0x2cb729+'/'+_0xe53d97)[_0x73ed('0x21')](_0x303963);}return null;};}function patchUpdates(_0x3e9cab){return function(_0x230f29){try{jsonpatch[_0x73ed('0x22')](_0x230f29,_0x3e9cab,!![]);}catch(_0x2c8260){return BPromise[_0x73ed('0x23')](_0x2c8260);}return _0x230f29['save']();};}function saveUpdates(_0x212fae,_0x17100d){return function(_0x566f49){if(_0x566f49){return _0x566f49['update'](_0x212fae)[_0x73ed('0x24')](function(_0xc77cc2){return _0xc77cc2;});}return null;};}function removeEntity(_0x24cd84,_0x144ea7){return function(_0x315cef){if(_0x315cef){return _0x315cef[_0x73ed('0x25')]()[_0x73ed('0x24')](function(){var _0x1adfcf=_0x315cef[_0x73ed('0x26')]({'plain':!![]});var _0xe5213f=_0x73ed('0x27');return db[_0x73ed('0x28')][_0x73ed('0x25')]({'where':{'type':_0xe5213f,'resourceId':_0x1adfcf['id']}})[_0x73ed('0x24')](function(){return _0x315cef;});})[_0x73ed('0x24')](function(){_0x24cd84[_0x73ed('0x19')](0xcc)[_0x73ed('0x1a')]();});}};}function handleEntityNotFound(_0x2769b1,_0x2c4155){return function(_0x408b17){if(!_0x408b17){_0x2769b1['sendStatus'](0x194);}return _0x408b17;};}function handleError(_0x44daae,_0x5a5060){_0x5a5060=_0x5a5060||0x1f4;return function(_0x142584){logger['error'](_0x142584[_0x73ed('0x29')]);if(_0x142584['name']){delete _0x142584[_0x73ed('0x2a')];}_0x44daae[_0x73ed('0x19')](_0x5a5060)[_0x73ed('0x2b')](_0x142584);};}exports['index']=function(_0x5b988b,_0x559530){var _0x5f0269={},_0x112a09={},_0x594c7c={'count':0x0,'rows':[]};var _0x73fb93=_[_0x73ed('0x2c')](db[_0x73ed('0x2d')][_0x73ed('0x2e')],function(_0x59089b){return{'name':_0x59089b[_0x73ed('0x2f')],'type':_0x59089b['type'][_0x73ed('0x30')]};});_0x112a09[_0x73ed('0x31')]=_[_0x73ed('0x2c')](_0x73fb93,_0x73ed('0x2a'));_0x112a09[_0x73ed('0x32')]=_[_0x73ed('0x33')](_0x5b988b[_0x73ed('0x32')]);_0x112a09[_0x73ed('0x34')]=_[_0x73ed('0x35')](_0x112a09[_0x73ed('0x31')],_0x112a09['query']);_0x5f0269[_0x73ed('0x36')]=_[_0x73ed('0x35')](_0x112a09[_0x73ed('0x31')],qs['fields'](_0x5b988b[_0x73ed('0x32')][_0x73ed('0x37')]));_0x5f0269[_0x73ed('0x36')]=_0x5f0269[_0x73ed('0x36')][_0x73ed('0x38')]?_0x5f0269[_0x73ed('0x36')]:_0x112a09[_0x73ed('0x31')];if(!_0x5b988b[_0x73ed('0x32')][_0x73ed('0x39')]('nolimit')){_0x5f0269[_0x73ed('0x1c')]=qs[_0x73ed('0x1c')](_0x5b988b[_0x73ed('0x32')][_0x73ed('0x1c')]);_0x5f0269['offset']=qs[_0x73ed('0x1b')](_0x5b988b['query'][_0x73ed('0x1b')]);}_0x5f0269[_0x73ed('0x3a')]=qs[_0x73ed('0x3b')](_0x5b988b[_0x73ed('0x32')][_0x73ed('0x3b')]);_0x5f0269['where']=qs['filters'](_[_0x73ed('0x3c')](_0x5b988b[_0x73ed('0x32')],_0x112a09['filters']),_0x73fb93);if(_0x5b988b[_0x73ed('0x32')][_0x73ed('0x3d')]){_0x5f0269[_0x73ed('0x3e')]=_[_0x73ed('0x3f')](_0x5f0269[_0x73ed('0x3e')],{'$or':_[_0x73ed('0x2c')](_0x73fb93,function(_0x12f0b4){if(_0x12f0b4['type']!==_0x73ed('0x40')){var _0x2c7288={};_0x2c7288[_0x12f0b4[_0x73ed('0x2a')]]={'$like':'%'+_0x5b988b[_0x73ed('0x32')][_0x73ed('0x3d')]+'%'};return _0x2c7288;}})});}_0x5f0269=_[_0x73ed('0x3f')]({},_0x5f0269,_0x5b988b[_0x73ed('0x41')]);var _0x189b7c={'where':_0x5f0269['where']};return db['Schedule'][_0x73ed('0x1e')](_0x189b7c)[_0x73ed('0x24')](function(_0x4ba8f8){_0x594c7c['count']=_0x4ba8f8;if(_0x5b988b['query'][_0x73ed('0x42')]){_0x5f0269[_0x73ed('0x43')]=[{'all':!![]}];}return db[_0x73ed('0x2d')][_0x73ed('0x44')](_0x5f0269);})[_0x73ed('0x24')](function(_0x4811d0){_0x594c7c[_0x73ed('0x45')]=_0x4811d0;return _0x594c7c;})[_0x73ed('0x24')](respondWithFilteredResult(_0x559530,_0x5f0269))[_0x73ed('0x46')](handleError(_0x559530,null));};exports['show']=function(_0x18dff8,_0x3e00a4){var _0x2148f={'raw':![],'where':{'id':_0x18dff8['params']['id']}},_0x1e1e34={};_0x1e1e34[_0x73ed('0x31')]=_[_0x73ed('0x33')](db[_0x73ed('0x2d')]['rawAttributes']);_0x1e1e34[_0x73ed('0x32')]=_[_0x73ed('0x33')](_0x18dff8[_0x73ed('0x32')]);_0x1e1e34[_0x73ed('0x34')]=_['intersection'](_0x1e1e34[_0x73ed('0x31')],_0x1e1e34[_0x73ed('0x32')]);_0x2148f['attributes']=_[_0x73ed('0x35')](_0x1e1e34['model'],qs['fields'](_0x18dff8[_0x73ed('0x32')][_0x73ed('0x37')]));_0x2148f['attributes']=_0x2148f[_0x73ed('0x36')][_0x73ed('0x38')]?_0x2148f[_0x73ed('0x36')]:_0x1e1e34[_0x73ed('0x31')];if(_0x18dff8[_0x73ed('0x32')][_0x73ed('0x42')]){_0x2148f[_0x73ed('0x43')]=[{'all':!![]}];}_0x2148f=_[_0x73ed('0x3f')]({},_0x2148f,_0x18dff8[_0x73ed('0x41')]);return db[_0x73ed('0x2d')][_0x73ed('0x47')](_0x2148f)['then'](handleEntityNotFound(_0x3e00a4,null))[_0x73ed('0x24')](respondWithResult(_0x3e00a4,null))[_0x73ed('0x46')](handleError(_0x3e00a4,null));};exports[_0x73ed('0x48')]=function(_0x490b0b,_0x25df1e){return db[_0x73ed('0x2d')][_0x73ed('0x48')](_0x490b0b[_0x73ed('0x49')],{})['then'](function(_0x4dd78a){var _0x583092=_0x490b0b[_0x73ed('0x4a')][_0x73ed('0x26')]({'plain':!![]});if(!_0x583092)throw new Error(_0x73ed('0x4b'));if(_0x583092[_0x73ed('0x4c')]==='user'){var _0x2fcfc9=_0x4dd78a[_0x73ed('0x26')]({'plain':!![]});var _0x3e9b54=_0x73ed('0x27');return db[_0x73ed('0x4d')][_0x73ed('0x47')]({'where':{'name':_0x3e9b54,'userProfileId':_0x583092[_0x73ed('0x4e')]},'raw':!![]})[_0x73ed('0x24')](function(_0x150bf2){if(_0x150bf2&&_0x150bf2[_0x73ed('0x4f')]===0x0){return db[_0x73ed('0x28')][_0x73ed('0x48')]({'name':_0x2fcfc9['name'],'resourceId':_0x2fcfc9['id'],'type':_0x150bf2[_0x73ed('0x2a')],'sectionId':_0x150bf2['id']},{})[_0x73ed('0x24')](function(){return _0x4dd78a;});}else{return _0x4dd78a;}})[_0x73ed('0x46')](function(_0x25a0a1){logger[_0x73ed('0x50')](_0x73ed('0x51'),_0x25a0a1);throw _0x25a0a1;});}return _0x4dd78a;})['then'](respondWithResult(_0x25df1e,0xc9))[_0x73ed('0x46')](handleError(_0x25df1e,null));};exports[_0x73ed('0x52')]=function(_0x1d296e,_0x175c52){if(_0x1d296e[_0x73ed('0x49')]['id']){delete _0x1d296e[_0x73ed('0x49')]['id'];}return db[_0x73ed('0x2d')][_0x73ed('0x47')]({'where':{'id':_0x1d296e[_0x73ed('0x53')]['id']}})[_0x73ed('0x24')](handleEntityNotFound(_0x175c52,null))[_0x73ed('0x24')](saveUpdates(_0x1d296e['body'],null))[_0x73ed('0x24')](respondWithResult(_0x175c52,null))['catch'](handleError(_0x175c52,null));};exports[_0x73ed('0x25')]=function(_0x1a61f9,_0x43f3f3){return db['Schedule'][_0x73ed('0x47')]({'where':{'id':_0x1a61f9[_0x73ed('0x53')]['id']}})[_0x73ed('0x24')](handleEntityNotFound(_0x43f3f3,null))[_0x73ed('0x24')](removeEntity(_0x43f3f3,null))['catch'](handleError(_0x43f3f3,null));};exports[_0x73ed('0x54')]=function(_0x38e126,_0x462af2,_0x407d68){var _0x33acb8=require('../../config/schedule');return db[_0x73ed('0x2d')][_0x73ed('0x47')]({'where':{'id':_0x38e126[_0x73ed('0x53')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x462af2,null))[_0x73ed('0x24')](function(){_0x33acb8[_0x73ed('0x54')](_0x38e126['params']['id']);})[_0x73ed('0x24')](respondWithStatusCode(_0x462af2,null))[_0x73ed('0x46')](handleError(_0x462af2,null));}; \ No newline at end of file +var _0xf7e9=['../../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','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','send','index','map','Schedule','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x23ca2e,_0x19758d){var _0x266df8=function(_0x13c227){while(--_0x13c227){_0x23ca2e['push'](_0x23ca2e['shift']());}};_0x266df8(++_0x19758d);}(_0xf7e9,0xf5));var _0x9f7e=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0xf7e9[_0x4c7935];return _0x30651d;};'use strict';var emlformat=require(_0x9f7e('0x0'));var rimraf=require(_0x9f7e('0x1'));var zipdir=require(_0x9f7e('0x2'));var jsonpatch=require(_0x9f7e('0x3'));var rp=require(_0x9f7e('0x4'));var moment=require(_0x9f7e('0x5'));var BPromise=require(_0x9f7e('0x6'));var Mustache=require(_0x9f7e('0x7'));var util=require(_0x9f7e('0x8'));var path=require('path');var sox=require(_0x9f7e('0x9'));var csv=require(_0x9f7e('0xa'));var ejs=require(_0x9f7e('0xb'));var fs=require('fs');var fs_extra=require(_0x9f7e('0xc'));var _=require(_0x9f7e('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9f7e('0xe'));var deskjs=require(_0x9f7e('0xf'));var toCsv=require(_0x9f7e('0xa'));var querystring=require('querystring');var Papa=require(_0x9f7e('0x10'));var Redis=require(_0x9f7e('0x11'));var authService=require(_0x9f7e('0x12'));var qs=require(_0x9f7e('0x13'));var as=require(_0x9f7e('0x14'));var hardwareService=require(_0x9f7e('0x15'));var logger=require(_0x9f7e('0x16'))(_0x9f7e('0x17'));var utils=require(_0x9f7e('0x18'));var config=require(_0x9f7e('0x19'));var licenseUtil=require(_0x9f7e('0x1a'));var db=require(_0x9f7e('0x1b'))['db'];function respondWithStatusCode(_0x42cada,_0x552cc3){_0x552cc3=_0x552cc3||0xcc;return function(_0x239873){if(_0x239873){return _0x42cada[_0x9f7e('0x1c')](_0x552cc3);}return _0x42cada['status'](_0x552cc3)['end']();};}function respondWithResult(_0x52433a,_0xed7872){_0xed7872=_0xed7872||0xc8;return function(_0xc7750c){if(_0xc7750c){return _0x52433a['status'](_0xed7872)[_0x9f7e('0x1d')](_0xc7750c);}};}function respondWithFilteredResult(_0x5b3005,_0x384cb5){return function(_0x16d4f6){if(_0x16d4f6){var _0x396504=typeof _0x384cb5[_0x9f7e('0x1e')]===_0x9f7e('0x1f')&&typeof _0x384cb5['limit']===_0x9f7e('0x1f');var _0x5886fe=_0x16d4f6[_0x9f7e('0x20')];var _0x16ebdf=_0x396504?0x0:_0x384cb5[_0x9f7e('0x1e')];var _0x21e411=_0x396504?_0x16d4f6['count']:_0x384cb5['offset']+_0x384cb5[_0x9f7e('0x21')];var _0x32fa20;if(_0x21e411>=_0x5886fe){_0x21e411=_0x5886fe;_0x32fa20=0xc8;}else{_0x32fa20=0xce;}_0x5b3005[_0x9f7e('0x22')](_0x32fa20);return _0x5b3005[_0x9f7e('0x23')](_0x9f7e('0x24'),_0x16ebdf+'-'+_0x21e411+'/'+_0x5886fe)['json'](_0x16d4f6);}return null;};}function patchUpdates(_0x1802c9){return function(_0x23c9e0){try{jsonpatch[_0x9f7e('0x25')](_0x23c9e0,_0x1802c9,!![]);}catch(_0x1af375){return BPromise[_0x9f7e('0x26')](_0x1af375);}return _0x23c9e0[_0x9f7e('0x27')]();};}function saveUpdates(_0x3af88d,_0x4bc81d){return function(_0x36a0e5){if(_0x36a0e5){return _0x36a0e5[_0x9f7e('0x28')](_0x3af88d)[_0x9f7e('0x29')](function(_0x3977c2){return _0x3977c2;});}return null;};}function removeEntity(_0x35d53b,_0x43233c){return function(_0x3fca7a){if(_0x3fca7a){return _0x3fca7a[_0x9f7e('0x2a')]()['then'](function(){var _0x20317c=_0x3fca7a[_0x9f7e('0x2b')]({'plain':!![]});var _0x329181='Scheduler';return db[_0x9f7e('0x2c')][_0x9f7e('0x2a')]({'where':{'type':_0x329181,'resourceId':_0x20317c['id']}})[_0x9f7e('0x29')](function(){return _0x3fca7a;});})[_0x9f7e('0x29')](function(){_0x35d53b['status'](0xcc)[_0x9f7e('0x2d')]();});}};}function handleEntityNotFound(_0x4e77c5,_0x5a31f1){return function(_0x514e0a){if(!_0x514e0a){_0x4e77c5[_0x9f7e('0x1c')](0x194);}return _0x514e0a;};}function handleError(_0x1fa7f1,_0x2226c5){_0x2226c5=_0x2226c5||0x1f4;return function(_0x23937d){logger['error'](_0x23937d[_0x9f7e('0x2e')]);if(_0x23937d[_0x9f7e('0x2f')]){delete _0x23937d[_0x9f7e('0x2f')];}_0x1fa7f1[_0x9f7e('0x22')](_0x2226c5)[_0x9f7e('0x30')](_0x23937d);};}exports[_0x9f7e('0x31')]=function(_0x1c4796,_0xfc7806){var _0x2a60f7={},_0x3a345d={},_0x59a093={'count':0x0,'rows':[]};var _0x31c358=_[_0x9f7e('0x32')](db[_0x9f7e('0x33')]['rawAttributes'],function(_0x256085){return{'name':_0x256085[_0x9f7e('0x34')],'type':_0x256085[_0x9f7e('0x35')][_0x9f7e('0x36')]};});_0x3a345d[_0x9f7e('0x37')]=_[_0x9f7e('0x32')](_0x31c358,_0x9f7e('0x2f'));_0x3a345d[_0x9f7e('0x38')]=_[_0x9f7e('0x39')](_0x1c4796[_0x9f7e('0x38')]);_0x3a345d[_0x9f7e('0x3a')]=_[_0x9f7e('0x3b')](_0x3a345d['model'],_0x3a345d[_0x9f7e('0x38')]);_0x2a60f7[_0x9f7e('0x3c')]=_[_0x9f7e('0x3b')](_0x3a345d[_0x9f7e('0x37')],qs[_0x9f7e('0x3d')](_0x1c4796[_0x9f7e('0x38')]['fields']));_0x2a60f7[_0x9f7e('0x3c')]=_0x2a60f7[_0x9f7e('0x3c')][_0x9f7e('0x3e')]?_0x2a60f7['attributes']:_0x3a345d[_0x9f7e('0x37')];if(!_0x1c4796[_0x9f7e('0x38')][_0x9f7e('0x3f')](_0x9f7e('0x40'))){_0x2a60f7[_0x9f7e('0x21')]=qs['limit'](_0x1c4796['query'][_0x9f7e('0x21')]);_0x2a60f7[_0x9f7e('0x1e')]=qs[_0x9f7e('0x1e')](_0x1c4796['query'][_0x9f7e('0x1e')]);}_0x2a60f7[_0x9f7e('0x41')]=qs[_0x9f7e('0x42')](_0x1c4796['query'][_0x9f7e('0x42')]);_0x2a60f7['where']=qs[_0x9f7e('0x3a')](_[_0x9f7e('0x43')](_0x1c4796[_0x9f7e('0x38')],_0x3a345d['filters']),_0x31c358);if(_0x1c4796[_0x9f7e('0x38')][_0x9f7e('0x44')]){_0x2a60f7[_0x9f7e('0x45')]=_[_0x9f7e('0x46')](_0x2a60f7[_0x9f7e('0x45')],{'$or':_[_0x9f7e('0x32')](_0x31c358,function(_0x174d40){if(_0x174d40[_0x9f7e('0x35')]!==_0x9f7e('0x47')){var _0x48218c={};_0x48218c[_0x174d40['name']]={'$like':'%'+_0x1c4796[_0x9f7e('0x38')][_0x9f7e('0x44')]+'%'};return _0x48218c;}})});}_0x2a60f7=_[_0x9f7e('0x46')]({},_0x2a60f7,_0x1c4796[_0x9f7e('0x48')]);var _0x344296={'where':_0x2a60f7[_0x9f7e('0x45')]};return db[_0x9f7e('0x33')][_0x9f7e('0x20')](_0x344296)[_0x9f7e('0x29')](function(_0x197d66){_0x59a093[_0x9f7e('0x20')]=_0x197d66;if(_0x1c4796['query'][_0x9f7e('0x49')]){_0x2a60f7[_0x9f7e('0x4a')]=[{'all':!![]}];}return db['Schedule'][_0x9f7e('0x4b')](_0x2a60f7);})[_0x9f7e('0x29')](function(_0x3d84b8){_0x59a093['rows']=_0x3d84b8;return _0x59a093;})[_0x9f7e('0x29')](respondWithFilteredResult(_0xfc7806,_0x2a60f7))[_0x9f7e('0x4c')](handleError(_0xfc7806,null));};exports[_0x9f7e('0x4d')]=function(_0xebafc7,_0x58174b){var _0x460ae0={'raw':![],'where':{'id':_0xebafc7[_0x9f7e('0x4e')]['id']}},_0x288c0b={};_0x288c0b[_0x9f7e('0x37')]=_[_0x9f7e('0x39')](db[_0x9f7e('0x33')]['rawAttributes']);_0x288c0b[_0x9f7e('0x38')]=_[_0x9f7e('0x39')](_0xebafc7[_0x9f7e('0x38')]);_0x288c0b[_0x9f7e('0x3a')]=_[_0x9f7e('0x3b')](_0x288c0b[_0x9f7e('0x37')],_0x288c0b['query']);_0x460ae0[_0x9f7e('0x3c')]=_[_0x9f7e('0x3b')](_0x288c0b[_0x9f7e('0x37')],qs[_0x9f7e('0x3d')](_0xebafc7[_0x9f7e('0x38')][_0x9f7e('0x3d')]));_0x460ae0['attributes']=_0x460ae0[_0x9f7e('0x3c')][_0x9f7e('0x3e')]?_0x460ae0[_0x9f7e('0x3c')]:_0x288c0b[_0x9f7e('0x37')];if(_0xebafc7[_0x9f7e('0x38')][_0x9f7e('0x49')]){_0x460ae0[_0x9f7e('0x4a')]=[{'all':!![]}];}_0x460ae0=_[_0x9f7e('0x46')]({},_0x460ae0,_0xebafc7[_0x9f7e('0x48')]);return db[_0x9f7e('0x33')][_0x9f7e('0x4f')](_0x460ae0)[_0x9f7e('0x29')](handleEntityNotFound(_0x58174b,null))['then'](respondWithResult(_0x58174b,null))['catch'](handleError(_0x58174b,null));};exports[_0x9f7e('0x50')]=function(_0x51cd2d,_0x1beb37){return db[_0x9f7e('0x33')][_0x9f7e('0x50')](_0x51cd2d[_0x9f7e('0x51')],{})['then'](function(_0x11c8d1){var _0x16f8e0=_0x51cd2d[_0x9f7e('0x52')]['get']({'plain':!![]});if(!_0x16f8e0)throw new Error(_0x9f7e('0x53'));if(_0x16f8e0['role']===_0x9f7e('0x52')){var _0x294fa7=_0x11c8d1[_0x9f7e('0x2b')]({'plain':!![]});var _0x91b20a='Scheduler';return db[_0x9f7e('0x54')]['find']({'where':{'name':_0x91b20a,'userProfileId':_0x16f8e0[_0x9f7e('0x55')]},'raw':!![]})[_0x9f7e('0x29')](function(_0x326e16){if(_0x326e16&&_0x326e16[_0x9f7e('0x56')]===0x0){return db[_0x9f7e('0x2c')][_0x9f7e('0x50')]({'name':_0x294fa7['name'],'resourceId':_0x294fa7['id'],'type':_0x326e16[_0x9f7e('0x2f')],'sectionId':_0x326e16['id']},{})['then'](function(){return _0x11c8d1;});}else{return _0x11c8d1;}})['catch'](function(_0x1e9cd4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e9cd4);throw _0x1e9cd4;});}return _0x11c8d1;})[_0x9f7e('0x29')](respondWithResult(_0x1beb37,0xc9))[_0x9f7e('0x4c')](handleError(_0x1beb37,null));};exports[_0x9f7e('0x28')]=function(_0x3ee912,_0xb7432e){if(_0x3ee912['body']['id']){delete _0x3ee912[_0x9f7e('0x51')]['id'];}return db[_0x9f7e('0x33')]['find']({'where':{'id':_0x3ee912[_0x9f7e('0x4e')]['id']}})[_0x9f7e('0x29')](handleEntityNotFound(_0xb7432e,null))['then'](saveUpdates(_0x3ee912[_0x9f7e('0x51')],null))[_0x9f7e('0x29')](respondWithResult(_0xb7432e,null))['catch'](handleError(_0xb7432e,null));};exports['destroy']=function(_0x28f7b9,_0x4ec1e3){return db[_0x9f7e('0x33')]['find']({'where':{'id':_0x28f7b9[_0x9f7e('0x4e')]['id']}})[_0x9f7e('0x29')](handleEntityNotFound(_0x4ec1e3,null))[_0x9f7e('0x29')](removeEntity(_0x4ec1e3,null))[_0x9f7e('0x4c')](handleError(_0x4ec1e3,null));};exports[_0x9f7e('0x57')]=function(_0x571520,_0x1b172d,_0x29d07d){var _0x452d5f=require('../../config/schedule');return db[_0x9f7e('0x33')]['find']({'where':{'id':_0x571520[_0x9f7e('0x4e')]['id']},'raw':!![]})[_0x9f7e('0x29')](handleEntityNotFound(_0x1b172d,null))[_0x9f7e('0x29')](function(){_0x452d5f[_0x9f7e('0x57')](_0x571520[_0x9f7e('0x4e')]['id']);})['then'](respondWithStatusCode(_0x1b172d,null))[_0x9f7e('0x4c')](handleError(_0x1b172d,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index e4ba326..ac4bd5c 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 _0xe0d5=['api','moment','request-promise','path','rimraf','./schedule.attributes','tools_schedules','lodash','util','../../config/logger'];(function(_0x442f02,_0x47d845){var _0xab6ef1=function(_0x4cad5c){while(--_0x4cad5c){_0x442f02['push'](_0x442f02['shift']());}};_0xab6ef1(++_0x47d845);}(_0xe0d5,0xb1));var _0x5e0d=function(_0x16a7c9,_0x277f34){_0x16a7c9=_0x16a7c9-0x0;var _0x17bd6d=_0xe0d5[_0x16a7c9];return _0x17bd6d;};'use strict';var _=require(_0x5e0d('0x0'));var util=require(_0x5e0d('0x1'));var logger=require(_0x5e0d('0x2'))(_0x5e0d('0x3'));var moment=require(_0x5e0d('0x4'));var BPromise=require('bluebird');var rp=require(_0x5e0d('0x5'));var fs=require('fs');var path=require(_0x5e0d('0x6'));var rimraf=require(_0x5e0d('0x7'));var config=require('../../config/environment');var attributes=require(_0x5e0d('0x8'));module['exports']=function(_0x22593a,_0x36cef8){return _0x22593a['define']('Schedule',attributes,{'tableName':_0x5e0d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2baf=['rimraf','exports','Schedule','tools_schedules','lodash','util','../../config/logger','bluebird','path'];(function(_0x40d112,_0x1711fa){var _0x527f38=function(_0x2683c4){while(--_0x2683c4){_0x40d112['push'](_0x40d112['shift']());}};_0x527f38(++_0x1711fa);}(_0x2baf,0x1cf));var _0xf2ba=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0x2baf[_0x5ac84c];return _0x3c53d2;};'use strict';var _=require(_0xf2ba('0x0'));var util=require(_0xf2ba('0x1'));var logger=require(_0xf2ba('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf2ba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2ba('0x4'));var rimraf=require(_0xf2ba('0x5'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0xf2ba('0x6')]=function(_0xd3dcdd,_0x1ebe62){return _0xd3dcdd['define'](_0xf2ba('0x7'),attributes,{'tableName':_0xf2ba('0x8'),'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 b9937ad..274a2de 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 _0xcfb0=['bluebird','randomstring','../../mysqldb','rpc','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0x16ae27,_0x3d0212){var _0x4871c5=function(_0x1f226c){while(--_0x1f226c){_0x16ae27['push'](_0x16ae27['shift']());}};_0x4871c5(++_0x3d0212);}(_0xcfb0,0x13d));var _0x0cfb=function(_0x4f9914,_0x2286cb){_0x4f9914=_0x4f9914-0x0;var _0x1d4984=_0xcfb0[_0x4f9914];return _0x1d4984;};'use strict';var _=require(_0x0cfb('0x0'));var util=require(_0x0cfb('0x1'));var moment=require(_0x0cfb('0x2'));var BPromise=require(_0x0cfb('0x3'));var rs=require(_0x0cfb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cfb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0cfb('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0cfb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34767f,_0x392592,_0x386f97){return new BPromise(function(_0x3f8fd1,_0x592041){return client[_0x0cfb('0x8')](_0x34767f,_0x386f97)[_0x0cfb('0x9')](function(_0x49ac2b){logger['info'](_0x0cfb('0xa'),_0x392592,_0x0cfb('0xb'));logger[_0x0cfb('0xc')](_0x0cfb('0xd'),_0x392592,_0x0cfb('0xb'),JSON[_0x0cfb('0xe')](_0x49ac2b));if(_0x49ac2b[_0x0cfb('0xf')]){if(_0x49ac2b['error']['code']===0x1f4){logger[_0x0cfb('0xf')]('Schedule,\x20%s,\x20%s',_0x392592,_0x49ac2b[_0x0cfb('0xf')][_0x0cfb('0x10')]);return _0x592041(_0x49ac2b[_0x0cfb('0xf')][_0x0cfb('0x10')]);}logger[_0x0cfb('0xf')](_0x0cfb('0xa'),_0x392592,_0x49ac2b[_0x0cfb('0xf')][_0x0cfb('0x10')]);return _0x3f8fd1(_0x49ac2b[_0x0cfb('0xf')]['message']);}else{logger[_0x0cfb('0x11')](_0x0cfb('0xa'),_0x392592,_0x0cfb('0xb'));_0x3f8fd1(_0x49ac2b[_0x0cfb('0x12')][_0x0cfb('0x10')]);}})[_0x0cfb('0x13')](function(_0xf5e170){logger[_0x0cfb('0xf')]('Schedule,\x20%s,\x20%s',_0x392592,_0xf5e170);_0x592041(_0xf5e170);});});} \ No newline at end of file +var _0xc89c=['Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x279d95,_0x2389ca){var _0x5725e7=function(_0x1a3d0e){while(--_0x1a3d0e){_0x279d95['push'](_0x279d95['shift']());}};_0x5725e7(++_0x2389ca);}(_0xc89c,0x177));var _0xcc89=function(_0x790db,_0x2adc54){_0x790db=_0x790db-0x0;var _0x405b9c=_0xc89c[_0x790db];return _0x405b9c;};'use strict';var _=require(_0xcc89('0x0'));var util=require(_0xcc89('0x1'));var moment=require(_0xcc89('0x2'));var BPromise=require(_0xcc89('0x3'));var rs=require(_0xcc89('0x4'));var fs=require('fs');var Redis=require(_0xcc89('0x5'));var db=require(_0xcc89('0x6'))['db'];var utils=require(_0xcc89('0x7'));var logger=require(_0xcc89('0x8'))(_0xcc89('0x9'));var config=require('../../config/environment');var jayson=require(_0xcc89('0xa'));var client=jayson[_0xcc89('0xb')][_0xcc89('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x506c1c,_0xa47449,_0x30ff2a){return new BPromise(function(_0x17d80c,_0x3fa1f0){return client[_0xcc89('0xd')](_0x506c1c,_0x30ff2a)[_0xcc89('0xe')](function(_0x4d0ddd){logger[_0xcc89('0xf')](_0xcc89('0x10'),_0xa47449,_0xcc89('0x11'));logger[_0xcc89('0x12')]('Schedule,\x20%s,\x20%s,\x20%s',_0xa47449,_0xcc89('0x11'),JSON[_0xcc89('0x13')](_0x4d0ddd));if(_0x4d0ddd[_0xcc89('0x14')]){if(_0x4d0ddd['error']['code']===0x1f4){logger[_0xcc89('0x14')]('Schedule,\x20%s,\x20%s',_0xa47449,_0x4d0ddd[_0xcc89('0x14')][_0xcc89('0x15')]);return _0x3fa1f0(_0x4d0ddd[_0xcc89('0x14')][_0xcc89('0x15')]);}logger[_0xcc89('0x14')]('Schedule,\x20%s,\x20%s',_0xa47449,_0x4d0ddd[_0xcc89('0x14')][_0xcc89('0x15')]);return _0x17d80c(_0x4d0ddd['error'][_0xcc89('0x15')]);}else{logger[_0xcc89('0xf')](_0xcc89('0x10'),_0xa47449,_0xcc89('0x11'));_0x17d80c(_0x4d0ddd[_0xcc89('0x16')][_0xcc89('0x15')]);}})['catch'](function(_0x323ab1){logger[_0xcc89('0x14')]('Schedule,\x20%s,\x20%s',_0xa47449,_0x323ab1);_0x3fa1f0(_0x323ab1);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index f2d06d1..e3f22dc 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 _0x1e43=['index','get','/describe','isAuthenticated','/:id','show','/:id/download','post','put','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller'];(function(_0x4d6416,_0x5c5095){var _0x233005=function(_0x2889c6){while(--_0x2889c6){_0x4d6416['push'](_0x4d6416['shift']());}};_0x233005(++_0x5c5095);}(_0x1e43,0x13b));var _0x31e4=function(_0x53ad58,_0x3fb489){_0x53ad58=_0x53ad58-0x0;var _0x554b03=_0x1e43[_0x53ad58];return _0x554b03;};'use strict';var multer=require('multer');var util=require(_0x31e4('0x0'));var path=require(_0x31e4('0x1'));var timeout=require(_0x31e4('0x2'));var express=require(_0x31e4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x31e4('0x4'));var interaction=require(_0x31e4('0x5'));var config=require(_0x31e4('0x6'));var controller=require(_0x31e4('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x31e4('0x8')]);router[_0x31e4('0x9')](_0x31e4('0xa'),auth[_0x31e4('0xb')](),controller['describe']);router[_0x31e4('0x9')](_0x31e4('0xc'),auth[_0x31e4('0xb')](),controller[_0x31e4('0xd')]);router[_0x31e4('0x9')](_0x31e4('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x31e4('0xf')]('/',auth[_0x31e4('0xb')](),controller['create']);router[_0x31e4('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x31e4('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x67fe=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','create','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x31295c,_0x2f2b82){var _0x2c150e=function(_0x957f1){while(--_0x957f1){_0x31295c['push'](_0x31295c['shift']());}};_0x2c150e(++_0x2f2b82);}(_0x67fe,0x130));var _0xe67f=function(_0x36ca4c,_0x328ce5){_0x36ca4c=_0x36ca4c-0x0;var _0x3dfa81=_0x67fe[_0x36ca4c];return _0x3dfa81;};'use strict';var multer=require(_0xe67f('0x0'));var util=require(_0xe67f('0x1'));var path=require(_0xe67f('0x2'));var timeout=require(_0xe67f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe67f('0x4'));var auth=require(_0xe67f('0x5'));var interaction=require(_0xe67f('0x6'));var config=require(_0xe67f('0x7'));var controller=require(_0xe67f('0x8'));router[_0xe67f('0x9')]('/',auth[_0xe67f('0xa')](),controller['index']);router[_0xe67f('0x9')](_0xe67f('0xb'),auth[_0xe67f('0xa')](),controller[_0xe67f('0xc')]);router[_0xe67f('0x9')](_0xe67f('0xd'),auth[_0xe67f('0xa')](),controller[_0xe67f('0xe')]);router[_0xe67f('0x9')](_0xe67f('0xf'),auth[_0xe67f('0xa')](),controller[_0xe67f('0x10')]);router['post']('/',auth[_0xe67f('0xa')](),controller[_0xe67f('0x11')]);router[_0xe67f('0x12')](_0xe67f('0xd'),auth[_0xe67f('0xa')](),controller['update']);router[_0xe67f('0x13')](_0xe67f('0xd'),auth[_0xe67f('0xa')](),controller[_0xe67f('0x14')]);module[_0xe67f('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index c0d4ec0..b344f58 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 _0xdacc=['getDataValue','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','createdAt','toString','updatedAt','moment','path','../../config/environment','exports','VIRTUAL'];(function(_0x40dc12,_0x509075){var _0x25c034=function(_0x3aceb7){while(--_0x3aceb7){_0x40dc12['push'](_0x40dc12['shift']());}};_0x25c034(++_0x509075);}(_0xdacc,0x14f));var _0xcdac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdacc[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcdac('0x0'));var path=require(_0xcdac('0x1'));var config=require(_0xcdac('0x2'));module[_0xcdac('0x3')]={'format':{'type':Sequelize[_0xcdac('0x4')],'get':function(){return this[_0xcdac('0x5')](_0xcdac('0x6'))?path['extname'](this[_0xcdac('0x5')](_0xcdac('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xcdac('0x7')]},'channel':{'type':Sequelize[_0xcdac('0x7')]},'value':{'type':Sequelize[_0xcdac('0x7')],'set':function(_0x2a10a1){var _0x20a66e=_0x2a10a1[_0xcdac('0x8')](/\\/g,'/');this[_0xcdac('0x9')](_0xcdac('0x6'),_0x20a66e);}},'rating':{'type':Sequelize[_0xcdac('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xcdac('0xa')],'set':function(_0x33c4af){this[_0xcdac('0x9')](_0xcdac('0xb'),moment()[_0xcdac('0xc')](_0x33c4af,'ms'));this['setDataValue'](_0xcdac('0xd'),moment());this[_0xcdac('0x9')]('duration',_0x33c4af);}},'startedAt':{'type':Sequelize[_0xcdac('0xe')],'get':function(){return moment(this[_0xcdac('0x5')](_0xcdac('0xb')))[_0xcdac('0xf')](_0xcdac('0x10'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xcdac('0x5')]('closedAt'))[_0xcdac('0xf')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0xcdac('0xe')],'get':function(){return moment(this[_0xcdac('0x5')](_0xcdac('0x11')))[_0xcdac('0xf')](_0xcdac('0x10'))[_0xcdac('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xcdac('0x5')](_0xcdac('0x13')))['format'](_0xcdac('0x10'))[_0xcdac('0x12')]();}}}; \ No newline at end of file +var _0xc0d7=['STRING','replace','INTEGER','startedAt','subtract','setDataValue','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','closedAt','createdAt','../../config/environment','exports','VIRTUAL','getDataValue','value','extname'];(function(_0x100b96,_0x1bac2c){var _0x44bbcf=function(_0x3ed853){while(--_0x3ed853){_0x100b96['push'](_0x100b96['shift']());}};_0x44bbcf(++_0x1bac2c);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x53cb61,_0x18d2a8){_0x53cb61=_0x53cb61-0x0;var _0x27dea3=_0xc0d7[_0x53cb61];return _0x27dea3;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require('path');var config=require(_0x7c0d('0x0'));module[_0x7c0d('0x1')]={'format':{'type':Sequelize[_0x7c0d('0x2')],'get':function(){return this[_0x7c0d('0x3')](_0x7c0d('0x4'))?path[_0x7c0d('0x5')](this[_0x7c0d('0x3')](_0x7c0d('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x7c0d('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x7c0d('0x6')],'set':function(_0x14f205){var _0x22101d=_0x14f205[_0x7c0d('0x7')](/\\/g,'/');this['setDataValue'](_0x7c0d('0x4'),_0x22101d);}},'rating':{'type':Sequelize[_0x7c0d('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x7c0d('0x8')],'set':function(_0xfd38a0){this['setDataValue'](_0x7c0d('0x9'),moment()[_0x7c0d('0xa')](_0xfd38a0,'ms'));this['setDataValue']('closedAt',moment());this[_0x7c0d('0xb')](_0x7c0d('0xc'),_0xfd38a0);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x7c0d('0x3')](_0x7c0d('0x9')))[_0x7c0d('0xd')](_0x7c0d('0xe'))[_0x7c0d('0xf')]();}},'closedAt':{'type':Sequelize[_0x7c0d('0x10')],'get':function(){return moment(this['getDataValue'](_0x7c0d('0x11')))[_0x7c0d('0xd')](_0x7c0d('0xe'))[_0x7c0d('0xf')]();}},'createdAt':{'type':Sequelize[_0x7c0d('0x10')],'get':function(){return moment(this[_0x7c0d('0x3')](_0x7c0d('0x12')))[_0x7c0d('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x7c0d('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x7c0d('0x3')]('updatedAt'))[_0x7c0d('0xd')](_0x7c0d('0xe'))[_0x7c0d('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 12dfe90..7d00b9f 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 _0xe5b3=['info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','keys','intersection','attributes','fields','query','length','nolimit','order','where','filters','filter','merge','options','include','findAll','rows','catch','show','create','body','duration','createdAt','closedAt','value','find','params','describe','download','uniqueid','join','%s.cypher','existsSync','root','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','send','Not\x20found','destroy','Entity\x20not\x20found'];(function(_0x4a4813,_0x4fbb91){var _0x52519f=function(_0x2106e){while(--_0x2106e){_0x4a4813['push'](_0x4a4813['shift']());}};_0x52519f(++_0x4fbb91);}(_0xe5b3,0x133));var _0x3e5b=function(_0x5f53ab,_0x324327){_0x5f53ab=_0x5f53ab-0x0;var _0x116166=_0xe5b3[_0x5f53ab];return _0x116166;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41b684,_0x2f6368){return function(_0x42d7e9){if(!_0x42d7e9){_0x41b684[_0x3e5b('0x19')](0x194);}return _0x42d7e9;};}function handleError(_0x3bb749,_0x26c7f2){_0x26c7f2=_0x26c7f2||0x1f4;return function(_0x160e87){logger[_0x3e5b('0x28')](_0x160e87['stack']);if(_0x160e87[_0x3e5b('0x29')]){delete _0x160e87['name'];}_0x3bb749[_0x3e5b('0x1b')](_0x26c7f2)['send'](_0x160e87);};}exports[_0x3e5b('0x2a')]=function(_0x1f6473,_0x1296ec){var _0x475b39={},_0x10d2ed={},_0x3cfaf6={'count':0x0,'rows':[]};var _0x307091=_[_0x3e5b('0x2b')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')],function(_0x1e1565){return{'name':_0x1e1565['fieldName'],'type':_0x1e1565[_0x3e5b('0x2e')][_0x3e5b('0x2f')]};});_0x10d2ed[_0x3e5b('0x30')]=_[_0x3e5b('0x31')](_[_0x3e5b('0x2b')](_0x307091,_0x3e5b('0x29')),[_0x3e5b('0x32')]);_0x10d2ed['query']=_[_0x3e5b('0x33')](_0x1f6473['query']);_0x10d2ed['filters']=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],_0x10d2ed['query']);_0x475b39[_0x3e5b('0x35')]=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x475b39[_0x3e5b('0x35')]=_0x475b39[_0x3e5b('0x35')][_0x3e5b('0x38')]?_0x475b39[_0x3e5b('0x35')]:_0x10d2ed[_0x3e5b('0x30')];if(!_0x1f6473[_0x3e5b('0x37')]['hasOwnProperty'](_0x3e5b('0x39'))){_0x475b39[_0x3e5b('0x1e')]=qs['limit'](_0x1f6473['query'][_0x3e5b('0x1e')]);_0x475b39['offset']=qs[_0x3e5b('0x20')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x20')]);}_0x475b39[_0x3e5b('0x3a')]=qs['sort'](_0x1f6473[_0x3e5b('0x37')]['sort']);_0x475b39[_0x3e5b('0x3b')]=qs['filters'](_['pick'](_0x1f6473['query'],_0x10d2ed[_0x3e5b('0x3c')]),_0x307091);if(_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x3d')]){_0x475b39[_0x3e5b('0x3b')]=_[_0x3e5b('0x3e')](_0x475b39[_0x3e5b('0x3b')],{'$or':_['map'](_0x307091,function(_0x5d0c59){if(_0x5d0c59['type']!=='VIRTUAL'){var _0x5f0271={};_0x5f0271[_0x5d0c59['name']]={'$like':'%'+_0x1f6473['query'][_0x3e5b('0x3d')]+'%'};return _0x5f0271;}})});}_0x475b39=_[_0x3e5b('0x3e')]({},_0x475b39,_0x1f6473[_0x3e5b('0x3f')]);var _0x1aafd5={'where':_0x475b39[_0x3e5b('0x3b')]};return db[_0x3e5b('0x2c')][_0x3e5b('0x1f')](_0x1aafd5)[_0x3e5b('0x27')](function(_0x222d0f){_0x3cfaf6[_0x3e5b('0x1f')]=_0x222d0f;if(_0x1f6473[_0x3e5b('0x37')]['includeAll']){_0x475b39[_0x3e5b('0x40')]=[{'all':!![]}];}return db[_0x3e5b('0x2c')][_0x3e5b('0x41')](_0x475b39);})[_0x3e5b('0x27')](function(_0xa262e0){_0x3cfaf6[_0x3e5b('0x42')]=_0xa262e0;return _0x3cfaf6;})[_0x3e5b('0x27')](respondWithFilteredResult(_0x1296ec,_0x475b39))[_0x3e5b('0x43')](handleError(_0x1296ec,null));};exports[_0x3e5b('0x44')]=function(_0x39da3f,_0x13c8d5){var _0x559056={'raw':![],'where':{'id':_0x39da3f['params']['id']}},_0x598ab4={};_0x598ab4['model']=_[_0x3e5b('0x33')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')]);_0x598ab4[_0x3e5b('0x37')]=_[_0x3e5b('0x33')](_0x39da3f[_0x3e5b('0x37')]);_0x598ab4[_0x3e5b('0x3c')]=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],_0x598ab4[_0x3e5b('0x37')]);_0x559056['attributes']=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x39da3f[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x559056['attributes']=_0x559056['attributes']['length']?_0x559056[_0x3e5b('0x35')]:_0x598ab4[_0x3e5b('0x30')];if(_0x39da3f[_0x3e5b('0x37')]['includeAll']){_0x559056['include']=[{'all':!![]}];}_0x559056=_[_0x3e5b('0x3e')]({},_0x559056,_0x39da3f[_0x3e5b('0x3f')]);return db[_0x3e5b('0x2c')]['find'](_0x559056)['then'](handleEntityNotFound(_0x13c8d5,null))[_0x3e5b('0x27')](respondWithResult(_0x13c8d5,null))['catch'](handleError(_0x13c8d5,null));};exports[_0x3e5b('0x45')]=function(_0x3379a1,_0x3f5835){return db[_0x3e5b('0x2c')][_0x3e5b('0x45')](_0x3379a1[_0x3e5b('0x46')],{})[_0x3e5b('0x27')](respondWithResult(_0x3f5835,0xc9))[_0x3e5b('0x43')](handleError(_0x3f5835,null));};exports[_0x3e5b('0x26')]=function(_0x4a2ae1,_0x223185){if(_0x4a2ae1['body']['id']){delete _0x4a2ae1[_0x3e5b('0x46')]['id'];}delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x47')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x48')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x49')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x4a')];return db[_0x3e5b('0x2c')][_0x3e5b('0x4b')]({'where':{'id':_0x4a2ae1[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x223185,null))['then'](saveUpdates(_0x4a2ae1[_0x3e5b('0x46')],null))[_0x3e5b('0x27')](respondWithResult(_0x223185,null))[_0x3e5b('0x43')](handleError(_0x223185,null));};exports[_0x3e5b('0x4d')]=function(_0x16c9f9,_0x2cecd3){return db['ScreenRecording'][_0x3e5b('0x4d')]()[_0x3e5b('0x27')](respondWithResult(_0x2cecd3,null))[_0x3e5b('0x43')](handleError(_0x2cecd3,null));};exports[_0x3e5b('0x4e')]=function(_0x3f8646,_0x449d0f,_0x216600){var _0x437430=require('../../components/encryptor');var _0x1e6403=![];var _0x5e702f={};if(_0x3f8646['query'][_0x3e5b('0x2e')]&&_0x3f8646['query'][_0x3e5b('0x2e')]===_0x3e5b('0x4f')){_0x5e702f[_0x3e5b('0x4f')]=_0x3f8646[_0x3e5b('0x4c')]['id'];}else{_0x5e702f['id']=_0x3f8646['params']['id'];}return db['ScreenRecording']['find']({'where':_0x5e702f,'attributes':['id','value'],'raw':!![]})[_0x3e5b('0x27')](handleEntityNotFound(_0x449d0f,null))[_0x3e5b('0x27')](function(_0x1ea02a){if(_0x1ea02a){var _0x4149c8=path[_0x3e5b('0x50')](config['root'],'server/files/screen_recordings',_0x1ea02a[_0x3e5b('0x4a')]);var _0x1b0b32=util[_0x3e5b('0x32')](_0x3e5b('0x51'),_0x4149c8);if(fs[_0x3e5b('0x52')](_0x1b0b32)){_0x1e6403=!![];return _0x437430['decryptFile'](_0x1b0b32,_0x4149c8,config['secrets']['recording'])['then'](function(){return _0x1ea02a;});}return _0x1ea02a;}})[_0x3e5b('0x27')](function(_0x3e3115){if(_0x3e3115){var _0x3088d4=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x3e3115[_0x3e5b('0x4a')]);if(!fs[_0x3e5b('0x52')](_0x3088d4)){throw new db['Sequelize'][(_0x3e5b('0x55'))](_0x3e5b('0x56'));}if(_0x3e3115[_0x3e5b('0x57')]){return _0x449d0f[_0x3e5b('0x4e')](_0x3088d4,_0x3e3115[_0x3e5b('0x57')]+path['extname'](_0x3088d4),function(){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}else{return _0x449d0f['download'](_0x3088d4,function(_0x45ca16){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}}})['catch'](function(_0x4a7d8e){if(_0x4a7d8e['message']===_0x3e5b('0x56')){_0x449d0f['status'](0x194)[_0x3e5b('0x59')](_0x3e5b('0x5a'));}else{return handleError(_0x449d0f,null);}});};exports[_0x3e5b('0x5b')]=function(_0x40197c,_0x14f187){return db['ScreenRecording']['find']({'where':{'id':_0x40197c[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](function(_0x3f7f71){if(_['isNil'](_0x3f7f71)){throw new ReferenceError(_0x3e5b('0x5c'));}return _0x3f7f71;})[_0x3e5b('0x27')](function(_0x32a42f){var _0x1c9526=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x32a42f[_0x3e5b('0x4a')]);logger[_0x3e5b('0x5d')](_0x3e5b('0x5e'),_0x1c9526);if(!_[_0x3e5b('0x5f')](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger[_0x3e5b('0x5d')](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs[_0x3e5b('0x62')](_0x1c9526);}_0x1c9526=_0x1c9526+_0x3e5b('0x63');if(!_['isNil'](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger['info'](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs['unlinkSync'](_0x1c9526);}return _0x32a42f;})['then'](function(_0x4f67d1){if(!_0x4f67d1)throw new InternalError();return _0x4f67d1[_0x3e5b('0x5b')]();})[_0x3e5b('0x27')](function(){_0x14f187['status'](0xcc)[_0x3e5b('0x1a')]();})[_0x3e5b('0x43')](handleError(_0x14f187,null));}; \ No newline at end of file +var _0x2bd8=['unlink','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','index','ScreenRecording','rawAttributes','type','model','differenceBy','map','name','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','include','rows','catch','show','params','find','create','body','duration','createdAt','closedAt','value','../../components/encryptor','uniqueid','%s.cypher','secrets','recording','join','root','server/files/screen_recordings','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','download','extname'];(function(_0x526bd9,_0x5d802d){var _0x38bb6b=function(_0x1dc6b1){while(--_0x1dc6b1){_0x526bd9['push'](_0x526bd9['shift']());}};_0x38bb6b(++_0x5d802d);}(_0x2bd8,0x130));var _0x82bd=function(_0x10fa61,_0xc71fb4){_0x10fa61=_0x10fa61-0x0;var _0xab9f5e=_0x2bd8[_0x10fa61];return _0xab9f5e;};'use strict';var emlformat=require(_0x82bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x82bd('0x1'));var jsonpatch=require(_0x82bd('0x2'));var rp=require(_0x82bd('0x3'));var moment=require(_0x82bd('0x4'));var BPromise=require(_0x82bd('0x5'));var Mustache=require(_0x82bd('0x6'));var util=require(_0x82bd('0x7'));var path=require('path');var sox=require(_0x82bd('0x8'));var csv=require(_0x82bd('0x9'));var ejs=require(_0x82bd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82bd('0xb'));var squel=require(_0x82bd('0xc'));var crypto=require(_0x82bd('0xd'));var jsforce=require(_0x82bd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x82bd('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x82bd('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x82bd('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x82bd('0x11'));var config=require(_0x82bd('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x82bd('0x13'))['db'];function respondWithStatusCode(_0x5f1ab9,_0xfaccf7){_0xfaccf7=_0xfaccf7||0xcc;return function(_0x51e17e){if(_0x51e17e){return _0x5f1ab9[_0x82bd('0x14')](_0xfaccf7);}return _0x5f1ab9[_0x82bd('0x15')](_0xfaccf7)[_0x82bd('0x16')]();};}function respondWithResult(_0x2ca530,_0x58d82b){_0x58d82b=_0x58d82b||0xc8;return function(_0x446ffc){if(_0x446ffc){return _0x2ca530[_0x82bd('0x15')](_0x58d82b)['json'](_0x446ffc);}};}function respondWithFilteredResult(_0x3667ef,_0x4db39d){return function(_0x35dd09){if(_0x35dd09){var _0x433e7d=typeof _0x4db39d[_0x82bd('0x17')]===_0x82bd('0x18')&&typeof _0x4db39d[_0x82bd('0x19')]===_0x82bd('0x18');var _0x387d21=_0x35dd09[_0x82bd('0x1a')];var _0x31a350=_0x433e7d?0x0:_0x4db39d[_0x82bd('0x17')];var _0x390107=_0x433e7d?_0x35dd09[_0x82bd('0x1a')]:_0x4db39d[_0x82bd('0x17')]+_0x4db39d[_0x82bd('0x19')];var _0x4a1e62;if(_0x390107>=_0x387d21){_0x390107=_0x387d21;_0x4a1e62=0xc8;}else{_0x4a1e62=0xce;}_0x3667ef['status'](_0x4a1e62);return _0x3667ef[_0x82bd('0x1b')](_0x82bd('0x1c'),_0x31a350+'-'+_0x390107+'/'+_0x387d21)[_0x82bd('0x1d')](_0x35dd09);}return null;};}function patchUpdates(_0xc9fcdf){return function(_0x34899b){try{jsonpatch[_0x82bd('0x1e')](_0x34899b,_0xc9fcdf,!![]);}catch(_0x2c1810){return BPromise[_0x82bd('0x1f')](_0x2c1810);}return _0x34899b[_0x82bd('0x20')]();};}function saveUpdates(_0x3291cd,_0x2caa29){return function(_0x177025){if(_0x177025){return _0x177025[_0x82bd('0x21')](_0x3291cd)[_0x82bd('0x22')](function(_0x3d9f03){return _0x3d9f03;});}return null;};}function removeEntity(_0x2d9d95,_0x13a42a){return function(_0x3b6b93){if(_0x3b6b93){return _0x3b6b93[_0x82bd('0x23')]()['then'](function(){_0x2d9d95['status'](0xcc)[_0x82bd('0x16')]();});}};}function handleEntityNotFound(_0x436ecd,_0x1cb292){return function(_0x3eb6a5){if(!_0x3eb6a5){_0x436ecd[_0x82bd('0x14')](0x194);}return _0x3eb6a5;};}function handleError(_0x10d101,_0x3c7751){_0x3c7751=_0x3c7751||0x1f4;return function(_0xbef23b){logger[_0x82bd('0x24')](_0xbef23b[_0x82bd('0x25')]);if(_0xbef23b['name']){delete _0xbef23b['name'];}_0x10d101['status'](_0x3c7751)['send'](_0xbef23b);};}exports[_0x82bd('0x26')]=function(_0x52bcd8,_0x351d3d){var _0x190bca={},_0x363ef9={},_0x50585e={'count':0x0,'rows':[]};var _0x516c6d=_['map'](db[_0x82bd('0x27')][_0x82bd('0x28')],function(_0x40884f){return{'name':_0x40884f['fieldName'],'type':_0x40884f[_0x82bd('0x29')]['key']};});_0x363ef9[_0x82bd('0x2a')]=_[_0x82bd('0x2b')](_[_0x82bd('0x2c')](_0x516c6d,_0x82bd('0x2d')),[_0x82bd('0x2e')]);_0x363ef9[_0x82bd('0x2f')]=_['keys'](_0x52bcd8[_0x82bd('0x2f')]);_0x363ef9[_0x82bd('0x30')]=_[_0x82bd('0x31')](_0x363ef9['model'],_0x363ef9[_0x82bd('0x2f')]);_0x190bca['attributes']=_['intersection'](_0x363ef9[_0x82bd('0x2a')],qs[_0x82bd('0x32')](_0x52bcd8[_0x82bd('0x2f')][_0x82bd('0x32')]));_0x190bca[_0x82bd('0x33')]=_0x190bca[_0x82bd('0x33')][_0x82bd('0x34')]?_0x190bca[_0x82bd('0x33')]:_0x363ef9[_0x82bd('0x2a')];if(!_0x52bcd8[_0x82bd('0x2f')][_0x82bd('0x35')](_0x82bd('0x36'))){_0x190bca[_0x82bd('0x19')]=qs[_0x82bd('0x19')](_0x52bcd8[_0x82bd('0x2f')][_0x82bd('0x19')]);_0x190bca[_0x82bd('0x17')]=qs['offset'](_0x52bcd8['query']['offset']);}_0x190bca[_0x82bd('0x37')]=qs[_0x82bd('0x38')](_0x52bcd8['query'][_0x82bd('0x38')]);_0x190bca['where']=qs['filters'](_['pick'](_0x52bcd8[_0x82bd('0x2f')],_0x363ef9[_0x82bd('0x30')]),_0x516c6d);if(_0x52bcd8[_0x82bd('0x2f')][_0x82bd('0x39')]){_0x190bca[_0x82bd('0x3a')]=_['merge'](_0x190bca['where'],{'$or':_['map'](_0x516c6d,function(_0x64bc54){if(_0x64bc54['type']!=='VIRTUAL'){var _0xba38a4={};_0xba38a4[_0x64bc54[_0x82bd('0x2d')]]={'$like':'%'+_0x52bcd8[_0x82bd('0x2f')][_0x82bd('0x39')]+'%'};return _0xba38a4;}})});}_0x190bca=_[_0x82bd('0x3b')]({},_0x190bca,_0x52bcd8[_0x82bd('0x3c')]);var _0x65335b={'where':_0x190bca[_0x82bd('0x3a')]};return db[_0x82bd('0x27')]['count'](_0x65335b)['then'](function(_0xe210f4){_0x50585e[_0x82bd('0x1a')]=_0xe210f4;if(_0x52bcd8['query']['includeAll']){_0x190bca[_0x82bd('0x3d')]=[{'all':!![]}];}return db[_0x82bd('0x27')]['findAll'](_0x190bca);})[_0x82bd('0x22')](function(_0x21868d){_0x50585e[_0x82bd('0x3e')]=_0x21868d;return _0x50585e;})[_0x82bd('0x22')](respondWithFilteredResult(_0x351d3d,_0x190bca))[_0x82bd('0x3f')](handleError(_0x351d3d,null));};exports[_0x82bd('0x40')]=function(_0x2a18c3,_0x2c429d){var _0x21d7d4={'raw':![],'where':{'id':_0x2a18c3[_0x82bd('0x41')]['id']}},_0x239d48={};_0x239d48[_0x82bd('0x2a')]=_['keys'](db[_0x82bd('0x27')][_0x82bd('0x28')]);_0x239d48['query']=_['keys'](_0x2a18c3[_0x82bd('0x2f')]);_0x239d48[_0x82bd('0x30')]=_[_0x82bd('0x31')](_0x239d48[_0x82bd('0x2a')],_0x239d48[_0x82bd('0x2f')]);_0x21d7d4['attributes']=_['intersection'](_0x239d48[_0x82bd('0x2a')],qs[_0x82bd('0x32')](_0x2a18c3['query'][_0x82bd('0x32')]));_0x21d7d4['attributes']=_0x21d7d4[_0x82bd('0x33')][_0x82bd('0x34')]?_0x21d7d4['attributes']:_0x239d48[_0x82bd('0x2a')];if(_0x2a18c3[_0x82bd('0x2f')]['includeAll']){_0x21d7d4['include']=[{'all':!![]}];}_0x21d7d4=_[_0x82bd('0x3b')]({},_0x21d7d4,_0x2a18c3['options']);return db[_0x82bd('0x27')][_0x82bd('0x42')](_0x21d7d4)[_0x82bd('0x22')](handleEntityNotFound(_0x2c429d,null))[_0x82bd('0x22')](respondWithResult(_0x2c429d,null))['catch'](handleError(_0x2c429d,null));};exports['create']=function(_0x1852f2,_0x5a0ca6){return db['ScreenRecording'][_0x82bd('0x43')](_0x1852f2[_0x82bd('0x44')],{})[_0x82bd('0x22')](respondWithResult(_0x5a0ca6,0xc9))['catch'](handleError(_0x5a0ca6,null));};exports[_0x82bd('0x21')]=function(_0x92ba88,_0x1db61b){if(_0x92ba88[_0x82bd('0x44')]['id']){delete _0x92ba88[_0x82bd('0x44')]['id'];}delete _0x92ba88[_0x82bd('0x44')][_0x82bd('0x45')];delete _0x92ba88[_0x82bd('0x44')][_0x82bd('0x46')];delete _0x92ba88[_0x82bd('0x44')][_0x82bd('0x47')];delete _0x92ba88[_0x82bd('0x44')][_0x82bd('0x48')];return db['ScreenRecording'][_0x82bd('0x42')]({'where':{'id':_0x92ba88[_0x82bd('0x41')]['id']}})['then'](handleEntityNotFound(_0x1db61b,null))[_0x82bd('0x22')](saveUpdates(_0x92ba88[_0x82bd('0x44')],null))[_0x82bd('0x22')](respondWithResult(_0x1db61b,null))[_0x82bd('0x3f')](handleError(_0x1db61b,null));};exports['describe']=function(_0x5b4fd2,_0x37d1f0){return db['ScreenRecording']['describe']()[_0x82bd('0x22')](respondWithResult(_0x37d1f0,null))['catch'](handleError(_0x37d1f0,null));};exports['download']=function(_0x31b41d,_0x3f94f3,_0x3dbee7){var _0xcfb5ef=require(_0x82bd('0x49'));var _0x1a7402=![];var _0x417c29={};if(_0x31b41d[_0x82bd('0x2f')][_0x82bd('0x29')]&&_0x31b41d[_0x82bd('0x2f')][_0x82bd('0x29')]===_0x82bd('0x4a')){_0x417c29[_0x82bd('0x4a')]=_0x31b41d[_0x82bd('0x41')]['id'];}else{_0x417c29['id']=_0x31b41d[_0x82bd('0x41')]['id'];}return db['ScreenRecording'][_0x82bd('0x42')]({'where':_0x417c29,'attributes':['id',_0x82bd('0x48')],'raw':!![]})[_0x82bd('0x22')](handleEntityNotFound(_0x3f94f3,null))[_0x82bd('0x22')](function(_0x9bf8fa){if(_0x9bf8fa){var _0x5466d9=path['join'](config['root'],'server/files/screen_recordings',_0x9bf8fa[_0x82bd('0x48')]);var _0x2cc6ea=util[_0x82bd('0x2e')](_0x82bd('0x4b'),_0x5466d9);if(fs['existsSync'](_0x2cc6ea)){_0x1a7402=!![];return _0xcfb5ef['decryptFile'](_0x2cc6ea,_0x5466d9,config[_0x82bd('0x4c')][_0x82bd('0x4d')])[_0x82bd('0x22')](function(){return _0x9bf8fa;});}return _0x9bf8fa;}})['then'](function(_0x2657bc){if(_0x2657bc){var _0x2252ef=path[_0x82bd('0x4e')](config[_0x82bd('0x4f')],_0x82bd('0x50'),_0x2657bc[_0x82bd('0x48')]);if(!fs[_0x82bd('0x51')](_0x2252ef)){throw new db[(_0x82bd('0x52'))][(_0x82bd('0x53'))](_0x82bd('0x54'));}if(_0x2657bc[_0x82bd('0x55')]){return _0x3f94f3[_0x82bd('0x56')](_0x2252ef,_0x2657bc[_0x82bd('0x55')]+path[_0x82bd('0x57')](_0x2252ef),function(){if(_0x1a7402){fs[_0x82bd('0x58')](_0x2252ef);}});}else{return _0x3f94f3[_0x82bd('0x56')](_0x2252ef,function(_0x124ca4){if(_0x1a7402){fs[_0x82bd('0x58')](_0x2252ef);}});}}})['catch'](function(_0x566b01){if(_0x566b01['message']==='ScreenRecording\x20not\x20found'){_0x3f94f3[_0x82bd('0x15')](0x194)['send'](_0x82bd('0x59'));}else{return handleError(_0x3f94f3,null);}});};exports[_0x82bd('0x23')]=function(_0x3ee7c7,_0x409b06){return db[_0x82bd('0x27')][_0x82bd('0x42')]({'where':{'id':_0x3ee7c7[_0x82bd('0x41')]['id']}})[_0x82bd('0x22')](function(_0x40d6cf){if(_[_0x82bd('0x5a')](_0x40d6cf)){throw new ReferenceError(_0x82bd('0x5b'));}return _0x40d6cf;})['then'](function(_0x4c54f0){var _0x419965=path[_0x82bd('0x4e')](config['root'],'server/files/screen_recordings',_0x4c54f0[_0x82bd('0x48')]);logger[_0x82bd('0x5c')](_0x82bd('0x5d'),_0x419965);if(!_[_0x82bd('0x5a')](_0x4c54f0['value'])&&fs[_0x82bd('0x51')](_0x419965)){logger['info'](_0x82bd('0x5e')+_0x419965+_0x82bd('0x5f'));fs['unlinkSync'](_0x419965);}_0x419965=_0x419965+_0x82bd('0x60');if(!_[_0x82bd('0x5a')](_0x4c54f0[_0x82bd('0x48')])&&fs[_0x82bd('0x51')](_0x419965)){logger['info'](_0x82bd('0x5e')+_0x419965+_0x82bd('0x5f'));fs[_0x82bd('0x61')](_0x419965);}return _0x4c54f0;})[_0x82bd('0x22')](function(_0x243fba){if(!_0x243fba)throw new InternalError();return _0x243fba[_0x82bd('0x23')]();})[_0x82bd('0x22')](function(){_0x409b06[_0x82bd('0x15')](0xcc)[_0x82bd('0x16')]();})['catch'](handleError(_0x409b06,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index c2efeba..bbc93af 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 _0x8047=['define','ScreenRecording','screen_recordings','lodash','util','moment','bluebird','./screenRecording.attributes','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8047,0x174));var _0x7804=function(_0x2aeb4b,_0x29d79d){_0x2aeb4b=_0x2aeb4b-0x0;var _0x16138d=_0x8047[_0x2aeb4b];return _0x16138d;};'use strict';var _=require(_0x7804('0x0'));var util=require(_0x7804('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7804('0x2'));var BPromise=require(_0x7804('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7804('0x4'));module[_0x7804('0x5')]=function(_0xa3166,_0x1d5147){return _0xa3166[_0x7804('0x6')](_0x7804('0x7'),attributes,{'tableName':_0x7804('0x8'),'paranoid':![],'indexes':[{'name':'interactionid','fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5495=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x4ab3fb,_0x776775){var _0x34fe1e=function(_0x1c94c5){while(--_0x1c94c5){_0x4ab3fb['push'](_0x4ab3fb['shift']());}};_0x34fe1e(++_0x776775);}(_0x5495,0xa7));var _0x5549=function(_0x59b063,_0x2de28d){_0x59b063=_0x59b063-0x0;var _0x181d24=_0x5495[_0x59b063];return _0x181d24;};'use strict';var _=require(_0x5549('0x0'));var util=require(_0x5549('0x1'));var logger=require(_0x5549('0x2'))('api');var moment=require(_0x5549('0x3'));var BPromise=require('bluebird');var rp=require(_0x5549('0x4'));var fs=require('fs');var path=require(_0x5549('0x5'));var rimraf=require(_0x5549('0x6'));var config=require(_0x5549('0x7'));var attributes=require(_0x5549('0x8'));module[_0x5549('0x9')]=function(_0x122485,_0x3e33ed){return _0x122485[_0x5549('0xa')](_0x5549('0xb'),attributes,{'tableName':_0x5549('0xc'),'paranoid':![],'indexes':[{'name':_0x5549('0xd'),'fields':[_0x5549('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 6fe0297..c744bfe 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 _0x3a39=['../../config/logger','../../config/environment','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5767e2,_0x52f148){var _0x49d882=function(_0x12cb3){while(--_0x12cb3){_0x5767e2['push'](_0x5767e2['shift']());}};_0x49d882(++_0x52f148);}(_0x3a39,0xb7));var _0x93a3=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x3a39[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x93a3('0x0'));var util=require(_0x93a3('0x1'));var moment=require(_0x93a3('0x2'));var BPromise=require('bluebird');var rs=require(_0x93a3('0x3'));var fs=require('fs');var Redis=require(_0x93a3('0x4'));var db=require(_0x93a3('0x5'))['db'];var utils=require(_0x93a3('0x6'));var logger=require(_0x93a3('0x7'))('rpc');var config=require(_0x93a3('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43191d,_0x527636,_0xf5615b){return new BPromise(function(_0x2765b3,_0x3732ec){return client[_0x93a3('0x9')](_0x43191d,_0xf5615b)[_0x93a3('0xa')](function(_0x55e7c4){logger[_0x93a3('0xb')](_0x93a3('0xc'),_0x527636,_0x93a3('0xd'));logger['debug'](_0x93a3('0xe'),_0x527636,_0x93a3('0xd'),JSON['stringify'](_0x55e7c4));if(_0x55e7c4[_0x93a3('0xf')]){if(_0x55e7c4[_0x93a3('0xf')]['code']===0x1f4){logger[_0x93a3('0xf')](_0x93a3('0xc'),_0x527636,_0x55e7c4[_0x93a3('0xf')][_0x93a3('0x10')]);return _0x3732ec(_0x55e7c4['error'][_0x93a3('0x10')]);}logger[_0x93a3('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x527636,_0x55e7c4[_0x93a3('0xf')][_0x93a3('0x10')]);return _0x2765b3(_0x55e7c4[_0x93a3('0xf')][_0x93a3('0x10')]);}else{logger[_0x93a3('0xb')](_0x93a3('0xc'),_0x527636,_0x93a3('0xd'));_0x2765b3(_0x55e7c4[_0x93a3('0x11')][_0x93a3('0x10')]);}})[_0x93a3('0x12')](function(_0x5a5cde){logger[_0x93a3('0xf')](_0x93a3('0xc'),_0x527636,_0x5a5cde);_0x3732ec(_0x5a5cde);});});} \ No newline at end of file +var _0xbf73=['then','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x4c5779,_0x5c39e6){var _0x461652=function(_0x5c23ee){while(--_0x5c23ee){_0x4c5779['push'](_0x4c5779['shift']());}};_0x461652(++_0x5c39e6);}(_0xbf73,0x1a3));var _0x3bf7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbf73[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x3bf7('0x0'));var util=require(_0x3bf7('0x1'));var moment=require(_0x3bf7('0x2'));var BPromise=require(_0x3bf7('0x3'));var rs=require(_0x3bf7('0x4'));var fs=require('fs');var Redis=require(_0x3bf7('0x5'));var db=require(_0x3bf7('0x6'))['db'];var utils=require(_0x3bf7('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3bf7('0x8'));var jayson=require(_0x3bf7('0x9'));var client=jayson[_0x3bf7('0xa')][_0x3bf7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ffe74,_0x4fc965,_0x7be78c){return new BPromise(function(_0x4c2630,_0x2a34bf){return client[_0x3bf7('0xc')](_0x1ffe74,_0x7be78c)[_0x3bf7('0xd')](function(_0x259f81){logger['info'](_0x3bf7('0xe'),_0x4fc965,'request\x20sent');logger[_0x3bf7('0xf')](_0x3bf7('0x10'),_0x4fc965,_0x3bf7('0x11'),JSON[_0x3bf7('0x12')](_0x259f81));if(_0x259f81[_0x3bf7('0x13')]){if(_0x259f81[_0x3bf7('0x13')]['code']===0x1f4){logger[_0x3bf7('0x13')](_0x3bf7('0xe'),_0x4fc965,_0x259f81[_0x3bf7('0x13')][_0x3bf7('0x14')]);return _0x2a34bf(_0x259f81['error']['message']);}logger[_0x3bf7('0x13')](_0x3bf7('0xe'),_0x4fc965,_0x259f81['error'][_0x3bf7('0x14')]);return _0x4c2630(_0x259f81[_0x3bf7('0x13')]['message']);}else{logger[_0x3bf7('0x15')](_0x3bf7('0xe'),_0x4fc965,_0x3bf7('0x11'));_0x4c2630(_0x259f81[_0x3bf7('0x16')][_0x3bf7('0x14')]);}})[_0x3bf7('0x17')](function(_0x2c2afb){logger['error'](_0x3bf7('0xe'),_0x4fc965,_0x2c2afb);_0x2a34bf(_0x2c2afb);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 1e3b33a..c6b8d68 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 _0xe3b7=['getLogo','/:id/logo_login','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','file','addLogo','preferred','single','addPreferred','favicon','addFavicon','/:id','isAuthenticated','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','index','get','/now','getDate','/:id/logo'];(function(_0x424d5c,_0x35907c){var _0x2239a1=function(_0x5f5bbf){while(--_0x5f5bbf){_0x424d5c['push'](_0x424d5c['shift']());}};_0x2239a1(++_0x35907c);}(_0xe3b7,0xd7));var _0x7e3b=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xe3b7[_0x4a7631];return _0x1a5a6f;};'use strict';var multer=require(_0x7e3b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7e3b('0x1'));var express=require(_0x7e3b('0x2'));var router=express[_0x7e3b('0x3')]();var fs_extra=require(_0x7e3b('0x4'));var auth=require(_0x7e3b('0x5'));var interaction=require(_0x7e3b('0x6'));var config=require('../../config/environment');var controller=require(_0x7e3b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7e3b('0x8')]);router[_0x7e3b('0x9')](_0x7e3b('0xa'),controller[_0x7e3b('0xb')]);router[_0x7e3b('0x9')]('/:id',controller['show']);router['get'](_0x7e3b('0xc'),controller[_0x7e3b('0xd')]);router[_0x7e3b('0x9')](_0x7e3b('0xe'),controller['getLogoLogin']);router[_0x7e3b('0x9')]('/:id/gdpr',controller[_0x7e3b('0xf')]);router['get'](_0x7e3b('0x10'),controller[_0x7e3b('0x11')]);router[_0x7e3b('0x9')](_0x7e3b('0x12'),controller[_0x7e3b('0x13')]);var upload=multer({'storage':multer[_0x7e3b('0x14')]({'destination':function(_0x568898,_0x5d78a7,_0x2c97e3){_0x2c97e3(null,path[_0x7e3b('0x15')](config[_0x7e3b('0x16')],_0x7e3b('0x17')));},'filename':function(_0x516f35,_0x59c802,_0x1f18b0){_0x1f18b0(null,util[_0x7e3b('0x18')](_0x7e3b('0x19'),_0x7e3b('0x1a'),path[_0x7e3b('0x1b')](_0x59c802[_0x7e3b('0x1c')])));}})});router['post'](_0x7e3b('0xc'),upload['single'](_0x7e3b('0x1d')),controller[_0x7e3b('0x1e')]);var upload=multer({'storage':multer[_0x7e3b('0x14')]({'destination':function(_0x3c6d46,_0x23ba28,_0x12da49){_0x12da49(null,path[_0x7e3b('0x15')](config['root'],_0x7e3b('0x17')));},'filename':function(_0x30ab6f,_0x397d5a,_0x28d1f5){_0x28d1f5(null,util[_0x7e3b('0x18')](_0x7e3b('0x19'),'logologin',path['extname'](_0x397d5a[_0x7e3b('0x1c')])));}})});router['post'](_0x7e3b('0xe'),upload['single'](_0x7e3b('0x1d')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x7e3b('0x14')]({'destination':function(_0x1c96dc,_0x53bc62,_0x41e142){_0x41e142(null,path[_0x7e3b('0x15')](config[_0x7e3b('0x16')],_0x7e3b('0x17')));},'filename':function(_0x15e40b,_0x36c860,_0x40276d){_0x40276d(null,util[_0x7e3b('0x18')](_0x7e3b('0x19'),_0x7e3b('0x1f'),path[_0x7e3b('0x1b')](_0x36c860[_0x7e3b('0x1c')])));}})});router['post'](_0x7e3b('0x10'),upload[_0x7e3b('0x20')](_0x7e3b('0x1d')),controller[_0x7e3b('0x21')]);var upload=multer({'storage':multer[_0x7e3b('0x14')]({'destination':function(_0x57319a,_0x566e0a,_0x2c0edb){_0x2c0edb(null,path[_0x7e3b('0x15')](config[_0x7e3b('0x16')],_0x7e3b('0x17')));},'filename':function(_0x57300c,_0x47237d,_0x412c19){_0x412c19(null,util[_0x7e3b('0x18')](_0x7e3b('0x19'),_0x7e3b('0x22'),path[_0x7e3b('0x1b')](_0x47237d[_0x7e3b('0x1c')])));}})});router['post']('/:id/favicon',upload[_0x7e3b('0x20')]('file'),controller[_0x7e3b('0x23')]);router['put'](_0x7e3b('0x24'),auth[_0x7e3b('0x25')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0xb118=['addLogoLogin','preferred','/:id/preferred','addPreferred','favicon','put','/:id','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id/logo_login','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','join','root'];(function(_0x101802,_0x11f913){var _0x5d61ce=function(_0x4acc0){while(--_0x4acc0){_0x101802['push'](_0x101802['shift']());}};_0x5d61ce(++_0x11f913);}(_0xb118,0x1e8));var _0x8b11=function(_0x57b900,_0x537674){_0x57b900=_0x57b900-0x0;var _0x4fcf27=_0xb118[_0x57b900];return _0x4fcf27;};'use strict';var multer=require('multer');var util=require(_0x8b11('0x0'));var path=require(_0x8b11('0x1'));var timeout=require(_0x8b11('0x2'));var express=require('express');var router=express[_0x8b11('0x3')]();var fs_extra=require(_0x8b11('0x4'));var auth=require(_0x8b11('0x5'));var interaction=require(_0x8b11('0x6'));var config=require(_0x8b11('0x7'));var controller=require(_0x8b11('0x8'));router[_0x8b11('0x9')]('/',auth[_0x8b11('0xa')](),controller[_0x8b11('0xb')]);router[_0x8b11('0x9')](_0x8b11('0xc'),controller[_0x8b11('0xd')]);router[_0x8b11('0x9')]('/:id',controller['show']);router[_0x8b11('0x9')]('/:id/logo',controller['getLogo']);router[_0x8b11('0x9')](_0x8b11('0xe'),controller['getLogoLogin']);router['get']('/:id/gdpr',controller[_0x8b11('0xf')]);router['get']('/:id/preferred',controller[_0x8b11('0x10')]);router[_0x8b11('0x9')](_0x8b11('0x11'),controller[_0x8b11('0x12')]);var upload=multer({'storage':multer[_0x8b11('0x13')]({'destination':function(_0x3b9219,_0x253887,_0x332027){_0x332027(null,path['join'](config['root'],_0x8b11('0x14')));},'filename':function(_0x460d78,_0x28eb25,_0x45ec42){_0x45ec42(null,util[_0x8b11('0x15')](_0x8b11('0x16'),_0x8b11('0x17'),path[_0x8b11('0x18')](_0x28eb25[_0x8b11('0x19')])));}})});router[_0x8b11('0x1a')]('/:id/logo',upload[_0x8b11('0x1b')](_0x8b11('0x1c')),controller[_0x8b11('0x1d')]);var upload=multer({'storage':multer[_0x8b11('0x13')]({'destination':function(_0x1b965a,_0xb75043,_0x8194ec){_0x8194ec(null,path[_0x8b11('0x1e')](config[_0x8b11('0x1f')],_0x8b11('0x14')));},'filename':function(_0x549cef,_0x59ef5c,_0x4df2b4){_0x4df2b4(null,util[_0x8b11('0x15')](_0x8b11('0x16'),'logologin',path[_0x8b11('0x18')](_0x59ef5c['originalname'])));}})});router['post'](_0x8b11('0xe'),upload[_0x8b11('0x1b')]('file'),controller[_0x8b11('0x20')]);var upload=multer({'storage':multer[_0x8b11('0x13')]({'destination':function(_0x2861b5,_0x3dc43b,_0x1f1e93){_0x1f1e93(null,path['join'](config[_0x8b11('0x1f')],_0x8b11('0x14')));},'filename':function(_0x21fc96,_0x4d852e,_0x199cea){_0x199cea(null,util[_0x8b11('0x15')](_0x8b11('0x16'),_0x8b11('0x21'),path[_0x8b11('0x18')](_0x4d852e[_0x8b11('0x19')])));}})});router[_0x8b11('0x1a')](_0x8b11('0x22'),upload[_0x8b11('0x1b')](_0x8b11('0x1c')),controller[_0x8b11('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x56ccd8,_0x8230e0,_0x473d7b){_0x473d7b(null,path[_0x8b11('0x1e')](config[_0x8b11('0x1f')],'server/files/images/logos/'));},'filename':function(_0x20c7f1,_0x2fbb57,_0x330dd0){_0x330dd0(null,util[_0x8b11('0x15')](_0x8b11('0x16'),_0x8b11('0x24'),path[_0x8b11('0x18')](_0x2fbb57['originalname'])));}})});router[_0x8b11('0x1a')](_0x8b11('0x11'),upload[_0x8b11('0x1b')]('file'),controller['addFavicon']);router[_0x8b11('0x25')](_0x8b11('0x26'),auth[_0x8b11('0xa')](),controller['update']);module[_0x8b11('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 762bac4..1e0f108 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 _0x3d2f=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x201577,_0x4aaeea){var _0x228b10=function(_0x127218){while(--_0x127218){_0x201577['push'](_0x201577['shift']());}};_0x228b10(++_0x4aaeea);}(_0x3d2f,0x18f));var _0xf3d2=function(_0x52b24,_0x4d4184){_0x52b24=_0x52b24-0x0;var _0xea5a5b=_0x3d2f[_0x52b24];return _0xea5a5b;};'use strict';var Sequelize=require(_0xf3d2('0x0'));module[_0xf3d2('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xf3d2('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xf3d2('0x3')](0xb),'unique':_0xf3d2('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xf3d2('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xf3d2('0x5')],'defaultValue':_0xf3d2('0x6')},'logo':{'type':Sequelize[_0xf3d2('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xf3d2('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xf3d2('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xf3d2('0x5')]},'turnaddr':{'type':Sequelize[_0xf3d2('0x5')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xf3d2('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xf3d2('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xf3d2('0x5')],'defaultValue':_0xf3d2('0x8')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xf3d2('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xf3d2('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xf3d2('0x9')},'chatTimeout':{'type':Sequelize[_0xf3d2('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xf3d2('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xf3d2('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xf3d2('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xf3d2('0x5')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xf3d2('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xf3d2('0x3')]},'transcribeRegion':{'type':Sequelize[_0xf3d2('0x5')]},'sentiment':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xf3d2('0x3')]},'sentimentRegion':{'type':Sequelize[_0xf3d2('0x5')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xf3d2('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xf3d2('0x3')](0x2)[_0xf3d2('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0xf3d2('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xf3d2('0x3')](0x2)[_0xf3d2('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xf3d2('0x3')](0x2)[_0xf3d2('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xf3d2('0x3')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xf3d2('0x3')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xf3d2('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xf3d2('0x3')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xf3d2('0x3')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0xf3d2('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xf3d2('0x3')],'defaultValue':0x14}}; \ No newline at end of file +var _0x58c8=['STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','exports','min_internal','min_mailbox','INTEGER'];(function(_0x4a0748,_0xcad15d){var _0x5e7e0e=function(_0x5719d2){while(--_0x5719d2){_0x4a0748['push'](_0x4a0748['shift']());}};_0x5e7e0e(++_0xcad15d);}(_0x58c8,0x1d9));var _0x858c=function(_0x3b17ff,_0x11f5c5){_0x3b17ff=_0x3b17ff-0x0;var _0x27fd83=_0x58c8[_0x3b17ff];return _0x27fd83;};'use strict';var Sequelize=require('sequelize');module[_0x858c('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x858c('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x858c('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x858c('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x858c('0x4')],'defaultValue':_0x858c('0x5')},'logo':{'type':Sequelize[_0x858c('0x4')]},'defaultLogo':{'type':Sequelize[_0x858c('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x858c('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x858c('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x858c('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x858c('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x858c('0x4')]},'turnaddr':{'type':Sequelize[_0x858c('0x4')]},'turnusername':{'type':Sequelize[_0x858c('0x4')]},'turnpassword':{'type':Sequelize[_0x858c('0x4')]},'pageTitle':{'type':Sequelize[_0x858c('0x4')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x858c('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x858c('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x858c('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x858c('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x858c('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x858c('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x858c('0x4')],'defaultValue':_0x858c('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x858c('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x858c('0x4')]},'defaultPreferred':{'type':Sequelize[_0x858c('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x858c('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x858c('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x858c('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x858c('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x858c('0x4')]},'defaultFavicon':{'type':Sequelize[_0x858c('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x858c('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x858c('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x858c('0x3')]},'transcribeRegion':{'type':Sequelize[_0x858c('0x4')]},'sentiment':{'type':Sequelize[_0x858c('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x858c('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x858c('0x3')]},'sentimentRegion':{'type':Sequelize[_0x858c('0x4')]},'language':{'type':Sequelize[_0x858c('0x4')]},'bucket':{'type':Sequelize[_0x858c('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x858c('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x858c('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x858c('0x3')](0x2)[_0x858c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x858c('0x3')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x858c('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x858c('0x3')](0x2)[_0x858c('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x858c('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x858c('0x3')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x858c('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x858c('0x3')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x858c('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x858c('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x858c('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x858c('0x3')],'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 0391a7c..b7ab00e 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 _0x7be4=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','code','Setting,\x20%s,\x20%s','message','error','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','Setting','rawAttributes','fieldName','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','merge','includeAll','rows','show','params','intersection','include','find','body','addLogo','file','logo','filename','loginLogo','../../config/license/util','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','custom','existsSync','Sequelize','ValidationError','getLogoLogin','defaultLogo','default_loginLogo.svg','download','gdpr','addPreferred','server/files/images/logos','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS'];(function(_0x16d565,_0x2a2da7){var _0x42cfab=function(_0x4f53f1){while(--_0x4f53f1){_0x16d565['push'](_0x16d565['shift']());}};_0x42cfab(++_0x2a2da7);}(_0x7be4,0x16e));var _0x47be=function(_0x185458,_0x27ee5d){_0x185458=_0x185458-0x0;var _0x337e75=_0x7be4[_0x185458];return _0x337e75;};'use strict';var emlformat=require(_0x47be('0x0'));var rimraf=require(_0x47be('0x1'));var zipdir=require(_0x47be('0x2'));var jsonpatch=require(_0x47be('0x3'));var rp=require(_0x47be('0x4'));var moment=require(_0x47be('0x5'));var BPromise=require(_0x47be('0x6'));var Mustache=require(_0x47be('0x7'));var util=require(_0x47be('0x8'));var path=require(_0x47be('0x9'));var sox=require(_0x47be('0xa'));var csv=require(_0x47be('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47be('0xc'));var _=require(_0x47be('0xd'));var squel=require(_0x47be('0xe'));var crypto=require(_0x47be('0xf'));var jsforce=require(_0x47be('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x47be('0xb'));var querystring=require('querystring');var Papa=require(_0x47be('0x11'));var Redis=require(_0x47be('0x12'));var authService=require(_0x47be('0x13'));var qs=require(_0x47be('0x14'));var as=require(_0x47be('0x15'));var hardwareService=require(_0x47be('0x16'));var logger=require(_0x47be('0x17'))(_0x47be('0x18'));var utils=require('../../config/utils');var config=require(_0x47be('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x47be('0x1a'))['db'];var jayson=require(_0x47be('0x1b'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x57e5c0,_0x5a1010,_0x2333ab,_0x585774){return new BPromise(function(_0x1311a5,_0x114cb4){var _0x1d0d87=_0x585774||client;return _0x1d0d87[_0x47be('0x1c')](_0x57e5c0,_0x2333ab)[_0x47be('0x1d')](function(_0x11b2b7){logger[_0x47be('0x1e')]('Setting,\x20%s,\x20%s',_0x5a1010,_0x47be('0x1f'));logger['debug'](_0x47be('0x20'),_0x5a1010,_0x47be('0x1f'),JSON[_0x47be('0x21')](_0x11b2b7));if(_0x11b2b7['error']){if(_0x11b2b7['error'][_0x47be('0x22')]===0x1f4){logger['error'](_0x47be('0x23'),_0x5a1010,_0x11b2b7['error']['message']);return _0x114cb4(_0x11b2b7['error'][_0x47be('0x24')]);}logger[_0x47be('0x25')]('Setting,\x20%s,\x20%s',_0x5a1010,_0x11b2b7['error'][_0x47be('0x24')]);return _0x1311a5(_0x11b2b7[_0x47be('0x25')][_0x47be('0x24')]);}else{logger[_0x47be('0x1e')](_0x47be('0x23'),_0x5a1010,_0x47be('0x1f'));_0x1311a5(_0x11b2b7['result'][_0x47be('0x24')]);}})[_0x47be('0x26')](function(_0xb6b541){logger['error'](_0x47be('0x23'),_0x5a1010,_0xb6b541);_0x114cb4(_0xb6b541);});});}function respondWithStatusCode(_0xb4cccb,_0x2d9415){_0x2d9415=_0x2d9415||0xcc;return function(_0x5b62f9){if(_0x5b62f9){return _0xb4cccb[_0x47be('0x27')](_0x2d9415);}return _0xb4cccb['status'](_0x2d9415)[_0x47be('0x28')]();};}function respondWithResult(_0x5533ef,_0x1fd2cd){_0x1fd2cd=_0x1fd2cd||0xc8;return function(_0x113e9f){if(_0x113e9f){return _0x5533ef['status'](_0x1fd2cd)[_0x47be('0x29')](_0x113e9f);}};}function respondWithFilteredResult(_0x3bf6ad,_0x1984bf){return function(_0x1363f8){if(_0x1363f8){var _0x5674f8=typeof _0x1984bf[_0x47be('0x2a')]===_0x47be('0x2b')&&typeof _0x1984bf[_0x47be('0x2c')]===_0x47be('0x2b');var _0x236f69=_0x1363f8[_0x47be('0x2d')];var _0x4f306d=_0x5674f8?0x0:_0x1984bf[_0x47be('0x2a')];var _0x505717=_0x5674f8?_0x1363f8[_0x47be('0x2d')]:_0x1984bf['offset']+_0x1984bf[_0x47be('0x2c')];var _0x5b5435;if(_0x505717>=_0x236f69){_0x505717=_0x236f69;_0x5b5435=0xc8;}else{_0x5b5435=0xce;}_0x3bf6ad[_0x47be('0x2e')](_0x5b5435);return _0x3bf6ad[_0x47be('0x2f')](_0x47be('0x30'),_0x4f306d+'-'+_0x505717+'/'+_0x236f69)['json'](_0x1363f8);}return null;};}function patchUpdates(_0x4b53ba){return function(_0xa3449f){try{jsonpatch[_0x47be('0x31')](_0xa3449f,_0x4b53ba,!![]);}catch(_0x7c071d){return BPromise[_0x47be('0x32')](_0x7c071d);}return _0xa3449f[_0x47be('0x33')]();};}function saveUpdates(_0x1b96e4,_0x3a9cb0){return function(_0x10be7b){if(_0x10be7b){return _0x10be7b[_0x47be('0x34')](_0x1b96e4)[_0x47be('0x1d')](function(_0x5a2f97){return _0x5a2f97;});}return null;};}function removeEntity(_0x43e562,_0x29b8aa){return function(_0xcf4542){if(_0xcf4542){return _0xcf4542['destroy']()['then'](function(){_0x43e562[_0x47be('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4269d9,_0x276deb){return function(_0x323e18){if(!_0x323e18){_0x4269d9[_0x47be('0x27')](0x194);}return _0x323e18;};}function handleError(_0x336517,_0x5872d2){_0x5872d2=_0x5872d2||0x1f4;return function(_0x163c46){logger['error'](_0x163c46[_0x47be('0x35')]);if(_0x163c46[_0x47be('0x36')]){delete _0x163c46[_0x47be('0x36')];}_0x336517[_0x47be('0x2e')](_0x5872d2)[_0x47be('0x37')](_0x163c46);};}exports[_0x47be('0x38')]=function(_0x56c3ae,_0xb5948c){var _0x54a824={},_0x54033a={},_0x458142={'count':0x0,'rows':[]};var _0x1df331=_[_0x47be('0x39')](db[_0x47be('0x3a')][_0x47be('0x3b')],function(_0x1b3cf4){return{'name':_0x1b3cf4[_0x47be('0x3c')],'type':_0x1b3cf4['type'][_0x47be('0x3d')]};});_0x54033a[_0x47be('0x3e')]=_['map'](_0x1df331,'name');_0x54033a['query']=_[_0x47be('0x3f')](_0x56c3ae[_0x47be('0x40')]);_0x54033a['filters']=_['intersection'](_0x54033a[_0x47be('0x3e')],_0x54033a[_0x47be('0x40')]);_0x54a824[_0x47be('0x41')]=_['intersection'](_0x54033a[_0x47be('0x3e')],qs[_0x47be('0x42')](_0x56c3ae[_0x47be('0x40')]['fields']));_0x54a824[_0x47be('0x41')]=_0x54a824[_0x47be('0x41')][_0x47be('0x43')]?_0x54a824[_0x47be('0x41')]:_0x54033a[_0x47be('0x3e')];if(!_0x56c3ae[_0x47be('0x40')][_0x47be('0x44')](_0x47be('0x45'))){_0x54a824[_0x47be('0x2c')]=qs[_0x47be('0x2c')](_0x56c3ae['query']['limit']);_0x54a824['offset']=qs[_0x47be('0x2a')](_0x56c3ae[_0x47be('0x40')][_0x47be('0x2a')]);}_0x54a824[_0x47be('0x46')]=qs['sort'](_0x56c3ae[_0x47be('0x40')][_0x47be('0x47')]);_0x54a824[_0x47be('0x48')]=qs[_0x47be('0x49')](_[_0x47be('0x4a')](_0x56c3ae['query'],_0x54033a[_0x47be('0x49')]),_0x1df331);if(_0x56c3ae[_0x47be('0x40')][_0x47be('0x4b')]){_0x54a824[_0x47be('0x48')]=_['merge'](_0x54a824['where'],{'$or':_[_0x47be('0x39')](_0x1df331,function(_0x1d4ede){if(_0x1d4ede[_0x47be('0x4c')]!=='VIRTUAL'){var _0x1d9b04={};_0x1d9b04[_0x1d4ede['name']]={'$like':'%'+_0x56c3ae[_0x47be('0x40')][_0x47be('0x4b')]+'%'};return _0x1d9b04;}})});}_0x54a824=_[_0x47be('0x4d')]({},_0x54a824,_0x56c3ae['options']);var _0x47a51b={'where':_0x54a824[_0x47be('0x48')]};return db[_0x47be('0x3a')][_0x47be('0x2d')](_0x47a51b)[_0x47be('0x1d')](function(_0xff6b3c){_0x458142['count']=_0xff6b3c;if(_0x56c3ae['query'][_0x47be('0x4e')]){_0x54a824['include']=[{'all':!![]}];}return db[_0x47be('0x3a')]['findAll'](_0x54a824);})[_0x47be('0x1d')](function(_0x236bb2){_0x458142[_0x47be('0x4f')]=_0x236bb2;return _0x458142;})[_0x47be('0x1d')](respondWithFilteredResult(_0xb5948c,_0x54a824))[_0x47be('0x26')](handleError(_0xb5948c,null));};exports[_0x47be('0x50')]=function(_0x23811a,_0x2ee319){var _0x29fe85={'raw':![],'where':{'id':_0x23811a[_0x47be('0x51')]['id']}},_0x1396b8={};_0x1396b8[_0x47be('0x3e')]=_[_0x47be('0x3f')](db[_0x47be('0x3a')][_0x47be('0x3b')]);_0x1396b8[_0x47be('0x40')]=_[_0x47be('0x3f')](_0x23811a[_0x47be('0x40')]);_0x1396b8['filters']=_['intersection'](_0x1396b8[_0x47be('0x3e')],_0x1396b8[_0x47be('0x40')]);_0x29fe85[_0x47be('0x41')]=_[_0x47be('0x52')](_0x1396b8[_0x47be('0x3e')],qs['fields'](_0x23811a[_0x47be('0x40')][_0x47be('0x42')]));_0x29fe85['attributes']=_0x29fe85[_0x47be('0x41')]['length']?_0x29fe85['attributes']:_0x1396b8['model'];if(_0x23811a[_0x47be('0x40')]['includeAll']){_0x29fe85[_0x47be('0x53')]=[{'all':!![]}];}_0x29fe85=_[_0x47be('0x4d')]({},_0x29fe85,_0x23811a['options']);return db[_0x47be('0x3a')][_0x47be('0x54')](_0x29fe85)[_0x47be('0x1d')](handleEntityNotFound(_0x2ee319,null))[_0x47be('0x1d')](respondWithResult(_0x2ee319,null))['catch'](handleError(_0x2ee319,null));};exports[_0x47be('0x34')]=function(_0x442146,_0x307404){if(_0x442146[_0x47be('0x55')]['id']){delete _0x442146[_0x47be('0x55')]['id'];}return db[_0x47be('0x3a')][_0x47be('0x54')]({'where':{'id':_0x442146['params']['id']}})[_0x47be('0x1d')](handleEntityNotFound(_0x307404,null))[_0x47be('0x1d')](saveUpdates(_0x442146[_0x47be('0x55')],null))[_0x47be('0x1d')](respondWithResult(_0x307404,null))['catch'](handleError(_0x307404,null));};exports[_0x47be('0x56')]=function(_0x29329f,_0x419435,_0x1cfee0){if(_0x29329f[_0x47be('0x57')]&&_0x29329f[_0x47be('0x57')]['filename']){_0x29329f[_0x47be('0x55')][_0x47be('0x58')]=_0x29329f[_0x47be('0x57')][_0x47be('0x59')];}return db[_0x47be('0x3a')]['find']({'where':{'id':_0x29329f['params']['id']}})[_0x47be('0x1d')](handleEntityNotFound(_0x419435,null))[_0x47be('0x1d')](saveUpdates(_0x29329f[_0x47be('0x55')],null))['then'](respondWithResult(_0x419435,null))['catch'](handleError(_0x419435,null));};exports['addLogoLogin']=function(_0x45bc4c,_0xf548c2,_0xd9c878){if(_0x45bc4c[_0x47be('0x57')]&&_0x45bc4c['file'][_0x47be('0x59')]){_0x45bc4c[_0x47be('0x55')][_0x47be('0x5a')]=_0x45bc4c[_0x47be('0x57')]['filename'];}return db[_0x47be('0x3a')][_0x47be('0x54')]({'where':{'id':_0x45bc4c[_0x47be('0x51')]['id']}})[_0x47be('0x1d')](handleEntityNotFound(_0xf548c2,null))[_0x47be('0x1d')](saveUpdates(_0x45bc4c[_0x47be('0x55')],null))['then'](respondWithResult(_0xf548c2,null))[_0x47be('0x26')](handleError(_0xf548c2,null));};var utilLicense=require(_0x47be('0x5b'));exports['getLogo']=function(_0x4ecf09,_0x50ece7,_0x5ec872){var _0x59e305='server/files/images/logos';var _0x52b069={'custom':![]};return utilLicense[_0x47be('0x5c')]()[_0x47be('0x1d')](function(_0x267fc1){if(_0x267fc1){_0x52b069=_0x267fc1;}return db[_0x47be('0x3a')][_0x47be('0x54')]({'where':{'id':_0x4ecf09[_0x47be('0x51')]['id']},'attributes':['logo','loginLogo',_0x47be('0x5d'),_0x47be('0x5e'),'defaultLogo',_0x47be('0x5f'),_0x47be('0x60'),_0x47be('0x61')],'raw':!![]});})[_0x47be('0x1d')](handleEntityNotFound(_0x50ece7,null))[_0x47be('0x1d')](function(_0x4578c1){if(_0x4578c1){var _0x2e90fe=_0x4578c1[_0x47be('0x58')]&&fs['existsSync'](path[_0x47be('0x62')](config[_0x47be('0x63')],_0x59e305,_[_0x47be('0x64')](_0x4578c1['logo'])))?path[_0x47be('0x62')](config['root'],_0x59e305,_[_0x47be('0x64')](_0x4578c1[_0x47be('0x58')])):path['join'](config['root'],_0x59e305,_[_0x47be('0x64')](_0x47be('0x65')));var _0xad4509=_0x47be('0x66')+_[_0x47be('0x67')]('logo');if(_0x4578c1[_0xad4509]||!_0x52b069[_0x47be('0x68')]){_0x2e90fe=path['join'](config[_0x47be('0x63')],_0x59e305,_[_0x47be('0x64')](_0x47be('0x65')));}if(!fs[_0x47be('0x69')](_0x2e90fe)){throw new db[(_0x47be('0x6a'))][(_0x47be('0x6b'))](_['upperFirst'](_0x47be('0x58'))+'\x20not\x20found');}return _0x50ece7['download'](_0x2e90fe);}})['catch'](handleError(_0x50ece7,null));};var utilLicense=require(_0x47be('0x5b'));exports[_0x47be('0x6c')]=function(_0x4910ee,_0x46b6f9,_0x4204cd){var _0x59a2ba='server/files/images/logos';var _0x592e6a={'custom':![]};return utilLicense[_0x47be('0x5c')]()[_0x47be('0x1d')](function(_0x3f45e4){if(_0x3f45e4){_0x592e6a=_0x3f45e4;}return db[_0x47be('0x3a')][_0x47be('0x54')]({'where':{'id':_0x4910ee['params']['id']},'attributes':[_0x47be('0x58'),_0x47be('0x5a'),'preferred',_0x47be('0x5e'),_0x47be('0x6d'),_0x47be('0x5f'),'defaultPreferred',_0x47be('0x61')],'raw':!![]});})[_0x47be('0x1d')](handleEntityNotFound(_0x46b6f9,null))[_0x47be('0x1d')](function(_0x39280d){if(_0x39280d){var _0x493584=_0x39280d[_0x47be('0x5a')]&&fs[_0x47be('0x69')](path['join'](config[_0x47be('0x63')],_0x59a2ba,_[_0x47be('0x64')](_0x39280d[_0x47be('0x5a')])))?path['join'](config['root'],_0x59a2ba,_[_0x47be('0x64')](_0x39280d[_0x47be('0x5a')])):path[_0x47be('0x62')](config['root'],_0x59a2ba,_[_0x47be('0x64')](_0x47be('0x6e')));var _0x332b69=_0x47be('0x66')+_[_0x47be('0x67')](_0x47be('0x5a'));if(_0x39280d[_0x332b69]||!_0x592e6a[_0x47be('0x68')]){_0x493584=path['join'](config[_0x47be('0x63')],_0x59a2ba,_[_0x47be('0x64')](_0x47be('0x6e')));}if(!fs[_0x47be('0x69')](_0x493584)){throw new db[(_0x47be('0x6a'))][(_0x47be('0x6b'))](_['upperFirst'](_0x47be('0x5a'))+'\x20not\x20found');}return _0x46b6f9[_0x47be('0x6f')](_0x493584);}})[_0x47be('0x26')](handleError(_0x46b6f9,null));};exports[_0x47be('0x70')]=function(_0x25eb44,_0x3c4ace){return db[_0x47be('0x3a')][_0x47be('0x54')]({'where':{'id':_0x25eb44['params']['id']},'attributes':['securePassword']})[_0x47be('0x1d')](respondWithResult(_0x3c4ace,null))[_0x47be('0x26')](handleError(_0x3c4ace,null));};exports[_0x47be('0x71')]=function(_0x4960fa,_0x5e5386,_0x530389){if(_0x4960fa['file']&&_0x4960fa[_0x47be('0x57')][_0x47be('0x59')]){_0x4960fa[_0x47be('0x55')][_0x47be('0x5d')]=_0x4960fa[_0x47be('0x57')][_0x47be('0x59')];}return db['Setting'][_0x47be('0x54')]({'where':{'id':_0x4960fa['params']['id']}})[_0x47be('0x1d')](handleEntityNotFound(_0x5e5386,null))[_0x47be('0x1d')](saveUpdates(_0x4960fa[_0x47be('0x55')],null))[_0x47be('0x1d')](respondWithResult(_0x5e5386,null))[_0x47be('0x26')](handleError(_0x5e5386,null));};var utilLicense=require(_0x47be('0x5b'));exports['getPreferred']=function(_0x4d9181,_0x2253ea,_0x7ecafe){var _0x11369f=_0x47be('0x72');var _0x2e6a04={'custom':![]};return utilLicense['getLicense']()[_0x47be('0x1d')](function(_0x1b3eb9){if(_0x1b3eb9){_0x2e6a04=_0x1b3eb9;}return db[_0x47be('0x3a')][_0x47be('0x54')]({'where':{'id':_0x4d9181['params']['id']},'attributes':['logo',_0x47be('0x5a'),_0x47be('0x5d'),_0x47be('0x5e'),_0x47be('0x6d'),_0x47be('0x5f'),_0x47be('0x60'),_0x47be('0x61')],'raw':!![]});})[_0x47be('0x1d')](handleEntityNotFound(_0x2253ea,null))[_0x47be('0x1d')](function(_0x2ac14c){if(_0x2ac14c){var _0x29a0c1=_0x2ac14c[_0x47be('0x5d')]&&fs['existsSync'](path[_0x47be('0x62')](config[_0x47be('0x63')],_0x11369f,_[_0x47be('0x64')](_0x2ac14c[_0x47be('0x5d')])))?path[_0x47be('0x62')](config['root'],_0x11369f,_[_0x47be('0x64')](_0x2ac14c['preferred'])):path['join'](config[_0x47be('0x63')],_0x11369f,_[_0x47be('0x64')](_0x47be('0x73')));var _0x2f5455='default'+_[_0x47be('0x67')]('preferred');if(_0x2ac14c[_0x2f5455]||!_0x2e6a04[_0x47be('0x68')]||!_0x2e6a04[_0x47be('0x5d')]){_0x29a0c1=path[_0x47be('0x62')](config[_0x47be('0x63')],_0x11369f,_[_0x47be('0x64')](_0x47be('0x73')));}if(!fs[_0x47be('0x69')](_0x29a0c1)){throw new db[(_0x47be('0x6a'))][(_0x47be('0x6b'))](_[_0x47be('0x67')](_0x47be('0x5d'))+'\x20not\x20found');}return _0x2253ea[_0x47be('0x6f')](_0x29a0c1);}})['catch'](handleError(_0x2253ea,null));};exports[_0x47be('0x74')]=function(_0x4fa7f5,_0x121ec5,_0x3ae841){if(_0x4fa7f5[_0x47be('0x57')]&&_0x4fa7f5[_0x47be('0x57')]['filename']){_0x4fa7f5[_0x47be('0x55')][_0x47be('0x5e')]=_0x4fa7f5[_0x47be('0x57')][_0x47be('0x59')];}return db[_0x47be('0x3a')]['find']({'where':{'id':_0x4fa7f5[_0x47be('0x51')]['id']}})[_0x47be('0x1d')](handleEntityNotFound(_0x121ec5,null))[_0x47be('0x1d')](saveUpdates(_0x4fa7f5[_0x47be('0x55')],null))[_0x47be('0x1d')](respondWithResult(_0x121ec5,null))[_0x47be('0x26')](handleError(_0x121ec5,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x83365d,_0x5d1d07,_0x43cce4){var _0x36917f=_0x47be('0x72');var _0x370eaa={'custom':![]};return utilLicense[_0x47be('0x5c')]()[_0x47be('0x1d')](function(_0x434e77){if(_0x434e77){_0x370eaa=_0x434e77;}return db['Setting'][_0x47be('0x54')]({'where':{'id':_0x83365d[_0x47be('0x51')]['id']},'attributes':['logo','loginLogo',_0x47be('0x5d'),_0x47be('0x5e'),'defaultLogo',_0x47be('0x5f'),_0x47be('0x60'),_0x47be('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x5d1d07,null))[_0x47be('0x1d')](function(_0x5c3e6d){if(_0x5c3e6d){var _0x2ee34e=_0x5c3e6d[_0x47be('0x5e')]&&fs['existsSync'](path['join'](config[_0x47be('0x63')],_0x36917f,_[_0x47be('0x64')](_0x5c3e6d['favicon'])))?path[_0x47be('0x62')](config[_0x47be('0x63')],_0x36917f,_[_0x47be('0x64')](_0x5c3e6d['favicon'])):path['join'](config['root'],_0x36917f,_['toLower'](_0x47be('0x75')));var _0x22943f='default'+_['upperFirst']('favicon');if(_0x5c3e6d[_0x22943f]||!_0x370eaa[_0x47be('0x68')]){_0x2ee34e=path[_0x47be('0x62')](config['root'],_0x36917f,_[_0x47be('0x64')]('default_favicon.ico'));}if(!fs[_0x47be('0x69')](_0x2ee34e)){throw new db[(_0x47be('0x6a'))][(_0x47be('0x6b'))](_[_0x47be('0x67')]('favicon')+'\x20not\x20found');}return _0x5d1d07[_0x47be('0x6f')](_0x2ee34e);}})['catch'](handleError(_0x5d1d07,null));};exports[_0x47be('0x76')]=function(_0xa1a73c,_0x6da59b){var _0x3eca4c={'offset':moment()[_0x47be('0x77')]()};_0x3eca4c[_0x47be('0x78')]=moment()[_0x47be('0x77')](_0x3eca4c['offset'])['format'](_0x47be('0x79'));return _0x6da59b[_0x47be('0x2e')](0xc8)[_0x47be('0x37')](_0x3eca4c);}; \ No newline at end of file +var _0x9879=['defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','preferred','default_loginLogo.svg','existsSync','ValidationError','gdpr','securePassword','default_preferred.png','download','addFavicon','getFavicon','default_favicon.ico','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','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','sendStatus','status','json','offset','undefined','limit','count','apply','reject','update','destroy','end','stack','name','map','Setting','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','params','model','length','include','find','body','addLogo','file','logo','addLogoLogin','filename','getLogo','server/files/images/logos','getLicense','loginLogo','favicon','defaultLogo'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9879,0x98));var _0x9987=function(_0x50b7f4,_0x5f04a){_0x50b7f4=_0x50b7f4-0x0;var _0x192341=_0x9879[_0x50b7f4];return _0x192341;};'use strict';var emlformat=require(_0x9987('0x0'));var rimraf=require(_0x9987('0x1'));var zipdir=require(_0x9987('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9987('0x3'));var moment=require('moment');var BPromise=require(_0x9987('0x4'));var Mustache=require(_0x9987('0x5'));var util=require(_0x9987('0x6'));var path=require(_0x9987('0x7'));var sox=require(_0x9987('0x8'));var csv=require(_0x9987('0x9'));var ejs=require(_0x9987('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9987('0xb'));var squel=require('squel');var crypto=require(_0x9987('0xc'));var jsforce=require(_0x9987('0xd'));var deskjs=require(_0x9987('0xe'));var toCsv=require(_0x9987('0x9'));var querystring=require(_0x9987('0xf'));var Papa=require(_0x9987('0x10'));var Redis=require(_0x9987('0x11'));var authService=require(_0x9987('0x12'));var qs=require(_0x9987('0x13'));var as=require(_0x9987('0x14'));var hardwareService=require(_0x9987('0x15'));var logger=require(_0x9987('0x16'))(_0x9987('0x17'));var utils=require(_0x9987('0x18'));var config=require(_0x9987('0x19'));var licenseUtil=require(_0x9987('0x1a'));var db=require(_0x9987('0x1b'))['db'];var jayson=require(_0x9987('0x1c'));var client=jayson['client'][_0x9987('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x33cf22,_0x2d03e9,_0x374098,_0x2f3207){return new BPromise(function(_0x5d8e6a,_0xb976c3){var _0x4a4b61=_0x2f3207||client;return _0x4a4b61[_0x9987('0x1e')](_0x33cf22,_0x374098)[_0x9987('0x1f')](function(_0x2bd935){logger[_0x9987('0x20')](_0x9987('0x21'),_0x2d03e9,_0x9987('0x22'));logger[_0x9987('0x23')](_0x9987('0x24'),_0x2d03e9,_0x9987('0x22'),JSON[_0x9987('0x25')](_0x2bd935));if(_0x2bd935[_0x9987('0x26')]){if(_0x2bd935[_0x9987('0x26')][_0x9987('0x27')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x2d03e9,_0x2bd935[_0x9987('0x26')][_0x9987('0x28')]);return _0xb976c3(_0x2bd935[_0x9987('0x26')][_0x9987('0x28')]);}logger['error'](_0x9987('0x21'),_0x2d03e9,_0x2bd935[_0x9987('0x26')][_0x9987('0x28')]);return _0x5d8e6a(_0x2bd935[_0x9987('0x26')]['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0x2d03e9,_0x9987('0x22'));_0x5d8e6a(_0x2bd935[_0x9987('0x29')]['message']);}})[_0x9987('0x2a')](function(_0x539f27){logger[_0x9987('0x26')](_0x9987('0x21'),_0x2d03e9,_0x539f27);_0xb976c3(_0x539f27);});});}function respondWithStatusCode(_0x194d1a,_0xbdef68){_0xbdef68=_0xbdef68||0xcc;return function(_0x29c39e){if(_0x29c39e){return _0x194d1a[_0x9987('0x2b')](_0xbdef68);}return _0x194d1a[_0x9987('0x2c')](_0xbdef68)['end']();};}function respondWithResult(_0x4beaf6,_0x368d41){_0x368d41=_0x368d41||0xc8;return function(_0x4094f2){if(_0x4094f2){return _0x4beaf6[_0x9987('0x2c')](_0x368d41)[_0x9987('0x2d')](_0x4094f2);}};}function respondWithFilteredResult(_0x230402,_0x4c442a){return function(_0x11863a){if(_0x11863a){var _0x324b9f=typeof _0x4c442a[_0x9987('0x2e')]===_0x9987('0x2f')&&typeof _0x4c442a[_0x9987('0x30')]==='undefined';var _0x3a2ec2=_0x11863a['count'];var _0x5ce1d6=_0x324b9f?0x0:_0x4c442a[_0x9987('0x2e')];var _0x497b15=_0x324b9f?_0x11863a[_0x9987('0x31')]:_0x4c442a[_0x9987('0x2e')]+_0x4c442a[_0x9987('0x30')];var _0x5ec5b1;if(_0x497b15>=_0x3a2ec2){_0x497b15=_0x3a2ec2;_0x5ec5b1=0xc8;}else{_0x5ec5b1=0xce;}_0x230402['status'](_0x5ec5b1);return _0x230402['set']('Content-Range',_0x5ce1d6+'-'+_0x497b15+'/'+_0x3a2ec2)[_0x9987('0x2d')](_0x11863a);}return null;};}function patchUpdates(_0xf09b1a){return function(_0xc80f69){try{jsonpatch[_0x9987('0x32')](_0xc80f69,_0xf09b1a,!![]);}catch(_0x96ccb){return BPromise[_0x9987('0x33')](_0x96ccb);}return _0xc80f69['save']();};}function saveUpdates(_0x22a28e,_0x312faa){return function(_0x590dfc){if(_0x590dfc){return _0x590dfc[_0x9987('0x34')](_0x22a28e)[_0x9987('0x1f')](function(_0x1a0c05){return _0x1a0c05;});}return null;};}function removeEntity(_0x38f354,_0x292728){return function(_0x3d1750){if(_0x3d1750){return _0x3d1750[_0x9987('0x35')]()[_0x9987('0x1f')](function(){_0x38f354[_0x9987('0x2c')](0xcc)[_0x9987('0x36')]();});}};}function handleEntityNotFound(_0x3a044d,_0x2b854f){return function(_0x55496f){if(!_0x55496f){_0x3a044d[_0x9987('0x2b')](0x194);}return _0x55496f;};}function handleError(_0x4e6416,_0x4948fc){_0x4948fc=_0x4948fc||0x1f4;return function(_0x4c37fc){logger['error'](_0x4c37fc[_0x9987('0x37')]);if(_0x4c37fc[_0x9987('0x38')]){delete _0x4c37fc['name'];}_0x4e6416['status'](_0x4948fc)['send'](_0x4c37fc);};}exports['index']=function(_0x4a162f,_0x3e7476){var _0x357d6c={},_0xc35e5e={},_0x19aa56={'count':0x0,'rows':[]};var _0x43efbb=_[_0x9987('0x39')](db[_0x9987('0x3a')][_0x9987('0x3b')],function(_0x3db02d){return{'name':_0x3db02d[_0x9987('0x3c')],'type':_0x3db02d[_0x9987('0x3d')][_0x9987('0x3e')]};});_0xc35e5e['model']=_['map'](_0x43efbb,'name');_0xc35e5e[_0x9987('0x3f')]=_[_0x9987('0x40')](_0x4a162f['query']);_0xc35e5e[_0x9987('0x41')]=_[_0x9987('0x42')](_0xc35e5e['model'],_0xc35e5e[_0x9987('0x3f')]);_0x357d6c[_0x9987('0x43')]=_[_0x9987('0x42')](_0xc35e5e['model'],qs[_0x9987('0x44')](_0x4a162f['query'][_0x9987('0x44')]));_0x357d6c[_0x9987('0x43')]=_0x357d6c[_0x9987('0x43')]['length']?_0x357d6c[_0x9987('0x43')]:_0xc35e5e['model'];if(!_0x4a162f[_0x9987('0x3f')]['hasOwnProperty'](_0x9987('0x45'))){_0x357d6c[_0x9987('0x30')]=qs[_0x9987('0x30')](_0x4a162f[_0x9987('0x3f')][_0x9987('0x30')]);_0x357d6c[_0x9987('0x2e')]=qs[_0x9987('0x2e')](_0x4a162f[_0x9987('0x3f')]['offset']);}_0x357d6c[_0x9987('0x46')]=qs[_0x9987('0x47')](_0x4a162f[_0x9987('0x3f')][_0x9987('0x47')]);_0x357d6c['where']=qs[_0x9987('0x41')](_[_0x9987('0x48')](_0x4a162f[_0x9987('0x3f')],_0xc35e5e[_0x9987('0x41')]),_0x43efbb);if(_0x4a162f[_0x9987('0x3f')][_0x9987('0x49')]){_0x357d6c[_0x9987('0x4a')]=_[_0x9987('0x4b')](_0x357d6c['where'],{'$or':_[_0x9987('0x39')](_0x43efbb,function(_0x110b71){if(_0x110b71[_0x9987('0x3d')]!==_0x9987('0x4c')){var _0x109a00={};_0x109a00[_0x110b71[_0x9987('0x38')]]={'$like':'%'+_0x4a162f[_0x9987('0x3f')]['filter']+'%'};return _0x109a00;}})});}_0x357d6c=_[_0x9987('0x4b')]({},_0x357d6c,_0x4a162f[_0x9987('0x4d')]);var _0x250511={'where':_0x357d6c[_0x9987('0x4a')]};return db[_0x9987('0x3a')]['count'](_0x250511)['then'](function(_0x497847){_0x19aa56[_0x9987('0x31')]=_0x497847;if(_0x4a162f[_0x9987('0x3f')][_0x9987('0x4e')]){_0x357d6c['include']=[{'all':!![]}];}return db['Setting'][_0x9987('0x4f')](_0x357d6c);})['then'](function(_0x21c898){_0x19aa56['rows']=_0x21c898;return _0x19aa56;})[_0x9987('0x1f')](respondWithFilteredResult(_0x3e7476,_0x357d6c))['catch'](handleError(_0x3e7476,null));};exports[_0x9987('0x50')]=function(_0x4603cc,_0x1ddca5){var _0x4806cb={'raw':![],'where':{'id':_0x4603cc[_0x9987('0x51')]['id']}},_0x4ead5f={};_0x4ead5f['model']=_[_0x9987('0x40')](db[_0x9987('0x3a')][_0x9987('0x3b')]);_0x4ead5f['query']=_[_0x9987('0x40')](_0x4603cc[_0x9987('0x3f')]);_0x4ead5f['filters']=_[_0x9987('0x42')](_0x4ead5f[_0x9987('0x52')],_0x4ead5f[_0x9987('0x3f')]);_0x4806cb[_0x9987('0x43')]=_[_0x9987('0x42')](_0x4ead5f[_0x9987('0x52')],qs[_0x9987('0x44')](_0x4603cc['query'][_0x9987('0x44')]));_0x4806cb[_0x9987('0x43')]=_0x4806cb[_0x9987('0x43')][_0x9987('0x53')]?_0x4806cb[_0x9987('0x43')]:_0x4ead5f['model'];if(_0x4603cc['query'][_0x9987('0x4e')]){_0x4806cb[_0x9987('0x54')]=[{'all':!![]}];}_0x4806cb=_[_0x9987('0x4b')]({},_0x4806cb,_0x4603cc[_0x9987('0x4d')]);return db[_0x9987('0x3a')][_0x9987('0x55')](_0x4806cb)[_0x9987('0x1f')](handleEntityNotFound(_0x1ddca5,null))['then'](respondWithResult(_0x1ddca5,null))[_0x9987('0x2a')](handleError(_0x1ddca5,null));};exports['update']=function(_0x1e071c,_0x8dcfd2){if(_0x1e071c[_0x9987('0x56')]['id']){delete _0x1e071c['body']['id'];}return db[_0x9987('0x3a')][_0x9987('0x55')]({'where':{'id':_0x1e071c[_0x9987('0x51')]['id']}})[_0x9987('0x1f')](handleEntityNotFound(_0x8dcfd2,null))[_0x9987('0x1f')](saveUpdates(_0x1e071c[_0x9987('0x56')],null))['then'](respondWithResult(_0x8dcfd2,null))[_0x9987('0x2a')](handleError(_0x8dcfd2,null));};exports[_0x9987('0x57')]=function(_0x366e79,_0x51ef56,_0x220fa7){if(_0x366e79['file']&&_0x366e79[_0x9987('0x58')]['filename']){_0x366e79[_0x9987('0x56')][_0x9987('0x59')]=_0x366e79['file']['filename'];}return db[_0x9987('0x3a')]['find']({'where':{'id':_0x366e79[_0x9987('0x51')]['id']}})[_0x9987('0x1f')](handleEntityNotFound(_0x51ef56,null))['then'](saveUpdates(_0x366e79['body'],null))[_0x9987('0x1f')](respondWithResult(_0x51ef56,null))['catch'](handleError(_0x51ef56,null));};exports[_0x9987('0x5a')]=function(_0x1e2257,_0x5d274d,_0x187daf){if(_0x1e2257[_0x9987('0x58')]&&_0x1e2257['file'][_0x9987('0x5b')]){_0x1e2257['body']['loginLogo']=_0x1e2257['file'][_0x9987('0x5b')];}return db[_0x9987('0x3a')][_0x9987('0x55')]({'where':{'id':_0x1e2257[_0x9987('0x51')]['id']}})[_0x9987('0x1f')](handleEntityNotFound(_0x5d274d,null))['then'](saveUpdates(_0x1e2257[_0x9987('0x56')],null))[_0x9987('0x1f')](respondWithResult(_0x5d274d,null))[_0x9987('0x2a')](handleError(_0x5d274d,null));};var utilLicense=require(_0x9987('0x1a'));exports[_0x9987('0x5c')]=function(_0xb692ce,_0x2ffdef,_0x181fd4){var _0x1809f5=_0x9987('0x5d');var _0x426e92={'custom':![]};return utilLicense[_0x9987('0x5e')]()['then'](function(_0x39a42c){if(_0x39a42c){_0x426e92=_0x39a42c;}return db['Setting']['find']({'where':{'id':_0xb692ce['params']['id']},'attributes':[_0x9987('0x59'),_0x9987('0x5f'),'preferred',_0x9987('0x60'),_0x9987('0x61'),_0x9987('0x62'),_0x9987('0x63'),_0x9987('0x64')],'raw':!![]});})[_0x9987('0x1f')](handleEntityNotFound(_0x2ffdef,null))[_0x9987('0x1f')](function(_0x2075ce){if(_0x2075ce){var _0x58dce1=_0x2075ce[_0x9987('0x59')]&&fs['existsSync'](path[_0x9987('0x65')](config[_0x9987('0x66')],_0x1809f5,_[_0x9987('0x67')](_0x2075ce[_0x9987('0x59')])))?path[_0x9987('0x65')](config[_0x9987('0x66')],_0x1809f5,_[_0x9987('0x67')](_0x2075ce[_0x9987('0x59')])):path[_0x9987('0x65')](config[_0x9987('0x66')],_0x1809f5,_[_0x9987('0x67')](_0x9987('0x68')));var _0x1be801=_0x9987('0x69')+_[_0x9987('0x6a')](_0x9987('0x59'));if(_0x2075ce[_0x1be801]||!_0x426e92[_0x9987('0x6b')]){_0x58dce1=path[_0x9987('0x65')](config[_0x9987('0x66')],_0x1809f5,_[_0x9987('0x67')](_0x9987('0x68')));}if(!fs['existsSync'](_0x58dce1)){throw new db[(_0x9987('0x6c'))]['ValidationError'](_[_0x9987('0x6a')](_0x9987('0x59'))+_0x9987('0x6d'));}return _0x2ffdef['download'](_0x58dce1);}})[_0x9987('0x2a')](handleError(_0x2ffdef,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x19bffe,_0x3fc28f,_0x296db9){var _0x17cf53='server/files/images/logos';var _0x11b8db={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x518cf3){if(_0x518cf3){_0x11b8db=_0x518cf3;}return db['Setting'][_0x9987('0x55')]({'where':{'id':_0x19bffe[_0x9987('0x51')]['id']},'attributes':[_0x9987('0x59'),_0x9987('0x5f'),_0x9987('0x6e'),_0x9987('0x60'),_0x9987('0x61'),_0x9987('0x62'),_0x9987('0x63'),_0x9987('0x64')],'raw':!![]});})[_0x9987('0x1f')](handleEntityNotFound(_0x3fc28f,null))['then'](function(_0x92adc1){if(_0x92adc1){var _0x487d2c=_0x92adc1[_0x9987('0x5f')]&&fs['existsSync'](path[_0x9987('0x65')](config[_0x9987('0x66')],_0x17cf53,_[_0x9987('0x67')](_0x92adc1[_0x9987('0x5f')])))?path['join'](config[_0x9987('0x66')],_0x17cf53,_['toLower'](_0x92adc1['loginLogo'])):path[_0x9987('0x65')](config['root'],_0x17cf53,_[_0x9987('0x67')](_0x9987('0x6f')));var _0xfe0cb9=_0x9987('0x69')+_[_0x9987('0x6a')](_0x9987('0x5f'));if(_0x92adc1[_0xfe0cb9]||!_0x11b8db[_0x9987('0x6b')]){_0x487d2c=path[_0x9987('0x65')](config[_0x9987('0x66')],_0x17cf53,_[_0x9987('0x67')](_0x9987('0x6f')));}if(!fs[_0x9987('0x70')](_0x487d2c)){throw new db[(_0x9987('0x6c'))][(_0x9987('0x71'))](_['upperFirst']('loginLogo')+_0x9987('0x6d'));}return _0x3fc28f['download'](_0x487d2c);}})[_0x9987('0x2a')](handleError(_0x3fc28f,null));};exports[_0x9987('0x72')]=function(_0x51df5b,_0x4d618e){return db[_0x9987('0x3a')][_0x9987('0x55')]({'where':{'id':_0x51df5b['params']['id']},'attributes':[_0x9987('0x73')]})[_0x9987('0x1f')](respondWithResult(_0x4d618e,null))[_0x9987('0x2a')](handleError(_0x4d618e,null));};exports['addPreferred']=function(_0x46200b,_0x2dd326,_0x52633a){if(_0x46200b[_0x9987('0x58')]&&_0x46200b[_0x9987('0x58')][_0x9987('0x5b')]){_0x46200b[_0x9987('0x56')]['preferred']=_0x46200b[_0x9987('0x58')]['filename'];}return db[_0x9987('0x3a')][_0x9987('0x55')]({'where':{'id':_0x46200b['params']['id']}})[_0x9987('0x1f')](handleEntityNotFound(_0x2dd326,null))[_0x9987('0x1f')](saveUpdates(_0x46200b[_0x9987('0x56')],null))[_0x9987('0x1f')](respondWithResult(_0x2dd326,null))[_0x9987('0x2a')](handleError(_0x2dd326,null));};var utilLicense=require(_0x9987('0x1a'));exports['getPreferred']=function(_0x5daf9f,_0xd95f1d,_0x2919f7){var _0x1aeea7='server/files/images/logos';var _0x18b93a={'custom':![]};return utilLicense[_0x9987('0x5e')]()[_0x9987('0x1f')](function(_0x4b4c00){if(_0x4b4c00){_0x18b93a=_0x4b4c00;}return db[_0x9987('0x3a')]['find']({'where':{'id':_0x5daf9f[_0x9987('0x51')]['id']},'attributes':['logo','loginLogo','preferred',_0x9987('0x60'),_0x9987('0x61'),_0x9987('0x62'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x9987('0x1f')](handleEntityNotFound(_0xd95f1d,null))[_0x9987('0x1f')](function(_0x3acaf0){if(_0x3acaf0){var _0x10978f=_0x3acaf0[_0x9987('0x6e')]&&fs[_0x9987('0x70')](path[_0x9987('0x65')](config['root'],_0x1aeea7,_[_0x9987('0x67')](_0x3acaf0[_0x9987('0x6e')])))?path[_0x9987('0x65')](config[_0x9987('0x66')],_0x1aeea7,_[_0x9987('0x67')](_0x3acaf0[_0x9987('0x6e')])):path[_0x9987('0x65')](config[_0x9987('0x66')],_0x1aeea7,_[_0x9987('0x67')](_0x9987('0x74')));var _0x24082d='default'+_[_0x9987('0x6a')](_0x9987('0x6e'));if(_0x3acaf0[_0x24082d]||!_0x18b93a[_0x9987('0x6b')]||!_0x18b93a['preferred']){_0x10978f=path['join'](config[_0x9987('0x66')],_0x1aeea7,_[_0x9987('0x67')](_0x9987('0x74')));}if(!fs[_0x9987('0x70')](_0x10978f)){throw new db['Sequelize'][(_0x9987('0x71'))](_['upperFirst']('preferred')+'\x20not\x20found');}return _0xd95f1d[_0x9987('0x75')](_0x10978f);}})[_0x9987('0x2a')](handleError(_0xd95f1d,null));};exports[_0x9987('0x76')]=function(_0x1268f1,_0x15c907,_0xcb0577){if(_0x1268f1['file']&&_0x1268f1[_0x9987('0x58')][_0x9987('0x5b')]){_0x1268f1[_0x9987('0x56')][_0x9987('0x60')]=_0x1268f1[_0x9987('0x58')][_0x9987('0x5b')];}return db[_0x9987('0x3a')][_0x9987('0x55')]({'where':{'id':_0x1268f1[_0x9987('0x51')]['id']}})['then'](handleEntityNotFound(_0x15c907,null))[_0x9987('0x1f')](saveUpdates(_0x1268f1[_0x9987('0x56')],null))[_0x9987('0x1f')](respondWithResult(_0x15c907,null))[_0x9987('0x2a')](handleError(_0x15c907,null));};var utilLicense=require(_0x9987('0x1a'));exports[_0x9987('0x77')]=function(_0x55127e,_0x384cdd,_0x55e48c){var _0x5c5e5f=_0x9987('0x5d');var _0x2bc41e={'custom':![]};return utilLicense[_0x9987('0x5e')]()[_0x9987('0x1f')](function(_0x186c55){if(_0x186c55){_0x2bc41e=_0x186c55;}return db['Setting'][_0x9987('0x55')]({'where':{'id':_0x55127e[_0x9987('0x51')]['id']},'attributes':[_0x9987('0x59'),_0x9987('0x5f'),'preferred',_0x9987('0x60'),'defaultLogo',_0x9987('0x62'),_0x9987('0x63'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x384cdd,null))['then'](function(_0x5af8aa){if(_0x5af8aa){var _0x5e5bca=_0x5af8aa['favicon']&&fs[_0x9987('0x70')](path[_0x9987('0x65')](config[_0x9987('0x66')],_0x5c5e5f,_[_0x9987('0x67')](_0x5af8aa[_0x9987('0x60')])))?path['join'](config[_0x9987('0x66')],_0x5c5e5f,_['toLower'](_0x5af8aa[_0x9987('0x60')])):path[_0x9987('0x65')](config['root'],_0x5c5e5f,_[_0x9987('0x67')](_0x9987('0x78')));var _0x44e1a9='default'+_[_0x9987('0x6a')](_0x9987('0x60'));if(_0x5af8aa[_0x44e1a9]||!_0x2bc41e[_0x9987('0x6b')]){_0x5e5bca=path[_0x9987('0x65')](config[_0x9987('0x66')],_0x5c5e5f,_[_0x9987('0x67')](_0x9987('0x78')));}if(!fs[_0x9987('0x70')](_0x5e5bca)){throw new db[(_0x9987('0x6c'))]['ValidationError'](_['upperFirst'](_0x9987('0x60'))+'\x20not\x20found');}return _0x384cdd['download'](_0x5e5bca);}})[_0x9987('0x2a')](handleError(_0x384cdd,null));};exports['getDate']=function(_0x3faa2c,_0x45bbfa){var _0x5d5ce8={'offset':moment()['utcOffset']()};_0x5d5ce8[_0x9987('0x79')]=moment()['utcOffset'](_0x5d5ce8[_0x9987('0x2e')])[_0x9987('0x7a')](_0x9987('0x7b'));return _0x45bbfa[_0x9987('0x2c')](0xc8)[_0x9987('0x7c')](_0x5d5ce8);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 70179b6..78c61fb 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x16cf9e,_0x3d3cfd){var _0x56aefd=function(_0x24d46e){while(--_0x24d46e){_0x16cf9e['push'](_0x16cf9e['shift']());}};_0x56aefd(++_0x3d3cfd);}(_0x008c,0x188));var _0xc008=function(_0x91d019,_0x5223c4){_0x91d019=_0x91d019-0x0;var _0x19de1f=_0x008c[_0x91d019];return _0x19de1f;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 7693b51..df9c3cb 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 _0x1275=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Setting','find','options','raw','where','map','include','model','attributes','ShowSetting','catch'];(function(_0x5becd6,_0x128819){var _0x25368d=function(_0x3238d6){while(--_0x3238d6){_0x5becd6['push'](_0x5becd6['shift']());}};_0x25368d(++_0x128819);}(_0x1275,0x14a));var _0x5127=function(_0xba30a5,_0x2a6589){_0xba30a5=_0xba30a5-0x0;var _0x303340=_0x1275[_0xba30a5];return _0x303340;};'use strict';var _=require(_0x5127('0x0'));var util=require(_0x5127('0x1'));var moment=require('moment');var BPromise=require(_0x5127('0x2'));var rs=require(_0x5127('0x3'));var fs=require('fs');var Redis=require(_0x5127('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5127('0x5'));var logger=require(_0x5127('0x6'))(_0x5127('0x7'));var config=require(_0x5127('0x8'));var jayson=require(_0x5127('0x9'));var client=jayson[_0x5127('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b626b,_0x2b84d2,_0x673400){return new BPromise(function(_0x5034bc,_0x3077c1){return client[_0x5127('0xb')](_0x3b626b,_0x673400)[_0x5127('0xc')](function(_0x26b4bc){logger[_0x5127('0xd')](_0x5127('0xe'),_0x2b84d2,_0x5127('0xf'));logger['debug'](_0x5127('0x10'),_0x2b84d2,'request\x20sent',JSON[_0x5127('0x11')](_0x26b4bc));if(_0x26b4bc[_0x5127('0x12')]){if(_0x26b4bc['error'][_0x5127('0x13')]===0x1f4){logger['error'](_0x5127('0xe'),_0x2b84d2,_0x26b4bc[_0x5127('0x12')]['message']);return _0x3077c1(_0x26b4bc[_0x5127('0x12')][_0x5127('0x14')]);}logger[_0x5127('0x12')]('Setting,\x20%s,\x20%s',_0x2b84d2,_0x26b4bc[_0x5127('0x12')][_0x5127('0x14')]);return _0x5034bc(_0x26b4bc[_0x5127('0x12')][_0x5127('0x14')]);}else{logger[_0x5127('0xd')](_0x5127('0xe'),_0x2b84d2,_0x5127('0xf'));_0x5034bc(_0x26b4bc[_0x5127('0x15')][_0x5127('0x14')]);}})['catch'](function(_0x110218){logger[_0x5127('0x12')]('Setting,\x20%s,\x20%s',_0x2b84d2,_0x110218);_0x3077c1(_0x110218);});});}exports['ShowSetting']=function(_0x1c8110){var _0x4b282d=this;return new Promise(function(_0x56096c,_0x2ccd5a){return db[_0x5127('0x16')][_0x5127('0x17')]({'raw':_0x1c8110[_0x5127('0x18')]?_0x1c8110[_0x5127('0x18')][_0x5127('0x19')]===undefined?!![]:![]:!![],'where':_0x1c8110[_0x5127('0x18')]?_0x1c8110['options'][_0x5127('0x1a')]||null:null,'attributes':_0x1c8110[_0x5127('0x18')]?_0x1c8110[_0x5127('0x18')]['attributes']||null:null,'include':_0x1c8110['options']?_0x1c8110['options']['include']?_[_0x5127('0x1b')](_0x1c8110[_0x5127('0x18')][_0x5127('0x1c')],function(_0x54ec39){return{'model':db[_0x54ec39[_0x5127('0x1d')]],'as':_0x54ec39['as'],'attributes':_0x54ec39['attributes'],'include':_0x54ec39[_0x5127('0x1c')]?_[_0x5127('0x1b')](_0x54ec39[_0x5127('0x1c')],function(_0x3eaa55){return{'model':db[_0x3eaa55[_0x5127('0x1d')]],'as':_0x3eaa55['as'],'attributes':_0x3eaa55[_0x5127('0x1e')],'include':_0x3eaa55[_0x5127('0x1c')]?_['map'](_0x3eaa55[_0x5127('0x1c')],function(_0x4aa77a){return{'model':db[_0x4aa77a[_0x5127('0x1d')]],'as':_0x4aa77a['as'],'attributes':_0x4aa77a[_0x5127('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5127('0xc')](function(_0x1f0866){logger[_0x5127('0xd')](_0x5127('0x1f'),_0x1c8110);logger['debug'](_0x5127('0x1f'),_0x1c8110,JSON[_0x5127('0x11')](_0x1f0866));_0x56096c(_0x1f0866);})[_0x5127('0x20')](function(_0x1fdc50){logger[_0x5127('0x12')](_0x5127('0x1f'),_0x1fdc50[_0x5127('0x14')],_0x1c8110);_0x2ccd5a(_0x4b282d['error'](0x1f4,_0x1fdc50[_0x5127('0x14')]));});});}; \ No newline at end of file +var _0xf5e6=['request\x20sent','stringify','error','code','message','result','catch','Setting','find','options','raw','where','include','model','attributes','map','ShowSetting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xf5e6,0xd1));var _0x6f5e=function(_0x352961,_0x445210){_0x352961=_0x352961-0x0;var _0x51ce4f=_0xf5e6[_0x352961];return _0x51ce4f;};'use strict';var _=require(_0x6f5e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6f5e('0x1'));var rs=require(_0x6f5e('0x2'));var fs=require('fs');var Redis=require(_0x6f5e('0x3'));var db=require(_0x6f5e('0x4'))['db'];var utils=require(_0x6f5e('0x5'));var logger=require(_0x6f5e('0x6'))(_0x6f5e('0x7'));var config=require(_0x6f5e('0x8'));var jayson=require(_0x6f5e('0x9'));var client=jayson[_0x6f5e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x444a86,_0x1b5662,_0x5abf2){return new BPromise(function(_0x2377be,_0x511d02){return client[_0x6f5e('0xb')](_0x444a86,_0x5abf2)[_0x6f5e('0xc')](function(_0x3c7d7a){logger[_0x6f5e('0xd')](_0x6f5e('0xe'),_0x1b5662,_0x6f5e('0xf'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x1b5662,_0x6f5e('0xf'),JSON[_0x6f5e('0x10')](_0x3c7d7a));if(_0x3c7d7a[_0x6f5e('0x11')]){if(_0x3c7d7a['error'][_0x6f5e('0x12')]===0x1f4){logger[_0x6f5e('0x11')](_0x6f5e('0xe'),_0x1b5662,_0x3c7d7a['error'][_0x6f5e('0x13')]);return _0x511d02(_0x3c7d7a[_0x6f5e('0x11')]['message']);}logger[_0x6f5e('0x11')](_0x6f5e('0xe'),_0x1b5662,_0x3c7d7a[_0x6f5e('0x11')][_0x6f5e('0x13')]);return _0x2377be(_0x3c7d7a['error'][_0x6f5e('0x13')]);}else{logger[_0x6f5e('0xd')]('Setting,\x20%s,\x20%s',_0x1b5662,_0x6f5e('0xf'));_0x2377be(_0x3c7d7a[_0x6f5e('0x14')][_0x6f5e('0x13')]);}})[_0x6f5e('0x15')](function(_0x265215){logger[_0x6f5e('0x11')](_0x6f5e('0xe'),_0x1b5662,_0x265215);_0x511d02(_0x265215);});});}exports['ShowSetting']=function(_0x589521){var _0x257b2f=this;return new Promise(function(_0xfdd727,_0x153616){return db[_0x6f5e('0x16')][_0x6f5e('0x17')]({'raw':_0x589521[_0x6f5e('0x18')]?_0x589521[_0x6f5e('0x18')][_0x6f5e('0x19')]===undefined?!![]:![]:!![],'where':_0x589521[_0x6f5e('0x18')]?_0x589521[_0x6f5e('0x18')][_0x6f5e('0x1a')]||null:null,'attributes':_0x589521[_0x6f5e('0x18')]?_0x589521['options']['attributes']||null:null,'include':_0x589521['options']?_0x589521[_0x6f5e('0x18')][_0x6f5e('0x1b')]?_['map'](_0x589521[_0x6f5e('0x18')]['include'],function(_0x5aaa7f){return{'model':db[_0x5aaa7f[_0x6f5e('0x1c')]],'as':_0x5aaa7f['as'],'attributes':_0x5aaa7f[_0x6f5e('0x1d')],'include':_0x5aaa7f[_0x6f5e('0x1b')]?_[_0x6f5e('0x1e')](_0x5aaa7f[_0x6f5e('0x1b')],function(_0x2b2e74){return{'model':db[_0x2b2e74['model']],'as':_0x2b2e74['as'],'attributes':_0x2b2e74[_0x6f5e('0x1d')],'include':_0x2b2e74[_0x6f5e('0x1b')]?_[_0x6f5e('0x1e')](_0x2b2e74[_0x6f5e('0x1b')],function(_0x49a638){return{'model':db[_0x49a638[_0x6f5e('0x1c')]],'as':_0x49a638['as'],'attributes':_0x49a638[_0x6f5e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x388eb6){logger[_0x6f5e('0xd')](_0x6f5e('0x1f'),_0x589521);logger['debug'](_0x6f5e('0x1f'),_0x589521,JSON[_0x6f5e('0x10')](_0x388eb6));_0xfdd727(_0x388eb6);})[_0x6f5e('0x15')](function(_0x52252b){logger[_0x6f5e('0x11')](_0x6f5e('0x1f'),_0x52252b[_0x6f5e('0x13')],_0x589521);_0x153616(_0x257b2f[_0x6f5e('0x11')](0x1f4,_0x52252b['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index a230414..4318045 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 _0x8ef6=['addApplications','/:id/send','send','status','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','addAnswer','notify'];(function(_0x1bc989,_0x7eb097){var _0x3d2f8b=function(_0x22749d){while(--_0x22749d){_0x1bc989['push'](_0x1bc989['shift']());}};_0x3d2f8b(++_0x7eb097);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2a9c9,_0x419b7e){_0x2a9c9=_0x2a9c9-0x0;var _0x5a4263=_0x8ef6[_0x2a9c9];return _0x5a4263;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xa')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0xa')](_0x68ef('0x11'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router['get'](_0x68ef('0x13'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);router[_0x68ef('0xa')](_0x68ef('0x15'),auth[_0x68ef('0xc')](),controller['getInteractions']);router[_0x68ef('0xa')](_0x68ef('0x16'),controller[_0x68ef('0x17')]);router['get'](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x19')]);router['post']('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xf'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);router['post']('/:id/canned_answers',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1d')]);router['post']('/:id/notify',controller[_0x68ef('0x1e')]);router[_0x68ef('0x1b')](_0x68ef('0x13'),auth['isAuthenticated'](),controller[_0x68ef('0x1f')]);router[_0x68ef('0x1b')](_0x68ef('0x20'),auth['isAuthenticated'](),controller[_0x68ef('0x21')]);router[_0x68ef('0x1b')]('/:id/status',controller[_0x68ef('0x22')]);router[_0x68ef('0x1b')](_0x68ef('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x23')]);router[_0x68ef('0x24')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x25')]);router[_0x68ef('0x24')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller['removeDispositions']);router[_0x68ef('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x68ef('0x24')](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x26')]);module['exports']=router; \ No newline at end of file +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(_0x26da5e,_0x2f4830){var _0x19932c=function(_0x681c95){while(--_0x681c95){_0x26da5e['push'](_0x26da5e['shift']());}};_0x19932c(++_0x2f4830);}(_0x814b,0x1a2));var _0xb814=function(_0x33314d,_0x499628){_0x33314d=_0x33314d-0x0;var _0x4ffe8e=_0x814b[_0x33314d];return _0x4ffe8e;};'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 diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 5cf609d..de7d348 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 _0x2e1b=['setDataValue','sequelize','randomstring','name','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','clickatell','csc','infobip','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x3e5d81,_0xf8904f){var _0x158126=function(_0x2e6c6b){while(--_0x2e6c6b){_0x3e5d81['push'](_0x3e5d81['shift']());}};_0x158126(++_0xf8904f);}(_0x2e1b,0xb5));var _0xb2e1=function(_0x433d96,_0x2c2e96){_0x433d96=_0x433d96-0x0;var _0x2a4cbb=_0x2e1b[_0x433d96];return _0x2a4cbb;};'use strict';var Sequelize=require(_0xb2e1('0x0'));var rs=require(_0xb2e1('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb2e1('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xb2e1('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xb2e1('0x3')],'defaultValue':function(){return rs[_0xb2e1('0x4')]();}},'phone':{'type':Sequelize[_0xb2e1('0x3')]},'type':{'type':Sequelize[_0xb2e1('0x5')](_0xb2e1('0x6'),_0xb2e1('0x7'),_0xb2e1('0x8'),_0xb2e1('0x9'),'plivo',_0xb2e1('0xa'),'bandwidth',_0xb2e1('0xb'),_0xb2e1('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0xb2e1('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xb2e1('0x3')]},'smsMethod':{'type':Sequelize[_0xb2e1('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xb2e1('0x3')]},'accountId':{'type':Sequelize[_0xb2e1('0x3')]},'senderString':{'type':Sequelize[_0xb2e1('0x3')]},'deliveryReport':{'type':Sequelize[_0xb2e1('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xb2e1('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb2e1('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xb2e1('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb2e1('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb2e1('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb2e1('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xb2e1('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb2e1('0xf')],'comment':_0xb2e1('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xb2e1('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4d2691){if(!_0x4d2691)this[_0xb2e1('0x11')]('mandatoryDispositionPauseId',null);this[_0xb2e1('0x11')]('mandatoryDisposition',_0x4d2691);}}}; \ No newline at end of file +var _0x33f9=['randomstring','exports','STRING','name','generate','ENUM','skebby','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x33f9,0xa0));var _0x933f=function(_0xb27d3e,_0x108b22){_0xb27d3e=_0xb27d3e-0x0;var _0x1a30e2=_0x33f9[_0xb27d3e];return _0x1a30e2;};'use strict';var Sequelize=require(_0x933f('0x0'));var rs=require(_0x933f('0x1'));module[_0x933f('0x2')]={'name':{'type':Sequelize[_0x933f('0x3')],'unique':_0x933f('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x933f('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x933f('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x933f('0x3')],'defaultValue':function(){return rs[_0x933f('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x933f('0x6')]('twilio',_0x933f('0x7'),'connectel',_0x933f('0x8'),_0x933f('0x9'),_0x933f('0xa'),_0x933f('0xb'),_0x933f('0xc'),_0x933f('0xd'),_0x933f('0xe'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x933f('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x933f('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x933f('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x933f('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x933f('0x3')]},'deliveryReport':{'type':Sequelize[_0x933f('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x933f('0x3')]},'notificationTemplate':{'type':Sequelize[_0x933f('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x933f('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x933f('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x933f('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x933f('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x933f('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x933f('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x933f('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x933f('0x11')],'comment':_0x933f('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x933f('0xf')],'defaultValue':![],'comment':_0x933f('0x13'),'set':function(_0x5e2914){if(!_0x5e2914)this[_0x933f('0x14')](_0x933f('0x15'),null);this['setDataValue'](_0x933f('0x16'),_0x5e2914);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 0dbc28d..f493844 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 _0xec2a=['Disposition','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','account','from','From','Body','messageId','MessageSid','sender','connectel','message_id','Text','MessageUUID','results','originatingAddress','clickatell','fromNumber','text','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','autoclose','applications','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','twilio','Content-Type','text/xml','\x0a','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','getApplications','getInteractions','Contact','User','Owner','fullname','internal','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','debug','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','infobip','groupName','DELIVERED','bandwidth','redif','skebby','inspect','error_code','DELIVERED_TO_GATEWAY','DELIVRD','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./smsAccount.socket','register','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','undefined','limit','offset','count','set','apply','save','update','destroy','get','SmsAccounts','UserProfileResource','end','stack','send','index','Pause','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','SmsAccount','includeAll','include','findAll','rows','params','mandatoryDispositionPause','merge','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId'];(function(_0x8a1701,_0x5c1955){var _0xa235e7=function(_0x4c0d0f){while(--_0x4c0d0f){_0x8a1701['push'](_0x8a1701['shift']());}};_0xa235e7(++_0x5c1955);}(_0xec2a,0x161));var _0xaec2=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0xec2a[_0x2f87cd];return _0x5d7eda;};'use strict';var emlformat=require(_0xaec2('0x0'));var rimraf=require(_0xaec2('0x1'));var zipdir=require(_0xaec2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaec2('0x3'));var moment=require(_0xaec2('0x4'));var BPromise=require(_0xaec2('0x5'));var Mustache=require('mustache');var util=require(_0xaec2('0x6'));var path=require(_0xaec2('0x7'));var sox=require(_0xaec2('0x8'));var csv=require('to-csv');var ejs=require(_0xaec2('0x9'));var fs=require('fs');var fs_extra=require(_0xaec2('0xa'));var _=require('lodash');var squel=require(_0xaec2('0xb'));var crypto=require(_0xaec2('0xc'));var jsforce=require(_0xaec2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaec2('0xe'));var querystring=require('querystring');var Papa=require(_0xaec2('0xf'));var Redis=require(_0xaec2('0x10'));var authService=require(_0xaec2('0x11'));var qs=require(_0xaec2('0x12'));var as=require(_0xaec2('0x13'));var hardwareService=require(_0xaec2('0x14'));var logger=require(_0xaec2('0x15'))(_0xaec2('0x16'));var utils=require(_0xaec2('0x17'));var config=require(_0xaec2('0x18'));var licenseUtil=require(_0xaec2('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xaec2('0x1a')](config[_0xaec2('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xaec2('0x1c'))(new Redis(config['redis']));require(_0xaec2('0x1d'))[_0xaec2('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xaec2('0x1f')][_0xaec2('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x329923,_0x417761,_0x526c4e,_0xc81164){return new BPromise(function(_0x304dcf,_0x54e09d){var _0x5a133f=_0xc81164||client;return _0x5a133f[_0xaec2('0x21')](_0x329923,_0x526c4e)[_0xaec2('0x22')](function(_0x5cfd31){logger[_0xaec2('0x23')](_0xaec2('0x24'),_0x417761,_0xaec2('0x25'));logger['debug'](_0xaec2('0x26'),_0x417761,'request\x20sent',JSON['stringify'](_0x5cfd31));if(_0x5cfd31[_0xaec2('0x27')]){if(_0x5cfd31[_0xaec2('0x27')]['code']===0x1f4){logger[_0xaec2('0x27')](_0xaec2('0x24'),_0x417761,_0x5cfd31[_0xaec2('0x27')][_0xaec2('0x28')]);return _0x54e09d(_0x5cfd31['error'][_0xaec2('0x28')]);}logger['error'](_0xaec2('0x24'),_0x417761,_0x5cfd31[_0xaec2('0x27')][_0xaec2('0x28')]);return _0x304dcf(_0x5cfd31[_0xaec2('0x27')][_0xaec2('0x28')]);}else{logger['info'](_0xaec2('0x24'),_0x417761,_0xaec2('0x25'));_0x304dcf(_0x5cfd31[_0xaec2('0x29')]['message']);}})[_0xaec2('0x2a')](function(_0x2ab918){logger[_0xaec2('0x27')]('SmsAccount,\x20%s,\x20%s',_0x417761,_0x2ab918);_0x54e09d(_0x2ab918);});});}function respondWithStatusCode(_0x1a203f,_0x47b21c){_0x47b21c=_0x47b21c||0xcc;return function(_0x2166d1){if(_0x2166d1){return _0x1a203f[_0xaec2('0x2b')](_0x47b21c);}return _0x1a203f[_0xaec2('0x2c')](_0x47b21c)['end']();};}function respondWithResult(_0x2fc369,_0x3c3e63){_0x3c3e63=_0x3c3e63||0xc8;return function(_0x4e9780){if(_0x4e9780){return _0x2fc369[_0xaec2('0x2c')](_0x3c3e63)[_0xaec2('0x2d')](_0x4e9780);}};}function respondWithFilteredResult(_0x4ee66e,_0x1d79fc){return function(_0xe2871e){if(_0xe2871e){var _0x250987=typeof _0x1d79fc['offset']===_0xaec2('0x2e')&&typeof _0x1d79fc[_0xaec2('0x2f')]===_0xaec2('0x2e');var _0xd92c50=_0xe2871e['count'];var _0x2f9aa6=_0x250987?0x0:_0x1d79fc[_0xaec2('0x30')];var _0x350d03=_0x250987?_0xe2871e[_0xaec2('0x31')]:_0x1d79fc[_0xaec2('0x30')]+_0x1d79fc[_0xaec2('0x2f')];var _0xa7f4ed;if(_0x350d03>=_0xd92c50){_0x350d03=_0xd92c50;_0xa7f4ed=0xc8;}else{_0xa7f4ed=0xce;}_0x4ee66e[_0xaec2('0x2c')](_0xa7f4ed);return _0x4ee66e[_0xaec2('0x32')]('Content-Range',_0x2f9aa6+'-'+_0x350d03+'/'+_0xd92c50)[_0xaec2('0x2d')](_0xe2871e);}return null;};}function patchUpdates(_0x50c265){return function(_0x108f5f){try{jsonpatch[_0xaec2('0x33')](_0x108f5f,_0x50c265,!![]);}catch(_0x193896){return BPromise['reject'](_0x193896);}return _0x108f5f[_0xaec2('0x34')]();};}function saveUpdates(_0x247ebf,_0x390fac){return function(_0x4a126b){if(_0x4a126b){return _0x4a126b[_0xaec2('0x35')](_0x247ebf)[_0xaec2('0x22')](function(_0x1f2897){return _0x1f2897;});}return null;};}function removeEntity(_0x13e237,_0x379c98){return function(_0x40b4c2){if(_0x40b4c2){return _0x40b4c2[_0xaec2('0x36')]()[_0xaec2('0x22')](function(){var _0x203d10=_0x40b4c2[_0xaec2('0x37')]({'plain':!![]});var _0x491283=_0xaec2('0x38');return db[_0xaec2('0x39')][_0xaec2('0x36')]({'where':{'type':_0x491283,'resourceId':_0x203d10['id']}})[_0xaec2('0x22')](function(){return _0x40b4c2;});})[_0xaec2('0x22')](function(){_0x13e237[_0xaec2('0x2c')](0xcc)[_0xaec2('0x3a')]();});}};}function handleEntityNotFound(_0x472e4e,_0x3bd104){return function(_0x265cf9){if(!_0x265cf9){_0x472e4e[_0xaec2('0x2b')](0x194);}return _0x265cf9;};}function handleError(_0x3815e0,_0x83b971){_0x83b971=_0x83b971||0x1f4;return function(_0x14a49f){logger[_0xaec2('0x27')](_0x14a49f[_0xaec2('0x3b')]);if(_0x14a49f['name']){delete _0x14a49f['name'];}_0x3815e0[_0xaec2('0x2c')](_0x83b971)[_0xaec2('0x3c')](_0x14a49f);};}exports[_0xaec2('0x3d')]=function(_0x41abdf,_0x12b870){var _0xe112b6={'include':[{'model':db[_0xaec2('0x3e')],'as':'mandatoryDispositionPause'}]},_0x43f046={},_0x51d65b={'count':0x0,'rows':[]};var _0x114ade=_[_0xaec2('0x3f')](db['SmsAccount'][_0xaec2('0x40')],function(_0x5432ff){return{'name':_0x5432ff[_0xaec2('0x41')],'type':_0x5432ff[_0xaec2('0x42')][_0xaec2('0x43')]};});_0x43f046[_0xaec2('0x44')]=_['map'](_0x114ade,_0xaec2('0x45'));_0x43f046['query']=_[_0xaec2('0x46')](_0x41abdf[_0xaec2('0x47')]);_0x43f046[_0xaec2('0x48')]=_[_0xaec2('0x49')](_0x43f046[_0xaec2('0x44')],_0x43f046[_0xaec2('0x47')]);_0xe112b6[_0xaec2('0x4a')]=_[_0xaec2('0x49')](_0x43f046[_0xaec2('0x44')],qs[_0xaec2('0x4b')](_0x41abdf[_0xaec2('0x47')][_0xaec2('0x4b')]));_0xe112b6[_0xaec2('0x4a')]=_0xe112b6[_0xaec2('0x4a')][_0xaec2('0x4c')]?_0xe112b6['attributes']:_0x43f046['model'];if(!_0x41abdf['query'][_0xaec2('0x4d')](_0xaec2('0x4e'))){_0xe112b6[_0xaec2('0x2f')]=qs[_0xaec2('0x2f')](_0x41abdf['query'][_0xaec2('0x2f')]);_0xe112b6['offset']=qs[_0xaec2('0x30')](_0x41abdf[_0xaec2('0x47')][_0xaec2('0x30')]);}_0xe112b6[_0xaec2('0x4f')]=qs[_0xaec2('0x50')](_0x41abdf[_0xaec2('0x47')]['sort']);_0xe112b6[_0xaec2('0x51')]=qs['filters'](_[_0xaec2('0x52')](_0x41abdf[_0xaec2('0x47')],_0x43f046[_0xaec2('0x48')]),_0x114ade);if(_0x41abdf['query'][_0xaec2('0x53')]){_0xe112b6['where']=_['merge'](_0xe112b6[_0xaec2('0x51')],{'$or':_[_0xaec2('0x3f')](_0x114ade,function(_0x540317){if(_0x540317[_0xaec2('0x42')]!==_0xaec2('0x54')){var _0x4186a2={};_0x4186a2[_0x540317['name']]={'$like':'%'+_0x41abdf[_0xaec2('0x47')][_0xaec2('0x53')]+'%'};return _0x4186a2;}})});}_0xe112b6=_['merge']({},_0xe112b6,_0x41abdf[_0xaec2('0x55')]);var _0x31c094={'where':_0xe112b6[_0xaec2('0x51')]};return db[_0xaec2('0x56')]['count'](_0x31c094)[_0xaec2('0x22')](function(_0x3d2181){_0x51d65b['count']=_0x3d2181;if(_0x41abdf['query'][_0xaec2('0x57')]){_0xe112b6[_0xaec2('0x58')]=[{'all':!![]}];}return db[_0xaec2('0x56')][_0xaec2('0x59')](_0xe112b6);})['then'](function(_0x1c8e32){_0x51d65b[_0xaec2('0x5a')]=_0x1c8e32;return _0x51d65b;})[_0xaec2('0x22')](respondWithFilteredResult(_0x12b870,_0xe112b6))[_0xaec2('0x2a')](handleError(_0x12b870,null));};exports['show']=function(_0xf0689e,_0x2072f8){var _0x39b8cd={'raw':![],'where':{'id':_0xf0689e[_0xaec2('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xaec2('0x5c')}]},_0x20bd73={};_0x20bd73[_0xaec2('0x44')]=_[_0xaec2('0x46')](db[_0xaec2('0x56')]['rawAttributes']);_0x20bd73['query']=_[_0xaec2('0x46')](_0xf0689e[_0xaec2('0x47')]);_0x20bd73[_0xaec2('0x48')]=_['intersection'](_0x20bd73['model'],_0x20bd73['query']);_0x39b8cd[_0xaec2('0x4a')]=_['intersection'](_0x20bd73[_0xaec2('0x44')],qs['fields'](_0xf0689e[_0xaec2('0x47')][_0xaec2('0x4b')]));_0x39b8cd[_0xaec2('0x4a')]=_0x39b8cd[_0xaec2('0x4a')][_0xaec2('0x4c')]?_0x39b8cd[_0xaec2('0x4a')]:_0x20bd73['model'];if(_0xf0689e['query'][_0xaec2('0x57')]){_0x39b8cd['include']=[{'all':!![]}];}_0x39b8cd=_[_0xaec2('0x5d')]({},_0x39b8cd,_0xf0689e[_0xaec2('0x55')]);return db[_0xaec2('0x56')][_0xaec2('0x5e')](_0x39b8cd)[_0xaec2('0x22')](handleEntityNotFound(_0x2072f8,null))[_0xaec2('0x22')](respondWithResult(_0x2072f8,null))[_0xaec2('0x2a')](handleError(_0x2072f8,null));};exports[_0xaec2('0x5f')]=function(_0x3af484,_0x32bbf7){return db[_0xaec2('0x56')][_0xaec2('0x5f')](_0x3af484[_0xaec2('0x60')],{})[_0xaec2('0x22')](function(_0x1fd2fe){var _0x478b5b=_0x3af484[_0xaec2('0x61')][_0xaec2('0x37')]({'plain':!![]});if(!_0x478b5b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x478b5b[_0xaec2('0x62')]===_0xaec2('0x61')){var _0x4f5625=_0x1fd2fe[_0xaec2('0x37')]({'plain':!![]});var _0x118d62=_0xaec2('0x38');return db[_0xaec2('0x63')]['find']({'where':{'name':_0x118d62,'userProfileId':_0x478b5b[_0xaec2('0x64')]},'raw':!![]})[_0xaec2('0x22')](function(_0x476f10){if(_0x476f10&&_0x476f10['autoAssociation']===0x0){return db[_0xaec2('0x39')][_0xaec2('0x5f')]({'name':_0x4f5625[_0xaec2('0x45')],'resourceId':_0x4f5625['id'],'type':_0x476f10[_0xaec2('0x45')],'sectionId':_0x476f10['id']},{})[_0xaec2('0x22')](function(){return _0x1fd2fe;});}else{return _0x1fd2fe;}})[_0xaec2('0x2a')](function(_0x4eef2a){logger[_0xaec2('0x27')](_0xaec2('0x65'),_0x4eef2a);throw _0x4eef2a;});}return _0x1fd2fe;})[_0xaec2('0x22')](respondWithResult(_0x32bbf7,0xc9))[_0xaec2('0x2a')](handleError(_0x32bbf7,null));};exports[_0xaec2('0x35')]=function(_0x305029,_0x416cea){if(_0x305029[_0xaec2('0x60')]['id']){delete _0x305029[_0xaec2('0x60')]['id'];}return db[_0xaec2('0x56')][_0xaec2('0x5e')]({'where':{'id':_0x305029[_0xaec2('0x5b')]['id']},'include':[{'model':db[_0xaec2('0x3e')],'as':_0xaec2('0x5c')}]})[_0xaec2('0x22')](handleEntityNotFound(_0x416cea,null))[_0xaec2('0x22')](saveUpdates(_0x305029[_0xaec2('0x60')],null))['then'](respondWithResult(_0x416cea,null))[_0xaec2('0x2a')](handleError(_0x416cea,null));};exports[_0xaec2('0x36')]=function(_0x25c122,_0x45d64e){return db['SmsAccount'][_0xaec2('0x5e')]({'where':{'id':_0x25c122[_0xaec2('0x5b')]['id']}})[_0xaec2('0x22')](handleEntityNotFound(_0x45d64e,null))[_0xaec2('0x22')](removeEntity(_0x45d64e,null))[_0xaec2('0x2a')](handleError(_0x45d64e,null));};exports[_0xaec2('0x66')]=function(_0x249850,_0x4c3318){return db[_0xaec2('0x56')][_0xaec2('0x66')]()['then'](respondWithResult(_0x4c3318,null))['catch'](handleError(_0x4c3318,null));};exports[_0xaec2('0x67')]=function(_0x42f61b,_0x1dac67,_0xc1205){if(_0x42f61b[_0xaec2('0x60')]['id']){delete _0x42f61b[_0xaec2('0x60')]['id'];}return db[_0xaec2('0x56')][_0xaec2('0x5e')]({'where':{'id':_0x42f61b[_0xaec2('0x5b')]['id']}})[_0xaec2('0x22')](handleEntityNotFound(_0x1dac67,null))[_0xaec2('0x22')](function(_0x9faec7){if(_0x9faec7){_0x42f61b[_0xaec2('0x60')][_0xaec2('0x68')]=_0x9faec7['id'];return db[_0xaec2('0x69')]['create'](_0x42f61b[_0xaec2('0x60')]);}})['then'](respondWithResult(_0x1dac67,null))[_0xaec2('0x2a')](handleError(_0x1dac67,null));};exports['getDispositions']=function(_0x4b4893,_0x48793c,_0x1790c0){var _0x4cdbf5={'raw':![],'where':{}};var _0x1593da={};var _0x1a5d3b={'count':0x0,'rows':[]};return db['SmsAccount'][_0xaec2('0x6a')]({'where':{'id':_0x4b4893['params']['id']}})[_0xaec2('0x22')](handleEntityNotFound(_0x48793c,null))['then'](function(_0x3820e3){if(_0x3820e3){_0x1593da[_0xaec2('0x44')]=_[_0xaec2('0x46')](db[_0xaec2('0x69')]['rawAttributes']);_0x1593da[_0xaec2('0x47')]=_[_0xaec2('0x46')](_0x4b4893[_0xaec2('0x47')]);_0x1593da['filters']=_['intersection'](_0x1593da[_0xaec2('0x44')],_0x1593da[_0xaec2('0x47')]);_0x4cdbf5[_0xaec2('0x4a')]=_[_0xaec2('0x49')](_0x1593da[_0xaec2('0x44')],qs[_0xaec2('0x4b')](_0x4b4893[_0xaec2('0x47')][_0xaec2('0x4b')]));_0x4cdbf5[_0xaec2('0x4a')]=_0x4cdbf5[_0xaec2('0x4a')][_0xaec2('0x4c')]?_0x4cdbf5['attributes']:_0x1593da[_0xaec2('0x44')];if(!_0x4b4893[_0xaec2('0x47')][_0xaec2('0x4d')](_0xaec2('0x4e'))){_0x4cdbf5[_0xaec2('0x2f')]=qs[_0xaec2('0x2f')](_0x4b4893[_0xaec2('0x47')][_0xaec2('0x2f')]);_0x4cdbf5['offset']=qs[_0xaec2('0x30')](_0x4b4893[_0xaec2('0x47')][_0xaec2('0x30')]);}_0x4cdbf5['order']=qs[_0xaec2('0x50')](_0x4b4893[_0xaec2('0x47')][_0xaec2('0x50')]);_0x4cdbf5['where']=qs[_0xaec2('0x48')](_[_0xaec2('0x52')](_0x4b4893[_0xaec2('0x47')],_0x1593da['filters']));_0x4cdbf5[_0xaec2('0x51')]['SmsAccountId']=_0x3820e3['id'];if(_0x4b4893['query'][_0xaec2('0x53')]){_0x4cdbf5[_0xaec2('0x51')]=_['merge'](_0x4cdbf5[_0xaec2('0x51')],{'$or':_[_0xaec2('0x3f')](_0x4cdbf5[_0xaec2('0x4a')],function(_0x4c4878){var _0x19b489={};_0x19b489[_0x4c4878]={'$like':'%'+_0x4b4893[_0xaec2('0x47')][_0xaec2('0x53')]+'%'};return _0x19b489;})});}_0x4cdbf5=_[_0xaec2('0x5d')]({},_0x4cdbf5,_0x4b4893[_0xaec2('0x55')]);return db[_0xaec2('0x69')][_0xaec2('0x31')]({'where':_0x4cdbf5[_0xaec2('0x51')]})[_0xaec2('0x22')](function(_0x1acc9c){_0x1a5d3b[_0xaec2('0x31')]=_0x1acc9c;if(_0x4b4893['query'][_0xaec2('0x57')]){_0x4cdbf5['include']=[{'all':!![]}];}return db[_0xaec2('0x69')][_0xaec2('0x59')](_0x4cdbf5);})[_0xaec2('0x22')](function(_0x2a2a39){_0x1a5d3b[_0xaec2('0x5a')]=_0x2a2a39;return _0x1a5d3b;});}})[_0xaec2('0x22')](respondWithFilteredResult(_0x48793c,_0x4cdbf5))['catch'](handleError(_0x48793c,null));};exports[_0xaec2('0x6b')]=function(_0x17a960,_0x2271a0,_0x600b01){return db['SmsAccount'][_0xaec2('0x5e')]({'where':{'id':_0x17a960['params']['id']}})[_0xaec2('0x22')](handleEntityNotFound(_0x2271a0,null))['then'](function(_0x5cdf3a){if(_0x5cdf3a){return _0x5cdf3a[_0xaec2('0x6b')](_0x17a960[_0xaec2('0x47')][_0xaec2('0x6c')]);}})[_0xaec2('0x22')](respondWithStatusCode(_0x2271a0,null))[_0xaec2('0x2a')](handleError(_0x2271a0,null));};exports[_0xaec2('0x6d')]=function(_0x5786c5,_0x4805c7,_0x482a9c){if(_0x5786c5[_0xaec2('0x60')]['id']){delete _0x5786c5[_0xaec2('0x60')]['id'];}return db[_0xaec2('0x56')][_0xaec2('0x5e')]({'where':{'id':_0x5786c5[_0xaec2('0x5b')]['id']}})[_0xaec2('0x22')](handleEntityNotFound(_0x4805c7,null))[_0xaec2('0x22')](function(_0x440721){if(_0x440721){_0x5786c5[_0xaec2('0x60')][_0xaec2('0x68')]=_0x440721['id'];return db[_0xaec2('0x6e')]['create'](_0x5786c5[_0xaec2('0x60')]);}})[_0xaec2('0x22')](respondWithResult(_0x4805c7,null))[_0xaec2('0x2a')](handleError(_0x4805c7,null));};exports[_0xaec2('0x6f')]=function(_0x2f3b75,_0x5568d5,_0x1bc604){var _0x58e42f={'raw':![],'where':{}};var _0x162edb={};var _0x313e7f={'count':0x0,'rows':[]};return db[_0xaec2('0x56')]['findOne']({'where':{'id':_0x2f3b75[_0xaec2('0x5b')]['id']}})[_0xaec2('0x22')](handleEntityNotFound(_0x5568d5,null))['then'](function(_0x509dea){if(_0x509dea){_0x162edb[_0xaec2('0x44')]=_['keys'](db[_0xaec2('0x6e')][_0xaec2('0x40')]);_0x162edb[_0xaec2('0x47')]=_[_0xaec2('0x46')](_0x2f3b75[_0xaec2('0x47')]);_0x162edb[_0xaec2('0x48')]=_['intersection'](_0x162edb['model'],_0x162edb['query']);_0x58e42f[_0xaec2('0x4a')]=_[_0xaec2('0x49')](_0x162edb[_0xaec2('0x44')],qs[_0xaec2('0x4b')](_0x2f3b75[_0xaec2('0x47')][_0xaec2('0x4b')]));_0x58e42f['attributes']=_0x58e42f[_0xaec2('0x4a')][_0xaec2('0x4c')]?_0x58e42f['attributes']:_0x162edb[_0xaec2('0x44')];if(!_0x2f3b75[_0xaec2('0x47')]['hasOwnProperty'](_0xaec2('0x4e'))){_0x58e42f['limit']=qs[_0xaec2('0x2f')](_0x2f3b75['query'][_0xaec2('0x2f')]);_0x58e42f[_0xaec2('0x30')]=qs[_0xaec2('0x30')](_0x2f3b75['query'][_0xaec2('0x30')]);}_0x58e42f[_0xaec2('0x4f')]=qs[_0xaec2('0x50')](_0x2f3b75['query']['sort']);_0x58e42f['where']=qs[_0xaec2('0x48')](_[_0xaec2('0x52')](_0x2f3b75[_0xaec2('0x47')],_0x162edb['filters']));_0x58e42f[_0xaec2('0x51')][_0xaec2('0x68')]=_0x509dea['id'];if(_0x2f3b75[_0xaec2('0x47')]['filter']){_0x58e42f['where']=_[_0xaec2('0x5d')](_0x58e42f['where'],{'$or':_[_0xaec2('0x3f')](_0x58e42f['attributes'],function(_0x5a7d66){var _0x2d9a41={};_0x2d9a41[_0x5a7d66]={'$like':'%'+_0x2f3b75[_0xaec2('0x47')][_0xaec2('0x53')]+'%'};return _0x2d9a41;})});}_0x58e42f=_[_0xaec2('0x5d')]({},_0x58e42f,_0x2f3b75[_0xaec2('0x55')]);return db[_0xaec2('0x6e')]['count']({'where':_0x58e42f['where']})[_0xaec2('0x22')](function(_0x43a1e7){_0x313e7f[_0xaec2('0x31')]=_0x43a1e7;if(_0x2f3b75[_0xaec2('0x47')]['includeAll']){_0x58e42f[_0xaec2('0x58')]=[{'all':!![]}];}return db[_0xaec2('0x6e')][_0xaec2('0x59')](_0x58e42f);})['then'](function(_0x1ab384){_0x313e7f[_0xaec2('0x5a')]=_0x1ab384;return _0x313e7f;});}})[_0xaec2('0x22')](respondWithFilteredResult(_0x5568d5,_0x58e42f))[_0xaec2('0x2a')](handleError(_0x5568d5,null));};exports[_0xaec2('0x70')]=function(_0xcb8936,_0x2b77f6,_0x46c3dc){return db['SmsAccount']['find']({'where':{'id':_0xcb8936[_0xaec2('0x5b')]['id']}})[_0xaec2('0x22')](handleEntityNotFound(_0x2b77f6,null))[_0xaec2('0x22')](function(_0x12560f){if(_0x12560f){return _0x12560f[_0xaec2('0x70')](_0xcb8936[_0xaec2('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x2b77f6,null))[_0xaec2('0x2a')](handleError(_0x2b77f6,null));};exports[_0xaec2('0x71')]=function(_0x5dd767,_0x35fcf5,_0x5765ee){var _0x296080={'channel':_0xaec2('0x72')};var _0x54e9aa=[];var _0x5a0187=[];var _0x4c1147={};return db[_0xaec2('0x56')][_0xaec2('0x5e')]({'where':{'id':_0x5dd767[_0xaec2('0x5b')]['id']},'include':[{'model':db[_0xaec2('0x73')],'as':'Applications'}]})[_0xaec2('0x22')](handleEntityNotFound(_0x35fcf5,null))['then'](function(_0x3f9bc0){_0x296080['account']=_0x3f9bc0;_0x296080['applications']=_[_0xaec2('0x74')](_0x3f9bc0[_0xaec2('0x75')],['priority'],[_0xaec2('0x76')]);if(_0x296080['account']['Applications']){delete _0x296080['account']['Applications'];}return db[_0xaec2('0x77')]['describe']();})[_0xaec2('0x22')](function(_0x18f849){if(!_0x18f849){throw new db[(_0xaec2('0x78'))]['ValidationError'](_0xaec2('0x79'));}_0x54e9aa=_[_0xaec2('0x7a')](_[_0xaec2('0x46')](_0x18f849),[_0xaec2('0x7b'),_0xaec2('0x7c')]);_0x5a0187=_['difference'](_[_0xaec2('0x46')](_0x18f849),['createdAt',_0xaec2('0x7c'),_0xaec2('0x7d'),_0xaec2('0x7e')]);_0x296080[_0xaec2('0x60')]={'mapKey':_0xaec2('0x7f')};if(_0x296080[_0xaec2('0x80')][_0xaec2('0x42')]){switch(_0x296080[_0xaec2('0x80')][_0xaec2('0x42')]){case'twilio':_0x296080[_0xaec2('0x60')][_0xaec2('0x81')]=_0x5dd767['body'][_0xaec2('0x82')];_0x296080[_0xaec2('0x60')][_0xaec2('0x60')]=_0x5dd767[_0xaec2('0x60')][_0xaec2('0x83')];_0x296080['body'][_0xaec2('0x84')]=_0x5dd767[_0xaec2('0x60')][_0xaec2('0x85')];break;case'skebby':_0x296080['body'][_0xaec2('0x81')]='+'+_0x5dd767[_0xaec2('0x60')][_0xaec2('0x86')];_0x296080['body'][_0xaec2('0x60')]=_0x5dd767[_0xaec2('0x60')]['text'];break;case _0xaec2('0x87'):_0x296080[_0xaec2('0x60')]['from']=_0x5dd767['body'][_0xaec2('0x81')];_0x296080[_0xaec2('0x60')][_0xaec2('0x60')]=_0x5dd767[_0xaec2('0x60')][_0xaec2('0x28')];break;case'clicksend':_0x296080[_0xaec2('0x60')][_0xaec2('0x81')]=_0x5dd767[_0xaec2('0x60')]['from'];_0x296080[_0xaec2('0x60')][_0xaec2('0x60')]=_0x5dd767[_0xaec2('0x60')][_0xaec2('0x60')];_0x296080[_0xaec2('0x60')]['messageId']=_0x5dd767[_0xaec2('0x60')][_0xaec2('0x88')];break;case'plivo':_0x296080[_0xaec2('0x60')][_0xaec2('0x81')]=_0x5dd767[_0xaec2('0x60')]['From'];_0x296080[_0xaec2('0x60')][_0xaec2('0x60')]=_0x5dd767[_0xaec2('0x60')][_0xaec2('0x89')];_0x296080[_0xaec2('0x60')][_0xaec2('0x84')]=_0x5dd767['body'][_0xaec2('0x8a')];break;case'infobip':_0x296080[_0xaec2('0x60')][_0xaec2('0x81')]='+'+_0x5dd767['body'][_0xaec2('0x8b')][0x0]['from'];_0x296080[_0xaec2('0x60')]['body']=_0x5dd767[_0xaec2('0x60')]['results'][0x0]['text'];_0x296080[_0xaec2('0x60')][_0xaec2('0x84')]=_0x5dd767['body'][_0xaec2('0x8b')][0x0]['messageId'];break;case'csc':_0x296080[_0xaec2('0x60')][_0xaec2('0x81')]=_0x5dd767[_0xaec2('0x60')][_0xaec2('0x8c')];_0x296080[_0xaec2('0x60')]['body']=_0x5dd767[_0xaec2('0x60')]['segmentedMessage'][_0xaec2('0x28')];break;case _0xaec2('0x8d'):_0x296080[_0xaec2('0x60')][_0xaec2('0x81')]=_0x5dd767[_0xaec2('0x60')][_0xaec2('0x8e')];_0x296080[_0xaec2('0x60')][_0xaec2('0x60')]=_0x5dd767[_0xaec2('0x60')][_0xaec2('0x8f')];_0x296080['body'][_0xaec2('0x84')]=_0x5dd767[_0xaec2('0x60')]['replyMessageId'];break;case'bandwidth':_0x296080[_0xaec2('0x60')][_0xaec2('0x84')]=_0x5dd767[_0xaec2('0x60')][0x0][_0xaec2('0x28')]['id'];_0x296080[_0xaec2('0x60')][_0xaec2('0x81')]=_0x5dd767[_0xaec2('0x60')][0x0][_0xaec2('0x28')]['from'];_0x296080[_0xaec2('0x60')][_0xaec2('0x60')]=_0x5dd767[_0xaec2('0x60')][0x0][_0xaec2('0x28')]['text'];break;case _0xaec2('0x90'):_0x296080[_0xaec2('0x60')][_0xaec2('0x81')]=_0x5dd767[_0xaec2('0x60')][_0xaec2('0x81')];_0x296080[_0xaec2('0x60')][_0xaec2('0x60')]=_0x5dd767[_0xaec2('0x60')][_0xaec2('0x28')];_0x296080['body'][_0xaec2('0x84')]=_0x5dd767[_0xaec2('0x60')][_0xaec2('0x91')];break;}}if(_0x296080[_0xaec2('0x60')]['id']){delete _0x296080[_0xaec2('0x60')]['id'];}if(_[_0xaec2('0x92')](_0x296080['body']['from'])){throw new db[(_0xaec2('0x78'))][(_0xaec2('0x93'))](_0xaec2('0x94'));}if(_[_0xaec2('0x92')](_0x296080[_0xaec2('0x60')][_0xaec2('0x60')])||_0x296080[_0xaec2('0x60')][_0xaec2('0x60')]===''){throw new db[(_0xaec2('0x78'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xaec2('0x92')](_0x296080[_0xaec2('0x60')][_0xaec2('0x95')])){throw new db[(_0xaec2('0x78'))][(_0xaec2('0x93'))](_0xaec2('0x96')+_0x5a0187);}if(!_[_0xaec2('0x97')](_0x5a0187,_0x296080['body'][_0xaec2('0x95')])){throw new db[(_0xaec2('0x78'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5a0187);}_0x4c1147[_0x296080[_0xaec2('0x60')]['mapKey']]=_0x296080[_0xaec2('0x60')][_0xaec2('0x81')];return db[_0xaec2('0x98')][_0xaec2('0x5e')]({'where':{'id':_0x296080[_0xaec2('0x80')][_0xaec2('0x7e')]},'include':[{'model':db[_0xaec2('0x77')],'as':_0xaec2('0x99'),'where':_0x4c1147,'limit':0x1,'order':[['updatedAt',_0xaec2('0x9a')]]}]});})[_0xaec2('0x22')](handleEntityNotFound(_0x35fcf5,null))[_0xaec2('0x22')](function(_0x1859c6){if(_0x1859c6){_0x296080[_0xaec2('0x9b')]=_[_0xaec2('0x9c')](_0x1859c6,[_0xaec2('0x99')]);if(_0x1859c6[_0xaec2('0x99')][_0xaec2('0x4c')]){return _0x1859c6[_0xaec2('0x99')][0x0];}var _0x4993ea=_['defaults'](_0x296080[_0xaec2('0x60')],{'firstName':_0x296080[_0xaec2('0x60')][_0xaec2('0x81')],'ListId':_0x1859c6['id']});_0x4993ea[_0x296080[_0xaec2('0x60')]['mapKey']]=_0x296080[_0xaec2('0x60')]['from'];return db['CmContact']['create'](_0x4993ea,{'fields':_0x54e9aa,'raw':!![]});}})[_0xaec2('0x22')](handleEntityNotFound(_0x35fcf5,null))['then'](function(_0x507bdf){if(_0x507bdf){_0x296080[_0xaec2('0x9d')]=_0x507bdf;var _0x53b129={'ContactId':_0x507bdf['id'],'phone':_0x296080[_0xaec2('0x60')][_0xaec2('0x81')],'SmsAccountId':_0x5dd767[_0xaec2('0x5b')]['id']};var _0x1613c8={'ContactId':_0x507bdf['id'],'SmsAccountId':_0x5dd767[_0xaec2('0x5b')]['id'],'closed':![]};return db['SmsInteraction'][_0xaec2('0x5e')]({'where':_0x1613c8})[_0xaec2('0x22')](function(_0x402314){if(_0x402314){return[_0x402314,![]];}return db[_0xaec2('0x9e')][_0xaec2('0x5f')](_0x53b129)[_0xaec2('0x22')](function(_0x490698){return[_0x490698,!![]];});});}})[_0xaec2('0x9f')](function(_0x47624e,_0xc39e98){_0x296080[_0xaec2('0xa0')]=_0x47624e['get']({'plain':!![]});_0x296080[_0xaec2('0xa0')]['created']=![];if(_0xc39e98){if(_0x296080[_0xaec2('0x80')][_0xaec2('0xa1')]){_0x296080[_0xaec2('0xa2')][_0xaec2('0xa3')]({'id':0x0,'priority':_0x296080[_0xaec2('0xa2')]['length']+0x1,'app':_0xaec2('0xa4'),'appdata':_0xaec2('0xa5'),'interval':_0xaec2('0xa6')});}_0x296080[_0xaec2('0xa0')][_0xaec2('0xa7')]=!![];}return db[_0xaec2('0xa8')][_0xaec2('0x5f')]({'phone':_0x296080[_0xaec2('0x60')][_0xaec2('0x81')],'messageId':_0x296080[_0xaec2('0x60')][_0xaec2('0x84')],'body':_0x296080[_0xaec2('0x60')]['body'],'SmsAccountId':_0x5dd767[_0xaec2('0x5b')]['id'],'SmsInteractionId':_0x47624e['id'],'direction':'in','ContactId':_0x47624e[_0xaec2('0xa9')],'AttachmentId':_0x296080[_0xaec2('0x60')]['AttachmentId']});})['then'](function(_0x544e0b){_0x296080[_0xaec2('0x28')]=_0x544e0b;if(_0x296080['interaction'][_0xaec2('0xaa')]){return db['User'][_0xaec2('0x5e')]({'attributes':['id',_0xaec2('0x45')],'where':{'id':_0x296080[_0xaec2('0xa0')][_0xaec2('0xaa')]}})['then'](function(_0x43586f){if(_0x43586f){_0x296080[_0xaec2('0xa2')]['unshift']({'id':0x0,'priority':0x0,'app':_0xaec2('0xab'),'appdata':_0x43586f[_0xaec2('0x45')]+','+(_0x296080[_0xaec2('0x80')][_0xaec2('0xac')]||0xa),'interval':_0xaec2('0xa6')});}return respondWithRpcPromise(_0xaec2('0xad'),_0xaec2('0xae'),_0x296080);});}return respondWithRpcPromise('Start',_0xaec2('0xae'),_0x296080);})[_0xaec2('0x22')](function(_0x5452fd){if(_0x5452fd){var _0x32bac9=0xc8;var _0x4945a5=_0xaec2('0xaf');logger[_0xaec2('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4945a5,_0x32bac9,_0xaec2('0xb0'));logger['debug'](_0xaec2('0xb1'),_0x4945a5,_0x32bac9,_0xaec2('0xb0'),JSON[_0xaec2('0xb2')](_0x5452fd));if(_0x296080[_0xaec2('0x80')][_0xaec2('0x42')]===_0xaec2('0xb3')){return _0x35fcf5[_0xaec2('0x2c')](_0x32bac9)[_0xaec2('0x32')](_0xaec2('0xb4'),_0xaec2('0xb5'))[_0xaec2('0x3c')](_0xaec2('0xb6'));}else{return _0x35fcf5[_0xaec2('0x2c')](_0x32bac9)['json'](_0x5452fd);}}})[_0xaec2('0x2a')](handleError(_0x35fcf5,null));};exports[_0xaec2('0xb7')]=function(_0x344556,_0x5cd92a){var _0x8cc1a4=_0x344556['params']['id'];var _0x32af6d=_0x344556[_0xaec2('0x60')];var _0xdbd2bf=0xc8;var _0x188b64=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0xaec2('0xb8')][_0xaec2('0xb9')][_0xaec2('0xba')]},function(_0x1b0152){return db[_0xaec2('0x56')][_0xaec2('0x6a')]({'where':{'id':_0x8cc1a4},'transaction':_0x1b0152})[_0xaec2('0x22')](function(_0x42df51){if(_0x42df51){return db[_0xaec2('0x73')][_0xaec2('0x36')]({'where':{'SmsAccountId':_0x8cc1a4},'transaction':_0x1b0152})[_0xaec2('0x22')](function(){var _0x21ed99=_['map'](_0x32af6d,function(_0x41560b){_0x41560b[_0xaec2('0x68')]=_0x8cc1a4;return _0x41560b;});return db['SmsApplication'][_0xaec2('0xbb')](_0x21ed99,{'transaction':_0x1b0152});});}else{_0xdbd2bf=0x194;_0x188b64=[];}});})[_0xaec2('0x22')](function(){if(_0xdbd2bf!==0x194){return db[_0xaec2('0x73')]['findAndCountAll']({'where':{'SmsAccountId':_0x8cc1a4},'order':'priority'})[_0xaec2('0x22')](function(_0x1df067){_0x188b64=_0x1df067;});}})['catch'](function(_0x4b3e99){_0xdbd2bf=0x1f4;logger[_0xaec2('0x27')](_0x4b3e99[_0xaec2('0x3b')]);if(_0x4b3e99[_0xaec2('0x45')]){delete _0x4b3e99[_0xaec2('0x45')];}_0x188b64=_0x4b3e99;})['finally'](function(){if(_0x188b64===null){_0x5cd92a[_0xaec2('0x2b')](_0xdbd2bf);}else{if(_0xdbd2bf===0x1f4){_0x5cd92a[_0xaec2('0x2c')](_0xdbd2bf)['send'](_0x188b64);}else{_0x5cd92a['status'](_0xdbd2bf)[_0xaec2('0x2d')](_0x188b64);}}});};exports[_0xaec2('0xbc')]=function(_0x5c251c,_0x3ffc38,_0x49a916){var _0x5067bf={};var _0x492057={};var _0x5bf7bc;var _0x439b7e;return db['SmsAccount']['findOne']({'where':{'id':_0x5c251c[_0xaec2('0x5b')]['id']}})[_0xaec2('0x22')](handleEntityNotFound(_0x3ffc38,null))['then'](function(_0x495f8d){if(_0x495f8d){_0x5bf7bc=_0x495f8d;_0x492057[_0xaec2('0x44')]=_['keys'](db[_0xaec2('0x73')][_0xaec2('0x40')]);_0x492057[_0xaec2('0x47')]=_[_0xaec2('0x46')](_0x5c251c[_0xaec2('0x47')]);_0x492057['filters']=_[_0xaec2('0x49')](_0x492057['model'],_0x492057[_0xaec2('0x47')]);_0x5067bf[_0xaec2('0x4a')]=_[_0xaec2('0x49')](_0x492057[_0xaec2('0x44')],qs[_0xaec2('0x4b')](_0x5c251c[_0xaec2('0x47')][_0xaec2('0x4b')]));_0x5067bf[_0xaec2('0x4a')]=_0x5067bf[_0xaec2('0x4a')][_0xaec2('0x4c')]?_0x5067bf['attributes']:_0x492057[_0xaec2('0x44')];_0x5067bf[_0xaec2('0x4f')]=qs[_0xaec2('0x50')](_0x5c251c[_0xaec2('0x47')]['sort']);_0x5067bf['where']=qs[_0xaec2('0x48')](_['pick'](_0x5c251c[_0xaec2('0x47')],_0x492057[_0xaec2('0x48')]));if(_0x5c251c[_0xaec2('0x47')][_0xaec2('0x53')]){_0x5067bf[_0xaec2('0x51')]=_[_0xaec2('0x5d')](_0x5067bf[_0xaec2('0x51')],{'$or':_[_0xaec2('0x3f')](_0x5067bf[_0xaec2('0x4a')],function(_0x22dd02){var _0x55c7f2={};_0x55c7f2[_0x22dd02]={'$like':'%'+_0x5c251c[_0xaec2('0x47')][_0xaec2('0x53')]+'%'};return _0x55c7f2;})});}_0x5067bf=_[_0xaec2('0x5d')]({},_0x5067bf,_0x5c251c[_0xaec2('0x55')]);return _0x5bf7bc[_0xaec2('0xbc')](_0x5067bf);}})['then'](function(_0x111cb3){if(_0x111cb3){_0x439b7e=_0x111cb3[_0xaec2('0x4c')];if(!_0x5c251c[_0xaec2('0x47')]['hasOwnProperty'](_0xaec2('0x4e'))){_0x5067bf[_0xaec2('0x2f')]=qs[_0xaec2('0x2f')](_0x5c251c['query'][_0xaec2('0x2f')]);_0x5067bf[_0xaec2('0x30')]=qs[_0xaec2('0x30')](_0x5c251c[_0xaec2('0x47')][_0xaec2('0x30')]);}return _0x5bf7bc['getApplications'](_0x5067bf);}})['then'](function(_0x5aef54){if(_0x5aef54){return _0x5aef54?{'count':_0x439b7e,'rows':_0x5aef54}:null;}})[_0xaec2('0x22')](respondWithResult(_0x3ffc38,null))['catch'](handleError(_0x3ffc38,null));};exports[_0xaec2('0xbd')]=function(_0x5cbf2c,_0x414893,_0x26d69e){var _0x558811={'raw':![],'where':{}};var _0x438923={};var _0x1ffedd={'count':0x0,'rows':[]};return db[_0xaec2('0x56')][_0xaec2('0x6a')]({'where':{'id':_0x5cbf2c[_0xaec2('0x5b')]['id']}})[_0xaec2('0x22')](handleEntityNotFound(_0x414893,null))[_0xaec2('0x22')](function(_0x1d080f){if(_0x1d080f){_0x438923['model']=_[_0xaec2('0x46')](db['SmsInteraction'][_0xaec2('0x40')]);_0x438923[_0xaec2('0x47')]=_['keys'](_0x5cbf2c[_0xaec2('0x47')]);_0x438923['filters']=_[_0xaec2('0x49')](_0x438923[_0xaec2('0x44')],_0x438923[_0xaec2('0x47')]);_0x558811[_0xaec2('0x4a')]=_[_0xaec2('0x49')](_0x438923[_0xaec2('0x44')],qs[_0xaec2('0x4b')](_0x5cbf2c[_0xaec2('0x47')][_0xaec2('0x4b')]));_0x558811[_0xaec2('0x4a')]=_0x558811[_0xaec2('0x4a')][_0xaec2('0x4c')]?_0x558811['attributes']:_0x438923['model'];if(!_0x5cbf2c[_0xaec2('0x47')][_0xaec2('0x4d')](_0xaec2('0x4e'))){_0x558811['limit']=qs[_0xaec2('0x2f')](_0x5cbf2c['query'][_0xaec2('0x2f')]);_0x558811['offset']=qs[_0xaec2('0x30')](_0x5cbf2c[_0xaec2('0x47')][_0xaec2('0x30')]);}_0x558811[_0xaec2('0x4f')]=qs[_0xaec2('0x50')](_0x5cbf2c[_0xaec2('0x47')][_0xaec2('0x50')]);_0x558811[_0xaec2('0x51')]=qs[_0xaec2('0x48')](_[_0xaec2('0x52')](_0x5cbf2c[_0xaec2('0x47')],_0x438923[_0xaec2('0x48')]));_0x558811[_0xaec2('0x51')][_0xaec2('0x68')]=_0x1d080f['id'];if(_0x5cbf2c[_0xaec2('0x47')][_0xaec2('0x53')]){_0x558811[_0xaec2('0x51')]=_[_0xaec2('0x5d')](_0x558811[_0xaec2('0x51')],{'$or':_[_0xaec2('0x3f')](_0x558811[_0xaec2('0x4a')],function(_0x2ecaf2){var _0xa3f74d={};_0xa3f74d[_0x2ecaf2]={'$like':'%'+_0x5cbf2c[_0xaec2('0x47')][_0xaec2('0x53')]+'%'};return _0xa3f74d;})});}_0x558811=_['merge']({},_0x558811,_0x5cbf2c['options']);return db[_0xaec2('0x9e')][_0xaec2('0x31')]({'where':_0x558811[_0xaec2('0x51')]})[_0xaec2('0x22')](function(_0x243cc2){_0x1ffedd[_0xaec2('0x31')]=_0x243cc2;if(_0x5cbf2c[_0xaec2('0x47')][_0xaec2('0x57')]){_0x558811[_0xaec2('0x58')]=[{'model':db['CmContact'],'as':_0xaec2('0xbe'),'required':![]},{'model':db[_0xaec2('0xbf')],'as':_0xaec2('0xc0'),'attributes':[_0xaec2('0x45'),_0xaec2('0xc1'),_0xaec2('0xc2')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xaec2('0x45'),_0xaec2('0xc3')],'where':_0x5cbf2c['query'][_0xaec2('0xc4')]?{'id':_0x5cbf2c[_0xaec2('0x47')][_0xaec2('0xc4')]}:undefined,'required':_0x5cbf2c[_0xaec2('0x47')][_0xaec2('0xc4')]?!![]:![]}];}return db[_0xaec2('0x9e')][_0xaec2('0x59')](_0x558811);})[_0xaec2('0x22')](function(_0x232501){_0x1ffedd['rows']=_0x232501;return _0x1ffedd;});}})['then'](respondWithFilteredResult(_0x414893,_0x558811))[_0xaec2('0x2a')](handleError(_0x414893,null));};exports[_0xaec2('0x3c')]=function(_0x17c6f2,_0x2f22a7,_0x467d21){var _0x55b578,_0x498382,_0x127f52;if(_['isNil'](_0x17c6f2[_0xaec2('0x60')]['body'])||_0x17c6f2[_0xaec2('0x60')][_0xaec2('0x60')]===''){throw new db['Sequelize'][(_0xaec2('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xaec2('0x92')](_0x17c6f2['body']['to'])){throw new db['Sequelize']['ValidationError'](_0xaec2('0xc5'));}_0x55b578=_0x17c6f2[_0xaec2('0x60')]['to'];return db[_0xaec2('0x56')][_0xaec2('0x5e')]({'where':{'id':_0x17c6f2[_0xaec2('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0xaec2('0xc6'),'include':[{'model':db[_0xaec2('0x77')],'as':'Contacts','where':{'mobile':_0x55b578},'limit':0x1,'order':[[_0xaec2('0x7c'),'DESC']]}]}]})[_0xaec2('0x22')](handleEntityNotFound(_0x2f22a7,null))['then'](function(_0x4c84b8){if(_0x4c84b8&&_0x4c84b8[_0xaec2('0xc6')]){_0x498382=_0x4c84b8[_0xaec2('0x37')]({'plain':!![]});if(_0x498382[_0xaec2('0xc6')]&&_0x498382[_0xaec2('0xc6')]['Contacts'][_0xaec2('0x4c')]){return _0x498382[_0xaec2('0xc6')][_0xaec2('0x99')][0x0];}return db[_0xaec2('0x77')][_0xaec2('0x5f')](_[_0xaec2('0x1a')](_0x17c6f2[_0xaec2('0x60')],{'firstName':_0x55b578,'mobile':_0x55b578,'phone':_0x55b578,'ListId':_0x498382[_0xaec2('0x7e')]}));}})[_0xaec2('0x22')](handleEntityNotFound(_0x2f22a7,null))[_0xaec2('0x22')](function(_0x51cec8){if(_0x51cec8){_0x127f52=_0x51cec8;return db[_0xaec2('0x9e')]['find']({'where':{'ContactId':_0x127f52['id'],'closed':![],'SmsAccountId':_0x498382['id']}})[_0xaec2('0x22')](function(_0x1b04e0){if(_0x1b04e0){return[_0x1b04e0,![]];}return db[_0xaec2('0x9e')][_0xaec2('0x5f')]({'UserId':_0x17c6f2[_0xaec2('0x61')]['id'],'ContactId':_0x127f52['id'],'SmsAccountId':_0x498382['id'],'phone':_0x55b578,'firstMsgDirection':_0xaec2('0xc7'),'Messages':[_[_0xaec2('0x5d')](_0x17c6f2[_0xaec2('0x60')],{'read':![],'body':_0x17c6f2[_0xaec2('0x60')][_0xaec2('0x60')],'phone':_0x55b578,'SmsAccountId':_0x498382['id'],'UserId':_0x17c6f2[_0xaec2('0x61')]['id'],'ContactId':_0x127f52['id']})]},{'include':[{'model':db[_0xaec2('0xa8')],'as':_0xaec2('0xc8')}]})[_0xaec2('0x22')](function(_0x262a10){return[_0x262a10,!![]];});});}})[_0xaec2('0x9f')](function(_0x525f60,_0x4e5bd8){if(_0x4e5bd8){return _0x525f60;}return db['SmsMessage'][_0xaec2('0x5f')](_[_0xaec2('0x5d')](_0x17c6f2[_0xaec2('0x60')],{'read':![],'body':_0x17c6f2[_0xaec2('0x60')][_0xaec2('0x60')],'phone':_0x55b578,'SmsAccountId':_0x498382['id'],'SmsInteractionId':_0x525f60['id'],'UserId':_0x17c6f2[_0xaec2('0x61')]['id'],'ContactId':_0x127f52['id']}))[_0xaec2('0x22')](function(_0x3f5ee1){_0x525f60[_0xaec2('0xc9')][_0xaec2('0xc8')]=[];_0x525f60[_0xaec2('0xc9')][_0xaec2('0xc8')]['push'](_0x3f5ee1[_0xaec2('0xc9')]);return _0x525f60;});})[_0xaec2('0x22')](respondWithResult(_0x2f22a7,null))['catch'](handleError(_0x2f22a7,null));};exports[_0xaec2('0x2c')]=function(_0x5ce232,_0x4a2e43,_0x32f362){if(_0x5ce232['body']['id']){delete _0x5ce232[_0xaec2('0x60')]['id'];}var _0x3fd8d6,_0x333913,_0x53fd4d;return db[_0xaec2('0x56')][_0xaec2('0x5e')]({'where':{'id':_0x5ce232[_0xaec2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4a2e43,null))[_0xaec2('0x22')](function(_0x1e31f7){if(_0x1e31f7){_0x53fd4d=_0x1e31f7;logger[_0xaec2('0xca')](_0xaec2('0x26'),_0xaec2('0x2c'),_0xaec2('0xcb'),_0x1e31f7[_0xaec2('0x42')],util['inspect'](_0x5ce232[_0xaec2('0x60')],{'showHidden':![],'depth':null}));switch(_0x1e31f7[_0xaec2('0x42')]){case'skebby':if(_0x5ce232[_0xaec2('0x60')][_0xaec2('0xcc')]&&_0x5ce232[_0xaec2('0x60')][_0xaec2('0x2c')]){_0x333913=_0x5ce232[_0xaec2('0x60')][_0xaec2('0x2c')];return db['SmsMessage'][_0xaec2('0x5e')]({'where':{'messageId':_0x5ce232[_0xaec2('0x60')][_0xaec2('0xcc')]}});}break;case'connectel':if(_0x5ce232[_0xaec2('0x60')][_0xaec2('0xcd')]&&_0x5ce232[_0xaec2('0x60')][_0xaec2('0xce')]){_0x333913=_0x5ce232[_0xaec2('0x60')][_0xaec2('0xce')];return db[_0xaec2('0xa8')][_0xaec2('0x5e')]({'where':{'messageId':_0x5ce232[_0xaec2('0x60')]['requestid']}});}break;case _0xaec2('0xcf'):if(_0x5ce232[_0xaec2('0x60')][_0xaec2('0x88')]&&_0x5ce232[_0xaec2('0x60')][_0xaec2('0xd0')]){_0x333913=_0x5ce232['body'][_0xaec2('0xd0')];return db[_0xaec2('0xa8')][_0xaec2('0x5e')]({'where':{'messageId':_0x5ce232['body'][_0xaec2('0x88')]}});}break;case _0xaec2('0xd1'):var _0x972ab3=_0x5ce232[_0xaec2('0x60')][_0xaec2('0x8b')][0x0];if(_0x972ab3[_0xaec2('0x84')]&&_0x972ab3['status'][_0xaec2('0xd2')]===_0xaec2('0xd3')){_0x333913=_0x972ab3[_0xaec2('0x2c')][_0xaec2('0xd2')];return db[_0xaec2('0xa8')][_0xaec2('0x5e')]({'where':{'messageId':_0x972ab3[_0xaec2('0x84')]}});}break;case'clickatell':if(_0x5ce232[_0xaec2('0x60')]['messageId']&&_0x5ce232['body'][_0xaec2('0x2c')]){_0x333913=_0x5ce232[_0xaec2('0x60')][_0xaec2('0x2c')];return db['SmsMessage'][_0xaec2('0x5e')]({'where':{'messageId':_0x5ce232['body'][_0xaec2('0x84')]}});}break;case _0xaec2('0xd4'):if(_0x5ce232[_0xaec2('0x60')][0x0]['message']['id']){_0x333913=_0x5ce232[_0xaec2('0x60')][0x0]['type'];return db[_0xaec2('0xa8')][_0xaec2('0x5e')]({'where':{'messageId':_0x5ce232[_0xaec2('0x60')][0x0][_0xaec2('0x28')]['id']}});}break;case _0xaec2('0x90'):if(_0x5ce232[_0xaec2('0x60')]['redif']&&_0x5ce232[_0xaec2('0x60')][_0xaec2('0x2c')]){_0x333913=_0x5ce232[_0xaec2('0x60')][_0xaec2('0x2c')];return db['SmsMessage']['find']({'where':{'messageId':_0x5ce232[_0xaec2('0x60')][_0xaec2('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x4a2e43,null))[_0xaec2('0x22')](function(_0x570bcc){if(_0x570bcc){_0x3fd8d6=_0x570bcc;switch(_0x53fd4d[_0xaec2('0x42')]){case _0xaec2('0xd6'):if(_0x333913==='DELIVERED'){return _0x3fd8d6[_0xaec2('0x35')]({'read':!![]});}else{logger[_0xaec2('0x27')](_0xaec2('0x26'),_0xaec2('0x2c'),_0xaec2('0xd6'),util['inspect'](_0x5ce232['body'],{'showHidden':![],'depth':null}));}break;case _0xaec2('0x87'):if(_0x333913==='1'){return _0x3fd8d6[_0xaec2('0x35')]({'read':!![]});}else{logger[_0xaec2('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaec2('0x2c'),'skebby',util[_0xaec2('0xd7')](_0x5ce232[_0xaec2('0x60')],{'showHidden':![],'depth':null}));}break;case _0xaec2('0xcf'):if(!_0x5ce232[_0xaec2('0x60')][_0xaec2('0xd8')]&&_0x333913>=0xc8&&_0x333913<=0xce){return _0x3fd8d6[_0xaec2('0x35')]({'read':!![]});}else{logger[_0xaec2('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaec2('0x2c'),_0xaec2('0xcf'),util[_0xaec2('0xd7')](_0x5ce232['body'],{'showHidden':![],'depth':null}));}break;case _0xaec2('0xd1'):var _0xcb8301=_0x5ce232[_0xaec2('0x60')][_0xaec2('0x8b')][0x0];if(_0xcb8301[_0xaec2('0x2c')][_0xaec2('0xd2')]===_0xaec2('0xd3')){return _0x3fd8d6[_0xaec2('0x35')]({'read':!![]});}else{logger[_0xaec2('0x27')](_0xaec2('0x26'),_0xaec2('0x2c'),_0xaec2('0xd1'),util[_0xaec2('0xd7')](_0x5ce232[_0xaec2('0x60')],{'showHidden':![],'depth':null}));}break;case _0xaec2('0x8d'):if(_0x333913==_0xaec2('0xd9')||_0x333913=='RECEIVED_BY_RECIPIENT'){return _0x3fd8d6[_0xaec2('0x35')]({'read':!![]});}else{logger[_0xaec2('0x27')](_0xaec2('0x26'),'status',_0xaec2('0x8d'),util['inspect'](_0x5ce232[_0xaec2('0x60')],{'showHidden':![],'depth':null}));}break;case _0xaec2('0xd4'):if(_0x333913=='message-delivered'){return _0x3fd8d6[_0xaec2('0x35')]({'read':!![]});}else{logger['error'](_0xaec2('0x26'),_0xaec2('0x2c'),_0xaec2('0xd4'),util[_0xaec2('0xd7')](_0x5ce232[_0xaec2('0x60')],{'showHidden':![],'depth':null}));}break;case _0xaec2('0x90'):if(_0x333913===_0xaec2('0xda')||_0x333913==='ACCEPTD'){return _0x3fd8d6[_0xaec2('0x35')]({'read':!![]});}else{logger[_0xaec2('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaec2('0x2c'),'intelepeer',util[_0xaec2('0xd7')](_0x5ce232[_0xaec2('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x3fd8d6;}})['then'](respondWithResult(_0x4a2e43,null))[_0xaec2('0x2a')](handleError(_0x4a2e43,null));};exports['statusGet']=function(_0x45974f,_0x20477a,_0x15eb2f){var _0x349734,_0x253923,_0x5bf43a;return db['SmsAccount'][_0xaec2('0x5e')]({'where':{'id':_0x45974f[_0xaec2('0x5b')]['id']}})[_0xaec2('0x22')](handleEntityNotFound(_0x20477a,null))['then'](function(_0xc28ade){if(_0xc28ade){_0x5bf43a=_0xc28ade;logger[_0xaec2('0xca')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaec2('0x2c'),_0xaec2('0xcb'),_0xc28ade['type'],util[_0xaec2('0xd7')](_0x45974f[_0xaec2('0x47')],{'showHidden':![],'depth':null}));switch(_0xc28ade[_0xaec2('0x42')]){case _0xaec2('0xdb'):if(_0x45974f['query'][_0xaec2('0xdc')]&&_0x45974f[_0xaec2('0x47')][_0xaec2('0xdd')]){_0x253923=_0x45974f[_0xaec2('0x47')][_0xaec2('0xdd')];return db[_0xaec2('0xa8')][_0xaec2('0x5e')]({'where':{'messageId':_0x45974f[_0xaec2('0x47')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x20477a,null))[_0xaec2('0x22')](function(_0x1e0ae5){if(_0x1e0ae5){_0x349734=_0x1e0ae5;switch(_0x5bf43a[_0xaec2('0x42')]){case _0xaec2('0xdb'):if(_0x253923==='2'||_0x253923==='6'){return _0x349734[_0xaec2('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaec2('0x2c'),_0xaec2('0xdb'),util[_0xaec2('0xd7')](_0x45974f[_0xaec2('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x349734;}})[_0xaec2('0x22')](respondWithResult(_0x20477a,null))[_0xaec2('0x2a')](handleError(_0x20477a,null));};exports[_0xaec2('0xde')]=function(_0x1485fc,_0x566d25,_0x59c1cf){return db['SmsAccount'][_0xaec2('0x5e')]({'where':{'id':_0x1485fc['params']['id']}})['then'](handleEntityNotFound(_0x566d25,null))[_0xaec2('0x22')](function(_0x46f5a9){if(_0x46f5a9){return _0x46f5a9[_0xaec2('0xde')](_0x1485fc[_0xaec2('0x60')][_0xaec2('0x6c')],_[_0xaec2('0x9c')](_0x1485fc[_0xaec2('0x60')],[_0xaec2('0x6c'),'id'])||{})[_0xaec2('0x9f')](function(_0xa46343){for(var _0x392ddb=0x0;_0x392ddb<_0x1485fc['body'][_0xaec2('0x6c')][_0xaec2('0x4c')];_0x392ddb+=0x1){socket[_0xaec2('0xdf')](_0xaec2('0xe0'),{'UserId':Number(_0x1485fc['body'][_0xaec2('0x6c')][_0x392ddb]),'SmsAccountId':Number(_0x1485fc[_0xaec2('0x5b')]['id'])});}return _0xa46343;});}})[_0xaec2('0x22')](respondWithResult(_0x566d25,null))[_0xaec2('0x2a')](handleError(_0x566d25,null));};exports[_0xaec2('0xe1')]=function(_0x148cc4,_0x50c1f5,_0x49a31c){return db['SmsAccount']['find']({'where':{'id':_0x148cc4['params']['id']}})['then'](handleEntityNotFound(_0x50c1f5,null))[_0xaec2('0x22')](function(_0x466893){if(_0x466893){return _0x466893[_0xaec2('0xe1')](_0x148cc4[_0xaec2('0x47')][_0xaec2('0x6c')])['then'](function(){if(_[_0xaec2('0xe2')](_0x148cc4[_0xaec2('0x47')][_0xaec2('0x6c')])){for(var _0x54ecba=0x0;_0x54ecba<_0x148cc4[_0xaec2('0x47')][_0xaec2('0x6c')][_0xaec2('0x4c')];_0x54ecba+=0x1){socket[_0xaec2('0xdf')](_0xaec2('0xe3'),{'UserId':Number(_0x148cc4['query'][_0xaec2('0x6c')][_0x54ecba]),'SmsAccountId':Number(_0x148cc4[_0xaec2('0x5b')]['id'])});}}else{socket['emit'](_0xaec2('0xe3'),{'UserId':Number(_0x148cc4[_0xaec2('0x47')]['ids']),'SmsAccountId':Number(_0x148cc4[_0xaec2('0x5b')]['id'])});}});}})[_0xaec2('0x22')](respondWithStatusCode(_0x50c1f5,null))[_0xaec2('0x2a')](handleError(_0x50c1f5,null));};exports[_0xaec2('0xe4')]=function(_0x5f1839,_0x5b2649,_0x1277af){var _0x3695f0={};var _0x26f891={};var _0x8ac478;var _0x2ac2c7;return db[_0xaec2('0x56')][_0xaec2('0x6a')]({'where':{'id':_0x5f1839[_0xaec2('0x5b')]['id']}})[_0xaec2('0x22')](handleEntityNotFound(_0x5b2649,null))[_0xaec2('0x22')](function(_0x90f6){if(_0x90f6){_0x8ac478=_0x90f6;_0x26f891[_0xaec2('0x44')]=_['keys'](db[_0xaec2('0xbf')][_0xaec2('0x40')]);_0x26f891[_0xaec2('0x47')]=_[_0xaec2('0x46')](_0x5f1839[_0xaec2('0x47')]);_0x26f891[_0xaec2('0x48')]=_[_0xaec2('0x49')](_0x26f891[_0xaec2('0x44')],_0x26f891['query']);_0x3695f0[_0xaec2('0x4a')]=_[_0xaec2('0x49')](_0x26f891[_0xaec2('0x44')],qs[_0xaec2('0x4b')](_0x5f1839['query']['fields']));_0x3695f0[_0xaec2('0x4a')]=_0x3695f0[_0xaec2('0x4a')][_0xaec2('0x4c')]?_0x3695f0[_0xaec2('0x4a')]:_0x26f891[_0xaec2('0x44')];_0x3695f0['order']=qs[_0xaec2('0x50')](_0x5f1839[_0xaec2('0x47')][_0xaec2('0x50')]);_0x3695f0[_0xaec2('0x51')]=qs[_0xaec2('0x48')](_['pick'](_0x5f1839[_0xaec2('0x47')],_0x26f891[_0xaec2('0x48')]));if(_0x5f1839[_0xaec2('0x47')]['filter']){_0x3695f0[_0xaec2('0x51')]=_[_0xaec2('0x5d')](_0x3695f0['where'],{'$or':_[_0xaec2('0x3f')](_0x3695f0[_0xaec2('0x4a')],function(_0x31f2db){var _0x41d11f={};_0x41d11f[_0x31f2db]={'$like':'%'+_0x5f1839['query'][_0xaec2('0x53')]+'%'};return _0x41d11f;})});}_0x3695f0=_[_0xaec2('0x5d')]({},_0x3695f0,_0x5f1839['options']);return _0x8ac478[_0xaec2('0xe4')](_0x3695f0);}})[_0xaec2('0x22')](function(_0x5a8388){if(_0x5a8388){_0x2ac2c7=_0x5a8388[_0xaec2('0x4c')];if(!_0x5f1839[_0xaec2('0x47')]['hasOwnProperty'](_0xaec2('0x4e'))){_0x3695f0['limit']=qs[_0xaec2('0x2f')](_0x5f1839['query'][_0xaec2('0x2f')]);_0x3695f0[_0xaec2('0x30')]=qs[_0xaec2('0x30')](_0x5f1839[_0xaec2('0x47')][_0xaec2('0x30')]);}return _0x8ac478['getAgents'](_0x3695f0);}})[_0xaec2('0x22')](function(_0x16cdea){if(_0x16cdea){return _0x16cdea?{'count':_0x2ac2c7,'rows':_0x16cdea}:null;}})['then'](respondWithResult(_0x5b2649,null))[_0xaec2('0x2a')](handleError(_0x5b2649,null));}; \ No newline at end of file +var _0x934a=['contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','startRouting','receiveMessage','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','getApplications','Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','user','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','clickatell','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','csc','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','offset','limit','count','reject','save','update','destroy','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','SmsAccount','includeAll','include','findAll','rows','show','params','Pause','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','CannedAnswer','removeAnswers','notify','SmsApplication','Applications','applications','priority','asc','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','results','originatingAddress','segmentedMessage','replyMessageId','bandwidth','intelepeer','refid','isNil','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','Contacts','DESC','list','omit'];(function(_0x2ba617,_0x3651ce){var _0xe7a009=function(_0x6a229e){while(--_0x6a229e){_0x2ba617['push'](_0x2ba617['shift']());}};_0xe7a009(++_0x3651ce);}(_0x934a,0x129));var _0xa934=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0x934a[_0xa79977];return _0x109f10;};'use strict';var emlformat=require(_0xa934('0x0'));var rimraf=require(_0xa934('0x1'));var zipdir=require(_0xa934('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa934('0x3'));var BPromise=require(_0xa934('0x4'));var Mustache=require(_0xa934('0x5'));var util=require('util');var path=require(_0xa934('0x6'));var sox=require(_0xa934('0x7'));var csv=require('to-csv');var ejs=require(_0xa934('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa934('0x9'));var squel=require(_0xa934('0xa'));var crypto=require(_0xa934('0xb'));var jsforce=require(_0xa934('0xc'));var deskjs=require(_0xa934('0xd'));var toCsv=require(_0xa934('0xe'));var querystring=require(_0xa934('0xf'));var Papa=require(_0xa934('0x10'));var Redis=require(_0xa934('0x11'));var authService=require(_0xa934('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa934('0x13'));var hardwareService=require(_0xa934('0x14'));var logger=require(_0xa934('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa934('0x16'))['db'];config[_0xa934('0x17')]=_[_0xa934('0x18')](config[_0xa934('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xa934('0x19'))(new Redis(config['redis']));require('./smsAccount.socket')[_0xa934('0x1a')](socket);var jayson=require(_0xa934('0x1b'));var client=jayson[_0xa934('0x1c')][_0xa934('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x3787ac,_0x2766d5,_0x2c8c65,_0x5d8fe8){return new BPromise(function(_0xb26cfd,_0x13f5bf){var _0x59acc8=_0x5d8fe8||client;return _0x59acc8[_0xa934('0x1e')](_0x3787ac,_0x2c8c65)[_0xa934('0x1f')](function(_0x41b781){logger[_0xa934('0x20')](_0xa934('0x21'),_0x2766d5,'request\x20sent');logger['debug'](_0xa934('0x22'),_0x2766d5,_0xa934('0x23'),JSON[_0xa934('0x24')](_0x41b781));if(_0x41b781['error']){if(_0x41b781[_0xa934('0x25')][_0xa934('0x26')]===0x1f4){logger[_0xa934('0x25')](_0xa934('0x21'),_0x2766d5,_0x41b781[_0xa934('0x25')][_0xa934('0x27')]);return _0x13f5bf(_0x41b781[_0xa934('0x25')][_0xa934('0x27')]);}logger[_0xa934('0x25')]('SmsAccount,\x20%s,\x20%s',_0x2766d5,_0x41b781[_0xa934('0x25')]['message']);return _0xb26cfd(_0x41b781[_0xa934('0x25')]['message']);}else{logger[_0xa934('0x20')](_0xa934('0x21'),_0x2766d5,_0xa934('0x23'));_0xb26cfd(_0x41b781['result'][_0xa934('0x27')]);}})[_0xa934('0x28')](function(_0x48b219){logger[_0xa934('0x25')](_0xa934('0x21'),_0x2766d5,_0x48b219);_0x13f5bf(_0x48b219);});});}function respondWithStatusCode(_0x5316fb,_0x437bfc){_0x437bfc=_0x437bfc||0xcc;return function(_0x592ca0){if(_0x592ca0){return _0x5316fb['sendStatus'](_0x437bfc);}return _0x5316fb[_0xa934('0x29')](_0x437bfc)[_0xa934('0x2a')]();};}function respondWithResult(_0x11a281,_0x11f134){_0x11f134=_0x11f134||0xc8;return function(_0x20a07f){if(_0x20a07f){return _0x11a281[_0xa934('0x29')](_0x11f134)[_0xa934('0x2b')](_0x20a07f);}};}function respondWithFilteredResult(_0x35e665,_0x10f236){return function(_0x4ae6ef){if(_0x4ae6ef){var _0x52c9c6=typeof _0x10f236[_0xa934('0x2c')]==='undefined'&&typeof _0x10f236[_0xa934('0x2d')]==='undefined';var _0x160146=_0x4ae6ef[_0xa934('0x2e')];var _0x5a657e=_0x52c9c6?0x0:_0x10f236[_0xa934('0x2c')];var _0xc2b92d=_0x52c9c6?_0x4ae6ef[_0xa934('0x2e')]:_0x10f236[_0xa934('0x2c')]+_0x10f236[_0xa934('0x2d')];var _0x555a63;if(_0xc2b92d>=_0x160146){_0xc2b92d=_0x160146;_0x555a63=0xc8;}else{_0x555a63=0xce;}_0x35e665[_0xa934('0x29')](_0x555a63);return _0x35e665['set']('Content-Range',_0x5a657e+'-'+_0xc2b92d+'/'+_0x160146)[_0xa934('0x2b')](_0x4ae6ef);}return null;};}function patchUpdates(_0x98c288){return function(_0x556919){try{jsonpatch['apply'](_0x556919,_0x98c288,!![]);}catch(_0x5dc830){return BPromise[_0xa934('0x2f')](_0x5dc830);}return _0x556919[_0xa934('0x30')]();};}function saveUpdates(_0x2c12ea,_0x4f3cf0){return function(_0x2fc277){if(_0x2fc277){return _0x2fc277[_0xa934('0x31')](_0x2c12ea)[_0xa934('0x1f')](function(_0x35f2e2){return _0x35f2e2;});}return null;};}function removeEntity(_0x255171,_0x329486){return function(_0x4820ba){if(_0x4820ba){return _0x4820ba[_0xa934('0x32')]()['then'](function(){var _0x8c67f9=_0x4820ba['get']({'plain':!![]});var _0x23c54d=_0xa934('0x33');return db[_0xa934('0x34')][_0xa934('0x32')]({'where':{'type':_0x23c54d,'resourceId':_0x8c67f9['id']}})['then'](function(){return _0x4820ba;});})[_0xa934('0x1f')](function(){_0x255171[_0xa934('0x29')](0xcc)[_0xa934('0x2a')]();});}};}function handleEntityNotFound(_0x10f9fa,_0x472399){return function(_0x1df086){if(!_0x1df086){_0x10f9fa[_0xa934('0x35')](0x194);}return _0x1df086;};}function handleError(_0x5c3592,_0x25d3c1){_0x25d3c1=_0x25d3c1||0x1f4;return function(_0x52a86b){logger['error'](_0x52a86b[_0xa934('0x36')]);if(_0x52a86b[_0xa934('0x37')]){delete _0x52a86b[_0xa934('0x37')];}_0x5c3592['status'](_0x25d3c1)[_0xa934('0x38')](_0x52a86b);};}exports[_0xa934('0x39')]=function(_0x6ce880,_0x3cb878){var _0x14f4e0={'include':[{'model':db['Pause'],'as':_0xa934('0x3a')}]},_0x2f21b8={},_0x431613={'count':0x0,'rows':[]};var _0x535e19=_[_0xa934('0x3b')](db['SmsAccount'][_0xa934('0x3c')],function(_0x2cb19f){return{'name':_0x2cb19f['fieldName'],'type':_0x2cb19f[_0xa934('0x3d')][_0xa934('0x3e')]};});_0x2f21b8[_0xa934('0x3f')]=_['map'](_0x535e19,'name');_0x2f21b8[_0xa934('0x40')]=_[_0xa934('0x41')](_0x6ce880[_0xa934('0x40')]);_0x2f21b8[_0xa934('0x42')]=_[_0xa934('0x43')](_0x2f21b8[_0xa934('0x3f')],_0x2f21b8[_0xa934('0x40')]);_0x14f4e0[_0xa934('0x44')]=_[_0xa934('0x43')](_0x2f21b8['model'],qs[_0xa934('0x45')](_0x6ce880[_0xa934('0x40')][_0xa934('0x45')]));_0x14f4e0[_0xa934('0x44')]=_0x14f4e0[_0xa934('0x44')][_0xa934('0x46')]?_0x14f4e0['attributes']:_0x2f21b8[_0xa934('0x3f')];if(!_0x6ce880[_0xa934('0x40')][_0xa934('0x47')](_0xa934('0x48'))){_0x14f4e0[_0xa934('0x2d')]=qs[_0xa934('0x2d')](_0x6ce880['query'][_0xa934('0x2d')]);_0x14f4e0[_0xa934('0x2c')]=qs['offset'](_0x6ce880['query']['offset']);}_0x14f4e0[_0xa934('0x49')]=qs[_0xa934('0x4a')](_0x6ce880[_0xa934('0x40')][_0xa934('0x4a')]);_0x14f4e0[_0xa934('0x4b')]=qs[_0xa934('0x42')](_['pick'](_0x6ce880['query'],_0x2f21b8[_0xa934('0x42')]),_0x535e19);if(_0x6ce880[_0xa934('0x40')][_0xa934('0x4c')]){_0x14f4e0[_0xa934('0x4b')]=_['merge'](_0x14f4e0['where'],{'$or':_[_0xa934('0x3b')](_0x535e19,function(_0x565854){if(_0x565854[_0xa934('0x3d')]!==_0xa934('0x4d')){var _0x564666={};_0x564666[_0x565854[_0xa934('0x37')]]={'$like':'%'+_0x6ce880[_0xa934('0x40')][_0xa934('0x4c')]+'%'};return _0x564666;}})});}_0x14f4e0=_[_0xa934('0x4e')]({},_0x14f4e0,_0x6ce880['options']);var _0x449b9b={'where':_0x14f4e0['where']};return db[_0xa934('0x4f')][_0xa934('0x2e')](_0x449b9b)['then'](function(_0x20cddc){_0x431613[_0xa934('0x2e')]=_0x20cddc;if(_0x6ce880[_0xa934('0x40')][_0xa934('0x50')]){_0x14f4e0[_0xa934('0x51')]=[{'all':!![]}];}return db[_0xa934('0x4f')][_0xa934('0x52')](_0x14f4e0);})['then'](function(_0x1001ba){_0x431613[_0xa934('0x53')]=_0x1001ba;return _0x431613;})[_0xa934('0x1f')](respondWithFilteredResult(_0x3cb878,_0x14f4e0))['catch'](handleError(_0x3cb878,null));};exports[_0xa934('0x54')]=function(_0x5ba1a7,_0x11945c){var _0x552563={'raw':![],'where':{'id':_0x5ba1a7[_0xa934('0x55')]['id']},'include':[{'model':db[_0xa934('0x56')],'as':_0xa934('0x3a')}]},_0x2557b6={};_0x2557b6[_0xa934('0x3f')]=_[_0xa934('0x41')](db[_0xa934('0x4f')]['rawAttributes']);_0x2557b6[_0xa934('0x40')]=_[_0xa934('0x41')](_0x5ba1a7[_0xa934('0x40')]);_0x2557b6[_0xa934('0x42')]=_[_0xa934('0x43')](_0x2557b6[_0xa934('0x3f')],_0x2557b6['query']);_0x552563[_0xa934('0x44')]=_[_0xa934('0x43')](_0x2557b6['model'],qs['fields'](_0x5ba1a7[_0xa934('0x40')]['fields']));_0x552563[_0xa934('0x44')]=_0x552563[_0xa934('0x44')]['length']?_0x552563[_0xa934('0x44')]:_0x2557b6[_0xa934('0x3f')];if(_0x5ba1a7[_0xa934('0x40')][_0xa934('0x50')]){_0x552563[_0xa934('0x51')]=[{'all':!![]}];}_0x552563=_[_0xa934('0x4e')]({},_0x552563,_0x5ba1a7[_0xa934('0x57')]);return db[_0xa934('0x4f')][_0xa934('0x58')](_0x552563)['then'](handleEntityNotFound(_0x11945c,null))[_0xa934('0x1f')](respondWithResult(_0x11945c,null))[_0xa934('0x28')](handleError(_0x11945c,null));};exports['create']=function(_0x215611,_0x268523){return db[_0xa934('0x4f')][_0xa934('0x59')](_0x215611[_0xa934('0x5a')],{})[_0xa934('0x1f')](function(_0xe3f7dd){var _0x26ffee=_0x215611['user'][_0xa934('0x5b')]({'plain':!![]});if(!_0x26ffee)throw new Error(_0xa934('0x5c'));if(_0x26ffee[_0xa934('0x5d')]==='user'){var _0x4517e7=_0xe3f7dd[_0xa934('0x5b')]({'plain':!![]});var _0x15accd='SmsAccounts';return db['UserProfileSection'][_0xa934('0x58')]({'where':{'name':_0x15accd,'userProfileId':_0x26ffee[_0xa934('0x5e')]},'raw':!![]})[_0xa934('0x1f')](function(_0x578e88){if(_0x578e88&&_0x578e88[_0xa934('0x5f')]===0x0){return db['UserProfileResource'][_0xa934('0x59')]({'name':_0x4517e7['name'],'resourceId':_0x4517e7['id'],'type':_0x578e88[_0xa934('0x37')],'sectionId':_0x578e88['id']},{})[_0xa934('0x1f')](function(){return _0xe3f7dd;});}else{return _0xe3f7dd;}})[_0xa934('0x28')](function(_0x4e54b9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e54b9);throw _0x4e54b9;});}return _0xe3f7dd;})['then'](respondWithResult(_0x268523,0xc9))[_0xa934('0x28')](handleError(_0x268523,null));};exports[_0xa934('0x31')]=function(_0x564333,_0x218b63){if(_0x564333[_0xa934('0x5a')]['id']){delete _0x564333['body']['id'];}return db[_0xa934('0x4f')][_0xa934('0x58')]({'where':{'id':_0x564333[_0xa934('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xa934('0x3a')}]})[_0xa934('0x1f')](handleEntityNotFound(_0x218b63,null))[_0xa934('0x1f')](saveUpdates(_0x564333['body'],null))[_0xa934('0x1f')](respondWithResult(_0x218b63,null))[_0xa934('0x28')](handleError(_0x218b63,null));};exports[_0xa934('0x32')]=function(_0x7101,_0x2ff3f8){return db[_0xa934('0x4f')][_0xa934('0x58')]({'where':{'id':_0x7101[_0xa934('0x55')]['id']}})[_0xa934('0x1f')](handleEntityNotFound(_0x2ff3f8,null))['then'](removeEntity(_0x2ff3f8,null))['catch'](handleError(_0x2ff3f8,null));};exports[_0xa934('0x60')]=function(_0x1726ea,_0x21420f){return db['SmsAccount'][_0xa934('0x60')]()['then'](respondWithResult(_0x21420f,null))[_0xa934('0x28')](handleError(_0x21420f,null));};exports[_0xa934('0x61')]=function(_0x29bdf3,_0x478698,_0x3f365d){if(_0x29bdf3[_0xa934('0x5a')]['id']){delete _0x29bdf3[_0xa934('0x5a')]['id'];}return db[_0xa934('0x4f')][_0xa934('0x58')]({'where':{'id':_0x29bdf3[_0xa934('0x55')]['id']}})['then'](handleEntityNotFound(_0x478698,null))[_0xa934('0x1f')](function(_0x168596){if(_0x168596){_0x29bdf3[_0xa934('0x5a')][_0xa934('0x62')]=_0x168596['id'];return db[_0xa934('0x63')]['create'](_0x29bdf3[_0xa934('0x5a')]);}})[_0xa934('0x1f')](respondWithResult(_0x478698,null))[_0xa934('0x28')](handleError(_0x478698,null));};exports[_0xa934('0x64')]=function(_0x5b606a,_0x345e6e,_0x5d9cad){var _0x47a315={'raw':![],'where':{}};var _0x50ddae={};var _0x205bd6={'count':0x0,'rows':[]};return db[_0xa934('0x4f')][_0xa934('0x65')]({'where':{'id':_0x5b606a[_0xa934('0x55')]['id']}})['then'](handleEntityNotFound(_0x345e6e,null))[_0xa934('0x1f')](function(_0x5aa5bc){if(_0x5aa5bc){_0x50ddae[_0xa934('0x3f')]=_[_0xa934('0x41')](db[_0xa934('0x63')]['rawAttributes']);_0x50ddae['query']=_[_0xa934('0x41')](_0x5b606a[_0xa934('0x40')]);_0x50ddae[_0xa934('0x42')]=_[_0xa934('0x43')](_0x50ddae[_0xa934('0x3f')],_0x50ddae[_0xa934('0x40')]);_0x47a315[_0xa934('0x44')]=_[_0xa934('0x43')](_0x50ddae['model'],qs[_0xa934('0x45')](_0x5b606a[_0xa934('0x40')]['fields']));_0x47a315[_0xa934('0x44')]=_0x47a315[_0xa934('0x44')][_0xa934('0x46')]?_0x47a315[_0xa934('0x44')]:_0x50ddae['model'];if(!_0x5b606a['query'][_0xa934('0x47')](_0xa934('0x48'))){_0x47a315[_0xa934('0x2d')]=qs['limit'](_0x5b606a[_0xa934('0x40')][_0xa934('0x2d')]);_0x47a315[_0xa934('0x2c')]=qs[_0xa934('0x2c')](_0x5b606a[_0xa934('0x40')][_0xa934('0x2c')]);}_0x47a315['order']=qs[_0xa934('0x4a')](_0x5b606a[_0xa934('0x40')][_0xa934('0x4a')]);_0x47a315[_0xa934('0x4b')]=qs[_0xa934('0x42')](_[_0xa934('0x66')](_0x5b606a[_0xa934('0x40')],_0x50ddae[_0xa934('0x42')]));_0x47a315['where']['SmsAccountId']=_0x5aa5bc['id'];if(_0x5b606a[_0xa934('0x40')][_0xa934('0x4c')]){_0x47a315[_0xa934('0x4b')]=_['merge'](_0x47a315[_0xa934('0x4b')],{'$or':_['map'](_0x47a315[_0xa934('0x44')],function(_0x6d4300){var _0x38fb68={};_0x38fb68[_0x6d4300]={'$like':'%'+_0x5b606a['query'][_0xa934('0x4c')]+'%'};return _0x38fb68;})});}_0x47a315=_[_0xa934('0x4e')]({},_0x47a315,_0x5b606a[_0xa934('0x57')]);return db['Disposition'][_0xa934('0x2e')]({'where':_0x47a315['where']})[_0xa934('0x1f')](function(_0x2ab1e){_0x205bd6[_0xa934('0x2e')]=_0x2ab1e;if(_0x5b606a[_0xa934('0x40')][_0xa934('0x50')]){_0x47a315['include']=[{'all':!![]}];}return db[_0xa934('0x63')][_0xa934('0x52')](_0x47a315);})[_0xa934('0x1f')](function(_0x3acc51){_0x205bd6['rows']=_0x3acc51;return _0x205bd6;});}})[_0xa934('0x1f')](respondWithFilteredResult(_0x345e6e,_0x47a315))[_0xa934('0x28')](handleError(_0x345e6e,null));};exports['removeDispositions']=function(_0x4d29b9,_0x1bc948,_0x9cce78){return db[_0xa934('0x4f')][_0xa934('0x58')]({'where':{'id':_0x4d29b9[_0xa934('0x55')]['id']}})[_0xa934('0x1f')](handleEntityNotFound(_0x1bc948,null))[_0xa934('0x1f')](function(_0x58e2b8){if(_0x58e2b8){return _0x58e2b8[_0xa934('0x67')](_0x4d29b9[_0xa934('0x40')][_0xa934('0x68')]);}})[_0xa934('0x1f')](respondWithStatusCode(_0x1bc948,null))[_0xa934('0x28')](handleError(_0x1bc948,null));};exports['addAnswer']=function(_0x124df4,_0x307521,_0x50877f){if(_0x124df4[_0xa934('0x5a')]['id']){delete _0x124df4[_0xa934('0x5a')]['id'];}return db[_0xa934('0x4f')][_0xa934('0x58')]({'where':{'id':_0x124df4[_0xa934('0x55')]['id']}})[_0xa934('0x1f')](handleEntityNotFound(_0x307521,null))[_0xa934('0x1f')](function(_0x537c19){if(_0x537c19){_0x124df4[_0xa934('0x5a')][_0xa934('0x62')]=_0x537c19['id'];return db[_0xa934('0x69')]['create'](_0x124df4[_0xa934('0x5a')]);}})[_0xa934('0x1f')](respondWithResult(_0x307521,null))[_0xa934('0x28')](handleError(_0x307521,null));};exports['getAnswers']=function(_0x266c58,_0x14768b,_0x36daa3){var _0xb44d22={'raw':![],'where':{}};var _0x4c420d={};var _0xca816f={'count':0x0,'rows':[]};return db[_0xa934('0x4f')][_0xa934('0x65')]({'where':{'id':_0x266c58[_0xa934('0x55')]['id']}})['then'](handleEntityNotFound(_0x14768b,null))['then'](function(_0x23278d){if(_0x23278d){_0x4c420d[_0xa934('0x3f')]=_[_0xa934('0x41')](db[_0xa934('0x69')][_0xa934('0x3c')]);_0x4c420d[_0xa934('0x40')]=_['keys'](_0x266c58[_0xa934('0x40')]);_0x4c420d[_0xa934('0x42')]=_[_0xa934('0x43')](_0x4c420d['model'],_0x4c420d[_0xa934('0x40')]);_0xb44d22[_0xa934('0x44')]=_['intersection'](_0x4c420d[_0xa934('0x3f')],qs[_0xa934('0x45')](_0x266c58[_0xa934('0x40')][_0xa934('0x45')]));_0xb44d22[_0xa934('0x44')]=_0xb44d22['attributes']['length']?_0xb44d22[_0xa934('0x44')]:_0x4c420d[_0xa934('0x3f')];if(!_0x266c58[_0xa934('0x40')][_0xa934('0x47')](_0xa934('0x48'))){_0xb44d22[_0xa934('0x2d')]=qs[_0xa934('0x2d')](_0x266c58['query'][_0xa934('0x2d')]);_0xb44d22[_0xa934('0x2c')]=qs['offset'](_0x266c58[_0xa934('0x40')][_0xa934('0x2c')]);}_0xb44d22[_0xa934('0x49')]=qs[_0xa934('0x4a')](_0x266c58[_0xa934('0x40')][_0xa934('0x4a')]);_0xb44d22['where']=qs[_0xa934('0x42')](_[_0xa934('0x66')](_0x266c58[_0xa934('0x40')],_0x4c420d['filters']));_0xb44d22[_0xa934('0x4b')]['SmsAccountId']=_0x23278d['id'];if(_0x266c58[_0xa934('0x40')]['filter']){_0xb44d22[_0xa934('0x4b')]=_[_0xa934('0x4e')](_0xb44d22[_0xa934('0x4b')],{'$or':_['map'](_0xb44d22[_0xa934('0x44')],function(_0x26e842){var _0x449db3={};_0x449db3[_0x26e842]={'$like':'%'+_0x266c58[_0xa934('0x40')][_0xa934('0x4c')]+'%'};return _0x449db3;})});}_0xb44d22=_[_0xa934('0x4e')]({},_0xb44d22,_0x266c58[_0xa934('0x57')]);return db[_0xa934('0x69')][_0xa934('0x2e')]({'where':_0xb44d22[_0xa934('0x4b')]})['then'](function(_0x24080f){_0xca816f['count']=_0x24080f;if(_0x266c58[_0xa934('0x40')][_0xa934('0x50')]){_0xb44d22[_0xa934('0x51')]=[{'all':!![]}];}return db[_0xa934('0x69')][_0xa934('0x52')](_0xb44d22);})[_0xa934('0x1f')](function(_0x5599f5){_0xca816f['rows']=_0x5599f5;return _0xca816f;});}})[_0xa934('0x1f')](respondWithFilteredResult(_0x14768b,_0xb44d22))['catch'](handleError(_0x14768b,null));};exports[_0xa934('0x6a')]=function(_0x3f1343,_0x3b6f75,_0x478914){return db['SmsAccount']['find']({'where':{'id':_0x3f1343[_0xa934('0x55')]['id']}})[_0xa934('0x1f')](handleEntityNotFound(_0x3b6f75,null))['then'](function(_0x257f47){if(_0x257f47){return _0x257f47['removeAnswers'](_0x3f1343[_0xa934('0x40')]['ids']);}})['then'](respondWithStatusCode(_0x3b6f75,null))[_0xa934('0x28')](handleError(_0x3b6f75,null));};exports[_0xa934('0x6b')]=function(_0x586f37,_0x223d92,_0x1747c2){var _0x1ddbea={'channel':'sms'};var _0x5703ba=[];var _0xd1f4a=[];var _0x29b2f0={};return db[_0xa934('0x4f')][_0xa934('0x58')]({'where':{'id':_0x586f37[_0xa934('0x55')]['id']},'include':[{'model':db[_0xa934('0x6c')],'as':_0xa934('0x6d')}]})[_0xa934('0x1f')](handleEntityNotFound(_0x223d92,null))[_0xa934('0x1f')](function(_0x441064){_0x1ddbea['account']=_0x441064;_0x1ddbea[_0xa934('0x6e')]=_['orderBy'](_0x441064['Applications'],[_0xa934('0x6f')],[_0xa934('0x70')]);if(_0x1ddbea[_0xa934('0x71')][_0xa934('0x6d')]){delete _0x1ddbea[_0xa934('0x71')][_0xa934('0x6d')];}return db[_0xa934('0x72')][_0xa934('0x60')]();})[_0xa934('0x1f')](function(_0x1c4dc4){if(!_0x1c4dc4){throw new db['Sequelize'][(_0xa934('0x73'))](_0xa934('0x74'));}_0x5703ba=_[_0xa934('0x75')](_[_0xa934('0x41')](_0x1c4dc4),[_0xa934('0x76'),_0xa934('0x77')]);_0xd1f4a=_[_0xa934('0x75')](_['keys'](_0x1c4dc4),[_0xa934('0x76'),_0xa934('0x77'),_0xa934('0x78'),_0xa934('0x79')]);_0x1ddbea['body']={'mapKey':_0xa934('0x7a')};if(_0x1ddbea['account']['type']){switch(_0x1ddbea['account']['type']){case _0xa934('0x7b'):_0x1ddbea[_0xa934('0x5a')][_0xa934('0x7c')]=_0x586f37[_0xa934('0x5a')]['From'];_0x1ddbea[_0xa934('0x5a')]['body']=_0x586f37[_0xa934('0x5a')][_0xa934('0x7d')];_0x1ddbea[_0xa934('0x5a')][_0xa934('0x7e')]=_0x586f37[_0xa934('0x5a')][_0xa934('0x7f')];break;case _0xa934('0x80'):_0x1ddbea[_0xa934('0x5a')][_0xa934('0x7c')]='+'+_0x586f37[_0xa934('0x5a')][_0xa934('0x81')];_0x1ddbea['body'][_0xa934('0x5a')]=_0x586f37[_0xa934('0x5a')][_0xa934('0x82')];break;case _0xa934('0x83'):_0x1ddbea['body'][_0xa934('0x7c')]=_0x586f37[_0xa934('0x5a')][_0xa934('0x7c')];_0x1ddbea[_0xa934('0x5a')]['body']=_0x586f37['body'][_0xa934('0x27')];break;case _0xa934('0x84'):_0x1ddbea[_0xa934('0x5a')][_0xa934('0x7c')]=_0x586f37[_0xa934('0x5a')]['from'];_0x1ddbea[_0xa934('0x5a')][_0xa934('0x5a')]=_0x586f37[_0xa934('0x5a')]['body'];_0x1ddbea[_0xa934('0x5a')][_0xa934('0x7e')]=_0x586f37[_0xa934('0x5a')][_0xa934('0x85')];break;case _0xa934('0x86'):_0x1ddbea['body'][_0xa934('0x7c')]=_0x586f37[_0xa934('0x5a')]['From'];_0x1ddbea[_0xa934('0x5a')]['body']=_0x586f37[_0xa934('0x5a')][_0xa934('0x87')];_0x1ddbea[_0xa934('0x5a')][_0xa934('0x7e')]=_0x586f37[_0xa934('0x5a')][_0xa934('0x88')];break;case'infobip':_0x1ddbea['body'][_0xa934('0x7c')]='+'+_0x586f37[_0xa934('0x5a')][_0xa934('0x89')][0x0]['from'];_0x1ddbea[_0xa934('0x5a')][_0xa934('0x5a')]=_0x586f37[_0xa934('0x5a')][_0xa934('0x89')][0x0][_0xa934('0x82')];_0x1ddbea[_0xa934('0x5a')][_0xa934('0x7e')]=_0x586f37['body']['results'][0x0]['messageId'];break;case'csc':_0x1ddbea['body'][_0xa934('0x7c')]=_0x586f37['body'][_0xa934('0x8a')];_0x1ddbea['body'][_0xa934('0x5a')]=_0x586f37[_0xa934('0x5a')][_0xa934('0x8b')][_0xa934('0x27')];break;case'clickatell':_0x1ddbea[_0xa934('0x5a')]['from']=_0x586f37[_0xa934('0x5a')]['fromNumber'];_0x1ddbea['body'][_0xa934('0x5a')]=_0x586f37[_0xa934('0x5a')]['text'];_0x1ddbea['body'][_0xa934('0x7e')]=_0x586f37[_0xa934('0x5a')][_0xa934('0x8c')];break;case _0xa934('0x8d'):_0x1ddbea['body']['messageId']=_0x586f37[_0xa934('0x5a')][0x0]['message']['id'];_0x1ddbea['body'][_0xa934('0x7c')]=_0x586f37['body'][0x0][_0xa934('0x27')][_0xa934('0x7c')];_0x1ddbea['body'][_0xa934('0x5a')]=_0x586f37[_0xa934('0x5a')][0x0][_0xa934('0x27')][_0xa934('0x82')];break;case _0xa934('0x8e'):_0x1ddbea[_0xa934('0x5a')]['from']=_0x586f37[_0xa934('0x5a')][_0xa934('0x7c')];_0x1ddbea[_0xa934('0x5a')][_0xa934('0x5a')]=_0x586f37[_0xa934('0x5a')]['message'];_0x1ddbea[_0xa934('0x5a')][_0xa934('0x7e')]=_0x586f37[_0xa934('0x5a')][_0xa934('0x8f')];break;}}if(_0x1ddbea[_0xa934('0x5a')]['id']){delete _0x1ddbea[_0xa934('0x5a')]['id'];}if(_[_0xa934('0x90')](_0x1ddbea[_0xa934('0x5a')]['from'])){throw new db[(_0xa934('0x91'))][(_0xa934('0x73'))](_0xa934('0x92'));}if(_[_0xa934('0x90')](_0x1ddbea[_0xa934('0x5a')]['body'])||_0x1ddbea[_0xa934('0x5a')][_0xa934('0x5a')]===''){throw new db[(_0xa934('0x91'))]['ValidationError'](_0xa934('0x93'));}if(_[_0xa934('0x90')](_0x1ddbea['body'][_0xa934('0x94')])){throw new db[(_0xa934('0x91'))][(_0xa934('0x73'))](_0xa934('0x95')+_0xd1f4a);}if(!_[_0xa934('0x96')](_0xd1f4a,_0x1ddbea[_0xa934('0x5a')]['mapKey'])){throw new db[(_0xa934('0x91'))]['ValidationError'](_0xa934('0x97')+_0xd1f4a);}_0x29b2f0[_0x1ddbea['body']['mapKey']]=_0x1ddbea[_0xa934('0x5a')][_0xa934('0x7c')];return db[_0xa934('0x98')][_0xa934('0x58')]({'where':{'id':_0x1ddbea[_0xa934('0x71')]['ListId']},'include':[{'model':db[_0xa934('0x72')],'as':_0xa934('0x99'),'where':_0x29b2f0,'limit':0x1,'order':[['updatedAt',_0xa934('0x9a')]]}]});})['then'](handleEntityNotFound(_0x223d92,null))['then'](function(_0x4f753d){if(_0x4f753d){_0x1ddbea[_0xa934('0x9b')]=_[_0xa934('0x9c')](_0x4f753d,[_0xa934('0x99')]);if(_0x4f753d[_0xa934('0x99')]['length']){return _0x4f753d[_0xa934('0x99')][0x0];}var _0x54748f=_[_0xa934('0x18')](_0x1ddbea[_0xa934('0x5a')],{'firstName':_0x1ddbea['body'][_0xa934('0x7c')],'ListId':_0x4f753d['id']});_0x54748f[_0x1ddbea[_0xa934('0x5a')][_0xa934('0x94')]]=_0x1ddbea[_0xa934('0x5a')][_0xa934('0x7c')];return db[_0xa934('0x72')][_0xa934('0x59')](_0x54748f,{'fields':_0x5703ba,'raw':!![]});}})[_0xa934('0x1f')](handleEntityNotFound(_0x223d92,null))[_0xa934('0x1f')](function(_0x44169c){if(_0x44169c){_0x1ddbea[_0xa934('0x9d')]=_0x44169c;var _0x1c998f={'ContactId':_0x44169c['id'],'phone':_0x1ddbea[_0xa934('0x5a')]['from'],'SmsAccountId':_0x586f37[_0xa934('0x55')]['id']};var _0x2eb554={'ContactId':_0x44169c['id'],'SmsAccountId':_0x586f37['params']['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x2eb554})[_0xa934('0x1f')](function(_0x1fcf54){if(_0x1fcf54){return[_0x1fcf54,![]];}return db[_0xa934('0x9e')][_0xa934('0x59')](_0x1c998f)[_0xa934('0x1f')](function(_0x8ddcb0){return[_0x8ddcb0,!![]];});});}})[_0xa934('0x9f')](function(_0x484520,_0x398f29){_0x1ddbea[_0xa934('0xa0')]=_0x484520['get']({'plain':!![]});_0x1ddbea['interaction']['created']=![];if(_0x398f29){if(_0x1ddbea[_0xa934('0x71')][_0xa934('0xa1')]){_0x1ddbea['applications'][_0xa934('0xa2')]({'id':0x0,'priority':_0x1ddbea[_0xa934('0x6e')][_0xa934('0x46')]+0x1,'app':_0xa934('0xa3'),'appdata':_0xa934('0xa4'),'interval':_0xa934('0xa5')});}_0x1ddbea[_0xa934('0xa0')]['created']=!![];}return db[_0xa934('0xa6')]['create']({'phone':_0x1ddbea[_0xa934('0x5a')][_0xa934('0x7c')],'messageId':_0x1ddbea['body'][_0xa934('0x7e')],'body':_0x1ddbea[_0xa934('0x5a')][_0xa934('0x5a')],'SmsAccountId':_0x586f37[_0xa934('0x55')]['id'],'SmsInteractionId':_0x484520['id'],'direction':'in','ContactId':_0x484520['ContactId'],'AttachmentId':_0x1ddbea[_0xa934('0x5a')][_0xa934('0xa7')]});})[_0xa934('0x1f')](function(_0x2c9452){_0x1ddbea[_0xa934('0x27')]=_0x2c9452;if(_0x1ddbea[_0xa934('0xa0')]['UserId']){return db[_0xa934('0xa8')][_0xa934('0x58')]({'attributes':['id',_0xa934('0x37')],'where':{'id':_0x1ddbea[_0xa934('0xa0')]['UserId']}})[_0xa934('0x1f')](function(_0x5fa6c){if(_0x5fa6c){_0x1ddbea['applications'][_0xa934('0xa9')]({'id':0x0,'priority':0x0,'app':_0xa934('0xaa'),'appdata':_0x5fa6c[_0xa934('0x37')]+','+(_0x1ddbea[_0xa934('0x71')][_0xa934('0xab')]||0xa),'interval':_0xa934('0xa5')});}return respondWithRpcPromise('Start',_0xa934('0xac'),_0x1ddbea);});}return respondWithRpcPromise('Start',_0xa934('0xac'),_0x1ddbea);})[_0xa934('0x1f')](function(_0x53d1b9){if(_0x53d1b9){var _0x5ead08=0xc8;var _0x7b851f=_0xa934('0xad');logger[_0xa934('0x20')](_0xa934('0x22'),_0x7b851f,_0x5ead08,'entity\x20found');logger[_0xa934('0xae')](_0xa934('0xaf'),_0x7b851f,_0x5ead08,'entity\x20found',JSON['stringify'](_0x53d1b9));if(_0x1ddbea[_0xa934('0x71')][_0xa934('0x3d')]===_0xa934('0x7b')){return _0x223d92[_0xa934('0x29')](_0x5ead08)[_0xa934('0xb0')](_0xa934('0xb1'),_0xa934('0xb2'))[_0xa934('0x38')](_0xa934('0xb3'));}else{return _0x223d92['status'](_0x5ead08)[_0xa934('0x2b')](_0x53d1b9);}}})[_0xa934('0x28')](handleError(_0x223d92,null));};exports[_0xa934('0xb4')]=function(_0x47987b,_0x4c9016){var _0x3e134a=_0x47987b[_0xa934('0x55')]['id'];var _0x33810c=_0x47987b[_0xa934('0x5a')];var _0x311415=0xc8;var _0x2e1703=null;return db['sequelize'][_0xa934('0xb5')]({'isolationLevel':db[_0xa934('0xb6')][_0xa934('0xb7')][_0xa934('0xb8')][_0xa934('0xb9')]},function(_0x38d531){return db[_0xa934('0x4f')]['findOne']({'where':{'id':_0x3e134a},'transaction':_0x38d531})[_0xa934('0x1f')](function(_0x2afa94){if(_0x2afa94){return db[_0xa934('0x6c')][_0xa934('0x32')]({'where':{'SmsAccountId':_0x3e134a},'transaction':_0x38d531})[_0xa934('0x1f')](function(){var _0x3a2ca8=_['map'](_0x33810c,function(_0x1c1fcb){_0x1c1fcb[_0xa934('0x62')]=_0x3e134a;return _0x1c1fcb;});return db[_0xa934('0x6c')]['bulkCreate'](_0x3a2ca8,{'transaction':_0x38d531});});}else{_0x311415=0x194;_0x2e1703=[];}});})[_0xa934('0x1f')](function(){if(_0x311415!==0x194){return db['SmsApplication'][_0xa934('0xba')]({'where':{'SmsAccountId':_0x3e134a},'order':_0xa934('0x6f')})[_0xa934('0x1f')](function(_0x2d8312){_0x2e1703=_0x2d8312;});}})[_0xa934('0x28')](function(_0x22bd54){_0x311415=0x1f4;logger['error'](_0x22bd54[_0xa934('0x36')]);if(_0x22bd54[_0xa934('0x37')]){delete _0x22bd54[_0xa934('0x37')];}_0x2e1703=_0x22bd54;})['finally'](function(){if(_0x2e1703===null){_0x4c9016[_0xa934('0x35')](_0x311415);}else{if(_0x311415===0x1f4){_0x4c9016['status'](_0x311415)[_0xa934('0x38')](_0x2e1703);}else{_0x4c9016['status'](_0x311415)[_0xa934('0x2b')](_0x2e1703);}}});};exports['getApplications']=function(_0x53a2b1,_0x2b0465,_0x1765e0){var _0x55b587={};var _0x49e32f={};var _0x5782f2;var _0x350b26;return db['SmsAccount']['findOne']({'where':{'id':_0x53a2b1[_0xa934('0x55')]['id']}})['then'](handleEntityNotFound(_0x2b0465,null))[_0xa934('0x1f')](function(_0x2619a8){if(_0x2619a8){_0x5782f2=_0x2619a8;_0x49e32f[_0xa934('0x3f')]=_[_0xa934('0x41')](db[_0xa934('0x6c')][_0xa934('0x3c')]);_0x49e32f[_0xa934('0x40')]=_[_0xa934('0x41')](_0x53a2b1[_0xa934('0x40')]);_0x49e32f[_0xa934('0x42')]=_[_0xa934('0x43')](_0x49e32f[_0xa934('0x3f')],_0x49e32f['query']);_0x55b587[_0xa934('0x44')]=_[_0xa934('0x43')](_0x49e32f[_0xa934('0x3f')],qs[_0xa934('0x45')](_0x53a2b1[_0xa934('0x40')][_0xa934('0x45')]));_0x55b587['attributes']=_0x55b587[_0xa934('0x44')][_0xa934('0x46')]?_0x55b587[_0xa934('0x44')]:_0x49e32f[_0xa934('0x3f')];_0x55b587[_0xa934('0x49')]=qs[_0xa934('0x4a')](_0x53a2b1[_0xa934('0x40')][_0xa934('0x4a')]);_0x55b587[_0xa934('0x4b')]=qs[_0xa934('0x42')](_[_0xa934('0x66')](_0x53a2b1['query'],_0x49e32f[_0xa934('0x42')]));if(_0x53a2b1[_0xa934('0x40')][_0xa934('0x4c')]){_0x55b587['where']=_[_0xa934('0x4e')](_0x55b587[_0xa934('0x4b')],{'$or':_[_0xa934('0x3b')](_0x55b587['attributes'],function(_0x37de1c){var _0xc011e2={};_0xc011e2[_0x37de1c]={'$like':'%'+_0x53a2b1[_0xa934('0x40')][_0xa934('0x4c')]+'%'};return _0xc011e2;})});}_0x55b587=_[_0xa934('0x4e')]({},_0x55b587,_0x53a2b1['options']);return _0x5782f2['getApplications'](_0x55b587);}})[_0xa934('0x1f')](function(_0x3f0226){if(_0x3f0226){_0x350b26=_0x3f0226[_0xa934('0x46')];if(!_0x53a2b1[_0xa934('0x40')][_0xa934('0x47')](_0xa934('0x48'))){_0x55b587[_0xa934('0x2d')]=qs[_0xa934('0x2d')](_0x53a2b1[_0xa934('0x40')][_0xa934('0x2d')]);_0x55b587['offset']=qs[_0xa934('0x2c')](_0x53a2b1['query'][_0xa934('0x2c')]);}return _0x5782f2[_0xa934('0xbb')](_0x55b587);}})[_0xa934('0x1f')](function(_0x46458d){if(_0x46458d){return _0x46458d?{'count':_0x350b26,'rows':_0x46458d}:null;}})[_0xa934('0x1f')](respondWithResult(_0x2b0465,null))['catch'](handleError(_0x2b0465,null));};exports['getInteractions']=function(_0x49538d,_0x360a22,_0x511b7f){var _0x1707a3={'raw':![],'where':{}};var _0x43162e={};var _0x19b0a5={'count':0x0,'rows':[]};return db['SmsAccount'][_0xa934('0x65')]({'where':{'id':_0x49538d[_0xa934('0x55')]['id']}})[_0xa934('0x1f')](handleEntityNotFound(_0x360a22,null))[_0xa934('0x1f')](function(_0x5d47ab){if(_0x5d47ab){_0x43162e['model']=_[_0xa934('0x41')](db[_0xa934('0x9e')][_0xa934('0x3c')]);_0x43162e[_0xa934('0x40')]=_[_0xa934('0x41')](_0x49538d[_0xa934('0x40')]);_0x43162e[_0xa934('0x42')]=_['intersection'](_0x43162e[_0xa934('0x3f')],_0x43162e[_0xa934('0x40')]);_0x1707a3[_0xa934('0x44')]=_[_0xa934('0x43')](_0x43162e['model'],qs[_0xa934('0x45')](_0x49538d['query']['fields']));_0x1707a3[_0xa934('0x44')]=_0x1707a3[_0xa934('0x44')][_0xa934('0x46')]?_0x1707a3[_0xa934('0x44')]:_0x43162e[_0xa934('0x3f')];if(!_0x49538d[_0xa934('0x40')][_0xa934('0x47')](_0xa934('0x48'))){_0x1707a3[_0xa934('0x2d')]=qs[_0xa934('0x2d')](_0x49538d[_0xa934('0x40')][_0xa934('0x2d')]);_0x1707a3[_0xa934('0x2c')]=qs['offset'](_0x49538d[_0xa934('0x40')]['offset']);}_0x1707a3[_0xa934('0x49')]=qs[_0xa934('0x4a')](_0x49538d[_0xa934('0x40')][_0xa934('0x4a')]);_0x1707a3[_0xa934('0x4b')]=qs[_0xa934('0x42')](_['pick'](_0x49538d[_0xa934('0x40')],_0x43162e[_0xa934('0x42')]));_0x1707a3[_0xa934('0x4b')][_0xa934('0x62')]=_0x5d47ab['id'];if(_0x49538d[_0xa934('0x40')]['filter']){_0x1707a3[_0xa934('0x4b')]=_[_0xa934('0x4e')](_0x1707a3['where'],{'$or':_[_0xa934('0x3b')](_0x1707a3[_0xa934('0x44')],function(_0x2fc552){var _0x4060ca={};_0x4060ca[_0x2fc552]={'$like':'%'+_0x49538d[_0xa934('0x40')][_0xa934('0x4c')]+'%'};return _0x4060ca;})});}_0x1707a3=_[_0xa934('0x4e')]({},_0x1707a3,_0x49538d[_0xa934('0x57')]);return db[_0xa934('0x9e')]['count']({'where':_0x1707a3[_0xa934('0x4b')]})[_0xa934('0x1f')](function(_0x33f813){_0x19b0a5['count']=_0x33f813;if(_0x49538d[_0xa934('0x40')][_0xa934('0x50')]){_0x1707a3[_0xa934('0x51')]=[{'model':db[_0xa934('0x72')],'as':_0xa934('0xbc'),'required':![]},{'model':db['User'],'as':_0xa934('0xbd'),'attributes':[_0xa934('0x37'),_0xa934('0xbe'),'internal'],'required':![]},{'model':db[_0xa934('0xbf')],'as':_0xa934('0xc0'),'attributes':['id',_0xa934('0x37'),_0xa934('0xc1')],'where':_0x49538d[_0xa934('0x40')]['tag']?{'id':_0x49538d['query'][_0xa934('0xc2')]}:undefined,'required':_0x49538d[_0xa934('0x40')][_0xa934('0xc2')]?!![]:![]}];}return db[_0xa934('0x9e')][_0xa934('0x52')](_0x1707a3);})[_0xa934('0x1f')](function(_0x249ee1){_0x19b0a5[_0xa934('0x53')]=_0x249ee1;return _0x19b0a5;});}})[_0xa934('0x1f')](respondWithFilteredResult(_0x360a22,_0x1707a3))['catch'](handleError(_0x360a22,null));};exports['send']=function(_0x38a454,_0x3757a9,_0x4b0854){var _0x3a17c9,_0x379963,_0x19c7d0;if(_[_0xa934('0x90')](_0x38a454[_0xa934('0x5a')]['body'])||_0x38a454[_0xa934('0x5a')][_0xa934('0x5a')]===''){throw new db[(_0xa934('0x91'))]['ValidationError'](_0xa934('0x93'));}if(_[_0xa934('0x90')](_0x38a454[_0xa934('0x5a')]['to'])){throw new db[(_0xa934('0x91'))][(_0xa934('0x73'))](_0xa934('0xc3'));}_0x3a17c9=_0x38a454['body']['to'];return db[_0xa934('0x4f')][_0xa934('0x58')]({'where':{'id':_0x38a454[_0xa934('0x55')]['id']},'include':[{'model':db[_0xa934('0x98')],'as':_0xa934('0xc4'),'include':[{'model':db[_0xa934('0x72')],'as':_0xa934('0x99'),'where':{'mobile':_0x3a17c9},'limit':0x1,'order':[[_0xa934('0x77'),_0xa934('0x9a')]]}]}]})[_0xa934('0x1f')](handleEntityNotFound(_0x3757a9,null))[_0xa934('0x1f')](function(_0x13d83b){if(_0x13d83b&&_0x13d83b['List']){_0x379963=_0x13d83b[_0xa934('0x5b')]({'plain':!![]});if(_0x379963[_0xa934('0xc4')]&&_0x379963['List'][_0xa934('0x99')][_0xa934('0x46')]){return _0x379963[_0xa934('0xc4')][_0xa934('0x99')][0x0];}return db['CmContact'][_0xa934('0x59')](_['defaults'](_0x38a454[_0xa934('0x5a')],{'firstName':_0x3a17c9,'mobile':_0x3a17c9,'phone':_0x3a17c9,'ListId':_0x379963[_0xa934('0x79')]}));}})[_0xa934('0x1f')](handleEntityNotFound(_0x3757a9,null))[_0xa934('0x1f')](function(_0x8a0237){if(_0x8a0237){_0x19c7d0=_0x8a0237;return db[_0xa934('0x9e')]['find']({'where':{'ContactId':_0x19c7d0['id'],'closed':![],'SmsAccountId':_0x379963['id']}})['then'](function(_0x110d83){if(_0x110d83){return[_0x110d83,![]];}return db[_0xa934('0x9e')][_0xa934('0x59')]({'UserId':_0x38a454['user']['id'],'ContactId':_0x19c7d0['id'],'SmsAccountId':_0x379963['id'],'phone':_0x3a17c9,'firstMsgDirection':_0xa934('0xc5'),'Messages':[_['merge'](_0x38a454[_0xa934('0x5a')],{'read':![],'body':_0x38a454[_0xa934('0x5a')][_0xa934('0x5a')],'phone':_0x3a17c9,'SmsAccountId':_0x379963['id'],'UserId':_0x38a454[_0xa934('0xc6')]['id'],'ContactId':_0x19c7d0['id']})]},{'include':[{'model':db[_0xa934('0xa6')],'as':_0xa934('0xc7')}]})[_0xa934('0x1f')](function(_0x4f6f0c){return[_0x4f6f0c,!![]];});});}})[_0xa934('0x9f')](function(_0x808826,_0x34c2e8){if(_0x34c2e8){return _0x808826;}return db[_0xa934('0xa6')]['create'](_[_0xa934('0x4e')](_0x38a454['body'],{'read':![],'body':_0x38a454['body'][_0xa934('0x5a')],'phone':_0x3a17c9,'SmsAccountId':_0x379963['id'],'SmsInteractionId':_0x808826['id'],'UserId':_0x38a454[_0xa934('0xc6')]['id'],'ContactId':_0x19c7d0['id']}))[_0xa934('0x1f')](function(_0xacd48b){_0x808826['dataValues']['Messages']=[];_0x808826[_0xa934('0xc8')][_0xa934('0xc7')][_0xa934('0xa2')](_0xacd48b[_0xa934('0xc8')]);return _0x808826;});})[_0xa934('0x1f')](respondWithResult(_0x3757a9,null))['catch'](handleError(_0x3757a9,null));};exports['status']=function(_0x203ebc,_0x3a1043,_0x1a4e25){if(_0x203ebc[_0xa934('0x5a')]['id']){delete _0x203ebc[_0xa934('0x5a')]['id'];}var _0x41de05,_0x19d0fe,_0x2bdb8f;return db[_0xa934('0x4f')][_0xa934('0x58')]({'where':{'id':_0x203ebc['params']['id']}})[_0xa934('0x1f')](handleEntityNotFound(_0x3a1043,null))[_0xa934('0x1f')](function(_0x33bb00){if(_0x33bb00){_0x2bdb8f=_0x33bb00;logger[_0xa934('0xae')](_0xa934('0x22'),'status',_0xa934('0xc9'),_0x33bb00[_0xa934('0x3d')],util[_0xa934('0xca')](_0x203ebc['body'],{'showHidden':![],'depth':null}));switch(_0x33bb00[_0xa934('0x3d')]){case'skebby':if(_0x203ebc['body'][_0xa934('0xcb')]&&_0x203ebc['body'][_0xa934('0x29')]){_0x19d0fe=_0x203ebc[_0xa934('0x5a')][_0xa934('0x29')];return db[_0xa934('0xa6')][_0xa934('0x58')]({'where':{'messageId':_0x203ebc[_0xa934('0x5a')]['skebby_dispatch_id']}});}break;case _0xa934('0x83'):if(_0x203ebc[_0xa934('0x5a')][_0xa934('0xcc')]&&_0x203ebc[_0xa934('0x5a')][_0xa934('0xcd')]){_0x19d0fe=_0x203ebc['body'][_0xa934('0xcd')];return db[_0xa934('0xa6')][_0xa934('0x58')]({'where':{'messageId':_0x203ebc[_0xa934('0x5a')][_0xa934('0xcc')]}});}break;case _0xa934('0x84'):if(_0x203ebc[_0xa934('0x5a')][_0xa934('0x85')]&&_0x203ebc[_0xa934('0x5a')][_0xa934('0xce')]){_0x19d0fe=_0x203ebc[_0xa934('0x5a')]['status_code'];return db[_0xa934('0xa6')][_0xa934('0x58')]({'where':{'messageId':_0x203ebc[_0xa934('0x5a')][_0xa934('0x85')]}});}break;case _0xa934('0xcf'):var _0x4dc1ed=_0x203ebc[_0xa934('0x5a')][_0xa934('0x89')][0x0];if(_0x4dc1ed[_0xa934('0x7e')]&&_0x4dc1ed[_0xa934('0x29')][_0xa934('0xd0')]==='DELIVERED'){_0x19d0fe=_0x4dc1ed[_0xa934('0x29')][_0xa934('0xd0')];return db[_0xa934('0xa6')]['find']({'where':{'messageId':_0x4dc1ed[_0xa934('0x7e')]}});}break;case _0xa934('0xd1'):if(_0x203ebc['body'][_0xa934('0x7e')]&&_0x203ebc[_0xa934('0x5a')]['status']){_0x19d0fe=_0x203ebc[_0xa934('0x5a')]['status'];return db[_0xa934('0xa6')][_0xa934('0x58')]({'where':{'messageId':_0x203ebc[_0xa934('0x5a')]['messageId']}});}break;case _0xa934('0x8d'):if(_0x203ebc[_0xa934('0x5a')][0x0][_0xa934('0x27')]['id']){_0x19d0fe=_0x203ebc['body'][0x0][_0xa934('0x3d')];return db[_0xa934('0xa6')][_0xa934('0x58')]({'where':{'messageId':_0x203ebc[_0xa934('0x5a')][0x0][_0xa934('0x27')]['id']}});}break;case _0xa934('0x8e'):if(_0x203ebc[_0xa934('0x5a')][_0xa934('0xd2')]&&_0x203ebc[_0xa934('0x5a')][_0xa934('0x29')]){_0x19d0fe=_0x203ebc['body'][_0xa934('0x29')];return db[_0xa934('0xa6')][_0xa934('0x58')]({'where':{'messageId':_0x203ebc['body']['redif']}});}break;}}})[_0xa934('0x1f')](handleEntityNotFound(_0x3a1043,null))[_0xa934('0x1f')](function(_0x5e394c){if(_0x5e394c){_0x41de05=_0x5e394c;switch(_0x2bdb8f[_0xa934('0x3d')]){case _0xa934('0x80'):if(_0x19d0fe===_0xa934('0xd3')){return _0x41de05[_0xa934('0x31')]({'read':!![]});}else{logger[_0xa934('0x25')](_0xa934('0x22'),_0xa934('0x29'),_0xa934('0x80'),util['inspect'](_0x203ebc[_0xa934('0x5a')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x19d0fe==='1'){return _0x41de05['update']({'read':!![]});}else{logger[_0xa934('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa934('0x29'),_0xa934('0x80'),util[_0xa934('0xca')](_0x203ebc[_0xa934('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xa934('0x84'):if(!_0x203ebc['body'][_0xa934('0xd4')]&&_0x19d0fe>=0xc8&&_0x19d0fe<=0xce){return _0x41de05['update']({'read':!![]});}else{logger[_0xa934('0x25')](_0xa934('0x22'),'status',_0xa934('0x84'),util[_0xa934('0xca')](_0x203ebc['body'],{'showHidden':![],'depth':null}));}break;case _0xa934('0xcf'):var _0x1906d5=_0x203ebc['body'][_0xa934('0x89')][0x0];if(_0x1906d5['status'][_0xa934('0xd0')]===_0xa934('0xd3')){return _0x41de05[_0xa934('0x31')]({'read':!![]});}else{logger[_0xa934('0x25')](_0xa934('0x22'),'status',_0xa934('0xcf'),util[_0xa934('0xca')](_0x203ebc[_0xa934('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xa934('0xd1'):if(_0x19d0fe==_0xa934('0xd5')||_0x19d0fe=='RECEIVED_BY_RECIPIENT'){return _0x41de05[_0xa934('0x31')]({'read':!![]});}else{logger[_0xa934('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa934('0x29'),_0xa934('0xd1'),util[_0xa934('0xca')](_0x203ebc['body'],{'showHidden':![],'depth':null}));}break;case _0xa934('0x8d'):if(_0x19d0fe==_0xa934('0xd6')){return _0x41de05[_0xa934('0x31')]({'read':!![]});}else{logger[_0xa934('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xa934('0x8d'),util[_0xa934('0xca')](_0x203ebc[_0xa934('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xa934('0x8e'):if(_0x19d0fe===_0xa934('0xd7')||_0x19d0fe===_0xa934('0xd8')){return _0x41de05[_0xa934('0x31')]({'read':!![]});}else{logger[_0xa934('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa934('0x29'),'intelepeer',util[_0xa934('0xca')](_0x203ebc[_0xa934('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x41de05;}})[_0xa934('0x1f')](respondWithResult(_0x3a1043,null))[_0xa934('0x28')](handleError(_0x3a1043,null));};exports[_0xa934('0xd9')]=function(_0x1e1733,_0x5a655d,_0x16e491){var _0x1572bc,_0x3f2ecc,_0x5d385f;return db[_0xa934('0x4f')]['find']({'where':{'id':_0x1e1733[_0xa934('0x55')]['id']}})[_0xa934('0x1f')](handleEntityNotFound(_0x5a655d,null))[_0xa934('0x1f')](function(_0x568443){if(_0x568443){_0x5d385f=_0x568443;logger[_0xa934('0xae')](_0xa934('0x22'),_0xa934('0x29'),_0xa934('0xc9'),_0x568443['type'],util['inspect'](_0x1e1733[_0xa934('0x40')],{'showHidden':![],'depth':null}));switch(_0x568443[_0xa934('0x3d')]){case _0xa934('0xda'):if(_0x1e1733[_0xa934('0x40')][_0xa934('0xdb')]&&_0x1e1733[_0xa934('0x40')]['state']){_0x3f2ecc=_0x1e1733[_0xa934('0x40')]['state'];return db[_0xa934('0xa6')][_0xa934('0x58')]({'where':{'messageId':_0x1e1733[_0xa934('0x40')][_0xa934('0xdb')]}});}break;}}})[_0xa934('0x1f')](handleEntityNotFound(_0x5a655d,null))[_0xa934('0x1f')](function(_0x5025c0){if(_0x5025c0){_0x1572bc=_0x5025c0;switch(_0x5d385f['type']){case'csc':if(_0x3f2ecc==='2'||_0x3f2ecc==='6'){return _0x1572bc['update']({'read':!![]});}else{logger[_0xa934('0x25')](_0xa934('0x22'),_0xa934('0x29'),_0xa934('0xda'),util[_0xa934('0xca')](_0x1e1733['query'],{'showHidden':![],'depth':null}));};break;}return _0x1572bc;}})['then'](respondWithResult(_0x5a655d,null))['catch'](handleError(_0x5a655d,null));};exports[_0xa934('0xdc')]=function(_0x3b0ffa,_0xd7277d,_0x811f07){return db[_0xa934('0x4f')][_0xa934('0x58')]({'where':{'id':_0x3b0ffa[_0xa934('0x55')]['id']}})[_0xa934('0x1f')](handleEntityNotFound(_0xd7277d,null))['then'](function(_0x33f561){if(_0x33f561){return _0x33f561[_0xa934('0xdc')](_0x3b0ffa[_0xa934('0x5a')][_0xa934('0x68')],_[_0xa934('0x9c')](_0x3b0ffa['body'],[_0xa934('0x68'),'id'])||{})[_0xa934('0x9f')](function(_0x560414){for(var _0x26de08=0x0;_0x26de08<_0x3b0ffa['body'][_0xa934('0x68')][_0xa934('0x46')];_0x26de08+=0x1){socket[_0xa934('0xdd')](_0xa934('0xde'),{'UserId':Number(_0x3b0ffa[_0xa934('0x5a')][_0xa934('0x68')][_0x26de08]),'SmsAccountId':Number(_0x3b0ffa[_0xa934('0x55')]['id'])});}return _0x560414;});}})[_0xa934('0x1f')](respondWithResult(_0xd7277d,null))[_0xa934('0x28')](handleError(_0xd7277d,null));};exports[_0xa934('0xdf')]=function(_0x4a6d2b,_0x4b5a5c,_0x11fc6b){return db['SmsAccount'][_0xa934('0x58')]({'where':{'id':_0x4a6d2b[_0xa934('0x55')]['id']}})[_0xa934('0x1f')](handleEntityNotFound(_0x4b5a5c,null))[_0xa934('0x1f')](function(_0x12d2ff){if(_0x12d2ff){return _0x12d2ff[_0xa934('0xdf')](_0x4a6d2b[_0xa934('0x40')][_0xa934('0x68')])[_0xa934('0x1f')](function(){if(_[_0xa934('0xe0')](_0x4a6d2b[_0xa934('0x40')]['ids'])){for(var _0x208d63=0x0;_0x208d63<_0x4a6d2b['query'][_0xa934('0x68')][_0xa934('0x46')];_0x208d63+=0x1){socket['emit'](_0xa934('0xe1'),{'UserId':Number(_0x4a6d2b['query']['ids'][_0x208d63]),'SmsAccountId':Number(_0x4a6d2b[_0xa934('0x55')]['id'])});}}else{socket['emit'](_0xa934('0xe1'),{'UserId':Number(_0x4a6d2b['query']['ids']),'SmsAccountId':Number(_0x4a6d2b[_0xa934('0x55')]['id'])});}});}})[_0xa934('0x1f')](respondWithStatusCode(_0x4b5a5c,null))['catch'](handleError(_0x4b5a5c,null));};exports[_0xa934('0xe2')]=function(_0x20b7fb,_0x338a73,_0x1fa3c2){var _0x1a10d8={};var _0x479d75={};var _0xf3cc8a;var _0x5e8c8f;return db[_0xa934('0x4f')][_0xa934('0x65')]({'where':{'id':_0x20b7fb[_0xa934('0x55')]['id']}})[_0xa934('0x1f')](handleEntityNotFound(_0x338a73,null))[_0xa934('0x1f')](function(_0x5e16b5){if(_0x5e16b5){_0xf3cc8a=_0x5e16b5;_0x479d75[_0xa934('0x3f')]=_[_0xa934('0x41')](db[_0xa934('0xa8')]['rawAttributes']);_0x479d75['query']=_['keys'](_0x20b7fb[_0xa934('0x40')]);_0x479d75[_0xa934('0x42')]=_['intersection'](_0x479d75[_0xa934('0x3f')],_0x479d75['query']);_0x1a10d8['attributes']=_[_0xa934('0x43')](_0x479d75[_0xa934('0x3f')],qs[_0xa934('0x45')](_0x20b7fb[_0xa934('0x40')][_0xa934('0x45')]));_0x1a10d8[_0xa934('0x44')]=_0x1a10d8[_0xa934('0x44')]['length']?_0x1a10d8[_0xa934('0x44')]:_0x479d75['model'];_0x1a10d8[_0xa934('0x49')]=qs[_0xa934('0x4a')](_0x20b7fb[_0xa934('0x40')][_0xa934('0x4a')]);_0x1a10d8['where']=qs[_0xa934('0x42')](_[_0xa934('0x66')](_0x20b7fb[_0xa934('0x40')],_0x479d75[_0xa934('0x42')]));if(_0x20b7fb['query'][_0xa934('0x4c')]){_0x1a10d8[_0xa934('0x4b')]=_[_0xa934('0x4e')](_0x1a10d8['where'],{'$or':_[_0xa934('0x3b')](_0x1a10d8[_0xa934('0x44')],function(_0x391c96){var _0x1bb8ca={};_0x1bb8ca[_0x391c96]={'$like':'%'+_0x20b7fb[_0xa934('0x40')][_0xa934('0x4c')]+'%'};return _0x1bb8ca;})});}_0x1a10d8=_[_0xa934('0x4e')]({},_0x1a10d8,_0x20b7fb[_0xa934('0x57')]);return _0xf3cc8a[_0xa934('0xe2')](_0x1a10d8);}})['then'](function(_0x52e63c){if(_0x52e63c){_0x5e8c8f=_0x52e63c[_0xa934('0x46')];if(!_0x20b7fb[_0xa934('0x40')][_0xa934('0x47')]('nolimit')){_0x1a10d8[_0xa934('0x2d')]=qs['limit'](_0x20b7fb[_0xa934('0x40')][_0xa934('0x2d')]);_0x1a10d8['offset']=qs[_0xa934('0x2c')](_0x20b7fb['query'][_0xa934('0x2c')]);}return _0xf3cc8a[_0xa934('0xe2')](_0x1a10d8);}})['then'](function(_0xcdbea){if(_0xcdbea){return _0xcdbea?{'count':_0x5e8c8f,'rows':_0xcdbea}:null;}})[_0xa934('0x1f')](respondWithResult(_0x338a73,null))[_0xa934('0x28')](handleError(_0x338a73,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index a237b6e..1315d7a 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 _0x29b1=['emit','hasOwnProperty','events','SmsAccount','setMaxListeners','save','update','remove'];(function(_0x47e096,_0x50f86e){var _0x2bf692=function(_0x5e1c57){while(--_0x5e1c57){_0x47e096['push'](_0x47e096['shift']());}};_0x2bf692(++_0x50f86e);}(_0x29b1,0x10a));var _0x129b=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x29b1[_0x376b45];return _0x2341b3;};'use strict';var EventEmitter=require(_0x129b('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x129b('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x129b('0x2')](0x0);var events={'afterCreate':_0x129b('0x3'),'afterUpdate':_0x129b('0x4'),'afterDestroy':_0x129b('0x5')};function emitEvent(_0x3b3718){return function(_0x2d6cfb,_0x26fd58,_0x349aa9){SmsAccountEvents[_0x129b('0x6')](_0x3b3718+':'+_0x2d6cfb['id'],_0x2d6cfb);SmsAccountEvents[_0x129b('0x6')](_0x3b3718,_0x2d6cfb);_0x349aa9(null);};}for(var e in events){if(events[_0x129b('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xa14f=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount','update'];(function(_0x7d26a3,_0x4c4190){var _0x4048ac=function(_0x9a5fbb){while(--_0x9a5fbb){_0x7d26a3['push'](_0x7d26a3['shift']());}};_0x4048ac(++_0x4c4190);}(_0xa14f,0x12c));var _0xfa14=function(_0x3993c8,_0x44fc74){_0x3993c8=_0x3993c8-0x0;var _0x4bc189=_0xa14f[_0x3993c8];return _0x4bc189;};'use strict';var EventEmitter=require(_0xfa14('0x0'));var SmsAccount=require(_0xfa14('0x1'))['db'][_0xfa14('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfa14('0x3'),'afterDestroy':_0xfa14('0x4')};function emitEvent(_0x19bbf7){return function(_0x254376,_0x59f124,_0x57d86f){SmsAccountEvents['emit'](_0x19bbf7+':'+_0x254376['id'],_0x254376);SmsAccountEvents[_0xfa14('0x5')](_0x19bbf7,_0x254376);_0x57d86f(null);};}for(var e in events){if(events[_0xfa14('0x6')](e)){var event=events[e];SmsAccount[_0xfa14('0x7')](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 212893e..5501d39 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 _0xdbba=['rimraf','exports','define','sms_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xdbba,0x112));var _0xadbb=function(_0x3ba095,_0x445aef){_0x3ba095=_0x3ba095-0x0;var _0x135e8c=_0xdbba[_0x3ba095];return _0x135e8c;};'use strict';var _=require(_0xadbb('0x0'));var util=require('util');var logger=require(_0xadbb('0x1'))(_0xadbb('0x2'));var moment=require(_0xadbb('0x3'));var BPromise=require(_0xadbb('0x4'));var rp=require(_0xadbb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xadbb('0x6'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0xadbb('0x7')]=function(_0xa7833b,_0x3992bb){return _0xa7833b[_0xadbb('0x8')]('SmsAccount',attributes,{'tableName':_0xadbb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd392=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','SmsAccount','sms_accounts','lodash','util','../../config/logger'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xd392,0x1eb));var _0x2d39=function(_0x50e755,_0x39a2ea){_0x50e755=_0x50e755-0x0;var _0x4eec51=_0xd392[_0x50e755];return _0x4eec51;};'use strict';var _=require(_0x2d39('0x0'));var util=require(_0x2d39('0x1'));var logger=require(_0x2d39('0x2'))(_0x2d39('0x3'));var moment=require(_0x2d39('0x4'));var BPromise=require(_0x2d39('0x5'));var rp=require(_0x2d39('0x6'));var fs=require('fs');var path=require(_0x2d39('0x7'));var rimraf=require(_0x2d39('0x8'));var config=require(_0x2d39('0x9'));var attributes=require(_0x2d39('0xa'));module['exports']=function(_0x5fc1f2,_0x11a358){return _0x5fc1f2['define'](_0x2d39('0xb'),attributes,{'tableName':_0x2d39('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 9818fcd..2bc6445 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 _0x8882=['localhost','socket.io-emitter','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','SmsAccount,\x20%s,\x20%s','message','info','result','catch','options','raw','where','attributes','include','map','ShowSmsAccount','debug','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0xeb0cd3,_0x58c351){var _0x3eefb9=function(_0x2f2c07){while(--_0x2f2c07){_0xeb0cd3['push'](_0xeb0cd3['shift']());}};_0x3eefb9(++_0x58c351);}(_0x8882,0xcb));var _0x2888=function(_0x26201e,_0x5d2fe3){_0x26201e=_0x26201e-0x0;var _0xa274d2=_0x8882[_0x26201e];return _0xa274d2;};'use strict';var _=require(_0x2888('0x0'));var util=require('util');var moment=require(_0x2888('0x1'));var BPromise=require('bluebird');var rs=require(_0x2888('0x2'));var fs=require('fs');var Redis=require(_0x2888('0x3'));var db=require(_0x2888('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2888('0x5'))(_0x2888('0x6'));var config=require(_0x2888('0x7'));var jayson=require(_0x2888('0x8'));var client=jayson[_0x2888('0x9')][_0x2888('0xa')]({'port':0x232a});config[_0x2888('0xb')]=_[_0x2888('0xc')](config[_0x2888('0xb')],{'host':_0x2888('0xd'),'port':0x18eb});var socket=require(_0x2888('0xe'))(new Redis(config[_0x2888('0xb')]));require(_0x2888('0xf'))[_0x2888('0x10')](socket);function respondWithRpcPromise(_0x23f463,_0x5d9e87,_0x1a422b){return new BPromise(function(_0x5e8a16,_0x3444ae){return client[_0x2888('0x11')](_0x23f463,_0x1a422b)[_0x2888('0x12')](function(_0x36c341){logger['info']('SmsAccount,\x20%s,\x20%s',_0x5d9e87,'request\x20sent');logger['debug'](_0x2888('0x13'),_0x5d9e87,_0x2888('0x14'),JSON['stringify'](_0x36c341));if(_0x36c341[_0x2888('0x15')]){if(_0x36c341[_0x2888('0x15')]['code']===0x1f4){logger[_0x2888('0x15')](_0x2888('0x16'),_0x5d9e87,_0x36c341[_0x2888('0x15')]['message']);return _0x3444ae(_0x36c341[_0x2888('0x15')]['message']);}logger[_0x2888('0x15')](_0x2888('0x16'),_0x5d9e87,_0x36c341[_0x2888('0x15')]['message']);return _0x5e8a16(_0x36c341[_0x2888('0x15')][_0x2888('0x17')]);}else{logger[_0x2888('0x18')]('SmsAccount,\x20%s,\x20%s',_0x5d9e87,_0x2888('0x14'));_0x5e8a16(_0x36c341[_0x2888('0x19')][_0x2888('0x17')]);}})[_0x2888('0x1a')](function(_0x47ddc8){logger[_0x2888('0x15')](_0x2888('0x16'),_0x5d9e87,_0x47ddc8);_0x3444ae(_0x47ddc8);});});}exports['ShowSmsAccount']=function(_0x4047de){var _0x36393a=this;return new Promise(function(_0x431e09,_0xaa52ec){return db['SmsAccount']['find']({'raw':_0x4047de[_0x2888('0x1b')]?_0x4047de[_0x2888('0x1b')][_0x2888('0x1c')]===undefined?!![]:![]:!![],'where':_0x4047de[_0x2888('0x1b')]?_0x4047de[_0x2888('0x1b')][_0x2888('0x1d')]||null:null,'attributes':_0x4047de[_0x2888('0x1b')]?_0x4047de[_0x2888('0x1b')][_0x2888('0x1e')]||null:null,'include':_0x4047de[_0x2888('0x1b')]?_0x4047de[_0x2888('0x1b')][_0x2888('0x1f')]?_['map'](_0x4047de[_0x2888('0x1b')][_0x2888('0x1f')],function(_0x4b42e4){return{'model':db[_0x4b42e4['model']],'as':_0x4b42e4['as'],'attributes':_0x4b42e4[_0x2888('0x1e')],'include':_0x4b42e4[_0x2888('0x1f')]?_[_0x2888('0x20')](_0x4b42e4[_0x2888('0x1f')],function(_0x46984b){return{'model':db[_0x46984b['model']],'as':_0x46984b['as'],'attributes':_0x46984b[_0x2888('0x1e')],'include':_0x46984b[_0x2888('0x1f')]?_[_0x2888('0x20')](_0x46984b['include'],function(_0x8f1877){return{'model':db[_0x8f1877['model']],'as':_0x8f1877['as'],'attributes':_0x8f1877[_0x2888('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2888('0x12')](function(_0x2fe845){logger[_0x2888('0x18')](_0x2888('0x21'),_0x4047de);logger[_0x2888('0x22')]('ShowSmsAccount',_0x4047de,JSON[_0x2888('0x23')](_0x2fe845));_0x431e09(_0x2fe845);})[_0x2888('0x1a')](function(_0x4cca80){logger[_0x2888('0x15')](_0x2888('0x21'),_0x4cca80[_0x2888('0x17')],_0x4047de);_0xaa52ec(_0x36393a[_0x2888('0x15')](0x1f4,_0x4cca80['message']));});});}; \ No newline at end of file +var _0x1f3b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./smsAccount.socket','register','then','info','request\x20sent','debug','stringify','error','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','find','options','where','include','map','attributes','model','lodash','util'];(function(_0x45c3e5,_0x223647){var _0x4b57fa=function(_0x2420cb){while(--_0x2420cb){_0x45c3e5['push'](_0x45c3e5['shift']());}};_0x4b57fa(++_0x223647);}(_0x1f3b,0x67));var _0xb1f3=function(_0x28ee74,_0x289441){_0x28ee74=_0x28ee74-0x0;var _0x6cc80c=_0x1f3b[_0x28ee74];return _0x6cc80c;};'use strict';var _=require(_0xb1f3('0x0'));var util=require(_0xb1f3('0x1'));var moment=require(_0xb1f3('0x2'));var BPromise=require(_0xb1f3('0x3'));var rs=require(_0xb1f3('0x4'));var fs=require('fs');var Redis=require(_0xb1f3('0x5'));var db=require(_0xb1f3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb1f3('0x7'))('rpc');var config=require(_0xb1f3('0x8'));var jayson=require(_0xb1f3('0x9'));var client=jayson[_0xb1f3('0xa')][_0xb1f3('0xb')]({'port':0x232a});config[_0xb1f3('0xc')]=_[_0xb1f3('0xd')](config[_0xb1f3('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb1f3('0xe'))[_0xb1f3('0xf')](socket);function respondWithRpcPromise(_0x37350a,_0x1997b9,_0x5c81a9){return new BPromise(function(_0x202a67,_0x144a0c){return client['request'](_0x37350a,_0x5c81a9)[_0xb1f3('0x10')](function(_0x4ea852){logger[_0xb1f3('0x11')]('SmsAccount,\x20%s,\x20%s',_0x1997b9,_0xb1f3('0x12'));logger[_0xb1f3('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1997b9,_0xb1f3('0x12'),JSON[_0xb1f3('0x14')](_0x4ea852));if(_0x4ea852[_0xb1f3('0x15')]){if(_0x4ea852[_0xb1f3('0x15')]['code']===0x1f4){logger[_0xb1f3('0x15')](_0xb1f3('0x16'),_0x1997b9,_0x4ea852[_0xb1f3('0x15')]['message']);return _0x144a0c(_0x4ea852[_0xb1f3('0x15')][_0xb1f3('0x17')]);}logger[_0xb1f3('0x15')](_0xb1f3('0x16'),_0x1997b9,_0x4ea852['error']['message']);return _0x202a67(_0x4ea852[_0xb1f3('0x15')][_0xb1f3('0x17')]);}else{logger['info'](_0xb1f3('0x16'),_0x1997b9,_0xb1f3('0x12'));_0x202a67(_0x4ea852[_0xb1f3('0x18')][_0xb1f3('0x17')]);}})[_0xb1f3('0x19')](function(_0x1eefbc){logger[_0xb1f3('0x15')](_0xb1f3('0x16'),_0x1997b9,_0x1eefbc);_0x144a0c(_0x1eefbc);});});}exports[_0xb1f3('0x1a')]=function(_0x57fa81){var _0x1464c0=this;return new Promise(function(_0x4c2a3f,_0x5d9846){return db[_0xb1f3('0x1b')][_0xb1f3('0x1c')]({'raw':_0x57fa81[_0xb1f3('0x1d')]?_0x57fa81['options']['raw']===undefined?!![]:![]:!![],'where':_0x57fa81[_0xb1f3('0x1d')]?_0x57fa81[_0xb1f3('0x1d')][_0xb1f3('0x1e')]||null:null,'attributes':_0x57fa81[_0xb1f3('0x1d')]?_0x57fa81[_0xb1f3('0x1d')]['attributes']||null:null,'include':_0x57fa81['options']?_0x57fa81['options'][_0xb1f3('0x1f')]?_[_0xb1f3('0x20')](_0x57fa81['options'][_0xb1f3('0x1f')],function(_0x3fad92){return{'model':db[_0x3fad92['model']],'as':_0x3fad92['as'],'attributes':_0x3fad92[_0xb1f3('0x21')],'include':_0x3fad92[_0xb1f3('0x1f')]?_[_0xb1f3('0x20')](_0x3fad92[_0xb1f3('0x1f')],function(_0x58c09a){return{'model':db[_0x58c09a[_0xb1f3('0x22')]],'as':_0x58c09a['as'],'attributes':_0x58c09a[_0xb1f3('0x21')],'include':_0x58c09a[_0xb1f3('0x1f')]?_['map'](_0x58c09a[_0xb1f3('0x1f')],function(_0x43b563){return{'model':db[_0x43b563[_0xb1f3('0x22')]],'as':_0x43b563['as'],'attributes':_0x43b563[_0xb1f3('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb1f3('0x10')](function(_0x3ad883){logger[_0xb1f3('0x11')](_0xb1f3('0x1a'),_0x57fa81);logger[_0xb1f3('0x13')](_0xb1f3('0x1a'),_0x57fa81,JSON['stringify'](_0x3ad883));_0x4c2a3f(_0x3ad883);})[_0xb1f3('0x19')](function(_0x4dd185){logger['error'](_0xb1f3('0x1a'),_0x4dd185['message'],_0x57fa81);_0x5d9846(_0x1464c0['error'](0x1f4,_0x4dd185[_0xb1f3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 8784738..2f3142d 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(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 d714a6a..98ed06f 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 _0xe14b=['/:id','create','put','exports','multer','util','express','Router','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x471ade,_0x491890){var _0x5eea0f=function(_0x2ea3e2){while(--_0x2ea3e2){_0x471ade['push'](_0x471ade['shift']());}};_0x5eea0f(++_0x491890);}(_0xe14b,0x93));var _0xbe14=function(_0x5501b2,_0x321fe0){_0x5501b2=_0x5501b2-0x0;var _0x285a40=_0xe14b[_0x5501b2];return _0x285a40;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router['delete'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['destroy']);module[_0xbe14('0xc')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 09a41bb..0e190a5 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 _0xff3a=['noop','TEXT','STRING','sequelize','exports'];(function(_0x5cbacf,_0x1c115c){var _0x159fad=function(_0x1b3566){while(--_0x1b3566){_0x5cbacf['push'](_0x5cbacf['shift']());}};_0x159fad(++_0x1c115c);}(_0xff3a,0x94));var _0xaff3=function(_0x25bf58,_0x40304b){_0x25bf58=_0x25bf58-0x0;var _0x1426b4=_0xff3a[_0x25bf58];return _0x1426b4;};'use strict';var Sequelize=require(_0xaff3('0x0'));module[_0xaff3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaff3('0x2')},'appdata':{'type':Sequelize[_0xaff3('0x3')]()},'description':{'type':Sequelize[_0xaff3('0x4')]},'interval':{'type':Sequelize[_0xaff3('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x0c7d=['noop','sequelize','exports','STRING'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x0c7d,0x111));var _0xd0c7=function(_0x21cc45,_0x22eff2){_0x21cc45=_0x21cc45-0x0;var _0x169c76=_0x0c7d[_0x21cc45];return _0x169c76;};'use strict';var Sequelize=require(_0xd0c7('0x0'));module[_0xd0c7('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd0c7('0x2')],'allowNull':![],'defaultValue':_0xd0c7('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xd0c7('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index edb4441..0b81da6 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 _0x63dd=['model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','destroy','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','update','then','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key'];(function(_0x4370c7,_0x5dbfb0){var _0xce78a9=function(_0x157b2c){while(--_0x157b2c){_0x4370c7['push'](_0x4370c7['shift']());}};_0xce78a9(++_0x5dbfb0);}(_0x63dd,0x1ef));var _0xd63d=function(_0x1a1f2e,_0x2fb1e6){_0x1a1f2e=_0x1a1f2e-0x0;var _0x5ce8bd=_0x63dd[_0x1a1f2e];return _0x5ce8bd;};'use strict';var emlformat=require(_0xd63d('0x0'));var rimraf=require(_0xd63d('0x1'));var zipdir=require(_0xd63d('0x2'));var jsonpatch=require(_0xd63d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd63d('0x4'));var Mustache=require(_0xd63d('0x5'));var util=require(_0xd63d('0x6'));var path=require(_0xd63d('0x7'));var sox=require(_0xd63d('0x8'));var csv=require(_0xd63d('0x9'));var ejs=require(_0xd63d('0xa'));var fs=require('fs');var fs_extra=require(_0xd63d('0xb'));var _=require(_0xd63d('0xc'));var squel=require(_0xd63d('0xd'));var crypto=require(_0xd63d('0xe'));var jsforce=require(_0xd63d('0xf'));var deskjs=require(_0xd63d('0x10'));var toCsv=require(_0xd63d('0x9'));var querystring=require(_0xd63d('0x11'));var Papa=require('papaparse');var Redis=require(_0xd63d('0x12'));var authService=require(_0xd63d('0x13'));var qs=require(_0xd63d('0x14'));var as=require(_0xd63d('0x15'));var hardwareService=require(_0xd63d('0x16'));var logger=require(_0xd63d('0x17'))(_0xd63d('0x18'));var utils=require('../../config/utils');var config=require(_0xd63d('0x19'));var licenseUtil=require(_0xd63d('0x1a'));var db=require(_0xd63d('0x1b'))['db'];function respondWithStatusCode(_0x4140b0,_0x5da6c4){_0x5da6c4=_0x5da6c4||0xcc;return function(_0x4b380a){if(_0x4b380a){return _0x4140b0[_0xd63d('0x1c')](_0x5da6c4);}return _0x4140b0['status'](_0x5da6c4)[_0xd63d('0x1d')]();};}function respondWithResult(_0x56f387,_0x3294a5){_0x3294a5=_0x3294a5||0xc8;return function(_0x24f6a3){if(_0x24f6a3){return _0x56f387[_0xd63d('0x1e')](_0x3294a5)[_0xd63d('0x1f')](_0x24f6a3);}};}function respondWithFilteredResult(_0x1be123,_0x27d9a4){return function(_0x386696){if(_0x386696){var _0x34fa8d=typeof _0x27d9a4['offset']===_0xd63d('0x20')&&typeof _0x27d9a4['limit']===_0xd63d('0x20');var _0xfd39a7=_0x386696[_0xd63d('0x21')];var _0x25617c=_0x34fa8d?0x0:_0x27d9a4[_0xd63d('0x22')];var _0x63fe05=_0x34fa8d?_0x386696[_0xd63d('0x21')]:_0x27d9a4[_0xd63d('0x22')]+_0x27d9a4[_0xd63d('0x23')];var _0x231813;if(_0x63fe05>=_0xfd39a7){_0x63fe05=_0xfd39a7;_0x231813=0xc8;}else{_0x231813=0xce;}_0x1be123[_0xd63d('0x1e')](_0x231813);return _0x1be123[_0xd63d('0x24')](_0xd63d('0x25'),_0x25617c+'-'+_0x63fe05+'/'+_0xfd39a7)['json'](_0x386696);}return null;};}function patchUpdates(_0xa48dee){return function(_0x2c160c){try{jsonpatch['apply'](_0x2c160c,_0xa48dee,!![]);}catch(_0x1d214f){return BPromise['reject'](_0x1d214f);}return _0x2c160c['save']();};}function saveUpdates(_0x1e9271,_0x5f5680){return function(_0x3bdc02){if(_0x3bdc02){return _0x3bdc02[_0xd63d('0x26')](_0x1e9271)[_0xd63d('0x27')](function(_0x2e9206){return _0x2e9206;});}return null;};}function removeEntity(_0x1bd4ca,_0x39d867){return function(_0x5eee16){if(_0x5eee16){return _0x5eee16['destroy']()[_0xd63d('0x27')](function(){_0x1bd4ca[_0xd63d('0x1e')](0xcc)[_0xd63d('0x1d')]();});}};}function handleEntityNotFound(_0x20b96c,_0xc5b0d){return function(_0x4566f9){if(!_0x4566f9){_0x20b96c['sendStatus'](0x194);}return _0x4566f9;};}function handleError(_0x46b200,_0x595eab){_0x595eab=_0x595eab||0x1f4;return function(_0x19e5c9){logger[_0xd63d('0x28')](_0x19e5c9[_0xd63d('0x29')]);if(_0x19e5c9[_0xd63d('0x2a')]){delete _0x19e5c9['name'];}_0x46b200[_0xd63d('0x1e')](_0x595eab)[_0xd63d('0x2b')](_0x19e5c9);};}exports[_0xd63d('0x2c')]=function(_0x47f86a,_0x2623ee){var _0x4816d5={},_0x54aec0={},_0x1a02ba={'count':0x0,'rows':[]};var _0x567096=_[_0xd63d('0x2d')](db[_0xd63d('0x2e')][_0xd63d('0x2f')],function(_0x258036){return{'name':_0x258036[_0xd63d('0x30')],'type':_0x258036[_0xd63d('0x31')][_0xd63d('0x32')]};});_0x54aec0[_0xd63d('0x33')]=_[_0xd63d('0x2d')](_0x567096,'name');_0x54aec0['query']=_['keys'](_0x47f86a[_0xd63d('0x34')]);_0x54aec0[_0xd63d('0x35')]=_[_0xd63d('0x36')](_0x54aec0[_0xd63d('0x33')],_0x54aec0[_0xd63d('0x34')]);_0x4816d5[_0xd63d('0x37')]=_[_0xd63d('0x36')](_0x54aec0['model'],qs[_0xd63d('0x38')](_0x47f86a[_0xd63d('0x34')][_0xd63d('0x38')]));_0x4816d5['attributes']=_0x4816d5[_0xd63d('0x37')][_0xd63d('0x39')]?_0x4816d5[_0xd63d('0x37')]:_0x54aec0[_0xd63d('0x33')];if(!_0x47f86a[_0xd63d('0x34')][_0xd63d('0x3a')]('nolimit')){_0x4816d5[_0xd63d('0x23')]=qs[_0xd63d('0x23')](_0x47f86a['query'][_0xd63d('0x23')]);_0x4816d5[_0xd63d('0x22')]=qs[_0xd63d('0x22')](_0x47f86a[_0xd63d('0x34')][_0xd63d('0x22')]);}_0x4816d5[_0xd63d('0x3b')]=qs[_0xd63d('0x3c')](_0x47f86a[_0xd63d('0x34')]['sort']);_0x4816d5[_0xd63d('0x3d')]=qs['filters'](_[_0xd63d('0x3e')](_0x47f86a[_0xd63d('0x34')],_0x54aec0['filters']),_0x567096);if(_0x47f86a[_0xd63d('0x34')][_0xd63d('0x3f')]){_0x4816d5[_0xd63d('0x3d')]=_[_0xd63d('0x40')](_0x4816d5[_0xd63d('0x3d')],{'$or':_['map'](_0x567096,function(_0x381bbd){if(_0x381bbd[_0xd63d('0x31')]!=='VIRTUAL'){var _0x2125fe={};_0x2125fe[_0x381bbd[_0xd63d('0x2a')]]={'$like':'%'+_0x47f86a[_0xd63d('0x34')][_0xd63d('0x3f')]+'%'};return _0x2125fe;}})});}_0x4816d5=_[_0xd63d('0x40')]({},_0x4816d5,_0x47f86a[_0xd63d('0x41')]);var _0x5426de={'where':_0x4816d5[_0xd63d('0x3d')]};return db[_0xd63d('0x2e')][_0xd63d('0x21')](_0x5426de)[_0xd63d('0x27')](function(_0x4f5a5a){_0x1a02ba[_0xd63d('0x21')]=_0x4f5a5a;if(_0x47f86a[_0xd63d('0x34')]['includeAll']){_0x4816d5[_0xd63d('0x42')]=[{'all':!![]}];}return db[_0xd63d('0x2e')][_0xd63d('0x43')](_0x4816d5);})['then'](function(_0x547d7e){_0x1a02ba[_0xd63d('0x44')]=_0x547d7e;return _0x1a02ba;})[_0xd63d('0x27')](respondWithFilteredResult(_0x2623ee,_0x4816d5))['catch'](handleError(_0x2623ee,null));};exports[_0xd63d('0x45')]=function(_0x306216,_0x436b1e){var _0x5022b9={'raw':!![],'where':{'id':_0x306216[_0xd63d('0x46')]['id']}},_0x58e165={};_0x58e165[_0xd63d('0x33')]=_[_0xd63d('0x47')](db[_0xd63d('0x2e')][_0xd63d('0x2f')]);_0x58e165[_0xd63d('0x34')]=_[_0xd63d('0x47')](_0x306216['query']);_0x58e165[_0xd63d('0x35')]=_['intersection'](_0x58e165[_0xd63d('0x33')],_0x58e165['query']);_0x5022b9[_0xd63d('0x37')]=_['intersection'](_0x58e165['model'],qs[_0xd63d('0x38')](_0x306216[_0xd63d('0x34')]['fields']));_0x5022b9[_0xd63d('0x37')]=_0x5022b9['attributes'][_0xd63d('0x39')]?_0x5022b9['attributes']:_0x58e165['model'];if(_0x306216[_0xd63d('0x34')][_0xd63d('0x48')]){_0x5022b9[_0xd63d('0x42')]=[{'all':!![]}];}_0x5022b9=_[_0xd63d('0x40')]({},_0x5022b9,_0x306216['options']);return db[_0xd63d('0x2e')][_0xd63d('0x49')](_0x5022b9)[_0xd63d('0x27')](handleEntityNotFound(_0x436b1e,null))['then'](respondWithResult(_0x436b1e,null))[_0xd63d('0x4a')](handleError(_0x436b1e,null));};exports['create']=function(_0x3eab35,_0x4d265e){return db['SmsApplication'][_0xd63d('0x4b')](_0x3eab35[_0xd63d('0x4c')],{})[_0xd63d('0x27')](respondWithResult(_0x4d265e,0xc9))['catch'](handleError(_0x4d265e,null));};exports[_0xd63d('0x26')]=function(_0x3ce95c,_0xf3814c){if(_0x3ce95c[_0xd63d('0x4c')]['id']){delete _0x3ce95c[_0xd63d('0x4c')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x3ce95c['params']['id']}})['then'](handleEntityNotFound(_0xf3814c,null))[_0xd63d('0x27')](saveUpdates(_0x3ce95c[_0xd63d('0x4c')],null))[_0xd63d('0x27')](respondWithResult(_0xf3814c,null))[_0xd63d('0x4a')](handleError(_0xf3814c,null));};exports[_0xd63d('0x4d')]=function(_0xd7f25,_0x1f768b){return db[_0xd63d('0x2e')]['find']({'where':{'id':_0xd7f25[_0xd63d('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f768b,null))[_0xd63d('0x27')](removeEntity(_0x1f768b,null))[_0xd63d('0x4a')](handleError(_0x1f768b,null));}; \ No newline at end of file +var _0x8f34=['filters','pick','filter','merge','options','includeAll','rows','show','params','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','index','map','SmsApplication','rawAttributes','type','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where'];(function(_0x3b38ab,_0x2f6962){var _0x47cd1a=function(_0x5818b3){while(--_0x5818b3){_0x3b38ab['push'](_0x3b38ab['shift']());}};_0x47cd1a(++_0x2f6962);}(_0x8f34,0x131));var _0x48f3=function(_0x4f05ec,_0x3640df){_0x4f05ec=_0x4f05ec-0x0;var _0x502eed=_0x8f34[_0x4f05ec];return _0x502eed;};'use strict';var emlformat=require(_0x48f3('0x0'));var rimraf=require(_0x48f3('0x1'));var zipdir=require(_0x48f3('0x2'));var jsonpatch=require(_0x48f3('0x3'));var rp=require(_0x48f3('0x4'));var moment=require(_0x48f3('0x5'));var BPromise=require(_0x48f3('0x6'));var Mustache=require(_0x48f3('0x7'));var util=require(_0x48f3('0x8'));var path=require(_0x48f3('0x9'));var sox=require('sox');var csv=require(_0x48f3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x48f3('0xb'));var crypto=require(_0x48f3('0xc'));var jsforce=require(_0x48f3('0xd'));var deskjs=require(_0x48f3('0xe'));var toCsv=require(_0x48f3('0xa'));var querystring=require(_0x48f3('0xf'));var Papa=require(_0x48f3('0x10'));var Redis=require(_0x48f3('0x11'));var authService=require(_0x48f3('0x12'));var qs=require(_0x48f3('0x13'));var as=require(_0x48f3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x48f3('0x15'))(_0x48f3('0x16'));var utils=require(_0x48f3('0x17'));var config=require(_0x48f3('0x18'));var licenseUtil=require(_0x48f3('0x19'));var db=require(_0x48f3('0x1a'))['db'];function respondWithStatusCode(_0x2e5de6,_0x1b9395){_0x1b9395=_0x1b9395||0xcc;return function(_0x4c1f43){if(_0x4c1f43){return _0x2e5de6[_0x48f3('0x1b')](_0x1b9395);}return _0x2e5de6[_0x48f3('0x1c')](_0x1b9395)[_0x48f3('0x1d')]();};}function respondWithResult(_0x392e9f,_0x179092){_0x179092=_0x179092||0xc8;return function(_0xfe0ff){if(_0xfe0ff){return _0x392e9f[_0x48f3('0x1c')](_0x179092)[_0x48f3('0x1e')](_0xfe0ff);}};}function respondWithFilteredResult(_0x32a460,_0x420752){return function(_0x1b2edf){if(_0x1b2edf){var _0x1ccc07=typeof _0x420752['offset']===_0x48f3('0x1f')&&typeof _0x420752['limit']===_0x48f3('0x1f');var _0x149475=_0x1b2edf[_0x48f3('0x20')];var _0x2de354=_0x1ccc07?0x0:_0x420752[_0x48f3('0x21')];var _0x378614=_0x1ccc07?_0x1b2edf[_0x48f3('0x20')]:_0x420752[_0x48f3('0x21')]+_0x420752[_0x48f3('0x22')];var _0x15f09f;if(_0x378614>=_0x149475){_0x378614=_0x149475;_0x15f09f=0xc8;}else{_0x15f09f=0xce;}_0x32a460[_0x48f3('0x1c')](_0x15f09f);return _0x32a460[_0x48f3('0x23')](_0x48f3('0x24'),_0x2de354+'-'+_0x378614+'/'+_0x149475)[_0x48f3('0x1e')](_0x1b2edf);}return null;};}function patchUpdates(_0x34f59d){return function(_0x254fb0){try{jsonpatch[_0x48f3('0x25')](_0x254fb0,_0x34f59d,!![]);}catch(_0x4b34f3){return BPromise[_0x48f3('0x26')](_0x4b34f3);}return _0x254fb0[_0x48f3('0x27')]();};}function saveUpdates(_0x1781d0,_0x16cb2a){return function(_0x2cc616){if(_0x2cc616){return _0x2cc616[_0x48f3('0x28')](_0x1781d0)['then'](function(_0x6c3a4c){return _0x6c3a4c;});}return null;};}function removeEntity(_0x5f57eb,_0xd9ee4b){return function(_0x461221){if(_0x461221){return _0x461221['destroy']()[_0x48f3('0x29')](function(){_0x5f57eb['status'](0xcc)[_0x48f3('0x1d')]();});}};}function handleEntityNotFound(_0x1600b8,_0x242a15){return function(_0x33c898){if(!_0x33c898){_0x1600b8[_0x48f3('0x1b')](0x194);}return _0x33c898;};}function handleError(_0x41d013,_0x3feae4){_0x3feae4=_0x3feae4||0x1f4;return function(_0x85f7a8){logger[_0x48f3('0x2a')](_0x85f7a8['stack']);if(_0x85f7a8['name']){delete _0x85f7a8[_0x48f3('0x2b')];}_0x41d013[_0x48f3('0x1c')](_0x3feae4)['send'](_0x85f7a8);};}exports[_0x48f3('0x2c')]=function(_0x16b408,_0x539cc1){var _0x3283ad={},_0x1ffed9={},_0x4c8266={'count':0x0,'rows':[]};var _0x51be88=_[_0x48f3('0x2d')](db[_0x48f3('0x2e')][_0x48f3('0x2f')],function(_0x131634){return{'name':_0x131634['fieldName'],'type':_0x131634[_0x48f3('0x30')]['key']};});_0x1ffed9[_0x48f3('0x31')]=_[_0x48f3('0x2d')](_0x51be88,_0x48f3('0x2b'));_0x1ffed9['query']=_[_0x48f3('0x32')](_0x16b408['query']);_0x1ffed9['filters']=_[_0x48f3('0x33')](_0x1ffed9[_0x48f3('0x31')],_0x1ffed9[_0x48f3('0x34')]);_0x3283ad[_0x48f3('0x35')]=_[_0x48f3('0x33')](_0x1ffed9[_0x48f3('0x31')],qs[_0x48f3('0x36')](_0x16b408[_0x48f3('0x34')]['fields']));_0x3283ad[_0x48f3('0x35')]=_0x3283ad[_0x48f3('0x35')][_0x48f3('0x37')]?_0x3283ad[_0x48f3('0x35')]:_0x1ffed9[_0x48f3('0x31')];if(!_0x16b408[_0x48f3('0x34')][_0x48f3('0x38')]('nolimit')){_0x3283ad[_0x48f3('0x22')]=qs[_0x48f3('0x22')](_0x16b408[_0x48f3('0x34')]['limit']);_0x3283ad[_0x48f3('0x21')]=qs[_0x48f3('0x21')](_0x16b408[_0x48f3('0x34')][_0x48f3('0x21')]);}_0x3283ad[_0x48f3('0x39')]=qs[_0x48f3('0x3a')](_0x16b408[_0x48f3('0x34')][_0x48f3('0x3a')]);_0x3283ad[_0x48f3('0x3b')]=qs[_0x48f3('0x3c')](_[_0x48f3('0x3d')](_0x16b408[_0x48f3('0x34')],_0x1ffed9[_0x48f3('0x3c')]),_0x51be88);if(_0x16b408['query'][_0x48f3('0x3e')]){_0x3283ad['where']=_[_0x48f3('0x3f')](_0x3283ad[_0x48f3('0x3b')],{'$or':_[_0x48f3('0x2d')](_0x51be88,function(_0x35373f){if(_0x35373f[_0x48f3('0x30')]!=='VIRTUAL'){var _0x222c99={};_0x222c99[_0x35373f[_0x48f3('0x2b')]]={'$like':'%'+_0x16b408[_0x48f3('0x34')][_0x48f3('0x3e')]+'%'};return _0x222c99;}})});}_0x3283ad=_[_0x48f3('0x3f')]({},_0x3283ad,_0x16b408[_0x48f3('0x40')]);var _0x35892a={'where':_0x3283ad[_0x48f3('0x3b')]};return db[_0x48f3('0x2e')][_0x48f3('0x20')](_0x35892a)[_0x48f3('0x29')](function(_0x1939c1){_0x4c8266[_0x48f3('0x20')]=_0x1939c1;if(_0x16b408[_0x48f3('0x34')][_0x48f3('0x41')]){_0x3283ad['include']=[{'all':!![]}];}return db[_0x48f3('0x2e')]['findAll'](_0x3283ad);})[_0x48f3('0x29')](function(_0x3db45f){_0x4c8266[_0x48f3('0x42')]=_0x3db45f;return _0x4c8266;})[_0x48f3('0x29')](respondWithFilteredResult(_0x539cc1,_0x3283ad))['catch'](handleError(_0x539cc1,null));};exports[_0x48f3('0x43')]=function(_0x2496f8,_0x2d565e){var _0x8fb364={'raw':!![],'where':{'id':_0x2496f8[_0x48f3('0x44')]['id']}},_0x10d6c6={};_0x10d6c6['model']=_[_0x48f3('0x32')](db[_0x48f3('0x2e')][_0x48f3('0x2f')]);_0x10d6c6[_0x48f3('0x34')]=_[_0x48f3('0x32')](_0x2496f8[_0x48f3('0x34')]);_0x10d6c6[_0x48f3('0x3c')]=_[_0x48f3('0x33')](_0x10d6c6[_0x48f3('0x31')],_0x10d6c6[_0x48f3('0x34')]);_0x8fb364[_0x48f3('0x35')]=_[_0x48f3('0x33')](_0x10d6c6[_0x48f3('0x31')],qs[_0x48f3('0x36')](_0x2496f8[_0x48f3('0x34')]['fields']));_0x8fb364[_0x48f3('0x35')]=_0x8fb364[_0x48f3('0x35')]['length']?_0x8fb364['attributes']:_0x10d6c6[_0x48f3('0x31')];if(_0x2496f8[_0x48f3('0x34')]['includeAll']){_0x8fb364['include']=[{'all':!![]}];}_0x8fb364=_[_0x48f3('0x3f')]({},_0x8fb364,_0x2496f8[_0x48f3('0x40')]);return db[_0x48f3('0x2e')][_0x48f3('0x45')](_0x8fb364)[_0x48f3('0x29')](handleEntityNotFound(_0x2d565e,null))[_0x48f3('0x29')](respondWithResult(_0x2d565e,null))['catch'](handleError(_0x2d565e,null));};exports['create']=function(_0x1c4b5b,_0x3639a8){return db[_0x48f3('0x2e')][_0x48f3('0x46')](_0x1c4b5b[_0x48f3('0x47')],{})['then'](respondWithResult(_0x3639a8,0xc9))[_0x48f3('0x48')](handleError(_0x3639a8,null));};exports[_0x48f3('0x28')]=function(_0x36f268,_0x5d6031){if(_0x36f268[_0x48f3('0x47')]['id']){delete _0x36f268[_0x48f3('0x47')]['id'];}return db['SmsApplication'][_0x48f3('0x45')]({'where':{'id':_0x36f268[_0x48f3('0x44')]['id']}})[_0x48f3('0x29')](handleEntityNotFound(_0x5d6031,null))['then'](saveUpdates(_0x36f268[_0x48f3('0x47')],null))[_0x48f3('0x29')](respondWithResult(_0x5d6031,null))[_0x48f3('0x48')](handleError(_0x5d6031,null));};exports['destroy']=function(_0x123ff2,_0x2e7edb){return db[_0x48f3('0x2e')][_0x48f3('0x45')]({'where':{'id':_0x123ff2[_0x48f3('0x44')]['id']}})['then'](handleEntityNotFound(_0x2e7edb,null))[_0x48f3('0x29')](removeEntity(_0x2e7edb,null))['catch'](handleError(_0x2e7edb,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index b961497..787c49a 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 _0xbbd5=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes','define','sms_applications'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0xbbd5,0x84));var _0x5bbd=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbbd5[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x5bbd('0x0'));var util=require(_0x5bbd('0x1'));var logger=require('../../config/logger')(_0x5bbd('0x2'));var moment=require(_0x5bbd('0x3'));var BPromise=require(_0x5bbd('0x4'));var rp=require(_0x5bbd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bbd('0x6'));var config=require(_0x5bbd('0x7'));var attributes=require(_0x5bbd('0x8'));module['exports']=function(_0x21af62,_0x3b4f5f){return _0x21af62[_0x5bbd('0x9')]('SmsApplication',attributes,{'tableName':_0x5bbd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5bbd('0xb'),'collate':_0x5bbd('0xc')});}; \ No newline at end of file +var _0x313c=['request-promise','path','rimraf','define','SmsApplication','sms_applications','utf8mb4','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4df988,_0x39b49a){var _0x537f78=function(_0x16fb6d){while(--_0x16fb6d){_0x4df988['push'](_0x4df988['shift']());}};_0x537f78(++_0x39b49a);}(_0x313c,0x1f3));var _0xc313=function(_0x2adc7f,_0xfcf6ae){_0x2adc7f=_0x2adc7f-0x0;var _0xe7193e=_0x313c[_0x2adc7f];return _0xe7193e;};'use strict';var _=require(_0xc313('0x0'));var util=require('util');var logger=require(_0xc313('0x1'))(_0xc313('0x2'));var moment=require(_0xc313('0x3'));var BPromise=require(_0xc313('0x4'));var rp=require(_0xc313('0x5'));var fs=require('fs');var path=require(_0xc313('0x6'));var rimraf=require(_0xc313('0x7'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module['exports']=function(_0x283fb4,_0x344308){return _0x283fb4[_0xc313('0x8')](_0xc313('0x9'),attributes,{'tableName':_0xc313('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc313('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 301e7f1..05e0ed6 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 _0xb1ef=['info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x383baa,_0x2d32ad){var _0x409b2a=function(_0x58c9a7){while(--_0x58c9a7){_0x383baa['push'](_0x383baa['shift']());}};_0x409b2a(++_0x2d32ad);}(_0xb1ef,0x93));var _0xfb1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1ef[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xfb1e('0x0'));var util=require(_0xfb1e('0x1'));var moment=require('moment');var BPromise=require(_0xfb1e('0x2'));var rs=require(_0xfb1e('0x3'));var fs=require('fs');var Redis=require(_0xfb1e('0x4'));var db=require(_0xfb1e('0x5'))['db'];var utils=require(_0xfb1e('0x6'));var logger=require(_0xfb1e('0x7'))(_0xfb1e('0x8'));var config=require(_0xfb1e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfb1e('0xa')][_0xfb1e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1455fa,_0xccf70,_0x502d8e){return new BPromise(function(_0x5eadcc,_0x3c7643){return client[_0xfb1e('0xc')](_0x1455fa,_0x502d8e)[_0xfb1e('0xd')](function(_0x1ac2dd){logger[_0xfb1e('0xe')](_0xfb1e('0xf'),_0xccf70,_0xfb1e('0x10'));logger[_0xfb1e('0x11')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0xccf70,_0xfb1e('0x10'),JSON[_0xfb1e('0x12')](_0x1ac2dd));if(_0x1ac2dd[_0xfb1e('0x13')]){if(_0x1ac2dd[_0xfb1e('0x13')][_0xfb1e('0x14')]===0x1f4){logger[_0xfb1e('0x13')](_0xfb1e('0xf'),_0xccf70,_0x1ac2dd['error'][_0xfb1e('0x15')]);return _0x3c7643(_0x1ac2dd[_0xfb1e('0x13')]['message']);}logger[_0xfb1e('0x13')](_0xfb1e('0xf'),_0xccf70,_0x1ac2dd[_0xfb1e('0x13')][_0xfb1e('0x15')]);return _0x5eadcc(_0x1ac2dd[_0xfb1e('0x13')]['message']);}else{logger[_0xfb1e('0xe')](_0xfb1e('0xf'),_0xccf70,_0xfb1e('0x10'));_0x5eadcc(_0x1ac2dd[_0xfb1e('0x16')][_0xfb1e('0x15')]);}})['catch'](function(_0x2f3d7e){logger[_0xfb1e('0x13')](_0xfb1e('0xf'),_0xccf70,_0x2f3d7e);_0x3c7643(_0x2f3d7e);});});} \ No newline at end of file +var _0x4b74=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','code','message','SmsApplication,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0x4b74,0x103));var _0x44b7=function(_0x439f49,_0x34c786){_0x439f49=_0x439f49-0x0;var _0x4de539=_0x4b74[_0x439f49];return _0x4de539;};'use strict';var _=require(_0x44b7('0x0'));var util=require(_0x44b7('0x1'));var moment=require(_0x44b7('0x2'));var BPromise=require('bluebird');var rs=require(_0x44b7('0x3'));var fs=require('fs');var Redis=require(_0x44b7('0x4'));var db=require(_0x44b7('0x5'))['db'];var utils=require(_0x44b7('0x6'));var logger=require(_0x44b7('0x7'))(_0x44b7('0x8'));var config=require(_0x44b7('0x9'));var jayson=require(_0x44b7('0xa'));var client=jayson['client'][_0x44b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2174f2,_0x7b80e9,_0x4a582b){return new BPromise(function(_0x45dfbe,_0xabf05c){return client[_0x44b7('0xc')](_0x2174f2,_0x4a582b)['then'](function(_0x7d4b17){logger[_0x44b7('0xd')]('SmsApplication,\x20%s,\x20%s',_0x7b80e9,_0x44b7('0xe'));logger[_0x44b7('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x7b80e9,_0x44b7('0xe'),JSON[_0x44b7('0x10')](_0x7d4b17));if(_0x7d4b17[_0x44b7('0x11')]){if(_0x7d4b17['error'][_0x44b7('0x12')]===0x1f4){logger[_0x44b7('0x11')]('SmsApplication,\x20%s,\x20%s',_0x7b80e9,_0x7d4b17[_0x44b7('0x11')]['message']);return _0xabf05c(_0x7d4b17[_0x44b7('0x11')][_0x44b7('0x13')]);}logger[_0x44b7('0x11')]('SmsApplication,\x20%s,\x20%s',_0x7b80e9,_0x7d4b17['error'][_0x44b7('0x13')]);return _0x45dfbe(_0x7d4b17['error']['message']);}else{logger['info'](_0x44b7('0x14'),_0x7b80e9,_0x44b7('0xe'));_0x45dfbe(_0x7d4b17['result'][_0x44b7('0x13')]);}})[_0x44b7('0x15')](function(_0x3528c8){logger[_0x44b7('0x11')](_0x44b7('0x14'),_0x7b80e9,_0x3528c8);_0xabf05c(_0x3528c8);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6b3a810..6c7c665 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 _0x6cb4=['./smsInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','getMessages','/:id/download','create','post','/:id/messages','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x477795,_0x181d00){var _0x49e3b6=function(_0x39a2e0){while(--_0x39a2e0){_0x477795['push'](_0x477795['shift']());}};_0x49e3b6(++_0x181d00);}(_0x6cb4,0xff));var _0x46cb=function(_0x382bcd,_0x268071){_0x382bcd=_0x382bcd-0x0;var _0x4268ae=_0x6cb4[_0x382bcd];return _0x4268ae;};'use strict';var multer=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var path=require(_0x46cb('0x2'));var timeout=require(_0x46cb('0x3'));var express=require(_0x46cb('0x4'));var router=express[_0x46cb('0x5')]();var fs_extra=require(_0x46cb('0x6'));var auth=require(_0x46cb('0x7'));var interaction=require(_0x46cb('0x8'));var config=require('../../config/environment');var controller=require(_0x46cb('0x9'));router['get']('/',auth[_0x46cb('0xa')](),controller['index']);router[_0x46cb('0xb')](_0x46cb('0xc'),auth[_0x46cb('0xa')](),controller[_0x46cb('0xd')]);router[_0x46cb('0xb')](_0x46cb('0xe'),auth['isAuthenticated'](),controller[_0x46cb('0xf')]);router[_0x46cb('0xb')]('/:id/messages',auth[_0x46cb('0xa')](),controller[_0x46cb('0x10')]);router['get'](_0x46cb('0x11'),auth[_0x46cb('0xa')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x46cb('0x12')]);router[_0x46cb('0x13')](_0x46cb('0x14'),auth[_0x46cb('0xa')](),controller['addMessage']);router[_0x46cb('0x13')](_0x46cb('0x15'),auth[_0x46cb('0xa')](),interaction[_0x46cb('0x16')](_0x46cb('0x17'),_0x46cb('0x18')),controller[_0x46cb('0x19')]);router[_0x46cb('0x1a')](_0x46cb('0xe'),auth[_0x46cb('0xa')](),interaction[_0x46cb('0x16')]('sms',_0x46cb('0x1b')),controller['update']);router[_0x46cb('0x1c')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x46cb('0x17'),_0x46cb('0x1d')),controller[_0x46cb('0x1e')]);router[_0x46cb('0x1c')](_0x46cb('0x15'),auth[_0x46cb('0xa')](),controller[_0x46cb('0x1f')]);module[_0x46cb('0x20')]=router; \ No newline at end of file +var _0x9354=['/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0xd533d1,_0x5ee548){var _0x475db5=function(_0x1a64d8){while(--_0x1a64d8){_0xd533d1['push'](_0xd533d1['shift']());}};_0x475db5(++_0x5ee548);}(_0x9354,0x96));var _0x4935=function(_0x33e93d,_0x1a8423){_0x33e93d=_0x33e93d-0x0;var _0x19e99d=_0x9354[_0x33e93d];return _0x19e99d;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['get'](_0x4935('0xd'),auth['isAuthenticated'](),controller[_0x4935('0xe')]);router[_0x4935('0x8')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x10')]);router[_0x4935('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x4935('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4935('0x12')]);router[_0x4935('0x13')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x14')]);router[_0x4935('0x13')](_0x4935('0x15'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')](_0x4935('0x17'),_0x4935('0x18')),controller[_0x4935('0x19')]);router[_0x4935('0x1a')](_0x4935('0xd'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')]('sms',_0x4935('0x1b')),controller[_0x4935('0x1c')]);router[_0x4935('0x1d')](_0x4935('0xd'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')]('sms',_0x4935('0x1e')),controller[_0x4935('0x1f')]);router['delete'](_0x4935('0x15'),auth[_0x4935('0x9')](),controller[_0x4935('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 650af16..ddaddf6 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 _0x15c6=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x48d91a,_0x2234ff){var _0x675bfa=function(_0x477fd9){while(--_0x477fd9){_0x48d91a['push'](_0x48d91a['shift']());}};_0x675bfa(++_0x2234ff);}(_0x15c6,0x1cd));var _0x615c=function(_0x2f023d,_0x29dfe5){_0x2f023d=_0x2f023d-0x0;var _0x4ef240=_0x15c6[_0x2f023d];return _0x4ef240;};'use strict';var Sequelize=require(_0x615c('0x0'));var moment=require(_0x615c('0x1'));module[_0x615c('0x2')]={'closed':{'type':Sequelize[_0x615c('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x615c('0x4')]},'disposition':{'type':Sequelize[_0x615c('0x5')]},'secondDisposition':{'type':Sequelize[_0x615c('0x5')]},'thirdDisposition':{'type':Sequelize[_0x615c('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x615c('0x6')]('in',_0x615c('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x615c('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x615c('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x615c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa423=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x802997,_0x5534a2){var _0x35c641=function(_0x22c4f2){while(--_0x22c4f2){_0x802997['push'](_0x802997['shift']());}};_0x35c641(++_0x5534a2);}(_0xa423,0x16c));var _0x3a42=function(_0x3f392c,_0x309dc6){_0x3f392c=_0x3f392c-0x0;var _0x34858b=_0xa423[_0x3f392c];return _0x34858b;};'use strict';var Sequelize=require(_0x3a42('0x0'));var moment=require(_0x3a42('0x1'));module[_0x3a42('0x2')]={'closed':{'type':Sequelize[_0x3a42('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3a42('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3a42('0x5')]},'thirdDisposition':{'type':Sequelize[_0x3a42('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x3a42('0x5')]},'read1stAt':{'type':Sequelize[_0x3a42('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3a42('0x6')]('in',_0x3a42('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3a42('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x3a42('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3a42('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 67c0ab4..90b5234 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 _0x07a5=['rows','addTags','setTags','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','push','firstName','lastName','Messages','secret','Account','Owner','get','mkdirSync','N.A.','out','renderFile','views','downloadInteraction.ejs','.pdf','Sms','createPdfFromHTML','log','err','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','SmsInteraction','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','parseSearch','search','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','some','compact','isEmpty','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','merge','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','show','params','includeAll','options','create','describe','addMessage','SmsMessage','ids','getMessages','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll'];(function(_0x1c9efb,_0x45b205){var _0x1eec67=function(_0x22e1de){while(--_0x22e1de){_0x1c9efb['push'](_0x1c9efb['shift']());}};_0x1eec67(++_0x45b205);}(_0x07a5,0x1e8));var _0x507a=function(_0x236770,_0x8553){_0x236770=_0x236770-0x0;var _0x521ffd=_0x07a5[_0x236770];return _0x521ffd;};'use strict';var emlformat=require(_0x507a('0x0'));var rimraf=require(_0x507a('0x1'));var zipdir=require(_0x507a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x507a('0x3'));var moment=require(_0x507a('0x4'));var BPromise=require(_0x507a('0x5'));var Mustache=require('mustache');var util=require(_0x507a('0x6'));var path=require('path');var sox=require(_0x507a('0x7'));var csv=require(_0x507a('0x8'));var ejs=require(_0x507a('0x9'));var fs=require('fs');var fs_extra=require(_0x507a('0xa'));var _=require(_0x507a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x507a('0xc'));var deskjs=require(_0x507a('0xd'));var toCsv=require(_0x507a('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x507a('0xe'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x507a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x507a('0x10'))(_0x507a('0x11'));var utils=require(_0x507a('0x12'));var config=require(_0x507a('0x13'));var licenseUtil=require(_0x507a('0x14'));var db=require(_0x507a('0x15'))['db'];config['redis']=_[_0x507a('0x16')](config['redis'],{'host':_0x507a('0x17'),'port':0x18eb});var socket=require(_0x507a('0x18'))(new Redis(config['redis']));require(_0x507a('0x19'))[_0x507a('0x1a')](socket);function respondWithStatusCode(_0x5bb8da,_0x14e7c8){_0x14e7c8=_0x14e7c8||0xcc;return function(_0xceac9a){if(_0xceac9a){return _0x5bb8da[_0x507a('0x1b')](_0x14e7c8);}return _0x5bb8da['status'](_0x14e7c8)['end']();};}function respondWithResult(_0x29e743,_0x1e9deb){_0x1e9deb=_0x1e9deb||0xc8;return function(_0xdb066a){if(_0xdb066a){return _0x29e743[_0x507a('0x1c')](_0x1e9deb)['json'](_0xdb066a);}};}function respondWithFilteredResult(_0x502c6b,_0x16154c){return function(_0x150985){if(_0x150985){var _0x288008=typeof _0x16154c[_0x507a('0x1d')]===_0x507a('0x1e')&&typeof _0x16154c[_0x507a('0x1f')]===_0x507a('0x1e');var _0x5b286f=_0x150985[_0x507a('0x20')];var _0x1b896a=_0x288008?0x0:_0x16154c['offset'];var _0x24b802=_0x288008?_0x150985['count']:_0x16154c['offset']+_0x16154c['limit'];var _0x2e5cfe;if(_0x24b802>=_0x5b286f){_0x24b802=_0x5b286f;_0x2e5cfe=0xc8;}else{_0x2e5cfe=0xce;}_0x502c6b[_0x507a('0x1c')](_0x2e5cfe);return _0x502c6b[_0x507a('0x21')](_0x507a('0x22'),_0x1b896a+'-'+_0x24b802+'/'+_0x5b286f)[_0x507a('0x23')](_0x150985);}return null;};}function patchUpdates(_0xd58ebb){return function(_0x42f27c){try{jsonpatch[_0x507a('0x24')](_0x42f27c,_0xd58ebb,!![]);}catch(_0x6d80c2){return BPromise[_0x507a('0x25')](_0x6d80c2);}return _0x42f27c[_0x507a('0x26')]();};}function saveUpdates(_0x5c3e03,_0x30f4e6){return function(_0xdd93b2){if(_0xdd93b2){return _0xdd93b2[_0x507a('0x27')](_0x5c3e03)[_0x507a('0x28')](function(_0x1bb330){return _0x1bb330;});}return null;};}function removeEntity(_0x506076,_0x60ae4f){return function(_0x4f7c35){if(_0x4f7c35){return _0x4f7c35[_0x507a('0x29')]()['then'](function(){_0x506076[_0x507a('0x1c')](0xcc)[_0x507a('0x2a')]();});}};}function handleEntityNotFound(_0x4db07d,_0x4f9a0b){return function(_0x2c882d){if(!_0x2c882d){_0x4db07d[_0x507a('0x1b')](0x194);}return _0x2c882d;};}function handleError(_0x1eb777,_0x5e5bb4){_0x5e5bb4=_0x5e5bb4||0x1f4;return function(_0x180ebd){logger[_0x507a('0x2b')](_0x180ebd['stack']);if(_0x180ebd[_0x507a('0x2c')]){delete _0x180ebd[_0x507a('0x2c')];}_0x1eb777['status'](_0x5e5bb4)[_0x507a('0x2d')](_0x180ebd);};}function getInteractionUsers(_0x3d2f91,_0xb4110e){return new BPromise(function(_0x2beb36,_0x4233c0){try{if(_0xb4110e[_0x3d2f91['id']]){_0x3d2f91[_0x507a('0x2e')]=_[_0x507a('0x2f')](_0xb4110e[_0x3d2f91['id']],function(_0x54c3a2){return{'id':_0x54c3a2['id'],'fullname':_0x54c3a2[_0x507a('0x30')]};});}}catch(_0x1476c2){_0x4233c0(_0x1476c2);}_0x2beb36(_0x3d2f91);});}function getInteractionTags(_0x2d60,_0x46bc12){return new BPromise(function(_0x254463,_0x477c32){try{if(_0x2d60[_0x507a('0x31')]){_0x2d60[_0x507a('0x32')]=[];_0x2d60['TagIds'][_0x507a('0x33')](',')[_0x507a('0x34')](function(_0x1625d7){_0x2d60['Tags']['push'](_0x46bc12[_0x1625d7]);});}delete _0x2d60[_0x507a('0x31')];}catch(_0x21dcce){_0x477c32(_0x21dcce);}_0x254463(_0x2d60);});}function updateSmsInteraction(_0x162c36,_0x171616,_0x477d66){return new BPromise(function(_0x10b68a,_0x1810d0){return getInteractionUsers(_0x162c36,_0x477d66)[_0x507a('0x28')](function(_0xf93a21){return getInteractionTags(_0xf93a21,_0x171616);})['then'](function(_0x39e8a6){return getStateInteraction(_0x39e8a6);})[_0x507a('0x28')](function(_0x273c66){_0x10b68a(_0x273c66);})[_0x507a('0x35')](function(_0x4b3d42){_0x1810d0(_0x4b3d42);});});}function getStateInteraction(_0x31ab6e){return new BPromise(function(_0x214e89){_0x31ab6e[_0x507a('0x36')]=0x0;_0x31ab6e[_0x507a('0x37')]=0x0;_0x31ab6e[_0x507a('0x38')]=0x0;_0x31ab6e[_0x507a('0x39')]=0x0;_0x31ab6e[_0x507a('0x3a')]=0x0;if(!_0x31ab6e[_0x507a('0x3b')]&&!_0x31ab6e[_0x507a('0x3c')]){_0x31ab6e[_0x507a('0x36')]+=0x1;}if(!_0x31ab6e['closed']&&_0x31ab6e[_0x507a('0x3c')]){_0x31ab6e[_0x507a('0x37')]+=0x1;if(_0x31ab6e[_0x507a('0x36')]){_0x31ab6e[_0x507a('0x36')]-=0x1;}}if(_0x31ab6e[_0x507a('0x3b')]&&_0x31ab6e[_0x507a('0x3c')]){_0x31ab6e[_0x507a('0x38')]+=0x1;if(_0x31ab6e[_0x507a('0x37')]){_0x31ab6e['talking']-=0x1;}}if(_0x31ab6e[_0x507a('0x3b')]&&!_0x31ab6e[_0x507a('0x3c')]){_0x31ab6e[_0x507a('0x39')]+=0x1;if(_0x31ab6e[_0x507a('0x36')]){_0x31ab6e[_0x507a('0x36')]-=0x1;}}_0x31ab6e[_0x507a('0x3a')]+=0x1;_0x214e89(_0x31ab6e);});}exports[_0x507a('0x3d')]=function(_0x113cbb,_0x5d93fa){var _0x2bfd67={},_0x4a4f62={},_0xc2ac51={'count':0x0,'rows':[]};var _0xeb919a=_[_0x507a('0x2f')](db[_0x507a('0x3e')][_0x507a('0x3f')],function(_0x2724d1){return{'name':_0x2724d1['fieldName'],'type':_0x2724d1[_0x507a('0x40')]['key']};});_0x4a4f62[_0x507a('0x41')]=_[_0x507a('0x2f')](_0xeb919a,_0x507a('0x2c'));_0x4a4f62[_0x507a('0x42')]=_[_0x507a('0x43')](_0x113cbb[_0x507a('0x42')]);_0x4a4f62[_0x507a('0x44')]=_[_0x507a('0x45')](_0x4a4f62[_0x507a('0x41')],_0x4a4f62[_0x507a('0x42')]);_0x2bfd67['attributes']=_['intersection'](_0x4a4f62[_0x507a('0x41')],qs[_0x507a('0x46')](_0x113cbb[_0x507a('0x42')][_0x507a('0x46')]));_0x2bfd67['attributes']=_0x2bfd67[_0x507a('0x47')][_0x507a('0x48')]?_0x2bfd67[_0x507a('0x47')]:_0x4a4f62[_0x507a('0x41')];if(!_0x113cbb[_0x507a('0x42')]['hasOwnProperty'](_0x507a('0x49'))){_0x2bfd67[_0x507a('0x1f')]=qs[_0x507a('0x1f')](_0x113cbb[_0x507a('0x42')]['limit']);_0x2bfd67[_0x507a('0x1d')]=qs[_0x507a('0x1d')](_0x113cbb[_0x507a('0x42')][_0x507a('0x1d')]);}_0x2bfd67[_0x507a('0x4a')]=qs[_0x507a('0x4b')](_0x113cbb[_0x507a('0x42')][_0x507a('0x4b')]);_0x2bfd67[_0x507a('0x4c')]=qs['filters'](_[_0x507a('0x4d')](_0x113cbb[_0x507a('0x42')],_0x4a4f62[_0x507a('0x44')]),_0xeb919a);var _0x3fdfc6=[];var _0x5a0ee1=squel[_0x507a('0x4e')]()['field']('id')[_0x507a('0x4f')](_0x507a('0x2c'))['field']('color')[_0x507a('0x50')](_0x507a('0x51'));var _0x3088c2=squel['select']()[_0x507a('0x4f')]('u.id')['field'](_0x507a('0x52'))[_0x507a('0x4f')](_0x507a('0x53'))[_0x507a('0x50')](_0x507a('0x54'),'ui')[_0x507a('0x55')](_0x507a('0x56'),'u',_0x507a('0x57'));var _0x39e0ee=squel[_0x507a('0x4e')]()['from'](_0x507a('0x58'),'i')['left_join']('cm_contacts','c',_0x507a('0x59'))[_0x507a('0x55')](_0x507a('0x56'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x507a('0x5a'),'a','a.id\x20=\x20i.SmsAccountId')[_0x507a('0x55')](_0x507a('0x5b'),'me',_0x507a('0x5c'))[_0x507a('0x55')](_0x507a('0x5d'),'it',_0x507a('0x5e'))['left_join'](_0x507a('0x51'),'t',_0x507a('0x5f'));var _0x237448=squel['expr']();var _0x3785db=[];var _0x5ec25b=squel['expr']();var _0x24c7be;if(_0x113cbb[_0x507a('0x42')]['search']){_0x24c7be=as[_0x507a('0x60')](_0x113cbb[_0x507a('0x42')][_0x507a('0x61')]);var _0x2ab87c=_0x24c7be['sqlOperator'];for(var _0x76387=0x0;_0x76387<_0x24c7be[_0x507a('0x62')][_0x507a('0x48')];_0x76387++){var _0x26542b=_0x24c7be['conditions'][_0x76387];var _0x57ed6b='i';var _0x527030=_[_0x507a('0x63')](_0xeb919a,[_0x507a('0x2c'),_0x26542b[_0x507a('0x4f')]]);if(!_0x527030){switch(_0x26542b['field']){case _0x507a('0x64'):if(_0x26542b[_0x507a('0x65')]==0x1){_0x39e0ee[_0x507a('0x66')]('`'+_0x26542b[_0x507a('0x4f')]+_0x507a('0x67'));}else{_0x39e0ee[_0x507a('0x66')]('`'+_0x26542b[_0x507a('0x4f')]+'`\x20>\x200');}break;case _0x507a('0x68'):if(_0x26542b['operator']===_0x507a('0x69')){if(_0x26542b[_0x507a('0x65')]['split']('\x20')[_0x507a('0x48')]>0x1){_0x237448[_0x2ab87c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x507a('0x6a')](_0x26542b[_0x507a('0x65')]),null);}else{var _0x275fd7='%'+_0x26542b[_0x507a('0x65')]+'%';_0x237448[_0x2ab87c](_0x507a('0x6b'),_0x275fd7,_0x275fd7,_0x275fd7);}}else{_0x527030=_[_0x507a('0x63')](_0xeb919a,[_0x507a('0x2c'),_0x507a('0x6c')]);_0x26542b['field']=_0x507a('0x6c');_0x59a160=as[_0x507a('0x6d')](_0x57ed6b,_0x527030['type'],_0x26542b);_0x237448[_0x2ab87c](_0x59a160['text'],_0x59a160[_0x507a('0x65')][_0x507a('0x6e')],_0x59a160[_0x507a('0x65')][_0x507a('0x2a')]);}break;case'Tag':var _0x3d9a65=_0x26542b[_0x507a('0x65')][_0x507a('0x33')](',')[_0x507a('0x2f')](function(_0x589854){return Number(_0x589854);});_0x3d9a65[_0x507a('0x34')](function(_0x870fda){_0x5ec25b['or'](_0x507a('0x6f'),'%,'+_0x870fda+',%');});_0x3785db=_['union'](_0x3785db,_0x3d9a65);break;case _0x507a('0x70'):if(_0x26542b[_0x507a('0x71')]===_0x507a('0x69')){_0x237448[_0x2ab87c](_0x507a('0x72'),'%'+_0x26542b['value']+'%',null);}else{_0x527030=_[_0x507a('0x63')](_0xeb919a,[_0x507a('0x2c'),_0x507a('0x3c')]);_0x26542b[_0x507a('0x4f')]=_0x507a('0x3c');_0x59a160=as[_0x507a('0x6d')](_0x57ed6b,_0x527030[_0x507a('0x40')],_0x26542b);_0x237448[_0x2ab87c](_0x59a160[_0x507a('0x73')],_0x59a160['value']['start'],_0x59a160[_0x507a('0x65')][_0x507a('0x2a')]);}break;case _0x507a('0x74'):_0x59a160=as[_0x507a('0x6d')]('me',null,_0x26542b);_0x237448[_0x2ab87c](_0x59a160['text'],_0x59a160[_0x507a('0x65')][_0x507a('0x6e')],_0x59a160[_0x507a('0x65')][_0x507a('0x2a')]);break;}}else{var _0x59a160=as[_0x507a('0x6d')](_0x57ed6b,_0x527030[_0x507a('0x40')],_0x26542b);_0x237448[_0x2ab87c](_0x59a160[_0x507a('0x73')],_0x59a160[_0x507a('0x65')][_0x507a('0x6e')],_0x59a160['value']['end']);}}}else{var _0x5f448f=_(_0x113cbb[_0x507a('0x42')])[_0x507a('0x43')]()[_0x507a('0x2f')](function(_0x1355d2){return _[_0x507a('0x75')](_0xeb919a,[_0x507a('0x2c'),_0x1355d2])?_0x1355d2:undefined;})[_0x507a('0x76')]()[_0x507a('0x65')]();if(!_[_0x507a('0x77')](_0x5f448f)){_0x5f448f[_0x507a('0x34')](function(_0x3c2c02){if(_0x3c2c02==='SmsAccountId'){_0x39e0ee[_0x507a('0x4c')](_0x507a('0x78'),[][_0x507a('0x79')](_0x113cbb[_0x507a('0x42')][_0x3c2c02]));}else if(_0x3c2c02===_0x507a('0x7a')){var _0xd2c5fc=JSON[_0x507a('0x7b')](_0x113cbb['query'][_0x3c2c02])[_0x507a('0x7c')];var _0x56ab36=JSON['parse'](_0x113cbb[_0x507a('0x42')][_0x3c2c02])[_0x507a('0x7d')];_0x39e0ee['where'](_0x507a('0x7e'),_0xd2c5fc,_0x56ab36);}else{if(_0x113cbb[_0x507a('0x42')][_0x3c2c02]===_0x507a('0x7f')){_0x39e0ee[_0x507a('0x4c')]('i.'+_0x3c2c02+'\x20IS\x20NULL');}else{_0x39e0ee['where']('i.'+_0x3c2c02+_0x507a('0x80'),_0x113cbb[_0x507a('0x42')][_0x3c2c02]);}}});}if(_0x113cbb[_0x507a('0x42')][_0x507a('0x81')]){if(_0x113cbb[_0x507a('0x42')]['read']==0x1){_0x39e0ee['having']('`unreadMessages`\x20=\x200');}else{_0x39e0ee[_0x507a('0x66')](_0x507a('0x82'));}}if(_0x113cbb[_0x507a('0x42')][_0x507a('0x83')]){_0x3785db=_[_0x507a('0x84')](_0x113cbb[_0x507a('0x42')]['tag'])?_0x113cbb['query'][_0x507a('0x83')]:new Array(_0x113cbb[_0x507a('0x42')][_0x507a('0x83')]);_0x3785db[_0x507a('0x34')](function(_0x5bcd17){_0x5ec25b['or'](_0x507a('0x6f'),'%,'+_0x5bcd17+',%');});}if(_0x113cbb[_0x507a('0x42')][_0x507a('0x85')]){var _0x5079f9=_0x113cbb['query'][_0x507a('0x85')][_0x507a('0x86')]('\x5c','\x5c\x5c')[_0x507a('0x86')](/'/g,'\x27\x27');if(qs[_0x507a('0x87')](_0x5079f9)){_0x237448['or']('i.id\x20LIKE\x20?',_0x5079f9+'%')['or'](_0x507a('0x88'),_0x5079f9+'%');}else{_0x237448['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x507a('0x6a')](_0x5079f9))['or'](_0x507a('0x89'),_0x5079f9+'%');}}}_0x39e0ee[_0x507a('0x4c')](_0x237448);_0x39e0ee['group']('i.id');var _0x32a3a7={'type':db[_0x507a('0x8a')][_0x507a('0x8b')][_0x507a('0x8c')],'raw':!![]};var _0x353d25=_0x39e0ee[_0x507a('0x8d')]();_0x353d25[_0x507a('0x4f')](_0x507a('0x8e'));_0x353d25['field'](_0x507a('0x8f'),_0x507a('0x64'));if(_0x2bfd67[_0x507a('0x4a')]){_0x2bfd67[_0x507a('0x4a')][_0x507a('0x34')](function(_0xbff7ec){var _0x2bb652=_0xbff7ec[0x0]===_0x507a('0x90')?_0xbff7ec[0x0]:'i.'+_0xbff7ec[0x0];_0x39e0ee[_0x507a('0x4a')](_0x2bb652,_0xbff7ec[0x1]==='DESC'?![]:!![]);});}if(!_[_0x507a('0x77')](_0x3785db)){_0x39e0ee['having'](_0x5ec25b);_0x353d25[_0x507a('0x4c')](_0x507a('0x91'),_0x3785db);}BPromise['resolve']()[_0x507a('0x28')](function(){if(!_0x24c7be){if(_0x113cbb['query'][_0x507a('0x92')])return;_0x353d25[_0x507a('0x4c')](_0x507a('0x93'));_0x39e0ee[_0x507a('0x4c')](_0x507a('0x93'));return;}if(_0x113cbb[_0x507a('0x94')]['role']!==_0x507a('0x95'))return;return _0x113cbb['user'][_0x507a('0x96')]({'attributes':['id'],'raw':!![]})[_0x507a('0x28')](function(_0x372764){if(_[_0x507a('0x77')](_0x372764)){_0x353d25['where']('i.SmsAccountId\x20IS\x20NULL');_0x39e0ee['where'](_0x507a('0x97'));}else{_0x353d25[_0x507a('0x4c')]('i.SmsAccountId\x20IN\x20?',_[_0x507a('0x2f')](_0x372764,'id'));_0x39e0ee[_0x507a('0x4c')]('i.SmsAccountId\x20IN\x20?',_[_0x507a('0x2f')](_0x372764,'id'));}});})[_0x507a('0x28')](function(){if(_0x113cbb['user'][_0x507a('0x98')]===_0x507a('0x95')&&!_0x24c7be&&!_0x113cbb[_0x507a('0x42')][_0x507a('0x92')])return[];return db[_0x507a('0x99')]['query'](_0x353d25[_0x507a('0x9a')](),_0x32a3a7);})['then'](function(_0x31b090){_0xc2ac51[_0x507a('0x20')]=_0x31b090[_0x507a('0x48')];if(_0xc2ac51[_0x507a('0x20')]===0x0)return[];return db[_0x507a('0x99')][_0x507a('0x42')](_0x5a0ee1[_0x507a('0x9a')](),_0x32a3a7)[_0x507a('0x28')](function(_0x547ac0){_0x3fdfc6=_['keyBy'](_0x547ac0,'id');_0x32a3a7=_[_0x507a('0x9b')](_0x32a3a7,{'model':db[_0x507a('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x113cbb[_0x507a('0x42')][_0x507a('0x46')]){_0x2bfd67[_0x507a('0x47')][_0x507a('0x34')](function(_0x348582){_0x39e0ee[_0x507a('0x4f')]('i.'+_0x348582);});}else{_0x39e0ee[_0x507a('0x4f')](_0x507a('0x8f'),_0x507a('0x64'));_0x39e0ee[_0x507a('0x4f')]('a.key',_0x507a('0x9c'));_0x39e0ee[_0x507a('0x4f')]('a.mandatoryDisposition',_0x507a('0x9d'));_0x39e0ee[_0x507a('0x4f')](_0x507a('0x9e'),_0x507a('0x90'));_0x39e0ee['field']('i.*');_0x39e0ee[_0x507a('0x4f')](_0x507a('0x9f'),_0x507a('0xa0'));_0x39e0ee[_0x507a('0x4f')](_0x507a('0xa1'),_0x507a('0xa2'));_0x39e0ee['field'](_0x507a('0xa3'),'Contact.email');_0x39e0ee[_0x507a('0x4f')](_0x507a('0xa4'),_0x507a('0xa5'));_0x39e0ee[_0x507a('0x4f')](_0x507a('0xa6'),_0x507a('0xa7'));_0x39e0ee[_0x507a('0x4f')](_0x507a('0xa8'),'Contact.fax');_0x39e0ee[_0x507a('0x4f')]('o.fullname','Owner.fullname');_0x39e0ee[_0x507a('0x4f')]('o.internal','Owner.internal');_0x39e0ee['field'](_0x507a('0xa9'),_0x507a('0x31'));}if(_0x2bfd67[_0x507a('0x1f')])_0x39e0ee[_0x507a('0x1f')](_0x2bfd67[_0x507a('0x1f')]);if(_0x2bfd67[_0x507a('0x1d')])_0x39e0ee[_0x507a('0x1d')](_0x2bfd67[_0x507a('0x1d')]);return db['sequelize']['query'](_0x39e0ee[_0x507a('0x9a')](),_0x32a3a7);})['then'](function(_0x4c2b26){if(_0x4c2b26[_0x507a('0x48')]>0x0)_0x3088c2[_0x507a('0x4c')](_0x507a('0xaa'),_[_0x507a('0x2f')](_0x4c2b26,'id'));return db[_0x507a('0x99')][_0x507a('0x42')](_0x3088c2[_0x507a('0x9a')](),_0x32a3a7)[_0x507a('0x28')](function(_0x4ae118){var _0x5c142d=_[_0x507a('0xab')](_0x4ae118,_0x507a('0xac'));var _0x364ff2=[];_0x4c2b26[_0x507a('0x34')](function(_0x2de056){_0x364ff2['push'](updateSmsInteraction(_0x2de056,_0x3fdfc6,_0x5c142d));});return BPromise[_0x507a('0xad')](_0x364ff2);});});})[_0x507a('0x28')](function(_0x1cee7b){_0xc2ac51['rows']=_0x1cee7b;return _0xc2ac51;})['then'](respondWithFilteredResult(_0x5d93fa,_0x2bfd67))[_0x507a('0x35')](handleError(_0x5d93fa,null));};exports[_0x507a('0xae')]=function(_0x40ad46,_0x4480ba){var _0xddf14={'raw':![],'where':{'id':_0x40ad46[_0x507a('0xaf')]['id']}},_0x192ab5={};_0x192ab5[_0x507a('0x41')]=_[_0x507a('0x43')](db[_0x507a('0x3e')][_0x507a('0x3f')]);_0x192ab5[_0x507a('0x42')]=_[_0x507a('0x43')](_0x40ad46[_0x507a('0x42')]);_0x192ab5[_0x507a('0x44')]=_[_0x507a('0x45')](_0x192ab5[_0x507a('0x41')],_0x192ab5[_0x507a('0x42')]);_0xddf14[_0x507a('0x47')]=_[_0x507a('0x45')](_0x192ab5[_0x507a('0x41')],qs[_0x507a('0x46')](_0x40ad46['query'][_0x507a('0x46')]));_0xddf14['attributes']=_0xddf14[_0x507a('0x47')][_0x507a('0x48')]?_0xddf14[_0x507a('0x47')]:_0x192ab5[_0x507a('0x41')];if(_0x40ad46[_0x507a('0x42')][_0x507a('0xb0')]){_0xddf14['include']=[{'all':!![]}];}_0xddf14=_['merge']({},_0xddf14,_0x40ad46[_0x507a('0xb1')]);return db['SmsInteraction'][_0x507a('0x63')](_0xddf14)['then'](handleEntityNotFound(_0x4480ba,null))[_0x507a('0x28')](respondWithResult(_0x4480ba,null))[_0x507a('0x35')](handleError(_0x4480ba,null));};exports[_0x507a('0xb2')]=function(_0x4f8ae1,_0x3b3a11){return db[_0x507a('0x3e')][_0x507a('0xb2')](_0x4f8ae1[_0x507a('0x74')],{})[_0x507a('0x28')](respondWithResult(_0x3b3a11,0xc9))[_0x507a('0x35')](handleError(_0x3b3a11,null));};exports[_0x507a('0x27')]=function(_0x3a2adb,_0x298337){if(_0x3a2adb[_0x507a('0x74')]['id']){delete _0x3a2adb['body']['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x3a2adb[_0x507a('0xaf')]['id']}})[_0x507a('0x28')](handleEntityNotFound(_0x298337,null))['then'](saveUpdates(_0x3a2adb[_0x507a('0x74')],null))['then'](respondWithResult(_0x298337,null))['catch'](handleError(_0x298337,null));};exports[_0x507a('0x29')]=function(_0x48762e,_0x180b9){return db[_0x507a('0x3e')][_0x507a('0x63')]({'where':{'id':_0x48762e[_0x507a('0xaf')]['id']}})[_0x507a('0x28')](handleEntityNotFound(_0x180b9,null))[_0x507a('0x28')](removeEntity(_0x180b9,null))[_0x507a('0x35')](handleError(_0x180b9,null));};exports[_0x507a('0xb3')]=function(_0x587faa,_0x164901){return db[_0x507a('0x3e')][_0x507a('0xb3')]()[_0x507a('0x28')](respondWithResult(_0x164901,null))[_0x507a('0x35')](handleError(_0x164901,null));};exports[_0x507a('0xb4')]=function(_0x519495,_0x25cd90,_0x30750c){return db[_0x507a('0xb5')][_0x507a('0x63')]({'where':{'id':_0x519495['params']['id']}})['then'](handleEntityNotFound(_0x25cd90,null))[_0x507a('0x28')](function(_0x39a368){if(_0x39a368){return _0x39a368[_0x507a('0xb4')](_0x519495[_0x507a('0x74')][_0x507a('0xb6')],_['omit'](_0x519495[_0x507a('0x74')],[_0x507a('0xb6'),'id'])||{});}})['then'](respondWithResult(_0x25cd90,null))[_0x507a('0x35')](handleError(_0x25cd90,null));};exports[_0x507a('0xb7')]=function(_0x20d0a3,_0x5c8e49,_0x289c64){var _0x4f3880={'raw':![],'where':{}};var _0xb5f52c={};var _0x5b5436={'count':0x0,'rows':[]};return db[_0x507a('0x3e')][_0x507a('0xb8')]({'where':{'id':_0x20d0a3['params']['id']}})[_0x507a('0x28')](handleEntityNotFound(_0x5c8e49,null))[_0x507a('0x28')](function(_0x125485){if(_0x125485){_0xb5f52c['model']=_[_0x507a('0x43')](db[_0x507a('0xb5')][_0x507a('0x3f')]);_0xb5f52c[_0x507a('0x42')]=_[_0x507a('0x43')](_0x20d0a3['query']);_0xb5f52c[_0x507a('0x44')]=_['intersection'](_0xb5f52c[_0x507a('0x41')],_0xb5f52c[_0x507a('0x42')]);_0x4f3880['attributes']=_[_0x507a('0x45')](_0xb5f52c[_0x507a('0x41')],qs[_0x507a('0x46')](_0x20d0a3['query'][_0x507a('0x46')]));_0x4f3880[_0x507a('0x47')]=_0x4f3880[_0x507a('0x47')][_0x507a('0x48')]?_0x4f3880['attributes']:_0xb5f52c['model'];if(!_0x20d0a3[_0x507a('0x42')][_0x507a('0xb9')]('nolimit')){_0x4f3880[_0x507a('0x1f')]=qs['limit'](_0x20d0a3[_0x507a('0x42')][_0x507a('0x1f')]);_0x4f3880['offset']=qs['offset'](_0x20d0a3[_0x507a('0x42')]['offset']);}_0x4f3880[_0x507a('0x4a')]=qs[_0x507a('0x4b')](_0x20d0a3['query'][_0x507a('0x4b')]);_0x4f3880['where']=qs[_0x507a('0x44')](_[_0x507a('0x4d')](_0x20d0a3[_0x507a('0x42')],_0xb5f52c[_0x507a('0x44')]));_0x4f3880[_0x507a('0x4c')][_0x507a('0xac')]=_0x125485['id'];if(_0x20d0a3[_0x507a('0x42')][_0x507a('0x85')]){_0x4f3880[_0x507a('0x4c')]=_[_0x507a('0x9b')](_0x4f3880[_0x507a('0x4c')],{'$or':_['map'](_0x4f3880['attributes'],function(_0x24be78){var _0x40e923={};_0x40e923[_0x24be78]={'$like':'%'+_0x20d0a3[_0x507a('0x42')][_0x507a('0x85')]+'%'};return _0x40e923;})});}if(_0x20d0a3['query']['$gte']){var _0x4b09a2=_0x20d0a3[_0x507a('0x42')][_0x507a('0x7c')][_0x507a('0x33')](',');var _0xb82acc={};_0xb82acc[_0x4b09a2[0x0]]={'$gte':moment(_0x4b09a2[0x1])[_0x507a('0xba')](_0x507a('0xbb'))};_0x4f3880[_0x507a('0x4c')]=_['merge'](_0x4f3880[_0x507a('0x4c')],_0xb82acc);}_0x4f3880=_[_0x507a('0x9b')]({},_0x4f3880,_0x20d0a3['options']);return db['SmsMessage'][_0x507a('0x20')]({'where':_0x4f3880[_0x507a('0x4c')]})[_0x507a('0x28')](function(_0x25cbc8){_0x5b5436['count']=_0x25cbc8;if(_0x20d0a3[_0x507a('0x42')]['includeAll']){_0x4f3880[_0x507a('0xbc')]=[{'all':!![]}];}return db[_0x507a('0xb5')][_0x507a('0xbd')](_0x4f3880);})[_0x507a('0x28')](function(_0x4d53c7){_0x5b5436[_0x507a('0xbe')]=_0x4d53c7;return _0x5b5436;});}})[_0x507a('0x28')](respondWithFilteredResult(_0x5c8e49,_0x4f3880))['catch'](handleError(_0x5c8e49,null));};exports[_0x507a('0xbf')]=function(_0xcc8153,_0x7197bb,_0x47dd9d){return db[_0x507a('0x3e')][_0x507a('0x63')]({'where':{'id':_0xcc8153[_0x507a('0xaf')]['id']}})[_0x507a('0x28')](handleEntityNotFound(_0x7197bb,null))[_0x507a('0x28')](function(_0x2bef89){if(_0x2bef89){return _0x2bef89[_0x507a('0xc0')](_0xcc8153[_0x507a('0x74')][_0x507a('0xb6')],_['omit'](_0xcc8153[_0x507a('0x74')],[_0x507a('0xb6'),'id'])||{})['spread'](function(){return db[_0x507a('0xc1')][_0x507a('0xbd')]({'attributes':['id',_0x507a('0x2c'),_0x507a('0xc2')],'where':{'id':_0xcc8153[_0x507a('0x74')][_0x507a('0xb6')]}});})[_0x507a('0x28')](function(_0x770e34){socket[_0x507a('0xc3')](_0x507a('0xc4'),{'id':Number(_0xcc8153['params']['id']),'tags':_0x770e34||[]});return{'id':Number(_0xcc8153[_0x507a('0xaf')]['id']),'tags':_0x770e34||[]};});}})[_0x507a('0x28')](respondWithResult(_0x7197bb,null))[_0x507a('0x35')](handleError(_0x7197bb,null));};exports['removeTags']=function(_0x1e8702,_0x4cd046,_0x320059){return db[_0x507a('0x3e')]['find']({'where':{'id':_0x1e8702['params']['id']}})[_0x507a('0x28')](handleEntityNotFound(_0x4cd046,null))[_0x507a('0x28')](function(_0x290a22){if(_0x290a22){return _0x290a22[_0x507a('0xc5')](_0x1e8702[_0x507a('0x42')][_0x507a('0xb6')]);}})[_0x507a('0x28')](respondWithStatusCode(_0x4cd046,null))[_0x507a('0x35')](handleError(_0x4cd046,null));};exports[_0x507a('0xc6')]=function(_0x5be856,_0x21f178){var _0x151aa0=moment()[_0x507a('0xc7')]()[_0x507a('0x9a')]();var _0x5896f1=path[_0x507a('0xc8')](config['root'],_0x507a('0xc9'),_0x507a('0xca'),_0x507a('0xcb'));var _0x1109be=path[_0x507a('0xc8')](config[_0x507a('0xcc')],_0x507a('0xc9'),_0x507a('0xca'),_0x507a('0xcd'));var _0xf9b328=path[_0x507a('0xc8')](_0x5896f1,_0x151aa0);var _0x5889ef=util[_0x507a('0xba')](_0x507a('0xce'),_0x5be856[_0x507a('0xaf')]['id'],_0x151aa0);var _0x4c7790=path['join'](_0x5896f1,_0x5889ef);var _0x3a635d=[];_0x3a635d[_0x507a('0xcf')]({'model':db[_0x507a('0x70')],'as':_0x507a('0x70'),'attributes':['id',_0x507a('0x30')],'raw':!![]});_0x3a635d[_0x507a('0xcf')]({'model':db['CmContact'],'as':_0x507a('0x68'),'attributes':['id',_0x507a('0xd0'),_0x507a('0xd1')],'raw':!![]});var _0x450250=[{'model':db[_0x507a('0xb5')],'as':_0x507a('0xd2'),'attributes':['id',_0x507a('0x74'),_0x507a('0x7a'),'direction',_0x507a('0xd3'),'read'],'include':_0x3a635d}];_0x450250[_0x507a('0xcf')]({'model':db['SmsAccount'],'as':_0x507a('0xd4'),'attributes':['id',_0x507a('0x2c')]});_0x450250['push']({'model':db[_0x507a('0x70')],'as':_0x507a('0xd5'),'attributes':['id',_0x507a('0x30')]});return db['SmsInteraction']['find']({'where':{'id':_0x5be856[_0x507a('0xaf')]['id']},'include':_0x450250})[_0x507a('0x28')](handleEntityNotFound(_0x21f178,null))[_0x507a('0x28')](function(_0x2c8b6f){if(_0x2c8b6f){var _0x3b6e0b=_0x2c8b6f[_0x507a('0xd6')]({'plain':!![]});fs[_0x507a('0xd7')](_0xf9b328);var _0x58d95a={'channel':'Sms','account':_0x3b6e0b['Account'][_0x507a('0x2c')],'agent':_0x3b6e0b[_0x507a('0xd5')]?_0x3b6e0b[_0x507a('0xd5')]['fullname']:_0x507a('0xd8'),'createdAt':moment(_0x3b6e0b[_0x507a('0x7a')])[_0x507a('0xba')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x3b6e0b[_0x507a('0x3b')]?moment(_0x3b6e0b['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x507a('0x9a')]():'','disposition':_0x3b6e0b['disposition'],'messages':_(_0x3b6e0b[_0x507a('0xd2')])[_0x507a('0x85')]({'secret':![]})[_0x507a('0x2f')](function(_0xa77fff){return{'date':moment(_0xa77fff['createdAt'])[_0x507a('0xba')]('YYYY-MM-DD\x20HH:mm:ss')[_0x507a('0x9a')](),'sender':_0xa77fff['direction']===_0x507a('0xd9')?_0xa77fff['User']?_0xa77fff[_0x507a('0x70')][_0x507a('0x30')]:'System':_0xa77fff[_0x507a('0x68')][_0x507a('0xd0')]+(_0xa77fff[_0x507a('0x68')]['lastName']?'\x20'+_0xa77fff[_0x507a('0x68')][_0x507a('0xd1')]:''),'body':_0xa77fff[_0x507a('0x74')],'direction':_0xa77fff['direction']===_0x507a('0xd9')?'A':'C','secret':_0xa77fff[_0x507a('0xd3')],'read':_0xa77fff['read']};})[_0x507a('0x65')]()};return ejs[_0x507a('0xda')](path[_0x507a('0xc8')](config['root'],_0x507a('0xc9'),_0x507a('0xdb'),_0x507a('0xdc')),{'interaction':_0x58d95a})[_0x507a('0x28')](function(_0x512ab8){var _0x49685b=path[_0x507a('0xc8')](_0xf9b328,'transcript-'+_0x3b6e0b['id']+'-'+_0x151aa0+_0x507a('0xdd'));var _0x3ca92f={'path':_0x49685b,'channel':_0x507a('0xde'),'interactionId':_0x3b6e0b['id']};return pdf[_0x507a('0xdf')](_0x512ab8,_0x3ca92f);})[_0x507a('0x28')](function(){return new BPromise(function(_0x126761,_0x5dbfc6){zipdir(_0xf9b328,{'saveTo':_0x4c7790},function(_0xa75223,_0x4b1ed8){if(_0xa75223)return _0x5dbfc6(_0xa75223);return _0x126761(_0x4b1ed8);});})[_0x507a('0x28')](function(){return new BPromise(function(_0x3dc636,_0x4ccf0e){rimraf(_0xf9b328,function(_0x107db4){if(_0x107db4)_0x4ccf0e(_0x107db4);return _0x3dc636();});});})[_0x507a('0x28')](function(){return _0x21f178['download'](_0x4c7790,_0x5889ef,function(_0x5f2170){if(_0x5f2170){console[_0x507a('0xe0')](_0x507a('0xe1'),_0x5f2170);}else{fs['unlinkSync'](_0x4c7790);}});});});}else{return _0x21f178[_0x507a('0x1b')](0xc8);}})[_0x507a('0x35')](handleError(_0x21f178,null));}; \ No newline at end of file +var _0xc709=['ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','start','some','compact','isEmpty','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','agent','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','params','includeAll','merge','create','destroy','describe','SmsMessage','addMessage','ids','omit','findOne','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','color','removeTags','unix','root','files','tmp','join','server','transcript-%d-%s.zip','Contact','firstName','lastName','Messages','direction','secret','SmsAccount','Owner','get','Sms','Account','N.A.','closedAt','disposition','out','System','renderFile','views','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','error','stack','name','fullname','Tags','TagIds','split','forEach','push','catch','talking','unmanaged','total','closed','waiting','UserId','answered','index','SmsInteraction','rawAttributes','fieldName','map','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','select','field','tools_tags','ui.SmsInteractionId','from','user_has_sms_interactions','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)'];(function(_0x25b062,_0x32fe5e){var _0x2ab62b=function(_0x4ecc89){while(--_0x4ecc89){_0x25b062['push'](_0x25b062['shift']());}};_0x2ab62b(++_0x32fe5e);}(_0xc709,0x7f));var _0x9c70=function(_0x5d72da,_0xb7ce32){_0x5d72da=_0x5d72da-0x0;var _0x43ebe7=_0xc709[_0x5d72da];return _0x43ebe7;};'use strict';var emlformat=require(_0x9c70('0x0'));var rimraf=require(_0x9c70('0x1'));var zipdir=require(_0x9c70('0x2'));var jsonpatch=require(_0x9c70('0x3'));var rp=require(_0x9c70('0x4'));var moment=require(_0x9c70('0x5'));var BPromise=require(_0x9c70('0x6'));var Mustache=require(_0x9c70('0x7'));var util=require(_0x9c70('0x8'));var path=require('path');var sox=require(_0x9c70('0x9'));var csv=require(_0x9c70('0xa'));var ejs=require(_0x9c70('0xb'));var fs=require('fs');var fs_extra=require(_0x9c70('0xc'));var _=require(_0x9c70('0xd'));var squel=require(_0x9c70('0xe'));var crypto=require(_0x9c70('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9c70('0x10'));var toCsv=require(_0x9c70('0xa'));var querystring=require('querystring');var Papa=require(_0x9c70('0x11'));var Redis=require(_0x9c70('0x12'));var authService=require(_0x9c70('0x13'));var qs=require(_0x9c70('0x14'));var as=require(_0x9c70('0x15'));var pdf=require(_0x9c70('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c70('0x17'))(_0x9c70('0x18'));var utils=require(_0x9c70('0x19'));var config=require(_0x9c70('0x1a'));var licenseUtil=require(_0x9c70('0x1b'));var db=require(_0x9c70('0x1c'))['db'];config[_0x9c70('0x1d')]=_['defaults'](config[_0x9c70('0x1d')],{'host':_0x9c70('0x1e'),'port':0x18eb});var socket=require(_0x9c70('0x1f'))(new Redis(config[_0x9c70('0x1d')]));require(_0x9c70('0x20'))['register'](socket);function respondWithStatusCode(_0x3df93d,_0x2f0b6e){_0x2f0b6e=_0x2f0b6e||0xcc;return function(_0x5d6b24){if(_0x5d6b24){return _0x3df93d[_0x9c70('0x21')](_0x2f0b6e);}return _0x3df93d['status'](_0x2f0b6e)[_0x9c70('0x22')]();};}function respondWithResult(_0x209f89,_0x77fab2){_0x77fab2=_0x77fab2||0xc8;return function(_0x1f6b68){if(_0x1f6b68){return _0x209f89[_0x9c70('0x23')](_0x77fab2)[_0x9c70('0x24')](_0x1f6b68);}};}function respondWithFilteredResult(_0x5cf1e5,_0x244b33){return function(_0x2aead3){if(_0x2aead3){var _0x117878=typeof _0x244b33[_0x9c70('0x25')]===_0x9c70('0x26')&&typeof _0x244b33['limit']===_0x9c70('0x26');var _0x506c1a=_0x2aead3[_0x9c70('0x27')];var _0x442e49=_0x117878?0x0:_0x244b33[_0x9c70('0x25')];var _0x3c4140=_0x117878?_0x2aead3[_0x9c70('0x27')]:_0x244b33['offset']+_0x244b33[_0x9c70('0x28')];var _0x48ace7;if(_0x3c4140>=_0x506c1a){_0x3c4140=_0x506c1a;_0x48ace7=0xc8;}else{_0x48ace7=0xce;}_0x5cf1e5[_0x9c70('0x23')](_0x48ace7);return _0x5cf1e5[_0x9c70('0x29')]('Content-Range',_0x442e49+'-'+_0x3c4140+'/'+_0x506c1a)[_0x9c70('0x24')](_0x2aead3);}return null;};}function patchUpdates(_0x304cc6){return function(_0x196959){try{jsonpatch[_0x9c70('0x2a')](_0x196959,_0x304cc6,!![]);}catch(_0x5e0601){return BPromise[_0x9c70('0x2b')](_0x5e0601);}return _0x196959[_0x9c70('0x2c')]();};}function saveUpdates(_0x1d75fc,_0x448102){return function(_0x249f62){if(_0x249f62){return _0x249f62[_0x9c70('0x2d')](_0x1d75fc)[_0x9c70('0x2e')](function(_0x3f102f){return _0x3f102f;});}return null;};}function removeEntity(_0x4abaea,_0x5c9c0e){return function(_0x1dcf9a){if(_0x1dcf9a){return _0x1dcf9a['destroy']()[_0x9c70('0x2e')](function(){_0x4abaea[_0x9c70('0x23')](0xcc)[_0x9c70('0x22')]();});}};}function handleEntityNotFound(_0x368af3,_0x2af711){return function(_0x4b08ec){if(!_0x4b08ec){_0x368af3['sendStatus'](0x194);}return _0x4b08ec;};}function handleError(_0x3260c8,_0x1a65cd){_0x1a65cd=_0x1a65cd||0x1f4;return function(_0x19b062){logger[_0x9c70('0x2f')](_0x19b062[_0x9c70('0x30')]);if(_0x19b062[_0x9c70('0x31')]){delete _0x19b062['name'];}_0x3260c8[_0x9c70('0x23')](_0x1a65cd)['send'](_0x19b062);};}function getInteractionUsers(_0x2e17c6,_0x5963c6){return new BPromise(function(_0x130160,_0x2e6fee){try{if(_0x5963c6[_0x2e17c6['id']]){_0x2e17c6['Users']=_['map'](_0x5963c6[_0x2e17c6['id']],function(_0x383399){return{'id':_0x383399['id'],'fullname':_0x383399[_0x9c70('0x32')]};});}}catch(_0x4f3c09){_0x2e6fee(_0x4f3c09);}_0x130160(_0x2e17c6);});}function getInteractionTags(_0x1f1d60,_0x573d4f){return new BPromise(function(_0x4d76b7,_0x3b0fd1){try{if(_0x1f1d60['TagIds']){_0x1f1d60[_0x9c70('0x33')]=[];_0x1f1d60[_0x9c70('0x34')][_0x9c70('0x35')](',')[_0x9c70('0x36')](function(_0x8b175){_0x1f1d60[_0x9c70('0x33')][_0x9c70('0x37')](_0x573d4f[_0x8b175]);});}delete _0x1f1d60[_0x9c70('0x34')];}catch(_0x2937d4){_0x3b0fd1(_0x2937d4);}_0x4d76b7(_0x1f1d60);});}function updateSmsInteraction(_0x516d88,_0x895862,_0x1c1bf7){return new BPromise(function(_0x3db466,_0x50af61){return getInteractionUsers(_0x516d88,_0x1c1bf7)[_0x9c70('0x2e')](function(_0xdec06b){return getInteractionTags(_0xdec06b,_0x895862);})['then'](function(_0x212c09){return getStateInteraction(_0x212c09);})[_0x9c70('0x2e')](function(_0x5e0c6e){_0x3db466(_0x5e0c6e);})[_0x9c70('0x38')](function(_0x218ee5){_0x50af61(_0x218ee5);});});}function getStateInteraction(_0x6c5df){return new BPromise(function(_0x13a13d){_0x6c5df['waiting']=0x0;_0x6c5df[_0x9c70('0x39')]=0x0;_0x6c5df['answered']=0x0;_0x6c5df[_0x9c70('0x3a')]=0x0;_0x6c5df[_0x9c70('0x3b')]=0x0;if(!_0x6c5df[_0x9c70('0x3c')]&&!_0x6c5df['UserId']){_0x6c5df[_0x9c70('0x3d')]+=0x1;}if(!_0x6c5df[_0x9c70('0x3c')]&&_0x6c5df[_0x9c70('0x3e')]){_0x6c5df[_0x9c70('0x39')]+=0x1;if(_0x6c5df['waiting']){_0x6c5df[_0x9c70('0x3d')]-=0x1;}}if(_0x6c5df['closed']&&_0x6c5df[_0x9c70('0x3e')]){_0x6c5df[_0x9c70('0x3f')]+=0x1;if(_0x6c5df[_0x9c70('0x39')]){_0x6c5df[_0x9c70('0x39')]-=0x1;}}if(_0x6c5df[_0x9c70('0x3c')]&&!_0x6c5df[_0x9c70('0x3e')]){_0x6c5df[_0x9c70('0x3a')]+=0x1;if(_0x6c5df[_0x9c70('0x3d')]){_0x6c5df[_0x9c70('0x3d')]-=0x1;}}_0x6c5df[_0x9c70('0x3b')]+=0x1;_0x13a13d(_0x6c5df);});}exports[_0x9c70('0x40')]=function(_0xa7c2c0,_0x6f88df){var _0x1a168b={},_0x5524bc={},_0x2b1142={'count':0x0,'rows':[]};var _0x34055d=_['map'](db[_0x9c70('0x41')][_0x9c70('0x42')],function(_0x263ac1){return{'name':_0x263ac1[_0x9c70('0x43')],'type':_0x263ac1['type']['key']};});_0x5524bc['model']=_[_0x9c70('0x44')](_0x34055d,_0x9c70('0x31'));_0x5524bc[_0x9c70('0x45')]=_[_0x9c70('0x46')](_0xa7c2c0[_0x9c70('0x45')]);_0x5524bc[_0x9c70('0x47')]=_[_0x9c70('0x48')](_0x5524bc['model'],_0x5524bc[_0x9c70('0x45')]);_0x1a168b['attributes']=_['intersection'](_0x5524bc['model'],qs[_0x9c70('0x49')](_0xa7c2c0[_0x9c70('0x45')][_0x9c70('0x49')]));_0x1a168b[_0x9c70('0x4a')]=_0x1a168b[_0x9c70('0x4a')][_0x9c70('0x4b')]?_0x1a168b['attributes']:_0x5524bc[_0x9c70('0x4c')];if(!_0xa7c2c0[_0x9c70('0x45')][_0x9c70('0x4d')](_0x9c70('0x4e'))){_0x1a168b[_0x9c70('0x28')]=qs['limit'](_0xa7c2c0[_0x9c70('0x45')]['limit']);_0x1a168b[_0x9c70('0x25')]=qs[_0x9c70('0x25')](_0xa7c2c0[_0x9c70('0x45')]['offset']);}_0x1a168b[_0x9c70('0x4f')]=qs[_0x9c70('0x50')](_0xa7c2c0['query'][_0x9c70('0x50')]);_0x1a168b[_0x9c70('0x51')]=qs[_0x9c70('0x47')](_['pick'](_0xa7c2c0[_0x9c70('0x45')],_0x5524bc[_0x9c70('0x47')]),_0x34055d);var _0x52245f=[];var _0x4a6377=squel[_0x9c70('0x52')]()[_0x9c70('0x53')]('id')['field']('name')[_0x9c70('0x53')]('color')['from'](_0x9c70('0x54'));var _0x42f4c9=squel['select']()['field']('u.id')[_0x9c70('0x53')]('u.fullname')[_0x9c70('0x53')](_0x9c70('0x55'))[_0x9c70('0x56')](_0x9c70('0x57'),'ui')['left_join']('users','u',_0x9c70('0x58'));var _0x1c97df=squel['select']()['from'](_0x9c70('0x59'),'i')[_0x9c70('0x5a')](_0x9c70('0x5b'),'c',_0x9c70('0x5c'))[_0x9c70('0x5a')]('users','o',_0x9c70('0x5d'))[_0x9c70('0x5a')](_0x9c70('0x5e'),'a','a.id\x20=\x20i.SmsAccountId')[_0x9c70('0x5a')](_0x9c70('0x5f'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x9c70('0x5a')](_0x9c70('0x60'),'it',_0x9c70('0x61'))[_0x9c70('0x5a')](_0x9c70('0x54'),'t',_0x9c70('0x62'));var _0x4571b1=squel[_0x9c70('0x63')]();var _0x133cfa=[];var _0x4e131d=squel[_0x9c70('0x63')]();var _0x3044b0;if(_0xa7c2c0[_0x9c70('0x45')][_0x9c70('0x64')]){_0x3044b0=as[_0x9c70('0x65')](_0xa7c2c0['query']['search']);var _0x18d137=_0x3044b0[_0x9c70('0x66')];for(var _0x52af2b=0x0;_0x52af2b<_0x3044b0[_0x9c70('0x67')][_0x9c70('0x4b')];_0x52af2b++){var _0x4676e5=_0x3044b0[_0x9c70('0x67')][_0x52af2b];var _0x10742e='i';var _0x2ad434=_[_0x9c70('0x68')](_0x34055d,[_0x9c70('0x31'),_0x4676e5[_0x9c70('0x53')]]);if(!_0x2ad434){switch(_0x4676e5[_0x9c70('0x53')]){case _0x9c70('0x69'):if(_0x4676e5['value']==0x1){_0x1c97df[_0x9c70('0x6a')]('`'+_0x4676e5['field']+_0x9c70('0x6b'));}else{_0x1c97df[_0x9c70('0x6a')]('`'+_0x4676e5[_0x9c70('0x53')]+_0x9c70('0x6c'));}break;case'Contact':if(_0x4676e5['operator']===_0x9c70('0x6d')){if(_0x4676e5[_0x9c70('0x6e')]['split']('\x20')[_0x9c70('0x4b')]>0x1){_0x4571b1[_0x18d137](_0x9c70('0x6f'),qs['getFullTextValue'](_0x4676e5['value']),null);}else{var _0x27decd='%'+_0x4676e5[_0x9c70('0x6e')]+'%';_0x4571b1[_0x18d137]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x27decd,_0x27decd,_0x27decd);}}else{_0x2ad434=_[_0x9c70('0x68')](_0x34055d,[_0x9c70('0x31'),'ContactId']);_0x4676e5['field']=_0x9c70('0x70');_0x2aa539=as[_0x9c70('0x71')](_0x10742e,_0x2ad434[_0x9c70('0x72')],_0x4676e5);_0x4571b1[_0x18d137](_0x2aa539[_0x9c70('0x73')],_0x2aa539['value']['start'],_0x2aa539['value']['end']);}break;case _0x9c70('0x74'):var _0x20264e=_0x4676e5[_0x9c70('0x6e')][_0x9c70('0x35')](',')[_0x9c70('0x44')](function(_0x451593){return Number(_0x451593);});_0x20264e[_0x9c70('0x36')](function(_0x28bc21){_0x4e131d['or'](_0x9c70('0x75'),'%,'+_0x28bc21+',%');});_0x133cfa=_[_0x9c70('0x76')](_0x133cfa,_0x20264e);break;case _0x9c70('0x77'):if(_0x4676e5[_0x9c70('0x78')]==='$substring'){_0x4571b1[_0x18d137](_0x9c70('0x79'),'%'+_0x4676e5['value']+'%',null);}else{_0x2ad434=_[_0x9c70('0x68')](_0x34055d,[_0x9c70('0x31'),_0x9c70('0x3e')]);_0x4676e5['field']=_0x9c70('0x3e');_0x2aa539=as['buildExpression'](_0x10742e,_0x2ad434['type'],_0x4676e5);_0x4571b1[_0x18d137](_0x2aa539['text'],_0x2aa539[_0x9c70('0x6e')]['start'],_0x2aa539[_0x9c70('0x6e')][_0x9c70('0x22')]);}break;case _0x9c70('0x7a'):_0x2aa539=as[_0x9c70('0x71')]('me',null,_0x4676e5);_0x4571b1[_0x18d137](_0x2aa539[_0x9c70('0x73')],_0x2aa539[_0x9c70('0x6e')][_0x9c70('0x7b')],_0x2aa539[_0x9c70('0x6e')]['end']);break;}}else{var _0x2aa539=as[_0x9c70('0x71')](_0x10742e,_0x2ad434[_0x9c70('0x72')],_0x4676e5);_0x4571b1[_0x18d137](_0x2aa539[_0x9c70('0x73')],_0x2aa539[_0x9c70('0x6e')][_0x9c70('0x7b')],_0x2aa539[_0x9c70('0x6e')][_0x9c70('0x22')]);}}}else{var _0x4d8d0f=_(_0xa7c2c0[_0x9c70('0x45')])['keys']()[_0x9c70('0x44')](function(_0x1ad00c){return _[_0x9c70('0x7c')](_0x34055d,['name',_0x1ad00c])?_0x1ad00c:undefined;})[_0x9c70('0x7d')]()['value']();if(!_[_0x9c70('0x7e')](_0x4d8d0f)){_0x4d8d0f['forEach'](function(_0x9015f2){if(_0x9015f2==='SmsAccountId'){_0x1c97df[_0x9c70('0x51')]('i.SmsAccountId\x20IN\x20?',[][_0x9c70('0x7f')](_0xa7c2c0[_0x9c70('0x45')][_0x9015f2]));}else if(_0x9015f2===_0x9c70('0x80')){var _0x1bded5=JSON[_0x9c70('0x81')](_0xa7c2c0['query'][_0x9015f2])[_0x9c70('0x82')];var _0x4bb76a=JSON[_0x9c70('0x81')](_0xa7c2c0[_0x9c70('0x45')][_0x9015f2])['$lte'];_0x1c97df['where'](_0x9c70('0x83'),_0x1bded5,_0x4bb76a);}else{if(_0xa7c2c0['query'][_0x9015f2]===_0x9c70('0x84')){_0x1c97df[_0x9c70('0x51')]('i.'+_0x9015f2+_0x9c70('0x85'));}else{_0x1c97df['where']('i.'+_0x9015f2+_0x9c70('0x86'),_0xa7c2c0[_0x9c70('0x45')][_0x9015f2]);}}});}if(_0xa7c2c0['query'][_0x9c70('0x87')]){if(_0xa7c2c0[_0x9c70('0x45')][_0x9c70('0x87')]==0x1){_0x1c97df[_0x9c70('0x6a')](_0x9c70('0x88'));}else{_0x1c97df[_0x9c70('0x6a')]('`unreadMessages`\x20>\x200');}}if(_0xa7c2c0[_0x9c70('0x45')][_0x9c70('0x89')]){_0x133cfa=_['isArray'](_0xa7c2c0[_0x9c70('0x45')]['tag'])?_0xa7c2c0[_0x9c70('0x45')][_0x9c70('0x89')]:new Array(_0xa7c2c0[_0x9c70('0x45')]['tag']);_0x133cfa[_0x9c70('0x36')](function(_0x2c4e35){_0x4e131d['or'](_0x9c70('0x75'),'%,'+_0x2c4e35+',%');});}if(_0xa7c2c0['query'][_0x9c70('0x8a')]){var _0x1e4bf3=_0xa7c2c0[_0x9c70('0x45')][_0x9c70('0x8a')][_0x9c70('0x8b')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x9c70('0x8c')](_0x1e4bf3)){_0x4571b1['or'](_0x9c70('0x8d'),_0x1e4bf3+'%')['or'](_0x9c70('0x8e'),_0x1e4bf3+'%');}else{_0x4571b1['or'](_0x9c70('0x8f'),qs['getFullTextValue'](_0x1e4bf3))['or'](_0x9c70('0x90'),_0x1e4bf3+'%');}}}_0x1c97df['where'](_0x4571b1);_0x1c97df[_0x9c70('0x91')]('i.id');var _0x143170={'type':db[_0x9c70('0x92')][_0x9c70('0x93')][_0x9c70('0x94')],'raw':!![]};var _0x3e96d3=_0x1c97df[_0x9c70('0x95')]();_0x3e96d3[_0x9c70('0x53')](_0x9c70('0x96'));_0x3e96d3[_0x9c70('0x53')](_0x9c70('0x97'),_0x9c70('0x69'));if(_0x1a168b['order']){_0x1a168b[_0x9c70('0x4f')][_0x9c70('0x36')](function(_0x39e784){var _0x70e412=_0x39e784[0x0]===_0x9c70('0x98')?_0x39e784[0x0]:'i.'+_0x39e784[0x0];_0x1c97df[_0x9c70('0x4f')](_0x70e412,_0x39e784[0x1]==='DESC'?![]:!![]);});}if(!_[_0x9c70('0x7e')](_0x133cfa)){_0x1c97df[_0x9c70('0x6a')](_0x4e131d);_0x3e96d3[_0x9c70('0x51')](_0x9c70('0x99'),_0x133cfa);}BPromise[_0x9c70('0x9a')]()[_0x9c70('0x2e')](function(){if(!_0x3044b0){if(_0xa7c2c0[_0x9c70('0x45')][_0x9c70('0x9b')])return;_0x3e96d3[_0x9c70('0x51')](_0x9c70('0x9c'));_0x1c97df[_0x9c70('0x51')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0xa7c2c0[_0x9c70('0x9d')][_0x9c70('0x9e')]!=='agent')return;return _0xa7c2c0[_0x9c70('0x9d')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x9c70('0x2e')](function(_0x34fefa){if(_[_0x9c70('0x7e')](_0x34fefa)){_0x3e96d3[_0x9c70('0x51')](_0x9c70('0x9f'));_0x1c97df[_0x9c70('0x51')](_0x9c70('0x9f'));}else{_0x3e96d3[_0x9c70('0x51')](_0x9c70('0xa0'),_[_0x9c70('0x44')](_0x34fefa,'id'));_0x1c97df['where'](_0x9c70('0xa0'),_[_0x9c70('0x44')](_0x34fefa,'id'));}});})[_0x9c70('0x2e')](function(){if(_0xa7c2c0[_0x9c70('0x9d')][_0x9c70('0x9e')]===_0x9c70('0xa1')&&!_0x3044b0&&!_0xa7c2c0[_0x9c70('0x45')][_0x9c70('0x9b')])return[];return db[_0x9c70('0xa2')]['query'](_0x3e96d3[_0x9c70('0xa3')](),_0x143170);})[_0x9c70('0x2e')](function(_0x39f6d2){_0x2b1142[_0x9c70('0x27')]=_0x39f6d2['length'];if(_0x2b1142[_0x9c70('0x27')]===0x0)return[];return db[_0x9c70('0xa2')][_0x9c70('0x45')](_0x4a6377['toString'](),_0x143170)[_0x9c70('0x2e')](function(_0x574832){_0x52245f=_[_0x9c70('0xa4')](_0x574832,'id');_0x143170=_['merge'](_0x143170,{'model':db[_0x9c70('0x41')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xa7c2c0['query'][_0x9c70('0x49')]){_0x1a168b[_0x9c70('0x4a')]['forEach'](function(_0x126627){_0x1c97df[_0x9c70('0x53')]('i.'+_0x126627);});}else{_0x1c97df[_0x9c70('0x53')](_0x9c70('0x97'),_0x9c70('0x69'));_0x1c97df[_0x9c70('0x53')]('a.key',_0x9c70('0xa5'));_0x1c97df[_0x9c70('0x53')](_0x9c70('0xa6'),_0x9c70('0xa7'));_0x1c97df[_0x9c70('0x53')](_0x9c70('0xa8'),_0x9c70('0x98'));_0x1c97df['field'](_0x9c70('0xa9'));_0x1c97df[_0x9c70('0x53')](_0x9c70('0xaa'),_0x9c70('0xab'));_0x1c97df[_0x9c70('0x53')](_0x9c70('0xac'),_0x9c70('0xad'));_0x1c97df['field'](_0x9c70('0xae'),_0x9c70('0xaf'));_0x1c97df[_0x9c70('0x53')]('c.phone',_0x9c70('0xb0'));_0x1c97df[_0x9c70('0x53')](_0x9c70('0xb1'),'Contact.mobile');_0x1c97df[_0x9c70('0x53')](_0x9c70('0xb2'),_0x9c70('0xb3'));_0x1c97df[_0x9c70('0x53')]('o.fullname','Owner.fullname');_0x1c97df[_0x9c70('0x53')](_0x9c70('0xb4'),_0x9c70('0xb5'));_0x1c97df[_0x9c70('0x53')](_0x9c70('0xb6'),_0x9c70('0x34'));}if(_0x1a168b[_0x9c70('0x28')])_0x1c97df[_0x9c70('0x28')](_0x1a168b[_0x9c70('0x28')]);if(_0x1a168b[_0x9c70('0x25')])_0x1c97df[_0x9c70('0x25')](_0x1a168b[_0x9c70('0x25')]);return db['sequelize'][_0x9c70('0x45')](_0x1c97df[_0x9c70('0xa3')](),_0x143170);})[_0x9c70('0x2e')](function(_0x29442f){if(_0x29442f[_0x9c70('0x4b')]>0x0)_0x42f4c9[_0x9c70('0x51')](_0x9c70('0xb7'),_['map'](_0x29442f,'id'));return db[_0x9c70('0xa2')][_0x9c70('0x45')](_0x42f4c9['toString'](),_0x143170)[_0x9c70('0x2e')](function(_0x557e0f){var _0x4c95b5=_['groupBy'](_0x557e0f,_0x9c70('0xb8'));var _0x384f81=[];_0x29442f[_0x9c70('0x36')](function(_0x475ce4){_0x384f81[_0x9c70('0x37')](updateSmsInteraction(_0x475ce4,_0x52245f,_0x4c95b5));});return BPromise[_0x9c70('0xb9')](_0x384f81);});});})['then'](function(_0x53c5c0){_0x2b1142['rows']=_0x53c5c0;return _0x2b1142;})[_0x9c70('0x2e')](respondWithFilteredResult(_0x6f88df,_0x1a168b))['catch'](handleError(_0x6f88df,null));};exports['show']=function(_0x50e3bd,_0xa8a996){var _0x1cd07a={'raw':![],'where':{'id':_0x50e3bd[_0x9c70('0xba')]['id']}},_0x2ea9e0={};_0x2ea9e0[_0x9c70('0x4c')]=_[_0x9c70('0x46')](db['SmsInteraction']['rawAttributes']);_0x2ea9e0[_0x9c70('0x45')]=_[_0x9c70('0x46')](_0x50e3bd[_0x9c70('0x45')]);_0x2ea9e0[_0x9c70('0x47')]=_['intersection'](_0x2ea9e0[_0x9c70('0x4c')],_0x2ea9e0[_0x9c70('0x45')]);_0x1cd07a[_0x9c70('0x4a')]=_[_0x9c70('0x48')](_0x2ea9e0[_0x9c70('0x4c')],qs[_0x9c70('0x49')](_0x50e3bd['query']['fields']));_0x1cd07a[_0x9c70('0x4a')]=_0x1cd07a['attributes'][_0x9c70('0x4b')]?_0x1cd07a[_0x9c70('0x4a')]:_0x2ea9e0['model'];if(_0x50e3bd[_0x9c70('0x45')][_0x9c70('0xbb')]){_0x1cd07a['include']=[{'all':!![]}];}_0x1cd07a=_[_0x9c70('0xbc')]({},_0x1cd07a,_0x50e3bd['options']);return db['SmsInteraction'][_0x9c70('0x68')](_0x1cd07a)[_0x9c70('0x2e')](handleEntityNotFound(_0xa8a996,null))[_0x9c70('0x2e')](respondWithResult(_0xa8a996,null))[_0x9c70('0x38')](handleError(_0xa8a996,null));};exports['create']=function(_0x4c0394,_0x49b81c){return db[_0x9c70('0x41')][_0x9c70('0xbd')](_0x4c0394['body'],{})[_0x9c70('0x2e')](respondWithResult(_0x49b81c,0xc9))[_0x9c70('0x38')](handleError(_0x49b81c,null));};exports[_0x9c70('0x2d')]=function(_0x549e04,_0x1bfdf5){if(_0x549e04[_0x9c70('0x7a')]['id']){delete _0x549e04[_0x9c70('0x7a')]['id'];}return db[_0x9c70('0x41')][_0x9c70('0x68')]({'where':{'id':_0x549e04[_0x9c70('0xba')]['id']}})[_0x9c70('0x2e')](handleEntityNotFound(_0x1bfdf5,null))[_0x9c70('0x2e')](saveUpdates(_0x549e04[_0x9c70('0x7a')],null))[_0x9c70('0x2e')](respondWithResult(_0x1bfdf5,null))['catch'](handleError(_0x1bfdf5,null));};exports[_0x9c70('0xbe')]=function(_0x5c6635,_0x59ef0e){return db['SmsInteraction']['find']({'where':{'id':_0x5c6635[_0x9c70('0xba')]['id']}})[_0x9c70('0x2e')](handleEntityNotFound(_0x59ef0e,null))[_0x9c70('0x2e')](removeEntity(_0x59ef0e,null))[_0x9c70('0x38')](handleError(_0x59ef0e,null));};exports[_0x9c70('0xbf')]=function(_0x37fa1f,_0x21e581){return db[_0x9c70('0x41')][_0x9c70('0xbf')]()[_0x9c70('0x2e')](respondWithResult(_0x21e581,null))[_0x9c70('0x38')](handleError(_0x21e581,null));};exports['addMessage']=function(_0x23487e,_0x3b63c2,_0x208bf2){return db[_0x9c70('0xc0')]['find']({'where':{'id':_0x23487e[_0x9c70('0xba')]['id']}})['then'](handleEntityNotFound(_0x3b63c2,null))[_0x9c70('0x2e')](function(_0xb107a3){if(_0xb107a3){return _0xb107a3[_0x9c70('0xc1')](_0x23487e[_0x9c70('0x7a')][_0x9c70('0xc2')],_[_0x9c70('0xc3')](_0x23487e[_0x9c70('0x7a')],[_0x9c70('0xc2'),'id'])||{});}})['then'](respondWithResult(_0x3b63c2,null))[_0x9c70('0x38')](handleError(_0x3b63c2,null));};exports['getMessages']=function(_0x14317e,_0x1cf2d,_0x2ea351){var _0x5322cf={'raw':![],'where':{}};var _0x4816fd={};var _0x10a22d={'count':0x0,'rows':[]};return db[_0x9c70('0x41')][_0x9c70('0xc4')]({'where':{'id':_0x14317e['params']['id']}})['then'](handleEntityNotFound(_0x1cf2d,null))[_0x9c70('0x2e')](function(_0x127910){if(_0x127910){_0x4816fd[_0x9c70('0x4c')]=_[_0x9c70('0x46')](db[_0x9c70('0xc0')][_0x9c70('0x42')]);_0x4816fd[_0x9c70('0x45')]=_[_0x9c70('0x46')](_0x14317e['query']);_0x4816fd['filters']=_['intersection'](_0x4816fd[_0x9c70('0x4c')],_0x4816fd[_0x9c70('0x45')]);_0x5322cf[_0x9c70('0x4a')]=_[_0x9c70('0x48')](_0x4816fd[_0x9c70('0x4c')],qs[_0x9c70('0x49')](_0x14317e[_0x9c70('0x45')]['fields']));_0x5322cf['attributes']=_0x5322cf[_0x9c70('0x4a')][_0x9c70('0x4b')]?_0x5322cf[_0x9c70('0x4a')]:_0x4816fd['model'];if(!_0x14317e[_0x9c70('0x45')]['hasOwnProperty'](_0x9c70('0x4e'))){_0x5322cf['limit']=qs[_0x9c70('0x28')](_0x14317e[_0x9c70('0x45')][_0x9c70('0x28')]);_0x5322cf[_0x9c70('0x25')]=qs[_0x9c70('0x25')](_0x14317e[_0x9c70('0x45')]['offset']);}_0x5322cf['order']=qs[_0x9c70('0x50')](_0x14317e[_0x9c70('0x45')][_0x9c70('0x50')]);_0x5322cf[_0x9c70('0x51')]=qs[_0x9c70('0x47')](_[_0x9c70('0xc5')](_0x14317e[_0x9c70('0x45')],_0x4816fd[_0x9c70('0x47')]));_0x5322cf[_0x9c70('0x51')][_0x9c70('0xb8')]=_0x127910['id'];if(_0x14317e[_0x9c70('0x45')][_0x9c70('0x8a')]){_0x5322cf[_0x9c70('0x51')]=_[_0x9c70('0xbc')](_0x5322cf[_0x9c70('0x51')],{'$or':_[_0x9c70('0x44')](_0x5322cf[_0x9c70('0x4a')],function(_0x160d6b){var _0x38442b={};_0x38442b[_0x160d6b]={'$like':'%'+_0x14317e[_0x9c70('0x45')][_0x9c70('0x8a')]+'%'};return _0x38442b;})});}if(_0x14317e[_0x9c70('0x45')][_0x9c70('0x82')]){var _0x1ba486=_0x14317e[_0x9c70('0x45')][_0x9c70('0x82')][_0x9c70('0x35')](',');var _0x98a678={};_0x98a678[_0x1ba486[0x0]]={'$gte':moment(_0x1ba486[0x1])[_0x9c70('0xc6')](_0x9c70('0xc7'))};_0x5322cf[_0x9c70('0x51')]=_[_0x9c70('0xbc')](_0x5322cf[_0x9c70('0x51')],_0x98a678);}_0x5322cf=_[_0x9c70('0xbc')]({},_0x5322cf,_0x14317e['options']);return db[_0x9c70('0xc0')][_0x9c70('0x27')]({'where':_0x5322cf[_0x9c70('0x51')]})[_0x9c70('0x2e')](function(_0x12e924){_0x10a22d['count']=_0x12e924;if(_0x14317e[_0x9c70('0x45')][_0x9c70('0xbb')]){_0x5322cf['include']=[{'all':!![]}];}return db[_0x9c70('0xc0')][_0x9c70('0xc8')](_0x5322cf);})[_0x9c70('0x2e')](function(_0x1dfc84){_0x10a22d[_0x9c70('0xc9')]=_0x1dfc84;return _0x10a22d;});}})[_0x9c70('0x2e')](respondWithFilteredResult(_0x1cf2d,_0x5322cf))[_0x9c70('0x38')](handleError(_0x1cf2d,null));};exports[_0x9c70('0xca')]=function(_0xc41dce,_0x1806a,_0x5a53fb){return db['SmsInteraction'][_0x9c70('0x68')]({'where':{'id':_0xc41dce[_0x9c70('0xba')]['id']}})[_0x9c70('0x2e')](handleEntityNotFound(_0x1806a,null))[_0x9c70('0x2e')](function(_0x5d4468){if(_0x5d4468){return _0x5d4468[_0x9c70('0xcb')](_0xc41dce[_0x9c70('0x7a')]['ids'],_[_0x9c70('0xc3')](_0xc41dce[_0x9c70('0x7a')],[_0x9c70('0xc2'),'id'])||{})[_0x9c70('0xcc')](function(){return db[_0x9c70('0x74')][_0x9c70('0xc8')]({'attributes':['id','name',_0x9c70('0xcd')],'where':{'id':_0xc41dce[_0x9c70('0x7a')][_0x9c70('0xc2')]}});})[_0x9c70('0x2e')](function(_0x484398){socket['emit']('smsInteractionTags:save',{'id':Number(_0xc41dce[_0x9c70('0xba')]['id']),'tags':_0x484398||[]});return{'id':Number(_0xc41dce[_0x9c70('0xba')]['id']),'tags':_0x484398||[]};});}})[_0x9c70('0x2e')](respondWithResult(_0x1806a,null))[_0x9c70('0x38')](handleError(_0x1806a,null));};exports[_0x9c70('0xce')]=function(_0x51a7d4,_0xd03a48,_0x37d3e9){return db[_0x9c70('0x41')][_0x9c70('0x68')]({'where':{'id':_0x51a7d4['params']['id']}})[_0x9c70('0x2e')](handleEntityNotFound(_0xd03a48,null))['then'](function(_0x249752){if(_0x249752){return _0x249752[_0x9c70('0xce')](_0x51a7d4[_0x9c70('0x45')][_0x9c70('0xc2')]);}})['then'](respondWithStatusCode(_0xd03a48,null))['catch'](handleError(_0xd03a48,null));};exports['download']=function(_0x41aba0,_0xf4b1cb){var _0x32a32f=moment()[_0x9c70('0xcf')]()[_0x9c70('0xa3')]();var _0x55af9d=path['join'](config[_0x9c70('0xd0')],'server',_0x9c70('0xd1'),_0x9c70('0xd2'));var _0x9ee354=path[_0x9c70('0xd3')](config[_0x9c70('0xd0')],_0x9c70('0xd4'),_0x9c70('0xd1'),'attachments');var _0x18ff2d=path[_0x9c70('0xd3')](_0x55af9d,_0x32a32f);var _0x17ced9=util['format'](_0x9c70('0xd5'),_0x41aba0[_0x9c70('0xba')]['id'],_0x32a32f);var _0x6aee0f=path['join'](_0x55af9d,_0x17ced9);var _0x192693=[];_0x192693[_0x9c70('0x37')]({'model':db[_0x9c70('0x77')],'as':_0x9c70('0x77'),'attributes':['id',_0x9c70('0x32')],'raw':!![]});_0x192693[_0x9c70('0x37')]({'model':db['CmContact'],'as':_0x9c70('0xd6'),'attributes':['id',_0x9c70('0xd7'),_0x9c70('0xd8')],'raw':!![]});var _0xa47b32=[{'model':db[_0x9c70('0xc0')],'as':_0x9c70('0xd9'),'attributes':['id','body',_0x9c70('0x80'),_0x9c70('0xda'),_0x9c70('0xdb'),_0x9c70('0x87')],'include':_0x192693}];_0xa47b32[_0x9c70('0x37')]({'model':db[_0x9c70('0xdc')],'as':'Account','attributes':['id','name']});_0xa47b32[_0x9c70('0x37')]({'model':db['User'],'as':_0x9c70('0xdd'),'attributes':['id',_0x9c70('0x32')]});return db[_0x9c70('0x41')][_0x9c70('0x68')]({'where':{'id':_0x41aba0[_0x9c70('0xba')]['id']},'include':_0xa47b32})['then'](handleEntityNotFound(_0xf4b1cb,null))[_0x9c70('0x2e')](function(_0x4b87a1){if(_0x4b87a1){var _0x5897dc=_0x4b87a1[_0x9c70('0xde')]({'plain':!![]});fs['mkdirSync'](_0x18ff2d);var _0x27b41a={'channel':_0x9c70('0xdf'),'account':_0x5897dc[_0x9c70('0xe0')][_0x9c70('0x31')],'agent':_0x5897dc[_0x9c70('0xdd')]?_0x5897dc['Owner'][_0x9c70('0x32')]:_0x9c70('0xe1'),'createdAt':moment(_0x5897dc[_0x9c70('0x80')])[_0x9c70('0xc6')](_0x9c70('0xc7'))[_0x9c70('0xa3')](),'closedAt':_0x5897dc['closed']?moment(_0x5897dc[_0x9c70('0xe2')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x9c70('0xa3')]():'','disposition':_0x5897dc[_0x9c70('0xe3')],'messages':_(_0x5897dc[_0x9c70('0xd9')])[_0x9c70('0x8a')]({'secret':![]})[_0x9c70('0x44')](function(_0x2133ea){return{'date':moment(_0x2133ea[_0x9c70('0x80')])[_0x9c70('0xc6')](_0x9c70('0xc7'))[_0x9c70('0xa3')](),'sender':_0x2133ea['direction']===_0x9c70('0xe4')?_0x2133ea['User']?_0x2133ea['User'][_0x9c70('0x32')]:_0x9c70('0xe5'):_0x2133ea[_0x9c70('0xd6')][_0x9c70('0xd7')]+(_0x2133ea[_0x9c70('0xd6')][_0x9c70('0xd8')]?'\x20'+_0x2133ea[_0x9c70('0xd6')]['lastName']:''),'body':_0x2133ea['body'],'direction':_0x2133ea[_0x9c70('0xda')]===_0x9c70('0xe4')?'A':'C','secret':_0x2133ea[_0x9c70('0xdb')],'read':_0x2133ea[_0x9c70('0x87')]};})['value']()};return ejs[_0x9c70('0xe6')](path[_0x9c70('0xd3')](config[_0x9c70('0xd0')],_0x9c70('0xd4'),_0x9c70('0xe7'),'downloadInteraction.ejs'),{'interaction':_0x27b41a})[_0x9c70('0x2e')](function(_0x22ddd1){var _0x2d60e3=path[_0x9c70('0xd3')](_0x18ff2d,_0x9c70('0xe8')+_0x5897dc['id']+'-'+_0x32a32f+_0x9c70('0xe9'));var _0x23c7e0={'path':_0x2d60e3,'channel':_0x9c70('0xdf'),'interactionId':_0x5897dc['id']};return pdf[_0x9c70('0xea')](_0x22ddd1,_0x23c7e0);})[_0x9c70('0x2e')](function(){return new BPromise(function(_0x220da4,_0x4233c0){zipdir(_0x18ff2d,{'saveTo':_0x6aee0f},function(_0x5e33e9,_0x3e7ab3){if(_0x5e33e9)return _0x4233c0(_0x5e33e9);return _0x220da4(_0x3e7ab3);});})[_0x9c70('0x2e')](function(){return new BPromise(function(_0x4d9dc8,_0x4e3f21){rimraf(_0x18ff2d,function(_0x5a71b1){if(_0x5a71b1)_0x4e3f21(_0x5a71b1);return _0x4d9dc8();});});})[_0x9c70('0x2e')](function(){return _0xf4b1cb[_0x9c70('0xeb')](_0x6aee0f,_0x17ced9,function(_0x1e1f77){if(_0x1e1f77){console[_0x9c70('0xec')](_0x9c70('0xed'),_0x1e1f77);}else{fs[_0x9c70('0xee')](_0x6aee0f);}});});});}else{return _0xf4b1cb[_0x9c70('0x21')](0xc8);}})[_0x9c70('0x38')](handleError(_0xf4b1cb,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 20bcc02..2c8521b 100644 --- a/server/api/smsInteraction/smsInteraction.events.js +++ b/server/api/smsInteraction/smsInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','../../mysqldb','SmsInteraction','save'];(function(_0x41cfd4,_0x1ed2cc){var _0x190f48=function(_0x4b5b1a){while(--_0x4b5b1a){_0x41cfd4['push'](_0x41cfd4['shift']());}};_0x190f48(++_0x1ed2cc);}(_0x757a,0xde));var _0xa757=function(_0xcd85f3,_0x2f28ec){_0xcd85f3=_0xcd85f3-0x0;var _0x48cd86=_0x757a[_0xcd85f3];return _0x48cd86;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa757('0x2'),'afterUpdate':_0xa757('0x3'),'afterDestroy':_0xa757('0x4')};function emitEvent(_0x453d07){return function(_0x32630d,_0x3caeb0,_0x5edca8){_0x32630d[_0xa757('0x5')]({'attributes':['id'],'raw':!![]})[_0xa757('0x6')](function(_0x53be0e){_0x32630d[_0xa757('0x7')](_0xa757('0x8'),_0x53be0e[_0xa757('0x9')](function(_0x1a95ee){return{'id':_0x1a95ee['id']};}));return SmsMessage[_0xa757('0xa')]({'where':{'SmsInteractionId':_0x32630d['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x89c630){_0x32630d[_0xa757('0x7')](_0xa757('0xb'),_0x89c630[_0xa757('0xc')]);SmsInteractionEvents[_0xa757('0xd')](_0x453d07+':'+_0x32630d['id'],_0x32630d);SmsInteractionEvents[_0xa757('0xd')](_0x453d07,_0x32630d);_0x5edca8(null);})[_0xa757('0xe')](_0x5edca8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x1a85=['then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','SmsInteraction','../../mysqldb','SmsMessage','update','remove','getUsers','setDataValue','map'];(function(_0x3db0a1,_0x522797){var _0x59ef3f=function(_0x567673){while(--_0x567673){_0x3db0a1['push'](_0x3db0a1['shift']());}};_0x59ef3f(++_0x522797);}(_0x1a85,0x178));var _0x51a8=function(_0xf64789,_0x55bdfa){_0xf64789=_0xf64789-0x0;var _0x3622f1=_0x1a85[_0xf64789];return _0x3622f1;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x51a8('0x0')];var SmsMessage=require(_0x51a8('0x1'))['db'][_0x51a8('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x51a8('0x3'),'afterDestroy':_0x51a8('0x4')};function emitEvent(_0x99e371){return function(_0x48a21b,_0xaac0bf,_0x4b76a8){_0x48a21b[_0x51a8('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x331117){_0x48a21b[_0x51a8('0x6')]('Users',_0x331117[_0x51a8('0x7')](function(_0x513685){return{'id':_0x513685['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x48a21b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x51a8('0x8')](function(_0x2f276b){_0x48a21b[_0x51a8('0x6')](_0x51a8('0x9'),_0x2f276b[_0x51a8('0xa')]);SmsInteractionEvents[_0x51a8('0xb')](_0x99e371+':'+_0x48a21b['id'],_0x48a21b);SmsInteractionEvents[_0x51a8('0xb')](_0x99e371,_0x48a21b);_0x4b76a8(null);})[_0x51a8('0xc')](_0x4b76a8(null));};}for(var e in events){if(events[_0x51a8('0xd')](e)){var event=events[e];SmsInteraction[_0x51a8('0xe')](e,emitEvent(event));}}module[_0x51a8('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 7ac8129..21509a7 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 _0xebd5=['../../config/environment','exports','define','SmsInteraction','sms_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','rimraf'];(function(_0x39365b,_0x5af75e){var _0x540344=function(_0x457261){while(--_0x457261){_0x39365b['push'](_0x39365b['shift']());}};_0x540344(++_0x5af75e);}(_0xebd5,0xa4));var _0x5ebd=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xebd5[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5ebd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5ebd('0x1'));var moment=require(_0x5ebd('0x2'));var BPromise=require(_0x5ebd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5ebd('0x4'));var config=require(_0x5ebd('0x5'));var attributes=require('./smsInteraction.attributes');module[_0x5ebd('0x6')]=function(_0x576a6f,_0x5e6f68){return _0x576a6f[_0x5ebd('0x7')](_0x5ebd('0x8'),attributes,{'tableName':_0x5ebd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ea022,_0x435489,_0x541a6a){if(_0x3ea022[_0x5ebd('0xa')](_0x5ebd('0xb'))){_0x3ea022['closedAt']=moment()['format'](_0x5ebd('0xc'));}_0x541a6a(null,_0x3ea022);}}});}; \ No newline at end of file +var _0x1201=['../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x216d7d,_0x92df95){var _0x3d1e8d=function(_0x2d4d3f){while(--_0x2d4d3f){_0x216d7d['push'](_0x216d7d['shift']());}};_0x3d1e8d(++_0x92df95);}(_0x1201,0x8f));var _0x1120=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0x1201[_0x4709c8];return _0x478cdd;};'use strict';var _=require(_0x1120('0x0'));var util=require(_0x1120('0x1'));var logger=require(_0x1120('0x2'))(_0x1120('0x3'));var moment=require('moment');var BPromise=require(_0x1120('0x4'));var rp=require(_0x1120('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1120('0x6'));var config=require(_0x1120('0x7'));var attributes=require(_0x1120('0x8'));module[_0x1120('0x9')]=function(_0x5187f5,_0xf24b9c){return _0x5187f5['define'](_0x1120('0xa'),attributes,{'tableName':_0x1120('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8a5e51,_0x3e4d88,_0x34eb23){if(_0x8a5e51['changed']('closed')){_0x8a5e51[_0x1120('0xc')]=moment()[_0x1120('0xd')](_0x1120('0xe'));}_0x34eb23(null,_0x8a5e51);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 350eaf4..374f6f9 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 _0x051a=['SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','ids','omit','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','./smsInteraction.socket','register','request','then','info'];(function(_0x479acc,_0x515d40){var _0x2653ee=function(_0x1e586c){while(--_0x1e586c){_0x479acc['push'](_0x479acc['shift']());}};_0x2653ee(++_0x515d40);}(_0x051a,0x160));var _0xa051=function(_0x4c7844,_0x3290e2){_0x4c7844=_0x4c7844-0x0;var _0x317bd3=_0x051a[_0x4c7844];return _0x317bd3;};'use strict';var _=require(_0xa051('0x0'));var util=require(_0xa051('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa051('0x2'));var fs=require('fs');var Redis=require(_0xa051('0x3'));var db=require(_0xa051('0x4'))['db'];var utils=require(_0xa051('0x5'));var logger=require('../../config/logger')(_0xa051('0x6'));var config=require('../../config/environment');var jayson=require(_0xa051('0x7'));var client=jayson[_0xa051('0x8')][_0xa051('0x9')]({'port':0x232a});config[_0xa051('0xa')]=_['defaults'](config['redis'],{'host':_0xa051('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa051('0xa')]));require(_0xa051('0xc'))[_0xa051('0xd')](socket);function respondWithRpcPromise(_0x6780f,_0x72f15c,_0x5cc939){return new BPromise(function(_0x5db604,_0x1f5ede){return client[_0xa051('0xe')](_0x6780f,_0x5cc939)[_0xa051('0xf')](function(_0x542e17){logger[_0xa051('0x10')](_0xa051('0x11'),_0x72f15c,_0xa051('0x12'));logger[_0xa051('0x13')](_0xa051('0x14'),_0x72f15c,_0xa051('0x12'),JSON[_0xa051('0x15')](_0x542e17));if(_0x542e17[_0xa051('0x16')]){if(_0x542e17[_0xa051('0x16')][_0xa051('0x17')]===0x1f4){logger['error'](_0xa051('0x11'),_0x72f15c,_0x542e17[_0xa051('0x16')]['message']);return _0x1f5ede(_0x542e17['error'][_0xa051('0x18')]);}logger[_0xa051('0x16')](_0xa051('0x11'),_0x72f15c,_0x542e17[_0xa051('0x16')][_0xa051('0x18')]);return _0x5db604(_0x542e17[_0xa051('0x16')]['message']);}else{logger[_0xa051('0x10')](_0xa051('0x11'),_0x72f15c,_0xa051('0x12'));_0x5db604(_0x542e17['result']['message']);}})[_0xa051('0x19')](function(_0x4dadcb){logger['error'](_0xa051('0x11'),_0x72f15c,_0x4dadcb);_0x1f5ede(_0x4dadcb);});});}exports[_0xa051('0x1a')]=function(_0xccfb1e){var _0x44630e=this;return new Promise(function(_0x40cad6,_0x1a3b8f){return db[_0xa051('0x1b')][_0xa051('0x1c')](_0xccfb1e[_0xa051('0x1d')],{'raw':_0xccfb1e[_0xa051('0x1e')]?_0xccfb1e['options'][_0xa051('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xccfb1e[_0xa051('0x1e')]?_0xccfb1e[_0xa051('0x1e')][_0xa051('0x20')]||null:null,'attributes':_0xccfb1e[_0xa051('0x1e')]?_0xccfb1e[_0xa051('0x1e')][_0xa051('0x21')]||null:null,'limit':_0xccfb1e[_0xa051('0x1e')]?_0xccfb1e[_0xa051('0x1e')][_0xa051('0x22')]||null:null})['then'](function(_0x509b6b){logger[_0xa051('0x10')](_0xa051('0x1a'),_0xccfb1e);logger[_0xa051('0x13')](_0xa051('0x1a'),_0xccfb1e,JSON['stringify'](_0x509b6b));_0x40cad6(_0x509b6b);})['catch'](function(_0x3c33fe){logger[_0xa051('0x16')](_0xa051('0x1a'),_0x3c33fe[_0xa051('0x18')],_0xccfb1e);_0x1a3b8f(_0x44630e[_0xa051('0x16')](0x1f4,_0x3c33fe['message']));});});};exports[_0xa051('0x23')]=function(_0x1739d6){return new Promise(function(_0x33b3cf,_0x118b3d){return db[_0xa051('0x1b')][_0xa051('0x24')]({'where':_0x1739d6['options']?_0x1739d6[_0xa051('0x1e')]['where']||null:null})[_0xa051('0xf')](function(_0x49d048){if(_0x49d048){return _0x49d048[_0xa051('0x25')](_0x1739d6[_0xa051('0x1d')][_0xa051('0x26')],_[_0xa051('0x27')](_0x1739d6[_0xa051('0x1d')],[_0xa051('0x26'),'id'])||{});}})['spread'](function(_0x322eb5){logger[_0xa051('0x10')](_0xa051('0x28'),_0x1739d6);logger['debug'](_0xa051('0x28'),_0x1739d6,JSON[_0xa051('0x15')](_0x322eb5));_0x33b3cf(_0x322eb5);})[_0xa051('0x19')](function(_0x1ed8b7){logger[_0xa051('0x16')](_0xa051('0x28'),_0x1ed8b7['message'],_0x1739d6);_0x118b3d(_this[_0xa051('0x16')](0x1f4,_0x1ed8b7['message']));});});}; \ No newline at end of file +var _0xf2f7=['options','raw','where','attributes','limit','AddTagsToSmsInteraction','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','localhost','socket.io-emitter','redis','register','then','info','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsInteraction,\x20%s,\x20%s','message','catch','UpdateSmsInteraction','SmsInteraction','body'];(function(_0x221eda,_0xcf03bf){var _0x132929=function(_0x18b5d4){while(--_0x18b5d4){_0x221eda['push'](_0x221eda['shift']());}};_0x132929(++_0xcf03bf);}(_0xf2f7,0x17c));var _0x7f2f=function(_0x303164,_0x550d26){_0x303164=_0x303164-0x0;var _0x546978=_0xf2f7[_0x303164];return _0x546978;};'use strict';var _=require(_0x7f2f('0x0'));var util=require(_0x7f2f('0x1'));var moment=require(_0x7f2f('0x2'));var BPromise=require(_0x7f2f('0x3'));var rs=require(_0x7f2f('0x4'));var fs=require('fs');var Redis=require(_0x7f2f('0x5'));var db=require(_0x7f2f('0x6'))['db'];var utils=require(_0x7f2f('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x7f2f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7f2f('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x7f2f('0xa'),'port':0x18eb});var socket=require(_0x7f2f('0xb'))(new Redis(config[_0x7f2f('0xc')]));require('./smsInteraction.socket')[_0x7f2f('0xd')](socket);function respondWithRpcPromise(_0x361ea4,_0x287373,_0x178885){return new BPromise(function(_0x60b62f,_0xa0f809){return client['request'](_0x361ea4,_0x178885)[_0x7f2f('0xe')](function(_0x1fa546){logger[_0x7f2f('0xf')]('SmsInteraction,\x20%s,\x20%s',_0x287373,'request\x20sent');logger[_0x7f2f('0x10')](_0x7f2f('0x11'),_0x287373,'request\x20sent',JSON[_0x7f2f('0x12')](_0x1fa546));if(_0x1fa546['error']){if(_0x1fa546['error'][_0x7f2f('0x13')]===0x1f4){logger[_0x7f2f('0x14')](_0x7f2f('0x15'),_0x287373,_0x1fa546[_0x7f2f('0x14')]['message']);return _0xa0f809(_0x1fa546[_0x7f2f('0x14')][_0x7f2f('0x16')]);}logger[_0x7f2f('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x287373,_0x1fa546[_0x7f2f('0x14')]['message']);return _0x60b62f(_0x1fa546['error']['message']);}else{logger[_0x7f2f('0xf')](_0x7f2f('0x15'),_0x287373,'request\x20sent');_0x60b62f(_0x1fa546['result'][_0x7f2f('0x16')]);}})[_0x7f2f('0x17')](function(_0x58f333){logger['error'](_0x7f2f('0x15'),_0x287373,_0x58f333);_0xa0f809(_0x58f333);});});}exports[_0x7f2f('0x18')]=function(_0xc13cc3){var _0x51348a=this;return new Promise(function(_0x1236cb,_0x33c01a){return db[_0x7f2f('0x19')]['update'](_0xc13cc3[_0x7f2f('0x1a')],{'raw':_0xc13cc3[_0x7f2f('0x1b')]?_0xc13cc3[_0x7f2f('0x1b')][_0x7f2f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc13cc3['options']?_0xc13cc3[_0x7f2f('0x1b')][_0x7f2f('0x1d')]||null:null,'attributes':_0xc13cc3[_0x7f2f('0x1b')]?_0xc13cc3[_0x7f2f('0x1b')][_0x7f2f('0x1e')]||null:null,'limit':_0xc13cc3['options']?_0xc13cc3[_0x7f2f('0x1b')][_0x7f2f('0x1f')]||null:null})[_0x7f2f('0xe')](function(_0x282a36){logger['info'](_0x7f2f('0x18'),_0xc13cc3);logger['debug'](_0x7f2f('0x18'),_0xc13cc3,JSON[_0x7f2f('0x12')](_0x282a36));_0x1236cb(_0x282a36);})[_0x7f2f('0x17')](function(_0x8205f){logger[_0x7f2f('0x14')]('UpdateSmsInteraction',_0x8205f['message'],_0xc13cc3);_0x33c01a(_0x51348a['error'](0x1f4,_0x8205f['message']));});});};exports[_0x7f2f('0x20')]=function(_0x2f3fd1){return new Promise(function(_0x3df278,_0x1bfbfe){return db['SmsInteraction']['find']({'where':_0x2f3fd1['options']?_0x2f3fd1[_0x7f2f('0x1b')]['where']||null:null})[_0x7f2f('0xe')](function(_0x7ed6c6){if(_0x7ed6c6){return _0x7ed6c6['addTags'](_0x2f3fd1[_0x7f2f('0x1a')][_0x7f2f('0x21')],_[_0x7f2f('0x22')](_0x2f3fd1['body'],[_0x7f2f('0x21'),'id'])||{});}})[_0x7f2f('0x23')](function(_0x551adb){logger['info'](_0x7f2f('0x24'),_0x2f3fd1);logger[_0x7f2f('0x10')]('AddTags',_0x2f3fd1,JSON[_0x7f2f('0x12')](_0x551adb));_0x3df278(_0x551adb);})[_0x7f2f('0x17')](function(_0x1e5802){logger[_0x7f2f('0x14')](_0x7f2f('0x24'),_0x1e5802[_0x7f2f('0x16')],_0x2f3fd1);_0x1bfbfe(_this[_0x7f2f('0x14')](0x1f4,_0x1e5802[_0x7f2f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 8f94d16..8e229cf 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 _0xaa44=['emit','removeListener','length','./smsInteraction.events','save','update'];(function(_0x4ab656,_0x3acc9c){var _0x4b0942=function(_0x23fd0e){while(--_0x23fd0e){_0x4ab656['push'](_0x4ab656['shift']());}};_0x4b0942(++_0x3acc9c);}(_0xaa44,0x105));var _0x4aa4=function(_0x27d41b,_0x408b41){_0x27d41b=_0x27d41b-0x0;var _0x3db577=_0xaa44[_0x27d41b];return _0x3db577;};'use strict';var SmsInteractionEvents=require(_0x4aa4('0x0'));var events=[_0x4aa4('0x1'),'remove',_0x4aa4('0x2')];function createListener(_0x4fe4c2,_0x564ad2){return function(_0x126018){_0x564ad2[_0x4aa4('0x3')](_0x4fe4c2,_0x126018);};}function removeListener(_0x35961d,_0x1edf3f){return function(){SmsInteractionEvents[_0x4aa4('0x4')](_0x35961d,_0x1edf3f);};}exports['register']=function(_0x2baa7f){for(var _0x2019f9=0x0,_0x522a34=events[_0x4aa4('0x5')];_0x2019f9<_0x522a34;_0x2019f9++){var _0x4c18fb=events[_0x2019f9];var _0x2fe68e=createListener('smsInteraction:'+_0x4c18fb,_0x2baa7f);SmsInteractionEvents['on'](_0x4c18fb,_0x2fe68e);}}; \ No newline at end of file +var _0x9111=['save','update','emit','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x160e64,_0x4a9672){var _0x2bba4b=function(_0x3d9986){while(--_0x3d9986){_0x160e64['push'](_0x160e64['shift']());}};_0x2bba4b(++_0x4a9672);}(_0x9111,0xed));var _0x1911=function(_0x3393c8,_0x4696c9){_0x3393c8=_0x3393c8-0x0;var _0x44117b=_0x9111[_0x3393c8];return _0x44117b;};'use strict';var SmsInteractionEvents=require(_0x1911('0x0'));var events=[_0x1911('0x1'),'remove',_0x1911('0x2')];function createListener(_0x5194f4,_0x1cc053){return function(_0x19834c){_0x1cc053[_0x1911('0x3')](_0x5194f4,_0x19834c);};}function removeListener(_0x313c79,_0x42d02a){return function(){SmsInteractionEvents['removeListener'](_0x313c79,_0x42d02a);};}exports[_0x1911('0x4')]=function(_0x325f7d){for(var _0x3a8397=0x0,_0xf58706=events[_0x1911('0x5')];_0x3a8397<_0xf58706;_0x3a8397++){var _0x3316fa=events[_0x3a8397];var _0x5252f2=createListener(_0x1911('0x6')+_0x3316fa,_0x325f7d);SmsInteractionEvents['on'](_0x3316fa,_0x5252f2);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 3ea0407..f5adae2 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 _0x58fd=['accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','post','/:id/status','put','/:id','/:id/accept'];(function(_0x3eb426,_0x321a16){var _0x5a14a1=function(_0x59825c){while(--_0x59825c){_0x3eb426['push'](_0x3eb426['shift']());}};_0x5a14a1(++_0x321a16);}(_0x58fd,0xe6));var _0xd58f=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x58fd[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0xd58f('0x0'));var util=require(_0xd58f('0x1'));var path=require(_0xd58f('0x2'));var timeout=require(_0xd58f('0x3'));var express=require(_0xd58f('0x4'));var router=express[_0xd58f('0x5')]();var fs_extra=require(_0xd58f('0x6'));var auth=require(_0xd58f('0x7'));var interaction=require(_0xd58f('0x8'));var config=require(_0xd58f('0x9'));var controller=require(_0xd58f('0xa'));router[_0xd58f('0xb')]('/',auth[_0xd58f('0xc')](),controller[_0xd58f('0xd')]);router[_0xd58f('0xb')](_0xd58f('0xe'),auth[_0xd58f('0xc')](),controller['describe']);router[_0xd58f('0xb')]('/:id',auth[_0xd58f('0xc')](),controller['show']);router[_0xd58f('0xf')]('/',auth[_0xd58f('0xc')](),interaction['tracked']('sms','smsmessage:create'),controller['create']);router[_0xd58f('0xf')](_0xd58f('0x10'),controller['status']);router[_0xd58f('0x11')](_0xd58f('0x12'),auth[_0xd58f('0xc')](),controller['update']);router[_0xd58f('0x11')](_0xd58f('0x13'),auth[_0xd58f('0xc')](),controller[_0xd58f('0x14')]);router[_0xd58f('0x11')](_0xd58f('0x15'),auth['isAuthenticated'](),controller[_0xd58f('0x16')]);router[_0xd58f('0x17')](_0xd58f('0x12'),auth[_0xd58f('0xc')](),controller[_0xd58f('0x18')]);module['exports']=router; \ No newline at end of file +var _0x1604=['isAuthenticated','index','/describe','describe','tracked','sms','smsmessage:create','create','/:id/status','put','/:id','update','accept','/:id/reject','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get'];(function(_0x5c72ee,_0x5a8bf8){var _0x231876=function(_0x955276){while(--_0x955276){_0x5c72ee['push'](_0x5c72ee['shift']());}};_0x231876(++_0x5a8bf8);}(_0x1604,0xac));var _0x4160=function(_0x1f51f2,_0x4e6a8a){_0x1f51f2=_0x1f51f2-0x0;var _0x162935=_0x1604[_0x1f51f2];return _0x162935;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4160('0x0'));var timeout=require(_0x4160('0x1'));var express=require(_0x4160('0x2'));var router=express[_0x4160('0x3')]();var fs_extra=require(_0x4160('0x4'));var auth=require(_0x4160('0x5'));var interaction=require(_0x4160('0x6'));var config=require(_0x4160('0x7'));var controller=require(_0x4160('0x8'));router[_0x4160('0x9')]('/',auth[_0x4160('0xa')](),controller[_0x4160('0xb')]);router[_0x4160('0x9')](_0x4160('0xc'),auth['isAuthenticated'](),controller[_0x4160('0xd')]);router['get']('/:id',auth[_0x4160('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0x4160('0xe')](_0x4160('0xf'),_0x4160('0x10')),controller[_0x4160('0x11')]);router['post'](_0x4160('0x12'),controller['status']);router[_0x4160('0x13')](_0x4160('0x14'),auth['isAuthenticated'](),controller[_0x4160('0x15')]);router['put']('/:id/accept',auth[_0x4160('0xa')](),controller[_0x4160('0x16')]);router[_0x4160('0x13')](_0x4160('0x17'),auth[_0x4160('0xa')](),controller['reject']);router[_0x4160('0x18')](_0x4160('0x14'),auth[_0x4160('0xa')](),controller[_0x4160('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 cb61ec6..b74dcf6 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 _0x1c9a=['exports','medium','BOOLEAN','ENUM','out','STRING','TEXT','sequelize'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x2158e5,_0x5e3f56){_0x2158e5=_0x2158e5-0x0;var _0x5e6216=_0x1c9a[_0x2158e5];return _0x5e6216;};'use strict';var Sequelize=require(_0xa1c9('0x0'));module[_0xa1c9('0x1')]={'body':{'type':Sequelize['TEXT'](_0xa1c9('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa1c9('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa1c9('0x4')]('in',_0xa1c9('0x5')),'defaultValue':_0xa1c9('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xa1c9('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xa1c9('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa1c9('0x6')]},'providerResponse':{'type':Sequelize[_0xa1c9('0x7')]}}; \ No newline at end of file +var _0x724f=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x4f61a1,_0x35820b){var _0xae8b64=function(_0x4f784c){while(--_0x4f784c){_0x4f61a1['push'](_0x4f61a1['shift']());}};_0xae8b64(++_0x35820b);}(_0x724f,0x1ea));var _0xf724=function(_0x4954e7,_0x143ddc){_0x4954e7=_0x4954e7-0x0;var _0x574062=_0x724f[_0x4954e7];return _0x574062;};'use strict';var Sequelize=require(_0xf724('0x0'));module[_0xf724('0x1')]={'body':{'type':Sequelize[_0xf724('0x2')](_0xf724('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf724('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf724('0x5')]('in',_0xf724('0x6')),'defaultValue':_0xf724('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xf724('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf724('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index acb530c..617d710 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 _0xd1f8=['error','code','SmsMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','destroy','name','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','keys','create','body','find','params','describe','sms-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','agent','manual','interface','channel','motionChannel','EventManager','sms','role','RejectMessage','ContactId','Sequelize','SIP/%s','event','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','messageId','sent','Status','plivio','infobip','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3cd6c5,_0x538c8f){var _0x15c7e7=function(_0x226bb8){while(--_0x226bb8){_0x3cd6c5['push'](_0x3cd6c5['shift']());}};_0x15c7e7(++_0x538c8f);}(_0xd1f8,0x18e));var _0x8d1f=function(_0xf34b0a,_0x11e116){_0xf34b0a=_0xf34b0a-0x0;var _0x5021e1=_0xd1f8[_0xf34b0a];return _0x5021e1;};'use strict';var emlformat=require(_0x8d1f('0x0'));var rimraf=require(_0x8d1f('0x1'));var zipdir=require(_0x8d1f('0x2'));var jsonpatch=require(_0x8d1f('0x3'));var rp=require('request-promise');var moment=require(_0x8d1f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8d1f('0x5'));var util=require('util');var path=require(_0x8d1f('0x6'));var sox=require('sox');var csv=require(_0x8d1f('0x7'));var ejs=require(_0x8d1f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d1f('0x9'));var squel=require(_0x8d1f('0xa'));var crypto=require(_0x8d1f('0xb'));var jsforce=require(_0x8d1f('0xc'));var deskjs=require(_0x8d1f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8d1f('0xe'));var Papa=require(_0x8d1f('0xf'));var Redis=require('ioredis');var authService=require(_0x8d1f('0x10'));var qs=require(_0x8d1f('0x11'));var as=require(_0x8d1f('0x12'));var hardwareService=require(_0x8d1f('0x13'));var logger=require(_0x8d1f('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8d1f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d1f('0x16'))['db'];config[_0x8d1f('0x17')]=_['defaults'](config[_0x8d1f('0x17')],{'host':_0x8d1f('0x18'),'port':0x18eb});var socket=require(_0x8d1f('0x19'))(new Redis(config['redis']));require(_0x8d1f('0x1a'))[_0x8d1f('0x1b')](socket);var jayson=require(_0x8d1f('0x1c'));var client=jayson[_0x8d1f('0x1d')][_0x8d1f('0x1e')]({'port':0x232c});var client9002=jayson[_0x8d1f('0x1d')][_0x8d1f('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1af7e2,_0x2463c9,_0x2422d0,_0x19dabf){return new BPromise(function(_0x1c106a,_0x431beb){var _0x2036ee=_0x19dabf||client;return _0x2036ee[_0x8d1f('0x1f')](_0x1af7e2,_0x2422d0)[_0x8d1f('0x20')](function(_0x3fc761){logger['info']('SmsMessage,\x20%s,\x20%s',_0x2463c9,_0x8d1f('0x21'));logger[_0x8d1f('0x22')](_0x8d1f('0x23'),_0x2463c9,_0x8d1f('0x21'),JSON[_0x8d1f('0x24')](_0x3fc761));if(_0x3fc761[_0x8d1f('0x25')]){if(_0x3fc761['error'][_0x8d1f('0x26')]===0x1f4){logger[_0x8d1f('0x25')](_0x8d1f('0x27'),_0x2463c9,_0x3fc761[_0x8d1f('0x25')]['message']);return _0x431beb(_0x3fc761['error'][_0x8d1f('0x28')]);}logger[_0x8d1f('0x25')]('SmsMessage,\x20%s,\x20%s',_0x2463c9,_0x3fc761[_0x8d1f('0x25')]['message']);return _0x1c106a(_0x3fc761[_0x8d1f('0x25')][_0x8d1f('0x28')]);}else{logger[_0x8d1f('0x29')](_0x8d1f('0x27'),_0x2463c9,_0x8d1f('0x21'));_0x1c106a(_0x3fc761[_0x8d1f('0x2a')][_0x8d1f('0x28')]);}})[_0x8d1f('0x2b')](function(_0x296d0c){logger['error'](_0x8d1f('0x27'),_0x2463c9,_0x296d0c);_0x431beb(_0x296d0c);});});}function respondWithStatusCode(_0x213321,_0x584157){_0x584157=_0x584157||0xcc;return function(_0x391e79){if(_0x391e79){return _0x213321[_0x8d1f('0x2c')](_0x584157);}return _0x213321['status'](_0x584157)[_0x8d1f('0x2d')]();};}function respondWithResult(_0x2dbc3d,_0x7d84d8){_0x7d84d8=_0x7d84d8||0xc8;return function(_0x56748d){if(_0x56748d){return _0x2dbc3d[_0x8d1f('0x2e')](_0x7d84d8)[_0x8d1f('0x2f')](_0x56748d);}};}function respondWithFilteredResult(_0x4ca54a,_0x4e7e41){return function(_0x3c15de){if(_0x3c15de){var _0x564920=typeof _0x4e7e41['offset']===_0x8d1f('0x30')&&typeof _0x4e7e41[_0x8d1f('0x31')]===_0x8d1f('0x30');var _0x10829d=_0x3c15de[_0x8d1f('0x32')];var _0x46e90e=_0x564920?0x0:_0x4e7e41[_0x8d1f('0x33')];var _0x1da9f8=_0x564920?_0x3c15de['count']:_0x4e7e41[_0x8d1f('0x33')]+_0x4e7e41[_0x8d1f('0x31')];var _0x2f6003;if(_0x1da9f8>=_0x10829d){_0x1da9f8=_0x10829d;_0x2f6003=0xc8;}else{_0x2f6003=0xce;}_0x4ca54a[_0x8d1f('0x2e')](_0x2f6003);return _0x4ca54a[_0x8d1f('0x34')](_0x8d1f('0x35'),_0x46e90e+'-'+_0x1da9f8+'/'+_0x10829d)['json'](_0x3c15de);}return null;};}function patchUpdates(_0x340e44){return function(_0x47cff6){try{jsonpatch['apply'](_0x47cff6,_0x340e44,!![]);}catch(_0x45bf99){return BPromise[_0x8d1f('0x36')](_0x45bf99);}return _0x47cff6['save']();};}function saveUpdates(_0x4c33e8,_0x54f397){return function(_0x296d1a){if(_0x296d1a){return _0x296d1a[_0x8d1f('0x37')](_0x4c33e8)[_0x8d1f('0x20')](function(_0x24d865){return _0x24d865;});}return null;};}function removeEntity(_0x2cff29,_0x6c6d58){return function(_0x25fcd7){if(_0x25fcd7){return _0x25fcd7[_0x8d1f('0x38')]()['then'](function(){_0x2cff29['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30a671,_0xdbe040){return function(_0x30b4d2){if(!_0x30b4d2){_0x30a671[_0x8d1f('0x2c')](0x194);}return _0x30b4d2;};}function handleError(_0x1d6f68,_0x15e37f){_0x15e37f=_0x15e37f||0x1f4;return function(_0x5a5a55){logger[_0x8d1f('0x25')](_0x5a5a55['stack']);if(_0x5a5a55[_0x8d1f('0x39')]){delete _0x5a5a55[_0x8d1f('0x39')];}_0x1d6f68['status'](_0x15e37f)['send'](_0x5a5a55);};}exports[_0x8d1f('0x3a')]=function(_0x44b018,_0x2d002d){var _0x142e2e={},_0x3feca6={},_0x1aed5e={'count':0x0,'rows':[]};var _0x53d1e9=_[_0x8d1f('0x3b')](db[_0x8d1f('0x3c')][_0x8d1f('0x3d')],function(_0x19273f){return{'name':_0x19273f[_0x8d1f('0x3e')],'type':_0x19273f[_0x8d1f('0x3f')][_0x8d1f('0x40')]};});_0x3feca6[_0x8d1f('0x41')]=_[_0x8d1f('0x3b')](_0x53d1e9,_0x8d1f('0x39'));_0x3feca6[_0x8d1f('0x42')]=_['keys'](_0x44b018[_0x8d1f('0x42')]);_0x3feca6[_0x8d1f('0x43')]=_[_0x8d1f('0x44')](_0x3feca6['model'],_0x3feca6['query']);_0x142e2e['attributes']=_[_0x8d1f('0x44')](_0x3feca6[_0x8d1f('0x41')],qs['fields'](_0x44b018[_0x8d1f('0x42')][_0x8d1f('0x45')]));_0x142e2e[_0x8d1f('0x46')]=_0x142e2e[_0x8d1f('0x46')][_0x8d1f('0x47')]?_0x142e2e[_0x8d1f('0x46')]:_0x3feca6[_0x8d1f('0x41')];if(!_0x44b018[_0x8d1f('0x42')][_0x8d1f('0x48')](_0x8d1f('0x49'))){_0x142e2e[_0x8d1f('0x31')]=qs['limit'](_0x44b018[_0x8d1f('0x42')][_0x8d1f('0x31')]);_0x142e2e['offset']=qs[_0x8d1f('0x33')](_0x44b018[_0x8d1f('0x42')][_0x8d1f('0x33')]);}_0x142e2e[_0x8d1f('0x4a')]=qs['sort'](_0x44b018['query']['sort']);_0x142e2e['where']=qs[_0x8d1f('0x43')](_[_0x8d1f('0x4b')](_0x44b018['query'],_0x3feca6[_0x8d1f('0x43')]),_0x53d1e9);if(_0x44b018['query']['filter']){_0x142e2e['where']=_[_0x8d1f('0x4c')](_0x142e2e[_0x8d1f('0x4d')],{'$or':_[_0x8d1f('0x3b')](_0x53d1e9,function(_0x161533){if(_0x161533['type']!==_0x8d1f('0x4e')){var _0x546efc={};_0x546efc[_0x161533['name']]={'$like':'%'+_0x44b018[_0x8d1f('0x42')][_0x8d1f('0x4f')]+'%'};return _0x546efc;}})});}_0x142e2e=_[_0x8d1f('0x4c')]({},_0x142e2e,_0x44b018[_0x8d1f('0x50')]);var _0x1070c8={'where':_0x142e2e[_0x8d1f('0x4d')]};return db[_0x8d1f('0x3c')][_0x8d1f('0x32')](_0x1070c8)[_0x8d1f('0x20')](function(_0x521d07){_0x1aed5e[_0x8d1f('0x32')]=_0x521d07;if(_0x44b018[_0x8d1f('0x42')][_0x8d1f('0x51')]){_0x142e2e[_0x8d1f('0x52')]=[{'all':!![]}];}return db[_0x8d1f('0x3c')][_0x8d1f('0x53')](_0x142e2e);})[_0x8d1f('0x20')](function(_0x1d5cce){_0x1aed5e[_0x8d1f('0x54')]=_0x1d5cce;return _0x1aed5e;})[_0x8d1f('0x20')](respondWithFilteredResult(_0x2d002d,_0x142e2e))[_0x8d1f('0x2b')](handleError(_0x2d002d,null));};exports[_0x8d1f('0x55')]=function(_0x4027d6,_0x28114d){var _0x1bf8cd={'raw':!![],'where':{'id':_0x4027d6['params']['id']}},_0x3f377a={};_0x3f377a[_0x8d1f('0x41')]=_[_0x8d1f('0x56')](db[_0x8d1f('0x3c')][_0x8d1f('0x3d')]);_0x3f377a[_0x8d1f('0x42')]=_[_0x8d1f('0x56')](_0x4027d6[_0x8d1f('0x42')]);_0x3f377a[_0x8d1f('0x43')]=_[_0x8d1f('0x44')](_0x3f377a[_0x8d1f('0x41')],_0x3f377a[_0x8d1f('0x42')]);_0x1bf8cd[_0x8d1f('0x46')]=_[_0x8d1f('0x44')](_0x3f377a['model'],qs[_0x8d1f('0x45')](_0x4027d6[_0x8d1f('0x42')][_0x8d1f('0x45')]));_0x1bf8cd[_0x8d1f('0x46')]=_0x1bf8cd[_0x8d1f('0x46')]['length']?_0x1bf8cd[_0x8d1f('0x46')]:_0x3f377a[_0x8d1f('0x41')];if(_0x4027d6[_0x8d1f('0x42')][_0x8d1f('0x51')]){_0x1bf8cd['include']=[{'all':!![]}];}_0x1bf8cd=_[_0x8d1f('0x4c')]({},_0x1bf8cd,_0x4027d6[_0x8d1f('0x50')]);return db[_0x8d1f('0x3c')]['find'](_0x1bf8cd)['then'](handleEntityNotFound(_0x28114d,null))[_0x8d1f('0x20')](respondWithResult(_0x28114d,null))[_0x8d1f('0x2b')](handleError(_0x28114d,null));};exports[_0x8d1f('0x57')]=function(_0x240642,_0x3d6e9e){return db['SmsMessage'][_0x8d1f('0x57')](_0x240642[_0x8d1f('0x58')],{})['then'](respondWithResult(_0x3d6e9e,0xc9))[_0x8d1f('0x2b')](handleError(_0x3d6e9e,null));};exports[_0x8d1f('0x37')]=function(_0x3c8211,_0x281da){if(_0x3c8211[_0x8d1f('0x58')]['id']){delete _0x3c8211['body']['id'];}return db[_0x8d1f('0x3c')][_0x8d1f('0x59')]({'where':{'id':_0x3c8211[_0x8d1f('0x5a')]['id']}})[_0x8d1f('0x20')](handleEntityNotFound(_0x281da,null))[_0x8d1f('0x20')](saveUpdates(_0x3c8211[_0x8d1f('0x58')],null))[_0x8d1f('0x20')](respondWithResult(_0x281da,null))[_0x8d1f('0x2b')](handleError(_0x281da,null));};exports['destroy']=function(_0xd06ba6,_0x3ac0d1){return db[_0x8d1f('0x3c')][_0x8d1f('0x59')]({'where':{'id':_0xd06ba6[_0x8d1f('0x5a')]['id']}})[_0x8d1f('0x20')](handleEntityNotFound(_0x3ac0d1,null))['then'](removeEntity(_0x3ac0d1,null))['catch'](handleError(_0x3ac0d1,null));};exports[_0x8d1f('0x5b')]=function(_0x470407,_0x411841){return db[_0x8d1f('0x3c')][_0x8d1f('0x5b')]()[_0x8d1f('0x20')](respondWithResult(_0x411841,null))[_0x8d1f('0x2b')](handleError(_0x411841,null));};var interaction_log=require(_0x8d1f('0x14'))(_0x8d1f('0x5c'));exports[_0x8d1f('0x5d')]=function(_0x4b9ab1,_0x3e8751,_0x2bed6e){var _0x2223a6={'agent':{},'channel':'sms'};if(_0x4b9ab1[_0x8d1f('0x58')]['id']){delete _0x4b9ab1[_0x8d1f('0x58')]['id'];}_0x4b9ab1[_0x8d1f('0x58')][_0x8d1f('0x5e')]=!![];_0x4b9ab1[_0x8d1f('0x58')]['readAt']=moment()[_0x8d1f('0x5f')](_0x8d1f('0x60'));_0x4b9ab1[_0x8d1f('0x58')][_0x8d1f('0x61')]=_0x4b9ab1[_0x8d1f('0x58')][_0x8d1f('0x61')]||_0x4b9ab1[_0x8d1f('0x62')]['id'];_0x2223a6['agent']['id']=_0x4b9ab1[_0x8d1f('0x58')]['UserId'];return db[_0x8d1f('0x3c')]['find']({'where':{'id':_0x4b9ab1[_0x8d1f('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3e8751,null))[_0x8d1f('0x20')](saveUpdates(_0x4b9ab1[_0x8d1f('0x58')],null))['then'](function(_0x3eee7c){if(_0x3eee7c){_0x2223a6[_0x8d1f('0x28')]=_0x3eee7c[_0x8d1f('0x63')]({'plain':!![]});return db[_0x8d1f('0x64')][_0x8d1f('0x59')]({'where':{'id':_0x3eee7c[_0x8d1f('0x65')]}});}return null;})[_0x8d1f('0x20')](handleEntityNotFound(_0x3e8751,null))[_0x8d1f('0x20')](function(_0x3567f8){if(_0x3567f8){return _0x3567f8[_0x8d1f('0x37')]({'UserId':_0x4b9ab1[_0x8d1f('0x58')][_0x8d1f('0x61')],'read1stAt':_[_0x8d1f('0x66')](_0x3567f8[_0x8d1f('0x67')])?moment()[_0x8d1f('0x5f')](_0x8d1f('0x60')):undefined});}return null;})[_0x8d1f('0x20')](function(_0x533c2c){if(_0x533c2c){_0x2223a6[_0x8d1f('0x68')]=_0x533c2c['get']({'plain':!![]});interaction_log[_0x8d1f('0x29')](_0x8d1f('0x69'),_0x4b9ab1[_0x8d1f('0x62')]['id'],_0x4b9ab1[_0x8d1f('0x62')][_0x8d1f('0x39')],_0x4b9ab1[_0x8d1f('0x62')]['role'],_0x2223a6[_0x8d1f('0x68')]['id'],_0x4b9ab1['body']?JSON[_0x8d1f('0x24')](_0x4b9ab1[_0x8d1f('0x58')]):_0x8d1f('0x6a'));return respondWithRpcPromise(_0x8d1f('0x6b'),_0x8d1f('0x6c'),_0x2223a6);}return null;})[_0x8d1f('0x20')](function(_0x52d894){var _0x465263=_0x8d1f('0x6d')+_0x52d894[_0x8d1f('0x28')]['ContactId'];return db[_0x8d1f('0x6e')][_0x8d1f('0x42')](_0x465263,{'type':db['Sequelize'][_0x8d1f('0x6f')][_0x8d1f('0x70')],'raw':!![]})[_0x8d1f('0x20')](function(_0x5d851c){return _0x5d851c;});})[_0x8d1f('0x20')](function(_0x286dfc){if(_0x286dfc){_0x2223a6['message'][_0x8d1f('0x71')]=_0x286dfc[0x0];if(!_0x4b9ab1[_0x8d1f('0x58')][_0x8d1f('0x61')])return;return db[_0x8d1f('0x72')][_0x8d1f('0x59')]({'where':{'id':_0x4b9ab1[_0x8d1f('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0x8d1f('0x39'),_0x8d1f('0x73'),_0x8d1f('0x74'),_0x8d1f('0x75')],'raw':!![]});}return null;})[_0x8d1f('0x20')](function(_0x30de4c){if(!_0x30de4c)return null;_0x2223a6[_0x8d1f('0x28')][_0x8d1f('0x76')]=_0x30de4c;return _0x2223a6;})[_0x8d1f('0x20')](function(_0x36ef5a){if(_0x36ef5a){if(_0x4b9ab1[_0x8d1f('0x58')][_0x8d1f('0x77')]){_0x2223a6[_0x8d1f('0x28')][_0x8d1f('0x78')]=util['format']('SIP/%s',_0x4b9ab1[_0x8d1f('0x62')][_0x8d1f('0x39')]);_0x2223a6[_0x8d1f('0x28')][_0x8d1f('0x79')]=_0x2223a6[_0x8d1f('0x79')];_0x2223a6['message'][_0x8d1f('0x7a')]=_0x2223a6[_0x8d1f('0x79')];_0x2223a6['message']['event']='accept';return respondWithRpcPromise(_0x8d1f('0x7b'),_0x8d1f('0x7b'),{'event':'acceptmessage','message':_0x2223a6[_0x8d1f('0x28')]},client9002)[_0x8d1f('0x20')](function(){return _0x2223a6;});}return _0x2223a6;}return null;})[_0x8d1f('0x20')](respondWithResult(_0x3e8751,null))[_0x8d1f('0x2b')](handleError(_0x3e8751,null));};var interaction_log=require(_0x8d1f('0x14'))(_0x8d1f('0x5c'));exports[_0x8d1f('0x36')]=function(_0x4eacc5,_0x168116,_0x2314ab){var _0x1bcd8a={'agent':{},'channel':_0x8d1f('0x7c')};if(_0x4eacc5[_0x8d1f('0x58')]['id']){delete _0x4eacc5[_0x8d1f('0x58')]['id'];}_0x4eacc5[_0x8d1f('0x58')]['UserId']=_0x4eacc5[_0x8d1f('0x58')][_0x8d1f('0x61')]||_0x4eacc5['user']['id'];_0x1bcd8a[_0x8d1f('0x76')]['id']=_0x4eacc5[_0x8d1f('0x58')][_0x8d1f('0x61')];return db['SmsMessage'][_0x8d1f('0x59')]({'where':{'id':_0x4eacc5['params']['id'],'UserId':null}})[_0x8d1f('0x20')](handleEntityNotFound(_0x168116,null))['then'](function(_0x271ac1){if(_0x271ac1){_0x1bcd8a[_0x8d1f('0x28')]=_0x271ac1[_0x8d1f('0x63')]({'plain':!![]});return db[_0x8d1f('0x64')][_0x8d1f('0x59')]({'where':{'id':_0x271ac1[_0x8d1f('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x168116,null))[_0x8d1f('0x20')](function(_0x12eb89){if(_0x12eb89){_0x1bcd8a['interaction']=_0x12eb89[_0x8d1f('0x63')]({'plain':!![]});interaction_log[_0x8d1f('0x29')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4eacc5['user']['id'],_0x4eacc5[_0x8d1f('0x62')]['name'],_0x4eacc5[_0x8d1f('0x62')][_0x8d1f('0x7d')],_0x1bcd8a[_0x8d1f('0x68')]['id'],_0x4eacc5[_0x8d1f('0x58')]?JSON[_0x8d1f('0x24')](_0x4eacc5[_0x8d1f('0x58')]):_0x8d1f('0x6a'));return respondWithRpcPromise(_0x8d1f('0x7e'),'rejectMessage',_0x1bcd8a);}return null;})['then'](function(_0x31b7ae){var _0x20ac14='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x31b7ae['message'][_0x8d1f('0x7f')];return db[_0x8d1f('0x6e')][_0x8d1f('0x42')](_0x20ac14,{'type':db[_0x8d1f('0x80')][_0x8d1f('0x6f')][_0x8d1f('0x70')],'raw':!![]})[_0x8d1f('0x20')](function(_0x41ff13){return _0x41ff13;});})[_0x8d1f('0x20')](function(_0x49a8b3){if(_0x49a8b3){_0x1bcd8a['message']['contact']=_0x49a8b3[0x0];if(!_0x4eacc5['body'][_0x8d1f('0x61')])return;return db[_0x8d1f('0x72')][_0x8d1f('0x59')]({'where':{'id':_0x4eacc5['body'][_0x8d1f('0x61')],'role':_0x8d1f('0x76')},'attributes':['id',_0x8d1f('0x39'),_0x8d1f('0x73'),'email',_0x8d1f('0x75')],'raw':!![]});}return null;})[_0x8d1f('0x20')](function(_0x5c99b7){if(!_0x5c99b7)return null;_0x1bcd8a[_0x8d1f('0x28')][_0x8d1f('0x76')]=_0x5c99b7;return _0x1bcd8a;})[_0x8d1f('0x20')](function(_0x4c0a5d){if(_0x4c0a5d){_0x4c0a5d[_0x8d1f('0x28')][_0x8d1f('0x78')]=util[_0x8d1f('0x5f')](_0x8d1f('0x81'),_0x4eacc5['user'][_0x8d1f('0x39')]);_0x4c0a5d[_0x8d1f('0x28')][_0x8d1f('0x79')]=_0x1bcd8a[_0x8d1f('0x79')];_0x4c0a5d[_0x8d1f('0x28')]['motionChannel']=_0x1bcd8a[_0x8d1f('0x79')];_0x4c0a5d[_0x8d1f('0x28')][_0x8d1f('0x82')]=_0x8d1f('0x36');respondWithRpcPromise(_0x8d1f('0x7b'),_0x8d1f('0x7b'),{'event':'rejectmessage','message':_0x4c0a5d['message']},client9002);return _0x1bcd8a;}return null;})[_0x8d1f('0x20')](respondWithResult(_0x168116,null))[_0x8d1f('0x2b')](handleError(_0x168116,null));};exports[_0x8d1f('0x2e')]=function(_0x564cf7,_0x3173b9,_0x4e30e2){if(_0x564cf7[_0x8d1f('0x58')]['id']){delete _0x564cf7[_0x8d1f('0x58')]['id'];}var _0x2bc6b5;return db[_0x8d1f('0x3c')]['find']({'where':{'id':_0x564cf7[_0x8d1f('0x5a')]['id']}})[_0x8d1f('0x20')](handleEntityNotFound(_0x3173b9,null))['then'](function(_0x5dca47){if(_0x5dca47){_0x2bc6b5=_0x5dca47;return db[_0x8d1f('0x83')][_0x8d1f('0x59')]({'where':{'id':_0x5dca47[_0x8d1f('0x84')]}});}})[_0x8d1f('0x20')](handleEntityNotFound(_0x3173b9,null))[_0x8d1f('0x20')](function(_0x46e8f1){if(_0x46e8f1){logger[_0x8d1f('0x22')](_0x8d1f('0x23'),_0x8d1f('0x2e'),_0x8d1f('0x85'),_0x46e8f1[_0x8d1f('0x3f')],util[_0x8d1f('0x86')](_0x564cf7[_0x8d1f('0x58')],{'showHidden':![],'depth':null}));switch(_0x46e8f1[_0x8d1f('0x3f')]){case'twilio':if(_0x564cf7['body'][_0x8d1f('0x87')]&&_0x564cf7['body'][_0x8d1f('0x87')]===_0x2bc6b5['messageId']){return _0x2bc6b5[_0x8d1f('0x37')]({'read':!![]});}else{logger[_0x8d1f('0x25')](_0x8d1f('0x88'),_0x8d1f('0x2e'),_0x8d1f('0x89'),util[_0x8d1f('0x86')](_0x564cf7[_0x8d1f('0x58')],{'showHidden':![],'depth':null}));}break;case _0x8d1f('0x8a'):if(_0x564cf7[_0x8d1f('0x58')]['MessageUUID']&&_0x564cf7[_0x8d1f('0x58')][_0x8d1f('0x8b')]===_0x2bc6b5[_0x8d1f('0x8c')]&&_['indexOf']([_0x8d1f('0x8d'),'delivered'],_0x564cf7[_0x8d1f('0x58')][_0x8d1f('0x8e')])>=0x0){return _0x2bc6b5[_0x8d1f('0x37')]({'read':!![]});}else{logger[_0x8d1f('0x25')](_0x8d1f('0x88'),_0x8d1f('0x2e'),_0x8d1f('0x8f'),util[_0x8d1f('0x86')](_0x564cf7[_0x8d1f('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x39a247=_0x564cf7[_0x8d1f('0x58')]['results'][0x0];if(_0x39a247[_0x8d1f('0x2e')]['groupName']==='DELIVERED'){return _0x2bc6b5[_0x8d1f('0x37')]({'read':!![]});}else{logger[_0x8d1f('0x25')](_0x8d1f('0x88'),_0x8d1f('0x2e'),_0x8d1f('0x90'),util[_0x8d1f('0x86')](_0x564cf7[_0x8d1f('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x2bc6b5;}})[_0x8d1f('0x20')](respondWithResult(_0x3173b9,null))[_0x8d1f('0x2b')](handleError(_0x3173b9,null));}; \ No newline at end of file +var _0x9ab2=['register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','end','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','length','find','create','update','body','describe','accept','sms','read','readAt','format','UserId','user','get','SmsInteraction','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','SmsInteractionId','stringify','null','RejectMessage','rejectMessage','QueryTypes','SELECT','contact','rejectmessage','SmsAccountId','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','groupName','DELIVERED','infobip','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./smsMessage.socket'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9ab2,0x192));var _0x29ab=function(_0x316a17,_0x54040f){_0x316a17=_0x316a17-0x0;var _0x2c2f18=_0x9ab2[_0x316a17];return _0x2c2f18;};'use strict';var emlformat=require(_0x29ab('0x0'));var rimraf=require(_0x29ab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29ab('0x2'));var rp=require(_0x29ab('0x3'));var moment=require(_0x29ab('0x4'));var BPromise=require(_0x29ab('0x5'));var Mustache=require(_0x29ab('0x6'));var util=require(_0x29ab('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x29ab('0x8'));var ejs=require(_0x29ab('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x29ab('0xa'));var crypto=require(_0x29ab('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x29ab('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29ab('0xd'));var authService=require(_0x29ab('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29ab('0xf'));var logger=require(_0x29ab('0x10'))(_0x29ab('0x11'));var utils=require(_0x29ab('0x12'));var config=require(_0x29ab('0x13'));var licenseUtil=require(_0x29ab('0x14'));var db=require(_0x29ab('0x15'))['db'];config['redis']=_[_0x29ab('0x16')](config['redis'],{'host':_0x29ab('0x17'),'port':0x18eb});var socket=require(_0x29ab('0x18'))(new Redis(config[_0x29ab('0x19')]));require(_0x29ab('0x1a'))[_0x29ab('0x1b')](socket);var jayson=require(_0x29ab('0x1c'));var client=jayson[_0x29ab('0x1d')][_0x29ab('0x1e')]({'port':0x232c});var client9002=jayson[_0x29ab('0x1d')][_0x29ab('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x107175,_0x3c6ca8,_0x50eadc,_0x578c4f){return new BPromise(function(_0x2b7d43,_0xfab02c){var _0x4a05c1=_0x578c4f||client;return _0x4a05c1['request'](_0x107175,_0x50eadc)[_0x29ab('0x1f')](function(_0x11cb2b){logger[_0x29ab('0x20')](_0x29ab('0x21'),_0x3c6ca8,_0x29ab('0x22'));logger[_0x29ab('0x23')](_0x29ab('0x24'),_0x3c6ca8,_0x29ab('0x22'),JSON['stringify'](_0x11cb2b));if(_0x11cb2b[_0x29ab('0x25')]){if(_0x11cb2b[_0x29ab('0x25')]['code']===0x1f4){logger[_0x29ab('0x25')](_0x29ab('0x21'),_0x3c6ca8,_0x11cb2b[_0x29ab('0x25')][_0x29ab('0x26')]);return _0xfab02c(_0x11cb2b[_0x29ab('0x25')][_0x29ab('0x26')]);}logger[_0x29ab('0x25')](_0x29ab('0x21'),_0x3c6ca8,_0x11cb2b['error'][_0x29ab('0x26')]);return _0x2b7d43(_0x11cb2b['error'][_0x29ab('0x26')]);}else{logger[_0x29ab('0x20')](_0x29ab('0x21'),_0x3c6ca8,_0x29ab('0x22'));_0x2b7d43(_0x11cb2b[_0x29ab('0x27')][_0x29ab('0x26')]);}})[_0x29ab('0x28')](function(_0x3be06e){logger[_0x29ab('0x25')](_0x29ab('0x21'),_0x3c6ca8,_0x3be06e);_0xfab02c(_0x3be06e);});});}function respondWithStatusCode(_0x45ba5b,_0x3c0f69){_0x3c0f69=_0x3c0f69||0xcc;return function(_0x3466f0){if(_0x3466f0){return _0x45ba5b[_0x29ab('0x29')](_0x3c0f69);}return _0x45ba5b[_0x29ab('0x2a')](_0x3c0f69)['end']();};}function respondWithResult(_0xdc9d43,_0x116784){_0x116784=_0x116784||0xc8;return function(_0x5714ad){if(_0x5714ad){return _0xdc9d43['status'](_0x116784)[_0x29ab('0x2b')](_0x5714ad);}};}function respondWithFilteredResult(_0x545866,_0x13a2f5){return function(_0x477fad){if(_0x477fad){var _0x22411d=typeof _0x13a2f5[_0x29ab('0x2c')]===_0x29ab('0x2d')&&typeof _0x13a2f5['limit']==='undefined';var _0x2213a9=_0x477fad[_0x29ab('0x2e')];var _0x25efbe=_0x22411d?0x0:_0x13a2f5['offset'];var _0x8f8115=_0x22411d?_0x477fad['count']:_0x13a2f5[_0x29ab('0x2c')]+_0x13a2f5['limit'];var _0x2f3d2d;if(_0x8f8115>=_0x2213a9){_0x8f8115=_0x2213a9;_0x2f3d2d=0xc8;}else{_0x2f3d2d=0xce;}_0x545866[_0x29ab('0x2a')](_0x2f3d2d);return _0x545866[_0x29ab('0x2f')](_0x29ab('0x30'),_0x25efbe+'-'+_0x8f8115+'/'+_0x2213a9)[_0x29ab('0x2b')](_0x477fad);}return null;};}function patchUpdates(_0x539b68){return function(_0x1441de){try{jsonpatch[_0x29ab('0x31')](_0x1441de,_0x539b68,!![]);}catch(_0x15094c){return BPromise[_0x29ab('0x32')](_0x15094c);}return _0x1441de[_0x29ab('0x33')]();};}function saveUpdates(_0x5f4c6e,_0x282473){return function(_0x182038){if(_0x182038){return _0x182038['update'](_0x5f4c6e)[_0x29ab('0x1f')](function(_0x4c119f){return _0x4c119f;});}return null;};}function removeEntity(_0x58cf0e,_0x8140e4){return function(_0x70b917){if(_0x70b917){return _0x70b917[_0x29ab('0x34')]()['then'](function(){_0x58cf0e[_0x29ab('0x2a')](0xcc)[_0x29ab('0x35')]();});}};}function handleEntityNotFound(_0x2333f5,_0x26a025){return function(_0x4ff0e1){if(!_0x4ff0e1){_0x2333f5[_0x29ab('0x29')](0x194);}return _0x4ff0e1;};}function handleError(_0x2b427e,_0x11b7f4){_0x11b7f4=_0x11b7f4||0x1f4;return function(_0x458008){logger[_0x29ab('0x25')](_0x458008[_0x29ab('0x36')]);if(_0x458008[_0x29ab('0x37')]){delete _0x458008[_0x29ab('0x37')];}_0x2b427e[_0x29ab('0x2a')](_0x11b7f4)[_0x29ab('0x38')](_0x458008);};}exports[_0x29ab('0x39')]=function(_0x157342,_0x56bd25){var _0x17076e={},_0x32282e={},_0x50e837={'count':0x0,'rows':[]};var _0x58b88f=_[_0x29ab('0x3a')](db[_0x29ab('0x3b')][_0x29ab('0x3c')],function(_0x1c83fa){return{'name':_0x1c83fa[_0x29ab('0x3d')],'type':_0x1c83fa[_0x29ab('0x3e')]['key']};});_0x32282e['model']=_[_0x29ab('0x3a')](_0x58b88f,_0x29ab('0x37'));_0x32282e['query']=_[_0x29ab('0x3f')](_0x157342[_0x29ab('0x40')]);_0x32282e['filters']=_[_0x29ab('0x41')](_0x32282e[_0x29ab('0x42')],_0x32282e[_0x29ab('0x40')]);_0x17076e[_0x29ab('0x43')]=_[_0x29ab('0x41')](_0x32282e[_0x29ab('0x42')],qs[_0x29ab('0x44')](_0x157342[_0x29ab('0x40')]['fields']));_0x17076e['attributes']=_0x17076e[_0x29ab('0x43')]['length']?_0x17076e[_0x29ab('0x43')]:_0x32282e[_0x29ab('0x42')];if(!_0x157342[_0x29ab('0x40')][_0x29ab('0x45')](_0x29ab('0x46'))){_0x17076e[_0x29ab('0x47')]=qs[_0x29ab('0x47')](_0x157342[_0x29ab('0x40')][_0x29ab('0x47')]);_0x17076e[_0x29ab('0x2c')]=qs[_0x29ab('0x2c')](_0x157342[_0x29ab('0x40')][_0x29ab('0x2c')]);}_0x17076e[_0x29ab('0x48')]=qs[_0x29ab('0x49')](_0x157342[_0x29ab('0x40')][_0x29ab('0x49')]);_0x17076e[_0x29ab('0x4a')]=qs[_0x29ab('0x4b')](_[_0x29ab('0x4c')](_0x157342[_0x29ab('0x40')],_0x32282e[_0x29ab('0x4b')]),_0x58b88f);if(_0x157342[_0x29ab('0x40')][_0x29ab('0x4d')]){_0x17076e[_0x29ab('0x4a')]=_[_0x29ab('0x4e')](_0x17076e[_0x29ab('0x4a')],{'$or':_[_0x29ab('0x3a')](_0x58b88f,function(_0xb7def5){if(_0xb7def5[_0x29ab('0x3e')]!==_0x29ab('0x4f')){var _0x131d20={};_0x131d20[_0xb7def5[_0x29ab('0x37')]]={'$like':'%'+_0x157342[_0x29ab('0x40')][_0x29ab('0x4d')]+'%'};return _0x131d20;}})});}_0x17076e=_['merge']({},_0x17076e,_0x157342[_0x29ab('0x50')]);var _0x49f944={'where':_0x17076e['where']};return db[_0x29ab('0x3b')][_0x29ab('0x2e')](_0x49f944)['then'](function(_0x44edae){_0x50e837['count']=_0x44edae;if(_0x157342['query'][_0x29ab('0x51')]){_0x17076e[_0x29ab('0x52')]=[{'all':!![]}];}return db['SmsMessage'][_0x29ab('0x53')](_0x17076e);})['then'](function(_0x26cd5f){_0x50e837['rows']=_0x26cd5f;return _0x50e837;})[_0x29ab('0x1f')](respondWithFilteredResult(_0x56bd25,_0x17076e))[_0x29ab('0x28')](handleError(_0x56bd25,null));};exports['show']=function(_0x4782cb,_0x522fc9){var _0x1dc819={'raw':!![],'where':{'id':_0x4782cb[_0x29ab('0x54')]['id']}},_0x1106d5={};_0x1106d5['model']=_[_0x29ab('0x3f')](db[_0x29ab('0x3b')][_0x29ab('0x3c')]);_0x1106d5[_0x29ab('0x40')]=_[_0x29ab('0x3f')](_0x4782cb['query']);_0x1106d5[_0x29ab('0x4b')]=_[_0x29ab('0x41')](_0x1106d5['model'],_0x1106d5['query']);_0x1dc819['attributes']=_[_0x29ab('0x41')](_0x1106d5[_0x29ab('0x42')],qs['fields'](_0x4782cb[_0x29ab('0x40')][_0x29ab('0x44')]));_0x1dc819['attributes']=_0x1dc819[_0x29ab('0x43')][_0x29ab('0x55')]?_0x1dc819[_0x29ab('0x43')]:_0x1106d5[_0x29ab('0x42')];if(_0x4782cb[_0x29ab('0x40')]['includeAll']){_0x1dc819[_0x29ab('0x52')]=[{'all':!![]}];}_0x1dc819=_[_0x29ab('0x4e')]({},_0x1dc819,_0x4782cb[_0x29ab('0x50')]);return db[_0x29ab('0x3b')][_0x29ab('0x56')](_0x1dc819)['then'](handleEntityNotFound(_0x522fc9,null))['then'](respondWithResult(_0x522fc9,null))[_0x29ab('0x28')](handleError(_0x522fc9,null));};exports['create']=function(_0x5d2953,_0x4ccd1b){return db[_0x29ab('0x3b')][_0x29ab('0x57')](_0x5d2953['body'],{})[_0x29ab('0x1f')](respondWithResult(_0x4ccd1b,0xc9))[_0x29ab('0x28')](handleError(_0x4ccd1b,null));};exports[_0x29ab('0x58')]=function(_0x327ca9,_0x4fdf15){if(_0x327ca9['body']['id']){delete _0x327ca9[_0x29ab('0x59')]['id'];}return db[_0x29ab('0x3b')][_0x29ab('0x56')]({'where':{'id':_0x327ca9[_0x29ab('0x54')]['id']}})['then'](handleEntityNotFound(_0x4fdf15,null))[_0x29ab('0x1f')](saveUpdates(_0x327ca9['body'],null))['then'](respondWithResult(_0x4fdf15,null))[_0x29ab('0x28')](handleError(_0x4fdf15,null));};exports['destroy']=function(_0x2dec08,_0x5ed512){return db['SmsMessage'][_0x29ab('0x56')]({'where':{'id':_0x2dec08[_0x29ab('0x54')]['id']}})[_0x29ab('0x1f')](handleEntityNotFound(_0x5ed512,null))[_0x29ab('0x1f')](removeEntity(_0x5ed512,null))[_0x29ab('0x28')](handleError(_0x5ed512,null));};exports[_0x29ab('0x5a')]=function(_0x16c3f5,_0x4d4693){return db[_0x29ab('0x3b')]['describe']()[_0x29ab('0x1f')](respondWithResult(_0x4d4693,null))[_0x29ab('0x28')](handleError(_0x4d4693,null));};var interaction_log=require(_0x29ab('0x10'))('sms-interactions');exports[_0x29ab('0x5b')]=function(_0x2980fb,_0x5ec97a,_0x44f3d1){var _0x1bd47b={'agent':{},'channel':_0x29ab('0x5c')};if(_0x2980fb[_0x29ab('0x59')]['id']){delete _0x2980fb[_0x29ab('0x59')]['id'];}_0x2980fb[_0x29ab('0x59')][_0x29ab('0x5d')]=!![];_0x2980fb[_0x29ab('0x59')][_0x29ab('0x5e')]=moment()[_0x29ab('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2980fb[_0x29ab('0x59')]['UserId']=_0x2980fb[_0x29ab('0x59')][_0x29ab('0x60')]||_0x2980fb[_0x29ab('0x61')]['id'];_0x1bd47b['agent']['id']=_0x2980fb[_0x29ab('0x59')]['UserId'];return db[_0x29ab('0x3b')][_0x29ab('0x56')]({'where':{'id':_0x2980fb[_0x29ab('0x54')]['id'],'UserId':null}})[_0x29ab('0x1f')](handleEntityNotFound(_0x5ec97a,null))['then'](saveUpdates(_0x2980fb[_0x29ab('0x59')],null))[_0x29ab('0x1f')](function(_0x3c0fb0){if(_0x3c0fb0){_0x1bd47b[_0x29ab('0x26')]=_0x3c0fb0[_0x29ab('0x62')]({'plain':!![]});return db[_0x29ab('0x63')][_0x29ab('0x56')]({'where':{'id':_0x3c0fb0['SmsInteractionId']}});}return null;})[_0x29ab('0x1f')](handleEntityNotFound(_0x5ec97a,null))['then'](function(_0x512484){if(_0x512484){return _0x512484[_0x29ab('0x58')]({'UserId':_0x2980fb[_0x29ab('0x59')][_0x29ab('0x60')],'read1stAt':_['isNil'](_0x512484['read1stAt'])?moment()[_0x29ab('0x5f')](_0x29ab('0x64')):undefined});}return null;})[_0x29ab('0x1f')](function(_0x3d1410){if(_0x3d1410){_0x1bd47b[_0x29ab('0x65')]=_0x3d1410['get']({'plain':!![]});interaction_log[_0x29ab('0x20')](_0x29ab('0x66'),_0x2980fb[_0x29ab('0x61')]['id'],_0x2980fb['user'][_0x29ab('0x37')],_0x2980fb['user'][_0x29ab('0x67')],_0x1bd47b[_0x29ab('0x65')]['id'],_0x2980fb[_0x29ab('0x59')]?JSON['stringify'](_0x2980fb[_0x29ab('0x59')]):'null');return respondWithRpcPromise(_0x29ab('0x68'),_0x29ab('0x69'),_0x1bd47b);}return null;})[_0x29ab('0x1f')](function(_0x38bb06){var _0x456b5a=_0x29ab('0x6a')+_0x38bb06[_0x29ab('0x26')][_0x29ab('0x6b')];return db[_0x29ab('0x6c')][_0x29ab('0x40')](_0x456b5a,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x29ab('0x1f')](function(_0x5becc3){return _0x5becc3;});})[_0x29ab('0x1f')](function(_0x1f8ae2){if(_0x1f8ae2){_0x1bd47b[_0x29ab('0x26')]['contact']=_0x1f8ae2[0x0];if(!_0x2980fb[_0x29ab('0x59')][_0x29ab('0x60')])return;return db['User'][_0x29ab('0x56')]({'where':{'id':_0x2980fb[_0x29ab('0x59')]['UserId'],'role':_0x29ab('0x6d')},'attributes':['id',_0x29ab('0x37'),_0x29ab('0x6e'),_0x29ab('0x6f'),_0x29ab('0x70')],'raw':!![]});}return null;})['then'](function(_0x1be464){if(!_0x1be464)return null;_0x1bd47b['message'][_0x29ab('0x6d')]=_0x1be464;return _0x1bd47b;})[_0x29ab('0x1f')](function(_0xa6bd88){if(_0xa6bd88){if(_0x2980fb[_0x29ab('0x59')][_0x29ab('0x71')]){_0x1bd47b[_0x29ab('0x26')][_0x29ab('0x72')]=util[_0x29ab('0x5f')](_0x29ab('0x73'),_0x2980fb[_0x29ab('0x61')][_0x29ab('0x37')]);_0x1bd47b[_0x29ab('0x26')]['channel']=_0x1bd47b[_0x29ab('0x74')];_0x1bd47b['message'][_0x29ab('0x75')]=_0x1bd47b['channel'];_0x1bd47b[_0x29ab('0x26')][_0x29ab('0x76')]=_0x29ab('0x5b');return respondWithRpcPromise('EventManager',_0x29ab('0x77'),{'event':'acceptmessage','message':_0x1bd47b['message']},client9002)[_0x29ab('0x1f')](function(){return _0x1bd47b;});}return _0x1bd47b;}return null;})['then'](respondWithResult(_0x5ec97a,null))[_0x29ab('0x28')](handleError(_0x5ec97a,null));};var interaction_log=require(_0x29ab('0x10'))('sms-interactions');exports[_0x29ab('0x32')]=function(_0xb0c641,_0x4ac713,_0x3fc610){var _0x50ef29={'agent':{},'channel':_0x29ab('0x5c')};if(_0xb0c641[_0x29ab('0x59')]['id']){delete _0xb0c641[_0x29ab('0x59')]['id'];}_0xb0c641[_0x29ab('0x59')][_0x29ab('0x60')]=_0xb0c641[_0x29ab('0x59')][_0x29ab('0x60')]||_0xb0c641[_0x29ab('0x61')]['id'];_0x50ef29[_0x29ab('0x6d')]['id']=_0xb0c641['body']['UserId'];return db[_0x29ab('0x3b')]['find']({'where':{'id':_0xb0c641[_0x29ab('0x54')]['id'],'UserId':null}})[_0x29ab('0x1f')](handleEntityNotFound(_0x4ac713,null))[_0x29ab('0x1f')](function(_0x521bb7){if(_0x521bb7){_0x50ef29['message']=_0x521bb7[_0x29ab('0x62')]({'plain':!![]});return db[_0x29ab('0x63')][_0x29ab('0x56')]({'where':{'id':_0x521bb7[_0x29ab('0x78')]}});}return null;})[_0x29ab('0x1f')](handleEntityNotFound(_0x4ac713,null))[_0x29ab('0x1f')](function(_0x205330){if(_0x205330){_0x50ef29[_0x29ab('0x65')]=_0x205330['get']({'plain':!![]});interaction_log[_0x29ab('0x20')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xb0c641['user']['id'],_0xb0c641[_0x29ab('0x61')][_0x29ab('0x37')],_0xb0c641[_0x29ab('0x61')]['role'],_0x50ef29[_0x29ab('0x65')]['id'],_0xb0c641[_0x29ab('0x59')]?JSON[_0x29ab('0x79')](_0xb0c641[_0x29ab('0x59')]):_0x29ab('0x7a'));return respondWithRpcPromise(_0x29ab('0x7b'),_0x29ab('0x7c'),_0x50ef29);}return null;})[_0x29ab('0x1f')](function(_0x928fce){var _0x26e056=_0x29ab('0x6a')+_0x928fce[_0x29ab('0x26')][_0x29ab('0x6b')];return db[_0x29ab('0x6c')][_0x29ab('0x40')](_0x26e056,{'type':db['Sequelize'][_0x29ab('0x7d')][_0x29ab('0x7e')],'raw':!![]})[_0x29ab('0x1f')](function(_0x3765b7){return _0x3765b7;});})['then'](function(_0x3580c6){if(_0x3580c6){_0x50ef29['message'][_0x29ab('0x7f')]=_0x3580c6[0x0];if(!_0xb0c641[_0x29ab('0x59')][_0x29ab('0x60')])return;return db['User'][_0x29ab('0x56')]({'where':{'id':_0xb0c641[_0x29ab('0x59')][_0x29ab('0x60')],'role':'agent'},'attributes':['id','name',_0x29ab('0x6e'),_0x29ab('0x6f'),_0x29ab('0x70')],'raw':!![]});}return null;})[_0x29ab('0x1f')](function(_0x424534){if(!_0x424534)return null;_0x50ef29[_0x29ab('0x26')]['agent']=_0x424534;return _0x50ef29;})['then'](function(_0xb3ddd){if(_0xb3ddd){_0xb3ddd[_0x29ab('0x26')][_0x29ab('0x72')]=util[_0x29ab('0x5f')](_0x29ab('0x73'),_0xb0c641[_0x29ab('0x61')][_0x29ab('0x37')]);_0xb3ddd['message']['channel']=_0x50ef29[_0x29ab('0x74')];_0xb3ddd['message'][_0x29ab('0x75')]=_0x50ef29[_0x29ab('0x74')];_0xb3ddd[_0x29ab('0x26')]['event']=_0x29ab('0x32');respondWithRpcPromise(_0x29ab('0x77'),_0x29ab('0x77'),{'event':_0x29ab('0x80'),'message':_0xb3ddd['message']},client9002);return _0x50ef29;}return null;})[_0x29ab('0x1f')](respondWithResult(_0x4ac713,null))[_0x29ab('0x28')](handleError(_0x4ac713,null));};exports[_0x29ab('0x2a')]=function(_0x1a0eb3,_0x4384c8,_0x48ca86){if(_0x1a0eb3[_0x29ab('0x59')]['id']){delete _0x1a0eb3[_0x29ab('0x59')]['id'];}var _0xdbc09f;return db[_0x29ab('0x3b')][_0x29ab('0x56')]({'where':{'id':_0x1a0eb3[_0x29ab('0x54')]['id']}})[_0x29ab('0x1f')](handleEntityNotFound(_0x4384c8,null))[_0x29ab('0x1f')](function(_0x5f4980){if(_0x5f4980){_0xdbc09f=_0x5f4980;return db['SmsAccount'][_0x29ab('0x56')]({'where':{'id':_0x5f4980[_0x29ab('0x81')]}});}})[_0x29ab('0x1f')](handleEntityNotFound(_0x4384c8,null))['then'](function(_0x31d6b7){if(_0x31d6b7){logger['debug'](_0x29ab('0x24'),_0x29ab('0x2a'),'received\x20delivery\x20report\x20from',_0x31d6b7['type'],util[_0x29ab('0x82')](_0x1a0eb3[_0x29ab('0x59')],{'showHidden':![],'depth':null}));switch(_0x31d6b7['type']){case _0x29ab('0x83'):if(_0x1a0eb3[_0x29ab('0x59')][_0x29ab('0x84')]&&_0x1a0eb3['body'][_0x29ab('0x84')]===_0xdbc09f[_0x29ab('0x85')]){return _0xdbc09f[_0x29ab('0x58')]({'read':!![]});}else{logger[_0x29ab('0x25')](_0x29ab('0x86'),_0x29ab('0x2a'),_0x29ab('0x83'),util[_0x29ab('0x82')](_0x1a0eb3[_0x29ab('0x59')],{'showHidden':![],'depth':null}));}break;case _0x29ab('0x87'):if(_0x1a0eb3[_0x29ab('0x59')][_0x29ab('0x88')]&&_0x1a0eb3['body'][_0x29ab('0x88')]===_0xdbc09f['messageId']&&_['indexOf']([_0x29ab('0x89'),_0x29ab('0x8a')],_0x1a0eb3[_0x29ab('0x59')][_0x29ab('0x8b')])>=0x0){return _0xdbc09f[_0x29ab('0x58')]({'read':!![]});}else{logger[_0x29ab('0x25')](_0x29ab('0x86'),_0x29ab('0x2a'),'plivio',util['inspect'](_0x1a0eb3[_0x29ab('0x59')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x31677e=_0x1a0eb3[_0x29ab('0x59')]['results'][0x0];if(_0x31677e[_0x29ab('0x2a')][_0x29ab('0x8c')]===_0x29ab('0x8d')){return _0xdbc09f[_0x29ab('0x58')]({'read':!![]});}else{logger[_0x29ab('0x25')](_0x29ab('0x86'),'status',_0x29ab('0x8e'),util['inspect'](_0x1a0eb3[_0x29ab('0x59')],{'showHidden':![],'depth':null}));}break;}return _0xdbc09f;}})[_0x29ab('0x1f')](respondWithResult(_0x4384c8,null))['catch'](handleError(_0x4384c8,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 409c13c..0e473e0 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 _0x43fd=['SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3a0a99,_0x5e07f2){var _0x4b04e2=function(_0x2af4a8){while(--_0x2af4a8){_0x3a0a99['push'](_0x3a0a99['shift']());}};_0x4b04e2(++_0x5e07f2);}(_0x43fd,0x1cb));var _0xd43f=function(_0x19efad,_0xd19ac4){_0x19efad=_0x19efad-0x0;var _0x51fbc0=_0x43fd[_0x19efad];return _0x51fbc0;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xd43f('0x0'))['db'][_0xd43f('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd43f('0x2')](0x0);var events={'afterCreate':_0xd43f('0x3'),'afterUpdate':_0xd43f('0x4'),'afterDestroy':_0xd43f('0x5')};function emitEvent(_0x3024d3){return function(_0x408960,_0x300f6b,_0x1674fe){SmsMessageEvents[_0xd43f('0x6')](_0x3024d3+':'+_0x408960['id'],_0x408960);SmsMessageEvents[_0xd43f('0x6')](_0x3024d3,_0x408960);_0x1674fe(null);};}for(var e in events){if(events[_0xd43f('0x7')](e)){var event=events[e];SmsMessage[_0xd43f('0x8')](e,emitEvent(event));}}module[_0xd43f('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0xc72b=['hasOwnProperty','hook','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit'];(function(_0x599ffb,_0x480d1a){var _0x37728d=function(_0x36b114){while(--_0x36b114){_0x599ffb['push'](_0x599ffb['shift']());}};_0x37728d(++_0x480d1a);}(_0xc72b,0x110));var _0xbc72=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0xc72b[_0x59d0cc];return _0x2ae79f;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xbc72('0x0'))['db'][_0xbc72('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xbc72('0x2')](0x0);var events={'afterCreate':_0xbc72('0x3'),'afterUpdate':_0xbc72('0x4'),'afterDestroy':_0xbc72('0x5')};function emitEvent(_0x825e60){return function(_0xd68789,_0xbf97a2,_0x54c0cf){SmsMessageEvents[_0xbc72('0x6')](_0x825e60+':'+_0xd68789['id'],_0xd68789);SmsMessageEvents[_0xbc72('0x6')](_0x825e60,_0xd68789);_0x54c0cf(null);};}for(var e in events){if(events[_0xbc72('0x7')](e)){var event=events[e];SmsMessage[_0xbc72('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 31ba4c1..ad6a383 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 _0x4795=['login?username=','&password=','GET','sms','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','requestid','clicksend','username','%s:%s','format','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','/status?token=','application/json','IBSSO\x20','csc','crypto','apiKey','login','keys','sort','length','createHash','md5','digest','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','bandwidth','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','SmsMessage','sms_messages','messageId','body','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','update','createdAt','catch','error','SmsAccount','find','then','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender'];(function(_0x5f1357,_0x5a4c37){var _0x24a1d8=function(_0x2bf715){while(--_0x2bf715){_0x5f1357['push'](_0x5f1357['shift']());}};_0x24a1d8(++_0x5a4c37);}(_0x4795,0xbd));var _0x5479=function(_0x393d90,_0x2ac1f3){_0x393d90=_0x393d90-0x0;var _0x52c5e1=_0x4795[_0x393d90];return _0x52c5e1;};'use strict';var _=require('lodash');var util=require(_0x5479('0x0'));var logger=require(_0x5479('0x1'))(_0x5479('0x2'));var moment=require(_0x5479('0x3'));var BPromise=require(_0x5479('0x4'));var rp=require(_0x5479('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5479('0x6'));var config=require(_0x5479('0x7'));var attributes=require(_0x5479('0x8'));module['exports']=function(_0x3c112e,_0x2f4463){return _0x3c112e['define'](_0x5479('0x9'),attributes,{'tableName':_0x5479('0xa'),'paranoid':![],'indexes':[{'name':_0x5479('0xb'),'fields':[_0x5479('0xb')]},{'name':'fti_sms_messages','fields':[_0x5479('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4cec24,_0x370e82,_0x224eb1){var _0x368677=_0x3c112e['models'];var _0x779a72=_0x4cec24[_0x5479('0xd')]({'plain':!![]});if(_0x779a72[_0x5479('0xe')]['toLowerCase']()==='in'||_0x779a72[_0x5479('0xe')][_0x5479('0xf')]()===_0x5479('0x10')&&!_0x779a72[_0x5479('0x11')]&&!_[_0x5479('0x12')](_0x779a72[_0x5479('0x13')])&&!_[_0x5479('0x12')](_0x779a72[_0x5479('0x14')])){_0x368677[_0x5479('0x15')][_0x5479('0x16')]({'where':{'id':_0x779a72[_0x5479('0x14')]}})['then'](function(_0x2b723c){if(_0x2b723c){_0x2b723c[_0x5479('0x17')]({'lastMsgAt':_0x779a72[_0x5479('0x18')],'lastMsgDirection':_0x779a72['direction'][_0x5479('0xf')]()});}})[_0x5479('0x19')](function(_0x405bbd){console[_0x5479('0x1a')](_0x405bbd);});}if(_0x779a72[_0x5479('0xe')]==='out'&&!_0x779a72[_0x5479('0x11')]){var _0x8b0988;_0x368677[_0x5479('0x1b')][_0x5479('0x1c')]({'where':{'id':_0x779a72['SmsAccountId']},'raw':!![]})[_0x5479('0x1d')](function(_0x2206ff){_0x8b0988=_0x2206ff;if(_0x8b0988&&_0x8b0988[_0x5479('0x1e')]){switch(_0x8b0988['type']){case _0x5479('0x1f'):var _0x14c38f=require('twilio');if(_0x8b0988[_0x5479('0x20')]&&_0x8b0988[_0x5479('0x21')]&&_0x8b0988['phone']){var _0x10b5be=new _0x14c38f(_0x8b0988[_0x5479('0x20')],_0x8b0988[_0x5479('0x21')]);_0x10b5be[_0x5479('0x22')][_0x5479('0x23')]({'body':_0x779a72[_0x5479('0xc')],'to':_0x779a72[_0x5479('0x24')],'from':_0x8b0988[_0x5479('0x24')],'statusCallback':_0x8b0988[_0x5479('0x25')]+_0x5479('0x26')+_0x779a72['id']+'/status?token='+_0x8b0988[_0x5479('0x27')]})[_0x5479('0x1d')](function(_0x4bb24d){if(_0x4bb24d[_0x5479('0x28')]){return _0x4cec24['update']({'messageId':_0x4bb24d[_0x5479('0x28')]});}})[_0x5479('0x19')](function(_0x498b3a){logger['error'](_0x5479('0x29'),_0x5479('0x2a'),_0x5479('0x1f'),util['inspect'](_0x498b3a,{'showHidden':![],'depth':null}));});}else{logger[_0x5479('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5479('0x2a'),_0x5479('0x1f'),_0x5479('0x2b'));}break;case _0x5479('0x2c'):var _0x28ea1a=_0x5479('0x2d');if(_0x8b0988['username']&&_0x8b0988[_0x5479('0x2e')]){var _0x530a4b={'recipient':[_0x779a72['phone']],'message':_0x779a72[_0x5479('0xc')],'message_type':_0x8b0988[_0x5479('0x2f')]};if(_0x8b0988[_0x5479('0x2f')]&&_0x8b0988[_0x5479('0x2f')]!=='SI'){_0x530a4b[_0x5479('0x30')]=_0x8b0988[_0x5479('0x24')];}var _0x61819a={'url':_0x28ea1a+_0x5479('0x31')+_0x8b0988['username']+_0x5479('0x32')+_0x8b0988[_0x5479('0x2e')],'method':_0x5479('0x33')};rp(_0x61819a)[_0x5479('0x1d')](function(_0x15a72a){var _0x4e2339=_0x15a72a['split'](';');var _0x7e9b83={'user_key':_0x4e2339[0x0],'session_key':_0x4e2339[0x1]};_0x61819a={'url':_0x28ea1a+_0x5479('0x34'),'method':'POST','headers':{'user_key':_0x7e9b83['user_key'],'Session_key':_0x7e9b83['session_key']},'json':!![],'body':_0x530a4b};return rp(_0x61819a);})[_0x5479('0x1d')](function(_0x22a404){if(_0x22a404[_0x5479('0x35')]>=0x1){var _0x5ace72={'messageId':_0x22a404[_0x5479('0x36')]};if(_0x8b0988['smsMethod']!=='GP'||!_0x8b0988[_0x5479('0x37')]){_0x5ace72[_0x5479('0x38')]=!![];}return _0x4cec24['update'](_0x5ace72);}else{return logger[_0x5479('0x1a')](_0x5479('0x29'),_0x5479('0x2a'),'skebby',util[_0x5479('0x39')](_0x22a404,{'showHidden':![],'depth':null}));}})[_0x5479('0x19')](function(_0x5aa456){return logger[_0x5479('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5479('0x2a'),_0x5479('0x2c'),util[_0x5479('0x39')](_0x5aa456,{'showHidden':![],'depth':null}));});}else{logger[_0x5479('0x1a')](_0x5479('0x29'),_0x5479('0x2a'),_0x5479('0x2c'),_0x5479('0x3a'));}break;case _0x5479('0x3b'):if(_0x8b0988['authToken']){var _0x179534={'recipient':_0x779a72[_0x5479('0x24')],'message':_0x779a72[_0x5479('0xc')],'sender':_0x8b0988[_0x5479('0x3c')]||_0x8b0988[_0x5479('0x24')],'authorization':_0x8b0988[_0x5479('0x21')]};var _0x370e82={'method':_0x5479('0x3d'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x179534,'json':!![]};rp(_0x370e82)[_0x5479('0x1d')](function(_0x283bd1){var _0x5d4b10={'messageId':_0x283bd1[_0x5479('0x3e')]};if(!_0x8b0988[_0x5479('0x37')]){_0x5d4b10['read']=!![];}return _0x4cec24[_0x5479('0x17')](_0x5d4b10);})[_0x5479('0x19')](function(_0x4add2e){logger['error'](_0x5479('0x29'),_0x5479('0x2a'),'connectel',util['inspect'](_0x4add2e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5479('0x29'),_0x5479('0x2a'),_0x5479('0x3b'),'Missing\x20parameters:\x20authToken');}break;case _0x5479('0x3f'):if(_0x8b0988[_0x5479('0x40')]&&_0x8b0988['password']){var _0x179534={'messages':[{'source':'xCALLY\x20Motion','to':_0x779a72[_0x5479('0x24')],'body':_0x779a72[_0x5479('0xc')],'from':_0x8b0988['senderString']||_0x8b0988[_0x5479('0x24')]}]};var _0x1724e1=util['format'](_0x5479('0x41'),_0x8b0988[_0x5479('0x40')],_0x8b0988[_0x5479('0x2e')]);var _0x370e82={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x179534,'headers':{'Authorization':util[_0x5479('0x42')](_0x5479('0x43'),new Buffer(_0x1724e1)[_0x5479('0x44')](_0x5479('0x45')))},'json':!![]};rp(_0x370e82)[_0x5479('0x1d')](function(_0x3afdeb){if(_0x3afdeb[_0x5479('0x46')]>=0xc8&&_0x3afdeb[_0x5479('0x46')]<=0xce){if(_0x3afdeb['data']&&_0x3afdeb[_0x5479('0x47')][_0x5479('0x48')]>0x0){var _0x50586e=_[_0x5479('0x49')](_0x3afdeb[_0x5479('0x47')][_0x5479('0x22')]);var _0x2e06df={'messageId':_0x50586e[_0x5479('0x4a')]};if(!_0x8b0988[_0x5479('0x37')]){_0x2e06df[_0x5479('0x38')]=!![];}return _0x4cec24[_0x5479('0x17')](_0x2e06df);}else{logger[_0x5479('0x1a')](_0x5479('0x29'),'afterCreate',_0x5479('0x4b'),util[_0x5479('0x39')](_0x3afdeb,{'showHidden':![],'depth':null}));}}else{logger[_0x5479('0x1a')](_0x5479('0x29'),_0x5479('0x2a'),'clickSend',util[_0x5479('0x39')](_0x3afdeb,{'showHidden':![],'depth':null}));}})['catch'](function(_0x291b57){logger['error'](_0x5479('0x29'),_0x5479('0x2a'),_0x5479('0x4b'),util[_0x5479('0x39')](_0x291b57,{'showHidden':![],'depth':null}));});}else{logger[_0x5479('0x1a')](_0x5479('0x29'),_0x5479('0x2a'),'clickSend',_0x5479('0x3a'));}break;case _0x5479('0x4c'):if(_0x8b0988['authId']&&_0x8b0988[_0x5479('0x21')]){var _0x179534={'dst':_0x779a72['phone'],'text':_0x779a72['body'],'src':_0x8b0988[_0x5479('0x3c')]||_0x8b0988[_0x5479('0x24')],'url':_0x8b0988['remote']+_0x5479('0x26')+_0x779a72['id']+'/status?token='+_0x8b0988[_0x5479('0x27')]};var _0x1724e1=util[_0x5479('0x42')](_0x5479('0x41'),_0x8b0988[_0x5479('0x4d')],_0x8b0988['authToken']);var _0x370e82={'method':'POST','uri':util[_0x5479('0x42')]('https://api.plivo.com/v1/Account/%s/Message/',_0x8b0988[_0x5479('0x4d')]),'body':_0x179534,'headers':{'Authorization':util[_0x5479('0x42')](_0x5479('0x43'),new Buffer(_0x1724e1)[_0x5479('0x44')](_0x5479('0x45')))},'json':!![]};rp(_0x370e82)[_0x5479('0x1d')](function(_0x357ce6){var _0x5971fa={'messageId':_0x357ce6['message_uuid'][0x0]};return _0x4cec24[_0x5479('0x17')](_0x5971fa);})['catch'](function(_0x154695){logger[_0x5479('0x1a')](_0x5479('0x29'),'afterCreate','plivo',util['inspect'](_0x154695,{'showHidden':![],'depth':null}));});}else{logger[_0x5479('0x1a')](_0x5479('0x29'),_0x5479('0x2a'),'plivo',_0x5479('0x4e'));}break;case _0x5479('0x4f'):if(_0x8b0988['username']&&_0x8b0988[_0x5479('0x2e')]){if(_0x8b0988[_0x5479('0x50')]){var _0xdd6674={'method':_0x5479('0x3d'),'uri':_0x8b0988['baseUrl']+_0x5479('0x51'),'body':{'username':_0x8b0988[_0x5479('0x40')],'password':_0x8b0988[_0x5479('0x2e')]},'json':!![]};return rp(_0xdd6674)[_0x5479('0x1d')](function(_0x31c714){var _0x34bb65={'method':_0x5479('0x3d'),'uri':_0x8b0988[_0x5479('0x50')]+_0x5479('0x52'),'body':{'messages':[{'from':_0x8b0988['phone'],'destinations':[{'to':_0x779a72['phone']}],'text':_0x779a72[_0x5479('0xc')],'notifyUrl':_0x8b0988[_0x5479('0x25')]+_0x5479('0x26')+_0x779a72['id']+_0x5479('0x53')+_0x8b0988[_0x5479('0x27')],'notifyContentType':_0x5479('0x54'),'callbackData':_0x8b0988[_0x5479('0x24')]+';'+_0x779a72[_0x5479('0xc')]}]},'headers':{'Authorization':_0x5479('0x55')+_0x31c714[_0x5479('0x27')]},'json':!![]};return rp(_0x34bb65)[_0x5479('0x1d')](function(_0x552ad9){if(_0x552ad9['messages']){var _0x56827c={'messageId':_0x552ad9[_0x5479('0x22')][0x0]['messageId']};if(!_0x8b0988[_0x5479('0x37')]){_0x56827c['read']=!![];}return _0x4cec24[_0x5479('0x17')](_0x56827c);}else{return logger[_0x5479('0x1a')](_0x5479('0x29'),_0x5479('0x2a'),_0x5479('0x4f'),util['inspect'](_0x552ad9,{'showHidden':![],'depth':null}));}});})[_0x5479('0x19')](function(_0x48b0b7){return logger[_0x5479('0x1a')](_0x5479('0x29'),_0x5479('0x2a'),_0x5479('0x4f'),util[_0x5479('0x39')](_0x48b0b7,{'showHidden':![],'depth':null}));});}else{logger[_0x5479('0x1a')](_0x5479('0x29'),_0x5479('0x2a'),_0x5479('0x4f'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x5479('0x1a')](_0x5479('0x29'),_0x5479('0x2a'),_0x5479('0x4f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x5479('0x56'):var _0xaf4b3e=require(_0x5479('0x57'));if(_0x8b0988[_0x5479('0x58')]){var _0x21c7b4={};_0x21c7b4[_0x5479('0x59')]=_0x8b0988[_0x5479('0x40')];_0x21c7b4[_0x5479('0x24')]=_0x779a72[_0x5479('0x24')];_0x21c7b4[_0x5479('0x30')]=_0x8b0988[_0x5479('0x24')];_0x21c7b4['text']=_0x779a72['body'];_0x21c7b4['timestamp']=+new Date();var _0x1a68fb='';var _0x3734f8='';var _0x18b26c=Object[_0x5479('0x5a')](_0x21c7b4);_0x18b26c[_0x5479('0x5b')]();for(var _0x39d9f2=0x0;_0x39d9f2<_0x18b26c[_0x5479('0x5c')];_0x39d9f2++){if(_0x1a68fb!=''){_0x1a68fb+='&';}_0x1a68fb+=_0x18b26c[_0x39d9f2]+'='+encodeURIComponent(_0x21c7b4[_0x18b26c[_0x39d9f2]]);_0x3734f8+=_0x21c7b4[_0x18b26c[_0x39d9f2]];}_0x3734f8+=_0x8b0988[_0x5479('0x58')];_0x3734f8=_0xaf4b3e[_0x5479('0x5d')](_0x5479('0x5e'))[_0x5479('0x17')](_0x3734f8)[_0x5479('0x5f')](_0x5479('0x60'));if(_0x1a68fb!==''){_0x1a68fb+='&';}_0x1a68fb+='signature='+_0x3734f8;var _0x61819a={'method':_0x5479('0x33'),'uri':_0x8b0988[_0x5479('0x50')]+_0x5479('0x61')+_0x1a68fb,'json':!![]};return rp(_0x61819a)[_0x5479('0x1d')](function(_0x2c39f8){var _0x39a17f=Object[_0x5479('0x5a')](_0x2c39f8);if(_0x2c39f8[_0x39a17f[0x0]]['error']&&parseInt(_0x2c39f8[_0x39a17f[0x0]][_0x5479('0x1a')])===0x0){var _0x54ce26={'messageId':_0x2c39f8[_0x39a17f[0x0]][_0x5479('0x62')]};if(!_0x8b0988[_0x5479('0x37')]){_0x54ce26['read']=!![];}return _0x4cec24[_0x5479('0x17')](_0x54ce26);}else{return logger[_0x5479('0x1a')](_0x5479('0x29'),_0x5479('0x2a'),'csc',util[_0x5479('0x39')](_0x2c39f8['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x250929){return logger[_0x5479('0x1a')](_0x5479('0x29'),'afterCreate',_0x5479('0x56'),util[_0x5479('0x39')](_0x250929,{'showHidden':![],'depth':null}));});}else{logger[_0x5479('0x1a')](_0x5479('0x29'),_0x5479('0x2a'),_0x5479('0x56'),_0x5479('0x63'));}break;case _0x5479('0x64'):if(_0x8b0988[_0x5479('0x58')]){var _0x2eed94={'method':'POST','uri':_0x5479('0x65'),'headers':{'Authorization':_0x8b0988[_0x5479('0x58')]},'body':{'content':_0x779a72[_0x5479('0xc')],'to':[_0x779a72['phone']],'from':_0x8b0988[_0x5479('0x24')],'binary':![],'clientMessageId':_0x5479('0x66'),'charset':_0x5479('0x67')},'json':!![]};rp(_0x2eed94)[_0x5479('0x1d')](function(_0x1b8c43){if(!_0x1b8c43[_0x5479('0x1a')]){var _0x83d010={'messageId':_0x1b8c43[_0x5479('0x22')][0x0][_0x5479('0x68')]};if(!_0x8b0988[_0x5479('0x37')]){_0x83d010[_0x5479('0x38')]=!![];}return _0x4cec24[_0x5479('0x17')](_0x83d010);}else{return logger[_0x5479('0x1a')](_0x5479('0x29'),'afterCreate',_0x5479('0x64'),util['inspect'](_0x1b8c43[_0x5479('0x1a')],{'showHidden':![],'depth':null}));}})[_0x5479('0x19')](function(_0x4219f8){return logger[_0x5479('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5479('0x2a'),'clickatell',util[_0x5479('0x39')](_0x4219f8,{'showHidden':![],'depth':null}));});}else{logger[_0x5479('0x1a')](_0x5479('0x29'),_0x5479('0x2a'),_0x5479('0x64'),_0x5479('0x63'));}break;case'bandwidth':if(_0x8b0988[_0x5479('0x40')]&&_0x8b0988[_0x5479('0x2e')]){var _0x1724e1=util['format'](_0x5479('0x41'),_0x8b0988['username'],_0x8b0988['password']);var _0x370e82={'method':_0x5479('0x3d'),'uri':_0x5479('0x69')+_0x8b0988[_0x5479('0x6a')]+_0x5479('0x6b'),'body':{'to':[_0x779a72[_0x5479('0x24')]],'text':_0x779a72['body'],'from':_0x8b0988[_0x5479('0x24')],'applicationId':_0x8b0988['applicationId']},'headers':{'Authorization':util[_0x5479('0x42')]('Basic\x20%s',new Buffer(_0x1724e1)['toString']('base64'))},'json':!![]};rp(_0x370e82)[_0x5479('0x1d')](function(_0x7fcd6a){if(_0x7fcd6a['id']){var _0x2d30b0={'messageId':_0x7fcd6a['id']};return _0x4cec24[_0x5479('0x17')](_0x2d30b0);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5479('0x2a'),'bandwidth',util[_0x5479('0x39')](_0x7fcd6a,{'showHidden':![],'depth':null}));}})[_0x5479('0x19')](function(_0x39fe9f){logger[_0x5479('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5479('0x2a'),_0x5479('0x6c'),util[_0x5479('0x39')](_0x39fe9f,{'showHidden':![],'depth':null}));});}else{logger[_0x5479('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5479('0x2a'),'bandwidth',_0x5479('0x3a'));}break;case'intelepeer':if(_0x8b0988['apiKey']){var _0x23987b={};var _0x61819a={'method':_0x5479('0x3d'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x5479('0x6d')+_0x8b0988['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x8b0988[_0x5479('0x24')],'to':_0x779a72[_0x5479('0x24')],'text':_0x779a72[_0x5479('0xc')]},'json':!![]};return rp(_0x61819a)['then'](function(_0x54cf87){if(_0x54cf87[_0x5479('0x6e')]==0xca){_0x23987b[_0x5479('0x6f')]=_0x54cf87;var _0x30d488={'method':'POST','uri':_0x5479('0x70'),'headers':{'Authorization':_0x5479('0x6d')+_0x8b0988[_0x5479('0x58')],'Content-Type':'application/json'},'body':{'refid':_0x23987b[_0x5479('0x6f')][_0x5479('0x71')]},'json':!![]};return rp(_0x30d488)[_0x5479('0x1d')](function(_0x4a5a2a){_0x23987b[_0x5479('0x72')]=_0x4a5a2a;var _0x21821e={'messageId':_0x23987b[_0x5479('0x6f')][_0x5479('0x71')],'read':!![]};return _0x4cec24[_0x5479('0x17')](_0x21821e);});}else{return logger[_0x5479('0x1a')](_0x5479('0x29'),_0x5479('0x2a'),_0x5479('0x73'),util[_0x5479('0x39')](_0x54cf87,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4c7f6b){return logger[_0x5479('0x1a')](_0x5479('0x29'),_0x5479('0x2a'),_0x5479('0x73'),util[_0x5479('0x39')](_0x4c7f6b,{'showHidden':![],'depth':null}));});}else{return logger[_0x5479('0x1a')](_0x5479('0x29'),_0x5479('0x2a'),_0x5479('0x73'),_0x5479('0x74'));}break;}}})[_0x5479('0x75')](function(){_0x224eb1();});}else{_0x224eb1();}}},'charset':'utf8mb4','collate':_0x5479('0x76')});}; \ No newline at end of file +var _0xbe97=['authToken','phone','messages','create','remote','/api/sms/messages/','sid','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','split','sms','POST','user_key','total_sent','deliveryReport','read','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','clicksend','password','xCALLY\x20Motion','senderString','format','Basic\x20%s','toString','base64','http_code','data','queued_count','head','clickSend','plivo','authId','/status?token=','token','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','timestamp','keys','sort','createHash','md5','digest','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','uuid','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','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','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./smsMessage.attributes','exports','define','sms_messages','messageId','body','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','findOne','then','update','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid'];(function(_0x5494ea,_0x2d04b1){var _0x1f7288=function(_0x3a2699){while(--_0x3a2699){_0x5494ea['push'](_0x5494ea['shift']());}};_0x1f7288(++_0x2d04b1);}(_0xbe97,0xcc));var _0x7be9=function(_0xeb5ff3,_0x472ad6){_0xeb5ff3=_0xeb5ff3-0x0;var _0x3c3441=_0xbe97[_0xeb5ff3];return _0x3c3441;};'use strict';var _=require(_0x7be9('0x0'));var util=require('util');var logger=require(_0x7be9('0x1'))(_0x7be9('0x2'));var moment=require(_0x7be9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7be9('0x4'));var fs=require('fs');var path=require(_0x7be9('0x5'));var rimraf=require(_0x7be9('0x6'));var config=require('../../config/environment');var attributes=require(_0x7be9('0x7'));module[_0x7be9('0x8')]=function(_0xc41a37,_0x6d5062){return _0xc41a37[_0x7be9('0x9')]('SmsMessage',attributes,{'tableName':_0x7be9('0xa'),'paranoid':![],'indexes':[{'name':_0x7be9('0xb'),'fields':[_0x7be9('0xb')]},{'name':'fti_sms_messages','fields':[_0x7be9('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b528e,_0x257898,_0x3ee82f){var _0x64faf2=_0xc41a37[_0x7be9('0xd')];var _0x422234=_0x2b528e[_0x7be9('0xe')]({'plain':!![]});if(_0x422234[_0x7be9('0xf')][_0x7be9('0x10')]()==='in'||_0x422234[_0x7be9('0xf')][_0x7be9('0x10')]()===_0x7be9('0x11')&&!_0x422234['secret']&&!_[_0x7be9('0x12')](_0x422234[_0x7be9('0x13')])&&!_[_0x7be9('0x12')](_0x422234[_0x7be9('0x14')])){_0x64faf2['SmsInteraction'][_0x7be9('0x15')]({'where':{'id':_0x422234[_0x7be9('0x14')]}})[_0x7be9('0x16')](function(_0x4ad07a){if(_0x4ad07a){_0x4ad07a[_0x7be9('0x17')]({'lastMsgAt':_0x422234[_0x7be9('0x18')],'lastMsgDirection':_0x422234[_0x7be9('0xf')][_0x7be9('0x10')]()});}})[_0x7be9('0x19')](function(_0x2b7291){console[_0x7be9('0x1a')](_0x2b7291);});}if(_0x422234[_0x7be9('0xf')]===_0x7be9('0x11')&&!_0x422234[_0x7be9('0x1b')]){var _0x42f26f;_0x64faf2[_0x7be9('0x1c')][_0x7be9('0x1d')]({'where':{'id':_0x422234[_0x7be9('0x1e')]},'raw':!![]})[_0x7be9('0x16')](function(_0x4828f2){_0x42f26f=_0x4828f2;if(_0x42f26f&&_0x42f26f['type']){switch(_0x42f26f[_0x7be9('0x1f')]){case _0x7be9('0x20'):var _0x163d15=require(_0x7be9('0x20'));if(_0x42f26f[_0x7be9('0x21')]&&_0x42f26f[_0x7be9('0x22')]&&_0x42f26f[_0x7be9('0x23')]){var _0x3154ec=new _0x163d15(_0x42f26f[_0x7be9('0x21')],_0x42f26f['authToken']);_0x3154ec[_0x7be9('0x24')][_0x7be9('0x25')]({'body':_0x422234[_0x7be9('0xc')],'to':_0x422234['phone'],'from':_0x42f26f[_0x7be9('0x23')],'statusCallback':_0x42f26f[_0x7be9('0x26')]+_0x7be9('0x27')+_0x422234['id']+'/status?token='+_0x42f26f['token']})[_0x7be9('0x16')](function(_0x3af71d){if(_0x3af71d[_0x7be9('0x28')]){return _0x2b528e[_0x7be9('0x17')]({'messageId':_0x3af71d[_0x7be9('0x28')]});}})[_0x7be9('0x19')](function(_0x286f48){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7be9('0x20'),util[_0x7be9('0x29')](_0x286f48,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7be9('0x2a'),'twilio',_0x7be9('0x2b'));}break;case _0x7be9('0x2c'):var _0x12cb37=_0x7be9('0x2d');if(_0x42f26f[_0x7be9('0x2e')]&&_0x42f26f['password']){var _0xdd7397={'recipient':[_0x422234[_0x7be9('0x23')]],'message':_0x422234['body'],'message_type':_0x42f26f[_0x7be9('0x2f')]};if(_0x42f26f['smsMethod']&&_0x42f26f['smsMethod']!=='SI'){_0xdd7397[_0x7be9('0x30')]=_0x42f26f['phone'];}var _0x5d7c66={'url':_0x12cb37+_0x7be9('0x31')+_0x42f26f[_0x7be9('0x2e')]+_0x7be9('0x32')+_0x42f26f['password'],'method':'GET'};rp(_0x5d7c66)[_0x7be9('0x16')](function(_0xd1e2ee){var _0x2ad623=_0xd1e2ee[_0x7be9('0x33')](';');var _0x2ce70f={'user_key':_0x2ad623[0x0],'session_key':_0x2ad623[0x1]};_0x5d7c66={'url':_0x12cb37+_0x7be9('0x34'),'method':_0x7be9('0x35'),'headers':{'user_key':_0x2ce70f[_0x7be9('0x36')],'Session_key':_0x2ce70f['session_key']},'json':!![],'body':_0xdd7397};return rp(_0x5d7c66);})[_0x7be9('0x16')](function(_0x5972e5){if(_0x5972e5[_0x7be9('0x37')]>=0x1){var _0x28562a={'messageId':_0x5972e5['internal_order_id']};if(_0x42f26f[_0x7be9('0x2f')]!=='GP'||!_0x42f26f[_0x7be9('0x38')]){_0x28562a[_0x7be9('0x39')]=!![];}return _0x2b528e['update'](_0x28562a);}else{return logger[_0x7be9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7be9('0x2a'),_0x7be9('0x2c'),util[_0x7be9('0x29')](_0x5972e5,{'showHidden':![],'depth':null}));}})[_0x7be9('0x19')](function(_0x27af75){return logger['error'](_0x7be9('0x3a'),_0x7be9('0x2a'),_0x7be9('0x2c'),util[_0x7be9('0x29')](_0x27af75,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7be9('0x3a'),_0x7be9('0x2a'),_0x7be9('0x2c'),_0x7be9('0x3b'));}break;case _0x7be9('0x3c'):if(_0x42f26f[_0x7be9('0x22')]){var _0x3f4e87={'recipient':_0x422234[_0x7be9('0x23')],'message':_0x422234[_0x7be9('0xc')],'sender':_0x42f26f['senderString']||_0x42f26f['phone'],'authorization':_0x42f26f[_0x7be9('0x22')]};var _0x257898={'method':_0x7be9('0x35'),'uri':_0x7be9('0x3d'),'body':_0x3f4e87,'json':!![]};rp(_0x257898)['then'](function(_0x3a4d1f){var _0x333607={'messageId':_0x3a4d1f['requestid']};if(!_0x42f26f[_0x7be9('0x38')]){_0x333607['read']=!![];}return _0x2b528e[_0x7be9('0x17')](_0x333607);})['catch'](function(_0x459349){logger[_0x7be9('0x1a')](_0x7be9('0x3a'),_0x7be9('0x2a'),_0x7be9('0x3c'),util[_0x7be9('0x29')](_0x459349,{'showHidden':![],'depth':null}));});}else{logger[_0x7be9('0x1a')](_0x7be9('0x3a'),_0x7be9('0x2a'),_0x7be9('0x3c'),'Missing\x20parameters:\x20authToken');}break;case _0x7be9('0x3e'):if(_0x42f26f[_0x7be9('0x2e')]&&_0x42f26f[_0x7be9('0x3f')]){var _0x3f4e87={'messages':[{'source':_0x7be9('0x40'),'to':_0x422234[_0x7be9('0x23')],'body':_0x422234[_0x7be9('0xc')],'from':_0x42f26f[_0x7be9('0x41')]||_0x42f26f[_0x7be9('0x23')]}]};var _0x33a0dc=util[_0x7be9('0x42')]('%s:%s',_0x42f26f[_0x7be9('0x2e')],_0x42f26f[_0x7be9('0x3f')]);var _0x257898={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x3f4e87,'headers':{'Authorization':util[_0x7be9('0x42')](_0x7be9('0x43'),new Buffer(_0x33a0dc)[_0x7be9('0x44')](_0x7be9('0x45')))},'json':!![]};rp(_0x257898)['then'](function(_0x1bb35b){if(_0x1bb35b[_0x7be9('0x46')]>=0xc8&&_0x1bb35b[_0x7be9('0x46')]<=0xce){if(_0x1bb35b[_0x7be9('0x47')]&&_0x1bb35b['data'][_0x7be9('0x48')]>0x0){var _0x1970da=_[_0x7be9('0x49')](_0x1bb35b['data']['messages']);var _0x589354={'messageId':_0x1970da['message_id']};if(!_0x42f26f[_0x7be9('0x38')]){_0x589354[_0x7be9('0x39')]=!![];}return _0x2b528e[_0x7be9('0x17')](_0x589354);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7be9('0x2a'),_0x7be9('0x4a'),util[_0x7be9('0x29')](_0x1bb35b,{'showHidden':![],'depth':null}));}}else{logger[_0x7be9('0x1a')](_0x7be9('0x3a'),_0x7be9('0x2a'),_0x7be9('0x4a'),util[_0x7be9('0x29')](_0x1bb35b,{'showHidden':![],'depth':null}));}})[_0x7be9('0x19')](function(_0x44a80a){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7be9('0x2a'),_0x7be9('0x4a'),util['inspect'](_0x44a80a,{'showHidden':![],'depth':null}));});}else{logger[_0x7be9('0x1a')](_0x7be9('0x3a'),_0x7be9('0x2a'),_0x7be9('0x4a'),_0x7be9('0x3b'));}break;case _0x7be9('0x4b'):if(_0x42f26f[_0x7be9('0x4c')]&&_0x42f26f['authToken']){var _0x3f4e87={'dst':_0x422234[_0x7be9('0x23')],'text':_0x422234[_0x7be9('0xc')],'src':_0x42f26f[_0x7be9('0x41')]||_0x42f26f[_0x7be9('0x23')],'url':_0x42f26f[_0x7be9('0x26')]+_0x7be9('0x27')+_0x422234['id']+_0x7be9('0x4d')+_0x42f26f[_0x7be9('0x4e')]};var _0x33a0dc=util[_0x7be9('0x42')](_0x7be9('0x4f'),_0x42f26f[_0x7be9('0x4c')],_0x42f26f[_0x7be9('0x22')]);var _0x257898={'method':_0x7be9('0x35'),'uri':util[_0x7be9('0x42')](_0x7be9('0x50'),_0x42f26f[_0x7be9('0x4c')]),'body':_0x3f4e87,'headers':{'Authorization':util[_0x7be9('0x42')](_0x7be9('0x43'),new Buffer(_0x33a0dc)[_0x7be9('0x44')]('base64'))},'json':!![]};rp(_0x257898)[_0x7be9('0x16')](function(_0x4786de){var _0x2ab6ac={'messageId':_0x4786de['message_uuid'][0x0]};return _0x2b528e['update'](_0x2ab6ac);})[_0x7be9('0x19')](function(_0x2fa627){logger[_0x7be9('0x1a')](_0x7be9('0x3a'),_0x7be9('0x2a'),'plivo',util['inspect'](_0x2fa627,{'showHidden':![],'depth':null}));});}else{logger[_0x7be9('0x1a')](_0x7be9('0x3a'),_0x7be9('0x2a'),_0x7be9('0x4b'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x7be9('0x51'):if(_0x42f26f[_0x7be9('0x2e')]&&_0x42f26f[_0x7be9('0x3f')]){if(_0x42f26f[_0x7be9('0x52')]){var _0x4a494={'method':_0x7be9('0x35'),'uri':_0x42f26f['baseUrl']+'/auth/1/session','body':{'username':_0x42f26f['username'],'password':_0x42f26f[_0x7be9('0x3f')]},'json':!![]};return rp(_0x4a494)[_0x7be9('0x16')](function(_0x4a40cf){var _0x56583d={'method':_0x7be9('0x35'),'uri':_0x42f26f[_0x7be9('0x52')]+_0x7be9('0x53'),'body':{'messages':[{'from':_0x42f26f[_0x7be9('0x23')],'destinations':[{'to':_0x422234[_0x7be9('0x23')]}],'text':_0x422234['body'],'notifyUrl':_0x42f26f[_0x7be9('0x26')]+_0x7be9('0x27')+_0x422234['id']+_0x7be9('0x4d')+_0x42f26f['token'],'notifyContentType':_0x7be9('0x54'),'callbackData':_0x42f26f[_0x7be9('0x23')]+';'+_0x422234['body']}]},'headers':{'Authorization':_0x7be9('0x55')+_0x4a40cf[_0x7be9('0x4e')]},'json':!![]};return rp(_0x56583d)[_0x7be9('0x16')](function(_0x13ad3d){if(_0x13ad3d[_0x7be9('0x24')]){var _0x23ef66={'messageId':_0x13ad3d['messages'][0x0][_0x7be9('0xb')]};if(!_0x42f26f[_0x7be9('0x38')]){_0x23ef66[_0x7be9('0x39')]=!![];}return _0x2b528e[_0x7be9('0x17')](_0x23ef66);}else{return logger['error'](_0x7be9('0x3a'),_0x7be9('0x2a'),_0x7be9('0x51'),util[_0x7be9('0x29')](_0x13ad3d,{'showHidden':![],'depth':null}));}});})[_0x7be9('0x19')](function(_0x1c2e64){return logger[_0x7be9('0x1a')](_0x7be9('0x3a'),'afterCreate',_0x7be9('0x51'),util['inspect'](_0x1c2e64,{'showHidden':![],'depth':null}));});}else{logger[_0x7be9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7be9('0x2a'),_0x7be9('0x51'),_0x7be9('0x56'));}}else{logger[_0x7be9('0x1a')](_0x7be9('0x3a'),_0x7be9('0x2a'),_0x7be9('0x51'),_0x7be9('0x3b'));}break;case _0x7be9('0x57'):var _0x39381e=require(_0x7be9('0x58'));if(_0x42f26f[_0x7be9('0x59')]){var _0x4a31ba={};_0x4a31ba['login']=_0x42f26f[_0x7be9('0x2e')];_0x4a31ba['phone']=_0x422234['phone'];_0x4a31ba[_0x7be9('0x30')]=_0x42f26f[_0x7be9('0x23')];_0x4a31ba[_0x7be9('0x5a')]=_0x422234['body'];_0x4a31ba[_0x7be9('0x5b')]=+new Date();var _0x1dd2e3='';var _0x363f18='';var _0x3eb367=Object[_0x7be9('0x5c')](_0x4a31ba);_0x3eb367[_0x7be9('0x5d')]();for(var _0x2f395e=0x0;_0x2f395e<_0x3eb367['length'];_0x2f395e++){if(_0x1dd2e3!=''){_0x1dd2e3+='&';}_0x1dd2e3+=_0x3eb367[_0x2f395e]+'='+encodeURIComponent(_0x4a31ba[_0x3eb367[_0x2f395e]]);_0x363f18+=_0x4a31ba[_0x3eb367[_0x2f395e]];}_0x363f18+=_0x42f26f[_0x7be9('0x59')];_0x363f18=_0x39381e[_0x7be9('0x5e')](_0x7be9('0x5f'))[_0x7be9('0x17')](_0x363f18)[_0x7be9('0x60')]('hex');if(_0x1dd2e3!==''){_0x1dd2e3+='&';}_0x1dd2e3+=_0x7be9('0x61')+_0x363f18;var _0x5d7c66={'method':'GET','uri':_0x42f26f[_0x7be9('0x52')]+_0x7be9('0x62')+_0x1dd2e3,'json':!![]};return rp(_0x5d7c66)[_0x7be9('0x16')](function(_0x45b491){var _0x2271ce=Object['keys'](_0x45b491);if(_0x45b491[_0x2271ce[0x0]][_0x7be9('0x1a')]&&parseInt(_0x45b491[_0x2271ce[0x0]]['error'])===0x0){var _0x6305e8={'messageId':_0x45b491[_0x2271ce[0x0]]['id_sms']};if(!_0x42f26f['deliveryReport']){_0x6305e8[_0x7be9('0x39')]=!![];}return _0x2b528e[_0x7be9('0x17')](_0x6305e8);}else{return logger[_0x7be9('0x1a')](_0x7be9('0x3a'),_0x7be9('0x2a'),_0x7be9('0x57'),util['inspect'](_0x45b491['error'],{'showHidden':![],'depth':null}));}})[_0x7be9('0x19')](function(_0x1c5243){return logger['error'](_0x7be9('0x3a'),_0x7be9('0x2a'),_0x7be9('0x57'),util[_0x7be9('0x29')](_0x1c5243,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','csc',_0x7be9('0x63'));}break;case'clickatell':if(_0x42f26f[_0x7be9('0x59')]){var _0x1a4ac4={'method':'POST','uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x42f26f[_0x7be9('0x59')]},'body':{'content':_0x422234[_0x7be9('0xc')],'to':[_0x422234[_0x7be9('0x23')]],'from':_0x42f26f[_0x7be9('0x23')],'binary':![],'clientMessageId':_0x7be9('0x64'),'charset':_0x7be9('0x65')},'json':!![]};rp(_0x1a4ac4)[_0x7be9('0x16')](function(_0x2a1cee){if(!_0x2a1cee[_0x7be9('0x1a')]){var _0x5ec671={'messageId':_0x2a1cee[_0x7be9('0x24')][0x0][_0x7be9('0x66')]};if(!_0x42f26f[_0x7be9('0x38')]){_0x5ec671[_0x7be9('0x39')]=!![];}return _0x2b528e[_0x7be9('0x17')](_0x5ec671);}else{return logger[_0x7be9('0x1a')](_0x7be9('0x3a'),'afterCreate',_0x7be9('0x67'),util['inspect'](_0x2a1cee[_0x7be9('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0xd918f3){return logger[_0x7be9('0x1a')](_0x7be9('0x3a'),'afterCreate',_0x7be9('0x67'),util[_0x7be9('0x29')](_0xd918f3,{'showHidden':![],'depth':null}));});}else{logger[_0x7be9('0x1a')](_0x7be9('0x3a'),'afterCreate',_0x7be9('0x67'),'Missing\x20parameters:\x20apiKey');}break;case _0x7be9('0x68'):if(_0x42f26f['username']&&_0x42f26f[_0x7be9('0x3f')]){var _0x33a0dc=util[_0x7be9('0x42')](_0x7be9('0x4f'),_0x42f26f[_0x7be9('0x2e')],_0x42f26f[_0x7be9('0x3f')]);var _0x257898={'method':_0x7be9('0x35'),'uri':_0x7be9('0x69')+_0x42f26f['accountId']+_0x7be9('0x6a'),'body':{'to':[_0x422234['phone']],'text':_0x422234[_0x7be9('0xc')],'from':_0x42f26f[_0x7be9('0x23')],'applicationId':_0x42f26f[_0x7be9('0x6b')]},'headers':{'Authorization':util[_0x7be9('0x42')](_0x7be9('0x43'),new Buffer(_0x33a0dc)[_0x7be9('0x44')](_0x7be9('0x45')))},'json':!![]};rp(_0x257898)['then'](function(_0x53f1d7){if(_0x53f1d7['id']){var _0x23be68={'messageId':_0x53f1d7['id']};return _0x2b528e[_0x7be9('0x17')](_0x23be68);}else{logger[_0x7be9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7be9('0x2a'),'bandwidth',util[_0x7be9('0x29')](_0x53f1d7,{'showHidden':![],'depth':null}));}})[_0x7be9('0x19')](function(_0x4a76e5){logger[_0x7be9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7be9('0x2a'),_0x7be9('0x68'),util[_0x7be9('0x29')](_0x4a76e5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7be9('0x3a'),_0x7be9('0x2a'),_0x7be9('0x68'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x7be9('0x6c'):if(_0x42f26f[_0x7be9('0x59')]){var _0x3ecfac={};var _0x5d7c66={'method':'POST','uri':_0x7be9('0x6d'),'headers':{'Authorization':_0x7be9('0x6e')+_0x42f26f[_0x7be9('0x59')],'Content-Type':'application/json'},'body':{'from':_0x42f26f[_0x7be9('0x23')],'to':_0x422234[_0x7be9('0x23')],'text':_0x422234[_0x7be9('0xc')]},'json':!![]};return rp(_0x5d7c66)[_0x7be9('0x16')](function(_0x69cfc3){if(_0x69cfc3[_0x7be9('0x6f')]==0xca){_0x3ecfac[_0x7be9('0x70')]=_0x69cfc3;var _0x208b18={'method':_0x7be9('0x35'),'uri':_0x7be9('0x71'),'headers':{'Authorization':'Bearer\x20'+_0x42f26f[_0x7be9('0x59')],'Content-Type':_0x7be9('0x54')},'body':{'refid':_0x3ecfac[_0x7be9('0x70')][_0x7be9('0x72')]},'json':!![]};return rp(_0x208b18)['then'](function(_0x449ce3){_0x3ecfac[_0x7be9('0x73')]=_0x449ce3;var _0x11bc13={'messageId':_0x3ecfac[_0x7be9('0x70')]['refid'],'read':!![]};return _0x2b528e[_0x7be9('0x17')](_0x11bc13);});}else{return logger[_0x7be9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7be9('0x2a'),_0x7be9('0x6c'),util[_0x7be9('0x29')](_0x69cfc3,{'showHidden':![],'depth':null}));}})[_0x7be9('0x19')](function(_0x1e87b4){return logger[_0x7be9('0x1a')](_0x7be9('0x3a'),_0x7be9('0x2a'),_0x7be9('0x6c'),util[_0x7be9('0x29')](_0x1e87b4,{'showHidden':![],'depth':null}));});}else{return logger[_0x7be9('0x1a')](_0x7be9('0x3a'),_0x7be9('0x2a'),_0x7be9('0x6c'),'Token\x20not\x20received');}break;}}})[_0x7be9('0x74')](function(){_0x3ee82f();});}else{_0x3ee82f();}}},'charset':_0x7be9('0x75'),'collate':_0x7be9('0x76')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 18fb8a4..b0260eb 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 _0x0f50=['redis','defaults','localhost','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','SmsMessage','create','options','raw','CreateSmsMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1e90b9,_0x21a91c){var _0x4cd6c3=function(_0x147489){while(--_0x147489){_0x1e90b9['push'](_0x1e90b9['shift']());}};_0x4cd6c3(++_0x21a91c);}(_0x0f50,0x90));var _0x00f5=function(_0x1baa02,_0x599e96){_0x1baa02=_0x1baa02-0x0;var _0x535fb3=_0x0f50[_0x1baa02];return _0x535fb3;};'use strict';var _=require(_0x00f5('0x0'));var util=require('util');var moment=require(_0x00f5('0x1'));var BPromise=require(_0x00f5('0x2'));var rs=require(_0x00f5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x00f5('0x4'))['db'];var utils=require(_0x00f5('0x5'));var logger=require(_0x00f5('0x6'))(_0x00f5('0x7'));var config=require(_0x00f5('0x8'));var jayson=require(_0x00f5('0x9'));var client=jayson['client'][_0x00f5('0xa')]({'port':0x232a});config[_0x00f5('0xb')]=_[_0x00f5('0xc')](config[_0x00f5('0xb')],{'host':_0x00f5('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x00f5('0xb')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x23ad2c,_0x4b852d,_0x23756d){return new BPromise(function(_0x43da30,_0x5305b3){return client[_0x00f5('0xe')](_0x23ad2c,_0x23756d)[_0x00f5('0xf')](function(_0x3f92b3){logger['info'](_0x00f5('0x10'),_0x4b852d,_0x00f5('0x11'));logger[_0x00f5('0x12')](_0x00f5('0x13'),_0x4b852d,_0x00f5('0x11'),JSON['stringify'](_0x3f92b3));if(_0x3f92b3['error']){if(_0x3f92b3[_0x00f5('0x14')][_0x00f5('0x15')]===0x1f4){logger[_0x00f5('0x14')]('SmsMessage,\x20%s,\x20%s',_0x4b852d,_0x3f92b3[_0x00f5('0x14')][_0x00f5('0x16')]);return _0x5305b3(_0x3f92b3[_0x00f5('0x14')]['message']);}logger[_0x00f5('0x14')](_0x00f5('0x10'),_0x4b852d,_0x3f92b3[_0x00f5('0x14')]['message']);return _0x43da30(_0x3f92b3[_0x00f5('0x14')][_0x00f5('0x16')]);}else{logger[_0x00f5('0x17')](_0x00f5('0x10'),_0x4b852d,_0x00f5('0x11'));_0x43da30(_0x3f92b3[_0x00f5('0x18')]['message']);}})[_0x00f5('0x19')](function(_0xd6fb44){logger[_0x00f5('0x14')](_0x00f5('0x10'),_0x4b852d,_0xd6fb44);_0x5305b3(_0xd6fb44);});});}exports['CreateSmsMessage']=function(_0x2da3dc){var _0x483894=this;return new Promise(function(_0x2a1343,_0x3ef5eb){return db[_0x00f5('0x1a')][_0x00f5('0x1b')](_0x2da3dc['body'],{'raw':_0x2da3dc['options']?_0x2da3dc[_0x00f5('0x1c')][_0x00f5('0x1d')]===undefined?!![]:![]:!![]})[_0x00f5('0xf')](function(_0x52104){logger[_0x00f5('0x17')](_0x00f5('0x1e'),_0x2da3dc);logger[_0x00f5('0x12')](_0x00f5('0x1e'),_0x2da3dc,JSON['stringify'](_0x52104));_0x2a1343(_0x52104);})[_0x00f5('0x19')](function(_0x1a311d){logger[_0x00f5('0x14')](_0x00f5('0x1e'),_0x1a311d['message'],_0x2da3dc);_0x3ef5eb(_0x483894[_0x00f5('0x14')](0x1f4,_0x1a311d[_0x00f5('0x16')]));});});}; \ No newline at end of file +var _0xf480=['request\x20sent','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','then','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./smsMessage.socket','request','info','debug'];(function(_0x1ab143,_0x3b4c0f){var _0x1b0d34=function(_0x48a21e){while(--_0x48a21e){_0x1ab143['push'](_0x1ab143['shift']());}};_0x1b0d34(++_0x3b4c0f);}(_0xf480,0x1c0));var _0x0f48=function(_0x269a38,_0x55662e){_0x269a38=_0x269a38-0x0;var _0x1f45a4=_0xf480[_0x269a38];return _0x1f45a4;};'use strict';var _=require(_0x0f48('0x0'));var util=require(_0x0f48('0x1'));var moment=require(_0x0f48('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f48('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f48('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f48('0x5'))(_0x0f48('0x6'));var config=require(_0x0f48('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0f48('0x8')]({'port':0x232a});config[_0x0f48('0x9')]=_['defaults'](config[_0x0f48('0x9')],{'host':_0x0f48('0xa'),'port':0x18eb});var socket=require(_0x0f48('0xb'))(new Redis(config[_0x0f48('0x9')]));require(_0x0f48('0xc'))['register'](socket);function respondWithRpcPromise(_0x51a854,_0xf43af5,_0x5c46fc){return new BPromise(function(_0x1c1e16,_0x47d4bd){return client[_0x0f48('0xd')](_0x51a854,_0x5c46fc)['then'](function(_0x8509f4){logger[_0x0f48('0xe')]('SmsMessage,\x20%s,\x20%s',_0xf43af5,'request\x20sent');logger[_0x0f48('0xf')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf43af5,_0x0f48('0x10'),JSON[_0x0f48('0x11')](_0x8509f4));if(_0x8509f4[_0x0f48('0x12')]){if(_0x8509f4[_0x0f48('0x12')]['code']===0x1f4){logger[_0x0f48('0x12')](_0x0f48('0x13'),_0xf43af5,_0x8509f4[_0x0f48('0x12')]['message']);return _0x47d4bd(_0x8509f4[_0x0f48('0x12')][_0x0f48('0x14')]);}logger[_0x0f48('0x12')](_0x0f48('0x13'),_0xf43af5,_0x8509f4[_0x0f48('0x12')][_0x0f48('0x14')]);return _0x1c1e16(_0x8509f4[_0x0f48('0x12')][_0x0f48('0x14')]);}else{logger[_0x0f48('0xe')](_0x0f48('0x13'),_0xf43af5,_0x0f48('0x10'));_0x1c1e16(_0x8509f4[_0x0f48('0x15')]['message']);}})[_0x0f48('0x16')](function(_0x2daa98){logger[_0x0f48('0x12')]('SmsMessage,\x20%s,\x20%s',_0xf43af5,_0x2daa98);_0x47d4bd(_0x2daa98);});});}exports[_0x0f48('0x17')]=function(_0x4289b1){var _0x419947=this;return new Promise(function(_0x10b701,_0x5b9753){return db[_0x0f48('0x18')][_0x0f48('0x19')](_0x4289b1[_0x0f48('0x1a')],{'raw':_0x4289b1[_0x0f48('0x1b')]?_0x4289b1[_0x0f48('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x0f48('0x1c')](function(_0x5e9cef){logger[_0x0f48('0xe')](_0x0f48('0x17'),_0x4289b1);logger[_0x0f48('0xf')](_0x0f48('0x17'),_0x4289b1,JSON[_0x0f48('0x11')](_0x5e9cef));_0x10b701(_0x5e9cef);})[_0x0f48('0x16')](function(_0x4bf547){logger[_0x0f48('0x12')]('CreateSmsMessage',_0x4bf547[_0x0f48('0x14')],_0x4289b1);_0x5b9753(_0x419947[_0x0f48('0x12')](0x1f4,_0x4bf547[_0x0f48('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 745169d..1d79955 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 _0xa125=['register','length','./smsMessage.events','remove','update','removeListener'];(function(_0x2504c6,_0x2e21a5){var _0x3f293d=function(_0x4c2499){while(--_0x4c2499){_0x2504c6['push'](_0x2504c6['shift']());}};_0x3f293d(++_0x2e21a5);}(_0xa125,0x10a));var _0x5a12=function(_0x6c9cc2,_0x5a2fb3){_0x6c9cc2=_0x6c9cc2-0x0;var _0x368394=_0xa125[_0x6c9cc2];return _0x368394;};'use strict';var SmsMessageEvents=require(_0x5a12('0x0'));var events=['save',_0x5a12('0x1'),_0x5a12('0x2')];function createListener(_0x37f117,_0x41a505){return function(_0x59c3b5){_0x41a505['emit'](_0x37f117,_0x59c3b5);};}function removeListener(_0x37ed0f,_0x2c0634){return function(){SmsMessageEvents[_0x5a12('0x3')](_0x37ed0f,_0x2c0634);};}exports[_0x5a12('0x4')]=function(_0x59a686){for(var _0x4d3ffd=0x0,_0x1f7852=events[_0x5a12('0x5')];_0x4d3ffd<_0x1f7852;_0x4d3ffd++){var _0x37b352=events[_0x4d3ffd];var _0x169d86=createListener('smsMessage:'+_0x37b352,_0x59a686);SmsMessageEvents['on'](_0x37b352,_0x169d86);}}; \ No newline at end of file +var _0x1b07=['length','./smsMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x37c27c,_0x249b81){var _0x214d47=function(_0x49aa3d){while(--_0x49aa3d){_0x37c27c['push'](_0x37c27c['shift']());}};_0x214d47(++_0x249b81);}(_0x1b07,0xa9));var _0x71b0=function(_0x4f3c9b,_0x28e078){_0x4f3c9b=_0x4f3c9b-0x0;var _0x84e58a=_0x1b07[_0x4f3c9b];return _0x84e58a;};'use strict';var SmsMessageEvents=require(_0x71b0('0x0'));var events=[_0x71b0('0x1'),_0x71b0('0x2'),_0x71b0('0x3')];function createListener(_0x1c4bc0,_0x5abc15){return function(_0x7ac859){_0x5abc15[_0x71b0('0x4')](_0x1c4bc0,_0x7ac859);};}function removeListener(_0x4f8f54,_0x3c7d1b){return function(){SmsMessageEvents[_0x71b0('0x5')](_0x4f8f54,_0x3c7d1b);};}exports[_0x71b0('0x6')]=function(_0xe96c4){for(var _0x118a49=0x0,_0xf394e8=events[_0x71b0('0x7')];_0x118a49<_0xf394e8;_0x118a49++){var _0x17f903=events[_0x118a49];var _0x42ee2d=createListener('smsMessage:'+_0x17f903,_0xe96c4);SmsMessageEvents['on'](_0x17f903,_0x42ee2d);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 26a4dad..ad8ed71 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 _0xa2be=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','describe','/:id','/:id/members'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2be,0x1ef));var _0xea2b=function(_0x1bc1e6,_0x13d154){_0x1bc1e6=_0x1bc1e6-0x0;var _0x5d9439=_0xa2be[_0x1bc1e6];return _0x5d9439;};'use strict';var multer=require(_0xea2b('0x0'));var util=require(_0xea2b('0x1'));var path=require(_0xea2b('0x2'));var timeout=require(_0xea2b('0x3'));var express=require(_0xea2b('0x4'));var router=express[_0xea2b('0x5')]();var fs_extra=require(_0xea2b('0x6'));var auth=require(_0xea2b('0x7'));var interaction=require(_0xea2b('0x8'));var config=require('../../config/environment');var controller=require(_0xea2b('0x9'));router[_0xea2b('0xa')]('/',auth[_0xea2b('0xb')](),controller['index']);router[_0xea2b('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xea2b('0xc')]);router['get'](_0xea2b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xea2b('0xa')](_0xea2b('0xe'),auth[_0xea2b('0xb')](),controller[_0xea2b('0xf')]);router[_0xea2b('0xa')](_0xea2b('0x10'),auth['isAuthenticated'](),controller[_0xea2b('0x11')]);router[_0xea2b('0xa')](_0xea2b('0x12'),auth['isAuthenticated'](),controller[_0xea2b('0x13')]);router[_0xea2b('0x14')]('/',auth['isAuthenticated'](),controller[_0xea2b('0x15')]);router[_0xea2b('0x14')](_0xea2b('0x10'),auth[_0xea2b('0xb')](),controller[_0xea2b('0x16')]);router[_0xea2b('0x14')]('/:id/users',auth[_0xea2b('0xb')](),controller[_0xea2b('0x17')]);router[_0xea2b('0x18')]('/:id',auth[_0xea2b('0xb')](),controller[_0xea2b('0x19')]);router[_0xea2b('0x1a')](_0xea2b('0xd'),auth[_0xea2b('0xb')](),controller[_0xea2b('0x1b')]);router[_0xea2b('0x1a')](_0xea2b('0x10'),auth['isAuthenticated'](),controller[_0xea2b('0x1c')]);router[_0xea2b('0x1a')](_0xea2b('0x12'),auth[_0xea2b('0xb')](),controller['removeAgents']);module[_0xea2b('0x1d')]=router; \ No newline at end of file +var _0x772c=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x22629d,_0x52081e){var _0x518a87=function(_0x3be34d){while(--_0x3be34d){_0x22629d['push'](_0x22629d['shift']());}};_0x518a87(++_0x52081e);}(_0x772c,0x174));var _0xc772=function(_0x11e1ea,_0x5755e7){_0x11e1ea=_0x11e1ea-0x0;var _0x558e4a=_0x772c[_0x11e1ea];return _0x558e4a;};'use strict';var multer=require(_0xc772('0x0'));var util=require('util');var path=require(_0xc772('0x1'));var timeout=require(_0xc772('0x2'));var express=require('express');var router=express[_0xc772('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc772('0x4'));var interaction=require(_0xc772('0x5'));var config=require(_0xc772('0x6'));var controller=require(_0xc772('0x7'));router[_0xc772('0x8')]('/',auth[_0xc772('0x9')](),controller['index']);router['get'](_0xc772('0xa'),auth[_0xc772('0x9')](),controller[_0xc772('0xb')]);router[_0xc772('0x8')](_0xc772('0xc'),auth['isAuthenticated'](),controller[_0xc772('0xd')]);router[_0xc772('0x8')](_0xc772('0xe'),auth[_0xc772('0x9')](),controller[_0xc772('0xf')]);router[_0xc772('0x8')](_0xc772('0x10'),auth['isAuthenticated'](),controller[_0xc772('0x11')]);router[_0xc772('0x8')](_0xc772('0x12'),auth[_0xc772('0x9')](),controller[_0xc772('0x13')]);router[_0xc772('0x14')]('/',auth[_0xc772('0x9')](),controller[_0xc772('0x15')]);router[_0xc772('0x14')](_0xc772('0x10'),auth[_0xc772('0x9')](),controller[_0xc772('0x16')]);router[_0xc772('0x14')](_0xc772('0x12'),auth['isAuthenticated'](),controller[_0xc772('0x17')]);router[_0xc772('0x18')](_0xc772('0xc'),auth[_0xc772('0x9')](),controller[_0xc772('0x19')]);router[_0xc772('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0xc772('0x1b')]);router[_0xc772('0x1a')](_0xc772('0x10'),auth[_0xc772('0x9')](),controller[_0xc772('0x1c')]);router[_0xc772('0x1a')](_0xc772('0x12'),auth['isAuthenticated'](),controller[_0xc772('0x1d')]);module[_0xc772('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 5846b78..2d00265 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 _0x3ad0=['ENUM','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x13ff8d,_0x252e77){var _0x40a56e=function(_0xddf0){while(--_0xddf0){_0x13ff8d['push'](_0x13ff8d['shift']());}};_0x40a56e(++_0x252e77);}(_0x3ad0,0x199));var _0x03ad=function(_0x2d024f,_0xe9c672){_0x2d024f=_0x2d024f-0x0;var _0xb9561f=_0x3ad0[_0x2d024f];return _0xb9561f;};'use strict';var Sequelize=require(_0x03ad('0x0'));module['exports']={'name':{'type':Sequelize[_0x03ad('0x1')],'unique':_0x03ad('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x03ad('0x1')]},'timeout':{'type':Sequelize[_0x03ad('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x03ad('0x4')]('rrmemory',_0x03ad('0x5'),_0x03ad('0x6'))}}; \ No newline at end of file +var _0x0043=['STRING','name','INTEGER','beepall','sequelize','exports'];(function(_0xa855a7,_0x4a7934){var _0x2c0d41=function(_0x28b7b4){while(--_0x28b7b4){_0xa855a7['push'](_0xa855a7['shift']());}};_0x2c0d41(++_0x4a7934);}(_0x0043,0xc4));var _0x3004=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x0043[_0x38b14f];return _0x22a324;};'use strict';var Sequelize=require(_0x3004('0x0'));module[_0x3004('0x1')]={'name':{'type':Sequelize[_0x3004('0x2')],'unique':_0x3004('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3004('0x2')]},'timeout':{'type':Sequelize[_0x3004('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x3004('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index c6ca345..228a9a7 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 _0x84c4=['UserSmsQueue','User','findAndCountAll','UserId','smsPause','updatedAt','format','SIP','findOne','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','emit','userSmsQueue:save','select','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','value','transaction','removeTeams','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','./smsQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','get','SmsQueues','UserProfileResource','then','end','error','stack','name','send','index','SmsQueue','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','find','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','SmsQueueId','options'];(function(_0x3b0896,_0x408d22){var _0x2c4036=function(_0x3fbdd5){while(--_0x3fbdd5){_0x3b0896['push'](_0x3b0896['shift']());}};_0x2c4036(++_0x408d22);}(_0x84c4,0x157));var _0x484c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84c4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x484c('0x0'));var rimraf=require(_0x484c('0x1'));var zipdir=require(_0x484c('0x2'));var jsonpatch=require(_0x484c('0x3'));var rp=require(_0x484c('0x4'));var moment=require(_0x484c('0x5'));var BPromise=require(_0x484c('0x6'));var Mustache=require(_0x484c('0x7'));var util=require(_0x484c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x484c('0x9'));var ejs=require(_0x484c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x484c('0xb'));var squel=require('squel');var crypto=require(_0x484c('0xc'));var jsforce=require(_0x484c('0xd'));var deskjs=require(_0x484c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x484c('0xf'));var Papa=require(_0x484c('0x10'));var Redis=require(_0x484c('0x11'));var authService=require(_0x484c('0x12'));var qs=require(_0x484c('0x13'));var as=require(_0x484c('0x14'));var hardwareService=require(_0x484c('0x15'));var logger=require('../../config/logger')(_0x484c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x484c('0x17'));var db=require(_0x484c('0x18'))['db'];config[_0x484c('0x19')]=_[_0x484c('0x1a')](config[_0x484c('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x484c('0x1b'))[_0x484c('0x1c')](socket);function respondWithStatusCode(_0x5105ee,_0x41e556){_0x41e556=_0x41e556||0xcc;return function(_0x52a0f6){if(_0x52a0f6){return _0x5105ee[_0x484c('0x1d')](_0x41e556);}return _0x5105ee[_0x484c('0x1e')](_0x41e556)['end']();};}function respondWithResult(_0x579464,_0x57e06f){_0x57e06f=_0x57e06f||0xc8;return function(_0x5da25f){if(_0x5da25f){return _0x579464[_0x484c('0x1e')](_0x57e06f)[_0x484c('0x1f')](_0x5da25f);}};}function respondWithFilteredResult(_0x489221,_0x11639b){return function(_0x4567f8){if(_0x4567f8){var _0x39a436=typeof _0x11639b[_0x484c('0x20')]===_0x484c('0x21')&&typeof _0x11639b[_0x484c('0x22')]==='undefined';var _0x1105ca=_0x4567f8[_0x484c('0x23')];var _0x1b5e95=_0x39a436?0x0:_0x11639b[_0x484c('0x20')];var _0x102666=_0x39a436?_0x4567f8[_0x484c('0x23')]:_0x11639b[_0x484c('0x20')]+_0x11639b[_0x484c('0x22')];var _0x3dc482;if(_0x102666>=_0x1105ca){_0x102666=_0x1105ca;_0x3dc482=0xc8;}else{_0x3dc482=0xce;}_0x489221['status'](_0x3dc482);return _0x489221[_0x484c('0x24')](_0x484c('0x25'),_0x1b5e95+'-'+_0x102666+'/'+_0x1105ca)[_0x484c('0x1f')](_0x4567f8);}return null;};}function patchUpdates(_0xca8eee){return function(_0x1a3d3e){try{jsonpatch['apply'](_0x1a3d3e,_0xca8eee,!![]);}catch(_0x284ea5){return BPromise[_0x484c('0x26')](_0x284ea5);}return _0x1a3d3e[_0x484c('0x27')]();};}function saveUpdates(_0x571f76,_0x11e62c){return function(_0x2a54e1){if(_0x2a54e1){return _0x2a54e1['update'](_0x571f76)['then'](function(_0x23a3ce){return _0x23a3ce;});}return null;};}function removeEntity(_0x4dc2f6,_0x5335ff){return function(_0x3aa5db){if(_0x3aa5db){return _0x3aa5db[_0x484c('0x28')]()['then'](function(){var _0x2e2fd9=_0x3aa5db[_0x484c('0x29')]({'plain':!![]});var _0x12dad6=_0x484c('0x2a');return db[_0x484c('0x2b')]['destroy']({'where':{'type':_0x12dad6,'resourceId':_0x2e2fd9['id']}})[_0x484c('0x2c')](function(){return _0x3aa5db;});})[_0x484c('0x2c')](function(){_0x4dc2f6[_0x484c('0x1e')](0xcc)[_0x484c('0x2d')]();});}};}function handleEntityNotFound(_0x31af1f,_0x413e91){return function(_0x438b1a){if(!_0x438b1a){_0x31af1f[_0x484c('0x1d')](0x194);}return _0x438b1a;};}function handleError(_0x1615aa,_0x82b329){_0x82b329=_0x82b329||0x1f4;return function(_0x2ab33e){logger[_0x484c('0x2e')](_0x2ab33e[_0x484c('0x2f')]);if(_0x2ab33e[_0x484c('0x30')]){delete _0x2ab33e[_0x484c('0x30')];}_0x1615aa[_0x484c('0x1e')](_0x82b329)[_0x484c('0x31')](_0x2ab33e);};}exports[_0x484c('0x32')]=function(_0x36bea3,_0x2a99b2){var _0x444600={},_0x11b8c0={},_0x88cef2={'count':0x0,'rows':[]};var _0x22fa7a=_['map'](db[_0x484c('0x33')][_0x484c('0x34')],function(_0x3a5086){return{'name':_0x3a5086[_0x484c('0x35')],'type':_0x3a5086[_0x484c('0x36')]['key']};});_0x11b8c0[_0x484c('0x37')]=_[_0x484c('0x38')](_0x22fa7a,'name');_0x11b8c0[_0x484c('0x39')]=_[_0x484c('0x3a')](_0x36bea3[_0x484c('0x39')]);_0x11b8c0[_0x484c('0x3b')]=_['intersection'](_0x11b8c0[_0x484c('0x37')],_0x11b8c0['query']);_0x444600[_0x484c('0x3c')]=_[_0x484c('0x3d')](_0x11b8c0[_0x484c('0x37')],qs[_0x484c('0x3e')](_0x36bea3[_0x484c('0x39')]['fields']));_0x444600[_0x484c('0x3c')]=_0x444600[_0x484c('0x3c')][_0x484c('0x3f')]?_0x444600['attributes']:_0x11b8c0[_0x484c('0x37')];if(!_0x36bea3[_0x484c('0x39')][_0x484c('0x40')](_0x484c('0x41'))){_0x444600['limit']=qs[_0x484c('0x22')](_0x36bea3[_0x484c('0x39')][_0x484c('0x22')]);_0x444600[_0x484c('0x20')]=qs['offset'](_0x36bea3[_0x484c('0x39')][_0x484c('0x20')]);}_0x444600[_0x484c('0x42')]=qs[_0x484c('0x43')](_0x36bea3['query'][_0x484c('0x43')]);_0x444600[_0x484c('0x44')]=qs[_0x484c('0x3b')](_[_0x484c('0x45')](_0x36bea3[_0x484c('0x39')],_0x11b8c0[_0x484c('0x3b')]),_0x22fa7a);if(_0x36bea3[_0x484c('0x39')]['filter']){_0x444600[_0x484c('0x44')]=_[_0x484c('0x46')](_0x444600[_0x484c('0x44')],{'$or':_['map'](_0x22fa7a,function(_0x51a4ea){if(_0x51a4ea[_0x484c('0x36')]!==_0x484c('0x47')){var _0x58b7e1={};_0x58b7e1[_0x51a4ea[_0x484c('0x30')]]={'$like':'%'+_0x36bea3[_0x484c('0x39')][_0x484c('0x48')]+'%'};return _0x58b7e1;}})});}_0x444600=_[_0x484c('0x46')]({},_0x444600,_0x36bea3['options']);var _0x17e101={'where':_0x444600['where']};return db[_0x484c('0x33')][_0x484c('0x23')](_0x17e101)['then'](function(_0x38adf1){_0x88cef2[_0x484c('0x23')]=_0x38adf1;if(_0x36bea3[_0x484c('0x39')][_0x484c('0x49')]){_0x444600[_0x484c('0x4a')]=[{'all':!![]}];}return db['SmsQueue'][_0x484c('0x4b')](_0x444600);})['then'](function(_0xfe90ba){_0x88cef2[_0x484c('0x4c')]=_0xfe90ba;return _0x88cef2;})[_0x484c('0x2c')](respondWithFilteredResult(_0x2a99b2,_0x444600))['catch'](handleError(_0x2a99b2,null));};exports['show']=function(_0x4e9eb1,_0x1a929e){var _0x2a809c={'raw':!![],'where':{'id':_0x4e9eb1[_0x484c('0x4d')]['id']}},_0x395471={};_0x395471[_0x484c('0x37')]=_[_0x484c('0x3a')](db[_0x484c('0x33')][_0x484c('0x34')]);_0x395471[_0x484c('0x39')]=_[_0x484c('0x3a')](_0x4e9eb1['query']);_0x395471[_0x484c('0x3b')]=_[_0x484c('0x3d')](_0x395471[_0x484c('0x37')],_0x395471[_0x484c('0x39')]);_0x2a809c[_0x484c('0x3c')]=_[_0x484c('0x3d')](_0x395471[_0x484c('0x37')],qs[_0x484c('0x3e')](_0x4e9eb1[_0x484c('0x39')][_0x484c('0x3e')]));_0x2a809c['attributes']=_0x2a809c[_0x484c('0x3c')][_0x484c('0x3f')]?_0x2a809c[_0x484c('0x3c')]:_0x395471[_0x484c('0x37')];if(_0x4e9eb1[_0x484c('0x39')][_0x484c('0x49')]){_0x2a809c[_0x484c('0x4a')]=[{'all':!![]}];}_0x2a809c=_[_0x484c('0x46')]({},_0x2a809c,_0x4e9eb1['options']);return db[_0x484c('0x33')][_0x484c('0x4e')](_0x2a809c)['then'](handleEntityNotFound(_0x1a929e,null))[_0x484c('0x2c')](respondWithResult(_0x1a929e,null))[_0x484c('0x4f')](handleError(_0x1a929e,null));};exports['create']=function(_0x247a5b,_0x2b4122){return db[_0x484c('0x33')]['create'](_0x247a5b[_0x484c('0x50')],{})['then'](function(_0xeac332){var _0x178fe2=_0x247a5b['user'][_0x484c('0x29')]({'plain':!![]});if(!_0x178fe2)throw new Error(_0x484c('0x51'));if(_0x178fe2[_0x484c('0x52')]===_0x484c('0x53')){var _0x34df62=_0xeac332[_0x484c('0x29')]({'plain':!![]});var _0x4e737b='SmsQueues';return db[_0x484c('0x54')]['find']({'where':{'name':_0x4e737b,'userProfileId':_0x178fe2['userProfileId']},'raw':!![]})[_0x484c('0x2c')](function(_0x507876){if(_0x507876&&_0x507876[_0x484c('0x55')]===0x0){return db[_0x484c('0x2b')][_0x484c('0x56')]({'name':_0x34df62['name'],'resourceId':_0x34df62['id'],'type':_0x507876[_0x484c('0x30')],'sectionId':_0x507876['id']},{})[_0x484c('0x2c')](function(){return _0xeac332;});}else{return _0xeac332;}})[_0x484c('0x4f')](function(_0x1c452f){logger[_0x484c('0x2e')](_0x484c('0x57'),_0x1c452f);throw _0x1c452f;});}return _0xeac332;})['then'](respondWithResult(_0x2b4122,0xc9))['catch'](handleError(_0x2b4122,null));};exports[_0x484c('0x58')]=function(_0x999266,_0x1179fd){if(_0x999266['body']['id']){delete _0x999266['body']['id'];}return db[_0x484c('0x33')][_0x484c('0x4e')]({'where':{'id':_0x999266['params']['id']}})['then'](handleEntityNotFound(_0x1179fd,null))[_0x484c('0x2c')](saveUpdates(_0x999266[_0x484c('0x50')],null))[_0x484c('0x2c')](respondWithResult(_0x1179fd,null))['catch'](handleError(_0x1179fd,null));};exports[_0x484c('0x28')]=function(_0x1840df,_0x42e0f1){return db[_0x484c('0x33')][_0x484c('0x4e')]({'where':{'id':_0x1840df[_0x484c('0x4d')]['id']}})[_0x484c('0x2c')](handleEntityNotFound(_0x42e0f1,null))[_0x484c('0x2c')](removeEntity(_0x42e0f1,null))[_0x484c('0x4f')](handleError(_0x42e0f1,null));};exports[_0x484c('0x59')]=function(_0xc4d709,_0x4801ee){return db[_0x484c('0x33')][_0x484c('0x59')]()[_0x484c('0x2c')](respondWithResult(_0x4801ee,null))[_0x484c('0x4f')](handleError(_0x4801ee,null));};exports['getMembers']=function(_0x1c33c9,_0x5c9636,_0x1e8362){var _0x86795e={'raw':!![],'where':{}},_0x999d53={},_0x453c69;return db[_0x484c('0x33')]['findOne']({'where':{'id':_0x1c33c9[_0x484c('0x4d')]['id']}})[_0x484c('0x2c')](handleEntityNotFound(_0x5c9636,null))[_0x484c('0x2c')](function(_0x4368d9){if(_0x4368d9){_0x453c69=_0x4368d9[_0x484c('0x29')]({'plain':!![]});_0x999d53[_0x484c('0x37')]=_[_0x484c('0x3a')](db['UserSmsQueue'][_0x484c('0x34')]);_0x999d53[_0x484c('0x39')]=_[_0x484c('0x3a')](_0x1c33c9['query']);_0x999d53[_0x484c('0x3b')]=_[_0x484c('0x3d')](_0x999d53[_0x484c('0x37')],_0x999d53['query']);_0x86795e[_0x484c('0x3c')]=_[_0x484c('0x3d')](_0x999d53[_0x484c('0x37')],qs[_0x484c('0x3e')](_0x1c33c9[_0x484c('0x39')][_0x484c('0x3e')]));_0x86795e[_0x484c('0x3c')]=_0x86795e[_0x484c('0x3c')]['length']?_0x86795e[_0x484c('0x3c')]:_0x999d53[_0x484c('0x37')];if(!_0x1c33c9[_0x484c('0x39')][_0x484c('0x40')](_0x484c('0x41'))){_0x86795e[_0x484c('0x22')]=qs[_0x484c('0x22')](_0x1c33c9[_0x484c('0x39')][_0x484c('0x22')]);_0x86795e[_0x484c('0x20')]=qs[_0x484c('0x20')](_0x1c33c9[_0x484c('0x39')][_0x484c('0x20')]);}_0x86795e[_0x484c('0x42')]=qs[_0x484c('0x43')](_0x1c33c9[_0x484c('0x39')][_0x484c('0x43')]);_0x86795e['where']=qs[_0x484c('0x3b')](_['pick'](_0x1c33c9['query'],_0x999d53['filters']));_0x86795e[_0x484c('0x44')][_0x484c('0x5a')]=_0x4368d9['id'];if(_0x1c33c9[_0x484c('0x39')][_0x484c('0x48')]){_0x86795e[_0x484c('0x44')]=_['merge'](_0x86795e[_0x484c('0x44')],{'$or':_[_0x484c('0x38')](_0x86795e[_0x484c('0x3c')],function(_0x1b3e2c){var _0x3ec942={};_0x3ec942[_0x1b3e2c]={'$like':'%'+_0x1c33c9[_0x484c('0x39')][_0x484c('0x48')]+'%'};return _0x3ec942;})});}_0x86795e=_['merge']({},_0x86795e,_0x1c33c9[_0x484c('0x5b')]);return db[_0x484c('0x5c')][_0x484c('0x4b')](_0x86795e);}})[_0x484c('0x2c')](function(_0x3016a3){if(_0x3016a3){return db[_0x484c('0x5d')][_0x484c('0x5e')]({'where':{'id':_[_0x484c('0x38')](_0x3016a3,_0x484c('0x5f')),'role':'agent'},'attributes':['id',_0x484c('0x30'),_0x484c('0x60'),_0x484c('0x61'),'createdAt']});}})['then'](function(_0x4fc52d){if(_0x4fc52d){return{'count':_0x4fc52d[_0x484c('0x23')],'rows':_[_0x484c('0x38')](_0x4fc52d[_0x484c('0x4c')],function(_0x4d7e78){return{'membername':_0x4d7e78['name'],'UserId':_0x4d7e78['id'],'queue_name':_0x453c69['name'],'SmsQueueId':_0x453c69['id'],'interface':util[_0x484c('0x62')]('%s/%s',_0x484c('0x63'),_0x4d7e78[_0x484c('0x30')]),'penalty':0x0,'paused':_0x4d7e78[_0x484c('0x60')],'createdAt':_0x4d7e78['createdAt'],'updatedAt':_0x4d7e78[_0x484c('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x484c('0x2c')](respondWithFilteredResult(_0x5c9636,_0x86795e))[_0x484c('0x4f')](handleError(_0x5c9636,null));};exports['getTeams']=function(_0x11ce02,_0x120e90,_0x2d2f03){var _0x5b14e8={};var _0x592948={};var _0x1043ad;var _0x1c791c;return db[_0x484c('0x33')][_0x484c('0x64')]({'where':{'id':_0x11ce02[_0x484c('0x4d')]['id']}})[_0x484c('0x2c')](handleEntityNotFound(_0x120e90,null))[_0x484c('0x2c')](function(_0xfcf8a1){if(_0xfcf8a1){_0x1043ad=_0xfcf8a1;_0x592948['model']=_['keys'](db[_0x484c('0x65')]['rawAttributes']);_0x592948['query']=_[_0x484c('0x3a')](_0x11ce02['query']);_0x592948[_0x484c('0x3b')]=_[_0x484c('0x3d')](_0x592948['model'],_0x592948[_0x484c('0x39')]);_0x5b14e8[_0x484c('0x3c')]=_['intersection'](_0x592948['model'],qs['fields'](_0x11ce02['query'][_0x484c('0x3e')]));_0x5b14e8['attributes']=_0x5b14e8[_0x484c('0x3c')][_0x484c('0x3f')]?_0x5b14e8[_0x484c('0x3c')]:_0x592948[_0x484c('0x37')];_0x5b14e8[_0x484c('0x42')]=qs[_0x484c('0x43')](_0x11ce02['query'][_0x484c('0x43')]);_0x5b14e8[_0x484c('0x44')]=qs[_0x484c('0x3b')](_[_0x484c('0x45')](_0x11ce02[_0x484c('0x39')],_0x592948['filters']));if(_0x11ce02[_0x484c('0x39')]['filter']){_0x5b14e8[_0x484c('0x44')]=_['merge'](_0x5b14e8[_0x484c('0x44')],{'$or':_[_0x484c('0x38')](_0x5b14e8['attributes'],function(_0x538046){var _0x255685={};_0x255685[_0x538046]={'$like':'%'+_0x11ce02[_0x484c('0x39')][_0x484c('0x48')]+'%'};return _0x255685;})});}_0x5b14e8=_[_0x484c('0x46')]({},_0x5b14e8,_0x11ce02['options']);return _0x1043ad[_0x484c('0x66')](_0x5b14e8);}})[_0x484c('0x2c')](function(_0x509062){if(_0x509062){_0x1c791c=_0x509062[_0x484c('0x3f')];if(!_0x11ce02['query'][_0x484c('0x40')](_0x484c('0x41'))){_0x5b14e8[_0x484c('0x22')]=qs[_0x484c('0x22')](_0x11ce02[_0x484c('0x39')]['limit']);_0x5b14e8[_0x484c('0x20')]=qs['offset'](_0x11ce02[_0x484c('0x39')][_0x484c('0x20')]);}return _0x1043ad['getTeams'](_0x5b14e8);}})[_0x484c('0x2c')](function(_0x416a74){if(_0x416a74){return _0x416a74?{'count':_0x1c791c,'rows':_0x416a74}:null;}})[_0x484c('0x2c')](respondWithResult(_0x120e90,null))['catch'](handleError(_0x120e90,null));};exports[_0x484c('0x67')]=function(_0x56ebda,_0x27bc66,_0x467eea){var _0x4a1974=_0x56ebda[_0x484c('0x50')][_0x484c('0x68')];return db[_0x484c('0x65')][_0x484c('0x4b')]({'where':{'id':_0x4a1974},'attributes':['id'],'include':[{'model':db[_0x484c('0x5d')],'as':_0x484c('0x69'),'attributes':['id',_0x484c('0x30'),_0x484c('0x6a'),_0x484c('0x6b'),_0x484c('0x6c')],'raw':!![]}]})[_0x484c('0x2c')](function(_0x397de1){if(_0x397de1){var _0x1565d9=_[_0x484c('0x6d')](_0x397de1,function(_0x30aea3){var _0x48ed07=_0x30aea3[_0x484c('0x29')]({'plain':!![]});return _0x48ed07[_0x484c('0x69')];});return db[_0x484c('0x33')][_0x484c('0x4e')]({'where':{'id':_0x56ebda['params']['id']}})[_0x484c('0x2c')](function(_0x357ea5){return db[_0x484c('0x6e')]['transaction'](function(_0x1035a8){return _0x357ea5[_0x484c('0x67')](_0x4a1974,{'transaction':_0x1035a8})[_0x484c('0x2c')](function(){return BPromise[_0x484c('0x6f')](_0x1565d9,function(_0x28370a){return db['UserSmsQueue'][_0x484c('0x70')]({'where':{'UserId':_0x28370a['id'],'SmsQueueId':_0x56ebda[_0x484c('0x4d')]['id']},'transaction':_0x1035a8});});})[_0x484c('0x2c')](function(){_0x1565d9['forEach'](function(_0x188a26){socket[_0x484c('0x71')](_0x484c('0x72'),{'UserId':_0x188a26['id'],'SmsQueueId':_0x357ea5['id']});});});});});}})['then'](respondWithStatusCode(_0x27bc66,null))[_0x484c('0x4f')](handleError(_0x27bc66,null));};exports['removeTeams']=function(_0x5aeb8d,_0x269459,_0x2543ec){return db[_0x484c('0x65')][_0x484c('0x4b')]({'where':{'id':_0x5aeb8d['query'][_0x484c('0x68')]},'attributes':['id'],'include':[{'model':db[_0x484c('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x484c('0x2c')](handleEntityNotFound(_0x269459,null))[_0x484c('0x2c')](function(_0x51a0e0){var _0x44c684=_[_0x484c('0x38')](_0x51a0e0,'id');var _0x8289a4=[];var _0x4ce1a6=[];var _0x203818=squel[_0x484c('0x73')]();_0x203818[_0x484c('0x74')](_0x484c('0x75'))[_0x484c('0x76')](_0x484c('0x77'),'tq')[_0x484c('0x78')]('user_has_teams','ut',_0x484c('0x79'))[_0x484c('0x44')](_0x484c('0x7a'),_0x5aeb8d[_0x484c('0x4d')]['id']);for(var _0x4184b3=0x0;_0x4184b3<_0x51a0e0[_0x484c('0x3f')];_0x4184b3+=0x1){let _0x4ad694=_0x51a0e0[_0x4184b3];for(var _0x262c14=0x0;_0x262c14<_0x4ad694['Agents'][_0x484c('0x3f')];_0x262c14+=0x1){let _0x3979c0=_0x4ad694[_0x484c('0x69')][_0x262c14];var _0x4a8554=_0x203818[_0x484c('0x7b')]();_0x4a8554['where'](_0x484c('0x7c'),_0x3979c0['id']);_0x4ce1a6[_0x484c('0x7d')](db[_0x484c('0x6e')][_0x484c('0x39')](_0x4a8554[_0x484c('0x7e')](),{'type':db[_0x484c('0x6e')][_0x484c('0x7f')]['SELECT']})['then'](function(_0x552330){if(_0x552330[_0x484c('0x3f')]===0x1){return _0x3979c0['id'];}else{var _0x3cf85e=_[_0x484c('0x80')](_[_0x484c('0x38')](_0x552330,_0x484c('0x81')),function(_0x1c6eb4){return _[_0x484c('0x82')](_0x44c684,_0x1c6eb4);});if(_0x3cf85e){return _0x3979c0['id'];}}}));}}return BPromise[_0x484c('0x83')](_0x4ce1a6)['then'](function(_0x45d4da){_0x8289a4=_(_0x8289a4)[_0x484c('0x84')](_0x45d4da)['compact']()[_0x484c('0x85')]();return db['SmsQueue']['find']({'where':{'id':_0x5aeb8d[_0x484c('0x4d')]['id']}})[_0x484c('0x2c')](function(_0x5d12f4){return db['sequelize'][_0x484c('0x86')](function(_0x1dea31){return _0x5d12f4[_0x484c('0x87')](_0x5aeb8d[_0x484c('0x39')]['ids'],{'transaction':_0x1dea31})[_0x484c('0x2c')](function(){if(!_[_0x484c('0x88')](_0x8289a4)){return _0x5d12f4['removeAgents'](_0x8289a4,{'transaction':_0x1dea31});}})[_0x484c('0x2c')](function(){_0x8289a4[_0x484c('0x89')](function(_0x5d4637){socket[_0x484c('0x71')](_0x484c('0x8a'),{'UserId':_0x5d4637,'SmsQueueId':_0x5d12f4['id']});});});});});});})['then'](respondWithStatusCode(_0x269459,null))[_0x484c('0x4f')](handleError(_0x269459,null));};exports[_0x484c('0x8b')]=function(_0x4fda36,_0x4bf25d,_0x1b33ca){return db[_0x484c('0x33')]['find']({'where':{'id':_0x4fda36[_0x484c('0x4d')]['id']}})[_0x484c('0x2c')](handleEntityNotFound(_0x4bf25d,null))[_0x484c('0x2c')](function(_0x592863){if(_0x592863){return _0x592863[_0x484c('0x8b')](_0x4fda36[_0x484c('0x50')]['ids'],_[_0x484c('0x8c')](_0x4fda36[_0x484c('0x50')],[_0x484c('0x68'),'id'])||{})[_0x484c('0x8d')](function(_0x5b2c01){for(var _0x31fad8=0x0;_0x31fad8<_0x4fda36[_0x484c('0x50')]['ids']['length'];_0x31fad8+=0x1){socket['emit'](_0x484c('0x72'),{'UserId':Number(_0x4fda36[_0x484c('0x50')][_0x484c('0x68')][_0x31fad8]),'SmsQueueId':Number(_0x4fda36['params']['id'])});}return _0x5b2c01;});}})[_0x484c('0x2c')](respondWithResult(_0x4bf25d,null))[_0x484c('0x4f')](handleError(_0x4bf25d,null));};exports[_0x484c('0x8e')]=function(_0x2f9fa0,_0x22d6b1,_0x494b3d){return db[_0x484c('0x33')][_0x484c('0x4e')]({'where':{'id':_0x2f9fa0['params']['id']}})[_0x484c('0x2c')](handleEntityNotFound(_0x22d6b1,null))[_0x484c('0x2c')](function(_0xe07183){if(_0xe07183){return _0xe07183[_0x484c('0x8e')](_0x2f9fa0[_0x484c('0x39')][_0x484c('0x68')])[_0x484c('0x2c')](function(){if(_[_0x484c('0x8f')](_0x2f9fa0['query'][_0x484c('0x68')])){for(var _0x1bf1d4=0x0;_0x1bf1d4<_0x2f9fa0[_0x484c('0x39')][_0x484c('0x68')][_0x484c('0x3f')];_0x1bf1d4+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x2f9fa0[_0x484c('0x39')][_0x484c('0x68')][_0x1bf1d4]),'SmsQueueId':Number(_0x2f9fa0[_0x484c('0x4d')]['id'])});}}else{socket[_0x484c('0x71')](_0x484c('0x8a'),{'UserId':Number(_0x2f9fa0[_0x484c('0x39')][_0x484c('0x68')]),'SmsQueueId':Number(_0x2f9fa0[_0x484c('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x22d6b1,null))[_0x484c('0x4f')](handleError(_0x22d6b1,null));};exports[_0x484c('0x90')]=function(_0x3578fd,_0x421dd5,_0x5dcd6b){var _0x30956e={};var _0x468536={};var _0x9d97f3;var _0x264223;return db[_0x484c('0x33')]['findOne']({'where':{'id':_0x3578fd[_0x484c('0x4d')]['id']}})[_0x484c('0x2c')](handleEntityNotFound(_0x421dd5,null))[_0x484c('0x2c')](function(_0x45b83b){if(_0x45b83b){_0x9d97f3=_0x45b83b;_0x468536[_0x484c('0x37')]=_[_0x484c('0x3a')](db['User'][_0x484c('0x34')]);_0x468536[_0x484c('0x39')]=_[_0x484c('0x3a')](_0x3578fd['query']);_0x468536['filters']=_[_0x484c('0x3d')](_0x468536[_0x484c('0x37')],_0x468536[_0x484c('0x39')]);_0x30956e[_0x484c('0x3c')]=_['intersection'](_0x468536[_0x484c('0x37')],qs[_0x484c('0x3e')](_0x3578fd[_0x484c('0x39')][_0x484c('0x3e')]));_0x30956e['attributes']=_0x30956e[_0x484c('0x3c')][_0x484c('0x3f')]?_0x30956e[_0x484c('0x3c')]:_0x468536[_0x484c('0x37')];_0x30956e[_0x484c('0x42')]=qs[_0x484c('0x43')](_0x3578fd['query']['sort']);_0x30956e[_0x484c('0x44')]=qs[_0x484c('0x3b')](_[_0x484c('0x45')](_0x3578fd['query'],_0x468536[_0x484c('0x3b')]));if(_0x3578fd[_0x484c('0x39')]['filter']){_0x30956e[_0x484c('0x44')]=_[_0x484c('0x46')](_0x30956e['where'],{'$or':_[_0x484c('0x38')](_0x30956e[_0x484c('0x3c')],function(_0x556cf1){var _0x2d44ff={};_0x2d44ff[_0x556cf1]={'$like':'%'+_0x3578fd['query'][_0x484c('0x48')]+'%'};return _0x2d44ff;})});}_0x30956e=_[_0x484c('0x46')]({},_0x30956e,_0x3578fd['options']);return _0x9d97f3[_0x484c('0x90')](_0x30956e);}})[_0x484c('0x2c')](function(_0x597d8f){if(_0x597d8f){_0x264223=_0x597d8f['length'];if(!_0x3578fd[_0x484c('0x39')][_0x484c('0x40')](_0x484c('0x41'))){_0x30956e['limit']=qs[_0x484c('0x22')](_0x3578fd['query'][_0x484c('0x22')]);_0x30956e['offset']=qs[_0x484c('0x20')](_0x3578fd[_0x484c('0x39')]['offset']);}return _0x9d97f3[_0x484c('0x90')](_0x30956e);}})[_0x484c('0x2c')](function(_0x1b421b){if(_0x1b421b){return _0x1b421b?{'count':_0x264223,'rows':_0x1b421b}:null;}})[_0x484c('0x2c')](respondWithResult(_0x421dd5,null))[_0x484c('0x4f')](handleError(_0x421dd5,null));}; \ No newline at end of file +var _0xc50f=['rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','SmsQueueId','UserSmsQueue','findAll','User','findAndCountAll','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','from','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','map','SmsQueue','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include'];(function(_0x234995,_0x48c007){var _0x5115f0=function(_0x7f8704){while(--_0x7f8704){_0x234995['push'](_0x234995['shift']());}};_0x5115f0(++_0x48c007);}(_0xc50f,0x153));var _0xfc50=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xc50f[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0xfc50('0x0'));var rimraf=require(_0xfc50('0x1'));var zipdir=require(_0xfc50('0x2'));var jsonpatch=require(_0xfc50('0x3'));var rp=require('request-promise');var moment=require(_0xfc50('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfc50('0x5'));var path=require(_0xfc50('0x6'));var sox=require(_0xfc50('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc50('0x8'));var _=require(_0xfc50('0x9'));var squel=require('squel');var crypto=require(_0xfc50('0xa'));var jsforce=require(_0xfc50('0xb'));var deskjs=require(_0xfc50('0xc'));var toCsv=require(_0xfc50('0xd'));var querystring=require(_0xfc50('0xe'));var Papa=require(_0xfc50('0xf'));var Redis=require(_0xfc50('0x10'));var authService=require(_0xfc50('0x11'));var qs=require(_0xfc50('0x12'));var as=require(_0xfc50('0x13'));var hardwareService=require(_0xfc50('0x14'));var logger=require('../../config/logger')(_0xfc50('0x15'));var utils=require(_0xfc50('0x16'));var config=require(_0xfc50('0x17'));var licenseUtil=require(_0xfc50('0x18'));var db=require(_0xfc50('0x19'))['db'];config[_0xfc50('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfc50('0x1b'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xfc50('0x1c')](socket);function respondWithStatusCode(_0x2ccfb4,_0x47f7e3){_0x47f7e3=_0x47f7e3||0xcc;return function(_0x2d94b3){if(_0x2d94b3){return _0x2ccfb4['sendStatus'](_0x47f7e3);}return _0x2ccfb4['status'](_0x47f7e3)['end']();};}function respondWithResult(_0x501de5,_0x37a8cb){_0x37a8cb=_0x37a8cb||0xc8;return function(_0xe9b3b6){if(_0xe9b3b6){return _0x501de5[_0xfc50('0x1d')](_0x37a8cb)['json'](_0xe9b3b6);}};}function respondWithFilteredResult(_0x164afa,_0x2a4ecb){return function(_0x446650){if(_0x446650){var _0x3388a8=typeof _0x2a4ecb[_0xfc50('0x1e')]==='undefined'&&typeof _0x2a4ecb[_0xfc50('0x1f')]===_0xfc50('0x20');var _0x4221a9=_0x446650[_0xfc50('0x21')];var _0x31126f=_0x3388a8?0x0:_0x2a4ecb[_0xfc50('0x1e')];var _0x2857b4=_0x3388a8?_0x446650[_0xfc50('0x21')]:_0x2a4ecb['offset']+_0x2a4ecb[_0xfc50('0x1f')];var _0x5f2afa;if(_0x2857b4>=_0x4221a9){_0x2857b4=_0x4221a9;_0x5f2afa=0xc8;}else{_0x5f2afa=0xce;}_0x164afa[_0xfc50('0x1d')](_0x5f2afa);return _0x164afa[_0xfc50('0x22')](_0xfc50('0x23'),_0x31126f+'-'+_0x2857b4+'/'+_0x4221a9)[_0xfc50('0x24')](_0x446650);}return null;};}function patchUpdates(_0x3e9403){return function(_0x177e70){try{jsonpatch[_0xfc50('0x25')](_0x177e70,_0x3e9403,!![]);}catch(_0x2096f4){return BPromise[_0xfc50('0x26')](_0x2096f4);}return _0x177e70[_0xfc50('0x27')]();};}function saveUpdates(_0x4229c6,_0x3f369f){return function(_0x2fa3f9){if(_0x2fa3f9){return _0x2fa3f9[_0xfc50('0x28')](_0x4229c6)[_0xfc50('0x29')](function(_0x5a61ba){return _0x5a61ba;});}return null;};}function removeEntity(_0x3e41ad,_0x3b7d7c){return function(_0x1e32ca){if(_0x1e32ca){return _0x1e32ca['destroy']()[_0xfc50('0x29')](function(){var _0x29c4bb=_0x1e32ca[_0xfc50('0x2a')]({'plain':!![]});var _0x3c0046='SmsQueues';return db[_0xfc50('0x2b')][_0xfc50('0x2c')]({'where':{'type':_0x3c0046,'resourceId':_0x29c4bb['id']}})[_0xfc50('0x29')](function(){return _0x1e32ca;});})[_0xfc50('0x29')](function(){_0x3e41ad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15a751,_0x31b63c){return function(_0x419070){if(!_0x419070){_0x15a751[_0xfc50('0x2d')](0x194);}return _0x419070;};}function handleError(_0x3e2c6f,_0x38ba36){_0x38ba36=_0x38ba36||0x1f4;return function(_0x2775b7){logger[_0xfc50('0x2e')](_0x2775b7[_0xfc50('0x2f')]);if(_0x2775b7['name']){delete _0x2775b7[_0xfc50('0x30')];}_0x3e2c6f[_0xfc50('0x1d')](_0x38ba36)['send'](_0x2775b7);};}exports['index']=function(_0x3ea16b,_0x24d491){var _0x13a08f={},_0xfe87c3={},_0x5c9be9={'count':0x0,'rows':[]};var _0x4ace96=_[_0xfc50('0x31')](db[_0xfc50('0x32')][_0xfc50('0x33')],function(_0xeff85d){return{'name':_0xeff85d['fieldName'],'type':_0xeff85d[_0xfc50('0x34')]['key']};});_0xfe87c3[_0xfc50('0x35')]=_[_0xfc50('0x31')](_0x4ace96,_0xfc50('0x30'));_0xfe87c3[_0xfc50('0x36')]=_[_0xfc50('0x37')](_0x3ea16b[_0xfc50('0x36')]);_0xfe87c3['filters']=_[_0xfc50('0x38')](_0xfe87c3[_0xfc50('0x35')],_0xfe87c3[_0xfc50('0x36')]);_0x13a08f['attributes']=_[_0xfc50('0x38')](_0xfe87c3[_0xfc50('0x35')],qs[_0xfc50('0x39')](_0x3ea16b['query'][_0xfc50('0x39')]));_0x13a08f[_0xfc50('0x3a')]=_0x13a08f['attributes'][_0xfc50('0x3b')]?_0x13a08f[_0xfc50('0x3a')]:_0xfe87c3['model'];if(!_0x3ea16b['query'][_0xfc50('0x3c')]('nolimit')){_0x13a08f['limit']=qs[_0xfc50('0x1f')](_0x3ea16b[_0xfc50('0x36')][_0xfc50('0x1f')]);_0x13a08f[_0xfc50('0x1e')]=qs['offset'](_0x3ea16b[_0xfc50('0x36')][_0xfc50('0x1e')]);}_0x13a08f[_0xfc50('0x3d')]=qs[_0xfc50('0x3e')](_0x3ea16b[_0xfc50('0x36')]['sort']);_0x13a08f[_0xfc50('0x3f')]=qs[_0xfc50('0x40')](_[_0xfc50('0x41')](_0x3ea16b[_0xfc50('0x36')],_0xfe87c3['filters']),_0x4ace96);if(_0x3ea16b[_0xfc50('0x36')]['filter']){_0x13a08f[_0xfc50('0x3f')]=_[_0xfc50('0x42')](_0x13a08f[_0xfc50('0x3f')],{'$or':_[_0xfc50('0x31')](_0x4ace96,function(_0x17678a){if(_0x17678a['type']!==_0xfc50('0x43')){var _0x1edcef={};_0x1edcef[_0x17678a[_0xfc50('0x30')]]={'$like':'%'+_0x3ea16b[_0xfc50('0x36')][_0xfc50('0x44')]+'%'};return _0x1edcef;}})});}_0x13a08f=_['merge']({},_0x13a08f,_0x3ea16b[_0xfc50('0x45')]);var _0x311b03={'where':_0x13a08f[_0xfc50('0x3f')]};return db[_0xfc50('0x32')][_0xfc50('0x21')](_0x311b03)[_0xfc50('0x29')](function(_0x4e3ac0){_0x5c9be9[_0xfc50('0x21')]=_0x4e3ac0;if(_0x3ea16b[_0xfc50('0x36')][_0xfc50('0x46')]){_0x13a08f[_0xfc50('0x47')]=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x13a08f);})['then'](function(_0x2f33ed){_0x5c9be9[_0xfc50('0x48')]=_0x2f33ed;return _0x5c9be9;})[_0xfc50('0x29')](respondWithFilteredResult(_0x24d491,_0x13a08f))[_0xfc50('0x49')](handleError(_0x24d491,null));};exports[_0xfc50('0x4a')]=function(_0x221b73,_0x51a30f){var _0x1d95ed={'raw':!![],'where':{'id':_0x221b73[_0xfc50('0x4b')]['id']}},_0x2ce60c={};_0x2ce60c[_0xfc50('0x35')]=_[_0xfc50('0x37')](db[_0xfc50('0x32')][_0xfc50('0x33')]);_0x2ce60c[_0xfc50('0x36')]=_['keys'](_0x221b73[_0xfc50('0x36')]);_0x2ce60c[_0xfc50('0x40')]=_[_0xfc50('0x38')](_0x2ce60c[_0xfc50('0x35')],_0x2ce60c[_0xfc50('0x36')]);_0x1d95ed[_0xfc50('0x3a')]=_[_0xfc50('0x38')](_0x2ce60c[_0xfc50('0x35')],qs[_0xfc50('0x39')](_0x221b73[_0xfc50('0x36')][_0xfc50('0x39')]));_0x1d95ed['attributes']=_0x1d95ed['attributes'][_0xfc50('0x3b')]?_0x1d95ed['attributes']:_0x2ce60c[_0xfc50('0x35')];if(_0x221b73[_0xfc50('0x36')][_0xfc50('0x46')]){_0x1d95ed['include']=[{'all':!![]}];}_0x1d95ed=_['merge']({},_0x1d95ed,_0x221b73[_0xfc50('0x45')]);return db[_0xfc50('0x32')][_0xfc50('0x4c')](_0x1d95ed)['then'](handleEntityNotFound(_0x51a30f,null))[_0xfc50('0x29')](respondWithResult(_0x51a30f,null))[_0xfc50('0x49')](handleError(_0x51a30f,null));};exports['create']=function(_0x4ed210,_0x285b46){return db[_0xfc50('0x32')][_0xfc50('0x4d')](_0x4ed210[_0xfc50('0x4e')],{})['then'](function(_0x508d08){var _0x2f3234=_0x4ed210[_0xfc50('0x4f')]['get']({'plain':!![]});if(!_0x2f3234)throw new Error(_0xfc50('0x50'));if(_0x2f3234['role']==='user'){var _0x3d169a=_0x508d08[_0xfc50('0x2a')]({'plain':!![]});var _0x5e38dd=_0xfc50('0x51');return db[_0xfc50('0x52')][_0xfc50('0x4c')]({'where':{'name':_0x5e38dd,'userProfileId':_0x2f3234[_0xfc50('0x53')]},'raw':!![]})[_0xfc50('0x29')](function(_0x4859a1){if(_0x4859a1&&_0x4859a1[_0xfc50('0x54')]===0x0){return db['UserProfileResource'][_0xfc50('0x4d')]({'name':_0x3d169a[_0xfc50('0x30')],'resourceId':_0x3d169a['id'],'type':_0x4859a1[_0xfc50('0x30')],'sectionId':_0x4859a1['id']},{})['then'](function(){return _0x508d08;});}else{return _0x508d08;}})['catch'](function(_0x3ce061){logger[_0xfc50('0x2e')](_0xfc50('0x55'),_0x3ce061);throw _0x3ce061;});}return _0x508d08;})[_0xfc50('0x29')](respondWithResult(_0x285b46,0xc9))[_0xfc50('0x49')](handleError(_0x285b46,null));};exports[_0xfc50('0x28')]=function(_0x10ceec,_0x576434){if(_0x10ceec[_0xfc50('0x4e')]['id']){delete _0x10ceec[_0xfc50('0x4e')]['id'];}return db['SmsQueue'][_0xfc50('0x4c')]({'where':{'id':_0x10ceec[_0xfc50('0x4b')]['id']}})['then'](handleEntityNotFound(_0x576434,null))[_0xfc50('0x29')](saveUpdates(_0x10ceec[_0xfc50('0x4e')],null))[_0xfc50('0x29')](respondWithResult(_0x576434,null))[_0xfc50('0x49')](handleError(_0x576434,null));};exports[_0xfc50('0x2c')]=function(_0x4682bb,_0x325fa3){return db[_0xfc50('0x32')][_0xfc50('0x4c')]({'where':{'id':_0x4682bb['params']['id']}})[_0xfc50('0x29')](handleEntityNotFound(_0x325fa3,null))[_0xfc50('0x29')](removeEntity(_0x325fa3,null))[_0xfc50('0x49')](handleError(_0x325fa3,null));};exports['describe']=function(_0x4ca9ad,_0x384b3e){return db[_0xfc50('0x32')][_0xfc50('0x56')]()[_0xfc50('0x29')](respondWithResult(_0x384b3e,null))['catch'](handleError(_0x384b3e,null));};exports[_0xfc50('0x57')]=function(_0x2d7622,_0x211d1c,_0x46019b){var _0x34e7ae={'raw':!![],'where':{}},_0x3a90c1={},_0x486791;return db[_0xfc50('0x32')][_0xfc50('0x58')]({'where':{'id':_0x2d7622['params']['id']}})['then'](handleEntityNotFound(_0x211d1c,null))[_0xfc50('0x29')](function(_0x1fb28b){if(_0x1fb28b){_0x486791=_0x1fb28b['get']({'plain':!![]});_0x3a90c1['model']=_[_0xfc50('0x37')](db['UserSmsQueue'][_0xfc50('0x33')]);_0x3a90c1[_0xfc50('0x36')]=_[_0xfc50('0x37')](_0x2d7622[_0xfc50('0x36')]);_0x3a90c1[_0xfc50('0x40')]=_['intersection'](_0x3a90c1[_0xfc50('0x35')],_0x3a90c1['query']);_0x34e7ae[_0xfc50('0x3a')]=_[_0xfc50('0x38')](_0x3a90c1['model'],qs[_0xfc50('0x39')](_0x2d7622[_0xfc50('0x36')][_0xfc50('0x39')]));_0x34e7ae[_0xfc50('0x3a')]=_0x34e7ae['attributes'][_0xfc50('0x3b')]?_0x34e7ae[_0xfc50('0x3a')]:_0x3a90c1['model'];if(!_0x2d7622[_0xfc50('0x36')][_0xfc50('0x3c')](_0xfc50('0x59'))){_0x34e7ae[_0xfc50('0x1f')]=qs[_0xfc50('0x1f')](_0x2d7622[_0xfc50('0x36')]['limit']);_0x34e7ae['offset']=qs['offset'](_0x2d7622[_0xfc50('0x36')][_0xfc50('0x1e')]);}_0x34e7ae['order']=qs[_0xfc50('0x3e')](_0x2d7622[_0xfc50('0x36')][_0xfc50('0x3e')]);_0x34e7ae['where']=qs[_0xfc50('0x40')](_[_0xfc50('0x41')](_0x2d7622['query'],_0x3a90c1[_0xfc50('0x40')]));_0x34e7ae['where'][_0xfc50('0x5a')]=_0x1fb28b['id'];if(_0x2d7622['query'][_0xfc50('0x44')]){_0x34e7ae[_0xfc50('0x3f')]=_[_0xfc50('0x42')](_0x34e7ae['where'],{'$or':_[_0xfc50('0x31')](_0x34e7ae[_0xfc50('0x3a')],function(_0x41e434){var _0x207eab={};_0x207eab[_0x41e434]={'$like':'%'+_0x2d7622[_0xfc50('0x36')][_0xfc50('0x44')]+'%'};return _0x207eab;})});}_0x34e7ae=_['merge']({},_0x34e7ae,_0x2d7622[_0xfc50('0x45')]);return db[_0xfc50('0x5b')][_0xfc50('0x5c')](_0x34e7ae);}})[_0xfc50('0x29')](function(_0x4ce9ba){if(_0x4ce9ba){return db[_0xfc50('0x5d')][_0xfc50('0x5e')]({'where':{'id':_[_0xfc50('0x31')](_0x4ce9ba,'UserId'),'role':'agent'},'attributes':['id','name','smsPause',_0xfc50('0x5f'),'createdAt']});}})[_0xfc50('0x29')](function(_0x125fbf){if(_0x125fbf){return{'count':_0x125fbf[_0xfc50('0x21')],'rows':_['map'](_0x125fbf[_0xfc50('0x48')],function(_0x4a079c){return{'membername':_0x4a079c[_0xfc50('0x30')],'UserId':_0x4a079c['id'],'queue_name':_0x486791['name'],'SmsQueueId':_0x486791['id'],'interface':util[_0xfc50('0x60')](_0xfc50('0x61'),_0xfc50('0x62'),_0x4a079c['name']),'penalty':0x0,'paused':_0x4a079c['smsPause'],'createdAt':_0x4a079c[_0xfc50('0x63')],'updatedAt':_0x4a079c[_0xfc50('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfc50('0x29')](respondWithFilteredResult(_0x211d1c,_0x34e7ae))['catch'](handleError(_0x211d1c,null));};exports[_0xfc50('0x64')]=function(_0x580f2f,_0x1c90ca,_0x1f7590){var _0x45b201={};var _0x28aa74={};var _0x11d51c;var _0x51e1ca;return db[_0xfc50('0x32')][_0xfc50('0x58')]({'where':{'id':_0x580f2f[_0xfc50('0x4b')]['id']}})[_0xfc50('0x29')](handleEntityNotFound(_0x1c90ca,null))[_0xfc50('0x29')](function(_0x4b3d16){if(_0x4b3d16){_0x11d51c=_0x4b3d16;_0x28aa74[_0xfc50('0x35')]=_[_0xfc50('0x37')](db[_0xfc50('0x65')][_0xfc50('0x33')]);_0x28aa74[_0xfc50('0x36')]=_['keys'](_0x580f2f[_0xfc50('0x36')]);_0x28aa74[_0xfc50('0x40')]=_[_0xfc50('0x38')](_0x28aa74[_0xfc50('0x35')],_0x28aa74[_0xfc50('0x36')]);_0x45b201[_0xfc50('0x3a')]=_[_0xfc50('0x38')](_0x28aa74[_0xfc50('0x35')],qs[_0xfc50('0x39')](_0x580f2f[_0xfc50('0x36')][_0xfc50('0x39')]));_0x45b201['attributes']=_0x45b201[_0xfc50('0x3a')]['length']?_0x45b201[_0xfc50('0x3a')]:_0x28aa74['model'];_0x45b201[_0xfc50('0x3d')]=qs['sort'](_0x580f2f[_0xfc50('0x36')][_0xfc50('0x3e')]);_0x45b201[_0xfc50('0x3f')]=qs[_0xfc50('0x40')](_[_0xfc50('0x41')](_0x580f2f[_0xfc50('0x36')],_0x28aa74['filters']));if(_0x580f2f[_0xfc50('0x36')][_0xfc50('0x44')]){_0x45b201[_0xfc50('0x3f')]=_[_0xfc50('0x42')](_0x45b201[_0xfc50('0x3f')],{'$or':_['map'](_0x45b201[_0xfc50('0x3a')],function(_0x718a80){var _0x5e5c1e={};_0x5e5c1e[_0x718a80]={'$like':'%'+_0x580f2f[_0xfc50('0x36')][_0xfc50('0x44')]+'%'};return _0x5e5c1e;})});}_0x45b201=_['merge']({},_0x45b201,_0x580f2f[_0xfc50('0x45')]);return _0x11d51c[_0xfc50('0x64')](_0x45b201);}})[_0xfc50('0x29')](function(_0x394230){if(_0x394230){_0x51e1ca=_0x394230[_0xfc50('0x3b')];if(!_0x580f2f[_0xfc50('0x36')][_0xfc50('0x3c')](_0xfc50('0x59'))){_0x45b201[_0xfc50('0x1f')]=qs[_0xfc50('0x1f')](_0x580f2f[_0xfc50('0x36')]['limit']);_0x45b201['offset']=qs[_0xfc50('0x1e')](_0x580f2f['query'][_0xfc50('0x1e')]);}return _0x11d51c['getTeams'](_0x45b201);}})[_0xfc50('0x29')](function(_0x8540f5){if(_0x8540f5){return _0x8540f5?{'count':_0x51e1ca,'rows':_0x8540f5}:null;}})[_0xfc50('0x29')](respondWithResult(_0x1c90ca,null))[_0xfc50('0x49')](handleError(_0x1c90ca,null));};exports[_0xfc50('0x66')]=function(_0x47f09f,_0x140138,_0x1eb01c){var _0x40d0ba=_0x47f09f[_0xfc50('0x4e')][_0xfc50('0x67')];return db[_0xfc50('0x65')][_0xfc50('0x5c')]({'where':{'id':_0x40d0ba},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfc50('0x68'),'attributes':['id',_0xfc50('0x30'),'online',_0xfc50('0x69'),'interface'],'raw':!![]}]})[_0xfc50('0x29')](function(_0x36b01b){if(_0x36b01b){var _0x1c8b14=_['flatMap'](_0x36b01b,function(_0x586a68){var _0x3b8d26=_0x586a68[_0xfc50('0x2a')]({'plain':!![]});return _0x3b8d26['Agents'];});return db[_0xfc50('0x32')][_0xfc50('0x4c')]({'where':{'id':_0x47f09f['params']['id']}})[_0xfc50('0x29')](function(_0x4af3e3){return db[_0xfc50('0x6a')][_0xfc50('0x6b')](function(_0x3fbfbc){return _0x4af3e3[_0xfc50('0x66')](_0x40d0ba,{'transaction':_0x3fbfbc})[_0xfc50('0x29')](function(){return BPromise[_0xfc50('0x6c')](_0x1c8b14,function(_0x596419){return db[_0xfc50('0x5b')][_0xfc50('0x6d')]({'where':{'UserId':_0x596419['id'],'SmsQueueId':_0x47f09f[_0xfc50('0x4b')]['id']},'transaction':_0x3fbfbc});});})['then'](function(){_0x1c8b14[_0xfc50('0x6e')](function(_0xd9fd3d){socket[_0xfc50('0x6f')](_0xfc50('0x70'),{'UserId':_0xd9fd3d['id'],'SmsQueueId':_0x4af3e3['id']});});});});});}})['then'](respondWithStatusCode(_0x140138,null))[_0xfc50('0x49')](handleError(_0x140138,null));};exports[_0xfc50('0x71')]=function(_0x1dead6,_0x424e3f,_0x4b1050){return db[_0xfc50('0x65')][_0xfc50('0x5c')]({'where':{'id':_0x1dead6['query'][_0xfc50('0x67')]},'attributes':['id'],'include':[{'model':db[_0xfc50('0x5d')],'as':_0xfc50('0x68'),'attributes':['id'],'raw':!![]}]})[_0xfc50('0x29')](handleEntityNotFound(_0x424e3f,null))[_0xfc50('0x29')](function(_0x5b5f5a){var _0x55819c=_[_0xfc50('0x31')](_0x5b5f5a,'id');var _0x3b3d36=[];var _0x254272=[];var _0x3fabbd=squel[_0xfc50('0x72')]();_0x3fabbd[_0xfc50('0x73')]('tq.TeamId')[_0xfc50('0x74')]('team_has_sms_queues','tq')[_0xfc50('0x75')]('user_has_teams','ut',_0xfc50('0x76'))[_0xfc50('0x3f')]('SmsQueueId\x20=\x20?',_0x1dead6[_0xfc50('0x4b')]['id']);for(var _0x45f408=0x0;_0x45f408<_0x5b5f5a[_0xfc50('0x3b')];_0x45f408+=0x1){let _0x1d0a86=_0x5b5f5a[_0x45f408];for(var _0x72031=0x0;_0x72031<_0x1d0a86['Agents'][_0xfc50('0x3b')];_0x72031+=0x1){let _0x2128f7=_0x1d0a86[_0xfc50('0x68')][_0x72031];var _0x4136a9=_0x3fabbd[_0xfc50('0x77')]();_0x4136a9['where'](_0xfc50('0x78'),_0x2128f7['id']);_0x254272[_0xfc50('0x79')](db[_0xfc50('0x6a')][_0xfc50('0x36')](_0x4136a9['toString'](),{'type':db['sequelize'][_0xfc50('0x7a')][_0xfc50('0x7b')]})[_0xfc50('0x29')](function(_0x58c5d2){if(_0x58c5d2[_0xfc50('0x3b')]===0x1){return _0x2128f7['id'];}else{var _0x5a8751=_[_0xfc50('0x7c')](_[_0xfc50('0x31')](_0x58c5d2,_0xfc50('0x7d')),function(_0x75f879){return _[_0xfc50('0x7e')](_0x55819c,_0x75f879);});if(_0x5a8751){return _0x2128f7['id'];}}}));}}return BPromise[_0xfc50('0x7f')](_0x254272)['then'](function(_0x13b847){_0x3b3d36=_(_0x3b3d36)[_0xfc50('0x80')](_0x13b847)['compact']()[_0xfc50('0x81')]();return db['SmsQueue'][_0xfc50('0x4c')]({'where':{'id':_0x1dead6[_0xfc50('0x4b')]['id']}})[_0xfc50('0x29')](function(_0x58ac83){return db[_0xfc50('0x6a')][_0xfc50('0x6b')](function(_0x2d559d){return _0x58ac83[_0xfc50('0x71')](_0x1dead6[_0xfc50('0x36')][_0xfc50('0x67')],{'transaction':_0x2d559d})[_0xfc50('0x29')](function(){if(!_[_0xfc50('0x82')](_0x3b3d36)){return _0x58ac83[_0xfc50('0x83')](_0x3b3d36,{'transaction':_0x2d559d});}})[_0xfc50('0x29')](function(){_0x3b3d36[_0xfc50('0x6e')](function(_0x11ccdc){socket[_0xfc50('0x6f')](_0xfc50('0x84'),{'UserId':_0x11ccdc,'SmsQueueId':_0x58ac83['id']});});});});});});})[_0xfc50('0x29')](respondWithStatusCode(_0x424e3f,null))[_0xfc50('0x49')](handleError(_0x424e3f,null));};exports[_0xfc50('0x85')]=function(_0x557ed9,_0x4d4d0c,_0x373081){return db[_0xfc50('0x32')][_0xfc50('0x4c')]({'where':{'id':_0x557ed9[_0xfc50('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4d4d0c,null))[_0xfc50('0x29')](function(_0x497bba){if(_0x497bba){return _0x497bba[_0xfc50('0x85')](_0x557ed9[_0xfc50('0x4e')][_0xfc50('0x67')],_['omit'](_0x557ed9[_0xfc50('0x4e')],['ids','id'])||{})[_0xfc50('0x86')](function(_0x54d8ab){for(var _0x42e47d=0x0;_0x42e47d<_0x557ed9[_0xfc50('0x4e')][_0xfc50('0x67')][_0xfc50('0x3b')];_0x42e47d+=0x1){socket[_0xfc50('0x6f')](_0xfc50('0x70'),{'UserId':Number(_0x557ed9[_0xfc50('0x4e')][_0xfc50('0x67')][_0x42e47d]),'SmsQueueId':Number(_0x557ed9[_0xfc50('0x4b')]['id'])});}return _0x54d8ab;});}})[_0xfc50('0x29')](respondWithResult(_0x4d4d0c,null))[_0xfc50('0x49')](handleError(_0x4d4d0c,null));};exports[_0xfc50('0x83')]=function(_0x49985d,_0x235ec9,_0x3bd70a){return db[_0xfc50('0x32')]['find']({'where':{'id':_0x49985d['params']['id']}})[_0xfc50('0x29')](handleEntityNotFound(_0x235ec9,null))['then'](function(_0xa9b3a7){if(_0xa9b3a7){return _0xa9b3a7[_0xfc50('0x83')](_0x49985d[_0xfc50('0x36')][_0xfc50('0x67')])['then'](function(){if(_[_0xfc50('0x87')](_0x49985d['query'][_0xfc50('0x67')])){for(var _0x3c34f0=0x0;_0x3c34f0<_0x49985d['query']['ids'][_0xfc50('0x3b')];_0x3c34f0+=0x1){socket[_0xfc50('0x6f')](_0xfc50('0x84'),{'UserId':Number(_0x49985d[_0xfc50('0x36')][_0xfc50('0x67')][_0x3c34f0]),'SmsQueueId':Number(_0x49985d[_0xfc50('0x4b')]['id'])});}}else{socket['emit'](_0xfc50('0x84'),{'UserId':Number(_0x49985d['query']['ids']),'SmsQueueId':Number(_0x49985d[_0xfc50('0x4b')]['id'])});}});}})[_0xfc50('0x29')](respondWithStatusCode(_0x235ec9,null))[_0xfc50('0x49')](handleError(_0x235ec9,null));};exports[_0xfc50('0x88')]=function(_0x24a186,_0x908a20,_0x429867){var _0x17a4f3={};var _0x4b0aa4={};var _0x43b853;var _0x27671e;return db[_0xfc50('0x32')][_0xfc50('0x58')]({'where':{'id':_0x24a186[_0xfc50('0x4b')]['id']}})['then'](handleEntityNotFound(_0x908a20,null))[_0xfc50('0x29')](function(_0x156eef){if(_0x156eef){_0x43b853=_0x156eef;_0x4b0aa4[_0xfc50('0x35')]=_['keys'](db[_0xfc50('0x5d')][_0xfc50('0x33')]);_0x4b0aa4['query']=_[_0xfc50('0x37')](_0x24a186[_0xfc50('0x36')]);_0x4b0aa4['filters']=_[_0xfc50('0x38')](_0x4b0aa4['model'],_0x4b0aa4[_0xfc50('0x36')]);_0x17a4f3[_0xfc50('0x3a')]=_[_0xfc50('0x38')](_0x4b0aa4[_0xfc50('0x35')],qs[_0xfc50('0x39')](_0x24a186['query'][_0xfc50('0x39')]));_0x17a4f3[_0xfc50('0x3a')]=_0x17a4f3[_0xfc50('0x3a')][_0xfc50('0x3b')]?_0x17a4f3[_0xfc50('0x3a')]:_0x4b0aa4[_0xfc50('0x35')];_0x17a4f3['order']=qs['sort'](_0x24a186['query'][_0xfc50('0x3e')]);_0x17a4f3[_0xfc50('0x3f')]=qs[_0xfc50('0x40')](_[_0xfc50('0x41')](_0x24a186[_0xfc50('0x36')],_0x4b0aa4[_0xfc50('0x40')]));if(_0x24a186[_0xfc50('0x36')]['filter']){_0x17a4f3[_0xfc50('0x3f')]=_[_0xfc50('0x42')](_0x17a4f3[_0xfc50('0x3f')],{'$or':_[_0xfc50('0x31')](_0x17a4f3[_0xfc50('0x3a')],function(_0x144eed){var _0x2ea26b={};_0x2ea26b[_0x144eed]={'$like':'%'+_0x24a186['query'][_0xfc50('0x44')]+'%'};return _0x2ea26b;})});}_0x17a4f3=_[_0xfc50('0x42')]({},_0x17a4f3,_0x24a186[_0xfc50('0x45')]);return _0x43b853['getAgents'](_0x17a4f3);}})[_0xfc50('0x29')](function(_0x818847){if(_0x818847){_0x27671e=_0x818847['length'];if(!_0x24a186[_0xfc50('0x36')][_0xfc50('0x3c')]('nolimit')){_0x17a4f3['limit']=qs[_0xfc50('0x1f')](_0x24a186['query'][_0xfc50('0x1f')]);_0x17a4f3['offset']=qs[_0xfc50('0x1e')](_0x24a186[_0xfc50('0x36')][_0xfc50('0x1e')]);}return _0x43b853[_0xfc50('0x88')](_0x17a4f3);}})[_0xfc50('0x29')](function(_0x391390){if(_0x391390){return _0x391390?{'count':_0x27671e,'rows':_0x391390}:null;}})[_0xfc50('0x29')](respondWithResult(_0x908a20,null))[_0xfc50('0x49')](handleError(_0x908a20,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 4da8048..87d75fe 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 _0xb79f=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0x323430,_0x3d2b6d){var _0x9eecd1=function(_0xab855a){while(--_0xab855a){_0x323430['push'](_0x323430['shift']());}};_0x9eecd1(++_0x3d2b6d);}(_0xb79f,0x71));var _0xfb79=function(_0x16a101,_0x12caba){_0x16a101=_0x16a101-0x0;var _0x47b258=_0xb79f[_0x16a101];return _0x47b258;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xfb79('0x0'))['db'][_0xfb79('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xfb79('0x2')](0x0);var events={'afterCreate':_0xfb79('0x3'),'afterUpdate':'update','afterDestroy':_0xfb79('0x4')};function emitEvent(_0x5fe7dc){return function(_0x539566,_0x299fef,_0x267b99){SmsQueueEvents['emit'](_0x5fe7dc+':'+_0x539566['id'],_0x539566);SmsQueueEvents[_0xfb79('0x5')](_0x5fe7dc,_0x539566);_0x267b99(null);};}for(var e in events){if(events[_0xfb79('0x6')](e)){var event=events[e];SmsQueue[_0xfb79('0x7')](e,emitEvent(event));}}module[_0xfb79('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x52aa=['update','remove','emit','hook','exports','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x52aa,0x113));var _0xa52a=function(_0x1ccacc,_0x2609cd){_0x1ccacc=_0x1ccacc-0x0;var _0x8c74f7=_0x52aa[_0x1ccacc];return _0x8c74f7;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xa52a('0x0'))['db'][_0xa52a('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xa52a('0x2')](0x0);var events={'afterCreate':_0xa52a('0x3'),'afterUpdate':_0xa52a('0x4'),'afterDestroy':_0xa52a('0x5')};function emitEvent(_0x1145c1){return function(_0x1cab36,_0x18975a,_0x3aaabd){SmsQueueEvents[_0xa52a('0x6')](_0x1145c1+':'+_0x1cab36['id'],_0x1cab36);SmsQueueEvents['emit'](_0x1145c1,_0x1cab36);_0x3aaabd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xa52a('0x7')](e,emitEvent(event));}}module[_0xa52a('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index eaf0d38..5195255 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 _0x8f45=['define','sms_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x8f45,0x18e));var _0x58f4=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x8f45[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x58f4('0x0'));var util=require(_0x58f4('0x1'));var logger=require('../../config/logger')(_0x58f4('0x2'));var moment=require(_0x58f4('0x3'));var BPromise=require(_0x58f4('0x4'));var rp=require(_0x58f4('0x5'));var fs=require('fs');var path=require(_0x58f4('0x6'));var rimraf=require(_0x58f4('0x7'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x58f4('0x8')]=function(_0x22ca96,_0x1fb317){return _0x22ca96[_0x58f4('0x9')]('SmsQueue',attributes,{'tableName':_0x58f4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb299=['../../config/environment','exports','define','SmsQueue','sms_queues','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x19b8f3,_0x244b0a){var _0x4d1156=function(_0x11126b){while(--_0x11126b){_0x19b8f3['push'](_0x19b8f3['shift']());}};_0x4d1156(++_0x244b0a);}(_0xb299,0xa1));var _0x9b29=function(_0x51577a,_0x4b5106){_0x51577a=_0x51577a-0x0;var _0x2b6c04=_0xb299[_0x51577a];return _0x2b6c04;};'use strict';var _=require('lodash');var util=require(_0x9b29('0x0'));var logger=require(_0x9b29('0x1'))(_0x9b29('0x2'));var moment=require(_0x9b29('0x3'));var BPromise=require('bluebird');var rp=require(_0x9b29('0x4'));var fs=require('fs');var path=require(_0x9b29('0x5'));var rimraf=require(_0x9b29('0x6'));var config=require(_0x9b29('0x7'));var attributes=require('./smsQueue.attributes');module[_0x9b29('0x8')]=function(_0xcac75a,_0x1ef687){return _0xcac75a[_0x9b29('0x9')](_0x9b29('0xa'),attributes,{'tableName':_0x9b29('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 8eaa437..8f2d22d 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 _0xdd15=['bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','defaults','redis','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','catch','GetSmsQueue','findAll','raw','options','where','attributes','limit','include','map','model','ShowSmsQueue','SmsQueue','find','lodash','util','moment'];(function(_0x37bf7e,_0x4993f0){var _0x4e7d8c=function(_0x2ed66e){while(--_0x2ed66e){_0x37bf7e['push'](_0x37bf7e['shift']());}};_0x4e7d8c(++_0x4993f0);}(_0xdd15,0x16e));var _0x5dd1=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xdd15[_0x20a558];return _0x53d3f7;};'use strict';var _=require(_0x5dd1('0x0'));var util=require(_0x5dd1('0x1'));var moment=require(_0x5dd1('0x2'));var BPromise=require(_0x5dd1('0x3'));var rs=require(_0x5dd1('0x4'));var fs=require('fs');var Redis=require(_0x5dd1('0x5'));var db=require(_0x5dd1('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5dd1('0x7'));var jayson=require(_0x5dd1('0x8'));var client=jayson['client'][_0x5dd1('0x9')]({'port':0x232a});config['redis']=_[_0x5dd1('0xa')](config[_0x5dd1('0xb')],{'host':_0x5dd1('0xc'),'port':0x18eb});var socket=require(_0x5dd1('0xd'))(new Redis(config['redis']));require(_0x5dd1('0xe'))['register'](socket);function respondWithRpcPromise(_0x4ca8ef,_0x4a9403,_0x208151){return new BPromise(function(_0x15bf9f,_0x396343){return client[_0x5dd1('0xf')](_0x4ca8ef,_0x208151)[_0x5dd1('0x10')](function(_0xe0d478){logger[_0x5dd1('0x11')](_0x5dd1('0x12'),_0x4a9403,_0x5dd1('0x13'));logger[_0x5dd1('0x14')](_0x5dd1('0x15'),_0x4a9403,_0x5dd1('0x13'),JSON[_0x5dd1('0x16')](_0xe0d478));if(_0xe0d478['error']){if(_0xe0d478[_0x5dd1('0x17')][_0x5dd1('0x18')]===0x1f4){logger['error'](_0x5dd1('0x12'),_0x4a9403,_0xe0d478[_0x5dd1('0x17')][_0x5dd1('0x19')]);return _0x396343(_0xe0d478[_0x5dd1('0x17')][_0x5dd1('0x19')]);}logger['error'](_0x5dd1('0x12'),_0x4a9403,_0xe0d478[_0x5dd1('0x17')][_0x5dd1('0x19')]);return _0x15bf9f(_0xe0d478['error'][_0x5dd1('0x19')]);}else{logger['info'](_0x5dd1('0x12'),_0x4a9403,_0x5dd1('0x13'));_0x15bf9f(_0xe0d478[_0x5dd1('0x1a')][_0x5dd1('0x19')]);}})[_0x5dd1('0x1b')](function(_0x1a7d21){logger[_0x5dd1('0x17')](_0x5dd1('0x12'),_0x4a9403,_0x1a7d21);_0x396343(_0x1a7d21);});});}exports[_0x5dd1('0x1c')]=function(_0xbba7b){var _0x4b570b=this;return new Promise(function(_0x1f1bb8,_0x52c1cd){return db['SmsQueue'][_0x5dd1('0x1d')]({'raw':_0xbba7b['options']?_0xbba7b['options'][_0x5dd1('0x1e')]===undefined?!![]:![]:!![],'where':_0xbba7b[_0x5dd1('0x1f')]?_0xbba7b[_0x5dd1('0x1f')][_0x5dd1('0x20')]||null:null,'attributes':_0xbba7b['options']?_0xbba7b[_0x5dd1('0x1f')][_0x5dd1('0x21')]||null:null,'limit':_0xbba7b[_0x5dd1('0x1f')]?_0xbba7b[_0x5dd1('0x1f')][_0x5dd1('0x22')]||null:null,'include':_0xbba7b[_0x5dd1('0x1f')]?_0xbba7b['options'][_0x5dd1('0x23')]?_[_0x5dd1('0x24')](_0xbba7b[_0x5dd1('0x1f')][_0x5dd1('0x23')],function(_0x28ec27){return{'model':db[_0x28ec27[_0x5dd1('0x25')]],'as':_0x28ec27['as'],'attributes':_0x28ec27[_0x5dd1('0x21')],'include':_0x28ec27[_0x5dd1('0x23')]?_[_0x5dd1('0x24')](_0x28ec27[_0x5dd1('0x23')],function(_0x2b37b6){return{'model':db[_0x2b37b6[_0x5dd1('0x25')]],'as':_0x2b37b6['as'],'attributes':_0x2b37b6['attributes'],'include':_0x2b37b6[_0x5dd1('0x23')]?_[_0x5dd1('0x24')](_0x2b37b6[_0x5dd1('0x23')],function(_0x767700){return{'model':db[_0x767700['model']],'as':_0x767700['as'],'attributes':_0x767700[_0x5dd1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5dd1('0x10')](function(_0x51c5ae){logger[_0x5dd1('0x11')]('GetSmsQueue',_0xbba7b);logger[_0x5dd1('0x14')](_0x5dd1('0x1c'),_0xbba7b,JSON[_0x5dd1('0x16')](_0x51c5ae));_0x1f1bb8(_0x51c5ae);})[_0x5dd1('0x1b')](function(_0x4a1f10){logger[_0x5dd1('0x17')](_0x5dd1('0x1c'),_0x4a1f10[_0x5dd1('0x19')],_0xbba7b);_0x52c1cd(_0x4b570b[_0x5dd1('0x17')](0x1f4,_0x4a1f10['message']));});});};exports[_0x5dd1('0x26')]=function(_0x2c5b62){var _0x4f8ca1=this;return new Promise(function(_0x448777,_0x7e6f50){return db[_0x5dd1('0x27')][_0x5dd1('0x28')]({'raw':_0x2c5b62[_0x5dd1('0x1f')]?_0x2c5b62[_0x5dd1('0x1f')][_0x5dd1('0x1e')]===undefined?!![]:![]:!![],'where':_0x2c5b62['options']?_0x2c5b62[_0x5dd1('0x1f')]['where']||null:null,'attributes':_0x2c5b62[_0x5dd1('0x1f')]?_0x2c5b62[_0x5dd1('0x1f')][_0x5dd1('0x21')]||null:null,'include':_0x2c5b62['options']?_0x2c5b62[_0x5dd1('0x1f')][_0x5dd1('0x23')]?_[_0x5dd1('0x24')](_0x2c5b62[_0x5dd1('0x1f')][_0x5dd1('0x23')],function(_0x5de0bf){return{'model':db[_0x5de0bf[_0x5dd1('0x25')]],'as':_0x5de0bf['as'],'attributes':_0x5de0bf[_0x5dd1('0x21')],'include':_0x5de0bf[_0x5dd1('0x23')]?_[_0x5dd1('0x24')](_0x5de0bf[_0x5dd1('0x23')],function(_0x498e8e){return{'model':db[_0x498e8e[_0x5dd1('0x25')]],'as':_0x498e8e['as'],'attributes':_0x498e8e[_0x5dd1('0x21')],'include':_0x498e8e[_0x5dd1('0x23')]?_[_0x5dd1('0x24')](_0x498e8e['include'],function(_0x363507){return{'model':db[_0x363507[_0x5dd1('0x25')]],'as':_0x363507['as'],'attributes':_0x363507[_0x5dd1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5dd1('0x10')](function(_0x4d3f3c){logger[_0x5dd1('0x11')]('ShowSmsQueue',_0x2c5b62);logger['debug'](_0x5dd1('0x26'),_0x2c5b62,JSON['stringify'](_0x4d3f3c));_0x448777(_0x4d3f3c);})[_0x5dd1('0x1b')](function(_0x1285ea){logger[_0x5dd1('0x17')](_0x5dd1('0x26'),_0x1285ea[_0x5dd1('0x19')],_0x2c5b62);_0x7e6f50(_0x4f8ca1[_0x5dd1('0x17')](0x1f4,_0x1285ea['message']));});});}; \ No newline at end of file +var _0x3292=['error','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','include','model','attributes','map','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x3b48b8,_0x20210e){var _0x354209=function(_0xc24a3a){while(--_0xc24a3a){_0x3b48b8['push'](_0x3b48b8['shift']());}};_0x354209(++_0x20210e);}(_0x3292,0x1d2));var _0x2329=function(_0x470e2f,_0x16add3){_0x470e2f=_0x470e2f-0x0;var _0x111e5f=_0x3292[_0x470e2f];return _0x111e5f;};'use strict';var _=require(_0x2329('0x0'));var util=require(_0x2329('0x1'));var moment=require(_0x2329('0x2'));var BPromise=require(_0x2329('0x3'));var rs=require(_0x2329('0x4'));var fs=require('fs');var Redis=require(_0x2329('0x5'));var db=require(_0x2329('0x6'))['db'];var utils=require(_0x2329('0x7'));var logger=require(_0x2329('0x8'))(_0x2329('0x9'));var config=require(_0x2329('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2329('0xb')][_0x2329('0xc')]({'port':0x232a});config[_0x2329('0xd')]=_[_0x2329('0xe')](config[_0x2329('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x2329('0xf'))(new Redis(config[_0x2329('0xd')]));require('./smsQueue.socket')[_0x2329('0x10')](socket);function respondWithRpcPromise(_0x531254,_0x1a7d5c,_0x5a9232){return new BPromise(function(_0x381e7e,_0x5db095){return client[_0x2329('0x11')](_0x531254,_0x5a9232)[_0x2329('0x12')](function(_0x53a777){logger[_0x2329('0x13')](_0x2329('0x14'),_0x1a7d5c,_0x2329('0x15'));logger[_0x2329('0x16')](_0x2329('0x17'),_0x1a7d5c,_0x2329('0x15'),JSON[_0x2329('0x18')](_0x53a777));if(_0x53a777['error']){if(_0x53a777['error'][_0x2329('0x19')]===0x1f4){logger[_0x2329('0x1a')](_0x2329('0x14'),_0x1a7d5c,_0x53a777[_0x2329('0x1a')]['message']);return _0x5db095(_0x53a777[_0x2329('0x1a')][_0x2329('0x1b')]);}logger[_0x2329('0x1a')](_0x2329('0x14'),_0x1a7d5c,_0x53a777[_0x2329('0x1a')]['message']);return _0x381e7e(_0x53a777['error'][_0x2329('0x1b')]);}else{logger[_0x2329('0x13')](_0x2329('0x14'),_0x1a7d5c,_0x2329('0x15'));_0x381e7e(_0x53a777[_0x2329('0x1c')][_0x2329('0x1b')]);}})[_0x2329('0x1d')](function(_0x4c0f86){logger[_0x2329('0x1a')](_0x2329('0x14'),_0x1a7d5c,_0x4c0f86);_0x5db095(_0x4c0f86);});});}exports[_0x2329('0x1e')]=function(_0x49bedd){var _0x6b61d5=this;return new Promise(function(_0x435a39,_0x48d3fd){return db[_0x2329('0x1f')][_0x2329('0x20')]({'raw':_0x49bedd['options']?_0x49bedd[_0x2329('0x21')][_0x2329('0x22')]===undefined?!![]:![]:!![],'where':_0x49bedd[_0x2329('0x21')]?_0x49bedd['options'][_0x2329('0x23')]||null:null,'attributes':_0x49bedd[_0x2329('0x21')]?_0x49bedd[_0x2329('0x21')]['attributes']||null:null,'limit':_0x49bedd[_0x2329('0x21')]?_0x49bedd[_0x2329('0x21')]['limit']||null:null,'include':_0x49bedd[_0x2329('0x21')]?_0x49bedd[_0x2329('0x21')][_0x2329('0x24')]?_['map'](_0x49bedd['options'][_0x2329('0x24')],function(_0x2b0bf7){return{'model':db[_0x2b0bf7[_0x2329('0x25')]],'as':_0x2b0bf7['as'],'attributes':_0x2b0bf7[_0x2329('0x26')],'include':_0x2b0bf7['include']?_[_0x2329('0x27')](_0x2b0bf7['include'],function(_0xcbef98){return{'model':db[_0xcbef98[_0x2329('0x25')]],'as':_0xcbef98['as'],'attributes':_0xcbef98['attributes'],'include':_0xcbef98['include']?_[_0x2329('0x27')](_0xcbef98[_0x2329('0x24')],function(_0x410d96){return{'model':db[_0x410d96[_0x2329('0x25')]],'as':_0x410d96['as'],'attributes':_0x410d96[_0x2329('0x26')]};}):[]};}):[]};}):[]:[]})[_0x2329('0x12')](function(_0x53c5d4){logger['info']('GetSmsQueue',_0x49bedd);logger[_0x2329('0x16')](_0x2329('0x1e'),_0x49bedd,JSON[_0x2329('0x18')](_0x53c5d4));_0x435a39(_0x53c5d4);})[_0x2329('0x1d')](function(_0x5b06c0){logger[_0x2329('0x1a')](_0x2329('0x1e'),_0x5b06c0[_0x2329('0x1b')],_0x49bedd);_0x48d3fd(_0x6b61d5[_0x2329('0x1a')](0x1f4,_0x5b06c0[_0x2329('0x1b')]));});});};exports['ShowSmsQueue']=function(_0x2e2c00){var _0x49ba44=this;return new Promise(function(_0x364359,_0x16437b){return db[_0x2329('0x1f')]['find']({'raw':_0x2e2c00['options']?_0x2e2c00[_0x2329('0x21')][_0x2329('0x22')]===undefined?!![]:![]:!![],'where':_0x2e2c00['options']?_0x2e2c00['options']['where']||null:null,'attributes':_0x2e2c00[_0x2329('0x21')]?_0x2e2c00[_0x2329('0x21')][_0x2329('0x26')]||null:null,'include':_0x2e2c00[_0x2329('0x21')]?_0x2e2c00['options'][_0x2329('0x24')]?_[_0x2329('0x27')](_0x2e2c00['options'][_0x2329('0x24')],function(_0x344f5b){return{'model':db[_0x344f5b[_0x2329('0x25')]],'as':_0x344f5b['as'],'attributes':_0x344f5b[_0x2329('0x26')],'include':_0x344f5b[_0x2329('0x24')]?_[_0x2329('0x27')](_0x344f5b[_0x2329('0x24')],function(_0x473c93){return{'model':db[_0x473c93[_0x2329('0x25')]],'as':_0x473c93['as'],'attributes':_0x473c93['attributes'],'include':_0x473c93[_0x2329('0x24')]?_[_0x2329('0x27')](_0x473c93[_0x2329('0x24')],function(_0x47e402){return{'model':db[_0x47e402[_0x2329('0x25')]],'as':_0x47e402['as'],'attributes':_0x47e402['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ebf1b){logger[_0x2329('0x13')]('ShowSmsQueue',_0x2e2c00);logger[_0x2329('0x16')]('ShowSmsQueue',_0x2e2c00,JSON[_0x2329('0x18')](_0x3ebf1b));_0x364359(_0x3ebf1b);})[_0x2329('0x1d')](function(_0x4b93ef){logger['error'](_0x2329('0x28'),_0x4b93ef[_0x2329('0x1b')],_0x2e2c00);_0x16437b(_0x49ba44[_0x2329('0x1a')](0x1f4,_0x4b93ef[_0x2329('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 59fa745..17e63e1 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 _0x309f=['register','smsQueue:','save','remove','update','emit','removeListener'];(function(_0x33ee29,_0xf68a9d){var _0x560940=function(_0xc7e18a){while(--_0xc7e18a){_0x33ee29['push'](_0x33ee29['shift']());}};_0x560940(++_0xf68a9d);}(_0x309f,0x1ad));var _0xf309=function(_0x11199d,_0x302eb1){_0x11199d=_0x11199d-0x0;var _0x2ea8ee=_0x309f[_0x11199d];return _0x2ea8ee;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xf309('0x0'),_0xf309('0x1'),_0xf309('0x2')];function createListener(_0x23a4fd,_0x3988ad){return function(_0x4b54cc){_0x3988ad[_0xf309('0x3')](_0x23a4fd,_0x4b54cc);};}function removeListener(_0x5f5436,_0x1cb1aa){return function(){SmsQueueEvents[_0xf309('0x4')](_0x5f5436,_0x1cb1aa);};}exports[_0xf309('0x5')]=function(_0x164c79){for(var _0x51f0b0=0x0,_0x1d3694=events['length'];_0x51f0b0<_0x1d3694;_0x51f0b0++){var _0x164d03=events[_0x51f0b0];var _0x52bdb3=createListener(_0xf309('0x6')+_0x164d03,_0x164c79);SmsQueueEvents['on'](_0x164d03,_0x52bdb3);}}; \ No newline at end of file +var _0x9e8f=['removeListener','smsQueue:','./smsQueue.events','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e8f,0x11f));var _0xf9e8=function(_0x5cb605,_0x1f1b3c){_0x5cb605=_0x5cb605-0x0;var _0x1df66a=_0x9e8f[_0x5cb605];return _0x1df66a;};'use strict';var SmsQueueEvents=require(_0xf9e8('0x0'));var events=['save','remove',_0xf9e8('0x1')];function createListener(_0x5e26f9,_0x55dc25){return function(_0xcb481){_0x55dc25[_0xf9e8('0x2')](_0x5e26f9,_0xcb481);};}function removeListener(_0x367326,_0x303e5c){return function(){SmsQueueEvents[_0xf9e8('0x3')](_0x367326,_0x303e5c);};}exports['register']=function(_0x10e7b9){for(var _0x103cb3=0x0,_0x3165c5=events['length'];_0x103cb3<_0x3165c5;_0x103cb3++){var _0x5b4d18=events[_0x103cb3];var _0x450bce=createListener(_0xf9e8('0x4')+_0x5b4d18,_0x10e7b9);SmsQueueEvents['on'](_0x5b4d18,_0x450bce);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index bcd7f34..a2b06dc 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 _0x956a=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','create','destroy','util','path','connect-timeout','express','Router'];(function(_0x4f3c9b,_0x28e078){var _0x84e58a=function(_0x37bf49){while(--_0x37bf49){_0x4f3c9b['push'](_0x4f3c9b['shift']());}};_0x84e58a(++_0x28e078);}(_0x956a,0xb6));var _0xa956=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x956a[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0xa956('0x0'));var path=require(_0xa956('0x1'));var timeout=require(_0xa956('0x2'));var express=require(_0xa956('0x3'));var router=express[_0xa956('0x4')]();var fs_extra=require(_0xa956('0x5'));var auth=require(_0xa956('0x6'));var interaction=require(_0xa956('0x7'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0xa956('0x8')]('/',auth[_0xa956('0x9')](),controller[_0xa956('0xa')]);router['get'](_0xa956('0xb'),auth[_0xa956('0x9')](),controller[_0xa956('0xc')]);router[_0xa956('0x8')](_0xa956('0xd'),auth[_0xa956('0x9')](),controller[_0xa956('0xe')]);router['post']('/',auth[_0xa956('0x9')](),controller[_0xa956('0xf')]);router['put'](_0xa956('0xd'),auth[_0xa956('0x9')](),controller['update']);router['delete'](_0xa956('0xd'),auth[_0xa956('0x9')](),controller[_0xa956('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0463=['show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','describe'];(function(_0x5b6d72,_0x4a4b38){var _0x4979b2=function(_0x559a48){while(--_0x559a48){_0x5b6d72['push'](_0x5b6d72['shift']());}};_0x4979b2(++_0x4a4b38);}(_0x0463,0x144));var _0x3046=function(_0x28ae38,_0x5984bd){_0x28ae38=_0x28ae38-0x0;var _0x498da9=_0x0463[_0x28ae38];return _0x498da9;};'use strict';var multer=require(_0x3046('0x0'));var util=require(_0x3046('0x1'));var path=require(_0x3046('0x2'));var timeout=require(_0x3046('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3046('0x4'));var interaction=require(_0x3046('0x5'));var config=require(_0x3046('0x6'));var controller=require(_0x3046('0x7'));router['get']('/',auth[_0x3046('0x8')](),controller[_0x3046('0x9')]);router[_0x3046('0xa')]('/describe',auth[_0x3046('0x8')](),controller[_0x3046('0xb')]);router[_0x3046('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x3046('0xc')]);router[_0x3046('0xd')]('/',auth['isAuthenticated'](),controller[_0x3046('0xe')]);router[_0x3046('0xf')]('/:id',auth[_0x3046('0x8')](),controller[_0x3046('0x10')]);router[_0x3046('0x11')](_0x3046('0x12'),auth[_0x3046('0x8')](),controller[_0x3046('0x13')]);module[_0x3046('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 84720d7..df0509f 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 _0xf089=['DATE','sequelize','exports','STRING'];(function(_0x340e0c,_0x34ce0f){var _0x4dbdf2=function(_0x5e07a4){while(--_0x5e07a4){_0x340e0c['push'](_0x340e0c['shift']());}};_0x4dbdf2(++_0x34ce0f);}(_0xf089,0x1a9));var _0x9f08=function(_0x435415,_0x43188c){_0x435415=_0x435415-0x0;var _0x206a3d=_0xf089[_0x435415];return _0x206a3d;};'use strict';var moment=require('moment');var Sequelize=require(_0x9f08('0x0'));module[_0x9f08('0x1')]={'uniqueid':{'type':Sequelize[_0x9f08('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9f08('0x2')]},'joinAt':{'type':Sequelize[_0x9f08('0x3')]},'leaveAt':{'type':Sequelize[_0x9f08('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9f08('0x3')]},'reason':{'type':Sequelize[_0x9f08('0x2')]}}; \ No newline at end of file +var _0x2e09=['moment','sequelize','exports','STRING','DATE'];(function(_0x507e36,_0xcec611){var _0x2d2674=function(_0x381db1){while(--_0x381db1){_0x507e36['push'](_0x507e36['shift']());}};_0x2d2674(++_0xcec611);}(_0x2e09,0xc8));var _0x92e0=function(_0x2a858f,_0x57b073){_0x2a858f=_0x2a858f-0x0;var _0x4ca115=_0x2e09[_0x2a858f];return _0x4ca115;};'use strict';var moment=require(_0x92e0('0x0'));var Sequelize=require(_0x92e0('0x1'));module[_0x92e0('0x2')]={'uniqueid':{'type':Sequelize[_0x92e0('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x92e0('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x92e0('0x4')]},'exitAt':{'type':Sequelize[_0x92e0('0x4')]},'reason':{'type':Sequelize[_0x92e0('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 492f813..b631696 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 _0xa81e=['catch','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SmsQueueReport','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','pick','filter','where','merge','VIRTUAL','options','include','findAll','show','rawAttributes'];(function(_0x368018,_0x588c61){var _0x5f34d2=function(_0x5cf67c){while(--_0x5cf67c){_0x368018['push'](_0x368018['shift']());}};_0x5f34d2(++_0x588c61);}(_0xa81e,0x126));var _0xea81=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xa81e[_0x4d613c];return _0x301fe3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea81('0x0'));var zipdir=require(_0xea81('0x1'));var jsonpatch=require(_0xea81('0x2'));var rp=require(_0xea81('0x3'));var moment=require(_0xea81('0x4'));var BPromise=require(_0xea81('0x5'));var Mustache=require(_0xea81('0x6'));var util=require(_0xea81('0x7'));var path=require('path');var sox=require(_0xea81('0x8'));var csv=require(_0xea81('0x9'));var ejs=require(_0xea81('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xea81('0xb'));var crypto=require('crypto');var jsforce=require(_0xea81('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xea81('0x9'));var querystring=require(_0xea81('0xd'));var Papa=require(_0xea81('0xe'));var Redis=require(_0xea81('0xf'));var authService=require(_0xea81('0x10'));var qs=require(_0xea81('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xea81('0x12'));var logger=require(_0xea81('0x13'))(_0xea81('0x14'));var utils=require(_0xea81('0x15'));var config=require(_0xea81('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x104203,_0x4b2f85){_0x4b2f85=_0x4b2f85||0xcc;return function(_0x5b170b){if(_0x5b170b){return _0x104203[_0xea81('0x17')](_0x4b2f85);}return _0x104203[_0xea81('0x18')](_0x4b2f85)[_0xea81('0x19')]();};}function respondWithResult(_0x24b103,_0x4afb17){_0x4afb17=_0x4afb17||0xc8;return function(_0x46a156){if(_0x46a156){return _0x24b103[_0xea81('0x18')](_0x4afb17)[_0xea81('0x1a')](_0x46a156);}};}function respondWithFilteredResult(_0x1cdfb0,_0x374742){return function(_0x221b38){if(_0x221b38){var _0x321a07=typeof _0x374742[_0xea81('0x1b')]==='undefined'&&typeof _0x374742[_0xea81('0x1c')]==='undefined';var _0x3f3f7c=_0x221b38[_0xea81('0x1d')];var _0x5f0233=_0x321a07?0x0:_0x374742[_0xea81('0x1b')];var _0x317eda=_0x321a07?_0x221b38['count']:_0x374742['offset']+_0x374742['limit'];var _0x144b24;if(_0x317eda>=_0x3f3f7c){_0x317eda=_0x3f3f7c;_0x144b24=0xc8;}else{_0x144b24=0xce;}_0x1cdfb0[_0xea81('0x18')](_0x144b24);return _0x1cdfb0[_0xea81('0x1e')](_0xea81('0x1f'),_0x5f0233+'-'+_0x317eda+'/'+_0x3f3f7c)[_0xea81('0x1a')](_0x221b38);}return null;};}function patchUpdates(_0x582405){return function(_0x462f47){try{jsonpatch[_0xea81('0x20')](_0x462f47,_0x582405,!![]);}catch(_0x9c8208){return BPromise[_0xea81('0x21')](_0x9c8208);}return _0x462f47[_0xea81('0x22')]();};}function saveUpdates(_0x52241d,_0x573e53){return function(_0xe10b4e){if(_0xe10b4e){return _0xe10b4e[_0xea81('0x23')](_0x52241d)[_0xea81('0x24')](function(_0xe46128){return _0xe46128;});}return null;};}function removeEntity(_0x27deb7,_0x34d46b){return function(_0xf4d6a1){if(_0xf4d6a1){return _0xf4d6a1[_0xea81('0x25')]()[_0xea81('0x24')](function(){_0x27deb7[_0xea81('0x18')](0xcc)[_0xea81('0x19')]();});}};}function handleEntityNotFound(_0x4df650,_0x591fca){return function(_0x39bece){if(!_0x39bece){_0x4df650['sendStatus'](0x194);}return _0x39bece;};}function handleError(_0x49f5c1,_0xdfe2cd){_0xdfe2cd=_0xdfe2cd||0x1f4;return function(_0x5c5262){logger[_0xea81('0x26')](_0x5c5262['stack']);if(_0x5c5262[_0xea81('0x27')]){delete _0x5c5262[_0xea81('0x27')];}_0x49f5c1['status'](_0xdfe2cd)[_0xea81('0x28')](_0x5c5262);};}exports[_0xea81('0x29')]=function(_0x81a341,_0x492320){var _0x17cd23={},_0x900c0a={},_0x33a722={'count':0x0,'rows':[]};var _0x4896d6=_[_0xea81('0x2a')](db[_0xea81('0x2b')]['rawAttributes'],function(_0x5ad01b){return{'name':_0x5ad01b['fieldName'],'type':_0x5ad01b[_0xea81('0x2c')][_0xea81('0x2d')]};});_0x900c0a[_0xea81('0x2e')]=_[_0xea81('0x2a')](_0x4896d6,'name');_0x900c0a[_0xea81('0x2f')]=_[_0xea81('0x30')](_0x81a341['query']);_0x900c0a[_0xea81('0x31')]=_[_0xea81('0x32')](_0x900c0a['model'],_0x900c0a[_0xea81('0x2f')]);_0x17cd23['attributes']=_[_0xea81('0x32')](_0x900c0a[_0xea81('0x2e')],qs['fields'](_0x81a341['query'][_0xea81('0x33')]));_0x17cd23[_0xea81('0x34')]=_0x17cd23[_0xea81('0x34')][_0xea81('0x35')]?_0x17cd23[_0xea81('0x34')]:_0x900c0a[_0xea81('0x2e')];if(!_0x81a341['query']['hasOwnProperty'](_0xea81('0x36'))){_0x17cd23[_0xea81('0x1c')]=qs['limit'](_0x81a341['query'][_0xea81('0x1c')]);_0x17cd23[_0xea81('0x1b')]=qs['offset'](_0x81a341['query'][_0xea81('0x1b')]);}_0x17cd23[_0xea81('0x37')]=qs['sort'](_0x81a341['query']['sort']);_0x17cd23['where']=qs[_0xea81('0x31')](_[_0xea81('0x38')](_0x81a341[_0xea81('0x2f')],_0x900c0a[_0xea81('0x31')]),_0x4896d6);if(_0x81a341[_0xea81('0x2f')][_0xea81('0x39')]){_0x17cd23[_0xea81('0x3a')]=_[_0xea81('0x3b')](_0x17cd23[_0xea81('0x3a')],{'$or':_[_0xea81('0x2a')](_0x4896d6,function(_0x59c118){if(_0x59c118['type']!==_0xea81('0x3c')){var _0x264e77={};_0x264e77[_0x59c118[_0xea81('0x27')]]={'$like':'%'+_0x81a341['query'][_0xea81('0x39')]+'%'};return _0x264e77;}})});}_0x17cd23=_['merge']({},_0x17cd23,_0x81a341[_0xea81('0x3d')]);var _0x42ca3c={'where':_0x17cd23[_0xea81('0x3a')]};return db['SmsQueueReport'][_0xea81('0x1d')](_0x42ca3c)[_0xea81('0x24')](function(_0x1c7672){_0x33a722[_0xea81('0x1d')]=_0x1c7672;if(_0x81a341[_0xea81('0x2f')]['includeAll']){_0x17cd23[_0xea81('0x3e')]=[{'all':!![]}];}return db[_0xea81('0x2b')][_0xea81('0x3f')](_0x17cd23);})['then'](function(_0x4e71cf){_0x33a722['rows']=_0x4e71cf;return _0x33a722;})['then'](respondWithFilteredResult(_0x492320,_0x17cd23))['catch'](handleError(_0x492320,null));};exports[_0xea81('0x40')]=function(_0x3b5f00,_0x540f7e){var _0xb42122={'raw':!![],'where':{'id':_0x3b5f00['params']['id']}},_0x27de89={};_0x27de89['model']=_[_0xea81('0x30')](db[_0xea81('0x2b')][_0xea81('0x41')]);_0x27de89[_0xea81('0x2f')]=_[_0xea81('0x30')](_0x3b5f00[_0xea81('0x2f')]);_0x27de89[_0xea81('0x31')]=_['intersection'](_0x27de89['model'],_0x27de89[_0xea81('0x2f')]);_0xb42122[_0xea81('0x34')]=_[_0xea81('0x32')](_0x27de89[_0xea81('0x2e')],qs[_0xea81('0x33')](_0x3b5f00[_0xea81('0x2f')][_0xea81('0x33')]));_0xb42122[_0xea81('0x34')]=_0xb42122['attributes']['length']?_0xb42122['attributes']:_0x27de89[_0xea81('0x2e')];if(_0x3b5f00[_0xea81('0x2f')]['includeAll']){_0xb42122[_0xea81('0x3e')]=[{'all':!![]}];}_0xb42122=_['merge']({},_0xb42122,_0x3b5f00[_0xea81('0x3d')]);return db[_0xea81('0x2b')]['find'](_0xb42122)[_0xea81('0x24')](handleEntityNotFound(_0x540f7e,null))[_0xea81('0x24')](respondWithResult(_0x540f7e,null))[_0xea81('0x42')](handleError(_0x540f7e,null));};exports[_0xea81('0x43')]=function(_0x1b4cbd,_0x1c2d00){return db[_0xea81('0x2b')][_0xea81('0x43')](_0x1b4cbd['body'],{})[_0xea81('0x24')](respondWithResult(_0x1c2d00,0xc9))[_0xea81('0x42')](handleError(_0x1c2d00,null));};exports['update']=function(_0xe393ff,_0x4fdd50){if(_0xe393ff[_0xea81('0x44')]['id']){delete _0xe393ff['body']['id'];}return db[_0xea81('0x2b')][_0xea81('0x45')]({'where':{'id':_0xe393ff[_0xea81('0x46')]['id']}})[_0xea81('0x24')](handleEntityNotFound(_0x4fdd50,null))[_0xea81('0x24')](saveUpdates(_0xe393ff['body'],null))[_0xea81('0x24')](respondWithResult(_0x4fdd50,null))[_0xea81('0x42')](handleError(_0x4fdd50,null));};exports['destroy']=function(_0x5043ed,_0x243063){return db[_0xea81('0x2b')][_0xea81('0x45')]({'where':{'id':_0x5043ed[_0xea81('0x46')]['id']}})[_0xea81('0x24')](handleEntityNotFound(_0x243063,null))[_0xea81('0x24')](removeEntity(_0x243063,null))[_0xea81('0x42')](handleError(_0x243063,null));};exports[_0xea81('0x47')]=function(_0x5b21ff,_0x46783d){return db[_0xea81('0x2b')][_0xea81('0x47')]()[_0xea81('0x24')](respondWithResult(_0x46783d,null))[_0xea81('0x42')](handleError(_0x46783d,null));}; \ No newline at end of file +var _0x3746=['limit','count','offset','Content-Range','json','reject','update','destroy','then','error','name','send','map','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','options','SmsQueueReport','include','findAll','rows','catch','show','includeAll','merge','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x3746,0x1e2));var _0x6374=function(_0x325d30,_0x259f5d){_0x325d30=_0x325d30-0x0;var _0x39ddeb=_0x3746[_0x325d30];return _0x39ddeb;};'use strict';var emlformat=require(_0x6374('0x0'));var rimraf=require(_0x6374('0x1'));var zipdir=require(_0x6374('0x2'));var jsonpatch=require(_0x6374('0x3'));var rp=require('request-promise');var moment=require(_0x6374('0x4'));var BPromise=require(_0x6374('0x5'));var Mustache=require('mustache');var util=require(_0x6374('0x6'));var path=require(_0x6374('0x7'));var sox=require(_0x6374('0x8'));var csv=require(_0x6374('0x9'));var ejs=require(_0x6374('0xa'));var fs=require('fs');var fs_extra=require(_0x6374('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6374('0xc'));var jsforce=require(_0x6374('0xd'));var deskjs=require(_0x6374('0xe'));var toCsv=require(_0x6374('0x9'));var querystring=require('querystring');var Papa=require(_0x6374('0xf'));var Redis=require(_0x6374('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6374('0x11'));var as=require(_0x6374('0x12'));var hardwareService=require(_0x6374('0x13'));var logger=require(_0x6374('0x14'))('api');var utils=require(_0x6374('0x15'));var config=require(_0x6374('0x16'));var licenseUtil=require(_0x6374('0x17'));var db=require(_0x6374('0x18'))['db'];function respondWithStatusCode(_0x598f1e,_0x22499e){_0x22499e=_0x22499e||0xcc;return function(_0x152232){if(_0x152232){return _0x598f1e[_0x6374('0x19')](_0x22499e);}return _0x598f1e['status'](_0x22499e)[_0x6374('0x1a')]();};}function respondWithResult(_0x205e74,_0xbc0aa4){_0xbc0aa4=_0xbc0aa4||0xc8;return function(_0x53e7b3){if(_0x53e7b3){return _0x205e74[_0x6374('0x1b')](_0xbc0aa4)['json'](_0x53e7b3);}};}function respondWithFilteredResult(_0x297bf5,_0xcf4c4e){return function(_0x5ed36b){if(_0x5ed36b){var _0x275510=typeof _0xcf4c4e['offset']===_0x6374('0x1c')&&typeof _0xcf4c4e[_0x6374('0x1d')]==='undefined';var _0x651ef2=_0x5ed36b[_0x6374('0x1e')];var _0x34132d=_0x275510?0x0:_0xcf4c4e[_0x6374('0x1f')];var _0x5e9bbb=_0x275510?_0x5ed36b['count']:_0xcf4c4e[_0x6374('0x1f')]+_0xcf4c4e[_0x6374('0x1d')];var _0x2aabdc;if(_0x5e9bbb>=_0x651ef2){_0x5e9bbb=_0x651ef2;_0x2aabdc=0xc8;}else{_0x2aabdc=0xce;}_0x297bf5[_0x6374('0x1b')](_0x2aabdc);return _0x297bf5['set'](_0x6374('0x20'),_0x34132d+'-'+_0x5e9bbb+'/'+_0x651ef2)[_0x6374('0x21')](_0x5ed36b);}return null;};}function patchUpdates(_0x3862c8){return function(_0x377579){try{jsonpatch['apply'](_0x377579,_0x3862c8,!![]);}catch(_0x882a25){return BPromise[_0x6374('0x22')](_0x882a25);}return _0x377579['save']();};}function saveUpdates(_0x2c6926,_0x1037e0){return function(_0x208b0a){if(_0x208b0a){return _0x208b0a[_0x6374('0x23')](_0x2c6926)['then'](function(_0x2c8cdc){return _0x2c8cdc;});}return null;};}function removeEntity(_0x1da248,_0x4869ee){return function(_0x372cc4){if(_0x372cc4){return _0x372cc4[_0x6374('0x24')]()[_0x6374('0x25')](function(){_0x1da248[_0x6374('0x1b')](0xcc)[_0x6374('0x1a')]();});}};}function handleEntityNotFound(_0x2816e2,_0x43aa53){return function(_0x41577b){if(!_0x41577b){_0x2816e2[_0x6374('0x19')](0x194);}return _0x41577b;};}function handleError(_0x4e186f,_0x47c156){_0x47c156=_0x47c156||0x1f4;return function(_0x34f33f){logger[_0x6374('0x26')](_0x34f33f['stack']);if(_0x34f33f[_0x6374('0x27')]){delete _0x34f33f[_0x6374('0x27')];}_0x4e186f['status'](_0x47c156)[_0x6374('0x28')](_0x34f33f);};}exports['index']=function(_0x1d1b25,_0x3e1eb3){var _0x4a8db0={},_0x4887aa={},_0x32f975={'count':0x0,'rows':[]};var _0x141a8a=_[_0x6374('0x29')](db['SmsQueueReport']['rawAttributes'],function(_0x47a92c){return{'name':_0x47a92c['fieldName'],'type':_0x47a92c[_0x6374('0x2a')][_0x6374('0x2b')]};});_0x4887aa[_0x6374('0x2c')]=_[_0x6374('0x29')](_0x141a8a,_0x6374('0x27'));_0x4887aa[_0x6374('0x2d')]=_[_0x6374('0x2e')](_0x1d1b25[_0x6374('0x2d')]);_0x4887aa['filters']=_[_0x6374('0x2f')](_0x4887aa[_0x6374('0x2c')],_0x4887aa[_0x6374('0x2d')]);_0x4a8db0['attributes']=_[_0x6374('0x2f')](_0x4887aa[_0x6374('0x2c')],qs['fields'](_0x1d1b25[_0x6374('0x2d')][_0x6374('0x30')]));_0x4a8db0[_0x6374('0x31')]=_0x4a8db0['attributes'][_0x6374('0x32')]?_0x4a8db0[_0x6374('0x31')]:_0x4887aa[_0x6374('0x2c')];if(!_0x1d1b25[_0x6374('0x2d')][_0x6374('0x33')](_0x6374('0x34'))){_0x4a8db0['limit']=qs[_0x6374('0x1d')](_0x1d1b25[_0x6374('0x2d')][_0x6374('0x1d')]);_0x4a8db0[_0x6374('0x1f')]=qs['offset'](_0x1d1b25[_0x6374('0x2d')][_0x6374('0x1f')]);}_0x4a8db0['order']=qs[_0x6374('0x35')](_0x1d1b25[_0x6374('0x2d')][_0x6374('0x35')]);_0x4a8db0[_0x6374('0x36')]=qs['filters'](_[_0x6374('0x37')](_0x1d1b25['query'],_0x4887aa[_0x6374('0x38')]),_0x141a8a);if(_0x1d1b25[_0x6374('0x2d')][_0x6374('0x39')]){_0x4a8db0[_0x6374('0x36')]=_['merge'](_0x4a8db0[_0x6374('0x36')],{'$or':_[_0x6374('0x29')](_0x141a8a,function(_0x80b2b){if(_0x80b2b[_0x6374('0x2a')]!==_0x6374('0x3a')){var _0x4a8bbf={};_0x4a8bbf[_0x80b2b[_0x6374('0x27')]]={'$like':'%'+_0x1d1b25[_0x6374('0x2d')][_0x6374('0x39')]+'%'};return _0x4a8bbf;}})});}_0x4a8db0=_['merge']({},_0x4a8db0,_0x1d1b25[_0x6374('0x3b')]);var _0xcd718b={'where':_0x4a8db0[_0x6374('0x36')]};return db[_0x6374('0x3c')][_0x6374('0x1e')](_0xcd718b)[_0x6374('0x25')](function(_0x42ce25){_0x32f975['count']=_0x42ce25;if(_0x1d1b25[_0x6374('0x2d')]['includeAll']){_0x4a8db0[_0x6374('0x3d')]=[{'all':!![]}];}return db[_0x6374('0x3c')][_0x6374('0x3e')](_0x4a8db0);})['then'](function(_0x14b2b7){_0x32f975[_0x6374('0x3f')]=_0x14b2b7;return _0x32f975;})[_0x6374('0x25')](respondWithFilteredResult(_0x3e1eb3,_0x4a8db0))[_0x6374('0x40')](handleError(_0x3e1eb3,null));};exports[_0x6374('0x41')]=function(_0x5b99b2,_0x402669){var _0x6aa58f={'raw':!![],'where':{'id':_0x5b99b2['params']['id']}},_0x58313c={};_0x58313c[_0x6374('0x2c')]=_['keys'](db['SmsQueueReport']['rawAttributes']);_0x58313c['query']=_[_0x6374('0x2e')](_0x5b99b2[_0x6374('0x2d')]);_0x58313c[_0x6374('0x38')]=_[_0x6374('0x2f')](_0x58313c['model'],_0x58313c[_0x6374('0x2d')]);_0x6aa58f[_0x6374('0x31')]=_['intersection'](_0x58313c[_0x6374('0x2c')],qs[_0x6374('0x30')](_0x5b99b2[_0x6374('0x2d')][_0x6374('0x30')]));_0x6aa58f['attributes']=_0x6aa58f[_0x6374('0x31')][_0x6374('0x32')]?_0x6aa58f[_0x6374('0x31')]:_0x58313c[_0x6374('0x2c')];if(_0x5b99b2[_0x6374('0x2d')][_0x6374('0x42')]){_0x6aa58f[_0x6374('0x3d')]=[{'all':!![]}];}_0x6aa58f=_[_0x6374('0x43')]({},_0x6aa58f,_0x5b99b2[_0x6374('0x3b')]);return db[_0x6374('0x3c')][_0x6374('0x44')](_0x6aa58f)[_0x6374('0x25')](handleEntityNotFound(_0x402669,null))[_0x6374('0x25')](respondWithResult(_0x402669,null))[_0x6374('0x40')](handleError(_0x402669,null));};exports[_0x6374('0x45')]=function(_0x2a062b,_0x72dddd){return db[_0x6374('0x3c')][_0x6374('0x45')](_0x2a062b[_0x6374('0x46')],{})[_0x6374('0x25')](respondWithResult(_0x72dddd,0xc9))['catch'](handleError(_0x72dddd,null));};exports[_0x6374('0x23')]=function(_0x18f3d9,_0x532ce6){if(_0x18f3d9[_0x6374('0x46')]['id']){delete _0x18f3d9['body']['id'];}return db['SmsQueueReport'][_0x6374('0x44')]({'where':{'id':_0x18f3d9[_0x6374('0x47')]['id']}})['then'](handleEntityNotFound(_0x532ce6,null))[_0x6374('0x25')](saveUpdates(_0x18f3d9[_0x6374('0x46')],null))['then'](respondWithResult(_0x532ce6,null))['catch'](handleError(_0x532ce6,null));};exports[_0x6374('0x24')]=function(_0x52c82d,_0x3620a6){return db[_0x6374('0x3c')]['find']({'where':{'id':_0x52c82d[_0x6374('0x47')]['id']}})[_0x6374('0x25')](handleEntityNotFound(_0x3620a6,null))[_0x6374('0x25')](removeEntity(_0x3620a6,null))[_0x6374('0x40')](handleError(_0x3620a6,null));};exports['describe']=function(_0x291a95,_0x2d1da7){return db[_0x6374('0x3c')][_0x6374('0x48')]()[_0x6374('0x25')](respondWithResult(_0x2d1da7,null))['catch'](handleError(_0x2d1da7,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index c059788..ec85ed0 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(_0x1af1b7,_0x336efa){var _0x4ad867=function(_0x328b37){while(--_0x328b37){_0x1af1b7['push'](_0x1af1b7['shift']());}};_0x4ad867(++_0x336efa);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb7e7[_0x4ea69d];return _0x5318e0;};'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 _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 9d16758..bf5c514 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 _0xd9ba=['request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','options','CreateSmsQueueReport','UpdateSmsQueueReport','update','raw','where','attributes','limit','util','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','SmsQueueReport,\x20%s,\x20%s'];(function(_0x75a922,_0x1e63cc){var _0x31e7ce=function(_0x18d7b6){while(--_0x18d7b6){_0x75a922['push'](_0x75a922['shift']());}};_0x31e7ce(++_0x1e63cc);}(_0xd9ba,0x117));var _0xad9b=function(_0x267b21,_0x59242b){_0x267b21=_0x267b21-0x0;var _0x2dd40a=_0xd9ba[_0x267b21];return _0x2dd40a;};'use strict';var _=require('lodash');var util=require(_0xad9b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xad9b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad9b('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xad9b('0x3'))(_0xad9b('0x4'));var config=require('../../config/environment');var jayson=require(_0xad9b('0x5'));var client=jayson[_0xad9b('0x6')][_0xad9b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3c3273,_0x40771f,_0xa301a3){return new BPromise(function(_0x47497a,_0x3912ae){return client['request'](_0x3c3273,_0xa301a3)[_0xad9b('0x8')](function(_0x537d3c){logger[_0xad9b('0x9')](_0xad9b('0xa'),_0x40771f,_0xad9b('0xb'));logger[_0xad9b('0xc')](_0xad9b('0xd'),_0x40771f,_0xad9b('0xb'),JSON[_0xad9b('0xe')](_0x537d3c));if(_0x537d3c[_0xad9b('0xf')]){if(_0x537d3c[_0xad9b('0xf')][_0xad9b('0x10')]===0x1f4){logger[_0xad9b('0xf')](_0xad9b('0xa'),_0x40771f,_0x537d3c['error']['message']);return _0x3912ae(_0x537d3c[_0xad9b('0xf')][_0xad9b('0x11')]);}logger[_0xad9b('0xf')](_0xad9b('0xa'),_0x40771f,_0x537d3c['error'][_0xad9b('0x11')]);return _0x47497a(_0x537d3c[_0xad9b('0xf')][_0xad9b('0x11')]);}else{logger[_0xad9b('0x9')](_0xad9b('0xa'),_0x40771f,_0xad9b('0xb'));_0x47497a(_0x537d3c[_0xad9b('0x12')][_0xad9b('0x11')]);}})[_0xad9b('0x13')](function(_0x123c2d){logger[_0xad9b('0xf')](_0xad9b('0xa'),_0x40771f,_0x123c2d);_0x3912ae(_0x123c2d);});});}exports['CreateSmsQueueReport']=function(_0x3da8c2){var _0x4e67eb=this;return new Promise(function(_0xcd161,_0x53b640){return db['SmsQueueReport'][_0xad9b('0x14')](_0x3da8c2['body'],{'raw':_0x3da8c2[_0xad9b('0x15')]?_0x3da8c2[_0xad9b('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5c002c){logger[_0xad9b('0x9')](_0xad9b('0x16'),_0x3da8c2);logger[_0xad9b('0xc')](_0xad9b('0x16'),_0x3da8c2,JSON[_0xad9b('0xe')](_0x5c002c));_0xcd161(_0x5c002c);})[_0xad9b('0x13')](function(_0x32eaca){logger[_0xad9b('0xf')](_0xad9b('0x16'),_0x32eaca[_0xad9b('0x11')],_0x3da8c2);_0x53b640(_0x4e67eb[_0xad9b('0xf')](0x1f4,_0x32eaca[_0xad9b('0x11')]));});});};exports[_0xad9b('0x17')]=function(_0xb5fb26){var _0x18e7ca=this;return new Promise(function(_0x368997,_0x292bd3){return db['SmsQueueReport'][_0xad9b('0x18')](_0xb5fb26['body'],{'raw':_0xb5fb26[_0xad9b('0x15')]?_0xb5fb26[_0xad9b('0x15')][_0xad9b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb5fb26[_0xad9b('0x15')]?_0xb5fb26['options'][_0xad9b('0x1a')]||null:null,'attributes':_0xb5fb26[_0xad9b('0x15')]?_0xb5fb26['options'][_0xad9b('0x1b')]||null:null,'limit':_0xb5fb26[_0xad9b('0x15')]?_0xb5fb26[_0xad9b('0x15')][_0xad9b('0x1c')]||null:null})[_0xad9b('0x8')](function(_0x27c586){logger[_0xad9b('0x9')](_0xad9b('0x17'),_0xb5fb26);logger[_0xad9b('0xc')]('UpdateSmsQueueReport',_0xb5fb26,JSON[_0xad9b('0xe')](_0x27c586));_0x368997(_0x27c586);})[_0xad9b('0x13')](function(_0x178a5d){logger['error'](_0xad9b('0x17'),_0x178a5d[_0xad9b('0x11')],_0xb5fb26);_0x292bd3(_0x18e7ca[_0xad9b('0xf')](0x1f4,_0x178a5d[_0xad9b('0x11')]));});});}; \ No newline at end of file +var _0xc703=['info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','update','where','attributes','limit','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x24c55d,_0x35e9f0){var _0x3776ba=function(_0x45c5e0){while(--_0x45c5e0){_0x24c55d['push'](_0x24c55d['shift']());}};_0x3776ba(++_0x35e9f0);}(_0xc703,0x18e));var _0x3c70=function(_0x531722,_0x161aa9){_0x531722=_0x531722-0x0;var _0x3f1769=_0xc703[_0x531722];return _0x3f1769;};'use strict';var _=require('lodash');var util=require(_0x3c70('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3c70('0x1'));var fs=require('fs');var Redis=require(_0x3c70('0x2'));var db=require(_0x3c70('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3c70('0x4'))('rpc');var config=require(_0x3c70('0x5'));var jayson=require(_0x3c70('0x6'));var client=jayson['client'][_0x3c70('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ee9fc,_0x426c2d,_0x200d11){return new BPromise(function(_0x121c56,_0x323b90){return client[_0x3c70('0x8')](_0x4ee9fc,_0x200d11)[_0x3c70('0x9')](function(_0x97f256){logger['info'](_0x3c70('0xa'),_0x426c2d,_0x3c70('0xb'));logger[_0x3c70('0xc')](_0x3c70('0xd'),_0x426c2d,_0x3c70('0xb'),JSON[_0x3c70('0xe')](_0x97f256));if(_0x97f256[_0x3c70('0xf')]){if(_0x97f256['error'][_0x3c70('0x10')]===0x1f4){logger[_0x3c70('0xf')](_0x3c70('0xa'),_0x426c2d,_0x97f256[_0x3c70('0xf')][_0x3c70('0x11')]);return _0x323b90(_0x97f256['error'][_0x3c70('0x11')]);}logger[_0x3c70('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x426c2d,_0x97f256[_0x3c70('0xf')]['message']);return _0x121c56(_0x97f256[_0x3c70('0xf')][_0x3c70('0x11')]);}else{logger[_0x3c70('0x12')](_0x3c70('0xa'),_0x426c2d,_0x3c70('0xb'));_0x121c56(_0x97f256[_0x3c70('0x13')][_0x3c70('0x11')]);}})[_0x3c70('0x14')](function(_0x356fea){logger[_0x3c70('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x426c2d,_0x356fea);_0x323b90(_0x356fea);});});}exports[_0x3c70('0x15')]=function(_0x5a7d1b){var _0x4cae82=this;return new Promise(function(_0x4791ae,_0x426c08){return db[_0x3c70('0x16')][_0x3c70('0x17')](_0x5a7d1b[_0x3c70('0x18')],{'raw':_0x5a7d1b[_0x3c70('0x19')]?_0x5a7d1b[_0x3c70('0x19')][_0x3c70('0x1a')]===undefined?!![]:![]:!![]})[_0x3c70('0x9')](function(_0x9ce508){logger[_0x3c70('0x12')](_0x3c70('0x15'),_0x5a7d1b);logger[_0x3c70('0xc')](_0x3c70('0x15'),_0x5a7d1b,JSON['stringify'](_0x9ce508));_0x4791ae(_0x9ce508);})[_0x3c70('0x14')](function(_0x3ff857){logger[_0x3c70('0xf')](_0x3c70('0x15'),_0x3ff857['message'],_0x5a7d1b);_0x426c08(_0x4cae82[_0x3c70('0xf')](0x1f4,_0x3ff857[_0x3c70('0x11')]));});});};exports[_0x3c70('0x1b')]=function(_0x22712e){var _0x260a7f=this;return new Promise(function(_0x22076c,_0x3cc338){return db[_0x3c70('0x16')][_0x3c70('0x1c')](_0x22712e[_0x3c70('0x18')],{'raw':_0x22712e['options']?_0x22712e[_0x3c70('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22712e[_0x3c70('0x19')]?_0x22712e['options'][_0x3c70('0x1d')]||null:null,'attributes':_0x22712e['options']?_0x22712e[_0x3c70('0x19')][_0x3c70('0x1e')]||null:null,'limit':_0x22712e['options']?_0x22712e[_0x3c70('0x19')][_0x3c70('0x1f')]||null:null})['then'](function(_0x3a608d){logger[_0x3c70('0x12')](_0x3c70('0x1b'),_0x22712e);logger[_0x3c70('0xc')](_0x3c70('0x1b'),_0x22712e,JSON['stringify'](_0x3a608d));_0x22076c(_0x3a608d);})[_0x3c70('0x14')](function(_0x5d4250){logger[_0x3c70('0xf')](_0x3c70('0x1b'),_0x5d4250[_0x3c70('0x11')],_0x22712e);_0x3cc338(_0x260a7f[_0x3c70('0xf')](0x1f4,_0x5d4250[_0x3c70('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 5dba14c..3d50049 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 _0xe198=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe198,0x6f));var _0x8e19=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xe198[_0x4fde08];return _0x12e725;};'use strict';var multer=require(_0x8e19('0x0'));var util=require(_0x8e19('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8e19('0x2'));var router=express[_0x8e19('0x3')]();var fs_extra=require(_0x8e19('0x4'));var auth=require(_0x8e19('0x5'));var interaction=require(_0x8e19('0x6'));var config=require('../../config/environment');var controller=require(_0x8e19('0x7'));router[_0x8e19('0x8')]('/',auth[_0x8e19('0x9')](),controller[_0x8e19('0xa')]);router[_0x8e19('0x8')](_0x8e19('0xb'),auth[_0x8e19('0x9')](),controller[_0x8e19('0xc')]);router[_0x8e19('0x8')](_0x8e19('0xd'),auth[_0x8e19('0x9')](),controller[_0x8e19('0xe')]);router[_0x8e19('0xf')]('/',auth['isAuthenticated'](),controller[_0x8e19('0x10')]);router[_0x8e19('0x11')](_0x8e19('0xd'),auth[_0x8e19('0x9')](),controller[_0x8e19('0x12')]);router[_0x8e19('0x13')](_0x8e19('0xd'),auth[_0x8e19('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x29d4=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','destroy','exports','multer','path','connect-timeout'];(function(_0xd0eff6,_0x11ead8){var _0x1a9019=function(_0x29b66c){while(--_0x29b66c){_0xd0eff6['push'](_0xd0eff6['shift']());}};_0x1a9019(++_0x11ead8);}(_0x29d4,0x1a1));var _0x429d=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x29d4[_0x138f59];return _0x3d114d;};'use strict';var multer=require(_0x429d('0x0'));var util=require('util');var path=require(_0x429d('0x1'));var timeout=require(_0x429d('0x2'));var express=require(_0x429d('0x3'));var router=express[_0x429d('0x4')]();var fs_extra=require(_0x429d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var controller=require(_0x429d('0x8'));router[_0x429d('0x9')]('/',auth[_0x429d('0xa')](),controller[_0x429d('0xb')]);router[_0x429d('0x9')](_0x429d('0xc'),auth['isAuthenticated'](),controller[_0x429d('0xd')]);router['get'](_0x429d('0xe'),auth[_0x429d('0xa')](),controller[_0x429d('0xf')]);router['post']('/',auth[_0x429d('0xa')](),controller[_0x429d('0x10')]);router['put'](_0x429d('0xe'),auth[_0x429d('0xa')](),controller[_0x429d('0x11')]);router['delete'](_0x429d('0xe'),auth[_0x429d('0xa')](),controller[_0x429d('0x12')]);module[_0x429d('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index aaa9408..251e069 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x230a27,_0x17e643){var _0x14079c=function(_0x205963){while(--_0x205963){_0x230a27['push'](_0x230a27['shift']());}};_0x14079c(++_0x17e643);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x582d0b,_0x28f609){_0x582d0b=_0x582d0b-0x0;var _0x2e93e1=_0xcb91[_0x582d0b];return _0x2e93e1;};'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 +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x1781de,_0x5c4b38){var _0x48d7fc=function(_0x7becb5){while(--_0x7becb5){_0x1781de['push'](_0x1781de['shift']());}};_0x48d7fc(++_0x5c4b38);}(_0x54ef,0x112));var _0xf54e=function(_0x13d4ec,_0x36dd23){_0x13d4ec=_0x13d4ec-0x0;var _0x2bad22=_0x54ef[_0x13d4ec];return _0x2bad22;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index e9d9033..5fe06d3 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 _0x1901=['save','update','then','end','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','SmsTransferReport','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','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','offset','undefined','count','Content-Range','apply'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0x1901,0xc3));var _0x1190=function(_0x49c1f2,_0x468abb){_0x49c1f2=_0x49c1f2-0x0;var _0x2058c9=_0x1901[_0x49c1f2];return _0x2058c9;};'use strict';var emlformat=require(_0x1190('0x0'));var rimraf=require(_0x1190('0x1'));var zipdir=require(_0x1190('0x2'));var jsonpatch=require(_0x1190('0x3'));var rp=require('request-promise');var moment=require(_0x1190('0x4'));var BPromise=require(_0x1190('0x5'));var Mustache=require(_0x1190('0x6'));var util=require('util');var path=require(_0x1190('0x7'));var sox=require(_0x1190('0x8'));var csv=require(_0x1190('0x9'));var ejs=require(_0x1190('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1190('0xb'));var squel=require(_0x1190('0xc'));var crypto=require(_0x1190('0xd'));var jsforce=require(_0x1190('0xe'));var deskjs=require(_0x1190('0xf'));var toCsv=require(_0x1190('0x9'));var querystring=require(_0x1190('0x10'));var Papa=require(_0x1190('0x11'));var Redis=require(_0x1190('0x12'));var authService=require(_0x1190('0x13'));var qs=require(_0x1190('0x14'));var as=require(_0x1190('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1190('0x16'))(_0x1190('0x17'));var utils=require(_0x1190('0x18'));var config=require(_0x1190('0x19'));var licenseUtil=require(_0x1190('0x1a'));var db=require(_0x1190('0x1b'))['db'];function respondWithStatusCode(_0x23d34b,_0x33e144){_0x33e144=_0x33e144||0xcc;return function(_0x234f34){if(_0x234f34){return _0x23d34b[_0x1190('0x1c')](_0x33e144);}return _0x23d34b['status'](_0x33e144)['end']();};}function respondWithResult(_0x4e0776,_0x3f6118){_0x3f6118=_0x3f6118||0xc8;return function(_0x344691){if(_0x344691){return _0x4e0776[_0x1190('0x1d')](_0x3f6118)[_0x1190('0x1e')](_0x344691);}};}function respondWithFilteredResult(_0x4066cd,_0x11f8af){return function(_0x355978){if(_0x355978){var _0xfd7e8c=typeof _0x11f8af[_0x1190('0x1f')]===_0x1190('0x20')&&typeof _0x11f8af['limit']===_0x1190('0x20');var _0x442d7d=_0x355978[_0x1190('0x21')];var _0x291c8a=_0xfd7e8c?0x0:_0x11f8af[_0x1190('0x1f')];var _0x445a78=_0xfd7e8c?_0x355978[_0x1190('0x21')]:_0x11f8af[_0x1190('0x1f')]+_0x11f8af['limit'];var _0xa243e8;if(_0x445a78>=_0x442d7d){_0x445a78=_0x442d7d;_0xa243e8=0xc8;}else{_0xa243e8=0xce;}_0x4066cd[_0x1190('0x1d')](_0xa243e8);return _0x4066cd['set'](_0x1190('0x22'),_0x291c8a+'-'+_0x445a78+'/'+_0x442d7d)[_0x1190('0x1e')](_0x355978);}return null;};}function patchUpdates(_0x278a58){return function(_0x2955ab){try{jsonpatch[_0x1190('0x23')](_0x2955ab,_0x278a58,!![]);}catch(_0x3cc255){return BPromise['reject'](_0x3cc255);}return _0x2955ab[_0x1190('0x24')]();};}function saveUpdates(_0x12528c,_0x50ffa1){return function(_0xbf0f68){if(_0xbf0f68){return _0xbf0f68[_0x1190('0x25')](_0x12528c)[_0x1190('0x26')](function(_0x3917a9){return _0x3917a9;});}return null;};}function removeEntity(_0x438957,_0x1762f7){return function(_0x419615){if(_0x419615){return _0x419615['destroy']()[_0x1190('0x26')](function(){_0x438957['status'](0xcc)[_0x1190('0x27')]();});}};}function handleEntityNotFound(_0x4e6fc4,_0x270f1f){return function(_0x63933e){if(!_0x63933e){_0x4e6fc4[_0x1190('0x1c')](0x194);}return _0x63933e;};}function handleError(_0x4b451e,_0x34c010){_0x34c010=_0x34c010||0x1f4;return function(_0x41bc69){logger[_0x1190('0x28')](_0x41bc69[_0x1190('0x29')]);if(_0x41bc69[_0x1190('0x2a')]){delete _0x41bc69['name'];}_0x4b451e[_0x1190('0x1d')](_0x34c010)[_0x1190('0x2b')](_0x41bc69);};}exports['index']=function(_0x3cf202,_0x27a80e){var _0x264c48={},_0x259aba={},_0x1c33bf={'count':0x0,'rows':[]};var _0x243fba=_[_0x1190('0x2c')](db['SmsTransferReport'][_0x1190('0x2d')],function(_0x3bb055){return{'name':_0x3bb055['fieldName'],'type':_0x3bb055[_0x1190('0x2e')][_0x1190('0x2f')]};});_0x259aba[_0x1190('0x30')]=_['map'](_0x243fba,'name');_0x259aba['query']=_['keys'](_0x3cf202[_0x1190('0x31')]);_0x259aba[_0x1190('0x32')]=_[_0x1190('0x33')](_0x259aba['model'],_0x259aba['query']);_0x264c48[_0x1190('0x34')]=_[_0x1190('0x33')](_0x259aba[_0x1190('0x30')],qs[_0x1190('0x35')](_0x3cf202[_0x1190('0x31')][_0x1190('0x35')]));_0x264c48[_0x1190('0x34')]=_0x264c48[_0x1190('0x34')][_0x1190('0x36')]?_0x264c48[_0x1190('0x34')]:_0x259aba[_0x1190('0x30')];if(!_0x3cf202['query']['hasOwnProperty']('nolimit')){_0x264c48[_0x1190('0x37')]=qs[_0x1190('0x37')](_0x3cf202[_0x1190('0x31')][_0x1190('0x37')]);_0x264c48['offset']=qs[_0x1190('0x1f')](_0x3cf202['query'][_0x1190('0x1f')]);}_0x264c48[_0x1190('0x38')]=qs['sort'](_0x3cf202[_0x1190('0x31')][_0x1190('0x39')]);_0x264c48[_0x1190('0x3a')]=qs[_0x1190('0x32')](_[_0x1190('0x3b')](_0x3cf202['query'],_0x259aba[_0x1190('0x32')]),_0x243fba);if(_0x3cf202[_0x1190('0x31')]['filter']){_0x264c48['where']=_[_0x1190('0x3c')](_0x264c48[_0x1190('0x3a')],{'$or':_['map'](_0x243fba,function(_0x20ec62){if(_0x20ec62['type']!==_0x1190('0x3d')){var _0x2888a8={};_0x2888a8[_0x20ec62[_0x1190('0x2a')]]={'$like':'%'+_0x3cf202[_0x1190('0x31')][_0x1190('0x3e')]+'%'};return _0x2888a8;}})});}_0x264c48=_[_0x1190('0x3c')]({},_0x264c48,_0x3cf202[_0x1190('0x3f')]);var _0x1d402e={'where':_0x264c48[_0x1190('0x3a')]};return db[_0x1190('0x40')][_0x1190('0x21')](_0x1d402e)['then'](function(_0x45643a){_0x1c33bf[_0x1190('0x21')]=_0x45643a;if(_0x3cf202[_0x1190('0x31')][_0x1190('0x41')]){_0x264c48['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0x1190('0x42')](_0x264c48);})['then'](function(_0x4568a1){_0x1c33bf[_0x1190('0x43')]=_0x4568a1;return _0x1c33bf;})[_0x1190('0x26')](respondWithFilteredResult(_0x27a80e,_0x264c48))[_0x1190('0x44')](handleError(_0x27a80e,null));};exports[_0x1190('0x45')]=function(_0x1ece4f,_0x16d926){var _0x16fb68={'raw':!![],'where':{'id':_0x1ece4f[_0x1190('0x46')]['id']}},_0x45bf63={};_0x45bf63[_0x1190('0x30')]=_[_0x1190('0x47')](db[_0x1190('0x40')]['rawAttributes']);_0x45bf63['query']=_[_0x1190('0x47')](_0x1ece4f['query']);_0x45bf63[_0x1190('0x32')]=_['intersection'](_0x45bf63[_0x1190('0x30')],_0x45bf63[_0x1190('0x31')]);_0x16fb68[_0x1190('0x34')]=_[_0x1190('0x33')](_0x45bf63['model'],qs['fields'](_0x1ece4f[_0x1190('0x31')][_0x1190('0x35')]));_0x16fb68[_0x1190('0x34')]=_0x16fb68[_0x1190('0x34')][_0x1190('0x36')]?_0x16fb68['attributes']:_0x45bf63[_0x1190('0x30')];if(_0x1ece4f[_0x1190('0x31')][_0x1190('0x41')]){_0x16fb68[_0x1190('0x48')]=[{'all':!![]}];}_0x16fb68=_[_0x1190('0x3c')]({},_0x16fb68,_0x1ece4f[_0x1190('0x3f')]);return db['SmsTransferReport'][_0x1190('0x49')](_0x16fb68)['then'](handleEntityNotFound(_0x16d926,null))[_0x1190('0x26')](respondWithResult(_0x16d926,null))[_0x1190('0x44')](handleError(_0x16d926,null));};exports[_0x1190('0x4a')]=function(_0x111244,_0x1080ce){return db['SmsTransferReport'][_0x1190('0x4a')](_0x111244[_0x1190('0x4b')],{})[_0x1190('0x26')](respondWithResult(_0x1080ce,0xc9))[_0x1190('0x44')](handleError(_0x1080ce,null));};exports['update']=function(_0x1e5ea8,_0x53dc4e){if(_0x1e5ea8[_0x1190('0x4b')]['id']){delete _0x1e5ea8[_0x1190('0x4b')]['id'];}return db['SmsTransferReport'][_0x1190('0x49')]({'where':{'id':_0x1e5ea8[_0x1190('0x46')]['id']}})[_0x1190('0x26')](handleEntityNotFound(_0x53dc4e,null))[_0x1190('0x26')](saveUpdates(_0x1e5ea8['body'],null))['then'](respondWithResult(_0x53dc4e,null))[_0x1190('0x44')](handleError(_0x53dc4e,null));};exports[_0x1190('0x4c')]=function(_0x2986fa,_0x14ceac){return db[_0x1190('0x40')][_0x1190('0x49')]({'where':{'id':_0x2986fa[_0x1190('0x46')]['id']}})[_0x1190('0x26')](handleEntityNotFound(_0x14ceac,null))[_0x1190('0x26')](removeEntity(_0x14ceac,null))[_0x1190('0x44')](handleError(_0x14ceac,null));};exports['describe']=function(_0x3a1f66,_0x4d10f5){return db['SmsTransferReport']['describe']()['then'](respondWithResult(_0x4d10f5,null))[_0x1190('0x44')](handleError(_0x4d10f5,null));}; \ No newline at end of file +var _0x0eba=['options','SmsTransferReport','includeAll','include','findAll','rows','catch','show','params','keys','intersection','length','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type'];(function(_0x197e10,_0x159068){var _0x329726=function(_0x594e73){while(--_0x594e73){_0x197e10['push'](_0x197e10['shift']());}};_0x329726(++_0x159068);}(_0x0eba,0x1af));var _0xa0eb=function(_0x320b41,_0x28466f){_0x320b41=_0x320b41-0x0;var _0x4d649e=_0x0eba[_0x320b41];return _0x4d649e;};'use strict';var emlformat=require(_0xa0eb('0x0'));var rimraf=require(_0xa0eb('0x1'));var zipdir=require(_0xa0eb('0x2'));var jsonpatch=require(_0xa0eb('0x3'));var rp=require(_0xa0eb('0x4'));var moment=require(_0xa0eb('0x5'));var BPromise=require(_0xa0eb('0x6'));var Mustache=require(_0xa0eb('0x7'));var util=require(_0xa0eb('0x8'));var path=require(_0xa0eb('0x9'));var sox=require(_0xa0eb('0xa'));var csv=require(_0xa0eb('0xb'));var ejs=require(_0xa0eb('0xc'));var fs=require('fs');var fs_extra=require(_0xa0eb('0xd'));var _=require(_0xa0eb('0xe'));var squel=require(_0xa0eb('0xf'));var crypto=require(_0xa0eb('0x10'));var jsforce=require(_0xa0eb('0x11'));var deskjs=require(_0xa0eb('0x12'));var toCsv=require('to-csv');var querystring=require(_0xa0eb('0x13'));var Papa=require(_0xa0eb('0x14'));var Redis=require(_0xa0eb('0x15'));var authService=require(_0xa0eb('0x16'));var qs=require(_0xa0eb('0x17'));var as=require(_0xa0eb('0x18'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0eb('0x19'))(_0xa0eb('0x1a'));var utils=require(_0xa0eb('0x1b'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa0eb('0x1c'))['db'];function respondWithStatusCode(_0x585d58,_0x4c0f10){_0x4c0f10=_0x4c0f10||0xcc;return function(_0x53c498){if(_0x53c498){return _0x585d58[_0xa0eb('0x1d')](_0x4c0f10);}return _0x585d58['status'](_0x4c0f10)['end']();};}function respondWithResult(_0x569ee4,_0x280b18){_0x280b18=_0x280b18||0xc8;return function(_0x32cd2a){if(_0x32cd2a){return _0x569ee4[_0xa0eb('0x1e')](_0x280b18)[_0xa0eb('0x1f')](_0x32cd2a);}};}function respondWithFilteredResult(_0x7c5081,_0x29ba83){return function(_0x286536){if(_0x286536){var _0x4cb34a=typeof _0x29ba83[_0xa0eb('0x20')]===_0xa0eb('0x21')&&typeof _0x29ba83[_0xa0eb('0x22')]===_0xa0eb('0x21');var _0x1e274c=_0x286536['count'];var _0x3a1fce=_0x4cb34a?0x0:_0x29ba83[_0xa0eb('0x20')];var _0x251b15=_0x4cb34a?_0x286536[_0xa0eb('0x23')]:_0x29ba83['offset']+_0x29ba83['limit'];var _0x2ce615;if(_0x251b15>=_0x1e274c){_0x251b15=_0x1e274c;_0x2ce615=0xc8;}else{_0x2ce615=0xce;}_0x7c5081['status'](_0x2ce615);return _0x7c5081['set'](_0xa0eb('0x24'),_0x3a1fce+'-'+_0x251b15+'/'+_0x1e274c)[_0xa0eb('0x1f')](_0x286536);}return null;};}function patchUpdates(_0x1508cc){return function(_0x2dd72b){try{jsonpatch[_0xa0eb('0x25')](_0x2dd72b,_0x1508cc,!![]);}catch(_0x5b4978){return BPromise[_0xa0eb('0x26')](_0x5b4978);}return _0x2dd72b[_0xa0eb('0x27')]();};}function saveUpdates(_0x15749b,_0x16dd75){return function(_0x17f45b){if(_0x17f45b){return _0x17f45b[_0xa0eb('0x28')](_0x15749b)[_0xa0eb('0x29')](function(_0x5b05ea){return _0x5b05ea;});}return null;};}function removeEntity(_0x1c1eb0,_0xda26d2){return function(_0x137857){if(_0x137857){return _0x137857[_0xa0eb('0x2a')]()[_0xa0eb('0x29')](function(){_0x1c1eb0['status'](0xcc)[_0xa0eb('0x2b')]();});}};}function handleEntityNotFound(_0x1bfc2d,_0x3f9d17){return function(_0x231259){if(!_0x231259){_0x1bfc2d[_0xa0eb('0x1d')](0x194);}return _0x231259;};}function handleError(_0x3ba28f,_0x236290){_0x236290=_0x236290||0x1f4;return function(_0x55889d){logger[_0xa0eb('0x2c')](_0x55889d[_0xa0eb('0x2d')]);if(_0x55889d[_0xa0eb('0x2e')]){delete _0x55889d[_0xa0eb('0x2e')];}_0x3ba28f['status'](_0x236290)[_0xa0eb('0x2f')](_0x55889d);};}exports[_0xa0eb('0x30')]=function(_0x2ae7e9,_0x2eb910){var _0x51e3ad={},_0x2f4d9a={},_0x3d3cf9={'count':0x0,'rows':[]};var _0x379c21=_[_0xa0eb('0x31')](db['SmsTransferReport'][_0xa0eb('0x32')],function(_0x220138){return{'name':_0x220138[_0xa0eb('0x33')],'type':_0x220138['type'][_0xa0eb('0x34')]};});_0x2f4d9a[_0xa0eb('0x35')]=_[_0xa0eb('0x31')](_0x379c21,_0xa0eb('0x2e'));_0x2f4d9a[_0xa0eb('0x36')]=_['keys'](_0x2ae7e9['query']);_0x2f4d9a[_0xa0eb('0x37')]=_['intersection'](_0x2f4d9a[_0xa0eb('0x35')],_0x2f4d9a[_0xa0eb('0x36')]);_0x51e3ad[_0xa0eb('0x38')]=_['intersection'](_0x2f4d9a[_0xa0eb('0x35')],qs[_0xa0eb('0x39')](_0x2ae7e9[_0xa0eb('0x36')][_0xa0eb('0x39')]));_0x51e3ad[_0xa0eb('0x38')]=_0x51e3ad[_0xa0eb('0x38')]['length']?_0x51e3ad[_0xa0eb('0x38')]:_0x2f4d9a[_0xa0eb('0x35')];if(!_0x2ae7e9[_0xa0eb('0x36')][_0xa0eb('0x3a')](_0xa0eb('0x3b'))){_0x51e3ad[_0xa0eb('0x22')]=qs['limit'](_0x2ae7e9[_0xa0eb('0x36')][_0xa0eb('0x22')]);_0x51e3ad[_0xa0eb('0x20')]=qs[_0xa0eb('0x20')](_0x2ae7e9[_0xa0eb('0x36')]['offset']);}_0x51e3ad[_0xa0eb('0x3c')]=qs[_0xa0eb('0x3d')](_0x2ae7e9[_0xa0eb('0x36')][_0xa0eb('0x3d')]);_0x51e3ad[_0xa0eb('0x3e')]=qs[_0xa0eb('0x37')](_[_0xa0eb('0x3f')](_0x2ae7e9[_0xa0eb('0x36')],_0x2f4d9a['filters']),_0x379c21);if(_0x2ae7e9[_0xa0eb('0x36')][_0xa0eb('0x40')]){_0x51e3ad[_0xa0eb('0x3e')]=_[_0xa0eb('0x41')](_0x51e3ad['where'],{'$or':_[_0xa0eb('0x31')](_0x379c21,function(_0x1bd21c){if(_0x1bd21c[_0xa0eb('0x42')]!=='VIRTUAL'){var _0x2c65ae={};_0x2c65ae[_0x1bd21c[_0xa0eb('0x2e')]]={'$like':'%'+_0x2ae7e9['query'][_0xa0eb('0x40')]+'%'};return _0x2c65ae;}})});}_0x51e3ad=_[_0xa0eb('0x41')]({},_0x51e3ad,_0x2ae7e9[_0xa0eb('0x43')]);var _0xa524d1={'where':_0x51e3ad[_0xa0eb('0x3e')]};return db[_0xa0eb('0x44')][_0xa0eb('0x23')](_0xa524d1)[_0xa0eb('0x29')](function(_0x17315f){_0x3d3cf9[_0xa0eb('0x23')]=_0x17315f;if(_0x2ae7e9['query'][_0xa0eb('0x45')]){_0x51e3ad[_0xa0eb('0x46')]=[{'all':!![]}];}return db[_0xa0eb('0x44')][_0xa0eb('0x47')](_0x51e3ad);})['then'](function(_0x19d2f2){_0x3d3cf9[_0xa0eb('0x48')]=_0x19d2f2;return _0x3d3cf9;})['then'](respondWithFilteredResult(_0x2eb910,_0x51e3ad))[_0xa0eb('0x49')](handleError(_0x2eb910,null));};exports[_0xa0eb('0x4a')]=function(_0x4b426e,_0x1e9abb){var _0x47adfa={'raw':!![],'where':{'id':_0x4b426e[_0xa0eb('0x4b')]['id']}},_0x40b66d={};_0x40b66d[_0xa0eb('0x35')]=_[_0xa0eb('0x4c')](db[_0xa0eb('0x44')][_0xa0eb('0x32')]);_0x40b66d[_0xa0eb('0x36')]=_[_0xa0eb('0x4c')](_0x4b426e['query']);_0x40b66d[_0xa0eb('0x37')]=_[_0xa0eb('0x4d')](_0x40b66d[_0xa0eb('0x35')],_0x40b66d[_0xa0eb('0x36')]);_0x47adfa[_0xa0eb('0x38')]=_[_0xa0eb('0x4d')](_0x40b66d[_0xa0eb('0x35')],qs[_0xa0eb('0x39')](_0x4b426e[_0xa0eb('0x36')]['fields']));_0x47adfa[_0xa0eb('0x38')]=_0x47adfa['attributes'][_0xa0eb('0x4e')]?_0x47adfa[_0xa0eb('0x38')]:_0x40b66d[_0xa0eb('0x35')];if(_0x4b426e[_0xa0eb('0x36')]['includeAll']){_0x47adfa[_0xa0eb('0x46')]=[{'all':!![]}];}_0x47adfa=_[_0xa0eb('0x41')]({},_0x47adfa,_0x4b426e['options']);return db[_0xa0eb('0x44')]['find'](_0x47adfa)[_0xa0eb('0x29')](handleEntityNotFound(_0x1e9abb,null))[_0xa0eb('0x29')](respondWithResult(_0x1e9abb,null))['catch'](handleError(_0x1e9abb,null));};exports[_0xa0eb('0x4f')]=function(_0x134b54,_0x328a24){return db[_0xa0eb('0x44')][_0xa0eb('0x4f')](_0x134b54[_0xa0eb('0x50')],{})['then'](respondWithResult(_0x328a24,0xc9))['catch'](handleError(_0x328a24,null));};exports[_0xa0eb('0x28')]=function(_0x5bb595,_0x145beb){if(_0x5bb595[_0xa0eb('0x50')]['id']){delete _0x5bb595[_0xa0eb('0x50')]['id'];}return db[_0xa0eb('0x44')][_0xa0eb('0x51')]({'where':{'id':_0x5bb595['params']['id']}})[_0xa0eb('0x29')](handleEntityNotFound(_0x145beb,null))[_0xa0eb('0x29')](saveUpdates(_0x5bb595[_0xa0eb('0x50')],null))[_0xa0eb('0x29')](respondWithResult(_0x145beb,null))[_0xa0eb('0x49')](handleError(_0x145beb,null));};exports[_0xa0eb('0x2a')]=function(_0x252323,_0x2e5aa4){return db['SmsTransferReport']['find']({'where':{'id':_0x252323[_0xa0eb('0x4b')]['id']}})[_0xa0eb('0x29')](handleEntityNotFound(_0x2e5aa4,null))[_0xa0eb('0x29')](removeEntity(_0x2e5aa4,null))[_0xa0eb('0x49')](handleError(_0x2e5aa4,null));};exports[_0xa0eb('0x52')]=function(_0x13bb3c,_0x1745a2){return db[_0xa0eb('0x44')][_0xa0eb('0x52')]()[_0xa0eb('0x29')](respondWithResult(_0x1745a2,null))[_0xa0eb('0x49')](handleError(_0x1745a2,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 2ddf0a0..aac1984 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 _0xe198=['rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','moment','bluebird','request-promise','path'];(function(_0x482a6d,_0x776f8c){var _0x3a03b4=function(_0xf2438b){while(--_0xf2438b){_0x482a6d['push'](_0x482a6d['shift']());}};_0x3a03b4(++_0x776f8c);}(_0xe198,0x6f));var _0x8e19=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xe198[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x8e19('0x0'));var util=require(_0x8e19('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8e19('0x2'));var BPromise=require(_0x8e19('0x3'));var rp=require(_0x8e19('0x4'));var fs=require('fs');var path=require(_0x8e19('0x5'));var rimraf=require(_0x8e19('0x6'));var config=require('../../config/environment');var attributes=require(_0x8e19('0x7'));module[_0x8e19('0x8')]=function(_0x2fb138,_0x188ce0){return _0x2fb138[_0x8e19('0x9')](_0x8e19('0xa'),attributes,{'tableName':_0x8e19('0xb'),'paranoid':![],'indexes':[{'name':_0x8e19('0xc'),'fields':[_0x8e19('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4858=['uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer'];(function(_0x1d8566,_0x5aada4){var _0x56bbc2=function(_0x2160cd){while(--_0x2160cd){_0x1d8566['push'](_0x1d8566['shift']());}};_0x56bbc2(++_0x5aada4);}(_0x4858,0x12c));var _0x8485=function(_0x45cf75,_0x1ea455){_0x45cf75=_0x45cf75-0x0;var _0x4d08fc=_0x4858[_0x45cf75];return _0x4d08fc;};'use strict';var _=require(_0x8485('0x0'));var util=require(_0x8485('0x1'));var logger=require(_0x8485('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8485('0x3'));var rp=require(_0x8485('0x4'));var fs=require('fs');var path=require(_0x8485('0x5'));var rimraf=require(_0x8485('0x6'));var config=require(_0x8485('0x7'));var attributes=require(_0x8485('0x8'));module[_0x8485('0x9')]=function(_0x3a86c4,_0x50a990){return _0x3a86c4[_0x8485('0xa')]('SmsTransferReport',attributes,{'tableName':_0x8485('0xb'),'paranoid':![],'indexes':[{'name':_0x8485('0xc'),'fields':[_0x8485('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index a08b28d..bc8d9dc 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 _0xc92f=['request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client'];(function(_0x26721d,_0x448ba5){var _0x1035c5=function(_0x1c1b86){while(--_0x1c1b86){_0x26721d['push'](_0x26721d['shift']());}};_0x1035c5(++_0x448ba5);}(_0xc92f,0xf3));var _0xfc92=function(_0x32d530,_0x327b60){_0x32d530=_0x32d530-0x0;var _0x397a2b=_0xc92f[_0x32d530];return _0x397a2b;};'use strict';var _=require(_0xfc92('0x0'));var util=require(_0xfc92('0x1'));var moment=require('moment');var BPromise=require(_0xfc92('0x2'));var rs=require(_0xfc92('0x3'));var fs=require('fs');var Redis=require(_0xfc92('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc92('0x5'));var logger=require(_0xfc92('0x6'))(_0xfc92('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfc92('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x394026,_0x4e578a,_0xd80968){return new BPromise(function(_0x49db29,_0x432982){return client[_0xfc92('0x9')](_0x394026,_0xd80968)[_0xfc92('0xa')](function(_0x4f37f2){logger[_0xfc92('0xb')](_0xfc92('0xc'),_0x4e578a,_0xfc92('0xd'));logger['debug'](_0xfc92('0xe'),_0x4e578a,_0xfc92('0xd'),JSON[_0xfc92('0xf')](_0x4f37f2));if(_0x4f37f2[_0xfc92('0x10')]){if(_0x4f37f2[_0xfc92('0x10')][_0xfc92('0x11')]===0x1f4){logger[_0xfc92('0x10')](_0xfc92('0xc'),_0x4e578a,_0x4f37f2[_0xfc92('0x10')][_0xfc92('0x12')]);return _0x432982(_0x4f37f2[_0xfc92('0x10')][_0xfc92('0x12')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x4e578a,_0x4f37f2['error'][_0xfc92('0x12')]);return _0x49db29(_0x4f37f2[_0xfc92('0x10')]['message']);}else{logger[_0xfc92('0xb')](_0xfc92('0xc'),_0x4e578a,_0xfc92('0xd'));_0x49db29(_0x4f37f2[_0xfc92('0x13')][_0xfc92('0x12')]);}})[_0xfc92('0x14')](function(_0x492d40){logger[_0xfc92('0x10')](_0xfc92('0xc'),_0x4e578a,_0x492d40);_0x432982(_0x492d40);});});} \ No newline at end of file +var _0xd45e=['info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','SmsTransferReport,\x20%s,\x20%s','message','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then'];(function(_0x3fe484,_0xf5dfa0){var _0x50593d=function(_0x3ad441){while(--_0x3ad441){_0x3fe484['push'](_0x3fe484['shift']());}};_0x50593d(++_0xf5dfa0);}(_0xd45e,0x182));var _0xed45=function(_0x3d1d3a,_0x42a74f){_0x3d1d3a=_0x3d1d3a-0x0;var _0x13151d=_0xd45e[_0x3d1d3a];return _0x13151d;};'use strict';var _=require('lodash');var util=require(_0xed45('0x0'));var moment=require(_0xed45('0x1'));var BPromise=require('bluebird');var rs=require(_0xed45('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed45('0x3'))['db'];var utils=require(_0xed45('0x4'));var logger=require(_0xed45('0x5'))('rpc');var config=require(_0xed45('0x6'));var jayson=require(_0xed45('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3185ae,_0x47171f,_0x4afe6c){return new BPromise(function(_0x380a8,_0x428832){return client[_0xed45('0x8')](_0x3185ae,_0x4afe6c)[_0xed45('0x9')](function(_0xb2019c){logger[_0xed45('0xa')]('SmsTransferReport,\x20%s,\x20%s',_0x47171f,_0xed45('0xb'));logger[_0xed45('0xc')](_0xed45('0xd'),_0x47171f,_0xed45('0xb'),JSON[_0xed45('0xe')](_0xb2019c));if(_0xb2019c[_0xed45('0xf')]){if(_0xb2019c[_0xed45('0xf')]['code']===0x1f4){logger[_0xed45('0xf')](_0xed45('0x10'),_0x47171f,_0xb2019c[_0xed45('0xf')][_0xed45('0x11')]);return _0x428832(_0xb2019c['error'][_0xed45('0x11')]);}logger['error'](_0xed45('0x10'),_0x47171f,_0xb2019c[_0xed45('0xf')][_0xed45('0x11')]);return _0x380a8(_0xb2019c[_0xed45('0xf')]['message']);}else{logger[_0xed45('0xa')](_0xed45('0x10'),_0x47171f,_0xed45('0xb'));_0x380a8(_0xb2019c['result'][_0xed45('0x11')]);}})['catch'](function(_0x2d9bc4){logger[_0xed45('0xf')](_0xed45('0x10'),_0x47171f,_0x2d9bc4);_0x428832(_0x2d9bc4);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 9955b7c..6da6b01 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 _0xb562=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','format','now','extname','single','put','/:id','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x4f653d,_0x21b71a){var _0x505ffa=function(_0x50e3a3){while(--_0x50e3a3){_0x4f653d['push'](_0x4f653d['shift']());}};_0x505ffa(++_0x21b71a);}(_0xb562,0x1d8));var _0x2b56=function(_0x3a0a97,_0x82ccf2){_0x3a0a97=_0x3a0a97-0x0;var _0x46f4e1=_0xb562[_0x3a0a97];return _0x46f4e1;};'use strict';var multer=require(_0x2b56('0x0'));var util=require('util');var path=require(_0x2b56('0x1'));var timeout=require(_0x2b56('0x2'));var express=require(_0x2b56('0x3'));var router=express[_0x2b56('0x4')]();var fs_extra=require(_0x2b56('0x5'));var auth=require(_0x2b56('0x6'));var interaction=require(_0x2b56('0x7'));var config=require('../../config/environment');var controller=require(_0x2b56('0x8'));router[_0x2b56('0x9')]('/',auth[_0x2b56('0xa')](),controller[_0x2b56('0xb')]);router[_0x2b56('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2b56('0x9')](_0x2b56('0xc'),auth[_0x2b56('0xa')](),controller[_0x2b56('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x47e65c,_0x283dda,_0x3504b5){_0x3504b5(null,path[_0x2b56('0xe')](config[_0x2b56('0xf')],_0x2b56('0x10')));},'filename':function(_0x4f7360,_0x4af3ec,_0x52c817){_0x4af3ec[_0x2b56('0x11')]=_0x4af3ec[_0x2b56('0x11')][_0x2b56('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52c817(null,util[_0x2b56('0x13')]('%s-%s%s',path['basename'](_0x4af3ec[_0x2b56('0x11')],path['extname'](_0x4af3ec[_0x2b56('0x11')])),Date[_0x2b56('0x14')](),path[_0x2b56('0x15')](_0x4af3ec[_0x2b56('0x11')])));}})});router['post']('/',upload[_0x2b56('0x16')]('file'),controller['create']);router[_0x2b56('0x17')](_0x2b56('0x18'),auth['isAuthenticated'](),controller[_0x2b56('0x19')]);router[_0x2b56('0x1a')](_0x2b56('0x18'),auth[_0x2b56('0xa')](),controller[_0x2b56('0x1a')]);module[_0x2b56('0x1b')]=router; \ No newline at end of file +var _0x010b=['./sound.controller','isAuthenticated','get','/:id','show','/:id/download','download','join','server/files/sounds/original/','originalname','replace','format','basename','extname','now','post','single','file','create','put','update','delete','exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x34190e,_0x50ecc7){var _0x41a4e6=function(_0x4a9ad9){while(--_0x4a9ad9){_0x34190e['push'](_0x34190e['shift']());}};_0x41a4e6(++_0x50ecc7);}(_0x010b,0x139));var _0xb010=function(_0x514527,_0xae23bf){_0x514527=_0x514527-0x0;var _0x35e785=_0x010b[_0x514527];return _0x35e785;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb010('0x0'));var timeout=require('connect-timeout');var express=require(_0xb010('0x1'));var router=express[_0xb010('0x2')]();var fs_extra=require(_0xb010('0x3'));var auth=require(_0xb010('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb010('0x5'));var controller=require(_0xb010('0x6'));router['get']('/',auth[_0xb010('0x7')](),controller['index']);router[_0xb010('0x8')](_0xb010('0x9'),auth[_0xb010('0x7')](),controller[_0xb010('0xa')]);router[_0xb010('0x8')](_0xb010('0xb'),auth[_0xb010('0x7')](),controller[_0xb010('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x35e4a3,_0x655f06,_0x46fb9a){_0x46fb9a(null,path[_0xb010('0xd')](config['root'],_0xb010('0xe')));},'filename':function(_0x3db354,_0x502735,_0xaa0643){_0x502735[_0xb010('0xf')]=_0x502735[_0xb010('0xf')][_0xb010('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xaa0643(null,util[_0xb010('0x11')]('%s-%s%s',path[_0xb010('0x12')](_0x502735[_0xb010('0xf')],path[_0xb010('0x13')](_0x502735[_0xb010('0xf')])),Date[_0xb010('0x14')](),path[_0xb010('0x13')](_0x502735[_0xb010('0xf')])));}})});router[_0xb010('0x15')]('/',upload[_0xb010('0x16')](_0xb010('0x17')),controller[_0xb010('0x18')]);router[_0xb010('0x19')]('/:id',auth[_0xb010('0x7')](),controller[_0xb010('0x1a')]);router[_0xb010('0x1b')](_0xb010('0x9'),auth[_0xb010('0x7')](),controller[_0xb010('0x1b')]);module[_0xb010('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 9290a11..a2c6180 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 _0x8254=['INTEGER','sequelize','exports','STRING','name','FLOAT','BIGINT'];(function(_0x2c98c6,_0x52ee89){var _0x1f7fe0=function(_0xfe7a64){while(--_0xfe7a64){_0x2c98c6['push'](_0x2c98c6['shift']());}};_0x1f7fe0(++_0x52ee89);}(_0x8254,0x15f));var _0x4825=function(_0x11d479,_0xbaed9){_0x11d479=_0x11d479-0x0;var _0x471634=_0x8254[_0x11d479];return _0x471634;};'use strict';var Sequelize=require(_0x4825('0x0'));module[_0x4825('0x1')]={'name':{'type':Sequelize[_0x4825('0x2')],'unique':_0x4825('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x4825('0x2')]},'display_name':{'type':Sequelize[_0x4825('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x4825('0x2')]},'original_format':{'type':Sequelize[_0x4825('0x2')]},'original_duration':{'type':Sequelize[_0x4825('0x4')]},'original_sampleCount':{'type':Sequelize[_0x4825('0x5')]},'original_channelCount':{'type':Sequelize[_0x4825('0x6')]},'original_bitRate':{'type':Sequelize[_0x4825('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x4825('0x2')]},'converted_duration':{'type':Sequelize[_0x4825('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x4825('0x6')]},'converted_bitRate':{'type':Sequelize[_0x4825('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x4825('0x6')]}}; \ No newline at end of file +var _0xe4d0=['sequelize','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xe4d0,0x186));var _0x0e4d=function(_0x1f27df,_0x4f1a64){_0x1f27df=_0x1f27df-0x0;var _0x286ee2=_0xe4d0[_0x1f27df];return _0x286ee2;};'use strict';var Sequelize=require(_0x0e4d('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e4d('0x1')],'unique':_0x0e4d('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x0e4d('0x1')]},'display_name':{'type':Sequelize[_0x0e4d('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x0e4d('0x1')]},'original_format':{'type':Sequelize[_0x0e4d('0x1')]},'original_duration':{'type':Sequelize[_0x0e4d('0x3')]},'original_sampleCount':{'type':Sequelize[_0x0e4d('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x0e4d('0x4')]},'original_sampleRate':{'type':Sequelize[_0x0e4d('0x5')]},'converted_format':{'type':Sequelize[_0x0e4d('0x1')]},'converted_duration':{'type':Sequelize[_0x0e4d('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x0e4d('0x4')]},'converted_channelCount':{'type':Sequelize[_0x0e4d('0x5')]},'converted_bitRate':{'type':Sequelize[_0x0e4d('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index ea6f0b8..be68b1c 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 _0xe5fe=['original_sampleRate','sampleRate','converted_duration','converted_channelCount','channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','original_format','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','get','UserProfileResource','destroy','then','sendStatus','error','stack','name','send','index','Sound','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','download','join','format','%s.%s','create','file','originalname','extname','filename','wav','server/files/sounds/original','basename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','original_bitRate','bitRate'];(function(_0x52b91f,_0x499757){var _0x15f8f5=function(_0x33fbf6){while(--_0x33fbf6){_0x52b91f['push'](_0x52b91f['shift']());}};_0x15f8f5(++_0x499757);}(_0xe5fe,0x111));var _0xee5f=function(_0x4f6c24,_0x4204af){_0x4f6c24=_0x4f6c24-0x0;var _0x1f67c6=_0xe5fe[_0x4f6c24];return _0x1f67c6;};'use strict';var emlformat=require(_0xee5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee5f('0x1'));var jsonpatch=require(_0xee5f('0x2'));var rp=require('request-promise');var moment=require(_0xee5f('0x3'));var BPromise=require(_0xee5f('0x4'));var Mustache=require(_0xee5f('0x5'));var util=require(_0xee5f('0x6'));var path=require(_0xee5f('0x7'));var sox=require(_0xee5f('0x8'));var csv=require(_0xee5f('0x9'));var ejs=require(_0xee5f('0xa'));var fs=require('fs');var fs_extra=require(_0xee5f('0xb'));var _=require(_0xee5f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xee5f('0xd'));var toCsv=require(_0xee5f('0x9'));var querystring=require(_0xee5f('0xe'));var Papa=require(_0xee5f('0xf'));var Redis=require(_0xee5f('0x10'));var authService=require(_0xee5f('0x11'));var qs=require(_0xee5f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee5f('0x13'));var logger=require(_0xee5f('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xee5f('0x15'));var db=require(_0xee5f('0x16'))['db'];function respondWithStatusCode(_0x5c0a95,_0x452be5){_0x452be5=_0x452be5||0xcc;return function(_0x4d2112){if(_0x4d2112){return _0x5c0a95['sendStatus'](_0x452be5);}return _0x5c0a95['status'](_0x452be5)[_0xee5f('0x17')]();};}function respondWithResult(_0x287f74,_0x43c053){_0x43c053=_0x43c053||0xc8;return function(_0x282296){if(_0x282296){return _0x287f74[_0xee5f('0x18')](_0x43c053)[_0xee5f('0x19')](_0x282296);}};}function respondWithFilteredResult(_0x5797c,_0x49a5b9){return function(_0x3f53e4){if(_0x3f53e4){var _0x501727=typeof _0x49a5b9[_0xee5f('0x1a')]===_0xee5f('0x1b')&&typeof _0x49a5b9[_0xee5f('0x1c')]===_0xee5f('0x1b');var _0x3c99f1=_0x3f53e4[_0xee5f('0x1d')];var _0x17130d=_0x501727?0x0:_0x49a5b9[_0xee5f('0x1a')];var _0x5632b8=_0x501727?_0x3f53e4[_0xee5f('0x1d')]:_0x49a5b9['offset']+_0x49a5b9[_0xee5f('0x1c')];var _0x423d0f;if(_0x5632b8>=_0x3c99f1){_0x5632b8=_0x3c99f1;_0x423d0f=0xc8;}else{_0x423d0f=0xce;}_0x5797c['status'](_0x423d0f);return _0x5797c[_0xee5f('0x1e')](_0xee5f('0x1f'),_0x17130d+'-'+_0x5632b8+'/'+_0x3c99f1)['json'](_0x3f53e4);}return null;};}function patchUpdates(_0x29169d){return function(_0x217a09){try{jsonpatch[_0xee5f('0x20')](_0x217a09,_0x29169d,!![]);}catch(_0x9b3c43){return BPromise['reject'](_0x9b3c43);}return _0x217a09['save']();};}function saveUpdates(_0x16fefe,_0x90ca75){return function(_0xd81bb9){if(_0xd81bb9){return _0xd81bb9[_0xee5f('0x21')](_0x16fefe)['then'](function(_0x1ff42a){return _0x1ff42a;});}return null;};}function removeEntity(_0x35fe0f,_0x2396a3){return function(_0x77d2c7){if(_0x77d2c7){return _0x77d2c7['destroy']()['then'](function(){var _0x17ff0d=_0x77d2c7[_0xee5f('0x22')]({'plain':!![]});var _0x37ef3e='Sounds';return db[_0xee5f('0x23')][_0xee5f('0x24')]({'where':{'type':_0x37ef3e,'resourceId':_0x17ff0d['id']}})[_0xee5f('0x25')](function(){return _0x77d2c7;});})[_0xee5f('0x25')](function(){_0x35fe0f['status'](0xcc)[_0xee5f('0x17')]();});}};}function handleEntityNotFound(_0x1f4995,_0x275d85){return function(_0x4f3c61){if(!_0x4f3c61){_0x1f4995[_0xee5f('0x26')](0x194);}return _0x4f3c61;};}function handleError(_0x573360,_0x226ffd){_0x226ffd=_0x226ffd||0x1f4;return function(_0xfa9983){logger[_0xee5f('0x27')](_0xfa9983[_0xee5f('0x28')]);if(_0xfa9983[_0xee5f('0x29')]){delete _0xfa9983['name'];}_0x573360['status'](_0x226ffd)[_0xee5f('0x2a')](_0xfa9983);};}exports[_0xee5f('0x2b')]=function(_0x169bfc,_0x5a9345){var _0x2e0278={},_0x2ebebd={},_0x2098bd={'count':0x0,'rows':[]};var _0x2143b6=_['map'](db[_0xee5f('0x2c')][_0xee5f('0x2d')],function(_0x5c2445){return{'name':_0x5c2445['fieldName'],'type':_0x5c2445[_0xee5f('0x2e')][_0xee5f('0x2f')]};});_0x2ebebd[_0xee5f('0x30')]=_[_0xee5f('0x31')](_0x2143b6,_0xee5f('0x29'));_0x2ebebd[_0xee5f('0x32')]=_['keys'](_0x169bfc[_0xee5f('0x32')]);_0x2ebebd[_0xee5f('0x33')]=_[_0xee5f('0x34')](_0x2ebebd['model'],_0x2ebebd[_0xee5f('0x32')]);_0x2e0278[_0xee5f('0x35')]=_[_0xee5f('0x34')](_0x2ebebd['model'],qs[_0xee5f('0x36')](_0x169bfc[_0xee5f('0x32')]['fields']));_0x2e0278[_0xee5f('0x35')]=_0x2e0278[_0xee5f('0x35')][_0xee5f('0x37')]?_0x2e0278[_0xee5f('0x35')]:_0x2ebebd['model'];if(!_0x169bfc[_0xee5f('0x32')]['hasOwnProperty'](_0xee5f('0x38'))){_0x2e0278[_0xee5f('0x1c')]=qs[_0xee5f('0x1c')](_0x169bfc[_0xee5f('0x32')][_0xee5f('0x1c')]);_0x2e0278['offset']=qs['offset'](_0x169bfc['query'][_0xee5f('0x1a')]);}_0x2e0278[_0xee5f('0x39')]=qs[_0xee5f('0x3a')](_0x169bfc[_0xee5f('0x32')]['sort']);_0x2e0278[_0xee5f('0x3b')]=qs['filters'](_[_0xee5f('0x3c')](_0x169bfc[_0xee5f('0x32')],_0x2ebebd[_0xee5f('0x33')]),_0x2143b6);if(_0x169bfc[_0xee5f('0x32')][_0xee5f('0x3d')]){_0x2e0278['where']=_[_0xee5f('0x3e')](_0x2e0278[_0xee5f('0x3b')],{'$or':_[_0xee5f('0x31')](_0x2143b6,function(_0x20fafe){if(_0x20fafe[_0xee5f('0x2e')]!==_0xee5f('0x3f')){var _0x4abaf4={};_0x4abaf4[_0x20fafe[_0xee5f('0x29')]]={'$like':'%'+_0x169bfc[_0xee5f('0x32')]['filter']+'%'};return _0x4abaf4;}})});}_0x2e0278=_[_0xee5f('0x3e')]({},_0x2e0278,_0x169bfc['options']);var _0x30a6f0={'where':_0x2e0278[_0xee5f('0x3b')]};return db[_0xee5f('0x2c')][_0xee5f('0x1d')](_0x30a6f0)[_0xee5f('0x25')](function(_0x49f19f){_0x2098bd[_0xee5f('0x1d')]=_0x49f19f;if(_0x169bfc[_0xee5f('0x32')][_0xee5f('0x40')]){_0x2e0278[_0xee5f('0x41')]=[{'all':!![]}];}return db['Sound'][_0xee5f('0x42')](_0x2e0278);})[_0xee5f('0x25')](function(_0xb7b34e){_0x2098bd[_0xee5f('0x43')]=_0xb7b34e;return _0x2098bd;})['then'](respondWithFilteredResult(_0x5a9345,_0x2e0278))[_0xee5f('0x44')](handleError(_0x5a9345,null));};exports[_0xee5f('0x45')]=function(_0x30d11d,_0x5507d6){var _0x946c61={'raw':!![],'where':{'id':_0x30d11d[_0xee5f('0x46')]['id']}},_0x33d96d={};_0x33d96d[_0xee5f('0x30')]=_[_0xee5f('0x47')](db[_0xee5f('0x2c')]['rawAttributes']);_0x33d96d[_0xee5f('0x32')]=_[_0xee5f('0x47')](_0x30d11d['query']);_0x33d96d[_0xee5f('0x33')]=_[_0xee5f('0x34')](_0x33d96d[_0xee5f('0x30')],_0x33d96d[_0xee5f('0x32')]);_0x946c61[_0xee5f('0x35')]=_[_0xee5f('0x34')](_0x33d96d[_0xee5f('0x30')],qs[_0xee5f('0x36')](_0x30d11d[_0xee5f('0x32')]['fields']));_0x946c61[_0xee5f('0x35')]=_0x946c61['attributes'][_0xee5f('0x37')]?_0x946c61[_0xee5f('0x35')]:_0x33d96d['model'];if(_0x30d11d['query'][_0xee5f('0x40')]){_0x946c61[_0xee5f('0x41')]=[{'all':!![]}];}_0x946c61=_[_0xee5f('0x3e')]({},_0x946c61,_0x30d11d[_0xee5f('0x48')]);return db[_0xee5f('0x2c')][_0xee5f('0x49')](_0x946c61)[_0xee5f('0x25')](handleEntityNotFound(_0x5507d6,null))[_0xee5f('0x25')](respondWithResult(_0x5507d6,null))[_0xee5f('0x44')](handleError(_0x5507d6,null));};exports['download']=function(_0x4a6806,_0x57991c,_0x4564a8){return db[_0xee5f('0x2c')][_0xee5f('0x49')]({'where':{'id':_0x4a6806['params']['id']},'attributes':[_0xee5f('0x29'),_0xee5f('0x4a'),_0xee5f('0x4b')],'raw':!![]})[_0xee5f('0x25')](handleEntityNotFound(_0x57991c,null))[_0xee5f('0x25')](function(_0xe33fb){if(_0xe33fb){if(!fs[_0xee5f('0x4c')](path['join'](config[_0xee5f('0x4d')],_0xee5f('0x4e'),_0xe33fb[_0xee5f('0x4a')]+'.'+_0xe33fb[_0xee5f('0x4b')]))){throw new db[(_0xee5f('0x4f'))][(_0xee5f('0x50'))]('Sound\x20not\x20found');}return _0x57991c[_0xee5f('0x51')](path[_0xee5f('0x52')](config[_0xee5f('0x4d')],_0xee5f('0x4e'),util[_0xee5f('0x53')](_0xee5f('0x54'),_0xe33fb['save_name'],_0xe33fb[_0xee5f('0x4b')])),util[_0xee5f('0x53')](_0xee5f('0x54'),_0xe33fb['name'],_0xe33fb[_0xee5f('0x4b')]));}return null;})['catch'](handleError(_0x57991c,null));};exports[_0xee5f('0x55')]=function(_0x35a31c,_0x2f1a0b,_0x1aa5b){var _0x3502d8={'name':path['basename'](_0x35a31c[_0xee5f('0x56')][_0xee5f('0x57')],path[_0xee5f('0x58')](_0x35a31c[_0xee5f('0x56')][_0xee5f('0x57')])),'save_name':path['basename'](_0x35a31c[_0xee5f('0x56')][_0xee5f('0x59')],path[_0xee5f('0x58')](_0x35a31c[_0xee5f('0x56')]['filename'])),'original_format':path['extname'](_0x35a31c[_0xee5f('0x56')][_0xee5f('0x57')])['substring'](0x1),'converted_format':_0xee5f('0x5a')};var _0x24a51c=path[_0xee5f('0x52')](config['root'],_0xee5f('0x5b'),_0x35a31c[_0xee5f('0x56')]['filename']);var _0x35d131=path[_0xee5f('0x52')](config[_0xee5f('0x4d')],_0xee5f('0x4e'),util[_0xee5f('0x53')]('%s.%s',path[_0xee5f('0x5c')](_0x35a31c[_0xee5f('0x56')][_0xee5f('0x59')],path['extname'](_0x35a31c['file'][_0xee5f('0x59')])),_0x3502d8[_0xee5f('0x4b')]));logger[_0xee5f('0x5d')](_0xee5f('0x5e'),_0x24a51c);logger[_0xee5f('0x5d')](_0xee5f('0x5f'),_0x35d131);try{fs[_0xee5f('0x60')](_0x24a51c,parseInt(_0xee5f('0x61'),0x8));var _0x4586ea=sox[_0xee5f('0x62')](_0x24a51c,_0x35d131,{'sampleRate':0x1f40,'format':_0xee5f('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4586ea['on'](_0xee5f('0x27'),function(_0x36afae){fs[_0xee5f('0x63')](_0x24a51c);_0x2f1a0b[_0xee5f('0x18')](0x1f4)[_0xee5f('0x2a')](_0x36afae);});_0x4586ea['on'](_0xee5f('0x64'),function(_0x4dd69a){_0x3502d8[_0xee5f('0x65')]=isNaN(_0x4dd69a[_0xee5f('0x66')])?null:_0x4dd69a[_0xee5f('0x66')]*0x3e8;_0x3502d8[_0xee5f('0x67')]=isNaN(_0x4dd69a[_0xee5f('0x68')])?null:_0x4dd69a[_0xee5f('0x68')];_0x3502d8[_0xee5f('0x69')]=isNaN(_0x4dd69a['channelCount'])?null:_0x4dd69a['channelCount'];_0x3502d8[_0xee5f('0x6a')]=isNaN(_0x4dd69a[_0xee5f('0x6b')])?null:_0x4dd69a['bitRate'];_0x3502d8[_0xee5f('0x6c')]=isNaN(_0x4dd69a[_0xee5f('0x6d')])?null:_0x4dd69a[_0xee5f('0x6d')];});_0x4586ea['on']('dest',function(_0x468eb8){_0x3502d8[_0xee5f('0x6e')]=isNaN(_0x468eb8[_0xee5f('0x66')])?null:_0x468eb8[_0xee5f('0x66')]*0x3e8;_0x3502d8['converted_sampleCount']=isNaN(_0x468eb8['sampleCount'])?null:_0x468eb8[_0xee5f('0x68')];_0x3502d8[_0xee5f('0x6f')]=isNaN(_0x468eb8[_0xee5f('0x70')])?null:_0x468eb8['channelCount'];_0x3502d8[_0xee5f('0x71')]=isNaN(_0x468eb8[_0xee5f('0x6b')])?null:_0x468eb8['bitRate'];_0x3502d8[_0xee5f('0x72')]=isNaN(_0x468eb8['sampleRate'])?null:_0x468eb8[_0xee5f('0x6d')];});_0x4586ea['on'](_0xee5f('0x17'),function(){fs[_0xee5f('0x60')](_0x35d131,parseInt('0777',0x8));return db['Sound'][_0xee5f('0x55')](_0x3502d8)[_0xee5f('0x25')](function(_0x4d77b7){var _0x3f50a1={'role':_0x35a31c[_0xee5f('0x73')][_0xee5f('0x74')],'userProfileId':_0x35a31c[_0xee5f('0x73')][_0xee5f('0x75')]};if(!_0x3f50a1)throw new Error(_0xee5f('0x76'));if(_0x3f50a1[_0xee5f('0x74')]===_0xee5f('0x77')){var _0x3510b2=_0x4d77b7[_0xee5f('0x22')]({'plain':!![]});return db[_0xee5f('0x78')]['find']({'where':{'name':_0xee5f('0x79'),'userProfileId':_0x3f50a1[_0xee5f('0x75')]},'raw':!![]})[_0xee5f('0x25')](function(_0x2ad449){if(_0x2ad449&&_0x2ad449[_0xee5f('0x7a')]===0x0){return db[_0xee5f('0x23')][_0xee5f('0x55')]({'name':_0x3510b2['name'],'resourceId':_0x3510b2['id'],'type':_0x2ad449[_0xee5f('0x29')],'sectionId':_0x2ad449['id']},{})[_0xee5f('0x25')](function(){return _0x4d77b7;});}else{return _0x4d77b7;}})[_0xee5f('0x44')](function(_0x5f4782){logger['error'](_0xee5f('0x7b'),_0x5f4782);throw _0x5f4782;});}return _0x4d77b7;})[_0xee5f('0x25')](respondWithResult(_0x2f1a0b,null))[_0xee5f('0x44')](handleError(_0x2f1a0b,null));});_0x4586ea[_0xee5f('0x7c')]();}catch(_0x3a0b8d){_0x2f1a0b['status'](0x1f4)[_0xee5f('0x2a')](_0x3a0b8d);}};exports['update']=function(_0x2232f4,_0x35efb3,_0x1c8688){return db[_0xee5f('0x2c')][_0xee5f('0x49')]({'where':{'id':_0x2232f4[_0xee5f('0x46')]['id']}})[_0xee5f('0x25')](handleEntityNotFound(_0x35efb3,null))[_0xee5f('0x25')](saveUpdates(_[_0xee5f('0x3c')](_0x2232f4[_0xee5f('0x73')],[_0xee5f('0x29'),_0xee5f('0x7d')]),null))[_0xee5f('0x25')](respondWithResult(_0x35efb3,null))['catch'](handleError(_0x35efb3,null));};exports['delete']=function(_0x200540,_0x1fd6fe,_0x3e16f3){return db[_0xee5f('0x2c')][_0xee5f('0x49')]({'where':{'id':_0x200540[_0xee5f('0x46')]['id']}})[_0xee5f('0x25')](function(_0x196900){if(_0x196900){return _0x196900[_0xee5f('0x24')]();}})['then'](function(_0x4ec728){var _0x338290=path['join'](config[_0xee5f('0x4d')],_0xee5f('0x5b'),util[_0xee5f('0x53')]('%s.%s',_0x4ec728[_0xee5f('0x4a')],_0x4ec728[_0xee5f('0x7e')]));var _0x27345f=path[_0xee5f('0x52')](config[_0xee5f('0x4d')],_0xee5f('0x4e'),util[_0xee5f('0x53')](_0xee5f('0x54'),_0x4ec728[_0xee5f('0x4a')],_0x4ec728[_0xee5f('0x4b')]));fs['unlinkSync'](_0x338290);fs['unlinkSync'](_0x27345f);return _0x4ec728;})[_0xee5f('0x25')](function(_0xfcca6){if(_0xfcca6){return _0x1fd6fe[_0xee5f('0x18')](0xcc)[_0xee5f('0x17')]();}})[_0xee5f('0x25')](handleEntityNotFound(_0x1fd6fe,null))[_0xee5f('0x44')](handleError(_0x1fd6fe,null));}; \ No newline at end of file +var _0x59d0=['UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','Sound','includeAll','include','findAll','show','download','find','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','catch','basename','file','originalname','filename','extname','substring','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','0777','create','role','body','userProfileId','user','UserProfileSection','autoAssociation','start','update','params','description','delete','server/files/sounds/original','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','Sounds'];(function(_0x42c713,_0x259859){var _0xd3e94c=function(_0x4c6e00){while(--_0x4c6e00){_0x42c713['push'](_0x42c713['shift']());}};_0xd3e94c(++_0x259859);}(_0x59d0,0x1e2));var _0x059d=function(_0x2d5423,_0x22801d){_0x2d5423=_0x2d5423-0x0;var _0x3c5a53=_0x59d0[_0x2d5423];return _0x3c5a53;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x059d('0x0'));var zipdir=require(_0x059d('0x1'));var jsonpatch=require(_0x059d('0x2'));var rp=require(_0x059d('0x3'));var moment=require(_0x059d('0x4'));var BPromise=require(_0x059d('0x5'));var Mustache=require(_0x059d('0x6'));var util=require(_0x059d('0x7'));var path=require(_0x059d('0x8'));var sox=require(_0x059d('0x9'));var csv=require(_0x059d('0xa'));var ejs=require(_0x059d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x059d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x059d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x059d('0xe'));var Papa=require(_0x059d('0xf'));var Redis=require(_0x059d('0x10'));var authService=require(_0x059d('0x11'));var qs=require(_0x059d('0x12'));var as=require(_0x059d('0x13'));var hardwareService=require(_0x059d('0x14'));var logger=require('../../config/logger')(_0x059d('0x15'));var utils=require(_0x059d('0x16'));var config=require(_0x059d('0x17'));var licenseUtil=require(_0x059d('0x18'));var db=require(_0x059d('0x19'))['db'];function respondWithStatusCode(_0x36f89c,_0x32c8c9){_0x32c8c9=_0x32c8c9||0xcc;return function(_0x8925fb){if(_0x8925fb){return _0x36f89c['sendStatus'](_0x32c8c9);}return _0x36f89c[_0x059d('0x1a')](_0x32c8c9)[_0x059d('0x1b')]();};}function respondWithResult(_0x3cbe53,_0x17b550){_0x17b550=_0x17b550||0xc8;return function(_0x591981){if(_0x591981){return _0x3cbe53[_0x059d('0x1a')](_0x17b550)[_0x059d('0x1c')](_0x591981);}};}function respondWithFilteredResult(_0xd0e940,_0x3bdec6){return function(_0x17cfb2){if(_0x17cfb2){var _0x2f697f=typeof _0x3bdec6[_0x059d('0x1d')]===_0x059d('0x1e')&&typeof _0x3bdec6[_0x059d('0x1f')]==='undefined';var _0x234b51=_0x17cfb2[_0x059d('0x20')];var _0x4cc51c=_0x2f697f?0x0:_0x3bdec6[_0x059d('0x1d')];var _0x2e30e8=_0x2f697f?_0x17cfb2[_0x059d('0x20')]:_0x3bdec6[_0x059d('0x1d')]+_0x3bdec6[_0x059d('0x1f')];var _0x497d47;if(_0x2e30e8>=_0x234b51){_0x2e30e8=_0x234b51;_0x497d47=0xc8;}else{_0x497d47=0xce;}_0xd0e940[_0x059d('0x1a')](_0x497d47);return _0xd0e940[_0x059d('0x21')](_0x059d('0x22'),_0x4cc51c+'-'+_0x2e30e8+'/'+_0x234b51)[_0x059d('0x1c')](_0x17cfb2);}return null;};}function patchUpdates(_0x5375e1){return function(_0x216b60){try{jsonpatch[_0x059d('0x23')](_0x216b60,_0x5375e1,!![]);}catch(_0x249aeb){return BPromise[_0x059d('0x24')](_0x249aeb);}return _0x216b60[_0x059d('0x25')]();};}function saveUpdates(_0x525a4c,_0xeb2a20){return function(_0x20a8d2){if(_0x20a8d2){return _0x20a8d2['update'](_0x525a4c)['then'](function(_0x1ebb06){return _0x1ebb06;});}return null;};}function removeEntity(_0x1734c9,_0x38fc73){return function(_0x4de426){if(_0x4de426){return _0x4de426[_0x059d('0x26')]()[_0x059d('0x27')](function(){var _0x2808fc=_0x4de426[_0x059d('0x28')]({'plain':!![]});var _0x5e1477=_0x059d('0x29');return db[_0x059d('0x2a')][_0x059d('0x26')]({'where':{'type':_0x5e1477,'resourceId':_0x2808fc['id']}})[_0x059d('0x27')](function(){return _0x4de426;});})[_0x059d('0x27')](function(){_0x1734c9[_0x059d('0x1a')](0xcc)[_0x059d('0x1b')]();});}};}function handleEntityNotFound(_0x216568,_0x31b81d){return function(_0x5702c4){if(!_0x5702c4){_0x216568[_0x059d('0x2b')](0x194);}return _0x5702c4;};}function handleError(_0x18bfff,_0x5cad9a){_0x5cad9a=_0x5cad9a||0x1f4;return function(_0x46f77b){logger[_0x059d('0x2c')](_0x46f77b[_0x059d('0x2d')]);if(_0x46f77b[_0x059d('0x2e')]){delete _0x46f77b[_0x059d('0x2e')];}_0x18bfff['status'](_0x5cad9a)[_0x059d('0x2f')](_0x46f77b);};}exports[_0x059d('0x30')]=function(_0x29bcdf,_0x50ae5b){var _0x1c0ff0={},_0x418407={},_0x5d7350={'count':0x0,'rows':[]};var _0x11eb81=_['map'](db['Sound'][_0x059d('0x31')],function(_0x38e83f){return{'name':_0x38e83f[_0x059d('0x32')],'type':_0x38e83f['type']['key']};});_0x418407[_0x059d('0x33')]=_[_0x059d('0x34')](_0x11eb81,_0x059d('0x2e'));_0x418407[_0x059d('0x35')]=_[_0x059d('0x36')](_0x29bcdf['query']);_0x418407[_0x059d('0x37')]=_[_0x059d('0x38')](_0x418407[_0x059d('0x33')],_0x418407[_0x059d('0x35')]);_0x1c0ff0[_0x059d('0x39')]=_['intersection'](_0x418407['model'],qs[_0x059d('0x3a')](_0x29bcdf[_0x059d('0x35')][_0x059d('0x3a')]));_0x1c0ff0[_0x059d('0x39')]=_0x1c0ff0[_0x059d('0x39')][_0x059d('0x3b')]?_0x1c0ff0[_0x059d('0x39')]:_0x418407['model'];if(!_0x29bcdf[_0x059d('0x35')][_0x059d('0x3c')](_0x059d('0x3d'))){_0x1c0ff0['limit']=qs['limit'](_0x29bcdf[_0x059d('0x35')][_0x059d('0x1f')]);_0x1c0ff0[_0x059d('0x1d')]=qs[_0x059d('0x1d')](_0x29bcdf['query'][_0x059d('0x1d')]);}_0x1c0ff0[_0x059d('0x3e')]=qs[_0x059d('0x3f')](_0x29bcdf[_0x059d('0x35')][_0x059d('0x3f')]);_0x1c0ff0['where']=qs[_0x059d('0x37')](_[_0x059d('0x40')](_0x29bcdf['query'],_0x418407[_0x059d('0x37')]),_0x11eb81);if(_0x29bcdf[_0x059d('0x35')]['filter']){_0x1c0ff0[_0x059d('0x41')]=_[_0x059d('0x42')](_0x1c0ff0[_0x059d('0x41')],{'$or':_[_0x059d('0x34')](_0x11eb81,function(_0x1275b3){if(_0x1275b3[_0x059d('0x43')]!==_0x059d('0x44')){var _0x391096={};_0x391096[_0x1275b3[_0x059d('0x2e')]]={'$like':'%'+_0x29bcdf[_0x059d('0x35')][_0x059d('0x45')]+'%'};return _0x391096;}})});}_0x1c0ff0=_[_0x059d('0x42')]({},_0x1c0ff0,_0x29bcdf[_0x059d('0x46')]);var _0x43d36f={'where':_0x1c0ff0[_0x059d('0x41')]};return db[_0x059d('0x47')][_0x059d('0x20')](_0x43d36f)[_0x059d('0x27')](function(_0x26f20b){_0x5d7350[_0x059d('0x20')]=_0x26f20b;if(_0x29bcdf[_0x059d('0x35')][_0x059d('0x48')]){_0x1c0ff0[_0x059d('0x49')]=[{'all':!![]}];}return db[_0x059d('0x47')][_0x059d('0x4a')](_0x1c0ff0);})[_0x059d('0x27')](function(_0x136a09){_0x5d7350['rows']=_0x136a09;return _0x5d7350;})[_0x059d('0x27')](respondWithFilteredResult(_0x50ae5b,_0x1c0ff0))['catch'](handleError(_0x50ae5b,null));};exports[_0x059d('0x4b')]=function(_0x41f9b3,_0x10666e){var _0x216644={'raw':!![],'where':{'id':_0x41f9b3['params']['id']}},_0x378df5={};_0x378df5[_0x059d('0x33')]=_[_0x059d('0x36')](db['Sound'][_0x059d('0x31')]);_0x378df5[_0x059d('0x35')]=_[_0x059d('0x36')](_0x41f9b3[_0x059d('0x35')]);_0x378df5[_0x059d('0x37')]=_[_0x059d('0x38')](_0x378df5['model'],_0x378df5[_0x059d('0x35')]);_0x216644[_0x059d('0x39')]=_[_0x059d('0x38')](_0x378df5[_0x059d('0x33')],qs['fields'](_0x41f9b3['query']['fields']));_0x216644[_0x059d('0x39')]=_0x216644[_0x059d('0x39')][_0x059d('0x3b')]?_0x216644[_0x059d('0x39')]:_0x378df5['model'];if(_0x41f9b3[_0x059d('0x35')][_0x059d('0x48')]){_0x216644[_0x059d('0x49')]=[{'all':!![]}];}_0x216644=_[_0x059d('0x42')]({},_0x216644,_0x41f9b3[_0x059d('0x46')]);return db[_0x059d('0x47')]['find'](_0x216644)[_0x059d('0x27')](handleEntityNotFound(_0x10666e,null))[_0x059d('0x27')](respondWithResult(_0x10666e,null))['catch'](handleError(_0x10666e,null));};exports[_0x059d('0x4c')]=function(_0x3e53d3,_0x26e768,_0x541cfb){return db[_0x059d('0x47')][_0x059d('0x4d')]({'where':{'id':_0x3e53d3['params']['id']},'attributes':['name',_0x059d('0x4e'),_0x059d('0x4f')],'raw':!![]})[_0x059d('0x27')](handleEntityNotFound(_0x26e768,null))['then'](function(_0x5dfe8a){if(_0x5dfe8a){if(!fs[_0x059d('0x50')](path[_0x059d('0x51')](config['root'],_0x059d('0x52'),_0x5dfe8a[_0x059d('0x4e')]+'.'+_0x5dfe8a[_0x059d('0x4f')]))){throw new db[(_0x059d('0x53'))][(_0x059d('0x54'))](_0x059d('0x55'));}return _0x26e768[_0x059d('0x4c')](path[_0x059d('0x51')](config[_0x059d('0x56')],_0x059d('0x52'),util[_0x059d('0x57')](_0x059d('0x58'),_0x5dfe8a[_0x059d('0x4e')],_0x5dfe8a[_0x059d('0x4f')])),util[_0x059d('0x57')](_0x059d('0x58'),_0x5dfe8a[_0x059d('0x2e')],_0x5dfe8a[_0x059d('0x4f')]));}return null;})[_0x059d('0x59')](handleError(_0x26e768,null));};exports['create']=function(_0x12671b,_0x10e4b8,_0x6ae92){var _0x27c77a={'name':path[_0x059d('0x5a')](_0x12671b[_0x059d('0x5b')]['originalname'],path['extname'](_0x12671b[_0x059d('0x5b')][_0x059d('0x5c')])),'save_name':path[_0x059d('0x5a')](_0x12671b[_0x059d('0x5b')][_0x059d('0x5d')],path[_0x059d('0x5e')](_0x12671b[_0x059d('0x5b')][_0x059d('0x5d')])),'original_format':path[_0x059d('0x5e')](_0x12671b[_0x059d('0x5b')]['originalname'])[_0x059d('0x5f')](0x1),'converted_format':'wav'};var _0x2b9d5e=path[_0x059d('0x51')](config[_0x059d('0x56')],'server/files/sounds/original',_0x12671b[_0x059d('0x5b')]['filename']);var _0x33a550=path[_0x059d('0x51')](config[_0x059d('0x56')],_0x059d('0x52'),util[_0x059d('0x57')](_0x059d('0x58'),path['basename'](_0x12671b[_0x059d('0x5b')]['filename'],path[_0x059d('0x5e')](_0x12671b[_0x059d('0x5b')][_0x059d('0x5d')])),_0x27c77a[_0x059d('0x4f')]));logger[_0x059d('0x60')](_0x059d('0x61'),_0x2b9d5e);logger[_0x059d('0x60')](_0x059d('0x62'),_0x33a550);try{fs[_0x059d('0x63')](_0x2b9d5e,parseInt('0777',0x8));var _0xb6ba34=sox[_0x059d('0x64')](_0x2b9d5e,_0x33a550,{'sampleRate':0x1f40,'format':_0x059d('0x65'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xb6ba34['on'](_0x059d('0x2c'),function(_0x3a815c){fs[_0x059d('0x66')](_0x2b9d5e);_0x10e4b8[_0x059d('0x1a')](0x1f4)[_0x059d('0x2f')](_0x3a815c);});_0xb6ba34['on'](_0x059d('0x67'),function(_0x1e48bc){_0x27c77a[_0x059d('0x68')]=isNaN(_0x1e48bc[_0x059d('0x69')])?null:_0x1e48bc[_0x059d('0x69')]*0x3e8;_0x27c77a[_0x059d('0x6a')]=isNaN(_0x1e48bc[_0x059d('0x6b')])?null:_0x1e48bc[_0x059d('0x6b')];_0x27c77a[_0x059d('0x6c')]=isNaN(_0x1e48bc[_0x059d('0x6d')])?null:_0x1e48bc[_0x059d('0x6d')];_0x27c77a['original_bitRate']=isNaN(_0x1e48bc[_0x059d('0x6e')])?null:_0x1e48bc['bitRate'];_0x27c77a[_0x059d('0x6f')]=isNaN(_0x1e48bc[_0x059d('0x70')])?null:_0x1e48bc[_0x059d('0x70')];});_0xb6ba34['on'](_0x059d('0x71'),function(_0x27469c){_0x27c77a[_0x059d('0x72')]=isNaN(_0x27469c[_0x059d('0x69')])?null:_0x27469c['duration']*0x3e8;_0x27c77a[_0x059d('0x73')]=isNaN(_0x27469c[_0x059d('0x6b')])?null:_0x27469c[_0x059d('0x6b')];_0x27c77a['converted_channelCount']=isNaN(_0x27469c['channelCount'])?null:_0x27469c[_0x059d('0x6d')];_0x27c77a[_0x059d('0x74')]=isNaN(_0x27469c[_0x059d('0x6e')])?null:_0x27469c[_0x059d('0x6e')];_0x27c77a['converted_sampleRate']=isNaN(_0x27469c[_0x059d('0x70')])?null:_0x27469c[_0x059d('0x70')];});_0xb6ba34['on'](_0x059d('0x1b'),function(){fs[_0x059d('0x63')](_0x33a550,parseInt(_0x059d('0x75'),0x8));return db['Sound'][_0x059d('0x76')](_0x27c77a)[_0x059d('0x27')](function(_0x35d35a){var _0x21d008={'role':_0x12671b['body'][_0x059d('0x77')],'userProfileId':_0x12671b[_0x059d('0x78')][_0x059d('0x79')]};if(!_0x21d008)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21d008['role']===_0x059d('0x7a')){var _0x3061aa=_0x35d35a[_0x059d('0x28')]({'plain':!![]});return db[_0x059d('0x7b')][_0x059d('0x4d')]({'where':{'name':_0x059d('0x29'),'userProfileId':_0x21d008[_0x059d('0x79')]},'raw':!![]})[_0x059d('0x27')](function(_0x57f8bf){if(_0x57f8bf&&_0x57f8bf[_0x059d('0x7c')]===0x0){return db[_0x059d('0x2a')][_0x059d('0x76')]({'name':_0x3061aa[_0x059d('0x2e')],'resourceId':_0x3061aa['id'],'type':_0x57f8bf[_0x059d('0x2e')],'sectionId':_0x57f8bf['id']},{})[_0x059d('0x27')](function(){return _0x35d35a;});}else{return _0x35d35a;}})[_0x059d('0x59')](function(_0x400b04){logger[_0x059d('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x400b04);throw _0x400b04;});}return _0x35d35a;})['then'](respondWithResult(_0x10e4b8,null))[_0x059d('0x59')](handleError(_0x10e4b8,null));});_0xb6ba34[_0x059d('0x7d')]();}catch(_0x3da9f8){_0x10e4b8['status'](0x1f4)[_0x059d('0x2f')](_0x3da9f8);}};exports[_0x059d('0x7e')]=function(_0x55a5c8,_0x26597e,_0x49a6e1){return db[_0x059d('0x47')][_0x059d('0x4d')]({'where':{'id':_0x55a5c8[_0x059d('0x7f')]['id']}})[_0x059d('0x27')](handleEntityNotFound(_0x26597e,null))[_0x059d('0x27')](saveUpdates(_[_0x059d('0x40')](_0x55a5c8[_0x059d('0x78')],[_0x059d('0x2e'),_0x059d('0x80')]),null))['then'](respondWithResult(_0x26597e,null))[_0x059d('0x59')](handleError(_0x26597e,null));};exports[_0x059d('0x81')]=function(_0x17f9f3,_0x24cab2,_0x2ec435){return db[_0x059d('0x47')][_0x059d('0x4d')]({'where':{'id':_0x17f9f3[_0x059d('0x7f')]['id']}})[_0x059d('0x27')](function(_0x58b4b8){if(_0x58b4b8){return _0x58b4b8[_0x059d('0x26')]();}})[_0x059d('0x27')](function(_0x56e7b6){var _0x12d8f0=path[_0x059d('0x51')](config['root'],_0x059d('0x82'),util['format'](_0x059d('0x58'),_0x56e7b6['save_name'],_0x56e7b6['original_format']));var _0xf1934e=path[_0x059d('0x51')](config[_0x059d('0x56')],'server/files/sounds/converted',util[_0x059d('0x57')](_0x059d('0x58'),_0x56e7b6['save_name'],_0x56e7b6[_0x059d('0x4f')]));fs[_0x059d('0x66')](_0x12d8f0);fs['unlinkSync'](_0xf1934e);return _0x56e7b6;})[_0x059d('0x27')](function(_0x585e0e){if(_0x585e0e){return _0x24cab2['status'](0xcc)[_0x059d('0x1b')]();}})[_0x059d('0x27')](handleEntityNotFound(_0x24cab2,null))['catch'](handleError(_0x24cab2,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 939ab1a..0f41c00 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 _0xd63f=['util','api','moment','request-promise','rimraf','../../config/environment','./sound.attributes','exports','Sound','tools_sounds','lodash'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd63f,0x196));var _0xfd63=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd63f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfd63('0x0'));var util=require(_0xfd63('0x1'));var logger=require('../../config/logger')(_0xfd63('0x2'));var moment=require(_0xfd63('0x3'));var BPromise=require('bluebird');var rp=require(_0xfd63('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd63('0x5'));var config=require(_0xfd63('0x6'));var attributes=require(_0xfd63('0x7'));module[_0xfd63('0x8')]=function(_0x25a1ba,_0x17eb95){return _0x25a1ba['define'](_0xfd63('0x9'),attributes,{'tableName':_0xfd63('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x576a=['./sound.attributes','define','Sound','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x59a5d0,_0x4b3308){var _0x6840ac=function(_0x2dadf5){while(--_0x2dadf5){_0x59a5d0['push'](_0x59a5d0['shift']());}};_0x6840ac(++_0x4b3308);}(_0x576a,0xc9));var _0xa576=function(_0xc96e57,_0x366dbc){_0xc96e57=_0xc96e57-0x0;var _0x48feee=_0x576a[_0xc96e57];return _0x48feee;};'use strict';var _=require('lodash');var util=require(_0xa576('0x0'));var logger=require(_0xa576('0x1'))('api');var moment=require(_0xa576('0x2'));var BPromise=require(_0xa576('0x3'));var rp=require(_0xa576('0x4'));var fs=require('fs');var path=require(_0xa576('0x5'));var rimraf=require(_0xa576('0x6'));var config=require(_0xa576('0x7'));var attributes=require(_0xa576('0x8'));module['exports']=function(_0x3019f9,_0x3b13a5){return _0x3019f9[_0xa576('0x9')](_0xa576('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 2c4622b..1d71dd6 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 _0x5790=['client','http','request','then','info','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','error','Sound,\x20%s,\x20%s','message','catch','ShowSound','Sound','find','options','raw','where','include','map','model','attributes','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x5790,0xf7));var _0x0579=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5790[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x0579('0x0'));var util=require('util');var moment=require(_0x0579('0x1'));var BPromise=require(_0x0579('0x2'));var rs=require(_0x0579('0x3'));var fs=require('fs');var Redis=require(_0x0579('0x4'));var db=require(_0x0579('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0579('0x6'))(_0x0579('0x7'));var config=require('../../config/environment');var jayson=require(_0x0579('0x8'));var client=jayson[_0x0579('0x9')][_0x0579('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31f715,_0xe666c5,_0xe0efd9){return new BPromise(function(_0x23671f,_0x42ddaf){return client[_0x0579('0xb')](_0x31f715,_0xe0efd9)[_0x0579('0xc')](function(_0x5b624a){logger[_0x0579('0xd')]('Sound,\x20%s,\x20%s',_0xe666c5,'request\x20sent');logger[_0x0579('0xe')](_0x0579('0xf'),_0xe666c5,_0x0579('0x10'),JSON['stringify'](_0x5b624a));if(_0x5b624a[_0x0579('0x11')]){if(_0x5b624a[_0x0579('0x11')]['code']===0x1f4){logger['error'](_0x0579('0x12'),_0xe666c5,_0x5b624a['error']['message']);return _0x42ddaf(_0x5b624a[_0x0579('0x11')]['message']);}logger[_0x0579('0x11')](_0x0579('0x12'),_0xe666c5,_0x5b624a[_0x0579('0x11')][_0x0579('0x13')]);return _0x23671f(_0x5b624a[_0x0579('0x11')][_0x0579('0x13')]);}else{logger[_0x0579('0xd')](_0x0579('0x12'),_0xe666c5,_0x0579('0x10'));_0x23671f(_0x5b624a['result'][_0x0579('0x13')]);}})[_0x0579('0x14')](function(_0x3dfe9c){logger[_0x0579('0x11')](_0x0579('0x12'),_0xe666c5,_0x3dfe9c);_0x42ddaf(_0x3dfe9c);});});}exports[_0x0579('0x15')]=function(_0x5ec15d){var _0x39ff26=this;return new Promise(function(_0x253578,_0x4f185f){return db[_0x0579('0x16')][_0x0579('0x17')]({'raw':_0x5ec15d[_0x0579('0x18')]?_0x5ec15d[_0x0579('0x18')][_0x0579('0x19')]===undefined?!![]:![]:!![],'where':_0x5ec15d[_0x0579('0x18')]?_0x5ec15d[_0x0579('0x18')][_0x0579('0x1a')]||null:null,'attributes':_0x5ec15d[_0x0579('0x18')]?_0x5ec15d[_0x0579('0x18')]['attributes']||null:null,'include':_0x5ec15d[_0x0579('0x18')]?_0x5ec15d['options'][_0x0579('0x1b')]?_[_0x0579('0x1c')](_0x5ec15d[_0x0579('0x18')][_0x0579('0x1b')],function(_0x3c25bd){return{'model':db[_0x3c25bd[_0x0579('0x1d')]],'as':_0x3c25bd['as'],'attributes':_0x3c25bd[_0x0579('0x1e')],'include':_0x3c25bd['include']?_['map'](_0x3c25bd[_0x0579('0x1b')],function(_0x5ec6ca){return{'model':db[_0x5ec6ca[_0x0579('0x1d')]],'as':_0x5ec6ca['as'],'attributes':_0x5ec6ca[_0x0579('0x1e')],'include':_0x5ec6ca[_0x0579('0x1b')]?_[_0x0579('0x1c')](_0x5ec6ca[_0x0579('0x1b')],function(_0x2f06b7){return{'model':db[_0x2f06b7[_0x0579('0x1d')]],'as':_0x2f06b7['as'],'attributes':_0x2f06b7[_0x0579('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0579('0xc')](function(_0x59b49f){logger[_0x0579('0xd')](_0x0579('0x15'),_0x5ec15d);logger[_0x0579('0xe')]('ShowSound',_0x5ec15d,JSON[_0x0579('0x1f')](_0x59b49f));_0x253578(_0x59b49f);})[_0x0579('0x14')](function(_0x52dc04){logger['error'](_0x0579('0x15'),_0x52dc04[_0x0579('0x13')],_0x5ec15d);_0x4f185f(_0x39ff26[_0x0579('0x11')](0x1f4,_0x52dc04[_0x0579('0x13')]));});});}; \ No newline at end of file +var _0xc2c4=['raw','attributes','include','map','model','ShowSound','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','find','options'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xc2c4,0x10b));var _0x4c2c=function(_0x184429,_0x5e820b){_0x184429=_0x184429-0x0;var _0x47c2aa=_0xc2c4[_0x184429];return _0x47c2aa;};'use strict';var _=require('lodash');var util=require(_0x4c2c('0x0'));var moment=require(_0x4c2c('0x1'));var BPromise=require(_0x4c2c('0x2'));var rs=require(_0x4c2c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4c2c('0x4'))(_0x4c2c('0x5'));var config=require(_0x4c2c('0x6'));var jayson=require(_0x4c2c('0x7'));var client=jayson['client'][_0x4c2c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x541043,_0x4cbb0b,_0x4d4825){return new BPromise(function(_0x16e019,_0x171133){return client[_0x4c2c('0x9')](_0x541043,_0x4d4825)[_0x4c2c('0xa')](function(_0x40923b){logger['info'](_0x4c2c('0xb'),_0x4cbb0b,_0x4c2c('0xc'));logger[_0x4c2c('0xd')](_0x4c2c('0xe'),_0x4cbb0b,'request\x20sent',JSON[_0x4c2c('0xf')](_0x40923b));if(_0x40923b[_0x4c2c('0x10')]){if(_0x40923b[_0x4c2c('0x10')]['code']===0x1f4){logger[_0x4c2c('0x10')](_0x4c2c('0xb'),_0x4cbb0b,_0x40923b['error']['message']);return _0x171133(_0x40923b[_0x4c2c('0x10')][_0x4c2c('0x11')]);}logger[_0x4c2c('0x10')](_0x4c2c('0xb'),_0x4cbb0b,_0x40923b[_0x4c2c('0x10')][_0x4c2c('0x11')]);return _0x16e019(_0x40923b['error'][_0x4c2c('0x11')]);}else{logger[_0x4c2c('0x12')](_0x4c2c('0xb'),_0x4cbb0b,_0x4c2c('0xc'));_0x16e019(_0x40923b[_0x4c2c('0x13')]['message']);}})[_0x4c2c('0x14')](function(_0x5d8301){logger['error'](_0x4c2c('0xb'),_0x4cbb0b,_0x5d8301);_0x171133(_0x5d8301);});});}exports['ShowSound']=function(_0x16f732){var _0xbc7522=this;return new Promise(function(_0x13d771,_0x288b6f){return db['Sound'][_0x4c2c('0x15')]({'raw':_0x16f732[_0x4c2c('0x16')]?_0x16f732[_0x4c2c('0x16')][_0x4c2c('0x17')]===undefined?!![]:![]:!![],'where':_0x16f732[_0x4c2c('0x16')]?_0x16f732[_0x4c2c('0x16')]['where']||null:null,'attributes':_0x16f732[_0x4c2c('0x16')]?_0x16f732[_0x4c2c('0x16')][_0x4c2c('0x18')]||null:null,'include':_0x16f732['options']?_0x16f732[_0x4c2c('0x16')][_0x4c2c('0x19')]?_[_0x4c2c('0x1a')](_0x16f732[_0x4c2c('0x16')][_0x4c2c('0x19')],function(_0x274287){return{'model':db[_0x274287[_0x4c2c('0x1b')]],'as':_0x274287['as'],'attributes':_0x274287[_0x4c2c('0x18')],'include':_0x274287[_0x4c2c('0x19')]?_[_0x4c2c('0x1a')](_0x274287['include'],function(_0x315e8b){return{'model':db[_0x315e8b[_0x4c2c('0x1b')]],'as':_0x315e8b['as'],'attributes':_0x315e8b['attributes'],'include':_0x315e8b[_0x4c2c('0x19')]?_[_0x4c2c('0x1a')](_0x315e8b[_0x4c2c('0x19')],function(_0x22830a){return{'model':db[_0x22830a['model']],'as':_0x22830a['as'],'attributes':_0x22830a[_0x4c2c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4c2c('0xa')](function(_0x100c65){logger[_0x4c2c('0x12')](_0x4c2c('0x1c'),_0x16f732);logger[_0x4c2c('0xd')](_0x4c2c('0x1c'),_0x16f732,JSON[_0x4c2c('0xf')](_0x100c65));_0x13d771(_0x100c65);})[_0x4c2c('0x14')](function(_0x91ee16){logger[_0x4c2c('0x10')](_0x4c2c('0x1c'),_0x91ee16[_0x4c2c('0x11')],_0x16f732);_0x288b6f(_0xbc7522[_0x4c2c('0x10')](0x1f4,_0x91ee16['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 5008b5e..771449c 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 _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x4ec520,_0x15fee2){var _0xed49d7=function(_0x3031f2){while(--_0x3031f2){_0x4ec520['push'](_0x4ec520['shift']());}};_0xed49d7(++_0x15fee2);}(_0x8603,0x190));var _0x3860=function(_0x547ea0,_0x58254c){_0x547ea0=_0x547ea0-0x0;var _0x36e258=_0x8603[_0x547ea0];return _0x36e258;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file +var _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x37a7c6,_0x3a84b6){var _0x539905=function(_0xa00c20){while(--_0xa00c20){_0x37a7c6['push'](_0x37a7c6['shift']());}};_0x539905(++_0x3a84b6);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x58ff72,_0x5e3573){_0x58ff72=_0x58ff72-0x0;var _0x395a2d=_0x9ffd[_0x58ff72];return _0x395a2d;};'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('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('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 800240e..3d1d0a7 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 _0x7e02=['out','STRING','TEXT','medium','ENUM'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0x7e02,0xdd));var _0x27e0=function(_0x3588ba,_0x5c49f3){_0x3588ba=_0x3588ba-0x0;var _0x3695a2=_0x7e02[_0x3588ba];return _0x3695a2;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x27e0('0x0')]},'body':{'type':Sequelize[_0x27e0('0x1')](_0x27e0('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x27e0('0x3')]('in',_0x27e0('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x27e0('0x1')]}}; \ No newline at end of file +var _0x04f3=['ENUM','out','exports','STRING','TEXT','medium'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x04f3,0x14c));var _0x304f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x04f3[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x304f('0x0')]={'uniqueid':{'type':Sequelize[_0x304f('0x1')]},'body':{'type':Sequelize[_0x304f('0x2')](_0x304f('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x304f('0x4')]('in',_0x304f('0x5')),'defaultValue':_0x304f('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 7b676c8..ffa7ab6 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 _0xf95a=['includeAll','include','findAll','catch','rawAttributes','merge','find','create','body','params','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','type','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','VIRTUAL','filter','options','SquareMessage'];(function(_0x51a695,_0x424da7){var _0x21c6fd=function(_0xcb7820){while(--_0xcb7820){_0x51a695['push'](_0x51a695['shift']());}};_0x21c6fd(++_0x424da7);}(_0xf95a,0xd6));var _0xaf95=function(_0x341d08,_0x2a1ca3){_0x341d08=_0x341d08-0x0;var _0xae8581=_0xf95a[_0x341d08];return _0xae8581;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf95('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf95('0x1'));var rp=require(_0xaf95('0x2'));var moment=require('moment');var BPromise=require(_0xaf95('0x3'));var Mustache=require(_0xaf95('0x4'));var util=require('util');var path=require(_0xaf95('0x5'));var sox=require(_0xaf95('0x6'));var csv=require(_0xaf95('0x7'));var ejs=require(_0xaf95('0x8'));var fs=require('fs');var fs_extra=require(_0xaf95('0x9'));var _=require(_0xaf95('0xa'));var squel=require(_0xaf95('0xb'));var crypto=require(_0xaf95('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaf95('0x7'));var querystring=require('querystring');var Papa=require(_0xaf95('0xd'));var Redis=require(_0xaf95('0xe'));var authService=require(_0xaf95('0xf'));var qs=require(_0xaf95('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf95('0x11'));var logger=require(_0xaf95('0x12'))(_0xaf95('0x13'));var utils=require(_0xaf95('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xaf95('0x15'));var db=require(_0xaf95('0x16'))['db'];function respondWithStatusCode(_0x328fb4,_0xa799e0){_0xa799e0=_0xa799e0||0xcc;return function(_0x450c1a){if(_0x450c1a){return _0x328fb4[_0xaf95('0x17')](_0xa799e0);}return _0x328fb4['status'](_0xa799e0)['end']();};}function respondWithResult(_0x9956b6,_0xbe918a){_0xbe918a=_0xbe918a||0xc8;return function(_0xef5df8){if(_0xef5df8){return _0x9956b6[_0xaf95('0x18')](_0xbe918a)[_0xaf95('0x19')](_0xef5df8);}};}function respondWithFilteredResult(_0x47010b,_0x29c81d){return function(_0xff9129){if(_0xff9129){var _0x8591f3=typeof _0x29c81d[_0xaf95('0x1a')]==='undefined'&&typeof _0x29c81d[_0xaf95('0x1b')]==='undefined';var _0x8d23fe=_0xff9129[_0xaf95('0x1c')];var _0x29782f=_0x8591f3?0x0:_0x29c81d[_0xaf95('0x1a')];var _0x3f7ae7=_0x8591f3?_0xff9129[_0xaf95('0x1c')]:_0x29c81d[_0xaf95('0x1a')]+_0x29c81d[_0xaf95('0x1b')];var _0x4b42cd;if(_0x3f7ae7>=_0x8d23fe){_0x3f7ae7=_0x8d23fe;_0x4b42cd=0xc8;}else{_0x4b42cd=0xce;}_0x47010b['status'](_0x4b42cd);return _0x47010b['set'](_0xaf95('0x1d'),_0x29782f+'-'+_0x3f7ae7+'/'+_0x8d23fe)['json'](_0xff9129);}return null;};}function patchUpdates(_0x3d57ad){return function(_0x16f97d){try{jsonpatch[_0xaf95('0x1e')](_0x16f97d,_0x3d57ad,!![]);}catch(_0x13f5c6){return BPromise[_0xaf95('0x1f')](_0x13f5c6);}return _0x16f97d[_0xaf95('0x20')]();};}function saveUpdates(_0x4c6cca,_0x241c8e){return function(_0x21a1fb){if(_0x21a1fb){return _0x21a1fb[_0xaf95('0x21')](_0x4c6cca)[_0xaf95('0x22')](function(_0x3eeb1f){return _0x3eeb1f;});}return null;};}function removeEntity(_0x448a06,_0x5ebb4a){return function(_0x290ac9){if(_0x290ac9){return _0x290ac9['destroy']()[_0xaf95('0x22')](function(){_0x448a06['status'](0xcc)[_0xaf95('0x23')]();});}};}function handleEntityNotFound(_0x35cf91,_0x455340){return function(_0xe4fa9c){if(!_0xe4fa9c){_0x35cf91[_0xaf95('0x17')](0x194);}return _0xe4fa9c;};}function handleError(_0x576055,_0x156af0){_0x156af0=_0x156af0||0x1f4;return function(_0x299695){logger[_0xaf95('0x24')](_0x299695[_0xaf95('0x25')]);if(_0x299695[_0xaf95('0x26')]){delete _0x299695[_0xaf95('0x26')];}_0x576055[_0xaf95('0x18')](_0x156af0)[_0xaf95('0x27')](_0x299695);};}exports[_0xaf95('0x28')]=function(_0x3965a3,_0x1f558e){var _0x378689={},_0x3c16f8={},_0x2b67d0={'count':0x0,'rows':[]};var _0x5af070=_[_0xaf95('0x29')](db['SquareMessage']['rawAttributes'],function(_0x5d09ef){return{'name':_0x5d09ef['fieldName'],'type':_0x5d09ef[_0xaf95('0x2a')]['key']};});_0x3c16f8['model']=_[_0xaf95('0x29')](_0x5af070,_0xaf95('0x26'));_0x3c16f8[_0xaf95('0x2b')]=_[_0xaf95('0x2c')](_0x3965a3[_0xaf95('0x2b')]);_0x3c16f8[_0xaf95('0x2d')]=_[_0xaf95('0x2e')](_0x3c16f8[_0xaf95('0x2f')],_0x3c16f8[_0xaf95('0x2b')]);_0x378689['attributes']=_[_0xaf95('0x2e')](_0x3c16f8[_0xaf95('0x2f')],qs[_0xaf95('0x30')](_0x3965a3[_0xaf95('0x2b')]['fields']));_0x378689['attributes']=_0x378689[_0xaf95('0x31')][_0xaf95('0x32')]?_0x378689[_0xaf95('0x31')]:_0x3c16f8[_0xaf95('0x2f')];if(!_0x3965a3[_0xaf95('0x2b')]['hasOwnProperty']('nolimit')){_0x378689[_0xaf95('0x1b')]=qs[_0xaf95('0x1b')](_0x3965a3[_0xaf95('0x2b')][_0xaf95('0x1b')]);_0x378689[_0xaf95('0x1a')]=qs['offset'](_0x3965a3[_0xaf95('0x2b')][_0xaf95('0x1a')]);}_0x378689[_0xaf95('0x33')]=qs[_0xaf95('0x34')](_0x3965a3[_0xaf95('0x2b')][_0xaf95('0x34')]);_0x378689[_0xaf95('0x35')]=qs['filters'](_['pick'](_0x3965a3[_0xaf95('0x2b')],_0x3c16f8[_0xaf95('0x2d')]),_0x5af070);if(_0x3965a3[_0xaf95('0x2b')]['filter']){_0x378689[_0xaf95('0x35')]=_['merge'](_0x378689[_0xaf95('0x35')],{'$or':_[_0xaf95('0x29')](_0x5af070,function(_0x3e4a2e){if(_0x3e4a2e[_0xaf95('0x2a')]!==_0xaf95('0x36')){var _0x19b778={};_0x19b778[_0x3e4a2e[_0xaf95('0x26')]]={'$like':'%'+_0x3965a3[_0xaf95('0x2b')][_0xaf95('0x37')]+'%'};return _0x19b778;}})});}_0x378689=_['merge']({},_0x378689,_0x3965a3[_0xaf95('0x38')]);var _0x152f56={'where':_0x378689['where']};return db[_0xaf95('0x39')][_0xaf95('0x1c')](_0x152f56)[_0xaf95('0x22')](function(_0x550d88){_0x2b67d0[_0xaf95('0x1c')]=_0x550d88;if(_0x3965a3[_0xaf95('0x2b')][_0xaf95('0x3a')]){_0x378689[_0xaf95('0x3b')]=[{'all':!![]}];}return db[_0xaf95('0x39')][_0xaf95('0x3c')](_0x378689);})[_0xaf95('0x22')](function(_0x288baa){_0x2b67d0['rows']=_0x288baa;return _0x2b67d0;})['then'](respondWithFilteredResult(_0x1f558e,_0x378689))[_0xaf95('0x3d')](handleError(_0x1f558e,null));};exports['show']=function(_0x1755af,_0xdb9776){var _0x260384={'raw':!![],'where':{'id':_0x1755af['params']['id']}},_0x566f11={};_0x566f11[_0xaf95('0x2f')]=_[_0xaf95('0x2c')](db[_0xaf95('0x39')][_0xaf95('0x3e')]);_0x566f11[_0xaf95('0x2b')]=_[_0xaf95('0x2c')](_0x1755af[_0xaf95('0x2b')]);_0x566f11[_0xaf95('0x2d')]=_[_0xaf95('0x2e')](_0x566f11[_0xaf95('0x2f')],_0x566f11[_0xaf95('0x2b')]);_0x260384[_0xaf95('0x31')]=_['intersection'](_0x566f11[_0xaf95('0x2f')],qs['fields'](_0x1755af['query']['fields']));_0x260384['attributes']=_0x260384[_0xaf95('0x31')]['length']?_0x260384['attributes']:_0x566f11[_0xaf95('0x2f')];if(_0x1755af[_0xaf95('0x2b')][_0xaf95('0x3a')]){_0x260384[_0xaf95('0x3b')]=[{'all':!![]}];}_0x260384=_[_0xaf95('0x3f')]({},_0x260384,_0x1755af['options']);return db[_0xaf95('0x39')][_0xaf95('0x40')](_0x260384)[_0xaf95('0x22')](handleEntityNotFound(_0xdb9776,null))[_0xaf95('0x22')](respondWithResult(_0xdb9776,null))['catch'](handleError(_0xdb9776,null));};exports['create']=function(_0x15df75,_0x2b360a){return db[_0xaf95('0x39')][_0xaf95('0x41')](_0x15df75['body'],{})['then'](respondWithResult(_0x2b360a,0xc9))[_0xaf95('0x3d')](handleError(_0x2b360a,null));};exports[_0xaf95('0x21')]=function(_0x2cc9db,_0x4d3fd1){if(_0x2cc9db[_0xaf95('0x42')]['id']){delete _0x2cc9db[_0xaf95('0x42')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x2cc9db['params']['id']}})[_0xaf95('0x22')](handleEntityNotFound(_0x4d3fd1,null))[_0xaf95('0x22')](saveUpdates(_0x2cc9db[_0xaf95('0x42')],null))[_0xaf95('0x22')](respondWithResult(_0x4d3fd1,null))[_0xaf95('0x3d')](handleError(_0x4d3fd1,null));};exports['destroy']=function(_0x2221e8,_0x22a5f7){return db[_0xaf95('0x39')][_0xaf95('0x40')]({'where':{'id':_0x2221e8[_0xaf95('0x43')]['id']}})[_0xaf95('0x22')](handleEntityNotFound(_0x22a5f7,null))['then'](removeEntity(_0x22a5f7,null))['catch'](handleError(_0x22a5f7,null));}; \ No newline at end of file +var _0xa600=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','destroy','error','stack','name','send','SquareMessage','rawAttributes','type','key','model','query','keys','filters'];(function(_0x3bc133,_0x4b9732){var _0x388b4f=function(_0x133825){while(--_0x133825){_0x3bc133['push'](_0x3bc133['shift']());}};_0x388b4f(++_0x4b9732);}(_0xa600,0xa6));var _0x0a60=function(_0x42c118,_0x197006){_0x42c118=_0x42c118-0x0;var _0x112ebd=_0xa600[_0x42c118];return _0x112ebd;};'use strict';var emlformat=require(_0x0a60('0x0'));var rimraf=require(_0x0a60('0x1'));var zipdir=require(_0x0a60('0x2'));var jsonpatch=require(_0x0a60('0x3'));var rp=require(_0x0a60('0x4'));var moment=require(_0x0a60('0x5'));var BPromise=require(_0x0a60('0x6'));var Mustache=require('mustache');var util=require(_0x0a60('0x7'));var path=require(_0x0a60('0x8'));var sox=require('sox');var csv=require(_0x0a60('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a60('0xa'));var _=require(_0x0a60('0xb'));var squel=require(_0x0a60('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a60('0xd'));var toCsv=require(_0x0a60('0x9'));var querystring=require(_0x0a60('0xe'));var Papa=require(_0x0a60('0xf'));var Redis=require(_0x0a60('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0a60('0x11'));var as=require(_0x0a60('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a60('0x13'))(_0x0a60('0x14'));var utils=require(_0x0a60('0x15'));var config=require(_0x0a60('0x16'));var licenseUtil=require(_0x0a60('0x17'));var db=require(_0x0a60('0x18'))['db'];function respondWithStatusCode(_0x8a9b85,_0x31f1c1){_0x31f1c1=_0x31f1c1||0xcc;return function(_0x1d24a0){if(_0x1d24a0){return _0x8a9b85[_0x0a60('0x19')](_0x31f1c1);}return _0x8a9b85[_0x0a60('0x1a')](_0x31f1c1)[_0x0a60('0x1b')]();};}function respondWithResult(_0x4260d9,_0x4e60df){_0x4e60df=_0x4e60df||0xc8;return function(_0x1d378e){if(_0x1d378e){return _0x4260d9[_0x0a60('0x1a')](_0x4e60df)[_0x0a60('0x1c')](_0x1d378e);}};}function respondWithFilteredResult(_0x2ba765,_0x331488){return function(_0x73f0b4){if(_0x73f0b4){var _0xea160c=typeof _0x331488[_0x0a60('0x1d')]===_0x0a60('0x1e')&&typeof _0x331488[_0x0a60('0x1f')]===_0x0a60('0x1e');var _0x2bd7e1=_0x73f0b4[_0x0a60('0x20')];var _0x53c610=_0xea160c?0x0:_0x331488[_0x0a60('0x1d')];var _0x4f47ad=_0xea160c?_0x73f0b4[_0x0a60('0x20')]:_0x331488['offset']+_0x331488[_0x0a60('0x1f')];var _0x55f417;if(_0x4f47ad>=_0x2bd7e1){_0x4f47ad=_0x2bd7e1;_0x55f417=0xc8;}else{_0x55f417=0xce;}_0x2ba765[_0x0a60('0x1a')](_0x55f417);return _0x2ba765['set']('Content-Range',_0x53c610+'-'+_0x4f47ad+'/'+_0x2bd7e1)[_0x0a60('0x1c')](_0x73f0b4);}return null;};}function patchUpdates(_0x33fe7f){return function(_0x33430b){try{jsonpatch['apply'](_0x33430b,_0x33fe7f,!![]);}catch(_0x29e680){return BPromise[_0x0a60('0x21')](_0x29e680);}return _0x33430b[_0x0a60('0x22')]();};}function saveUpdates(_0x379772,_0x1e2d9b){return function(_0x545356){if(_0x545356){return _0x545356[_0x0a60('0x23')](_0x379772)[_0x0a60('0x24')](function(_0x5203b3){return _0x5203b3;});}return null;};}function removeEntity(_0x29c498,_0x5e2cbb){return function(_0x48e83a){if(_0x48e83a){return _0x48e83a[_0x0a60('0x25')]()[_0x0a60('0x24')](function(){_0x29c498['status'](0xcc)[_0x0a60('0x1b')]();});}};}function handleEntityNotFound(_0x100bcf,_0x46c05d){return function(_0x1e0626){if(!_0x1e0626){_0x100bcf[_0x0a60('0x19')](0x194);}return _0x1e0626;};}function handleError(_0x3f5d71,_0x55d26f){_0x55d26f=_0x55d26f||0x1f4;return function(_0x519c65){logger[_0x0a60('0x26')](_0x519c65[_0x0a60('0x27')]);if(_0x519c65[_0x0a60('0x28')]){delete _0x519c65['name'];}_0x3f5d71[_0x0a60('0x1a')](_0x55d26f)[_0x0a60('0x29')](_0x519c65);};}exports['index']=function(_0x1ddb22,_0x39c77d){var _0x39222c={},_0x41f968={},_0x4cdf96={'count':0x0,'rows':[]};var _0x2987c4=_['map'](db[_0x0a60('0x2a')][_0x0a60('0x2b')],function(_0x400679){return{'name':_0x400679['fieldName'],'type':_0x400679[_0x0a60('0x2c')][_0x0a60('0x2d')]};});_0x41f968[_0x0a60('0x2e')]=_['map'](_0x2987c4,_0x0a60('0x28'));_0x41f968[_0x0a60('0x2f')]=_[_0x0a60('0x30')](_0x1ddb22[_0x0a60('0x2f')]);_0x41f968[_0x0a60('0x31')]=_[_0x0a60('0x32')](_0x41f968[_0x0a60('0x2e')],_0x41f968[_0x0a60('0x2f')]);_0x39222c[_0x0a60('0x33')]=_[_0x0a60('0x32')](_0x41f968[_0x0a60('0x2e')],qs[_0x0a60('0x34')](_0x1ddb22['query']['fields']));_0x39222c['attributes']=_0x39222c[_0x0a60('0x33')]['length']?_0x39222c['attributes']:_0x41f968['model'];if(!_0x1ddb22[_0x0a60('0x2f')][_0x0a60('0x35')](_0x0a60('0x36'))){_0x39222c['limit']=qs[_0x0a60('0x1f')](_0x1ddb22[_0x0a60('0x2f')]['limit']);_0x39222c[_0x0a60('0x1d')]=qs['offset'](_0x1ddb22[_0x0a60('0x2f')][_0x0a60('0x1d')]);}_0x39222c[_0x0a60('0x37')]=qs[_0x0a60('0x38')](_0x1ddb22[_0x0a60('0x2f')][_0x0a60('0x38')]);_0x39222c[_0x0a60('0x39')]=qs[_0x0a60('0x31')](_[_0x0a60('0x3a')](_0x1ddb22[_0x0a60('0x2f')],_0x41f968['filters']),_0x2987c4);if(_0x1ddb22[_0x0a60('0x2f')][_0x0a60('0x3b')]){_0x39222c[_0x0a60('0x39')]=_['merge'](_0x39222c[_0x0a60('0x39')],{'$or':_['map'](_0x2987c4,function(_0x4f996d){if(_0x4f996d[_0x0a60('0x2c')]!==_0x0a60('0x3c')){var _0x1a7588={};_0x1a7588[_0x4f996d[_0x0a60('0x28')]]={'$like':'%'+_0x1ddb22[_0x0a60('0x2f')][_0x0a60('0x3b')]+'%'};return _0x1a7588;}})});}_0x39222c=_[_0x0a60('0x3d')]({},_0x39222c,_0x1ddb22[_0x0a60('0x3e')]);var _0x5f2a49={'where':_0x39222c[_0x0a60('0x39')]};return db['SquareMessage'][_0x0a60('0x20')](_0x5f2a49)[_0x0a60('0x24')](function(_0x825191){_0x4cdf96[_0x0a60('0x20')]=_0x825191;if(_0x1ddb22['query']['includeAll']){_0x39222c[_0x0a60('0x3f')]=[{'all':!![]}];}return db[_0x0a60('0x2a')][_0x0a60('0x40')](_0x39222c);})[_0x0a60('0x24')](function(_0x851122){_0x4cdf96['rows']=_0x851122;return _0x4cdf96;})[_0x0a60('0x24')](respondWithFilteredResult(_0x39c77d,_0x39222c))[_0x0a60('0x41')](handleError(_0x39c77d,null));};exports['show']=function(_0x22f79b,_0x111c98){var _0x29147f={'raw':!![],'where':{'id':_0x22f79b[_0x0a60('0x42')]['id']}},_0x432008={};_0x432008[_0x0a60('0x2e')]=_[_0x0a60('0x30')](db[_0x0a60('0x2a')][_0x0a60('0x2b')]);_0x432008[_0x0a60('0x2f')]=_['keys'](_0x22f79b[_0x0a60('0x2f')]);_0x432008[_0x0a60('0x31')]=_['intersection'](_0x432008[_0x0a60('0x2e')],_0x432008[_0x0a60('0x2f')]);_0x29147f['attributes']=_[_0x0a60('0x32')](_0x432008[_0x0a60('0x2e')],qs[_0x0a60('0x34')](_0x22f79b[_0x0a60('0x2f')][_0x0a60('0x34')]));_0x29147f['attributes']=_0x29147f[_0x0a60('0x33')][_0x0a60('0x43')]?_0x29147f['attributes']:_0x432008['model'];if(_0x22f79b['query'][_0x0a60('0x44')]){_0x29147f[_0x0a60('0x3f')]=[{'all':!![]}];}_0x29147f=_[_0x0a60('0x3d')]({},_0x29147f,_0x22f79b[_0x0a60('0x3e')]);return db[_0x0a60('0x2a')][_0x0a60('0x45')](_0x29147f)[_0x0a60('0x24')](handleEntityNotFound(_0x111c98,null))[_0x0a60('0x24')](respondWithResult(_0x111c98,null))[_0x0a60('0x41')](handleError(_0x111c98,null));};exports[_0x0a60('0x46')]=function(_0x40eb0c,_0x4e341b){return db[_0x0a60('0x2a')][_0x0a60('0x46')](_0x40eb0c[_0x0a60('0x47')],{})[_0x0a60('0x24')](respondWithResult(_0x4e341b,0xc9))[_0x0a60('0x41')](handleError(_0x4e341b,null));};exports['update']=function(_0x2144b0,_0x1da59d){if(_0x2144b0['body']['id']){delete _0x2144b0[_0x0a60('0x47')]['id'];}return db[_0x0a60('0x2a')]['find']({'where':{'id':_0x2144b0['params']['id']}})[_0x0a60('0x24')](handleEntityNotFound(_0x1da59d,null))[_0x0a60('0x24')](saveUpdates(_0x2144b0[_0x0a60('0x47')],null))[_0x0a60('0x24')](respondWithResult(_0x1da59d,null))['catch'](handleError(_0x1da59d,null));};exports[_0x0a60('0x25')]=function(_0x1f5c58,_0x209c7a){return db[_0x0a60('0x2a')][_0x0a60('0x45')]({'where':{'id':_0x1f5c58[_0x0a60('0x42')]['id']}})[_0x0a60('0x24')](handleEntityNotFound(_0x209c7a,null))['then'](removeEntity(_0x209c7a,null))[_0x0a60('0x41')](handleError(_0x209c7a,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 933ee0d..b4cb094 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 _0xc128=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','lodash','util'];(function(_0x328951,_0x36a5f3){var _0x182d71=function(_0x5e25bd){while(--_0x5e25bd){_0x328951['push'](_0x328951['shift']());}};_0x182d71(++_0x36a5f3);}(_0xc128,0x106));var _0x8c12=function(_0x5e350e,_0x2cf4d7){_0x5e350e=_0x5e350e-0x0;var _0x2b07ec=_0xc128[_0x5e350e];return _0x2b07ec;};'use strict';var _=require(_0x8c12('0x0'));var util=require(_0x8c12('0x1'));var logger=require('../../config/logger')(_0x8c12('0x2'));var moment=require(_0x8c12('0x3'));var BPromise=require(_0x8c12('0x4'));var rp=require(_0x8c12('0x5'));var fs=require('fs');var path=require(_0x8c12('0x6'));var rimraf=require(_0x8c12('0x7'));var config=require(_0x8c12('0x8'));var attributes=require(_0x8c12('0x9'));module[_0x8c12('0xa')]=function(_0x3d55d7,_0x4de354){return _0x3d55d7[_0x8c12('0xb')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f05=['SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareMessage.attributes','exports','define'];(function(_0x503bdb,_0xa58604){var _0x96f5bf=function(_0x3a37f1){while(--_0x3a37f1){_0x503bdb['push'](_0x503bdb['shift']());}};_0x96f5bf(++_0xa58604);}(_0x5f05,0x8e));var _0x55f0=function(_0x115a41,_0x7b8e31){_0x115a41=_0x115a41-0x0;var _0x50f0ec=_0x5f05[_0x115a41];return _0x50f0ec;};'use strict';var _=require(_0x55f0('0x0'));var util=require(_0x55f0('0x1'));var logger=require(_0x55f0('0x2'))(_0x55f0('0x3'));var moment=require(_0x55f0('0x4'));var BPromise=require(_0x55f0('0x5'));var rp=require(_0x55f0('0x6'));var fs=require('fs');var path=require(_0x55f0('0x7'));var rimraf=require('rimraf');var config=require(_0x55f0('0x8'));var attributes=require(_0x55f0('0x9'));module[_0x55f0('0xa')]=function(_0x1ce77d,_0x37aae0){return _0x1ce77d[_0x55f0('0xb')](_0x55f0('0xc'),attributes,{'tableName':_0x55f0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 9e3e29b..e70aca6 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 _0x4c56=['error','code','message','info','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5cd55f,_0x5d08d1){var _0x56bd12=function(_0x5c86ab){while(--_0x5c86ab){_0x5cd55f['push'](_0x5cd55f['shift']());}};_0x56bd12(++_0x5d08d1);}(_0x4c56,0x1de));var _0x64c5=function(_0xcfee76,_0x30d187){_0xcfee76=_0xcfee76-0x0;var _0x4c5404=_0x4c56[_0xcfee76];return _0x4c5404;};'use strict';var _=require(_0x64c5('0x0'));var util=require(_0x64c5('0x1'));var moment=require(_0x64c5('0x2'));var BPromise=require(_0x64c5('0x3'));var rs=require(_0x64c5('0x4'));var fs=require('fs');var Redis=require(_0x64c5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x64c5('0x6'));var logger=require(_0x64c5('0x7'))(_0x64c5('0x8'));var config=require('../../config/environment');var jayson=require(_0x64c5('0x9'));var client=jayson[_0x64c5('0xa')][_0x64c5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x492a87,_0x2f4b3a,_0x1683e2){return new BPromise(function(_0x5a65c6,_0x455f4f){return client[_0x64c5('0xc')](_0x492a87,_0x1683e2)[_0x64c5('0xd')](function(_0x2482bb){logger['info'](_0x64c5('0xe'),_0x2f4b3a,'request\x20sent');logger['debug'](_0x64c5('0xf'),_0x2f4b3a,_0x64c5('0x10'),JSON[_0x64c5('0x11')](_0x2482bb));if(_0x2482bb[_0x64c5('0x12')]){if(_0x2482bb[_0x64c5('0x12')][_0x64c5('0x13')]===0x1f4){logger[_0x64c5('0x12')]('SquareMessage,\x20%s,\x20%s',_0x2f4b3a,_0x2482bb[_0x64c5('0x12')][_0x64c5('0x14')]);return _0x455f4f(_0x2482bb[_0x64c5('0x12')]['message']);}logger[_0x64c5('0x12')](_0x64c5('0xe'),_0x2f4b3a,_0x2482bb[_0x64c5('0x12')][_0x64c5('0x14')]);return _0x5a65c6(_0x2482bb[_0x64c5('0x12')][_0x64c5('0x14')]);}else{logger[_0x64c5('0x15')](_0x64c5('0xe'),_0x2f4b3a,_0x64c5('0x10'));_0x5a65c6(_0x2482bb[_0x64c5('0x16')][_0x64c5('0x14')]);}})[_0x64c5('0x17')](function(_0xe8edb){logger[_0x64c5('0x12')](_0x64c5('0xe'),_0x2f4b3a,_0xe8edb);_0x455f4f(_0xe8edb);});});}exports[_0x64c5('0x18')]=function(_0xa48346){var _0x2570af=this;return new Promise(function(_0x42adde,_0x4bb585){return db[_0x64c5('0x19')][_0x64c5('0x1a')](_0xa48346[_0x64c5('0x1b')],{'raw':_0xa48346[_0x64c5('0x1c')]?_0xa48346[_0x64c5('0x1c')][_0x64c5('0x1d')]===undefined?!![]:![]:!![]})[_0x64c5('0xd')](function(_0x50bb68){logger['info'](_0x64c5('0x18'),_0xa48346);logger[_0x64c5('0x1e')]('CreateSquareMessage',_0xa48346,JSON[_0x64c5('0x11')](_0x50bb68));_0x42adde(_0x50bb68);})['catch'](function(_0x32f1d5){logger[_0x64c5('0x12')]('CreateSquareMessage',_0x32f1d5[_0x64c5('0x14')],_0xa48346);_0x4bb585(_0x2570af[_0x64c5('0x12')](0x1f4,_0x32f1d5[_0x64c5('0x14')]));});});}; \ No newline at end of file +var _0xdac9=['error','code','message','request\x20sent','catch','CreateSquareMessage','SquareMessage','create','body','options','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s'];(function(_0x1105a4,_0xdc17a6){var _0x3c0e47=function(_0x1ebc83){while(--_0x1ebc83){_0x1105a4['push'](_0x1105a4['shift']());}};_0x3c0e47(++_0xdc17a6);}(_0xdac9,0xca));var _0x9dac=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0xdac9[_0x38eb23];return _0x48506a;};'use strict';var _=require('lodash');var util=require(_0x9dac('0x0'));var moment=require('moment');var BPromise=require(_0x9dac('0x1'));var rs=require(_0x9dac('0x2'));var fs=require('fs');var Redis=require(_0x9dac('0x3'));var db=require(_0x9dac('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9dac('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x9dac('0x6')][_0x9dac('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5350ed,_0x5eff07,_0x415c50){return new BPromise(function(_0x1ee009,_0x845f1){return client[_0x9dac('0x8')](_0x5350ed,_0x415c50)[_0x9dac('0x9')](function(_0x64fbd7){logger[_0x9dac('0xa')](_0x9dac('0xb'),_0x5eff07,'request\x20sent');logger[_0x9dac('0xc')](_0x9dac('0xd'),_0x5eff07,'request\x20sent',JSON['stringify'](_0x64fbd7));if(_0x64fbd7[_0x9dac('0xe')]){if(_0x64fbd7['error'][_0x9dac('0xf')]===0x1f4){logger[_0x9dac('0xe')]('SquareMessage,\x20%s,\x20%s',_0x5eff07,_0x64fbd7['error'][_0x9dac('0x10')]);return _0x845f1(_0x64fbd7[_0x9dac('0xe')][_0x9dac('0x10')]);}logger[_0x9dac('0xe')](_0x9dac('0xb'),_0x5eff07,_0x64fbd7['error'][_0x9dac('0x10')]);return _0x1ee009(_0x64fbd7[_0x9dac('0xe')][_0x9dac('0x10')]);}else{logger['info'](_0x9dac('0xb'),_0x5eff07,_0x9dac('0x11'));_0x1ee009(_0x64fbd7['result'][_0x9dac('0x10')]);}})[_0x9dac('0x12')](function(_0x2d67ee){logger[_0x9dac('0xe')](_0x9dac('0xb'),_0x5eff07,_0x2d67ee);_0x845f1(_0x2d67ee);});});}exports[_0x9dac('0x13')]=function(_0x595cce){var _0x54c8e1=this;return new Promise(function(_0x118c68,_0x50b852){return db[_0x9dac('0x14')][_0x9dac('0x15')](_0x595cce[_0x9dac('0x16')],{'raw':_0x595cce['options']?_0x595cce[_0x9dac('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x9dac('0x9')](function(_0x867fb2){logger[_0x9dac('0xa')]('CreateSquareMessage',_0x595cce);logger[_0x9dac('0xc')](_0x9dac('0x13'),_0x595cce,JSON['stringify'](_0x867fb2));_0x118c68(_0x867fb2);})[_0x9dac('0x12')](function(_0x3ac8ef){logger[_0x9dac('0xe')](_0x9dac('0x13'),_0x3ac8ef[_0x9dac('0x10')],_0x595cce);_0x50b852(_0x54c8e1[_0x9dac('0xe')](0x1f4,_0x3ac8ef[_0x9dac('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index a027722..1a75594 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 _0x705a=['get','isAuthenticated','index','show','15s','test','post','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0x22a91c,_0x5ce13f){var _0x733c2f=function(_0x1ef119){while(--_0x1ef119){_0x22a91c['push'](_0x22a91c['shift']());}};_0x733c2f(++_0x5ce13f);}(_0x705a,0xc5));var _0xa705=function(_0x140e1c,_0x3a0551){_0x140e1c=_0x140e1c-0x0;var _0x53d4f1=_0x705a[_0x140e1c];return _0x53d4f1;};'use strict';var multer=require(_0xa705('0x0'));var util=require('util');var path=require(_0xa705('0x1'));var timeout=require(_0xa705('0x2'));var express=require(_0xa705('0x3'));var router=express[_0xa705('0x4')]();var fs_extra=require(_0xa705('0x5'));var auth=require(_0xa705('0x6'));var interaction=require(_0xa705('0x7'));var config=require(_0xa705('0x8'));var controller=require(_0xa705('0x9'));router[_0xa705('0xa')]('/',auth[_0xa705('0xb')](),controller[_0xa705('0xc')]);router[_0xa705('0xa')]('/:id',auth[_0xa705('0xb')](),controller[_0xa705('0xd')]);router[_0xa705('0xa')]('/:id/test',auth[_0xa705('0xb')](),timeout(_0xa705('0xe')),controller[_0xa705('0xf')]);router[_0xa705('0x10')]('/',auth[_0xa705('0xb')](),controller[_0xa705('0x11')]);router['put'](_0xa705('0x12'),auth[_0xa705('0xb')](),controller[_0xa705('0x13')]);router[_0xa705('0x14')]('/:id',auth[_0xa705('0xb')](),controller[_0xa705('0x15')]);module[_0xa705('0x16')]=router; \ No newline at end of file +var _0x6771=['delete','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/test','15s','test','post','create','put','update'];(function(_0x3372eb,_0x57520b){var _0x4b252e=function(_0x190800){while(--_0x190800){_0x3372eb['push'](_0x3372eb['shift']());}};_0x4b252e(++_0x57520b);}(_0x6771,0x146));var _0x1677=function(_0x360fde,_0x795e1a){_0x360fde=_0x360fde-0x0;var _0x2db8c4=_0x6771[_0x360fde];return _0x2db8c4;};'use strict';var multer=require(_0x1677('0x0'));var util=require('util');var path=require(_0x1677('0x1'));var timeout=require(_0x1677('0x2'));var express=require('express');var router=express[_0x1677('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1677('0x4'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0x1677('0x5')]('/',auth[_0x1677('0x6')](),controller['index']);router[_0x1677('0x5')](_0x1677('0x7'),auth[_0x1677('0x6')](),controller[_0x1677('0x8')]);router[_0x1677('0x5')](_0x1677('0x9'),auth[_0x1677('0x6')](),timeout(_0x1677('0xa')),controller[_0x1677('0xb')]);router[_0x1677('0xc')]('/',auth[_0x1677('0x6')](),controller[_0x1677('0xd')]);router[_0x1677('0xe')]('/:id',auth[_0x1677('0x6')](),controller[_0x1677('0xf')]);router[_0x1677('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1677('0x11')]);module[_0x1677('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index b3323a7..82657a3 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 _0xbc28=['STRING','exports'];(function(_0x5175b2,_0x50ce57){var _0x118680=function(_0x536abf){while(--_0x536abf){_0x5175b2['push'](_0x5175b2['shift']());}};_0x118680(++_0x50ce57);}(_0xbc28,0xa1));var _0x8bc2=function(_0x258e79,_0x2c93b2){_0x258e79=_0x258e79-0x0;var _0x2731c0=_0xbc28[_0x258e79];return _0x2731c0;};'use strict';var Sequelize=require('sequelize');module[_0x8bc2('0x0')]={'name':{'type':Sequelize[_0x8bc2('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8bc2('0x1')]}}; \ No newline at end of file +var _0x4b02=['exports','STRING'];(function(_0x457d69,_0x2bfa35){var _0x489d9f=function(_0x2570b6){while(--_0x2570b6){_0x457d69['push'](_0x457d69['shift']());}};_0x489d9f(++_0x2bfa35);}(_0x4b02,0xe6));var _0x24b0=function(_0x9fec80,_0x377ea4){_0x9fec80=_0x9fec80-0x0;var _0x4eecb9=_0x4b02[_0x9fec80];return _0x4eecb9;};'use strict';var Sequelize=require('sequelize');module[_0x24b0('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x24b0('0x1')]},'description':{'type':Sequelize[_0x24b0('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 5be15d9..dc733cf 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 _0x9460=['type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','dsn','odbc','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then','get','ODBC','error','stack','name','send','index','SquareOdbc','rawAttributes','fieldName'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9460,0x83));var _0x0946=function(_0x1c2f9b,_0x19cf6b){_0x1c2f9b=_0x1c2f9b-0x0;var _0x5c1b1d=_0x9460[_0x1c2f9b];return _0x5c1b1d;};'use strict';var emlformat=require(_0x0946('0x0'));var rimraf=require(_0x0946('0x1'));var zipdir=require(_0x0946('0x2'));var jsonpatch=require(_0x0946('0x3'));var rp=require(_0x0946('0x4'));var moment=require(_0x0946('0x5'));var BPromise=require(_0x0946('0x6'));var Mustache=require('mustache');var util=require(_0x0946('0x7'));var path=require(_0x0946('0x8'));var sox=require(_0x0946('0x9'));var csv=require(_0x0946('0xa'));var ejs=require(_0x0946('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0946('0xc'));var deskjs=require(_0x0946('0xd'));var toCsv=require(_0x0946('0xa'));var querystring=require(_0x0946('0xe'));var Papa=require(_0x0946('0xf'));var Redis=require(_0x0946('0x10'));var authService=require(_0x0946('0x11'));var qs=require(_0x0946('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0946('0x13'));var logger=require(_0x0946('0x14'))(_0x0946('0x15'));var utils=require('../../config/utils');var config=require(_0x0946('0x16'));var licenseUtil=require(_0x0946('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd3ad56,_0xb85867){_0xb85867=_0xb85867||0xcc;return function(_0x27f880){if(_0x27f880){return _0xd3ad56[_0x0946('0x18')](_0xb85867);}return _0xd3ad56[_0x0946('0x19')](_0xb85867)[_0x0946('0x1a')]();};}function respondWithResult(_0x2ec428,_0xc8bc05){_0xc8bc05=_0xc8bc05||0xc8;return function(_0xaf93ee){if(_0xaf93ee){return _0x2ec428[_0x0946('0x19')](_0xc8bc05)['json'](_0xaf93ee);}};}function respondWithFilteredResult(_0x481076,_0x22e339){return function(_0x48379c){if(_0x48379c){var _0x481932=typeof _0x22e339[_0x0946('0x1b')]===_0x0946('0x1c')&&typeof _0x22e339[_0x0946('0x1d')]===_0x0946('0x1c');var _0x3d0be2=_0x48379c[_0x0946('0x1e')];var _0x2c4f0c=_0x481932?0x0:_0x22e339['offset'];var _0x14ec44=_0x481932?_0x48379c[_0x0946('0x1e')]:_0x22e339[_0x0946('0x1b')]+_0x22e339[_0x0946('0x1d')];var _0x4305d6;if(_0x14ec44>=_0x3d0be2){_0x14ec44=_0x3d0be2;_0x4305d6=0xc8;}else{_0x4305d6=0xce;}_0x481076[_0x0946('0x19')](_0x4305d6);return _0x481076[_0x0946('0x1f')]('Content-Range',_0x2c4f0c+'-'+_0x14ec44+'/'+_0x3d0be2)[_0x0946('0x20')](_0x48379c);}return null;};}function patchUpdates(_0x220bfa){return function(_0x3ccf7d){try{jsonpatch[_0x0946('0x21')](_0x3ccf7d,_0x220bfa,!![]);}catch(_0x322198){return BPromise[_0x0946('0x22')](_0x322198);}return _0x3ccf7d[_0x0946('0x23')]();};}function saveUpdates(_0x138ec1,_0x59f9df){return function(_0x3c396b){if(_0x3c396b){return _0x3c396b[_0x0946('0x24')](_0x138ec1)['then'](function(_0x2811a7){return _0x2811a7;});}return null;};}function removeEntity(_0x25a3f3,_0x411098){return function(_0x1fe1b5){if(_0x1fe1b5){return _0x1fe1b5[_0x0946('0x25')]()[_0x0946('0x26')](function(){var _0x5a2d1b=_0x1fe1b5[_0x0946('0x27')]({'plain':!![]});var _0x484171=_0x0946('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x484171,'resourceId':_0x5a2d1b['id']}})[_0x0946('0x26')](function(){return _0x1fe1b5;});})[_0x0946('0x26')](function(){_0x25a3f3[_0x0946('0x19')](0xcc)[_0x0946('0x1a')]();});}};}function handleEntityNotFound(_0x6524f7,_0x184462){return function(_0x5e2f9f){if(!_0x5e2f9f){_0x6524f7['sendStatus'](0x194);}return _0x5e2f9f;};}function handleError(_0x2302a8,_0x11db7d){_0x11db7d=_0x11db7d||0x1f4;return function(_0x30a168){logger[_0x0946('0x29')](_0x30a168[_0x0946('0x2a')]);if(_0x30a168[_0x0946('0x2b')]){delete _0x30a168[_0x0946('0x2b')];}_0x2302a8[_0x0946('0x19')](_0x11db7d)[_0x0946('0x2c')](_0x30a168);};}exports[_0x0946('0x2d')]=function(_0x3c760a,_0x327a9b){var _0x57f85a={},_0x1d5555={},_0x1143cf={'count':0x0,'rows':[]};var _0x28e835=_['map'](db[_0x0946('0x2e')][_0x0946('0x2f')],function(_0x58b614){return{'name':_0x58b614[_0x0946('0x30')],'type':_0x58b614[_0x0946('0x31')][_0x0946('0x32')]};});_0x1d5555[_0x0946('0x33')]=_[_0x0946('0x34')](_0x28e835,_0x0946('0x2b'));_0x1d5555[_0x0946('0x35')]=_[_0x0946('0x36')](_0x3c760a[_0x0946('0x35')]);_0x1d5555[_0x0946('0x37')]=_[_0x0946('0x38')](_0x1d5555[_0x0946('0x33')],_0x1d5555[_0x0946('0x35')]);_0x57f85a[_0x0946('0x39')]=_[_0x0946('0x38')](_0x1d5555['model'],qs[_0x0946('0x3a')](_0x3c760a[_0x0946('0x35')][_0x0946('0x3a')]));_0x57f85a['attributes']=_0x57f85a[_0x0946('0x39')][_0x0946('0x3b')]?_0x57f85a[_0x0946('0x39')]:_0x1d5555[_0x0946('0x33')];if(!_0x3c760a[_0x0946('0x35')][_0x0946('0x3c')](_0x0946('0x3d'))){_0x57f85a[_0x0946('0x1d')]=qs['limit'](_0x3c760a['query'][_0x0946('0x1d')]);_0x57f85a['offset']=qs['offset'](_0x3c760a[_0x0946('0x35')][_0x0946('0x1b')]);}_0x57f85a[_0x0946('0x3e')]=qs['sort'](_0x3c760a[_0x0946('0x35')][_0x0946('0x3f')]);_0x57f85a[_0x0946('0x40')]=qs[_0x0946('0x37')](_[_0x0946('0x41')](_0x3c760a[_0x0946('0x35')],_0x1d5555[_0x0946('0x37')]),_0x28e835);if(_0x3c760a['query'][_0x0946('0x42')]){_0x57f85a[_0x0946('0x40')]=_['merge'](_0x57f85a[_0x0946('0x40')],{'$or':_[_0x0946('0x34')](_0x28e835,function(_0x3a4f66){if(_0x3a4f66[_0x0946('0x31')]!==_0x0946('0x43')){var _0x36ec0d={};_0x36ec0d[_0x3a4f66[_0x0946('0x2b')]]={'$like':'%'+_0x3c760a[_0x0946('0x35')][_0x0946('0x42')]+'%'};return _0x36ec0d;}})});}_0x57f85a=_[_0x0946('0x44')]({},_0x57f85a,_0x3c760a[_0x0946('0x45')]);var _0x44e8ea={'where':_0x57f85a[_0x0946('0x40')]};return db[_0x0946('0x2e')][_0x0946('0x1e')](_0x44e8ea)[_0x0946('0x26')](function(_0x258e55){_0x1143cf['count']=_0x258e55;if(_0x3c760a['query'][_0x0946('0x46')]){_0x57f85a[_0x0946('0x47')]=[{'all':!![]}];}return db[_0x0946('0x2e')][_0x0946('0x48')](_0x57f85a);})[_0x0946('0x26')](function(_0x204b63){_0x1143cf[_0x0946('0x49')]=_0x204b63;return _0x1143cf;})[_0x0946('0x26')](respondWithFilteredResult(_0x327a9b,_0x57f85a))[_0x0946('0x4a')](handleError(_0x327a9b,null));};exports[_0x0946('0x4b')]=function(_0x3422a4,_0x1543a3){var _0x4407c6={'raw':!![],'where':{'id':_0x3422a4[_0x0946('0x4c')]['id']}},_0x587023={};_0x587023[_0x0946('0x33')]=_[_0x0946('0x36')](db[_0x0946('0x2e')][_0x0946('0x2f')]);_0x587023[_0x0946('0x35')]=_[_0x0946('0x36')](_0x3422a4[_0x0946('0x35')]);_0x587023[_0x0946('0x37')]=_[_0x0946('0x38')](_0x587023[_0x0946('0x33')],_0x587023[_0x0946('0x35')]);_0x4407c6[_0x0946('0x39')]=_[_0x0946('0x38')](_0x587023['model'],qs[_0x0946('0x3a')](_0x3422a4[_0x0946('0x35')][_0x0946('0x3a')]));_0x4407c6[_0x0946('0x39')]=_0x4407c6[_0x0946('0x39')][_0x0946('0x3b')]?_0x4407c6[_0x0946('0x39')]:_0x587023[_0x0946('0x33')];if(_0x3422a4[_0x0946('0x35')][_0x0946('0x46')]){_0x4407c6[_0x0946('0x47')]=[{'all':!![]}];}_0x4407c6=_[_0x0946('0x44')]({},_0x4407c6,_0x3422a4[_0x0946('0x45')]);return db[_0x0946('0x2e')][_0x0946('0x4d')](_0x4407c6)['then'](handleEntityNotFound(_0x1543a3,null))['then'](respondWithResult(_0x1543a3,null))[_0x0946('0x4a')](handleError(_0x1543a3,null));};exports['create']=function(_0x3769cf,_0x3095f6){return db[_0x0946('0x2e')]['create'](_0x3769cf['body'],{})[_0x0946('0x26')](function(_0x566d41){var _0x169ea8=_0x3769cf[_0x0946('0x4e')]['get']({'plain':!![]});if(!_0x169ea8)throw new Error(_0x0946('0x4f'));if(_0x169ea8[_0x0946('0x50')]===_0x0946('0x4e')){var _0x5819d9=_0x566d41['get']({'plain':!![]});var _0x554bc2=_0x0946('0x28');return db['UserProfileSection'][_0x0946('0x4d')]({'where':{'name':_0x554bc2,'userProfileId':_0x169ea8[_0x0946('0x51')]},'raw':!![]})[_0x0946('0x26')](function(_0x2c99f6){if(_0x2c99f6&&_0x2c99f6[_0x0946('0x52')]===0x0){return db[_0x0946('0x53')][_0x0946('0x54')]({'name':_0x5819d9['name'],'resourceId':_0x5819d9['id'],'type':_0x2c99f6[_0x0946('0x2b')],'sectionId':_0x2c99f6['id']},{})[_0x0946('0x26')](function(){return _0x566d41;});}else{return _0x566d41;}})['catch'](function(_0x5f4566){logger[_0x0946('0x29')](_0x0946('0x55'),_0x5f4566);throw _0x5f4566;});}return _0x566d41;})['then'](respondWithResult(_0x3095f6,0xc9))[_0x0946('0x4a')](handleError(_0x3095f6,null));};exports['update']=function(_0x172501,_0x10b5fd){if(_0x172501['body']['id']){delete _0x172501[_0x0946('0x56')]['id'];}return db[_0x0946('0x2e')]['find']({'where':{'id':_0x172501[_0x0946('0x4c')]['id']}})[_0x0946('0x26')](handleEntityNotFound(_0x10b5fd,null))[_0x0946('0x26')](saveUpdates(_0x172501[_0x0946('0x56')],null))[_0x0946('0x26')](respondWithResult(_0x10b5fd,null))[_0x0946('0x4a')](handleError(_0x10b5fd,null));};exports['destroy']=function(_0x320d56,_0x28a7a4){return db[_0x0946('0x2e')]['find']({'where':{'id':_0x320d56[_0x0946('0x4c')]['id']}})[_0x0946('0x26')](handleEntityNotFound(_0x28a7a4,null))[_0x0946('0x26')](removeEntity(_0x28a7a4,null))[_0x0946('0x4a')](handleError(_0x28a7a4,null));};exports['test']=function(_0x186b09,_0x2342c9,_0x5c0d3a){var _0x106032;return db[_0x0946('0x2e')][_0x0946('0x4d')]({'where':{'id':_0x186b09[_0x0946('0x4c')]['id']},'attributes':['id',_0x0946('0x57')]})[_0x0946('0x26')](handleEntityNotFound(_0x2342c9,null))[_0x0946('0x26')](function(_0x2a7b60){if(_0x2a7b60){var _0x237a40=require(_0x0946('0x58'))();_0x237a40['openSync'](_0x2a7b60['dsn']);_0x237a40[_0x0946('0x59')]();return _0x2a7b60;}})[_0x0946('0x26')](respondWithResult(_0x2342c9,null))[_0x0946('0x4a')](handleError(_0x2342c9,null));}; \ No newline at end of file +var _0xb01b=['autoAssociation','body','odbc','dsn','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','ODBC','UserProfileResource','end','sendStatus','error','stack','name','index','SquareOdbc','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','user','role','UserProfileSection','userProfileId'];(function(_0x4ffa11,_0x120051){var _0x1f669d=function(_0x44b3ab){while(--_0x44b3ab){_0x4ffa11['push'](_0x4ffa11['shift']());}};_0x1f669d(++_0x120051);}(_0xb01b,0x107));var _0xbb01=function(_0x56f0b9,_0x338fed){_0x56f0b9=_0x56f0b9-0x0;var _0x229087=_0xb01b[_0x56f0b9];return _0x229087;};'use strict';var emlformat=require(_0xbb01('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb01('0x1'));var jsonpatch=require(_0xbb01('0x2'));var rp=require(_0xbb01('0x3'));var moment=require(_0xbb01('0x4'));var BPromise=require(_0xbb01('0x5'));var Mustache=require(_0xbb01('0x6'));var util=require(_0xbb01('0x7'));var path=require(_0xbb01('0x8'));var sox=require(_0xbb01('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb01('0xa'));var _=require(_0xbb01('0xb'));var squel=require(_0xbb01('0xc'));var crypto=require(_0xbb01('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbb01('0xe'));var querystring=require(_0xbb01('0xf'));var Papa=require(_0xbb01('0x10'));var Redis=require(_0xbb01('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbb01('0x12'));var as=require(_0xbb01('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb01('0x14'))(_0xbb01('0x15'));var utils=require(_0xbb01('0x16'));var config=require(_0xbb01('0x17'));var licenseUtil=require(_0xbb01('0x18'));var db=require(_0xbb01('0x19'))['db'];function respondWithStatusCode(_0x9e2518,_0x266339){_0x266339=_0x266339||0xcc;return function(_0x3d6cce){if(_0x3d6cce){return _0x9e2518['sendStatus'](_0x266339);}return _0x9e2518[_0xbb01('0x1a')](_0x266339)['end']();};}function respondWithResult(_0x46c00b,_0x1a657f){_0x1a657f=_0x1a657f||0xc8;return function(_0x3296e3){if(_0x3296e3){return _0x46c00b[_0xbb01('0x1a')](_0x1a657f)['json'](_0x3296e3);}};}function respondWithFilteredResult(_0x42854f,_0x3c92c3){return function(_0x4d4899){if(_0x4d4899){var _0x578093=typeof _0x3c92c3[_0xbb01('0x1b')]===_0xbb01('0x1c')&&typeof _0x3c92c3[_0xbb01('0x1d')]===_0xbb01('0x1c');var _0x26b4ec=_0x4d4899['count'];var _0x1cbc02=_0x578093?0x0:_0x3c92c3['offset'];var _0x4c534d=_0x578093?_0x4d4899[_0xbb01('0x1e')]:_0x3c92c3[_0xbb01('0x1b')]+_0x3c92c3[_0xbb01('0x1d')];var _0x39fcb1;if(_0x4c534d>=_0x26b4ec){_0x4c534d=_0x26b4ec;_0x39fcb1=0xc8;}else{_0x39fcb1=0xce;}_0x42854f[_0xbb01('0x1a')](_0x39fcb1);return _0x42854f[_0xbb01('0x1f')]('Content-Range',_0x1cbc02+'-'+_0x4c534d+'/'+_0x26b4ec)['json'](_0x4d4899);}return null;};}function patchUpdates(_0x37d2df){return function(_0x3ea607){try{jsonpatch[_0xbb01('0x20')](_0x3ea607,_0x37d2df,!![]);}catch(_0x37667a){return BPromise['reject'](_0x37667a);}return _0x3ea607[_0xbb01('0x21')]();};}function saveUpdates(_0x201fcb,_0x212ba9){return function(_0x388bc6){if(_0x388bc6){return _0x388bc6[_0xbb01('0x22')](_0x201fcb)[_0xbb01('0x23')](function(_0xf98f87){return _0xf98f87;});}return null;};}function removeEntity(_0x2fd086,_0x3d2dcb){return function(_0x41215e){if(_0x41215e){return _0x41215e[_0xbb01('0x24')]()['then'](function(){var _0x36a13a=_0x41215e[_0xbb01('0x25')]({'plain':!![]});var _0x298bf8=_0xbb01('0x26');return db[_0xbb01('0x27')]['destroy']({'where':{'type':_0x298bf8,'resourceId':_0x36a13a['id']}})[_0xbb01('0x23')](function(){return _0x41215e;});})[_0xbb01('0x23')](function(){_0x2fd086[_0xbb01('0x1a')](0xcc)[_0xbb01('0x28')]();});}};}function handleEntityNotFound(_0x287434,_0x308c37){return function(_0x32ce36){if(!_0x32ce36){_0x287434[_0xbb01('0x29')](0x194);}return _0x32ce36;};}function handleError(_0x8e0f81,_0x7137a0){_0x7137a0=_0x7137a0||0x1f4;return function(_0x2091a5){logger[_0xbb01('0x2a')](_0x2091a5[_0xbb01('0x2b')]);if(_0x2091a5['name']){delete _0x2091a5[_0xbb01('0x2c')];}_0x8e0f81[_0xbb01('0x1a')](_0x7137a0)['send'](_0x2091a5);};}exports[_0xbb01('0x2d')]=function(_0x32b0a6,_0x3f3251){var _0x558974={},_0x244134={},_0x56498f={'count':0x0,'rows':[]};var _0x25c6bc=_['map'](db[_0xbb01('0x2e')]['rawAttributes'],function(_0x5a6830){return{'name':_0x5a6830[_0xbb01('0x2f')],'type':_0x5a6830[_0xbb01('0x30')][_0xbb01('0x31')]};});_0x244134[_0xbb01('0x32')]=_[_0xbb01('0x33')](_0x25c6bc,'name');_0x244134[_0xbb01('0x34')]=_[_0xbb01('0x35')](_0x32b0a6['query']);_0x244134[_0xbb01('0x36')]=_[_0xbb01('0x37')](_0x244134[_0xbb01('0x32')],_0x244134['query']);_0x558974['attributes']=_[_0xbb01('0x37')](_0x244134['model'],qs[_0xbb01('0x38')](_0x32b0a6['query']['fields']));_0x558974[_0xbb01('0x39')]=_0x558974[_0xbb01('0x39')][_0xbb01('0x3a')]?_0x558974[_0xbb01('0x39')]:_0x244134['model'];if(!_0x32b0a6[_0xbb01('0x34')]['hasOwnProperty']('nolimit')){_0x558974[_0xbb01('0x1d')]=qs['limit'](_0x32b0a6[_0xbb01('0x34')][_0xbb01('0x1d')]);_0x558974[_0xbb01('0x1b')]=qs[_0xbb01('0x1b')](_0x32b0a6[_0xbb01('0x34')]['offset']);}_0x558974[_0xbb01('0x3b')]=qs[_0xbb01('0x3c')](_0x32b0a6[_0xbb01('0x34')][_0xbb01('0x3c')]);_0x558974[_0xbb01('0x3d')]=qs[_0xbb01('0x36')](_[_0xbb01('0x3e')](_0x32b0a6[_0xbb01('0x34')],_0x244134[_0xbb01('0x36')]),_0x25c6bc);if(_0x32b0a6['query'][_0xbb01('0x3f')]){_0x558974[_0xbb01('0x3d')]=_[_0xbb01('0x40')](_0x558974[_0xbb01('0x3d')],{'$or':_['map'](_0x25c6bc,function(_0x4726f3){if(_0x4726f3['type']!==_0xbb01('0x41')){var _0x413288={};_0x413288[_0x4726f3[_0xbb01('0x2c')]]={'$like':'%'+_0x32b0a6['query'][_0xbb01('0x3f')]+'%'};return _0x413288;}})});}_0x558974=_[_0xbb01('0x40')]({},_0x558974,_0x32b0a6['options']);var _0x28d549={'where':_0x558974[_0xbb01('0x3d')]};return db[_0xbb01('0x2e')][_0xbb01('0x1e')](_0x28d549)[_0xbb01('0x23')](function(_0x41259c){_0x56498f['count']=_0x41259c;if(_0x32b0a6[_0xbb01('0x34')][_0xbb01('0x42')]){_0x558974[_0xbb01('0x43')]=[{'all':!![]}];}return db[_0xbb01('0x2e')][_0xbb01('0x44')](_0x558974);})[_0xbb01('0x23')](function(_0xda8315){_0x56498f[_0xbb01('0x45')]=_0xda8315;return _0x56498f;})[_0xbb01('0x23')](respondWithFilteredResult(_0x3f3251,_0x558974))[_0xbb01('0x46')](handleError(_0x3f3251,null));};exports[_0xbb01('0x47')]=function(_0x927163,_0x4f1c7d){var _0x2679fc={'raw':!![],'where':{'id':_0x927163[_0xbb01('0x48')]['id']}},_0x28684e={};_0x28684e['model']=_[_0xbb01('0x35')](db[_0xbb01('0x2e')][_0xbb01('0x49')]);_0x28684e[_0xbb01('0x34')]=_[_0xbb01('0x35')](_0x927163['query']);_0x28684e[_0xbb01('0x36')]=_[_0xbb01('0x37')](_0x28684e['model'],_0x28684e[_0xbb01('0x34')]);_0x2679fc[_0xbb01('0x39')]=_[_0xbb01('0x37')](_0x28684e[_0xbb01('0x32')],qs['fields'](_0x927163['query'][_0xbb01('0x38')]));_0x2679fc[_0xbb01('0x39')]=_0x2679fc[_0xbb01('0x39')]['length']?_0x2679fc[_0xbb01('0x39')]:_0x28684e[_0xbb01('0x32')];if(_0x927163['query'][_0xbb01('0x42')]){_0x2679fc[_0xbb01('0x43')]=[{'all':!![]}];}_0x2679fc=_[_0xbb01('0x40')]({},_0x2679fc,_0x927163[_0xbb01('0x4a')]);return db[_0xbb01('0x2e')][_0xbb01('0x4b')](_0x2679fc)[_0xbb01('0x23')](handleEntityNotFound(_0x4f1c7d,null))[_0xbb01('0x23')](respondWithResult(_0x4f1c7d,null))[_0xbb01('0x46')](handleError(_0x4f1c7d,null));};exports['create']=function(_0x591ddf,_0x6fc1b1){return db[_0xbb01('0x2e')][_0xbb01('0x4c')](_0x591ddf['body'],{})[_0xbb01('0x23')](function(_0x2e3173){var _0x51abfb=_0x591ddf[_0xbb01('0x4d')][_0xbb01('0x25')]({'plain':!![]});if(!_0x51abfb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51abfb[_0xbb01('0x4e')]===_0xbb01('0x4d')){var _0x209299=_0x2e3173['get']({'plain':!![]});var _0x598d60=_0xbb01('0x26');return db[_0xbb01('0x4f')][_0xbb01('0x4b')]({'where':{'name':_0x598d60,'userProfileId':_0x51abfb[_0xbb01('0x50')]},'raw':!![]})[_0xbb01('0x23')](function(_0x27942b){if(_0x27942b&&_0x27942b[_0xbb01('0x51')]===0x0){return db[_0xbb01('0x27')][_0xbb01('0x4c')]({'name':_0x209299['name'],'resourceId':_0x209299['id'],'type':_0x27942b[_0xbb01('0x2c')],'sectionId':_0x27942b['id']},{})[_0xbb01('0x23')](function(){return _0x2e3173;});}else{return _0x2e3173;}})[_0xbb01('0x46')](function(_0xdbbecd){logger[_0xbb01('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdbbecd);throw _0xdbbecd;});}return _0x2e3173;})['then'](respondWithResult(_0x6fc1b1,0xc9))[_0xbb01('0x46')](handleError(_0x6fc1b1,null));};exports[_0xbb01('0x22')]=function(_0x55b277,_0x4496ff){if(_0x55b277[_0xbb01('0x52')]['id']){delete _0x55b277['body']['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x55b277[_0xbb01('0x48')]['id']}})['then'](handleEntityNotFound(_0x4496ff,null))[_0xbb01('0x23')](saveUpdates(_0x55b277[_0xbb01('0x52')],null))[_0xbb01('0x23')](respondWithResult(_0x4496ff,null))['catch'](handleError(_0x4496ff,null));};exports[_0xbb01('0x24')]=function(_0x49eaf0,_0xd7ecf9){return db[_0xbb01('0x2e')]['find']({'where':{'id':_0x49eaf0['params']['id']}})[_0xbb01('0x23')](handleEntityNotFound(_0xd7ecf9,null))[_0xbb01('0x23')](removeEntity(_0xd7ecf9,null))['catch'](handleError(_0xd7ecf9,null));};exports['test']=function(_0x2e8b5f,_0x2b8045,_0x39946d){var _0x520eb5;return db[_0xbb01('0x2e')]['find']({'where':{'id':_0x2e8b5f['params']['id']},'attributes':['id','dsn']})[_0xbb01('0x23')](handleEntityNotFound(_0x2b8045,null))[_0xbb01('0x23')](function(_0x2d86c9){if(_0x2d86c9){var _0x1e1c22=require(_0xbb01('0x53'))();_0x1e1c22['openSync'](_0x2d86c9[_0xbb01('0x54')]);_0x1e1c22[_0xbb01('0x55')]();return _0x2d86c9;}})['then'](respondWithResult(_0x2b8045,null))[_0xbb01('0x46')](handleError(_0x2b8045,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index d8422ff..6054846 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 _0xcb37=['request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','SquareOdbc','square_odbc','lodash','bluebird'];(function(_0x36bf46,_0x3d8db9){var _0x1d0a72=function(_0x328e8d){while(--_0x328e8d){_0x36bf46['push'](_0x36bf46['shift']());}};_0x1d0a72(++_0x3d8db9);}(_0xcb37,0xa8));var _0x7cb3=function(_0x5c48ea,_0x1c325a){_0x5c48ea=_0x5c48ea-0x0;var _0x2f2aa8=_0xcb37[_0x5c48ea];return _0x2f2aa8;};'use strict';var _=require(_0x7cb3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7cb3('0x1'));var rp=require(_0x7cb3('0x2'));var fs=require('fs');var path=require(_0x7cb3('0x3'));var rimraf=require(_0x7cb3('0x4'));var config=require(_0x7cb3('0x5'));var attributes=require(_0x7cb3('0x6'));module[_0x7cb3('0x7')]=function(_0x823004,_0x3e8ca3){return _0x823004['define'](_0x7cb3('0x8'),attributes,{'tableName':_0x7cb3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x934e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','SquareOdbc','square_odbc','lodash'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x934e,0x74));var _0xe934=function(_0x4426e1,_0x3f2795){_0x4426e1=_0x4426e1-0x0;var _0x117c8c=_0x934e[_0x4426e1];return _0x117c8c;};'use strict';var _=require(_0xe934('0x0'));var util=require(_0xe934('0x1'));var logger=require(_0xe934('0x2'))(_0xe934('0x3'));var moment=require(_0xe934('0x4'));var BPromise=require(_0xe934('0x5'));var rp=require(_0xe934('0x6'));var fs=require('fs');var path=require(_0xe934('0x7'));var rimraf=require(_0xe934('0x8'));var config=require(_0xe934('0x9'));var attributes=require(_0xe934('0xa'));module['exports']=function(_0x4b5da4,_0x3eab61){return _0x4b5da4['define'](_0xe934('0xb'),attributes,{'tableName':_0xe934('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 5d8269e..080f892 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 _0xdde4=['attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','then','info','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options'];(function(_0x2d98a3,_0x341945){var _0xe139e4=function(_0x3af627){while(--_0x3af627){_0x2d98a3['push'](_0x2d98a3['shift']());}};_0xe139e4(++_0x341945);}(_0xdde4,0x90));var _0x4dde=function(_0x1a6e4c,_0xb89675){_0x1a6e4c=_0x1a6e4c-0x0;var _0x4d111b=_0xdde4[_0x1a6e4c];return _0x4d111b;};'use strict';var _=require(_0x4dde('0x0'));var util=require(_0x4dde('0x1'));var moment=require(_0x4dde('0x2'));var BPromise=require(_0x4dde('0x3'));var rs=require(_0x4dde('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4dde('0x5'));var logger=require('../../config/logger')(_0x4dde('0x6'));var config=require('../../config/environment');var jayson=require(_0x4dde('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25698c,_0x354655,_0x64c10f){return new BPromise(function(_0xe4a229,_0x5f3e34){return client['request'](_0x25698c,_0x64c10f)[_0x4dde('0x8')](function(_0x21ec78){logger[_0x4dde('0x9')]('SquareOdbc,\x20%s,\x20%s',_0x354655,'request\x20sent');logger[_0x4dde('0xa')](_0x4dde('0xb'),_0x354655,_0x4dde('0xc'),JSON[_0x4dde('0xd')](_0x21ec78));if(_0x21ec78[_0x4dde('0xe')]){if(_0x21ec78[_0x4dde('0xe')][_0x4dde('0xf')]===0x1f4){logger[_0x4dde('0xe')](_0x4dde('0x10'),_0x354655,_0x21ec78[_0x4dde('0xe')]['message']);return _0x5f3e34(_0x21ec78['error']['message']);}logger[_0x4dde('0xe')](_0x4dde('0x10'),_0x354655,_0x21ec78[_0x4dde('0xe')][_0x4dde('0x11')]);return _0xe4a229(_0x21ec78['error'][_0x4dde('0x11')]);}else{logger[_0x4dde('0x9')](_0x4dde('0x10'),_0x354655,_0x4dde('0xc'));_0xe4a229(_0x21ec78[_0x4dde('0x12')][_0x4dde('0x11')]);}})[_0x4dde('0x13')](function(_0x16f1c5){logger[_0x4dde('0xe')](_0x4dde('0x10'),_0x354655,_0x16f1c5);_0x5f3e34(_0x16f1c5);});});}exports[_0x4dde('0x14')]=function(_0x15bea9){var _0xd7aea0=this;return new Promise(function(_0x3f342a,_0x527301){return db[_0x4dde('0x15')][_0x4dde('0x16')]({'raw':_0x15bea9['options']?_0x15bea9[_0x4dde('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x15bea9['options']?_0x15bea9[_0x4dde('0x17')]['where']||null:null,'attributes':_0x15bea9['options']?_0x15bea9[_0x4dde('0x17')][_0x4dde('0x18')]||null:null,'include':_0x15bea9[_0x4dde('0x17')]?_0x15bea9[_0x4dde('0x17')][_0x4dde('0x19')]?_[_0x4dde('0x1a')](_0x15bea9[_0x4dde('0x17')][_0x4dde('0x19')],function(_0x30b509){return{'model':db[_0x30b509[_0x4dde('0x1b')]],'as':_0x30b509['as'],'attributes':_0x30b509['attributes'],'include':_0x30b509[_0x4dde('0x19')]?_[_0x4dde('0x1a')](_0x30b509[_0x4dde('0x19')],function(_0x726e8){return{'model':db[_0x726e8[_0x4dde('0x1b')]],'as':_0x726e8['as'],'attributes':_0x726e8['attributes'],'include':_0x726e8[_0x4dde('0x19')]?_[_0x4dde('0x1a')](_0x726e8['include'],function(_0x1896ce){return{'model':db[_0x1896ce[_0x4dde('0x1b')]],'as':_0x1896ce['as'],'attributes':_0x1896ce[_0x4dde('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4dde('0x8')](function(_0x981ef3){logger[_0x4dde('0x9')](_0x4dde('0x14'),_0x15bea9);logger[_0x4dde('0xa')](_0x4dde('0x14'),_0x15bea9,JSON[_0x4dde('0xd')](_0x981ef3));_0x3f342a(_0x981ef3);})[_0x4dde('0x13')](function(_0x56cb61){logger['error'](_0x4dde('0x14'),_0x56cb61[_0x4dde('0x11')],_0x15bea9);_0x527301(_0xd7aea0['error'](0x1f4,_0x56cb61[_0x4dde('0x11')]));});});}; \ No newline at end of file +var _0x06b1=['SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include','map','model','attributes','then','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x49a2b,_0x28b582){var _0x2f081a=function(_0xe1db3){while(--_0xe1db3){_0x49a2b['push'](_0x49a2b['shift']());}};_0x2f081a(++_0x28b582);}(_0x06b1,0x1dd));var _0x106b=function(_0x4ab5cd,_0x1830b1){_0x4ab5cd=_0x4ab5cd-0x0;var _0x489c58=_0x06b1[_0x4ab5cd];return _0x489c58;};'use strict';var _=require(_0x106b('0x0'));var util=require(_0x106b('0x1'));var moment=require(_0x106b('0x2'));var BPromise=require('bluebird');var rs=require(_0x106b('0x3'));var fs=require('fs');var Redis=require(_0x106b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x106b('0x5'));var logger=require(_0x106b('0x6'))(_0x106b('0x7'));var config=require(_0x106b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x106b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53e839,_0xa22198,_0x27906f){return new BPromise(function(_0x59059b,_0x54c0a6){return client[_0x106b('0xa')](_0x53e839,_0x27906f)['then'](function(_0x1fe48e){logger[_0x106b('0xb')]('SquareOdbc,\x20%s,\x20%s',_0xa22198,_0x106b('0xc'));logger[_0x106b('0xd')](_0x106b('0xe'),_0xa22198,_0x106b('0xc'),JSON[_0x106b('0xf')](_0x1fe48e));if(_0x1fe48e[_0x106b('0x10')]){if(_0x1fe48e[_0x106b('0x10')][_0x106b('0x11')]===0x1f4){logger[_0x106b('0x10')](_0x106b('0x12'),_0xa22198,_0x1fe48e['error'][_0x106b('0x13')]);return _0x54c0a6(_0x1fe48e[_0x106b('0x10')][_0x106b('0x13')]);}logger[_0x106b('0x10')](_0x106b('0x12'),_0xa22198,_0x1fe48e['error'][_0x106b('0x13')]);return _0x59059b(_0x1fe48e[_0x106b('0x10')][_0x106b('0x13')]);}else{logger[_0x106b('0xb')](_0x106b('0x12'),_0xa22198,_0x106b('0xc'));_0x59059b(_0x1fe48e[_0x106b('0x14')][_0x106b('0x13')]);}})[_0x106b('0x15')](function(_0x3fecea){logger['error'](_0x106b('0x12'),_0xa22198,_0x3fecea);_0x54c0a6(_0x3fecea);});});}exports[_0x106b('0x16')]=function(_0xbbb9e8){var _0x584f20=this;return new Promise(function(_0x302857,_0x1ed56c){return db[_0x106b('0x17')][_0x106b('0x18')]({'raw':_0xbbb9e8['options']?_0xbbb9e8[_0x106b('0x19')][_0x106b('0x1a')]===undefined?!![]:![]:!![],'where':_0xbbb9e8['options']?_0xbbb9e8[_0x106b('0x19')][_0x106b('0x1b')]||null:null,'attributes':_0xbbb9e8[_0x106b('0x19')]?_0xbbb9e8['options']['attributes']||null:null,'include':_0xbbb9e8[_0x106b('0x19')]?_0xbbb9e8[_0x106b('0x19')][_0x106b('0x1c')]?_[_0x106b('0x1d')](_0xbbb9e8[_0x106b('0x19')][_0x106b('0x1c')],function(_0x3af850){return{'model':db[_0x3af850[_0x106b('0x1e')]],'as':_0x3af850['as'],'attributes':_0x3af850[_0x106b('0x1f')],'include':_0x3af850[_0x106b('0x1c')]?_[_0x106b('0x1d')](_0x3af850[_0x106b('0x1c')],function(_0x4306a6){return{'model':db[_0x4306a6[_0x106b('0x1e')]],'as':_0x4306a6['as'],'attributes':_0x4306a6['attributes'],'include':_0x4306a6[_0x106b('0x1c')]?_[_0x106b('0x1d')](_0x4306a6[_0x106b('0x1c')],function(_0x309c22){return{'model':db[_0x309c22[_0x106b('0x1e')]],'as':_0x309c22['as'],'attributes':_0x309c22[_0x106b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x106b('0x20')](function(_0x9bdd63){logger[_0x106b('0xb')]('ShowSquareOdbc',_0xbbb9e8);logger['debug'](_0x106b('0x16'),_0xbbb9e8,JSON['stringify'](_0x9bdd63));_0x302857(_0x9bdd63);})['catch'](function(_0x1fb1a0){logger[_0x106b('0x10')](_0x106b('0x16'),_0x1fb1a0[_0x106b('0x13')],_0xbbb9e8);_0x1ed56c(_0x584f20[_0x106b('0x10')](0x1f4,_0x1fb1a0[_0x106b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index b533931..32c5029 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 _0xcef7=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','getUsers','post','create','/:id/users','addUsers','/:id','update','destroy','exports','util'];(function(_0x5a097c,_0x28506f){var _0x51b539=function(_0xd64448){while(--_0xd64448){_0x5a097c['push'](_0x5a097c['shift']());}};_0x51b539(++_0x28506f);}(_0xcef7,0xe3));var _0x7cef=function(_0x5f0ce0,_0x39eca7){_0x5f0ce0=_0x5f0ce0-0x0;var _0x4c65ac=_0xcef7[_0x5f0ce0];return _0x4c65ac;};'use strict';var multer=require('multer');var util=require(_0x7cef('0x0'));var path=require(_0x7cef('0x1'));var timeout=require(_0x7cef('0x2'));var express=require(_0x7cef('0x3'));var router=express[_0x7cef('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7cef('0x5'));var interaction=require(_0x7cef('0x6'));var config=require('../../config/environment');var controller=require('./squareProject.controller');router[_0x7cef('0x7')]('/',auth[_0x7cef('0x8')](),controller['index']);router[_0x7cef('0x7')]('/:id',auth[_0x7cef('0x8')](),controller[_0x7cef('0x9')]);router['get']('/:id/users',auth[_0x7cef('0x8')](),controller[_0x7cef('0xa')]);router[_0x7cef('0xb')]('/',auth[_0x7cef('0x8')](),controller[_0x7cef('0xc')]);router[_0x7cef('0xb')](_0x7cef('0xd'),auth['isAuthenticated'](),controller[_0x7cef('0xe')]);router['put'](_0x7cef('0xf'),auth['isAuthenticated'](),controller[_0x7cef('0x10')]);router['delete'](_0x7cef('0xf'),auth[_0x7cef('0x8')](),controller[_0x7cef('0x11')]);router['delete']('/:id/users',auth[_0x7cef('0x8')](),controller['removeUsers']);module[_0x7cef('0x12')]=router; \ No newline at end of file +var _0x28cd=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','/:id','isAuthenticated','show','/:id/users','post','create','addUsers','put','update','removeUsers','exports','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28cd,0x177));var _0xd28c=function(_0x1d81bf,_0x30eba3){_0x1d81bf=_0x1d81bf-0x0;var _0x4c143d=_0x28cd[_0x1d81bf];return _0x4c143d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd28c('0x0'));var timeout=require(_0xd28c('0x1'));var express=require(_0xd28c('0x2'));var router=express[_0xd28c('0x3')]();var fs_extra=require(_0xd28c('0x4'));var auth=require(_0xd28c('0x5'));var interaction=require(_0xd28c('0x6'));var config=require(_0xd28c('0x7'));var controller=require(_0xd28c('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd28c('0x9')](_0xd28c('0xa'),auth[_0xd28c('0xb')](),controller[_0xd28c('0xc')]);router[_0xd28c('0x9')](_0xd28c('0xd'),auth['isAuthenticated'](),controller['getUsers']);router[_0xd28c('0xe')]('/',auth[_0xd28c('0xb')](),controller[_0xd28c('0xf')]);router[_0xd28c('0xe')]('/:id/users',auth[_0xd28c('0xb')](),controller[_0xd28c('0x10')]);router[_0xd28c('0x11')](_0xd28c('0xa'),auth[_0xd28c('0xb')](),controller[_0xd28c('0x12')]);router['delete'](_0xd28c('0xa'),auth[_0xd28c('0xb')](),controller['destroy']);router['delete'](_0xd28c('0xd'),auth['isAuthenticated'](),controller[_0xd28c('0x13')]);module[_0xd28c('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 0592435..42adcba 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 _0xdbd8=['getDataValue','preproduction','toString','production','DATE','sequelize','exports','STRING','long'];(function(_0x305d8a,_0x4cf327){var _0x47b94f=function(_0x236872){while(--_0x236872){_0x305d8a['push'](_0x305d8a['shift']());}};_0x47b94f(++_0x4cf327);}(_0xdbd8,0x1a3));var _0x8dbd=function(_0x54b050,_0x5d5f05){_0x54b050=_0x54b050-0x0;var _0x3718ee=_0xdbd8[_0x54b050];return _0x3718ee;};'use strict';var Sequelize=require(_0x8dbd('0x0'));module[_0x8dbd('0x1')]={'name':{'type':Sequelize[_0x8dbd('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x8dbd('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x8dbd('0x3')),'get':function(){if(this[_0x8dbd('0x4')]('preproduction')){return this[_0x8dbd('0x4')](_0x8dbd('0x5'))[_0x8dbd('0x6')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0x8dbd('0x3')),'get':function(){if(this['getDataValue'](_0x8dbd('0x7'))){return this[_0x8dbd('0x4')](_0x8dbd('0x7'))[_0x8dbd('0x6')]('utf8');}}},'savedAt':{'type':Sequelize[_0x8dbd('0x8')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x0d91=['DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','preproduction','getDataValue','utf8','production','toString'];(function(_0x597424,_0x1a9bf2){var _0x2ae1e4=function(_0x405f4f){while(--_0x405f4f){_0x597424['push'](_0x597424['shift']());}};_0x2ae1e4(++_0x1a9bf2);}(_0x0d91,0x76));var _0x10d9=function(_0x4d4c19,_0x3147ff){_0x4d4c19=_0x4d4c19-0x0;var _0xf9e510=_0x0d91[_0x4d4c19];return _0xf9e510;};'use strict';var Sequelize=require(_0x10d9('0x0'));module[_0x10d9('0x1')]={'name':{'type':Sequelize[_0x10d9('0x2')],'unique':_0x10d9('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x10d9('0x4')]},'preproduction':{'type':Sequelize[_0x10d9('0x5')](_0x10d9('0x6')),'get':function(){if(this['getDataValue'](_0x10d9('0x7'))){return this[_0x10d9('0x8')](_0x10d9('0x7'))['toString'](_0x10d9('0x9'));}}},'production':{'type':Sequelize[_0x10d9('0x5')](_0x10d9('0x6')),'get':function(){if(this[_0x10d9('0x8')](_0x10d9('0xa'))){return this[_0x10d9('0x8')](_0x10d9('0xa'))[_0x10d9('0xb')](_0x10d9('0x9'));}}},'savedAt':{'type':Sequelize[_0x10d9('0xc')]},'publishedAt':{'type':Sequelize[_0x10d9('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index f3513db..ac4bb45 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 _0xbddc=['hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','rows','catch','show','params','include','find','create','role','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','User','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','SquareProjects','destroy','error','stack','name','send','index','map','SquareProject','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x5bc30f,_0x53e8f9){var _0x46c66a=function(_0x4c0f9e){while(--_0x4c0f9e){_0x5bc30f['push'](_0x5bc30f['shift']());}};_0x46c66a(++_0x53e8f9);}(_0xbddc,0x19f));var _0xcbdd=function(_0x27bed6,_0x4dcdfa){_0x27bed6=_0x27bed6-0x0;var _0x10c5dc=_0xbddc[_0x27bed6];return _0x10c5dc;};'use strict';var emlformat=require(_0xcbdd('0x0'));var rimraf=require(_0xcbdd('0x1'));var zipdir=require(_0xcbdd('0x2'));var jsonpatch=require(_0xcbdd('0x3'));var rp=require('request-promise');var moment=require(_0xcbdd('0x4'));var BPromise=require(_0xcbdd('0x5'));var Mustache=require('mustache');var util=require(_0xcbdd('0x6'));var path=require('path');var sox=require(_0xcbdd('0x7'));var csv=require('to-csv');var ejs=require(_0xcbdd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbdd('0x9'));var squel=require(_0xcbdd('0xa'));var crypto=require(_0xcbdd('0xb'));var jsforce=require(_0xcbdd('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcbdd('0xd'));var Papa=require(_0xcbdd('0xe'));var Redis=require(_0xcbdd('0xf'));var authService=require(_0xcbdd('0x10'));var qs=require(_0xcbdd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcbdd('0x12'));var logger=require(_0xcbdd('0x13'))(_0xcbdd('0x14'));var utils=require('../../config/utils');var config=require(_0xcbdd('0x15'));var licenseUtil=require(_0xcbdd('0x16'));var db=require(_0xcbdd('0x17'))['db'];config['redis']=_[_0xcbdd('0x18')](config[_0xcbdd('0x19')],{'host':_0xcbdd('0x1a'),'port':0x18eb});var socket=require(_0xcbdd('0x1b'))(new Redis(config[_0xcbdd('0x19')]));require(_0xcbdd('0x1c'))[_0xcbdd('0x1d')](socket);function respondWithStatusCode(_0x2c86f8,_0x471ac8){_0x471ac8=_0x471ac8||0xcc;return function(_0x2e566d){if(_0x2e566d){return _0x2c86f8[_0xcbdd('0x1e')](_0x471ac8);}return _0x2c86f8['status'](_0x471ac8)[_0xcbdd('0x1f')]();};}function respondWithResult(_0x4a3b72,_0x3e1cd8){_0x3e1cd8=_0x3e1cd8||0xc8;return function(_0x3f9f84){if(_0x3f9f84){return _0x4a3b72[_0xcbdd('0x20')](_0x3e1cd8)[_0xcbdd('0x21')](_0x3f9f84);}};}function respondWithFilteredResult(_0x253fec,_0x1b408e){return function(_0x291be2){if(_0x291be2){var _0x24cd5d=typeof _0x1b408e[_0xcbdd('0x22')]===_0xcbdd('0x23')&&typeof _0x1b408e[_0xcbdd('0x24')]===_0xcbdd('0x23');var _0x2a2de0=_0x291be2[_0xcbdd('0x25')];var _0x538be0=_0x24cd5d?0x0:_0x1b408e[_0xcbdd('0x22')];var _0x57de82=_0x24cd5d?_0x291be2['count']:_0x1b408e['offset']+_0x1b408e[_0xcbdd('0x24')];var _0x42398b;if(_0x57de82>=_0x2a2de0){_0x57de82=_0x2a2de0;_0x42398b=0xc8;}else{_0x42398b=0xce;}_0x253fec[_0xcbdd('0x20')](_0x42398b);return _0x253fec[_0xcbdd('0x26')](_0xcbdd('0x27'),_0x538be0+'-'+_0x57de82+'/'+_0x2a2de0)['json'](_0x291be2);}return null;};}function patchUpdates(_0x12d543){return function(_0x38cccd){try{jsonpatch[_0xcbdd('0x28')](_0x38cccd,_0x12d543,!![]);}catch(_0x1852c3){return BPromise[_0xcbdd('0x29')](_0x1852c3);}return _0x38cccd['save']();};}function saveUpdates(_0x5e1f8a,_0x279cbb){return function(_0xf8ff78){if(_0xf8ff78){return _0xf8ff78[_0xcbdd('0x2a')](_0x5e1f8a)[_0xcbdd('0x2b')](function(_0x36ea4f){return _0x36ea4f;});}return null;};}function removeEntity(_0xa6cfdd,_0x431215){return function(_0x5e0044){if(_0x5e0044){return _0x5e0044['destroy']()['then'](function(){var _0x478acb=_0x5e0044[_0xcbdd('0x2c')]({'plain':!![]});var _0x2888f4=_0xcbdd('0x2d');return db['UserProfileResource'][_0xcbdd('0x2e')]({'where':{'type':_0x2888f4,'resourceId':_0x478acb['id']}})[_0xcbdd('0x2b')](function(){return _0x5e0044;});})[_0xcbdd('0x2b')](function(){_0xa6cfdd['status'](0xcc)[_0xcbdd('0x1f')]();});}};}function handleEntityNotFound(_0x3dc6d3,_0x340c3d){return function(_0x10f8ec){if(!_0x10f8ec){_0x3dc6d3[_0xcbdd('0x1e')](0x194);}return _0x10f8ec;};}function handleError(_0x2f03c0,_0x1a226e){_0x1a226e=_0x1a226e||0x1f4;return function(_0x20aa3b){logger[_0xcbdd('0x2f')](_0x20aa3b[_0xcbdd('0x30')]);if(_0x20aa3b[_0xcbdd('0x31')]){delete _0x20aa3b[_0xcbdd('0x31')];}_0x2f03c0[_0xcbdd('0x20')](_0x1a226e)[_0xcbdd('0x32')](_0x20aa3b);};}exports[_0xcbdd('0x33')]=function(_0x3e9d71,_0x2ab121){var _0xbe02a4={},_0x108d48={},_0x56c710={'count':0x0,'rows':[]};var _0x3a6d0b=_[_0xcbdd('0x34')](db[_0xcbdd('0x35')][_0xcbdd('0x36')],function(_0x3652a9){return{'name':_0x3652a9['fieldName'],'type':_0x3652a9[_0xcbdd('0x37')][_0xcbdd('0x38')]};});_0x108d48[_0xcbdd('0x39')]=_['map'](_0x3a6d0b,'name');_0x108d48['query']=_[_0xcbdd('0x3a')](_0x3e9d71[_0xcbdd('0x3b')]);_0x108d48[_0xcbdd('0x3c')]=_[_0xcbdd('0x3d')](_0x108d48[_0xcbdd('0x39')],_0x108d48[_0xcbdd('0x3b')]);_0xbe02a4[_0xcbdd('0x3e')]=_[_0xcbdd('0x3d')](_0x108d48[_0xcbdd('0x39')],qs[_0xcbdd('0x3f')](_0x3e9d71[_0xcbdd('0x3b')][_0xcbdd('0x3f')]));_0xbe02a4['attributes']=_0xbe02a4[_0xcbdd('0x3e')][_0xcbdd('0x40')]?_0xbe02a4['attributes']:_0x108d48[_0xcbdd('0x39')];if(!_0x3e9d71[_0xcbdd('0x3b')][_0xcbdd('0x41')](_0xcbdd('0x42'))){_0xbe02a4[_0xcbdd('0x24')]=qs[_0xcbdd('0x24')](_0x3e9d71[_0xcbdd('0x3b')][_0xcbdd('0x24')]);_0xbe02a4[_0xcbdd('0x22')]=qs['offset'](_0x3e9d71['query']['offset']);}_0xbe02a4[_0xcbdd('0x43')]=qs['sort'](_0x3e9d71[_0xcbdd('0x3b')][_0xcbdd('0x44')]);_0xbe02a4[_0xcbdd('0x45')]=qs[_0xcbdd('0x3c')](_[_0xcbdd('0x46')](_0x3e9d71[_0xcbdd('0x3b')],_0x108d48['filters']),_0x3a6d0b);if(_0x3e9d71[_0xcbdd('0x3b')]['filter']){_0xbe02a4[_0xcbdd('0x45')]=_[_0xcbdd('0x47')](_0xbe02a4['where'],{'$or':_['map'](_0x3a6d0b,function(_0x562ac8){if(_0x562ac8['type']!=='VIRTUAL'){var _0x146060={};_0x146060[_0x562ac8[_0xcbdd('0x31')]]={'$like':'%'+_0x3e9d71[_0xcbdd('0x3b')][_0xcbdd('0x48')]+'%'};return _0x146060;}})});}_0xbe02a4=_[_0xcbdd('0x47')]({},_0xbe02a4,_0x3e9d71[_0xcbdd('0x49')]);var _0x49871f={'where':_0xbe02a4[_0xcbdd('0x45')]};return db[_0xcbdd('0x35')][_0xcbdd('0x25')](_0x49871f)[_0xcbdd('0x2b')](function(_0x4bcb2d){_0x56c710[_0xcbdd('0x25')]=_0x4bcb2d;if(_0x3e9d71['query']['includeAll']){_0xbe02a4['include']=[{'all':!![]}];}return db[_0xcbdd('0x35')]['findAll'](_0xbe02a4);})[_0xcbdd('0x2b')](function(_0x66a220){_0x56c710[_0xcbdd('0x4a')]=_0x66a220;return _0x56c710;})[_0xcbdd('0x2b')](respondWithFilteredResult(_0x2ab121,_0xbe02a4))[_0xcbdd('0x4b')](handleError(_0x2ab121,null));};exports[_0xcbdd('0x4c')]=function(_0x46097c,_0x4734fa){var _0x249013={'raw':![],'where':{'id':_0x46097c[_0xcbdd('0x4d')]['id']}},_0x25e82f={};_0x25e82f[_0xcbdd('0x39')]=_[_0xcbdd('0x3a')](db['SquareProject']['rawAttributes']);_0x25e82f[_0xcbdd('0x3b')]=_[_0xcbdd('0x3a')](_0x46097c[_0xcbdd('0x3b')]);_0x25e82f[_0xcbdd('0x3c')]=_[_0xcbdd('0x3d')](_0x25e82f[_0xcbdd('0x39')],_0x25e82f[_0xcbdd('0x3b')]);_0x249013['attributes']=_[_0xcbdd('0x3d')](_0x25e82f['model'],qs[_0xcbdd('0x3f')](_0x46097c[_0xcbdd('0x3b')][_0xcbdd('0x3f')]));_0x249013['attributes']=_0x249013[_0xcbdd('0x3e')][_0xcbdd('0x40')]?_0x249013[_0xcbdd('0x3e')]:_0x25e82f[_0xcbdd('0x39')];if(_0x46097c['query']['includeAll']){_0x249013[_0xcbdd('0x4e')]=[{'all':!![]}];}_0x249013=_[_0xcbdd('0x47')]({},_0x249013,_0x46097c['options']);return db['SquareProject'][_0xcbdd('0x4f')](_0x249013)[_0xcbdd('0x2b')](handleEntityNotFound(_0x4734fa,null))[_0xcbdd('0x2b')](respondWithResult(_0x4734fa,null))[_0xcbdd('0x4b')](handleError(_0x4734fa,null));};exports[_0xcbdd('0x50')]=function(_0x66175,_0x415c4){return db['SquareProject']['create'](_0x66175['body'],{})[_0xcbdd('0x2b')](function(_0xb7e919){var _0x4a4572=_0x66175['user'][_0xcbdd('0x2c')]({'plain':!![]});if(!_0x4a4572)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a4572[_0xcbdd('0x51')]===_0xcbdd('0x52')){var _0x52b6e1=_0xb7e919[_0xcbdd('0x2c')]({'plain':!![]});var _0x4fdfb4=_0xcbdd('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x4fdfb4,'userProfileId':_0x4a4572[_0xcbdd('0x53')]},'raw':!![]})[_0xcbdd('0x2b')](function(_0x4ff081){if(_0x4ff081&&_0x4ff081['autoAssociation']===0x0){return db[_0xcbdd('0x54')]['create']({'name':_0x52b6e1[_0xcbdd('0x31')],'resourceId':_0x52b6e1['id'],'type':_0x4ff081['name'],'sectionId':_0x4ff081['id']},{})['then'](function(){return _0xb7e919;});}else{return _0xb7e919;}})['catch'](function(_0x482ab8){logger[_0xcbdd('0x2f')](_0xcbdd('0x55'),_0x482ab8);throw _0x482ab8;});}return _0xb7e919;})[_0xcbdd('0x2b')](respondWithResult(_0x415c4,0xc9))[_0xcbdd('0x4b')](handleError(_0x415c4,null));};exports[_0xcbdd('0x2a')]=function(_0x515934,_0x5b750f){if(_0x515934[_0xcbdd('0x56')]['id']){delete _0x515934[_0xcbdd('0x56')]['id'];}return db['SquareProject'][_0xcbdd('0x4f')]({'where':{'id':_0x515934[_0xcbdd('0x4d')]['id']}})[_0xcbdd('0x2b')](handleEntityNotFound(_0x5b750f,null))[_0xcbdd('0x2b')](saveUpdates(_0x515934[_0xcbdd('0x56')],null))[_0xcbdd('0x2b')](respondWithResult(_0x5b750f,null))[_0xcbdd('0x4b')](handleError(_0x5b750f,null));};exports[_0xcbdd('0x2e')]=function(_0x5a6b15,_0x4739ff){return db[_0xcbdd('0x35')][_0xcbdd('0x4f')]({'where':{'id':_0x5a6b15[_0xcbdd('0x4d')]['id']}})[_0xcbdd('0x2b')](handleEntityNotFound(_0x4739ff,null))[_0xcbdd('0x2b')](removeEntity(_0x4739ff,null))[_0xcbdd('0x4b')](handleError(_0x4739ff,null));};exports[_0xcbdd('0x57')]=function(_0x53fc82,_0x2024d5,_0x55f695){return db[_0xcbdd('0x35')][_0xcbdd('0x4f')]({'where':{'id':_0x53fc82['params']['id']}})[_0xcbdd('0x2b')](handleEntityNotFound(_0x2024d5,null))[_0xcbdd('0x2b')](function(_0x293c98){if(_0x293c98){return _0x293c98[_0xcbdd('0x57')](_0x53fc82[_0xcbdd('0x56')][_0xcbdd('0x58')],_[_0xcbdd('0x59')](_0x53fc82[_0xcbdd('0x56')],[_0xcbdd('0x58'),'id'])||{});}})[_0xcbdd('0x2b')](respondWithResult(_0x2024d5,null))[_0xcbdd('0x4b')](handleError(_0x2024d5,null));};exports[_0xcbdd('0x5a')]=function(_0x2eb0dc,_0x3ebf19,_0x967a2){return db[_0xcbdd('0x35')][_0xcbdd('0x4f')]({'where':{'id':_0x2eb0dc['params']['id']}})[_0xcbdd('0x2b')](handleEntityNotFound(_0x3ebf19,null))['then'](function(_0x27a542){if(_0x27a542){return _0x27a542[_0xcbdd('0x5a')](_0x2eb0dc[_0xcbdd('0x3b')][_0xcbdd('0x58')])[_0xcbdd('0x2b')](function(){if(_[_0xcbdd('0x5b')](_0x2eb0dc['query'][_0xcbdd('0x58')])){for(var _0x5e5bd5=0x0;_0x5e5bd5<_0x2eb0dc[_0xcbdd('0x3b')][_0xcbdd('0x58')]['length'];_0x5e5bd5+=0x1){socket[_0xcbdd('0x5c')](_0xcbdd('0x5d'),{'UserId':Number(_0x2eb0dc['query'][_0xcbdd('0x58')][_0x5e5bd5]),'SquareProjectId':Number(_0x2eb0dc[_0xcbdd('0x4d')]['id'])});}}else{socket[_0xcbdd('0x5c')]('userSquareProject:remove',{'UserId':Number(_0x2eb0dc[_0xcbdd('0x3b')]['ids']),'SquareProjectId':Number(_0x2eb0dc[_0xcbdd('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ebf19,null))[_0xcbdd('0x4b')](handleError(_0x3ebf19,null));};exports['getUsers']=function(_0xdf9260,_0x5d6984,_0x293fa6){var _0x191df1={};var _0xea3996={};var _0x21eccd;var _0x547b28;return db[_0xcbdd('0x35')]['findOne']({'where':{'id':_0xdf9260[_0xcbdd('0x4d')]['id']}})[_0xcbdd('0x2b')](handleEntityNotFound(_0x5d6984,null))[_0xcbdd('0x2b')](function(_0x367eb6){if(_0x367eb6){_0x21eccd=_0x367eb6;_0xea3996[_0xcbdd('0x39')]=_[_0xcbdd('0x3a')](db[_0xcbdd('0x5e')][_0xcbdd('0x36')]);_0xea3996[_0xcbdd('0x3b')]=_[_0xcbdd('0x3a')](_0xdf9260[_0xcbdd('0x3b')]);_0xea3996[_0xcbdd('0x3c')]=_[_0xcbdd('0x3d')](_0xea3996[_0xcbdd('0x39')],_0xea3996['query']);_0x191df1[_0xcbdd('0x3e')]=_['intersection'](_0xea3996['model'],qs[_0xcbdd('0x3f')](_0xdf9260[_0xcbdd('0x3b')][_0xcbdd('0x3f')]));_0x191df1['attributes']=_0x191df1['attributes'][_0xcbdd('0x40')]?_0x191df1[_0xcbdd('0x3e')]:_0xea3996['model'];_0x191df1['order']=qs[_0xcbdd('0x44')](_0xdf9260['query']['sort']);_0x191df1[_0xcbdd('0x45')]=qs['filters'](_[_0xcbdd('0x46')](_0xdf9260[_0xcbdd('0x3b')],_0xea3996[_0xcbdd('0x3c')]));if(_0xdf9260[_0xcbdd('0x3b')]['filter']){_0x191df1[_0xcbdd('0x45')]=_[_0xcbdd('0x47')](_0x191df1['where'],{'$or':_[_0xcbdd('0x34')](_0x191df1['attributes'],function(_0x42f5b3){var _0x56b77b={};_0x56b77b[_0x42f5b3]={'$like':'%'+_0xdf9260[_0xcbdd('0x3b')][_0xcbdd('0x48')]+'%'};return _0x56b77b;})});}_0x191df1=_[_0xcbdd('0x47')]({},_0x191df1,_0xdf9260['options']);return _0x21eccd[_0xcbdd('0x5f')](_0x191df1);}})[_0xcbdd('0x2b')](function(_0x2a27ac){if(_0x2a27ac){_0x547b28=_0x2a27ac['length'];if(!_0xdf9260['query'][_0xcbdd('0x41')](_0xcbdd('0x42'))){_0x191df1[_0xcbdd('0x24')]=qs['limit'](_0xdf9260[_0xcbdd('0x3b')][_0xcbdd('0x24')]);_0x191df1[_0xcbdd('0x22')]=qs[_0xcbdd('0x22')](_0xdf9260[_0xcbdd('0x3b')][_0xcbdd('0x22')]);}return _0x21eccd['getUsers'](_0x191df1);}})[_0xcbdd('0x2b')](function(_0x292466){if(_0x292466){return _0x292466?{'count':_0x547b28,'rows':_0x292466}:null;}})[_0xcbdd('0x2b')](respondWithResult(_0x5d6984,null))[_0xcbdd('0x4b')](handleError(_0x5d6984,null));}; \ No newline at end of file +var _0xf189=['isArray','emit','userSquareProject:remove','findOne','User','rawAttributes','getUsers','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','SquareProjects','UserProfileResource','stack','name','send','index','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','SquareProject','includeAll','include','findAll','rows','catch','show','params','options','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addUsers','omit','ids','removeUsers'];(function(_0x35387d,_0x1ba72f){var _0x3aba56=function(_0x42cd08){while(--_0x42cd08){_0x35387d['push'](_0x35387d['shift']());}};_0x3aba56(++_0x1ba72f);}(_0xf189,0x134));var _0x9f18=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf189[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f18('0x0'));var zipdir=require(_0x9f18('0x1'));var jsonpatch=require(_0x9f18('0x2'));var rp=require(_0x9f18('0x3'));var moment=require(_0x9f18('0x4'));var BPromise=require(_0x9f18('0x5'));var Mustache=require(_0x9f18('0x6'));var util=require('util');var path=require(_0x9f18('0x7'));var sox=require(_0x9f18('0x8'));var csv=require(_0x9f18('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f18('0xa'));var _=require(_0x9f18('0xb'));var squel=require('squel');var crypto=require(_0x9f18('0xc'));var jsforce=require(_0x9f18('0xd'));var deskjs=require(_0x9f18('0xe'));var toCsv=require(_0x9f18('0x9'));var querystring=require('querystring');var Papa=require(_0x9f18('0xf'));var Redis=require('ioredis');var authService=require(_0x9f18('0x10'));var qs=require(_0x9f18('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f18('0x12'));var logger=require(_0x9f18('0x13'))(_0x9f18('0x14'));var utils=require(_0x9f18('0x15'));var config=require(_0x9f18('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f18('0x17'))['db'];config['redis']=_[_0x9f18('0x18')](config[_0x9f18('0x19')],{'host':_0x9f18('0x1a'),'port':0x18eb});var socket=require(_0x9f18('0x1b'))(new Redis(config[_0x9f18('0x19')]));require(_0x9f18('0x1c'))[_0x9f18('0x1d')](socket);function respondWithStatusCode(_0x3d8101,_0x5d7885){_0x5d7885=_0x5d7885||0xcc;return function(_0x573e88){if(_0x573e88){return _0x3d8101[_0x9f18('0x1e')](_0x5d7885);}return _0x3d8101[_0x9f18('0x1f')](_0x5d7885)[_0x9f18('0x20')]();};}function respondWithResult(_0x553c99,_0x3a6d0f){_0x3a6d0f=_0x3a6d0f||0xc8;return function(_0x5c5ae3){if(_0x5c5ae3){return _0x553c99[_0x9f18('0x1f')](_0x3a6d0f)[_0x9f18('0x21')](_0x5c5ae3);}};}function respondWithFilteredResult(_0x48872d,_0x3e5196){return function(_0x375e02){if(_0x375e02){var _0x2e1976=typeof _0x3e5196['offset']===_0x9f18('0x22')&&typeof _0x3e5196['limit']===_0x9f18('0x22');var _0x5c2b54=_0x375e02[_0x9f18('0x23')];var _0x5d0c88=_0x2e1976?0x0:_0x3e5196[_0x9f18('0x24')];var _0xba5d97=_0x2e1976?_0x375e02[_0x9f18('0x23')]:_0x3e5196[_0x9f18('0x24')]+_0x3e5196['limit'];var _0x1a2bfb;if(_0xba5d97>=_0x5c2b54){_0xba5d97=_0x5c2b54;_0x1a2bfb=0xc8;}else{_0x1a2bfb=0xce;}_0x48872d[_0x9f18('0x1f')](_0x1a2bfb);return _0x48872d[_0x9f18('0x25')](_0x9f18('0x26'),_0x5d0c88+'-'+_0xba5d97+'/'+_0x5c2b54)[_0x9f18('0x21')](_0x375e02);}return null;};}function patchUpdates(_0x11170d){return function(_0x31a445){try{jsonpatch['apply'](_0x31a445,_0x11170d,!![]);}catch(_0x3127fe){return BPromise[_0x9f18('0x27')](_0x3127fe);}return _0x31a445[_0x9f18('0x28')]();};}function saveUpdates(_0x52d22d,_0x14382f){return function(_0x1e8bd7){if(_0x1e8bd7){return _0x1e8bd7[_0x9f18('0x29')](_0x52d22d)[_0x9f18('0x2a')](function(_0x2d39c7){return _0x2d39c7;});}return null;};}function removeEntity(_0x3295b5,_0x3e09e2){return function(_0x1b12be){if(_0x1b12be){return _0x1b12be[_0x9f18('0x2b')]()[_0x9f18('0x2a')](function(){var _0x557584=_0x1b12be['get']({'plain':!![]});var _0x5d31cd=_0x9f18('0x2c');return db[_0x9f18('0x2d')][_0x9f18('0x2b')]({'where':{'type':_0x5d31cd,'resourceId':_0x557584['id']}})['then'](function(){return _0x1b12be;});})['then'](function(){_0x3295b5['status'](0xcc)[_0x9f18('0x20')]();});}};}function handleEntityNotFound(_0x1d026d,_0x6423fc){return function(_0x4c83dd){if(!_0x4c83dd){_0x1d026d['sendStatus'](0x194);}return _0x4c83dd;};}function handleError(_0x27d298,_0x3ac189){_0x3ac189=_0x3ac189||0x1f4;return function(_0x315cca){logger['error'](_0x315cca[_0x9f18('0x2e')]);if(_0x315cca[_0x9f18('0x2f')]){delete _0x315cca[_0x9f18('0x2f')];}_0x27d298['status'](_0x3ac189)[_0x9f18('0x30')](_0x315cca);};}exports[_0x9f18('0x31')]=function(_0x1e6b3c,_0x56bb5a){var _0x193297={},_0xb96d97={},_0x339964={'count':0x0,'rows':[]};var _0x19e946=_['map'](db['SquareProject']['rawAttributes'],function(_0x5579b2){return{'name':_0x5579b2[_0x9f18('0x32')],'type':_0x5579b2['type']['key']};});_0xb96d97['model']=_[_0x9f18('0x33')](_0x19e946,'name');_0xb96d97[_0x9f18('0x34')]=_[_0x9f18('0x35')](_0x1e6b3c[_0x9f18('0x34')]);_0xb96d97[_0x9f18('0x36')]=_[_0x9f18('0x37')](_0xb96d97[_0x9f18('0x38')],_0xb96d97['query']);_0x193297[_0x9f18('0x39')]=_[_0x9f18('0x37')](_0xb96d97[_0x9f18('0x38')],qs[_0x9f18('0x3a')](_0x1e6b3c['query'][_0x9f18('0x3a')]));_0x193297[_0x9f18('0x39')]=_0x193297['attributes'][_0x9f18('0x3b')]?_0x193297[_0x9f18('0x39')]:_0xb96d97[_0x9f18('0x38')];if(!_0x1e6b3c[_0x9f18('0x34')]['hasOwnProperty'](_0x9f18('0x3c'))){_0x193297[_0x9f18('0x3d')]=qs['limit'](_0x1e6b3c[_0x9f18('0x34')][_0x9f18('0x3d')]);_0x193297['offset']=qs[_0x9f18('0x24')](_0x1e6b3c['query'][_0x9f18('0x24')]);}_0x193297[_0x9f18('0x3e')]=qs[_0x9f18('0x3f')](_0x1e6b3c[_0x9f18('0x34')]['sort']);_0x193297[_0x9f18('0x40')]=qs['filters'](_['pick'](_0x1e6b3c['query'],_0xb96d97[_0x9f18('0x36')]),_0x19e946);if(_0x1e6b3c[_0x9f18('0x34')][_0x9f18('0x41')]){_0x193297[_0x9f18('0x40')]=_[_0x9f18('0x42')](_0x193297[_0x9f18('0x40')],{'$or':_[_0x9f18('0x33')](_0x19e946,function(_0x21af81){if(_0x21af81[_0x9f18('0x43')]!==_0x9f18('0x44')){var _0x5554ca={};_0x5554ca[_0x21af81[_0x9f18('0x2f')]]={'$like':'%'+_0x1e6b3c[_0x9f18('0x34')][_0x9f18('0x41')]+'%'};return _0x5554ca;}})});}_0x193297=_[_0x9f18('0x42')]({},_0x193297,_0x1e6b3c['options']);var _0x298505={'where':_0x193297[_0x9f18('0x40')]};return db[_0x9f18('0x45')][_0x9f18('0x23')](_0x298505)[_0x9f18('0x2a')](function(_0x47de1d){_0x339964[_0x9f18('0x23')]=_0x47de1d;if(_0x1e6b3c[_0x9f18('0x34')][_0x9f18('0x46')]){_0x193297[_0x9f18('0x47')]=[{'all':!![]}];}return db[_0x9f18('0x45')][_0x9f18('0x48')](_0x193297);})[_0x9f18('0x2a')](function(_0x2945c7){_0x339964[_0x9f18('0x49')]=_0x2945c7;return _0x339964;})[_0x9f18('0x2a')](respondWithFilteredResult(_0x56bb5a,_0x193297))[_0x9f18('0x4a')](handleError(_0x56bb5a,null));};exports[_0x9f18('0x4b')]=function(_0x14f1c2,_0x358742){var _0xec893d={'raw':![],'where':{'id':_0x14f1c2[_0x9f18('0x4c')]['id']}},_0x48823e={};_0x48823e[_0x9f18('0x38')]=_[_0x9f18('0x35')](db[_0x9f18('0x45')]['rawAttributes']);_0x48823e[_0x9f18('0x34')]=_['keys'](_0x14f1c2[_0x9f18('0x34')]);_0x48823e['filters']=_[_0x9f18('0x37')](_0x48823e[_0x9f18('0x38')],_0x48823e[_0x9f18('0x34')]);_0xec893d['attributes']=_[_0x9f18('0x37')](_0x48823e[_0x9f18('0x38')],qs[_0x9f18('0x3a')](_0x14f1c2[_0x9f18('0x34')][_0x9f18('0x3a')]));_0xec893d['attributes']=_0xec893d[_0x9f18('0x39')][_0x9f18('0x3b')]?_0xec893d['attributes']:_0x48823e[_0x9f18('0x38')];if(_0x14f1c2[_0x9f18('0x34')][_0x9f18('0x46')]){_0xec893d[_0x9f18('0x47')]=[{'all':!![]}];}_0xec893d=_[_0x9f18('0x42')]({},_0xec893d,_0x14f1c2[_0x9f18('0x4d')]);return db[_0x9f18('0x45')]['find'](_0xec893d)[_0x9f18('0x2a')](handleEntityNotFound(_0x358742,null))['then'](respondWithResult(_0x358742,null))[_0x9f18('0x4a')](handleError(_0x358742,null));};exports['create']=function(_0x501c39,_0x32cdf4){return db[_0x9f18('0x45')][_0x9f18('0x4e')](_0x501c39[_0x9f18('0x4f')],{})[_0x9f18('0x2a')](function(_0x26d244){var _0xcca6f9=_0x501c39[_0x9f18('0x50')]['get']({'plain':!![]});if(!_0xcca6f9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcca6f9[_0x9f18('0x51')]===_0x9f18('0x50')){var _0x460b59=_0x26d244['get']({'plain':!![]});var _0x3030ec=_0x9f18('0x2c');return db[_0x9f18('0x52')]['find']({'where':{'name':_0x3030ec,'userProfileId':_0xcca6f9[_0x9f18('0x53')]},'raw':!![]})[_0x9f18('0x2a')](function(_0x167c30){if(_0x167c30&&_0x167c30[_0x9f18('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x460b59[_0x9f18('0x2f')],'resourceId':_0x460b59['id'],'type':_0x167c30[_0x9f18('0x2f')],'sectionId':_0x167c30['id']},{})[_0x9f18('0x2a')](function(){return _0x26d244;});}else{return _0x26d244;}})[_0x9f18('0x4a')](function(_0x27e39e){logger[_0x9f18('0x55')](_0x9f18('0x56'),_0x27e39e);throw _0x27e39e;});}return _0x26d244;})[_0x9f18('0x2a')](respondWithResult(_0x32cdf4,0xc9))[_0x9f18('0x4a')](handleError(_0x32cdf4,null));};exports[_0x9f18('0x29')]=function(_0x3fe24f,_0x1badc0){if(_0x3fe24f['body']['id']){delete _0x3fe24f[_0x9f18('0x4f')]['id'];}return db[_0x9f18('0x45')][_0x9f18('0x57')]({'where':{'id':_0x3fe24f[_0x9f18('0x4c')]['id']}})[_0x9f18('0x2a')](handleEntityNotFound(_0x1badc0,null))['then'](saveUpdates(_0x3fe24f[_0x9f18('0x4f')],null))[_0x9f18('0x2a')](respondWithResult(_0x1badc0,null))['catch'](handleError(_0x1badc0,null));};exports[_0x9f18('0x2b')]=function(_0x42a8c1,_0x202491){return db[_0x9f18('0x45')][_0x9f18('0x57')]({'where':{'id':_0x42a8c1[_0x9f18('0x4c')]['id']}})[_0x9f18('0x2a')](handleEntityNotFound(_0x202491,null))[_0x9f18('0x2a')](removeEntity(_0x202491,null))['catch'](handleError(_0x202491,null));};exports[_0x9f18('0x58')]=function(_0x27008f,_0x4452a1,_0x550c70){return db[_0x9f18('0x45')][_0x9f18('0x57')]({'where':{'id':_0x27008f[_0x9f18('0x4c')]['id']}})[_0x9f18('0x2a')](handleEntityNotFound(_0x4452a1,null))[_0x9f18('0x2a')](function(_0xedb1b2){if(_0xedb1b2){return _0xedb1b2[_0x9f18('0x58')](_0x27008f['body']['ids'],_[_0x9f18('0x59')](_0x27008f[_0x9f18('0x4f')],[_0x9f18('0x5a'),'id'])||{});}})[_0x9f18('0x2a')](respondWithResult(_0x4452a1,null))['catch'](handleError(_0x4452a1,null));};exports[_0x9f18('0x5b')]=function(_0x46de62,_0x2de482,_0x6e5502){return db[_0x9f18('0x45')][_0x9f18('0x57')]({'where':{'id':_0x46de62[_0x9f18('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2de482,null))['then'](function(_0x5f4274){if(_0x5f4274){return _0x5f4274[_0x9f18('0x5b')](_0x46de62[_0x9f18('0x34')][_0x9f18('0x5a')])[_0x9f18('0x2a')](function(){if(_[_0x9f18('0x5c')](_0x46de62[_0x9f18('0x34')][_0x9f18('0x5a')])){for(var _0x3c80e7=0x0;_0x3c80e7<_0x46de62[_0x9f18('0x34')][_0x9f18('0x5a')]['length'];_0x3c80e7+=0x1){socket[_0x9f18('0x5d')](_0x9f18('0x5e'),{'UserId':Number(_0x46de62['query'][_0x9f18('0x5a')][_0x3c80e7]),'SquareProjectId':Number(_0x46de62[_0x9f18('0x4c')]['id'])});}}else{socket[_0x9f18('0x5d')](_0x9f18('0x5e'),{'UserId':Number(_0x46de62[_0x9f18('0x34')]['ids']),'SquareProjectId':Number(_0x46de62['params']['id'])});}});}})[_0x9f18('0x2a')](respondWithStatusCode(_0x2de482,null))['catch'](handleError(_0x2de482,null));};exports['getUsers']=function(_0x152568,_0x2f95e7,_0x51e4be){var _0x386d7f={};var _0x5f0a1c={};var _0x380e31;var _0x159e20;return db['SquareProject'][_0x9f18('0x5f')]({'where':{'id':_0x152568['params']['id']}})[_0x9f18('0x2a')](handleEntityNotFound(_0x2f95e7,null))['then'](function(_0x1da231){if(_0x1da231){_0x380e31=_0x1da231;_0x5f0a1c[_0x9f18('0x38')]=_[_0x9f18('0x35')](db[_0x9f18('0x60')][_0x9f18('0x61')]);_0x5f0a1c[_0x9f18('0x34')]=_[_0x9f18('0x35')](_0x152568['query']);_0x5f0a1c[_0x9f18('0x36')]=_[_0x9f18('0x37')](_0x5f0a1c[_0x9f18('0x38')],_0x5f0a1c[_0x9f18('0x34')]);_0x386d7f[_0x9f18('0x39')]=_[_0x9f18('0x37')](_0x5f0a1c[_0x9f18('0x38')],qs[_0x9f18('0x3a')](_0x152568['query'][_0x9f18('0x3a')]));_0x386d7f['attributes']=_0x386d7f[_0x9f18('0x39')][_0x9f18('0x3b')]?_0x386d7f[_0x9f18('0x39')]:_0x5f0a1c[_0x9f18('0x38')];_0x386d7f[_0x9f18('0x3e')]=qs['sort'](_0x152568[_0x9f18('0x34')]['sort']);_0x386d7f[_0x9f18('0x40')]=qs['filters'](_['pick'](_0x152568[_0x9f18('0x34')],_0x5f0a1c['filters']));if(_0x152568[_0x9f18('0x34')]['filter']){_0x386d7f[_0x9f18('0x40')]=_['merge'](_0x386d7f[_0x9f18('0x40')],{'$or':_[_0x9f18('0x33')](_0x386d7f[_0x9f18('0x39')],function(_0x1596d4){var _0x5ca9aa={};_0x5ca9aa[_0x1596d4]={'$like':'%'+_0x152568[_0x9f18('0x34')]['filter']+'%'};return _0x5ca9aa;})});}_0x386d7f=_['merge']({},_0x386d7f,_0x152568[_0x9f18('0x4d')]);return _0x380e31[_0x9f18('0x62')](_0x386d7f);}})[_0x9f18('0x2a')](function(_0x17e2b2){if(_0x17e2b2){_0x159e20=_0x17e2b2[_0x9f18('0x3b')];if(!_0x152568[_0x9f18('0x34')][_0x9f18('0x63')](_0x9f18('0x3c'))){_0x386d7f[_0x9f18('0x3d')]=qs['limit'](_0x152568[_0x9f18('0x34')][_0x9f18('0x3d')]);_0x386d7f[_0x9f18('0x24')]=qs[_0x9f18('0x24')](_0x152568[_0x9f18('0x34')]['offset']);}return _0x380e31[_0x9f18('0x62')](_0x386d7f);}})[_0x9f18('0x2a')](function(_0x286d5c){if(_0x286d5c){return _0x286d5c?{'count':_0x159e20,'rows':_0x286d5c}:null;}})[_0x9f18('0x2a')](respondWithResult(_0x2f95e7,null))[_0x9f18('0x4a')](handleError(_0x2f95e7,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index a186ec1..9a67ae0 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 _0xd930=['hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x52913a,_0x3b4c96){var _0x3869d8=function(_0x4e89bf){while(--_0x4e89bf){_0x52913a['push'](_0x52913a['shift']());}};_0x3869d8(++_0x3b4c96);}(_0xd930,0xcd));var _0x0d93=function(_0x228dec,_0x304815){_0x228dec=_0x228dec-0x0;var _0x5d9204=_0xd930[_0x228dec];return _0x5d9204;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x0d93('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x0d93('0x1')](0x0);var events={'afterCreate':_0x0d93('0x2'),'afterUpdate':'update','afterDestroy':_0x0d93('0x3')};function emitEvent(_0x2d8c22){return function(_0x138d1c,_0x5a73eb,_0x230df6){SquareProjectEvents[_0x0d93('0x4')](_0x2d8c22+':'+_0x138d1c['id'],_0x138d1c);SquareProjectEvents[_0x0d93('0x4')](_0x2d8c22,_0x138d1c);_0x230df6(null);};}for(var e in events){if(events[_0x0d93('0x5')](e)){var event=events[e];SquareProject[_0x0d93('0x6')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0xbcf0=['exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hook'];(function(_0x14b32a,_0x49d688){var _0x937045=function(_0x2b50f2){while(--_0x2b50f2){_0x14b32a['push'](_0x14b32a['shift']());}};_0x937045(++_0x49d688);}(_0xbcf0,0x155));var _0x0bcf=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xbcf0[_0x2ec461];return _0x28603d;};'use strict';var EventEmitter=require(_0x0bcf('0x0'));var SquareProject=require(_0x0bcf('0x1'))['db'][_0x0bcf('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x0bcf('0x3')](0x0);var events={'afterCreate':_0x0bcf('0x4'),'afterUpdate':_0x0bcf('0x5'),'afterDestroy':_0x0bcf('0x6')};function emitEvent(_0xbcfab9){return function(_0x574c7e,_0x34d99c,_0x1b098e){SquareProjectEvents[_0x0bcf('0x7')](_0xbcfab9+':'+_0x574c7e['id'],_0x574c7e);SquareProjectEvents[_0x0bcf('0x7')](_0xbcfab9,_0x574c7e);_0x1b098e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x0bcf('0x8')](e,emitEvent(event));}}module[_0x0bcf('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 45a6579..825e52d 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 _0xf911=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','exports','define','SquareProject','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf911,0xe2));var _0x1f91=function(_0x91abdd,_0x4e7e7d){_0x91abdd=_0x91abdd-0x0;var _0x3779ad=_0xf911[_0x91abdd];return _0x3779ad;};'use strict';var _=require(_0x1f91('0x0'));var util=require(_0x1f91('0x1'));var logger=require(_0x1f91('0x2'))(_0x1f91('0x3'));var moment=require(_0x1f91('0x4'));var BPromise=require(_0x1f91('0x5'));var rp=require(_0x1f91('0x6'));var fs=require('fs');var path=require(_0x1f91('0x7'));var rimraf=require('rimraf');var config=require(_0x1f91('0x8'));var attributes=require(_0x1f91('0x9'));module[_0x1f91('0xa')]=function(_0x3a431c,_0x5deea8){return _0x3a431c[_0x1f91('0xb')](_0x1f91('0xc'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f1e21,_0x1beec4,_0x3f6ba2){if(_0x3f1e21[_0x1f91('0xd')](_0x1f91('0xe'))){_0x3f1e21[_0x1f91('0xf')]=moment()[_0x1f91('0x10')](_0x1f91('0x11'));}if(_0x3f1e21[_0x1f91('0xd')]('production')){_0x3f1e21[_0x1f91('0x12')]=moment()[_0x1f91('0x10')](_0x1f91('0x11'));}_0x3f6ba2(null,_0x3f1e21);}}});}; \ No newline at end of file +var _0xb5e2=['api','request-promise','path','rimraf','../../config/environment','exports','define','SquareProject','square_projects','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','../../config/logger'];(function(_0x28d3e2,_0x329634){var _0x5949a3=function(_0x126000){while(--_0x126000){_0x28d3e2['push'](_0x28d3e2['shift']());}};_0x5949a3(++_0x329634);}(_0xb5e2,0x16e));var _0x2b5e=function(_0x124f75,_0x5738d0){_0x124f75=_0x124f75-0x0;var _0x3fc108=_0xb5e2[_0x124f75];return _0x3fc108;};'use strict';var _=require(_0x2b5e('0x0'));var util=require('util');var logger=require(_0x2b5e('0x1'))(_0x2b5e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2b5e('0x3'));var fs=require('fs');var path=require(_0x2b5e('0x4'));var rimraf=require(_0x2b5e('0x5'));var config=require(_0x2b5e('0x6'));var attributes=require('./squareProject.attributes');module[_0x2b5e('0x7')]=function(_0x554648,_0x574427){return _0x554648[_0x2b5e('0x8')](_0x2b5e('0x9'),attributes,{'tableName':_0x2b5e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13091a,_0x145f87,_0x1cab14){if(_0x13091a['changed']('preproduction')){_0x13091a[_0x2b5e('0xb')]=moment()[_0x2b5e('0xc')](_0x2b5e('0xd'));}if(_0x13091a['changed'](_0x2b5e('0xe'))){_0x13091a[_0x2b5e('0xf')]=moment()[_0x2b5e('0xc')](_0x2b5e('0xd'));}_0x1cab14(null,_0x13091a);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index a1dbbd8..492740a 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 _0x5388=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./squareProject.socket','register','request','then','info','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareProject,\x20%s,\x20%s','result','ShowSquareProject','options','raw','where','include','map','model','attributes','catch','lodash','util','moment'];(function(_0x30704b,_0x2d64f0){var _0x461511=function(_0x37f708){while(--_0x37f708){_0x30704b['push'](_0x30704b['shift']());}};_0x461511(++_0x2d64f0);}(_0x5388,0x100));var _0x8538=function(_0x578c59,_0x1b0872){_0x578c59=_0x578c59-0x0;var _0x32760a=_0x5388[_0x578c59];return _0x32760a;};'use strict';var _=require(_0x8538('0x0'));var util=require(_0x8538('0x1'));var moment=require(_0x8538('0x2'));var BPromise=require(_0x8538('0x3'));var rs=require(_0x8538('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8538('0x5'))['db'];var utils=require(_0x8538('0x6'));var logger=require(_0x8538('0x7'))(_0x8538('0x8'));var config=require('../../config/environment');var jayson=require(_0x8538('0x9'));var client=jayson[_0x8538('0xa')][_0x8538('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8538('0xc')],{'host':_0x8538('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8538('0xc')]));require(_0x8538('0xe'))[_0x8538('0xf')](socket);function respondWithRpcPromise(_0x5e423a,_0xbcde4c,_0x4952f2){return new BPromise(function(_0x22b691,_0x4880aa){return client[_0x8538('0x10')](_0x5e423a,_0x4952f2)[_0x8538('0x11')](function(_0x29d803){logger[_0x8538('0x12')]('SquareProject,\x20%s,\x20%s',_0xbcde4c,_0x8538('0x13'));logger[_0x8538('0x14')](_0x8538('0x15'),_0xbcde4c,'request\x20sent',JSON[_0x8538('0x16')](_0x29d803));if(_0x29d803['error']){if(_0x29d803[_0x8538('0x17')][_0x8538('0x18')]===0x1f4){logger[_0x8538('0x17')]('SquareProject,\x20%s,\x20%s',_0xbcde4c,_0x29d803[_0x8538('0x17')][_0x8538('0x19')]);return _0x4880aa(_0x29d803[_0x8538('0x17')][_0x8538('0x19')]);}logger[_0x8538('0x17')]('SquareProject,\x20%s,\x20%s',_0xbcde4c,_0x29d803['error'][_0x8538('0x19')]);return _0x22b691(_0x29d803['error'][_0x8538('0x19')]);}else{logger[_0x8538('0x12')](_0x8538('0x1a'),_0xbcde4c,_0x8538('0x13'));_0x22b691(_0x29d803[_0x8538('0x1b')][_0x8538('0x19')]);}})['catch'](function(_0x46dff2){logger[_0x8538('0x17')](_0x8538('0x1a'),_0xbcde4c,_0x46dff2);_0x4880aa(_0x46dff2);});});}exports[_0x8538('0x1c')]=function(_0x34b1aa){var _0x128d1b=this;return new Promise(function(_0x141523,_0x5cd1ef){return db['SquareProject']['find']({'raw':_0x34b1aa[_0x8538('0x1d')]?_0x34b1aa['options'][_0x8538('0x1e')]===undefined?!![]:![]:!![],'where':_0x34b1aa[_0x8538('0x1d')]?_0x34b1aa[_0x8538('0x1d')][_0x8538('0x1f')]||null:null,'attributes':_0x34b1aa[_0x8538('0x1d')]?_0x34b1aa['options']['attributes']||null:null,'include':_0x34b1aa['options']?_0x34b1aa['options'][_0x8538('0x20')]?_[_0x8538('0x21')](_0x34b1aa['options'][_0x8538('0x20')],function(_0x48de08){return{'model':db[_0x48de08['model']],'as':_0x48de08['as'],'attributes':_0x48de08['attributes'],'include':_0x48de08[_0x8538('0x20')]?_[_0x8538('0x21')](_0x48de08[_0x8538('0x20')],function(_0x495557){return{'model':db[_0x495557[_0x8538('0x22')]],'as':_0x495557['as'],'attributes':_0x495557['attributes'],'include':_0x495557['include']?_['map'](_0x495557['include'],function(_0x415cb3){return{'model':db[_0x415cb3['model']],'as':_0x415cb3['as'],'attributes':_0x415cb3[_0x8538('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8538('0x11')](function(_0x49192f){logger[_0x8538('0x12')](_0x8538('0x1c'),_0x34b1aa);logger[_0x8538('0x14')](_0x8538('0x1c'),_0x34b1aa,JSON[_0x8538('0x16')](_0x49192f));_0x141523(_0x49192f);})[_0x8538('0x24')](function(_0x29fc7d){logger[_0x8538('0x17')](_0x8538('0x1c'),_0x29fc7d[_0x8538('0x19')],_0x34b1aa);_0x5cd1ef(_0x128d1b['error'](0x1f4,_0x29fc7d[_0x8538('0x19')]));});});}; \ No newline at end of file +var _0xe083=['stringify','error','SquareProject,\x20%s,\x20%s','message','result','catch','ShowSquareProject','SquareProject','options','raw','where','map','include','attributes','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./squareProject.socket','register','then','info','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s'];(function(_0x1eccf5,_0xeabb9d){var _0x49cdc4=function(_0x221bef){while(--_0x221bef){_0x1eccf5['push'](_0x1eccf5['shift']());}};_0x49cdc4(++_0xeabb9d);}(_0xe083,0x1a6));var _0x3e08=function(_0x500801,_0x23d9c2){_0x500801=_0x500801-0x0;var _0x1fde38=_0xe083[_0x500801];return _0x1fde38;};'use strict';var _=require(_0x3e08('0x0'));var util=require(_0x3e08('0x1'));var moment=require(_0x3e08('0x2'));var BPromise=require(_0x3e08('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e08('0x4'));var db=require(_0x3e08('0x5'))['db'];var utils=require(_0x3e08('0x6'));var logger=require(_0x3e08('0x7'))(_0x3e08('0x8'));var config=require(_0x3e08('0x9'));var jayson=require(_0x3e08('0xa'));var client=jayson[_0x3e08('0xb')]['http']({'port':0x232a});config[_0x3e08('0xc')]=_[_0x3e08('0xd')](config[_0x3e08('0xc')],{'host':_0x3e08('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3e08('0xf'))[_0x3e08('0x10')](socket);function respondWithRpcPromise(_0x266e1f,_0x50a94c,_0x1025dc){return new BPromise(function(_0x6c674e,_0x1c0b20){return client['request'](_0x266e1f,_0x1025dc)[_0x3e08('0x11')](function(_0x5b8319){logger[_0x3e08('0x12')]('SquareProject,\x20%s,\x20%s',_0x50a94c,_0x3e08('0x13'));logger[_0x3e08('0x14')](_0x3e08('0x15'),_0x50a94c,_0x3e08('0x13'),JSON[_0x3e08('0x16')](_0x5b8319));if(_0x5b8319[_0x3e08('0x17')]){if(_0x5b8319['error']['code']===0x1f4){logger[_0x3e08('0x17')](_0x3e08('0x18'),_0x50a94c,_0x5b8319['error'][_0x3e08('0x19')]);return _0x1c0b20(_0x5b8319[_0x3e08('0x17')][_0x3e08('0x19')]);}logger['error'](_0x3e08('0x18'),_0x50a94c,_0x5b8319[_0x3e08('0x17')]['message']);return _0x6c674e(_0x5b8319[_0x3e08('0x17')][_0x3e08('0x19')]);}else{logger[_0x3e08('0x12')]('SquareProject,\x20%s,\x20%s',_0x50a94c,_0x3e08('0x13'));_0x6c674e(_0x5b8319[_0x3e08('0x1a')]['message']);}})[_0x3e08('0x1b')](function(_0x2f2c97){logger[_0x3e08('0x17')](_0x3e08('0x18'),_0x50a94c,_0x2f2c97);_0x1c0b20(_0x2f2c97);});});}exports[_0x3e08('0x1c')]=function(_0x1ab56a){var _0x209d88=this;return new Promise(function(_0x1fd45b,_0x577d20){return db[_0x3e08('0x1d')]['find']({'raw':_0x1ab56a[_0x3e08('0x1e')]?_0x1ab56a[_0x3e08('0x1e')][_0x3e08('0x1f')]===undefined?!![]:![]:!![],'where':_0x1ab56a[_0x3e08('0x1e')]?_0x1ab56a[_0x3e08('0x1e')][_0x3e08('0x20')]||null:null,'attributes':_0x1ab56a[_0x3e08('0x1e')]?_0x1ab56a[_0x3e08('0x1e')]['attributes']||null:null,'include':_0x1ab56a[_0x3e08('0x1e')]?_0x1ab56a[_0x3e08('0x1e')]['include']?_[_0x3e08('0x21')](_0x1ab56a[_0x3e08('0x1e')][_0x3e08('0x22')],function(_0x42deae){return{'model':db[_0x42deae['model']],'as':_0x42deae['as'],'attributes':_0x42deae[_0x3e08('0x23')],'include':_0x42deae[_0x3e08('0x22')]?_[_0x3e08('0x21')](_0x42deae[_0x3e08('0x22')],function(_0x12b812){return{'model':db[_0x12b812[_0x3e08('0x24')]],'as':_0x12b812['as'],'attributes':_0x12b812[_0x3e08('0x23')],'include':_0x12b812[_0x3e08('0x22')]?_[_0x3e08('0x21')](_0x12b812[_0x3e08('0x22')],function(_0x418657){return{'model':db[_0x418657[_0x3e08('0x24')]],'as':_0x418657['as'],'attributes':_0x418657['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e08('0x11')](function(_0x345653){logger['info'](_0x3e08('0x1c'),_0x1ab56a);logger[_0x3e08('0x14')]('ShowSquareProject',_0x1ab56a,JSON[_0x3e08('0x16')](_0x345653));_0x1fd45b(_0x345653);})[_0x3e08('0x1b')](function(_0x41b555){logger[_0x3e08('0x17')](_0x3e08('0x1c'),_0x41b555[_0x3e08('0x19')],_0x1ab56a);_0x577d20(_0x209d88[_0x3e08('0x17')](0x1f4,_0x41b555[_0x3e08('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 34f9bc0..b34d233 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 _0x14a3=['remove','update','emit','removeListener','register','squareProject:','./squareProject.events','save'];(function(_0xbf8ec1,_0x9169c8){var _0xc84567=function(_0x509094){while(--_0x509094){_0xbf8ec1['push'](_0xbf8ec1['shift']());}};_0xc84567(++_0x9169c8);}(_0x14a3,0xa6));var _0x314a=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0x14a3[_0x2c3255];return _0x282aba;};'use strict';var SquareProjectEvents=require(_0x314a('0x0'));var events=[_0x314a('0x1'),_0x314a('0x2'),_0x314a('0x3')];function createListener(_0x1aba33,_0x4ee113){return function(_0x445527){_0x4ee113[_0x314a('0x4')](_0x1aba33,_0x445527);};}function removeListener(_0x22e03a,_0x113527){return function(){SquareProjectEvents[_0x314a('0x5')](_0x22e03a,_0x113527);};}exports[_0x314a('0x6')]=function(_0x20189b){for(var _0x4a94f5=0x0,_0x17eac4=events['length'];_0x4a94f5<_0x17eac4;_0x4a94f5++){var _0x53d36c=events[_0x4a94f5];var _0x250dfd=createListener(_0x314a('0x7')+_0x53d36c,_0x20189b);SquareProjectEvents['on'](_0x53d36c,_0x250dfd);}}; \ No newline at end of file +var _0x5c9a=['squareProject:','remove','update','length'];(function(_0x57ee8c,_0xe42849){var _0x3a2322=function(_0x5ea8b2){while(--_0x5ea8b2){_0x57ee8c['push'](_0x57ee8c['shift']());}};_0x3a2322(++_0xe42849);}(_0x5c9a,0x11d));var _0xa5c9=function(_0x38c0b2,_0x6a67a5){_0x38c0b2=_0x38c0b2-0x0;var _0x283c00=_0x5c9a[_0x38c0b2];return _0x283c00;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0xa5c9('0x0'),_0xa5c9('0x1')];function createListener(_0x36fd82,_0x31d780){return function(_0x3eb924){_0x31d780['emit'](_0x36fd82,_0x3eb924);};}function removeListener(_0x5906e0,_0x4062b5){return function(){SquareProjectEvents['removeListener'](_0x5906e0,_0x4062b5);};}exports['register']=function(_0x39c4aa){for(var _0x3fc68f=0x0,_0x37ff58=events[_0xa5c9('0x2')];_0x3fc68f<_0x37ff58;_0x3fc68f++){var _0x408f69=events[_0x3fc68f];var _0x1053c5=createListener(_0xa5c9('0x3')+_0x408f69,_0x39c4aa);SquareProjectEvents['on'](_0x408f69,_0x1053c5);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 95690b0..4020189 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1aebb9,_0x154e2a){var _0x1d2d29=function(_0x441553){while(--_0x441553){_0x1aebb9['push'](_0x1aebb9['shift']());}};_0x1d2d29(++_0x154e2a);}(_0xf494,0x1c6));var _0x4f49=function(_0x92e6a,_0x4c3e17){_0x92e6a=_0x92e6a-0x0;var _0x687db8=_0xf494[_0x92e6a];return _0x687db8;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router; \ No newline at end of file +var _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x2977a1,_0x148f8f){var _0x1543eb=function(_0x3b8c15){while(--_0x3b8c15){_0x2977a1['push'](_0x2977a1['shift']());}};_0x1543eb(++_0x148f8f);}(_0x5fab,0x177));var _0xb5fa=function(_0x33f54b,_0x41df7d){_0x33f54b=_0x33f54b-0x0;var _0x191255=_0x5fab[_0x33f54b];return _0x191255;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index b02b7b7..3193577 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 _0x5fc3=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf'];(function(_0x413b4d,_0xa3459c){var _0x8b810a=function(_0x22d441){while(--_0x22d441){_0x413b4d['push'](_0x413b4d['shift']());}};_0x8b810a(++_0xa3459c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0x5fc3[_0x2053ea];return _0x2232c4;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x35fc('0x2')]},'calleridname':{'type':Sequelize[_0x35fc('0x2')]},'context':{'type':Sequelize[_0x35fc('0x2')]},'extension':{'type':Sequelize[_0x35fc('0x2')]},'priority':{'type':Sequelize[_0x35fc('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x35fc('0x2')]},'projectName':{'type':Sequelize[_0x35fc('0x2')]},'saveName':{'type':Sequelize[_0x35fc('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x35fc('0x3')],'get':function(){var _0x508b32='';var _0x16e153=this[_0x35fc('0x4')](_0x35fc('0x5'));if(_0x16e153){_0x508b32=_0x16e153[_0x35fc('0x6')](_0x16e153[_0x35fc('0x7')]('.'));}return _0x508b32;}}}; \ No newline at end of file +var _0x46ed=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf'];(function(_0x20c809,_0x26b566){var _0x1064a1=function(_0x39c6db){while(--_0x39c6db){_0x20c809['push'](_0x20c809['shift']());}};_0x1064a1(++_0x26b566);}(_0x46ed,0x168));var _0xd46e=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x46ed[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd46e('0x2')]},'calleridname':{'type':Sequelize[_0xd46e('0x2')]},'context':{'type':Sequelize[_0xd46e('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd46e('0x2')]},'accountcode':{'type':Sequelize[_0xd46e('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xd46e('0x2')]},'saveName':{'type':Sequelize[_0xd46e('0x2')]},'filename':{'type':Sequelize[_0xd46e('0x2')]},'savePath':{'type':Sequelize[_0xd46e('0x2')]},'format':{'type':Sequelize[_0xd46e('0x3')],'get':function(){var _0x855f24='';var _0x437ea0=this[_0xd46e('0x4')](_0xd46e('0x5'));if(_0x437ea0){_0x855f24=_0x437ea0[_0xd46e('0x6')](_0x437ea0[_0xd46e('0x7')]('.'));}return _0x855f24;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 69a44b4..93de1a5 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 _0x6a0d=['create','body','params','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','secrets','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','send','index','map','SquareRecording','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','name','options','include','rows','catch','show','rawAttributes','includeAll','find'];(function(_0x54d1d2,_0x4f16a0){var _0x23442b=function(_0x29434e){while(--_0x29434e){_0x54d1d2['push'](_0x54d1d2['shift']());}};_0x23442b(++_0x4f16a0);}(_0x6a0d,0xe4));var _0xd6a0=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x6a0d[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0xd6a0('0x0'));var rimraf=require(_0xd6a0('0x1'));var zipdir=require(_0xd6a0('0x2'));var jsonpatch=require(_0xd6a0('0x3'));var rp=require(_0xd6a0('0x4'));var moment=require(_0xd6a0('0x5'));var BPromise=require(_0xd6a0('0x6'));var Mustache=require(_0xd6a0('0x7'));var util=require(_0xd6a0('0x8'));var path=require(_0xd6a0('0x9'));var sox=require('sox');var csv=require(_0xd6a0('0xa'));var ejs=require(_0xd6a0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6a0('0xc'));var squel=require(_0xd6a0('0xd'));var crypto=require(_0xd6a0('0xe'));var jsforce=require(_0xd6a0('0xf'));var deskjs=require(_0xd6a0('0x10'));var toCsv=require(_0xd6a0('0xa'));var querystring=require(_0xd6a0('0x11'));var Papa=require(_0xd6a0('0x12'));var Redis=require(_0xd6a0('0x13'));var authService=require(_0xd6a0('0x14'));var qs=require(_0xd6a0('0x15'));var as=require(_0xd6a0('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd6a0('0x17'))('api');var utils=require(_0xd6a0('0x18'));var config=require(_0xd6a0('0x19'));var licenseUtil=require(_0xd6a0('0x1a'));var db=require(_0xd6a0('0x1b'))['db'];function respondWithStatusCode(_0x2d213,_0x161035){_0x161035=_0x161035||0xcc;return function(_0x358a52){if(_0x358a52){return _0x2d213['sendStatus'](_0x161035);}return _0x2d213['status'](_0x161035)[_0xd6a0('0x1c')]();};}function respondWithResult(_0x4b39f8,_0xf1b57d){_0xf1b57d=_0xf1b57d||0xc8;return function(_0x483058){if(_0x483058){return _0x4b39f8[_0xd6a0('0x1d')](_0xf1b57d)[_0xd6a0('0x1e')](_0x483058);}};}function respondWithFilteredResult(_0x544219,_0x1066a5){return function(_0xe10044){if(_0xe10044){var _0x2aedef=typeof _0x1066a5[_0xd6a0('0x1f')]===_0xd6a0('0x20')&&typeof _0x1066a5['limit']===_0xd6a0('0x20');var _0x3ac037=_0xe10044[_0xd6a0('0x21')];var _0x15c4d0=_0x2aedef?0x0:_0x1066a5[_0xd6a0('0x1f')];var _0x5cab5b=_0x2aedef?_0xe10044['count']:_0x1066a5[_0xd6a0('0x1f')]+_0x1066a5['limit'];var _0x391ec8;if(_0x5cab5b>=_0x3ac037){_0x5cab5b=_0x3ac037;_0x391ec8=0xc8;}else{_0x391ec8=0xce;}_0x544219[_0xd6a0('0x1d')](_0x391ec8);return _0x544219[_0xd6a0('0x22')](_0xd6a0('0x23'),_0x15c4d0+'-'+_0x5cab5b+'/'+_0x3ac037)[_0xd6a0('0x1e')](_0xe10044);}return null;};}function patchUpdates(_0x251bfa){return function(_0x13df60){try{jsonpatch[_0xd6a0('0x24')](_0x13df60,_0x251bfa,!![]);}catch(_0x373553){return BPromise[_0xd6a0('0x25')](_0x373553);}return _0x13df60[_0xd6a0('0x26')]();};}function saveUpdates(_0x4e063d,_0x1c4d39){return function(_0x135e41){if(_0x135e41){return _0x135e41[_0xd6a0('0x27')](_0x4e063d)[_0xd6a0('0x28')](function(_0x567b3d){return _0x567b3d;});}return null;};}function removeEntity(_0x39df4f,_0x257791){return function(_0x1665aa){if(_0x1665aa){return _0x1665aa[_0xd6a0('0x29')]()[_0xd6a0('0x28')](function(){_0x39df4f[_0xd6a0('0x1d')](0xcc)[_0xd6a0('0x1c')]();});}};}function handleEntityNotFound(_0xb5330a,_0x5c1b7e){return function(_0x382b01){if(!_0x382b01){_0xb5330a['sendStatus'](0x194);}return _0x382b01;};}function handleError(_0x127b72,_0x13fdd2){_0x13fdd2=_0x13fdd2||0x1f4;return function(_0x4f30eb){logger[_0xd6a0('0x2a')](_0x4f30eb['stack']);if(_0x4f30eb['name']){delete _0x4f30eb['name'];}_0x127b72['status'](_0x13fdd2)[_0xd6a0('0x2b')](_0x4f30eb);};}exports[_0xd6a0('0x2c')]=function(_0x3a6f4d,_0x23127e){var _0x250240={},_0x564430={},_0x3f423a={'count':0x0,'rows':[]};var _0x3afe48=_[_0xd6a0('0x2d')](db[_0xd6a0('0x2e')]['rawAttributes'],function(_0x16f8bb){return{'name':_0x16f8bb[_0xd6a0('0x2f')],'type':_0x16f8bb[_0xd6a0('0x30')][_0xd6a0('0x31')]};});_0x564430['model']=_[_0xd6a0('0x2d')](_0x3afe48,'name');_0x564430[_0xd6a0('0x32')]=_[_0xd6a0('0x33')](_0x3a6f4d[_0xd6a0('0x32')]);_0x564430[_0xd6a0('0x34')]=_[_0xd6a0('0x35')](_0x564430[_0xd6a0('0x36')],_0x564430['query']);_0x250240[_0xd6a0('0x37')]=_[_0xd6a0('0x35')](_0x564430[_0xd6a0('0x36')],qs[_0xd6a0('0x38')](_0x3a6f4d[_0xd6a0('0x32')]['fields']));_0x250240['attributes']=_0x250240[_0xd6a0('0x37')][_0xd6a0('0x39')]?_0x250240[_0xd6a0('0x37')]:_0x564430[_0xd6a0('0x36')];if(!_0x3a6f4d[_0xd6a0('0x32')][_0xd6a0('0x3a')]('nolimit')){_0x250240[_0xd6a0('0x3b')]=qs[_0xd6a0('0x3b')](_0x3a6f4d[_0xd6a0('0x32')][_0xd6a0('0x3b')]);_0x250240[_0xd6a0('0x1f')]=qs[_0xd6a0('0x1f')](_0x3a6f4d[_0xd6a0('0x32')]['offset']);}_0x250240[_0xd6a0('0x3c')]=qs[_0xd6a0('0x3d')](_0x3a6f4d['query'][_0xd6a0('0x3d')]);_0x250240[_0xd6a0('0x3e')]=qs[_0xd6a0('0x34')](_['pick'](_0x3a6f4d[_0xd6a0('0x32')],_0x564430['filters']),_0x3afe48);if(_0x3a6f4d[_0xd6a0('0x32')][_0xd6a0('0x3f')]){_0x250240[_0xd6a0('0x3e')]=_[_0xd6a0('0x40')](_0x250240[_0xd6a0('0x3e')],{'$or':_['map'](_0x3afe48,function(_0x5e1752){if(_0x5e1752[_0xd6a0('0x30')]!==_0xd6a0('0x41')){var _0x2cad69={};_0x2cad69[_0x5e1752[_0xd6a0('0x42')]]={'$like':'%'+_0x3a6f4d['query'][_0xd6a0('0x3f')]+'%'};return _0x2cad69;}})});}_0x250240=_[_0xd6a0('0x40')]({},_0x250240,_0x3a6f4d[_0xd6a0('0x43')]);var _0x144f28={'where':_0x250240['where']};return db[_0xd6a0('0x2e')][_0xd6a0('0x21')](_0x144f28)['then'](function(_0xa264c2){_0x3f423a[_0xd6a0('0x21')]=_0xa264c2;if(_0x3a6f4d['query']['includeAll']){_0x250240[_0xd6a0('0x44')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x250240);})[_0xd6a0('0x28')](function(_0x2fdf71){_0x3f423a[_0xd6a0('0x45')]=_0x2fdf71;return _0x3f423a;})['then'](respondWithFilteredResult(_0x23127e,_0x250240))[_0xd6a0('0x46')](handleError(_0x23127e,null));};exports[_0xd6a0('0x47')]=function(_0x492056,_0x33fb40){var _0x98f232={'raw':!![],'where':{'id':_0x492056['params']['id']}},_0x530930={};_0x530930['model']=_[_0xd6a0('0x33')](db[_0xd6a0('0x2e')][_0xd6a0('0x48')]);_0x530930['query']=_[_0xd6a0('0x33')](_0x492056[_0xd6a0('0x32')]);_0x530930[_0xd6a0('0x34')]=_[_0xd6a0('0x35')](_0x530930[_0xd6a0('0x36')],_0x530930[_0xd6a0('0x32')]);_0x98f232[_0xd6a0('0x37')]=_['intersection'](_0x530930['model'],qs[_0xd6a0('0x38')](_0x492056[_0xd6a0('0x32')]['fields']));_0x98f232['attributes']=_0x98f232[_0xd6a0('0x37')]['length']?_0x98f232[_0xd6a0('0x37')]:_0x530930[_0xd6a0('0x36')];if(_0x492056[_0xd6a0('0x32')][_0xd6a0('0x49')]){_0x98f232['include']=[{'all':!![]}];}_0x98f232=_['merge']({},_0x98f232,_0x492056['options']);return db[_0xd6a0('0x2e')][_0xd6a0('0x4a')](_0x98f232)[_0xd6a0('0x28')](handleEntityNotFound(_0x33fb40,null))[_0xd6a0('0x28')](respondWithResult(_0x33fb40,null))[_0xd6a0('0x46')](handleError(_0x33fb40,null));};exports['create']=function(_0x1a7e16,_0x5e157b){return db[_0xd6a0('0x2e')][_0xd6a0('0x4b')](_0x1a7e16[_0xd6a0('0x4c')],{})[_0xd6a0('0x28')](respondWithResult(_0x5e157b,0xc9))[_0xd6a0('0x46')](handleError(_0x5e157b,null));};exports[_0xd6a0('0x27')]=function(_0x198237,_0x395eda){if(_0x198237['body']['id']){delete _0x198237['body']['id'];}return db[_0xd6a0('0x2e')][_0xd6a0('0x4a')]({'where':{'id':_0x198237[_0xd6a0('0x4d')]['id']}})[_0xd6a0('0x28')](handleEntityNotFound(_0x395eda,null))['then'](saveUpdates(_0x198237[_0xd6a0('0x4c')],null))[_0xd6a0('0x28')](respondWithResult(_0x395eda,null))['catch'](handleError(_0x395eda,null));};exports[_0xd6a0('0x4e')]=function(_0x563811,_0x22b909,_0x128c93){var _0x1de47d=require(_0xd6a0('0x4f'));var _0x2bf8b5=![];var _0x238f35={};if(_0x563811[_0xd6a0('0x32')][_0xd6a0('0x30')]&&_0x563811[_0xd6a0('0x32')][_0xd6a0('0x30')]===_0xd6a0('0x50')){_0x238f35[_0xd6a0('0x50')]=_0x563811[_0xd6a0('0x4d')]['id'];}else{_0x238f35['id']=_0x563811['params']['id'];}return db[_0xd6a0('0x2e')][_0xd6a0('0x4a')]({'where':_0x238f35,'attributes':['id',_0xd6a0('0x51'),_0xd6a0('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x22b909,null))[_0xd6a0('0x28')](function(_0x50dce1){if(_0x50dce1){var _0x5c8872=_0x50dce1['savePath'];var _0x48215c=util[_0xd6a0('0x53')](_0xd6a0('0x54'),_0x5c8872);if(fs['existsSync'](_0x48215c)){_0x2bf8b5=!![];return _0x1de47d['decryptFile'](_0x48215c,_0x5c8872,config[_0xd6a0('0x55')]['recording'])[_0xd6a0('0x28')](function(){return _0x50dce1;});}return _0x50dce1;}})[_0xd6a0('0x28')](function(_0x1aae47){if(_0x1aae47){var _0x4581ac=_0x1aae47[_0xd6a0('0x51')];if(!fs[_0xd6a0('0x56')](_0x4581ac)){throw new db[(_0xd6a0('0x57'))][(_0xd6a0('0x58'))](_0xd6a0('0x59'));}if(_0x1aae47['filename']){return _0x22b909[_0xd6a0('0x4e')](_0x4581ac,_0x1aae47[_0xd6a0('0x52')]+path[_0xd6a0('0x5a')](_0x4581ac),function(){if(_0x2bf8b5){fs[_0xd6a0('0x5b')](_0x4581ac);}});}else{return _0x22b909[_0xd6a0('0x4e')](_0x4581ac,function(_0x5b3b71){if(_0x2bf8b5){fs['unlink'](_0x4581ac);}});}}})['catch'](function(_0x3c59c6){if(_0x3c59c6[_0xd6a0('0x5c')]==='SquareRecording\x20not\x20found'){_0x22b909[_0xd6a0('0x1d')](0x194)[_0xd6a0('0x2b')](_0xd6a0('0x5d'));}else{return handleError(_0x22b909,null);}});};exports[_0xd6a0('0x29')]=function(_0x4c7025,_0x1d9bbb){return db[_0xd6a0('0x2e')]['find']({'where':{'id':_0x4c7025[_0xd6a0('0x4d')]['id']}})[_0xd6a0('0x28')](function(_0x1db84b){if(_[_0xd6a0('0x5e')](_0x1db84b)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1db84b;})[_0xd6a0('0x28')](function(_0x4a7c31){var _0x1c250d=_0x4a7c31[_0xd6a0('0x51')];logger['info'](_0xd6a0('0x5f'),_0x1c250d);if(!_['isNil'](_0x4a7c31[_0xd6a0('0x51')])&&fs[_0xd6a0('0x56')](_0x1c250d)){logger[_0xd6a0('0x60')](_0xd6a0('0x61')+_0x1c250d+_0xd6a0('0x62'));fs[_0xd6a0('0x63')](_0x1c250d);}_0x1c250d=_0x1c250d+_0xd6a0('0x64');if(!_[_0xd6a0('0x5e')](_0x4a7c31[_0xd6a0('0x51')])&&fs['existsSync'](_0x1c250d)){logger[_0xd6a0('0x60')]('File:\x20\x22'+_0x1c250d+_0xd6a0('0x62'));fs[_0xd6a0('0x63')](_0x1c250d);}return _0x4a7c31;})[_0xd6a0('0x28')](function(_0x472637){if(!_0x472637)throw new InternalError();return _0x472637[_0xd6a0('0x29')]();})[_0xd6a0('0x28')](function(){_0x1d9bbb[_0xd6a0('0x1d')](0xcc)[_0xd6a0('0x1c')]();})[_0xd6a0('0x46')](handleError(_0x1d9bbb,null));}; \ No newline at end of file +var _0xe0d0=['to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','end','stack','name','send','index','map','SquareRecording','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','params','find','catch','create','body','uniqueid','filename','savePath','format','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xe0d0,0x14f));var _0x0e0d=function(_0x1e7265,_0x43cdc5){_0x1e7265=_0x1e7265-0x0;var _0x381c27=_0xe0d0[_0x1e7265];return _0x381c27;};'use strict';var emlformat=require(_0x0e0d('0x0'));var rimraf=require(_0x0e0d('0x1'));var zipdir=require(_0x0e0d('0x2'));var jsonpatch=require(_0x0e0d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0e0d('0x4'));var Mustache=require('mustache');var util=require(_0x0e0d('0x5'));var path=require(_0x0e0d('0x6'));var sox=require(_0x0e0d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0e0d('0x8'));var _=require('lodash');var squel=require(_0x0e0d('0x9'));var crypto=require(_0x0e0d('0xa'));var jsforce=require(_0x0e0d('0xb'));var deskjs=require(_0x0e0d('0xc'));var toCsv=require(_0x0e0d('0xd'));var querystring=require('querystring');var Papa=require(_0x0e0d('0xe'));var Redis=require('ioredis');var authService=require(_0x0e0d('0xf'));var qs=require(_0x0e0d('0x10'));var as=require(_0x0e0d('0x11'));var hardwareService=require(_0x0e0d('0x12'));var logger=require('../../config/logger')(_0x0e0d('0x13'));var utils=require(_0x0e0d('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d468b,_0xa7e228){_0xa7e228=_0xa7e228||0xcc;return function(_0x37d99c){if(_0x37d99c){return _0x3d468b[_0x0e0d('0x15')](_0xa7e228);}return _0x3d468b[_0x0e0d('0x16')](_0xa7e228)['end']();};}function respondWithResult(_0x4a6a28,_0x31ada5){_0x31ada5=_0x31ada5||0xc8;return function(_0x2f883b){if(_0x2f883b){return _0x4a6a28[_0x0e0d('0x16')](_0x31ada5)[_0x0e0d('0x17')](_0x2f883b);}};}function respondWithFilteredResult(_0x193e9d,_0x19f784){return function(_0x5cdfed){if(_0x5cdfed){var _0xaa6b22=typeof _0x19f784[_0x0e0d('0x18')]===_0x0e0d('0x19')&&typeof _0x19f784[_0x0e0d('0x1a')]===_0x0e0d('0x19');var _0x1ce187=_0x5cdfed[_0x0e0d('0x1b')];var _0x39b2a8=_0xaa6b22?0x0:_0x19f784['offset'];var _0x493c4e=_0xaa6b22?_0x5cdfed['count']:_0x19f784[_0x0e0d('0x18')]+_0x19f784['limit'];var _0x45924b;if(_0x493c4e>=_0x1ce187){_0x493c4e=_0x1ce187;_0x45924b=0xc8;}else{_0x45924b=0xce;}_0x193e9d[_0x0e0d('0x16')](_0x45924b);return _0x193e9d['set']('Content-Range',_0x39b2a8+'-'+_0x493c4e+'/'+_0x1ce187)['json'](_0x5cdfed);}return null;};}function patchUpdates(_0x42b386){return function(_0x4902c9){try{jsonpatch[_0x0e0d('0x1c')](_0x4902c9,_0x42b386,!![]);}catch(_0x49bf8a){return BPromise['reject'](_0x49bf8a);}return _0x4902c9[_0x0e0d('0x1d')]();};}function saveUpdates(_0x6557fe,_0x3c43d9){return function(_0x42b6f2){if(_0x42b6f2){return _0x42b6f2[_0x0e0d('0x1e')](_0x6557fe)[_0x0e0d('0x1f')](function(_0x2cfae4){return _0x2cfae4;});}return null;};}function removeEntity(_0x590064,_0x58f369){return function(_0x4db63f){if(_0x4db63f){return _0x4db63f[_0x0e0d('0x20')]()['then'](function(){_0x590064[_0x0e0d('0x16')](0xcc)[_0x0e0d('0x21')]();});}};}function handleEntityNotFound(_0x4839f2,_0x441b0e){return function(_0x790f4f){if(!_0x790f4f){_0x4839f2[_0x0e0d('0x15')](0x194);}return _0x790f4f;};}function handleError(_0x4b9831,_0x42b29d){_0x42b29d=_0x42b29d||0x1f4;return function(_0x595535){logger['error'](_0x595535[_0x0e0d('0x22')]);if(_0x595535[_0x0e0d('0x23')]){delete _0x595535[_0x0e0d('0x23')];}_0x4b9831[_0x0e0d('0x16')](_0x42b29d)[_0x0e0d('0x24')](_0x595535);};}exports[_0x0e0d('0x25')]=function(_0x82d2c1,_0x5be799){var _0x28e706={},_0x362e91={},_0x13dc94={'count':0x0,'rows':[]};var _0x65da0a=_[_0x0e0d('0x26')](db[_0x0e0d('0x27')]['rawAttributes'],function(_0x1302cf){return{'name':_0x1302cf[_0x0e0d('0x28')],'type':_0x1302cf[_0x0e0d('0x29')][_0x0e0d('0x2a')]};});_0x362e91[_0x0e0d('0x2b')]=_[_0x0e0d('0x26')](_0x65da0a,_0x0e0d('0x23'));_0x362e91['query']=_[_0x0e0d('0x2c')](_0x82d2c1['query']);_0x362e91['filters']=_[_0x0e0d('0x2d')](_0x362e91['model'],_0x362e91[_0x0e0d('0x2e')]);_0x28e706['attributes']=_[_0x0e0d('0x2d')](_0x362e91[_0x0e0d('0x2b')],qs['fields'](_0x82d2c1[_0x0e0d('0x2e')][_0x0e0d('0x2f')]));_0x28e706['attributes']=_0x28e706[_0x0e0d('0x30')][_0x0e0d('0x31')]?_0x28e706[_0x0e0d('0x30')]:_0x362e91[_0x0e0d('0x2b')];if(!_0x82d2c1[_0x0e0d('0x2e')][_0x0e0d('0x32')](_0x0e0d('0x33'))){_0x28e706[_0x0e0d('0x1a')]=qs['limit'](_0x82d2c1[_0x0e0d('0x2e')][_0x0e0d('0x1a')]);_0x28e706[_0x0e0d('0x18')]=qs[_0x0e0d('0x18')](_0x82d2c1[_0x0e0d('0x2e')][_0x0e0d('0x18')]);}_0x28e706['order']=qs[_0x0e0d('0x34')](_0x82d2c1[_0x0e0d('0x2e')][_0x0e0d('0x34')]);_0x28e706[_0x0e0d('0x35')]=qs[_0x0e0d('0x36')](_[_0x0e0d('0x37')](_0x82d2c1['query'],_0x362e91['filters']),_0x65da0a);if(_0x82d2c1[_0x0e0d('0x2e')][_0x0e0d('0x38')]){_0x28e706[_0x0e0d('0x35')]=_[_0x0e0d('0x39')](_0x28e706[_0x0e0d('0x35')],{'$or':_[_0x0e0d('0x26')](_0x65da0a,function(_0x4e3ee1){if(_0x4e3ee1[_0x0e0d('0x29')]!==_0x0e0d('0x3a')){var _0x8c6bae={};_0x8c6bae[_0x4e3ee1['name']]={'$like':'%'+_0x82d2c1[_0x0e0d('0x2e')][_0x0e0d('0x38')]+'%'};return _0x8c6bae;}})});}_0x28e706=_['merge']({},_0x28e706,_0x82d2c1[_0x0e0d('0x3b')]);var _0x3d1125={'where':_0x28e706[_0x0e0d('0x35')]};return db[_0x0e0d('0x27')][_0x0e0d('0x1b')](_0x3d1125)[_0x0e0d('0x1f')](function(_0x44a471){_0x13dc94['count']=_0x44a471;if(_0x82d2c1[_0x0e0d('0x2e')][_0x0e0d('0x3c')]){_0x28e706[_0x0e0d('0x3d')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x28e706);})[_0x0e0d('0x1f')](function(_0x29acbe){_0x13dc94['rows']=_0x29acbe;return _0x13dc94;})['then'](respondWithFilteredResult(_0x5be799,_0x28e706))['catch'](handleError(_0x5be799,null));};exports['show']=function(_0x300d91,_0x4b4369){var _0xa06454={'raw':!![],'where':{'id':_0x300d91[_0x0e0d('0x3e')]['id']}},_0x2b3f4e={};_0x2b3f4e[_0x0e0d('0x2b')]=_['keys'](db[_0x0e0d('0x27')]['rawAttributes']);_0x2b3f4e[_0x0e0d('0x2e')]=_['keys'](_0x300d91[_0x0e0d('0x2e')]);_0x2b3f4e[_0x0e0d('0x36')]=_[_0x0e0d('0x2d')](_0x2b3f4e[_0x0e0d('0x2b')],_0x2b3f4e['query']);_0xa06454[_0x0e0d('0x30')]=_['intersection'](_0x2b3f4e[_0x0e0d('0x2b')],qs[_0x0e0d('0x2f')](_0x300d91[_0x0e0d('0x2e')][_0x0e0d('0x2f')]));_0xa06454[_0x0e0d('0x30')]=_0xa06454['attributes'][_0x0e0d('0x31')]?_0xa06454[_0x0e0d('0x30')]:_0x2b3f4e['model'];if(_0x300d91[_0x0e0d('0x2e')][_0x0e0d('0x3c')]){_0xa06454[_0x0e0d('0x3d')]=[{'all':!![]}];}_0xa06454=_[_0x0e0d('0x39')]({},_0xa06454,_0x300d91[_0x0e0d('0x3b')]);return db['SquareRecording'][_0x0e0d('0x3f')](_0xa06454)[_0x0e0d('0x1f')](handleEntityNotFound(_0x4b4369,null))[_0x0e0d('0x1f')](respondWithResult(_0x4b4369,null))[_0x0e0d('0x40')](handleError(_0x4b4369,null));};exports[_0x0e0d('0x41')]=function(_0x1fc79e,_0x49ab11){return db[_0x0e0d('0x27')]['create'](_0x1fc79e[_0x0e0d('0x42')],{})[_0x0e0d('0x1f')](respondWithResult(_0x49ab11,0xc9))[_0x0e0d('0x40')](handleError(_0x49ab11,null));};exports['update']=function(_0x223f88,_0x40262e){if(_0x223f88[_0x0e0d('0x42')]['id']){delete _0x223f88[_0x0e0d('0x42')]['id'];}return db['SquareRecording'][_0x0e0d('0x3f')]({'where':{'id':_0x223f88[_0x0e0d('0x3e')]['id']}})[_0x0e0d('0x1f')](handleEntityNotFound(_0x40262e,null))[_0x0e0d('0x1f')](saveUpdates(_0x223f88[_0x0e0d('0x42')],null))[_0x0e0d('0x1f')](respondWithResult(_0x40262e,null))[_0x0e0d('0x40')](handleError(_0x40262e,null));};exports['download']=function(_0x1dd3cc,_0x4ef88f,_0x4a0c94){var _0x25e2b4=require('../../components/encryptor');var _0x24c9bd=![];var _0x1b32bb={};if(_0x1dd3cc[_0x0e0d('0x2e')]['type']&&_0x1dd3cc[_0x0e0d('0x2e')][_0x0e0d('0x29')]===_0x0e0d('0x43')){_0x1b32bb['uniqueid']=_0x1dd3cc['params']['id'];}else{_0x1b32bb['id']=_0x1dd3cc[_0x0e0d('0x3e')]['id'];}return db[_0x0e0d('0x27')][_0x0e0d('0x3f')]({'where':_0x1b32bb,'attributes':['id','savePath',_0x0e0d('0x44')],'raw':!![]})[_0x0e0d('0x1f')](handleEntityNotFound(_0x4ef88f,null))['then'](function(_0x3b8894){if(_0x3b8894){var _0x33b26c=_0x3b8894[_0x0e0d('0x45')];var _0x52fb26=util[_0x0e0d('0x46')](_0x0e0d('0x47'),_0x33b26c);if(fs[_0x0e0d('0x48')](_0x52fb26)){_0x24c9bd=!![];return _0x25e2b4['decryptFile'](_0x52fb26,_0x33b26c,config[_0x0e0d('0x49')][_0x0e0d('0x4a')])['then'](function(){return _0x3b8894;});}return _0x3b8894;}})[_0x0e0d('0x1f')](function(_0x3ff06c){if(_0x3ff06c){var _0x5ea927=_0x3ff06c[_0x0e0d('0x45')];if(!fs[_0x0e0d('0x48')](_0x5ea927)){throw new db[(_0x0e0d('0x4b'))][(_0x0e0d('0x4c'))](_0x0e0d('0x4d'));}if(_0x3ff06c[_0x0e0d('0x44')]){return _0x4ef88f[_0x0e0d('0x4e')](_0x5ea927,_0x3ff06c[_0x0e0d('0x44')]+path['extname'](_0x5ea927),function(){if(_0x24c9bd){fs[_0x0e0d('0x4f')](_0x5ea927);}});}else{return _0x4ef88f[_0x0e0d('0x4e')](_0x5ea927,function(_0x6ae14c){if(_0x24c9bd){fs[_0x0e0d('0x4f')](_0x5ea927);}});}}})[_0x0e0d('0x40')](function(_0x490a41){if(_0x490a41['message']===_0x0e0d('0x4d')){_0x4ef88f[_0x0e0d('0x16')](0x194)[_0x0e0d('0x24')](_0x0e0d('0x50'));}else{return handleError(_0x4ef88f,null);}});};exports[_0x0e0d('0x20')]=function(_0x4aa0e0,_0x2cf3b8){return db[_0x0e0d('0x27')][_0x0e0d('0x3f')]({'where':{'id':_0x4aa0e0[_0x0e0d('0x3e')]['id']}})[_0x0e0d('0x1f')](function(_0x352ca4){if(_[_0x0e0d('0x51')](_0x352ca4)){throw new ReferenceError(_0x0e0d('0x52'));}return _0x352ca4;})[_0x0e0d('0x1f')](function(_0x12991d){var _0xdedf66=_0x12991d[_0x0e0d('0x45')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0xdedf66);if(!_[_0x0e0d('0x51')](_0x12991d[_0x0e0d('0x45')])&&fs[_0x0e0d('0x48')](_0xdedf66)){logger[_0x0e0d('0x53')](_0x0e0d('0x54')+_0xdedf66+_0x0e0d('0x55'));fs[_0x0e0d('0x56')](_0xdedf66);}_0xdedf66=_0xdedf66+'.cypher';if(!_[_0x0e0d('0x51')](_0x12991d[_0x0e0d('0x45')])&&fs['existsSync'](_0xdedf66)){logger[_0x0e0d('0x53')](_0x0e0d('0x54')+_0xdedf66+_0x0e0d('0x55'));fs['unlinkSync'](_0xdedf66);}return _0x12991d;})['then'](function(_0x3c36a2){if(!_0x3c36a2)throw new InternalError();return _0x3c36a2[_0x0e0d('0x20')]();})['then'](function(){_0x2cf3b8['status'](0xcc)[_0x0e0d('0x21')]();})[_0x0e0d('0x40')](handleError(_0x2cf3b8,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 7ca97d5..b2340e6 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 _0x4815=['bluebird','request-promise','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment'];(function(_0x58edac,_0x2ffb50){var _0x124777=function(_0x1fad2c){while(--_0x1fad2c){_0x58edac['push'](_0x58edac['shift']());}};_0x124777(++_0x2ffb50);}(_0x4815,0xff));var _0x5481=function(_0x103e95,_0x2a9e10){_0x103e95=_0x103e95-0x0;var _0x56a99e=_0x4815[_0x103e95];return _0x56a99e;};'use strict';var _=require(_0x5481('0x0'));var util=require(_0x5481('0x1'));var logger=require(_0x5481('0x2'))(_0x5481('0x3'));var moment=require(_0x5481('0x4'));var BPromise=require(_0x5481('0x5'));var rp=require(_0x5481('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5481('0x7'));var attributes=require(_0x5481('0x8'));module[_0x5481('0x9')]=function(_0x3de2c3,_0xa91d26){return _0x3de2c3[_0x5481('0xa')](_0x5481('0xb'),attributes,{'tableName':_0x5481('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb296=['request-promise','rimraf','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3abe25,_0x1e75de){var _0x4b7f15=function(_0x4a1cc0){while(--_0x4a1cc0){_0x3abe25['push'](_0x3abe25['shift']());}};_0x4b7f15(++_0x1e75de);}(_0xb296,0xa3));var _0x6b29=function(_0x248c54,_0x4cadd2){_0x248c54=_0x248c54-0x0;var _0xba8b4d=_0xb296[_0x248c54];return _0xba8b4d;};'use strict';var _=require(_0x6b29('0x0'));var util=require(_0x6b29('0x1'));var logger=require(_0x6b29('0x2'))(_0x6b29('0x3'));var moment=require(_0x6b29('0x4'));var BPromise=require(_0x6b29('0x5'));var rp=require(_0x6b29('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b29('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b29('0x8'));module[_0x6b29('0x9')]=function(_0x5e0aa1,_0x327329){return _0x5e0aa1[_0x6b29('0xa')](_0x6b29('0xb'),attributes,{'tableName':_0x6b29('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 2ecffef..740a812 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 _0xeb98=['SquareRecording','create','body','options','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xeb98,0x19a));var _0x8eb9=function(_0x49201a,_0x11df17){_0x49201a=_0x49201a-0x0;var _0x3976b9=_0xeb98[_0x49201a];return _0x3976b9;};'use strict';var _=require(_0x8eb9('0x0'));var util=require(_0x8eb9('0x1'));var moment=require('moment');var BPromise=require(_0x8eb9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8eb9('0x3'));var db=require(_0x8eb9('0x4'))['db'];var utils=require(_0x8eb9('0x5'));var logger=require(_0x8eb9('0x6'))('rpc');var config=require(_0x8eb9('0x7'));var jayson=require(_0x8eb9('0x8'));var client=jayson[_0x8eb9('0x9')][_0x8eb9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17cbb1,_0x29c2d7,_0x3705ad){return new BPromise(function(_0x117dbd,_0x3f4422){return client['request'](_0x17cbb1,_0x3705ad)['then'](function(_0x21a87c){logger[_0x8eb9('0xb')](_0x8eb9('0xc'),_0x29c2d7,_0x8eb9('0xd'));logger[_0x8eb9('0xe')](_0x8eb9('0xf'),_0x29c2d7,_0x8eb9('0xd'),JSON[_0x8eb9('0x10')](_0x21a87c));if(_0x21a87c[_0x8eb9('0x11')]){if(_0x21a87c[_0x8eb9('0x11')][_0x8eb9('0x12')]===0x1f4){logger[_0x8eb9('0x11')]('SquareRecording,\x20%s,\x20%s',_0x29c2d7,_0x21a87c['error'][_0x8eb9('0x13')]);return _0x3f4422(_0x21a87c[_0x8eb9('0x11')]['message']);}logger['error'](_0x8eb9('0xc'),_0x29c2d7,_0x21a87c[_0x8eb9('0x11')][_0x8eb9('0x13')]);return _0x117dbd(_0x21a87c[_0x8eb9('0x11')]['message']);}else{logger['info'](_0x8eb9('0xc'),_0x29c2d7,_0x8eb9('0xd'));_0x117dbd(_0x21a87c[_0x8eb9('0x14')][_0x8eb9('0x13')]);}})[_0x8eb9('0x15')](function(_0x4d9910){logger[_0x8eb9('0x11')](_0x8eb9('0xc'),_0x29c2d7,_0x4d9910);_0x3f4422(_0x4d9910);});});}exports['CreateSquareRecording']=function(_0x2b94b9){var _0x2ba49f=this;return new Promise(function(_0x5ea84c,_0x1e0d89){return db[_0x8eb9('0x16')][_0x8eb9('0x17')](_0x2b94b9[_0x8eb9('0x18')],{'raw':_0x2b94b9[_0x8eb9('0x19')]?_0x2b94b9[_0x8eb9('0x19')][_0x8eb9('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x32272d){logger[_0x8eb9('0xb')]('CreateSquareRecording',_0x2b94b9);logger['debug']('CreateSquareRecording',_0x2b94b9,JSON[_0x8eb9('0x10')](_0x32272d));_0x5ea84c(_0x32272d);})[_0x8eb9('0x15')](function(_0xbf17eb){logger[_0x8eb9('0x11')]('CreateSquareRecording',_0xbf17eb[_0x8eb9('0x13')],_0x2b94b9);_0x1e0d89(_0x2ba49f['error'](0x1f4,_0xbf17eb[_0x8eb9('0x13')]));});});}; \ No newline at end of file +var _0x1f02=['randomstring','ioredis','rpc','../../config/environment','client','info','request\x20sent','debug','error','code','SquareRecording,\x20%s,\x20%s','message','result','SquareRecording','create','body','options','raw','then','CreateSquareRecording','stringify','catch','lodash','util','bluebird'];(function(_0x5a754e,_0x4b70d8){var _0x573a34=function(_0x597f54){while(--_0x597f54){_0x5a754e['push'](_0x5a754e['shift']());}};_0x573a34(++_0x4b70d8);}(_0x1f02,0xac));var _0x21f0=function(_0x7765ee,_0x176880){_0x7765ee=_0x7765ee-0x0;var _0x147d70=_0x1f02[_0x7765ee];return _0x147d70;};'use strict';var _=require(_0x21f0('0x0'));var util=require(_0x21f0('0x1'));var moment=require('moment');var BPromise=require(_0x21f0('0x2'));var rs=require(_0x21f0('0x3'));var fs=require('fs');var Redis=require(_0x21f0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x21f0('0x5'));var config=require(_0x21f0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x21f0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f6696,_0x4f4ffb,_0xa732ee){return new BPromise(function(_0x553b1e,_0x409f37){return client['request'](_0x2f6696,_0xa732ee)['then'](function(_0x500a62){logger[_0x21f0('0x8')]('SquareRecording,\x20%s,\x20%s',_0x4f4ffb,_0x21f0('0x9'));logger[_0x21f0('0xa')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x4f4ffb,_0x21f0('0x9'),JSON['stringify'](_0x500a62));if(_0x500a62[_0x21f0('0xb')]){if(_0x500a62[_0x21f0('0xb')][_0x21f0('0xc')]===0x1f4){logger['error'](_0x21f0('0xd'),_0x4f4ffb,_0x500a62[_0x21f0('0xb')][_0x21f0('0xe')]);return _0x409f37(_0x500a62[_0x21f0('0xb')]['message']);}logger[_0x21f0('0xb')](_0x21f0('0xd'),_0x4f4ffb,_0x500a62[_0x21f0('0xb')]['message']);return _0x553b1e(_0x500a62['error'][_0x21f0('0xe')]);}else{logger[_0x21f0('0x8')](_0x21f0('0xd'),_0x4f4ffb,'request\x20sent');_0x553b1e(_0x500a62[_0x21f0('0xf')]['message']);}})['catch'](function(_0xd798d7){logger[_0x21f0('0xb')](_0x21f0('0xd'),_0x4f4ffb,_0xd798d7);_0x409f37(_0xd798d7);});});}exports['CreateSquareRecording']=function(_0x1680cf){var _0xe0168c=this;return new Promise(function(_0x266d97,_0x3b6f0e){return db[_0x21f0('0x10')][_0x21f0('0x11')](_0x1680cf[_0x21f0('0x12')],{'raw':_0x1680cf[_0x21f0('0x13')]?_0x1680cf['options'][_0x21f0('0x14')]===undefined?!![]:![]:!![]})[_0x21f0('0x15')](function(_0x355f6f){logger['info']('CreateSquareRecording',_0x1680cf);logger['debug'](_0x21f0('0x16'),_0x1680cf,JSON[_0x21f0('0x17')](_0x355f6f));_0x266d97(_0x355f6f);})[_0x21f0('0x18')](function(_0x4e0a79){logger['error'](_0x21f0('0x16'),_0x4e0a79['message'],_0x1680cf);_0x3b6f0e(_0xe0168c[_0x21f0('0xb')](0x1f4,_0x4e0a79[_0x21f0('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 5da2fe7..4f4413a 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 _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x33ea3f,_0xe0eaf9){var _0x314aa7=function(_0x124d99){while(--_0x124d99){_0x33ea3f['push'](_0x33ea3f['shift']());}};_0x314aa7(++_0xe0eaf9);}(_0xe706,0xa3));var _0x6e70=function(_0x367bad,_0x1eea19){_0x367bad=_0x367bad-0x0;var _0x3a99d3=_0xe706[_0x367bad];return _0x3a99d3;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +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(_0x2be343,_0x2bc3b0){var _0x5eb417=function(_0x101bfd){while(--_0x101bfd){_0x2be343['push'](_0x2be343['shift']());}};_0x5eb417(++_0x2bc3b0);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'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 f672ce7..2600ec5 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 _0xa8de=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x5e9ab8,_0x3e14e0){var _0x1fd0c1=function(_0x1fc339){while(--_0x1fc339){_0x5e9ab8['push'](_0x5e9ab8['shift']());}};_0x1fd0c1(++_0x3e14e0);}(_0xa8de,0x175));var _0xea8d=function(_0x448e53,_0x402e06){_0x448e53=_0x448e53-0x0;var _0x3d1fef=_0xa8de[_0x448e53];return _0x3d1fef;};'use strict';var Sequelize=require(_0xea8d('0x0'));module[_0xea8d('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xea8d('0x2')]},'request':{'type':Sequelize[_0xea8d('0x2')]},'channel':{'type':Sequelize[_0xea8d('0x2')]},'language':{'type':Sequelize[_0xea8d('0x2')]},'type':{'type':Sequelize[_0xea8d('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xea8d('0x2')]},'callerid':{'type':Sequelize[_0xea8d('0x2')]},'calleridname':{'type':Sequelize[_0xea8d('0x2')]},'callingpres':{'type':Sequelize[_0xea8d('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xea8d('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xea8d('0x2')]},'rdnis':{'type':Sequelize[_0xea8d('0x2')]},'context':{'type':Sequelize[_0xea8d('0x2')]},'extension':{'type':Sequelize[_0xea8d('0x2')]},'priority':{'type':Sequelize[_0xea8d('0x2')]},'enhanced':{'type':Sequelize[_0xea8d('0x2')]},'accountcode':{'type':Sequelize[_0xea8d('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xea8d('0x2')]},'joinAt':{'type':Sequelize[_0xea8d('0x3')]},'leaveAt':{'type':Sequelize[_0xea8d('0x3')]},'bot':{'type':Sequelize[_0xea8d('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xe0bf=['sequelize','exports','STRING','DATE'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe0bf,0x168));var _0xfe0b=function(_0x3668f7,_0x5edb00){_0x3668f7=_0x3668f7-0x0;var _0x3bc242=_0xe0bf[_0x3668f7];return _0x3bc242;};'use strict';var Sequelize=require(_0xfe0b('0x0'));module[_0xfe0b('0x1')]={'network':{'type':Sequelize[_0xfe0b('0x2')]},'network_script':{'type':Sequelize[_0xfe0b('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xfe0b('0x2')]},'uniqueid':{'type':Sequelize[_0xfe0b('0x2')]},'version':{'type':Sequelize[_0xfe0b('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfe0b('0x2')]},'callingpres':{'type':Sequelize[_0xfe0b('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xfe0b('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xfe0b('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xfe0b('0x2')]},'extension':{'type':Sequelize[_0xfe0b('0x2')]},'priority':{'type':Sequelize[_0xfe0b('0x2')]},'enhanced':{'type':Sequelize[_0xfe0b('0x2')]},'accountcode':{'type':Sequelize[_0xfe0b('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xfe0b('0x2')]},'joinAt':{'type':Sequelize[_0xfe0b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 14d0e28..f124437 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 _0x5595=['reject','update','then','destroy','end','error','stack','name','send','map','fieldName','type','model','query','keys','filters','attributes','intersection','fields','order','sort','where','filter','merge','options','SquareReport','include','findAll','catch','show','params','rawAttributes','length','includeAll','find','create','body','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x5595,0x17a));var _0x5559=function(_0x199227,_0x3dd233){_0x199227=_0x199227-0x0;var _0x497ca1=_0x5595[_0x199227];return _0x497ca1;};'use strict';var emlformat=require(_0x5559('0x0'));var rimraf=require(_0x5559('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5559('0x2'));var BPromise=require(_0x5559('0x3'));var Mustache=require(_0x5559('0x4'));var util=require(_0x5559('0x5'));var path=require(_0x5559('0x6'));var sox=require(_0x5559('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5559('0x8'));var _=require(_0x5559('0x9'));var squel=require('squel');var crypto=require(_0x5559('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5559('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5559('0xc'));var Papa=require(_0x5559('0xd'));var Redis=require(_0x5559('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5559('0xf'));var hardwareService=require(_0x5559('0x10'));var logger=require(_0x5559('0x11'))(_0x5559('0x12'));var utils=require(_0x5559('0x13'));var config=require(_0x5559('0x14'));var licenseUtil=require(_0x5559('0x15'));var db=require(_0x5559('0x16'))['db'];function respondWithStatusCode(_0x3809fc,_0x22d950){_0x22d950=_0x22d950||0xcc;return function(_0x1f32ba){if(_0x1f32ba){return _0x3809fc[_0x5559('0x17')](_0x22d950);}return _0x3809fc[_0x5559('0x18')](_0x22d950)['end']();};}function respondWithResult(_0x441829,_0x14aa88){_0x14aa88=_0x14aa88||0xc8;return function(_0x519b88){if(_0x519b88){return _0x441829[_0x5559('0x18')](_0x14aa88)['json'](_0x519b88);}};}function respondWithFilteredResult(_0x40687f,_0x7684fd){return function(_0xd611a9){if(_0xd611a9){var _0x2e614b=typeof _0x7684fd[_0x5559('0x19')]==='undefined'&&typeof _0x7684fd[_0x5559('0x1a')]==='undefined';var _0x54871e=_0xd611a9[_0x5559('0x1b')];var _0x1f58d5=_0x2e614b?0x0:_0x7684fd[_0x5559('0x19')];var _0x2719e7=_0x2e614b?_0xd611a9['count']:_0x7684fd[_0x5559('0x19')]+_0x7684fd[_0x5559('0x1a')];var _0x49e26b;if(_0x2719e7>=_0x54871e){_0x2719e7=_0x54871e;_0x49e26b=0xc8;}else{_0x49e26b=0xce;}_0x40687f[_0x5559('0x18')](_0x49e26b);return _0x40687f[_0x5559('0x1c')](_0x5559('0x1d'),_0x1f58d5+'-'+_0x2719e7+'/'+_0x54871e)['json'](_0xd611a9);}return null;};}function patchUpdates(_0x41033a){return function(_0x3beaeb){try{jsonpatch['apply'](_0x3beaeb,_0x41033a,!![]);}catch(_0x8253){return BPromise[_0x5559('0x1e')](_0x8253);}return _0x3beaeb['save']();};}function saveUpdates(_0x208502,_0x5f268e){return function(_0x46d453){if(_0x46d453){return _0x46d453[_0x5559('0x1f')](_0x208502)[_0x5559('0x20')](function(_0x52a99d){return _0x52a99d;});}return null;};}function removeEntity(_0x70b3e7,_0x43ee30){return function(_0x4cdd49){if(_0x4cdd49){return _0x4cdd49[_0x5559('0x21')]()[_0x5559('0x20')](function(){_0x70b3e7[_0x5559('0x18')](0xcc)[_0x5559('0x22')]();});}};}function handleEntityNotFound(_0x906257,_0x498a6b){return function(_0x9b5ecc){if(!_0x9b5ecc){_0x906257['sendStatus'](0x194);}return _0x9b5ecc;};}function handleError(_0x49e98b,_0x11bcdd){_0x11bcdd=_0x11bcdd||0x1f4;return function(_0x484596){logger[_0x5559('0x23')](_0x484596[_0x5559('0x24')]);if(_0x484596[_0x5559('0x25')]){delete _0x484596[_0x5559('0x25')];}_0x49e98b[_0x5559('0x18')](_0x11bcdd)[_0x5559('0x26')](_0x484596);};}exports['index']=function(_0x57c3d0,_0x41d011){var _0x4bcf13={},_0x52c39c={},_0x2c4895={'count':0x0,'rows':[]};var _0x4af2bf=_[_0x5559('0x27')](db['SquareReport']['rawAttributes'],function(_0x449bde){return{'name':_0x449bde[_0x5559('0x28')],'type':_0x449bde[_0x5559('0x29')]['key']};});_0x52c39c[_0x5559('0x2a')]=_['map'](_0x4af2bf,_0x5559('0x25'));_0x52c39c[_0x5559('0x2b')]=_[_0x5559('0x2c')](_0x57c3d0[_0x5559('0x2b')]);_0x52c39c[_0x5559('0x2d')]=_['intersection'](_0x52c39c[_0x5559('0x2a')],_0x52c39c[_0x5559('0x2b')]);_0x4bcf13[_0x5559('0x2e')]=_[_0x5559('0x2f')](_0x52c39c[_0x5559('0x2a')],qs[_0x5559('0x30')](_0x57c3d0['query'][_0x5559('0x30')]));_0x4bcf13[_0x5559('0x2e')]=_0x4bcf13[_0x5559('0x2e')]['length']?_0x4bcf13[_0x5559('0x2e')]:_0x52c39c[_0x5559('0x2a')];if(!_0x57c3d0[_0x5559('0x2b')]['hasOwnProperty']('nolimit')){_0x4bcf13[_0x5559('0x1a')]=qs[_0x5559('0x1a')](_0x57c3d0[_0x5559('0x2b')][_0x5559('0x1a')]);_0x4bcf13[_0x5559('0x19')]=qs[_0x5559('0x19')](_0x57c3d0['query'][_0x5559('0x19')]);}_0x4bcf13[_0x5559('0x31')]=qs[_0x5559('0x32')](_0x57c3d0['query'][_0x5559('0x32')]);_0x4bcf13[_0x5559('0x33')]=qs[_0x5559('0x2d')](_['pick'](_0x57c3d0[_0x5559('0x2b')],_0x52c39c[_0x5559('0x2d')]),_0x4af2bf);if(_0x57c3d0[_0x5559('0x2b')][_0x5559('0x34')]){_0x4bcf13[_0x5559('0x33')]=_[_0x5559('0x35')](_0x4bcf13[_0x5559('0x33')],{'$or':_['map'](_0x4af2bf,function(_0x2f9ccf){if(_0x2f9ccf['type']!=='VIRTUAL'){var _0x2fc894={};_0x2fc894[_0x2f9ccf[_0x5559('0x25')]]={'$like':'%'+_0x57c3d0[_0x5559('0x2b')][_0x5559('0x34')]+'%'};return _0x2fc894;}})});}_0x4bcf13=_[_0x5559('0x35')]({},_0x4bcf13,_0x57c3d0[_0x5559('0x36')]);var _0x488286={'where':_0x4bcf13[_0x5559('0x33')]};return db[_0x5559('0x37')][_0x5559('0x1b')](_0x488286)[_0x5559('0x20')](function(_0x54a57a){_0x2c4895['count']=_0x54a57a;if(_0x57c3d0['query']['includeAll']){_0x4bcf13[_0x5559('0x38')]=[{'all':!![]}];}return db[_0x5559('0x37')][_0x5559('0x39')](_0x4bcf13);})['then'](function(_0x10e14e){_0x2c4895['rows']=_0x10e14e;return _0x2c4895;})[_0x5559('0x20')](respondWithFilteredResult(_0x41d011,_0x4bcf13))[_0x5559('0x3a')](handleError(_0x41d011,null));};exports[_0x5559('0x3b')]=function(_0x36a546,_0xe84cb){var _0x54f2c9={'raw':!![],'where':{'id':_0x36a546[_0x5559('0x3c')]['id']}},_0x147222={};_0x147222['model']=_[_0x5559('0x2c')](db[_0x5559('0x37')][_0x5559('0x3d')]);_0x147222[_0x5559('0x2b')]=_[_0x5559('0x2c')](_0x36a546[_0x5559('0x2b')]);_0x147222[_0x5559('0x2d')]=_['intersection'](_0x147222[_0x5559('0x2a')],_0x147222[_0x5559('0x2b')]);_0x54f2c9[_0x5559('0x2e')]=_[_0x5559('0x2f')](_0x147222['model'],qs[_0x5559('0x30')](_0x36a546[_0x5559('0x2b')][_0x5559('0x30')]));_0x54f2c9[_0x5559('0x2e')]=_0x54f2c9[_0x5559('0x2e')][_0x5559('0x3e')]?_0x54f2c9['attributes']:_0x147222['model'];if(_0x36a546[_0x5559('0x2b')][_0x5559('0x3f')]){_0x54f2c9['include']=[{'all':!![]}];}_0x54f2c9=_[_0x5559('0x35')]({},_0x54f2c9,_0x36a546[_0x5559('0x36')]);return db[_0x5559('0x37')][_0x5559('0x40')](_0x54f2c9)['then'](handleEntityNotFound(_0xe84cb,null))[_0x5559('0x20')](respondWithResult(_0xe84cb,null))[_0x5559('0x3a')](handleError(_0xe84cb,null));};exports[_0x5559('0x41')]=function(_0x50ed8d,_0x15584e){return db[_0x5559('0x37')][_0x5559('0x41')](_0x50ed8d['body'],{})['then'](respondWithResult(_0x15584e,0xc9))[_0x5559('0x3a')](handleError(_0x15584e,null));};exports[_0x5559('0x1f')]=function(_0x206152,_0x21c57d){if(_0x206152['body']['id']){delete _0x206152[_0x5559('0x42')]['id'];}return db['SquareReport'][_0x5559('0x40')]({'where':{'id':_0x206152[_0x5559('0x3c')]['id']}})[_0x5559('0x20')](handleEntityNotFound(_0x21c57d,null))[_0x5559('0x20')](saveUpdates(_0x206152[_0x5559('0x42')],null))[_0x5559('0x20')](respondWithResult(_0x21c57d,null))[_0x5559('0x3a')](handleError(_0x21c57d,null));};exports['destroy']=function(_0x4dab38,_0x1bbe31){return db[_0x5559('0x37')][_0x5559('0x40')]({'where':{'id':_0x4dab38[_0x5559('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1bbe31,null))['then'](removeEntity(_0x1bbe31,null))[_0x5559('0x3a')](handleError(_0x1bbe31,null));};exports[_0x5559('0x43')]=function(_0x2afee2,_0x1f6cf6){return db[_0x5559('0x37')][_0x5559('0x43')]()['then'](respondWithResult(_0x1f6cf6,null))[_0x5559('0x3a')](handleError(_0x1f6cf6,null));}; \ No newline at end of file +var _0xa23e=['then','end','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareReport','includeAll','findAll','rows','show','params','length','include','find','create','body','catch','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','json','apply','update'];(function(_0x173861,_0x55cd7c){var _0x1339dd=function(_0x26ccae){while(--_0x26ccae){_0x173861['push'](_0x173861['shift']());}};_0x1339dd(++_0x55cd7c);}(_0xa23e,0x1ec));var _0xea23=function(_0x216d11,_0x380cf0){_0x216d11=_0x216d11-0x0;var _0x13d6cf=_0xa23e[_0x216d11];return _0x13d6cf;};'use strict';var emlformat=require(_0xea23('0x0'));var rimraf=require(_0xea23('0x1'));var zipdir=require(_0xea23('0x2'));var jsonpatch=require(_0xea23('0x3'));var rp=require(_0xea23('0x4'));var moment=require(_0xea23('0x5'));var BPromise=require(_0xea23('0x6'));var Mustache=require(_0xea23('0x7'));var util=require(_0xea23('0x8'));var path=require(_0xea23('0x9'));var sox=require(_0xea23('0xa'));var csv=require('to-csv');var ejs=require(_0xea23('0xb'));var fs=require('fs');var fs_extra=require(_0xea23('0xc'));var _=require(_0xea23('0xd'));var squel=require(_0xea23('0xe'));var crypto=require(_0xea23('0xf'));var jsforce=require(_0xea23('0x10'));var deskjs=require(_0xea23('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xea23('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xea23('0x13'));var logger=require(_0xea23('0x14'))('api');var utils=require(_0xea23('0x15'));var config=require(_0xea23('0x16'));var licenseUtil=require(_0xea23('0x17'));var db=require(_0xea23('0x18'))['db'];function respondWithStatusCode(_0x5706ce,_0x5a07f4){_0x5a07f4=_0x5a07f4||0xcc;return function(_0xd390e4){if(_0xd390e4){return _0x5706ce['sendStatus'](_0x5a07f4);}return _0x5706ce[_0xea23('0x19')](_0x5a07f4)['end']();};}function respondWithResult(_0x17fee9,_0x5482c1){_0x5482c1=_0x5482c1||0xc8;return function(_0x2fe029){if(_0x2fe029){return _0x17fee9[_0xea23('0x19')](_0x5482c1)['json'](_0x2fe029);}};}function respondWithFilteredResult(_0x54bb8d,_0x31764b){return function(_0x2188e5){if(_0x2188e5){var _0x4d58a4=typeof _0x31764b[_0xea23('0x1a')]==='undefined'&&typeof _0x31764b['limit']===_0xea23('0x1b');var _0x3baa62=_0x2188e5[_0xea23('0x1c')];var _0x193748=_0x4d58a4?0x0:_0x31764b[_0xea23('0x1a')];var _0x44d694=_0x4d58a4?_0x2188e5[_0xea23('0x1c')]:_0x31764b[_0xea23('0x1a')]+_0x31764b[_0xea23('0x1d')];var _0x45592e;if(_0x44d694>=_0x3baa62){_0x44d694=_0x3baa62;_0x45592e=0xc8;}else{_0x45592e=0xce;}_0x54bb8d[_0xea23('0x19')](_0x45592e);return _0x54bb8d['set']('Content-Range',_0x193748+'-'+_0x44d694+'/'+_0x3baa62)[_0xea23('0x1e')](_0x2188e5);}return null;};}function patchUpdates(_0x1179ae){return function(_0x39dbd9){try{jsonpatch[_0xea23('0x1f')](_0x39dbd9,_0x1179ae,!![]);}catch(_0x2505ae){return BPromise['reject'](_0x2505ae);}return _0x39dbd9['save']();};}function saveUpdates(_0x1b6f94,_0x44b426){return function(_0x4b5dd7){if(_0x4b5dd7){return _0x4b5dd7[_0xea23('0x20')](_0x1b6f94)[_0xea23('0x21')](function(_0x9068d7){return _0x9068d7;});}return null;};}function removeEntity(_0x136b56,_0x5ec29d){return function(_0x1d2edd){if(_0x1d2edd){return _0x1d2edd['destroy']()[_0xea23('0x21')](function(){_0x136b56[_0xea23('0x19')](0xcc)[_0xea23('0x22')]();});}};}function handleEntityNotFound(_0x57b951,_0xf53d24){return function(_0x251cd1){if(!_0x251cd1){_0x57b951[_0xea23('0x23')](0x194);}return _0x251cd1;};}function handleError(_0x3647c0,_0x392ed4){_0x392ed4=_0x392ed4||0x1f4;return function(_0x2784fd){logger[_0xea23('0x24')](_0x2784fd[_0xea23('0x25')]);if(_0x2784fd[_0xea23('0x26')]){delete _0x2784fd[_0xea23('0x26')];}_0x3647c0[_0xea23('0x19')](_0x392ed4)['send'](_0x2784fd);};}exports[_0xea23('0x27')]=function(_0x7a20ce,_0x1ad834){var _0x3b0f93={},_0x406fc8={},_0x7d023e={'count':0x0,'rows':[]};var _0x47ea7c=_[_0xea23('0x28')](db['SquareReport'][_0xea23('0x29')],function(_0x321a8f){return{'name':_0x321a8f[_0xea23('0x2a')],'type':_0x321a8f[_0xea23('0x2b')]['key']};});_0x406fc8[_0xea23('0x2c')]=_['map'](_0x47ea7c,_0xea23('0x26'));_0x406fc8[_0xea23('0x2d')]=_[_0xea23('0x2e')](_0x7a20ce[_0xea23('0x2d')]);_0x406fc8[_0xea23('0x2f')]=_[_0xea23('0x30')](_0x406fc8[_0xea23('0x2c')],_0x406fc8['query']);_0x3b0f93[_0xea23('0x31')]=_[_0xea23('0x30')](_0x406fc8[_0xea23('0x2c')],qs['fields'](_0x7a20ce[_0xea23('0x2d')][_0xea23('0x32')]));_0x3b0f93[_0xea23('0x31')]=_0x3b0f93[_0xea23('0x31')]['length']?_0x3b0f93[_0xea23('0x31')]:_0x406fc8['model'];if(!_0x7a20ce[_0xea23('0x2d')][_0xea23('0x33')](_0xea23('0x34'))){_0x3b0f93['limit']=qs[_0xea23('0x1d')](_0x7a20ce[_0xea23('0x2d')]['limit']);_0x3b0f93[_0xea23('0x1a')]=qs[_0xea23('0x1a')](_0x7a20ce[_0xea23('0x2d')][_0xea23('0x1a')]);}_0x3b0f93[_0xea23('0x35')]=qs[_0xea23('0x36')](_0x7a20ce[_0xea23('0x2d')][_0xea23('0x36')]);_0x3b0f93[_0xea23('0x37')]=qs[_0xea23('0x2f')](_[_0xea23('0x38')](_0x7a20ce['query'],_0x406fc8['filters']),_0x47ea7c);if(_0x7a20ce[_0xea23('0x2d')][_0xea23('0x39')]){_0x3b0f93[_0xea23('0x37')]=_[_0xea23('0x3a')](_0x3b0f93[_0xea23('0x37')],{'$or':_['map'](_0x47ea7c,function(_0x3f8567){if(_0x3f8567[_0xea23('0x2b')]!==_0xea23('0x3b')){var _0x3d7dc8={};_0x3d7dc8[_0x3f8567[_0xea23('0x26')]]={'$like':'%'+_0x7a20ce[_0xea23('0x2d')][_0xea23('0x39')]+'%'};return _0x3d7dc8;}})});}_0x3b0f93=_[_0xea23('0x3a')]({},_0x3b0f93,_0x7a20ce[_0xea23('0x3c')]);var _0xe07a7e={'where':_0x3b0f93[_0xea23('0x37')]};return db[_0xea23('0x3d')]['count'](_0xe07a7e)['then'](function(_0x4c5fb9){_0x7d023e[_0xea23('0x1c')]=_0x4c5fb9;if(_0x7a20ce[_0xea23('0x2d')][_0xea23('0x3e')]){_0x3b0f93['include']=[{'all':!![]}];}return db[_0xea23('0x3d')][_0xea23('0x3f')](_0x3b0f93);})[_0xea23('0x21')](function(_0x50a3d2){_0x7d023e[_0xea23('0x40')]=_0x50a3d2;return _0x7d023e;})[_0xea23('0x21')](respondWithFilteredResult(_0x1ad834,_0x3b0f93))['catch'](handleError(_0x1ad834,null));};exports[_0xea23('0x41')]=function(_0x5c2771,_0x33ccf3){var _0x28df33={'raw':!![],'where':{'id':_0x5c2771[_0xea23('0x42')]['id']}},_0x323307={};_0x323307[_0xea23('0x2c')]=_[_0xea23('0x2e')](db[_0xea23('0x3d')][_0xea23('0x29')]);_0x323307[_0xea23('0x2d')]=_['keys'](_0x5c2771[_0xea23('0x2d')]);_0x323307[_0xea23('0x2f')]=_[_0xea23('0x30')](_0x323307[_0xea23('0x2c')],_0x323307[_0xea23('0x2d')]);_0x28df33[_0xea23('0x31')]=_[_0xea23('0x30')](_0x323307['model'],qs['fields'](_0x5c2771[_0xea23('0x2d')][_0xea23('0x32')]));_0x28df33[_0xea23('0x31')]=_0x28df33[_0xea23('0x31')][_0xea23('0x43')]?_0x28df33[_0xea23('0x31')]:_0x323307['model'];if(_0x5c2771[_0xea23('0x2d')]['includeAll']){_0x28df33[_0xea23('0x44')]=[{'all':!![]}];}_0x28df33=_['merge']({},_0x28df33,_0x5c2771[_0xea23('0x3c')]);return db[_0xea23('0x3d')][_0xea23('0x45')](_0x28df33)['then'](handleEntityNotFound(_0x33ccf3,null))[_0xea23('0x21')](respondWithResult(_0x33ccf3,null))['catch'](handleError(_0x33ccf3,null));};exports[_0xea23('0x46')]=function(_0x1defd8,_0x566760){return db[_0xea23('0x3d')][_0xea23('0x46')](_0x1defd8[_0xea23('0x47')],{})[_0xea23('0x21')](respondWithResult(_0x566760,0xc9))[_0xea23('0x48')](handleError(_0x566760,null));};exports[_0xea23('0x20')]=function(_0x464c12,_0x35e7d1){if(_0x464c12[_0xea23('0x47')]['id']){delete _0x464c12[_0xea23('0x47')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x464c12[_0xea23('0x42')]['id']}})[_0xea23('0x21')](handleEntityNotFound(_0x35e7d1,null))[_0xea23('0x21')](saveUpdates(_0x464c12[_0xea23('0x47')],null))[_0xea23('0x21')](respondWithResult(_0x35e7d1,null))[_0xea23('0x48')](handleError(_0x35e7d1,null));};exports[_0xea23('0x49')]=function(_0x466ac3,_0x1e0b7b){return db[_0xea23('0x3d')][_0xea23('0x45')]({'where':{'id':_0x466ac3[_0xea23('0x42')]['id']}})[_0xea23('0x21')](handleEntityNotFound(_0x1e0b7b,null))[_0xea23('0x21')](removeEntity(_0x1e0b7b,null))[_0xea23('0x48')](handleError(_0x1e0b7b,null));};exports['describe']=function(_0x4e5f68,_0x505308){return db[_0xea23('0x3d')][_0xea23('0x4a')]()[_0xea23('0x21')](respondWithResult(_0x505308,null))['catch'](handleError(_0x505308,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 311b699..6b6845d 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 _0x0624=['request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2dad72,_0x5ca04c){var _0x28ffc2=function(_0x2a5c17){while(--_0x2a5c17){_0x2dad72['push'](_0x2dad72['shift']());}};_0x28ffc2(++_0x5ca04c);}(_0x0624,0x1cf));var _0x4062=function(_0x4b68bf,_0x21695e){_0x4b68bf=_0x4b68bf-0x0;var _0x443b4e=_0x0624[_0x4b68bf];return _0x443b4e;};'use strict';var _=require(_0x4062('0x0'));var util=require('util');var logger=require(_0x4062('0x1'))(_0x4062('0x2'));var moment=require(_0x4062('0x3'));var BPromise=require(_0x4062('0x4'));var rp=require(_0x4062('0x5'));var fs=require('fs');var path=require(_0x4062('0x6'));var rimraf=require(_0x4062('0x7'));var config=require(_0x4062('0x8'));var attributes=require(_0x4062('0x9'));module[_0x4062('0xa')]=function(_0x3a7c00,_0x306e3b){return _0x3a7c00[_0x4062('0xb')](_0x4062('0xc'),attributes,{'tableName':_0x4062('0xd'),'paranoid':![],'indexes':[{'name':_0x4062('0xe'),'fields':[_0x4062('0xf'),_0x4062('0x10')]},{'name':_0x4062('0x11'),'fields':[_0x4062('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa7a=['../../config/logger','api','moment','bluebird','path','../../config/environment','./squareReport.attributes','report_square','uid_pname','project_name','leaveAt','lodash'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0xfa7a,0x9b));var _0xafa7=function(_0x3f57fa,_0x57b27b){_0x3f57fa=_0x3f57fa-0x0;var _0x517f25=_0xfa7a[_0x3f57fa];return _0x517f25;};'use strict';var _=require(_0xafa7('0x0'));var util=require('util');var logger=require(_0xafa7('0x1'))(_0xafa7('0x2'));var moment=require(_0xafa7('0x3'));var BPromise=require(_0xafa7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xafa7('0x5'));var rimraf=require('rimraf');var config=require(_0xafa7('0x6'));var attributes=require(_0xafa7('0x7'));module['exports']=function(_0x1550a2,_0x1d7980){return _0x1550a2['define']('SquareReport',attributes,{'tableName':_0xafa7('0x8'),'paranoid':![],'indexes':[{'name':_0xafa7('0x9'),'fields':['uniqueid',_0xafa7('0xa')]},{'name':'leaveAt','fields':[_0xafa7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index eb88dde..aad86ba 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 _0xf9c9=['error','code','message','result','catch','CreateSquareReport','SquareReport','options','raw','info','stringify','update','body','where','limit','UpdateSquareReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf9c9,0x165));var _0x9f9c=function(_0x15dafa,_0x3bd9b2){_0x15dafa=_0x15dafa-0x0;var _0x390812=_0xf9c9[_0x15dafa];return _0x390812;};'use strict';var _=require(_0x9f9c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9f9c('0x1'));var rs=require(_0x9f9c('0x2'));var fs=require('fs');var Redis=require(_0x9f9c('0x3'));var db=require(_0x9f9c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f9c('0x5'))('rpc');var config=require(_0x9f9c('0x6'));var jayson=require(_0x9f9c('0x7'));var client=jayson[_0x9f9c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2948b6,_0xfe27f2,_0x103950){return new BPromise(function(_0x473fa2,_0x14e81c){return client[_0x9f9c('0x9')](_0x2948b6,_0x103950)[_0x9f9c('0xa')](function(_0x3025f7){logger['info'](_0x9f9c('0xb'),_0xfe27f2,_0x9f9c('0xc'));logger[_0x9f9c('0xd')](_0x9f9c('0xe'),_0xfe27f2,_0x9f9c('0xc'),JSON['stringify'](_0x3025f7));if(_0x3025f7[_0x9f9c('0xf')]){if(_0x3025f7[_0x9f9c('0xf')][_0x9f9c('0x10')]===0x1f4){logger[_0x9f9c('0xf')](_0x9f9c('0xb'),_0xfe27f2,_0x3025f7['error'][_0x9f9c('0x11')]);return _0x14e81c(_0x3025f7[_0x9f9c('0xf')]['message']);}logger['error'](_0x9f9c('0xb'),_0xfe27f2,_0x3025f7[_0x9f9c('0xf')][_0x9f9c('0x11')]);return _0x473fa2(_0x3025f7['error'][_0x9f9c('0x11')]);}else{logger['info'](_0x9f9c('0xb'),_0xfe27f2,_0x9f9c('0xc'));_0x473fa2(_0x3025f7[_0x9f9c('0x12')]['message']);}})[_0x9f9c('0x13')](function(_0x55c9d0){logger['error'](_0x9f9c('0xb'),_0xfe27f2,_0x55c9d0);_0x14e81c(_0x55c9d0);});});}exports[_0x9f9c('0x14')]=function(_0x5dec19){var _0xcd710e=this;return new Promise(function(_0xe2f57e,_0x2d073e){return db[_0x9f9c('0x15')]['create'](_0x5dec19['body'],{'raw':_0x5dec19[_0x9f9c('0x16')]?_0x5dec19['options'][_0x9f9c('0x17')]===undefined?!![]:![]:!![]})[_0x9f9c('0xa')](function(_0xf50723){logger[_0x9f9c('0x18')]('CreateSquareReport',_0x5dec19);logger[_0x9f9c('0xd')](_0x9f9c('0x14'),_0x5dec19,JSON[_0x9f9c('0x19')](_0xf50723));_0xe2f57e(_0xf50723);})['catch'](function(_0x7a2286){logger[_0x9f9c('0xf')](_0x9f9c('0x14'),_0x7a2286['message'],_0x5dec19);_0x2d073e(_0xcd710e['error'](0x1f4,_0x7a2286[_0x9f9c('0x11')]));});});};exports['UpdateSquareReport']=function(_0x523ad2){var _0x1bbe11=this;return new Promise(function(_0xedb2aa,_0x41a660){return db[_0x9f9c('0x15')][_0x9f9c('0x1a')](_0x523ad2[_0x9f9c('0x1b')],{'raw':_0x523ad2[_0x9f9c('0x16')]?_0x523ad2['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x523ad2[_0x9f9c('0x16')]?_0x523ad2['options'][_0x9f9c('0x1c')]||null:null,'attributes':_0x523ad2[_0x9f9c('0x16')]?_0x523ad2['options']['attributes']||null:null,'limit':_0x523ad2[_0x9f9c('0x16')]?_0x523ad2[_0x9f9c('0x16')][_0x9f9c('0x1d')]||null:null})[_0x9f9c('0xa')](function(_0x5cb1d8){logger['info'](_0x9f9c('0x1e'),_0x523ad2);logger[_0x9f9c('0xd')](_0x9f9c('0x1e'),_0x523ad2,JSON['stringify'](_0x5cb1d8));_0xedb2aa(_0x5cb1d8);})['catch'](function(_0x25db68){logger[_0x9f9c('0xf')](_0x9f9c('0x1e'),_0x25db68[_0x9f9c('0x11')],_0x523ad2);_0x41a660(_0x1bbe11['error'](0x1f4,_0x25db68[_0x9f9c('0x11')]));});});}; \ No newline at end of file +var _0x9e5c=['info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','where','attributes','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x4c9730,_0x412b10){var _0x16a1ef=function(_0x3deef2){while(--_0x3deef2){_0x4c9730['push'](_0x4c9730['shift']());}};_0x16a1ef(++_0x412b10);}(_0x9e5c,0x17f));var _0xc9e5=function(_0x57d4ef,_0x54dcd4){_0x57d4ef=_0x57d4ef-0x0;var _0x452faa=_0x9e5c[_0x57d4ef];return _0x452faa;};'use strict';var _=require(_0xc9e5('0x0'));var util=require('util');var moment=require(_0xc9e5('0x1'));var BPromise=require(_0xc9e5('0x2'));var rs=require(_0xc9e5('0x3'));var fs=require('fs');var Redis=require(_0xc9e5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9e5('0x5'));var logger=require(_0xc9e5('0x6'))(_0xc9e5('0x7'));var config=require(_0xc9e5('0x8'));var jayson=require(_0xc9e5('0x9'));var client=jayson['client'][_0xc9e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5176a0,_0x38d3b1,_0x5c7237){return new BPromise(function(_0x33b08f,_0xca837f){return client[_0xc9e5('0xb')](_0x5176a0,_0x5c7237)[_0xc9e5('0xc')](function(_0x538455){logger[_0xc9e5('0xd')](_0xc9e5('0xe'),_0x38d3b1,_0xc9e5('0xf'));logger[_0xc9e5('0x10')](_0xc9e5('0x11'),_0x38d3b1,_0xc9e5('0xf'),JSON[_0xc9e5('0x12')](_0x538455));if(_0x538455[_0xc9e5('0x13')]){if(_0x538455[_0xc9e5('0x13')]['code']===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x38d3b1,_0x538455['error'][_0xc9e5('0x14')]);return _0xca837f(_0x538455['error'][_0xc9e5('0x14')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x38d3b1,_0x538455[_0xc9e5('0x13')][_0xc9e5('0x14')]);return _0x33b08f(_0x538455[_0xc9e5('0x13')][_0xc9e5('0x14')]);}else{logger[_0xc9e5('0xd')](_0xc9e5('0xe'),_0x38d3b1,_0xc9e5('0xf'));_0x33b08f(_0x538455[_0xc9e5('0x15')]['message']);}})['catch'](function(_0x1c2750){logger[_0xc9e5('0x13')](_0xc9e5('0xe'),_0x38d3b1,_0x1c2750);_0xca837f(_0x1c2750);});});}exports[_0xc9e5('0x16')]=function(_0x16865c){var _0x1001fd=this;return new Promise(function(_0x180e55,_0x45010c){return db[_0xc9e5('0x17')][_0xc9e5('0x18')](_0x16865c[_0xc9e5('0x19')],{'raw':_0x16865c[_0xc9e5('0x1a')]?_0x16865c[_0xc9e5('0x1a')][_0xc9e5('0x1b')]===undefined?!![]:![]:!![]})[_0xc9e5('0xc')](function(_0x38a5e3){logger[_0xc9e5('0xd')](_0xc9e5('0x16'),_0x16865c);logger['debug']('CreateSquareReport',_0x16865c,JSON[_0xc9e5('0x12')](_0x38a5e3));_0x180e55(_0x38a5e3);})['catch'](function(_0xa20c57){logger[_0xc9e5('0x13')](_0xc9e5('0x16'),_0xa20c57['message'],_0x16865c);_0x45010c(_0x1001fd[_0xc9e5('0x13')](0x1f4,_0xa20c57[_0xc9e5('0x14')]));});});};exports[_0xc9e5('0x1c')]=function(_0x5d33a6){var _0x20a393=this;return new Promise(function(_0x54e99a,_0x30457f){return db[_0xc9e5('0x17')][_0xc9e5('0x1d')](_0x5d33a6[_0xc9e5('0x19')],{'raw':_0x5d33a6['options']?_0x5d33a6[_0xc9e5('0x1a')][_0xc9e5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d33a6[_0xc9e5('0x1a')]?_0x5d33a6[_0xc9e5('0x1a')][_0xc9e5('0x1e')]||null:null,'attributes':_0x5d33a6[_0xc9e5('0x1a')]?_0x5d33a6[_0xc9e5('0x1a')][_0xc9e5('0x1f')]||null:null,'limit':_0x5d33a6[_0xc9e5('0x1a')]?_0x5d33a6[_0xc9e5('0x1a')]['limit']||null:null})[_0xc9e5('0xc')](function(_0x51ddb2){logger['info'](_0xc9e5('0x1c'),_0x5d33a6);logger['debug'](_0xc9e5('0x1c'),_0x5d33a6,JSON[_0xc9e5('0x12')](_0x51ddb2));_0x54e99a(_0x51ddb2);})[_0xc9e5('0x20')](function(_0x1118ae){logger[_0xc9e5('0x13')](_0xc9e5('0x1c'),_0x1118ae['message'],_0x5d33a6);_0x30457f(_0x20a393['error'](0x1f4,_0x1118ae['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 333bc20..cdf6ef3 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 _0xb83c=['connect-timeout','Router','../../components/auth/service','./squareReportDetail.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer','util','path'];(function(_0x235ed4,_0x25f6db){var _0x4b8048=function(_0x3e4d9d){while(--_0x3e4d9d){_0x235ed4['push'](_0x235ed4['shift']());}};_0x4b8048(++_0x25f6db);}(_0xb83c,0x8d));var _0xcb83=function(_0x34b608,_0x27d6a9){_0x34b608=_0x34b608-0x0;var _0x2dd3dc=_0xb83c[_0x34b608];return _0x2dd3dc;};'use strict';var multer=require(_0xcb83('0x0'));var util=require(_0xcb83('0x1'));var path=require(_0xcb83('0x2'));var timeout=require(_0xcb83('0x3'));var express=require('express');var router=express[_0xcb83('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcb83('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcb83('0x6'));router[_0xcb83('0x7')]('/',auth[_0xcb83('0x8')](),controller[_0xcb83('0x9')]);router[_0xcb83('0x7')]('/describe',auth[_0xcb83('0x8')](),controller['describe']);router[_0xcb83('0x7')]('/:id',auth[_0xcb83('0x8')](),controller[_0xcb83('0xa')]);router[_0xcb83('0xb')]('/',auth[_0xcb83('0x8')](),controller[_0xcb83('0xc')]);router[_0xcb83('0xd')](_0xcb83('0xe'),auth[_0xcb83('0x8')](),controller[_0xcb83('0xf')]);router[_0xcb83('0x10')](_0xcb83('0xe'),auth[_0xcb83('0x8')](),controller[_0xcb83('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1552=['get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller'];(function(_0xc465f5,_0xa9c358){var _0x3dd839=function(_0x45aa86){while(--_0x45aa86){_0xc465f5['push'](_0xc465f5['shift']());}};_0x3dd839(++_0xa9c358);}(_0x1552,0x90));var _0x2155=function(_0x2eb3db,_0x4a32c0){_0x2eb3db=_0x2eb3db-0x0;var _0x358f33=_0x1552[_0x2eb3db];return _0x358f33;};'use strict';var multer=require(_0x2155('0x0'));var util=require(_0x2155('0x1'));var path=require('path');var timeout=require(_0x2155('0x2'));var express=require(_0x2155('0x3'));var router=express[_0x2155('0x4')]();var fs_extra=require(_0x2155('0x5'));var auth=require(_0x2155('0x6'));var interaction=require(_0x2155('0x7'));var config=require(_0x2155('0x8'));var controller=require(_0x2155('0x9'));router[_0x2155('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2155('0xa')](_0x2155('0xb'),auth[_0x2155('0xc')](),controller[_0x2155('0xd')]);router[_0x2155('0xa')](_0x2155('0xe'),auth[_0x2155('0xc')](),controller[_0x2155('0xf')]);router[_0x2155('0x10')]('/',auth['isAuthenticated'](),controller[_0x2155('0x11')]);router[_0x2155('0x12')](_0x2155('0xe'),auth[_0x2155('0xc')](),controller[_0x2155('0x13')]);router[_0x2155('0x14')](_0x2155('0xe'),auth[_0x2155('0xc')](),controller['destroy']);module[_0x2155('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 48a8f98..bfd26d6 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 _0x118d=['sequelize','exports','STRING','TEXT'];(function(_0x8ffc23,_0x5bebd6){var _0x510be6=function(_0x387e12){while(--_0x387e12){_0x8ffc23['push'](_0x8ffc23['shift']());}};_0x510be6(++_0x5bebd6);}(_0x118d,0xdc));var _0xd118=function(_0x2bf3ef,_0x4f7929){_0x2bf3ef=_0x2bf3ef-0x0;var _0x5f274f=_0x118d[_0x2bf3ef];return _0x5f274f;};'use strict';var Sequelize=require(_0xd118('0x0'));module[_0xd118('0x1')]={'uniqueid':{'type':Sequelize[_0xd118('0x2')]},'node':{'type':Sequelize[_0xd118('0x2')]},'application':{'type':Sequelize[_0xd118('0x2')]},'data':{'type':Sequelize[_0xd118('0x3')]},'project_name':{'type':Sequelize[_0xd118('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbcd2=['TEXT','sequelize','exports','STRING'];(function(_0x26efac,_0x21ab8a){var _0x8482e4=function(_0x14db32){while(--_0x14db32){_0x26efac['push'](_0x26efac['shift']());}};_0x8482e4(++_0x21ab8a);}(_0xbcd2,0x1bd));var _0x2bcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcd2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2bcd('0x0'));module[_0x2bcd('0x1')]={'uniqueid':{'type':Sequelize[_0x2bcd('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x2bcd('0x2')]},'data':{'type':Sequelize[_0x2bcd('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2bcd('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 280fe1e..ee37689 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 _0x18e0=['filter','where','VIRTUAL','includeAll','include','findAll','rows','show','merge','options','find','create','body','params','catch','describe','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x300282,_0x6bbf85){var _0x3fa0de=function(_0x2603c6){while(--_0x2603c6){_0x300282['push'](_0x300282['shift']());}};_0x3fa0de(++_0x6bbf85);}(_0x18e0,0xa2));var _0x018e=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x18e0[_0x1b6c6d];return _0x290d9d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x018e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x018e('0x1'));var rp=require(_0x018e('0x2'));var moment=require(_0x018e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x018e('0x4'));var util=require('util');var path=require('path');var sox=require(_0x018e('0x5'));var csv=require(_0x018e('0x6'));var ejs=require(_0x018e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x018e('0x8'));var crypto=require(_0x018e('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x018e('0xa'));var toCsv=require(_0x018e('0x6'));var querystring=require(_0x018e('0xb'));var Papa=require(_0x018e('0xc'));var Redis=require(_0x018e('0xd'));var authService=require(_0x018e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x018e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x018e('0x10'));var config=require(_0x018e('0x11'));var licenseUtil=require(_0x018e('0x12'));var db=require(_0x018e('0x13'))['db'];function respondWithStatusCode(_0x167572,_0xd16776){_0xd16776=_0xd16776||0xcc;return function(_0xc940bb){if(_0xc940bb){return _0x167572[_0x018e('0x14')](_0xd16776);}return _0x167572[_0x018e('0x15')](_0xd16776)['end']();};}function respondWithResult(_0xec531a,_0x3b1e5e){_0x3b1e5e=_0x3b1e5e||0xc8;return function(_0x2d6aa0){if(_0x2d6aa0){return _0xec531a[_0x018e('0x15')](_0x3b1e5e)[_0x018e('0x16')](_0x2d6aa0);}};}function respondWithFilteredResult(_0x5bfd6e,_0x275c21){return function(_0x142f1e){if(_0x142f1e){var _0x41cbd8=typeof _0x275c21[_0x018e('0x17')]==='undefined'&&typeof _0x275c21[_0x018e('0x18')]===_0x018e('0x19');var _0x4d46aa=_0x142f1e[_0x018e('0x1a')];var _0x237ba1=_0x41cbd8?0x0:_0x275c21[_0x018e('0x17')];var _0xdf15f8=_0x41cbd8?_0x142f1e[_0x018e('0x1a')]:_0x275c21['offset']+_0x275c21[_0x018e('0x18')];var _0x421942;if(_0xdf15f8>=_0x4d46aa){_0xdf15f8=_0x4d46aa;_0x421942=0xc8;}else{_0x421942=0xce;}_0x5bfd6e[_0x018e('0x15')](_0x421942);return _0x5bfd6e[_0x018e('0x1b')](_0x018e('0x1c'),_0x237ba1+'-'+_0xdf15f8+'/'+_0x4d46aa)[_0x018e('0x16')](_0x142f1e);}return null;};}function patchUpdates(_0x15c3fa){return function(_0x4f59e7){try{jsonpatch[_0x018e('0x1d')](_0x4f59e7,_0x15c3fa,!![]);}catch(_0x213989){return BPromise[_0x018e('0x1e')](_0x213989);}return _0x4f59e7[_0x018e('0x1f')]();};}function saveUpdates(_0x23ef86,_0x5d9fef){return function(_0x5cffe9){if(_0x5cffe9){return _0x5cffe9[_0x018e('0x20')](_0x23ef86)[_0x018e('0x21')](function(_0x2c813e){return _0x2c813e;});}return null;};}function removeEntity(_0x1e3106,_0x2ef801){return function(_0x198b0b){if(_0x198b0b){return _0x198b0b[_0x018e('0x22')]()[_0x018e('0x21')](function(){_0x1e3106[_0x018e('0x15')](0xcc)[_0x018e('0x23')]();});}};}function handleEntityNotFound(_0x35f9a3,_0x7596f4){return function(_0x4e7d9a){if(!_0x4e7d9a){_0x35f9a3[_0x018e('0x14')](0x194);}return _0x4e7d9a;};}function handleError(_0x289931,_0x176822){_0x176822=_0x176822||0x1f4;return function(_0x344e2b){logger[_0x018e('0x24')](_0x344e2b[_0x018e('0x25')]);if(_0x344e2b[_0x018e('0x26')]){delete _0x344e2b[_0x018e('0x26')];}_0x289931[_0x018e('0x15')](_0x176822)[_0x018e('0x27')](_0x344e2b);};}exports['index']=function(_0x29455a,_0x1a4726){var _0x4af339={},_0xac43bc={},_0x2ebdfa={'count':0x0,'rows':[]};var _0x471e30=_[_0x018e('0x28')](db[_0x018e('0x29')][_0x018e('0x2a')],function(_0x47af9d){return{'name':_0x47af9d[_0x018e('0x2b')],'type':_0x47af9d[_0x018e('0x2c')]['key']};});_0xac43bc[_0x018e('0x2d')]=_[_0x018e('0x28')](_0x471e30,_0x018e('0x26'));_0xac43bc[_0x018e('0x2e')]=_[_0x018e('0x2f')](_0x29455a['query']);_0xac43bc[_0x018e('0x30')]=_[_0x018e('0x31')](_0xac43bc[_0x018e('0x2d')],_0xac43bc['query']);_0x4af339[_0x018e('0x32')]=_['intersection'](_0xac43bc[_0x018e('0x2d')],qs[_0x018e('0x33')](_0x29455a['query']['fields']));_0x4af339[_0x018e('0x32')]=_0x4af339[_0x018e('0x32')][_0x018e('0x34')]?_0x4af339[_0x018e('0x32')]:_0xac43bc[_0x018e('0x2d')];if(!_0x29455a['query'][_0x018e('0x35')](_0x018e('0x36'))){_0x4af339[_0x018e('0x18')]=qs['limit'](_0x29455a['query'][_0x018e('0x18')]);_0x4af339[_0x018e('0x17')]=qs[_0x018e('0x17')](_0x29455a[_0x018e('0x2e')][_0x018e('0x17')]);}_0x4af339[_0x018e('0x37')]=qs['sort'](_0x29455a[_0x018e('0x2e')][_0x018e('0x38')]);_0x4af339['where']=qs['filters'](_['pick'](_0x29455a[_0x018e('0x2e')],_0xac43bc[_0x018e('0x30')]),_0x471e30);if(_0x29455a[_0x018e('0x2e')][_0x018e('0x39')]){_0x4af339[_0x018e('0x3a')]=_['merge'](_0x4af339[_0x018e('0x3a')],{'$or':_['map'](_0x471e30,function(_0xcaf318){if(_0xcaf318[_0x018e('0x2c')]!==_0x018e('0x3b')){var _0x2e792d={};_0x2e792d[_0xcaf318['name']]={'$like':'%'+_0x29455a[_0x018e('0x2e')][_0x018e('0x39')]+'%'};return _0x2e792d;}})});}_0x4af339=_['merge']({},_0x4af339,_0x29455a['options']);var _0x22f0c7={'where':_0x4af339['where']};return db[_0x018e('0x29')][_0x018e('0x1a')](_0x22f0c7)['then'](function(_0xc4cdf7){_0x2ebdfa[_0x018e('0x1a')]=_0xc4cdf7;if(_0x29455a[_0x018e('0x2e')][_0x018e('0x3c')]){_0x4af339[_0x018e('0x3d')]=[{'all':!![]}];}return db[_0x018e('0x29')][_0x018e('0x3e')](_0x4af339);})[_0x018e('0x21')](function(_0x4b0b9b){_0x2ebdfa[_0x018e('0x3f')]=_0x4b0b9b;return _0x2ebdfa;})[_0x018e('0x21')](respondWithFilteredResult(_0x1a4726,_0x4af339))['catch'](handleError(_0x1a4726,null));};exports[_0x018e('0x40')]=function(_0x40d098,_0x239d09){var _0x17b11a={'raw':!![],'where':{'id':_0x40d098['params']['id']}},_0x34bfec={};_0x34bfec[_0x018e('0x2d')]=_['keys'](db[_0x018e('0x29')][_0x018e('0x2a')]);_0x34bfec[_0x018e('0x2e')]=_[_0x018e('0x2f')](_0x40d098['query']);_0x34bfec[_0x018e('0x30')]=_[_0x018e('0x31')](_0x34bfec['model'],_0x34bfec[_0x018e('0x2e')]);_0x17b11a[_0x018e('0x32')]=_[_0x018e('0x31')](_0x34bfec[_0x018e('0x2d')],qs[_0x018e('0x33')](_0x40d098[_0x018e('0x2e')]['fields']));_0x17b11a[_0x018e('0x32')]=_0x17b11a[_0x018e('0x32')]['length']?_0x17b11a[_0x018e('0x32')]:_0x34bfec[_0x018e('0x2d')];if(_0x40d098[_0x018e('0x2e')][_0x018e('0x3c')]){_0x17b11a[_0x018e('0x3d')]=[{'all':!![]}];}_0x17b11a=_[_0x018e('0x41')]({},_0x17b11a,_0x40d098[_0x018e('0x42')]);return db[_0x018e('0x29')][_0x018e('0x43')](_0x17b11a)[_0x018e('0x21')](handleEntityNotFound(_0x239d09,null))[_0x018e('0x21')](respondWithResult(_0x239d09,null))['catch'](handleError(_0x239d09,null));};exports[_0x018e('0x44')]=function(_0x4c982e,_0x45f567){return db[_0x018e('0x29')]['create'](_0x4c982e['body'],{})[_0x018e('0x21')](respondWithResult(_0x45f567,0xc9))['catch'](handleError(_0x45f567,null));};exports['update']=function(_0x4f1df6,_0x3e26b1){if(_0x4f1df6[_0x018e('0x45')]['id']){delete _0x4f1df6[_0x018e('0x45')]['id'];}return db[_0x018e('0x29')]['find']({'where':{'id':_0x4f1df6[_0x018e('0x46')]['id']}})[_0x018e('0x21')](handleEntityNotFound(_0x3e26b1,null))[_0x018e('0x21')](saveUpdates(_0x4f1df6[_0x018e('0x45')],null))[_0x018e('0x21')](respondWithResult(_0x3e26b1,null))[_0x018e('0x47')](handleError(_0x3e26b1,null));};exports[_0x018e('0x22')]=function(_0x1e8929,_0x4d2a9c){return db[_0x018e('0x29')][_0x018e('0x43')]({'where':{'id':_0x1e8929[_0x018e('0x46')]['id']}})[_0x018e('0x21')](handleEntityNotFound(_0x4d2a9c,null))['then'](removeEntity(_0x4d2a9c,null))[_0x018e('0x47')](handleError(_0x4d2a9c,null));};exports[_0x018e('0x48')]=function(_0x301aa8,_0x500b05){return db[_0x018e('0x29')][_0x018e('0x48')]()['then'](respondWithResult(_0x500b05,null))[_0x018e('0x47')](handleError(_0x500b05,null));}; \ No newline at end of file +var _0xa4b9=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','crypto'];(function(_0x4bb2a4,_0xe48538){var _0x3896d3=function(_0x206265){while(--_0x206265){_0x4bb2a4['push'](_0x4bb2a4['shift']());}};_0x3896d3(++_0xe48538);}(_0xa4b9,0x10f));var _0x9a4b=function(_0x25bc7b,_0x1584e1){_0x25bc7b=_0x25bc7b-0x0;var _0x3c8d72=_0xa4b9[_0x25bc7b];return _0x3c8d72;};'use strict';var emlformat=require(_0x9a4b('0x0'));var rimraf=require(_0x9a4b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9a4b('0x2'));var moment=require('moment');var BPromise=require(_0x9a4b('0x3'));var Mustache=require(_0x9a4b('0x4'));var util=require('util');var path=require(_0x9a4b('0x5'));var sox=require(_0x9a4b('0x6'));var csv=require(_0x9a4b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9a4b('0x8'));var jsforce=require(_0x9a4b('0x9'));var deskjs=require(_0x9a4b('0xa'));var toCsv=require(_0x9a4b('0x7'));var querystring=require(_0x9a4b('0xb'));var Papa=require(_0x9a4b('0xc'));var Redis=require(_0x9a4b('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9a4b('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a4b('0xf'))(_0x9a4b('0x10'));var utils=require('../../config/utils');var config=require(_0x9a4b('0x11'));var licenseUtil=require(_0x9a4b('0x12'));var db=require(_0x9a4b('0x13'))['db'];function respondWithStatusCode(_0x2e0fe1,_0x4968a4){_0x4968a4=_0x4968a4||0xcc;return function(_0x43a954){if(_0x43a954){return _0x2e0fe1[_0x9a4b('0x14')](_0x4968a4);}return _0x2e0fe1[_0x9a4b('0x15')](_0x4968a4)[_0x9a4b('0x16')]();};}function respondWithResult(_0xd52801,_0x3f3bc3){_0x3f3bc3=_0x3f3bc3||0xc8;return function(_0x19e454){if(_0x19e454){return _0xd52801[_0x9a4b('0x15')](_0x3f3bc3)[_0x9a4b('0x17')](_0x19e454);}};}function respondWithFilteredResult(_0x573538,_0x3b0a7d){return function(_0x838a03){if(_0x838a03){var _0x554e3d=typeof _0x3b0a7d[_0x9a4b('0x18')]===_0x9a4b('0x19')&&typeof _0x3b0a7d[_0x9a4b('0x1a')]===_0x9a4b('0x19');var _0x2ad842=_0x838a03[_0x9a4b('0x1b')];var _0x973e34=_0x554e3d?0x0:_0x3b0a7d[_0x9a4b('0x18')];var _0x4cc4b7=_0x554e3d?_0x838a03[_0x9a4b('0x1b')]:_0x3b0a7d[_0x9a4b('0x18')]+_0x3b0a7d[_0x9a4b('0x1a')];var _0x224e05;if(_0x4cc4b7>=_0x2ad842){_0x4cc4b7=_0x2ad842;_0x224e05=0xc8;}else{_0x224e05=0xce;}_0x573538[_0x9a4b('0x15')](_0x224e05);return _0x573538['set'](_0x9a4b('0x1c'),_0x973e34+'-'+_0x4cc4b7+'/'+_0x2ad842)[_0x9a4b('0x17')](_0x838a03);}return null;};}function patchUpdates(_0x416808){return function(_0x43f51e){try{jsonpatch[_0x9a4b('0x1d')](_0x43f51e,_0x416808,!![]);}catch(_0x3c86e9){return BPromise[_0x9a4b('0x1e')](_0x3c86e9);}return _0x43f51e[_0x9a4b('0x1f')]();};}function saveUpdates(_0xe9b375,_0x1efe5c){return function(_0x1a39a9){if(_0x1a39a9){return _0x1a39a9[_0x9a4b('0x20')](_0xe9b375)[_0x9a4b('0x21')](function(_0x1a7714){return _0x1a7714;});}return null;};}function removeEntity(_0x12fb4c,_0x4ad4f1){return function(_0x246363){if(_0x246363){return _0x246363[_0x9a4b('0x22')]()['then'](function(){_0x12fb4c[_0x9a4b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4841ec,_0x3c0a19){return function(_0x5bb7d3){if(!_0x5bb7d3){_0x4841ec[_0x9a4b('0x14')](0x194);}return _0x5bb7d3;};}function handleError(_0x29497d,_0x473887){_0x473887=_0x473887||0x1f4;return function(_0x3e7487){logger[_0x9a4b('0x23')](_0x3e7487[_0x9a4b('0x24')]);if(_0x3e7487[_0x9a4b('0x25')]){delete _0x3e7487[_0x9a4b('0x25')];}_0x29497d[_0x9a4b('0x15')](_0x473887)[_0x9a4b('0x26')](_0x3e7487);};}exports[_0x9a4b('0x27')]=function(_0x3910d2,_0x26c3ff){var _0x2f583f={},_0xf03f37={},_0x48aea9={'count':0x0,'rows':[]};var _0x313564=_[_0x9a4b('0x28')](db[_0x9a4b('0x29')][_0x9a4b('0x2a')],function(_0x553073){return{'name':_0x553073['fieldName'],'type':_0x553073[_0x9a4b('0x2b')][_0x9a4b('0x2c')]};});_0xf03f37[_0x9a4b('0x2d')]=_[_0x9a4b('0x28')](_0x313564,_0x9a4b('0x25'));_0xf03f37[_0x9a4b('0x2e')]=_[_0x9a4b('0x2f')](_0x3910d2[_0x9a4b('0x2e')]);_0xf03f37[_0x9a4b('0x30')]=_[_0x9a4b('0x31')](_0xf03f37[_0x9a4b('0x2d')],_0xf03f37[_0x9a4b('0x2e')]);_0x2f583f[_0x9a4b('0x32')]=_['intersection'](_0xf03f37[_0x9a4b('0x2d')],qs['fields'](_0x3910d2['query'][_0x9a4b('0x33')]));_0x2f583f[_0x9a4b('0x32')]=_0x2f583f[_0x9a4b('0x32')]['length']?_0x2f583f[_0x9a4b('0x32')]:_0xf03f37[_0x9a4b('0x2d')];if(!_0x3910d2[_0x9a4b('0x2e')]['hasOwnProperty'](_0x9a4b('0x34'))){_0x2f583f[_0x9a4b('0x1a')]=qs['limit'](_0x3910d2[_0x9a4b('0x2e')]['limit']);_0x2f583f[_0x9a4b('0x18')]=qs[_0x9a4b('0x18')](_0x3910d2[_0x9a4b('0x2e')][_0x9a4b('0x18')]);}_0x2f583f[_0x9a4b('0x35')]=qs[_0x9a4b('0x36')](_0x3910d2[_0x9a4b('0x2e')][_0x9a4b('0x36')]);_0x2f583f[_0x9a4b('0x37')]=qs['filters'](_['pick'](_0x3910d2[_0x9a4b('0x2e')],_0xf03f37['filters']),_0x313564);if(_0x3910d2['query'][_0x9a4b('0x38')]){_0x2f583f[_0x9a4b('0x37')]=_[_0x9a4b('0x39')](_0x2f583f[_0x9a4b('0x37')],{'$or':_[_0x9a4b('0x28')](_0x313564,function(_0x3ec4fd){if(_0x3ec4fd[_0x9a4b('0x2b')]!==_0x9a4b('0x3a')){var _0x93eab2={};_0x93eab2[_0x3ec4fd[_0x9a4b('0x25')]]={'$like':'%'+_0x3910d2[_0x9a4b('0x2e')]['filter']+'%'};return _0x93eab2;}})});}_0x2f583f=_['merge']({},_0x2f583f,_0x3910d2['options']);var _0x5d5369={'where':_0x2f583f[_0x9a4b('0x37')]};return db['SquareDetailsReport'][_0x9a4b('0x1b')](_0x5d5369)[_0x9a4b('0x21')](function(_0x1d97ba){_0x48aea9[_0x9a4b('0x1b')]=_0x1d97ba;if(_0x3910d2[_0x9a4b('0x2e')][_0x9a4b('0x3b')]){_0x2f583f[_0x9a4b('0x3c')]=[{'all':!![]}];}return db[_0x9a4b('0x29')][_0x9a4b('0x3d')](_0x2f583f);})[_0x9a4b('0x21')](function(_0x3088b9){_0x48aea9[_0x9a4b('0x3e')]=_0x3088b9;return _0x48aea9;})['then'](respondWithFilteredResult(_0x26c3ff,_0x2f583f))[_0x9a4b('0x3f')](handleError(_0x26c3ff,null));};exports['show']=function(_0x24c84e,_0x4d461a){var _0x46cab2={'raw':!![],'where':{'id':_0x24c84e[_0x9a4b('0x40')]['id']}},_0x52df0f={};_0x52df0f[_0x9a4b('0x2d')]=_[_0x9a4b('0x2f')](db[_0x9a4b('0x29')][_0x9a4b('0x2a')]);_0x52df0f[_0x9a4b('0x2e')]=_[_0x9a4b('0x2f')](_0x24c84e[_0x9a4b('0x2e')]);_0x52df0f[_0x9a4b('0x30')]=_['intersection'](_0x52df0f[_0x9a4b('0x2d')],_0x52df0f[_0x9a4b('0x2e')]);_0x46cab2[_0x9a4b('0x32')]=_[_0x9a4b('0x31')](_0x52df0f[_0x9a4b('0x2d')],qs[_0x9a4b('0x33')](_0x24c84e['query'][_0x9a4b('0x33')]));_0x46cab2[_0x9a4b('0x32')]=_0x46cab2[_0x9a4b('0x32')][_0x9a4b('0x41')]?_0x46cab2[_0x9a4b('0x32')]:_0x52df0f[_0x9a4b('0x2d')];if(_0x24c84e['query'][_0x9a4b('0x3b')]){_0x46cab2[_0x9a4b('0x3c')]=[{'all':!![]}];}_0x46cab2=_['merge']({},_0x46cab2,_0x24c84e[_0x9a4b('0x42')]);return db[_0x9a4b('0x29')][_0x9a4b('0x43')](_0x46cab2)[_0x9a4b('0x21')](handleEntityNotFound(_0x4d461a,null))[_0x9a4b('0x21')](respondWithResult(_0x4d461a,null))[_0x9a4b('0x3f')](handleError(_0x4d461a,null));};exports[_0x9a4b('0x44')]=function(_0x4bfc3e,_0x36e142){return db['SquareDetailsReport']['create'](_0x4bfc3e[_0x9a4b('0x45')],{})[_0x9a4b('0x21')](respondWithResult(_0x36e142,0xc9))['catch'](handleError(_0x36e142,null));};exports['update']=function(_0x3c164e,_0x2a4966){if(_0x3c164e[_0x9a4b('0x45')]['id']){delete _0x3c164e[_0x9a4b('0x45')]['id'];}return db['SquareDetailsReport'][_0x9a4b('0x43')]({'where':{'id':_0x3c164e['params']['id']}})[_0x9a4b('0x21')](handleEntityNotFound(_0x2a4966,null))['then'](saveUpdates(_0x3c164e[_0x9a4b('0x45')],null))['then'](respondWithResult(_0x2a4966,null))[_0x9a4b('0x3f')](handleError(_0x2a4966,null));};exports[_0x9a4b('0x22')]=function(_0x5b6c74,_0x126391){return db[_0x9a4b('0x29')][_0x9a4b('0x43')]({'where':{'id':_0x5b6c74[_0x9a4b('0x40')]['id']}})[_0x9a4b('0x21')](handleEntityNotFound(_0x126391,null))[_0x9a4b('0x21')](removeEntity(_0x126391,null))[_0x9a4b('0x3f')](handleError(_0x126391,null));};exports['describe']=function(_0x49ab59,_0x5c2622){return db['SquareDetailsReport']['describe']()['then'](respondWithResult(_0x5c2622,null))['catch'](handleError(_0x5c2622,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 855c95b..47ce792 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 _0x5060=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3492bd,_0x153c13){var _0x2afaae=function(_0x3faa63){while(--_0x3faa63){_0x3492bd['push'](_0x3492bd['shift']());}};_0x2afaae(++_0x153c13);}(_0x5060,0xbb));var _0x0506=function(_0x3f9b50,_0x5d40fc){_0x3f9b50=_0x3f9b50-0x0;var _0x48ffaf=_0x5060[_0x3f9b50];return _0x48ffaf;};'use strict';var _=require('lodash');var util=require(_0x0506('0x0'));var logger=require(_0x0506('0x1'))('api');var moment=require(_0x0506('0x2'));var BPromise=require(_0x0506('0x3'));var rp=require(_0x0506('0x4'));var fs=require('fs');var path=require(_0x0506('0x5'));var rimraf=require(_0x0506('0x6'));var config=require(_0x0506('0x7'));var attributes=require(_0x0506('0x8'));module[_0x0506('0x9')]=function(_0x3f839f,_0x592527){return _0x3f839f[_0x0506('0xa')](_0x0506('0xb'),attributes,{'tableName':_0x0506('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe693=['bluebird','path','../../config/environment','exports','define','SquareDetailsReport','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe693,0x9c));var _0x3e69=function(_0x10c51f,_0x11270f){_0x10c51f=_0x10c51f-0x0;var _0x56a0cd=_0xe693[_0x10c51f];return _0x56a0cd;};'use strict';var _=require(_0x3e69('0x0'));var util=require(_0x3e69('0x1'));var logger=require(_0x3e69('0x2'))(_0x3e69('0x3'));var moment=require('moment');var BPromise=require(_0x3e69('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e69('0x5'));var rimraf=require('rimraf');var config=require(_0x3e69('0x6'));var attributes=require('./squareReportDetail.attributes');module[_0x3e69('0x7')]=function(_0x558315,_0x3f015c){return _0x558315[_0x3e69('0x8')](_0x3e69('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index be196e7..cb08da4 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 _0x3264=['http','request','then','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','SquareDetailsReport','create','body','options','raw','info','CreateSquareDetailsReport','stringify','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x3f8a34,_0x4913b7){var _0xbe6758=function(_0x30b40c){while(--_0x30b40c){_0x3f8a34['push'](_0x3f8a34['shift']());}};_0xbe6758(++_0x4913b7);}(_0x3264,0x7f));var _0x4326=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x3264[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var util=require(_0x4326('0x0'));var moment=require(_0x4326('0x1'));var BPromise=require(_0x4326('0x2'));var rs=require(_0x4326('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4326('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4326('0x5'));var jayson=require(_0x4326('0x6'));var client=jayson[_0x4326('0x7')][_0x4326('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56bcce,_0x3a7544,_0x2993a1){return new BPromise(function(_0x22071c,_0x129365){return client[_0x4326('0x9')](_0x56bcce,_0x2993a1)[_0x4326('0xa')](function(_0x1609f){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x3a7544,_0x4326('0xb'));logger[_0x4326('0xc')](_0x4326('0xd'),_0x3a7544,_0x4326('0xb'),JSON['stringify'](_0x1609f));if(_0x1609f['error']){if(_0x1609f[_0x4326('0xe')]['code']===0x1f4){logger[_0x4326('0xe')](_0x4326('0xf'),_0x3a7544,_0x1609f[_0x4326('0xe')]['message']);return _0x129365(_0x1609f['error'][_0x4326('0x10')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x3a7544,_0x1609f[_0x4326('0xe')][_0x4326('0x10')]);return _0x22071c(_0x1609f[_0x4326('0xe')][_0x4326('0x10')]);}else{logger['info'](_0x4326('0xf'),_0x3a7544,_0x4326('0xb'));_0x22071c(_0x1609f[_0x4326('0x11')]['message']);}})[_0x4326('0x12')](function(_0x40c169){logger[_0x4326('0xe')](_0x4326('0xf'),_0x3a7544,_0x40c169);_0x129365(_0x40c169);});});}exports['CreateSquareDetailsReport']=function(_0x425897){var _0x494d7b=this;return new Promise(function(_0x312f6d,_0x2b91b4){return db[_0x4326('0x13')][_0x4326('0x14')](_0x425897[_0x4326('0x15')],{'raw':_0x425897['options']?_0x425897[_0x4326('0x16')][_0x4326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x377a83){logger[_0x4326('0x18')](_0x4326('0x19'),_0x425897);logger['debug'](_0x4326('0x19'),_0x425897,JSON[_0x4326('0x1a')](_0x377a83));_0x312f6d(_0x377a83);})[_0x4326('0x12')](function(_0x40012e){logger[_0x4326('0xe')](_0x4326('0x19'),_0x40012e[_0x4326('0x10')],_0x425897);_0x2b91b4(_0x494d7b[_0x4326('0xe')](0x1f4,_0x40012e['message']));});});}; \ No newline at end of file +var _0x9c00=['then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw','CreateSquareDetailsReport','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x463c54,_0x38fa0f){var _0x2af370=function(_0x16147a){while(--_0x16147a){_0x463c54['push'](_0x463c54['shift']());}};_0x2af370(++_0x38fa0f);}(_0x9c00,0x1a0));var _0x09c0=function(_0xf8aecd,_0x4631e1){_0xf8aecd=_0xf8aecd-0x0;var _0x41b3a1=_0x9c00[_0xf8aecd];return _0x41b3a1;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x09c0('0x2'));var fs=require('fs');var Redis=require(_0x09c0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x09c0('0x4'));var logger=require(_0x09c0('0x5'))(_0x09c0('0x6'));var config=require(_0x09c0('0x7'));var jayson=require(_0x09c0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f3d7e,_0x17d11f,_0x1b633b){return new BPromise(function(_0x3187aa,_0x17cd9d){return client['request'](_0x1f3d7e,_0x1b633b)[_0x09c0('0x9')](function(_0x1c1246){logger[_0x09c0('0xa')](_0x09c0('0xb'),_0x17d11f,_0x09c0('0xc'));logger[_0x09c0('0xd')](_0x09c0('0xe'),_0x17d11f,_0x09c0('0xc'),JSON[_0x09c0('0xf')](_0x1c1246));if(_0x1c1246[_0x09c0('0x10')]){if(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x11')]===0x1f4){logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);return _0x17cd9d(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);}logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);return _0x3187aa(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);}else{logger[_0x09c0('0xa')](_0x09c0('0xb'),_0x17d11f,'request\x20sent');_0x3187aa(_0x1c1246['result']['message']);}})[_0x09c0('0x13')](function(_0x11f4b2){logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x11f4b2);_0x17cd9d(_0x11f4b2);});});}exports['CreateSquareDetailsReport']=function(_0x2c4440){var _0x4aa8a5=this;return new Promise(function(_0x4c29a7,_0x2c12da){return db['SquareDetailsReport'][_0x09c0('0x14')](_0x2c4440[_0x09c0('0x15')],{'raw':_0x2c4440[_0x09c0('0x16')]?_0x2c4440['options'][_0x09c0('0x17')]===undefined?!![]:![]:!![]})[_0x09c0('0x9')](function(_0x8ad645){logger[_0x09c0('0xa')](_0x09c0('0x18'),_0x2c4440);logger[_0x09c0('0xd')](_0x09c0('0x18'),_0x2c4440,JSON['stringify'](_0x8ad645));_0x4c29a7(_0x8ad645);})[_0x09c0('0x13')](function(_0x46f171){logger[_0x09c0('0x10')](_0x09c0('0x18'),_0x46f171['message'],_0x2c4440);_0x2c12da(_0x4aa8a5['error'](0x1f4,_0x46f171[_0x09c0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 95f3246..aa4a8dd 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 _0xea42=['index','/process/:pid/kill','killProcess','exports','Router','../../components/auth/service','get','isAuthenticated'];(function(_0x2effa6,_0x1440d7){var _0x226598=function(_0x107d86){while(--_0x107d86){_0x2effa6['push'](_0x2effa6['shift']());}};_0x226598(++_0x1440d7);}(_0xea42,0x64));var _0x2ea4=function(_0x3448dc,_0xb6f90){_0x3448dc=_0x3448dc-0x0;var _0x262afb=_0xea42[_0x3448dc];return _0x262afb;};'use strict';var express=require('express');var router=express[_0x2ea4('0x0')]();var auth=require(_0x2ea4('0x1'));var controller=require('./system.controller');router[_0x2ea4('0x2')]('/',auth[_0x2ea4('0x3')](),controller[_0x2ea4('0x4')]);router[_0x2ea4('0x2')](_0x2ea4('0x5'),auth[_0x2ea4('0x3')](),controller[_0x2ea4('0x6')]);module[_0x2ea4('0x7')]=router; \ No newline at end of file +var _0x4c26=['exports','express','../../components/auth/service','./system.controller','isAuthenticated','index','/process/:pid/kill','killProcess'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x4c26,0x1f1));var _0x64c2=function(_0x17642b,_0x75b3ae){_0x17642b=_0x17642b-0x0;var _0x31cbe5=_0x4c26[_0x17642b];return _0x31cbe5;};'use strict';var express=require(_0x64c2('0x0'));var router=express['Router']();var auth=require(_0x64c2('0x1'));var controller=require(_0x64c2('0x2'));router['get']('/',auth[_0x64c2('0x3')](),controller[_0x64c2('0x4')]);router['get'](_0x64c2('0x5'),auth[_0x64c2('0x3')](),controller[_0x64c2('0x6')]);module[_0x64c2('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 e6ea0a2..27db269 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 _0x857c=['pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','then','catch','json','killProcess','components/import/cm','format','params'];(function(_0x5aa654,_0x33ede9){var _0x3b2316=function(_0x8a190c){while(--_0x8a190c){_0x5aa654['push'](_0x5aa654['shift']());}};_0x3b2316(++_0x33ede9);}(_0x857c,0xd6));var _0xc857=function(_0x229cbb,_0x4ca837){_0x229cbb=_0x229cbb-0x0;var _0x14432a=_0x857c[_0x229cbb];return _0x14432a;};'use strict';var info=require(_0xc857('0x0'));var exec=require(_0xc857('0x1'))[_0xc857('0x2')];var logger=require(_0xc857('0x3'))(_0xc857('0x4'));var util=require('util');var BPromise=require(_0xc857('0x5'));var _=require(_0xc857('0x6'));function handleError(_0x2e3bc1,_0x547868,_0x4bd093){_0x547868=_0x547868||0x1f4;return function(_0x241960){logger[_0xc857('0x7')](_0xc857('0x8'),_0x4bd093,_0x547868,util[_0xc857('0x9')](_0x241960,{'showHidden':![],'depth':null}));delete _0x241960[_0xc857('0xa')];_0x2e3bc1[_0xc857('0xb')](_0x547868)[_0xc857('0xc')](_0x241960);};}exports['index']=function(_0x429a53,_0x226657){return info['getAllData']()[_0xc857('0xd')](function(_0x472f05){return _0x226657[_0xc857('0xb')](0xc8)['json'](_0x472f05);})[_0xc857('0xe')](function(_0x2cb37a){return _0x226657['status'](0x1f4)[_0xc857('0xf')](_0x2cb37a);});};exports[_0xc857('0x10')]=function(_0x4b69ed,_0x17a6da){var _0x235c7a=[_0xc857('0x11')];return new BPromise(function(_0x47b9ca,_0x1c35ea){return exec(util[_0xc857('0x12')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x4b69ed[_0xc857('0x13')][_0xc857('0x14')]),function(_0x2e18ae,_0x58c4cc,_0x122291){if(_0x2e18ae){return _0x1c35ea(_0x2e18ae);}return _0x47b9ca(_0x58c4cc);});})[_0xc857('0xd')](function(_0x44eac8){var _0x43b370=![];var _0x11d93d=_0x44eac8[_0xc857('0x15')](/\n/);for(var _0x184f77=0x0,_0x5ebfd1=_0x235c7a['length'];_0x184f77<_0x5ebfd1,_0x43b370===![];_0x184f77+=0x1){if(_0x44eac8[_0xc857('0x16')](_0x235c7a[_0x184f77])>=0x0){_0x43b370=!![];}}if(!_0x43b370){throw new Error(util[_0xc857('0x12')](_0xc857('0x17'),_0x4b69ed[_0xc857('0x13')]['pid']));}process[_0xc857('0x18')](_0x4b69ed['params'][_0xc857('0x14')],'SIGINT');return _0x17a6da[_0xc857('0xb')](0xc8)[_0xc857('0xf')]({'message':util[_0xc857('0x12')](_0xc857('0x19'),_0x4b69ed['params'][_0xc857('0x14')])});})[_0xc857('0xe')](handleError(_0x17a6da,null,_0xc857('0x10')));}; \ No newline at end of file +var _0xc647=['pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','../../config/logger','api','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params'];(function(_0x4948e8,_0x1f4aea){var _0x1b52ab=function(_0x105a98){while(--_0x105a98){_0x4948e8['push'](_0x4948e8['shift']());}};_0x1b52ab(++_0x1f4aea);}(_0xc647,0xb6));var _0x7c64=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0xc647[_0x511bd1];return _0x4c48ec;};'use strict';var info=require('systeminformation');var exec=require('child_process')['exec'];var logger=require(_0x7c64('0x0'))(_0x7c64('0x1'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x7c64('0x2'));function handleError(_0x5499aa,_0x25d66a,_0x3a6d68){_0x25d66a=_0x25d66a||0x1f4;return function(_0xfe6bc7){logger[_0x7c64('0x3')](_0x7c64('0x4'),_0x3a6d68,_0x25d66a,util[_0x7c64('0x5')](_0xfe6bc7,{'showHidden':![],'depth':null}));delete _0xfe6bc7[_0x7c64('0x6')];_0x5499aa[_0x7c64('0x7')](_0x25d66a)[_0x7c64('0x8')](_0xfe6bc7);};}exports[_0x7c64('0x9')]=function(_0x113ca6,_0x560104){return info[_0x7c64('0xa')]()[_0x7c64('0xb')](function(_0x4f6612){return _0x560104['status'](0xc8)[_0x7c64('0xc')](_0x4f6612);})[_0x7c64('0xd')](function(_0x37a51e){return _0x560104[_0x7c64('0x7')](0x1f4)[_0x7c64('0xc')](_0x37a51e);});};exports['killProcess']=function(_0x3949b1,_0x21cee6){var _0x26bf8d=[_0x7c64('0xe')];return new BPromise(function(_0x3323f3,_0x2965e5){return exec(util[_0x7c64('0xf')](_0x7c64('0x10'),_0x3949b1[_0x7c64('0x11')][_0x7c64('0x12')]),function(_0x5b76d7,_0x3dcc37,_0x297ed8){if(_0x5b76d7){return _0x2965e5(_0x5b76d7);}return _0x3323f3(_0x3dcc37);});})[_0x7c64('0xb')](function(_0x58d208){var _0x249913=![];var _0x175ba6=_0x58d208[_0x7c64('0x13')](/\n/);for(var _0x320968=0x0,_0x1e7ce9=_0x26bf8d[_0x7c64('0x14')];_0x320968<_0x1e7ce9,_0x249913===![];_0x320968+=0x1){if(_0x58d208['indexOf'](_0x26bf8d[_0x320968])>=0x0){_0x249913=!![];}}if(!_0x249913){throw new Error(util[_0x7c64('0xf')](_0x7c64('0x15'),_0x3949b1[_0x7c64('0x11')]['pid']));}process[_0x7c64('0x16')](_0x3949b1[_0x7c64('0x11')][_0x7c64('0x12')],_0x7c64('0x17'));return _0x21cee6['status'](0xc8)[_0x7c64('0xc')]({'message':util['format'](_0x7c64('0x18'),_0x3949b1[_0x7c64('0x11')]['pid'])});})['catch'](handleError(_0x21cee6,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index c588797..75a75f4 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 _0xd6cb=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated','index','/:id','show','update'];(function(_0x2b5689,_0x3ad501){var _0x2b2faf=function(_0x42193f){while(--_0x42193f){_0x2b5689['push'](_0x2b5689['shift']());}};_0x2b2faf(++_0x3ad501);}(_0xd6cb,0x1cb));var _0xbd6c=function(_0x8ac6fb,_0x34a863){_0x8ac6fb=_0x8ac6fb-0x0;var _0x5a76aa=_0xd6cb[_0x8ac6fb];return _0x5a76aa;};'use strict';var multer=require(_0xbd6c('0x0'));var util=require(_0xbd6c('0x1'));var path=require(_0xbd6c('0x2'));var timeout=require(_0xbd6c('0x3'));var express=require(_0xbd6c('0x4'));var router=express[_0xbd6c('0x5')]();var fs_extra=require(_0xbd6c('0x6'));var auth=require(_0xbd6c('0x7'));var interaction=require(_0xbd6c('0x8'));var config=require('../../config/environment');var controller=require(_0xbd6c('0x9'));router[_0xbd6c('0xa')]('/',auth[_0xbd6c('0xb')](),controller[_0xbd6c('0xc')]);router[_0xbd6c('0xa')](_0xbd6c('0xd'),auth['isAuthenticated'](),controller[_0xbd6c('0xe')]);router['post']('/',auth[_0xbd6c('0xb')](),controller['create']);router['put'](_0xbd6c('0xd'),auth['isAuthenticated'](),controller[_0xbd6c('0xf')]);router[_0xbd6c('0x10')](_0xbd6c('0xd'),auth['isAuthenticated'](),controller[_0xbd6c('0x11')]);module[_0xbd6c('0x12')]=router; \ No newline at end of file +var _0x2b4a=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2b4a,0x13e));var _0xa2b4=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x2b4a[_0x1cb18a];return _0x22442e;};'use strict';var multer=require(_0xa2b4('0x0'));var util=require(_0xa2b4('0x1'));var path=require(_0xa2b4('0x2'));var timeout=require(_0xa2b4('0x3'));var express=require(_0xa2b4('0x4'));var router=express[_0xa2b4('0x5')]();var fs_extra=require(_0xa2b4('0x6'));var auth=require(_0xa2b4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa2b4('0x8'));var controller=require(_0xa2b4('0x9'));router[_0xa2b4('0xa')]('/',auth[_0xa2b4('0xb')](),controller['index']);router[_0xa2b4('0xa')](_0xa2b4('0xc'),auth['isAuthenticated'](),controller[_0xa2b4('0xd')]);router[_0xa2b4('0xe')]('/',auth[_0xa2b4('0xb')](),controller[_0xa2b4('0xf')]);router[_0xa2b4('0x10')](_0xa2b4('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xa2b4('0x11')]('/:id',auth[_0xa2b4('0xb')](),controller[_0xa2b4('0x12')]);module[_0xa2b4('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 0915438..7e31ea8 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 _0x71f4=['STRING','name','#0091EA'];(function(_0x585723,_0x25250e){var _0x54edcf=function(_0x9cd647){while(--_0x9cd647){_0x585723['push'](_0x585723['shift']());}};_0x54edcf(++_0x25250e);}(_0x71f4,0xf9));var _0x471f=function(_0x1049a0,_0x5b6b5d){_0x1049a0=_0x1049a0-0x0;var _0x55839e=_0x71f4[_0x1049a0];return _0x55839e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x471f('0x0')],'unique':_0x471f('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x471f('0x0')],'defaultValue':_0x471f('0x2')},'description':{'type':Sequelize[_0x471f('0x0')]}}; \ No newline at end of file +var _0xe9e8=['name','#0091EA','sequelize','exports','STRING'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x77a4a1,_0x49f50d){_0x77a4a1=_0x77a4a1-0x0;var _0x5b06a4=_0xe9e8[_0x77a4a1];return _0x5b06a4;};'use strict';var Sequelize=require(_0x8e9e('0x0'));module[_0x8e9e('0x1')]={'name':{'type':Sequelize[_0x8e9e('0x2')],'unique':_0x8e9e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8e9e('0x2')],'defaultValue':_0x8e9e('0x4')},'description':{'type':Sequelize[_0x8e9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 70f21b3..130bc3e 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 _0x153f=['fields','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','fieldName','model','keys','query','intersection','attributes','length','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x237e36,_0x30d6ae){var _0xf89afa=function(_0x28b30a){while(--_0x28b30a){_0x237e36['push'](_0x237e36['shift']());}};_0xf89afa(++_0x30d6ae);}(_0x153f,0x15b));var _0xf153=function(_0xcc1940,_0xe586c6){_0xcc1940=_0xcc1940-0x0;var _0x4afa17=_0x153f[_0xcc1940];return _0x4afa17;};'use strict';var emlformat=require(_0xf153('0x0'));var rimraf=require(_0xf153('0x1'));var zipdir=require(_0xf153('0x2'));var jsonpatch=require(_0xf153('0x3'));var rp=require(_0xf153('0x4'));var moment=require(_0xf153('0x5'));var BPromise=require(_0xf153('0x6'));var Mustache=require('mustache');var util=require(_0xf153('0x7'));var path=require('path');var sox=require(_0xf153('0x8'));var csv=require(_0xf153('0x9'));var ejs=require(_0xf153('0xa'));var fs=require('fs');var fs_extra=require(_0xf153('0xb'));var _=require(_0xf153('0xc'));var squel=require('squel');var crypto=require(_0xf153('0xd'));var jsforce=require(_0xf153('0xe'));var deskjs=require(_0xf153('0xf'));var toCsv=require(_0xf153('0x9'));var querystring=require(_0xf153('0x10'));var Papa=require(_0xf153('0x11'));var Redis=require(_0xf153('0x12'));var authService=require(_0xf153('0x13'));var qs=require(_0xf153('0x14'));var as=require(_0xf153('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf153('0x16'))(_0xf153('0x17'));var utils=require(_0xf153('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf153('0x19'));var db=require(_0xf153('0x1a'))['db'];function respondWithStatusCode(_0x65756d,_0x1cc666){_0x1cc666=_0x1cc666||0xcc;return function(_0x256b7d){if(_0x256b7d){return _0x65756d[_0xf153('0x1b')](_0x1cc666);}return _0x65756d[_0xf153('0x1c')](_0x1cc666)[_0xf153('0x1d')]();};}function respondWithResult(_0x3e34fb,_0x4c5283){_0x4c5283=_0x4c5283||0xc8;return function(_0x18be7e){if(_0x18be7e){return _0x3e34fb[_0xf153('0x1c')](_0x4c5283)[_0xf153('0x1e')](_0x18be7e);}};}function respondWithFilteredResult(_0x406e6f,_0x3afea2){return function(_0x68f436){if(_0x68f436){var _0x273a90=typeof _0x3afea2[_0xf153('0x1f')]==='undefined'&&typeof _0x3afea2[_0xf153('0x20')]==='undefined';var _0x37093a=_0x68f436[_0xf153('0x21')];var _0x138dbe=_0x273a90?0x0:_0x3afea2[_0xf153('0x1f')];var _0x4e790d=_0x273a90?_0x68f436[_0xf153('0x21')]:_0x3afea2[_0xf153('0x1f')]+_0x3afea2[_0xf153('0x20')];var _0x14b83f;if(_0x4e790d>=_0x37093a){_0x4e790d=_0x37093a;_0x14b83f=0xc8;}else{_0x14b83f=0xce;}_0x406e6f[_0xf153('0x1c')](_0x14b83f);return _0x406e6f[_0xf153('0x22')](_0xf153('0x23'),_0x138dbe+'-'+_0x4e790d+'/'+_0x37093a)[_0xf153('0x1e')](_0x68f436);}return null;};}function patchUpdates(_0x3735a7){return function(_0x1dd340){try{jsonpatch[_0xf153('0x24')](_0x1dd340,_0x3735a7,!![]);}catch(_0x3665a2){return BPromise['reject'](_0x3665a2);}return _0x1dd340[_0xf153('0x25')]();};}function saveUpdates(_0x395f28,_0x3d3e41){return function(_0x32e759){if(_0x32e759){return _0x32e759[_0xf153('0x26')](_0x395f28)[_0xf153('0x27')](function(_0x465d88){return _0x465d88;});}return null;};}function removeEntity(_0x4376f7,_0xf67cde){return function(_0x38190c){if(_0x38190c){return _0x38190c[_0xf153('0x28')]()[_0xf153('0x27')](function(){var _0x35cfe3=_0x38190c[_0xf153('0x29')]({'plain':!![]});var _0xe490f8=_0xf153('0x2a');return db[_0xf153('0x2b')][_0xf153('0x28')]({'where':{'type':_0xe490f8,'resourceId':_0x35cfe3['id']}})[_0xf153('0x27')](function(){return _0x38190c;});})[_0xf153('0x27')](function(){_0x4376f7['status'](0xcc)[_0xf153('0x1d')]();});}};}function handleEntityNotFound(_0x3f1c6f,_0x576788){return function(_0x16cdcd){if(!_0x16cdcd){_0x3f1c6f[_0xf153('0x1b')](0x194);}return _0x16cdcd;};}function handleError(_0x4e45f9,_0x17305d){_0x17305d=_0x17305d||0x1f4;return function(_0x10295e){logger[_0xf153('0x2c')](_0x10295e[_0xf153('0x2d')]);if(_0x10295e[_0xf153('0x2e')]){delete _0x10295e[_0xf153('0x2e')];}_0x4e45f9[_0xf153('0x1c')](_0x17305d)[_0xf153('0x2f')](_0x10295e);};}exports[_0xf153('0x30')]=function(_0x8e31bf,_0x13b541){var _0x415a5f={},_0x5b5237={},_0x258fb0={'count':0x0,'rows':[]};var _0xbb3619=_[_0xf153('0x31')](db[_0xf153('0x32')]['rawAttributes'],function(_0x47b715){return{'name':_0x47b715[_0xf153('0x33')],'type':_0x47b715['type']['key']};});_0x5b5237[_0xf153('0x34')]=_['map'](_0xbb3619,_0xf153('0x2e'));_0x5b5237['query']=_[_0xf153('0x35')](_0x8e31bf[_0xf153('0x36')]);_0x5b5237['filters']=_[_0xf153('0x37')](_0x5b5237[_0xf153('0x34')],_0x5b5237[_0xf153('0x36')]);_0x415a5f[_0xf153('0x38')]=_[_0xf153('0x37')](_0x5b5237[_0xf153('0x34')],qs['fields'](_0x8e31bf[_0xf153('0x36')]['fields']));_0x415a5f[_0xf153('0x38')]=_0x415a5f[_0xf153('0x38')][_0xf153('0x39')]?_0x415a5f[_0xf153('0x38')]:_0x5b5237[_0xf153('0x34')];if(!_0x8e31bf[_0xf153('0x36')]['hasOwnProperty'](_0xf153('0x3a'))){_0x415a5f[_0xf153('0x20')]=qs[_0xf153('0x20')](_0x8e31bf['query'][_0xf153('0x20')]);_0x415a5f[_0xf153('0x1f')]=qs[_0xf153('0x1f')](_0x8e31bf[_0xf153('0x36')][_0xf153('0x1f')]);}_0x415a5f[_0xf153('0x3b')]=qs['sort'](_0x8e31bf[_0xf153('0x36')][_0xf153('0x3c')]);_0x415a5f['where']=qs[_0xf153('0x3d')](_[_0xf153('0x3e')](_0x8e31bf[_0xf153('0x36')],_0x5b5237[_0xf153('0x3d')]),_0xbb3619);if(_0x8e31bf[_0xf153('0x36')][_0xf153('0x3f')]){_0x415a5f[_0xf153('0x40')]=_['merge'](_0x415a5f[_0xf153('0x40')],{'$or':_[_0xf153('0x31')](_0xbb3619,function(_0x150ce4){if(_0x150ce4[_0xf153('0x41')]!==_0xf153('0x42')){var _0x1ee606={};_0x1ee606[_0x150ce4['name']]={'$like':'%'+_0x8e31bf['query'][_0xf153('0x3f')]+'%'};return _0x1ee606;}})});}_0x415a5f=_['merge']({},_0x415a5f,_0x8e31bf[_0xf153('0x43')]);var _0x36c456={'where':_0x415a5f[_0xf153('0x40')]};return db[_0xf153('0x32')][_0xf153('0x21')](_0x36c456)[_0xf153('0x27')](function(_0x5599e5){_0x258fb0['count']=_0x5599e5;if(_0x8e31bf[_0xf153('0x36')][_0xf153('0x44')]){_0x415a5f['include']=[{'all':!![]}];}return db[_0xf153('0x32')][_0xf153('0x45')](_0x415a5f);})[_0xf153('0x27')](function(_0x3a9cb2){_0x258fb0[_0xf153('0x46')]=_0x3a9cb2;return _0x258fb0;})[_0xf153('0x27')](respondWithFilteredResult(_0x13b541,_0x415a5f))[_0xf153('0x47')](handleError(_0x13b541,null));};exports[_0xf153('0x48')]=function(_0x1b453f,_0x2ff654){var _0xbe2df4={'raw':!![],'where':{'id':_0x1b453f['params']['id']}},_0x46e279={};_0x46e279[_0xf153('0x34')]=_[_0xf153('0x35')](db[_0xf153('0x32')]['rawAttributes']);_0x46e279[_0xf153('0x36')]=_[_0xf153('0x35')](_0x1b453f['query']);_0x46e279[_0xf153('0x3d')]=_['intersection'](_0x46e279[_0xf153('0x34')],_0x46e279[_0xf153('0x36')]);_0xbe2df4[_0xf153('0x38')]=_['intersection'](_0x46e279[_0xf153('0x34')],qs[_0xf153('0x49')](_0x1b453f[_0xf153('0x36')][_0xf153('0x49')]));_0xbe2df4[_0xf153('0x38')]=_0xbe2df4['attributes'][_0xf153('0x39')]?_0xbe2df4[_0xf153('0x38')]:_0x46e279['model'];if(_0x1b453f[_0xf153('0x36')][_0xf153('0x44')]){_0xbe2df4[_0xf153('0x4a')]=[{'all':!![]}];}_0xbe2df4=_['merge']({},_0xbe2df4,_0x1b453f[_0xf153('0x43')]);return db[_0xf153('0x32')][_0xf153('0x4b')](_0xbe2df4)[_0xf153('0x27')](handleEntityNotFound(_0x2ff654,null))[_0xf153('0x27')](respondWithResult(_0x2ff654,null))[_0xf153('0x47')](handleError(_0x2ff654,null));};exports[_0xf153('0x4c')]=function(_0x33e48,_0x3b91ed){return db['Tag'][_0xf153('0x4c')](_0x33e48['body'],{})['then'](function(_0x57af92){var _0x43e608=_0x33e48[_0xf153('0x4d')]['get']({'plain':!![]});if(!_0x43e608)throw new Error(_0xf153('0x4e'));if(_0x43e608[_0xf153('0x4f')]==='user'){var _0x3f1ecb=_0x57af92[_0xf153('0x29')]({'plain':!![]});var _0x40b097=_0xf153('0x2a');return db[_0xf153('0x50')][_0xf153('0x4b')]({'where':{'name':_0x40b097,'userProfileId':_0x43e608['userProfileId']},'raw':!![]})[_0xf153('0x27')](function(_0x13efbb){if(_0x13efbb&&_0x13efbb['autoAssociation']===0x0){return db['UserProfileResource'][_0xf153('0x4c')]({'name':_0x3f1ecb[_0xf153('0x2e')],'resourceId':_0x3f1ecb['id'],'type':_0x13efbb[_0xf153('0x2e')],'sectionId':_0x13efbb['id']},{})[_0xf153('0x27')](function(){return _0x57af92;});}else{return _0x57af92;}})[_0xf153('0x47')](function(_0x1e1c33){logger['error'](_0xf153('0x51'),_0x1e1c33);throw _0x1e1c33;});}return _0x57af92;})['then'](respondWithResult(_0x3b91ed,0xc9))[_0xf153('0x47')](handleError(_0x3b91ed,null));};exports[_0xf153('0x26')]=function(_0x454fff,_0x5cc697){if(_0x454fff[_0xf153('0x52')]['id']){delete _0x454fff[_0xf153('0x52')]['id'];}return db[_0xf153('0x32')][_0xf153('0x4b')]({'where':{'id':_0x454fff[_0xf153('0x53')]['id']}})[_0xf153('0x27')](handleEntityNotFound(_0x5cc697,null))[_0xf153('0x27')](saveUpdates(_0x454fff['body'],null))[_0xf153('0x27')](respondWithResult(_0x5cc697,null))[_0xf153('0x47')](handleError(_0x5cc697,null));};exports[_0xf153('0x28')]=function(_0x5673f5,_0x1bf770){return db[_0xf153('0x32')][_0xf153('0x4b')]({'where':{'id':_0x5673f5[_0xf153('0x53')]['id']}})[_0xf153('0x27')](handleEntityNotFound(_0x1bf770,null))[_0xf153('0x27')](removeEntity(_0x1bf770,null))[_0xf153('0x47')](handleError(_0x1bf770,null));}; \ No newline at end of file +var _0x98d3=['sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','save','update','destroy','then','Tags','UserProfileResource','stack','name','map','Tag','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','intersection','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','error','params','eml-format','rimraf','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x38500e,_0x2ebeee){var _0x558b19=function(_0x31ba0c){while(--_0x31ba0c){_0x38500e['push'](_0x38500e['shift']());}};_0x558b19(++_0x2ebeee);}(_0x98d3,0x173));var _0x398d=function(_0x5dbbca,_0x61ab68){_0x5dbbca=_0x5dbbca-0x0;var _0x2a57e5=_0x98d3[_0x5dbbca];return _0x2a57e5;};'use strict';var emlformat=require(_0x398d('0x0'));var rimraf=require(_0x398d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x398d('0x2'));var rp=require('request-promise');var moment=require(_0x398d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x398d('0x4'));var util=require(_0x398d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x398d('0x6'));var ejs=require(_0x398d('0x7'));var fs=require('fs');var fs_extra=require(_0x398d('0x8'));var _=require('lodash');var squel=require(_0x398d('0x9'));var crypto=require(_0x398d('0xa'));var jsforce=require(_0x398d('0xb'));var deskjs=require(_0x398d('0xc'));var toCsv=require(_0x398d('0x6'));var querystring=require('querystring');var Papa=require(_0x398d('0xd'));var Redis=require(_0x398d('0xe'));var authService=require(_0x398d('0xf'));var qs=require(_0x398d('0x10'));var as=require(_0x398d('0x11'));var hardwareService=require(_0x398d('0x12'));var logger=require(_0x398d('0x13'))(_0x398d('0x14'));var utils=require('../../config/utils');var config=require(_0x398d('0x15'));var licenseUtil=require(_0x398d('0x16'));var db=require(_0x398d('0x17'))['db'];function respondWithStatusCode(_0x12eb91,_0x15a424){_0x15a424=_0x15a424||0xcc;return function(_0x91619e){if(_0x91619e){return _0x12eb91[_0x398d('0x18')](_0x15a424);}return _0x12eb91[_0x398d('0x19')](_0x15a424)[_0x398d('0x1a')]();};}function respondWithResult(_0x396015,_0x1fc998){_0x1fc998=_0x1fc998||0xc8;return function(_0x537bb6){if(_0x537bb6){return _0x396015['status'](_0x1fc998)[_0x398d('0x1b')](_0x537bb6);}};}function respondWithFilteredResult(_0x36cde2,_0x347508){return function(_0x2197b4){if(_0x2197b4){var _0x278004=typeof _0x347508[_0x398d('0x1c')]===_0x398d('0x1d')&&typeof _0x347508[_0x398d('0x1e')]==='undefined';var _0x26b9a0=_0x2197b4['count'];var _0x673840=_0x278004?0x0:_0x347508[_0x398d('0x1c')];var _0x297768=_0x278004?_0x2197b4['count']:_0x347508['offset']+_0x347508['limit'];var _0x28b124;if(_0x297768>=_0x26b9a0){_0x297768=_0x26b9a0;_0x28b124=0xc8;}else{_0x28b124=0xce;}_0x36cde2[_0x398d('0x19')](_0x28b124);return _0x36cde2[_0x398d('0x1f')](_0x398d('0x20'),_0x673840+'-'+_0x297768+'/'+_0x26b9a0)[_0x398d('0x1b')](_0x2197b4);}return null;};}function patchUpdates(_0x1d9e75){return function(_0x38659b){try{jsonpatch['apply'](_0x38659b,_0x1d9e75,!![]);}catch(_0x55c98e){return BPromise['reject'](_0x55c98e);}return _0x38659b[_0x398d('0x21')]();};}function saveUpdates(_0x3b275a,_0x1ea5f9){return function(_0x2affed){if(_0x2affed){return _0x2affed[_0x398d('0x22')](_0x3b275a)['then'](function(_0x5c4c70){return _0x5c4c70;});}return null;};}function removeEntity(_0x31e87d,_0x497ad1){return function(_0x55a48d){if(_0x55a48d){return _0x55a48d[_0x398d('0x23')]()[_0x398d('0x24')](function(){var _0x5ae3b4=_0x55a48d['get']({'plain':!![]});var _0x4aad76=_0x398d('0x25');return db[_0x398d('0x26')][_0x398d('0x23')]({'where':{'type':_0x4aad76,'resourceId':_0x5ae3b4['id']}})[_0x398d('0x24')](function(){return _0x55a48d;});})[_0x398d('0x24')](function(){_0x31e87d[_0x398d('0x19')](0xcc)[_0x398d('0x1a')]();});}};}function handleEntityNotFound(_0x17318c,_0x4f4466){return function(_0x35bd19){if(!_0x35bd19){_0x17318c['sendStatus'](0x194);}return _0x35bd19;};}function handleError(_0x4aa568,_0x124bc9){_0x124bc9=_0x124bc9||0x1f4;return function(_0x27bc6e){logger['error'](_0x27bc6e[_0x398d('0x27')]);if(_0x27bc6e['name']){delete _0x27bc6e[_0x398d('0x28')];}_0x4aa568[_0x398d('0x19')](_0x124bc9)['send'](_0x27bc6e);};}exports['index']=function(_0x410db2,_0x2ca780){var _0x4abab6={},_0x397f07={},_0x2fbcce={'count':0x0,'rows':[]};var _0x204b27=_[_0x398d('0x29')](db[_0x398d('0x2a')][_0x398d('0x2b')],function(_0x490bee){return{'name':_0x490bee['fieldName'],'type':_0x490bee[_0x398d('0x2c')][_0x398d('0x2d')]};});_0x397f07[_0x398d('0x2e')]=_[_0x398d('0x29')](_0x204b27,_0x398d('0x28'));_0x397f07[_0x398d('0x2f')]=_[_0x398d('0x30')](_0x410db2[_0x398d('0x2f')]);_0x397f07[_0x398d('0x31')]=_['intersection'](_0x397f07[_0x398d('0x2e')],_0x397f07[_0x398d('0x2f')]);_0x4abab6[_0x398d('0x32')]=_['intersection'](_0x397f07['model'],qs[_0x398d('0x33')](_0x410db2[_0x398d('0x2f')][_0x398d('0x33')]));_0x4abab6[_0x398d('0x32')]=_0x4abab6[_0x398d('0x32')][_0x398d('0x34')]?_0x4abab6[_0x398d('0x32')]:_0x397f07[_0x398d('0x2e')];if(!_0x410db2[_0x398d('0x2f')][_0x398d('0x35')](_0x398d('0x36'))){_0x4abab6[_0x398d('0x1e')]=qs[_0x398d('0x1e')](_0x410db2[_0x398d('0x2f')][_0x398d('0x1e')]);_0x4abab6[_0x398d('0x1c')]=qs[_0x398d('0x1c')](_0x410db2[_0x398d('0x2f')][_0x398d('0x1c')]);}_0x4abab6['order']=qs[_0x398d('0x37')](_0x410db2[_0x398d('0x2f')][_0x398d('0x37')]);_0x4abab6[_0x398d('0x38')]=qs[_0x398d('0x31')](_[_0x398d('0x39')](_0x410db2[_0x398d('0x2f')],_0x397f07['filters']),_0x204b27);if(_0x410db2[_0x398d('0x2f')][_0x398d('0x3a')]){_0x4abab6[_0x398d('0x38')]=_[_0x398d('0x3b')](_0x4abab6[_0x398d('0x38')],{'$or':_[_0x398d('0x29')](_0x204b27,function(_0x4d57cc){if(_0x4d57cc[_0x398d('0x2c')]!=='VIRTUAL'){var _0x208eb2={};_0x208eb2[_0x4d57cc[_0x398d('0x28')]]={'$like':'%'+_0x410db2[_0x398d('0x2f')][_0x398d('0x3a')]+'%'};return _0x208eb2;}})});}_0x4abab6=_[_0x398d('0x3b')]({},_0x4abab6,_0x410db2['options']);var _0xa20d77={'where':_0x4abab6[_0x398d('0x38')]};return db['Tag'][_0x398d('0x3c')](_0xa20d77)[_0x398d('0x24')](function(_0x3d72ee){_0x2fbcce[_0x398d('0x3c')]=_0x3d72ee;if(_0x410db2[_0x398d('0x2f')][_0x398d('0x3d')]){_0x4abab6[_0x398d('0x3e')]=[{'all':!![]}];}return db[_0x398d('0x2a')][_0x398d('0x3f')](_0x4abab6);})['then'](function(_0x2760f2){_0x2fbcce[_0x398d('0x40')]=_0x2760f2;return _0x2fbcce;})[_0x398d('0x24')](respondWithFilteredResult(_0x2ca780,_0x4abab6))[_0x398d('0x41')](handleError(_0x2ca780,null));};exports[_0x398d('0x42')]=function(_0x227984,_0x505b78){var _0x26b0c6={'raw':!![],'where':{'id':_0x227984['params']['id']}},_0x1a6bdc={};_0x1a6bdc[_0x398d('0x2e')]=_[_0x398d('0x30')](db[_0x398d('0x2a')]['rawAttributes']);_0x1a6bdc[_0x398d('0x2f')]=_[_0x398d('0x30')](_0x227984[_0x398d('0x2f')]);_0x1a6bdc[_0x398d('0x31')]=_[_0x398d('0x43')](_0x1a6bdc['model'],_0x1a6bdc[_0x398d('0x2f')]);_0x26b0c6[_0x398d('0x32')]=_[_0x398d('0x43')](_0x1a6bdc['model'],qs[_0x398d('0x33')](_0x227984[_0x398d('0x2f')]['fields']));_0x26b0c6[_0x398d('0x32')]=_0x26b0c6[_0x398d('0x32')][_0x398d('0x34')]?_0x26b0c6[_0x398d('0x32')]:_0x1a6bdc[_0x398d('0x2e')];if(_0x227984[_0x398d('0x2f')][_0x398d('0x3d')]){_0x26b0c6[_0x398d('0x3e')]=[{'all':!![]}];}_0x26b0c6=_['merge']({},_0x26b0c6,_0x227984[_0x398d('0x44')]);return db[_0x398d('0x2a')]['find'](_0x26b0c6)['then'](handleEntityNotFound(_0x505b78,null))[_0x398d('0x24')](respondWithResult(_0x505b78,null))[_0x398d('0x41')](handleError(_0x505b78,null));};exports[_0x398d('0x45')]=function(_0x35d260,_0x49a6de){return db[_0x398d('0x2a')]['create'](_0x35d260[_0x398d('0x46')],{})['then'](function(_0x3c27a1){var _0x588548=_0x35d260['user']['get']({'plain':!![]});if(!_0x588548)throw new Error(_0x398d('0x47'));if(_0x588548[_0x398d('0x48')]===_0x398d('0x49')){var _0x3fa030=_0x3c27a1['get']({'plain':!![]});var _0x5d864a=_0x398d('0x25');return db[_0x398d('0x4a')][_0x398d('0x4b')]({'where':{'name':_0x5d864a,'userProfileId':_0x588548['userProfileId']},'raw':!![]})[_0x398d('0x24')](function(_0x2fcb61){if(_0x2fcb61&&_0x2fcb61[_0x398d('0x4c')]===0x0){return db[_0x398d('0x26')][_0x398d('0x45')]({'name':_0x3fa030[_0x398d('0x28')],'resourceId':_0x3fa030['id'],'type':_0x2fcb61['name'],'sectionId':_0x2fcb61['id']},{})[_0x398d('0x24')](function(){return _0x3c27a1;});}else{return _0x3c27a1;}})[_0x398d('0x41')](function(_0x453bf5){logger[_0x398d('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x453bf5);throw _0x453bf5;});}return _0x3c27a1;})[_0x398d('0x24')](respondWithResult(_0x49a6de,0xc9))[_0x398d('0x41')](handleError(_0x49a6de,null));};exports[_0x398d('0x22')]=function(_0x3ec128,_0x536fd1){if(_0x3ec128['body']['id']){delete _0x3ec128[_0x398d('0x46')]['id'];}return db['Tag'][_0x398d('0x4b')]({'where':{'id':_0x3ec128[_0x398d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x536fd1,null))[_0x398d('0x24')](saveUpdates(_0x3ec128['body'],null))[_0x398d('0x24')](respondWithResult(_0x536fd1,null))[_0x398d('0x41')](handleError(_0x536fd1,null));};exports[_0x398d('0x23')]=function(_0x1c4c38,_0x360e67){return db[_0x398d('0x2a')][_0x398d('0x4b')]({'where':{'id':_0x1c4c38[_0x398d('0x4e')]['id']}})[_0x398d('0x24')](handleEntityNotFound(_0x360e67,null))[_0x398d('0x24')](removeEntity(_0x360e67,null))[_0x398d('0x41')](handleError(_0x360e67,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index ab93614..9e33fed 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 _0x45fc=['tools_tags','util','moment','request-promise','rimraf','../../config/environment','exports','define','Tag'];(function(_0x5ae8f7,_0x330d91){var _0x54c636=function(_0x173188){while(--_0x173188){_0x5ae8f7['push'](_0x5ae8f7['shift']());}};_0x54c636(++_0x330d91);}(_0x45fc,0x14e));var _0xc45f=function(_0x4b7874,_0xe683e){_0x4b7874=_0x4b7874-0x0;var _0x1b54bc=_0x45fc[_0x4b7874];return _0x1b54bc;};'use strict';var _=require('lodash');var util=require(_0xc45f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc45f('0x1'));var BPromise=require('bluebird');var rp=require(_0xc45f('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc45f('0x3'));var config=require(_0xc45f('0x4'));var attributes=require('./tag.attributes');module[_0xc45f('0x5')]=function(_0x56d986,_0x402262){return _0x56d986[_0xc45f('0x6')](_0xc45f('0x7'),attributes,{'tableName':_0xc45f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43fe=['path','rimraf','../../config/environment','./tag.attributes','define','tools_tags','lodash','../../config/logger','api','moment','request-promise'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x43fe,0x17c));var _0xe43f=function(_0x1235fd,_0x50bedc){_0x1235fd=_0x1235fd-0x0;var _0x4c33b0=_0x43fe[_0x1235fd];return _0x4c33b0;};'use strict';var _=require(_0xe43f('0x0'));var util=require('util');var logger=require(_0xe43f('0x1'))(_0xe43f('0x2'));var moment=require(_0xe43f('0x3'));var BPromise=require('bluebird');var rp=require(_0xe43f('0x4'));var fs=require('fs');var path=require(_0xe43f('0x5'));var rimraf=require(_0xe43f('0x6'));var config=require(_0xe43f('0x7'));var attributes=require(_0xe43f('0x8'));module['exports']=function(_0x1cb318,_0x326c94){return _0x1cb318[_0xe43f('0x9')]('Tag',attributes,{'tableName':_0xe43f('0xa'),'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 3e59963..9711761 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 _0xeec6=['then','info','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xeec6,0x1c2));var _0x6eec=function(_0x35ef6b,_0x202c42){_0x35ef6b=_0x35ef6b-0x0;var _0x3ad145=_0xeec6[_0x35ef6b];return _0x3ad145;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){return client['request'](_0x48064a,_0x1c810e)[_0x6eec('0xc')](function(_0x3aca38){logger[_0x6eec('0xd')]('Tag,\x20%s,\x20%s',_0x5a5e47,'request\x20sent');logger['debug'](_0x6eec('0xe'),_0x5a5e47,_0x6eec('0xf'),JSON['stringify'](_0x3aca38));if(_0x3aca38['error']){if(_0x3aca38[_0x6eec('0x10')]['code']===0x1f4){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x834c2(_0x3aca38[_0x6eec('0x10')]['message']);}logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x3443c2(_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);}else{logger[_0x6eec('0xd')](_0x6eec('0x11'),_0x5a5e47,_0x6eec('0xf'));_0x3443c2(_0x3aca38[_0x6eec('0x13')]['message']);}})[_0x6eec('0x14')](function(_0x5f1f33){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x5f1f33);_0x834c2(_0x5f1f33);});});} \ No newline at end of file +var _0x495e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x39f879,_0x319e9f){var _0x3c28a2=function(_0x26a8d4){while(--_0x26a8d4){_0x39f879['push'](_0x39f879['shift']());}};_0x3c28a2(++_0x319e9f);}(_0x495e,0xfb));var _0xe495=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0x495e[_0x3e8cae];return _0x45c4d6;};'use strict';var _=require(_0xe495('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe495('0x1'));var rs=require(_0xe495('0x2'));var fs=require('fs');var Redis=require(_0xe495('0x3'));var db=require(_0xe495('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe495('0x5'))(_0xe495('0x6'));var config=require(_0xe495('0x7'));var jayson=require(_0xe495('0x8'));var client=jayson[_0xe495('0x9')][_0xe495('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x101a7e,_0x5745e3,_0x599ab4){return new BPromise(function(_0x5c17d0,_0x16f146){return client['request'](_0x101a7e,_0x599ab4)[_0xe495('0xb')](function(_0x3a9a00){logger[_0xe495('0xc')](_0xe495('0xd'),_0x5745e3,_0xe495('0xe'));logger['debug'](_0xe495('0xf'),_0x5745e3,_0xe495('0xe'),JSON[_0xe495('0x10')](_0x3a9a00));if(_0x3a9a00['error']){if(_0x3a9a00[_0xe495('0x11')][_0xe495('0x12')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x5745e3,_0x3a9a00[_0xe495('0x11')][_0xe495('0x13')]);return _0x16f146(_0x3a9a00['error'][_0xe495('0x13')]);}logger[_0xe495('0x11')](_0xe495('0xd'),_0x5745e3,_0x3a9a00[_0xe495('0x11')][_0xe495('0x13')]);return _0x5c17d0(_0x3a9a00['error'][_0xe495('0x13')]);}else{logger[_0xe495('0xc')](_0xe495('0xd'),_0x5745e3,_0xe495('0xe'));_0x5c17d0(_0x3a9a00[_0xe495('0x14')]['message']);}})['catch'](function(_0x4de730){logger[_0xe495('0x11')](_0xe495('0xd'),_0x5745e3,_0x4de730);_0x16f146(_0x4de730);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 2e8d1ac..d5d006a 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(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 8bbc44a..91153f2 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 _0xb7e7=['STRING','sequelize'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xb7e7[_0x4b7b62];return _0x2280df;};'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 +var _0x2032=['name','exports','STRING'];(function(_0x360f6e,_0x579caf){var _0x3b70d5=function(_0x2ec5e2){while(--_0x2ec5e2){_0x360f6e['push'](_0x360f6e['shift']());}};_0x3b70d5(++_0x579caf);}(_0x2032,0xd9));var _0x2203=function(_0x5d474b,_0x78261b){_0x5d474b=_0x5d474b-0x0;var _0x33cf13=_0x2032[_0x5d474b];return _0x33cf13;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 58d36b0..d1425b6 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 _0x958d=['../../mysqldb','defaults','socket.io-emitter','redis','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','error','stack','name','send','Team','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','VIRTUAL','merge','where','then','includeAll','include','rows','params','keys','options','catch','create','body','user','get','role','Teams','UserProfileSection','find','autoAssociation','UserProfileResource','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','destroy','MailQueueId','UserMailQueue','UserSmsQueue','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','sendStatus','getQueues','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','ids','remove','addAgents','isArray','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','Voice','through','penalty','QueueId','User','emit','findAll','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','TeamVoiceQueue','all','spread','removeAgents','getAgents','hasOwnProperty','eml-format','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0x958d,0x7d));var _0xd958=function(_0x2beb24,_0x8818fa){_0x2beb24=_0x2beb24-0x0;var _0x6f2a38=_0x958d[_0x2beb24];return _0x6f2a38;};'use strict';var emlformat=require(_0xd958('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd958('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd958('0x2'));var moment=require('moment');var BPromise=require(_0xd958('0x3'));var Mustache=require('mustache');var util=require(_0xd958('0x4'));var path=require('path');var sox=require(_0xd958('0x5'));var csv=require(_0xd958('0x6'));var ejs=require(_0xd958('0x7'));var fs=require('fs');var fs_extra=require(_0xd958('0x8'));var _=require(_0xd958('0x9'));var squel=require(_0xd958('0xa'));var crypto=require(_0xd958('0xb'));var jsforce=require(_0xd958('0xc'));var deskjs=require(_0xd958('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd958('0xe'));var Papa=require('papaparse');var Redis=require(_0xd958('0xf'));var authService=require(_0xd958('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd958('0x11'));var hardwareService=require(_0xd958('0x12'));var logger=require(_0xd958('0x13'))(_0xd958('0x14'));var utils=require(_0xd958('0x15'));var config=require(_0xd958('0x16'));var licenseUtil=require(_0xd958('0x17'));var db=require(_0xd958('0x18'))['db'];config['redis']=_[_0xd958('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd958('0x1a'))(new Redis(config[_0xd958('0x1b')]));require('./team.socket')[_0xd958('0x1c')](socket);function respondWithStatusCode(_0x372a1d,_0xc8f41d){_0xc8f41d=_0xc8f41d||0xcc;return function(_0x5f25e6){if(_0x5f25e6){return _0x372a1d['sendStatus'](_0xc8f41d);}return _0x372a1d[_0xd958('0x1d')](_0xc8f41d)[_0xd958('0x1e')]();};}function respondWithResult(_0x589fa4,_0x59fa7b){_0x59fa7b=_0x59fa7b||0xc8;return function(_0x83d136){if(_0x83d136){return _0x589fa4[_0xd958('0x1d')](_0x59fa7b)[_0xd958('0x1f')](_0x83d136);}};}function respondWithFilteredResult(_0x30c1c4,_0x4e171e){return function(_0x1d3c56){if(_0x1d3c56){var _0x5653de=typeof _0x4e171e[_0xd958('0x20')]===_0xd958('0x21')&&typeof _0x4e171e[_0xd958('0x22')]===_0xd958('0x21');var _0x1de21e=_0x1d3c56[_0xd958('0x23')];var _0x31f065=_0x5653de?0x0:_0x4e171e['offset'];var _0x47defb=_0x5653de?_0x1d3c56['count']:_0x4e171e[_0xd958('0x20')]+_0x4e171e[_0xd958('0x22')];var _0x57851a;if(_0x47defb>=_0x1de21e){_0x47defb=_0x1de21e;_0x57851a=0xc8;}else{_0x57851a=0xce;}_0x30c1c4[_0xd958('0x1d')](_0x57851a);return _0x30c1c4['set'](_0xd958('0x24'),_0x31f065+'-'+_0x47defb+'/'+_0x1de21e)[_0xd958('0x1f')](_0x1d3c56);}return null;};}function patchUpdates(_0x28beba){return function(_0x29383a){try{jsonpatch[_0xd958('0x25')](_0x29383a,_0x28beba,!![]);}catch(_0x440bf2){return BPromise[_0xd958('0x26')](_0x440bf2);}return _0x29383a['save']();};}function saveUpdates(_0x3f4c3b,_0x162a25){return function(_0x1c7fc4){if(_0x1c7fc4){return _0x1c7fc4[_0xd958('0x27')](_0x3f4c3b)['then'](function(_0x3f31b1){return _0x3f31b1;});}return null;};}function handleEntityNotFound(_0x3d760e,_0x52c1da){return function(_0x527ba5){if(!_0x527ba5){_0x3d760e['sendStatus'](0x194);}return _0x527ba5;};}function handleError(_0x55e0e4,_0x2cce3b){_0x2cce3b=_0x2cce3b||0x1f4;return function(_0x2095af){logger[_0xd958('0x28')](_0x2095af[_0xd958('0x29')]);if(_0x2095af['name']){delete _0x2095af[_0xd958('0x2a')];}_0x55e0e4[_0xd958('0x1d')](_0x2cce3b)[_0xd958('0x2b')](_0x2095af);};}exports['index']=function(_0x1cb126,_0x4a73b4){var _0x383b30={},_0x5dfee6={},_0x265e41={'count':0x0,'rows':[]};var _0x31bdd0=_['map'](db[_0xd958('0x2c')][_0xd958('0x2d')],function(_0x327d0b){return{'name':_0x327d0b[_0xd958('0x2e')],'type':_0x327d0b['type'][_0xd958('0x2f')]};});_0x5dfee6[_0xd958('0x30')]=_[_0xd958('0x31')](_0x31bdd0,_0xd958('0x2a'));_0x5dfee6[_0xd958('0x32')]=_['keys'](_0x1cb126[_0xd958('0x32')]);_0x5dfee6['filters']=_[_0xd958('0x33')](_0x5dfee6[_0xd958('0x30')],_0x5dfee6['query']);_0x383b30[_0xd958('0x34')]=_[_0xd958('0x33')](_0x5dfee6[_0xd958('0x30')],qs['fields'](_0x1cb126[_0xd958('0x32')][_0xd958('0x35')]));_0x383b30[_0xd958('0x34')]=_0x383b30['attributes'][_0xd958('0x36')]?_0x383b30[_0xd958('0x34')]:_0x5dfee6[_0xd958('0x30')];if(!_0x1cb126[_0xd958('0x32')]['hasOwnProperty'](_0xd958('0x37'))){_0x383b30['limit']=qs[_0xd958('0x22')](_0x1cb126['query']['limit']);_0x383b30['offset']=qs[_0xd958('0x20')](_0x1cb126[_0xd958('0x32')]['offset']);}_0x383b30[_0xd958('0x38')]=qs[_0xd958('0x39')](_0x1cb126[_0xd958('0x32')][_0xd958('0x39')]);_0x383b30['where']=qs[_0xd958('0x3a')](_[_0xd958('0x3b')](_0x1cb126[_0xd958('0x32')],_0x5dfee6[_0xd958('0x3a')]),_0x31bdd0);if(_0x1cb126[_0xd958('0x32')][_0xd958('0x3c')]){_0x383b30['where']=_['merge'](_0x383b30['where'],{'$or':_[_0xd958('0x31')](_0x31bdd0,function(_0x5acea6){if(_0x5acea6['type']!==_0xd958('0x3d')){var _0x20530a={};_0x20530a[_0x5acea6[_0xd958('0x2a')]]={'$like':'%'+_0x1cb126[_0xd958('0x32')][_0xd958('0x3c')]+'%'};return _0x20530a;}})});}_0x383b30=_[_0xd958('0x3e')]({},_0x383b30,_0x1cb126['options']);var _0x18da89={'where':_0x383b30[_0xd958('0x3f')]};return db[_0xd958('0x2c')][_0xd958('0x23')](_0x18da89)[_0xd958('0x40')](function(_0x2949f4){_0x265e41[_0xd958('0x23')]=_0x2949f4;if(_0x1cb126['query'][_0xd958('0x41')]){_0x383b30[_0xd958('0x42')]=[{'all':!![]}];}return db[_0xd958('0x2c')]['findAll'](_0x383b30);})['then'](function(_0x474afb){_0x265e41[_0xd958('0x43')]=_0x474afb;return _0x265e41;})[_0xd958('0x40')](respondWithFilteredResult(_0x4a73b4,_0x383b30))['catch'](handleError(_0x4a73b4,null));};exports['show']=function(_0x563d46,_0x28dfa8){var _0x97b19a={'raw':![],'where':{'id':_0x563d46[_0xd958('0x44')]['id']}},_0x3313dd={};_0x3313dd[_0xd958('0x30')]=_[_0xd958('0x45')](db['Team']['rawAttributes']);_0x3313dd[_0xd958('0x32')]=_['keys'](_0x563d46[_0xd958('0x32')]);_0x3313dd['filters']=_[_0xd958('0x33')](_0x3313dd['model'],_0x3313dd[_0xd958('0x32')]);_0x97b19a[_0xd958('0x34')]=_['intersection'](_0x3313dd[_0xd958('0x30')],qs[_0xd958('0x35')](_0x563d46[_0xd958('0x32')][_0xd958('0x35')]));_0x97b19a[_0xd958('0x34')]=_0x97b19a[_0xd958('0x34')][_0xd958('0x36')]?_0x97b19a[_0xd958('0x34')]:_0x3313dd[_0xd958('0x30')];if(_0x563d46[_0xd958('0x32')][_0xd958('0x41')]){_0x97b19a['include']=[{'all':!![]}];}_0x97b19a=_[_0xd958('0x3e')]({},_0x97b19a,_0x563d46[_0xd958('0x46')]);return db[_0xd958('0x2c')]['find'](_0x97b19a)[_0xd958('0x40')](handleEntityNotFound(_0x28dfa8,null))['then'](respondWithResult(_0x28dfa8,null))[_0xd958('0x47')](handleError(_0x28dfa8,null));};exports[_0xd958('0x48')]=function(_0x5e4693,_0x5eb486){return db[_0xd958('0x2c')][_0xd958('0x48')](_0x5e4693[_0xd958('0x49')],{})['then'](function(_0x389930){var _0x141f05=_0x5e4693[_0xd958('0x4a')][_0xd958('0x4b')]({'plain':!![]});if(!_0x141f05)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x141f05[_0xd958('0x4c')]===_0xd958('0x4a')){var _0x563c0b=_0x389930['get']({'plain':!![]});var _0x30b66e=_0xd958('0x4d');return db[_0xd958('0x4e')][_0xd958('0x4f')]({'where':{'name':_0x30b66e,'userProfileId':_0x141f05['userProfileId']},'raw':!![]})[_0xd958('0x40')](function(_0x298632){if(_0x298632&&_0x298632[_0xd958('0x50')]===0x0){return db[_0xd958('0x51')][_0xd958('0x48')]({'name':_0x563c0b[_0xd958('0x2a')],'resourceId':_0x563c0b['id'],'type':_0x298632[_0xd958('0x2a')],'sectionId':_0x298632['id']},{})['then'](function(){return _0x389930;});}else{return _0x389930;}})[_0xd958('0x47')](function(_0x46a123){logger[_0xd958('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46a123);throw _0x46a123;});}return _0x389930;})[_0xd958('0x40')](respondWithResult(_0x5eb486,0xc9))[_0xd958('0x47')](handleError(_0x5eb486,null));};exports['update']=function(_0x14f650,_0x5374bc){if(_0x14f650[_0xd958('0x49')]['id']){delete _0x14f650[_0xd958('0x49')]['id'];}return db[_0xd958('0x2c')]['find']({'where':{'id':_0x14f650[_0xd958('0x44')]['id']}})[_0xd958('0x40')](handleEntityNotFound(_0x5374bc,null))[_0xd958('0x40')](saveUpdates(_0x14f650[_0xd958('0x49')],null))['then'](respondWithResult(_0x5374bc,null))[_0xd958('0x47')](handleError(_0x5374bc,null));};exports['destroy']=function(_0x4bec38,_0x43996c){var _0x1a34c1=_0x4bec38[_0xd958('0x44')]['id'];var _0x381d3f=[];return db[_0xd958('0x52')][_0xd958('0x53')](function(_0x1e1383){var _0x5f222c=_0xd958('0x54')+_0x1a34c1;return db[_0xd958('0x52')][_0xd958('0x32')](_0x5f222c,{'type':db[_0xd958('0x55')][_0xd958('0x56')]['SELECT'],'raw':!![],'transaction':_0x1e1383})['then'](function(_0x10a543){_0x381d3f=_['map'](_0x10a543,function(_0x397ab6){return Number(_0x397ab6['UserId']);});})[_0xd958('0x40')](function(){var _0x3f5aae=_0xd958('0x57')+_0x1a34c1;return db['sequelize'][_0xd958('0x32')](_0x3f5aae,{'type':db[_0xd958('0x55')][_0xd958('0x56')][_0xd958('0x58')],'raw':!![],'transaction':_0x1e1383});})['then'](function(_0x4ca369){var _0x5526ff=_[_0xd958('0x31')](_0x4ca369,function(_0x1c1d1f){return Number(_0x1c1d1f[_0xd958('0x59')]);});return db[_0xd958('0x5a')][_0xd958('0x5b')]({'where':{'UserId':{'$in':_0x381d3f},'VoiceQueueId':{'$in':_0x5526ff}},'transaction':_0x1e1383});})[_0xd958('0x40')](function(){var _0x31756d='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1a34c1;return db['sequelize'][_0xd958('0x32')](_0x31756d,{'type':db[_0xd958('0x55')]['QueryTypes'][_0xd958('0x58')],'raw':!![],'transaction':_0x1e1383});})['then'](function(_0x59941b){var _0xa2e6f5=_['map'](_0x59941b,function(_0x1e0cf0){return Number(_0x1e0cf0[_0xd958('0x5c')]);});return db[_0xd958('0x5d')][_0xd958('0x5b')]({'where':{'UserId':{'$in':_0x381d3f},'MailQueueId':{'$in':_0xa2e6f5}},'transaction':_0x1e1383});})['then'](function(){var _0x329318='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1a34c1;return db[_0xd958('0x52')][_0xd958('0x32')](_0x329318,{'type':db[_0xd958('0x55')][_0xd958('0x56')][_0xd958('0x58')],'raw':!![],'transaction':_0x1e1383});})[_0xd958('0x40')](function(_0x54c415){var _0x470b29=_[_0xd958('0x31')](_0x54c415,function(_0x4ddf16){return Number(_0x4ddf16['SmsQueueId']);});return db[_0xd958('0x5e')][_0xd958('0x5b')]({'where':{'UserId':{'$in':_0x381d3f},'SmsQueueId':{'$in':_0x470b29}},'transaction':_0x1e1383});})[_0xd958('0x40')](function(){var _0x56fe17='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1a34c1;return db[_0xd958('0x52')][_0xd958('0x32')](_0x56fe17,{'type':db[_0xd958('0x55')][_0xd958('0x56')][_0xd958('0x58')],'raw':!![],'transaction':_0x1e1383});})['then'](function(_0x591097){var _0x5c70f3=_['map'](_0x591097,function(_0x50bf54){return Number(_0x50bf54['ChatQueueId']);});return db[_0xd958('0x5f')][_0xd958('0x5b')]({'where':{'UserId':{'$in':_0x381d3f},'ChatQueueId':{'$in':_0x5c70f3}},'transaction':_0x1e1383});})['then'](function(){var _0x27b29c=_0xd958('0x60')+_0x1a34c1;return db[_0xd958('0x52')]['query'](_0x27b29c,{'type':db[_0xd958('0x55')][_0xd958('0x56')]['SELECT'],'raw':!![],'transaction':_0x1e1383});})[_0xd958('0x40')](function(_0x54b4e2){var _0x3ebd8a=_[_0xd958('0x31')](_0x54b4e2,function(_0x19c09b){return Number(_0x19c09b[_0xd958('0x61')]);});return db[_0xd958('0x62')][_0xd958('0x5b')]({'where':{'UserId':{'$in':_0x381d3f},'FaxQueueId':{'$in':_0x3ebd8a}},'transaction':_0x1e1383});})[_0xd958('0x40')](function(){var _0x928d98=_0xd958('0x63')+_0x1a34c1;return db['sequelize'][_0xd958('0x32')](_0x928d98,{'type':db[_0xd958('0x55')][_0xd958('0x56')][_0xd958('0x58')],'raw':!![],'transaction':_0x1e1383});})['then'](function(_0x1e9109){var _0x5110b2=_[_0xd958('0x31')](_0x1e9109,function(_0x3ada01){return Number(_0x3ada01['OpenchannelQueueId']);});return db[_0xd958('0x64')][_0xd958('0x5b')]({'where':{'UserId':{'$in':_0x381d3f},'OpenchannelQueueId':{'$in':_0x5110b2}},'transaction':_0x1e1383});})[_0xd958('0x40')](function(){var _0x18ca7a=_0xd958('0x65')+_0x1a34c1;return db['sequelize'][_0xd958('0x32')](_0x18ca7a,{'type':db[_0xd958('0x55')][_0xd958('0x56')]['SELECT'],'raw':!![],'transaction':_0x1e1383});})['then'](function(_0x320a4b){var _0x420d0a=_[_0xd958('0x31')](_0x320a4b,function(_0x3b439d){return Number(_0x3b439d[_0xd958('0x66')]);});return db[_0xd958('0x67')][_0xd958('0x5b')]({'where':{'UserId':{'$in':_0x381d3f},'WhatsappQueueId':{'$in':_0x420d0a}},'transaction':_0x1e1383});})[_0xd958('0x40')](function(){return db[_0xd958('0x68')][_0xd958('0x4f')]({'where':{'TeamId':_0x1a34c1}});})[_0xd958('0x40')](function(_0xd5538d){if(_0xd5538d===null){return;}return db[_0xd958('0x69')]['destroy']({'where':{'UserId':{'$in':_0x381d3f},'VoicePrefixId':_0xd5538d['VoicePrefixId']},'transaction':_0x1e1383});})[_0xd958('0x40')](function(){return db[_0xd958('0x2c')][_0xd958('0x5b')]({'where':{'id':_0x1a34c1},'cascade':!![],'transaction':_0x1e1383});})[_0xd958('0x40')](function(_0x32f2d4){if(_0x32f2d4===0x0){_0x43996c[_0xd958('0x6a')](0x194);}else{return db[_0xd958('0x51')][_0xd958('0x5b')]({'where':{'type':_0xd958('0x4d'),'resourceId':_0x1a34c1},'cascade':!![],'transaction':_0x1e1383})[_0xd958('0x40')](function(){_0x43996c['status'](0xcc)[_0xd958('0x1e')]();});}})[_0xd958('0x47')](function(_0x378ded){_0x43996c[_0xd958('0x1d')](0x1f4)[_0xd958('0x2b')](_0x378ded);});});};exports[_0xd958('0x6b')]=function(_0x65b22c,_0xc7c18e,_0x49092e){return db[_0xd958('0x2c')][_0xd958('0x6c')]({'where':{'id':_0x65b22c[_0xd958('0x44')]['id']}})[_0xd958('0x40')](handleEntityNotFound(_0xc7c18e,null))['then'](function(_0x3360b0){if(!_0x65b22c[_0xd958('0x32')]['channel']||!utils[_0xd958('0x6d')](_0x65b22c['query'][_0xd958('0x6e')])){throw new db[(_0xd958('0x55'))][(_0xd958('0x6f'))](_0xd958('0x70'));}var _0x493803={};var _0x1b5d31={};_0x1b5d31['model']=_[_0xd958('0x45')](db[_[_0xd958('0x71')](_0x65b22c[_0xd958('0x32')][_0xd958('0x6e')][_0xd958('0x72')]())+_0xd958('0x73')]['rawAttributes']);_0x1b5d31[_0xd958('0x32')]=_[_0xd958('0x45')](_0x65b22c['query']);_0x1b5d31['filters']=_[_0xd958('0x33')](_0x1b5d31['model'],_0x1b5d31['query']);_0x493803[_0xd958('0x34')]=_[_0xd958('0x33')](_0x1b5d31[_0xd958('0x30')],qs['fields'](_0x65b22c[_0xd958('0x32')][_0xd958('0x35')]));_0x493803[_0xd958('0x34')]=_0x493803[_0xd958('0x34')][_0xd958('0x36')]?_0x493803[_0xd958('0x34')]:_0x1b5d31[_0xd958('0x30')];_0x493803['limit']=qs[_0xd958('0x22')](_0x65b22c[_0xd958('0x32')][_0xd958('0x22')]);_0x493803['offset']=qs['offset'](_0x65b22c[_0xd958('0x32')][_0xd958('0x20')]);_0x493803[_0xd958('0x38')]=qs[_0xd958('0x39')](_0x65b22c[_0xd958('0x32')][_0xd958('0x39')]);_0x493803['where']=qs[_0xd958('0x3a')](_[_0xd958('0x3b')](_0x65b22c[_0xd958('0x32')],_0x1b5d31[_0xd958('0x3a')]));_0x493803=_[_0xd958('0x3e')]({},_0x493803,_0x65b22c[_0xd958('0x46')]);return _0x3360b0[_0xd958('0x4b')+_[_0xd958('0x71')](_0x65b22c['query'][_0xd958('0x6e')][_0xd958('0x72')]())+_0xd958('0x74')](_0x493803);})[_0xd958('0x40')](respondWithResult(_0xc7c18e,null))[_0xd958('0x47')](handleError(_0xc7c18e,null));};exports[_0xd958('0x75')]=function(_0xa7b6c4,_0x43bac4,_0x4dfd4e){return db[_0xd958('0x2c')][_0xd958('0x6c')]({'where':{'id':_0xa7b6c4[_0xd958('0x44')]['id']}})[_0xd958('0x40')](function(_0x42f86c){if(_0x42f86c){if(!_0xa7b6c4[_0xd958('0x49')][_0xd958('0x6e')]||!utils[_0xd958('0x6d')](_0xa7b6c4[_0xd958('0x49')][_0xd958('0x6e')])){throw new db[(_0xd958('0x55'))][(_0xd958('0x6f'))](_0xd958('0x70'));}return _0x42f86c['add'+_['capitalize'](_0xa7b6c4[_0xd958('0x49')][_0xd958('0x6e')][_0xd958('0x72')]())+_0xd958('0x74')](_0xa7b6c4[_0xd958('0x49')][_0xd958('0x76')]);}return null;})[_0xd958('0x40')](handleEntityNotFound(_0x43bac4,null))[_0xd958('0x40')](respondWithStatusCode(_0x43bac4,null))[_0xd958('0x47')](handleError(_0x43bac4,null));};exports['removeQueues']=function(_0x42d1cd,_0x4c85b0,_0x1d5df7){return db[_0xd958('0x2c')]['findOne']({'where':{'id':_0x42d1cd['params']['id']}})[_0xd958('0x40')](function(_0x281dfc){if(_0x281dfc){if(!_0x42d1cd['query'][_0xd958('0x6e')]||!utils[_0xd958('0x6d')](_0x42d1cd[_0xd958('0x32')][_0xd958('0x6e')])){throw new db[(_0xd958('0x55'))][(_0xd958('0x6f'))]('Unknown\x20channel');}return _0x281dfc[_0xd958('0x77')+_[_0xd958('0x71')](_0x42d1cd[_0xd958('0x32')][_0xd958('0x6e')][_0xd958('0x72')]())+_0xd958('0x74')](_0x42d1cd['query']['ids']);}return null;})['then'](handleEntityNotFound(_0x4c85b0,null))[_0xd958('0x40')](respondWithStatusCode(_0x4c85b0,null))['catch'](handleError(_0x4c85b0,null));};exports[_0xd958('0x78')]=function(_0x31121f,_0x5dcec9){var _0x397c84=_[_0xd958('0x79')](_0x31121f[_0xd958('0x49')][_0xd958('0x76')])?_0x31121f[_0xd958('0x49')][_0xd958('0x76')]:[_0x31121f['body'][_0xd958('0x76')]];var _0x1706f3=_0x31121f[_0xd958('0x44')]['id'];return db[_0xd958('0x2c')][_0xd958('0x4f')]({'where':{'id':_0x1706f3}})['then'](handleEntityNotFound(_0x5dcec9,null))[_0xd958('0x40')](function(_0x1502e9){if(_0x1502e9){var _0x6e88b=['Voice',_0xd958('0x7a'),_0xd958('0x7b'),_0xd958('0x7c'),_0xd958('0x7d'),_0xd958('0x7e'),_0xd958('0x7f')];return db[_0xd958('0x52')]['transaction'](function(_0x2086c9){var _0x51e03c=_['map'](_0x6e88b,function(_0x40bb2d){var _0x467a11={'attributes':['id',_0xd958('0x2a')]};if(_0x40bb2d===_0xd958('0x80')){_0x467a11[_0xd958('0x81')]={'attributes':[_0xd958('0x82')]};}return _0x1502e9[_0xd958('0x4b')+_0x40bb2d+_0xd958('0x74')](_0x467a11)['then'](function(_0xecb3d1){var _0x5cef01=_[_0xd958('0x31')](_0xecb3d1,function(_0x2f5a24){var _0x10a541=_['map'](_0x397c84,function(_0x1f5270){var _0x39de82={'where':{'UserId':_0x1f5270,[_0x40bb2d+_0xd958('0x83')]:_0x2f5a24['id']},'transaction':_0x2086c9};if(_0x40bb2d==='Voice'){_0x39de82[_0xd958('0x19')]={'penalty':_0x2f5a24['TeamVoiceQueue'][_0xd958('0x82')]};}return db[_0xd958('0x84')+_0x40bb2d+'Queue']['findOrCreate'](_0x39de82)[_0xd958('0x40')](function(){socket[_0xd958('0x85')](_0xd958('0x4a')+_0x40bb2d+'Queue:save',{'UserId':_0x1f5270,[_0x40bb2d+_0xd958('0x83')]:_0x2f5a24['id']});if(_0x40bb2d!==_0xd958('0x80')){return;}return db[_0xd958('0x84')][_0xd958('0x86')]({'where':{'id':_0x397c84,'online':0x1},'attributes':['id','name',_0xd958('0x87'),'voicePause',_0xd958('0x88')],'raw':!![]})[_0xd958('0x40')](function(_0x595066){var _0x40ab97=_[_0xd958('0x31')](_0x595066,function(_0x263974){return db[_0xd958('0x89')][_0xd958('0x8a')]({'membername':_0x263974['name'],'UserId':_0x263974['id'],'queue_name':_0x2f5a24['name'],'VoiceQueueId':_0x2f5a24['id'],'interface':_[_0xd958('0x8b')](_0x263974[_0xd958('0x88')])?util[_0xd958('0x8c')](_0xd958('0x8d'),_0x263974[_0xd958('0x2a')]):_0x263974['interface'],'paused':_0x263974[_0xd958('0x8e')]||![],'penalty':_0x2f5a24[_0xd958('0x8f')][_0xd958('0x82')]},{'transaction':_0x2086c9});});return Promise[_0xd958('0x90')](_0x40ab97);});});});return Promise['all'](_0x10a541);});return Promise[_0xd958('0x90')](_0x5cef01);})[_0xd958('0x40')](function(){return db[_0xd958('0x68')]['findOne']({'where':{'teamId':_0x1706f3}})[_0xd958('0x40')](function(_0x22ad08){if(_0x22ad08){var _0x3c1898=_[_0xd958('0x31')](_0x397c84,function(_0x29645c){db['UserVoicePrefix'][_0xd958('0x8a')]({'UserId':_0x29645c,'VoicePrefixId':_0x22ad08['VoicePrefixId']});});return Promise[_0xd958('0x90')](_0x3c1898);}});});});return Promise[_0xd958('0x90')](_0x51e03c)[_0xd958('0x40')](function(){return _0x1502e9[_0xd958('0x78')](_0x397c84,{'transaction':_0x2086c9})[_0xd958('0x91')](function(_0x597c0d){return _0x597c0d;});});});}})[_0xd958('0x40')](respondWithResult(_0x5dcec9,null))[_0xd958('0x47')](handleError(_0x5dcec9,null));};exports[_0xd958('0x92')]=function(_0x66c0c2,_0x24eb49){var _0x6cf46d=_['isArray'](_0x66c0c2['query']['ids'])?_0x66c0c2[_0xd958('0x32')][_0xd958('0x76')]:[_0x66c0c2[_0xd958('0x32')][_0xd958('0x76')]];var _0x431736=_0x66c0c2[_0xd958('0x44')]['id'];return db[_0xd958('0x2c')][_0xd958('0x4f')]({'where':{'id':_0x431736}})[_0xd958('0x40')](handleEntityNotFound(_0x24eb49,null))['then'](function(_0xbbef4b){if(_0xbbef4b){var _0x405b27=['Voice','Chat',_0xd958('0x7b'),'Sms','Fax',_0xd958('0x7e'),'Whatsapp'];return db['sequelize'][_0xd958('0x53')](function(_0x565eca){var _0x13d566=_[_0xd958('0x31')](_0x405b27,function(_0x5631ba){var _0x59d7ed={'attributes':['id','name']};return _0xbbef4b['get'+_0x5631ba+_0xd958('0x74')](_0x59d7ed)[_0xd958('0x40')](function(_0x48b8d4){var _0x49944d=_[_0xd958('0x31')](_0x48b8d4,function(_0x59abaa){return _0x59abaa[_0xd958('0x92')](_0x6cf46d,{'transaction':_0x565eca})[_0xd958('0x40')](function(){var _0xb0c062=_['map'](_0x6cf46d,function(_0x576a08){socket[_0xd958('0x85')](_0xd958('0x4a')+_0x5631ba+'Queue:remove',{'UserId':Number(_0x576a08),[_0x5631ba+_0xd958('0x83')]:_0x59abaa['id']});if(_0x5631ba!==_0xd958('0x80')){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x59abaa['id'],'UserId':_0x576a08},'transaction':_0x565eca});});return Promise[_0xd958('0x90')](_0xb0c062);});});return Promise[_0xd958('0x90')](_0x49944d);});});return Promise[_0xd958('0x90')](_0x13d566)['then'](function(){return _0xbbef4b[_0xd958('0x92')](_0x6cf46d,{'transaction':_0x565eca});})[_0xd958('0x40')](function(){return db[_0xd958('0x68')][_0xd958('0x6c')]({'where':{'teamId':_0x431736}})[_0xd958('0x40')](function(_0x2d5177){if(_0x2d5177){var _0x55c460=_[_0xd958('0x31')](_0x6cf46d,function(_0x30eb8b){db[_0xd958('0x69')]['destroy']({'where':{'UserId':_0x30eb8b,'VoicePrefixId':_0x2d5177['VoicePrefixId']}});});return Promise['all'](_0x55c460);}});});});}})[_0xd958('0x40')](respondWithStatusCode(_0x24eb49,null))['catch'](handleError(_0x24eb49,null));};exports[_0xd958('0x93')]=function(_0x5382f9,_0x1cedb0,_0x34422d){var _0x5b2a35={};var _0x439239={};var _0x2a4406;var _0x38f2b5;return db[_0xd958('0x2c')][_0xd958('0x6c')]({'where':{'id':_0x5382f9[_0xd958('0x44')]['id']}})[_0xd958('0x40')](handleEntityNotFound(_0x1cedb0,null))[_0xd958('0x40')](function(_0x278c61){if(_0x278c61){_0x2a4406=_0x278c61;_0x439239[_0xd958('0x30')]=_[_0xd958('0x45')](db[_0xd958('0x84')][_0xd958('0x2d')]);_0x439239[_0xd958('0x32')]=_[_0xd958('0x45')](_0x5382f9[_0xd958('0x32')]);_0x439239[_0xd958('0x3a')]=_[_0xd958('0x33')](_0x439239[_0xd958('0x30')],_0x439239[_0xd958('0x32')]);_0x5b2a35[_0xd958('0x34')]=_['intersection'](_0x439239['model'],qs[_0xd958('0x35')](_0x5382f9[_0xd958('0x32')][_0xd958('0x35')]));_0x5b2a35[_0xd958('0x34')]=_0x5b2a35[_0xd958('0x34')]['length']?_0x5b2a35[_0xd958('0x34')]:_0x439239[_0xd958('0x30')];_0x5b2a35[_0xd958('0x38')]=qs[_0xd958('0x39')](_0x5382f9['query'][_0xd958('0x39')]);_0x5b2a35[_0xd958('0x3f')]=qs[_0xd958('0x3a')](_['pick'](_0x5382f9[_0xd958('0x32')],_0x439239['filters']));if(_0x5382f9['query'][_0xd958('0x3c')]){_0x5b2a35[_0xd958('0x3f')]=_[_0xd958('0x3e')](_0x5b2a35['where'],{'$or':_[_0xd958('0x31')](_0x5b2a35[_0xd958('0x34')],function(_0x1ccd7f){var _0x5a3197={};_0x5a3197[_0x1ccd7f]={'$like':'%'+_0x5382f9['query'][_0xd958('0x3c')]+'%'};return _0x5a3197;})});}_0x5b2a35=_[_0xd958('0x3e')]({},_0x5b2a35,_0x5382f9['options']);return _0x2a4406['getAgents'](_0x5b2a35);}})[_0xd958('0x40')](function(_0x436eea){if(_0x436eea){_0x38f2b5=_0x436eea[_0xd958('0x36')];if(!_0x5382f9['query'][_0xd958('0x94')](_0xd958('0x37'))){_0x5b2a35[_0xd958('0x22')]=qs[_0xd958('0x22')](_0x5382f9[_0xd958('0x32')][_0xd958('0x22')]);_0x5b2a35[_0xd958('0x20')]=qs['offset'](_0x5382f9[_0xd958('0x32')][_0xd958('0x20')]);}return _0x2a4406['getAgents'](_0x5b2a35);}})['then'](function(_0x584afa){if(_0x584afa){return _0x584afa?{'count':_0x38f2b5,'rows':_0x584afa}:null;}})[_0xd958('0x40')](respondWithResult(_0x1cedb0,null))[_0xd958('0x47')](handleError(_0x1cedb0,null));}; \ No newline at end of file +var _0xf709=['type','VIRTUAL','options','then','includeAll','findAll','rows','catch','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','Teams','UserProfileSection','userProfileId','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','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','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','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','capitalize','Queues','addQueues','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','penalty','TeamVoiceQueue','findOrCreate','Queue:save','QueueId','User','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','UserVoicePrefix','spread','removeAgents','emit','Queue:remove','getAgents','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','sendStatus','error','stack','name','send','map','Team','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge'];(function(_0x3a544a,_0x73a217){var _0x342f1e=function(_0x519dce){while(--_0x519dce){_0x3a544a['push'](_0x3a544a['shift']());}};_0x342f1e(++_0x73a217);}(_0xf709,0xf7));var _0x9f70=function(_0x4630c9,_0xd229d3){_0x4630c9=_0x4630c9-0x0;var _0x10b8bd=_0xf709[_0x4630c9];return _0x10b8bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f70('0x0'));var zipdir=require(_0x9f70('0x1'));var jsonpatch=require(_0x9f70('0x2'));var rp=require(_0x9f70('0x3'));var moment=require(_0x9f70('0x4'));var BPromise=require(_0x9f70('0x5'));var Mustache=require(_0x9f70('0x6'));var util=require(_0x9f70('0x7'));var path=require('path');var sox=require(_0x9f70('0x8'));var csv=require(_0x9f70('0x9'));var ejs=require(_0x9f70('0xa'));var fs=require('fs');var fs_extra=require(_0x9f70('0xb'));var _=require(_0x9f70('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9f70('0xd'));var deskjs=require(_0x9f70('0xe'));var toCsv=require(_0x9f70('0x9'));var querystring=require(_0x9f70('0xf'));var Papa=require(_0x9f70('0x10'));var Redis=require(_0x9f70('0x11'));var authService=require(_0x9f70('0x12'));var qs=require(_0x9f70('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f70('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9f70('0x15'));var config=require(_0x9f70('0x16'));var licenseUtil=require(_0x9f70('0x17'));var db=require(_0x9f70('0x18'))['db'];config[_0x9f70('0x19')]=_[_0x9f70('0x1a')](config['redis'],{'host':_0x9f70('0x1b'),'port':0x18eb});var socket=require(_0x9f70('0x1c'))(new Redis(config[_0x9f70('0x19')]));require(_0x9f70('0x1d'))[_0x9f70('0x1e')](socket);function respondWithStatusCode(_0x484013,_0x789e60){_0x789e60=_0x789e60||0xcc;return function(_0x3fe190){if(_0x3fe190){return _0x484013['sendStatus'](_0x789e60);}return _0x484013[_0x9f70('0x1f')](_0x789e60)[_0x9f70('0x20')]();};}function respondWithResult(_0x1a5b6d,_0x310d33){_0x310d33=_0x310d33||0xc8;return function(_0x2c3aeb){if(_0x2c3aeb){return _0x1a5b6d[_0x9f70('0x1f')](_0x310d33)[_0x9f70('0x21')](_0x2c3aeb);}};}function respondWithFilteredResult(_0x97e77f,_0x129136){return function(_0x3c6f74){if(_0x3c6f74){var _0x1c383f=typeof _0x129136[_0x9f70('0x22')]===_0x9f70('0x23')&&typeof _0x129136['limit']===_0x9f70('0x23');var _0x110a2d=_0x3c6f74['count'];var _0x226526=_0x1c383f?0x0:_0x129136['offset'];var _0x2ecb5b=_0x1c383f?_0x3c6f74[_0x9f70('0x24')]:_0x129136['offset']+_0x129136[_0x9f70('0x25')];var _0x319062;if(_0x2ecb5b>=_0x110a2d){_0x2ecb5b=_0x110a2d;_0x319062=0xc8;}else{_0x319062=0xce;}_0x97e77f[_0x9f70('0x1f')](_0x319062);return _0x97e77f['set'](_0x9f70('0x26'),_0x226526+'-'+_0x2ecb5b+'/'+_0x110a2d)['json'](_0x3c6f74);}return null;};}function patchUpdates(_0x196894){return function(_0x4118f1){try{jsonpatch[_0x9f70('0x27')](_0x4118f1,_0x196894,!![]);}catch(_0x5c5c3a){return BPromise[_0x9f70('0x28')](_0x5c5c3a);}return _0x4118f1[_0x9f70('0x29')]();};}function saveUpdates(_0x5f4556,_0x3b625b){return function(_0x55be1c){if(_0x55be1c){return _0x55be1c[_0x9f70('0x2a')](_0x5f4556)['then'](function(_0x5b32c4){return _0x5b32c4;});}return null;};}function handleEntityNotFound(_0x31496f,_0xb5bba){return function(_0x5b9736){if(!_0x5b9736){_0x31496f[_0x9f70('0x2b')](0x194);}return _0x5b9736;};}function handleError(_0x2d65bd,_0x33af04){_0x33af04=_0x33af04||0x1f4;return function(_0x1ac038){logger[_0x9f70('0x2c')](_0x1ac038[_0x9f70('0x2d')]);if(_0x1ac038[_0x9f70('0x2e')]){delete _0x1ac038[_0x9f70('0x2e')];}_0x2d65bd[_0x9f70('0x1f')](_0x33af04)[_0x9f70('0x2f')](_0x1ac038);};}exports['index']=function(_0x37c71c,_0x3403ea){var _0x173968={},_0x2044eb={},_0x863ba2={'count':0x0,'rows':[]};var _0x108a90=_[_0x9f70('0x30')](db[_0x9f70('0x31')][_0x9f70('0x32')],function(_0x344e7d){return{'name':_0x344e7d[_0x9f70('0x33')],'type':_0x344e7d['type'][_0x9f70('0x34')]};});_0x2044eb[_0x9f70('0x35')]=_[_0x9f70('0x30')](_0x108a90,_0x9f70('0x2e'));_0x2044eb[_0x9f70('0x36')]=_[_0x9f70('0x37')](_0x37c71c[_0x9f70('0x36')]);_0x2044eb[_0x9f70('0x38')]=_['intersection'](_0x2044eb[_0x9f70('0x35')],_0x2044eb[_0x9f70('0x36')]);_0x173968[_0x9f70('0x39')]=_[_0x9f70('0x3a')](_0x2044eb[_0x9f70('0x35')],qs[_0x9f70('0x3b')](_0x37c71c[_0x9f70('0x36')][_0x9f70('0x3b')]));_0x173968[_0x9f70('0x39')]=_0x173968[_0x9f70('0x39')][_0x9f70('0x3c')]?_0x173968[_0x9f70('0x39')]:_0x2044eb[_0x9f70('0x35')];if(!_0x37c71c[_0x9f70('0x36')]['hasOwnProperty'](_0x9f70('0x3d'))){_0x173968[_0x9f70('0x25')]=qs[_0x9f70('0x25')](_0x37c71c[_0x9f70('0x36')][_0x9f70('0x25')]);_0x173968[_0x9f70('0x22')]=qs[_0x9f70('0x22')](_0x37c71c['query']['offset']);}_0x173968[_0x9f70('0x3e')]=qs[_0x9f70('0x3f')](_0x37c71c['query']['sort']);_0x173968[_0x9f70('0x40')]=qs[_0x9f70('0x38')](_['pick'](_0x37c71c[_0x9f70('0x36')],_0x2044eb[_0x9f70('0x38')]),_0x108a90);if(_0x37c71c[_0x9f70('0x36')][_0x9f70('0x41')]){_0x173968[_0x9f70('0x40')]=_[_0x9f70('0x42')](_0x173968[_0x9f70('0x40')],{'$or':_[_0x9f70('0x30')](_0x108a90,function(_0x185b81){if(_0x185b81[_0x9f70('0x43')]!==_0x9f70('0x44')){var _0x411bc7={};_0x411bc7[_0x185b81[_0x9f70('0x2e')]]={'$like':'%'+_0x37c71c[_0x9f70('0x36')][_0x9f70('0x41')]+'%'};return _0x411bc7;}})});}_0x173968=_[_0x9f70('0x42')]({},_0x173968,_0x37c71c[_0x9f70('0x45')]);var _0x5b3218={'where':_0x173968['where']};return db['Team']['count'](_0x5b3218)[_0x9f70('0x46')](function(_0x3bbee4){_0x863ba2[_0x9f70('0x24')]=_0x3bbee4;if(_0x37c71c[_0x9f70('0x36')][_0x9f70('0x47')]){_0x173968['include']=[{'all':!![]}];}return db['Team'][_0x9f70('0x48')](_0x173968);})[_0x9f70('0x46')](function(_0x1b4832){_0x863ba2[_0x9f70('0x49')]=_0x1b4832;return _0x863ba2;})[_0x9f70('0x46')](respondWithFilteredResult(_0x3403ea,_0x173968))[_0x9f70('0x4a')](handleError(_0x3403ea,null));};exports['show']=function(_0x324bd0,_0x37bbcf){var _0x1a1c03={'raw':![],'where':{'id':_0x324bd0[_0x9f70('0x4b')]['id']}},_0x298a41={};_0x298a41[_0x9f70('0x35')]=_['keys'](db[_0x9f70('0x31')][_0x9f70('0x32')]);_0x298a41[_0x9f70('0x36')]=_[_0x9f70('0x37')](_0x324bd0[_0x9f70('0x36')]);_0x298a41['filters']=_[_0x9f70('0x3a')](_0x298a41[_0x9f70('0x35')],_0x298a41[_0x9f70('0x36')]);_0x1a1c03[_0x9f70('0x39')]=_['intersection'](_0x298a41[_0x9f70('0x35')],qs[_0x9f70('0x3b')](_0x324bd0[_0x9f70('0x36')][_0x9f70('0x3b')]));_0x1a1c03[_0x9f70('0x39')]=_0x1a1c03[_0x9f70('0x39')]['length']?_0x1a1c03['attributes']:_0x298a41[_0x9f70('0x35')];if(_0x324bd0[_0x9f70('0x36')][_0x9f70('0x47')]){_0x1a1c03[_0x9f70('0x4c')]=[{'all':!![]}];}_0x1a1c03=_[_0x9f70('0x42')]({},_0x1a1c03,_0x324bd0[_0x9f70('0x45')]);return db['Team'][_0x9f70('0x4d')](_0x1a1c03)[_0x9f70('0x46')](handleEntityNotFound(_0x37bbcf,null))[_0x9f70('0x46')](respondWithResult(_0x37bbcf,null))['catch'](handleError(_0x37bbcf,null));};exports[_0x9f70('0x4e')]=function(_0x5e5235,_0x22286f){return db['Team']['create'](_0x5e5235[_0x9f70('0x4f')],{})[_0x9f70('0x46')](function(_0x443763){var _0x84770c=_0x5e5235['user']['get']({'plain':!![]});if(!_0x84770c)throw new Error(_0x9f70('0x50'));if(_0x84770c[_0x9f70('0x51')]===_0x9f70('0x52')){var _0x3fb52b=_0x443763[_0x9f70('0x53')]({'plain':!![]});var _0x1edde5=_0x9f70('0x54');return db[_0x9f70('0x55')][_0x9f70('0x4d')]({'where':{'name':_0x1edde5,'userProfileId':_0x84770c[_0x9f70('0x56')]},'raw':!![]})['then'](function(_0x1e0985){if(_0x1e0985&&_0x1e0985['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3fb52b['name'],'resourceId':_0x3fb52b['id'],'type':_0x1e0985[_0x9f70('0x2e')],'sectionId':_0x1e0985['id']},{})[_0x9f70('0x46')](function(){return _0x443763;});}else{return _0x443763;}})[_0x9f70('0x4a')](function(_0x3c385b){logger[_0x9f70('0x2c')](_0x9f70('0x57'),_0x3c385b);throw _0x3c385b;});}return _0x443763;})[_0x9f70('0x46')](respondWithResult(_0x22286f,0xc9))[_0x9f70('0x4a')](handleError(_0x22286f,null));};exports[_0x9f70('0x2a')]=function(_0xfffa63,_0x29003a){if(_0xfffa63['body']['id']){delete _0xfffa63['body']['id'];}return db[_0x9f70('0x31')][_0x9f70('0x4d')]({'where':{'id':_0xfffa63[_0x9f70('0x4b')]['id']}})[_0x9f70('0x46')](handleEntityNotFound(_0x29003a,null))[_0x9f70('0x46')](saveUpdates(_0xfffa63[_0x9f70('0x4f')],null))[_0x9f70('0x46')](respondWithResult(_0x29003a,null))[_0x9f70('0x4a')](handleError(_0x29003a,null));};exports[_0x9f70('0x58')]=function(_0x5d7945,_0x20200c){var _0x19169f=_0x5d7945[_0x9f70('0x4b')]['id'];var _0x2908b5=[];return db[_0x9f70('0x59')][_0x9f70('0x5a')](function(_0x898e33){var _0x9fe501=_0x9f70('0x5b')+_0x19169f;return db[_0x9f70('0x59')][_0x9f70('0x36')](_0x9fe501,{'type':db[_0x9f70('0x5c')]['QueryTypes'][_0x9f70('0x5d')],'raw':!![],'transaction':_0x898e33})['then'](function(_0x5620af){_0x2908b5=_[_0x9f70('0x30')](_0x5620af,function(_0x2ced60){return Number(_0x2ced60[_0x9f70('0x5e')]);});})[_0x9f70('0x46')](function(){var _0x427898=_0x9f70('0x5f')+_0x19169f;return db[_0x9f70('0x59')][_0x9f70('0x36')](_0x427898,{'type':db[_0x9f70('0x5c')][_0x9f70('0x60')]['SELECT'],'raw':!![],'transaction':_0x898e33});})['then'](function(_0xeac6c2){var _0x1d5f2f=_[_0x9f70('0x30')](_0xeac6c2,function(_0x22a855){return Number(_0x22a855[_0x9f70('0x61')]);});return db['UserVoiceQueue'][_0x9f70('0x58')]({'where':{'UserId':{'$in':_0x2908b5},'VoiceQueueId':{'$in':_0x1d5f2f}},'transaction':_0x898e33});})['then'](function(){var _0x5836d1=_0x9f70('0x62')+_0x19169f;return db[_0x9f70('0x59')]['query'](_0x5836d1,{'type':db[_0x9f70('0x5c')][_0x9f70('0x60')][_0x9f70('0x5d')],'raw':!![],'transaction':_0x898e33});})[_0x9f70('0x46')](function(_0x134583){var _0x40c409=_[_0x9f70('0x30')](_0x134583,function(_0x3404ee){return Number(_0x3404ee[_0x9f70('0x63')]);});return db[_0x9f70('0x64')][_0x9f70('0x58')]({'where':{'UserId':{'$in':_0x2908b5},'MailQueueId':{'$in':_0x40c409}},'transaction':_0x898e33});})[_0x9f70('0x46')](function(){var _0x564ee4=_0x9f70('0x65')+_0x19169f;return db[_0x9f70('0x59')][_0x9f70('0x36')](_0x564ee4,{'type':db[_0x9f70('0x5c')]['QueryTypes'][_0x9f70('0x5d')],'raw':!![],'transaction':_0x898e33});})[_0x9f70('0x46')](function(_0x39e296){var _0x32bca0=_[_0x9f70('0x30')](_0x39e296,function(_0x11f09e){return Number(_0x11f09e['SmsQueueId']);});return db['UserSmsQueue'][_0x9f70('0x58')]({'where':{'UserId':{'$in':_0x2908b5},'SmsQueueId':{'$in':_0x32bca0}},'transaction':_0x898e33});})[_0x9f70('0x46')](function(){var _0x41797a=_0x9f70('0x66')+_0x19169f;return db['sequelize']['query'](_0x41797a,{'type':db[_0x9f70('0x5c')][_0x9f70('0x60')][_0x9f70('0x5d')],'raw':!![],'transaction':_0x898e33});})[_0x9f70('0x46')](function(_0x42ee9f){var _0x2bb67d=_[_0x9f70('0x30')](_0x42ee9f,function(_0x3f3b59){return Number(_0x3f3b59[_0x9f70('0x67')]);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x2908b5},'ChatQueueId':{'$in':_0x2bb67d}},'transaction':_0x898e33});})['then'](function(){var _0x191428=_0x9f70('0x68')+_0x19169f;return db[_0x9f70('0x59')]['query'](_0x191428,{'type':db[_0x9f70('0x5c')][_0x9f70('0x60')][_0x9f70('0x5d')],'raw':!![],'transaction':_0x898e33});})[_0x9f70('0x46')](function(_0x4c3a92){var _0x5be506=_[_0x9f70('0x30')](_0x4c3a92,function(_0xa8e4af){return Number(_0xa8e4af['FaxQueueId']);});return db['UserFaxQueue'][_0x9f70('0x58')]({'where':{'UserId':{'$in':_0x2908b5},'FaxQueueId':{'$in':_0x5be506}},'transaction':_0x898e33});})[_0x9f70('0x46')](function(){var _0x50ba43=_0x9f70('0x69')+_0x19169f;return db[_0x9f70('0x59')][_0x9f70('0x36')](_0x50ba43,{'type':db[_0x9f70('0x5c')][_0x9f70('0x60')][_0x9f70('0x5d')],'raw':!![],'transaction':_0x898e33});})[_0x9f70('0x46')](function(_0x338d3f){var _0x383088=_[_0x9f70('0x30')](_0x338d3f,function(_0x43b2ad){return Number(_0x43b2ad[_0x9f70('0x6a')]);});return db[_0x9f70('0x6b')][_0x9f70('0x58')]({'where':{'UserId':{'$in':_0x2908b5},'OpenchannelQueueId':{'$in':_0x383088}},'transaction':_0x898e33});})['then'](function(){var _0x57f5fb=_0x9f70('0x6c')+_0x19169f;return db['sequelize'][_0x9f70('0x36')](_0x57f5fb,{'type':db[_0x9f70('0x5c')]['QueryTypes'][_0x9f70('0x5d')],'raw':!![],'transaction':_0x898e33});})[_0x9f70('0x46')](function(_0x17c14e){var _0x8096d6=_['map'](_0x17c14e,function(_0x2a725a){return Number(_0x2a725a[_0x9f70('0x6d')]);});return db[_0x9f70('0x6e')]['destroy']({'where':{'UserId':{'$in':_0x2908b5},'WhatsappQueueId':{'$in':_0x8096d6}},'transaction':_0x898e33});})[_0x9f70('0x46')](function(){return db[_0x9f70('0x6f')][_0x9f70('0x4d')]({'where':{'TeamId':_0x19169f}});})[_0x9f70('0x46')](function(_0x34a865){if(_0x34a865===null){return;}return db['UserVoicePrefix'][_0x9f70('0x58')]({'where':{'UserId':{'$in':_0x2908b5},'VoicePrefixId':_0x34a865[_0x9f70('0x70')]},'transaction':_0x898e33});})[_0x9f70('0x46')](function(){return db['Team']['destroy']({'where':{'id':_0x19169f},'cascade':!![],'transaction':_0x898e33});})[_0x9f70('0x46')](function(_0x11ab19){if(_0x11ab19===0x0){_0x20200c['sendStatus'](0x194);}else{return db['UserProfileResource'][_0x9f70('0x58')]({'where':{'type':_0x9f70('0x54'),'resourceId':_0x19169f},'cascade':!![],'transaction':_0x898e33})[_0x9f70('0x46')](function(){_0x20200c['status'](0xcc)['end']();});}})[_0x9f70('0x4a')](function(_0x38a711){_0x20200c[_0x9f70('0x1f')](0x1f4)['send'](_0x38a711);});});};exports[_0x9f70('0x71')]=function(_0x4a18a9,_0x50e8f8,_0x20f16a){return db[_0x9f70('0x31')][_0x9f70('0x72')]({'where':{'id':_0x4a18a9[_0x9f70('0x4b')]['id']}})[_0x9f70('0x46')](handleEntityNotFound(_0x50e8f8,null))['then'](function(_0x5cdfbd){if(!_0x4a18a9[_0x9f70('0x36')][_0x9f70('0x73')]||!utils[_0x9f70('0x74')](_0x4a18a9[_0x9f70('0x36')]['channel'])){throw new db[(_0x9f70('0x5c'))][(_0x9f70('0x75'))](_0x9f70('0x76'));}var _0x5e2abf={};var _0x272857={};_0x272857[_0x9f70('0x35')]=_['keys'](db[_['capitalize'](_0x4a18a9[_0x9f70('0x36')][_0x9f70('0x73')][_0x9f70('0x77')]())+'Queue']['rawAttributes']);_0x272857[_0x9f70('0x36')]=_['keys'](_0x4a18a9[_0x9f70('0x36')]);_0x272857[_0x9f70('0x38')]=_[_0x9f70('0x3a')](_0x272857[_0x9f70('0x35')],_0x272857['query']);_0x5e2abf[_0x9f70('0x39')]=_[_0x9f70('0x3a')](_0x272857[_0x9f70('0x35')],qs[_0x9f70('0x3b')](_0x4a18a9[_0x9f70('0x36')][_0x9f70('0x3b')]));_0x5e2abf[_0x9f70('0x39')]=_0x5e2abf[_0x9f70('0x39')][_0x9f70('0x3c')]?_0x5e2abf[_0x9f70('0x39')]:_0x272857[_0x9f70('0x35')];_0x5e2abf[_0x9f70('0x25')]=qs[_0x9f70('0x25')](_0x4a18a9[_0x9f70('0x36')][_0x9f70('0x25')]);_0x5e2abf[_0x9f70('0x22')]=qs[_0x9f70('0x22')](_0x4a18a9[_0x9f70('0x36')][_0x9f70('0x22')]);_0x5e2abf['order']=qs[_0x9f70('0x3f')](_0x4a18a9[_0x9f70('0x36')][_0x9f70('0x3f')]);_0x5e2abf['where']=qs[_0x9f70('0x38')](_['pick'](_0x4a18a9[_0x9f70('0x36')],_0x272857[_0x9f70('0x38')]));_0x5e2abf=_[_0x9f70('0x42')]({},_0x5e2abf,_0x4a18a9[_0x9f70('0x45')]);return _0x5cdfbd[_0x9f70('0x53')+_[_0x9f70('0x78')](_0x4a18a9['query'][_0x9f70('0x73')][_0x9f70('0x77')]())+_0x9f70('0x79')](_0x5e2abf);})['then'](respondWithResult(_0x50e8f8,null))[_0x9f70('0x4a')](handleError(_0x50e8f8,null));};exports[_0x9f70('0x7a')]=function(_0x38615a,_0x153dd7,_0x2cfb60){return db['Team'][_0x9f70('0x72')]({'where':{'id':_0x38615a[_0x9f70('0x4b')]['id']}})[_0x9f70('0x46')](function(_0x366245){if(_0x366245){if(!_0x38615a[_0x9f70('0x4f')][_0x9f70('0x73')]||!utils[_0x9f70('0x74')](_0x38615a[_0x9f70('0x4f')][_0x9f70('0x73')])){throw new db[(_0x9f70('0x5c'))][(_0x9f70('0x75'))](_0x9f70('0x76'));}return _0x366245[_0x9f70('0x7b')+_[_0x9f70('0x78')](_0x38615a[_0x9f70('0x4f')]['channel']['toLowerCase']())+_0x9f70('0x79')](_0x38615a[_0x9f70('0x4f')][_0x9f70('0x7c')]);}return null;})[_0x9f70('0x46')](handleEntityNotFound(_0x153dd7,null))[_0x9f70('0x46')](respondWithStatusCode(_0x153dd7,null))[_0x9f70('0x4a')](handleError(_0x153dd7,null));};exports[_0x9f70('0x7d')]=function(_0x5d8d7d,_0x30ba03,_0x586f3b){return db[_0x9f70('0x31')][_0x9f70('0x72')]({'where':{'id':_0x5d8d7d[_0x9f70('0x4b')]['id']}})[_0x9f70('0x46')](function(_0x441810){if(_0x441810){if(!_0x5d8d7d[_0x9f70('0x36')][_0x9f70('0x73')]||!utils[_0x9f70('0x74')](_0x5d8d7d[_0x9f70('0x36')][_0x9f70('0x73')])){throw new db['Sequelize'][(_0x9f70('0x75'))](_0x9f70('0x76'));}return _0x441810[_0x9f70('0x7e')+_[_0x9f70('0x78')](_0x5d8d7d['query'][_0x9f70('0x73')][_0x9f70('0x77')]())+_0x9f70('0x79')](_0x5d8d7d['query'][_0x9f70('0x7c')]);}return null;})[_0x9f70('0x46')](handleEntityNotFound(_0x30ba03,null))[_0x9f70('0x46')](respondWithStatusCode(_0x30ba03,null))[_0x9f70('0x4a')](handleError(_0x30ba03,null));};exports[_0x9f70('0x7f')]=function(_0x4899ea,_0x4e3959){var _0x3dc39a=_[_0x9f70('0x80')](_0x4899ea['body']['ids'])?_0x4899ea['body'][_0x9f70('0x7c')]:[_0x4899ea[_0x9f70('0x4f')][_0x9f70('0x7c')]];var _0x550b26=_0x4899ea[_0x9f70('0x4b')]['id'];return db[_0x9f70('0x31')][_0x9f70('0x4d')]({'where':{'id':_0x550b26}})[_0x9f70('0x46')](handleEntityNotFound(_0x4e3959,null))[_0x9f70('0x46')](function(_0x306f04){if(_0x306f04){var _0x54f4cf=[_0x9f70('0x81'),_0x9f70('0x82'),_0x9f70('0x83'),_0x9f70('0x84'),_0x9f70('0x85'),_0x9f70('0x86'),_0x9f70('0x87')];return db[_0x9f70('0x59')][_0x9f70('0x5a')](function(_0xd2500e){var _0x49cdf8=_['map'](_0x54f4cf,function(_0x520072){var _0x3c0f6a={'attributes':['id',_0x9f70('0x2e')]};if(_0x520072===_0x9f70('0x81')){_0x3c0f6a['through']={'attributes':[_0x9f70('0x88')]};}return _0x306f04[_0x9f70('0x53')+_0x520072+'Queues'](_0x3c0f6a)[_0x9f70('0x46')](function(_0x4a8375){var _0x297c36=_[_0x9f70('0x30')](_0x4a8375,function(_0x4b0473){var _0x4064ea=_[_0x9f70('0x30')](_0x3dc39a,function(_0x47814e){var _0x13be8d={'where':{'UserId':_0x47814e,[_0x520072+'QueueId']:_0x4b0473['id']},'transaction':_0xd2500e};if(_0x520072===_0x9f70('0x81')){_0x13be8d['defaults']={'penalty':_0x4b0473[_0x9f70('0x89')][_0x9f70('0x88')]};}return db['User'+_0x520072+'Queue'][_0x9f70('0x8a')](_0x13be8d)[_0x9f70('0x46')](function(){socket['emit'](_0x9f70('0x52')+_0x520072+_0x9f70('0x8b'),{'UserId':_0x47814e,[_0x520072+_0x9f70('0x8c')]:_0x4b0473['id']});if(_0x520072!=='Voice'){return;}return db[_0x9f70('0x8d')][_0x9f70('0x48')]({'where':{'id':_0x3dc39a,'online':0x1},'attributes':['id','name',_0x9f70('0x8e'),_0x9f70('0x8f'),_0x9f70('0x90')],'raw':!![]})[_0x9f70('0x46')](function(_0x18f096){var _0x4b27b3=_[_0x9f70('0x30')](_0x18f096,function(_0x38cfe5){return db[_0x9f70('0x91')]['upsert']({'membername':_0x38cfe5[_0x9f70('0x2e')],'UserId':_0x38cfe5['id'],'queue_name':_0x4b0473[_0x9f70('0x2e')],'VoiceQueueId':_0x4b0473['id'],'interface':_[_0x9f70('0x92')](_0x38cfe5[_0x9f70('0x90')])?util[_0x9f70('0x93')](_0x9f70('0x94'),_0x38cfe5['name']):_0x38cfe5['interface'],'paused':_0x38cfe5[_0x9f70('0x8f')]||![],'penalty':_0x4b0473[_0x9f70('0x89')]['penalty']},{'transaction':_0xd2500e});});return Promise[_0x9f70('0x95')](_0x4b27b3);});});});return Promise[_0x9f70('0x95')](_0x4064ea);});return Promise[_0x9f70('0x95')](_0x297c36);})[_0x9f70('0x46')](function(){return db[_0x9f70('0x6f')]['findOne']({'where':{'teamId':_0x550b26}})['then'](function(_0x32461a){if(_0x32461a){var _0x2d2152=_[_0x9f70('0x30')](_0x3dc39a,function(_0x29ca74){db[_0x9f70('0x96')]['upsert']({'UserId':_0x29ca74,'VoicePrefixId':_0x32461a[_0x9f70('0x70')]});});return Promise[_0x9f70('0x95')](_0x2d2152);}});});});return Promise[_0x9f70('0x95')](_0x49cdf8)[_0x9f70('0x46')](function(){return _0x306f04['addAgents'](_0x3dc39a,{'transaction':_0xd2500e})[_0x9f70('0x97')](function(_0x38108d){return _0x38108d;});});});}})['then'](respondWithResult(_0x4e3959,null))[_0x9f70('0x4a')](handleError(_0x4e3959,null));};exports[_0x9f70('0x98')]=function(_0x7f89d0,_0x581313){var _0x51decf=_[_0x9f70('0x80')](_0x7f89d0[_0x9f70('0x36')][_0x9f70('0x7c')])?_0x7f89d0[_0x9f70('0x36')][_0x9f70('0x7c')]:[_0x7f89d0[_0x9f70('0x36')][_0x9f70('0x7c')]];var _0x435d7b=_0x7f89d0[_0x9f70('0x4b')]['id'];return db[_0x9f70('0x31')]['find']({'where':{'id':_0x435d7b}})[_0x9f70('0x46')](handleEntityNotFound(_0x581313,null))[_0x9f70('0x46')](function(_0x568a9a){if(_0x568a9a){var _0x530041=['Voice',_0x9f70('0x82'),_0x9f70('0x83'),_0x9f70('0x84'),_0x9f70('0x85'),_0x9f70('0x86'),_0x9f70('0x87')];return db['sequelize'][_0x9f70('0x5a')](function(_0x437095){var _0x3b8284=_['map'](_0x530041,function(_0x3adcd4){var _0x7eaa73={'attributes':['id',_0x9f70('0x2e')]};return _0x568a9a[_0x9f70('0x53')+_0x3adcd4+_0x9f70('0x79')](_0x7eaa73)[_0x9f70('0x46')](function(_0x3f7dcc){var _0x208834=_[_0x9f70('0x30')](_0x3f7dcc,function(_0xa70437){return _0xa70437[_0x9f70('0x98')](_0x51decf,{'transaction':_0x437095})[_0x9f70('0x46')](function(){var _0x3a516d=_[_0x9f70('0x30')](_0x51decf,function(_0x21e544){socket[_0x9f70('0x99')](_0x9f70('0x52')+_0x3adcd4+_0x9f70('0x9a'),{'UserId':Number(_0x21e544),[_0x3adcd4+_0x9f70('0x8c')]:_0xa70437['id']});if(_0x3adcd4!==_0x9f70('0x81')){return;}return db[_0x9f70('0x91')][_0x9f70('0x58')]({'where':{'VoiceQueueId':_0xa70437['id'],'UserId':_0x21e544},'transaction':_0x437095});});return Promise['all'](_0x3a516d);});});return Promise[_0x9f70('0x95')](_0x208834);});});return Promise[_0x9f70('0x95')](_0x3b8284)[_0x9f70('0x46')](function(){return _0x568a9a['removeAgents'](_0x51decf,{'transaction':_0x437095});})[_0x9f70('0x46')](function(){return db[_0x9f70('0x6f')][_0x9f70('0x72')]({'where':{'teamId':_0x435d7b}})[_0x9f70('0x46')](function(_0x39e22f){if(_0x39e22f){var _0x2bb29a=_[_0x9f70('0x30')](_0x51decf,function(_0x255375){db[_0x9f70('0x96')]['destroy']({'where':{'UserId':_0x255375,'VoicePrefixId':_0x39e22f[_0x9f70('0x70')]}});});return Promise['all'](_0x2bb29a);}});});});}})[_0x9f70('0x46')](respondWithStatusCode(_0x581313,null))['catch'](handleError(_0x581313,null));};exports['getAgents']=function(_0x32e335,_0x4ba61d,_0x21b652){var _0x3663a6={};var _0x571297={};var _0x150832;var _0x21aea0;return db[_0x9f70('0x31')][_0x9f70('0x72')]({'where':{'id':_0x32e335['params']['id']}})[_0x9f70('0x46')](handleEntityNotFound(_0x4ba61d,null))[_0x9f70('0x46')](function(_0x4fa888){if(_0x4fa888){_0x150832=_0x4fa888;_0x571297['model']=_[_0x9f70('0x37')](db[_0x9f70('0x8d')]['rawAttributes']);_0x571297['query']=_[_0x9f70('0x37')](_0x32e335['query']);_0x571297[_0x9f70('0x38')]=_[_0x9f70('0x3a')](_0x571297['model'],_0x571297[_0x9f70('0x36')]);_0x3663a6[_0x9f70('0x39')]=_[_0x9f70('0x3a')](_0x571297[_0x9f70('0x35')],qs[_0x9f70('0x3b')](_0x32e335[_0x9f70('0x36')][_0x9f70('0x3b')]));_0x3663a6[_0x9f70('0x39')]=_0x3663a6['attributes'][_0x9f70('0x3c')]?_0x3663a6[_0x9f70('0x39')]:_0x571297['model'];_0x3663a6[_0x9f70('0x3e')]=qs[_0x9f70('0x3f')](_0x32e335[_0x9f70('0x36')][_0x9f70('0x3f')]);_0x3663a6[_0x9f70('0x40')]=qs[_0x9f70('0x38')](_['pick'](_0x32e335[_0x9f70('0x36')],_0x571297[_0x9f70('0x38')]));if(_0x32e335[_0x9f70('0x36')]['filter']){_0x3663a6[_0x9f70('0x40')]=_[_0x9f70('0x42')](_0x3663a6['where'],{'$or':_[_0x9f70('0x30')](_0x3663a6[_0x9f70('0x39')],function(_0xbb72e1){var _0x32b870={};_0x32b870[_0xbb72e1]={'$like':'%'+_0x32e335[_0x9f70('0x36')][_0x9f70('0x41')]+'%'};return _0x32b870;})});}_0x3663a6=_[_0x9f70('0x42')]({},_0x3663a6,_0x32e335[_0x9f70('0x45')]);return _0x150832[_0x9f70('0x9b')](_0x3663a6);}})[_0x9f70('0x46')](function(_0x2affb4){if(_0x2affb4){_0x21aea0=_0x2affb4['length'];if(!_0x32e335[_0x9f70('0x36')][_0x9f70('0x9c')](_0x9f70('0x3d'))){_0x3663a6['limit']=qs[_0x9f70('0x25')](_0x32e335[_0x9f70('0x36')]['limit']);_0x3663a6[_0x9f70('0x22')]=qs[_0x9f70('0x22')](_0x32e335[_0x9f70('0x36')]['offset']);}return _0x150832[_0x9f70('0x9b')](_0x3663a6);}})[_0x9f70('0x46')](function(_0x3b6672){if(_0x3b6672){return _0x3b6672?{'count':_0x21aea0,'rows':_0x3b6672}:null;}})[_0x9f70('0x46')](respondWithResult(_0x4ba61d,null))['catch'](handleError(_0x4ba61d,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 6e39adb..b418177 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 _0xeb28=['../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x21995a,_0x49cb59){var _0x5d76a0=function(_0x1798da){while(--_0x1798da){_0x21995a['push'](_0x21995a['shift']());}};_0x5d76a0(++_0x49cb59);}(_0xeb28,0xff));var _0x8eb2=function(_0x22ab8e,_0x1faa99){_0x22ab8e=_0x22ab8e-0x0;var _0x3d1001=_0xeb28[_0x22ab8e];return _0x3d1001;};'use strict';var EventEmitter=require(_0x8eb2('0x0'));var Team=require(_0x8eb2('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x8eb2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8eb2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4587cc){return function(_0x1839fb,_0x5a291b,_0xbeb01c){TeamEvents[_0x8eb2('0x4')](_0x4587cc+':'+_0x1839fb['id'],_0x1839fb);TeamEvents[_0x8eb2('0x4')](_0x4587cc,_0x1839fb);_0xbeb01c(null);};}for(var e in events){if(events[_0x8eb2('0x5')](e)){var event=events[e];Team[_0x8eb2('0x6')](e,emitEvent(event));}}module[_0x8eb2('0x7')]=TeamEvents; \ No newline at end of file +var _0xcbe3=['Team','setMaxListeners','save','update','emit','hook','exports'];(function(_0x20418c,_0x2459dc){var _0x45b8b2=function(_0x3303b2){while(--_0x3303b2){_0x20418c['push'](_0x20418c['shift']());}};_0x45b8b2(++_0x2459dc);}(_0xcbe3,0xaf));var _0x3cbe=function(_0x2a406b,_0x273c86){_0x2a406b=_0x2a406b-0x0;var _0x7876cd=_0xcbe3[_0x2a406b];return _0x7876cd;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x3cbe('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0x3cbe('0x1')](0x0);var events={'afterCreate':_0x3cbe('0x2'),'afterUpdate':_0x3cbe('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1e7fd8){return function(_0x1b25b3,_0x492ce2,_0x445dc4){TeamEvents[_0x3cbe('0x4')](_0x1e7fd8+':'+_0x1b25b3['id'],_0x1b25b3);TeamEvents[_0x3cbe('0x4')](_0x1e7fd8,_0x1b25b3);_0x445dc4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x3cbe('0x5')](e,emitEvent(event));}}module[_0x3cbe('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index d1dd757..e7f3e0c 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 _0xcae8=['../../config/environment','./team.attributes','define','Team','teams','lodash','util','moment','path','rimraf'];(function(_0x5987ae,_0x202985){var _0x4a444d=function(_0x361ca1){while(--_0x361ca1){_0x5987ae['push'](_0x5987ae['shift']());}};_0x4a444d(++_0x202985);}(_0xcae8,0xcd));var _0x8cae=function(_0x13915f,_0x3d90c6){_0x13915f=_0x13915f-0x0;var _0x373181=_0xcae8[_0x13915f];return _0x373181;};'use strict';var _=require(_0x8cae('0x0'));var util=require(_0x8cae('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8cae('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8cae('0x3'));var rimraf=require(_0x8cae('0x4'));var config=require(_0x8cae('0x5'));var attributes=require(_0x8cae('0x6'));module['exports']=function(_0x264da7,_0x5cb9d8){return _0x264da7[_0x8cae('0x7')](_0x8cae('0x8'),attributes,{'tableName':_0x8cae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf38=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./team.attributes','exports','define','Team'];(function(_0x19a2eb,_0x2df439){var _0x3c8514=function(_0x2b6204){while(--_0x2b6204){_0x19a2eb['push'](_0x19a2eb['shift']());}};_0x3c8514(++_0x2df439);}(_0xdf38,0x150));var _0x8df3=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xdf38[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var util=require(_0x8df3('0x0'));var logger=require(_0x8df3('0x1'))(_0x8df3('0x2'));var moment=require(_0x8df3('0x3'));var BPromise=require(_0x8df3('0x4'));var rp=require(_0x8df3('0x5'));var fs=require('fs');var path=require(_0x8df3('0x6'));var rimraf=require('rimraf');var config=require(_0x8df3('0x7'));var attributes=require(_0x8df3('0x8'));module[_0x8df3('0x9')]=function(_0x4f6dd9,_0x149057){return _0x4f6dd9[_0x8df3('0xa')](_0x8df3('0xb'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index e61f6fb..341aa47 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 _0x2c53=['client','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','Team,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x592e40,_0x2ed011){var _0x5d4288=function(_0x366e87){while(--_0x366e87){_0x592e40['push'](_0x592e40['shift']());}};_0x5d4288(++_0x2ed011);}(_0x2c53,0x17a));var _0x32c5=function(_0x532807,_0x92d7fd){_0x532807=_0x532807-0x0;var _0x40b83f=_0x2c53[_0x532807];return _0x40b83f;};'use strict';var _=require(_0x32c5('0x0'));var util=require(_0x32c5('0x1'));var moment=require(_0x32c5('0x2'));var BPromise=require(_0x32c5('0x3'));var rs=require(_0x32c5('0x4'));var fs=require('fs');var Redis=require(_0x32c5('0x5'));var db=require(_0x32c5('0x6'))['db'];var utils=require(_0x32c5('0x7'));var logger=require(_0x32c5('0x8'))(_0x32c5('0x9'));var config=require(_0x32c5('0xa'));var jayson=require(_0x32c5('0xb'));var client=jayson[_0x32c5('0xc')]['http']({'port':0x232a});config[_0x32c5('0xd')]=_[_0x32c5('0xe')](config[_0x32c5('0xd')],{'host':_0x32c5('0xf'),'port':0x18eb});var socket=require(_0x32c5('0x10'))(new Redis(config['redis']));require(_0x32c5('0x11'))[_0x32c5('0x12')](socket);function respondWithRpcPromise(_0x13e9d9,_0x5e6dee,_0x1d8d10){return new BPromise(function(_0x2ea425,_0xa82995){return client[_0x32c5('0x13')](_0x13e9d9,_0x1d8d10)[_0x32c5('0x14')](function(_0x2c7d60){logger[_0x32c5('0x15')]('Team,\x20%s,\x20%s',_0x5e6dee,_0x32c5('0x16'));logger['debug'](_0x32c5('0x17'),_0x5e6dee,_0x32c5('0x16'),JSON[_0x32c5('0x18')](_0x2c7d60));if(_0x2c7d60['error']){if(_0x2c7d60['error']['code']===0x1f4){logger[_0x32c5('0x19')](_0x32c5('0x1a'),_0x5e6dee,_0x2c7d60[_0x32c5('0x19')][_0x32c5('0x1b')]);return _0xa82995(_0x2c7d60[_0x32c5('0x19')][_0x32c5('0x1b')]);}logger[_0x32c5('0x19')](_0x32c5('0x1a'),_0x5e6dee,_0x2c7d60[_0x32c5('0x19')]['message']);return _0x2ea425(_0x2c7d60['error'][_0x32c5('0x1b')]);}else{logger[_0x32c5('0x15')](_0x32c5('0x1a'),_0x5e6dee,_0x32c5('0x16'));_0x2ea425(_0x2c7d60[_0x32c5('0x1c')]['message']);}})[_0x32c5('0x1d')](function(_0x59cd2c){logger[_0x32c5('0x19')](_0x32c5('0x1a'),_0x5e6dee,_0x59cd2c);_0xa82995(_0x59cd2c);});});} \ No newline at end of file +var _0x4dc5=['then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./team.socket'];(function(_0x3a340f,_0x18653e){var _0x14ca55=function(_0x2e2fd6){while(--_0x2e2fd6){_0x3a340f['push'](_0x3a340f['shift']());}};_0x14ca55(++_0x18653e);}(_0x4dc5,0xd7));var _0x54dc=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x4dc5[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0x54dc('0x0'));var util=require(_0x54dc('0x1'));var moment=require(_0x54dc('0x2'));var BPromise=require(_0x54dc('0x3'));var rs=require(_0x54dc('0x4'));var fs=require('fs');var Redis=require(_0x54dc('0x5'));var db=require(_0x54dc('0x6'))['db'];var utils=require(_0x54dc('0x7'));var logger=require(_0x54dc('0x8'))(_0x54dc('0x9'));var config=require('../../config/environment');var jayson=require(_0x54dc('0xa'));var client=jayson[_0x54dc('0xb')][_0x54dc('0xc')]({'port':0x232a});config['redis']=_[_0x54dc('0xd')](config[_0x54dc('0xe')],{'host':_0x54dc('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x54dc('0xe')]));require(_0x54dc('0x10'))['register'](socket);function respondWithRpcPromise(_0x22c291,_0x183359,_0x5f0a71){return new BPromise(function(_0x209002,_0xa9a359){return client['request'](_0x22c291,_0x5f0a71)[_0x54dc('0x11')](function(_0x399aa9){logger['info'](_0x54dc('0x12'),_0x183359,_0x54dc('0x13'));logger[_0x54dc('0x14')](_0x54dc('0x15'),_0x183359,_0x54dc('0x13'),JSON[_0x54dc('0x16')](_0x399aa9));if(_0x399aa9['error']){if(_0x399aa9[_0x54dc('0x17')][_0x54dc('0x18')]===0x1f4){logger[_0x54dc('0x17')](_0x54dc('0x12'),_0x183359,_0x399aa9[_0x54dc('0x17')][_0x54dc('0x19')]);return _0xa9a359(_0x399aa9[_0x54dc('0x17')][_0x54dc('0x19')]);}logger[_0x54dc('0x17')](_0x54dc('0x12'),_0x183359,_0x399aa9[_0x54dc('0x17')]['message']);return _0x209002(_0x399aa9[_0x54dc('0x17')][_0x54dc('0x19')]);}else{logger[_0x54dc('0x1a')]('Team,\x20%s,\x20%s',_0x183359,_0x54dc('0x13'));_0x209002(_0x399aa9[_0x54dc('0x1b')][_0x54dc('0x19')]);}})[_0x54dc('0x1c')](function(_0x641aed){logger[_0x54dc('0x17')](_0x54dc('0x12'),_0x183359,_0x641aed);_0xa9a359(_0x641aed);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 228f419..34f83d4 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 _0xb62e=['removeListener','team:','./team.events','save','remove','update','emit'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xb62e,0x1de));var _0xeb62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb62e[_0x3dd15e];return _0x231fd0;};'use strict';var TeamEvents=require(_0xeb62('0x0'));var events=[_0xeb62('0x1'),_0xeb62('0x2'),_0xeb62('0x3')];function createListener(_0x57a5ba,_0x3dfdef){return function(_0x1dbacd){_0x3dfdef[_0xeb62('0x4')](_0x57a5ba,_0x1dbacd);};}function removeListener(_0x929329,_0x3c7ad5){return function(){TeamEvents[_0xeb62('0x5')](_0x929329,_0x3c7ad5);};}exports['register']=function(_0x3ec879){for(var _0x455e1a=0x0,_0x31f5ea=events['length'];_0x455e1a<_0x31f5ea;_0x455e1a++){var _0x2065a0=events[_0x455e1a];var _0xab7049=createListener(_0xeb62('0x6')+_0x2065a0,_0x3ec879);TeamEvents['on'](_0x2065a0,_0xab7049);}}; \ No newline at end of file +var _0x8546=['emit','removeListener','register','length','team:','save','remove','update'];(function(_0x158d16,_0xb2350a){var _0x119b3d=function(_0x858b33){while(--_0x858b33){_0x158d16['push'](_0x158d16['shift']());}};_0x119b3d(++_0xb2350a);}(_0x8546,0x75));var _0x6854=function(_0x1203d5,_0x49015a){_0x1203d5=_0x1203d5-0x0;var _0x3ff135=_0x8546[_0x1203d5];return _0x3ff135;};'use strict';var TeamEvents=require('./team.events');var events=[_0x6854('0x0'),_0x6854('0x1'),_0x6854('0x2')];function createListener(_0x175253,_0x25338f){return function(_0x2708ce){_0x25338f[_0x6854('0x3')](_0x175253,_0x2708ce);};}function removeListener(_0xa90d66,_0x117674){return function(){TeamEvents[_0x6854('0x4')](_0xa90d66,_0x117674);};}exports[_0x6854('0x5')]=function(_0x43765f){for(var _0x38ab8f=0x0,_0x149138=events[_0x6854('0x6')];_0x38ab8f<_0x149138;_0x38ab8f++){var _0x180f79=events[_0x38ab8f];var _0x126d83=createListener(_0x6854('0x7')+_0x180f79,_0x43765f);TeamEvents['on'](_0x180f79,_0x126d83);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 70e4295..20f615d 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 _0x2a4b=['INTEGER','exports'];(function(_0x49cb71,_0x2f0149){var _0x3a50fd=function(_0x48c304){while(--_0x48c304){_0x49cb71['push'](_0x49cb71['shift']());}};_0x3a50fd(++_0x2f0149);}(_0x2a4b,0xbb));var _0xb2a4=function(_0x13bac3,_0x204272){_0x13bac3=_0x13bac3-0x0;var _0x269f29=_0x2a4b[_0x13bac3];return _0x269f29;};'use strict';var Sequelize=require('sequelize');module[_0xb2a4('0x0')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xb2a4('0x1')]}}; \ No newline at end of file +var _0x6c5e=['exports','INTEGER','sequelize'];(function(_0xc1197a,_0x17ddf5){var _0x293bf6=function(_0x390207){while(--_0x390207){_0xc1197a['push'](_0xc1197a['shift']());}};_0x293bf6(++_0x17ddf5);}(_0x6c5e,0x1d6));var _0xe6c5=function(_0x23cd5a,_0x45de7d){_0x23cd5a=_0x23cd5a-0x0;var _0x4e4719=_0x6c5e[_0x23cd5a];return _0x4e4719;};'use strict';var Sequelize=require(_0xe6c5('0x0'));module[_0xe6c5('0x1')]={'TeamId':{'type':Sequelize[_0xe6c5('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xe6c5('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 397eba4..b2b9f1a 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 _0x5e30=['./teamVoicePrefix.attributes','exports','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x27aa10,_0x1c4f33){var _0x274268=function(_0x108316){while(--_0x108316){_0x27aa10['push'](_0x27aa10['shift']());}};_0x274268(++_0x1c4f33);}(_0x5e30,0x7b));var _0x05e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e30[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x05e3('0x0'));var util=require(_0x05e3('0x1'));var logger=require(_0x05e3('0x2'))(_0x05e3('0x3'));var moment=require(_0x05e3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x05e3('0x5'));var config=require(_0x05e3('0x6'));var attributes=require(_0x05e3('0x7'));module[_0x05e3('0x8')]=function(_0x348e2c,_0x2dd025){return _0x348e2c['define']('TeamVoicePrefix',attributes,{'tableName':_0x05e3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23a3=['../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','api','bluebird','request-promise','path','rimraf'];(function(_0xfac746,_0x50bd4c){var _0x565017=function(_0x495c6d){while(--_0x495c6d){_0xfac746['push'](_0xfac746['shift']());}};_0x565017(++_0x50bd4c);}(_0x23a3,0x131));var _0x323a=function(_0x3e24da,_0x5d6fe0){_0x3e24da=_0x3e24da-0x0;var _0x1b5968=_0x23a3[_0x3e24da];return _0x1b5968;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x323a('0x0'));var moment=require('moment');var BPromise=require(_0x323a('0x1'));var rp=require(_0x323a('0x2'));var fs=require('fs');var path=require(_0x323a('0x3'));var rimraf=require(_0x323a('0x4'));var config=require(_0x323a('0x5'));var attributes=require(_0x323a('0x6'));module[_0x323a('0x7')]=function(_0x3c1648,_0x14a418){return _0x3c1648['define'](_0x323a('0x8'),attributes,{'tableName':_0x323a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index c8c780a..ac5d0ba 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(_0x5a52,_0x342d00){var _0x219a50=function(_0x5feeb7){while(--_0x5feeb7){_0x5a52['push'](_0x5a52['shift']());}};_0x219a50(++_0x342d00);}(_0x70e0,0x17b));var _0x070e=function(_0xa20d3d,_0x26685c){_0xa20d3d=_0xa20d3d-0x0;var _0x292aed=_0x70e0[_0xa20d3d];return _0x292aed;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3d1986,_0x38c8a6){var _0xa826df=function(_0x121ed2){while(--_0x121ed2){_0x3d1986['push'](_0x3d1986['shift']());}};_0xa826df(++_0x38c8a6);}(_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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 89a7bb9..7c50f50 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 _0xe90b=['INTEGER'];(function(_0x1b6311,_0x42ec20){var _0x25aab6=function(_0x139a77){while(--_0x139a77){_0x1b6311['push'](_0x1b6311['shift']());}};_0x25aab6(++_0x42ec20);}(_0xe90b,0xd9));var _0xbe90=function(_0x49237d,_0xbe0b7f){_0x49237d=_0x49237d-0x0;var _0x487149=_0xe90b[_0x49237d];return _0x487149;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xbe90('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x295d=['exports','INTEGER'];(function(_0x11c57d,_0x1ce80a){var _0x8762ae=function(_0x3ae9d9){while(--_0x3ae9d9){_0x11c57d['push'](_0x11c57d['shift']());}};_0x8762ae(++_0x1ce80a);}(_0x295d,0x8e));var _0xd295=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x295d[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0xd295('0x0')]={'penalty':{'type':Sequelize[_0xd295('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 dfed1d9..4c3cee2 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 _0xdb4b=['rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','util','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb4b,0xd7));var _0xbdb4=function(_0x552352,_0x51e3b0){_0x552352=_0x552352-0x0;var _0x1e0d71=_0xdb4b[_0x552352];return _0x1e0d71;};'use strict';var _=require('lodash');var util=require(_0xbdb4('0x0'));var logger=require('../../config/logger')(_0xbdb4('0x1'));var moment=require(_0xbdb4('0x2'));var BPromise=require(_0xbdb4('0x3'));var rp=require(_0xbdb4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbdb4('0x5'));var config=require(_0xbdb4('0x6'));var attributes=require(_0xbdb4('0x7'));module[_0xbdb4('0x8')]=function(_0x1c69ed,_0x3c8252){return _0x1c69ed[_0xbdb4('0x9')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc65=['rimraf','exports','define','TeamVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4ba611,_0x1190e1){var _0x4732b6=function(_0x248718){while(--_0x248718){_0x4ba611['push'](_0x4ba611['shift']());}};_0x4732b6(++_0x1190e1);}(_0xfc65,0x1b4));var _0x5fc6=function(_0x4b229d,_0x4208af){_0x4b229d=_0x4b229d-0x0;var _0xdbf868=_0xfc65[_0x4b229d];return _0xdbf868;};'use strict';var _=require(_0x5fc6('0x0'));var util=require(_0x5fc6('0x1'));var logger=require(_0x5fc6('0x2'))(_0x5fc6('0x3'));var moment=require(_0x5fc6('0x4'));var BPromise=require(_0x5fc6('0x5'));var rp=require(_0x5fc6('0x6'));var fs=require('fs');var path=require(_0x5fc6('0x7'));var rimraf=require(_0x5fc6('0x8'));var config=require('../../config/environment');var attributes=require('./teamVoiceQueue.attributes');module[_0x5fc6('0x9')]=function(_0x2e1c2b,_0x3e9bf3){return _0x2e1c2b[_0x5fc6('0xa')](_0x5fc6('0xb'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 991baa4..c661438 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 _0xec15=['debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x43d966,_0x25ff80){var _0x252340=function(_0x65ed76){while(--_0x65ed76){_0x43d966['push'](_0x43d966['shift']());}};_0x252340(++_0x25ff80);}(_0xec15,0x1a8));var _0x5ec1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec15[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x5ec1('0x0'));var moment=require(_0x5ec1('0x1'));var BPromise=require(_0x5ec1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ec1('0x3'));var db=require(_0x5ec1('0x4'))['db'];var utils=require(_0x5ec1('0x5'));var logger=require(_0x5ec1('0x6'))('rpc');var config=require(_0x5ec1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ec1('0x8')][_0x5ec1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bad40,_0xab52a8,_0x519088){return new BPromise(function(_0xf59488,_0x1f2c89){return client[_0x5ec1('0xa')](_0x3bad40,_0x519088)[_0x5ec1('0xb')](function(_0x13ffed){logger[_0x5ec1('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0xab52a8,'request\x20sent');logger[_0x5ec1('0xd')](_0x5ec1('0xe'),_0xab52a8,_0x5ec1('0xf'),JSON[_0x5ec1('0x10')](_0x13ffed));if(_0x13ffed[_0x5ec1('0x11')]){if(_0x13ffed[_0x5ec1('0x11')][_0x5ec1('0x12')]===0x1f4){logger['error'](_0x5ec1('0x13'),_0xab52a8,_0x13ffed[_0x5ec1('0x11')]['message']);return _0x1f2c89(_0x13ffed['error']['message']);}logger[_0x5ec1('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0xab52a8,_0x13ffed[_0x5ec1('0x11')][_0x5ec1('0x14')]);return _0xf59488(_0x13ffed[_0x5ec1('0x11')][_0x5ec1('0x14')]);}else{logger[_0x5ec1('0xc')](_0x5ec1('0x13'),_0xab52a8,_0x5ec1('0xf'));_0xf59488(_0x13ffed[_0x5ec1('0x15')][_0x5ec1('0x14')]);}})[_0x5ec1('0x16')](function(_0x38e39f){logger[_0x5ec1('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0xab52a8,_0x38e39f);_0x1f2c89(_0x38e39f);});});} \ No newline at end of file +var _0xe927=['result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','error','code','TeamVoiceQueue,\x20%s,\x20%s','message'];(function(_0x33c8ac,_0x5f0592){var _0x1e6d0d=function(_0x443301){while(--_0x443301){_0x33c8ac['push'](_0x33c8ac['shift']());}};_0x1e6d0d(++_0x5f0592);}(_0xe927,0x141));var _0x7e92=function(_0x5393a6,_0x3c972d){_0x5393a6=_0x5393a6-0x0;var _0x477463=_0xe927[_0x5393a6];return _0x477463;};'use strict';var _=require(_0x7e92('0x0'));var util=require(_0x7e92('0x1'));var moment=require(_0x7e92('0x2'));var BPromise=require('bluebird');var rs=require(_0x7e92('0x3'));var fs=require('fs');var Redis=require(_0x7e92('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e92('0x5'));var logger=require(_0x7e92('0x6'))(_0x7e92('0x7'));var config=require(_0x7e92('0x8'));var jayson=require(_0x7e92('0x9'));var client=jayson[_0x7e92('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x66929a,_0x2e6ca7,_0x4b0073){return new BPromise(function(_0x546ff9,_0x1e512f){return client['request'](_0x66929a,_0x4b0073)[_0x7e92('0xb')](function(_0xebb1e8){logger[_0x7e92('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2e6ca7,_0x7e92('0xd'));logger[_0x7e92('0xe')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2e6ca7,_0x7e92('0xd'),JSON['stringify'](_0xebb1e8));if(_0xebb1e8[_0x7e92('0xf')]){if(_0xebb1e8[_0x7e92('0xf')][_0x7e92('0x10')]===0x1f4){logger[_0x7e92('0xf')](_0x7e92('0x11'),_0x2e6ca7,_0xebb1e8['error'][_0x7e92('0x12')]);return _0x1e512f(_0xebb1e8[_0x7e92('0xf')][_0x7e92('0x12')]);}logger[_0x7e92('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2e6ca7,_0xebb1e8['error'][_0x7e92('0x12')]);return _0x546ff9(_0xebb1e8[_0x7e92('0xf')][_0x7e92('0x12')]);}else{logger[_0x7e92('0xc')](_0x7e92('0x11'),_0x2e6ca7,'request\x20sent');_0x546ff9(_0xebb1e8[_0x7e92('0x13')][_0x7e92('0x12')]);}})['catch'](function(_0x34ed11){logger[_0x7e92('0xf')](_0x7e92('0x11'),_0x2e6ca7,_0x34ed11);_0x1e512f(_0x34ed11);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 89c682f..cfd8867 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 _0x57ef=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x57ef,0xdb));var _0xf57e=function(_0x296e98,_0x543f10){_0x296e98=_0x296e98-0x0;var _0x330e0d=_0x57ef[_0x296e98];return _0x330e0d;};'use strict';var multer=require('multer');var util=require(_0xf57e('0x0'));var path=require(_0xf57e('0x1'));var timeout=require(_0xf57e('0x2'));var express=require(_0xf57e('0x3'));var router=express[_0xf57e('0x4')]();var fs_extra=require(_0xf57e('0x5'));var auth=require(_0xf57e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf57e('0x7'));var controller=require(_0xf57e('0x8'));router[_0xf57e('0x9')]('/',auth[_0xf57e('0xa')](),controller[_0xf57e('0xb')]);router[_0xf57e('0x9')](_0xf57e('0xc'),auth[_0xf57e('0xa')](),controller['show']);router[_0xf57e('0xd')]('/',auth[_0xf57e('0xa')](),controller[_0xf57e('0xe')]);router[_0xf57e('0xf')](_0xf57e('0xc'),auth['isAuthenticated'](),controller[_0xf57e('0x10')]);router[_0xf57e('0x11')]('/:id',auth[_0xf57e('0xa')](),controller[_0xf57e('0x12')]);module[_0xf57e('0x13')]=router; \ No newline at end of file +var _0x7374=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x5d70c6,_0xe89511){var _0x209d13=function(_0x396019){while(--_0x396019){_0x5d70c6['push'](_0x5d70c6['shift']());}};_0x209d13(++_0xe89511);}(_0x7374,0x1b9));var _0x4737=function(_0xd6eca6,_0x5d817b){_0xd6eca6=_0xd6eca6-0x0;var _0x5e16d2=_0x7374[_0xd6eca6];return _0x5e16d2;};'use strict';var multer=require(_0x4737('0x0'));var util=require(_0x4737('0x1'));var path=require(_0x4737('0x2'));var timeout=require(_0x4737('0x3'));var express=require(_0x4737('0x4'));var router=express['Router']();var fs_extra=require(_0x4737('0x5'));var auth=require(_0x4737('0x6'));var interaction=require(_0x4737('0x7'));var config=require(_0x4737('0x8'));var controller=require('./template.controller');router['get']('/',auth[_0x4737('0x9')](),controller[_0x4737('0xa')]);router[_0x4737('0xb')](_0x4737('0xc'),auth['isAuthenticated'](),controller[_0x4737('0xd')]);router[_0x4737('0xe')]('/',auth[_0x4737('0x9')](),controller[_0x4737('0xf')]);router[_0x4737('0x10')]('/:id',auth[_0x4737('0x9')](),controller[_0x4737('0x11')]);router[_0x4737('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4737('0x13')]);module[_0x4737('0x14')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 70a85f9..25fa0eb 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 _0xd32a=['exports','STRING','TEXT','sequelize'];(function(_0x4b9f85,_0x35930b){var _0x587c22=function(_0x1974f8){while(--_0x1974f8){_0x4b9f85['push'](_0x4b9f85['shift']());}};_0x587c22(++_0x35930b);}(_0xd32a,0x14f));var _0xad32=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xd32a[_0x9dfc10];return _0x4f938a;};'use strict';var Sequelize=require(_0xad32('0x0'));module[_0xad32('0x1')]={'name':{'type':Sequelize[_0xad32('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xad32('0x3')]}}; \ No newline at end of file +var _0x40e7=['TEXT','STRING'];(function(_0x5d1223,_0x142e40){var _0x2df976=function(_0x120f8d){while(--_0x120f8d){_0x5d1223['push'](_0x5d1223['shift']());}};_0x2df976(++_0x142e40);}(_0x40e7,0x9b));var _0x740e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x40e7[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x740e('0x0')]},'description':{'type':Sequelize[_0x740e('0x0')]},'html':{'type':Sequelize[_0x740e('0x1')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 3af6012..4fcffb7 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 _0x5909=['sort','filter','where','merge','type','options','Template','includeAll','include','catch','show','params','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','destroy','then','Templates','error','stack','name','send','index','map','rawAttributes','fieldName','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x5909,0x192));var _0x9590=function(_0x19e928,_0x26a0e4){_0x19e928=_0x19e928-0x0;var _0x4e941f=_0x5909[_0x19e928];return _0x4e941f;};'use strict';var emlformat=require(_0x9590('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9590('0x1'));var jsonpatch=require(_0x9590('0x2'));var rp=require(_0x9590('0x3'));var moment=require('moment');var BPromise=require(_0x9590('0x4'));var Mustache=require(_0x9590('0x5'));var util=require('util');var path=require(_0x9590('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9590('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9590('0x8'));var crypto=require(_0x9590('0x9'));var jsforce=require(_0x9590('0xa'));var deskjs=require(_0x9590('0xb'));var toCsv=require(_0x9590('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9590('0xd'));var authService=require(_0x9590('0xe'));var qs=require(_0x9590('0xf'));var as=require(_0x9590('0x10'));var hardwareService=require(_0x9590('0x11'));var logger=require('../../config/logger')(_0x9590('0x12'));var utils=require(_0x9590('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9590('0x14'));var db=require(_0x9590('0x15'))['db'];function respondWithStatusCode(_0x48acda,_0x18c05f){_0x18c05f=_0x18c05f||0xcc;return function(_0x1341ca){if(_0x1341ca){return _0x48acda[_0x9590('0x16')](_0x18c05f);}return _0x48acda[_0x9590('0x17')](_0x18c05f)[_0x9590('0x18')]();};}function respondWithResult(_0xfc81b8,_0x5c4448){_0x5c4448=_0x5c4448||0xc8;return function(_0x15d0fc){if(_0x15d0fc){return _0xfc81b8['status'](_0x5c4448)[_0x9590('0x19')](_0x15d0fc);}};}function respondWithFilteredResult(_0x4c3379,_0x3cbad9){return function(_0x112362){if(_0x112362){var _0x50506c=typeof _0x3cbad9[_0x9590('0x1a')]===_0x9590('0x1b')&&typeof _0x3cbad9[_0x9590('0x1c')]===_0x9590('0x1b');var _0x10165e=_0x112362[_0x9590('0x1d')];var _0xef3c2c=_0x50506c?0x0:_0x3cbad9[_0x9590('0x1a')];var _0x918ef8=_0x50506c?_0x112362[_0x9590('0x1d')]:_0x3cbad9['offset']+_0x3cbad9[_0x9590('0x1c')];var _0x147ac7;if(_0x918ef8>=_0x10165e){_0x918ef8=_0x10165e;_0x147ac7=0xc8;}else{_0x147ac7=0xce;}_0x4c3379[_0x9590('0x17')](_0x147ac7);return _0x4c3379['set']('Content-Range',_0xef3c2c+'-'+_0x918ef8+'/'+_0x10165e)[_0x9590('0x19')](_0x112362);}return null;};}function patchUpdates(_0x1c60c6){return function(_0x49ea4f){try{jsonpatch['apply'](_0x49ea4f,_0x1c60c6,!![]);}catch(_0x48d12e){return BPromise[_0x9590('0x1e')](_0x48d12e);}return _0x49ea4f[_0x9590('0x1f')]();};}function saveUpdates(_0x5f49ab,_0x3a6a52){return function(_0x1977b6){if(_0x1977b6){return _0x1977b6[_0x9590('0x20')](_0x5f49ab)['then'](function(_0x822cde){return _0x822cde;});}return null;};}function removeEntity(_0x4bf260,_0x3953c3){return function(_0x3bdd6e){if(_0x3bdd6e){return _0x3bdd6e[_0x9590('0x21')]()[_0x9590('0x22')](function(){var _0x21c6ff=_0x3bdd6e['get']({'plain':!![]});var _0x3524df=_0x9590('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x3524df,'resourceId':_0x21c6ff['id']}})[_0x9590('0x22')](function(){return _0x3bdd6e;});})[_0x9590('0x22')](function(){_0x4bf260[_0x9590('0x17')](0xcc)[_0x9590('0x18')]();});}};}function handleEntityNotFound(_0xe5da47,_0x54660a){return function(_0x562432){if(!_0x562432){_0xe5da47[_0x9590('0x16')](0x194);}return _0x562432;};}function handleError(_0x9e788e,_0x1280ae){_0x1280ae=_0x1280ae||0x1f4;return function(_0x3ce1dd){logger[_0x9590('0x24')](_0x3ce1dd[_0x9590('0x25')]);if(_0x3ce1dd['name']){delete _0x3ce1dd[_0x9590('0x26')];}_0x9e788e[_0x9590('0x17')](_0x1280ae)[_0x9590('0x27')](_0x3ce1dd);};}exports[_0x9590('0x28')]=function(_0x5470e9,_0x545c81){var _0x18e77d={},_0x215df4={},_0x49f743={'count':0x0,'rows':[]};var _0x564978=_[_0x9590('0x29')](db['Template'][_0x9590('0x2a')],function(_0x4749a3){return{'name':_0x4749a3[_0x9590('0x2b')],'type':_0x4749a3['type']['key']};});_0x215df4['model']=_[_0x9590('0x29')](_0x564978,'name');_0x215df4[_0x9590('0x2c')]=_[_0x9590('0x2d')](_0x5470e9[_0x9590('0x2c')]);_0x215df4[_0x9590('0x2e')]=_[_0x9590('0x2f')](_0x215df4['model'],_0x215df4[_0x9590('0x2c')]);_0x18e77d[_0x9590('0x30')]=_[_0x9590('0x2f')](_0x215df4['model'],qs[_0x9590('0x31')](_0x5470e9['query'][_0x9590('0x31')]));_0x18e77d[_0x9590('0x30')]=_0x18e77d[_0x9590('0x30')]['length']?_0x18e77d[_0x9590('0x30')]:_0x215df4[_0x9590('0x32')];if(!_0x5470e9[_0x9590('0x2c')][_0x9590('0x33')](_0x9590('0x34'))){_0x18e77d['limit']=qs[_0x9590('0x1c')](_0x5470e9[_0x9590('0x2c')]['limit']);_0x18e77d[_0x9590('0x1a')]=qs[_0x9590('0x1a')](_0x5470e9[_0x9590('0x2c')]['offset']);}_0x18e77d[_0x9590('0x35')]=qs[_0x9590('0x36')](_0x5470e9[_0x9590('0x2c')][_0x9590('0x36')]);_0x18e77d['where']=qs[_0x9590('0x2e')](_['pick'](_0x5470e9[_0x9590('0x2c')],_0x215df4['filters']),_0x564978);if(_0x5470e9[_0x9590('0x2c')][_0x9590('0x37')]){_0x18e77d[_0x9590('0x38')]=_[_0x9590('0x39')](_0x18e77d['where'],{'$or':_[_0x9590('0x29')](_0x564978,function(_0x4f7f24){if(_0x4f7f24[_0x9590('0x3a')]!=='VIRTUAL'){var _0x538c5e={};_0x538c5e[_0x4f7f24[_0x9590('0x26')]]={'$like':'%'+_0x5470e9[_0x9590('0x2c')]['filter']+'%'};return _0x538c5e;}})});}_0x18e77d=_[_0x9590('0x39')]({},_0x18e77d,_0x5470e9[_0x9590('0x3b')]);var _0x5850b1={'where':_0x18e77d[_0x9590('0x38')]};return db[_0x9590('0x3c')][_0x9590('0x1d')](_0x5850b1)[_0x9590('0x22')](function(_0x59313c){_0x49f743[_0x9590('0x1d')]=_0x59313c;if(_0x5470e9[_0x9590('0x2c')][_0x9590('0x3d')]){_0x18e77d[_0x9590('0x3e')]=[{'all':!![]}];}return db[_0x9590('0x3c')]['findAll'](_0x18e77d);})['then'](function(_0xec97ec){_0x49f743['rows']=_0xec97ec;return _0x49f743;})[_0x9590('0x22')](respondWithFilteredResult(_0x545c81,_0x18e77d))[_0x9590('0x3f')](handleError(_0x545c81,null));};exports[_0x9590('0x40')]=function(_0x43d274,_0x5d6687){var _0x3902cd={'raw':!![],'where':{'id':_0x43d274[_0x9590('0x41')]['id']}},_0x3cdd04={};_0x3cdd04[_0x9590('0x32')]=_[_0x9590('0x2d')](db[_0x9590('0x3c')]['rawAttributes']);_0x3cdd04[_0x9590('0x2c')]=_[_0x9590('0x2d')](_0x43d274[_0x9590('0x2c')]);_0x3cdd04[_0x9590('0x2e')]=_['intersection'](_0x3cdd04[_0x9590('0x32')],_0x3cdd04[_0x9590('0x2c')]);_0x3902cd[_0x9590('0x30')]=_[_0x9590('0x2f')](_0x3cdd04[_0x9590('0x32')],qs[_0x9590('0x31')](_0x43d274[_0x9590('0x2c')][_0x9590('0x31')]));_0x3902cd[_0x9590('0x30')]=_0x3902cd['attributes'][_0x9590('0x42')]?_0x3902cd[_0x9590('0x30')]:_0x3cdd04[_0x9590('0x32')];if(_0x43d274['query'][_0x9590('0x3d')]){_0x3902cd[_0x9590('0x3e')]=[{'all':!![]}];}_0x3902cd=_[_0x9590('0x39')]({},_0x3902cd,_0x43d274[_0x9590('0x3b')]);return db[_0x9590('0x3c')][_0x9590('0x43')](_0x3902cd)['then'](handleEntityNotFound(_0x5d6687,null))[_0x9590('0x22')](respondWithResult(_0x5d6687,null))['catch'](handleError(_0x5d6687,null));};exports[_0x9590('0x44')]=function(_0x4a0968,_0x4242cd){return db[_0x9590('0x3c')]['create'](_0x4a0968['body'],{})[_0x9590('0x22')](function(_0x73b7e1){var _0x1b4c5e=_0x4a0968[_0x9590('0x45')][_0x9590('0x46')]({'plain':!![]});if(!_0x1b4c5e)throw new Error(_0x9590('0x47'));if(_0x1b4c5e['role']===_0x9590('0x45')){var _0x3712b9=_0x73b7e1[_0x9590('0x46')]({'plain':!![]});var _0x2a4d29=_0x9590('0x23');return db[_0x9590('0x48')]['find']({'where':{'name':_0x2a4d29,'userProfileId':_0x1b4c5e['userProfileId']},'raw':!![]})[_0x9590('0x22')](function(_0x54778d){if(_0x54778d&&_0x54778d[_0x9590('0x49')]===0x0){return db[_0x9590('0x4a')]['create']({'name':_0x3712b9[_0x9590('0x26')],'resourceId':_0x3712b9['id'],'type':_0x54778d['name'],'sectionId':_0x54778d['id']},{})[_0x9590('0x22')](function(){return _0x73b7e1;});}else{return _0x73b7e1;}})[_0x9590('0x3f')](function(_0x1d472a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d472a);throw _0x1d472a;});}return _0x73b7e1;})[_0x9590('0x22')](respondWithResult(_0x4242cd,0xc9))[_0x9590('0x3f')](handleError(_0x4242cd,null));};exports[_0x9590('0x20')]=function(_0x10ffd5,_0x23ec7d){if(_0x10ffd5[_0x9590('0x4b')]['id']){delete _0x10ffd5[_0x9590('0x4b')]['id'];}return db[_0x9590('0x3c')]['find']({'where':{'id':_0x10ffd5['params']['id']}})['then'](handleEntityNotFound(_0x23ec7d,null))[_0x9590('0x22')](saveUpdates(_0x10ffd5[_0x9590('0x4b')],null))[_0x9590('0x22')](respondWithResult(_0x23ec7d,null))['catch'](handleError(_0x23ec7d,null));};exports[_0x9590('0x21')]=function(_0x248f17,_0x4836bb){return db[_0x9590('0x3c')][_0x9590('0x43')]({'where':{'id':_0x248f17['params']['id']}})[_0x9590('0x22')](handleEntityNotFound(_0x4836bb,null))[_0x9590('0x22')](removeEntity(_0x4836bb,null))[_0x9590('0x3f')](handleError(_0x4836bb,null));}; \ No newline at end of file +var _0x9478=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','keys','rawAttributes','filters','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','stack','name','send','index','map','Template','fieldName','type','key','model','query','intersection','attributes','fields'];(function(_0x4f08b0,_0x337546){var _0x10659b=function(_0x5a1e20){while(--_0x5a1e20){_0x4f08b0['push'](_0x4f08b0['shift']());}};_0x10659b(++_0x337546);}(_0x9478,0x1c5));var _0x8947=function(_0x55510a,_0x4ac898){_0x55510a=_0x55510a-0x0;var _0x3c721e=_0x9478[_0x55510a];return _0x3c721e;};'use strict';var emlformat=require(_0x8947('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8947('0x1'));var jsonpatch=require(_0x8947('0x2'));var rp=require(_0x8947('0x3'));var moment=require(_0x8947('0x4'));var BPromise=require(_0x8947('0x5'));var Mustache=require(_0x8947('0x6'));var util=require(_0x8947('0x7'));var path=require(_0x8947('0x8'));var sox=require(_0x8947('0x9'));var csv=require(_0x8947('0xa'));var ejs=require(_0x8947('0xb'));var fs=require('fs');var fs_extra=require(_0x8947('0xc'));var _=require(_0x8947('0xd'));var squel=require(_0x8947('0xe'));var crypto=require(_0x8947('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8947('0x10'));var Papa=require(_0x8947('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8947('0x12'));var as=require(_0x8947('0x13'));var hardwareService=require(_0x8947('0x14'));var logger=require(_0x8947('0x15'))(_0x8947('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8947('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14f4cb,_0x5c40ad){_0x5c40ad=_0x5c40ad||0xcc;return function(_0x212336){if(_0x212336){return _0x14f4cb[_0x8947('0x18')](_0x5c40ad);}return _0x14f4cb['status'](_0x5c40ad)[_0x8947('0x19')]();};}function respondWithResult(_0x2dccef,_0x40d32e){_0x40d32e=_0x40d32e||0xc8;return function(_0x1ace12){if(_0x1ace12){return _0x2dccef['status'](_0x40d32e)[_0x8947('0x1a')](_0x1ace12);}};}function respondWithFilteredResult(_0x4b8dda,_0x590825){return function(_0x18ba99){if(_0x18ba99){var _0x3f9068=typeof _0x590825[_0x8947('0x1b')]===_0x8947('0x1c')&&typeof _0x590825[_0x8947('0x1d')]===_0x8947('0x1c');var _0x149c96=_0x18ba99[_0x8947('0x1e')];var _0x59166d=_0x3f9068?0x0:_0x590825[_0x8947('0x1b')];var _0x24d227=_0x3f9068?_0x18ba99['count']:_0x590825[_0x8947('0x1b')]+_0x590825[_0x8947('0x1d')];var _0x308549;if(_0x24d227>=_0x149c96){_0x24d227=_0x149c96;_0x308549=0xc8;}else{_0x308549=0xce;}_0x4b8dda[_0x8947('0x1f')](_0x308549);return _0x4b8dda[_0x8947('0x20')](_0x8947('0x21'),_0x59166d+'-'+_0x24d227+'/'+_0x149c96)[_0x8947('0x1a')](_0x18ba99);}return null;};}function patchUpdates(_0x3c34af){return function(_0x416294){try{jsonpatch[_0x8947('0x22')](_0x416294,_0x3c34af,!![]);}catch(_0x4c2d21){return BPromise[_0x8947('0x23')](_0x4c2d21);}return _0x416294[_0x8947('0x24')]();};}function saveUpdates(_0x9bd384,_0x255130){return function(_0xbb5606){if(_0xbb5606){return _0xbb5606[_0x8947('0x25')](_0x9bd384)[_0x8947('0x26')](function(_0x151581){return _0x151581;});}return null;};}function removeEntity(_0x569ada,_0x3a7cb9){return function(_0x1323d4){if(_0x1323d4){return _0x1323d4[_0x8947('0x27')]()[_0x8947('0x26')](function(){var _0x5cfab3=_0x1323d4[_0x8947('0x28')]({'plain':!![]});var _0x39d72a=_0x8947('0x29');return db[_0x8947('0x2a')][_0x8947('0x27')]({'where':{'type':_0x39d72a,'resourceId':_0x5cfab3['id']}})[_0x8947('0x26')](function(){return _0x1323d4;});})[_0x8947('0x26')](function(){_0x569ada['status'](0xcc)[_0x8947('0x19')]();});}};}function handleEntityNotFound(_0x591f39,_0x149396){return function(_0x202ed9){if(!_0x202ed9){_0x591f39[_0x8947('0x18')](0x194);}return _0x202ed9;};}function handleError(_0x6eda4c,_0x5a3314){_0x5a3314=_0x5a3314||0x1f4;return function(_0x263b1d){logger['error'](_0x263b1d[_0x8947('0x2b')]);if(_0x263b1d['name']){delete _0x263b1d[_0x8947('0x2c')];}_0x6eda4c[_0x8947('0x1f')](_0x5a3314)[_0x8947('0x2d')](_0x263b1d);};}exports[_0x8947('0x2e')]=function(_0x40ebaa,_0x1b9be4){var _0x18fe80={},_0x3aa23b={},_0x530cc2={'count':0x0,'rows':[]};var _0x3e933b=_[_0x8947('0x2f')](db[_0x8947('0x30')]['rawAttributes'],function(_0x4b827f){return{'name':_0x4b827f[_0x8947('0x31')],'type':_0x4b827f[_0x8947('0x32')][_0x8947('0x33')]};});_0x3aa23b[_0x8947('0x34')]=_[_0x8947('0x2f')](_0x3e933b,_0x8947('0x2c'));_0x3aa23b[_0x8947('0x35')]=_['keys'](_0x40ebaa['query']);_0x3aa23b['filters']=_[_0x8947('0x36')](_0x3aa23b[_0x8947('0x34')],_0x3aa23b['query']);_0x18fe80[_0x8947('0x37')]=_['intersection'](_0x3aa23b[_0x8947('0x34')],qs['fields'](_0x40ebaa['query'][_0x8947('0x38')]));_0x18fe80[_0x8947('0x37')]=_0x18fe80[_0x8947('0x37')][_0x8947('0x39')]?_0x18fe80[_0x8947('0x37')]:_0x3aa23b['model'];if(!_0x40ebaa[_0x8947('0x35')][_0x8947('0x3a')](_0x8947('0x3b'))){_0x18fe80[_0x8947('0x1d')]=qs[_0x8947('0x1d')](_0x40ebaa['query'][_0x8947('0x1d')]);_0x18fe80[_0x8947('0x1b')]=qs['offset'](_0x40ebaa[_0x8947('0x35')][_0x8947('0x1b')]);}_0x18fe80[_0x8947('0x3c')]=qs[_0x8947('0x3d')](_0x40ebaa[_0x8947('0x35')][_0x8947('0x3d')]);_0x18fe80[_0x8947('0x3e')]=qs['filters'](_[_0x8947('0x3f')](_0x40ebaa[_0x8947('0x35')],_0x3aa23b['filters']),_0x3e933b);if(_0x40ebaa[_0x8947('0x35')][_0x8947('0x40')]){_0x18fe80[_0x8947('0x3e')]=_[_0x8947('0x41')](_0x18fe80[_0x8947('0x3e')],{'$or':_[_0x8947('0x2f')](_0x3e933b,function(_0x582192){if(_0x582192[_0x8947('0x32')]!==_0x8947('0x42')){var _0x16a00f={};_0x16a00f[_0x582192[_0x8947('0x2c')]]={'$like':'%'+_0x40ebaa[_0x8947('0x35')][_0x8947('0x40')]+'%'};return _0x16a00f;}})});}_0x18fe80=_[_0x8947('0x41')]({},_0x18fe80,_0x40ebaa[_0x8947('0x43')]);var _0x2ec4eb={'where':_0x18fe80[_0x8947('0x3e')]};return db[_0x8947('0x30')]['count'](_0x2ec4eb)[_0x8947('0x26')](function(_0x229b3f){_0x530cc2[_0x8947('0x1e')]=_0x229b3f;if(_0x40ebaa[_0x8947('0x35')][_0x8947('0x44')]){_0x18fe80[_0x8947('0x45')]=[{'all':!![]}];}return db['Template'][_0x8947('0x46')](_0x18fe80);})[_0x8947('0x26')](function(_0x556877){_0x530cc2['rows']=_0x556877;return _0x530cc2;})['then'](respondWithFilteredResult(_0x1b9be4,_0x18fe80))[_0x8947('0x47')](handleError(_0x1b9be4,null));};exports['show']=function(_0x57d09c,_0x2e6a55){var _0x3d7205={'raw':!![],'where':{'id':_0x57d09c['params']['id']}},_0x1eec50={};_0x1eec50[_0x8947('0x34')]=_[_0x8947('0x48')](db[_0x8947('0x30')][_0x8947('0x49')]);_0x1eec50[_0x8947('0x35')]=_[_0x8947('0x48')](_0x57d09c[_0x8947('0x35')]);_0x1eec50[_0x8947('0x4a')]=_['intersection'](_0x1eec50['model'],_0x1eec50['query']);_0x3d7205['attributes']=_[_0x8947('0x36')](_0x1eec50[_0x8947('0x34')],qs['fields'](_0x57d09c[_0x8947('0x35')][_0x8947('0x38')]));_0x3d7205[_0x8947('0x37')]=_0x3d7205['attributes']['length']?_0x3d7205[_0x8947('0x37')]:_0x1eec50[_0x8947('0x34')];if(_0x57d09c[_0x8947('0x35')]['includeAll']){_0x3d7205[_0x8947('0x45')]=[{'all':!![]}];}_0x3d7205=_[_0x8947('0x41')]({},_0x3d7205,_0x57d09c['options']);return db[_0x8947('0x30')][_0x8947('0x4b')](_0x3d7205)['then'](handleEntityNotFound(_0x2e6a55,null))[_0x8947('0x26')](respondWithResult(_0x2e6a55,null))[_0x8947('0x47')](handleError(_0x2e6a55,null));};exports[_0x8947('0x4c')]=function(_0x46d84b,_0x40e574){return db['Template']['create'](_0x46d84b[_0x8947('0x4d')],{})['then'](function(_0x2de66b){var _0x4a1aca=_0x46d84b[_0x8947('0x4e')]['get']({'plain':!![]});if(!_0x4a1aca)throw new Error(_0x8947('0x4f'));if(_0x4a1aca['role']===_0x8947('0x4e')){var _0x59f6aa=_0x2de66b['get']({'plain':!![]});var _0x3c9c51=_0x8947('0x29');return db[_0x8947('0x50')][_0x8947('0x4b')]({'where':{'name':_0x3c9c51,'userProfileId':_0x4a1aca['userProfileId']},'raw':!![]})[_0x8947('0x26')](function(_0x39f468){if(_0x39f468&&_0x39f468[_0x8947('0x51')]===0x0){return db[_0x8947('0x2a')][_0x8947('0x4c')]({'name':_0x59f6aa[_0x8947('0x2c')],'resourceId':_0x59f6aa['id'],'type':_0x39f468[_0x8947('0x2c')],'sectionId':_0x39f468['id']},{})[_0x8947('0x26')](function(){return _0x2de66b;});}else{return _0x2de66b;}})[_0x8947('0x47')](function(_0x440b41){logger[_0x8947('0x52')](_0x8947('0x53'),_0x440b41);throw _0x440b41;});}return _0x2de66b;})[_0x8947('0x26')](respondWithResult(_0x40e574,0xc9))[_0x8947('0x47')](handleError(_0x40e574,null));};exports['update']=function(_0x29de39,_0x2ed01e){if(_0x29de39['body']['id']){delete _0x29de39[_0x8947('0x4d')]['id'];}return db[_0x8947('0x30')]['find']({'where':{'id':_0x29de39[_0x8947('0x54')]['id']}})[_0x8947('0x26')](handleEntityNotFound(_0x2ed01e,null))[_0x8947('0x26')](saveUpdates(_0x29de39[_0x8947('0x4d')],null))[_0x8947('0x26')](respondWithResult(_0x2ed01e,null))[_0x8947('0x47')](handleError(_0x2ed01e,null));};exports['destroy']=function(_0x10ea38,_0x3c4ee8){return db['Template'][_0x8947('0x4b')]({'where':{'id':_0x10ea38[_0x8947('0x54')]['id']}})['then'](handleEntityNotFound(_0x3c4ee8,null))[_0x8947('0x26')](removeEntity(_0x3c4ee8,null))[_0x8947('0x47')](handleError(_0x3c4ee8,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index b6127e1..e061650 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 _0x61c3=['Template','tools_templates','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./template.attributes','define'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x61c3,0x1f1));var _0x361c=function(_0x277a25,_0x361f87){_0x277a25=_0x277a25-0x0;var _0x53580e=_0x61c3[_0x277a25];return _0x53580e;};'use strict';var _=require(_0x361c('0x0'));var util=require('util');var logger=require(_0x361c('0x1'))('api');var moment=require(_0x361c('0x2'));var BPromise=require(_0x361c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x361c('0x4'));var rimraf=require(_0x361c('0x5'));var config=require(_0x361c('0x6'));var attributes=require(_0x361c('0x7'));module['exports']=function(_0x29ccf6,_0x21fe99){return _0x29ccf6[_0x361c('0x8')](_0x361c('0x9'),attributes,{'tableName':_0x361c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a43=['./template.attributes','define','Template','lodash','api','moment','bluebird','path','../../config/environment'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0x1a43,0x1c5));var _0x31a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a43[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x31a4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x31a4('0x1'));var moment=require(_0x31a4('0x2'));var BPromise=require(_0x31a4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31a4('0x4'));var rimraf=require('rimraf');var config=require(_0x31a4('0x5'));var attributes=require(_0x31a4('0x6'));module['exports']=function(_0x45a4e2,_0x5cda37){return _0x45a4e2[_0x31a4('0x7')](_0x31a4('0x8'),attributes,{'tableName':'tools_templates','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 bfdb8af..d540159 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 _0x459c=['request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','findAll','options','where','attributes','include','model','map','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x335cef,_0x4d99db){var _0x130072=function(_0x46e38c){while(--_0x46e38c){_0x335cef['push'](_0x335cef['shift']());}};_0x130072(++_0x4d99db);}(_0x459c,0x12b));var _0xc459=function(_0x2d27a3,_0x38737f){_0x2d27a3=_0x2d27a3-0x0;var _0x1a8ee9=_0x459c[_0x2d27a3];return _0x1a8ee9;};'use strict';var _=require('lodash');var util=require(_0xc459('0x0'));var moment=require('moment');var BPromise=require(_0xc459('0x1'));var rs=require(_0xc459('0x2'));var fs=require('fs');var Redis=require(_0xc459('0x3'));var db=require(_0xc459('0x4'))['db'];var utils=require(_0xc459('0x5'));var logger=require(_0xc459('0x6'))(_0xc459('0x7'));var config=require(_0xc459('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc459('0x9')][_0xc459('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a41d6,_0x51dcc0,_0x2bc5b9){return new BPromise(function(_0x22cab6,_0xe32cf8){return client[_0xc459('0xb')](_0x5a41d6,_0x2bc5b9)[_0xc459('0xc')](function(_0x40857f){logger[_0xc459('0xd')]('Template,\x20%s,\x20%s',_0x51dcc0,_0xc459('0xe'));logger[_0xc459('0xf')](_0xc459('0x10'),_0x51dcc0,'request\x20sent',JSON[_0xc459('0x11')](_0x40857f));if(_0x40857f['error']){if(_0x40857f[_0xc459('0x12')]['code']===0x1f4){logger[_0xc459('0x12')](_0xc459('0x13'),_0x51dcc0,_0x40857f[_0xc459('0x12')]['message']);return _0xe32cf8(_0x40857f[_0xc459('0x12')]['message']);}logger[_0xc459('0x12')]('Template,\x20%s,\x20%s',_0x51dcc0,_0x40857f[_0xc459('0x12')][_0xc459('0x14')]);return _0x22cab6(_0x40857f[_0xc459('0x12')][_0xc459('0x14')]);}else{logger['info'](_0xc459('0x13'),_0x51dcc0,'request\x20sent');_0x22cab6(_0x40857f[_0xc459('0x15')]['message']);}})[_0xc459('0x16')](function(_0xeef20c){logger['error'](_0xc459('0x13'),_0x51dcc0,_0xeef20c);_0xe32cf8(_0xeef20c);});});}exports[_0xc459('0x17')]=function(_0x41540e){var _0x49ace2=this;return new Promise(function(_0x5249cc,_0x3179ca){return db['Template'][_0xc459('0x18')]({'raw':_0x41540e[_0xc459('0x19')]?_0x41540e['options']['raw']===undefined?!![]:![]:!![],'where':_0x41540e[_0xc459('0x19')]?_0x41540e[_0xc459('0x19')][_0xc459('0x1a')]||null:null,'attributes':_0x41540e['options']?_0x41540e[_0xc459('0x19')][_0xc459('0x1b')]||null:null,'limit':_0x41540e[_0xc459('0x19')]?_0x41540e[_0xc459('0x19')]['limit']||null:null,'include':_0x41540e[_0xc459('0x19')]?_0x41540e[_0xc459('0x19')][_0xc459('0x1c')]?_['map'](_0x41540e[_0xc459('0x19')][_0xc459('0x1c')],function(_0x12d137){return{'model':db[_0x12d137[_0xc459('0x1d')]],'as':_0x12d137['as'],'attributes':_0x12d137[_0xc459('0x1b')],'include':_0x12d137['include']?_[_0xc459('0x1e')](_0x12d137['include'],function(_0x5d72c8){return{'model':db[_0x5d72c8[_0xc459('0x1d')]],'as':_0x5d72c8['as'],'attributes':_0x5d72c8[_0xc459('0x1b')],'include':_0x5d72c8[_0xc459('0x1c')]?_['map'](_0x5d72c8['include'],function(_0x362857){return{'model':db[_0x362857[_0xc459('0x1d')]],'as':_0x362857['as'],'attributes':_0x362857[_0xc459('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc459('0xc')](function(_0x511e5d){logger[_0xc459('0xd')](_0xc459('0x17'),_0x41540e);logger[_0xc459('0xf')](_0xc459('0x17'),_0x41540e,JSON[_0xc459('0x11')](_0x511e5d));_0x5249cc(_0x511e5d);})[_0xc459('0x16')](function(_0x4b9e37){logger['error'](_0xc459('0x17'),_0x4b9e37['message'],_0x41540e);_0x3179ca(_0x49ace2[_0xc459('0x12')](0x1f4,_0x4b9e37['message']));});});}; \ No newline at end of file +var _0x619d=['client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTemplate','Template','findAll','options','raw','where','attributes','include','model','map','debug','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3e0816,_0x18d9d3){var _0x4386f2=function(_0x349e3b){while(--_0x349e3b){_0x3e0816['push'](_0x3e0816['shift']());}};_0x4386f2(++_0x18d9d3);}(_0x619d,0x1b7));var _0xd619=function(_0x4f90e3,_0x34987b){_0x4f90e3=_0x4f90e3-0x0;var _0x14fb1f=_0x619d[_0x4f90e3];return _0x14fb1f;};'use strict';var _=require(_0xd619('0x0'));var util=require(_0xd619('0x1'));var moment=require('moment');var BPromise=require(_0xd619('0x2'));var rs=require(_0xd619('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd619('0x4'))['db'];var utils=require(_0xd619('0x5'));var logger=require(_0xd619('0x6'))(_0xd619('0x7'));var config=require('../../config/environment');var jayson=require(_0xd619('0x8'));var client=jayson[_0xd619('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x105cb1,_0x54b1c3,_0xfa419d){return new BPromise(function(_0xe8a9a9,_0x1c87d0){return client[_0xd619('0xa')](_0x105cb1,_0xfa419d)[_0xd619('0xb')](function(_0x35f2f8){logger[_0xd619('0xc')](_0xd619('0xd'),_0x54b1c3,_0xd619('0xe'));logger['debug'](_0xd619('0xf'),_0x54b1c3,_0xd619('0xe'),JSON['stringify'](_0x35f2f8));if(_0x35f2f8[_0xd619('0x10')]){if(_0x35f2f8[_0xd619('0x10')][_0xd619('0x11')]===0x1f4){logger[_0xd619('0x10')]('Template,\x20%s,\x20%s',_0x54b1c3,_0x35f2f8[_0xd619('0x10')]['message']);return _0x1c87d0(_0x35f2f8['error'][_0xd619('0x12')]);}logger[_0xd619('0x10')](_0xd619('0xd'),_0x54b1c3,_0x35f2f8[_0xd619('0x10')]['message']);return _0xe8a9a9(_0x35f2f8[_0xd619('0x10')][_0xd619('0x12')]);}else{logger[_0xd619('0xc')](_0xd619('0xd'),_0x54b1c3,_0xd619('0xe'));_0xe8a9a9(_0x35f2f8['result'][_0xd619('0x12')]);}})[_0xd619('0x13')](function(_0x333dca){logger[_0xd619('0x10')](_0xd619('0xd'),_0x54b1c3,_0x333dca);_0x1c87d0(_0x333dca);});});}exports[_0xd619('0x14')]=function(_0xbaa71){var _0x1be30e=this;return new Promise(function(_0x4db36e,_0x11b699){return db[_0xd619('0x15')][_0xd619('0x16')]({'raw':_0xbaa71[_0xd619('0x17')]?_0xbaa71[_0xd619('0x17')][_0xd619('0x18')]===undefined?!![]:![]:!![],'where':_0xbaa71[_0xd619('0x17')]?_0xbaa71[_0xd619('0x17')][_0xd619('0x19')]||null:null,'attributes':_0xbaa71[_0xd619('0x17')]?_0xbaa71['options'][_0xd619('0x1a')]||null:null,'limit':_0xbaa71[_0xd619('0x17')]?_0xbaa71['options']['limit']||null:null,'include':_0xbaa71['options']?_0xbaa71['options'][_0xd619('0x1b')]?_['map'](_0xbaa71[_0xd619('0x17')][_0xd619('0x1b')],function(_0x457977){return{'model':db[_0x457977[_0xd619('0x1c')]],'as':_0x457977['as'],'attributes':_0x457977['attributes'],'include':_0x457977['include']?_[_0xd619('0x1d')](_0x457977[_0xd619('0x1b')],function(_0x4889c5){return{'model':db[_0x4889c5[_0xd619('0x1c')]],'as':_0x4889c5['as'],'attributes':_0x4889c5['attributes'],'include':_0x4889c5['include']?_[_0xd619('0x1d')](_0x4889c5[_0xd619('0x1b')],function(_0x3ecadc){return{'model':db[_0x3ecadc[_0xd619('0x1c')]],'as':_0x3ecadc['as'],'attributes':_0x3ecadc[_0xd619('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd619('0xb')](function(_0x403774){logger[_0xd619('0xc')](_0xd619('0x14'),_0xbaa71);logger[_0xd619('0x1e')]('GetTemplate',_0xbaa71,JSON[_0xd619('0x1f')](_0x403774));_0x4db36e(_0x403774);})[_0xd619('0x13')](function(_0x3e681f){logger[_0xd619('0x10')](_0xd619('0x14'),_0x3e681f['message'],_0xbaa71);_0x11b699(_0x1be30e[_0xd619('0x10')](0x1f4,_0x3e681f[_0xd619('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 6bfd669..b1d8723 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 _0x7ef0=['../../components/interaction/service','./trigger.controller','get','index','/:id','/:id/all_conditions','isAuthenticated','getAllConditions','getAnyConditions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x832e80,_0x5c100b){var _0x4b43a3=function(_0x1ff2e2){while(--_0x1ff2e2){_0x832e80['push'](_0x832e80['shift']());}};_0x4b43a3(++_0x5c100b);}(_0x7ef0,0x122));var _0x07ef=function(_0x5efd70,_0x5b31e9){_0x5efd70=_0x5efd70-0x0;var _0x1d5af3=_0x7ef0[_0x5efd70];return _0x1d5af3;};'use strict';var multer=require(_0x07ef('0x0'));var util=require(_0x07ef('0x1'));var path=require(_0x07ef('0x2'));var timeout=require(_0x07ef('0x3'));var express=require('express');var router=express[_0x07ef('0x4')]();var fs_extra=require(_0x07ef('0x5'));var auth=require(_0x07ef('0x6'));var interaction=require(_0x07ef('0x7'));var config=require('../../config/environment');var controller=require(_0x07ef('0x8'));router[_0x07ef('0x9')]('/',auth['isAuthenticated'](),controller[_0x07ef('0xa')]);router[_0x07ef('0x9')](_0x07ef('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x07ef('0x9')](_0x07ef('0xc'),auth[_0x07ef('0xd')](),controller[_0x07ef('0xe')]);router[_0x07ef('0x9')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x07ef('0xf')]);router[_0x07ef('0x9')]('/:id/actions',auth[_0x07ef('0xd')](),controller[_0x07ef('0x10')]);router[_0x07ef('0x11')]('/',auth['isAuthenticated'](),controller[_0x07ef('0x12')]);router['post']('/:id/all_conditions',auth[_0x07ef('0xd')](),controller[_0x07ef('0x13')]);router[_0x07ef('0x11')](_0x07ef('0x14'),auth[_0x07ef('0xd')](),controller[_0x07ef('0x15')]);router[_0x07ef('0x11')]('/:id/actions',auth[_0x07ef('0xd')](),controller[_0x07ef('0x16')]);router[_0x07ef('0x17')](_0x07ef('0xb'),auth['isAuthenticated'](),controller[_0x07ef('0x18')]);router[_0x07ef('0x19')](_0x07ef('0xb'),auth[_0x07ef('0xd')](),controller['destroy']);module[_0x07ef('0x1a')]=router; \ No newline at end of file +var _0xac8e=['get','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index'];(function(_0x46edc1,_0x4d1774){var _0xec1111=function(_0x31fef3){while(--_0x31fef3){_0x46edc1['push'](_0x46edc1['shift']());}};_0xec1111(++_0x4d1774);}(_0xac8e,0x19f));var _0xeac8=function(_0x38386b,_0x2cadac){_0x38386b=_0x38386b-0x0;var _0x4c0ee9=_0xac8e[_0x38386b];return _0x4c0ee9;};'use strict';var multer=require(_0xeac8('0x0'));var util=require(_0xeac8('0x1'));var path=require(_0xeac8('0x2'));var timeout=require(_0xeac8('0x3'));var express=require(_0xeac8('0x4'));var router=express[_0xeac8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xeac8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeac8('0x7'));var controller=require('./trigger.controller');router['get']('/',auth[_0xeac8('0x8')](),controller[_0xeac8('0x9')]);router[_0xeac8('0xa')]('/:id',auth[_0xeac8('0x8')](),controller[_0xeac8('0xb')]);router[_0xeac8('0xa')](_0xeac8('0xc'),auth[_0xeac8('0x8')](),controller['getAllConditions']);router[_0xeac8('0xa')](_0xeac8('0xd'),auth['isAuthenticated'](),controller[_0xeac8('0xe')]);router[_0xeac8('0xa')](_0xeac8('0xf'),auth[_0xeac8('0x8')](),controller[_0xeac8('0x10')]);router[_0xeac8('0x11')]('/',auth[_0xeac8('0x8')](),controller[_0xeac8('0x12')]);router[_0xeac8('0x11')](_0xeac8('0xc'),auth['isAuthenticated'](),controller[_0xeac8('0x13')]);router[_0xeac8('0x11')](_0xeac8('0xd'),auth[_0xeac8('0x8')](),controller[_0xeac8('0x14')]);router[_0xeac8('0x11')](_0xeac8('0xf'),auth[_0xeac8('0x8')](),controller['addAction']);router[_0xeac8('0x15')]('/:id',auth[_0xeac8('0x8')](),controller[_0xeac8('0x16')]);router[_0xeac8('0x17')]('/:id',auth[_0xeac8('0x8')](),controller[_0xeac8('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 75c4506..5f14131 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 _0xa9c0=['STRING','BOOLEAN','exports'];(function(_0x531e0c,_0x30da49){var _0xd29387=function(_0x3888f9){while(--_0x3888f9){_0x531e0c['push'](_0x531e0c['shift']());}};_0xd29387(++_0x30da49);}(_0xa9c0,0xf5));var _0x0a9c=function(_0x1bae85,_0x19ecfe){_0x1bae85=_0x1bae85-0x0;var _0x295098=_0xa9c0[_0x1bae85];return _0x295098;};'use strict';var Sequelize=require('sequelize');module[_0x0a9c('0x0')]={'name':{'type':Sequelize[_0x0a9c('0x1')]},'channel':{'type':Sequelize[_0x0a9c('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x0a9c('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x494b=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x494b,0x7c));var _0xb494=function(_0x3198fd,_0x3729d8){_0x3198fd=_0x3198fd-0x0;var _0x2dd0b=_0x494b[_0x3198fd];return _0x2dd0b;};'use strict';var Sequelize=require(_0xb494('0x0'));module[_0xb494('0x1')]={'name':{'type':Sequelize[_0xb494('0x2')]},'channel':{'type':Sequelize[_0xb494('0x2')]},'description':{'type':Sequelize[_0xb494('0x2')]},'status':{'type':Sequelize[_0xb494('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 d165046..839b193 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 _0xb89e=['save','then','destroy','Triggers','UserProfileResource','end','error','stack','name','send','index','map','Trigger','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','getAllConditions','findOne','Condition','getAnyConditions','addAction','TriggerId','Action','getActions','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x541a67,_0x50728d){var _0x45da2a=function(_0x158929){while(--_0x158929){_0x541a67['push'](_0x541a67['shift']());}};_0x45da2a(++_0x50728d);}(_0xb89e,0x110));var _0xeb89=function(_0x1894e7,_0x1253e6){_0x1894e7=_0x1894e7-0x0;var _0x5e857f=_0xb89e[_0x1894e7];return _0x5e857f;};'use strict';var emlformat=require(_0xeb89('0x0'));var rimraf=require(_0xeb89('0x1'));var zipdir=require(_0xeb89('0x2'));var jsonpatch=require(_0xeb89('0x3'));var rp=require(_0xeb89('0x4'));var moment=require(_0xeb89('0x5'));var BPromise=require(_0xeb89('0x6'));var Mustache=require(_0xeb89('0x7'));var util=require(_0xeb89('0x8'));var path=require(_0xeb89('0x9'));var sox=require(_0xeb89('0xa'));var csv=require(_0xeb89('0xb'));var ejs=require(_0xeb89('0xc'));var fs=require('fs');var fs_extra=require(_0xeb89('0xd'));var _=require(_0xeb89('0xe'));var squel=require(_0xeb89('0xf'));var crypto=require(_0xeb89('0x10'));var jsforce=require(_0xeb89('0x11'));var deskjs=require(_0xeb89('0x12'));var toCsv=require(_0xeb89('0xb'));var querystring=require(_0xeb89('0x13'));var Papa=require(_0xeb89('0x14'));var Redis=require(_0xeb89('0x15'));var authService=require(_0xeb89('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0xeb89('0x17'));var hardwareService=require(_0xeb89('0x18'));var logger=require(_0xeb89('0x19'))('api');var utils=require(_0xeb89('0x1a'));var config=require(_0xeb89('0x1b'));var licenseUtil=require(_0xeb89('0x1c'));var db=require(_0xeb89('0x1d'))['db'];function respondWithStatusCode(_0x3659ec,_0x4d3a93){_0x4d3a93=_0x4d3a93||0xcc;return function(_0x4f099f){if(_0x4f099f){return _0x3659ec[_0xeb89('0x1e')](_0x4d3a93);}return _0x3659ec[_0xeb89('0x1f')](_0x4d3a93)['end']();};}function respondWithResult(_0x758307,_0x2038b8){_0x2038b8=_0x2038b8||0xc8;return function(_0x2b8b06){if(_0x2b8b06){return _0x758307[_0xeb89('0x1f')](_0x2038b8)[_0xeb89('0x20')](_0x2b8b06);}};}function respondWithFilteredResult(_0x57c660,_0x55cfec){return function(_0x5b5b46){if(_0x5b5b46){var _0x1dc86d=typeof _0x55cfec[_0xeb89('0x21')]===_0xeb89('0x22')&&typeof _0x55cfec[_0xeb89('0x23')]===_0xeb89('0x22');var _0x3d8aaf=_0x5b5b46[_0xeb89('0x24')];var _0x3f4d6f=_0x1dc86d?0x0:_0x55cfec[_0xeb89('0x21')];var _0x5745e1=_0x1dc86d?_0x5b5b46[_0xeb89('0x24')]:_0x55cfec[_0xeb89('0x21')]+_0x55cfec[_0xeb89('0x23')];var _0x31c48c;if(_0x5745e1>=_0x3d8aaf){_0x5745e1=_0x3d8aaf;_0x31c48c=0xc8;}else{_0x31c48c=0xce;}_0x57c660[_0xeb89('0x1f')](_0x31c48c);return _0x57c660['set'](_0xeb89('0x25'),_0x3f4d6f+'-'+_0x5745e1+'/'+_0x3d8aaf)[_0xeb89('0x20')](_0x5b5b46);}return null;};}function patchUpdates(_0x45638a){return function(_0x273a01){try{jsonpatch[_0xeb89('0x26')](_0x273a01,_0x45638a,!![]);}catch(_0x3fc30c){return BPromise[_0xeb89('0x27')](_0x3fc30c);}return _0x273a01[_0xeb89('0x28')]();};}function saveUpdates(_0x5086c0,_0x53bd95){return function(_0x4802df){if(_0x4802df){return _0x4802df['update'](_0x5086c0)[_0xeb89('0x29')](function(_0x912836){return _0x912836;});}return null;};}function removeEntity(_0x47483c,_0x40e8cd){return function(_0x238bd4){if(_0x238bd4){return _0x238bd4[_0xeb89('0x2a')]()[_0xeb89('0x29')](function(){var _0x1d7d96=_0x238bd4['get']({'plain':!![]});var _0x161180=_0xeb89('0x2b');return db[_0xeb89('0x2c')][_0xeb89('0x2a')]({'where':{'type':_0x161180,'resourceId':_0x1d7d96['id']}})['then'](function(){return _0x238bd4;});})[_0xeb89('0x29')](function(){_0x47483c['status'](0xcc)[_0xeb89('0x2d')]();});}};}function handleEntityNotFound(_0x514037,_0x286248){return function(_0x110d70){if(!_0x110d70){_0x514037[_0xeb89('0x1e')](0x194);}return _0x110d70;};}function handleError(_0x3e7c73,_0x233350){_0x233350=_0x233350||0x1f4;return function(_0x57fa46){logger[_0xeb89('0x2e')](_0x57fa46[_0xeb89('0x2f')]);if(_0x57fa46[_0xeb89('0x30')]){delete _0x57fa46[_0xeb89('0x30')];}_0x3e7c73[_0xeb89('0x1f')](_0x233350)[_0xeb89('0x31')](_0x57fa46);};}exports[_0xeb89('0x32')]=function(_0x23bfe4,_0x13ef44){var _0x15ca0e={},_0x5a184d={},_0x1c2ff8={'count':0x0,'rows':[]};var _0x495e28=_[_0xeb89('0x33')](db[_0xeb89('0x34')][_0xeb89('0x35')],function(_0x3cb17f){return{'name':_0x3cb17f['fieldName'],'type':_0x3cb17f[_0xeb89('0x36')][_0xeb89('0x37')]};});_0x5a184d[_0xeb89('0x38')]=_['map'](_0x495e28,_0xeb89('0x30'));_0x5a184d[_0xeb89('0x39')]=_['keys'](_0x23bfe4['query']);_0x5a184d['filters']=_[_0xeb89('0x3a')](_0x5a184d['model'],_0x5a184d[_0xeb89('0x39')]);_0x15ca0e[_0xeb89('0x3b')]=_['intersection'](_0x5a184d[_0xeb89('0x38')],qs[_0xeb89('0x3c')](_0x23bfe4[_0xeb89('0x39')]['fields']));_0x15ca0e[_0xeb89('0x3b')]=_0x15ca0e[_0xeb89('0x3b')]['length']?_0x15ca0e[_0xeb89('0x3b')]:_0x5a184d['model'];if(!_0x23bfe4[_0xeb89('0x39')][_0xeb89('0x3d')](_0xeb89('0x3e'))){_0x15ca0e[_0xeb89('0x23')]=qs[_0xeb89('0x23')](_0x23bfe4[_0xeb89('0x39')]['limit']);_0x15ca0e[_0xeb89('0x21')]=qs[_0xeb89('0x21')](_0x23bfe4[_0xeb89('0x39')][_0xeb89('0x21')]);}_0x15ca0e[_0xeb89('0x3f')]=qs[_0xeb89('0x40')](_0x23bfe4[_0xeb89('0x39')]['sort']);_0x15ca0e[_0xeb89('0x41')]=qs[_0xeb89('0x42')](_[_0xeb89('0x43')](_0x23bfe4[_0xeb89('0x39')],_0x5a184d['filters']),_0x495e28);if(_0x23bfe4[_0xeb89('0x39')][_0xeb89('0x44')]){_0x15ca0e[_0xeb89('0x41')]=_[_0xeb89('0x45')](_0x15ca0e[_0xeb89('0x41')],{'$or':_['map'](_0x495e28,function(_0x4350a2){if(_0x4350a2[_0xeb89('0x36')]!==_0xeb89('0x46')){var _0x4cb3f6={};_0x4cb3f6[_0x4350a2[_0xeb89('0x30')]]={'$like':'%'+_0x23bfe4[_0xeb89('0x39')]['filter']+'%'};return _0x4cb3f6;}})});}_0x15ca0e=_['merge']({},_0x15ca0e,_0x23bfe4[_0xeb89('0x47')]);var _0x144c72={'where':_0x15ca0e['where']};return db[_0xeb89('0x34')][_0xeb89('0x24')](_0x144c72)[_0xeb89('0x29')](function(_0x43f2c5){_0x1c2ff8['count']=_0x43f2c5;if(_0x23bfe4[_0xeb89('0x39')][_0xeb89('0x48')]){_0x15ca0e[_0xeb89('0x49')]=[{'all':!![]}];}return db[_0xeb89('0x34')][_0xeb89('0x4a')](_0x15ca0e);})[_0xeb89('0x29')](function(_0xfa3070){_0x1c2ff8[_0xeb89('0x4b')]=_0xfa3070;return _0x1c2ff8;})[_0xeb89('0x29')](respondWithFilteredResult(_0x13ef44,_0x15ca0e))['catch'](handleError(_0x13ef44,null));};exports[_0xeb89('0x4c')]=function(_0x3cd65d,_0x1d124a){var _0x3342c6={'raw':![],'where':{'id':_0x3cd65d[_0xeb89('0x4d')]['id']}},_0x30efda={};_0x30efda[_0xeb89('0x38')]=_[_0xeb89('0x4e')](db[_0xeb89('0x34')][_0xeb89('0x35')]);_0x30efda[_0xeb89('0x39')]=_[_0xeb89('0x4e')](_0x3cd65d[_0xeb89('0x39')]);_0x30efda[_0xeb89('0x42')]=_[_0xeb89('0x3a')](_0x30efda['model'],_0x30efda[_0xeb89('0x39')]);_0x3342c6[_0xeb89('0x3b')]=_['intersection'](_0x30efda['model'],qs[_0xeb89('0x3c')](_0x3cd65d[_0xeb89('0x39')]['fields']));_0x3342c6['attributes']=_0x3342c6[_0xeb89('0x3b')][_0xeb89('0x4f')]?_0x3342c6[_0xeb89('0x3b')]:_0x30efda['model'];if(_0x3cd65d[_0xeb89('0x39')]['includeAll']){_0x3342c6[_0xeb89('0x49')]=[{'all':!![]}];}_0x3342c6=_[_0xeb89('0x45')]({},_0x3342c6,_0x3cd65d[_0xeb89('0x47')]);return db[_0xeb89('0x34')]['find'](_0x3342c6)['then'](handleEntityNotFound(_0x1d124a,null))['then'](respondWithResult(_0x1d124a,null))[_0xeb89('0x50')](handleError(_0x1d124a,null));};exports[_0xeb89('0x51')]=function(_0xc5dac4,_0x9af70e){return db[_0xeb89('0x34')][_0xeb89('0x51')](_0xc5dac4[_0xeb89('0x52')],{})[_0xeb89('0x29')](function(_0x42dc18){var _0x3ba941=_0xc5dac4['user'][_0xeb89('0x53')]({'plain':!![]});if(!_0x3ba941)throw new Error(_0xeb89('0x54'));if(_0x3ba941[_0xeb89('0x55')]===_0xeb89('0x56')){var _0x56e62b=_0x42dc18[_0xeb89('0x53')]({'plain':!![]});var _0x3d75c5=_0xeb89('0x2b');return db[_0xeb89('0x57')][_0xeb89('0x58')]({'where':{'name':_0x3d75c5,'userProfileId':_0x3ba941[_0xeb89('0x59')]},'raw':!![]})['then'](function(_0x2b5055){if(_0x2b5055&&_0x2b5055[_0xeb89('0x5a')]===0x0){return db[_0xeb89('0x2c')]['create']({'name':_0x56e62b[_0xeb89('0x30')],'resourceId':_0x56e62b['id'],'type':_0x2b5055['name'],'sectionId':_0x2b5055['id']},{})[_0xeb89('0x29')](function(){return _0x42dc18;});}else{return _0x42dc18;}})[_0xeb89('0x50')](function(_0x51e4bc){logger[_0xeb89('0x2e')](_0xeb89('0x5b'),_0x51e4bc);throw _0x51e4bc;});}return _0x42dc18;})[_0xeb89('0x29')](respondWithResult(_0x9af70e,0xc9))[_0xeb89('0x50')](handleError(_0x9af70e,null));};exports['update']=function(_0x3fd43d,_0x2937a9){if(_0x3fd43d[_0xeb89('0x52')]['id']){delete _0x3fd43d[_0xeb89('0x52')]['id'];}return db['Trigger'][_0xeb89('0x58')]({'where':{'id':_0x3fd43d[_0xeb89('0x4d')]['id']}})[_0xeb89('0x29')](handleEntityNotFound(_0x2937a9,null))[_0xeb89('0x29')](saveUpdates(_0x3fd43d[_0xeb89('0x52')],null))[_0xeb89('0x29')](respondWithResult(_0x2937a9,null))['catch'](handleError(_0x2937a9,null));};exports[_0xeb89('0x2a')]=function(_0x3d39e4,_0x3e1852){return db[_0xeb89('0x34')][_0xeb89('0x58')]({'where':{'id':_0x3d39e4[_0xeb89('0x4d')]['id']}})[_0xeb89('0x29')](handleEntityNotFound(_0x3e1852,null))['then'](removeEntity(_0x3e1852,null))['catch'](handleError(_0x3e1852,null));};exports[_0xeb89('0x5c')]=function(_0x3fd537,_0x5e25e2,_0x2c07f1){if(_0x3fd537[_0xeb89('0x52')]['id']){delete _0x3fd537['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x3fd537['params']['id']}})[_0xeb89('0x29')](handleEntityNotFound(_0x5e25e2,null))[_0xeb89('0x29')](function(_0x542cd2){if(_0x542cd2){_0x3fd537[_0xeb89('0x52')][_0xeb89('0x5d')]=_0x542cd2['id'];return db['Condition'][_0xeb89('0x51')](_0x3fd537[_0xeb89('0x52')]);}})[_0xeb89('0x29')](respondWithResult(_0x5e25e2,null))[_0xeb89('0x50')](handleError(_0x5e25e2,null));};exports[_0xeb89('0x5e')]=function(_0x3ff9d6,_0x3d3fef,_0x5e8932){if(_0x3ff9d6[_0xeb89('0x52')]['id']){delete _0x3ff9d6[_0xeb89('0x52')]['id'];}return db[_0xeb89('0x34')][_0xeb89('0x58')]({'where':{'id':_0x3ff9d6['params']['id']}})[_0xeb89('0x29')](handleEntityNotFound(_0x3d3fef,null))[_0xeb89('0x29')](function(_0x2302d5){if(_0x2302d5){_0x3ff9d6['body'][_0xeb89('0x5f')]=_0x2302d5['id'];return db['Condition'][_0xeb89('0x51')](_0x3ff9d6[_0xeb89('0x52')]);}})['then'](respondWithResult(_0x3d3fef,null))['catch'](handleError(_0x3d3fef,null));};exports[_0xeb89('0x60')]=function(_0x13cac8,_0x3d0f55,_0x516aa9){var _0x532519={};var _0x235f50={};var _0xb45721;var _0x2cf067;return db[_0xeb89('0x34')][_0xeb89('0x61')]({'where':{'id':_0x13cac8['params']['id']}})[_0xeb89('0x29')](handleEntityNotFound(_0x3d0f55,null))['then'](function(_0xed6964){if(_0xed6964){_0xb45721=_0xed6964;_0x235f50[_0xeb89('0x38')]=_[_0xeb89('0x4e')](db[_0xeb89('0x62')][_0xeb89('0x35')]);_0x235f50[_0xeb89('0x39')]=_['keys'](_0x13cac8[_0xeb89('0x39')]);_0x235f50['filters']=_[_0xeb89('0x3a')](_0x235f50[_0xeb89('0x38')],_0x235f50[_0xeb89('0x39')]);_0x532519[_0xeb89('0x3b')]=_[_0xeb89('0x3a')](_0x235f50[_0xeb89('0x38')],qs[_0xeb89('0x3c')](_0x13cac8[_0xeb89('0x39')][_0xeb89('0x3c')]));_0x532519[_0xeb89('0x3b')]=_0x532519['attributes'][_0xeb89('0x4f')]?_0x532519['attributes']:_0x235f50['model'];_0x532519[_0xeb89('0x3f')]=qs[_0xeb89('0x40')](_0x13cac8[_0xeb89('0x39')]['sort']);_0x532519[_0xeb89('0x41')]=qs[_0xeb89('0x42')](_[_0xeb89('0x43')](_0x13cac8[_0xeb89('0x39')],_0x235f50[_0xeb89('0x42')]));if(_0x13cac8[_0xeb89('0x39')]['filter']){_0x532519['where']=_[_0xeb89('0x45')](_0x532519[_0xeb89('0x41')],{'$or':_[_0xeb89('0x33')](_0x532519[_0xeb89('0x3b')],function(_0xb2cfc6){var _0x141c8d={};_0x141c8d[_0xb2cfc6]={'$like':'%'+_0x13cac8[_0xeb89('0x39')][_0xeb89('0x44')]+'%'};return _0x141c8d;})});}_0x532519=_['merge']({},_0x532519,_0x13cac8[_0xeb89('0x47')]);return _0xb45721[_0xeb89('0x60')](_0x532519);}})[_0xeb89('0x29')](function(_0x31576a){if(_0x31576a){_0x2cf067=_0x31576a[_0xeb89('0x4f')];if(!_0x13cac8[_0xeb89('0x39')][_0xeb89('0x3d')](_0xeb89('0x3e'))){_0x532519[_0xeb89('0x23')]=qs['limit'](_0x13cac8['query'][_0xeb89('0x23')]);_0x532519[_0xeb89('0x21')]=qs[_0xeb89('0x21')](_0x13cac8['query'][_0xeb89('0x21')]);}return _0xb45721[_0xeb89('0x60')](_0x532519);}})[_0xeb89('0x29')](function(_0x58db81){if(_0x58db81){return _0x58db81?{'count':_0x2cf067,'rows':_0x58db81}:null;}})[_0xeb89('0x29')](respondWithResult(_0x3d0f55,null))[_0xeb89('0x50')](handleError(_0x3d0f55,null));};exports[_0xeb89('0x63')]=function(_0x50308b,_0x2c2f0d,_0x3e66ec){var _0x254c96={};var _0x23b77e={};var _0x21a42c;var _0x47ff74;return db[_0xeb89('0x34')][_0xeb89('0x61')]({'where':{'id':_0x50308b[_0xeb89('0x4d')]['id']}})[_0xeb89('0x29')](handleEntityNotFound(_0x2c2f0d,null))[_0xeb89('0x29')](function(_0x5c5399){if(_0x5c5399){_0x21a42c=_0x5c5399;_0x23b77e[_0xeb89('0x38')]=_[_0xeb89('0x4e')](db[_0xeb89('0x62')][_0xeb89('0x35')]);_0x23b77e[_0xeb89('0x39')]=_['keys'](_0x50308b['query']);_0x23b77e['filters']=_[_0xeb89('0x3a')](_0x23b77e['model'],_0x23b77e[_0xeb89('0x39')]);_0x254c96[_0xeb89('0x3b')]=_[_0xeb89('0x3a')](_0x23b77e[_0xeb89('0x38')],qs['fields'](_0x50308b[_0xeb89('0x39')][_0xeb89('0x3c')]));_0x254c96[_0xeb89('0x3b')]=_0x254c96[_0xeb89('0x3b')][_0xeb89('0x4f')]?_0x254c96[_0xeb89('0x3b')]:_0x23b77e['model'];_0x254c96[_0xeb89('0x3f')]=qs[_0xeb89('0x40')](_0x50308b[_0xeb89('0x39')][_0xeb89('0x40')]);_0x254c96[_0xeb89('0x41')]=qs[_0xeb89('0x42')](_[_0xeb89('0x43')](_0x50308b[_0xeb89('0x39')],_0x23b77e[_0xeb89('0x42')]));if(_0x50308b[_0xeb89('0x39')][_0xeb89('0x44')]){_0x254c96[_0xeb89('0x41')]=_[_0xeb89('0x45')](_0x254c96[_0xeb89('0x41')],{'$or':_[_0xeb89('0x33')](_0x254c96['attributes'],function(_0x32dc72){var _0x3d961c={};_0x3d961c[_0x32dc72]={'$like':'%'+_0x50308b[_0xeb89('0x39')][_0xeb89('0x44')]+'%'};return _0x3d961c;})});}_0x254c96=_[_0xeb89('0x45')]({},_0x254c96,_0x50308b[_0xeb89('0x47')]);return _0x21a42c['getAnyConditions'](_0x254c96);}})['then'](function(_0x350b37){if(_0x350b37){_0x47ff74=_0x350b37[_0xeb89('0x4f')];if(!_0x50308b[_0xeb89('0x39')][_0xeb89('0x3d')](_0xeb89('0x3e'))){_0x254c96[_0xeb89('0x23')]=qs[_0xeb89('0x23')](_0x50308b['query']['limit']);_0x254c96[_0xeb89('0x21')]=qs['offset'](_0x50308b[_0xeb89('0x39')]['offset']);}return _0x21a42c[_0xeb89('0x63')](_0x254c96);}})[_0xeb89('0x29')](function(_0x5720dc){if(_0x5720dc){return _0x5720dc?{'count':_0x47ff74,'rows':_0x5720dc}:null;}})[_0xeb89('0x29')](respondWithResult(_0x2c2f0d,null))[_0xeb89('0x50')](handleError(_0x2c2f0d,null));};exports[_0xeb89('0x64')]=function(_0x9a6fcd,_0x35e147,_0x36f5dd){if(_0x9a6fcd[_0xeb89('0x52')]['id']){delete _0x9a6fcd[_0xeb89('0x52')]['id'];}return db[_0xeb89('0x34')][_0xeb89('0x58')]({'where':{'id':_0x9a6fcd['params']['id']}})[_0xeb89('0x29')](handleEntityNotFound(_0x35e147,null))['then'](function(_0x5ea757){if(_0x5ea757){_0x9a6fcd[_0xeb89('0x52')][_0xeb89('0x65')]=_0x5ea757['id'];return db[_0xeb89('0x66')]['create'](_0x9a6fcd[_0xeb89('0x52')]);}})[_0xeb89('0x29')](respondWithResult(_0x35e147,null))['catch'](handleError(_0x35e147,null));};exports[_0xeb89('0x67')]=function(_0x1d7d6e,_0x22cb01,_0x20f698){var _0x15dc91={};var _0x2661f4={};var _0x386ad0;var _0x202bb4;return db[_0xeb89('0x34')][_0xeb89('0x61')]({'where':{'id':_0x1d7d6e[_0xeb89('0x4d')]['id']}})[_0xeb89('0x29')](handleEntityNotFound(_0x22cb01,null))['then'](function(_0x31601f){if(_0x31601f){_0x386ad0=_0x31601f;_0x2661f4['model']=_[_0xeb89('0x4e')](db[_0xeb89('0x66')][_0xeb89('0x35')]);_0x2661f4['query']=_[_0xeb89('0x4e')](_0x1d7d6e[_0xeb89('0x39')]);_0x2661f4[_0xeb89('0x42')]=_['intersection'](_0x2661f4[_0xeb89('0x38')],_0x2661f4['query']);_0x15dc91['attributes']=_['intersection'](_0x2661f4[_0xeb89('0x38')],qs[_0xeb89('0x3c')](_0x1d7d6e[_0xeb89('0x39')][_0xeb89('0x3c')]));_0x15dc91[_0xeb89('0x3b')]=_0x15dc91[_0xeb89('0x3b')]['length']?_0x15dc91[_0xeb89('0x3b')]:_0x2661f4[_0xeb89('0x38')];_0x15dc91[_0xeb89('0x3f')]=qs[_0xeb89('0x40')](_0x1d7d6e[_0xeb89('0x39')][_0xeb89('0x40')]);_0x15dc91[_0xeb89('0x41')]=qs[_0xeb89('0x42')](_[_0xeb89('0x43')](_0x1d7d6e[_0xeb89('0x39')],_0x2661f4[_0xeb89('0x42')]));if(_0x1d7d6e[_0xeb89('0x39')][_0xeb89('0x44')]){_0x15dc91[_0xeb89('0x41')]=_[_0xeb89('0x45')](_0x15dc91[_0xeb89('0x41')],{'$or':_[_0xeb89('0x33')](_0x15dc91['attributes'],function(_0x1465c0){var _0x11d218={};_0x11d218[_0x1465c0]={'$like':'%'+_0x1d7d6e[_0xeb89('0x39')][_0xeb89('0x44')]+'%'};return _0x11d218;})});}_0x15dc91=_['merge']({},_0x15dc91,_0x1d7d6e[_0xeb89('0x47')]);return _0x386ad0[_0xeb89('0x67')](_0x15dc91);}})[_0xeb89('0x29')](function(_0x998642){if(_0x998642){_0x202bb4=_0x998642[_0xeb89('0x4f')];if(!_0x1d7d6e[_0xeb89('0x39')]['hasOwnProperty']('nolimit')){_0x15dc91[_0xeb89('0x23')]=qs[_0xeb89('0x23')](_0x1d7d6e[_0xeb89('0x39')]['limit']);_0x15dc91[_0xeb89('0x21')]=qs[_0xeb89('0x21')](_0x1d7d6e[_0xeb89('0x39')][_0xeb89('0x21')]);}return _0x386ad0[_0xeb89('0x67')](_0x15dc91);}})[_0xeb89('0x29')](function(_0x5bf8fe){if(_0x5bf8fe){return _0x5bf8fe?{'count':_0x202bb4,'rows':_0x5bf8fe}:null;}})[_0xeb89('0x29')](respondWithResult(_0x22cb01,null))[_0xeb89('0x50')](handleError(_0x22cb01,null));}; \ No newline at end of file +var _0x5ea1=['../../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','limit','undefined','offset','count','set','apply','save','update','destroy','then','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','TriggerAnyId','length','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4b729f,_0x557020){var _0x5b9abd=function(_0x1e1a08){while(--_0x1e1a08){_0x4b729f['push'](_0x4b729f['shift']());}};_0x5b9abd(++_0x557020);}(_0x5ea1,0x113));var _0x15ea=function(_0x1a38f0,_0x480396){_0x1a38f0=_0x1a38f0-0x0;var _0x3b6dc4=_0x5ea1[_0x1a38f0];return _0x3b6dc4;};'use strict';var emlformat=require(_0x15ea('0x0'));var rimraf=require(_0x15ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x15ea('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x15ea('0x3'));var util=require(_0x15ea('0x4'));var path=require(_0x15ea('0x5'));var sox=require(_0x15ea('0x6'));var csv=require(_0x15ea('0x7'));var ejs=require(_0x15ea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15ea('0x9'));var squel=require(_0x15ea('0xa'));var crypto=require('crypto');var jsforce=require(_0x15ea('0xb'));var deskjs=require(_0x15ea('0xc'));var toCsv=require('to-csv');var querystring=require(_0x15ea('0xd'));var Papa=require(_0x15ea('0xe'));var Redis=require(_0x15ea('0xf'));var authService=require(_0x15ea('0x10'));var qs=require(_0x15ea('0x11'));var as=require(_0x15ea('0x12'));var hardwareService=require(_0x15ea('0x13'));var logger=require('../../config/logger')(_0x15ea('0x14'));var utils=require(_0x15ea('0x15'));var config=require(_0x15ea('0x16'));var licenseUtil=require(_0x15ea('0x17'));var db=require(_0x15ea('0x18'))['db'];function respondWithStatusCode(_0x526059,_0x28acf8){_0x28acf8=_0x28acf8||0xcc;return function(_0x565340){if(_0x565340){return _0x526059[_0x15ea('0x19')](_0x28acf8);}return _0x526059[_0x15ea('0x1a')](_0x28acf8)[_0x15ea('0x1b')]();};}function respondWithResult(_0x52247d,_0x4a0cf0){_0x4a0cf0=_0x4a0cf0||0xc8;return function(_0x4d1996){if(_0x4d1996){return _0x52247d[_0x15ea('0x1a')](_0x4a0cf0)[_0x15ea('0x1c')](_0x4d1996);}};}function respondWithFilteredResult(_0x2d4e5b,_0xc3f444){return function(_0x57c1c4){if(_0x57c1c4){var _0x32d8eb=typeof _0xc3f444['offset']==='undefined'&&typeof _0xc3f444[_0x15ea('0x1d')]===_0x15ea('0x1e');var _0x2d2d98=_0x57c1c4['count'];var _0x2fb206=_0x32d8eb?0x0:_0xc3f444[_0x15ea('0x1f')];var _0x122c41=_0x32d8eb?_0x57c1c4[_0x15ea('0x20')]:_0xc3f444[_0x15ea('0x1f')]+_0xc3f444[_0x15ea('0x1d')];var _0x56aa8e;if(_0x122c41>=_0x2d2d98){_0x122c41=_0x2d2d98;_0x56aa8e=0xc8;}else{_0x56aa8e=0xce;}_0x2d4e5b['status'](_0x56aa8e);return _0x2d4e5b[_0x15ea('0x21')]('Content-Range',_0x2fb206+'-'+_0x122c41+'/'+_0x2d2d98)[_0x15ea('0x1c')](_0x57c1c4);}return null;};}function patchUpdates(_0x36ca33){return function(_0x5a20a7){try{jsonpatch[_0x15ea('0x22')](_0x5a20a7,_0x36ca33,!![]);}catch(_0x2c8eb4){return BPromise['reject'](_0x2c8eb4);}return _0x5a20a7[_0x15ea('0x23')]();};}function saveUpdates(_0x1b48e1,_0x447829){return function(_0x237770){if(_0x237770){return _0x237770[_0x15ea('0x24')](_0x1b48e1)['then'](function(_0x1cefa9){return _0x1cefa9;});}return null;};}function removeEntity(_0x540c3b,_0x17a064){return function(_0x4ab6d7){if(_0x4ab6d7){return _0x4ab6d7[_0x15ea('0x25')]()[_0x15ea('0x26')](function(){var _0x4277a9=_0x4ab6d7['get']({'plain':!![]});var _0x280de4=_0x15ea('0x27');return db[_0x15ea('0x28')][_0x15ea('0x25')]({'where':{'type':_0x280de4,'resourceId':_0x4277a9['id']}})[_0x15ea('0x26')](function(){return _0x4ab6d7;});})['then'](function(){_0x540c3b[_0x15ea('0x1a')](0xcc)[_0x15ea('0x1b')]();});}};}function handleEntityNotFound(_0x283c69,_0x5f2a24){return function(_0x1adf2f){if(!_0x1adf2f){_0x283c69[_0x15ea('0x19')](0x194);}return _0x1adf2f;};}function handleError(_0x20fd0f,_0x53fc1f){_0x53fc1f=_0x53fc1f||0x1f4;return function(_0x52b023){logger[_0x15ea('0x29')](_0x52b023[_0x15ea('0x2a')]);if(_0x52b023[_0x15ea('0x2b')]){delete _0x52b023[_0x15ea('0x2b')];}_0x20fd0f[_0x15ea('0x1a')](_0x53fc1f)[_0x15ea('0x2c')](_0x52b023);};}exports[_0x15ea('0x2d')]=function(_0x1c85da,_0x223fb5){var _0x1a3bca={},_0x37d943={},_0x20aa2a={'count':0x0,'rows':[]};var _0x33f3ae=_[_0x15ea('0x2e')](db[_0x15ea('0x2f')]['rawAttributes'],function(_0x458b59){return{'name':_0x458b59[_0x15ea('0x30')],'type':_0x458b59[_0x15ea('0x31')][_0x15ea('0x32')]};});_0x37d943[_0x15ea('0x33')]=_['map'](_0x33f3ae,_0x15ea('0x2b'));_0x37d943[_0x15ea('0x34')]=_['keys'](_0x1c85da[_0x15ea('0x34')]);_0x37d943[_0x15ea('0x35')]=_[_0x15ea('0x36')](_0x37d943[_0x15ea('0x33')],_0x37d943[_0x15ea('0x34')]);_0x1a3bca[_0x15ea('0x37')]=_['intersection'](_0x37d943[_0x15ea('0x33')],qs[_0x15ea('0x38')](_0x1c85da[_0x15ea('0x34')][_0x15ea('0x38')]));_0x1a3bca['attributes']=_0x1a3bca['attributes']['length']?_0x1a3bca[_0x15ea('0x37')]:_0x37d943[_0x15ea('0x33')];if(!_0x1c85da[_0x15ea('0x34')][_0x15ea('0x39')](_0x15ea('0x3a'))){_0x1a3bca[_0x15ea('0x1d')]=qs[_0x15ea('0x1d')](_0x1c85da[_0x15ea('0x34')][_0x15ea('0x1d')]);_0x1a3bca[_0x15ea('0x1f')]=qs[_0x15ea('0x1f')](_0x1c85da[_0x15ea('0x34')][_0x15ea('0x1f')]);}_0x1a3bca[_0x15ea('0x3b')]=qs[_0x15ea('0x3c')](_0x1c85da[_0x15ea('0x34')][_0x15ea('0x3c')]);_0x1a3bca['where']=qs['filters'](_[_0x15ea('0x3d')](_0x1c85da[_0x15ea('0x34')],_0x37d943[_0x15ea('0x35')]),_0x33f3ae);if(_0x1c85da[_0x15ea('0x34')][_0x15ea('0x3e')]){_0x1a3bca[_0x15ea('0x3f')]=_[_0x15ea('0x40')](_0x1a3bca[_0x15ea('0x3f')],{'$or':_[_0x15ea('0x2e')](_0x33f3ae,function(_0x8110c5){if(_0x8110c5[_0x15ea('0x31')]!==_0x15ea('0x41')){var _0x2e1b7c={};_0x2e1b7c[_0x8110c5[_0x15ea('0x2b')]]={'$like':'%'+_0x1c85da['query']['filter']+'%'};return _0x2e1b7c;}})});}_0x1a3bca=_['merge']({},_0x1a3bca,_0x1c85da[_0x15ea('0x42')]);var _0x5d456a={'where':_0x1a3bca[_0x15ea('0x3f')]};return db[_0x15ea('0x2f')][_0x15ea('0x20')](_0x5d456a)[_0x15ea('0x26')](function(_0x45d655){_0x20aa2a[_0x15ea('0x20')]=_0x45d655;if(_0x1c85da[_0x15ea('0x34')][_0x15ea('0x43')]){_0x1a3bca[_0x15ea('0x44')]=[{'all':!![]}];}return db[_0x15ea('0x2f')]['findAll'](_0x1a3bca);})[_0x15ea('0x26')](function(_0x161190){_0x20aa2a[_0x15ea('0x45')]=_0x161190;return _0x20aa2a;})[_0x15ea('0x26')](respondWithFilteredResult(_0x223fb5,_0x1a3bca))[_0x15ea('0x46')](handleError(_0x223fb5,null));};exports[_0x15ea('0x47')]=function(_0x2389a0,_0x551136){var _0x1e8356={'raw':![],'where':{'id':_0x2389a0[_0x15ea('0x48')]['id']}},_0x4debf1={};_0x4debf1[_0x15ea('0x33')]=_[_0x15ea('0x49')](db[_0x15ea('0x2f')][_0x15ea('0x4a')]);_0x4debf1[_0x15ea('0x34')]=_['keys'](_0x2389a0[_0x15ea('0x34')]);_0x4debf1[_0x15ea('0x35')]=_['intersection'](_0x4debf1[_0x15ea('0x33')],_0x4debf1[_0x15ea('0x34')]);_0x1e8356[_0x15ea('0x37')]=_[_0x15ea('0x36')](_0x4debf1[_0x15ea('0x33')],qs[_0x15ea('0x38')](_0x2389a0[_0x15ea('0x34')]['fields']));_0x1e8356['attributes']=_0x1e8356['attributes']['length']?_0x1e8356[_0x15ea('0x37')]:_0x4debf1[_0x15ea('0x33')];if(_0x2389a0['query'][_0x15ea('0x43')]){_0x1e8356['include']=[{'all':!![]}];}_0x1e8356=_[_0x15ea('0x40')]({},_0x1e8356,_0x2389a0[_0x15ea('0x42')]);return db[_0x15ea('0x2f')][_0x15ea('0x4b')](_0x1e8356)[_0x15ea('0x26')](handleEntityNotFound(_0x551136,null))[_0x15ea('0x26')](respondWithResult(_0x551136,null))[_0x15ea('0x46')](handleError(_0x551136,null));};exports['create']=function(_0x3c84cc,_0x29fbcd){return db['Trigger'][_0x15ea('0x4c')](_0x3c84cc[_0x15ea('0x4d')],{})['then'](function(_0x5d7162){var _0x27ce22=_0x3c84cc[_0x15ea('0x4e')][_0x15ea('0x4f')]({'plain':!![]});if(!_0x27ce22)throw new Error(_0x15ea('0x50'));if(_0x27ce22[_0x15ea('0x51')]==='user'){var _0x185d9e=_0x5d7162[_0x15ea('0x4f')]({'plain':!![]});var _0x5c0bff=_0x15ea('0x27');return db[_0x15ea('0x52')]['find']({'where':{'name':_0x5c0bff,'userProfileId':_0x27ce22[_0x15ea('0x53')]},'raw':!![]})['then'](function(_0x2822ea){if(_0x2822ea&&_0x2822ea[_0x15ea('0x54')]===0x0){return db['UserProfileResource'][_0x15ea('0x4c')]({'name':_0x185d9e[_0x15ea('0x2b')],'resourceId':_0x185d9e['id'],'type':_0x2822ea[_0x15ea('0x2b')],'sectionId':_0x2822ea['id']},{})[_0x15ea('0x26')](function(){return _0x5d7162;});}else{return _0x5d7162;}})['catch'](function(_0x5b5db3){logger[_0x15ea('0x29')](_0x15ea('0x55'),_0x5b5db3);throw _0x5b5db3;});}return _0x5d7162;})[_0x15ea('0x26')](respondWithResult(_0x29fbcd,0xc9))[_0x15ea('0x46')](handleError(_0x29fbcd,null));};exports[_0x15ea('0x24')]=function(_0x220aaf,_0x2d6a40){if(_0x220aaf[_0x15ea('0x4d')]['id']){delete _0x220aaf['body']['id'];}return db['Trigger'][_0x15ea('0x4b')]({'where':{'id':_0x220aaf[_0x15ea('0x48')]['id']}})[_0x15ea('0x26')](handleEntityNotFound(_0x2d6a40,null))[_0x15ea('0x26')](saveUpdates(_0x220aaf[_0x15ea('0x4d')],null))['then'](respondWithResult(_0x2d6a40,null))[_0x15ea('0x46')](handleError(_0x2d6a40,null));};exports[_0x15ea('0x25')]=function(_0x101738,_0x5f5d24){return db[_0x15ea('0x2f')]['find']({'where':{'id':_0x101738[_0x15ea('0x48')]['id']}})['then'](handleEntityNotFound(_0x5f5d24,null))[_0x15ea('0x26')](removeEntity(_0x5f5d24,null))[_0x15ea('0x46')](handleError(_0x5f5d24,null));};exports[_0x15ea('0x56')]=function(_0x2fd4b4,_0x30dd56,_0x4b1568){if(_0x2fd4b4['body']['id']){delete _0x2fd4b4[_0x15ea('0x4d')]['id'];}return db[_0x15ea('0x2f')][_0x15ea('0x4b')]({'where':{'id':_0x2fd4b4['params']['id']}})[_0x15ea('0x26')](handleEntityNotFound(_0x30dd56,null))['then'](function(_0xbf8ac7){if(_0xbf8ac7){_0x2fd4b4[_0x15ea('0x4d')]['TriggerAllId']=_0xbf8ac7['id'];return db[_0x15ea('0x57')][_0x15ea('0x4c')](_0x2fd4b4[_0x15ea('0x4d')]);}})[_0x15ea('0x26')](respondWithResult(_0x30dd56,null))[_0x15ea('0x46')](handleError(_0x30dd56,null));};exports['addAnyCondition']=function(_0x3d2609,_0x3b2753,_0x11f7f8){if(_0x3d2609[_0x15ea('0x4d')]['id']){delete _0x3d2609[_0x15ea('0x4d')]['id'];}return db[_0x15ea('0x2f')][_0x15ea('0x4b')]({'where':{'id':_0x3d2609[_0x15ea('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b2753,null))[_0x15ea('0x26')](function(_0x613604){if(_0x613604){_0x3d2609[_0x15ea('0x4d')][_0x15ea('0x58')]=_0x613604['id'];return db[_0x15ea('0x57')][_0x15ea('0x4c')](_0x3d2609[_0x15ea('0x4d')]);}})[_0x15ea('0x26')](respondWithResult(_0x3b2753,null))[_0x15ea('0x46')](handleError(_0x3b2753,null));};exports['getAllConditions']=function(_0x554d55,_0x2d4483,_0x27bbb7){var _0x6b5180={};var _0x260069={};var _0x493506;var _0x1a4da6;return db[_0x15ea('0x2f')]['findOne']({'where':{'id':_0x554d55[_0x15ea('0x48')]['id']}})[_0x15ea('0x26')](handleEntityNotFound(_0x2d4483,null))[_0x15ea('0x26')](function(_0x1ed1cb){if(_0x1ed1cb){_0x493506=_0x1ed1cb;_0x260069['model']=_[_0x15ea('0x49')](db['Condition'][_0x15ea('0x4a')]);_0x260069[_0x15ea('0x34')]=_[_0x15ea('0x49')](_0x554d55['query']);_0x260069[_0x15ea('0x35')]=_[_0x15ea('0x36')](_0x260069[_0x15ea('0x33')],_0x260069[_0x15ea('0x34')]);_0x6b5180[_0x15ea('0x37')]=_[_0x15ea('0x36')](_0x260069['model'],qs['fields'](_0x554d55[_0x15ea('0x34')]['fields']));_0x6b5180[_0x15ea('0x37')]=_0x6b5180[_0x15ea('0x37')][_0x15ea('0x59')]?_0x6b5180[_0x15ea('0x37')]:_0x260069[_0x15ea('0x33')];_0x6b5180[_0x15ea('0x3b')]=qs[_0x15ea('0x3c')](_0x554d55[_0x15ea('0x34')][_0x15ea('0x3c')]);_0x6b5180['where']=qs[_0x15ea('0x35')](_['pick'](_0x554d55[_0x15ea('0x34')],_0x260069['filters']));if(_0x554d55[_0x15ea('0x34')]['filter']){_0x6b5180['where']=_[_0x15ea('0x40')](_0x6b5180[_0x15ea('0x3f')],{'$or':_[_0x15ea('0x2e')](_0x6b5180[_0x15ea('0x37')],function(_0x4ac6b6){var _0x370361={};_0x370361[_0x4ac6b6]={'$like':'%'+_0x554d55['query'][_0x15ea('0x3e')]+'%'};return _0x370361;})});}_0x6b5180=_[_0x15ea('0x40')]({},_0x6b5180,_0x554d55[_0x15ea('0x42')]);return _0x493506['getAllConditions'](_0x6b5180);}})[_0x15ea('0x26')](function(_0x50406d){if(_0x50406d){_0x1a4da6=_0x50406d[_0x15ea('0x59')];if(!_0x554d55['query'][_0x15ea('0x39')](_0x15ea('0x3a'))){_0x6b5180['limit']=qs[_0x15ea('0x1d')](_0x554d55[_0x15ea('0x34')][_0x15ea('0x1d')]);_0x6b5180[_0x15ea('0x1f')]=qs[_0x15ea('0x1f')](_0x554d55[_0x15ea('0x34')]['offset']);}return _0x493506[_0x15ea('0x5a')](_0x6b5180);}})[_0x15ea('0x26')](function(_0x527239){if(_0x527239){return _0x527239?{'count':_0x1a4da6,'rows':_0x527239}:null;}})[_0x15ea('0x26')](respondWithResult(_0x2d4483,null))[_0x15ea('0x46')](handleError(_0x2d4483,null));};exports[_0x15ea('0x5b')]=function(_0x2c5474,_0x2caf54,_0x1d80bd){var _0x11b035={};var _0x57ecd4={};var _0x2eded3;var _0x4e465e;return db[_0x15ea('0x2f')][_0x15ea('0x5c')]({'where':{'id':_0x2c5474[_0x15ea('0x48')]['id']}})['then'](handleEntityNotFound(_0x2caf54,null))[_0x15ea('0x26')](function(_0x5cbf56){if(_0x5cbf56){_0x2eded3=_0x5cbf56;_0x57ecd4['model']=_[_0x15ea('0x49')](db[_0x15ea('0x57')][_0x15ea('0x4a')]);_0x57ecd4['query']=_[_0x15ea('0x49')](_0x2c5474[_0x15ea('0x34')]);_0x57ecd4['filters']=_[_0x15ea('0x36')](_0x57ecd4[_0x15ea('0x33')],_0x57ecd4[_0x15ea('0x34')]);_0x11b035['attributes']=_['intersection'](_0x57ecd4[_0x15ea('0x33')],qs[_0x15ea('0x38')](_0x2c5474[_0x15ea('0x34')][_0x15ea('0x38')]));_0x11b035[_0x15ea('0x37')]=_0x11b035[_0x15ea('0x37')][_0x15ea('0x59')]?_0x11b035[_0x15ea('0x37')]:_0x57ecd4['model'];_0x11b035['order']=qs[_0x15ea('0x3c')](_0x2c5474[_0x15ea('0x34')]['sort']);_0x11b035[_0x15ea('0x3f')]=qs[_0x15ea('0x35')](_[_0x15ea('0x3d')](_0x2c5474['query'],_0x57ecd4[_0x15ea('0x35')]));if(_0x2c5474['query']['filter']){_0x11b035['where']=_[_0x15ea('0x40')](_0x11b035[_0x15ea('0x3f')],{'$or':_[_0x15ea('0x2e')](_0x11b035[_0x15ea('0x37')],function(_0x11adc5){var _0x661e2b={};_0x661e2b[_0x11adc5]={'$like':'%'+_0x2c5474[_0x15ea('0x34')][_0x15ea('0x3e')]+'%'};return _0x661e2b;})});}_0x11b035=_[_0x15ea('0x40')]({},_0x11b035,_0x2c5474['options']);return _0x2eded3[_0x15ea('0x5b')](_0x11b035);}})['then'](function(_0x1db225){if(_0x1db225){_0x4e465e=_0x1db225[_0x15ea('0x59')];if(!_0x2c5474['query'][_0x15ea('0x39')](_0x15ea('0x3a'))){_0x11b035[_0x15ea('0x1d')]=qs[_0x15ea('0x1d')](_0x2c5474[_0x15ea('0x34')][_0x15ea('0x1d')]);_0x11b035[_0x15ea('0x1f')]=qs[_0x15ea('0x1f')](_0x2c5474['query'][_0x15ea('0x1f')]);}return _0x2eded3['getAnyConditions'](_0x11b035);}})[_0x15ea('0x26')](function(_0x51257d){if(_0x51257d){return _0x51257d?{'count':_0x4e465e,'rows':_0x51257d}:null;}})[_0x15ea('0x26')](respondWithResult(_0x2caf54,null))[_0x15ea('0x46')](handleError(_0x2caf54,null));};exports[_0x15ea('0x5d')]=function(_0x36205d,_0x58c3fd,_0x31ed8c){if(_0x36205d[_0x15ea('0x4d')]['id']){delete _0x36205d[_0x15ea('0x4d')]['id'];}return db[_0x15ea('0x2f')][_0x15ea('0x4b')]({'where':{'id':_0x36205d[_0x15ea('0x48')]['id']}})[_0x15ea('0x26')](handleEntityNotFound(_0x58c3fd,null))[_0x15ea('0x26')](function(_0x172615){if(_0x172615){_0x36205d['body'][_0x15ea('0x5e')]=_0x172615['id'];return db[_0x15ea('0x5f')][_0x15ea('0x4c')](_0x36205d[_0x15ea('0x4d')]);}})[_0x15ea('0x26')](respondWithResult(_0x58c3fd,null))[_0x15ea('0x46')](handleError(_0x58c3fd,null));};exports[_0x15ea('0x60')]=function(_0x4985d3,_0x39b2a7,_0x1c7b59){var _0x3e3e2e={};var _0x6394e8={};var _0x26f274;var _0xcb70a1;return db['Trigger'][_0x15ea('0x5c')]({'where':{'id':_0x4985d3['params']['id']}})[_0x15ea('0x26')](handleEntityNotFound(_0x39b2a7,null))[_0x15ea('0x26')](function(_0x3f171a){if(_0x3f171a){_0x26f274=_0x3f171a;_0x6394e8[_0x15ea('0x33')]=_[_0x15ea('0x49')](db['Action'][_0x15ea('0x4a')]);_0x6394e8[_0x15ea('0x34')]=_['keys'](_0x4985d3[_0x15ea('0x34')]);_0x6394e8[_0x15ea('0x35')]=_[_0x15ea('0x36')](_0x6394e8['model'],_0x6394e8['query']);_0x3e3e2e[_0x15ea('0x37')]=_[_0x15ea('0x36')](_0x6394e8[_0x15ea('0x33')],qs[_0x15ea('0x38')](_0x4985d3[_0x15ea('0x34')][_0x15ea('0x38')]));_0x3e3e2e[_0x15ea('0x37')]=_0x3e3e2e[_0x15ea('0x37')][_0x15ea('0x59')]?_0x3e3e2e['attributes']:_0x6394e8[_0x15ea('0x33')];_0x3e3e2e[_0x15ea('0x3b')]=qs[_0x15ea('0x3c')](_0x4985d3['query'][_0x15ea('0x3c')]);_0x3e3e2e['where']=qs[_0x15ea('0x35')](_[_0x15ea('0x3d')](_0x4985d3[_0x15ea('0x34')],_0x6394e8[_0x15ea('0x35')]));if(_0x4985d3[_0x15ea('0x34')]['filter']){_0x3e3e2e[_0x15ea('0x3f')]=_[_0x15ea('0x40')](_0x3e3e2e[_0x15ea('0x3f')],{'$or':_[_0x15ea('0x2e')](_0x3e3e2e['attributes'],function(_0x94f1ac){var _0x411736={};_0x411736[_0x94f1ac]={'$like':'%'+_0x4985d3[_0x15ea('0x34')]['filter']+'%'};return _0x411736;})});}_0x3e3e2e=_['merge']({},_0x3e3e2e,_0x4985d3[_0x15ea('0x42')]);return _0x26f274[_0x15ea('0x60')](_0x3e3e2e);}})[_0x15ea('0x26')](function(_0xa60932){if(_0xa60932){_0xcb70a1=_0xa60932[_0x15ea('0x59')];if(!_0x4985d3[_0x15ea('0x34')][_0x15ea('0x39')]('nolimit')){_0x3e3e2e[_0x15ea('0x1d')]=qs[_0x15ea('0x1d')](_0x4985d3[_0x15ea('0x34')][_0x15ea('0x1d')]);_0x3e3e2e[_0x15ea('0x1f')]=qs[_0x15ea('0x1f')](_0x4985d3[_0x15ea('0x34')][_0x15ea('0x1f')]);}return _0x26f274[_0x15ea('0x60')](_0x3e3e2e);}})[_0x15ea('0x26')](function(_0x3e4c71){if(_0x3e4c71){return _0x3e4c71?{'count':_0xcb70a1,'rows':_0x3e4c71}:null;}})[_0x15ea('0x26')](respondWithResult(_0x39b2a7,null))[_0x15ea('0x46')](handleError(_0x39b2a7,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index d3a4f65..b6bb166 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 _0x6379=['exports','define','lodash','util','../../config/logger','api','moment','request-promise','path','./trigger.attributes'];(function(_0x347866,_0x31b3f2){var _0x8155a5=function(_0x5d7c24){while(--_0x5d7c24){_0x347866['push'](_0x347866['shift']());}};_0x8155a5(++_0x31b3f2);}(_0x6379,0x84));var _0x9637=function(_0x4c32f5,_0x3dbbf1){_0x4c32f5=_0x4c32f5-0x0;var _0x19cae9=_0x6379[_0x4c32f5];return _0x19cae9;};'use strict';var _=require(_0x9637('0x0'));var util=require(_0x9637('0x1'));var logger=require(_0x9637('0x2'))(_0x9637('0x3'));var moment=require(_0x9637('0x4'));var BPromise=require('bluebird');var rp=require(_0x9637('0x5'));var fs=require('fs');var path=require(_0x9637('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9637('0x7'));module[_0x9637('0x8')]=function(_0x19f7d0,_0x25087c){return _0x19f7d0[_0x9637('0x9')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x851c=['bluebird','request-promise','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x127106,_0x26e795){var _0x440765=function(_0x3748cd){while(--_0x3748cd){_0x127106['push'](_0x127106['shift']());}};_0x440765(++_0x26e795);}(_0x851c,0x19d));var _0xc851=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x851c[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xc851('0x0'));var util=require(_0xc851('0x1'));var logger=require(_0xc851('0x2'))(_0xc851('0x3'));var moment=require(_0xc851('0x4'));var BPromise=require(_0xc851('0x5'));var rp=require(_0xc851('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc851('0x7'));var config=require(_0xc851('0x8'));var attributes=require('./trigger.attributes');module[_0xc851('0x9')]=function(_0x272e34,_0x535cf1){return _0x272e34[_0xc851('0xa')]('Trigger',attributes,{'tableName':'tools_triggers','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 378b751..57a76b3 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 _0x3ab2=['Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Trigger','findAll','options','raw','attributes','limit','include','map','model','GetTrigger','ShowTrigger','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x19a439,_0x4988a0){var _0x559aa9=function(_0x2027a6){while(--_0x2027a6){_0x19a439['push'](_0x19a439['shift']());}};_0x559aa9(++_0x4988a0);}(_0x3ab2,0x173));var _0x23ab=function(_0x8f4933,_0x4c43f3){_0x8f4933=_0x8f4933-0x0;var _0x2e14be=_0x3ab2[_0x8f4933];return _0x2e14be;};'use strict';var _=require(_0x23ab('0x0'));var util=require(_0x23ab('0x1'));var moment=require(_0x23ab('0x2'));var BPromise=require(_0x23ab('0x3'));var rs=require(_0x23ab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23ab('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x23ab('0x6'));var jayson=require(_0x23ab('0x7'));var client=jayson['client'][_0x23ab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16affc,_0x34c853,_0x4c3f70){return new BPromise(function(_0x18b52f,_0x153a59){return client[_0x23ab('0x9')](_0x16affc,_0x4c3f70)[_0x23ab('0xa')](function(_0x809a90){logger['info'](_0x23ab('0xb'),_0x34c853,_0x23ab('0xc'));logger[_0x23ab('0xd')](_0x23ab('0xe'),_0x34c853,_0x23ab('0xc'),JSON[_0x23ab('0xf')](_0x809a90));if(_0x809a90[_0x23ab('0x10')]){if(_0x809a90['error'][_0x23ab('0x11')]===0x1f4){logger['error'](_0x23ab('0xb'),_0x34c853,_0x809a90[_0x23ab('0x10')][_0x23ab('0x12')]);return _0x153a59(_0x809a90[_0x23ab('0x10')]['message']);}logger[_0x23ab('0x10')](_0x23ab('0xb'),_0x34c853,_0x809a90[_0x23ab('0x10')][_0x23ab('0x12')]);return _0x18b52f(_0x809a90[_0x23ab('0x10')][_0x23ab('0x12')]);}else{logger[_0x23ab('0x13')](_0x23ab('0xb'),_0x34c853,_0x23ab('0xc'));_0x18b52f(_0x809a90[_0x23ab('0x14')][_0x23ab('0x12')]);}})[_0x23ab('0x15')](function(_0x457c2b){logger[_0x23ab('0x10')](_0x23ab('0xb'),_0x34c853,_0x457c2b);_0x153a59(_0x457c2b);});});}exports['GetTrigger']=function(_0x2f7257){var _0x40f76f=this;return new Promise(function(_0x48b0fe,_0x29879a){return db[_0x23ab('0x16')][_0x23ab('0x17')]({'raw':_0x2f7257[_0x23ab('0x18')]?_0x2f7257[_0x23ab('0x18')][_0x23ab('0x19')]===undefined?!![]:![]:!![],'where':_0x2f7257['options']?_0x2f7257[_0x23ab('0x18')]['where']||null:null,'attributes':_0x2f7257[_0x23ab('0x18')]?_0x2f7257['options'][_0x23ab('0x1a')]||null:null,'limit':_0x2f7257[_0x23ab('0x18')]?_0x2f7257[_0x23ab('0x18')][_0x23ab('0x1b')]||null:null,'include':_0x2f7257[_0x23ab('0x18')]?_0x2f7257['options'][_0x23ab('0x1c')]?_[_0x23ab('0x1d')](_0x2f7257[_0x23ab('0x18')][_0x23ab('0x1c')],function(_0x34a5d4){return{'model':db[_0x34a5d4[_0x23ab('0x1e')]],'as':_0x34a5d4['as'],'attributes':_0x34a5d4['attributes'],'include':_0x34a5d4[_0x23ab('0x1c')]?_['map'](_0x34a5d4[_0x23ab('0x1c')],function(_0x1a5d1a){return{'model':db[_0x1a5d1a[_0x23ab('0x1e')]],'as':_0x1a5d1a['as'],'attributes':_0x1a5d1a[_0x23ab('0x1a')],'include':_0x1a5d1a[_0x23ab('0x1c')]?_[_0x23ab('0x1d')](_0x1a5d1a[_0x23ab('0x1c')],function(_0x46c5e5){return{'model':db[_0x46c5e5[_0x23ab('0x1e')]],'as':_0x46c5e5['as'],'attributes':_0x46c5e5[_0x23ab('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x23ab('0xa')](function(_0x4bb3cd){logger[_0x23ab('0x13')](_0x23ab('0x1f'),_0x2f7257);logger[_0x23ab('0xd')](_0x23ab('0x1f'),_0x2f7257,JSON[_0x23ab('0xf')](_0x4bb3cd));_0x48b0fe(_0x4bb3cd);})[_0x23ab('0x15')](function(_0x103fad){logger[_0x23ab('0x10')](_0x23ab('0x1f'),_0x103fad[_0x23ab('0x12')],_0x2f7257);_0x29879a(_0x40f76f[_0x23ab('0x10')](0x1f4,_0x103fad[_0x23ab('0x12')]));});});};exports[_0x23ab('0x20')]=function(_0x21c3b0){var _0xe2102b=this;return new Promise(function(_0x4c1efb,_0x884dc3){return db[_0x23ab('0x16')][_0x23ab('0x21')]({'raw':_0x21c3b0[_0x23ab('0x18')]?_0x21c3b0[_0x23ab('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x21c3b0['options']?_0x21c3b0[_0x23ab('0x18')][_0x23ab('0x22')]||null:null,'attributes':_0x21c3b0[_0x23ab('0x18')]?_0x21c3b0[_0x23ab('0x18')][_0x23ab('0x1a')]||null:null,'include':_0x21c3b0[_0x23ab('0x18')]?_0x21c3b0['options'][_0x23ab('0x1c')]?_[_0x23ab('0x1d')](_0x21c3b0[_0x23ab('0x18')]['include'],function(_0x1b2a05){return{'model':db[_0x1b2a05[_0x23ab('0x1e')]],'as':_0x1b2a05['as'],'attributes':_0x1b2a05['attributes'],'include':_0x1b2a05[_0x23ab('0x1c')]?_['map'](_0x1b2a05['include'],function(_0x4e9a2a){return{'model':db[_0x4e9a2a[_0x23ab('0x1e')]],'as':_0x4e9a2a['as'],'attributes':_0x4e9a2a['attributes'],'include':_0x4e9a2a[_0x23ab('0x1c')]?_[_0x23ab('0x1d')](_0x4e9a2a[_0x23ab('0x1c')],function(_0x4e7f27){return{'model':db[_0x4e7f27[_0x23ab('0x1e')]],'as':_0x4e7f27['as'],'attributes':_0x4e7f27[_0x23ab('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x23ab('0xa')](function(_0x3097d3){logger[_0x23ab('0x13')]('ShowTrigger',_0x21c3b0);logger[_0x23ab('0xd')](_0x23ab('0x20'),_0x21c3b0,JSON[_0x23ab('0xf')](_0x3097d3));_0x4c1efb(_0x3097d3);})['catch'](function(_0x25802d){logger[_0x23ab('0x10')](_0x23ab('0x20'),_0x25802d['message'],_0x21c3b0);_0x884dc3(_0xe2102b[_0x23ab('0x10')](0x1f4,_0x25802d[_0x23ab('0x12')]));});});}; \ No newline at end of file +var _0x4476=['then','stringify','ShowTrigger','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','error','Trigger,\x20%s,\x20%s','message','catch','GetTrigger','Trigger','findAll','options','where','attributes','limit','include','map','model'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x4476,0x1d9));var _0x6447=function(_0x5a513c,_0x1ac679){_0x5a513c=_0x5a513c-0x0;var _0x323bc3=_0x4476[_0x5a513c];return _0x323bc3;};'use strict';var _=require(_0x6447('0x0'));var util=require(_0x6447('0x1'));var moment=require(_0x6447('0x2'));var BPromise=require(_0x6447('0x3'));var rs=require(_0x6447('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6447('0x5'))['db'];var utils=require(_0x6447('0x6'));var logger=require(_0x6447('0x7'))(_0x6447('0x8'));var config=require(_0x6447('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6447('0xa')][_0x6447('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x836662,_0x3548c5,_0x33fd1a){return new BPromise(function(_0xc7ec8f,_0x24d32a){return client[_0x6447('0xc')](_0x836662,_0x33fd1a)['then'](function(_0x57a295){logger[_0x6447('0xd')]('Trigger,\x20%s,\x20%s',_0x3548c5,'request\x20sent');logger[_0x6447('0xe')](_0x6447('0xf'),_0x3548c5,_0x6447('0x10'),JSON['stringify'](_0x57a295));if(_0x57a295[_0x6447('0x11')]){if(_0x57a295[_0x6447('0x11')]['code']===0x1f4){logger['error'](_0x6447('0x12'),_0x3548c5,_0x57a295[_0x6447('0x11')][_0x6447('0x13')]);return _0x24d32a(_0x57a295['error'][_0x6447('0x13')]);}logger[_0x6447('0x11')](_0x6447('0x12'),_0x3548c5,_0x57a295[_0x6447('0x11')][_0x6447('0x13')]);return _0xc7ec8f(_0x57a295[_0x6447('0x11')][_0x6447('0x13')]);}else{logger[_0x6447('0xd')]('Trigger,\x20%s,\x20%s',_0x3548c5,_0x6447('0x10'));_0xc7ec8f(_0x57a295['result'][_0x6447('0x13')]);}})[_0x6447('0x14')](function(_0x3afa0f){logger[_0x6447('0x11')](_0x6447('0x12'),_0x3548c5,_0x3afa0f);_0x24d32a(_0x3afa0f);});});}exports[_0x6447('0x15')]=function(_0x5a7b81){var _0x51dc4e=this;return new Promise(function(_0x4f1030,_0x33e43e){return db[_0x6447('0x16')][_0x6447('0x17')]({'raw':_0x5a7b81[_0x6447('0x18')]?_0x5a7b81[_0x6447('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5a7b81[_0x6447('0x18')]?_0x5a7b81[_0x6447('0x18')][_0x6447('0x19')]||null:null,'attributes':_0x5a7b81[_0x6447('0x18')]?_0x5a7b81[_0x6447('0x18')][_0x6447('0x1a')]||null:null,'limit':_0x5a7b81[_0x6447('0x18')]?_0x5a7b81[_0x6447('0x18')][_0x6447('0x1b')]||null:null,'include':_0x5a7b81[_0x6447('0x18')]?_0x5a7b81[_0x6447('0x18')][_0x6447('0x1c')]?_[_0x6447('0x1d')](_0x5a7b81[_0x6447('0x18')][_0x6447('0x1c')],function(_0x50aad6){return{'model':db[_0x50aad6[_0x6447('0x1e')]],'as':_0x50aad6['as'],'attributes':_0x50aad6[_0x6447('0x1a')],'include':_0x50aad6['include']?_[_0x6447('0x1d')](_0x50aad6[_0x6447('0x1c')],function(_0x5e40e0){return{'model':db[_0x5e40e0[_0x6447('0x1e')]],'as':_0x5e40e0['as'],'attributes':_0x5e40e0['attributes'],'include':_0x5e40e0[_0x6447('0x1c')]?_['map'](_0x5e40e0['include'],function(_0x81101d){return{'model':db[_0x81101d['model']],'as':_0x81101d['as'],'attributes':_0x81101d['attributes']};}):[]};}):[]};}):[]:[]})[_0x6447('0x1f')](function(_0x7f561e){logger['info'](_0x6447('0x15'),_0x5a7b81);logger[_0x6447('0xe')](_0x6447('0x15'),_0x5a7b81,JSON[_0x6447('0x20')](_0x7f561e));_0x4f1030(_0x7f561e);})[_0x6447('0x14')](function(_0x26ce2d){logger[_0x6447('0x11')](_0x6447('0x15'),_0x26ce2d[_0x6447('0x13')],_0x5a7b81);_0x33e43e(_0x51dc4e[_0x6447('0x11')](0x1f4,_0x26ce2d['message']));});});};exports[_0x6447('0x21')]=function(_0x511d21){var _0x303d37=this;return new Promise(function(_0x4bad13,_0x2a84d6){return db[_0x6447('0x16')][_0x6447('0x22')]({'raw':_0x511d21[_0x6447('0x18')]?_0x511d21['options'][_0x6447('0x23')]===undefined?!![]:![]:!![],'where':_0x511d21[_0x6447('0x18')]?_0x511d21[_0x6447('0x18')][_0x6447('0x19')]||null:null,'attributes':_0x511d21['options']?_0x511d21[_0x6447('0x18')][_0x6447('0x1a')]||null:null,'include':_0x511d21['options']?_0x511d21[_0x6447('0x18')]['include']?_[_0x6447('0x1d')](_0x511d21[_0x6447('0x18')][_0x6447('0x1c')],function(_0x192c22){return{'model':db[_0x192c22['model']],'as':_0x192c22['as'],'attributes':_0x192c22['attributes'],'include':_0x192c22['include']?_['map'](_0x192c22[_0x6447('0x1c')],function(_0x2f70fb){return{'model':db[_0x2f70fb[_0x6447('0x1e')]],'as':_0x2f70fb['as'],'attributes':_0x2f70fb[_0x6447('0x1a')],'include':_0x2f70fb[_0x6447('0x1c')]?_[_0x6447('0x1d')](_0x2f70fb[_0x6447('0x1c')],function(_0x2d4d94){return{'model':db[_0x2d4d94['model']],'as':_0x2d4d94['as'],'attributes':_0x2d4d94[_0x6447('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e7906){logger[_0x6447('0xd')](_0x6447('0x21'),_0x511d21);logger['debug'](_0x6447('0x21'),_0x511d21,JSON[_0x6447('0x20')](_0x3e7906));_0x4bad13(_0x3e7906);})[_0x6447('0x14')](function(_0x142fbe){logger[_0x6447('0x11')]('ShowTrigger',_0x142fbe[_0x6447('0x13')],_0x511d21);_0x2a84d6(_0x303d37[_0x6447('0x11')](0x1f4,_0x142fbe[_0x6447('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index be96e42..c6dd783 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 _0x142c=['get','/:id','isAuthenticated','show','post','/:id/clone','clone','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment'];(function(_0x2a0d2c,_0x202267){var _0x460dd8=function(_0x518579){while(--_0x518579){_0x2a0d2c['push'](_0x2a0d2c['shift']());}};_0x460dd8(++_0x202267);}(_0x142c,0x1c2));var _0xc142=function(_0x523898,_0x3c69e6){_0x523898=_0x523898-0x0;var _0x38ce96=_0x142c[_0x523898];return _0x38ce96;};'use strict';var multer=require(_0xc142('0x0'));var util=require(_0xc142('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc142('0x2'));var router=express[_0xc142('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc142('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc142('0x5'));var controller=require('./trunk.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc142('0x6')](_0xc142('0x7'),auth[_0xc142('0x8')](),controller[_0xc142('0x9')]);router[_0xc142('0xa')](_0xc142('0xb'),auth['isAuthenticated'](),controller[_0xc142('0xc')]);router[_0xc142('0xa')]('/',auth[_0xc142('0x8')](),controller[_0xc142('0xd')]);router[_0xc142('0xe')](_0xc142('0x7'),auth['isAuthenticated'](),controller[_0xc142('0xf')]);router[_0xc142('0x10')]('/:id',auth[_0xc142('0x8')](),controller[_0xc142('0x11')]);module[_0xc142('0x12')]=router; \ No newline at end of file +var _0x0669=['delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','isAuthenticated','get','post','/:id/clone','clone','put','/:id','update'];(function(_0x27b0c4,_0xaf6d02){var _0xcb87b2=function(_0x2bd20f){while(--_0x2bd20f){_0x27b0c4['push'](_0x27b0c4['shift']());}};_0xcb87b2(++_0xaf6d02);}(_0x0669,0x10c));var _0x9066=function(_0x47410f,_0x53d9b2){_0x47410f=_0x47410f-0x0;var _0x272541=_0x0669[_0x47410f];return _0x272541;};'use strict';var multer=require(_0x9066('0x0'));var util=require(_0x9066('0x1'));var path=require('path');var timeout=require(_0x9066('0x2'));var express=require(_0x9066('0x3'));var router=express[_0x9066('0x4')]();var fs_extra=require(_0x9066('0x5'));var auth=require(_0x9066('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9066('0x7'));var controller=require(_0x9066('0x8'));router['get']('/',auth[_0x9066('0x9')](),controller['index']);router[_0x9066('0xa')]('/:id',auth[_0x9066('0x9')](),controller['show']);router[_0x9066('0xb')](_0x9066('0xc'),auth[_0x9066('0x9')](),controller[_0x9066('0xd')]);router['post']('/',auth[_0x9066('0x9')](),controller['create']);router[_0x9066('0xe')](_0x9066('0xf'),auth[_0x9066('0x9')](),controller[_0x9066('0x10')]);router[_0x9066('0x11')](_0x9066('0xf'),auth[_0x9066('0x9')](),controller['destroy']);module[_0x9066('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 61c800b..690b972 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 _0x177b=['INTEGER','accept','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','dynamic','update,nonat','sequelize','exports','STRING','name','ENUM','friend','user','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','setDataValue','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','yes','nonat','update','outgoing','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]','\x22\x22\x20<>'];(function(_0x1af790,_0x24a1e9){var _0x13c10b=function(_0x481b95){while(--_0x481b95){_0x1af790['push'](_0x1af790['shift']());}};_0x13c10b(++_0x24a1e9);}(_0x177b,0x11a));var _0xb177=function(_0x47c492,_0x311a27){_0x47c492=_0x47c492-0x0;var _0x32105d=_0x177b[_0x47c492];return _0x32105d;};'use strict';var Sequelize=require(_0xb177('0x0'));module[_0xb177('0x1')]={'name':{'type':Sequelize[_0xb177('0x2')],'allowNull':![],'unique':_0xb177('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x5'),_0xb177('0x6'),'peer'),'allowNull':![],'defaultValue':_0xb177('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0xb177('0x7'),_0xb177('0x8'),'ALLOWED_FAILED_SCREEN',_0xb177('0x9'),_0xb177('0xa'),'PROHIB_PASSED_SCREEN',_0xb177('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0xb177('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xb177('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x502b19){this[_0xb177('0xc')]('transport',_0x502b19?_0x502b19['join'](','):null);},'get':function(){return this[_0xb177('0xd')](_0xb177('0xe'))?this[_0xb177('0xd')]('transport')[_0xb177('0xf')](','):null;},'comment':_0xb177('0x10')},'dtmfmode':{'type':Sequelize['ENUM'](_0xb177('0x11'),'info','shortinfo',_0xb177('0x12'),'auto'),'defaultValue':_0xb177('0x11')},'directmedia':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x13'),'no',_0xb177('0x14'),_0xb177('0x15'),_0xb177('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb177('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xb177('0x2')]},'nat':{'type':Sequelize[_0xb177('0x2')],'defaultValue':_0xb177('0x17'),'set':function(_0x2f230c){this['setDataValue'](_0xb177('0x18'),_0x2f230c?_0x2f230c[_0xb177('0x19')](','):null);},'get':function(){return this['getDataValue'](_0xb177('0x18'))?this['getDataValue'](_0xb177('0x18'))[_0xb177('0xf')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xb177('0x2')]},'namedcallgroup':{'type':Sequelize[_0xb177('0x2')]},'pickupgroup':{'type':Sequelize[_0xb177('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xb177('0x2')]},'language':{'type':Sequelize[_0xb177('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xb177('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb177('0x1a'),'set':function(_0x1a2586){this['setDataValue']('allow',_0x1a2586?_0x1a2586[_0xb177('0x19')](';'):_0xb177('0x1a'));},'get':function(){return this['getDataValue'](_0xb177('0x1b'))?this[_0xb177('0xd')]('allow')[_0xb177('0xf')](';'):null;},'comment':_0xb177('0x1c')},'autoframing':{'type':Sequelize[_0xb177('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0xb177('0x2')],'defaultValue':_0xb177('0x1d'),'set':function(_0x54a780){this['setDataValue']('insecure',_0x54a780?_0x54a780[_0xb177('0x19')](','):null);},'get':function(){return this[_0xb177('0xd')](_0xb177('0x1e'))?this['getDataValue'](_0xb177('0x1e'))[_0xb177('0xf')](','):null;},'comment':_0xb177('0x1f')},'trustrpid':{'type':Sequelize['ENUM'](_0xb177('0x13'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x13'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x13'),'no','never')},'promiscredir':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x13'),'no')},'useclientcode':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x13'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xb177('0x2')]},'callerid':{'type':Sequelize[_0xb177('0x2')],'defaultValue':_0xb177('0x20')},'amaflags':{'type':Sequelize[_0xb177('0x2')]},'callcounter':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x13'),'no'),'defaultValue':_0xb177('0x13')},'busylevel':{'type':Sequelize[_0xb177('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0xb177('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x13'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xb177('0x13'),'no')},'ignoresdpversion':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x13'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xb177('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0xb177('0x13'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xb177('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x13'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0xb177('0x22'),_0xb177('0x23'),_0xb177('0x24'))},'session_expires':{'type':Sequelize[_0xb177('0x21')](0xb)},'session_minse':{'type':Sequelize[_0xb177('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x25'),_0xb177('0x26')),'defaultValue':_0xb177('0x26')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xb177('0x2')]},'fromdomain':{'type':Sequelize[_0xb177('0x2')]},'fromuser':{'type':Sequelize[_0xb177('0x2')]},'port':{'type':Sequelize[_0xb177('0x21')](0x5)},'qualify':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x13'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xb177('0x21')](0xb)},'defaultip':{'type':Sequelize[_0xb177('0x2')]},'defaultuser':{'type':Sequelize[_0xb177('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xb177('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xb177('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0xb177('0x4')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb177('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xb177('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0xb177('0x21')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xb177('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xb177('0x2')]},'use_q850_reason':{'type':Sequelize[_0xb177('0x2')]},'maxforwards':{'type':Sequelize[_0xb177('0x21')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xb177('0x13'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x13'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xb177('0x13'),'no')},'icesupport':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x13'),'no')},'dtlsenable':{'type':Sequelize[_0xb177('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x13'),'no',_0xb177('0x27'),_0xb177('0x28'))},'dtlsrekey':{'type':Sequelize[_0xb177('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0xb177('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xb177('0x2')]},'dtlscipher':{'type':Sequelize[_0xb177('0x2')]},'dtlscafile':{'type':Sequelize[_0xb177('0x2')]},'dtlscapath':{'type':Sequelize[_0xb177('0x2')]},'dtlssetup':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x29'),'passive',_0xb177('0x2a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x13'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb177('0x2')]},'recordofffeature':{'type':Sequelize[_0xb177('0x2')]},'call_limit':{'type':Sequelize[_0xb177('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x13'),'no')},'subscribemwi':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x13'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xb177('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xb177('0x2')]},'description':{'type':Sequelize[_0xb177('0x2')]},'host':{'type':Sequelize[_0xb177('0x2')],'defaultValue':_0xb177('0x2b')},'canreinvite':{'type':Sequelize[_0xb177('0x4')](_0xb177('0x13'),'no',_0xb177('0x14'),'update',_0xb177('0x2c')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xb177('0x2')]},'otherFields':{'type':Sequelize[_0xb177('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x4e72=['INTEGER','\x22\x22\x20<>','accept','originate','uac','uas','certificate','active','passive','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','ENUM','friend','user','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','rfc2833','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','setDataValue','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x4e72,0xd5));var _0x24e7=function(_0x56f860,_0x4dfd2f){_0x56f860=_0x56f860-0x0;var _0x1e01c0=_0x4e72[_0x56f860];return _0x1e01c0;};'use strict';var Sequelize=require(_0x24e7('0x0'));module[_0x24e7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x3'),_0x24e7('0x4'),'peer'),'allowNull':![],'defaultValue':_0x24e7('0x3')},'context':{'type':Sequelize[_0x24e7('0x5')],'allowNull':![],'defaultValue':_0x24e7('0x6')},'callingpres':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x7'),_0x24e7('0x8'),_0x24e7('0x9'),_0x24e7('0xa'),_0x24e7('0xb'),_0x24e7('0xc'),_0x24e7('0xd'),_0x24e7('0xe'))},'deny':{'type':Sequelize[_0x24e7('0x5')]},'permit':{'type':Sequelize[_0x24e7('0x5')]},'secret':{'type':Sequelize[_0x24e7('0x5')]},'md5secret':{'type':Sequelize[_0x24e7('0x5')]},'remotesecret':{'type':Sequelize[_0x24e7('0x5')]},'transport':{'type':Sequelize[_0x24e7('0x5')],'defaultValue':_0x24e7('0xf'),'set':function(_0x39305d){this['setDataValue']('transport',_0x39305d?_0x39305d[_0x24e7('0x10')](','):null);},'get':function(){return this[_0x24e7('0x11')]('transport')?this[_0x24e7('0x11')](_0x24e7('0x12'))[_0x24e7('0x13')](','):null;},'comment':_0x24e7('0x14')},'dtmfmode':{'type':Sequelize[_0x24e7('0x2')]('rfc2833',_0x24e7('0x15'),_0x24e7('0x16'),'inband',_0x24e7('0x17')),'defaultValue':_0x24e7('0x18')},'directmedia':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x19'),'no',_0x24e7('0x1a'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x24e7('0x5')]},'directmediadeny':{'type':Sequelize[_0x24e7('0x5')]},'nat':{'type':Sequelize[_0x24e7('0x5')],'defaultValue':_0x24e7('0x1b'),'set':function(_0x38ecc9){this['setDataValue']('nat',_0x38ecc9?_0x38ecc9[_0x24e7('0x10')](','):null);},'get':function(){return this[_0x24e7('0x11')](_0x24e7('0x1c'))?this['getDataValue'](_0x24e7('0x1c'))['split'](','):null;},'comment':_0x24e7('0x1d')},'callgroup':{'type':Sequelize[_0x24e7('0x5')]},'namedcallgroup':{'type':Sequelize[_0x24e7('0x5')]},'pickupgroup':{'type':Sequelize[_0x24e7('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x24e7('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x24e7('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x24e7('0x5')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x24e7('0x5')],'allowNull':![],'defaultValue':_0x24e7('0x1e'),'set':function(_0x4e3dc9){this[_0x24e7('0x1f')]('allow',_0x4e3dc9?_0x4e3dc9[_0x24e7('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue']('allow')?this[_0x24e7('0x11')](_0x24e7('0x20'))[_0x24e7('0x13')](';'):null;},'comment':_0x24e7('0x21')},'autoframing':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x19'),'no')},'insecure':{'type':Sequelize[_0x24e7('0x5')],'defaultValue':_0x24e7('0x22'),'set':function(_0x4cee51){this[_0x24e7('0x1f')]('insecure',_0x4cee51?_0x4cee51[_0x24e7('0x10')](','):null);},'get':function(){return this[_0x24e7('0x11')](_0x24e7('0x23'))?this[_0x24e7('0x11')](_0x24e7('0x23'))[_0x24e7('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x24e7('0x2')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x24e7('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x24e7('0x2')]('yes','no',_0x24e7('0x24'))},'promiscredir':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x24e7('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0x24e7('0x25')](0xb)},'setvar':{'type':Sequelize[_0x24e7('0x5')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x24e7('0x26')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x19'),'no'),'defaultValue':_0x24e7('0x19')},'busylevel':{'type':Sequelize[_0x24e7('0x25')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x24e7('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x19'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x24e7('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x24e7('0x5')]},'template':{'type':Sequelize[_0x24e7('0x5')]},'videosupport':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x19'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x24e7('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x24e7('0x2')]('yes','no')},'mailbox':{'type':Sequelize[_0x24e7('0x5')]},'session_timers':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x27'),'refuse',_0x24e7('0x28'))},'session_expires':{'type':Sequelize[_0x24e7('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x24e7('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x29'),_0x24e7('0x2a')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x24e7('0x5')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x24e7('0x5')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x24e7('0x19'),'no'),'defaultValue':_0x24e7('0x19')},'keepalive':{'type':Sequelize[_0x24e7('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x24e7('0x5')]},'defaultuser':{'type':Sequelize[_0x24e7('0x5')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x24e7('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x24e7('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x19'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x24e7('0x5')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x24e7('0x25')](0xb)},'timerb':{'type':Sequelize[_0x24e7('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x24e7('0x25')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x24e7('0x5')]},'contactacl':{'type':Sequelize[_0x24e7('0x5')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x24e7('0x5')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x24e7('0x19'),'no')},'force_avp':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x19'),'no')},'icesupport':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x19'),'no','fingerprint',_0x24e7('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x24e7('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x24e7('0x5')]},'dtlsprivatekey':{'type':Sequelize[_0x24e7('0x5')]},'dtlscipher':{'type':Sequelize[_0x24e7('0x5')]},'dtlscafile':{'type':Sequelize[_0x24e7('0x5')]},'dtlscapath':{'type':Sequelize[_0x24e7('0x5')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x24e7('0x2c'),_0x24e7('0x2d'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x24e7('0x5')]},'usereqphone':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x24e7('0x5')]},'recordofffeature':{'type':Sequelize[_0x24e7('0x5')]},'call_limit':{'type':Sequelize[_0x24e7('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x19'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x24e7('0x19'),'no')},'vmexten':{'type':Sequelize[_0x24e7('0x5')]},'mohinterpret':{'type':Sequelize[_0x24e7('0x5')]},'mohsuggest':{'type':Sequelize[_0x24e7('0x5')]},'parkinglot':{'type':Sequelize[_0x24e7('0x5')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x24e7('0x5')],'defaultValue':_0x24e7('0x2e')},'canreinvite':{'type':Sequelize[_0x24e7('0x2')](_0x24e7('0x19'),'no','nonat',_0x24e7('0x2f'),_0x24e7('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x24e7('0x5')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x24e7('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x24e7('0x5')],'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 8c91933..c354339 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f62=['updatedAt','body','create','user','role','UserProfileSection','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','render','/etc/asterisk/sip_xcally_trunks.conf','Reload','server/files/templates/registry.ejs','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','get','Trunks','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','map','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Trunk','findAll','rows','show','params','clone','find','omit','createdAt'];(function(_0xf20b6,_0x49ddbb){var _0x4ff567=function(_0x3ccc7f){while(--_0x3ccc7f){_0xf20b6['push'](_0xf20b6['shift']());}};_0x4ff567(++_0x49ddbb);}(_0x9f62,0x154));var _0x29f6=function(_0x5c9abd,_0x3d36e4){_0x5c9abd=_0x5c9abd-0x0;var _0xd7ee38=_0x9f62[_0x5c9abd];return _0xd7ee38;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29f6('0x1'));var rp=require(_0x29f6('0x2'));var moment=require(_0x29f6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29f6('0x4'));var path=require(_0x29f6('0x5'));var sox=require(_0x29f6('0x6'));var csv=require(_0x29f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29f6('0x8'));var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x29f6('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x55cf4,_0x189344,_0x11a1fd,_0x17de6e){return new BPromise(function(_0x156c96,_0x35d2e2){var _0x2418ee=_0x17de6e||client;return _0x2418ee[_0x29f6('0x14')](_0x55cf4,_0x11a1fd)[_0x29f6('0x15')](function(_0x28d314){logger[_0x29f6('0x16')](_0x29f6('0x17'),_0x189344,_0x29f6('0x18'));logger[_0x29f6('0x19')](_0x29f6('0x1a'),_0x189344,_0x29f6('0x18'),JSON['stringify'](_0x28d314));if(_0x28d314['error']){if(_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){logger[_0x29f6('0x1b')]('Trunk,\x20%s,\x20%s',_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x35d2e2(_0x28d314['error'][_0x29f6('0x1d')]);}logger[_0x29f6('0x1b')](_0x29f6('0x17'),_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x156c96(_0x28d314[_0x29f6('0x1b')]['message']);}else{logger[_0x29f6('0x16')]('Trunk,\x20%s,\x20%s',_0x189344,'request\x20sent');_0x156c96(_0x28d314[_0x29f6('0x1e')][_0x29f6('0x1d')]);}})[_0x29f6('0x1f')](function(_0xafb5dd){logger['error'](_0x29f6('0x17'),_0x189344,_0xafb5dd);_0x35d2e2(_0xafb5dd);});});}function respondWithStatusCode(_0x49f67d,_0xd4179c){_0xd4179c=_0xd4179c||0xcc;return function(_0xcce041){if(_0xcce041){return _0x49f67d[_0x29f6('0x20')](_0xd4179c);}return _0x49f67d[_0x29f6('0x21')](_0xd4179c)['end']();};}function respondWithResult(_0x4290a2,_0x4d494f){_0x4d494f=_0x4d494f||0xc8;return function(_0x47c385){if(_0x47c385){return _0x4290a2[_0x29f6('0x21')](_0x4d494f)[_0x29f6('0x22')](_0x47c385);}};}function respondWithFilteredResult(_0x2519ac,_0x342038){return function(_0x84ccb7){if(_0x84ccb7){var _0x4333bc=typeof _0x342038[_0x29f6('0x23')]==='undefined'&&typeof _0x342038[_0x29f6('0x24')]===_0x29f6('0x25');var _0x1ab8d8=_0x84ccb7[_0x29f6('0x26')];var _0xda0a63=_0x4333bc?0x0:_0x342038[_0x29f6('0x23')];var _0x3790f5=_0x4333bc?_0x84ccb7[_0x29f6('0x26')]:_0x342038[_0x29f6('0x23')]+_0x342038[_0x29f6('0x24')];var _0x2915bc;if(_0x3790f5>=_0x1ab8d8){_0x3790f5=_0x1ab8d8;_0x2915bc=0xc8;}else{_0x2915bc=0xce;}_0x2519ac[_0x29f6('0x21')](_0x2915bc);return _0x2519ac[_0x29f6('0x27')](_0x29f6('0x28'),_0xda0a63+'-'+_0x3790f5+'/'+_0x1ab8d8)[_0x29f6('0x22')](_0x84ccb7);}return null;};}function patchUpdates(_0x218931){return function(_0x3a7249){try{jsonpatch['apply'](_0x3a7249,_0x218931,!![]);}catch(_0x5582d3){return BPromise[_0x29f6('0x29')](_0x5582d3);}return _0x3a7249['save']();};}function saveUpdates(_0x341071,_0xc8d2c5){return function(_0x1e1bb6){if(_0x1e1bb6){return _0x1e1bb6[_0x29f6('0x2a')](_0x341071)['then'](function(_0x53e11f){return _0x53e11f;});}return null;};}function removeEntity(_0x1bde69,_0xa6377c){return function(_0x2edc2e){if(_0x2edc2e){return _0x2edc2e[_0x29f6('0x2b')]()[_0x29f6('0x15')](function(){var _0x20bc5e=_0x2edc2e[_0x29f6('0x2c')]({'plain':!![]});var _0x1c3f0f=_0x29f6('0x2d');return db[_0x29f6('0x2e')][_0x29f6('0x2b')]({'where':{'type':_0x1c3f0f,'resourceId':_0x20bc5e['id']}})[_0x29f6('0x15')](function(){return _0x2edc2e;});})[_0x29f6('0x15')](function(){_0x1bde69[_0x29f6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e31dd,_0x206beb){return function(_0x44cf19){if(!_0x44cf19){_0x5e31dd[_0x29f6('0x20')](0x194);}return _0x44cf19;};}function handleError(_0x5416dc,_0x3e1e25){_0x3e1e25=_0x3e1e25||0x1f4;return function(_0x749b9d){logger[_0x29f6('0x1b')](_0x749b9d[_0x29f6('0x2f')]);if(_0x749b9d[_0x29f6('0x30')]){delete _0x749b9d['name'];}_0x5416dc[_0x29f6('0x21')](_0x3e1e25)[_0x29f6('0x31')](_0x749b9d);};}exports[_0x29f6('0x32')]=function(_0x1b51cc,_0x4f5fe1){var _0x30d747={},_0x2a09e8={},_0x14b392={'count':0x0,'rows':[]};var _0x105557=_['map'](db['Trunk'][_0x29f6('0x33')],function(_0x4bfc80){return{'name':_0x4bfc80[_0x29f6('0x34')],'type':_0x4bfc80['type'][_0x29f6('0x35')]};});_0x2a09e8['model']=_[_0x29f6('0x36')](_0x105557,_0x29f6('0x30'));_0x2a09e8['query']=_[_0x29f6('0x37')](_0x1b51cc['query']);_0x2a09e8[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x2a09e8['model'],_0x2a09e8[_0x29f6('0x3a')]);_0x30d747[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2a09e8[_0x29f6('0x3c')],qs['fields'](_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x3d')]));_0x30d747[_0x29f6('0x3b')]=_0x30d747[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x30d747['attributes']:_0x2a09e8[_0x29f6('0x3c')];if(!_0x1b51cc['query'][_0x29f6('0x3f')]('nolimit')){_0x30d747[_0x29f6('0x24')]=qs[_0x29f6('0x24')](_0x1b51cc['query'][_0x29f6('0x24')]);_0x30d747[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x1b51cc[_0x29f6('0x3a')]['offset']);}_0x30d747[_0x29f6('0x40')]=qs[_0x29f6('0x41')](_0x1b51cc[_0x29f6('0x3a')]['sort']);_0x30d747[_0x29f6('0x42')]=qs['filters'](_[_0x29f6('0x43')](_0x1b51cc['query'],_0x2a09e8['filters']),_0x105557);if(_0x1b51cc['query'][_0x29f6('0x44')]){_0x30d747[_0x29f6('0x42')]=_[_0x29f6('0x45')](_0x30d747[_0x29f6('0x42')],{'$or':_[_0x29f6('0x36')](_0x105557,function(_0x270842){if(_0x270842[_0x29f6('0x46')]!==_0x29f6('0x47')){var _0x352119={};_0x352119[_0x270842[_0x29f6('0x30')]]={'$like':'%'+_0x1b51cc['query']['filter']+'%'};return _0x352119;}})});}_0x30d747=_[_0x29f6('0x45')]({},_0x30d747,_0x1b51cc[_0x29f6('0x48')]);var _0x7a65c0={'where':_0x30d747[_0x29f6('0x42')]};return db['Trunk'][_0x29f6('0x26')](_0x7a65c0)[_0x29f6('0x15')](function(_0x532df5){_0x14b392[_0x29f6('0x26')]=_0x532df5;if(_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x30d747[_0x29f6('0x4a')]=[{'all':!![]}];}return db[_0x29f6('0x4b')][_0x29f6('0x4c')](_0x30d747);})[_0x29f6('0x15')](function(_0x1f03b6){_0x14b392[_0x29f6('0x4d')]=_0x1f03b6;return _0x14b392;})[_0x29f6('0x15')](respondWithFilteredResult(_0x4f5fe1,_0x30d747))[_0x29f6('0x1f')](handleError(_0x4f5fe1,null));};exports[_0x29f6('0x4e')]=function(_0x58ea69,_0x416c24){var _0x463551={'raw':![],'where':{'id':_0x58ea69[_0x29f6('0x4f')]['id']}},_0x335ec1={};_0x335ec1[_0x29f6('0x3c')]=_['keys'](db[_0x29f6('0x4b')]['rawAttributes']);_0x335ec1['query']=_[_0x29f6('0x37')](_0x58ea69[_0x29f6('0x3a')]);_0x335ec1[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x335ec1[_0x29f6('0x3c')],_0x335ec1['query']);_0x463551[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x335ec1['model'],qs[_0x29f6('0x3d')](_0x58ea69['query'][_0x29f6('0x3d')]));_0x463551[_0x29f6('0x3b')]=_0x463551[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x463551['attributes']:_0x335ec1[_0x29f6('0x3c')];if(_0x58ea69[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x463551[_0x29f6('0x4a')]=[{'all':!![]}];}_0x463551=_[_0x29f6('0x45')]({},_0x463551,_0x58ea69[_0x29f6('0x48')]);return db[_0x29f6('0x4b')]['find'](_0x463551)[_0x29f6('0x15')](handleEntityNotFound(_0x416c24,null))[_0x29f6('0x15')](respondWithResult(_0x416c24,null))[_0x29f6('0x1f')](handleError(_0x416c24,null));};exports[_0x29f6('0x50')]=function(_0x36e52c,_0x1ac20d){var _0x37c3c1={'where':{'id':_0x36e52c[_0x29f6('0x4f')]['id']}},_0x2f356d={};_0x2f356d[_0x29f6('0x3c')]=_['keys'](db['Trunk'][_0x29f6('0x33')]);_0x37c3c1[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2f356d['model'],qs[_0x29f6('0x3d')](_0x36e52c['query']['fields']));_0x37c3c1[_0x29f6('0x3b')]=_0x37c3c1[_0x29f6('0x3b')]['length']?_0x37c3c1['attributes']:_0x2f356d[_0x29f6('0x3c')];if(_0x36e52c[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x37c3c1['include']=[{'all':!![]}];}_0x37c3c1=_[_0x29f6('0x45')]({},_0x37c3c1,_0x36e52c[_0x29f6('0x48')]);return db[_0x29f6('0x4b')][_0x29f6('0x51')](_0x37c3c1)[_0x29f6('0x15')](handleEntityNotFound(_0x1ac20d,null))[_0x29f6('0x15')](function(_0x7700da){if(_0x7700da){var _0x33b1d7=_0x7700da[_0x29f6('0x2c')]({'plain':!![]});_0x33b1d7=qs[_0x29f6('0x52')](_0x33b1d7,['id',_0x29f6('0x53'),_0x29f6('0x54')]);_0x36e52c[_0x29f6('0x55')]=_['omit'](_0x36e52c['body'],['id',_0x29f6('0x53'),'updatedAt']);return db[_0x29f6('0x4b')][_0x29f6('0x56')](_[_0x29f6('0x45')](_0x33b1d7,_0x36e52c[_0x29f6('0x55')]),{'include':_0x36e52c[_0x29f6('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x29f6('0x15')](function(_0x38d684){var _0x2f694e=_0x36e52c[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x2f694e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f694e[_0x29f6('0x58')]==='user'){var _0x51b9dc=_0x38d684[_0x29f6('0x2c')]({'plain':!![]});var _0x336b8e='Trunks';return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':_0x336b8e,'userProfileId':_0x2f694e['userProfileId']},'raw':!![]})[_0x29f6('0x15')](function(_0x2ba44c){if(_0x2ba44c&&_0x2ba44c[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')][_0x29f6('0x56')]({'name':_0x51b9dc[_0x29f6('0x30')],'resourceId':_0x51b9dc['id'],'type':_0x2ba44c[_0x29f6('0x30')],'sectionId':_0x2ba44c['id']},{})['then'](function(){return _0x38d684;});}else{return _0x38d684;}})[_0x29f6('0x1f')](function(_0x50ddd6){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50ddd6);throw _0x50ddd6;});}return _0x38d684;});}})['then'](respondWithResult(_0x1ac20d,0xc9))[_0x29f6('0x1f')](handleError(_0x1ac20d,null));};exports[_0x29f6('0x56')]=function(_0x195887,_0x536b0c,_0x6ae738){var _0x373cf6;return db[_0x29f6('0x4b')]['create'](_0x195887[_0x29f6('0x55')],{'raw':!![]})[_0x29f6('0x15')](function(_0x66a7bb){_0x373cf6=_0x66a7bb;return db[_0x29f6('0x4b')][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x6587f3){var _0x41c1b9=fs['readFileSync'](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x1636f1=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],'server/files/templates/registry.ejs'),_0x29f6('0x5e'));var _0x1ca187=ejs['render'](_0x41c1b9,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ca187);if(_0x373cf6[_0x29f6('0x61')]){var _0x5a383f=ejs['render'](_0x1636f1,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x5a383f);}})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':_0x29f6('0x63')});})[_0x29f6('0x15')](function(){var _0x144c76=_0x195887[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x144c76)throw new Error(_0x29f6('0x64'));if(_0x144c76[_0x29f6('0x58')]==='user'){var _0x11ef85=_0x373cf6[_0x29f6('0x2c')]({'plain':!![]});return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':'Trunks','userProfileId':_0x144c76[_0x29f6('0x65')]},'raw':!![]})[_0x29f6('0x15')](function(_0x32a862){if(_0x32a862&&_0x32a862[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')]['create']({'name':_0x11ef85[_0x29f6('0x30')],'resourceId':_0x11ef85['id'],'type':_0x32a862[_0x29f6('0x30')],'sectionId':_0x32a862['id']},{})[_0x29f6('0x15')](function(){return _0x373cf6;});}else{return _0x373cf6;}})[_0x29f6('0x1f')](function(_0x4273a3){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4273a3);throw _0x4273a3;});}return _0x373cf6;})[_0x29f6('0x15')](respondWithResult(_0x536b0c,0xc9))['catch'](handleError(_0x536b0c,null));};exports['update']=function(_0x4f9907,_0x842ae3,_0x5bcf90){var _0x425da2;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x4f9907[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x842ae3,null))[_0x29f6('0x15')](saveUpdates(_0x4f9907[_0x29f6('0x55')],null))['then'](function(_0x3a23f3){if(_0x3a23f3){_0x425da2=_0x3a23f3;return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});}})[_0x29f6('0x15')](function(_0x32fa77){if(_0x32fa77){var _0x1d6e32=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0xe14459=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0xa31c7d=ejs[_0x29f6('0x66')](_0x1d6e32,{'trunks':_0x32fa77||[]});fs['writeFileSync'](_0x29f6('0x67'),_0xa31c7d);var _0x57b9fb=ejs[_0x29f6('0x66')](_0xe14459,{'trunks':_0x32fa77||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x57b9fb);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2a'),{'module':_0x29f6('0x63')});}return null;})[_0x29f6('0x15')](function(_0x4203f1){if(_0x4203f1){return _0x425da2;}})[_0x29f6('0x15')](respondWithResult(_0x842ae3,null))[_0x29f6('0x1f')](handleError(_0x842ae3,null));};exports['destroy']=function(_0x1d61ff,_0x4c0acc,_0x16bb3c){var _0x144d8c;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x1d61ff[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x4c0acc,null))[_0x29f6('0x15')](removeEntity(_0x4c0acc,null))[_0x29f6('0x15')](function(){return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x4e185f){var _0x4bb53f=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x906098=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x69')),_0x29f6('0x5e'));var _0x3f51fa=ejs['render'](_0x4bb53f,{'trunks':_0x4e185f});var _0x4b9631=ejs[_0x29f6('0x66')](_0x906098,{'trunks':_0x4e185f});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3f51fa);fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x4b9631);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2b'),{'module':_0x29f6('0x63')});})[_0x29f6('0x1f')](handleError(_0x4c0acc,null));}; \ No newline at end of file +var _0x34e8=['limit','count','set','Content-Range','json','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','key','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','clone','rawAttributes','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','Reload','chan_sip.so','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','offset','undefined'];(function(_0x1d2adf,_0x8b056f){var _0x431bd7=function(_0x2785a7){while(--_0x2785a7){_0x1d2adf['push'](_0x1d2adf['shift']());}};_0x431bd7(++_0x8b056f);}(_0x34e8,0x12c));var _0x834e=function(_0x2cd5c6,_0x5b2296){_0x2cd5c6=_0x2cd5c6-0x0;var _0x1df5d2=_0x34e8[_0x2cd5c6];return _0x1df5d2;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x834e('0x1c'));var client=jayson[_0x834e('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23848e,_0x2d95f2,_0x28e659,_0x21cc0a){return new BPromise(function(_0x50e860,_0x43156c){var _0x302cbd=_0x21cc0a||client;return _0x302cbd['request'](_0x23848e,_0x28e659)[_0x834e('0x1e')](function(_0x4a9cdc){logger[_0x834e('0x1f')](_0x834e('0x20'),_0x2d95f2,'request\x20sent');logger[_0x834e('0x21')](_0x834e('0x22'),_0x2d95f2,_0x834e('0x23'),JSON['stringify'](_0x4a9cdc));if(_0x4a9cdc[_0x834e('0x24')]){if(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x25')]===0x1f4){logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);return _0x43156c(_0x4a9cdc['error'][_0x834e('0x26')]);}logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')]['message']);return _0x50e860(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);}else{logger['info'](_0x834e('0x20'),_0x2d95f2,_0x834e('0x23'));_0x50e860(_0x4a9cdc[_0x834e('0x27')]['message']);}})['catch'](function(_0x231619){logger[_0x834e('0x24')]('Trunk,\x20%s,\x20%s',_0x2d95f2,_0x231619);_0x43156c(_0x231619);});});}function respondWithStatusCode(_0x25ee1d,_0x1dc1e0){_0x1dc1e0=_0x1dc1e0||0xcc;return function(_0x58f4fd){if(_0x58f4fd){return _0x25ee1d[_0x834e('0x28')](_0x1dc1e0);}return _0x25ee1d[_0x834e('0x29')](_0x1dc1e0)[_0x834e('0x2a')]();};}function respondWithResult(_0x561cd2,_0x24fcf7){_0x24fcf7=_0x24fcf7||0xc8;return function(_0x3e310f){if(_0x3e310f){return _0x561cd2['status'](_0x24fcf7)['json'](_0x3e310f);}};}function respondWithFilteredResult(_0x1e713a,_0x508a1d){return function(_0x2826ec){if(_0x2826ec){var _0x3f1b0b=typeof _0x508a1d[_0x834e('0x2b')]===_0x834e('0x2c')&&typeof _0x508a1d[_0x834e('0x2d')]===_0x834e('0x2c');var _0x491919=_0x2826ec['count'];var _0x4dc64a=_0x3f1b0b?0x0:_0x508a1d['offset'];var _0x2c7a8d=_0x3f1b0b?_0x2826ec[_0x834e('0x2e')]:_0x508a1d[_0x834e('0x2b')]+_0x508a1d['limit'];var _0xb5bc06;if(_0x2c7a8d>=_0x491919){_0x2c7a8d=_0x491919;_0xb5bc06=0xc8;}else{_0xb5bc06=0xce;}_0x1e713a[_0x834e('0x29')](_0xb5bc06);return _0x1e713a[_0x834e('0x2f')](_0x834e('0x30'),_0x4dc64a+'-'+_0x2c7a8d+'/'+_0x491919)[_0x834e('0x31')](_0x2826ec);}return null;};}function patchUpdates(_0x390119){return function(_0x3d149d){try{jsonpatch[_0x834e('0x32')](_0x3d149d,_0x390119,!![]);}catch(_0x278db3){return BPromise['reject'](_0x278db3);}return _0x3d149d[_0x834e('0x33')]();};}function saveUpdates(_0x5cad11,_0x2c75c2){return function(_0x3787b0){if(_0x3787b0){return _0x3787b0[_0x834e('0x34')](_0x5cad11)[_0x834e('0x1e')](function(_0x444366){return _0x444366;});}return null;};}function removeEntity(_0x4689c2,_0x4696a1){return function(_0x38cd29){if(_0x38cd29){return _0x38cd29[_0x834e('0x35')]()[_0x834e('0x1e')](function(){var _0x5bd232=_0x38cd29[_0x834e('0x36')]({'plain':!![]});var _0x2f408a=_0x834e('0x37');return db[_0x834e('0x38')]['destroy']({'where':{'type':_0x2f408a,'resourceId':_0x5bd232['id']}})[_0x834e('0x1e')](function(){return _0x38cd29;});})[_0x834e('0x1e')](function(){_0x4689c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59385a,_0x3e58fa){return function(_0x41bf4d){if(!_0x41bf4d){_0x59385a[_0x834e('0x28')](0x194);}return _0x41bf4d;};}function handleError(_0x34fefb,_0x339e28){_0x339e28=_0x339e28||0x1f4;return function(_0x1b76dd){logger['error'](_0x1b76dd[_0x834e('0x39')]);if(_0x1b76dd['name']){delete _0x1b76dd[_0x834e('0x3a')];}_0x34fefb[_0x834e('0x29')](_0x339e28)['send'](_0x1b76dd);};}exports[_0x834e('0x3b')]=function(_0x2f56c7,_0x491c28){var _0x481f70={},_0x388711={},_0xd0d43a={'count':0x0,'rows':[]};var _0x2e9383=_[_0x834e('0x3c')](db[_0x834e('0x3d')]['rawAttributes'],function(_0x1c5ed6){return{'name':_0x1c5ed6['fieldName'],'type':_0x1c5ed6['type'][_0x834e('0x3e')]};});_0x388711['model']=_[_0x834e('0x3c')](_0x2e9383,_0x834e('0x3a'));_0x388711[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x2f56c7[_0x834e('0x3f')]);_0x388711['filters']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],_0x388711[_0x834e('0x3f')]);_0x481f70['attributes']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],qs['fields'](_0x2f56c7[_0x834e('0x3f')]['fields']));_0x481f70[_0x834e('0x43')]=_0x481f70[_0x834e('0x43')]['length']?_0x481f70['attributes']:_0x388711[_0x834e('0x42')];if(!_0x2f56c7[_0x834e('0x3f')][_0x834e('0x44')](_0x834e('0x45'))){_0x481f70[_0x834e('0x2d')]=qs[_0x834e('0x2d')](_0x2f56c7[_0x834e('0x3f')]['limit']);_0x481f70[_0x834e('0x2b')]=qs['offset'](_0x2f56c7[_0x834e('0x3f')]['offset']);}_0x481f70[_0x834e('0x46')]=qs['sort'](_0x2f56c7[_0x834e('0x3f')][_0x834e('0x47')]);_0x481f70['where']=qs[_0x834e('0x48')](_[_0x834e('0x49')](_0x2f56c7[_0x834e('0x3f')],_0x388711[_0x834e('0x48')]),_0x2e9383);if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]){_0x481f70[_0x834e('0x4b')]=_[_0x834e('0x4c')](_0x481f70[_0x834e('0x4b')],{'$or':_[_0x834e('0x3c')](_0x2e9383,function(_0x5f3943){if(_0x5f3943[_0x834e('0x4d')]!==_0x834e('0x4e')){var _0x47a8a9={};_0x47a8a9[_0x5f3943[_0x834e('0x3a')]]={'$like':'%'+_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]+'%'};return _0x47a8a9;}})});}_0x481f70=_[_0x834e('0x4c')]({},_0x481f70,_0x2f56c7[_0x834e('0x4f')]);var _0x4264b8={'where':_0x481f70['where']};return db['Trunk'][_0x834e('0x2e')](_0x4264b8)[_0x834e('0x1e')](function(_0x30568e){_0xd0d43a[_0x834e('0x2e')]=_0x30568e;if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x50')]){_0x481f70[_0x834e('0x51')]=[{'all':!![]}];}return db[_0x834e('0x3d')][_0x834e('0x52')](_0x481f70);})[_0x834e('0x1e')](function(_0xf02f0d){_0xd0d43a[_0x834e('0x53')]=_0xf02f0d;return _0xd0d43a;})[_0x834e('0x1e')](respondWithFilteredResult(_0x491c28,_0x481f70))[_0x834e('0x54')](handleError(_0x491c28,null));};exports[_0x834e('0x55')]=function(_0x1a3855,_0x3df078){var _0x32b8f7={'raw':![],'where':{'id':_0x1a3855[_0x834e('0x56')]['id']}},_0x420841={};_0x420841['model']=_[_0x834e('0x40')](db[_0x834e('0x3d')]['rawAttributes']);_0x420841[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x1a3855['query']);_0x420841[_0x834e('0x48')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],_0x420841[_0x834e('0x3f')]);_0x32b8f7[_0x834e('0x43')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],qs['fields'](_0x1a3855[_0x834e('0x3f')][_0x834e('0x57')]));_0x32b8f7[_0x834e('0x43')]=_0x32b8f7[_0x834e('0x43')][_0x834e('0x58')]?_0x32b8f7[_0x834e('0x43')]:_0x420841[_0x834e('0x42')];if(_0x1a3855[_0x834e('0x3f')]['includeAll']){_0x32b8f7[_0x834e('0x51')]=[{'all':!![]}];}_0x32b8f7=_['merge']({},_0x32b8f7,_0x1a3855[_0x834e('0x4f')]);return db['Trunk'][_0x834e('0x59')](_0x32b8f7)['then'](handleEntityNotFound(_0x3df078,null))['then'](respondWithResult(_0x3df078,null))[_0x834e('0x54')](handleError(_0x3df078,null));};exports[_0x834e('0x5a')]=function(_0x5291ae,_0x5be43d){var _0x2c8155={'where':{'id':_0x5291ae[_0x834e('0x56')]['id']}},_0x2452b4={};_0x2452b4[_0x834e('0x42')]=_[_0x834e('0x40')](db[_0x834e('0x3d')][_0x834e('0x5b')]);_0x2c8155[_0x834e('0x43')]=_['intersection'](_0x2452b4[_0x834e('0x42')],qs[_0x834e('0x57')](_0x5291ae['query'][_0x834e('0x57')]));_0x2c8155['attributes']=_0x2c8155[_0x834e('0x43')][_0x834e('0x58')]?_0x2c8155['attributes']:_0x2452b4[_0x834e('0x42')];if(_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]){_0x2c8155[_0x834e('0x51')]=[{'all':!![]}];}_0x2c8155=_['merge']({},_0x2c8155,_0x5291ae[_0x834e('0x4f')]);return db[_0x834e('0x3d')][_0x834e('0x59')](_0x2c8155)['then'](handleEntityNotFound(_0x5be43d,null))[_0x834e('0x1e')](function(_0x1fcae9){if(_0x1fcae9){var _0x3a7683=_0x1fcae9[_0x834e('0x36')]({'plain':!![]});_0x3a7683=qs[_0x834e('0x5c')](_0x3a7683,['id',_0x834e('0x5d'),_0x834e('0x5e')]);_0x5291ae[_0x834e('0x5f')]=_[_0x834e('0x5c')](_0x5291ae[_0x834e('0x5f')],['id',_0x834e('0x5d'),_0x834e('0x5e')]);return db[_0x834e('0x3d')][_0x834e('0x60')](_[_0x834e('0x4c')](_0x3a7683,_0x5291ae[_0x834e('0x5f')]),{'include':_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]?[{'all':!![]}]:undefined})[_0x834e('0x1e')](function(_0x3e3467){var _0xed4081=_0x5291ae[_0x834e('0x61')]['get']({'plain':!![]});if(!_0xed4081)throw new Error(_0x834e('0x62'));if(_0xed4081[_0x834e('0x63')]===_0x834e('0x61')){var _0x36cc14=_0x3e3467['get']({'plain':!![]});var _0x30faa8='Trunks';return db['UserProfileSection'][_0x834e('0x59')]({'where':{'name':_0x30faa8,'userProfileId':_0xed4081[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0xe79465){if(_0xe79465&&_0xe79465[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x36cc14[_0x834e('0x3a')],'resourceId':_0x36cc14['id'],'type':_0xe79465['name'],'sectionId':_0xe79465['id']},{})[_0x834e('0x1e')](function(){return _0x3e3467;});}else{return _0x3e3467;}})['catch'](function(_0x17e223){logger[_0x834e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17e223);throw _0x17e223;});}return _0x3e3467;});}})['then'](respondWithResult(_0x5be43d,0xc9))[_0x834e('0x54')](handleError(_0x5be43d,null));};exports[_0x834e('0x60')]=function(_0x363cc2,_0x2cca07,_0x2c41bd){var _0x5a4854;return db[_0x834e('0x3d')][_0x834e('0x60')](_0x363cc2[_0x834e('0x5f')],{'raw':!![]})[_0x834e('0x1e')](function(_0x3181af){_0x5a4854=_0x3181af;return db[_0x834e('0x3d')][_0x834e('0x52')]({'raw':!![]});})[_0x834e('0x1e')](function(_0x376f72){var _0x324f67=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x51cfab=fs[_0x834e('0x6a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x332d8f=ejs['render'](_0x324f67,{'trunks':_0x376f72||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x332d8f);if(_0x5a4854['registry']){var _0x353246=ejs[_0x834e('0x6d')](_0x51cfab,{'trunks':_0x376f72||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x353246);}})[_0x834e('0x1e')](function(){return respondWithRpcPromise(_0x834e('0x6e'),_0x834e('0x60'),{'module':_0x834e('0x6f')});})[_0x834e('0x1e')](function(){var _0x493239=_0x363cc2[_0x834e('0x61')]['get']({'plain':!![]});if(!_0x493239)throw new Error(_0x834e('0x62'));if(_0x493239[_0x834e('0x63')]===_0x834e('0x61')){var _0x5afb41=_0x5a4854[_0x834e('0x36')]({'plain':!![]});return db[_0x834e('0x70')]['find']({'where':{'name':_0x834e('0x37'),'userProfileId':_0x493239[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0x50d0a3){if(_0x50d0a3&&_0x50d0a3[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x5afb41[_0x834e('0x3a')],'resourceId':_0x5afb41['id'],'type':_0x50d0a3[_0x834e('0x3a')],'sectionId':_0x50d0a3['id']},{})[_0x834e('0x1e')](function(){return _0x5a4854;});}else{return _0x5a4854;}})[_0x834e('0x54')](function(_0x23b5d9){logger[_0x834e('0x24')](_0x834e('0x71'),_0x23b5d9);throw _0x23b5d9;});}return _0x5a4854;})['then'](respondWithResult(_0x2cca07,0xc9))['catch'](handleError(_0x2cca07,null));};exports['update']=function(_0x36ede9,_0x1135a5,_0x313c03){var _0x37fa2c;return db[_0x834e('0x3d')]['find']({'where':{'id':_0x36ede9['params']['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x1135a5,null))[_0x834e('0x1e')](saveUpdates(_0x36ede9[_0x834e('0x5f')],null))[_0x834e('0x1e')](function(_0x40a705){if(_0x40a705){_0x37fa2c=_0x40a705;return db['Trunk'][_0x834e('0x52')]({'raw':!![]});}})[_0x834e('0x1e')](function(_0x113714){if(_0x113714){var _0x4e1735=fs[_0x834e('0x6a')](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x585d02=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x509427=ejs[_0x834e('0x6d')](_0x4e1735,{'trunks':_0x113714||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x509427);var _0x53012d=ejs[_0x834e('0x6d')](_0x585d02,{'trunks':_0x113714||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x53012d);return respondWithRpcPromise('Reload',_0x834e('0x34'),{'module':_0x834e('0x6f')});}return null;})[_0x834e('0x1e')](function(_0x1d76c6){if(_0x1d76c6){return _0x37fa2c;}})[_0x834e('0x1e')](respondWithResult(_0x1135a5,null))[_0x834e('0x54')](handleError(_0x1135a5,null));};exports[_0x834e('0x35')]=function(_0x179892,_0x17e61a,_0x53f6e3){var _0x2f775a;return db['Trunk'][_0x834e('0x59')]({'where':{'id':_0x179892[_0x834e('0x56')]['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x17e61a,null))[_0x834e('0x1e')](removeEntity(_0x17e61a,null))[_0x834e('0x1e')](function(){return db[_0x834e('0x3d')]['findAll']({'raw':!![]});})['then'](function(_0xeb096d){var _0x2a854a=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0xc75f5e=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5ede29=ejs[_0x834e('0x6d')](_0x2a854a,{'trunks':_0xeb096d});var _0x1f3e26=ejs['render'](_0xc75f5e,{'trunks':_0xeb096d});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x5ede29);fs['writeFileSync'](_0x834e('0x72'),_0x1f3e26);return respondWithRpcPromise('Reload','destroy',{'module':_0x834e('0x6f')});})[_0x834e('0x54')](handleError(_0x17e61a,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index bb4294c..12aaefc 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 _0x3784=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash'];(function(_0x29763f,_0x399bb7){var _0x437d68=function(_0x1d263f){while(--_0x1d263f){_0x29763f['push'](_0x29763f['shift']());}};_0x437d68(++_0x399bb7);}(_0x3784,0x143));var _0x4378=function(_0x302d1f,_0x76c9cd){_0x302d1f=_0x302d1f-0x0;var _0x2b2bd0=_0x3784[_0x302d1f];return _0x2b2bd0;};'use strict';var _=require(_0x4378('0x0'));var util=require('util');var logger=require(_0x4378('0x1'))('api');var moment=require(_0x4378('0x2'));var BPromise=require(_0x4378('0x3'));var rp=require(_0x4378('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4378('0x5'));var config=require(_0x4378('0x6'));var attributes=require(_0x4378('0x7'));module[_0x4378('0x8')]=function(_0x517d93,_0x6d3c0e){return _0x517d93[_0x4378('0x9')](_0x4378('0xa'),attributes,{'tableName':_0x4378('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b77=['path','rimraf','../../config/environment','./trunk.attributes','define','Trunk','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2d455d,_0x53a743){var _0x320269=function(_0x2c7bbe){while(--_0x2c7bbe){_0x2d455d['push'](_0x2d455d['shift']());}};_0x320269(++_0x53a743);}(_0x4b77,0x1aa));var _0x74b7=function(_0x393dde,_0xae15c3){_0x393dde=_0x393dde-0x0;var _0x3053e8=_0x4b77[_0x393dde];return _0x3053e8;};'use strict';var _=require(_0x74b7('0x0'));var util=require(_0x74b7('0x1'));var logger=require(_0x74b7('0x2'))(_0x74b7('0x3'));var moment=require(_0x74b7('0x4'));var BPromise=require('bluebird');var rp=require(_0x74b7('0x5'));var fs=require('fs');var path=require(_0x74b7('0x6'));var rimraf=require(_0x74b7('0x7'));var config=require(_0x74b7('0x8'));var attributes=require(_0x74b7('0x9'));module['exports']=function(_0x5c4384,_0xa536e1){return _0x5c4384[_0x74b7('0xa')](_0x74b7('0xb'),attributes,{'tableName':'tools_trunks','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 59723be..b3fcd7b 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 _0xc57b=['attributes','limit','map','include','model','info','ShowTrunk','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrunk','Trunk','options','raw'];(function(_0x5d3dd7,_0x2c7b29){var _0x5a9569=function(_0x4d2fed){while(--_0x4d2fed){_0x5d3dd7['push'](_0x5d3dd7['shift']());}};_0x5a9569(++_0x2c7b29);}(_0xc57b,0x90));var _0xbc57=function(_0x2a3888,_0x493ebd){_0x2a3888=_0x2a3888-0x0;var _0xe844f4=_0xc57b[_0x2a3888];return _0xe844f4;};'use strict';var _=require('lodash');var util=require(_0xbc57('0x0'));var moment=require(_0xbc57('0x1'));var BPromise=require(_0xbc57('0x2'));var rs=require(_0xbc57('0x3'));var fs=require('fs');var Redis=require(_0xbc57('0x4'));var db=require(_0xbc57('0x5'))['db'];var utils=require(_0xbc57('0x6'));var logger=require(_0xbc57('0x7'))(_0xbc57('0x8'));var config=require(_0xbc57('0x9'));var jayson=require(_0xbc57('0xa'));var client=jayson[_0xbc57('0xb')][_0xbc57('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e38e0,_0x5420f3,_0x29a563){return new BPromise(function(_0x193991,_0xfeb949){return client['request'](_0x2e38e0,_0x29a563)[_0xbc57('0xd')](function(_0x1a895c){logger['info'](_0xbc57('0xe'),_0x5420f3,_0xbc57('0xf'));logger[_0xbc57('0x10')](_0xbc57('0x11'),_0x5420f3,'request\x20sent',JSON[_0xbc57('0x12')](_0x1a895c));if(_0x1a895c[_0xbc57('0x13')]){if(_0x1a895c[_0xbc57('0x13')]['code']===0x1f4){logger[_0xbc57('0x13')](_0xbc57('0xe'),_0x5420f3,_0x1a895c[_0xbc57('0x13')]['message']);return _0xfeb949(_0x1a895c[_0xbc57('0x13')][_0xbc57('0x14')]);}logger['error'](_0xbc57('0xe'),_0x5420f3,_0x1a895c[_0xbc57('0x13')][_0xbc57('0x14')]);return _0x193991(_0x1a895c[_0xbc57('0x13')]['message']);}else{logger['info'](_0xbc57('0xe'),_0x5420f3,_0xbc57('0xf'));_0x193991(_0x1a895c['result'][_0xbc57('0x14')]);}})[_0xbc57('0x15')](function(_0x356e14){logger[_0xbc57('0x13')](_0xbc57('0xe'),_0x5420f3,_0x356e14);_0xfeb949(_0x356e14);});});}exports[_0xbc57('0x16')]=function(_0x32c072){var _0x2235ef=this;return new Promise(function(_0x30d850,_0x35e3ad){return db[_0xbc57('0x17')]['findAll']({'raw':_0x32c072['options']?_0x32c072[_0xbc57('0x18')][_0xbc57('0x19')]===undefined?!![]:![]:!![],'where':_0x32c072['options']?_0x32c072['options']['where']||null:null,'attributes':_0x32c072['options']?_0x32c072[_0xbc57('0x18')][_0xbc57('0x1a')]||null:null,'limit':_0x32c072[_0xbc57('0x18')]?_0x32c072[_0xbc57('0x18')][_0xbc57('0x1b')]||null:null,'include':_0x32c072[_0xbc57('0x18')]?_0x32c072[_0xbc57('0x18')]['include']?_[_0xbc57('0x1c')](_0x32c072[_0xbc57('0x18')][_0xbc57('0x1d')],function(_0x3303ee){return{'model':db[_0x3303ee[_0xbc57('0x1e')]],'as':_0x3303ee['as'],'attributes':_0x3303ee[_0xbc57('0x1a')],'include':_0x3303ee[_0xbc57('0x1d')]?_['map'](_0x3303ee['include'],function(_0x22a70e){return{'model':db[_0x22a70e[_0xbc57('0x1e')]],'as':_0x22a70e['as'],'attributes':_0x22a70e[_0xbc57('0x1a')],'include':_0x22a70e[_0xbc57('0x1d')]?_[_0xbc57('0x1c')](_0x22a70e[_0xbc57('0x1d')],function(_0x2cce09){return{'model':db[_0x2cce09[_0xbc57('0x1e')]],'as':_0x2cce09['as'],'attributes':_0x2cce09[_0xbc57('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbc57('0xd')](function(_0x449c3f){logger[_0xbc57('0x1f')](_0xbc57('0x16'),_0x32c072);logger[_0xbc57('0x10')](_0xbc57('0x16'),_0x32c072,JSON['stringify'](_0x449c3f));_0x30d850(_0x449c3f);})[_0xbc57('0x15')](function(_0xf205e5){logger[_0xbc57('0x13')](_0xbc57('0x16'),_0xf205e5[_0xbc57('0x14')],_0x32c072);_0x35e3ad(_0x2235ef[_0xbc57('0x13')](0x1f4,_0xf205e5['message']));});});};exports[_0xbc57('0x20')]=function(_0x16353d){var _0x3e4b72=this;return new Promise(function(_0x8f92e2,_0x57b5de){return db[_0xbc57('0x17')]['find']({'raw':_0x16353d[_0xbc57('0x18')]?_0x16353d[_0xbc57('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x16353d[_0xbc57('0x18')]?_0x16353d[_0xbc57('0x18')][_0xbc57('0x21')]||null:null,'attributes':_0x16353d[_0xbc57('0x18')]?_0x16353d[_0xbc57('0x18')]['attributes']||null:null,'include':_0x16353d[_0xbc57('0x18')]?_0x16353d[_0xbc57('0x18')]['include']?_[_0xbc57('0x1c')](_0x16353d[_0xbc57('0x18')][_0xbc57('0x1d')],function(_0x2604cc){return{'model':db[_0x2604cc[_0xbc57('0x1e')]],'as':_0x2604cc['as'],'attributes':_0x2604cc[_0xbc57('0x1a')],'include':_0x2604cc['include']?_[_0xbc57('0x1c')](_0x2604cc['include'],function(_0xefef0){return{'model':db[_0xefef0[_0xbc57('0x1e')]],'as':_0xefef0['as'],'attributes':_0xefef0[_0xbc57('0x1a')],'include':_0xefef0[_0xbc57('0x1d')]?_[_0xbc57('0x1c')](_0xefef0[_0xbc57('0x1d')],function(_0x12307a){return{'model':db[_0x12307a[_0xbc57('0x1e')]],'as':_0x12307a['as'],'attributes':_0x12307a[_0xbc57('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbc57('0xd')](function(_0x39384b){logger[_0xbc57('0x1f')](_0xbc57('0x20'),_0x16353d);logger['debug']('ShowTrunk',_0x16353d,JSON['stringify'](_0x39384b));_0x8f92e2(_0x39384b);})[_0xbc57('0x15')](function(_0x898ea){logger[_0xbc57('0x13')](_0xbc57('0x20'),_0x898ea[_0xbc57('0x14')],_0x16353d);_0x57b5de(_0x3e4b72['error'](0x1f4,_0x898ea['message']));});});}; \ No newline at end of file +var _0x0ea9=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','options','raw','where','attributes','limit','include','map','model','ShowTrunk','find','debug','util','bluebird','ioredis','../../mysqldb'];(function(_0x1809c5,_0x46cabc){var _0x5254a4=function(_0xd1d319){while(--_0xd1d319){_0x1809c5['push'](_0x1809c5['shift']());}};_0x5254a4(++_0x46cabc);}(_0x0ea9,0x188));var _0x90ea=function(_0x1a49c9,_0x8a0be0){_0x1a49c9=_0x1a49c9-0x0;var _0x195866=_0x0ea9[_0x1a49c9];return _0x195866;};'use strict';var _=require('lodash');var util=require(_0x90ea('0x0'));var moment=require('moment');var BPromise=require(_0x90ea('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x90ea('0x2'));var db=require(_0x90ea('0x3'))['db'];var utils=require(_0x90ea('0x4'));var logger=require(_0x90ea('0x5'))('rpc');var config=require(_0x90ea('0x6'));var jayson=require(_0x90ea('0x7'));var client=jayson[_0x90ea('0x8')][_0x90ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41f1fb,_0xc82080,_0x16c03a){return new BPromise(function(_0x3fcaba,_0x33fef2){return client['request'](_0x41f1fb,_0x16c03a)[_0x90ea('0xa')](function(_0x466b43){logger[_0x90ea('0xb')]('Trunk,\x20%s,\x20%s',_0xc82080,_0x90ea('0xc'));logger['debug'](_0x90ea('0xd'),_0xc82080,_0x90ea('0xc'),JSON[_0x90ea('0xe')](_0x466b43));if(_0x466b43[_0x90ea('0xf')]){if(_0x466b43['error']['code']===0x1f4){logger[_0x90ea('0xf')](_0x90ea('0x10'),_0xc82080,_0x466b43[_0x90ea('0xf')][_0x90ea('0x11')]);return _0x33fef2(_0x466b43[_0x90ea('0xf')][_0x90ea('0x11')]);}logger['error'](_0x90ea('0x10'),_0xc82080,_0x466b43[_0x90ea('0xf')]['message']);return _0x3fcaba(_0x466b43['error'][_0x90ea('0x11')]);}else{logger[_0x90ea('0xb')]('Trunk,\x20%s,\x20%s',_0xc82080,_0x90ea('0xc'));_0x3fcaba(_0x466b43[_0x90ea('0x12')][_0x90ea('0x11')]);}})[_0x90ea('0x13')](function(_0x5c17d0){logger[_0x90ea('0xf')](_0x90ea('0x10'),_0xc82080,_0x5c17d0);_0x33fef2(_0x5c17d0);});});}exports[_0x90ea('0x14')]=function(_0x55a850){var _0x425335=this;return new Promise(function(_0x1223a8,_0x3f4b49){return db[_0x90ea('0x15')]['findAll']({'raw':_0x55a850[_0x90ea('0x16')]?_0x55a850['options'][_0x90ea('0x17')]===undefined?!![]:![]:!![],'where':_0x55a850[_0x90ea('0x16')]?_0x55a850[_0x90ea('0x16')][_0x90ea('0x18')]||null:null,'attributes':_0x55a850[_0x90ea('0x16')]?_0x55a850[_0x90ea('0x16')][_0x90ea('0x19')]||null:null,'limit':_0x55a850[_0x90ea('0x16')]?_0x55a850[_0x90ea('0x16')][_0x90ea('0x1a')]||null:null,'include':_0x55a850[_0x90ea('0x16')]?_0x55a850[_0x90ea('0x16')][_0x90ea('0x1b')]?_[_0x90ea('0x1c')](_0x55a850[_0x90ea('0x16')][_0x90ea('0x1b')],function(_0x17d494){return{'model':db[_0x17d494['model']],'as':_0x17d494['as'],'attributes':_0x17d494['attributes'],'include':_0x17d494['include']?_[_0x90ea('0x1c')](_0x17d494[_0x90ea('0x1b')],function(_0x1b498d){return{'model':db[_0x1b498d[_0x90ea('0x1d')]],'as':_0x1b498d['as'],'attributes':_0x1b498d[_0x90ea('0x19')],'include':_0x1b498d[_0x90ea('0x1b')]?_['map'](_0x1b498d[_0x90ea('0x1b')],function(_0x541bf0){return{'model':db[_0x541bf0[_0x90ea('0x1d')]],'as':_0x541bf0['as'],'attributes':_0x541bf0[_0x90ea('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b098b){logger[_0x90ea('0xb')](_0x90ea('0x14'),_0x55a850);logger['debug']('GetTrunk',_0x55a850,JSON[_0x90ea('0xe')](_0x1b098b));_0x1223a8(_0x1b098b);})[_0x90ea('0x13')](function(_0x274473){logger[_0x90ea('0xf')](_0x90ea('0x14'),_0x274473[_0x90ea('0x11')],_0x55a850);_0x3f4b49(_0x425335['error'](0x1f4,_0x274473[_0x90ea('0x11')]));});});};exports[_0x90ea('0x1e')]=function(_0x5e8821){var _0x4637f7=this;return new Promise(function(_0x1c90a9,_0x41d887){return db[_0x90ea('0x15')][_0x90ea('0x1f')]({'raw':_0x5e8821[_0x90ea('0x16')]?_0x5e8821[_0x90ea('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5e8821[_0x90ea('0x16')]?_0x5e8821[_0x90ea('0x16')]['where']||null:null,'attributes':_0x5e8821[_0x90ea('0x16')]?_0x5e8821[_0x90ea('0x16')][_0x90ea('0x19')]||null:null,'include':_0x5e8821[_0x90ea('0x16')]?_0x5e8821[_0x90ea('0x16')][_0x90ea('0x1b')]?_['map'](_0x5e8821['options'][_0x90ea('0x1b')],function(_0x361fc8){return{'model':db[_0x361fc8[_0x90ea('0x1d')]],'as':_0x361fc8['as'],'attributes':_0x361fc8['attributes'],'include':_0x361fc8[_0x90ea('0x1b')]?_['map'](_0x361fc8[_0x90ea('0x1b')],function(_0x87bc05){return{'model':db[_0x87bc05[_0x90ea('0x1d')]],'as':_0x87bc05['as'],'attributes':_0x87bc05['attributes'],'include':_0x87bc05[_0x90ea('0x1b')]?_[_0x90ea('0x1c')](_0x87bc05[_0x90ea('0x1b')],function(_0xa96ad8){return{'model':db[_0xa96ad8['model']],'as':_0xa96ad8['as'],'attributes':_0xa96ad8[_0x90ea('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22d4b2){logger[_0x90ea('0xb')](_0x90ea('0x1e'),_0x5e8821);logger[_0x90ea('0x20')]('ShowTrunk',_0x5e8821,JSON[_0x90ea('0xe')](_0x22d4b2));_0x1c90a9(_0x22d4b2);})[_0x90ea('0x13')](function(_0x125be7){logger[_0x90ea('0xf')](_0x90ea('0x1e'),_0x125be7['message'],_0x5e8821);_0x41d887(_0x4637f7[_0x90ea('0xf')](0x1f4,_0x125be7[_0x90ea('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 56b7653..b2a2317 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 _0x0fb1=['isAuthenticated','update','Router','../../components/auth/service','./user-setting.controller','/:id'];(function(_0x443ff8,_0x694c16){var _0x2eef4f=function(_0x39cc2b){while(--_0x39cc2b){_0x443ff8['push'](_0x443ff8['shift']());}};_0x2eef4f(++_0x694c16);}(_0x0fb1,0x1c4));var _0x10fb=function(_0x1f2755,_0x5ef3f4){_0x1f2755=_0x1f2755-0x0;var _0x285d4f=_0x0fb1[_0x1f2755];return _0x285d4f;};'use strict';var express=require('express');var router=express[_0x10fb('0x0')]();var auth=require(_0x10fb('0x1'));var controller=require(_0x10fb('0x2'));router['put'](_0x10fb('0x3'),auth[_0x10fb('0x4')](),controller[_0x10fb('0x5')]);module['exports']=router; \ No newline at end of file +var _0x6254=['/:id','isAuthenticated','update','exports','express','../../components/auth/service','./user-setting.controller'];(function(_0x427bcd,_0x55e2a9){var _0x1fcd0d=function(_0x2a85c4){while(--_0x2a85c4){_0x427bcd['push'](_0x427bcd['shift']());}};_0x1fcd0d(++_0x55e2a9);}(_0x6254,0x7b));var _0x4625=function(_0x18b191,_0x4e0684){_0x18b191=_0x18b191-0x0;var _0x43e146=_0x6254[_0x18b191];return _0x43e146;};'use strict';var express=require(_0x4625('0x0'));var router=express['Router']();var auth=require(_0x4625('0x1'));var controller=require(_0x4625('0x2'));router['put'](_0x4625('0x3'),auth[_0x4625('0x4')](),controller[_0x4625('0x5')]);module[_0x4625('0x6')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 45106ba..611183a 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 _0xdfdf=['info','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','error','warning'];(function(_0x25315b,_0x3ce640){var _0x2fab0d=function(_0xb11384){while(--_0xb11384){_0x25315b['push'](_0x25315b['shift']());}};_0x2fab0d(++_0x3ce640);}(_0xdfdf,0x6b));var _0xfdfd=function(_0x23494b,_0x52ff58){_0x23494b=_0x23494b-0x0;var _0x25f449=_0xdfdf[_0x23494b];return _0x25f449;};'use strict';var Sequelize=require(_0xfdfd('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xfdfd('0x1'),_0xfdfd('0x2'),_0xfdfd('0x3'),'debug'];module[_0xfdfd('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xfdfd('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xfdfd('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xfdfd('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xfdfd('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xfdfd('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xfdfd('0x9')],'unique':_0xfdfd('0xa')}}; \ No newline at end of file +var _0x10af=['info','debug','exports','ENUM','BOOLEAN','TEXT','INTEGER','sequelize','error','warning'];(function(_0x1cd4e7,_0x5f17dd){var _0x5243eb=function(_0x827ee4){while(--_0x827ee4){_0x1cd4e7['push'](_0x1cd4e7['shift']());}};_0x5243eb(++_0x5f17dd);}(_0x10af,0x101));var _0xf10a=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x10af[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0xf10a('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xf10a('0x1'),_0xf10a('0x2'),_0xf10a('0x3'),_0xf10a('0x4')];module[_0xf10a('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0xf10a('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xf10a('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xf10a('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xf10a('0x8')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xf10a('0x9')],'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 76c0a73..42d424e 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 _0x0d4e=['name','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','defaults','localhost','status','json','update','then','sendStatus','error','stack'];(function(_0x51f562,_0x23ac69){var _0x367826=function(_0x15dea1){while(--_0x15dea1){_0x51f562['push'](_0x51f562['shift']());}};_0x367826(++_0x23ac69);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x0d4e[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xe0d4('0x0'));var Redis=require(_0xe0d4('0x1'));var logger=require(_0xe0d4('0x2'))(_0xe0d4('0x3'));var config=require(_0xe0d4('0x4'));var db=require(_0xe0d4('0x5'))['db'];var socket=require(_0xe0d4('0x6'))(new Redis(config[_0xe0d4('0x7')]));require(_0xe0d4('0x8'))['register'](socket);config[_0xe0d4('0x7')]=_[_0xe0d4('0x9')](config[_0xe0d4('0x7')],{'host':_0xe0d4('0xa'),'port':0x18eb});function respondWithResult(_0x54a11f,_0x4a2a87){_0x4a2a87=_0x4a2a87||0xc8;return function(_0x312e09){if(_0x312e09){return _0x54a11f[_0xe0d4('0xb')](_0x4a2a87)[_0xe0d4('0xc')](_0x312e09);}};}function saveUpdates(_0x439f1a){return function(_0x3b44fa){if(_0x3b44fa){return _0x3b44fa[_0xe0d4('0xd')](_0x439f1a)[_0xe0d4('0xe')](function(_0xb36d72){return _0xb36d72;});}return null;};}function handleEntityNotFound(_0x1dd35d){return function(_0x215d49){if(!_0x215d49){_0x1dd35d[_0xe0d4('0xf')](0x194);}return _0x215d49;};}function handleError(_0x418ef9,_0x814ec0){_0x814ec0=_0x814ec0||0x1f4;return function(_0x5a26cc){logger[_0xe0d4('0x10')](_0x5a26cc[_0xe0d4('0x11')]);if(_0x5a26cc[_0xe0d4('0x12')]){delete _0x5a26cc[_0xe0d4('0x12')];}_0x418ef9[_0xe0d4('0xb')](_0x814ec0)[_0xe0d4('0x13')](_0x5a26cc);};}exports[_0xe0d4('0xd')]=function(_0x40e917,_0x44777f){if(_0x40e917[_0xe0d4('0x14')][_0xe0d4('0x15')]!==_0xe0d4('0x16'))throw new Error(_0xe0d4('0x17'));if(isNaN(Number(_0x40e917[_0xe0d4('0x18')]['id'])))throw new Error(_0xe0d4('0x19'));return db['UserSetting'][_0xe0d4('0x1a')]({'where':{'id':_0x40e917[_0xe0d4('0x18')]['id']}})[_0xe0d4('0xe')](handleEntityNotFound(_0x44777f,null))['then'](saveUpdates(_0x40e917['body'],null))[_0xe0d4('0xe')](respondWithResult(_0x44777f,null))[_0xe0d4('0x1b')](handleError(_0x44777f,null));}; \ No newline at end of file +var _0x2e35=['body','catch','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','register','defaults','then','stack','name','status','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find'];(function(_0x57b248,_0x2d5053){var _0x3a55f5=function(_0x145403){while(--_0x145403){_0x57b248['push'](_0x57b248['shift']());}};_0x3a55f5(++_0x2d5053);}(_0x2e35,0x1d0));var _0x52e3=function(_0x2064f7,_0x99428){_0x2064f7=_0x2064f7-0x0;var _0xc45ab2=_0x2e35[_0x2064f7];return _0xc45ab2;};'use strict';var _=require(_0x52e3('0x0'));var Redis=require(_0x52e3('0x1'));var logger=require(_0x52e3('0x2'))('api');var config=require(_0x52e3('0x3'));var db=require(_0x52e3('0x4'))['db'];var socket=require(_0x52e3('0x5'))(new Redis(config[_0x52e3('0x6')]));require('./user-setting.socket')[_0x52e3('0x7')](socket);config[_0x52e3('0x6')]=_[_0x52e3('0x8')](config[_0x52e3('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x483b93,_0x507a6c){_0x507a6c=_0x507a6c||0xc8;return function(_0x21ae13){if(_0x21ae13){return _0x483b93['status'](_0x507a6c)['json'](_0x21ae13);}};}function saveUpdates(_0x1367de){return function(_0x2fcd20){if(_0x2fcd20){return _0x2fcd20['update'](_0x1367de)[_0x52e3('0x9')](function(_0x1153c4){return _0x1153c4;});}return null;};}function handleEntityNotFound(_0x542097){return function(_0x440fe5){if(!_0x440fe5){_0x542097['sendStatus'](0x194);}return _0x440fe5;};}function handleError(_0x343960,_0x10f70f){_0x10f70f=_0x10f70f||0x1f4;return function(_0x16492c){logger['error'](_0x16492c[_0x52e3('0xa')]);if(_0x16492c[_0x52e3('0xb')]){delete _0x16492c['name'];}_0x343960[_0x52e3('0xc')](_0x10f70f)['send'](_0x16492c);};}exports['update']=function(_0x58dcdd,_0x478ff9){if(_0x58dcdd['user'][_0x52e3('0xd')]!==_0x52e3('0xe'))throw new Error(_0x52e3('0xf'));if(isNaN(Number(_0x58dcdd[_0x52e3('0x10')]['id'])))throw new Error(_0x52e3('0x11'));return db[_0x52e3('0x12')][_0x52e3('0x13')]({'where':{'id':_0x58dcdd[_0x52e3('0x10')]['id']}})[_0x52e3('0x9')](handleEntityNotFound(_0x478ff9,null))[_0x52e3('0x9')](saveUpdates(_0x58dcdd[_0x52e3('0x14')],null))['then'](respondWithResult(_0x478ff9,null))[_0x52e3('0x15')](handleError(_0x478ff9,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 c6b5712..411f0ae 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 _0xe0d7=['update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x14499b,_0x262bfd){var _0x22ff69=function(_0x425ba3){while(--_0x425ba3){_0x14499b['push'](_0x14499b['shift']());}};_0x22ff69(++_0x262bfd);}(_0xe0d7,0x18e));var _0x7e0d=function(_0x49240d,_0x26d805){_0x49240d=_0x49240d-0x0;var _0xc70389=_0xe0d7[_0x49240d];return _0xc70389;};'use strict';var EventEmitter=require(_0x7e0d('0x0'));var UserSetting=require('../../mysqldb')['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x7e0d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7e0d('0x2'),'afterDestroy':_0x7e0d('0x3')};function emitEvent(_0x3a65d6){return function(_0x1cc529,_0x279a48,_0x5a1b5b){UserSettingEvents[_0x7e0d('0x4')](_0x3a65d6+':'+_0x1cc529['id'],_0x1cc529);UserSettingEvents['emit'](_0x3a65d6,_0x1cc529);_0x5a1b5b(null);};}for(var e in events){if(events[_0x7e0d('0x5')](e)){var event=events[e];UserSetting[_0x7e0d('0x6')](e,emitEvent(event));}}module[_0x7e0d('0x7')]=UserSettingEvents; \ No newline at end of file +var _0x8af2=['../../mysqldb','UserSetting','save','emit','hasOwnProperty','exports','events'];(function(_0x38af48,_0x400460){var _0x445384=function(_0x464435){while(--_0x464435){_0x38af48['push'](_0x38af48['shift']());}};_0x445384(++_0x400460);}(_0x8af2,0x1a3));var _0x28af=function(_0x50ec7f,_0x4b3c5d){_0x50ec7f=_0x50ec7f-0x0;var _0x2f16f6=_0x8af2[_0x50ec7f];return _0x2f16f6;};'use strict';var EventEmitter=require(_0x28af('0x0'));var UserSetting=require(_0x28af('0x1'))['db'][_0x28af('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x28af('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4e2c0a){return function(_0x487933,_0x1b5686,_0x242357){UserSettingEvents[_0x28af('0x4')](_0x4e2c0a+':'+_0x487933['id'],_0x487933);UserSettingEvents['emit'](_0x4e2c0a,_0x487933);_0x242357(null);};}for(var e in events){if(events[_0x28af('0x5')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x28af('0x6')]=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 8062bce..a2a5218 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 _0x803f=['./user-setting.attributes','define','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x4e4413,_0x1116a6){var _0x4c449a=function(_0x2ff65c){while(--_0x2ff65c){_0x4e4413['push'](_0x4e4413['shift']());}};_0x4c449a(++_0x1116a6);}(_0x803f,0x64));var _0xf803=function(_0x66fa37,_0x49ff63){_0x66fa37=_0x66fa37-0x0;var _0x1374a0=_0x803f[_0x66fa37];return _0x1374a0;};'use strict';var attributes=require(_0xf803('0x0'));module['exports']=function(_0x328b90){return _0x328b90[_0xf803('0x1')]('UserSetting',attributes,{'tableName':_0xf803('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43fb3b){if(!_0x43fb3b[_0xf803('0x3')])_0x43fb3b[_0xf803('0x4')]=null;else if(_0x43fb3b[_0xf803('0x4')]===null)_0x43fb3b['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x180f=['UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x17dbbf,_0x3084ea){var _0x440ceb=function(_0x498ca1){while(--_0x498ca1){_0x17dbbf['push'](_0x17dbbf['shift']());}};_0x440ceb(++_0x3084ea);}(_0x180f,0xf3));var _0xf180=function(_0x217ff6,_0x36f75d){_0x217ff6=_0x217ff6-0x0;var _0x417c93=_0x180f[_0x217ff6];return _0x417c93;};'use strict';var attributes=require(_0xf180('0x0'));module[_0xf180('0x1')]=function(_0x49bb6e){return _0x49bb6e[_0xf180('0x2')](_0xf180('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1bd2a7){if(!_0x1bd2a7[_0xf180('0x4')])_0x1bd2a7[_0xf180('0x5')]=null;else if(_0x1bd2a7[_0xf180('0x5')]===null)_0x1bd2a7[_0xf180('0x5')]=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 9d78279..427e203 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 _0xaa67=['UserId','register','length','user-setting:','./user-setting.events','save','remove','update','emit','user-setting:update:user-'];(function(_0x4f5e67,_0x163a00){var _0xa8e9dc=function(_0x3f69ae){while(--_0x3f69ae){_0x4f5e67['push'](_0x4f5e67['shift']());}};_0xa8e9dc(++_0x163a00);}(_0xaa67,0x162));var _0x7aa6=function(_0x42db6d,_0x5b60af){_0x42db6d=_0x42db6d-0x0;var _0x1afa2f=_0xaa67[_0x42db6d];return _0x1afa2f;};'use strict';var UserSettingEvents=require(_0x7aa6('0x0'));var events=[_0x7aa6('0x1'),_0x7aa6('0x2'),_0x7aa6('0x3')];function createListener(_0x2f6b0c,_0x2a9f64){return function(_0xc59ed5){_0x2a9f64[_0x7aa6('0x4')](_0x2f6b0c,_0xc59ed5);if(_0x2f6b0c==='user-setting:update'){_0x2a9f64[_0x7aa6('0x4')](_0x7aa6('0x5')+_0xc59ed5[_0x7aa6('0x6')],_0xc59ed5);}};}exports[_0x7aa6('0x7')]=function(_0x35c561){for(var _0x22d823=0x0,_0xc719d7=events[_0x7aa6('0x8')];_0x22d823<_0xc719d7;_0x22d823++){var _0x384062=events[_0x22d823];var _0x149b0d=createListener(_0x7aa6('0x9')+_0x384062,_0x35c561);UserSettingEvents['on'](_0x384062,_0x149b0d);}}; \ No newline at end of file +var _0xa33b=['user-setting:update','user-setting:update:user-','register','length','user-setting:','./user-setting.events','save','remove','update'];(function(_0x51b1a1,_0x5596d9){var _0x4220b4=function(_0x26ad99){while(--_0x26ad99){_0x51b1a1['push'](_0x51b1a1['shift']());}};_0x4220b4(++_0x5596d9);}(_0xa33b,0x83));var _0xba33=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa33b[_0x167cc1];return _0x10bc4b;};'use strict';var UserSettingEvents=require(_0xba33('0x0'));var events=[_0xba33('0x1'),_0xba33('0x2'),_0xba33('0x3')];function createListener(_0x27dc98,_0x347d90){return function(_0x2ef18f){_0x347d90['emit'](_0x27dc98,_0x2ef18f);if(_0x27dc98===_0xba33('0x4')){_0x347d90['emit'](_0xba33('0x5')+_0x2ef18f['UserId'],_0x2ef18f);}};}exports[_0xba33('0x6')]=function(_0x1667f8){for(var _0x46aac4=0x0,_0x795899=events[_0xba33('0x7')];_0x46aac4<_0x795899;_0x46aac4++){var _0x454d06=events[_0x46aac4];var _0x166a67=createListener(_0xba33('0x8')+_0x454d06,_0x1667f8);UserSettingEvents['on'](_0x454d06,_0x166a67);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 083b6d8..447bbfc 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 _0x3c54=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/presence','getPresence','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getTeams','/:id/lists','getLists','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','file','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','/:id/fax_accounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id','update','/:id/password','changePassword','delete','removeQueues','destroy','removeChatInteractions','removeMailInteractions','/:id/sms_interactions','removeWhatsappInteractions','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util'];(function(_0x49d0e3,_0x359aed){var _0x26d388=function(_0x6f5512){while(--_0x6f5512){_0x49d0e3['push'](_0x49d0e3['shift']());}};_0x26d388(++_0x359aed);}(_0x3c54,0x157));var _0x43c5=function(_0x2e0e1c,_0x4357c1){_0x2e0e1c=_0x2e0e1c-0x0;var _0x5c510b=_0x3c54[_0x2e0e1c];return _0x5c510b;};'use strict';var multer=require(_0x43c5('0x0'));var util=require(_0x43c5('0x1'));var path=require(_0x43c5('0x2'));var timeout=require(_0x43c5('0x3'));var express=require(_0x43c5('0x4'));var router=express[_0x43c5('0x5')]();var fs_extra=require(_0x43c5('0x6'));var auth=require(_0x43c5('0x7'));var interaction=require(_0x43c5('0x8'));var config=require(_0x43c5('0x9'));var controller=require('./user.controller');router['get']('/',auth[_0x43c5('0xa')](),controller[_0x43c5('0xb')]);router[_0x43c5('0xc')](_0x43c5('0xd'),auth[_0x43c5('0xa')](),controller[_0x43c5('0xe')]);router[_0x43c5('0xc')](_0x43c5('0xf'),auth['isAuthenticated'](),controller[_0x43c5('0x10')]);router[_0x43c5('0xc')](_0x43c5('0x11'),auth['isAuthenticated'](),controller[_0x43c5('0x12')]);router[_0x43c5('0xc')]('/:id',auth[_0x43c5('0xa')](),controller[_0x43c5('0x13')]);router[_0x43c5('0xc')](_0x43c5('0x14'),controller['getAvatar']);router['get'](_0x43c5('0x15'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x16')]);router['get'](_0x43c5('0x17'),auth['isAuthenticated'](),controller[_0x43c5('0x18')]);router[_0x43c5('0xc')](_0x43c5('0x19'),auth['isAuthenticated'](),controller['getQueues']);router[_0x43c5('0xc')](_0x43c5('0x1a'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x1b')]);router['get'](_0x43c5('0x1c'),auth['isAuthenticated'](),controller['getGroups']);router['get'](_0x43c5('0x1d'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x1e')]);router[_0x43c5('0xc')](_0x43c5('0x1f'),auth[_0x43c5('0xa')](),controller['getScreenRecordings']);router[_0x43c5('0xc')](_0x43c5('0x20'),auth['isAuthenticated'](),controller[_0x43c5('0x21')]);router['get']('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x43c5('0x22')]);router[_0x43c5('0xc')](_0x43c5('0x23'),auth[_0x43c5('0xa')](),controller['getMailInteractions']);router[_0x43c5('0xc')](_0x43c5('0x24'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x25')]);router[_0x43c5('0xc')](_0x43c5('0x26'),auth['isAuthenticated'](),controller[_0x43c5('0x27')]);router['get']('/:id/whatsapp/interactions',auth[_0x43c5('0xa')](),controller['getWhatsappInteractions']);router[_0x43c5('0xc')]('/:id/teams',auth[_0x43c5('0xa')](),controller[_0x43c5('0x28')]);router['get'](_0x43c5('0x29'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x2a')]);router[_0x43c5('0xc')]('/:id/agents',auth['isAuthenticated'](),controller['getAgents']);router['get'](_0x43c5('0x2b'),auth['isAuthenticated'](),controller[_0x43c5('0x2c')]);router[_0x43c5('0xc')]('/:id/fax_accounts',auth[_0x43c5('0xa')](),controller[_0x43c5('0x2d')]);router['get'](_0x43c5('0x2e'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0x43c5('0xc')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x43c5('0x2f')]);router['get']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x43c5('0x30')]);router[_0x43c5('0xc')](_0x43c5('0x31'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x32')]);router[_0x43c5('0xc')](_0x43c5('0x33'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x34')]);router[_0x43c5('0xc')](_0x43c5('0x35'),auth[_0x43c5('0xa')](),controller['getSquareProjects']);router[_0x43c5('0xc')](_0x43c5('0x36'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x37')]);router[_0x43c5('0xc')](_0x43c5('0x38'),auth['isAuthenticated'](),controller[_0x43c5('0x39')]);router[_0x43c5('0x3a')](_0x43c5('0x17'),auth['isAuthenticated'](),controller[_0x43c5('0x3b')]);router[_0x43c5('0x3a')]('/',auth[_0x43c5('0xa')](),controller['create']);router[_0x43c5('0x3a')](_0x43c5('0x3c'),auth['isAuthenticated'](),controller[_0x43c5('0x3d')]);router[_0x43c5('0x3a')]('/:id/queues',auth['isAuthenticated'](),controller[_0x43c5('0x3e')]);var upload=multer({'storage':multer[_0x43c5('0x3f')]({'destination':function(_0xc9117a,_0x405856,_0x359d3e){_0x359d3e(null,path[_0x43c5('0x40')](config[_0x43c5('0x41')],_0x43c5('0x42')));},'filename':function(_0x4db20d,_0x27514b,_0x1dbd09){_0x1dbd09(null,util[_0x43c5('0x43')](_0x43c5('0x44'),Date[_0x43c5('0x45')](),_0x27514b[_0x43c5('0x46')]));}})});router[_0x43c5('0x3a')](_0x43c5('0x14'),upload['single'](_0x43c5('0x47')),controller['addAvatar']);router['post'](_0x43c5('0x48'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x49')]);router[_0x43c5('0x3a')](_0x43c5('0x4a'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x4b')]);router[_0x43c5('0x3a')](_0x43c5('0x4c'),auth[_0x43c5('0xa')](),controller['pause']);router['post']('/:id/unpause',auth[_0x43c5('0xa')](),controller['unpause']);router[_0x43c5('0x3a')](_0x43c5('0x4d'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x4e')]);router[_0x43c5('0x3a')](_0x43c5('0x4f'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x50')]);router[_0x43c5('0x3a')](_0x43c5('0x51'),auth[_0x43c5('0xa')](),controller['addMailInteractions']);router[_0x43c5('0x3a')](_0x43c5('0x52'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x53')]);router[_0x43c5('0x3a')]('/:id/sms_interactions',auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0x43c5('0x3a')](_0x43c5('0x54'),auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router['post'](_0x43c5('0x55'),auth[_0x43c5('0xa')](),controller['addWhatsappInteractions']);router[_0x43c5('0x3a')](_0x43c5('0x56'),auth[_0x43c5('0xa')](),controller['addFaxAccounts']);router[_0x43c5('0x3a')](_0x43c5('0x2e'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x57')]);router[_0x43c5('0x3a')](_0x43c5('0x58'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x59')]);router['post']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x43c5('0x5a')]);router[_0x43c5('0x3a')](_0x43c5('0x31'),auth['isAuthenticated'](),controller[_0x43c5('0x5b')]);router[_0x43c5('0x3a')]('/:id/whatsapp_accounts',auth[_0x43c5('0xa')](),controller[_0x43c5('0x5c')]);router[_0x43c5('0x3a')]('/:id/square_projects',auth[_0x43c5('0xa')](),controller[_0x43c5('0x5d')]);router[_0x43c5('0x3a')](_0x43c5('0x38'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x5e')]);router[_0x43c5('0x5f')](_0x43c5('0x60'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x61')]);router[_0x43c5('0x5f')](_0x43c5('0x62'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x63')]);router[_0x43c5('0x64')](_0x43c5('0x19'),auth['isAuthenticated'](),controller[_0x43c5('0x65')]);router['delete']('/:id/teams',auth[_0x43c5('0xa')](),controller['removeTeams']);router[_0x43c5('0x64')](_0x43c5('0x60'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x66')]);router[_0x43c5('0x64')](_0x43c5('0x4f'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x67')]);router[_0x43c5('0x64')](_0x43c5('0x51'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x68')]);router[_0x43c5('0x64')](_0x43c5('0x52'),auth[_0x43c5('0xa')](),controller['removeFaxInteractions']);router[_0x43c5('0x64')](_0x43c5('0x69'),auth[_0x43c5('0xa')](),controller['removeSmsInteractions']);router[_0x43c5('0x64')](_0x43c5('0x54'),auth[_0x43c5('0xa')](),controller['removeOpenchannelInteractions']);router[_0x43c5('0x64')]('/:id/whatsapp_interactions',auth[_0x43c5('0xa')](),controller[_0x43c5('0x6a')]);router[_0x43c5('0x64')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['removeFaxAccounts']);router['delete'](_0x43c5('0x2e'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x43c5('0x64')](_0x43c5('0x58'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x6b')]);router[_0x43c5('0x64')](_0x43c5('0x6c'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x6d')]);router[_0x43c5('0x64')](_0x43c5('0x31'),auth[_0x43c5('0xa')](),controller[_0x43c5('0x6e')]);router['delete'](_0x43c5('0x33'),auth['isAuthenticated'](),controller[_0x43c5('0x6f')]);router[_0x43c5('0x64')]('/:id/square_projects',auth[_0x43c5('0xa')](),controller[_0x43c5('0x70')]);router[_0x43c5('0x64')](_0x43c5('0x38'),auth['isAuthenticated'](),controller[_0x43c5('0x71')]);module[_0x43c5('0x72')]=router; \ No newline at end of file +var _0x5091=['./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','/:id/contacts','addContacts','bulkCreate','diskStorage','root','format','%s-%s','now','originalname','single','file','/:id/login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','update','put','/:id/password','delete','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','/:id/fax_accounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','/:id/api_key','removeApiKey','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5091,0x152));var _0x1509=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5091[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x1509('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1509('0x1'));var express=require(_0x1509('0x2'));var router=express[_0x1509('0x3')]();var fs_extra=require(_0x1509('0x4'));var auth=require(_0x1509('0x5'));var interaction=require(_0x1509('0x6'));var config=require('../../config/environment');var controller=require(_0x1509('0x7'));router[_0x1509('0x8')]('/',auth[_0x1509('0x9')](),controller[_0x1509('0xa')]);router[_0x1509('0x8')](_0x1509('0xb'),auth['isAuthenticated'](),controller[_0x1509('0xc')]);router['get'](_0x1509('0xd'),auth[_0x1509('0x9')](),controller[_0x1509('0xe')]);router[_0x1509('0x8')](_0x1509('0xf'),auth[_0x1509('0x9')](),controller['getPresence']);router['get'](_0x1509('0x10'),auth['isAuthenticated'](),controller['show']);router[_0x1509('0x8')](_0x1509('0x11'),controller[_0x1509('0x12')]);router['get'](_0x1509('0x13'),auth['isAuthenticated'](),controller[_0x1509('0x14')]);router[_0x1509('0x8')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router['get'](_0x1509('0x15'),auth['isAuthenticated'](),controller['getQueues']);router[_0x1509('0x8')](_0x1509('0x16'),auth[_0x1509('0x9')](),controller[_0x1509('0x17')]);router[_0x1509('0x8')](_0x1509('0x18'),auth[_0x1509('0x9')](),controller[_0x1509('0x19')]);router[_0x1509('0x8')](_0x1509('0x1a'),auth['isAuthenticated'](),controller[_0x1509('0x1b')]);router[_0x1509('0x8')]('/:id/screen_recordings',auth[_0x1509('0x9')](),controller[_0x1509('0x1c')]);router[_0x1509('0x8')](_0x1509('0x1d'),auth[_0x1509('0x9')](),controller[_0x1509('0x1e')]);router['get'](_0x1509('0x1f'),auth[_0x1509('0x9')](),controller['getOpenchannelInteractions']);router[_0x1509('0x8')]('/:id/mail/interactions',auth[_0x1509('0x9')](),controller[_0x1509('0x20')]);router['get']('/:id/sms/interactions',auth[_0x1509('0x9')](),controller[_0x1509('0x21')]);router[_0x1509('0x8')](_0x1509('0x22'),auth[_0x1509('0x9')](),controller[_0x1509('0x23')]);router[_0x1509('0x8')](_0x1509('0x24'),auth[_0x1509('0x9')](),controller['getWhatsappInteractions']);router[_0x1509('0x8')](_0x1509('0x25'),auth[_0x1509('0x9')](),controller[_0x1509('0x26')]);router['get'](_0x1509('0x27'),auth[_0x1509('0x9')](),controller[_0x1509('0x28')]);router[_0x1509('0x8')](_0x1509('0x29'),auth['isAuthenticated'](),controller[_0x1509('0x2a')]);router[_0x1509('0x8')](_0x1509('0x2b'),auth[_0x1509('0x9')](),controller[_0x1509('0x2c')]);router[_0x1509('0x8')]('/:id/fax_accounts',auth[_0x1509('0x9')](),controller['getFaxAccounts']);router[_0x1509('0x8')](_0x1509('0x2d'),auth[_0x1509('0x9')](),controller[_0x1509('0x2e')]);router[_0x1509('0x8')](_0x1509('0x2f'),auth[_0x1509('0x9')](),controller[_0x1509('0x30')]);router[_0x1509('0x8')](_0x1509('0x31'),auth['isAuthenticated'](),controller[_0x1509('0x32')]);router[_0x1509('0x8')](_0x1509('0x33'),auth[_0x1509('0x9')](),controller[_0x1509('0x34')]);router[_0x1509('0x8')](_0x1509('0x35'),auth[_0x1509('0x9')](),controller[_0x1509('0x36')]);router[_0x1509('0x8')](_0x1509('0x37'),auth[_0x1509('0x9')](),controller['getSquareProjects']);router['get'](_0x1509('0x38'),auth[_0x1509('0x9')](),controller[_0x1509('0x39')]);router[_0x1509('0x8')]('/:id/api_key',auth[_0x1509('0x9')](),controller[_0x1509('0x3a')]);router[_0x1509('0x3b')](_0x1509('0x3c'),auth['isAuthenticated'](),controller[_0x1509('0x3d')]);router[_0x1509('0x3b')]('/',auth[_0x1509('0x9')](),controller['create']);router['post']('/create_many',auth[_0x1509('0x9')](),controller[_0x1509('0x3e')]);router[_0x1509('0x3b')]('/:id/queues',auth[_0x1509('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0x1509('0x3f')]({'destination':function(_0x3a4797,_0x2299cd,_0x9b1763){_0x9b1763(null,path['join'](config[_0x1509('0x40')],'server/files/images/'));},'filename':function(_0xd89239,_0x2da324,_0x3990ba){_0x3990ba(null,util[_0x1509('0x41')](_0x1509('0x42'),Date[_0x1509('0x43')](),_0x2da324[_0x1509('0x44')]));}})});router[_0x1509('0x3b')]('/:id/avatar',upload[_0x1509('0x45')](_0x1509('0x46')),controller['addAvatar']);router[_0x1509('0x3b')](_0x1509('0x47'),auth[_0x1509('0x9')](),controller['login']);router['post']('/:id/logout',auth['isAuthenticated'](),controller[_0x1509('0x48')]);router['post'](_0x1509('0x49'),auth[_0x1509('0x9')](),controller[_0x1509('0x4a')]);router[_0x1509('0x3b')](_0x1509('0x4b'),auth[_0x1509('0x9')](),controller[_0x1509('0x4c')]);router[_0x1509('0x3b')](_0x1509('0x25'),auth[_0x1509('0x9')](),controller[_0x1509('0x4d')]);router[_0x1509('0x3b')](_0x1509('0x4e'),auth['isAuthenticated'](),controller['addChatInteractions']);router['post'](_0x1509('0x4f'),auth[_0x1509('0x9')](),controller[_0x1509('0x50')]);router['post'](_0x1509('0x51'),auth[_0x1509('0x9')](),controller[_0x1509('0x52')]);router[_0x1509('0x3b')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x1509('0x53')]);router[_0x1509('0x3b')](_0x1509('0x54'),auth[_0x1509('0x9')](),controller[_0x1509('0x55')]);router[_0x1509('0x3b')](_0x1509('0x56'),auth[_0x1509('0x9')](),controller[_0x1509('0x57')]);router[_0x1509('0x3b')]('/:id/fax_accounts',auth[_0x1509('0x9')](),controller[_0x1509('0x58')]);router['post'](_0x1509('0x2d'),auth['isAuthenticated'](),controller[_0x1509('0x59')]);router[_0x1509('0x3b')]('/:id/openchannel_accounts',auth[_0x1509('0x9')](),controller['addOpenchannelAccounts']);router[_0x1509('0x3b')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x1509('0x5a')]);router['post']('/:id/chat_websites',auth[_0x1509('0x9')](),controller[_0x1509('0x5b')]);router[_0x1509('0x3b')](_0x1509('0x35'),auth[_0x1509('0x9')](),controller[_0x1509('0x5c')]);router['post'](_0x1509('0x37'),auth[_0x1509('0x9')](),controller[_0x1509('0x5d')]);router[_0x1509('0x3b')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x1509('0x5e')]);router['put'](_0x1509('0x10'),auth[_0x1509('0x9')](),controller[_0x1509('0x5f')]);router[_0x1509('0x60')](_0x1509('0x61'),auth['isAuthenticated'](),controller['changePassword']);router[_0x1509('0x62')]('/:id/queues',auth['isAuthenticated'](),controller['removeQueues']);router['delete']('/:id/teams',auth[_0x1509('0x9')](),controller['removeTeams']);router[_0x1509('0x62')](_0x1509('0x10'),auth[_0x1509('0x9')](),controller['destroy']);router['delete'](_0x1509('0x4e'),auth[_0x1509('0x9')](),controller[_0x1509('0x63')]);router[_0x1509('0x62')](_0x1509('0x4f'),auth[_0x1509('0x9')](),controller[_0x1509('0x64')]);router[_0x1509('0x62')](_0x1509('0x51'),auth[_0x1509('0x9')](),controller[_0x1509('0x65')]);router['delete'](_0x1509('0x66'),auth[_0x1509('0x9')](),controller[_0x1509('0x67')]);router[_0x1509('0x62')](_0x1509('0x54'),auth[_0x1509('0x9')](),controller[_0x1509('0x68')]);router[_0x1509('0x62')](_0x1509('0x56'),auth[_0x1509('0x9')](),controller[_0x1509('0x69')]);router['delete'](_0x1509('0x6a'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0x1509('0x62')](_0x1509('0x2d'),auth[_0x1509('0x9')](),controller[_0x1509('0x6b')]);router[_0x1509('0x62')](_0x1509('0x2f'),auth[_0x1509('0x9')](),controller[_0x1509('0x6c')]);router[_0x1509('0x62')](_0x1509('0x31'),auth['isAuthenticated'](),controller[_0x1509('0x6d')]);router[_0x1509('0x62')](_0x1509('0x33'),auth[_0x1509('0x9')](),controller[_0x1509('0x6e')]);router['delete'](_0x1509('0x35'),auth[_0x1509('0x9')](),controller['removeWhatsappAccounts']);router['delete'](_0x1509('0x37'),auth[_0x1509('0x9')](),controller[_0x1509('0x6f')]);router['delete'](_0x1509('0x70'),auth[_0x1509('0x9')](),controller[_0x1509('0x71')]);module[_0x1509('0x72')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 7e0e9a4..2b0cf66 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 _0x34e8=['isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get'];(function(_0x168014,_0x44d242){var _0x1a2157=function(_0x26198e){while(--_0x26198e){_0x168014['push'](_0x168014['shift']());}};_0x1a2157(++_0x44d242);}(_0x34e8,0x12c));var _0x834e=function(_0x2457fc,_0x326789){_0x2457fc=_0x2457fc-0x0;var _0x1aaf90=_0x34e8[_0x2457fc];return _0x1aaf90;};'use strict';var Sequelize=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));module['exports']={'name':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x472111){this[_0x834e('0x6')](_0x834e('0x5'),_0x472111);this[_0x834e('0x6')](_0x834e('0x7'),_0x472111);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'set':function(_0x52056d){this[_0x834e('0x6')](_0x834e('0x8'),_0x52056d);this[_0x834e('0x6')](_0x834e('0x9'),util[_0x834e('0xa')](_0x834e('0xb'),_0x52056d,this[_0x834e('0xc')](_0x834e('0xd'))));}},'alias':{'type':Sequelize[_0x834e('0x4')]},'email':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0xe'),'validate':{'isEmail':!![]},'set':function(_0x36e124){if(_0x36e124){this[_0x834e('0x6')](_0x834e('0xe'),_0x36e124[_0x834e('0xf')]());}}},'role':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x11'),'user',_0x834e('0x12'),_0x834e('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x834e('0x4')],'defaultValue':_0x834e('0x14')},'internal':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':![],'unique':_0x834e('0xd'),'set':function(_0x50e860){this[_0x834e('0x6')](_0x834e('0xd'),_0x50e860);this['setDataValue'](_0x834e('0x16'),_0x50e860);this['setDataValue'](_0x834e('0x9'),util[_0x834e('0xa')]('\x22%s\x22\x20<%s>',this[_0x834e('0xc')](_0x834e('0x8')),_0x50e860));}},'salt':{'type':Sequelize[_0x834e('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x834e('0x4')]},'address':{'type':Sequelize[_0x834e('0x4')]},'zipcode':{'type':Sequelize[_0x834e('0x4')]},'userpic':{'type':Sequelize[_0x834e('0x4')]},'city':{'type':Sequelize[_0x834e('0x4')]},'country':{'type':Sequelize[_0x834e('0x4')]},'online':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x834e('0x18')},'lastPauseAt':{'type':Sequelize[_0x834e('0x19')]},'chatCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x834e('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x834e('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0x834e('0x1b')},'context':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x834e('0x1d'),_0x834e('0x1e'),_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),_0x834e('0x23'),_0x834e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x25'),'set':function(_0x2b3418){this[_0x834e('0x6')](_0x834e('0x26'),_0x2b3418?_0x2b3418[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x26'))?this[_0x834e('0xc')]('transport')[_0x834e('0x28')](','):null;},'comment':_0x834e('0x29')},'dtmfmode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2a'),'info',_0x834e('0x2b'),_0x834e('0x2c'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x31'),'set':function(_0x6a3ac){this['setDataValue'](_0x834e('0x32'),_0x6a3ac?_0x6a3ac[_0x834e('0x27')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x834e('0xc')](_0x834e('0x32'))[_0x834e('0x28')](','):null;},'comment':_0x834e('0x33')},'callgroup':{'type':Sequelize[_0x834e('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x834e('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x834e('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x834e('0x34')},'allow':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'defaultValue':_0x834e('0x35'),'set':function(_0x3c59af){this[_0x834e('0x6')]('allow',_0x3c59af?_0x3c59af[_0x834e('0x27')](';'):_0x834e('0x35'));},'get':function(){return this[_0x834e('0xc')]('allow')?this[_0x834e('0xc')](_0x834e('0x36'))['split'](';'):null;},'comment':_0x834e('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'set':function(_0x4a18bb){this['setDataValue'](_0x834e('0x38'),_0x4a18bb?_0x4a18bb[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x38'))?this[_0x834e('0xc')](_0x834e('0x38'))[_0x834e('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x834e('0x10')]('yes','no',_0x834e('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x3a')},'amaflags':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3c'),_0x834e('0x3d'),_0x834e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3f'),_0x834e('0x40')),'allowNull':!![],'defaultValue':_0x834e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x834e('0x10')]('yes','no','fingerprint',_0x834e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x834e('0x10')]('active',_0x834e('0x42'),_0x834e('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x834e('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x834e('0x19')]},'passwordResetAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x834e('0x45')]},'showWebBar':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0,'set':function(_0x1e4310){this[_0x834e('0x6')](_0x834e('0x46'),_0x1e4310);var _0x1659c8=this[_0x834e('0x47')]({'plain':!![]});switch(_0x1e4310){case 0x0:case 0x1:var _0x17b8e3=_0x1659c8[_0x834e('0x26')]?_[_0x834e('0x48')](_0x1659c8[_0x834e('0x26')])?_0x1659c8[_0x834e('0x26')][_0x834e('0x27')]():_0x1659c8[_0x834e('0x26')]:'udp';if(_0x17b8e3===_0x834e('0x49')){_0x17b8e3=_0x834e('0x25');}this[_0x834e('0x6')](_0x834e('0x26'),_0x17b8e3);this['setDataValue'](_0x834e('0x4a'),'no');this['setDataValue']('avpf',null);this[_0x834e('0x6')](_0x834e('0x4b'),null);this[_0x834e('0x6')](_0x834e('0x4c'),null);this[_0x834e('0x6')](_0x834e('0x4d'),null);this[_0x834e('0x6')](_0x834e('0x4e'),null);this['setDataValue'](_0x834e('0x4f'),null);this['setDataValue'](_0x834e('0x50'),null);this[_0x834e('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x834e('0x51'),'no');break;case 0x2:this[_0x834e('0x6')](_0x834e('0x26'),_0x834e('0x49'));this[_0x834e('0x6')]('encryption',_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x52'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4b'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4c'),_0x834e('0x2d'));this['setDataValue'](_0x834e('0x4d'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4e'),'no');this['setDataValue'](_0x834e('0x4f'),'actpass');this['setDataValue']('dtlscertfile',_0x1659c8[_0x834e('0x50')]||_0x834e('0x53'));this['setDataValue'](_0x834e('0x54'),_0x1659c8[_0x834e('0x54')]||'/etc/pki/tls/private/motion.key');this[_0x834e('0x6')](_0x834e('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x346be5){this[_0x834e('0x6')](_0x834e('0x55'),_0x346be5?_0x346be5[_0x834e('0x27')](','):[]);},'get':function(){return this[_0x834e('0xc')]('permissions')?_[_0x834e('0x56')](this['getDataValue'](_0x834e('0x55'))[_0x834e('0x28')](','),function(_0x2c758c){return parseInt(_0x2c758c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x834e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x834e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x834e('0xc')](_0x834e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x18ddac){if(typeof _0x18ddac===_0x834e('0x58')){var _0x5acf5c=_0x18ddac==='1'?!![]:_0x18ddac==='0'?![]:_0x18ddac===_0x834e('0x59')?!![]:_0x18ddac===_0x834e('0x5a')?![]:![];this[_0x834e('0x6')]('screenrecording',_0x5acf5c);}else{this[_0x834e('0x6')](_0x834e('0x5b'),_0x18ddac);}}},'blocked':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x443633){this[_0x834e('0x6')]('blocked',_0x443633);if(_0x443633===!![]){this['setDataValue'](_0x834e('0x5c'),moment());this[_0x834e('0x6')]('loginAttempts',0x0);}else{this[_0x834e('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x834e('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0}}; \ No newline at end of file +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(_0x14950b,_0x14259f){var _0x339ef1=function(_0x54657e){while(--_0x54657e){_0x14950b['push'](_0x14950b['shift']());}};_0x339ef1(++_0x14259f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0xcb91[_0x58547b];return _0x1d3fd2;};'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 diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 34841cd..a280dd4 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 _0x871b=['undefined','offset','limit','status','set','Content-Range','update','role','Users','Telephones','telephone','filter','ignore','map','value','includes','find','destroy','name','send','index','User','rawAttributes','fieldName','type','key','password','salt','getOptions','where','count','query','includeAll','include','userSetting','true','UserSetting','attributes','push','openTabs','rows','chat','dataValues','sms','fax','mail','openchannel','whatsapp','all','show','differenceBy','keys','filters','intersection','model','fields','length','options','body','describe','addContacts','params','ids','omit','internal','Setting','findById','securePassword','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','from','mailbox','email','permissions','102','113','110','104','105','107','108','109','100','114','115','create','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','agent','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','VoiceMail','findAll','Agents','isEmpty','autoAssociation','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','findOne','validatePasswordPattern','enforcePasswordHistory','previousPasswords','passwordHistoryLimit','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','toLowerCase','penalty','spread','capitalize','Queue:save','voice','VoiceQueue','get','online','interface','format','SIP/%s','each','UserVoiceQueueRt','upsert','removeQueues','channel','remove','QueueId','emit','Queue:remove','addAvatar','userpic','file','filename','getAvatar','existsSync','join','root','server/files/images/','download','getOpenTabs','ChatOpenTabs','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','createdAt','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','order','sort','pick','merge','hasOwnProperty','CmList','Tag','Tags','color','tag','nolimit','Queue','Queues','Unknown\x20role','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','VoiceRecording','getScreenRecordings','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','headers','remoteAddress','connection','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','concat','isMiddleware','logout','pause','DEFAULT\x20PAUSE','unpause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','lastPauseAt','manual','%s%s','Pause','QueuePause','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','Chat','Mail','getSmsQueues','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','Openchannel','flatten','transaction','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Sms','getOpenchannelQueues','removeAgent','getLists','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gte','$lt','$ne','$eq','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','CmHopper','firstName','lastName','CmContact','getApiKey','retrieveApiKey','json','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','resolve','getUserSetting','getPresence','teams','queues','inbound','getAgents','lower','col','toString','asc','desc','substring','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unavailable','ringing','voiceStatus','busy','slice','select','field','ui.','InteractionId','ui.createdAt','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','util','path','lodash','squel','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./user.socket','register','localhost','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x871b,0x17e));var _0xb871=function(_0x34b8a8,_0x7b9f7e){_0x34b8a8=_0x34b8a8-0x0;var _0x325e04=_0x871b[_0x34b8a8];return _0x325e04;};'use strict';var moment=require(_0xb871('0x0'));var BPromise=require('bluebird');var util=require(_0xb871('0x1'));var path=require(_0xb871('0x2'));var fs=require('fs');var _=require(_0xb871('0x3'));var squel=require(_0xb871('0x4'));var jayson=require('jayson/promise');var Redis=require(_0xb871('0x5'));var authService=require('../../components/auth/service');var qs=require(_0xb871('0x6'));var logger=require('../../config/logger')('api');var utils=require(_0xb871('0x7'));var config=require(_0xb871('0x8'));var licenseUtil=require(_0xb871('0x9'));var db=require(_0xb871('0xa'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xb871('0xb')]));require(_0xb871('0xc'))[_0xb871('0xd')](socket);config[_0xb871('0xb')]=_['defaults'](config[_0xb871('0xb')],{'host':_0xb871('0xe'),'port':0x18eb});var client=jayson[_0xb871('0xf')][_0xb871('0x10')]({'port':0x232a});var values;function respondWithRpcPromise(_0x35c1d2,_0x28e5a9,_0xd99c88,_0x18c203){return new BPromise(function(_0xbf9977,_0x2ebdf3){var _0x6d4ed=_0x18c203||client;return _0x6d4ed[_0xb871('0x11')](_0x35c1d2,_0xd99c88)[_0xb871('0x12')](function(_0x3b1bad){logger[_0xb871('0x13')](_0xb871('0x14'),_0x28e5a9,_0xb871('0x15'));logger[_0xb871('0x16')](_0xb871('0x17'),_0x28e5a9,_0xb871('0x15'),JSON[_0xb871('0x18')](_0x3b1bad));if(_0x3b1bad[_0xb871('0x19')]){if(_0x3b1bad[_0xb871('0x19')][_0xb871('0x1a')]===0x1f4){logger[_0xb871('0x19')]('User,\x20%s,\x20%s',_0x28e5a9,_0x3b1bad['error']['message']);return _0x2ebdf3(_0x3b1bad['error'][_0xb871('0x1b')]);}logger['error']('User,\x20%s,\x20%s',_0x28e5a9,_0x3b1bad[_0xb871('0x19')]['message']);return _0xbf9977(_0x3b1bad[_0xb871('0x19')][_0xb871('0x1b')]);}else{logger[_0xb871('0x13')](_0xb871('0x14'),_0x28e5a9,_0xb871('0x15'));_0xbf9977(_0x3b1bad[_0xb871('0x1c')][_0xb871('0x1b')]);}})[_0xb871('0x1d')](function(_0x57b3b1){logger[_0xb871('0x19')]('User,\x20%s,\x20%s',_0x28e5a9,_0x57b3b1);_0x2ebdf3(_0x57b3b1);});});}function respondWithStatusCode(_0x2f638d,_0x1a6d50){_0x1a6d50=_0x1a6d50||0xcc;return function(_0x36e12e){if(_0x36e12e){return _0x2f638d[_0xb871('0x1e')](_0x1a6d50);}return _0x2f638d['status'](_0x1a6d50)[_0xb871('0x1f')]();};}function respondWithResult(_0x62732f,_0x5c1b3d){_0x5c1b3d=_0x5c1b3d||0xc8;return function(_0x2738e0){if(_0x2738e0){return _0x62732f['status'](_0x5c1b3d)['json'](_0x2738e0);}};}function respondWithFilteredResult(_0x3db6ff,_0x53dc17){return function(_0x4d6bfd){if(_0x4d6bfd){var _0x5da44f=typeof _0x53dc17['offset']===_0xb871('0x20')&&typeof _0x53dc17['limit']==='undefined';var _0x253f9b=_0x4d6bfd['count'];var _0x11df80=_0x5da44f?0x0:_0x53dc17[_0xb871('0x21')];var _0x49e497=_0x5da44f?_0x4d6bfd['count']:_0x53dc17['offset']+_0x53dc17[_0xb871('0x22')];var _0x4c04f6;if(_0x49e497>=_0x253f9b){_0x49e497=_0x253f9b;_0x4c04f6=0xc8;}else{_0x4c04f6=0xce;}_0x3db6ff[_0xb871('0x23')](_0x4c04f6);return _0x3db6ff[_0xb871('0x24')](_0xb871('0x25'),_0x11df80+'-'+_0x49e497+'/'+_0x253f9b)['json'](_0x4d6bfd);}return null;};}function saveUpdates(_0x1fe456){return function(_0xdcb6dc){if(_0xdcb6dc){return _0xdcb6dc[_0xb871('0x26')](_0x1fe456)[_0xb871('0x12')](function(_0x1e9309){return _0x1e9309;});}return null;};}function removeEntity(_0x5cb765){return function(_0x18f19d){if(_0x18f19d){return _0x18f19d['destroy']()[_0xb871('0x12')](function(){var _0x2af9b1=_0x18f19d['get']({'plain':!![]});if(_0x2af9b1[_0xb871('0x27')]==='admin')return;var _0x38867a=[{'name':_0xb871('0x28'),'value':'user','ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0xb871('0x29'),'value':_0xb871('0x2a'),'ignore':![]}];var _0x418500=_(_0x38867a)[_0xb871('0x2b')](_0xb871('0x2c'))[_0xb871('0x2d')](_0xb871('0x2e'))[_0xb871('0x2e')]();if(_[_0xb871('0x2f')](_0x418500,_0x2af9b1[_0xb871('0x27')])){return;}var _0x4fe10f=_[_0xb871('0x30')](_0x38867a,[_0xb871('0x2e'),_0x2af9b1[_0xb871('0x27')]])['name'];return db['UserProfileResource'][_0xb871('0x31')]({'where':{'type':_0x4fe10f,'resourceId':_0x2af9b1['id']}})[_0xb871('0x12')](function(){return _0x18f19d;});})[_0xb871('0x12')](function(){_0x5cb765['status'](0xcc)[_0xb871('0x1f')]();});}};}function handleEntityNotFound(_0x2ebf7f){return function(_0x26191c){if(!_0x26191c){_0x2ebf7f[_0xb871('0x1e')](0x194);}return _0x26191c;};}function handleError(_0x1d9335,_0x4ae268){_0x4ae268=_0x4ae268||0x1f4;return function(_0x126dbb){logger[_0xb871('0x19')](_0x126dbb['stack']);if(_0x126dbb[_0xb871('0x32')]){delete _0x126dbb[_0xb871('0x32')];}_0x1d9335[_0xb871('0x23')](_0x4ae268)[_0xb871('0x33')](_0x126dbb);};}exports[_0xb871('0x34')]=function(_0x2d08bb,_0x48c9a0){var _0x15b890={},_0x50d2f2={'count':0x0,'rows':[]};var _0x211538=_(db[_0xb871('0x35')][_0xb871('0x36')])[_0xb871('0x2d')](function(_0x2b77c3){return{'name':_0x2b77c3[_0xb871('0x37')],'type':_0x2b77c3[_0xb871('0x38')][_0xb871('0x39')]};})[_0xb871('0x2b')](function(_0x5da82b){return!_['includes']([_0xb871('0x3a'),_0xb871('0x3b')],_0x5da82b[_0xb871('0x32')]);})[_0xb871('0x2e')]();_0x15b890=qs[_0xb871('0x3c')](_0x211538,_0x2d08bb);var _0x4f3fbe={'where':_0x15b890[_0xb871('0x3d')]};return db[_0xb871('0x35')]['count'](_0x4f3fbe)['then'](function(_0x2de4fd){_0x50d2f2[_0xb871('0x3e')]=_0x2de4fd;if(_0x2d08bb[_0xb871('0x3f')][_0xb871('0x40')]){_0x15b890[_0xb871('0x41')]=[{'all':!![]}];}if(_0x2d08bb['query'][_0xb871('0x42')]===_0xb871('0x43')){_0x15b890[_0xb871('0x41')]=[{'model':db[_0xb871('0x44')],'as':_0xb871('0x42')}];}if(!_[_0xb871('0x2f')](_0x15b890[_0xb871('0x45')],'id')){_0x15b890['attributes'][_0xb871('0x46')]('id');}return db[_0xb871('0x35')]['findAll'](_0x15b890);})['then'](function(_0x5f02a3){_0x50d2f2['rows']=_0x5f02a3;if(_0x2d08bb[_0xb871('0x3f')][_0xb871('0x47')]===_0xb871('0x43')){var _0x355623=[];for(var _0x214407=0x0;_0x214407<_0x50d2f2[_0xb871('0x48')]['length'];_0x214407++){_0x355623[_0xb871('0x46')](get_open_tabs(_0xb871('0x49'),_0x50d2f2[_0xb871('0x48')][_0x214407][_0xb871('0x4a')]));_0x355623[_0xb871('0x46')](get_open_tabs(_0xb871('0x4b'),_0x50d2f2[_0xb871('0x48')][_0x214407][_0xb871('0x4a')]));_0x355623[_0xb871('0x46')](get_open_tabs(_0xb871('0x4c'),_0x50d2f2[_0xb871('0x48')][_0x214407]['dataValues']));_0x355623[_0xb871('0x46')](get_open_tabs(_0xb871('0x4d'),_0x50d2f2[_0xb871('0x48')][_0x214407][_0xb871('0x4a')]));_0x355623[_0xb871('0x46')](get_open_tabs(_0xb871('0x4e'),_0x50d2f2[_0xb871('0x48')][_0x214407][_0xb871('0x4a')]));_0x355623['push'](get_open_tabs(_0xb871('0x4f'),_0x50d2f2['rows'][_0x214407][_0xb871('0x4a')]));}return BPromise[_0xb871('0x50')](_0x355623)[_0xb871('0x12')](function(){return _0x50d2f2;});}else{return _0x50d2f2;}})[_0xb871('0x12')](respondWithFilteredResult(_0x48c9a0,_0x15b890))['catch'](handleError(_0x48c9a0,null));};exports[_0xb871('0x51')]=function(_0x14abaa,_0xb2a727){var _0x290eb0={'raw':![],'where':{'id':_0x14abaa['params']['id']}},_0xfc625b={};_0xfc625b['model']=_[_0xb871('0x52')](_[_0xb871('0x53')](db[_0xb871('0x35')][_0xb871('0x36')]),[_0xb871('0x3a'),_0xb871('0x3b')]);_0xfc625b[_0xb871('0x3f')]=_[_0xb871('0x53')](_0x14abaa[_0xb871('0x3f')]);_0xfc625b[_0xb871('0x54')]=_['intersection'](_0xfc625b['model'],_0xfc625b[_0xb871('0x3f')]);_0x290eb0[_0xb871('0x45')]=_[_0xb871('0x55')](_0xfc625b[_0xb871('0x56')],qs[_0xb871('0x57')](_0x14abaa[_0xb871('0x3f')][_0xb871('0x57')]));_0x290eb0[_0xb871('0x45')]=_0x290eb0['attributes'][_0xb871('0x58')]?_0x290eb0[_0xb871('0x45')]:_0xfc625b['model'];if(_0x14abaa[_0xb871('0x3f')]['includeAll']){_0x290eb0[_0xb871('0x41')]=[{'all':!![]}];}if(_0x14abaa[_0xb871('0x3f')]['userSetting']===_0xb871('0x43')){_0x290eb0[_0xb871('0x41')]=[{'model':db['UserSetting'],'as':_0xb871('0x42')}];}_0x290eb0=_['merge']({},_0x290eb0,_0x14abaa[_0xb871('0x59')]);if(!_['includes'](_0x290eb0[_0xb871('0x45')],'id')){_0x290eb0['attributes'][_0xb871('0x46')]('id');}return db[_0xb871('0x35')][_0xb871('0x30')](_0x290eb0)['then'](handleEntityNotFound(_0xb2a727,null))[_0xb871('0x12')](function(_0x137d92){var _0x335e66=[];values=_0x137d92;if(_0x14abaa['query'][_0xb871('0x47')]==='true'){_0x335e66[_0xb871('0x46')](get_open_tabs(_0xb871('0x49'),_0x137d92[_0xb871('0x4a')]));_0x335e66[_0xb871('0x46')](get_open_tabs(_0xb871('0x4b'),_0x137d92[_0xb871('0x4a')]));_0x335e66[_0xb871('0x46')](get_open_tabs(_0xb871('0x4e'),_0x137d92[_0xb871('0x4a')]));_0x335e66[_0xb871('0x46')](get_open_tabs('whatsapp',_0x137d92['dataValues']));_0x335e66[_0xb871('0x46')](get_open_tabs(_0xb871('0x4c'),_0x137d92[_0xb871('0x4a')]));_0x335e66[_0xb871('0x46')](get_open_tabs(_0xb871('0x4d'),_0x137d92[_0xb871('0x4a')]));return BPromise['all'](_0x335e66);}else{return values;}})[_0xb871('0x12')](function(){return values;})[_0xb871('0x12')](respondWithResult(_0xb2a727,null))[_0xb871('0x1d')](handleError(_0xb2a727,null));};exports[_0xb871('0x26')]=function(_0x28b5b7,_0x20dcce){if(_0x28b5b7[_0xb871('0x5a')]['id']){delete _0x28b5b7[_0xb871('0x5a')]['id'];}delete _0x28b5b7[_0xb871('0x5a')]['role'];return db[_0xb871('0x35')][_0xb871('0x30')]({'where':{'id':_0x28b5b7['params']['id']}})[_0xb871('0x12')](handleEntityNotFound(_0x20dcce,null))[_0xb871('0x12')](saveUpdates(_0x28b5b7[_0xb871('0x5a')],null))[_0xb871('0x12')](respondWithResult(_0x20dcce,null))['catch'](handleError(_0x20dcce,null));};exports[_0xb871('0x5b')]=function(_0xa615d4,_0x513801){return db['User'][_0xb871('0x5b')]()[_0xb871('0x12')](respondWithResult(_0x513801,null))[_0xb871('0x1d')](handleError(_0x513801,null));};exports[_0xb871('0x5c')]=function(_0xc118ab,_0x79486b){return db[_0xb871('0x35')][_0xb871('0x30')]({'where':{'id':_0xc118ab[_0xb871('0x5d')]['id']}})[_0xb871('0x12')](handleEntityNotFound(_0x79486b,null))['then'](function(_0x479573){if(_0x479573){return _0x479573[_0xb871('0x5c')](_0xc118ab[_0xb871('0x5a')][_0xb871('0x5e')],_[_0xb871('0x5f')](_0xc118ab[_0xb871('0x5a')],['ids','id'])||{});}})[_0xb871('0x12')](respondWithResult(_0x79486b,null))[_0xb871('0x1d')](handleError(_0x79486b,null));};function validateUser(_0xc82195){return new BPromise(function(_0x4180ec,_0x1425c3){if(_0xc82195[_0xb871('0x60')])return _0x4180ec(_0xc82195);return db[_0xb871('0x61')][_0xb871('0x62')](0x1)[_0xb871('0x12')](function(_0xd5413){if(_0xd5413[_0xb871('0x63')])authService['validatePasswordPattern'](_0xc82195[_0xb871('0x3a')]);db[_0xb871('0x35')][_0xb871('0x64')]('internal')[_0xb871('0x12')](function(_0x46fe40){if(_[_0xb871('0x65')](_0x46fe40)){_0xc82195[_0xb871('0x60')]=_0xd5413[_0xb871('0x66')]||0x1;return;}if(_[_0xb871('0x65')](_0xd5413['min_internal'])||_0xd5413[_0xb871('0x66')]===_0x46fe40){_0xc82195[_0xb871('0x60')]=_0x46fe40+0x1;return;}if(_0xd5413['min_internal']>_0x46fe40){_0xc82195['internal']=_0xd5413[_0xb871('0x66')];return;}return db[_0xb871('0x67')][_0xb871('0x3f')](_0xb871('0x68'),{'type':db[_0xb871('0x67')]['QueryTypes'][_0xb871('0x69')]})[_0xb871('0x12')](function(_0x4bab92){if(_0x4bab92&&_0x4bab92[_0xb871('0x58')]){for(var _0xb765a5=0x0,_0x25f07d=_0x4bab92[_0xb871('0x58')];_0xb765a5<_0x25f07d&&_[_0xb871('0x65')](_0xc82195[_0xb871('0x60')]);_0xb765a5++){if(_0xd5413['min_internal']<=_0x4bab92[_0xb765a5][_0xb871('0x6a')]){_0xc82195[_0xb871('0x60')]=_0x4bab92[_0xb765a5][_0xb871('0x6a')];}else if(_0xd5413[_0xb871('0x66')]>_0x4bab92[_0xb765a5]['from']&&_0xd5413['min_internal']<=_0x4bab92[_0xb765a5]['to']){_0xc82195['internal']=_0xd5413[_0xb871('0x66')];}}}if(_[_0xb871('0x65')](_0xc82195[_0xb871('0x60')])){_0xc82195[_0xb871('0x60')]=_0x46fe40+0x1;}return _0x4180ec(_0xc82195);});});})[_0xb871('0x1d')](function(_0x5d44a3){_0x1425c3(_0x5d44a3);});});}function updateUser(_0x14db03){return new BPromise(function(_0x296874,_0x445ab1){try{if(_0x14db03['voicemail']){_0x14db03[_0xb871('0x6b')]=_0x14db03[_0xb871('0x60')];_0x14db03['VoiceMail']={'mailbox':_0x14db03[_0xb871('0x60')],'password':_0x14db03[_0xb871('0x3a')],'fullname':_0x14db03['fullname'],'email':_0x14db03[_0xb871('0x6c')]};}if(_0x14db03[_0xb871('0x27')]==='agent'){if(!_0x14db03[_0xb871('0x6d')])_0x14db03['permissions']=['101',_0xb871('0x6e'),'103',_0xb871('0x6f'),_0xb871('0x70'),_0xb871('0x71'),_0xb871('0x72'),'106',_0xb871('0x73'),_0xb871('0x74'),_0xb871('0x75'),_0xb871('0x76'),'111',_0xb871('0x77'),_0xb871('0x78')];}_0x296874(_0x14db03);}catch(_0x2989a3){_0x445ab1(_0x2989a3);}});}exports[_0xb871('0x79')]=function(_0x56662e,_0x2b088e){if(_0x56662e[_0xb871('0x7a')]['role']==='agent')throw new Error('Unauthorized');if(_0x56662e[_0xb871('0x5a')]['role']==='user'&&_0x56662e['user'][_0xb871('0x27')]!==_0xb871('0x7b')){throw new Error(_0xb871('0x7c'));}if(_0x56662e['body'][_0xb871('0x27')]===_0xb871('0x7b')&&_0x56662e['user']['role']!==_0xb871('0x7b')){throw new Error(_0xb871('0x7d'));}return licenseUtil[_0xb871('0x7e')]([_0x56662e[_0xb871('0x5a')]])[_0xb871('0x12')](function(){return validateUser(_0x56662e[_0xb871('0x5a')]);})[_0xb871('0x12')](function(_0x29dc41){return updateUser(_0x29dc41)[_0xb871('0x12')](function(_0x5aba0f){if(_0x5aba0f[_0xb871('0x27')]===_0xb871('0x7b')){_0x5aba0f[_0xb871('0x7f')]=_0x56662e[_0xb871('0x7a')][_0xb871('0x7f')];delete _0x5aba0f['userProfileId'];}return _0x5aba0f;});})[_0xb871('0x12')](function(_0xe7aef7){return db[_0xb871('0x35')][_0xb871('0x79')](_0xe7aef7,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0xb871('0x12')](function(_0x5484a3){if(_0x56662e[_0xb871('0x5a')][_0xb871('0x27')]===_0xb871('0x7a'))return _0x5484a3;if(_0x56662e[_0xb871('0x7a')][_0xb871('0x27')]!==_0xb871('0x7a'))return _0x5484a3;return db['UserProfileSection'][_0xb871('0x30')]({'where':{'name':_0x5484a3[_0xb871('0x27')]===_0xb871('0x80')?'Agents':_0xb871('0x29'),'userProfileId':_0x56662e[_0xb871('0x7a')][_0xb871('0x81')]},'raw':!![]})[_0xb871('0x12')](function(_0x2ae425){if(!_0x2ae425||_0x2ae425['autoAssociation']!=0x0)return _0x5484a3;return db[_0xb871('0x82')][_0xb871('0x79')]({'name':_0x5484a3['name'],'resourceId':_0x5484a3['id'],'type':_0x2ae425[_0xb871('0x32')],'sectionId':_0x2ae425['id']},{})[_0xb871('0x12')](function(){return _0x5484a3;});})[_0xb871('0x1d')](function(_0x3e6c1c){logger[_0xb871('0x19')](_0xb871('0x83'),_0x3e6c1c);throw _0x3e6c1c;});})[_0xb871('0x12')](respondWithResult(_0x2b088e,0xc9))[_0xb871('0x1d')](handleError(_0x2b088e,null));};exports[_0xb871('0x84')]=function(_0x270a5b,_0x573765){var _0x1189e5=_0x270a5b[_0xb871('0x5a')];var _0x5b5723=[];if(_0x270a5b[_0xb871('0x7a')][_0xb871('0x27')]==='agent')throw new Error(_0xb871('0x85'));if(_[_0xb871('0x86')](_0x1189e5,[_0xb871('0x27'),'user'])&&_0x270a5b[_0xb871('0x7a')]['role']!=='admin'){throw new Error(_0xb871('0x7c'));}if(_[_0xb871('0x86')](_0x1189e5,[_0xb871('0x27'),_0xb871('0x7b')])&&_0x270a5b[_0xb871('0x7a')]['role']!=='admin'){throw new Error(_0xb871('0x87'));}return licenseUtil[_0xb871('0x7e')](_0x1189e5)[_0xb871('0x12')](function(){return validateUser(_0x1189e5[0x0]);})['then'](function(){for(var _0x4e9c0d=0x1;_0x4e9c0d<_0x1189e5[_0xb871('0x58')];_0x4e9c0d++){var _0x360161=_0x1189e5[_0x4e9c0d-0x1]['internal'];if(!_0x1189e5[_0x4e9c0d][_0xb871('0x60')])_0x1189e5[_0x4e9c0d][_0xb871('0x60')]=_0x360161+0x1;_0x5b5723['push'](validateUser(_0x1189e5[_0x4e9c0d]));}return BPromise[_0xb871('0x50')](_0x5b5723);})[_0xb871('0x12')](function(){_0x5b5723=[];for(var _0x56b0b5=0x0;_0x56b0b5<_0x1189e5['length'];_0x56b0b5++){_0x5b5723['push'](updateUser(_0x1189e5[_0x56b0b5]));}return BPromise[_0xb871('0x50')](_0x5b5723);})['then'](function(){return BPromise['each'](_0x1189e5,function(_0x390446){return db[_0xb871('0x35')]['create'](_0x390446,{'include':[{'model':db[_0xb871('0x88')],'as':_0xb871('0x88')}]})[_0xb871('0x12')](function(_0x323437){_0x390446['id']=_0x323437['id'];return _0x390446;});});})['then'](function(_0x1f4861){if(_0x270a5b[_0xb871('0x5a')][_0xb871('0x27')]===_0xb871('0x7a'))return _0x1f4861;if(_0x270a5b[_0xb871('0x7a')][_0xb871('0x27')]!==_0xb871('0x7a'))return _0x1f4861;var _0x56441e=_['some'](_0x1f4861,function(_0x74e4c0){return _0x74e4c0['role']===_0xb871('0x80')||_0x74e4c0[_0xb871('0x27')]===_0xb871('0x2a');});if(!_0x56441e)return _0x1f4861;return db['UserProfileSection'][_0xb871('0x89')]({'where':{'name':{'$or':[_0xb871('0x8a'),'Telephones']},'userProfileId':_0x270a5b[_0xb871('0x7a')][_0xb871('0x81')]},'raw':!![]})[_0xb871('0x12')](function(_0x178545){if(_[_0xb871('0x8b')](_0x178545)||!_[_0xb871('0x86')](_0x178545,[_0xb871('0x8c'),0x0]))return _0x1f4861;_0x5b5723=[];var _0x37f2d7=_(_0x178545)[_0xb871('0x2d')](function(_0x159d3b){if(_0x159d3b[_0xb871('0x8c')]===0x1)return;return _0x159d3b[_0xb871('0x32')]==='Agents'?_0xb871('0x80'):_0xb871('0x2a');})[_0xb871('0x8d')]()[_0xb871('0x2e')]();for(var _0x227bdc=0x0;_0x227bdc<_0x1f4861[_0xb871('0x58')];_0x227bdc++){if(!_[_0xb871('0x2f')](_0x37f2d7,_0x1f4861[_0x227bdc][_0xb871('0x27')]))return;var _0x420fdd=_0x1f4861[_0x227bdc][_0xb871('0x27')]===_0xb871('0x80')?_0xb871('0x8a'):_0xb871('0x29');_0x5b5723[_0xb871('0x46')](db['UserProfileResource'][_0xb871('0x79')]({'name':_0x1f4861[_0x227bdc][_0xb871('0x32')],'resourceId':_0x1f4861[_0x227bdc]['id'],'type':_0x420fdd,'sectionId':_['find'](_0x178545,[_0xb871('0x32'),_0x420fdd])['id']},{}));}return BPromise['all'](_0x5b5723);});})[_0xb871('0x12')](respondWithResult(_0x573765,0xc9))[_0xb871('0x1d')](handleError(_0x573765,null));};exports[_0xb871('0x8e')]=function(_0x406f46,_0x2cd46c){if(_0x406f46[_0xb871('0x5a')]['id']){delete _0x406f46[_0xb871('0x5a')]['id'];}return db['User'][_0xb871('0x30')]({'where':{'id':_0x406f46[_0xb871('0x5d')]['id']}})[_0xb871('0x12')](function(_0x4f4629){if(!_0x4f4629)return null;if(_0x4f4629['id']===_0x406f46[_0xb871('0x7a')]['id']){if(!_0x406f46['body'][_0xb871('0x8f')]||!_0x406f46[_0xb871('0x5a')][_0xb871('0x90')]){throw new db[(_0xb871('0x91'))][(_0xb871('0x92'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x4f4629[_0xb871('0x93')](_0x406f46['body'][_0xb871('0x8f')])){throw new db[(_0xb871('0x91'))][(_0xb871('0x92'))](_0xb871('0x94'));}if(_0x406f46['body'][_0xb871('0x8f')]===_0x406f46['body'][_0xb871('0x90')]){throw new db[(_0xb871('0x91'))][(_0xb871('0x92'))](_0xb871('0x95'));}}else if(_0x406f46[_0xb871('0x7a')]['role']==='admin'){if(!_0x406f46['body'][_0xb871('0x90')]){throw new db['Sequelize'][(_0xb871('0x92'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x406f46[_0xb871('0x7a')][_0xb871('0x27')]===_0xb871('0x7a')){if(!_0x406f46['body'][_0xb871('0x90')]){throw new db[(_0xb871('0x91'))][(_0xb871('0x92'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x4f4629[_0xb871('0x27')]!=='agent'){throw new db['Sequelize'][(_0xb871('0x92'))](_0xb871('0x85'));}}else{throw new db[(_0xb871('0x91'))][(_0xb871('0x92'))](_0xb871('0x85'));}return _0x4f4629;})[_0xb871('0x12')](handleEntityNotFound(_0x2cd46c,null))['then'](function(_0x49ecbb){return db['Setting'][_0xb871('0x96')]({'attributes':['id',_0xb871('0x63'),'enforcePasswordHistory','passwordHistoryLimit']})[_0xb871('0x12')](function(_0x550d72){if(_0x550d72[_0xb871('0x63')])authService[_0xb871('0x97')](_0x406f46['body'][_0xb871('0x90')]);if(!_0x550d72[_0xb871('0x98')]||!_0x49ecbb[_0xb871('0x99')])return _0x49ecbb;authService['validatePasswordHistory'](_0x406f46[_0xb871('0x5a')][_0xb871('0x90')],_0x49ecbb[_0xb871('0x99')],_0x550d72[_0xb871('0x9a')]);return _0x49ecbb;})[_0xb871('0x12')](saveUpdates({'password':_0x406f46['body']['newPassword'],'passwordResetAt':_0x406f46['user']['id']==_0x406f46[_0xb871('0x5d')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x406f46['body'][_0xb871('0x90')],_0x49ecbb[_0xb871('0x99')])},null));})[_0xb871('0x12')](respondWithResult(_0x2cd46c,null))[_0xb871('0x1d')](handleError(_0x2cd46c,null));};exports['addQueues']=function(_0x328a8a,_0x3ed8f2){var _0x4325bd=_0x328a8a[_0xb871('0x5a')]['channel'];return db['User']['find']({'where':{'id':_0x328a8a[_0xb871('0x5d')]['id']},'attributes':['id',_0xb871('0x32'),'role','online',_0xb871('0x9b'),_0xb871('0x9c'),'interface']})['then'](handleEntityNotFound(_0x3ed8f2,null))[_0xb871('0x12')](function(_0x5363b0){if(_0x5363b0){if(!utils[_0xb871('0x9d')](_0x4325bd)){throw new db[(_0xb871('0x91'))][(_0xb871('0x92'))](_0xb871('0x9e'));}return _0x5363b0[_0xb871('0x9f')+_['capitalize'](_0x4325bd[_0xb871('0xa0')]())+'Queues'](_0x328a8a['body'][_0xb871('0x5e')],{'penalty':_0x328a8a[_0xb871('0x5a')][_0xb871('0xa1')]||0x0})[_0xb871('0xa2')](function(_0x3354c8){for(var _0x3950d7=0x0;_0x3950d7<_0x328a8a[_0xb871('0x5a')][_0xb871('0x5e')]['length'];_0x3950d7+=0x1){var _0x1dcc96={'UserId':Number(_0x328a8a['params']['id'])};_0x1dcc96[_[_0xb871('0xa3')](_0x4325bd[_0xb871('0xa0')]())+'QueueId']=Number(_0x328a8a[_0xb871('0x5a')][_0xb871('0x5e')][_0x3950d7]);socket['emit'](_0xb871('0x7a')+_[_0xb871('0xa3')](_0x4325bd[_0xb871('0xa0')]())+_0xb871('0xa4'),_0x1dcc96);}return _0x3354c8;})[_0xb871('0x12')](function(){if(_0x4325bd===_0xb871('0xa5')){return db[_0xb871('0xa6')][_0xb871('0x89')]({'where':{'id':_0x328a8a[_0xb871('0x5a')][_0xb871('0x5e')]||[]},'raw':!![],'attributes':['id',_0xb871('0x32')]});}})[_0xb871('0x12')](function(_0x2b97e4){var _0x7af994=_0x5363b0[_0xb871('0xa7')]({'plain':!![]});var _0x38dd24=[];if(_0x4325bd===_0xb871('0xa5')&&_0x7af994[_0xb871('0x27')]===_0xb871('0x80')&&_0x7af994[_0xb871('0xa8')]){for(var _0x469ab2=0x0;_0x469ab2<_0x2b97e4[_0xb871('0x58')];_0x469ab2+=0x1){_0x38dd24[_0xb871('0x46')]({'membername':_0x7af994[_0xb871('0x32')],'UserId':_0x7af994['id'],'queue_name':_0x2b97e4[_0x469ab2][_0xb871('0x32')],'VoiceQueueId':_0x2b97e4[_0x469ab2]['id'],'interface':_['isNil'](_0x7af994[_0xb871('0xa9')])?util[_0xb871('0xaa')](_0xb871('0xab'),_0x7af994[_0xb871('0x32')]):_0x7af994[_0xb871('0xa9')],'paused':_0x7af994['voicePause']||![],'penalty':_0x328a8a[_0xb871('0x5a')]['penalty']||0x0});}return BPromise[_0xb871('0xac')](_0x38dd24,function(_0x490f95){return db[_0xb871('0xad')][_0xb871('0xae')](_0x490f95);});}return _0x5363b0;});}})[_0xb871('0x12')](respondWithStatusCode(_0x3ed8f2,null))[_0xb871('0x1d')](handleError(_0x3ed8f2,null));};exports[_0xb871('0xaf')]=function(_0x421897,_0xd0c917){var _0x3197af,_0x2b3f6a;return db['User'][_0xb871('0x30')]({'where':{'id':_0x421897[_0xb871('0x5d')]['id']},'attributes':['id','name',_0xb871('0x27')]})['then'](handleEntityNotFound(_0xd0c917,null))[_0xb871('0x12')](function(_0x33bb11){if(_0x33bb11){_0x3197af=_0x33bb11;if(!_0x421897[_0xb871('0x3f')]['channel']||!utils['isValidChannel'](_0x421897['query'][_0xb871('0xb0')])){throw new db['Sequelize']['ValidationError'](_0xb871('0x9e'));}return _0x33bb11[_0xb871('0xb1')+_[_0xb871('0xa3')](_0x421897[_0xb871('0x3f')][_0xb871('0xb0')]['toLowerCase']())+'Queues'](_0x421897[_0xb871('0x3f')][_0xb871('0x5e')]);}})[_0xb871('0x12')](function(_0x2ab1cd){if(_['isArray'](_0x421897[_0xb871('0x3f')]['ids'])){for(var _0x496701=0x0;_0x496701<_0x421897[_0xb871('0x3f')][_0xb871('0x5e')][_0xb871('0x58')];_0x496701+=0x1){_0x2b3f6a={'UserId':Number(_0x421897['params']['id'])};_0x2b3f6a[_[_0xb871('0xa3')](_0x421897[_0xb871('0x3f')][_0xb871('0xb0')][_0xb871('0xa0')]())+_0xb871('0xb2')]=Number(_0x421897[_0xb871('0x3f')][_0xb871('0x5e')][_0x496701]);socket[_0xb871('0xb3')]('user'+_[_0xb871('0xa3')](_0x421897[_0xb871('0x3f')]['channel'][_0xb871('0xa0')]())+_0xb871('0xb4'),_0x2b3f6a);}}else{_0x2b3f6a={'UserId':Number(_0x421897[_0xb871('0x5d')]['id'])};_0x2b3f6a[_[_0xb871('0xa3')](_0x421897[_0xb871('0x3f')][_0xb871('0xb0')]['toLowerCase']())+_0xb871('0xb2')]=Number(_0x421897[_0xb871('0x3f')][_0xb871('0x5e')]);socket[_0xb871('0xb3')]('user'+_[_0xb871('0xa3')](_0x421897[_0xb871('0x3f')]['channel'][_0xb871('0xa0')]())+_0xb871('0xb4'),_0x2b3f6a);}return _0x2ab1cd;})[_0xb871('0x12')](function(){if(_0x421897[_0xb871('0x3f')][_0xb871('0xb0')]===_0xb871('0xa5')){return db[_0xb871('0xad')][_0xb871('0x31')]({'where':{'UserId':_0x421897[_0xb871('0x5d')]['id'],'VoiceQueueId':_0x421897[_0xb871('0x3f')]['ids']},'individualHooks':!![]})[_0xb871('0x12')](function(){return _0x3197af;});}return _0x3197af;})['then'](respondWithStatusCode(_0xd0c917,null))[_0xb871('0x1d')](handleError(_0xd0c917,null));};exports[_0xb871('0xb5')]=function(_0x2cf71b,_0xe0136f){_0x2cf71b[_0xb871('0x5a')][_0xb871('0xb6')]=_0x2cf71b[_0xb871('0xb7')][_0xb871('0xb8')];return db['User']['find']({'where':{'id':_0x2cf71b[_0xb871('0x5d')]['id']}})[_0xb871('0x12')](handleEntityNotFound(_0xe0136f,null))[_0xb871('0x12')](saveUpdates(_0x2cf71b[_0xb871('0x5a')],null))[_0xb871('0x12')](respondWithResult(_0xe0136f,null))[_0xb871('0x1d')](handleError(_0xe0136f,null));};exports[_0xb871('0xb9')]=function(_0x1cb6a7,_0x59f846){var _0x1ef157=path['join'](config['root'],'server/files/images/logos/default_profile.png');return db[_0xb871('0x35')]['find']({'where':{'id':_0x1cb6a7[_0xb871('0x5d')]['id']},'attributes':['id',_0xb871('0xb6')],'raw':!![]})[_0xb871('0x12')](handleEntityNotFound(_0x59f846,null))[_0xb871('0x12')](function(_0x258e2f){if(_0x258e2f){if(_[_0xb871('0x65')](_0x258e2f[_0xb871('0xb6')])){return _0x59f846['download'](_0x1ef157);}else{if(!fs[_0xb871('0xba')](path[_0xb871('0xbb')](config[_0xb871('0xbc')],_0xb871('0xbd'),_0x258e2f[_0xb871('0xb6')]))){return _0x59f846['download'](_0x1ef157);}return _0x59f846[_0xb871('0xbe')](path[_0xb871('0xbb')](config['root'],_0xb871('0xbd'),_0x258e2f[_0xb871('0xb6')]));}}})[_0xb871('0x1d')](handleError(_0x59f846,null));};exports[_0xb871('0xbf')]=function(_0x4c2cab,_0x575943){return db[_0xb871('0x35')][_0xb871('0x30')]({'where':{'id':_0x4c2cab['params']['id']},'attributes':['id']})[_0xb871('0x12')](handleEntityNotFound(_0x575943,null))['then'](function(_0x295450){var _0x4aaebb=[];values=_0x295450[_0xb871('0x4a')];_0x4aaebb['push'](get_open_tabs(_0xb871('0x49'),_0x295450[_0xb871('0x4a')]));_0x4aaebb[_0xb871('0x46')](get_open_tabs('sms',_0x295450[_0xb871('0x4a')]));_0x4aaebb[_0xb871('0x46')](get_open_tabs('openchannel',_0x295450[_0xb871('0x4a')]));_0x4aaebb[_0xb871('0x46')](get_open_tabs('whatsapp',_0x295450[_0xb871('0x4a')]));_0x4aaebb['push'](get_open_tabs(_0xb871('0x4c'),_0x295450[_0xb871('0x4a')]));_0x4aaebb[_0xb871('0x46')](get_open_tabs(_0xb871('0x4d'),_0x295450[_0xb871('0x4a')]));return BPromise[_0xb871('0x50')](_0x4aaebb);})[_0xb871('0x12')](function(_0x3d08d8){if(_0x3d08d8){var _0x2c757e=_[_0xb871('0x2d')](values[_0xb871('0xc0')],function(_0x164a1d){return{'channel':'CHAT','id':_0x164a1d['id'],'createdAt':_0x164a1d['createdAt']};});var _0x10186b=_[_0xb871('0x2d')](values[_0xb871('0xc1')],function(_0x15c872){return{'channel':_0xb871('0xc2'),'id':_0x15c872['id'],'createdAt':_0x15c872['createdAt']};});var _0x149238=_['map'](values[_0xb871('0xc3')],function(_0x3ab063){return{'channel':_0xb871('0xc4'),'id':_0x3ab063['id'],'createdAt':_0x3ab063[_0xb871('0xc5')]};});var _0x3b1c69=_[_0xb871('0x2d')](values[_0xb871('0xc6')],function(_0x302f62){return{'channel':_0xb871('0xc7'),'id':_0x302f62['id'],'createdAt':_0x302f62['createdAt']};});var _0x72fb44=_[_0xb871('0x2d')](values[_0xb871('0xc8')],function(_0x15efaf){return{'channel':_0xb871('0xc9'),'id':_0x15efaf['id'],'createdAt':_0x15efaf[_0xb871('0xc5')]};});var _0x580973=_[_0xb871('0x2d')](values[_0xb871('0xca')],function(_0x56ca7b){return{'channel':_0xb871('0xcb'),'id':_0x56ca7b['id'],'createdAt':_0x56ca7b[_0xb871('0xc5')]};});var _0xb77774=_['concat'](_0x2c757e,_0x10186b,_0x149238,_0x3b1c69,_0x72fb44,_0x580973);var _0x33d63b={'count':_0xb77774[_0xb871('0x58')],'rows':_0xb77774};return _0x33d63b;}else return null;})[_0xb871('0x12')](respondWithResult(_0x575943,null))[_0xb871('0x1d')](handleError(_0x575943,null));};exports[_0xb871('0xcc')]=function(_0x595931,_0x28bd1e){var _0x19a3a5={};var _0x87020f={};var _0x4a7988;var _0x598d75;return db[_0xb871('0x35')]['findOne']({'where':{'id':_0x595931['params']['id']}})[_0xb871('0x12')](handleEntityNotFound(_0x28bd1e,null))[_0xb871('0x12')](function(_0x97d5a9){if(_0x97d5a9){_0x4a7988=_0x97d5a9;_0x87020f[_0xb871('0x56')]=_['keys'](db['CmContact'][_0xb871('0x36')]);_0x87020f[_0xb871('0x3f')]=_['keys'](_0x595931['query']);_0x87020f[_0xb871('0x54')]=_[_0xb871('0x55')](_0x87020f[_0xb871('0x56')],_0x87020f['query']);_0x19a3a5[_0xb871('0x45')]=_['intersection'](_0x87020f[_0xb871('0x56')],qs['fields'](_0x595931[_0xb871('0x3f')][_0xb871('0x57')]));_0x19a3a5['attributes']=_0x19a3a5[_0xb871('0x45')][_0xb871('0x58')]?_0x19a3a5[_0xb871('0x45')]:_0x87020f[_0xb871('0x56')];_0x19a3a5[_0xb871('0xcd')]=qs[_0xb871('0xce')](_0x595931[_0xb871('0x3f')][_0xb871('0xce')]);_0x19a3a5['where']=qs[_0xb871('0x54')](_[_0xb871('0xcf')](_0x595931[_0xb871('0x3f')],_0x87020f['filters']));if(_0x595931[_0xb871('0x3f')][_0xb871('0x2b')]){_0x19a3a5[_0xb871('0x3d')]=_[_0xb871('0xd0')](_0x19a3a5[_0xb871('0x3d')],{'$or':_['map'](_0x19a3a5['attributes'],function(_0x34bc60){var _0x1608e2={};_0x1608e2[_0x34bc60]={'$like':'%'+_0x595931[_0xb871('0x3f')][_0xb871('0x2b')]+'%'};return _0x1608e2;})});}_0x19a3a5=_[_0xb871('0xd0')]({},_0x19a3a5,_0x595931[_0xb871('0x59')]);return _0x4a7988['getContacts'](_0x19a3a5);}})[_0xb871('0x12')](function(_0x28a305){if(_0x28a305){_0x598d75=_0x28a305[_0xb871('0x58')];if(_0x595931['query'][_0xb871('0xd1')](_0xb871('0x40'))){_0x19a3a5['include']=[{'model':db[_0xb871('0xd2')],'as':'List','required':![]},{'model':db[_0xb871('0xd3')],'as':_0xb871('0xd4'),'attributes':['id',_0xb871('0x32'),_0xb871('0xd5')],'where':_0x595931[_0xb871('0x3f')][_0xb871('0xd6')]?{'id':_0x595931[_0xb871('0x3f')][_0xb871('0xd6')]}:undefined,'required':_0x595931['query'][_0xb871('0xd6')]?!![]:![]}];}if(!_0x595931[_0xb871('0x3f')]['hasOwnProperty'](_0xb871('0xd7'))){_0x19a3a5[_0xb871('0x22')]=qs[_0xb871('0x22')](_0x595931[_0xb871('0x3f')]['limit']);_0x19a3a5['offset']=qs['offset'](_0x595931[_0xb871('0x3f')][_0xb871('0x21')]);}return _0x4a7988[_0xb871('0xcc')](_0x19a3a5);}})[_0xb871('0x12')](function(_0x2e1ea2){if(_0x2e1ea2){return _0x2e1ea2?{'count':_0x598d75,'rows':_0x2e1ea2}:null;}})['then'](respondWithResult(_0x28bd1e,null))[_0xb871('0x1d')](handleError(_0x28bd1e,null));};exports['getQueues']=function(_0x13c9e8,_0x5adfb2){var _0x30c664;var _0x232c34={};var _0x46276e;return db[_0xb871('0x35')][_0xb871('0x96')]({'where':{'id':_0x13c9e8[_0xb871('0x5d')]['id']},'attributes':['id','name','role']})['then'](handleEntityNotFound(_0x5adfb2,null))[_0xb871('0x12')](function(_0x1d77ad){if(!utils[_0xb871('0x9d')](_0x13c9e8[_0xb871('0x3f')][_0xb871('0xb0')])){throw new db[(_0xb871('0x91'))][(_0xb871('0x92'))]('Unknown\x20channel');}_0x30c664=_0x1d77ad;var _0x3d4d59={};_0x3d4d59['model']=_[_0xb871('0x53')](db[_['capitalize'](_0x13c9e8['query']['channel'])+_0xb871('0xd8')][_0xb871('0x36')]);_0x3d4d59['query']=_[_0xb871('0x53')](_0x13c9e8[_0xb871('0x3f')]);_0x3d4d59[_0xb871('0x54')]=_['intersection'](_0x3d4d59[_0xb871('0x56')],_0x3d4d59[_0xb871('0x3f')]);_0x232c34[_0xb871('0x45')]=_['intersection'](_0x3d4d59[_0xb871('0x56')],qs[_0xb871('0x57')](_0x13c9e8['query'][_0xb871('0x57')]));_0x232c34[_0xb871('0x45')]=_0x232c34[_0xb871('0x45')][_0xb871('0x58')]?_0x232c34[_0xb871('0x45')]:_0x3d4d59[_0xb871('0x56')];_0x232c34['order']=qs[_0xb871('0xce')](_0x13c9e8['query'][_0xb871('0xce')]);_0x232c34['where']=qs['filters'](_[_0xb871('0xcf')](_0x13c9e8['query'],_0x3d4d59['filters']));if(_0x13c9e8[_0xb871('0x3f')][_0xb871('0x2b')]){_0x232c34[_0xb871('0x3d')]=_[_0xb871('0xd0')](_0x232c34[_0xb871('0x3d')],{'$or':_[_0xb871('0x2d')](_0x232c34[_0xb871('0x45')],function(_0x389976){var _0x3e0232={};_0x3e0232[_0x389976]={'$like':'%'+_0x13c9e8[_0xb871('0x3f')]['filter']+'%'};return _0x3e0232;})});}_0x232c34=_[_0xb871('0xd0')]({},_0x232c34,_0x13c9e8[_0xb871('0x59')]);switch(_0x30c664[_0xb871('0x27')]){case _0xb871('0x7b'):return db[_[_0xb871('0xa3')](_0x13c9e8['query'][_0xb871('0xb0')])+_0xb871('0xd8')][_0xb871('0x89')](_0x232c34);case _0xb871('0x7a'):case'agent':return _0x30c664[_0xb871('0xa7')+_['capitalize'](_0x13c9e8[_0xb871('0x3f')][_0xb871('0xb0')])+_0xb871('0xd9')](_0x232c34);default:throw new db[(_0xb871('0x91'))]['ValidationError'](_0xb871('0xda'));}})[_0xb871('0x12')](function(_0x5b3f3e){_0x46276e=_0x5b3f3e[_0xb871('0x58')];if(!_0x13c9e8[_0xb871('0x3f')][_0xb871('0xd1')]('nolimit')){_0x232c34[_0xb871('0x22')]=qs[_0xb871('0x22')](_0x13c9e8['query'][_0xb871('0x22')]);_0x232c34['offset']=qs[_0xb871('0x21')](_0x13c9e8[_0xb871('0x3f')][_0xb871('0x21')]);}switch(_0x30c664[_0xb871('0x27')]){case'admin':return db[_[_0xb871('0xa3')](_0x13c9e8[_0xb871('0x3f')][_0xb871('0xb0')])+_0xb871('0xd8')][_0xb871('0x89')](_0x232c34);case'user':case'agent':return _0x30c664['get'+_[_0xb871('0xa3')](_0x13c9e8['query'][_0xb871('0xb0')])+_0xb871('0xd9')](_0x232c34);}})['then'](function(_0x93684f){return{'count':_0x46276e,'rows':_0x93684f};})[_0xb871('0x12')](respondWithResult(_0x5adfb2,null))[_0xb871('0x1d')](handleError(_0x5adfb2,null));};exports[_0xb871('0xdb')]=function(_0x5cfc5f,_0x11626f){var _0x480b37={};var _0x245472={};var _0x591e88;var _0x510c30;return db[_0xb871('0x35')][_0xb871('0x96')]({'where':{'id':_0x5cfc5f[_0xb871('0x5d')]['id']}})[_0xb871('0x12')](handleEntityNotFound(_0x11626f,null))[_0xb871('0x12')](function(_0x652f48){if(_0x652f48){_0x591e88=_0x652f48;_0x245472[_0xb871('0x56')]=_[_0xb871('0x53')](db[_0xb871('0xad')]['rawAttributes']);_0x245472['query']=_[_0xb871('0x53')](_0x5cfc5f['query']);_0x245472[_0xb871('0x54')]=_['intersection'](_0x245472['model'],_0x245472['query']);_0x480b37['attributes']=_[_0xb871('0x55')](_0x245472['model'],qs[_0xb871('0x57')](_0x5cfc5f[_0xb871('0x3f')]['fields']));_0x480b37[_0xb871('0x45')]=_0x480b37[_0xb871('0x45')][_0xb871('0x58')]?_0x480b37[_0xb871('0x45')]:_0x245472['model'];_0x480b37['order']=qs[_0xb871('0xce')](_0x5cfc5f[_0xb871('0x3f')]['sort']);_0x480b37['where']=qs[_0xb871('0x54')](_[_0xb871('0xcf')](_0x5cfc5f[_0xb871('0x3f')],_0x245472[_0xb871('0x54')]));if(_0x5cfc5f[_0xb871('0x3f')][_0xb871('0x2b')]){_0x480b37['where']=_[_0xb871('0xd0')](_0x480b37[_0xb871('0x3d')],{'$or':_['map'](_0x480b37[_0xb871('0x45')],function(_0x55cb2e){var _0x59ed8b={};_0x59ed8b[_0x55cb2e]={'$like':'%'+_0x5cfc5f[_0xb871('0x3f')][_0xb871('0x2b')]+'%'};return _0x59ed8b;})});}_0x480b37=_['merge']({},_0x480b37,_0x5cfc5f[_0xb871('0x59')]);return _0x591e88[_0xb871('0xdb')](_0x480b37);}})['then'](function(_0xd17856){if(_0xd17856){_0x510c30=_0xd17856[_0xb871('0x58')];if(!_0x5cfc5f[_0xb871('0x3f')][_0xb871('0xd1')]('nolimit')){_0x480b37[_0xb871('0x22')]=qs[_0xb871('0x22')](_0x5cfc5f['query'][_0xb871('0x22')]);_0x480b37[_0xb871('0x21')]=qs[_0xb871('0x21')](_0x5cfc5f['query'][_0xb871('0x21')]);}return _0x591e88[_0xb871('0xdb')](_0x480b37);}})['then'](function(_0x3db5ae){if(_0x3db5ae){return _0x3db5ae?{'count':_0x510c30,'rows':_0x3db5ae}:null;}})['then'](respondWithResult(_0x11626f,null))[_0xb871('0x1d')](handleError(_0x11626f,null));};exports['getGroups']=function(_0x43e598,_0x2db198){var _0x1534eb={};var _0x389184={};var _0x4409be;var _0x3c0db2;return db[_0xb871('0x35')]['findOne']({'where':{'id':_0x43e598[_0xb871('0x5d')]['id']}})[_0xb871('0x12')](handleEntityNotFound(_0x2db198,null))[_0xb871('0x12')](function(_0x1767ae){if(_0x1767ae){_0x4409be=_0x1767ae;_0x389184['model']=_['keys'](db[_0xb871('0xdc')][_0xb871('0x36')]);_0x389184['query']=_[_0xb871('0x53')](_0x43e598['query']);_0x389184['filters']=_[_0xb871('0x55')](_0x389184[_0xb871('0x56')],_0x389184['query']);_0x1534eb[_0xb871('0x45')]=_['intersection'](_0x389184[_0xb871('0x56')],qs[_0xb871('0x57')](_0x43e598[_0xb871('0x3f')][_0xb871('0x57')]));_0x1534eb['attributes']=_0x1534eb['attributes']['length']?_0x1534eb[_0xb871('0x45')]:_0x389184[_0xb871('0x56')];_0x1534eb[_0xb871('0xcd')]=qs[_0xb871('0xce')](_0x43e598[_0xb871('0x3f')][_0xb871('0xce')]);_0x1534eb[_0xb871('0x3d')]=qs['filters'](_['pick'](_0x43e598[_0xb871('0x3f')],_0x389184[_0xb871('0x54')]));if(_0x43e598[_0xb871('0x3f')]['filter']){_0x1534eb[_0xb871('0x3d')]=_['merge'](_0x1534eb['where'],{'$or':_[_0xb871('0x2d')](_0x1534eb[_0xb871('0x45')],function(_0x20d519){var _0x5d982e={};_0x5d982e[_0x20d519]={'$like':'%'+_0x43e598[_0xb871('0x3f')][_0xb871('0x2b')]+'%'};return _0x5d982e;})});}_0x1534eb=_['merge']({},_0x1534eb,_0x43e598[_0xb871('0x59')]);return _0x4409be[_0xb871('0xdd')](_0x1534eb);}})[_0xb871('0x12')](function(_0xd78a3a){if(_0xd78a3a){_0x3c0db2=_0xd78a3a['length'];if(!_0x43e598[_0xb871('0x3f')]['hasOwnProperty']('nolimit')){_0x1534eb[_0xb871('0x22')]=qs[_0xb871('0x22')](_0x43e598[_0xb871('0x3f')][_0xb871('0x22')]);_0x1534eb['offset']=qs[_0xb871('0x21')](_0x43e598[_0xb871('0x3f')][_0xb871('0x21')]);}return _0x4409be[_0xb871('0xdd')](_0x1534eb);}})[_0xb871('0x12')](function(_0x3b5ffc){if(_0x3b5ffc){return _0x3b5ffc?{'count':_0x3c0db2,'rows':_0x3b5ffc}:null;}})[_0xb871('0x12')](respondWithResult(_0x2db198,null))[_0xb871('0x1d')](handleError(_0x2db198,null));};exports[_0xb871('0xde')]=function(_0x2adfb5,_0x2d47a6){var _0x3fe063={'raw':!![],'where':{}};var _0x121692={};var _0x265931={'count':0x0,'rows':[]};return db[_0xb871('0x35')][_0xb871('0x96')]({'where':{'id':_0x2adfb5[_0xb871('0x5d')]['id']}})[_0xb871('0x12')](handleEntityNotFound(_0x2d47a6,null))[_0xb871('0x12')](function(_0xc9980f){if(_0xc9980f){_0x121692[_0xb871('0x56')]=_[_0xb871('0x53')](db[_0xb871('0xdf')][_0xb871('0x36')]);_0x121692[_0xb871('0x3f')]=_[_0xb871('0x53')](_0x2adfb5[_0xb871('0x3f')]);_0x121692[_0xb871('0x54')]=_[_0xb871('0x55')](_0x121692[_0xb871('0x56')],_0x121692[_0xb871('0x3f')]);_0x3fe063[_0xb871('0x45')]=_[_0xb871('0x55')](_0x121692[_0xb871('0x56')],qs['fields'](_0x2adfb5[_0xb871('0x3f')][_0xb871('0x57')]));_0x3fe063['attributes']=_0x3fe063['attributes'][_0xb871('0x58')]?_0x3fe063[_0xb871('0x45')]:_0x121692[_0xb871('0x56')];if(!_0x2adfb5[_0xb871('0x3f')][_0xb871('0xd1')](_0xb871('0xd7'))){_0x3fe063[_0xb871('0x22')]=qs[_0xb871('0x22')](_0x2adfb5[_0xb871('0x3f')][_0xb871('0x22')]);_0x3fe063[_0xb871('0x21')]=qs[_0xb871('0x21')](_0x2adfb5[_0xb871('0x3f')]['offset']);}_0x3fe063[_0xb871('0xcd')]=qs[_0xb871('0xce')](_0x2adfb5[_0xb871('0x3f')][_0xb871('0xce')]);_0x3fe063[_0xb871('0x3d')]=qs[_0xb871('0x54')](_[_0xb871('0xcf')](_0x2adfb5[_0xb871('0x3f')],_0x121692[_0xb871('0x54')]));_0x3fe063[_0xb871('0x3d')]['UserId']=_0xc9980f['id'];if(_0x2adfb5[_0xb871('0x3f')]['filter']){_0x3fe063[_0xb871('0x3d')]=_[_0xb871('0xd0')](_0x3fe063['where'],{'$or':_['map'](_0x3fe063['attributes'],function(_0x5b2c7c){var _0x5936c8={};_0x5936c8[_0x5b2c7c]={'$like':'%'+_0x2adfb5['query'][_0xb871('0x2b')]+'%'};return _0x5936c8;})});}_0x3fe063=_[_0xb871('0xd0')]({},_0x3fe063,_0x2adfb5[_0xb871('0x59')]);return db[_0xb871('0xdf')][_0xb871('0x3e')]({'where':_0x3fe063[_0xb871('0x3d')]})[_0xb871('0x12')](function(_0x364404){_0x265931['count']=_0x364404;if(_0x2adfb5[_0xb871('0x3f')]['includeAll']){_0x3fe063[_0xb871('0x41')]=[{'all':!![]}];}return db[_0xb871('0xdf')][_0xb871('0x89')](_0x3fe063);})[_0xb871('0x12')](function(_0x4c986a){_0x265931[_0xb871('0x48')]=_0x4c986a;return _0x265931;});}})[_0xb871('0x12')](respondWithFilteredResult(_0x2d47a6,_0x3fe063))[_0xb871('0x1d')](handleError(_0x2d47a6,null));};exports[_0xb871('0xe0')]=function(_0x45b6e5,_0x43a40){var _0x5564f0={'raw':!![],'where':{}};var _0x431ed6={};var _0x2c0f37={'count':0x0,'rows':[]};return db[_0xb871('0x35')][_0xb871('0x96')]({'where':{'id':_0x45b6e5[_0xb871('0x5d')]['id']}})[_0xb871('0x12')](handleEntityNotFound(_0x43a40,null))['then'](function(_0x2f3fdb){if(_0x2f3fdb){_0x431ed6[_0xb871('0x56')]=_[_0xb871('0x53')](db['ScreenRecording']['rawAttributes']);_0x431ed6[_0xb871('0x3f')]=_[_0xb871('0x53')](_0x45b6e5[_0xb871('0x3f')]);_0x431ed6[_0xb871('0x54')]=_['intersection'](_0x431ed6[_0xb871('0x56')],_0x431ed6[_0xb871('0x3f')]);_0x5564f0[_0xb871('0x45')]=_[_0xb871('0x55')](_0x431ed6['model'],qs[_0xb871('0x57')](_0x45b6e5[_0xb871('0x3f')][_0xb871('0x57')]));_0x5564f0[_0xb871('0x45')]=_0x5564f0[_0xb871('0x45')][_0xb871('0x58')]?_0x5564f0[_0xb871('0x45')]:_0x431ed6[_0xb871('0x56')];if(!_0x45b6e5['query'][_0xb871('0xd1')]('nolimit')){_0x5564f0[_0xb871('0x22')]=qs[_0xb871('0x22')](_0x45b6e5['query'][_0xb871('0x22')]);_0x5564f0[_0xb871('0x21')]=qs['offset'](_0x45b6e5[_0xb871('0x3f')][_0xb871('0x21')]);}_0x5564f0[_0xb871('0xcd')]=qs[_0xb871('0xce')](_0x45b6e5[_0xb871('0x3f')][_0xb871('0xce')]);_0x5564f0[_0xb871('0x3d')]=qs[_0xb871('0x54')](_[_0xb871('0xcf')](_0x45b6e5[_0xb871('0x3f')],_0x431ed6[_0xb871('0x54')]));_0x5564f0[_0xb871('0x3d')][_0xb871('0xe1')]=_0x2f3fdb['id'];if(_0x45b6e5[_0xb871('0x3f')][_0xb871('0x2b')]){_0x5564f0[_0xb871('0x3d')]=_['merge'](_0x5564f0[_0xb871('0x3d')],{'$or':_['map'](_0x5564f0[_0xb871('0x45')],function(_0x54902b){var _0x50a6a8={};_0x50a6a8[_0x54902b]={'$like':'%'+_0x45b6e5[_0xb871('0x3f')][_0xb871('0x2b')]+'%'};return _0x50a6a8;})});}_0x5564f0=_[_0xb871('0xd0')]({},_0x5564f0,_0x45b6e5['options']);return db['ScreenRecording']['count']({'where':_0x5564f0[_0xb871('0x3d')]})[_0xb871('0x12')](function(_0x28972a){_0x2c0f37[_0xb871('0x3e')]=_0x28972a;if(_0x45b6e5['query'][_0xb871('0x40')]){_0x5564f0[_0xb871('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xb871('0x89')](_0x5564f0);})['then'](function(_0x155540){_0x2c0f37[_0xb871('0x48')]=_0x155540;return _0x2c0f37;});}})[_0xb871('0x12')](respondWithFilteredResult(_0x43a40,_0x5564f0))['catch'](handleError(_0x43a40,null));};exports[_0xb871('0xe2')]=function(_0x68f4c3,_0xa794ed){var _0x58d8de={};var _0x1cb6ff={};var _0x58ecfb;var _0x3a3bd3;return db[_0xb871('0x35')][_0xb871('0x96')]({'where':{'id':_0x68f4c3[_0xb871('0x5d')]['id']}})[_0xb871('0x12')](handleEntityNotFound(_0xa794ed,null))[_0xb871('0x12')](function(_0x3fa98b){if(_0x3fa98b){_0x58ecfb=_0x3fa98b;_0x1cb6ff[_0xb871('0x56')]=_[_0xb871('0x53')](db[_0xb871('0xe3')][_0xb871('0x36')]);_0x1cb6ff['query']=_[_0xb871('0x53')](_0x68f4c3[_0xb871('0x3f')]);_0x1cb6ff['filters']=_[_0xb871('0x55')](_0x1cb6ff['model'],_0x1cb6ff[_0xb871('0x3f')]);_0x58d8de[_0xb871('0x45')]=_[_0xb871('0x55')](_0x1cb6ff[_0xb871('0x56')],qs[_0xb871('0x57')](_0x68f4c3[_0xb871('0x3f')]['fields']));_0x58d8de[_0xb871('0x45')]=_0x58d8de[_0xb871('0x45')][_0xb871('0x58')]?_0x58d8de[_0xb871('0x45')]:_0x1cb6ff[_0xb871('0x56')];_0x58d8de[_0xb871('0xcd')]=qs[_0xb871('0xce')](_0x68f4c3[_0xb871('0x3f')][_0xb871('0xce')]);_0x58d8de[_0xb871('0x3d')]=qs[_0xb871('0x54')](_[_0xb871('0xcf')](_0x68f4c3['query'],_0x1cb6ff['filters']));if(_0x68f4c3['query']['filter']){_0x58d8de[_0xb871('0x3d')]=_[_0xb871('0xd0')](_0x58d8de[_0xb871('0x3d')],{'$or':_[_0xb871('0x2d')](_0x58d8de['attributes'],function(_0x4019fc){var _0x5bf58b={};_0x5bf58b[_0x4019fc]={'$like':'%'+_0x68f4c3['query']['filter']+'%'};return _0x5bf58b;})});}_0x58d8de=_[_0xb871('0xd0')]({},_0x58d8de,_0x68f4c3['options']);return _0x58ecfb[_0xb871('0xe2')](_0x58d8de);}})[_0xb871('0x12')](function(_0x435d7f){if(_0x435d7f){_0x3a3bd3=_0x435d7f[_0xb871('0x58')];if(!_0x68f4c3[_0xb871('0x3f')]['hasOwnProperty']('nolimit')){_0x58d8de[_0xb871('0x22')]=qs['limit'](_0x68f4c3[_0xb871('0x3f')][_0xb871('0x22')]);_0x58d8de['offset']=qs[_0xb871('0x21')](_0x68f4c3[_0xb871('0x3f')][_0xb871('0x21')]);}return _0x58ecfb[_0xb871('0xe2')](_0x58d8de);}})[_0xb871('0x12')](function(_0x24301b){if(_0x24301b){return _0x24301b?{'count':_0x3a3bd3,'rows':_0x24301b}:null;}})[_0xb871('0x12')](respondWithResult(_0xa794ed,null))[_0xb871('0x1d')](handleError(_0xa794ed,null));};exports[_0xb871('0xe4')]=function(_0x253d91,_0x201c83){var _0xcf508e={};var _0x4d115d={};var _0x5b4321;var _0xd5df76;return db['User'][_0xb871('0x96')]({'where':{'id':_0x253d91['params']['id']}})['then'](handleEntityNotFound(_0x201c83,null))[_0xb871('0x12')](function(_0x5bd910){if(_0x5bd910){_0x5b4321=_0x5bd910;_0x4d115d[_0xb871('0x56')]=_[_0xb871('0x53')](db[_0xb871('0xe5')][_0xb871('0x36')]);_0x4d115d['query']=_[_0xb871('0x53')](_0x253d91[_0xb871('0x3f')]);_0x4d115d[_0xb871('0x54')]=_[_0xb871('0x55')](_0x4d115d[_0xb871('0x56')],_0x4d115d[_0xb871('0x3f')]);_0xcf508e[_0xb871('0x45')]=_[_0xb871('0x55')](_0x4d115d[_0xb871('0x56')],qs['fields'](_0x253d91['query'][_0xb871('0x57')]));_0xcf508e[_0xb871('0x45')]=_0xcf508e['attributes'][_0xb871('0x58')]?_0xcf508e['attributes']:_0x4d115d[_0xb871('0x56')];_0xcf508e[_0xb871('0xcd')]=qs[_0xb871('0xce')](_0x253d91[_0xb871('0x3f')][_0xb871('0xce')]);_0xcf508e[_0xb871('0x3d')]=qs[_0xb871('0x54')](_['pick'](_0x253d91['query'],_0x4d115d[_0xb871('0x54')]));if(_0x253d91[_0xb871('0x3f')][_0xb871('0x2b')]){_0xcf508e[_0xb871('0x3d')]=_[_0xb871('0xd0')](_0xcf508e['where'],{'$or':_['map'](_0xcf508e[_0xb871('0x45')],function(_0x13436f){var _0x21c8b6={};_0x21c8b6[_0x13436f]={'$like':'%'+_0x253d91[_0xb871('0x3f')][_0xb871('0x2b')]+'%'};return _0x21c8b6;})});}_0xcf508e=_[_0xb871('0xd0')]({},_0xcf508e,_0x253d91[_0xb871('0x59')]);return _0x5b4321[_0xb871('0xe4')](_0xcf508e);}})[_0xb871('0x12')](function(_0x3516f1){if(_0x3516f1){_0xd5df76=_0x3516f1[_0xb871('0x58')];if(!_0x253d91[_0xb871('0x3f')][_0xb871('0xd1')]('nolimit')){_0xcf508e[_0xb871('0x22')]=qs['limit'](_0x253d91[_0xb871('0x3f')][_0xb871('0x22')]);_0xcf508e[_0xb871('0x21')]=qs[_0xb871('0x21')](_0x253d91[_0xb871('0x3f')][_0xb871('0x21')]);}return _0x5b4321[_0xb871('0xe4')](_0xcf508e);}})[_0xb871('0x12')](function(_0x22605b){if(_0x22605b){return _0x22605b?{'count':_0xd5df76,'rows':_0x22605b}:null;}})[_0xb871('0x12')](respondWithResult(_0x201c83,null))['catch'](handleError(_0x201c83,null));};exports['getMailInteractions']=function(_0x2f0103,_0x5e3200){var _0xa9663f={'raw':!![],'where':{}};var _0x1fd1db={};var _0x468d72={'count':0x0,'rows':[]};return db['User'][_0xb871('0x96')]({'where':{'id':_0x2f0103[_0xb871('0x5d')]['id']}})[_0xb871('0x12')](handleEntityNotFound(_0x5e3200,null))[_0xb871('0x12')](function(_0x217575){if(_0x217575){_0x1fd1db[_0xb871('0x56')]=_[_0xb871('0x53')](db[_0xb871('0xe6')]['rawAttributes']);_0x1fd1db[_0xb871('0x3f')]=_[_0xb871('0x53')](_0x2f0103[_0xb871('0x3f')]);_0x1fd1db[_0xb871('0x54')]=_[_0xb871('0x55')](_0x1fd1db[_0xb871('0x56')],_0x1fd1db[_0xb871('0x3f')]);_0xa9663f['attributes']=_[_0xb871('0x55')](_0x1fd1db[_0xb871('0x56')],qs[_0xb871('0x57')](_0x2f0103['query'][_0xb871('0x57')]));_0xa9663f[_0xb871('0x45')]=_0xa9663f[_0xb871('0x45')][_0xb871('0x58')]?_0xa9663f[_0xb871('0x45')]:_0x1fd1db[_0xb871('0x56')];if(!_0x2f0103['query'][_0xb871('0xd1')](_0xb871('0xd7'))){_0xa9663f[_0xb871('0x22')]=qs[_0xb871('0x22')](_0x2f0103[_0xb871('0x3f')][_0xb871('0x22')]);_0xa9663f['offset']=qs[_0xb871('0x21')](_0x2f0103[_0xb871('0x3f')][_0xb871('0x21')]);}_0xa9663f['order']=qs[_0xb871('0xce')](_0x2f0103[_0xb871('0x3f')][_0xb871('0xce')]);_0xa9663f[_0xb871('0x3d')]=qs['filters'](_[_0xb871('0xcf')](_0x2f0103['query'],_0x1fd1db[_0xb871('0x54')]));_0xa9663f['where']['UserId']=_0x217575['id'];if(_0x2f0103[_0xb871('0x3f')]['filter']){_0xa9663f[_0xb871('0x3d')]=_[_0xb871('0xd0')](_0xa9663f['where'],{'$or':_[_0xb871('0x2d')](_0xa9663f[_0xb871('0x45')],function(_0x2464b1){var _0x1995e0={};_0x1995e0[_0x2464b1]={'$like':'%'+_0x2f0103[_0xb871('0x3f')]['filter']+'%'};return _0x1995e0;})});}_0xa9663f=_[_0xb871('0xd0')]({},_0xa9663f,_0x2f0103[_0xb871('0x59')]);return db[_0xb871('0xe6')]['count']({'where':_0xa9663f['where']})[_0xb871('0x12')](function(_0x354e5e){_0x468d72[_0xb871('0x3e')]=_0x354e5e;if(_0x2f0103[_0xb871('0x3f')][_0xb871('0x40')]){_0xa9663f[_0xb871('0x41')]=[{'all':!![]}];}return db[_0xb871('0xe6')][_0xb871('0x89')](_0xa9663f);})['then'](function(_0x1fe1c1){_0x468d72[_0xb871('0x48')]=_0x1fe1c1;return _0x468d72;});}})[_0xb871('0x12')](respondWithFilteredResult(_0x5e3200,_0xa9663f))[_0xb871('0x1d')](handleError(_0x5e3200,null));};exports[_0xb871('0xe7')]=function(_0x235ee1,_0x3b193d){var _0x58c274={};var _0xf705bc={};var _0x4219b7;var _0x4feb24;return db[_0xb871('0x35')][_0xb871('0x96')]({'where':{'id':_0x235ee1[_0xb871('0x5d')]['id']}})[_0xb871('0x12')](handleEntityNotFound(_0x3b193d,null))[_0xb871('0x12')](function(_0x47f74c){if(_0x47f74c){_0x4219b7=_0x47f74c;_0xf705bc['model']=_[_0xb871('0x53')](db[_0xb871('0xe8')]['rawAttributes']);_0xf705bc[_0xb871('0x3f')]=_[_0xb871('0x53')](_0x235ee1['query']);_0xf705bc[_0xb871('0x54')]=_[_0xb871('0x55')](_0xf705bc[_0xb871('0x56')],_0xf705bc[_0xb871('0x3f')]);_0x58c274[_0xb871('0x45')]=_[_0xb871('0x55')](_0xf705bc[_0xb871('0x56')],qs['fields'](_0x235ee1[_0xb871('0x3f')][_0xb871('0x57')]));_0x58c274['attributes']=_0x58c274['attributes'][_0xb871('0x58')]?_0x58c274[_0xb871('0x45')]:_0xf705bc[_0xb871('0x56')];_0x58c274['order']=qs[_0xb871('0xce')](_0x235ee1[_0xb871('0x3f')][_0xb871('0xce')]);_0x58c274[_0xb871('0x3d')]=qs[_0xb871('0x54')](_[_0xb871('0xcf')](_0x235ee1[_0xb871('0x3f')],_0xf705bc[_0xb871('0x54')]));if(_0x235ee1[_0xb871('0x3f')][_0xb871('0x2b')]){_0x58c274['where']=_['merge'](_0x58c274['where'],{'$or':_[_0xb871('0x2d')](_0x58c274[_0xb871('0x45')],function(_0x29cbec){var _0x506f37={};_0x506f37[_0x29cbec]={'$like':'%'+_0x235ee1[_0xb871('0x3f')][_0xb871('0x2b')]+'%'};return _0x506f37;})});}_0x58c274=_[_0xb871('0xd0')]({},_0x58c274,_0x235ee1[_0xb871('0x59')]);return _0x4219b7['getSmsInteractions'](_0x58c274);}})['then'](function(_0x25de78){if(_0x25de78){_0x4feb24=_0x25de78[_0xb871('0x58')];if(!_0x235ee1[_0xb871('0x3f')][_0xb871('0xd1')](_0xb871('0xd7'))){_0x58c274[_0xb871('0x22')]=qs['limit'](_0x235ee1[_0xb871('0x3f')][_0xb871('0x22')]);_0x58c274[_0xb871('0x21')]=qs[_0xb871('0x21')](_0x235ee1[_0xb871('0x3f')][_0xb871('0x21')]);}return _0x4219b7[_0xb871('0xe7')](_0x58c274);}})['then'](function(_0x4d893c){if(_0x4d893c){return _0x4d893c?{'count':_0x4feb24,'rows':_0x4d893c}:null;}})[_0xb871('0x12')](respondWithResult(_0x3b193d,null))['catch'](handleError(_0x3b193d,null));};exports[_0xb871('0xe9')]=function(_0xf1aeb7,_0x282132){var _0x1a447c={};var _0x24df43={};var _0x108744;var _0x474528;return db['User'][_0xb871('0x96')]({'where':{'id':_0xf1aeb7[_0xb871('0x5d')]['id']}})[_0xb871('0x12')](handleEntityNotFound(_0x282132,null))[_0xb871('0x12')](function(_0x100682){if(_0x100682){_0x108744=_0x100682;_0x24df43[_0xb871('0x56')]=_['keys'](db[_0xb871('0xea')]['rawAttributes']);_0x24df43[_0xb871('0x3f')]=_[_0xb871('0x53')](_0xf1aeb7[_0xb871('0x3f')]);_0x24df43[_0xb871('0x54')]=_['intersection'](_0x24df43[_0xb871('0x56')],_0x24df43[_0xb871('0x3f')]);_0x1a447c[_0xb871('0x45')]=_[_0xb871('0x55')](_0x24df43[_0xb871('0x56')],qs[_0xb871('0x57')](_0xf1aeb7[_0xb871('0x3f')][_0xb871('0x57')]));_0x1a447c[_0xb871('0x45')]=_0x1a447c['attributes'][_0xb871('0x58')]?_0x1a447c[_0xb871('0x45')]:_0x24df43[_0xb871('0x56')];_0x1a447c['order']=qs[_0xb871('0xce')](_0xf1aeb7[_0xb871('0x3f')][_0xb871('0xce')]);_0x1a447c['where']=qs[_0xb871('0x54')](_[_0xb871('0xcf')](_0xf1aeb7[_0xb871('0x3f')],_0x24df43['filters']));if(_0xf1aeb7[_0xb871('0x3f')][_0xb871('0x2b')]){_0x1a447c['where']=_[_0xb871('0xd0')](_0x1a447c[_0xb871('0x3d')],{'$or':_[_0xb871('0x2d')](_0x1a447c['attributes'],function(_0x333e63){var _0x4c5ec0={};_0x4c5ec0[_0x333e63]={'$like':'%'+_0xf1aeb7['query'][_0xb871('0x2b')]+'%'};return _0x4c5ec0;})});}_0x1a447c=_[_0xb871('0xd0')]({},_0x1a447c,_0xf1aeb7[_0xb871('0x59')]);return _0x108744[_0xb871('0xe9')](_0x1a447c);}})[_0xb871('0x12')](function(_0x4b0c85){if(_0x4b0c85){_0x474528=_0x4b0c85[_0xb871('0x58')];if(!_0xf1aeb7[_0xb871('0x3f')][_0xb871('0xd1')](_0xb871('0xd7'))){_0x1a447c[_0xb871('0x22')]=qs[_0xb871('0x22')](_0xf1aeb7['query'][_0xb871('0x22')]);_0x1a447c['offset']=qs[_0xb871('0x21')](_0xf1aeb7[_0xb871('0x3f')][_0xb871('0x21')]);}return _0x108744['getFaxInteractions'](_0x1a447c);}})['then'](function(_0x72612d){if(_0x72612d){return _0x72612d?{'count':_0x474528,'rows':_0x72612d}:null;}})[_0xb871('0x12')](respondWithResult(_0x282132,null))['catch'](handleError(_0x282132,null));};exports[_0xb871('0xeb')]=function(_0x2f8ac3,_0xa5f661){var _0x4b77fc={};var _0x56af12={};var _0x26b4aa;var _0x5a0a8d;return db['User']['findOne']({'where':{'id':_0x2f8ac3[_0xb871('0x5d')]['id']}})[_0xb871('0x12')](handleEntityNotFound(_0xa5f661,null))['then'](function(_0x40957c){if(_0x40957c){_0x26b4aa=_0x40957c;_0x56af12[_0xb871('0x56')]=_[_0xb871('0x53')](db[_0xb871('0xec')][_0xb871('0x36')]);_0x56af12[_0xb871('0x3f')]=_['keys'](_0x2f8ac3[_0xb871('0x3f')]);_0x56af12[_0xb871('0x54')]=_['intersection'](_0x56af12[_0xb871('0x56')],_0x56af12['query']);_0x4b77fc[_0xb871('0x45')]=_['intersection'](_0x56af12[_0xb871('0x56')],qs[_0xb871('0x57')](_0x2f8ac3[_0xb871('0x3f')][_0xb871('0x57')]));_0x4b77fc[_0xb871('0x45')]=_0x4b77fc['attributes'][_0xb871('0x58')]?_0x4b77fc[_0xb871('0x45')]:_0x56af12[_0xb871('0x56')];_0x4b77fc['order']=qs[_0xb871('0xce')](_0x2f8ac3[_0xb871('0x3f')][_0xb871('0xce')]);_0x4b77fc[_0xb871('0x3d')]=qs['filters'](_[_0xb871('0xcf')](_0x2f8ac3[_0xb871('0x3f')],_0x56af12[_0xb871('0x54')]));if(_0x2f8ac3['query']['filter']){_0x4b77fc['where']=_[_0xb871('0xd0')](_0x4b77fc[_0xb871('0x3d')],{'$or':_[_0xb871('0x2d')](_0x4b77fc[_0xb871('0x45')],function(_0xb02f43){var _0x503158={};_0x503158[_0xb02f43]={'$like':'%'+_0x2f8ac3[_0xb871('0x3f')][_0xb871('0x2b')]+'%'};return _0x503158;})});}_0x4b77fc=_[_0xb871('0xd0')]({},_0x4b77fc,_0x2f8ac3['options']);return _0x26b4aa[_0xb871('0xeb')](_0x4b77fc);}})[_0xb871('0x12')](function(_0x49c487){if(_0x49c487){_0x5a0a8d=_0x49c487[_0xb871('0x58')];if(!_0x2f8ac3[_0xb871('0x3f')][_0xb871('0xd1')](_0xb871('0xd7'))){_0x4b77fc[_0xb871('0x22')]=qs[_0xb871('0x22')](_0x2f8ac3['query'][_0xb871('0x22')]);_0x4b77fc[_0xb871('0x21')]=qs['offset'](_0x2f8ac3['query'][_0xb871('0x21')]);}return _0x26b4aa[_0xb871('0xeb')](_0x4b77fc);}})['then'](function(_0x5d755e){if(_0x5d755e){return _0x5d755e?{'count':_0x5a0a8d,'rows':_0x5d755e}:null;}})[_0xb871('0x12')](respondWithResult(_0xa5f661,null))[_0xb871('0x1d')](handleError(_0xa5f661,null));};exports[_0xb871('0xed')]=function(_0x525bd1,_0x850a17,_0x2f7f42){var _0x7824eb;var _0x349494;var _0x1cd6b8;var _0x33b2dc=!_['isNil'](_0x525bd1['params']['id'])?_0x525bd1['params']['id']:!_[_0xb871('0x65')](_0x525bd1[_0xb871('0x7a')]['id'])?_0x525bd1[_0xb871('0x7a')]['id']:null;return db[_0xb871('0x35')]['find']({'where':{'id':_0x33b2dc,'role':{'$or':['admin',_0xb871('0x7a'),_0xb871('0x80')]}},'attributes':['id',_0xb871('0x32'),_0xb871('0xee'),_0xb871('0xef'),'role',_0xb871('0x60'),_0xb871('0x9b')]})[_0xb871('0x12')](function(_0x56fec7){if(_0x56fec7){if(_0x56fec7[_0xb871('0x27')]===_0xb871('0x80')){_0x7824eb=_0x56fec7;if(_0x525bd1[_0xb871('0x5a')][_0xb871('0xa9')]){_0x1cd6b8=util[_0xb871('0xaa')]('LOCAL/%s@from-sip/n',_0x7824eb[_0x525bd1[_0xb871('0x5a')][_0xb871('0xa9')]]);}else if(_0x525bd1[_0xb871('0x5a')]['intrf']){_0x1cd6b8=util[_0xb871('0xaa')](_0xb871('0xab'),_0x525bd1[_0xb871('0x5a')]['intrf']);}else{_0x1cd6b8=util[_0xb871('0xaa')](_0xb871('0xab'),_0x7824eb[_0xb871('0x32')]);}socket['to'](util[_0xb871('0xaa')]('user:%s',_0x7824eb[_0xb871('0x32')]))[_0xb871('0xb3')]('user:forcelogout',{'user':{'id':_0x7824eb['id'],'name':_0x7824eb['name']},'ip':_0x525bd1[_0xb871('0xf0')]['x-forwarded-for']||_0x525bd1['connection'][_0xb871('0xf1')]||_0x525bd1['socket'][_0xb871('0xf1')]||_0x525bd1[_0xb871('0xf2')][_0xb871('0xf3')][_0xb871('0xf1')]});return db['UserVoiceQueueRt'][_0xb871('0x31')]({'where':{'membername':_0x7824eb[_0xb871('0x32')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xb871('0x92'))](_0xb871('0xf4'));}})[_0xb871('0x12')](function(){if(_0x7824eb){return _0x7824eb[_0xb871('0xf5')]({'raw':!![]});}})['then'](function(_0x4fd3cb){if(_0x7824eb){var _0x55292f=[];if(_0x4fd3cb){_0x349494=_0x4fd3cb;if(_0x349494[_0xb871('0x58')]){for(var _0x398418=0x0;_0x398418<_0x349494[_0xb871('0x58')];_0x398418++){_0x55292f[_0xb871('0x46')]({'membername':_0x7824eb[_0xb871('0x32')],'UserId':_0x7824eb['id'],'queue_name':_0x349494[_0x398418][_0xb871('0x32')],'VoiceQueueId':_0x349494[_0x398418]['id'],'interface':_0x1cd6b8,'paused':_0x7824eb[_0xb871('0x9b')]||![],'penalty':_0x349494[_0x398418][_0xb871('0xf6')]||0x0});}return BPromise[_0xb871('0xac')](_0x55292f,function(_0x5617ce){return db[_0xb871('0xad')][_0xb871('0xae')](_0x5617ce);});}}}})[_0xb871('0x12')](function(){if(_0x7824eb){return db[_0xb871('0xf7')][_0xb871('0x89')]({'where':{'membername':_0x7824eb['name'],'exitAt':null}});}})[_0xb871('0x12')](function(_0x14f6f3){if(_0x7824eb){var _0x5aeaa0=[];_0x14f6f3[_0xb871('0xf8')](function(_0x410397){_0x5aeaa0[_0xb871('0x46')](_0x410397[_0xb871('0x26')]({'exitAt':moment()[_0xb871('0xaa')](_0xb871('0xf9'))}));});return BPromise[_0xb871('0x50')](_0x5aeaa0);}})['then'](function(){if(_0x7824eb){var _0x2d6450=[];var _0x24ef17=[];var _0x2c5693=utils[_0xb871('0xfa')]();var _0x463190={'membername':_0x7824eb[_0xb871('0x32')],'interface':_0x1cd6b8,'enterAt':moment()[_0xb871('0xaa')](_0xb871('0xf9')),'role':_0x7824eb[_0xb871('0x27')],'internal':_0x7824eb[_0xb871('0x60')]};_0x2c5693[_0xb871('0xf8')](function(_0x279d97){_0x2d6450['push'](_[_0xb871('0xd0')]({'channel':_0x279d97,'type':_0xb871('0xfb'),'data1':_0x525bd1['body'][_0xb871('0xfc')],'data2':_0x1cd6b8},_0x463190));if(_0x7824eb[_0xb871('0x9b')]){_0x24ef17[_0xb871('0x46')](_[_0xb871('0xd0')]({'channel':_0x279d97,'type':_0xb871('0xfd'),'data1':_0xb871('0xfe')},_0x463190));}});return db[_0xb871('0xf7')][_0xb871('0x84')](_0x2d6450[_0xb871('0xff')](_0x24ef17),{'individualHooks':!![]});}})['then'](function(){if(_0x7824eb){return _0x7824eb['update']({'online':!![],'lastLoginAt':moment()['format'](_0xb871('0xf9')),'voicePause':_0x7824eb[_0xb871('0x9b')]||![],'mailPause':_0x7824eb[_0xb871('0x9b')]||![],'chatPause':_0x7824eb[_0xb871('0x9b')]||![],'faxPause':_0x7824eb[_0xb871('0x9b')]||![],'smsPause':_0x7824eb[_0xb871('0x9b')]||![],'openchannelPause':_0x7824eb[_0xb871('0x9b')]||![],'whatsappPause':_0x7824eb[_0xb871('0x9b')]||![],'pauseType':_0x7824eb['loginInPause']?'LOGININPAUSE':null,'interface':_0x1cd6b8,'lastPauseAt':moment()['format'](_0xb871('0xf9'))});}})['then'](function(_0x6da9ef){if(_0x525bd1[_0xb871('0x100')]){return _0x2f7f42();}else{return BPromise['resolve'](_0x6da9ef)[_0xb871('0x12')](respondWithResult(_0x850a17,null));}})['catch'](handleError(_0x850a17,null));};exports[_0xb871('0x101')]=function(_0x34db13,_0x147cfc){var _0x1d41a6;return db[_0xb871('0x35')][_0xb871('0x30')]({'where':{'id':_0x34db13[_0xb871('0x5d')]['id'],'role':_0xb871('0x80')},'attributes':['id',_0xb871('0x32'),'role']})[_0xb871('0x12')](handleEntityNotFound(_0x147cfc,null))[_0xb871('0x12')](function(_0x260956){if(_0x260956){_0x1d41a6=_0x260956;return db[_0xb871('0xad')]['destroy']({'where':{'membername':_0x1d41a6[_0xb871('0x32')]},'individualHooks':!![]});}})[_0xb871('0x12')](function(){return db[_0xb871('0xf7')][_0xb871('0x89')]({'where':{'membername':_0x1d41a6['name'],'exitAt':null}});})[_0xb871('0x12')](function(_0x8865ea){var _0xe21318=[];_0x8865ea['forEach'](function(_0x170924){_0xe21318['push'](_0x170924['update']({'exitAt':moment()[_0xb871('0xaa')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xb871('0x50')](_0xe21318);})[_0xb871('0x12')](function(){return _0x1d41a6[_0xb871('0x26')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x147cfc,null))[_0xb871('0x1d')](handleError(_0x147cfc,null));};exports['pause']=function(_0x95e648,_0x33cbdc){var _0x3fe105;return db[_0xb871('0xad')][_0xb871('0x26')]({'paused':0x1},{'where':{'UserId':_0x95e648[_0xb871('0x5d')]['id']},'individualHooks':!![]})[_0xb871('0x12')](function(){return db[_0xb871('0x35')][_0xb871('0x30')]({'where':{'id':_0x95e648[_0xb871('0x5d')]['id'],'role':'agent'},'attributes':['id',_0xb871('0x32'),_0xb871('0x27'),_0xb871('0x60'),_0xb871('0xa9')]});})['then'](handleEntityNotFound(_0x33cbdc,null))[_0xb871('0x12')](function(_0x5abf5a){if(_0x5abf5a){_0x3fe105=_0x5abf5a;return respondWithRpcPromise('QueuePause',_0xb871('0x102'),{'id':_0x3fe105['id'],'name':_0x3fe105['name'],'pause':!![]});}})['then'](function(){if(_0x3fe105){return db['MemberReport'][_0xb871('0x89')]({'where':{'membername':_0x3fe105['name'],'type':_0xb871('0xfd'),'exitAt':null}});}})[_0xb871('0x12')](function(_0x2d2ac5){if(_0x2d2ac5[_0xb871('0x58')]){var _0xa05c1b=moment()[_0xb871('0xaa')](_0xb871('0xf9'));for(var _0x424700=0x0,_0x2bb726=_0x2d2ac5[_0xb871('0x58')];_0x424700<_0x2bb726;_0x424700++){_0x2d2ac5[_0x424700]['updateAttributes']({'exitAt':_0xa05c1b});}}})[_0xb871('0x12')](function(){var _0xe60de4=[];var _0x222a07=utils[_0xb871('0xfa')]();_0x222a07[_0xb871('0xf8')](function(_0x297707){_0xe60de4[_0xb871('0x46')]({'channel':_0x297707,'membername':_0x3fe105[_0xb871('0x32')],'interface':_[_0xb871('0x65')](_0x3fe105['interface'])?util[_0xb871('0xaa')](_0xb871('0xab'),_0x3fe105[_0xb871('0x32')]):_0x3fe105['interface'],'type':'PAUSE','enterAt':moment()[_0xb871('0xaa')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x95e648[_0xb871('0x5a')][_0xb871('0x38')]||_0xb871('0x103'),'role':_0x3fe105['role'],'internal':_0x3fe105[_0xb871('0x60')]});});return db['MemberReport'][_0xb871('0x84')](_0xe60de4,{'individualHooks':!![]});})[_0xb871('0x12')](function(){return _0x3fe105['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x95e648[_0xb871('0x5a')][_0xb871('0x38')]||_0xb871('0x103'),'lastPauseAt':moment()['format'](_0xb871('0xf9'))});})[_0xb871('0x12')](respondWithResult(_0x33cbdc,null))[_0xb871('0x1d')](handleError(_0x33cbdc,null));};exports[_0xb871('0x104')]=function(_0x45f25b,_0x9775b8){var _0x3d1ac9;return db['User'][_0xb871('0x30')]({'where':{'id':_0x45f25b['params']['id']},'attributes':['id',_0xb871('0x32'),'role',_0xb871('0x9c'),'mailPause',_0xb871('0x105'),_0xb871('0x106'),_0xb871('0x107'),_0xb871('0x108'),_0xb871('0x109'),'pauseType',_0xb871('0x10a')]})[_0xb871('0x12')](handleEntityNotFound(_0x9775b8,null))[_0xb871('0x12')](function(_0xf7d2f2){if(_0xf7d2f2){_0x3d1ac9=_0xf7d2f2;if(_0x45f25b[_0xb871('0x5a')][_0xb871('0xb0')]&&!utils[_0xb871('0x9d')](_0x45f25b[_0xb871('0x5a')]['channel'])){throw new db[(_0xb871('0x91'))][(_0xb871('0x92'))](_0xb871('0x9e'));}switch(_0x45f25b[_0xb871('0x5a')][_0xb871('0xb0')]){case'voice':return respondWithRpcPromise('QueuePause',_0xb871('0x104'),{'id':_0x3d1ac9['id'],'name':_0x3d1ac9[_0xb871('0x32')],'pause':![]})[_0xb871('0x12')](function(){return db[_0xb871('0xad')][_0xb871('0x26')]({'paused':0x0},{'where':{'UserId':_0x3d1ac9['id']},'individualHooks':!![]});})[_0xb871('0x12')](function(){return db[_0xb871('0xf7')][_0xb871('0x30')]({'where':{'channel':_0x45f25b['body'][_0xb871('0xb0')],'membername':_0x3d1ac9[_0xb871('0x32')],'type':_0xb871('0xfd'),'exitAt':null}});})[_0xb871('0x12')](function(_0x24226e){if(_0x24226e){return _0x24226e[_0xb871('0x26')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){return _0x3d1ac9[_0xb871('0x26')]({'voicePause':![]});});case'mail':case _0xb871('0x49'):case'fax':case'sms':case'whatsapp':case'openchannel':return db[_0xb871('0xf7')]['find']({'where':{'channel':_0x45f25b[_0xb871('0x5a')][_0xb871('0xb0')],'membername':_0x3d1ac9['name'],'type':_0xb871('0xfd'),'exitAt':null}})[_0xb871('0x12')](function(_0x530af1){if(_0x530af1){return _0x530af1[_0xb871('0x26')]({'exitAt':moment()[_0xb871('0xaa')](_0xb871('0xf9')),'data2':_0xb871('0x10b')},{'individualHooks':!![]});}return null;})[_0xb871('0x12')](function(){var _0x50346a={};_[_0xb871('0x24')](_0x50346a,util[_0xb871('0xaa')](_0xb871('0x10c'),_0x45f25b[_0xb871('0x5a')][_0xb871('0xb0')],_0xb871('0x10d')),![]);return _0x3d1ac9[_0xb871('0x26')](_0x50346a);});default:return respondWithRpcPromise(_0xb871('0x10e'),_0xb871('0x104'),{'id':_0x3d1ac9['id'],'name':_0x3d1ac9[_0xb871('0x32')],'pause':![]})[_0xb871('0x12')](function(){return db[_0xb871('0xad')][_0xb871('0x26')]({'paused':0x0},{'where':{'UserId':_0x3d1ac9['id']}});})[_0xb871('0x12')](function(){return db['MemberReport'][_0xb871('0x89')]({'where':{'membername':_0x3d1ac9[_0xb871('0x32')],'type':_0xb871('0xfd'),'exitAt':null}});})[_0xb871('0x12')](function(_0x2b6f6c){var _0x2c9416=[];_0x2b6f6c['forEach'](function(_0x5398c1){_0x2c9416[_0xb871('0x46')](_0x5398c1[_0xb871('0x26')]({'exitAt':moment()[_0xb871('0xaa')](_0xb871('0xf9')),'data2':_0xb871('0x10b')}));});return BPromise['all'](_0x2c9416);})[_0xb871('0x12')](function(){return _0x3d1ac9[_0xb871('0x26')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xb871('0x12')](respondWithResult(_0x9775b8,null))[_0xb871('0x1d')](handleError(_0x9775b8,null));};exports[_0xb871('0x10f')]=function(_0x18d63b,_0x2bd10e){var _0x18df2a={};var _0x4878b3={};var _0x58c5fa;var _0x1c751a;return db['User'][_0xb871('0x96')]({'where':{'id':_0x18d63b[_0xb871('0x5d')]['id']}})[_0xb871('0x12')](handleEntityNotFound(_0x2bd10e,null))[_0xb871('0x12')](function(_0x46d70b){if(_0x46d70b){_0x58c5fa=_0x46d70b;_0x4878b3[_0xb871('0x56')]=_[_0xb871('0x53')](db[_0xb871('0x110')][_0xb871('0x36')]);_0x4878b3[_0xb871('0x3f')]=_[_0xb871('0x53')](_0x18d63b['query']);_0x4878b3[_0xb871('0x54')]=_['intersection'](_0x4878b3[_0xb871('0x56')],_0x4878b3[_0xb871('0x3f')]);_0x18df2a[_0xb871('0x45')]=_['intersection'](_0x4878b3[_0xb871('0x56')],qs['fields'](_0x18d63b['query']['fields']));_0x18df2a[_0xb871('0x45')]=_0x18df2a[_0xb871('0x45')][_0xb871('0x58')]?_0x18df2a[_0xb871('0x45')]:_0x4878b3[_0xb871('0x56')];_0x18df2a[_0xb871('0xcd')]=qs['sort'](_0x18d63b['query']['sort']);_0x18df2a[_0xb871('0x3d')]=qs[_0xb871('0x54')](_[_0xb871('0xcf')](_0x18d63b['query'],_0x4878b3['filters']));if(_0x18d63b[_0xb871('0x3f')][_0xb871('0x2b')]){_0x18df2a[_0xb871('0x3d')]=_[_0xb871('0xd0')](_0x18df2a[_0xb871('0x3d')],{'$or':_[_0xb871('0x2d')](_0x18df2a['attributes'],function(_0x358108){var _0xb8401d={};_0xb8401d[_0x358108]={'$like':'%'+_0x18d63b[_0xb871('0x3f')][_0xb871('0x2b')]+'%'};return _0xb8401d;})});}_0x18df2a=_[_0xb871('0xd0')]({},_0x18df2a,_0x18d63b['options']);return _0x58c5fa[_0xb871('0x10f')](_0x18df2a);}})['then'](function(_0x3303ee){if(_0x3303ee){_0x1c751a=_0x3303ee[_0xb871('0x58')];if(!_0x18d63b[_0xb871('0x3f')][_0xb871('0xd1')](_0xb871('0xd7'))){_0x18df2a[_0xb871('0x22')]=qs['limit'](_0x18d63b[_0xb871('0x3f')]['limit']);_0x18df2a[_0xb871('0x21')]=qs[_0xb871('0x21')](_0x18d63b[_0xb871('0x3f')]['offset']);}return _0x58c5fa['getTeams'](_0x18df2a);}})[_0xb871('0x12')](function(_0x3184f9){if(_0x3184f9){return _0x3184f9?{'count':_0x1c751a,'rows':_0x3184f9}:null;}})['then'](respondWithResult(_0x2bd10e,null))[_0xb871('0x1d')](handleError(_0x2bd10e,null));};exports[_0xb871('0x111')]=function(_0x63f70e,_0x420cc4){return db['User'][_0xb871('0x30')]({'where':{'id':_0x63f70e['params']['id']}})[_0xb871('0x12')](handleEntityNotFound(_0x420cc4,null))[_0xb871('0x12')](function(_0x197e40){if(_0x197e40){var _0x1deb88=_0x197e40[_0xb871('0xa7')]({'plain':!![]});return _0x197e40['addTeams'](_0x63f70e[_0xb871('0x5a')][_0xb871('0x5e')],_[_0xb871('0x5f')](_0x63f70e[_0xb871('0x5a')],['ids','id'])||{})['then'](function(){for(var _0x47bb4e=0x0;_0x47bb4e<_0x63f70e[_0xb871('0x5a')][_0xb871('0x5e')]['length'];_0x47bb4e++){var _0x7191f=[];var _0x16db77={};db[_0xb871('0x110')]['findOne']({'where':{'id':_0x63f70e['body'][_0xb871('0x5e')][_0x47bb4e]}})['then'](function(_0x42e888){_0x16db77=_0x42e888['dataValues'];_0x7191f[_0xb871('0x46')](_0x42e888['getVoiceQueues']()[_0xb871('0x12')](function(_0x494387){for(var _0x59f0f7=0x0;_0x59f0f7<_0x494387[_0xb871('0x58')];_0x59f0f7++){_0x494387[_0x59f0f7][_0xb871('0x112')](_0xb871('0xb0'),_0xb871('0x113'));}return _0x494387;}));_0x7191f[_0xb871('0x46')](_0x42e888[_0xb871('0x114')]()['then'](function(_0x27ac70){for(var _0x1b1cf7=0x0;_0x1b1cf7<_0x27ac70[_0xb871('0x58')];_0x1b1cf7++){_0x27ac70[_0x1b1cf7][_0xb871('0x112')](_0xb871('0xb0'),_0xb871('0x115'));}return _0x27ac70;}));_0x7191f[_0xb871('0x46')](_0x42e888['getMailQueues']()[_0xb871('0x12')](function(_0x90dd95){for(var _0x4f3cf1=0x0;_0x4f3cf1<_0x90dd95[_0xb871('0x58')];_0x4f3cf1++){_0x90dd95[_0x4f3cf1][_0xb871('0x112')](_0xb871('0xb0'),_0xb871('0x116'));}return _0x90dd95;}));_0x7191f[_0xb871('0x46')](_0x42e888[_0xb871('0x117')]()[_0xb871('0x12')](function(_0x3453b3){for(var _0x22352a=0x0;_0x22352a<_0x3453b3['length'];_0x22352a++){_0x3453b3[_0x22352a]['setDataValue'](_0xb871('0xb0'),'Sms');}return _0x3453b3;}));_0x7191f[_0xb871('0x46')](_0x42e888[_0xb871('0x118')]()[_0xb871('0x12')](function(_0x460d90){for(var _0x2e225b=0x0;_0x2e225b<_0x460d90[_0xb871('0x58')];_0x2e225b++){_0x460d90[_0x2e225b]['setDataValue'](_0xb871('0xb0'),_0xb871('0x119'));}return _0x460d90;}));_0x7191f[_0xb871('0x46')](_0x42e888[_0xb871('0x11a')]()[_0xb871('0x12')](function(_0x49b5c4){for(var _0x568242=0x0;_0x568242<_0x49b5c4['length'];_0x568242++){_0x49b5c4[_0x568242][_0xb871('0x112')](_0xb871('0xb0'),_0xb871('0x11b'));}return _0x49b5c4;}));_0x7191f['push'](_0x42e888['getOpenchannelQueues']()['then'](function(_0x3c614d){for(var _0x745445=0x0;_0x745445<_0x3c614d['length'];_0x745445++){_0x3c614d[_0x745445][_0xb871('0x112')](_0xb871('0xb0'),_0xb871('0x11c'));}return _0x3c614d;}));return BPromise[_0xb871('0x50')](_0x7191f);})[_0xb871('0x12')](function(_0x220e8a){var _0x2d70c4=_[_0xb871('0x11d')](_0x220e8a);_0x7191f=[];return db[_0xb871('0x67')][_0xb871('0x11e')](function(_0x3c095e){for(var _0x5b419f=0x0;_0x5b419f<_0x2d70c4[_0xb871('0x58')];_0x5b419f++){_0x7191f[_0xb871('0x46')](_0x2d70c4[_0x5b419f][_0xb871('0x11f')](_0x1deb88['id']),{'transaction':_0x3c095e});}return BPromise['all'](_0x7191f)['then'](function(){if(_0x1deb88[_0xb871('0xa8')]){return BPromise[_0xb871('0xac')](_[_0xb871('0x2b')](_0x2d70c4,function(_0x795009){return _0x795009[_0xb871('0x120')](_0xb871('0xb0'))==='Voice';}),function(_0x18bbdc){return db[_0xb871('0xad')]['upsert']({'membername':_0x1deb88[_0xb871('0x32')],'UserId':_0x1deb88['id'],'queue_name':_0x18bbdc[_0xb871('0x32')],'VoiceQueueId':_0x18bbdc['id'],'interface':_['isNil'](_0x1deb88['interface'])?util[_0xb871('0xaa')](_0xb871('0xab'),_0x1deb88[_0xb871('0x32')]):_0x1deb88[_0xb871('0xa9')],'paused':_0x1deb88['voicePause']||![],'penalty':_0x1deb88[_0xb871('0xa1')]},{'transaction':_0x3c095e});});}else{return;}})[_0xb871('0x12')](function(){for(var _0x2b4aca=0x0;_0x2b4aca<_0x2d70c4[_0xb871('0x58')];_0x2b4aca++){var _0x38f081=_0x2d70c4[_0x2b4aca][_0xb871('0x120')](_0xb871('0xb0'));var _0xfec1b0=_0x38f081+'QueueId';socket[_0xb871('0xb3')](_0xb871('0x7a')+_0x38f081+'Queue:save',{'UserId':_0x1deb88['id'],['queueField']:_0x2d70c4[_0x2b4aca]['id']});}});});})[_0xb871('0x12')](function(){db[_0xb871('0x121')][_0xb871('0x96')]({'where':{'teamId':_0x16db77['id']}})[_0xb871('0x12')](function(_0xf36ae7){if(_0xf36ae7){db[_0xb871('0x122')][_0xb871('0x79')]({'UserId':_0x63f70e[_0xb871('0x5d')]['id'],'VoicePrefixId':_0xf36ae7[_0xb871('0x123')]});}});});}});}})[_0xb871('0x12')](respondWithStatusCode(_0x420cc4,null))[_0xb871('0x1d')](handleError(_0x420cc4,null));};exports[_0xb871('0x124')]=function(_0x20c10f,_0x1c5447){return db[_0xb871('0x35')]['findOne']({'where':{'id':_0x20c10f[_0xb871('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1c5447,null))['then'](function(_0x3c198c){if(_0x3c198c){var _0x5027fa=_0x3c198c[_0xb871('0xa7')]({'plain':!![]});var _0x1da387=_0x20c10f[_0xb871('0x3f')][_0xb871('0x5e')];return _0x3c198c[_0xb871('0x124')](_0x1da387)[_0xb871('0x12')](function(){for(var _0x229bbb=0x0;_0x229bbb<_0x1da387[_0xb871('0x58')];_0x229bbb++){var _0x40c77e=[];var _0x151765={};db[_0xb871('0x110')][_0xb871('0x96')]({'where':{'id':_0x1da387[_0x229bbb]}})[_0xb871('0x12')](function(_0x54a519){_0x151765=_0x54a519[_0xb871('0x4a')];_0x40c77e[_0xb871('0x46')](_0x54a519['getVoiceQueues']()['then'](function(_0xb88af9){for(var _0x15c9bc=0x0;_0x15c9bc<_0xb88af9['length'];_0x15c9bc++){_0xb88af9[_0x15c9bc][_0xb871('0x112')](_0xb871('0xb0'),_0xb871('0x113'));}return _0xb88af9;}));_0x40c77e[_0xb871('0x46')](_0x54a519[_0xb871('0x114')]()[_0xb871('0x12')](function(_0x41b4ae){for(var _0x10c4e9=0x0;_0x10c4e9<_0x41b4ae['length'];_0x10c4e9++){_0x41b4ae[_0x10c4e9][_0xb871('0x112')]('channel',_0xb871('0x115'));}return _0x41b4ae;}));_0x40c77e[_0xb871('0x46')](_0x54a519['getMailQueues']()[_0xb871('0x12')](function(_0x48f024){for(var _0x64f9da=0x0;_0x64f9da<_0x48f024['length'];_0x64f9da++){_0x48f024[_0x64f9da][_0xb871('0x112')]('channel','Mail');}return _0x48f024;}));_0x40c77e[_0xb871('0x46')](_0x54a519[_0xb871('0x117')]()[_0xb871('0x12')](function(_0xca6b6e){for(var _0x1f8233=0x0;_0x1f8233<_0xca6b6e[_0xb871('0x58')];_0x1f8233++){_0xca6b6e[_0x1f8233][_0xb871('0x112')](_0xb871('0xb0'),_0xb871('0x125'));}return _0xca6b6e;}));_0x40c77e[_0xb871('0x46')](_0x54a519[_0xb871('0x118')]()[_0xb871('0x12')](function(_0x30e9ed){for(var _0x52a8e6=0x0;_0x52a8e6<_0x30e9ed[_0xb871('0x58')];_0x52a8e6++){_0x30e9ed[_0x52a8e6][_0xb871('0x112')]('channel',_0xb871('0x119'));}return _0x30e9ed;}));_0x40c77e[_0xb871('0x46')](_0x54a519[_0xb871('0x11a')]()[_0xb871('0x12')](function(_0x1bc157){for(var _0x5cabd9=0x0;_0x5cabd9<_0x1bc157[_0xb871('0x58')];_0x5cabd9++){_0x1bc157[_0x5cabd9]['setDataValue'](_0xb871('0xb0'),'Fax');}return _0x1bc157;}));_0x40c77e[_0xb871('0x46')](_0x54a519[_0xb871('0x126')]()[_0xb871('0x12')](function(_0x4418bb){for(var _0x47ed32=0x0;_0x47ed32<_0x4418bb[_0xb871('0x58')];_0x47ed32++){_0x4418bb[_0x47ed32][_0xb871('0x112')]('channel','Openchannel');}return _0x4418bb;}));return BPromise[_0xb871('0x50')](_0x40c77e);})[_0xb871('0x12')](function(_0xfdab80){var _0x8f28a6=_[_0xb871('0x11d')](_0xfdab80);_0x40c77e=[];return db['sequelize'][_0xb871('0x11e')](function(_0x516dac){for(var _0xfbf627=0x0;_0xfbf627<_0x8f28a6[_0xb871('0x58')];_0xfbf627++){_0x40c77e[_0xb871('0x46')](_0x8f28a6[_0xfbf627][_0xb871('0x127')](_0x5027fa['id']),{'transaction':_0x516dac});}return BPromise['all'](_0x40c77e)[_0xb871('0x12')](function(){if(_0x5027fa[_0xb871('0xa8')]){return BPromise[_0xb871('0xac')](_[_0xb871('0x2b')](_0x8f28a6,function(_0x327522){return _0x327522['getDataValue'](_0xb871('0xb0'))===_0xb871('0x113');}),function(_0x23f287){return db[_0xb871('0xad')][_0xb871('0x31')]({'where':{'VoiceQueueId':_0x23f287['id'],'UserId':_0x5027fa['id']},'transaction':_0x516dac});});}else{return;}})[_0xb871('0x12')](function(){db[_0xb871('0x121')][_0xb871('0x96')]({'where':{'teamId':_0x151765['id']}})['then'](function(_0x201b61){if(_0x201b61){return db[_0xb871('0x122')]['destroy']({'where':{'UserId':_0x5027fa['id'],'VoicePrefixId':_0x201b61[_0xb871('0x4a')][_0xb871('0x123')]}});}});})['then'](function(){for(var _0x44772b=0x0;_0x44772b<_0x8f28a6['length'];_0x44772b++){var _0x18ed8a=_0x8f28a6[_0x44772b][_0xb871('0x120')](_0xb871('0xb0'));var _0x580d8e=_0x18ed8a+'QueueId';socket[_0xb871('0xb3')](_0xb871('0x7a')+_0x18ed8a+'Queue:remove',{'UserId':_0x5027fa['id'],['queueField']:_0x8f28a6[_0x44772b]['id']});}});});});}});}})[_0xb871('0x12')](respondWithStatusCode(_0x1c5447,null))[_0xb871('0x1d')](handleError(_0x1c5447,null));};exports[_0xb871('0x128')]=function(_0x2875cb,_0x2b6fb2){var _0x5598be={};var _0x213671={};var _0x27e060;var _0x29dd2c;return db[_0xb871('0x35')]['findOne']({'where':{'id':_0x2875cb[_0xb871('0x5d')]['id']}})[_0xb871('0x12')](handleEntityNotFound(_0x2b6fb2,null))['then'](function(_0x406f59){if(_0x406f59){_0x27e060=_0x406f59;_0x213671[_0xb871('0x56')]=_[_0xb871('0x53')](db[_0xb871('0xd2')]['rawAttributes']);_0x213671[_0xb871('0x3f')]=_['keys'](_0x2875cb[_0xb871('0x3f')]);_0x213671[_0xb871('0x54')]=_[_0xb871('0x55')](_0x213671[_0xb871('0x56')],_0x213671[_0xb871('0x3f')]);_0x5598be[_0xb871('0x45')]=_['intersection'](_0x213671[_0xb871('0x56')],qs[_0xb871('0x57')](_0x2875cb['query']['fields']));_0x5598be['attributes']=_0x5598be['attributes'][_0xb871('0x58')]?_0x5598be[_0xb871('0x45')]:_0x213671[_0xb871('0x56')];_0x5598be[_0xb871('0xcd')]=qs[_0xb871('0xce')](_0x2875cb[_0xb871('0x3f')]['sort']);_0x5598be['where']=qs[_0xb871('0x54')](_[_0xb871('0xcf')](_0x2875cb[_0xb871('0x3f')],_0x213671[_0xb871('0x54')]));if(_0x2875cb[_0xb871('0x3f')][_0xb871('0x2b')]){_0x5598be[_0xb871('0x3d')]=_[_0xb871('0xd0')](_0x5598be[_0xb871('0x3d')],{'$or':_['map'](_0x5598be[_0xb871('0x45')],function(_0x1d4e1b){var _0x4995b5={};_0x4995b5[_0x1d4e1b]={'$like':'%'+_0x2875cb['query'][_0xb871('0x2b')]+'%'};return _0x4995b5;})});}_0x5598be=_['merge']({},_0x5598be,_0x2875cb[_0xb871('0x59')]);return _0x27e060[_0xb871('0x128')](_0x5598be);}})[_0xb871('0x12')](function(_0x11f6e8){if(_0x11f6e8){_0x29dd2c=_0x11f6e8['length'];if(!_0x2875cb[_0xb871('0x3f')][_0xb871('0xd1')]('nolimit')){_0x5598be[_0xb871('0x22')]=qs[_0xb871('0x22')](_0x2875cb[_0xb871('0x3f')][_0xb871('0x22')]);_0x5598be[_0xb871('0x21')]=qs[_0xb871('0x21')](_0x2875cb[_0xb871('0x3f')]['offset']);}return _0x27e060[_0xb871('0x128')](_0x5598be);}})[_0xb871('0x12')](function(_0x522238){if(_0x522238){return _0x522238?{'count':_0x29dd2c,'rows':_0x522238}:null;}})[_0xb871('0x12')](respondWithResult(_0x2b6fb2,null))[_0xb871('0x1d')](handleError(_0x2b6fb2,null));};exports['getAgents']=function(_0x13d8e0,_0x2c8dc8){var _0x43c300={};var _0x1f19d1={};var _0x2ebef1;return db[_0xb871('0x35')][_0xb871('0x96')]({'where':{'id':_0x13d8e0['params']['id']}})['then'](handleEntityNotFound(_0x2c8dc8,null))[_0xb871('0x12')](function(_0x5daf8a){if(_0x5daf8a){_0x2ebef1=_0x5daf8a;_0x1f19d1[_0xb871('0x56')]=_[_0xb871('0x53')](db['User']['rawAttributes']);_0x1f19d1[_0xb871('0x3f')]=_[_0xb871('0x53')](_0x13d8e0[_0xb871('0x3f')]);_0x1f19d1[_0xb871('0x54')]=_[_0xb871('0x55')](_0x1f19d1[_0xb871('0x56')],_0x1f19d1[_0xb871('0x3f')]);_0x43c300['attributes']=_[_0xb871('0x55')](_0x1f19d1['model'],qs[_0xb871('0x57')](_0x13d8e0[_0xb871('0x3f')][_0xb871('0x57')]));_0x43c300['attributes']=_0x43c300['attributes'][_0xb871('0x58')]?_0x43c300[_0xb871('0x45')]:_0x1f19d1[_0xb871('0x56')];_0x43c300[_0xb871('0xcd')]=qs[_0xb871('0xce')](_0x13d8e0['query'][_0xb871('0xce')]);_0x43c300[_0xb871('0x3d')]=qs['filters'](_['pick'](_0x13d8e0[_0xb871('0x3f')],_0x1f19d1['filters']));if(_0x13d8e0['query']['filter']){_0x43c300[_0xb871('0x3d')]=_[_0xb871('0xd0')](_0x43c300[_0xb871('0x3d')],{'$or':_[_0xb871('0x2d')](_0x43c300[_0xb871('0x45')],function(_0x398cc3){var _0x38991d={};_0x38991d[_0x398cc3]={'$like':'%'+_0x13d8e0[_0xb871('0x3f')][_0xb871('0x2b')]+'%'};return _0x38991d;})});}_0x43c300[_0xb871('0x56')]=db[_0xb871('0x35')];_0x43c300['as']='Agents';_0x43c300=_[_0xb871('0xd0')]({},_0x43c300,_0x13d8e0['options']);return _0x2ebef1[_0xb871('0xf5')]({'include':[_0x43c300]});}})['then'](function(_0x442ae4){if(_0x442ae4){var _0x351b5f={},_0x122c4a=[];for(var _0x13e15b=0x0;_0x13e15b<_0x442ae4['length'];_0x13e15b+=0x1){for(var _0x2aa51a=0x0,_0x508fab;_0x2aa51a<_0x442ae4[_0x13e15b][_0xb871('0x8a')][_0xb871('0x58')];_0x2aa51a+=0x1){_0x508fab=_0x442ae4[_0x13e15b][_0xb871('0x8a')][_0x2aa51a][_0xb871('0xa7')]({'plain':!![]});_0x351b5f[_0x508fab['id']]=_0x508fab;}}_0x351b5f=_['values'](_0x351b5f);for(var _0x5458ca=qs[_0xb871('0x21')](_0x13d8e0[_0xb871('0x3f')][_0xb871('0x21')]);_0x5458ca<_0x351b5f['length']&&_0x122c4a[_0xb871('0x58')]=_0x55be95){_0x2c08c1=_0x55be95;_0x564318=0xc8;}else{_0x564318=0xce;}_0x802569[_0x2d9b('0x20')](_0x564318);return _0x802569[_0x2d9b('0x24')](_0x2d9b('0x25'),_0x5a6811+'-'+_0x2c08c1+'/'+_0x55be95)['json'](_0x31fe36);}return null;};}function saveUpdates(_0x36d8f6){return function(_0x496999){if(_0x496999){return _0x496999[_0x2d9b('0x26')](_0x36d8f6)[_0x2d9b('0x15')](function(_0x42d129){return _0x42d129;});}return null;};}function removeEntity(_0x30e054){return function(_0x1edcfd){if(_0x1edcfd){return _0x1edcfd[_0x2d9b('0x27')]()['then'](function(){var _0xf709f8=_0x1edcfd[_0x2d9b('0x28')]({'plain':!![]});if(_0xf709f8[_0x2d9b('0x29')]===_0x2d9b('0x2a'))return;var _0x19de86=[{'name':_0x2d9b('0x2b'),'value':_0x2d9b('0x2c'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':'Telephones','value':_0x2d9b('0x2d'),'ignore':![]}];var _0x3b4c5d=_(_0x19de86)[_0x2d9b('0x2e')]('ignore')[_0x2d9b('0x2f')](_0x2d9b('0x30'))[_0x2d9b('0x30')]();if(_['includes'](_0x3b4c5d,_0xf709f8[_0x2d9b('0x29')])){return;}var _0x48df87=_['find'](_0x19de86,[_0x2d9b('0x30'),_0xf709f8[_0x2d9b('0x29')]])['name'];return db[_0x2d9b('0x31')][_0x2d9b('0x27')]({'where':{'type':_0x48df87,'resourceId':_0xf709f8['id']}})[_0x2d9b('0x15')](function(){return _0x1edcfd;});})[_0x2d9b('0x15')](function(){_0x30e054[_0x2d9b('0x20')](0xcc)[_0x2d9b('0x21')]();});}};}function handleEntityNotFound(_0x2e9749){return function(_0x259048){if(!_0x259048){_0x2e9749[_0x2d9b('0x1f')](0x194);}return _0x259048;};}function handleError(_0x343f3b,_0x186816){_0x186816=_0x186816||0x1f4;return function(_0x2c4254){logger[_0x2d9b('0x1a')](_0x2c4254[_0x2d9b('0x32')]);if(_0x2c4254[_0x2d9b('0x33')]){delete _0x2c4254[_0x2d9b('0x33')];}_0x343f3b[_0x2d9b('0x20')](_0x186816)[_0x2d9b('0x34')](_0x2c4254);};}exports[_0x2d9b('0x35')]=function(_0x36112f,_0x5a8911){var _0x2a0b65={},_0x474d65={'count':0x0,'rows':[]};var _0x587708=_(db[_0x2d9b('0x36')][_0x2d9b('0x37')])[_0x2d9b('0x2f')](function(_0x473a25){return{'name':_0x473a25[_0x2d9b('0x38')],'type':_0x473a25[_0x2d9b('0x39')]['key']};})[_0x2d9b('0x2e')](function(_0x48b002){return!_[_0x2d9b('0x3a')](['password',_0x2d9b('0x3b')],_0x48b002['name']);})[_0x2d9b('0x30')]();_0x2a0b65=qs['getOptions'](_0x587708,_0x36112f);var _0x22fcc5={'where':_0x2a0b65[_0x2d9b('0x3c')]};return db['User'][_0x2d9b('0x3d')](_0x22fcc5)[_0x2d9b('0x15')](function(_0xe88db9){_0x474d65[_0x2d9b('0x3d')]=_0xe88db9;if(_0x36112f[_0x2d9b('0x3e')]['includeAll']){_0x2a0b65[_0x2d9b('0x3f')]=[{'all':!![]}];}if(_0x36112f[_0x2d9b('0x3e')][_0x2d9b('0x40')]===_0x2d9b('0x41')){_0x2a0b65[_0x2d9b('0x3f')]=[{'model':db[_0x2d9b('0x42')],'as':_0x2d9b('0x40')}];}if(!_[_0x2d9b('0x3a')](_0x2a0b65[_0x2d9b('0x43')],'id')){_0x2a0b65[_0x2d9b('0x43')][_0x2d9b('0x44')]('id');}return db[_0x2d9b('0x36')][_0x2d9b('0x45')](_0x2a0b65);})[_0x2d9b('0x15')](function(_0x3435ed){_0x474d65[_0x2d9b('0x46')]=_0x3435ed;if(_0x36112f[_0x2d9b('0x3e')][_0x2d9b('0x47')]===_0x2d9b('0x41')){var _0x34f9ca=[];for(var _0x21b4c1=0x0;_0x21b4c1<_0x474d65[_0x2d9b('0x46')][_0x2d9b('0x48')];_0x21b4c1++){_0x34f9ca[_0x2d9b('0x44')](get_open_tabs('chat',_0x474d65[_0x2d9b('0x46')][_0x21b4c1][_0x2d9b('0x49')]));_0x34f9ca[_0x2d9b('0x44')](get_open_tabs(_0x2d9b('0x4a'),_0x474d65[_0x2d9b('0x46')][_0x21b4c1][_0x2d9b('0x49')]));_0x34f9ca[_0x2d9b('0x44')](get_open_tabs(_0x2d9b('0x4b'),_0x474d65[_0x2d9b('0x46')][_0x21b4c1]['dataValues']));_0x34f9ca[_0x2d9b('0x44')](get_open_tabs(_0x2d9b('0x4c'),_0x474d65[_0x2d9b('0x46')][_0x21b4c1]['dataValues']));_0x34f9ca[_0x2d9b('0x44')](get_open_tabs('openchannel',_0x474d65[_0x2d9b('0x46')][_0x21b4c1][_0x2d9b('0x49')]));_0x34f9ca[_0x2d9b('0x44')](get_open_tabs(_0x2d9b('0x4d'),_0x474d65[_0x2d9b('0x46')][_0x21b4c1][_0x2d9b('0x49')]));}return BPromise[_0x2d9b('0x4e')](_0x34f9ca)[_0x2d9b('0x15')](function(){return _0x474d65;});}else{return _0x474d65;}})[_0x2d9b('0x15')](respondWithFilteredResult(_0x5a8911,_0x2a0b65))['catch'](handleError(_0x5a8911,null));};exports[_0x2d9b('0x4f')]=function(_0x2430aa,_0x4f05fb){var _0x39ba98={'raw':![],'where':{'id':_0x2430aa[_0x2d9b('0x50')]['id']}},_0x2873c0={};_0x2873c0[_0x2d9b('0x51')]=_[_0x2d9b('0x52')](_[_0x2d9b('0x53')](db[_0x2d9b('0x36')][_0x2d9b('0x37')]),[_0x2d9b('0x54'),_0x2d9b('0x3b')]);_0x2873c0[_0x2d9b('0x3e')]=_[_0x2d9b('0x53')](_0x2430aa[_0x2d9b('0x3e')]);_0x2873c0[_0x2d9b('0x55')]=_[_0x2d9b('0x56')](_0x2873c0[_0x2d9b('0x51')],_0x2873c0[_0x2d9b('0x3e')]);_0x39ba98[_0x2d9b('0x43')]=_[_0x2d9b('0x56')](_0x2873c0[_0x2d9b('0x51')],qs[_0x2d9b('0x57')](_0x2430aa[_0x2d9b('0x3e')][_0x2d9b('0x57')]));_0x39ba98[_0x2d9b('0x43')]=_0x39ba98[_0x2d9b('0x43')]['length']?_0x39ba98[_0x2d9b('0x43')]:_0x2873c0['model'];if(_0x2430aa[_0x2d9b('0x3e')][_0x2d9b('0x58')]){_0x39ba98[_0x2d9b('0x3f')]=[{'all':!![]}];}if(_0x2430aa[_0x2d9b('0x3e')][_0x2d9b('0x40')]===_0x2d9b('0x41')){_0x39ba98['include']=[{'model':db['UserSetting'],'as':_0x2d9b('0x40')}];}_0x39ba98=_['merge']({},_0x39ba98,_0x2430aa['options']);if(!_[_0x2d9b('0x3a')](_0x39ba98[_0x2d9b('0x43')],'id')){_0x39ba98[_0x2d9b('0x43')]['push']('id');}return db[_0x2d9b('0x36')]['find'](_0x39ba98)[_0x2d9b('0x15')](handleEntityNotFound(_0x4f05fb,null))[_0x2d9b('0x15')](function(_0x405f4f){var _0x40bd8b=[];values=_0x405f4f;if(_0x2430aa[_0x2d9b('0x3e')][_0x2d9b('0x47')]===_0x2d9b('0x41')){_0x40bd8b[_0x2d9b('0x44')](get_open_tabs(_0x2d9b('0x59'),_0x405f4f[_0x2d9b('0x49')]));_0x40bd8b[_0x2d9b('0x44')](get_open_tabs(_0x2d9b('0x4a'),_0x405f4f[_0x2d9b('0x49')]));_0x40bd8b[_0x2d9b('0x44')](get_open_tabs(_0x2d9b('0x5a'),_0x405f4f[_0x2d9b('0x49')]));_0x40bd8b[_0x2d9b('0x44')](get_open_tabs(_0x2d9b('0x4d'),_0x405f4f[_0x2d9b('0x49')]));_0x40bd8b[_0x2d9b('0x44')](get_open_tabs(_0x2d9b('0x4b'),_0x405f4f[_0x2d9b('0x49')]));_0x40bd8b[_0x2d9b('0x44')](get_open_tabs('mail',_0x405f4f['dataValues']));return BPromise[_0x2d9b('0x4e')](_0x40bd8b);}else{return values;}})['then'](function(){return values;})[_0x2d9b('0x15')](respondWithResult(_0x4f05fb,null))['catch'](handleError(_0x4f05fb,null));};exports[_0x2d9b('0x26')]=function(_0x354ce3,_0x508f32){if(_0x354ce3[_0x2d9b('0x5b')]['id']){delete _0x354ce3[_0x2d9b('0x5b')]['id'];}delete _0x354ce3[_0x2d9b('0x5b')]['role'];return db[_0x2d9b('0x36')][_0x2d9b('0x5c')]({'where':{'id':_0x354ce3[_0x2d9b('0x50')]['id']}})[_0x2d9b('0x15')](handleEntityNotFound(_0x508f32,null))[_0x2d9b('0x15')](saveUpdates(_0x354ce3['body'],null))[_0x2d9b('0x15')](respondWithResult(_0x508f32,null))[_0x2d9b('0x1e')](handleError(_0x508f32,null));};exports['describe']=function(_0x504ae7,_0x13d725){return db[_0x2d9b('0x36')][_0x2d9b('0x5d')]()['then'](respondWithResult(_0x13d725,null))[_0x2d9b('0x1e')](handleError(_0x13d725,null));};exports[_0x2d9b('0x5e')]=function(_0x34cca3,_0x38e8d8){return db[_0x2d9b('0x36')][_0x2d9b('0x5c')]({'where':{'id':_0x34cca3[_0x2d9b('0x50')]['id']}})[_0x2d9b('0x15')](handleEntityNotFound(_0x38e8d8,null))['then'](function(_0x247536){if(_0x247536){return _0x247536[_0x2d9b('0x5e')](_0x34cca3['body'][_0x2d9b('0x5f')],_[_0x2d9b('0x60')](_0x34cca3[_0x2d9b('0x5b')],[_0x2d9b('0x5f'),'id'])||{});}})[_0x2d9b('0x15')](respondWithResult(_0x38e8d8,null))[_0x2d9b('0x1e')](handleError(_0x38e8d8,null));};function validateUser(_0xf0758d){return new BPromise(function(_0x12e7b3,_0x46739c){if(_0xf0758d[_0x2d9b('0x61')])return _0x12e7b3(_0xf0758d);return db[_0x2d9b('0x62')][_0x2d9b('0x63')](0x1)[_0x2d9b('0x15')](function(_0x16518c){if(_0x16518c[_0x2d9b('0x64')])authService['validatePasswordPattern'](_0xf0758d[_0x2d9b('0x54')]);db['User'][_0x2d9b('0x65')](_0x2d9b('0x61'))[_0x2d9b('0x15')](function(_0x2bd94f){if(_[_0x2d9b('0x66')](_0x2bd94f)){_0xf0758d[_0x2d9b('0x61')]=_0x16518c['min_internal']||0x1;return;}if(_[_0x2d9b('0x66')](_0x16518c[_0x2d9b('0x67')])||_0x16518c[_0x2d9b('0x67')]===_0x2bd94f){_0xf0758d[_0x2d9b('0x61')]=_0x2bd94f+0x1;return;}if(_0x16518c[_0x2d9b('0x67')]>_0x2bd94f){_0xf0758d['internal']=_0x16518c['min_internal'];return;}return db['sequelize'][_0x2d9b('0x3e')](_0x2d9b('0x68'),{'type':db['sequelize']['QueryTypes'][_0x2d9b('0x69')]})[_0x2d9b('0x15')](function(_0x1cfc2f){if(_0x1cfc2f&&_0x1cfc2f[_0x2d9b('0x48')]){for(var _0x33f9f7=0x0,_0x190b52=_0x1cfc2f[_0x2d9b('0x48')];_0x33f9f7<_0x190b52&&_['isNil'](_0xf0758d[_0x2d9b('0x61')]);_0x33f9f7++){if(_0x16518c[_0x2d9b('0x67')]<=_0x1cfc2f[_0x33f9f7][_0x2d9b('0x6a')]){_0xf0758d[_0x2d9b('0x61')]=_0x1cfc2f[_0x33f9f7][_0x2d9b('0x6a')];}else if(_0x16518c['min_internal']>_0x1cfc2f[_0x33f9f7][_0x2d9b('0x6a')]&&_0x16518c[_0x2d9b('0x67')]<=_0x1cfc2f[_0x33f9f7]['to']){_0xf0758d['internal']=_0x16518c[_0x2d9b('0x67')];}}}if(_[_0x2d9b('0x66')](_0xf0758d[_0x2d9b('0x61')])){_0xf0758d[_0x2d9b('0x61')]=_0x2bd94f+0x1;}return _0x12e7b3(_0xf0758d);});});})[_0x2d9b('0x1e')](function(_0x5e11cf){_0x46739c(_0x5e11cf);});});}function updateUser(_0x4bb7b7){return new BPromise(function(_0x813d56,_0x205c8b){try{if(_0x4bb7b7['voicemail']){_0x4bb7b7[_0x2d9b('0x6b')]=_0x4bb7b7['internal'];_0x4bb7b7[_0x2d9b('0x6c')]={'mailbox':_0x4bb7b7[_0x2d9b('0x61')],'password':_0x4bb7b7[_0x2d9b('0x54')],'fullname':_0x4bb7b7['fullname'],'email':_0x4bb7b7[_0x2d9b('0x6d')]};}if(_0x4bb7b7[_0x2d9b('0x29')]===_0x2d9b('0x6e')){if(!_0x4bb7b7[_0x2d9b('0x6f')])_0x4bb7b7[_0x2d9b('0x6f')]=['101',_0x2d9b('0x70'),_0x2d9b('0x71'),_0x2d9b('0x72'),_0x2d9b('0x73'),'104',_0x2d9b('0x74'),_0x2d9b('0x75'),_0x2d9b('0x76'),_0x2d9b('0x77'),'109',_0x2d9b('0x78'),_0x2d9b('0x79'),_0x2d9b('0x7a'),_0x2d9b('0x7b')];}_0x813d56(_0x4bb7b7);}catch(_0x255e5e){_0x205c8b(_0x255e5e);}});}exports[_0x2d9b('0x7c')]=function(_0x4d59c9,_0x5f2753){if(_0x4d59c9[_0x2d9b('0x2c')][_0x2d9b('0x29')]==='agent')throw new Error(_0x2d9b('0x7d'));if(_0x4d59c9['body'][_0x2d9b('0x29')]==='user'&&_0x4d59c9[_0x2d9b('0x2c')][_0x2d9b('0x29')]!=='admin'){throw new Error(_0x2d9b('0x7e'));}if(_0x4d59c9[_0x2d9b('0x5b')][_0x2d9b('0x29')]===_0x2d9b('0x2a')&&_0x4d59c9[_0x2d9b('0x2c')][_0x2d9b('0x29')]!==_0x2d9b('0x2a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x2d9b('0x7f')]([_0x4d59c9[_0x2d9b('0x5b')]])[_0x2d9b('0x15')](function(){return validateUser(_0x4d59c9[_0x2d9b('0x5b')]);})[_0x2d9b('0x15')](function(_0x254b2f){return updateUser(_0x254b2f)[_0x2d9b('0x15')](function(_0x2fa32d){if(_0x2fa32d[_0x2d9b('0x29')]===_0x2d9b('0x2a')){_0x2fa32d[_0x2d9b('0x80')]=_0x4d59c9[_0x2d9b('0x2c')][_0x2d9b('0x80')];delete _0x2fa32d[_0x2d9b('0x81')];}return _0x2fa32d;});})['then'](function(_0x4b8e86){return db[_0x2d9b('0x36')][_0x2d9b('0x7c')](_0x4b8e86,{'include':[{'model':db[_0x2d9b('0x6c')],'as':'VoiceMail'}]});})[_0x2d9b('0x15')](function(_0x2ad1cc){if(_0x4d59c9[_0x2d9b('0x5b')][_0x2d9b('0x29')]==='user')return _0x2ad1cc;if(_0x4d59c9[_0x2d9b('0x2c')][_0x2d9b('0x29')]!=='user')return _0x2ad1cc;return db[_0x2d9b('0x82')][_0x2d9b('0x5c')]({'where':{'name':_0x2ad1cc[_0x2d9b('0x29')]===_0x2d9b('0x6e')?'Agents':_0x2d9b('0x83'),'userProfileId':_0x4d59c9[_0x2d9b('0x2c')][_0x2d9b('0x81')]},'raw':!![]})[_0x2d9b('0x15')](function(_0x3461d6){if(!_0x3461d6||_0x3461d6[_0x2d9b('0x84')]!=0x0)return _0x2ad1cc;return db['UserProfileResource'][_0x2d9b('0x7c')]({'name':_0x2ad1cc[_0x2d9b('0x33')],'resourceId':_0x2ad1cc['id'],'type':_0x3461d6[_0x2d9b('0x33')],'sectionId':_0x3461d6['id']},{})[_0x2d9b('0x15')](function(){return _0x2ad1cc;});})[_0x2d9b('0x1e')](function(_0x5cb678){logger[_0x2d9b('0x1a')](_0x2d9b('0x85'),_0x5cb678);throw _0x5cb678;});})[_0x2d9b('0x15')](respondWithResult(_0x5f2753,0xc9))['catch'](handleError(_0x5f2753,null));};exports[_0x2d9b('0x86')]=function(_0x4201dc,_0x591ae7){var _0x4d3463=_0x4201dc[_0x2d9b('0x5b')];var _0x5c4e50=[];if(_0x4201dc['user']['role']==='agent')throw new Error(_0x2d9b('0x7d'));if(_[_0x2d9b('0x87')](_0x4d3463,[_0x2d9b('0x29'),_0x2d9b('0x2c')])&&_0x4201dc[_0x2d9b('0x2c')][_0x2d9b('0x29')]!==_0x2d9b('0x2a')){throw new Error(_0x2d9b('0x7e'));}if(_[_0x2d9b('0x87')](_0x4d3463,[_0x2d9b('0x29'),_0x2d9b('0x2a')])&&_0x4201dc[_0x2d9b('0x2c')][_0x2d9b('0x29')]!==_0x2d9b('0x2a')){throw new Error(_0x2d9b('0x88'));}return licenseUtil['checkUserLimits'](_0x4d3463)[_0x2d9b('0x15')](function(){return validateUser(_0x4d3463[0x0]);})[_0x2d9b('0x15')](function(){for(var _0x7baa6d=0x1;_0x7baa6d<_0x4d3463[_0x2d9b('0x48')];_0x7baa6d++){var _0x34bc9f=_0x4d3463[_0x7baa6d-0x1][_0x2d9b('0x61')];if(!_0x4d3463[_0x7baa6d][_0x2d9b('0x61')])_0x4d3463[_0x7baa6d][_0x2d9b('0x61')]=_0x34bc9f+0x1;_0x5c4e50[_0x2d9b('0x44')](validateUser(_0x4d3463[_0x7baa6d]));}return BPromise[_0x2d9b('0x4e')](_0x5c4e50);})[_0x2d9b('0x15')](function(){_0x5c4e50=[];for(var _0x41b5b3=0x0;_0x41b5b3<_0x4d3463[_0x2d9b('0x48')];_0x41b5b3++){_0x5c4e50[_0x2d9b('0x44')](updateUser(_0x4d3463[_0x41b5b3]));}return BPromise[_0x2d9b('0x4e')](_0x5c4e50);})[_0x2d9b('0x15')](function(){return BPromise[_0x2d9b('0x89')](_0x4d3463,function(_0x3c2526){return db[_0x2d9b('0x36')][_0x2d9b('0x7c')](_0x3c2526,{'include':[{'model':db[_0x2d9b('0x6c')],'as':_0x2d9b('0x6c')}]})['then'](function(_0x33b025){_0x3c2526['id']=_0x33b025['id'];return _0x3c2526;});});})[_0x2d9b('0x15')](function(_0x1e68d5){if(_0x4201dc['body'][_0x2d9b('0x29')]===_0x2d9b('0x2c'))return _0x1e68d5;if(_0x4201dc[_0x2d9b('0x2c')][_0x2d9b('0x29')]!==_0x2d9b('0x2c'))return _0x1e68d5;var _0x4c5398=_[_0x2d9b('0x87')](_0x1e68d5,function(_0x5671dd){return _0x5671dd[_0x2d9b('0x29')]===_0x2d9b('0x6e')||_0x5671dd['role']===_0x2d9b('0x2d');});if(!_0x4c5398)return _0x1e68d5;return db[_0x2d9b('0x82')][_0x2d9b('0x45')]({'where':{'name':{'$or':['Agents',_0x2d9b('0x83')]},'userProfileId':_0x4201dc[_0x2d9b('0x2c')]['userProfileId']},'raw':!![]})[_0x2d9b('0x15')](function(_0x21023d){if(_[_0x2d9b('0x8a')](_0x21023d)||!_[_0x2d9b('0x87')](_0x21023d,[_0x2d9b('0x84'),0x0]))return _0x1e68d5;_0x5c4e50=[];var _0x2a119b=_(_0x21023d)[_0x2d9b('0x2f')](function(_0x5c367d){if(_0x5c367d[_0x2d9b('0x84')]===0x1)return;return _0x5c367d['name']===_0x2d9b('0x8b')?_0x2d9b('0x6e'):'telephone';})[_0x2d9b('0x8c')]()[_0x2d9b('0x30')]();for(var _0x5833c4=0x0;_0x5833c4<_0x1e68d5['length'];_0x5833c4++){if(!_['includes'](_0x2a119b,_0x1e68d5[_0x5833c4][_0x2d9b('0x29')]))return;var _0x290704=_0x1e68d5[_0x5833c4]['role']===_0x2d9b('0x6e')?_0x2d9b('0x8b'):_0x2d9b('0x83');_0x5c4e50['push'](db[_0x2d9b('0x31')][_0x2d9b('0x7c')]({'name':_0x1e68d5[_0x5833c4][_0x2d9b('0x33')],'resourceId':_0x1e68d5[_0x5833c4]['id'],'type':_0x290704,'sectionId':_[_0x2d9b('0x5c')](_0x21023d,['name',_0x290704])['id']},{}));}return BPromise[_0x2d9b('0x4e')](_0x5c4e50);});})['then'](respondWithResult(_0x591ae7,0xc9))[_0x2d9b('0x1e')](handleError(_0x591ae7,null));};exports[_0x2d9b('0x8d')]=function(_0x5c8687,_0x2bf134){if(_0x5c8687[_0x2d9b('0x5b')]['id']){delete _0x5c8687[_0x2d9b('0x5b')]['id'];}return db['User'][_0x2d9b('0x5c')]({'where':{'id':_0x5c8687['params']['id']}})[_0x2d9b('0x15')](function(_0xab88f5){if(!_0xab88f5)return null;if(_0xab88f5['id']===_0x5c8687[_0x2d9b('0x2c')]['id']){if(!_0x5c8687[_0x2d9b('0x5b')][_0x2d9b('0x8e')]||!_0x5c8687[_0x2d9b('0x5b')][_0x2d9b('0x8f')]){throw new db[(_0x2d9b('0x90'))]['ValidationError'](_0x2d9b('0x91'));}if(!_0xab88f5[_0x2d9b('0x92')](_0x5c8687[_0x2d9b('0x5b')][_0x2d9b('0x8e')])){throw new db[(_0x2d9b('0x90'))][(_0x2d9b('0x93'))](_0x2d9b('0x94'));}if(_0x5c8687[_0x2d9b('0x5b')][_0x2d9b('0x8e')]===_0x5c8687['body'][_0x2d9b('0x8f')]){throw new db['Sequelize'][(_0x2d9b('0x93'))](_0x2d9b('0x95'));}}else if(_0x5c8687['user'][_0x2d9b('0x29')]===_0x2d9b('0x2a')){if(!_0x5c8687[_0x2d9b('0x5b')]['newPassword']){throw new db[(_0x2d9b('0x90'))][(_0x2d9b('0x93'))](_0x2d9b('0x96'));}}else if(_0x5c8687[_0x2d9b('0x2c')][_0x2d9b('0x29')]===_0x2d9b('0x2c')){if(!_0x5c8687[_0x2d9b('0x5b')][_0x2d9b('0x8f')]){throw new db[(_0x2d9b('0x90'))][(_0x2d9b('0x93'))](_0x2d9b('0x96'));}if(_0xab88f5[_0x2d9b('0x29')]!==_0x2d9b('0x6e')){throw new db['Sequelize'][(_0x2d9b('0x93'))](_0x2d9b('0x7d'));}}else{throw new db[(_0x2d9b('0x90'))][(_0x2d9b('0x93'))](_0x2d9b('0x7d'));}return _0xab88f5;})['then'](handleEntityNotFound(_0x2bf134,null))[_0x2d9b('0x15')](function(_0x4a2e77){return db['Setting']['findOne']({'attributes':['id',_0x2d9b('0x64'),_0x2d9b('0x97'),_0x2d9b('0x98')]})[_0x2d9b('0x15')](function(_0x4a0317){if(_0x4a0317[_0x2d9b('0x64')])authService[_0x2d9b('0x99')](_0x5c8687[_0x2d9b('0x5b')]['newPassword']);if(!_0x4a0317['enforcePasswordHistory']||!_0x4a2e77[_0x2d9b('0x9a')])return _0x4a2e77;authService[_0x2d9b('0x9b')](_0x5c8687[_0x2d9b('0x5b')][_0x2d9b('0x8f')],_0x4a2e77[_0x2d9b('0x9a')],_0x4a0317['passwordHistoryLimit']);return _0x4a2e77;})['then'](saveUpdates({'password':_0x5c8687[_0x2d9b('0x5b')]['newPassword'],'passwordResetAt':_0x5c8687[_0x2d9b('0x2c')]['id']==_0x5c8687[_0x2d9b('0x50')]['id']?moment():null,'previousPasswords':authService[_0x2d9b('0x9c')](_0x5c8687['body'][_0x2d9b('0x8f')],_0x4a2e77[_0x2d9b('0x9a')])},null));})[_0x2d9b('0x15')](respondWithResult(_0x2bf134,null))['catch'](handleError(_0x2bf134,null));};exports['addQueues']=function(_0x1b98d6,_0x39ba6b){var _0x4cd70f=_0x1b98d6[_0x2d9b('0x5b')]['channel'];return db[_0x2d9b('0x36')]['find']({'where':{'id':_0x1b98d6[_0x2d9b('0x50')]['id']},'attributes':['id',_0x2d9b('0x33'),'role',_0x2d9b('0x9d'),_0x2d9b('0x9e'),_0x2d9b('0x9f'),_0x2d9b('0xa0')]})[_0x2d9b('0x15')](handleEntityNotFound(_0x39ba6b,null))[_0x2d9b('0x15')](function(_0x34ef7c){if(_0x34ef7c){if(!utils[_0x2d9b('0xa1')](_0x4cd70f)){throw new db[(_0x2d9b('0x90'))][(_0x2d9b('0x93'))]('Unknown\x20channel');}return _0x34ef7c['add'+_[_0x2d9b('0xa2')](_0x4cd70f[_0x2d9b('0xa3')]())+'Queues'](_0x1b98d6['body'][_0x2d9b('0x5f')],{'penalty':_0x1b98d6[_0x2d9b('0x5b')][_0x2d9b('0xa4')]||0x0})[_0x2d9b('0xa5')](function(_0x1964dc){for(var _0x2683f0=0x0;_0x2683f0<_0x1b98d6[_0x2d9b('0x5b')][_0x2d9b('0x5f')][_0x2d9b('0x48')];_0x2683f0+=0x1){var _0x233689={'UserId':Number(_0x1b98d6[_0x2d9b('0x50')]['id'])};_0x233689[_['capitalize'](_0x4cd70f[_0x2d9b('0xa3')]())+_0x2d9b('0xa6')]=Number(_0x1b98d6[_0x2d9b('0x5b')]['ids'][_0x2683f0]);socket[_0x2d9b('0xa7')]('user'+_[_0x2d9b('0xa2')](_0x4cd70f[_0x2d9b('0xa3')]())+_0x2d9b('0xa8'),_0x233689);}return _0x1964dc;})[_0x2d9b('0x15')](function(){if(_0x4cd70f===_0x2d9b('0xa9')){return db[_0x2d9b('0xaa')][_0x2d9b('0x45')]({'where':{'id':_0x1b98d6[_0x2d9b('0x5b')][_0x2d9b('0x5f')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x2d9b('0x15')](function(_0x4b082e){var _0x17a0c3=_0x34ef7c['get']({'plain':!![]});var _0x28cd71=[];if(_0x4cd70f===_0x2d9b('0xa9')&&_0x17a0c3['role']===_0x2d9b('0x6e')&&_0x17a0c3[_0x2d9b('0x9d')]){for(var _0x21b24c=0x0;_0x21b24c<_0x4b082e[_0x2d9b('0x48')];_0x21b24c+=0x1){_0x28cd71[_0x2d9b('0x44')]({'membername':_0x17a0c3[_0x2d9b('0x33')],'UserId':_0x17a0c3['id'],'queue_name':_0x4b082e[_0x21b24c]['name'],'VoiceQueueId':_0x4b082e[_0x21b24c]['id'],'interface':_[_0x2d9b('0x66')](_0x17a0c3[_0x2d9b('0xa0')])?util['format'](_0x2d9b('0xab'),_0x17a0c3['name']):_0x17a0c3['interface'],'paused':_0x17a0c3[_0x2d9b('0x9f')]||![],'penalty':_0x1b98d6[_0x2d9b('0x5b')][_0x2d9b('0xa4')]||0x0});}return BPromise[_0x2d9b('0x89')](_0x28cd71,function(_0xac5b0f){return db[_0x2d9b('0xac')][_0x2d9b('0xad')](_0xac5b0f);});}return _0x34ef7c;});}})[_0x2d9b('0x15')](respondWithStatusCode(_0x39ba6b,null))['catch'](handleError(_0x39ba6b,null));};exports[_0x2d9b('0xae')]=function(_0x197177,_0x7c7ff9){var _0x222d48,_0xd2072d;return db[_0x2d9b('0x36')]['find']({'where':{'id':_0x197177[_0x2d9b('0x50')]['id']},'attributes':['id',_0x2d9b('0x33'),_0x2d9b('0x29')]})[_0x2d9b('0x15')](handleEntityNotFound(_0x7c7ff9,null))[_0x2d9b('0x15')](function(_0x1311a6){if(_0x1311a6){_0x222d48=_0x1311a6;if(!_0x197177[_0x2d9b('0x3e')][_0x2d9b('0xaf')]||!utils[_0x2d9b('0xa1')](_0x197177['query'][_0x2d9b('0xaf')])){throw new db[(_0x2d9b('0x90'))][(_0x2d9b('0x93'))]('Unknown\x20channel');}return _0x1311a6['remove'+_[_0x2d9b('0xa2')](_0x197177[_0x2d9b('0x3e')][_0x2d9b('0xaf')][_0x2d9b('0xa3')]())+_0x2d9b('0xb0')](_0x197177[_0x2d9b('0x3e')][_0x2d9b('0x5f')]);}})[_0x2d9b('0x15')](function(_0x3bf40d){if(_[_0x2d9b('0xb1')](_0x197177[_0x2d9b('0x3e')][_0x2d9b('0x5f')])){for(var _0x497d85=0x0;_0x497d85<_0x197177[_0x2d9b('0x3e')][_0x2d9b('0x5f')][_0x2d9b('0x48')];_0x497d85+=0x1){_0xd2072d={'UserId':Number(_0x197177[_0x2d9b('0x50')]['id'])};_0xd2072d[_[_0x2d9b('0xa2')](_0x197177[_0x2d9b('0x3e')]['channel'][_0x2d9b('0xa3')]())+_0x2d9b('0xa6')]=Number(_0x197177[_0x2d9b('0x3e')][_0x2d9b('0x5f')][_0x497d85]);socket[_0x2d9b('0xa7')](_0x2d9b('0x2c')+_[_0x2d9b('0xa2')](_0x197177[_0x2d9b('0x3e')][_0x2d9b('0xaf')][_0x2d9b('0xa3')]())+_0x2d9b('0xb2'),_0xd2072d);}}else{_0xd2072d={'UserId':Number(_0x197177[_0x2d9b('0x50')]['id'])};_0xd2072d[_['capitalize'](_0x197177[_0x2d9b('0x3e')][_0x2d9b('0xaf')][_0x2d9b('0xa3')]())+_0x2d9b('0xa6')]=Number(_0x197177[_0x2d9b('0x3e')][_0x2d9b('0x5f')]);socket[_0x2d9b('0xa7')](_0x2d9b('0x2c')+_[_0x2d9b('0xa2')](_0x197177['query'][_0x2d9b('0xaf')][_0x2d9b('0xa3')]())+_0x2d9b('0xb2'),_0xd2072d);}return _0x3bf40d;})[_0x2d9b('0x15')](function(){if(_0x197177[_0x2d9b('0x3e')]['channel']==='voice'){return db[_0x2d9b('0xac')][_0x2d9b('0x27')]({'where':{'UserId':_0x197177[_0x2d9b('0x50')]['id'],'VoiceQueueId':_0x197177[_0x2d9b('0x3e')]['ids']},'individualHooks':!![]})[_0x2d9b('0x15')](function(){return _0x222d48;});}return _0x222d48;})[_0x2d9b('0x15')](respondWithStatusCode(_0x7c7ff9,null))[_0x2d9b('0x1e')](handleError(_0x7c7ff9,null));};exports[_0x2d9b('0xb3')]=function(_0x27cecf,_0x4b0e1f){_0x27cecf[_0x2d9b('0x5b')][_0x2d9b('0xb4')]=_0x27cecf[_0x2d9b('0xb5')][_0x2d9b('0xb6')];return db[_0x2d9b('0x36')][_0x2d9b('0x5c')]({'where':{'id':_0x27cecf[_0x2d9b('0x50')]['id']}})[_0x2d9b('0x15')](handleEntityNotFound(_0x4b0e1f,null))['then'](saveUpdates(_0x27cecf[_0x2d9b('0x5b')],null))['then'](respondWithResult(_0x4b0e1f,null))[_0x2d9b('0x1e')](handleError(_0x4b0e1f,null));};exports['getAvatar']=function(_0x27f0f3,_0x4bad3c){var _0x27d9bd=path[_0x2d9b('0xb7')](config[_0x2d9b('0xb8')],_0x2d9b('0xb9'));return db['User'][_0x2d9b('0x5c')]({'where':{'id':_0x27f0f3[_0x2d9b('0x50')]['id']},'attributes':['id',_0x2d9b('0xb4')],'raw':!![]})[_0x2d9b('0x15')](handleEntityNotFound(_0x4bad3c,null))['then'](function(_0x2d63ec){if(_0x2d63ec){if(_[_0x2d9b('0x66')](_0x2d63ec[_0x2d9b('0xb4')])){return _0x4bad3c[_0x2d9b('0xba')](_0x27d9bd);}else{if(!fs['existsSync'](path[_0x2d9b('0xb7')](config[_0x2d9b('0xb8')],'server/files/images/',_0x2d63ec[_0x2d9b('0xb4')]))){return _0x4bad3c[_0x2d9b('0xba')](_0x27d9bd);}return _0x4bad3c['download'](path[_0x2d9b('0xb7')](config[_0x2d9b('0xb8')],_0x2d9b('0xbb'),_0x2d63ec[_0x2d9b('0xb4')]));}}})['catch'](handleError(_0x4bad3c,null));};exports['getOpenTabs']=function(_0x1dd46b,_0x1c022b){return db[_0x2d9b('0x36')][_0x2d9b('0x5c')]({'where':{'id':_0x1dd46b['params']['id']},'attributes':['id']})[_0x2d9b('0x15')](handleEntityNotFound(_0x1c022b,null))['then'](function(_0x2f3154){var _0x4bb96c=[];values=_0x2f3154[_0x2d9b('0x49')];_0x4bb96c[_0x2d9b('0x44')](get_open_tabs(_0x2d9b('0x59'),_0x2f3154[_0x2d9b('0x49')]));_0x4bb96c[_0x2d9b('0x44')](get_open_tabs('sms',_0x2f3154[_0x2d9b('0x49')]));_0x4bb96c[_0x2d9b('0x44')](get_open_tabs(_0x2d9b('0x5a'),_0x2f3154[_0x2d9b('0x49')]));_0x4bb96c[_0x2d9b('0x44')](get_open_tabs(_0x2d9b('0x4d'),_0x2f3154[_0x2d9b('0x49')]));_0x4bb96c['push'](get_open_tabs('fax',_0x2f3154['dataValues']));_0x4bb96c['push'](get_open_tabs('mail',_0x2f3154[_0x2d9b('0x49')]));return BPromise[_0x2d9b('0x4e')](_0x4bb96c);})['then'](function(_0x5010e0){if(_0x5010e0){var _0x5edcd5=_[_0x2d9b('0x2f')](values[_0x2d9b('0xbc')],function(_0x1503a9){return{'channel':_0x2d9b('0xbd'),'id':_0x1503a9['id'],'createdAt':_0x1503a9[_0x2d9b('0xbe')]};});var _0x99b3c5=_['map'](values[_0x2d9b('0xbf')],function(_0x6d94d3){return{'channel':'FAX','id':_0x6d94d3['id'],'createdAt':_0x6d94d3[_0x2d9b('0xbe')]};});var _0x44a670=_[_0x2d9b('0x2f')](values[_0x2d9b('0xc0')],function(_0x424447){return{'channel':'OPENCHANNEL','id':_0x424447['id'],'createdAt':_0x424447[_0x2d9b('0xbe')]};});var _0x27281c=_[_0x2d9b('0x2f')](values[_0x2d9b('0xc1')],function(_0x330a71){return{'channel':'MAIL','id':_0x330a71['id'],'createdAt':_0x330a71[_0x2d9b('0xbe')]};});var _0x1f6a97=_[_0x2d9b('0x2f')](values[_0x2d9b('0xc2')],function(_0x529ecf){return{'channel':_0x2d9b('0xc3'),'id':_0x529ecf['id'],'createdAt':_0x529ecf[_0x2d9b('0xbe')]};});var _0x4bf61f=_[_0x2d9b('0x2f')](values[_0x2d9b('0xc4')],function(_0x13eee7){return{'channel':_0x2d9b('0xc5'),'id':_0x13eee7['id'],'createdAt':_0x13eee7[_0x2d9b('0xbe')]};});var _0x354e07=_[_0x2d9b('0xc6')](_0x5edcd5,_0x99b3c5,_0x44a670,_0x27281c,_0x1f6a97,_0x4bf61f);var _0x9923ba={'count':_0x354e07[_0x2d9b('0x48')],'rows':_0x354e07};return _0x9923ba;}else return null;})[_0x2d9b('0x15')](respondWithResult(_0x1c022b,null))[_0x2d9b('0x1e')](handleError(_0x1c022b,null));};exports['getContacts']=function(_0x135992,_0x27eb59){var _0x4c4829={};var _0x3dcfcb={};var _0x1c6f0b;var _0x2a36d5;return db[_0x2d9b('0x36')]['findOne']({'where':{'id':_0x135992[_0x2d9b('0x50')]['id']}})[_0x2d9b('0x15')](handleEntityNotFound(_0x27eb59,null))[_0x2d9b('0x15')](function(_0x3a348a){if(_0x3a348a){_0x1c6f0b=_0x3a348a;_0x3dcfcb[_0x2d9b('0x51')]=_[_0x2d9b('0x53')](db[_0x2d9b('0xc7')][_0x2d9b('0x37')]);_0x3dcfcb['query']=_[_0x2d9b('0x53')](_0x135992['query']);_0x3dcfcb[_0x2d9b('0x55')]=_[_0x2d9b('0x56')](_0x3dcfcb[_0x2d9b('0x51')],_0x3dcfcb[_0x2d9b('0x3e')]);_0x4c4829[_0x2d9b('0x43')]=_[_0x2d9b('0x56')](_0x3dcfcb[_0x2d9b('0x51')],qs[_0x2d9b('0x57')](_0x135992[_0x2d9b('0x3e')][_0x2d9b('0x57')]));_0x4c4829[_0x2d9b('0x43')]=_0x4c4829[_0x2d9b('0x43')][_0x2d9b('0x48')]?_0x4c4829[_0x2d9b('0x43')]:_0x3dcfcb['model'];_0x4c4829[_0x2d9b('0xc8')]=qs[_0x2d9b('0xc9')](_0x135992[_0x2d9b('0x3e')]['sort']);_0x4c4829[_0x2d9b('0x3c')]=qs[_0x2d9b('0x55')](_[_0x2d9b('0xca')](_0x135992[_0x2d9b('0x3e')],_0x3dcfcb[_0x2d9b('0x55')]));if(_0x135992['query'][_0x2d9b('0x2e')]){_0x4c4829[_0x2d9b('0x3c')]=_[_0x2d9b('0xcb')](_0x4c4829['where'],{'$or':_[_0x2d9b('0x2f')](_0x4c4829[_0x2d9b('0x43')],function(_0x38b5dd){var _0x495105={};_0x495105[_0x38b5dd]={'$like':'%'+_0x135992[_0x2d9b('0x3e')][_0x2d9b('0x2e')]+'%'};return _0x495105;})});}_0x4c4829=_['merge']({},_0x4c4829,_0x135992[_0x2d9b('0xcc')]);return _0x1c6f0b['getContacts'](_0x4c4829);}})['then'](function(_0x509ca4){if(_0x509ca4){_0x2a36d5=_0x509ca4['length'];if(_0x135992['query']['hasOwnProperty']('includeAll')){_0x4c4829['include']=[{'model':db[_0x2d9b('0xcd')],'as':_0x2d9b('0xce'),'required':![]},{'model':db[_0x2d9b('0xcf')],'as':_0x2d9b('0xd0'),'attributes':['id',_0x2d9b('0x33'),'color'],'where':_0x135992[_0x2d9b('0x3e')][_0x2d9b('0xd1')]?{'id':_0x135992['query'][_0x2d9b('0xd1')]}:undefined,'required':_0x135992[_0x2d9b('0x3e')][_0x2d9b('0xd1')]?!![]:![]}];}if(!_0x135992[_0x2d9b('0x3e')][_0x2d9b('0xd2')]('nolimit')){_0x4c4829['limit']=qs['limit'](_0x135992[_0x2d9b('0x3e')][_0x2d9b('0x22')]);_0x4c4829[_0x2d9b('0x23')]=qs[_0x2d9b('0x23')](_0x135992[_0x2d9b('0x3e')][_0x2d9b('0x23')]);}return _0x1c6f0b[_0x2d9b('0xd3')](_0x4c4829);}})[_0x2d9b('0x15')](function(_0x584665){if(_0x584665){return _0x584665?{'count':_0x2a36d5,'rows':_0x584665}:null;}})[_0x2d9b('0x15')](respondWithResult(_0x27eb59,null))[_0x2d9b('0x1e')](handleError(_0x27eb59,null));};exports[_0x2d9b('0xd4')]=function(_0x4f501e,_0x49db4a){var _0x3c8e97;var _0x4c7cc7={};var _0x2e4d68;return db['User'][_0x2d9b('0xd5')]({'where':{'id':_0x4f501e[_0x2d9b('0x50')]['id']},'attributes':['id',_0x2d9b('0x33'),_0x2d9b('0x29')]})[_0x2d9b('0x15')](handleEntityNotFound(_0x49db4a,null))[_0x2d9b('0x15')](function(_0x318052){if(!utils[_0x2d9b('0xa1')](_0x4f501e['query'][_0x2d9b('0xaf')])){throw new db[(_0x2d9b('0x90'))][(_0x2d9b('0x93'))](_0x2d9b('0xd6'));}_0x3c8e97=_0x318052;var _0x5ac58a={};_0x5ac58a[_0x2d9b('0x51')]=_[_0x2d9b('0x53')](db[_[_0x2d9b('0xa2')](_0x4f501e[_0x2d9b('0x3e')]['channel'])+_0x2d9b('0xd7')][_0x2d9b('0x37')]);_0x5ac58a['query']=_['keys'](_0x4f501e[_0x2d9b('0x3e')]);_0x5ac58a[_0x2d9b('0x55')]=_[_0x2d9b('0x56')](_0x5ac58a[_0x2d9b('0x51')],_0x5ac58a[_0x2d9b('0x3e')]);_0x4c7cc7[_0x2d9b('0x43')]=_[_0x2d9b('0x56')](_0x5ac58a[_0x2d9b('0x51')],qs[_0x2d9b('0x57')](_0x4f501e['query'][_0x2d9b('0x57')]));_0x4c7cc7[_0x2d9b('0x43')]=_0x4c7cc7[_0x2d9b('0x43')][_0x2d9b('0x48')]?_0x4c7cc7['attributes']:_0x5ac58a['model'];_0x4c7cc7[_0x2d9b('0xc8')]=qs['sort'](_0x4f501e[_0x2d9b('0x3e')][_0x2d9b('0xc9')]);_0x4c7cc7[_0x2d9b('0x3c')]=qs[_0x2d9b('0x55')](_['pick'](_0x4f501e[_0x2d9b('0x3e')],_0x5ac58a[_0x2d9b('0x55')]));if(_0x4f501e['query'][_0x2d9b('0x2e')]){_0x4c7cc7[_0x2d9b('0x3c')]=_[_0x2d9b('0xcb')](_0x4c7cc7[_0x2d9b('0x3c')],{'$or':_[_0x2d9b('0x2f')](_0x4c7cc7[_0x2d9b('0x43')],function(_0x3aae29){var _0x4ccf94={};_0x4ccf94[_0x3aae29]={'$like':'%'+_0x4f501e[_0x2d9b('0x3e')][_0x2d9b('0x2e')]+'%'};return _0x4ccf94;})});}_0x4c7cc7=_[_0x2d9b('0xcb')]({},_0x4c7cc7,_0x4f501e[_0x2d9b('0xcc')]);switch(_0x3c8e97[_0x2d9b('0x29')]){case _0x2d9b('0x2a'):return db[_[_0x2d9b('0xa2')](_0x4f501e[_0x2d9b('0x3e')][_0x2d9b('0xaf')])+_0x2d9b('0xd7')]['findAll'](_0x4c7cc7);case _0x2d9b('0x2c'):case _0x2d9b('0x6e'):return _0x3c8e97[_0x2d9b('0x28')+_['capitalize'](_0x4f501e[_0x2d9b('0x3e')]['channel'])+_0x2d9b('0xb0')](_0x4c7cc7);default:throw new db[(_0x2d9b('0x90'))][(_0x2d9b('0x93'))](_0x2d9b('0xd8'));}})[_0x2d9b('0x15')](function(_0x4425da){_0x2e4d68=_0x4425da[_0x2d9b('0x48')];if(!_0x4f501e['query'][_0x2d9b('0xd2')](_0x2d9b('0xd9'))){_0x4c7cc7[_0x2d9b('0x22')]=qs[_0x2d9b('0x22')](_0x4f501e[_0x2d9b('0x3e')][_0x2d9b('0x22')]);_0x4c7cc7[_0x2d9b('0x23')]=qs[_0x2d9b('0x23')](_0x4f501e[_0x2d9b('0x3e')][_0x2d9b('0x23')]);}switch(_0x3c8e97[_0x2d9b('0x29')]){case _0x2d9b('0x2a'):return db[_[_0x2d9b('0xa2')](_0x4f501e[_0x2d9b('0x3e')][_0x2d9b('0xaf')])+_0x2d9b('0xd7')][_0x2d9b('0x45')](_0x4c7cc7);case _0x2d9b('0x2c'):case _0x2d9b('0x6e'):return _0x3c8e97[_0x2d9b('0x28')+_[_0x2d9b('0xa2')](_0x4f501e[_0x2d9b('0x3e')][_0x2d9b('0xaf')])+_0x2d9b('0xb0')](_0x4c7cc7);}})[_0x2d9b('0x15')](function(_0x4e968a){return{'count':_0x2e4d68,'rows':_0x4e968a};})[_0x2d9b('0x15')](respondWithResult(_0x49db4a,null))[_0x2d9b('0x1e')](handleError(_0x49db4a,null));};exports[_0x2d9b('0xda')]=function(_0x35d254,_0x5d98ad){var _0x451cfa={};var _0x403883={};var _0x4201ca;var _0x52344b;return db[_0x2d9b('0x36')][_0x2d9b('0xd5')]({'where':{'id':_0x35d254[_0x2d9b('0x50')]['id']}})['then'](handleEntityNotFound(_0x5d98ad,null))[_0x2d9b('0x15')](function(_0x202989){if(_0x202989){_0x4201ca=_0x202989;_0x403883[_0x2d9b('0x51')]=_[_0x2d9b('0x53')](db['UserVoiceQueueRt']['rawAttributes']);_0x403883[_0x2d9b('0x3e')]=_[_0x2d9b('0x53')](_0x35d254[_0x2d9b('0x3e')]);_0x403883[_0x2d9b('0x55')]=_[_0x2d9b('0x56')](_0x403883[_0x2d9b('0x51')],_0x403883['query']);_0x451cfa['attributes']=_['intersection'](_0x403883[_0x2d9b('0x51')],qs['fields'](_0x35d254[_0x2d9b('0x3e')][_0x2d9b('0x57')]));_0x451cfa['attributes']=_0x451cfa['attributes']['length']?_0x451cfa['attributes']:_0x403883[_0x2d9b('0x51')];_0x451cfa['order']=qs[_0x2d9b('0xc9')](_0x35d254[_0x2d9b('0x3e')][_0x2d9b('0xc9')]);_0x451cfa['where']=qs['filters'](_[_0x2d9b('0xca')](_0x35d254[_0x2d9b('0x3e')],_0x403883['filters']));if(_0x35d254[_0x2d9b('0x3e')][_0x2d9b('0x2e')]){_0x451cfa[_0x2d9b('0x3c')]=_[_0x2d9b('0xcb')](_0x451cfa['where'],{'$or':_[_0x2d9b('0x2f')](_0x451cfa[_0x2d9b('0x43')],function(_0x22af22){var _0x46f6a3={};_0x46f6a3[_0x22af22]={'$like':'%'+_0x35d254[_0x2d9b('0x3e')][_0x2d9b('0x2e')]+'%'};return _0x46f6a3;})});}_0x451cfa=_['merge']({},_0x451cfa,_0x35d254[_0x2d9b('0xcc')]);return _0x4201ca[_0x2d9b('0xda')](_0x451cfa);}})[_0x2d9b('0x15')](function(_0x38a552){if(_0x38a552){_0x52344b=_0x38a552[_0x2d9b('0x48')];if(!_0x35d254['query'][_0x2d9b('0xd2')](_0x2d9b('0xd9'))){_0x451cfa[_0x2d9b('0x22')]=qs[_0x2d9b('0x22')](_0x35d254['query'][_0x2d9b('0x22')]);_0x451cfa['offset']=qs[_0x2d9b('0x23')](_0x35d254[_0x2d9b('0x3e')]['offset']);}return _0x4201ca['getVoiceQueuesRt'](_0x451cfa);}})[_0x2d9b('0x15')](function(_0x3a1702){if(_0x3a1702){return _0x3a1702?{'count':_0x52344b,'rows':_0x3a1702}:null;}})['then'](respondWithResult(_0x5d98ad,null))['catch'](handleError(_0x5d98ad,null));};exports['getGroups']=function(_0x1c46eb,_0xa492d8){var _0x26ce44={};var _0x4e7c07={};var _0x594342;var _0x584cb1;return db[_0x2d9b('0x36')]['findOne']({'where':{'id':_0x1c46eb['params']['id']}})[_0x2d9b('0x15')](handleEntityNotFound(_0xa492d8,null))[_0x2d9b('0x15')](function(_0x140318){if(_0x140318){_0x594342=_0x140318;_0x4e7c07[_0x2d9b('0x51')]=_[_0x2d9b('0x53')](db[_0x2d9b('0xdb')][_0x2d9b('0x37')]);_0x4e7c07[_0x2d9b('0x3e')]=_[_0x2d9b('0x53')](_0x1c46eb['query']);_0x4e7c07[_0x2d9b('0x55')]=_['intersection'](_0x4e7c07[_0x2d9b('0x51')],_0x4e7c07[_0x2d9b('0x3e')]);_0x26ce44[_0x2d9b('0x43')]=_[_0x2d9b('0x56')](_0x4e7c07[_0x2d9b('0x51')],qs[_0x2d9b('0x57')](_0x1c46eb[_0x2d9b('0x3e')][_0x2d9b('0x57')]));_0x26ce44[_0x2d9b('0x43')]=_0x26ce44['attributes'][_0x2d9b('0x48')]?_0x26ce44['attributes']:_0x4e7c07[_0x2d9b('0x51')];_0x26ce44['order']=qs['sort'](_0x1c46eb['query'][_0x2d9b('0xc9')]);_0x26ce44[_0x2d9b('0x3c')]=qs[_0x2d9b('0x55')](_[_0x2d9b('0xca')](_0x1c46eb[_0x2d9b('0x3e')],_0x4e7c07[_0x2d9b('0x55')]));if(_0x1c46eb[_0x2d9b('0x3e')][_0x2d9b('0x2e')]){_0x26ce44[_0x2d9b('0x3c')]=_[_0x2d9b('0xcb')](_0x26ce44[_0x2d9b('0x3c')],{'$or':_[_0x2d9b('0x2f')](_0x26ce44[_0x2d9b('0x43')],function(_0x9161f){var _0x20abde={};_0x20abde[_0x9161f]={'$like':'%'+_0x1c46eb[_0x2d9b('0x3e')]['filter']+'%'};return _0x20abde;})});}_0x26ce44=_[_0x2d9b('0xcb')]({},_0x26ce44,_0x1c46eb['options']);return _0x594342['getGroups'](_0x26ce44);}})[_0x2d9b('0x15')](function(_0x519ba1){if(_0x519ba1){_0x584cb1=_0x519ba1[_0x2d9b('0x48')];if(!_0x1c46eb[_0x2d9b('0x3e')][_0x2d9b('0xd2')](_0x2d9b('0xd9'))){_0x26ce44[_0x2d9b('0x22')]=qs[_0x2d9b('0x22')](_0x1c46eb['query'][_0x2d9b('0x22')]);_0x26ce44[_0x2d9b('0x23')]=qs[_0x2d9b('0x23')](_0x1c46eb['query'][_0x2d9b('0x23')]);}return _0x594342[_0x2d9b('0xdc')](_0x26ce44);}})[_0x2d9b('0x15')](function(_0x1a8be4){if(_0x1a8be4){return _0x1a8be4?{'count':_0x584cb1,'rows':_0x1a8be4}:null;}})[_0x2d9b('0x15')](respondWithResult(_0xa492d8,null))[_0x2d9b('0x1e')](handleError(_0xa492d8,null));};exports[_0x2d9b('0xdd')]=function(_0x545ad2,_0x40507b){var _0x34f924={'raw':!![],'where':{}};var _0x11d8f7={};var _0x1ddfd6={'count':0x0,'rows':[]};return db[_0x2d9b('0x36')][_0x2d9b('0xd5')]({'where':{'id':_0x545ad2[_0x2d9b('0x50')]['id']}})[_0x2d9b('0x15')](handleEntityNotFound(_0x40507b,null))[_0x2d9b('0x15')](function(_0x33c787){if(_0x33c787){_0x11d8f7[_0x2d9b('0x51')]=_['keys'](db['VoiceRecording']['rawAttributes']);_0x11d8f7[_0x2d9b('0x3e')]=_[_0x2d9b('0x53')](_0x545ad2['query']);_0x11d8f7[_0x2d9b('0x55')]=_['intersection'](_0x11d8f7[_0x2d9b('0x51')],_0x11d8f7[_0x2d9b('0x3e')]);_0x34f924[_0x2d9b('0x43')]=_[_0x2d9b('0x56')](_0x11d8f7[_0x2d9b('0x51')],qs[_0x2d9b('0x57')](_0x545ad2[_0x2d9b('0x3e')][_0x2d9b('0x57')]));_0x34f924['attributes']=_0x34f924[_0x2d9b('0x43')][_0x2d9b('0x48')]?_0x34f924[_0x2d9b('0x43')]:_0x11d8f7[_0x2d9b('0x51')];if(!_0x545ad2[_0x2d9b('0x3e')]['hasOwnProperty'](_0x2d9b('0xd9'))){_0x34f924[_0x2d9b('0x22')]=qs[_0x2d9b('0x22')](_0x545ad2[_0x2d9b('0x3e')][_0x2d9b('0x22')]);_0x34f924[_0x2d9b('0x23')]=qs[_0x2d9b('0x23')](_0x545ad2[_0x2d9b('0x3e')][_0x2d9b('0x23')]);}_0x34f924['order']=qs['sort'](_0x545ad2[_0x2d9b('0x3e')][_0x2d9b('0xc9')]);_0x34f924['where']=qs[_0x2d9b('0x55')](_[_0x2d9b('0xca')](_0x545ad2['query'],_0x11d8f7[_0x2d9b('0x55')]));_0x34f924[_0x2d9b('0x3c')][_0x2d9b('0xde')]=_0x33c787['id'];if(_0x545ad2[_0x2d9b('0x3e')]['filter']){_0x34f924[_0x2d9b('0x3c')]=_[_0x2d9b('0xcb')](_0x34f924[_0x2d9b('0x3c')],{'$or':_[_0x2d9b('0x2f')](_0x34f924[_0x2d9b('0x43')],function(_0x320c1b){var _0x4248fb={};_0x4248fb[_0x320c1b]={'$like':'%'+_0x545ad2['query'][_0x2d9b('0x2e')]+'%'};return _0x4248fb;})});}_0x34f924=_[_0x2d9b('0xcb')]({},_0x34f924,_0x545ad2[_0x2d9b('0xcc')]);return db[_0x2d9b('0xdf')][_0x2d9b('0x3d')]({'where':_0x34f924[_0x2d9b('0x3c')]})[_0x2d9b('0x15')](function(_0x198de1){_0x1ddfd6[_0x2d9b('0x3d')]=_0x198de1;if(_0x545ad2[_0x2d9b('0x3e')][_0x2d9b('0x58')]){_0x34f924[_0x2d9b('0x3f')]=[{'all':!![]}];}return db[_0x2d9b('0xdf')][_0x2d9b('0x45')](_0x34f924);})[_0x2d9b('0x15')](function(_0x210f0e){_0x1ddfd6[_0x2d9b('0x46')]=_0x210f0e;return _0x1ddfd6;});}})['then'](respondWithFilteredResult(_0x40507b,_0x34f924))[_0x2d9b('0x1e')](handleError(_0x40507b,null));};exports[_0x2d9b('0xe0')]=function(_0x55c7a6,_0x43980f){var _0x2360e5={'raw':!![],'where':{}};var _0x1e363c={};var _0x4b58a0={'count':0x0,'rows':[]};return db[_0x2d9b('0x36')][_0x2d9b('0xd5')]({'where':{'id':_0x55c7a6['params']['id']}})[_0x2d9b('0x15')](handleEntityNotFound(_0x43980f,null))[_0x2d9b('0x15')](function(_0x5f46c8){if(_0x5f46c8){_0x1e363c[_0x2d9b('0x51')]=_[_0x2d9b('0x53')](db[_0x2d9b('0xe1')][_0x2d9b('0x37')]);_0x1e363c[_0x2d9b('0x3e')]=_[_0x2d9b('0x53')](_0x55c7a6[_0x2d9b('0x3e')]);_0x1e363c[_0x2d9b('0x55')]=_[_0x2d9b('0x56')](_0x1e363c[_0x2d9b('0x51')],_0x1e363c[_0x2d9b('0x3e')]);_0x2360e5[_0x2d9b('0x43')]=_[_0x2d9b('0x56')](_0x1e363c[_0x2d9b('0x51')],qs['fields'](_0x55c7a6[_0x2d9b('0x3e')][_0x2d9b('0x57')]));_0x2360e5[_0x2d9b('0x43')]=_0x2360e5['attributes'][_0x2d9b('0x48')]?_0x2360e5['attributes']:_0x1e363c[_0x2d9b('0x51')];if(!_0x55c7a6[_0x2d9b('0x3e')][_0x2d9b('0xd2')]('nolimit')){_0x2360e5[_0x2d9b('0x22')]=qs['limit'](_0x55c7a6[_0x2d9b('0x3e')][_0x2d9b('0x22')]);_0x2360e5[_0x2d9b('0x23')]=qs[_0x2d9b('0x23')](_0x55c7a6['query'][_0x2d9b('0x23')]);}_0x2360e5[_0x2d9b('0xc8')]=qs[_0x2d9b('0xc9')](_0x55c7a6[_0x2d9b('0x3e')][_0x2d9b('0xc9')]);_0x2360e5[_0x2d9b('0x3c')]=qs['filters'](_[_0x2d9b('0xca')](_0x55c7a6['query'],_0x1e363c[_0x2d9b('0x55')]));_0x2360e5[_0x2d9b('0x3c')][_0x2d9b('0xde')]=_0x5f46c8['id'];if(_0x55c7a6[_0x2d9b('0x3e')]['filter']){_0x2360e5[_0x2d9b('0x3c')]=_[_0x2d9b('0xcb')](_0x2360e5[_0x2d9b('0x3c')],{'$or':_['map'](_0x2360e5[_0x2d9b('0x43')],function(_0x4688a9){var _0x5a84ca={};_0x5a84ca[_0x4688a9]={'$like':'%'+_0x55c7a6[_0x2d9b('0x3e')][_0x2d9b('0x2e')]+'%'};return _0x5a84ca;})});}_0x2360e5=_[_0x2d9b('0xcb')]({},_0x2360e5,_0x55c7a6[_0x2d9b('0xcc')]);return db[_0x2d9b('0xe1')]['count']({'where':_0x2360e5['where']})[_0x2d9b('0x15')](function(_0x220037){_0x4b58a0[_0x2d9b('0x3d')]=_0x220037;if(_0x55c7a6['query']['includeAll']){_0x2360e5[_0x2d9b('0x3f')]=[{'all':!![]}];}return db['ScreenRecording'][_0x2d9b('0x45')](_0x2360e5);})[_0x2d9b('0x15')](function(_0x527747){_0x4b58a0[_0x2d9b('0x46')]=_0x527747;return _0x4b58a0;});}})[_0x2d9b('0x15')](respondWithFilteredResult(_0x43980f,_0x2360e5))[_0x2d9b('0x1e')](handleError(_0x43980f,null));};exports[_0x2d9b('0xe2')]=function(_0x163a68,_0x4cbb72){var _0x373d98={};var _0x3f8a9d={};var _0x2c7d69;var _0xfe0ad0;return db[_0x2d9b('0x36')][_0x2d9b('0xd5')]({'where':{'id':_0x163a68[_0x2d9b('0x50')]['id']}})[_0x2d9b('0x15')](handleEntityNotFound(_0x4cbb72,null))[_0x2d9b('0x15')](function(_0x18808b){if(_0x18808b){_0x2c7d69=_0x18808b;_0x3f8a9d[_0x2d9b('0x51')]=_[_0x2d9b('0x53')](db['ChatInteraction'][_0x2d9b('0x37')]);_0x3f8a9d['query']=_['keys'](_0x163a68[_0x2d9b('0x3e')]);_0x3f8a9d['filters']=_[_0x2d9b('0x56')](_0x3f8a9d[_0x2d9b('0x51')],_0x3f8a9d['query']);_0x373d98['attributes']=_['intersection'](_0x3f8a9d[_0x2d9b('0x51')],qs[_0x2d9b('0x57')](_0x163a68['query'][_0x2d9b('0x57')]));_0x373d98[_0x2d9b('0x43')]=_0x373d98[_0x2d9b('0x43')]['length']?_0x373d98[_0x2d9b('0x43')]:_0x3f8a9d[_0x2d9b('0x51')];_0x373d98[_0x2d9b('0xc8')]=qs[_0x2d9b('0xc9')](_0x163a68[_0x2d9b('0x3e')][_0x2d9b('0xc9')]);_0x373d98[_0x2d9b('0x3c')]=qs[_0x2d9b('0x55')](_[_0x2d9b('0xca')](_0x163a68[_0x2d9b('0x3e')],_0x3f8a9d['filters']));if(_0x163a68['query'][_0x2d9b('0x2e')]){_0x373d98[_0x2d9b('0x3c')]=_[_0x2d9b('0xcb')](_0x373d98['where'],{'$or':_[_0x2d9b('0x2f')](_0x373d98[_0x2d9b('0x43')],function(_0x1ed499){var _0x2393d9={};_0x2393d9[_0x1ed499]={'$like':'%'+_0x163a68['query'][_0x2d9b('0x2e')]+'%'};return _0x2393d9;})});}_0x373d98=_[_0x2d9b('0xcb')]({},_0x373d98,_0x163a68['options']);return _0x2c7d69[_0x2d9b('0xe2')](_0x373d98);}})[_0x2d9b('0x15')](function(_0x5c127a){if(_0x5c127a){_0xfe0ad0=_0x5c127a[_0x2d9b('0x48')];if(!_0x163a68[_0x2d9b('0x3e')]['hasOwnProperty'](_0x2d9b('0xd9'))){_0x373d98[_0x2d9b('0x22')]=qs[_0x2d9b('0x22')](_0x163a68['query'][_0x2d9b('0x22')]);_0x373d98[_0x2d9b('0x23')]=qs[_0x2d9b('0x23')](_0x163a68['query']['offset']);}return _0x2c7d69[_0x2d9b('0xe2')](_0x373d98);}})[_0x2d9b('0x15')](function(_0x5e1fac){if(_0x5e1fac){return _0x5e1fac?{'count':_0xfe0ad0,'rows':_0x5e1fac}:null;}})[_0x2d9b('0x15')](respondWithResult(_0x4cbb72,null))[_0x2d9b('0x1e')](handleError(_0x4cbb72,null));};exports[_0x2d9b('0xe3')]=function(_0xe43355,_0x228819){var _0x5b5969={};var _0x53ae33={};var _0x17faf4;var _0x444a64;return db['User']['findOne']({'where':{'id':_0xe43355[_0x2d9b('0x50')]['id']}})['then'](handleEntityNotFound(_0x228819,null))[_0x2d9b('0x15')](function(_0xfb2201){if(_0xfb2201){_0x17faf4=_0xfb2201;_0x53ae33['model']=_[_0x2d9b('0x53')](db['OpenchannelInteraction']['rawAttributes']);_0x53ae33[_0x2d9b('0x3e')]=_[_0x2d9b('0x53')](_0xe43355['query']);_0x53ae33[_0x2d9b('0x55')]=_['intersection'](_0x53ae33[_0x2d9b('0x51')],_0x53ae33[_0x2d9b('0x3e')]);_0x5b5969['attributes']=_[_0x2d9b('0x56')](_0x53ae33[_0x2d9b('0x51')],qs[_0x2d9b('0x57')](_0xe43355[_0x2d9b('0x3e')][_0x2d9b('0x57')]));_0x5b5969[_0x2d9b('0x43')]=_0x5b5969[_0x2d9b('0x43')]['length']?_0x5b5969[_0x2d9b('0x43')]:_0x53ae33[_0x2d9b('0x51')];_0x5b5969[_0x2d9b('0xc8')]=qs[_0x2d9b('0xc9')](_0xe43355[_0x2d9b('0x3e')][_0x2d9b('0xc9')]);_0x5b5969['where']=qs[_0x2d9b('0x55')](_['pick'](_0xe43355[_0x2d9b('0x3e')],_0x53ae33[_0x2d9b('0x55')]));if(_0xe43355[_0x2d9b('0x3e')][_0x2d9b('0x2e')]){_0x5b5969[_0x2d9b('0x3c')]=_['merge'](_0x5b5969['where'],{'$or':_[_0x2d9b('0x2f')](_0x5b5969['attributes'],function(_0x3f874b){var _0x446837={};_0x446837[_0x3f874b]={'$like':'%'+_0xe43355[_0x2d9b('0x3e')][_0x2d9b('0x2e')]+'%'};return _0x446837;})});}_0x5b5969=_[_0x2d9b('0xcb')]({},_0x5b5969,_0xe43355[_0x2d9b('0xcc')]);return _0x17faf4['getOpenchannelInteractions'](_0x5b5969);}})[_0x2d9b('0x15')](function(_0x42fb24){if(_0x42fb24){_0x444a64=_0x42fb24[_0x2d9b('0x48')];if(!_0xe43355[_0x2d9b('0x3e')][_0x2d9b('0xd2')]('nolimit')){_0x5b5969[_0x2d9b('0x22')]=qs[_0x2d9b('0x22')](_0xe43355[_0x2d9b('0x3e')][_0x2d9b('0x22')]);_0x5b5969['offset']=qs[_0x2d9b('0x23')](_0xe43355[_0x2d9b('0x3e')][_0x2d9b('0x23')]);}return _0x17faf4[_0x2d9b('0xe3')](_0x5b5969);}})[_0x2d9b('0x15')](function(_0x42b10e){if(_0x42b10e){return _0x42b10e?{'count':_0x444a64,'rows':_0x42b10e}:null;}})[_0x2d9b('0x15')](respondWithResult(_0x228819,null))['catch'](handleError(_0x228819,null));};exports[_0x2d9b('0xe4')]=function(_0x21dba0,_0x3087eb){var _0x25c01c={'raw':!![],'where':{}};var _0x3b58d1={};var _0x24dccf={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x21dba0[_0x2d9b('0x50')]['id']}})['then'](handleEntityNotFound(_0x3087eb,null))[_0x2d9b('0x15')](function(_0x5b26b8){if(_0x5b26b8){_0x3b58d1['model']=_[_0x2d9b('0x53')](db[_0x2d9b('0xe5')][_0x2d9b('0x37')]);_0x3b58d1[_0x2d9b('0x3e')]=_[_0x2d9b('0x53')](_0x21dba0[_0x2d9b('0x3e')]);_0x3b58d1[_0x2d9b('0x55')]=_[_0x2d9b('0x56')](_0x3b58d1['model'],_0x3b58d1[_0x2d9b('0x3e')]);_0x25c01c[_0x2d9b('0x43')]=_[_0x2d9b('0x56')](_0x3b58d1[_0x2d9b('0x51')],qs['fields'](_0x21dba0[_0x2d9b('0x3e')]['fields']));_0x25c01c[_0x2d9b('0x43')]=_0x25c01c[_0x2d9b('0x43')][_0x2d9b('0x48')]?_0x25c01c[_0x2d9b('0x43')]:_0x3b58d1[_0x2d9b('0x51')];if(!_0x21dba0['query'][_0x2d9b('0xd2')]('nolimit')){_0x25c01c['limit']=qs['limit'](_0x21dba0[_0x2d9b('0x3e')][_0x2d9b('0x22')]);_0x25c01c[_0x2d9b('0x23')]=qs[_0x2d9b('0x23')](_0x21dba0['query']['offset']);}_0x25c01c[_0x2d9b('0xc8')]=qs[_0x2d9b('0xc9')](_0x21dba0['query'][_0x2d9b('0xc9')]);_0x25c01c['where']=qs['filters'](_[_0x2d9b('0xca')](_0x21dba0[_0x2d9b('0x3e')],_0x3b58d1['filters']));_0x25c01c[_0x2d9b('0x3c')][_0x2d9b('0xde')]=_0x5b26b8['id'];if(_0x21dba0[_0x2d9b('0x3e')][_0x2d9b('0x2e')]){_0x25c01c['where']=_[_0x2d9b('0xcb')](_0x25c01c[_0x2d9b('0x3c')],{'$or':_['map'](_0x25c01c[_0x2d9b('0x43')],function(_0x4bd83f){var _0x522783={};_0x522783[_0x4bd83f]={'$like':'%'+_0x21dba0[_0x2d9b('0x3e')]['filter']+'%'};return _0x522783;})});}_0x25c01c=_[_0x2d9b('0xcb')]({},_0x25c01c,_0x21dba0[_0x2d9b('0xcc')]);return db[_0x2d9b('0xe5')]['count']({'where':_0x25c01c[_0x2d9b('0x3c')]})[_0x2d9b('0x15')](function(_0x1b0e59){_0x24dccf['count']=_0x1b0e59;if(_0x21dba0[_0x2d9b('0x3e')][_0x2d9b('0x58')]){_0x25c01c[_0x2d9b('0x3f')]=[{'all':!![]}];}return db['MailInteraction'][_0x2d9b('0x45')](_0x25c01c);})[_0x2d9b('0x15')](function(_0x26556b){_0x24dccf[_0x2d9b('0x46')]=_0x26556b;return _0x24dccf;});}})[_0x2d9b('0x15')](respondWithFilteredResult(_0x3087eb,_0x25c01c))[_0x2d9b('0x1e')](handleError(_0x3087eb,null));};exports[_0x2d9b('0xe6')]=function(_0x181f1a,_0x183951){var _0x35f8a9={};var _0x13574e={};var _0x4ae1aa;var _0x58cd7f;return db[_0x2d9b('0x36')][_0x2d9b('0xd5')]({'where':{'id':_0x181f1a[_0x2d9b('0x50')]['id']}})[_0x2d9b('0x15')](handleEntityNotFound(_0x183951,null))[_0x2d9b('0x15')](function(_0x4bea69){if(_0x4bea69){_0x4ae1aa=_0x4bea69;_0x13574e[_0x2d9b('0x51')]=_[_0x2d9b('0x53')](db['SmsInteraction']['rawAttributes']);_0x13574e[_0x2d9b('0x3e')]=_[_0x2d9b('0x53')](_0x181f1a[_0x2d9b('0x3e')]);_0x13574e[_0x2d9b('0x55')]=_['intersection'](_0x13574e['model'],_0x13574e[_0x2d9b('0x3e')]);_0x35f8a9['attributes']=_[_0x2d9b('0x56')](_0x13574e['model'],qs[_0x2d9b('0x57')](_0x181f1a['query'][_0x2d9b('0x57')]));_0x35f8a9[_0x2d9b('0x43')]=_0x35f8a9['attributes']['length']?_0x35f8a9[_0x2d9b('0x43')]:_0x13574e[_0x2d9b('0x51')];_0x35f8a9[_0x2d9b('0xc8')]=qs['sort'](_0x181f1a['query'][_0x2d9b('0xc9')]);_0x35f8a9[_0x2d9b('0x3c')]=qs['filters'](_[_0x2d9b('0xca')](_0x181f1a['query'],_0x13574e['filters']));if(_0x181f1a[_0x2d9b('0x3e')][_0x2d9b('0x2e')]){_0x35f8a9[_0x2d9b('0x3c')]=_[_0x2d9b('0xcb')](_0x35f8a9[_0x2d9b('0x3c')],{'$or':_[_0x2d9b('0x2f')](_0x35f8a9['attributes'],function(_0x256324){var _0x4c6b46={};_0x4c6b46[_0x256324]={'$like':'%'+_0x181f1a[_0x2d9b('0x3e')][_0x2d9b('0x2e')]+'%'};return _0x4c6b46;})});}_0x35f8a9=_[_0x2d9b('0xcb')]({},_0x35f8a9,_0x181f1a[_0x2d9b('0xcc')]);return _0x4ae1aa[_0x2d9b('0xe6')](_0x35f8a9);}})['then'](function(_0x3a5ae2){if(_0x3a5ae2){_0x58cd7f=_0x3a5ae2[_0x2d9b('0x48')];if(!_0x181f1a[_0x2d9b('0x3e')][_0x2d9b('0xd2')]('nolimit')){_0x35f8a9[_0x2d9b('0x22')]=qs[_0x2d9b('0x22')](_0x181f1a[_0x2d9b('0x3e')][_0x2d9b('0x22')]);_0x35f8a9[_0x2d9b('0x23')]=qs['offset'](_0x181f1a[_0x2d9b('0x3e')]['offset']);}return _0x4ae1aa[_0x2d9b('0xe6')](_0x35f8a9);}})[_0x2d9b('0x15')](function(_0x37915c){if(_0x37915c){return _0x37915c?{'count':_0x58cd7f,'rows':_0x37915c}:null;}})[_0x2d9b('0x15')](respondWithResult(_0x183951,null))[_0x2d9b('0x1e')](handleError(_0x183951,null));};exports['getFaxInteractions']=function(_0x4c655e,_0x5a0830){var _0x207a94={};var _0x59fc9e={};var _0x52fb28;var _0x3423e0;return db[_0x2d9b('0x36')][_0x2d9b('0xd5')]({'where':{'id':_0x4c655e[_0x2d9b('0x50')]['id']}})[_0x2d9b('0x15')](handleEntityNotFound(_0x5a0830,null))[_0x2d9b('0x15')](function(_0x148b00){if(_0x148b00){_0x52fb28=_0x148b00;_0x59fc9e['model']=_[_0x2d9b('0x53')](db[_0x2d9b('0xe7')][_0x2d9b('0x37')]);_0x59fc9e['query']=_[_0x2d9b('0x53')](_0x4c655e['query']);_0x59fc9e['filters']=_[_0x2d9b('0x56')](_0x59fc9e[_0x2d9b('0x51')],_0x59fc9e['query']);_0x207a94[_0x2d9b('0x43')]=_[_0x2d9b('0x56')](_0x59fc9e[_0x2d9b('0x51')],qs[_0x2d9b('0x57')](_0x4c655e['query'][_0x2d9b('0x57')]));_0x207a94[_0x2d9b('0x43')]=_0x207a94[_0x2d9b('0x43')]['length']?_0x207a94[_0x2d9b('0x43')]:_0x59fc9e[_0x2d9b('0x51')];_0x207a94[_0x2d9b('0xc8')]=qs['sort'](_0x4c655e[_0x2d9b('0x3e')][_0x2d9b('0xc9')]);_0x207a94[_0x2d9b('0x3c')]=qs[_0x2d9b('0x55')](_['pick'](_0x4c655e[_0x2d9b('0x3e')],_0x59fc9e[_0x2d9b('0x55')]));if(_0x4c655e['query'][_0x2d9b('0x2e')]){_0x207a94['where']=_[_0x2d9b('0xcb')](_0x207a94[_0x2d9b('0x3c')],{'$or':_['map'](_0x207a94[_0x2d9b('0x43')],function(_0x4a4474){var _0x410a1c={};_0x410a1c[_0x4a4474]={'$like':'%'+_0x4c655e[_0x2d9b('0x3e')][_0x2d9b('0x2e')]+'%'};return _0x410a1c;})});}_0x207a94=_[_0x2d9b('0xcb')]({},_0x207a94,_0x4c655e[_0x2d9b('0xcc')]);return _0x52fb28[_0x2d9b('0xe8')](_0x207a94);}})[_0x2d9b('0x15')](function(_0x335e77){if(_0x335e77){_0x3423e0=_0x335e77[_0x2d9b('0x48')];if(!_0x4c655e[_0x2d9b('0x3e')]['hasOwnProperty']('nolimit')){_0x207a94[_0x2d9b('0x22')]=qs[_0x2d9b('0x22')](_0x4c655e['query']['limit']);_0x207a94[_0x2d9b('0x23')]=qs[_0x2d9b('0x23')](_0x4c655e[_0x2d9b('0x3e')][_0x2d9b('0x23')]);}return _0x52fb28[_0x2d9b('0xe8')](_0x207a94);}})['then'](function(_0x55aeb7){if(_0x55aeb7){return _0x55aeb7?{'count':_0x3423e0,'rows':_0x55aeb7}:null;}})[_0x2d9b('0x15')](respondWithResult(_0x5a0830,null))['catch'](handleError(_0x5a0830,null));};exports['getWhatsappInteractions']=function(_0x45b638,_0x9629d2){var _0x3b37a4={};var _0x399d3a={};var _0x412799;var _0x31ec75;return db[_0x2d9b('0x36')][_0x2d9b('0xd5')]({'where':{'id':_0x45b638[_0x2d9b('0x50')]['id']}})[_0x2d9b('0x15')](handleEntityNotFound(_0x9629d2,null))[_0x2d9b('0x15')](function(_0x31884d){if(_0x31884d){_0x412799=_0x31884d;_0x399d3a[_0x2d9b('0x51')]=_[_0x2d9b('0x53')](db[_0x2d9b('0xe9')][_0x2d9b('0x37')]);_0x399d3a['query']=_[_0x2d9b('0x53')](_0x45b638['query']);_0x399d3a[_0x2d9b('0x55')]=_['intersection'](_0x399d3a[_0x2d9b('0x51')],_0x399d3a['query']);_0x3b37a4[_0x2d9b('0x43')]=_[_0x2d9b('0x56')](_0x399d3a['model'],qs['fields'](_0x45b638[_0x2d9b('0x3e')][_0x2d9b('0x57')]));_0x3b37a4[_0x2d9b('0x43')]=_0x3b37a4['attributes'][_0x2d9b('0x48')]?_0x3b37a4['attributes']:_0x399d3a[_0x2d9b('0x51')];_0x3b37a4[_0x2d9b('0xc8')]=qs[_0x2d9b('0xc9')](_0x45b638['query'][_0x2d9b('0xc9')]);_0x3b37a4['where']=qs[_0x2d9b('0x55')](_[_0x2d9b('0xca')](_0x45b638[_0x2d9b('0x3e')],_0x399d3a[_0x2d9b('0x55')]));if(_0x45b638[_0x2d9b('0x3e')][_0x2d9b('0x2e')]){_0x3b37a4['where']=_['merge'](_0x3b37a4[_0x2d9b('0x3c')],{'$or':_[_0x2d9b('0x2f')](_0x3b37a4['attributes'],function(_0xc8c154){var _0x32f382={};_0x32f382[_0xc8c154]={'$like':'%'+_0x45b638[_0x2d9b('0x3e')][_0x2d9b('0x2e')]+'%'};return _0x32f382;})});}_0x3b37a4=_[_0x2d9b('0xcb')]({},_0x3b37a4,_0x45b638[_0x2d9b('0xcc')]);return _0x412799[_0x2d9b('0xea')](_0x3b37a4);}})[_0x2d9b('0x15')](function(_0x35d6a0){if(_0x35d6a0){_0x31ec75=_0x35d6a0[_0x2d9b('0x48')];if(!_0x45b638[_0x2d9b('0x3e')]['hasOwnProperty'](_0x2d9b('0xd9'))){_0x3b37a4[_0x2d9b('0x22')]=qs['limit'](_0x45b638[_0x2d9b('0x3e')][_0x2d9b('0x22')]);_0x3b37a4[_0x2d9b('0x23')]=qs[_0x2d9b('0x23')](_0x45b638[_0x2d9b('0x3e')][_0x2d9b('0x23')]);}return _0x412799[_0x2d9b('0xea')](_0x3b37a4);}})['then'](function(_0x427e05){if(_0x427e05){return _0x427e05?{'count':_0x31ec75,'rows':_0x427e05}:null;}})['then'](respondWithResult(_0x9629d2,null))[_0x2d9b('0x1e')](handleError(_0x9629d2,null));};exports[_0x2d9b('0xeb')]=function(_0x3bef8e,_0x2fcc21,_0x1362bb){var _0x57e543;var _0xc956df;var _0x3d059a;var _0x55067f=!_['isNil'](_0x3bef8e[_0x2d9b('0x50')]['id'])?_0x3bef8e[_0x2d9b('0x50')]['id']:!_['isNil'](_0x3bef8e[_0x2d9b('0x2c')]['id'])?_0x3bef8e['user']['id']:null;return db[_0x2d9b('0x36')]['find']({'where':{'id':_0x55067f,'role':{'$or':[_0x2d9b('0x2a'),_0x2d9b('0x2c'),_0x2d9b('0x6e')]}},'attributes':['id','name',_0x2d9b('0xec'),_0x2d9b('0xed'),_0x2d9b('0x29'),_0x2d9b('0x61'),_0x2d9b('0x9e')]})['then'](function(_0x4cdcbd){if(_0x4cdcbd){if(_0x4cdcbd[_0x2d9b('0x29')]==='agent'){_0x57e543=_0x4cdcbd;if(_0x3bef8e['body'][_0x2d9b('0xa0')]){_0x3d059a=util[_0x2d9b('0xee')](_0x2d9b('0xef'),_0x57e543[_0x3bef8e[_0x2d9b('0x5b')][_0x2d9b('0xa0')]]);}else if(_0x3bef8e[_0x2d9b('0x5b')][_0x2d9b('0xf0')]){_0x3d059a=util['format'](_0x2d9b('0xab'),_0x3bef8e['body'][_0x2d9b('0xf0')]);}else{_0x3d059a=util['format']('SIP/%s',_0x57e543[_0x2d9b('0x33')]);}socket['to'](util[_0x2d9b('0xee')](_0x2d9b('0xf1'),_0x57e543[_0x2d9b('0x33')]))['emit'](_0x2d9b('0xf2'),{'user':{'id':_0x57e543['id'],'name':_0x57e543[_0x2d9b('0x33')]},'ip':_0x3bef8e[_0x2d9b('0xf3')][_0x2d9b('0xf4')]||_0x3bef8e[_0x2d9b('0xf5')][_0x2d9b('0xf6')]||_0x3bef8e[_0x2d9b('0xf7')][_0x2d9b('0xf6')]||_0x3bef8e[_0x2d9b('0xf5')][_0x2d9b('0xf7')][_0x2d9b('0xf6')]});return db[_0x2d9b('0xac')]['destroy']({'where':{'membername':_0x57e543[_0x2d9b('0x33')]},'individualHooks':!![]});}}else{throw new db[(_0x2d9b('0x90'))][(_0x2d9b('0x93'))](_0x2d9b('0xf8'));}})[_0x2d9b('0x15')](function(){if(_0x57e543){return _0x57e543[_0x2d9b('0xf9')]({'raw':!![]});}})['then'](function(_0x1ec079){if(_0x57e543){var _0x1dea55=[];if(_0x1ec079){_0xc956df=_0x1ec079;if(_0xc956df[_0x2d9b('0x48')]){for(var _0x172c0f=0x0;_0x172c0f<_0xc956df[_0x2d9b('0x48')];_0x172c0f++){_0x1dea55[_0x2d9b('0x44')]({'membername':_0x57e543[_0x2d9b('0x33')],'UserId':_0x57e543['id'],'queue_name':_0xc956df[_0x172c0f][_0x2d9b('0x33')],'VoiceQueueId':_0xc956df[_0x172c0f]['id'],'interface':_0x3d059a,'paused':_0x57e543[_0x2d9b('0x9e')]||![],'penalty':_0xc956df[_0x172c0f]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x2d9b('0x89')](_0x1dea55,function(_0x355ab2){return db[_0x2d9b('0xac')][_0x2d9b('0xad')](_0x355ab2);});}}}})[_0x2d9b('0x15')](function(){if(_0x57e543){return db[_0x2d9b('0xfa')][_0x2d9b('0x45')]({'where':{'membername':_0x57e543[_0x2d9b('0x33')],'exitAt':null}});}})[_0x2d9b('0x15')](function(_0x5e87a9){if(_0x57e543){var _0x13bfb4=[];_0x5e87a9[_0x2d9b('0xfb')](function(_0x23bab8){_0x13bfb4[_0x2d9b('0x44')](_0x23bab8[_0x2d9b('0x26')]({'exitAt':moment()[_0x2d9b('0xee')](_0x2d9b('0xfc'))}));});return BPromise[_0x2d9b('0x4e')](_0x13bfb4);}})['then'](function(){if(_0x57e543){var _0x41455e=[];var _0x4bee66=[];var _0x1d749e=utils[_0x2d9b('0xfd')]();var _0x3322ea={'membername':_0x57e543['name'],'interface':_0x3d059a,'enterAt':moment()[_0x2d9b('0xee')](_0x2d9b('0xfc')),'role':_0x57e543[_0x2d9b('0x29')],'internal':_0x57e543[_0x2d9b('0x61')]};_0x1d749e[_0x2d9b('0xfb')](function(_0x7d100c){_0x41455e['push'](_['merge']({'channel':_0x7d100c,'type':_0x2d9b('0xfe'),'data1':_0x3bef8e[_0x2d9b('0x5b')]['device'],'data2':_0x3d059a},_0x3322ea));if(_0x57e543['loginInPause']){_0x4bee66[_0x2d9b('0x44')](_[_0x2d9b('0xcb')]({'channel':_0x7d100c,'type':_0x2d9b('0xff'),'data1':_0x2d9b('0x100')},_0x3322ea));}});return db[_0x2d9b('0xfa')][_0x2d9b('0x86')](_0x41455e[_0x2d9b('0xc6')](_0x4bee66),{'individualHooks':!![]});}})['then'](function(){if(_0x57e543){return _0x57e543[_0x2d9b('0x26')]({'online':!![],'lastLoginAt':moment()['format'](_0x2d9b('0xfc')),'voicePause':_0x57e543[_0x2d9b('0x9e')]||![],'mailPause':_0x57e543[_0x2d9b('0x9e')]||![],'chatPause':_0x57e543[_0x2d9b('0x9e')]||![],'faxPause':_0x57e543[_0x2d9b('0x9e')]||![],'smsPause':_0x57e543[_0x2d9b('0x9e')]||![],'openchannelPause':_0x57e543[_0x2d9b('0x9e')]||![],'whatsappPause':_0x57e543[_0x2d9b('0x9e')]||![],'pauseType':_0x57e543['loginInPause']?_0x2d9b('0x100'):null,'interface':_0x3d059a,'lastPauseAt':moment()[_0x2d9b('0xee')](_0x2d9b('0xfc'))});}})['then'](function(_0x22d309){if(_0x3bef8e['isMiddleware']){return _0x1362bb();}else{return BPromise[_0x2d9b('0x101')](_0x22d309)[_0x2d9b('0x15')](respondWithResult(_0x2fcc21,null));}})['catch'](handleError(_0x2fcc21,null));};exports['logout']=function(_0x23d846,_0x376075){var _0x3b19a9;return db[_0x2d9b('0x36')][_0x2d9b('0x5c')]({'where':{'id':_0x23d846[_0x2d9b('0x50')]['id'],'role':'agent'},'attributes':['id',_0x2d9b('0x33'),_0x2d9b('0x29')]})[_0x2d9b('0x15')](handleEntityNotFound(_0x376075,null))['then'](function(_0x5a5a3c){if(_0x5a5a3c){_0x3b19a9=_0x5a5a3c;return db[_0x2d9b('0xac')][_0x2d9b('0x27')]({'where':{'membername':_0x3b19a9[_0x2d9b('0x33')]},'individualHooks':!![]});}})[_0x2d9b('0x15')](function(){return db['MemberReport'][_0x2d9b('0x45')]({'where':{'membername':_0x3b19a9[_0x2d9b('0x33')],'exitAt':null}});})['then'](function(_0x8326da){var _0x46f5f2=[];_0x8326da['forEach'](function(_0x1c5e1e){_0x46f5f2['push'](_0x1c5e1e[_0x2d9b('0x26')]({'exitAt':moment()['format'](_0x2d9b('0xfc'))}));});return BPromise[_0x2d9b('0x4e')](_0x46f5f2);})[_0x2d9b('0x15')](function(){return _0x3b19a9[_0x2d9b('0x26')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2d9b('0x15')](respondWithResult(_0x376075,null))['catch'](handleError(_0x376075,null));};exports['pause']=function(_0x2daade,_0x2db6a9){var _0x41650b;return db[_0x2d9b('0xac')][_0x2d9b('0x26')]({'paused':0x1},{'where':{'UserId':_0x2daade[_0x2d9b('0x50')]['id']},'individualHooks':!![]})['then'](function(){return db['User']['find']({'where':{'id':_0x2daade[_0x2d9b('0x50')]['id'],'role':_0x2d9b('0x6e')},'attributes':['id',_0x2d9b('0x33'),_0x2d9b('0x29'),_0x2d9b('0x61'),'interface']});})[_0x2d9b('0x15')](handleEntityNotFound(_0x2db6a9,null))[_0x2d9b('0x15')](function(_0x199a51){if(_0x199a51){_0x41650b=_0x199a51;return respondWithRpcPromise(_0x2d9b('0x102'),_0x2d9b('0x103'),{'id':_0x41650b['id'],'name':_0x41650b['name'],'pause':!![]});}})[_0x2d9b('0x15')](function(){if(_0x41650b){return db['MemberReport']['findAll']({'where':{'membername':_0x41650b[_0x2d9b('0x33')],'type':_0x2d9b('0xff'),'exitAt':null}});}})[_0x2d9b('0x15')](function(_0x2c73cf){if(_0x2c73cf[_0x2d9b('0x48')]){var _0xa82e33=moment()[_0x2d9b('0xee')](_0x2d9b('0xfc'));for(var _0x40ed6f=0x0,_0x4bd9=_0x2c73cf['length'];_0x40ed6f<_0x4bd9;_0x40ed6f++){_0x2c73cf[_0x40ed6f][_0x2d9b('0x104')]({'exitAt':_0xa82e33});}}})[_0x2d9b('0x15')](function(){var _0xd3ec4b=[];var _0x443d3c=utils[_0x2d9b('0xfd')]();_0x443d3c[_0x2d9b('0xfb')](function(_0x49e8a4){_0xd3ec4b[_0x2d9b('0x44')]({'channel':_0x49e8a4,'membername':_0x41650b[_0x2d9b('0x33')],'interface':_[_0x2d9b('0x66')](_0x41650b[_0x2d9b('0xa0')])?util['format'](_0x2d9b('0xab'),_0x41650b['name']):_0x41650b[_0x2d9b('0xa0')],'type':'PAUSE','enterAt':moment()[_0x2d9b('0xee')](_0x2d9b('0xfc')),'data1':_0x2daade[_0x2d9b('0x5b')][_0x2d9b('0x39')]||_0x2d9b('0x105'),'role':_0x41650b[_0x2d9b('0x29')],'internal':_0x41650b[_0x2d9b('0x61')]});});return db[_0x2d9b('0xfa')][_0x2d9b('0x86')](_0xd3ec4b,{'individualHooks':!![]});})['then'](function(){return _0x41650b[_0x2d9b('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2daade[_0x2d9b('0x5b')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x2d9b('0xee')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x2d9b('0x15')](respondWithResult(_0x2db6a9,null))[_0x2d9b('0x1e')](handleError(_0x2db6a9,null));};exports[_0x2d9b('0x106')]=function(_0x5f2335,_0x4990b8){var _0x38d2ab;return db[_0x2d9b('0x36')][_0x2d9b('0x5c')]({'where':{'id':_0x5f2335[_0x2d9b('0x50')]['id']},'attributes':['id',_0x2d9b('0x33'),_0x2d9b('0x29'),_0x2d9b('0x9f'),_0x2d9b('0x107'),_0x2d9b('0x108'),_0x2d9b('0x109'),_0x2d9b('0x10a'),_0x2d9b('0x10b'),'whatsapppause',_0x2d9b('0x10c'),'lastPauseAt']})['then'](handleEntityNotFound(_0x4990b8,null))['then'](function(_0x40e873){if(_0x40e873){_0x38d2ab=_0x40e873;if(_0x5f2335[_0x2d9b('0x5b')][_0x2d9b('0xaf')]&&!utils[_0x2d9b('0xa1')](_0x5f2335[_0x2d9b('0x5b')][_0x2d9b('0xaf')])){throw new db[(_0x2d9b('0x90'))][(_0x2d9b('0x93'))](_0x2d9b('0xd6'));}switch(_0x5f2335[_0x2d9b('0x5b')][_0x2d9b('0xaf')]){case _0x2d9b('0xa9'):return respondWithRpcPromise(_0x2d9b('0x102'),_0x2d9b('0x106'),{'id':_0x38d2ab['id'],'name':_0x38d2ab[_0x2d9b('0x33')],'pause':![]})['then'](function(){return db[_0x2d9b('0xac')][_0x2d9b('0x26')]({'paused':0x0},{'where':{'UserId':_0x38d2ab['id']},'individualHooks':!![]});})['then'](function(){return db['MemberReport'][_0x2d9b('0x5c')]({'where':{'channel':_0x5f2335['body']['channel'],'membername':_0x38d2ab[_0x2d9b('0x33')],'type':_0x2d9b('0xff'),'exitAt':null}});})[_0x2d9b('0x15')](function(_0x4ae1c0){if(_0x4ae1c0){return _0x4ae1c0[_0x2d9b('0x26')]({'exitAt':moment()[_0x2d9b('0xee')](_0x2d9b('0xfc')),'data2':_0x2d9b('0x10d')},{'individualHooks':!![]});}return null;})[_0x2d9b('0x15')](function(){return _0x38d2ab['update']({'voicePause':![]});});case _0x2d9b('0x4c'):case _0x2d9b('0x59'):case _0x2d9b('0x4b'):case _0x2d9b('0x4a'):case _0x2d9b('0x4d'):case _0x2d9b('0x5a'):return db['MemberReport'][_0x2d9b('0x5c')]({'where':{'channel':_0x5f2335['body'][_0x2d9b('0xaf')],'membername':_0x38d2ab['name'],'type':_0x2d9b('0xff'),'exitAt':null}})['then'](function(_0x15ddba){if(_0x15ddba){return _0x15ddba['update']({'exitAt':moment()[_0x2d9b('0xee')](_0x2d9b('0xfc')),'data2':_0x2d9b('0x10d')},{'individualHooks':!![]});}return null;})[_0x2d9b('0x15')](function(){var _0x255d34={};_[_0x2d9b('0x24')](_0x255d34,util[_0x2d9b('0xee')]('%s%s',_0x5f2335[_0x2d9b('0x5b')][_0x2d9b('0xaf')],_0x2d9b('0x10e')),![]);return _0x38d2ab[_0x2d9b('0x26')](_0x255d34);});default:return respondWithRpcPromise(_0x2d9b('0x102'),'unpause',{'id':_0x38d2ab['id'],'name':_0x38d2ab[_0x2d9b('0x33')],'pause':![]})['then'](function(){return db[_0x2d9b('0xac')][_0x2d9b('0x26')]({'paused':0x0},{'where':{'UserId':_0x38d2ab['id']}});})[_0x2d9b('0x15')](function(){return db[_0x2d9b('0xfa')][_0x2d9b('0x45')]({'where':{'membername':_0x38d2ab['name'],'type':_0x2d9b('0xff'),'exitAt':null}});})[_0x2d9b('0x15')](function(_0x20e9a8){var _0x1db72f=[];_0x20e9a8[_0x2d9b('0xfb')](function(_0x3ce440){_0x1db72f['push'](_0x3ce440[_0x2d9b('0x26')]({'exitAt':moment()[_0x2d9b('0xee')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x2d9b('0x10d')}));});return BPromise[_0x2d9b('0x4e')](_0x1db72f);})['then'](function(){return _0x38d2ab[_0x2d9b('0x26')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x2d9b('0x15')](respondWithResult(_0x4990b8,null))[_0x2d9b('0x1e')](handleError(_0x4990b8,null));};exports['getTeams']=function(_0x41cd61,_0x21ba11){var _0x134e67={};var _0x338e57={};var _0x53ae4b;var _0x57408a;return db['User'][_0x2d9b('0xd5')]({'where':{'id':_0x41cd61[_0x2d9b('0x50')]['id']}})[_0x2d9b('0x15')](handleEntityNotFound(_0x21ba11,null))['then'](function(_0x95475c){if(_0x95475c){_0x53ae4b=_0x95475c;_0x338e57[_0x2d9b('0x51')]=_['keys'](db[_0x2d9b('0x10f')]['rawAttributes']);_0x338e57[_0x2d9b('0x3e')]=_[_0x2d9b('0x53')](_0x41cd61[_0x2d9b('0x3e')]);_0x338e57[_0x2d9b('0x55')]=_[_0x2d9b('0x56')](_0x338e57[_0x2d9b('0x51')],_0x338e57[_0x2d9b('0x3e')]);_0x134e67[_0x2d9b('0x43')]=_['intersection'](_0x338e57[_0x2d9b('0x51')],qs[_0x2d9b('0x57')](_0x41cd61[_0x2d9b('0x3e')][_0x2d9b('0x57')]));_0x134e67[_0x2d9b('0x43')]=_0x134e67['attributes'][_0x2d9b('0x48')]?_0x134e67[_0x2d9b('0x43')]:_0x338e57[_0x2d9b('0x51')];_0x134e67['order']=qs['sort'](_0x41cd61[_0x2d9b('0x3e')][_0x2d9b('0xc9')]);_0x134e67['where']=qs['filters'](_[_0x2d9b('0xca')](_0x41cd61[_0x2d9b('0x3e')],_0x338e57[_0x2d9b('0x55')]));if(_0x41cd61['query'][_0x2d9b('0x2e')]){_0x134e67[_0x2d9b('0x3c')]=_['merge'](_0x134e67[_0x2d9b('0x3c')],{'$or':_['map'](_0x134e67[_0x2d9b('0x43')],function(_0x33584c){var _0x1ac008={};_0x1ac008[_0x33584c]={'$like':'%'+_0x41cd61[_0x2d9b('0x3e')][_0x2d9b('0x2e')]+'%'};return _0x1ac008;})});}_0x134e67=_[_0x2d9b('0xcb')]({},_0x134e67,_0x41cd61['options']);return _0x53ae4b['getTeams'](_0x134e67);}})[_0x2d9b('0x15')](function(_0x1da9cc){if(_0x1da9cc){_0x57408a=_0x1da9cc[_0x2d9b('0x48')];if(!_0x41cd61[_0x2d9b('0x3e')]['hasOwnProperty']('nolimit')){_0x134e67[_0x2d9b('0x22')]=qs[_0x2d9b('0x22')](_0x41cd61['query'][_0x2d9b('0x22')]);_0x134e67['offset']=qs['offset'](_0x41cd61[_0x2d9b('0x3e')][_0x2d9b('0x23')]);}return _0x53ae4b[_0x2d9b('0x110')](_0x134e67);}})[_0x2d9b('0x15')](function(_0x12e6ea){if(_0x12e6ea){return _0x12e6ea?{'count':_0x57408a,'rows':_0x12e6ea}:null;}})[_0x2d9b('0x15')](respondWithResult(_0x21ba11,null))[_0x2d9b('0x1e')](handleError(_0x21ba11,null));};exports[_0x2d9b('0x111')]=function(_0x1f5807,_0x13adbb){return db['User']['find']({'where':{'id':_0x1f5807[_0x2d9b('0x50')]['id']}})[_0x2d9b('0x15')](handleEntityNotFound(_0x13adbb,null))['then'](function(_0x23b924){if(_0x23b924){var _0xcf6a17=_0x23b924['get']({'plain':!![]});return _0x23b924['addTeams'](_0x1f5807[_0x2d9b('0x5b')]['ids'],_['omit'](_0x1f5807[_0x2d9b('0x5b')],[_0x2d9b('0x5f'),'id'])||{})['then'](function(){for(var _0xc62ed7=0x0;_0xc62ed7<_0x1f5807['body'][_0x2d9b('0x5f')][_0x2d9b('0x48')];_0xc62ed7++){var _0x1528e8=[];var _0x3e40c0={};db[_0x2d9b('0x10f')]['findOne']({'where':{'id':_0x1f5807[_0x2d9b('0x5b')][_0x2d9b('0x5f')][_0xc62ed7]}})[_0x2d9b('0x15')](function(_0x227808){_0x3e40c0=_0x227808['dataValues'];_0x1528e8['push'](_0x227808[_0x2d9b('0xf9')]()[_0x2d9b('0x15')](function(_0x5d19fa){for(var _0x4718ad=0x0;_0x4718ad<_0x5d19fa[_0x2d9b('0x48')];_0x4718ad++){_0x5d19fa[_0x4718ad][_0x2d9b('0x112')]('channel',_0x2d9b('0x113'));}return _0x5d19fa;}));_0x1528e8[_0x2d9b('0x44')](_0x227808['getChatQueues']()[_0x2d9b('0x15')](function(_0x597352){for(var _0x456b1a=0x0;_0x456b1a<_0x597352[_0x2d9b('0x48')];_0x456b1a++){_0x597352[_0x456b1a][_0x2d9b('0x112')](_0x2d9b('0xaf'),'Chat');}return _0x597352;}));_0x1528e8['push'](_0x227808['getMailQueues']()[_0x2d9b('0x15')](function(_0x5c67bb){for(var _0x3edbdf=0x0;_0x3edbdf<_0x5c67bb['length'];_0x3edbdf++){_0x5c67bb[_0x3edbdf][_0x2d9b('0x112')]('channel','Mail');}return _0x5c67bb;}));_0x1528e8[_0x2d9b('0x44')](_0x227808[_0x2d9b('0x114')]()['then'](function(_0x571f99){for(var _0x344cfd=0x0;_0x344cfd<_0x571f99['length'];_0x344cfd++){_0x571f99[_0x344cfd]['setDataValue'](_0x2d9b('0xaf'),_0x2d9b('0x115'));}return _0x571f99;}));_0x1528e8[_0x2d9b('0x44')](_0x227808['getWhatsappQueues']()[_0x2d9b('0x15')](function(_0x3d7d10){for(var _0x1fcb0b=0x0;_0x1fcb0b<_0x3d7d10[_0x2d9b('0x48')];_0x1fcb0b++){_0x3d7d10[_0x1fcb0b][_0x2d9b('0x112')]('channel','Whatsapp');}return _0x3d7d10;}));_0x1528e8[_0x2d9b('0x44')](_0x227808[_0x2d9b('0x116')]()[_0x2d9b('0x15')](function(_0x13c0a2){for(var _0x465285=0x0;_0x465285<_0x13c0a2[_0x2d9b('0x48')];_0x465285++){_0x13c0a2[_0x465285][_0x2d9b('0x112')](_0x2d9b('0xaf'),_0x2d9b('0x117'));}return _0x13c0a2;}));_0x1528e8[_0x2d9b('0x44')](_0x227808['getOpenchannelQueues']()[_0x2d9b('0x15')](function(_0x17e5d8){for(var _0x1d119d=0x0;_0x1d119d<_0x17e5d8[_0x2d9b('0x48')];_0x1d119d++){_0x17e5d8[_0x1d119d]['setDataValue'](_0x2d9b('0xaf'),_0x2d9b('0x118'));}return _0x17e5d8;}));return BPromise[_0x2d9b('0x4e')](_0x1528e8);})[_0x2d9b('0x15')](function(_0x2fc7f5){var _0x2114da=_['flatten'](_0x2fc7f5);_0x1528e8=[];return db[_0x2d9b('0x119')][_0x2d9b('0x11a')](function(_0x5e6e17){for(var _0x2d4c37=0x0;_0x2d4c37<_0x2114da[_0x2d9b('0x48')];_0x2d4c37++){_0x1528e8[_0x2d9b('0x44')](_0x2114da[_0x2d4c37][_0x2d9b('0x11b')](_0xcf6a17['id']),{'transaction':_0x5e6e17});}return BPromise[_0x2d9b('0x4e')](_0x1528e8)[_0x2d9b('0x15')](function(){if(_0xcf6a17[_0x2d9b('0x9d')]){return BPromise['each'](_[_0x2d9b('0x2e')](_0x2114da,function(_0x527565){return _0x527565['getDataValue']('channel')===_0x2d9b('0x113');}),function(_0x54c523){return db[_0x2d9b('0xac')][_0x2d9b('0xad')]({'membername':_0xcf6a17[_0x2d9b('0x33')],'UserId':_0xcf6a17['id'],'queue_name':_0x54c523[_0x2d9b('0x33')],'VoiceQueueId':_0x54c523['id'],'interface':_[_0x2d9b('0x66')](_0xcf6a17['interface'])?util[_0x2d9b('0xee')](_0x2d9b('0xab'),_0xcf6a17[_0x2d9b('0x33')]):_0xcf6a17[_0x2d9b('0xa0')],'paused':_0xcf6a17[_0x2d9b('0x9f')]||![],'penalty':_0xcf6a17[_0x2d9b('0xa4')]},{'transaction':_0x5e6e17});});}else{return;}})[_0x2d9b('0x15')](function(){for(var _0x1b717d=0x0;_0x1b717d<_0x2114da[_0x2d9b('0x48')];_0x1b717d++){var _0x39acbe=_0x2114da[_0x1b717d][_0x2d9b('0x11c')]('channel');var _0x540155=_0x39acbe+_0x2d9b('0xa6');socket[_0x2d9b('0xa7')]('user'+_0x39acbe+_0x2d9b('0xa8'),{'UserId':_0xcf6a17['id'],['queueField']:_0x2114da[_0x1b717d]['id']});}});});})[_0x2d9b('0x15')](function(){db[_0x2d9b('0x11d')][_0x2d9b('0xd5')]({'where':{'teamId':_0x3e40c0['id']}})[_0x2d9b('0x15')](function(_0x4de892){if(_0x4de892){db[_0x2d9b('0x11e')][_0x2d9b('0x7c')]({'UserId':_0x1f5807[_0x2d9b('0x50')]['id'],'VoicePrefixId':_0x4de892[_0x2d9b('0x11f')]});}});});}});}})[_0x2d9b('0x15')](respondWithStatusCode(_0x13adbb,null))[_0x2d9b('0x1e')](handleError(_0x13adbb,null));};exports[_0x2d9b('0x120')]=function(_0x82bd25,_0x248b1b){return db[_0x2d9b('0x36')]['findOne']({'where':{'id':_0x82bd25[_0x2d9b('0x50')]['id']}})[_0x2d9b('0x15')](handleEntityNotFound(_0x248b1b,null))[_0x2d9b('0x15')](function(_0x3d39f1){if(_0x3d39f1){var _0x4d40b2=_0x3d39f1['get']({'plain':!![]});var _0x179c78=_0x82bd25[_0x2d9b('0x3e')][_0x2d9b('0x5f')];return _0x3d39f1['removeTeams'](_0x179c78)[_0x2d9b('0x15')](function(){for(var _0xf3574e=0x0;_0xf3574e<_0x179c78[_0x2d9b('0x48')];_0xf3574e++){var _0x4f068c=[];var _0x45afc7={};db[_0x2d9b('0x10f')][_0x2d9b('0xd5')]({'where':{'id':_0x179c78[_0xf3574e]}})[_0x2d9b('0x15')](function(_0x17f467){_0x45afc7=_0x17f467[_0x2d9b('0x49')];_0x4f068c[_0x2d9b('0x44')](_0x17f467[_0x2d9b('0xf9')]()['then'](function(_0x5648a4){for(var _0x790eae=0x0;_0x790eae<_0x5648a4[_0x2d9b('0x48')];_0x790eae++){_0x5648a4[_0x790eae][_0x2d9b('0x112')](_0x2d9b('0xaf'),'Voice');}return _0x5648a4;}));_0x4f068c[_0x2d9b('0x44')](_0x17f467[_0x2d9b('0x121')]()[_0x2d9b('0x15')](function(_0x54a9b6){for(var _0x428b13=0x0;_0x428b13<_0x54a9b6[_0x2d9b('0x48')];_0x428b13++){_0x54a9b6[_0x428b13]['setDataValue'](_0x2d9b('0xaf'),_0x2d9b('0x122'));}return _0x54a9b6;}));_0x4f068c[_0x2d9b('0x44')](_0x17f467[_0x2d9b('0x123')]()[_0x2d9b('0x15')](function(_0x566b7c){for(var _0xb2b071=0x0;_0xb2b071<_0x566b7c[_0x2d9b('0x48')];_0xb2b071++){_0x566b7c[_0xb2b071][_0x2d9b('0x112')](_0x2d9b('0xaf'),_0x2d9b('0x124'));}return _0x566b7c;}));_0x4f068c['push'](_0x17f467[_0x2d9b('0x114')]()[_0x2d9b('0x15')](function(_0x4c0f92){for(var _0x5d7850=0x0;_0x5d7850<_0x4c0f92[_0x2d9b('0x48')];_0x5d7850++){_0x4c0f92[_0x5d7850]['setDataValue']('channel','Sms');}return _0x4c0f92;}));_0x4f068c[_0x2d9b('0x44')](_0x17f467['getWhatsappQueues']()['then'](function(_0x364ca6){for(var _0x29a41b=0x0;_0x29a41b<_0x364ca6[_0x2d9b('0x48')];_0x29a41b++){_0x364ca6[_0x29a41b][_0x2d9b('0x112')](_0x2d9b('0xaf'),_0x2d9b('0x125'));}return _0x364ca6;}));_0x4f068c['push'](_0x17f467[_0x2d9b('0x116')]()['then'](function(_0x222a2c){for(var _0x2c6729=0x0;_0x2c6729<_0x222a2c[_0x2d9b('0x48')];_0x2c6729++){_0x222a2c[_0x2c6729][_0x2d9b('0x112')](_0x2d9b('0xaf'),_0x2d9b('0x117'));}return _0x222a2c;}));_0x4f068c[_0x2d9b('0x44')](_0x17f467[_0x2d9b('0x126')]()[_0x2d9b('0x15')](function(_0x3c39f6){for(var _0x5eef22=0x0;_0x5eef22<_0x3c39f6['length'];_0x5eef22++){_0x3c39f6[_0x5eef22][_0x2d9b('0x112')](_0x2d9b('0xaf'),_0x2d9b('0x118'));}return _0x3c39f6;}));return BPromise[_0x2d9b('0x4e')](_0x4f068c);})[_0x2d9b('0x15')](function(_0x30792f){var _0x517c21=_['flatten'](_0x30792f);_0x4f068c=[];return db[_0x2d9b('0x119')][_0x2d9b('0x11a')](function(_0x44ed6f){for(var _0x11f3c3=0x0;_0x11f3c3<_0x517c21[_0x2d9b('0x48')];_0x11f3c3++){_0x4f068c[_0x2d9b('0x44')](_0x517c21[_0x11f3c3]['removeAgent'](_0x4d40b2['id']),{'transaction':_0x44ed6f});}return BPromise[_0x2d9b('0x4e')](_0x4f068c)['then'](function(){if(_0x4d40b2[_0x2d9b('0x9d')]){return BPromise['each'](_['filter'](_0x517c21,function(_0x5e685a){return _0x5e685a[_0x2d9b('0x11c')](_0x2d9b('0xaf'))===_0x2d9b('0x113');}),function(_0x5ddd99){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x5ddd99['id'],'UserId':_0x4d40b2['id']},'transaction':_0x44ed6f});});}else{return;}})[_0x2d9b('0x15')](function(){db[_0x2d9b('0x11d')][_0x2d9b('0xd5')]({'where':{'teamId':_0x45afc7['id']}})[_0x2d9b('0x15')](function(_0xd164e5){if(_0xd164e5){return db[_0x2d9b('0x11e')][_0x2d9b('0x27')]({'where':{'UserId':_0x4d40b2['id'],'VoicePrefixId':_0xd164e5['dataValues']['VoicePrefixId']}});}});})[_0x2d9b('0x15')](function(){for(var _0x22de3b=0x0;_0x22de3b<_0x517c21[_0x2d9b('0x48')];_0x22de3b++){var _0x30a114=_0x517c21[_0x22de3b][_0x2d9b('0x11c')](_0x2d9b('0xaf'));var _0x3b3f0c=_0x30a114+_0x2d9b('0xa6');socket[_0x2d9b('0xa7')]('user'+_0x30a114+_0x2d9b('0xb2'),{'UserId':_0x4d40b2['id'],['queueField']:_0x517c21[_0x22de3b]['id']});}});});});}});}})[_0x2d9b('0x15')](respondWithStatusCode(_0x248b1b,null))[_0x2d9b('0x1e')](handleError(_0x248b1b,null));};exports['getLists']=function(_0x27c893,_0x23f8cf){var _0x1ea988={};var _0x197e48={};var _0x34b76f;var _0x332784;return db[_0x2d9b('0x36')][_0x2d9b('0xd5')]({'where':{'id':_0x27c893[_0x2d9b('0x50')]['id']}})[_0x2d9b('0x15')](handleEntityNotFound(_0x23f8cf,null))[_0x2d9b('0x15')](function(_0x4c117d){if(_0x4c117d){_0x34b76f=_0x4c117d;_0x197e48['model']=_[_0x2d9b('0x53')](db[_0x2d9b('0xcd')][_0x2d9b('0x37')]);_0x197e48[_0x2d9b('0x3e')]=_[_0x2d9b('0x53')](_0x27c893[_0x2d9b('0x3e')]);_0x197e48[_0x2d9b('0x55')]=_[_0x2d9b('0x56')](_0x197e48[_0x2d9b('0x51')],_0x197e48[_0x2d9b('0x3e')]);_0x1ea988[_0x2d9b('0x43')]=_[_0x2d9b('0x56')](_0x197e48[_0x2d9b('0x51')],qs['fields'](_0x27c893[_0x2d9b('0x3e')]['fields']));_0x1ea988[_0x2d9b('0x43')]=_0x1ea988['attributes'][_0x2d9b('0x48')]?_0x1ea988[_0x2d9b('0x43')]:_0x197e48[_0x2d9b('0x51')];_0x1ea988[_0x2d9b('0xc8')]=qs[_0x2d9b('0xc9')](_0x27c893[_0x2d9b('0x3e')][_0x2d9b('0xc9')]);_0x1ea988['where']=qs['filters'](_[_0x2d9b('0xca')](_0x27c893[_0x2d9b('0x3e')],_0x197e48[_0x2d9b('0x55')]));if(_0x27c893[_0x2d9b('0x3e')][_0x2d9b('0x2e')]){_0x1ea988[_0x2d9b('0x3c')]=_[_0x2d9b('0xcb')](_0x1ea988['where'],{'$or':_[_0x2d9b('0x2f')](_0x1ea988[_0x2d9b('0x43')],function(_0x1adb42){var _0xc3ee77={};_0xc3ee77[_0x1adb42]={'$like':'%'+_0x27c893[_0x2d9b('0x3e')][_0x2d9b('0x2e')]+'%'};return _0xc3ee77;})});}_0x1ea988=_[_0x2d9b('0xcb')]({},_0x1ea988,_0x27c893['options']);return _0x34b76f[_0x2d9b('0x127')](_0x1ea988);}})[_0x2d9b('0x15')](function(_0x27d329){if(_0x27d329){_0x332784=_0x27d329['length'];if(!_0x27c893[_0x2d9b('0x3e')][_0x2d9b('0xd2')](_0x2d9b('0xd9'))){_0x1ea988['limit']=qs[_0x2d9b('0x22')](_0x27c893[_0x2d9b('0x3e')]['limit']);_0x1ea988[_0x2d9b('0x23')]=qs['offset'](_0x27c893[_0x2d9b('0x3e')][_0x2d9b('0x23')]);}return _0x34b76f[_0x2d9b('0x127')](_0x1ea988);}})[_0x2d9b('0x15')](function(_0x3c767d){if(_0x3c767d){return _0x3c767d?{'count':_0x332784,'rows':_0x3c767d}:null;}})[_0x2d9b('0x15')](respondWithResult(_0x23f8cf,null))['catch'](handleError(_0x23f8cf,null));};exports[_0x2d9b('0x128')]=function(_0x52d7d7,_0x2fa971){var _0x39970b={};var _0x466486={};var _0xc2e4a8;return db[_0x2d9b('0x36')]['findOne']({'where':{'id':_0x52d7d7['params']['id']}})[_0x2d9b('0x15')](handleEntityNotFound(_0x2fa971,null))[_0x2d9b('0x15')](function(_0x185115){if(_0x185115){_0xc2e4a8=_0x185115;_0x466486['model']=_['keys'](db[_0x2d9b('0x36')][_0x2d9b('0x37')]);_0x466486[_0x2d9b('0x3e')]=_[_0x2d9b('0x53')](_0x52d7d7[_0x2d9b('0x3e')]);_0x466486[_0x2d9b('0x55')]=_[_0x2d9b('0x56')](_0x466486[_0x2d9b('0x51')],_0x466486[_0x2d9b('0x3e')]);_0x39970b[_0x2d9b('0x43')]=_[_0x2d9b('0x56')](_0x466486[_0x2d9b('0x51')],qs[_0x2d9b('0x57')](_0x52d7d7['query']['fields']));_0x39970b[_0x2d9b('0x43')]=_0x39970b[_0x2d9b('0x43')]['length']?_0x39970b[_0x2d9b('0x43')]:_0x466486[_0x2d9b('0x51')];_0x39970b[_0x2d9b('0xc8')]=qs['sort'](_0x52d7d7[_0x2d9b('0x3e')][_0x2d9b('0xc9')]);_0x39970b[_0x2d9b('0x3c')]=qs[_0x2d9b('0x55')](_[_0x2d9b('0xca')](_0x52d7d7[_0x2d9b('0x3e')],_0x466486[_0x2d9b('0x55')]));if(_0x52d7d7[_0x2d9b('0x3e')]['filter']){_0x39970b[_0x2d9b('0x3c')]=_['merge'](_0x39970b[_0x2d9b('0x3c')],{'$or':_[_0x2d9b('0x2f')](_0x39970b[_0x2d9b('0x43')],function(_0x48f284){var _0x2f4caa={};_0x2f4caa[_0x48f284]={'$like':'%'+_0x52d7d7[_0x2d9b('0x3e')][_0x2d9b('0x2e')]+'%'};return _0x2f4caa;})});}_0x39970b[_0x2d9b('0x51')]=db[_0x2d9b('0x36')];_0x39970b['as']=_0x2d9b('0x8b');_0x39970b=_[_0x2d9b('0xcb')]({},_0x39970b,_0x52d7d7[_0x2d9b('0xcc')]);return _0xc2e4a8['getVoiceQueues']({'include':[_0x39970b]});}})[_0x2d9b('0x15')](function(_0x253809){if(_0x253809){var _0x291cb7={},_0x229a32=[];for(var _0x433e62=0x0;_0x433e62<_0x253809[_0x2d9b('0x48')];_0x433e62+=0x1){for(var _0x55f715=0x0,_0x3029e7;_0x55f715<_0x253809[_0x433e62][_0x2d9b('0x8b')][_0x2d9b('0x48')];_0x55f715+=0x1){_0x3029e7=_0x253809[_0x433e62]['Agents'][_0x55f715][_0x2d9b('0x28')]({'plain':!![]});_0x291cb7[_0x3029e7['id']]=_0x3029e7;}}_0x291cb7=_[_0x2d9b('0x129')](_0x291cb7);for(var _0x4ae45d=qs[_0x2d9b('0x23')](_0x52d7d7[_0x2d9b('0x3e')][_0x2d9b('0x23')]);_0x4ae45d<_0x291cb7[_0x2d9b('0x48')]&&_0x229a32[_0x2d9b('0x48')]=_0x1586e3[_0xa6af('0x4b')]){throw new Error(_0xa6af('0x4c'));}})[_0xa6af('0xf')](function(){if(_0x156e2a){return db[_0xa6af('0x39')][_0xa6af('0x45')]({'where':{'membername':_0x156e2a['name']},'individualHooks':!![]});}})[_0xa6af('0xf')](function(){if(_0x156e2a){return _0x156e2a[_0xa6af('0x4d')]({'raw':!![]});}})[_0xa6af('0xf')](function(_0x2936d2){if(_0x156e2a){if(_0x2936d2){var _0x587c97=[];_0x243dde=_0x2936d2;if(_0x243dde['length']){for(var _0x4b0d18=0x0;_0x4b0d18<_0x243dde[_0xa6af('0x46')];_0x4b0d18++){_0x587c97[_0xa6af('0x2c')](db[_0xa6af('0x39')][_0xa6af('0x4e')]({'membername':_0x156e2a[_0xa6af('0x25')],'UserId':_0x156e2a['id'],'queue_name':_0x243dde[_0x4b0d18][_0xa6af('0x25')],'VoiceQueueId':_0x243dde[_0x4b0d18]['id'],'interface':_0x52d1bf,'paused':_0x156e2a[_0xa6af('0x4f')]||![],'penalty':_0x243dde[_0x4b0d18][_0xa6af('0x50')]||0x0}));}return BPromise['all'](_0x587c97);}}}})['then'](function(){if(_0x156e2a){return db[_0xa6af('0x26')][_0xa6af('0x18')]({'where':{'membername':_0x156e2a[_0xa6af('0x25')],'exitAt':null}});}})['then'](function(_0x53accc){if(_0x156e2a){if(_0x53accc&&_0x53accc[_0xa6af('0x46')]){var _0xc2bbe0=[];_0x53accc[_0xa6af('0x2b')](function(_0x3bd185){_0xc2bbe0[_0xa6af('0x2c')](_0x3bd185[_0xa6af('0x36')]({'exitAt':moment()[_0xa6af('0x2f')](_0xa6af('0x28'))}));});return BPromise[_0xa6af('0x42')](_0xc2bbe0);}}})['then'](function(_0x302c0f){if(_0x156e2a){var _0x2bc3f2=[];var _0x2f9d5e=[];var _0x21ad7f=utils[_0xa6af('0x2a')]();var _0x3f9513={'membername':_0x156e2a[_0xa6af('0x25')],'interface':_0x52d1bf,'enterAt':moment()[_0xa6af('0x2f')](_0xa6af('0x28')),'role':_0x156e2a[_0xa6af('0x51')],'internal':_0x156e2a[_0xa6af('0x34')]};_0x21ad7f[_0xa6af('0x2b')](function(_0x38ff84){_0x2bc3f2['push'](_['merge']({'channel':_0x38ff84,'type':_0xa6af('0x52'),'data1':'callysquare','data2':_0x52d1bf},_0x3f9513));if(_0x156e2a[_0xa6af('0x4f')]){_0x2f9d5e[_0xa6af('0x2c')](_['merge']({'channel':_0x38ff84,'type':_0xa6af('0x27'),'data1':_0xa6af('0x53')},_0x3f9513));}});return db['MemberReport'][_0xa6af('0x54')](_0x2bc3f2[_0xa6af('0x55')](_0x2f9d5e),{'individualHooks':!![]});}})['then'](function(){if(_0x156e2a){return _0x156e2a[_0xa6af('0x36')]({'online':!![],'lastLoginAt':moment()['format'](_0xa6af('0x28')),'voicePause':_0x156e2a[_0xa6af('0x4f')]||![],'mailPause':_0x156e2a[_0xa6af('0x4f')]||![],'chatPause':_0x156e2a[_0xa6af('0x4f')]||![],'faxPause':_0x156e2a[_0xa6af('0x4f')]||![],'smsPause':_0x156e2a[_0xa6af('0x4f')]||![],'openchannelPause':_0x156e2a[_0xa6af('0x4f')]||![],'pauseType':_0x156e2a[_0xa6af('0x4f')]?_0xa6af('0x53'):null,'lastPauseAt':moment()['format'](_0xa6af('0x28')),'interface':_0x52d1bf});}})[_0xa6af('0xf')](function(_0x283f81){_0x2d876c(_0x283f81);})[_0xa6af('0x17')](function(_0x497c21){_0xe46af8(_0x4b1edb['error'](0x1f4,_0x497c21[_0xa6af('0x16')]));});});}; \ No newline at end of file +var _0x8378=['YYYY-MM-DD\x20HH:mm:ss','body','uniqueid','bulkCreate','type','DEFAULT\x20PAUSE','channel','isValidChannel','voice','MemberReport','system','sms','whatsapp','set','%s%s','all','LogoutUser','findOne','destroy','length','LoginUser','mobile','phone','loginInPause','SIP/%s','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','callysquare','concat','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./user.socket','register','request','then','info','request\x20sent','stringify','error','code','User,\x20%s,\x20%s','message','result','catch','GetUser','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowUser','User','find','name','role','internal','UserVoiceQueueRt','update','PAUSE','format','updateAttributes','getChannels','forEach','push','isNil','interface'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x8378,0x12e));var _0x8837=function(_0xa01aeb,_0x277dd9){_0xa01aeb=_0xa01aeb-0x0;var _0x559556=_0x8378[_0xa01aeb];return _0x559556;};'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('ioredis');var db=require(_0x8837('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8837('0x6'))(_0x8837('0x7'));var config=require(_0x8837('0x8'));var jayson=require(_0x8837('0x9'));var client=jayson['client'][_0x8837('0xa')]({'port':0x232a});config['redis']=_[_0x8837('0xb')](config[_0x8837('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8837('0xd'))(new Redis(config['redis']));require(_0x8837('0xe'))[_0x8837('0xf')](socket);function respondWithRpcPromise(_0x26a63b,_0x124abc,_0x2ee252){return new BPromise(function(_0x57f514,_0x4a5256){return client[_0x8837('0x10')](_0x26a63b,_0x2ee252)[_0x8837('0x11')](function(_0x288c0e){logger[_0x8837('0x12')]('User,\x20%s,\x20%s',_0x124abc,_0x8837('0x13'));logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x124abc,_0x8837('0x13'),JSON[_0x8837('0x14')](_0x288c0e));if(_0x288c0e[_0x8837('0x15')]){if(_0x288c0e[_0x8837('0x15')][_0x8837('0x16')]===0x1f4){logger[_0x8837('0x15')](_0x8837('0x17'),_0x124abc,_0x288c0e[_0x8837('0x15')]['message']);return _0x4a5256(_0x288c0e[_0x8837('0x15')][_0x8837('0x18')]);}logger[_0x8837('0x15')]('User,\x20%s,\x20%s',_0x124abc,_0x288c0e[_0x8837('0x15')][_0x8837('0x18')]);return _0x57f514(_0x288c0e[_0x8837('0x15')]['message']);}else{logger['info'](_0x8837('0x17'),_0x124abc,'request\x20sent');_0x57f514(_0x288c0e[_0x8837('0x19')][_0x8837('0x18')]);}})[_0x8837('0x1a')](function(_0x236abe){logger[_0x8837('0x15')](_0x8837('0x17'),_0x124abc,_0x236abe);_0x4a5256(_0x236abe);});});}exports[_0x8837('0x1b')]=function(_0x26b2be){var _0x80d569=this;return new Promise(function(_0x144310,_0x46b31f){return db['User'][_0x8837('0x1c')]({'raw':_0x26b2be[_0x8837('0x1d')]?_0x26b2be[_0x8837('0x1d')][_0x8837('0x1e')]===undefined?!![]:![]:!![],'where':_0x26b2be[_0x8837('0x1d')]?_0x26b2be['options'][_0x8837('0x1f')]||null:null,'attributes':_0x26b2be[_0x8837('0x1d')]?_0x26b2be[_0x8837('0x1d')][_0x8837('0x20')]||null:null,'limit':_0x26b2be['options']?_0x26b2be[_0x8837('0x1d')][_0x8837('0x21')]||null:null,'include':_0x26b2be[_0x8837('0x1d')]?_0x26b2be[_0x8837('0x1d')][_0x8837('0x22')]?_[_0x8837('0x23')](_0x26b2be[_0x8837('0x1d')][_0x8837('0x22')],function(_0x3db239){return{'model':db[_0x3db239[_0x8837('0x24')]],'as':_0x3db239['as'],'attributes':_0x3db239['attributes'],'include':_0x3db239[_0x8837('0x22')]?_[_0x8837('0x23')](_0x3db239['include'],function(_0x40bfc2){return{'model':db[_0x40bfc2[_0x8837('0x24')]],'as':_0x40bfc2['as'],'attributes':_0x40bfc2[_0x8837('0x20')],'include':_0x40bfc2[_0x8837('0x22')]?_[_0x8837('0x23')](_0x40bfc2['include'],function(_0xa20d91){return{'model':db[_0xa20d91[_0x8837('0x24')]],'as':_0xa20d91['as'],'attributes':_0xa20d91[_0x8837('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30809d){logger['info'](_0x8837('0x1b'),_0x26b2be);logger[_0x8837('0x25')](_0x8837('0x1b'),_0x26b2be,JSON[_0x8837('0x14')](_0x30809d));_0x144310(_0x30809d);})[_0x8837('0x1a')](function(_0x331639){logger[_0x8837('0x15')](_0x8837('0x1b'),_0x331639[_0x8837('0x18')],_0x26b2be);_0x46b31f(_0x80d569[_0x8837('0x15')](0x1f4,_0x331639[_0x8837('0x18')]));});});};exports[_0x8837('0x26')]=function(_0x39f284){var _0x1a0086=this;return new Promise(function(_0x1577d8,_0x3dcc91){return db[_0x8837('0x27')][_0x8837('0x28')]({'raw':_0x39f284['options']?_0x39f284[_0x8837('0x1d')][_0x8837('0x1e')]===undefined?!![]:![]:!![],'where':_0x39f284['options']?_0x39f284[_0x8837('0x1d')][_0x8837('0x1f')]||null:null,'attributes':_0x39f284['options']?_0x39f284['options'][_0x8837('0x20')]||null:null,'include':_0x39f284[_0x8837('0x1d')]?_0x39f284['options']['include']?_[_0x8837('0x23')](_0x39f284['options'][_0x8837('0x22')],function(_0x49aed8){return{'model':db[_0x49aed8[_0x8837('0x24')]],'as':_0x49aed8['as'],'attributes':_0x49aed8[_0x8837('0x20')],'include':_0x49aed8[_0x8837('0x22')]?_['map'](_0x49aed8['include'],function(_0x5884a3){return{'model':db[_0x5884a3[_0x8837('0x24')]],'as':_0x5884a3['as'],'attributes':_0x5884a3[_0x8837('0x20')],'include':_0x5884a3[_0x8837('0x22')]?_[_0x8837('0x23')](_0x5884a3[_0x8837('0x22')],function(_0x6469cc){return{'model':db[_0x6469cc[_0x8837('0x24')]],'as':_0x6469cc['as'],'attributes':_0x6469cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x8837('0x11')](function(_0x2d7500){logger['info']('ShowUser',_0x39f284);logger[_0x8837('0x25')](_0x8837('0x26'),_0x39f284,JSON[_0x8837('0x14')](_0x2d7500));_0x1577d8(_0x2d7500);})[_0x8837('0x1a')](function(_0x4bebbd){logger['error'](_0x8837('0x26'),_0x4bebbd[_0x8837('0x18')],_0x39f284);_0x3dcc91(_0x1a0086[_0x8837('0x15')](0x1f4,_0x4bebbd[_0x8837('0x18')]));});});};exports['PauseUser']=function(_0x12f64b){var _0x412040=this;return new Promise(function(_0x541057,_0xccf17d){var _0x5e845f;return db[_0x8837('0x27')][_0x8837('0x28')]({'where':_0x12f64b[_0x8837('0x1d')]['where']||{},'attributes':['id',_0x8837('0x29'),_0x8837('0x2a'),_0x8837('0x2b'),'interface']})['then'](function(_0x9e37d6){if(_0x9e37d6){_0x5e845f=_0x9e37d6;return db[_0x8837('0x2c')][_0x8837('0x2d')]({'paused':0x1},{'where':{'UserId':_0x5e845f['id']},'individualHooks':!![]});}})['then'](function(){if(_0x5e845f){return db['MemberReport'][_0x8837('0x1c')]({'where':{'membername':_0x5e845f[_0x8837('0x29')],'type':_0x8837('0x2e'),'exitAt':null}});}})['then'](function(_0x39d1f6){if(_0x5e845f){if(_0x39d1f6&&_0x39d1f6['length']){var _0x227e96=moment()[_0x8837('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x24c8ef=0x0,_0xcc5aa4=_0x39d1f6['length'];_0x24c8ef<_0xcc5aa4;_0x24c8ef++){_0x39d1f6[_0x24c8ef][_0x8837('0x30')]({'exitAt':_0x227e96});}}}})[_0x8837('0x11')](function(){if(_0x5e845f){var _0x1a91b2=[];var _0x4c6515=utils[_0x8837('0x31')]();_0x4c6515[_0x8837('0x32')](function(_0x4fc90f){_0x1a91b2[_0x8837('0x33')]({'channel':_0x4fc90f,'membername':_0x5e845f[_0x8837('0x29')],'interface':_[_0x8837('0x34')](_0x5e845f['interface'])?util[_0x8837('0x2f')]('SIP/%s',_0x5e845f[_0x8837('0x29')]):_0x5e845f[_0x8837('0x35')],'type':_0x8837('0x2e'),'enterAt':moment()[_0x8837('0x2f')](_0x8837('0x36')),'data1':_0x12f64b[_0x8837('0x37')]['type']||'DEFAULT\x20PAUSE','role':_0x5e845f[_0x8837('0x2a')],'internal':_0x5e845f['internal'],'uniqueid':_0x12f64b[_0x8837('0x37')][_0x8837('0x38')]||null});});return db['MemberReport'][_0x8837('0x39')](_0x1a91b2,{'individualHooks':!![]});}})[_0x8837('0x11')](function(){if(_0x5e845f){return _0x5e845f[_0x8837('0x2d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x12f64b[_0x8837('0x37')][_0x8837('0x3a')]||_0x8837('0x3b'),'lastPauseAt':moment()[_0x8837('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x8837('0x11')](function(_0x7b3aa6){_0x541057(_0x7b3aa6);})[_0x8837('0x1a')](function(_0x50f3bd){_0xccf17d(_0x412040[_0x8837('0x15')](0x1f4,_0x50f3bd['message']));});});};exports['UnpauseUser']=function(_0x12998f){var _0x2aba1b=this;return new Promise(function(_0x24c915,_0x22e66c){var _0x3926e2;return db[_0x8837('0x27')]['findOne']({'where':_0x12998f[_0x8837('0x1d')]['where']||{},'attributes':['id',_0x8837('0x29')]})[_0x8837('0x11')](function(_0x3f51e4){if(_0x3f51e4){_0x3926e2=_0x3f51e4;if(_0x12998f[_0x8837('0x37')][_0x8837('0x3c')]&&!utils[_0x8837('0x3d')](_0x12998f[_0x8837('0x37')][_0x8837('0x3c')])){throw new Error('Unknown\x20channel');}switch(_0x12998f['body'][_0x8837('0x3c')]){case _0x8837('0x3e'):return db[_0x8837('0x2c')]['update']({'paused':0x0},{'where':{'UserId':_0x3926e2['id']}})[_0x8837('0x11')](function(){return db[_0x8837('0x3f')][_0x8837('0x28')]({'where':{'channel':_0x12998f['body'][_0x8837('0x3c')],'membername':_0x3926e2[_0x8837('0x29')],'type':_0x8837('0x2e'),'exitAt':null}});})[_0x8837('0x11')](function(_0x5cca38){if(_0x5cca38){return _0x5cca38['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x8837('0x40')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x3926e2[_0x8837('0x2d')]({'voicePause':![]});});case'mail':case'chat':case'fax':case _0x8837('0x41'):case'openchannel':case _0x8837('0x42'):return db[_0x8837('0x3f')]['find']({'where':{'channel':_0x12998f[_0x8837('0x37')][_0x8837('0x3c')],'membername':_0x3926e2[_0x8837('0x29')],'type':'PAUSE','exitAt':null}})[_0x8837('0x11')](function(_0x500820){return _0x500820[_0x8837('0x2d')]({'exitAt':moment()[_0x8837('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});})[_0x8837('0x11')](function(){var _0x18e457={};_[_0x8837('0x43')](_0x18e457,util[_0x8837('0x2f')](_0x8837('0x44'),_0x12998f[_0x8837('0x37')][_0x8837('0x3c')],'Pause'),![]);return _0x3926e2[_0x8837('0x2d')](_0x18e457);});default:return db[_0x8837('0x2c')]['update']({'paused':0x0},{'where':{'UserId':_0x3926e2['id']}})[_0x8837('0x11')](function(){return db['MemberReport'][_0x8837('0x1c')]({'where':{'membername':_0x3926e2[_0x8837('0x29')],'type':_0x8837('0x2e'),'exitAt':null}});})[_0x8837('0x11')](function(_0x454f27){var _0x371b8c=[];_0x454f27[_0x8837('0x32')](function(_0x3e0274){_0x371b8c[_0x8837('0x33')](_0x3e0274[_0x8837('0x2d')]({'exitAt':moment()[_0x8837('0x2f')](_0x8837('0x36')),'data2':_0x8837('0x40')}));});return BPromise[_0x8837('0x45')](_0x371b8c);})[_0x8837('0x11')](function(){return _0x3926e2[_0x8837('0x2d')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x8837('0x11')](function(_0x4575ef){_0x24c915(_0x4575ef);})[_0x8837('0x1a')](function(_0x3a4525){_0x22e66c(_0x2aba1b[_0x8837('0x15')](0x1f4,_0x3a4525[_0x8837('0x18')]));});});};exports[_0x8837('0x46')]=function(_0x58f4c2){var _0x1c11a8=this;return new Promise(function(_0x1350b7,_0x4a7b83){var _0x5575c1;return db[_0x8837('0x27')][_0x8837('0x47')]({'where':_0x58f4c2[_0x8837('0x1d')][_0x8837('0x1f')]||{},'attributes':['id',_0x8837('0x29')]})['then'](function(_0x16faab){if(_0x16faab){_0x5575c1=_0x16faab;return db[_0x8837('0x2c')][_0x8837('0x48')]({'where':{'membername':_0x5575c1[_0x8837('0x29')]},'individualHooks':!![]});}})[_0x8837('0x11')](function(){if(_0x5575c1){return db['MemberReport'][_0x8837('0x1c')]({'where':{'membername':_0x5575c1[_0x8837('0x29')],'exitAt':null}});}})[_0x8837('0x11')](function(_0x1400f2){if(_0x5575c1){if(_0x1400f2&&_0x1400f2[_0x8837('0x49')]){var _0x9f2171=[];_0x1400f2['forEach'](function(_0x2ccdf4){_0x9f2171[_0x8837('0x33')](_0x2ccdf4[_0x8837('0x2d')]({'exitAt':moment()[_0x8837('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x8837('0x45')](_0x9f2171);}}})['then'](function(){if(_0x5575c1){return _0x5575c1[_0x8837('0x2d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x5cf45e){_0x1350b7(_0x5cf45e);})[_0x8837('0x1a')](function(_0x38f838){_0x4a7b83(_0x1c11a8[_0x8837('0x15')](0x1f4,_0x38f838['message']));});});};exports[_0x8837('0x4a')]=function(_0x233474){var _0x40f72b=this;return new Promise(function(_0x172b49,_0x4b5126){var _0x103963;var _0x187835;var _0x2bc644;var _0x319280;return db['User'][_0x8837('0x47')]({'where':_0x233474['options'][_0x8837('0x1f')]||{},'attributes':['id',_0x8837('0x29'),_0x8837('0x2a'),_0x8837('0x4b'),_0x8837('0x4c'),_0x8837('0x2b'),_0x8837('0x4d'),_0x8837('0x35')]})[_0x8837('0x11')](function(_0xef99c3){if(_0xef99c3){_0x103963=_0xef99c3;_0x319280=_0x233474[_0x8837('0x37')]['interface']?_0x233474[_0x8837('0x37')][_0x8837('0x35')]:util[_0x8837('0x2f')](_0x8837('0x4e'),_0x103963['name']);return db['User']['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x103963['id']}}});}})[_0x8837('0x11')](function(_0x2f1906){if(_0x2f1906){_0x2bc644=_0x2f1906;return require('../../config/license/util')[_0x8837('0x4f')]();}})[_0x8837('0x11')](function(_0x221300){if(_0x221300&&_0x221300['agents']&&_0x2bc644>=_0x221300[_0x8837('0x50')]){throw new Error(_0x8837('0x51'));}})['then'](function(){if(_0x103963){return db[_0x8837('0x2c')][_0x8837('0x48')]({'where':{'membername':_0x103963[_0x8837('0x29')]},'individualHooks':!![]});}})[_0x8837('0x11')](function(){if(_0x103963){return _0x103963[_0x8837('0x52')]({'raw':!![]});}})[_0x8837('0x11')](function(_0x40ce34){if(_0x103963){if(_0x40ce34){var _0x59e4d7=[];_0x187835=_0x40ce34;if(_0x187835[_0x8837('0x49')]){for(var _0x51cee4=0x0;_0x51cee4<_0x187835[_0x8837('0x49')];_0x51cee4++){_0x59e4d7['push'](db[_0x8837('0x2c')][_0x8837('0x53')]({'membername':_0x103963[_0x8837('0x29')],'UserId':_0x103963['id'],'queue_name':_0x187835[_0x51cee4][_0x8837('0x29')],'VoiceQueueId':_0x187835[_0x51cee4]['id'],'interface':_0x319280,'paused':_0x103963[_0x8837('0x4d')]||![],'penalty':_0x187835[_0x51cee4][_0x8837('0x54')]||0x0}));}return BPromise[_0x8837('0x45')](_0x59e4d7);}}}})[_0x8837('0x11')](function(){if(_0x103963){return db[_0x8837('0x3f')][_0x8837('0x1c')]({'where':{'membername':_0x103963['name'],'exitAt':null}});}})[_0x8837('0x11')](function(_0x1af5db){if(_0x103963){if(_0x1af5db&&_0x1af5db[_0x8837('0x49')]){var _0x442820=[];_0x1af5db[_0x8837('0x32')](function(_0x4fb00b){_0x442820[_0x8837('0x33')](_0x4fb00b[_0x8837('0x2d')]({'exitAt':moment()['format'](_0x8837('0x36'))}));});return BPromise[_0x8837('0x45')](_0x442820);}}})[_0x8837('0x11')](function(_0x319294){if(_0x103963){var _0x418c43=[];var _0x5f12e1=[];var _0x432ea8=utils[_0x8837('0x31')]();var _0x5302f9={'membername':_0x103963[_0x8837('0x29')],'interface':_0x319280,'enterAt':moment()[_0x8837('0x2f')](_0x8837('0x36')),'role':_0x103963[_0x8837('0x2a')],'internal':_0x103963[_0x8837('0x2b')]};_0x432ea8[_0x8837('0x32')](function(_0x58e32c){_0x418c43[_0x8837('0x33')](_[_0x8837('0x55')]({'channel':_0x58e32c,'type':'LOGIN','data1':_0x8837('0x56'),'data2':_0x319280},_0x5302f9));if(_0x103963[_0x8837('0x4d')]){_0x5f12e1[_0x8837('0x33')](_[_0x8837('0x55')]({'channel':_0x58e32c,'type':_0x8837('0x2e'),'data1':'LOGININPAUSE'},_0x5302f9));}});return db[_0x8837('0x3f')][_0x8837('0x39')](_0x418c43[_0x8837('0x57')](_0x5f12e1),{'individualHooks':!![]});}})[_0x8837('0x11')](function(){if(_0x103963){return _0x103963[_0x8837('0x2d')]({'online':!![],'lastLoginAt':moment()[_0x8837('0x2f')](_0x8837('0x36')),'voicePause':_0x103963[_0x8837('0x4d')]||![],'mailPause':_0x103963[_0x8837('0x4d')]||![],'chatPause':_0x103963[_0x8837('0x4d')]||![],'faxPause':_0x103963[_0x8837('0x4d')]||![],'smsPause':_0x103963[_0x8837('0x4d')]||![],'openchannelPause':_0x103963['loginInPause']||![],'pauseType':_0x103963[_0x8837('0x4d')]?_0x8837('0x58'):null,'lastPauseAt':moment()[_0x8837('0x2f')](_0x8837('0x36')),'interface':_0x319280});}})[_0x8837('0x11')](function(_0x4cadb6){_0x172b49(_0x4cadb6);})[_0x8837('0x1a')](function(_0x364ee1){_0x4b5126(_0x40f72b[_0x8837('0x15')](0x1f4,_0x364ee1[_0x8837('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index f804f53..ac0cd31 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 _0xfc49=['removeListener','register','length','user:','./user.events','save','remove','update','emit'];(function(_0x593a73,_0x41aaed){var _0x358cc7=function(_0x395bbd){while(--_0x395bbd){_0x593a73['push'](_0x593a73['shift']());}};_0x358cc7(++_0x41aaed);}(_0xfc49,0x1f3));var _0x9fc4=function(_0x343a11,_0x8df74d){_0x343a11=_0x343a11-0x0;var _0x2a9e3f=_0xfc49[_0x343a11];return _0x2a9e3f;};'use strict';var UserEvents=require(_0x9fc4('0x0'));var events=[_0x9fc4('0x1'),_0x9fc4('0x2'),_0x9fc4('0x3')];function createListener(_0x27734d,_0x9d7094){return function(_0x251796){_0x9d7094[_0x9fc4('0x4')](_0x27734d,_0x251796);};}function removeListener(_0x5bd56f,_0x308b3b){return function(){UserEvents[_0x9fc4('0x5')](_0x5bd56f,_0x308b3b);};}exports[_0x9fc4('0x6')]=function(_0x52d324){for(var _0x532071=0x0,_0x4a2a8b=events[_0x9fc4('0x7')];_0x532071<_0x4a2a8b;_0x532071++){var _0x5027f0=events[_0x532071];var _0x3a2441=createListener(_0x9fc4('0x8')+_0x5027f0,_0x52d324);UserEvents['on'](_0x5027f0,_0x3a2441);}}; \ No newline at end of file +var _0x6352=['removeListener','register','length','user:','save','remove','update'];(function(_0x287a7e,_0x40906d){var _0x2151e1=function(_0x445fc3){while(--_0x445fc3){_0x287a7e['push'](_0x287a7e['shift']());}};_0x2151e1(++_0x40906d);}(_0x6352,0xac));var _0x2635=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x6352[_0x2e4e19];return _0x9ba20b;};'use strict';var UserEvents=require('./user.events');var events=[_0x2635('0x0'),_0x2635('0x1'),_0x2635('0x2')];function createListener(_0x25d08e,_0x6657fb){return function(_0x455085){_0x6657fb['emit'](_0x25d08e,_0x455085);};}function removeListener(_0x55035b,_0x5f4ecf){return function(){UserEvents[_0x2635('0x3')](_0x55035b,_0x5f4ecf);};}exports[_0x2635('0x4')]=function(_0x2e8af3){for(var _0x486ec9=0x0,_0x128e41=events[_0x2635('0x5')];_0x486ec9<_0x128e41;_0x486ec9++){var _0x4b308e=events[_0x486ec9];var _0x223fe8=createListener(_0x2635('0x6')+_0x4b308e,_0x2e8af3);UserEvents['on'](_0x4b308e,_0x223fe8);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index e2eeb23..94b6800 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(_0x1230f1,_0x310bbc){var _0xc4ef35=function(_0x445a7d){while(--_0x445a7d){_0x1230f1['push'](_0x1230f1['shift']());}};_0xc4ef35(++_0x310bbc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0xcb91[_0x5ac84c];return _0x3c53d2;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2fe7b0,_0x39c02b){var _0x456c3d=function(_0x44041e){while(--_0x44041e){_0x2fe7b0['push'](_0x2fe7b0['shift']());}};_0x456c3d(++_0x39c02b);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 5c1d582..bf55c6d 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 _0xcb6a=['INTEGER','sequelize','exports'];(function(_0x27bd9b,_0x206238){var _0xbd6219=function(_0x3c1577){while(--_0x3c1577){_0x27bd9b['push'](_0x27bd9b['shift']());}};_0xbd6219(++_0x206238);}(_0xcb6a,0x1b1));var _0xacb6=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0xcb6a[_0x31a371];return _0x2a5bd6;};'use strict';var Sequelize=require(_0xacb6('0x0'));module[_0xacb6('0x1')]={'penalty':{'type':Sequelize[_0xacb6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7f2f=['exports','INTEGER'];(function(_0x5aa373,_0x54c7f4){var _0x590e8e=function(_0x505e62){while(--_0x505e62){_0x5aa373['push'](_0x5aa373['shift']());}};_0x590e8e(++_0x54c7f4);}(_0x7f2f,0x11c));var _0xf7f2=function(_0x4a7b2b,_0x3366e1){_0x4a7b2b=_0x4a7b2b-0x0;var _0x35e381=_0x7f2f[_0x4a7b2b];return _0x35e381;};'use strict';var Sequelize=require('sequelize');module[_0xf7f2('0x0')]={'penalty':{'type':Sequelize[_0xf7f2('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 dcdf60e..0c593cf 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 _0xa6bc=['request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment'];(function(_0x36a469,_0x59d84c){var _0x3347fc=function(_0x3860e7){while(--_0x3860e7){_0x36a469['push'](_0x36a469['shift']());}};_0x3347fc(++_0x59d84c);}(_0xa6bc,0x8a));var _0xca6b=function(_0x519380,_0x7f196){_0x519380=_0x519380-0x0;var _0x60ba2c=_0xa6bc[_0x519380];return _0x60ba2c;};'use strict';var _=require(_0xca6b('0x0'));var util=require(_0xca6b('0x1'));var logger=require(_0xca6b('0x2'))(_0xca6b('0x3'));var moment=require(_0xca6b('0x4'));var BPromise=require('bluebird');var rp=require(_0xca6b('0x5'));var fs=require('fs');var path=require(_0xca6b('0x6'));var rimraf=require(_0xca6b('0x7'));var config=require(_0xca6b('0x8'));var attributes=require(_0xca6b('0x9'));module['exports']=function(_0x400987,_0x1797f9){return _0x400987[_0xca6b('0xa')](_0xca6b('0xb'),attributes,{'tableName':_0xca6b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e62=['rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','util','moment','bluebird','request-promise','path'];(function(_0x41699e,_0x586ea4){var _0x5e7c11=function(_0x576eb0){while(--_0x576eb0){_0x41699e['push'](_0x41699e['shift']());}};_0x5e7c11(++_0x586ea4);}(_0x6e62,0x177));var _0x26e6=function(_0x15d529,_0x5c3d21){_0x15d529=_0x15d529-0x0;var _0x3b607c=_0x6e62[_0x15d529];return _0x3b607c;};'use strict';var _=require('lodash');var util=require(_0x26e6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x26e6('0x1'));var BPromise=require(_0x26e6('0x2'));var rp=require(_0x26e6('0x3'));var fs=require('fs');var path=require(_0x26e6('0x4'));var rimraf=require(_0x26e6('0x5'));var config=require(_0x26e6('0x6'));var attributes=require(_0x26e6('0x7'));module[_0x26e6('0x8')]=function(_0x5c9644,_0x401001){return _0x5c9644['define'](_0x26e6('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 42f7ea2..b4905f8 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 _0xef67=['debug','error','code','message','request\x20sent','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','UserChatQueue,\x20%s,\x20%s'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xef67,0x1c8));var _0x7ef6=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0xef67[_0x1ebce2];return _0x4a330c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7ef6('0x0'));var BPromise=require('bluebird');var rs=require(_0x7ef6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ef6('0x2'))['db'];var utils=require(_0x7ef6('0x3'));var logger=require(_0x7ef6('0x4'))(_0x7ef6('0x5'));var config=require(_0x7ef6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7ef6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2041af,_0x213159,_0x4be090){return new BPromise(function(_0x1cb561,_0x2c58d8){return client[_0x7ef6('0x8')](_0x2041af,_0x4be090)[_0x7ef6('0x9')](function(_0x14d8e3){logger[_0x7ef6('0xa')](_0x7ef6('0xb'),_0x213159,'request\x20sent');logger[_0x7ef6('0xc')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x213159,'request\x20sent',JSON['stringify'](_0x14d8e3));if(_0x14d8e3[_0x7ef6('0xd')]){if(_0x14d8e3[_0x7ef6('0xd')][_0x7ef6('0xe')]===0x1f4){logger['error'](_0x7ef6('0xb'),_0x213159,_0x14d8e3[_0x7ef6('0xd')][_0x7ef6('0xf')]);return _0x2c58d8(_0x14d8e3['error']['message']);}logger[_0x7ef6('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x213159,_0x14d8e3['error']['message']);return _0x1cb561(_0x14d8e3['error'][_0x7ef6('0xf')]);}else{logger['info'](_0x7ef6('0xb'),_0x213159,_0x7ef6('0x10'));_0x1cb561(_0x14d8e3['result'][_0x7ef6('0xf')]);}})[_0x7ef6('0x11')](function(_0x374f52){logger[_0x7ef6('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x213159,_0x374f52);_0x2c58d8(_0x374f52);});});} \ No newline at end of file +var _0x2dae=['code','UserChatQueue,\x20%s,\x20%s','message','catch','util','moment','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x328412,_0x1147cb){var _0x44023e=function(_0x14af2a){while(--_0x14af2a){_0x328412['push'](_0x328412['shift']());}};_0x44023e(++_0x1147cb);}(_0x2dae,0x6a));var _0xe2da=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0x2dae[_0x245afe];return _0x4eefde;};'use strict';var _=require('lodash');var util=require(_0xe2da('0x0'));var moment=require(_0xe2da('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2da('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe2da('0x3'));var config=require(_0xe2da('0x4'));var jayson=require(_0xe2da('0x5'));var client=jayson[_0xe2da('0x6')][_0xe2da('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x171caa,_0x3cd235,_0x3d6d0b){return new BPromise(function(_0x55a90c,_0x46e204){return client[_0xe2da('0x8')](_0x171caa,_0x3d6d0b)[_0xe2da('0x9')](function(_0x2ccc88){logger[_0xe2da('0xa')]('UserChatQueue,\x20%s,\x20%s',_0x3cd235,'request\x20sent');logger['debug'](_0xe2da('0xb'),_0x3cd235,'request\x20sent',JSON['stringify'](_0x2ccc88));if(_0x2ccc88[_0xe2da('0xc')]){if(_0x2ccc88[_0xe2da('0xc')][_0xe2da('0xd')]===0x1f4){logger[_0xe2da('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x3cd235,_0x2ccc88[_0xe2da('0xc')]['message']);return _0x46e204(_0x2ccc88[_0xe2da('0xc')]['message']);}logger[_0xe2da('0xc')](_0xe2da('0xe'),_0x3cd235,_0x2ccc88[_0xe2da('0xc')][_0xe2da('0xf')]);return _0x55a90c(_0x2ccc88[_0xe2da('0xc')][_0xe2da('0xf')]);}else{logger[_0xe2da('0xa')]('UserChatQueue,\x20%s,\x20%s',_0x3cd235,'request\x20sent');_0x55a90c(_0x2ccc88['result'][_0xe2da('0xf')]);}})[_0xe2da('0x10')](function(_0x4e603e){logger[_0xe2da('0xc')](_0xe2da('0xe'),_0x3cd235,_0x4e603e);_0x46e204(_0x4e603e);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index f689b80..e74120d 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3e075e,_0x5e655b){var _0x5c6b49=function(_0x3f26c9){while(--_0x3f26c9){_0x3e075e['push'](_0x3e075e['shift']());}};_0x5c6b49(++_0x5e655b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x119705,_0xba9427){_0x119705=_0x119705-0x0;var _0x2affc2=_0xcb91[_0x119705];return _0x2affc2;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4dc35f,_0x377c51){var _0x1f8820=function(_0x37c340){while(--_0x37c340){_0x4dc35f['push'](_0x4dc35f['shift']());}};_0x1f8820(++_0x377c51);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index b844982..040fa47 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 _0x642d=['STRING','sequelize','exports','INTEGER'];(function(_0x2f178c,_0x24059a){var _0x32f9cd=function(_0x570af7){while(--_0x570af7){_0x2f178c['push'](_0x2f178c['shift']());}};_0x32f9cd(++_0x24059a);}(_0x642d,0xb5));var _0xd642=function(_0x4b53e3,_0x1bfecc){_0x4b53e3=_0x4b53e3-0x0;var _0x35f754=_0x642d[_0x4b53e3];return _0x35f754;};'use strict';var Sequelize=require(_0xd642('0x0'));module[_0xd642('0x1')]={'penalty':{'type':Sequelize[_0xd642('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xd642('0x3')]}}; \ No newline at end of file +var _0xdfcd=['INTEGER','sequelize'];(function(_0x21d9c3,_0x57b393){var _0x1f7207=function(_0x27bc36){while(--_0x27bc36){_0x21d9c3['push'](_0x21d9c3['shift']());}};_0x1f7207(++_0x57b393);}(_0xdfcd,0x1c7));var _0xddfc=function(_0x5c840c,_0x188073){_0x5c840c=_0x5c840c-0x0;var _0x170a06=_0xdfcd[_0x5c840c];return _0x170a06;};'use strict';var Sequelize=require(_0xddfc('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xddfc('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xddfc('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 4a09b8a..990f83e 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 _0xacef=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','../../config/logger'];(function(_0x385af0,_0x3d7789){var _0x5c27f3=function(_0x2538d1){while(--_0x2538d1){_0x385af0['push'](_0x385af0['shift']());}};_0x5c27f3(++_0x3d7789);}(_0xacef,0x106));var _0xface=function(_0xae3665,_0x21f169){_0xae3665=_0xae3665-0x0;var _0x350d41=_0xacef[_0xae3665];return _0x350d41;};'use strict';var _=require(_0xface('0x0'));var util=require('util');var logger=require(_0xface('0x1'))(_0xface('0x2'));var moment=require(_0xface('0x3'));var BPromise=require(_0xface('0x4'));var rp=require(_0xface('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xface('0x6'));var config=require(_0xface('0x7'));var attributes=require(_0xface('0x8'));module[_0xface('0x9')]=function(_0x19a440,_0x3bd625){return _0x19a440[_0xface('0xa')](_0xface('0xb'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe577=['UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','define'];(function(_0x234cd5,_0x1e7b00){var _0x17a377=function(_0x138d3a){while(--_0x138d3a){_0x234cd5['push'](_0x234cd5['shift']());}};_0x17a377(++_0x1e7b00);}(_0xe577,0x1c5));var _0x7e57=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe577[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x7e57('0x0'));var util=require(_0x7e57('0x1'));var logger=require(_0x7e57('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7e57('0x3'));var fs=require('fs');var path=require(_0x7e57('0x4'));var rimraf=require(_0x7e57('0x5'));var config=require(_0x7e57('0x6'));var attributes=require(_0x7e57('0x7'));module['exports']=function(_0x21578c,_0x3012de){return _0x21578c[_0x7e57('0x8')](_0x7e57('0x9'),attributes,{'tableName':_0x7e57('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 2dd0925..fa46b07 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 _0xe754=['message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x5f23f3,_0x313a4f){var _0x233399=function(_0x4e44af){while(--_0x4e44af){_0x5f23f3['push'](_0x5f23f3['shift']());}};_0x233399(++_0x313a4f);}(_0xe754,0xca));var _0x4e75=function(_0x22f09e,_0x4313a9){_0x22f09e=_0x22f09e-0x0;var _0x10dda6=_0xe754[_0x22f09e];return _0x10dda6;};'use strict';var _=require(_0x4e75('0x0'));var util=require('util');var moment=require(_0x4e75('0x1'));var BPromise=require(_0x4e75('0x2'));var rs=require(_0x4e75('0x3'));var fs=require('fs');var Redis=require(_0x4e75('0x4'));var db=require(_0x4e75('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4e75('0x6'));var config=require(_0x4e75('0x7'));var jayson=require(_0x4e75('0x8'));var client=jayson[_0x4e75('0x9')][_0x4e75('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2094d0,_0x8efe9a,_0x328fc8){return new BPromise(function(_0x101b92,_0x162470){return client[_0x4e75('0xb')](_0x2094d0,_0x328fc8)[_0x4e75('0xc')](function(_0x7a0069){logger[_0x4e75('0xd')](_0x4e75('0xe'),_0x8efe9a,_0x4e75('0xf'));logger[_0x4e75('0x10')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x8efe9a,'request\x20sent',JSON['stringify'](_0x7a0069));if(_0x7a0069[_0x4e75('0x11')]){if(_0x7a0069['error']['code']===0x1f4){logger[_0x4e75('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x8efe9a,_0x7a0069[_0x4e75('0x11')][_0x4e75('0x12')]);return _0x162470(_0x7a0069[_0x4e75('0x11')][_0x4e75('0x12')]);}logger[_0x4e75('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x8efe9a,_0x7a0069[_0x4e75('0x11')][_0x4e75('0x12')]);return _0x101b92(_0x7a0069['error']['message']);}else{logger[_0x4e75('0xd')](_0x4e75('0xe'),_0x8efe9a,'request\x20sent');_0x101b92(_0x7a0069[_0x4e75('0x13')][_0x4e75('0x12')]);}})['catch'](function(_0x54d724){logger[_0x4e75('0x11')](_0x4e75('0xe'),_0x8efe9a,_0x54d724);_0x162470(_0x54d724);});});} \ No newline at end of file +var _0xb5d3=['info','UserFaxQueue,\x20%s,\x20%s','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb5d3,0xba));var _0x3b5d=function(_0x11dde4,_0x1d4852){_0x11dde4=_0x11dde4-0x0;var _0x6eea94=_0xb5d3[_0x11dde4];return _0x6eea94;};'use strict';var _=require(_0x3b5d('0x0'));var util=require(_0x3b5d('0x1'));var moment=require(_0x3b5d('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b5d('0x3'));var fs=require('fs');var Redis=require(_0x3b5d('0x4'));var db=require(_0x3b5d('0x5'))['db'];var utils=require(_0x3b5d('0x6'));var logger=require(_0x3b5d('0x7'))('rpc');var config=require(_0x3b5d('0x8'));var jayson=require(_0x3b5d('0x9'));var client=jayson['client'][_0x3b5d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a4d88,_0x4bdfca,_0x5c69d5){return new BPromise(function(_0x2fd5e0,_0x3ce2bf){return client[_0x3b5d('0xb')](_0x1a4d88,_0x5c69d5)['then'](function(_0x21b250){logger[_0x3b5d('0xc')](_0x3b5d('0xd'),_0x4bdfca,'request\x20sent');logger['debug'](_0x3b5d('0xe'),_0x4bdfca,_0x3b5d('0xf'),JSON[_0x3b5d('0x10')](_0x21b250));if(_0x21b250[_0x3b5d('0x11')]){if(_0x21b250['error'][_0x3b5d('0x12')]===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x4bdfca,_0x21b250['error']['message']);return _0x3ce2bf(_0x21b250[_0x3b5d('0x11')][_0x3b5d('0x13')]);}logger[_0x3b5d('0x11')](_0x3b5d('0xd'),_0x4bdfca,_0x21b250[_0x3b5d('0x11')]['message']);return _0x2fd5e0(_0x21b250[_0x3b5d('0x11')][_0x3b5d('0x13')]);}else{logger[_0x3b5d('0xc')](_0x3b5d('0xd'),_0x4bdfca,_0x3b5d('0xf'));_0x2fd5e0(_0x21b250[_0x3b5d('0x14')][_0x3b5d('0x13')]);}})[_0x3b5d('0x15')](function(_0x25988d){logger[_0x3b5d('0x11')](_0x3b5d('0xd'),_0x4bdfca,_0x25988d);_0x3ce2bf(_0x25988d);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index be5ee1b..869907a 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x40a0a4,_0x5d30d0){var _0x50cc17=function(_0x4ea52d){while(--_0x4ea52d){_0x40a0a4['push'](_0x40a0a4['shift']());}};_0x50cc17(++_0x5d30d0);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x255d67,_0x2d5b8c){var _0x438131=function(_0x2b486e){while(--_0x2b486e){_0x255d67['push'](_0x255d67['shift']());}};_0x438131(++_0x2d5b8c);}(_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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index a8c9f66..ddd322e 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 _0xbd06=['exports','INTEGER'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xbd06,0x98));var _0x6bd0=function(_0x1cb593,_0x6dd77f){_0x1cb593=_0x1cb593-0x0;var _0x46bf06=_0xbd06[_0x1cb593];return _0x46bf06;};'use strict';var Sequelize=require('sequelize');module[_0x6bd0('0x0')]={'penalty':{'type':Sequelize[_0x6bd0('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x133a=['INTEGER','exports'];(function(_0x156555,_0x496650){var _0x2885ad=function(_0x368eaa){while(--_0x368eaa){_0x156555['push'](_0x156555['shift']());}};_0x2885ad(++_0x496650);}(_0x133a,0xcb));var _0xa133=function(_0x5a3d49,_0x24b21a){_0x5a3d49=_0x5a3d49-0x0;var _0x4d5c23=_0x133a[_0x5a3d49];return _0x4d5c23;};'use strict';var Sequelize=require('sequelize');module[_0xa133('0x0')]={'penalty':{'type':Sequelize[_0xa133('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 23fd3b0..63c3f48 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 _0x0b41=['UserMailQueue','user_has_mail_queues','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./userMailQueue.attributes','exports','define'];(function(_0x1df16b,_0x47cdef){var _0x449165=function(_0x47ff3e){while(--_0x47ff3e){_0x1df16b['push'](_0x1df16b['shift']());}};_0x449165(++_0x47cdef);}(_0x0b41,0x16d));var _0x10b4=function(_0x2f9802,_0x32f5f7){_0x2f9802=_0x2f9802-0x0;var _0x6fbdce=_0x0b41[_0x2f9802];return _0x6fbdce;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x10b4('0x0'))(_0x10b4('0x1'));var moment=require(_0x10b4('0x2'));var BPromise=require(_0x10b4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x10b4('0x4'));var config=require(_0x10b4('0x5'));var attributes=require(_0x10b4('0x6'));module[_0x10b4('0x7')]=function(_0x28a191,_0x1bf704){return _0x28a191[_0x10b4('0x8')](_0x10b4('0x9'),attributes,{'tableName':_0x10b4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42e2=['user_has_mail_queues','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x53b3e7,_0x1c05a0){var _0x229432=function(_0x22ddfa){while(--_0x22ddfa){_0x53b3e7['push'](_0x53b3e7['shift']());}};_0x229432(++_0x1c05a0);}(_0x42e2,0x1ae));var _0x242e=function(_0x273dc0,_0x519186){_0x273dc0=_0x273dc0-0x0;var _0x3f2d30=_0x42e2[_0x273dc0];return _0x3f2d30;};'use strict';var _=require(_0x242e('0x0'));var util=require(_0x242e('0x1'));var logger=require(_0x242e('0x2'))(_0x242e('0x3'));var moment=require(_0x242e('0x4'));var BPromise=require('bluebird');var rp=require(_0x242e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x242e('0x6'));var config=require(_0x242e('0x7'));var attributes=require(_0x242e('0x8'));module[_0x242e('0x9')]=function(_0x717990,_0x58f357){return _0x717990[_0x242e('0xa')](_0x242e('0xb'),attributes,{'tableName':_0x242e('0xc'),'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 b8302cf..ff6849a 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 _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3a3674,_0x3d2243){var _0x3e3191=function(_0x1efed4){while(--_0x1efed4){_0x3a3674['push'](_0x3a3674['shift']());}};_0x3e3191(++_0x3d2243);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2feab1,_0x2178ff){_0x2feab1=_0x2feab1-0x0;var _0x78401d=_0x8ef6[_0x2feab1];return _0x78401d;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x163659,_0x1f57c0){var _0x5a91fa=function(_0x380bf5){while(--_0x380bf5){_0x163659['push'](_0x163659['shift']());}};_0x5a91fa(++_0x1f57c0);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3323b2,_0x206a48){_0x3323b2=_0x3323b2-0x0;var _0x48e205=_0x8ef6[_0x3323b2];return _0x48e205;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 56e32b3..d3b8ec5 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 _0x3ac4=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','isAuthenticated','sendUserNotification'];(function(_0x23f60d,_0x4e9de6){var _0x33efd4=function(_0x441db7){while(--_0x441db7){_0x23f60d['push'](_0x23f60d['shift']());}};_0x33efd4(++_0x4e9de6);}(_0x3ac4,0x1e2));var _0x43ac=function(_0x562216,_0x56f31f){_0x562216=_0x562216-0x0;var _0x3b9ddc=_0x3ac4[_0x562216];return _0x3b9ddc;};'use strict';var multer=require(_0x43ac('0x0'));var util=require(_0x43ac('0x1'));var path=require(_0x43ac('0x2'));var timeout=require(_0x43ac('0x3'));var express=require(_0x43ac('0x4'));var router=express[_0x43ac('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x43ac('0x6'));var interaction=require(_0x43ac('0x7'));var config=require('../../config/environment');var controller=require(_0x43ac('0x8'));router[_0x43ac('0x9')]('/',auth[_0x43ac('0xa')](),controller[_0x43ac('0xb')]);module[_0x43ac('0xc')]=router; \ No newline at end of file +var _0x31e7=['sendUserNotification','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post'];(function(_0x439af6,_0x479095){var _0x259601=function(_0x375ea9){while(--_0x375ea9){_0x439af6['push'](_0x439af6['shift']());}};_0x259601(++_0x479095);}(_0x31e7,0x6f));var _0x731e=function(_0x2841f4,_0x5ab834){_0x2841f4=_0x2841f4-0x0;var _0x543466=_0x31e7[_0x2841f4];return _0x543466;};'use strict';var multer=require(_0x731e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x731e('0x1'));var express=require(_0x731e('0x2'));var router=express[_0x731e('0x3')]();var fs_extra=require(_0x731e('0x4'));var auth=require(_0x731e('0x5'));var interaction=require(_0x731e('0x6'));var config=require(_0x731e('0x7'));var controller=require(_0x731e('0x8'));router[_0x731e('0x9')]('/',auth['isAuthenticated'](),controller[_0x731e('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 32e8cdd..2e66918 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 _0x3f5f=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x1bb49c,_0x510210){var _0x45db79=function(_0x3dc94c){while(--_0x3dc94c){_0x1bb49c['push'](_0x1bb49c['shift']());}};_0x45db79(++_0x510210);}(_0x3f5f,0x17d));var _0xf3f5=function(_0x17c8a9,_0x531ca3){_0x17c8a9=_0x17c8a9-0x0;var _0x379aa6=_0x3f5f[_0x17c8a9];return _0x379aa6;};'use strict';var Sequelize=require(_0xf3f5('0x0'));module[_0xf3f5('0x1')]={'body':{'type':Sequelize[_0xf3f5('0x2')]},'senderName':{'type':Sequelize[_0xf3f5('0x3')]},'recipientsId':{'type':Sequelize[_0xf3f5('0x2')]},'recipientsDescription':{'type':Sequelize[_0xf3f5('0x3')]},'beep':{'type':Sequelize[_0xf3f5('0x4')]}}; \ No newline at end of file +var _0x15f9=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x15f9,0xc1));var _0x915f=function(_0x2eb1ee,_0x116642){_0x2eb1ee=_0x2eb1ee-0x0;var _0x1ec4b6=_0x15f9[_0x2eb1ee];return _0x1ec4b6;};'use strict';var Sequelize=require(_0x915f('0x0'));module['exports']={'body':{'type':Sequelize[_0x915f('0x1')]},'senderName':{'type':Sequelize[_0x915f('0x2')]},'recipientsId':{'type':Sequelize[_0x915f('0x1')]},'recipientsDescription':{'type':Sequelize[_0x915f('0x2')]},'beep':{'type':Sequelize[_0x915f('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 3e6fa91..8e1280a 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 _0xad00=['voicequeue','whatsappqueue','team','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','Template','html','render','catch','startCase','User','union','ids','includes','queue','replace','Queue','push','all','flatten','findOne','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','apply','save','update','destroy','then','stack','name','send','sendUserNotification','body','hasOwnProperty','text','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue'];(function(_0x30c2d8,_0x532b33){var _0x465a77=function(_0x423691){while(--_0x423691){_0x30c2d8['push'](_0x30c2d8['shift']());}};_0x465a77(++_0x532b33);}(_0xad00,0xf7));var _0x0ad0=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0xad00[_0x4521e3];return _0x46a272;};'use strict';var emlformat=require(_0x0ad0('0x0'));var rimraf=require(_0x0ad0('0x1'));var zipdir=require(_0x0ad0('0x2'));var jsonpatch=require(_0x0ad0('0x3'));var rp=require(_0x0ad0('0x4'));var moment=require(_0x0ad0('0x5'));var BPromise=require(_0x0ad0('0x6'));var Mustache=require(_0x0ad0('0x7'));var util=require(_0x0ad0('0x8'));var path=require(_0x0ad0('0x9'));var sox=require(_0x0ad0('0xa'));var csv=require(_0x0ad0('0xb'));var ejs=require(_0x0ad0('0xc'));var fs=require('fs');var fs_extra=require(_0x0ad0('0xd'));var _=require(_0x0ad0('0xe'));var squel=require(_0x0ad0('0xf'));var crypto=require(_0x0ad0('0x10'));var jsforce=require(_0x0ad0('0x11'));var deskjs=require(_0x0ad0('0x12'));var toCsv=require(_0x0ad0('0xb'));var querystring=require('querystring');var Papa=require(_0x0ad0('0x13'));var Redis=require(_0x0ad0('0x14'));var authService=require(_0x0ad0('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x0ad0('0x16'));var hardwareService=require(_0x0ad0('0x17'));var logger=require('../../config/logger')(_0x0ad0('0x18'));var utils=require(_0x0ad0('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x0ad0('0x1a'));var db=require('../../mysqldb')['db'];config[_0x0ad0('0x1b')]=_[_0x0ad0('0x1c')](config[_0x0ad0('0x1b')],{'host':_0x0ad0('0x1d'),'port':0x18eb});var socket=require(_0x0ad0('0x1e'))(new Redis(config[_0x0ad0('0x1b')]));require(_0x0ad0('0x1f'))['register'](socket);function respondWithStatusCode(_0x2292eb,_0x41b851){_0x41b851=_0x41b851||0xcc;return function(_0x2fbab6){if(_0x2fbab6){return _0x2292eb[_0x0ad0('0x20')](_0x41b851);}return _0x2292eb['status'](_0x41b851)[_0x0ad0('0x21')]();};}function respondWithResult(_0x8bbf3b,_0x7fcc3c){_0x7fcc3c=_0x7fcc3c||0xc8;return function(_0x32a944){if(_0x32a944){return _0x8bbf3b['status'](_0x7fcc3c)[_0x0ad0('0x22')](_0x32a944);}};}function respondWithFilteredResult(_0x42f8a8,_0x3cbf04){return function(_0x41e260){if(_0x41e260){var _0x978692=typeof _0x3cbf04[_0x0ad0('0x23')]===_0x0ad0('0x24')&&typeof _0x3cbf04['limit']===_0x0ad0('0x24');var _0x4ba30e=_0x41e260['count'];var _0x4213b4=_0x978692?0x0:_0x3cbf04['offset'];var _0x5c1505=_0x978692?_0x41e260[_0x0ad0('0x25')]:_0x3cbf04[_0x0ad0('0x23')]+_0x3cbf04['limit'];var _0x224bac;if(_0x5c1505>=_0x4ba30e){_0x5c1505=_0x4ba30e;_0x224bac=0xc8;}else{_0x224bac=0xce;}_0x42f8a8[_0x0ad0('0x26')](_0x224bac);return _0x42f8a8[_0x0ad0('0x27')](_0x0ad0('0x28'),_0x4213b4+'-'+_0x5c1505+'/'+_0x4ba30e)['json'](_0x41e260);}return null;};}function patchUpdates(_0x4c108c){return function(_0x114e76){try{jsonpatch[_0x0ad0('0x29')](_0x114e76,_0x4c108c,!![]);}catch(_0x4ef381){return BPromise['reject'](_0x4ef381);}return _0x114e76[_0x0ad0('0x2a')]();};}function saveUpdates(_0x2b05c1,_0xc2531b){return function(_0x4e0c38){if(_0x4e0c38){return _0x4e0c38[_0x0ad0('0x2b')](_0x2b05c1)['then'](function(_0x4a1bf6){return _0x4a1bf6;});}return null;};}function removeEntity(_0x40e43b,_0x588584){return function(_0x16c249){if(_0x16c249){return _0x16c249[_0x0ad0('0x2c')]()[_0x0ad0('0x2d')](function(){_0x40e43b[_0x0ad0('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x275843,_0x3499a3){return function(_0x218556){if(!_0x218556){_0x275843[_0x0ad0('0x20')](0x194);}return _0x218556;};}function handleError(_0x27160d,_0x858c8a){_0x858c8a=_0x858c8a||0x1f4;return function(_0x2fb265){logger['error'](_0x2fb265[_0x0ad0('0x2e')]);if(_0x2fb265[_0x0ad0('0x2f')]){delete _0x2fb265[_0x0ad0('0x2f')];}_0x27160d[_0x0ad0('0x26')](_0x858c8a)[_0x0ad0('0x30')](_0x2fb265);};}exports[_0x0ad0('0x31')]=function(_0x1c0cc9,_0x34e1ea,_0x145a03){if(!_0x1c0cc9[_0x0ad0('0x32')][_0x0ad0('0x33')](_0x0ad0('0x34'))&&!_0x1c0cc9[_0x0ad0('0x32')][_0x0ad0('0x33')]('TemplateId')){throw new db[(_0x0ad0('0x35'))][(_0x0ad0('0x36'))](_0x0ad0('0x37'));}else{if(_0x1c0cc9[_0x0ad0('0x32')]['hasOwnProperty'](_0x0ad0('0x38'))&&!_0x1c0cc9[_0x0ad0('0x32')][_0x0ad0('0x33')](_0x0ad0('0x39'))){throw new db[(_0x0ad0('0x35'))]['ValidationError'](_0x0ad0('0x3a'));}if(!_0x1c0cc9['body'][_0x0ad0('0x33')]('recipients')){throw new db[(_0x0ad0('0x35'))][(_0x0ad0('0x36'))](_0x0ad0('0x3b'));}else{try{var _0x5bfd94=JSON[_0x0ad0('0x3c')](_0x1c0cc9[_0x0ad0('0x32')][_0x0ad0('0x3d')]);}catch(_0xb6848c){logger[_0x0ad0('0x3e')](_0xb6848c);throw new db[(_0x0ad0('0x35'))][(_0x0ad0('0x36'))](_0x0ad0('0x3f'));}var _0x5acc85=[_0x0ad0('0x40'),'faxqueue',_0x0ad0('0x41'),_0x0ad0('0x42'),_0x0ad0('0x43'),_0x0ad0('0x44'),_0x0ad0('0x45'),_0x0ad0('0x46'),'user'];if(_['some'](_0x5bfd94,function(_0x4e3b54){return!_['includes'](_0x5acc85,_0x4e3b54[_0x0ad0('0x47')]['toLowerCase']());})){throw new db[(_0x0ad0('0x35'))][(_0x0ad0('0x36'))](_0x0ad0('0x48'));}}}var _0x25e1ce={};_0x25e1ce[_0x0ad0('0x49')]=_0x1c0cc9['body'][_0x0ad0('0x33')]('senderName')?_0x1c0cc9[_0x0ad0('0x32')]['senderName']:_0x1c0cc9[_0x0ad0('0x4a')]['fullname'];_0x25e1ce[_0x0ad0('0x4b')]=_[_0x0ad0('0x4c')](_0x1c0cc9[_0x0ad0('0x32')][_0x0ad0('0x4b')])?null:_0x1c0cc9[_0x0ad0('0x32')][_0x0ad0('0x4b')];_0x25e1ce[_0x0ad0('0x4d')]=_0x1c0cc9['body'][_0x0ad0('0x4d')]||![];_0x25e1ce[_0x0ad0('0x4e')]=_0x1c0cc9[_0x0ad0('0x4a')]['id'];return getContent(_0x1c0cc9[_0x0ad0('0x32')])['then'](function(_0x350b2a){_0x25e1ce[_0x0ad0('0x32')]=_0x350b2a;return getRecipients(_0x5bfd94);})['then'](function(_0x4a4a10){_0x25e1ce[_0x0ad0('0x4f')]=_[_0x0ad0('0x50')](_0x4a4a10)[_0x0ad0('0x51')](',');return db[_0x0ad0('0x52')][_0x0ad0('0x53')](function(_0x433931){return db['UserNotification'][_0x0ad0('0x54')](_0x25e1ce,{'raw':!![],'transaction':_0x433931})['then'](function(_0x2b4281){var _0x11e6c8={'sender':_0x25e1ce[_0x0ad0('0x49')],'description':_0x25e1ce[_0x0ad0('0x4b')],'content':_0x25e1ce[_0x0ad0('0x32')],'beep':_0x25e1ce[_0x0ad0('0x4d')]};_0x4a4a10[_0x0ad0('0x55')](function(_0x98048b){_0x11e6c8[_0x0ad0('0x56')]=_0x98048b;socket['emit']('userNotification:send',_0x11e6c8);});return _0x2b4281;});});})[_0x0ad0('0x2d')](respondWithResult(_0x34e1ea,0xc9))['catch'](handleError(_0x34e1ea,null));};function getContent(_0x1684e8){return new BPromise(function(_0x2d5b8f,_0x46f9ab){if(_0x1684e8['text']){_0x2d5b8f(_0x1684e8[_0x0ad0('0x34')]);return;}return db[_0x0ad0('0x57')]['findOne']({'attributes':[_0x0ad0('0x58')],'where':{'id':_0x1684e8[_0x0ad0('0x38')]},'raw':!![]})[_0x0ad0('0x2d')](function(_0x598106){if(!_0x598106)throw new db[(_0x0ad0('0x35'))][(_0x0ad0('0x36'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x2f5f89=Mustache[_0x0ad0('0x59')](_0x598106[_0x0ad0('0x58')],_0x1684e8[_0x0ad0('0x39')]);_0x2d5b8f(_0x2f5f89);})[_0x0ad0('0x5a')](function(_0x26abb5){_0x46f9ab(_0x26abb5);});});}function getRecipients(_0x18e323){return new BPromise(function(_0x437964,_0x2a0516){var _0x4cc926=[];var _0x2cadf8=[];_0x18e323[_0x0ad0('0x55')](function(_0x1ca753){var _0x88fb1b=_[_0x0ad0('0x5b')](_0x1ca753[_0x0ad0('0x47')]['toLowerCase']());if(_0x88fb1b===_0x0ad0('0x5c')){_0x4cc926=_[_0x0ad0('0x5d')](_0x4cc926,_0x1ca753[_0x0ad0('0x5e')]);}else{if(_[_0x0ad0('0x5f')](_0x88fb1b,_0x0ad0('0x60')))_0x88fb1b=_0x88fb1b[_0x0ad0('0x61')](_0x0ad0('0x60'),_0x0ad0('0x62'));_0x1ca753[_0x0ad0('0x5e')][_0x0ad0('0x55')](function(_0x9653db){_0x2cadf8[_0x0ad0('0x63')](getAgents(_0x88fb1b,_0x9653db));});}});return BPromise[_0x0ad0('0x64')](_0x2cadf8)[_0x0ad0('0x2d')](function(_0x367cdc){_0x4cc926=_[_0x0ad0('0x5d')](_0x4cc926,_[_0x0ad0('0x65')](_0x367cdc));_0x437964(_0x4cc926);})[_0x0ad0('0x5a')](function(_0x223c74){_0x2a0516(_0x223c74);});});}function getAgents(_0x1559c6,_0x50d87d){return new BPromise(function(_0x4bc6b8,_0x5cc226){return db[_0x1559c6][_0x0ad0('0x66')]({'where':{'id':_0x50d87d}})[_0x0ad0('0x2d')](function(_0x34046b){return _0x34046b[_0x0ad0('0x67')]({'attributes':['id'],'raw':!![]})[_0x0ad0('0x2d')](function(_0x5ea9b3){var _0x18f59f=_[_0x0ad0('0x68')](_0x5ea9b3,'id');_0x4bc6b8(_0x18f59f);});})[_0x0ad0('0x5a')](function(_0x102a6b){_0x5cc226(_0x102a6b);});});} \ No newline at end of file +var _0x5202=['chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','transaction','UserNotification','emit','userNotification:send','catch','Template','findOne','html','render','startCase','User','union','queue','replace','Queue','ids','forEach','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','limit','undefined','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','text','body','hasOwnProperty','ValidationError','TemplateId','view','Sequelize','recipients','Invalid\x20\x27recipients\x27\x20object'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x5202,0x1bb));var _0x2520=function(_0x47ec05,_0x4261fc){_0x47ec05=_0x47ec05-0x0;var _0x19c65d=_0x5202[_0x47ec05];return _0x19c65d;};'use strict';var emlformat=require(_0x2520('0x0'));var rimraf=require(_0x2520('0x1'));var zipdir=require(_0x2520('0x2'));var jsonpatch=require(_0x2520('0x3'));var rp=require(_0x2520('0x4'));var moment=require(_0x2520('0x5'));var BPromise=require(_0x2520('0x6'));var Mustache=require('mustache');var util=require(_0x2520('0x7'));var path=require(_0x2520('0x8'));var sox=require(_0x2520('0x9'));var csv=require(_0x2520('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2520('0xb'));var _=require(_0x2520('0xc'));var squel=require(_0x2520('0xd'));var crypto=require(_0x2520('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2520('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2520('0x10'));var Papa=require('papaparse');var Redis=require(_0x2520('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2520('0x12'));var as=require(_0x2520('0x13'));var hardwareService=require(_0x2520('0x14'));var logger=require(_0x2520('0x15'))('api');var utils=require(_0x2520('0x16'));var config=require(_0x2520('0x17'));var licenseUtil=require(_0x2520('0x18'));var db=require(_0x2520('0x19'))['db'];config['redis']=_['defaults'](config[_0x2520('0x1a')],{'host':_0x2520('0x1b'),'port':0x18eb});var socket=require(_0x2520('0x1c'))(new Redis(config[_0x2520('0x1a')]));require('./userNotification.socket')[_0x2520('0x1d')](socket);function respondWithStatusCode(_0x4cfa66,_0x95c687){_0x95c687=_0x95c687||0xcc;return function(_0x1a09c6){if(_0x1a09c6){return _0x4cfa66['sendStatus'](_0x95c687);}return _0x4cfa66[_0x2520('0x1e')](_0x95c687)[_0x2520('0x1f')]();};}function respondWithResult(_0x1ada32,_0x243075){_0x243075=_0x243075||0xc8;return function(_0x1fd631){if(_0x1fd631){return _0x1ada32['status'](_0x243075)[_0x2520('0x20')](_0x1fd631);}};}function respondWithFilteredResult(_0x1d34d2,_0x42b9fc){return function(_0x1ecc69){if(_0x1ecc69){var _0x472723=typeof _0x42b9fc['offset']==='undefined'&&typeof _0x42b9fc[_0x2520('0x21')]===_0x2520('0x22');var _0x3da788=_0x1ecc69['count'];var _0x59167f=_0x472723?0x0:_0x42b9fc[_0x2520('0x23')];var _0x56975f=_0x472723?_0x1ecc69['count']:_0x42b9fc[_0x2520('0x23')]+_0x42b9fc['limit'];var _0x3d49ba;if(_0x56975f>=_0x3da788){_0x56975f=_0x3da788;_0x3d49ba=0xc8;}else{_0x3d49ba=0xce;}_0x1d34d2[_0x2520('0x1e')](_0x3d49ba);return _0x1d34d2[_0x2520('0x24')](_0x2520('0x25'),_0x59167f+'-'+_0x56975f+'/'+_0x3da788)[_0x2520('0x20')](_0x1ecc69);}return null;};}function patchUpdates(_0x22a4ed){return function(_0x2881a4){try{jsonpatch['apply'](_0x2881a4,_0x22a4ed,!![]);}catch(_0x5657eb){return BPromise[_0x2520('0x26')](_0x5657eb);}return _0x2881a4[_0x2520('0x27')]();};}function saveUpdates(_0x5d9a28,_0x107a22){return function(_0x1bf2c4){if(_0x1bf2c4){return _0x1bf2c4[_0x2520('0x28')](_0x5d9a28)[_0x2520('0x29')](function(_0x32d3d0){return _0x32d3d0;});}return null;};}function removeEntity(_0x10f336,_0x179e4a){return function(_0x1d801f){if(_0x1d801f){return _0x1d801f[_0x2520('0x2a')]()[_0x2520('0x29')](function(){_0x10f336[_0x2520('0x1e')](0xcc)[_0x2520('0x1f')]();});}};}function handleEntityNotFound(_0x5ed2af,_0x21c087){return function(_0x292749){if(!_0x292749){_0x5ed2af[_0x2520('0x2b')](0x194);}return _0x292749;};}function handleError(_0x148b3f,_0x3eb5ca){_0x3eb5ca=_0x3eb5ca||0x1f4;return function(_0x201726){logger[_0x2520('0x2c')](_0x201726[_0x2520('0x2d')]);if(_0x201726[_0x2520('0x2e')]){delete _0x201726[_0x2520('0x2e')];}_0x148b3f[_0x2520('0x1e')](_0x3eb5ca)[_0x2520('0x2f')](_0x201726);};}exports['sendUserNotification']=function(_0x18bf8f,_0x1b6c32,_0x12463a){if(!_0x18bf8f['body']['hasOwnProperty'](_0x2520('0x30'))&&!_0x18bf8f[_0x2520('0x31')][_0x2520('0x32')]('TemplateId')){throw new db['Sequelize'][(_0x2520('0x33'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x18bf8f['body'][_0x2520('0x32')](_0x2520('0x34'))&&!_0x18bf8f['body'][_0x2520('0x32')](_0x2520('0x35'))){throw new db[(_0x2520('0x36'))][(_0x2520('0x33'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x18bf8f['body'][_0x2520('0x32')](_0x2520('0x37'))){throw new db['Sequelize'][(_0x2520('0x33'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x412c28=JSON['parse'](_0x18bf8f['body'][_0x2520('0x37')]);}catch(_0x28032e){logger[_0x2520('0x2c')](_0x28032e);throw new db[(_0x2520('0x36'))][(_0x2520('0x33'))](_0x2520('0x38'));}var _0x4f2125=[_0x2520('0x39'),_0x2520('0x3a'),_0x2520('0x3b'),_0x2520('0x3c'),_0x2520('0x3d'),_0x2520('0x3e'),_0x2520('0x3f'),'team',_0x2520('0x40')];if(_[_0x2520('0x41')](_0x412c28,function(_0x1a39a6){return!_['includes'](_0x4f2125,_0x1a39a6[_0x2520('0x42')][_0x2520('0x43')]());})){throw new db['Sequelize'][(_0x2520('0x33'))](_0x2520('0x44'));}}}var _0x301e91={};_0x301e91[_0x2520('0x45')]=_0x18bf8f[_0x2520('0x31')][_0x2520('0x32')](_0x2520('0x45'))?_0x18bf8f[_0x2520('0x31')][_0x2520('0x45')]:_0x18bf8f['user'][_0x2520('0x46')];_0x301e91[_0x2520('0x47')]=_[_0x2520('0x48')](_0x18bf8f[_0x2520('0x31')]['recipientsDescription'])?null:_0x18bf8f[_0x2520('0x31')]['recipientsDescription'];_0x301e91[_0x2520('0x49')]=_0x18bf8f[_0x2520('0x31')][_0x2520('0x49')]||![];_0x301e91[_0x2520('0x4a')]=_0x18bf8f[_0x2520('0x40')]['id'];return getContent(_0x18bf8f[_0x2520('0x31')])['then'](function(_0x2ddd25){_0x301e91['body']=_0x2ddd25;return getRecipients(_0x412c28);})[_0x2520('0x29')](function(_0x1c122a){_0x301e91[_0x2520('0x4b')]=_['sortBy'](_0x1c122a)[_0x2520('0x4c')](',');return db[_0x2520('0x4d')][_0x2520('0x4e')](function(_0x15e4fb){return db[_0x2520('0x4f')]['create'](_0x301e91,{'raw':!![],'transaction':_0x15e4fb})[_0x2520('0x29')](function(_0x557825){var _0x248b9f={'sender':_0x301e91[_0x2520('0x45')],'description':_0x301e91[_0x2520('0x47')],'content':_0x301e91[_0x2520('0x31')],'beep':_0x301e91[_0x2520('0x49')]};_0x1c122a['forEach'](function(_0x413d0b){_0x248b9f['recipient']=_0x413d0b;socket[_0x2520('0x50')](_0x2520('0x51'),_0x248b9f);});return _0x557825;});});})[_0x2520('0x29')](respondWithResult(_0x1b6c32,0xc9))[_0x2520('0x52')](handleError(_0x1b6c32,null));};function getContent(_0x515eb6){return new BPromise(function(_0x22e588,_0x369788){if(_0x515eb6[_0x2520('0x30')]){_0x22e588(_0x515eb6[_0x2520('0x30')]);return;}return db[_0x2520('0x53')][_0x2520('0x54')]({'attributes':[_0x2520('0x55')],'where':{'id':_0x515eb6['TemplateId']},'raw':!![]})[_0x2520('0x29')](function(_0x2d9bb2){if(!_0x2d9bb2)throw new db['Sequelize'][(_0x2520('0x33'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x5f448d=Mustache[_0x2520('0x56')](_0x2d9bb2[_0x2520('0x55')],_0x515eb6['view']);_0x22e588(_0x5f448d);})[_0x2520('0x52')](function(_0x16af88){_0x369788(_0x16af88);});});}function getRecipients(_0xf5938f){return new BPromise(function(_0x203aff,_0x2edea1){var _0x52b4bf=[];var _0x438fb1=[];_0xf5938f['forEach'](function(_0x2ad88f){var _0x55c844=_[_0x2520('0x57')](_0x2ad88f[_0x2520('0x42')][_0x2520('0x43')]());if(_0x55c844===_0x2520('0x58')){_0x52b4bf=_[_0x2520('0x59')](_0x52b4bf,_0x2ad88f['ids']);}else{if(_['includes'](_0x55c844,_0x2520('0x5a')))_0x55c844=_0x55c844[_0x2520('0x5b')]('queue',_0x2520('0x5c'));_0x2ad88f[_0x2520('0x5d')][_0x2520('0x5e')](function(_0x59c383){_0x438fb1[_0x2520('0x5f')](getAgents(_0x55c844,_0x59c383));});}});return BPromise[_0x2520('0x60')](_0x438fb1)['then'](function(_0x2e3805){_0x52b4bf=_[_0x2520('0x59')](_0x52b4bf,_[_0x2520('0x61')](_0x2e3805));_0x203aff(_0x52b4bf);})[_0x2520('0x52')](function(_0x4dde81){_0x2edea1(_0x4dde81);});});}function getAgents(_0x2ae513,_0x3cd152){return new BPromise(function(_0x1aef9b,_0x5c07ce){return db[_0x2ae513]['findOne']({'where':{'id':_0x3cd152}})[_0x2520('0x29')](function(_0x25b63d){return _0x25b63d[_0x2520('0x62')]({'attributes':['id'],'raw':!![]})[_0x2520('0x29')](function(_0x3a36b9){var _0x5c4217=_[_0x2520('0x63')](_0x3a36b9,'id');_0x1aef9b(_0x5c4217);});})['catch'](function(_0xd955f5){_0x5c07ce(_0xd955f5);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 43cecc0..f564299 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 _0xe07f=['save','update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x5b961b,_0x4d51fb){var _0x3fa72e=function(_0x3c19fd){while(--_0x3c19fd){_0x5b961b['push'](_0x5b961b['shift']());}};_0x3fa72e(++_0x4d51fb);}(_0xe07f,0x1ed));var _0xfe07=function(_0x15a8c7,_0x114528){_0x15a8c7=_0x15a8c7-0x0;var _0x5206a6=_0xe07f[_0x15a8c7];return _0x5206a6;};'use strict';var EventEmitter=require(_0xfe07('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xfe07('0x1')](0x0);var events={'afterCreate':_0xfe07('0x2'),'afterUpdate':_0xfe07('0x3'),'afterDestroy':_0xfe07('0x4')};function emitEvent(_0x3b46d4){return function(_0x5cab97,_0x29a523,_0x3704f7){UserNotificationEvents[_0xfe07('0x5')](_0x3b46d4+':'+_0x5cab97['id'],_0x5cab97);UserNotificationEvents[_0xfe07('0x5')](_0x3b46d4,_0x5cab97);_0x3704f7(null);};}for(var e in events){if(events[_0xfe07('0x6')](e)){var event=events[e];UserNotification[_0xfe07('0x7')](e,emitEvent(event));}}module[_0xfe07('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xf7c8=['emit','events','UserNotification','setMaxListeners','save','update','remove'];(function(_0x3e022f,_0x3cd1b3){var _0x2c16b3=function(_0x451fea){while(--_0x451fea){_0x3e022f['push'](_0x3e022f['shift']());}};_0x2c16b3(++_0x3cd1b3);}(_0xf7c8,0x13c));var _0x8f7c=function(_0xe25b2f,_0x23c1bc){_0xe25b2f=_0xe25b2f-0x0;var _0x20b33d=_0xf7c8[_0xe25b2f];return _0x20b33d;};'use strict';var EventEmitter=require(_0x8f7c('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x8f7c('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x8f7c('0x2')](0x0);var events={'afterCreate':_0x8f7c('0x3'),'afterUpdate':_0x8f7c('0x4'),'afterDestroy':_0x8f7c('0x5')};function emitEvent(_0x149d77){return function(_0xb96597,_0x1f312a,_0x184ffc){UserNotificationEvents[_0x8f7c('0x6')](_0x149d77+':'+_0xb96597['id'],_0xb96597);UserNotificationEvents[_0x8f7c('0x6')](_0x149d77,_0xb96597);_0x184ffc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 1a5ae95..0fc6c97 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 _0xe3f6=['define','userNotifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports'];(function(_0x4744e8,_0xf9991b){var _0x455c6d=function(_0x1ef9fa){while(--_0x1ef9fa){_0x4744e8['push'](_0x4744e8['shift']());}};_0x455c6d(++_0xf9991b);}(_0xe3f6,0x92));var _0x6e3f=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xe3f6[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x6e3f('0x0'));var util=require(_0x6e3f('0x1'));var logger=require(_0x6e3f('0x2'))('api');var moment=require(_0x6e3f('0x3'));var BPromise=require('bluebird');var rp=require(_0x6e3f('0x4'));var fs=require('fs');var path=require(_0x6e3f('0x5'));var rimraf=require('rimraf');var config=require(_0x6e3f('0x6'));var attributes=require('./userNotification.attributes');module[_0x6e3f('0x7')]=function(_0x5ff9b4,_0xbeed8){return _0x5ff9b4[_0x6e3f('0x8')]('UserNotification',attributes,{'tableName':_0x6e3f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6e3f('0xa')});}; \ No newline at end of file +var _0x22c3=['../../config/environment','exports','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22c3,0x16e));var _0x322c=function(_0x2af5fb,_0x284519){_0x2af5fb=_0x2af5fb-0x0;var _0x3eb93d=_0x22c3[_0x2af5fb];return _0x3eb93d;};'use strict';var _=require('lodash');var util=require(_0x322c('0x0'));var logger=require(_0x322c('0x1'))(_0x322c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x322c('0x3'));var fs=require('fs');var path=require(_0x322c('0x4'));var rimraf=require(_0x322c('0x5'));var config=require(_0x322c('0x6'));var attributes=require('./userNotification.attributes');module[_0x322c('0x7')]=function(_0x2faa10,_0x2bb652){return _0x2faa10[_0x322c('0x8')](_0x322c('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x322c('0xa'),'collate':_0x322c('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index fa9c3b6..0f8cca9 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 _0x0bc2=['result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4b6507,_0x5518b5){var _0x2001ec=function(_0x330ddf){while(--_0x330ddf){_0x4b6507['push'](_0x4b6507['shift']());}};_0x2001ec(++_0x5518b5);}(_0x0bc2,0x1ab));var _0x20bc=function(_0x39424b,_0x148626){_0x39424b=_0x39424b-0x0;var _0x38ffc3=_0x0bc2[_0x39424b];return _0x38ffc3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x20bc('0x0'));var BPromise=require(_0x20bc('0x1'));var rs=require(_0x20bc('0x2'));var fs=require('fs');var Redis=require(_0x20bc('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x20bc('0x4'))('rpc');var config=require(_0x20bc('0x5'));var jayson=require(_0x20bc('0x6'));var client=jayson['client'][_0x20bc('0x7')]({'port':0x232a});config['redis']=_[_0x20bc('0x8')](config[_0x20bc('0x9')],{'host':_0x20bc('0xa'),'port':0x18eb});var socket=require(_0x20bc('0xb'))(new Redis(config['redis']));require(_0x20bc('0xc'))[_0x20bc('0xd')](socket);function respondWithRpcPromise(_0x1dfb2d,_0x1c5469,_0x7ae988){return new BPromise(function(_0x3e8d31,_0x50b348){return client['request'](_0x1dfb2d,_0x7ae988)['then'](function(_0x90eab0){logger[_0x20bc('0xe')](_0x20bc('0xf'),_0x1c5469,_0x20bc('0x10'));logger[_0x20bc('0x11')](_0x20bc('0x12'),_0x1c5469,'request\x20sent',JSON[_0x20bc('0x13')](_0x90eab0));if(_0x90eab0[_0x20bc('0x14')]){if(_0x90eab0[_0x20bc('0x14')][_0x20bc('0x15')]===0x1f4){logger[_0x20bc('0x14')](_0x20bc('0xf'),_0x1c5469,_0x90eab0[_0x20bc('0x14')][_0x20bc('0x16')]);return _0x50b348(_0x90eab0[_0x20bc('0x14')][_0x20bc('0x16')]);}logger['error'](_0x20bc('0xf'),_0x1c5469,_0x90eab0[_0x20bc('0x14')][_0x20bc('0x16')]);return _0x3e8d31(_0x90eab0['error'][_0x20bc('0x16')]);}else{logger[_0x20bc('0xe')]('UserNotification,\x20%s,\x20%s',_0x1c5469,_0x20bc('0x10'));_0x3e8d31(_0x90eab0[_0x20bc('0x17')]['message']);}})[_0x20bc('0x18')](function(_0xef64c5){logger[_0x20bc('0x14')]('UserNotification,\x20%s,\x20%s',_0x1c5469,_0xef64c5);_0x50b348(_0xef64c5);});});} \ No newline at end of file +var _0xb646=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x3de873,_0x174b5f){var _0x380b8c=function(_0x313dea){while(--_0x313dea){_0x3de873['push'](_0x3de873['shift']());}};_0x380b8c(++_0x174b5f);}(_0xb646,0x1d8));var _0x6b64=function(_0x2d8938,_0x6b08e0){_0x2d8938=_0x2d8938-0x0;var _0x1234ce=_0xb646[_0x2d8938];return _0x1234ce;};'use strict';var _=require(_0x6b64('0x0'));var util=require(_0x6b64('0x1'));var moment=require(_0x6b64('0x2'));var BPromise=require(_0x6b64('0x3'));var rs=require(_0x6b64('0x4'));var fs=require('fs');var Redis=require(_0x6b64('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6b64('0x6'));var logger=require(_0x6b64('0x7'))(_0x6b64('0x8'));var config=require(_0x6b64('0x9'));var jayson=require(_0x6b64('0xa'));var client=jayson[_0x6b64('0xb')]['http']({'port':0x232a});config[_0x6b64('0xc')]=_[_0x6b64('0xd')](config[_0x6b64('0xc')],{'host':_0x6b64('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6b64('0xf'))[_0x6b64('0x10')](socket);function respondWithRpcPromise(_0x51e62f,_0x58c8ee,_0x4b04ca){return new BPromise(function(_0x33b957,_0x3fea0f){return client[_0x6b64('0x11')](_0x51e62f,_0x4b04ca)['then'](function(_0x261d21){logger[_0x6b64('0x12')](_0x6b64('0x13'),_0x58c8ee,_0x6b64('0x14'));logger[_0x6b64('0x15')](_0x6b64('0x16'),_0x58c8ee,_0x6b64('0x14'),JSON[_0x6b64('0x17')](_0x261d21));if(_0x261d21[_0x6b64('0x18')]){if(_0x261d21[_0x6b64('0x18')][_0x6b64('0x19')]===0x1f4){logger[_0x6b64('0x18')]('UserNotification,\x20%s,\x20%s',_0x58c8ee,_0x261d21[_0x6b64('0x18')][_0x6b64('0x1a')]);return _0x3fea0f(_0x261d21['error']['message']);}logger[_0x6b64('0x18')](_0x6b64('0x13'),_0x58c8ee,_0x261d21[_0x6b64('0x18')][_0x6b64('0x1a')]);return _0x33b957(_0x261d21['error'][_0x6b64('0x1a')]);}else{logger[_0x6b64('0x12')]('UserNotification,\x20%s,\x20%s',_0x58c8ee,'request\x20sent');_0x33b957(_0x261d21['result'][_0x6b64('0x1a')]);}})[_0x6b64('0x1b')](function(_0x49417e){logger[_0x6b64('0x18')](_0x6b64('0x13'),_0x58c8ee,_0x49417e);_0x3fea0f(_0x49417e);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index f4e93a3..558b55a 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 _0xa430=['update','register','length','userNotification:','./userNotification.events','save','remove'];(function(_0xaa934e,_0x112c86){var _0x4b03be=function(_0x1312ae){while(--_0x1312ae){_0xaa934e['push'](_0xaa934e['shift']());}};_0x4b03be(++_0x112c86);}(_0xa430,0x12a));var _0x0a43=function(_0x287be6,_0x446059){_0x287be6=_0x287be6-0x0;var _0x2f5345=_0xa430[_0x287be6];return _0x2f5345;};'use strict';var UserNotificationEvents=require(_0x0a43('0x0'));var events=[_0x0a43('0x1'),_0x0a43('0x2'),_0x0a43('0x3')];function createListener(_0x5acbd3,_0x5d1243){return function(_0x5bb3be){_0x5d1243['emit'](_0x5acbd3,_0x5bb3be);};}function removeListener(_0xa0db73,_0xb72022){return function(){UserNotificationEvents['removeListener'](_0xa0db73,_0xb72022);};}exports[_0x0a43('0x4')]=function(_0x53b38d){for(var _0xa3e5e2=0x0,_0x315075=events[_0x0a43('0x5')];_0xa3e5e2<_0x315075;_0xa3e5e2++){var _0x2ae749=events[_0xa3e5e2];var _0x36ddcb=createListener(_0x0a43('0x6')+_0x2ae749,_0x53b38d);UserNotificationEvents['on'](_0x2ae749,_0x36ddcb);}}; \ No newline at end of file +var _0x3848=['length','userNotification:','./userNotification.events','save','remove','update','emit'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x3848,0x1b4));var _0x8384=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0x3848[_0x52085a];return _0x5afc1a;};'use strict';var UserNotificationEvents=require(_0x8384('0x0'));var events=[_0x8384('0x1'),_0x8384('0x2'),_0x8384('0x3')];function createListener(_0x35ad36,_0x4f393e){return function(_0x3f5fbe){_0x4f393e[_0x8384('0x4')](_0x35ad36,_0x3f5fbe);};}function removeListener(_0x482fb1,_0x1792bf){return function(){UserNotificationEvents['removeListener'](_0x482fb1,_0x1792bf);};}exports['register']=function(_0x54f5cc){for(var _0x116c7e=0x0,_0x20d200=events[_0x8384('0x5')];_0x116c7e<_0x20d200;_0x116c7e++){var _0x2d398a=events[_0x116c7e];var _0x531d51=createListener(_0x8384('0x6')+_0x2d398a,_0x54f5cc);UserNotificationEvents['on'](_0x2d398a,_0x531d51);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 4f1cf07..77aa705 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x411bbc,_0x44eea7){var _0x164e02=function(_0x11be9f){while(--_0x11be9f){_0x411bbc['push'](_0x411bbc['shift']());}};_0x164e02(++_0x44eea7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x595ac6,_0xc6bae2){var _0x4d7ce1=function(_0x150fec){while(--_0x150fec){_0x595ac6['push'](_0x595ac6['shift']());}};_0x4d7ce1(++_0xc6bae2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index b172424..25a984a 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 _0x0734=['INTEGER','sequelize','exports'];(function(_0x214b65,_0x55ac96){var _0x243984=function(_0x588c5b){while(--_0x588c5b){_0x214b65['push'](_0x214b65['shift']());}};_0x243984(++_0x55ac96);}(_0x0734,0xfa));var _0x4073=function(_0x5f2828,_0xbc7f50){_0x5f2828=_0x5f2828-0x0;var _0x471aba=_0x0734[_0x5f2828];return _0x471aba;};'use strict';var Sequelize=require(_0x4073('0x0'));module[_0x4073('0x1')]={'penalty':{'type':Sequelize[_0x4073('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3770=['INTEGER','sequelize','exports'];(function(_0x4cc820,_0xb017ac){var _0x15096d=function(_0x40a7cd){while(--_0x40a7cd){_0x4cc820['push'](_0x4cc820['shift']());}};_0x15096d(++_0xb017ac);}(_0x3770,0x13c));var _0x0377=function(_0x46499b,_0x59cd09){_0x46499b=_0x46499b-0x0;var _0x252fb0=_0x3770[_0x46499b];return _0x252fb0;};'use strict';var Sequelize=require(_0x0377('0x0'));module[_0x0377('0x1')]={'penalty':{'type':Sequelize[_0x0377('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 040e6fd..a07a6cc 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 _0xbe87=['api','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger'];(function(_0x11d500,_0x4dbf96){var _0x44c27b=function(_0x32f1ab){while(--_0x32f1ab){_0x11d500['push'](_0x11d500['shift']());}};_0x44c27b(++_0x4dbf96);}(_0xbe87,0xb4));var _0x7be8=function(_0x576ea1,_0x281a4f){_0x576ea1=_0x576ea1-0x0;var _0x1e6fe4=_0xbe87[_0x576ea1];return _0x1e6fe4;};'use strict';var _=require(_0x7be8('0x0'));var util=require('util');var logger=require(_0x7be8('0x1'))(_0x7be8('0x2'));var moment=require(_0x7be8('0x3'));var BPromise=require(_0x7be8('0x4'));var rp=require(_0x7be8('0x5'));var fs=require('fs');var path=require(_0x7be8('0x6'));var rimraf=require(_0x7be8('0x7'));var config=require('../../config/environment');var attributes=require(_0x7be8('0x8'));module[_0x7be8('0x9')]=function(_0x42fa4d,_0x1cfebc){return _0x42fa4d[_0x7be8('0xa')](_0x7be8('0xb'),attributes,{'tableName':_0x7be8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5826=['path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4694a0,_0x35b97f){var _0x38a2dc=function(_0x298039){while(--_0x298039){_0x4694a0['push'](_0x4694a0['shift']());}};_0x38a2dc(++_0x35b97f);}(_0x5826,0x18d));var _0x6582=function(_0x35f26e,_0x1a4bb0){_0x35f26e=_0x35f26e-0x0;var _0x587841=_0x5826[_0x35f26e];return _0x587841;};'use strict';var _=require(_0x6582('0x0'));var util=require(_0x6582('0x1'));var logger=require(_0x6582('0x2'))(_0x6582('0x3'));var moment=require(_0x6582('0x4'));var BPromise=require(_0x6582('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6582('0x6'));var rimraf=require(_0x6582('0x7'));var config=require(_0x6582('0x8'));var attributes=require(_0x6582('0x9'));module[_0x6582('0xa')]=function(_0x542f15,_0x277003){return _0x542f15['define'](_0x6582('0xb'),attributes,{'tableName':_0x6582('0xc'),'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 2a514fe..3b4ec5e 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 _0xcb6d=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xcb6d,0xc8));var _0xdcb6=function(_0x1bd539,_0x11f819){_0x1bd539=_0x1bd539-0x0;var _0x674036=_0xcb6d[_0x1bd539];return _0x674036;};'use strict';var _=require(_0xdcb6('0x0'));var util=require(_0xdcb6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdcb6('0x2'));var fs=require('fs');var Redis=require(_0xdcb6('0x3'));var db=require(_0xdcb6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcb6('0x5'))(_0xdcb6('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdcb6('0x7')][_0xdcb6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23bba6,_0xf43f1c,_0x2e151b){return new BPromise(function(_0x1b7f9a,_0x5d07d7){return client[_0xdcb6('0x9')](_0x23bba6,_0x2e151b)[_0xdcb6('0xa')](function(_0x3e6623){logger['info'](_0xdcb6('0xb'),_0xf43f1c,'request\x20sent');logger[_0xdcb6('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xf43f1c,_0xdcb6('0xd'),JSON[_0xdcb6('0xe')](_0x3e6623));if(_0x3e6623[_0xdcb6('0xf')]){if(_0x3e6623['error'][_0xdcb6('0x10')]===0x1f4){logger[_0xdcb6('0xf')](_0xdcb6('0xb'),_0xf43f1c,_0x3e6623['error'][_0xdcb6('0x11')]);return _0x5d07d7(_0x3e6623[_0xdcb6('0xf')][_0xdcb6('0x11')]);}logger[_0xdcb6('0xf')](_0xdcb6('0xb'),_0xf43f1c,_0x3e6623[_0xdcb6('0xf')][_0xdcb6('0x11')]);return _0x1b7f9a(_0x3e6623[_0xdcb6('0xf')][_0xdcb6('0x11')]);}else{logger[_0xdcb6('0x12')](_0xdcb6('0xb'),_0xf43f1c,_0xdcb6('0xd'));_0x1b7f9a(_0x3e6623[_0xdcb6('0x13')][_0xdcb6('0x11')]);}})['catch'](function(_0xd6d4ee){logger[_0xdcb6('0xf')](_0xdcb6('0xb'),_0xf43f1c,_0xd6d4ee);_0x5d07d7(_0xd6d4ee);});});} \ No newline at end of file +var _0x9f5d=['debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s'];(function(_0x46401e,_0x2a345b){var _0x447cba=function(_0x54ea97){while(--_0x54ea97){_0x46401e['push'](_0x46401e['shift']());}};_0x447cba(++_0x2a345b);}(_0x9f5d,0xe4));var _0xd9f5=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x9f5d[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0xd9f5('0x0'));var util=require('util');var moment=require(_0xd9f5('0x1'));var BPromise=require(_0xd9f5('0x2'));var rs=require(_0xd9f5('0x3'));var fs=require('fs');var Redis=require(_0xd9f5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd9f5('0x5'))('rpc');var config=require(_0xd9f5('0x6'));var jayson=require(_0xd9f5('0x7'));var client=jayson['client'][_0xd9f5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fb886,_0x4f5065,_0x10c55c){return new BPromise(function(_0x22deee,_0x309c11){return client['request'](_0x2fb886,_0x10c55c)[_0xd9f5('0x9')](function(_0x32c7d3){logger[_0xd9f5('0xa')](_0xd9f5('0xb'),_0x4f5065,'request\x20sent');logger[_0xd9f5('0xc')](_0xd9f5('0xd'),_0x4f5065,_0xd9f5('0xe'),JSON[_0xd9f5('0xf')](_0x32c7d3));if(_0x32c7d3[_0xd9f5('0x10')]){if(_0x32c7d3['error'][_0xd9f5('0x11')]===0x1f4){logger[_0xd9f5('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4f5065,_0x32c7d3[_0xd9f5('0x10')][_0xd9f5('0x12')]);return _0x309c11(_0x32c7d3[_0xd9f5('0x10')][_0xd9f5('0x12')]);}logger[_0xd9f5('0x10')](_0xd9f5('0xb'),_0x4f5065,_0x32c7d3['error']['message']);return _0x22deee(_0x32c7d3[_0xd9f5('0x10')][_0xd9f5('0x12')]);}else{logger[_0xd9f5('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4f5065,_0xd9f5('0xe'));_0x22deee(_0x32c7d3[_0xd9f5('0x13')][_0xd9f5('0x12')]);}})['catch'](function(_0x13672){logger['error'](_0xd9f5('0xb'),_0x4f5065,_0x13672);_0x309c11(_0x13672);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 1de1633..63893ea 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 _0x8258=['removeResources','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','create','post','/:id/clone','addSections','addResources','put','update','delete','destroy','removeSections'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x8258,0x1f2));var _0x8825=function(_0x363615,_0x2959b2){_0x363615=_0x363615-0x0;var _0x26e911=_0x8258[_0x363615];return _0x26e911;};'use strict';var multer=require(_0x8825('0x0'));var util=require(_0x8825('0x1'));var path=require(_0x8825('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8825('0x3')]();var fs_extra=require(_0x8825('0x4'));var auth=require(_0x8825('0x5'));var interaction=require(_0x8825('0x6'));var config=require(_0x8825('0x7'));var controller=require(_0x8825('0x8'));router[_0x8825('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8825('0xa'),auth[_0x8825('0xb')](),controller[_0x8825('0xc')]);router[_0x8825('0x9')](_0x8825('0xd'),auth[_0x8825('0xb')](),controller[_0x8825('0xe')]);router[_0x8825('0x9')](_0x8825('0xf'),auth[_0x8825('0xb')](),controller[_0x8825('0x10')]);router['get'](_0x8825('0x11'),auth['isAuthenticated'](),controller[_0x8825('0x12')]);router['post']('/',auth[_0x8825('0xb')](),controller[_0x8825('0x13')]);router[_0x8825('0x14')](_0x8825('0x15'),auth['isAuthenticated'](),controller['clone']);router[_0x8825('0x14')](_0x8825('0xf'),auth[_0x8825('0xb')](),controller[_0x8825('0x16')]);router['post']('/:id/resources',auth[_0x8825('0xb')](),controller[_0x8825('0x17')]);router[_0x8825('0x18')](_0x8825('0xd'),auth[_0x8825('0xb')](),controller[_0x8825('0x19')]);router[_0x8825('0x1a')](_0x8825('0xd'),auth[_0x8825('0xb')](),controller[_0x8825('0x1b')]);router[_0x8825('0x1a')](_0x8825('0xf'),auth[_0x8825('0xb')](),controller[_0x8825('0x1c')]);router[_0x8825('0x1a')]('/:id/resources',auth['isAuthenticated'](),controller[_0x8825('0x1d')]);module[_0x8825('0x1e')]=router; \ No newline at end of file +var _0xb3b7=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','describe','/:id','show','/:id/sections','getSections','/:id/resources','post','create','/:id/clone','clone','addResources','put','update','delete','destroy','removeSections','removeResources','util','path'];(function(_0xa3d694,_0x4a4430){var _0x385c16=function(_0x32041b){while(--_0x32041b){_0xa3d694['push'](_0xa3d694['shift']());}};_0x385c16(++_0x4a4430);}(_0xb3b7,0x16a));var _0x7b3b=function(_0x52a783,_0x3ca672){_0x52a783=_0x52a783-0x0;var _0x5766b6=_0xb3b7[_0x52a783];return _0x5766b6;};'use strict';var multer=require('multer');var util=require(_0x7b3b('0x0'));var path=require(_0x7b3b('0x1'));var timeout=require(_0x7b3b('0x2'));var express=require('express');var router=express[_0x7b3b('0x3')]();var fs_extra=require(_0x7b3b('0x4'));var auth=require(_0x7b3b('0x5'));var interaction=require(_0x7b3b('0x6'));var config=require('../../config/environment');var controller=require(_0x7b3b('0x7'));router[_0x7b3b('0x8')]('/',auth[_0x7b3b('0x9')](),controller[_0x7b3b('0xa')]);router[_0x7b3b('0x8')]('/describe',auth[_0x7b3b('0x9')](),controller[_0x7b3b('0xb')]);router[_0x7b3b('0x8')](_0x7b3b('0xc'),auth[_0x7b3b('0x9')](),controller[_0x7b3b('0xd')]);router[_0x7b3b('0x8')](_0x7b3b('0xe'),auth['isAuthenticated'](),controller[_0x7b3b('0xf')]);router[_0x7b3b('0x8')](_0x7b3b('0x10'),auth[_0x7b3b('0x9')](),controller['getResources']);router[_0x7b3b('0x11')]('/',auth['isAuthenticated'](),controller[_0x7b3b('0x12')]);router[_0x7b3b('0x11')](_0x7b3b('0x13'),auth[_0x7b3b('0x9')](),controller[_0x7b3b('0x14')]);router['post']('/:id/sections',auth[_0x7b3b('0x9')](),controller['addSections']);router[_0x7b3b('0x11')]('/:id/resources',auth[_0x7b3b('0x9')](),controller[_0x7b3b('0x15')]);router[_0x7b3b('0x16')](_0x7b3b('0xc'),auth[_0x7b3b('0x9')](),controller[_0x7b3b('0x17')]);router[_0x7b3b('0x18')](_0x7b3b('0xc'),auth[_0x7b3b('0x9')](),controller[_0x7b3b('0x19')]);router[_0x7b3b('0x18')](_0x7b3b('0xe'),auth[_0x7b3b('0x9')](),controller[_0x7b3b('0x1a')]);router[_0x7b3b('0x18')]('/:id/resources',auth[_0x7b3b('0x9')](),controller[_0x7b3b('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index ef94d1a..9874a98 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 _0x0c6b=['join','getDataValue','BOOLEAN','exports','STRING','setDataValue','crudPermissions'];(function(_0x12402c,_0xb5bbf1){var _0x19ba40=function(_0x32b4e4){while(--_0x32b4e4){_0x12402c['push'](_0x12402c['shift']());}};_0x19ba40(++_0xb5bbf1);}(_0x0c6b,0x1c3));var _0xb0c6=function(_0x52b3e3,_0x596581){_0x52b3e3=_0x52b3e3-0x0;var _0x3caaf0=_0x0c6b[_0x52b3e3];return _0x3caaf0;};'use strict';var Sequelize=require('sequelize');module[_0xb0c6('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xb0c6('0x1')],'set':function(_0x144b54){this[_0xb0c6('0x2')](_0xb0c6('0x3'),_0x144b54?_0x144b54[_0xb0c6('0x4')](''):[]);},'get':function(){return this[_0xb0c6('0x5')](_0xb0c6('0x3'))?this['getDataValue'](_0xb0c6('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xb0c6('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb0c6('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb0c6('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xb0c6('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb0c6('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb0c6('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7d23=['getDataValue','split','BOOLEAN','sequelize','STRING','name','setDataValue','crudPermissions'];(function(_0x5ce242,_0x5ea7f4){var _0x402f8d=function(_0x305dcf){while(--_0x305dcf){_0x5ce242['push'](_0x5ce242['shift']());}};_0x402f8d(++_0x5ea7f4);}(_0x7d23,0x1a3));var _0x37d2=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x7d23[_0x11c573];return _0x6b72de;};'use strict';var Sequelize=require(_0x37d2('0x0'));module['exports']={'name':{'type':Sequelize[_0x37d2('0x1')],'allowNull':![],'unique':_0x37d2('0x2')},'crudPermissions':{'type':Sequelize[_0x37d2('0x1')],'set':function(_0x2b8472){this[_0x37d2('0x3')](_0x37d2('0x4'),_0x2b8472?_0x2b8472['join'](''):[]);},'get':function(){return this[_0x37d2('0x5')](_0x37d2('0x4'))?this[_0x37d2('0x5')]('crudPermissions')[_0x37d2('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x37d2('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x37d2('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x37d2('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x37d2('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x37d2('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x37d2('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x37d2('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x37d2('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index c153232..d3bc9e4 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 _0x8a5c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','apply','reject','update','then','end','name','send','index','map','UserProfile','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','include','find','create','body','clone','get','omit','updatedAt','createdAt','sequelize','transaction','findAll','each','autoAssociation','sectionId','Resources','UserProfileResource','destroy','addSections','UserProfileSection','userProfileId','push','removeSections','ids','includes','isEmpty','enabled','subsections','findOne','Dashboard','forEach','Plugin','bulkCreate','removeResources','section','Missing\x20section\x20parameter','hasOwnProperty','nolimit','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x12173b,_0x22c847){var _0x366048=function(_0x1c7356){while(--_0x1c7356){_0x12173b['push'](_0x12173b['shift']());}};_0x366048(++_0x22c847);}(_0x8a5c,0x136));var _0xc8a5=function(_0x14ae83,_0x164295){_0x14ae83=_0x14ae83-0x0;var _0x592d07=_0x8a5c[_0x14ae83];return _0x592d07;};'use strict';var emlformat=require(_0xc8a5('0x0'));var rimraf=require(_0xc8a5('0x1'));var zipdir=require(_0xc8a5('0x2'));var jsonpatch=require(_0xc8a5('0x3'));var rp=require(_0xc8a5('0x4'));var moment=require(_0xc8a5('0x5'));var BPromise=require(_0xc8a5('0x6'));var Mustache=require(_0xc8a5('0x7'));var util=require(_0xc8a5('0x8'));var path=require('path');var sox=require(_0xc8a5('0x9'));var csv=require(_0xc8a5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc8a5('0xb'));var _=require(_0xc8a5('0xc'));var squel=require(_0xc8a5('0xd'));var crypto=require(_0xc8a5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc8a5('0xf'));var toCsv=require(_0xc8a5('0xa'));var querystring=require(_0xc8a5('0x10'));var Papa=require(_0xc8a5('0x11'));var Redis=require(_0xc8a5('0x12'));var authService=require(_0xc8a5('0x13'));var qs=require(_0xc8a5('0x14'));var as=require(_0xc8a5('0x15'));var hardwareService=require(_0xc8a5('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xc8a5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc8a5('0x18'));var db=require(_0xc8a5('0x19'))['db'];config[_0xc8a5('0x1a')]=_[_0xc8a5('0x1b')](config[_0xc8a5('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xc8a5('0x1c'))(new Redis(config[_0xc8a5('0x1a')]));require('./userProfile.socket')[_0xc8a5('0x1d')](socket);function respondWithStatusCode(_0x33062b,_0x197ea9){_0x197ea9=_0x197ea9||0xcc;return function(_0x2090d0){if(_0x2090d0){return _0x33062b[_0xc8a5('0x1e')](_0x197ea9);}return _0x33062b[_0xc8a5('0x1f')](_0x197ea9)['end']();};}function respondWithResult(_0xbc4806,_0x44d436){_0x44d436=_0x44d436||0xc8;return function(_0x5cb7ff){if(_0x5cb7ff){return _0xbc4806[_0xc8a5('0x1f')](_0x44d436)[_0xc8a5('0x20')](_0x5cb7ff);}};}function respondWithFilteredResult(_0x5d1c16,_0x2b7bc4){return function(_0x3ef8d3){if(_0x3ef8d3){var _0x12a441=typeof _0x2b7bc4[_0xc8a5('0x21')]===_0xc8a5('0x22')&&typeof _0x2b7bc4['limit']===_0xc8a5('0x22');var _0x523ddf=_0x3ef8d3[_0xc8a5('0x23')];var _0x43e970=_0x12a441?0x0:_0x2b7bc4['offset'];var _0x4c7c8a=_0x12a441?_0x3ef8d3[_0xc8a5('0x23')]:_0x2b7bc4[_0xc8a5('0x21')]+_0x2b7bc4[_0xc8a5('0x24')];var _0x15dc5c;if(_0x4c7c8a>=_0x523ddf){_0x4c7c8a=_0x523ddf;_0x15dc5c=0xc8;}else{_0x15dc5c=0xce;}_0x5d1c16[_0xc8a5('0x1f')](_0x15dc5c);return _0x5d1c16['set']('Content-Range',_0x43e970+'-'+_0x4c7c8a+'/'+_0x523ddf)[_0xc8a5('0x20')](_0x3ef8d3);}return null;};}function patchUpdates(_0x3c7fe9){return function(_0x4cd01d){try{jsonpatch[_0xc8a5('0x25')](_0x4cd01d,_0x3c7fe9,!![]);}catch(_0x406bda){return BPromise[_0xc8a5('0x26')](_0x406bda);}return _0x4cd01d['save']();};}function saveUpdates(_0x1b3870,_0x3beb20){return function(_0x266c59){if(_0x266c59){return _0x266c59[_0xc8a5('0x27')](_0x1b3870)[_0xc8a5('0x28')](function(_0x34205e){return _0x34205e;});}return null;};}function removeEntity(_0x3b325d,_0x3bbbdc){return function(_0x1ac715){if(_0x1ac715){return _0x1ac715['destroy']()[_0xc8a5('0x28')](function(){_0x3b325d[_0xc8a5('0x1f')](0xcc)[_0xc8a5('0x29')]();});}};}function handleEntityNotFound(_0x3539fd,_0x3d391f){return function(_0x453f5e){if(!_0x453f5e){_0x3539fd[_0xc8a5('0x1e')](0x194);}return _0x453f5e;};}function handleError(_0x483011,_0x4aa944){_0x4aa944=_0x4aa944||0x1f4;return function(_0x9886){logger['error'](_0x9886['stack']);if(_0x9886[_0xc8a5('0x2a')]){delete _0x9886[_0xc8a5('0x2a')];}_0x483011[_0xc8a5('0x1f')](_0x4aa944)[_0xc8a5('0x2b')](_0x9886);};}exports[_0xc8a5('0x2c')]=function(_0x31c416,_0x48f58a){var _0x240e07={},_0x432800={},_0x1c713f={'count':0x0,'rows':[]};var _0x31f5a3=_[_0xc8a5('0x2d')](db[_0xc8a5('0x2e')]['rawAttributes'],function(_0x445c3d){return{'name':_0x445c3d[_0xc8a5('0x2f')],'type':_0x445c3d[_0xc8a5('0x30')][_0xc8a5('0x31')]};});_0x432800['model']=_['map'](_0x31f5a3,_0xc8a5('0x2a'));_0x432800[_0xc8a5('0x32')]=_[_0xc8a5('0x33')](_0x31c416[_0xc8a5('0x32')]);_0x432800[_0xc8a5('0x34')]=_['intersection'](_0x432800[_0xc8a5('0x35')],_0x432800['query']);_0x240e07[_0xc8a5('0x36')]=_[_0xc8a5('0x37')](_0x432800[_0xc8a5('0x35')],qs['fields'](_0x31c416[_0xc8a5('0x32')][_0xc8a5('0x38')]));_0x240e07[_0xc8a5('0x36')]=_0x240e07['attributes'][_0xc8a5('0x39')]?_0x240e07[_0xc8a5('0x36')]:_0x432800['model'];if(!_0x31c416[_0xc8a5('0x32')]['hasOwnProperty']('nolimit')){_0x240e07['limit']=qs['limit'](_0x31c416['query'][_0xc8a5('0x24')]);_0x240e07['offset']=qs[_0xc8a5('0x21')](_0x31c416[_0xc8a5('0x32')][_0xc8a5('0x21')]);}_0x240e07[_0xc8a5('0x3a')]=qs[_0xc8a5('0x3b')](_0x31c416[_0xc8a5('0x32')][_0xc8a5('0x3b')]);_0x240e07['where']=qs[_0xc8a5('0x34')](_[_0xc8a5('0x3c')](_0x31c416['query'],_0x432800[_0xc8a5('0x34')]),_0x31f5a3);if(_0x31c416['query']['filter']){_0x240e07[_0xc8a5('0x3d')]=_[_0xc8a5('0x3e')](_0x240e07[_0xc8a5('0x3d')],{'$or':_['map'](_0x31f5a3,function(_0x4e925c){if(_0x4e925c[_0xc8a5('0x30')]!==_0xc8a5('0x3f')){var _0x228e73={};_0x228e73[_0x4e925c[_0xc8a5('0x2a')]]={'$like':'%'+_0x31c416['query'][_0xc8a5('0x40')]+'%'};return _0x228e73;}})});}_0x240e07=_[_0xc8a5('0x3e')]({},_0x240e07,_0x31c416[_0xc8a5('0x41')]);var _0x49caf3={'where':_0x240e07['where']};return db[_0xc8a5('0x2e')][_0xc8a5('0x23')](_0x49caf3)[_0xc8a5('0x28')](function(_0x9836c){_0x1c713f[_0xc8a5('0x23')]=_0x9836c;if(_0x31c416['query'][_0xc8a5('0x42')]){_0x240e07['include']=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x240e07);})[_0xc8a5('0x28')](function(_0x3a5f8f){_0x1c713f[_0xc8a5('0x43')]=_0x3a5f8f;return _0x1c713f;})[_0xc8a5('0x28')](respondWithFilteredResult(_0x48f58a,_0x240e07))[_0xc8a5('0x44')](handleError(_0x48f58a,null));};exports[_0xc8a5('0x45')]=function(_0x1fcc9a,_0x1698fa){var _0x1c9ace={'raw':![],'where':{'id':_0x1fcc9a[_0xc8a5('0x46')]['id']}},_0x334f24={};_0x334f24[_0xc8a5('0x35')]=_[_0xc8a5('0x33')](db[_0xc8a5('0x2e')]['rawAttributes']);_0x334f24[_0xc8a5('0x32')]=_[_0xc8a5('0x33')](_0x1fcc9a[_0xc8a5('0x32')]);_0x334f24[_0xc8a5('0x34')]=_[_0xc8a5('0x37')](_0x334f24[_0xc8a5('0x35')],_0x334f24[_0xc8a5('0x32')]);_0x1c9ace[_0xc8a5('0x36')]=_['intersection'](_0x334f24['model'],qs[_0xc8a5('0x38')](_0x1fcc9a[_0xc8a5('0x32')][_0xc8a5('0x38')]));_0x1c9ace['attributes']=_0x1c9ace[_0xc8a5('0x36')][_0xc8a5('0x39')]?_0x1c9ace['attributes']:_0x334f24[_0xc8a5('0x35')];if(_0x1fcc9a[_0xc8a5('0x32')][_0xc8a5('0x42')]){_0x1c9ace[_0xc8a5('0x47')]=[{'all':!![]}];}_0x1c9ace=_['merge']({},_0x1c9ace,_0x1fcc9a[_0xc8a5('0x41')]);return db[_0xc8a5('0x2e')][_0xc8a5('0x48')](_0x1c9ace)[_0xc8a5('0x28')](handleEntityNotFound(_0x1698fa,null))[_0xc8a5('0x28')](respondWithResult(_0x1698fa,null))[_0xc8a5('0x44')](handleError(_0x1698fa,null));};exports['create']=function(_0x1b44df,_0x2e7dfa){return db[_0xc8a5('0x2e')][_0xc8a5('0x49')](_0x1b44df[_0xc8a5('0x4a')],{})[_0xc8a5('0x28')](respondWithResult(_0x2e7dfa,0xc9))[_0xc8a5('0x44')](handleError(_0x2e7dfa,null));};exports[_0xc8a5('0x4b')]=function(_0x43cb68,_0x46f754){var _0x4252e4={'where':{'id':_0x43cb68[_0xc8a5('0x46')]['id']}},_0x93fa5b={};_0x93fa5b['model']=_[_0xc8a5('0x33')](db['UserProfile']['rawAttributes']);_0x4252e4['attributes']=_[_0xc8a5('0x37')](_0x93fa5b['model'],qs[_0xc8a5('0x38')](_0x43cb68[_0xc8a5('0x32')][_0xc8a5('0x38')]));_0x4252e4[_0xc8a5('0x36')]=_0x4252e4[_0xc8a5('0x36')][_0xc8a5('0x39')]?_0x4252e4[_0xc8a5('0x36')]:_0x93fa5b[_0xc8a5('0x35')];if(_0x43cb68[_0xc8a5('0x32')]['includeAll']){_0x4252e4[_0xc8a5('0x47')]=[{'all':!![]}];}_0x4252e4=_[_0xc8a5('0x3e')]({},_0x4252e4,_0x43cb68[_0xc8a5('0x41')]);return db[_0xc8a5('0x2e')][_0xc8a5('0x48')](_0x4252e4)['then'](handleEntityNotFound(_0x46f754,null))[_0xc8a5('0x28')](function(_0x3602f1){if(_0x3602f1){var _0x21f299=_0x3602f1[_0xc8a5('0x4c')]({'plain':!![]});_0x21f299=qs[_0xc8a5('0x4d')](_0x21f299,['id','createdAt',_0xc8a5('0x4e'),'crudPermissions']);_0x43cb68[_0xc8a5('0x4a')]=_[_0xc8a5('0x4d')](_0x43cb68['body'],['id',_0xc8a5('0x4f'),'updatedAt']);return db[_0xc8a5('0x50')][_0xc8a5('0x51')](function(_0xc49d18){return db[_0xc8a5('0x2e')][_0xc8a5('0x49')](_[_0xc8a5('0x3e')](_0x21f299,_0x43cb68[_0xc8a5('0x4a')]),{'include':_0x43cb68[_0xc8a5('0x32')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0xc49d18})[_0xc8a5('0x28')](function(_0x185924){var _0x556fc7=_0x185924[_0xc8a5('0x4c')]({'plain':!![]});return db['UserProfileSection'][_0xc8a5('0x52')]({'where':{'userProfileId':_0x43cb68[_0xc8a5('0x46')]['id']},'raw':!![]})[_0xc8a5('0x28')](function(_0x481036){if(_0x481036){return BPromise[_0xc8a5('0x53')](_0x481036,function(_0x31d636){return new BPromise(function(_0x405605,_0x63f943){if(_0x31d636['autoAssociation']===null||_0x31d636[_0xc8a5('0x54')]===0x1)_0x405605(null);return db['UserProfileResource'][_0xc8a5('0x52')]({'where':{'sectionId':_0x31d636['id']},'raw':!![]})['then'](function(_0x1d21fa){var _0x37982c=_['map'](_0x1d21fa,function(_0x6c2d3b){return qs[_0xc8a5('0x4d')](_0x6c2d3b,['id',_0xc8a5('0x4f'),_0xc8a5('0x4e'),_0xc8a5('0x55')]);});_0x405605(_0x37982c);})[_0xc8a5('0x44')](function(_0x3bb8f9){_0x63f943(_0x3bb8f9);});})[_0xc8a5('0x28')](function(_0x54c2b7){var _0x58d682=qs[_0xc8a5('0x4d')](_0x31d636,['id',_0xc8a5('0x4f'),_0xc8a5('0x4e')]);_0x58d682['userProfileId']=_0x556fc7['id'];if(_0x54c2b7)_0x58d682[_0xc8a5('0x56')]=_0x54c2b7;return _0x58d682;})[_0xc8a5('0x28')](function(_0x57741b){return db['UserProfileSection'][_0xc8a5('0x49')](_0x57741b,{'include':[{'model':db[_0xc8a5('0x57')],'as':'Resources'}],'raw':!![],'transaction':_0xc49d18});});})['then'](function(){return _0x556fc7;});}});});});}})[_0xc8a5('0x28')](respondWithResult(_0x46f754,0xc9))[_0xc8a5('0x44')](handleError(_0x46f754,null));};exports[_0xc8a5('0x27')]=function(_0x43ffa5,_0x25c05f){if(_0x43ffa5[_0xc8a5('0x4a')]['id']){delete _0x43ffa5['body']['id'];}return db['UserProfile'][_0xc8a5('0x48')]({'where':{'id':_0x43ffa5[_0xc8a5('0x46')]['id']}})[_0xc8a5('0x28')](handleEntityNotFound(_0x25c05f,null))[_0xc8a5('0x28')](saveUpdates(_0x43ffa5[_0xc8a5('0x4a')],null))[_0xc8a5('0x28')](respondWithResult(_0x25c05f,null))[_0xc8a5('0x44')](handleError(_0x25c05f,null));};exports[_0xc8a5('0x58')]=function(_0x586e4b,_0x2b2842){return db[_0xc8a5('0x2e')][_0xc8a5('0x48')]({'where':{'id':_0x586e4b['params']['id']}})[_0xc8a5('0x28')](handleEntityNotFound(_0x2b2842,null))['then'](removeEntity(_0x2b2842,null))['catch'](handleError(_0x2b2842,null));};exports['describe']=function(_0x15be7e,_0x4b2d2a){return db[_0xc8a5('0x2e')]['describe']()[_0xc8a5('0x28')](respondWithResult(_0x4b2d2a,null))['catch'](handleError(_0x4b2d2a,null));};exports[_0xc8a5('0x59')]=function(_0x53645c,_0x5aabf5){var _0x3a92ea=_0x53645c[_0xc8a5('0x4a')];return db[_0xc8a5('0x2e')][_0xc8a5('0x48')]({'where':{'id':_0x53645c[_0xc8a5('0x46')]['id']}})[_0xc8a5('0x28')](handleEntityNotFound(_0x5aabf5,null))[_0xc8a5('0x28')](function(_0x509886){if(_0x509886){return db[_0xc8a5('0x50')][_0xc8a5('0x51')](function(_0x208ae1){return db[_0xc8a5('0x5a')][_0xc8a5('0x58')]({'where':{'userProfileId':_0x53645c['params']['id'],'sectionId':_[_0xc8a5('0x2d')](_0x3a92ea,function(_0x3bcf19){return _0x3bcf19['sectionId'];})},'transaction':_0x208ae1})[_0xc8a5('0x28')](function(){var _0x98b938=_[_0xc8a5('0x2d')](_0x3a92ea,function(_0x3a4673){_0x3a4673[_0xc8a5('0x5b')]=_0x53645c[_0xc8a5('0x46')]['id'];return _0x3a4673;});var _0x5534ba=[];return BPromise[_0xc8a5('0x53')](_0x98b938,function(_0x28d4a6){return db[_0xc8a5('0x5a')]['create'](_0x28d4a6,{'include':[{'model':db[_0xc8a5('0x57')],'as':'Resources'}],'raw':!![],'transaction':_0x208ae1})[_0xc8a5('0x28')](function(_0x2ff188){_0x5534ba[_0xc8a5('0x5c')](_0x2ff188[_0xc8a5('0x4c')]({'plain':!![]}));});})['then'](function(){return _0x5534ba;});});});}})[_0xc8a5('0x28')](function(_0xf69fa9){return _0xf69fa9;})[_0xc8a5('0x28')](respondWithResult(_0x5aabf5,null))[_0xc8a5('0x44')](handleError(_0x5aabf5,null));};exports[_0xc8a5('0x5d')]=function(_0x11a3db,_0x424066){var _0x340bef;return db[_0xc8a5('0x2e')][_0xc8a5('0x48')]({'where':{'id':_0x11a3db[_0xc8a5('0x46')]['id']},'attributes':['id',_0xc8a5('0x2a')]})[_0xc8a5('0x28')](handleEntityNotFound(_0x424066,null))[_0xc8a5('0x28')](function(_0x445176){if(_0x445176){_0x340bef=_0x445176;return db['UserProfileSection'][_0xc8a5('0x58')]({'where':{'userProfileId':_0x11a3db[_0xc8a5('0x46')]['id'],'sectionId':_0x11a3db[_0xc8a5('0x32')][_0xc8a5('0x5e')]}});}})['then'](function(){return _0x340bef;})['then'](respondWithStatusCode(_0x424066,null))[_0xc8a5('0x44')](handleError(_0x424066,null));};exports['getSections']=function(_0x50af55,_0x511a6b){var _0x542351=[];var _0x1f370e=[];return db['UserProfileSection'][_0xc8a5('0x52')]({'where':{'userProfileId':_0x50af55[_0xc8a5('0x46')]['id']},'raw':!![]})[_0xc8a5('0x28')](function(_0x5cba59){_0x542351=_[_0xc8a5('0x40')](_0x5cba59,function(_0xaafb6){return _0xaafb6['enabled']===0x1||_[_0xc8a5('0x5f')]([0x3eb,0x709],_0xaafb6[_0xc8a5('0x55')]);});if(!_[_0xc8a5('0x60')](_0x542351)){return _[_0xc8a5('0x2d')](_0x542351,function(_0xe85a5){return _0xe85a5[_0xc8a5('0x55')];});}else{return;}})['then'](function(_0x5c3d0a){if(_0x5c3d0a)_0x1f370e=_0x5c3d0a;if(_[_0xc8a5('0x5f')](_0x1f370e,0x64)){var _0x349b81=_[_0xc8a5('0x48')](_0x542351,{'sectionId':0x64});return hasDefaultDashboard(_0x349b81)[_0xc8a5('0x28')](function(_0xe2815d){return _[_0xc8a5('0x2d')](_0x542351,function(_0x13c24c){if(_0x13c24c['sectionId']===0x64){_0x13c24c['subsections']=_0xe2815d;}return _0x13c24c;});});}else{return;}})[_0xc8a5('0x28')](function(_0x237746){if(_0x237746)_0x542351=_0x237746;if(_[_0xc8a5('0x5f')](_0x1f370e,0x3eb)){var _0xb07387=_[_0xc8a5('0x48')](_0x542351,{'sectionId':0x3eb});return getCustomDashboards(_0xb07387)[_0xc8a5('0x28')](function(_0x56b356){return _[_0xc8a5('0x2d')](_0x542351,function(_0x1606b1){if(_0xb07387[_0xc8a5('0x61')]){if(_0x1606b1[_0xc8a5('0x55')]===0x3eb){_0x1606b1[_0xc8a5('0x62')]=_0x56b356;}}else{if(_0x1606b1[_0xc8a5('0x55')]===0x64){_0x1606b1[_0xc8a5('0x62')]=_0x56b356;}}return _0x1606b1;});});}else{return;}})['then'](function(_0x5e23e2){if(_0x5e23e2)_0x542351=_0x5e23e2;if(_[_0xc8a5('0x5f')](_0x1f370e,0x709)){var _0x5afdb9=_[_0xc8a5('0x48')](_0x542351,{'sectionId':0x709});return getPlugins(_0x5afdb9)[_0xc8a5('0x28')](function(_0x2c9948){if(_0x5afdb9['enabled']){return _['map'](_0x542351,function(_0x2ef70b){if(_0x2ef70b[_0xc8a5('0x55')]===0x709){_0x2ef70b[_0xc8a5('0x62')]=_0x2c9948;}return _0x2ef70b;});}else{var _0x422879={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2c9948};var _0x1c7fb5=_[_0xc8a5('0x2d')](_0x542351);_0x1c7fb5[_0xc8a5('0x5c')](_0x422879);return _0x1c7fb5;}});}else{return;}})[_0xc8a5('0x28')](function(_0x4c49cb){if(_0x4c49cb)_0x542351=_0x4c49cb;return _[_0xc8a5('0x40')](_0x542351,[_0xc8a5('0x61'),0x1]);})['then'](respondWithResult(_0x511a6b,null))['catch'](handleError(_0x511a6b,null));};function hasDefaultDashboard(_0x4af14a){var _0x5f34ad=[0x65];return new BPromise(function(_0x43b5df,_0x5a480c){try{if(_0x4af14a[_0xc8a5('0x54')]){_0x43b5df(_0x5f34ad);}else{return db[_0xc8a5('0x57')][_0xc8a5('0x63')]({'where':{'sectionId':_0x4af14a['id']},'raw':!![]})[_0xc8a5('0x28')](function(_0x562798){_0x562798?_0x43b5df(_0x5f34ad):_0x43b5df();});}}catch(_0x21df3b){_0x5a480c(_0x21df3b);}});}function getCustomDashboards(_0x34ca69){var _0x2b2ed1=[];return new BPromise(function(_0x103828,_0x1333d4){try{if(_0x34ca69['autoAssociation']){return db[_0xc8a5('0x64')]['findAll']({'raw':!![]})['then'](function(_0x62964){_0x62964['forEach'](function(_0x4c6a3a){_0x2b2ed1[_0xc8a5('0x5c')](_0x4c6a3a['id']+0x1869f);});_0x103828(_0x2b2ed1);});}else{return db['UserProfileResource'][_0xc8a5('0x52')]({'where':{'sectionId':_0x34ca69['id']},'raw':!![]})['then'](function(_0x4096e9){_0x4096e9[_0xc8a5('0x65')](function(_0x53eb24){_0x2b2ed1['push'](_0x53eb24['resourceId']+0x1869f);});_0x103828(_0x2b2ed1);});}}catch(_0x2073f5){_0x1333d4(_0x2073f5);}});}function getPlugins(_0x127c11){var _0x1f62c4=[];return new BPromise(function(_0x14a71d,_0x58da58){try{if(_0x127c11[_0xc8a5('0x54')]){return db[_0xc8a5('0x66')][_0xc8a5('0x52')]({'raw':!![]})[_0xc8a5('0x28')](function(_0x1ead99){_0x1ead99[_0xc8a5('0x65')](function(_0x1c51ed){_0x1f62c4[_0xc8a5('0x5c')](_0x1c51ed['id']+0x15b38);});_0x14a71d(_0x1f62c4);});}else{return db[_0xc8a5('0x57')][_0xc8a5('0x52')]({'where':{'sectionId':_0x127c11['id']},'raw':!![]})[_0xc8a5('0x28')](function(_0x3c4179){_0x3c4179[_0xc8a5('0x65')](function(_0x27d87c){_0x1f62c4[_0xc8a5('0x5c')](_0x27d87c['resourceId']+0x15b38);});_0x14a71d(_0x1f62c4);});}}catch(_0x1ec309){_0x58da58(_0x1ec309);}});}exports['addResources']=function(_0x3005e5,_0x1d3fea){return db[_0xc8a5('0x2e')][_0xc8a5('0x48')]({'where':{'id':_0x3005e5[_0xc8a5('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d3fea,null))['then'](function(_0x3bbac0){if(_0x3bbac0){return db[_0xc8a5('0x50')][_0xc8a5('0x51')](function(_0x10ebd6){return db[_0xc8a5('0x5a')][_0xc8a5('0x52')]({'where':{'userProfileId':_0x3005e5[_0xc8a5('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0xc8a5('0x28')](function(_0x44e8c3){if(_0x44e8c3){return db['UserProfileSection'][_0xc8a5('0x58')]({'where':{'userProfileId':_0x3005e5[_0xc8a5('0x46')]['id'],'id':_[_0xc8a5('0x2d')](_0x44e8c3,function(_0x166c88){return _0x166c88['id'];})},'transaction':_0x10ebd6});}})[_0xc8a5('0x28')](function(_0x24747b){var _0x5a29ad=_[_0xc8a5('0x2d')](_0x3005e5[_0xc8a5('0x4a')],function(_0x5e0122){_0x5e0122[_0xc8a5('0x5b')]=_0x3005e5[_0xc8a5('0x46')]['id'];return _0x5e0122;});return db[_0xc8a5('0x5a')][_0xc8a5('0x67')](_0x5a29ad,{'raw':!![],'transaction':_0x10ebd6});})[_0xc8a5('0x28')](function(_0x4f5c1d){var _0x41e2b3=_['filter'](_['map'](_0x4f5c1d,function(_0x2d7f4c){return _0x2d7f4c[_0xc8a5('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x41e2b3){return db[_0xc8a5('0x5a')]['findAll']({'where':{'userProfileId':_0x3005e5['params']['id'],'sectionId':_['map'](_0x41e2b3,function(_0x14e4f8){return _0x14e4f8['sectionId'];})},'attributes':['id',_0xc8a5('0x55')],'raw':!![]})[_0xc8a5('0x28')](function(_0x5a4fa4){var _0x3c9b95=_[_0xc8a5('0x2d')](_0x3005e5[_0xc8a5('0x4a')],function(_0x18feee){_0x18feee[_0xc8a5('0x5b')]=_0x3005e5[_0xc8a5('0x46')]['id'];return _0x18feee;});return db[_0xc8a5('0x57')][_0xc8a5('0x67')](_0x3c9b95,{'raw':!![],'transaction':_0x10ebd6});});}})[_0xc8a5('0x44')](handleError(_0x1d3fea,null));});}})[_0xc8a5('0x28')](function(_0x4b0e90){var _0xd1cac8=_[_0xc8a5('0x2d')](_0x4b0e90,function(_0x17e74d){return _0x17e74d[_0xc8a5('0x4c')]({'plain':!![]});});})['then'](respondWithResult(_0x1d3fea,null))[_0xc8a5('0x44')](handleError(_0x1d3fea,null));};exports[_0xc8a5('0x68')]=function(_0x48b778,_0x3a50a2,_0x2567c){return db['UserProfile'][_0xc8a5('0x48')]({'where':{'id':_0x48b778['params']['id']}})[_0xc8a5('0x28')](handleEntityNotFound(_0x3a50a2,null))['then'](function(_0x5650f7){if(_0x5650f7){return _0x5650f7[_0xc8a5('0x68')](_0x48b778['query'][_0xc8a5('0x5e')]);}})['then'](respondWithStatusCode(_0x3a50a2,null))[_0xc8a5('0x44')](handleError(_0x3a50a2,null));};exports['getResources']=function(_0x26e746,_0x4aa892){var _0x689332={};if(!_0x26e746[_0xc8a5('0x32')][_0xc8a5('0x69')])throw new Error(_0xc8a5('0x6a'));if(!_0x26e746[_0xc8a5('0x32')][_0xc8a5('0x6b')](_0xc8a5('0x6c'))){_0x689332['limit']=qs[_0xc8a5('0x24')](_0x26e746[_0xc8a5('0x32')][_0xc8a5('0x24')]);_0x689332[_0xc8a5('0x21')]=qs[_0xc8a5('0x21')](_0x26e746[_0xc8a5('0x32')][_0xc8a5('0x21')]);}return db[_0xc8a5('0x2e')][_0xc8a5('0x48')]({'where':{'id':_0x26e746[_0xc8a5('0x46')]['id']}})[_0xc8a5('0x28')](function(_0x3a8492){if(!_0x3a8492)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x26e746['params']['id']);return db['UserProfile'][_0xc8a5('0x6d')](_0x26e746);})['then'](respondWithFilteredResult(_0x4aa892,_0x689332))[_0xc8a5('0x44')](handleError(_0x4aa892,null));}; \ No newline at end of file +var _0xdf4d=['../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','index','UserProfile','rawAttributes','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','intersection','find','create','get','createdAt','updatedAt','crudPermissions','body','omit','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','Resources','UserProfileSection','addSections','destroy','userProfileId','push','removeSections','ids','enabled','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','section','Missing\x20section\x20parameter','getResources','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0xe9e6ea,_0x3a039a){var _0x19e3f7=function(_0x5b13a8){while(--_0x5b13a8){_0xe9e6ea['push'](_0xe9e6ea['shift']());}};_0x19e3f7(++_0x3a039a);}(_0xdf4d,0xcb));var _0xddf4=function(_0x3ca14c,_0x2368c6){_0x3ca14c=_0x3ca14c-0x0;var _0x19cc35=_0xdf4d[_0x3ca14c];return _0x19cc35;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xddf4('0x0'));var zipdir=require(_0xddf4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xddf4('0x2'));var moment=require(_0xddf4('0x3'));var BPromise=require(_0xddf4('0x4'));var Mustache=require(_0xddf4('0x5'));var util=require(_0xddf4('0x6'));var path=require(_0xddf4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xddf4('0x8'));var fs=require('fs');var fs_extra=require(_0xddf4('0x9'));var _=require(_0xddf4('0xa'));var squel=require(_0xddf4('0xb'));var crypto=require(_0xddf4('0xc'));var jsforce=require(_0xddf4('0xd'));var deskjs=require(_0xddf4('0xe'));var toCsv=require(_0xddf4('0xf'));var querystring=require(_0xddf4('0x10'));var Papa=require(_0xddf4('0x11'));var Redis=require(_0xddf4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xddf4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xddf4('0x14'));var logger=require(_0xddf4('0x15'))(_0xddf4('0x16'));var utils=require(_0xddf4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xddf4('0x18'));var db=require(_0xddf4('0x19'))['db'];config[_0xddf4('0x1a')]=_[_0xddf4('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xddf4('0x1c'))(new Redis(config['redis']));require(_0xddf4('0x1d'))[_0xddf4('0x1e')](socket);function respondWithStatusCode(_0x3754f5,_0x276ab2){_0x276ab2=_0x276ab2||0xcc;return function(_0x3ef3a1){if(_0x3ef3a1){return _0x3754f5['sendStatus'](_0x276ab2);}return _0x3754f5[_0xddf4('0x1f')](_0x276ab2)['end']();};}function respondWithResult(_0x13c576,_0x464288){_0x464288=_0x464288||0xc8;return function(_0x111e2e){if(_0x111e2e){return _0x13c576[_0xddf4('0x1f')](_0x464288)[_0xddf4('0x20')](_0x111e2e);}};}function respondWithFilteredResult(_0x29ff35,_0x28f3fb){return function(_0x4d76b1){if(_0x4d76b1){var _0x49e4d3=typeof _0x28f3fb[_0xddf4('0x21')]===_0xddf4('0x22')&&typeof _0x28f3fb['limit']==='undefined';var _0x5cb24f=_0x4d76b1[_0xddf4('0x23')];var _0x412dab=_0x49e4d3?0x0:_0x28f3fb[_0xddf4('0x21')];var _0x254c7a=_0x49e4d3?_0x4d76b1[_0xddf4('0x23')]:_0x28f3fb['offset']+_0x28f3fb[_0xddf4('0x24')];var _0x5b1aee;if(_0x254c7a>=_0x5cb24f){_0x254c7a=_0x5cb24f;_0x5b1aee=0xc8;}else{_0x5b1aee=0xce;}_0x29ff35[_0xddf4('0x1f')](_0x5b1aee);return _0x29ff35[_0xddf4('0x25')](_0xddf4('0x26'),_0x412dab+'-'+_0x254c7a+'/'+_0x5cb24f)['json'](_0x4d76b1);}return null;};}function patchUpdates(_0x1f7a04){return function(_0x60b240){try{jsonpatch[_0xddf4('0x27')](_0x60b240,_0x1f7a04,!![]);}catch(_0x4ccad2){return BPromise[_0xddf4('0x28')](_0x4ccad2);}return _0x60b240[_0xddf4('0x29')]();};}function saveUpdates(_0x149a0e,_0x3d37da){return function(_0x321b6c){if(_0x321b6c){return _0x321b6c[_0xddf4('0x2a')](_0x149a0e)[_0xddf4('0x2b')](function(_0x898311){return _0x898311;});}return null;};}function removeEntity(_0x44bb39,_0x1757f6){return function(_0x2c76c6){if(_0x2c76c6){return _0x2c76c6['destroy']()[_0xddf4('0x2b')](function(){_0x44bb39['status'](0xcc)[_0xddf4('0x2c')]();});}};}function handleEntityNotFound(_0x1d9edd,_0x345d35){return function(_0x67dbb1){if(!_0x67dbb1){_0x1d9edd[_0xddf4('0x2d')](0x194);}return _0x67dbb1;};}function handleError(_0x19cfb7,_0x215f34){_0x215f34=_0x215f34||0x1f4;return function(_0x1e8945){logger[_0xddf4('0x2e')](_0x1e8945[_0xddf4('0x2f')]);if(_0x1e8945[_0xddf4('0x30')]){delete _0x1e8945['name'];}_0x19cfb7['status'](_0x215f34)['send'](_0x1e8945);};}exports[_0xddf4('0x31')]=function(_0x4c2ad9,_0xbcbbaa){var _0x10311d={},_0x3e2680={},_0x1be3e7={'count':0x0,'rows':[]};var _0x48de86=_['map'](db[_0xddf4('0x32')][_0xddf4('0x33')],function(_0x4fc988){return{'name':_0x4fc988['fieldName'],'type':_0x4fc988[_0xddf4('0x34')][_0xddf4('0x35')]};});_0x3e2680[_0xddf4('0x36')]=_['map'](_0x48de86,_0xddf4('0x30'));_0x3e2680[_0xddf4('0x37')]=_['keys'](_0x4c2ad9['query']);_0x3e2680[_0xddf4('0x38')]=_['intersection'](_0x3e2680[_0xddf4('0x36')],_0x3e2680[_0xddf4('0x37')]);_0x10311d['attributes']=_['intersection'](_0x3e2680[_0xddf4('0x36')],qs['fields'](_0x4c2ad9[_0xddf4('0x37')][_0xddf4('0x39')]));_0x10311d[_0xddf4('0x3a')]=_0x10311d[_0xddf4('0x3a')][_0xddf4('0x3b')]?_0x10311d[_0xddf4('0x3a')]:_0x3e2680[_0xddf4('0x36')];if(!_0x4c2ad9[_0xddf4('0x37')][_0xddf4('0x3c')](_0xddf4('0x3d'))){_0x10311d['limit']=qs[_0xddf4('0x24')](_0x4c2ad9[_0xddf4('0x37')][_0xddf4('0x24')]);_0x10311d[_0xddf4('0x21')]=qs[_0xddf4('0x21')](_0x4c2ad9[_0xddf4('0x37')][_0xddf4('0x21')]);}_0x10311d[_0xddf4('0x3e')]=qs[_0xddf4('0x3f')](_0x4c2ad9[_0xddf4('0x37')][_0xddf4('0x3f')]);_0x10311d[_0xddf4('0x40')]=qs[_0xddf4('0x38')](_['pick'](_0x4c2ad9[_0xddf4('0x37')],_0x3e2680[_0xddf4('0x38')]),_0x48de86);if(_0x4c2ad9['query'][_0xddf4('0x41')]){_0x10311d[_0xddf4('0x40')]=_[_0xddf4('0x42')](_0x10311d[_0xddf4('0x40')],{'$or':_[_0xddf4('0x43')](_0x48de86,function(_0xd7e337){if(_0xd7e337[_0xddf4('0x34')]!==_0xddf4('0x44')){var _0x5b7bd2={};_0x5b7bd2[_0xd7e337[_0xddf4('0x30')]]={'$like':'%'+_0x4c2ad9['query']['filter']+'%'};return _0x5b7bd2;}})});}_0x10311d=_[_0xddf4('0x42')]({},_0x10311d,_0x4c2ad9[_0xddf4('0x45')]);var _0x3cd53f={'where':_0x10311d[_0xddf4('0x40')]};return db[_0xddf4('0x32')]['count'](_0x3cd53f)[_0xddf4('0x2b')](function(_0x1195d4){_0x1be3e7[_0xddf4('0x23')]=_0x1195d4;if(_0x4c2ad9[_0xddf4('0x37')][_0xddf4('0x46')]){_0x10311d[_0xddf4('0x47')]=[{'all':!![]}];}return db[_0xddf4('0x32')][_0xddf4('0x48')](_0x10311d);})[_0xddf4('0x2b')](function(_0x2f9588){_0x1be3e7[_0xddf4('0x49')]=_0x2f9588;return _0x1be3e7;})[_0xddf4('0x2b')](respondWithFilteredResult(_0xbcbbaa,_0x10311d))[_0xddf4('0x4a')](handleError(_0xbcbbaa,null));};exports['show']=function(_0x1bcb35,_0x284134){var _0x59d876={'raw':![],'where':{'id':_0x1bcb35[_0xddf4('0x4b')]['id']}},_0x8e38ea={};_0x8e38ea[_0xddf4('0x36')]=_[_0xddf4('0x4c')](db[_0xddf4('0x32')][_0xddf4('0x33')]);_0x8e38ea[_0xddf4('0x37')]=_[_0xddf4('0x4c')](_0x1bcb35[_0xddf4('0x37')]);_0x8e38ea[_0xddf4('0x38')]=_[_0xddf4('0x4d')](_0x8e38ea[_0xddf4('0x36')],_0x8e38ea['query']);_0x59d876['attributes']=_[_0xddf4('0x4d')](_0x8e38ea[_0xddf4('0x36')],qs[_0xddf4('0x39')](_0x1bcb35[_0xddf4('0x37')][_0xddf4('0x39')]));_0x59d876[_0xddf4('0x3a')]=_0x59d876['attributes'][_0xddf4('0x3b')]?_0x59d876[_0xddf4('0x3a')]:_0x8e38ea['model'];if(_0x1bcb35[_0xddf4('0x37')][_0xddf4('0x46')]){_0x59d876[_0xddf4('0x47')]=[{'all':!![]}];}_0x59d876=_[_0xddf4('0x42')]({},_0x59d876,_0x1bcb35['options']);return db[_0xddf4('0x32')][_0xddf4('0x4e')](_0x59d876)['then'](handleEntityNotFound(_0x284134,null))['then'](respondWithResult(_0x284134,null))[_0xddf4('0x4a')](handleError(_0x284134,null));};exports['create']=function(_0x288c8a,_0x27b30a){return db[_0xddf4('0x32')][_0xddf4('0x4f')](_0x288c8a['body'],{})[_0xddf4('0x2b')](respondWithResult(_0x27b30a,0xc9))[_0xddf4('0x4a')](handleError(_0x27b30a,null));};exports['clone']=function(_0x3943dc,_0x5b1552){var _0x203eed={'where':{'id':_0x3943dc[_0xddf4('0x4b')]['id']}},_0x1efc8d={};_0x1efc8d['model']=_[_0xddf4('0x4c')](db['UserProfile'][_0xddf4('0x33')]);_0x203eed['attributes']=_[_0xddf4('0x4d')](_0x1efc8d[_0xddf4('0x36')],qs[_0xddf4('0x39')](_0x3943dc[_0xddf4('0x37')][_0xddf4('0x39')]));_0x203eed['attributes']=_0x203eed[_0xddf4('0x3a')][_0xddf4('0x3b')]?_0x203eed[_0xddf4('0x3a')]:_0x1efc8d['model'];if(_0x3943dc[_0xddf4('0x37')]['includeAll']){_0x203eed[_0xddf4('0x47')]=[{'all':!![]}];}_0x203eed=_[_0xddf4('0x42')]({},_0x203eed,_0x3943dc[_0xddf4('0x45')]);return db[_0xddf4('0x32')][_0xddf4('0x4e')](_0x203eed)[_0xddf4('0x2b')](handleEntityNotFound(_0x5b1552,null))['then'](function(_0x193a18){if(_0x193a18){var _0x2a58c8=_0x193a18[_0xddf4('0x50')]({'plain':!![]});_0x2a58c8=qs['omit'](_0x2a58c8,['id',_0xddf4('0x51'),_0xddf4('0x52'),_0xddf4('0x53')]);_0x3943dc[_0xddf4('0x54')]=_[_0xddf4('0x55')](_0x3943dc['body'],['id','createdAt','updatedAt']);return db[_0xddf4('0x56')][_0xddf4('0x57')](function(_0x29dc36){return db[_0xddf4('0x32')][_0xddf4('0x4f')](_['merge'](_0x2a58c8,_0x3943dc[_0xddf4('0x54')]),{'include':_0x3943dc[_0xddf4('0x37')][_0xddf4('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x29dc36})['then'](function(_0x364812){var _0x3fb248=_0x364812[_0xddf4('0x50')]({'plain':!![]});return db['UserProfileSection'][_0xddf4('0x48')]({'where':{'userProfileId':_0x3943dc[_0xddf4('0x4b')]['id']},'raw':!![]})['then'](function(_0x30ae8a){if(_0x30ae8a){return BPromise[_0xddf4('0x58')](_0x30ae8a,function(_0x3e9d8a){return new BPromise(function(_0x1d06ea,_0x11893f){if(_0x3e9d8a['autoAssociation']===null||_0x3e9d8a[_0xddf4('0x59')]===0x1)_0x1d06ea(null);return db[_0xddf4('0x5a')][_0xddf4('0x48')]({'where':{'sectionId':_0x3e9d8a['id']},'raw':!![]})[_0xddf4('0x2b')](function(_0x4c2080){var _0x32dfbf=_[_0xddf4('0x43')](_0x4c2080,function(_0x2eca89){return qs[_0xddf4('0x55')](_0x2eca89,['id',_0xddf4('0x51'),_0xddf4('0x52'),_0xddf4('0x5b')]);});_0x1d06ea(_0x32dfbf);})[_0xddf4('0x4a')](function(_0x90745b){_0x11893f(_0x90745b);});})[_0xddf4('0x2b')](function(_0x21db53){var _0x605e2c=qs['omit'](_0x3e9d8a,['id',_0xddf4('0x51'),'updatedAt']);_0x605e2c['userProfileId']=_0x3fb248['id'];if(_0x21db53)_0x605e2c[_0xddf4('0x5c')]=_0x21db53;return _0x605e2c;})['then'](function(_0x48d54a){return db[_0xddf4('0x5d')][_0xddf4('0x4f')](_0x48d54a,{'include':[{'model':db[_0xddf4('0x5a')],'as':_0xddf4('0x5c')}],'raw':!![],'transaction':_0x29dc36});});})[_0xddf4('0x2b')](function(){return _0x3fb248;});}});});});}})['then'](respondWithResult(_0x5b1552,0xc9))['catch'](handleError(_0x5b1552,null));};exports[_0xddf4('0x2a')]=function(_0x545cf8,_0x42ff2a){if(_0x545cf8[_0xddf4('0x54')]['id']){delete _0x545cf8['body']['id'];}return db[_0xddf4('0x32')][_0xddf4('0x4e')]({'where':{'id':_0x545cf8[_0xddf4('0x4b')]['id']}})[_0xddf4('0x2b')](handleEntityNotFound(_0x42ff2a,null))[_0xddf4('0x2b')](saveUpdates(_0x545cf8[_0xddf4('0x54')],null))['then'](respondWithResult(_0x42ff2a,null))['catch'](handleError(_0x42ff2a,null));};exports['destroy']=function(_0x4a5837,_0x223028){return db[_0xddf4('0x32')][_0xddf4('0x4e')]({'where':{'id':_0x4a5837[_0xddf4('0x4b')]['id']}})[_0xddf4('0x2b')](handleEntityNotFound(_0x223028,null))[_0xddf4('0x2b')](removeEntity(_0x223028,null))[_0xddf4('0x4a')](handleError(_0x223028,null));};exports['describe']=function(_0x82d699,_0x313551){return db[_0xddf4('0x32')]['describe']()[_0xddf4('0x2b')](respondWithResult(_0x313551,null))['catch'](handleError(_0x313551,null));};exports[_0xddf4('0x5e')]=function(_0x48f6c5,_0x1c480a){var _0xcef0c2=_0x48f6c5[_0xddf4('0x54')];return db[_0xddf4('0x32')][_0xddf4('0x4e')]({'where':{'id':_0x48f6c5[_0xddf4('0x4b')]['id']}})[_0xddf4('0x2b')](handleEntityNotFound(_0x1c480a,null))[_0xddf4('0x2b')](function(_0x38e3a6){if(_0x38e3a6){return db[_0xddf4('0x56')][_0xddf4('0x57')](function(_0x37b462){return db[_0xddf4('0x5d')][_0xddf4('0x5f')]({'where':{'userProfileId':_0x48f6c5[_0xddf4('0x4b')]['id'],'sectionId':_[_0xddf4('0x43')](_0xcef0c2,function(_0x353c30){return _0x353c30['sectionId'];})},'transaction':_0x37b462})['then'](function(){var _0x33f4b3=_[_0xddf4('0x43')](_0xcef0c2,function(_0x1a700b){_0x1a700b[_0xddf4('0x60')]=_0x48f6c5[_0xddf4('0x4b')]['id'];return _0x1a700b;});var _0x446f12=[];return BPromise['each'](_0x33f4b3,function(_0x397b25){return db[_0xddf4('0x5d')][_0xddf4('0x4f')](_0x397b25,{'include':[{'model':db['UserProfileResource'],'as':_0xddf4('0x5c')}],'raw':!![],'transaction':_0x37b462})[_0xddf4('0x2b')](function(_0xd71e22){_0x446f12[_0xddf4('0x61')](_0xd71e22[_0xddf4('0x50')]({'plain':!![]}));});})[_0xddf4('0x2b')](function(){return _0x446f12;});});});}})[_0xddf4('0x2b')](function(_0x53619b){return _0x53619b;})[_0xddf4('0x2b')](respondWithResult(_0x1c480a,null))[_0xddf4('0x4a')](handleError(_0x1c480a,null));};exports[_0xddf4('0x62')]=function(_0x21efbe,_0x58dc5b){var _0x525548;return db[_0xddf4('0x32')][_0xddf4('0x4e')]({'where':{'id':_0x21efbe['params']['id']},'attributes':['id',_0xddf4('0x30')]})[_0xddf4('0x2b')](handleEntityNotFound(_0x58dc5b,null))[_0xddf4('0x2b')](function(_0x1b83ca){if(_0x1b83ca){_0x525548=_0x1b83ca;return db[_0xddf4('0x5d')]['destroy']({'where':{'userProfileId':_0x21efbe['params']['id'],'sectionId':_0x21efbe[_0xddf4('0x37')][_0xddf4('0x63')]}});}})['then'](function(){return _0x525548;})[_0xddf4('0x2b')](respondWithStatusCode(_0x58dc5b,null))[_0xddf4('0x4a')](handleError(_0x58dc5b,null));};exports['getSections']=function(_0x2572da,_0x536dc2){var _0x44d0b3=[];var _0x589ccc=[];return db[_0xddf4('0x5d')]['findAll']({'where':{'userProfileId':_0x2572da['params']['id']},'raw':!![]})[_0xddf4('0x2b')](function(_0x7cd11d){_0x44d0b3=_[_0xddf4('0x41')](_0x7cd11d,function(_0x49d894){return _0x49d894[_0xddf4('0x64')]===0x1||_['includes']([0x3eb,0x709],_0x49d894[_0xddf4('0x5b')]);});if(!_['isEmpty'](_0x44d0b3)){return _[_0xddf4('0x43')](_0x44d0b3,function(_0x4d5d0a){return _0x4d5d0a[_0xddf4('0x5b')];});}else{return;}})[_0xddf4('0x2b')](function(_0x5bffb4){if(_0x5bffb4)_0x589ccc=_0x5bffb4;if(_[_0xddf4('0x65')](_0x589ccc,0x64)){var _0x1b98d6=_['find'](_0x44d0b3,{'sectionId':0x64});return hasDefaultDashboard(_0x1b98d6)[_0xddf4('0x2b')](function(_0x2af3bd){return _[_0xddf4('0x43')](_0x44d0b3,function(_0x31a74b){if(_0x31a74b[_0xddf4('0x5b')]===0x64){_0x31a74b[_0xddf4('0x66')]=_0x2af3bd;}return _0x31a74b;});});}else{return;}})['then'](function(_0x3f6d68){if(_0x3f6d68)_0x44d0b3=_0x3f6d68;if(_['includes'](_0x589ccc,0x3eb)){var _0x1f769a=_[_0xddf4('0x4e')](_0x44d0b3,{'sectionId':0x3eb});return getCustomDashboards(_0x1f769a)[_0xddf4('0x2b')](function(_0x4ffd49){return _[_0xddf4('0x43')](_0x44d0b3,function(_0x3a5ea7){if(_0x1f769a[_0xddf4('0x64')]){if(_0x3a5ea7['sectionId']===0x3eb){_0x3a5ea7[_0xddf4('0x66')]=_0x4ffd49;}}else{if(_0x3a5ea7[_0xddf4('0x5b')]===0x64){_0x3a5ea7[_0xddf4('0x66')]=_0x4ffd49;}}return _0x3a5ea7;});});}else{return;}})[_0xddf4('0x2b')](function(_0x4d20fa){if(_0x4d20fa)_0x44d0b3=_0x4d20fa;if(_[_0xddf4('0x65')](_0x589ccc,0x709)){var _0x579f66=_[_0xddf4('0x4e')](_0x44d0b3,{'sectionId':0x709});return getPlugins(_0x579f66)[_0xddf4('0x2b')](function(_0xa771f4){if(_0x579f66[_0xddf4('0x64')]){return _['map'](_0x44d0b3,function(_0x436cee){if(_0x436cee['sectionId']===0x709){_0x436cee['subsections']=_0xa771f4;}return _0x436cee;});}else{var _0x453932={'sectionId':0x76c,'enabled':0x1,'subsections':_0xa771f4};var _0x2c431c=_[_0xddf4('0x43')](_0x44d0b3);_0x2c431c[_0xddf4('0x61')](_0x453932);return _0x2c431c;}});}else{return;}})[_0xddf4('0x2b')](function(_0x46d3ec){if(_0x46d3ec)_0x44d0b3=_0x46d3ec;return _[_0xddf4('0x41')](_0x44d0b3,['enabled',0x1]);})[_0xddf4('0x2b')](respondWithResult(_0x536dc2,null))[_0xddf4('0x4a')](handleError(_0x536dc2,null));};function hasDefaultDashboard(_0x357d09){var _0xa687cb=[0x65];return new BPromise(function(_0x1b98be,_0x226dfa){try{if(_0x357d09['autoAssociation']){_0x1b98be(_0xa687cb);}else{return db[_0xddf4('0x5a')][_0xddf4('0x67')]({'where':{'sectionId':_0x357d09['id']},'raw':!![]})[_0xddf4('0x2b')](function(_0x57dbf2){_0x57dbf2?_0x1b98be(_0xa687cb):_0x1b98be();});}}catch(_0x162f99){_0x226dfa(_0x162f99);}});}function getCustomDashboards(_0x3414fe){var _0x1caf26=[];return new BPromise(function(_0xb4f02,_0x1d4e7b){try{if(_0x3414fe['autoAssociation']){return db[_0xddf4('0x68')][_0xddf4('0x48')]({'raw':!![]})[_0xddf4('0x2b')](function(_0x233e74){_0x233e74[_0xddf4('0x69')](function(_0x327a6a){_0x1caf26[_0xddf4('0x61')](_0x327a6a['id']+0x1869f);});_0xb4f02(_0x1caf26);});}else{return db['UserProfileResource'][_0xddf4('0x48')]({'where':{'sectionId':_0x3414fe['id']},'raw':!![]})[_0xddf4('0x2b')](function(_0xbdd3f2){_0xbdd3f2[_0xddf4('0x69')](function(_0x29f726){_0x1caf26[_0xddf4('0x61')](_0x29f726[_0xddf4('0x6a')]+0x1869f);});_0xb4f02(_0x1caf26);});}}catch(_0x5a4fc9){_0x1d4e7b(_0x5a4fc9);}});}function getPlugins(_0x131ce4){var _0x1bd8fb=[];return new BPromise(function(_0xa0e1cf,_0x107c2f){try{if(_0x131ce4[_0xddf4('0x59')]){return db[_0xddf4('0x6b')][_0xddf4('0x48')]({'raw':!![]})[_0xddf4('0x2b')](function(_0x19c91b){_0x19c91b[_0xddf4('0x69')](function(_0xb9976c){_0x1bd8fb[_0xddf4('0x61')](_0xb9976c['id']+0x15b38);});_0xa0e1cf(_0x1bd8fb);});}else{return db[_0xddf4('0x5a')][_0xddf4('0x48')]({'where':{'sectionId':_0x131ce4['id']},'raw':!![]})[_0xddf4('0x2b')](function(_0x598bde){_0x598bde[_0xddf4('0x69')](function(_0x370ae5){_0x1bd8fb[_0xddf4('0x61')](_0x370ae5[_0xddf4('0x6a')]+0x15b38);});_0xa0e1cf(_0x1bd8fb);});}}catch(_0xd0ba87){_0x107c2f(_0xd0ba87);}});}exports['addResources']=function(_0x474a38,_0xa815b0){return db[_0xddf4('0x32')][_0xddf4('0x4e')]({'where':{'id':_0x474a38['params']['id']}})['then'](handleEntityNotFound(_0xa815b0,null))[_0xddf4('0x2b')](function(_0x2adfe5){if(_0x2adfe5){return db[_0xddf4('0x56')]['transaction'](function(_0x2ad6e5){return db['UserProfileSection'][_0xddf4('0x48')]({'where':{'userProfileId':_0x474a38['params']['id']},'attributes':['id'],'raw':!![]})[_0xddf4('0x2b')](function(_0xbd1c13){if(_0xbd1c13){return db[_0xddf4('0x5d')][_0xddf4('0x5f')]({'where':{'userProfileId':_0x474a38[_0xddf4('0x4b')]['id'],'id':_['map'](_0xbd1c13,function(_0x272f73){return _0x272f73['id'];})},'transaction':_0x2ad6e5});}})[_0xddf4('0x2b')](function(_0x2a1c01){var _0x168b08=_[_0xddf4('0x43')](_0x474a38['body'],function(_0x13045f){_0x13045f[_0xddf4('0x60')]=_0x474a38['params']['id'];return _0x13045f;});return db[_0xddf4('0x5d')][_0xddf4('0x6c')](_0x168b08,{'raw':!![],'transaction':_0x2ad6e5});})[_0xddf4('0x2b')](function(_0x1bd078){var _0x15c09b=_[_0xddf4('0x41')](_[_0xddf4('0x43')](_0x1bd078,function(_0xcf9229){return _0xcf9229['get']({'plain':!![]});}),{'includeAll':![]});if(_0x15c09b){return db[_0xddf4('0x5d')][_0xddf4('0x48')]({'where':{'userProfileId':_0x474a38['params']['id'],'sectionId':_[_0xddf4('0x43')](_0x15c09b,function(_0x4ff838){return _0x4ff838[_0xddf4('0x5b')];})},'attributes':['id',_0xddf4('0x5b')],'raw':!![]})[_0xddf4('0x2b')](function(_0x3481cc){var _0x73a093=_['map'](_0x474a38[_0xddf4('0x54')],function(_0x1c590b){_0x1c590b[_0xddf4('0x60')]=_0x474a38['params']['id'];return _0x1c590b;});return db['UserProfileResource'][_0xddf4('0x6c')](_0x73a093,{'raw':!![],'transaction':_0x2ad6e5});});}})[_0xddf4('0x4a')](handleError(_0xa815b0,null));});}})['then'](function(_0x29477f){var _0x37d6b5=_[_0xddf4('0x43')](_0x29477f,function(_0xadd6e8){return _0xadd6e8[_0xddf4('0x50')]({'plain':!![]});});})[_0xddf4('0x2b')](respondWithResult(_0xa815b0,null))[_0xddf4('0x4a')](handleError(_0xa815b0,null));};exports[_0xddf4('0x6d')]=function(_0x527217,_0x31ced0,_0x3b00e8){return db['UserProfile'][_0xddf4('0x4e')]({'where':{'id':_0x527217['params']['id']}})[_0xddf4('0x2b')](handleEntityNotFound(_0x31ced0,null))[_0xddf4('0x2b')](function(_0x49d378){if(_0x49d378){return _0x49d378['removeResources'](_0x527217[_0xddf4('0x37')][_0xddf4('0x63')]);}})['then'](respondWithStatusCode(_0x31ced0,null))[_0xddf4('0x4a')](handleError(_0x31ced0,null));};exports['getResources']=function(_0x313052,_0x437188){var _0x135298={};if(!_0x313052[_0xddf4('0x37')][_0xddf4('0x6e')])throw new Error(_0xddf4('0x6f'));if(!_0x313052[_0xddf4('0x37')][_0xddf4('0x3c')](_0xddf4('0x3d'))){_0x135298['limit']=qs[_0xddf4('0x24')](_0x313052[_0xddf4('0x37')][_0xddf4('0x24')]);_0x135298['offset']=qs[_0xddf4('0x21')](_0x313052[_0xddf4('0x37')]['offset']);}return db[_0xddf4('0x32')]['find']({'where':{'id':_0x313052[_0xddf4('0x4b')]['id']}})['then'](function(_0x295783){if(!_0x295783)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x313052['params']['id']);return db[_0xddf4('0x32')][_0xddf4('0x70')](_0x313052);})[_0xddf4('0x2b')](respondWithFilteredResult(_0x437188,_0x135298))['catch'](handleError(_0x437188,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index ee9efb0..989467b 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 _0xfd2e=['events','UserProfile','save','remove','hasOwnProperty'];(function(_0x240d24,_0x7663d0){var _0x3f24cd=function(_0x251d5d){while(--_0x251d5d){_0x240d24['push'](_0x240d24['shift']());}};_0x3f24cd(++_0x7663d0);}(_0xfd2e,0x6e));var _0xefd2=function(_0x593a31,_0x534b73){_0x593a31=_0x593a31-0x0;var _0xa977fd=_0xfd2e[_0x593a31];return _0xa977fd;};'use strict';var EventEmitter=require(_0xefd2('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xefd2('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xefd2('0x2'),'afterUpdate':'update','afterDestroy':_0xefd2('0x3')};function emitEvent(_0x1c75dd){return function(_0x2b6511,_0x11d644,_0x2e095c){UserProfileEvents['emit'](_0x1c75dd+':'+_0x2b6511['id'],_0x2b6511);UserProfileEvents['emit'](_0x1c75dd,_0x2b6511);_0x2e095c(null);};}for(var e in events){if(events[_0xefd2('0x4')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xee3c=['events','../../mysqldb','UserProfile','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xee3c,0x14a));var _0xcee3=function(_0x475d84,_0x39754a){_0x475d84=_0x475d84-0x0;var _0x5dc03f=_0xee3c[_0x475d84];return _0x5dc03f;};'use strict';var EventEmitter=require(_0xcee3('0x0'));var UserProfile=require(_0xcee3('0x1'))['db'][_0xcee3('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xcee3('0x3')](0x0);var events={'afterCreate':_0xcee3('0x4'),'afterUpdate':_0xcee3('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4a7681){return function(_0x435892,_0x4cd398,_0x39d2a8){UserProfileEvents[_0xcee3('0x6')](_0x4a7681+':'+_0x435892['id'],_0x435892);UserProfileEvents[_0xcee3('0x6')](_0x4a7681,_0x435892);_0x39d2a8(null);};}for(var e in events){if(events[_0xcee3('0x7')](e)){var event=events[e];UserProfile[_0xcee3('0x8')](e,emitEvent(event));}}module[_0xcee3('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index a356cfa..588800f 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 _0xd7d1=['UserProfile','user_profiles','raw','section','Invalid\x20section\x20\x27','length','UserProfileSection','find','all','ignore','isEmpty','union','push','autoAssociation','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','reportType','default','reportId','DefaultReports','custom','rows','ids','intersection','count','include','Tag','Tags','tag','openTabs','true','chat','dataValues','sms','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','model','name','resolve','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','childModel','JscriptyProject','contacts','CmContact','Lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceRecording','Agents','role','agent','Telephones','membername','User','telephone','VoiceQueues','QueueCampaigns','queue','VoiceQueue','type','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Schedule','Sound','tags','templates','triggers','Trigger','trunks','Trunk','variables','plugins','Reports','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs'];(function(_0x451de3,_0x395bb3){var _0x58416d=function(_0x5aee15){while(--_0x5aee15){_0x451de3['push'](_0x451de3['shift']());}};_0x58416d(++_0x395bb3);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x519201,_0x2e79bd){_0x519201=_0x519201-0x0;var _0x58ad4d=_0xd7d1[_0x519201];return _0x58ad4d;};'use strict';var _=require(_0x1d7d('0x0'));var attributes=require(_0x1d7d('0x1'));var qs=require(_0x1d7d('0x2'));var squel=require(_0x1d7d('0x3'));module[_0x1d7d('0x4')]=function(_0x3c3a27){var _0x222e84=_0x3c3a27[_0x1d7d('0x5')];function _0x1ac097(_0x1adb6b,_0x3c0839){return new Promise(function(_0x1a2564,_0x14b2b9){if(!_0x3c0839)return _0x1a2564(null);var _0x5a8cf3=_0x3c0839[_0x1d7d('0x6')]?{[_0x3c0839[_0x1d7d('0x6')][_0x1d7d('0x7')]]:_0x3c0839[_0x1d7d('0x6')][_0x1d7d('0x8')]}:undefined;return _0x222e84[_0x1adb6b][_0x1d7d('0x9')]({'where':_0x5a8cf3,'raw':!![]})[_0x1d7d('0xa')](function(_0xa44223){_0x3c0839[_0x1d7d('0xb')]=_[_0x1d7d('0xc')](_0xa44223,'id');_0x1a2564(_0x3c0839);})[_0x1d7d('0xd')](function(_0x547f7b){_0x14b2b9(_0x547f7b);});});}function _0xe6b9eb(_0x4c6809,_0x3cbca9){return new Promise(function(_0x3a7add,_0x3ddf35){var _0x30b888=_0x4c6809['filter']?{[_0x4c6809[_0x1d7d('0x6')]['field']]:_0x4c6809['filter'][_0x1d7d('0x8')]}:undefined;return _0x222e84[_0x4c6809[_0x1d7d('0xe')]]['findAll']({'where':_0x30b888,'raw':!![]})['then'](function(_0x1d3822){_0x3cbca9[_0x1d7d('0xb')]=_[_0x1d7d('0xc')](_0x1d3822,function(_0x183fc6){return _0x183fc6[_0x1d7d('0xf')];});_0x3a7add(_0x3cbca9);})['catch'](function(_0x28adf3){_0x3ddf35(_0x28adf3);});});}function _0x1de6cc(_0x51cbca,_0xb90a8c,_0x162c3a){if(!_0xb90a8c)return Promise[_0x1d7d('0x10')](null);return new Promise(function(_0x47826a,_0x40db4d){return _0x222e84['UserProfileResource'][_0x1d7d('0x9')]({'where':{'sectionId':_0xb90a8c['id']},'raw':!![]})[_0x1d7d('0xa')](function(_0x5cbb8f){if(_0x51cbca['field']&&_0x51cbca[_0x1d7d('0x7')]!=='id'){_0xb90a8c[_0x1d7d('0xb')]=_[_0x1d7d('0xc')](_0x5cbb8f,function(_0x396802){return _0x396802[_0x51cbca[_0x1d7d('0x7')]];});}else{if(_0x162c3a===_0x1d7d('0x11')){_0xb90a8c['associatedResources']=_[_0x1d7d('0xc')](_0x5cbb8f,function(_0x40c27f){return{'id':_0x40c27f[_0x1d7d('0x12')],'type':_0x40c27f['type']};});}else{_0xb90a8c[_0x1d7d('0xb')]=_[_0x1d7d('0xc')](_0x5cbb8f,function(_0x4a1cdc){return _0x4a1cdc['resourceId'];});}}_0x47826a(_0xb90a8c);})[_0x1d7d('0xd')](function(_0x264a4e){_0x40db4d(_0x264a4e);});});}function _0x3d631f(_0x5097b8,_0x377653){var _0x106376={'parentSections':[]};switch(_0x5097b8[_0x1d7d('0x13')]()){case _0x1d7d('0x14'):_0x106376['childModel']=_0x1d7d('0x15');break;case _0x1d7d('0x16'):_0x106376['childModel']='SquareOdbc';break;case _0x1d7d('0x17'):_0x106376['childModel']=_0x1d7d('0x18');_0x106376[_0x1d7d('0x19')]=[{'name':_0x1d7d('0x1a'),'field':_0x1d7d('0xf'),'foreignKey':_0x1d7d('0x1b')}];break;case'projects':_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x1d');break;case _0x1d7d('0x1e'):_0x106376['childModel']=_0x1d7d('0x1f');_0x106376[_0x1d7d('0x19')]=[{'name':_0x1d7d('0x20'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x106376['childModel']=_0x1d7d('0x21');break;case _0x1d7d('0x22'):_0x106376['childModel']=_0x1d7d('0x23');break;case _0x1d7d('0x24'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x25');break;case _0x1d7d('0x26'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x27');break;case _0x1d7d('0x28'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x29');break;case'faxqueues':_0x106376['childModel']=_0x1d7d('0x2a');break;case _0x1d7d('0x2b'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x2c');break;case _0x1d7d('0x2d'):case _0x1d7d('0x2e'):case _0x1d7d('0x2f'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x30');break;case'contexts':_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x31');break;case _0x1d7d('0x32'):_0x106376[_0x1d7d('0x1c')]='VoiceMail';break;case'voicerecordings':_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x33');_0x106376['parentSections']=[{'name':_0x1d7d('0x34'),'field':_0x1d7d('0xf'),'foreignKey':'membername','model':'User','filter':{'field':_0x1d7d('0x35'),'value':[_0x1d7d('0x36')]}},{'name':_0x1d7d('0x37'),'field':_0x1d7d('0xf'),'foreignKey':_0x1d7d('0x38'),'model':_0x1d7d('0x39'),'filter':{'field':_0x1d7d('0x35'),'value':[_0x1d7d('0x3a')]}},{'name':_0x1d7d('0x3b'),'field':_0x1d7d('0xf'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':['inbound']}},{'name':_0x1d7d('0x3c'),'field':'name','foreignKey':_0x1d7d('0x3d'),'model':_0x1d7d('0x3e'),'filter':{'field':_0x1d7d('0x3f'),'value':['outbound']}}];break;case _0x1d7d('0x40'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x41');break;case'chanspies':_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x42');break;case _0x1d7d('0x43'):_0x106376[_0x1d7d('0x1c')]='VoicePrefix';break;case _0x1d7d('0x44'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x45');break;case _0x1d7d('0x46'):_0x106376['childModel']=_0x1d7d('0x47');break;case'mailaccounts':_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x48');break;case _0x1d7d('0x49'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x4a');break;case'openchannelqueues':_0x106376['childModel']=_0x1d7d('0x4b');break;case _0x1d7d('0x4c'):_0x106376[_0x1d7d('0x1c')]='OpenchannelAccount';break;case'smsqueues':_0x106376[_0x1d7d('0x1c')]='SmsQueue';break;case _0x1d7d('0x4d'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x4e');break;case _0x1d7d('0x4f'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x50');break;case _0x1d7d('0x51'):_0x106376['childModel']=_0x1d7d('0x52');break;case _0x1d7d('0x53'):_0x106376['childModel']=_0x1d7d('0x54');break;case _0x1d7d('0x55'):case _0x1d7d('0x56'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x3e');if(_0x377653){_0x106376[_0x1d7d('0x19')]=[{'name':_0x1d7d('0x3b')},{'name':_0x1d7d('0x3c')}];}break;case _0x1d7d('0x57'):case _0x1d7d('0x58'):case _0x1d7d('0x59'):_0x106376[_0x1d7d('0x1c')]='User';if(_0x377653){_0x106376[_0x1d7d('0x19')]=[{'name':'Users','filter':{'field':_0x1d7d('0x35'),'value':['admin',_0x1d7d('0x5a')]},'ignore':!![]},{'name':_0x1d7d('0x34')},{'name':_0x1d7d('0x37')}];}break;case _0x1d7d('0x5b'):_0x106376['childModel']=_0x1d7d('0x5c');break;case'salesforceaccounts':_0x106376['childModel']=_0x1d7d('0x5d');break;case'freshdeskaccounts':_0x106376['childModel']=_0x1d7d('0x5e');break;case _0x1d7d('0x5f'):_0x106376['childModel']=_0x1d7d('0x60');break;case _0x1d7d('0x61'):_0x106376['childModel']=_0x1d7d('0x62');break;case _0x1d7d('0x63'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x64');break;case'vtigeraccounts':_0x106376['childModel']=_0x1d7d('0x39');break;case _0x1d7d('0x65'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x66');break;case _0x1d7d('0x67'):_0x106376['childModel']=_0x1d7d('0x68');break;case _0x1d7d('0x69'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x6a');break;case _0x1d7d('0x6b'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x6c');break;case _0x1d7d('0x6d'):_0x106376[_0x1d7d('0x1c')]='Pause';break;case _0x1d7d('0x6e'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x6f');break;case'sounds':_0x106376['childModel']=_0x1d7d('0x70');break;case _0x1d7d('0x71'):_0x106376[_0x1d7d('0x1c')]='Tag';break;case _0x1d7d('0x72'):_0x106376[_0x1d7d('0x1c')]='Template';break;case _0x1d7d('0x73'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x74');break;case _0x1d7d('0x75'):_0x106376['childModel']=_0x1d7d('0x76');break;case _0x1d7d('0x77'):_0x106376['childModel']='Variable';break;case _0x1d7d('0x78'):_0x106376[_0x1d7d('0x1c')]='Plugin';break;case'extractedreports':_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x11');_0x106376[_0x1d7d('0x19')]=[{'name':_0x1d7d('0x79'),'field':'id','foreignKey':'reportId'}];break;case _0x1d7d('0x7a'):_0x106376['childModel']=_0x1d7d('0x7b');break;}return _0x106376;}function _0x1b1d9e(_0x14078d,_0x5f84fe){var _0x5a4bd7=_0x14078d[_0x1d7d('0x7c')](0x0)[_0x1d7d('0x7d')]()+_0x14078d[_0x1d7d('0x7e')](0x1);var _0x226509={'type':_0x222e84[_0x1d7d('0x7f')][_0x1d7d('0x80')][_0x1d7d('0x81')],'raw':!![]};return new Promise(function(_0x2bd2a0,_0x27cebf){var _0x17c967=squel[_0x1d7d('0x82')]()[_0x1d7d('0x7')](_0x1d7d('0x83')+_0x5a4bd7+_0x1d7d('0x84'),'id')[_0x1d7d('0x7')]('ui.createdAt')[_0x1d7d('0x85')]('user_has_'+_0x14078d+_0x1d7d('0x86'),'ui')[_0x1d7d('0x87')](_0x1d7d('0x88'),_0x5f84fe['id']);return _0x222e84[_0x1d7d('0x89')][_0x1d7d('0x8a')](_0x17c967[_0x1d7d('0x8b')](),_0x226509)['then'](function(_0x9043bf){_0x5f84fe[_0x5a4bd7+_0x1d7d('0x8c')]=_0x9043bf;_0x2bd2a0(_0x9043bf);})['catch'](function(_0x2c6d03){_0x27cebf(_0x2c6d03);});});}return _0x3c3a27['define'](_0x1d7d('0x8d'),attributes,{'tableName':_0x1d7d('0x8e'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x11eddd){var _0x283f77={'raw':_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0x8f')],'where':{}};var _0x516aa0={};var _0x3768a7={'count':0x0,'rows':[]};var _0x35a44b=_0x11eddd['query'][_0x1d7d('0x90')];var _0x3da337=_0x11eddd[_0x1d7d('0x8a')]['mergeResources']||![];var _0x3b3975=_0x3d631f(_0x35a44b,_0x3da337);if(!_0x3b3975[_0x1d7d('0x1c')])throw new Error(_0x1d7d('0x91')+_0x35a44b+'\x27');var _0x1938fe=[{'name':_0x35a44b}];if(!_['isEmpty'](_0x3b3975[_0x1d7d('0x19')]))_0x1938fe=_0x3b3975[_0x1d7d('0x19')];var _0x1e25db=[];for(var _0x18dac4=0x0;_0x18dac4<_0x1938fe[_0x1d7d('0x92')];_0x18dac4++){_0x1e25db['push'](_0x222e84[_0x1d7d('0x93')][_0x1d7d('0x94')]({'where':{'userProfileId':_0x11eddd['params']['id'],'name':_0x1938fe[_0x18dac4][_0x1d7d('0xf')]},'raw':!![]}));}return Promise[_0x1d7d('0x95')](_0x1e25db)[_0x1d7d('0xa')](function(_0x20c900){var _0x47d27e=_[_0x1d7d('0x6')](_0x20c900,function(_0x4a3159){return _0x4a3159?_0x4a3159:undefined;});var _0x3b93aa=_[_0x1d7d('0x6')](_0x1938fe,[_0x1d7d('0x96'),!![]]);var _0x5e1172=_[_0x1d7d('0x97')](_0x47d27e)&&_[_0x1d7d('0x97')](_0x3b93aa)?null:_[_0x1d7d('0x98')](_0x3b93aa,_0x47d27e);if(!_0x5e1172)return null;var _0x55ded9=[];for(var _0x45b66d=0x0;_0x45b66d<_0x5e1172['length'];_0x45b66d++){var _0x6e9ee6=_[_0x1d7d('0x94')](_0x1938fe,function(_0x131c8e){return _0x5e1172[_0x45b66d]?_0x131c8e[_0x1d7d('0xf')]===_0x5e1172[_0x45b66d][_0x1d7d('0xf')]:null;});if(_0x6e9ee6){if(_0x5e1172[_0x45b66d][_0x1d7d('0x96')]){_0x55ded9[_0x1d7d('0x99')](_0x1ac097(_0x3b3975[_0x1d7d('0x1c')],_0x5e1172[_0x45b66d]));}else{if(!_0x5e1172[_0x45b66d][_0x1d7d('0x9a')]){_0x55ded9[_0x1d7d('0x99')](_0x1de6cc(_0x6e9ee6,_0x5e1172[_0x45b66d],_0x3b3975[_0x1d7d('0x1c')]));}else{if(_0x6e9ee6['model']){_0x55ded9['push'](_0xe6b9eb(_0x6e9ee6,_0x5e1172[_0x45b66d]));}}}}}return Promise[_0x1d7d('0x95')](_0x55ded9);})[_0x1d7d('0xa')](function(_0x3b2615){var _0x5f3406=_0x3b2615;var _0x44854c=null;if(_0x5f3406){_0x44854c=_0x5f3406['length']===0x1?_0x5f3406[0x0]:null;}if(!_0x44854c&&!_0x5f3406)return _0x3768a7;var _0x139d9a=_0x222e84[_0x3b3975[_0x1d7d('0x1c')]]['rawAttributes'];_0x516aa0[_0x1d7d('0xe')]=_[_0x1d7d('0x9b')](_0x139d9a);_0x516aa0['query']=_[_0x1d7d('0x9b')](_0x11eddd[_0x1d7d('0x8a')]);_0x516aa0[_0x1d7d('0x9c')]=_['intersection'](_0x516aa0['model'],_0x516aa0[_0x1d7d('0x8a')]);_0x283f77[_0x1d7d('0x9d')]=_['intersection'](_0x516aa0[_0x1d7d('0xe')],qs[_0x1d7d('0x9e')](_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0x9e')]));_0x283f77['attributes']=_0x283f77[_0x1d7d('0x9d')][_0x1d7d('0x92')]?_0x283f77[_0x1d7d('0x9d')]:_0x516aa0[_0x1d7d('0xe')];if(!_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0x9f')](_0x1d7d('0xa0'))){_0x283f77[_0x1d7d('0xa1')]=qs[_0x1d7d('0xa1')](_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0xa1')]);_0x283f77[_0x1d7d('0xa2')]=qs[_0x1d7d('0xa2')](_0x11eddd['query'][_0x1d7d('0xa2')]);}_0x283f77[_0x1d7d('0xa3')]=qs['sort'](_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0xa4')]);_0x283f77['where']=qs['filters'](_['pick'](_0x11eddd[_0x1d7d('0x8a')],_0x516aa0[_0x1d7d('0x9c')]));if(_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0x6')]){_0x283f77['where']=_[_0x1d7d('0xa5')](_0x283f77[_0x1d7d('0x87')],{'$or':_[_0x1d7d('0xc')](_0x139d9a,function(_0x1d39a9){if(_0x1d39a9['type'][_0x1d7d('0xa6')]!==_0x1d7d('0xa7')){var _0x135910={};_0x135910[_0x1d39a9[_0x1d7d('0x7')]]={'$like':'%'+_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0x6')]+'%'};return _0x135910;}})});}var _0x57abf9=[];var _0x230834=null;var _0x2d90fb={};if(_0x44854c){_0x230834=_['find'](_0x1938fe,[_0x1d7d('0xf'),_0x44854c[_0x1d7d('0xf')]]);if(_0x230834[_0x1d7d('0x7')]){_0x2d90fb={};if(_0x3b3975['childModel']===_0x1d7d('0x11')){_0x2d90fb[_0x230834['foreignKey']]=_[_0x1d7d('0xc')](_0x44854c[_0x1d7d('0xb')],'id');}else{_0x2d90fb[_0x230834['foreignKey']]=_0x44854c[_0x1d7d('0xb')];}_0x57abf9[_0x1d7d('0x99')](_0x2d90fb);}else{_0x283f77[_0x1d7d('0x87')]['id']=_0x44854c[_0x1d7d('0xb')];}}else{for(var _0x20b275=0x0;_0x20b275<_0x5f3406[_0x1d7d('0x92')];_0x20b275++){_0x230834=_[_0x1d7d('0x94')](_0x1938fe,[_0x1d7d('0xf'),_0x5f3406[_0x20b275][_0x1d7d('0xf')]]);if(_0x230834[_0x1d7d('0x7')]){_0x2d90fb={};_0x2d90fb[_0x230834[_0x1d7d('0xa8')]]=_0x5f3406[_0x20b275][_0x1d7d('0xb')];_0x57abf9['push'](_0x2d90fb);}else{if(!_0x283f77['where']['id'])_0x283f77[_0x1d7d('0x87')]['id']=[];_0x5f3406[_0x20b275][_0x1d7d('0xb')][_0x1d7d('0xa9')](function(_0x395818){_0x283f77[_0x1d7d('0x87')]['id'][_0x1d7d('0x99')](_0x395818);});}}}if(!_[_0x1d7d('0x97')](_0x57abf9)){_0x283f77[_0x1d7d('0x87')]=_[_0x1d7d('0xa5')](_0x283f77[_0x1d7d('0x87')],{'$and':{'$or':_0x57abf9}});}_0x283f77=_[_0x1d7d('0xa5')]({},_0x283f77,_0x11eddd[_0x1d7d('0xaa')]);if(_0x44854c&&!_0x44854c['autoAssociation']&&_0x3b3975[_0x1d7d('0x1c')]===_0x1d7d('0x11')){if(_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0xab')]){_0x283f77['include']=[{'all':!![]}];}return _0x222e84[_0x3b3975[_0x1d7d('0x1c')]][_0x1d7d('0x9')](_0x283f77)[_0x1d7d('0xa')](function(_0x31cfa1){var _0x53cc1d=[];_0x31cfa1['forEach'](function(_0x5e4340){var _0x56030c;switch(_0x5e4340[_0x1d7d('0xac')]){case _0x1d7d('0xad'):_0x56030c=_['find'](_0x44854c['associatedResources'],function(_0xb5db24){return _0xb5db24['id']===_0x5e4340[_0x1d7d('0xae')]&&_0xb5db24[_0x1d7d('0x3f')]===_0x1d7d('0xaf');});break;case _0x1d7d('0xb0'):_0x56030c=_[_0x1d7d('0x94')](_0x44854c[_0x1d7d('0xb')],function(_0x35020c){return _0x35020c['id']===_0x5e4340[_0x1d7d('0xae')]&&_0x35020c[_0x1d7d('0x3f')]==='CustomReports';});break;}if(_0x56030c)_0x53cc1d[_0x1d7d('0x99')](_0x5e4340);});_0x3768a7['count']=_0x53cc1d[_0x1d7d('0x92')];_0x3768a7[_0x1d7d('0xb1')]=_0x53cc1d;return _0x3768a7;});}else{if(!_[_0x1d7d('0x97')](_0x11eddd['query'][_0x1d7d('0xb2')])){_0x283f77[_0x1d7d('0x87')]['id']=_0x283f77[_0x1d7d('0x87')]['id']?_[_0x1d7d('0xb3')](_0x283f77[_0x1d7d('0x87')]['id'],_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0xb2')]):_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0xb2')];}return _0x222e84[_0x3b3975[_0x1d7d('0x1c')]][_0x1d7d('0xb4')]({'where':_0x283f77[_0x1d7d('0x87')]})[_0x1d7d('0xa')](function(_0xd6c7ad){_0x3768a7[_0x1d7d('0xb4')]=_0xd6c7ad;if(_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0xab')]){if(_0x3b3975[_0x1d7d('0x1c')]===_0x1d7d('0x1f')){_0x283f77[_0x1d7d('0xb5')]=[{'model':_0x222e84[_0x1d7d('0xb6')],'as':_0x1d7d('0xb7'),'attributes':['id',_0x1d7d('0xf'),'color'],'required':_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0xb8')]?!![]:![]},{'model':_0x222e84[_0x1d7d('0xb6')],'as':'ThroughTags','attributes':['id',_0x1d7d('0xf'),'color'],'through':_0x11eddd['query']['tag']?{'attributes':[],'where':{'TagId':_0x11eddd['query'][_0x1d7d('0xb8')]||undefined}}:{},'required':_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0xb8')]?!![]:![]}];}else{_0x283f77['include']=[{'all':!![]}];}}return _0x222e84[_0x3b3975[_0x1d7d('0x1c')]]['findAll'](_0x283f77);})[_0x1d7d('0xa')](function(_0x25a34f){_0x3768a7[_0x1d7d('0xb1')]=_0x25a34f;if(_0x35a44b===_0x1d7d('0x34')&&_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0xb9')]===_0x1d7d('0xba')){var _0x171024=[];for(var _0x44baef=0x0;_0x44baef<_0x3768a7[_0x1d7d('0xb1')][_0x1d7d('0x92')];_0x44baef++){_0x171024['push'](_0x1b1d9e(_0x1d7d('0xbb'),_0x3768a7[_0x1d7d('0xb1')][_0x44baef][_0x1d7d('0xbc')]));_0x171024['push'](_0x1b1d9e(_0x1d7d('0xbd'),_0x3768a7[_0x1d7d('0xb1')][_0x44baef][_0x1d7d('0xbc')]));_0x171024['push'](_0x1b1d9e('fax',_0x3768a7[_0x1d7d('0xb1')][_0x44baef]['dataValues']));_0x171024[_0x1d7d('0x99')](_0x1b1d9e(_0x1d7d('0xbe'),_0x3768a7['rows'][_0x44baef][_0x1d7d('0xbc')]));_0x171024[_0x1d7d('0x99')](_0x1b1d9e('openchannel',_0x3768a7[_0x1d7d('0xb1')][_0x44baef][_0x1d7d('0xbc')]));_0x171024[_0x1d7d('0x99')](_0x1b1d9e(_0x1d7d('0xbf'),_0x3768a7['rows'][_0x44baef]['dataValues']));}return Promise[_0x1d7d('0x95')](_0x171024)[_0x1d7d('0xa')](function(){return _0x3768a7;});}return _0x3768a7;});}});}}});}; \ No newline at end of file +var _0x4137=['QueryTypes','select','ui.','InteractionId','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','define','user_profiles','query','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','find','ignore','autoAssociation','model','all','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','pick','VIRTUAL','push','foreignKey','forEach','merge','options','include','reportType','default','reportId','DefaultReports','custom','CustomReports','rows','ids','count','includeAll','Tags','color','tag','ThroughTags','Agents','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','associatedResources','catch','then','map','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','name','role','Telephones','membername','User','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','MailQueue','mailaccounts','MailAccount','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','Disposition','customdashboards','Dashboard','Interval','Sound','tags','Tag','Template','triggers','Trigger','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','toUpperCase','slice','Sequelize'];(function(_0x256fec,_0x4c1399){var _0x5d1ca8=function(_0x4fbe2a){while(--_0x4fbe2a){_0x256fec['push'](_0x256fec['shift']());}};_0x5d1ca8(++_0x4c1399);}(_0x4137,0xf8));var _0x7413=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4137[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7413('0x0'));var attributes=require(_0x7413('0x1'));var qs=require(_0x7413('0x2'));var squel=require(_0x7413('0x3'));module[_0x7413('0x4')]=function(_0x410971){var _0x2e6df7=_0x410971[_0x7413('0x5')];function _0x258255(_0x3dc48a,_0x451a96){return new Promise(function(_0x3bb181,_0x4fbade){if(!_0x451a96)return _0x3bb181(null);var _0xc808cd=_0x451a96[_0x7413('0x6')]?{[_0x451a96[_0x7413('0x6')][_0x7413('0x7')]]:_0x451a96['filter'][_0x7413('0x8')]}:undefined;return _0x2e6df7[_0x3dc48a][_0x7413('0x9')]({'where':_0xc808cd,'raw':!![]})['then'](function(_0x422bf5){_0x451a96[_0x7413('0xa')]=_['map'](_0x422bf5,'id');_0x3bb181(_0x451a96);})[_0x7413('0xb')](function(_0x427b3b){_0x4fbade(_0x427b3b);});});}function _0x737ab4(_0x3e026b,_0x14212d){return new Promise(function(_0x5a1e62,_0xa25d72){var _0x32034c=_0x3e026b['filter']?{[_0x3e026b[_0x7413('0x6')][_0x7413('0x7')]]:_0x3e026b[_0x7413('0x6')]['value']}:undefined;return _0x2e6df7[_0x3e026b['model']]['findAll']({'where':_0x32034c,'raw':!![]})[_0x7413('0xc')](function(_0x336c4c){_0x14212d['associatedResources']=_[_0x7413('0xd')](_0x336c4c,function(_0x45bef0){return _0x45bef0['name'];});_0x5a1e62(_0x14212d);})[_0x7413('0xb')](function(_0x50f301){_0xa25d72(_0x50f301);});});}function _0x4b9a5b(_0x26501b,_0x568d1f,_0x195c72){if(!_0x568d1f)return Promise['resolve'](null);return new Promise(function(_0x2036b6,_0x3230d8){return _0x2e6df7[_0x7413('0xe')][_0x7413('0x9')]({'where':{'sectionId':_0x568d1f['id']},'raw':!![]})[_0x7413('0xc')](function(_0x26dafe){if(_0x26501b['field']&&_0x26501b[_0x7413('0x7')]!=='id'){_0x568d1f[_0x7413('0xa')]=_[_0x7413('0xd')](_0x26dafe,function(_0xfe5b8c){return _0xfe5b8c[_0x26501b['field']];});}else{if(_0x195c72===_0x7413('0xf')){_0x568d1f[_0x7413('0xa')]=_[_0x7413('0xd')](_0x26dafe,function(_0x20d3d2){return{'id':_0x20d3d2[_0x7413('0x10')],'type':_0x20d3d2[_0x7413('0x11')]};});}else{_0x568d1f[_0x7413('0xa')]=_[_0x7413('0xd')](_0x26dafe,function(_0x56a06a){return _0x56a06a['resourceId'];});}}_0x2036b6(_0x568d1f);})[_0x7413('0xb')](function(_0x599654){_0x3230d8(_0x599654);});});}function _0x1585ba(_0x372944,_0x3b0c81){var _0x2fc0f4={'parentSections':[]};switch(_0x372944[_0x7413('0x12')]()){case _0x7413('0x13'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x15');break;case _0x7413('0x16'):_0x2fc0f4['childModel']='SquareOdbc';break;case _0x7413('0x17'):_0x2fc0f4['childModel']=_0x7413('0x18');_0x2fc0f4[_0x7413('0x19')]=[{'name':_0x7413('0x1a'),'field':'name','foreignKey':_0x7413('0x1b')}];break;case _0x7413('0x1c'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x1d');break;case _0x7413('0x1e'):_0x2fc0f4[_0x7413('0x14')]='CmContact';_0x2fc0f4[_0x7413('0x19')]=[{'name':'Lists','field':'id','foreignKey':_0x7413('0x1f')}];break;case _0x7413('0x20'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x21');break;case _0x7413('0x22'):_0x2fc0f4[_0x7413('0x14')]='CmCompany';break;case _0x7413('0x23'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x24');break;case _0x7413('0x25'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x26');break;case _0x7413('0x27'):_0x2fc0f4['childModel']=_0x7413('0x28');break;case _0x7413('0x29'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x2a');break;case _0x7413('0x2b'):_0x2fc0f4['childModel']=_0x7413('0x2c');break;case'inboundroutes':case _0x7413('0x2d'):case _0x7413('0x2e'):_0x2fc0f4[_0x7413('0x14')]='VoiceExtension';break;case _0x7413('0x2f'):_0x2fc0f4['childModel']=_0x7413('0x30');break;case _0x7413('0x31'):_0x2fc0f4['childModel']='VoiceMail';break;case _0x7413('0x32'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x33');_0x2fc0f4['parentSections']=[{'name':'Agents','field':_0x7413('0x34'),'foreignKey':'membername','model':'User','filter':{'field':_0x7413('0x35'),'value':['agent']}},{'name':_0x7413('0x36'),'field':_0x7413('0x34'),'foreignKey':_0x7413('0x37'),'model':_0x7413('0x38'),'filter':{'field':_0x7413('0x35'),'value':['telephone']}},{'name':_0x7413('0x39'),'field':_0x7413('0x34'),'foreignKey':_0x7413('0x3a'),'model':_0x7413('0x3b'),'filter':{'field':_0x7413('0x11'),'value':[_0x7413('0x3c')]}},{'name':_0x7413('0x3d'),'field':_0x7413('0x34'),'foreignKey':_0x7413('0x3a'),'model':_0x7413('0x3b'),'filter':{'field':_0x7413('0x11'),'value':[_0x7413('0x3e')]}}];break;case'musiconholds':_0x2fc0f4[_0x7413('0x14')]='VoiceMusicOnHold';break;case'chanspies':_0x2fc0f4['childModel']='VoiceChanSpy';break;case'voiceprefixes':_0x2fc0f4[_0x7413('0x14')]='VoicePrefix';break;case'ivrcampaigns':_0x2fc0f4[_0x7413('0x14')]='Campaign';break;case'mailqueues':_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x3f');break;case _0x7413('0x40'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x41');break;case'mailsubstatuses':_0x2fc0f4[_0x7413('0x14')]='MailSubstatus';break;case _0x7413('0x42'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x43');break;case _0x7413('0x44'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x45');break;case _0x7413('0x46'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x47');break;case _0x7413('0x48'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x49');break;case _0x7413('0x4a'):_0x2fc0f4['childModel']=_0x7413('0x4b');break;case _0x7413('0x4c'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x4d');break;case _0x7413('0x4e'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x4f');break;case _0x7413('0x50'):case _0x7413('0x51'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x3b');if(_0x3b0c81){_0x2fc0f4['parentSections']=[{'name':_0x7413('0x39')},{'name':'QueueCampaigns'}];}break;case _0x7413('0x52'):case _0x7413('0x53'):case _0x7413('0x54'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x38');if(_0x3b0c81){_0x2fc0f4[_0x7413('0x19')]=[{'name':_0x7413('0x55'),'filter':{'field':_0x7413('0x35'),'value':[_0x7413('0x56'),_0x7413('0x57')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x7413('0x58'):_0x2fc0f4['childModel']='ZendeskAccount';break;case _0x7413('0x59'):_0x2fc0f4[_0x7413('0x14')]='SalesforceAccount';break;case _0x7413('0x5a'):_0x2fc0f4['childModel']='FreshdeskAccount';break;case _0x7413('0x5b'):_0x2fc0f4['childModel']=_0x7413('0x5c');break;case _0x7413('0x5d'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x5e');break;case _0x7413('0x5f'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x60');break;case _0x7413('0x61'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x38');break;case'cannedanswers':_0x2fc0f4[_0x7413('0x14')]='CannedAnswer';break;case'dispositions':_0x2fc0f4['childModel']=_0x7413('0x62');break;case _0x7413('0x63'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x64');break;case'intervals':_0x2fc0f4['childModel']=_0x7413('0x65');break;case'pauses':_0x2fc0f4[_0x7413('0x14')]='Pause';break;case'scheduler':_0x2fc0f4['childModel']='Schedule';break;case'sounds':_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x66');break;case _0x7413('0x67'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x68');break;case'templates':_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x69');break;case _0x7413('0x6a'):_0x2fc0f4['childModel']=_0x7413('0x6b');break;case'trunks':_0x2fc0f4['childModel']=_0x7413('0x6c');break;case _0x7413('0x6d'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x6e');break;case _0x7413('0x6f'):_0x2fc0f4[_0x7413('0x14')]='Plugin';break;case _0x7413('0x70'):_0x2fc0f4['childModel']=_0x7413('0xf');_0x2fc0f4['parentSections']=[{'name':_0x7413('0x71'),'field':'id','foreignKey':'reportId'}];break;case _0x7413('0x72'):_0x2fc0f4[_0x7413('0x14')]='AnalyticMetric';break;}return _0x2fc0f4;}function _0x269976(_0x549623,_0xf01452){var _0x2a5db6=_0x549623['charAt'](0x0)[_0x7413('0x73')]()+_0x549623[_0x7413('0x74')](0x1);var _0x59d639={'type':_0x2e6df7[_0x7413('0x75')][_0x7413('0x76')]['SELECT'],'raw':!![]};return new Promise(function(_0xf4641,_0x28eaf4){var _0x34211b=squel[_0x7413('0x77')]()[_0x7413('0x7')](_0x7413('0x78')+_0x2a5db6+_0x7413('0x79'),'id')[_0x7413('0x7')]('ui.createdAt')[_0x7413('0x7a')]('user_has_'+_0x549623+_0x7413('0x7b'),'ui')[_0x7413('0x7c')](_0x7413('0x7d'),_0xf01452['id']);return _0x2e6df7[_0x7413('0x7e')]['query'](_0x34211b['toString'](),_0x59d639)['then'](function(_0x56b090){_0xf01452[_0x2a5db6+'OpenTabs']=_0x56b090;_0xf4641(_0x56b090);})[_0x7413('0xb')](function(_0x1c00e6){_0x28eaf4(_0x1c00e6);});});}return _0x410971[_0x7413('0x7f')]('UserProfile',attributes,{'tableName':_0x7413('0x80'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xb7dd83){var _0x12544d={'raw':_0xb7dd83[_0x7413('0x81')][_0x7413('0x82')],'where':{}};var _0x3db284={};var _0x2f0f0c={'count':0x0,'rows':[]};var _0x295a0a=_0xb7dd83[_0x7413('0x81')][_0x7413('0x83')];var _0x3f9cfd=_0xb7dd83[_0x7413('0x81')][_0x7413('0x84')]||![];var _0x4b381e=_0x1585ba(_0x295a0a,_0x3f9cfd);if(!_0x4b381e[_0x7413('0x14')])throw new Error(_0x7413('0x85')+_0x295a0a+'\x27');var _0x4cab22=[{'name':_0x295a0a}];if(!_[_0x7413('0x86')](_0x4b381e[_0x7413('0x19')]))_0x4cab22=_0x4b381e[_0x7413('0x19')];var _0x5e4aa1=[];for(var _0x102fd2=0x0;_0x102fd2<_0x4cab22[_0x7413('0x87')];_0x102fd2++){_0x5e4aa1['push'](_0x2e6df7[_0x7413('0x88')][_0x7413('0x89')]({'where':{'userProfileId':_0xb7dd83['params']['id'],'name':_0x4cab22[_0x102fd2][_0x7413('0x34')]},'raw':!![]}));}return Promise['all'](_0x5e4aa1)['then'](function(_0xbb819a){var _0xbd74d9=_[_0x7413('0x6')](_0xbb819a,function(_0x3d2f93){return _0x3d2f93?_0x3d2f93:undefined;});var _0x128419=_[_0x7413('0x6')](_0x4cab22,[_0x7413('0x8a'),!![]]);var _0x2f8637=_['isEmpty'](_0xbd74d9)&&_[_0x7413('0x86')](_0x128419)?null:_['union'](_0x128419,_0xbd74d9);if(!_0x2f8637)return null;var _0xd9c741=[];for(var _0x3deb37=0x0;_0x3deb37<_0x2f8637[_0x7413('0x87')];_0x3deb37++){var _0x3054f5=_[_0x7413('0x89')](_0x4cab22,function(_0x29d919){return _0x2f8637[_0x3deb37]?_0x29d919[_0x7413('0x34')]===_0x2f8637[_0x3deb37][_0x7413('0x34')]:null;});if(_0x3054f5){if(_0x2f8637[_0x3deb37][_0x7413('0x8a')]){_0xd9c741['push'](_0x258255(_0x4b381e[_0x7413('0x14')],_0x2f8637[_0x3deb37]));}else{if(!_0x2f8637[_0x3deb37][_0x7413('0x8b')]){_0xd9c741['push'](_0x4b9a5b(_0x3054f5,_0x2f8637[_0x3deb37],_0x4b381e[_0x7413('0x14')]));}else{if(_0x3054f5[_0x7413('0x8c')]){_0xd9c741['push'](_0x737ab4(_0x3054f5,_0x2f8637[_0x3deb37]));}}}}}return Promise[_0x7413('0x8d')](_0xd9c741);})['then'](function(_0xcbc6e){var _0x3d4ce3=_0xcbc6e;var _0x54f03d=null;if(_0x3d4ce3){_0x54f03d=_0x3d4ce3['length']===0x1?_0x3d4ce3[0x0]:null;}if(!_0x54f03d&&!_0x3d4ce3)return _0x2f0f0c;var _0x227a66=_0x2e6df7[_0x4b381e[_0x7413('0x14')]][_0x7413('0x8e')];_0x3db284['model']=_[_0x7413('0x8f')](_0x227a66);_0x3db284[_0x7413('0x81')]=_[_0x7413('0x8f')](_0xb7dd83[_0x7413('0x81')]);_0x3db284[_0x7413('0x90')]=_[_0x7413('0x91')](_0x3db284['model'],_0x3db284[_0x7413('0x81')]);_0x12544d[_0x7413('0x92')]=_[_0x7413('0x91')](_0x3db284['model'],qs[_0x7413('0x93')](_0xb7dd83[_0x7413('0x81')][_0x7413('0x93')]));_0x12544d[_0x7413('0x92')]=_0x12544d[_0x7413('0x92')][_0x7413('0x87')]?_0x12544d[_0x7413('0x92')]:_0x3db284[_0x7413('0x8c')];if(!_0xb7dd83[_0x7413('0x81')]['hasOwnProperty'](_0x7413('0x94'))){_0x12544d[_0x7413('0x95')]=qs[_0x7413('0x95')](_0xb7dd83[_0x7413('0x81')][_0x7413('0x95')]);_0x12544d[_0x7413('0x96')]=qs['offset'](_0xb7dd83[_0x7413('0x81')]['offset']);}_0x12544d['order']=qs[_0x7413('0x97')](_0xb7dd83[_0x7413('0x81')]['sort']);_0x12544d[_0x7413('0x7c')]=qs[_0x7413('0x90')](_[_0x7413('0x98')](_0xb7dd83[_0x7413('0x81')],_0x3db284[_0x7413('0x90')]));if(_0xb7dd83[_0x7413('0x81')][_0x7413('0x6')]){_0x12544d[_0x7413('0x7c')]=_['merge'](_0x12544d[_0x7413('0x7c')],{'$or':_['map'](_0x227a66,function(_0xeaf166){if(_0xeaf166[_0x7413('0x11')]['key']!==_0x7413('0x99')){var _0x1f4ce0={};_0x1f4ce0[_0xeaf166[_0x7413('0x7')]]={'$like':'%'+_0xb7dd83[_0x7413('0x81')][_0x7413('0x6')]+'%'};return _0x1f4ce0;}})});}var _0x3920b5=[];var _0x3dcbfb=null;var _0x12fbb2={};if(_0x54f03d){_0x3dcbfb=_[_0x7413('0x89')](_0x4cab22,[_0x7413('0x34'),_0x54f03d['name']]);if(_0x3dcbfb[_0x7413('0x7')]){_0x12fbb2={};if(_0x4b381e[_0x7413('0x14')]==='AnalyticExtractedReport'){_0x12fbb2[_0x3dcbfb['foreignKey']]=_['map'](_0x54f03d[_0x7413('0xa')],'id');}else{_0x12fbb2[_0x3dcbfb['foreignKey']]=_0x54f03d[_0x7413('0xa')];}_0x3920b5[_0x7413('0x9a')](_0x12fbb2);}else{_0x12544d[_0x7413('0x7c')]['id']=_0x54f03d[_0x7413('0xa')];}}else{for(var _0x470c21=0x0;_0x470c21<_0x3d4ce3[_0x7413('0x87')];_0x470c21++){_0x3dcbfb=_[_0x7413('0x89')](_0x4cab22,[_0x7413('0x34'),_0x3d4ce3[_0x470c21][_0x7413('0x34')]]);if(_0x3dcbfb['field']){_0x12fbb2={};_0x12fbb2[_0x3dcbfb[_0x7413('0x9b')]]=_0x3d4ce3[_0x470c21][_0x7413('0xa')];_0x3920b5[_0x7413('0x9a')](_0x12fbb2);}else{if(!_0x12544d['where']['id'])_0x12544d[_0x7413('0x7c')]['id']=[];_0x3d4ce3[_0x470c21][_0x7413('0xa')][_0x7413('0x9c')](function(_0x432906){_0x12544d[_0x7413('0x7c')]['id'][_0x7413('0x9a')](_0x432906);});}}}if(!_[_0x7413('0x86')](_0x3920b5)){_0x12544d[_0x7413('0x7c')]=_[_0x7413('0x9d')](_0x12544d[_0x7413('0x7c')],{'$and':{'$or':_0x3920b5}});}_0x12544d=_['merge']({},_0x12544d,_0xb7dd83[_0x7413('0x9e')]);if(_0x54f03d&&!_0x54f03d[_0x7413('0x8b')]&&_0x4b381e['childModel']===_0x7413('0xf')){if(_0xb7dd83[_0x7413('0x81')]['includeAll']){_0x12544d[_0x7413('0x9f')]=[{'all':!![]}];}return _0x2e6df7[_0x4b381e[_0x7413('0x14')]][_0x7413('0x9')](_0x12544d)['then'](function(_0x36d8cf){var _0x5a44bd=[];_0x36d8cf[_0x7413('0x9c')](function(_0x35f721){var _0x4537b5;switch(_0x35f721[_0x7413('0xa0')]){case _0x7413('0xa1'):_0x4537b5=_[_0x7413('0x89')](_0x54f03d['associatedResources'],function(_0x4ece1){return _0x4ece1['id']===_0x35f721[_0x7413('0xa2')]&&_0x4ece1[_0x7413('0x11')]===_0x7413('0xa3');});break;case _0x7413('0xa4'):_0x4537b5=_['find'](_0x54f03d[_0x7413('0xa')],function(_0x566ee0){return _0x566ee0['id']===_0x35f721[_0x7413('0xa2')]&&_0x566ee0[_0x7413('0x11')]===_0x7413('0xa5');});break;}if(_0x4537b5)_0x5a44bd['push'](_0x35f721);});_0x2f0f0c['count']=_0x5a44bd[_0x7413('0x87')];_0x2f0f0c[_0x7413('0xa6')]=_0x5a44bd;return _0x2f0f0c;});}else{if(!_[_0x7413('0x86')](_0xb7dd83[_0x7413('0x81')]['ids'])){_0x12544d['where']['id']=_0x12544d[_0x7413('0x7c')]['id']?_[_0x7413('0x91')](_0x12544d[_0x7413('0x7c')]['id'],_0xb7dd83['query']['ids']):_0xb7dd83[_0x7413('0x81')][_0x7413('0xa7')];}return _0x2e6df7[_0x4b381e[_0x7413('0x14')]][_0x7413('0xa8')]({'where':_0x12544d[_0x7413('0x7c')]})[_0x7413('0xc')](function(_0x5fd045){_0x2f0f0c['count']=_0x5fd045;if(_0xb7dd83['query'][_0x7413('0xa9')]){if(_0x4b381e[_0x7413('0x14')]==='CmContact'){_0x12544d[_0x7413('0x9f')]=[{'model':_0x2e6df7[_0x7413('0x68')],'as':_0x7413('0xaa'),'attributes':['id',_0x7413('0x34'),_0x7413('0xab')],'required':_0xb7dd83[_0x7413('0x81')][_0x7413('0xac')]?!![]:![]},{'model':_0x2e6df7[_0x7413('0x68')],'as':_0x7413('0xad'),'attributes':['id','name',_0x7413('0xab')],'through':_0xb7dd83[_0x7413('0x81')][_0x7413('0xac')]?{'attributes':[],'where':{'TagId':_0xb7dd83[_0x7413('0x81')][_0x7413('0xac')]||undefined}}:{},'required':_0xb7dd83[_0x7413('0x81')]['tag']?!![]:![]}];}else{_0x12544d['include']=[{'all':!![]}];}}return _0x2e6df7[_0x4b381e['childModel']][_0x7413('0x9')](_0x12544d);})[_0x7413('0xc')](function(_0x999109){_0x2f0f0c[_0x7413('0xa6')]=_0x999109;if(_0x295a0a===_0x7413('0xae')&&_0xb7dd83[_0x7413('0x81')][_0x7413('0xaf')]===_0x7413('0xb0')){var _0x4e872e=[];for(var _0x11f5a3=0x0;_0x11f5a3<_0x2f0f0c['rows'][_0x7413('0x87')];_0x11f5a3++){_0x4e872e[_0x7413('0x9a')](_0x269976(_0x7413('0xb1'),_0x2f0f0c[_0x7413('0xa6')][_0x11f5a3][_0x7413('0xb2')]));_0x4e872e['push'](_0x269976(_0x7413('0xb3'),_0x2f0f0c[_0x7413('0xa6')][_0x11f5a3][_0x7413('0xb2')]));_0x4e872e[_0x7413('0x9a')](_0x269976(_0x7413('0xb4'),_0x2f0f0c[_0x7413('0xa6')][_0x11f5a3][_0x7413('0xb2')]));_0x4e872e[_0x7413('0x9a')](_0x269976(_0x7413('0xb5'),_0x2f0f0c[_0x7413('0xa6')][_0x11f5a3][_0x7413('0xb2')]));_0x4e872e[_0x7413('0x9a')](_0x269976(_0x7413('0xb6'),_0x2f0f0c[_0x7413('0xa6')][_0x11f5a3][_0x7413('0xb2')]));_0x4e872e['push'](_0x269976('whatsapp',_0x2f0f0c[_0x7413('0xa6')][_0x11f5a3][_0x7413('0xb2')]));}return Promise['all'](_0x4e872e)[_0x7413('0xc')](function(){return _0x2f0f0c;});}return _0x2f0f0c;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index ac825b5..922c071 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 _0x0d91=['UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4608c2,_0x3ef86d){var _0x29dd0d=function(_0x42e86b){while(--_0x42e86b){_0x4608c2['push'](_0x4608c2['shift']());}};_0x29dd0d(++_0x3ef86d);}(_0x0d91,0x76));var _0x10d9=function(_0x25b7be,_0x2bc7d5){_0x25b7be=_0x25b7be-0x0;var _0x4eaabf=_0x0d91[_0x25b7be];return _0x4eaabf;};'use strict';var _=require(_0x10d9('0x0'));var util=require(_0x10d9('0x1'));var moment=require(_0x10d9('0x2'));var BPromise=require(_0x10d9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x10d9('0x4'));var db=require(_0x10d9('0x5'))['db'];var utils=require(_0x10d9('0x6'));var logger=require('../../config/logger')(_0x10d9('0x7'));var config=require(_0x10d9('0x8'));var jayson=require(_0x10d9('0x9'));var client=jayson['client'][_0x10d9('0xa')]({'port':0x232a});config[_0x10d9('0xb')]=_[_0x10d9('0xc')](config[_0x10d9('0xb')],{'host':_0x10d9('0xd'),'port':0x18eb});var socket=require(_0x10d9('0xe'))(new Redis(config[_0x10d9('0xb')]));require(_0x10d9('0xf'))[_0x10d9('0x10')](socket);function respondWithRpcPromise(_0x1aeeea,_0x698aa4,_0x258ecc){return new BPromise(function(_0x3fe0de,_0x2332c7){return client[_0x10d9('0x11')](_0x1aeeea,_0x258ecc)[_0x10d9('0x12')](function(_0x273a4c){logger['info'](_0x10d9('0x13'),_0x698aa4,_0x10d9('0x14'));logger[_0x10d9('0x15')](_0x10d9('0x16'),_0x698aa4,_0x10d9('0x14'),JSON['stringify'](_0x273a4c));if(_0x273a4c[_0x10d9('0x17')]){if(_0x273a4c['error'][_0x10d9('0x18')]===0x1f4){logger[_0x10d9('0x17')](_0x10d9('0x13'),_0x698aa4,_0x273a4c[_0x10d9('0x17')][_0x10d9('0x19')]);return _0x2332c7(_0x273a4c[_0x10d9('0x17')][_0x10d9('0x19')]);}logger[_0x10d9('0x17')](_0x10d9('0x13'),_0x698aa4,_0x273a4c[_0x10d9('0x17')]['message']);return _0x3fe0de(_0x273a4c['error'][_0x10d9('0x19')]);}else{logger[_0x10d9('0x1a')](_0x10d9('0x13'),_0x698aa4,_0x10d9('0x14'));_0x3fe0de(_0x273a4c['result'][_0x10d9('0x19')]);}})[_0x10d9('0x1b')](function(_0x1cff55){logger[_0x10d9('0x17')]('UserProfile,\x20%s,\x20%s',_0x698aa4,_0x1cff55);_0x2332c7(_0x1cff55);});});} \ No newline at end of file +var _0x7d37=['../../mysqldb','../../config/logger','rpc','jayson/promise','http','defaults','redis','./userProfile.socket','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x34cb95,_0x12f8c0){var _0x218a27=function(_0x46906a){while(--_0x46906a){_0x34cb95['push'](_0x34cb95['shift']());}};_0x218a27(++_0x12f8c0);}(_0x7d37,0x1db));var _0x77d3=function(_0x361b57,_0x17437b){_0x361b57=_0x361b57-0x0;var _0x7cc70a=_0x7d37[_0x361b57];return _0x7cc70a;};'use strict';var _=require(_0x77d3('0x0'));var util=require(_0x77d3('0x1'));var moment=require(_0x77d3('0x2'));var BPromise=require('bluebird');var rs=require(_0x77d3('0x3'));var fs=require('fs');var Redis=require(_0x77d3('0x4'));var db=require(_0x77d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x77d3('0x6'))(_0x77d3('0x7'));var config=require('../../config/environment');var jayson=require(_0x77d3('0x8'));var client=jayson['client'][_0x77d3('0x9')]({'port':0x232a});config['redis']=_[_0x77d3('0xa')](config[_0x77d3('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x77d3('0xb')]));require(_0x77d3('0xc'))['register'](socket);function respondWithRpcPromise(_0x238791,_0x5e8c4d,_0x10f92e){return new BPromise(function(_0x57c75c,_0x1afabc){return client['request'](_0x238791,_0x10f92e)[_0x77d3('0xd')](function(_0x295d24){logger[_0x77d3('0xe')](_0x77d3('0xf'),_0x5e8c4d,_0x77d3('0x10'));logger[_0x77d3('0x11')](_0x77d3('0x12'),_0x5e8c4d,_0x77d3('0x10'),JSON[_0x77d3('0x13')](_0x295d24));if(_0x295d24['error']){if(_0x295d24[_0x77d3('0x14')]['code']===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x5e8c4d,_0x295d24[_0x77d3('0x14')][_0x77d3('0x15')]);return _0x1afabc(_0x295d24[_0x77d3('0x14')][_0x77d3('0x15')]);}logger[_0x77d3('0x14')]('UserProfile,\x20%s,\x20%s',_0x5e8c4d,_0x295d24[_0x77d3('0x14')][_0x77d3('0x15')]);return _0x57c75c(_0x295d24['error']['message']);}else{logger[_0x77d3('0xe')](_0x77d3('0xf'),_0x5e8c4d,_0x77d3('0x10'));_0x57c75c(_0x295d24[_0x77d3('0x16')][_0x77d3('0x15')]);}})[_0x77d3('0x17')](function(_0x12fb05){logger[_0x77d3('0x14')](_0x77d3('0xf'),_0x5e8c4d,_0x12fb05);_0x1afabc(_0x12fb05);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 0abdd94..1e3c415 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 _0x05c0=['emit','register','length','userProfile:','./userProfile.events','save','remove','update'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x05c0,0x1dc));var _0x005c=function(_0x5ee267,_0x3a0c72){_0x5ee267=_0x5ee267-0x0;var _0x178eb1=_0x05c0[_0x5ee267];return _0x178eb1;};'use strict';var UserProfileEvents=require(_0x005c('0x0'));var events=[_0x005c('0x1'),_0x005c('0x2'),_0x005c('0x3')];function createListener(_0x443a3a,_0x44458c){return function(_0x51c263){_0x44458c[_0x005c('0x4')](_0x443a3a,_0x51c263);};}function removeListener(_0x267875,_0x4f49f3){return function(){UserProfileEvents['removeListener'](_0x267875,_0x4f49f3);};}exports[_0x005c('0x5')]=function(_0x398577){for(var _0x15b5c4=0x0,_0x3a859c=events[_0x005c('0x6')];_0x15b5c4<_0x3a859c;_0x15b5c4++){var _0x23593d=events[_0x15b5c4];var _0x369f20=createListener(_0x005c('0x7')+_0x23593d,_0x398577);UserProfileEvents['on'](_0x23593d,_0x369f20);}}; \ No newline at end of file +var _0xc9b4=['save','remove','update','removeListener','register','length','userProfile:'];(function(_0x1be1fd,_0x203a72){var _0x2e4d20=function(_0x30e256){while(--_0x30e256){_0x1be1fd['push'](_0x1be1fd['shift']());}};_0x2e4d20(++_0x203a72);}(_0xc9b4,0x10a));var _0x4c9b=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0xc9b4[_0x4a5494];return _0x57cbb5;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x4c9b('0x0'),_0x4c9b('0x1'),_0x4c9b('0x2')];function createListener(_0x553d5c,_0x306696){return function(_0x7d6e44){_0x306696['emit'](_0x553d5c,_0x7d6e44);};}function removeListener(_0x2a357a,_0x55b260){return function(){UserProfileEvents[_0x4c9b('0x3')](_0x2a357a,_0x55b260);};}exports[_0x4c9b('0x4')]=function(_0x43e218){for(var _0x4c6143=0x0,_0x1d76cc=events[_0x4c9b('0x5')];_0x4c6143<_0x1d76cc;_0x4c6143++){var _0x204a4e=events[_0x4c6143];var _0x397e61=createListener(_0x4c9b('0x6')+_0x204a4e,_0x43e218);UserProfileEvents['on'](_0x204a4e,_0x397e61);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index d107d1e..59c645e 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 _0x6614=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x24bcc4,_0x226525){var _0x2e6411=function(_0x541b84){while(--_0x541b84){_0x24bcc4['push'](_0x24bcc4['shift']());}};_0x2e6411(++_0x226525);}(_0x6614,0x179));var _0x4661=function(_0x499044,_0x1b0dd0){_0x499044=_0x499044-0x0;var _0x1d004b=_0x6614[_0x499044];return _0x1d004b;};'use strict';var multer=require(_0x4661('0x0'));var util=require('util');var path=require(_0x4661('0x1'));var timeout=require(_0x4661('0x2'));var express=require(_0x4661('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4661('0x4'));var interaction=require(_0x4661('0x5'));var config=require(_0x4661('0x6'));var controller=require(_0x4661('0x7'));router[_0x4661('0x8')]('/',auth[_0x4661('0x9')](),controller[_0x4661('0xa')]);router[_0x4661('0x8')](_0x4661('0xb'),auth[_0x4661('0x9')](),controller[_0x4661('0xc')]);router[_0x4661('0x8')](_0x4661('0xd'),auth['isAuthenticated'](),controller[_0x4661('0xe')]);router['post']('/',auth[_0x4661('0x9')](),controller[_0x4661('0xf')]);router['put'](_0x4661('0xd'),auth[_0x4661('0x9')](),controller[_0x4661('0x10')]);router[_0x4661('0x11')](_0x4661('0xd'),auth['isAuthenticated'](),controller[_0x4661('0x12')]);module[_0x4661('0x13')]=router; \ No newline at end of file +var _0x5a13=['../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','/describe','describe','show','post','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x213cbb,_0x487561){var _0x162e7e=function(_0x55fa16){while(--_0x55fa16){_0x213cbb['push'](_0x213cbb['shift']());}};_0x162e7e(++_0x487561);}(_0x5a13,0x1f3));var _0x35a1=function(_0x441a81,_0x4cdbe0){_0x441a81=_0x441a81-0x0;var _0x1865e5=_0x5a13[_0x441a81];return _0x1865e5;};'use strict';var multer=require(_0x35a1('0x0'));var util=require(_0x35a1('0x1'));var path=require('path');var timeout=require(_0x35a1('0x2'));var express=require('express');var router=express[_0x35a1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x35a1('0x4'));var interaction=require(_0x35a1('0x5'));var config=require(_0x35a1('0x6'));var controller=require(_0x35a1('0x7'));router['get']('/',auth[_0x35a1('0x8')](),controller[_0x35a1('0x9')]);router[_0x35a1('0xa')](_0x35a1('0xb'),auth[_0x35a1('0x8')](),controller[_0x35a1('0xc')]);router[_0x35a1('0xa')]('/:id',auth[_0x35a1('0x8')](),controller[_0x35a1('0xd')]);router[_0x35a1('0xe')]('/',auth[_0x35a1('0x8')](),controller['create']);router[_0x35a1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x35a1('0x10')]);router[_0x35a1('0x11')](_0x35a1('0x12'),auth[_0x35a1('0x8')](),controller[_0x35a1('0x13')]);module[_0x35a1('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index cbb1acb..80dd25d 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 _0x3b35=['STRING','INTEGER','sequelize','exports'];(function(_0x1a7921,_0xae24d9){var _0x1bc8c3=function(_0xaa8751){while(--_0xaa8751){_0x1a7921['push'](_0x1a7921['shift']());}};_0x1bc8c3(++_0xae24d9);}(_0x3b35,0xfa));var _0x53b3=function(_0x700360,_0x92f4dc){_0x700360=_0x700360-0x0;var _0x3e90b2=_0x3b35[_0x700360];return _0x3e90b2;};'use strict';var Sequelize=require(_0x53b3('0x0'));module[_0x53b3('0x1')]={'name':{'type':Sequelize[_0x53b3('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x53b3('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x53b3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7f62=['INTEGER','exports','STRING'];(function(_0x5e28c2,_0x1e48ab){var _0x1a8cc6=function(_0x1218bf){while(--_0x1218bf){_0x5e28c2['push'](_0x5e28c2['shift']());}};_0x1a8cc6(++_0x1e48ab);}(_0x7f62,0x115));var _0x27f6=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7f62[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require('sequelize');module[_0x27f6('0x0')]={'name':{'type':Sequelize[_0x27f6('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x27f6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x27f6('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 0063245..807259c 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 _0xc2c7=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x43397b,_0x4242c0){var _0x561487=function(_0x4785f2){while(--_0x4785f2){_0x43397b['push'](_0x43397b['shift']());}};_0x561487(++_0x4242c0);}(_0xc2c7,0x134));var _0x7c2c=function(_0x2921fb,_0x4ce7ff){_0x2921fb=_0x2921fb-0x0;var _0x1d35a8=_0xc2c7[_0x2921fb];return _0x1d35a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['UserProfileResource'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['UserProfileResource'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['create']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['create'](_0xeb067b['body'],{})[_0x7c2c('0x26')](respondWithResult(_0x3091bd,0xc9))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x2b79d5,_0x5f3de8){if(_0x2b79d5['body']['id']){delete _0x2b79d5['body']['id'];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x2b79d5[_0x7c2c('0x48')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x5f3de8,null))[_0x7c2c('0x26')](saveUpdates(_0x2b79d5['body'],null))[_0x7c2c('0x26')](respondWithResult(_0x5f3de8,null))[_0x7c2c('0x45')](handleError(_0x5f3de8,null));};exports['destroy']=function(_0x19621a,_0x56e09d){return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x19621a[_0x7c2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e09d,null))['then'](removeEntity(_0x56e09d,null))[_0x7c2c('0x45')](handleError(_0x56e09d,null));};exports['describe']=function(_0x13e0bf,_0x11d337){return db['UserProfileResource'][_0x7c2c('0x49')]()[_0x7c2c('0x26')](respondWithResult(_0x11d337,null))['catch'](handleError(_0x11d337,null));}; \ No newline at end of file +var _0x7096=['Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','UserProfileResource','find','catch','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7096,0x10c));var _0x6709=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x7096[_0x24237f];return _0x48298e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['UserProfileResource'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['UserProfileResource'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['UserProfileResource'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['UserProfileResource']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['UserProfileResource'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));};exports[_0x6709('0x4a')]=function(_0x1015e0,_0x55188c){return db['UserProfileResource'][_0x6709('0x4a')]()['then'](respondWithResult(_0x55188c,null))['catch'](handleError(_0x55188c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 0ded88e..82bdc53 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 _0xaa45=['./userProfileResource.attributes','exports','compositeIndex','resourceId','lodash','api','moment','bluebird','rimraf','../../config/environment'];(function(_0xf55294,_0x3e5e0b){var _0x73cc9e=function(_0x16ab61){while(--_0x16ab61){_0xf55294['push'](_0xf55294['shift']());}};_0x73cc9e(++_0x3e5e0b);}(_0xaa45,0x1c6));var _0x5aa4=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0xaa45[_0x5d4f12];return _0x4eb577;};'use strict';var _=require(_0x5aa4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5aa4('0x1'));var moment=require(_0x5aa4('0x2'));var BPromise=require(_0x5aa4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5aa4('0x4'));var config=require(_0x5aa4('0x5'));var attributes=require(_0x5aa4('0x6'));module[_0x5aa4('0x7')]=function(_0x96017c,_0x2ef01a){return _0x96017c['define']('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x5aa4('0x8'),'fields':[_0x5aa4('0x9'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d75=['util','api','moment','bluebird','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','compositeIndex'];(function(_0x30faee,_0x1c3794){var _0x3a90ab=function(_0x11129b){while(--_0x11129b){_0x30faee['push'](_0x30faee['shift']());}};_0x3a90ab(++_0x1c3794);}(_0x2d75,0xc8));var _0x52d7=function(_0x5d7726,_0x57adac){_0x5d7726=_0x5d7726-0x0;var _0x521e1c=_0x2d75[_0x5d7726];return _0x521e1c;};'use strict';var _=require('lodash');var util=require(_0x52d7('0x0'));var logger=require('../../config/logger')(_0x52d7('0x1'));var moment=require(_0x52d7('0x2'));var BPromise=require(_0x52d7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x52d7('0x4'));var attributes=require(_0x52d7('0x5'));module[_0x52d7('0x6')]=function(_0x31e578,_0x2f9329){return _0x31e578[_0x52d7('0x7')](_0x52d7('0x8'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x52d7('0x9'),'fields':['resourceId','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 7b284cc..61ab305 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 _0x6bdb=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','error','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x6bdb,0xde));var _0xb6bd=function(_0x514c9c,_0x4d7e9e){_0x514c9c=_0x514c9c-0x0;var _0x21e36e=_0x6bdb[_0x514c9c];return _0x21e36e;};'use strict';var _=require(_0xb6bd('0x0'));var util=require(_0xb6bd('0x1'));var moment=require(_0xb6bd('0x2'));var BPromise=require(_0xb6bd('0x3'));var rs=require(_0xb6bd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb6bd('0x5'));var logger=require(_0xb6bd('0x6'))('rpc');var config=require(_0xb6bd('0x7'));var jayson=require(_0xb6bd('0x8'));var client=jayson[_0xb6bd('0x9')][_0xb6bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7b7ca8,_0x5fc18a,_0x338a09){return new BPromise(function(_0x9b8acb,_0x109e9b){return client[_0xb6bd('0xb')](_0x7b7ca8,_0x338a09)[_0xb6bd('0xc')](function(_0x2c772c){logger['info'](_0xb6bd('0xd'),_0x5fc18a,_0xb6bd('0xe'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x5fc18a,_0xb6bd('0xe'),JSON['stringify'](_0x2c772c));if(_0x2c772c[_0xb6bd('0xf')]){if(_0x2c772c[_0xb6bd('0xf')]['code']===0x1f4){logger[_0xb6bd('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x5fc18a,_0x2c772c[_0xb6bd('0xf')][_0xb6bd('0x10')]);return _0x109e9b(_0x2c772c[_0xb6bd('0xf')][_0xb6bd('0x10')]);}logger[_0xb6bd('0xf')](_0xb6bd('0xd'),_0x5fc18a,_0x2c772c['error']['message']);return _0x9b8acb(_0x2c772c['error'][_0xb6bd('0x10')]);}else{logger[_0xb6bd('0x11')](_0xb6bd('0xd'),_0x5fc18a,_0xb6bd('0xe'));_0x9b8acb(_0x2c772c[_0xb6bd('0x12')][_0xb6bd('0x10')]);}})['catch'](function(_0x3c2438){logger[_0xb6bd('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x5fc18a,_0x3c2438);_0x109e9b(_0x3c2438);});});} \ No newline at end of file +var _0x3a35=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5cc036,_0xd8f917){var _0x1c03d3=function(_0x3b35cd){while(--_0x3b35cd){_0x5cc036['push'](_0x5cc036['shift']());}};_0x1c03d3(++_0xd8f917);}(_0x3a35,0x1ce));var _0x53a3=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x3a35[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0x53a3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x53a3('0x1'));var rs=require(_0x53a3('0x2'));var fs=require('fs');var Redis=require(_0x53a3('0x3'));var db=require(_0x53a3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x53a3('0x5'))(_0x53a3('0x6'));var config=require('../../config/environment');var jayson=require(_0x53a3('0x7'));var client=jayson[_0x53a3('0x8')][_0x53a3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ba5ad,_0x4c816b,_0x146d94){return new BPromise(function(_0x3809fd,_0x5495ea){return client['request'](_0x4ba5ad,_0x146d94)[_0x53a3('0xa')](function(_0x3200ee){logger[_0x53a3('0xb')](_0x53a3('0xc'),_0x4c816b,_0x53a3('0xd'));logger[_0x53a3('0xe')](_0x53a3('0xf'),_0x4c816b,_0x53a3('0xd'),JSON[_0x53a3('0x10')](_0x3200ee));if(_0x3200ee[_0x53a3('0x11')]){if(_0x3200ee['error'][_0x53a3('0x12')]===0x1f4){logger[_0x53a3('0x11')](_0x53a3('0xc'),_0x4c816b,_0x3200ee[_0x53a3('0x11')]['message']);return _0x5495ea(_0x3200ee[_0x53a3('0x11')][_0x53a3('0x13')]);}logger[_0x53a3('0x11')](_0x53a3('0xc'),_0x4c816b,_0x3200ee[_0x53a3('0x11')]['message']);return _0x3809fd(_0x3200ee[_0x53a3('0x11')][_0x53a3('0x13')]);}else{logger[_0x53a3('0xb')](_0x53a3('0xc'),_0x4c816b,_0x53a3('0xd'));_0x3809fd(_0x3200ee[_0x53a3('0x14')][_0x53a3('0x13')]);}})[_0x53a3('0x15')](function(_0x255607){logger[_0x53a3('0x11')](_0x53a3('0xc'),_0x4c816b,_0x255607);_0x5495ea(_0x255607);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 4612d70..02bb50c 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 _0xc57b=['multer','path','express','Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update'];(function(_0x2bfd41,_0x1d50d9){var _0x34032e=function(_0x516652){while(--_0x516652){_0x2bfd41['push'](_0x2bfd41['shift']());}};_0x34032e(++_0x1d50d9);}(_0xc57b,0x198));var _0xbc57=function(_0x52e9f3,_0x2fb8d5){_0x52e9f3=_0x52e9f3-0x0;var _0x5818e3=_0xc57b[_0x52e9f3];return _0x5818e3;};'use strict';var multer=require(_0xbc57('0x0'));var util=require('util');var path=require(_0xbc57('0x1'));var timeout=require('connect-timeout');var express=require(_0xbc57('0x2'));var router=express[_0xbc57('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbc57('0x4'));var config=require(_0xbc57('0x5'));var controller=require(_0xbc57('0x6'));router[_0xbc57('0x7')]('/',auth[_0xbc57('0x8')](),controller[_0xbc57('0x9')]);router[_0xbc57('0x7')](_0xbc57('0xa'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbc57('0x8')](),controller[_0xbc57('0xb')]);router[_0xbc57('0xc')]('/',auth[_0xbc57('0x8')](),controller[_0xbc57('0xd')]);router[_0xbc57('0xe')](_0xbc57('0xf'),auth[_0xbc57('0x8')](),controller[_0xbc57('0x10')]);router['delete']('/:id',auth[_0xbc57('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb26b=['index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated'];(function(_0x5894fd,_0x46433d){var _0x56b37b=function(_0x1992c5){while(--_0x1992c5){_0x5894fd['push'](_0x5894fd['shift']());}};_0x56b37b(++_0x46433d);}(_0xb26b,0xd3));var _0xbb26=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb26b[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xbb26('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbb26('0x1'));var router=express[_0xbb26('0x2')]();var fs_extra=require(_0xbb26('0x3'));var auth=require(_0xbb26('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbb26('0x5'));var controller=require(_0xbb26('0x6'));router[_0xbb26('0x7')]('/',auth[_0xbb26('0x8')](),controller[_0xbb26('0x9')]);router['get'](_0xbb26('0xa'),auth[_0xbb26('0x8')](),controller[_0xbb26('0xb')]);router[_0xbb26('0x7')](_0xbb26('0xc'),auth[_0xbb26('0x8')](),controller[_0xbb26('0xd')]);router[_0xbb26('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbb26('0xf')]('/:id',auth[_0xbb26('0x8')](),controller[_0xbb26('0x10')]);router[_0xbb26('0x11')](_0xbb26('0xc'),auth[_0xbb26('0x8')](),controller[_0xbb26('0x12')]);module[_0xbb26('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index a9dbcbc..b1b39b9 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 _0x1c7c=['setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','BOOLEAN'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0x1c7c,0x164));var _0xc1c7=function(_0x19a6b4,_0x4723bd){_0x19a6b4=_0x19a6b4-0x0;var _0x76ceb5=_0x1c7c[_0x19a6b4];return _0x76ceb5;};'use strict';var Sequelize=require(_0xc1c7('0x0'));module[_0xc1c7('0x1')]={'name':{'type':Sequelize[_0xc1c7('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xc1c7('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xc1c7('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xc1c7('0x2')],'set':function(_0x20dad3){this[_0xc1c7('0x4')](_0xc1c7('0x5'),_0x20dad3?_0x20dad3[_0xc1c7('0x6')](''):[]);},'get':function(){return this[_0xc1c7('0x7')](_0xc1c7('0x5'))?this[_0xc1c7('0x7')](_0xc1c7('0x5'))[_0xc1c7('0x8')](''):[];}}}; \ No newline at end of file +var _0x1c9a=['sequelize','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','split'];(function(_0x1f0225,_0x188cb){var _0x54116e=function(_0x5a465d){while(--_0x5a465d){_0x1f0225['push'](_0x1f0225['shift']());}};_0x54116e(++_0x188cb);}(_0x1c9a,0x98));var _0xa1c9=function(_0xc37f0,_0x124ad4){_0xc37f0=_0xc37f0-0x0;var _0x59e34c=_0x1c9a[_0xc37f0];return _0x59e34c;};'use strict';var Sequelize=require(_0xa1c9('0x0'));module['exports']={'name':{'type':Sequelize[_0xa1c9('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xa1c9('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xa1c9('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xa1c9('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x21c0fc){this[_0xa1c9('0x4')](_0xa1c9('0x5'),_0x21c0fc?_0x21c0fc[_0xa1c9('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xa1c9('0x5'))?this['getDataValue'](_0xa1c9('0x5'))[_0xa1c9('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index a3014a7..49fb4e6 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 _0x2e9f=['papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','sendStatus','error','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','sort','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','length','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring'];(function(_0x388c02,_0x5d682f){var _0x31a736=function(_0x52ecb3){while(--_0x52ecb3){_0x388c02['push'](_0x388c02['shift']());}};_0x31a736(++_0x5d682f);}(_0x2e9f,0x19a));var _0xf2e9=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x2e9f[_0x5d2803];return _0xdcad2c;};'use strict';var emlformat=require(_0xf2e9('0x0'));var rimraf=require(_0xf2e9('0x1'));var zipdir=require(_0xf2e9('0x2'));var jsonpatch=require(_0xf2e9('0x3'));var rp=require('request-promise');var moment=require(_0xf2e9('0x4'));var BPromise=require(_0xf2e9('0x5'));var Mustache=require(_0xf2e9('0x6'));var util=require(_0xf2e9('0x7'));var path=require(_0xf2e9('0x8'));var sox=require(_0xf2e9('0x9'));var csv=require('to-csv');var ejs=require(_0xf2e9('0xa'));var fs=require('fs');var fs_extra=require(_0xf2e9('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf2e9('0xc'));var deskjs=require(_0xf2e9('0xd'));var toCsv=require(_0xf2e9('0xe'));var querystring=require(_0xf2e9('0xf'));var Papa=require(_0xf2e9('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf2e9('0x11'));var as=require(_0xf2e9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf2e9('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf2e9('0x14'));var db=require(_0xf2e9('0x15'))['db'];function respondWithStatusCode(_0x728668,_0x2c2000){_0x2c2000=_0x2c2000||0xcc;return function(_0x1bd66e){if(_0x1bd66e){return _0x728668['sendStatus'](_0x2c2000);}return _0x728668[_0xf2e9('0x16')](_0x2c2000)[_0xf2e9('0x17')]();};}function respondWithResult(_0x4d2719,_0x32f238){_0x32f238=_0x32f238||0xc8;return function(_0x2b2187){if(_0x2b2187){return _0x4d2719[_0xf2e9('0x16')](_0x32f238)['json'](_0x2b2187);}};}function respondWithFilteredResult(_0x10adf9,_0x5c1b1a){return function(_0x297926){if(_0x297926){var _0x1c461b=typeof _0x5c1b1a[_0xf2e9('0x18')]===_0xf2e9('0x19')&&typeof _0x5c1b1a[_0xf2e9('0x1a')]===_0xf2e9('0x19');var _0x2e3795=_0x297926[_0xf2e9('0x1b')];var _0x588cbc=_0x1c461b?0x0:_0x5c1b1a[_0xf2e9('0x18')];var _0x14691f=_0x1c461b?_0x297926[_0xf2e9('0x1b')]:_0x5c1b1a['offset']+_0x5c1b1a['limit'];var _0x20bfbf;if(_0x14691f>=_0x2e3795){_0x14691f=_0x2e3795;_0x20bfbf=0xc8;}else{_0x20bfbf=0xce;}_0x10adf9[_0xf2e9('0x16')](_0x20bfbf);return _0x10adf9[_0xf2e9('0x1c')](_0xf2e9('0x1d'),_0x588cbc+'-'+_0x14691f+'/'+_0x2e3795)[_0xf2e9('0x1e')](_0x297926);}return null;};}function patchUpdates(_0x3633f7){return function(_0xe13665){try{jsonpatch['apply'](_0xe13665,_0x3633f7,!![]);}catch(_0x3a3914){return BPromise[_0xf2e9('0x1f')](_0x3a3914);}return _0xe13665[_0xf2e9('0x20')]();};}function saveUpdates(_0x329466,_0x31b31e){return function(_0x56ae37){if(_0x56ae37){return _0x56ae37['update'](_0x329466)[_0xf2e9('0x21')](function(_0x27a095){return _0x27a095;});}return null;};}function removeEntity(_0x442c34,_0x4239ce){return function(_0x1d637f){if(_0x1d637f){return _0x1d637f[_0xf2e9('0x22')]()[_0xf2e9('0x21')](function(){_0x442c34['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x294437,_0x450817){return function(_0x1ff0f1){if(!_0x1ff0f1){_0x294437[_0xf2e9('0x23')](0x194);}return _0x1ff0f1;};}function handleError(_0x217b89,_0x3774d6){_0x3774d6=_0x3774d6||0x1f4;return function(_0x6acfd6){logger[_0xf2e9('0x24')](_0x6acfd6[_0xf2e9('0x25')]);if(_0x6acfd6['name']){delete _0x6acfd6[_0xf2e9('0x26')];}_0x217b89['status'](_0x3774d6)[_0xf2e9('0x27')](_0x6acfd6);};}exports['index']=function(_0x5de196,_0x115a94){var _0x55da74={},_0x1505cd={},_0x17bfd={'count':0x0,'rows':[]};var _0x41175e=_[_0xf2e9('0x28')](db[_0xf2e9('0x29')][_0xf2e9('0x2a')],function(_0x54b1c2){return{'name':_0x54b1c2[_0xf2e9('0x2b')],'type':_0x54b1c2[_0xf2e9('0x2c')][_0xf2e9('0x2d')]};});_0x1505cd[_0xf2e9('0x2e')]=_['map'](_0x41175e,_0xf2e9('0x26'));_0x1505cd[_0xf2e9('0x2f')]=_[_0xf2e9('0x30')](_0x5de196[_0xf2e9('0x2f')]);_0x1505cd[_0xf2e9('0x31')]=_[_0xf2e9('0x32')](_0x1505cd[_0xf2e9('0x2e')],_0x1505cd[_0xf2e9('0x2f')]);_0x55da74[_0xf2e9('0x33')]=_['intersection'](_0x1505cd[_0xf2e9('0x2e')],qs[_0xf2e9('0x34')](_0x5de196['query']['fields']));_0x55da74[_0xf2e9('0x33')]=_0x55da74[_0xf2e9('0x33')]['length']?_0x55da74[_0xf2e9('0x33')]:_0x1505cd[_0xf2e9('0x2e')];if(!_0x5de196['query']['hasOwnProperty']('nolimit')){_0x55da74[_0xf2e9('0x1a')]=qs[_0xf2e9('0x1a')](_0x5de196[_0xf2e9('0x2f')][_0xf2e9('0x1a')]);_0x55da74[_0xf2e9('0x18')]=qs[_0xf2e9('0x18')](_0x5de196[_0xf2e9('0x2f')][_0xf2e9('0x18')]);}_0x55da74['order']=qs[_0xf2e9('0x35')](_0x5de196[_0xf2e9('0x2f')][_0xf2e9('0x35')]);_0x55da74['where']=qs['filters'](_['pick'](_0x5de196['query'],_0x1505cd[_0xf2e9('0x31')]),_0x41175e);if(_0x5de196[_0xf2e9('0x2f')][_0xf2e9('0x36')]){_0x55da74['where']=_[_0xf2e9('0x37')](_0x55da74['where'],{'$or':_[_0xf2e9('0x28')](_0x41175e,function(_0x3f83a9){if(_0x3f83a9[_0xf2e9('0x2c')]!==_0xf2e9('0x38')){var _0x325525={};_0x325525[_0x3f83a9[_0xf2e9('0x26')]]={'$like':'%'+_0x5de196[_0xf2e9('0x2f')][_0xf2e9('0x36')]+'%'};return _0x325525;}})});}_0x55da74=_[_0xf2e9('0x37')]({},_0x55da74,_0x5de196[_0xf2e9('0x39')]);var _0x39f6ff={'where':_0x55da74[_0xf2e9('0x3a')]};return db[_0xf2e9('0x29')][_0xf2e9('0x1b')](_0x39f6ff)[_0xf2e9('0x21')](function(_0x3f62e6){_0x17bfd[_0xf2e9('0x1b')]=_0x3f62e6;if(_0x5de196[_0xf2e9('0x2f')][_0xf2e9('0x3b')]){_0x55da74[_0xf2e9('0x3c')]=[{'all':!![]}];}return db[_0xf2e9('0x29')][_0xf2e9('0x3d')](_0x55da74);})[_0xf2e9('0x21')](function(_0x51f31e){_0x17bfd[_0xf2e9('0x3e')]=_0x51f31e;return _0x17bfd;})[_0xf2e9('0x21')](respondWithFilteredResult(_0x115a94,_0x55da74))[_0xf2e9('0x3f')](handleError(_0x115a94,null));};exports[_0xf2e9('0x40')]=function(_0x343605,_0x25c8d7){var _0x21764c={'raw':![],'where':{'id':_0x343605['params']['id']}},_0x47b0a7={};_0x47b0a7['model']=_[_0xf2e9('0x30')](db[_0xf2e9('0x29')][_0xf2e9('0x2a')]);_0x47b0a7[_0xf2e9('0x2f')]=_[_0xf2e9('0x30')](_0x343605[_0xf2e9('0x2f')]);_0x47b0a7[_0xf2e9('0x31')]=_[_0xf2e9('0x32')](_0x47b0a7[_0xf2e9('0x2e')],_0x47b0a7['query']);_0x21764c[_0xf2e9('0x33')]=_[_0xf2e9('0x32')](_0x47b0a7[_0xf2e9('0x2e')],qs[_0xf2e9('0x34')](_0x343605['query'][_0xf2e9('0x34')]));_0x21764c['attributes']=_0x21764c[_0xf2e9('0x33')][_0xf2e9('0x41')]?_0x21764c['attributes']:_0x47b0a7[_0xf2e9('0x2e')];if(_0x343605[_0xf2e9('0x2f')]['includeAll']){_0x21764c['include']=[{'all':!![]}];}_0x21764c=_[_0xf2e9('0x37')]({},_0x21764c,_0x343605[_0xf2e9('0x39')]);return db[_0xf2e9('0x29')]['find'](_0x21764c)[_0xf2e9('0x21')](handleEntityNotFound(_0x25c8d7,null))[_0xf2e9('0x21')](respondWithResult(_0x25c8d7,null))[_0xf2e9('0x3f')](handleError(_0x25c8d7,null));};exports[_0xf2e9('0x42')]=function(_0x25aa3b,_0x17cbb5){return db[_0xf2e9('0x29')]['create'](_0x25aa3b[_0xf2e9('0x43')],{})[_0xf2e9('0x21')](respondWithResult(_0x17cbb5,0xc9))['catch'](handleError(_0x17cbb5,null));};exports['update']=function(_0x1e6400,_0x517fd0){if(_0x1e6400[_0xf2e9('0x43')]['id']){delete _0x1e6400[_0xf2e9('0x43')]['id'];}return db['UserProfileSection'][_0xf2e9('0x44')]({'where':{'id':_0x1e6400['params']['id']}})[_0xf2e9('0x21')](handleEntityNotFound(_0x517fd0,null))[_0xf2e9('0x21')](saveUpdates(_0x1e6400[_0xf2e9('0x43')],null))[_0xf2e9('0x21')](respondWithResult(_0x517fd0,null))[_0xf2e9('0x3f')](handleError(_0x517fd0,null));};exports[_0xf2e9('0x22')]=function(_0x20d5ce,_0x613734){return db['UserProfileSection'][_0xf2e9('0x44')]({'where':{'id':_0x20d5ce[_0xf2e9('0x45')]['id']}})['then'](handleEntityNotFound(_0x613734,null))[_0xf2e9('0x21')](removeEntity(_0x613734,null))[_0xf2e9('0x3f')](handleError(_0x613734,null));};exports[_0xf2e9('0x46')]=function(_0x1b3296,_0x232e38){return db[_0xf2e9('0x29')][_0xf2e9('0x46')]()[_0xf2e9('0x21')](respondWithResult(_0x232e38,null))['catch'](handleError(_0x232e38,null));}; \ No newline at end of file +var _0x2793=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','undefined','count','limit','set','reject','save','then','destroy','error','stack','name','send','UserProfileSection','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','offset','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','params','rawAttributes','options','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','querystring'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x2793,0x1a1));var _0x3279=function(_0x21fc0a,_0x1c3a72){_0x21fc0a=_0x21fc0a-0x0;var _0x485574=_0x2793[_0x21fc0a];return _0x485574;};'use strict';var emlformat=require(_0x3279('0x0'));var rimraf=require(_0x3279('0x1'));var zipdir=require(_0x3279('0x2'));var jsonpatch=require(_0x3279('0x3'));var rp=require(_0x3279('0x4'));var moment=require(_0x3279('0x5'));var BPromise=require(_0x3279('0x6'));var Mustache=require(_0x3279('0x7'));var util=require('util');var path=require(_0x3279('0x8'));var sox=require('sox');var csv=require(_0x3279('0x9'));var ejs=require(_0x3279('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3279('0xb'));var squel=require(_0x3279('0xc'));var crypto=require(_0x3279('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3279('0x9'));var querystring=require(_0x3279('0xe'));var Papa=require(_0x3279('0xf'));var Redis=require(_0x3279('0x10'));var authService=require(_0x3279('0x11'));var qs=require(_0x3279('0x12'));var as=require(_0x3279('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3279('0x14'))(_0x3279('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3279('0x16'))['db'];function respondWithStatusCode(_0x47f760,_0x137da6){_0x137da6=_0x137da6||0xcc;return function(_0x6480c1){if(_0x6480c1){return _0x47f760[_0x3279('0x17')](_0x137da6);}return _0x47f760[_0x3279('0x18')](_0x137da6)[_0x3279('0x19')]();};}function respondWithResult(_0x450843,_0x413485){_0x413485=_0x413485||0xc8;return function(_0x3b4d70){if(_0x3b4d70){return _0x450843['status'](_0x413485)[_0x3279('0x1a')](_0x3b4d70);}};}function respondWithFilteredResult(_0x10d10e,_0x35a89d){return function(_0x465651){if(_0x465651){var _0x5f2cf9=typeof _0x35a89d['offset']==='undefined'&&typeof _0x35a89d['limit']===_0x3279('0x1b');var _0x5dfe2f=_0x465651[_0x3279('0x1c')];var _0x45a554=_0x5f2cf9?0x0:_0x35a89d['offset'];var _0x28ffef=_0x5f2cf9?_0x465651['count']:_0x35a89d['offset']+_0x35a89d[_0x3279('0x1d')];var _0xe1c42c;if(_0x28ffef>=_0x5dfe2f){_0x28ffef=_0x5dfe2f;_0xe1c42c=0xc8;}else{_0xe1c42c=0xce;}_0x10d10e[_0x3279('0x18')](_0xe1c42c);return _0x10d10e[_0x3279('0x1e')]('Content-Range',_0x45a554+'-'+_0x28ffef+'/'+_0x5dfe2f)[_0x3279('0x1a')](_0x465651);}return null;};}function patchUpdates(_0x416434){return function(_0x5d8d1e){try{jsonpatch['apply'](_0x5d8d1e,_0x416434,!![]);}catch(_0x4c4843){return BPromise[_0x3279('0x1f')](_0x4c4843);}return _0x5d8d1e[_0x3279('0x20')]();};}function saveUpdates(_0x419815,_0xa80fcb){return function(_0x16725d){if(_0x16725d){return _0x16725d['update'](_0x419815)[_0x3279('0x21')](function(_0x145cce){return _0x145cce;});}return null;};}function removeEntity(_0x18d7a9,_0x73e8c5){return function(_0x470585){if(_0x470585){return _0x470585[_0x3279('0x22')]()[_0x3279('0x21')](function(){_0x18d7a9[_0x3279('0x18')](0xcc)[_0x3279('0x19')]();});}};}function handleEntityNotFound(_0x44a157,_0x33b2f6){return function(_0x590c4c){if(!_0x590c4c){_0x44a157[_0x3279('0x17')](0x194);}return _0x590c4c;};}function handleError(_0x3b7474,_0x37c393){_0x37c393=_0x37c393||0x1f4;return function(_0x3f6b9b){logger[_0x3279('0x23')](_0x3f6b9b[_0x3279('0x24')]);if(_0x3f6b9b['name']){delete _0x3f6b9b[_0x3279('0x25')];}_0x3b7474[_0x3279('0x18')](_0x37c393)[_0x3279('0x26')](_0x3f6b9b);};}exports['index']=function(_0x36ce95,_0x410f55){var _0x550086={},_0x23d4fa={},_0x10787b={'count':0x0,'rows':[]};var _0x23636b=_['map'](db[_0x3279('0x27')]['rawAttributes'],function(_0x5c3701){return{'name':_0x5c3701[_0x3279('0x28')],'type':_0x5c3701[_0x3279('0x29')][_0x3279('0x2a')]};});_0x23d4fa[_0x3279('0x2b')]=_[_0x3279('0x2c')](_0x23636b,_0x3279('0x25'));_0x23d4fa[_0x3279('0x2d')]=_[_0x3279('0x2e')](_0x36ce95[_0x3279('0x2d')]);_0x23d4fa[_0x3279('0x2f')]=_['intersection'](_0x23d4fa['model'],_0x23d4fa[_0x3279('0x2d')]);_0x550086[_0x3279('0x30')]=_[_0x3279('0x31')](_0x23d4fa[_0x3279('0x2b')],qs[_0x3279('0x32')](_0x36ce95['query'][_0x3279('0x32')]));_0x550086[_0x3279('0x30')]=_0x550086[_0x3279('0x30')][_0x3279('0x33')]?_0x550086[_0x3279('0x30')]:_0x23d4fa[_0x3279('0x2b')];if(!_0x36ce95[_0x3279('0x2d')][_0x3279('0x34')]('nolimit')){_0x550086['limit']=qs[_0x3279('0x1d')](_0x36ce95['query'][_0x3279('0x1d')]);_0x550086[_0x3279('0x35')]=qs['offset'](_0x36ce95[_0x3279('0x2d')][_0x3279('0x35')]);}_0x550086['order']=qs[_0x3279('0x36')](_0x36ce95[_0x3279('0x2d')][_0x3279('0x36')]);_0x550086['where']=qs[_0x3279('0x2f')](_[_0x3279('0x37')](_0x36ce95[_0x3279('0x2d')],_0x23d4fa[_0x3279('0x2f')]),_0x23636b);if(_0x36ce95['query']['filter']){_0x550086[_0x3279('0x38')]=_[_0x3279('0x39')](_0x550086['where'],{'$or':_[_0x3279('0x2c')](_0x23636b,function(_0x1825b8){if(_0x1825b8[_0x3279('0x29')]!==_0x3279('0x3a')){var _0x3db4d1={};_0x3db4d1[_0x1825b8['name']]={'$like':'%'+_0x36ce95[_0x3279('0x2d')][_0x3279('0x3b')]+'%'};return _0x3db4d1;}})});}_0x550086=_[_0x3279('0x39')]({},_0x550086,_0x36ce95['options']);var _0x38091e={'where':_0x550086['where']};return db[_0x3279('0x27')][_0x3279('0x1c')](_0x38091e)[_0x3279('0x21')](function(_0x4c0541){_0x10787b[_0x3279('0x1c')]=_0x4c0541;if(_0x36ce95['query'][_0x3279('0x3c')]){_0x550086[_0x3279('0x3d')]=[{'all':!![]}];}return db[_0x3279('0x27')]['findAll'](_0x550086);})[_0x3279('0x21')](function(_0xb0c194){_0x10787b[_0x3279('0x3e')]=_0xb0c194;return _0x10787b;})[_0x3279('0x21')](respondWithFilteredResult(_0x410f55,_0x550086))[_0x3279('0x3f')](handleError(_0x410f55,null));};exports['show']=function(_0x116a59,_0x36cc36){var _0x1b2c08={'raw':![],'where':{'id':_0x116a59[_0x3279('0x40')]['id']}},_0x4831ae={};_0x4831ae[_0x3279('0x2b')]=_[_0x3279('0x2e')](db[_0x3279('0x27')][_0x3279('0x41')]);_0x4831ae['query']=_[_0x3279('0x2e')](_0x116a59[_0x3279('0x2d')]);_0x4831ae[_0x3279('0x2f')]=_[_0x3279('0x31')](_0x4831ae[_0x3279('0x2b')],_0x4831ae[_0x3279('0x2d')]);_0x1b2c08[_0x3279('0x30')]=_[_0x3279('0x31')](_0x4831ae[_0x3279('0x2b')],qs[_0x3279('0x32')](_0x116a59[_0x3279('0x2d')]['fields']));_0x1b2c08[_0x3279('0x30')]=_0x1b2c08[_0x3279('0x30')]['length']?_0x1b2c08[_0x3279('0x30')]:_0x4831ae[_0x3279('0x2b')];if(_0x116a59['query'][_0x3279('0x3c')]){_0x1b2c08[_0x3279('0x3d')]=[{'all':!![]}];}_0x1b2c08=_[_0x3279('0x39')]({},_0x1b2c08,_0x116a59[_0x3279('0x42')]);return db[_0x3279('0x27')]['find'](_0x1b2c08)['then'](handleEntityNotFound(_0x36cc36,null))[_0x3279('0x21')](respondWithResult(_0x36cc36,null))[_0x3279('0x3f')](handleError(_0x36cc36,null));};exports[_0x3279('0x43')]=function(_0x444f1c,_0x5f5690){return db['UserProfileSection']['create'](_0x444f1c[_0x3279('0x44')],{})['then'](respondWithResult(_0x5f5690,0xc9))[_0x3279('0x3f')](handleError(_0x5f5690,null));};exports[_0x3279('0x45')]=function(_0x17ac1b,_0x4bfe8c){if(_0x17ac1b[_0x3279('0x44')]['id']){delete _0x17ac1b['body']['id'];}return db[_0x3279('0x27')][_0x3279('0x46')]({'where':{'id':_0x17ac1b['params']['id']}})['then'](handleEntityNotFound(_0x4bfe8c,null))[_0x3279('0x21')](saveUpdates(_0x17ac1b[_0x3279('0x44')],null))[_0x3279('0x21')](respondWithResult(_0x4bfe8c,null))['catch'](handleError(_0x4bfe8c,null));};exports[_0x3279('0x22')]=function(_0x4b0e5e,_0x4a9cf6){return db[_0x3279('0x27')]['find']({'where':{'id':_0x4b0e5e[_0x3279('0x40')]['id']}})[_0x3279('0x21')](handleEntityNotFound(_0x4a9cf6,null))[_0x3279('0x21')](removeEntity(_0x4a9cf6,null))[_0x3279('0x3f')](handleError(_0x4a9cf6,null));};exports[_0x3279('0x47')]=function(_0xd08c2a,_0x4a69d2){return db[_0x3279('0x27')][_0x3279('0x47')]()[_0x3279('0x21')](respondWithResult(_0x4a69d2,null))[_0x3279('0x3f')](handleError(_0x4a69d2,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 87b278c..2caa261 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 _0x8149=['../../config/environment','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x4df85c,_0x248dfb){var _0x4e2a61=function(_0x4e2c8e){while(--_0x4e2c8e){_0x4df85c['push'](_0x4df85c['shift']());}};_0x4e2a61(++_0x248dfb);}(_0x8149,0x149));var _0x9814=function(_0x829d5d,_0x520c80){_0x829d5d=_0x829d5d-0x0;var _0x13df56=_0x8149[_0x829d5d];return _0x13df56;};'use strict';var _=require(_0x9814('0x0'));var util=require(_0x9814('0x1'));var logger=require(_0x9814('0x2'))(_0x9814('0x3'));var moment=require('moment');var BPromise=require(_0x9814('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9814('0x5'));var rimraf=require(_0x9814('0x6'));var config=require(_0x9814('0x7'));var attributes=require(_0x9814('0x8'));module[_0x9814('0x9')]=function(_0x5f5b11,_0x53a187){return _0x5f5b11[_0x9814('0xa')]('UserProfileSection',attributes,{'tableName':_0x9814('0xb'),'paranoid':![],'indexes':[{'name':_0x9814('0xc'),'fields':['sectionId',_0x9814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xece1=['exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xece1,0x1aa));var _0x1ece=function(_0xe4e603,_0x50f485){_0xe4e603=_0xe4e603-0x0;var _0x33887c=_0xece1[_0xe4e603];return _0x33887c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1ece('0x0'))(_0x1ece('0x1'));var moment=require(_0x1ece('0x2'));var BPromise=require(_0x1ece('0x3'));var rp=require(_0x1ece('0x4'));var fs=require('fs');var path=require(_0x1ece('0x5'));var rimraf=require(_0x1ece('0x6'));var config=require(_0x1ece('0x7'));var attributes=require(_0x1ece('0x8'));module[_0x1ece('0x9')]=function(_0x3184d7,_0xcfff18){return _0x3184d7['define'](_0x1ece('0xa'),attributes,{'tableName':_0x1ece('0xb'),'paranoid':![],'indexes':[{'name':_0x1ece('0xc'),'fields':[_0x1ece('0xd'),_0x1ece('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index d88ed9b..e871102 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 _0x1fcb=['http','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x34cff3,_0x41c550){var _0x1a038e=function(_0x437248){while(--_0x437248){_0x34cff3['push'](_0x34cff3['shift']());}};_0x1a038e(++_0x41c550);}(_0x1fcb,0x96));var _0xb1fc=function(_0xd7de80,_0x2f2c9e){_0xd7de80=_0xd7de80-0x0;var _0xf68736=_0x1fcb[_0xd7de80];return _0xf68736;};'use strict';var _=require(_0xb1fc('0x0'));var util=require(_0xb1fc('0x1'));var moment=require('moment');var BPromise=require(_0xb1fc('0x2'));var rs=require(_0xb1fc('0x3'));var fs=require('fs');var Redis=require(_0xb1fc('0x4'));var db=require(_0xb1fc('0x5'))['db'];var utils=require(_0xb1fc('0x6'));var logger=require(_0xb1fc('0x7'))(_0xb1fc('0x8'));var config=require('../../config/environment');var jayson=require(_0xb1fc('0x9'));var client=jayson['client'][_0xb1fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f885a,_0x308ec9,_0x2460bf){return new BPromise(function(_0x525749,_0x18557c){return client['request'](_0x1f885a,_0x2460bf)[_0xb1fc('0xb')](function(_0x1ac1a9){logger['info'](_0xb1fc('0xc'),_0x308ec9,_0xb1fc('0xd'));logger[_0xb1fc('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x308ec9,_0xb1fc('0xd'),JSON['stringify'](_0x1ac1a9));if(_0x1ac1a9[_0xb1fc('0xf')]){if(_0x1ac1a9[_0xb1fc('0xf')][_0xb1fc('0x10')]===0x1f4){logger[_0xb1fc('0xf')](_0xb1fc('0xc'),_0x308ec9,_0x1ac1a9[_0xb1fc('0xf')][_0xb1fc('0x11')]);return _0x18557c(_0x1ac1a9[_0xb1fc('0xf')]['message']);}logger[_0xb1fc('0xf')](_0xb1fc('0xc'),_0x308ec9,_0x1ac1a9[_0xb1fc('0xf')][_0xb1fc('0x11')]);return _0x525749(_0x1ac1a9[_0xb1fc('0xf')][_0xb1fc('0x11')]);}else{logger[_0xb1fc('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x308ec9,_0xb1fc('0xd'));_0x525749(_0x1ac1a9[_0xb1fc('0x13')]['message']);}})['catch'](function(_0x26cd4c){logger[_0xb1fc('0xf')](_0xb1fc('0xc'),_0x308ec9,_0x26cd4c);_0x18557c(_0x26cd4c);});});} \ No newline at end of file +var _0xd783=['request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserProfileSection,\x20%s,\x20%s'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xd783,0x1ab));var _0x3d78=function(_0x761b6d,_0x7c7fa8){_0x761b6d=_0x761b6d-0x0;var _0x3a1639=_0xd783[_0x761b6d];return _0x3a1639;};'use strict';var _=require(_0x3d78('0x0'));var util=require(_0x3d78('0x1'));var moment=require(_0x3d78('0x2'));var BPromise=require('bluebird');var rs=require(_0x3d78('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d78('0x4'))['db'];var utils=require(_0x3d78('0x5'));var logger=require(_0x3d78('0x6'))(_0x3d78('0x7'));var config=require(_0x3d78('0x8'));var jayson=require(_0x3d78('0x9'));var client=jayson[_0x3d78('0xa')][_0x3d78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34bff9,_0x3d8d09,_0x4e1606){return new BPromise(function(_0x238e74,_0x1a0609){return client['request'](_0x34bff9,_0x4e1606)[_0x3d78('0xc')](function(_0x1a412d){logger['info'](_0x3d78('0xd'),_0x3d8d09,_0x3d78('0xe'));logger['debug'](_0x3d78('0xf'),_0x3d8d09,_0x3d78('0xe'),JSON['stringify'](_0x1a412d));if(_0x1a412d[_0x3d78('0x10')]){if(_0x1a412d['error']['code']===0x1f4){logger[_0x3d78('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x3d8d09,_0x1a412d[_0x3d78('0x10')][_0x3d78('0x11')]);return _0x1a0609(_0x1a412d[_0x3d78('0x10')]['message']);}logger[_0x3d78('0x10')](_0x3d78('0xd'),_0x3d8d09,_0x1a412d[_0x3d78('0x10')][_0x3d78('0x11')]);return _0x238e74(_0x1a412d[_0x3d78('0x10')][_0x3d78('0x11')]);}else{logger[_0x3d78('0x12')](_0x3d78('0xd'),_0x3d8d09,_0x3d78('0xe'));_0x238e74(_0x1a412d[_0x3d78('0x13')][_0x3d78('0x11')]);}})[_0x3d78('0x14')](function(_0x73a980){logger[_0x3d78('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x3d8d09,_0x73a980);_0x1a0609(_0x73a980);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 33bbde5..97503ee 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x53f6a0,_0x16d576){var _0x3e6f05=function(_0x419759){while(--_0x419759){_0x53f6a0['push'](_0x53f6a0['shift']());}};_0x3e6f05(++_0x16d576);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x58cf94,_0x191c2f){var _0x7c52a8=function(_0x28b9c8){while(--_0x28b9c8){_0x58cf94['push'](_0x58cf94['shift']());}};_0x7c52a8(++_0x191c2f);}(_0xedd9,0xfc));var _0x9edd=function(_0x3f326c,_0x48677e){_0x3f326c=_0x3f326c-0x0;var _0x38c6d0=_0xedd9[_0x3f326c];return _0x38c6d0;};'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 diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 5462218..e09d975 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 _0xa8c4=['INTEGER','exports'];(function(_0x4c0fbd,_0x167e73){var _0xfa377c=function(_0x19a0c6){while(--_0x19a0c6){_0x4c0fbd['push'](_0x4c0fbd['shift']());}};_0xfa377c(++_0x167e73);}(_0xa8c4,0x12d));var _0x4a8c=function(_0x21a2b2,_0x22ba1e){_0x21a2b2=_0x21a2b2-0x0;var _0x2060b4=_0xa8c4[_0x21a2b2];return _0x2060b4;};'use strict';var Sequelize=require('sequelize');module[_0x4a8c('0x0')]={'penalty':{'type':Sequelize[_0x4a8c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7634=['INTEGER','exports'];(function(_0x315afa,_0x1a8e13){var _0x4a9077=function(_0x19a759){while(--_0x19a759){_0x315afa['push'](_0x315afa['shift']());}};_0x4a9077(++_0x1a8e13);}(_0x7634,0x1ed));var _0x4763=function(_0x25ea84,_0x28794d){_0x25ea84=_0x25ea84-0x0;var _0x20c682=_0x7634[_0x25ea84];return _0x20c682;};'use strict';var Sequelize=require('sequelize');module[_0x4763('0x0')]={'penalty':{'type':Sequelize[_0x4763('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 b77e83e..0feefe4 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 _0x32f4=['./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32f4,0x154));var _0x432f=function(_0x8918a8,_0x597b94){_0x8918a8=_0x8918a8-0x0;var _0x1a3ae2=_0x32f4[_0x8918a8];return _0x1a3ae2;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var logger=require(_0x432f('0x2'))(_0x432f('0x3'));var moment=require('moment');var BPromise=require(_0x432f('0x4'));var rp=require(_0x432f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var attributes=require(_0x432f('0x8'));module[_0x432f('0x9')]=function(_0x2f5f03,_0x5d8cc0){return _0x2f5f03['define'](_0x432f('0xa'),attributes,{'tableName':_0x432f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ee1=['user_has_sms_queues','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define'];(function(_0x237ac5,_0x106f44){var _0xc65c11=function(_0x281986){while(--_0x281986){_0x237ac5['push'](_0x237ac5['shift']());}};_0xc65c11(++_0x106f44);}(_0x7ee1,0x8d));var _0x17ee=function(_0x721697,_0x1f4980){_0x721697=_0x721697-0x0;var _0x51c1b6=_0x7ee1[_0x721697];return _0x51c1b6;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var attributes=require(_0x17ee('0x6'));module[_0x17ee('0x7')]=function(_0x5c0617,_0x52b1db){return _0x5c0617[_0x17ee('0x8')]('UserSmsQueue',attributes,{'tableName':_0x17ee('0x9'),'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 b392a0e..1efaf66 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 _0x8822=['debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent'];(function(_0x5f1515,_0x216f35){var _0x377ade=function(_0x5a5b9d){while(--_0x5a5b9d){_0x5f1515['push'](_0x5f1515['shift']());}};_0x377ade(++_0x216f35);}(_0x8822,0x7c));var _0x2882=function(_0x5db5fd,_0x2613ec){_0x5db5fd=_0x5db5fd-0x0;var _0x33c1f9=_0x8822[_0x5db5fd];return _0x33c1f9;};'use strict';var _=require(_0x2882('0x0'));var util=require(_0x2882('0x1'));var moment=require(_0x2882('0x2'));var BPromise=require('bluebird');var rs=require(_0x2882('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2882('0x4'))['db'];var utils=require(_0x2882('0x5'));var logger=require(_0x2882('0x6'))(_0x2882('0x7'));var config=require(_0x2882('0x8'));var jayson=require(_0x2882('0x9'));var client=jayson['client'][_0x2882('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e3081,_0x416832,_0x4bd3da){return new BPromise(function(_0x35f4cb,_0x404133){return client[_0x2882('0xb')](_0x5e3081,_0x4bd3da)[_0x2882('0xc')](function(_0x210343){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x416832,_0x2882('0xd'));logger[_0x2882('0xe')](_0x2882('0xf'),_0x416832,_0x2882('0xd'),JSON[_0x2882('0x10')](_0x210343));if(_0x210343[_0x2882('0x11')]){if(_0x210343['error'][_0x2882('0x12')]===0x1f4){logger['error'](_0x2882('0x13'),_0x416832,_0x210343[_0x2882('0x11')][_0x2882('0x14')]);return _0x404133(_0x210343[_0x2882('0x11')][_0x2882('0x14')]);}logger[_0x2882('0x11')](_0x2882('0x13'),_0x416832,_0x210343[_0x2882('0x11')]['message']);return _0x35f4cb(_0x210343[_0x2882('0x11')][_0x2882('0x14')]);}else{logger[_0x2882('0x15')](_0x2882('0x13'),_0x416832,_0x2882('0xd'));_0x35f4cb(_0x210343['result'][_0x2882('0x14')]);}})[_0x2882('0x16')](function(_0x1d3a65){logger[_0x2882('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x416832,_0x1d3a65);_0x404133(_0x1d3a65);});});} \ No newline at end of file +var _0x8bd3=['error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','debug','stringify'];(function(_0x23b7d9,_0x55ed3b){var _0x5309e7=function(_0x5c60da){while(--_0x5c60da){_0x23b7d9['push'](_0x23b7d9['shift']());}};_0x5309e7(++_0x55ed3b);}(_0x8bd3,0xb6));var _0x38bd=function(_0x5b26cb,_0x527ab0){_0x5b26cb=_0x5b26cb-0x0;var _0x563d12=_0x8bd3[_0x5b26cb];return _0x563d12;};'use strict';var _=require(_0x38bd('0x0'));var util=require(_0x38bd('0x1'));var moment=require(_0x38bd('0x2'));var BPromise=require(_0x38bd('0x3'));var rs=require(_0x38bd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x38bd('0x5'))['db'];var utils=require(_0x38bd('0x6'));var logger=require(_0x38bd('0x7'))(_0x38bd('0x8'));var config=require('../../config/environment');var jayson=require(_0x38bd('0x9'));var client=jayson['client'][_0x38bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bf608,_0x236cb1,_0x1893e7){return new BPromise(function(_0x46b5f9,_0x36fb30){return client['request'](_0x4bf608,_0x1893e7)[_0x38bd('0xb')](function(_0x281c06){logger[_0x38bd('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x236cb1,_0x38bd('0xd'));logger[_0x38bd('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x236cb1,_0x38bd('0xd'),JSON[_0x38bd('0xf')](_0x281c06));if(_0x281c06[_0x38bd('0x10')]){if(_0x281c06[_0x38bd('0x10')][_0x38bd('0x11')]===0x1f4){logger[_0x38bd('0x10')](_0x38bd('0x12'),_0x236cb1,_0x281c06['error'][_0x38bd('0x13')]);return _0x36fb30(_0x281c06[_0x38bd('0x10')]['message']);}logger[_0x38bd('0x10')](_0x38bd('0x12'),_0x236cb1,_0x281c06[_0x38bd('0x10')]['message']);return _0x46b5f9(_0x281c06[_0x38bd('0x10')][_0x38bd('0x13')]);}else{logger['info'](_0x38bd('0x12'),_0x236cb1,_0x38bd('0xd'));_0x46b5f9(_0x281c06[_0x38bd('0x14')]['message']);}})[_0x38bd('0x15')](function(_0x3a07c8){logger[_0x38bd('0x10')](_0x38bd('0x12'),_0x236cb1,_0x3a07c8);_0x36fb30(_0x3a07c8);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 3b3918f..4d8b196 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 _0xe30d=['INTEGER'];(function(_0x4b1012,_0x1415eb){var _0x23d715=function(_0x25f330){while(--_0x25f330){_0x4b1012['push'](_0x4b1012['shift']());}};_0x23d715(++_0x1415eb);}(_0xe30d,0x1bc));var _0xde30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe30d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize[_0xde30('0x0')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf4cc=['INTEGER','exports'];(function(_0x55cb69,_0x18bd1b){var _0x3839f0=function(_0x5233f1){while(--_0x5233f1){_0x55cb69['push'](_0x55cb69['shift']());}};_0x3839f0(++_0x18bd1b);}(_0xf4cc,0x12f));var _0xcf4c=function(_0x4e7f33,_0x3e75bc){_0x4e7f33=_0x4e7f33-0x0;var _0x385a77=_0xf4cc[_0x4e7f33];return _0x385a77;};'use strict';var Sequelize=require('sequelize');module[_0xcf4c('0x0')]={'UserId':{'type':Sequelize[_0xcf4c('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xcf4c('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 5ac0e7d..8435493 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(_0x3791eb,_0x2c8dde){var _0x246b31=function(_0x2b7901){while(--_0x2b7901){_0x3791eb['push'](_0x3791eb['shift']());}};_0x246b31(++_0x2c8dde);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x45e615,_0x24b9b4){var _0x5141a7=function(_0x1a9af5){while(--_0x1a9af5){_0x45e615['push'](_0x45e615['shift']());}};_0x5141a7(++_0x24b9b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 de4a94f..c56d032 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(_0x2c5315,_0x3696d8){var _0x934ff9=function(_0x1e4083){while(--_0x1e4083){_0x2c5315['push'](_0x2c5315['shift']());}};_0x934ff9(++_0x3696d8);}(_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(_0x24af46,_0x40d457){var _0x3bb5af=function(_0x3ad6ef){while(--_0x3ad6ef){_0x24af46['push'](_0x24af46['shift']());}};_0x3bb5af(++_0x40d457);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 682020e..9fd6d7c 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 _0xa562=['exports','INTEGER','sequelize'];(function(_0x465f17,_0x4bd683){var _0x38fb72=function(_0xcd6ba){while(--_0xcd6ba){_0x465f17['push'](_0x465f17['shift']());}};_0x38fb72(++_0x4bd683);}(_0xa562,0x1a9));var _0x2a56=function(_0x27714d,_0x457b53){_0x27714d=_0x27714d-0x0;var _0x18e2fb=_0xa562[_0x27714d];return _0x18e2fb;};'use strict';var Sequelize=require(_0x2a56('0x0'));module[_0x2a56('0x1')]={'penalty':{'type':Sequelize[_0x2a56('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x22e4=['exports'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0x22e4,0x1af));var _0x422e=function(_0x4b79cc,_0x143bab){_0x4b79cc=_0x4b79cc-0x0;var _0x5b7d12=_0x22e4[_0x4b79cc];return _0x5b7d12;};'use strict';var Sequelize=require('sequelize');module[_0x422e('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 374512f..f603d9b 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 _0xcc9f=['request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x56ca9e,_0x283852){var _0x536ebb=function(_0x29f98e){while(--_0x29f98e){_0x56ca9e['push'](_0x56ca9e['shift']());}};_0x536ebb(++_0x283852);}(_0xcc9f,0xea));var _0xfcc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc9f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfcc9('0x0'));var util=require(_0xfcc9('0x1'));var logger=require(_0xfcc9('0x2'))(_0xfcc9('0x3'));var moment=require(_0xfcc9('0x4'));var BPromise=require(_0xfcc9('0x5'));var rp=require(_0xfcc9('0x6'));var fs=require('fs');var path=require(_0xfcc9('0x7'));var rimraf=require(_0xfcc9('0x8'));var config=require(_0xfcc9('0x9'));var attributes=require(_0xfcc9('0xa'));module[_0xfcc9('0xb')]=function(_0x470ff0,_0xecb70c){return _0x470ff0[_0xfcc9('0xc')](_0xfcc9('0xd'),attributes,{'tableName':_0xfcc9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb9a=['bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','moment'];(function(_0x9435ae,_0x205b23){var _0x40e07a=function(_0x313739){while(--_0x313739){_0x9435ae['push'](_0x9435ae['shift']());}};_0x40e07a(++_0x205b23);}(_0xbb9a,0xa5));var _0xabb9=function(_0x51c429,_0x5bb4e5){_0x51c429=_0x51c429-0x0;var _0x11dd96=_0xbb9a[_0x51c429];return _0x11dd96;};'use strict';var _=require(_0xabb9('0x0'));var util=require(_0xabb9('0x1'));var logger=require(_0xabb9('0x2'))('api');var moment=require(_0xabb9('0x3'));var BPromise=require(_0xabb9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xabb9('0x5'));var rimraf=require(_0xabb9('0x6'));var config=require(_0xabb9('0x7'));var attributes=require(_0xabb9('0x8'));module[_0xabb9('0x9')]=function(_0xf30a65,_0x37f5a3){return _0xf30a65[_0xabb9('0xa')](_0xabb9('0xb'),attributes,{'tableName':_0xabb9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 1c321df..edc0f2d 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 _0xb261=['info','UserVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x36ca8e,_0x545ebc){var _0x5e474d=function(_0x3bc822){while(--_0x3bc822){_0x36ca8e['push'](_0x36ca8e['shift']());}};_0x5e474d(++_0x545ebc);}(_0xb261,0x1d5));var _0x1b26=function(_0xa03db6,_0x436e2c){_0xa03db6=_0xa03db6-0x0;var _0x1e7e80=_0xb261[_0xa03db6];return _0x1e7e80;};'use strict';var _=require(_0x1b26('0x0'));var util=require(_0x1b26('0x1'));var moment=require(_0x1b26('0x2'));var BPromise=require(_0x1b26('0x3'));var rs=require(_0x1b26('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b26('0x5'))['db'];var utils=require(_0x1b26('0x6'));var logger=require('../../config/logger')(_0x1b26('0x7'));var config=require(_0x1b26('0x8'));var jayson=require(_0x1b26('0x9'));var client=jayson[_0x1b26('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27e2d5,_0x370238,_0x4e798a){return new BPromise(function(_0x32a7f7,_0x567368){return client['request'](_0x27e2d5,_0x4e798a)['then'](function(_0x4b23a1){logger[_0x1b26('0xb')](_0x1b26('0xc'),_0x370238,'request\x20sent');logger[_0x1b26('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x370238,_0x1b26('0xe'),JSON[_0x1b26('0xf')](_0x4b23a1));if(_0x4b23a1[_0x1b26('0x10')]){if(_0x4b23a1[_0x1b26('0x10')][_0x1b26('0x11')]===0x1f4){logger[_0x1b26('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x370238,_0x4b23a1[_0x1b26('0x10')][_0x1b26('0x12')]);return _0x567368(_0x4b23a1[_0x1b26('0x10')][_0x1b26('0x12')]);}logger[_0x1b26('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x370238,_0x4b23a1['error'][_0x1b26('0x12')]);return _0x32a7f7(_0x4b23a1['error'][_0x1b26('0x12')]);}else{logger[_0x1b26('0xb')](_0x1b26('0xc'),_0x370238,'request\x20sent');_0x32a7f7(_0x4b23a1['result']['message']);}})[_0x1b26('0x13')](function(_0x67f766){logger[_0x1b26('0x10')](_0x1b26('0xc'),_0x370238,_0x67f766);_0x567368(_0x67f766);});});} \ No newline at end of file +var _0x6be5=['request\x20sent','error','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','info','UserVoiceQueue,\x20%s,\x20%s','UserVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1b5ef7,_0x11a53c){var _0x271ff9=function(_0x590d7e){while(--_0x590d7e){_0x1b5ef7['push'](_0x1b5ef7['shift']());}};_0x271ff9(++_0x11a53c);}(_0x6be5,0xb4));var _0x56be=function(_0x4caf9b,_0x1b6b8e){_0x4caf9b=_0x4caf9b-0x0;var _0xc59298=_0x6be5[_0x4caf9b];return _0xc59298;};'use strict';var _=require(_0x56be('0x0'));var util=require('util');var moment=require(_0x56be('0x1'));var BPromise=require(_0x56be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56be('0x3'));var db=require(_0x56be('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x56be('0x5'))(_0x56be('0x6'));var config=require(_0x56be('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xefaf24,_0x58e02c,_0x2c66fb){return new BPromise(function(_0x4bf011,_0x3e83a6){return client[_0x56be('0x8')](_0xefaf24,_0x2c66fb)['then'](function(_0x533ec5){logger[_0x56be('0x9')](_0x56be('0xa'),_0x58e02c,'request\x20sent');logger['debug'](_0x56be('0xb'),_0x58e02c,_0x56be('0xc'),JSON['stringify'](_0x533ec5));if(_0x533ec5[_0x56be('0xd')]){if(_0x533ec5[_0x56be('0xd')]['code']===0x1f4){logger[_0x56be('0xd')](_0x56be('0xa'),_0x58e02c,_0x533ec5[_0x56be('0xd')][_0x56be('0xe')]);return _0x3e83a6(_0x533ec5[_0x56be('0xd')]['message']);}logger['error'](_0x56be('0xa'),_0x58e02c,_0x533ec5[_0x56be('0xd')][_0x56be('0xe')]);return _0x4bf011(_0x533ec5[_0x56be('0xd')][_0x56be('0xe')]);}else{logger[_0x56be('0x9')](_0x56be('0xa'),_0x58e02c,_0x56be('0xc'));_0x4bf011(_0x533ec5[_0x56be('0xf')][_0x56be('0xe')]);}})['catch'](function(_0x50c9d9){logger[_0x56be('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x58e02c,_0x50c9d9);_0x3e83a6(_0x50c9d9);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 33ea353..8cdd4fe 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2ac28f,_0x5da61a){var _0x150fdf=function(_0x3fe1f2){while(--_0x3fe1f2){_0x2ac28f['push'](_0x2ac28f['shift']());}};_0x150fdf(++_0x5da61a);}(_0xe706,0xa3));var _0x6e70=function(_0x3a634e,_0x273db2){_0x3a634e=_0x3a634e-0x0;var _0x2ecddb=_0xe706[_0x3a634e];return _0x2ecddb;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2fee36,_0x88e91){var _0x45e792=function(_0x546894){while(--_0x546894){_0x2fee36['push'](_0x2fee36['shift']());}};_0x45e792(++_0x88e91);}(_0x70e0,0x17b));var _0x070e=function(_0x4c6f53,_0x2dbab9){_0x4c6f53=_0x4c6f53-0x0;var _0x2797a3=_0x70e0[_0x4c6f53];return _0x2797a3;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 805669a..2ee1bbc 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 _0x1156=['queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x4f8d61,_0x29eff0){var _0x3bc078=function(_0x4c7203){while(--_0x4c7203){_0x4f8d61['push'](_0x4f8d61['shift']());}};_0x3bc078(++_0x29eff0);}(_0x1156,0x178));var _0x6115=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x1156[_0x409353];return _0x4f4b59;};'use strict';var Sequelize=require(_0x6115('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6115('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x6115('0x2')},'UserId':{'type':Sequelize[_0x6115('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x6115('0x3')],'allowNull':![],'unique':_0x6115('0x4'),'comment':_0x6115('0x2')},'VoiceQueueId':{'type':Sequelize[_0x6115('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x6115('0x3')],'allowNull':![],'unique':_0x6115('0x4'),'comment':_0x6115('0x2')},'penalty':{'type':Sequelize[_0x6115('0x1')](0xb),'defaultValue':0x0,'comment':_0x6115('0x2')},'paused':{'type':Sequelize[_0x6115('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xea1e=['INTEGER','queue_interface','sequelize','exports','Required\x20by\x20Asterisk','STRING'];(function(_0x554394,_0x386254){var _0xfd2947=function(_0xeab87e){while(--_0xeab87e){_0x554394['push'](_0x554394['shift']());}};_0xfd2947(++_0x386254);}(_0xea1e,0x1e2));var _0xeea1=function(_0xdb4588,_0x1fe588){_0xdb4588=_0xdb4588-0x0;var _0x59864d=_0xea1e[_0xdb4588];return _0x59864d;};'use strict';var Sequelize=require(_0xeea1('0x0'));module[_0xeea1('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xeea1('0x2')},'membername':{'type':Sequelize[_0xeea1('0x3')],'allowNull':![],'comment':_0xeea1('0x2')},'UserId':{'type':Sequelize[_0xeea1('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xeea1('0x3')],'allowNull':![],'unique':_0xeea1('0x5'),'comment':_0xeea1('0x2')},'VoiceQueueId':{'type':Sequelize[_0xeea1('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0xeea1('0x3')],'allowNull':![],'unique':_0xeea1('0x5'),'comment':_0xeea1('0x2')},'penalty':{'type':Sequelize[_0xeea1('0x4')](0xb),'defaultValue':0x0,'comment':_0xeea1('0x2')},'paused':{'type':Sequelize[_0xeea1('0x4')](0xb),'defaultValue':0x0,'comment':_0xeea1('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index f1a4fad..e0004a6 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 _0x2b4e=['UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hook','../../mysqldb'];(function(_0x1ba2e5,_0xbcc3fb){var _0x2b8957=function(_0x2a2427){while(--_0x2a2427){_0x1ba2e5['push'](_0x1ba2e5['shift']());}};_0x2b8957(++_0xbcc3fb);}(_0x2b4e,0x197));var _0xe2b4=function(_0x2ae2cd,_0xb42c96){_0x2ae2cd=_0x2ae2cd-0x0;var _0xc52725=_0x2b4e[_0x2ae2cd];return _0xc52725;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xe2b4('0x0'))['db'][_0xe2b4('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xe2b4('0x2')](0x0);var events={'afterCreate':_0xe2b4('0x3'),'afterUpdate':_0xe2b4('0x4'),'afterDestroy':_0xe2b4('0x5')};function emitEvent(_0x50b677){return function(_0x5db85f,_0x5df838,_0x338805){UserVoiceQueueRtEvents[_0xe2b4('0x6')](_0x50b677+':'+_0x5db85f['id'],_0x5db85f);UserVoiceQueueRtEvents[_0xe2b4('0x6')](_0x50b677,_0x5db85f);_0x338805(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xe2b4('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x7805=['events','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2ac42c,_0x400eff){var _0x29b7f3=function(_0x2f9606){while(--_0x2f9606){_0x2ac42c['push'](_0x2ac42c['shift']());}};_0x29b7f3(++_0x400eff);}(_0x7805,0x12c));var _0x5780=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x7805[_0x174ef5];return _0x1cc379;};'use strict';var EventEmitter=require(_0x5780('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x5780('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5780('0x2')](0x0);var events={'afterCreate':_0x5780('0x3'),'afterUpdate':_0x5780('0x4'),'afterDestroy':_0x5780('0x5')};function emitEvent(_0x1c0d34){return function(_0xdd7686,_0x1e4c3d,_0x3fc56e){UserVoiceQueueRtEvents[_0x5780('0x6')](_0x1c0d34+':'+_0xdd7686['id'],_0xdd7686);UserVoiceQueueRtEvents['emit'](_0x1c0d34,_0xdd7686);_0x3fc56e(null);};}for(var e in events){if(events[_0x5780('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x5780('0x8')](e,emitEvent(event));}}module[_0x5780('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index a3af4fb..d823f31 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 _0x6833=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./userVoiceQueueRt.attributes','exports','define','lodash','util'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x6833,0x169));var _0x3683=function(_0x5a0ad0,_0x4cb120){_0x5a0ad0=_0x5a0ad0-0x0;var _0x31c7a5=_0x6833[_0x5a0ad0];return _0x31c7a5;};'use strict';var _=require(_0x3683('0x0'));var util=require(_0x3683('0x1'));var logger=require(_0x3683('0x2'))(_0x3683('0x3'));var moment=require(_0x3683('0x4'));var BPromise=require(_0x3683('0x5'));var rp=require(_0x3683('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3683('0x7'));var config=require('../../config/environment');var attributes=require(_0x3683('0x8'));module[_0x3683('0x9')]=function(_0x1fcf9e,_0x17f461){return _0x1fcf9e[_0x3683('0xa')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23cc=['define','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports'];(function(_0x38fe6,_0x39131e){var _0x14e81c=function(_0x3008c1){while(--_0x3008c1){_0x38fe6['push'](_0x38fe6['shift']());}};_0x14e81c(++_0x39131e);}(_0x23cc,0xb1));var _0xc23c=function(_0x31a647,_0x35ab53){_0x31a647=_0x31a647-0x0;var _0xd45e3b=_0x23cc[_0x31a647];return _0xd45e3b;};'use strict';var _=require(_0xc23c('0x0'));var util=require(_0xc23c('0x1'));var logger=require(_0xc23c('0x2'))('api');var moment=require(_0xc23c('0x3'));var BPromise=require(_0xc23c('0x4'));var rp=require(_0xc23c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc23c('0x6'));var config=require(_0xc23c('0x7'));var attributes=require(_0xc23c('0x8'));module[_0xc23c('0x9')]=function(_0x54c989,_0x40083f){return _0x54c989[_0xc23c('0xa')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index f695fa8..aae0774 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 _0xa4d0=['catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x1f8861,_0x418201){var _0x4679a0=function(_0x261c96){while(--_0x261c96){_0x1f8861['push'](_0x1f8861['shift']());}};_0x4679a0(++_0x418201);}(_0xa4d0,0x96));var _0x0a4d=function(_0xe7006e,_0x319423){_0xe7006e=_0xe7006e-0x0;var _0x30e482=_0xa4d0[_0xe7006e];return _0x30e482;};'use strict';var _=require(_0x0a4d('0x0'));var util=require(_0x0a4d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a4d('0x2'));var fs=require('fs');var Redis=require(_0x0a4d('0x3'));var db=require(_0x0a4d('0x4'))['db'];var utils=require(_0x0a4d('0x5'));var logger=require(_0x0a4d('0x6'))(_0x0a4d('0x7'));var config=require('../../config/environment');var jayson=require(_0x0a4d('0x8'));var client=jayson[_0x0a4d('0x9')][_0x0a4d('0xa')]({'port':0x232a});config[_0x0a4d('0xb')]=_[_0x0a4d('0xc')](config['redis'],{'host':_0x0a4d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a4d('0xb')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x30fd95,_0x2bc359,_0x52533f){return new BPromise(function(_0x65069c,_0x15f5bb){return client[_0x0a4d('0xe')](_0x30fd95,_0x52533f)[_0x0a4d('0xf')](function(_0x4069e9){logger[_0x0a4d('0x10')](_0x0a4d('0x11'),_0x2bc359,_0x0a4d('0x12'));logger[_0x0a4d('0x13')](_0x0a4d('0x14'),_0x2bc359,_0x0a4d('0x12'),JSON['stringify'](_0x4069e9));if(_0x4069e9[_0x0a4d('0x15')]){if(_0x4069e9[_0x0a4d('0x15')][_0x0a4d('0x16')]===0x1f4){logger[_0x0a4d('0x15')](_0x0a4d('0x11'),_0x2bc359,_0x4069e9[_0x0a4d('0x15')]['message']);return _0x15f5bb(_0x4069e9['error'][_0x0a4d('0x17')]);}logger[_0x0a4d('0x15')](_0x0a4d('0x11'),_0x2bc359,_0x4069e9[_0x0a4d('0x15')][_0x0a4d('0x17')]);return _0x65069c(_0x4069e9[_0x0a4d('0x15')][_0x0a4d('0x17')]);}else{logger['info'](_0x0a4d('0x11'),_0x2bc359,_0x0a4d('0x12'));_0x65069c(_0x4069e9[_0x0a4d('0x18')][_0x0a4d('0x17')]);}})[_0x0a4d('0x19')](function(_0x12ea79){logger[_0x0a4d('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2bc359,_0x12ea79);_0x15f5bb(_0x12ea79);});});}exports[_0x0a4d('0x1a')]=function(_0x176718){var _0x2181e0=this;return new Promise(function(_0xa978ad,_0x7fb7cd){return db[_0x0a4d('0x1b')]['findAll']({'raw':_0x176718[_0x0a4d('0x1c')]?_0x176718['options']['raw']===undefined?!![]:![]:!![],'where':_0x176718['options']?_0x176718[_0x0a4d('0x1c')]['where']||null:null,'attributes':[[db[_0x0a4d('0x1d')]['fn'](_0x0a4d('0x1e'),db[_0x0a4d('0x1d')]['fn']('IF',db['sequelize'][_0x0a4d('0x1f')](_0x0a4d('0x20')))),_0x0a4d('0x21')]]})[_0x0a4d('0xf')](function(_0x4b1046){logger[_0x0a4d('0x10')]('GetVoiceQueueRtPauses',_0x176718);logger[_0x0a4d('0x13')](_0x0a4d('0x1a'),_0x176718,JSON[_0x0a4d('0x22')](_0x4b1046));_0xa978ad(_0x4b1046);})[_0x0a4d('0x19')](function(_0x14dcba){logger['error'](_0x0a4d('0x1a'),_0x14dcba[_0x0a4d('0x17')],_0x176718);_0x7fb7cd(_0x2181e0[_0x0a4d('0x15')](0x1f4,_0x14dcba['message']));});});}; \ No newline at end of file +var _0x8bd5=['result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueueRt,\x20%s,\x20%s','message'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x8bd5,0x107));var _0x58bd=function(_0x3d9116,_0x555d1d){_0x3d9116=_0x3d9116-0x0;var _0x26688d=_0x8bd5[_0x3d9116];return _0x26688d;};'use strict';var _=require('lodash');var util=require(_0x58bd('0x0'));var moment=require(_0x58bd('0x1'));var BPromise=require(_0x58bd('0x2'));var rs=require(_0x58bd('0x3'));var fs=require('fs');var Redis=require(_0x58bd('0x4'));var db=require(_0x58bd('0x5'))['db'];var utils=require(_0x58bd('0x6'));var logger=require(_0x58bd('0x7'))(_0x58bd('0x8'));var config=require(_0x58bd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x58bd('0xa')][_0x58bd('0xb')]({'port':0x232a});config[_0x58bd('0xc')]=_['defaults'](config[_0x58bd('0xc')],{'host':_0x58bd('0xd'),'port':0x18eb});var socket=require(_0x58bd('0xe'))(new Redis(config['redis']));require(_0x58bd('0xf'))[_0x58bd('0x10')](socket);function respondWithRpcPromise(_0x54ec76,_0x2cea61,_0x5edb9b){return new BPromise(function(_0x27097b,_0x2bf746){return client['request'](_0x54ec76,_0x5edb9b)['then'](function(_0x4508f3){logger[_0x58bd('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2cea61,_0x58bd('0x12'));logger[_0x58bd('0x13')](_0x58bd('0x14'),_0x2cea61,'request\x20sent',JSON[_0x58bd('0x15')](_0x4508f3));if(_0x4508f3['error']){if(_0x4508f3['error']['code']===0x1f4){logger[_0x58bd('0x16')](_0x58bd('0x17'),_0x2cea61,_0x4508f3[_0x58bd('0x16')][_0x58bd('0x18')]);return _0x2bf746(_0x4508f3['error']['message']);}logger[_0x58bd('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2cea61,_0x4508f3['error'][_0x58bd('0x18')]);return _0x27097b(_0x4508f3[_0x58bd('0x16')][_0x58bd('0x18')]);}else{logger[_0x58bd('0x11')](_0x58bd('0x17'),_0x2cea61,_0x58bd('0x12'));_0x27097b(_0x4508f3[_0x58bd('0x19')][_0x58bd('0x18')]);}})[_0x58bd('0x1a')](function(_0x53819e){logger[_0x58bd('0x16')](_0x58bd('0x17'),_0x2cea61,_0x53819e);_0x2bf746(_0x53819e);});});}exports[_0x58bd('0x1b')]=function(_0x588417){var _0x2efd79=this;return new Promise(function(_0x3d6716,_0x343cc2){return db[_0x58bd('0x1c')]['findAll']({'raw':_0x588417[_0x58bd('0x1d')]?_0x588417['options'][_0x58bd('0x1e')]===undefined?!![]:![]:!![],'where':_0x588417[_0x58bd('0x1d')]?_0x588417[_0x58bd('0x1d')][_0x58bd('0x1f')]||null:null,'attributes':[[db[_0x58bd('0x20')]['fn'](_0x58bd('0x21'),db[_0x58bd('0x20')]['fn']('IF',db[_0x58bd('0x20')][_0x58bd('0x22')]('`paused`\x20=\x201,\x201,\x20null'))),_0x58bd('0x23')]]})['then'](function(_0x6bcd6a){logger[_0x58bd('0x11')](_0x58bd('0x1b'),_0x588417);logger[_0x58bd('0x13')](_0x58bd('0x1b'),_0x588417,JSON[_0x58bd('0x15')](_0x6bcd6a));_0x3d6716(_0x6bcd6a);})[_0x58bd('0x1a')](function(_0xa77f05){logger[_0x58bd('0x16')](_0x58bd('0x1b'),_0xa77f05['message'],_0x588417);_0x343cc2(_0x2efd79[_0x58bd('0x16')](0x1f4,_0xa77f05[_0x58bd('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index e53b889..c3a323b 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 _0x80c3=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','update','emit'];(function(_0x13a638,_0x45b543){var _0x21b5be=function(_0x58cd21){while(--_0x58cd21){_0x13a638['push'](_0x13a638['shift']());}};_0x21b5be(++_0x45b543);}(_0x80c3,0x18f));var _0x380c=function(_0x52b24f,_0xca062d){_0x52b24f=_0x52b24f-0x0;var _0x46ea6b=_0x80c3[_0x52b24f];return _0x46ea6b;};'use strict';var UserVoiceQueueRtEvents=require(_0x380c('0x0'));var events=['save','remove',_0x380c('0x1')];function createListener(_0x53f207,_0x3c1362){return function(_0x4202d4){_0x3c1362[_0x380c('0x2')](_0x53f207,_0x4202d4);};}function removeListener(_0x52fd7e,_0x565a08){return function(){UserVoiceQueueRtEvents['removeListener'](_0x52fd7e,_0x565a08);};}exports[_0x380c('0x3')]=function(_0x595b66){for(var _0x581c96=0x0,_0x332ed3=events[_0x380c('0x4')];_0x581c96<_0x332ed3;_0x581c96++){var _0x1cdbad=events[_0x581c96];var _0x59445f=createListener(_0x380c('0x5')+_0x1cdbad,_0x595b66);UserVoiceQueueRtEvents['on'](_0x1cdbad,_0x59445f);}}; \ No newline at end of file +var _0xd7ce=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7ce,0x16b));var _0xed7c=function(_0x32a767,_0x4e3e76){_0x32a767=_0x32a767-0x0;var _0x2b4e6d=_0xd7ce[_0x32a767];return _0x2b4e6d;};'use strict';var UserVoiceQueueRtEvents=require(_0xed7c('0x0'));var events=[_0xed7c('0x1'),_0xed7c('0x2'),_0xed7c('0x3')];function createListener(_0x4ce2a9,_0x4fe5c1){return function(_0x1230ec){_0x4fe5c1['emit'](_0x4ce2a9,_0x1230ec);};}function removeListener(_0x4a6138,_0x587c5a){return function(){UserVoiceQueueRtEvents[_0xed7c('0x4')](_0x4a6138,_0x587c5a);};}exports[_0xed7c('0x5')]=function(_0x194d4b){for(var _0x1aa7a0=0x0,_0x34bbd7=events[_0xed7c('0x6')];_0x1aa7a0<_0x34bbd7;_0x1aa7a0++){var _0x41afb9=events[_0x1aa7a0];var _0x270db6=createListener(_0xed7c('0x7')+_0x41afb9,_0x194d4b);UserVoiceQueueRtEvents['on'](_0x41afb9,_0x270db6);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index e036613..7ab0a90 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1f4e10,_0x1db2a1){var _0x4c9c4d=function(_0x2b21af){while(--_0x2b21af){_0x1f4e10['push'](_0x1f4e10['shift']());}};_0x4c9c4d(++_0x1db2a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x28383d,_0x4c101e){var _0x2e919e=function(_0x4080da){while(--_0x4080da){_0x28383d['push'](_0x28383d['shift']());}};_0x2e919e(++_0x4c101e);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 605072a..f93a00b 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 _0x44aa=['sequelize','INTEGER'];(function(_0xe84805,_0x2702d9){var _0x398efd=function(_0x37cfad){while(--_0x37cfad){_0xe84805['push'](_0xe84805['shift']());}};_0x398efd(++_0x2702d9);}(_0x44aa,0x100));var _0xa44a=function(_0x89e989,_0x47f65b){_0x89e989=_0x89e989-0x0;var _0x18ea2a=_0x44aa[_0x89e989];return _0x18ea2a;};'use strict';var Sequelize=require(_0xa44a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xa44a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4591=['exports','INTEGER'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4591,0x168));var _0x1459=function(_0x3e5dca,_0x50fe50){_0x3e5dca=_0x3e5dca-0x0;var _0x50e9a0=_0x4591[_0x3e5dca];return _0x50e9a0;};'use strict';var Sequelize=require('sequelize');module[_0x1459('0x0')]={'penalty':{'type':Sequelize[_0x1459('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index b413588..148fae6 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 _0xb837=['exports','define','user_has_whatsapp_queues','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5873a0,_0x4ce87c){var _0x2243ba=function(_0x232581){while(--_0x232581){_0x5873a0['push'](_0x5873a0['shift']());}};_0x2243ba(++_0x4ce87c);}(_0xb837,0x16b));var _0x7b83=function(_0x3324f9,_0x126ea2){_0x3324f9=_0x3324f9-0x0;var _0x4295b8=_0xb837[_0x3324f9];return _0x4295b8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7b83('0x0'));var moment=require('moment');var BPromise=require(_0x7b83('0x1'));var rp=require(_0x7b83('0x2'));var fs=require('fs');var path=require(_0x7b83('0x3'));var rimraf=require(_0x7b83('0x4'));var config=require(_0x7b83('0x5'));var attributes=require('./userWhatsappQueue.attributes');module[_0x7b83('0x6')]=function(_0x188351,_0x50b48a){return _0x188351[_0x7b83('0x7')]('UserWhatsappQueue',attributes,{'tableName':_0x7b83('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x581f=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','../../config/environment','exports','define'];(function(_0x1ac5e1,_0x43a483){var _0x3ae80e=function(_0x234518){while(--_0x234518){_0x1ac5e1['push'](_0x1ac5e1['shift']());}};_0x3ae80e(++_0x43a483);}(_0x581f,0x70));var _0xf581=function(_0x55a747,_0x50c122){_0x55a747=_0x55a747-0x0;var _0x2136b3=_0x581f[_0x55a747];return _0x2136b3;};'use strict';var _=require(_0xf581('0x0'));var util=require(_0xf581('0x1'));var logger=require(_0xf581('0x2'))('api');var moment=require(_0xf581('0x3'));var BPromise=require(_0xf581('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf581('0x5'));var attributes=require('./userWhatsappQueue.attributes');module[_0xf581('0x6')]=function(_0x1c1d3b,_0x12a606){return _0x1c1d3b[_0xf581('0x7')](_0xf581('0x8'),attributes,{'tableName':_0xf581('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index a1a0282..8fef4a3 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 _0x6678=['../../config/environment','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x1427ec,_0x1a47fd){var _0x3da3dd=function(_0x40ad46){while(--_0x40ad46){_0x1427ec['push'](_0x1427ec['shift']());}};_0x3da3dd(++_0x1a47fd);}(_0x6678,0x12c));var _0x8667=function(_0x71cd05,_0x36ac11){_0x71cd05=_0x71cd05-0x0;var _0x59c9e7=_0x6678[_0x71cd05];return _0x59c9e7;};'use strict';var _=require(_0x8667('0x0'));var util=require(_0x8667('0x1'));var moment=require(_0x8667('0x2'));var BPromise=require(_0x8667('0x3'));var rs=require(_0x8667('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8667('0x5'));var logger=require(_0x8667('0x6'))(_0x8667('0x7'));var config=require(_0x8667('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8667('0x9')][_0x8667('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7eb26b,_0x3853bd,_0x198c7e){return new BPromise(function(_0x5d9448,_0xc29e50){return client[_0x8667('0xb')](_0x7eb26b,_0x198c7e)[_0x8667('0xc')](function(_0x9010d4){logger[_0x8667('0xd')](_0x8667('0xe'),_0x3853bd,_0x8667('0xf'));logger['debug'](_0x8667('0x10'),_0x3853bd,_0x8667('0xf'),JSON[_0x8667('0x11')](_0x9010d4));if(_0x9010d4[_0x8667('0x12')]){if(_0x9010d4[_0x8667('0x12')]['code']===0x1f4){logger[_0x8667('0x12')](_0x8667('0xe'),_0x3853bd,_0x9010d4[_0x8667('0x12')][_0x8667('0x13')]);return _0xc29e50(_0x9010d4[_0x8667('0x12')][_0x8667('0x13')]);}logger[_0x8667('0x12')](_0x8667('0xe'),_0x3853bd,_0x9010d4[_0x8667('0x12')][_0x8667('0x13')]);return _0x5d9448(_0x9010d4[_0x8667('0x12')]['message']);}else{logger[_0x8667('0xd')](_0x8667('0xe'),_0x3853bd,'request\x20sent');_0x5d9448(_0x9010d4[_0x8667('0x14')]['message']);}})[_0x8667('0x15')](function(_0xc38198){logger[_0x8667('0x12')](_0x8667('0xe'),_0x3853bd,_0xc38198);_0xc29e50(_0xc38198);});});} \ No newline at end of file +var _0x31e8=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x23d957,_0x5d2176){var _0x568ff2=function(_0x6ad689){while(--_0x6ad689){_0x23d957['push'](_0x23d957['shift']());}};_0x568ff2(++_0x5d2176);}(_0x31e8,0x7c));var _0x831e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x31e8[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x831e('0x0'));var util=require(_0x831e('0x1'));var moment=require(_0x831e('0x2'));var BPromise=require(_0x831e('0x3'));var rs=require(_0x831e('0x4'));var fs=require('fs');var Redis=require(_0x831e('0x5'));var db=require(_0x831e('0x6'))['db'];var utils=require(_0x831e('0x7'));var logger=require(_0x831e('0x8'))(_0x831e('0x9'));var config=require('../../config/environment');var jayson=require(_0x831e('0xa'));var client=jayson[_0x831e('0xb')][_0x831e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20d659,_0x56954,_0x12d012){return new BPromise(function(_0x44dd3b,_0xa382dc){return client[_0x831e('0xd')](_0x20d659,_0x12d012)[_0x831e('0xe')](function(_0x2b08f0){logger[_0x831e('0xf')](_0x831e('0x10'),_0x56954,_0x831e('0x11'));logger['debug'](_0x831e('0x12'),_0x56954,_0x831e('0x11'),JSON['stringify'](_0x2b08f0));if(_0x2b08f0[_0x831e('0x13')]){if(_0x2b08f0[_0x831e('0x13')][_0x831e('0x14')]===0x1f4){logger[_0x831e('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x56954,_0x2b08f0[_0x831e('0x13')][_0x831e('0x15')]);return _0xa382dc(_0x2b08f0['error'][_0x831e('0x15')]);}logger[_0x831e('0x13')](_0x831e('0x10'),_0x56954,_0x2b08f0[_0x831e('0x13')][_0x831e('0x15')]);return _0x44dd3b(_0x2b08f0[_0x831e('0x13')][_0x831e('0x15')]);}else{logger[_0x831e('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x56954,_0x831e('0x11'));_0x44dd3b(_0x2b08f0[_0x831e('0x16')][_0x831e('0x15')]);}})[_0x831e('0x17')](function(_0x49e668){logger[_0x831e('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x56954,_0x49e668);_0xa382dc(_0x49e668);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 76a168b..1fb4293 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 _0xb647=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','exports','multer','util'];(function(_0x92c0fc,_0x3e1e82){var _0x1b6c66=function(_0x17caee){while(--_0x17caee){_0x92c0fc['push'](_0x92c0fc['shift']());}};_0x1b6c66(++_0x3e1e82);}(_0xb647,0xdb));var _0x7b64=function(_0x59556f,_0x53dbb6){_0x59556f=_0x59556f-0x0;var _0x4beec5=_0xb647[_0x59556f];return _0x4beec5;};'use strict';var multer=require(_0x7b64('0x0'));var util=require(_0x7b64('0x1'));var path=require(_0x7b64('0x2'));var timeout=require(_0x7b64('0x3'));var express=require(_0x7b64('0x4'));var router=express[_0x7b64('0x5')]();var fs_extra=require(_0x7b64('0x6'));var auth=require(_0x7b64('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7b64('0x8'));var controller=require('./variable.controller');router[_0x7b64('0x9')]('/',auth[_0x7b64('0xa')](),controller[_0x7b64('0xb')]);router[_0x7b64('0x9')](_0x7b64('0xc'),auth[_0x7b64('0xa')](),controller[_0x7b64('0xd')]);router[_0x7b64('0xe')]('/',auth[_0x7b64('0xa')](),controller['create']);router[_0x7b64('0xf')]('/:id',auth[_0x7b64('0xa')](),controller['update']);router['delete'](_0x7b64('0xc'),auth[_0x7b64('0xa')](),controller['destroy']);module[_0x7b64('0x10')]=router; \ No newline at end of file +var _0xae79=['put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','post','create'];(function(_0x15eb4e,_0x4d4b52){var _0x174ec1=function(_0x692e20){while(--_0x692e20){_0x15eb4e['push'](_0x15eb4e['shift']());}};_0x174ec1(++_0x4d4b52);}(_0xae79,0x1d3));var _0x9ae7=function(_0xce8318,_0xef5995){_0xce8318=_0xce8318-0x0;var _0x3fcd7e=_0xae79[_0xce8318];return _0x3fcd7e;};'use strict';var multer=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var path=require(_0x9ae7('0x2'));var timeout=require(_0x9ae7('0x3'));var express=require(_0x9ae7('0x4'));var router=express[_0x9ae7('0x5')]();var fs_extra=require(_0x9ae7('0x6'));var auth=require(_0x9ae7('0x7'));var interaction=require(_0x9ae7('0x8'));var config=require(_0x9ae7('0x9'));var controller=require(_0x9ae7('0xa'));router[_0x9ae7('0xb')]('/',auth[_0x9ae7('0xc')](),controller[_0x9ae7('0xd')]);router[_0x9ae7('0xb')]('/:id',auth[_0x9ae7('0xc')](),controller[_0x9ae7('0xe')]);router[_0x9ae7('0xf')]('/',auth[_0x9ae7('0xc')](),controller[_0x9ae7('0x10')]);router[_0x9ae7('0x11')]('/:id',auth[_0x9ae7('0xc')](),controller['update']);router[_0x9ae7('0x12')](_0x9ae7('0x13'),auth[_0x9ae7('0xc')](),controller[_0x9ae7('0x14')]);module[_0x9ae7('0x15')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index bb00100..588c779 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 _0x1e6f=['sequelize','exports','name','STRING'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0x1e6f,0x13c));var _0xf1e6=function(_0x315546,_0x5dc0cf){_0x315546=_0x315546-0x0;var _0x2b758e=_0x1e6f[_0x315546];return _0x2b758e;};'use strict';var Sequelize=require(_0xf1e6('0x0'));module[_0xf1e6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf1e6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf1e6('0x3')]}}; \ No newline at end of file +var _0xbe43=['STRING','sequelize'];(function(_0x1bfbad,_0x2494c7){var _0x45d7e5=function(_0x1031c9){while(--_0x1031c9){_0x1bfbad['push'](_0x1bfbad['shift']());}};_0x45d7e5(++_0x2494c7);}(_0xbe43,0xbb));var _0x3be4=function(_0x323e3d,_0x27c504){_0x323e3d=_0x323e3d-0x0;var _0x941c8c=_0xbe43[_0x323e3d];return _0x941c8c;};'use strict';var Sequelize=require(_0x3be4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3be4('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 1727e15..529046a 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 _0xc10a=['UserProfileResource','stack','name','send','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','error','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','reject','save','update','then','Variables'];(function(_0xa7386a,_0xbafeb8){var _0x1a4cd9=function(_0x545714){while(--_0x545714){_0xa7386a['push'](_0xa7386a['shift']());}};_0x1a4cd9(++_0xbafeb8);}(_0xc10a,0x16b));var _0xac10=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0xc10a[_0x2f87cd];return _0x5d7eda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac10('0x0'));var zipdir=require(_0xac10('0x1'));var jsonpatch=require(_0xac10('0x2'));var rp=require(_0xac10('0x3'));var moment=require(_0xac10('0x4'));var BPromise=require(_0xac10('0x5'));var Mustache=require('mustache');var util=require(_0xac10('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xac10('0x7'));var ejs=require(_0xac10('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac10('0x9'));var squel=require(_0xac10('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xac10('0xb'));var toCsv=require('to-csv');var querystring=require(_0xac10('0xc'));var Papa=require(_0xac10('0xd'));var Redis=require(_0xac10('0xe'));var authService=require(_0xac10('0xf'));var qs=require(_0xac10('0x10'));var as=require(_0xac10('0x11'));var hardwareService=require(_0xac10('0x12'));var logger=require(_0xac10('0x13'))(_0xac10('0x14'));var utils=require(_0xac10('0x15'));var config=require(_0xac10('0x16'));var licenseUtil=require(_0xac10('0x17'));var db=require(_0xac10('0x18'))['db'];function respondWithStatusCode(_0x51191f,_0x74a2f6){_0x74a2f6=_0x74a2f6||0xcc;return function(_0x5c724b){if(_0x5c724b){return _0x51191f[_0xac10('0x19')](_0x74a2f6);}return _0x51191f[_0xac10('0x1a')](_0x74a2f6)[_0xac10('0x1b')]();};}function respondWithResult(_0x309b65,_0x2fd360){_0x2fd360=_0x2fd360||0xc8;return function(_0x4a7164){if(_0x4a7164){return _0x309b65[_0xac10('0x1a')](_0x2fd360)[_0xac10('0x1c')](_0x4a7164);}};}function respondWithFilteredResult(_0x5a84d3,_0x485633){return function(_0x55d212){if(_0x55d212){var _0xedab94=typeof _0x485633[_0xac10('0x1d')]===_0xac10('0x1e')&&typeof _0x485633['limit']===_0xac10('0x1e');var _0x5b7278=_0x55d212[_0xac10('0x1f')];var _0x19fe80=_0xedab94?0x0:_0x485633[_0xac10('0x1d')];var _0x110976=_0xedab94?_0x55d212[_0xac10('0x1f')]:_0x485633[_0xac10('0x1d')]+_0x485633['limit'];var _0x1ae0b8;if(_0x110976>=_0x5b7278){_0x110976=_0x5b7278;_0x1ae0b8=0xc8;}else{_0x1ae0b8=0xce;}_0x5a84d3[_0xac10('0x1a')](_0x1ae0b8);return _0x5a84d3['set']('Content-Range',_0x19fe80+'-'+_0x110976+'/'+_0x5b7278)[_0xac10('0x1c')](_0x55d212);}return null;};}function patchUpdates(_0x41d1d0){return function(_0x525073){try{jsonpatch['apply'](_0x525073,_0x41d1d0,!![]);}catch(_0xd1d356){return BPromise[_0xac10('0x20')](_0xd1d356);}return _0x525073[_0xac10('0x21')]();};}function saveUpdates(_0x2dd5ee,_0x40a510){return function(_0xbc0b9e){if(_0xbc0b9e){return _0xbc0b9e[_0xac10('0x22')](_0x2dd5ee)[_0xac10('0x23')](function(_0x2fb910){return _0x2fb910;});}return null;};}function removeEntity(_0x414c39,_0x3f5a52){return function(_0x2c7043){if(_0x2c7043){return _0x2c7043['destroy']()[_0xac10('0x23')](function(){var _0xbbb8a=_0x2c7043['get']({'plain':!![]});var _0x197424=_0xac10('0x24');return db[_0xac10('0x25')]['destroy']({'where':{'type':_0x197424,'resourceId':_0xbbb8a['id']}})['then'](function(){return _0x2c7043;});})[_0xac10('0x23')](function(){_0x414c39[_0xac10('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11d010,_0xcb1059){return function(_0x2d502f){if(!_0x2d502f){_0x11d010['sendStatus'](0x194);}return _0x2d502f;};}function handleError(_0x2b8585,_0x85725b){_0x85725b=_0x85725b||0x1f4;return function(_0x4f1745){logger['error'](_0x4f1745[_0xac10('0x26')]);if(_0x4f1745['name']){delete _0x4f1745[_0xac10('0x27')];}_0x2b8585[_0xac10('0x1a')](_0x85725b)[_0xac10('0x28')](_0x4f1745);};}exports['index']=function(_0x43932b,_0x40040d){var _0x6e99fd={},_0x12c004={},_0x2609ce={'count':0x0,'rows':[]};var _0x2ca143=_[_0xac10('0x29')](db[_0xac10('0x2a')][_0xac10('0x2b')],function(_0x158a61){return{'name':_0x158a61[_0xac10('0x2c')],'type':_0x158a61[_0xac10('0x2d')][_0xac10('0x2e')]};});_0x12c004[_0xac10('0x2f')]=_[_0xac10('0x29')](_0x2ca143,'name');_0x12c004[_0xac10('0x30')]=_[_0xac10('0x31')](_0x43932b[_0xac10('0x30')]);_0x12c004[_0xac10('0x32')]=_['intersection'](_0x12c004['model'],_0x12c004[_0xac10('0x30')]);_0x6e99fd[_0xac10('0x33')]=_[_0xac10('0x34')](_0x12c004['model'],qs[_0xac10('0x35')](_0x43932b[_0xac10('0x30')][_0xac10('0x35')]));_0x6e99fd[_0xac10('0x33')]=_0x6e99fd[_0xac10('0x33')][_0xac10('0x36')]?_0x6e99fd[_0xac10('0x33')]:_0x12c004[_0xac10('0x2f')];if(!_0x43932b['query']['hasOwnProperty'](_0xac10('0x37'))){_0x6e99fd[_0xac10('0x38')]=qs[_0xac10('0x38')](_0x43932b['query'][_0xac10('0x38')]);_0x6e99fd['offset']=qs[_0xac10('0x1d')](_0x43932b[_0xac10('0x30')][_0xac10('0x1d')]);}_0x6e99fd['order']=qs[_0xac10('0x39')](_0x43932b[_0xac10('0x30')]['sort']);_0x6e99fd[_0xac10('0x3a')]=qs[_0xac10('0x32')](_[_0xac10('0x3b')](_0x43932b[_0xac10('0x30')],_0x12c004[_0xac10('0x32')]),_0x2ca143);if(_0x43932b['query'][_0xac10('0x3c')]){_0x6e99fd[_0xac10('0x3a')]=_[_0xac10('0x3d')](_0x6e99fd[_0xac10('0x3a')],{'$or':_[_0xac10('0x29')](_0x2ca143,function(_0x4a5e20){if(_0x4a5e20['type']!==_0xac10('0x3e')){var _0x3fe4f8={};_0x3fe4f8[_0x4a5e20[_0xac10('0x27')]]={'$like':'%'+_0x43932b[_0xac10('0x30')][_0xac10('0x3c')]+'%'};return _0x3fe4f8;}})});}_0x6e99fd=_[_0xac10('0x3d')]({},_0x6e99fd,_0x43932b[_0xac10('0x3f')]);var _0x57fd61={'where':_0x6e99fd[_0xac10('0x3a')]};return db[_0xac10('0x2a')]['count'](_0x57fd61)[_0xac10('0x23')](function(_0x1199f3){_0x2609ce['count']=_0x1199f3;if(_0x43932b[_0xac10('0x30')][_0xac10('0x40')]){_0x6e99fd[_0xac10('0x41')]=[{'all':!![]}];}return db[_0xac10('0x2a')][_0xac10('0x42')](_0x6e99fd);})[_0xac10('0x23')](function(_0x1ec97c){_0x2609ce[_0xac10('0x43')]=_0x1ec97c;return _0x2609ce;})[_0xac10('0x23')](respondWithFilteredResult(_0x40040d,_0x6e99fd))['catch'](handleError(_0x40040d,null));};exports['show']=function(_0x80a2f5,_0x28c5c4){var _0x5cef8f={'raw':!![],'where':{'id':_0x80a2f5[_0xac10('0x44')]['id']}},_0x5ddd22={};_0x5ddd22['model']=_[_0xac10('0x31')](db[_0xac10('0x2a')][_0xac10('0x2b')]);_0x5ddd22[_0xac10('0x30')]=_[_0xac10('0x31')](_0x80a2f5['query']);_0x5ddd22[_0xac10('0x32')]=_[_0xac10('0x34')](_0x5ddd22[_0xac10('0x2f')],_0x5ddd22['query']);_0x5cef8f['attributes']=_[_0xac10('0x34')](_0x5ddd22[_0xac10('0x2f')],qs[_0xac10('0x35')](_0x80a2f5['query'][_0xac10('0x35')]));_0x5cef8f['attributes']=_0x5cef8f[_0xac10('0x33')][_0xac10('0x36')]?_0x5cef8f[_0xac10('0x33')]:_0x5ddd22[_0xac10('0x2f')];if(_0x80a2f5[_0xac10('0x30')]['includeAll']){_0x5cef8f[_0xac10('0x41')]=[{'all':!![]}];}_0x5cef8f=_[_0xac10('0x3d')]({},_0x5cef8f,_0x80a2f5[_0xac10('0x3f')]);return db[_0xac10('0x2a')][_0xac10('0x45')](_0x5cef8f)[_0xac10('0x23')](handleEntityNotFound(_0x28c5c4,null))[_0xac10('0x23')](respondWithResult(_0x28c5c4,null))[_0xac10('0x46')](handleError(_0x28c5c4,null));};exports[_0xac10('0x47')]=function(_0x1ce983,_0x520509){return db[_0xac10('0x2a')][_0xac10('0x47')](_0x1ce983['body'],{})[_0xac10('0x23')](function(_0x5941ac){var _0x159b36=_0x1ce983['user'][_0xac10('0x48')]({'plain':!![]});if(!_0x159b36)throw new Error(_0xac10('0x49'));if(_0x159b36['role']===_0xac10('0x4a')){var _0x1df610=_0x5941ac[_0xac10('0x48')]({'plain':!![]});var _0x29fdfb=_0xac10('0x24');return db[_0xac10('0x4b')][_0xac10('0x45')]({'where':{'name':_0x29fdfb,'userProfileId':_0x159b36['userProfileId']},'raw':!![]})['then'](function(_0x553c06){if(_0x553c06&&_0x553c06[_0xac10('0x4c')]===0x0){return db[_0xac10('0x25')]['create']({'name':_0x1df610[_0xac10('0x27')],'resourceId':_0x1df610['id'],'type':_0x553c06[_0xac10('0x27')],'sectionId':_0x553c06['id']},{})['then'](function(){return _0x5941ac;});}else{return _0x5941ac;}})['catch'](function(_0x81c9f6){logger[_0xac10('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x81c9f6);throw _0x81c9f6;});}return _0x5941ac;})[_0xac10('0x23')](respondWithResult(_0x520509,0xc9))[_0xac10('0x46')](handleError(_0x520509,null));};exports[_0xac10('0x22')]=function(_0x1bc6e4,_0x5a9242){if(_0x1bc6e4[_0xac10('0x4e')]['id']){delete _0x1bc6e4[_0xac10('0x4e')]['id'];}return db['Variable'][_0xac10('0x45')]({'where':{'id':_0x1bc6e4[_0xac10('0x44')]['id']}})['then'](handleEntityNotFound(_0x5a9242,null))[_0xac10('0x23')](saveUpdates(_0x1bc6e4[_0xac10('0x4e')],null))[_0xac10('0x23')](respondWithResult(_0x5a9242,null))['catch'](handleError(_0x5a9242,null));};exports[_0xac10('0x4f')]=function(_0x1b874d,_0x2216b8){return db[_0xac10('0x2a')][_0xac10('0x45')]({'where':{'id':_0x1b874d['params']['id']}})[_0xac10('0x23')](handleEntityNotFound(_0x2216b8,null))[_0xac10('0x23')](removeEntity(_0x2216b8,null))['catch'](handleError(_0x2216b8,null));}; \ No newline at end of file +var _0x2a28=['undefined','limit','count','Content-Range','apply','reject','then','destroy','get','Variables','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','Variable','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0x3986fc,_0x41fd49){var _0x514bd1=function(_0x4f038f){while(--_0x4f038f){_0x3986fc['push'](_0x3986fc['shift']());}};_0x514bd1(++_0x41fd49);}(_0x2a28,0x1e3));var _0x82a2=function(_0x2490a9,_0x182636){_0x2490a9=_0x2490a9-0x0;var _0x3552f9=_0x2a28[_0x2490a9];return _0x3552f9;};'use strict';var emlformat=require(_0x82a2('0x0'));var rimraf=require(_0x82a2('0x1'));var zipdir=require(_0x82a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x82a2('0x3'));var moment=require(_0x82a2('0x4'));var BPromise=require(_0x82a2('0x5'));var Mustache=require(_0x82a2('0x6'));var util=require('util');var path=require('path');var sox=require(_0x82a2('0x7'));var csv=require(_0x82a2('0x8'));var ejs=require(_0x82a2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x82a2('0xa'));var deskjs=require(_0x82a2('0xb'));var toCsv=require(_0x82a2('0x8'));var querystring=require(_0x82a2('0xc'));var Papa=require(_0x82a2('0xd'));var Redis=require('ioredis');var authService=require(_0x82a2('0xe'));var qs=require(_0x82a2('0xf'));var as=require(_0x82a2('0x10'));var hardwareService=require(_0x82a2('0x11'));var logger=require(_0x82a2('0x12'))(_0x82a2('0x13'));var utils=require(_0x82a2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x82a2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x291f8c,_0x50165f){_0x50165f=_0x50165f||0xcc;return function(_0x5109a6){if(_0x5109a6){return _0x291f8c[_0x82a2('0x16')](_0x50165f);}return _0x291f8c[_0x82a2('0x17')](_0x50165f)[_0x82a2('0x18')]();};}function respondWithResult(_0x1b56c5,_0xdb9d96){_0xdb9d96=_0xdb9d96||0xc8;return function(_0x49e919){if(_0x49e919){return _0x1b56c5[_0x82a2('0x17')](_0xdb9d96)[_0x82a2('0x19')](_0x49e919);}};}function respondWithFilteredResult(_0x7f8e15,_0x31317e){return function(_0x3be5b8){if(_0x3be5b8){var _0x4e3cce=typeof _0x31317e[_0x82a2('0x1a')]===_0x82a2('0x1b')&&typeof _0x31317e[_0x82a2('0x1c')]===_0x82a2('0x1b');var _0x5774e1=_0x3be5b8[_0x82a2('0x1d')];var _0x5a6c6e=_0x4e3cce?0x0:_0x31317e['offset'];var _0x3dd57f=_0x4e3cce?_0x3be5b8[_0x82a2('0x1d')]:_0x31317e[_0x82a2('0x1a')]+_0x31317e['limit'];var _0x446abe;if(_0x3dd57f>=_0x5774e1){_0x3dd57f=_0x5774e1;_0x446abe=0xc8;}else{_0x446abe=0xce;}_0x7f8e15[_0x82a2('0x17')](_0x446abe);return _0x7f8e15['set'](_0x82a2('0x1e'),_0x5a6c6e+'-'+_0x3dd57f+'/'+_0x5774e1)[_0x82a2('0x19')](_0x3be5b8);}return null;};}function patchUpdates(_0x251e17){return function(_0x3765bd){try{jsonpatch[_0x82a2('0x1f')](_0x3765bd,_0x251e17,!![]);}catch(_0x247340){return BPromise[_0x82a2('0x20')](_0x247340);}return _0x3765bd['save']();};}function saveUpdates(_0x49bfd6,_0x2d6f0c){return function(_0x23901d){if(_0x23901d){return _0x23901d['update'](_0x49bfd6)[_0x82a2('0x21')](function(_0x3391b4){return _0x3391b4;});}return null;};}function removeEntity(_0x2bcc4e,_0x493fd7){return function(_0x236e9f){if(_0x236e9f){return _0x236e9f[_0x82a2('0x22')]()[_0x82a2('0x21')](function(){var _0x1b5f27=_0x236e9f[_0x82a2('0x23')]({'plain':!![]});var _0xe48395=_0x82a2('0x24');return db[_0x82a2('0x25')][_0x82a2('0x22')]({'where':{'type':_0xe48395,'resourceId':_0x1b5f27['id']}})[_0x82a2('0x21')](function(){return _0x236e9f;});})[_0x82a2('0x21')](function(){_0x2bcc4e['status'](0xcc)[_0x82a2('0x18')]();});}};}function handleEntityNotFound(_0x509485,_0x34e72c){return function(_0x47a224){if(!_0x47a224){_0x509485[_0x82a2('0x16')](0x194);}return _0x47a224;};}function handleError(_0x39742d,_0x4df84f){_0x4df84f=_0x4df84f||0x1f4;return function(_0x1f5248){logger['error'](_0x1f5248[_0x82a2('0x26')]);if(_0x1f5248[_0x82a2('0x27')]){delete _0x1f5248[_0x82a2('0x27')];}_0x39742d['status'](_0x4df84f)[_0x82a2('0x28')](_0x1f5248);};}exports[_0x82a2('0x29')]=function(_0xd35d01,_0xb0e200){var _0x1d2942={},_0x1f4060={},_0x1b1a3e={'count':0x0,'rows':[]};var _0x515310=_[_0x82a2('0x2a')](db['Variable'][_0x82a2('0x2b')],function(_0x1df888){return{'name':_0x1df888[_0x82a2('0x2c')],'type':_0x1df888['type'][_0x82a2('0x2d')]};});_0x1f4060[_0x82a2('0x2e')]=_[_0x82a2('0x2a')](_0x515310,_0x82a2('0x27'));_0x1f4060[_0x82a2('0x2f')]=_[_0x82a2('0x30')](_0xd35d01[_0x82a2('0x2f')]);_0x1f4060[_0x82a2('0x31')]=_[_0x82a2('0x32')](_0x1f4060['model'],_0x1f4060['query']);_0x1d2942[_0x82a2('0x33')]=_[_0x82a2('0x32')](_0x1f4060['model'],qs[_0x82a2('0x34')](_0xd35d01[_0x82a2('0x2f')][_0x82a2('0x34')]));_0x1d2942[_0x82a2('0x33')]=_0x1d2942[_0x82a2('0x33')][_0x82a2('0x35')]?_0x1d2942[_0x82a2('0x33')]:_0x1f4060[_0x82a2('0x2e')];if(!_0xd35d01[_0x82a2('0x2f')][_0x82a2('0x36')](_0x82a2('0x37'))){_0x1d2942[_0x82a2('0x1c')]=qs[_0x82a2('0x1c')](_0xd35d01[_0x82a2('0x2f')][_0x82a2('0x1c')]);_0x1d2942['offset']=qs[_0x82a2('0x1a')](_0xd35d01[_0x82a2('0x2f')][_0x82a2('0x1a')]);}_0x1d2942[_0x82a2('0x38')]=qs[_0x82a2('0x39')](_0xd35d01['query'][_0x82a2('0x39')]);_0x1d2942['where']=qs[_0x82a2('0x31')](_[_0x82a2('0x3a')](_0xd35d01[_0x82a2('0x2f')],_0x1f4060[_0x82a2('0x31')]),_0x515310);if(_0xd35d01['query'][_0x82a2('0x3b')]){_0x1d2942[_0x82a2('0x3c')]=_[_0x82a2('0x3d')](_0x1d2942['where'],{'$or':_['map'](_0x515310,function(_0x30515e){if(_0x30515e[_0x82a2('0x3e')]!==_0x82a2('0x3f')){var _0x1cb38d={};_0x1cb38d[_0x30515e[_0x82a2('0x27')]]={'$like':'%'+_0xd35d01[_0x82a2('0x2f')][_0x82a2('0x3b')]+'%'};return _0x1cb38d;}})});}_0x1d2942=_[_0x82a2('0x3d')]({},_0x1d2942,_0xd35d01[_0x82a2('0x40')]);var _0xf8d369={'where':_0x1d2942['where']};return db[_0x82a2('0x41')][_0x82a2('0x1d')](_0xf8d369)[_0x82a2('0x21')](function(_0x15f454){_0x1b1a3e['count']=_0x15f454;if(_0xd35d01['query'][_0x82a2('0x42')]){_0x1d2942[_0x82a2('0x43')]=[{'all':!![]}];}return db['Variable'][_0x82a2('0x44')](_0x1d2942);})[_0x82a2('0x21')](function(_0x265c88){_0x1b1a3e[_0x82a2('0x45')]=_0x265c88;return _0x1b1a3e;})[_0x82a2('0x21')](respondWithFilteredResult(_0xb0e200,_0x1d2942))[_0x82a2('0x46')](handleError(_0xb0e200,null));};exports[_0x82a2('0x47')]=function(_0x15eb9a,_0x485c06){var _0x328b10={'raw':!![],'where':{'id':_0x15eb9a[_0x82a2('0x48')]['id']}},_0x1d7c3d={};_0x1d7c3d[_0x82a2('0x2e')]=_['keys'](db[_0x82a2('0x41')]['rawAttributes']);_0x1d7c3d[_0x82a2('0x2f')]=_[_0x82a2('0x30')](_0x15eb9a[_0x82a2('0x2f')]);_0x1d7c3d[_0x82a2('0x31')]=_[_0x82a2('0x32')](_0x1d7c3d[_0x82a2('0x2e')],_0x1d7c3d['query']);_0x328b10[_0x82a2('0x33')]=_[_0x82a2('0x32')](_0x1d7c3d['model'],qs['fields'](_0x15eb9a[_0x82a2('0x2f')][_0x82a2('0x34')]));_0x328b10[_0x82a2('0x33')]=_0x328b10['attributes']['length']?_0x328b10[_0x82a2('0x33')]:_0x1d7c3d['model'];if(_0x15eb9a['query']['includeAll']){_0x328b10[_0x82a2('0x43')]=[{'all':!![]}];}_0x328b10=_[_0x82a2('0x3d')]({},_0x328b10,_0x15eb9a[_0x82a2('0x40')]);return db[_0x82a2('0x41')]['find'](_0x328b10)['then'](handleEntityNotFound(_0x485c06,null))[_0x82a2('0x21')](respondWithResult(_0x485c06,null))[_0x82a2('0x46')](handleError(_0x485c06,null));};exports[_0x82a2('0x49')]=function(_0x12f843,_0x4cb679){return db[_0x82a2('0x41')][_0x82a2('0x49')](_0x12f843[_0x82a2('0x4a')],{})[_0x82a2('0x21')](function(_0x546477){var _0x40c468=_0x12f843[_0x82a2('0x4b')][_0x82a2('0x23')]({'plain':!![]});if(!_0x40c468)throw new Error(_0x82a2('0x4c'));if(_0x40c468[_0x82a2('0x4d')]===_0x82a2('0x4b')){var _0x3be91a=_0x546477[_0x82a2('0x23')]({'plain':!![]});var _0x530159=_0x82a2('0x24');return db[_0x82a2('0x4e')][_0x82a2('0x4f')]({'where':{'name':_0x530159,'userProfileId':_0x40c468[_0x82a2('0x50')]},'raw':!![]})[_0x82a2('0x21')](function(_0x83f8fd){if(_0x83f8fd&&_0x83f8fd[_0x82a2('0x51')]===0x0){return db[_0x82a2('0x25')][_0x82a2('0x49')]({'name':_0x3be91a['name'],'resourceId':_0x3be91a['id'],'type':_0x83f8fd[_0x82a2('0x27')],'sectionId':_0x83f8fd['id']},{})['then'](function(){return _0x546477;});}else{return _0x546477;}})[_0x82a2('0x46')](function(_0x51de32){logger[_0x82a2('0x52')](_0x82a2('0x53'),_0x51de32);throw _0x51de32;});}return _0x546477;})[_0x82a2('0x21')](respondWithResult(_0x4cb679,0xc9))[_0x82a2('0x46')](handleError(_0x4cb679,null));};exports[_0x82a2('0x54')]=function(_0x3f418c,_0x5c7313){if(_0x3f418c[_0x82a2('0x4a')]['id']){delete _0x3f418c[_0x82a2('0x4a')]['id'];}return db['Variable'][_0x82a2('0x4f')]({'where':{'id':_0x3f418c[_0x82a2('0x48')]['id']}})[_0x82a2('0x21')](handleEntityNotFound(_0x5c7313,null))[_0x82a2('0x21')](saveUpdates(_0x3f418c[_0x82a2('0x4a')],null))[_0x82a2('0x21')](respondWithResult(_0x5c7313,null))['catch'](handleError(_0x5c7313,null));};exports[_0x82a2('0x22')]=function(_0x192dd5,_0x48c239){return db[_0x82a2('0x41')][_0x82a2('0x4f')]({'where':{'id':_0x192dd5[_0x82a2('0x48')]['id']}})[_0x82a2('0x21')](handleEntityNotFound(_0x48c239,null))[_0x82a2('0x21')](removeEntity(_0x48c239,null))[_0x82a2('0x46')](handleError(_0x48c239,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 3301e66..8ec01de 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 _0xdf38=['rimraf','./variable.attributes','exports','define','Variable','tools_variables','util','../../config/logger','api','moment','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf38,0x1be));var _0x8df3=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xdf38[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var util=require(_0x8df3('0x0'));var logger=require(_0x8df3('0x1'))(_0x8df3('0x2'));var moment=require(_0x8df3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8df3('0x4'));var rimraf=require(_0x8df3('0x5'));var config=require('../../config/environment');var attributes=require(_0x8df3('0x6'));module[_0x8df3('0x7')]=function(_0x180d7a,_0x3b8437){return _0x180d7a[_0x8df3('0x8')](_0x8df3('0x9'),attributes,{'tableName':_0x8df3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69c4=['./variable.attributes','exports','define','Variable','lodash','util','../../config/logger','moment'];(function(_0x36f243,_0x188505){var _0x426436=function(_0x1c8622){while(--_0x1c8622){_0x36f243['push'](_0x36f243['shift']());}};_0x426436(++_0x188505);}(_0x69c4,0x1d4));var _0x469c=function(_0x5ad9a4,_0x59fd88){_0x5ad9a4=_0x5ad9a4-0x0;var _0x293417=_0x69c4[_0x5ad9a4];return _0x293417;};'use strict';var _=require(_0x469c('0x0'));var util=require(_0x469c('0x1'));var logger=require(_0x469c('0x2'))('api');var moment=require(_0x469c('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('../../config/environment');var attributes=require(_0x469c('0x4'));module[_0x469c('0x5')]=function(_0x283b6c,_0x26e023){return _0x283b6c[_0x469c('0x6')](_0x469c('0x7'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 5007fa8..26a6b29 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 _0x8ef6=['result','catch','Variable','find','options','raw','include','model','attributes','map','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x59db19,_0x30c1c6){var _0x5f0f09=function(_0x36e225){while(--_0x36e225){_0x59db19['push'](_0x59db19['shift']());}};_0x5f0f09(++_0x30c1c6);}(_0x8ef6,0xf2));var _0x68ef=function(_0x599228,_0x33262c){_0x599228=_0x599228-0x0;var _0x513c48=_0x8ef6[_0x599228];return _0x513c48;};'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')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['ShowVariable']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]?_['map'](_0x2633c1['options']['include'],function(_0x26018d){return{'model':db[_0x26018d[_0x68ef('0x1d')]],'as':_0x26018d['as'],'attributes':_0x26018d[_0x68ef('0x1e')],'include':_0x26018d[_0x68ef('0x1c')]?_[_0x68ef('0x1f')](_0x26018d[_0x68ef('0x1c')],function(_0x258cd5){return{'model':db[_0x258cd5[_0x68ef('0x1d')]],'as':_0x258cd5['as'],'attributes':_0x258cd5[_0x68ef('0x1e')],'include':_0x258cd5[_0x68ef('0x1c')]?_['map'](_0x258cd5[_0x68ef('0x1c')],function(_0x57f9ee){return{'model':db[_0x57f9ee['model']],'as':_0x57f9ee['as'],'attributes':_0x57f9ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x268f32){logger[_0x68ef('0xd')](_0x68ef('0x20'),_0x2633c1);logger['debug']('ShowVariable',_0x2633c1,JSON[_0x68ef('0x12')](_0x268f32));_0x4ade0d(_0x268f32);})[_0x68ef('0x17')](function(_0x7bf96){logger[_0x68ef('0x13')](_0x68ef('0x20'),_0x7bf96[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x7bf96[_0x68ef('0x15')]));});});}; \ No newline at end of file +var _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x5368d5,_0x19c1f2){var _0x5b5449=function(_0x22e396){while(--_0x22e396){_0x5368d5['push'](_0x5368d5['shift']());}};_0x5b5449(++_0x19c1f2);}(_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']('Variable,\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);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 641d401..7546eb3 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 _0x9182=['canUpdate','/reset','reset','/restart','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated'];(function(_0x1493c8,_0x32c455){var _0x1eb439=function(_0x14e6d4){while(--_0x14e6d4){_0x1493c8['push'](_0x1493c8['shift']());}};_0x1eb439(++_0x32c455);}(_0x9182,0x1b8));var _0x2918=function(_0x4a8bc8,_0x10a34a){_0x4a8bc8=_0x4a8bc8-0x0;var _0x20c655=_0x9182[_0x4a8bc8];return _0x20c655;};'use strict';var express=require(_0x2918('0x0'));var router=express[_0x2918('0x1')]();var auth=require(_0x2918('0x2'));var controller=require(_0x2918('0x3'));router[_0x2918('0x4')]('/',controller[_0x2918('0x5')]);router[_0x2918('0x4')](_0x2918('0x6'),auth[_0x2918('0x7')](),auth[_0x2918('0x8')](),controller['fetch']);router[_0x2918('0x4')](_0x2918('0x9'),auth[_0x2918('0x7')](),auth[_0x2918('0x8')](),controller[_0x2918('0xa')]);router[_0x2918('0x4')]('/pull',auth['isAuthenticated'](),auth[_0x2918('0x8')](),controller['pull']);router['get'](_0x2918('0xb'),auth['isAuthenticated'](),controller['restart']);router[_0x2918('0x4')]('/migrations',controller[_0x2918('0xc')]);module[_0x2918('0xd')]=router; \ No newline at end of file +var _0x84ce=['pull','/restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull'];(function(_0x10fd65,_0x2d6ca4){var _0x4c5954=function(_0x3ccdfa){while(--_0x3ccdfa){_0x10fd65['push'](_0x10fd65['shift']());}};_0x4c5954(++_0x2d6ca4);}(_0x84ce,0x137));var _0xe84c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x84ce[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0xe84c('0x0'));var router=express[_0xe84c('0x1')]();var auth=require(_0xe84c('0x2'));var controller=require(_0xe84c('0x3'));router[_0xe84c('0x4')]('/',controller[_0xe84c('0x5')]);router['get'](_0xe84c('0x6'),auth[_0xe84c('0x7')](),auth[_0xe84c('0x8')](),controller[_0xe84c('0x9')]);router[_0xe84c('0x4')](_0xe84c('0xa'),auth[_0xe84c('0x7')](),auth[_0xe84c('0x8')](),controller[_0xe84c('0xb')]);router['get'](_0xe84c('0xc'),auth[_0xe84c('0x7')](),auth[_0xe84c('0x8')](),controller[_0xe84c('0xd')]);router[_0xe84c('0x4')](_0xe84c('0xe'),auth['isAuthenticated'](),controller['restart']);router[_0xe84c('0x4')](_0xe84c('0xf'),controller[_0xe84c('0x10')]);module[_0xe84c('0x11')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 0d0ed9d..09ffd83 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 _0x111f=['replace','.js','push','length','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','then','last','join','catch','sequelize','Database\x20already\x20up-to-date','umzug','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','query','latest','fetch','2.0.0','status','json','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','server'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x111f,0x10d));var _0xf111=function(_0x4d6ad9,_0x172f14){_0x4d6ad9=_0x4d6ad9-0x0;var _0x3754e1=_0x111f[_0x4d6ad9];return _0x3754e1;};'use strict';var Umzug=require(_0xf111('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xf111('0x1'))(module,_0xf111('0x2'));var compareVersions=require(_0xf111('0x3'));var exec=require(_0xf111('0x4'))['exec'];var db=require(_0xf111('0x5'))['db'];var config=require(_0xf111('0x6'));var pm2=require(_0xf111('0x7'));var logger=require('../../config/logger')(_0xf111('0x8'));var git=require(_0xf111('0x9'))(config[_0xf111('0xa')]);exports[_0xf111('0xb')]=function(_0xcd6850,_0x248aa2){var _0x304740={'current':module[_0xf111('0xc')]['version'],'phonebar':0x2};if(_0xcd6850[_0xf111('0xd')]&&_0xcd6850[_0xf111('0xd')][_0xf111('0xe')]){return git[_0xf111('0xf')]()['tags'](function(_0x6d7d7c,_0x541d49){_0x304740[_0xf111('0xe')]=(_0x6d7d7c?module[_0xf111('0xc')][_0xf111('0x2')]:_0x541d49[_0xf111('0xe')])||_0xf111('0x10');return _0x248aa2[_0xf111('0x11')](0xc8)[_0xf111('0x12')](_0x304740);});}else{return _0x248aa2[_0xf111('0x11')](0xc8)[_0xf111('0x12')](_0x304740);}};exports[_0xf111('0xf')]=function(_0x1b6441,_0x26edcb){return git[_0xf111('0xf')]([_0xf111('0x13'),_0xf111('0x14')],function(_0x3b482d){if(_0x3b482d){logger[_0xf111('0x15')](_0x3b482d);return _0x26edcb[_0xf111('0x11')](0x1f4)[_0xf111('0x12')](_0x3b482d);}logger[_0xf111('0x16')]('git\x20fetch');return _0x26edcb[_0xf111('0x11')](0xc8)[_0xf111('0x12')]({'output':_0xf111('0x17')});});};exports['reset']=function(_0x228ded,_0xa672d3){return git[_0xf111('0x18')]([_0xf111('0x19'),_0xf111('0x1a')],function(_0x225c49){if(_0x225c49){logger[_0xf111('0x15')](_0x225c49);return _0xa672d3['status'](0x1f4)[_0xf111('0x12')](_0x225c49);}logger['info'](_0xf111('0x1b'));return _0xa672d3[_0xf111('0x11')](0xc8)[_0xf111('0x12')]({'output':_0xf111('0x1c')});});};exports[_0xf111('0x1d')]=function(_0x284781,_0x5719cb){exec(_0xf111('0x1e'),function(_0x5456a5,_0x314113,_0x4b8900){logger[_0xf111('0x16')](_0x314113);logger['info'](_0x4b8900);if(_0x5456a5){logger[_0xf111('0x15')](_0x5456a5);return _0x5719cb['status'](0x1f4)[_0xf111('0x12')](_0x5456a5);}return _0x5719cb[_0xf111('0x11')](0xc8)[_0xf111('0x12')]({'output':_0x314113});});};exports[_0xf111('0x1f')]=function(_0xd0e6a4,_0x421670){return pm2[_0xf111('0x1f')]('motion2')['then'](function(_0x37481b){logger[_0xf111('0x16')](_0xf111('0x20'),_0x37481b);return _0x421670[_0xf111('0x11')](0xc8)[_0xf111('0x12')]({'output':_0xf111('0x21')});})['catch'](function(_0x5714df){logger[_0xf111('0x15')](_0x5714df);return _0x421670['status'](0x1f4)[_0xf111('0x12')](_0x5714df);});};exports[_0xf111('0x22')]=function(_0x4f4170,_0x16bb37){var _0x2ab11f=fs[_0xf111('0x23')](path['join'](config[_0xf111('0xa')],_0xf111('0x24'),_0xf111('0x22')));var _0x408135=[];for(var _0x17b99a=0x0;_0x17b99a<_0x2ab11f['length'];_0x17b99a++){var _0x35400d=_0x2ab11f[_0x17b99a][_0xf111('0x25')](_0xf111('0x26'),'');if(compareVersions(module['exports'][_0xf111('0x2')],_0x35400d)===-0x1){_0x408135[_0xf111('0x27')](_0x35400d);}}if(_0x408135[_0xf111('0x28')]){var _0x1842fe=_0x408135['sort'](compareVersions);var _0x1bc6e2=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0xf111('0x29'),'columnName':_0xf111('0x2')},'migrations':{'params':[db['sequelize'][_0xf111('0x2a')](),db['sequelize'][_0xf111('0x2b')],function(){throw new Error(_0xf111('0x2c'));}],'path':path['join'](config['root'],_0xf111('0x24'),_0xf111('0x22')),'pattern':/\.js$/}});_0x1bc6e2['up']({'migrations':_['map'](_0x1842fe,function(_0x18f896){return _0x18f896+_0xf111('0x26');})})[_0xf111('0x2d')](function(){return _0x16bb37[_0xf111('0x11')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0xf111('0x2')]+'\x20to\x20'+_[_0xf111('0x2e')](_0x1842fe),'migrations':_[_0xf111('0x2f')](_0x1842fe)});})[_0xf111('0x30')](function(_0x5ad495){if(_0x5ad495 instanceof db[_0xf111('0x31')]['UniqueConstraintError']){return _0x16bb37[_0xf111('0x11')](0xc8)['json']({'output':_0xf111('0x32')});}else{return _0x16bb37[_0xf111('0x11')](0x1f4)['json'](_0x5ad495);}});}else{return _0x16bb37['status'](0xc8)['json']({'output':_0xf111('0x32')});}}; \ No newline at end of file +var _0xf476=['exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','index','exports','query','latest','tags','2.0.0','status','json','fetch','error','info','git\x20fetch','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','length','replace','push','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','child_process'];(function(_0x1bc95c,_0x109aec){var _0x1a9fdc=function(_0x3d73f8){while(--_0x3d73f8){_0x1bc95c['push'](_0x1bc95c['shift']());}};_0x1a9fdc(++_0x109aec);}(_0xf476,0x1a3));var _0x6f47=function(_0x4aaf9a,_0x28a342){_0x4aaf9a=_0x4aaf9a-0x0;var _0x2c0333=_0xf476[_0x4aaf9a];return _0x2c0333;};'use strict';var Umzug=require(_0x6f47('0x0'));var path=require(_0x6f47('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x6f47('0x2'))(module,_0x6f47('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x6f47('0x4'))[_0x6f47('0x5')];var db=require(_0x6f47('0x6'))['db'];var config=require(_0x6f47('0x7'));var pm2=require(_0x6f47('0x8'));var logger=require(_0x6f47('0x9'))(_0x6f47('0xa'));var git=require('simple-git')(config[_0x6f47('0xb')]);exports[_0x6f47('0xc')]=function(_0x1e213f,_0x26562a){var _0x5b6ab0={'current':module[_0x6f47('0xd')][_0x6f47('0x3')],'phonebar':0x2};if(_0x1e213f[_0x6f47('0xe')]&&_0x1e213f[_0x6f47('0xe')][_0x6f47('0xf')]){return git['fetch']()[_0x6f47('0x10')](function(_0x14d696,_0x19494b){_0x5b6ab0[_0x6f47('0xf')]=(_0x14d696?module[_0x6f47('0xd')][_0x6f47('0x3')]:_0x19494b[_0x6f47('0xf')])||_0x6f47('0x11');return _0x26562a[_0x6f47('0x12')](0xc8)[_0x6f47('0x13')](_0x5b6ab0);});}else{return _0x26562a[_0x6f47('0x12')](0xc8)[_0x6f47('0x13')](_0x5b6ab0);}};exports[_0x6f47('0x14')]=function(_0x3fcfdf,_0xe17735){return git[_0x6f47('0x14')](['origin','master'],function(_0x5f2db7){if(_0x5f2db7){logger[_0x6f47('0x15')](_0x5f2db7);return _0xe17735[_0x6f47('0x12')](0x1f4)[_0x6f47('0x13')](_0x5f2db7);}logger[_0x6f47('0x16')](_0x6f47('0x17'));return _0xe17735[_0x6f47('0x12')](0xc8)[_0x6f47('0x13')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x6f47('0x18')]=function(_0xca6088,_0x540f05){return git[_0x6f47('0x18')]([_0x6f47('0x19'),'FETCH_HEAD'],function(_0x6fb599){if(_0x6fb599){logger['error'](_0x6fb599);return _0x540f05[_0x6f47('0x12')](0x1f4)['json'](_0x6fb599);}logger[_0x6f47('0x16')](_0x6f47('0x1a'));return _0x540f05[_0x6f47('0x12')](0xc8)['json']({'output':_0x6f47('0x1b')});});};exports[_0x6f47('0x1c')]=function(_0x58581b,_0x35705e){exec(_0x6f47('0x1d'),function(_0x317dce,_0x146d2a,_0x281605){logger[_0x6f47('0x16')](_0x146d2a);logger['info'](_0x281605);if(_0x317dce){logger[_0x6f47('0x15')](_0x317dce);return _0x35705e[_0x6f47('0x12')](0x1f4)[_0x6f47('0x13')](_0x317dce);}return _0x35705e[_0x6f47('0x12')](0xc8)[_0x6f47('0x13')]({'output':_0x146d2a});});};exports[_0x6f47('0x1e')]=function(_0x2150a4,_0x235489){return pm2[_0x6f47('0x1e')](_0x6f47('0x1f'))[_0x6f47('0x20')](function(_0x36bed3){logger[_0x6f47('0x16')](_0x6f47('0x21'),_0x36bed3);return _0x235489[_0x6f47('0x12')](0xc8)['json']({'output':_0x6f47('0x22')});})[_0x6f47('0x23')](function(_0x479a65){logger[_0x6f47('0x15')](_0x479a65);return _0x235489[_0x6f47('0x12')](0x1f4)[_0x6f47('0x13')](_0x479a65);});};exports['migrations']=function(_0x1ec555,_0x114ab1){var _0x5dbeb0=fs[_0x6f47('0x24')](path[_0x6f47('0x25')](config[_0x6f47('0xb')],_0x6f47('0x26'),_0x6f47('0x27')));var _0x3f4cfa=[];for(var _0x1a2938=0x0;_0x1a2938<_0x5dbeb0[_0x6f47('0x28')];_0x1a2938++){var _0x138e20=_0x5dbeb0[_0x1a2938][_0x6f47('0x29')]('.js','');if(compareVersions(module[_0x6f47('0xd')]['version'],_0x138e20)===-0x1){_0x3f4cfa[_0x6f47('0x2a')](_0x138e20);}}if(_0x3f4cfa[_0x6f47('0x28')]){var _0x287e38=_0x3f4cfa['sort'](compareVersions);var _0x3645a8=new Umzug({'storage':_0x6f47('0x2b'),'storageOptions':{'model':db[_0x6f47('0x2c')],'modelName':_0x6f47('0x2c'),'columnName':_0x6f47('0x3')},'migrations':{'params':[db[_0x6f47('0x2b')]['getQueryInterface'](),db[_0x6f47('0x2b')][_0x6f47('0x2d')],function(){throw new Error(_0x6f47('0x2e'));}],'path':path[_0x6f47('0x25')](config[_0x6f47('0xb')],_0x6f47('0x26'),_0x6f47('0x27')),'pattern':/\.js$/}});_0x3645a8['up']({'migrations':_[_0x6f47('0x2f')](_0x287e38,function(_0x378c29){return _0x378c29+_0x6f47('0x30');})})['then'](function(){return _0x114ab1[_0x6f47('0x12')](0xc8)[_0x6f47('0x13')]({'output':_0x6f47('0x31')+module[_0x6f47('0xd')][_0x6f47('0x3')]+'\x20to\x20'+_[_0x6f47('0x32')](_0x287e38),'migrations':_[_0x6f47('0x25')](_0x287e38)});})[_0x6f47('0x23')](function(_0x2bd7f6){if(_0x2bd7f6 instanceof db[_0x6f47('0x2b')][_0x6f47('0x33')]){return _0x114ab1['status'](0xc8)[_0x6f47('0x13')]({'output':_0x6f47('0x34')});}else{return _0x114ab1[_0x6f47('0x12')](0x1f4)['json'](_0x2bd7f6);}});}else{return _0x114ab1[_0x6f47('0x12')](0xc8)[_0x6f47('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index bd926ee..c622382 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 _0xab1b=['show','create','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x1357a3,_0x25e5ef){var _0xb1cf34=function(_0x420aee){while(--_0x420aee){_0x1357a3['push'](_0x1357a3['shift']());}};_0xb1cf34(++_0x25e5ef);}(_0xab1b,0x159));var _0xbab1=function(_0x4fed2a,_0x4062ad){_0x4fed2a=_0x4fed2a-0x0;var _0x45174c=_0xab1b[_0x4fed2a];return _0x45174c;};'use strict';var multer=require(_0xbab1('0x0'));var util=require(_0xbab1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbab1('0x2')]();var fs_extra=require(_0xbab1('0x3'));var auth=require(_0xbab1('0x4'));var interaction=require(_0xbab1('0x5'));var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0xbab1('0x6')]('/',auth['isAuthenticated'](),controller[_0xbab1('0x7')]);router['get'](_0xbab1('0x8'),auth[_0xbab1('0x9')](),controller[_0xbab1('0xa')]);router['get'](_0xbab1('0xb'),auth['isAuthenticated'](),controller[_0xbab1('0xc')]);router['post']('/',auth[_0xbab1('0x9')](),controller[_0xbab1('0xd')]);router['put']('/:id',auth[_0xbab1('0x9')](),controller['update']);router[_0xbab1('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xbab1('0xf')]);module[_0xbab1('0x10')]=router; \ No newline at end of file +var _0xe7a6=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe7a6,0xff));var _0x6e7a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe7a6[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x6e7a('0x0'));var util=require(_0x6e7a('0x1'));var path=require(_0x6e7a('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e7a('0x3'));var router=express[_0x6e7a('0x4')]();var fs_extra=require(_0x6e7a('0x5'));var auth=require(_0x6e7a('0x6'));var interaction=require(_0x6e7a('0x7'));var config=require(_0x6e7a('0x8'));var controller=require(_0x6e7a('0x9'));router[_0x6e7a('0xa')]('/',auth[_0x6e7a('0xb')](),controller['index']);router[_0x6e7a('0xa')](_0x6e7a('0xc'),auth[_0x6e7a('0xb')](),controller['describe']);router[_0x6e7a('0xa')](_0x6e7a('0xd'),auth['isAuthenticated'](),controller[_0x6e7a('0xe')]);router[_0x6e7a('0xf')]('/',auth[_0x6e7a('0xb')](),controller[_0x6e7a('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6e7a('0x11')]);router[_0x6e7a('0x12')](_0x6e7a('0xd'),auth['isAuthenticated'](),controller[_0x6e7a('0x13')]);module[_0x6e7a('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 1ef76c2..74a9504 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 _0xbe9d=['exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x1dcdfb,_0x1ef521){var _0x32fb12=function(_0x35b62a){while(--_0x35b62a){_0x1dcdfb['push'](_0x1dcdfb['shift']());}};_0x32fb12(++_0x1ef521);}(_0xbe9d,0x99));var _0xdbe9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbe9d[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xdbe9('0x0'));module[_0xdbe9('0x1')]={'type':{'type':Sequelize[_0xdbe9('0x2')]},'uniqueid':{'type':Sequelize[_0xdbe9('0x2')]},'calleridnum':{'type':Sequelize[_0xdbe9('0x2')]},'calleridname':{'type':Sequelize[_0xdbe9('0x2')]},'queue':{'type':Sequelize[_0xdbe9('0x2')]},'interface':{'type':Sequelize[_0xdbe9('0x2')]},'membername':{'type':Sequelize[_0xdbe9('0x2')]},'agentcalledAt':{'type':Sequelize[_0xdbe9('0x3')]},'agentconnectAt':{'type':Sequelize[_0xdbe9('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xdbe9('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xdbe9('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xdbe9('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xdbe9('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xdbe9('0x5')]},'agentacw':{'type':Sequelize[_0xdbe9('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xdbe9('0x5')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xdbe9('0x2')]},'channelstate':{'type':Sequelize[_0xdbe9('0x5')]},'channelstatedesc':{'type':Sequelize[_0xdbe9('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdbe9('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xdbe9('0x2')]},'accountcode':{'type':Sequelize[_0xdbe9('0x2')]},'context':{'type':Sequelize[_0xdbe9('0x2')]},'exten':{'type':Sequelize[_0xdbe9('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xdbe9('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xdbe9('0x2')]},'destcalleridnum':{'type':Sequelize[_0xdbe9('0x2')]},'destcalleridname':{'type':Sequelize[_0xdbe9('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xdbe9('0x2')]},'destlanguage':{'type':Sequelize[_0xdbe9('0x2')]},'destaccountcode':{'type':Sequelize[_0xdbe9('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xdbe9('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xdbe9('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xdbe9('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xdbe9('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xdbe9('0x2')],'comment':_0xdbe9('0x6')},'transferexten':{'type':Sequelize[_0xdbe9('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xdbe9('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2884=['STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x5ba3e3,_0xd3f6a6){var _0x5b0ddf=function(_0x1f0089){while(--_0x1f0089){_0x5ba3e3['push'](_0x5ba3e3['shift']());}};_0x5b0ddf(++_0xd3f6a6);}(_0x2884,0x1eb));var _0x4288=function(_0x554a48,_0x3b0b29){_0x554a48=_0x554a48-0x0;var _0x4cd1dc=_0x2884[_0x554a48];return _0x4cd1dc;};'use strict';var Sequelize=require(_0x4288('0x0'));module['exports']={'type':{'type':Sequelize[_0x4288('0x1')]},'uniqueid':{'type':Sequelize[_0x4288('0x1')]},'calleridnum':{'type':Sequelize[_0x4288('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4288('0x1')]},'interface':{'type':Sequelize[_0x4288('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x4288('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x4288('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x4288('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x4288('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4288('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4288('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4288('0x4')]},'reason':{'type':Sequelize[_0x4288('0x1')]},'lastevent':{'type':Sequelize[_0x4288('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x4288('0x1')]},'connectedlinenum':{'type':Sequelize[_0x4288('0x1')]},'connectedlinename':{'type':Sequelize[_0x4288('0x1')]},'language':{'type':Sequelize[_0x4288('0x1')]},'accountcode':{'type':Sequelize[_0x4288('0x1')]},'context':{'type':Sequelize[_0x4288('0x1')]},'exten':{'type':Sequelize[_0x4288('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x4288('0x1')]},'destchannelstate':{'type':Sequelize[_0x4288('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x4288('0x1')]},'destcalleridnum':{'type':Sequelize[_0x4288('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x4288('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x4288('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4288('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x4288('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x4288('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4288('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x4288('0x1')]},'transfer':{'type':Sequelize[_0x4288('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4288('0x1')],'comment':_0x4288('0x5')},'transferexten':{'type':Sequelize[_0x4288('0x1')]},'transferuniqueid':{'type':Sequelize[_0x4288('0x1')]},'agententerreason':{'type':Sequelize[_0x4288('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index e084de2..ba5bf0b 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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 5770a11..a56ac73 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 _0xf2cf=['api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','../../config/logger'];(function(_0x2de0d8,_0x4b5fac){var _0x90f161=function(_0x47ab7a){while(--_0x47ab7a){_0x2de0d8['push'](_0x2de0d8['shift']());}};_0x90f161(++_0x4b5fac);}(_0xf2cf,0xf5));var _0xff2c=function(_0x1f9d58,_0x3e18b0){_0x1f9d58=_0x1f9d58-0x0;var _0x3c729d=_0xf2cf[_0x1f9d58];return _0x3c729d;};'use strict';var _=require('lodash');var util=require(_0xff2c('0x0'));var logger=require(_0xff2c('0x1'))(_0xff2c('0x2'));var moment=require('moment');var BPromise=require(_0xff2c('0x3'));var rp=require(_0xff2c('0x4'));var fs=require('fs');var path=require(_0xff2c('0x5'));var rimraf=require(_0xff2c('0x6'));var config=require(_0xff2c('0x7'));var attributes=require(_0xff2c('0x8'));module['exports']=function(_0x8f0f4,_0x68b356){return _0x8f0f4['define'](_0xff2c('0x9'),attributes,{'tableName':_0xff2c('0xa'),'paranoid':![],'indexes':[{'fields':[_0xff2c('0xb'),_0xff2c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa6bb=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xa6bb,0x12c));var _0xba6b=function(_0x5d5bec,_0x58b65f){_0x5d5bec=_0x5d5bec-0x0;var _0x34fe93=_0xa6bb[_0x5d5bec];return _0x34fe93;};'use strict';var _=require('lodash');var util=require(_0xba6b('0x0'));var logger=require(_0xba6b('0x1'))(_0xba6b('0x2'));var moment=require(_0xba6b('0x3'));var BPromise=require(_0xba6b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xba6b('0x5'));var config=require(_0xba6b('0x6'));var attributes=require(_0xba6b('0x7'));module[_0xba6b('0x8')]=function(_0x517d10,_0x4cc381){return _0x517d10[_0xba6b('0x9')](_0xba6b('0xa'),attributes,{'tableName':_0xba6b('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index eb9d0d8..e4a76fe 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 _0xabdf=['info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceAgentReport','create','options','UpdateVoiceAgentReport','VoiceAgentReport','update','body','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x20ce17,_0x1711c7){var _0x8ebced=function(_0x34f74e){while(--_0x34f74e){_0x20ce17['push'](_0x20ce17['shift']());}};_0x8ebced(++_0x1711c7);}(_0xabdf,0x1f1));var _0xfabd=function(_0x17acb5,_0x2445b5){_0x17acb5=_0x17acb5-0x0;var _0x4aca07=_0xabdf[_0x17acb5];return _0x4aca07;};'use strict';var _=require(_0xfabd('0x0'));var util=require(_0xfabd('0x1'));var moment=require(_0xfabd('0x2'));var BPromise=require(_0xfabd('0x3'));var rs=require(_0xfabd('0x4'));var fs=require('fs');var Redis=require(_0xfabd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfabd('0x6'));var logger=require(_0xfabd('0x7'))(_0xfabd('0x8'));var config=require('../../config/environment');var jayson=require(_0xfabd('0x9'));var client=jayson[_0xfabd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d777d,_0x8d9fd6,_0x326ce9){return new BPromise(function(_0x1e9d02,_0x1ffe98){return client[_0xfabd('0xb')](_0x5d777d,_0x326ce9)[_0xfabd('0xc')](function(_0x32c4ed){logger[_0xfabd('0xd')](_0xfabd('0xe'),_0x8d9fd6,_0xfabd('0xf'));logger[_0xfabd('0x10')](_0xfabd('0x11'),_0x8d9fd6,_0xfabd('0xf'),JSON[_0xfabd('0x12')](_0x32c4ed));if(_0x32c4ed[_0xfabd('0x13')]){if(_0x32c4ed['error']['code']===0x1f4){logger['error'](_0xfabd('0xe'),_0x8d9fd6,_0x32c4ed[_0xfabd('0x13')][_0xfabd('0x14')]);return _0x1ffe98(_0x32c4ed[_0xfabd('0x13')]['message']);}logger[_0xfabd('0x13')](_0xfabd('0xe'),_0x8d9fd6,_0x32c4ed[_0xfabd('0x13')][_0xfabd('0x14')]);return _0x1e9d02(_0x32c4ed[_0xfabd('0x13')][_0xfabd('0x14')]);}else{logger[_0xfabd('0xd')](_0xfabd('0xe'),_0x8d9fd6,_0xfabd('0xf'));_0x1e9d02(_0x32c4ed[_0xfabd('0x15')][_0xfabd('0x14')]);}})[_0xfabd('0x16')](function(_0x20707e){logger[_0xfabd('0x13')](_0xfabd('0xe'),_0x8d9fd6,_0x20707e);_0x1ffe98(_0x20707e);});});}exports[_0xfabd('0x17')]=function(_0x1d889b){var _0x5859fe=this;return new Promise(function(_0xee1698,_0x58d4fb){return db['VoiceAgentReport'][_0xfabd('0x18')](_0x1d889b['body'],{'raw':_0x1d889b[_0xfabd('0x19')]?_0x1d889b[_0xfabd('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xfabd('0xc')](function(_0x1ea124){logger['info'](_0xfabd('0x17'),_0x1d889b);logger['debug']('CreateVoiceAgentReport',_0x1d889b,JSON['stringify'](_0x1ea124));_0xee1698(_0x1ea124);})[_0xfabd('0x16')](function(_0x30d512){logger[_0xfabd('0x13')](_0xfabd('0x17'),_0x30d512['message'],_0x1d889b);_0x58d4fb(_0x5859fe['error'](0x1f4,_0x30d512[_0xfabd('0x14')]));});});};exports[_0xfabd('0x1a')]=function(_0x57913c){var _0x13c5d8=this;return new Promise(function(_0x5b5b15,_0x3c6f22){return db[_0xfabd('0x1b')][_0xfabd('0x1c')](_0x57913c[_0xfabd('0x1d')],{'raw':_0x57913c[_0xfabd('0x19')]?_0x57913c['options'][_0xfabd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57913c[_0xfabd('0x19')]?_0x57913c['options'][_0xfabd('0x1f')]||null:null,'attributes':_0x57913c[_0xfabd('0x19')]?_0x57913c['options'][_0xfabd('0x20')]||null:null,'limit':_0x57913c[_0xfabd('0x19')]?_0x57913c[_0xfabd('0x19')][_0xfabd('0x21')]||null:null})['then'](function(_0x355748){logger[_0xfabd('0xd')](_0xfabd('0x1a'),_0x57913c);logger[_0xfabd('0x10')](_0xfabd('0x1a'),_0x57913c,JSON[_0xfabd('0x12')](_0x355748));_0x5b5b15(_0x355748);})[_0xfabd('0x16')](function(_0x291186){logger[_0xfabd('0x13')](_0xfabd('0x1a'),_0x291186['message'],_0x57913c);_0x3c6f22(_0x13c5d8['error'](0x1f4,_0x291186[_0xfabd('0x14')]));});});}; \ No newline at end of file +var _0xedf4=['request\x20sent','debug','stringify','error','VoiceAgentReport,\x20%s,\x20%s','message','CreateVoiceAgentReport','create','options','catch','UpdateVoiceAgentReport','update','body','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x48f99d,_0x5e3f7a){var _0x1811e2=function(_0x43ec26){while(--_0x43ec26){_0x48f99d['push'](_0x48f99d['shift']());}};_0x1811e2(++_0x5e3f7a);}(_0xedf4,0x191));var _0x4edf=function(_0x543795,_0x41c078){_0x543795=_0x543795-0x0;var _0x18824d=_0xedf4[_0x543795];return _0x18824d;};'use strict';var _=require(_0x4edf('0x0'));var util=require(_0x4edf('0x1'));var moment=require(_0x4edf('0x2'));var BPromise=require(_0x4edf('0x3'));var rs=require(_0x4edf('0x4'));var fs=require('fs');var Redis=require(_0x4edf('0x5'));var db=require(_0x4edf('0x6'))['db'];var utils=require(_0x4edf('0x7'));var logger=require('../../config/logger')(_0x4edf('0x8'));var config=require(_0x4edf('0x9'));var jayson=require(_0x4edf('0xa'));var client=jayson[_0x4edf('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3288f8,_0x4ac34e,_0x4e7cbe){return new BPromise(function(_0xdaa057,_0x3492b0){return client[_0x4edf('0xc')](_0x3288f8,_0x4e7cbe)[_0x4edf('0xd')](function(_0x2b0cf6){logger[_0x4edf('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x4ac34e,_0x4edf('0xf'));logger[_0x4edf('0x10')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x4ac34e,_0x4edf('0xf'),JSON[_0x4edf('0x11')](_0x2b0cf6));if(_0x2b0cf6[_0x4edf('0x12')]){if(_0x2b0cf6[_0x4edf('0x12')]['code']===0x1f4){logger['error'](_0x4edf('0x13'),_0x4ac34e,_0x2b0cf6['error'][_0x4edf('0x14')]);return _0x3492b0(_0x2b0cf6[_0x4edf('0x12')]['message']);}logger[_0x4edf('0x12')](_0x4edf('0x13'),_0x4ac34e,_0x2b0cf6['error']['message']);return _0xdaa057(_0x2b0cf6[_0x4edf('0x12')]['message']);}else{logger[_0x4edf('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x4ac34e,'request\x20sent');_0xdaa057(_0x2b0cf6['result'][_0x4edf('0x14')]);}})['catch'](function(_0x5e9ef5){logger['error'](_0x4edf('0x13'),_0x4ac34e,_0x5e9ef5);_0x3492b0(_0x5e9ef5);});});}exports[_0x4edf('0x15')]=function(_0x1d7c10){var _0xaa0133=this;return new Promise(function(_0xce9361,_0x4bfd41){return db['VoiceAgentReport'][_0x4edf('0x16')](_0x1d7c10['body'],{'raw':_0x1d7c10[_0x4edf('0x17')]?_0x1d7c10['options']['raw']===undefined?!![]:![]:!![]})[_0x4edf('0xd')](function(_0x5e5808){logger[_0x4edf('0xe')](_0x4edf('0x15'),_0x1d7c10);logger[_0x4edf('0x10')](_0x4edf('0x15'),_0x1d7c10,JSON[_0x4edf('0x11')](_0x5e5808));_0xce9361(_0x5e5808);})[_0x4edf('0x18')](function(_0x44021d){logger[_0x4edf('0x12')](_0x4edf('0x15'),_0x44021d[_0x4edf('0x14')],_0x1d7c10);_0x4bfd41(_0xaa0133[_0x4edf('0x12')](0x1f4,_0x44021d[_0x4edf('0x14')]));});});};exports[_0x4edf('0x19')]=function(_0x12bd8e){var _0x1e260c=this;return new Promise(function(_0x1a51e7,_0x4d18e8){return db['VoiceAgentReport'][_0x4edf('0x1a')](_0x12bd8e[_0x4edf('0x1b')],{'raw':_0x12bd8e[_0x4edf('0x17')]?_0x12bd8e[_0x4edf('0x17')][_0x4edf('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12bd8e[_0x4edf('0x17')]?_0x12bd8e[_0x4edf('0x17')][_0x4edf('0x1d')]||null:null,'attributes':_0x12bd8e[_0x4edf('0x17')]?_0x12bd8e['options'][_0x4edf('0x1e')]||null:null,'limit':_0x12bd8e[_0x4edf('0x17')]?_0x12bd8e[_0x4edf('0x17')][_0x4edf('0x1f')]||null:null})[_0x4edf('0xd')](function(_0xbf355e){logger[_0x4edf('0xe')](_0x4edf('0x19'),_0x12bd8e);logger[_0x4edf('0x10')]('UpdateVoiceAgentReport',_0x12bd8e,JSON['stringify'](_0xbf355e));_0x1a51e7(_0xbf355e);})[_0x4edf('0x18')](function(_0x3e6eb2){logger[_0x4edf('0x12')](_0x4edf('0x19'),_0x3e6eb2[_0x4edf('0x14')],_0x12bd8e);_0x4d18e8(_0x1e260c[_0x4edf('0x12')](0x1f4,_0x3e6eb2[_0x4edf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index e6bf040..fd24dc7 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 _0x7dfd=['isAuthenticated','index','/describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get'];(function(_0x85f9ee,_0x397c33){var _0x3bdeb5=function(_0x500121){while(--_0x500121){_0x85f9ee['push'](_0x85f9ee['shift']());}};_0x3bdeb5(++_0x397c33);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require(_0xd7df('0x6'));var auth=require(_0xd7df('0x7'));var interaction=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var controller=require(_0xd7df('0xa'));router[_0xd7df('0xb')]('/',auth[_0xd7df('0xc')](),controller[_0xd7df('0xd')]);router[_0xd7df('0xb')](_0xd7df('0xe'),auth[_0xd7df('0xc')](),controller['describe']);router[_0xd7df('0xb')](_0xd7df('0xf'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x10')]);router['post']('/',auth[_0xd7df('0xc')](),controller['create']);router[_0xd7df('0x11')]('/:id',auth[_0xd7df('0xc')](),controller[_0xd7df('0x12')]);router[_0xd7df('0x13')](_0xd7df('0xf'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x14')]);module[_0xd7df('0x15')]=router; \ No newline at end of file +var _0x84ab=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','/describe','describe','isAuthenticated','post','create','update','delete','/:id','destroy','multer'];(function(_0x387ed5,_0x44e590){var _0x20a79e=function(_0x54f5e5){while(--_0x54f5e5){_0x387ed5['push'](_0x387ed5['shift']());}};_0x20a79e(++_0x44e590);}(_0x84ab,0x12f));var _0xb84a=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0x84ab[_0x3c6dce];return _0x1450e9;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var fs_extra=require(_0xb84a('0x5'));var auth=require(_0xb84a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb84a('0x7'));var controller=require(_0xb84a('0x8'));router[_0xb84a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router[_0xb84a('0x9')]('/:id',auth[_0xb84a('0xc')](),controller['show']);router[_0xb84a('0xd')]('/',auth[_0xb84a('0xc')](),controller[_0xb84a('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb84a('0xf')]);router[_0xb84a('0x10')](_0xb84a('0x11'),auth[_0xb84a('0xc')](),controller[_0xb84a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 5f56e48..501daae 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 _0x4c8c=['outbound-fax','STRING','TEXT','DATE','INTEGER','sequelize','ENUM','inbound','internal','inbound-fax'];(function(_0x93009b,_0x1fd533){var _0x53c856=function(_0x14146a){while(--_0x14146a){_0x93009b['push'](_0x93009b['shift']());}};_0x53c856(++_0x1fd533);}(_0x4c8c,0x1b3));var _0xc4c8=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x4c8c[_0x2d8fc2];return _0x3a9e53;};'use strict';var Sequelize=require(_0xc4c8('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc4c8('0x1')](_0xc4c8('0x2'),_0xc4c8('0x3'),'outbound',_0xc4c8('0x4'),_0xc4c8('0x5'),'dialer')},'tag':{'type':Sequelize[_0xc4c8('0x6')]},'accountcode':{'type':Sequelize[_0xc4c8('0x6')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xc4c8('0x6')]},'destinationcontext':{'type':Sequelize[_0xc4c8('0x6')]},'callerid':{'type':Sequelize[_0xc4c8('0x6')]},'channel':{'type':Sequelize[_0xc4c8('0x6')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0xc4c8('0x6')]},'lastdata':{'type':Sequelize[_0xc4c8('0x7')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xc4c8('0x8')]},'answertime':{'type':Sequelize[_0xc4c8('0x8')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xc4c8('0x9')]},'billableseconds':{'type':Sequelize[_0xc4c8('0x9')]},'mohtime':{'type':Sequelize[_0xc4c8('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc4c8('0x6')]},'amaflags':{'type':Sequelize[_0xc4c8('0x6')]},'userfield':{'type':Sequelize[_0xc4c8('0x6')]},'userDisposition':{'type':Sequelize[_0xc4c8('0x6')]},'userSecondDisposition':{'type':Sequelize[_0xc4c8('0x6')]},'userThirdDisposition':{'type':Sequelize[_0xc4c8('0x6')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xc4c8('0x6')]},'routeid':{'type':Sequelize[_0xc4c8('0x9')]},'sipcallid':{'type':Sequelize[_0xc4c8('0x6')]}}; \ No newline at end of file +var _0x359c=['sequelize','exports','STRING','ENUM','inbound','internal','outbound','dialer','TEXT','DATE','INTEGER'];(function(_0x208409,_0x10f264){var _0x444f28=function(_0x47ca8b){while(--_0x47ca8b){_0x208409['push'](_0x208409['shift']());}};_0x444f28(++_0x10f264);}(_0x359c,0xa5));var _0xc359=function(_0x19641c,_0x476fb3){_0x19641c=_0x19641c-0x0;var _0x4e634a=_0x359c[_0x19641c];return _0x4e634a;};'use strict';var Sequelize=require(_0xc359('0x0'));module[_0xc359('0x1')]={'uniqueid':{'type':Sequelize[_0xc359('0x2')]},'type':{'type':Sequelize[_0xc359('0x3')](_0xc359('0x4'),_0xc359('0x5'),_0xc359('0x6'),'inbound-fax','outbound-fax',_0xc359('0x7'))},'tag':{'type':Sequelize[_0xc359('0x2')]},'accountcode':{'type':Sequelize[_0xc359('0x2')]},'source':{'type':Sequelize[_0xc359('0x2')]},'destination':{'type':Sequelize[_0xc359('0x2')]},'destinationcontext':{'type':Sequelize[_0xc359('0x2')]},'callerid':{'type':Sequelize[_0xc359('0x2')]},'channel':{'type':Sequelize[_0xc359('0x2')]},'destinationchannel':{'type':Sequelize[_0xc359('0x2')]},'lastapplication':{'type':Sequelize[_0xc359('0x2')]},'lastdata':{'type':Sequelize[_0xc359('0x8')]},'starttime':{'type':Sequelize[_0xc359('0x9')]},'systemanswertime':{'type':Sequelize[_0xc359('0x9')]},'answertime':{'type':Sequelize[_0xc359('0x9')]},'endtime':{'type':Sequelize[_0xc359('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xc359('0xa')]},'mohtime':{'type':Sequelize[_0xc359('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc359('0x2')]},'amaflags':{'type':Sequelize[_0xc359('0x2')]},'userfield':{'type':Sequelize[_0xc359('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc359('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xc359('0xa')]},'sipcallid':{'type':Sequelize[_0xc359('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index ccb50fb..0bce40c 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 _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(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x2ef3,0xba));var _0x32ef=function(_0x163b17,_0x408b0b){_0x163b17=_0x163b17-0x0;var _0x1fb1e5=_0x2ef3[_0x163b17];return _0x1fb1e5;};'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 +var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x5f2f,0x73));var _0xf5f2=function(_0x394b51,_0x3af5dc){_0x394b51=_0x394b51-0x0;var _0x1ec90b=_0x5f2f[_0x394b51];return _0x1ec90b;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 3497f46..fbb2232 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 _0x85a6=['../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid','util','../../config/logger','api','moment','path'];(function(_0x40165b,_0x2bef91){var _0x9dbfaa=function(_0x172f6e){while(--_0x172f6e){_0x40165b['push'](_0x40165b['shift']());}};_0x9dbfaa(++_0x2bef91);}(_0x85a6,0xa0));var _0x685a=function(_0x16c593,_0x4bde8e){_0x16c593=_0x16c593-0x0;var _0x11c84e=_0x85a6[_0x16c593];return _0x11c84e;};'use strict';var _=require('lodash');var util=require(_0x685a('0x0'));var logger=require(_0x685a('0x1'))(_0x685a('0x2'));var moment=require(_0x685a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x685a('0x4'));var rimraf=require('rimraf');var config=require(_0x685a('0x5'));var attributes=require(_0x685a('0x6'));module[_0x685a('0x7')]=function(_0x2760f6,_0x298d31){return _0x2760f6[_0x685a('0x8')]('VoiceCallReport',attributes,{'tableName':_0x685a('0x9'),'paranoid':![],'indexes':[{'fields':[_0x685a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf0cb=['../../config/logger','api','moment','request-promise','path','../../config/environment','define','uniqueid','lodash','util'];(function(_0x163afd,_0x39405b){var _0x216c7e=function(_0x80e1a){while(--_0x80e1a){_0x163afd['push'](_0x163afd['shift']());}};_0x216c7e(++_0x39405b);}(_0xf0cb,0x134));var _0xbf0c=function(_0x5816bf,_0x3f0cd7){_0x5816bf=_0x5816bf-0x0;var _0x1cd8a3=_0xf0cb[_0x5816bf];return _0x1cd8a3;};'use strict';var _=require(_0xbf0c('0x0'));var util=require(_0xbf0c('0x1'));var logger=require(_0xbf0c('0x2'))(_0xbf0c('0x3'));var moment=require(_0xbf0c('0x4'));var BPromise=require('bluebird');var rp=require(_0xbf0c('0x5'));var fs=require('fs');var path=require(_0xbf0c('0x6'));var rimraf=require('rimraf');var config=require(_0xbf0c('0x7'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x59f587,_0xfa23bf){return _0x59f587[_0xbf0c('0x8')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xbf0c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 7cc6a70..924ee83 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 _0x2967=['error','message','info','result','catch','VoiceCallReport','findAll','options','raw','where','limit','include','map','model','attributes','GetVoiceCallReport','CreateVoiceCallReport','body','debug','UpdateVoiceCallReport','update','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1a34b9,_0x546fd5){var _0x31cf0f=function(_0x35ad7a){while(--_0x35ad7a){_0x1a34b9['push'](_0x1a34b9['shift']());}};_0x31cf0f(++_0x546fd5);}(_0x2967,0xf9));var _0x7296=function(_0x420f2a,_0x2cc58d){_0x420f2a=_0x420f2a-0x0;var _0x28f802=_0x2967[_0x420f2a];return _0x28f802;};'use strict';var _=require('lodash');var util=require(_0x7296('0x0'));var moment=require(_0x7296('0x1'));var BPromise=require(_0x7296('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7296('0x3'));var db=require(_0x7296('0x4'))['db'];var utils=require(_0x7296('0x5'));var logger=require(_0x7296('0x6'))(_0x7296('0x7'));var config=require('../../config/environment');var jayson=require(_0x7296('0x8'));var client=jayson[_0x7296('0x9')][_0x7296('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5322d0,_0x653416,_0x1e31e3){return new BPromise(function(_0x20e0f0,_0x491589){return client[_0x7296('0xb')](_0x5322d0,_0x1e31e3)[_0x7296('0xc')](function(_0x35509d){logger['info'](_0x7296('0xd'),_0x653416,_0x7296('0xe'));logger['debug'](_0x7296('0xf'),_0x653416,_0x7296('0xe'),JSON[_0x7296('0x10')](_0x35509d));if(_0x35509d[_0x7296('0x11')]){if(_0x35509d[_0x7296('0x11')]['code']===0x1f4){logger[_0x7296('0x11')](_0x7296('0xd'),_0x653416,_0x35509d[_0x7296('0x11')][_0x7296('0x12')]);return _0x491589(_0x35509d[_0x7296('0x11')]['message']);}logger['error'](_0x7296('0xd'),_0x653416,_0x35509d[_0x7296('0x11')]['message']);return _0x20e0f0(_0x35509d[_0x7296('0x11')]['message']);}else{logger[_0x7296('0x13')](_0x7296('0xd'),_0x653416,_0x7296('0xe'));_0x20e0f0(_0x35509d[_0x7296('0x14')][_0x7296('0x12')]);}})[_0x7296('0x15')](function(_0x5e9c59){logger[_0x7296('0x11')](_0x7296('0xd'),_0x653416,_0x5e9c59);_0x491589(_0x5e9c59);});});}exports['GetVoiceCallReport']=function(_0x5d968b){var _0x4e813e=this;return new Promise(function(_0x5af90a,_0x3a7225){return db[_0x7296('0x16')][_0x7296('0x17')]({'raw':_0x5d968b[_0x7296('0x18')]?_0x5d968b[_0x7296('0x18')][_0x7296('0x19')]===undefined?!![]:![]:!![],'where':_0x5d968b[_0x7296('0x18')]?_0x5d968b[_0x7296('0x18')][_0x7296('0x1a')]||null:null,'attributes':_0x5d968b[_0x7296('0x18')]?_0x5d968b[_0x7296('0x18')]['attributes']||null:null,'limit':_0x5d968b['options']?_0x5d968b[_0x7296('0x18')][_0x7296('0x1b')]||null:null,'include':_0x5d968b[_0x7296('0x18')]?_0x5d968b[_0x7296('0x18')][_0x7296('0x1c')]?_[_0x7296('0x1d')](_0x5d968b[_0x7296('0x18')][_0x7296('0x1c')],function(_0x357bdd){return{'model':db[_0x357bdd[_0x7296('0x1e')]],'as':_0x357bdd['as'],'attributes':_0x357bdd['attributes'],'include':_0x357bdd[_0x7296('0x1c')]?_['map'](_0x357bdd['include'],function(_0x541f68){return{'model':db[_0x541f68[_0x7296('0x1e')]],'as':_0x541f68['as'],'attributes':_0x541f68[_0x7296('0x1f')],'include':_0x541f68[_0x7296('0x1c')]?_[_0x7296('0x1d')](_0x541f68[_0x7296('0x1c')],function(_0x4b1f64){return{'model':db[_0x4b1f64[_0x7296('0x1e')]],'as':_0x4b1f64['as'],'attributes':_0x4b1f64[_0x7296('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x324066){logger[_0x7296('0x13')](_0x7296('0x20'),_0x5d968b);logger['debug'](_0x7296('0x20'),_0x5d968b,JSON['stringify'](_0x324066));_0x5af90a(_0x324066);})[_0x7296('0x15')](function(_0x522bc1){logger[_0x7296('0x11')]('GetVoiceCallReport',_0x522bc1[_0x7296('0x12')],_0x5d968b);_0x3a7225(_0x4e813e[_0x7296('0x11')](0x1f4,_0x522bc1[_0x7296('0x12')]));});});};exports[_0x7296('0x21')]=function(_0x30669b){var _0x4087d8=this;return new Promise(function(_0x306883,_0x2842f5){return db[_0x7296('0x16')]['create'](_0x30669b[_0x7296('0x22')],{'raw':_0x30669b[_0x7296('0x18')]?_0x30669b[_0x7296('0x18')][_0x7296('0x19')]===undefined?!![]:![]:!![]})[_0x7296('0xc')](function(_0x16273f){logger[_0x7296('0x13')]('CreateVoiceCallReport',_0x30669b);logger[_0x7296('0x23')](_0x7296('0x21'),_0x30669b,JSON[_0x7296('0x10')](_0x16273f));_0x306883(_0x16273f);})[_0x7296('0x15')](function(_0x34e0df){logger['error'](_0x7296('0x21'),_0x34e0df[_0x7296('0x12')],_0x30669b);_0x2842f5(_0x4087d8['error'](0x1f4,_0x34e0df['message']));});});};exports[_0x7296('0x24')]=function(_0x14ca1a){var _0x3b18e6=this;return new Promise(function(_0x3d45dc,_0x44c597){return db[_0x7296('0x16')][_0x7296('0x25')](_0x14ca1a[_0x7296('0x22')],{'raw':_0x14ca1a[_0x7296('0x18')]?_0x14ca1a[_0x7296('0x18')][_0x7296('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14ca1a[_0x7296('0x18')]?_0x14ca1a['options']['where']||null:null,'attributes':_0x14ca1a[_0x7296('0x18')]?_0x14ca1a[_0x7296('0x18')][_0x7296('0x1f')]||null:null,'limit':_0x14ca1a[_0x7296('0x18')]?_0x14ca1a[_0x7296('0x18')]['limit']||null:null})[_0x7296('0xc')](function(_0x55cbd2){logger['info'](_0x7296('0x24'),_0x14ca1a);logger[_0x7296('0x23')]('UpdateVoiceCallReport',_0x14ca1a,JSON[_0x7296('0x10')](_0x55cbd2));_0x3d45dc(_0x55cbd2);})[_0x7296('0x15')](function(_0x3d3b4e){logger[_0x7296('0x11')]('UpdateVoiceCallReport',_0x3d3b4e['message'],_0x14ca1a);_0x44c597(_0x3b18e6[_0x7296('0x11')](0x1f4,_0x3d3b4e['message']));});});}; \ No newline at end of file +var _0x5ec3=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','limit','map','model','include','then','CreateVoiceCallReport','body','UpdateVoiceCallReport','update','where','lodash','moment','randomstring','ioredis'];(function(_0x8ea5d6,_0x18115a){var _0x139946=function(_0x50641b){while(--_0x50641b){_0x8ea5d6['push'](_0x8ea5d6['shift']());}};_0x139946(++_0x18115a);}(_0x5ec3,0x12c));var _0x35ec=function(_0x596a91,_0x4a312b){_0x596a91=_0x596a91-0x0;var _0x109f9c=_0x5ec3[_0x596a91];return _0x109f9c;};'use strict';var _=require(_0x35ec('0x0'));var util=require('util');var moment=require(_0x35ec('0x1'));var BPromise=require('bluebird');var rs=require(_0x35ec('0x2'));var fs=require('fs');var Redis=require(_0x35ec('0x3'));var db=require(_0x35ec('0x4'))['db'];var utils=require(_0x35ec('0x5'));var logger=require(_0x35ec('0x6'))(_0x35ec('0x7'));var config=require(_0x35ec('0x8'));var jayson=require(_0x35ec('0x9'));var client=jayson[_0x35ec('0xa')][_0x35ec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ac813,_0x29c3fd,_0x23c02a){return new BPromise(function(_0x31c91f,_0x36ba1a){return client[_0x35ec('0xc')](_0x4ac813,_0x23c02a)['then'](function(_0x1d6c80){logger[_0x35ec('0xd')](_0x35ec('0xe'),_0x29c3fd,_0x35ec('0xf'));logger[_0x35ec('0x10')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x29c3fd,'request\x20sent',JSON[_0x35ec('0x11')](_0x1d6c80));if(_0x1d6c80['error']){if(_0x1d6c80['error'][_0x35ec('0x12')]===0x1f4){logger[_0x35ec('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x29c3fd,_0x1d6c80[_0x35ec('0x13')][_0x35ec('0x14')]);return _0x36ba1a(_0x1d6c80[_0x35ec('0x13')][_0x35ec('0x14')]);}logger['error'](_0x35ec('0xe'),_0x29c3fd,_0x1d6c80['error'][_0x35ec('0x14')]);return _0x31c91f(_0x1d6c80['error'][_0x35ec('0x14')]);}else{logger[_0x35ec('0xd')](_0x35ec('0xe'),_0x29c3fd,'request\x20sent');_0x31c91f(_0x1d6c80['result'][_0x35ec('0x14')]);}})[_0x35ec('0x15')](function(_0x28644e){logger[_0x35ec('0x13')](_0x35ec('0xe'),_0x29c3fd,_0x28644e);_0x36ba1a(_0x28644e);});});}exports[_0x35ec('0x16')]=function(_0x48d616){var _0x11109c=this;return new Promise(function(_0x18129f,_0x1208d4){return db[_0x35ec('0x17')][_0x35ec('0x18')]({'raw':_0x48d616[_0x35ec('0x19')]?_0x48d616[_0x35ec('0x19')][_0x35ec('0x1a')]===undefined?!![]:![]:!![],'where':_0x48d616[_0x35ec('0x19')]?_0x48d616[_0x35ec('0x19')]['where']||null:null,'attributes':_0x48d616['options']?_0x48d616[_0x35ec('0x19')][_0x35ec('0x1b')]||null:null,'limit':_0x48d616[_0x35ec('0x19')]?_0x48d616[_0x35ec('0x19')][_0x35ec('0x1c')]||null:null,'include':_0x48d616[_0x35ec('0x19')]?_0x48d616[_0x35ec('0x19')]['include']?_[_0x35ec('0x1d')](_0x48d616[_0x35ec('0x19')]['include'],function(_0x3651d6){return{'model':db[_0x3651d6[_0x35ec('0x1e')]],'as':_0x3651d6['as'],'attributes':_0x3651d6[_0x35ec('0x1b')],'include':_0x3651d6[_0x35ec('0x1f')]?_[_0x35ec('0x1d')](_0x3651d6[_0x35ec('0x1f')],function(_0x3e5c6e){return{'model':db[_0x3e5c6e[_0x35ec('0x1e')]],'as':_0x3e5c6e['as'],'attributes':_0x3e5c6e[_0x35ec('0x1b')],'include':_0x3e5c6e[_0x35ec('0x1f')]?_[_0x35ec('0x1d')](_0x3e5c6e[_0x35ec('0x1f')],function(_0x5c2e5f){return{'model':db[_0x5c2e5f[_0x35ec('0x1e')]],'as':_0x5c2e5f['as'],'attributes':_0x5c2e5f[_0x35ec('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x35ec('0x20')](function(_0x20e086){logger[_0x35ec('0xd')](_0x35ec('0x16'),_0x48d616);logger[_0x35ec('0x10')](_0x35ec('0x16'),_0x48d616,JSON[_0x35ec('0x11')](_0x20e086));_0x18129f(_0x20e086);})[_0x35ec('0x15')](function(_0x5457a1){logger[_0x35ec('0x13')](_0x35ec('0x16'),_0x5457a1['message'],_0x48d616);_0x1208d4(_0x11109c[_0x35ec('0x13')](0x1f4,_0x5457a1[_0x35ec('0x14')]));});});};exports[_0x35ec('0x21')]=function(_0x433804){var _0x2db50d=this;return new Promise(function(_0x328f63,_0x33ddb9){return db[_0x35ec('0x17')]['create'](_0x433804[_0x35ec('0x22')],{'raw':_0x433804[_0x35ec('0x19')]?_0x433804['options']['raw']===undefined?!![]:![]:!![]})[_0x35ec('0x20')](function(_0x14b19e){logger[_0x35ec('0xd')]('CreateVoiceCallReport',_0x433804);logger[_0x35ec('0x10')](_0x35ec('0x21'),_0x433804,JSON['stringify'](_0x14b19e));_0x328f63(_0x14b19e);})[_0x35ec('0x15')](function(_0x4a4949){logger['error'](_0x35ec('0x21'),_0x4a4949[_0x35ec('0x14')],_0x433804);_0x33ddb9(_0x2db50d[_0x35ec('0x13')](0x1f4,_0x4a4949[_0x35ec('0x14')]));});});};exports[_0x35ec('0x23')]=function(_0x2ca89d){var _0x81f8e8=this;return new Promise(function(_0x29d7df,_0x15f0f1){return db[_0x35ec('0x17')][_0x35ec('0x24')](_0x2ca89d[_0x35ec('0x22')],{'raw':_0x2ca89d[_0x35ec('0x19')]?_0x2ca89d[_0x35ec('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ca89d[_0x35ec('0x19')]?_0x2ca89d[_0x35ec('0x19')][_0x35ec('0x25')]||null:null,'attributes':_0x2ca89d[_0x35ec('0x19')]?_0x2ca89d[_0x35ec('0x19')][_0x35ec('0x1b')]||null:null,'limit':_0x2ca89d['options']?_0x2ca89d['options'][_0x35ec('0x1c')]||null:null})[_0x35ec('0x20')](function(_0x520c08){logger[_0x35ec('0xd')](_0x35ec('0x23'),_0x2ca89d);logger['debug']('UpdateVoiceCallReport',_0x2ca89d,JSON[_0x35ec('0x11')](_0x520c08));_0x29d7df(_0x520c08);})[_0x35ec('0x15')](function(_0x3b4477){logger[_0x35ec('0x13')](_0x35ec('0x23'),_0x3b4477[_0x35ec('0x14')],_0x2ca89d);_0x15f0f1(_0x81f8e8[_0x35ec('0x13')](0x1f4,_0x3b4477[_0x35ec('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 5fa75bb..59c0d94 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 _0xca39=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x4cbdfc,_0x1161af){var _0x19958f=function(_0x24f25a){while(--_0x24f25a){_0x4cbdfc['push'](_0x4cbdfc['shift']());}};_0x19958f(++_0x1161af);}(_0xca39,0x99));var _0x9ca3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xca39[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x9ca3('0x0'));var util=require(_0x9ca3('0x1'));var path=require(_0x9ca3('0x2'));var timeout=require(_0x9ca3('0x3'));var express=require(_0x9ca3('0x4'));var router=express[_0x9ca3('0x5')]();var fs_extra=require(_0x9ca3('0x6'));var auth=require(_0x9ca3('0x7'));var interaction=require(_0x9ca3('0x8'));var config=require(_0x9ca3('0x9'));var controller=require(_0x9ca3('0xa'));router['get']('/',auth[_0x9ca3('0xb')](),controller[_0x9ca3('0xc')]);router[_0x9ca3('0xd')](_0x9ca3('0xe'),auth['isAuthenticated'](),controller[_0x9ca3('0xf')]);router[_0x9ca3('0x10')]('/',auth[_0x9ca3('0xb')](),controller[_0x9ca3('0x11')]);router[_0x9ca3('0x12')](_0x9ca3('0xe'),auth[_0x9ca3('0xb')](),controller['update']);router[_0x9ca3('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x9ca3('0x14')]);module[_0x9ca3('0x15')]=router; \ No newline at end of file +var _0xba39=['update','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','isAuthenticated','index','get','show','post'];(function(_0x5b3946,_0x23053c){var _0x2bd577=function(_0x406e40){while(--_0x406e40){_0x5b3946['push'](_0x5b3946['shift']());}};_0x2bd577(++_0x23053c);}(_0xba39,0x16b));var _0x9ba3=function(_0x28d33c,_0x537f1a){_0x28d33c=_0x28d33c-0x0;var _0x2e90bf=_0xba39[_0x28d33c];return _0x2e90bf;};'use strict';var multer=require(_0x9ba3('0x0'));var util=require(_0x9ba3('0x1'));var path=require(_0x9ba3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9ba3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9ba3('0x4'));var interaction=require(_0x9ba3('0x5'));var config=require('../../config/environment');var controller=require(_0x9ba3('0x6'));router['get']('/',auth[_0x9ba3('0x7')](),controller[_0x9ba3('0x8')]);router[_0x9ba3('0x9')]('/:id',auth[_0x9ba3('0x7')](),controller[_0x9ba3('0xa')]);router[_0x9ba3('0xb')]('/',auth[_0x9ba3('0x7')](),controller['create']);router['put']('/:id',auth[_0x9ba3('0x7')](),controller[_0x9ba3('0xc')]);router['delete'](_0x9ba3('0xd'),auth[_0x9ba3('0x7')](),controller[_0x9ba3('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 c2ed72a..c7cc2c1 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 _0x3868=['join','getDataValue','split','sequelize','STRING','name','setDataValue','options'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x3868,0x1c3));var _0x8386=function(_0x4146eb,_0x275aff){_0x4146eb=_0x4146eb-0x0;var _0x5ee3d3=_0x3868[_0x4146eb];return _0x5ee3d3;};'use strict';var Sequelize=require(_0x8386('0x0'));module['exports']={'name':{'type':Sequelize[_0x8386('0x1')]},'prefix':{'type':Sequelize[_0x8386('0x1')],'unique':_0x8386('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x8386('0x1')],'set':function(_0x206701){this[_0x8386('0x3')](_0x8386('0x4'),_0x206701?_0x206701[_0x8386('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x8386('0x4'))?this[_0x8386('0x6')](_0x8386('0x4'))[_0x8386('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x8386('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x8386('0x1')]},'description':{'type':Sequelize[_0x8386('0x1')]}}; \ No newline at end of file +var _0xbee1=['BOOLEAN','sequelize','exports','STRING','name','options','join','getDataValue','split'];(function(_0x585199,_0x10d223){var _0x4f5eaf=function(_0x19f4cf){while(--_0x19f4cf){_0x585199['push'](_0x585199['shift']());}};_0x4f5eaf(++_0x10d223);}(_0xbee1,0x1c3));var _0x1bee=function(_0x4ff456,_0x57d067){_0x4ff456=_0x4ff456-0x0;var _0x28e3ee=_0xbee1[_0x4ff456];return _0x28e3ee;};'use strict';var Sequelize=require(_0x1bee('0x0'));module[_0x1bee('0x1')]={'name':{'type':Sequelize[_0x1bee('0x2')]},'prefix':{'type':Sequelize[_0x1bee('0x2')],'unique':_0x1bee('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x1bee('0x2')],'set':function(_0x25efa7){this['setDataValue'](_0x1bee('0x4'),_0x25efa7?_0x25efa7[_0x1bee('0x5')](''):[]);},'get':function(){return this[_0x1bee('0x6')]('options')?this['getDataValue']('options')[_0x1bee('0x7')](''):[];}},'auth':{'type':Sequelize[_0x1bee('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x1bee('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x1bee('0x2')]},'description':{'type':Sequelize[_0x1bee('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 1a07aec..a20db6b 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 _0x7ee1=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','get','ChanSpies','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','VoiceChanSpy','includeAll','include','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x164fdd,_0x571315){var _0x3735ea=function(_0x537bbb){while(--_0x537bbb){_0x164fdd['push'](_0x164fdd['shift']());}};_0x3735ea(++_0x571315);}(_0x7ee1,0xab));var _0x17ee=function(_0x10ebed,_0x3fd03e){_0x10ebed=_0x10ebed-0x0;var _0x46b824=_0x7ee1[_0x10ebed];return _0x46b824;};'use strict';var emlformat=require(_0x17ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x17ee('0x1'));var jsonpatch=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var moment=require(_0x17ee('0x4'));var BPromise=require(_0x17ee('0x5'));var Mustache=require('mustache');var util=require(_0x17ee('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x17ee('0x7'));var ejs=require(_0x17ee('0x8'));var fs=require('fs');var fs_extra=require(_0x17ee('0x9'));var _=require(_0x17ee('0xa'));var squel=require(_0x17ee('0xb'));var crypto=require('crypto');var jsforce=require(_0x17ee('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x17ee('0x7'));var querystring=require(_0x17ee('0xd'));var Papa=require('papaparse');var Redis=require(_0x17ee('0xe'));var authService=require(_0x17ee('0xf'));var qs=require(_0x17ee('0x10'));var as=require(_0x17ee('0x11'));var hardwareService=require(_0x17ee('0x12'));var logger=require(_0x17ee('0x13'))(_0x17ee('0x14'));var utils=require(_0x17ee('0x15'));var config=require(_0x17ee('0x16'));var licenseUtil=require(_0x17ee('0x17'));var db=require(_0x17ee('0x18'))['db'];function respondWithStatusCode(_0x372279,_0x5aa625){_0x5aa625=_0x5aa625||0xcc;return function(_0x2a0f19){if(_0x2a0f19){return _0x372279[_0x17ee('0x19')](_0x5aa625);}return _0x372279['status'](_0x5aa625)[_0x17ee('0x1a')]();};}function respondWithResult(_0x53a2c2,_0x2f452e){_0x2f452e=_0x2f452e||0xc8;return function(_0x27447d){if(_0x27447d){return _0x53a2c2[_0x17ee('0x1b')](_0x2f452e)[_0x17ee('0x1c')](_0x27447d);}};}function respondWithFilteredResult(_0x5eebbc,_0x3fa583){return function(_0x749078){if(_0x749078){var _0x1b09a3=typeof _0x3fa583['offset']===_0x17ee('0x1d')&&typeof _0x3fa583[_0x17ee('0x1e')]===_0x17ee('0x1d');var _0x384eaa=_0x749078[_0x17ee('0x1f')];var _0x3785ed=_0x1b09a3?0x0:_0x3fa583[_0x17ee('0x20')];var _0x5506a3=_0x1b09a3?_0x749078['count']:_0x3fa583[_0x17ee('0x20')]+_0x3fa583[_0x17ee('0x1e')];var _0x1f8fb;if(_0x5506a3>=_0x384eaa){_0x5506a3=_0x384eaa;_0x1f8fb=0xc8;}else{_0x1f8fb=0xce;}_0x5eebbc[_0x17ee('0x1b')](_0x1f8fb);return _0x5eebbc['set'](_0x17ee('0x21'),_0x3785ed+'-'+_0x5506a3+'/'+_0x384eaa)[_0x17ee('0x1c')](_0x749078);}return null;};}function patchUpdates(_0x25782c){return function(_0x3ace7f){try{jsonpatch['apply'](_0x3ace7f,_0x25782c,!![]);}catch(_0x2354a5){return BPromise[_0x17ee('0x22')](_0x2354a5);}return _0x3ace7f[_0x17ee('0x23')]();};}function saveUpdates(_0x54daae,_0x3672df){return function(_0x2d0297){if(_0x2d0297){return _0x2d0297[_0x17ee('0x24')](_0x54daae)[_0x17ee('0x25')](function(_0x3aee75){return _0x3aee75;});}return null;};}function removeEntity(_0x4804ea,_0x249a48){return function(_0xc01da5){if(_0xc01da5){return _0xc01da5[_0x17ee('0x26')]()[_0x17ee('0x25')](function(){var _0x88a4af=_0xc01da5[_0x17ee('0x27')]({'plain':!![]});var _0x13e8ff=_0x17ee('0x28');return db['UserProfileResource'][_0x17ee('0x26')]({'where':{'type':_0x13e8ff,'resourceId':_0x88a4af['id']}})[_0x17ee('0x25')](function(){return _0xc01da5;});})[_0x17ee('0x25')](function(){_0x4804ea[_0x17ee('0x1b')](0xcc)[_0x17ee('0x1a')]();});}};}function handleEntityNotFound(_0x345d22,_0x5b11c5){return function(_0x4ba675){if(!_0x4ba675){_0x345d22[_0x17ee('0x19')](0x194);}return _0x4ba675;};}function handleError(_0x400306,_0x390c04){_0x390c04=_0x390c04||0x1f4;return function(_0x5ea202){logger[_0x17ee('0x29')](_0x5ea202[_0x17ee('0x2a')]);if(_0x5ea202[_0x17ee('0x2b')]){delete _0x5ea202['name'];}_0x400306[_0x17ee('0x1b')](_0x390c04)[_0x17ee('0x2c')](_0x5ea202);};}exports[_0x17ee('0x2d')]=function(_0x1e5727,_0x4dfb63){var _0x3aa7fe={},_0x3e7b9b={},_0x3bdb0b={'count':0x0,'rows':[]};var _0x550175=_[_0x17ee('0x2e')](db['VoiceChanSpy'][_0x17ee('0x2f')],function(_0x1cf8b9){return{'name':_0x1cf8b9[_0x17ee('0x30')],'type':_0x1cf8b9['type'][_0x17ee('0x31')]};});_0x3e7b9b['model']=_[_0x17ee('0x2e')](_0x550175,_0x17ee('0x2b'));_0x3e7b9b[_0x17ee('0x32')]=_[_0x17ee('0x33')](_0x1e5727['query']);_0x3e7b9b[_0x17ee('0x34')]=_[_0x17ee('0x35')](_0x3e7b9b[_0x17ee('0x36')],_0x3e7b9b['query']);_0x3aa7fe[_0x17ee('0x37')]=_[_0x17ee('0x35')](_0x3e7b9b[_0x17ee('0x36')],qs['fields'](_0x1e5727[_0x17ee('0x32')][_0x17ee('0x38')]));_0x3aa7fe[_0x17ee('0x37')]=_0x3aa7fe[_0x17ee('0x37')][_0x17ee('0x39')]?_0x3aa7fe[_0x17ee('0x37')]:_0x3e7b9b[_0x17ee('0x36')];if(!_0x1e5727[_0x17ee('0x32')][_0x17ee('0x3a')](_0x17ee('0x3b'))){_0x3aa7fe['limit']=qs[_0x17ee('0x1e')](_0x1e5727[_0x17ee('0x32')][_0x17ee('0x1e')]);_0x3aa7fe[_0x17ee('0x20')]=qs[_0x17ee('0x20')](_0x1e5727[_0x17ee('0x32')][_0x17ee('0x20')]);}_0x3aa7fe[_0x17ee('0x3c')]=qs[_0x17ee('0x3d')](_0x1e5727[_0x17ee('0x32')][_0x17ee('0x3d')]);_0x3aa7fe['where']=qs[_0x17ee('0x34')](_[_0x17ee('0x3e')](_0x1e5727['query'],_0x3e7b9b[_0x17ee('0x34')]),_0x550175);if(_0x1e5727[_0x17ee('0x32')][_0x17ee('0x3f')]){_0x3aa7fe[_0x17ee('0x40')]=_[_0x17ee('0x41')](_0x3aa7fe[_0x17ee('0x40')],{'$or':_['map'](_0x550175,function(_0x47b543){if(_0x47b543[_0x17ee('0x42')]!==_0x17ee('0x43')){var _0x12adc6={};_0x12adc6[_0x47b543[_0x17ee('0x2b')]]={'$like':'%'+_0x1e5727[_0x17ee('0x32')][_0x17ee('0x3f')]+'%'};return _0x12adc6;}})});}_0x3aa7fe=_['merge']({},_0x3aa7fe,_0x1e5727[_0x17ee('0x44')]);var _0x13260c={'where':_0x3aa7fe['where']};return db[_0x17ee('0x45')]['count'](_0x13260c)[_0x17ee('0x25')](function(_0x49a03c){_0x3bdb0b[_0x17ee('0x1f')]=_0x49a03c;if(_0x1e5727[_0x17ee('0x32')][_0x17ee('0x46')]){_0x3aa7fe[_0x17ee('0x47')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x3aa7fe);})['then'](function(_0x5c5452){_0x3bdb0b[_0x17ee('0x48')]=_0x5c5452;return _0x3bdb0b;})[_0x17ee('0x25')](respondWithFilteredResult(_0x4dfb63,_0x3aa7fe))['catch'](handleError(_0x4dfb63,null));};exports[_0x17ee('0x49')]=function(_0x1d82eb,_0xe2f73b){var _0xcf486={'raw':![],'where':{'id':_0x1d82eb[_0x17ee('0x4a')]['id']}},_0x31e4f1={};_0x31e4f1[_0x17ee('0x36')]=_[_0x17ee('0x33')](db['VoiceChanSpy'][_0x17ee('0x2f')]);_0x31e4f1[_0x17ee('0x32')]=_['keys'](_0x1d82eb[_0x17ee('0x32')]);_0x31e4f1[_0x17ee('0x34')]=_[_0x17ee('0x35')](_0x31e4f1['model'],_0x31e4f1['query']);_0xcf486['attributes']=_[_0x17ee('0x35')](_0x31e4f1[_0x17ee('0x36')],qs[_0x17ee('0x38')](_0x1d82eb[_0x17ee('0x32')][_0x17ee('0x38')]));_0xcf486[_0x17ee('0x37')]=_0xcf486[_0x17ee('0x37')][_0x17ee('0x39')]?_0xcf486['attributes']:_0x31e4f1[_0x17ee('0x36')];if(_0x1d82eb[_0x17ee('0x32')][_0x17ee('0x46')]){_0xcf486[_0x17ee('0x47')]=[{'all':!![]}];}_0xcf486=_[_0x17ee('0x41')]({},_0xcf486,_0x1d82eb[_0x17ee('0x44')]);return db[_0x17ee('0x45')]['find'](_0xcf486)[_0x17ee('0x25')](handleEntityNotFound(_0xe2f73b,null))[_0x17ee('0x25')](respondWithResult(_0xe2f73b,null))[_0x17ee('0x4b')](handleError(_0xe2f73b,null));};exports[_0x17ee('0x4c')]=function(_0x5c4f71,_0x10a097){return db[_0x17ee('0x45')][_0x17ee('0x4c')](_0x5c4f71[_0x17ee('0x4d')],{})['then'](function(_0x3fa45f){var _0x34faf0=_0x5c4f71[_0x17ee('0x4e')][_0x17ee('0x27')]({'plain':!![]});if(!_0x34faf0)throw new Error(_0x17ee('0x4f'));if(_0x34faf0[_0x17ee('0x50')]===_0x17ee('0x4e')){var _0x2f9cd4=_0x3fa45f['get']({'plain':!![]});var _0x585a31=_0x17ee('0x28');return db[_0x17ee('0x51')]['find']({'where':{'name':_0x585a31,'userProfileId':_0x34faf0[_0x17ee('0x52')]},'raw':!![]})[_0x17ee('0x25')](function(_0x32efef){if(_0x32efef&&_0x32efef[_0x17ee('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x2f9cd4[_0x17ee('0x2b')],'resourceId':_0x2f9cd4['id'],'type':_0x32efef[_0x17ee('0x2b')],'sectionId':_0x32efef['id']},{})['then'](function(){return _0x3fa45f;});}else{return _0x3fa45f;}})['catch'](function(_0x22b890){logger['error'](_0x17ee('0x54'),_0x22b890);throw _0x22b890;});}return _0x3fa45f;})['then'](respondWithResult(_0x10a097,0xc9))[_0x17ee('0x4b')](handleError(_0x10a097,null));};exports['update']=function(_0x329c99,_0x25e765){if(_0x329c99[_0x17ee('0x4d')]['id']){delete _0x329c99['body']['id'];}return db[_0x17ee('0x45')]['find']({'where':{'id':_0x329c99['params']['id']}})['then'](handleEntityNotFound(_0x25e765,null))[_0x17ee('0x25')](saveUpdates(_0x329c99[_0x17ee('0x4d')],null))['then'](respondWithResult(_0x25e765,null))[_0x17ee('0x4b')](handleError(_0x25e765,null));};exports[_0x17ee('0x26')]=function(_0x3075cf,_0x45854c){return db[_0x17ee('0x45')]['find']({'where':{'id':_0x3075cf[_0x17ee('0x4a')]['id']}})[_0x17ee('0x25')](handleEntityNotFound(_0x45854c,null))['then'](removeEntity(_0x45854c,null))[_0x17ee('0x4b')](handleError(_0x45854c,null));}; \ No newline at end of file +var _0x7b05=['path','sox','to-csv','fs-extra','squel','crypto','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','undefined','limit','count','status','set','reject','save','update','then','get','ChanSpies','UserProfileResource','destroy','sendStatus','name','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceChanSpy','includeAll','include','catch','show','params','options','find','create','body','user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x41d14e,_0x2682b5){var _0x599a11=function(_0x28f2f5){while(--_0x28f2f5){_0x41d14e['push'](_0x41d14e['shift']());}};_0x599a11(++_0x2682b5);}(_0x7b05,0x91));var _0x57b0=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0x7b05[_0x162780];return _0x1ea2dc;};'use strict';var emlformat=require(_0x57b0('0x0'));var rimraf=require(_0x57b0('0x1'));var zipdir=require(_0x57b0('0x2'));var jsonpatch=require(_0x57b0('0x3'));var rp=require('request-promise');var moment=require(_0x57b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x57b0('0x5'));var util=require(_0x57b0('0x6'));var path=require(_0x57b0('0x7'));var sox=require(_0x57b0('0x8'));var csv=require(_0x57b0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x57b0('0xa'));var _=require('lodash');var squel=require(_0x57b0('0xb'));var crypto=require(_0x57b0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x57b0('0xd'));var Redis=require(_0x57b0('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57b0('0xf'));var logger=require(_0x57b0('0x10'))(_0x57b0('0x11'));var utils=require(_0x57b0('0x12'));var config=require(_0x57b0('0x13'));var licenseUtil=require(_0x57b0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x363096,_0x145eae){_0x145eae=_0x145eae||0xcc;return function(_0xee8335){if(_0xee8335){return _0x363096['sendStatus'](_0x145eae);}return _0x363096['status'](_0x145eae)[_0x57b0('0x15')]();};}function respondWithResult(_0x3f95e3,_0xc9044f){_0xc9044f=_0xc9044f||0xc8;return function(_0x3b48a3){if(_0x3b48a3){return _0x3f95e3['status'](_0xc9044f)[_0x57b0('0x16')](_0x3b48a3);}};}function respondWithFilteredResult(_0x5c46a5,_0x235d4a){return function(_0xa20423){if(_0xa20423){var _0x55fd9c=typeof _0x235d4a[_0x57b0('0x17')]===_0x57b0('0x18')&&typeof _0x235d4a[_0x57b0('0x19')]===_0x57b0('0x18');var _0x3eb198=_0xa20423['count'];var _0x37bd5d=_0x55fd9c?0x0:_0x235d4a['offset'];var _0x592b2d=_0x55fd9c?_0xa20423[_0x57b0('0x1a')]:_0x235d4a[_0x57b0('0x17')]+_0x235d4a[_0x57b0('0x19')];var _0x3e14f5;if(_0x592b2d>=_0x3eb198){_0x592b2d=_0x3eb198;_0x3e14f5=0xc8;}else{_0x3e14f5=0xce;}_0x5c46a5[_0x57b0('0x1b')](_0x3e14f5);return _0x5c46a5[_0x57b0('0x1c')]('Content-Range',_0x37bd5d+'-'+_0x592b2d+'/'+_0x3eb198)[_0x57b0('0x16')](_0xa20423);}return null;};}function patchUpdates(_0x1d81ff){return function(_0x35a457){try{jsonpatch['apply'](_0x35a457,_0x1d81ff,!![]);}catch(_0x12f2f6){return BPromise[_0x57b0('0x1d')](_0x12f2f6);}return _0x35a457[_0x57b0('0x1e')]();};}function saveUpdates(_0x149056,_0x2ffc0a){return function(_0x22b11e){if(_0x22b11e){return _0x22b11e[_0x57b0('0x1f')](_0x149056)[_0x57b0('0x20')](function(_0x3497e4){return _0x3497e4;});}return null;};}function removeEntity(_0x5c60b9,_0x55b870){return function(_0x40c279){if(_0x40c279){return _0x40c279['destroy']()[_0x57b0('0x20')](function(){var _0x3ce739=_0x40c279[_0x57b0('0x21')]({'plain':!![]});var _0x38e3a0=_0x57b0('0x22');return db[_0x57b0('0x23')][_0x57b0('0x24')]({'where':{'type':_0x38e3a0,'resourceId':_0x3ce739['id']}})[_0x57b0('0x20')](function(){return _0x40c279;});})[_0x57b0('0x20')](function(){_0x5c60b9[_0x57b0('0x1b')](0xcc)[_0x57b0('0x15')]();});}};}function handleEntityNotFound(_0x43b90f,_0x196c85){return function(_0x508288){if(!_0x508288){_0x43b90f[_0x57b0('0x25')](0x194);}return _0x508288;};}function handleError(_0x114cd7,_0xf8e773){_0xf8e773=_0xf8e773||0x1f4;return function(_0x228dfe){logger['error'](_0x228dfe['stack']);if(_0x228dfe[_0x57b0('0x26')]){delete _0x228dfe[_0x57b0('0x26')];}_0x114cd7[_0x57b0('0x1b')](_0xf8e773)['send'](_0x228dfe);};}exports['index']=function(_0x9d9195,_0x577dae){var _0x12f4bf={},_0x5b6c1d={},_0x5d19a6={'count':0x0,'rows':[]};var _0x2fb4b7=_[_0x57b0('0x27')](db['VoiceChanSpy'][_0x57b0('0x28')],function(_0x32e03e){return{'name':_0x32e03e['fieldName'],'type':_0x32e03e[_0x57b0('0x29')][_0x57b0('0x2a')]};});_0x5b6c1d[_0x57b0('0x2b')]=_['map'](_0x2fb4b7,_0x57b0('0x26'));_0x5b6c1d[_0x57b0('0x2c')]=_[_0x57b0('0x2d')](_0x9d9195[_0x57b0('0x2c')]);_0x5b6c1d[_0x57b0('0x2e')]=_['intersection'](_0x5b6c1d['model'],_0x5b6c1d['query']);_0x12f4bf['attributes']=_[_0x57b0('0x2f')](_0x5b6c1d[_0x57b0('0x2b')],qs[_0x57b0('0x30')](_0x9d9195[_0x57b0('0x2c')][_0x57b0('0x30')]));_0x12f4bf['attributes']=_0x12f4bf[_0x57b0('0x31')][_0x57b0('0x32')]?_0x12f4bf[_0x57b0('0x31')]:_0x5b6c1d[_0x57b0('0x2b')];if(!_0x9d9195['query'][_0x57b0('0x33')](_0x57b0('0x34'))){_0x12f4bf['limit']=qs[_0x57b0('0x19')](_0x9d9195[_0x57b0('0x2c')]['limit']);_0x12f4bf['offset']=qs[_0x57b0('0x17')](_0x9d9195[_0x57b0('0x2c')][_0x57b0('0x17')]);}_0x12f4bf[_0x57b0('0x35')]=qs[_0x57b0('0x36')](_0x9d9195[_0x57b0('0x2c')][_0x57b0('0x36')]);_0x12f4bf[_0x57b0('0x37')]=qs[_0x57b0('0x2e')](_[_0x57b0('0x38')](_0x9d9195[_0x57b0('0x2c')],_0x5b6c1d[_0x57b0('0x2e')]),_0x2fb4b7);if(_0x9d9195['query'][_0x57b0('0x39')]){_0x12f4bf[_0x57b0('0x37')]=_[_0x57b0('0x3a')](_0x12f4bf['where'],{'$or':_['map'](_0x2fb4b7,function(_0x48bf5c){if(_0x48bf5c[_0x57b0('0x29')]!==_0x57b0('0x3b')){var _0xc3b922={};_0xc3b922[_0x48bf5c[_0x57b0('0x26')]]={'$like':'%'+_0x9d9195['query'][_0x57b0('0x39')]+'%'};return _0xc3b922;}})});}_0x12f4bf=_[_0x57b0('0x3a')]({},_0x12f4bf,_0x9d9195['options']);var _0x24afa0={'where':_0x12f4bf[_0x57b0('0x37')]};return db[_0x57b0('0x3c')][_0x57b0('0x1a')](_0x24afa0)[_0x57b0('0x20')](function(_0x5980db){_0x5d19a6[_0x57b0('0x1a')]=_0x5980db;if(_0x9d9195[_0x57b0('0x2c')][_0x57b0('0x3d')]){_0x12f4bf[_0x57b0('0x3e')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x12f4bf);})[_0x57b0('0x20')](function(_0x344bc6){_0x5d19a6['rows']=_0x344bc6;return _0x5d19a6;})[_0x57b0('0x20')](respondWithFilteredResult(_0x577dae,_0x12f4bf))[_0x57b0('0x3f')](handleError(_0x577dae,null));};exports[_0x57b0('0x40')]=function(_0x546d5d,_0x4f5ebd){var _0x3b7b4a={'raw':![],'where':{'id':_0x546d5d[_0x57b0('0x41')]['id']}},_0x3f3b1c={};_0x3f3b1c[_0x57b0('0x2b')]=_[_0x57b0('0x2d')](db['VoiceChanSpy'][_0x57b0('0x28')]);_0x3f3b1c[_0x57b0('0x2c')]=_[_0x57b0('0x2d')](_0x546d5d[_0x57b0('0x2c')]);_0x3f3b1c[_0x57b0('0x2e')]=_['intersection'](_0x3f3b1c['model'],_0x3f3b1c['query']);_0x3b7b4a['attributes']=_[_0x57b0('0x2f')](_0x3f3b1c[_0x57b0('0x2b')],qs[_0x57b0('0x30')](_0x546d5d[_0x57b0('0x2c')][_0x57b0('0x30')]));_0x3b7b4a[_0x57b0('0x31')]=_0x3b7b4a[_0x57b0('0x31')]['length']?_0x3b7b4a[_0x57b0('0x31')]:_0x3f3b1c[_0x57b0('0x2b')];if(_0x546d5d[_0x57b0('0x2c')][_0x57b0('0x3d')]){_0x3b7b4a[_0x57b0('0x3e')]=[{'all':!![]}];}_0x3b7b4a=_[_0x57b0('0x3a')]({},_0x3b7b4a,_0x546d5d[_0x57b0('0x42')]);return db['VoiceChanSpy'][_0x57b0('0x43')](_0x3b7b4a)['then'](handleEntityNotFound(_0x4f5ebd,null))[_0x57b0('0x20')](respondWithResult(_0x4f5ebd,null))['catch'](handleError(_0x4f5ebd,null));};exports[_0x57b0('0x44')]=function(_0x5cae47,_0x40dae2){return db[_0x57b0('0x3c')]['create'](_0x5cae47[_0x57b0('0x45')],{})[_0x57b0('0x20')](function(_0x1047a2){var _0x4fe484=_0x5cae47[_0x57b0('0x46')][_0x57b0('0x21')]({'plain':!![]});if(!_0x4fe484)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fe484[_0x57b0('0x47')]===_0x57b0('0x46')){var _0x4d891b=_0x1047a2[_0x57b0('0x21')]({'plain':!![]});var _0x35ed98=_0x57b0('0x22');return db[_0x57b0('0x48')][_0x57b0('0x43')]({'where':{'name':_0x35ed98,'userProfileId':_0x4fe484['userProfileId']},'raw':!![]})['then'](function(_0x3696b5){if(_0x3696b5&&_0x3696b5[_0x57b0('0x49')]===0x0){return db[_0x57b0('0x23')]['create']({'name':_0x4d891b[_0x57b0('0x26')],'resourceId':_0x4d891b['id'],'type':_0x3696b5[_0x57b0('0x26')],'sectionId':_0x3696b5['id']},{})[_0x57b0('0x20')](function(){return _0x1047a2;});}else{return _0x1047a2;}})[_0x57b0('0x3f')](function(_0xe3c067){logger[_0x57b0('0x4a')](_0x57b0('0x4b'),_0xe3c067);throw _0xe3c067;});}return _0x1047a2;})[_0x57b0('0x20')](respondWithResult(_0x40dae2,0xc9))[_0x57b0('0x3f')](handleError(_0x40dae2,null));};exports[_0x57b0('0x1f')]=function(_0x1350a0,_0x446d19){if(_0x1350a0[_0x57b0('0x45')]['id']){delete _0x1350a0[_0x57b0('0x45')]['id'];}return db[_0x57b0('0x3c')][_0x57b0('0x43')]({'where':{'id':_0x1350a0[_0x57b0('0x41')]['id']}})[_0x57b0('0x20')](handleEntityNotFound(_0x446d19,null))['then'](saveUpdates(_0x1350a0[_0x57b0('0x45')],null))[_0x57b0('0x20')](respondWithResult(_0x446d19,null))[_0x57b0('0x3f')](handleError(_0x446d19,null));};exports['destroy']=function(_0x56bcec,_0x2670f5){return db['VoiceChanSpy']['find']({'where':{'id':_0x56bcec[_0x57b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2670f5,null))[_0x57b0('0x20')](removeEntity(_0x2670f5,null))['catch'](handleError(_0x2670f5,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 151ea3b..9847e67 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 _0x4ee7=['./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','merge','Set','format','chanspy','push','MixMonitor','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','record','length','concat','internal','User','findAll','agent','then','exports','VoiceExtension','catch','bulkCreate','destroy','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4ee7,0xa9));var _0x74ee=function(_0x2766ba,_0x201b3c){_0x2766ba=_0x2766ba-0x0;var _0x5697e3=_0x4ee7[_0x2766ba];return _0x5697e3;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x74ee('0x0'));var attributes=require(_0x74ee('0x1'));var getUserApplications=function(_0x581eee,_0x2c6d77,_0x1601fb){var _0x5cc84d=0x1;var _0x506bc1=[];var _0x1ace5e={'context':_0x2c6d77[_0x74ee('0x2')]||_0x74ee('0x3'),'exten':util['format'](_0x74ee('0x4'),_0x581eee[_0x74ee('0x5')],_0x1601fb),'type':_0x74ee('0x6'),'isApp':![],'ChanSpyId':_0x581eee['id'],'UserId':_0x2c6d77['id']};_0x506bc1['push'](_[_0x74ee('0x7')]({'app':_0x74ee('0x8'),'appdata':util[_0x74ee('0x9')]('CDR(type)=%s',_0x74ee('0xa')),'priority':_0x5cc84d++},_0x1ace5e));if(_0x581eee['record']){_0x506bc1[_0x74ee('0xb')](_['merge']({'app':_0x74ee('0xc'),'appdata':util[_0x74ee('0x9')]('${UNIQUEID}.%s,a',_0x581eee['recordingFormat']),'priority':_0x5cc84d++},_0x1ace5e));}if(_0x581eee[_0x74ee('0xd')]){_0x506bc1[_0x74ee('0xb')](_[_0x74ee('0x7')]({'app':_0x74ee('0xe'),'appdata':_0x581eee[_0x74ee('0xf')],'priority':_0x5cc84d++},_0x1ace5e));}_0x506bc1['push'](_['merge']({'app':_0x74ee('0x10'),'appdata':util[_0x74ee('0x9')](_0x74ee('0x11'),_0x2c6d77[_0x74ee('0x12')],_0x581eee[_0x74ee('0x13')]?_0x581eee[_0x74ee('0x13')][_0x74ee('0x14')](''):''),'priority':_0x5cc84d++},_0x1ace5e));if(_0x581eee[_0x74ee('0x15')]){_0x506bc1[_0x74ee('0xb')](_[_0x74ee('0x7')]({'app':'StopMixMonitor','priority':_0x5cc84d++},_0x1ace5e));}return _0x506bc1;};var getChanSpyApplications=function(_0xa40159,_0x433b54){var _0x406d70=[];for(var _0x4aad35=0x0,_0x58831f=0x1;_0x4aad35<_0x433b54[_0x74ee('0x16')];_0x4aad35++,_0x58831f=0x1){_0x406d70=_0x406d70[_0x74ee('0x17')](getUserApplications(_0xa40159,_0x433b54[_0x4aad35],_0x433b54[_0x4aad35][_0x74ee('0x18')]));if(_0x433b54[_0x4aad35][_0x74ee('0x18')]!=_0x433b54[_0x4aad35][_0x74ee('0x12')]){_0x406d70=_0x406d70[_0x74ee('0x17')](getUserApplications(_0xa40159,_0x433b54[_0x4aad35],_0x433b54[_0x4aad35]['name']));}}return _0x406d70;};var getChanSpyPromise=function(_0x4ffbbc,_0x1fca54){return new BPromise(function(_0x11e867,_0x28ac49){return _0x4ffbbc[_0x74ee('0x19')][_0x74ee('0x1a')]({'attributes':['id',_0x74ee('0x12'),'internal'],'where':{'role':_0x74ee('0x1b'),'chanspy':!![]},'raw':!![]})[_0x74ee('0x1c')](function(_0x10f1da){if(_0x10f1da){return _0x11e867(getChanSpyApplications(_0x1fca54,_0x10f1da));}return _0x11e867([]);})['catch'](function(_0x56eefa){_0x28ac49(_0x56eefa);});});};module[_0x74ee('0x1d')]=function(_0x4190b8,_0x481e75){var _0x26f3b7=_0x4190b8['models'];return _0x4190b8['define']('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c30a9,_0x6e2cc5,_0xb47f7b){return getChanSpyPromise(_0x26f3b7,_0x5c30a9)['then'](function(_0x13c22a){if(_0x13c22a&&_0x13c22a[_0x74ee('0x16')]){return _0x26f3b7[_0x74ee('0x1e')]['bulkCreate'](_0x13c22a);}})[_0x74ee('0x1c')](function(){_0xb47f7b();})[_0x74ee('0x1f')](function(_0x2b69ef){_0xb47f7b(_0x2b69ef);});},'afterUpdate':function(_0x2f771e,_0x10edda,_0x5dbc48){return _0x26f3b7[_0x74ee('0x1e')]['destroy']({'where':{'ChanSpyId':_0x2f771e['id']}})[_0x74ee('0x1c')](function(){return getChanSpyPromise(_0x26f3b7,_0x2f771e);})[_0x74ee('0x1c')](function(_0x38b21f){if(_0x38b21f&&_0x38b21f[_0x74ee('0x16')]){return _0x26f3b7['VoiceExtension'][_0x74ee('0x20')](_0x38b21f);}})[_0x74ee('0x1c')](function(){_0x5dbc48();})[_0x74ee('0x1f')](function(_0x5b9385){_0x5dbc48(_0x5b9385);});},'afterDestroy':function(_0x23d34f,_0x35c5e1,_0x41c4b7){return _0x26f3b7['VoiceExtension'][_0x74ee('0x21')]({'where':{'ChanSpyId':_0x23d34f['id']}})[_0x74ee('0x1c')](function(){_0x41c4b7();})['catch'](function(_0x26502f){_0x41c4b7(_0x26502f);});}}});}; \ No newline at end of file +var _0x7795=['auth','push','Authenticate','password','ChanSpy','SIP/%s,%s','name','join','record','StopMixMonitor','length','concat','internal','User','findAll','agent','exports','models','VoiceChanSpy','VoiceExtension','bulkCreate','catch','destroy','then','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','merge','Set','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat'];(function(_0x125339,_0x3e13b3){var _0x303dec=function(_0x299719){while(--_0x299719){_0x125339['push'](_0x125339['shift']());}};_0x303dec(++_0x3e13b3);}(_0x7795,0x90));var _0x5779=function(_0x1947d6,_0x168dc5){_0x1947d6=_0x1947d6-0x0;var _0x2b39d0=_0x7795[_0x1947d6];return _0x2b39d0;};'use strict';var _=require(_0x5779('0x0'));var util=require(_0x5779('0x1'));var BPromise=require(_0x5779('0x2'));var attributes=require(_0x5779('0x3'));var getUserApplications=function(_0x3b5836,_0x43da94,_0x505374){var _0x35cf9b=0x1;var _0x553809=[];var _0x4966af={'context':_0x43da94[_0x5779('0x4')]||_0x5779('0x5'),'exten':util[_0x5779('0x6')]('%s%s',_0x3b5836[_0x5779('0x7')],_0x505374),'type':_0x5779('0x8'),'isApp':![],'ChanSpyId':_0x3b5836['id'],'UserId':_0x43da94['id']};_0x553809['push'](_[_0x5779('0x9')]({'app':_0x5779('0xa'),'appdata':util['format'](_0x5779('0xb'),_0x5779('0xc')),'priority':_0x35cf9b++},_0x4966af));if(_0x3b5836['record']){_0x553809['push'](_[_0x5779('0x9')]({'app':_0x5779('0xd'),'appdata':util[_0x5779('0x6')](_0x5779('0xe'),_0x3b5836[_0x5779('0xf')]),'priority':_0x35cf9b++},_0x4966af));}if(_0x3b5836[_0x5779('0x10')]){_0x553809[_0x5779('0x11')](_[_0x5779('0x9')]({'app':_0x5779('0x12'),'appdata':_0x3b5836[_0x5779('0x13')],'priority':_0x35cf9b++},_0x4966af));}_0x553809[_0x5779('0x11')](_[_0x5779('0x9')]({'app':_0x5779('0x14'),'appdata':util[_0x5779('0x6')](_0x5779('0x15'),_0x43da94[_0x5779('0x16')],_0x3b5836['options']?_0x3b5836['options'][_0x5779('0x17')](''):''),'priority':_0x35cf9b++},_0x4966af));if(_0x3b5836[_0x5779('0x18')]){_0x553809[_0x5779('0x11')](_[_0x5779('0x9')]({'app':_0x5779('0x19'),'priority':_0x35cf9b++},_0x4966af));}return _0x553809;};var getChanSpyApplications=function(_0x55b2d4,_0x27f173){var _0x1e59be=[];for(var _0x1a8fcf=0x0,_0x1355e2=0x1;_0x1a8fcf<_0x27f173[_0x5779('0x1a')];_0x1a8fcf++,_0x1355e2=0x1){_0x1e59be=_0x1e59be[_0x5779('0x1b')](getUserApplications(_0x55b2d4,_0x27f173[_0x1a8fcf],_0x27f173[_0x1a8fcf][_0x5779('0x1c')]));if(_0x27f173[_0x1a8fcf][_0x5779('0x1c')]!=_0x27f173[_0x1a8fcf][_0x5779('0x16')]){_0x1e59be=_0x1e59be[_0x5779('0x1b')](getUserApplications(_0x55b2d4,_0x27f173[_0x1a8fcf],_0x27f173[_0x1a8fcf][_0x5779('0x16')]));}}return _0x1e59be;};var getChanSpyPromise=function(_0x11170e,_0x126aab){return new BPromise(function(_0x2561d5,_0x2b83a2){return _0x11170e[_0x5779('0x1d')][_0x5779('0x1e')]({'attributes':['id',_0x5779('0x16'),_0x5779('0x1c')],'where':{'role':_0x5779('0x1f'),'chanspy':!![]},'raw':!![]})['then'](function(_0x5e3884){if(_0x5e3884){return _0x2561d5(getChanSpyApplications(_0x126aab,_0x5e3884));}return _0x2561d5([]);})['catch'](function(_0xdc3336){_0x2b83a2(_0xdc3336);});});};module[_0x5779('0x20')]=function(_0x687238,_0x2c72f6){var _0x290647=_0x687238[_0x5779('0x21')];return _0x687238['define'](_0x5779('0x22'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xc9f9f,_0x17dacc,_0x9170b1){return getChanSpyPromise(_0x290647,_0xc9f9f)['then'](function(_0x247708){if(_0x247708&&_0x247708[_0x5779('0x1a')]){return _0x290647[_0x5779('0x23')][_0x5779('0x24')](_0x247708);}})['then'](function(){_0x9170b1();})[_0x5779('0x25')](function(_0x142ebb){_0x9170b1(_0x142ebb);});},'afterUpdate':function(_0x51d6f3,_0x5a34cb,_0x4ca93e){return _0x290647['VoiceExtension'][_0x5779('0x26')]({'where':{'ChanSpyId':_0x51d6f3['id']}})[_0x5779('0x27')](function(){return getChanSpyPromise(_0x290647,_0x51d6f3);})['then'](function(_0x421b98){if(_0x421b98&&_0x421b98[_0x5779('0x1a')]){return _0x290647['VoiceExtension'][_0x5779('0x24')](_0x421b98);}})[_0x5779('0x27')](function(){_0x4ca93e();})[_0x5779('0x25')](function(_0x2cf7b0){_0x4ca93e(_0x2cf7b0);});},'afterDestroy':function(_0x335265,_0x2ea45c,_0x12dfa6){return _0x290647[_0x5779('0x23')][_0x5779('0x26')]({'where':{'ChanSpyId':_0x335265['id']}})[_0x5779('0x27')](function(){_0x12dfa6();})[_0x5779('0x25')](function(_0xdf0d50){_0x12dfa6(_0xdf0d50);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 0ecd559..de3f60a 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 _0x668b=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x30e0ad,_0x294509){var _0x54a1c9=function(_0x19c601){while(--_0x19c601){_0x30e0ad['push'](_0x30e0ad['shift']());}};_0x54a1c9(++_0x294509);}(_0x668b,0x140));var _0xb668=function(_0x54bac5,_0x8d3a16){_0x54bac5=_0x54bac5-0x0;var _0xc15971=_0x668b[_0x54bac5];return _0xc15971;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var moment=require('moment');var BPromise=require(_0xb668('0x2'));var rs=require(_0xb668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb668('0x5'))(_0xb668('0x6'));var config=require(_0xb668('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb668('0x8')][_0xb668('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3be92e,_0x2778e9,_0x20b749){return new BPromise(function(_0x3f01bc,_0x517fc5){return client[_0xb668('0xa')](_0x3be92e,_0x20b749)[_0xb668('0xb')](function(_0x128cf5){logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));logger[_0xb668('0xf')](_0xb668('0x10'),_0x2778e9,'request\x20sent',JSON[_0xb668('0x11')](_0x128cf5));if(_0x128cf5[_0xb668('0x12')]){if(_0x128cf5[_0xb668('0x12')][_0xb668('0x13')]===0x1f4){logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x517fc5(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x3f01bc(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}else{logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));_0x3f01bc(_0x128cf5[_0xb668('0x15')][_0xb668('0x14')]);}})[_0xb668('0x16')](function(_0x4ab137){logger[_0xb668('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x2778e9,_0x4ab137);_0x517fc5(_0x4ab137);});});} \ No newline at end of file +var _0xc901=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','lodash'];(function(_0xb20672,_0x3da81a){var _0x2f2341=function(_0x1d16a0){while(--_0x1d16a0){_0xb20672['push'](_0xb20672['shift']());}};_0x2f2341(++_0x3da81a);}(_0xc901,0x142));var _0x1c90=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc901[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x1c90('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c90('0x1'));var db=require(_0x1c90('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c90('0x3'))(_0x1c90('0x4'));var config=require(_0x1c90('0x5'));var jayson=require(_0x1c90('0x6'));var client=jayson[_0x1c90('0x7')][_0x1c90('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x912860,_0x12c07d,_0x423cfb){return new BPromise(function(_0x19196f,_0x514386){return client[_0x1c90('0x9')](_0x912860,_0x423cfb)[_0x1c90('0xa')](function(_0x38cd18){logger[_0x1c90('0xb')](_0x1c90('0xc'),_0x12c07d,_0x1c90('0xd'));logger[_0x1c90('0xe')](_0x1c90('0xf'),_0x12c07d,'request\x20sent',JSON['stringify'](_0x38cd18));if(_0x38cd18[_0x1c90('0x10')]){if(_0x38cd18[_0x1c90('0x10')][_0x1c90('0x11')]===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x12c07d,_0x38cd18[_0x1c90('0x10')][_0x1c90('0x12')]);return _0x514386(_0x38cd18['error'][_0x1c90('0x12')]);}logger[_0x1c90('0x10')](_0x1c90('0xc'),_0x12c07d,_0x38cd18['error'][_0x1c90('0x12')]);return _0x19196f(_0x38cd18['error'][_0x1c90('0x12')]);}else{logger[_0x1c90('0xb')](_0x1c90('0xc'),_0x12c07d,_0x1c90('0xd'));_0x19196f(_0x38cd18['result'][_0x1c90('0x12')]);}})['catch'](function(_0x2d3c90){logger[_0x1c90('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x12c07d,_0x2d3c90);_0x514386(_0x2d3c90);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 2e4c599..baff982 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 _0x1a6d=['isAuthenticated','index','/:id','show','create','put','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x1a6d,0x17e));var _0xd1a6=function(_0x27324f,_0x43d551){_0x27324f=_0x27324f-0x0;var _0x29d980=_0x1a6d[_0x27324f];return _0x29d980;};'use strict';var multer=require(_0xd1a6('0x0'));var util=require(_0xd1a6('0x1'));var path=require('path');var timeout=require(_0xd1a6('0x2'));var express=require('express');var router=express[_0xd1a6('0x3')]();var fs_extra=require(_0xd1a6('0x4'));var auth=require(_0xd1a6('0x5'));var interaction=require(_0xd1a6('0x6'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0xd1a6('0x7')]('/',auth[_0xd1a6('0x8')](),controller[_0xd1a6('0x9')]);router[_0xd1a6('0x7')](_0xd1a6('0xa'),auth[_0xd1a6('0x8')](),controller[_0xd1a6('0xb')]);router['post']('/',auth[_0xd1a6('0x8')](),controller[_0xd1a6('0xc')]);router[_0xd1a6('0xd')](_0xd1a6('0xa'),auth[_0xd1a6('0x8')](),controller['update']);router['delete'](_0xd1a6('0xa'),auth['isAuthenticated'](),controller[_0xd1a6('0xe')]);module['exports']=router; \ No newline at end of file +var _0xb6fd=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','exports'];(function(_0x743a2a,_0x2eb88f){var _0x30a5e2=function(_0x526d9a){while(--_0x526d9a){_0x743a2a['push'](_0x743a2a['shift']());}};_0x30a5e2(++_0x2eb88f);}(_0xb6fd,0x1ce));var _0xdb6f=function(_0x5f35d1,_0x14ce31){_0x5f35d1=_0x5f35d1-0x0;var _0x1b4a2e=_0xb6fd[_0x5f35d1];return _0x1b4a2e;};'use strict';var multer=require(_0xdb6f('0x0'));var util=require(_0xdb6f('0x1'));var path=require(_0xdb6f('0x2'));var timeout=require(_0xdb6f('0x3'));var express=require(_0xdb6f('0x4'));var router=express[_0xdb6f('0x5')]();var fs_extra=require(_0xdb6f('0x6'));var auth=require(_0xdb6f('0x7'));var interaction=require(_0xdb6f('0x8'));var config=require(_0xdb6f('0x9'));var controller=require(_0xdb6f('0xa'));router['get']('/',auth[_0xdb6f('0xb')](),controller[_0xdb6f('0xc')]);router[_0xdb6f('0xd')]('/:id',auth[_0xdb6f('0xb')](),controller[_0xdb6f('0xe')]);router[_0xdb6f('0xf')]('/',auth[_0xdb6f('0xb')](),controller[_0xdb6f('0x10')]);router[_0xdb6f('0x11')](_0xdb6f('0x12'),auth[_0xdb6f('0xb')](),controller[_0xdb6f('0x13')]);router[_0xdb6f('0x14')]('/:id',auth[_0xdb6f('0xb')](),controller['destroy']);module[_0xdb6f('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 6f128bb..794f4e3 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 _0x9f33=['STRING','name','BOOLEAN','exports'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x9f33,0x13b));var _0x39f3=function(_0x5e8b80,_0x25e9c9){_0x5e8b80=_0x5e8b80-0x0;var _0x544459=_0x9f33[_0x5e8b80];return _0x544459;};'use strict';var Sequelize=require('sequelize');module[_0x39f3('0x0')]={'name':{'type':Sequelize[_0x39f3('0x1')],'unique':_0x39f3('0x2')},'description':{'type':Sequelize[_0x39f3('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x39f3('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb2a6=['name','STRING','exports'];(function(_0x22c0e2,_0x3b9bcb){var _0x4d865c=function(_0x2532ab){while(--_0x2532ab){_0x22c0e2['push'](_0x22c0e2['shift']());}};_0x4d865c(++_0x3b9bcb);}(_0xb2a6,0xe9));var _0x6b2a=function(_0x471039,_0x24fd6a){_0x471039=_0x471039-0x0;var _0x3a7d8e=_0xb2a6[_0x471039];return _0x3a7d8e;};'use strict';var Sequelize=require('sequelize');module[_0x6b2a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6b2a('0x1')},'description':{'type':Sequelize[_0x6b2a('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 cbe6a3a..af37087 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 _0x1b21=['offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Contexts','UserProfileResource','sendStatus','name','index','map','VoiceContext','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','show','params','length','find','create','body','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','end','status','json'];(function(_0x5eca04,_0x368480){var _0x4cf26e=function(_0x31962c){while(--_0x31962c){_0x5eca04['push'](_0x5eca04['shift']());}};_0x4cf26e(++_0x368480);}(_0x1b21,0x1f3));var _0x11b2=function(_0x3f25be,_0xcd60d){_0x3f25be=_0x3f25be-0x0;var _0x25f17f=_0x1b21[_0x3f25be];return _0x25f17f;};'use strict';var emlformat=require(_0x11b2('0x0'));var rimraf=require(_0x11b2('0x1'));var zipdir=require(_0x11b2('0x2'));var jsonpatch=require(_0x11b2('0x3'));var rp=require(_0x11b2('0x4'));var moment=require('moment');var BPromise=require(_0x11b2('0x5'));var Mustache=require(_0x11b2('0x6'));var util=require(_0x11b2('0x7'));var path=require(_0x11b2('0x8'));var sox=require(_0x11b2('0x9'));var csv=require(_0x11b2('0xa'));var ejs=require(_0x11b2('0xb'));var fs=require('fs');var fs_extra=require(_0x11b2('0xc'));var _=require(_0x11b2('0xd'));var squel=require(_0x11b2('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x11b2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x11b2('0x10'));var Papa=require('papaparse');var Redis=require(_0x11b2('0x11'));var authService=require(_0x11b2('0x12'));var qs=require(_0x11b2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x11b2('0x14'));var utils=require(_0x11b2('0x15'));var config=require(_0x11b2('0x16'));var licenseUtil=require(_0x11b2('0x17'));var db=require(_0x11b2('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x11b2('0x19')][_0x11b2('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xf593cd,_0xb427b1,_0x362717,_0x142ec2){return new BPromise(function(_0x21a453,_0x11a9e5){var _0x26f8dc=_0x142ec2||client;return _0x26f8dc[_0x11b2('0x1b')](_0xf593cd,_0x362717)['then'](function(_0xcc596e){logger[_0x11b2('0x1c')]('VoiceContext,\x20%s,\x20%s',_0xb427b1,_0x11b2('0x1d'));logger[_0x11b2('0x1e')](_0x11b2('0x1f'),_0xb427b1,'request\x20sent',JSON[_0x11b2('0x20')](_0xcc596e));if(_0xcc596e[_0x11b2('0x21')]){if(_0xcc596e[_0x11b2('0x21')][_0x11b2('0x22')]===0x1f4){logger['error'](_0x11b2('0x23'),_0xb427b1,_0xcc596e[_0x11b2('0x21')][_0x11b2('0x24')]);return _0x11a9e5(_0xcc596e['error']['message']);}logger[_0x11b2('0x21')](_0x11b2('0x23'),_0xb427b1,_0xcc596e[_0x11b2('0x21')]['message']);return _0x21a453(_0xcc596e[_0x11b2('0x21')][_0x11b2('0x24')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0xb427b1,_0x11b2('0x1d'));_0x21a453(_0xcc596e['result'][_0x11b2('0x24')]);}})[_0x11b2('0x25')](function(_0xda1f25){logger['error'](_0x11b2('0x23'),_0xb427b1,_0xda1f25);_0x11a9e5(_0xda1f25);});});}function respondWithStatusCode(_0x5309c9,_0x345480){_0x345480=_0x345480||0xcc;return function(_0x6efccf){if(_0x6efccf){return _0x5309c9['sendStatus'](_0x345480);}return _0x5309c9['status'](_0x345480)[_0x11b2('0x26')]();};}function respondWithResult(_0x35132d,_0x55a980){_0x55a980=_0x55a980||0xc8;return function(_0x28f13d){if(_0x28f13d){return _0x35132d[_0x11b2('0x27')](_0x55a980)[_0x11b2('0x28')](_0x28f13d);}};}function respondWithFilteredResult(_0x3f3dcb,_0x333791){return function(_0x14730c){if(_0x14730c){var _0xe88f3b=typeof _0x333791[_0x11b2('0x29')]===_0x11b2('0x2a')&&typeof _0x333791[_0x11b2('0x2b')]==='undefined';var _0x13c00c=_0x14730c['count'];var _0x2e991c=_0xe88f3b?0x0:_0x333791[_0x11b2('0x29')];var _0x3f66c4=_0xe88f3b?_0x14730c['count']:_0x333791[_0x11b2('0x29')]+_0x333791[_0x11b2('0x2b')];var _0x3ff55e;if(_0x3f66c4>=_0x13c00c){_0x3f66c4=_0x13c00c;_0x3ff55e=0xc8;}else{_0x3ff55e=0xce;}_0x3f3dcb['status'](_0x3ff55e);return _0x3f3dcb[_0x11b2('0x2c')](_0x11b2('0x2d'),_0x2e991c+'-'+_0x3f66c4+'/'+_0x13c00c)[_0x11b2('0x28')](_0x14730c);}return null;};}function patchUpdates(_0x16a82b){return function(_0x19a02f){try{jsonpatch[_0x11b2('0x2e')](_0x19a02f,_0x16a82b,!![]);}catch(_0x2ffe3e){return BPromise[_0x11b2('0x2f')](_0x2ffe3e);}return _0x19a02f[_0x11b2('0x30')]();};}function saveUpdates(_0x570800,_0x55652b){return function(_0x1c64c7){if(_0x1c64c7){return _0x1c64c7[_0x11b2('0x31')](_0x570800)[_0x11b2('0x32')](function(_0x3ac3e3){return _0x3ac3e3;});}return null;};}function removeEntity(_0x23618c,_0x1b8641){return function(_0xaf6554){if(_0xaf6554){return _0xaf6554[_0x11b2('0x33')]()[_0x11b2('0x32')](function(){var _0x315415=_0xaf6554[_0x11b2('0x34')]({'plain':!![]});var _0x1e73ba=_0x11b2('0x35');return db[_0x11b2('0x36')][_0x11b2('0x33')]({'where':{'type':_0x1e73ba,'resourceId':_0x315415['id']}})['then'](function(){return _0xaf6554;});})[_0x11b2('0x32')](function(){_0x23618c[_0x11b2('0x27')](0xcc)[_0x11b2('0x26')]();});}};}function handleEntityNotFound(_0x276b4e,_0x3af0f7){return function(_0x5d2566){if(!_0x5d2566){_0x276b4e[_0x11b2('0x37')](0x194);}return _0x5d2566;};}function handleError(_0x217766,_0xdd8089){_0xdd8089=_0xdd8089||0x1f4;return function(_0x3df203){logger[_0x11b2('0x21')](_0x3df203['stack']);if(_0x3df203[_0x11b2('0x38')]){delete _0x3df203[_0x11b2('0x38')];}_0x217766[_0x11b2('0x27')](_0xdd8089)['send'](_0x3df203);};}exports[_0x11b2('0x39')]=function(_0x7f350c,_0x1c0162){var _0x48329f={},_0x1e15aa={},_0x4db943={'count':0x0,'rows':[]};var _0x3f2013=_[_0x11b2('0x3a')](db[_0x11b2('0x3b')][_0x11b2('0x3c')],function(_0x3dfc08){return{'name':_0x3dfc08[_0x11b2('0x3d')],'type':_0x3dfc08['type'][_0x11b2('0x3e')]};});_0x1e15aa['model']=_[_0x11b2('0x3a')](_0x3f2013,_0x11b2('0x38'));_0x1e15aa[_0x11b2('0x3f')]=_[_0x11b2('0x40')](_0x7f350c[_0x11b2('0x3f')]);_0x1e15aa[_0x11b2('0x41')]=_[_0x11b2('0x42')](_0x1e15aa[_0x11b2('0x43')],_0x1e15aa['query']);_0x48329f[_0x11b2('0x44')]=_[_0x11b2('0x42')](_0x1e15aa['model'],qs[_0x11b2('0x45')](_0x7f350c[_0x11b2('0x3f')][_0x11b2('0x45')]));_0x48329f[_0x11b2('0x44')]=_0x48329f[_0x11b2('0x44')]['length']?_0x48329f['attributes']:_0x1e15aa[_0x11b2('0x43')];if(!_0x7f350c['query'][_0x11b2('0x46')](_0x11b2('0x47'))){_0x48329f[_0x11b2('0x2b')]=qs[_0x11b2('0x2b')](_0x7f350c[_0x11b2('0x3f')][_0x11b2('0x2b')]);_0x48329f['offset']=qs[_0x11b2('0x29')](_0x7f350c[_0x11b2('0x3f')][_0x11b2('0x29')]);}_0x48329f[_0x11b2('0x48')]=qs[_0x11b2('0x49')](_0x7f350c[_0x11b2('0x3f')][_0x11b2('0x49')]);_0x48329f[_0x11b2('0x4a')]=qs['filters'](_[_0x11b2('0x4b')](_0x7f350c[_0x11b2('0x3f')],_0x1e15aa[_0x11b2('0x41')]),_0x3f2013);if(_0x7f350c[_0x11b2('0x3f')][_0x11b2('0x4c')]){_0x48329f[_0x11b2('0x4a')]=_[_0x11b2('0x4d')](_0x48329f[_0x11b2('0x4a')],{'$or':_[_0x11b2('0x3a')](_0x3f2013,function(_0x393653){if(_0x393653[_0x11b2('0x4e')]!==_0x11b2('0x4f')){var _0x3b8d28={};_0x3b8d28[_0x393653[_0x11b2('0x38')]]={'$like':'%'+_0x7f350c['query'][_0x11b2('0x4c')]+'%'};return _0x3b8d28;}})});}_0x48329f=_[_0x11b2('0x4d')]({},_0x48329f,_0x7f350c['options']);var _0x1cc14d={'where':_0x48329f[_0x11b2('0x4a')]};return db[_0x11b2('0x3b')][_0x11b2('0x50')](_0x1cc14d)[_0x11b2('0x32')](function(_0x424c78){_0x4db943[_0x11b2('0x50')]=_0x424c78;if(_0x7f350c[_0x11b2('0x3f')][_0x11b2('0x51')]){_0x48329f[_0x11b2('0x52')]=[{'all':!![]}];}return db[_0x11b2('0x3b')][_0x11b2('0x53')](_0x48329f);})[_0x11b2('0x32')](function(_0x32446e){_0x4db943[_0x11b2('0x54')]=_0x32446e;return _0x4db943;})[_0x11b2('0x32')](respondWithFilteredResult(_0x1c0162,_0x48329f))[_0x11b2('0x25')](handleError(_0x1c0162,null));};exports[_0x11b2('0x55')]=function(_0x4ce74c,_0x2f4879){var _0x56764d={'raw':![],'where':{'id':_0x4ce74c[_0x11b2('0x56')]['id']}},_0x5aa26f={};_0x5aa26f[_0x11b2('0x43')]=_['keys'](db[_0x11b2('0x3b')]['rawAttributes']);_0x5aa26f[_0x11b2('0x3f')]=_[_0x11b2('0x40')](_0x4ce74c[_0x11b2('0x3f')]);_0x5aa26f[_0x11b2('0x41')]=_['intersection'](_0x5aa26f[_0x11b2('0x43')],_0x5aa26f['query']);_0x56764d[_0x11b2('0x44')]=_[_0x11b2('0x42')](_0x5aa26f['model'],qs[_0x11b2('0x45')](_0x4ce74c[_0x11b2('0x3f')][_0x11b2('0x45')]));_0x56764d['attributes']=_0x56764d[_0x11b2('0x44')][_0x11b2('0x57')]?_0x56764d[_0x11b2('0x44')]:_0x5aa26f[_0x11b2('0x43')];if(_0x4ce74c[_0x11b2('0x3f')][_0x11b2('0x51')]){_0x56764d[_0x11b2('0x52')]=[{'all':!![]}];}_0x56764d=_[_0x11b2('0x4d')]({},_0x56764d,_0x4ce74c['options']);return db[_0x11b2('0x3b')][_0x11b2('0x58')](_0x56764d)[_0x11b2('0x32')](handleEntityNotFound(_0x2f4879,null))[_0x11b2('0x32')](respondWithResult(_0x2f4879,null))[_0x11b2('0x25')](handleError(_0x2f4879,null));};exports[_0x11b2('0x59')]=function(_0x32cb2c,_0x212caf,_0x1ea590){var _0x3d645b;return db['VoiceContext'][_0x11b2('0x59')](_0x32cb2c[_0x11b2('0x5a')],{'raw':!![]})[_0x11b2('0x32')](function(_0xf37c1a){_0x3d645b=_0xf37c1a;return db[_0x11b2('0x3b')][_0x11b2('0x53')]({'raw':!![]});})['then'](function(_0x3e8b3e){var _0x3f1c5e=fs['readFileSync'](path[_0x11b2('0x5b')](config['root'],_0x11b2('0x5c')),_0x11b2('0x5d'));var _0x280a7b=ejs[_0x11b2('0x5e')](_0x3f1c5e,{'contexts':_0x3e8b3e||[]});fs[_0x11b2('0x5f')](_0x11b2('0x60'),_0x280a7b);})['then'](function(){return respondWithRpcPromise(_0x11b2('0x61'),_0x11b2('0x59'),{'module':_0x11b2('0x62')});})['then'](function(){var _0x4dd2d3=_0x32cb2c[_0x11b2('0x63')][_0x11b2('0x34')]({'plain':!![]});if(!_0x4dd2d3)throw new Error(_0x11b2('0x64'));if(_0x4dd2d3[_0x11b2('0x65')]===_0x11b2('0x63')){var _0x1fd19d=_0x3d645b[_0x11b2('0x34')]({'plain':!![]});return db[_0x11b2('0x66')]['find']({'where':{'name':_0x11b2('0x35'),'userProfileId':_0x4dd2d3[_0x11b2('0x67')]},'raw':!![]})[_0x11b2('0x32')](function(_0x195066){if(_0x195066&&_0x195066[_0x11b2('0x68')]===0x0){return db[_0x11b2('0x36')][_0x11b2('0x59')]({'name':_0x1fd19d[_0x11b2('0x38')],'resourceId':_0x1fd19d['id'],'type':_0x195066[_0x11b2('0x38')],'sectionId':_0x195066['id']},{})['then'](function(){return _0x3d645b;});}else{return _0x3d645b;}})[_0x11b2('0x25')](function(_0x35d0e4){logger[_0x11b2('0x21')](_0x11b2('0x69'),_0x35d0e4);throw _0x35d0e4;});}return _0x3d645b;})['then'](respondWithResult(_0x212caf,0xc9))[_0x11b2('0x25')](handleError(_0x212caf,null));};exports[_0x11b2('0x31')]=function(_0x24b52a,_0x1eb838,_0x44963e){var _0x6bb1d5;return db[_0x11b2('0x3b')][_0x11b2('0x58')]({'where':{'id':_0x24b52a[_0x11b2('0x56')]['id']}})[_0x11b2('0x32')](handleEntityNotFound(_0x1eb838,null))[_0x11b2('0x32')](saveUpdates(_0x24b52a[_0x11b2('0x5a')],null))[_0x11b2('0x32')](function(_0x1e5b81){if(_0x1e5b81){_0x6bb1d5=_0x1e5b81;return db[_0x11b2('0x3b')][_0x11b2('0x53')]({'raw':!![]});}})['then'](function(_0x3d56ef){var _0x4ce101=fs[_0x11b2('0x6a')](path[_0x11b2('0x5b')](config[_0x11b2('0x6b')],'server/files/templates/context.ejs'),_0x11b2('0x5d'));var _0x5a9e7a=ejs[_0x11b2('0x5e')](_0x4ce101,{'contexts':_0x3d56ef||[]});fs[_0x11b2('0x5f')](_0x11b2('0x60'),_0x5a9e7a);})['then'](function(){return respondWithRpcPromise(_0x11b2('0x61'),'update',{'module':'chan_sip.so'});})[_0x11b2('0x32')](function(){return _0x6bb1d5;})[_0x11b2('0x32')](respondWithResult(_0x1eb838,null))[_0x11b2('0x25')](handleError(_0x1eb838,null));};exports[_0x11b2('0x33')]=function(_0x2b4e0b,_0x3f5204,_0xb4ba76){var _0x2fa631;return db[_0x11b2('0x3b')][_0x11b2('0x58')]({'where':{'id':_0x2b4e0b[_0x11b2('0x56')]['id']}})[_0x11b2('0x32')](handleEntityNotFound(_0x3f5204,null))[_0x11b2('0x32')](removeEntity(_0x3f5204,null))[_0x11b2('0x32')](function(){return db[_0x11b2('0x3b')][_0x11b2('0x53')]({'raw':!![]});})[_0x11b2('0x32')](function(_0x41cf53){var _0x36ed49=fs[_0x11b2('0x6a')](path['join'](config[_0x11b2('0x6b')],_0x11b2('0x5c')),'utf8');var _0x245364=ejs[_0x11b2('0x5e')](_0x36ed49,{'contexts':_0x41cf53});fs['writeFileSync'](_0x11b2('0x60'),_0x245364);return respondWithRpcPromise(_0x11b2('0x61'),_0x11b2('0x33'),{'module':'chan_sip.so'});})[_0x11b2('0x25')](handleError(_0x3f5204,null));}; \ No newline at end of file +var _0xfac0=['api','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','VoiceContext,\x20%s,\x20%s','message','catch','sendStatus','status','end','offset','undefined','count','Content-Range','json','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','rawAttributes','type','key','map','query','keys','filters','attributes','intersection','model','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceContext','include','findAll','show','params','find','create','readFileSync','join','root','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Contexts','autoAssociation','body','utf8','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0xdfba2e,_0x54d3c5){var _0x2a79fa=function(_0x594f0e){while(--_0x594f0e){_0xdfba2e['push'](_0xdfba2e['shift']());}};_0x2a79fa(++_0x54d3c5);}(_0xfac0,0xb0));var _0x0fac=function(_0x2514fe,_0x576510){_0x2514fe=_0x2514fe-0x0;var _0x4dc193=_0xfac0[_0x2514fe];return _0x4dc193;};'use strict';var emlformat=require(_0x0fac('0x0'));var rimraf=require(_0x0fac('0x1'));var zipdir=require(_0x0fac('0x2'));var jsonpatch=require(_0x0fac('0x3'));var rp=require(_0x0fac('0x4'));var moment=require(_0x0fac('0x5'));var BPromise=require(_0x0fac('0x6'));var Mustache=require('mustache');var util=require(_0x0fac('0x7'));var path=require(_0x0fac('0x8'));var sox=require(_0x0fac('0x9'));var csv=require('to-csv');var ejs=require(_0x0fac('0xa'));var fs=require('fs');var fs_extra=require(_0x0fac('0xb'));var _=require(_0x0fac('0xc'));var squel=require('squel');var crypto=require(_0x0fac('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0fac('0xe'));var toCsv=require(_0x0fac('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0fac('0x10'));var authService=require(_0x0fac('0x11'));var qs=require(_0x0fac('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0fac('0x13'));var logger=require('../../config/logger')(_0x0fac('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0fac('0x15'));var db=require(_0x0fac('0x16'))['db'];var jayson=require(_0x0fac('0x17'));var client=jayson[_0x0fac('0x18')][_0x0fac('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5d6b72,_0x260e09,_0x1fabb5,_0x4c9102){return new BPromise(function(_0x38b3e0,_0x3091c7){var _0x2707e4=_0x4c9102||client;return _0x2707e4['request'](_0x5d6b72,_0x1fabb5)['then'](function(_0xebbc09){logger[_0x0fac('0x1a')]('VoiceContext,\x20%s,\x20%s',_0x260e09,_0x0fac('0x1b'));logger[_0x0fac('0x1c')](_0x0fac('0x1d'),_0x260e09,'request\x20sent',JSON['stringify'](_0xebbc09));if(_0xebbc09[_0x0fac('0x1e')]){if(_0xebbc09[_0x0fac('0x1e')][_0x0fac('0x1f')]===0x1f4){logger[_0x0fac('0x1e')](_0x0fac('0x20'),_0x260e09,_0xebbc09[_0x0fac('0x1e')]['message']);return _0x3091c7(_0xebbc09[_0x0fac('0x1e')][_0x0fac('0x21')]);}logger['error'](_0x0fac('0x20'),_0x260e09,_0xebbc09['error']['message']);return _0x38b3e0(_0xebbc09[_0x0fac('0x1e')][_0x0fac('0x21')]);}else{logger[_0x0fac('0x1a')](_0x0fac('0x20'),_0x260e09,_0x0fac('0x1b'));_0x38b3e0(_0xebbc09['result'][_0x0fac('0x21')]);}})[_0x0fac('0x22')](function(_0x285fcb){logger[_0x0fac('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x260e09,_0x285fcb);_0x3091c7(_0x285fcb);});});}function respondWithStatusCode(_0x17729d,_0x59629a){_0x59629a=_0x59629a||0xcc;return function(_0x5f44a4){if(_0x5f44a4){return _0x17729d[_0x0fac('0x23')](_0x59629a);}return _0x17729d[_0x0fac('0x24')](_0x59629a)[_0x0fac('0x25')]();};}function respondWithResult(_0x4b12c5,_0x4741cc){_0x4741cc=_0x4741cc||0xc8;return function(_0x1c1ece){if(_0x1c1ece){return _0x4b12c5[_0x0fac('0x24')](_0x4741cc)['json'](_0x1c1ece);}};}function respondWithFilteredResult(_0x13ee1b,_0x112fba){return function(_0x539352){if(_0x539352){var _0x2e2a49=typeof _0x112fba[_0x0fac('0x26')]===_0x0fac('0x27')&&typeof _0x112fba['limit']===_0x0fac('0x27');var _0x4fdcf1=_0x539352[_0x0fac('0x28')];var _0x3e28cc=_0x2e2a49?0x0:_0x112fba[_0x0fac('0x26')];var _0x5eae89=_0x2e2a49?_0x539352['count']:_0x112fba[_0x0fac('0x26')]+_0x112fba['limit'];var _0x4969ba;if(_0x5eae89>=_0x4fdcf1){_0x5eae89=_0x4fdcf1;_0x4969ba=0xc8;}else{_0x4969ba=0xce;}_0x13ee1b[_0x0fac('0x24')](_0x4969ba);return _0x13ee1b['set'](_0x0fac('0x29'),_0x3e28cc+'-'+_0x5eae89+'/'+_0x4fdcf1)[_0x0fac('0x2a')](_0x539352);}return null;};}function patchUpdates(_0x271ad4){return function(_0x1ec607){try{jsonpatch['apply'](_0x1ec607,_0x271ad4,!![]);}catch(_0x3e7fce){return BPromise['reject'](_0x3e7fce);}return _0x1ec607[_0x0fac('0x2b')]();};}function saveUpdates(_0x520b55,_0x1d7213){return function(_0x3107f2){if(_0x3107f2){return _0x3107f2[_0x0fac('0x2c')](_0x520b55)[_0x0fac('0x2d')](function(_0x503782){return _0x503782;});}return null;};}function removeEntity(_0x4cb79d,_0x3d76f7){return function(_0x36f7e4){if(_0x36f7e4){return _0x36f7e4[_0x0fac('0x2e')]()[_0x0fac('0x2d')](function(){var _0x5a0668=_0x36f7e4[_0x0fac('0x2f')]({'plain':!![]});var _0x21f7c7='Contexts';return db[_0x0fac('0x30')]['destroy']({'where':{'type':_0x21f7c7,'resourceId':_0x5a0668['id']}})['then'](function(){return _0x36f7e4;});})[_0x0fac('0x2d')](function(){_0x4cb79d[_0x0fac('0x24')](0xcc)[_0x0fac('0x25')]();});}};}function handleEntityNotFound(_0x4f0bcd,_0x5e22cc){return function(_0x8ee70c){if(!_0x8ee70c){_0x4f0bcd[_0x0fac('0x23')](0x194);}return _0x8ee70c;};}function handleError(_0x4182fc,_0x16c1d7){_0x16c1d7=_0x16c1d7||0x1f4;return function(_0x35b493){logger['error'](_0x35b493[_0x0fac('0x31')]);if(_0x35b493[_0x0fac('0x32')]){delete _0x35b493[_0x0fac('0x32')];}_0x4182fc[_0x0fac('0x24')](_0x16c1d7)[_0x0fac('0x33')](_0x35b493);};}exports[_0x0fac('0x34')]=function(_0x5682c2,_0x2ee9ae){var _0x5f8f19={},_0x97b01b={},_0x4d49ee={'count':0x0,'rows':[]};var _0x1fdf3c=_['map'](db['VoiceContext'][_0x0fac('0x35')],function(_0x7ab68a){return{'name':_0x7ab68a['fieldName'],'type':_0x7ab68a[_0x0fac('0x36')][_0x0fac('0x37')]};});_0x97b01b['model']=_[_0x0fac('0x38')](_0x1fdf3c,_0x0fac('0x32'));_0x97b01b[_0x0fac('0x39')]=_[_0x0fac('0x3a')](_0x5682c2[_0x0fac('0x39')]);_0x97b01b[_0x0fac('0x3b')]=_['intersection'](_0x97b01b['model'],_0x97b01b[_0x0fac('0x39')]);_0x5f8f19[_0x0fac('0x3c')]=_[_0x0fac('0x3d')](_0x97b01b[_0x0fac('0x3e')],qs[_0x0fac('0x3f')](_0x5682c2['query']['fields']));_0x5f8f19[_0x0fac('0x3c')]=_0x5f8f19[_0x0fac('0x3c')]['length']?_0x5f8f19['attributes']:_0x97b01b[_0x0fac('0x3e')];if(!_0x5682c2[_0x0fac('0x39')]['hasOwnProperty'](_0x0fac('0x40'))){_0x5f8f19['limit']=qs[_0x0fac('0x41')](_0x5682c2[_0x0fac('0x39')][_0x0fac('0x41')]);_0x5f8f19[_0x0fac('0x26')]=qs[_0x0fac('0x26')](_0x5682c2[_0x0fac('0x39')][_0x0fac('0x26')]);}_0x5f8f19[_0x0fac('0x42')]=qs[_0x0fac('0x43')](_0x5682c2['query'][_0x0fac('0x43')]);_0x5f8f19[_0x0fac('0x44')]=qs[_0x0fac('0x3b')](_[_0x0fac('0x45')](_0x5682c2[_0x0fac('0x39')],_0x97b01b['filters']),_0x1fdf3c);if(_0x5682c2[_0x0fac('0x39')][_0x0fac('0x46')]){_0x5f8f19[_0x0fac('0x44')]=_[_0x0fac('0x47')](_0x5f8f19[_0x0fac('0x44')],{'$or':_['map'](_0x1fdf3c,function(_0xd539a){if(_0xd539a[_0x0fac('0x36')]!==_0x0fac('0x48')){var _0x2ddbb6={};_0x2ddbb6[_0xd539a[_0x0fac('0x32')]]={'$like':'%'+_0x5682c2[_0x0fac('0x39')]['filter']+'%'};return _0x2ddbb6;}})});}_0x5f8f19=_[_0x0fac('0x47')]({},_0x5f8f19,_0x5682c2[_0x0fac('0x49')]);var _0x5683be={'where':_0x5f8f19[_0x0fac('0x44')]};return db[_0x0fac('0x4a')][_0x0fac('0x28')](_0x5683be)[_0x0fac('0x2d')](function(_0x11afbe){_0x4d49ee[_0x0fac('0x28')]=_0x11afbe;if(_0x5682c2[_0x0fac('0x39')]['includeAll']){_0x5f8f19[_0x0fac('0x4b')]=[{'all':!![]}];}return db[_0x0fac('0x4a')][_0x0fac('0x4c')](_0x5f8f19);})['then'](function(_0x3ee95b){_0x4d49ee['rows']=_0x3ee95b;return _0x4d49ee;})[_0x0fac('0x2d')](respondWithFilteredResult(_0x2ee9ae,_0x5f8f19))['catch'](handleError(_0x2ee9ae,null));};exports[_0x0fac('0x4d')]=function(_0x542497,_0x129f8d){var _0x4ed084={'raw':![],'where':{'id':_0x542497[_0x0fac('0x4e')]['id']}},_0x313e2e={};_0x313e2e[_0x0fac('0x3e')]=_[_0x0fac('0x3a')](db[_0x0fac('0x4a')][_0x0fac('0x35')]);_0x313e2e[_0x0fac('0x39')]=_[_0x0fac('0x3a')](_0x542497[_0x0fac('0x39')]);_0x313e2e[_0x0fac('0x3b')]=_['intersection'](_0x313e2e[_0x0fac('0x3e')],_0x313e2e['query']);_0x4ed084['attributes']=_[_0x0fac('0x3d')](_0x313e2e['model'],qs[_0x0fac('0x3f')](_0x542497[_0x0fac('0x39')]['fields']));_0x4ed084[_0x0fac('0x3c')]=_0x4ed084[_0x0fac('0x3c')]['length']?_0x4ed084['attributes']:_0x313e2e[_0x0fac('0x3e')];if(_0x542497['query']['includeAll']){_0x4ed084['include']=[{'all':!![]}];}_0x4ed084=_[_0x0fac('0x47')]({},_0x4ed084,_0x542497[_0x0fac('0x49')]);return db['VoiceContext'][_0x0fac('0x4f')](_0x4ed084)[_0x0fac('0x2d')](handleEntityNotFound(_0x129f8d,null))['then'](respondWithResult(_0x129f8d,null))[_0x0fac('0x22')](handleError(_0x129f8d,null));};exports[_0x0fac('0x50')]=function(_0x2fbc4b,_0xc4c0cd,_0x12d8b4){var _0x36e9f4;return db[_0x0fac('0x4a')][_0x0fac('0x50')](_0x2fbc4b['body'],{'raw':!![]})[_0x0fac('0x2d')](function(_0x40ec46){_0x36e9f4=_0x40ec46;return db[_0x0fac('0x4a')][_0x0fac('0x4c')]({'raw':!![]});})['then'](function(_0x2b0658){var _0x8b0f37=fs[_0x0fac('0x51')](path[_0x0fac('0x52')](config[_0x0fac('0x53')],_0x0fac('0x54')),'utf8');var _0x4fae85=ejs[_0x0fac('0x55')](_0x8b0f37,{'contexts':_0x2b0658||[]});fs['writeFileSync'](_0x0fac('0x56'),_0x4fae85);})[_0x0fac('0x2d')](function(){return respondWithRpcPromise(_0x0fac('0x57'),'create',{'module':_0x0fac('0x58')});})[_0x0fac('0x2d')](function(){var _0x3fbf0d=_0x2fbc4b[_0x0fac('0x59')][_0x0fac('0x2f')]({'plain':!![]});if(!_0x3fbf0d)throw new Error(_0x0fac('0x5a'));if(_0x3fbf0d[_0x0fac('0x5b')]==='user'){var _0x5941d7=_0x36e9f4[_0x0fac('0x2f')]({'plain':!![]});return db[_0x0fac('0x5c')][_0x0fac('0x4f')]({'where':{'name':_0x0fac('0x5d'),'userProfileId':_0x3fbf0d['userProfileId']},'raw':!![]})[_0x0fac('0x2d')](function(_0x1f94d1){if(_0x1f94d1&&_0x1f94d1[_0x0fac('0x5e')]===0x0){return db[_0x0fac('0x30')][_0x0fac('0x50')]({'name':_0x5941d7[_0x0fac('0x32')],'resourceId':_0x5941d7['id'],'type':_0x1f94d1[_0x0fac('0x32')],'sectionId':_0x1f94d1['id']},{})[_0x0fac('0x2d')](function(){return _0x36e9f4;});}else{return _0x36e9f4;}})[_0x0fac('0x22')](function(_0x1ea0bd){logger[_0x0fac('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ea0bd);throw _0x1ea0bd;});}return _0x36e9f4;})['then'](respondWithResult(_0xc4c0cd,0xc9))[_0x0fac('0x22')](handleError(_0xc4c0cd,null));};exports[_0x0fac('0x2c')]=function(_0x44ea4d,_0x18e9ba,_0x3c7cc5){var _0x28fcbc;return db[_0x0fac('0x4a')][_0x0fac('0x4f')]({'where':{'id':_0x44ea4d['params']['id']}})[_0x0fac('0x2d')](handleEntityNotFound(_0x18e9ba,null))[_0x0fac('0x2d')](saveUpdates(_0x44ea4d[_0x0fac('0x5f')],null))[_0x0fac('0x2d')](function(_0x22c9f4){if(_0x22c9f4){_0x28fcbc=_0x22c9f4;return db[_0x0fac('0x4a')][_0x0fac('0x4c')]({'raw':!![]});}})[_0x0fac('0x2d')](function(_0x41e024){var _0x31aa57=fs['readFileSync'](path['join'](config[_0x0fac('0x53')],'server/files/templates/context.ejs'),_0x0fac('0x60'));var _0x3a130f=ejs[_0x0fac('0x55')](_0x31aa57,{'contexts':_0x41e024||[]});fs['writeFileSync'](_0x0fac('0x56'),_0x3a130f);})[_0x0fac('0x2d')](function(){return respondWithRpcPromise(_0x0fac('0x57'),_0x0fac('0x2c'),{'module':'chan_sip.so'});})['then'](function(){return _0x28fcbc;})[_0x0fac('0x2d')](respondWithResult(_0x18e9ba,null))[_0x0fac('0x22')](handleError(_0x18e9ba,null));};exports[_0x0fac('0x2e')]=function(_0x4a0c15,_0xac99ac,_0x4b0f38){var _0x849f19;return db['VoiceContext'][_0x0fac('0x4f')]({'where':{'id':_0x4a0c15[_0x0fac('0x4e')]['id']}})[_0x0fac('0x2d')](handleEntityNotFound(_0xac99ac,null))['then'](removeEntity(_0xac99ac,null))[_0x0fac('0x2d')](function(){return db['VoiceContext'][_0x0fac('0x4c')]({'raw':!![]});})[_0x0fac('0x2d')](function(_0x4cbda2){var _0x1c4f7b=fs[_0x0fac('0x51')](path[_0x0fac('0x52')](config[_0x0fac('0x53')],_0x0fac('0x54')),_0x0fac('0x60'));var _0x598b4c=ejs[_0x0fac('0x55')](_0x1c4f7b,{'contexts':_0x4cbda2});fs[_0x0fac('0x61')](_0x0fac('0x56'),_0x598b4c);return respondWithRpcPromise(_0x0fac('0x57'),_0x0fac('0x2e'),{'module':_0x0fac('0x58')});})[_0x0fac('0x22')](handleError(_0xac99ac,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index ef6b75a..b82081c 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 _0xb1ef=['exports','voice_contexts','util','api','moment','path','rimraf','../../config/environment','./voiceContext.attributes'];(function(_0x59344c,_0xfe6403){var _0xed7e4d=function(_0x184f38){while(--_0x184f38){_0x59344c['push'](_0x59344c['shift']());}};_0xed7e4d(++_0xfe6403);}(_0xb1ef,0x107));var _0xfb1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1ef[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xfb1e('0x0'));var logger=require('../../config/logger')(_0xfb1e('0x1'));var moment=require(_0xfb1e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb1e('0x3'));var rimraf=require(_0xfb1e('0x4'));var config=require(_0xfb1e('0x5'));var attributes=require(_0xfb1e('0x6'));module[_0xfb1e('0x7')]=function(_0x37c9e1,_0x24515b){return _0x37c9e1['define']('VoiceContext',attributes,{'tableName':_0xfb1e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ab2=['moment','bluebird','rimraf','../../config/environment','./voiceContext.attributes','exports','define','voice_contexts','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ab2,0x167));var _0x28ab=function(_0x14cc36,_0xac0c2){_0x14cc36=_0x14cc36-0x0;var _0x264fc7=_0x8ab2[_0x14cc36];return _0x264fc7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x28ab('0x0'))('api');var moment=require(_0x28ab('0x1'));var BPromise=require(_0x28ab('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x28ab('0x3'));var config=require(_0x28ab('0x4'));var attributes=require(_0x28ab('0x5'));module[_0x28ab('0x6')]=function(_0x36397c,_0x212cf6){return _0x36397c[_0x28ab('0x7')]('VoiceContext',attributes,{'tableName':_0x28ab('0x8'),'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 eb41d76..7b4bece 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 _0xfb8a=['http','request','then','info','request\x20sent','debug','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x263561,_0x48b468){var _0x18da37=function(_0x549fac){while(--_0x549fac){_0x263561['push'](_0x263561['shift']());}};_0x18da37(++_0x48b468);}(_0xfb8a,0x109));var _0xafb8=function(_0x211af9,_0x216a8c){_0x211af9=_0x211af9-0x0;var _0x242e38=_0xfb8a[_0x211af9];return _0x242e38;};'use strict';var _=require(_0xafb8('0x0'));var util=require(_0xafb8('0x1'));var moment=require(_0xafb8('0x2'));var BPromise=require(_0xafb8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafb8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xafb8('0x5'));var logger=require(_0xafb8('0x6'))(_0xafb8('0x7'));var config=require(_0xafb8('0x8'));var jayson=require(_0xafb8('0x9'));var client=jayson[_0xafb8('0xa')][_0xafb8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x396ff3,_0x1d6261,_0x694212){return new BPromise(function(_0x1f3121,_0x3bf691){return client[_0xafb8('0xc')](_0x396ff3,_0x694212)[_0xafb8('0xd')](function(_0x49a78d){logger[_0xafb8('0xe')]('VoiceContext,\x20%s,\x20%s',_0x1d6261,_0xafb8('0xf'));logger[_0xafb8('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1d6261,'request\x20sent',JSON['stringify'](_0x49a78d));if(_0x49a78d[_0xafb8('0x11')]){if(_0x49a78d[_0xafb8('0x11')][_0xafb8('0x12')]===0x1f4){logger['error'](_0xafb8('0x13'),_0x1d6261,_0x49a78d['error'][_0xafb8('0x14')]);return _0x3bf691(_0x49a78d[_0xafb8('0x11')][_0xafb8('0x14')]);}logger['error'](_0xafb8('0x13'),_0x1d6261,_0x49a78d['error'][_0xafb8('0x14')]);return _0x1f3121(_0x49a78d[_0xafb8('0x11')][_0xafb8('0x14')]);}else{logger[_0xafb8('0xe')](_0xafb8('0x13'),_0x1d6261,_0xafb8('0xf'));_0x1f3121(_0x49a78d[_0xafb8('0x15')][_0xafb8('0x14')]);}})[_0xafb8('0x16')](function(_0x41306e){logger[_0xafb8('0x11')]('VoiceContext,\x20%s,\x20%s',_0x1d6261,_0x41306e);_0x3bf691(_0x41306e);});});} \ No newline at end of file +var _0x0bb4=['../../config/environment','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0x0bb4,0x77));var _0x40bb=function(_0x530738,_0x591aca){_0x530738=_0x530738-0x0;var _0x32b4cd=_0x0bb4[_0x530738];return _0x32b4cd;};'use strict';var _=require(_0x40bb('0x0'));var util=require(_0x40bb('0x1'));var moment=require('moment');var BPromise=require(_0x40bb('0x2'));var rs=require(_0x40bb('0x3'));var fs=require('fs');var Redis=require(_0x40bb('0x4'));var db=require(_0x40bb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x40bb('0x6'))('rpc');var config=require(_0x40bb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x40bb('0x8')][_0x40bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d15f6,_0x266c1e,_0x1243f4){return new BPromise(function(_0x50d70f,_0x1dc35d){return client['request'](_0x4d15f6,_0x1243f4)[_0x40bb('0xa')](function(_0x3bc5c5){logger[_0x40bb('0xb')](_0x40bb('0xc'),_0x266c1e,_0x40bb('0xd'));logger[_0x40bb('0xe')](_0x40bb('0xf'),_0x266c1e,_0x40bb('0xd'),JSON[_0x40bb('0x10')](_0x3bc5c5));if(_0x3bc5c5[_0x40bb('0x11')]){if(_0x3bc5c5[_0x40bb('0x11')][_0x40bb('0x12')]===0x1f4){logger[_0x40bb('0x11')](_0x40bb('0xc'),_0x266c1e,_0x3bc5c5[_0x40bb('0x11')][_0x40bb('0x13')]);return _0x1dc35d(_0x3bc5c5[_0x40bb('0x11')]['message']);}logger['error'](_0x40bb('0xc'),_0x266c1e,_0x3bc5c5[_0x40bb('0x11')][_0x40bb('0x13')]);return _0x50d70f(_0x3bc5c5[_0x40bb('0x11')][_0x40bb('0x13')]);}else{logger[_0x40bb('0xb')](_0x40bb('0xc'),_0x266c1e,_0x40bb('0xd'));_0x50d70f(_0x3bc5c5['result'][_0x40bb('0x13')]);}})[_0x40bb('0x14')](function(_0x416d95){logger[_0x40bb('0x11')](_0x40bb('0xc'),_0x266c1e,_0x416d95);_0x1dc35d(_0x416d95);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 09c20e6..3f450bc 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 _0xb7aa=['../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x5151d8,_0x10933b){var _0x28159b=function(_0x5b5bd2){while(--_0x5b5bd2){_0x5151d8['push'](_0x5151d8['shift']());}};_0x28159b(++_0x10933b);}(_0xb7aa,0x160));var _0xab7a=function(_0x341384,_0x158136){_0x341384=_0x341384-0x0;var _0x58cd0d=_0xb7aa[_0x341384];return _0x58cd0d;};'use strict';var multer=require(_0xab7a('0x0'));var util=require(_0xab7a('0x1'));var path=require(_0xab7a('0x2'));var timeout=require('connect-timeout');var express=require(_0xab7a('0x3'));var router=express[_0xab7a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xab7a('0x5'));var interaction=require(_0xab7a('0x6'));var config=require('../../config/environment');var controller=require(_0xab7a('0x7'));router[_0xab7a('0x8')]('/',auth['isAuthenticated'](),controller[_0xab7a('0x9')]);router[_0xab7a('0x8')](_0xab7a('0xa'),auth['isAuthenticated'](),controller[_0xab7a('0xb')]);router[_0xab7a('0x8')](_0xab7a('0xc'),auth[_0xab7a('0xd')](),controller[_0xab7a('0xe')]);router[_0xab7a('0xf')]('/',auth[_0xab7a('0xd')](),controller[_0xab7a('0x10')]);router['put'](_0xab7a('0xc'),auth[_0xab7a('0xd')](),controller[_0xab7a('0x11')]);router[_0xab7a('0x12')](_0xab7a('0xc'),auth[_0xab7a('0xd')](),controller[_0xab7a('0x13')]);module[_0xab7a('0x14')]=router; \ No newline at end of file +var _0x2948=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','isAuthenticated','index','get','/:id','post','create','put'];(function(_0x28c189,_0x5d2540){var _0x54a03e=function(_0x249f28){while(--_0x249f28){_0x28c189['push'](_0x28c189['shift']());}};_0x54a03e(++_0x5d2540);}(_0x2948,0xcb));var _0x8294=function(_0x5c588e,_0x115808){_0x5c588e=_0x5c588e-0x0;var _0x37d687=_0x2948[_0x5c588e];return _0x37d687;};'use strict';var multer=require(_0x8294('0x0'));var util=require(_0x8294('0x1'));var path=require(_0x8294('0x2'));var timeout=require(_0x8294('0x3'));var express=require(_0x8294('0x4'));var router=express[_0x8294('0x5')]();var fs_extra=require(_0x8294('0x6'));var auth=require(_0x8294('0x7'));var interaction=require(_0x8294('0x8'));var config=require('../../config/environment');var controller=require(_0x8294('0x9'));router['get']('/',auth[_0x8294('0xa')](),controller[_0x8294('0xb')]);router[_0x8294('0xc')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x8294('0xd'),auth[_0x8294('0xa')](),controller['show']);router[_0x8294('0xe')]('/',auth[_0x8294('0xa')](),controller[_0x8294('0xf')]);router[_0x8294('0x10')](_0x8294('0xd'),auth[_0x8294('0xa')](),controller['update']);router[_0x8294('0x11')](_0x8294('0xd'),auth[_0x8294('0xa')](),controller[_0x8294('0x12')]);module[_0x8294('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 1cde796..c4351c3 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 _0xbec5=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x48a006,_0x246178){var _0x450d9e=function(_0x2a8221){while(--_0x2a8221){_0x48a006['push'](_0x48a006['shift']());}};_0x450d9e(++_0x246178);}(_0xbec5,0xe5));var _0x5bec=function(_0x47adb8,_0x591ccc){_0x47adb8=_0x47adb8-0x0;var _0x4689a8=_0xbec5[_0x47adb8];return _0x4689a8;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5bec('0x2')]},'channelstate':{'type':Sequelize[_0x5bec('0x3')]},'channelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'calleridnum':{'type':Sequelize[_0x5bec('0x2')]},'calleridname':{'type':Sequelize[_0x5bec('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5bec('0x2')]},'language':{'type':Sequelize[_0x5bec('0x2')]},'accountcode':{'type':Sequelize[_0x5bec('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5bec('0x2')]},'priority':{'type':Sequelize[_0x5bec('0x3')]},'uniqueid':{'type':Sequelize[_0x5bec('0x2')]},'linkedid':{'type':Sequelize[_0x5bec('0x2')]},'destchannel':{'type':Sequelize[_0x5bec('0x2')]},'destchannelstate':{'type':Sequelize[_0x5bec('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x5bec('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5bec('0x2')]},'destaccountcode':{'type':Sequelize[_0x5bec('0x2')]},'destcontext':{'type':Sequelize[_0x5bec('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5bec('0x3')]},'destuniqueid':{'type':Sequelize[_0x5bec('0x2')]},'destlinkedid':{'type':Sequelize[_0x5bec('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x5bec('0x2')]},'starttime':{'type':Sequelize[_0x5bec('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5bec('0x4')]},'lastevent':{'type':Sequelize[_0x5bec('0x2')],'comment':_0x5bec('0x5')},'routeId':{'type':Sequelize[_0x5bec('0x3')]},'duration':{'type':Sequelize[_0x5bec('0x3')]},'holdtime':{'type':Sequelize[_0x5bec('0x3')]},'billableseconds':{'type':Sequelize[_0x5bec('0x3')]}}; \ No newline at end of file +var _0x6f0d=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x4f1f6f,_0x3eb06f){var _0x41e11d=function(_0x5d7628){while(--_0x5d7628){_0x4f1f6f['push'](_0x4f1f6f['shift']());}};_0x41e11d(++_0x3eb06f);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x57cdec,_0x505fec){_0x57cdec=_0x57cdec-0x0;var _0x56b63c=_0x6f0d[_0x57cdec];return _0x56b63c;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'privilege':{'type':Sequelize[_0xd6f0('0x1')]},'channel':{'type':Sequelize[_0xd6f0('0x1')]},'channelstate':{'type':Sequelize[_0xd6f0('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'calleridname':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'language':{'type':Sequelize[_0xd6f0('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd6f0('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd6f0('0x2')]},'uniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'linkedid':{'type':Sequelize[_0xd6f0('0x1')]},'destchannel':{'type':Sequelize[_0xd6f0('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'destcalleridname':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'destlanguage':{'type':Sequelize[_0xd6f0('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd6f0('0x1')]},'destexten':{'type':Sequelize[_0xd6f0('0x1')]},'destpriority':{'type':Sequelize[_0xd6f0('0x2')]},'destuniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xd6f0('0x1')]},'dialstatus':{'type':Sequelize[_0xd6f0('0x1')]},'starttime':{'type':Sequelize[_0xd6f0('0x3')]},'answertime':{'type':Sequelize[_0xd6f0('0x3')]},'endtime':{'type':Sequelize[_0xd6f0('0x3')]},'lastevent':{'type':Sequelize[_0xd6f0('0x1')],'comment':_0xd6f0('0x4')},'routeId':{'type':Sequelize[_0xd6f0('0x2')]},'duration':{'type':Sequelize[_0xd6f0('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd6f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index c140a87..7e960f0 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 _0x920e=['map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceDialReport','includeAll','include','findAll','show','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index'];(function(_0x5d4876,_0x11e6b0){var _0x6927ac=function(_0x2e9a3a){while(--_0x2e9a3a){_0x5d4876['push'](_0x5d4876['shift']());}};_0x6927ac(++_0x11e6b0);}(_0x920e,0x1b5));var _0xe920=function(_0x127d2d,_0x36be4c){_0x127d2d=_0x127d2d-0x0;var _0x35fe47=_0x920e[_0x127d2d];return _0x35fe47;};'use strict';var emlformat=require(_0xe920('0x0'));var rimraf=require(_0xe920('0x1'));var zipdir=require(_0xe920('0x2'));var jsonpatch=require(_0xe920('0x3'));var rp=require(_0xe920('0x4'));var moment=require(_0xe920('0x5'));var BPromise=require(_0xe920('0x6'));var Mustache=require(_0xe920('0x7'));var util=require('util');var path=require(_0xe920('0x8'));var sox=require(_0xe920('0x9'));var csv=require('to-csv');var ejs=require(_0xe920('0xa'));var fs=require('fs');var fs_extra=require(_0xe920('0xb'));var _=require(_0xe920('0xc'));var squel=require(_0xe920('0xd'));var crypto=require(_0xe920('0xe'));var jsforce=require(_0xe920('0xf'));var deskjs=require(_0xe920('0x10'));var toCsv=require(_0xe920('0x11'));var querystring=require(_0xe920('0x12'));var Papa=require(_0xe920('0x13'));var Redis=require(_0xe920('0x14'));var authService=require(_0xe920('0x15'));var qs=require(_0xe920('0x16'));var as=require(_0xe920('0x17'));var hardwareService=require(_0xe920('0x18'));var logger=require(_0xe920('0x19'))(_0xe920('0x1a'));var utils=require('../../config/utils');var config=require(_0xe920('0x1b'));var licenseUtil=require(_0xe920('0x1c'));var db=require(_0xe920('0x1d'))['db'];function respondWithStatusCode(_0x279bae,_0x3fc8fa){_0x3fc8fa=_0x3fc8fa||0xcc;return function(_0x36fd27){if(_0x36fd27){return _0x279bae[_0xe920('0x1e')](_0x3fc8fa);}return _0x279bae[_0xe920('0x1f')](_0x3fc8fa)[_0xe920('0x20')]();};}function respondWithResult(_0xe24df,_0x314d53){_0x314d53=_0x314d53||0xc8;return function(_0x36c735){if(_0x36c735){return _0xe24df[_0xe920('0x1f')](_0x314d53)['json'](_0x36c735);}};}function respondWithFilteredResult(_0x3f7737,_0x42059e){return function(_0x55482f){if(_0x55482f){var _0x5975e2=typeof _0x42059e[_0xe920('0x21')]===_0xe920('0x22')&&typeof _0x42059e[_0xe920('0x23')]===_0xe920('0x22');var _0x56f43e=_0x55482f[_0xe920('0x24')];var _0x41c165=_0x5975e2?0x0:_0x42059e[_0xe920('0x21')];var _0x12a3fd=_0x5975e2?_0x55482f[_0xe920('0x24')]:_0x42059e[_0xe920('0x21')]+_0x42059e[_0xe920('0x23')];var _0x1136a8;if(_0x12a3fd>=_0x56f43e){_0x12a3fd=_0x56f43e;_0x1136a8=0xc8;}else{_0x1136a8=0xce;}_0x3f7737[_0xe920('0x1f')](_0x1136a8);return _0x3f7737[_0xe920('0x25')](_0xe920('0x26'),_0x41c165+'-'+_0x12a3fd+'/'+_0x56f43e)['json'](_0x55482f);}return null;};}function patchUpdates(_0x1f679c){return function(_0x22afa6){try{jsonpatch[_0xe920('0x27')](_0x22afa6,_0x1f679c,!![]);}catch(_0x2be254){return BPromise['reject'](_0x2be254);}return _0x22afa6[_0xe920('0x28')]();};}function saveUpdates(_0x3f81cd,_0x136d42){return function(_0x2ec06e){if(_0x2ec06e){return _0x2ec06e[_0xe920('0x29')](_0x3f81cd)[_0xe920('0x2a')](function(_0x32c531){return _0x32c531;});}return null;};}function removeEntity(_0x2b7297,_0x4c1dde){return function(_0x3365f6){if(_0x3365f6){return _0x3365f6[_0xe920('0x2b')]()[_0xe920('0x2a')](function(){_0x2b7297[_0xe920('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x595e05,_0x3f90fa){return function(_0x546363){if(!_0x546363){_0x595e05[_0xe920('0x1e')](0x194);}return _0x546363;};}function handleError(_0x3ba2ed,_0x54b763){_0x54b763=_0x54b763||0x1f4;return function(_0x585ff6){logger[_0xe920('0x2c')](_0x585ff6[_0xe920('0x2d')]);if(_0x585ff6['name']){delete _0x585ff6[_0xe920('0x2e')];}_0x3ba2ed[_0xe920('0x1f')](_0x54b763)[_0xe920('0x2f')](_0x585ff6);};}exports[_0xe920('0x30')]=function(_0x46e4a8,_0x43f37d){var _0x5916ee={},_0x5f2558={},_0x3c4cdc={'count':0x0,'rows':[]};var _0x455d4d=_[_0xe920('0x31')](db['VoiceDialReport'][_0xe920('0x32')],function(_0x42c2c6){return{'name':_0x42c2c6[_0xe920('0x33')],'type':_0x42c2c6[_0xe920('0x34')]['key']};});_0x5f2558[_0xe920('0x35')]=_[_0xe920('0x31')](_0x455d4d,_0xe920('0x2e'));_0x5f2558[_0xe920('0x36')]=_[_0xe920('0x37')](_0x46e4a8[_0xe920('0x36')]);_0x5f2558[_0xe920('0x38')]=_[_0xe920('0x39')](_0x5f2558[_0xe920('0x35')],_0x5f2558[_0xe920('0x36')]);_0x5916ee[_0xe920('0x3a')]=_['intersection'](_0x5f2558[_0xe920('0x35')],qs['fields'](_0x46e4a8[_0xe920('0x36')][_0xe920('0x3b')]));_0x5916ee['attributes']=_0x5916ee[_0xe920('0x3a')][_0xe920('0x3c')]?_0x5916ee[_0xe920('0x3a')]:_0x5f2558['model'];if(!_0x46e4a8[_0xe920('0x36')][_0xe920('0x3d')](_0xe920('0x3e'))){_0x5916ee[_0xe920('0x23')]=qs[_0xe920('0x23')](_0x46e4a8[_0xe920('0x36')][_0xe920('0x23')]);_0x5916ee[_0xe920('0x21')]=qs['offset'](_0x46e4a8['query'][_0xe920('0x21')]);}_0x5916ee[_0xe920('0x3f')]=qs[_0xe920('0x40')](_0x46e4a8[_0xe920('0x36')]['sort']);_0x5916ee['where']=qs[_0xe920('0x38')](_[_0xe920('0x41')](_0x46e4a8['query'],_0x5f2558[_0xe920('0x38')]),_0x455d4d);if(_0x46e4a8[_0xe920('0x36')][_0xe920('0x42')]){_0x5916ee[_0xe920('0x43')]=_[_0xe920('0x44')](_0x5916ee[_0xe920('0x43')],{'$or':_[_0xe920('0x31')](_0x455d4d,function(_0x4c64bc){if(_0x4c64bc[_0xe920('0x34')]!==_0xe920('0x45')){var _0x4cd9fb={};_0x4cd9fb[_0x4c64bc['name']]={'$like':'%'+_0x46e4a8[_0xe920('0x36')][_0xe920('0x42')]+'%'};return _0x4cd9fb;}})});}_0x5916ee=_[_0xe920('0x44')]({},_0x5916ee,_0x46e4a8[_0xe920('0x46')]);var _0x3b9a10={'where':_0x5916ee[_0xe920('0x43')]};return db[_0xe920('0x47')][_0xe920('0x24')](_0x3b9a10)[_0xe920('0x2a')](function(_0x15d490){_0x3c4cdc[_0xe920('0x24')]=_0x15d490;if(_0x46e4a8[_0xe920('0x36')][_0xe920('0x48')]){_0x5916ee[_0xe920('0x49')]=[{'all':!![]}];}return db[_0xe920('0x47')][_0xe920('0x4a')](_0x5916ee);})['then'](function(_0x5b5495){_0x3c4cdc['rows']=_0x5b5495;return _0x3c4cdc;})[_0xe920('0x2a')](respondWithFilteredResult(_0x43f37d,_0x5916ee))['catch'](handleError(_0x43f37d,null));};exports[_0xe920('0x4b')]=function(_0x4966c5,_0xcb754e){var _0x2798ff={'raw':!![],'where':{'id':_0x4966c5['params']['id']}},_0x4d163f={};_0x4d163f[_0xe920('0x35')]=_[_0xe920('0x37')](db[_0xe920('0x47')]['rawAttributes']);_0x4d163f['query']=_['keys'](_0x4966c5['query']);_0x4d163f['filters']=_[_0xe920('0x39')](_0x4d163f[_0xe920('0x35')],_0x4d163f[_0xe920('0x36')]);_0x2798ff[_0xe920('0x3a')]=_[_0xe920('0x39')](_0x4d163f[_0xe920('0x35')],qs[_0xe920('0x3b')](_0x4966c5[_0xe920('0x36')][_0xe920('0x3b')]));_0x2798ff[_0xe920('0x3a')]=_0x2798ff['attributes'][_0xe920('0x3c')]?_0x2798ff[_0xe920('0x3a')]:_0x4d163f['model'];if(_0x4966c5[_0xe920('0x36')][_0xe920('0x48')]){_0x2798ff[_0xe920('0x49')]=[{'all':!![]}];}_0x2798ff=_['merge']({},_0x2798ff,_0x4966c5['options']);return db[_0xe920('0x47')][_0xe920('0x4c')](_0x2798ff)['then'](handleEntityNotFound(_0xcb754e,null))[_0xe920('0x2a')](respondWithResult(_0xcb754e,null))['catch'](handleError(_0xcb754e,null));};exports[_0xe920('0x4d')]=function(_0x31c168,_0x53fad6){return db[_0xe920('0x47')]['create'](_0x31c168[_0xe920('0x4e')],{})[_0xe920('0x2a')](respondWithResult(_0x53fad6,0xc9))[_0xe920('0x4f')](handleError(_0x53fad6,null));};exports[_0xe920('0x29')]=function(_0x2613fe,_0x211a8d){if(_0x2613fe[_0xe920('0x4e')]['id']){delete _0x2613fe['body']['id'];}return db[_0xe920('0x47')][_0xe920('0x4c')]({'where':{'id':_0x2613fe['params']['id']}})[_0xe920('0x2a')](handleEntityNotFound(_0x211a8d,null))['then'](saveUpdates(_0x2613fe[_0xe920('0x4e')],null))[_0xe920('0x2a')](respondWithResult(_0x211a8d,null))['catch'](handleError(_0x211a8d,null));};exports['destroy']=function(_0x1c350e,_0xcccff6){return db['VoiceDialReport'][_0xe920('0x4c')]({'where':{'id':_0x1c350e['params']['id']}})[_0xe920('0x2a')](handleEntityNotFound(_0xcccff6,null))[_0xe920('0x2a')](removeEntity(_0xcccff6,null))[_0xe920('0x4f')](handleError(_0xcccff6,null));};exports[_0xe920('0x50')]=function(_0x41db78,_0x5629ba){return db[_0xe920('0x47')][_0xe920('0x50')]()[_0xe920('0x2a')](respondWithResult(_0x5629ba,null))[_0xe920('0x4f')](handleError(_0x5629ba,null));}; \ No newline at end of file +var _0x62a8=['where','VIRTUAL','merge','options','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x62a8,0x197));var _0x862a=function(_0x318c72,_0x2d94c2){_0x318c72=_0x318c72-0x0;var _0x117a4e=_0x62a8[_0x318c72];return _0x117a4e;};'use strict';var emlformat=require(_0x862a('0x0'));var rimraf=require(_0x862a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x862a('0x2'));var rp=require(_0x862a('0x3'));var moment=require(_0x862a('0x4'));var BPromise=require(_0x862a('0x5'));var Mustache=require(_0x862a('0x6'));var util=require(_0x862a('0x7'));var path=require(_0x862a('0x8'));var sox=require('sox');var csv=require(_0x862a('0x9'));var ejs=require(_0x862a('0xa'));var fs=require('fs');var fs_extra=require(_0x862a('0xb'));var _=require(_0x862a('0xc'));var squel=require(_0x862a('0xd'));var crypto=require(_0x862a('0xe'));var jsforce=require(_0x862a('0xf'));var deskjs=require(_0x862a('0x10'));var toCsv=require(_0x862a('0x9'));var querystring=require(_0x862a('0x11'));var Papa=require(_0x862a('0x12'));var Redis=require('ioredis');var authService=require(_0x862a('0x13'));var qs=require(_0x862a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x862a('0x15'));var logger=require(_0x862a('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x862a('0x17'));var licenseUtil=require(_0x862a('0x18'));var db=require(_0x862a('0x19'))['db'];function respondWithStatusCode(_0x2bb3db,_0x1c06ea){_0x1c06ea=_0x1c06ea||0xcc;return function(_0x2321e3){if(_0x2321e3){return _0x2bb3db[_0x862a('0x1a')](_0x1c06ea);}return _0x2bb3db[_0x862a('0x1b')](_0x1c06ea)['end']();};}function respondWithResult(_0x2b0eb3,_0x551075){_0x551075=_0x551075||0xc8;return function(_0x1a95a4){if(_0x1a95a4){return _0x2b0eb3[_0x862a('0x1b')](_0x551075)['json'](_0x1a95a4);}};}function respondWithFilteredResult(_0xf54773,_0x361a75){return function(_0x3c1705){if(_0x3c1705){var _0x491560=typeof _0x361a75[_0x862a('0x1c')]==='undefined'&&typeof _0x361a75[_0x862a('0x1d')]===_0x862a('0x1e');var _0x5acb11=_0x3c1705[_0x862a('0x1f')];var _0x59e737=_0x491560?0x0:_0x361a75[_0x862a('0x1c')];var _0x1bdfb4=_0x491560?_0x3c1705['count']:_0x361a75['offset']+_0x361a75[_0x862a('0x1d')];var _0x350f6c;if(_0x1bdfb4>=_0x5acb11){_0x1bdfb4=_0x5acb11;_0x350f6c=0xc8;}else{_0x350f6c=0xce;}_0xf54773[_0x862a('0x1b')](_0x350f6c);return _0xf54773['set'](_0x862a('0x20'),_0x59e737+'-'+_0x1bdfb4+'/'+_0x5acb11)[_0x862a('0x21')](_0x3c1705);}return null;};}function patchUpdates(_0x532311){return function(_0x52c1d5){try{jsonpatch[_0x862a('0x22')](_0x52c1d5,_0x532311,!![]);}catch(_0x3b1b23){return BPromise[_0x862a('0x23')](_0x3b1b23);}return _0x52c1d5[_0x862a('0x24')]();};}function saveUpdates(_0xb76d30,_0x2f5445){return function(_0x470c88){if(_0x470c88){return _0x470c88[_0x862a('0x25')](_0xb76d30)[_0x862a('0x26')](function(_0x3b1ca1){return _0x3b1ca1;});}return null;};}function removeEntity(_0xc31124,_0x3ea31b){return function(_0x351e7f){if(_0x351e7f){return _0x351e7f['destroy']()[_0x862a('0x26')](function(){_0xc31124[_0x862a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18bb19,_0x50c6b3){return function(_0x3c2c95){if(!_0x3c2c95){_0x18bb19[_0x862a('0x1a')](0x194);}return _0x3c2c95;};}function handleError(_0x3b2d58,_0x54eb36){_0x54eb36=_0x54eb36||0x1f4;return function(_0xf46d2c){logger[_0x862a('0x27')](_0xf46d2c[_0x862a('0x28')]);if(_0xf46d2c[_0x862a('0x29')]){delete _0xf46d2c[_0x862a('0x29')];}_0x3b2d58[_0x862a('0x1b')](_0x54eb36)['send'](_0xf46d2c);};}exports[_0x862a('0x2a')]=function(_0x436df7,_0xaac360){var _0x228b39={},_0x16a28a={},_0x9e273c={'count':0x0,'rows':[]};var _0x1e092c=_[_0x862a('0x2b')](db[_0x862a('0x2c')][_0x862a('0x2d')],function(_0x52e3c7){return{'name':_0x52e3c7[_0x862a('0x2e')],'type':_0x52e3c7[_0x862a('0x2f')][_0x862a('0x30')]};});_0x16a28a[_0x862a('0x31')]=_['map'](_0x1e092c,_0x862a('0x29'));_0x16a28a[_0x862a('0x32')]=_[_0x862a('0x33')](_0x436df7[_0x862a('0x32')]);_0x16a28a['filters']=_[_0x862a('0x34')](_0x16a28a['model'],_0x16a28a[_0x862a('0x32')]);_0x228b39[_0x862a('0x35')]=_[_0x862a('0x34')](_0x16a28a['model'],qs[_0x862a('0x36')](_0x436df7[_0x862a('0x32')][_0x862a('0x36')]));_0x228b39[_0x862a('0x35')]=_0x228b39['attributes']['length']?_0x228b39[_0x862a('0x35')]:_0x16a28a[_0x862a('0x31')];if(!_0x436df7[_0x862a('0x32')][_0x862a('0x37')](_0x862a('0x38'))){_0x228b39[_0x862a('0x1d')]=qs[_0x862a('0x1d')](_0x436df7['query']['limit']);_0x228b39['offset']=qs[_0x862a('0x1c')](_0x436df7[_0x862a('0x32')][_0x862a('0x1c')]);}_0x228b39['order']=qs[_0x862a('0x39')](_0x436df7[_0x862a('0x32')]['sort']);_0x228b39['where']=qs[_0x862a('0x3a')](_[_0x862a('0x3b')](_0x436df7[_0x862a('0x32')],_0x16a28a[_0x862a('0x3a')]),_0x1e092c);if(_0x436df7[_0x862a('0x32')][_0x862a('0x3c')]){_0x228b39[_0x862a('0x3d')]=_['merge'](_0x228b39[_0x862a('0x3d')],{'$or':_[_0x862a('0x2b')](_0x1e092c,function(_0x104571){if(_0x104571[_0x862a('0x2f')]!==_0x862a('0x3e')){var _0x337e40={};_0x337e40[_0x104571['name']]={'$like':'%'+_0x436df7[_0x862a('0x32')][_0x862a('0x3c')]+'%'};return _0x337e40;}})});}_0x228b39=_[_0x862a('0x3f')]({},_0x228b39,_0x436df7[_0x862a('0x40')]);var _0x6f18b0={'where':_0x228b39[_0x862a('0x3d')]};return db['VoiceDialReport'][_0x862a('0x1f')](_0x6f18b0)['then'](function(_0x1b9ebd){_0x9e273c['count']=_0x1b9ebd;if(_0x436df7['query']['includeAll']){_0x228b39[_0x862a('0x41')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x862a('0x42')](_0x228b39);})[_0x862a('0x26')](function(_0xf59499){_0x9e273c[_0x862a('0x43')]=_0xf59499;return _0x9e273c;})[_0x862a('0x26')](respondWithFilteredResult(_0xaac360,_0x228b39))['catch'](handleError(_0xaac360,null));};exports[_0x862a('0x44')]=function(_0x15803e,_0x4b6d2f){var _0x52eb23={'raw':!![],'where':{'id':_0x15803e[_0x862a('0x45')]['id']}},_0x2bc045={};_0x2bc045[_0x862a('0x31')]=_['keys'](db[_0x862a('0x2c')][_0x862a('0x2d')]);_0x2bc045[_0x862a('0x32')]=_[_0x862a('0x33')](_0x15803e[_0x862a('0x32')]);_0x2bc045['filters']=_[_0x862a('0x34')](_0x2bc045[_0x862a('0x31')],_0x2bc045[_0x862a('0x32')]);_0x52eb23[_0x862a('0x35')]=_['intersection'](_0x2bc045['model'],qs[_0x862a('0x36')](_0x15803e[_0x862a('0x32')][_0x862a('0x36')]));_0x52eb23['attributes']=_0x52eb23['attributes'][_0x862a('0x46')]?_0x52eb23[_0x862a('0x35')]:_0x2bc045[_0x862a('0x31')];if(_0x15803e['query'][_0x862a('0x47')]){_0x52eb23[_0x862a('0x41')]=[{'all':!![]}];}_0x52eb23=_[_0x862a('0x3f')]({},_0x52eb23,_0x15803e[_0x862a('0x40')]);return db[_0x862a('0x2c')][_0x862a('0x48')](_0x52eb23)[_0x862a('0x26')](handleEntityNotFound(_0x4b6d2f,null))['then'](respondWithResult(_0x4b6d2f,null))[_0x862a('0x49')](handleError(_0x4b6d2f,null));};exports[_0x862a('0x4a')]=function(_0x1abc77,_0x203221){return db[_0x862a('0x2c')][_0x862a('0x4a')](_0x1abc77[_0x862a('0x4b')],{})['then'](respondWithResult(_0x203221,0xc9))[_0x862a('0x49')](handleError(_0x203221,null));};exports[_0x862a('0x25')]=function(_0x324541,_0x59f282){if(_0x324541[_0x862a('0x4b')]['id']){delete _0x324541['body']['id'];}return db[_0x862a('0x2c')][_0x862a('0x48')]({'where':{'id':_0x324541[_0x862a('0x45')]['id']}})[_0x862a('0x26')](handleEntityNotFound(_0x59f282,null))[_0x862a('0x26')](saveUpdates(_0x324541[_0x862a('0x4b')],null))[_0x862a('0x26')](respondWithResult(_0x59f282,null))['catch'](handleError(_0x59f282,null));};exports[_0x862a('0x4c')]=function(_0x38bd57,_0x4e01ac){return db['VoiceDialReport'][_0x862a('0x48')]({'where':{'id':_0x38bd57[_0x862a('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e01ac,null))['then'](removeEntity(_0x4e01ac,null))[_0x862a('0x49')](handleError(_0x4e01ac,null));};exports[_0x862a('0x4d')]=function(_0x266800,_0x2dcbd9){return db['VoiceDialReport'][_0x862a('0x4d')]()[_0x862a('0x26')](respondWithResult(_0x2dcbd9,null))[_0x862a('0x49')](handleError(_0x2dcbd9,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 9b41f6c..0f2aff8 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 _0xeddd=['uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial'];(function(_0x390b2b,_0x34988d){var _0x523fb5=function(_0x1cd802){while(--_0x1cd802){_0x390b2b['push'](_0x390b2b['shift']());}};_0x523fb5(++_0x34988d);}(_0xeddd,0x69));var _0xdedd=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xeddd[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xdedd('0x0'));var util=require(_0xdedd('0x1'));var logger=require(_0xdedd('0x2'))(_0xdedd('0x3'));var moment=require('moment');var BPromise=require(_0xdedd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdedd('0x5'));var rimraf=require(_0xdedd('0x6'));var config=require('../../config/environment');var attributes=require(_0xdedd('0x7'));module[_0xdedd('0x8')]=function(_0x16801a,_0x3e6b5a){return _0x16801a[_0xdedd('0x9')](_0xdedd('0xa'),attributes,{'tableName':_0xdedd('0xb'),'paranoid':![],'indexes':[{'fields':[_0xdedd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb8d9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','define','uniqueid','lodash','util','../../config/logger','api'];(function(_0xa336b3,_0x517241){var _0x174f4a=function(_0x1b388c){while(--_0x1b388c){_0xa336b3['push'](_0xa336b3['shift']());}};_0x174f4a(++_0x517241);}(_0xb8d9,0x175));var _0x9b8d=function(_0x21c908,_0x2acb35){_0x21c908=_0x21c908-0x0;var _0x29f925=_0xb8d9[_0x21c908];return _0x29f925;};'use strict';var _=require(_0x9b8d('0x0'));var util=require(_0x9b8d('0x1'));var logger=require(_0x9b8d('0x2'))(_0x9b8d('0x3'));var moment=require(_0x9b8d('0x4'));var BPromise=require(_0x9b8d('0x5'));var rp=require(_0x9b8d('0x6'));var fs=require('fs');var path=require(_0x9b8d('0x7'));var rimraf=require(_0x9b8d('0x8'));var config=require(_0x9b8d('0x9'));var attributes=require(_0x9b8d('0xa'));module['exports']=function(_0x4a385f,_0x3d7703){return _0x4a385f[_0x9b8d('0xb')]('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x9b8d('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 3b6056e..4c31871 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 _0x9fdd=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','catch','CreateVoiceDialReport','create','options','raw','UpdateVoiceDialReport','update','body','where','attributes','limit','lodash','util','bluebird'];(function(_0x10852d,_0x4cdcc6){var _0x13a8d6=function(_0x2ece16){while(--_0x2ece16){_0x10852d['push'](_0x10852d['shift']());}};_0x13a8d6(++_0x4cdcc6);}(_0x9fdd,0x114));var _0xd9fd=function(_0x3fef3a,_0x304d13){_0x3fef3a=_0x3fef3a-0x0;var _0x3d1ace=_0x9fdd[_0x3fef3a];return _0x3d1ace;};'use strict';var _=require(_0xd9fd('0x0'));var util=require(_0xd9fd('0x1'));var moment=require('moment');var BPromise=require(_0xd9fd('0x2'));var rs=require(_0xd9fd('0x3'));var fs=require('fs');var Redis=require(_0xd9fd('0x4'));var db=require(_0xd9fd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9fd('0x6'))('rpc');var config=require(_0xd9fd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd9fd('0x8')][_0xd9fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3de8e7,_0x21c6eb,_0x275e8f){return new BPromise(function(_0x28060e,_0x535b7c){return client['request'](_0x3de8e7,_0x275e8f)[_0xd9fd('0xa')](function(_0x4b6a07){logger[_0xd9fd('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x21c6eb,_0xd9fd('0xc'));logger[_0xd9fd('0xd')](_0xd9fd('0xe'),_0x21c6eb,'request\x20sent',JSON[_0xd9fd('0xf')](_0x4b6a07));if(_0x4b6a07[_0xd9fd('0x10')]){if(_0x4b6a07[_0xd9fd('0x10')][_0xd9fd('0x11')]===0x1f4){logger[_0xd9fd('0x10')](_0xd9fd('0x12'),_0x21c6eb,_0x4b6a07['error'][_0xd9fd('0x13')]);return _0x535b7c(_0x4b6a07[_0xd9fd('0x10')][_0xd9fd('0x13')]);}logger['error'](_0xd9fd('0x12'),_0x21c6eb,_0x4b6a07[_0xd9fd('0x10')]['message']);return _0x28060e(_0x4b6a07[_0xd9fd('0x10')][_0xd9fd('0x13')]);}else{logger[_0xd9fd('0xb')](_0xd9fd('0x12'),_0x21c6eb,_0xd9fd('0xc'));_0x28060e(_0x4b6a07['result']['message']);}})[_0xd9fd('0x14')](function(_0x1f0e14){logger[_0xd9fd('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x21c6eb,_0x1f0e14);_0x535b7c(_0x1f0e14);});});}exports[_0xd9fd('0x15')]=function(_0x5e371c){var _0xbab378=this;return new Promise(function(_0x3111e8,_0x99b11c){return db['VoiceDialReport'][_0xd9fd('0x16')](_0x5e371c['body'],{'raw':_0x5e371c['options']?_0x5e371c[_0xd9fd('0x17')][_0xd9fd('0x18')]===undefined?!![]:![]:!![]})[_0xd9fd('0xa')](function(_0x4cb5d4){logger[_0xd9fd('0xb')](_0xd9fd('0x15'),_0x5e371c);logger['debug'](_0xd9fd('0x15'),_0x5e371c,JSON[_0xd9fd('0xf')](_0x4cb5d4));_0x3111e8(_0x4cb5d4);})[_0xd9fd('0x14')](function(_0x50a0c3){logger['error'](_0xd9fd('0x15'),_0x50a0c3['message'],_0x5e371c);_0x99b11c(_0xbab378[_0xd9fd('0x10')](0x1f4,_0x50a0c3[_0xd9fd('0x13')]));});});};exports[_0xd9fd('0x19')]=function(_0x2d1c96){var _0x17e95b=this;return new Promise(function(_0x3ac592,_0x16ab6f){return db['VoiceDialReport'][_0xd9fd('0x1a')](_0x2d1c96[_0xd9fd('0x1b')],{'raw':_0x2d1c96[_0xd9fd('0x17')]?_0x2d1c96['options'][_0xd9fd('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d1c96[_0xd9fd('0x17')]?_0x2d1c96[_0xd9fd('0x17')][_0xd9fd('0x1c')]||null:null,'attributes':_0x2d1c96[_0xd9fd('0x17')]?_0x2d1c96[_0xd9fd('0x17')][_0xd9fd('0x1d')]||null:null,'limit':_0x2d1c96[_0xd9fd('0x17')]?_0x2d1c96['options'][_0xd9fd('0x1e')]||null:null})['then'](function(_0x3dfd61){logger[_0xd9fd('0xb')]('UpdateVoiceDialReport',_0x2d1c96);logger['debug'](_0xd9fd('0x19'),_0x2d1c96,JSON[_0xd9fd('0xf')](_0x3dfd61));_0x3ac592(_0x3dfd61);})[_0xd9fd('0x14')](function(_0xd6d0f0){logger[_0xd9fd('0x10')](_0xd9fd('0x19'),_0xd6d0f0[_0xd9fd('0x13')],_0x2d1c96);_0x16ab6f(_0x17e95b[_0xd9fd('0x10')](0x1f4,_0xd6d0f0[_0xd9fd('0x13')]));});});}; \ No newline at end of file +var _0x7aa3=['result','catch','VoiceDialReport','create','body','options','CreateVoiceDialReport','stringify','UpdateVoiceDialReport','raw','where','attributes','lodash','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','VoiceDialReport,\x20%s,\x20%s','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7aa3,0x192));var _0x37aa=function(_0x2ba8b2,_0x5530a7){_0x2ba8b2=_0x2ba8b2-0x0;var _0x2235b6=_0x7aa3[_0x2ba8b2];return _0x2235b6;};'use strict';var _=require(_0x37aa('0x0'));var util=require('util');var moment=require(_0x37aa('0x1'));var BPromise=require(_0x37aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37aa('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x37aa('0x4'))(_0x37aa('0x5'));var config=require('../../config/environment');var jayson=require(_0x37aa('0x6'));var client=jayson['client'][_0x37aa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4a552b,_0x5993b2,_0x3c0f74){return new BPromise(function(_0xf394f9,_0x320897){return client[_0x37aa('0x8')](_0x4a552b,_0x3c0f74)[_0x37aa('0x9')](function(_0x4a1014){logger[_0x37aa('0xa')]('VoiceDialReport,\x20%s,\x20%s',_0x5993b2,_0x37aa('0xb'));logger[_0x37aa('0xc')](_0x37aa('0xd'),_0x5993b2,_0x37aa('0xb'),JSON['stringify'](_0x4a1014));if(_0x4a1014[_0x37aa('0xe')]){if(_0x4a1014['error'][_0x37aa('0xf')]===0x1f4){logger[_0x37aa('0xe')](_0x37aa('0x10'),_0x5993b2,_0x4a1014[_0x37aa('0xe')][_0x37aa('0x11')]);return _0x320897(_0x4a1014[_0x37aa('0xe')][_0x37aa('0x11')]);}logger[_0x37aa('0xe')](_0x37aa('0x10'),_0x5993b2,_0x4a1014[_0x37aa('0xe')][_0x37aa('0x11')]);return _0xf394f9(_0x4a1014[_0x37aa('0xe')][_0x37aa('0x11')]);}else{logger['info'](_0x37aa('0x10'),_0x5993b2,_0x37aa('0xb'));_0xf394f9(_0x4a1014[_0x37aa('0x12')][_0x37aa('0x11')]);}})[_0x37aa('0x13')](function(_0x5418b4){logger['error'](_0x37aa('0x10'),_0x5993b2,_0x5418b4);_0x320897(_0x5418b4);});});}exports['CreateVoiceDialReport']=function(_0x24ca88){var _0x41e1f5=this;return new Promise(function(_0x5cef63,_0x35ae85){return db[_0x37aa('0x14')][_0x37aa('0x15')](_0x24ca88[_0x37aa('0x16')],{'raw':_0x24ca88[_0x37aa('0x17')]?_0x24ca88[_0x37aa('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x37aa('0x9')](function(_0x164f06){logger[_0x37aa('0xa')](_0x37aa('0x18'),_0x24ca88);logger['debug'](_0x37aa('0x18'),_0x24ca88,JSON[_0x37aa('0x19')](_0x164f06));_0x5cef63(_0x164f06);})[_0x37aa('0x13')](function(_0x5f36e4){logger[_0x37aa('0xe')](_0x37aa('0x18'),_0x5f36e4[_0x37aa('0x11')],_0x24ca88);_0x35ae85(_0x41e1f5[_0x37aa('0xe')](0x1f4,_0x5f36e4[_0x37aa('0x11')]));});});};exports[_0x37aa('0x1a')]=function(_0x2d8518){var _0x32ee02=this;return new Promise(function(_0x151c1e,_0xdc38e){return db['VoiceDialReport']['update'](_0x2d8518['body'],{'raw':_0x2d8518['options']?_0x2d8518[_0x37aa('0x17')][_0x37aa('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d8518['options']?_0x2d8518[_0x37aa('0x17')][_0x37aa('0x1c')]||null:null,'attributes':_0x2d8518[_0x37aa('0x17')]?_0x2d8518[_0x37aa('0x17')][_0x37aa('0x1d')]||null:null,'limit':_0x2d8518['options']?_0x2d8518[_0x37aa('0x17')]['limit']||null:null})[_0x37aa('0x9')](function(_0xe8256c){logger[_0x37aa('0xa')](_0x37aa('0x1a'),_0x2d8518);logger[_0x37aa('0xc')](_0x37aa('0x1a'),_0x2d8518,JSON[_0x37aa('0x19')](_0xe8256c));_0x151c1e(_0xe8256c);})[_0x37aa('0x13')](function(_0x5df0ac){logger[_0x37aa('0xe')](_0x37aa('0x1a'),_0x5df0ac['message'],_0x2d8518);_0xdc38e(_0x32ee02[_0x37aa('0xe')](0x1f4,_0x5df0ac[_0x37aa('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 20f9fe8..5693464 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 _0x4b3b=['util','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','/:id/applications','update','destroy','exports','multer'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x4b3b,0x65));var _0xb4b3=function(_0xa2b6ae,_0x3f3617){_0xa2b6ae=_0xa2b6ae-0x0;var _0x358722=_0x4b3b[_0xa2b6ae];return _0x358722;};'use strict';var multer=require(_0xb4b3('0x0'));var util=require(_0xb4b3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb4b3('0x2'));var router=express['Router']();var fs_extra=require(_0xb4b3('0x3'));var auth=require(_0xb4b3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb4b3('0x5'));var controller=require('./voiceExtension.controller');router['get']('/',auth[_0xb4b3('0x6')](),controller[_0xb4b3('0x7')]);router[_0xb4b3('0x8')](_0xb4b3('0x9'),auth['isAuthenticated'](),controller[_0xb4b3('0xa')]);router[_0xb4b3('0xb')]('/',auth['isAuthenticated'](),controller[_0xb4b3('0xc')]);router[_0xb4b3('0xb')](_0xb4b3('0xd'),auth[_0xb4b3('0x6')](),controller['addApplications']);router['put'](_0xb4b3('0x9'),auth[_0xb4b3('0x6')](),controller[_0xb4b3('0xe')]);router['delete'](_0xb4b3('0x9'),auth['isAuthenticated'](),controller[_0xb4b3('0xf')]);module[_0xb4b3('0x10')]=router; \ No newline at end of file +var _0xe59e=['update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','get','/:id','show','post','create','/:id/applications','put'];(function(_0x259d17,_0x220710){var _0x407535=function(_0x49bc38){while(--_0x49bc38){_0x259d17['push'](_0x259d17['shift']());}};_0x407535(++_0x220710);}(_0xe59e,0x114));var _0xee59=function(_0x308841,_0x535c47){_0x308841=_0x308841-0x0;var _0x9c3549=_0xe59e[_0x308841];return _0x9c3549;};'use strict';var multer=require(_0xee59('0x0'));var util=require(_0xee59('0x1'));var path=require(_0xee59('0x2'));var timeout=require(_0xee59('0x3'));var express=require(_0xee59('0x4'));var router=express['Router']();var fs_extra=require(_0xee59('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xee59('0x6'));var config=require(_0xee59('0x7'));var controller=require(_0xee59('0x8'));router['get']('/',auth[_0xee59('0x9')](),controller[_0xee59('0xa')]);router[_0xee59('0xb')](_0xee59('0xc'),auth[_0xee59('0x9')](),controller[_0xee59('0xd')]);router[_0xee59('0xe')]('/',auth[_0xee59('0x9')](),controller[_0xee59('0xf')]);router['post'](_0xee59('0x10'),auth[_0xee59('0x9')](),controller['addApplications']);router[_0xee59('0x11')]('/:id',auth[_0xee59('0x9')](),controller[_0xee59('0x12')]);router[_0xee59('0x13')](_0xee59('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xee59('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 4f383dc..486e9be 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 _0xe061=['NoOp','inbound','outbound','outbound-fax','any','*,*,*,*','BOOLEAN','wav','getDataValue','exten','sequelize','exports','STRING','compositeIndex'];(function(_0x5bc4ba,_0x36b4bd){var _0x2a0538=function(_0x52575c){while(--_0x52575c){_0x5bc4ba['push'](_0x5bc4ba['shift']());}};_0x2a0538(++_0x36b4bd);}(_0xe061,0xf8));var _0x1e06=function(_0x22d4c2,_0x3be306){_0x22d4c2=_0x22d4c2-0x0;var _0xc90491=_0xe061[_0x22d4c2];return _0xc90491;};'use strict';var Sequelize=require(_0x1e06('0x0'));module[_0x1e06('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x1e06('0x2')],'allowNull':![],'unique':_0x1e06('0x3')},'priority':{'type':Sequelize[_0x1e06('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x1e06('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x1e06('0x2')],'allowNull':![],'defaultValue':_0x1e06('0x4')},'appdata':{'type':Sequelize[_0x1e06('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x1e06('0x5'),_0x1e06('0x6'),'internal','inbound-fax',_0x1e06('0x7'),'system',_0x1e06('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x1e06('0x2')]},'interval':{'type':Sequelize[_0x1e06('0x2')],'allowNull':![],'defaultValue':_0x1e06('0x9')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x1e06('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x1e06('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x1e06('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x1e06('0x2')],'defaultValue':_0x1e06('0xb')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x45ac3c){return this[_0x1e06('0xc')](_0x1e06('0xd'));}},'alias':{'type':Sequelize[_0x1e06('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xa246=['INTEGER','wav','VIRTUAL','getDataValue','sequelize','STRING','compositeIndex','inbound','inbound-fax','outbound-fax','system','*,*,*,*','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa246,0x6c));var _0x6a24=function(_0x3bc556,_0x5be905){_0x3bc556=_0x3bc556-0x0;var _0x54669c=_0xa246[_0x3bc556];return _0x54669c;};'use strict';var Sequelize=require(_0x6a24('0x0'));module['exports']={'context':{'type':Sequelize[_0x6a24('0x1')],'allowNull':![],'unique':_0x6a24('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6a24('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x6a24('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x6a24('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x6a24('0x3'),'outbound','internal',_0x6a24('0x4'),_0x6a24('0x5'),_0x6a24('0x6'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x6a24('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6a24('0x7')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x6a24('0x8')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x6a24('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x6a24('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x6a24('0x8')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x6a24('0x9')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x6a24('0xa')},'answer':{'type':Sequelize[_0x6a24('0x8')],'defaultValue':!![]},'name':{'type':Sequelize[_0x6a24('0xb')],'get':function(_0x1be4c7){return this[_0x6a24('0xc')]('exten');}},'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 62232ac..bebe173 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 _0x7db8=['outbound','filter','ignore','value','includes','type','name','UserProfileResource','destroy','error','stack','index','VoiceExtension','rawAttributes','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','include','findAll','catch','show','includeAll','options','params','body','startsWith','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','internal','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','cutdigits','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','createRouting','findAndCountAll','finally','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','then','get','InboundRoutes','inbound'];(function(_0x49632b,_0x5b0c49){var _0x214a68=function(_0x29f04d){while(--_0x29f04d){_0x49632b['push'](_0x49632b['shift']());}};_0x214a68(++_0x5b0c49);}(_0x7db8,0x1a3));var _0x87db=function(_0x1f5475,_0x3d142e){_0x1f5475=_0x1f5475-0x0;var _0x55aa32=_0x7db8[_0x1f5475];return _0x55aa32;};'use strict';var _=require('lodash');var Redis=require(_0x87db('0x0'));var qs=require(_0x87db('0x1'));var logger=require(_0x87db('0x2'))(_0x87db('0x3'));var config=require(_0x87db('0x4'));var db=require(_0x87db('0x5'))['db'];config[_0x87db('0x6')]=_[_0x87db('0x7')](config[_0x87db('0x6')],{'host':_0x87db('0x8'),'port':0x18eb});var socket=require(_0x87db('0x9'))(new Redis(config[_0x87db('0x6')]));require(_0x87db('0xa'))[_0x87db('0xb')](socket);function respondWithStatusCode(_0x328bbb,_0x18bd37){_0x18bd37=_0x18bd37||0xcc;return function(_0xe180de){if(_0xe180de){return _0x328bbb[_0x87db('0xc')](_0x18bd37);}return _0x328bbb[_0x87db('0xd')](_0x18bd37)[_0x87db('0xe')]();};}function respondWithResult(_0x3ff583,_0x48a8f2){_0x48a8f2=_0x48a8f2||0xc8;return function(_0x5e8255){if(_0x5e8255){return _0x3ff583['status'](_0x48a8f2)[_0x87db('0xf')](_0x5e8255);}};}function respondWithFilteredResult(_0x180581,_0x24c6af){return function(_0x748751){if(_0x748751){var _0x518452=typeof _0x24c6af[_0x87db('0x10')]==='undefined'&&typeof _0x24c6af[_0x87db('0x11')]===_0x87db('0x12');var _0xfdce8f=_0x748751[_0x87db('0x13')];var _0x5cd52f=_0x518452?0x0:_0x24c6af[_0x87db('0x10')];var _0x2f058b=_0x518452?_0x748751[_0x87db('0x13')]:_0x24c6af[_0x87db('0x10')]+_0x24c6af[_0x87db('0x11')];var _0x3f6230;if(_0x2f058b>=_0xfdce8f){_0x2f058b=_0xfdce8f;_0x3f6230=0xc8;}else{_0x3f6230=0xce;}_0x180581[_0x87db('0xd')](_0x3f6230);return _0x180581[_0x87db('0x14')](_0x87db('0x15'),_0x5cd52f+'-'+_0x2f058b+'/'+_0xfdce8f)[_0x87db('0xf')](_0x748751);}return null;};}function removeEntity(_0x4c31a7){return function(_0x3c69f1){if(_0x3c69f1){return _0x3c69f1['destroy']()[_0x87db('0x16')](function(){var _0x450ddf=_0x3c69f1[_0x87db('0x17')]({'plain':!![]});var _0x1cbeb5=[{'name':_0x87db('0x18'),'value':_0x87db('0x19'),'ignore':![]},{'name':'OutboundRoutes','value':_0x87db('0x1a'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x4b7ddd=_(_0x1cbeb5)[_0x87db('0x1b')](_0x87db('0x1c'))['map'](_0x87db('0x1d'))[_0x87db('0x1d')]();if(_[_0x87db('0x1e')](_0x4b7ddd,_0x450ddf[_0x87db('0x1f')])){return;}var _0x54b72c=_['find'](_0x1cbeb5,[_0x87db('0x1d'),_0x450ddf['type']])[_0x87db('0x20')];return db[_0x87db('0x21')][_0x87db('0x22')]({'where':{'type':_0x54b72c,'resourceId':_0x450ddf['id']}})[_0x87db('0x16')](function(){return _0x3c69f1;});})[_0x87db('0x16')](function(){_0x4c31a7[_0x87db('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x392073){return function(_0x29ffb2){if(!_0x29ffb2){_0x392073['sendStatus'](0x194);}return _0x29ffb2;};}function handleError(_0x1b627d,_0x3c6d93){_0x3c6d93=_0x3c6d93||0x1f4;return function(_0x236d29){logger[_0x87db('0x23')](_0x236d29[_0x87db('0x24')]);if(_0x236d29[_0x87db('0x20')]){delete _0x236d29[_0x87db('0x20')];}_0x1b627d['status'](_0x3c6d93)['send'](_0x236d29);};}exports[_0x87db('0x25')]=function(_0x46a992,_0x22dc8a){var _0x40b449={},_0x4a72f4={},_0xdffef8={'count':0x0,'rows':[]};var _0x4c4624=_['map'](db[_0x87db('0x26')][_0x87db('0x27')],function(_0x826842){return{'name':_0x826842['fieldName'],'type':_0x826842['type']['key']};});_0x4a72f4[_0x87db('0x28')]=_[_0x87db('0x29')](_0x4c4624,_0x87db('0x20'));_0x4a72f4['query']=_[_0x87db('0x2a')](_0x46a992[_0x87db('0x2b')]);_0x4a72f4['filters']=_[_0x87db('0x2c')](_0x4a72f4['model'],_0x4a72f4[_0x87db('0x2b')]);_0x40b449[_0x87db('0x2d')]=_[_0x87db('0x2c')](_0x4a72f4[_0x87db('0x28')],qs[_0x87db('0x2e')](_0x46a992[_0x87db('0x2b')][_0x87db('0x2e')]));_0x40b449['attributes']=_0x40b449[_0x87db('0x2d')][_0x87db('0x2f')]?_0x40b449[_0x87db('0x2d')]:_0x4a72f4[_0x87db('0x28')];if(!_0x46a992[_0x87db('0x2b')][_0x87db('0x30')](_0x87db('0x31'))){_0x40b449[_0x87db('0x11')]=qs[_0x87db('0x11')](_0x46a992[_0x87db('0x2b')][_0x87db('0x11')]);_0x40b449[_0x87db('0x10')]=qs[_0x87db('0x10')](_0x46a992[_0x87db('0x2b')][_0x87db('0x10')]);}_0x40b449['order']=qs[_0x87db('0x32')](_0x46a992['query'][_0x87db('0x32')]);_0x40b449[_0x87db('0x33')]=qs[_0x87db('0x34')](_[_0x87db('0x35')](_0x46a992[_0x87db('0x2b')],_0x4a72f4['filters']),_0x4c4624);if(_0x46a992[_0x87db('0x2b')][_0x87db('0x1b')]){_0x40b449[_0x87db('0x33')]=_[_0x87db('0x36')](_0x40b449['where'],{'$or':_[_0x87db('0x29')](_0x4c4624,function(_0x4534b0){if(_0x4534b0[_0x87db('0x1f')]!==_0x87db('0x37')){var _0x1506bc={};_0x1506bc[_0x4534b0[_0x87db('0x20')]]={'$like':'%'+_0x46a992[_0x87db('0x2b')][_0x87db('0x1b')]+'%'};return _0x1506bc;}})});}_0x40b449=_[_0x87db('0x36')]({},_0x40b449,_0x46a992['options']);var _0x5d6ca3={'where':_0x40b449[_0x87db('0x33')]};return db[_0x87db('0x26')][_0x87db('0x13')](_0x5d6ca3)[_0x87db('0x16')](function(_0xfaf9ce){_0xdffef8[_0x87db('0x13')]=_0xfaf9ce;if(_0x46a992[_0x87db('0x2b')]['includeAll']){_0x40b449[_0x87db('0x38')]=[{'all':!![]}];}return db[_0x87db('0x26')][_0x87db('0x39')](_0x40b449);})['then'](function(_0x4c3c53){_0xdffef8['rows']=_0x4c3c53;return _0xdffef8;})[_0x87db('0x16')](respondWithFilteredResult(_0x22dc8a,_0x40b449))[_0x87db('0x3a')](handleError(_0x22dc8a,null));};exports[_0x87db('0x3b')]=function(_0x562602,_0x37494e){var _0x2d2565={'raw':![],'where':{'id':_0x562602['params']['id']}},_0x2e55bd={};_0x2e55bd[_0x87db('0x28')]=_['keys'](db[_0x87db('0x26')][_0x87db('0x27')]);_0x2e55bd[_0x87db('0x2b')]=_[_0x87db('0x2a')](_0x562602['query']);_0x2e55bd['filters']=_[_0x87db('0x2c')](_0x2e55bd[_0x87db('0x28')],_0x2e55bd[_0x87db('0x2b')]);_0x2d2565[_0x87db('0x2d')]=_['intersection'](_0x2e55bd[_0x87db('0x28')],qs['fields'](_0x562602['query'][_0x87db('0x2e')]));_0x2d2565[_0x87db('0x2d')]=_0x2d2565[_0x87db('0x2d')][_0x87db('0x2f')]?_0x2d2565['attributes']:_0x2e55bd[_0x87db('0x28')];if(_0x562602[_0x87db('0x2b')][_0x87db('0x3c')]){_0x2d2565[_0x87db('0x38')]=[{'all':!![]}];}_0x2d2565=_[_0x87db('0x36')]({},_0x2d2565,_0x562602[_0x87db('0x3d')]);return db[_0x87db('0x26')]['find'](_0x2d2565)[_0x87db('0x16')](handleEntityNotFound(_0x37494e,null))[_0x87db('0x16')](respondWithResult(_0x37494e,null))[_0x87db('0x3a')](handleError(_0x37494e,null));};exports[_0x87db('0x22')]=function(_0x3311c4,_0x3fad71){return db[_0x87db('0x26')]['find']({'where':{'id':_0x3311c4[_0x87db('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3fad71,null))[_0x87db('0x16')](removeEntity(_0x3fad71,null))['catch'](handleError(_0x3fad71,null));};exports['create']=function(_0x300087,_0x362e41){if(_0x300087[_0x87db('0x3f')][_0x87db('0x1f')]===_0x87db('0x1a')&&!_[_0x87db('0x40')](_0x300087[_0x87db('0x3f')][_0x87db('0x41')],'_')){_0x300087['body'][_0x87db('0x41')]='_'[_0x87db('0x42')](_0x300087['body'][_0x87db('0x41')]);}return db[_0x87db('0x26')][_0x87db('0x43')](_0x300087[_0x87db('0x3f')],{'raw':![]})[_0x87db('0x16')](function(_0x2090db){var _0x46c1cc=_0x300087[_0x87db('0x44')]['get']({'plain':!![]});if(!_0x46c1cc)throw new Error(_0x87db('0x45'));if(_0x46c1cc[_0x87db('0x46')]===_0x87db('0x44')){var _0x1cb744=_0x2090db[_0x87db('0x17')]({'plain':!![]});var _0x33b186=[{'name':_0x87db('0x18'),'value':'inbound'},{'name':_0x87db('0x47'),'value':_0x87db('0x1a')},{'name':'InternalRoutes','value':_0x87db('0x48')}];var _0x3ff0d3=_[_0x87db('0x49')](_0x33b186,[_0x87db('0x1d'),_0x1cb744[_0x87db('0x1f')]])['name'];return db['UserProfileSection'][_0x87db('0x49')]({'where':{'name':_0x3ff0d3,'userProfileId':_0x46c1cc[_0x87db('0x4a')]},'raw':!![]})['then'](function(_0x47488e){if(_0x47488e&&_0x47488e[_0x87db('0x4b')]===0x0){return db['UserProfileResource'][_0x87db('0x43')]({'name':_0x1cb744[_0x87db('0x20')],'resourceId':_0x1cb744['id'],'type':_0x47488e['name'],'sectionId':_0x47488e['id']},{})[_0x87db('0x16')](function(){return _0x2090db;});}else{return _0x2090db;}})[_0x87db('0x3a')](function(_0x488bc5){logger[_0x87db('0x23')](_0x87db('0x4c'),_0x488bc5);throw _0x488bc5;});}return _0x2090db;})[_0x87db('0x16')](respondWithResult(_0x362e41,0xc9))['catch'](handleError(_0x362e41,null));};exports['update']=function(_0x4a572f,_0x540467){if(_0x4a572f[_0x87db('0x3f')]['id']){delete _0x4a572f[_0x87db('0x3f')]['id'];}return db['VoiceExtension'][_0x87db('0x49')]({'where':{'id':_0x4a572f['params']['id']}})[_0x87db('0x16')](handleEntityNotFound(_0x540467,null))[_0x87db('0x16')](function(_0x40518e){if(_0x40518e){return db['VoiceExtension'][_0x87db('0x4d')](_['pick'](_0x4a572f['body'],['exten',_0x87db('0x4e'),'description','recordingFormat',_0x87db('0x4f'),'mandatoryDisposition','alias']),{'where':{'context':_0x40518e[_0x87db('0x4e')],'exten':_0x40518e[_0x87db('0x41')]},'individualHooks':!![]})[_0x87db('0x16')](function(_0x35173d){return _0x35173d;});}return null;})[_0x87db('0x16')](respondWithStatusCode(_0x540467,null))['catch'](handleError(_0x540467,null));};exports[_0x87db('0x50')]=function(_0x33dd9d,_0x487c2b){var _0x237879=_0x33dd9d[_0x87db('0x3e')]['id'];var _0x1deac2=_0x33dd9d[_0x87db('0x3f')];var _0x347576=0xc8;var _0x18ec79=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x87db('0x51')][_0x87db('0x52')][_0x87db('0x53')][_0x87db('0x54')]},function(_0x283050){return db[_0x87db('0x26')][_0x87db('0x55')]({'where':{'id':_0x237879},'transaction':_0x283050})[_0x87db('0x16')](function(_0x50f3b5){if(_0x50f3b5){return db[_0x87db('0x26')][_0x87db('0x22')]({'where':{'VoiceExtensionId':_0x237879},'transaction':_0x283050})[_0x87db('0x16')](function(){var _0xe5536a=_[_0x87db('0x29')](_0x1deac2,function(_0x2a06cf){_0x2a06cf['VoiceExtensionId']=_0x237879;_0x2a06cf['isApp']=!![];return _0x2a06cf;});return _0x50f3b5[_0x87db('0x56')](_0xe5536a);})[_0x87db('0x16')](function(_0x235121){return db[_0x87db('0x26')]['bulkCreate'](_0x235121,{'transaction':_0x283050});});}else{_0x347576=0x194;_0x18ec79=[];}});})['then'](function(){if(_0x347576!==0x194){return db['VoiceExtension'][_0x87db('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x237879},'order':'cast(priority\x20as\x20unsigned)'})['then'](function(_0x38ca68){_0x18ec79=_0x38ca68;});}})[_0x87db('0x3a')](function(_0x1f1dbe){_0x347576=0x1f4;logger['error'](_0x1f1dbe[_0x87db('0x24')]);if(_0x1f1dbe[_0x87db('0x20')]){delete _0x1f1dbe[_0x87db('0x20')];}_0x18ec79=_0x1f1dbe;})[_0x87db('0x58')](function(){if(_0x18ec79===null){_0x487c2b[_0x87db('0xc')](_0x347576);}else{if(_0x347576===0x1f4){_0x487c2b[_0x87db('0xd')](_0x347576)['send'](_0x18ec79);}else{_0x487c2b['status'](_0x347576)['json'](_0x18ec79);}}});}; \ No newline at end of file +var _0x9946=['pick','merge','VIRTUAL','filter','includeAll','include','VoiceExtension','findAll','catch','show','length','find','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','OutboundRoutes','UserProfileSection','autoAssociation','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','bulkCreate','finally','sendStatus','lodash','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status','end','undefined','limit','count','offset','set','json','destroy','then','get','InboundRoutes','outbound','InternalRoutes','internal','ignore','value','includes','type','UserProfileResource','error','stack','name','send','index','fieldName','key','map','keys','query','intersection','fields','attributes','model','nolimit','order','sort','where','filters'];(function(_0x8c9741,_0x1362c8){var _0x580e3e=function(_0x31ee83){while(--_0x31ee83){_0x8c9741['push'](_0x8c9741['shift']());}};_0x580e3e(++_0x1362c8);}(_0x9946,0xda));var _0x6994=function(_0x22c054,_0x30514c){_0x22c054=_0x22c054-0x0;var _0x2a5ed6=_0x9946[_0x22c054];return _0x2a5ed6;};'use strict';var _=require(_0x6994('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x6994('0x1'))(_0x6994('0x2'));var config=require('../../config/environment');var db=require(_0x6994('0x3'))['db'];config[_0x6994('0x4')]=_[_0x6994('0x5')](config['redis'],{'host':_0x6994('0x6'),'port':0x18eb});var socket=require(_0x6994('0x7'))(new Redis(config['redis']));require(_0x6994('0x8'))[_0x6994('0x9')](socket);function respondWithStatusCode(_0x4b1a8a,_0x153a55){_0x153a55=_0x153a55||0xcc;return function(_0x1dddc9){if(_0x1dddc9){return _0x4b1a8a['sendStatus'](_0x153a55);}return _0x4b1a8a[_0x6994('0xa')](_0x153a55)[_0x6994('0xb')]();};}function respondWithResult(_0x55e86d,_0xf35192){_0xf35192=_0xf35192||0xc8;return function(_0x450033){if(_0x450033){return _0x55e86d[_0x6994('0xa')](_0xf35192)['json'](_0x450033);}};}function respondWithFilteredResult(_0x4f63e2,_0x1c8108){return function(_0x1c0ed){if(_0x1c0ed){var _0x2c3985=typeof _0x1c8108['offset']===_0x6994('0xc')&&typeof _0x1c8108[_0x6994('0xd')]===_0x6994('0xc');var _0x291a44=_0x1c0ed[_0x6994('0xe')];var _0xa318c=_0x2c3985?0x0:_0x1c8108[_0x6994('0xf')];var _0x302c6b=_0x2c3985?_0x1c0ed['count']:_0x1c8108[_0x6994('0xf')]+_0x1c8108[_0x6994('0xd')];var _0x417fe2;if(_0x302c6b>=_0x291a44){_0x302c6b=_0x291a44;_0x417fe2=0xc8;}else{_0x417fe2=0xce;}_0x4f63e2[_0x6994('0xa')](_0x417fe2);return _0x4f63e2[_0x6994('0x10')]('Content-Range',_0xa318c+'-'+_0x302c6b+'/'+_0x291a44)[_0x6994('0x11')](_0x1c0ed);}return null;};}function removeEntity(_0x1c361f){return function(_0xfd054d){if(_0xfd054d){return _0xfd054d[_0x6994('0x12')]()[_0x6994('0x13')](function(){var _0x160143=_0xfd054d[_0x6994('0x14')]({'plain':!![]});var _0xbcf415=[{'name':_0x6994('0x15'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x6994('0x16'),'ignore':![]},{'name':_0x6994('0x17'),'value':_0x6994('0x18'),'ignore':![]}];var _0x62a52=_(_0xbcf415)['filter'](_0x6994('0x19'))['map'](_0x6994('0x1a'))['value']();if(_[_0x6994('0x1b')](_0x62a52,_0x160143[_0x6994('0x1c')])){return;}var _0x31e1e1=_['find'](_0xbcf415,['value',_0x160143[_0x6994('0x1c')]])['name'];return db[_0x6994('0x1d')][_0x6994('0x12')]({'where':{'type':_0x31e1e1,'resourceId':_0x160143['id']}})[_0x6994('0x13')](function(){return _0xfd054d;});})['then'](function(){_0x1c361f[_0x6994('0xa')](0xcc)[_0x6994('0xb')]();});}};}function handleEntityNotFound(_0x35b1ba){return function(_0x223243){if(!_0x223243){_0x35b1ba['sendStatus'](0x194);}return _0x223243;};}function handleError(_0x2e2bcd,_0x57cfba){_0x57cfba=_0x57cfba||0x1f4;return function(_0x3754b9){logger[_0x6994('0x1e')](_0x3754b9[_0x6994('0x1f')]);if(_0x3754b9[_0x6994('0x20')]){delete _0x3754b9['name'];}_0x2e2bcd[_0x6994('0xa')](_0x57cfba)[_0x6994('0x21')](_0x3754b9);};}exports[_0x6994('0x22')]=function(_0x502c96,_0x19b531){var _0x4e0329={},_0x393d9b={},_0xf1e9b8={'count':0x0,'rows':[]};var _0x7190d2=_['map'](db['VoiceExtension']['rawAttributes'],function(_0x31db7c){return{'name':_0x31db7c[_0x6994('0x23')],'type':_0x31db7c[_0x6994('0x1c')][_0x6994('0x24')]};});_0x393d9b['model']=_[_0x6994('0x25')](_0x7190d2,_0x6994('0x20'));_0x393d9b['query']=_[_0x6994('0x26')](_0x502c96[_0x6994('0x27')]);_0x393d9b['filters']=_[_0x6994('0x28')](_0x393d9b['model'],_0x393d9b[_0x6994('0x27')]);_0x4e0329['attributes']=_[_0x6994('0x28')](_0x393d9b['model'],qs[_0x6994('0x29')](_0x502c96['query']['fields']));_0x4e0329[_0x6994('0x2a')]=_0x4e0329[_0x6994('0x2a')]['length']?_0x4e0329[_0x6994('0x2a')]:_0x393d9b[_0x6994('0x2b')];if(!_0x502c96[_0x6994('0x27')]['hasOwnProperty'](_0x6994('0x2c'))){_0x4e0329[_0x6994('0xd')]=qs['limit'](_0x502c96[_0x6994('0x27')][_0x6994('0xd')]);_0x4e0329[_0x6994('0xf')]=qs[_0x6994('0xf')](_0x502c96[_0x6994('0x27')][_0x6994('0xf')]);}_0x4e0329[_0x6994('0x2d')]=qs[_0x6994('0x2e')](_0x502c96['query'][_0x6994('0x2e')]);_0x4e0329[_0x6994('0x2f')]=qs[_0x6994('0x30')](_[_0x6994('0x31')](_0x502c96[_0x6994('0x27')],_0x393d9b[_0x6994('0x30')]),_0x7190d2);if(_0x502c96['query']['filter']){_0x4e0329[_0x6994('0x2f')]=_[_0x6994('0x32')](_0x4e0329[_0x6994('0x2f')],{'$or':_[_0x6994('0x25')](_0x7190d2,function(_0x2e919){if(_0x2e919['type']!==_0x6994('0x33')){var _0x18ae22={};_0x18ae22[_0x2e919[_0x6994('0x20')]]={'$like':'%'+_0x502c96[_0x6994('0x27')][_0x6994('0x34')]+'%'};return _0x18ae22;}})});}_0x4e0329=_[_0x6994('0x32')]({},_0x4e0329,_0x502c96['options']);var _0x54d26d={'where':_0x4e0329[_0x6994('0x2f')]};return db['VoiceExtension'][_0x6994('0xe')](_0x54d26d)[_0x6994('0x13')](function(_0x3a84bb){_0xf1e9b8[_0x6994('0xe')]=_0x3a84bb;if(_0x502c96[_0x6994('0x27')][_0x6994('0x35')]){_0x4e0329[_0x6994('0x36')]=[{'all':!![]}];}return db[_0x6994('0x37')][_0x6994('0x38')](_0x4e0329);})[_0x6994('0x13')](function(_0x5303a5){_0xf1e9b8['rows']=_0x5303a5;return _0xf1e9b8;})[_0x6994('0x13')](respondWithFilteredResult(_0x19b531,_0x4e0329))[_0x6994('0x39')](handleError(_0x19b531,null));};exports[_0x6994('0x3a')]=function(_0x190d85,_0x2dfa61){var _0x336275={'raw':![],'where':{'id':_0x190d85['params']['id']}},_0x11e651={};_0x11e651[_0x6994('0x2b')]=_[_0x6994('0x26')](db[_0x6994('0x37')]['rawAttributes']);_0x11e651[_0x6994('0x27')]=_[_0x6994('0x26')](_0x190d85[_0x6994('0x27')]);_0x11e651[_0x6994('0x30')]=_[_0x6994('0x28')](_0x11e651[_0x6994('0x2b')],_0x11e651[_0x6994('0x27')]);_0x336275['attributes']=_['intersection'](_0x11e651[_0x6994('0x2b')],qs[_0x6994('0x29')](_0x190d85[_0x6994('0x27')][_0x6994('0x29')]));_0x336275[_0x6994('0x2a')]=_0x336275[_0x6994('0x2a')][_0x6994('0x3b')]?_0x336275[_0x6994('0x2a')]:_0x11e651[_0x6994('0x2b')];if(_0x190d85[_0x6994('0x27')][_0x6994('0x35')]){_0x336275[_0x6994('0x36')]=[{'all':!![]}];}_0x336275=_[_0x6994('0x32')]({},_0x336275,_0x190d85['options']);return db[_0x6994('0x37')][_0x6994('0x3c')](_0x336275)[_0x6994('0x13')](handleEntityNotFound(_0x2dfa61,null))['then'](respondWithResult(_0x2dfa61,null))[_0x6994('0x39')](handleError(_0x2dfa61,null));};exports[_0x6994('0x12')]=function(_0x3da2f8,_0x642713){return db['VoiceExtension'][_0x6994('0x3c')]({'where':{'id':_0x3da2f8['params']['id']}})[_0x6994('0x13')](handleEntityNotFound(_0x642713,null))[_0x6994('0x13')](removeEntity(_0x642713,null))[_0x6994('0x39')](handleError(_0x642713,null));};exports[_0x6994('0x3d')]=function(_0x135ed8,_0x490e66){if(_0x135ed8[_0x6994('0x3e')][_0x6994('0x1c')]===_0x6994('0x16')&&!_[_0x6994('0x3f')](_0x135ed8[_0x6994('0x3e')][_0x6994('0x40')],'_')){_0x135ed8[_0x6994('0x3e')][_0x6994('0x40')]='_'[_0x6994('0x41')](_0x135ed8[_0x6994('0x3e')][_0x6994('0x40')]);}return db[_0x6994('0x37')][_0x6994('0x3d')](_0x135ed8[_0x6994('0x3e')],{'raw':![]})[_0x6994('0x13')](function(_0x2074c4){var _0x5a0bea=_0x135ed8[_0x6994('0x42')][_0x6994('0x14')]({'plain':!![]});if(!_0x5a0bea)throw new Error(_0x6994('0x43'));if(_0x5a0bea[_0x6994('0x44')]==='user'){var _0x4d5c3c=_0x2074c4['get']({'plain':!![]});var _0x49532f=[{'name':_0x6994('0x15'),'value':_0x6994('0x45')},{'name':_0x6994('0x46'),'value':_0x6994('0x16')},{'name':_0x6994('0x17'),'value':_0x6994('0x18')}];var _0x32c680=_['find'](_0x49532f,[_0x6994('0x1a'),_0x4d5c3c['type']])[_0x6994('0x20')];return db[_0x6994('0x47')]['find']({'where':{'name':_0x32c680,'userProfileId':_0x5a0bea['userProfileId']},'raw':!![]})[_0x6994('0x13')](function(_0x49027f){if(_0x49027f&&_0x49027f[_0x6994('0x48')]===0x0){return db[_0x6994('0x1d')][_0x6994('0x3d')]({'name':_0x4d5c3c[_0x6994('0x20')],'resourceId':_0x4d5c3c['id'],'type':_0x49027f[_0x6994('0x20')],'sectionId':_0x49027f['id']},{})[_0x6994('0x13')](function(){return _0x2074c4;});}else{return _0x2074c4;}})[_0x6994('0x39')](function(_0x350495){logger[_0x6994('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x350495);throw _0x350495;});}return _0x2074c4;})[_0x6994('0x13')](respondWithResult(_0x490e66,0xc9))[_0x6994('0x39')](handleError(_0x490e66,null));};exports[_0x6994('0x49')]=function(_0x606bde,_0x18f02b){if(_0x606bde[_0x6994('0x3e')]['id']){delete _0x606bde[_0x6994('0x3e')]['id'];}return db[_0x6994('0x37')]['find']({'where':{'id':_0x606bde['params']['id']}})[_0x6994('0x13')](handleEntityNotFound(_0x18f02b,null))[_0x6994('0x13')](function(_0x99399d){if(_0x99399d){return db[_0x6994('0x37')][_0x6994('0x49')](_[_0x6994('0x31')](_0x606bde['body'],[_0x6994('0x40'),_0x6994('0x4a'),_0x6994('0x4b'),_0x6994('0x4c'),_0x6994('0x4d'),_0x6994('0x4e'),_0x6994('0x4f')]),{'where':{'context':_0x99399d[_0x6994('0x4a')],'exten':_0x99399d[_0x6994('0x40')]},'individualHooks':!![]})[_0x6994('0x13')](function(_0x101d41){return _0x101d41;});}return null;})[_0x6994('0x13')](respondWithStatusCode(_0x18f02b,null))[_0x6994('0x39')](handleError(_0x18f02b,null));};exports[_0x6994('0x50')]=function(_0xc3b627,_0x2ecc36){var _0x3eefc5=_0xc3b627['params']['id'];var _0x4aae65=_0xc3b627[_0x6994('0x3e')];var _0x208328=0xc8;var _0x320a76=null;return db[_0x6994('0x51')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0x6994('0x52')][_0x6994('0x53')]},function(_0x2eac98){return db['VoiceExtension'][_0x6994('0x54')]({'where':{'id':_0x3eefc5},'transaction':_0x2eac98})[_0x6994('0x13')](function(_0x7923c9){if(_0x7923c9){return db[_0x6994('0x37')]['destroy']({'where':{'VoiceExtensionId':_0x3eefc5},'transaction':_0x2eac98})[_0x6994('0x13')](function(){var _0x15187f=_[_0x6994('0x25')](_0x4aae65,function(_0x1f7d9b){_0x1f7d9b['VoiceExtensionId']=_0x3eefc5;_0x1f7d9b[_0x6994('0x55')]=!![];return _0x1f7d9b;});return _0x7923c9['createRouting'](_0x15187f);})[_0x6994('0x13')](function(_0x6df84c){return db[_0x6994('0x37')][_0x6994('0x56')](_0x6df84c,{'transaction':_0x2eac98});});}else{_0x208328=0x194;_0x320a76=[];}});})['then'](function(){if(_0x208328!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x3eefc5},'order':'cast(priority\x20as\x20unsigned)'})[_0x6994('0x13')](function(_0x43a722){_0x320a76=_0x43a722;});}})['catch'](function(_0x38ac5f){_0x208328=0x1f4;logger[_0x6994('0x1e')](_0x38ac5f[_0x6994('0x1f')]);if(_0x38ac5f[_0x6994('0x20')]){delete _0x38ac5f[_0x6994('0x20')];}_0x320a76=_0x38ac5f;})[_0x6994('0x57')](function(){if(_0x320a76===null){_0x2ecc36[_0x6994('0x58')](_0x208328);}else{if(_0x208328===0x1f4){_0x2ecc36[_0x6994('0xa')](_0x208328)['send'](_0x320a76);}else{_0x2ecc36['status'](_0x208328)[_0x6994('0x11')](_0x320a76);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 15cc79a..75abaef 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 _0xea3d=['exports','events','../../mysqldb','VoiceExtension','save','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea3d,0xd0));var _0xdea3=function(_0x4902bd,_0x3f68c6){_0x4902bd=_0x4902bd-0x0;var _0x38c18f=_0xea3d[_0x4902bd];return _0x38c18f;};'use strict';var EventEmitter=require(_0xdea3('0x0'));var VoiceExtension=require(_0xdea3('0x1'))['db'][_0xdea3('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdea3('0x3'),'afterUpdate':_0xdea3('0x4'),'afterDestroy':_0xdea3('0x5')};function emitEvent(_0x9bacf4){return function(_0x556bfd,_0x8ecd47,_0x34b7a6){VoiceExtensionEvents[_0xdea3('0x6')](_0x9bacf4+':'+_0x556bfd['id'],_0x556bfd);VoiceExtensionEvents['emit'](_0x9bacf4,_0x556bfd);_0x34b7a6(null);};}for(var e in events){if(events[_0xdea3('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xdea3('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xceb7=['events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xceb7,0x1c8));var _0x7ceb=function(_0x10465f,_0x58f754){_0x10465f=_0x10465f-0x0;var _0x57cc4a=_0xceb7[_0x10465f];return _0x57cc4a;};'use strict';var EventEmitter=require(_0x7ceb('0x0'));var VoiceExtension=require(_0x7ceb('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x7ceb('0x2')](0x0);var events={'afterCreate':_0x7ceb('0x3'),'afterUpdate':_0x7ceb('0x4'),'afterDestroy':'remove'};function emitEvent(_0x15af37){return function(_0x5ae3bf,_0x28325e,_0x629765){VoiceExtensionEvents[_0x7ceb('0x5')](_0x15af37+':'+_0x5ae3bf['id'],_0x5ae3bf);VoiceExtensionEvents[_0x7ceb('0x5')](_0x15af37,_0x5ae3bf);_0x629765(null);};}for(var e in events){if(events[_0x7ceb('0x6')](e)){var event=events[e];VoiceExtension[_0x7ceb('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index fedf86f..5ec80c0 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 _0xd053=['inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','split','length','name','phone','prefix','${EXTEN}','param','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','*,*,*,*','intervals','map','filter','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appdata','priority','last','define','VoiceExtension','get','then','concat','lodash','./voiceExtension.attributes','models','Set','CDR(type)=','context','exten','type','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set'];(function(_0x367336,_0x18c229){var _0x3423a7=function(_0xa8fa05){while(--_0xa8fa05){_0x367336['push'](_0x367336['shift']());}};_0x3423a7(++_0x18c229);}(_0xd053,0xe7));var _0x3d05=function(_0x326d35,_0x4f65b3){_0x326d35=_0x326d35-0x0;var _0xd3f8f3=_0xd053[_0x326d35];return _0xd3f8f3;};'use strict';var _=require(_0x3d05('0x0'));var attributes=require(_0x3d05('0x1'));module['exports']=function(_0xee24bb){var _0x35cdb1=_0xee24bb[_0x3d05('0x2')];function _0x55090d(_0x499a42){var _0x45c6cc=0x2;var _0x1fc866=[{'type':_0x499a42['type'],'app':_0x3d05('0x3'),'appdata':_0x3d05('0x4')+_0x499a42['type'],'context':_0x499a42[_0x3d05('0x5')],'exten':_0x499a42[_0x3d05('0x6')],'priority':_0x45c6cc++,'VoiceExtensionId':_0x499a42['id']},{'type':_0x499a42[_0x3d05('0x7')],'app':_0x499a42[_0x3d05('0x8')]?_0x3d05('0x3'):_0x3d05('0x9'),'appdata':_0x499a42[_0x3d05('0x8')]?_0x3d05('0xa')+_0x499a42[_0x3d05('0x8')]:_0x3d05('0xb'),'context':_0x499a42[_0x3d05('0x5')],'exten':_0x499a42['exten'],'priority':_0x45c6cc++,'VoiceExtensionId':_0x499a42['id']}];if(_0x499a42[_0x3d05('0x7')]===_0x3d05('0xc')){_0x1fc866[_0x3d05('0xd')]({'type':_0x3d05('0xc'),'app':_0x3d05('0x3'),'appdata':_0x3d05('0xe')+_0x499a42['id'],'context':_0x499a42[_0x3d05('0x5')],'exten':_0x499a42[_0x3d05('0x6')],'priority':_0x45c6cc++,'VoiceExtensionId':_0x499a42['id']});}_0x1fc866[_0x3d05('0xd')]({'type':_0x499a42['type'],'app':_0x3d05('0x3'),'appdata':_0x3d05('0xf'),'context':_0x499a42[_0x3d05('0x5')],'exten':_0x499a42[_0x3d05('0x6')],'priority':_0x45c6cc++,'VoiceExtensionId':_0x499a42['id']},{'type':_0x499a42['type'],'app':_0x3d05('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x499a42['context'],'exten':_0x499a42[_0x3d05('0x6')],'priority':_0x45c6cc++,'VoiceExtensionId':_0x499a42['id']},{'type':_0x499a42['type'],'app':_0x3d05('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0x499a42['context'],'exten':_0x499a42[_0x3d05('0x6')],'priority':_0x45c6cc++,'VoiceExtensionId':_0x499a42['id']});return _0x1fc866;}function _0x3389e5(_0x28cdd4){var _0x27cea8=0x2;var _0x18ffa0=[{'type':_0x3d05('0x10'),'app':_0x3d05('0x3'),'appdata':_0x3d05('0x11'),'context':_0x28cdd4[_0x3d05('0x5')],'exten':_0x28cdd4[_0x3d05('0x6')],'priority':_0x27cea8++,'VoiceExtensionId':_0x28cdd4['id']},{'type':_0x3d05('0x10'),'app':_0x28cdd4[_0x3d05('0x8')]?'Set':_0x3d05('0x9'),'appdata':_0x28cdd4['alias']?_0x3d05('0xa')+_0x28cdd4[_0x3d05('0x8')]:_0x3d05('0xb'),'context':_0x28cdd4[_0x3d05('0x5')],'exten':_0x28cdd4[_0x3d05('0x6')],'priority':_0x27cea8++,'VoiceExtensionId':_0x28cdd4['id']},{'type':_0x3d05('0x10'),'app':_0x3d05('0x3'),'appdata':_0x3d05('0x12')+(_0x28cdd4[_0x3d05('0x13')]?_0x3d05('0x14')+_0x28cdd4[_0x3d05('0x13')]+'}':'${EXTEN}'),'context':_0x28cdd4[_0x3d05('0x5')],'exten':_0x28cdd4[_0x3d05('0x6')],'priority':_0x27cea8++,'VoiceExtensionId':_0x28cdd4['id']},{'type':_0x3d05('0x10'),'app':_0x3d05('0x3'),'appdata':'CDR(routeid)='+_0x28cdd4['id'],'context':_0x28cdd4['context'],'exten':_0x28cdd4[_0x3d05('0x6')],'priority':_0x27cea8++,'VoiceExtensionId':_0x28cdd4['id']},{'type':_0x3d05('0x10'),'app':_0x3d05('0x15'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x27cea8+0x2)+_0x3d05('0x16')+(_0x27cea8+0x1)+')','context':_0x28cdd4[_0x3d05('0x5')],'exten':_0x28cdd4[_0x3d05('0x6')],'priority':_0x27cea8++,'VoiceExtensionId':_0x28cdd4['id']},{'type':_0x3d05('0x10'),'app':'Set','appdata':_0x28cdd4['cutdigits']?_0x3d05('0x17')+_0x28cdd4[_0x3d05('0x13')]+'}':_0x3d05('0x18'),'context':_0x28cdd4[_0x3d05('0x5')],'exten':_0x28cdd4['exten'],'priority':_0x27cea8++,'VoiceExtensionId':_0x28cdd4['id']},{'type':_0x3d05('0x10'),'app':_0x3d05('0x3'),'appdata':_0x3d05('0xf'),'context':_0x28cdd4['context'],'exten':_0x28cdd4[_0x3d05('0x6')],'priority':_0x27cea8++,'VoiceExtensionId':_0x28cdd4['id']},{'type':_0x3d05('0x10'),'app':_0x3d05('0x3'),'appdata':_0x3d05('0x19'),'context':_0x28cdd4['context'],'exten':_0x28cdd4[_0x3d05('0x6')],'priority':_0x27cea8++,'VoiceExtensionId':_0x28cdd4['id']},{'type':_0x3d05('0x10'),'app':_0x3d05('0x3'),'appdata':_0x3d05('0x1a'),'context':_0x28cdd4[_0x3d05('0x5')],'exten':_0x28cdd4[_0x3d05('0x6')],'priority':_0x27cea8++,'VoiceExtensionId':_0x28cdd4['id']},{'type':_0x3d05('0x10'),'app':_0x3d05('0x3'),'appdata':_0x3d05('0x1b')+_0x28cdd4['id'],'context':_0x28cdd4[_0x3d05('0x5')],'exten':_0x28cdd4[_0x3d05('0x6')],'priority':_0x27cea8++,'VoiceExtensionId':_0x28cdd4['id']}];if(_0x28cdd4[_0x3d05('0x1c')](_0x3d05('0x1d'))&&_0x28cdd4[_0x3d05('0x1d')]!=='none'){_0x18ffa0[_0x3d05('0xd')]({'type':_0x3d05('0x10'),'app':_0x3d05('0x3'),'appdata':_0x3d05('0x1e'),'context':_0x28cdd4[_0x3d05('0x5')],'exten':_0x28cdd4['exten'],'priority':_0x27cea8++,'VoiceExtensionId':_0x28cdd4['id']},{'type':_0x3d05('0x10'),'app':_0x3d05('0x3'),'appdata':_0x3d05('0x1f')+_0x28cdd4[_0x3d05('0x1d')]||_0x3d05('0x20'),'context':_0x28cdd4['context'],'exten':_0x28cdd4[_0x3d05('0x6')],'priority':_0x27cea8++,'VoiceExtensionId':_0x28cdd4['id']});}return _0x18ffa0;}function _0xc4961e(_0x2a4da8,_0x25fe49){var _0x1340d5=[{'name':_0x3d05('0x21'),'param':0x0},{'name':_0x3d05('0x22'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x5db3bb={};var _0x4841b7=_0x25fe49[_0x3d05('0x23')](',');var _0x40e8bf=[];for(var _0x542e41=0x0;_0x542e41<_0x1340d5[_0x3d05('0x24')];_0x542e41++){switch(_0x1340d5[_0x542e41][_0x3d05('0x25')]){case _0x3d05('0x21'):_0x5db3bb[_0x3d05('0x21')]=_0x4841b7[_0x1340d5[_0x542e41]['param']][_0x3d05('0x23')]('/')[0x1];_0x5db3bb[_0x3d05('0x26')]=_0x4841b7[_0x1340d5[_0x542e41]['param']]['split']('/')[0x2];_0x5db3bb['prefix']=_0x5db3bb['phone']?_0x5db3bb[_0x3d05('0x26')][_0x3d05('0x23')]('$')[0x0]:undefined;_0x5db3bb[_0x3d05('0x26')]=_0x2a4da8[_0x3d05('0x13')]?(_0x5db3bb[_0x3d05('0x27')]||'')+_0x3d05('0x14')+_0x2a4da8[_0x3d05('0x13')]+'}':(_0x5db3bb[_0x3d05('0x27')]||'')+_0x3d05('0x28');_0x40e8bf[_0x1340d5[_0x542e41][_0x3d05('0x29')]]=['SIP',_0x5db3bb[_0x3d05('0x21')],_0x5db3bb[_0x3d05('0x26')]][_0x3d05('0x2a')]('/');break;case'options':_0x5db3bb[_0x3d05('0x2b')]=_0x4841b7[_0x1340d5[_0x542e41][_0x3d05('0x29')]];if(_0x2a4da8['recordingFormat']!=='none'){if(_0x5db3bb[_0x3d05('0x2b')][_0x3d05('0x2c')](_0x3d05('0x2d'))<0x0){_0x5db3bb[_0x3d05('0x2b')]+=_0x3d05('0x2d');}}else{_0x5db3bb[_0x3d05('0x2b')]=_0x5db3bb[_0x3d05('0x2b')][_0x3d05('0x2e')]('U(xcally-mixmonitor-context)','');}_0x40e8bf[_0x1340d5[_0x542e41]['param']]=_0x5db3bb[_0x3d05('0x2b')];break;default:_0x40e8bf[_0x1340d5[_0x542e41][_0x3d05('0x29')]]=_0x4841b7[_0x1340d5[_0x542e41]['param']];}}return _0x40e8bf['join'](',');}function _0x4c850d(_0x3745e6,_0x3e787e,_0x1f4b19){return new Promise(function(_0xa7efa7,_0x19d4f8){var _0x53324c=[];if(_[_0x3d05('0x2f')](_0x3e787e))return _0xa7efa7(_0x53324c);_0x35cdb1['Interval'][_0x3d05('0x30')]({'attributes':['id',_0x3d05('0x31'),_0x3d05('0x32')],'raw':!![]})['then'](function(_0x354b96){for(var _0x592ab9=0x0,_0x1d90fc=0x0;_0x592ab9<_0x3e787e['length'];_0x592ab9++,_0x1d90fc=0x0){var _0x5855f5=_0x3e787e[_0x592ab9];var _0x553ef3=[];var _0x1a9113=[];delete _0x5855f5['id'];if(_0x5855f5[_0x3d05('0x31')]!==_0x3d05('0x33')){_0x5855f5[_0x3d05('0x34')]=[_0x5855f5['interval']];}else{_0x5855f5[_0x3d05('0x34')]=_0x5855f5[_0x3d05('0x32')]?_[_0x3d05('0x35')](_[_0x3d05('0x36')](_0x354b96,{'IntervalId':_0x5855f5[_0x3d05('0x32')]}),'interval'):[];}_0x5855f5[_0x3d05('0x5')]=_0x3745e6[_0x3d05('0x5')];_0x5855f5[_0x3d05('0x6')]=_0x3745e6['exten'];if(_0x5855f5[_0x3d05('0x7')])_0x5855f5[_0x3d05('0x7')]=_0x5855f5[_0x3d05('0x7')]['toLowerCase']();if(_0x3745e6[_0x3d05('0x7')]==='outbound'){if(_0x5855f5[_0x3d05('0x1c')](_0x3d05('0x37'))&&_0x5855f5['tag']&&_0x5855f5[_0x3d05('0x37')]!=='--'){_0x553ef3[_0x3d05('0xd')]({'type':_0x5855f5[_0x3d05('0x7')][_0x3d05('0x38')](),'app':_0x3d05('0x3'),'appdata':_0x3d05('0x39')+_0x5855f5[_0x3d05('0x37')],'context':_0x3745e6[_0x3d05('0x5')],'exten':_0x3745e6[_0x3d05('0x6')],'priority':_0x5855f5['intervals'][_0x3d05('0x24')]+_0x1f4b19+_0x1d90fc++,'VoiceExtensionId':_0x3745e6['id']});}_0x553ef3[_0x3d05('0xd')]({'type':_0x5855f5[_0x3d05('0x7')][_0x3d05('0x38')](),'app':_0x3d05('0x15'),'appdata':_0x3d05('0x3a')+(_0x5855f5['callerID']?_0x3d05('0x3b')+_0x5855f5[_0x3d05('0x3c')]+')':_0x3d05('0x3d')),'context':_0x3745e6[_0x3d05('0x5')],'exten':_0x3745e6[_0x3d05('0x6')],'priority':_0x5855f5[_0x3d05('0x34')][_0x3d05('0x24')]+_0x1f4b19+_0x1d90fc++,'VoiceExtensionId':_0x3745e6['id']});}else{if(_0x5855f5[_0x3d05('0x1c')](_0x3d05('0x3e'))){if([_0x3d05('0x3f'),_0x3d05('0x40')]['includes'](_0x5855f5['app'][_0x3d05('0x38')]())&&_0x5855f5[_0x3d05('0x41')]!==_0x3d05('0x42')){if(_0x5855f5['answer']){_0x553ef3[_0x3d05('0xd')]({'type':_0x5855f5['type'][_0x3d05('0x38')](),'app':'ExecIf','appdata':_0x3d05('0x43'),'context':_0x3745e6[_0x3d05('0x5')],'exten':_0x3745e6[_0x3d05('0x6')],'priority':_0x5855f5['intervals']['length']+_0x1f4b19+_0x1d90fc++,'VoiceExtensionId':_0x3745e6['id']});_0x553ef3[_0x3d05('0xd')]({'type':_0x5855f5['type'][_0x3d05('0x38')](),'app':_0x3d05('0x3'),'appdata':_0x3d05('0x44'),'context':_0x3745e6['context'],'exten':_0x3745e6[_0x3d05('0x6')],'priority':_0x5855f5[_0x3d05('0x34')][_0x3d05('0x24')]+_0x1f4b19+_0x1d90fc++,'VoiceExtensionId':_0x3745e6['id']});}else{_0x553ef3[_0x3d05('0xd')]({'type':_0x5855f5[_0x3d05('0x7')][_0x3d05('0x38')](),'app':_0x3d05('0x15'),'appdata':_0x3d05('0x45'),'context':_0x3745e6[_0x3d05('0x5')],'exten':_0x3745e6['exten'],'priority':_0x5855f5['intervals']['length']+_0x1f4b19+_0x1d90fc++,'VoiceExtensionId':_0x3745e6['id']});_0x553ef3[_0x3d05('0xd')]({'type':_0x5855f5[_0x3d05('0x7')][_0x3d05('0x38')](),'app':_0x3d05('0x3'),'appdata':_0x3d05('0x46'),'context':_0x3745e6[_0x3d05('0x5')],'exten':_0x3745e6[_0x3d05('0x6')],'priority':_0x5855f5['intervals'][_0x3d05('0x24')]+_0x1f4b19+_0x1d90fc++,'VoiceExtensionId':_0x3745e6['id']});}}}}for(var _0x543158=0x0;_0x543158<_0x5855f5[_0x3d05('0x34')]['length'];_0x543158++){var _0x3a18fb=_0x1f4b19+_0x5855f5[_0x3d05('0x34')][_0x3d05('0x24')];var _0x50c06b=_0x543158===_0x5855f5[_0x3d05('0x34')][_0x3d05('0x24')]-0x1?_0x1f4b19+_0x553ef3[_0x3d05('0x24')]+_0x1a9113[_0x3d05('0x24')]+0x2:_0x1f4b19+_0x543158+0x1;_0x553ef3[_0x3d05('0x47')](_0x543158,0x0,{'type':_0x3745e6['type'],'app':'GotoIfTime','appdata':_0x5855f5[_0x3d05('0x34')][_0x543158]+'?'+_0x3745e6['context']+_0x3d05('0x48')+_0x3a18fb+':'+_0x3745e6['context']+',${EXTEN},'+_0x50c06b,'exten':_0x3745e6[_0x3d05('0x6')],'context':_0x3745e6[_0x3d05('0x5')],'priority':_0x1f4b19+_0x543158,'VoiceExtensionId':_0x3745e6['id']});}if(_0x5855f5[_0x3d05('0x41')]==='outboundDial')_0x5855f5[_0x3d05('0x49')]=_0xc4961e(_0x3745e6,_0x5855f5['appdata']);_0x5855f5[_0x3d05('0x4a')]=_0x553ef3[_0x3d05('0x24')]?_[_0x3d05('0x4b')](_0x553ef3)['priority']+0x1:_0x1f4b19;_0x53324c=_['concat'](_0x53324c,_0x553ef3,[_0x5855f5],_0x1a9113);_0x1f4b19=_['last'](_0x53324c)[_0x3d05('0x4a')]+0x1;}return _0xa7efa7(_0x53324c);})['catch'](function(_0x23fd8e){_0x19d4f8(_0x23fd8e);});});}return _0xee24bb[_0x3d05('0x4c')](_0x3d05('0x4d'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5ce9f0){var _0x4a305a=this[_0x3d05('0x4e')]({'plain':!![]});var _0x54523f=_0x4a305a[_0x3d05('0x7')]===_0x3d05('0x10')?_0x3389e5(_0x4a305a):_0x55090d(_0x4a305a);return _0x4c850d(_0x4a305a,_0x5ce9f0,_[_0x3d05('0x4b')](_0x54523f)[_0x3d05('0x4a')]+0x1)[_0x3d05('0x4f')](function(_0x3c0f56){var _0x40275c=_[_0x3d05('0x50')](_0x54523f,_0x3c0f56);_0x40275c['push']({'type':_0x4a305a[_0x3d05('0x7')],'app':'Hangup','exten':_0x4a305a[_0x3d05('0x6')],'context':_0x4a305a[_0x3d05('0x5')],'priority':_['last'](_0x40275c)[_0x3d05('0x4a')]+0x1,'VoiceExtensionId':_0x4a305a['id']});return _0x40275c;});}}});}; \ No newline at end of file +var _0x5fdc=['timeout','options','url','split','length','name','param','phone','prefix','${EXTEN:','${EXTEN}','join','indexOf','U(xcally-mixmonitor-context)','replace','findAll','IntervalId','then','interval','intervals','map','filter','toLowerCase','tag','CDR(tag)=','callerID','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','outboundDial','appdata','priority','last','concat','catch','VoiceExtension','voice_extensions','get','Hangup','lodash','models','type','Set','CDR(type)=','context','exten','alias','CDR(routeAlias)=','push','XCALLY-MOTION-ANSWER=0','outbound','NoOp','No\x20alias\x20set','CDR(destination)=','cutdigits','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk'];(function(_0x29f9d9,_0x57a939){var _0x4fc4c9=function(_0xd26e3a){while(--_0xd26e3a){_0x29f9d9['push'](_0x29f9d9['shift']());}};_0x4fc4c9(++_0x57a939);}(_0x5fdc,0xcb));var _0xc5fd=function(_0x96457e,_0x472073){_0x96457e=_0x96457e-0x0;var _0x20d030=_0x5fdc[_0x96457e];return _0x20d030;};'use strict';var _=require(_0xc5fd('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x477673){var _0x3dc4c0=_0x477673[_0xc5fd('0x1')];function _0x517c4c(_0x3e2791){var _0x2a36a4=0x2;var _0x3d4575=[{'type':_0x3e2791[_0xc5fd('0x2')],'app':_0xc5fd('0x3'),'appdata':_0xc5fd('0x4')+_0x3e2791[_0xc5fd('0x2')],'context':_0x3e2791[_0xc5fd('0x5')],'exten':_0x3e2791[_0xc5fd('0x6')],'priority':_0x2a36a4++,'VoiceExtensionId':_0x3e2791['id']},{'type':_0x3e2791[_0xc5fd('0x2')],'app':_0x3e2791['alias']?_0xc5fd('0x3'):'NoOp','appdata':_0x3e2791[_0xc5fd('0x7')]?_0xc5fd('0x8')+_0x3e2791['alias']:'No\x20alias\x20set','context':_0x3e2791[_0xc5fd('0x5')],'exten':_0x3e2791[_0xc5fd('0x6')],'priority':_0x2a36a4++,'VoiceExtensionId':_0x3e2791['id']}];if(_0x3e2791['type']==='inbound'){_0x3d4575[_0xc5fd('0x9')]({'type':'inbound','app':_0xc5fd('0x3'),'appdata':'CDR(routeid)='+_0x3e2791['id'],'context':_0x3e2791[_0xc5fd('0x5')],'exten':_0x3e2791[_0xc5fd('0x6')],'priority':_0x2a36a4++,'VoiceExtensionId':_0x3e2791['id']});}_0x3d4575[_0xc5fd('0x9')]({'type':_0x3e2791[_0xc5fd('0x2')],'app':_0xc5fd('0x3'),'appdata':_0xc5fd('0xa'),'context':_0x3e2791[_0xc5fd('0x5')],'exten':_0x3e2791[_0xc5fd('0x6')],'priority':_0x2a36a4++,'VoiceExtensionId':_0x3e2791['id']},{'type':_0x3e2791[_0xc5fd('0x2')],'app':_0xc5fd('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3e2791[_0xc5fd('0x5')],'exten':_0x3e2791[_0xc5fd('0x6')],'priority':_0x2a36a4++,'VoiceExtensionId':_0x3e2791['id']},{'type':_0x3e2791['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x3e2791['context'],'exten':_0x3e2791[_0xc5fd('0x6')],'priority':_0x2a36a4++,'VoiceExtensionId':_0x3e2791['id']});return _0x3d4575;}function _0x4755af(_0x53fe5d){var _0x31a0e3=0x2;var _0x43d716=[{'type':_0xc5fd('0xb'),'app':_0xc5fd('0x3'),'appdata':'CDR(type)=outbound','context':_0x53fe5d[_0xc5fd('0x5')],'exten':_0x53fe5d['exten'],'priority':_0x31a0e3++,'VoiceExtensionId':_0x53fe5d['id']},{'type':_0xc5fd('0xb'),'app':_0x53fe5d['alias']?_0xc5fd('0x3'):_0xc5fd('0xc'),'appdata':_0x53fe5d['alias']?_0xc5fd('0x8')+_0x53fe5d['alias']:_0xc5fd('0xd'),'context':_0x53fe5d[_0xc5fd('0x5')],'exten':_0x53fe5d[_0xc5fd('0x6')],'priority':_0x31a0e3++,'VoiceExtensionId':_0x53fe5d['id']},{'type':_0xc5fd('0xb'),'app':_0xc5fd('0x3'),'appdata':_0xc5fd('0xe')+(_0x53fe5d[_0xc5fd('0xf')]?'${EXTEN:'+_0x53fe5d[_0xc5fd('0xf')]+'}':'${EXTEN}'),'context':_0x53fe5d[_0xc5fd('0x5')],'exten':_0x53fe5d[_0xc5fd('0x6')],'priority':_0x31a0e3++,'VoiceExtensionId':_0x53fe5d['id']},{'type':_0xc5fd('0xb'),'app':_0xc5fd('0x3'),'appdata':_0xc5fd('0x10')+_0x53fe5d['id'],'context':_0x53fe5d['context'],'exten':_0x53fe5d[_0xc5fd('0x6')],'priority':_0x31a0e3++,'VoiceExtensionId':_0x53fe5d['id']},{'type':_0xc5fd('0xb'),'app':_0xc5fd('0x11'),'appdata':_0xc5fd('0x12')+(_0x31a0e3+0x2)+_0xc5fd('0x13')+(_0x31a0e3+0x1)+')','context':_0x53fe5d[_0xc5fd('0x5')],'exten':_0x53fe5d['exten'],'priority':_0x31a0e3++,'VoiceExtensionId':_0x53fe5d['id']},{'type':_0xc5fd('0xb'),'app':_0xc5fd('0x3'),'appdata':_0x53fe5d['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x53fe5d[_0xc5fd('0xf')]+'}':_0xc5fd('0x14'),'context':_0x53fe5d['context'],'exten':_0x53fe5d[_0xc5fd('0x6')],'priority':_0x31a0e3++,'VoiceExtensionId':_0x53fe5d['id']},{'type':_0xc5fd('0xb'),'app':_0xc5fd('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x53fe5d['context'],'exten':_0x53fe5d[_0xc5fd('0x6')],'priority':_0x31a0e3++,'VoiceExtensionId':_0x53fe5d['id']},{'type':_0xc5fd('0xb'),'app':'Set','appdata':_0xc5fd('0x15'),'context':_0x53fe5d[_0xc5fd('0x5')],'exten':_0x53fe5d[_0xc5fd('0x6')],'priority':_0x31a0e3++,'VoiceExtensionId':_0x53fe5d['id']},{'type':_0xc5fd('0xb'),'app':_0xc5fd('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0x53fe5d[_0xc5fd('0x5')],'exten':_0x53fe5d['exten'],'priority':_0x31a0e3++,'VoiceExtensionId':_0x53fe5d['id']},{'type':_0xc5fd('0xb'),'app':_0xc5fd('0x3'),'appdata':'outboundrouteid='+_0x53fe5d['id'],'context':_0x53fe5d[_0xc5fd('0x5')],'exten':_0x53fe5d[_0xc5fd('0x6')],'priority':_0x31a0e3++,'VoiceExtensionId':_0x53fe5d['id']}];if(_0x53fe5d[_0xc5fd('0x16')](_0xc5fd('0x17'))&&_0x53fe5d[_0xc5fd('0x17')]!==_0xc5fd('0x18')){_0x43d716['push']({'type':_0xc5fd('0xb'),'app':_0xc5fd('0x3'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x53fe5d['context'],'exten':_0x53fe5d['exten'],'priority':_0x31a0e3++,'VoiceExtensionId':_0x53fe5d['id']},{'type':_0xc5fd('0xb'),'app':_0xc5fd('0x3'),'appdata':_0xc5fd('0x19')+_0x53fe5d[_0xc5fd('0x17')]||_0xc5fd('0x1a'),'context':_0x53fe5d[_0xc5fd('0x5')],'exten':_0x53fe5d[_0xc5fd('0x6')],'priority':_0x31a0e3++,'VoiceExtensionId':_0x53fe5d['id']});}return _0x43d716;}function _0x1af2a6(_0x342d45,_0x664e87){var _0x3fb48b=[{'name':_0xc5fd('0x1b'),'param':0x0},{'name':_0xc5fd('0x1c'),'param':0x1},{'name':_0xc5fd('0x1d'),'param':0x2},{'name':_0xc5fd('0x1e'),'param':0x3}];var _0x5c9637={};var _0x50efe4=_0x664e87[_0xc5fd('0x1f')](',');var _0x8c5753=[];for(var _0x375e48=0x0;_0x375e48<_0x3fb48b[_0xc5fd('0x20')];_0x375e48++){switch(_0x3fb48b[_0x375e48][_0xc5fd('0x21')]){case'trunk':_0x5c9637[_0xc5fd('0x1b')]=_0x50efe4[_0x3fb48b[_0x375e48][_0xc5fd('0x22')]]['split']('/')[0x1];_0x5c9637[_0xc5fd('0x23')]=_0x50efe4[_0x3fb48b[_0x375e48][_0xc5fd('0x22')]][_0xc5fd('0x1f')]('/')[0x2];_0x5c9637[_0xc5fd('0x24')]=_0x5c9637[_0xc5fd('0x23')]?_0x5c9637[_0xc5fd('0x23')]['split']('$')[0x0]:undefined;_0x5c9637['phone']=_0x342d45[_0xc5fd('0xf')]?(_0x5c9637[_0xc5fd('0x24')]||'')+_0xc5fd('0x25')+_0x342d45[_0xc5fd('0xf')]+'}':(_0x5c9637[_0xc5fd('0x24')]||'')+_0xc5fd('0x26');_0x8c5753[_0x3fb48b[_0x375e48][_0xc5fd('0x22')]]=['SIP',_0x5c9637['trunk'],_0x5c9637[_0xc5fd('0x23')]][_0xc5fd('0x27')]('/');break;case _0xc5fd('0x1d'):_0x5c9637['options']=_0x50efe4[_0x3fb48b[_0x375e48][_0xc5fd('0x22')]];if(_0x342d45[_0xc5fd('0x17')]!=='none'){if(_0x5c9637[_0xc5fd('0x1d')][_0xc5fd('0x28')](_0xc5fd('0x29'))<0x0){_0x5c9637[_0xc5fd('0x1d')]+='U(xcally-mixmonitor-context)';}}else{_0x5c9637[_0xc5fd('0x1d')]=_0x5c9637[_0xc5fd('0x1d')][_0xc5fd('0x2a')](_0xc5fd('0x29'),'');}_0x8c5753[_0x3fb48b[_0x375e48][_0xc5fd('0x22')]]=_0x5c9637[_0xc5fd('0x1d')];break;default:_0x8c5753[_0x3fb48b[_0x375e48][_0xc5fd('0x22')]]=_0x50efe4[_0x3fb48b[_0x375e48][_0xc5fd('0x22')]];}}return _0x8c5753[_0xc5fd('0x27')](',');}function _0x4238e6(_0x2ddda2,_0x594580,_0x2c4615){return new Promise(function(_0x4cf0fa,_0x408243){var _0x2de48b=[];if(_['isEmpty'](_0x594580))return _0x4cf0fa(_0x2de48b);_0x3dc4c0['Interval'][_0xc5fd('0x2b')]({'attributes':['id','interval',_0xc5fd('0x2c')],'raw':!![]})[_0xc5fd('0x2d')](function(_0x361d72){for(var _0x4a346d=0x0,_0x4d438e=0x0;_0x4a346d<_0x594580[_0xc5fd('0x20')];_0x4a346d++,_0x4d438e=0x0){var _0x3d7ee6=_0x594580[_0x4a346d];var _0x8e96e2=[];var _0x1272e5=[];delete _0x3d7ee6['id'];if(_0x3d7ee6[_0xc5fd('0x2e')]!=='*,*,*,*'){_0x3d7ee6[_0xc5fd('0x2f')]=[_0x3d7ee6[_0xc5fd('0x2e')]];}else{_0x3d7ee6['intervals']=_0x3d7ee6[_0xc5fd('0x2c')]?_[_0xc5fd('0x30')](_[_0xc5fd('0x31')](_0x361d72,{'IntervalId':_0x3d7ee6[_0xc5fd('0x2c')]}),'interval'):[];}_0x3d7ee6[_0xc5fd('0x5')]=_0x2ddda2[_0xc5fd('0x5')];_0x3d7ee6[_0xc5fd('0x6')]=_0x2ddda2[_0xc5fd('0x6')];if(_0x3d7ee6[_0xc5fd('0x2')])_0x3d7ee6['type']=_0x3d7ee6[_0xc5fd('0x2')][_0xc5fd('0x32')]();if(_0x2ddda2['type']===_0xc5fd('0xb')){if(_0x3d7ee6[_0xc5fd('0x16')](_0xc5fd('0x33'))&&_0x3d7ee6[_0xc5fd('0x33')]&&_0x3d7ee6[_0xc5fd('0x33')]!=='--'){_0x8e96e2[_0xc5fd('0x9')]({'type':_0x3d7ee6[_0xc5fd('0x2')][_0xc5fd('0x32')](),'app':'Set','appdata':_0xc5fd('0x34')+_0x3d7ee6[_0xc5fd('0x33')],'context':_0x2ddda2[_0xc5fd('0x5')],'exten':_0x2ddda2['exten'],'priority':_0x3d7ee6[_0xc5fd('0x2f')][_0xc5fd('0x20')]+_0x2c4615+_0x4d438e++,'VoiceExtensionId':_0x2ddda2['id']});}_0x8e96e2[_0xc5fd('0x9')]({'type':_0x3d7ee6[_0xc5fd('0x2')][_0xc5fd('0x32')](),'app':_0xc5fd('0x11'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x3d7ee6[_0xc5fd('0x35')]?'Set(CALLERID(all)='+_0x3d7ee6[_0xc5fd('0x35')]+')':'NoOp(No\x20number\x20available)'),'context':_0x2ddda2[_0xc5fd('0x5')],'exten':_0x2ddda2['exten'],'priority':_0x3d7ee6[_0xc5fd('0x2f')][_0xc5fd('0x20')]+_0x2c4615+_0x4d438e++,'VoiceExtensionId':_0x2ddda2['id']});}else{if(_0x3d7ee6[_0xc5fd('0x16')](_0xc5fd('0x36'))){if([_0xc5fd('0x37'),_0xc5fd('0x38')][_0xc5fd('0x39')](_0x3d7ee6[_0xc5fd('0x3a')][_0xc5fd('0x32')]())&&_0x3d7ee6[_0xc5fd('0x3b')]!==_0xc5fd('0x3c')){if(_0x3d7ee6[_0xc5fd('0x36')]){_0x8e96e2[_0xc5fd('0x9')]({'type':_0x3d7ee6[_0xc5fd('0x2')][_0xc5fd('0x32')](),'app':_0xc5fd('0x11'),'appdata':_0xc5fd('0x3d'),'context':_0x2ddda2[_0xc5fd('0x5')],'exten':_0x2ddda2[_0xc5fd('0x6')],'priority':_0x3d7ee6[_0xc5fd('0x2f')][_0xc5fd('0x20')]+_0x2c4615+_0x4d438e++,'VoiceExtensionId':_0x2ddda2['id']});_0x8e96e2[_0xc5fd('0x9')]({'type':_0x3d7ee6['type'][_0xc5fd('0x32')](),'app':_0xc5fd('0x3'),'appdata':_0xc5fd('0x3e'),'context':_0x2ddda2['context'],'exten':_0x2ddda2[_0xc5fd('0x6')],'priority':_0x3d7ee6[_0xc5fd('0x2f')][_0xc5fd('0x20')]+_0x2c4615+_0x4d438e++,'VoiceExtensionId':_0x2ddda2['id']});}else{_0x8e96e2['push']({'type':_0x3d7ee6[_0xc5fd('0x2')][_0xc5fd('0x32')](),'app':_0xc5fd('0x11'),'appdata':_0xc5fd('0x3f'),'context':_0x2ddda2[_0xc5fd('0x5')],'exten':_0x2ddda2[_0xc5fd('0x6')],'priority':_0x3d7ee6[_0xc5fd('0x2f')]['length']+_0x2c4615+_0x4d438e++,'VoiceExtensionId':_0x2ddda2['id']});_0x8e96e2[_0xc5fd('0x9')]({'type':_0x3d7ee6[_0xc5fd('0x2')][_0xc5fd('0x32')](),'app':_0xc5fd('0x3'),'appdata':_0xc5fd('0x40'),'context':_0x2ddda2[_0xc5fd('0x5')],'exten':_0x2ddda2['exten'],'priority':_0x3d7ee6[_0xc5fd('0x2f')]['length']+_0x2c4615+_0x4d438e++,'VoiceExtensionId':_0x2ddda2['id']});}}}}for(var _0x9666bf=0x0;_0x9666bf<_0x3d7ee6[_0xc5fd('0x2f')][_0xc5fd('0x20')];_0x9666bf++){var _0x53df7c=_0x2c4615+_0x3d7ee6[_0xc5fd('0x2f')][_0xc5fd('0x20')];var _0x5447dc=_0x9666bf===_0x3d7ee6['intervals'][_0xc5fd('0x20')]-0x1?_0x2c4615+_0x8e96e2[_0xc5fd('0x20')]+_0x1272e5[_0xc5fd('0x20')]+0x2:_0x2c4615+_0x9666bf+0x1;_0x8e96e2[_0xc5fd('0x41')](_0x9666bf,0x0,{'type':_0x2ddda2[_0xc5fd('0x2')],'app':_0xc5fd('0x42'),'appdata':_0x3d7ee6[_0xc5fd('0x2f')][_0x9666bf]+'?'+_0x2ddda2['context']+',${EXTEN},'+_0x53df7c+':'+_0x2ddda2['context']+',${EXTEN},'+_0x5447dc,'exten':_0x2ddda2[_0xc5fd('0x6')],'context':_0x2ddda2['context'],'priority':_0x2c4615+_0x9666bf,'VoiceExtensionId':_0x2ddda2['id']});}if(_0x3d7ee6[_0xc5fd('0x3b')]===_0xc5fd('0x43'))_0x3d7ee6['appdata']=_0x1af2a6(_0x2ddda2,_0x3d7ee6[_0xc5fd('0x44')]);_0x3d7ee6[_0xc5fd('0x45')]=_0x8e96e2[_0xc5fd('0x20')]?_[_0xc5fd('0x46')](_0x8e96e2)[_0xc5fd('0x45')]+0x1:_0x2c4615;_0x2de48b=_[_0xc5fd('0x47')](_0x2de48b,_0x8e96e2,[_0x3d7ee6],_0x1272e5);_0x2c4615=_[_0xc5fd('0x46')](_0x2de48b)['priority']+0x1;}return _0x4cf0fa(_0x2de48b);})[_0xc5fd('0x48')](function(_0x1262ae){_0x408243(_0x1262ae);});});}return _0x477673['define'](_0xc5fd('0x49'),attributes,{'tableName':_0xc5fd('0x4a'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x45a835){var _0x3613c7=this[_0xc5fd('0x4b')]({'plain':!![]});var _0x354a0c=_0x3613c7['type']===_0xc5fd('0xb')?_0x4755af(_0x3613c7):_0x517c4c(_0x3613c7);return _0x4238e6(_0x3613c7,_0x45a835,_['last'](_0x354a0c)[_0xc5fd('0x45')]+0x1)['then'](function(_0x33e7b3){var _0x12ed0d=_[_0xc5fd('0x47')](_0x354a0c,_0x33e7b3);_0x12ed0d[_0xc5fd('0x9')]({'type':_0x3613c7[_0xc5fd('0x2')],'app':_0xc5fd('0x4c'),'exten':_0x3613c7[_0xc5fd('0x6')],'context':_0x3613c7['context'],'priority':_['last'](_0x12ed0d)[_0xc5fd('0x45')]+0x1,'VoiceExtensionId':_0x3613c7['id']});return _0x12ed0d;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 442280c..f8d3c09 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 _0x53ec=['then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','limit','include','model','map','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register'];(function(_0x35d435,_0x5aa7be){var _0x4c5720=function(_0x5e82f0){while(--_0x5e82f0){_0x35d435['push'](_0x35d435['shift']());}};_0x4c5720(++_0x5aa7be);}(_0x53ec,0x192));var _0xc53e=function(_0x2fea3f,_0x143c24){_0x2fea3f=_0x2fea3f-0x0;var _0xe7b365=_0x53ec[_0x2fea3f];return _0xe7b365;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});config[_0xc53e('0xa')]=_[_0xc53e('0xb')](config['redis'],{'host':_0xc53e('0xc'),'port':0x18eb});var socket=require(_0xc53e('0xd'))(new Redis(config[_0xc53e('0xa')]));require(_0xc53e('0xe'))[_0xc53e('0xf')](socket);function respondWithRpcPromise(_0x2c88cb,_0xd82002,_0x361e9d){return new BPromise(function(_0xa98198,_0x4b7cfa){return client['request'](_0x2c88cb,_0x361e9d)[_0xc53e('0x10')](function(_0x5a2da7){logger['info'](_0xc53e('0x11'),_0xd82002,_0xc53e('0x12'));logger[_0xc53e('0x13')](_0xc53e('0x14'),_0xd82002,'request\x20sent',JSON['stringify'](_0x5a2da7));if(_0x5a2da7[_0xc53e('0x15')]){if(_0x5a2da7[_0xc53e('0x15')][_0xc53e('0x16')]===0x1f4){logger[_0xc53e('0x15')](_0xc53e('0x11'),_0xd82002,_0x5a2da7[_0xc53e('0x15')][_0xc53e('0x17')]);return _0x4b7cfa(_0x5a2da7[_0xc53e('0x15')][_0xc53e('0x17')]);}logger[_0xc53e('0x15')]('VoiceExtension,\x20%s,\x20%s',_0xd82002,_0x5a2da7[_0xc53e('0x15')][_0xc53e('0x17')]);return _0xa98198(_0x5a2da7[_0xc53e('0x15')][_0xc53e('0x17')]);}else{logger[_0xc53e('0x18')](_0xc53e('0x11'),_0xd82002,_0xc53e('0x12'));_0xa98198(_0x5a2da7[_0xc53e('0x19')][_0xc53e('0x17')]);}})['catch'](function(_0x546fab){logger[_0xc53e('0x15')](_0xc53e('0x11'),_0xd82002,_0x546fab);_0x4b7cfa(_0x546fab);});});}exports[_0xc53e('0x1a')]=function(_0x2e85df){var _0x20066e=this;return new Promise(function(_0x2cfe2b,_0x15a015){return db[_0xc53e('0x1b')][_0xc53e('0x1c')]({'raw':_0x2e85df[_0xc53e('0x1d')]?_0x2e85df[_0xc53e('0x1d')][_0xc53e('0x1e')]===undefined?!![]:![]:!![],'where':_0x2e85df[_0xc53e('0x1d')]?_0x2e85df['options']['where']||null:null,'attributes':_0x2e85df['options']?_0x2e85df[_0xc53e('0x1d')][_0xc53e('0x1f')]||null:null,'limit':_0x2e85df[_0xc53e('0x1d')]?_0x2e85df[_0xc53e('0x1d')][_0xc53e('0x20')]||null:null,'include':_0x2e85df['options']?_0x2e85df['options'][_0xc53e('0x21')]?_['map'](_0x2e85df[_0xc53e('0x1d')][_0xc53e('0x21')],function(_0x443179){return{'model':db[_0x443179[_0xc53e('0x22')]],'as':_0x443179['as'],'attributes':_0x443179[_0xc53e('0x1f')],'include':_0x443179['include']?_[_0xc53e('0x23')](_0x443179['include'],function(_0x4d9a68){return{'model':db[_0x4d9a68['model']],'as':_0x4d9a68['as'],'attributes':_0x4d9a68[_0xc53e('0x1f')],'include':_0x4d9a68['include']?_[_0xc53e('0x23')](_0x4d9a68['include'],function(_0x24a77e){return{'model':db[_0x24a77e['model']],'as':_0x24a77e['as'],'attributes':_0x24a77e['attributes']};}):[]};}):[]};}):[]:[]})[_0xc53e('0x10')](function(_0x6a62b0){logger[_0xc53e('0x18')](_0xc53e('0x1a'),_0x2e85df);logger[_0xc53e('0x13')](_0xc53e('0x1a'),_0x2e85df,JSON[_0xc53e('0x24')](_0x6a62b0));_0x2cfe2b(_0x6a62b0);})[_0xc53e('0x25')](function(_0x4ace0b){logger[_0xc53e('0x15')](_0xc53e('0x1a'),_0x4ace0b[_0xc53e('0x17')],_0x2e85df);_0x15a015(_0x20066e['error'](0x1f4,_0x4ace0b[_0xc53e('0x17')]));});});}; \ No newline at end of file +var _0x9fd4=['message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x57a949,_0x4f49f4){var _0x5a62cc=function(_0x2963ba){while(--_0x2963ba){_0x57a949['push'](_0x57a949['shift']());}};_0x5a62cc(++_0x4f49f4);}(_0x9fd4,0x16c));var _0x49fd=function(_0x162802,_0x555c15){_0x162802=_0x162802-0x0;var _0x24d606=_0x9fd4[_0x162802];return _0x24d606;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var moment=require(_0x49fd('0x2'));var BPromise=require(_0x49fd('0x3'));var rs=require(_0x49fd('0x4'));var fs=require('fs');var Redis=require(_0x49fd('0x5'));var db=require(_0x49fd('0x6'))['db'];var utils=require(_0x49fd('0x7'));var logger=require(_0x49fd('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x49fd('0x9'));var client=jayson[_0x49fd('0xa')][_0x49fd('0xb')]({'port':0x232a});config[_0x49fd('0xc')]=_['defaults'](config[_0x49fd('0xc')],{'host':_0x49fd('0xd'),'port':0x18eb});var socket=require(_0x49fd('0xe'))(new Redis(config[_0x49fd('0xc')]));require(_0x49fd('0xf'))['register'](socket);function respondWithRpcPromise(_0x35034c,_0x130c9b,_0x3e1c71){return new BPromise(function(_0x4969d3,_0x426ec2){return client[_0x49fd('0x10')](_0x35034c,_0x3e1c71)[_0x49fd('0x11')](function(_0x53a44e){logger[_0x49fd('0x12')](_0x49fd('0x13'),_0x130c9b,_0x49fd('0x14'));logger[_0x49fd('0x15')](_0x49fd('0x16'),_0x130c9b,_0x49fd('0x14'),JSON[_0x49fd('0x17')](_0x53a44e));if(_0x53a44e[_0x49fd('0x18')]){if(_0x53a44e[_0x49fd('0x18')][_0x49fd('0x19')]===0x1f4){logger[_0x49fd('0x18')](_0x49fd('0x13'),_0x130c9b,_0x53a44e[_0x49fd('0x18')][_0x49fd('0x1a')]);return _0x426ec2(_0x53a44e[_0x49fd('0x18')][_0x49fd('0x1a')]);}logger[_0x49fd('0x18')](_0x49fd('0x13'),_0x130c9b,_0x53a44e[_0x49fd('0x18')][_0x49fd('0x1a')]);return _0x4969d3(_0x53a44e[_0x49fd('0x18')][_0x49fd('0x1a')]);}else{logger[_0x49fd('0x12')](_0x49fd('0x13'),_0x130c9b,_0x49fd('0x14'));_0x4969d3(_0x53a44e[_0x49fd('0x1b')]['message']);}})[_0x49fd('0x1c')](function(_0x3fd46b){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x130c9b,_0x3fd46b);_0x426ec2(_0x3fd46b);});});}exports[_0x49fd('0x1d')]=function(_0x53cbd1){var _0x316e7c=this;return new Promise(function(_0xbb113b,_0x599315){return db[_0x49fd('0x1e')][_0x49fd('0x1f')]({'raw':_0x53cbd1['options']?_0x53cbd1[_0x49fd('0x20')][_0x49fd('0x21')]===undefined?!![]:![]:!![],'where':_0x53cbd1[_0x49fd('0x20')]?_0x53cbd1[_0x49fd('0x20')][_0x49fd('0x22')]||null:null,'attributes':_0x53cbd1[_0x49fd('0x20')]?_0x53cbd1['options'][_0x49fd('0x23')]||null:null,'limit':_0x53cbd1[_0x49fd('0x20')]?_0x53cbd1[_0x49fd('0x20')]['limit']||null:null,'include':_0x53cbd1[_0x49fd('0x20')]?_0x53cbd1[_0x49fd('0x20')][_0x49fd('0x24')]?_['map'](_0x53cbd1['options']['include'],function(_0x13c5a8){return{'model':db[_0x13c5a8[_0x49fd('0x25')]],'as':_0x13c5a8['as'],'attributes':_0x13c5a8[_0x49fd('0x23')],'include':_0x13c5a8[_0x49fd('0x24')]?_[_0x49fd('0x26')](_0x13c5a8[_0x49fd('0x24')],function(_0x20873e){return{'model':db[_0x20873e[_0x49fd('0x25')]],'as':_0x20873e['as'],'attributes':_0x20873e['attributes'],'include':_0x20873e[_0x49fd('0x24')]?_['map'](_0x20873e[_0x49fd('0x24')],function(_0x89badc){return{'model':db[_0x89badc['model']],'as':_0x89badc['as'],'attributes':_0x89badc[_0x49fd('0x23')]};}):[]};}):[]};}):[]:[]})[_0x49fd('0x11')](function(_0x23374c){logger[_0x49fd('0x12')](_0x49fd('0x1d'),_0x53cbd1);logger[_0x49fd('0x15')](_0x49fd('0x1d'),_0x53cbd1,JSON[_0x49fd('0x17')](_0x23374c));_0xbb113b(_0x23374c);})['catch'](function(_0x42181b){logger['error'](_0x49fd('0x1d'),_0x42181b['message'],_0x53cbd1);_0x599315(_0x316e7c[_0x49fd('0x18')](0x1f4,_0x42181b[_0x49fd('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index d6e3ca5..48c7272 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 _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x2b255a,_0x552991){var _0x39eee6=function(_0x8533b9){while(--_0x8533b9){_0x2b255a['push'](_0x2b255a['shift']());}};_0x39eee6(++_0x552991);}(_0x5fc3,0xa8));var _0x35fc=function(_0x29aefc,_0x4dcf53){_0x29aefc=_0x29aefc-0x0;var _0x11be36=_0x5fc3[_0x29aefc];return _0x11be36;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x3aa7ba,_0x442260){var _0x5588be=function(_0x1d491f){while(--_0x1d491f){_0x3aa7ba['push'](_0x3aa7ba['shift']());}};_0x5588be(++_0x442260);}(_0x1261,0x144));var _0x1126=function(_0xf38492,_0x45d84e){_0xf38492=_0xf38492-0x0;var _0x3e66e3=_0x1261[_0xf38492];return _0x3e66e3;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 7fc2aa7..8c88325 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 _0x6d38=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','/:id','/:id/messages','create','update','destroy','exports','util'];(function(_0x1e5bfb,_0x41cb42){var _0x2f6692=function(_0x563c3f){while(--_0x563c3f){_0x1e5bfb['push'](_0x1e5bfb['shift']());}};_0x2f6692(++_0x41cb42);}(_0x6d38,0x1ef));var _0x86d3=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x6d38[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['getMessages']);router['post']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0xc')]);router['put']('/:id',auth[_0x86d3('0x7')](),controller[_0x86d3('0xd')]);router['delete'](_0x86d3('0xa'),auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file +var _0x81c6=['isAuthenticated','/:id','/:id/messages','put','update','destroy','exports','util','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x81c6,0x1d5));var _0x681c=function(_0x9979f9,_0x22dba0){_0x9979f9=_0x9979f9-0x0;var _0x53b7fe=_0x81c6[_0x9979f9];return _0x53b7fe;};'use strict';var multer=require('multer');var util=require(_0x681c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x681c('0x1')]();var fs_extra=require(_0x681c('0x2'));var auth=require(_0x681c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x681c('0x4'));var controller=require(_0x681c('0x5'));router[_0x681c('0x6')]('/',auth[_0x681c('0x7')](),controller['index']);router[_0x681c('0x6')](_0x681c('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x681c('0x6')](_0x681c('0x9'),auth[_0x681c('0x7')](),controller['getMessages']);router['post']('/',auth[_0x681c('0x7')](),controller['create']);router[_0x681c('0xa')](_0x681c('0x8'),auth[_0x681c('0x7')](),controller[_0x681c('0xb')]);router['delete']('/:id',auth[_0x681c('0x7')](),controller[_0x681c('0xc')]);module[_0x681c('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 10e3f47..84210dd 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 _0xba00=['TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','trim','central','ENUM','yes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba00,0x106));var _0x0ba0=function(_0x198034,_0x3c565b){_0x198034=_0x198034-0x0;var _0x227b96=_0xba00[_0x198034];return _0x227b96;};'use strict';var Sequelize=require(_0x0ba0('0x0'));module[_0x0ba0('0x1')]={'customer_id':{'type':Sequelize[_0x0ba0('0x2')]},'context':{'type':Sequelize[_0x0ba0('0x2')],'defaultValue':_0x0ba0('0x3'),'unique':_0x0ba0('0x4')},'mailbox':{'type':Sequelize[_0x0ba0('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x0ba0('0x2')]},'email':{'type':Sequelize[_0x0ba0('0x2')],'validate':{'isEmail':!![]},'set':function(_0x2661ed){this[_0x0ba0('0x5')]('email',typeof _0x2661ed==='string'&&_0x2661ed[_0x0ba0('0x6')]()?_0x2661ed['trim']():null);}},'pager':{'type':Sequelize[_0x0ba0('0x2')]},'tz':{'type':Sequelize[_0x0ba0('0x2')],'defaultValue':_0x0ba0('0x7')},'attach':{'type':Sequelize[_0x0ba0('0x8')](_0x0ba0('0x9'),'no'),'defaultValue':_0x0ba0('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x0ba0('0x9'),'no'),'defaultValue':_0x0ba0('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0ba0('0x2')]},'callback':{'type':Sequelize[_0x0ba0('0x2')]},'review':{'type':Sequelize[_0x0ba0('0x8')](_0x0ba0('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x0ba0('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x0ba0('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x0ba0('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0ba0('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0ba0('0x8')](_0x0ba0('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0ba0('0x8')](_0x0ba0('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0ba0('0x8')]('yes','no'),'defaultValue':_0x0ba0('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0ba0('0x8')](_0x0ba0('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0ba0('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0ba0('0x8')]('yes','no'),'defaultValue':_0x0ba0('0x9'),'allowNull':![]},'stamp':{'type':_0x0ba0('0xb')},'emailsubject':{'type':Sequelize[_0x0ba0('0x2')]},'emailbody':{'type':Sequelize[_0x0ba0('0x2')]},'maxsecs':{'type':Sequelize[_0x0ba0('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0ba0('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0ba0('0xd')],'get':function(){return this['getDataValue'](_0x0ba0('0xe'))+'\x20-\x20'+this[_0x0ba0('0xf')](_0x0ba0('0x10'));}}}; \ No newline at end of file +var _0xb702=['ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email'];(function(_0x38e717,_0x5b8bba){var _0x5bda01=function(_0x7fbf36){while(--_0x7fbf36){_0x38e717['push'](_0x38e717['shift']());}};_0x5bda01(++_0x5b8bba);}(_0xb702,0x162));var _0x2b70=function(_0x35bd6c,_0x585087){_0x35bd6c=_0x35bd6c-0x0;var _0x2f421d=_0xb702[_0x35bd6c];return _0x2f421d;};'use strict';var Sequelize=require(_0x2b70('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2b70('0x1')],'defaultValue':_0x2b70('0x2'),'unique':_0x2b70('0x3')},'mailbox':{'type':Sequelize[_0x2b70('0x1')],'defaultValue':'','allowNull':![],'unique':_0x2b70('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x2b70('0x1')]},'email':{'type':Sequelize[_0x2b70('0x1')],'validate':{'isEmail':!![]},'set':function(_0x4bf5f4){this[_0x2b70('0x4')](_0x2b70('0x5'),typeof _0x4bf5f4==='string'&&_0x4bf5f4['trim']()?_0x4bf5f4['trim']():null);}},'pager':{'type':Sequelize[_0x2b70('0x1')]},'tz':{'type':Sequelize[_0x2b70('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x2b70('0x6')](_0x2b70('0x7'),'no'),'defaultValue':_0x2b70('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x2b70('0x6')](_0x2b70('0x7'),'no'),'defaultValue':_0x2b70('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x2b70('0x1')]},'callback':{'type':Sequelize[_0x2b70('0x1')]},'review':{'type':Sequelize['ENUM'](_0x2b70('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x2b70('0x6')](_0x2b70('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x2b70('0x6')](_0x2b70('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x2b70('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x2b70('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x2b70('0x6')](_0x2b70('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x2b70('0x6')](_0x2b70('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x2b70('0x6')](_0x2b70('0x7'),'no'),'defaultValue':_0x2b70('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x2b70('0x6')](_0x2b70('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x2b70('0x6')](_0x2b70('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x2b70('0x6')](_0x2b70('0x7'),'no'),'defaultValue':_0x2b70('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x2b70('0x1')]},'maxsecs':{'type':Sequelize[_0x2b70('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x2b70('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x2b70('0xa')],'get':function(){return this[_0x2b70('0xb')](_0x2b70('0xc'))+_0x2b70('0xd')+this['getDataValue'](_0x2b70('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 2508cd4..0bcd53b 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 _0xed3c=['body','getMessages','findOne','order','sort','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','get','UserProfileResource','end','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Voicemails','UserProfileSection','userProfileId','autoAssociation'];(function(_0x59a545,_0x4f2717){var _0x48802a=function(_0x346a61){while(--_0x346a61){_0x59a545['push'](_0x59a545['shift']());}};_0x48802a(++_0x4f2717);}(_0xed3c,0x1a6));var _0xced3=function(_0x11dc39,_0x491115){_0x11dc39=_0x11dc39-0x0;var _0x457277=_0xed3c[_0x11dc39];return _0x457277;};'use strict';var emlformat=require(_0xced3('0x0'));var rimraf=require(_0xced3('0x1'));var zipdir=require(_0xced3('0x2'));var jsonpatch=require(_0xced3('0x3'));var rp=require('request-promise');var moment=require(_0xced3('0x4'));var BPromise=require(_0xced3('0x5'));var Mustache=require(_0xced3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xced3('0x7'));var csv=require(_0xced3('0x8'));var ejs=require(_0xced3('0x9'));var fs=require('fs');var fs_extra=require(_0xced3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var Redis=require(_0xced3('0xd'));var authService=require(_0xced3('0xe'));var qs=require(_0xced3('0xf'));var as=require(_0xced3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced3('0x11'))(_0xced3('0x12'));var utils=require(_0xced3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xced3('0x14'));var db=require(_0xced3('0x15'))['db'];function respondWithStatusCode(_0x42d879,_0x3b2ac4){_0x3b2ac4=_0x3b2ac4||0xcc;return function(_0x457caf){if(_0x457caf){return _0x42d879[_0xced3('0x16')](_0x3b2ac4);}return _0x42d879[_0xced3('0x17')](_0x3b2ac4)['end']();};}function respondWithResult(_0x65bb58,_0x5e186e){_0x5e186e=_0x5e186e||0xc8;return function(_0xf2db6f){if(_0xf2db6f){return _0x65bb58[_0xced3('0x17')](_0x5e186e)[_0xced3('0x18')](_0xf2db6f);}};}function respondWithFilteredResult(_0x39e4aa,_0x4dd4c3){return function(_0x146a21){if(_0x146a21){var _0x322c2d=typeof _0x4dd4c3['offset']===_0xced3('0x19')&&typeof _0x4dd4c3[_0xced3('0x1a')]===_0xced3('0x19');var _0x17f611=_0x146a21['count'];var _0x4569af=_0x322c2d?0x0:_0x4dd4c3['offset'];var _0x353580=_0x322c2d?_0x146a21[_0xced3('0x1b')]:_0x4dd4c3[_0xced3('0x1c')]+_0x4dd4c3[_0xced3('0x1a')];var _0x44143f;if(_0x353580>=_0x17f611){_0x353580=_0x17f611;_0x44143f=0xc8;}else{_0x44143f=0xce;}_0x39e4aa[_0xced3('0x17')](_0x44143f);return _0x39e4aa[_0xced3('0x1d')](_0xced3('0x1e'),_0x4569af+'-'+_0x353580+'/'+_0x17f611)[_0xced3('0x18')](_0x146a21);}return null;};}function patchUpdates(_0x17c011){return function(_0x2008f2){try{jsonpatch['apply'](_0x2008f2,_0x17c011,!![]);}catch(_0x5b8b1f){return BPromise['reject'](_0x5b8b1f);}return _0x2008f2[_0xced3('0x1f')]();};}function saveUpdates(_0x342b9e,_0x21e074){return function(_0x4bf915){if(_0x4bf915){return _0x4bf915[_0xced3('0x20')](_0x342b9e)[_0xced3('0x21')](function(_0x526854){return _0x526854;});}return null;};}function removeEntity(_0x559fa2,_0x3adf14){return function(_0x101708){if(_0x101708){return _0x101708[_0xced3('0x22')]()[_0xced3('0x21')](function(){var _0x50f7c1=_0x101708[_0xced3('0x23')]({'plain':!![]});var _0x23f92b='Voicemails';return db[_0xced3('0x24')]['destroy']({'where':{'type':_0x23f92b,'resourceId':_0x50f7c1['id']}})[_0xced3('0x21')](function(){return _0x101708;});})[_0xced3('0x21')](function(){_0x559fa2[_0xced3('0x17')](0xcc)[_0xced3('0x25')]();});}};}function handleEntityNotFound(_0x2ec2c4,_0x502cf1){return function(_0x5454c0){if(!_0x5454c0){_0x2ec2c4[_0xced3('0x16')](0x194);}return _0x5454c0;};}function handleError(_0x5bb425,_0x2ab8a8){_0x2ab8a8=_0x2ab8a8||0x1f4;return function(_0x1e6923){logger['error'](_0x1e6923[_0xced3('0x26')]);if(_0x1e6923[_0xced3('0x27')]){delete _0x1e6923[_0xced3('0x27')];}_0x5bb425[_0xced3('0x17')](_0x2ab8a8)[_0xced3('0x28')](_0x1e6923);};}exports[_0xced3('0x29')]=function(_0x895a32,_0x41d003){var _0x116cc7={},_0x559b8e={},_0xa78899={'count':0x0,'rows':[]};var _0x1b8baa=_[_0xced3('0x2a')](db[_0xced3('0x2b')][_0xced3('0x2c')],function(_0x21e4a2){return{'name':_0x21e4a2[_0xced3('0x2d')],'type':_0x21e4a2[_0xced3('0x2e')][_0xced3('0x2f')]};});_0x559b8e[_0xced3('0x30')]=_[_0xced3('0x2a')](_0x1b8baa,_0xced3('0x27'));_0x559b8e[_0xced3('0x31')]=_[_0xced3('0x32')](_0x895a32[_0xced3('0x31')]);_0x559b8e[_0xced3('0x33')]=_[_0xced3('0x34')](_0x559b8e[_0xced3('0x30')],_0x559b8e[_0xced3('0x31')]);_0x116cc7[_0xced3('0x35')]=_[_0xced3('0x34')](_0x559b8e['model'],qs[_0xced3('0x36')](_0x895a32['query'][_0xced3('0x36')]));_0x116cc7[_0xced3('0x35')]=_0x116cc7[_0xced3('0x35')][_0xced3('0x37')]?_0x116cc7[_0xced3('0x35')]:_0x559b8e[_0xced3('0x30')];if(!_0x895a32[_0xced3('0x31')][_0xced3('0x38')](_0xced3('0x39'))){_0x116cc7[_0xced3('0x1a')]=qs['limit'](_0x895a32[_0xced3('0x31')][_0xced3('0x1a')]);_0x116cc7['offset']=qs[_0xced3('0x1c')](_0x895a32[_0xced3('0x31')][_0xced3('0x1c')]);}_0x116cc7['order']=qs['sort'](_0x895a32[_0xced3('0x31')]['sort']);_0x116cc7[_0xced3('0x3a')]=qs[_0xced3('0x33')](_['pick'](_0x895a32[_0xced3('0x31')],_0x559b8e[_0xced3('0x33')]),_0x1b8baa);if(_0x895a32[_0xced3('0x31')]['filter']){_0x116cc7[_0xced3('0x3a')]=_['merge'](_0x116cc7['where'],{'$or':_[_0xced3('0x2a')](_0x1b8baa,function(_0x31e281){if(_0x31e281[_0xced3('0x2e')]!=='VIRTUAL'){var _0xb2cf20={};_0xb2cf20[_0x31e281[_0xced3('0x27')]]={'$like':'%'+_0x895a32[_0xced3('0x31')][_0xced3('0x3b')]+'%'};return _0xb2cf20;}})});}_0x116cc7=_[_0xced3('0x3c')]({},_0x116cc7,_0x895a32[_0xced3('0x3d')]);var _0x30e890={'where':_0x116cc7[_0xced3('0x3a')]};return db[_0xced3('0x2b')][_0xced3('0x1b')](_0x30e890)[_0xced3('0x21')](function(_0x38855f){_0xa78899[_0xced3('0x1b')]=_0x38855f;if(_0x895a32[_0xced3('0x31')][_0xced3('0x3e')]){_0x116cc7['include']=[{'all':!![]}];}return db[_0xced3('0x2b')][_0xced3('0x3f')](_0x116cc7);})[_0xced3('0x21')](function(_0x1a6c1f){_0xa78899[_0xced3('0x40')]=_0x1a6c1f;return _0xa78899;})[_0xced3('0x21')](respondWithFilteredResult(_0x41d003,_0x116cc7))[_0xced3('0x41')](handleError(_0x41d003,null));};exports[_0xced3('0x42')]=function(_0x1ab7e0,_0x4cea5c){var _0x6c0238={'raw':!![],'where':{'id':_0x1ab7e0[_0xced3('0x43')]['id']}},_0x47ab23={};_0x47ab23[_0xced3('0x30')]=_[_0xced3('0x32')](db['VoiceMail'][_0xced3('0x2c')]);_0x47ab23[_0xced3('0x31')]=_[_0xced3('0x32')](_0x1ab7e0[_0xced3('0x31')]);_0x47ab23['filters']=_[_0xced3('0x34')](_0x47ab23[_0xced3('0x30')],_0x47ab23[_0xced3('0x31')]);_0x6c0238[_0xced3('0x35')]=_[_0xced3('0x34')](_0x47ab23['model'],qs[_0xced3('0x36')](_0x1ab7e0[_0xced3('0x31')][_0xced3('0x36')]));_0x6c0238[_0xced3('0x35')]=_0x6c0238[_0xced3('0x35')][_0xced3('0x37')]?_0x6c0238[_0xced3('0x35')]:_0x47ab23['model'];if(_0x1ab7e0[_0xced3('0x31')][_0xced3('0x3e')]){_0x6c0238['include']=[{'all':!![]}];}_0x6c0238=_['merge']({},_0x6c0238,_0x1ab7e0[_0xced3('0x3d')]);return db['VoiceMail'][_0xced3('0x44')](_0x6c0238)[_0xced3('0x21')](handleEntityNotFound(_0x4cea5c,null))[_0xced3('0x21')](respondWithResult(_0x4cea5c,null))[_0xced3('0x41')](handleError(_0x4cea5c,null));};exports[_0xced3('0x45')]=function(_0x1b3396,_0x3700ed){return db[_0xced3('0x2b')][_0xced3('0x45')](_0x1b3396['body'],{})[_0xced3('0x21')](function(_0x8df206){var _0x2aa876=_0x1b3396[_0xced3('0x46')][_0xced3('0x23')]({'plain':!![]});if(!_0x2aa876)throw new Error(_0xced3('0x47'));if(_0x2aa876['role']===_0xced3('0x46')){var _0x629ecf=_0x8df206[_0xced3('0x23')]({'plain':!![]});var _0x409da0=_0xced3('0x48');return db[_0xced3('0x49')][_0xced3('0x44')]({'where':{'name':_0x409da0,'userProfileId':_0x2aa876[_0xced3('0x4a')]},'raw':!![]})[_0xced3('0x21')](function(_0x44d779){if(_0x44d779&&_0x44d779[_0xced3('0x4b')]===0x0){return db[_0xced3('0x24')]['create']({'name':_0x629ecf[_0xced3('0x27')],'resourceId':_0x629ecf['id'],'type':_0x44d779['name'],'sectionId':_0x44d779['id']},{})[_0xced3('0x21')](function(){return _0x8df206;});}else{return _0x8df206;}})[_0xced3('0x41')](function(_0xc93e05){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc93e05);throw _0xc93e05;});}return _0x8df206;})[_0xced3('0x21')](respondWithResult(_0x3700ed,0xc9))[_0xced3('0x41')](handleError(_0x3700ed,null));};exports['update']=function(_0x3f41cc,_0x4ae67d){if(_0x3f41cc[_0xced3('0x4c')]['id']){delete _0x3f41cc[_0xced3('0x4c')]['id'];}return db['VoiceMail'][_0xced3('0x44')]({'where':{'id':_0x3f41cc[_0xced3('0x43')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x4ae67d,null))['then'](saveUpdates(_0x3f41cc[_0xced3('0x4c')],null))['then'](respondWithResult(_0x4ae67d,null))[_0xced3('0x41')](handleError(_0x4ae67d,null));};exports[_0xced3('0x22')]=function(_0x4694b8,_0x168c36){return db[_0xced3('0x2b')][_0xced3('0x44')]({'where':{'id':_0x4694b8[_0xced3('0x43')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x168c36,null))[_0xced3('0x21')](removeEntity(_0x168c36,null))[_0xced3('0x41')](handleError(_0x168c36,null));};exports[_0xced3('0x4d')]=function(_0x4b14dd,_0x3859e8,_0x3de35d){return db[_0xced3('0x2b')][_0xced3('0x4e')]({'where':{'id':_0x4b14dd[_0xced3('0x43')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x3859e8,null))['then'](function(_0x9db425){var _0x171081;var _0x21ea6a={},_0x440a0f={};_0x440a0f[_0xced3('0x30')]=_[_0xced3('0x32')](db['VoiceMailMessage'][_0xced3('0x2c')]);_0x440a0f['query']=_[_0xced3('0x32')](_0x4b14dd['query']);_0x440a0f[_0xced3('0x33')]=_[_0xced3('0x34')](_0x440a0f['model'],_0x440a0f[_0xced3('0x31')]);_0x21ea6a[_0xced3('0x35')]=_[_0xced3('0x34')](_0x440a0f[_0xced3('0x30')],qs[_0xced3('0x36')](_0x4b14dd[_0xced3('0x31')][_0xced3('0x36')]));_0x21ea6a[_0xced3('0x35')]=_0x21ea6a[_0xced3('0x35')][_0xced3('0x37')]?_0x21ea6a[_0xced3('0x35')]:_0x440a0f[_0xced3('0x30')];if(!_0x4b14dd[_0xced3('0x31')]['hasOwnProperty'](_0xced3('0x39'))){_0x21ea6a[_0xced3('0x1a')]=qs[_0xced3('0x1a')](_0x4b14dd[_0xced3('0x31')]['limit']);_0x21ea6a[_0xced3('0x1c')]=qs[_0xced3('0x1c')](_0x4b14dd[_0xced3('0x31')][_0xced3('0x1c')]);}_0x21ea6a[_0xced3('0x4f')]=qs[_0xced3('0x50')](_0x4b14dd[_0xced3('0x31')]['sort']);_0x21ea6a[_0xced3('0x3a')]=qs[_0xced3('0x33')](_['pick'](_0x4b14dd[_0xced3('0x31')],_0x440a0f[_0xced3('0x33')]));if(_0x4b14dd[_0xced3('0x31')][_0xced3('0x3b')]){_0x21ea6a['where']=_[_0xced3('0x3c')](_0x21ea6a[_0xced3('0x3a')],{'$or':_[_0xced3('0x2a')](_0x21ea6a[_0xced3('0x35')],function(_0x3992d2){var _0x385d45={};_0x385d45[_0x3992d2]={'$like':'%'+_0x4b14dd[_0xced3('0x31')][_0xced3('0x3b')]+'%'};return _0x385d45;})});}_0x21ea6a[_0xced3('0x3a')]=_[_0xced3('0x3c')](_0x21ea6a['where'],{'mailboxuser':_0x9db425[_0xced3('0x51')]});_0x21ea6a=_[_0xced3('0x3c')]({},_0x21ea6a,_0x4b14dd['options']);return db['VoiceMailMessage'][_0xced3('0x52')](_0x21ea6a)['then'](respondWithFilteredResult(_0x3859e8,_0x21ea6a));})[_0xced3('0x41')](handleError(_0x3859e8,null));}; \ No newline at end of file +var _0x3f8c=['create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','Voicemails','UserProfileResource','destroy','error','stack','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch'];(function(_0x5a70a9,_0x3d2cb7){var _0xd4b8d4=function(_0xccef87){while(--_0xccef87){_0x5a70a9['push'](_0x5a70a9['shift']());}};_0xd4b8d4(++_0x3d2cb7);}(_0x3f8c,0x104));var _0xc3f8=function(_0x1d5212,_0x594b8a){_0x1d5212=_0x1d5212-0x0;var _0x325609=_0x3f8c[_0x1d5212];return _0x325609;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3f8('0x0'));var jsonpatch=require(_0xc3f8('0x1'));var rp=require(_0xc3f8('0x2'));var moment=require(_0xc3f8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc3f8('0x4'));var ejs=require(_0xc3f8('0x5'));var fs=require('fs');var fs_extra=require(_0xc3f8('0x6'));var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x4'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var Redis=require(_0xc3f8('0xd'));var authService=require(_0xc3f8('0xe'));var qs=require(_0xc3f8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f8('0x10'));var logger=require(_0xc3f8('0x11'))(_0xc3f8('0x12'));var utils=require(_0xc3f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc3f8('0x14'));var db=require(_0xc3f8('0x15'))['db'];function respondWithStatusCode(_0x256e3d,_0x155c80){_0x155c80=_0x155c80||0xcc;return function(_0x511763){if(_0x511763){return _0x256e3d[_0xc3f8('0x16')](_0x155c80);}return _0x256e3d[_0xc3f8('0x17')](_0x155c80)[_0xc3f8('0x18')]();};}function respondWithResult(_0x44632a,_0x6155e9){_0x6155e9=_0x6155e9||0xc8;return function(_0x47754c){if(_0x47754c){return _0x44632a[_0xc3f8('0x17')](_0x6155e9)[_0xc3f8('0x19')](_0x47754c);}};}function respondWithFilteredResult(_0x12b141,_0x2fd8e8){return function(_0x3cb28a){if(_0x3cb28a){var _0x2a9f64=typeof _0x2fd8e8[_0xc3f8('0x1a')]==='undefined'&&typeof _0x2fd8e8[_0xc3f8('0x1b')]==='undefined';var _0x51807b=_0x3cb28a[_0xc3f8('0x1c')];var _0x2e7c0f=_0x2a9f64?0x0:_0x2fd8e8[_0xc3f8('0x1a')];var _0xb4ab67=_0x2a9f64?_0x3cb28a['count']:_0x2fd8e8[_0xc3f8('0x1a')]+_0x2fd8e8[_0xc3f8('0x1b')];var _0x5df6f9;if(_0xb4ab67>=_0x51807b){_0xb4ab67=_0x51807b;_0x5df6f9=0xc8;}else{_0x5df6f9=0xce;}_0x12b141[_0xc3f8('0x17')](_0x5df6f9);return _0x12b141['set'](_0xc3f8('0x1d'),_0x2e7c0f+'-'+_0xb4ab67+'/'+_0x51807b)[_0xc3f8('0x19')](_0x3cb28a);}return null;};}function patchUpdates(_0x3b2e98){return function(_0x53ada5){try{jsonpatch['apply'](_0x53ada5,_0x3b2e98,!![]);}catch(_0x113cd2){return BPromise[_0xc3f8('0x1e')](_0x113cd2);}return _0x53ada5[_0xc3f8('0x1f')]();};}function saveUpdates(_0x25a4c7,_0x6522e9){return function(_0x251bf7){if(_0x251bf7){return _0x251bf7[_0xc3f8('0x20')](_0x25a4c7)[_0xc3f8('0x21')](function(_0x49aeea){return _0x49aeea;});}return null;};}function removeEntity(_0x571f92,_0x4b83f0){return function(_0x2559a4){if(_0x2559a4){return _0x2559a4['destroy']()[_0xc3f8('0x21')](function(){var _0x3f196d=_0x2559a4['get']({'plain':!![]});var _0x4569c2=_0xc3f8('0x22');return db[_0xc3f8('0x23')][_0xc3f8('0x24')]({'where':{'type':_0x4569c2,'resourceId':_0x3f196d['id']}})[_0xc3f8('0x21')](function(){return _0x2559a4;});})[_0xc3f8('0x21')](function(){_0x571f92[_0xc3f8('0x17')](0xcc)[_0xc3f8('0x18')]();});}};}function handleEntityNotFound(_0x21b002,_0xbea3b8){return function(_0x22c8e6){if(!_0x22c8e6){_0x21b002[_0xc3f8('0x16')](0x194);}return _0x22c8e6;};}function handleError(_0x238ff5,_0x429fd8){_0x429fd8=_0x429fd8||0x1f4;return function(_0x59e4dd){logger[_0xc3f8('0x25')](_0x59e4dd[_0xc3f8('0x26')]);if(_0x59e4dd[_0xc3f8('0x27')]){delete _0x59e4dd['name'];}_0x238ff5[_0xc3f8('0x17')](_0x429fd8)['send'](_0x59e4dd);};}exports[_0xc3f8('0x28')]=function(_0x32343e,_0x47ab53){var _0x48b32e={},_0x21a225={},_0x25df65={'count':0x0,'rows':[]};var _0xd32b09=_[_0xc3f8('0x29')](db[_0xc3f8('0x2a')][_0xc3f8('0x2b')],function(_0x680047){return{'name':_0x680047[_0xc3f8('0x2c')],'type':_0x680047[_0xc3f8('0x2d')][_0xc3f8('0x2e')]};});_0x21a225['model']=_[_0xc3f8('0x29')](_0xd32b09,_0xc3f8('0x27'));_0x21a225[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x32343e[_0xc3f8('0x2f')]);_0x21a225['filters']=_['intersection'](_0x21a225[_0xc3f8('0x31')],_0x21a225[_0xc3f8('0x2f')]);_0x48b32e[_0xc3f8('0x32')]=_[_0xc3f8('0x33')](_0x21a225[_0xc3f8('0x31')],qs['fields'](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x48b32e[_0xc3f8('0x32')]=_0x48b32e['attributes'][_0xc3f8('0x35')]?_0x48b32e[_0xc3f8('0x32')]:_0x21a225[_0xc3f8('0x31')];if(!_0x32343e['query'][_0xc3f8('0x36')](_0xc3f8('0x37'))){_0x48b32e['limit']=qs[_0xc3f8('0x1b')](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0x48b32e[_0xc3f8('0x1a')]=qs[_0xc3f8('0x1a')](_0x32343e[_0xc3f8('0x2f')]['offset']);}_0x48b32e[_0xc3f8('0x38')]=qs[_0xc3f8('0x39')](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x39')]);_0x48b32e[_0xc3f8('0x3a')]=qs['filters'](_[_0xc3f8('0x3b')](_0x32343e[_0xc3f8('0x2f')],_0x21a225[_0xc3f8('0x3c')]),_0xd32b09);if(_0x32343e['query'][_0xc3f8('0x3d')]){_0x48b32e[_0xc3f8('0x3a')]=_[_0xc3f8('0x3e')](_0x48b32e[_0xc3f8('0x3a')],{'$or':_['map'](_0xd32b09,function(_0x306182){if(_0x306182[_0xc3f8('0x2d')]!==_0xc3f8('0x3f')){var _0x37b104={};_0x37b104[_0x306182['name']]={'$like':'%'+_0x32343e[_0xc3f8('0x2f')]['filter']+'%'};return _0x37b104;}})});}_0x48b32e=_['merge']({},_0x48b32e,_0x32343e[_0xc3f8('0x40')]);var _0x1f3aef={'where':_0x48b32e[_0xc3f8('0x3a')]};return db[_0xc3f8('0x2a')]['count'](_0x1f3aef)['then'](function(_0x361a85){_0x25df65[_0xc3f8('0x1c')]=_0x361a85;if(_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x41')]){_0x48b32e[_0xc3f8('0x42')]=[{'all':!![]}];}return db[_0xc3f8('0x2a')][_0xc3f8('0x43')](_0x48b32e);})[_0xc3f8('0x21')](function(_0x13d8dc){_0x25df65[_0xc3f8('0x44')]=_0x13d8dc;return _0x25df65;})[_0xc3f8('0x21')](respondWithFilteredResult(_0x47ab53,_0x48b32e))['catch'](handleError(_0x47ab53,null));};exports[_0xc3f8('0x45')]=function(_0x22e9b3,_0x4b327f){var _0x1aff20={'raw':!![],'where':{'id':_0x22e9b3['params']['id']}},_0x172f1a={};_0x172f1a[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](db[_0xc3f8('0x2a')][_0xc3f8('0x2b')]);_0x172f1a[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x22e9b3[_0xc3f8('0x2f')]);_0x172f1a[_0xc3f8('0x3c')]=_[_0xc3f8('0x33')](_0x172f1a[_0xc3f8('0x31')],_0x172f1a[_0xc3f8('0x2f')]);_0x1aff20['attributes']=_[_0xc3f8('0x33')](_0x172f1a[_0xc3f8('0x31')],qs['fields'](_0x22e9b3[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x1aff20[_0xc3f8('0x32')]=_0x1aff20[_0xc3f8('0x32')]['length']?_0x1aff20['attributes']:_0x172f1a[_0xc3f8('0x31')];if(_0x22e9b3[_0xc3f8('0x2f')][_0xc3f8('0x41')]){_0x1aff20['include']=[{'all':!![]}];}_0x1aff20=_[_0xc3f8('0x3e')]({},_0x1aff20,_0x22e9b3[_0xc3f8('0x40')]);return db[_0xc3f8('0x2a')][_0xc3f8('0x46')](_0x1aff20)[_0xc3f8('0x21')](handleEntityNotFound(_0x4b327f,null))['then'](respondWithResult(_0x4b327f,null))[_0xc3f8('0x47')](handleError(_0x4b327f,null));};exports[_0xc3f8('0x48')]=function(_0x5961ab,_0x1becae){return db[_0xc3f8('0x2a')][_0xc3f8('0x48')](_0x5961ab[_0xc3f8('0x49')],{})[_0xc3f8('0x21')](function(_0x3045bc){var _0x1ca7c9=_0x5961ab['user'][_0xc3f8('0x4a')]({'plain':!![]});if(!_0x1ca7c9)throw new Error(_0xc3f8('0x4b'));if(_0x1ca7c9['role']===_0xc3f8('0x4c')){var _0x2e9f93=_0x3045bc[_0xc3f8('0x4a')]({'plain':!![]});var _0x33e5c5=_0xc3f8('0x22');return db[_0xc3f8('0x4d')][_0xc3f8('0x46')]({'where':{'name':_0x33e5c5,'userProfileId':_0x1ca7c9['userProfileId']},'raw':!![]})[_0xc3f8('0x21')](function(_0x2c6999){if(_0x2c6999&&_0x2c6999[_0xc3f8('0x4e')]===0x0){return db[_0xc3f8('0x23')][_0xc3f8('0x48')]({'name':_0x2e9f93[_0xc3f8('0x27')],'resourceId':_0x2e9f93['id'],'type':_0x2c6999[_0xc3f8('0x27')],'sectionId':_0x2c6999['id']},{})[_0xc3f8('0x21')](function(){return _0x3045bc;});}else{return _0x3045bc;}})['catch'](function(_0x51249a){logger[_0xc3f8('0x25')](_0xc3f8('0x4f'),_0x51249a);throw _0x51249a;});}return _0x3045bc;})['then'](respondWithResult(_0x1becae,0xc9))['catch'](handleError(_0x1becae,null));};exports[_0xc3f8('0x20')]=function(_0x4b4adb,_0x1b1e13){if(_0x4b4adb[_0xc3f8('0x49')]['id']){delete _0x4b4adb[_0xc3f8('0x49')]['id'];}return db['VoiceMail'][_0xc3f8('0x46')]({'where':{'id':_0x4b4adb['params']['id']}})['then'](handleEntityNotFound(_0x1b1e13,null))[_0xc3f8('0x21')](saveUpdates(_0x4b4adb['body'],null))[_0xc3f8('0x21')](respondWithResult(_0x1b1e13,null))[_0xc3f8('0x47')](handleError(_0x1b1e13,null));};exports[_0xc3f8('0x24')]=function(_0x490f37,_0xcb45c1){return db[_0xc3f8('0x2a')][_0xc3f8('0x46')]({'where':{'id':_0x490f37[_0xc3f8('0x50')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0xcb45c1,null))['then'](removeEntity(_0xcb45c1,null))['catch'](handleError(_0xcb45c1,null));};exports[_0xc3f8('0x51')]=function(_0x326dcc,_0x2f1b68,_0x3a268d){return db[_0xc3f8('0x2a')]['findOne']({'where':{'id':_0x326dcc[_0xc3f8('0x50')]['id']}})['then'](handleEntityNotFound(_0x2f1b68,null))[_0xc3f8('0x21')](function(_0x337029){var _0x163264;var _0xd5d6a7={},_0x5c6f6e={};_0x5c6f6e[_0xc3f8('0x31')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x5c6f6e['query']=_[_0xc3f8('0x30')](_0x326dcc[_0xc3f8('0x2f')]);_0x5c6f6e[_0xc3f8('0x3c')]=_[_0xc3f8('0x33')](_0x5c6f6e[_0xc3f8('0x31')],_0x5c6f6e[_0xc3f8('0x2f')]);_0xd5d6a7[_0xc3f8('0x32')]=_[_0xc3f8('0x33')](_0x5c6f6e['model'],qs[_0xc3f8('0x34')](_0x326dcc[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0xd5d6a7[_0xc3f8('0x32')]=_0xd5d6a7[_0xc3f8('0x32')]['length']?_0xd5d6a7[_0xc3f8('0x32')]:_0x5c6f6e[_0xc3f8('0x31')];if(!_0x326dcc[_0xc3f8('0x2f')][_0xc3f8('0x36')](_0xc3f8('0x37'))){_0xd5d6a7['limit']=qs[_0xc3f8('0x1b')](_0x326dcc[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0xd5d6a7[_0xc3f8('0x1a')]=qs[_0xc3f8('0x1a')](_0x326dcc[_0xc3f8('0x2f')]['offset']);}_0xd5d6a7[_0xc3f8('0x38')]=qs[_0xc3f8('0x39')](_0x326dcc[_0xc3f8('0x2f')]['sort']);_0xd5d6a7[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3c')](_['pick'](_0x326dcc['query'],_0x5c6f6e[_0xc3f8('0x3c')]));if(_0x326dcc[_0xc3f8('0x2f')]['filter']){_0xd5d6a7[_0xc3f8('0x3a')]=_[_0xc3f8('0x3e')](_0xd5d6a7[_0xc3f8('0x3a')],{'$or':_[_0xc3f8('0x29')](_0xd5d6a7[_0xc3f8('0x32')],function(_0x30a23a){var _0x1e62ec={};_0x1e62ec[_0x30a23a]={'$like':'%'+_0x326dcc[_0xc3f8('0x2f')]['filter']+'%'};return _0x1e62ec;})});}_0xd5d6a7['where']=_[_0xc3f8('0x3e')](_0xd5d6a7['where'],{'mailboxuser':_0x337029['mailbox']});_0xd5d6a7=_['merge']({},_0xd5d6a7,_0x326dcc['options']);return db['VoiceMailMessage'][_0xc3f8('0x52')](_0xd5d6a7)[_0xc3f8('0x21')](respondWithFilteredResult(_0x2f1b68,_0xd5d6a7));})[_0xc3f8('0x47')](handleError(_0x2f1b68,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index c699120..73b7ae4 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 _0xcb1a=['../../config/environment','./voiceMail.attributes','voice_voicemail','mailbox_context','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb1a,0x162));var _0xacb1=function(_0x302428,_0xab75a9){_0x302428=_0x302428-0x0;var _0x3ab52c=_0xcb1a[_0x302428];return _0x3ab52c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xacb1('0x0'))(_0xacb1('0x1'));var moment=require('moment');var BPromise=require(_0xacb1('0x2'));var rp=require(_0xacb1('0x3'));var fs=require('fs');var path=require(_0xacb1('0x4'));var rimraf=require(_0xacb1('0x5'));var config=require(_0xacb1('0x6'));var attributes=require(_0xacb1('0x7'));module['exports']=function(_0x510d7c,_0x5b0f12){return _0x510d7c['define']('VoiceMail',attributes,{'tableName':_0xacb1('0x8'),'paranoid':![],'indexes':[{'name':_0xacb1('0x9'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd235=['path','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x2a3257,_0x170ea2){var _0x1f9128=function(_0x2ebc37){while(--_0x2ebc37){_0x2a3257['push'](_0x2a3257['shift']());}};_0x1f9128(++_0x170ea2);}(_0xd235,0xbe));var _0x5d23=function(_0x3a622b,_0x56bc98){_0x3a622b=_0x3a622b-0x0;var _0x4fdf61=_0xd235[_0x3a622b];return _0x4fdf61;};'use strict';var _=require(_0x5d23('0x0'));var util=require('util');var logger=require(_0x5d23('0x1'))('api');var moment=require(_0x5d23('0x2'));var BPromise=require(_0x5d23('0x3'));var rp=require(_0x5d23('0x4'));var fs=require('fs');var path=require(_0x5d23('0x5'));var rimraf=require('rimraf');var config=require(_0x5d23('0x6'));var attributes=require(_0x5d23('0x7'));module[_0x5d23('0x8')]=function(_0x3a1e77,_0x51b845){return _0x3a1e77[_0x5d23('0x9')](_0x5d23('0xa'),attributes,{'tableName':_0x5d23('0xb'),'paranoid':![],'indexes':[{'name':_0x5d23('0xc'),'fields':[_0x5d23('0xd'),_0x5d23('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 78ce760..32055eb 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 _0x4d4f=['VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','request','VoiceMail,\x20%s,\x20%s','request\x20sent'];(function(_0x29d01e,_0x2f6293){var _0x41376c=function(_0x2798c0){while(--_0x2798c0){_0x29d01e['push'](_0x29d01e['shift']());}};_0x41376c(++_0x2f6293);}(_0x4d4f,0xa9));var _0xf4d4=function(_0x1a83da,_0x43930d){_0x1a83da=_0x1a83da-0x0;var _0x25dc87=_0x4d4f[_0x1a83da];return _0x25dc87;};'use strict';var _=require(_0xf4d4('0x0'));var util=require(_0xf4d4('0x1'));var moment=require(_0xf4d4('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4d4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf4d4('0x4'));var logger=require(_0xf4d4('0x5'))(_0xf4d4('0x6'));var config=require('../../config/environment');var jayson=require(_0xf4d4('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd857bf,_0x558895,_0x4f270e){return new BPromise(function(_0x2db89b,_0x33b119){return client[_0xf4d4('0x8')](_0xd857bf,_0x4f270e)['then'](function(_0x51a697){logger['info'](_0xf4d4('0x9'),_0x558895,_0xf4d4('0xa'));logger['debug'](_0xf4d4('0xb'),_0x558895,_0xf4d4('0xa'),JSON[_0xf4d4('0xc')](_0x51a697));if(_0x51a697[_0xf4d4('0xd')]){if(_0x51a697[_0xf4d4('0xd')][_0xf4d4('0xe')]===0x1f4){logger[_0xf4d4('0xd')](_0xf4d4('0x9'),_0x558895,_0x51a697['error']['message']);return _0x33b119(_0x51a697['error'][_0xf4d4('0xf')]);}logger[_0xf4d4('0xd')]('VoiceMail,\x20%s,\x20%s',_0x558895,_0x51a697[_0xf4d4('0xd')][_0xf4d4('0xf')]);return _0x2db89b(_0x51a697[_0xf4d4('0xd')][_0xf4d4('0xf')]);}else{logger['info'](_0xf4d4('0x9'),_0x558895,_0xf4d4('0xa'));_0x2db89b(_0x51a697[_0xf4d4('0x10')][_0xf4d4('0xf')]);}})[_0xf4d4('0x11')](function(_0x3f65dd){logger['error'](_0xf4d4('0x9'),_0x558895,_0x3f65dd);_0x33b119(_0x3f65dd);});});} \ No newline at end of file +var _0xd0d7=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x5ef5ab,_0x46ee5f){var _0x13b52f=function(_0x25ef21){while(--_0x25ef21){_0x5ef5ab['push'](_0x5ef5ab['shift']());}};_0x13b52f(++_0x46ee5f);}(_0xd0d7,0x6e));var _0x7d0d=function(_0x25383a,_0xd9b3c5){_0x25383a=_0x25383a-0x0;var _0x25fdb1=_0xd0d7[_0x25383a];return _0x25fdb1;};'use strict';var _=require(_0x7d0d('0x0'));var util=require(_0x7d0d('0x1'));var moment=require('moment');var BPromise=require(_0x7d0d('0x2'));var rs=require(_0x7d0d('0x3'));var fs=require('fs');var Redis=require(_0x7d0d('0x4'));var db=require(_0x7d0d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7d0d('0x6'))(_0x7d0d('0x7'));var config=require(_0x7d0d('0x8'));var jayson=require(_0x7d0d('0x9'));var client=jayson[_0x7d0d('0xa')][_0x7d0d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x169c71,_0x3233c0,_0x34fe3c){return new BPromise(function(_0x15aa93,_0x539052){return client[_0x7d0d('0xc')](_0x169c71,_0x34fe3c)[_0x7d0d('0xd')](function(_0x3ab39e){logger[_0x7d0d('0xe')](_0x7d0d('0xf'),_0x3233c0,_0x7d0d('0x10'));logger[_0x7d0d('0x11')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x3233c0,_0x7d0d('0x10'),JSON[_0x7d0d('0x12')](_0x3ab39e));if(_0x3ab39e[_0x7d0d('0x13')]){if(_0x3ab39e['error'][_0x7d0d('0x14')]===0x1f4){logger[_0x7d0d('0x13')](_0x7d0d('0xf'),_0x3233c0,_0x3ab39e[_0x7d0d('0x13')]['message']);return _0x539052(_0x3ab39e[_0x7d0d('0x13')]['message']);}logger['error'](_0x7d0d('0xf'),_0x3233c0,_0x3ab39e[_0x7d0d('0x13')][_0x7d0d('0x15')]);return _0x15aa93(_0x3ab39e[_0x7d0d('0x13')][_0x7d0d('0x15')]);}else{logger[_0x7d0d('0xe')](_0x7d0d('0xf'),_0x3233c0,_0x7d0d('0x10'));_0x15aa93(_0x3ab39e['result'][_0x7d0d('0x15')]);}})[_0x7d0d('0x16')](function(_0x98d5a8){logger[_0x7d0d('0x13')](_0x7d0d('0xf'),_0x3233c0,_0x98d5a8);_0x539052(_0x98d5a8);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 9b1ae20..a05afff 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 _0x27eb=['put','update','exports','multer','path','connect-timeout','express','Router','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','create'];(function(_0x41e926,_0x41dd23){var _0x4a6bb8=function(_0x1e98d7){while(--_0x1e98d7){_0x41e926['push'](_0x41e926['shift']());}};_0x4a6bb8(++_0x41dd23);}(_0x27eb,0x124));var _0xb27e=function(_0x54fd7a,_0xc09c92){_0x54fd7a=_0x54fd7a-0x0;var _0x9ceedf=_0x27eb[_0x54fd7a];return _0x9ceedf;};'use strict';var multer=require(_0xb27e('0x0'));var util=require('util');var path=require(_0xb27e('0x1'));var timeout=require(_0xb27e('0x2'));var express=require(_0xb27e('0x3'));var router=express[_0xb27e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb27e('0x5'));router[_0xb27e('0x6')]('/',auth[_0xb27e('0x7')](),controller[_0xb27e('0x8')]);router[_0xb27e('0x6')](_0xb27e('0x9'),auth['isAuthenticated'](),controller[_0xb27e('0xa')]);router[_0xb27e('0x6')](_0xb27e('0xb'),auth[_0xb27e('0x7')](),controller[_0xb27e('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb27e('0xd')]);router[_0xb27e('0xe')](_0xb27e('0x9'),auth[_0xb27e('0x7')](),controller[_0xb27e('0xf')]);router['delete'](_0xb27e('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xb27e('0x10')]=router; \ No newline at end of file +var _0xe48d=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe48d,0x69));var _0xde48=function(_0x12819f,_0x2a25df){_0x12819f=_0x12819f-0x0;var _0x3b4949=_0xe48d[_0x12819f];return _0x3b4949;};'use strict';var multer=require(_0xde48('0x0'));var util=require(_0xde48('0x1'));var path=require('path');var timeout=require(_0xde48('0x2'));var express=require(_0xde48('0x3'));var router=express[_0xde48('0x4')]();var fs_extra=require(_0xde48('0x5'));var auth=require(_0xde48('0x6'));var interaction=require(_0xde48('0x7'));var config=require('../../config/environment');var controller=require(_0xde48('0x8'));router[_0xde48('0x9')]('/',auth[_0xde48('0xa')](),controller[_0xde48('0xb')]);router[_0xde48('0x9')](_0xde48('0xc'),auth['isAuthenticated'](),controller[_0xde48('0xd')]);router[_0xde48('0x9')](_0xde48('0xe'),auth[_0xde48('0xa')](),controller[_0xde48('0xf')]);router[_0xde48('0x10')]('/',auth['isAuthenticated'](),controller[_0xde48('0x11')]);router[_0xde48('0x12')](_0xde48('0xc'),auth[_0xde48('0xa')](),controller[_0xde48('0x13')]);router[_0xde48('0x14')](_0xde48('0xc'),auth[_0xde48('0xa')](),controller[_0xde48('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 3c087ea..c49922f 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 _0x303f=['STRING','long','TIMESTAMP','literal','exports','VIRTUAL','getDataValue','INTEGER'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x303f,0x64));var _0xf303=function(_0x4847e4,_0x7d6b6c){_0x4847e4=_0x4847e4-0x0;var _0x3d01f3=_0x303f[_0x4847e4];return _0x3d01f3;};'use strict';var Sequelize=require('sequelize');module[_0xf303('0x0')]={'name':{'type':Sequelize[_0xf303('0x1')],'get':function(_0x97d76c){return this[_0xf303('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xf303('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf303('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xf303('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xf303('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xf303('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf303('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xf303('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xf303('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xf303('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf303('0x4')],'defaultValue':''},'stamp':{'type':_0xf303('0x6'),'defaultValue':Sequelize[_0xf303('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x9c47=['sequelize','exports','VIRTUAL','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x9c47,0x14a));var _0x79c4=function(_0x3a87e2,_0x158da2){_0x3a87e2=_0x3a87e2-0x0;var _0x1a26a3=_0x9c47[_0x3a87e2];return _0x1a26a3;};'use strict';var Sequelize=require(_0x79c4('0x0'));module[_0x79c4('0x1')]={'name':{'type':Sequelize[_0x79c4('0x2')],'get':function(_0x44ccb3){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x79c4('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x79c4('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x79c4('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x79c4('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x79c4('0x5')](_0x79c4('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x79c4('0x4')],'defaultValue':''},'stamp':{'type':_0x79c4('0x7'),'defaultValue':Sequelize[_0x79c4('0x8')](_0x79c4('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index ca36e22..bca1f3e 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 _0x4c14=['VIRTUAL','include','findAll','show','params','fields','includeAll','options','find','catch','body','update','download','msg_id','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','request-promise','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','error','stack','name','status','send','index','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','query','keys','intersection','attributes','length','order','sort','where','filters','pick','filter','merge'];(function(_0x4d00a7,_0x323b6c){var _0x437d72=function(_0x111928){while(--_0x111928){_0x4d00a7['push'](_0x4d00a7['shift']());}};_0x437d72(++_0x323b6c);}(_0x4c14,0x65));var _0x44c1=function(_0x44ea83,_0x33dfa3){_0x44ea83=_0x44ea83-0x0;var _0x567db1=_0x4c14[_0x44ea83];return _0x567db1;};'use strict';var emlformat=require(_0x44c1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x44c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x44c1('0x2'));var moment=require(_0x44c1('0x3'));var BPromise=require(_0x44c1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x44c1('0x5'));var csv=require(_0x44c1('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44c1('0x7'));var _=require(_0x44c1('0x8'));var squel=require(_0x44c1('0x9'));var crypto=require(_0x44c1('0xa'));var jsforce=require(_0x44c1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x44c1('0x6'));var querystring=require('querystring');var Papa=require(_0x44c1('0xc'));var Redis=require('ioredis');var authService=require(_0x44c1('0xd'));var qs=require(_0x44c1('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x44c1('0xf'))(_0x44c1('0x10'));var utils=require(_0x44c1('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x44c1('0x12'));var db=require(_0x44c1('0x13'))['db'];function respondWithStatusCode(_0x2942d3,_0x328c43){_0x328c43=_0x328c43||0xcc;return function(_0x30c889){if(_0x30c889){return _0x2942d3['sendStatus'](_0x328c43);}return _0x2942d3['status'](_0x328c43)[_0x44c1('0x14')]();};}function respondWithResult(_0x524721,_0x3b7b02){_0x3b7b02=_0x3b7b02||0xc8;return function(_0x2b44f0){if(_0x2b44f0){return _0x524721['status'](_0x3b7b02)[_0x44c1('0x15')](_0x2b44f0);}};}function respondWithFilteredResult(_0x32c278,_0x529a7a){return function(_0x525372){if(_0x525372){var _0x333904=typeof _0x529a7a[_0x44c1('0x16')]==='undefined'&&typeof _0x529a7a[_0x44c1('0x17')]===_0x44c1('0x18');var _0x1071b3=_0x525372[_0x44c1('0x19')];var _0x37b9f5=_0x333904?0x0:_0x529a7a[_0x44c1('0x16')];var _0x3875ed=_0x333904?_0x525372[_0x44c1('0x19')]:_0x529a7a[_0x44c1('0x16')]+_0x529a7a['limit'];var _0x46f2e7;if(_0x3875ed>=_0x1071b3){_0x3875ed=_0x1071b3;_0x46f2e7=0xc8;}else{_0x46f2e7=0xce;}_0x32c278['status'](_0x46f2e7);return _0x32c278[_0x44c1('0x1a')](_0x44c1('0x1b'),_0x37b9f5+'-'+_0x3875ed+'/'+_0x1071b3)[_0x44c1('0x15')](_0x525372);}return null;};}function patchUpdates(_0x42c444){return function(_0x5b0431){try{jsonpatch['apply'](_0x5b0431,_0x42c444,!![]);}catch(_0x1dc3b4){return BPromise[_0x44c1('0x1c')](_0x1dc3b4);}return _0x5b0431[_0x44c1('0x1d')]();};}function saveUpdates(_0x360d94,_0x46584a){return function(_0x335d8c){if(_0x335d8c){return _0x335d8c['update'](_0x360d94)[_0x44c1('0x1e')](function(_0x2e3b34){return _0x2e3b34;});}return null;};}function removeEntity(_0x4fc869,_0x2ca407){return function(_0x480303){if(_0x480303){return _0x480303[_0x44c1('0x1f')]()[_0x44c1('0x1e')](function(){_0x4fc869['status'](0xcc)[_0x44c1('0x14')]();});}};}function handleEntityNotFound(_0x1d20f0,_0x42d5c3){return function(_0x118116){if(!_0x118116){_0x1d20f0['sendStatus'](0x194);}return _0x118116;};}function handleError(_0x5ed499,_0x42fdb3){_0x42fdb3=_0x42fdb3||0x1f4;return function(_0x180140){logger[_0x44c1('0x20')](_0x180140[_0x44c1('0x21')]);if(_0x180140[_0x44c1('0x22')]){delete _0x180140[_0x44c1('0x22')];}_0x5ed499[_0x44c1('0x23')](_0x42fdb3)[_0x44c1('0x24')](_0x180140);};}exports[_0x44c1('0x25')]=function(_0x4ac6a1,_0x672db7){var _0x94c20d={},_0x18c85e={},_0x128cad={'count':0x0,'rows':[]};var _0x26ba1f=_[_0x44c1('0x26')](db[_0x44c1('0x27')][_0x44c1('0x28')],function(_0x1daf63){return{'name':_0x1daf63['fieldName'],'type':_0x1daf63[_0x44c1('0x29')][_0x44c1('0x2a')]};});_0x18c85e[_0x44c1('0x2b')]=_[_0x44c1('0x2c')](_[_0x44c1('0x26')](_0x26ba1f,_0x44c1('0x22')),[_0x44c1('0x22')]);_0x18c85e[_0x44c1('0x2d')]=_[_0x44c1('0x2e')](_0x4ac6a1['query']);_0x18c85e['filters']=_[_0x44c1('0x2f')](_0x18c85e[_0x44c1('0x2b')],_0x18c85e['query']);_0x94c20d[_0x44c1('0x30')]=_['intersection'](_0x18c85e[_0x44c1('0x2b')],qs['fields'](_0x4ac6a1[_0x44c1('0x2d')]['fields']));_0x94c20d[_0x44c1('0x30')]=_0x94c20d[_0x44c1('0x30')][_0x44c1('0x31')]?_0x94c20d[_0x44c1('0x30')]:_0x18c85e['model'];if(!_0x4ac6a1[_0x44c1('0x2d')]['hasOwnProperty']('nolimit')){_0x94c20d[_0x44c1('0x17')]=qs['limit'](_0x4ac6a1['query'][_0x44c1('0x17')]);_0x94c20d['offset']=qs[_0x44c1('0x16')](_0x4ac6a1[_0x44c1('0x2d')][_0x44c1('0x16')]);}_0x94c20d[_0x44c1('0x32')]=qs[_0x44c1('0x33')](_0x4ac6a1[_0x44c1('0x2d')]['sort']);_0x94c20d[_0x44c1('0x34')]=qs[_0x44c1('0x35')](_[_0x44c1('0x36')](_0x4ac6a1['query'],_0x18c85e[_0x44c1('0x35')]),_0x26ba1f);if(_0x4ac6a1[_0x44c1('0x2d')][_0x44c1('0x37')]){_0x94c20d[_0x44c1('0x34')]=_[_0x44c1('0x38')](_0x94c20d['where'],{'$or':_['map'](_0x26ba1f,function(_0x3a6523){if(_0x3a6523[_0x44c1('0x29')]!==_0x44c1('0x39')){var _0x1f1c74={};_0x1f1c74[_0x3a6523['name']]={'$like':'%'+_0x4ac6a1[_0x44c1('0x2d')][_0x44c1('0x37')]+'%'};return _0x1f1c74;}})});}_0x94c20d=_[_0x44c1('0x38')]({},_0x94c20d,_0x4ac6a1['options']);var _0x4e8b30={'where':_0x94c20d[_0x44c1('0x34')]};return db[_0x44c1('0x27')]['count'](_0x4e8b30)[_0x44c1('0x1e')](function(_0x10655a){_0x128cad['count']=_0x10655a;if(_0x4ac6a1[_0x44c1('0x2d')]['includeAll']){_0x94c20d[_0x44c1('0x3a')]=[{'all':!![]}];}return db[_0x44c1('0x27')][_0x44c1('0x3b')](_0x94c20d);})['then'](function(_0x3d242a){_0x128cad['rows']=_0x3d242a;return _0x128cad;})[_0x44c1('0x1e')](respondWithFilteredResult(_0x672db7,_0x94c20d))['catch'](handleError(_0x672db7,null));};exports[_0x44c1('0x3c')]=function(_0x335c6f,_0x69f2d6){var _0x35ce9a={'raw':!![],'where':{'id':_0x335c6f[_0x44c1('0x3d')]['id']}},_0x376e0a={};_0x376e0a[_0x44c1('0x2b')]=_['keys'](db[_0x44c1('0x27')][_0x44c1('0x28')]);_0x376e0a[_0x44c1('0x2d')]=_[_0x44c1('0x2e')](_0x335c6f[_0x44c1('0x2d')]);_0x376e0a[_0x44c1('0x35')]=_[_0x44c1('0x2f')](_0x376e0a[_0x44c1('0x2b')],_0x376e0a['query']);_0x35ce9a[_0x44c1('0x30')]=_[_0x44c1('0x2f')](_0x376e0a[_0x44c1('0x2b')],qs[_0x44c1('0x3e')](_0x335c6f[_0x44c1('0x2d')][_0x44c1('0x3e')]));_0x35ce9a['attributes']=_0x35ce9a['attributes'][_0x44c1('0x31')]?_0x35ce9a[_0x44c1('0x30')]:_0x376e0a[_0x44c1('0x2b')];if(_0x335c6f[_0x44c1('0x2d')][_0x44c1('0x3f')]){_0x35ce9a[_0x44c1('0x3a')]=[{'all':!![]}];}_0x35ce9a=_[_0x44c1('0x38')]({},_0x35ce9a,_0x335c6f[_0x44c1('0x40')]);return db[_0x44c1('0x27')][_0x44c1('0x41')](_0x35ce9a)[_0x44c1('0x1e')](handleEntityNotFound(_0x69f2d6,null))[_0x44c1('0x1e')](respondWithResult(_0x69f2d6,null))[_0x44c1('0x42')](handleError(_0x69f2d6,null));};exports['create']=function(_0x182d82,_0x447349){return db[_0x44c1('0x27')]['create'](_0x182d82[_0x44c1('0x43')],{})[_0x44c1('0x1e')](respondWithResult(_0x447349,0xc9))['catch'](handleError(_0x447349,null));};exports[_0x44c1('0x44')]=function(_0x527925,_0x386e93){if(_0x527925[_0x44c1('0x43')]['id']){delete _0x527925[_0x44c1('0x43')]['id'];}return db['VoiceMailMessage'][_0x44c1('0x41')]({'where':{'id':_0x527925[_0x44c1('0x3d')]['id']}})[_0x44c1('0x1e')](handleEntityNotFound(_0x386e93,null))[_0x44c1('0x1e')](saveUpdates(_0x527925[_0x44c1('0x43')],null))[_0x44c1('0x1e')](respondWithResult(_0x386e93,null))[_0x44c1('0x42')](handleError(_0x386e93,null));};exports[_0x44c1('0x1f')]=function(_0x310a6c,_0x234e95){return db[_0x44c1('0x27')][_0x44c1('0x41')]({'where':{'id':_0x310a6c['params']['id']}})[_0x44c1('0x1e')](handleEntityNotFound(_0x234e95,null))[_0x44c1('0x1e')](removeEntity(_0x234e95,null))[_0x44c1('0x42')](handleError(_0x234e95,null));};exports[_0x44c1('0x45')]=function(_0x5f1888,_0x16bfa4,_0x4cd9e3){return db[_0x44c1('0x27')][_0x44c1('0x41')]({'where':{'id':_0x5f1888[_0x44c1('0x3d')]['id']},'attributes':['id','recording',_0x44c1('0x46')]})[_0x44c1('0x1e')](handleEntityNotFound(_0x16bfa4,null))[_0x44c1('0x1e')](function(_0x47a6aa){if(_0x47a6aa){if(!_0x47a6aa[_0x44c1('0x47')]){throw new db[(_0x44c1('0x48'))]['ValidationError'](_0x44c1('0x49'));}var _0x14168f={'Content-Type':_0x44c1('0x4a'),'Content-Disposition':_0x44c1('0x4b')};if(_0x47a6aa[_0x44c1('0x46')]){_0x14168f[_0x44c1('0x4c')]=_0x44c1('0x4d')+_0x47a6aa[_0x44c1('0x46')]+_0x44c1('0x4e');}_0x16bfa4[_0x44c1('0x1a')](_0x14168f);return _0x16bfa4[_0x44c1('0x24')](new Buffer(_0x47a6aa[_0x44c1('0x47')]));}})[_0x44c1('0x42')](handleError(_0x16bfa4,null));}; \ No newline at end of file +var _0x491c=['status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','name','send','index','VoiceMailMessage','fieldName','key','model','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','attachment;\x20filename=\x22','.wav\x22','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x3fb731,_0x2baf6d){var _0x139aac=function(_0x1c835e){while(--_0x1c835e){_0x3fb731['push'](_0x3fb731['shift']());}};_0x139aac(++_0x2baf6d);}(_0x491c,0x96));var _0xc491=function(_0x3387b8,_0x992fdb){_0x3387b8=_0x3387b8-0x0;var _0x3354c3=_0x491c[_0x3387b8];return _0x3354c3;};'use strict';var emlformat=require(_0xc491('0x0'));var rimraf=require(_0xc491('0x1'));var zipdir=require(_0xc491('0x2'));var jsonpatch=require(_0xc491('0x3'));var rp=require(_0xc491('0x4'));var moment=require(_0xc491('0x5'));var BPromise=require(_0xc491('0x6'));var Mustache=require(_0xc491('0x7'));var util=require('util');var path=require(_0xc491('0x8'));var sox=require(_0xc491('0x9'));var csv=require('to-csv');var ejs=require(_0xc491('0xa'));var fs=require('fs');var fs_extra=require(_0xc491('0xb'));var _=require(_0xc491('0xc'));var squel=require(_0xc491('0xd'));var crypto=require(_0xc491('0xe'));var jsforce=require(_0xc491('0xf'));var deskjs=require(_0xc491('0x10'));var toCsv=require(_0xc491('0x11'));var querystring=require(_0xc491('0x12'));var Papa=require(_0xc491('0x13'));var Redis=require(_0xc491('0x14'));var authService=require(_0xc491('0x15'));var qs=require(_0xc491('0x16'));var as=require(_0xc491('0x17'));var hardwareService=require(_0xc491('0x18'));var logger=require(_0xc491('0x19'))(_0xc491('0x1a'));var utils=require(_0xc491('0x1b'));var config=require(_0xc491('0x1c'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19d170,_0xa3cd34){_0xa3cd34=_0xa3cd34||0xcc;return function(_0x263b28){if(_0x263b28){return _0x19d170[_0xc491('0x1d')](_0xa3cd34);}return _0x19d170[_0xc491('0x1e')](_0xa3cd34)[_0xc491('0x1f')]();};}function respondWithResult(_0x422ff7,_0x5538bb){_0x5538bb=_0x5538bb||0xc8;return function(_0x48b948){if(_0x48b948){return _0x422ff7[_0xc491('0x1e')](_0x5538bb)[_0xc491('0x20')](_0x48b948);}};}function respondWithFilteredResult(_0x4271a0,_0x4c081b){return function(_0x44e6ca){if(_0x44e6ca){var _0x1330c3=typeof _0x4c081b[_0xc491('0x21')]===_0xc491('0x22')&&typeof _0x4c081b[_0xc491('0x23')]===_0xc491('0x22');var _0x370fba=_0x44e6ca[_0xc491('0x24')];var _0x1f3868=_0x1330c3?0x0:_0x4c081b[_0xc491('0x21')];var _0x56b9e4=_0x1330c3?_0x44e6ca[_0xc491('0x24')]:_0x4c081b['offset']+_0x4c081b[_0xc491('0x23')];var _0x24f62e;if(_0x56b9e4>=_0x370fba){_0x56b9e4=_0x370fba;_0x24f62e=0xc8;}else{_0x24f62e=0xce;}_0x4271a0[_0xc491('0x1e')](_0x24f62e);return _0x4271a0['set']('Content-Range',_0x1f3868+'-'+_0x56b9e4+'/'+_0x370fba)[_0xc491('0x20')](_0x44e6ca);}return null;};}function patchUpdates(_0x35f6f7){return function(_0x12c33e){try{jsonpatch[_0xc491('0x25')](_0x12c33e,_0x35f6f7,!![]);}catch(_0x21f8fe){return BPromise[_0xc491('0x26')](_0x21f8fe);}return _0x12c33e[_0xc491('0x27')]();};}function saveUpdates(_0x13d13a,_0x45e408){return function(_0x2c58bd){if(_0x2c58bd){return _0x2c58bd[_0xc491('0x28')](_0x13d13a)[_0xc491('0x29')](function(_0x2f65db){return _0x2f65db;});}return null;};}function removeEntity(_0x1c9d25,_0x1ac74e){return function(_0x258240){if(_0x258240){return _0x258240['destroy']()['then'](function(){_0x1c9d25[_0xc491('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36b616,_0x106750){return function(_0x2e74e7){if(!_0x2e74e7){_0x36b616[_0xc491('0x1d')](0x194);}return _0x2e74e7;};}function handleError(_0x3a4cfe,_0x3154e4){_0x3154e4=_0x3154e4||0x1f4;return function(_0x241c46){logger['error'](_0x241c46['stack']);if(_0x241c46[_0xc491('0x2a')]){delete _0x241c46[_0xc491('0x2a')];}_0x3a4cfe[_0xc491('0x1e')](_0x3154e4)[_0xc491('0x2b')](_0x241c46);};}exports[_0xc491('0x2c')]=function(_0x4d5b11,_0x100674){var _0x3f817f={},_0x235098={},_0x1bbbf6={'count':0x0,'rows':[]};var _0x388e5b=_['map'](db[_0xc491('0x2d')]['rawAttributes'],function(_0x9f852){return{'name':_0x9f852[_0xc491('0x2e')],'type':_0x9f852['type'][_0xc491('0x2f')]};});_0x235098[_0xc491('0x30')]=_[_0xc491('0x31')](_['map'](_0x388e5b,'name'),['name']);_0x235098[_0xc491('0x32')]=_[_0xc491('0x33')](_0x4d5b11[_0xc491('0x32')]);_0x235098['filters']=_[_0xc491('0x34')](_0x235098['model'],_0x235098[_0xc491('0x32')]);_0x3f817f[_0xc491('0x35')]=_[_0xc491('0x34')](_0x235098[_0xc491('0x30')],qs[_0xc491('0x36')](_0x4d5b11[_0xc491('0x32')][_0xc491('0x36')]));_0x3f817f[_0xc491('0x35')]=_0x3f817f[_0xc491('0x35')][_0xc491('0x37')]?_0x3f817f['attributes']:_0x235098[_0xc491('0x30')];if(!_0x4d5b11[_0xc491('0x32')][_0xc491('0x38')](_0xc491('0x39'))){_0x3f817f[_0xc491('0x23')]=qs['limit'](_0x4d5b11[_0xc491('0x32')][_0xc491('0x23')]);_0x3f817f[_0xc491('0x21')]=qs[_0xc491('0x21')](_0x4d5b11[_0xc491('0x32')][_0xc491('0x21')]);}_0x3f817f[_0xc491('0x3a')]=qs['sort'](_0x4d5b11[_0xc491('0x32')][_0xc491('0x3b')]);_0x3f817f[_0xc491('0x3c')]=qs[_0xc491('0x3d')](_[_0xc491('0x3e')](_0x4d5b11[_0xc491('0x32')],_0x235098[_0xc491('0x3d')]),_0x388e5b);if(_0x4d5b11[_0xc491('0x32')][_0xc491('0x3f')]){_0x3f817f[_0xc491('0x3c')]=_[_0xc491('0x40')](_0x3f817f[_0xc491('0x3c')],{'$or':_['map'](_0x388e5b,function(_0x1ec230){if(_0x1ec230[_0xc491('0x41')]!==_0xc491('0x42')){var _0xcdfd3d={};_0xcdfd3d[_0x1ec230['name']]={'$like':'%'+_0x4d5b11[_0xc491('0x32')][_0xc491('0x3f')]+'%'};return _0xcdfd3d;}})});}_0x3f817f=_[_0xc491('0x40')]({},_0x3f817f,_0x4d5b11[_0xc491('0x43')]);var _0x3e1749={'where':_0x3f817f[_0xc491('0x3c')]};return db['VoiceMailMessage']['count'](_0x3e1749)[_0xc491('0x29')](function(_0x580455){_0x1bbbf6['count']=_0x580455;if(_0x4d5b11['query']['includeAll']){_0x3f817f[_0xc491('0x44')]=[{'all':!![]}];}return db[_0xc491('0x2d')][_0xc491('0x45')](_0x3f817f);})[_0xc491('0x29')](function(_0x523c5c){_0x1bbbf6[_0xc491('0x46')]=_0x523c5c;return _0x1bbbf6;})[_0xc491('0x29')](respondWithFilteredResult(_0x100674,_0x3f817f))[_0xc491('0x47')](handleError(_0x100674,null));};exports[_0xc491('0x48')]=function(_0x4d9402,_0x29f14e){var _0x2cfaf9={'raw':!![],'where':{'id':_0x4d9402[_0xc491('0x49')]['id']}},_0x5b59d9={};_0x5b59d9[_0xc491('0x30')]=_['keys'](db['VoiceMailMessage'][_0xc491('0x4a')]);_0x5b59d9['query']=_['keys'](_0x4d9402[_0xc491('0x32')]);_0x5b59d9['filters']=_[_0xc491('0x34')](_0x5b59d9[_0xc491('0x30')],_0x5b59d9[_0xc491('0x32')]);_0x2cfaf9[_0xc491('0x35')]=_['intersection'](_0x5b59d9[_0xc491('0x30')],qs[_0xc491('0x36')](_0x4d9402[_0xc491('0x32')][_0xc491('0x36')]));_0x2cfaf9[_0xc491('0x35')]=_0x2cfaf9['attributes'][_0xc491('0x37')]?_0x2cfaf9[_0xc491('0x35')]:_0x5b59d9[_0xc491('0x30')];if(_0x4d9402[_0xc491('0x32')][_0xc491('0x4b')]){_0x2cfaf9[_0xc491('0x44')]=[{'all':!![]}];}_0x2cfaf9=_['merge']({},_0x2cfaf9,_0x4d9402[_0xc491('0x43')]);return db[_0xc491('0x2d')][_0xc491('0x4c')](_0x2cfaf9)[_0xc491('0x29')](handleEntityNotFound(_0x29f14e,null))[_0xc491('0x29')](respondWithResult(_0x29f14e,null))[_0xc491('0x47')](handleError(_0x29f14e,null));};exports[_0xc491('0x4d')]=function(_0x3d59b1,_0x1e0419){return db[_0xc491('0x2d')][_0xc491('0x4d')](_0x3d59b1['body'],{})[_0xc491('0x29')](respondWithResult(_0x1e0419,0xc9))['catch'](handleError(_0x1e0419,null));};exports[_0xc491('0x28')]=function(_0x5aaf0c,_0x25a605){if(_0x5aaf0c[_0xc491('0x4e')]['id']){delete _0x5aaf0c['body']['id'];}return db[_0xc491('0x2d')][_0xc491('0x4c')]({'where':{'id':_0x5aaf0c[_0xc491('0x49')]['id']}})[_0xc491('0x29')](handleEntityNotFound(_0x25a605,null))['then'](saveUpdates(_0x5aaf0c['body'],null))[_0xc491('0x29')](respondWithResult(_0x25a605,null))[_0xc491('0x47')](handleError(_0x25a605,null));};exports[_0xc491('0x4f')]=function(_0x3756ec,_0x4a1bda){return db[_0xc491('0x2d')][_0xc491('0x4c')]({'where':{'id':_0x3756ec['params']['id']}})[_0xc491('0x29')](handleEntityNotFound(_0x4a1bda,null))[_0xc491('0x29')](removeEntity(_0x4a1bda,null))[_0xc491('0x47')](handleError(_0x4a1bda,null));};exports[_0xc491('0x50')]=function(_0x5ab7c4,_0x5d4d00,_0x3242ab){return db[_0xc491('0x2d')]['find']({'where':{'id':_0x5ab7c4[_0xc491('0x49')]['id']},'attributes':['id',_0xc491('0x51'),_0xc491('0x52')]})[_0xc491('0x29')](handleEntityNotFound(_0x5d4d00,null))[_0xc491('0x29')](function(_0xadb863){if(_0xadb863){if(!_0xadb863[_0xc491('0x51')]){throw new db[(_0xc491('0x53'))][(_0xc491('0x54'))](_0xc491('0x55'));}var _0x2744d4={'Content-Type':'audio/wav','Content-Disposition':_0xc491('0x56')};if(_0xadb863[_0xc491('0x52')]){_0x2744d4['Content-Disposition']=_0xc491('0x57')+_0xadb863[_0xc491('0x52')]+_0xc491('0x58');}_0x5d4d00[_0xc491('0x59')](_0x2744d4);return _0x5d4d00[_0xc491('0x2b')](new Buffer(_0xadb863[_0xc491('0x51')]));}})[_0xc491('0x47')](handleError(_0x5d4d00,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 0e6947e..b4aa906 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 _0xdfda=['../../config/environment','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','api','bluebird','path','rimraf'];(function(_0x3873e2,_0x1190ea){var _0x4e1895=function(_0x151358){while(--_0x151358){_0x3873e2['push'](_0x3873e2['shift']());}};_0x4e1895(++_0x1190ea);}(_0xdfda,0x1e9));var _0xadfd=function(_0x44cf10,_0x1acc6c){_0x44cf10=_0x44cf10-0x0;var _0x249719=_0xdfda[_0x44cf10];return _0x249719;};'use strict';var _=require(_0xadfd('0x0'));var util=require('util');var logger=require(_0xadfd('0x1'))(_0xadfd('0x2'));var moment=require('moment');var BPromise=require(_0xadfd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xadfd('0x4'));var rimraf=require(_0xadfd('0x5'));var config=require(_0xadfd('0x6'));var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x18df0b,_0x5dc96b){return _0x18df0b[_0xadfd('0x7')](_0xadfd('0x8'),attributes,{'tableName':_0xadfd('0x9'),'paranoid':![],'indexes':[{'name':_0xadfd('0xa'),'fields':[_0xadfd('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x72f3=['../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x72f3,0x18d));var _0x372f=function(_0x63637,_0x3a20b3){_0x63637=_0x63637-0x0;var _0x3e1fa3=_0x72f3[_0x63637];return _0x3e1fa3;};'use strict';var _=require(_0x372f('0x0'));var util=require(_0x372f('0x1'));var logger=require('../../config/logger')(_0x372f('0x2'));var moment=require(_0x372f('0x3'));var BPromise=require(_0x372f('0x4'));var rp=require(_0x372f('0x5'));var fs=require('fs');var path=require(_0x372f('0x6'));var rimraf=require(_0x372f('0x7'));var config=require(_0x372f('0x8'));var attributes=require(_0x372f('0x9'));module[_0x372f('0xa')]=function(_0x3d1c6b,_0x36f07f){return _0x3d1c6b[_0x372f('0xb')](_0x372f('0xc'),attributes,{'tableName':_0x372f('0xd'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x372f('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index fabd1c1..27142df 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 _0x12b2=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x12b2,0x68));var _0x212b=function(_0x54a68c,_0xc03095){_0x54a68c=_0x54a68c-0x0;var _0x311109=_0x12b2[_0x54a68c];return _0x311109;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x212b('0x0'));var BPromise=require(_0x212b('0x1'));var rs=require(_0x212b('0x2'));var fs=require('fs');var Redis=require(_0x212b('0x3'));var db=require(_0x212b('0x4'))['db'];var utils=require(_0x212b('0x5'));var logger=require(_0x212b('0x6'))(_0x212b('0x7'));var config=require(_0x212b('0x8'));var jayson=require(_0x212b('0x9'));var client=jayson[_0x212b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5de0d6,_0x257a8f,_0x439605){return new BPromise(function(_0x597082,_0x18d008){return client['request'](_0x5de0d6,_0x439605)[_0x212b('0xb')](function(_0x16b04d){logger[_0x212b('0xc')](_0x212b('0xd'),_0x257a8f,_0x212b('0xe'));logger['debug'](_0x212b('0xf'),_0x257a8f,'request\x20sent',JSON[_0x212b('0x10')](_0x16b04d));if(_0x16b04d[_0x212b('0x11')]){if(_0x16b04d[_0x212b('0x11')][_0x212b('0x12')]===0x1f4){logger[_0x212b('0x11')](_0x212b('0xd'),_0x257a8f,_0x16b04d[_0x212b('0x11')]['message']);return _0x18d008(_0x16b04d[_0x212b('0x11')]['message']);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x257a8f,_0x16b04d[_0x212b('0x11')][_0x212b('0x13')]);return _0x597082(_0x16b04d[_0x212b('0x11')]['message']);}else{logger[_0x212b('0xc')](_0x212b('0xd'),_0x257a8f,'request\x20sent');_0x597082(_0x16b04d[_0x212b('0x14')]['message']);}})[_0x212b('0x15')](function(_0x3cf461){logger[_0x212b('0x11')](_0x212b('0xd'),_0x257a8f,_0x3cf461);_0x18d008(_0x3cf461);});});} \ No newline at end of file +var _0x71b2=['rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x34a00a,_0x20be50){var _0x2172eb=function(_0x491e0e){while(--_0x491e0e){_0x34a00a['push'](_0x34a00a['shift']());}};_0x2172eb(++_0x20be50);}(_0x71b2,0x10c));var _0x271b=function(_0x1fa873,_0x1319ab){_0x1fa873=_0x1fa873-0x0;var _0x599fbc=_0x71b2[_0x1fa873];return _0x599fbc;};'use strict';var _=require(_0x271b('0x0'));var util=require(_0x271b('0x1'));var moment=require(_0x271b('0x2'));var BPromise=require(_0x271b('0x3'));var rs=require(_0x271b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x271b('0x5'))['db'];var utils=require(_0x271b('0x6'));var logger=require(_0x271b('0x7'))(_0x271b('0x8'));var config=require(_0x271b('0x9'));var jayson=require(_0x271b('0xa'));var client=jayson['client'][_0x271b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a4109,_0xa672b9,_0x11ad9b){return new BPromise(function(_0x52b758,_0x2a983e){return client[_0x271b('0xc')](_0x3a4109,_0x11ad9b)[_0x271b('0xd')](function(_0x3114b9){logger[_0x271b('0xe')](_0x271b('0xf'),_0xa672b9,_0x271b('0x10'));logger['debug'](_0x271b('0x11'),_0xa672b9,_0x271b('0x10'),JSON['stringify'](_0x3114b9));if(_0x3114b9[_0x271b('0x12')]){if(_0x3114b9[_0x271b('0x12')][_0x271b('0x13')]===0x1f4){logger[_0x271b('0x12')](_0x271b('0xf'),_0xa672b9,_0x3114b9[_0x271b('0x12')][_0x271b('0x14')]);return _0x2a983e(_0x3114b9['error'][_0x271b('0x14')]);}logger[_0x271b('0x12')](_0x271b('0xf'),_0xa672b9,_0x3114b9[_0x271b('0x12')][_0x271b('0x14')]);return _0x52b758(_0x3114b9[_0x271b('0x12')][_0x271b('0x14')]);}else{logger['info'](_0x271b('0xf'),_0xa672b9,'request\x20sent');_0x52b758(_0x3114b9[_0x271b('0x15')][_0x271b('0x14')]);}})[_0x271b('0x16')](function(_0x1bcc05){logger['error'](_0x271b('0xf'),_0xa672b9,_0x1bcc05);_0x2a983e(_0x1bcc05);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index e7fc5e6..94403c6 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 _0xf968=['/:id/sounds','post','create','addSound','put','update','destroy','delete','removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id'];(function(_0x5581f6,_0x4749fb){var _0x32f62a=function(_0xecfdb5){while(--_0xecfdb5){_0x5581f6['push'](_0x5581f6['shift']());}};_0x32f62a(++_0x4749fb);}(_0xf968,0x15a));var _0x8f96=function(_0x1c4b44,_0x5a7310){_0x1c4b44=_0x1c4b44-0x0;var _0x6bb2a8=_0xf968[_0x1c4b44];return _0x6bb2a8;};'use strict';var multer=require(_0x8f96('0x0'));var util=require(_0x8f96('0x1'));var path=require(_0x8f96('0x2'));var timeout=require(_0x8f96('0x3'));var express=require(_0x8f96('0x4'));var router=express[_0x8f96('0x5')]();var fs_extra=require(_0x8f96('0x6'));var auth=require(_0x8f96('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8f96('0x8'));var controller=require(_0x8f96('0x9'));router['get']('/',auth[_0x8f96('0xa')](),controller[_0x8f96('0xb')]);router[_0x8f96('0xc')](_0x8f96('0xd'),auth[_0x8f96('0xa')](),controller['show']);router[_0x8f96('0xc')](_0x8f96('0xe'),auth['isAuthenticated'](),controller['getSounds']);router[_0x8f96('0xf')]('/',auth[_0x8f96('0xa')](),controller[_0x8f96('0x10')]);router[_0x8f96('0xf')](_0x8f96('0xe'),auth['isAuthenticated'](),controller[_0x8f96('0x11')]);router[_0x8f96('0x12')](_0x8f96('0xd'),auth[_0x8f96('0xa')](),controller[_0x8f96('0x13')]);router['delete'](_0x8f96('0xd'),auth[_0x8f96('0xa')](),controller[_0x8f96('0x14')]);router[_0x8f96('0x15')]('/:id/sounds/:id2',auth[_0x8f96('0xa')](),controller[_0x8f96('0x16')]);module[_0x8f96('0x17')]=router; \ No newline at end of file +var _0xe048=['isAuthenticated','index','get','/:id','/:id/sounds','create','addSound','put','destroy','delete','/:id/sounds/:id2','removeSound','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x46d310,_0x19d58a){var _0x302a4f=function(_0xc05cbc){while(--_0xc05cbc){_0x46d310['push'](_0x46d310['shift']());}};_0x302a4f(++_0x19d58a);}(_0xe048,0x98));var _0x8e04=function(_0x5e67a2,_0x73315b){_0x5e67a2=_0x5e67a2-0x0;var _0x168355=_0xe048[_0x5e67a2];return _0x168355;};'use strict';var multer=require(_0x8e04('0x0'));var util=require(_0x8e04('0x1'));var path=require(_0x8e04('0x2'));var timeout=require(_0x8e04('0x3'));var express=require(_0x8e04('0x4'));var router=express[_0x8e04('0x5')]();var fs_extra=require(_0x8e04('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8e04('0x7'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0x8e04('0x8')](),controller[_0x8e04('0x9')]);router[_0x8e04('0xa')](_0x8e04('0xb'),auth[_0x8e04('0x8')](),controller['show']);router[_0x8e04('0xa')](_0x8e04('0xc'),auth[_0x8e04('0x8')](),controller['getSounds']);router['post']('/',auth[_0x8e04('0x8')](),controller[_0x8e04('0xd')]);router['post'](_0x8e04('0xc'),auth['isAuthenticated'](),controller[_0x8e04('0xe')]);router[_0x8e04('0xf')]('/:id',auth[_0x8e04('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8e04('0x10')]);router[_0x8e04('0x11')](_0x8e04('0x12'),auth[_0x8e04('0x8')](),controller[_0x8e04('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 23ed1f3..a1d755e 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 _0x627a=['name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING'];(function(_0x1d030b,_0x473e46){var _0xa05fff=function(_0x16faf1){while(--_0x16faf1){_0x1d030b['push'](_0x1d030b['shift']());}};_0xa05fff(++_0x473e46);}(_0x627a,0x65));var _0xa627=function(_0x10cc5d,_0x145b14){_0x10cc5d=_0x10cc5d-0x0;var _0x387c48=_0x627a[_0x10cc5d];return _0x387c48;};'use strict';var Sequelize=require(_0xa627('0x0'));module[_0xa627('0x1')]={'name':{'type':Sequelize[_0xa627('0x2')],'allowNull':![],'unique':_0xa627('0x3')},'mode':{'type':Sequelize[_0xa627('0x4')](_0xa627('0x5'),_0xa627('0x6'),_0xa627('0x7'),_0xa627('0x8'),_0xa627('0x9'),'mp3'),'allowNull':!![],'defaultValue':_0xa627('0x6')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xa627('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa627('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa627('0xa')},'format':{'type':Sequelize[_0xa627('0x2')],'allowNull':!![]},'stamp':{'type':_0xa627('0xb')},'defaultEntry':{'type':Sequelize[_0xa627('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbb49=['STRING','ENUM','mp3nb','quietmp3nb','quietmp3','mp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize','exports'];(function(_0x3aef9b,_0x4a52c5){var _0x5613f9=function(_0x2f4bc0){while(--_0x2f4bc0){_0x3aef9b['push'](_0x3aef9b['shift']());}};_0x5613f9(++_0x4a52c5);}(_0xbb49,0x1c6));var _0x9bb4=function(_0x5933bb,_0x546730){_0x5933bb=_0x5933bb-0x0;var _0x193a96=_0xbb49[_0x5933bb];return _0x193a96;};'use strict';var Sequelize=require(_0x9bb4('0x0'));module[_0x9bb4('0x1')]={'name':{'type':Sequelize[_0x9bb4('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x9bb4('0x3')]('custom','files',_0x9bb4('0x4'),_0x9bb4('0x5'),_0x9bb4('0x6'),_0x9bb4('0x7')),'allowNull':!![],'defaultValue':_0x9bb4('0x8')},'directory':{'type':Sequelize[_0x9bb4('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x9bb4('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x9bb4('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9bb4('0x9')},'format':{'type':Sequelize[_0x9bb4('0x2')],'allowNull':!![]},'stamp':{'type':_0x9bb4('0xa')},'defaultEntry':{'type':Sequelize[_0x9bb4('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 0732ade..dbeb64c 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 _0x4d21=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','basename','%s.%s','symlinkSync','removeSound','id2','getSounds','map','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','destroy','then','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','body','create','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0x4d21,0x16b));var _0x14d2=function(_0x47b0a4,_0x457d86){_0x47b0a4=_0x47b0a4-0x0;var _0x2296bd=_0x4d21[_0x47b0a4];return _0x2296bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x14d2('0x0'));var jsonpatch=require(_0x14d2('0x1'));var rp=require(_0x14d2('0x2'));var moment=require(_0x14d2('0x3'));var BPromise=require(_0x14d2('0x4'));var Mustache=require(_0x14d2('0x5'));var util=require(_0x14d2('0x6'));var path=require(_0x14d2('0x7'));var sox=require(_0x14d2('0x8'));var csv=require(_0x14d2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14d2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x14d2('0x9'));var querystring=require('querystring');var Papa=require(_0x14d2('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x14d2('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14d2('0xd'));var logger=require(_0x14d2('0xe'))(_0x14d2('0xf'));var utils=require(_0x14d2('0x10'));var config=require(_0x14d2('0x11'));var licenseUtil=require(_0x14d2('0x12'));var db=require(_0x14d2('0x13'))['db'];function respondWithStatusCode(_0x29b5d3,_0x353005){_0x353005=_0x353005||0xcc;return function(_0x551d3f){if(_0x551d3f){return _0x29b5d3['sendStatus'](_0x353005);}return _0x29b5d3[_0x14d2('0x14')](_0x353005)[_0x14d2('0x15')]();};}function respondWithResult(_0x24dd6c,_0x473ba5){_0x473ba5=_0x473ba5||0xc8;return function(_0x54e749){if(_0x54e749){return _0x24dd6c[_0x14d2('0x14')](_0x473ba5)['json'](_0x54e749);}};}function respondWithFilteredResult(_0x5cf63f,_0x1a19f2){return function(_0x30422b){if(_0x30422b){var _0x5ee0ad=typeof _0x1a19f2['offset']===_0x14d2('0x16')&&typeof _0x1a19f2[_0x14d2('0x17')]===_0x14d2('0x16');var _0x26c883=_0x30422b[_0x14d2('0x18')];var _0x1ce541=_0x5ee0ad?0x0:_0x1a19f2[_0x14d2('0x19')];var _0x22bb1d=_0x5ee0ad?_0x30422b[_0x14d2('0x18')]:_0x1a19f2[_0x14d2('0x19')]+_0x1a19f2[_0x14d2('0x17')];var _0x280a97;if(_0x22bb1d>=_0x26c883){_0x22bb1d=_0x26c883;_0x280a97=0xc8;}else{_0x280a97=0xce;}_0x5cf63f[_0x14d2('0x14')](_0x280a97);return _0x5cf63f[_0x14d2('0x1a')](_0x14d2('0x1b'),_0x1ce541+'-'+_0x22bb1d+'/'+_0x26c883)[_0x14d2('0x1c')](_0x30422b);}return null;};}function patchUpdates(_0x1dbd68){return function(_0x226c74){try{jsonpatch[_0x14d2('0x1d')](_0x226c74,_0x1dbd68,!![]);}catch(_0x5a2a67){return BPromise[_0x14d2('0x1e')](_0x5a2a67);}return _0x226c74['save']();};}function saveUpdates(_0x1d74b4,_0x13b1e5){return function(_0x32161d){if(_0x32161d){return _0x32161d[_0x14d2('0x1f')](_0x1d74b4)['then'](function(_0x1bd264){return _0x1bd264;});}return null;};}function removeEntity(_0x2d458,_0x577921){return function(_0x384a86){if(_0x384a86){return _0x384a86[_0x14d2('0x20')]()[_0x14d2('0x21')](function(){var _0x25401b=_0x384a86[_0x14d2('0x22')]({'plain':!![]});var _0x2cea71=_0x14d2('0x23');return db[_0x14d2('0x24')][_0x14d2('0x20')]({'where':{'type':_0x2cea71,'resourceId':_0x25401b['id']}})[_0x14d2('0x21')](function(){return _0x384a86;});})['then'](function(){_0x2d458['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11198e,_0x110ec5){return function(_0x3bd145){if(!_0x3bd145){_0x11198e['sendStatus'](0x194);}return _0x3bd145;};}function handleError(_0x47dd62,_0x544652){_0x544652=_0x544652||0x1f4;return function(_0x2c76e3){logger[_0x14d2('0x25')](_0x2c76e3[_0x14d2('0x26')]);if(_0x2c76e3[_0x14d2('0x27')]){delete _0x2c76e3['name'];}_0x47dd62[_0x14d2('0x14')](_0x544652)[_0x14d2('0x28')](_0x2c76e3);};}exports[_0x14d2('0x29')]=function(_0x61e10c,_0x451db8){var _0x10a73f={},_0x533b90={},_0x20cedb={'count':0x0,'rows':[]};var _0x1cf1aa=_['map'](db[_0x14d2('0x2a')][_0x14d2('0x2b')],function(_0x483a3b){return{'name':_0x483a3b[_0x14d2('0x2c')],'type':_0x483a3b[_0x14d2('0x2d')][_0x14d2('0x2e')]};});_0x533b90[_0x14d2('0x2f')]=_['map'](_0x1cf1aa,'name');_0x533b90['query']=_['keys'](_0x61e10c[_0x14d2('0x30')]);_0x533b90[_0x14d2('0x31')]=_[_0x14d2('0x32')](_0x533b90[_0x14d2('0x2f')],_0x533b90[_0x14d2('0x30')]);_0x10a73f[_0x14d2('0x33')]=_['intersection'](_0x533b90[_0x14d2('0x2f')],qs['fields'](_0x61e10c[_0x14d2('0x30')]['fields']));_0x10a73f[_0x14d2('0x33')]=_0x10a73f[_0x14d2('0x33')][_0x14d2('0x34')]?_0x10a73f['attributes']:_0x533b90[_0x14d2('0x2f')];if(!_0x61e10c[_0x14d2('0x30')][_0x14d2('0x35')](_0x14d2('0x36'))){_0x10a73f['limit']=qs[_0x14d2('0x17')](_0x61e10c['query'][_0x14d2('0x17')]);_0x10a73f[_0x14d2('0x19')]=qs['offset'](_0x61e10c['query'][_0x14d2('0x19')]);}_0x10a73f[_0x14d2('0x37')]=qs[_0x14d2('0x38')](_0x61e10c[_0x14d2('0x30')][_0x14d2('0x38')]);delete _0x61e10c[_0x14d2('0x30')][_0x14d2('0x38')];_0x10a73f[_0x14d2('0x39')]=qs[_0x14d2('0x31')](_[_0x14d2('0x3a')](_0x61e10c[_0x14d2('0x30')],_0x533b90['filters']),_0x1cf1aa);if(_0x61e10c[_0x14d2('0x30')][_0x14d2('0x3b')]){_0x10a73f['where']=_[_0x14d2('0x3c')](_0x10a73f['where'],{'$or':_['map'](_0x1cf1aa,function(_0x34a2f7){if(_0x34a2f7['type']!==_0x14d2('0x3d')){var _0x667b59={};_0x667b59[_0x34a2f7['name']]={'$like':'%'+_0x61e10c[_0x14d2('0x30')][_0x14d2('0x3b')]+'%'};return _0x667b59;}})});}_0x10a73f=_['merge']({},_0x10a73f,_0x61e10c[_0x14d2('0x3e')]);var _0x1fd7f6={'where':_0x10a73f[_0x14d2('0x39')]};return db['VoiceMusicOnHold']['count'](_0x1fd7f6)[_0x14d2('0x21')](function(_0x1f174c){_0x20cedb['count']=_0x1f174c;if(_0x61e10c[_0x14d2('0x30')][_0x14d2('0x3f')]){_0x10a73f[_0x14d2('0x40')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x14d2('0x41')](_0x10a73f);})[_0x14d2('0x21')](function(_0x5bfba2){_0x20cedb[_0x14d2('0x42')]=_0x5bfba2;return _0x20cedb;})['then'](respondWithFilteredResult(_0x451db8,_0x10a73f))[_0x14d2('0x43')](handleError(_0x451db8,null));};exports[_0x14d2('0x44')]=function(_0xe5d032,_0x525273){var _0x437a81={'raw':![],'where':{'id':_0xe5d032[_0x14d2('0x45')]['id']}},_0x2e1acc={};_0x2e1acc[_0x14d2('0x2f')]=_[_0x14d2('0x46')](db['VoiceMusicOnHold'][_0x14d2('0x2b')]);_0x2e1acc[_0x14d2('0x30')]=_['keys'](_0xe5d032[_0x14d2('0x30')]);_0x2e1acc['filters']=_[_0x14d2('0x32')](_0x2e1acc[_0x14d2('0x2f')],_0x2e1acc[_0x14d2('0x30')]);_0x437a81[_0x14d2('0x33')]=_[_0x14d2('0x32')](_0x2e1acc[_0x14d2('0x2f')],qs[_0x14d2('0x47')](_0xe5d032[_0x14d2('0x30')]['fields']));_0x437a81[_0x14d2('0x33')]=_0x437a81['attributes']['length']?_0x437a81[_0x14d2('0x33')]:_0x2e1acc['model'];if(_0xe5d032[_0x14d2('0x30')][_0x14d2('0x3f')]){_0x437a81[_0x14d2('0x40')]=[{'all':!![]}];}_0x437a81=_[_0x14d2('0x3c')]({},_0x437a81,_0xe5d032[_0x14d2('0x3e')]);return db[_0x14d2('0x2a')][_0x14d2('0x48')](_0x437a81)[_0x14d2('0x21')](handleEntityNotFound(_0x525273,null))[_0x14d2('0x21')](respondWithResult(_0x525273,null))[_0x14d2('0x43')](handleError(_0x525273,null));};exports[_0x14d2('0x1f')]=function(_0x50f766,_0x5445eb){if(_0x50f766[_0x14d2('0x49')]['id']){delete _0x50f766[_0x14d2('0x49')]['id'];}return db['VoiceMusicOnHold'][_0x14d2('0x48')]({'where':{'id':_0x50f766[_0x14d2('0x45')]['id']}})['then'](handleEntityNotFound(_0x5445eb,null))[_0x14d2('0x21')](saveUpdates(_0x50f766[_0x14d2('0x49')],null))[_0x14d2('0x21')](respondWithResult(_0x5445eb,null))[_0x14d2('0x43')](handleError(_0x5445eb,null));};exports[_0x14d2('0x4a')]=function(_0x129c28,_0x11279c,_0x30755d){return db['sequelize'][_0x14d2('0x4b')](function(_0x5e5ae5){if(_0x129c28[_0x14d2('0x49')][_0x14d2('0x4c')]===_0x14d2('0x4d')){_0x129c28[_0x14d2('0x49')][_0x14d2('0x4e')]=path[_0x14d2('0x4f')](config[_0x14d2('0x50')],_0x14d2('0x51'),_0x129c28[_0x14d2('0x49')][_0x14d2('0x27')]);}return db['VoiceMusicOnHold'][_0x14d2('0x4a')](_0x129c28[_0x14d2('0x49')],{'transaction':_0x5e5ae5})[_0x14d2('0x21')](function(_0x463314){if(_0x129c28[_0x14d2('0x49')][_0x14d2('0x4c')]===_0x14d2('0x4d')){fs[_0x14d2('0x52')](_0x463314[_0x14d2('0x4e')],parseInt(_0x14d2('0x53'),0x8));}var _0x183178=_0x129c28[_0x14d2('0x54')]['get']({'plain':!![]});if(!_0x183178)throw new Error(_0x14d2('0x55'));if(_0x183178[_0x14d2('0x56')]===_0x14d2('0x54')){var _0x1dfb52=_0x463314['get']({'plain':!![]});return db[_0x14d2('0x57')]['find']({'where':{'name':_0x14d2('0x23'),'userProfileId':_0x183178[_0x14d2('0x58')]},'raw':!![]})[_0x14d2('0x21')](function(_0x3da12d){if(_0x3da12d&&_0x3da12d[_0x14d2('0x59')]===0x0){return db['UserProfileResource'][_0x14d2('0x4a')]({'name':_0x1dfb52[_0x14d2('0x27')],'resourceId':_0x1dfb52['id'],'type':_0x3da12d[_0x14d2('0x27')],'sectionId':_0x3da12d['id']},{})[_0x14d2('0x21')](function(){return _0x463314;});}else{return _0x463314;}})['catch'](function(_0x30315b){logger[_0x14d2('0x25')](_0x14d2('0x5a'),_0x30315b);});}return _0x463314;});})[_0x14d2('0x21')](respondWithResult(_0x11279c,0xc9))[_0x14d2('0x43')](handleError(_0x11279c,null));};exports[_0x14d2('0x20')]=function(_0x14507f,_0x44f05e,_0x11a075){var _0x39ec11;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x14507f[_0x14d2('0x45')]['id']}})[_0x14d2('0x21')](function(_0x494ced){if(_0x494ced){return db[_0x14d2('0x5b')][_0x14d2('0x4b')](function(_0x320035){return _0x494ced[_0x14d2('0x20')]({'transaction':_0x320035,'raw':!![]})[_0x14d2('0x21')](function(_0x5b639f){if(_0x5b639f[_0x14d2('0x4e')]){fs['readdirSync'](_0x5b639f[_0x14d2('0x4e')])[_0x14d2('0x5c')](function(_0x349dae){fs[_0x14d2('0x5d')](path['join'](_0x5b639f['directory'],_0x349dae));});fs[_0x14d2('0x5e')](_0x5b639f[_0x14d2('0x4e')]);}return _0x5b639f;});})[_0x14d2('0x43')](function(_0x506ec6){throw new db[(_0x14d2('0x5f'))][(_0x14d2('0x60'))](_0x506ec6[_0x14d2('0x61')]);});}})[_0x14d2('0x21')](handleEntityNotFound(_0x44f05e,null))['then'](removeEntity(_0x44f05e,null))[_0x14d2('0x43')](handleError(_0x44f05e,null));};exports['addSound']=function(_0x424a88,_0x19fc23,_0x7e93e9){return db[_0x14d2('0x5b')][_0x14d2('0x4b')](function(_0x5cb8ee){var _0x3137db;return db[_0x14d2('0x2a')][_0x14d2('0x48')]({'where':{'id':_0x424a88[_0x14d2('0x45')]['id']}})[_0x14d2('0x21')](function(_0x26708e){if(_0x26708e){_0x3137db=_0x26708e;return _0x26708e[_0x14d2('0x62')](_0x424a88['body']['id'],{'transaction':_0x5cb8ee});}})[_0x14d2('0x21')](function(_0x39c046){if(_0x39c046){return db[_0x14d2('0x63')][_0x14d2('0x64')]({'where':{'id':_0x424a88[_0x14d2('0x49')]['id']},'attributes':['id',_0x14d2('0x27'),_0x14d2('0x65'),_0x14d2('0x66'),_0x14d2('0x67')],'raw':!![]});}})[_0x14d2('0x21')](function(_0x4cbd17){if(_0x4cbd17){var _0x528363=path[_0x14d2('0x4f')](config[_0x14d2('0x50')],_0x14d2('0x68'),util[_0x14d2('0x69')]('%s.%s',path[_0x14d2('0x6a')](_0x4cbd17['save_name'],path['extname'](_0x4cbd17[_0x14d2('0x65')])),_0x4cbd17[_0x14d2('0x66')]));var _0x37445d=path[_0x14d2('0x4f')](config[_0x14d2('0x50')],'server/files/moh',_0x3137db[_0x14d2('0x27')],util[_0x14d2('0x69')](_0x14d2('0x6b'),_0x4cbd17[_0x14d2('0x27')],_0x4cbd17[_0x14d2('0x66')]));fs[_0x14d2('0x6c')](_0x528363,_0x37445d);return _0x4cbd17;}})[_0x14d2('0x43')](function(_0x1d70a9){throw new db[(_0x14d2('0x5f'))][(_0x14d2('0x60'))](_0x1d70a9[_0x14d2('0x61')]);});})['then'](handleEntityNotFound(_0x19fc23,null))[_0x14d2('0x21')](respondWithResult(_0x19fc23,0xc9))[_0x14d2('0x43')](handleError(_0x19fc23,null));};exports[_0x14d2('0x6d')]=function(_0x1714c6,_0x58f6b0,_0x33c728){return db[_0x14d2('0x5b')][_0x14d2('0x4b')](function(_0x39697f){var _0x26a5a2;return db[_0x14d2('0x2a')]['findOne']({'where':{'id':_0x1714c6['params']['id']}})[_0x14d2('0x21')](handleEntityNotFound(_0x58f6b0,null))['then'](function(_0x16a530){if(_0x16a530){_0x26a5a2=_0x16a530;return _0x16a530[_0x14d2('0x6d')](_0x1714c6[_0x14d2('0x45')][_0x14d2('0x6e')]);}})[_0x14d2('0x21')](function(_0x19a33a){if(_0x19a33a){return db['Sound']['findOne']({'where':{'id':_0x1714c6[_0x14d2('0x45')][_0x14d2('0x6e')]},'attributes':['id','name','save_name',_0x14d2('0x66'),_0x14d2('0x67')],'raw':!![]});}})['then'](function(_0x51574a){if(_0x51574a){fs['unlinkSync'](path['join'](_0x26a5a2[_0x14d2('0x4e')],util['format']('%s.%s',_0x51574a['name'],_0x51574a[_0x14d2('0x66')])));return _0x51574a;}})[_0x14d2('0x43')](function(_0x464081){throw new db['Sequelize'][(_0x14d2('0x60'))](_0x464081[_0x14d2('0x61')]);});})[_0x14d2('0x21')](handleEntityNotFound(_0x58f6b0,null))[_0x14d2('0x21')](respondWithStatusCode(_0x58f6b0,0xcc))['catch'](handleError(_0x58f6b0,null));};exports[_0x14d2('0x6f')]=function(_0x94322d,_0x230551,_0x319e98){var _0x12b20a={};var _0x1567f2={};var _0x1e5243;var _0xb74c26;return db[_0x14d2('0x2a')][_0x14d2('0x64')]({'where':{'id':_0x94322d['params']['id']}})[_0x14d2('0x21')](handleEntityNotFound(_0x230551,null))[_0x14d2('0x21')](function(_0x4656c4){if(_0x4656c4){_0x1e5243=_0x4656c4;_0x1567f2[_0x14d2('0x2f')]=_[_0x14d2('0x46')](db[_0x14d2('0x63')]['rawAttributes']);_0x1567f2[_0x14d2('0x30')]=_['keys'](_0x94322d['query']);_0x1567f2[_0x14d2('0x31')]=_['intersection'](_0x1567f2[_0x14d2('0x2f')],_0x1567f2[_0x14d2('0x30')]);_0x12b20a[_0x14d2('0x33')]=_[_0x14d2('0x32')](_0x1567f2[_0x14d2('0x2f')],qs[_0x14d2('0x47')](_0x94322d[_0x14d2('0x30')]['fields']));_0x12b20a[_0x14d2('0x33')]=_0x12b20a[_0x14d2('0x33')]['length']?_0x12b20a[_0x14d2('0x33')]:_0x1567f2[_0x14d2('0x2f')];_0x12b20a[_0x14d2('0x37')]=qs['sort'](_0x94322d[_0x14d2('0x30')][_0x14d2('0x38')]);_0x12b20a[_0x14d2('0x39')]=qs[_0x14d2('0x31')](_[_0x14d2('0x3a')](_0x94322d[_0x14d2('0x30')],_0x1567f2[_0x14d2('0x31')]));if(_0x94322d['query']['filter']){_0x12b20a[_0x14d2('0x39')]=_[_0x14d2('0x3c')](_0x12b20a[_0x14d2('0x39')],{'$or':_[_0x14d2('0x70')](_0x12b20a[_0x14d2('0x33')],function(_0x5cd772){var _0x2855e7={};_0x2855e7[_0x5cd772]={'$like':'%'+_0x94322d[_0x14d2('0x30')][_0x14d2('0x3b')]+'%'};return _0x2855e7;})});}_0x12b20a=_[_0x14d2('0x3c')]({},_0x12b20a,_0x94322d[_0x14d2('0x3e')]);return _0x1e5243[_0x14d2('0x6f')](_0x12b20a);}})[_0x14d2('0x21')](function(_0x23ef50){if(_0x23ef50){_0xb74c26=_0x23ef50['length'];if(!_0x94322d[_0x14d2('0x30')][_0x14d2('0x35')](_0x14d2('0x36'))){_0x12b20a[_0x14d2('0x17')]=qs[_0x14d2('0x17')](_0x94322d[_0x14d2('0x30')][_0x14d2('0x17')]);_0x12b20a[_0x14d2('0x19')]=qs[_0x14d2('0x19')](_0x94322d[_0x14d2('0x30')][_0x14d2('0x19')]);}return _0x1e5243[_0x14d2('0x6f')](_0x12b20a);}})[_0x14d2('0x21')](function(_0x4741ee){if(_0x4741ee){return _0x4741ee?{'count':_0xb74c26,'rows':_0x4741ee}:null;}})[_0x14d2('0x21')](respondWithResult(_0x230551,null))[_0x14d2('0x43')](handleError(_0x230551,null));}; \ No newline at end of file +var _0x1822=['length','find','body','create','sequelize','files','directory','join','root','server/files/moh','mode','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','MusicOnHolds','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','forEach','rmdirSync','Sequelize','ValidationError','addSound','Sound','save_name','server/files/sounds/converted','converted_format','format','symlinkSync','message','removeSound','findOne','id2','createdAt','unlinkSync','%s.%s','getSounds','eml-format','zip-dir','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','get','destroy','error','stack','name','send','index','map','VoiceMusicOnHold','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','options','includeAll','include','rows','catch','params','rawAttributes'];(function(_0xdf0952,_0x4a2fca){var _0x439a8e=function(_0x455611){while(--_0x455611){_0xdf0952['push'](_0xdf0952['shift']());}};_0x439a8e(++_0x4a2fca);}(_0x1822,0x91));var _0x2182=function(_0xeab246,_0x337e1f){_0xeab246=_0xeab246-0x0;var _0x39b8f1=_0x1822[_0xeab246];return _0x39b8f1;};'use strict';var emlformat=require(_0x2182('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2182('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2182('0x2'));var moment=require('moment');var BPromise=require(_0x2182('0x3'));var Mustache=require(_0x2182('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2182('0x5'));var ejs=require(_0x2182('0x6'));var fs=require('fs');var fs_extra=require(_0x2182('0x7'));var _=require(_0x2182('0x8'));var squel=require(_0x2182('0x9'));var crypto=require(_0x2182('0xa'));var jsforce=require(_0x2182('0xb'));var deskjs=require(_0x2182('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2182('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2182('0xe'));var logger=require(_0x2182('0xf'))(_0x2182('0x10'));var utils=require('../../config/utils');var config=require(_0x2182('0x11'));var licenseUtil=require(_0x2182('0x12'));var db=require(_0x2182('0x13'))['db'];function respondWithStatusCode(_0x178c5e,_0x304af0){_0x304af0=_0x304af0||0xcc;return function(_0x59f0d7){if(_0x59f0d7){return _0x178c5e['sendStatus'](_0x304af0);}return _0x178c5e[_0x2182('0x14')](_0x304af0)[_0x2182('0x15')]();};}function respondWithResult(_0x39efdc,_0x5b71b7){_0x5b71b7=_0x5b71b7||0xc8;return function(_0x4e6286){if(_0x4e6286){return _0x39efdc[_0x2182('0x14')](_0x5b71b7)['json'](_0x4e6286);}};}function respondWithFilteredResult(_0x484bd9,_0x54443e){return function(_0x5d891f){if(_0x5d891f){var _0x6c767=typeof _0x54443e['offset']===_0x2182('0x16')&&typeof _0x54443e[_0x2182('0x17')]==='undefined';var _0x30dcc4=_0x5d891f[_0x2182('0x18')];var _0x1ed6e4=_0x6c767?0x0:_0x54443e[_0x2182('0x19')];var _0x496c9c=_0x6c767?_0x5d891f[_0x2182('0x18')]:_0x54443e[_0x2182('0x19')]+_0x54443e[_0x2182('0x17')];var _0x1572f6;if(_0x496c9c>=_0x30dcc4){_0x496c9c=_0x30dcc4;_0x1572f6=0xc8;}else{_0x1572f6=0xce;}_0x484bd9[_0x2182('0x14')](_0x1572f6);return _0x484bd9[_0x2182('0x1a')](_0x2182('0x1b'),_0x1ed6e4+'-'+_0x496c9c+'/'+_0x30dcc4)[_0x2182('0x1c')](_0x5d891f);}return null;};}function patchUpdates(_0x1beef8){return function(_0x35a381){try{jsonpatch[_0x2182('0x1d')](_0x35a381,_0x1beef8,!![]);}catch(_0x4d83b7){return BPromise['reject'](_0x4d83b7);}return _0x35a381[_0x2182('0x1e')]();};}function saveUpdates(_0x40a6fc,_0x5c1509){return function(_0x2e05fb){if(_0x2e05fb){return _0x2e05fb[_0x2182('0x1f')](_0x40a6fc)[_0x2182('0x20')](function(_0x340425){return _0x340425;});}return null;};}function removeEntity(_0x1304b3,_0x59846c){return function(_0x235d34){if(_0x235d34){return _0x235d34['destroy']()[_0x2182('0x20')](function(){var _0xa99a7a=_0x235d34[_0x2182('0x21')]({'plain':!![]});var _0x162773='MusicOnHolds';return db['UserProfileResource'][_0x2182('0x22')]({'where':{'type':_0x162773,'resourceId':_0xa99a7a['id']}})[_0x2182('0x20')](function(){return _0x235d34;});})[_0x2182('0x20')](function(){_0x1304b3[_0x2182('0x14')](0xcc)[_0x2182('0x15')]();});}};}function handleEntityNotFound(_0x5595d6,_0x35bb60){return function(_0x4717fc){if(!_0x4717fc){_0x5595d6['sendStatus'](0x194);}return _0x4717fc;};}function handleError(_0x226672,_0x5930a5){_0x5930a5=_0x5930a5||0x1f4;return function(_0x5b8522){logger[_0x2182('0x23')](_0x5b8522[_0x2182('0x24')]);if(_0x5b8522[_0x2182('0x25')]){delete _0x5b8522[_0x2182('0x25')];}_0x226672[_0x2182('0x14')](_0x5930a5)[_0x2182('0x26')](_0x5b8522);};}exports[_0x2182('0x27')]=function(_0x3c5003,_0x4cf86d){var _0x59b2fd={},_0x49b267={},_0x38e210={'count':0x0,'rows':[]};var _0x1c8b0c=_[_0x2182('0x28')](db[_0x2182('0x29')]['rawAttributes'],function(_0xb051f1){return{'name':_0xb051f1[_0x2182('0x2a')],'type':_0xb051f1['type'][_0x2182('0x2b')]};});_0x49b267[_0x2182('0x2c')]=_[_0x2182('0x28')](_0x1c8b0c,_0x2182('0x25'));_0x49b267[_0x2182('0x2d')]=_[_0x2182('0x2e')](_0x3c5003[_0x2182('0x2d')]);_0x49b267[_0x2182('0x2f')]=_['intersection'](_0x49b267[_0x2182('0x2c')],_0x49b267['query']);_0x59b2fd[_0x2182('0x30')]=_[_0x2182('0x31')](_0x49b267['model'],qs['fields'](_0x3c5003['query'][_0x2182('0x32')]));_0x59b2fd[_0x2182('0x30')]=_0x59b2fd[_0x2182('0x30')]['length']?_0x59b2fd['attributes']:_0x49b267[_0x2182('0x2c')];if(!_0x3c5003[_0x2182('0x2d')][_0x2182('0x33')](_0x2182('0x34'))){_0x59b2fd[_0x2182('0x17')]=qs['limit'](_0x3c5003[_0x2182('0x2d')][_0x2182('0x17')]);_0x59b2fd[_0x2182('0x19')]=qs[_0x2182('0x19')](_0x3c5003[_0x2182('0x2d')][_0x2182('0x19')]);}_0x59b2fd[_0x2182('0x35')]=qs['sort'](_0x3c5003[_0x2182('0x2d')][_0x2182('0x36')]);delete _0x3c5003[_0x2182('0x2d')][_0x2182('0x36')];_0x59b2fd['where']=qs[_0x2182('0x2f')](_[_0x2182('0x37')](_0x3c5003[_0x2182('0x2d')],_0x49b267[_0x2182('0x2f')]),_0x1c8b0c);if(_0x3c5003[_0x2182('0x2d')][_0x2182('0x38')]){_0x59b2fd['where']=_[_0x2182('0x39')](_0x59b2fd[_0x2182('0x3a')],{'$or':_[_0x2182('0x28')](_0x1c8b0c,function(_0x15a070){if(_0x15a070[_0x2182('0x3b')]!=='VIRTUAL'){var _0x7ed7de={};_0x7ed7de[_0x15a070['name']]={'$like':'%'+_0x3c5003[_0x2182('0x2d')][_0x2182('0x38')]+'%'};return _0x7ed7de;}})});}_0x59b2fd=_[_0x2182('0x39')]({},_0x59b2fd,_0x3c5003[_0x2182('0x3c')]);var _0x42af6b={'where':_0x59b2fd[_0x2182('0x3a')]};return db['VoiceMusicOnHold']['count'](_0x42af6b)[_0x2182('0x20')](function(_0x5e03f7){_0x38e210[_0x2182('0x18')]=_0x5e03f7;if(_0x3c5003[_0x2182('0x2d')][_0x2182('0x3d')]){_0x59b2fd[_0x2182('0x3e')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x59b2fd);})['then'](function(_0xf5a0f8){_0x38e210[_0x2182('0x3f')]=_0xf5a0f8;return _0x38e210;})['then'](respondWithFilteredResult(_0x4cf86d,_0x59b2fd))[_0x2182('0x40')](handleError(_0x4cf86d,null));};exports['show']=function(_0x21eb32,_0xd6ab8c){var _0x516997={'raw':![],'where':{'id':_0x21eb32[_0x2182('0x41')]['id']}},_0x497062={};_0x497062[_0x2182('0x2c')]=_['keys'](db[_0x2182('0x29')][_0x2182('0x42')]);_0x497062[_0x2182('0x2d')]=_[_0x2182('0x2e')](_0x21eb32['query']);_0x497062[_0x2182('0x2f')]=_['intersection'](_0x497062['model'],_0x497062[_0x2182('0x2d')]);_0x516997[_0x2182('0x30')]=_['intersection'](_0x497062['model'],qs[_0x2182('0x32')](_0x21eb32[_0x2182('0x2d')][_0x2182('0x32')]));_0x516997['attributes']=_0x516997['attributes'][_0x2182('0x43')]?_0x516997[_0x2182('0x30')]:_0x497062[_0x2182('0x2c')];if(_0x21eb32[_0x2182('0x2d')]['includeAll']){_0x516997[_0x2182('0x3e')]=[{'all':!![]}];}_0x516997=_[_0x2182('0x39')]({},_0x516997,_0x21eb32[_0x2182('0x3c')]);return db[_0x2182('0x29')][_0x2182('0x44')](_0x516997)['then'](handleEntityNotFound(_0xd6ab8c,null))[_0x2182('0x20')](respondWithResult(_0xd6ab8c,null))[_0x2182('0x40')](handleError(_0xd6ab8c,null));};exports['update']=function(_0x3bb1d9,_0x101baf){if(_0x3bb1d9['body']['id']){delete _0x3bb1d9['body']['id'];}return db['VoiceMusicOnHold'][_0x2182('0x44')]({'where':{'id':_0x3bb1d9['params']['id']}})[_0x2182('0x20')](handleEntityNotFound(_0x101baf,null))[_0x2182('0x20')](saveUpdates(_0x3bb1d9[_0x2182('0x45')],null))['then'](respondWithResult(_0x101baf,null))[_0x2182('0x40')](handleError(_0x101baf,null));};exports[_0x2182('0x46')]=function(_0x266f36,_0x1e71ba,_0x3f8e67){return db[_0x2182('0x47')]['transaction'](function(_0x8ba1ea){if(_0x266f36[_0x2182('0x45')]['mode']===_0x2182('0x48')){_0x266f36[_0x2182('0x45')][_0x2182('0x49')]=path[_0x2182('0x4a')](config[_0x2182('0x4b')],_0x2182('0x4c'),_0x266f36[_0x2182('0x45')]['name']);}return db[_0x2182('0x29')][_0x2182('0x46')](_0x266f36[_0x2182('0x45')],{'transaction':_0x8ba1ea})[_0x2182('0x20')](function(_0x22b398){if(_0x266f36[_0x2182('0x45')][_0x2182('0x4d')]===_0x2182('0x48')){fs[_0x2182('0x4e')](_0x22b398[_0x2182('0x49')],parseInt(_0x2182('0x4f'),0x8));}var _0x33a15d=_0x266f36['user'][_0x2182('0x21')]({'plain':!![]});if(!_0x33a15d)throw new Error(_0x2182('0x50'));if(_0x33a15d['role']===_0x2182('0x51')){var _0x4fe620=_0x22b398[_0x2182('0x21')]({'plain':!![]});return db[_0x2182('0x52')][_0x2182('0x44')]({'where':{'name':_0x2182('0x53'),'userProfileId':_0x33a15d['userProfileId']},'raw':!![]})[_0x2182('0x20')](function(_0x3ba5c2){if(_0x3ba5c2&&_0x3ba5c2['autoAssociation']===0x0){return db[_0x2182('0x54')][_0x2182('0x46')]({'name':_0x4fe620[_0x2182('0x25')],'resourceId':_0x4fe620['id'],'type':_0x3ba5c2[_0x2182('0x25')],'sectionId':_0x3ba5c2['id']},{})[_0x2182('0x20')](function(){return _0x22b398;});}else{return _0x22b398;}})['catch'](function(_0x196a8c){logger[_0x2182('0x23')](_0x2182('0x55'),_0x196a8c);});}return _0x22b398;});})[_0x2182('0x20')](respondWithResult(_0x1e71ba,0xc9))[_0x2182('0x40')](handleError(_0x1e71ba,null));};exports[_0x2182('0x22')]=function(_0x1387e4,_0x4e5867,_0x34231){var _0x3c6f3d;return db[_0x2182('0x29')][_0x2182('0x44')]({'where':{'id':_0x1387e4['params']['id']}})[_0x2182('0x20')](function(_0x4ca15c){if(_0x4ca15c){return db[_0x2182('0x47')][_0x2182('0x56')](function(_0x4e4b16){return _0x4ca15c['destroy']({'transaction':_0x4e4b16,'raw':!![]})[_0x2182('0x20')](function(_0x5a8cf8){if(_0x5a8cf8['directory']){fs['readdirSync'](_0x5a8cf8['directory'])[_0x2182('0x57')](function(_0x5b4157){fs['unlinkSync'](path[_0x2182('0x4a')](_0x5a8cf8[_0x2182('0x49')],_0x5b4157));});fs[_0x2182('0x58')](_0x5a8cf8[_0x2182('0x49')]);}return _0x5a8cf8;});})[_0x2182('0x40')](function(_0x40120f){throw new db[(_0x2182('0x59'))][(_0x2182('0x5a'))](_0x40120f['message']);});}})[_0x2182('0x20')](handleEntityNotFound(_0x4e5867,null))[_0x2182('0x20')](removeEntity(_0x4e5867,null))[_0x2182('0x40')](handleError(_0x4e5867,null));};exports[_0x2182('0x5b')]=function(_0x33307a,_0x1ec63d,_0x2a1b87){return db['sequelize'][_0x2182('0x56')](function(_0x9c0274){var _0x5692f6;return db['VoiceMusicOnHold'][_0x2182('0x44')]({'where':{'id':_0x33307a[_0x2182('0x41')]['id']}})[_0x2182('0x20')](function(_0x305e03){if(_0x305e03){_0x5692f6=_0x305e03;return _0x305e03[_0x2182('0x5b')](_0x33307a[_0x2182('0x45')]['id'],{'transaction':_0x9c0274});}})[_0x2182('0x20')](function(_0x591a8e){if(_0x591a8e){return db[_0x2182('0x5c')]['findOne']({'where':{'id':_0x33307a[_0x2182('0x45')]['id']},'attributes':['id',_0x2182('0x25'),_0x2182('0x5d'),'converted_format','createdAt'],'raw':!![]});}})['then'](function(_0x3da645){if(_0x3da645){var _0x322ef7=path[_0x2182('0x4a')](config['root'],_0x2182('0x5e'),util['format']('%s.%s',path['basename'](_0x3da645['save_name'],path['extname'](_0x3da645[_0x2182('0x5d')])),_0x3da645[_0x2182('0x5f')]));var _0x182191=path[_0x2182('0x4a')](config[_0x2182('0x4b')],_0x2182('0x4c'),_0x5692f6[_0x2182('0x25')],util[_0x2182('0x60')]('%s.%s',_0x3da645['name'],_0x3da645[_0x2182('0x5f')]));fs[_0x2182('0x61')](_0x322ef7,_0x182191);return _0x3da645;}})[_0x2182('0x40')](function(_0x5c3b82){throw new db[(_0x2182('0x59'))]['ValidationError'](_0x5c3b82[_0x2182('0x62')]);});})[_0x2182('0x20')](handleEntityNotFound(_0x1ec63d,null))[_0x2182('0x20')](respondWithResult(_0x1ec63d,0xc9))['catch'](handleError(_0x1ec63d,null));};exports[_0x2182('0x63')]=function(_0x1fb53b,_0x45d83e,_0x41daaa){return db['sequelize'][_0x2182('0x56')](function(_0x3ecb56){var _0x1b26ac;return db[_0x2182('0x29')][_0x2182('0x64')]({'where':{'id':_0x1fb53b[_0x2182('0x41')]['id']}})['then'](handleEntityNotFound(_0x45d83e,null))[_0x2182('0x20')](function(_0x452c8d){if(_0x452c8d){_0x1b26ac=_0x452c8d;return _0x452c8d[_0x2182('0x63')](_0x1fb53b[_0x2182('0x41')][_0x2182('0x65')]);}})[_0x2182('0x20')](function(_0x201c0b){if(_0x201c0b){return db[_0x2182('0x5c')]['findOne']({'where':{'id':_0x1fb53b[_0x2182('0x41')]['id2']},'attributes':['id','name',_0x2182('0x5d'),_0x2182('0x5f'),_0x2182('0x66')],'raw':!![]});}})[_0x2182('0x20')](function(_0x4d149b){if(_0x4d149b){fs[_0x2182('0x67')](path['join'](_0x1b26ac['directory'],util[_0x2182('0x60')](_0x2182('0x68'),_0x4d149b[_0x2182('0x25')],_0x4d149b[_0x2182('0x5f')])));return _0x4d149b;}})['catch'](function(_0x511600){throw new db['Sequelize']['ValidationError'](_0x511600[_0x2182('0x62')]);});})[_0x2182('0x20')](handleEntityNotFound(_0x45d83e,null))[_0x2182('0x20')](respondWithStatusCode(_0x45d83e,0xcc))[_0x2182('0x40')](handleError(_0x45d83e,null));};exports[_0x2182('0x69')]=function(_0x3d1645,_0x5eadac,_0x5167b5){var _0x3da2f9={};var _0x3cae91={};var _0x2e6268;var _0x42be76;return db['VoiceMusicOnHold'][_0x2182('0x64')]({'where':{'id':_0x3d1645[_0x2182('0x41')]['id']}})['then'](handleEntityNotFound(_0x5eadac,null))[_0x2182('0x20')](function(_0x39b593){if(_0x39b593){_0x2e6268=_0x39b593;_0x3cae91[_0x2182('0x2c')]=_[_0x2182('0x2e')](db[_0x2182('0x5c')][_0x2182('0x42')]);_0x3cae91[_0x2182('0x2d')]=_[_0x2182('0x2e')](_0x3d1645[_0x2182('0x2d')]);_0x3cae91[_0x2182('0x2f')]=_[_0x2182('0x31')](_0x3cae91[_0x2182('0x2c')],_0x3cae91[_0x2182('0x2d')]);_0x3da2f9[_0x2182('0x30')]=_[_0x2182('0x31')](_0x3cae91[_0x2182('0x2c')],qs[_0x2182('0x32')](_0x3d1645['query'][_0x2182('0x32')]));_0x3da2f9[_0x2182('0x30')]=_0x3da2f9[_0x2182('0x30')][_0x2182('0x43')]?_0x3da2f9[_0x2182('0x30')]:_0x3cae91[_0x2182('0x2c')];_0x3da2f9['order']=qs[_0x2182('0x36')](_0x3d1645[_0x2182('0x2d')][_0x2182('0x36')]);_0x3da2f9[_0x2182('0x3a')]=qs[_0x2182('0x2f')](_['pick'](_0x3d1645['query'],_0x3cae91[_0x2182('0x2f')]));if(_0x3d1645['query'][_0x2182('0x38')]){_0x3da2f9[_0x2182('0x3a')]=_[_0x2182('0x39')](_0x3da2f9[_0x2182('0x3a')],{'$or':_['map'](_0x3da2f9['attributes'],function(_0x56fe1e){var _0x3b87ee={};_0x3b87ee[_0x56fe1e]={'$like':'%'+_0x3d1645[_0x2182('0x2d')]['filter']+'%'};return _0x3b87ee;})});}_0x3da2f9=_[_0x2182('0x39')]({},_0x3da2f9,_0x3d1645[_0x2182('0x3c')]);return _0x2e6268[_0x2182('0x69')](_0x3da2f9);}})[_0x2182('0x20')](function(_0x47ffe8){if(_0x47ffe8){_0x42be76=_0x47ffe8[_0x2182('0x43')];if(!_0x3d1645[_0x2182('0x2d')]['hasOwnProperty']('nolimit')){_0x3da2f9['limit']=qs['limit'](_0x3d1645[_0x2182('0x2d')][_0x2182('0x17')]);_0x3da2f9[_0x2182('0x19')]=qs[_0x2182('0x19')](_0x3d1645[_0x2182('0x2d')][_0x2182('0x19')]);}return _0x2e6268[_0x2182('0x69')](_0x3da2f9);}})[_0x2182('0x20')](function(_0x3e1145){if(_0x3e1145){return _0x3e1145?{'count':_0x42be76,'rows':_0x3e1145}:null;}})[_0x2182('0x20')](respondWithResult(_0x5eadac,null))[_0x2182('0x40')](handleError(_0x5eadac,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index a541064..dd40df8 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 _0x03c6=['exports','define','VoiceMusicOnHold','../../config/logger','api','bluebird','request-promise'];(function(_0x343ee8,_0x58caff){var _0x447d0f=function(_0x2740c2){while(--_0x2740c2){_0x343ee8['push'](_0x343ee8['shift']());}};_0x447d0f(++_0x58caff);}(_0x03c6,0x65));var _0x603c=function(_0x3f8fda,_0x27e98e){_0x3f8fda=_0x3f8fda-0x0;var _0x4535c2=_0x03c6[_0x3f8fda];return _0x4535c2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x603c('0x0'))(_0x603c('0x1'));var moment=require('moment');var BPromise=require(_0x603c('0x2'));var rp=require(_0x603c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module[_0x603c('0x4')]=function(_0x2c7a91,_0x1c3b7d){return _0x2c7a91[_0x603c('0x5')](_0x603c('0x6'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dea=['define','voice_musiconhold','lodash','../../config/logger','api','moment','request-promise','path','./voiceMusicOnHold.attributes'];(function(_0x3a26b7,_0x15f4fa){var _0x44b7e8=function(_0x206cb8){while(--_0x206cb8){_0x3a26b7['push'](_0x3a26b7['shift']());}};_0x44b7e8(++_0x15f4fa);}(_0x9dea,0xd1));var _0xa9de=function(_0x5c1b06,_0x33e4c6){_0x5c1b06=_0x5c1b06-0x0;var _0x1abd2e=_0x9dea[_0x5c1b06];return _0x1abd2e;};'use strict';var _=require(_0xa9de('0x0'));var util=require('util');var logger=require(_0xa9de('0x1'))(_0xa9de('0x2'));var moment=require(_0xa9de('0x3'));var BPromise=require('bluebird');var rp=require(_0xa9de('0x4'));var fs=require('fs');var path=require(_0xa9de('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa9de('0x6'));module['exports']=function(_0x720974,_0x1a764e){return _0x720974[_0xa9de('0x7')]('VoiceMusicOnHold',attributes,{'tableName':_0xa9de('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 f430b8b..66cb310 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x480f5c,_0x230032){var _0x3d9660=function(_0x488493){while(--_0x488493){_0x480f5c['push'](_0x480f5c['shift']());}};_0x3d9660(++_0x230032);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x463fdc,_0x203d52){var _0x344a51=function(_0x52a4b0){while(--_0x52a4b0){_0x463fdc['push'](_0x463fdc['shift']());}};_0x344a51(++_0x203d52);}(_0xe706,0xa3));var _0x6e70=function(_0xcfa2e0,_0x40dd3d){_0xcfa2e0=_0xcfa2e0-0x0;var _0x1dc2b1=_0xe706[_0xcfa2e0];return _0x1dc2b1;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index a043977..306d64d 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 _0x2755=['removeAgents','removeTeams','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','delete','destroy'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0x2755,0x19a));var _0x5275=function(_0x3bd473,_0x4408d0){_0x3bd473=_0x3bd473-0x0;var _0x26e9d0=_0x2755[_0x3bd473];return _0x26e9d0;};'use strict';var multer=require(_0x5275('0x0'));var util=require('util');var path=require(_0x5275('0x1'));var timeout=require(_0x5275('0x2'));var express=require(_0x5275('0x3'));var router=express['Router']();var fs_extra=require(_0x5275('0x4'));var auth=require(_0x5275('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5275('0x6'));var controller=require(_0x5275('0x7'));router[_0x5275('0x8')]('/',auth[_0x5275('0x9')](),controller['index']);router['get']('/describe',auth[_0x5275('0x9')](),controller[_0x5275('0xa')]);router[_0x5275('0x8')](_0x5275('0xb'),auth[_0x5275('0x9')](),controller['show']);router[_0x5275('0x8')](_0x5275('0xc'),auth[_0x5275('0x9')](),controller[_0x5275('0xd')]);router[_0x5275('0x8')](_0x5275('0xe'),auth[_0x5275('0x9')](),controller[_0x5275('0xf')]);router[_0x5275('0x10')]('/',auth['isAuthenticated'](),controller[_0x5275('0x11')]);router['post'](_0x5275('0xc'),auth[_0x5275('0x9')](),controller[_0x5275('0x12')]);router['post'](_0x5275('0xe'),auth[_0x5275('0x9')](),controller[_0x5275('0x13')]);router['put']('/:id',auth[_0x5275('0x9')](),controller['update']);router[_0x5275('0x14')]('/:id',auth[_0x5275('0x9')](),controller[_0x5275('0x15')]);router[_0x5275('0x14')]('/:id/users',auth[_0x5275('0x9')](),controller[_0x5275('0x16')]);router['delete']('/:id/teams',auth[_0x5275('0x9')](),controller[_0x5275('0x17')]);module['exports']=router; \ No newline at end of file +var _0xb8ca=['getTeams','post','create','/:id/users','addAgents','/:id/teams','addTeams','put','delete','destroy','removeAgents','removeTeams','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/:id','show'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xb8ca,0x89));var _0xab8c=function(_0x1f4999,_0x4580f0){_0x1f4999=_0x1f4999-0x0;var _0x521e6e=_0xb8ca[_0x1f4999];return _0x521e6e;};'use strict';var multer=require(_0xab8c('0x0'));var util=require(_0xab8c('0x1'));var path=require(_0xab8c('0x2'));var timeout=require('connect-timeout');var express=require(_0xab8c('0x3'));var router=express[_0xab8c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xab8c('0x5'));var config=require(_0xab8c('0x6'));var controller=require(_0xab8c('0x7'));router[_0xab8c('0x8')]('/',auth[_0xab8c('0x9')](),controller[_0xab8c('0xa')]);router[_0xab8c('0x8')]('/describe',auth[_0xab8c('0x9')](),controller['describe']);router[_0xab8c('0x8')](_0xab8c('0xb'),auth[_0xab8c('0x9')](),controller[_0xab8c('0xc')]);router[_0xab8c('0x8')]('/:id/users',auth[_0xab8c('0x9')](),controller['getAgents']);router['get']('/:id/teams',auth[_0xab8c('0x9')](),controller[_0xab8c('0xd')]);router[_0xab8c('0xe')]('/',auth[_0xab8c('0x9')](),controller[_0xab8c('0xf')]);router[_0xab8c('0xe')](_0xab8c('0x10'),auth[_0xab8c('0x9')](),controller[_0xab8c('0x11')]);router[_0xab8c('0xe')](_0xab8c('0x12'),auth[_0xab8c('0x9')](),controller[_0xab8c('0x13')]);router[_0xab8c('0x14')](_0xab8c('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xab8c('0x15')](_0xab8c('0xb'),auth['isAuthenticated'](),controller[_0xab8c('0x16')]);router[_0xab8c('0x15')](_0xab8c('0x10'),auth[_0xab8c('0x9')](),controller[_0xab8c('0x17')]);router[_0xab8c('0x15')](_0xab8c('0x12'),auth[_0xab8c('0x9')](),controller[_0xab8c('0x18')]);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 99c37a8..f8901e0 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 _0x702b=['exports','STRING','name','VIRTUAL','system-','INTEGER','sequelize'];(function(_0x2d09f6,_0x3d3fd6){var _0x1516c9=function(_0x13f459){while(--_0x13f459){_0x2d09f6['push'](_0x2d09f6['shift']());}};_0x1516c9(++_0x3d3fd6);}(_0x702b,0xca));var _0xb702=function(_0x56215c,_0x42bd95){_0x56215c=_0x56215c-0x0;var _0x1d750f=_0x702b[_0x56215c];return _0x1d750f;};'use strict';var Sequelize=require(_0xb702('0x0'));module[_0xb702('0x1')]={'name':{'type':Sequelize[_0xb702('0x2')],'allowNull':![],'unique':_0xb702('0x3')},'prefix':{'type':Sequelize[_0xb702('0x4')],'get':function(_0x4157b0){return _0xb702('0x5')+this['getDataValue'](_0xb702('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xb702('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xb702('0x6')]}}; \ No newline at end of file +var _0x03f8=['exports','STRING','name','system-','getDataValue','INTEGER','sequelize'];(function(_0xf58718,_0x33541a){var _0x5aea10=function(_0x16f386){while(--_0x16f386){_0xf58718['push'](_0xf58718['shift']());}};_0x5aea10(++_0x33541a);}(_0x03f8,0x1aa));var _0x803f=function(_0x5c8b19,_0x47d79a){_0x5c8b19=_0x5c8b19-0x0;var _0x2ff0cd=_0x03f8[_0x5c8b19];return _0x2ff0cd;};'use strict';var Sequelize=require(_0x803f('0x0'));module[_0x803f('0x1')]={'name':{'type':Sequelize[_0x803f('0x2')],'allowNull':![],'unique':_0x803f('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x1c10af){return _0x803f('0x4')+this[_0x803f('0x5')](_0x803f('0x3'))+'-';}},'description':{'type':Sequelize[_0x803f('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x803f('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 15990c8..d9fcaae 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 _0xe1e3=['union','compact','value','isEmpty','forEach','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','localhost','./voicePrefix.socket','register','sendStatus','status','offset','undefined','count','limit','Content-Range','json','reject','update','then','UserProfileResource','destroy','end','name','index','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','VoicePrefix','includeAll','findAll','rows','show','filters','length','merge','find','catch','params','describe','create','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','VoicePrefixes','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','prefix','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','body','system-','sequelize','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','User','getTeams','findOne','Team','addTeams','Agents','online','voicePause','interface','flatMap','TeamVoicePrefix','each','UserVoicePrefix','removeTeams','select','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all'];(function(_0x11b736,_0x1fc4a8){var _0xb2e7e=function(_0x56f871){while(--_0x56f871){_0x11b736['push'](_0x11b736['shift']());}};_0xb2e7e(++_0x1fc4a8);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x1f14fd,_0x1340e4){_0x1f14fd=_0x1f14fd-0x0;var _0x5e5f68=_0xe1e3[_0x1f14fd];return _0x5e5f68;};'use strict';var emlformat=require(_0x3e1e('0x0'));var rimraf=require(_0x3e1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e1e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e1e('0x3'));var Mustache=require('mustache');var util=require(_0x3e1e('0x4'));var path=require(_0x3e1e('0x5'));var sox=require(_0x3e1e('0x6'));var csv=require(_0x3e1e('0x7'));var ejs=require(_0x3e1e('0x8'));var fs=require('fs');var fs_extra=require(_0x3e1e('0x9'));var _=require('lodash');var squel=require(_0x3e1e('0xa'));var crypto=require(_0x3e1e('0xb'));var jsforce=require(_0x3e1e('0xc'));var deskjs=require(_0x3e1e('0xd'));var toCsv=require(_0x3e1e('0x7'));var querystring=require(_0x3e1e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3e1e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e1e('0x10'));var logger=require(_0x3e1e('0x11'))(_0x3e1e('0x12'));var utils=require('../../config/utils');var config=require(_0x3e1e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x3e1e('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3e1e('0x15'))[_0x3e1e('0x16')](socket);function respondWithStatusCode(_0x78ee54,_0x50f221){_0x50f221=_0x50f221||0xcc;return function(_0x5b34ec){if(_0x5b34ec){return _0x78ee54[_0x3e1e('0x17')](_0x50f221);}return _0x78ee54[_0x3e1e('0x18')](_0x50f221)['end']();};}function respondWithResult(_0x26cb35,_0x1f0af9){_0x1f0af9=_0x1f0af9||0xc8;return function(_0x570212){if(_0x570212){return _0x26cb35[_0x3e1e('0x18')](_0x1f0af9)['json'](_0x570212);}};}function respondWithFilteredResult(_0x23228c,_0x247daa){return function(_0x1d786c){if(_0x1d786c){var _0x39eaa7=typeof _0x247daa[_0x3e1e('0x19')]===_0x3e1e('0x1a')&&typeof _0x247daa['limit']==='undefined';var _0x4a9497=_0x1d786c[_0x3e1e('0x1b')];var _0x30acbf=_0x39eaa7?0x0:_0x247daa[_0x3e1e('0x19')];var _0x57c660=_0x39eaa7?_0x1d786c[_0x3e1e('0x1b')]:_0x247daa['offset']+_0x247daa[_0x3e1e('0x1c')];var _0x33ec1d;if(_0x57c660>=_0x4a9497){_0x57c660=_0x4a9497;_0x33ec1d=0xc8;}else{_0x33ec1d=0xce;}_0x23228c[_0x3e1e('0x18')](_0x33ec1d);return _0x23228c['set'](_0x3e1e('0x1d'),_0x30acbf+'-'+_0x57c660+'/'+_0x4a9497)[_0x3e1e('0x1e')](_0x1d786c);}return null;};}function patchUpdates(_0xefa098){return function(_0x55dc62){try{jsonpatch['apply'](_0x55dc62,_0xefa098,!![]);}catch(_0x13d7ac){return BPromise[_0x3e1e('0x1f')](_0x13d7ac);}return _0x55dc62['save']();};}function saveUpdates(_0x60e6bc,_0x56ae51){return function(_0x164b15){if(_0x164b15){return _0x164b15[_0x3e1e('0x20')](_0x60e6bc)[_0x3e1e('0x21')](function(_0x159212){return _0x159212;});}return null;};}function removeEntity(_0x43d583,_0x21c898){return function(_0x4ee2b5){if(_0x4ee2b5){return _0x4ee2b5['destroy']()[_0x3e1e('0x21')](function(){var _0x541ef1=_0x4ee2b5['get']({'plain':!![]});var _0x4be84e='VoicePrefixes';return db[_0x3e1e('0x22')][_0x3e1e('0x23')]({'where':{'type':_0x4be84e,'resourceId':_0x541ef1['id']}})['then'](function(){return _0x4ee2b5;});})[_0x3e1e('0x21')](function(){_0x43d583['status'](0xcc)[_0x3e1e('0x24')]();});}};}function handleEntityNotFound(_0x176bb4,_0x53a6ff){return function(_0x43e029){if(!_0x43e029){_0x176bb4[_0x3e1e('0x17')](0x194);}return _0x43e029;};}function handleError(_0x45ed0e,_0x4d3695){_0x4d3695=_0x4d3695||0x1f4;return function(_0xdef39){logger['error'](_0xdef39['stack']);if(_0xdef39['name']){delete _0xdef39[_0x3e1e('0x25')];}_0x45ed0e['status'](_0x4d3695)['send'](_0xdef39);};}exports[_0x3e1e('0x26')]=function(_0x468336,_0x1c57c2){var _0x233b18={},_0xc9762c={},_0x54df5a={'count':0x0,'rows':[]};var _0x5522ba=_['map'](db['VoicePrefix'][_0x3e1e('0x27')],function(_0x417419){return{'name':_0x417419[_0x3e1e('0x28')],'type':_0x417419[_0x3e1e('0x29')][_0x3e1e('0x2a')]};});_0xc9762c[_0x3e1e('0x2b')]=_[_0x3e1e('0x2c')](_0x5522ba,_0x3e1e('0x25'));_0xc9762c['query']=_[_0x3e1e('0x2d')](_0x468336[_0x3e1e('0x2e')]);_0xc9762c['filters']=_[_0x3e1e('0x2f')](_0xc9762c[_0x3e1e('0x2b')],_0xc9762c[_0x3e1e('0x2e')]);_0x233b18[_0x3e1e('0x30')]=_['intersection'](_0xc9762c['model'],qs[_0x3e1e('0x31')](_0x468336[_0x3e1e('0x2e')]['fields']));_0x233b18[_0x3e1e('0x30')]=_0x233b18[_0x3e1e('0x30')]['length']?_0x233b18[_0x3e1e('0x30')]:_0xc9762c[_0x3e1e('0x2b')];if(!_0x468336[_0x3e1e('0x2e')][_0x3e1e('0x32')](_0x3e1e('0x33'))){_0x233b18['limit']=qs[_0x3e1e('0x1c')](_0x468336[_0x3e1e('0x2e')][_0x3e1e('0x1c')]);_0x233b18[_0x3e1e('0x19')]=qs['offset'](_0x468336[_0x3e1e('0x2e')][_0x3e1e('0x19')]);}_0x233b18[_0x3e1e('0x34')]=qs[_0x3e1e('0x35')](_0x468336[_0x3e1e('0x2e')][_0x3e1e('0x35')]);_0x233b18[_0x3e1e('0x36')]=qs['filters'](_[_0x3e1e('0x37')](_0x468336['query'],_0xc9762c['filters']),_0x5522ba);if(_0x468336[_0x3e1e('0x2e')][_0x3e1e('0x38')]){_0x233b18[_0x3e1e('0x36')]=_['merge'](_0x233b18[_0x3e1e('0x36')],{'$or':_[_0x3e1e('0x2c')](_0x5522ba,function(_0x4d372a){if(_0x4d372a[_0x3e1e('0x29')]!==_0x3e1e('0x39')){var _0x4b3d0f={};_0x4b3d0f[_0x4d372a['name']]={'$like':'%'+_0x468336[_0x3e1e('0x2e')]['filter']+'%'};return _0x4b3d0f;}})});}_0x233b18=_['merge']({},_0x233b18,_0x468336[_0x3e1e('0x3a')]);var _0x3d4a8d={'where':_0x233b18[_0x3e1e('0x36')]};return db[_0x3e1e('0x3b')][_0x3e1e('0x1b')](_0x3d4a8d)['then'](function(_0x5b32ad){_0x54df5a[_0x3e1e('0x1b')]=_0x5b32ad;if(_0x468336[_0x3e1e('0x2e')][_0x3e1e('0x3c')]){_0x233b18['include']=[{'all':!![]}];}return db[_0x3e1e('0x3b')][_0x3e1e('0x3d')](_0x233b18);})[_0x3e1e('0x21')](function(_0x4ad5fd){_0x54df5a[_0x3e1e('0x3e')]=_0x4ad5fd;return _0x54df5a;})['then'](respondWithFilteredResult(_0x1c57c2,_0x233b18))['catch'](handleError(_0x1c57c2,null));};exports[_0x3e1e('0x3f')]=function(_0x9053cd,_0x2a1373){var _0x3d6627={'raw':![],'where':{'id':_0x9053cd['params']['id']}},_0x4a2cfb={};_0x4a2cfb['model']=_['keys'](db[_0x3e1e('0x3b')][_0x3e1e('0x27')]);_0x4a2cfb['query']=_['keys'](_0x9053cd[_0x3e1e('0x2e')]);_0x4a2cfb[_0x3e1e('0x40')]=_[_0x3e1e('0x2f')](_0x4a2cfb['model'],_0x4a2cfb[_0x3e1e('0x2e')]);_0x3d6627['attributes']=_[_0x3e1e('0x2f')](_0x4a2cfb[_0x3e1e('0x2b')],qs[_0x3e1e('0x31')](_0x9053cd[_0x3e1e('0x2e')][_0x3e1e('0x31')]));_0x3d6627[_0x3e1e('0x30')]=_0x3d6627['attributes'][_0x3e1e('0x41')]?_0x3d6627[_0x3e1e('0x30')]:_0x4a2cfb['model'];if(_0x9053cd[_0x3e1e('0x2e')][_0x3e1e('0x3c')]){_0x3d6627['include']=[{'all':!![]}];}_0x3d6627=_[_0x3e1e('0x42')]({},_0x3d6627,_0x9053cd[_0x3e1e('0x3a')]);return db[_0x3e1e('0x3b')][_0x3e1e('0x43')](_0x3d6627)['then'](handleEntityNotFound(_0x2a1373,null))[_0x3e1e('0x21')](respondWithResult(_0x2a1373,null))[_0x3e1e('0x44')](handleError(_0x2a1373,null));};exports[_0x3e1e('0x23')]=function(_0xb086d4,_0x4bce83){return db[_0x3e1e('0x3b')][_0x3e1e('0x43')]({'where':{'id':_0xb086d4[_0x3e1e('0x45')]['id']}})[_0x3e1e('0x21')](handleEntityNotFound(_0x4bce83,null))[_0x3e1e('0x21')](removeEntity(_0x4bce83,null))[_0x3e1e('0x44')](handleError(_0x4bce83,null));};exports[_0x3e1e('0x46')]=function(_0x238a7d,_0x5df608){return db[_0x3e1e('0x3b')]['describe']()['then'](respondWithResult(_0x5df608,null))['catch'](handleError(_0x5df608,null));};exports[_0x3e1e('0x47')]=function(_0x17641c,_0x5147a2){var _0x13b076;return db['sequelize']['transaction'](function(_0x3eaf76){return db['VoicePrefix']['create'](_0x17641c['body'],{'transaction':_0x3eaf76})[_0x3e1e('0x21')](function(_0xe577b2){_0x13b076=_0xe577b2[_0x3e1e('0x48')]({'plain':!![]});return db[_0x3e1e('0x49')][_0x3e1e('0x43')]({'where':{'id':_0x13b076[_0x3e1e('0x4a')]},'raw':!![]})[_0x3e1e('0x21')](function(_0x5b71a6){return createVoicePrefixExtensions(_0x13b076,_0x5b71a6,_0x3eaf76);});});})[_0x3e1e('0x21')](function(){var _0x5f5587=_0x17641c[_0x3e1e('0x4b')][_0x3e1e('0x48')]({'plain':!![]});if(!_0x5f5587)throw new Error(_0x3e1e('0x4c'));if(_0x5f5587['role']==='user'){var _0xba8d16=_0x13b076;return db[_0x3e1e('0x4d')]['find']({'where':{'name':_0x3e1e('0x4e'),'userProfileId':_0x5f5587['userProfileId']},'raw':!![]})['then'](function(_0x284cc7){if(_0x284cc7&&_0x284cc7[_0x3e1e('0x4f')]===0x0){return db['UserProfileResource'][_0x3e1e('0x47')]({'name':_0xba8d16['name'],'resourceId':_0xba8d16['id'],'type':_0x284cc7['name'],'sectionId':_0x284cc7['id']},{})[_0x3e1e('0x21')](function(){return _0x13b076;});}else{return _0x13b076;}})['catch'](function(_0x3ab043){logger['error'](_0x3e1e('0x50'),_0x3ab043);throw _0x3ab043;});}return _0x13b076;})['then'](respondWithResult(_0x5147a2,null))[_0x3e1e('0x44')](handleError(_0x5147a2,null));};function Extension(_0x8a4987,_0x48be40,_0x4dfc6d,_0x499abc){this[_0x3e1e('0x51')]=_0x3e1e('0x52');this[_0x3e1e('0x53')]=_0x8a4987;this['app']=_0x4dfc6d;this[_0x3e1e('0x29')]=_0x3e1e('0x54');this[_0x3e1e('0x55')]='Voice\x20Prefix\x20Extension';this['priority']=_0x48be40;this[_0x3e1e('0x56')]=_0x499abc;}function createVoicePrefixExtensions(_0x48f406,_0x3b97a2,_0x6c0364){return new BPromise(function(_0x13eefb,_0x5a76c2){var _0x2bdd35=new Extension(formatPrefixName(_0x48f406['prefix']),0x1,_0x3e1e('0x57'),_0x3e1e('0x58'));_0x2bdd35['VoicePrefixId']=_0x48f406['id'];return db[_0x3e1e('0x49')]['create'](_0x2bdd35,{'transaction':_0x6c0364})[_0x3e1e('0x21')](function(_0x574c30){var _0x4dafe9=_0x574c30['get']({'plain':!![]});var _0x31062e=_[_0x3e1e('0x2c')](addVoicePrefixExtensions(_0x48f406,_0x3b97a2),function(_0x3457a1){_0x3457a1['VoiceExtensionId']=_0x4dafe9['id'];_0x3457a1[_0x3e1e('0x59')]=_0x48f406['id'];return _0x3457a1;});return db[_0x3e1e('0x49')]['bulkCreate'](_0x31062e,{'transaction':_0x6c0364})[_0x3e1e('0x21')](function(_0x583535){if(!_0x583535){return _0x5a76c2('Extensions\x20creation\x20failed');}else{return _0x13eefb(_0x583535);}})['catch'](function(_0x182da4){return _0x5a76c2(_0x182da4);});});;});};function addVoicePrefixExtensions(_0x3e6e12,_0x384ee6){var _0x4b0944=[];var _0x35d915=formatPrefixName(_0x3e6e12[_0x3e1e('0x5a')]);_0x4b0944[_0x3e1e('0x5b')](new Extension(_0x35d915,0x2,'Set',_0x3e1e('0x5c')+_0x3e6e12[_0x3e1e('0x25')]));if(_0x3e6e12[_0x3e1e('0x5d')]){_0x4b0944[_0x3e1e('0x5b')](new Extension(_0x35d915,0x3,_0x3e1e('0x5e'),_0x3e1e('0x5f')+_0x3e6e12[_0x3e1e('0x5d')]));}else{_0x4b0944[_0x3e1e('0x5b')](new Extension(_0x35d915,0x3,'NoOp','No\x20callerid\x20available'));}_0x4b0944[_0x3e1e('0x5b')](new Extension(_0x35d915,0x4,_0x3e1e('0x60'),_0x384ee6[_0x3e1e('0x51')]+','+_0x3e1e('0x61')+(0x8+_0x3e6e12[_0x3e1e('0x25')][_0x3e1e('0x41')])+'}'+','+0x1));return _0x4b0944;}function formatPrefixName(_0x35c9c3){var _0x112a22='_';for(var _0x2b78d5=0x0;_0x2b78d5<_0x35c9c3[_0x3e1e('0x41')];_0x2b78d5++){if(_0x35c9c3[_0x3e1e('0x62')](_0x2b78d5)=='-'){_0x112a22+=_0x35c9c3[_0x3e1e('0x62')](_0x2b78d5);}else{_0x112a22+='['+_0x35c9c3['charAt'](_0x2b78d5)+']';}}_0x112a22+='.';return _0x112a22;}exports['update']=function(_0x20bc4d,_0x29ddc4,_0x477e64){var _0x1d6135=_0x20bc4d[_0x3e1e('0x63')];_0x1d6135['prefix']=_0x3e1e('0x64')+_0x1d6135[_0x3e1e('0x25')]+'-';return db[_0x3e1e('0x65')][_0x3e1e('0x66')](function(_0x522637){return db['VoicePrefix'][_0x3e1e('0x20')](_0x1d6135,{'where':{'id':_0x1d6135['id']},'transaction':_0x522637})[_0x3e1e('0x21')](function(){return db[_0x3e1e('0x49')][_0x3e1e('0x23')]({'where':{'VoicePrefixId':_0x1d6135['id']},'transaction':_0x522637})[_0x3e1e('0x21')](function(){return db[_0x3e1e('0x49')]['find']({'where':{'id':_0x1d6135[_0x3e1e('0x4a')]},'raw':!![]})[_0x3e1e('0x21')](function(_0x34f093){return createVoicePrefixExtensions(_0x1d6135,_0x34f093,_0x522637);});});});})[_0x3e1e('0x21')](function(){return db[_0x3e1e('0x3b')][_0x3e1e('0x67')](_0x1d6135['id']);})['then'](respondWithResult(_0x29ddc4,null))[_0x3e1e('0x44')](handleError(_0x29ddc4,null));};exports[_0x3e1e('0x68')]=function(_0x4b78de,_0x109407,_0x2aef1b){return db[_0x3e1e('0x3b')]['find']({'where':{'id':_0x4b78de[_0x3e1e('0x45')]['id']}})['then'](handleEntityNotFound(_0x109407,null))[_0x3e1e('0x21')](function(_0x17c054){if(_0x17c054){return _0x17c054['addAgents'](_0x4b78de[_0x3e1e('0x63')][_0x3e1e('0x69')],_[_0x3e1e('0x6a')](_0x4b78de[_0x3e1e('0x63')],['ids','id'])||{})[_0x3e1e('0x6b')](function(_0x4a7dcc){for(var _0x2d6bb0=0x0;_0x2d6bb0<_0x4b78de[_0x3e1e('0x63')][_0x3e1e('0x69')][_0x3e1e('0x41')];_0x2d6bb0+=0x1){socket[_0x3e1e('0x6c')](_0x3e1e('0x6d'),{'UserId':Number(_0x4b78de['body'][_0x3e1e('0x69')][_0x2d6bb0]),'VoicePrefixId':Number(_0x4b78de[_0x3e1e('0x45')]['id'])});}return _0x4a7dcc;});}})[_0x3e1e('0x21')](respondWithResult(_0x109407,null))[_0x3e1e('0x44')](handleError(_0x109407,null));};exports['removeAgents']=function(_0x1ddf4a,_0x11eb0a,_0x437724){return db[_0x3e1e('0x3b')]['find']({'where':{'id':_0x1ddf4a[_0x3e1e('0x45')]['id']}})[_0x3e1e('0x21')](handleEntityNotFound(_0x11eb0a,null))[_0x3e1e('0x21')](function(_0x2161a4){if(_0x2161a4){return _0x2161a4[_0x3e1e('0x6e')](_0x1ddf4a[_0x3e1e('0x2e')]['ids'])['then'](function(){if(_['isArray'](_0x1ddf4a[_0x3e1e('0x2e')]['ids'])){for(var _0x321aa4=0x0;_0x321aa4<_0x1ddf4a['query'][_0x3e1e('0x69')][_0x3e1e('0x41')];_0x321aa4+=0x1){socket[_0x3e1e('0x6c')](_0x3e1e('0x6f'),{'UserId':Number(_0x1ddf4a['query'][_0x3e1e('0x69')][_0x321aa4]),'VoicePrefixId':Number(_0x1ddf4a['params']['id'])});}}else{socket[_0x3e1e('0x6c')]('userVoicePrefix:remove',{'UserId':Number(_0x1ddf4a[_0x3e1e('0x2e')][_0x3e1e('0x69')]),'VoicePrefixId':Number(_0x1ddf4a['params']['id'])});}});}})[_0x3e1e('0x21')](respondWithStatusCode(_0x11eb0a,null))[_0x3e1e('0x44')](handleError(_0x11eb0a,null));};exports[_0x3e1e('0x70')]=function(_0x4ad5e2,_0x53ba1b,_0x185a4d){var _0x20bb6d={};var _0x120618={};var _0x4dac94;var _0x2fced0;return db['VoicePrefix']['findOne']({'where':{'id':_0x4ad5e2['params']['id']}})[_0x3e1e('0x21')](handleEntityNotFound(_0x53ba1b,null))['then'](function(_0x44c0ee){if(_0x44c0ee){_0x4dac94=_0x44c0ee;_0x120618[_0x3e1e('0x2b')]=_[_0x3e1e('0x2d')](db[_0x3e1e('0x71')][_0x3e1e('0x27')]);_0x120618[_0x3e1e('0x2e')]=_[_0x3e1e('0x2d')](_0x4ad5e2[_0x3e1e('0x2e')]);_0x120618[_0x3e1e('0x40')]=_['intersection'](_0x120618['model'],_0x120618[_0x3e1e('0x2e')]);_0x20bb6d[_0x3e1e('0x30')]=_[_0x3e1e('0x2f')](_0x120618[_0x3e1e('0x2b')],qs[_0x3e1e('0x31')](_0x4ad5e2[_0x3e1e('0x2e')][_0x3e1e('0x31')]));_0x20bb6d[_0x3e1e('0x30')]=_0x20bb6d[_0x3e1e('0x30')]['length']?_0x20bb6d[_0x3e1e('0x30')]:_0x120618[_0x3e1e('0x2b')];_0x20bb6d[_0x3e1e('0x34')]=qs[_0x3e1e('0x35')](_0x4ad5e2[_0x3e1e('0x2e')][_0x3e1e('0x35')]);_0x20bb6d[_0x3e1e('0x36')]=qs[_0x3e1e('0x40')](_[_0x3e1e('0x37')](_0x4ad5e2[_0x3e1e('0x2e')],_0x120618[_0x3e1e('0x40')]));if(_0x4ad5e2[_0x3e1e('0x2e')]['filter']){_0x20bb6d[_0x3e1e('0x36')]=_[_0x3e1e('0x42')](_0x20bb6d['where'],{'$or':_[_0x3e1e('0x2c')](_0x20bb6d[_0x3e1e('0x30')],function(_0x1b7e29){var _0x292efb={};_0x292efb[_0x1b7e29]={'$like':'%'+_0x4ad5e2['query'][_0x3e1e('0x38')]+'%'};return _0x292efb;})});}_0x20bb6d=_[_0x3e1e('0x42')]({},_0x20bb6d,_0x4ad5e2[_0x3e1e('0x3a')]);return _0x4dac94[_0x3e1e('0x70')](_0x20bb6d);}})[_0x3e1e('0x21')](function(_0x285f83){if(_0x285f83){_0x2fced0=_0x285f83[_0x3e1e('0x41')];if(!_0x4ad5e2[_0x3e1e('0x2e')]['hasOwnProperty'](_0x3e1e('0x33'))){_0x20bb6d['limit']=qs[_0x3e1e('0x1c')](_0x4ad5e2[_0x3e1e('0x2e')][_0x3e1e('0x1c')]);_0x20bb6d[_0x3e1e('0x19')]=qs['offset'](_0x4ad5e2[_0x3e1e('0x2e')]['offset']);}return _0x4dac94[_0x3e1e('0x70')](_0x20bb6d);}})['then'](function(_0x1be666){if(_0x1be666){return _0x1be666?{'count':_0x2fced0,'rows':_0x1be666}:null;}})[_0x3e1e('0x21')](respondWithResult(_0x53ba1b,null))['catch'](handleError(_0x53ba1b,null));};exports[_0x3e1e('0x72')]=function(_0x1ed174,_0x54723b,_0x3d2406){var _0x2f07d3={};var _0x3b6af5={};var _0x23c86b;var _0x38a5b0;return db[_0x3e1e('0x3b')][_0x3e1e('0x73')]({'where':{'id':_0x1ed174['params']['id']}})[_0x3e1e('0x21')](handleEntityNotFound(_0x54723b,null))[_0x3e1e('0x21')](function(_0x5c5d32){if(_0x5c5d32){_0x23c86b=_0x5c5d32;_0x3b6af5[_0x3e1e('0x2b')]=_[_0x3e1e('0x2d')](db[_0x3e1e('0x74')]['rawAttributes']);_0x3b6af5[_0x3e1e('0x2e')]=_[_0x3e1e('0x2d')](_0x1ed174[_0x3e1e('0x2e')]);_0x3b6af5['filters']=_[_0x3e1e('0x2f')](_0x3b6af5['model'],_0x3b6af5[_0x3e1e('0x2e')]);_0x2f07d3[_0x3e1e('0x30')]=_[_0x3e1e('0x2f')](_0x3b6af5[_0x3e1e('0x2b')],qs[_0x3e1e('0x31')](_0x1ed174['query'][_0x3e1e('0x31')]));_0x2f07d3[_0x3e1e('0x30')]=_0x2f07d3[_0x3e1e('0x30')][_0x3e1e('0x41')]?_0x2f07d3[_0x3e1e('0x30')]:_0x3b6af5[_0x3e1e('0x2b')];_0x2f07d3[_0x3e1e('0x34')]=qs[_0x3e1e('0x35')](_0x1ed174[_0x3e1e('0x2e')]['sort']);_0x2f07d3[_0x3e1e('0x36')]=qs[_0x3e1e('0x40')](_[_0x3e1e('0x37')](_0x1ed174[_0x3e1e('0x2e')],_0x3b6af5[_0x3e1e('0x40')]));if(_0x1ed174['query'][_0x3e1e('0x38')]){_0x2f07d3[_0x3e1e('0x36')]=_[_0x3e1e('0x42')](_0x2f07d3[_0x3e1e('0x36')],{'$or':_[_0x3e1e('0x2c')](_0x2f07d3[_0x3e1e('0x30')],function(_0x1047de){var _0xe0eeab={};_0xe0eeab[_0x1047de]={'$like':'%'+_0x1ed174[_0x3e1e('0x2e')]['filter']+'%'};return _0xe0eeab;})});}_0x2f07d3=_[_0x3e1e('0x42')]({},_0x2f07d3,_0x1ed174[_0x3e1e('0x3a')]);return _0x23c86b['getTeams'](_0x2f07d3);}})[_0x3e1e('0x21')](function(_0x537072){if(_0x537072){_0x38a5b0=_0x537072[_0x3e1e('0x41')];if(!_0x1ed174[_0x3e1e('0x2e')][_0x3e1e('0x32')](_0x3e1e('0x33'))){_0x2f07d3[_0x3e1e('0x1c')]=qs[_0x3e1e('0x1c')](_0x1ed174[_0x3e1e('0x2e')][_0x3e1e('0x1c')]);_0x2f07d3[_0x3e1e('0x19')]=qs[_0x3e1e('0x19')](_0x1ed174['query']['offset']);}return _0x23c86b[_0x3e1e('0x72')](_0x2f07d3);}})[_0x3e1e('0x21')](function(_0x548cba){if(_0x548cba){return _0x548cba?{'count':_0x38a5b0,'rows':_0x548cba}:null;}})[_0x3e1e('0x21')](respondWithResult(_0x54723b,null))[_0x3e1e('0x44')](handleError(_0x54723b,null));};exports[_0x3e1e('0x75')]=function(_0x4a33f5,_0x5a6cb2,_0x2ec5e9){var _0xbfc033=_0x4a33f5[_0x3e1e('0x63')]['ids'];var _0x3049c4;return db['Team']['findAll']({'where':{'id':_0xbfc033},'attributes':['id'],'include':[{'model':db[_0x3e1e('0x71')],'as':_0x3e1e('0x76'),'attributes':['id','name',_0x3e1e('0x77'),_0x3e1e('0x78'),_0x3e1e('0x79')],'raw':!![]}]})[_0x3e1e('0x21')](function(_0x1ca30f){if(_0x1ca30f){_0x3049c4=_0x1ca30f;var _0x285ae4=_[_0x3e1e('0x7a')](_0x1ca30f,function(_0x32c3cf){var _0x201d18=_0x32c3cf[_0x3e1e('0x48')]({'plain':!![]});return _0x201d18[_0x3e1e('0x76')];});return db['VoicePrefix']['find']({'where':{'id':_0x4a33f5[_0x3e1e('0x45')]['id']}})[_0x3e1e('0x21')](function(_0x416b06){return db[_0x3e1e('0x65')]['transaction'](function(_0x2dea8b){return _0x416b06[_0x3e1e('0x75')](_0xbfc033,{'transaction':_0x2dea8b})['then'](function(){return BPromise['each'](_0x3049c4,function(_0x34c4c8){return db[_0x3e1e('0x7b')]['upsert']({'TeamId':_0x34c4c8['id'],'VoicePrefixId':_0x4a33f5[_0x3e1e('0x45')]['id']},{'transaction':_0x2dea8b});});})[_0x3e1e('0x21')](function(){return BPromise[_0x3e1e('0x7c')](_0x285ae4,function(_0x4332db){return db[_0x3e1e('0x7d')]['findOrCreate']({'where':{'UserId':_0x4332db['id'],'VoicePrefixId':_0x4a33f5[_0x3e1e('0x45')]['id']},'transaction':_0x2dea8b});});})[_0x3e1e('0x21')](function(){_0x285ae4['forEach'](function(_0x838800){socket['emit']('userVoicePrefix:save',{'UserId':_0x838800['id'],'VoicePrefixId':_0x416b06['id']});});});});});}})[_0x3e1e('0x21')](respondWithStatusCode(_0x5a6cb2,null))[_0x3e1e('0x44')](handleError(_0x5a6cb2,null));};exports[_0x3e1e('0x7e')]=function(_0xe57be2,_0x3ad5b0,_0x5788ea){return db[_0x3e1e('0x74')][_0x3e1e('0x3d')]({'where':{'id':_0xe57be2[_0x3e1e('0x2e')][_0x3e1e('0x69')]},'attributes':['id'],'include':[{'model':db[_0x3e1e('0x71')],'as':_0x3e1e('0x76'),'attributes':['id'],'raw':!![]}]})[_0x3e1e('0x21')](handleEntityNotFound(_0x3ad5b0,null))['then'](function(_0x2511d2){var _0x2d29d7=_[_0x3e1e('0x2c')](_0x2511d2,'id');var _0x161aa2=[];var _0x61318=[];var _0x20fa70=squel[_0x3e1e('0x7f')]();_0x20fa70['field'](_0x3e1e('0x80'))['from'](_0x3e1e('0x81'),'tq')[_0x3e1e('0x82')](_0x3e1e('0x83'),'ut',_0x3e1e('0x84'))[_0x3e1e('0x36')]('VoicePrefixId\x20=\x20?',_0xe57be2[_0x3e1e('0x45')]['id']);for(var _0x463428=0x0;_0x463428<_0x2511d2[_0x3e1e('0x41')];_0x463428+=0x1){let _0x5c6ba6=_0x2511d2[_0x463428];for(var _0x37eb53=0x0;_0x37eb53<_0x5c6ba6[_0x3e1e('0x76')]['length'];_0x37eb53+=0x1){let _0x3ae731=_0x5c6ba6['Agents'][_0x37eb53];var _0x2a2e80=_0x20fa70[_0x3e1e('0x85')]();_0x2a2e80[_0x3e1e('0x36')](_0x3e1e('0x86'),_0x3ae731['id']);_0x61318['push'](db[_0x3e1e('0x65')][_0x3e1e('0x2e')](_0x2a2e80[_0x3e1e('0x87')](),{'type':db[_0x3e1e('0x65')][_0x3e1e('0x88')][_0x3e1e('0x89')]})[_0x3e1e('0x21')](function(_0x415c88){if(_0x415c88[_0x3e1e('0x41')]===0x1){return _0x3ae731['id'];}else{var _0x187048=_[_0x3e1e('0x8a')](_[_0x3e1e('0x2c')](_0x415c88,'TeamId'),function(_0x244a5d){return _[_0x3e1e('0x8b')](_0x2d29d7,_0x244a5d);});if(_0x187048){return _0x3ae731['id'];}}}));}}return BPromise[_0x3e1e('0x8c')](_0x61318)[_0x3e1e('0x21')](function(_0x4afad1){_0x161aa2=_(_0x161aa2)[_0x3e1e('0x8d')](_0x4afad1)[_0x3e1e('0x8e')]()[_0x3e1e('0x8f')]();return db[_0x3e1e('0x3b')]['find']({'where':{'id':_0xe57be2[_0x3e1e('0x45')]['id']}})[_0x3e1e('0x21')](function(_0x5ef204){return db[_0x3e1e('0x65')][_0x3e1e('0x66')](function(_0x487d3f){return _0x5ef204[_0x3e1e('0x7e')](_0xe57be2[_0x3e1e('0x2e')][_0x3e1e('0x69')],{'transaction':_0x487d3f})[_0x3e1e('0x21')](function(){if(!_[_0x3e1e('0x90')](_0x161aa2)){return _0x5ef204['removeAgents'](_0x161aa2,{'transaction':_0x487d3f});}})[_0x3e1e('0x21')](function(){_0x161aa2[_0x3e1e('0x91')](function(_0x22d774){socket['emit'](_0x3e1e('0x6f'),{'UserId':_0x22d774,'VoicePrefixId':_0x5ef204['id']});});});});});});})[_0x3e1e('0x21')](respondWithStatusCode(_0x3ad5b0,null))[_0x3e1e('0x44')](handleError(_0x3ad5b0,null));}; \ No newline at end of file +var _0xd7d1=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','intersection','describe','create','sequelize','VoiceExtension','VoiceExtensionId','user','role','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','body','system-','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','findOne','User','getAgents','getTeams','addTeams','Agents','online','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','Team','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','get','VoicePrefixes','destroy','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x181fcc,_0x31ffea){var _0x34b13c=function(_0x905170){while(--_0x905170){_0x181fcc['push'](_0x181fcc['shift']());}};_0x34b13c(++_0x31ffea);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x20b6b0,_0x330516){_0x20b6b0=_0x20b6b0-0x0;var _0x14a28f=_0xd7d1[_0x20b6b0];return _0x14a28f;};'use strict';var emlformat=require(_0x1d7d('0x0'));var rimraf=require(_0x1d7d('0x1'));var zipdir=require(_0x1d7d('0x2'));var jsonpatch=require(_0x1d7d('0x3'));var rp=require(_0x1d7d('0x4'));var moment=require(_0x1d7d('0x5'));var BPromise=require(_0x1d7d('0x6'));var Mustache=require(_0x1d7d('0x7'));var util=require(_0x1d7d('0x8'));var path=require(_0x1d7d('0x9'));var sox=require(_0x1d7d('0xa'));var csv=require(_0x1d7d('0xb'));var ejs=require(_0x1d7d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xb'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d7d('0x17'));var logger=require('../../config/logger')(_0x1d7d('0x18'));var utils=require(_0x1d7d('0x19'));var config=require(_0x1d7d('0x1a'));var licenseUtil=require(_0x1d7d('0x1b'));var db=require('../../mysqldb')['db'];config[_0x1d7d('0x1c')]=_['defaults'](config['redis'],{'host':_0x1d7d('0x1d'),'port':0x18eb});var socket=require(_0x1d7d('0x1e'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x1d7d('0x1f')](socket);function respondWithStatusCode(_0x334e78,_0xe10fdd){_0xe10fdd=_0xe10fdd||0xcc;return function(_0x183fc6){if(_0x183fc6){return _0x334e78[_0x1d7d('0x20')](_0xe10fdd);}return _0x334e78['status'](_0xe10fdd)[_0x1d7d('0x21')]();};}function respondWithResult(_0x1de6cc,_0x51cbca){_0x51cbca=_0x51cbca||0xc8;return function(_0xb90a8c){if(_0xb90a8c){return _0x1de6cc[_0x1d7d('0x22')](_0x51cbca)[_0x1d7d('0x23')](_0xb90a8c);}};}function respondWithFilteredResult(_0x47826a,_0x40db4d){return function(_0x4db4f2){if(_0x4db4f2){var _0x664e3f=typeof _0x40db4d[_0x1d7d('0x24')]==='undefined'&&typeof _0x40db4d['limit']===_0x1d7d('0x25');var _0x1a5101=_0x4db4f2[_0x1d7d('0x26')];var _0x396802=_0x664e3f?0x0:_0x40db4d[_0x1d7d('0x24')];var _0x275d3c=_0x664e3f?_0x4db4f2['count']:_0x40db4d[_0x1d7d('0x24')]+_0x40db4d[_0x1d7d('0x27')];var _0x3a93d0;if(_0x275d3c>=_0x1a5101){_0x275d3c=_0x1a5101;_0x3a93d0=0xc8;}else{_0x3a93d0=0xce;}_0x47826a['status'](_0x3a93d0);return _0x47826a[_0x1d7d('0x28')](_0x1d7d('0x29'),_0x396802+'-'+_0x275d3c+'/'+_0x1a5101)['json'](_0x4db4f2);}return null;};}function patchUpdates(_0x5950bd){return function(_0x1dcaf2){try{jsonpatch[_0x1d7d('0x2a')](_0x1dcaf2,_0x5950bd,!![]);}catch(_0x3d631f){return BPromise['reject'](_0x3d631f);}return _0x1dcaf2[_0x1d7d('0x2b')]();};}function saveUpdates(_0x106376,_0x2d4c0c){return function(_0x21e59){if(_0x21e59){return _0x21e59['update'](_0x106376)[_0x1d7d('0x2c')](function(_0x151198){return _0x151198;});}return null;};}function removeEntity(_0x5c8257,_0x57bbd8){return function(_0x301e5c){if(_0x301e5c){return _0x301e5c['destroy']()[_0x1d7d('0x2c')](function(){var _0x2d4de4=_0x301e5c[_0x1d7d('0x2d')]({'plain':!![]});var _0x22c40d=_0x1d7d('0x2e');return db['UserProfileResource'][_0x1d7d('0x2f')]({'where':{'type':_0x22c40d,'resourceId':_0x2d4de4['id']}})[_0x1d7d('0x2c')](function(){return _0x301e5c;});})[_0x1d7d('0x2c')](function(){_0x5c8257['status'](0xcc)[_0x1d7d('0x21')]();});}};}function handleEntityNotFound(_0x1a935a,_0x23ad85){return function(_0x482367){if(!_0x482367){_0x1a935a['sendStatus'](0x194);}return _0x482367;};}function handleError(_0x53e25c,_0x189a6a){_0x189a6a=_0x189a6a||0x1f4;return function(_0x329f56){logger['error'](_0x329f56[_0x1d7d('0x30')]);if(_0x329f56[_0x1d7d('0x31')]){delete _0x329f56[_0x1d7d('0x31')];}_0x53e25c[_0x1d7d('0x22')](_0x189a6a)[_0x1d7d('0x32')](_0x329f56);};}exports[_0x1d7d('0x33')]=function(_0x452293,_0x803dc9){var _0xd701e1={},_0x456b56={},_0x5b2209={'count':0x0,'rows':[]};var _0x57c22e=_[_0x1d7d('0x34')](db[_0x1d7d('0x35')][_0x1d7d('0x36')],function(_0x40318f){return{'name':_0x40318f[_0x1d7d('0x37')],'type':_0x40318f[_0x1d7d('0x38')][_0x1d7d('0x39')]};});_0x456b56[_0x1d7d('0x3a')]=_[_0x1d7d('0x34')](_0x57c22e,'name');_0x456b56[_0x1d7d('0x3b')]=_[_0x1d7d('0x3c')](_0x452293[_0x1d7d('0x3b')]);_0x456b56[_0x1d7d('0x3d')]=_['intersection'](_0x456b56['model'],_0x456b56[_0x1d7d('0x3b')]);_0xd701e1[_0x1d7d('0x3e')]=_['intersection'](_0x456b56[_0x1d7d('0x3a')],qs[_0x1d7d('0x3f')](_0x452293['query']['fields']));_0xd701e1[_0x1d7d('0x3e')]=_0xd701e1[_0x1d7d('0x3e')][_0x1d7d('0x40')]?_0xd701e1[_0x1d7d('0x3e')]:_0x456b56[_0x1d7d('0x3a')];if(!_0x452293[_0x1d7d('0x3b')][_0x1d7d('0x41')](_0x1d7d('0x42'))){_0xd701e1[_0x1d7d('0x27')]=qs[_0x1d7d('0x27')](_0x452293['query']['limit']);_0xd701e1['offset']=qs['offset'](_0x452293[_0x1d7d('0x3b')]['offset']);}_0xd701e1[_0x1d7d('0x43')]=qs[_0x1d7d('0x44')](_0x452293[_0x1d7d('0x3b')]['sort']);_0xd701e1[_0x1d7d('0x45')]=qs[_0x1d7d('0x3d')](_[_0x1d7d('0x46')](_0x452293['query'],_0x456b56[_0x1d7d('0x3d')]),_0x57c22e);if(_0x452293[_0x1d7d('0x3b')][_0x1d7d('0x47')]){_0xd701e1[_0x1d7d('0x45')]=_['merge'](_0xd701e1[_0x1d7d('0x45')],{'$or':_[_0x1d7d('0x34')](_0x57c22e,function(_0x4239fa){if(_0x4239fa[_0x1d7d('0x38')]!=='VIRTUAL'){var _0x14a6b3={};_0x14a6b3[_0x4239fa['name']]={'$like':'%'+_0x452293[_0x1d7d('0x3b')][_0x1d7d('0x47')]+'%'};return _0x14a6b3;}})});}_0xd701e1=_[_0x1d7d('0x48')]({},_0xd701e1,_0x452293[_0x1d7d('0x49')]);var _0xf667a1={'where':_0xd701e1['where']};return db['VoicePrefix'][_0x1d7d('0x26')](_0xf667a1)[_0x1d7d('0x2c')](function(_0x1637fc){_0x5b2209['count']=_0x1637fc;if(_0x452293['query'][_0x1d7d('0x4a')]){_0xd701e1['include']=[{'all':!![]}];}return db[_0x1d7d('0x35')][_0x1d7d('0x4b')](_0xd701e1);})[_0x1d7d('0x2c')](function(_0x21394c){_0x5b2209[_0x1d7d('0x4c')]=_0x21394c;return _0x5b2209;})[_0x1d7d('0x2c')](respondWithFilteredResult(_0x803dc9,_0xd701e1))[_0x1d7d('0x4d')](handleError(_0x803dc9,null));};exports['show']=function(_0x3ccd44,_0x8b0c22){var _0x49de57={'raw':![],'where':{'id':_0x3ccd44[_0x1d7d('0x4e')]['id']}},_0x17c68b={};_0x17c68b[_0x1d7d('0x3a')]=_[_0x1d7d('0x3c')](db[_0x1d7d('0x35')][_0x1d7d('0x36')]);_0x17c68b[_0x1d7d('0x3b')]=_[_0x1d7d('0x3c')](_0x3ccd44[_0x1d7d('0x3b')]);_0x17c68b[_0x1d7d('0x3d')]=_[_0x1d7d('0x4f')](_0x17c68b[_0x1d7d('0x3a')],_0x17c68b['query']);_0x49de57[_0x1d7d('0x3e')]=_['intersection'](_0x17c68b[_0x1d7d('0x3a')],qs['fields'](_0x3ccd44[_0x1d7d('0x3b')][_0x1d7d('0x3f')]));_0x49de57[_0x1d7d('0x3e')]=_0x49de57[_0x1d7d('0x3e')]['length']?_0x49de57[_0x1d7d('0x3e')]:_0x17c68b['model'];if(_0x3ccd44['query'][_0x1d7d('0x4a')]){_0x49de57['include']=[{'all':!![]}];}_0x49de57=_['merge']({},_0x49de57,_0x3ccd44[_0x1d7d('0x49')]);return db[_0x1d7d('0x35')]['find'](_0x49de57)[_0x1d7d('0x2c')](handleEntityNotFound(_0x8b0c22,null))[_0x1d7d('0x2c')](respondWithResult(_0x8b0c22,null))['catch'](handleError(_0x8b0c22,null));};exports[_0x1d7d('0x2f')]=function(_0x2b9faa,_0xa64dbe){return db[_0x1d7d('0x35')]['find']({'where':{'id':_0x2b9faa['params']['id']}})[_0x1d7d('0x2c')](handleEntityNotFound(_0xa64dbe,null))[_0x1d7d('0x2c')](removeEntity(_0xa64dbe,null))[_0x1d7d('0x4d')](handleError(_0xa64dbe,null));};exports[_0x1d7d('0x50')]=function(_0x3cc5b7,_0x550c9f){return db[_0x1d7d('0x35')][_0x1d7d('0x50')]()[_0x1d7d('0x2c')](respondWithResult(_0x550c9f,null))[_0x1d7d('0x4d')](handleError(_0x550c9f,null));};exports[_0x1d7d('0x51')]=function(_0x42a103,_0x276e7e){var _0x296e7c;return db[_0x1d7d('0x52')]['transaction'](function(_0x3e7c4c){return db[_0x1d7d('0x35')][_0x1d7d('0x51')](_0x42a103['body'],{'transaction':_0x3e7c4c})['then'](function(_0x1d3f54){_0x296e7c=_0x1d3f54[_0x1d7d('0x2d')]({'plain':!![]});return db[_0x1d7d('0x53')]['find']({'where':{'id':_0x296e7c[_0x1d7d('0x54')]},'raw':!![]})[_0x1d7d('0x2c')](function(_0x5eff64){return createVoicePrefixExtensions(_0x296e7c,_0x5eff64,_0x3e7c4c);});});})[_0x1d7d('0x2c')](function(){var _0x2cf508=_0x42a103[_0x1d7d('0x55')][_0x1d7d('0x2d')]({'plain':!![]});if(!_0x2cf508)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cf508[_0x1d7d('0x56')]===_0x1d7d('0x55')){var _0x4ba6ec=_0x296e7c;return db['UserProfileSection'][_0x1d7d('0x57')]({'where':{'name':_0x1d7d('0x2e'),'userProfileId':_0x2cf508['userProfileId']},'raw':!![]})['then'](function(_0x155ef4){if(_0x155ef4&&_0x155ef4[_0x1d7d('0x58')]===0x0){return db[_0x1d7d('0x59')][_0x1d7d('0x51')]({'name':_0x4ba6ec['name'],'resourceId':_0x4ba6ec['id'],'type':_0x155ef4[_0x1d7d('0x31')],'sectionId':_0x155ef4['id']},{})['then'](function(){return _0x296e7c;});}else{return _0x296e7c;}})[_0x1d7d('0x4d')](function(_0x1b1d9e){logger[_0x1d7d('0x5a')](_0x1d7d('0x5b'),_0x1b1d9e);throw _0x1b1d9e;});}return _0x296e7c;})['then'](respondWithResult(_0x276e7e,null))[_0x1d7d('0x4d')](handleError(_0x276e7e,null));};function Extension(_0x1ea966,_0x193135,_0x226509,_0x28ec14){this[_0x1d7d('0x5c')]=_0x1d7d('0x5d');this[_0x1d7d('0x5e')]=_0x1ea966;this[_0x1d7d('0x5f')]=_0x226509;this[_0x1d7d('0x38')]=_0x1d7d('0x60');this[_0x1d7d('0x61')]=_0x1d7d('0x62');this[_0x1d7d('0x63')]=_0x193135;this[_0x1d7d('0x64')]=_0x28ec14;}function createVoicePrefixExtensions(_0x520d3c,_0x2279c5,_0x566d27){return new BPromise(function(_0x1c9fe7,_0x1e3853){var _0x1c698c=new Extension(formatPrefixName(_0x520d3c[_0x1d7d('0x65')]),0x1,_0x1d7d('0x66'),_0x1d7d('0x67'));_0x1c698c['VoicePrefixId']=_0x520d3c['id'];return db[_0x1d7d('0x53')][_0x1d7d('0x51')](_0x1c698c,{'transaction':_0x566d27})['then'](function(_0x2c6d03){var _0x5ed678=_0x2c6d03[_0x1d7d('0x2d')]({'plain':!![]});var _0x119e76=_[_0x1d7d('0x34')](addVoicePrefixExtensions(_0x520d3c,_0x2279c5),function(_0x283f77){_0x283f77[_0x1d7d('0x54')]=_0x5ed678['id'];_0x283f77[_0x1d7d('0x68')]=_0x520d3c['id'];return _0x283f77;});return db['VoiceExtension'][_0x1d7d('0x69')](_0x119e76,{'transaction':_0x566d27})[_0x1d7d('0x2c')](function(_0x4d69cc){if(!_0x4d69cc){return _0x1e3853(_0x1d7d('0x6a'));}else{return _0x1c9fe7(_0x4d69cc);}})[_0x1d7d('0x4d')](function(_0x3c8a65){return _0x1e3853(_0x3c8a65);});});;});};function addVoicePrefixExtensions(_0x4bc7b8,_0x3b3975){var _0xe5c3ba=[];var _0x1038ae=formatPrefixName(_0x4bc7b8[_0x1d7d('0x65')]);_0xe5c3ba['push'](new Extension(_0x1038ae,0x2,_0x1d7d('0x6b'),_0x1d7d('0x6c')+_0x4bc7b8[_0x1d7d('0x31')]));if(_0x4bc7b8[_0x1d7d('0x6d')]){_0xe5c3ba[_0x1d7d('0x6e')](new Extension(_0x1038ae,0x3,'Set',_0x1d7d('0x6f')+_0x4bc7b8[_0x1d7d('0x6d')]));}else{_0xe5c3ba['push'](new Extension(_0x1038ae,0x3,_0x1d7d('0x66'),_0x1d7d('0x70')));}_0xe5c3ba[_0x1d7d('0x6e')](new Extension(_0x1038ae,0x4,_0x1d7d('0x71'),_0x3b3975['context']+','+_0x1d7d('0x72')+(0x8+_0x4bc7b8['name'][_0x1d7d('0x40')])+'}'+','+0x1));return _0xe5c3ba;}function formatPrefixName(_0x138fc2){var _0x30dc64='_';for(var _0x5e1172=0x0;_0x5e1172<_0x138fc2[_0x1d7d('0x40')];_0x5e1172++){if(_0x138fc2[_0x1d7d('0x73')](_0x5e1172)=='-'){_0x30dc64+=_0x138fc2[_0x1d7d('0x73')](_0x5e1172);}else{_0x30dc64+='['+_0x138fc2['charAt'](_0x5e1172)+']';}}_0x30dc64+='.';return _0x30dc64;}exports[_0x1d7d('0x74')]=function(_0x47c1d5,_0x6e9ee6,_0x2a413b){var _0x131c8e=_0x47c1d5[_0x1d7d('0x75')];_0x131c8e[_0x1d7d('0x65')]=_0x1d7d('0x76')+_0x131c8e[_0x1d7d('0x31')]+'-';return db[_0x1d7d('0x52')][_0x1d7d('0x77')](function(_0x347877){return db[_0x1d7d('0x35')]['update'](_0x131c8e,{'where':{'id':_0x131c8e['id']},'transaction':_0x347877})['then'](function(){return db[_0x1d7d('0x53')][_0x1d7d('0x2f')]({'where':{'VoicePrefixId':_0x131c8e['id']},'transaction':_0x347877})[_0x1d7d('0x2c')](function(){return db['VoiceExtension'][_0x1d7d('0x57')]({'where':{'id':_0x131c8e['VoiceExtensionId']},'raw':!![]})[_0x1d7d('0x2c')](function(_0x33e656){return createVoicePrefixExtensions(_0x131c8e,_0x33e656,_0x347877);});});});})['then'](function(){return db[_0x1d7d('0x35')][_0x1d7d('0x78')](_0x131c8e['id']);})['then'](respondWithResult(_0x6e9ee6,null))[_0x1d7d('0x4d')](handleError(_0x6e9ee6,null));};exports[_0x1d7d('0x79')]=function(_0xc9b467,_0x50a21e,_0x47dc25){return db[_0x1d7d('0x35')][_0x1d7d('0x57')]({'where':{'id':_0xc9b467['params']['id']}})[_0x1d7d('0x2c')](handleEntityNotFound(_0x50a21e,null))[_0x1d7d('0x2c')](function(_0x268046){if(_0x268046){return _0x268046[_0x1d7d('0x79')](_0xc9b467['body'][_0x1d7d('0x7a')],_[_0x1d7d('0x7b')](_0xc9b467[_0x1d7d('0x75')],[_0x1d7d('0x7a'),'id'])||{})[_0x1d7d('0x7c')](function(_0x38bddd){for(var _0x42a83c=0x0;_0x42a83c<_0xc9b467[_0x1d7d('0x75')][_0x1d7d('0x7a')][_0x1d7d('0x40')];_0x42a83c+=0x1){socket[_0x1d7d('0x7d')](_0x1d7d('0x7e'),{'UserId':Number(_0xc9b467[_0x1d7d('0x75')]['ids'][_0x42a83c]),'VoicePrefixId':Number(_0xc9b467[_0x1d7d('0x4e')]['id'])});}return _0x38bddd;});}})[_0x1d7d('0x2c')](respondWithResult(_0x50a21e,null))['catch'](handleError(_0x50a21e,null));};exports[_0x1d7d('0x7f')]=function(_0x2e4373,_0x5d1a0e,_0x5b61c1){return db['VoicePrefix'][_0x1d7d('0x57')]({'where':{'id':_0x2e4373[_0x1d7d('0x4e')]['id']}})[_0x1d7d('0x2c')](handleEntityNotFound(_0x5d1a0e,null))[_0x1d7d('0x2c')](function(_0x4db998){if(_0x4db998){return _0x4db998[_0x1d7d('0x7f')](_0x2e4373[_0x1d7d('0x3b')][_0x1d7d('0x7a')])[_0x1d7d('0x2c')](function(){if(_['isArray'](_0x2e4373[_0x1d7d('0x3b')][_0x1d7d('0x7a')])){for(var _0x135910=0x0;_0x135910<_0x2e4373[_0x1d7d('0x3b')][_0x1d7d('0x7a')][_0x1d7d('0x40')];_0x135910+=0x1){socket['emit'](_0x1d7d('0x80'),{'UserId':Number(_0x2e4373[_0x1d7d('0x3b')]['ids'][_0x135910]),'VoicePrefixId':Number(_0x2e4373[_0x1d7d('0x4e')]['id'])});}}else{socket[_0x1d7d('0x7d')](_0x1d7d('0x80'),{'UserId':Number(_0x2e4373['query'][_0x1d7d('0x7a')]),'VoicePrefixId':Number(_0x2e4373['params']['id'])});}});}})[_0x1d7d('0x2c')](respondWithStatusCode(_0x5d1a0e,null))[_0x1d7d('0x4d')](handleError(_0x5d1a0e,null));};exports['getAgents']=function(_0x122483,_0x3390ab,_0xe381ff){var _0xc3c42f={};var _0x20b275={};var _0xb6519f;var _0x17ba85;return db[_0x1d7d('0x35')][_0x1d7d('0x81')]({'where':{'id':_0x122483[_0x1d7d('0x4e')]['id']}})[_0x1d7d('0x2c')](handleEntityNotFound(_0x3390ab,null))[_0x1d7d('0x2c')](function(_0x4e635a){if(_0x4e635a){_0xb6519f=_0x4e635a;_0x20b275['model']=_[_0x1d7d('0x3c')](db[_0x1d7d('0x82')][_0x1d7d('0x36')]);_0x20b275[_0x1d7d('0x3b')]=_[_0x1d7d('0x3c')](_0x122483[_0x1d7d('0x3b')]);_0x20b275[_0x1d7d('0x3d')]=_[_0x1d7d('0x4f')](_0x20b275[_0x1d7d('0x3a')],_0x20b275[_0x1d7d('0x3b')]);_0xc3c42f[_0x1d7d('0x3e')]=_[_0x1d7d('0x4f')](_0x20b275['model'],qs[_0x1d7d('0x3f')](_0x122483[_0x1d7d('0x3b')][_0x1d7d('0x3f')]));_0xc3c42f[_0x1d7d('0x3e')]=_0xc3c42f['attributes'][_0x1d7d('0x40')]?_0xc3c42f[_0x1d7d('0x3e')]:_0x20b275[_0x1d7d('0x3a')];_0xc3c42f[_0x1d7d('0x43')]=qs['sort'](_0x122483['query']['sort']);_0xc3c42f['where']=qs[_0x1d7d('0x3d')](_[_0x1d7d('0x46')](_0x122483['query'],_0x20b275['filters']));if(_0x122483[_0x1d7d('0x3b')][_0x1d7d('0x47')]){_0xc3c42f[_0x1d7d('0x45')]=_[_0x1d7d('0x48')](_0xc3c42f[_0x1d7d('0x45')],{'$or':_[_0x1d7d('0x34')](_0xc3c42f[_0x1d7d('0x3e')],function(_0x35020c){var _0x2f2a28={};_0x2f2a28[_0x35020c]={'$like':'%'+_0x122483[_0x1d7d('0x3b')]['filter']+'%'};return _0x2f2a28;})});}_0xc3c42f=_[_0x1d7d('0x48')]({},_0xc3c42f,_0x122483['options']);return _0xb6519f[_0x1d7d('0x83')](_0xc3c42f);}})[_0x1d7d('0x2c')](function(_0x29186b){if(_0x29186b){_0x17ba85=_0x29186b['length'];if(!_0x122483[_0x1d7d('0x3b')][_0x1d7d('0x41')](_0x1d7d('0x42'))){_0xc3c42f[_0x1d7d('0x27')]=qs[_0x1d7d('0x27')](_0x122483[_0x1d7d('0x3b')][_0x1d7d('0x27')]);_0xc3c42f[_0x1d7d('0x24')]=qs[_0x1d7d('0x24')](_0x122483[_0x1d7d('0x3b')][_0x1d7d('0x24')]);}return _0xb6519f[_0x1d7d('0x83')](_0xc3c42f);}})[_0x1d7d('0x2c')](function(_0xd6c7ad){if(_0xd6c7ad){return _0xd6c7ad?{'count':_0x17ba85,'rows':_0xd6c7ad}:null;}})[_0x1d7d('0x2c')](respondWithResult(_0x3390ab,null))[_0x1d7d('0x4d')](handleError(_0x3390ab,null));};exports[_0x1d7d('0x84')]=function(_0x2aac19,_0x37ba0e,_0x443c53){var _0x689a17={};var _0x65407b={};var _0xecfc39;var _0x4fac26;return db[_0x1d7d('0x35')][_0x1d7d('0x81')]({'where':{'id':_0x2aac19[_0x1d7d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x37ba0e,null))[_0x1d7d('0x2c')](function(_0x589609){if(_0x589609){_0xecfc39=_0x589609;_0x65407b['model']=_['keys'](db['Team'][_0x1d7d('0x36')]);_0x65407b[_0x1d7d('0x3b')]=_[_0x1d7d('0x3c')](_0x2aac19['query']);_0x65407b[_0x1d7d('0x3d')]=_['intersection'](_0x65407b[_0x1d7d('0x3a')],_0x65407b[_0x1d7d('0x3b')]);_0x689a17[_0x1d7d('0x3e')]=_[_0x1d7d('0x4f')](_0x65407b[_0x1d7d('0x3a')],qs[_0x1d7d('0x3f')](_0x2aac19[_0x1d7d('0x3b')][_0x1d7d('0x3f')]));_0x689a17[_0x1d7d('0x3e')]=_0x689a17[_0x1d7d('0x3e')][_0x1d7d('0x40')]?_0x689a17['attributes']:_0x65407b[_0x1d7d('0x3a')];_0x689a17[_0x1d7d('0x43')]=qs[_0x1d7d('0x44')](_0x2aac19['query'][_0x1d7d('0x44')]);_0x689a17[_0x1d7d('0x45')]=qs[_0x1d7d('0x3d')](_['pick'](_0x2aac19['query'],_0x65407b[_0x1d7d('0x3d')]));if(_0x2aac19['query'][_0x1d7d('0x47')]){_0x689a17[_0x1d7d('0x45')]=_['merge'](_0x689a17[_0x1d7d('0x45')],{'$or':_[_0x1d7d('0x34')](_0x689a17['attributes'],function(_0x3cfd3d){var _0xd0d1b5={};_0xd0d1b5[_0x3cfd3d]={'$like':'%'+_0x2aac19[_0x1d7d('0x3b')][_0x1d7d('0x47')]+'%'};return _0xd0d1b5;})});}_0x689a17=_['merge']({},_0x689a17,_0x2aac19['options']);return _0xecfc39[_0x1d7d('0x84')](_0x689a17);}})[_0x1d7d('0x2c')](function(_0x3c257c){if(_0x3c257c){_0x4fac26=_0x3c257c[_0x1d7d('0x40')];if(!_0x2aac19[_0x1d7d('0x3b')][_0x1d7d('0x41')](_0x1d7d('0x42'))){_0x689a17[_0x1d7d('0x27')]=qs[_0x1d7d('0x27')](_0x2aac19[_0x1d7d('0x3b')][_0x1d7d('0x27')]);_0x689a17[_0x1d7d('0x24')]=qs[_0x1d7d('0x24')](_0x2aac19[_0x1d7d('0x3b')][_0x1d7d('0x24')]);}return _0xecfc39[_0x1d7d('0x84')](_0x689a17);}})[_0x1d7d('0x2c')](function(_0x1c1ace){if(_0x1c1ace){return _0x1c1ace?{'count':_0x4fac26,'rows':_0x1c1ace}:null;}})['then'](respondWithResult(_0x37ba0e,null))[_0x1d7d('0x4d')](handleError(_0x37ba0e,null));};exports[_0x1d7d('0x85')]=function(_0x16ce51,_0x20b99d,_0x5ca824){var _0x4096cf=_0x16ce51[_0x1d7d('0x75')][_0x1d7d('0x7a')];var _0x1d1a34;return db['Team'][_0x1d7d('0x4b')]({'where':{'id':_0x4096cf},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1d7d('0x86'),'attributes':['id',_0x1d7d('0x31'),_0x1d7d('0x87'),'voicePause',_0x1d7d('0x88')],'raw':!![]}]})['then'](function(_0x341e74){if(_0x341e74){_0x1d1a34=_0x341e74;var _0x1c1077=_[_0x1d7d('0x89')](_0x341e74,function(_0x466208){var _0x4bbdc8=_0x466208[_0x1d7d('0x2d')]({'plain':!![]});return _0x4bbdc8['Agents'];});return db[_0x1d7d('0x35')][_0x1d7d('0x57')]({'where':{'id':_0x16ce51['params']['id']}})[_0x1d7d('0x2c')](function(_0x3dc8ee){return db[_0x1d7d('0x52')][_0x1d7d('0x77')](function(_0x4dca1d){return _0x3dc8ee['addTeams'](_0x4096cf,{'transaction':_0x4dca1d})['then'](function(){return BPromise[_0x1d7d('0x8a')](_0x1d1a34,function(_0x3ae715){return db[_0x1d7d('0x8b')][_0x1d7d('0x8c')]({'TeamId':_0x3ae715['id'],'VoicePrefixId':_0x16ce51[_0x1d7d('0x4e')]['id']},{'transaction':_0x4dca1d});});})['then'](function(){return BPromise[_0x1d7d('0x8a')](_0x1c1077,function(_0x41874){return db[_0x1d7d('0x8d')][_0x1d7d('0x8e')]({'where':{'UserId':_0x41874['id'],'VoicePrefixId':_0x16ce51['params']['id']},'transaction':_0x4dca1d});});})['then'](function(){_0x1c1077[_0x1d7d('0x8f')](function(_0x21995f){socket[_0x1d7d('0x7d')](_0x1d7d('0x7e'),{'UserId':_0x21995f['id'],'VoicePrefixId':_0x3dc8ee['id']});});});});});}})[_0x1d7d('0x2c')](respondWithStatusCode(_0x20b99d,null))[_0x1d7d('0x4d')](handleError(_0x20b99d,null));};exports['removeTeams']=function(_0x37863c,_0x5cf31f,_0x42893a){return db[_0x1d7d('0x90')]['findAll']({'where':{'id':_0x37863c[_0x1d7d('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1d7d('0x82')],'as':_0x1d7d('0x86'),'attributes':['id'],'raw':!![]}]})[_0x1d7d('0x2c')](handleEntityNotFound(_0x5cf31f,null))[_0x1d7d('0x2c')](function(_0xa5c124){var _0x481997=_[_0x1d7d('0x34')](_0xa5c124,'id');var _0x572be9=[];var _0x303d6f=[];var _0x5bf0de=squel['select']();_0x5bf0de[_0x1d7d('0x91')](_0x1d7d('0x92'))[_0x1d7d('0x93')](_0x1d7d('0x94'),'tq')[_0x1d7d('0x95')](_0x1d7d('0x96'),'ut',_0x1d7d('0x97'))[_0x1d7d('0x45')](_0x1d7d('0x98'),_0x37863c[_0x1d7d('0x4e')]['id']);for(var _0x3e94d6=0x0;_0x3e94d6<_0xa5c124[_0x1d7d('0x40')];_0x3e94d6+=0x1){let _0x5a05a3=_0xa5c124[_0x3e94d6];for(var _0x542ae6=0x0;_0x542ae6<_0x5a05a3[_0x1d7d('0x86')]['length'];_0x542ae6+=0x1){let _0x43ee13=_0x5a05a3['Agents'][_0x542ae6];var _0x489649=_0x5bf0de[_0x1d7d('0x99')]();_0x489649[_0x1d7d('0x45')](_0x1d7d('0x9a'),_0x43ee13['id']);_0x303d6f[_0x1d7d('0x6e')](db[_0x1d7d('0x52')][_0x1d7d('0x3b')](_0x489649[_0x1d7d('0x9b')](),{'type':db[_0x1d7d('0x52')][_0x1d7d('0x9c')]['SELECT']})['then'](function(_0x38cde1){if(_0x38cde1['length']===0x1){return _0x43ee13['id'];}else{var _0x3d863b=_[_0x1d7d('0x9d')](_[_0x1d7d('0x34')](_0x38cde1,_0x1d7d('0x9e')),function(_0x10b561){return _[_0x1d7d('0x9f')](_0x481997,_0x10b561);});if(_0x3d863b){return _0x43ee13['id'];}}}));}}return BPromise[_0x1d7d('0xa0')](_0x303d6f)[_0x1d7d('0x2c')](function(_0x2dfb5c){_0x572be9=_(_0x572be9)[_0x1d7d('0xa1')](_0x2dfb5c)[_0x1d7d('0xa2')]()[_0x1d7d('0xa3')]();return db['VoicePrefix']['find']({'where':{'id':_0x37863c[_0x1d7d('0x4e')]['id']}})[_0x1d7d('0x2c')](function(_0xfd4b25){return db['sequelize']['transaction'](function(_0x19a53b){return _0xfd4b25[_0x1d7d('0xa4')](_0x37863c['query'][_0x1d7d('0x7a')],{'transaction':_0x19a53b})['then'](function(){if(!_[_0x1d7d('0xa5')](_0x572be9)){return _0xfd4b25['removeAgents'](_0x572be9,{'transaction':_0x19a53b});}})[_0x1d7d('0x2c')](function(){_0x572be9[_0x1d7d('0x8f')](function(_0x44f307){socket[_0x1d7d('0x7d')](_0x1d7d('0x80'),{'UserId':_0x44f307,'VoicePrefixId':_0xfd4b25['id']});});});});});});})[_0x1d7d('0x2c')](respondWithStatusCode(_0x5cf31f,null))[_0x1d7d('0x4d')](handleError(_0x5cf31f,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 86b47de..392b7af 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 _0x92f8=['VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x26f65a,_0x2fa77e){var _0x3cde9d=function(_0x23eb37){while(--_0x23eb37){_0x26f65a['push'](_0x26f65a['shift']());}};_0x3cde9d(++_0x2fa77e);}(_0x92f8,0x199));var _0x892f=function(_0x1170a8,_0x35c392){_0x1170a8=_0x1170a8-0x0;var _0x2e11e9=_0x92f8[_0x1170a8];return _0x2e11e9;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x892f('0x0'))['db'][_0x892f('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x892f('0x2')](0x0);var events={'afterCreate':_0x892f('0x3'),'afterUpdate':_0x892f('0x4'),'afterDestroy':_0x892f('0x5')};function emitEvent(_0x39407a){return function(_0x34a5c1,_0x1182be,_0x48f243){VoicePrefixEvents['emit'](_0x39407a+':'+_0x34a5c1['id'],_0x34a5c1);VoicePrefixEvents[_0x892f('0x6')](_0x39407a,_0x34a5c1);_0x48f243(null);};}for(var e in events){if(events[_0x892f('0x7')](e)){var event=events[e];VoicePrefix[_0x892f('0x8')](e,emitEvent(event));}}module[_0x892f('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x0352=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix'];(function(_0x27b740,_0x238602){var _0x56c8bc=function(_0x10f116){while(--_0x10f116){_0x27b740['push'](_0x27b740['shift']());}};_0x56c8bc(++_0x238602);}(_0x0352,0x1bf));var _0x2035=function(_0x2ae9fe,_0x31ecfe){_0x2ae9fe=_0x2ae9fe-0x0;var _0x2331e1=_0x0352[_0x2ae9fe];return _0x2331e1;};'use strict';var EventEmitter=require(_0x2035('0x0'));var VoicePrefix=require(_0x2035('0x1'))['db'][_0x2035('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x2035('0x3')](0x0);var events={'afterCreate':_0x2035('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x305630){return function(_0x42632c,_0xde5f2e,_0x1be51a){VoicePrefixEvents['emit'](_0x305630+':'+_0x42632c['id'],_0x42632c);VoicePrefixEvents[_0x2035('0x5')](_0x305630,_0x42632c);_0x1be51a(null);};}for(var e in events){if(events[_0x2035('0x6')](e)){var event=events[e];VoicePrefix[_0x2035('0x7')](e,emitEvent(event));}}module[_0x2035('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index d5f57fb..4139838 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 _0x3764=['rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3764,0x165));var _0x4376=function(_0x5a994e,_0x561ffc){_0x5a994e=_0x5a994e-0x0;var _0x49754a=_0x3764[_0x5a994e];return _0x49754a;};'use strict';var _=require('lodash');var util=require(_0x4376('0x0'));var logger=require(_0x4376('0x1'))(_0x4376('0x2'));var moment=require(_0x4376('0x3'));var BPromise=require(_0x4376('0x4'));var rp=require(_0x4376('0x5'));var fs=require('fs');var path=require(_0x4376('0x6'));var rimraf=require(_0x4376('0x7'));var config=require(_0x4376('0x8'));var attributes=require(_0x4376('0x9'));module[_0x4376('0xa')]=function(_0x2cde7d,_0x5af432){return _0x2cde7d['define'](_0x4376('0xb'),attributes,{'tableName':_0x4376('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd8a=['path','../../config/environment','./voicePrefix.attributes','exports','define','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x926752,_0x25db93){var _0x2fab89=function(_0x23aa20){while(--_0x23aa20){_0x926752['push'](_0x926752['shift']());}};_0x2fab89(++_0x25db93);}(_0xdd8a,0x1b3));var _0xadd8=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xdd8a[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0xadd8('0x0'));var util=require(_0xadd8('0x1'));var logger=require(_0xadd8('0x2'))(_0xadd8('0x3'));var moment=require(_0xadd8('0x4'));var BPromise=require(_0xadd8('0x5'));var rp=require(_0xadd8('0x6'));var fs=require('fs');var path=require(_0xadd8('0x7'));var rimraf=require('rimraf');var config=require(_0xadd8('0x8'));var attributes=require(_0xadd8('0x9'));module[_0xadd8('0xa')]=function(_0x1ec378,_0x2fe85b){return _0x1ec378[_0xadd8('0xb')]('VoicePrefix',attributes,{'tableName':_0xadd8('0xc'),'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 0c0fe19..c4ad689 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 _0x2ff5=['request','then','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','request\x20sent','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register'];(function(_0x519276,_0x3e5e98){var _0x2713db=function(_0xd19b9c){while(--_0xd19b9c){_0x519276['push'](_0x519276['shift']());}};_0x2713db(++_0x3e5e98);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x3d1257,_0x182816){_0x3d1257=_0x3d1257-0x0;var _0x2dd9bb=_0x2ff5[_0x3d1257];return _0x2dd9bb;};'use strict';var _=require('lodash');var util=require(_0x52ff('0x0'));var moment=require(_0x52ff('0x1'));var BPromise=require('bluebird');var rs=require(_0x52ff('0x2'));var fs=require('fs');var Redis=require(_0x52ff('0x3'));var db=require(_0x52ff('0x4'))['db'];var utils=require(_0x52ff('0x5'));var logger=require(_0x52ff('0x6'))(_0x52ff('0x7'));var config=require('../../config/environment');var jayson=require(_0x52ff('0x8'));var client=jayson[_0x52ff('0x9')][_0x52ff('0xa')]({'port':0x232a});config['redis']=_[_0x52ff('0xb')](config[_0x52ff('0xc')],{'host':_0x52ff('0xd'),'port':0x18eb});var socket=require(_0x52ff('0xe'))(new Redis(config[_0x52ff('0xc')]));require(_0x52ff('0xf'))[_0x52ff('0x10')](socket);function respondWithRpcPromise(_0x16aaf4,_0x5e127e,_0xa7c521){return new BPromise(function(_0x9fb89c,_0x111904){return client[_0x52ff('0x11')](_0x16aaf4,_0xa7c521)[_0x52ff('0x12')](function(_0x300409){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x5e127e,'request\x20sent');logger['debug'](_0x52ff('0x13'),_0x5e127e,'request\x20sent',JSON[_0x52ff('0x14')](_0x300409));if(_0x300409[_0x52ff('0x15')]){if(_0x300409['error'][_0x52ff('0x16')]===0x1f4){logger[_0x52ff('0x15')](_0x52ff('0x17'),_0x5e127e,_0x300409[_0x52ff('0x15')][_0x52ff('0x18')]);return _0x111904(_0x300409[_0x52ff('0x15')]['message']);}logger[_0x52ff('0x15')](_0x52ff('0x17'),_0x5e127e,_0x300409[_0x52ff('0x15')][_0x52ff('0x18')]);return _0x9fb89c(_0x300409[_0x52ff('0x15')][_0x52ff('0x18')]);}else{logger['info'](_0x52ff('0x17'),_0x5e127e,_0x52ff('0x19'));_0x9fb89c(_0x300409[_0x52ff('0x1a')][_0x52ff('0x18')]);}})['catch'](function(_0x355ea4){logger[_0x52ff('0x15')](_0x52ff('0x17'),_0x5e127e,_0x355ea4);_0x111904(_0x355ea4);});});} \ No newline at end of file +var _0xd301=['defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x2a53ad,_0x234135){var _0x31b3b6=function(_0x141ec6){while(--_0x141ec6){_0x2a53ad['push'](_0x2a53ad['shift']());}};_0x31b3b6(++_0x234135);}(_0xd301,0x145));var _0x1d30=function(_0xae7883,_0xabf9c8){_0xae7883=_0xae7883-0x0;var _0xd55326=_0xd301[_0xae7883];return _0xd55326;};'use strict';var _=require(_0x1d30('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d30('0x1'));var fs=require('fs');var Redis=require(_0x1d30('0x2'));var db=require(_0x1d30('0x3'))['db'];var utils=require(_0x1d30('0x4'));var logger=require(_0x1d30('0x5'))(_0x1d30('0x6'));var config=require(_0x1d30('0x7'));var jayson=require(_0x1d30('0x8'));var client=jayson[_0x1d30('0x9')]['http']({'port':0x232a});config[_0x1d30('0xa')]=_[_0x1d30('0xb')](config[_0x1d30('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1d30('0xc'))(new Redis(config[_0x1d30('0xa')]));require(_0x1d30('0xd'))[_0x1d30('0xe')](socket);function respondWithRpcPromise(_0x2a526e,_0xbad263,_0x2bcc44){return new BPromise(function(_0x5ced3a,_0x3b65ed){return client[_0x1d30('0xf')](_0x2a526e,_0x2bcc44)[_0x1d30('0x10')](function(_0x521497){logger[_0x1d30('0x11')](_0x1d30('0x12'),_0xbad263,_0x1d30('0x13'));logger[_0x1d30('0x14')](_0x1d30('0x15'),_0xbad263,_0x1d30('0x13'),JSON[_0x1d30('0x16')](_0x521497));if(_0x521497[_0x1d30('0x17')]){if(_0x521497[_0x1d30('0x17')][_0x1d30('0x18')]===0x1f4){logger[_0x1d30('0x17')](_0x1d30('0x12'),_0xbad263,_0x521497[_0x1d30('0x17')][_0x1d30('0x19')]);return _0x3b65ed(_0x521497[_0x1d30('0x17')]['message']);}logger[_0x1d30('0x17')](_0x1d30('0x12'),_0xbad263,_0x521497[_0x1d30('0x17')][_0x1d30('0x19')]);return _0x5ced3a(_0x521497[_0x1d30('0x17')]['message']);}else{logger['info'](_0x1d30('0x12'),_0xbad263,_0x1d30('0x13'));_0x5ced3a(_0x521497[_0x1d30('0x1a')][_0x1d30('0x19')]);}})[_0x1d30('0x1b')](function(_0x458b97){logger[_0x1d30('0x17')](_0x1d30('0x12'),_0xbad263,_0x458b97);_0x3b65ed(_0x458b97);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 42a0df4..1ab2b90 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 _0x9099=['length','./voicePrefix.events','remove','update','emit','removeListener','register'];(function(_0x616ee1,_0x6c3156){var _0x57827=function(_0x98d3e2){while(--_0x98d3e2){_0x616ee1['push'](_0x616ee1['shift']());}};_0x57827(++_0x6c3156);}(_0x9099,0x1ac));var _0x9909=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x9099[_0x411add];return _0x238242;};'use strict';var VoicePrefixEvents=require(_0x9909('0x0'));var events=['save',_0x9909('0x1'),_0x9909('0x2')];function createListener(_0x38e636,_0x2524d3){return function(_0x3fd4b4){_0x2524d3[_0x9909('0x3')](_0x38e636,_0x3fd4b4);};}function removeListener(_0x2168ff,_0x6eb0ac){return function(){VoicePrefixEvents[_0x9909('0x4')](_0x2168ff,_0x6eb0ac);};}exports[_0x9909('0x5')]=function(_0x3947ed){for(var _0x41c07e=0x0,_0x3b7391=events[_0x9909('0x6')];_0x41c07e<_0x3b7391;_0x41c07e++){var _0x54011f=events[_0x41c07e];var _0x6d755a=createListener('voicePrefix:'+_0x54011f,_0x3947ed);VoicePrefixEvents['on'](_0x54011f,_0x6d755a);}}; \ No newline at end of file +var _0xcab6=['length','voicePrefix:','./voicePrefix.events','remove','update','emit','register'];(function(_0x5bdac8,_0x32da07){var _0x2d190a=function(_0x3a19ba){while(--_0x3a19ba){_0x5bdac8['push'](_0x5bdac8['shift']());}};_0x2d190a(++_0x32da07);}(_0xcab6,0xd4));var _0x6cab=function(_0x3c41e9,_0x2d7f0d){_0x3c41e9=_0x3c41e9-0x0;var _0x455540=_0xcab6[_0x3c41e9];return _0x455540;};'use strict';var VoicePrefixEvents=require(_0x6cab('0x0'));var events=['save',_0x6cab('0x1'),_0x6cab('0x2')];function createListener(_0x1ff0cd,_0x1b8153){return function(_0xae3b53){_0x1b8153[_0x6cab('0x3')](_0x1ff0cd,_0xae3b53);};}function removeListener(_0x5ea2d8,_0xa8b534){return function(){VoicePrefixEvents['removeListener'](_0x5ea2d8,_0xa8b534);};}exports[_0x6cab('0x4')]=function(_0x1953cd){for(var _0x13464a=0x0,_0x53e159=events[_0x6cab('0x5')];_0x13464a<_0x53e159;_0x13464a++){var _0x229e5a=events[_0x13464a];var _0x230f8b=createListener(_0x6cab('0x6')+_0x229e5a,_0x1953cd);VoicePrefixEvents['on'](_0x229e5a,_0x230f8b);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index bf03c09..c291dfb 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x3209fe,_0x2bb16b){var _0x11897d=function(_0x2bc4b9){while(--_0x2bc4b9){_0x3209fe['push'](_0x3209fe['shift']());}};_0x11897d(++_0x2bb16b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x289c3e,_0x3614b5){var _0x25a4b3=function(_0x1ea94b){while(--_0x1ea94b){_0x289c3e['push'](_0x289c3e['shift']());}};_0x25a4b3(++_0x3614b5);}(_0xb10b,0x12a));var _0xbb10=function(_0x178d95,_0x5880c1){_0x178d95=_0x178d95-0x0;var _0x55688c=_0xb10b[_0x178d95];return _0x55688c;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 51d9db3..022d356 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 _0x3df1=['#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','outbound','inbound','default','ringall','leastrecent','fewestcalls','rrmemory','linear','wrandom','setDataValue','type','getDataValue','strategy','booked','roundrobin','predictive','power','INTEGER','yes','once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','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(_0x2ad217,_0x539d2d){var _0x3dbc92=function(_0x342a45){while(--_0x342a45){_0x2ad217['push'](_0x2ad217['shift']());}};_0x3dbc92(++_0x539d2d);}(_0x3df1,0x6c));var _0x13df=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3df1[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0x13df('0x0')]={'name':{'type':Sequelize[_0x13df('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x13df('0x2')]('inbound',_0x13df('0x3')),'allowNull':![],'defaultValue':_0x13df('0x4')},'musiconhold':{'type':Sequelize[_0x13df('0x1')],'defaultValue':_0x13df('0x5')},'announce':{'type':Sequelize[_0x13df('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x13df('0x2')]('rr',_0x13df('0x6'),_0x13df('0x7'),_0x13df('0x8'),'random',_0x13df('0x9'),_0x13df('0xa'),_0x13df('0xb'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x2d63ff){this[_0x13df('0xc')]('strategy',_0x2d63ff?_0x2d63ff:'rrmemory');},'get':function(){var _0x249d7b=this['getDataValue'](_0x13df('0xd'));var _0x508c31=this[_0x13df('0xe')]('dialMethod');var _0x4fe1c8=this[_0x13df('0xe')](_0x13df('0xf'));if(_0x249d7b===_0x13df('0x4')){return _0x4fe1c8;}if(_0x508c31===_0x13df('0x10')&&_0x4fe1c8==='rrmemory'||_0x508c31==='booked'&&_0x4fe1c8===_0x13df('0x11')){return _0x4fe1c8;}if(_0x508c31==='progressive'||_0x508c31===_0x13df('0x12')||_0x508c31===_0x13df('0x13')){return _0x4fe1c8;}return null;}},'servicelevel':{'type':Sequelize[_0x13df('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x13df('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x13df('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x13df('0x1')]},'weight':{'type':Sequelize[_0x13df('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x13df('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x13df('0x2')](_0x13df('0x15'),'no'),'defaultValue':_0x13df('0x15')},'autopause':{'type':Sequelize['ENUM'](_0x13df('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x13df('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x13df('0x2')](_0x13df('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x13df('0x2')](_0x13df('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x13df('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x13df('0x2')](_0x13df('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x13df('0x2')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x13df('0x2')](_0x13df('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x13df('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x13df('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x13df('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x13df('0x2')](_0x13df('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x13df('0x2')]('yes','no'),'defaultValue':_0x13df('0x15')},'announce_holdtime':{'type':Sequelize[_0x13df('0x2')]('yes','no',_0x13df('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x13df('0x2')](_0x13df('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x13df('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x13df('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x13df('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x13df('0x1')]},'queue_youarenext':{'type':Sequelize[_0x13df('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x13df('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x13df('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x13df('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x13df('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x13df('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x13df('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x13df('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x13df('0x1')]},'queue_quantity1':{'type':Sequelize[_0x13df('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x13df('0x1')]},'queue_less_than':{'type':Sequelize[_0x13df('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0xda278a){this[_0x13df('0xc')](_0x13df('0x17'),_0xda278a?_0xda278a[_0x13df('0x18')](','):[]);},'get':function(){return this[_0x13df('0xe')](_0x13df('0x17'))?this[_0x13df('0xe')]('periodic_announce')[_0x13df('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x13df('0x1')],'defaultValue':_0x13df('0x15'),'set':function(_0x7a0e8d){this[_0x13df('0xc')](_0x13df('0x1a'),_0x7a0e8d?_0x7a0e8d['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x13df('0x1a'))?this[_0x13df('0xe')]('joinempty')[_0x13df('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x13df('0x1')],'defaultValue':'no','set':function(_0x4110dc){this[_0x13df('0xc')](_0x13df('0x1b'),_0x4110dc?_0x4110dc[_0x13df('0x18')](','):undefined);},'get':function(){return this[_0x13df('0xe')](_0x13df('0x1b'))?this[_0x13df('0xe')]('leavewhenempty')[_0x13df('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x13df('0x2')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x13df('0x2')](_0x13df('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x13df('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x13df('0x1')]},'acw':{'type':Sequelize[_0x13df('0x1c')],'defaultValue':0x0,'set':function(_0x33da7f){this[_0x13df('0xc')](_0x13df('0x1d'),_0x33da7f);if(_0x33da7f){if(this[_0x13df('0xe')](_0x13df('0x1e'))<0x2){this[_0x13df('0xc')](_0x13df('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x13df('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x13df('0x1c')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x13df('0x2')](_0x13df('0x1f'),_0x13df('0x20'),'power',_0x13df('0x12'),_0x13df('0x10')),'defaultValue':_0x13df('0x20'),'comment':_0x13df('0x21')},'dialLimitChannel':{'type':Sequelize[_0x13df('0x14')](0x4)[_0x13df('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x13df('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x13df('0x23')},'dialPowerLevel':{'type':Sequelize[_0x13df('0x24')](0x2)[_0x13df('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x13df('0x2')](_0x13df('0x25'),'dropRate'),'defaultValue':_0x13df('0x26'),'comment':_0x13df('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x13df('0x24')](0x2)[_0x13df('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x13df('0x28')},'dialPredictiveInterval':{'type':Sequelize[_0x13df('0x14')](0x3)[_0x13df('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x13df('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x13df('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x13df('0x14')](0x3)[_0x13df('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x13df('0x29')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x13df('0x2a'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x13df('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x13df('0x2b')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x13df('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0x13df('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x13df('0x14')](0x5)[_0x13df('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x13df('0x2d')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x13df('0x2e')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x13df('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x13df('0x2f')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x13df('0x14')](0x3)[_0x13df('0x22')],'defaultValue':0x3,'comment':_0x13df('0x30')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x13df('0x14')](0x5)[_0x13df('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x13df('0x31')},'dialGlobalMaxRetry':{'type':Sequelize[_0x13df('0x14')](0x3)[_0x13df('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x13df('0x32')},'dialTimezone':{'type':Sequelize[_0x13df('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x13df('0x33')},'dialPrefix':{'type':Sequelize[_0x13df('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x13df('0x34'),_0x13df('0x35'),_0x13df('0x36')),'defaultValue':_0x13df('0x34')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x13df('0x37')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x13df('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x13df('0x14')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x13df('0x14')](0x9)[_0x13df('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x13df('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x13df('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x13df('0x14')](0x9)[_0x13df('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x13df('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x13df('0x14')](0x9)[_0x13df('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x13df('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x13df('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x13df('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x13df('0x14')](0x5)[_0x13df('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x13df('0x14')](0x9)[_0x13df('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x13df('0x3d')},'dialRecallMeTimeout':{'type':Sequelize[_0x13df('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x13df('0x3e')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x13df('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x13df('0x40'),_0x13df('0x41')),'defaultValue':_0x13df('0x40')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x13df('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x13df('0x14')](0x3)[_0x13df('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x13df('0x42')},'dialCutDigit':{'type':Sequelize[_0x13df('0x14')](0x3)[_0x13df('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x13df('0x14')](0x3)[_0x13df('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x13df('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x13df('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x13df('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x13df('0x14')](0x3)[_0x13df('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x13df('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x13df('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x13df('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x13df('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x13df('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x13df('0x47')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x13df('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x13df('0x14')](0x5)[_0x13df('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x13df('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x13df('0x14')](0x3)[_0x13df('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x13df('0x14')](0x5)[_0x13df('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x13df('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x13df('0x14')],'allowNull':!![],'comment':_0x13df('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0x13df('0x1c')],'defaultValue':![],'comment':_0x13df('0x4b'),'set':function(_0x3cc88d){if(!_0x3cc88d)this[_0x13df('0xc')](_0x13df('0x4c'),null);this[_0x13df('0xc')](_0x13df('0x4d'),_0x3cc88d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x13df('0x14')](0x3)[_0x13df('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x13df('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x13df('0x14')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x13df('0x1c')],'defaultValue':![]}}; \ No newline at end of file +var _0x8e76=['linear','wrandom','strategy','getDataValue','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','onlyIfOpen','#AMD\x20Initial\x20Silence','#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)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','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','sequelize','exports','STRING','name','ENUM','inbound','outbound','ringall','leastrecent','fewestcalls','random','rrmemory'];(function(_0x461322,_0x573961){var _0x6ca08d=function(_0x1e56f0){while(--_0x1e56f0){_0x461322['push'](_0x461322['shift']());}};_0x6ca08d(++_0x573961);}(_0x8e76,0x134));var _0x68e7=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x8e76[_0x2bf141];return _0x48277b;};'use strict';var Sequelize=require(_0x68e7('0x0'));module[_0x68e7('0x1')]={'name':{'type':Sequelize[_0x68e7('0x2')],'allowNull':![],'unique':_0x68e7('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x68e7('0x4')](_0x68e7('0x5'),_0x68e7('0x6')),'allowNull':![],'defaultValue':_0x68e7('0x5')},'musiconhold':{'type':Sequelize[_0x68e7('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x68e7('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x68e7('0x4')]('rr',_0x68e7('0x7'),_0x68e7('0x8'),_0x68e7('0x9'),_0x68e7('0xa'),_0x68e7('0xb'),_0x68e7('0xc'),_0x68e7('0xd'),'rrordered'),'allowNull':![],'defaultValue':_0x68e7('0x7'),'set':function(_0x254d39){this['setDataValue'](_0x68e7('0xe'),_0x254d39?_0x254d39:_0x68e7('0xb'));},'get':function(){var _0x465ece=this[_0x68e7('0xf')]('type');var _0x105bd6=this['getDataValue'](_0x68e7('0x10'));var _0x49b0dd=this[_0x68e7('0xf')]('strategy');if(_0x465ece==='inbound'){return _0x49b0dd;}if(_0x105bd6==='booked'&&_0x49b0dd==='rrmemory'||_0x105bd6===_0x68e7('0x11')&&_0x49b0dd===_0x68e7('0x12')){return _0x49b0dd;}if(_0x105bd6===_0x68e7('0x13')||_0x105bd6===_0x68e7('0x14')||_0x105bd6===_0x68e7('0x15')){return _0x49b0dd;}return null;}},'servicelevel':{'type':Sequelize[_0x68e7('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x68e7('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x68e7('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x68e7('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x68e7('0x2')]},'weight':{'type':Sequelize[_0x68e7('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x68e7('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x68e7('0x4')](_0x68e7('0x17'),'no'),'defaultValue':_0x68e7('0x17')},'autopause':{'type':Sequelize[_0x68e7('0x4')]('yes','no',_0x68e7('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x68e7('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x68e7('0x4')](_0x68e7('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x68e7('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x68e7('0x4')](_0x68e7('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x68e7('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x68e7('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x68e7('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x68e7('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x68e7('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x68e7('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x68e7('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x68e7('0x4')](_0x68e7('0x17'),'no'),'defaultValue':_0x68e7('0x17')},'announce_holdtime':{'type':Sequelize[_0x68e7('0x4')](_0x68e7('0x17'),'no',_0x68e7('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x68e7('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x68e7('0x4')](_0x68e7('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x68e7('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x68e7('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x68e7('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x68e7('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x68e7('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x68e7('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x68e7('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x68e7('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x68e7('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x68e7('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x68e7('0x2')]},'queue_quantity1':{'type':Sequelize[_0x68e7('0x2')]},'queue_quantity2':{'type':Sequelize[_0x68e7('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x68e7('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x68e7('0x1a')],'set':function(_0x54feb0){this[_0x68e7('0x1b')](_0x68e7('0x1c'),_0x54feb0?_0x54feb0[_0x68e7('0x1d')](','):[]);},'get':function(){return this[_0x68e7('0xf')](_0x68e7('0x1c'))?this['getDataValue']('periodic_announce')[_0x68e7('0x1e')](','):[];}},'joinempty':{'type':Sequelize[_0x68e7('0x2')],'defaultValue':_0x68e7('0x17'),'set':function(_0x2ea930){this[_0x68e7('0x1b')]('joinempty',_0x2ea930?_0x2ea930[_0x68e7('0x1d')](','):undefined);},'get':function(){return this[_0x68e7('0xf')](_0x68e7('0x1f'))?this[_0x68e7('0xf')](_0x68e7('0x1f'))[_0x68e7('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x68e7('0x2')],'defaultValue':'no','set':function(_0x3b68df){this[_0x68e7('0x1b')](_0x68e7('0x20'),_0x3b68df?_0x3b68df['join'](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this[_0x68e7('0xf')](_0x68e7('0x20'))[_0x68e7('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x68e7('0x4')](_0x68e7('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x68e7('0x4')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x68e7('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x68e7('0x4')](_0x68e7('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x68e7('0x2')]},'description':{'type':Sequelize[_0x68e7('0x2')]},'acw':{'type':Sequelize[_0x68e7('0x21')],'defaultValue':0x0,'set':function(_0x1a25a8){this[_0x68e7('0x1b')](_0x68e7('0x22'),_0x1a25a8);if(_0x1a25a8){if(this[_0x68e7('0xf')](_0x68e7('0x23'))<0x2){this[_0x68e7('0x1b')](_0x68e7('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x68e7('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x68e7('0x21')],'defaultValue':0x0,'comment':_0x68e7('0x24')},'dialMethod':{'type':Sequelize[_0x68e7('0x4')]('preview',_0x68e7('0x13'),_0x68e7('0x15'),'predictive',_0x68e7('0x11')),'defaultValue':_0x68e7('0x13'),'comment':_0x68e7('0x25')},'dialLimitChannel':{'type':Sequelize[_0x68e7('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x68e7('0x26')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x68e7('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x68e7('0x28')},'dialPowerLevel':{'type':Sequelize[_0x68e7('0x29')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x68e7('0x2a')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x68e7('0x2b'),'dropRate'),'defaultValue':'dropRate','comment':_0x68e7('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x68e7('0x29')](0x2)[_0x68e7('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x68e7('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x68e7('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x68e7('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x68e7('0x16')](0x3)[_0x68e7('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x68e7('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x68e7('0x2')],'defaultValue':_0x68e7('0x2f'),'comment':_0x68e7('0x30')},'dialQueueTimeout':{'type':Sequelize[_0x68e7('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x68e7('0x2')],'comment':_0x68e7('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0x68e7('0x16')](0x3)[_0x68e7('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x68e7('0x16')](0x5)[_0x68e7('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x68e7('0x16')](0x3)[_0x68e7('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x68e7('0x16')](0x5)[_0x68e7('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x68e7('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x68e7('0x16')](0x3)[_0x68e7('0x27')],'defaultValue':0x3,'comment':_0x68e7('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x68e7('0x16')](0x5)[_0x68e7('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x68e7('0x16')](0x3)[_0x68e7('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x68e7('0x34')},'dialTimezone':{'type':Sequelize[_0x68e7('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x68e7('0x2')],'defaultValue':_0x68e7('0x35')},'dialPrefix':{'type':Sequelize[_0x68e7('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x68e7('0x4')]('always','never',_0x68e7('0x36')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x68e7('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x68e7('0x16')](0x9)[_0x68e7('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x68e7('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x68e7('0x16')](0x9)[_0x68e7('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x68e7('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x68e7('0x16')](0x9)[_0x68e7('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x68e7('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x68e7('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x68e7('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x68e7('0x16')](0x9)[_0x68e7('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x68e7('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x68e7('0x16')](0x9)[_0x68e7('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x68e7('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x68e7('0x16')](0x9)[_0x68e7('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x68e7('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x68e7('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x68e7('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x68e7('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x68e7('0x16')](0x5)[_0x68e7('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x68e7('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x68e7('0x21')],'defaultValue':0x0,'comment':_0x68e7('0x40')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x68e7('0x41'),_0x68e7('0x42')),'defaultValue':_0x68e7('0x41')},'dialQueueProject2':{'type':Sequelize[_0x68e7('0x2')],'comment':_0x68e7('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x68e7('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x68e7('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x68e7('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x68e7('0x43')},'dialCutDigit':{'type':Sequelize[_0x68e7('0x16')](0x3)[_0x68e7('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x68e7('0x16')](0x3)[_0x68e7('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x68e7('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x68e7('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x68e7('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x68e7('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x68e7('0x16')](0x5)[_0x68e7('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x68e7('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x68e7('0x16')](0x3)[_0x68e7('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x68e7('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x68e7('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x68e7('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x68e7('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x68e7('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x68e7('0x16')](0x5)[_0x68e7('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x68e7('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x68e7('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x68e7('0x16')](0x5)[_0x68e7('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x68e7('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x68e7('0x16')],'allowNull':!![],'comment':_0x68e7('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x68e7('0x21')],'defaultValue':![],'comment':_0x68e7('0x4d'),'set':function(_0x9e0480){if(!_0x9e0480)this[_0x68e7('0x1b')](_0x68e7('0x4e'),null);this[_0x68e7('0x1b')](_0x68e7('0x4f'),_0x9e0480);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x68e7('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x68e7('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x68e7('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x68e7('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x68e7('0x21')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 5943b63..e6598c3 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 _0xe3da=['ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','all','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','online','isEmpty','push','isNil','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','cm_hopper','VoiceQueueId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','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','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','outbound','filter','ignore','map','value','includes','find','type','name','UserProfileResource','error','stack','VoiceQueue','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','body','UserProfileSection','userProfileId','getHoppers','findOne','CmHopper','order','VoiceQueueId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','teams','Team','User','Agents','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','format','SIP/%s','voicePause','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','clone'];(function(_0x380553,_0x27dfec){var _0x132223=function(_0x287bf8){while(--_0x287bf8){_0x380553['push'](_0x380553['shift']());}};_0x132223(++_0x27dfec);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];config[_0xae3d('0x1c')]=_['defaults'](config[_0xae3d('0x1c')],{'host':_0xae3d('0x1d'),'port':0x18eb});var socket=require(_0xae3d('0x1e'))(new Redis(config[_0xae3d('0x1c')]));require(_0xae3d('0x1f'))[_0xae3d('0x20')](socket);function respondWithStatusCode(_0x31498d,_0x4e646f){_0x4e646f=_0x4e646f||0xcc;return function(_0x1fb7a9){if(_0x1fb7a9){return _0x31498d[_0xae3d('0x21')](_0x4e646f);}return _0x31498d[_0xae3d('0x22')](_0x4e646f)[_0xae3d('0x23')]();};}function respondWithResult(_0x192c13,_0x2da957){_0x2da957=_0x2da957||0xc8;return function(_0x585160){if(_0x585160){return _0x192c13[_0xae3d('0x22')](_0x2da957)[_0xae3d('0x24')](_0x585160);}};}function respondWithFilteredResult(_0x2e31f1,_0x5303c2){return function(_0x3f8cf9){if(_0x3f8cf9){var _0x4cbe4e=typeof _0x5303c2['offset']==='undefined'&&typeof _0x5303c2[_0xae3d('0x25')]===_0xae3d('0x26');var _0x19c44d=_0x3f8cf9[_0xae3d('0x27')];var _0x39828a=_0x4cbe4e?0x0:_0x5303c2['offset'];var _0x121024=_0x4cbe4e?_0x3f8cf9['count']:_0x5303c2[_0xae3d('0x28')]+_0x5303c2[_0xae3d('0x25')];var _0x1415e8;if(_0x121024>=_0x19c44d){_0x121024=_0x19c44d;_0x1415e8=0xc8;}else{_0x1415e8=0xce;}_0x2e31f1[_0xae3d('0x22')](_0x1415e8);return _0x2e31f1[_0xae3d('0x29')](_0xae3d('0x2a'),_0x39828a+'-'+_0x121024+'/'+_0x19c44d)[_0xae3d('0x24')](_0x3f8cf9);}return null;};}function patchUpdates(_0x155099){return function(_0x3224ff){try{jsonpatch[_0xae3d('0x2b')](_0x3224ff,_0x155099,!![]);}catch(_0x300be8){return BPromise[_0xae3d('0x2c')](_0x300be8);}return _0x3224ff[_0xae3d('0x2d')]();};}function saveUpdates(_0x1b2acb,_0x44a4e0){return function(_0x1fe90f){if(_0x1fe90f){return _0x1fe90f[_0xae3d('0x2e')](_0x1b2acb)[_0xae3d('0x2f')](function(_0x2131e9){return _0x2131e9;});}return null;};}function removeEntity(_0x1b1217,_0x5d45db){return function(_0x16c014){if(_0x16c014){return _0x16c014[_0xae3d('0x30')]()[_0xae3d('0x2f')](function(){var _0x52df0f=_0x16c014[_0xae3d('0x31')]({'plain':!![]});var _0x4391db=[{'name':_0xae3d('0x32'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0xae3d('0x33'),'ignore':![]}];var _0x1281aa=_(_0x4391db)[_0xae3d('0x34')](_0xae3d('0x35'))[_0xae3d('0x36')]('value')[_0xae3d('0x37')]();if(_[_0xae3d('0x38')](_0x1281aa,_0x52df0f['type'])){return;}var _0x5c155e=_[_0xae3d('0x39')](_0x4391db,[_0xae3d('0x37'),_0x52df0f[_0xae3d('0x3a')]])[_0xae3d('0x3b')];return db[_0xae3d('0x3c')]['destroy']({'where':{'type':_0x5c155e,'resourceId':_0x52df0f['id']}})['then'](function(){return _0x16c014;});})['then'](function(){_0x1b1217[_0xae3d('0x22')](0xcc)[_0xae3d('0x23')]();});}};}function handleEntityNotFound(_0x4306c1,_0x270043){return function(_0x54a75c){if(!_0x54a75c){_0x4306c1[_0xae3d('0x21')](0x194);}return _0x54a75c;};}function handleError(_0x276183,_0x10ccd4){_0x10ccd4=_0x10ccd4||0x1f4;return function(_0x3748d2){logger[_0xae3d('0x3d')](_0x3748d2[_0xae3d('0x3e')]);if(_0x3748d2[_0xae3d('0x3b')]){delete _0x3748d2['name'];}_0x276183[_0xae3d('0x22')](_0x10ccd4)['send'](_0x3748d2);};}exports['index']=function(_0x1cd957,_0x4cfe71){var _0x3a7fa8={},_0x4b79ed={},_0x59425f={'count':0x0,'rows':[]};var _0x1a28b5=_[_0xae3d('0x36')](db[_0xae3d('0x3f')]['rawAttributes'],function(_0x211b17){return{'name':_0x211b17['fieldName'],'type':_0x211b17[_0xae3d('0x3a')][_0xae3d('0x40')]};});_0x4b79ed[_0xae3d('0x41')]=_[_0xae3d('0x36')](_0x1a28b5,_0xae3d('0x3b'));_0x4b79ed[_0xae3d('0x42')]=_[_0xae3d('0x43')](_0x1cd957[_0xae3d('0x42')]);_0x4b79ed[_0xae3d('0x44')]=_[_0xae3d('0x45')](_0x4b79ed[_0xae3d('0x41')],_0x4b79ed['query']);_0x3a7fa8['attributes']=_[_0xae3d('0x45')](_0x4b79ed['model'],qs[_0xae3d('0x46')](_0x1cd957[_0xae3d('0x42')][_0xae3d('0x46')]));_0x3a7fa8[_0xae3d('0x47')]=_0x3a7fa8[_0xae3d('0x47')][_0xae3d('0x48')]?_0x3a7fa8[_0xae3d('0x47')]:_0x4b79ed[_0xae3d('0x41')];if(!_0x1cd957[_0xae3d('0x42')][_0xae3d('0x49')](_0xae3d('0x4a'))){_0x3a7fa8['limit']=qs[_0xae3d('0x25')](_0x1cd957[_0xae3d('0x42')][_0xae3d('0x25')]);_0x3a7fa8['offset']=qs['offset'](_0x1cd957[_0xae3d('0x42')][_0xae3d('0x28')]);}_0x3a7fa8['order']=qs[_0xae3d('0x4b')](_0x1cd957[_0xae3d('0x42')][_0xae3d('0x4b')]);_0x3a7fa8[_0xae3d('0x4c')]=qs[_0xae3d('0x44')](_[_0xae3d('0x4d')](_0x1cd957['query'],_0x4b79ed[_0xae3d('0x44')]),_0x1a28b5);if(_0x1cd957[_0xae3d('0x42')][_0xae3d('0x34')]){_0x3a7fa8[_0xae3d('0x4c')]=_[_0xae3d('0x4e')](_0x3a7fa8['where'],{'$or':_[_0xae3d('0x36')](_0x1a28b5,function(_0x4f7346){if(_0x4f7346[_0xae3d('0x3a')]!==_0xae3d('0x4f')){var _0x599d1a={};_0x599d1a[_0x4f7346[_0xae3d('0x3b')]]={'$like':'%'+_0x1cd957['query']['filter']+'%'};return _0x599d1a;}})});}_0x3a7fa8=_['merge']({},_0x3a7fa8,_0x1cd957[_0xae3d('0x50')]);var _0x2561e1={'where':_0x3a7fa8['where']};return db['VoiceQueue']['count'](_0x2561e1)[_0xae3d('0x2f')](function(_0x2fdc6e){_0x59425f[_0xae3d('0x27')]=_0x2fdc6e;if(_0x1cd957[_0xae3d('0x42')][_0xae3d('0x51')]){_0x3a7fa8[_0xae3d('0x52')]=[{'all':!![]}];}return db[_0xae3d('0x3f')]['findAll'](_0x3a7fa8);})['then'](function(_0x560f66){_0x59425f[_0xae3d('0x53')]=_0x560f66;return _0x59425f;})['then'](respondWithFilteredResult(_0x4cfe71,_0x3a7fa8))[_0xae3d('0x54')](handleError(_0x4cfe71,null));};exports[_0xae3d('0x55')]=function(_0x41cb63,_0x129e8b){var _0x1e593c={'raw':![],'where':{'id':_0x41cb63[_0xae3d('0x56')]['id']}},_0x193666={};_0x193666[_0xae3d('0x41')]=_[_0xae3d('0x43')](db[_0xae3d('0x3f')][_0xae3d('0x57')]);_0x193666['query']=_['keys'](_0x41cb63['query']);_0x193666[_0xae3d('0x44')]=_[_0xae3d('0x45')](_0x193666[_0xae3d('0x41')],_0x193666[_0xae3d('0x42')]);_0x1e593c['attributes']=_['intersection'](_0x193666[_0xae3d('0x41')],qs[_0xae3d('0x46')](_0x41cb63[_0xae3d('0x42')][_0xae3d('0x46')]));_0x1e593c['attributes']=_0x1e593c[_0xae3d('0x47')][_0xae3d('0x48')]?_0x1e593c[_0xae3d('0x47')]:_0x193666[_0xae3d('0x41')];if(_0x41cb63[_0xae3d('0x42')][_0xae3d('0x51')]){_0x1e593c[_0xae3d('0x52')]=[{'all':!![]}];}_0x1e593c=_[_0xae3d('0x4e')]({},_0x1e593c,_0x41cb63[_0xae3d('0x50')]);return db[_0xae3d('0x3f')][_0xae3d('0x39')](_0x1e593c)[_0xae3d('0x2f')](handleEntityNotFound(_0x129e8b,null))['then'](respondWithResult(_0x129e8b,null))['catch'](handleError(_0x129e8b,null));};exports['create']=function(_0xb46d7,_0x447d20){return db['VoiceQueue'][_0xae3d('0x58')](_0xb46d7['body'],{})['then'](function(_0xc19da7){var _0x194f7c=_0xb46d7[_0xae3d('0x59')][_0xae3d('0x31')]({'plain':!![]});if(!_0x194f7c)throw new Error(_0xae3d('0x5a'));if(_0x194f7c[_0xae3d('0x5b')]===_0xae3d('0x59')){var _0x5efe04=_0xc19da7[_0xae3d('0x31')]({'plain':!![]});var _0x165c63=[{'name':_0xae3d('0x32'),'value':_0xae3d('0x5c')},{'name':'QueueCampaigns','value':_0xae3d('0x33')}];var _0x155c3a=_[_0xae3d('0x39')](_0x165c63,[_0xae3d('0x37'),_0x5efe04['type']])['name'];return db['UserProfileSection'][_0xae3d('0x39')]({'where':{'name':_0x155c3a,'userProfileId':_0x194f7c['userProfileId']},'raw':!![]})['then'](function(_0x3c57b9){if(_0x3c57b9&&_0x3c57b9[_0xae3d('0x5d')]===0x0){return db[_0xae3d('0x3c')][_0xae3d('0x58')]({'name':_0x5efe04[_0xae3d('0x3b')],'resourceId':_0x5efe04['id'],'type':_0x3c57b9[_0xae3d('0x3b')],'sectionId':_0x3c57b9['id']},{})['then'](function(){return _0xc19da7;});}else{return _0xc19da7;}})[_0xae3d('0x54')](function(_0x4448d5){logger[_0xae3d('0x3d')](_0xae3d('0x5e'),_0x4448d5);throw _0x4448d5;});}return _0xc19da7;})[_0xae3d('0x2f')](respondWithResult(_0x447d20,0xc9))[_0xae3d('0x54')](handleError(_0x447d20,null));};exports['clone']=function(_0x3cb7bd,_0x2c1e5e){var _0x444d3c={'where':{'id':_0x3cb7bd['params']['id']}},_0x4d4c6e={};_0x4d4c6e['model']=_[_0xae3d('0x43')](db[_0xae3d('0x3f')]['rawAttributes']);_0x444d3c[_0xae3d('0x47')]=_[_0xae3d('0x45')](_0x4d4c6e[_0xae3d('0x41')],qs['fields'](_0x3cb7bd[_0xae3d('0x42')][_0xae3d('0x46')]));_0x444d3c[_0xae3d('0x47')]=_0x444d3c[_0xae3d('0x47')][_0xae3d('0x48')]?_0x444d3c[_0xae3d('0x47')]:_0x4d4c6e[_0xae3d('0x41')];if(_0x3cb7bd[_0xae3d('0x42')]['includeAll']){_0x444d3c['include']=[{'all':!![]}];}_0x444d3c=_[_0xae3d('0x4e')]({},_0x444d3c,_0x3cb7bd[_0xae3d('0x50')]);return db[_0xae3d('0x3f')]['find'](_0x444d3c)['then'](handleEntityNotFound(_0x2c1e5e,null))[_0xae3d('0x2f')](function(_0x2a03d6){if(_0x2a03d6){var _0xa766eb=_0x2a03d6[_0xae3d('0x31')]({'plain':!![]});_0xa766eb=qs['omit'](_0xa766eb,['id',_0xae3d('0x5f'),_0xae3d('0x60')]);_0x3cb7bd['body']=_[_0xae3d('0x61')](_0x3cb7bd[_0xae3d('0x62')],['id',_0xae3d('0x5f'),_0xae3d('0x60')]);return db[_0xae3d('0x3f')][_0xae3d('0x58')](_[_0xae3d('0x4e')](_0xa766eb,_0x3cb7bd['body']),{'include':_0x3cb7bd[_0xae3d('0x42')][_0xae3d('0x51')]?[{'all':!![]}]:undefined})[_0xae3d('0x2f')](function(_0x46be33){var _0x2641d3=_0x3cb7bd['user'][_0xae3d('0x31')]({'plain':!![]});if(!_0x2641d3)throw new Error(_0xae3d('0x5a'));if(_0x2641d3[_0xae3d('0x5b')]===_0xae3d('0x59')){var _0x1864b6=_0x46be33[_0xae3d('0x31')]({'plain':!![]});var _0x53f91b=[{'name':_0xae3d('0x32'),'value':_0xae3d('0x5c')},{'name':'QueueCampaigns','value':_0xae3d('0x33')}];var _0x343584=_[_0xae3d('0x39')](_0x53f91b,['value',_0x1864b6['type']])[_0xae3d('0x3b')];return db[_0xae3d('0x63')][_0xae3d('0x39')]({'where':{'name':_0x343584,'userProfileId':_0x2641d3[_0xae3d('0x64')]},'raw':!![]})[_0xae3d('0x2f')](function(_0x1a797a){if(_0x1a797a&&_0x1a797a[_0xae3d('0x5d')]===0x0){return db['UserProfileResource'][_0xae3d('0x58')]({'name':_0x1864b6[_0xae3d('0x3b')],'resourceId':_0x1864b6['id'],'type':_0x1a797a['name'],'sectionId':_0x1a797a['id']},{})[_0xae3d('0x2f')](function(){return _0x46be33;});}else{return _0x46be33;}})['catch'](function(_0x24684f){logger[_0xae3d('0x3d')](_0xae3d('0x5e'),_0x24684f);throw _0x24684f;});}return _0x46be33;});}})[_0xae3d('0x2f')](respondWithResult(_0x2c1e5e,0xc9))[_0xae3d('0x54')](handleError(_0x2c1e5e,null));};exports['update']=function(_0x1b1bb4,_0x1bbc28){if(_0x1b1bb4[_0xae3d('0x62')]['id']){delete _0x1b1bb4['body']['id'];}return db['VoiceQueue'][_0xae3d('0x39')]({'where':{'id':_0x1b1bb4[_0xae3d('0x56')]['id']}})['then'](handleEntityNotFound(_0x1bbc28,null))['then'](saveUpdates(_0x1b1bb4[_0xae3d('0x62')],null))['then'](respondWithResult(_0x1bbc28,null))[_0xae3d('0x54')](handleError(_0x1bbc28,null));};exports['destroy']=function(_0x5d1c4f,_0x56c7db){return db['VoiceQueue'][_0xae3d('0x39')]({'where':{'id':_0x5d1c4f[_0xae3d('0x56')]['id']}})['then'](handleEntityNotFound(_0x56c7db,null))['then'](removeEntity(_0x56c7db,null))[_0xae3d('0x54')](handleError(_0x56c7db,null));};exports[_0xae3d('0x65')]=function(_0x982c31,_0x21f4d6,_0x46a9ef){var _0x170cfc={'raw':![],'where':{}};var _0x3971db={};var _0x5e1744={'count':0x0,'rows':[]};return db[_0xae3d('0x3f')][_0xae3d('0x66')]({'where':{'id':_0x982c31[_0xae3d('0x56')]['id']}})[_0xae3d('0x2f')](handleEntityNotFound(_0x21f4d6,null))[_0xae3d('0x2f')](function(_0x3f6c2f){if(_0x3f6c2f){_0x3971db['model']=_[_0xae3d('0x43')](db[_0xae3d('0x67')]['rawAttributes']);_0x3971db['query']=_[_0xae3d('0x43')](_0x982c31[_0xae3d('0x42')]);_0x3971db['filters']=_[_0xae3d('0x45')](_0x3971db[_0xae3d('0x41')],_0x3971db[_0xae3d('0x42')]);_0x170cfc['attributes']=_[_0xae3d('0x45')](_0x3971db[_0xae3d('0x41')],qs['fields'](_0x982c31['query'][_0xae3d('0x46')]));_0x170cfc[_0xae3d('0x47')]=_0x170cfc[_0xae3d('0x47')]['length']?_0x170cfc[_0xae3d('0x47')]:_0x3971db[_0xae3d('0x41')];if(!_0x982c31['query'][_0xae3d('0x49')](_0xae3d('0x4a'))){_0x170cfc[_0xae3d('0x25')]=qs['limit'](_0x982c31[_0xae3d('0x42')][_0xae3d('0x25')]);_0x170cfc[_0xae3d('0x28')]=qs['offset'](_0x982c31[_0xae3d('0x42')]['offset']);}_0x170cfc[_0xae3d('0x68')]=qs['sort'](_0x982c31['query'][_0xae3d('0x4b')]);_0x170cfc['where']=qs[_0xae3d('0x44')](_[_0xae3d('0x4d')](_0x982c31[_0xae3d('0x42')],_0x3971db[_0xae3d('0x44')]));_0x170cfc['where'][_0xae3d('0x69')]=_0x3f6c2f['id'];if(_0x982c31[_0xae3d('0x42')][_0xae3d('0x34')]){_0x170cfc[_0xae3d('0x4c')]=_[_0xae3d('0x4e')](_0x170cfc[_0xae3d('0x4c')],{'$or':_[_0xae3d('0x36')](_0x170cfc[_0xae3d('0x47')],function(_0x26e422){var _0x19f797={};_0x19f797[_0x26e422]={'$like':'%'+_0x982c31[_0xae3d('0x42')][_0xae3d('0x34')]+'%'};return _0x19f797;})});}_0x170cfc=_[_0xae3d('0x4e')]({},_0x170cfc,_0x982c31[_0xae3d('0x50')]);return db[_0xae3d('0x67')][_0xae3d('0x27')]({'where':_0x170cfc[_0xae3d('0x4c')]})['then'](function(_0x1914e0){_0x5e1744[_0xae3d('0x27')]=_0x1914e0;if(_0x982c31[_0xae3d('0x42')][_0xae3d('0x51')]){_0x170cfc[_0xae3d('0x52')]=[{'all':!![]}];}return db['CmHopper'][_0xae3d('0x6a')](_0x170cfc);})[_0xae3d('0x2f')](function(_0x285829){_0x5e1744[_0xae3d('0x53')]=_0x285829;return _0x5e1744;});}})[_0xae3d('0x2f')](respondWithFilteredResult(_0x21f4d6,_0x170cfc))[_0xae3d('0x54')](handleError(_0x21f4d6,null));};exports[_0xae3d('0x6b')]=function(_0x2f7ef0,_0x5adde0,_0x17d85a){var _0x46716f={'raw':!![],'where':{}};var _0x3bb676={};var _0x52656b={'count':0x0,'rows':[]};return db[_0xae3d('0x3f')][_0xae3d('0x66')]({'where':{'id':_0x2f7ef0[_0xae3d('0x56')]['id']}})['then'](handleEntityNotFound(_0x5adde0,null))[_0xae3d('0x2f')](function(_0x2f08bd){if(_0x2f08bd){_0x3bb676['model']=_[_0xae3d('0x43')](db['CmHopperHistory'][_0xae3d('0x57')]);_0x3bb676['query']=_[_0xae3d('0x43')](_0x2f7ef0[_0xae3d('0x42')]);_0x3bb676[_0xae3d('0x44')]=_[_0xae3d('0x45')](_0x3bb676[_0xae3d('0x41')],_0x3bb676['query']);_0x46716f[_0xae3d('0x47')]=_[_0xae3d('0x45')](_0x3bb676['model'],qs['fields'](_0x2f7ef0[_0xae3d('0x42')][_0xae3d('0x46')]));_0x46716f[_0xae3d('0x47')]=_0x46716f[_0xae3d('0x47')]['length']?_0x46716f[_0xae3d('0x47')]:_0x3bb676[_0xae3d('0x41')];if(!_0x2f7ef0[_0xae3d('0x42')]['hasOwnProperty']('nolimit')){_0x46716f[_0xae3d('0x25')]=qs['limit'](_0x2f7ef0[_0xae3d('0x42')]['limit']);_0x46716f[_0xae3d('0x28')]=qs[_0xae3d('0x28')](_0x2f7ef0[_0xae3d('0x42')][_0xae3d('0x28')]);}_0x46716f['order']=qs[_0xae3d('0x4b')](_0x2f7ef0[_0xae3d('0x42')][_0xae3d('0x4b')]);_0x46716f['where']=qs[_0xae3d('0x44')](_['pick'](_0x2f7ef0[_0xae3d('0x42')],_0x3bb676[_0xae3d('0x44')]));_0x46716f['where']['VoiceQueueId']=_0x2f08bd['id'];if(_0x2f7ef0[_0xae3d('0x42')]['filter']){_0x46716f['where']=_[_0xae3d('0x4e')](_0x46716f['where'],{'$or':_[_0xae3d('0x36')](_0x46716f['attributes'],function(_0x31f606){var _0x47aa7a={};_0x47aa7a[_0x31f606]={'$like':'%'+_0x2f7ef0[_0xae3d('0x42')]['filter']+'%'};return _0x47aa7a;})});}_0x46716f=_[_0xae3d('0x4e')]({},_0x46716f,_0x2f7ef0['options']);return db[_0xae3d('0x6c')][_0xae3d('0x27')]({'where':_0x46716f[_0xae3d('0x4c')]})[_0xae3d('0x2f')](function(_0x125687){_0x52656b[_0xae3d('0x27')]=_0x125687;if(_0x2f7ef0[_0xae3d('0x42')][_0xae3d('0x51')]){_0x46716f[_0xae3d('0x52')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xae3d('0x6a')](_0x46716f);})[_0xae3d('0x2f')](function(_0xca73b8){_0x52656b[_0xae3d('0x53')]=_0xca73b8;return _0x52656b;});}})[_0xae3d('0x2f')](respondWithFilteredResult(_0x5adde0,_0x46716f))['catch'](handleError(_0x5adde0,null));};exports[_0xae3d('0x6d')]=function(_0x16e3df,_0x32dec5,_0x5f3805){var _0x242f09={'raw':!![],'where':{}};var _0x5c53b8={};var _0x52e98e={'count':0x0,'rows':[]};return db[_0xae3d('0x3f')]['findOne']({'where':{'id':_0x16e3df[_0xae3d('0x56')]['id']}})[_0xae3d('0x2f')](handleEntityNotFound(_0x32dec5,null))[_0xae3d('0x2f')](function(_0x147212){if(_0x147212){_0x5c53b8[_0xae3d('0x41')]=_[_0xae3d('0x43')](db[_0xae3d('0x6e')][_0xae3d('0x57')]);_0x5c53b8[_0xae3d('0x42')]=_[_0xae3d('0x43')](_0x16e3df[_0xae3d('0x42')]);_0x5c53b8[_0xae3d('0x44')]=_['intersection'](_0x5c53b8['model'],_0x5c53b8['query']);_0x242f09['attributes']=_['intersection'](_0x5c53b8[_0xae3d('0x41')],qs['fields'](_0x16e3df['query'][_0xae3d('0x46')]));_0x242f09[_0xae3d('0x47')]=_0x242f09['attributes']['length']?_0x242f09[_0xae3d('0x47')]:_0x5c53b8[_0xae3d('0x41')];if(!_0x16e3df[_0xae3d('0x42')][_0xae3d('0x49')](_0xae3d('0x4a'))){_0x242f09[_0xae3d('0x25')]=qs[_0xae3d('0x25')](_0x16e3df[_0xae3d('0x42')][_0xae3d('0x25')]);_0x242f09[_0xae3d('0x28')]=qs[_0xae3d('0x28')](_0x16e3df[_0xae3d('0x42')][_0xae3d('0x28')]);}_0x242f09['order']=qs['sort'](_0x16e3df[_0xae3d('0x42')]['sort']);_0x242f09[_0xae3d('0x4c')]=qs[_0xae3d('0x44')](_[_0xae3d('0x4d')](_0x16e3df[_0xae3d('0x42')],_0x5c53b8['filters']));_0x242f09[_0xae3d('0x4c')][_0xae3d('0x69')]=_0x147212['id'];if(_0x16e3df[_0xae3d('0x42')][_0xae3d('0x34')]){_0x242f09['where']=_['merge'](_0x242f09['where'],{'$or':_['map'](_0x242f09['attributes'],function(_0x3cc3aa){var _0x3d8be4={};_0x3d8be4[_0x3cc3aa]={'$like':'%'+_0x16e3df[_0xae3d('0x42')][_0xae3d('0x34')]+'%'};return _0x3d8be4;})});}_0x242f09=_[_0xae3d('0x4e')]({},_0x242f09,_0x16e3df['options']);return db[_0xae3d('0x6e')]['count']({'where':_0x242f09[_0xae3d('0x4c')]})[_0xae3d('0x2f')](function(_0x165fef){_0x52e98e[_0xae3d('0x27')]=_0x165fef;if(_0x16e3df['query']['includeAll']){_0x242f09[_0xae3d('0x52')]=[{'all':!![]}];}return db[_0xae3d('0x6e')][_0xae3d('0x6a')](_0x242f09);})[_0xae3d('0x2f')](function(_0x2ebc29){_0x52e98e[_0xae3d('0x53')]=_0x2ebc29;return _0x52e98e;});}})[_0xae3d('0x2f')](respondWithFilteredResult(_0x32dec5,_0x242f09))[_0xae3d('0x54')](handleError(_0x32dec5,null));};exports['getHopperBlacks']=function(_0x3603e2,_0x13433b,_0x48c91a){var _0x1e677d={'raw':!![],'where':{}};var _0x405547={};var _0x3ba3c3={'count':0x0,'rows':[]};return db[_0xae3d('0x3f')][_0xae3d('0x66')]({'where':{'id':_0x3603e2[_0xae3d('0x56')]['id']}})['then'](handleEntityNotFound(_0x13433b,null))[_0xae3d('0x2f')](function(_0x31b9a9){if(_0x31b9a9){_0x405547[_0xae3d('0x41')]=_[_0xae3d('0x43')](db[_0xae3d('0x6f')][_0xae3d('0x57')]);_0x405547[_0xae3d('0x42')]=_[_0xae3d('0x43')](_0x3603e2[_0xae3d('0x42')]);_0x405547[_0xae3d('0x44')]=_['intersection'](_0x405547['model'],_0x405547[_0xae3d('0x42')]);_0x1e677d[_0xae3d('0x47')]=_[_0xae3d('0x45')](_0x405547[_0xae3d('0x41')],qs['fields'](_0x3603e2[_0xae3d('0x42')]['fields']));_0x1e677d['attributes']=_0x1e677d[_0xae3d('0x47')][_0xae3d('0x48')]?_0x1e677d[_0xae3d('0x47')]:_0x405547[_0xae3d('0x41')];if(!_0x3603e2['query'][_0xae3d('0x49')](_0xae3d('0x4a'))){_0x1e677d[_0xae3d('0x25')]=qs['limit'](_0x3603e2[_0xae3d('0x42')][_0xae3d('0x25')]);_0x1e677d[_0xae3d('0x28')]=qs['offset'](_0x3603e2['query'][_0xae3d('0x28')]);}_0x1e677d[_0xae3d('0x68')]=qs['sort'](_0x3603e2[_0xae3d('0x42')][_0xae3d('0x4b')]);_0x1e677d[_0xae3d('0x4c')]=qs[_0xae3d('0x44')](_['pick'](_0x3603e2['query'],_0x405547['filters']));_0x1e677d[_0xae3d('0x4c')][_0xae3d('0x69')]=_0x31b9a9['id'];if(_0x3603e2['query'][_0xae3d('0x34')]){_0x1e677d[_0xae3d('0x4c')]=_[_0xae3d('0x4e')](_0x1e677d['where'],{'$or':_[_0xae3d('0x36')](_0x1e677d[_0xae3d('0x47')],function(_0x12c96c){var _0x400eeb={};_0x400eeb[_0x12c96c]={'$like':'%'+_0x3603e2[_0xae3d('0x42')][_0xae3d('0x34')]+'%'};return _0x400eeb;})});}_0x1e677d=_[_0xae3d('0x4e')]({},_0x1e677d,_0x3603e2['options']);return db[_0xae3d('0x6f')][_0xae3d('0x27')]({'where':_0x1e677d[_0xae3d('0x4c')]})[_0xae3d('0x2f')](function(_0x31eb2b){_0x3ba3c3[_0xae3d('0x27')]=_0x31eb2b;if(_0x3603e2[_0xae3d('0x42')][_0xae3d('0x51')]){_0x1e677d['include']=[{'all':!![]}];}return db[_0xae3d('0x6f')][_0xae3d('0x6a')](_0x1e677d);})['then'](function(_0x3f87ad){_0x3ba3c3['rows']=_0x3f87ad;return _0x3ba3c3;});}})['then'](respondWithFilteredResult(_0x13433b,_0x1e677d))['catch'](handleError(_0x13433b,null));};exports[_0xae3d('0x70')]=function(_0x11d45b,_0xee0eeb,_0x15bd43){var _0x533753={};var _0x5563b9={};var _0x270133;var _0xe733db;return db['VoiceQueue'][_0xae3d('0x66')]({'where':{'id':_0x11d45b['params']['id']}})['then'](handleEntityNotFound(_0xee0eeb,null))[_0xae3d('0x2f')](function(_0x430f40){if(_0x430f40){_0x270133=_0x430f40;_0x5563b9[_0xae3d('0x41')]=_[_0xae3d('0x43')](db['Team'][_0xae3d('0x57')]);_0x5563b9[_0xae3d('0x42')]=_['keys'](_0x11d45b[_0xae3d('0x42')]);_0x5563b9[_0xae3d('0x44')]=_[_0xae3d('0x45')](_0x5563b9['model'],_0x5563b9[_0xae3d('0x42')]);_0x533753[_0xae3d('0x47')]=_[_0xae3d('0x45')](_0x5563b9[_0xae3d('0x41')],qs['fields'](_0x11d45b['query'][_0xae3d('0x46')]));_0x533753['attributes']=_0x533753['attributes'][_0xae3d('0x48')]?_0x533753[_0xae3d('0x47')]:_0x5563b9[_0xae3d('0x41')];_0x533753[_0xae3d('0x68')]=qs[_0xae3d('0x4b')](_0x11d45b[_0xae3d('0x42')][_0xae3d('0x4b')]);_0x533753[_0xae3d('0x4c')]=qs['filters'](_[_0xae3d('0x4d')](_0x11d45b[_0xae3d('0x42')],_0x5563b9[_0xae3d('0x44')]));if(_0x11d45b['query'][_0xae3d('0x34')]){_0x533753[_0xae3d('0x4c')]=_['merge'](_0x533753[_0xae3d('0x4c')],{'$or':_[_0xae3d('0x36')](_0x533753[_0xae3d('0x47')],function(_0x2db96c){var _0x33d612={};_0x33d612[_0x2db96c]={'$like':'%'+_0x11d45b[_0xae3d('0x42')][_0xae3d('0x34')]+'%'};return _0x33d612;})});}_0x533753=_[_0xae3d('0x4e')]({},_0x533753,_0x11d45b[_0xae3d('0x50')]);return _0x270133[_0xae3d('0x70')](_0x533753);}})['then'](function(_0x58b8db){if(_0x58b8db){_0xe733db=_0x58b8db[_0xae3d('0x48')];if(!_0x11d45b[_0xae3d('0x42')][_0xae3d('0x49')](_0xae3d('0x4a'))){_0x533753[_0xae3d('0x25')]=qs[_0xae3d('0x25')](_0x11d45b['query'][_0xae3d('0x25')]);_0x533753['offset']=qs[_0xae3d('0x28')](_0x11d45b['query'][_0xae3d('0x28')]);}return _0x270133[_0xae3d('0x70')](_0x533753);}})[_0xae3d('0x2f')](function(_0x54ae8a){if(_0x54ae8a){return _0x54ae8a?{'count':_0xe733db,'rows':_0x54ae8a}:null;}})[_0xae3d('0x2f')](respondWithResult(_0xee0eeb,null))['catch'](handleError(_0xee0eeb,null));};exports['addTeams']=function(_0x58be1c,_0x472d14,_0x22d755){var _0x2219c4=_0x58be1c['body'][_0xae3d('0x71')];var _0x2ade1f=_[_0xae3d('0x36')](_0x2219c4,'id');return db[_0xae3d('0x72')][_0xae3d('0x6a')]({'where':{'id':_0x2ade1f},'attributes':['id'],'include':[{'model':db[_0xae3d('0x73')],'as':_0xae3d('0x74'),'attributes':['id','name','online','voicePause',_0xae3d('0x75')],'raw':!![]}]})[_0xae3d('0x2f')](function(_0x45b693){if(_0x45b693){var _0x56db83=_[_0xae3d('0x76')](_0x45b693,function(_0x319f38){var _0x2b675d=_0x319f38[_0xae3d('0x31')]({'plain':!![]});_0x2b675d[_0xae3d('0x74')][_0xae3d('0x77')](function(_0x493cee){_0x493cee[_0xae3d('0x78')]=_[_0xae3d('0x39')](_0x2219c4,{'id':_0x2b675d['id']})['penalty'];});return _0x2b675d['Agents'];});return db[_0xae3d('0x3f')][_0xae3d('0x39')]({'where':{'id':_0x58be1c['params']['id']}})['then'](function(_0x404bd4){return db[_0xae3d('0x79')][_0xae3d('0x7a')](function(_0x3d81a4){return _0x404bd4['addTeams'](_0x2ade1f,{'transaction':_0x3d81a4})['then'](function(){return BPromise[_0xae3d('0x7b')](_0x2219c4,function(_0x23edb4){return db[_0xae3d('0x7c')]['upsert']({'TeamId':_0x23edb4['id'],'VoiceQueueId':_0x58be1c[_0xae3d('0x56')]['id'],'penalty':_0x23edb4[_0xae3d('0x78')]},{'transaction':_0x3d81a4});});})[_0xae3d('0x2f')](function(){return BPromise[_0xae3d('0x7b')](_0x56db83,function(_0x530f6e){return db[_0xae3d('0x7d')][_0xae3d('0x7e')]({'where':{'UserId':_0x530f6e['id'],'VoiceQueueId':_0x58be1c[_0xae3d('0x56')]['id']},'defaults':{'penalty':_0x530f6e[_0xae3d('0x78')]},'transaction':_0x3d81a4});});})[_0xae3d('0x2f')](function(){return BPromise[_0xae3d('0x7b')](_[_0xae3d('0x34')](_0x56db83,{'online':!![]}),function(_0x4e166d){return db[_0xae3d('0x7f')][_0xae3d('0x80')]({'membername':_0x4e166d[_0xae3d('0x3b')],'UserId':_0x4e166d['id'],'queue_name':_0x404bd4[_0xae3d('0x3b')],'VoiceQueueId':_0x404bd4['id'],'interface':_['isNil'](_0x4e166d[_0xae3d('0x75')])?util[_0xae3d('0x81')](_0xae3d('0x82'),_0x4e166d[_0xae3d('0x3b')]):_0x4e166d[_0xae3d('0x75')],'paused':_0x4e166d[_0xae3d('0x83')]||![],'penalty':_0x4e166d[_0xae3d('0x78')]},{'transaction':_0x3d81a4});});})['then'](function(){_0x56db83[_0xae3d('0x77')](function(_0x503524){socket['emit']('userVoiceQueue:save',{'UserId':_0x503524['id'],'VoiceQueueId':_0x404bd4['id']});});});});});}})[_0xae3d('0x2f')](respondWithStatusCode(_0x472d14,null))[_0xae3d('0x54')](handleError(_0x472d14,null));};exports[_0xae3d('0x84')]=function(_0x2c8a30,_0x3d4455,_0x42891b){return db['Team']['findAll']({'where':{'id':_0x2c8a30[_0xae3d('0x42')][_0xae3d('0x85')]},'attributes':['id'],'include':[{'model':db[_0xae3d('0x73')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xae3d('0x2f')](handleEntityNotFound(_0x3d4455,null))[_0xae3d('0x2f')](function(_0x8fa3c9){var _0x15ea05=_[_0xae3d('0x36')](_0x8fa3c9,'id');var _0x313ddb=[];var _0x7cfd4c=[];var _0xec7935=squel[_0xae3d('0x86')]();_0xec7935[_0xae3d('0x87')](_0xae3d('0x88'))[_0xae3d('0x89')](_0xae3d('0x8a'),'tq')[_0xae3d('0x8b')](_0xae3d('0x8c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xae3d('0x4c')]('VoiceQueueId\x20=\x20?',_0x2c8a30[_0xae3d('0x56')]['id']);for(var _0x14c8eb=0x0;_0x14c8eb<_0x8fa3c9[_0xae3d('0x48')];_0x14c8eb+=0x1){let _0x6fc0c2=_0x8fa3c9[_0x14c8eb];for(var _0x3a9f8b=0x0;_0x3a9f8b<_0x6fc0c2[_0xae3d('0x74')][_0xae3d('0x48')];_0x3a9f8b+=0x1){let _0x545e14=_0x6fc0c2[_0xae3d('0x74')][_0x3a9f8b];var _0x1b147b=_0xec7935[_0xae3d('0x8d')]();_0x1b147b['where'](_0xae3d('0x8e'),_0x545e14['id']);_0x7cfd4c['push'](db[_0xae3d('0x79')][_0xae3d('0x42')](_0x1b147b[_0xae3d('0x8f')](),{'type':db['sequelize'][_0xae3d('0x90')][_0xae3d('0x91')]})[_0xae3d('0x2f')](function(_0x4c9936){if(_0x4c9936['length']===0x1){return _0x545e14['id'];}else{var _0x1ba69d=_['every'](_['map'](_0x4c9936,_0xae3d('0x92')),function(_0x194fd4){return _[_0xae3d('0x38')](_0x15ea05,_0x194fd4);});if(_0x1ba69d){return _0x545e14['id'];}}}));}}return BPromise[_0xae3d('0x93')](_0x7cfd4c)[_0xae3d('0x2f')](function(_0x4ce1c1){_0x313ddb=_(_0x313ddb)['union'](_0x4ce1c1)['compact']()[_0xae3d('0x37')]();return db[_0xae3d('0x3f')]['find']({'where':{'id':_0x2c8a30[_0xae3d('0x56')]['id']}})[_0xae3d('0x2f')](function(_0x130bc9){return db[_0xae3d('0x79')][_0xae3d('0x7a')](function(_0x55a165){return _0x130bc9[_0xae3d('0x84')](_0x2c8a30['query']['ids'],{'transaction':_0x55a165})[_0xae3d('0x2f')](function(){if(!_['isEmpty'](_0x313ddb)){return _0x130bc9[_0xae3d('0x94')](_0x313ddb,{'transaction':_0x55a165})[_0xae3d('0x2f')](function(){return db['UserVoiceQueueRt'][_0xae3d('0x30')]({'where':{'VoiceQueueId':_0x2c8a30['params']['id'],'UserId':_0x313ddb},'transaction':_0x55a165});});}})[_0xae3d('0x2f')](function(){_0x313ddb[_0xae3d('0x77')](function(_0x4fcbf7){socket[_0xae3d('0x95')](_0xae3d('0x96'),{'UserId':_0x4fcbf7,'VoiceQueueId':_0x130bc9['id']});});});});});});})['then'](respondWithStatusCode(_0x3d4455,null))['catch'](handleError(_0x3d4455,null));};exports[_0xae3d('0x97')]=function(_0x59502d,_0x363833,_0x539d25){var _0x3f9fe9,_0x43bb9c;return db[_0xae3d('0x3f')][_0xae3d('0x39')]({'where':{'id':_0x59502d[_0xae3d('0x56')]['id']}})[_0xae3d('0x2f')](handleEntityNotFound(_0x363833,null))['then'](function(_0x13e865){if(_0x13e865){_0x43bb9c=_0x13e865;return _0x13e865[_0xae3d('0x97')](_0x59502d['body'][_0xae3d('0x85')],_['omit'](_0x59502d[_0xae3d('0x62')],[_0xae3d('0x85'),'id'])||{})[_0xae3d('0x98')](function(_0x1479a7){for(var _0x113934=0x0;_0x113934<_0x59502d['body']['ids']['length'];_0x113934+=0x1){socket[_0xae3d('0x95')](_0xae3d('0x99'),{'UserId':Number(_0x59502d[_0xae3d('0x62')][_0xae3d('0x85')][_0x113934]),'VoiceQueueId':Number(_0x59502d[_0xae3d('0x56')]['id'])});}return _0x1479a7;});}})[_0xae3d('0x2f')](function(_0x599ba1){_0x3f9fe9=_0x599ba1||[];if(_0x43bb9c){return db['User']['findAll']({'where':{'id':_0x59502d[_0xae3d('0x62')][_0xae3d('0x85')]},'attributes':['id',_0xae3d('0x3b'),_0xae3d('0x9a'),_0xae3d('0x83'),'interface'],'raw':!![]});}})[_0xae3d('0x2f')](function(_0x37aa5d){if(!_[_0xae3d('0x9b')](_0x37aa5d)){var _0x58c4e1=[];for(var _0x282b40=0x0;_0x282b40<_0x37aa5d[_0xae3d('0x48')];_0x282b40++){if(_0x37aa5d[_0x282b40][_0xae3d('0x9a')]){_0x58c4e1[_0xae3d('0x9c')](db[_0xae3d('0x7f')]['upsert']({'membername':_0x37aa5d[_0x282b40]['name'],'UserId':_0x37aa5d[_0x282b40]['id'],'queue_name':_0x43bb9c[_0xae3d('0x3b')],'VoiceQueueId':_0x43bb9c['id'],'interface':_[_0xae3d('0x9d')](_0x37aa5d[_0x282b40][_0xae3d('0x75')])?util[_0xae3d('0x81')](_0xae3d('0x82'),_0x37aa5d[_0x282b40][_0xae3d('0x3b')]):_0x37aa5d[_0x282b40][_0xae3d('0x75')],'paused':_0x37aa5d[_0x282b40][_0xae3d('0x83')]||![],'penalty':_0x59502d[_0xae3d('0x62')][_0xae3d('0x78')]||0x0}));}}return BPromise[_0xae3d('0x93')](_0x58c4e1);}})[_0xae3d('0x2f')](function(){return _0x3f9fe9;})[_0xae3d('0x2f')](respondWithResult(_0x363833,null))[_0xae3d('0x54')](handleError(_0x363833,null));};exports[_0xae3d('0x94')]=function(_0xadef89,_0x404965,_0x2559af){return db['VoiceQueue'][_0xae3d('0x39')]({'where':{'id':_0xadef89['params']['id']}})[_0xae3d('0x2f')](handleEntityNotFound(_0x404965,null))[_0xae3d('0x2f')](function(_0x2014c2){if(_0x2014c2){return _0x2014c2[_0xae3d('0x94')](_0xadef89['query'][_0xae3d('0x85')])[_0xae3d('0x2f')](function(){if(_[_0xae3d('0x9e')](_0xadef89[_0xae3d('0x42')][_0xae3d('0x85')])){for(var _0xe8a61a=0x0;_0xe8a61a<_0xadef89[_0xae3d('0x42')][_0xae3d('0x85')]['length'];_0xe8a61a+=0x1){socket['emit'](_0xae3d('0x96'),{'UserId':Number(_0xadef89[_0xae3d('0x42')][_0xae3d('0x85')][_0xe8a61a]),'VoiceQueueId':Number(_0xadef89['params']['id'])});}}else{socket[_0xae3d('0x95')]('userVoiceQueue:remove',{'UserId':Number(_0xadef89[_0xae3d('0x42')]['ids']),'VoiceQueueId':Number(_0xadef89[_0xae3d('0x56')]['id'])});}});}})[_0xae3d('0x2f')](function(_0x53a55b){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0xadef89['params']['id'],'UserId':_0xadef89[_0xae3d('0x42')]['ids']}})[_0xae3d('0x2f')](function(){return _0x53a55b;});})[_0xae3d('0x2f')](respondWithStatusCode(_0x404965,null))[_0xae3d('0x54')](handleError(_0x404965,null));};exports[_0xae3d('0x9f')]=function(_0x4a7c3c,_0x5510f5,_0x41bdf6){var _0x44035={};var _0x26ff36={};var _0x12642b;var _0x3a99b2;return db[_0xae3d('0x3f')]['findOne']({'where':{'id':_0x4a7c3c[_0xae3d('0x56')]['id']}})[_0xae3d('0x2f')](handleEntityNotFound(_0x5510f5,null))[_0xae3d('0x2f')](function(_0x56bd17){if(_0x56bd17){_0x12642b=_0x56bd17;_0x26ff36[_0xae3d('0x41')]=_['keys'](db[_0xae3d('0x73')]['rawAttributes']);_0x26ff36[_0xae3d('0x42')]=_[_0xae3d('0x43')](_0x4a7c3c[_0xae3d('0x42')]);_0x26ff36[_0xae3d('0x44')]=_['intersection'](_0x26ff36['model'],_0x26ff36[_0xae3d('0x42')]);_0x44035[_0xae3d('0x47')]=_[_0xae3d('0x45')](_0x26ff36[_0xae3d('0x41')],qs[_0xae3d('0x46')](_0x4a7c3c['query'][_0xae3d('0x46')]));_0x44035['attributes']=_0x44035[_0xae3d('0x47')][_0xae3d('0x48')]?_0x44035[_0xae3d('0x47')]:_0x26ff36['model'];_0x44035[_0xae3d('0x68')]=qs[_0xae3d('0x4b')](_0x4a7c3c['query'][_0xae3d('0x4b')]);_0x44035[_0xae3d('0x4c')]=qs['filters'](_['pick'](_0x4a7c3c[_0xae3d('0x42')],_0x26ff36['filters']));if(_0x4a7c3c[_0xae3d('0x42')]['filter']){_0x44035[_0xae3d('0x4c')]=_['merge'](_0x44035['where'],{'$or':_[_0xae3d('0x36')](_0x44035[_0xae3d('0x47')],function(_0x2bdb9c){var _0x4b5896={};_0x4b5896[_0x2bdb9c]={'$like':'%'+_0x4a7c3c[_0xae3d('0x42')]['filter']+'%'};return _0x4b5896;})});}_0x44035=_['merge']({},_0x44035,_0x4a7c3c[_0xae3d('0x50')]);return _0x12642b['getAgents'](_0x44035);}})['then'](function(_0x47face){if(_0x47face){_0x3a99b2=_0x47face[_0xae3d('0x48')];if(!_0x4a7c3c[_0xae3d('0x42')][_0xae3d('0x49')](_0xae3d('0x4a'))){_0x44035[_0xae3d('0x25')]=qs['limit'](_0x4a7c3c[_0xae3d('0x42')]['limit']);_0x44035[_0xae3d('0x28')]=qs['offset'](_0x4a7c3c['query']['offset']);}return _0x12642b[_0xae3d('0x9f')](_0x44035);}})[_0xae3d('0x2f')](function(_0x3c0dfe){if(_0x3c0dfe){return _0x3c0dfe?{'count':_0x3a99b2,'rows':_0x3c0dfe}:null;}})[_0xae3d('0x2f')](respondWithResult(_0x5510f5,null))[_0xae3d('0x54')](handleError(_0x5510f5,null));};exports[_0xae3d('0xa0')]=function(_0x3f8c38,_0x1105d3,_0x3ed29c){var _0x30e877={};var _0x10ef7e={};var _0xb83cd4;var _0x4b40fd;return db['VoiceQueue'][_0xae3d('0x66')]({'where':{'id':_0x3f8c38[_0xae3d('0x56')]['id']}})[_0xae3d('0x2f')](handleEntityNotFound(_0x1105d3,null))[_0xae3d('0x2f')](function(_0x3b3373){if(_0x3b3373){_0xb83cd4=_0x3b3373;_0x10ef7e[_0xae3d('0x41')]=_[_0xae3d('0x43')](db[_0xae3d('0x7f')][_0xae3d('0x57')]);_0x10ef7e[_0xae3d('0x42')]=_[_0xae3d('0x43')](_0x3f8c38[_0xae3d('0x42')]);_0x10ef7e[_0xae3d('0x44')]=_[_0xae3d('0x45')](_0x10ef7e['model'],_0x10ef7e[_0xae3d('0x42')]);_0x30e877[_0xae3d('0x47')]=_['intersection'](_0x10ef7e[_0xae3d('0x41')],qs[_0xae3d('0x46')](_0x3f8c38[_0xae3d('0x42')][_0xae3d('0x46')]));_0x30e877['attributes']=_0x30e877[_0xae3d('0x47')][_0xae3d('0x48')]?_0x30e877[_0xae3d('0x47')]:_0x10ef7e[_0xae3d('0x41')];_0x30e877[_0xae3d('0x68')]=qs[_0xae3d('0x4b')](_0x3f8c38[_0xae3d('0x42')][_0xae3d('0x4b')]);_0x30e877[_0xae3d('0x4c')]=qs[_0xae3d('0x44')](_[_0xae3d('0x4d')](_0x3f8c38[_0xae3d('0x42')],_0x10ef7e[_0xae3d('0x44')]));if(_0x3f8c38[_0xae3d('0x42')][_0xae3d('0x34')]){_0x30e877[_0xae3d('0x4c')]=_[_0xae3d('0x4e')](_0x30e877['where'],{'$or':_['map'](_0x30e877[_0xae3d('0x47')],function(_0x307d5e){var _0x23dea6={};_0x23dea6[_0x307d5e]={'$like':'%'+_0x3f8c38[_0xae3d('0x42')]['filter']+'%'};return _0x23dea6;})});}_0x30e877=_[_0xae3d('0x4e')]({},_0x30e877,_0x3f8c38['options']);return _0xb83cd4[_0xae3d('0xa0')](_0x30e877);}})['then'](function(_0x2c9c73){if(_0x2c9c73){_0x4b40fd=_0x2c9c73[_0xae3d('0x48')];if(!_0x3f8c38['query'][_0xae3d('0x49')](_0xae3d('0x4a'))){_0x30e877[_0xae3d('0x25')]=qs[_0xae3d('0x25')](_0x3f8c38[_0xae3d('0x42')][_0xae3d('0x25')]);_0x30e877[_0xae3d('0x28')]=qs[_0xae3d('0x28')](_0x3f8c38['query']['offset']);}return _0xb83cd4[_0xae3d('0xa0')](_0x30e877);}})[_0xae3d('0x2f')](function(_0x436e5c){return _0x436e5c?{'count':_0x4b40fd,'rows':_0x436e5c}:null;})[_0xae3d('0x2f')](respondWithResult(_0x1105d3,null))[_0xae3d('0x54')](handleError(_0x1105d3,null));};exports[_0xae3d('0xa1')]=function(_0x4215d7,_0x3adfc1,_0xe19487){var _0x976668={};var _0x4583d9={};var _0x3e5237;var _0x453604;return db[_0xae3d('0x3f')]['findOne']({'where':{'id':_0x4215d7['params']['id']}})[_0xae3d('0x2f')](handleEntityNotFound(_0x3adfc1,null))[_0xae3d('0x2f')](function(_0x3c1307){if(_0x3c1307){_0x3e5237=_0x3c1307;_0x4583d9[_0xae3d('0x41')]=_[_0xae3d('0x43')](db[_0xae3d('0xa2')][_0xae3d('0x57')]);_0x4583d9['query']=_[_0xae3d('0x43')](_0x4215d7['query']);_0x4583d9['filters']=_['intersection'](_0x4583d9[_0xae3d('0x41')],_0x4583d9[_0xae3d('0x42')]);_0x976668[_0xae3d('0x47')]=_[_0xae3d('0x45')](_0x4583d9[_0xae3d('0x41')],qs[_0xae3d('0x46')](_0x4215d7[_0xae3d('0x42')][_0xae3d('0x46')]));_0x976668[_0xae3d('0x47')]=_0x976668[_0xae3d('0x47')]['length']?_0x976668[_0xae3d('0x47')]:_0x4583d9[_0xae3d('0x41')];_0x976668[_0xae3d('0x68')]=qs[_0xae3d('0x4b')](_0x4215d7[_0xae3d('0x42')][_0xae3d('0x4b')]);_0x976668[_0xae3d('0x4c')]=qs['filters'](_[_0xae3d('0x4d')](_0x4215d7[_0xae3d('0x42')],_0x4583d9[_0xae3d('0x44')]));if(_0x4215d7[_0xae3d('0x42')]['filter']){_0x976668['where']=_[_0xae3d('0x4e')](_0x976668[_0xae3d('0x4c')],{'$or':_['map'](_0x976668[_0xae3d('0x47')],function(_0x3f8f19){var _0x1dc051={};_0x1dc051[_0x3f8f19]={'$like':'%'+_0x4215d7[_0xae3d('0x42')][_0xae3d('0x34')]+'%'};return _0x1dc051;})});}_0x976668=_[_0xae3d('0x4e')]({},_0x976668,_0x4215d7[_0xae3d('0x50')]);return _0x3e5237[_0xae3d('0xa1')](_0x976668);}})['then'](function(_0x37b1db){if(_0x37b1db){_0x453604=_0x37b1db[_0xae3d('0x48')];if(!_0x4215d7[_0xae3d('0x42')][_0xae3d('0x49')]('nolimit')){_0x976668[_0xae3d('0x25')]=qs[_0xae3d('0x25')](_0x4215d7[_0xae3d('0x42')]['limit']);_0x976668['offset']=qs[_0xae3d('0x28')](_0x4215d7[_0xae3d('0x42')][_0xae3d('0x28')]);}return _0x3e5237[_0xae3d('0xa1')](_0x976668);}})[_0xae3d('0x2f')](function(_0x4ac798){if(_0x4ac798){return _0x4ac798?{'count':_0x453604,'rows':_0x4ac798}:null;}})[_0xae3d('0x2f')](respondWithResult(_0x3adfc1,null))[_0xae3d('0x54')](handleError(_0x3adfc1,null));};exports[_0xae3d('0xa3')]=function(_0x5825bd,_0x381585,_0xdc258c){var _0x1dab1f=moment()[_0xae3d('0x81')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3fe687,_0x1c42ea;return db[_0xae3d('0x3f')][_0xae3d('0x39')]({'where':{'id':_0x5825bd[_0xae3d('0x56')]['id']}})['then'](handleEntityNotFound(_0x381585,null))[_0xae3d('0x2f')](function(_0x5a90f5){if(_0x5a90f5){_0x1c42ea=_0x5a90f5;return _0x5a90f5[_0xae3d('0xa3')](_0x5825bd['body']['ids'],_['omit'](_0x5825bd['body'],[_0xae3d('0x85'),'id'])||{});}return null;})[_0xae3d('0x98')](function(_0x4ee45f){var _0x36e915;_0x3fe687=_0x4ee45f||[];var _0x5d8de9=[];if(_0x4ee45f){for(var _0x158e15=0x0;_0x158e15<_0x4ee45f[_0xae3d('0x48')];_0x158e15+=0x1){var _0x4b0fc0=_0x4ee45f[_0x158e15]['get']({'plain':!![]});_0x1c42ea[_0xae3d('0xa4')]=_0x5825bd[_0xae3d('0x62')][_0xae3d('0xa4')]?_0x5825bd[_0xae3d('0x62')]['dialCheckDuplicateType']:_0x1c42ea['dialCheckDuplicateType'];switch(_0x1c42ea[_0xae3d('0xa4')]){case _0xae3d('0xa5'):_0x36e915=squel['insert']()[_0xae3d('0xa6')]('cm_hopper')[_0xae3d('0xa7')]([_0xae3d('0xa8'),_0xae3d('0xa9'),_0xae3d('0xaa'),_0xae3d('0xab'),_0xae3d('0x69'),_0xae3d('0x5f'),_0xae3d('0x60')],squel[_0xae3d('0x86')]()[_0xae3d('0x87')](_0xae3d('0xa8'),_0xae3d('0xa8'))[_0xae3d('0x87')]('\x27'+_0x1dab1f+'\x27',_0xae3d('0xa9'))[_0xae3d('0x87')]('id',_0xae3d('0xaa'))[_0xae3d('0x87')](_0x4b0fc0[_0xae3d('0xac')]['toString'](),'ListId')[_0xae3d('0x87')](_0x5825bd[_0xae3d('0x56')]['id'][_0xae3d('0x8f')](),'VoiceQueueId')['field']('\x27'+_0x1dab1f+'\x27',_0xae3d('0x5f'))[_0xae3d('0x87')]('\x27'+_0x1dab1f+'\x27',_0xae3d('0x60'))[_0xae3d('0x89')](_0xae3d('0xad'))[_0xae3d('0x4c')](_0xae3d('0xae'))['where'](_0xae3d('0xaf'),_0x4b0fc0[_0xae3d('0xac')][_0xae3d('0x8f')]())[_0xae3d('0x4c')](_0xae3d('0xb0'))[_0xae3d('0x4c')](_0xae3d('0xb1'),squel[_0xae3d('0x86')]()[_0xae3d('0x87')]('COALESCE(calleridnum,\x27\x27)')[_0xae3d('0x89')](_0xae3d('0xb2'))[_0xae3d('0x4c')]('VoiceQueueId\x20=\x20?',_0x5825bd['params']['id'][_0xae3d('0x8f')]()))[_0xae3d('0x4c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xae3d('0x86')]()[_0xae3d('0x87')](_0xae3d('0xb3'))[_0xae3d('0x89')]('cm_hopper')[_0xae3d('0x4c')]('VoiceQueueId\x20=\x20?',_0x5825bd[_0xae3d('0x56')]['id'][_0xae3d('0x8f')]())))[_0xae3d('0x8f')]();break;case _0xae3d('0xb4'):_0x36e915=squel[_0xae3d('0xb5')]()[_0xae3d('0xa6')](_0xae3d('0xb6'))['fromQuery']([_0xae3d('0xa8'),_0xae3d('0xa9'),_0xae3d('0xaa'),_0xae3d('0xab'),_0xae3d('0x69'),_0xae3d('0x5f'),_0xae3d('0x60')],squel['select']()[_0xae3d('0x87')]('phone',_0xae3d('0xa8'))['field']('\x27'+_0x1dab1f+'\x27','scheduledAt')[_0xae3d('0x87')]('id',_0xae3d('0xaa'))[_0xae3d('0x87')](_0x4b0fc0['CmListId'][_0xae3d('0x8f')](),_0xae3d('0xab'))[_0xae3d('0x87')](_0x5825bd[_0xae3d('0x56')]['id']['toString'](),_0xae3d('0x69'))[_0xae3d('0x87')]('\x27'+_0x1dab1f+'\x27',_0xae3d('0x5f'))[_0xae3d('0x87')]('\x27'+_0x1dab1f+'\x27',_0xae3d('0x60'))[_0xae3d('0x89')]('cm_contacts')[_0xae3d('0x4c')](_0xae3d('0xae'))[_0xae3d('0x4c')](_0xae3d('0xaf'),_0x4b0fc0[_0xae3d('0xac')][_0xae3d('0x8f')]())[_0xae3d('0x4c')](_0xae3d('0xb0'))['where'](_0xae3d('0xb1'),squel[_0xae3d('0x86')]()[_0xae3d('0x87')](_0xae3d('0xb3'))[_0xae3d('0x89')](_0xae3d('0xb6'))[_0xae3d('0x4c')](_0xae3d('0xb7'),_0x5825bd['params']['id']['toString']())))['toString']();break;default:_0x36e915=squel[_0xae3d('0xb5')]()['into'](_0xae3d('0xb6'))[_0xae3d('0xa7')](['phone',_0xae3d('0xa9'),_0xae3d('0xaa'),_0xae3d('0xab'),_0xae3d('0x69'),'createdAt','updatedAt'],squel[_0xae3d('0x86')]()[_0xae3d('0x87')]('phone','phone')['field']('\x27'+_0x1dab1f+'\x27',_0xae3d('0xa9'))[_0xae3d('0x87')]('id',_0xae3d('0xaa'))[_0xae3d('0x87')](_0x4b0fc0[_0xae3d('0xac')][_0xae3d('0x8f')](),_0xae3d('0xab'))[_0xae3d('0x87')](_0x5825bd[_0xae3d('0x56')]['id']['toString'](),_0xae3d('0x69'))[_0xae3d('0x87')]('\x27'+_0x1dab1f+'\x27','createdAt')['field']('\x27'+_0x1dab1f+'\x27',_0xae3d('0x60'))[_0xae3d('0x89')](_0xae3d('0xad'))[_0xae3d('0x4c')](_0xae3d('0xae'))['where'](_0xae3d('0xaf'),_0x4b0fc0['CmListId'][_0xae3d('0x8f')]())['where'](_0xae3d('0xb0')))[_0xae3d('0x8f')]();}_0x5d8de9[_0xae3d('0x9c')](db[_0xae3d('0x79')][_0xae3d('0x42')](_0x36e915));}return BPromise['all'](_0x5d8de9);}})[_0xae3d('0x2f')](function(){var _0x15b161=[];var _0x318de1=squel['insert']()['into'](_0xae3d('0xb8'))[_0xae3d('0xa7')]([_0xae3d('0xb9'),_0xae3d('0xa8'),_0xae3d('0xba'),'createdAt',_0xae3d('0x60')],squel['select']()[_0xae3d('0x87')](_0xae3d('0xbb'))[_0xae3d('0x87')](_0xae3d('0xbc'))[_0xae3d('0x87')](_0xae3d('0xbd'))[_0xae3d('0x87')]('\x27'+_0x1dab1f+'\x27',_0xae3d('0x5f'))['field']('\x27'+_0x1dab1f+'\x27',_0xae3d('0x60'))[_0xae3d('0x89')](_0xae3d('0xbe'),'ci')[_0xae3d('0x8b')](_0xae3d('0xb6'),'h',_0xae3d('0xbf'))['where'](_0xae3d('0xc0'),_0x1dab1f)[_0xae3d('0x4c')](_0xae3d('0xc1'),_0xae3d('0xc2')))[_0xae3d('0x8f')]();_0x15b161['push'](db[_0xae3d('0x79')][_0xae3d('0x42')](_0x318de1));return BPromise['all'](_0x15b161);})[_0xae3d('0x2f')](function(){return _0x3fe687;})[_0xae3d('0x2f')](respondWithResult(_0x381585,null))[_0xae3d('0x54')](handleError(_0x381585,null));};exports[_0xae3d('0xc3')]=function(_0x427c9b,_0x2e9c80,_0x572288){return db['VoiceQueue'][_0xae3d('0x39')]({'where':{'id':_0x427c9b[_0xae3d('0x56')]['id']}})[_0xae3d('0x2f')](handleEntityNotFound(_0x2e9c80,null))['then'](function(_0x483b91){if(_0x483b91){return _0x483b91[_0xae3d('0xc3')](_0x427c9b[_0xae3d('0x42')][_0xae3d('0x85')]);}})[_0xae3d('0x2f')](function(_0x126f60){if(_0x126f60){return db[_0xae3d('0x67')][_0xae3d('0x30')]({'where':{'ListId':_0x427c9b[_0xae3d('0x42')][_0xae3d('0x85')],'VoiceQueueId':_0x427c9b[_0xae3d('0x56')]['id']}})[_0xae3d('0x2f')](function(){return _0x126f60;});}})[_0xae3d('0x2f')](respondWithStatusCode(_0x2e9c80,null))[_0xae3d('0x54')](handleError(_0x2e9c80,null));};exports[_0xae3d('0xc4')]=function(_0x9cb8d7,_0x1df4e4,_0x580ef8){var _0x51a996={};var _0xacb70={};var _0x4c6861;var _0x32733f;return db[_0xae3d('0x3f')][_0xae3d('0x66')]({'where':{'id':_0x9cb8d7[_0xae3d('0x56')]['id']}})['then'](handleEntityNotFound(_0x1df4e4,null))[_0xae3d('0x2f')](function(_0x4d5563){if(_0x4d5563){_0x4c6861=_0x4d5563;_0xacb70[_0xae3d('0x41')]=_['keys'](db[_0xae3d('0xa2')]['rawAttributes']);_0xacb70[_0xae3d('0x42')]=_[_0xae3d('0x43')](_0x9cb8d7['query']);_0xacb70['filters']=_['intersection'](_0xacb70['model'],_0xacb70['query']);_0x51a996[_0xae3d('0x47')]=_[_0xae3d('0x45')](_0xacb70[_0xae3d('0x41')],qs[_0xae3d('0x46')](_0x9cb8d7[_0xae3d('0x42')][_0xae3d('0x46')]));_0x51a996[_0xae3d('0x47')]=_0x51a996[_0xae3d('0x47')][_0xae3d('0x48')]?_0x51a996['attributes']:_0xacb70[_0xae3d('0x41')];_0x51a996['order']=qs['sort'](_0x9cb8d7['query'][_0xae3d('0x4b')]);_0x51a996['where']=qs[_0xae3d('0x44')](_[_0xae3d('0x4d')](_0x9cb8d7[_0xae3d('0x42')],_0xacb70[_0xae3d('0x44')]));if(_0x9cb8d7[_0xae3d('0x42')][_0xae3d('0x34')]){_0x51a996['where']=_['merge'](_0x51a996[_0xae3d('0x4c')],{'$or':_[_0xae3d('0x36')](_0x51a996[_0xae3d('0x47')],function(_0x23c8e5){var _0x49f235={};_0x49f235[_0x23c8e5]={'$like':'%'+_0x9cb8d7['query'][_0xae3d('0x34')]+'%'};return _0x49f235;})});}_0x51a996=_[_0xae3d('0x4e')]({},_0x51a996,_0x9cb8d7[_0xae3d('0x50')]);return _0x4c6861['getBlackLists'](_0x51a996);}})[_0xae3d('0x2f')](function(_0x9706db){if(_0x9706db){_0x32733f=_0x9706db[_0xae3d('0x48')];if(!_0x9cb8d7['query']['hasOwnProperty'](_0xae3d('0x4a'))){_0x51a996['limit']=qs[_0xae3d('0x25')](_0x9cb8d7[_0xae3d('0x42')]['limit']);_0x51a996[_0xae3d('0x28')]=qs[_0xae3d('0x28')](_0x9cb8d7[_0xae3d('0x42')]['offset']);}return _0x4c6861[_0xae3d('0xc4')](_0x51a996);}})[_0xae3d('0x2f')](function(_0x4520b8){if(_0x4520b8){return _0x4520b8?{'count':_0x32733f,'rows':_0x4520b8}:null;}})[_0xae3d('0x2f')](respondWithResult(_0x1df4e4,null))[_0xae3d('0x54')](handleError(_0x1df4e4,null));};exports['addBlackLists']=function(_0x5835fd,_0x305481,_0xb48683){var _0x982c76,_0x5421c7;return db[_0xae3d('0x3f')][_0xae3d('0x39')]({'where':{'id':_0x5835fd[_0xae3d('0x56')]['id']}})['then'](handleEntityNotFound(_0x305481,null))['then'](function(_0x415b20){if(_0x415b20){_0x5421c7=_0x415b20;return _0x415b20[_0xae3d('0xc5')](_0x5835fd[_0xae3d('0x62')][_0xae3d('0x85')],_[_0xae3d('0x61')](_0x5835fd[_0xae3d('0x62')],[_0xae3d('0x85'),'id'])||{});}return null;})[_0xae3d('0x98')](function(_0x6d972d){var _0x1cd4fc;_0x982c76=_0x6d972d||[];var _0x361d75=[];if(_0x6d972d){for(var _0x4e3f37=0x0;_0x4e3f37<_0x6d972d[_0xae3d('0x48')];_0x4e3f37+=0x1){var _0x49a461=_0x6d972d[_0x4e3f37][_0xae3d('0x31')]({'plain':!![]});_0x1cd4fc=squel['insert']()[_0xae3d('0xa6')](_0xae3d('0xc6'))['fromQuery']([_0xae3d('0xa8'),_0xae3d('0xaa'),'ListId',_0xae3d('0x69'),_0xae3d('0x5f'),_0xae3d('0x60')],squel['select']()['field'](_0xae3d('0xa8'),_0xae3d('0xa8'))[_0xae3d('0x87')]('id',_0xae3d('0xaa'))[_0xae3d('0x87')](_0x49a461['CmListId']['toString'](),_0xae3d('0xab'))[_0xae3d('0x87')](_0x5835fd[_0xae3d('0x56')]['id'][_0xae3d('0x8f')](),_0xae3d('0x69'))[_0xae3d('0x87')](_0xae3d('0xc7'),_0xae3d('0x5f'))[_0xae3d('0x87')](_0xae3d('0xc7'),_0xae3d('0x60'))[_0xae3d('0x89')](_0xae3d('0xad'))['where']('deletedAt\x20IS\x20NULL')[_0xae3d('0x4c')](_0xae3d('0xaf'),_0x49a461['CmListId'][_0xae3d('0x8f')]())[_0xae3d('0x4c')](_0xae3d('0xb0')))[_0xae3d('0x8f')]();_0x361d75['push'](db[_0xae3d('0x79')][_0xae3d('0x42')](_0x1cd4fc));}return BPromise[_0xae3d('0x93')](_0x361d75);}})[_0xae3d('0x2f')](function(){return _0x982c76;})[_0xae3d('0x2f')](respondWithResult(_0x305481,null))[_0xae3d('0x54')](handleError(_0x305481,null));};exports[_0xae3d('0xc8')]=function(_0x3477a5,_0x41ce74,_0x4694a8){return db[_0xae3d('0x3f')]['find']({'where':{'id':_0x3477a5['params']['id']}})['then'](handleEntityNotFound(_0x41ce74,null))[_0xae3d('0x2f')](function(_0x3c43c9){if(_0x3c43c9){return _0x3c43c9['removeBlackLists'](_0x3477a5['query']['ids']);}})['then'](function(_0x559fb2){if(_0x559fb2){return db[_0xae3d('0x6f')][_0xae3d('0x30')]({'where':{'ListId':_0x3477a5[_0xae3d('0x42')][_0xae3d('0x85')],'VoiceQueueId':_0x3477a5[_0xae3d('0x56')]['id']}})['then'](function(){return _0x559fb2;});}})[_0xae3d('0x2f')](respondWithStatusCode(_0x41ce74,null))[_0xae3d('0x54')](handleError(_0x41ce74,null));}; \ No newline at end of file +var _0x15c6=['interface','flatMap','forEach','penalty','transaction','each','TeamVoiceQueue','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','ids','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','all','union','compact','removeTeams','isEmpty','removeAgents','addAgents','spread','isArray','userVoiceQueue:remove','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','fromQuery','scheduledAt','ContactId','ListId','select','phone','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','VoiceQueues','inbound','QueueCampaigns','filter','ignore','map','value','includes','type','find','name','UserProfileResource','end','error','send','index','VoiceQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','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','clone','omit','createdAt','updatedAt','outbound','getHoppers','findOne','CmHopper','length','VoiceQueueId','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online'];(function(_0x250890,_0x47efc4){var _0x3c1914=function(_0x11f30e){while(--_0x11f30e){_0x250890['push'](_0x250890['shift']());}};_0x3c1914(++_0x47efc4);}(_0x15c6,0x1cd));var _0x615c=function(_0x38b3cb,_0x4ad7b3){_0x38b3cb=_0x38b3cb-0x0;var _0x5a9a84=_0x15c6[_0x38b3cb];return _0x5a9a84;};'use strict';var emlformat=require(_0x615c('0x0'));var rimraf=require(_0x615c('0x1'));var zipdir=require(_0x615c('0x2'));var jsonpatch=require(_0x615c('0x3'));var rp=require(_0x615c('0x4'));var moment=require(_0x615c('0x5'));var BPromise=require(_0x615c('0x6'));var Mustache=require(_0x615c('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x615c('0x8'));var ejs=require(_0x615c('0x9'));var fs=require('fs');var fs_extra=require(_0x615c('0xa'));var _=require('lodash');var squel=require(_0x615c('0xb'));var crypto=require(_0x615c('0xc'));var jsforce=require(_0x615c('0xd'));var deskjs=require(_0x615c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x615c('0xf'));var Papa=require('papaparse');var Redis=require(_0x615c('0x10'));var authService=require(_0x615c('0x11'));var qs=require(_0x615c('0x12'));var as=require(_0x615c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x615c('0x14'));var utils=require(_0x615c('0x15'));var config=require(_0x615c('0x16'));var licenseUtil=require(_0x615c('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x615c('0x18')](config[_0x615c('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x615c('0x1a'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0x615c('0x1b')](socket);function respondWithStatusCode(_0x11d751,_0x2e9dd9){_0x2e9dd9=_0x2e9dd9||0xcc;return function(_0x11e338){if(_0x11e338){return _0x11d751[_0x615c('0x1c')](_0x2e9dd9);}return _0x11d751[_0x615c('0x1d')](_0x2e9dd9)['end']();};}function respondWithResult(_0x2d10d2,_0x41dee1){_0x41dee1=_0x41dee1||0xc8;return function(_0x30205d){if(_0x30205d){return _0x2d10d2['status'](_0x41dee1)[_0x615c('0x1e')](_0x30205d);}};}function respondWithFilteredResult(_0x3953aa,_0x12dcda){return function(_0x1e0d18){if(_0x1e0d18){var _0x1badec=typeof _0x12dcda[_0x615c('0x1f')]===_0x615c('0x20')&&typeof _0x12dcda[_0x615c('0x21')]==='undefined';var _0x504e63=_0x1e0d18['count'];var _0x2cbe15=_0x1badec?0x0:_0x12dcda[_0x615c('0x1f')];var _0x348280=_0x1badec?_0x1e0d18[_0x615c('0x22')]:_0x12dcda['offset']+_0x12dcda['limit'];var _0x2f77cc;if(_0x348280>=_0x504e63){_0x348280=_0x504e63;_0x2f77cc=0xc8;}else{_0x2f77cc=0xce;}_0x3953aa['status'](_0x2f77cc);return _0x3953aa[_0x615c('0x23')]('Content-Range',_0x2cbe15+'-'+_0x348280+'/'+_0x504e63)[_0x615c('0x1e')](_0x1e0d18);}return null;};}function patchUpdates(_0x508ea5){return function(_0xcc25fb){try{jsonpatch[_0x615c('0x24')](_0xcc25fb,_0x508ea5,!![]);}catch(_0x5d148b){return BPromise['reject'](_0x5d148b);}return _0xcc25fb[_0x615c('0x25')]();};}function saveUpdates(_0x4117f5,_0x29bad0){return function(_0x42ee58){if(_0x42ee58){return _0x42ee58[_0x615c('0x26')](_0x4117f5)['then'](function(_0x32635f){return _0x32635f;});}return null;};}function removeEntity(_0x2f1959,_0x5968aa){return function(_0x49a14a){if(_0x49a14a){return _0x49a14a[_0x615c('0x27')]()[_0x615c('0x28')](function(){var _0x8671eb=_0x49a14a['get']({'plain':!![]});var _0x32ce76=[{'name':_0x615c('0x29'),'value':_0x615c('0x2a'),'ignore':![]},{'name':_0x615c('0x2b'),'value':'outbound','ignore':![]}];var _0x25101f=_(_0x32ce76)[_0x615c('0x2c')](_0x615c('0x2d'))[_0x615c('0x2e')](_0x615c('0x2f'))[_0x615c('0x2f')]();if(_[_0x615c('0x30')](_0x25101f,_0x8671eb[_0x615c('0x31')])){return;}var _0x3339d4=_[_0x615c('0x32')](_0x32ce76,[_0x615c('0x2f'),_0x8671eb[_0x615c('0x31')]])[_0x615c('0x33')];return db[_0x615c('0x34')]['destroy']({'where':{'type':_0x3339d4,'resourceId':_0x8671eb['id']}})[_0x615c('0x28')](function(){return _0x49a14a;});})[_0x615c('0x28')](function(){_0x2f1959[_0x615c('0x1d')](0xcc)[_0x615c('0x35')]();});}};}function handleEntityNotFound(_0x1daf84,_0x42f99d){return function(_0x49ed0d){if(!_0x49ed0d){_0x1daf84[_0x615c('0x1c')](0x194);}return _0x49ed0d;};}function handleError(_0x25c40a,_0x2478c2){_0x2478c2=_0x2478c2||0x1f4;return function(_0xcd2b9d){logger[_0x615c('0x36')](_0xcd2b9d['stack']);if(_0xcd2b9d[_0x615c('0x33')]){delete _0xcd2b9d['name'];}_0x25c40a[_0x615c('0x1d')](_0x2478c2)[_0x615c('0x37')](_0xcd2b9d);};}exports[_0x615c('0x38')]=function(_0x248423,_0x14926e){var _0x3d82b5={},_0x48de1b={},_0x193eed={'count':0x0,'rows':[]};var _0x84de42=_[_0x615c('0x2e')](db[_0x615c('0x39')][_0x615c('0x3a')],function(_0x2f1ac6){return{'name':_0x2f1ac6[_0x615c('0x3b')],'type':_0x2f1ac6['type'][_0x615c('0x3c')]};});_0x48de1b[_0x615c('0x3d')]=_[_0x615c('0x2e')](_0x84de42,_0x615c('0x33'));_0x48de1b['query']=_[_0x615c('0x3e')](_0x248423[_0x615c('0x3f')]);_0x48de1b[_0x615c('0x40')]=_[_0x615c('0x41')](_0x48de1b['model'],_0x48de1b['query']);_0x3d82b5[_0x615c('0x42')]=_[_0x615c('0x41')](_0x48de1b[_0x615c('0x3d')],qs['fields'](_0x248423[_0x615c('0x3f')][_0x615c('0x43')]));_0x3d82b5[_0x615c('0x42')]=_0x3d82b5[_0x615c('0x42')]['length']?_0x3d82b5['attributes']:_0x48de1b[_0x615c('0x3d')];if(!_0x248423['query'][_0x615c('0x44')](_0x615c('0x45'))){_0x3d82b5[_0x615c('0x21')]=qs['limit'](_0x248423[_0x615c('0x3f')][_0x615c('0x21')]);_0x3d82b5[_0x615c('0x1f')]=qs[_0x615c('0x1f')](_0x248423[_0x615c('0x3f')]['offset']);}_0x3d82b5[_0x615c('0x46')]=qs[_0x615c('0x47')](_0x248423['query']['sort']);_0x3d82b5['where']=qs[_0x615c('0x40')](_[_0x615c('0x48')](_0x248423['query'],_0x48de1b['filters']),_0x84de42);if(_0x248423[_0x615c('0x3f')][_0x615c('0x2c')]){_0x3d82b5[_0x615c('0x49')]=_[_0x615c('0x4a')](_0x3d82b5[_0x615c('0x49')],{'$or':_[_0x615c('0x2e')](_0x84de42,function(_0x238910){if(_0x238910[_0x615c('0x31')]!==_0x615c('0x4b')){var _0x43920f={};_0x43920f[_0x238910['name']]={'$like':'%'+_0x248423[_0x615c('0x3f')][_0x615c('0x2c')]+'%'};return _0x43920f;}})});}_0x3d82b5=_[_0x615c('0x4a')]({},_0x3d82b5,_0x248423[_0x615c('0x4c')]);var _0x50b756={'where':_0x3d82b5[_0x615c('0x49')]};return db[_0x615c('0x39')][_0x615c('0x22')](_0x50b756)[_0x615c('0x28')](function(_0x33a4b3){_0x193eed[_0x615c('0x22')]=_0x33a4b3;if(_0x248423['query'][_0x615c('0x4d')]){_0x3d82b5['include']=[{'all':!![]}];}return db['VoiceQueue'][_0x615c('0x4e')](_0x3d82b5);})['then'](function(_0x3f6156){_0x193eed[_0x615c('0x4f')]=_0x3f6156;return _0x193eed;})[_0x615c('0x28')](respondWithFilteredResult(_0x14926e,_0x3d82b5))[_0x615c('0x50')](handleError(_0x14926e,null));};exports[_0x615c('0x51')]=function(_0x20116d,_0x251e95){var _0x540c5c={'raw':![],'where':{'id':_0x20116d[_0x615c('0x52')]['id']}},_0x38fbe0={};_0x38fbe0['model']=_[_0x615c('0x3e')](db[_0x615c('0x39')][_0x615c('0x3a')]);_0x38fbe0['query']=_[_0x615c('0x3e')](_0x20116d[_0x615c('0x3f')]);_0x38fbe0[_0x615c('0x40')]=_['intersection'](_0x38fbe0[_0x615c('0x3d')],_0x38fbe0['query']);_0x540c5c[_0x615c('0x42')]=_[_0x615c('0x41')](_0x38fbe0[_0x615c('0x3d')],qs[_0x615c('0x43')](_0x20116d[_0x615c('0x3f')]['fields']));_0x540c5c[_0x615c('0x42')]=_0x540c5c[_0x615c('0x42')]['length']?_0x540c5c[_0x615c('0x42')]:_0x38fbe0['model'];if(_0x20116d[_0x615c('0x3f')][_0x615c('0x4d')]){_0x540c5c[_0x615c('0x53')]=[{'all':!![]}];}_0x540c5c=_[_0x615c('0x4a')]({},_0x540c5c,_0x20116d[_0x615c('0x4c')]);return db[_0x615c('0x39')][_0x615c('0x32')](_0x540c5c)[_0x615c('0x28')](handleEntityNotFound(_0x251e95,null))[_0x615c('0x28')](respondWithResult(_0x251e95,null))['catch'](handleError(_0x251e95,null));};exports[_0x615c('0x54')]=function(_0x30ef3f,_0x5bac0f){return db[_0x615c('0x39')][_0x615c('0x54')](_0x30ef3f[_0x615c('0x55')],{})[_0x615c('0x28')](function(_0x132919){var _0x51b134=_0x30ef3f['user'][_0x615c('0x56')]({'plain':!![]});if(!_0x51b134)throw new Error(_0x615c('0x57'));if(_0x51b134[_0x615c('0x58')]===_0x615c('0x59')){var _0xd02b68=_0x132919[_0x615c('0x56')]({'plain':!![]});var _0x3900ba=[{'name':_0x615c('0x29'),'value':_0x615c('0x2a')},{'name':'QueueCampaigns','value':'outbound'}];var _0x5c3c89=_['find'](_0x3900ba,[_0x615c('0x2f'),_0xd02b68[_0x615c('0x31')]])[_0x615c('0x33')];return db[_0x615c('0x5a')][_0x615c('0x32')]({'where':{'name':_0x5c3c89,'userProfileId':_0x51b134[_0x615c('0x5b')]},'raw':!![]})[_0x615c('0x28')](function(_0x4c20f3){if(_0x4c20f3&&_0x4c20f3[_0x615c('0x5c')]===0x0){return db[_0x615c('0x34')][_0x615c('0x54')]({'name':_0xd02b68[_0x615c('0x33')],'resourceId':_0xd02b68['id'],'type':_0x4c20f3['name'],'sectionId':_0x4c20f3['id']},{})[_0x615c('0x28')](function(){return _0x132919;});}else{return _0x132919;}})['catch'](function(_0x57ebc4){logger['error'](_0x615c('0x5d'),_0x57ebc4);throw _0x57ebc4;});}return _0x132919;})[_0x615c('0x28')](respondWithResult(_0x5bac0f,0xc9))['catch'](handleError(_0x5bac0f,null));};exports[_0x615c('0x5e')]=function(_0x6ef9bb,_0x2e2346){var _0x4b13e1={'where':{'id':_0x6ef9bb[_0x615c('0x52')]['id']}},_0x119bbe={};_0x119bbe[_0x615c('0x3d')]=_[_0x615c('0x3e')](db[_0x615c('0x39')][_0x615c('0x3a')]);_0x4b13e1[_0x615c('0x42')]=_[_0x615c('0x41')](_0x119bbe[_0x615c('0x3d')],qs[_0x615c('0x43')](_0x6ef9bb[_0x615c('0x3f')][_0x615c('0x43')]));_0x4b13e1[_0x615c('0x42')]=_0x4b13e1[_0x615c('0x42')]['length']?_0x4b13e1['attributes']:_0x119bbe['model'];if(_0x6ef9bb['query']['includeAll']){_0x4b13e1['include']=[{'all':!![]}];}_0x4b13e1=_[_0x615c('0x4a')]({},_0x4b13e1,_0x6ef9bb['options']);return db[_0x615c('0x39')][_0x615c('0x32')](_0x4b13e1)['then'](handleEntityNotFound(_0x2e2346,null))[_0x615c('0x28')](function(_0x4df2ff){if(_0x4df2ff){var _0x3cd5c2=_0x4df2ff[_0x615c('0x56')]({'plain':!![]});_0x3cd5c2=qs[_0x615c('0x5f')](_0x3cd5c2,['id',_0x615c('0x60'),_0x615c('0x61')]);_0x6ef9bb['body']=_[_0x615c('0x5f')](_0x6ef9bb[_0x615c('0x55')],['id','createdAt','updatedAt']);return db[_0x615c('0x39')][_0x615c('0x54')](_[_0x615c('0x4a')](_0x3cd5c2,_0x6ef9bb[_0x615c('0x55')]),{'include':_0x6ef9bb['query'][_0x615c('0x4d')]?[{'all':!![]}]:undefined})[_0x615c('0x28')](function(_0x160b01){var _0xe63b0c=_0x6ef9bb['user'][_0x615c('0x56')]({'plain':!![]});if(!_0xe63b0c)throw new Error(_0x615c('0x57'));if(_0xe63b0c[_0x615c('0x58')]===_0x615c('0x59')){var _0x9b2e54=_0x160b01[_0x615c('0x56')]({'plain':!![]});var _0x4eb084=[{'name':'VoiceQueues','value':_0x615c('0x2a')},{'name':_0x615c('0x2b'),'value':_0x615c('0x62')}];var _0x29e5b7=_[_0x615c('0x32')](_0x4eb084,[_0x615c('0x2f'),_0x9b2e54[_0x615c('0x31')]])[_0x615c('0x33')];return db['UserProfileSection'][_0x615c('0x32')]({'where':{'name':_0x29e5b7,'userProfileId':_0xe63b0c['userProfileId']},'raw':!![]})[_0x615c('0x28')](function(_0x1341b2){if(_0x1341b2&&_0x1341b2['autoAssociation']===0x0){return db[_0x615c('0x34')]['create']({'name':_0x9b2e54[_0x615c('0x33')],'resourceId':_0x9b2e54['id'],'type':_0x1341b2['name'],'sectionId':_0x1341b2['id']},{})[_0x615c('0x28')](function(){return _0x160b01;});}else{return _0x160b01;}})['catch'](function(_0x85be38){logger[_0x615c('0x36')](_0x615c('0x5d'),_0x85be38);throw _0x85be38;});}return _0x160b01;});}})[_0x615c('0x28')](respondWithResult(_0x2e2346,0xc9))[_0x615c('0x50')](handleError(_0x2e2346,null));};exports['update']=function(_0x4fb4d7,_0x21aae4){if(_0x4fb4d7[_0x615c('0x55')]['id']){delete _0x4fb4d7[_0x615c('0x55')]['id'];}return db[_0x615c('0x39')][_0x615c('0x32')]({'where':{'id':_0x4fb4d7[_0x615c('0x52')]['id']}})['then'](handleEntityNotFound(_0x21aae4,null))[_0x615c('0x28')](saveUpdates(_0x4fb4d7[_0x615c('0x55')],null))['then'](respondWithResult(_0x21aae4,null))['catch'](handleError(_0x21aae4,null));};exports[_0x615c('0x27')]=function(_0x565c50,_0x98685d){return db[_0x615c('0x39')]['find']({'where':{'id':_0x565c50[_0x615c('0x52')]['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x98685d,null))[_0x615c('0x28')](removeEntity(_0x98685d,null))[_0x615c('0x50')](handleError(_0x98685d,null));};exports[_0x615c('0x63')]=function(_0x47aa28,_0x2b7fb9,_0x4d1d5f){var _0x5192cd={'raw':![],'where':{}};var _0x568ebd={};var _0x45be40={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x615c('0x64')]({'where':{'id':_0x47aa28[_0x615c('0x52')]['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x2b7fb9,null))['then'](function(_0x314ca7){if(_0x314ca7){_0x568ebd[_0x615c('0x3d')]=_[_0x615c('0x3e')](db[_0x615c('0x65')]['rawAttributes']);_0x568ebd[_0x615c('0x3f')]=_['keys'](_0x47aa28[_0x615c('0x3f')]);_0x568ebd[_0x615c('0x40')]=_[_0x615c('0x41')](_0x568ebd[_0x615c('0x3d')],_0x568ebd[_0x615c('0x3f')]);_0x5192cd[_0x615c('0x42')]=_[_0x615c('0x41')](_0x568ebd[_0x615c('0x3d')],qs[_0x615c('0x43')](_0x47aa28[_0x615c('0x3f')][_0x615c('0x43')]));_0x5192cd[_0x615c('0x42')]=_0x5192cd[_0x615c('0x42')][_0x615c('0x66')]?_0x5192cd['attributes']:_0x568ebd[_0x615c('0x3d')];if(!_0x47aa28[_0x615c('0x3f')]['hasOwnProperty'](_0x615c('0x45'))){_0x5192cd[_0x615c('0x21')]=qs[_0x615c('0x21')](_0x47aa28[_0x615c('0x3f')][_0x615c('0x21')]);_0x5192cd[_0x615c('0x1f')]=qs[_0x615c('0x1f')](_0x47aa28['query']['offset']);}_0x5192cd[_0x615c('0x46')]=qs[_0x615c('0x47')](_0x47aa28[_0x615c('0x3f')][_0x615c('0x47')]);_0x5192cd[_0x615c('0x49')]=qs[_0x615c('0x40')](_[_0x615c('0x48')](_0x47aa28[_0x615c('0x3f')],_0x568ebd['filters']));_0x5192cd[_0x615c('0x49')][_0x615c('0x67')]=_0x314ca7['id'];if(_0x47aa28[_0x615c('0x3f')][_0x615c('0x2c')]){_0x5192cd[_0x615c('0x49')]=_[_0x615c('0x4a')](_0x5192cd[_0x615c('0x49')],{'$or':_[_0x615c('0x2e')](_0x5192cd[_0x615c('0x42')],function(_0x17a6cf){var _0x363dd2={};_0x363dd2[_0x17a6cf]={'$like':'%'+_0x47aa28[_0x615c('0x3f')][_0x615c('0x2c')]+'%'};return _0x363dd2;})});}_0x5192cd=_[_0x615c('0x4a')]({},_0x5192cd,_0x47aa28['options']);return db[_0x615c('0x65')][_0x615c('0x22')]({'where':_0x5192cd['where']})[_0x615c('0x28')](function(_0x3811a7){_0x45be40[_0x615c('0x22')]=_0x3811a7;if(_0x47aa28[_0x615c('0x3f')][_0x615c('0x4d')]){_0x5192cd[_0x615c('0x53')]=[{'all':!![]}];}return db['CmHopper'][_0x615c('0x4e')](_0x5192cd);})[_0x615c('0x28')](function(_0x9f5b05){_0x45be40[_0x615c('0x4f')]=_0x9f5b05;return _0x45be40;});}})['then'](respondWithFilteredResult(_0x2b7fb9,_0x5192cd))[_0x615c('0x50')](handleError(_0x2b7fb9,null));};exports[_0x615c('0x68')]=function(_0x5eb7a2,_0x49aa93,_0x3ab4cb){var _0xfd8d5a={'raw':!![],'where':{}};var _0x13a4b7={};var _0x44994e={'count':0x0,'rows':[]};return db[_0x615c('0x39')][_0x615c('0x64')]({'where':{'id':_0x5eb7a2['params']['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x49aa93,null))[_0x615c('0x28')](function(_0x328479){if(_0x328479){_0x13a4b7[_0x615c('0x3d')]=_[_0x615c('0x3e')](db[_0x615c('0x69')][_0x615c('0x3a')]);_0x13a4b7[_0x615c('0x3f')]=_['keys'](_0x5eb7a2[_0x615c('0x3f')]);_0x13a4b7[_0x615c('0x40')]=_[_0x615c('0x41')](_0x13a4b7[_0x615c('0x3d')],_0x13a4b7['query']);_0xfd8d5a[_0x615c('0x42')]=_[_0x615c('0x41')](_0x13a4b7[_0x615c('0x3d')],qs[_0x615c('0x43')](_0x5eb7a2['query']['fields']));_0xfd8d5a['attributes']=_0xfd8d5a[_0x615c('0x42')][_0x615c('0x66')]?_0xfd8d5a[_0x615c('0x42')]:_0x13a4b7['model'];if(!_0x5eb7a2[_0x615c('0x3f')][_0x615c('0x44')](_0x615c('0x45'))){_0xfd8d5a[_0x615c('0x21')]=qs[_0x615c('0x21')](_0x5eb7a2[_0x615c('0x3f')][_0x615c('0x21')]);_0xfd8d5a[_0x615c('0x1f')]=qs['offset'](_0x5eb7a2[_0x615c('0x3f')][_0x615c('0x1f')]);}_0xfd8d5a[_0x615c('0x46')]=qs['sort'](_0x5eb7a2[_0x615c('0x3f')][_0x615c('0x47')]);_0xfd8d5a[_0x615c('0x49')]=qs[_0x615c('0x40')](_[_0x615c('0x48')](_0x5eb7a2['query'],_0x13a4b7[_0x615c('0x40')]));_0xfd8d5a[_0x615c('0x49')][_0x615c('0x67')]=_0x328479['id'];if(_0x5eb7a2[_0x615c('0x3f')]['filter']){_0xfd8d5a[_0x615c('0x49')]=_[_0x615c('0x4a')](_0xfd8d5a[_0x615c('0x49')],{'$or':_['map'](_0xfd8d5a['attributes'],function(_0x4283e4){var _0x39d7f={};_0x39d7f[_0x4283e4]={'$like':'%'+_0x5eb7a2[_0x615c('0x3f')][_0x615c('0x2c')]+'%'};return _0x39d7f;})});}_0xfd8d5a=_[_0x615c('0x4a')]({},_0xfd8d5a,_0x5eb7a2['options']);return db[_0x615c('0x69')][_0x615c('0x22')]({'where':_0xfd8d5a[_0x615c('0x49')]})[_0x615c('0x28')](function(_0x4c6523){_0x44994e[_0x615c('0x22')]=_0x4c6523;if(_0x5eb7a2[_0x615c('0x3f')]['includeAll']){_0xfd8d5a[_0x615c('0x53')]=[{'all':!![]}];}return db[_0x615c('0x69')][_0x615c('0x4e')](_0xfd8d5a);})[_0x615c('0x28')](function(_0x104fe9){_0x44994e[_0x615c('0x4f')]=_0x104fe9;return _0x44994e;});}})[_0x615c('0x28')](respondWithFilteredResult(_0x49aa93,_0xfd8d5a))[_0x615c('0x50')](handleError(_0x49aa93,null));};exports['getHopperFinals']=function(_0xab333e,_0x10308f,_0x207336){var _0x319aa2={'raw':!![],'where':{}};var _0x36f2e5={};var _0x345be6={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x615c('0x64')]({'where':{'id':_0xab333e[_0x615c('0x52')]['id']}})['then'](handleEntityNotFound(_0x10308f,null))[_0x615c('0x28')](function(_0x2b6ef1){if(_0x2b6ef1){_0x36f2e5['model']=_[_0x615c('0x3e')](db[_0x615c('0x6a')]['rawAttributes']);_0x36f2e5[_0x615c('0x3f')]=_[_0x615c('0x3e')](_0xab333e[_0x615c('0x3f')]);_0x36f2e5[_0x615c('0x40')]=_[_0x615c('0x41')](_0x36f2e5[_0x615c('0x3d')],_0x36f2e5[_0x615c('0x3f')]);_0x319aa2[_0x615c('0x42')]=_['intersection'](_0x36f2e5['model'],qs[_0x615c('0x43')](_0xab333e['query'][_0x615c('0x43')]));_0x319aa2[_0x615c('0x42')]=_0x319aa2[_0x615c('0x42')][_0x615c('0x66')]?_0x319aa2[_0x615c('0x42')]:_0x36f2e5[_0x615c('0x3d')];if(!_0xab333e[_0x615c('0x3f')]['hasOwnProperty']('nolimit')){_0x319aa2[_0x615c('0x21')]=qs['limit'](_0xab333e['query'][_0x615c('0x21')]);_0x319aa2['offset']=qs[_0x615c('0x1f')](_0xab333e[_0x615c('0x3f')][_0x615c('0x1f')]);}_0x319aa2[_0x615c('0x46')]=qs[_0x615c('0x47')](_0xab333e[_0x615c('0x3f')]['sort']);_0x319aa2['where']=qs[_0x615c('0x40')](_[_0x615c('0x48')](_0xab333e['query'],_0x36f2e5['filters']));_0x319aa2[_0x615c('0x49')][_0x615c('0x67')]=_0x2b6ef1['id'];if(_0xab333e['query'][_0x615c('0x2c')]){_0x319aa2[_0x615c('0x49')]=_[_0x615c('0x4a')](_0x319aa2[_0x615c('0x49')],{'$or':_[_0x615c('0x2e')](_0x319aa2[_0x615c('0x42')],function(_0x530d7f){var _0x810a60={};_0x810a60[_0x530d7f]={'$like':'%'+_0xab333e[_0x615c('0x3f')][_0x615c('0x2c')]+'%'};return _0x810a60;})});}_0x319aa2=_['merge']({},_0x319aa2,_0xab333e[_0x615c('0x4c')]);return db[_0x615c('0x6a')][_0x615c('0x22')]({'where':_0x319aa2['where']})[_0x615c('0x28')](function(_0x478108){_0x345be6['count']=_0x478108;if(_0xab333e['query'][_0x615c('0x4d')]){_0x319aa2[_0x615c('0x53')]=[{'all':!![]}];}return db[_0x615c('0x6a')][_0x615c('0x4e')](_0x319aa2);})[_0x615c('0x28')](function(_0x974b5d){_0x345be6[_0x615c('0x4f')]=_0x974b5d;return _0x345be6;});}})['then'](respondWithFilteredResult(_0x10308f,_0x319aa2))[_0x615c('0x50')](handleError(_0x10308f,null));};exports['getHopperBlacks']=function(_0x4bc5ca,_0x198254,_0x3481e5){var _0x561a3b={'raw':!![],'where':{}};var _0x19bea4={};var _0x342a6d={'count':0x0,'rows':[]};return db[_0x615c('0x39')][_0x615c('0x64')]({'where':{'id':_0x4bc5ca[_0x615c('0x52')]['id']}})['then'](handleEntityNotFound(_0x198254,null))[_0x615c('0x28')](function(_0x16a97f){if(_0x16a97f){_0x19bea4[_0x615c('0x3d')]=_['keys'](db[_0x615c('0x6b')]['rawAttributes']);_0x19bea4[_0x615c('0x3f')]=_[_0x615c('0x3e')](_0x4bc5ca['query']);_0x19bea4[_0x615c('0x40')]=_[_0x615c('0x41')](_0x19bea4[_0x615c('0x3d')],_0x19bea4[_0x615c('0x3f')]);_0x561a3b['attributes']=_[_0x615c('0x41')](_0x19bea4['model'],qs['fields'](_0x4bc5ca[_0x615c('0x3f')][_0x615c('0x43')]));_0x561a3b['attributes']=_0x561a3b[_0x615c('0x42')][_0x615c('0x66')]?_0x561a3b[_0x615c('0x42')]:_0x19bea4['model'];if(!_0x4bc5ca[_0x615c('0x3f')][_0x615c('0x44')]('nolimit')){_0x561a3b[_0x615c('0x21')]=qs[_0x615c('0x21')](_0x4bc5ca['query'][_0x615c('0x21')]);_0x561a3b[_0x615c('0x1f')]=qs['offset'](_0x4bc5ca[_0x615c('0x3f')][_0x615c('0x1f')]);}_0x561a3b[_0x615c('0x46')]=qs[_0x615c('0x47')](_0x4bc5ca['query'][_0x615c('0x47')]);_0x561a3b[_0x615c('0x49')]=qs[_0x615c('0x40')](_[_0x615c('0x48')](_0x4bc5ca[_0x615c('0x3f')],_0x19bea4[_0x615c('0x40')]));_0x561a3b[_0x615c('0x49')][_0x615c('0x67')]=_0x16a97f['id'];if(_0x4bc5ca[_0x615c('0x3f')][_0x615c('0x2c')]){_0x561a3b[_0x615c('0x49')]=_[_0x615c('0x4a')](_0x561a3b['where'],{'$or':_[_0x615c('0x2e')](_0x561a3b[_0x615c('0x42')],function(_0x5412d6){var _0x57b755={};_0x57b755[_0x5412d6]={'$like':'%'+_0x4bc5ca[_0x615c('0x3f')][_0x615c('0x2c')]+'%'};return _0x57b755;})});}_0x561a3b=_[_0x615c('0x4a')]({},_0x561a3b,_0x4bc5ca[_0x615c('0x4c')]);return db[_0x615c('0x6b')]['count']({'where':_0x561a3b[_0x615c('0x49')]})['then'](function(_0x42b8c2){_0x342a6d['count']=_0x42b8c2;if(_0x4bc5ca[_0x615c('0x3f')][_0x615c('0x4d')]){_0x561a3b[_0x615c('0x53')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x615c('0x4e')](_0x561a3b);})['then'](function(_0xe583fb){_0x342a6d[_0x615c('0x4f')]=_0xe583fb;return _0x342a6d;});}})['then'](respondWithFilteredResult(_0x198254,_0x561a3b))['catch'](handleError(_0x198254,null));};exports[_0x615c('0x6c')]=function(_0x16cec8,_0x41ba3b,_0x790c50){var _0x179561={};var _0xce7e6f={};var _0x80e1b8;var _0x2a5457;return db[_0x615c('0x39')][_0x615c('0x64')]({'where':{'id':_0x16cec8['params']['id']}})['then'](handleEntityNotFound(_0x41ba3b,null))[_0x615c('0x28')](function(_0x5ac6b8){if(_0x5ac6b8){_0x80e1b8=_0x5ac6b8;_0xce7e6f[_0x615c('0x3d')]=_['keys'](db[_0x615c('0x6d')][_0x615c('0x3a')]);_0xce7e6f[_0x615c('0x3f')]=_['keys'](_0x16cec8['query']);_0xce7e6f[_0x615c('0x40')]=_[_0x615c('0x41')](_0xce7e6f[_0x615c('0x3d')],_0xce7e6f[_0x615c('0x3f')]);_0x179561[_0x615c('0x42')]=_[_0x615c('0x41')](_0xce7e6f['model'],qs['fields'](_0x16cec8[_0x615c('0x3f')][_0x615c('0x43')]));_0x179561[_0x615c('0x42')]=_0x179561['attributes'][_0x615c('0x66')]?_0x179561['attributes']:_0xce7e6f[_0x615c('0x3d')];_0x179561['order']=qs['sort'](_0x16cec8['query'][_0x615c('0x47')]);_0x179561[_0x615c('0x49')]=qs['filters'](_[_0x615c('0x48')](_0x16cec8[_0x615c('0x3f')],_0xce7e6f[_0x615c('0x40')]));if(_0x16cec8[_0x615c('0x3f')][_0x615c('0x2c')]){_0x179561[_0x615c('0x49')]=_[_0x615c('0x4a')](_0x179561[_0x615c('0x49')],{'$or':_['map'](_0x179561[_0x615c('0x42')],function(_0xce0d14){var _0x45ec7d={};_0x45ec7d[_0xce0d14]={'$like':'%'+_0x16cec8[_0x615c('0x3f')][_0x615c('0x2c')]+'%'};return _0x45ec7d;})});}_0x179561=_['merge']({},_0x179561,_0x16cec8[_0x615c('0x4c')]);return _0x80e1b8[_0x615c('0x6c')](_0x179561);}})[_0x615c('0x28')](function(_0x42ee39){if(_0x42ee39){_0x2a5457=_0x42ee39['length'];if(!_0x16cec8[_0x615c('0x3f')][_0x615c('0x44')](_0x615c('0x45'))){_0x179561[_0x615c('0x21')]=qs[_0x615c('0x21')](_0x16cec8[_0x615c('0x3f')]['limit']);_0x179561[_0x615c('0x1f')]=qs['offset'](_0x16cec8[_0x615c('0x3f')][_0x615c('0x1f')]);}return _0x80e1b8['getTeams'](_0x179561);}})[_0x615c('0x28')](function(_0xaa73f1){if(_0xaa73f1){return _0xaa73f1?{'count':_0x2a5457,'rows':_0xaa73f1}:null;}})[_0x615c('0x28')](respondWithResult(_0x41ba3b,null))['catch'](handleError(_0x41ba3b,null));};exports[_0x615c('0x6e')]=function(_0x58daef,_0x53d78e,_0x1991ca){var _0x48f168=_0x58daef['body'][_0x615c('0x6f')];var _0x254fb5=_[_0x615c('0x2e')](_0x48f168,'id');return db[_0x615c('0x6d')]['findAll']({'where':{'id':_0x254fb5},'attributes':['id'],'include':[{'model':db[_0x615c('0x70')],'as':_0x615c('0x71'),'attributes':['id',_0x615c('0x33'),_0x615c('0x72'),'voicePause',_0x615c('0x73')],'raw':!![]}]})[_0x615c('0x28')](function(_0x399bb2){if(_0x399bb2){var _0x4659eb=_[_0x615c('0x74')](_0x399bb2,function(_0xeb6f2d){var _0x42753c=_0xeb6f2d[_0x615c('0x56')]({'plain':!![]});_0x42753c[_0x615c('0x71')][_0x615c('0x75')](function(_0x1a3fc8){_0x1a3fc8[_0x615c('0x76')]=_[_0x615c('0x32')](_0x48f168,{'id':_0x42753c['id']})['penalty'];});return _0x42753c['Agents'];});return db[_0x615c('0x39')][_0x615c('0x32')]({'where':{'id':_0x58daef[_0x615c('0x52')]['id']}})['then'](function(_0x14d245){return db['sequelize'][_0x615c('0x77')](function(_0x18797d){return _0x14d245['addTeams'](_0x254fb5,{'transaction':_0x18797d})['then'](function(){return BPromise[_0x615c('0x78')](_0x48f168,function(_0x53c9be){return db[_0x615c('0x79')]['upsert']({'TeamId':_0x53c9be['id'],'VoiceQueueId':_0x58daef[_0x615c('0x52')]['id'],'penalty':_0x53c9be[_0x615c('0x76')]},{'transaction':_0x18797d});});})[_0x615c('0x28')](function(){return BPromise[_0x615c('0x78')](_0x4659eb,function(_0x19eeb0){return db[_0x615c('0x7a')]['findOrCreate']({'where':{'UserId':_0x19eeb0['id'],'VoiceQueueId':_0x58daef[_0x615c('0x52')]['id']},'defaults':{'penalty':_0x19eeb0[_0x615c('0x76')]},'transaction':_0x18797d});});})[_0x615c('0x28')](function(){return BPromise[_0x615c('0x78')](_['filter'](_0x4659eb,{'online':!![]}),function(_0x15c69b){return db[_0x615c('0x7b')][_0x615c('0x7c')]({'membername':_0x15c69b[_0x615c('0x33')],'UserId':_0x15c69b['id'],'queue_name':_0x14d245[_0x615c('0x33')],'VoiceQueueId':_0x14d245['id'],'interface':_[_0x615c('0x7d')](_0x15c69b[_0x615c('0x73')])?util[_0x615c('0x7e')](_0x615c('0x7f'),_0x15c69b[_0x615c('0x33')]):_0x15c69b[_0x615c('0x73')],'paused':_0x15c69b[_0x615c('0x80')]||![],'penalty':_0x15c69b[_0x615c('0x76')]},{'transaction':_0x18797d});});})['then'](function(){_0x4659eb[_0x615c('0x75')](function(_0x49e3a8){socket[_0x615c('0x81')](_0x615c('0x82'),{'UserId':_0x49e3a8['id'],'VoiceQueueId':_0x14d245['id']});});});});});}})[_0x615c('0x28')](respondWithStatusCode(_0x53d78e,null))[_0x615c('0x50')](handleError(_0x53d78e,null));};exports['removeTeams']=function(_0x3c99c9,_0x837ff8,_0x327f7c){return db[_0x615c('0x6d')][_0x615c('0x4e')]({'where':{'id':_0x3c99c9['query'][_0x615c('0x83')]},'attributes':['id'],'include':[{'model':db[_0x615c('0x70')],'as':_0x615c('0x71'),'attributes':['id'],'raw':!![]}]})[_0x615c('0x28')](handleEntityNotFound(_0x837ff8,null))[_0x615c('0x28')](function(_0x2a7dd0){var _0x53b41a=_['map'](_0x2a7dd0,'id');var _0x544217=[];var _0x22435b=[];var _0x7b8b18=squel['select']();_0x7b8b18[_0x615c('0x84')]('tq.TeamId')[_0x615c('0x85')]('team_has_voice_queues','tq')[_0x615c('0x86')](_0x615c('0x87'),'ut',_0x615c('0x88'))['where'](_0x615c('0x89'),_0x3c99c9[_0x615c('0x52')]['id']);for(var _0xfac63c=0x0;_0xfac63c<_0x2a7dd0['length'];_0xfac63c+=0x1){let _0x4f5804=_0x2a7dd0[_0xfac63c];for(var _0x1379a1=0x0;_0x1379a1<_0x4f5804['Agents']['length'];_0x1379a1+=0x1){let _0x3cad70=_0x4f5804[_0x615c('0x71')][_0x1379a1];var _0x122849=_0x7b8b18[_0x615c('0x5e')]();_0x122849[_0x615c('0x49')](_0x615c('0x8a'),_0x3cad70['id']);_0x22435b[_0x615c('0x8b')](db[_0x615c('0x8c')][_0x615c('0x3f')](_0x122849[_0x615c('0x8d')](),{'type':db[_0x615c('0x8c')][_0x615c('0x8e')][_0x615c('0x8f')]})['then'](function(_0x437c0f){if(_0x437c0f[_0x615c('0x66')]===0x1){return _0x3cad70['id'];}else{var _0x20c330=_['every'](_[_0x615c('0x2e')](_0x437c0f,'TeamId'),function(_0x470a78){return _[_0x615c('0x30')](_0x53b41a,_0x470a78);});if(_0x20c330){return _0x3cad70['id'];}}}));}}return BPromise[_0x615c('0x90')](_0x22435b)['then'](function(_0x50c033){_0x544217=_(_0x544217)[_0x615c('0x91')](_0x50c033)[_0x615c('0x92')]()[_0x615c('0x2f')]();return db[_0x615c('0x39')]['find']({'where':{'id':_0x3c99c9[_0x615c('0x52')]['id']}})[_0x615c('0x28')](function(_0x59db5d){return db['sequelize'][_0x615c('0x77')](function(_0x3f238c){return _0x59db5d[_0x615c('0x93')](_0x3c99c9[_0x615c('0x3f')][_0x615c('0x83')],{'transaction':_0x3f238c})[_0x615c('0x28')](function(){if(!_[_0x615c('0x94')](_0x544217)){return _0x59db5d[_0x615c('0x95')](_0x544217,{'transaction':_0x3f238c})[_0x615c('0x28')](function(){return db[_0x615c('0x7b')][_0x615c('0x27')]({'where':{'VoiceQueueId':_0x3c99c9[_0x615c('0x52')]['id'],'UserId':_0x544217},'transaction':_0x3f238c});});}})[_0x615c('0x28')](function(){_0x544217[_0x615c('0x75')](function(_0x498cfa){socket[_0x615c('0x81')]('userVoiceQueue:remove',{'UserId':_0x498cfa,'VoiceQueueId':_0x59db5d['id']});});});});});});})[_0x615c('0x28')](respondWithStatusCode(_0x837ff8,null))[_0x615c('0x50')](handleError(_0x837ff8,null));};exports[_0x615c('0x96')]=function(_0x5a3ea2,_0xb0c74,_0x11200d){var _0x5ec289,_0x124cbc;return db[_0x615c('0x39')]['find']({'where':{'id':_0x5a3ea2[_0x615c('0x52')]['id']}})[_0x615c('0x28')](handleEntityNotFound(_0xb0c74,null))[_0x615c('0x28')](function(_0x5c9883){if(_0x5c9883){_0x124cbc=_0x5c9883;return _0x5c9883[_0x615c('0x96')](_0x5a3ea2[_0x615c('0x55')][_0x615c('0x83')],_[_0x615c('0x5f')](_0x5a3ea2['body'],[_0x615c('0x83'),'id'])||{})[_0x615c('0x97')](function(_0x5b3322){for(var _0x3d227e=0x0;_0x3d227e<_0x5a3ea2[_0x615c('0x55')][_0x615c('0x83')]['length'];_0x3d227e+=0x1){socket[_0x615c('0x81')]('userVoiceQueue:save',{'UserId':Number(_0x5a3ea2['body'][_0x615c('0x83')][_0x3d227e]),'VoiceQueueId':Number(_0x5a3ea2[_0x615c('0x52')]['id'])});}return _0x5b3322;});}})['then'](function(_0x27e2d7){_0x5ec289=_0x27e2d7||[];if(_0x124cbc){return db[_0x615c('0x70')][_0x615c('0x4e')]({'where':{'id':_0x5a3ea2[_0x615c('0x55')][_0x615c('0x83')]},'attributes':['id',_0x615c('0x33'),'online',_0x615c('0x80'),_0x615c('0x73')],'raw':!![]});}})[_0x615c('0x28')](function(_0x2bad16){if(!_[_0x615c('0x94')](_0x2bad16)){var _0x4647b6=[];for(var _0x3edec2=0x0;_0x3edec2<_0x2bad16['length'];_0x3edec2++){if(_0x2bad16[_0x3edec2]['online']){_0x4647b6['push'](db[_0x615c('0x7b')]['upsert']({'membername':_0x2bad16[_0x3edec2]['name'],'UserId':_0x2bad16[_0x3edec2]['id'],'queue_name':_0x124cbc[_0x615c('0x33')],'VoiceQueueId':_0x124cbc['id'],'interface':_[_0x615c('0x7d')](_0x2bad16[_0x3edec2]['interface'])?util[_0x615c('0x7e')](_0x615c('0x7f'),_0x2bad16[_0x3edec2][_0x615c('0x33')]):_0x2bad16[_0x3edec2][_0x615c('0x73')],'paused':_0x2bad16[_0x3edec2][_0x615c('0x80')]||![],'penalty':_0x5a3ea2['body'][_0x615c('0x76')]||0x0}));}}return BPromise['all'](_0x4647b6);}})['then'](function(){return _0x5ec289;})[_0x615c('0x28')](respondWithResult(_0xb0c74,null))[_0x615c('0x50')](handleError(_0xb0c74,null));};exports[_0x615c('0x95')]=function(_0x389e06,_0x370c74,_0x132e8a){return db[_0x615c('0x39')][_0x615c('0x32')]({'where':{'id':_0x389e06[_0x615c('0x52')]['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x370c74,null))[_0x615c('0x28')](function(_0x30ef62){if(_0x30ef62){return _0x30ef62[_0x615c('0x95')](_0x389e06[_0x615c('0x3f')]['ids'])[_0x615c('0x28')](function(){if(_[_0x615c('0x98')](_0x389e06[_0x615c('0x3f')]['ids'])){for(var _0x5f10d8=0x0;_0x5f10d8<_0x389e06[_0x615c('0x3f')][_0x615c('0x83')][_0x615c('0x66')];_0x5f10d8+=0x1){socket[_0x615c('0x81')]('userVoiceQueue:remove',{'UserId':Number(_0x389e06[_0x615c('0x3f')][_0x615c('0x83')][_0x5f10d8]),'VoiceQueueId':Number(_0x389e06[_0x615c('0x52')]['id'])});}}else{socket['emit'](_0x615c('0x99'),{'UserId':Number(_0x389e06[_0x615c('0x3f')][_0x615c('0x83')]),'VoiceQueueId':Number(_0x389e06[_0x615c('0x52')]['id'])});}});}})[_0x615c('0x28')](function(_0x5b573f){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x389e06[_0x615c('0x52')]['id'],'UserId':_0x389e06['query'][_0x615c('0x83')]}})[_0x615c('0x28')](function(){return _0x5b573f;});})[_0x615c('0x28')](respondWithStatusCode(_0x370c74,null))['catch'](handleError(_0x370c74,null));};exports['getAgents']=function(_0x572b78,_0x480a3a,_0x4cc809){var _0xcdef2d={};var _0x147ce3={};var _0x2a6616;var _0x5d6430;return db[_0x615c('0x39')][_0x615c('0x64')]({'where':{'id':_0x572b78['params']['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x480a3a,null))[_0x615c('0x28')](function(_0x4f128a){if(_0x4f128a){_0x2a6616=_0x4f128a;_0x147ce3['model']=_[_0x615c('0x3e')](db[_0x615c('0x70')][_0x615c('0x3a')]);_0x147ce3[_0x615c('0x3f')]=_[_0x615c('0x3e')](_0x572b78[_0x615c('0x3f')]);_0x147ce3[_0x615c('0x40')]=_[_0x615c('0x41')](_0x147ce3[_0x615c('0x3d')],_0x147ce3[_0x615c('0x3f')]);_0xcdef2d['attributes']=_[_0x615c('0x41')](_0x147ce3['model'],qs[_0x615c('0x43')](_0x572b78['query']['fields']));_0xcdef2d['attributes']=_0xcdef2d[_0x615c('0x42')][_0x615c('0x66')]?_0xcdef2d['attributes']:_0x147ce3[_0x615c('0x3d')];_0xcdef2d['order']=qs['sort'](_0x572b78[_0x615c('0x3f')][_0x615c('0x47')]);_0xcdef2d[_0x615c('0x49')]=qs['filters'](_[_0x615c('0x48')](_0x572b78[_0x615c('0x3f')],_0x147ce3[_0x615c('0x40')]));if(_0x572b78[_0x615c('0x3f')]['filter']){_0xcdef2d[_0x615c('0x49')]=_[_0x615c('0x4a')](_0xcdef2d['where'],{'$or':_[_0x615c('0x2e')](_0xcdef2d[_0x615c('0x42')],function(_0x4b2f0f){var _0x2ba940={};_0x2ba940[_0x4b2f0f]={'$like':'%'+_0x572b78[_0x615c('0x3f')][_0x615c('0x2c')]+'%'};return _0x2ba940;})});}_0xcdef2d=_[_0x615c('0x4a')]({},_0xcdef2d,_0x572b78[_0x615c('0x4c')]);return _0x2a6616['getAgents'](_0xcdef2d);}})[_0x615c('0x28')](function(_0x189e85){if(_0x189e85){_0x5d6430=_0x189e85[_0x615c('0x66')];if(!_0x572b78[_0x615c('0x3f')][_0x615c('0x44')](_0x615c('0x45'))){_0xcdef2d['limit']=qs[_0x615c('0x21')](_0x572b78[_0x615c('0x3f')]['limit']);_0xcdef2d['offset']=qs['offset'](_0x572b78[_0x615c('0x3f')][_0x615c('0x1f')]);}return _0x2a6616['getAgents'](_0xcdef2d);}})['then'](function(_0x34a077){if(_0x34a077){return _0x34a077?{'count':_0x5d6430,'rows':_0x34a077}:null;}})[_0x615c('0x28')](respondWithResult(_0x480a3a,null))['catch'](handleError(_0x480a3a,null));};exports[_0x615c('0x9a')]=function(_0x29059b,_0x3fd6d0,_0x47ab62){var _0x41f9fc={};var _0x2dbb0e={};var _0x28a6f9;var _0x300f4a;return db['VoiceQueue'][_0x615c('0x64')]({'where':{'id':_0x29059b[_0x615c('0x52')]['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x3fd6d0,null))[_0x615c('0x28')](function(_0x24c946){if(_0x24c946){_0x28a6f9=_0x24c946;_0x2dbb0e['model']=_[_0x615c('0x3e')](db[_0x615c('0x7b')]['rawAttributes']);_0x2dbb0e['query']=_[_0x615c('0x3e')](_0x29059b[_0x615c('0x3f')]);_0x2dbb0e['filters']=_[_0x615c('0x41')](_0x2dbb0e[_0x615c('0x3d')],_0x2dbb0e[_0x615c('0x3f')]);_0x41f9fc[_0x615c('0x42')]=_[_0x615c('0x41')](_0x2dbb0e['model'],qs[_0x615c('0x43')](_0x29059b['query'][_0x615c('0x43')]));_0x41f9fc[_0x615c('0x42')]=_0x41f9fc[_0x615c('0x42')][_0x615c('0x66')]?_0x41f9fc[_0x615c('0x42')]:_0x2dbb0e[_0x615c('0x3d')];_0x41f9fc[_0x615c('0x46')]=qs[_0x615c('0x47')](_0x29059b['query']['sort']);_0x41f9fc[_0x615c('0x49')]=qs['filters'](_[_0x615c('0x48')](_0x29059b['query'],_0x2dbb0e[_0x615c('0x40')]));if(_0x29059b[_0x615c('0x3f')][_0x615c('0x2c')]){_0x41f9fc[_0x615c('0x49')]=_[_0x615c('0x4a')](_0x41f9fc[_0x615c('0x49')],{'$or':_['map'](_0x41f9fc[_0x615c('0x42')],function(_0x270913){var _0x15fa95={};_0x15fa95[_0x270913]={'$like':'%'+_0x29059b[_0x615c('0x3f')][_0x615c('0x2c')]+'%'};return _0x15fa95;})});}_0x41f9fc=_[_0x615c('0x4a')]({},_0x41f9fc,_0x29059b[_0x615c('0x4c')]);return _0x28a6f9[_0x615c('0x9a')](_0x41f9fc);}})[_0x615c('0x28')](function(_0x338b3d){if(_0x338b3d){_0x300f4a=_0x338b3d[_0x615c('0x66')];if(!_0x29059b[_0x615c('0x3f')][_0x615c('0x44')](_0x615c('0x45'))){_0x41f9fc[_0x615c('0x21')]=qs[_0x615c('0x21')](_0x29059b['query'][_0x615c('0x21')]);_0x41f9fc['offset']=qs['offset'](_0x29059b[_0x615c('0x3f')][_0x615c('0x1f')]);}return _0x28a6f9[_0x615c('0x9a')](_0x41f9fc);}})[_0x615c('0x28')](function(_0x226989){return _0x226989?{'count':_0x300f4a,'rows':_0x226989}:null;})[_0x615c('0x28')](respondWithResult(_0x3fd6d0,null))[_0x615c('0x50')](handleError(_0x3fd6d0,null));};exports[_0x615c('0x9b')]=function(_0x240b20,_0x4e35c1,_0x570f05){var _0x44566b={};var _0x5d2942={};var _0x1677a1;var _0x12c10e;return db[_0x615c('0x39')][_0x615c('0x64')]({'where':{'id':_0x240b20[_0x615c('0x52')]['id']}})['then'](handleEntityNotFound(_0x4e35c1,null))['then'](function(_0x4a704c){if(_0x4a704c){_0x1677a1=_0x4a704c;_0x5d2942[_0x615c('0x3d')]=_[_0x615c('0x3e')](db[_0x615c('0x9c')][_0x615c('0x3a')]);_0x5d2942[_0x615c('0x3f')]=_['keys'](_0x240b20[_0x615c('0x3f')]);_0x5d2942[_0x615c('0x40')]=_['intersection'](_0x5d2942[_0x615c('0x3d')],_0x5d2942[_0x615c('0x3f')]);_0x44566b[_0x615c('0x42')]=_['intersection'](_0x5d2942[_0x615c('0x3d')],qs[_0x615c('0x43')](_0x240b20[_0x615c('0x3f')][_0x615c('0x43')]));_0x44566b[_0x615c('0x42')]=_0x44566b[_0x615c('0x42')]['length']?_0x44566b[_0x615c('0x42')]:_0x5d2942[_0x615c('0x3d')];_0x44566b[_0x615c('0x46')]=qs[_0x615c('0x47')](_0x240b20[_0x615c('0x3f')]['sort']);_0x44566b[_0x615c('0x49')]=qs['filters'](_[_0x615c('0x48')](_0x240b20[_0x615c('0x3f')],_0x5d2942[_0x615c('0x40')]));if(_0x240b20[_0x615c('0x3f')][_0x615c('0x2c')]){_0x44566b[_0x615c('0x49')]=_[_0x615c('0x4a')](_0x44566b[_0x615c('0x49')],{'$or':_[_0x615c('0x2e')](_0x44566b[_0x615c('0x42')],function(_0xc7d39e){var _0x11f084={};_0x11f084[_0xc7d39e]={'$like':'%'+_0x240b20['query'][_0x615c('0x2c')]+'%'};return _0x11f084;})});}_0x44566b=_[_0x615c('0x4a')]({},_0x44566b,_0x240b20[_0x615c('0x4c')]);return _0x1677a1[_0x615c('0x9b')](_0x44566b);}})[_0x615c('0x28')](function(_0x564527){if(_0x564527){_0x12c10e=_0x564527[_0x615c('0x66')];if(!_0x240b20[_0x615c('0x3f')][_0x615c('0x44')](_0x615c('0x45'))){_0x44566b[_0x615c('0x21')]=qs[_0x615c('0x21')](_0x240b20[_0x615c('0x3f')][_0x615c('0x21')]);_0x44566b[_0x615c('0x1f')]=qs[_0x615c('0x1f')](_0x240b20[_0x615c('0x3f')][_0x615c('0x1f')]);}return _0x1677a1[_0x615c('0x9b')](_0x44566b);}})[_0x615c('0x28')](function(_0x3eb222){if(_0x3eb222){return _0x3eb222?{'count':_0x12c10e,'rows':_0x3eb222}:null;}})[_0x615c('0x28')](respondWithResult(_0x4e35c1,null))[_0x615c('0x50')](handleError(_0x4e35c1,null));};exports[_0x615c('0x9d')]=function(_0x4c6007,_0x4cdd8b,_0x131626){var _0x51bca0=moment()['format'](_0x615c('0x9e'));var _0x1b71db,_0x251a9a;return db['VoiceQueue']['find']({'where':{'id':_0x4c6007[_0x615c('0x52')]['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x4cdd8b,null))[_0x615c('0x28')](function(_0x1f82b9){if(_0x1f82b9){_0x251a9a=_0x1f82b9;return _0x1f82b9[_0x615c('0x9d')](_0x4c6007[_0x615c('0x55')][_0x615c('0x83')],_[_0x615c('0x5f')](_0x4c6007['body'],['ids','id'])||{});}return null;})[_0x615c('0x97')](function(_0x5a82b2){var _0x48ce07;_0x1b71db=_0x5a82b2||[];var _0x10baad=[];if(_0x5a82b2){for(var _0x503921=0x0;_0x503921<_0x5a82b2[_0x615c('0x66')];_0x503921+=0x1){var _0x2855a7=_0x5a82b2[_0x503921]['get']({'plain':!![]});_0x251a9a[_0x615c('0x9f')]=_0x4c6007[_0x615c('0x55')]['dialCheckDuplicateType']?_0x4c6007[_0x615c('0x55')][_0x615c('0x9f')]:_0x251a9a[_0x615c('0x9f')];switch(_0x251a9a[_0x615c('0x9f')]){case _0x615c('0xa0'):_0x48ce07=squel[_0x615c('0xa1')]()[_0x615c('0xa2')]('cm_hopper')[_0x615c('0xa3')](['phone',_0x615c('0xa4'),_0x615c('0xa5'),_0x615c('0xa6'),_0x615c('0x67'),_0x615c('0x60'),'updatedAt'],squel[_0x615c('0xa7')]()['field'](_0x615c('0xa8'),_0x615c('0xa8'))[_0x615c('0x84')]('\x27'+_0x51bca0+'\x27',_0x615c('0xa4'))[_0x615c('0x84')]('id',_0x615c('0xa5'))[_0x615c('0x84')](_0x2855a7['CmListId']['toString'](),'ListId')[_0x615c('0x84')](_0x4c6007['params']['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x51bca0+'\x27',_0x615c('0x60'))['field']('\x27'+_0x51bca0+'\x27',_0x615c('0x61'))['from'](_0x615c('0xa9'))[_0x615c('0x49')](_0x615c('0xaa'))[_0x615c('0x49')](_0x615c('0xab'),_0x2855a7[_0x615c('0xac')][_0x615c('0x8d')]())[_0x615c('0x49')](_0x615c('0xad'))['where'](_0x615c('0xae'),squel['select']()[_0x615c('0x84')]('COALESCE(calleridnum,\x27\x27)')[_0x615c('0x85')](_0x615c('0xaf'))[_0x615c('0x49')](_0x615c('0x89'),_0x4c6007[_0x615c('0x52')]['id']['toString']()))[_0x615c('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0x615c('0xa7')]()[_0x615c('0x84')](_0x615c('0xb0'))[_0x615c('0x85')](_0x615c('0xb1'))['where']('VoiceQueueId\x20=\x20?',_0x4c6007[_0x615c('0x52')]['id'][_0x615c('0x8d')]())))['toString']();break;case _0x615c('0xb2'):_0x48ce07=squel[_0x615c('0xa1')]()[_0x615c('0xa2')]('cm_hopper')[_0x615c('0xa3')](['phone',_0x615c('0xa4'),_0x615c('0xa5'),_0x615c('0xa6'),_0x615c('0x67'),_0x615c('0x60'),_0x615c('0x61')],squel['select']()[_0x615c('0x84')](_0x615c('0xa8'),_0x615c('0xa8'))[_0x615c('0x84')]('\x27'+_0x51bca0+'\x27',_0x615c('0xa4'))[_0x615c('0x84')]('id','ContactId')[_0x615c('0x84')](_0x2855a7[_0x615c('0xac')][_0x615c('0x8d')](),_0x615c('0xa6'))[_0x615c('0x84')](_0x4c6007['params']['id'][_0x615c('0x8d')](),_0x615c('0x67'))[_0x615c('0x84')]('\x27'+_0x51bca0+'\x27','createdAt')[_0x615c('0x84')]('\x27'+_0x51bca0+'\x27',_0x615c('0x61'))[_0x615c('0x85')]('cm_contacts')[_0x615c('0x49')]('deletedAt\x20IS\x20NULL')[_0x615c('0x49')]('ListId\x20=\x20?',_0x2855a7[_0x615c('0xac')]['toString']())[_0x615c('0x49')](_0x615c('0xad'))[_0x615c('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0x615c('0xa7')]()['field']('COALESCE(phone,\x27\x27)')[_0x615c('0x85')]('cm_hopper')[_0x615c('0x49')](_0x615c('0x89'),_0x4c6007[_0x615c('0x52')]['id'][_0x615c('0x8d')]())))[_0x615c('0x8d')]();break;default:_0x48ce07=squel[_0x615c('0xa1')]()[_0x615c('0xa2')]('cm_hopper')['fromQuery'](['phone',_0x615c('0xa4'),_0x615c('0xa5'),_0x615c('0xa6'),_0x615c('0x67'),'createdAt',_0x615c('0x61')],squel[_0x615c('0xa7')]()[_0x615c('0x84')](_0x615c('0xa8'),_0x615c('0xa8'))[_0x615c('0x84')]('\x27'+_0x51bca0+'\x27','scheduledAt')[_0x615c('0x84')]('id','ContactId')[_0x615c('0x84')](_0x2855a7['CmListId']['toString'](),'ListId')[_0x615c('0x84')](_0x4c6007[_0x615c('0x52')]['id'][_0x615c('0x8d')](),'VoiceQueueId')[_0x615c('0x84')]('\x27'+_0x51bca0+'\x27',_0x615c('0x60'))[_0x615c('0x84')]('\x27'+_0x51bca0+'\x27','updatedAt')['from'](_0x615c('0xa9'))[_0x615c('0x49')](_0x615c('0xaa'))['where'](_0x615c('0xab'),_0x2855a7[_0x615c('0xac')][_0x615c('0x8d')]())['where'](_0x615c('0xad')))[_0x615c('0x8d')]();}_0x10baad[_0x615c('0x8b')](db[_0x615c('0x8c')]['query'](_0x48ce07));}return BPromise[_0x615c('0x90')](_0x10baad);}})[_0x615c('0x28')](function(){var _0x15e276=[];var _0x23e9a2=squel[_0x615c('0xa1')]()[_0x615c('0xa2')](_0x615c('0xb3'))[_0x615c('0xa3')]([_0x615c('0xb4'),_0x615c('0xa8'),_0x615c('0xb5'),_0x615c('0x60'),'updatedAt'],squel[_0x615c('0xa7')]()[_0x615c('0x84')]('h.id')[_0x615c('0x84')]('ci.item')['field'](_0x615c('0xb6'))['field']('\x27'+_0x51bca0+'\x27','createdAt')[_0x615c('0x84')]('\x27'+_0x51bca0+'\x27',_0x615c('0x61'))[_0x615c('0x85')](_0x615c('0xb7'),'ci')[_0x615c('0x86')]('cm_hopper','h',_0x615c('0xb8'))[_0x615c('0x49')](_0x615c('0xb9'),_0x51bca0)['where']('ci.ItemClass=?','PHONE'))[_0x615c('0x8d')]();_0x15e276['push'](db[_0x615c('0x8c')]['query'](_0x23e9a2));return BPromise[_0x615c('0x90')](_0x15e276);})[_0x615c('0x28')](function(){return _0x1b71db;})[_0x615c('0x28')](respondWithResult(_0x4cdd8b,null))[_0x615c('0x50')](handleError(_0x4cdd8b,null));};exports['removeLists']=function(_0x4acd61,_0xabda91,_0x1f394d){return db[_0x615c('0x39')]['find']({'where':{'id':_0x4acd61['params']['id']}})[_0x615c('0x28')](handleEntityNotFound(_0xabda91,null))['then'](function(_0x5e55e9){if(_0x5e55e9){return _0x5e55e9[_0x615c('0xba')](_0x4acd61['query'][_0x615c('0x83')]);}})[_0x615c('0x28')](function(_0x4e2b7b){if(_0x4e2b7b){return db[_0x615c('0x65')][_0x615c('0x27')]({'where':{'ListId':_0x4acd61[_0x615c('0x3f')][_0x615c('0x83')],'VoiceQueueId':_0x4acd61['params']['id']}})['then'](function(){return _0x4e2b7b;});}})[_0x615c('0x28')](respondWithStatusCode(_0xabda91,null))[_0x615c('0x50')](handleError(_0xabda91,null));};exports[_0x615c('0xbb')]=function(_0x24741b,_0x233463,_0x2c4ffa){var _0x58c640={};var _0x36368e={};var _0x336798;var _0x543081;return db['VoiceQueue']['findOne']({'where':{'id':_0x24741b[_0x615c('0x52')]['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x233463,null))['then'](function(_0x5982fe){if(_0x5982fe){_0x336798=_0x5982fe;_0x36368e[_0x615c('0x3d')]=_['keys'](db[_0x615c('0x9c')][_0x615c('0x3a')]);_0x36368e[_0x615c('0x3f')]=_['keys'](_0x24741b[_0x615c('0x3f')]);_0x36368e[_0x615c('0x40')]=_[_0x615c('0x41')](_0x36368e['model'],_0x36368e[_0x615c('0x3f')]);_0x58c640[_0x615c('0x42')]=_[_0x615c('0x41')](_0x36368e[_0x615c('0x3d')],qs[_0x615c('0x43')](_0x24741b[_0x615c('0x3f')]['fields']));_0x58c640[_0x615c('0x42')]=_0x58c640[_0x615c('0x42')][_0x615c('0x66')]?_0x58c640[_0x615c('0x42')]:_0x36368e[_0x615c('0x3d')];_0x58c640[_0x615c('0x46')]=qs['sort'](_0x24741b[_0x615c('0x3f')]['sort']);_0x58c640[_0x615c('0x49')]=qs[_0x615c('0x40')](_[_0x615c('0x48')](_0x24741b[_0x615c('0x3f')],_0x36368e[_0x615c('0x40')]));if(_0x24741b[_0x615c('0x3f')][_0x615c('0x2c')]){_0x58c640[_0x615c('0x49')]=_['merge'](_0x58c640[_0x615c('0x49')],{'$or':_[_0x615c('0x2e')](_0x58c640[_0x615c('0x42')],function(_0x17789f){var _0x1c57fb={};_0x1c57fb[_0x17789f]={'$like':'%'+_0x24741b[_0x615c('0x3f')]['filter']+'%'};return _0x1c57fb;})});}_0x58c640=_['merge']({},_0x58c640,_0x24741b[_0x615c('0x4c')]);return _0x336798[_0x615c('0xbb')](_0x58c640);}})[_0x615c('0x28')](function(_0x41bf57){if(_0x41bf57){_0x543081=_0x41bf57[_0x615c('0x66')];if(!_0x24741b[_0x615c('0x3f')][_0x615c('0x44')](_0x615c('0x45'))){_0x58c640['limit']=qs[_0x615c('0x21')](_0x24741b[_0x615c('0x3f')]['limit']);_0x58c640['offset']=qs['offset'](_0x24741b[_0x615c('0x3f')][_0x615c('0x1f')]);}return _0x336798[_0x615c('0xbb')](_0x58c640);}})[_0x615c('0x28')](function(_0x3881f6){if(_0x3881f6){return _0x3881f6?{'count':_0x543081,'rows':_0x3881f6}:null;}})[_0x615c('0x28')](respondWithResult(_0x233463,null))[_0x615c('0x50')](handleError(_0x233463,null));};exports[_0x615c('0xbc')]=function(_0x1963c9,_0x530ccf,_0x56d890){var _0x335937,_0x3f6d1b;return db[_0x615c('0x39')][_0x615c('0x32')]({'where':{'id':_0x1963c9['params']['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x530ccf,null))[_0x615c('0x28')](function(_0x538fb2){if(_0x538fb2){_0x3f6d1b=_0x538fb2;return _0x538fb2[_0x615c('0xbc')](_0x1963c9[_0x615c('0x55')][_0x615c('0x83')],_[_0x615c('0x5f')](_0x1963c9[_0x615c('0x55')],[_0x615c('0x83'),'id'])||{});}return null;})[_0x615c('0x97')](function(_0x18e1c2){var _0x27b498;_0x335937=_0x18e1c2||[];var _0x40114c=[];if(_0x18e1c2){for(var _0x1f1af4=0x0;_0x1f1af4<_0x18e1c2[_0x615c('0x66')];_0x1f1af4+=0x1){var _0x54d714=_0x18e1c2[_0x1f1af4][_0x615c('0x56')]({'plain':!![]});_0x27b498=squel[_0x615c('0xa1')]()[_0x615c('0xa2')](_0x615c('0xbd'))[_0x615c('0xa3')]([_0x615c('0xa8'),'ContactId','ListId',_0x615c('0x67'),_0x615c('0x60'),_0x615c('0x61')],squel[_0x615c('0xa7')]()[_0x615c('0x84')](_0x615c('0xa8'),_0x615c('0xa8'))[_0x615c('0x84')]('id',_0x615c('0xa5'))[_0x615c('0x84')](_0x54d714[_0x615c('0xac')][_0x615c('0x8d')](),_0x615c('0xa6'))[_0x615c('0x84')](_0x1963c9['params']['id'][_0x615c('0x8d')](),'VoiceQueueId')[_0x615c('0x84')]('NOW()','createdAt')[_0x615c('0x84')](_0x615c('0xbe'),_0x615c('0x61'))[_0x615c('0x85')]('cm_contacts')['where'](_0x615c('0xaa'))[_0x615c('0x49')]('ListId\x20=\x20?',_0x54d714['CmListId'][_0x615c('0x8d')]())[_0x615c('0x49')](_0x615c('0xad')))[_0x615c('0x8d')]();_0x40114c[_0x615c('0x8b')](db['sequelize'][_0x615c('0x3f')](_0x27b498));}return BPromise[_0x615c('0x90')](_0x40114c);}})[_0x615c('0x28')](function(){return _0x335937;})[_0x615c('0x28')](respondWithResult(_0x530ccf,null))['catch'](handleError(_0x530ccf,null));};exports[_0x615c('0xbf')]=function(_0x333b9e,_0x437dac,_0x5a1b0f){return db['VoiceQueue']['find']({'where':{'id':_0x333b9e[_0x615c('0x52')]['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x437dac,null))[_0x615c('0x28')](function(_0x363348){if(_0x363348){return _0x363348['removeBlackLists'](_0x333b9e[_0x615c('0x3f')]['ids']);}})[_0x615c('0x28')](function(_0x2f5977){if(_0x2f5977){return db[_0x615c('0x6b')][_0x615c('0x27')]({'where':{'ListId':_0x333b9e[_0x615c('0x3f')][_0x615c('0x83')],'VoiceQueueId':_0x333b9e[_0x615c('0x52')]['id']}})[_0x615c('0x28')](function(){return _0x2f5977;});}})[_0x615c('0x28')](respondWithStatusCode(_0x437dac,null))['catch'](handleError(_0x437dac,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 6260a6a..ebcb240 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 _0xea9c=['emit','hook','exports','events','../../mysqldb','update','remove'];(function(_0x32262b,_0x348626){var _0x2e6c41=function(_0x278ebf){while(--_0x278ebf){_0x32262b['push'](_0x32262b['shift']());}};_0x2e6c41(++_0x348626);}(_0xea9c,0x106));var _0xcea9=function(_0x22608,_0x1cffde){_0x22608=_0x22608-0x0;var _0x381b6a=_0xea9c[_0x22608];return _0x381b6a;};'use strict';var EventEmitter=require(_0xcea9('0x0'));var VoiceQueue=require(_0xcea9('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xcea9('0x2'),'afterDestroy':_0xcea9('0x3')};function emitEvent(_0x2ea789){return function(_0x3215a4,_0x34fb18,_0x5c06d2){VoiceQueueEvents[_0xcea9('0x4')](_0x2ea789+':'+_0x3215a4['id'],_0x3215a4);VoiceQueueEvents[_0xcea9('0x4')](_0x2ea789,_0x3215a4);_0x5c06d2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xcea9('0x5')](e,emitEvent(event));}}module[_0xcea9('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0xf220=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf220,0xf2));var _0x0f22=function(_0x47e2d6,_0x93e61){_0x47e2d6=_0x47e2d6-0x0;var _0x4946b7=_0xf220[_0x47e2d6];return _0x4946b7;};'use strict';var EventEmitter=require(_0x0f22('0x0'));var VoiceQueue=require(_0x0f22('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x0f22('0x2')](0x0);var events={'afterCreate':_0x0f22('0x3'),'afterUpdate':'update','afterDestroy':_0x0f22('0x4')};function emitEvent(_0x4a5df3){return function(_0xb0e64d,_0x3a677a,_0x3fe675){VoiceQueueEvents[_0x0f22('0x5')](_0x4a5df3+':'+_0xb0e64d['id'],_0xb0e64d);VoiceQueueEvents[_0x0f22('0x5')](_0x4a5df3,_0xb0e64d);_0x3fe675(null);};}for(var e in events){if(events[_0x0f22('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x0f22('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 1fd6eb6..cc8c6e5 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 _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x396910,_0x397bda){var _0x217d81=function(_0x1e6ab9){while(--_0x1e6ab9){_0x396910['push'](_0x396910['shift']());}};_0x217d81(++_0x397bda);}(_0x008c,0x188));var _0xc008=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0x008c[_0x2e2681];return _0x368a64;};'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 +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x5d98e4,_0x377619){var _0x36157d=function(_0x1b39fd){while(--_0x1b39fd){_0x5d98e4['push'](_0x5d98e4['shift']());}};_0x36157d(++_0x377619);}(_0x70e0,0x17b));var _0x070e=function(_0x1f7d92,_0x1234b4){_0x1f7d92=_0x1f7d92-0x0;var _0x540f56=_0x70e0[_0x1f7d92];return _0x540f56;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index ee2af3f..56d9091 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 _0xa8be=['./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceQueue','findAll','raw','options','where','attributes','include','map','model','then','GetVoiceQueue','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x5300df,_0x370e86){var _0x52c187=function(_0x43cb02){while(--_0x43cb02){_0x5300df['push'](_0x5300df['shift']());}};_0x52c187(++_0x370e86);}(_0xa8be,0x122));var _0xea8b=function(_0x37041d,_0x296507){_0x37041d=_0x37041d-0x0;var _0x4493af=_0xa8be[_0x37041d];return _0x4493af;};'use strict';var _=require(_0xea8b('0x0'));var util=require(_0xea8b('0x1'));var moment=require(_0xea8b('0x2'));var BPromise=require(_0xea8b('0x3'));var rs=require(_0xea8b('0x4'));var fs=require('fs');var Redis=require(_0xea8b('0x5'));var db=require(_0xea8b('0x6'))['db'];var utils=require(_0xea8b('0x7'));var logger=require(_0xea8b('0x8'))(_0xea8b('0x9'));var config=require(_0xea8b('0xa'));var jayson=require(_0xea8b('0xb'));var client=jayson[_0xea8b('0xc')][_0xea8b('0xd')]({'port':0x232a});config[_0xea8b('0xe')]=_[_0xea8b('0xf')](config['redis'],{'host':_0xea8b('0x10'),'port':0x18eb});var socket=require(_0xea8b('0x11'))(new Redis(config[_0xea8b('0xe')]));require(_0xea8b('0x12'))[_0xea8b('0x13')](socket);function respondWithRpcPromise(_0xa9dfa7,_0x4d714e,_0x3590d3){return new BPromise(function(_0x2c1647,_0x44182d){return client[_0xea8b('0x14')](_0xa9dfa7,_0x3590d3)['then'](function(_0x30e840){logger[_0xea8b('0x15')](_0xea8b('0x16'),_0x4d714e,_0xea8b('0x17'));logger[_0xea8b('0x18')](_0xea8b('0x19'),_0x4d714e,_0xea8b('0x17'),JSON[_0xea8b('0x1a')](_0x30e840));if(_0x30e840['error']){if(_0x30e840[_0xea8b('0x1b')][_0xea8b('0x1c')]===0x1f4){logger[_0xea8b('0x1b')](_0xea8b('0x16'),_0x4d714e,_0x30e840[_0xea8b('0x1b')][_0xea8b('0x1d')]);return _0x44182d(_0x30e840[_0xea8b('0x1b')]['message']);}logger[_0xea8b('0x1b')]('VoiceQueue,\x20%s,\x20%s',_0x4d714e,_0x30e840[_0xea8b('0x1b')][_0xea8b('0x1d')]);return _0x2c1647(_0x30e840[_0xea8b('0x1b')][_0xea8b('0x1d')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x4d714e,_0xea8b('0x17'));_0x2c1647(_0x30e840['result'][_0xea8b('0x1d')]);}})[_0xea8b('0x1e')](function(_0x32f5f3){logger[_0xea8b('0x1b')](_0xea8b('0x16'),_0x4d714e,_0x32f5f3);_0x44182d(_0x32f5f3);});});}exports['GetVoiceQueue']=function(_0x4b1751){var _0x157912=this;return new Promise(function(_0x39bd4a,_0x3b6d05){return db[_0xea8b('0x1f')][_0xea8b('0x20')]({'raw':_0x4b1751['options']?_0x4b1751['options'][_0xea8b('0x21')]===undefined?!![]:![]:!![],'where':_0x4b1751['options']?_0x4b1751[_0xea8b('0x22')][_0xea8b('0x23')]||null:null,'attributes':_0x4b1751['options']?_0x4b1751[_0xea8b('0x22')][_0xea8b('0x24')]||null:null,'limit':_0x4b1751[_0xea8b('0x22')]?_0x4b1751[_0xea8b('0x22')]['limit']||null:null,'include':_0x4b1751[_0xea8b('0x22')]?_0x4b1751['options'][_0xea8b('0x25')]?_[_0xea8b('0x26')](_0x4b1751['options']['include'],function(_0x241ccc){return{'model':db[_0x241ccc['model']],'as':_0x241ccc['as'],'attributes':_0x241ccc[_0xea8b('0x24')],'include':_0x241ccc[_0xea8b('0x25')]?_[_0xea8b('0x26')](_0x241ccc[_0xea8b('0x25')],function(_0x1c205b){return{'model':db[_0x1c205b[_0xea8b('0x27')]],'as':_0x1c205b['as'],'attributes':_0x1c205b[_0xea8b('0x24')],'include':_0x1c205b[_0xea8b('0x25')]?_[_0xea8b('0x26')](_0x1c205b[_0xea8b('0x25')],function(_0x3be3fc){return{'model':db[_0x3be3fc[_0xea8b('0x27')]],'as':_0x3be3fc['as'],'attributes':_0x3be3fc[_0xea8b('0x24')]};}):[]};}):[]};}):[]:[]})[_0xea8b('0x28')](function(_0x3b68ba){logger[_0xea8b('0x15')](_0xea8b('0x29'),_0x4b1751);logger[_0xea8b('0x18')](_0xea8b('0x29'),_0x4b1751,JSON[_0xea8b('0x1a')](_0x3b68ba));_0x39bd4a(_0x3b68ba);})[_0xea8b('0x1e')](function(_0x2b8f12){logger[_0xea8b('0x1b')](_0xea8b('0x29'),_0x2b8f12[_0xea8b('0x1d')],_0x4b1751);_0x3b6d05(_0x157912[_0xea8b('0x1b')](0x1f4,_0x2b8f12[_0xea8b('0x1d')]));});});};exports[_0xea8b('0x2a')]=function(_0x42cdd8){var _0x28618b=this;return new Promise(function(_0x47069f,_0x11e06f){return db[_0xea8b('0x1f')][_0xea8b('0x2b')]({'raw':_0x42cdd8[_0xea8b('0x22')]?_0x42cdd8[_0xea8b('0x22')][_0xea8b('0x21')]===undefined?!![]:![]:!![],'where':_0x42cdd8['options']?_0x42cdd8[_0xea8b('0x22')][_0xea8b('0x23')]||null:null,'attributes':_0x42cdd8[_0xea8b('0x22')]?_0x42cdd8[_0xea8b('0x22')]['attributes']||null:null,'include':_0x42cdd8[_0xea8b('0x22')]?_0x42cdd8[_0xea8b('0x22')]['include']?_[_0xea8b('0x26')](_0x42cdd8[_0xea8b('0x22')]['include'],function(_0x1904cc){return{'model':db[_0x1904cc[_0xea8b('0x27')]],'as':_0x1904cc['as'],'attributes':_0x1904cc[_0xea8b('0x24')],'include':_0x1904cc[_0xea8b('0x25')]?_[_0xea8b('0x26')](_0x1904cc[_0xea8b('0x25')],function(_0xe21c50){return{'model':db[_0xe21c50['model']],'as':_0xe21c50['as'],'attributes':_0xe21c50[_0xea8b('0x24')],'include':_0xe21c50['include']?_[_0xea8b('0x26')](_0xe21c50[_0xea8b('0x25')],function(_0x4c3bc4){return{'model':db[_0x4c3bc4[_0xea8b('0x27')]],'as':_0x4c3bc4['as'],'attributes':_0x4c3bc4[_0xea8b('0x24')]};}):[]};}):[]};}):[]:[]})[_0xea8b('0x28')](function(_0x8108d5){logger[_0xea8b('0x15')](_0xea8b('0x2a'),_0x42cdd8);logger['debug'](_0xea8b('0x2a'),_0x42cdd8,JSON['stringify'](_0x8108d5));_0x47069f(_0x8108d5);})[_0xea8b('0x1e')](function(_0x27ab61){logger[_0xea8b('0x1b')](_0xea8b('0x2a'),_0x27ab61[_0xea8b('0x1d')],_0x42cdd8);_0x11e06f(_0x28618b['error'](0x1f4,_0x27ab61['message']));});});}; \ No newline at end of file +var _0x6a24=['client','http','redis','defaults','localhost','socket.io-emitter','then','request\x20sent','debug','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueue','VoiceQueue','options','raw','attributes','limit','include','map','model','find','where','ShowVoiceQueue','lodash','util','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x575a16,_0x18eefa){var _0x298d59=function(_0x48dfa0){while(--_0x48dfa0){_0x575a16['push'](_0x575a16['shift']());}};_0x298d59(++_0x18eefa);}(_0x6a24,0x119));var _0x46a2=function(_0x5eeadb,_0x528c99){_0x5eeadb=_0x5eeadb-0x0;var _0x3d3044=_0x6a24[_0x5eeadb];return _0x3d3044;};'use strict';var _=require(_0x46a2('0x0'));var util=require(_0x46a2('0x1'));var moment=require('moment');var BPromise=require(_0x46a2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46a2('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x46a2('0x4'));var config=require(_0x46a2('0x5'));var jayson=require(_0x46a2('0x6'));var client=jayson[_0x46a2('0x7')][_0x46a2('0x8')]({'port':0x232a});config[_0x46a2('0x9')]=_[_0x46a2('0xa')](config[_0x46a2('0x9')],{'host':_0x46a2('0xb'),'port':0x18eb});var socket=require(_0x46a2('0xc'))(new Redis(config[_0x46a2('0x9')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x49206f,_0x26f614,_0x2a31ab){return new BPromise(function(_0x213002,_0x2b6815){return client['request'](_0x49206f,_0x2a31ab)[_0x46a2('0xd')](function(_0x5d4a71){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x26f614,_0x46a2('0xe'));logger[_0x46a2('0xf')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x26f614,'request\x20sent',JSON[_0x46a2('0x10')](_0x5d4a71));if(_0x5d4a71[_0x46a2('0x11')]){if(_0x5d4a71[_0x46a2('0x11')][_0x46a2('0x12')]===0x1f4){logger[_0x46a2('0x11')](_0x46a2('0x13'),_0x26f614,_0x5d4a71[_0x46a2('0x11')]['message']);return _0x2b6815(_0x5d4a71['error']['message']);}logger[_0x46a2('0x11')](_0x46a2('0x13'),_0x26f614,_0x5d4a71[_0x46a2('0x11')][_0x46a2('0x14')]);return _0x213002(_0x5d4a71[_0x46a2('0x11')]['message']);}else{logger[_0x46a2('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x26f614,_0x46a2('0xe'));_0x213002(_0x5d4a71[_0x46a2('0x16')][_0x46a2('0x14')]);}})[_0x46a2('0x17')](function(_0x131baf){logger[_0x46a2('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x26f614,_0x131baf);_0x2b6815(_0x131baf);});});}exports[_0x46a2('0x18')]=function(_0x555ee7){var _0x373e21=this;return new Promise(function(_0x401054,_0x3944a8){return db[_0x46a2('0x19')]['findAll']({'raw':_0x555ee7[_0x46a2('0x1a')]?_0x555ee7[_0x46a2('0x1a')][_0x46a2('0x1b')]===undefined?!![]:![]:!![],'where':_0x555ee7[_0x46a2('0x1a')]?_0x555ee7[_0x46a2('0x1a')]['where']||null:null,'attributes':_0x555ee7['options']?_0x555ee7['options'][_0x46a2('0x1c')]||null:null,'limit':_0x555ee7[_0x46a2('0x1a')]?_0x555ee7[_0x46a2('0x1a')][_0x46a2('0x1d')]||null:null,'include':_0x555ee7[_0x46a2('0x1a')]?_0x555ee7['options'][_0x46a2('0x1e')]?_[_0x46a2('0x1f')](_0x555ee7['options'][_0x46a2('0x1e')],function(_0x55c4e6){return{'model':db[_0x55c4e6[_0x46a2('0x20')]],'as':_0x55c4e6['as'],'attributes':_0x55c4e6[_0x46a2('0x1c')],'include':_0x55c4e6[_0x46a2('0x1e')]?_[_0x46a2('0x1f')](_0x55c4e6[_0x46a2('0x1e')],function(_0x53d13c){return{'model':db[_0x53d13c['model']],'as':_0x53d13c['as'],'attributes':_0x53d13c['attributes'],'include':_0x53d13c[_0x46a2('0x1e')]?_[_0x46a2('0x1f')](_0x53d13c[_0x46a2('0x1e')],function(_0x50dfb1){return{'model':db[_0x50dfb1['model']],'as':_0x50dfb1['as'],'attributes':_0x50dfb1[_0x46a2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x46a2('0xd')](function(_0x459633){logger['info'](_0x46a2('0x18'),_0x555ee7);logger[_0x46a2('0xf')](_0x46a2('0x18'),_0x555ee7,JSON[_0x46a2('0x10')](_0x459633));_0x401054(_0x459633);})[_0x46a2('0x17')](function(_0x3ac591){logger['error'](_0x46a2('0x18'),_0x3ac591[_0x46a2('0x14')],_0x555ee7);_0x3944a8(_0x373e21[_0x46a2('0x11')](0x1f4,_0x3ac591['message']));});});};exports['ShowVoiceQueue']=function(_0x3bc87f){var _0x789543=this;return new Promise(function(_0x49c937,_0x3ecad6){return db[_0x46a2('0x19')][_0x46a2('0x21')]({'raw':_0x3bc87f['options']?_0x3bc87f[_0x46a2('0x1a')][_0x46a2('0x1b')]===undefined?!![]:![]:!![],'where':_0x3bc87f[_0x46a2('0x1a')]?_0x3bc87f[_0x46a2('0x1a')][_0x46a2('0x22')]||null:null,'attributes':_0x3bc87f[_0x46a2('0x1a')]?_0x3bc87f[_0x46a2('0x1a')][_0x46a2('0x1c')]||null:null,'include':_0x3bc87f['options']?_0x3bc87f['options'][_0x46a2('0x1e')]?_[_0x46a2('0x1f')](_0x3bc87f[_0x46a2('0x1a')]['include'],function(_0x2a90f7){return{'model':db[_0x2a90f7[_0x46a2('0x20')]],'as':_0x2a90f7['as'],'attributes':_0x2a90f7[_0x46a2('0x1c')],'include':_0x2a90f7[_0x46a2('0x1e')]?_['map'](_0x2a90f7[_0x46a2('0x1e')],function(_0x2af873){return{'model':db[_0x2af873[_0x46a2('0x20')]],'as':_0x2af873['as'],'attributes':_0x2af873['attributes'],'include':_0x2af873[_0x46a2('0x1e')]?_['map'](_0x2af873[_0x46a2('0x1e')],function(_0x40e3c8){return{'model':db[_0x40e3c8[_0x46a2('0x20')]],'as':_0x40e3c8['as'],'attributes':_0x40e3c8['attributes']};}):[]};}):[]};}):[]:[]})[_0x46a2('0xd')](function(_0x195c72){logger[_0x46a2('0x15')](_0x46a2('0x23'),_0x3bc87f);logger[_0x46a2('0xf')](_0x46a2('0x23'),_0x3bc87f,JSON[_0x46a2('0x10')](_0x195c72));_0x49c937(_0x195c72);})[_0x46a2('0x17')](function(_0x32c25e){logger[_0x46a2('0x11')]('ShowVoiceQueue',_0x32c25e[_0x46a2('0x14')],_0x3bc87f);_0x3ecad6(_0x789543['error'](0x1f4,_0x32c25e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 6296888..51af5cd 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 _0xd7cd=['emit','removeListener','length','voiceQueue:','./voiceQueue.events','remove','update'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0xd7cd,0x66));var _0xdd7c=function(_0x542746,_0x397a90){_0x542746=_0x542746-0x0;var _0x4a8a6f=_0xd7cd[_0x542746];return _0x4a8a6f;};'use strict';var VoiceQueueEvents=require(_0xdd7c('0x0'));var events=['save',_0xdd7c('0x1'),_0xdd7c('0x2')];function createListener(_0x38966d,_0x5ca104){return function(_0x2cfbbe){_0x5ca104[_0xdd7c('0x3')](_0x38966d,_0x2cfbbe);};}function removeListener(_0x46b10d,_0x5e653b){return function(){VoiceQueueEvents[_0xdd7c('0x4')](_0x46b10d,_0x5e653b);};}exports['register']=function(_0x1fb2ce){for(var _0x276bab=0x0,_0x5a1c05=events[_0xdd7c('0x5')];_0x276bab<_0x5a1c05;_0x276bab++){var _0x206d0b=events[_0x276bab];var _0x5073fb=createListener(_0xdd7c('0x6')+_0x206d0b,_0x1fb2ce);VoiceQueueEvents['on'](_0x206d0b,_0x5073fb);}}; \ No newline at end of file +var _0xfb82=['register','length','voiceQueue:','./voiceQueue.events','remove','update','emit','removeListener'];(function(_0x5b4301,_0x517315){var _0x125da0=function(_0x2d63a6){while(--_0x2d63a6){_0x5b4301['push'](_0x5b4301['shift']());}};_0x125da0(++_0x517315);}(_0xfb82,0x1db));var _0x2fb8=function(_0x474bf6,_0x3bebc9){_0x474bf6=_0x474bf6-0x0;var _0x5376b6=_0xfb82[_0x474bf6];return _0x5376b6;};'use strict';var VoiceQueueEvents=require(_0x2fb8('0x0'));var events=['save',_0x2fb8('0x1'),_0x2fb8('0x2')];function createListener(_0x4ab589,_0xf0442e){return function(_0x34951d){_0xf0442e[_0x2fb8('0x3')](_0x4ab589,_0x34951d);};}function removeListener(_0x3878e4,_0x126e7d){return function(){VoiceQueueEvents[_0x2fb8('0x4')](_0x3878e4,_0x126e7d);};}exports[_0x2fb8('0x5')]=function(_0x255dd1){for(var _0x3ee505=0x0,_0x5d8665=events[_0x2fb8('0x6')];_0x3ee505<_0x5d8665;_0x3ee505++){var _0x52ecea=events[_0x3ee505];var _0x360008=createListener(_0x2fb8('0x7')+_0x52ecea,_0x255dd1);VoiceQueueEvents['on'](_0x52ecea,_0x360008);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index c296d7a..3cf99e9 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 _0x68b1=['index','/describe','/index','getVoiceQueuesReport','/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x42da05,_0x26dd4c){var _0x444709=function(_0x187a96){while(--_0x187a96){_0x42da05['push'](_0x42da05['shift']());}};_0x444709(++_0x26dd4c);}(_0x68b1,0x16b));var _0x168b=function(_0x30c106,_0x4eafa9){_0x30c106=_0x30c106-0x0;var _0xfbcc47=_0x68b1[_0x30c106];return _0xfbcc47;};'use strict';var multer=require(_0x168b('0x0'));var util=require(_0x168b('0x1'));var path=require(_0x168b('0x2'));var timeout=require(_0x168b('0x3'));var express=require(_0x168b('0x4'));var router=express['Router']();var fs_extra=require(_0x168b('0x5'));var auth=require(_0x168b('0x6'));var interaction=require(_0x168b('0x7'));var config=require(_0x168b('0x8'));var controller=require('./voiceQueueReport.controller');router[_0x168b('0x9')]('/',auth[_0x168b('0xa')](),controller[_0x168b('0xb')]);router[_0x168b('0x9')](_0x168b('0xc'),auth[_0x168b('0xa')](),controller['describe']);router[_0x168b('0x9')](_0x168b('0xd'),auth[_0x168b('0xa')](),controller[_0x168b('0xe')]);router[_0x168b('0x9')](_0x168b('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x168b('0x10')]('/',auth[_0x168b('0xa')](),controller[_0x168b('0x11')]);router[_0x168b('0x12')](_0x168b('0xf'),auth[_0x168b('0xa')](),controller[_0x168b('0x13')]);router[_0x168b('0x14')]('/:id',auth[_0x168b('0xa')](),controller['destroy']);module[_0x168b('0x15')]=router; \ No newline at end of file +var _0x04b9=['get','isAuthenticated','index','describe','/index','/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x04b9,0x174));var _0x904b=function(_0x30f164,_0x29c85c){_0x30f164=_0x30f164-0x0;var _0x10d9d1=_0x04b9[_0x30f164];return _0x10d9d1;};'use strict';var multer=require(_0x904b('0x0'));var util=require(_0x904b('0x1'));var path=require(_0x904b('0x2'));var timeout=require(_0x904b('0x3'));var express=require(_0x904b('0x4'));var router=express[_0x904b('0x5')]();var fs_extra=require(_0x904b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x904b('0x7'));var controller=require('./voiceQueueReport.controller');router[_0x904b('0x8')]('/',auth[_0x904b('0x9')](),controller[_0x904b('0xa')]);router['get']('/describe',auth[_0x904b('0x9')](),controller[_0x904b('0xb')]);router[_0x904b('0x8')](_0x904b('0xc'),auth[_0x904b('0x9')](),controller['getVoiceQueuesReport']);router['get'](_0x904b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x904b('0xe')]('/',auth[_0x904b('0x9')](),controller['create']);router[_0x904b('0xf')](_0x904b('0xd'),auth[_0x904b('0x9')](),controller[_0x904b('0x10')]);router[_0x904b('0x11')](_0x904b('0xd'),auth[_0x904b('0x9')](),controller[_0x904b('0x12')]);module[_0x904b('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index e4ea58a..0805886 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 _0x0369=['DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','STRING'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0369,0x1a2));var _0x9036=function(_0x313bf7,_0x3fb976){_0x313bf7=_0x313bf7-0x0;var _0x16e9fb=_0x0369[_0x313bf7];return _0x16e9fb;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9036('0x0'));module['exports']={'type':{'type':Sequelize[_0x9036('0x1')]},'uniqueid':{'type':Sequelize[_0x9036('0x1')]},'calleridnum':{'type':Sequelize[_0x9036('0x1')]},'calleridname':{'type':Sequelize[_0x9036('0x1')]},'queue':{'type':Sequelize[_0x9036('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x9036('0x2')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x36c7e4){var _0x584228=moment(_0x36c7e4);var _0x215887=moment(this[_0x9036('0x3')](_0x9036('0x4')))[_0x9036('0x5')](_0x9036('0x6'));var _0x5f4801=_0x584228[_0x9036('0x7')](_0x215887,'seconds');this[_0x9036('0x8')](_0x9036('0x9'),_0x36c7e4);this['setDataValue']('holdtime',_0x5f4801||null);}},'position':{'type':Sequelize[_0x9036('0xa')]},'count':{'type':Sequelize[_0x9036('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x9036('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9036('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x9036('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x9036('0x2')]},'queuecallerexit':{'type':Sequelize[_0x9036('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x9036('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x9036('0x1')],'comment':_0x9036('0xc')},'originalposition':{'type':Sequelize[_0x9036('0xa')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x9036('0x1')]},'accountcode':{'type':Sequelize[_0x9036('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x9036('0xa')]},'mohtime':{'type':Sequelize[_0x9036('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9036('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x9036('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9036('0x1')],'comment':_0x9036('0xd')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x9036('0x1')]},'disposition':{'type':Sequelize[_0x9036('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9036('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x9036('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc290=['format','YYYY-MM-DD\x20HH:mm:ss','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0xd6fcb5,_0x526523){var _0x278ac7=function(_0x3a9512){while(--_0x3a9512){_0xd6fcb5['push'](_0xd6fcb5['shift']());}};_0x278ac7(++_0x526523);}(_0xc290,0x19d));var _0x0c29=function(_0x482490,_0x1783f1){_0x482490=_0x482490-0x0;var _0xe33c42=_0xc290[_0x482490];return _0xe33c42;};'use strict';var Sequelize=require(_0x0c29('0x0'));var moment=require(_0x0c29('0x1'));module[_0x0c29('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0c29('0x3')]},'calleridnum':{'type':Sequelize[_0x0c29('0x3')]},'calleridname':{'type':Sequelize[_0x0c29('0x3')]},'queue':{'type':Sequelize[_0x0c29('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x0c29('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x0c29('0x4')],'set':function(_0x3126c0){var _0x149c13=moment(_0x3126c0);var _0x242353=moment(this[_0x0c29('0x5')](_0x0c29('0x6')))[_0x0c29('0x7')](_0x0c29('0x8'));var _0x222d44=_0x149c13['diff'](_0x242353,'seconds');this[_0x0c29('0x9')]('queuecallerleaveAt',_0x3126c0);this[_0x0c29('0x9')](_0x0c29('0xa'),_0x222d44||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x0c29('0xb')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x0c29('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x0c29('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x0c29('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x0c29('0x3')],'comment':_0x0c29('0xd')},'originalposition':{'type':Sequelize[_0x0c29('0xb')]},'channel':{'type':Sequelize[_0x0c29('0x3')]},'connectedlinenum':{'type':Sequelize[_0x0c29('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0c29('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x0c29('0x3')]},'priority':{'type':Sequelize[_0x0c29('0x3')]},'holdtime':{'type':Sequelize[_0x0c29('0xb')]},'mohtime':{'type':Sequelize[_0x0c29('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0c29('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0c29('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0c29('0x3')],'comment':_0x0c29('0xe')},'transferexten':{'type':Sequelize[_0x0c29('0x3')]},'transferuniqueid':{'type':Sequelize[_0x0c29('0x3')]},'disposition':{'type':Sequelize[_0x0c29('0x3')]},'secondDisposition':{'type':Sequelize[_0x0c29('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0c29('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 3b73b75..9cdd51d 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 _0x8230=['nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','describe','getVoiceQueuesReport','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','destroy','error','map','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','fields','length','hasOwnProperty'];(function(_0x1aa950,_0x497adc){var _0x1d28cf=function(_0x496111){while(--_0x496111){_0x1aa950['push'](_0x1aa950['shift']());}};_0x1d28cf(++_0x497adc);}(_0x8230,0x1eb));var _0x0823=function(_0x103f1b,_0x3dfcc6){_0x103f1b=_0x103f1b-0x0;var _0x18c758=_0x8230[_0x103f1b];return _0x18c758;};'use strict';var emlformat=require(_0x0823('0x0'));var rimraf=require(_0x0823('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0823('0x2'));var rp=require(_0x0823('0x3'));var moment=require('moment');var BPromise=require(_0x0823('0x4'));var Mustache=require(_0x0823('0x5'));var util=require('util');var path=require(_0x0823('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0823('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0823('0x8'));var squel=require('squel');var crypto=require(_0x0823('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0823('0xa'));var toCsv=require(_0x0823('0xb'));var querystring=require(_0x0823('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0823('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x0823('0xe'));var hardwareService=require(_0x0823('0xf'));var logger=require(_0x0823('0x10'))(_0x0823('0x11'));var utils=require(_0x0823('0x12'));var config=require(_0x0823('0x13'));var licenseUtil=require(_0x0823('0x14'));var db=require(_0x0823('0x15'))['db'];config['redis']=_[_0x0823('0x16')](config[_0x0823('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x0823('0x18'))(new Redis(config[_0x0823('0x17')]));require(_0x0823('0x19'))[_0x0823('0x1a')](socket);function respondWithStatusCode(_0x246044,_0x47e250){_0x47e250=_0x47e250||0xcc;return function(_0x1db68b){if(_0x1db68b){return _0x246044[_0x0823('0x1b')](_0x47e250);}return _0x246044[_0x0823('0x1c')](_0x47e250)[_0x0823('0x1d')]();};}function respondWithResult(_0x5911af,_0x520bda){_0x520bda=_0x520bda||0xc8;return function(_0x5e7832){if(_0x5e7832){return _0x5911af[_0x0823('0x1c')](_0x520bda)['json'](_0x5e7832);}};}function respondWithFilteredResult(_0x20a625,_0x4dcd68){return function(_0x2f2782){if(_0x2f2782){var _0x22d068=typeof _0x4dcd68[_0x0823('0x1e')]==='undefined'&&typeof _0x4dcd68['limit']===_0x0823('0x1f');var _0x52b852=_0x2f2782[_0x0823('0x20')];var _0x1fc91f=_0x22d068?0x0:_0x4dcd68['offset'];var _0x124c6c=_0x22d068?_0x2f2782[_0x0823('0x20')]:_0x4dcd68[_0x0823('0x1e')]+_0x4dcd68[_0x0823('0x21')];var _0xc5ff06;if(_0x124c6c>=_0x52b852){_0x124c6c=_0x52b852;_0xc5ff06=0xc8;}else{_0xc5ff06=0xce;}_0x20a625[_0x0823('0x1c')](_0xc5ff06);return _0x20a625[_0x0823('0x22')](_0x0823('0x23'),_0x1fc91f+'-'+_0x124c6c+'/'+_0x52b852)[_0x0823('0x24')](_0x2f2782);}return null;};}function patchUpdates(_0x43e862){return function(_0x2ce161){try{jsonpatch[_0x0823('0x25')](_0x2ce161,_0x43e862,!![]);}catch(_0x34301a){return BPromise['reject'](_0x34301a);}return _0x2ce161[_0x0823('0x26')]();};}function saveUpdates(_0x2873fa,_0x37d481){return function(_0x352f94){if(_0x352f94){return _0x352f94['update'](_0x2873fa)[_0x0823('0x27')](function(_0x3dec21){return _0x3dec21;});}return null;};}function removeEntity(_0x176ccc,_0x33d4e1){return function(_0x146819){if(_0x146819){return _0x146819[_0x0823('0x28')]()[_0x0823('0x27')](function(){_0x176ccc[_0x0823('0x1c')](0xcc)[_0x0823('0x1d')]();});}};}function handleEntityNotFound(_0x480dfe,_0x635b7f){return function(_0x1c9e1a){if(!_0x1c9e1a){_0x480dfe['sendStatus'](0x194);}return _0x1c9e1a;};}function handleError(_0x1cbe11,_0x1cfaef){_0x1cfaef=_0x1cfaef||0x1f4;return function(_0x204780){logger[_0x0823('0x29')](_0x204780['stack']);if(_0x204780['name']){delete _0x204780['name'];}_0x1cbe11[_0x0823('0x1c')](_0x1cfaef)['send'](_0x204780);};}exports['index']=function(_0x1f6544,_0x5a7c40){var _0x509515={},_0x1e5387={},_0xb67f1f={'count':0x0,'rows':[]};var _0x2770a4=_[_0x0823('0x2a')](db['VoiceQueueReport'][_0x0823('0x2b')],function(_0x542b6c){return{'name':_0x542b6c[_0x0823('0x2c')],'type':_0x542b6c['type'][_0x0823('0x2d')]};});_0x1e5387[_0x0823('0x2e')]=_[_0x0823('0x2a')](_0x2770a4,_0x0823('0x2f'));_0x1e5387[_0x0823('0x30')]=_[_0x0823('0x31')](_0x1f6544[_0x0823('0x30')]);_0x1e5387[_0x0823('0x32')]=_['intersection'](_0x1e5387[_0x0823('0x2e')],_0x1e5387[_0x0823('0x30')]);_0x509515[_0x0823('0x33')]=_['intersection'](_0x1e5387[_0x0823('0x2e')],qs[_0x0823('0x34')](_0x1f6544[_0x0823('0x30')][_0x0823('0x34')]));_0x509515[_0x0823('0x33')]=_0x509515[_0x0823('0x33')][_0x0823('0x35')]?_0x509515[_0x0823('0x33')]:_0x1e5387[_0x0823('0x2e')];if(!_0x1f6544['query'][_0x0823('0x36')](_0x0823('0x37'))){_0x509515[_0x0823('0x21')]=qs['limit'](_0x1f6544['query'][_0x0823('0x21')]);_0x509515['offset']=qs[_0x0823('0x1e')](_0x1f6544[_0x0823('0x30')][_0x0823('0x1e')]);}_0x509515[_0x0823('0x38')]=qs['sort'](_0x1f6544['query'][_0x0823('0x39')]);_0x509515['where']=qs[_0x0823('0x32')](_[_0x0823('0x3a')](_0x1f6544[_0x0823('0x30')],_0x1e5387[_0x0823('0x32')]),_0x2770a4);if(_0x1f6544[_0x0823('0x30')][_0x0823('0x3b')]){_0x509515['where']=_[_0x0823('0x3c')](_0x509515[_0x0823('0x3d')],{'$or':_['map'](_0x2770a4,function(_0x3a50bf){if(_0x3a50bf['type']!==_0x0823('0x3e')){var _0x29d2e5={};_0x29d2e5[_0x3a50bf['name']]={'$like':'%'+_0x1f6544['query'][_0x0823('0x3b')]+'%'};return _0x29d2e5;}})});}_0x509515=_[_0x0823('0x3c')]({},_0x509515,_0x1f6544[_0x0823('0x3f')]);var _0x41ebf3={'where':_0x509515['where']};return db[_0x0823('0x40')]['count'](_0x41ebf3)[_0x0823('0x27')](function(_0x2a4f7c){_0xb67f1f[_0x0823('0x20')]=_0x2a4f7c;if(_0x1f6544[_0x0823('0x30')][_0x0823('0x41')]){_0x509515[_0x0823('0x42')]=[{'all':!![]}];}return db[_0x0823('0x40')][_0x0823('0x43')](_0x509515);})[_0x0823('0x27')](function(_0x2ae48f){_0xb67f1f[_0x0823('0x44')]=_0x2ae48f;return _0xb67f1f;})[_0x0823('0x27')](respondWithFilteredResult(_0x5a7c40,_0x509515))[_0x0823('0x45')](handleError(_0x5a7c40,null));};exports[_0x0823('0x46')]=function(_0x392d1a,_0x3888af){var _0x45f143={'raw':![],'where':{'id':_0x392d1a[_0x0823('0x47')]['id']}},_0x1eee75={};_0x1eee75['model']=_[_0x0823('0x31')](db[_0x0823('0x40')][_0x0823('0x2b')]);_0x1eee75[_0x0823('0x30')]=_[_0x0823('0x31')](_0x392d1a['query']);_0x1eee75['filters']=_[_0x0823('0x48')](_0x1eee75[_0x0823('0x2e')],_0x1eee75['query']);_0x45f143[_0x0823('0x33')]=_['intersection'](_0x1eee75[_0x0823('0x2e')],qs[_0x0823('0x34')](_0x392d1a[_0x0823('0x30')]['fields']));_0x45f143[_0x0823('0x33')]=_0x45f143['attributes']['length']?_0x45f143[_0x0823('0x33')]:_0x1eee75[_0x0823('0x2e')];if(_0x392d1a[_0x0823('0x30')][_0x0823('0x41')]){_0x45f143[_0x0823('0x42')]=[{'all':!![]}];}_0x45f143=_['merge']({},_0x45f143,_0x392d1a[_0x0823('0x3f')]);return db['VoiceQueueReport'][_0x0823('0x49')](_0x45f143)[_0x0823('0x27')](handleEntityNotFound(_0x3888af,null))['then'](respondWithResult(_0x3888af,null))['catch'](handleError(_0x3888af,null));};exports['create']=function(_0x1bb02e,_0x3469e6){return db[_0x0823('0x40')][_0x0823('0x4a')](_0x1bb02e[_0x0823('0x4b')],{})[_0x0823('0x27')](respondWithResult(_0x3469e6,0xc9))[_0x0823('0x45')](handleError(_0x3469e6,null));};exports['update']=function(_0x574e7e,_0x1824af){if(_0x574e7e[_0x0823('0x4b')]['id']){delete _0x574e7e[_0x0823('0x4b')]['id'];}return db[_0x0823('0x40')][_0x0823('0x49')]({'where':{'id':_0x574e7e['params']['id']}})[_0x0823('0x27')](handleEntityNotFound(_0x1824af,null))[_0x0823('0x27')](saveUpdates(_0x574e7e[_0x0823('0x4b')],null))[_0x0823('0x27')](respondWithResult(_0x1824af,null))[_0x0823('0x45')](handleError(_0x1824af,null));};exports[_0x0823('0x28')]=function(_0x7b5b0,_0x489688){return db[_0x0823('0x40')][_0x0823('0x49')]({'where':{'id':_0x7b5b0[_0x0823('0x47')]['id']}})[_0x0823('0x27')](handleEntityNotFound(_0x489688,null))['then'](removeEntity(_0x489688,null))[_0x0823('0x45')](handleError(_0x489688,null));};exports[_0x0823('0x4c')]=function(_0x26dbc8,_0x473289){return db['VoiceQueueReport'][_0x0823('0x4c')]()[_0x0823('0x27')](respondWithResult(_0x473289,null))[_0x0823('0x45')](handleError(_0x473289,null));};exports[_0x0823('0x4d')]=function(_0x5962be,_0x540ed0){var _0x2b5338={},_0x730bd0={},_0x2021d6={'count':0x0,'rows':[]};_0x730bd0[_0x0823('0x2e')]=_[_0x0823('0x31')](db[_0x0823('0x40')][_0x0823('0x2b')]);_0x730bd0[_0x0823('0x30')]=_[_0x0823('0x31')](_0x5962be[_0x0823('0x30')]);_0x730bd0[_0x0823('0x32')]=_[_0x0823('0x48')](_0x730bd0[_0x0823('0x2e')],_0x730bd0[_0x0823('0x30')]);_0x2b5338[_0x0823('0x33')]=_[_0x0823('0x48')](_0x730bd0[_0x0823('0x2e')],qs['fields'](_0x5962be[_0x0823('0x30')][_0x0823('0x34')]));_0x2b5338[_0x0823('0x33')]=_0x2b5338[_0x0823('0x33')]['length']?_0x2b5338[_0x0823('0x33')]:_0x730bd0[_0x0823('0x2e')];if(!_0x5962be[_0x0823('0x30')]['hasOwnProperty'](_0x0823('0x37'))){_0x2b5338[_0x0823('0x21')]=qs[_0x0823('0x21')](_0x5962be[_0x0823('0x30')][_0x0823('0x21')]);_0x2b5338[_0x0823('0x1e')]=qs[_0x0823('0x1e')](_0x5962be[_0x0823('0x30')][_0x0823('0x1e')]);}_0x2b5338[_0x0823('0x38')]=qs[_0x0823('0x39')](_0x5962be[_0x0823('0x30')][_0x0823('0x39')]);_0x2b5338['where']=qs[_0x0823('0x32')](_['pick'](_0x5962be[_0x0823('0x30')],_0x730bd0[_0x0823('0x32')]));if(_0x5962be[_0x0823('0x30')][_0x0823('0x3b')]){_0x2b5338[_0x0823('0x3d')]=_[_0x0823('0x3c')](_0x2b5338[_0x0823('0x3d')],{'$or':_[_0x0823('0x2a')](_0x2b5338[_0x0823('0x33')],function(_0x1f1585){var _0x537d32={};_0x537d32[_0x1f1585]={'$like':'%'+_0x5962be[_0x0823('0x30')][_0x0823('0x3b')]+'%'};return _0x537d32;})});}_0x2b5338=_[_0x0823('0x3c')]({},_0x2b5338,_0x5962be[_0x0823('0x3f')]);var _0xd0351={'where':_0x2b5338[_0x0823('0x3d')]};return db[_0x0823('0x40')][_0x0823('0x20')](_0xd0351)['then'](function(_0x5d1088){_0x2021d6[_0x0823('0x20')]=_0x5d1088;if(_0x5962be['query']['includeAll']){_0x2b5338[_0x0823('0x42')]=[{'all':!![]}];}return db[_0x0823('0x40')][_0x0823('0x43')](_0x2b5338);})[_0x0823('0x27')](function(_0x8420d1){_0x2021d6[_0x0823('0x44')]=_0x8420d1;return _0x2021d6;})['then'](respondWithFilteredResult(_0x540ed0,_0x2b5338,_0x0823('0x4d')))[_0x0823('0x45')](handleError(_0x540ed0,null,_0x0823('0x4d')));}; \ No newline at end of file +var _0x2182=['create','body','describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','keys','find'];(function(_0x55baa3,_0xf30ed8){var _0x59798b=function(_0x4d1b8b){while(--_0x4d1b8b){_0x55baa3['push'](_0x55baa3['shift']());}};_0x59798b(++_0xf30ed8);}(_0x2182,0xfa));var _0x2218=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2182[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x2218('0x0'));var rimraf=require(_0x2218('0x1'));var zipdir=require(_0x2218('0x2'));var jsonpatch=require(_0x2218('0x3'));var rp=require(_0x2218('0x4'));var moment=require('moment');var BPromise=require(_0x2218('0x5'));var Mustache=require(_0x2218('0x6'));var util=require(_0x2218('0x7'));var path=require('path');var sox=require(_0x2218('0x8'));var csv=require(_0x2218('0x9'));var ejs=require(_0x2218('0xa'));var fs=require('fs');var fs_extra=require(_0x2218('0xb'));var _=require(_0x2218('0xc'));var squel=require(_0x2218('0xd'));var crypto=require(_0x2218('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2218('0xf'));var toCsv=require(_0x2218('0x9'));var querystring=require(_0x2218('0x10'));var Papa=require('papaparse');var Redis=require(_0x2218('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2218('0x12'));var logger=require(_0x2218('0x13'))(_0x2218('0x14'));var utils=require(_0x2218('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2218('0x16'));var db=require('../../mysqldb')['db'];config[_0x2218('0x17')]=_[_0x2218('0x18')](config[_0x2218('0x17')],{'host':_0x2218('0x19'),'port':0x18eb});var socket=require(_0x2218('0x1a'))(new Redis(config[_0x2218('0x17')]));require(_0x2218('0x1b'))[_0x2218('0x1c')](socket);function respondWithStatusCode(_0x829ccf,_0x48810e){_0x48810e=_0x48810e||0xcc;return function(_0x3695d0){if(_0x3695d0){return _0x829ccf[_0x2218('0x1d')](_0x48810e);}return _0x829ccf[_0x2218('0x1e')](_0x48810e)['end']();};}function respondWithResult(_0x22c9fc,_0x27359){_0x27359=_0x27359||0xc8;return function(_0x5868f1){if(_0x5868f1){return _0x22c9fc[_0x2218('0x1e')](_0x27359)[_0x2218('0x1f')](_0x5868f1);}};}function respondWithFilteredResult(_0x5a0b91,_0x13b4b9){return function(_0x56b3ce){if(_0x56b3ce){var _0x8ddba9=typeof _0x13b4b9[_0x2218('0x20')]===_0x2218('0x21')&&typeof _0x13b4b9[_0x2218('0x22')]==='undefined';var _0x3e3820=_0x56b3ce['count'];var _0x62deea=_0x8ddba9?0x0:_0x13b4b9['offset'];var _0x665b5b=_0x8ddba9?_0x56b3ce[_0x2218('0x23')]:_0x13b4b9[_0x2218('0x20')]+_0x13b4b9[_0x2218('0x22')];var _0x277608;if(_0x665b5b>=_0x3e3820){_0x665b5b=_0x3e3820;_0x277608=0xc8;}else{_0x277608=0xce;}_0x5a0b91[_0x2218('0x1e')](_0x277608);return _0x5a0b91[_0x2218('0x24')](_0x2218('0x25'),_0x62deea+'-'+_0x665b5b+'/'+_0x3e3820)[_0x2218('0x1f')](_0x56b3ce);}return null;};}function patchUpdates(_0xb66d1e){return function(_0x541a84){try{jsonpatch['apply'](_0x541a84,_0xb66d1e,!![]);}catch(_0x2675a5){return BPromise[_0x2218('0x26')](_0x2675a5);}return _0x541a84[_0x2218('0x27')]();};}function saveUpdates(_0x3d257a,_0x153b9b){return function(_0x56c295){if(_0x56c295){return _0x56c295[_0x2218('0x28')](_0x3d257a)[_0x2218('0x29')](function(_0x2d8eb2){return _0x2d8eb2;});}return null;};}function removeEntity(_0x56b471,_0x5f3ba8){return function(_0x23b406){if(_0x23b406){return _0x23b406[_0x2218('0x2a')]()[_0x2218('0x29')](function(){_0x56b471[_0x2218('0x1e')](0xcc)[_0x2218('0x2b')]();});}};}function handleEntityNotFound(_0x32c6a6,_0x399220){return function(_0x57528f){if(!_0x57528f){_0x32c6a6['sendStatus'](0x194);}return _0x57528f;};}function handleError(_0x3d116c,_0x4e5f5f){_0x4e5f5f=_0x4e5f5f||0x1f4;return function(_0x121b3d){logger['error'](_0x121b3d[_0x2218('0x2c')]);if(_0x121b3d['name']){delete _0x121b3d[_0x2218('0x2d')];}_0x3d116c['status'](_0x4e5f5f)[_0x2218('0x2e')](_0x121b3d);};}exports[_0x2218('0x2f')]=function(_0x326b7a,_0x504e14){var _0x570e91={},_0x81fa03={},_0x51e3cf={'count':0x0,'rows':[]};var _0x26e652=_['map'](db[_0x2218('0x30')][_0x2218('0x31')],function(_0x48db9c){return{'name':_0x48db9c[_0x2218('0x32')],'type':_0x48db9c[_0x2218('0x33')][_0x2218('0x34')]};});_0x81fa03[_0x2218('0x35')]=_[_0x2218('0x36')](_0x26e652,_0x2218('0x2d'));_0x81fa03[_0x2218('0x37')]=_['keys'](_0x326b7a[_0x2218('0x37')]);_0x81fa03[_0x2218('0x38')]=_['intersection'](_0x81fa03[_0x2218('0x35')],_0x81fa03[_0x2218('0x37')]);_0x570e91[_0x2218('0x39')]=_[_0x2218('0x3a')](_0x81fa03['model'],qs[_0x2218('0x3b')](_0x326b7a[_0x2218('0x37')][_0x2218('0x3b')]));_0x570e91[_0x2218('0x39')]=_0x570e91[_0x2218('0x39')][_0x2218('0x3c')]?_0x570e91[_0x2218('0x39')]:_0x81fa03[_0x2218('0x35')];if(!_0x326b7a[_0x2218('0x37')][_0x2218('0x3d')](_0x2218('0x3e'))){_0x570e91[_0x2218('0x22')]=qs[_0x2218('0x22')](_0x326b7a[_0x2218('0x37')][_0x2218('0x22')]);_0x570e91[_0x2218('0x20')]=qs[_0x2218('0x20')](_0x326b7a[_0x2218('0x37')][_0x2218('0x20')]);}_0x570e91[_0x2218('0x3f')]=qs[_0x2218('0x40')](_0x326b7a[_0x2218('0x37')]['sort']);_0x570e91['where']=qs['filters'](_[_0x2218('0x41')](_0x326b7a['query'],_0x81fa03[_0x2218('0x38')]),_0x26e652);if(_0x326b7a[_0x2218('0x37')][_0x2218('0x42')]){_0x570e91[_0x2218('0x43')]=_[_0x2218('0x44')](_0x570e91[_0x2218('0x43')],{'$or':_[_0x2218('0x36')](_0x26e652,function(_0x505212){if(_0x505212[_0x2218('0x33')]!=='VIRTUAL'){var _0x431e50={};_0x431e50[_0x505212[_0x2218('0x2d')]]={'$like':'%'+_0x326b7a[_0x2218('0x37')][_0x2218('0x42')]+'%'};return _0x431e50;}})});}_0x570e91=_['merge']({},_0x570e91,_0x326b7a[_0x2218('0x45')]);var _0x3b59a4={'where':_0x570e91[_0x2218('0x43')]};return db[_0x2218('0x30')][_0x2218('0x23')](_0x3b59a4)['then'](function(_0x1eb470){_0x51e3cf['count']=_0x1eb470;if(_0x326b7a[_0x2218('0x37')][_0x2218('0x46')]){_0x570e91[_0x2218('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x2218('0x48')](_0x570e91);})['then'](function(_0x5746fc){_0x51e3cf[_0x2218('0x49')]=_0x5746fc;return _0x51e3cf;})[_0x2218('0x29')](respondWithFilteredResult(_0x504e14,_0x570e91))[_0x2218('0x4a')](handleError(_0x504e14,null));};exports['show']=function(_0x52e06f,_0x235db5){var _0x374341={'raw':![],'where':{'id':_0x52e06f[_0x2218('0x4b')]['id']}},_0x510702={};_0x510702['model']=_[_0x2218('0x4c')](db[_0x2218('0x30')][_0x2218('0x31')]);_0x510702[_0x2218('0x37')]=_['keys'](_0x52e06f[_0x2218('0x37')]);_0x510702[_0x2218('0x38')]=_[_0x2218('0x3a')](_0x510702[_0x2218('0x35')],_0x510702[_0x2218('0x37')]);_0x374341[_0x2218('0x39')]=_[_0x2218('0x3a')](_0x510702[_0x2218('0x35')],qs[_0x2218('0x3b')](_0x52e06f[_0x2218('0x37')][_0x2218('0x3b')]));_0x374341[_0x2218('0x39')]=_0x374341[_0x2218('0x39')][_0x2218('0x3c')]?_0x374341['attributes']:_0x510702['model'];if(_0x52e06f[_0x2218('0x37')][_0x2218('0x46')]){_0x374341[_0x2218('0x47')]=[{'all':!![]}];}_0x374341=_[_0x2218('0x44')]({},_0x374341,_0x52e06f['options']);return db[_0x2218('0x30')][_0x2218('0x4d')](_0x374341)['then'](handleEntityNotFound(_0x235db5,null))[_0x2218('0x29')](respondWithResult(_0x235db5,null))['catch'](handleError(_0x235db5,null));};exports[_0x2218('0x4e')]=function(_0x25461e,_0x1fa902){return db[_0x2218('0x30')][_0x2218('0x4e')](_0x25461e[_0x2218('0x4f')],{})[_0x2218('0x29')](respondWithResult(_0x1fa902,0xc9))[_0x2218('0x4a')](handleError(_0x1fa902,null));};exports[_0x2218('0x28')]=function(_0x1fb98e,_0x3afb88){if(_0x1fb98e['body']['id']){delete _0x1fb98e['body']['id'];}return db[_0x2218('0x30')]['find']({'where':{'id':_0x1fb98e['params']['id']}})['then'](handleEntityNotFound(_0x3afb88,null))['then'](saveUpdates(_0x1fb98e[_0x2218('0x4f')],null))['then'](respondWithResult(_0x3afb88,null))['catch'](handleError(_0x3afb88,null));};exports[_0x2218('0x2a')]=function(_0x15ccb1,_0x155035){return db[_0x2218('0x30')]['find']({'where':{'id':_0x15ccb1['params']['id']}})['then'](handleEntityNotFound(_0x155035,null))['then'](removeEntity(_0x155035,null))['catch'](handleError(_0x155035,null));};exports[_0x2218('0x50')]=function(_0x5dbc6f,_0x4b7463){return db[_0x2218('0x30')][_0x2218('0x50')]()['then'](respondWithResult(_0x4b7463,null))[_0x2218('0x4a')](handleError(_0x4b7463,null));};exports[_0x2218('0x51')]=function(_0x576d24,_0x41de7a){var _0x4d2539={},_0x2a79c7={},_0x1c0933={'count':0x0,'rows':[]};_0x2a79c7[_0x2218('0x35')]=_[_0x2218('0x4c')](db[_0x2218('0x30')][_0x2218('0x31')]);_0x2a79c7[_0x2218('0x37')]=_[_0x2218('0x4c')](_0x576d24[_0x2218('0x37')]);_0x2a79c7[_0x2218('0x38')]=_[_0x2218('0x3a')](_0x2a79c7[_0x2218('0x35')],_0x2a79c7['query']);_0x4d2539[_0x2218('0x39')]=_['intersection'](_0x2a79c7[_0x2218('0x35')],qs[_0x2218('0x3b')](_0x576d24[_0x2218('0x37')][_0x2218('0x3b')]));_0x4d2539[_0x2218('0x39')]=_0x4d2539[_0x2218('0x39')][_0x2218('0x3c')]?_0x4d2539[_0x2218('0x39')]:_0x2a79c7[_0x2218('0x35')];if(!_0x576d24['query'][_0x2218('0x3d')]('nolimit')){_0x4d2539[_0x2218('0x22')]=qs[_0x2218('0x22')](_0x576d24['query'][_0x2218('0x22')]);_0x4d2539[_0x2218('0x20')]=qs[_0x2218('0x20')](_0x576d24[_0x2218('0x37')][_0x2218('0x20')]);}_0x4d2539['order']=qs[_0x2218('0x40')](_0x576d24[_0x2218('0x37')][_0x2218('0x40')]);_0x4d2539[_0x2218('0x43')]=qs['filters'](_[_0x2218('0x41')](_0x576d24['query'],_0x2a79c7[_0x2218('0x38')]));if(_0x576d24['query']['filter']){_0x4d2539[_0x2218('0x43')]=_[_0x2218('0x44')](_0x4d2539['where'],{'$or':_[_0x2218('0x36')](_0x4d2539[_0x2218('0x39')],function(_0x2a97de){var _0x2dfaed={};_0x2dfaed[_0x2a97de]={'$like':'%'+_0x576d24['query'][_0x2218('0x42')]+'%'};return _0x2dfaed;})});}_0x4d2539=_[_0x2218('0x44')]({},_0x4d2539,_0x576d24[_0x2218('0x45')]);var _0x38274b={'where':_0x4d2539[_0x2218('0x43')]};return db[_0x2218('0x30')][_0x2218('0x23')](_0x38274b)[_0x2218('0x29')](function(_0x317960){_0x1c0933[_0x2218('0x23')]=_0x317960;if(_0x576d24[_0x2218('0x37')][_0x2218('0x46')]){_0x4d2539[_0x2218('0x47')]=[{'all':!![]}];}return db[_0x2218('0x30')]['findAll'](_0x4d2539);})[_0x2218('0x29')](function(_0x1656c1){_0x1c0933[_0x2218('0x49')]=_0x1656c1;return _0x1c0933;})[_0x2218('0x29')](respondWithFilteredResult(_0x41de7a,_0x4d2539,_0x2218('0x51')))[_0x2218('0x4a')](handleError(_0x41de7a,null,_0x2218('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index d30f2bf..42f1501 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 _0x11a8=['update','remove','emit','hasOwnProperty','exports','VoiceQueueReport','save'];(function(_0x3f1511,_0x811452){var _0x3a46fd=function(_0x59e317){while(--_0x59e317){_0x3f1511['push'](_0x3f1511['shift']());}};_0x3a46fd(++_0x811452);}(_0x11a8,0x14e));var _0x811a=function(_0x573d18,_0x400530){_0x573d18=_0x573d18-0x0;var _0x278993=_0x11a8[_0x573d18];return _0x278993;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x811a('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x811a('0x1'),'afterUpdate':_0x811a('0x2'),'afterDestroy':_0x811a('0x3')};function emitEvent(_0x372da1){return function(_0x72e2df,_0x1600b5,_0x3a7137){VoiceQueueReportEvents[_0x811a('0x4')](_0x372da1+':'+_0x72e2df['id'],_0x72e2df);VoiceQueueReportEvents[_0x811a('0x4')](_0x372da1,_0x72e2df);_0x3a7137(null);};}for(var e in events){if(events[_0x811a('0x5')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x811a('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x84b1=['update','remove','emit','hasOwnProperty','exports','VoiceQueueReport','setMaxListeners','save'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0x84b1,0x1bd));var _0x184b=function(_0x3a325f,_0x2e812e){_0x3a325f=_0x3a325f-0x0;var _0x321e42=_0x84b1[_0x3a325f];return _0x321e42;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x184b('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x184b('0x1')](0x0);var events={'afterCreate':_0x184b('0x2'),'afterUpdate':_0x184b('0x3'),'afterDestroy':_0x184b('0x4')};function emitEvent(_0x5e95a1){return function(_0x5c752f,_0x2f9af5,_0xf0d428){VoiceQueueReportEvents[_0x184b('0x5')](_0x5e95a1+':'+_0x5c752f['id'],_0x5c752f);VoiceQueueReportEvents[_0x184b('0x5')](_0x5e95a1,_0x5c752f);_0xf0d428(null);};}for(var e in events){if(events[_0x184b('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x184b('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 69762c1..d13e50c 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 _0xcd88=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','calleridnum','util'];(function(_0x3bf4b2,_0x4fe774){var _0xe6e949=function(_0x3dbdec){while(--_0x3dbdec){_0x3bf4b2['push'](_0x3bf4b2['shift']());}};_0xe6e949(++_0x4fe774);}(_0xcd88,0x8e));var _0x8cd8=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xcd88[_0x47a349];return _0x18ab75;};'use strict';var _=require('lodash');var util=require(_0x8cd8('0x0'));var logger=require(_0x8cd8('0x1'))(_0x8cd8('0x2'));var moment=require('moment');var BPromise=require(_0x8cd8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8cd8('0x4'));var rimraf=require(_0x8cd8('0x5'));var config=require(_0x8cd8('0x6'));var attributes=require(_0x8cd8('0x7'));module[_0x8cd8('0x8')]=function(_0x2a3980,_0x45221c){return _0x2a3980[_0x8cd8('0x9')](_0x8cd8('0xa'),attributes,{'tableName':_0x8cd8('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x8cd8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc3ce=['../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','lodash','util','api','request-promise','path','rimraf'];(function(_0x47dae0,_0x4a5047){var _0x1f8329=function(_0x13bac8){while(--_0x13bac8){_0x47dae0['push'](_0x47dae0['shift']());}};_0x1f8329(++_0x4a5047);}(_0xc3ce,0x1e6));var _0xec3c=function(_0x3b596b,_0x432b43){_0x3b596b=_0x3b596b-0x0;var _0x5137dc=_0xc3ce[_0x3b596b];return _0x5137dc;};'use strict';var _=require(_0xec3c('0x0'));var util=require(_0xec3c('0x1'));var logger=require('../../config/logger')(_0xec3c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xec3c('0x3'));var fs=require('fs');var path=require(_0xec3c('0x4'));var rimraf=require(_0xec3c('0x5'));var config=require(_0xec3c('0x6'));var attributes=require(_0xec3c('0x7'));module[_0xec3c('0x8')]=function(_0x690646,_0x382f37){return _0x690646[_0xec3c('0x9')]('VoiceQueueReport',attributes,{'tableName':_0xec3c('0xa'),'paranoid':![],'indexes':[{'fields':[_0xec3c('0xb')]},{'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 b3d0c67..047d61e 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 _0x4c88=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','model','map','stringify','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','body','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x47766f,_0x43821b){var _0x456f42=function(_0x365ed5){while(--_0x365ed5){_0x47766f['push'](_0x47766f['shift']());}};_0x456f42(++_0x43821b);}(_0x4c88,0x1d3));var _0x84c8=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4c88[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x84c8('0x0'));var moment=require(_0x84c8('0x1'));var BPromise=require(_0x84c8('0x2'));var rs=require(_0x84c8('0x3'));var fs=require('fs');var Redis=require(_0x84c8('0x4'));var db=require(_0x84c8('0x5'))['db'];var utils=require(_0x84c8('0x6'));var logger=require(_0x84c8('0x7'))('rpc');var config=require(_0x84c8('0x8'));var jayson=require(_0x84c8('0x9'));var client=jayson[_0x84c8('0xa')][_0x84c8('0xb')]({'port':0x232a});config[_0x84c8('0xc')]=_[_0x84c8('0xd')](config[_0x84c8('0xc')],{'host':_0x84c8('0xe'),'port':0x18eb});var socket=require(_0x84c8('0xf'))(new Redis(config[_0x84c8('0xc')]));require(_0x84c8('0x10'))['register'](socket);function respondWithRpcPromise(_0xef7bac,_0x421025,_0x3d767e){return new BPromise(function(_0x4ad483,_0x3b19a1){return client['request'](_0xef7bac,_0x3d767e)[_0x84c8('0x11')](function(_0x44563a){logger[_0x84c8('0x12')](_0x84c8('0x13'),_0x421025,_0x84c8('0x14'));logger[_0x84c8('0x15')](_0x84c8('0x16'),_0x421025,'request\x20sent',JSON['stringify'](_0x44563a));if(_0x44563a[_0x84c8('0x17')]){if(_0x44563a[_0x84c8('0x17')][_0x84c8('0x18')]===0x1f4){logger['error'](_0x84c8('0x13'),_0x421025,_0x44563a[_0x84c8('0x17')][_0x84c8('0x19')]);return _0x3b19a1(_0x44563a['error'][_0x84c8('0x19')]);}logger['error'](_0x84c8('0x13'),_0x421025,_0x44563a['error']['message']);return _0x4ad483(_0x44563a[_0x84c8('0x17')][_0x84c8('0x19')]);}else{logger[_0x84c8('0x12')](_0x84c8('0x13'),_0x421025,_0x84c8('0x14'));_0x4ad483(_0x44563a[_0x84c8('0x1a')]['message']);}})[_0x84c8('0x1b')](function(_0xfc8801){logger[_0x84c8('0x17')](_0x84c8('0x13'),_0x421025,_0xfc8801);_0x3b19a1(_0xfc8801);});});}exports[_0x84c8('0x1c')]=function(_0xd91caa){var _0x33062b=this;return new Promise(function(_0x2d0399,_0x487925){return db[_0x84c8('0x1d')][_0x84c8('0x1e')]({'raw':_0xd91caa[_0x84c8('0x1f')]?_0xd91caa[_0x84c8('0x1f')][_0x84c8('0x20')]===undefined?!![]:![]:!![],'where':_0xd91caa[_0x84c8('0x1f')]?_0xd91caa['options']['where']||null:null,'attributes':_0xd91caa['options']?_0xd91caa['options'][_0x84c8('0x21')]||null:null,'limit':_0xd91caa[_0x84c8('0x1f')]?_0xd91caa[_0x84c8('0x1f')][_0x84c8('0x22')]||null:null,'include':_0xd91caa[_0x84c8('0x1f')]?_0xd91caa['options'][_0x84c8('0x23')]?_['map'](_0xd91caa['options'][_0x84c8('0x23')],function(_0x49446c){return{'model':db[_0x49446c[_0x84c8('0x24')]],'as':_0x49446c['as'],'attributes':_0x49446c[_0x84c8('0x21')],'include':_0x49446c[_0x84c8('0x23')]?_['map'](_0x49446c['include'],function(_0x358029){return{'model':db[_0x358029[_0x84c8('0x24')]],'as':_0x358029['as'],'attributes':_0x358029[_0x84c8('0x21')],'include':_0x358029[_0x84c8('0x23')]?_[_0x84c8('0x25')](_0x358029['include'],function(_0xc23bac){return{'model':db[_0xc23bac[_0x84c8('0x24')]],'as':_0xc23bac['as'],'attributes':_0xc23bac[_0x84c8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x84c8('0x11')](function(_0xa36caf){logger['info']('GetVoiceQueueReport',_0xd91caa);logger[_0x84c8('0x15')](_0x84c8('0x1c'),_0xd91caa,JSON[_0x84c8('0x26')](_0xa36caf));_0x2d0399(_0xa36caf);})['catch'](function(_0x2c081e){logger[_0x84c8('0x17')](_0x84c8('0x1c'),_0x2c081e[_0x84c8('0x19')],_0xd91caa);_0x487925(_0x33062b[_0x84c8('0x17')](0x1f4,_0x2c081e[_0x84c8('0x19')]));});});};exports[_0x84c8('0x27')]=function(_0x5a05e3){var _0x5a68a8=this;return new Promise(function(_0x9ec36f,_0x5d9513){return db['VoiceQueueReport'][_0x84c8('0x28')](_0x5a05e3['body'],{'raw':_0x5a05e3[_0x84c8('0x1f')]?_0x5a05e3['options']['raw']===undefined?!![]:![]:!![]})[_0x84c8('0x11')](function(_0x525778){logger[_0x84c8('0x12')](_0x84c8('0x27'),_0x5a05e3);logger[_0x84c8('0x15')](_0x84c8('0x27'),_0x5a05e3,JSON[_0x84c8('0x26')](_0x525778));_0x9ec36f(_0x525778);})[_0x84c8('0x1b')](function(_0xa4db2c){logger['error'](_0x84c8('0x27'),_0xa4db2c[_0x84c8('0x19')],_0x5a05e3);_0x5d9513(_0x5a68a8[_0x84c8('0x17')](0x1f4,_0xa4db2c[_0x84c8('0x19')]));});});};exports[_0x84c8('0x29')]=function(_0x539bae){var _0x572343=this;return new Promise(function(_0x3d264c,_0x479bd6){return db[_0x84c8('0x1d')]['update'](_0x539bae[_0x84c8('0x2a')],{'raw':_0x539bae['options']?_0x539bae[_0x84c8('0x1f')][_0x84c8('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x539bae[_0x84c8('0x1f')]?_0x539bae[_0x84c8('0x1f')]['where']||null:null,'attributes':_0x539bae['options']?_0x539bae[_0x84c8('0x1f')][_0x84c8('0x21')]||null:null,'limit':_0x539bae['options']?_0x539bae['options']['limit']||null:null})[_0x84c8('0x11')](function(_0x142eb8){logger[_0x84c8('0x12')](_0x84c8('0x29'),_0x539bae);logger['debug']('UpdateVoiceQueueReport',_0x539bae,JSON[_0x84c8('0x26')](_0x142eb8));_0x3d264c(_0x142eb8);})['catch'](function(_0x2e78ca){logger[_0x84c8('0x17')](_0x84c8('0x29'),_0x2e78ca['message'],_0x539bae);_0x479bd6(_0x572343[_0x84c8('0x17')](0x1f4,_0x2e78ca[_0x84c8('0x19')]));});});}; \ No newline at end of file +var _0xbbe6=['raw','update','body','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','map','model','include','stringify','CreateVoiceQueueReport','create'];(function(_0x4d2f1b,_0x47c10e){var _0x5d7abd=function(_0x530950){while(--_0x530950){_0x4d2f1b['push'](_0x4d2f1b['shift']());}};_0x5d7abd(++_0x47c10e);}(_0xbbe6,0x184));var _0x6bbe=function(_0x2717dd,_0x2d72e8){_0x2717dd=_0x2717dd-0x0;var _0x45f3f1=_0xbbe6[_0x2717dd];return _0x45f3f1;};'use strict';var _=require(_0x6bbe('0x0'));var util=require(_0x6bbe('0x1'));var moment=require(_0x6bbe('0x2'));var BPromise=require(_0x6bbe('0x3'));var rs=require(_0x6bbe('0x4'));var fs=require('fs');var Redis=require(_0x6bbe('0x5'));var db=require(_0x6bbe('0x6'))['db'];var utils=require(_0x6bbe('0x7'));var logger=require(_0x6bbe('0x8'))(_0x6bbe('0x9'));var config=require('../../config/environment');var jayson=require(_0x6bbe('0xa'));var client=jayson[_0x6bbe('0xb')][_0x6bbe('0xc')]({'port':0x232a});config['redis']=_[_0x6bbe('0xd')](config[_0x6bbe('0xe')],{'host':_0x6bbe('0xf'),'port':0x18eb});var socket=require(_0x6bbe('0x10'))(new Redis(config[_0x6bbe('0xe')]));require(_0x6bbe('0x11'))[_0x6bbe('0x12')](socket);function respondWithRpcPromise(_0x1f511d,_0x5e031f,_0x1e8130){return new BPromise(function(_0x23c7eb,_0x3f4f5b){return client[_0x6bbe('0x13')](_0x1f511d,_0x1e8130)[_0x6bbe('0x14')](function(_0x3a1f14){logger['info'](_0x6bbe('0x15'),_0x5e031f,_0x6bbe('0x16'));logger[_0x6bbe('0x17')](_0x6bbe('0x18'),_0x5e031f,'request\x20sent',JSON['stringify'](_0x3a1f14));if(_0x3a1f14['error']){if(_0x3a1f14[_0x6bbe('0x19')][_0x6bbe('0x1a')]===0x1f4){logger[_0x6bbe('0x19')](_0x6bbe('0x15'),_0x5e031f,_0x3a1f14[_0x6bbe('0x19')][_0x6bbe('0x1b')]);return _0x3f4f5b(_0x3a1f14[_0x6bbe('0x19')][_0x6bbe('0x1b')]);}logger['error'](_0x6bbe('0x15'),_0x5e031f,_0x3a1f14['error'][_0x6bbe('0x1b')]);return _0x23c7eb(_0x3a1f14[_0x6bbe('0x19')][_0x6bbe('0x1b')]);}else{logger[_0x6bbe('0x1c')](_0x6bbe('0x15'),_0x5e031f,_0x6bbe('0x16'));_0x23c7eb(_0x3a1f14[_0x6bbe('0x1d')][_0x6bbe('0x1b')]);}})[_0x6bbe('0x1e')](function(_0x368def){logger[_0x6bbe('0x19')](_0x6bbe('0x15'),_0x5e031f,_0x368def);_0x3f4f5b(_0x368def);});});}exports[_0x6bbe('0x1f')]=function(_0x27e587){var _0x371c7d=this;return new Promise(function(_0xc492df,_0x3a1122){return db[_0x6bbe('0x20')][_0x6bbe('0x21')]({'raw':_0x27e587['options']?_0x27e587[_0x6bbe('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x27e587[_0x6bbe('0x22')]?_0x27e587[_0x6bbe('0x22')][_0x6bbe('0x23')]||null:null,'attributes':_0x27e587[_0x6bbe('0x22')]?_0x27e587[_0x6bbe('0x22')][_0x6bbe('0x24')]||null:null,'limit':_0x27e587[_0x6bbe('0x22')]?_0x27e587[_0x6bbe('0x22')][_0x6bbe('0x25')]||null:null,'include':_0x27e587[_0x6bbe('0x22')]?_0x27e587[_0x6bbe('0x22')]['include']?_[_0x6bbe('0x26')](_0x27e587['options']['include'],function(_0x40e7fa){return{'model':db[_0x40e7fa[_0x6bbe('0x27')]],'as':_0x40e7fa['as'],'attributes':_0x40e7fa[_0x6bbe('0x24')],'include':_0x40e7fa[_0x6bbe('0x28')]?_['map'](_0x40e7fa[_0x6bbe('0x28')],function(_0x48e6c4){return{'model':db[_0x48e6c4[_0x6bbe('0x27')]],'as':_0x48e6c4['as'],'attributes':_0x48e6c4['attributes'],'include':_0x48e6c4[_0x6bbe('0x28')]?_['map'](_0x48e6c4[_0x6bbe('0x28')],function(_0x54cceb){return{'model':db[_0x54cceb[_0x6bbe('0x27')]],'as':_0x54cceb['as'],'attributes':_0x54cceb[_0x6bbe('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48c15e){logger[_0x6bbe('0x1c')](_0x6bbe('0x1f'),_0x27e587);logger['debug']('GetVoiceQueueReport',_0x27e587,JSON[_0x6bbe('0x29')](_0x48c15e));_0xc492df(_0x48c15e);})['catch'](function(_0x267a24){logger[_0x6bbe('0x19')]('GetVoiceQueueReport',_0x267a24[_0x6bbe('0x1b')],_0x27e587);_0x3a1122(_0x371c7d['error'](0x1f4,_0x267a24[_0x6bbe('0x1b')]));});});};exports[_0x6bbe('0x2a')]=function(_0x61befe){var _0x2a9aff=this;return new Promise(function(_0x5a2605,_0x4edebb){return db[_0x6bbe('0x20')][_0x6bbe('0x2b')](_0x61befe['body'],{'raw':_0x61befe[_0x6bbe('0x22')]?_0x61befe[_0x6bbe('0x22')][_0x6bbe('0x2c')]===undefined?!![]:![]:!![]})[_0x6bbe('0x14')](function(_0x55fbbc){logger['info'](_0x6bbe('0x2a'),_0x61befe);logger[_0x6bbe('0x17')](_0x6bbe('0x2a'),_0x61befe,JSON['stringify'](_0x55fbbc));_0x5a2605(_0x55fbbc);})['catch'](function(_0x4f1b81){logger['error'](_0x6bbe('0x2a'),_0x4f1b81[_0x6bbe('0x1b')],_0x61befe);_0x4edebb(_0x2a9aff['error'](0x1f4,_0x4f1b81[_0x6bbe('0x1b')]));});});};exports['UpdateVoiceQueueReport']=function(_0x487025){var _0xc1cee9=this;return new Promise(function(_0xba2810,_0x4480b7){return db[_0x6bbe('0x20')][_0x6bbe('0x2d')](_0x487025[_0x6bbe('0x2e')],{'raw':_0x487025['options']?_0x487025[_0x6bbe('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x487025[_0x6bbe('0x22')]?_0x487025['options'][_0x6bbe('0x23')]||null:null,'attributes':_0x487025[_0x6bbe('0x22')]?_0x487025[_0x6bbe('0x22')]['attributes']||null:null,'limit':_0x487025[_0x6bbe('0x22')]?_0x487025['options']['limit']||null:null})[_0x6bbe('0x14')](function(_0x5ccb8c){logger[_0x6bbe('0x1c')](_0x6bbe('0x2f'),_0x487025);logger[_0x6bbe('0x17')](_0x6bbe('0x2f'),_0x487025,JSON['stringify'](_0x5ccb8c));_0xba2810(_0x5ccb8c);})[_0x6bbe('0x1e')](function(_0x232e3b){logger['error']('UpdateVoiceQueueReport',_0x232e3b[_0x6bbe('0x1b')],_0x487025);_0x4480b7(_0xc1cee9['error'](0x1f4,_0x232e3b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 017d214..f52afc9 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.socket.js +++ b/server/api/voiceQueueReport/voiceQueueReport.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f29=['emit','removeListener','register','length','voiceQueueReport:','save','remove','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4f29,0xfd));var _0x94f2=function(_0x5926f9,_0x117691){_0x5926f9=_0x5926f9-0x0;var _0x4d554c=_0x4f29[_0x5926f9];return _0x4d554c;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x94f2('0x0'),_0x94f2('0x1'),_0x94f2('0x2')];function createListener(_0x2a6804,_0xc16ee3){return function(_0x36e06e){_0xc16ee3[_0x94f2('0x3')](_0x2a6804,_0x36e06e);};}function removeListener(_0x2a6535,_0x106798){return function(){VoiceQueueReportEvents[_0x94f2('0x4')](_0x2a6535,_0x106798);};}exports[_0x94f2('0x5')]=function(_0x493302){for(var _0x5e9216=0x0,_0xe14ba5=events[_0x94f2('0x6')];_0x5e9216<_0xe14ba5;_0x5e9216++){var _0x1d1910=events[_0x5e9216];var _0x224a93=createListener(_0x94f2('0x7')+_0x1d1910,_0x493302);VoiceQueueReportEvents['on'](_0x1d1910,_0x224a93);}}; \ No newline at end of file +var _0xdf67=['./voiceQueueReport.events','save','remove','update','emit','removeListener','register','length','voiceQueueReport:'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xdf67,0x117));var _0x7df6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf67[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceQueueReportEvents=require(_0x7df6('0x0'));var events=[_0x7df6('0x1'),_0x7df6('0x2'),_0x7df6('0x3')];function createListener(_0x542ab6,_0x298beb){return function(_0x3e1a4e){_0x298beb[_0x7df6('0x4')](_0x542ab6,_0x3e1a4e);};}function removeListener(_0xcafaf7,_0x292de5){return function(){VoiceQueueReportEvents[_0x7df6('0x5')](_0xcafaf7,_0x292de5);};}exports[_0x7df6('0x6')]=function(_0x679475){for(var _0x50cf74=0x0,_0x437fcd=events[_0x7df6('0x7')];_0x50cf74<_0x437fcd;_0x50cf74++){var _0x440354=events[_0x50cf74];var _0x4f1eab=createListener(_0x7df6('0x8')+_0x440354,_0x679475);VoiceQueueReportEvents['on'](_0x440354,_0x4f1eab);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 614c4ad..159eab3 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 _0x39b3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','connect-timeout','Router'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x39b3,0xc9));var _0x339b=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x39b3[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x339b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x339b('0x1'));var express=require('express');var router=express[_0x339b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x339b('0x3'));var interaction=require(_0x339b('0x4'));var config=require(_0x339b('0x5'));var controller=require(_0x339b('0x6'));router[_0x339b('0x7')]('/',auth[_0x339b('0x8')](),controller[_0x339b('0x9')]);router[_0x339b('0x7')](_0x339b('0xa'),auth[_0x339b('0x8')](),controller[_0x339b('0xb')]);router[_0x339b('0xc')]('/',auth[_0x339b('0x8')](),controller[_0x339b('0xd')]);router[_0x339b('0xe')](_0x339b('0xa'),auth[_0x339b('0x8')](),controller[_0x339b('0xf')]);router[_0x339b('0x10')](_0x339b('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x71e8=['./voiceQueuesLog.controller','get','isAuthenticated','show','post','put','/:id','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0x71e8,0x9f));var _0x871e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x71e8[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x871e('0x0'));var timeout=require(_0x871e('0x1'));var express=require(_0x871e('0x2'));var router=express[_0x871e('0x3')]();var fs_extra=require(_0x871e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x871e('0x5'));var controller=require(_0x871e('0x6'));router[_0x871e('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x871e('0x7')]('/:id',auth[_0x871e('0x8')](),controller[_0x871e('0x9')]);router[_0x871e('0xa')]('/',auth[_0x871e('0x8')](),controller['create']);router[_0x871e('0xb')]('/:id',auth[_0x871e('0x8')](),controller['update']);router['delete'](_0x871e('0xc'),auth[_0x871e('0x8')](),controller[_0x871e('0xd')]);module[_0x871e('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 96527b5..a53143e 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 _0x5957=['STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports'];(function(_0x21db84,_0x199888){var _0x2266c1=function(_0x579632){while(--_0x579632){_0x21db84['push'](_0x21db84['shift']());}};_0x2266c1(++_0x199888);}(_0x5957,0x193));var _0x7595=function(_0xcdf349,_0x410173){_0xcdf349=_0xcdf349-0x0;var _0x2a4868=_0x5957[_0xcdf349];return _0x2a4868;};'use strict';var Sequelize=require(_0x7595('0x0'));var moment=require('moment');module[_0x7595('0x1')]={'time':{'type':Sequelize[_0x7595('0x2')]},'callid':{'type':Sequelize[_0x7595('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x7595('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x7595('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x7595('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x7595('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x7595('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x7595('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x7595('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x7595('0x3')],'allowNull':![],'defaultValue':moment()['format'](_0x7595('0x4'))}}; \ No newline at end of file +var _0xbb93=['sequelize','exports','STRING','format'];(function(_0x545d4a,_0x5299ac){var _0x1d4555=function(_0x25c635){while(--_0x25c635){_0x545d4a['push'](_0x545d4a['shift']());}};_0x1d4555(++_0x5299ac);}(_0xbb93,0x120));var _0x3bb9=function(_0xe07dc3,_0xe6d0ac){_0xe07dc3=_0xe07dc3-0x0;var _0x40aed4=_0xbb93[_0xe07dc3];return _0x40aed4;};'use strict';var Sequelize=require(_0x3bb9('0x0'));var moment=require('moment');module[_0x3bb9('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x3bb9('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x3bb9('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x3bb9('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x3bb9('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x3bb9('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x3bb9('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x3bb9('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x3bb9('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x3bb9('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x3bb9('0x3')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 0d79166..6a3390e 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 _0xd1c9=['show','params','length','catch','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','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','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','end','stack','name','index','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','include'];(function(_0x576612,_0x505076){var _0x548707=function(_0xcd1860){while(--_0xcd1860){_0x576612['push'](_0x576612['shift']());}};_0x548707(++_0x505076);}(_0xd1c9,0xa0));var _0x9d1c=function(_0x4cfc35,_0xb52690){_0x4cfc35=_0x4cfc35-0x0;var _0x43a384=_0xd1c9[_0x4cfc35];return _0x43a384;};'use strict';var emlformat=require(_0x9d1c('0x0'));var rimraf=require(_0x9d1c('0x1'));var zipdir=require(_0x9d1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9d1c('0x3'));var moment=require('moment');var BPromise=require(_0x9d1c('0x4'));var Mustache=require(_0x9d1c('0x5'));var util=require(_0x9d1c('0x6'));var path=require(_0x9d1c('0x7'));var sox=require(_0x9d1c('0x8'));var csv=require('to-csv');var ejs=require(_0x9d1c('0x9'));var fs=require('fs');var fs_extra=require(_0x9d1c('0xa'));var _=require(_0x9d1c('0xb'));var squel=require(_0x9d1c('0xc'));var crypto=require(_0x9d1c('0xd'));var jsforce=require(_0x9d1c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9d1c('0xf'));var querystring=require(_0x9d1c('0x10'));var Papa=require(_0x9d1c('0x11'));var Redis=require(_0x9d1c('0x12'));var authService=require(_0x9d1c('0x13'));var qs=require(_0x9d1c('0x14'));var as=require(_0x9d1c('0x15'));var hardwareService=require(_0x9d1c('0x16'));var logger=require(_0x9d1c('0x17'))(_0x9d1c('0x18'));var utils=require(_0x9d1c('0x19'));var config=require(_0x9d1c('0x1a'));var licenseUtil=require(_0x9d1c('0x1b'));var db=require(_0x9d1c('0x1c'))['db'];function respondWithStatusCode(_0x32865f,_0x4d35be){_0x4d35be=_0x4d35be||0xcc;return function(_0x39fcd4){if(_0x39fcd4){return _0x32865f[_0x9d1c('0x1d')](_0x4d35be);}return _0x32865f['status'](_0x4d35be)['end']();};}function respondWithResult(_0x2b158d,_0x3f6fcf){_0x3f6fcf=_0x3f6fcf||0xc8;return function(_0x392df8){if(_0x392df8){return _0x2b158d[_0x9d1c('0x1e')](_0x3f6fcf)[_0x9d1c('0x1f')](_0x392df8);}};}function respondWithFilteredResult(_0x5a9ce8,_0xac173a){return function(_0xfffd7e){if(_0xfffd7e){var _0x4a4e21=typeof _0xac173a[_0x9d1c('0x20')]===_0x9d1c('0x21')&&typeof _0xac173a[_0x9d1c('0x22')]===_0x9d1c('0x21');var _0x441c13=_0xfffd7e[_0x9d1c('0x23')];var _0x70554c=_0x4a4e21?0x0:_0xac173a[_0x9d1c('0x20')];var _0x3f587=_0x4a4e21?_0xfffd7e[_0x9d1c('0x23')]:_0xac173a[_0x9d1c('0x20')]+_0xac173a['limit'];var _0x235252;if(_0x3f587>=_0x441c13){_0x3f587=_0x441c13;_0x235252=0xc8;}else{_0x235252=0xce;}_0x5a9ce8[_0x9d1c('0x1e')](_0x235252);return _0x5a9ce8[_0x9d1c('0x24')](_0x9d1c('0x25'),_0x70554c+'-'+_0x3f587+'/'+_0x441c13)[_0x9d1c('0x1f')](_0xfffd7e);}return null;};}function patchUpdates(_0x28968a){return function(_0x1d0d64){try{jsonpatch[_0x9d1c('0x26')](_0x1d0d64,_0x28968a,!![]);}catch(_0x52274b){return BPromise[_0x9d1c('0x27')](_0x52274b);}return _0x1d0d64[_0x9d1c('0x28')]();};}function saveUpdates(_0x338f39,_0xec2513){return function(_0x1b34a6){if(_0x1b34a6){return _0x1b34a6[_0x9d1c('0x29')](_0x338f39)[_0x9d1c('0x2a')](function(_0x5755a0){return _0x5755a0;});}return null;};}function removeEntity(_0x54f177,_0x1872ab){return function(_0x1dde6e){if(_0x1dde6e){return _0x1dde6e[_0x9d1c('0x2b')]()[_0x9d1c('0x2a')](function(){_0x54f177['status'](0xcc)[_0x9d1c('0x2c')]();});}};}function handleEntityNotFound(_0x15a4f5,_0x45bc3b){return function(_0x44be82){if(!_0x44be82){_0x15a4f5[_0x9d1c('0x1d')](0x194);}return _0x44be82;};}function handleError(_0x541987,_0x10b828){_0x10b828=_0x10b828||0x1f4;return function(_0x468c1d){logger['error'](_0x468c1d[_0x9d1c('0x2d')]);if(_0x468c1d[_0x9d1c('0x2e')]){delete _0x468c1d[_0x9d1c('0x2e')];}_0x541987[_0x9d1c('0x1e')](_0x10b828)['send'](_0x468c1d);};}exports[_0x9d1c('0x2f')]=function(_0x2b765f,_0x4887b1){var _0x46d31f={},_0x402cb2={},_0xd58c1d={'count':0x0,'rows':[]};var _0x11faa7=_[_0x9d1c('0x30')](db[_0x9d1c('0x31')][_0x9d1c('0x32')],function(_0x16c310){return{'name':_0x16c310[_0x9d1c('0x33')],'type':_0x16c310['type'][_0x9d1c('0x34')]};});_0x402cb2[_0x9d1c('0x35')]=_[_0x9d1c('0x30')](_0x11faa7,_0x9d1c('0x2e'));_0x402cb2[_0x9d1c('0x36')]=_[_0x9d1c('0x37')](_0x2b765f[_0x9d1c('0x36')]);_0x402cb2[_0x9d1c('0x38')]=_[_0x9d1c('0x39')](_0x402cb2[_0x9d1c('0x35')],_0x402cb2[_0x9d1c('0x36')]);_0x46d31f['attributes']=_[_0x9d1c('0x39')](_0x402cb2[_0x9d1c('0x35')],qs[_0x9d1c('0x3a')](_0x2b765f[_0x9d1c('0x36')][_0x9d1c('0x3a')]));_0x46d31f['attributes']=_0x46d31f['attributes']['length']?_0x46d31f[_0x9d1c('0x3b')]:_0x402cb2[_0x9d1c('0x35')];if(!_0x2b765f[_0x9d1c('0x36')]['hasOwnProperty'](_0x9d1c('0x3c'))){_0x46d31f[_0x9d1c('0x22')]=qs[_0x9d1c('0x22')](_0x2b765f['query']['limit']);_0x46d31f['offset']=qs[_0x9d1c('0x20')](_0x2b765f[_0x9d1c('0x36')][_0x9d1c('0x20')]);}_0x46d31f[_0x9d1c('0x3d')]=qs[_0x9d1c('0x3e')](_0x2b765f[_0x9d1c('0x36')][_0x9d1c('0x3e')]);_0x46d31f['where']=qs['filters'](_['pick'](_0x2b765f[_0x9d1c('0x36')],_0x402cb2[_0x9d1c('0x38')]),_0x11faa7);if(_0x2b765f[_0x9d1c('0x36')][_0x9d1c('0x3f')]){_0x46d31f[_0x9d1c('0x40')]=_['merge'](_0x46d31f[_0x9d1c('0x40')],{'$or':_[_0x9d1c('0x30')](_0x11faa7,function(_0x2f4967){if(_0x2f4967[_0x9d1c('0x41')]!==_0x9d1c('0x42')){var _0x173880={};_0x173880[_0x2f4967['name']]={'$like':'%'+_0x2b765f['query'][_0x9d1c('0x3f')]+'%'};return _0x173880;}})});}_0x46d31f=_[_0x9d1c('0x43')]({},_0x46d31f,_0x2b765f[_0x9d1c('0x44')]);var _0x159f45={'where':_0x46d31f[_0x9d1c('0x40')]};return db[_0x9d1c('0x31')][_0x9d1c('0x23')](_0x159f45)[_0x9d1c('0x2a')](function(_0x131dd8){_0xd58c1d[_0x9d1c('0x23')]=_0x131dd8;if(_0x2b765f[_0x9d1c('0x36')][_0x9d1c('0x45')]){_0x46d31f[_0x9d1c('0x46')]=[{'all':!![]}];}return db[_0x9d1c('0x31')]['findAll'](_0x46d31f);})[_0x9d1c('0x2a')](function(_0x2aefe8){_0xd58c1d['rows']=_0x2aefe8;return _0xd58c1d;})[_0x9d1c('0x2a')](respondWithFilteredResult(_0x4887b1,_0x46d31f))['catch'](handleError(_0x4887b1,null));};exports[_0x9d1c('0x47')]=function(_0x550b72,_0x35d12c){var _0x3d8607={'raw':!![],'where':{'id':_0x550b72[_0x9d1c('0x48')]['id']}},_0x1ff060={};_0x1ff060[_0x9d1c('0x35')]=_['keys'](db[_0x9d1c('0x31')][_0x9d1c('0x32')]);_0x1ff060[_0x9d1c('0x36')]=_[_0x9d1c('0x37')](_0x550b72['query']);_0x1ff060['filters']=_[_0x9d1c('0x39')](_0x1ff060['model'],_0x1ff060[_0x9d1c('0x36')]);_0x3d8607[_0x9d1c('0x3b')]=_['intersection'](_0x1ff060[_0x9d1c('0x35')],qs[_0x9d1c('0x3a')](_0x550b72[_0x9d1c('0x36')]['fields']));_0x3d8607[_0x9d1c('0x3b')]=_0x3d8607['attributes'][_0x9d1c('0x49')]?_0x3d8607[_0x9d1c('0x3b')]:_0x1ff060[_0x9d1c('0x35')];if(_0x550b72[_0x9d1c('0x36')][_0x9d1c('0x45')]){_0x3d8607[_0x9d1c('0x46')]=[{'all':!![]}];}_0x3d8607=_[_0x9d1c('0x43')]({},_0x3d8607,_0x550b72[_0x9d1c('0x44')]);return db[_0x9d1c('0x31')]['find'](_0x3d8607)[_0x9d1c('0x2a')](handleEntityNotFound(_0x35d12c,null))['then'](respondWithResult(_0x35d12c,null))[_0x9d1c('0x4a')](handleError(_0x35d12c,null));};exports['create']=function(_0x52cbb8,_0x5d1498){return db[_0x9d1c('0x31')]['create'](_0x52cbb8[_0x9d1c('0x4b')],{})[_0x9d1c('0x2a')](respondWithResult(_0x5d1498,0xc9))['catch'](handleError(_0x5d1498,null));};exports[_0x9d1c('0x29')]=function(_0x35e13d,_0x5b9c85){if(_0x35e13d[_0x9d1c('0x4b')]['id']){delete _0x35e13d['body']['id'];}return db[_0x9d1c('0x31')][_0x9d1c('0x4c')]({'where':{'id':_0x35e13d[_0x9d1c('0x48')]['id']}})['then'](handleEntityNotFound(_0x5b9c85,null))[_0x9d1c('0x2a')](saveUpdates(_0x35e13d[_0x9d1c('0x4b')],null))[_0x9d1c('0x2a')](respondWithResult(_0x5b9c85,null))[_0x9d1c('0x4a')](handleError(_0x5b9c85,null));};exports[_0x9d1c('0x2b')]=function(_0x38cef8,_0x36828f){return db[_0x9d1c('0x31')][_0x9d1c('0x4c')]({'where':{'id':_0x38cef8[_0x9d1c('0x48')]['id']}})['then'](handleEntityNotFound(_0x36828f,null))[_0x9d1c('0x2a')](removeEntity(_0x36828f,null))['catch'](handleError(_0x36828f,null));}; \ No newline at end of file +var _0x65b6=['status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','create','body','update','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x11a0c3,_0x5a2c9e){var _0x500a0c=function(_0x298daf){while(--_0x298daf){_0x11a0c3['push'](_0x11a0c3['shift']());}};_0x500a0c(++_0x5a2c9e);}(_0x65b6,0x108));var _0x665b=function(_0x406134,_0x41e277){_0x406134=_0x406134-0x0;var _0x36bd34=_0x65b6[_0x406134];return _0x36bd34;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x665b('0x0'));var zipdir=require(_0x665b('0x1'));var jsonpatch=require(_0x665b('0x2'));var rp=require(_0x665b('0x3'));var moment=require(_0x665b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x665b('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x665b('0x6'));var ejs=require(_0x665b('0x7'));var fs=require('fs');var fs_extra=require(_0x665b('0x8'));var _=require(_0x665b('0x9'));var squel=require(_0x665b('0xa'));var crypto=require(_0x665b('0xb'));var jsforce=require(_0x665b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x665b('0x6'));var querystring=require(_0x665b('0xd'));var Papa=require(_0x665b('0xe'));var Redis=require(_0x665b('0xf'));var authService=require(_0x665b('0x10'));var qs=require(_0x665b('0x11'));var as=require(_0x665b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x665b('0x13'))('api');var utils=require(_0x665b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x665b('0x15'));var db=require(_0x665b('0x16'))['db'];function respondWithStatusCode(_0x3ee13a,_0x1bd325){_0x1bd325=_0x1bd325||0xcc;return function(_0x42661b){if(_0x42661b){return _0x3ee13a[_0x665b('0x17')](_0x1bd325);}return _0x3ee13a[_0x665b('0x18')](_0x1bd325)[_0x665b('0x19')]();};}function respondWithResult(_0x59c236,_0x44f72e){_0x44f72e=_0x44f72e||0xc8;return function(_0x56122e){if(_0x56122e){return _0x59c236[_0x665b('0x18')](_0x44f72e)[_0x665b('0x1a')](_0x56122e);}};}function respondWithFilteredResult(_0x5361db,_0x331686){return function(_0x18437d){if(_0x18437d){var _0x1ac9e1=typeof _0x331686[_0x665b('0x1b')]==='undefined'&&typeof _0x331686[_0x665b('0x1c')]==='undefined';var _0x330383=_0x18437d['count'];var _0x4c66af=_0x1ac9e1?0x0:_0x331686[_0x665b('0x1b')];var _0xa3b966=_0x1ac9e1?_0x18437d[_0x665b('0x1d')]:_0x331686[_0x665b('0x1b')]+_0x331686[_0x665b('0x1c')];var _0x4764a7;if(_0xa3b966>=_0x330383){_0xa3b966=_0x330383;_0x4764a7=0xc8;}else{_0x4764a7=0xce;}_0x5361db[_0x665b('0x18')](_0x4764a7);return _0x5361db[_0x665b('0x1e')](_0x665b('0x1f'),_0x4c66af+'-'+_0xa3b966+'/'+_0x330383)[_0x665b('0x1a')](_0x18437d);}return null;};}function patchUpdates(_0x3643a5){return function(_0x17efc9){try{jsonpatch[_0x665b('0x20')](_0x17efc9,_0x3643a5,!![]);}catch(_0x4fdf94){return BPromise[_0x665b('0x21')](_0x4fdf94);}return _0x17efc9[_0x665b('0x22')]();};}function saveUpdates(_0x23fc43,_0x5df7ff){return function(_0x5acdfc){if(_0x5acdfc){return _0x5acdfc['update'](_0x23fc43)['then'](function(_0x5436ed){return _0x5436ed;});}return null;};}function removeEntity(_0x39fe5a,_0x26a82d){return function(_0x14f4ae){if(_0x14f4ae){return _0x14f4ae[_0x665b('0x23')]()[_0x665b('0x24')](function(){_0x39fe5a['status'](0xcc)[_0x665b('0x19')]();});}};}function handleEntityNotFound(_0x29e9e4,_0x351877){return function(_0x353622){if(!_0x353622){_0x29e9e4['sendStatus'](0x194);}return _0x353622;};}function handleError(_0x4f6fde,_0x2db454){_0x2db454=_0x2db454||0x1f4;return function(_0xfb849a){logger[_0x665b('0x25')](_0xfb849a[_0x665b('0x26')]);if(_0xfb849a[_0x665b('0x27')]){delete _0xfb849a[_0x665b('0x27')];}_0x4f6fde[_0x665b('0x18')](_0x2db454)[_0x665b('0x28')](_0xfb849a);};}exports[_0x665b('0x29')]=function(_0x5bc0fa,_0x10f2a9){var _0x5e180f={},_0x1b7cff={},_0x2ee1a1={'count':0x0,'rows':[]};var _0x53bb48=_[_0x665b('0x2a')](db[_0x665b('0x2b')][_0x665b('0x2c')],function(_0x16e93c){return{'name':_0x16e93c[_0x665b('0x2d')],'type':_0x16e93c[_0x665b('0x2e')][_0x665b('0x2f')]};});_0x1b7cff[_0x665b('0x30')]=_[_0x665b('0x2a')](_0x53bb48,_0x665b('0x27'));_0x1b7cff[_0x665b('0x31')]=_[_0x665b('0x32')](_0x5bc0fa[_0x665b('0x31')]);_0x1b7cff[_0x665b('0x33')]=_[_0x665b('0x34')](_0x1b7cff[_0x665b('0x30')],_0x1b7cff['query']);_0x5e180f[_0x665b('0x35')]=_['intersection'](_0x1b7cff[_0x665b('0x30')],qs[_0x665b('0x36')](_0x5bc0fa['query'][_0x665b('0x36')]));_0x5e180f['attributes']=_0x5e180f[_0x665b('0x35')][_0x665b('0x37')]?_0x5e180f[_0x665b('0x35')]:_0x1b7cff[_0x665b('0x30')];if(!_0x5bc0fa['query']['hasOwnProperty']('nolimit')){_0x5e180f[_0x665b('0x1c')]=qs[_0x665b('0x1c')](_0x5bc0fa[_0x665b('0x31')][_0x665b('0x1c')]);_0x5e180f['offset']=qs[_0x665b('0x1b')](_0x5bc0fa[_0x665b('0x31')][_0x665b('0x1b')]);}_0x5e180f['order']=qs[_0x665b('0x38')](_0x5bc0fa[_0x665b('0x31')]['sort']);_0x5e180f[_0x665b('0x39')]=qs[_0x665b('0x33')](_[_0x665b('0x3a')](_0x5bc0fa[_0x665b('0x31')],_0x1b7cff['filters']),_0x53bb48);if(_0x5bc0fa[_0x665b('0x31')][_0x665b('0x3b')]){_0x5e180f[_0x665b('0x39')]=_[_0x665b('0x3c')](_0x5e180f[_0x665b('0x39')],{'$or':_[_0x665b('0x2a')](_0x53bb48,function(_0x55150c){if(_0x55150c[_0x665b('0x2e')]!=='VIRTUAL'){var _0x3d9c34={};_0x3d9c34[_0x55150c[_0x665b('0x27')]]={'$like':'%'+_0x5bc0fa[_0x665b('0x31')][_0x665b('0x3b')]+'%'};return _0x3d9c34;}})});}_0x5e180f=_[_0x665b('0x3c')]({},_0x5e180f,_0x5bc0fa[_0x665b('0x3d')]);var _0x514356={'where':_0x5e180f[_0x665b('0x39')]};return db['VoiceQueuesLog'][_0x665b('0x1d')](_0x514356)[_0x665b('0x24')](function(_0x3436a8){_0x2ee1a1['count']=_0x3436a8;if(_0x5bc0fa[_0x665b('0x31')][_0x665b('0x3e')]){_0x5e180f[_0x665b('0x3f')]=[{'all':!![]}];}return db[_0x665b('0x2b')][_0x665b('0x40')](_0x5e180f);})[_0x665b('0x24')](function(_0x2b0e92){_0x2ee1a1['rows']=_0x2b0e92;return _0x2ee1a1;})[_0x665b('0x24')](respondWithFilteredResult(_0x10f2a9,_0x5e180f))[_0x665b('0x41')](handleError(_0x10f2a9,null));};exports[_0x665b('0x42')]=function(_0x20188f,_0x40858c){var _0x35a650={'raw':!![],'where':{'id':_0x20188f[_0x665b('0x43')]['id']}},_0x38acf8={};_0x38acf8[_0x665b('0x30')]=_['keys'](db['VoiceQueuesLog'][_0x665b('0x2c')]);_0x38acf8[_0x665b('0x31')]=_[_0x665b('0x32')](_0x20188f[_0x665b('0x31')]);_0x38acf8[_0x665b('0x33')]=_['intersection'](_0x38acf8[_0x665b('0x30')],_0x38acf8['query']);_0x35a650[_0x665b('0x35')]=_[_0x665b('0x34')](_0x38acf8[_0x665b('0x30')],qs[_0x665b('0x36')](_0x20188f['query'][_0x665b('0x36')]));_0x35a650[_0x665b('0x35')]=_0x35a650['attributes'][_0x665b('0x37')]?_0x35a650[_0x665b('0x35')]:_0x38acf8['model'];if(_0x20188f[_0x665b('0x31')][_0x665b('0x3e')]){_0x35a650[_0x665b('0x3f')]=[{'all':!![]}];}_0x35a650=_[_0x665b('0x3c')]({},_0x35a650,_0x20188f[_0x665b('0x3d')]);return db[_0x665b('0x2b')]['find'](_0x35a650)[_0x665b('0x24')](handleEntityNotFound(_0x40858c,null))[_0x665b('0x24')](respondWithResult(_0x40858c,null))[_0x665b('0x41')](handleError(_0x40858c,null));};exports[_0x665b('0x44')]=function(_0x2e8f90,_0x13f4c2){return db[_0x665b('0x2b')]['create'](_0x2e8f90[_0x665b('0x45')],{})[_0x665b('0x24')](respondWithResult(_0x13f4c2,0xc9))[_0x665b('0x41')](handleError(_0x13f4c2,null));};exports[_0x665b('0x46')]=function(_0x54ac93,_0x39173a){if(_0x54ac93[_0x665b('0x45')]['id']){delete _0x54ac93[_0x665b('0x45')]['id'];}return db[_0x665b('0x2b')][_0x665b('0x47')]({'where':{'id':_0x54ac93[_0x665b('0x43')]['id']}})['then'](handleEntityNotFound(_0x39173a,null))['then'](saveUpdates(_0x54ac93[_0x665b('0x45')],null))[_0x665b('0x24')](respondWithResult(_0x39173a,null))[_0x665b('0x41')](handleError(_0x39173a,null));};exports[_0x665b('0x23')]=function(_0x3eb373,_0x117ea4){return db[_0x665b('0x2b')][_0x665b('0x47')]({'where':{'id':_0x3eb373[_0x665b('0x43')]['id']}})[_0x665b('0x24')](handleEntityNotFound(_0x117ea4,null))['then'](removeEntity(_0x117ea4,null))[_0x665b('0x41')](handleError(_0x117ea4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 10cc5b5..0914b2f 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 _0x3b34=['request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x50a6f5,_0x5530dc){var _0x5c18c4=function(_0x279eea){while(--_0x279eea){_0x50a6f5['push'](_0x50a6f5['shift']());}};_0x5c18c4(++_0x5530dc);}(_0x3b34,0x108));var _0x43b3=function(_0x49a25c,_0x26a0eb){_0x49a25c=_0x49a25c-0x0;var _0x3277a7=_0x3b34[_0x49a25c];return _0x3277a7;};'use strict';var _=require(_0x43b3('0x0'));var util=require(_0x43b3('0x1'));var logger=require(_0x43b3('0x2'))(_0x43b3('0x3'));var moment=require(_0x43b3('0x4'));var BPromise=require(_0x43b3('0x5'));var rp=require(_0x43b3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x43b3('0x7'));var config=require(_0x43b3('0x8'));var attributes=require(_0x43b3('0x9'));module[_0x43b3('0xa')]=function(_0x90a4b8,_0x3cc021){return _0x90a4b8['define'](_0x43b3('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x43b3('0xc'),'fields':[_0x43b3('0xd'),_0x43b3('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a6f=['moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a6f,0x148));var _0xf7a6=function(_0x355182,_0x3b232d){_0x355182=_0x355182-0x0;var _0x4ed0ed=_0x7a6f[_0x355182];return _0x4ed0ed;};'use strict';var _=require(_0xf7a6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf7a6('0x1'));var moment=require(_0xf7a6('0x2'));var BPromise=require(_0xf7a6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf7a6('0x4'));var rimraf=require(_0xf7a6('0x5'));var config=require(_0xf7a6('0x6'));var attributes=require(_0xf7a6('0x7'));module[_0xf7a6('0x8')]=function(_0x31c8a4,_0x24d394){return _0x31c8a4[_0xf7a6('0x9')](_0xf7a6('0xa'),attributes,{'tableName':_0xf7a6('0xb'),'paranoid':![],'indexes':[{'name':_0xf7a6('0xc'),'fields':[_0xf7a6('0xd'),_0xf7a6('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index da5be23..a48a1f4 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 _0xac52=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x562c29,_0x3851f3){var _0x3041c9=function(_0x28d88b){while(--_0x28d88b){_0x562c29['push'](_0x562c29['shift']());}};_0x3041c9(++_0x3851f3);}(_0xac52,0x122));var _0x2ac5=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xac52[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require('lodash');var util=require(_0x2ac5('0x0'));var moment=require(_0x2ac5('0x1'));var BPromise=require(_0x2ac5('0x2'));var rs=require(_0x2ac5('0x3'));var fs=require('fs');var Redis=require(_0x2ac5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ac5('0x5'));var logger=require(_0x2ac5('0x6'))('rpc');var config=require(_0x2ac5('0x7'));var jayson=require(_0x2ac5('0x8'));var client=jayson[_0x2ac5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54a8ed,_0x433d88,_0x197aed){return new BPromise(function(_0x1ff724,_0x3fc8b5){return client[_0x2ac5('0xa')](_0x54a8ed,_0x197aed)[_0x2ac5('0xb')](function(_0x22f28b){logger[_0x2ac5('0xc')](_0x2ac5('0xd'),_0x433d88,_0x2ac5('0xe'));logger['debug'](_0x2ac5('0xf'),_0x433d88,_0x2ac5('0xe'),JSON[_0x2ac5('0x10')](_0x22f28b));if(_0x22f28b[_0x2ac5('0x11')]){if(_0x22f28b['error']['code']===0x1f4){logger['error'](_0x2ac5('0xd'),_0x433d88,_0x22f28b[_0x2ac5('0x11')][_0x2ac5('0x12')]);return _0x3fc8b5(_0x22f28b[_0x2ac5('0x11')][_0x2ac5('0x12')]);}logger['error'](_0x2ac5('0xd'),_0x433d88,_0x22f28b['error'][_0x2ac5('0x12')]);return _0x1ff724(_0x22f28b[_0x2ac5('0x11')][_0x2ac5('0x12')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x433d88,_0x2ac5('0xe'));_0x1ff724(_0x22f28b[_0x2ac5('0x13')][_0x2ac5('0x12')]);}})[_0x2ac5('0x14')](function(_0x1741ce){logger[_0x2ac5('0x11')](_0x2ac5('0xd'),_0x433d88,_0x1741ce);_0x3fc8b5(_0x1741ce);});});} \ No newline at end of file +var _0x6697=['client','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','VoiceQueuesLog,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x265003,_0xf0f023){var _0x33c743=function(_0x326a5d){while(--_0x326a5d){_0x265003['push'](_0x265003['shift']());}};_0x33c743(++_0xf0f023);}(_0x6697,0x1c3));var _0x7669=function(_0x403235,_0x514e29){_0x403235=_0x403235-0x0;var _0x429cf8=_0x6697[_0x403235];return _0x429cf8;};'use strict';var _=require(_0x7669('0x0'));var util=require(_0x7669('0x1'));var moment=require(_0x7669('0x2'));var BPromise=require(_0x7669('0x3'));var rs=require(_0x7669('0x4'));var fs=require('fs');var Redis=require(_0x7669('0x5'));var db=require(_0x7669('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7669('0x7'))(_0x7669('0x8'));var config=require(_0x7669('0x9'));var jayson=require(_0x7669('0xa'));var client=jayson[_0x7669('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a8d64,_0x4765ba,_0x23e080){return new BPromise(function(_0x40a096,_0x2721c1){return client[_0x7669('0xc')](_0x2a8d64,_0x23e080)[_0x7669('0xd')](function(_0x8348ea){logger[_0x7669('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4765ba,_0x7669('0xf'));logger[_0x7669('0x10')](_0x7669('0x11'),_0x4765ba,_0x7669('0xf'),JSON['stringify'](_0x8348ea));if(_0x8348ea[_0x7669('0x12')]){if(_0x8348ea[_0x7669('0x12')]['code']===0x1f4){logger['error'](_0x7669('0x13'),_0x4765ba,_0x8348ea[_0x7669('0x12')]['message']);return _0x2721c1(_0x8348ea['error'][_0x7669('0x14')]);}logger['error'](_0x7669('0x13'),_0x4765ba,_0x8348ea[_0x7669('0x12')]['message']);return _0x40a096(_0x8348ea['error'][_0x7669('0x14')]);}else{logger[_0x7669('0xe')](_0x7669('0x13'),_0x4765ba,_0x7669('0xf'));_0x40a096(_0x8348ea['result']['message']);}})[_0x7669('0x15')](function(_0x548b14){logger[_0x7669('0x12')](_0x7669('0x13'),_0x4765ba,_0x548b14);_0x2721c1(_0x548b14);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 67068f3..eebacc2 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 _0x84f6=['/:id/transcribe','post','create','runTranscribe','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','isAuthenticated','get','show','/:id/download','/:id/downloads','downloads'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x84f6,0x104));var _0x684f=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x84f6[_0x257642];return _0x3d813b;};'use strict';var multer=require('multer');var util=require(_0x684f('0x0'));var path=require(_0x684f('0x1'));var timeout=require(_0x684f('0x2'));var express=require(_0x684f('0x3'));var router=express[_0x684f('0x4')]();var fs_extra=require(_0x684f('0x5'));var auth=require(_0x684f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x684f('0x7'));var controller=require(_0x684f('0x8'));router['get']('/',auth[_0x684f('0x9')](),controller['index']);router[_0x684f('0xa')]('/describe',auth[_0x684f('0x9')](),controller['describe']);router[_0x684f('0xa')]('/:id',auth[_0x684f('0x9')](),controller[_0x684f('0xb')]);router['get'](_0x684f('0xc'),auth[_0x684f('0x9')](),controller['download']);router['get'](_0x684f('0xd'),controller[_0x684f('0xe')]);router[_0x684f('0xa')](_0x684f('0xf'),auth[_0x684f('0x9')](),controller['downloadTranscribe']);router[_0x684f('0x10')]('/',auth[_0x684f('0x9')](),controller[_0x684f('0x11')]);router['post'](_0x684f('0xf'),auth[_0x684f('0x9')](),controller[_0x684f('0x12')]);router[_0x684f('0x13')](_0x684f('0x14'),auth[_0x684f('0x9')](),controller[_0x684f('0x15')]);router[_0x684f('0x16')](_0x684f('0x14'),auth[_0x684f('0x9')](),controller[_0x684f('0x17')]);module[_0x684f('0x18')]=router; \ No newline at end of file +var _0xbb30=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','/describe','/:id','/:id/download','download','get','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','destroy','util','path','express','Router'];(function(_0x52029b,_0x4508d7){var _0x36b941=function(_0x50b52c){while(--_0x50b52c){_0x52029b['push'](_0x52029b['shift']());}};_0x36b941(++_0x4508d7);}(_0xbb30,0x1c4));var _0x0bb3=function(_0xe83633,_0x6caca9){_0xe83633=_0xe83633-0x0;var _0x3c570d=_0xbb30[_0xe83633];return _0x3c570d;};'use strict';var multer=require('multer');var util=require(_0x0bb3('0x0'));var path=require(_0x0bb3('0x1'));var timeout=require('connect-timeout');var express=require(_0x0bb3('0x2'));var router=express[_0x0bb3('0x3')]();var fs_extra=require(_0x0bb3('0x4'));var auth=require(_0x0bb3('0x5'));var interaction=require(_0x0bb3('0x6'));var config=require(_0x0bb3('0x7'));var controller=require(_0x0bb3('0x8'));router['get']('/',auth[_0x0bb3('0x9')](),controller['index']);router['get'](_0x0bb3('0xa'),auth[_0x0bb3('0x9')](),controller['describe']);router['get'](_0x0bb3('0xb'),auth[_0x0bb3('0x9')](),controller['show']);router['get'](_0x0bb3('0xc'),auth['isAuthenticated'](),controller[_0x0bb3('0xd')]);router[_0x0bb3('0xe')]('/:id/downloads',controller[_0x0bb3('0xf')]);router[_0x0bb3('0xe')](_0x0bb3('0x10'),auth[_0x0bb3('0x9')](),controller[_0x0bb3('0x11')]);router[_0x0bb3('0x12')]('/',auth[_0x0bb3('0x9')](),controller['create']);router[_0x0bb3('0x12')](_0x0bb3('0x10'),auth['isAuthenticated'](),controller[_0x0bb3('0x13')]);router[_0x0bb3('0x14')](_0x0bb3('0xb'),auth['isAuthenticated'](),controller[_0x0bb3('0x15')]);router[_0x0bb3('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x0bb3('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 8297756..9ffa5d8 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(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 4dcff8c..2fc3f18 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 _0x0461=['catch','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','filename','extname','unlink','message','downloads','sequelize','MD5','col','token','$and','push','format','Sequelize','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Buckets','bucket','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','IN_PROGRESS','tempSentiment','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','differenceBy','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','options','includeAll','findAll','rows','params','include','merge','find'];(function(_0x2de253,_0x38747b){var _0xa1d3b0=function(_0x32a251){while(--_0x32a251){_0x2de253['push'](_0x2de253['shift']());}};_0xa1d3b0(++_0x38747b);}(_0x0461,0xea));var _0x1046=function(_0x1afb31,_0x5cfcb8){_0x1afb31=_0x1afb31-0x0;var _0x336468=_0x0461[_0x1afb31];return _0x336468;};'use strict';var emlformat=require(_0x1046('0x0'));var rimraf=require(_0x1046('0x1'));var zipdir=require(_0x1046('0x2'));var jsonpatch=require(_0x1046('0x3'));var rp=require('request-promise');var moment=require(_0x1046('0x4'));var BPromise=require(_0x1046('0x5'));var Mustache=require(_0x1046('0x6'));var util=require(_0x1046('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1046('0x8'));var ejs=require(_0x1046('0x9'));var fs=require('fs');var fs_extra=require(_0x1046('0xa'));var _=require(_0x1046('0xb'));var squel=require(_0x1046('0xc'));var crypto=require(_0x1046('0xd'));var jsforce=require(_0x1046('0xe'));var deskjs=require(_0x1046('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1046('0x10'));var Papa=require(_0x1046('0x11'));var AWS=require(_0x1046('0x12'));var uuidv4=require(_0x1046('0x13'));var Redis=require(_0x1046('0x14'));var authService=require(_0x1046('0x15'));var qs=require(_0x1046('0x16'));var as=require(_0x1046('0x17'));var hardwareService=require(_0x1046('0x18'));var logger=require('../../config/logger')(_0x1046('0x19'));var utils=require(_0x1046('0x1a'));var config=require(_0x1046('0x1b'));var licenseUtil=require(_0x1046('0x1c'));var db=require(_0x1046('0x1d'))['db'];function respondWithStatusCode(_0x3cf193,_0x43bb96){_0x43bb96=_0x43bb96||0xcc;return function(_0x232f28){if(_0x232f28){return _0x3cf193['sendStatus'](_0x43bb96);}return _0x3cf193[_0x1046('0x1e')](_0x43bb96)['end']();};}function respondWithResult(_0xdc727c,_0x273cfd){_0x273cfd=_0x273cfd||0xc8;return function(_0x51efe5){if(_0x51efe5){return _0xdc727c['status'](_0x273cfd)[_0x1046('0x1f')](_0x51efe5);}};}function respondWithFilteredResult(_0x376231,_0x49a907){return function(_0x18a411){if(_0x18a411){var _0x26e72f=typeof _0x49a907[_0x1046('0x20')]===_0x1046('0x21')&&typeof _0x49a907[_0x1046('0x22')]===_0x1046('0x21');var _0x32b5bc=_0x18a411[_0x1046('0x23')];var _0x2c3468=_0x26e72f?0x0:_0x49a907[_0x1046('0x20')];var _0xd1ca21=_0x26e72f?_0x18a411['count']:_0x49a907[_0x1046('0x20')]+_0x49a907[_0x1046('0x22')];var _0x26435e;if(_0xd1ca21>=_0x32b5bc){_0xd1ca21=_0x32b5bc;_0x26435e=0xc8;}else{_0x26435e=0xce;}_0x376231[_0x1046('0x1e')](_0x26435e);return _0x376231['set'](_0x1046('0x24'),_0x2c3468+'-'+_0xd1ca21+'/'+_0x32b5bc)[_0x1046('0x1f')](_0x18a411);}return null;};}function patchUpdates(_0x34b635){return function(_0xe1acca){try{jsonpatch[_0x1046('0x25')](_0xe1acca,_0x34b635,!![]);}catch(_0x54f52f){return BPromise[_0x1046('0x26')](_0x54f52f);}return _0xe1acca['save']();};}function saveUpdates(_0x1cb30a,_0x14e829){return function(_0x5cc249){if(_0x5cc249){return _0x5cc249[_0x1046('0x27')](_0x1cb30a)[_0x1046('0x28')](function(_0x2ff261){return _0x2ff261;});}return null;};}function removeEntity(_0x49021d,_0x2b24be){return function(_0x27956c){if(_0x27956c){return _0x27956c[_0x1046('0x29')]()[_0x1046('0x28')](function(){_0x49021d[_0x1046('0x1e')](0xcc)[_0x1046('0x2a')]();});}};}function handleEntityNotFound(_0x17f47f,_0x5e8d25){return function(_0xab6e38){if(!_0xab6e38){_0x17f47f[_0x1046('0x2b')](0x194);}return _0xab6e38;};}function handleError(_0x4ddf8a,_0x3fdb2f){_0x3fdb2f=_0x3fdb2f||0x1f4;return function(_0x489ddc){logger[_0x1046('0x2c')](_0x489ddc[_0x1046('0x2d')]);if(_0x489ddc[_0x1046('0x2e')]){delete _0x489ddc['name'];}_0x4ddf8a[_0x1046('0x1e')](_0x3fdb2f)[_0x1046('0x2f')](_0x489ddc);};}exports[_0x1046('0x30')]=function(_0x16e690,_0x2e6925){var _0x247704={},_0x4f9260={},_0x325769={'count':0x0,'rows':[]};var _0x20b0f0=_[_0x1046('0x31')](db[_0x1046('0x32')][_0x1046('0x33')],function(_0xc56a9e){return{'name':_0xc56a9e[_0x1046('0x34')],'type':_0xc56a9e['type']['key']};});_0x4f9260['model']=_[_0x1046('0x35')](_[_0x1046('0x31')](_0x20b0f0,_0x1046('0x2e')),['format']);_0x4f9260[_0x1046('0x36')]=_[_0x1046('0x37')](_0x16e690[_0x1046('0x36')]);_0x4f9260[_0x1046('0x38')]=_[_0x1046('0x39')](_0x4f9260['model'],_0x4f9260[_0x1046('0x36')]);_0x247704[_0x1046('0x3a')]=_[_0x1046('0x39')](_0x4f9260['model'],qs[_0x1046('0x3b')](_0x16e690[_0x1046('0x36')]['fields']));_0x247704['attributes']=_0x247704[_0x1046('0x3a')][_0x1046('0x3c')]?_0x247704[_0x1046('0x3a')]:_0x4f9260[_0x1046('0x3d')];if(!_0x16e690[_0x1046('0x36')][_0x1046('0x3e')](_0x1046('0x3f'))){_0x247704['limit']=qs[_0x1046('0x22')](_0x16e690[_0x1046('0x36')]['limit']);_0x247704[_0x1046('0x20')]=qs['offset'](_0x16e690[_0x1046('0x36')]['offset']);}_0x247704[_0x1046('0x40')]=qs['sort'](_0x16e690['query'][_0x1046('0x41')]);_0x247704[_0x1046('0x42')]=qs[_0x1046('0x38')](_[_0x1046('0x43')](_0x16e690[_0x1046('0x36')],_0x4f9260['filters']),_0x20b0f0);if(_0x16e690['query']['filter']){_0x247704[_0x1046('0x42')]=_['merge'](_0x247704[_0x1046('0x42')],{'$or':_[_0x1046('0x31')](_0x20b0f0,function(_0x2d4a55){if(_0x2d4a55[_0x1046('0x44')]!==_0x1046('0x45')){var _0x31ff65={};_0x31ff65[_0x2d4a55[_0x1046('0x2e')]]={'$like':'%'+_0x16e690[_0x1046('0x36')]['filter']+'%'};return _0x31ff65;}})});}_0x247704=_['merge']({},_0x247704,_0x16e690[_0x1046('0x46')]);var _0x5bc03b={'where':_0x247704['where']};return db['VoiceRecording'][_0x1046('0x23')](_0x5bc03b)['then'](function(_0x2f9269){_0x325769['count']=_0x2f9269;if(_0x16e690['query'][_0x1046('0x47')]){_0x247704['include']=[{'all':!![]}];}return db[_0x1046('0x32')][_0x1046('0x48')](_0x247704);})[_0x1046('0x28')](function(_0x5baf5b){_0x325769[_0x1046('0x49')]=_0x5baf5b;return _0x325769;})[_0x1046('0x28')](respondWithFilteredResult(_0x2e6925,_0x247704))['catch'](handleError(_0x2e6925,null));};exports['show']=function(_0x364ddf,_0x1b71bd){var _0x1877c4={'raw':![],'where':{'id':_0x364ddf[_0x1046('0x4a')]['id']}},_0x2ce13d={};_0x2ce13d['model']=_[_0x1046('0x37')](db[_0x1046('0x32')]['rawAttributes']);_0x2ce13d[_0x1046('0x36')]=_[_0x1046('0x37')](_0x364ddf[_0x1046('0x36')]);_0x2ce13d[_0x1046('0x38')]=_[_0x1046('0x39')](_0x2ce13d[_0x1046('0x3d')],_0x2ce13d['query']);_0x1877c4[_0x1046('0x3a')]=_['intersection'](_0x2ce13d[_0x1046('0x3d')],qs['fields'](_0x364ddf[_0x1046('0x36')][_0x1046('0x3b')]));_0x1877c4[_0x1046('0x3a')]=_0x1877c4[_0x1046('0x3a')][_0x1046('0x3c')]?_0x1877c4[_0x1046('0x3a')]:_0x2ce13d['model'];if(_0x364ddf[_0x1046('0x36')][_0x1046('0x47')]){_0x1877c4[_0x1046('0x4b')]=[{'all':!![]}];}_0x1877c4=_[_0x1046('0x4c')]({},_0x1877c4,_0x364ddf[_0x1046('0x46')]);return db[_0x1046('0x32')][_0x1046('0x4d')](_0x1877c4)[_0x1046('0x28')](handleEntityNotFound(_0x1b71bd,null))[_0x1046('0x28')](respondWithResult(_0x1b71bd,null))[_0x1046('0x4e')](handleError(_0x1b71bd,null));};exports['create']=function(_0x305f5d,_0x3c01ab){return db[_0x1046('0x32')][_0x1046('0x4f')](_0x305f5d[_0x1046('0x50')],{})['then'](respondWithResult(_0x3c01ab,0xc9))[_0x1046('0x4e')](handleError(_0x3c01ab,null));};exports[_0x1046('0x27')]=function(_0x5cb86d,_0x7378c7){if(_0x5cb86d[_0x1046('0x50')]['id']){delete _0x5cb86d[_0x1046('0x50')]['id'];}return db[_0x1046('0x32')]['find']({'where':{'id':_0x5cb86d['params']['id']}})[_0x1046('0x28')](handleEntityNotFound(_0x7378c7,null))[_0x1046('0x28')](saveUpdates(_0x5cb86d['body'],null))[_0x1046('0x28')](respondWithResult(_0x7378c7,null))[_0x1046('0x4e')](handleError(_0x7378c7,null));};exports[_0x1046('0x51')]=function(_0x2d8fb2,_0xeff6a5){return db[_0x1046('0x32')][_0x1046('0x51')]()[_0x1046('0x28')](respondWithResult(_0xeff6a5,null))[_0x1046('0x4e')](handleError(_0xeff6a5,null));};exports[_0x1046('0x52')]=function(_0x4ce214,_0x2e61c9,_0x20d365){var _0x335b8a=require(_0x1046('0x53'));var _0x35f694=![];var _0x401e1a={};if(_0x4ce214[_0x1046('0x36')][_0x1046('0x44')]&&_0x4ce214[_0x1046('0x36')][_0x1046('0x44')]===_0x1046('0x54')){_0x401e1a[_0x1046('0x54')]=_0x4ce214[_0x1046('0x4a')]['id'];}else{_0x401e1a['id']=_0x4ce214[_0x1046('0x4a')]['id'];}return db[_0x1046('0x32')][_0x1046('0x4d')]({'where':_0x401e1a,'attributes':['id','value'],'raw':!![]})[_0x1046('0x28')](handleEntityNotFound(_0x2e61c9,null))['then'](function(_0x3a9698){if(_0x3a9698){var _0x1735bb=_0x3a9698[_0x1046('0x55')];var _0x42c1dc=util['format'](_0x1046('0x56'),_0x1735bb);if(fs[_0x1046('0x57')](_0x42c1dc)){_0x35f694=!![];return _0x335b8a[_0x1046('0x58')](_0x42c1dc,_0x1735bb,config[_0x1046('0x59')][_0x1046('0x5a')])[_0x1046('0x28')](function(){return _0x3a9698;});}return _0x3a9698;}})['then'](function(_0x41705f){if(_0x41705f){var _0x5f3b52=_0x41705f[_0x1046('0x55')];if(!fs[_0x1046('0x57')](_0x5f3b52)){throw new db['Sequelize'][(_0x1046('0x5b'))]('VoiceRecording\x20not\x20found');}if(_0x41705f[_0x1046('0x5c')]){return _0x2e61c9['download'](_0x5f3b52,_0x41705f[_0x1046('0x5c')]+path[_0x1046('0x5d')](_0x5f3b52),function(){if(_0x35f694){fs[_0x1046('0x5e')](_0x5f3b52);}});}else{return _0x2e61c9[_0x1046('0x52')](_0x5f3b52,function(_0x1ad015){if(_0x35f694){fs[_0x1046('0x5e')](_0x5f3b52);}});}}})['catch'](function(_0x96cfcd){if(_0x96cfcd[_0x1046('0x5f')]==='VoiceRecording\x20not\x20found'){_0x2e61c9[_0x1046('0x1e')](0x194)[_0x1046('0x2f')]('Not\x20found');}else{return handleError(_0x2e61c9,null);}});};exports[_0x1046('0x60')]=function(_0x274b66,_0x4bbf96,_0x24be5e){var _0x221153=require(_0x1046('0x53'));var _0x103409=![];var _0x4376ac={'$and':[db[_0x1046('0x61')][_0x1046('0x42')](db[_0x1046('0x61')]['fn'](_0x1046('0x62'),db['sequelize'][_0x1046('0x63')](_0x1046('0x54'))),_0x274b66[_0x1046('0x36')][_0x1046('0x64')])]};if(_0x274b66['query'][_0x1046('0x44')]&&_0x274b66[_0x1046('0x36')]['type']==='uniqueid'){_0x4376ac[_0x1046('0x65')][_0x1046('0x66')]({'uniqueid':_0x274b66[_0x1046('0x4a')]['id']});}else{_0x4376ac['$and'][_0x1046('0x66')]({'id':_0x274b66[_0x1046('0x4a')]['id']});}return db[_0x1046('0x32')]['find']({'where':_0x4376ac,'attributes':['id','value'],'raw':!![]})[_0x1046('0x28')](handleEntityNotFound(_0x4bbf96,null))[_0x1046('0x28')](function(_0x1fc2e8){if(_0x1fc2e8){var _0x599ab4=util[_0x1046('0x67')](_0x1046('0x56'),_0x1fc2e8[_0x1046('0x55')]);if(fs[_0x1046('0x57')](_0x599ab4)){_0x103409=!![];return _0x221153['decryptFile'](_0x599ab4,_0x1fc2e8[_0x1046('0x55')],config[_0x1046('0x59')][_0x1046('0x5a')])[_0x1046('0x28')](function(){return _0x1fc2e8;});}return _0x1fc2e8;}})[_0x1046('0x28')](function(_0x4cbbe3){if(_0x4cbbe3){if(!fs[_0x1046('0x57')](_0x4cbbe3[_0x1046('0x55')])){throw new db[(_0x1046('0x68'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x4cbbe3[_0x1046('0x5c')]){return _0x4bbf96[_0x1046('0x52')](_0x4cbbe3[_0x1046('0x55')],_0x4cbbe3['filename']+path['extname'](_0x4cbbe3['value']),function(){if(_0x103409){fs[_0x1046('0x5e')](_0x4cbbe3[_0x1046('0x55')]);}});}else{return _0x4bbf96[_0x1046('0x52')](_0x4cbbe3['value'],function(_0x3c7616){if(_0x103409){fs[_0x1046('0x5e')](_0x4cbbe3[_0x1046('0x55')]);}});}}})[_0x1046('0x4e')](handleError(_0x4bbf96,null));};exports['destroy']=function(_0x110704,_0x5470f9){return db[_0x1046('0x32')][_0x1046('0x4d')]({'where':{'id':_0x110704[_0x1046('0x4a')]['id']}})[_0x1046('0x28')](function(_0x3cb7cc){if(_[_0x1046('0x69')](_0x3cb7cc)){throw new ReferenceError(_0x1046('0x6a'));}return _0x3cb7cc;})[_0x1046('0x28')](function(_0x5677f3){var _0x224187=_0x5677f3[_0x1046('0x55')];logger['info'](_0x1046('0x6b'),_0x224187);if(!_[_0x1046('0x69')](_0x5677f3[_0x1046('0x55')])&&fs[_0x1046('0x57')](_0x224187)){logger[_0x1046('0x6c')](_0x1046('0x6d')+_0x224187+_0x1046('0x6e'));fs[_0x1046('0x6f')](_0x224187);}_0x224187=_0x224187+_0x1046('0x70');if(!_[_0x1046('0x69')](_0x5677f3['value'])&&fs[_0x1046('0x57')](_0x224187)){logger[_0x1046('0x6c')]('File:\x20\x22'+_0x224187+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1046('0x6f')](_0x224187);}return _0x5677f3;})[_0x1046('0x28')](function(_0x27a15b){if(!_0x27a15b)throw new InternalError();return _0x27a15b[_0x1046('0x29')]();})['then'](function(){_0x5470f9[_0x1046('0x1e')](0xcc)[_0x1046('0x2a')]();})['catch'](handleError(_0x5470f9,null));};function getBucketslist(_0x26a69e,_0x5ad99e,_0x23bee2){return new Promise(function(_0x3c517b,_0x51ebf8){var _0x280467=new AWS['S3']({'accessKeyId':_0x5ad99e,'secretAccessKey':_0x26a69e,'region':_0x23bee2});_0x280467[_0x1046('0x71')]({},function(_0x1a59ae,_0xc96493){if(_0x1a59ae){return _0x51ebf8(_0x1a59ae);}else{return _0x3c517b(_0xc96493);}});});}function createBucket(_0x4df579,_0x9f5075,_0x21b536,_0x61fe52){return new Promise(function(_0x84c085,_0x38cc9b){var _0x59d918=new AWS['S3']({'accessKeyId':_0x9f5075,'secretAccessKey':_0x4df579,'region':_0x21b536});_0x59d918[_0x1046('0x72')]({'Bucket':_0x61fe52},function(_0x120a27,_0x1dcac6){if(_0x120a27){return _0x38cc9b(_0x120a27);}else{return _0x84c085(_0x1dcac6);}});});}function uploadFile(_0x2b5c15,_0x386669,_0x355579,_0x551ced,_0x55f579,_0x426ee5){return new Promise(function(_0x218631,_0x203507){var _0x1303f5=new AWS['S3']({'accessKeyId':_0x386669,'secretAccessKey':_0x2b5c15,'region':_0x355579});_0x1303f5[_0x1046('0x73')]({'Bucket':_0x551ced,'Key':_0x55f579,'Body':_0x426ee5},function(_0x40c701,_0x12fbbb){if(_0x40c701){return _0x203507(_0x40c701);}else{return _0x218631(_0x12fbbb);}});});}function startTranscribe(_0x5413e8,_0xb062f7,_0x15c85c,_0x15c1a1,_0x380594,_0x8cf3d3){return new Promise(function(_0x581893,_0x13734a){var _0x189c10=new AWS[(_0x1046('0x74'))]({'accessKeyId':_0xb062f7,'secretAccessKey':_0x5413e8,'region':_0x15c85c});_0x189c10['startTranscriptionJob']({'TranscriptionJobName':_0x15c1a1,'LanguageCode':_0x380594,'Media':{'MediaFileUri':_0x8cf3d3}},function(_0x2a05b0,_0xfc7b7b){if(_0x2a05b0){return _0x13734a(_0x2a05b0);}else{return _0x581893(_0xfc7b7b);}});});}function transcribe(_0xa5fb33,_0x4f6338,_0x34af83,_0x4cb691,_0xdfc54a,_0x1006d8,_0x1ab2ea){return new Promise(function(_0x1a74ed,_0x55b6c8){var _0x4f1941={};logger[_0x1046('0x6c')](util[_0x1046('0x67')](_0x1046('0x75'),_0xa5fb33,_0xdfc54a));return uploadFile(_0x4f6338,_0x34af83,_0x4cb691,_0xdfc54a,path[_0x1046('0x76')](_0x1006d8),fs[_0x1046('0x77')](_0x1006d8))[_0x1046('0x28')](function(_0x402984){logger[_0x1046('0x6c')](util[_0x1046('0x67')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0xa5fb33,_0xdfc54a,_0x402984[_0x1046('0x78')]));_0x4f1941['bucket']=_0x402984[_0x1046('0x79')];_0x4f1941[_0x1046('0x7a')]=_0x402984[_0x1046('0x78')];logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0xa5fb33));return startTranscribe(_0x4f6338,_0x34af83,_0x4cb691,uuidv4(),_0x1ab2ea,_0x402984[_0x1046('0x78')]);})[_0x1046('0x28')](function(_0x2f3c26){logger[_0x1046('0x6c')](util[_0x1046('0x67')](_0x1046('0x7b'),_0xa5fb33,_0x2f3c26[_0x1046('0x7c')][_0x1046('0x7d')]));_0x4f1941[_0x1046('0x7e')]=_0x2f3c26['TranscriptionJob'][_0x1046('0x7d')];_0x4f1941['transcribeStatus']=_0x2f3c26[_0x1046('0x7c')][_0x1046('0x7f')];return _0x1a74ed(_0x4f1941);})[_0x1046('0x4e')](function(_0x3ca61a){return _0x55b6c8(_0x3ca61a);});});}exports[_0x1046('0x80')]=function(_0x1c1219,_0x56c6da,_0x399775){var _0x4e358a;var _0x19c53a;var _0x35bbdd;var _0x2d796e=require(_0x1046('0x53'));return db[_0x1046('0x32')][_0x1046('0x81')]({'where':{'id':_0x1c1219[_0x1046('0x4a')]['id']}})[_0x1046('0x28')](function(_0x2cbe8a){if(_0x2cbe8a){var _0x3f39a8=util[_0x1046('0x67')](_0x1046('0x56'),_0x2cbe8a[_0x1046('0x55')]);if(fs[_0x1046('0x57')](_0x3f39a8)){cypher=!![];return _0x2d796e['decryptFile'](_0x3f39a8,_0x2cbe8a[_0x1046('0x55')],config[_0x1046('0x59')][_0x1046('0x5a')])[_0x1046('0x28')](function(){return _0x2cbe8a;});}return _0x2cbe8a;}})[_0x1046('0x28')](function(_0x246ee1){if(!_0x246ee1){throw new db['Sequelize'][(_0x1046('0x5b'))](_0x1046('0x82'));}_0x19c53a=_0x246ee1;return db[_0x1046('0x83')][_0x1046('0x81')]({'where':{'id':0x1}});})[_0x1046('0x28')](handleEntityNotFound(_0x56c6da,null))['then'](function(_0x753ece){if(_0x753ece){_0x4e358a=_0x753ece;if(!_0x4e358a[_0x1046('0x84')]||!_0x4e358a[_0x1046('0x85')]||!_0x4e358a[_0x1046('0x86')]||!_0x4e358a[_0x1046('0x87')]||!_0x4e358a['bucket']){throw new db['Sequelize'][(_0x1046('0x5b'))](_0x1046('0x88'));}if(_0x1c1219[_0x1046('0x50')][_0x1046('0x89')]&&(!_0x4e358a['sentiment']||!_0x4e358a[_0x1046('0x8a')]||!_0x4e358a[_0x1046('0x8b')]||!_0x4e358a[_0x1046('0x87')]||!_0x4e358a['bucket'])){throw new db['Sequelize']['ValidationError'](_0x1046('0x8c'));}return db[_0x1046('0x8d')][_0x1046('0x81')]({'where':{'id':_0x4e358a[_0x1046('0x85')]}});}})['then'](function(_0x251f89){if(!_0x251f89){throw new db[(_0x1046('0x68'))][(_0x1046('0x5b'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x251f89[_0x1046('0x8e')]||!_0x251f89[_0x1046('0x8f')]){throw new db[(_0x1046('0x68'))][(_0x1046('0x5b'))]('Cloud\x20Provider\x20not\x20configured');}_0x35bbdd=_0x251f89;return getBucketslist(_0x35bbdd[_0x1046('0x8e')],_0x35bbdd['data2'],_0x4e358a['transcribeRegion']);})[_0x1046('0x28')](function(_0x535ba3){if(_0x535ba3&&_0x535ba3[_0x1046('0x90')]){var _0x2c5f0a=_[_0x1046('0x4d')](_0x535ba3['Buckets'],function(_0xa763e4){return _0xa763e4['Name']===_0x4e358a[_0x1046('0x91')];});if(!_0x2c5f0a){logger[_0x1046('0x6c')](util[_0x1046('0x67')](_0x1046('0x92'),_0x1c1219[_0x1046('0x4a')]['id'],_0x4e358a['bucket']));return createBucket(_0x35bbdd[_0x1046('0x8e')],_0x35bbdd['data2'],_0x4e358a[_0x1046('0x86')],_0x4e358a['bucket']);}logger['info'](util['format'](_0x1046('0x93'),_0x1c1219[_0x1046('0x4a')]['id'],_0x4e358a[_0x1046('0x91')]));return;}})[_0x1046('0x28')](function(_0xbff8a8){if(_0x19c53a[_0x1046('0x94')]==='NEW'){return transcribe(_0x1c1219[_0x1046('0x4a')]['id'],_0x35bbdd['data1'],_0x35bbdd[_0x1046('0x8f')],_0x4e358a[_0x1046('0x86')],_0x4e358a[_0x1046('0x91')],_0x19c53a[_0x1046('0x55')],_0x4e358a[_0x1046('0x87')]);}else{logger[_0x1046('0x6c')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x1c1219[_0x1046('0x4a')]['id']));return{'transcribeStatus':_0x1046('0x95')};}})[_0x1046('0x28')](function(_0x124d4f){if(_0x124d4f){_0x124d4f[_0x1046('0x96')]=_0x1c1219['body']['runSentiment'];return _0x19c53a['updateAttributes'](_0x124d4f);}})['then'](respondWithResult(_0x56c6da,null))[_0x1046('0x4e')](handleError(_0x56c6da,null));};function writeFile(_0x33f1fc,_0x537588){return new Promise(function(_0x5be6f8,_0x476b95){fs['writeFile'](_0x537588,_0x33f1fc,function(_0x2a0132,_0x113ce9){if(_0x2a0132){return _0x476b95(_0x2a0132);}else{return _0x5be6f8(_0x113ce9);}});});}exports[_0x1046('0x97')]=function(_0x2cdadf,_0x5425f8,_0x231c64){return db['VoiceRecording'][_0x1046('0x81')]({'where':{'id':_0x2cdadf[_0x1046('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5425f8))[_0x1046('0x28')](function(_0x3f73b5){if(_0x3f73b5&&_0x3f73b5[_0x1046('0x98')]){var _0xd711d0=_0x3f73b5[_0x1046('0x98')];var _0x485d76=config['root']+_0x1046('0x99')+_0x3f73b5['id']+_0x1046('0x9a');if(fs[_0x1046('0x57')](_0x485d76)){return _0x485d76;}return writeFile(_0xd711d0,_0x485d76)[_0x1046('0x28')](function(){return _0x485d76;});}else{throw new db['Sequelize'][(_0x1046('0x5b'))](_0x1046('0x9b'));}})[_0x1046('0x28')](function(_0x235477){return _0x5425f8[_0x1046('0x52')](_0x235477);})[_0x1046('0x4e')](handleError(_0x5425f8));}; \ No newline at end of file +var _0xd21f=['request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','uuid/v4','../../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','reject','save','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','differenceBy','map','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceRecording','includeAll','include','findAll','rows','catch','params','find','create','body','update','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','col','token','push','$and','decryptFile','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4592a4,_0x310012){var _0x2836e9=function(_0xa4f11a){while(--_0xa4f11a){_0x4592a4['push'](_0x4592a4['shift']());}};_0x2836e9(++_0x310012);}(_0xd21f,0x1d9));var _0xfd21=function(_0x54b458,_0x4da21b){_0x54b458=_0x54b458-0x0;var _0x18d704=_0xd21f[_0x54b458];return _0x18d704;};'use strict';var emlformat=require(_0xfd21('0x0'));var rimraf=require(_0xfd21('0x1'));var zipdir=require(_0xfd21('0x2'));var jsonpatch=require(_0xfd21('0x3'));var rp=require(_0xfd21('0x4'));var moment=require(_0xfd21('0x5'));var BPromise=require(_0xfd21('0x6'));var Mustache=require(_0xfd21('0x7'));var util=require('util');var path=require(_0xfd21('0x8'));var sox=require(_0xfd21('0x9'));var csv=require(_0xfd21('0xa'));var ejs=require(_0xfd21('0xb'));var fs=require('fs');var fs_extra=require(_0xfd21('0xc'));var _=require('lodash');var squel=require(_0xfd21('0xd'));var crypto=require(_0xfd21('0xe'));var jsforce=require(_0xfd21('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfd21('0xa'));var querystring=require(_0xfd21('0x10'));var Papa=require(_0xfd21('0x11'));var AWS=require('aws-sdk');var uuidv4=require(_0xfd21('0x12'));var Redis=require('ioredis');var authService=require(_0xfd21('0x13'));var qs=require(_0xfd21('0x14'));var as=require(_0xfd21('0x15'));var hardwareService=require(_0xfd21('0x16'));var logger=require(_0xfd21('0x17'))(_0xfd21('0x18'));var utils=require(_0xfd21('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xfd21('0x1a'));var db=require(_0xfd21('0x1b'))['db'];function respondWithStatusCode(_0x304836,_0x2970fd){_0x2970fd=_0x2970fd||0xcc;return function(_0x4bc470){if(_0x4bc470){return _0x304836[_0xfd21('0x1c')](_0x2970fd);}return _0x304836[_0xfd21('0x1d')](_0x2970fd)[_0xfd21('0x1e')]();};}function respondWithResult(_0x1aa981,_0x5665e6){_0x5665e6=_0x5665e6||0xc8;return function(_0x31a273){if(_0x31a273){return _0x1aa981[_0xfd21('0x1d')](_0x5665e6)[_0xfd21('0x1f')](_0x31a273);}};}function respondWithFilteredResult(_0x45b043,_0x5f0b5b){return function(_0x2c6615){if(_0x2c6615){var _0x5b1f12=typeof _0x5f0b5b[_0xfd21('0x20')]==='undefined'&&typeof _0x5f0b5b[_0xfd21('0x21')]==='undefined';var _0x2b31ea=_0x2c6615[_0xfd21('0x22')];var _0x443d59=_0x5b1f12?0x0:_0x5f0b5b[_0xfd21('0x20')];var _0x515610=_0x5b1f12?_0x2c6615[_0xfd21('0x22')]:_0x5f0b5b[_0xfd21('0x20')]+_0x5f0b5b[_0xfd21('0x21')];var _0x481343;if(_0x515610>=_0x2b31ea){_0x515610=_0x2b31ea;_0x481343=0xc8;}else{_0x481343=0xce;}_0x45b043['status'](_0x481343);return _0x45b043['set'](_0xfd21('0x23'),_0x443d59+'-'+_0x515610+'/'+_0x2b31ea)['json'](_0x2c6615);}return null;};}function patchUpdates(_0x4745bc){return function(_0xff9a21){try{jsonpatch[_0xfd21('0x24')](_0xff9a21,_0x4745bc,!![]);}catch(_0x3c7656){return BPromise[_0xfd21('0x25')](_0x3c7656);}return _0xff9a21[_0xfd21('0x26')]();};}function saveUpdates(_0x5aa0a2,_0x1b5bd8){return function(_0x176a22){if(_0x176a22){return _0x176a22['update'](_0x5aa0a2)[_0xfd21('0x27')](function(_0x1bc6c8){return _0x1bc6c8;});}return null;};}function removeEntity(_0x5850c4,_0x2a6cad){return function(_0x5dcf97){if(_0x5dcf97){return _0x5dcf97[_0xfd21('0x28')]()[_0xfd21('0x27')](function(){_0x5850c4['status'](0xcc)[_0xfd21('0x1e')]();});}};}function handleEntityNotFound(_0x434a72,_0x2139e3){return function(_0x39d50f){if(!_0x39d50f){_0x434a72[_0xfd21('0x1c')](0x194);}return _0x39d50f;};}function handleError(_0x489324,_0x1d46eb){_0x1d46eb=_0x1d46eb||0x1f4;return function(_0x3a7ee4){logger[_0xfd21('0x29')](_0x3a7ee4['stack']);if(_0x3a7ee4['name']){delete _0x3a7ee4[_0xfd21('0x2a')];}_0x489324[_0xfd21('0x1d')](_0x1d46eb)[_0xfd21('0x2b')](_0x3a7ee4);};}exports[_0xfd21('0x2c')]=function(_0x589232,_0x392a5c){var _0x5ebc41={},_0x2456d9={},_0x7741ae={'count':0x0,'rows':[]};var _0x4a556f=_['map'](db['VoiceRecording'][_0xfd21('0x2d')],function(_0xbd06db){return{'name':_0xbd06db[_0xfd21('0x2e')],'type':_0xbd06db[_0xfd21('0x2f')][_0xfd21('0x30')]};});_0x2456d9[_0xfd21('0x31')]=_[_0xfd21('0x32')](_[_0xfd21('0x33')](_0x4a556f,_0xfd21('0x2a')),['format']);_0x2456d9[_0xfd21('0x34')]=_['keys'](_0x589232[_0xfd21('0x34')]);_0x2456d9['filters']=_[_0xfd21('0x35')](_0x2456d9['model'],_0x2456d9[_0xfd21('0x34')]);_0x5ebc41[_0xfd21('0x36')]=_[_0xfd21('0x35')](_0x2456d9[_0xfd21('0x31')],qs[_0xfd21('0x37')](_0x589232[_0xfd21('0x34')][_0xfd21('0x37')]));_0x5ebc41[_0xfd21('0x36')]=_0x5ebc41[_0xfd21('0x36')][_0xfd21('0x38')]?_0x5ebc41[_0xfd21('0x36')]:_0x2456d9[_0xfd21('0x31')];if(!_0x589232['query']['hasOwnProperty'](_0xfd21('0x39'))){_0x5ebc41['limit']=qs['limit'](_0x589232[_0xfd21('0x34')][_0xfd21('0x21')]);_0x5ebc41[_0xfd21('0x20')]=qs[_0xfd21('0x20')](_0x589232[_0xfd21('0x34')][_0xfd21('0x20')]);}_0x5ebc41[_0xfd21('0x3a')]=qs['sort'](_0x589232[_0xfd21('0x34')][_0xfd21('0x3b')]);_0x5ebc41[_0xfd21('0x3c')]=qs[_0xfd21('0x3d')](_[_0xfd21('0x3e')](_0x589232['query'],_0x2456d9[_0xfd21('0x3d')]),_0x4a556f);if(_0x589232[_0xfd21('0x34')][_0xfd21('0x3f')]){_0x5ebc41['where']=_[_0xfd21('0x40')](_0x5ebc41[_0xfd21('0x3c')],{'$or':_[_0xfd21('0x33')](_0x4a556f,function(_0x2c2207){if(_0x2c2207[_0xfd21('0x2f')]!==_0xfd21('0x41')){var _0x2f313a={};_0x2f313a[_0x2c2207[_0xfd21('0x2a')]]={'$like':'%'+_0x589232[_0xfd21('0x34')][_0xfd21('0x3f')]+'%'};return _0x2f313a;}})});}_0x5ebc41=_['merge']({},_0x5ebc41,_0x589232[_0xfd21('0x42')]);var _0x337a9f={'where':_0x5ebc41['where']};return db[_0xfd21('0x43')][_0xfd21('0x22')](_0x337a9f)['then'](function(_0x508ecb){_0x7741ae[_0xfd21('0x22')]=_0x508ecb;if(_0x589232[_0xfd21('0x34')][_0xfd21('0x44')]){_0x5ebc41[_0xfd21('0x45')]=[{'all':!![]}];}return db[_0xfd21('0x43')][_0xfd21('0x46')](_0x5ebc41);})[_0xfd21('0x27')](function(_0x50c7f9){_0x7741ae[_0xfd21('0x47')]=_0x50c7f9;return _0x7741ae;})[_0xfd21('0x27')](respondWithFilteredResult(_0x392a5c,_0x5ebc41))[_0xfd21('0x48')](handleError(_0x392a5c,null));};exports['show']=function(_0x1b8f0b,_0x13bf40){var _0x32e9f2={'raw':![],'where':{'id':_0x1b8f0b[_0xfd21('0x49')]['id']}},_0x27dd0a={};_0x27dd0a[_0xfd21('0x31')]=_['keys'](db[_0xfd21('0x43')][_0xfd21('0x2d')]);_0x27dd0a[_0xfd21('0x34')]=_['keys'](_0x1b8f0b[_0xfd21('0x34')]);_0x27dd0a[_0xfd21('0x3d')]=_['intersection'](_0x27dd0a[_0xfd21('0x31')],_0x27dd0a['query']);_0x32e9f2['attributes']=_[_0xfd21('0x35')](_0x27dd0a[_0xfd21('0x31')],qs[_0xfd21('0x37')](_0x1b8f0b[_0xfd21('0x34')][_0xfd21('0x37')]));_0x32e9f2[_0xfd21('0x36')]=_0x32e9f2[_0xfd21('0x36')][_0xfd21('0x38')]?_0x32e9f2[_0xfd21('0x36')]:_0x27dd0a[_0xfd21('0x31')];if(_0x1b8f0b[_0xfd21('0x34')]['includeAll']){_0x32e9f2[_0xfd21('0x45')]=[{'all':!![]}];}_0x32e9f2=_[_0xfd21('0x40')]({},_0x32e9f2,_0x1b8f0b[_0xfd21('0x42')]);return db[_0xfd21('0x43')][_0xfd21('0x4a')](_0x32e9f2)[_0xfd21('0x27')](handleEntityNotFound(_0x13bf40,null))[_0xfd21('0x27')](respondWithResult(_0x13bf40,null))[_0xfd21('0x48')](handleError(_0x13bf40,null));};exports[_0xfd21('0x4b')]=function(_0x22921b,_0xe94238){return db[_0xfd21('0x43')][_0xfd21('0x4b')](_0x22921b[_0xfd21('0x4c')],{})[_0xfd21('0x27')](respondWithResult(_0xe94238,0xc9))[_0xfd21('0x48')](handleError(_0xe94238,null));};exports[_0xfd21('0x4d')]=function(_0x532e76,_0x295352){if(_0x532e76['body']['id']){delete _0x532e76[_0xfd21('0x4c')]['id'];}return db[_0xfd21('0x43')][_0xfd21('0x4a')]({'where':{'id':_0x532e76[_0xfd21('0x49')]['id']}})[_0xfd21('0x27')](handleEntityNotFound(_0x295352,null))[_0xfd21('0x27')](saveUpdates(_0x532e76['body'],null))['then'](respondWithResult(_0x295352,null))['catch'](handleError(_0x295352,null));};exports[_0xfd21('0x4e')]=function(_0x208f79,_0xdecebf){return db[_0xfd21('0x43')]['describe']()[_0xfd21('0x27')](respondWithResult(_0xdecebf,null))['catch'](handleError(_0xdecebf,null));};exports[_0xfd21('0x4f')]=function(_0x141ee3,_0x13c798,_0x349429){var _0x5510c9=require(_0xfd21('0x50'));var _0x536f2f=![];var _0x1a59ab={};if(_0x141ee3[_0xfd21('0x34')][_0xfd21('0x2f')]&&_0x141ee3[_0xfd21('0x34')][_0xfd21('0x2f')]==='uniqueid'){_0x1a59ab[_0xfd21('0x51')]=_0x141ee3[_0xfd21('0x49')]['id'];}else{_0x1a59ab['id']=_0x141ee3[_0xfd21('0x49')]['id'];}return db['VoiceRecording'][_0xfd21('0x4a')]({'where':_0x1a59ab,'attributes':['id',_0xfd21('0x52')],'raw':!![]})[_0xfd21('0x27')](handleEntityNotFound(_0x13c798,null))[_0xfd21('0x27')](function(_0x5cb7ac){if(_0x5cb7ac){var _0xa9a259=_0x5cb7ac[_0xfd21('0x52')];var _0x2143d0=util[_0xfd21('0x53')](_0xfd21('0x54'),_0xa9a259);if(fs[_0xfd21('0x55')](_0x2143d0)){_0x536f2f=!![];return _0x5510c9['decryptFile'](_0x2143d0,_0xa9a259,config[_0xfd21('0x56')][_0xfd21('0x57')])['then'](function(){return _0x5cb7ac;});}return _0x5cb7ac;}})[_0xfd21('0x27')](function(_0x5c851b){if(_0x5c851b){var _0x5af18b=_0x5c851b['value'];if(!fs[_0xfd21('0x55')](_0x5af18b)){throw new db[(_0xfd21('0x58'))][(_0xfd21('0x59'))]('VoiceRecording\x20not\x20found');}if(_0x5c851b[_0xfd21('0x5a')]){return _0x13c798['download'](_0x5af18b,_0x5c851b[_0xfd21('0x5a')]+path[_0xfd21('0x5b')](_0x5af18b),function(){if(_0x536f2f){fs[_0xfd21('0x5c')](_0x5af18b);}});}else{return _0x13c798[_0xfd21('0x4f')](_0x5af18b,function(_0xa815f5){if(_0x536f2f){fs[_0xfd21('0x5c')](_0x5af18b);}});}}})['catch'](function(_0x4597eb){if(_0x4597eb[_0xfd21('0x5d')]===_0xfd21('0x5e')){_0x13c798[_0xfd21('0x1d')](0x194)[_0xfd21('0x2b')](_0xfd21('0x5f'));}else{return handleError(_0x13c798,null);}});};exports[_0xfd21('0x60')]=function(_0x37668f,_0x495855,_0x8bbc75){var _0x4439b6=require(_0xfd21('0x50'));var _0x3283ec=![];var _0x456a7e={'$and':[db[_0xfd21('0x61')][_0xfd21('0x3c')](db[_0xfd21('0x61')]['fn'](_0xfd21('0x62'),db[_0xfd21('0x61')][_0xfd21('0x63')](_0xfd21('0x51'))),_0x37668f[_0xfd21('0x34')][_0xfd21('0x64')])]};if(_0x37668f[_0xfd21('0x34')][_0xfd21('0x2f')]&&_0x37668f['query'][_0xfd21('0x2f')]==='uniqueid'){_0x456a7e['$and'][_0xfd21('0x65')]({'uniqueid':_0x37668f['params']['id']});}else{_0x456a7e[_0xfd21('0x66')][_0xfd21('0x65')]({'id':_0x37668f['params']['id']});}return db['VoiceRecording'][_0xfd21('0x4a')]({'where':_0x456a7e,'attributes':['id',_0xfd21('0x52')],'raw':!![]})[_0xfd21('0x27')](handleEntityNotFound(_0x495855,null))['then'](function(_0x24d95c){if(_0x24d95c){var _0x5a50f6=util['format'](_0xfd21('0x54'),_0x24d95c[_0xfd21('0x52')]);if(fs[_0xfd21('0x55')](_0x5a50f6)){_0x3283ec=!![];return _0x4439b6[_0xfd21('0x67')](_0x5a50f6,_0x24d95c[_0xfd21('0x52')],config[_0xfd21('0x56')][_0xfd21('0x57')])[_0xfd21('0x27')](function(){return _0x24d95c;});}return _0x24d95c;}})[_0xfd21('0x27')](function(_0x51a0a7){if(_0x51a0a7){if(!fs[_0xfd21('0x55')](_0x51a0a7[_0xfd21('0x52')])){throw new db[(_0xfd21('0x58'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x51a0a7[_0xfd21('0x5a')]){return _0x495855[_0xfd21('0x4f')](_0x51a0a7[_0xfd21('0x52')],_0x51a0a7[_0xfd21('0x5a')]+path[_0xfd21('0x5b')](_0x51a0a7['value']),function(){if(_0x3283ec){fs[_0xfd21('0x5c')](_0x51a0a7[_0xfd21('0x52')]);}});}else{return _0x495855['download'](_0x51a0a7[_0xfd21('0x52')],function(_0x268afd){if(_0x3283ec){fs[_0xfd21('0x5c')](_0x51a0a7['value']);}});}}})[_0xfd21('0x48')](handleError(_0x495855,null));};exports['destroy']=function(_0x33399c,_0x1fcd70){return db[_0xfd21('0x43')][_0xfd21('0x4a')]({'where':{'id':_0x33399c[_0xfd21('0x49')]['id']}})[_0xfd21('0x27')](function(_0x571afd){if(_[_0xfd21('0x68')](_0x571afd)){throw new ReferenceError(_0xfd21('0x69'));}return _0x571afd;})[_0xfd21('0x27')](function(_0x4ff877){var _0xebc984=_0x4ff877[_0xfd21('0x52')];logger[_0xfd21('0x6a')]('cancellazione\x20fisica\x20documento\x20%s',_0xebc984);if(!_['isNil'](_0x4ff877['value'])&&fs['existsSync'](_0xebc984)){logger['info'](_0xfd21('0x6b')+_0xebc984+_0xfd21('0x6c'));fs['unlinkSync'](_0xebc984);}_0xebc984=_0xebc984+'.cypher';if(!_[_0xfd21('0x68')](_0x4ff877[_0xfd21('0x52')])&&fs['existsSync'](_0xebc984)){logger[_0xfd21('0x6a')](_0xfd21('0x6b')+_0xebc984+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xfd21('0x6d')](_0xebc984);}return _0x4ff877;})[_0xfd21('0x27')](function(_0x1ab49f){if(!_0x1ab49f)throw new InternalError();return _0x1ab49f[_0xfd21('0x28')]();})[_0xfd21('0x27')](function(){_0x1fcd70['status'](0xcc)[_0xfd21('0x1e')]();})['catch'](handleError(_0x1fcd70,null));};function getBucketslist(_0xb33f7f,_0xded6c0,_0xc0fec3){return new Promise(function(_0x5cdbc2,_0x282cb2){var _0x4335be=new AWS['S3']({'accessKeyId':_0xded6c0,'secretAccessKey':_0xb33f7f,'region':_0xc0fec3});_0x4335be[_0xfd21('0x6e')]({},function(_0x203e80,_0x548fd0){if(_0x203e80){return _0x282cb2(_0x203e80);}else{return _0x5cdbc2(_0x548fd0);}});});}function createBucket(_0x3bf01a,_0x1e3f58,_0x3229ee,_0x4c18a9){return new Promise(function(_0x133005,_0x4e70dc){var _0x2ac7bb=new AWS['S3']({'accessKeyId':_0x1e3f58,'secretAccessKey':_0x3bf01a,'region':_0x3229ee});_0x2ac7bb[_0xfd21('0x6f')]({'Bucket':_0x4c18a9},function(_0x198176,_0x1162fe){if(_0x198176){return _0x4e70dc(_0x198176);}else{return _0x133005(_0x1162fe);}});});}function uploadFile(_0x3878b7,_0x31438e,_0xa0fbd1,_0x52ad50,_0x3633f6,_0x89f970){return new Promise(function(_0x3207a2,_0x3f8162){var _0x57d6ec=new AWS['S3']({'accessKeyId':_0x31438e,'secretAccessKey':_0x3878b7,'region':_0xa0fbd1});_0x57d6ec[_0xfd21('0x70')]({'Bucket':_0x52ad50,'Key':_0x3633f6,'Body':_0x89f970},function(_0x1d23cb,_0x2aae1a){if(_0x1d23cb){return _0x3f8162(_0x1d23cb);}else{return _0x3207a2(_0x2aae1a);}});});}function startTranscribe(_0x4a2409,_0x4a330e,_0x4601df,_0x1969f4,_0x3ed620,_0x14ece0){return new Promise(function(_0x28ec05,_0x4c5ec1){var _0x562647=new AWS[(_0xfd21('0x71'))]({'accessKeyId':_0x4a330e,'secretAccessKey':_0x4a2409,'region':_0x4601df});_0x562647[_0xfd21('0x72')]({'TranscriptionJobName':_0x1969f4,'LanguageCode':_0x3ed620,'Media':{'MediaFileUri':_0x14ece0}},function(_0x436f91,_0x33ee23){if(_0x436f91){return _0x4c5ec1(_0x436f91);}else{return _0x28ec05(_0x33ee23);}});});}function transcribe(_0x2e0673,_0x2e76b4,_0x307d66,_0x2b049d,_0x3ef877,_0x2850be,_0x2d7491){return new Promise(function(_0x5895aa,_0xf79e96){var _0x4d6e5c={};logger[_0xfd21('0x6a')](util[_0xfd21('0x53')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x2e0673,_0x3ef877));return uploadFile(_0x2e76b4,_0x307d66,_0x2b049d,_0x3ef877,path[_0xfd21('0x73')](_0x2850be),fs[_0xfd21('0x74')](_0x2850be))[_0xfd21('0x27')](function(_0xb127f3){logger[_0xfd21('0x6a')](util[_0xfd21('0x53')](_0xfd21('0x75'),_0x2e0673,_0x3ef877,_0xb127f3[_0xfd21('0x76')]));_0x4d6e5c[_0xfd21('0x77')]=_0xb127f3[_0xfd21('0x78')];_0x4d6e5c[_0xfd21('0x79')]=_0xb127f3[_0xfd21('0x76')];logger[_0xfd21('0x6a')](util[_0xfd21('0x53')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x2e0673));return startTranscribe(_0x2e76b4,_0x307d66,_0x2b049d,uuidv4(),_0x2d7491,_0xb127f3[_0xfd21('0x76')]);})[_0xfd21('0x27')](function(_0x42b808){logger[_0xfd21('0x6a')](util[_0xfd21('0x53')](_0xfd21('0x7a'),_0x2e0673,_0x42b808[_0xfd21('0x7b')][_0xfd21('0x7c')]));_0x4d6e5c['transcribeName']=_0x42b808[_0xfd21('0x7b')]['TranscriptionJobName'];_0x4d6e5c['transcribeStatus']=_0x42b808[_0xfd21('0x7b')][_0xfd21('0x7d')];return _0x5895aa(_0x4d6e5c);})['catch'](function(_0x492495){return _0xf79e96(_0x492495);});});}exports[_0xfd21('0x7e')]=function(_0x10a9d7,_0x4c8062,_0x52185a){var _0x201555;var _0x389196;var _0x98b0cb;var _0xa77a83=require(_0xfd21('0x50'));return db[_0xfd21('0x43')][_0xfd21('0x7f')]({'where':{'id':_0x10a9d7[_0xfd21('0x49')]['id']}})['then'](function(_0x3699f1){if(_0x3699f1){var _0x57e7b8=util[_0xfd21('0x53')](_0xfd21('0x54'),_0x3699f1[_0xfd21('0x52')]);if(fs[_0xfd21('0x55')](_0x57e7b8)){cypher=!![];return _0xa77a83[_0xfd21('0x67')](_0x57e7b8,_0x3699f1[_0xfd21('0x52')],config[_0xfd21('0x56')][_0xfd21('0x57')])[_0xfd21('0x27')](function(){return _0x3699f1;});}return _0x3699f1;}})[_0xfd21('0x27')](function(_0x4e3ef7){if(!_0x4e3ef7){throw new db['Sequelize']['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x389196=_0x4e3ef7;return db[_0xfd21('0x80')]['findOne']({'where':{'id':0x1}});})[_0xfd21('0x27')](handleEntityNotFound(_0x4c8062,null))[_0xfd21('0x27')](function(_0x4a504b){if(_0x4a504b){_0x201555=_0x4a504b;if(!_0x201555[_0xfd21('0x81')]||!_0x201555[_0xfd21('0x82')]||!_0x201555[_0xfd21('0x83')]||!_0x201555[_0xfd21('0x84')]||!_0x201555[_0xfd21('0x77')]){throw new db[(_0xfd21('0x58'))]['ValidationError'](_0xfd21('0x85'));}if(_0x10a9d7['body'][_0xfd21('0x86')]&&(!_0x201555[_0xfd21('0x87')]||!_0x201555[_0xfd21('0x88')]||!_0x201555[_0xfd21('0x89')]||!_0x201555[_0xfd21('0x84')]||!_0x201555[_0xfd21('0x77')])){throw new db[(_0xfd21('0x58'))][(_0xfd21('0x59'))](_0xfd21('0x8a'));}return db[_0xfd21('0x8b')][_0xfd21('0x7f')]({'where':{'id':_0x201555[_0xfd21('0x82')]}});}})[_0xfd21('0x27')](function(_0xc9bfed){if(!_0xc9bfed){throw new db[(_0xfd21('0x58'))][(_0xfd21('0x59'))](_0xfd21('0x8c'));}if(!_0xc9bfed[_0xfd21('0x8d')]||!_0xc9bfed[_0xfd21('0x8e')]){throw new db['Sequelize'][(_0xfd21('0x59'))](_0xfd21('0x8f'));}_0x98b0cb=_0xc9bfed;return getBucketslist(_0x98b0cb[_0xfd21('0x8d')],_0x98b0cb[_0xfd21('0x8e')],_0x201555[_0xfd21('0x83')]);})[_0xfd21('0x27')](function(_0x14a5e4){if(_0x14a5e4&&_0x14a5e4[_0xfd21('0x90')]){var _0x405177=_[_0xfd21('0x4a')](_0x14a5e4[_0xfd21('0x90')],function(_0x17ee75){return _0x17ee75['Name']===_0x201555[_0xfd21('0x77')];});if(!_0x405177){logger['info'](util[_0xfd21('0x53')](_0xfd21('0x91'),_0x10a9d7[_0xfd21('0x49')]['id'],_0x201555['bucket']));return createBucket(_0x98b0cb[_0xfd21('0x8d')],_0x98b0cb[_0xfd21('0x8e')],_0x201555[_0xfd21('0x83')],_0x201555[_0xfd21('0x77')]);}logger[_0xfd21('0x6a')](util[_0xfd21('0x53')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x10a9d7[_0xfd21('0x49')]['id'],_0x201555[_0xfd21('0x77')]));return;}})['then'](function(_0x2cfd8c){if(_0x389196[_0xfd21('0x92')]===_0xfd21('0x93')){return transcribe(_0x10a9d7['params']['id'],_0x98b0cb[_0xfd21('0x8d')],_0x98b0cb['data2'],_0x201555['transcribeRegion'],_0x201555['bucket'],_0x389196[_0xfd21('0x52')],_0x201555[_0xfd21('0x84')]);}else{logger[_0xfd21('0x6a')](util[_0xfd21('0x53')](_0xfd21('0x94'),_0x10a9d7['params']['id']));return{'transcribeStatus':_0xfd21('0x95')};}})[_0xfd21('0x27')](function(_0x7f895){if(_0x7f895){_0x7f895[_0xfd21('0x96')]=_0x10a9d7[_0xfd21('0x4c')][_0xfd21('0x86')];return _0x389196[_0xfd21('0x97')](_0x7f895);}})['then'](respondWithResult(_0x4c8062,null))[_0xfd21('0x48')](handleError(_0x4c8062,null));};function writeFile(_0x3ccd4d,_0x2a2a7b){return new Promise(function(_0x417a6b,_0x34d5b7){fs[_0xfd21('0x98')](_0x2a2a7b,_0x3ccd4d,function(_0x152716,_0x3e07a1){if(_0x152716){return _0x34d5b7(_0x152716);}else{return _0x417a6b(_0x3e07a1);}});});}exports[_0xfd21('0x99')]=function(_0x5ec9fb,_0x3c91fa,_0x22267f){return db[_0xfd21('0x43')][_0xfd21('0x7f')]({'where':{'id':_0x5ec9fb[_0xfd21('0x49')]['id']}})['then'](handleEntityNotFound(_0x3c91fa))[_0xfd21('0x27')](function(_0x47f7a6){if(_0x47f7a6&&_0x47f7a6[_0xfd21('0x9a')]){var _0x1848f8=_0x47f7a6[_0xfd21('0x9a')];var _0x13a123=config[_0xfd21('0x9b')]+_0xfd21('0x9c')+_0x47f7a6['id']+_0xfd21('0x9d');if(fs[_0xfd21('0x55')](_0x13a123)){return _0x13a123;}return writeFile(_0x1848f8,_0x13a123)['then'](function(){return _0x13a123;});}else{throw new db[(_0xfd21('0x58'))][(_0xfd21('0x59'))](_0xfd21('0x9e'));}})[_0xfd21('0x27')](function(_0x2d7c43){return _0x3c91fa['download'](_0x2d7c43);})[_0xfd21('0x48')](handleError(_0x3c91fa));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index cb67112..ff00b37 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 _0xd16c=['api','bluebird','request-promise','./voiceRecording.attributes','exports','VoiceRecording','uniqueid','lodash','../../config/logger'];(function(_0xbf4d4e,_0x54eb21){var _0x4b906d=function(_0x2eae5d){while(--_0x2eae5d){_0xbf4d4e['push'](_0xbf4d4e['shift']());}};_0x4b906d(++_0x54eb21);}(_0xd16c,0xd6));var _0xcd16=function(_0x51742e,_0x23f030){_0x51742e=_0x51742e-0x0;var _0x2509c5=_0xd16c[_0x51742e];return _0x2509c5;};'use strict';var _=require(_0xcd16('0x0'));var util=require('util');var logger=require(_0xcd16('0x1'))(_0xcd16('0x2'));var moment=require('moment');var BPromise=require(_0xcd16('0x3'));var rp=require(_0xcd16('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcd16('0x5'));module[_0xcd16('0x6')]=function(_0x5eb2ae,_0x5cd58a){return _0x5eb2ae['define'](_0xcd16('0x7'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xcd16('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa5d1=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x35cf7f,_0x250429){var _0x529d18=function(_0x3d50ab){while(--_0x3d50ab){_0x35cf7f['push'](_0x35cf7f['shift']());}};_0x529d18(++_0x250429);}(_0xa5d1,0x8c));var _0x1a5d=function(_0x2ad780,_0x5173fb){_0x2ad780=_0x2ad780-0x0;var _0x48875c=_0xa5d1[_0x2ad780];return _0x48875c;};'use strict';var _=require(_0x1a5d('0x0'));var util=require(_0x1a5d('0x1'));var logger=require('../../config/logger')(_0x1a5d('0x2'));var moment=require(_0x1a5d('0x3'));var BPromise=require('bluebird');var rp=require(_0x1a5d('0x4'));var fs=require('fs');var path=require(_0x1a5d('0x5'));var rimraf=require(_0x1a5d('0x6'));var config=require(_0x1a5d('0x7'));var attributes=require(_0x1a5d('0x8'));module[_0x1a5d('0x9')]=function(_0x5c5028,_0x1a008d){return _0x5c5028[_0x1a5d('0xa')](_0x1a5d('0xb'),attributes,{'tableName':_0x1a5d('0xc'),'paranoid':![],'indexes':[{'name':_0x1a5d('0xd'),'fields':[_0x1a5d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index fbc2e73..d44a739 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 _0x47c5=['secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceRecording','update','body','options','raw','where','attributes','limit','UpdateVoiceRecording','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher'];(function(_0x9a8838,_0x163c4b){var _0x277d69=function(_0x524bbd){while(--_0x524bbd){_0x9a8838['push'](_0x9a8838['shift']());}};_0x277d69(++_0x163c4b);}(_0x47c5,0x165));var _0x547c=function(_0x3287c0,_0x24165a){_0x3287c0=_0x3287c0-0x0;var _0x5316e3=_0x47c5[_0x3287c0];return _0x5316e3;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});}exports['UpdateVoiceRecording']=function(_0x23fa9e){var _0x199e4f=this;return new Promise(function(_0xeb059e,_0x4a8901){return db[_0x547c('0x18')][_0x547c('0x19')](_0x23fa9e[_0x547c('0x1a')],{'raw':_0x23fa9e['options']?_0x23fa9e[_0x547c('0x1b')][_0x547c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23fa9e['options']?_0x23fa9e['options'][_0x547c('0x1d')]||null:null,'attributes':_0x23fa9e[_0x547c('0x1b')]?_0x23fa9e['options'][_0x547c('0x1e')]||null:null,'limit':_0x23fa9e[_0x547c('0x1b')]?_0x23fa9e['options'][_0x547c('0x1f')]||null:null})[_0x547c('0xc')](function(_0x436e67){logger['info'](_0x547c('0x20'),_0x23fa9e);logger[_0x547c('0x10')](_0x547c('0x20'),_0x23fa9e,JSON[_0x547c('0x12')](_0x436e67));_0xeb059e(_0x436e67);})[_0x547c('0x17')](function(_0x2663bc){logger[_0x547c('0x13')](_0x547c('0x20'),_0x2663bc['message'],_0x23fa9e);_0x4a8901(_0x199e4f[_0x547c('0x13')](0x1f4,_0x2663bc['message']));});});};exports['CreateVoiceRecording']=function(_0x4855fd){var _0x478f04=this;return new Promise(function(_0x2c725d,_0x4c5256){var _0x93985c=require('../../components/encryptor');var _0x3ea493;return db['Setting'][_0x547c('0x21')]({'attributes':['id',_0x547c('0x22')],'where':{'id':0x1},'raw':!![]})[_0x547c('0xc')](function(_0x30a96c){_0x3ea493=_0x30a96c;return db[_0x547c('0x18')]['create'](_0x4855fd['body']);})[_0x547c('0xc')](function(_0x54de6f){if(_0x3ea493[_0x547c('0x22')]&&fs[_0x547c('0x23')](_0x54de6f[_0x547c('0x24')])){var _0x1695be=util[_0x547c('0x25')](_0x547c('0x26'),_0x54de6f[_0x547c('0x24')]);return _0x93985c['encryptFile'](_0x54de6f['value'],_0x1695be,config[_0x547c('0x27')][_0x547c('0x28')])[_0x547c('0xc')](function(){fs[_0x547c('0x29')](_0x54de6f[_0x547c('0x24')]);logger[_0x547c('0xd')](_0x547c('0x2a'));return _0x54de6f;});}return _0x54de6f;})[_0x547c('0xc')](function(_0x378bac){logger[_0x547c('0xd')](_0x547c('0x2b'),_0x4855fd);logger[_0x547c('0x10')](_0x547c('0x2b'),_0x4855fd,JSON[_0x547c('0x12')](_0x378bac));_0x2c725d(_0x378bac);})['catch'](function(_0x3afc28){logger['error']('CreateVoiceRecording',_0x3afc28['message'],_0x4855fd);_0x4c5256(_0x478f04[_0x547c('0x13')](0x1f4,_0x3afc28[_0x547c('0x15')]));});});}; \ No newline at end of file +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(_0x533b60,_0x4f121c){var _0x3ba02f=function(_0x1c7666){while(--_0x1c7666){_0x533b60['push'](_0x533b60['shift']());}};_0x3ba02f(++_0x4f121c);}(_0x4325,0x1da));var _0x5432=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4325[_0x3b380d];return _0x54502b;};'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 569e765..7eb9630 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 _0x4235=['index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated'];(function(_0x1a470f,_0x2f113a){var _0x3f0a4b=function(_0x275312){while(--_0x275312){_0x1a470f['push'](_0x1a470f['shift']());}};_0x3f0a4b(++_0x2f113a);}(_0x4235,0x1af));var _0x5423=function(_0x2b6235,_0xadfbcf){_0x2b6235=_0x2b6235-0x0;var _0x4cee7f=_0x4235[_0x2b6235];return _0x4cee7f;};'use strict';var multer=require(_0x5423('0x0'));var util=require('util');var path=require(_0x5423('0x1'));var timeout=require(_0x5423('0x2'));var express=require(_0x5423('0x3'));var router=express[_0x5423('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5423('0x5'));var config=require(_0x5423('0x6'));var controller=require(_0x5423('0x7'));router['get']('/',auth[_0x5423('0x8')](),controller[_0x5423('0x9')]);router[_0x5423('0xa')](_0x5423('0xb'),auth[_0x5423('0x8')](),controller[_0x5423('0xc')]);router[_0x5423('0xa')](_0x5423('0xd'),auth[_0x5423('0x8')](),controller[_0x5423('0xe')]);router[_0x5423('0xf')]('/',auth[_0x5423('0x8')](),controller[_0x5423('0x10')]);router[_0x5423('0x11')](_0x5423('0xd'),auth['isAuthenticated'](),controller[_0x5423('0x12')]);router[_0x5423('0x13')]('/:id',auth[_0x5423('0x8')](),controller[_0x5423('0x14')]);module[_0x5423('0x15')]=router; \ No newline at end of file +var _0x0d8a=['/:id','post','create','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x264f5b,_0x3d7501){var _0x21b31f=function(_0xfceebe){while(--_0xfceebe){_0x264f5b['push'](_0x264f5b['shift']());}};_0x21b31f(++_0x3d7501);}(_0x0d8a,0x9e));var _0xa0d8=function(_0x2b50a7,_0x38c690){_0x2b50a7=_0x2b50a7-0x0;var _0x11fe16=_0x0d8a[_0x2b50a7];return _0x11fe16;};'use strict';var multer=require(_0xa0d8('0x0'));var util=require(_0xa0d8('0x1'));var path=require(_0xa0d8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa0d8('0x3')]();var fs_extra=require(_0xa0d8('0x4'));var auth=require(_0xa0d8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa0d8('0x6'));var controller=require(_0xa0d8('0x7'));router[_0xa0d8('0x8')]('/',auth[_0xa0d8('0x9')](),controller[_0xa0d8('0xa')]);router[_0xa0d8('0x8')](_0xa0d8('0xb'),auth['isAuthenticated'](),controller[_0xa0d8('0xc')]);router['get'](_0xa0d8('0xd'),auth[_0xa0d8('0x9')](),controller['show']);router[_0xa0d8('0xe')]('/',auth['isAuthenticated'](),controller[_0xa0d8('0xf')]);router['put'](_0xa0d8('0xd'),auth[_0xa0d8('0x9')](),controller[_0xa0d8('0x10')]);router['delete']('/:id',auth[_0xa0d8('0x9')](),controller[_0xa0d8('0x11')]);module[_0xa0d8('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index b309f7e..dd83903 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 _0xfe60=['attended','STRING','Yes','moment','ENUM','blind'];(function(_0x1c1153,_0x59abfa){var _0x4f4c77=function(_0x1fbf5f){while(--_0x1fbf5f){_0x1c1153['push'](_0x1c1153['shift']());}};_0x4f4c77(++_0x59abfa);}(_0xfe60,0x1cb));var _0x0fe6=function(_0x508d5f,_0x400849){_0x508d5f=_0x508d5f-0x0;var _0x4d68a2=_0xfe60[_0x508d5f];return _0x4d68a2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0fe6('0x0'));module['exports']={'type':{'type':Sequelize[_0x0fe6('0x1')](_0x0fe6('0x2'),_0x0fe6('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x0fe6('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x0fe6('0x4')]},'transferercalleridname':{'type':Sequelize[_0x0fe6('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x0fe6('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x0fe6('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x0fe6('0x4')]},'transferercontext':{'type':Sequelize[_0x0fe6('0x4')]},'transfererexten':{'type':Sequelize[_0x0fe6('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x0fe6('0x4')]},'transfereechannel':{'type':Sequelize[_0x0fe6('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x0fe6('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x0fe6('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x0fe6('0x4')]},'isexternal':{'type':Sequelize[_0x0fe6('0x1')](_0x0fe6('0x5'),'No')},'context':{'type':Sequelize[_0x0fe6('0x4')]},'extension':{'type':Sequelize[_0x0fe6('0x4')]}}; \ No newline at end of file +var _0x504a=['STRING','ENUM','Yes','sequelize','moment','exports','blind','attended'];(function(_0x3cb152,_0x57eb54){var _0x4f54c3=function(_0x273a45){while(--_0x273a45){_0x3cb152['push'](_0x3cb152['shift']());}};_0x4f54c3(++_0x57eb54);}(_0x504a,0x18b));var _0xa504=function(_0x295fb6,_0xfbbe06){_0x295fb6=_0x295fb6-0x0;var _0x3f0b2=_0x504a[_0x295fb6];return _0x3f0b2;};'use strict';var Sequelize=require(_0xa504('0x0'));var moment=require(_0xa504('0x1'));module[_0xa504('0x2')]={'type':{'type':Sequelize['ENUM'](_0xa504('0x3'),_0xa504('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xa504('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xa504('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xa504('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xa504('0x5')]},'transferercontext':{'type':Sequelize[_0xa504('0x5')]},'transfererexten':{'type':Sequelize[_0xa504('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xa504('0x5')]},'transfereechannel':{'type':Sequelize[_0xa504('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xa504('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xa504('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xa504('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xa504('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xa504('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xa504('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xa504('0x5')]},'isexternal':{'type':Sequelize[_0xa504('0x6')](_0xa504('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xa504('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 83fb6aa..31d9913 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 _0x4133=['map','VoiceTransferReport','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','then','includeAll','include','rows','catch','show','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','apply','reject','save','destroy','error','stack','name','send','index'];(function(_0xe1e65c,_0x368fcc){var _0x2740a2=function(_0x147f86){while(--_0x147f86){_0xe1e65c['push'](_0xe1e65c['shift']());}};_0x2740a2(++_0x368fcc);}(_0x4133,0x6d));var _0x3413=function(_0x1015a5,_0x107de9){_0x1015a5=_0x1015a5-0x0;var _0x3a6343=_0x4133[_0x1015a5];return _0x3a6343;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3413('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3413('0x1'));var rp=require(_0x3413('0x2'));var moment=require(_0x3413('0x3'));var BPromise=require(_0x3413('0x4'));var Mustache=require(_0x3413('0x5'));var util=require(_0x3413('0x6'));var path=require(_0x3413('0x7'));var sox=require(_0x3413('0x8'));var csv=require(_0x3413('0x9'));var ejs=require(_0x3413('0xa'));var fs=require('fs');var fs_extra=require(_0x3413('0xb'));var _=require(_0x3413('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3413('0x9'));var querystring=require(_0x3413('0xd'));var Papa=require(_0x3413('0xe'));var Redis=require(_0x3413('0xf'));var authService=require(_0x3413('0x10'));var qs=require(_0x3413('0x11'));var as=require(_0x3413('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3413('0x13'))(_0x3413('0x14'));var utils=require(_0x3413('0x15'));var config=require(_0x3413('0x16'));var licenseUtil=require(_0x3413('0x17'));var db=require(_0x3413('0x18'))['db'];function respondWithStatusCode(_0x394743,_0x5e88b4){_0x5e88b4=_0x5e88b4||0xcc;return function(_0x32e59c){if(_0x32e59c){return _0x394743[_0x3413('0x19')](_0x5e88b4);}return _0x394743['status'](_0x5e88b4)[_0x3413('0x1a')]();};}function respondWithResult(_0x442d47,_0x267696){_0x267696=_0x267696||0xc8;return function(_0x2d60dd){if(_0x2d60dd){return _0x442d47[_0x3413('0x1b')](_0x267696)[_0x3413('0x1c')](_0x2d60dd);}};}function respondWithFilteredResult(_0x211945,_0x19f2b5){return function(_0x28f452){if(_0x28f452){var _0x580b6b=typeof _0x19f2b5[_0x3413('0x1d')]==='undefined'&&typeof _0x19f2b5[_0x3413('0x1e')]==='undefined';var _0x4f6ed5=_0x28f452[_0x3413('0x1f')];var _0x4b93e6=_0x580b6b?0x0:_0x19f2b5['offset'];var _0x3409f3=_0x580b6b?_0x28f452[_0x3413('0x1f')]:_0x19f2b5[_0x3413('0x1d')]+_0x19f2b5[_0x3413('0x1e')];var _0x2eaef0;if(_0x3409f3>=_0x4f6ed5){_0x3409f3=_0x4f6ed5;_0x2eaef0=0xc8;}else{_0x2eaef0=0xce;}_0x211945[_0x3413('0x1b')](_0x2eaef0);return _0x211945['set']('Content-Range',_0x4b93e6+'-'+_0x3409f3+'/'+_0x4f6ed5)[_0x3413('0x1c')](_0x28f452);}return null;};}function patchUpdates(_0x2a4b10){return function(_0x59d183){try{jsonpatch[_0x3413('0x20')](_0x59d183,_0x2a4b10,!![]);}catch(_0x3c1cca){return BPromise[_0x3413('0x21')](_0x3c1cca);}return _0x59d183[_0x3413('0x22')]();};}function saveUpdates(_0x3aa501,_0x1f3d52){return function(_0x3904cc){if(_0x3904cc){return _0x3904cc['update'](_0x3aa501)['then'](function(_0x2f4932){return _0x2f4932;});}return null;};}function removeEntity(_0xa50aba,_0x5792ac){return function(_0x53cedb){if(_0x53cedb){return _0x53cedb[_0x3413('0x23')]()['then'](function(){_0xa50aba[_0x3413('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x287b1d,_0x3dc7ba){return function(_0x5e4c99){if(!_0x5e4c99){_0x287b1d[_0x3413('0x19')](0x194);}return _0x5e4c99;};}function handleError(_0x2fee5a,_0x4db30b){_0x4db30b=_0x4db30b||0x1f4;return function(_0x119f8a){logger[_0x3413('0x24')](_0x119f8a[_0x3413('0x25')]);if(_0x119f8a[_0x3413('0x26')]){delete _0x119f8a[_0x3413('0x26')];}_0x2fee5a[_0x3413('0x1b')](_0x4db30b)[_0x3413('0x27')](_0x119f8a);};}exports[_0x3413('0x28')]=function(_0x296248,_0x252123){var _0xfbcdc2={},_0x30cd8d={},_0xccb253={'count':0x0,'rows':[]};var _0x544d3b=_[_0x3413('0x29')](db[_0x3413('0x2a')][_0x3413('0x2b')],function(_0x13bc6d){return{'name':_0x13bc6d[_0x3413('0x2c')],'type':_0x13bc6d['type'][_0x3413('0x2d')]};});_0x30cd8d[_0x3413('0x2e')]=_[_0x3413('0x29')](_0x544d3b,'name');_0x30cd8d[_0x3413('0x2f')]=_[_0x3413('0x30')](_0x296248[_0x3413('0x2f')]);_0x30cd8d['filters']=_['intersection'](_0x30cd8d[_0x3413('0x2e')],_0x30cd8d[_0x3413('0x2f')]);_0xfbcdc2[_0x3413('0x31')]=_[_0x3413('0x32')](_0x30cd8d[_0x3413('0x2e')],qs[_0x3413('0x33')](_0x296248['query']['fields']));_0xfbcdc2[_0x3413('0x31')]=_0xfbcdc2[_0x3413('0x31')][_0x3413('0x34')]?_0xfbcdc2['attributes']:_0x30cd8d[_0x3413('0x2e')];if(!_0x296248[_0x3413('0x2f')][_0x3413('0x35')](_0x3413('0x36'))){_0xfbcdc2[_0x3413('0x1e')]=qs[_0x3413('0x1e')](_0x296248[_0x3413('0x2f')][_0x3413('0x1e')]);_0xfbcdc2[_0x3413('0x1d')]=qs['offset'](_0x296248[_0x3413('0x2f')][_0x3413('0x1d')]);}_0xfbcdc2[_0x3413('0x37')]=qs['sort'](_0x296248[_0x3413('0x2f')][_0x3413('0x38')]);_0xfbcdc2[_0x3413('0x39')]=qs[_0x3413('0x3a')](_[_0x3413('0x3b')](_0x296248[_0x3413('0x2f')],_0x30cd8d[_0x3413('0x3a')]),_0x544d3b);if(_0x296248[_0x3413('0x2f')]['filter']){_0xfbcdc2['where']=_[_0x3413('0x3c')](_0xfbcdc2[_0x3413('0x39')],{'$or':_['map'](_0x544d3b,function(_0x26506e){if(_0x26506e[_0x3413('0x3d')]!==_0x3413('0x3e')){var _0x4999a5={};_0x4999a5[_0x26506e['name']]={'$like':'%'+_0x296248[_0x3413('0x2f')]['filter']+'%'};return _0x4999a5;}})});}_0xfbcdc2=_[_0x3413('0x3c')]({},_0xfbcdc2,_0x296248[_0x3413('0x3f')]);var _0x48b862={'where':_0xfbcdc2[_0x3413('0x39')]};return db[_0x3413('0x2a')][_0x3413('0x1f')](_0x48b862)[_0x3413('0x40')](function(_0x44388e){_0xccb253[_0x3413('0x1f')]=_0x44388e;if(_0x296248['query'][_0x3413('0x41')]){_0xfbcdc2[_0x3413('0x42')]=[{'all':!![]}];}return db[_0x3413('0x2a')]['findAll'](_0xfbcdc2);})[_0x3413('0x40')](function(_0x7f6b32){_0xccb253[_0x3413('0x43')]=_0x7f6b32;return _0xccb253;})[_0x3413('0x40')](respondWithFilteredResult(_0x252123,_0xfbcdc2))[_0x3413('0x44')](handleError(_0x252123,null));};exports[_0x3413('0x45')]=function(_0x5ef1f3,_0x2d3098){var _0x335053={'raw':!![],'where':{'id':_0x5ef1f3[_0x3413('0x46')]['id']}},_0x50d8b1={};_0x50d8b1[_0x3413('0x2e')]=_[_0x3413('0x30')](db[_0x3413('0x2a')][_0x3413('0x2b')]);_0x50d8b1[_0x3413('0x2f')]=_[_0x3413('0x30')](_0x5ef1f3[_0x3413('0x2f')]);_0x50d8b1['filters']=_[_0x3413('0x32')](_0x50d8b1[_0x3413('0x2e')],_0x50d8b1[_0x3413('0x2f')]);_0x335053[_0x3413('0x31')]=_[_0x3413('0x32')](_0x50d8b1[_0x3413('0x2e')],qs[_0x3413('0x33')](_0x5ef1f3['query'][_0x3413('0x33')]));_0x335053['attributes']=_0x335053['attributes']['length']?_0x335053[_0x3413('0x31')]:_0x50d8b1['model'];if(_0x5ef1f3[_0x3413('0x2f')][_0x3413('0x41')]){_0x335053['include']=[{'all':!![]}];}_0x335053=_[_0x3413('0x3c')]({},_0x335053,_0x5ef1f3[_0x3413('0x3f')]);return db[_0x3413('0x2a')][_0x3413('0x47')](_0x335053)[_0x3413('0x40')](handleEntityNotFound(_0x2d3098,null))[_0x3413('0x40')](respondWithResult(_0x2d3098,null))[_0x3413('0x44')](handleError(_0x2d3098,null));};exports['create']=function(_0x40606f,_0x390c68){return db[_0x3413('0x2a')][_0x3413('0x48')](_0x40606f['body'],{})[_0x3413('0x40')](respondWithResult(_0x390c68,0xc9))['catch'](handleError(_0x390c68,null));};exports['update']=function(_0x264196,_0x36a2f8){if(_0x264196['body']['id']){delete _0x264196[_0x3413('0x49')]['id'];}return db['VoiceTransferReport'][_0x3413('0x47')]({'where':{'id':_0x264196[_0x3413('0x46')]['id']}})[_0x3413('0x40')](handleEntityNotFound(_0x36a2f8,null))['then'](saveUpdates(_0x264196[_0x3413('0x49')],null))[_0x3413('0x40')](respondWithResult(_0x36a2f8,null))[_0x3413('0x44')](handleError(_0x36a2f8,null));};exports[_0x3413('0x23')]=function(_0x4f37a7,_0x350583){return db[_0x3413('0x2a')][_0x3413('0x47')]({'where':{'id':_0x4f37a7['params']['id']}})[_0x3413('0x40')](handleEntityNotFound(_0x350583,null))[_0x3413('0x40')](removeEntity(_0x350583,null))[_0x3413('0x44')](handleError(_0x350583,null));};exports['describe']=function(_0x2d6c26,_0x4eded1){return db[_0x3413('0x2a')][_0x3413('0x4a')]()[_0x3413('0x40')](respondWithResult(_0x4eded1,null))[_0x3413('0x44')](handleError(_0x4eded1,null));}; \ No newline at end of file +var _0x808a=['../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','length','find','catch','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x4d1909,_0x4cf5c1){var _0xfd9b1=function(_0x1f11a0){while(--_0x1f11a0){_0x4d1909['push'](_0x4d1909['shift']());}};_0xfd9b1(++_0x4cf5c1);}(_0x808a,0x1af));var _0xa808=function(_0x428ec2,_0x150404){_0x428ec2=_0x428ec2-0x0;var _0x1654d6=_0x808a[_0x428ec2];return _0x1654d6;};'use strict';var emlformat=require(_0xa808('0x0'));var rimraf=require(_0xa808('0x1'));var zipdir=require(_0xa808('0x2'));var jsonpatch=require(_0xa808('0x3'));var rp=require('request-promise');var moment=require(_0xa808('0x4'));var BPromise=require(_0xa808('0x5'));var Mustache=require(_0xa808('0x6'));var util=require(_0xa808('0x7'));var path=require(_0xa808('0x8'));var sox=require(_0xa808('0x9'));var csv=require(_0xa808('0xa'));var ejs=require(_0xa808('0xb'));var fs=require('fs');var fs_extra=require(_0xa808('0xc'));var _=require('lodash');var squel=require(_0xa808('0xd'));var crypto=require(_0xa808('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa808('0xa'));var querystring=require(_0xa808('0xf'));var Papa=require(_0xa808('0x10'));var Redis=require(_0xa808('0x11'));var authService=require(_0xa808('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa808('0x13'));var hardwareService=require(_0xa808('0x14'));var logger=require(_0xa808('0x15'))('api');var utils=require(_0xa808('0x16'));var config=require(_0xa808('0x17'));var licenseUtil=require(_0xa808('0x18'));var db=require(_0xa808('0x19'))['db'];function respondWithStatusCode(_0x472658,_0x574897){_0x574897=_0x574897||0xcc;return function(_0xa0f932){if(_0xa0f932){return _0x472658[_0xa808('0x1a')](_0x574897);}return _0x472658[_0xa808('0x1b')](_0x574897)[_0xa808('0x1c')]();};}function respondWithResult(_0x3398fe,_0x2f5711){_0x2f5711=_0x2f5711||0xc8;return function(_0x131b5b){if(_0x131b5b){return _0x3398fe[_0xa808('0x1b')](_0x2f5711)[_0xa808('0x1d')](_0x131b5b);}};}function respondWithFilteredResult(_0x5ceb27,_0xbd0caf){return function(_0xa07709){if(_0xa07709){var _0x1a0df4=typeof _0xbd0caf[_0xa808('0x1e')]===_0xa808('0x1f')&&typeof _0xbd0caf['limit']===_0xa808('0x1f');var _0x55fbb5=_0xa07709['count'];var _0x4e9987=_0x1a0df4?0x0:_0xbd0caf[_0xa808('0x1e')];var _0x27aa53=_0x1a0df4?_0xa07709[_0xa808('0x20')]:_0xbd0caf[_0xa808('0x1e')]+_0xbd0caf[_0xa808('0x21')];var _0x42d38a;if(_0x27aa53>=_0x55fbb5){_0x27aa53=_0x55fbb5;_0x42d38a=0xc8;}else{_0x42d38a=0xce;}_0x5ceb27['status'](_0x42d38a);return _0x5ceb27[_0xa808('0x22')](_0xa808('0x23'),_0x4e9987+'-'+_0x27aa53+'/'+_0x55fbb5)[_0xa808('0x1d')](_0xa07709);}return null;};}function patchUpdates(_0x31d2a5){return function(_0x409aa4){try{jsonpatch[_0xa808('0x24')](_0x409aa4,_0x31d2a5,!![]);}catch(_0x1f46ab){return BPromise['reject'](_0x1f46ab);}return _0x409aa4[_0xa808('0x25')]();};}function saveUpdates(_0x3f937f,_0xaaa9f9){return function(_0x4f6387){if(_0x4f6387){return _0x4f6387[_0xa808('0x26')](_0x3f937f)[_0xa808('0x27')](function(_0x4265ad){return _0x4265ad;});}return null;};}function removeEntity(_0x51a66c,_0x2c1f04){return function(_0x597fc4){if(_0x597fc4){return _0x597fc4['destroy']()[_0xa808('0x27')](function(){_0x51a66c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52fd61,_0x4d8c9e){return function(_0x2112ff){if(!_0x2112ff){_0x52fd61[_0xa808('0x1a')](0x194);}return _0x2112ff;};}function handleError(_0x2bdbec,_0x2fb1d0){_0x2fb1d0=_0x2fb1d0||0x1f4;return function(_0x3ce53e){logger['error'](_0x3ce53e[_0xa808('0x28')]);if(_0x3ce53e[_0xa808('0x29')]){delete _0x3ce53e[_0xa808('0x29')];}_0x2bdbec[_0xa808('0x1b')](_0x2fb1d0)[_0xa808('0x2a')](_0x3ce53e);};}exports['index']=function(_0xb2e6ba,_0x1a7670){var _0x54a859={},_0x5e533e={},_0x12524a={'count':0x0,'rows':[]};var _0x757448=_[_0xa808('0x2b')](db[_0xa808('0x2c')][_0xa808('0x2d')],function(_0x4eb94c){return{'name':_0x4eb94c[_0xa808('0x2e')],'type':_0x4eb94c[_0xa808('0x2f')]['key']};});_0x5e533e[_0xa808('0x30')]=_[_0xa808('0x2b')](_0x757448,_0xa808('0x29'));_0x5e533e[_0xa808('0x31')]=_[_0xa808('0x32')](_0xb2e6ba['query']);_0x5e533e['filters']=_['intersection'](_0x5e533e[_0xa808('0x30')],_0x5e533e[_0xa808('0x31')]);_0x54a859[_0xa808('0x33')]=_[_0xa808('0x34')](_0x5e533e[_0xa808('0x30')],qs[_0xa808('0x35')](_0xb2e6ba[_0xa808('0x31')][_0xa808('0x35')]));_0x54a859[_0xa808('0x33')]=_0x54a859[_0xa808('0x33')]['length']?_0x54a859['attributes']:_0x5e533e[_0xa808('0x30')];if(!_0xb2e6ba[_0xa808('0x31')][_0xa808('0x36')](_0xa808('0x37'))){_0x54a859['limit']=qs[_0xa808('0x21')](_0xb2e6ba['query'][_0xa808('0x21')]);_0x54a859[_0xa808('0x1e')]=qs[_0xa808('0x1e')](_0xb2e6ba[_0xa808('0x31')][_0xa808('0x1e')]);}_0x54a859[_0xa808('0x38')]=qs['sort'](_0xb2e6ba['query']['sort']);_0x54a859[_0xa808('0x39')]=qs[_0xa808('0x3a')](_[_0xa808('0x3b')](_0xb2e6ba[_0xa808('0x31')],_0x5e533e[_0xa808('0x3a')]),_0x757448);if(_0xb2e6ba[_0xa808('0x31')][_0xa808('0x3c')]){_0x54a859[_0xa808('0x39')]=_[_0xa808('0x3d')](_0x54a859[_0xa808('0x39')],{'$or':_[_0xa808('0x2b')](_0x757448,function(_0x17d96a){if(_0x17d96a[_0xa808('0x2f')]!==_0xa808('0x3e')){var _0x4f12b2={};_0x4f12b2[_0x17d96a[_0xa808('0x29')]]={'$like':'%'+_0xb2e6ba['query'][_0xa808('0x3c')]+'%'};return _0x4f12b2;}})});}_0x54a859=_[_0xa808('0x3d')]({},_0x54a859,_0xb2e6ba[_0xa808('0x3f')]);var _0x2f550a={'where':_0x54a859[_0xa808('0x39')]};return db[_0xa808('0x2c')][_0xa808('0x20')](_0x2f550a)['then'](function(_0x425504){_0x12524a[_0xa808('0x20')]=_0x425504;if(_0xb2e6ba['query'][_0xa808('0x40')]){_0x54a859[_0xa808('0x41')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xa808('0x42')](_0x54a859);})[_0xa808('0x27')](function(_0x21cf86){_0x12524a[_0xa808('0x43')]=_0x21cf86;return _0x12524a;})['then'](respondWithFilteredResult(_0x1a7670,_0x54a859))['catch'](handleError(_0x1a7670,null));};exports['show']=function(_0x2790d6,_0x1cf531){var _0x3f81e8={'raw':!![],'where':{'id':_0x2790d6['params']['id']}},_0x5b515d={};_0x5b515d['model']=_[_0xa808('0x32')](db['VoiceTransferReport'][_0xa808('0x2d')]);_0x5b515d[_0xa808('0x31')]=_[_0xa808('0x32')](_0x2790d6[_0xa808('0x31')]);_0x5b515d['filters']=_[_0xa808('0x34')](_0x5b515d[_0xa808('0x30')],_0x5b515d[_0xa808('0x31')]);_0x3f81e8[_0xa808('0x33')]=_[_0xa808('0x34')](_0x5b515d[_0xa808('0x30')],qs[_0xa808('0x35')](_0x2790d6[_0xa808('0x31')][_0xa808('0x35')]));_0x3f81e8[_0xa808('0x33')]=_0x3f81e8['attributes'][_0xa808('0x44')]?_0x3f81e8[_0xa808('0x33')]:_0x5b515d[_0xa808('0x30')];if(_0x2790d6[_0xa808('0x31')]['includeAll']){_0x3f81e8['include']=[{'all':!![]}];}_0x3f81e8=_[_0xa808('0x3d')]({},_0x3f81e8,_0x2790d6['options']);return db['VoiceTransferReport'][_0xa808('0x45')](_0x3f81e8)[_0xa808('0x27')](handleEntityNotFound(_0x1cf531,null))[_0xa808('0x27')](respondWithResult(_0x1cf531,null))[_0xa808('0x46')](handleError(_0x1cf531,null));};exports[_0xa808('0x47')]=function(_0x3adca7,_0x1f6b19){return db['VoiceTransferReport']['create'](_0x3adca7[_0xa808('0x48')],{})['then'](respondWithResult(_0x1f6b19,0xc9))[_0xa808('0x46')](handleError(_0x1f6b19,null));};exports[_0xa808('0x26')]=function(_0x96e70f,_0x3ed3b7){if(_0x96e70f['body']['id']){delete _0x96e70f[_0xa808('0x48')]['id'];}return db[_0xa808('0x2c')][_0xa808('0x45')]({'where':{'id':_0x96e70f[_0xa808('0x49')]['id']}})[_0xa808('0x27')](handleEntityNotFound(_0x3ed3b7,null))[_0xa808('0x27')](saveUpdates(_0x96e70f[_0xa808('0x48')],null))['then'](respondWithResult(_0x3ed3b7,null))[_0xa808('0x46')](handleError(_0x3ed3b7,null));};exports[_0xa808('0x4a')]=function(_0x42fd73,_0x36ac66){return db[_0xa808('0x2c')][_0xa808('0x45')]({'where':{'id':_0x42fd73[_0xa808('0x49')]['id']}})['then'](handleEntityNotFound(_0x36ac66,null))['then'](removeEntity(_0x36ac66,null))[_0xa808('0x46')](handleError(_0x36ac66,null));};exports[_0xa808('0x4b')]=function(_0x546b0f,_0x40be1d){return db['VoiceTransferReport'][_0xa808('0x4b')]()[_0xa808('0x27')](respondWithResult(_0x40be1d,null))[_0xa808('0x46')](handleError(_0x40be1d,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index e737d61..c2cc62b 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 _0xb4bc=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','lodash','util'];(function(_0x3e7804,_0x121853){var _0x56efda=function(_0x1996f3){while(--_0x1996f3){_0x3e7804['push'](_0x3e7804['shift']());}};_0x56efda(++_0x121853);}(_0xb4bc,0x6a));var _0xcb4b=function(_0x2009eb,_0x221901){_0x2009eb=_0x2009eb-0x0;var _0x48db1b=_0xb4bc[_0x2009eb];return _0x48db1b;};'use strict';var _=require(_0xcb4b('0x0'));var util=require(_0xcb4b('0x1'));var logger=require(_0xcb4b('0x2'))(_0xcb4b('0x3'));var moment=require(_0xcb4b('0x4'));var BPromise=require(_0xcb4b('0x5'));var rp=require(_0xcb4b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcb4b('0x7'));var attributes=require(_0xcb4b('0x8'));module[_0xcb4b('0x9')]=function(_0x31bb05,_0x26a573){return _0x31bb05['define'](_0xcb4b('0xa'),attributes,{'tableName':_0xcb4b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b53=['../../config/logger','bluebird','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash'];(function(_0x55a634,_0xeafcbb){var _0x3bd995=function(_0x55b458){while(--_0x55b458){_0x55a634['push'](_0x55a634['shift']());}};_0x3bd995(++_0xeafcbb);}(_0x2b53,0x133));var _0x32b5=function(_0x2cde3e,_0x1f2213){_0x2cde3e=_0x2cde3e-0x0;var _0x4dfdd7=_0x2b53[_0x2cde3e];return _0x4dfdd7;};'use strict';var _=require(_0x32b5('0x0'));var util=require('util');var logger=require(_0x32b5('0x1'))('api');var moment=require('moment');var BPromise=require(_0x32b5('0x2'));var rp=require(_0x32b5('0x3'));var fs=require('fs');var path=require(_0x32b5('0x4'));var rimraf=require(_0x32b5('0x5'));var config=require('../../config/environment');var attributes=require(_0x32b5('0x6'));module[_0x32b5('0x7')]=function(_0x56a479,_0x1b5271){return _0x56a479[_0x32b5('0x8')](_0x32b5('0x9'),attributes,{'tableName':_0x32b5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 74b5474..c8d7a8f 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 _0x055c=['request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','create','body','options','raw','info','CreateVoiceTransferReport','debug','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http'];(function(_0x52e572,_0x4c318b){var _0x112a42=function(_0x55315d){while(--_0x55315d){_0x52e572['push'](_0x52e572['shift']());}};_0x112a42(++_0x4c318b);}(_0x055c,0x105));var _0xc055=function(_0x541260,_0x4c7f2e){_0x541260=_0x541260-0x0;var _0x1dd2b5=_0x055c[_0x541260];return _0x1dd2b5;};'use strict';var _=require('lodash');var util=require(_0xc055('0x0'));var moment=require(_0xc055('0x1'));var BPromise=require('bluebird');var rs=require(_0xc055('0x2'));var fs=require('fs');var Redis=require(_0xc055('0x3'));var db=require(_0xc055('0x4'))['db'];var utils=require(_0xc055('0x5'));var logger=require('../../config/logger')(_0xc055('0x6'));var config=require(_0xc055('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc055('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e35aa,_0x5f5795,_0x3fe378){return new BPromise(function(_0x16c6b5,_0x4843f5){return client[_0xc055('0x9')](_0x1e35aa,_0x3fe378)[_0xc055('0xa')](function(_0x5cf5dd){logger['info'](_0xc055('0xb'),_0x5f5795,_0xc055('0xc'));logger['debug'](_0xc055('0xd'),_0x5f5795,_0xc055('0xc'),JSON['stringify'](_0x5cf5dd));if(_0x5cf5dd[_0xc055('0xe')]){if(_0x5cf5dd[_0xc055('0xe')][_0xc055('0xf')]===0x1f4){logger['error'](_0xc055('0xb'),_0x5f5795,_0x5cf5dd[_0xc055('0xe')][_0xc055('0x10')]);return _0x4843f5(_0x5cf5dd[_0xc055('0xe')][_0xc055('0x10')]);}logger[_0xc055('0xe')](_0xc055('0xb'),_0x5f5795,_0x5cf5dd[_0xc055('0xe')]['message']);return _0x16c6b5(_0x5cf5dd[_0xc055('0xe')][_0xc055('0x10')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x5f5795,_0xc055('0xc'));_0x16c6b5(_0x5cf5dd[_0xc055('0x11')]['message']);}})[_0xc055('0x12')](function(_0x14be7a){logger[_0xc055('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x5f5795,_0x14be7a);_0x4843f5(_0x14be7a);});});}exports['CreateVoiceTransferReport']=function(_0x2fee92){var _0x4b5bc0=this;return new Promise(function(_0x1185fb,_0x263b7d){return db['VoiceTransferReport'][_0xc055('0x13')](_0x2fee92[_0xc055('0x14')],{'raw':_0x2fee92[_0xc055('0x15')]?_0x2fee92[_0xc055('0x15')][_0xc055('0x16')]===undefined?!![]:![]:!![]})[_0xc055('0xa')](function(_0x5d91f9){logger[_0xc055('0x17')](_0xc055('0x18'),_0x2fee92);logger[_0xc055('0x19')](_0xc055('0x18'),_0x2fee92,JSON[_0xc055('0x1a')](_0x5d91f9));_0x1185fb(_0x5d91f9);})[_0xc055('0x12')](function(_0x2f473d){logger[_0xc055('0xe')](_0xc055('0x18'),_0x2f473d[_0xc055('0x10')],_0x2fee92);_0x263b7d(_0x4b5bc0[_0xc055('0xe')](0x1f4,_0x2f473d[_0xc055('0x10')]));});});}; \ No newline at end of file +var _0x02bf=['http','request','then','info','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceTransferReport,\x20%s,\x20%s','result','catch','VoiceTransferReport','create','body','options','CreateVoiceTransferReport','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client'];(function(_0x3cae18,_0x1c8c40){var _0x5847b7=function(_0x49ab9b){while(--_0x49ab9b){_0x3cae18['push'](_0x3cae18['shift']());}};_0x5847b7(++_0x1c8c40);}(_0x02bf,0x99));var _0xf02b=function(_0x54c695,_0x5d6677){_0x54c695=_0x54c695-0x0;var _0x3ce06b=_0x02bf[_0x54c695];return _0x3ce06b;};'use strict';var _=require(_0xf02b('0x0'));var util=require(_0xf02b('0x1'));var moment=require(_0xf02b('0x2'));var BPromise=require(_0xf02b('0x3'));var rs=require(_0xf02b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf02b('0x5'))['db'];var utils=require(_0xf02b('0x6'));var logger=require('../../config/logger')(_0xf02b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf02b('0x8')][_0xf02b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x244f2b,_0x5340ff,_0x570e40){return new BPromise(function(_0x165483,_0xa179d6){return client[_0xf02b('0xa')](_0x244f2b,_0x570e40)[_0xf02b('0xb')](function(_0x4bde21){logger[_0xf02b('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x5340ff,_0xf02b('0xd'));logger['debug'](_0xf02b('0xe'),_0x5340ff,_0xf02b('0xd'),JSON[_0xf02b('0xf')](_0x4bde21));if(_0x4bde21[_0xf02b('0x10')]){if(_0x4bde21[_0xf02b('0x10')]['code']===0x1f4){logger[_0xf02b('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x5340ff,_0x4bde21[_0xf02b('0x10')][_0xf02b('0x11')]);return _0xa179d6(_0x4bde21[_0xf02b('0x10')][_0xf02b('0x11')]);}logger[_0xf02b('0x10')](_0xf02b('0x12'),_0x5340ff,_0x4bde21[_0xf02b('0x10')][_0xf02b('0x11')]);return _0x165483(_0x4bde21['error'][_0xf02b('0x11')]);}else{logger[_0xf02b('0xc')](_0xf02b('0x12'),_0x5340ff,_0xf02b('0xd'));_0x165483(_0x4bde21[_0xf02b('0x13')][_0xf02b('0x11')]);}})[_0xf02b('0x14')](function(_0x1f844b){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x5340ff,_0x1f844b);_0xa179d6(_0x1f844b);});});}exports['CreateVoiceTransferReport']=function(_0x316296){var _0x124c13=this;return new Promise(function(_0x10516f,_0x190597){return db[_0xf02b('0x15')][_0xf02b('0x16')](_0x316296[_0xf02b('0x17')],{'raw':_0x316296[_0xf02b('0x18')]?_0x316296[_0xf02b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xf02b('0xb')](function(_0x2752d9){logger[_0xf02b('0xc')](_0xf02b('0x19'),_0x316296);logger[_0xf02b('0x1a')](_0xf02b('0x19'),_0x316296,JSON[_0xf02b('0xf')](_0x2752d9));_0x10516f(_0x2752d9);})['catch'](function(_0x1db598){logger[_0xf02b('0x10')](_0xf02b('0x19'),_0x1db598['message'],_0x316296);_0x190597(_0x124c13[_0xf02b('0x10')](0x1f4,_0x1db598[_0xf02b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 9b7c0b4..3339e71 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 _0x5b02=['Router','../../components/auth/service','./webbar.controller','isAuthenticated','originate','post','/hangup','isWebrtcLicence','/answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express'];(function(_0x4d3558,_0x4abef3){var _0x2dcf71=function(_0xc4d7c4){while(--_0xc4d7c4){_0x4d3558['push'](_0x4d3558['shift']());}};_0x2dcf71(++_0x4abef3);}(_0x5b02,0xe9));var _0x25b0=function(_0x39599c,_0x248ad6){_0x39599c=_0x39599c-0x0;var _0x51465c=_0x5b02[_0x39599c];return _0x51465c;};'use strict';var express=require(_0x25b0('0x0'));var router=express[_0x25b0('0x1')]();var auth=require(_0x25b0('0x2'));var controller=require(_0x25b0('0x3'));router['post']('/originate',auth[_0x25b0('0x4')](),auth['isWebrtcLicence'](),controller[_0x25b0('0x5')]);router[_0x25b0('0x6')](_0x25b0('0x7'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hangup']);router[_0x25b0('0x6')](_0x25b0('0x9'),auth['isAuthenticated'](),auth[_0x25b0('0x8')](),controller['answer']);router['post'](_0x25b0('0xa'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hold']);router[_0x25b0('0x6')](_0x25b0('0xb'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xc')]);router[_0x25b0('0x6')](_0x25b0('0xd'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xe')]);router[_0x25b0('0x6')](_0x25b0('0xf'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0x10')]);module[_0x25b0('0x11')]=router; \ No newline at end of file +var _0x54ef=['unhold','/calls','/transfer','transfer','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','/hold','hold','/unhold'];(function(_0x398d75,_0x2b940a){var _0x1a709d=function(_0x45ab67){while(--_0x45ab67){_0x398d75['push'](_0x398d75['shift']());}};_0x1a709d(++_0x2b940a);}(_0x54ef,0x112));var _0xf54e=function(_0x293db8,_0x2f9c5f){_0x293db8=_0x293db8-0x0;var _0x249cc9=_0x54ef[_0x293db8];return _0x249cc9;};'use strict';var express=require(_0xf54e('0x0'));var router=express[_0xf54e('0x1')]();var auth=require(_0xf54e('0x2'));var controller=require('./webbar.controller');router[_0xf54e('0x3')](_0xf54e('0x4'),auth[_0xf54e('0x5')](),auth[_0xf54e('0x6')](),controller[_0xf54e('0x7')]);router[_0xf54e('0x3')](_0xf54e('0x8'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xf54e('0x9')]);router[_0xf54e('0x3')](_0xf54e('0xa'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller['answer']);router[_0xf54e('0x3')](_0xf54e('0xb'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller[_0xf54e('0xc')]);router[_0xf54e('0x3')](_0xf54e('0xd'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller[_0xf54e('0xe')]);router[_0xf54e('0x3')](_0xf54e('0xf'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller['calls']);router['post'](_0xf54e('0x10'),auth[_0xf54e('0x5')](),auth[_0xf54e('0x6')](),controller[_0xf54e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index c4e2e6d..24214c2 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 _0x9aea=['calls\x20fired:','conference\x20fired:','conference\x20executed!','webbar:transfer','transfer\x20executed!','path','../../mysqldb','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','stack','name','status','send','NotFound','error','message','result','catch','User','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','user:%s','webbar:originate','length','hangup\x20executed!','answer','answer\x20fired:','format','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','webbar:unhold','unhold\x20executed!','calls'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9aea,0xdd));var _0xa9ae=function(_0x107f82,_0x235f79){_0x107f82=_0x107f82-0x0;var _0x48f139=_0x9aea[_0x107f82];return _0x48f139;};'use strict';var path=require(_0xa9ae('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xa9ae('0x1'))['db'];var config=require('../../config/environment');var util=require(_0xa9ae('0x2'));var BPromise=require(_0xa9ae('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0xa9ae('0x4')][_0xa9ae('0x5')]({'port':0x232a});var logger=require(_0xa9ae('0x6'))(_0xa9ae('0x7'));var Redis=require(_0xa9ae('0x8'));config['redis']=_[_0xa9ae('0x9')](config[_0xa9ae('0xa')],{'host':_0xa9ae('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa9ae('0xa')]));var Schema=require(_0xa9ae('0xc'));var originateValidation=new Schema({'userId':{'type':_0xa9ae('0xd'),'required':[!![],_0xa9ae('0xe')]},'callNumber':{'type':_0xa9ae('0xf'),'required':[!![],_0xa9ae('0x10')]},'callerId':{'type':_0xa9ae('0xf')},'callbackUrl':{'type':_0xa9ae('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xa9ae('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa9ae('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa9ae('0xe')]},'sessionId':{'type':_0xa9ae('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xa9ae('0xd'),'required':[!![],_0xa9ae('0xe')]},'sessionId':{'type':_0xa9ae('0xf'),'required':[!![],_0xa9ae('0x11')]},'transferNumber':{'type':_0xa9ae('0xf'),'required':[!![],_0xa9ae('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa9ae('0xe')]},'sessionId':{'type':_0xa9ae('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa9ae('0xd'),'required':[!![],_0xa9ae('0xe')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa9ae('0xd'),'required':[!![],_0xa9ae('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xa9ae('0xd'),'required':[!![],_0xa9ae('0xe')]}});function emit(_0x77b0a4,_0xddb095,_0x524bb2){logger[_0xa9ae('0x13')](_0x77b0a4,_0xddb095,JSON[_0xa9ae('0x14')](_0x524bb2));io['to'](_0x77b0a4)[_0xa9ae('0x15')](_0xddb095,_0x524bb2);}function handleError(_0x4ac5a6){return function(_0x4dbb30){console[_0xa9ae('0x16')]('handleError:',_0x4dbb30,_0x4dbb30 instanceof RangeError);logger['error'](_0x4dbb30[_0xa9ae('0x17')]);if(_0x4dbb30 instanceof RangeError){if(_0x4dbb30[_0xa9ae('0x18')]){delete _0x4dbb30[_0xa9ae('0x18')];}_0x4ac5a6[_0xa9ae('0x19')](0x194)['send'](_0x4dbb30);}else{if(_0x4dbb30[_0xa9ae('0x18')]){delete _0x4dbb30[_0xa9ae('0x18')];}_0x4ac5a6[_0xa9ae('0x19')](0x1f4)[_0xa9ae('0x1a')](_0x4dbb30);}};}function checkError(){return function(_0x426317){if(!_0x426317){throw new RangeError(_0xa9ae('0x1b'));}return _0x426317;};}function respondWithRpcPromise(_0x971ee1,_0x5a062d){return new BPromise(function(_0xc021cf,_0x4ca9a9){var _0x49dca9=amiClient;return _0x49dca9['request'](_0x971ee1,_0x5a062d)['then'](function(_0x1afd07){if(_0x1afd07['error']){if(_0x1afd07[_0xa9ae('0x1c')]['code']===0x1f4){return _0x4ca9a9(_0x1afd07[_0xa9ae('0x1c')][_0xa9ae('0x1d')]);}return _0xc021cf(_0x1afd07[_0xa9ae('0x1c')][_0xa9ae('0x1d')]);}else{_0xc021cf(_0x1afd07[_0xa9ae('0x1e')]);}})[_0xa9ae('0x1f')](function(_0x23c1ec){_0x4ca9a9(_0x23c1ec);});});}function getAgent(_0x5e82f1){return db[_0xa9ae('0x20')][_0xa9ae('0x21')]({'where':{'id':_0x5e82f1,'role':_0xa9ae('0x22')}})[_0xa9ae('0x23')](checkError());}function getAgentCheckSession(_0x222db7,_0x428934){return new BPromise(function(_0xb12fa8,_0x5dfcd7){var _0x489e88=respondWithRpcPromise(_0xa9ae('0x24'));var _0x3c324e=getAgent(_0x222db7);Promise[_0xa9ae('0x25')]([_0x489e88,_0x3c324e])[_0xa9ae('0x23')](function(_0x74cd94){var _0x54a821=_0x74cd94[0x0];var _0x52dd4f=_0x74cd94[0x1];var _0x1892b5=_[_0xa9ae('0x26')](_0x54a821[_0xa9ae('0x27')],function(_0x3a48b7){return _0x3a48b7[_0xa9ae('0x28')]==_0x52dd4f['id']&&_0x3a48b7[_0xa9ae('0x29')]==_0x428934;});if(_0x1892b5['length']==0x1){_0xb12fa8(_0x52dd4f);}else{_0x5dfcd7(new RangeError('sessionId\x20'+_0x428934+_0xa9ae('0x2a')));}});});}exports[_0xa9ae('0x2b')]=function(_0x3d9b30,_0x3cd87a){logger[_0xa9ae('0x13')](_0xa9ae('0x2c'),_0x3d9b30[_0xa9ae('0x2d')]);var _0x3e2ec2=originateValidation['validate'](_0x3d9b30[_0xa9ae('0x2d')]);if(_0x3e2ec2['length']>0x0){return _0x3cd87a[_0xa9ae('0x19')](0x190)[_0xa9ae('0x2e')](_0x3e2ec2);}var _0x3a701b=_0x3d9b30['body'][_0xa9ae('0x2f')];var _0x3eb867=_0x3d9b30[_0xa9ae('0x2d')][_0xa9ae('0x30')];var _0x353227=_0x3d9b30['body'][_0xa9ae('0x31')];var _0xa0730a=_0x3d9b30[_0xa9ae('0x2d')]['callbackUrl'];return getAgent(_0x3a701b)['then'](function(_0x2155c8){logger[_0xa9ae('0x13')](_0xa9ae('0x32'),_0x2155c8[_0xa9ae('0x18')]);emit(util['format'](_0xa9ae('0x33'),_0x2155c8[_0xa9ae('0x18')]),_0xa9ae('0x34'),{'callNumber':_0x3eb867,'callerId':_0x353227,'callbackUrl':_0xa0730a});return _0x3cd87a[_0xa9ae('0x19')](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':'originate\x20executed!'});})[_0xa9ae('0x1f')](handleError(_0x3cd87a));};exports['hangup']=function(_0x26c8fb,_0x38f360){logger[_0xa9ae('0x13')]('hangup\x20fired:',_0x26c8fb[_0xa9ae('0x2d')]);var _0x1ffcab=hangupValidation[_0xa9ae('0xc')](_0x26c8fb['body']);if(_0x1ffcab[_0xa9ae('0x35')]>0x0){return _0x38f360[_0xa9ae('0x19')](0x190)['json'](_0x1ffcab);}var _0x2993b2=_0x26c8fb['body'][_0xa9ae('0x2f')];var _0x24c237=_0x26c8fb['body'][_0xa9ae('0x29')];return getAgent(_0x2993b2)[_0xa9ae('0x23')](function(_0x234da5){logger[_0xa9ae('0x13')](_0xa9ae('0x32'),_0x234da5[_0xa9ae('0x18')]);emit(util['format'](_0xa9ae('0x33'),_0x234da5[_0xa9ae('0x18')]),'webbar:hangup',{'sessionId':_0x24c237});return _0x38f360['status'](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':_0xa9ae('0x36')});})[_0xa9ae('0x1f')](handleError(_0x38f360));};exports[_0xa9ae('0x37')]=function(_0x4c110a,_0x1b0f5e){logger[_0xa9ae('0x13')](_0xa9ae('0x38'),_0x4c110a[_0xa9ae('0x2d')]);var _0x23c91d=answerValidation[_0xa9ae('0xc')](_0x4c110a[_0xa9ae('0x2d')]);if(_0x23c91d['length']>0x0){return _0x1b0f5e[_0xa9ae('0x19')](0x190)[_0xa9ae('0x2e')](_0x23c91d);}var _0x566cb0=_0x4c110a[_0xa9ae('0x2d')]['userId'];var _0xb51a6c=_0x4c110a[_0xa9ae('0x2d')][_0xa9ae('0x29')];return getAgent(_0x566cb0)[_0xa9ae('0x23')](function(_0x250d2b){logger[_0xa9ae('0x13')](_0xa9ae('0x32'),_0x250d2b['name']);emit(util[_0xa9ae('0x39')](_0xa9ae('0x33'),_0x250d2b['name']),_0xa9ae('0x3a'),{'sessionId':_0xb51a6c});return _0x1b0f5e[_0xa9ae('0x19')](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':_0xa9ae('0x3b')});})[_0xa9ae('0x1f')](handleError(_0x1b0f5e));};exports[_0xa9ae('0x3c')]=function(_0x571cb4,_0x1416a2){logger['info'](_0xa9ae('0x3d'),_0x571cb4[_0xa9ae('0x2d')]);var _0x52c6e9=holdValidation['validate'](_0x571cb4[_0xa9ae('0x2d')]);if(_0x52c6e9[_0xa9ae('0x35')]>0x0){return _0x1416a2[_0xa9ae('0x19')](0x190)[_0xa9ae('0x2e')](_0x52c6e9);}var _0x435c29=_0x571cb4[_0xa9ae('0x2d')][_0xa9ae('0x2f')];var _0x60342a=_0x571cb4['body']['sessionId'];return getAgent(_0x435c29)[_0xa9ae('0x23')](function(_0x3cf89c){logger['info'](_0xa9ae('0x32'),_0x3cf89c[_0xa9ae('0x18')]);emit(util[_0xa9ae('0x39')](_0xa9ae('0x33'),_0x3cf89c[_0xa9ae('0x18')]),_0xa9ae('0x3e'),{'sessionId':_0x60342a});return _0x1416a2[_0xa9ae('0x19')](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':'hold\x20executed!'});})[_0xa9ae('0x1f')](handleError(_0x1416a2));};exports[_0xa9ae('0x3f')]=function(_0x5ea18d,_0x128f88){logger['info']('unhold\x20fired:',_0x5ea18d['body']);var _0x3b8916=unholdValidation[_0xa9ae('0xc')](_0x5ea18d['body']);if(_0x3b8916['length']>0x0){return _0x128f88['status'](0x190)[_0xa9ae('0x2e')](_0x3b8916);}var _0x54c67c=_0x5ea18d[_0xa9ae('0x2d')][_0xa9ae('0x2f')];var _0x4e39d5=_0x5ea18d[_0xa9ae('0x2d')]['sessionId'];return getAgent(_0x54c67c)[_0xa9ae('0x23')](function(_0xade70a){logger[_0xa9ae('0x13')](_0xa9ae('0x32'),_0xade70a[_0xa9ae('0x18')]);emit(util[_0xa9ae('0x39')](_0xa9ae('0x33'),_0xade70a[_0xa9ae('0x18')]),_0xa9ae('0x40'),{'sessionId':_0x4e39d5});return _0x128f88[_0xa9ae('0x19')](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':_0xa9ae('0x41')});})['catch'](handleError(_0x128f88));};exports[_0xa9ae('0x42')]=function(_0x9e42b3,_0x24087a){logger[_0xa9ae('0x13')](_0xa9ae('0x43'),_0x24087a['body']);var _0x4fe9e7=callsValidation[_0xa9ae('0xc')](_0x9e42b3[_0xa9ae('0x2d')]);if(_0x4fe9e7['length']>0x0){return _0x24087a['status'](0x190)[_0xa9ae('0x2e')](_0x4fe9e7);}var _0x48637a=_0x9e42b3[_0xa9ae('0x2d')][_0xa9ae('0x2f')];var _0x1a1605=respondWithRpcPromise('VoiceChannels');var _0x36d844=getAgent(_0x48637a);return Promise['all']([_0x1a1605,_0x36d844])[_0xa9ae('0x23')](function(_0x56e847){var _0x157628=_0x56e847[0x0];var _0x38ad8f=_0x56e847[0x1];var _0x46ab4c=_[_0xa9ae('0x26')](_0x157628[_0xa9ae('0x27')],function(_0x44c3cc){return _0x44c3cc['UserId']==_0x38ad8f['id'];});return _0x24087a[_0xa9ae('0x19')](0xc8)[_0xa9ae('0x2e')]({'count':_0x46ab4c[_0xa9ae('0x35')],'rows':_0x46ab4c});})[_0xa9ae('0x1f')](handleError(_0x24087a));};exports['conference']=function(_0x2ebb14,_0x2803fb){logger[_0xa9ae('0x13')](_0xa9ae('0x44'),_0x2ebb14[_0xa9ae('0x2d')]);var _0x1f563a=conferenceValidation[_0xa9ae('0xc')](_0x2ebb14[_0xa9ae('0x2d')]);if(_0x1f563a[_0xa9ae('0x35')]>0x0){return _0x2803fb[_0xa9ae('0x19')](0x190)['json'](_0x1f563a);}var _0xc6b8a4=_0x2ebb14[_0xa9ae('0x2d')][_0xa9ae('0x2f')];return getAgent(_0xc6b8a4)[_0xa9ae('0x23')](function(_0x5b2f69){logger[_0xa9ae('0x13')](_0xa9ae('0x32'),_0x5b2f69['name']);emit(util[_0xa9ae('0x39')](_0xa9ae('0x33'),_0x5b2f69[_0xa9ae('0x18')]),'webbar:conference');return _0x2803fb['status'](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':_0xa9ae('0x45')});})['catch'](handleError(_0x2803fb));};exports['transfer']=function(_0x2369e4,_0x7d0c93){logger[_0xa9ae('0x13')]('transfer\x20fired:',_0x2369e4[_0xa9ae('0x2d')]);var _0x619ae4=transferValidation[_0xa9ae('0xc')](_0x2369e4[_0xa9ae('0x2d')]);if(_0x619ae4[_0xa9ae('0x35')]>0x0){return _0x7d0c93[_0xa9ae('0x19')](0x190)[_0xa9ae('0x2e')](_0x619ae4);}var _0x381298=_0x2369e4[_0xa9ae('0x2d')][_0xa9ae('0x2f')];var _0x53445e=_0x2369e4['body'][_0xa9ae('0x29')];var _0x1a632a=_0x2369e4[_0xa9ae('0x2d')]['transferNumber'];return getAgent(_0x381298)[_0xa9ae('0x23')](function(_0xf2cd59){logger[_0xa9ae('0x13')]('entityFound:',_0xf2cd59['name']);emit(util[_0xa9ae('0x39')]('user:%s',_0xf2cd59[_0xa9ae('0x18')]),_0xa9ae('0x46'),{'sessionId':_0x53445e,'transferNumber':_0x1a632a});return _0x7d0c93[_0xa9ae('0x19')](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':_0xa9ae('0x47')});})[_0xa9ae('0x1f')](handleError(_0x7d0c93));}; \ No newline at end of file +var _0x3140=['answer\x20executed!','hold','sessionId','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','all','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId','callNumber','callerId','entityFound:','format','originate\x20executed!','hangup\x20fired:','user:%s','webbar:hangup','answer','answer\x20fired:','webbar:answer'];(function(_0x1e7869,_0x5bfd26){var _0x32aafc=function(_0x1d5a5e){while(--_0x1d5a5e){_0x1e7869['push'](_0x1e7869['shift']());}};_0x32aafc(++_0x5bfd26);}(_0x3140,0xaf));var _0x0314=function(_0x111692,_0x19f8a9){_0x111692=_0x111692-0x0;var _0x11836f=_0x3140[_0x111692];return _0x11836f;};'use strict';var path=require(_0x0314('0x0'));var fs=require('fs');var _=require(_0x0314('0x1'));var db=require(_0x0314('0x2'))['db'];var config=require(_0x0314('0x3'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x0314('0x4'));var amiClient=jayson[_0x0314('0x5')][_0x0314('0x6')]({'port':0x232a});var logger=require(_0x0314('0x7'))(_0x0314('0x8'));var Redis=require(_0x0314('0x9'));config[_0x0314('0xa')]=_[_0x0314('0xb')](config[_0x0314('0xa')],{'host':_0x0314('0xc'),'port':0x18eb});var io=require(_0x0314('0xd'))(new Redis(config['redis']));var Schema=require(_0x0314('0xe'));var originateValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x0314('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x0314('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],_0x0314('0x12')]},'sessionId':{'type':_0x0314('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],_0x0314('0x12')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],_0x0314('0x12')]},'sessionId':{'type':_0x0314('0x11'),'required':[!![],_0x0314('0x13')]},'transferNumber':{'type':_0x0314('0x11'),'required':[!![],_0x0314('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x0314('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],_0x0314('0x12')]},'sessionId':{'type':_0x0314('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],_0x0314('0x12')]}});var conferenceValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],_0x0314('0x12')]}});function emit(_0x5e460f,_0xb9730b,_0x24cd42){logger[_0x0314('0x15')](_0x5e460f,_0xb9730b,JSON['stringify'](_0x24cd42));io['to'](_0x5e460f)[_0x0314('0x16')](_0xb9730b,_0x24cd42);}function handleError(_0x5f2e82){return function(_0x575b68){console[_0x0314('0x17')](_0x0314('0x18'),_0x575b68,_0x575b68 instanceof RangeError);logger['error'](_0x575b68[_0x0314('0x19')]);if(_0x575b68 instanceof RangeError){if(_0x575b68[_0x0314('0x1a')]){delete _0x575b68['name'];}_0x5f2e82[_0x0314('0x1b')](0x194)['send'](_0x575b68);}else{if(_0x575b68[_0x0314('0x1a')]){delete _0x575b68[_0x0314('0x1a')];}_0x5f2e82[_0x0314('0x1b')](0x1f4)[_0x0314('0x1c')](_0x575b68);}};}function checkError(){return function(_0x3bdb1){if(!_0x3bdb1){throw new RangeError(_0x0314('0x1d'));}return _0x3bdb1;};}function respondWithRpcPromise(_0x4d3bc6,_0x56ef33){return new BPromise(function(_0x20305b,_0xbd3ad0){var _0x1945f8=amiClient;return _0x1945f8[_0x0314('0x1e')](_0x4d3bc6,_0x56ef33)[_0x0314('0x1f')](function(_0xd7638b){if(_0xd7638b['error']){if(_0xd7638b[_0x0314('0x20')][_0x0314('0x21')]===0x1f4){return _0xbd3ad0(_0xd7638b['error'][_0x0314('0x22')]);}return _0x20305b(_0xd7638b[_0x0314('0x20')][_0x0314('0x22')]);}else{_0x20305b(_0xd7638b[_0x0314('0x23')]);}})[_0x0314('0x24')](function(_0x3af9d3){_0xbd3ad0(_0x3af9d3);});});}function getAgent(_0x5d5b13){return db[_0x0314('0x25')][_0x0314('0x26')]({'where':{'id':_0x5d5b13,'role':_0x0314('0x27')}})['then'](checkError());}function getAgentCheckSession(_0x29b4b5,_0x5e3eba){return new BPromise(function(_0x47c102,_0x5da2c7){var _0x2fc520=respondWithRpcPromise(_0x0314('0x28'));var _0x550dc4=getAgent(_0x29b4b5);Promise[_0x0314('0x29')]([_0x2fc520,_0x550dc4])[_0x0314('0x1f')](function(_0x5291c2){var _0x547ab3=_0x5291c2[0x0];var _0x15fbfb=_0x5291c2[0x1];var _0x345cef=_['filter'](_0x547ab3[_0x0314('0x2a')],function(_0x16e74a){return _0x16e74a[_0x0314('0x2b')]==_0x15fbfb['id']&&_0x16e74a['sessionId']==_0x5e3eba;});if(_0x345cef[_0x0314('0x2c')]==0x1){_0x47c102(_0x15fbfb);}else{_0x5da2c7(new RangeError(_0x0314('0x2d')+_0x5e3eba+_0x0314('0x2e')));}});});}exports[_0x0314('0x2f')]=function(_0x549b0b,_0x1d01b5){logger['info']('originate\x20fired:',_0x549b0b[_0x0314('0x30')]);var _0x14d3b4=originateValidation[_0x0314('0xe')](_0x549b0b['body']);if(_0x14d3b4[_0x0314('0x2c')]>0x0){return _0x1d01b5['status'](0x190)[_0x0314('0x31')](_0x14d3b4);}var _0x5a0767=_0x549b0b['body'][_0x0314('0x32')];var _0x5d3b0e=_0x549b0b[_0x0314('0x30')][_0x0314('0x33')];var _0x2990ea=_0x549b0b[_0x0314('0x30')][_0x0314('0x34')];var _0x1a9ff7=_0x549b0b[_0x0314('0x30')]['callbackUrl'];return getAgent(_0x5a0767)[_0x0314('0x1f')](function(_0x28c6d0){logger[_0x0314('0x15')](_0x0314('0x35'),_0x28c6d0[_0x0314('0x1a')]);emit(util[_0x0314('0x36')]('user:%s',_0x28c6d0[_0x0314('0x1a')]),'webbar:originate',{'callNumber':_0x5d3b0e,'callerId':_0x2990ea,'callbackUrl':_0x1a9ff7});return _0x1d01b5[_0x0314('0x1b')](0xc8)['json']({'error':![],'message':_0x0314('0x37')});})['catch'](handleError(_0x1d01b5));};exports['hangup']=function(_0x58c701,_0x1765d7){logger[_0x0314('0x15')](_0x0314('0x38'),_0x58c701[_0x0314('0x30')]);var _0x986315=hangupValidation['validate'](_0x58c701[_0x0314('0x30')]);if(_0x986315[_0x0314('0x2c')]>0x0){return _0x1765d7[_0x0314('0x1b')](0x190)['json'](_0x986315);}var _0x273f2c=_0x58c701['body'][_0x0314('0x32')];var _0x5b034a=_0x58c701[_0x0314('0x30')]['sessionId'];return getAgent(_0x273f2c)['then'](function(_0x370539){logger[_0x0314('0x15')]('entityFound:',_0x370539[_0x0314('0x1a')]);emit(util['format'](_0x0314('0x39'),_0x370539[_0x0314('0x1a')]),_0x0314('0x3a'),{'sessionId':_0x5b034a});return _0x1765d7[_0x0314('0x1b')](0xc8)[_0x0314('0x31')]({'error':![],'message':'hangup\x20executed!'});})[_0x0314('0x24')](handleError(_0x1765d7));};exports[_0x0314('0x3b')]=function(_0x3b070a,_0x5f33cd){logger[_0x0314('0x15')](_0x0314('0x3c'),_0x3b070a[_0x0314('0x30')]);var _0x599473=answerValidation[_0x0314('0xe')](_0x3b070a['body']);if(_0x599473[_0x0314('0x2c')]>0x0){return _0x5f33cd[_0x0314('0x1b')](0x190)[_0x0314('0x31')](_0x599473);}var _0x583aba=_0x3b070a[_0x0314('0x30')][_0x0314('0x32')];var _0x588e65=_0x3b070a['body']['sessionId'];return getAgent(_0x583aba)[_0x0314('0x1f')](function(_0x70bcd){logger[_0x0314('0x15')]('entityFound:',_0x70bcd[_0x0314('0x1a')]);emit(util[_0x0314('0x36')](_0x0314('0x39'),_0x70bcd[_0x0314('0x1a')]),_0x0314('0x3d'),{'sessionId':_0x588e65});return _0x5f33cd['status'](0xc8)[_0x0314('0x31')]({'error':![],'message':_0x0314('0x3e')});})[_0x0314('0x24')](handleError(_0x5f33cd));};exports[_0x0314('0x3f')]=function(_0x1b7292,_0x209ea9){logger[_0x0314('0x15')]('hold\x20fired:',_0x1b7292[_0x0314('0x30')]);var _0x1d72f6=holdValidation['validate'](_0x1b7292[_0x0314('0x30')]);if(_0x1d72f6[_0x0314('0x2c')]>0x0){return _0x209ea9[_0x0314('0x1b')](0x190)['json'](_0x1d72f6);}var _0x4a1850=_0x1b7292[_0x0314('0x30')][_0x0314('0x32')];var _0x2cbed3=_0x1b7292[_0x0314('0x30')][_0x0314('0x40')];return getAgent(_0x4a1850)[_0x0314('0x1f')](function(_0x36a72a){logger['info'](_0x0314('0x35'),_0x36a72a['name']);emit(util[_0x0314('0x36')](_0x0314('0x39'),_0x36a72a[_0x0314('0x1a')]),_0x0314('0x41'),{'sessionId':_0x2cbed3});return _0x209ea9[_0x0314('0x1b')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0x0314('0x24')](handleError(_0x209ea9));};exports[_0x0314('0x42')]=function(_0x20070c,_0x26ecb7){logger['info'](_0x0314('0x43'),_0x20070c[_0x0314('0x30')]);var _0x2b601a=unholdValidation[_0x0314('0xe')](_0x20070c[_0x0314('0x30')]);if(_0x2b601a[_0x0314('0x2c')]>0x0){return _0x26ecb7[_0x0314('0x1b')](0x190)['json'](_0x2b601a);}var _0x28ca8f=_0x20070c[_0x0314('0x30')][_0x0314('0x32')];var _0x577a91=_0x20070c[_0x0314('0x30')][_0x0314('0x40')];return getAgent(_0x28ca8f)['then'](function(_0x92cb75){logger[_0x0314('0x15')](_0x0314('0x35'),_0x92cb75[_0x0314('0x1a')]);emit(util['format'](_0x0314('0x39'),_0x92cb75[_0x0314('0x1a')]),_0x0314('0x44'),{'sessionId':_0x577a91});return _0x26ecb7[_0x0314('0x1b')](0xc8)[_0x0314('0x31')]({'error':![],'message':_0x0314('0x45')});})[_0x0314('0x24')](handleError(_0x26ecb7));};exports[_0x0314('0x46')]=function(_0x166154,_0xa8dc19){logger['info'](_0x0314('0x47'),_0xa8dc19[_0x0314('0x30')]);var _0xf29a33=callsValidation[_0x0314('0xe')](_0x166154[_0x0314('0x30')]);if(_0xf29a33[_0x0314('0x2c')]>0x0){return _0xa8dc19[_0x0314('0x1b')](0x190)['json'](_0xf29a33);}var _0x5c4e26=_0x166154['body'][_0x0314('0x32')];var _0x3c292c=respondWithRpcPromise('VoiceChannels');var _0xda9a80=getAgent(_0x5c4e26);return Promise[_0x0314('0x29')]([_0x3c292c,_0xda9a80])[_0x0314('0x1f')](function(_0x4b35d8){var _0x50e8dc=_0x4b35d8[0x0];var _0x2e29ce=_0x4b35d8[0x1];var _0x40a4d8=_['filter'](_0x50e8dc[_0x0314('0x2a')],function(_0x4b022a){return _0x4b022a[_0x0314('0x2b')]==_0x2e29ce['id'];});return _0xa8dc19[_0x0314('0x1b')](0xc8)[_0x0314('0x31')]({'count':_0x40a4d8[_0x0314('0x2c')],'rows':_0x40a4d8});})['catch'](handleError(_0xa8dc19));};exports[_0x0314('0x48')]=function(_0x3fc295,_0x549f4c){logger['info'](_0x0314('0x49'),_0x3fc295[_0x0314('0x30')]);var _0x1cca34=conferenceValidation[_0x0314('0xe')](_0x3fc295[_0x0314('0x30')]);if(_0x1cca34[_0x0314('0x2c')]>0x0){return _0x549f4c[_0x0314('0x1b')](0x190)['json'](_0x1cca34);}var _0x340676=_0x3fc295['body']['userId'];return getAgent(_0x340676)[_0x0314('0x1f')](function(_0x5521dd){logger[_0x0314('0x15')](_0x0314('0x35'),_0x5521dd[_0x0314('0x1a')]);emit(util[_0x0314('0x36')](_0x0314('0x39'),_0x5521dd[_0x0314('0x1a')]),_0x0314('0x4a'));return _0x549f4c[_0x0314('0x1b')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x0314('0x24')](handleError(_0x549f4c));};exports[_0x0314('0x4b')]=function(_0xf480fe,_0x582451){logger['info']('transfer\x20fired:',_0xf480fe[_0x0314('0x30')]);var _0x17dbb9=transferValidation['validate'](_0xf480fe[_0x0314('0x30')]);if(_0x17dbb9[_0x0314('0x2c')]>0x0){return _0x582451[_0x0314('0x1b')](0x190)[_0x0314('0x31')](_0x17dbb9);}var _0x19d14b=_0xf480fe[_0x0314('0x30')]['userId'];var _0x41ec80=_0xf480fe[_0x0314('0x30')][_0x0314('0x40')];var _0x5a69ac=_0xf480fe[_0x0314('0x30')][_0x0314('0x4c')];return getAgent(_0x19d14b)[_0x0314('0x1f')](function(_0x51632e){logger[_0x0314('0x15')](_0x0314('0x35'),_0x51632e['name']);emit(util[_0x0314('0x36')](_0x0314('0x39'),_0x51632e[_0x0314('0x1a')]),_0x0314('0x4d'),{'sessionId':_0x41ec80,'transferNumber':_0x5a69ac});return _0x582451[_0x0314('0x1b')](0xc8)['json']({'error':![],'message':_0x0314('0x4e')});})[_0x0314('0x24')](handleError(_0x582451));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 386f329..b3c4a30 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 _0xd4a2=['../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/canned_answers','addAnswer','addAgents','notify','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','multer','connect-timeout','Router'];(function(_0x447f70,_0x480a9b){var _0x735e8b=function(_0x1f4915){while(--_0x1f4915){_0x447f70['push'](_0x447f70['shift']());}};_0x735e8b(++_0x480a9b);}(_0xd4a2,0x173));var _0x2d4a=function(_0x3c5960,_0x2999c3){_0x3c5960=_0x3c5960-0x0;var _0x3bb77c=_0xd4a2[_0x3c5960];return _0x3bb77c;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0x6')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0x6')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0x6')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x2d4a('0xf')]);router['get'](_0x2d4a('0x10'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x11')]);router[_0x2d4a('0x6')](_0x2d4a('0x12'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x13')]);router[_0x2d4a('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2d4a('0x14')]('/:id/dispositions',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x15')]);router[_0x2d4a('0x14')](_0x2d4a('0x16'),auth['isAuthenticated'](),controller[_0x2d4a('0x17')]);router['post'](_0x2d4a('0x10'),auth['isAuthenticated'](),controller[_0x2d4a('0x18')]);router[_0x2d4a('0x14')](_0x2d4a('0x12'),auth[_0x2d4a('0x7')](),controller['addApplications']);router['post']('/:id/notify',controller[_0x2d4a('0x19')]);router[_0x2d4a('0x14')](_0x2d4a('0x1a'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x1b')]);router[_0x2d4a('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x2d4a('0x1d')]);router[_0x2d4a('0x1e')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x1f')]);router[_0x2d4a('0x1e')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller['removeDispositions']);router[_0x2d4a('0x1e')](_0x2d4a('0x16'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x20')]);router[_0x2d4a('0x1e')](_0x2d4a('0x10'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x21')]);module['exports']=router; \ No newline at end of file +var _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','post','/:id/canned_answers','/:id/users','addAgents','/:id/notify','notify','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x2f938f,_0x923379){var _0x360c98=function(_0x13ddf6){while(--_0x13ddf6){_0x2f938f['push'](_0x2f938f['shift']());}};_0x360c98(++_0x923379);}(_0x9f0e,0x116));var _0xe9f0=function(_0x1bcd0f,_0x2da858){_0x1bcd0f=_0x1bcd0f-0x0;var _0x3f1eca=_0x9f0e[_0x1bcd0f];return _0x3f1eca;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0x9')](_0xe9f0('0xe'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x9')]('/:id/canned_answers',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x10')]);router[_0xe9f0('0x9')]('/:id/users',auth[_0xe9f0('0xb')](),controller['getAgents']);router[_0xe9f0('0x9')](_0xe9f0('0x11'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x12')]);router['post']('/',auth[_0xe9f0('0xb')](),controller['create']);router[_0xe9f0('0x13')](_0xe9f0('0xe'),auth[_0xe9f0('0xb')](),controller['addDisposition']);router[_0xe9f0('0x13')](_0xe9f0('0x14'),auth[_0xe9f0('0xb')](),controller['addAnswer']);router[_0xe9f0('0x13')](_0xe9f0('0x15'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x16')]);router[_0xe9f0('0x13')](_0xe9f0('0x11'),auth[_0xe9f0('0xb')](),controller['addApplications']);router[_0xe9f0('0x13')](_0xe9f0('0x17'),controller[_0xe9f0('0x18')]);router['post'](_0xe9f0('0x19'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x1a')]);router[_0xe9f0('0x1b')]('/:id',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x1c')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe9f0('0x1d')]);router[_0xe9f0('0x1e')](_0xe9f0('0xe'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x1f')]);router['delete'](_0xe9f0('0x14'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x20')]);router[_0xe9f0('0x1e')](_0xe9f0('0x15'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x21')]);module[_0xe9f0('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index d788fe4..4b38943 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 _0x9b21=['sinch','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','ENUM','twilio'];(function(_0x3f70cd,_0x6bf4ed){var _0x3feb93=function(_0x4a045a){while(--_0x4a045a){_0x3f70cd['push'](_0x3f70cd['shift']());}};_0x3feb93(++_0x6bf4ed);}(_0x9b21,0x1e9));var _0x19b2=function(_0x1128db,_0x314e95){_0x1128db=_0x1128db-0x0;var _0x1cf3f1=_0x9b21[_0x1128db];return _0x1cf3f1;};'use strict';var Sequelize=require(_0x19b2('0x0'));var rs=require(_0x19b2('0x1'));module[_0x19b2('0x2')]={'name':{'type':Sequelize[_0x19b2('0x3')],'unique':_0x19b2('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x19b2('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x19b2('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x19b2('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x19b2('0x3')]},'type':{'type':Sequelize[_0x19b2('0x5')](_0x19b2('0x6'),_0x19b2('0x7'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x19b2('0x3')]},'authToken':{'type':Sequelize[_0x19b2('0x3')]},'notificationTemplate':{'type':Sequelize[_0x19b2('0x8')],'defaultValue':function(){return _0x19b2('0x9');}},'notificationSound':{'type':Sequelize[_0x19b2('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x19b2('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x19b2('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x19b2('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x19b2('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x19b2('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x19b2('0xb')],'comment':_0x19b2('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x19b2('0xa')],'defaultValue':![],'comment':_0x19b2('0xd'),'set':function(_0x249ec9){if(!_0x249ec9){this[_0x19b2('0xe')](_0x19b2('0xf'),null);}this[_0x19b2('0xe')]('mandatoryDisposition',_0x249ec9);}},'description':{'type':Sequelize[_0x19b2('0x3')]}}; \ No newline at end of file +var _0x6a23=['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','STRING','name','twilio','sinch'];(function(_0x16051a,_0x5e4326){var _0x35d20d=function(_0x52b02e){while(--_0x52b02e){_0x16051a['push'](_0x16051a['shift']());}};_0x35d20d(++_0x5e4326);}(_0x6a23,0xbd));var _0x36a2=function(_0x2fcf18,_0x10009a){_0x2fcf18=_0x2fcf18-0x0;var _0x4c68cc=_0x6a23[_0x2fcf18];return _0x4c68cc;};'use strict';var Sequelize=require(_0x36a2('0x0'));var rs=require(_0x36a2('0x1'));module[_0x36a2('0x2')]={'name':{'type':Sequelize[_0x36a2('0x3')],'unique':_0x36a2('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x36a2('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x36a2('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x36a2('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x36a2('0x3')]},'type':{'type':Sequelize['ENUM'](_0x36a2('0x5'),_0x36a2('0x6'))},'accountSid':{'type':Sequelize[_0x36a2('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x36a2('0x7')],'defaultValue':function(){return _0x36a2('0x8');}},'notificationSound':{'type':Sequelize[_0x36a2('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x36a2('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x36a2('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x36a2('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x36a2('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x36a2('0xa')],'comment':_0x36a2('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x36a2('0x9')],'defaultValue':![],'comment':_0x36a2('0xc'),'set':function(_0x2ff0ba){if(!_0x2ff0ba){this[_0x36a2('0xd')]('mandatoryDispositionPauseId',null);}this[_0x36a2('0xd')]('mandatoryDisposition',_0x2ff0ba);}},'description':{'type':Sequelize[_0x36a2('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index fdaf424..9da3682 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 _0xf2c8=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','options','removeDispositions','ids','WhatsappAccountId','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','sendStatus','getApplications','notify','whatsapp','Applications','account','state','WhatsappMessage','statuses','timestamp','json','applications','orderBy','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','sinch','notifications','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','Contacts','contact','WhatsappInteraction','interaction','created','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','ListId','out','Messages','dataValues','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','offset','undefined','limit','count','set','update','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','map','WhatsappAccount','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf2c8,0x1ef));var _0x8f2c=function(_0x148cce,_0x4ca48c){_0x148cce=_0x148cce-0x0;var _0x52c017=_0xf2c8[_0x148cce];return _0x52c017;};'use strict';var emlformat=require(_0x8f2c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8f2c('0x1'));var moment=require(_0x8f2c('0x2'));var BPromise=require(_0x8f2c('0x3'));var Mustache=require(_0x8f2c('0x4'));var util=require(_0x8f2c('0x5'));var path=require(_0x8f2c('0x6'));var sox=require(_0x8f2c('0x7'));var csv=require(_0x8f2c('0x8'));var ejs=require(_0x8f2c('0x9'));var fs=require('fs');var fs_extra=require(_0x8f2c('0xa'));var _=require('lodash');var squel=require(_0x8f2c('0xb'));var crypto=require(_0x8f2c('0xc'));var jsforce=require(_0x8f2c('0xd'));var deskjs=require(_0x8f2c('0xe'));var toCsv=require(_0x8f2c('0x8'));var querystring=require(_0x8f2c('0xf'));var Papa=require(_0x8f2c('0x10'));var Redis=require(_0x8f2c('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f2c('0x12'))(_0x8f2c('0x13'));var utils=require(_0x8f2c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8f2c('0x15'));var db=require(_0x8f2c('0x16'))['db'];config[_0x8f2c('0x17')]=_[_0x8f2c('0x18')](config[_0x8f2c('0x17')],{'host':_0x8f2c('0x19'),'port':0x18eb});var socket=require(_0x8f2c('0x1a'))(new Redis(config[_0x8f2c('0x17')]));require(_0x8f2c('0x1b'))[_0x8f2c('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8f2c('0x1d')][_0x8f2c('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x163616,_0x4f523c,_0x12cce9,_0x496f1f){return new BPromise(function(_0x52dd9b,_0x54c826){var _0x1a8fbd=_0x496f1f||client;return _0x1a8fbd['request'](_0x163616,_0x12cce9)['then'](function(_0x531a1d){logger[_0x8f2c('0x1f')](_0x8f2c('0x20'),_0x4f523c,_0x8f2c('0x21'));logger[_0x8f2c('0x22')](_0x8f2c('0x23'),_0x4f523c,_0x8f2c('0x21'),JSON['stringify'](_0x531a1d));if(_0x531a1d[_0x8f2c('0x24')]){if(_0x531a1d[_0x8f2c('0x24')][_0x8f2c('0x25')]===0x1f4){logger[_0x8f2c('0x24')](_0x8f2c('0x20'),_0x4f523c,_0x531a1d[_0x8f2c('0x24')][_0x8f2c('0x26')]);return _0x54c826(_0x531a1d[_0x8f2c('0x24')][_0x8f2c('0x26')]);}logger['error'](_0x8f2c('0x20'),_0x4f523c,_0x531a1d[_0x8f2c('0x24')][_0x8f2c('0x26')]);return _0x52dd9b(_0x531a1d[_0x8f2c('0x24')][_0x8f2c('0x26')]);}else{logger[_0x8f2c('0x1f')](_0x8f2c('0x20'),_0x4f523c,_0x8f2c('0x21'));_0x52dd9b(_0x531a1d[_0x8f2c('0x27')][_0x8f2c('0x26')]);}})[_0x8f2c('0x28')](function(_0x183d12){logger['error'](_0x8f2c('0x20'),_0x4f523c,_0x183d12);_0x54c826(_0x183d12);});});}function respondWithStatusCode(_0x49ba75,_0x280a0f){_0x280a0f=_0x280a0f||0xcc;return function(_0x54b554){if(_0x54b554){return _0x49ba75['sendStatus'](_0x280a0f);}return _0x49ba75[_0x8f2c('0x29')](_0x280a0f)[_0x8f2c('0x2a')]();};}function respondWithResult(_0x24c807,_0x581556){_0x581556=_0x581556||0xc8;return function(_0x44f13d){if(_0x44f13d){return _0x24c807['status'](_0x581556)['json'](_0x44f13d);}};}function respondWithFilteredResult(_0x2cd127,_0x29c1af){return function(_0x1fe74f){if(_0x1fe74f){var _0x251167=typeof _0x29c1af[_0x8f2c('0x2b')]===_0x8f2c('0x2c')&&typeof _0x29c1af[_0x8f2c('0x2d')]===_0x8f2c('0x2c');var _0x1b0cc0=_0x1fe74f[_0x8f2c('0x2e')];var _0x352fa3=_0x251167?0x0:_0x29c1af[_0x8f2c('0x2b')];var _0x5375c2=_0x251167?_0x1fe74f[_0x8f2c('0x2e')]:_0x29c1af['offset']+_0x29c1af[_0x8f2c('0x2d')];var _0x595c82;if(_0x5375c2>=_0x1b0cc0){_0x5375c2=_0x1b0cc0;_0x595c82=0xc8;}else{_0x595c82=0xce;}_0x2cd127[_0x8f2c('0x29')](_0x595c82);return _0x2cd127[_0x8f2c('0x2f')]('Content-Range',_0x352fa3+'-'+_0x5375c2+'/'+_0x1b0cc0)['json'](_0x1fe74f);}return null;};}function patchUpdates(_0x244248){return function(_0x5f2f55){try{jsonpatch['apply'](_0x5f2f55,_0x244248,!![]);}catch(_0x16a174){return BPromise['reject'](_0x16a174);}return _0x5f2f55['save']();};}function saveUpdates(_0x11e271,_0x4f523d){return function(_0x29ca2f){if(_0x29ca2f){return _0x29ca2f[_0x8f2c('0x30')](_0x11e271)[_0x8f2c('0x31')](function(_0x48d9da){return _0x48d9da;});}return null;};}function removeEntity(_0x219b47,_0x6ae881){return function(_0x3f85b1){if(_0x3f85b1){return _0x3f85b1[_0x8f2c('0x32')]()[_0x8f2c('0x31')](function(){var _0x3ce652=_0x3f85b1[_0x8f2c('0x33')]({'plain':!![]});var _0x23bc14=_0x8f2c('0x34');return db[_0x8f2c('0x35')][_0x8f2c('0x32')]({'where':{'type':_0x23bc14,'resourceId':_0x3ce652['id']}})[_0x8f2c('0x31')](function(){return _0x3f85b1;});})['then'](function(){_0x219b47[_0x8f2c('0x29')](0xcc)[_0x8f2c('0x2a')]();});}};}function handleEntityNotFound(_0xae5c2e,_0x5760dc){return function(_0x16abc1){if(!_0x16abc1){_0xae5c2e['sendStatus'](0x194);}return _0x16abc1;};}function handleError(_0x56bfac,_0x2ee156){_0x2ee156=_0x2ee156||0x1f4;return function(_0x361a75){logger[_0x8f2c('0x24')](_0x361a75[_0x8f2c('0x36')]);if(_0x361a75[_0x8f2c('0x37')]){delete _0x361a75[_0x8f2c('0x37')];}_0x56bfac['status'](_0x2ee156)[_0x8f2c('0x38')](_0x361a75);};}exports[_0x8f2c('0x39')]=function(_0x273c59,_0x5830e7){var _0x58927e={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2c32d9={},_0x28b1f8={'count':0x0,'rows':[]};var _0x17a22f=_[_0x8f2c('0x3a')](db[_0x8f2c('0x3b')]['rawAttributes'],function(_0x51c5ab){return{'name':_0x51c5ab['fieldName'],'type':_0x51c5ab[_0x8f2c('0x3c')][_0x8f2c('0x3d')]};});_0x2c32d9[_0x8f2c('0x3e')]=_[_0x8f2c('0x3a')](_0x17a22f,_0x8f2c('0x37'));_0x2c32d9[_0x8f2c('0x3f')]=_['keys'](_0x273c59['query']);_0x2c32d9[_0x8f2c('0x40')]=_['intersection'](_0x2c32d9[_0x8f2c('0x3e')],_0x2c32d9[_0x8f2c('0x3f')]);_0x58927e[_0x8f2c('0x41')]=_[_0x8f2c('0x42')](_0x2c32d9[_0x8f2c('0x3e')],qs[_0x8f2c('0x43')](_0x273c59[_0x8f2c('0x3f')][_0x8f2c('0x43')]));_0x58927e[_0x8f2c('0x41')]=_0x58927e[_0x8f2c('0x41')][_0x8f2c('0x44')]?_0x58927e['attributes']:_0x2c32d9[_0x8f2c('0x3e')];if(!_0x273c59['query']['hasOwnProperty']('nolimit')){_0x58927e[_0x8f2c('0x2d')]=qs[_0x8f2c('0x2d')](_0x273c59[_0x8f2c('0x3f')]['limit']);_0x58927e[_0x8f2c('0x2b')]=qs['offset'](_0x273c59[_0x8f2c('0x3f')]['offset']);}_0x58927e[_0x8f2c('0x45')]=qs[_0x8f2c('0x46')](_0x273c59[_0x8f2c('0x3f')][_0x8f2c('0x46')]);_0x58927e[_0x8f2c('0x47')]=qs[_0x8f2c('0x40')](_[_0x8f2c('0x48')](_0x273c59[_0x8f2c('0x3f')],_0x2c32d9[_0x8f2c('0x40')]),_0x17a22f);if(_0x273c59[_0x8f2c('0x3f')][_0x8f2c('0x49')]){_0x58927e[_0x8f2c('0x47')]=_[_0x8f2c('0x4a')](_0x58927e[_0x8f2c('0x47')],{'$or':_[_0x8f2c('0x3a')](_0x17a22f,function(_0x36b361){if(_0x36b361[_0x8f2c('0x3c')]!==_0x8f2c('0x4b')){var _0x20062d={};_0x20062d[_0x36b361[_0x8f2c('0x37')]]={'$like':'%'+_0x273c59[_0x8f2c('0x3f')][_0x8f2c('0x49')]+'%'};return _0x20062d;}})});}_0x58927e=_[_0x8f2c('0x4a')]({},_0x58927e,_0x273c59['options']);var _0x52fead={'where':_0x58927e[_0x8f2c('0x47')]};return db['WhatsappAccount'][_0x8f2c('0x2e')](_0x52fead)[_0x8f2c('0x31')](function(_0x2c9127){_0x28b1f8[_0x8f2c('0x2e')]=_0x2c9127;if(_0x273c59[_0x8f2c('0x3f')][_0x8f2c('0x4c')]){_0x58927e[_0x8f2c('0x4d')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x8f2c('0x4e')](_0x58927e);})[_0x8f2c('0x31')](function(_0x149338){_0x28b1f8[_0x8f2c('0x4f')]=_0x149338;return _0x28b1f8;})[_0x8f2c('0x31')](respondWithFilteredResult(_0x5830e7,_0x58927e))['catch'](handleError(_0x5830e7,null));};exports[_0x8f2c('0x50')]=function(_0x51c602,_0x41272c){var _0x4c7005={'raw':![],'where':{'id':_0x51c602[_0x8f2c('0x51')]['id']},'include':[{'model':db['Pause'],'as':_0x8f2c('0x52')}]},_0x34961a={};_0x34961a[_0x8f2c('0x3e')]=_['keys'](db[_0x8f2c('0x3b')][_0x8f2c('0x53')]);_0x34961a[_0x8f2c('0x3f')]=_[_0x8f2c('0x54')](_0x51c602[_0x8f2c('0x3f')]);_0x34961a[_0x8f2c('0x40')]=_[_0x8f2c('0x42')](_0x34961a[_0x8f2c('0x3e')],_0x34961a[_0x8f2c('0x3f')]);_0x4c7005[_0x8f2c('0x41')]=_[_0x8f2c('0x42')](_0x34961a['model'],qs['fields'](_0x51c602[_0x8f2c('0x3f')][_0x8f2c('0x43')]));_0x4c7005[_0x8f2c('0x41')]=_0x4c7005[_0x8f2c('0x41')][_0x8f2c('0x44')]?_0x4c7005['attributes']:_0x34961a[_0x8f2c('0x3e')];if(_0x51c602[_0x8f2c('0x3f')][_0x8f2c('0x4c')]){_0x4c7005['include']=[{'all':!![]}];}_0x4c7005=_[_0x8f2c('0x4a')]({},_0x4c7005,_0x51c602['options']);return db[_0x8f2c('0x3b')][_0x8f2c('0x55')](_0x4c7005)[_0x8f2c('0x31')](handleEntityNotFound(_0x41272c,null))[_0x8f2c('0x31')](respondWithResult(_0x41272c,null))[_0x8f2c('0x28')](handleError(_0x41272c,null));};exports[_0x8f2c('0x56')]=function(_0x375470,_0x6b2bda){return db[_0x8f2c('0x3b')][_0x8f2c('0x56')](_0x375470['body'],{})['then'](function(_0x2e263e){var _0x69a323=_0x375470[_0x8f2c('0x57')]['get']({'plain':!![]});if(!_0x69a323)throw new Error(_0x8f2c('0x58'));if(_0x69a323[_0x8f2c('0x59')]===_0x8f2c('0x57')){var _0x2101a0=_0x2e263e[_0x8f2c('0x33')]({'plain':!![]});var _0x504a88=_0x8f2c('0x34');return db[_0x8f2c('0x5a')][_0x8f2c('0x55')]({'where':{'name':_0x504a88,'userProfileId':_0x69a323[_0x8f2c('0x5b')]},'raw':!![]})[_0x8f2c('0x31')](function(_0x5f2784){if(_0x5f2784&&_0x5f2784[_0x8f2c('0x5c')]===0x0){return db[_0x8f2c('0x35')][_0x8f2c('0x56')]({'name':_0x2101a0[_0x8f2c('0x37')],'resourceId':_0x2101a0['id'],'type':_0x5f2784[_0x8f2c('0x37')],'sectionId':_0x5f2784['id']},{})['then'](function(){return _0x2e263e;});}else{return _0x2e263e;}})['catch'](function(_0x1db79c){logger[_0x8f2c('0x24')](_0x8f2c('0x5d'),_0x1db79c);throw _0x1db79c;});}return _0x2e263e;})[_0x8f2c('0x31')](respondWithResult(_0x6b2bda,0xc9))[_0x8f2c('0x28')](handleError(_0x6b2bda,null));};exports['update']=function(_0x3d253c,_0x136482){if(_0x3d253c['body']['id']){delete _0x3d253c[_0x8f2c('0x5e')]['id'];}return db[_0x8f2c('0x3b')]['find']({'where':{'id':_0x3d253c['params']['id']},'include':[{'model':db[_0x8f2c('0x5f')],'as':_0x8f2c('0x52')}]})[_0x8f2c('0x31')](handleEntityNotFound(_0x136482,null))['then'](saveUpdates(_0x3d253c[_0x8f2c('0x5e')],null))[_0x8f2c('0x31')](respondWithResult(_0x136482,null))['catch'](handleError(_0x136482,null));};exports[_0x8f2c('0x32')]=function(_0x534f62,_0x35a0bb){return db[_0x8f2c('0x3b')][_0x8f2c('0x55')]({'where':{'id':_0x534f62[_0x8f2c('0x51')]['id']}})['then'](handleEntityNotFound(_0x35a0bb,null))[_0x8f2c('0x31')](removeEntity(_0x35a0bb,null))[_0x8f2c('0x28')](handleError(_0x35a0bb,null));};exports[_0x8f2c('0x60')]=function(_0x5b0734,_0x2207ad){return db['WhatsappAccount']['describe']()['then'](respondWithResult(_0x2207ad,null))['catch'](handleError(_0x2207ad,null));};exports[_0x8f2c('0x61')]=function(_0x1235de,_0x49f18c,_0xac6372){if(_0x1235de[_0x8f2c('0x5e')]['id']){delete _0x1235de[_0x8f2c('0x5e')]['id'];}return db[_0x8f2c('0x3b')]['find']({'where':{'id':_0x1235de['params']['id']}})[_0x8f2c('0x31')](handleEntityNotFound(_0x49f18c,null))[_0x8f2c('0x31')](function(_0x41ea3){if(_0x41ea3){_0x1235de[_0x8f2c('0x5e')]['WhatsappAccountId']=_0x41ea3['id'];return db[_0x8f2c('0x62')][_0x8f2c('0x56')](_0x1235de[_0x8f2c('0x5e')]);}})[_0x8f2c('0x31')](respondWithResult(_0x49f18c,null))[_0x8f2c('0x28')](handleError(_0x49f18c,null));};exports[_0x8f2c('0x63')]=function(_0x4e3a60,_0x38a06a,_0x136fbf){var _0x1b1a09={'raw':![],'where':{}};var _0x1907d9={};var _0x289a7f={'count':0x0,'rows':[]};return db[_0x8f2c('0x3b')][_0x8f2c('0x64')]({'where':{'id':_0x4e3a60[_0x8f2c('0x51')]['id']}})[_0x8f2c('0x31')](handleEntityNotFound(_0x38a06a,null))['then'](function(_0x492c1e){if(_0x492c1e){_0x1907d9[_0x8f2c('0x3e')]=_[_0x8f2c('0x54')](db[_0x8f2c('0x62')]['rawAttributes']);_0x1907d9['query']=_[_0x8f2c('0x54')](_0x4e3a60[_0x8f2c('0x3f')]);_0x1907d9[_0x8f2c('0x40')]=_[_0x8f2c('0x42')](_0x1907d9['model'],_0x1907d9['query']);_0x1b1a09[_0x8f2c('0x41')]=_[_0x8f2c('0x42')](_0x1907d9[_0x8f2c('0x3e')],qs[_0x8f2c('0x43')](_0x4e3a60[_0x8f2c('0x3f')][_0x8f2c('0x43')]));_0x1b1a09[_0x8f2c('0x41')]=_0x1b1a09[_0x8f2c('0x41')][_0x8f2c('0x44')]?_0x1b1a09[_0x8f2c('0x41')]:_0x1907d9[_0x8f2c('0x3e')];if(!_0x4e3a60[_0x8f2c('0x3f')][_0x8f2c('0x65')](_0x8f2c('0x66'))){_0x1b1a09[_0x8f2c('0x2d')]=qs[_0x8f2c('0x2d')](_0x4e3a60[_0x8f2c('0x3f')][_0x8f2c('0x2d')]);_0x1b1a09[_0x8f2c('0x2b')]=qs[_0x8f2c('0x2b')](_0x4e3a60['query'][_0x8f2c('0x2b')]);}_0x1b1a09[_0x8f2c('0x45')]=qs[_0x8f2c('0x46')](_0x4e3a60[_0x8f2c('0x3f')][_0x8f2c('0x46')]);_0x1b1a09[_0x8f2c('0x47')]=qs['filters'](_[_0x8f2c('0x48')](_0x4e3a60[_0x8f2c('0x3f')],_0x1907d9[_0x8f2c('0x40')]));_0x1b1a09['where']['WhatsappAccountId']=_0x492c1e['id'];if(_0x4e3a60[_0x8f2c('0x3f')][_0x8f2c('0x49')]){_0x1b1a09[_0x8f2c('0x47')]=_[_0x8f2c('0x4a')](_0x1b1a09[_0x8f2c('0x47')],{'$or':_[_0x8f2c('0x3a')](_0x1b1a09[_0x8f2c('0x41')],function(_0x41c561){var _0x532f81={};_0x532f81[_0x41c561]={'$like':'%'+_0x4e3a60[_0x8f2c('0x3f')][_0x8f2c('0x49')]+'%'};return _0x532f81;})});}_0x1b1a09=_['merge']({},_0x1b1a09,_0x4e3a60[_0x8f2c('0x67')]);return db['Disposition']['count']({'where':_0x1b1a09[_0x8f2c('0x47')]})[_0x8f2c('0x31')](function(_0xc1cfad){_0x289a7f['count']=_0xc1cfad;if(_0x4e3a60[_0x8f2c('0x3f')]['includeAll']){_0x1b1a09[_0x8f2c('0x4d')]=[{'all':!![]}];}return db[_0x8f2c('0x62')][_0x8f2c('0x4e')](_0x1b1a09);})[_0x8f2c('0x31')](function(_0x195266){_0x289a7f[_0x8f2c('0x4f')]=_0x195266;return _0x289a7f;});}})[_0x8f2c('0x31')](respondWithFilteredResult(_0x38a06a,_0x1b1a09))['catch'](handleError(_0x38a06a,null));};exports[_0x8f2c('0x68')]=function(_0x106398,_0x508811,_0x15c69d){return db[_0x8f2c('0x3b')][_0x8f2c('0x55')]({'where':{'id':_0x106398[_0x8f2c('0x51')]['id']}})[_0x8f2c('0x31')](handleEntityNotFound(_0x508811,null))[_0x8f2c('0x31')](function(_0x1ea256){if(_0x1ea256){return _0x1ea256[_0x8f2c('0x68')](_0x106398[_0x8f2c('0x3f')][_0x8f2c('0x69')]);}})[_0x8f2c('0x31')](respondWithStatusCode(_0x508811,null))[_0x8f2c('0x28')](handleError(_0x508811,null));};exports['addAnswer']=function(_0x25335f,_0x43754d,_0x5e2564){if(_0x25335f['body']['id']){delete _0x25335f[_0x8f2c('0x5e')]['id'];}return db['WhatsappAccount'][_0x8f2c('0x55')]({'where':{'id':_0x25335f[_0x8f2c('0x51')]['id']}})[_0x8f2c('0x31')](handleEntityNotFound(_0x43754d,null))[_0x8f2c('0x31')](function(_0xb14379){if(_0xb14379){_0x25335f[_0x8f2c('0x5e')][_0x8f2c('0x6a')]=_0xb14379['id'];return db[_0x8f2c('0x6b')]['create'](_0x25335f['body']);}})['then'](respondWithResult(_0x43754d,null))[_0x8f2c('0x28')](handleError(_0x43754d,null));};exports['getAnswers']=function(_0x280475,_0x4383ef,_0x3ca52e){var _0x102b25={'raw':![],'where':{}};var _0x4e4d30={};var _0x42ecd5={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x8f2c('0x64')]({'where':{'id':_0x280475[_0x8f2c('0x51')]['id']}})['then'](handleEntityNotFound(_0x4383ef,null))[_0x8f2c('0x31')](function(_0x27bc9f){if(_0x27bc9f){_0x4e4d30['model']=_[_0x8f2c('0x54')](db['CannedAnswer'][_0x8f2c('0x53')]);_0x4e4d30[_0x8f2c('0x3f')]=_['keys'](_0x280475['query']);_0x4e4d30[_0x8f2c('0x40')]=_['intersection'](_0x4e4d30[_0x8f2c('0x3e')],_0x4e4d30[_0x8f2c('0x3f')]);_0x102b25[_0x8f2c('0x41')]=_['intersection'](_0x4e4d30[_0x8f2c('0x3e')],qs[_0x8f2c('0x43')](_0x280475[_0x8f2c('0x3f')][_0x8f2c('0x43')]));_0x102b25[_0x8f2c('0x41')]=_0x102b25[_0x8f2c('0x41')][_0x8f2c('0x44')]?_0x102b25[_0x8f2c('0x41')]:_0x4e4d30[_0x8f2c('0x3e')];if(!_0x280475[_0x8f2c('0x3f')]['hasOwnProperty'](_0x8f2c('0x66'))){_0x102b25[_0x8f2c('0x2d')]=qs[_0x8f2c('0x2d')](_0x280475[_0x8f2c('0x3f')][_0x8f2c('0x2d')]);_0x102b25['offset']=qs[_0x8f2c('0x2b')](_0x280475['query']['offset']);}_0x102b25[_0x8f2c('0x45')]=qs[_0x8f2c('0x46')](_0x280475[_0x8f2c('0x3f')][_0x8f2c('0x46')]);_0x102b25[_0x8f2c('0x47')]=qs[_0x8f2c('0x40')](_[_0x8f2c('0x48')](_0x280475['query'],_0x4e4d30[_0x8f2c('0x40')]));_0x102b25[_0x8f2c('0x47')]['WhatsappAccountId']=_0x27bc9f['id'];if(_0x280475[_0x8f2c('0x3f')]['filter']){_0x102b25['where']=_[_0x8f2c('0x4a')](_0x102b25['where'],{'$or':_[_0x8f2c('0x3a')](_0x102b25[_0x8f2c('0x41')],function(_0x1ea950){var _0x3d8025={};_0x3d8025[_0x1ea950]={'$like':'%'+_0x280475[_0x8f2c('0x3f')][_0x8f2c('0x49')]+'%'};return _0x3d8025;})});}_0x102b25=_[_0x8f2c('0x4a')]({},_0x102b25,_0x280475[_0x8f2c('0x67')]);return db[_0x8f2c('0x6b')][_0x8f2c('0x2e')]({'where':_0x102b25[_0x8f2c('0x47')]})['then'](function(_0x20db2c){_0x42ecd5['count']=_0x20db2c;if(_0x280475['query'][_0x8f2c('0x4c')]){_0x102b25[_0x8f2c('0x4d')]=[{'all':!![]}];}return db[_0x8f2c('0x6b')][_0x8f2c('0x4e')](_0x102b25);})[_0x8f2c('0x31')](function(_0x4cfa1a){_0x42ecd5[_0x8f2c('0x4f')]=_0x4cfa1a;return _0x42ecd5;});}})[_0x8f2c('0x31')](respondWithFilteredResult(_0x4383ef,_0x102b25))[_0x8f2c('0x28')](handleError(_0x4383ef,null));};exports[_0x8f2c('0x6c')]=function(_0xded339,_0x1ffc59,_0x10b264){return db['WhatsappAccount'][_0x8f2c('0x55')]({'where':{'id':_0xded339[_0x8f2c('0x51')]['id']}})[_0x8f2c('0x31')](handleEntityNotFound(_0x1ffc59,null))[_0x8f2c('0x31')](function(_0x1c33ea){if(_0x1c33ea){return _0x1c33ea[_0x8f2c('0x6c')](_0xded339[_0x8f2c('0x3f')][_0x8f2c('0x69')]);}})[_0x8f2c('0x31')](respondWithStatusCode(_0x1ffc59,null))['catch'](handleError(_0x1ffc59,null));};exports[_0x8f2c('0x6d')]=function(_0x5d7438,_0x373651,_0x3873a6){return db[_0x8f2c('0x3b')][_0x8f2c('0x55')]({'where':{'id':_0x5d7438[_0x8f2c('0x51')]['id']}})[_0x8f2c('0x31')](handleEntityNotFound(_0x373651,null))[_0x8f2c('0x31')](function(_0x4182d1){if(_0x4182d1){return _0x4182d1[_0x8f2c('0x6d')](_0x5d7438[_0x8f2c('0x5e')][_0x8f2c('0x69')],_[_0x8f2c('0x6e')](_0x5d7438['body'],[_0x8f2c('0x69'),'id'])||{})[_0x8f2c('0x6f')](function(_0xe4b8a){for(var _0x5ed99e=0x0;_0x5ed99e<_0x5d7438[_0x8f2c('0x5e')][_0x8f2c('0x69')]['length'];_0x5ed99e+=0x1){socket[_0x8f2c('0x70')](_0x8f2c('0x71'),{'UserId':Number(_0x5d7438[_0x8f2c('0x5e')][_0x8f2c('0x69')][_0x5ed99e]),'WhatsappAccountId':Number(_0x5d7438[_0x8f2c('0x51')]['id'])});}return _0xe4b8a;});}})[_0x8f2c('0x31')](respondWithResult(_0x373651,null))[_0x8f2c('0x28')](handleError(_0x373651,null));};exports[_0x8f2c('0x72')]=function(_0x5b0dc3,_0x336a55,_0x1091f8){return db['WhatsappAccount'][_0x8f2c('0x55')]({'where':{'id':_0x5b0dc3['params']['id']}})[_0x8f2c('0x31')](handleEntityNotFound(_0x336a55,null))[_0x8f2c('0x31')](function(_0x4bed25){if(_0x4bed25){return _0x4bed25[_0x8f2c('0x72')](_0x5b0dc3[_0x8f2c('0x3f')][_0x8f2c('0x69')])[_0x8f2c('0x31')](function(){if(_['isArray'](_0x5b0dc3[_0x8f2c('0x3f')][_0x8f2c('0x69')])){for(var _0x1437e3=0x0;_0x1437e3<_0x5b0dc3[_0x8f2c('0x3f')]['ids'][_0x8f2c('0x44')];_0x1437e3+=0x1){socket[_0x8f2c('0x70')](_0x8f2c('0x73'),{'UserId':Number(_0x5b0dc3['query'][_0x8f2c('0x69')][_0x1437e3]),'WhatsappAccountId':Number(_0x5b0dc3['params']['id'])});}}else{socket['emit'](_0x8f2c('0x73'),{'UserId':Number(_0x5b0dc3['query'][_0x8f2c('0x69')]),'WhatsappAccountId':Number(_0x5b0dc3[_0x8f2c('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x336a55,null))[_0x8f2c('0x28')](handleError(_0x336a55,null));};exports[_0x8f2c('0x74')]=function(_0x26fa3c,_0x3eb464,_0x27f9d2){var _0x5be5d2={};var _0xd5bec0={};var _0xed0ac6;var _0x428dab;return db[_0x8f2c('0x3b')][_0x8f2c('0x64')]({'where':{'id':_0x26fa3c['params']['id']}})['then'](handleEntityNotFound(_0x3eb464,null))[_0x8f2c('0x31')](function(_0x31a646){if(_0x31a646){_0xed0ac6=_0x31a646;_0xd5bec0[_0x8f2c('0x3e')]=_[_0x8f2c('0x54')](db['User'][_0x8f2c('0x53')]);_0xd5bec0[_0x8f2c('0x3f')]=_[_0x8f2c('0x54')](_0x26fa3c[_0x8f2c('0x3f')]);_0xd5bec0[_0x8f2c('0x40')]=_[_0x8f2c('0x42')](_0xd5bec0[_0x8f2c('0x3e')],_0xd5bec0[_0x8f2c('0x3f')]);_0x5be5d2[_0x8f2c('0x41')]=_[_0x8f2c('0x42')](_0xd5bec0[_0x8f2c('0x3e')],qs['fields'](_0x26fa3c[_0x8f2c('0x3f')]['fields']));_0x5be5d2[_0x8f2c('0x41')]=_0x5be5d2[_0x8f2c('0x41')][_0x8f2c('0x44')]?_0x5be5d2[_0x8f2c('0x41')]:_0xd5bec0[_0x8f2c('0x3e')];_0x5be5d2[_0x8f2c('0x45')]=qs[_0x8f2c('0x46')](_0x26fa3c[_0x8f2c('0x3f')][_0x8f2c('0x46')]);_0x5be5d2[_0x8f2c('0x47')]=qs[_0x8f2c('0x40')](_[_0x8f2c('0x48')](_0x26fa3c[_0x8f2c('0x3f')],_0xd5bec0[_0x8f2c('0x40')]));if(_0x26fa3c[_0x8f2c('0x3f')]['filter']){_0x5be5d2[_0x8f2c('0x47')]=_[_0x8f2c('0x4a')](_0x5be5d2['where'],{'$or':_[_0x8f2c('0x3a')](_0x5be5d2[_0x8f2c('0x41')],function(_0x5f4a56){var _0x3e9de3={};_0x3e9de3[_0x5f4a56]={'$like':'%'+_0x26fa3c['query'][_0x8f2c('0x49')]+'%'};return _0x3e9de3;})});}_0x5be5d2=_[_0x8f2c('0x4a')]({},_0x5be5d2,_0x26fa3c[_0x8f2c('0x67')]);return _0xed0ac6[_0x8f2c('0x74')](_0x5be5d2);}})[_0x8f2c('0x31')](function(_0x318a82){if(_0x318a82){_0x428dab=_0x318a82[_0x8f2c('0x44')];if(!_0x26fa3c['query'][_0x8f2c('0x65')](_0x8f2c('0x66'))){_0x5be5d2['limit']=qs[_0x8f2c('0x2d')](_0x26fa3c[_0x8f2c('0x3f')][_0x8f2c('0x2d')]);_0x5be5d2['offset']=qs[_0x8f2c('0x2b')](_0x26fa3c[_0x8f2c('0x3f')][_0x8f2c('0x2b')]);}return _0xed0ac6[_0x8f2c('0x74')](_0x5be5d2);}})[_0x8f2c('0x31')](function(_0x8ec6e3){if(_0x8ec6e3){return _0x8ec6e3?{'count':_0x428dab,'rows':_0x8ec6e3}:null;}})[_0x8f2c('0x31')](respondWithResult(_0x3eb464,null))[_0x8f2c('0x28')](handleError(_0x3eb464,null));};exports[_0x8f2c('0x75')]=function(_0x2f68d6,_0x3b4940){var _0x64f846=_0x2f68d6[_0x8f2c('0x51')]['id'];var _0x4f12d7=_0x2f68d6[_0x8f2c('0x5e')];var _0x5dd856=0xc8;var _0xf4e310=null;return db[_0x8f2c('0x76')][_0x8f2c('0x77')]({'isolationLevel':db[_0x8f2c('0x76')]['Transaction']['ISOLATION_LEVELS'][_0x8f2c('0x78')]},function(_0x388c2f){return db[_0x8f2c('0x3b')]['findOne']({'where':{'id':_0x64f846},'transaction':_0x388c2f})['then'](function(_0xe09133){if(_0xe09133){return db[_0x8f2c('0x79')][_0x8f2c('0x32')]({'where':{'WhatsappAccountId':_0x64f846},'transaction':_0x388c2f})[_0x8f2c('0x31')](function(){var _0x539aff=_[_0x8f2c('0x3a')](_0x4f12d7,function(_0x30f958){_0x30f958[_0x8f2c('0x6a')]=_0x64f846;return _0x30f958;});return db[_0x8f2c('0x79')][_0x8f2c('0x7a')](_0x539aff,{'transaction':_0x388c2f});});}else{_0x5dd856=0x194;_0xf4e310=[];}});})['then'](function(){if(_0x5dd856!==0x194){return db[_0x8f2c('0x79')][_0x8f2c('0x7b')]({'where':{'WhatsappAccountId':_0x64f846},'order':_0x8f2c('0x7c')})[_0x8f2c('0x31')](function(_0x45cc29){_0xf4e310=_0x45cc29;});}})[_0x8f2c('0x28')](function(_0x11e628){_0x5dd856=0x1f4;logger['error'](_0x11e628[_0x8f2c('0x36')]);if(_0x11e628[_0x8f2c('0x37')]){delete _0x11e628[_0x8f2c('0x37')];}_0xf4e310=_0x11e628;})[_0x8f2c('0x7d')](function(){if(_0xf4e310===null){_0x3b4940[_0x8f2c('0x7e')](_0x5dd856);}else{if(_0x5dd856===0x1f4){_0x3b4940[_0x8f2c('0x29')](_0x5dd856)[_0x8f2c('0x38')](_0xf4e310);}else{_0x3b4940[_0x8f2c('0x29')](_0x5dd856)['json'](_0xf4e310);}}});};exports[_0x8f2c('0x7f')]=function(_0x17e9c7,_0x2b13f2,_0x180129){var _0x55d20b={};var _0xfbab8c={};var _0x2af850;var _0x901ed0;return db[_0x8f2c('0x3b')][_0x8f2c('0x64')]({'where':{'id':_0x17e9c7[_0x8f2c('0x51')]['id']}})[_0x8f2c('0x31')](handleEntityNotFound(_0x2b13f2,null))[_0x8f2c('0x31')](function(_0x51c14d){if(_0x51c14d){_0x2af850=_0x51c14d;_0xfbab8c[_0x8f2c('0x3e')]=_['keys'](db[_0x8f2c('0x79')][_0x8f2c('0x53')]);_0xfbab8c[_0x8f2c('0x3f')]=_[_0x8f2c('0x54')](_0x17e9c7[_0x8f2c('0x3f')]);_0xfbab8c['filters']=_[_0x8f2c('0x42')](_0xfbab8c['model'],_0xfbab8c[_0x8f2c('0x3f')]);_0x55d20b['attributes']=_['intersection'](_0xfbab8c[_0x8f2c('0x3e')],qs[_0x8f2c('0x43')](_0x17e9c7['query']['fields']));_0x55d20b[_0x8f2c('0x41')]=_0x55d20b[_0x8f2c('0x41')]['length']?_0x55d20b[_0x8f2c('0x41')]:_0xfbab8c[_0x8f2c('0x3e')];_0x55d20b[_0x8f2c('0x45')]=qs[_0x8f2c('0x46')](_0x17e9c7[_0x8f2c('0x3f')][_0x8f2c('0x46')]);_0x55d20b[_0x8f2c('0x47')]=qs[_0x8f2c('0x40')](_[_0x8f2c('0x48')](_0x17e9c7[_0x8f2c('0x3f')],_0xfbab8c['filters']));if(_0x17e9c7[_0x8f2c('0x3f')]['filter']){_0x55d20b['where']=_[_0x8f2c('0x4a')](_0x55d20b[_0x8f2c('0x47')],{'$or':_[_0x8f2c('0x3a')](_0x55d20b[_0x8f2c('0x41')],function(_0x308cd6){var _0x192b88={};_0x192b88[_0x308cd6]={'$like':'%'+_0x17e9c7[_0x8f2c('0x3f')][_0x8f2c('0x49')]+'%'};return _0x192b88;})});}_0x55d20b=_['merge']({},_0x55d20b,_0x17e9c7[_0x8f2c('0x67')]);return _0x2af850[_0x8f2c('0x7f')](_0x55d20b);}})[_0x8f2c('0x31')](function(_0x2242c2){if(_0x2242c2){_0x901ed0=_0x2242c2[_0x8f2c('0x44')];if(!_0x17e9c7[_0x8f2c('0x3f')]['hasOwnProperty'](_0x8f2c('0x66'))){_0x55d20b['limit']=qs['limit'](_0x17e9c7['query']['limit']);_0x55d20b[_0x8f2c('0x2b')]=qs[_0x8f2c('0x2b')](_0x17e9c7['query'][_0x8f2c('0x2b')]);}return _0x2af850[_0x8f2c('0x7f')](_0x55d20b);}})[_0x8f2c('0x31')](function(_0x1595ee){if(_0x1595ee){return _0x1595ee?{'count':_0x901ed0,'rows':_0x1595ee}:null;}})[_0x8f2c('0x31')](respondWithResult(_0x2b13f2,null))[_0x8f2c('0x28')](handleError(_0x2b13f2,null));};exports[_0x8f2c('0x80')]=function(_0x103bfe,_0x226d48,_0x4b0180){var _0x103a83={'channel':_0x8f2c('0x81')};var _0x49851c=[];var _0x1b9c84=[];var _0x136805={};return db[_0x8f2c('0x3b')][_0x8f2c('0x55')]({'where':{'id':_0x103bfe[_0x8f2c('0x51')]['id']},'include':[{'model':db[_0x8f2c('0x79')],'as':_0x8f2c('0x82')}]})[_0x8f2c('0x31')](handleEntityNotFound(_0x226d48,null))[_0x8f2c('0x31')](function(_0x574008){_0x103a83[_0x8f2c('0x83')]=_0x574008;if(_0x103a83['account']&&_0x103a83[_0x8f2c('0x83')][_0x8f2c('0x3c')]==='sinch'&&_0x103bfe[_0x8f2c('0x5e')]['statuses']){if(_0x103bfe[_0x8f2c('0x5e')]['statuses']['length']===0x0)return;if(_0x103bfe[_0x8f2c('0x5e')]['statuses'][0x0][_0x8f2c('0x84')]!=='read')return;return db[_0x8f2c('0x85')][_0x8f2c('0x30')]({'read':!![],'readAt':_0x103bfe[_0x8f2c('0x5e')][_0x8f2c('0x86')][0x0][_0x8f2c('0x87')]},{'where':{'messageId':_0x103bfe['body'][_0x8f2c('0x86')][0x0]['message_id']},'individualHooks':!![]})[_0x8f2c('0x31')](function(_0x5bac2f){return _0x226d48['status'](0xc8)[_0x8f2c('0x88')](_0x5bac2f);});}_0x103a83[_0x8f2c('0x89')]=_[_0x8f2c('0x8a')](_0x574008[_0x8f2c('0x82')],[_0x8f2c('0x7c')],[_0x8f2c('0x8b')]);if(_0x103a83['account'][_0x8f2c('0x82')]){delete _0x103a83['account'][_0x8f2c('0x82')];}return db['CmContact'][_0x8f2c('0x60')]()['then'](function(_0x4c01bb){if(!_0x4c01bb){throw new db[(_0x8f2c('0x8c'))][(_0x8f2c('0x8d'))](_0x8f2c('0x8e'));}_0x49851c=_[_0x8f2c('0x8f')](_[_0x8f2c('0x54')](_0x4c01bb),['createdAt',_0x8f2c('0x90')]);_0x1b9c84=_[_0x8f2c('0x8f')](_[_0x8f2c('0x54')](_0x4c01bb),[_0x8f2c('0x91'),_0x8f2c('0x90'),_0x8f2c('0x92'),'ListId']);_0x103a83[_0x8f2c('0x5e')]={'mapKey':_0x8f2c('0x93')};if(_0x103a83[_0x8f2c('0x83')]&&_0x103a83[_0x8f2c('0x83')]['type']===_0x8f2c('0x94')){_0x103a83[_0x8f2c('0x5e')][_0x8f2c('0x95')]=_0x103bfe[_0x8f2c('0x5e')][_0x8f2c('0x96')][_0x8f2c('0x97')](_0x8f2c('0x98'),'');_0x103a83[_0x8f2c('0x5e')][_0x8f2c('0x5e')]=_0x103bfe['body'][_0x8f2c('0x99')];_0x103a83[_0x8f2c('0x5e')][_0x8f2c('0x9a')]=_0x103bfe['body'][_0x8f2c('0x9b')];}if(_0x103a83['account']&&_0x103a83[_0x8f2c('0x83')]['type']===_0x8f2c('0x9c')){_0x103a83['body'][_0x8f2c('0x95')]=_0x103bfe['body'][_0x8f2c('0x9d')][0x0][_0x8f2c('0x95')];_0x103a83[_0x8f2c('0x5e')][_0x8f2c('0x5e')]=_0x103bfe[_0x8f2c('0x5e')]['notifications'][0x0][_0x8f2c('0x26')][_0x8f2c('0x5e')];_0x103a83[_0x8f2c('0x5e')][_0x8f2c('0x9a')]=_0x103bfe[_0x8f2c('0x5e')]['notifications'][0x0][_0x8f2c('0x9e')];}if(_0x103a83[_0x8f2c('0x5e')]['id']){delete _0x103a83[_0x8f2c('0x5e')]['id'];}if(_[_0x8f2c('0x9f')](_0x103a83[_0x8f2c('0x5e')][_0x8f2c('0x95')])){throw new db[(_0x8f2c('0x8c'))][(_0x8f2c('0x8d'))](_0x8f2c('0xa0'));}if(_[_0x8f2c('0x9f')](_0x103a83[_0x8f2c('0x5e')]['body'])||_0x103a83[_0x8f2c('0x5e')][_0x8f2c('0x5e')]===''){throw new db[(_0x8f2c('0x8c'))]['ValidationError'](_0x8f2c('0xa1'));}if(_[_0x8f2c('0x9f')](_0x103a83[_0x8f2c('0x5e')]['mapKey'])){throw new db[(_0x8f2c('0x8c'))][(_0x8f2c('0x8d'))](_0x8f2c('0xa2')+_0x1b9c84);}if(!_['includes'](_0x1b9c84,_0x103a83[_0x8f2c('0x5e')][_0x8f2c('0xa3')])){throw new db[(_0x8f2c('0x8c'))]['ValidationError'](_0x8f2c('0xa4')+_0x1b9c84);}_0x136805[_0x103a83[_0x8f2c('0x5e')][_0x8f2c('0xa3')]]=_0x103a83[_0x8f2c('0x5e')]['from'];return db[_0x8f2c('0xa5')][_0x8f2c('0x55')]({'where':{'id':_0x103a83[_0x8f2c('0x83')]['ListId']},'include':[{'model':db[_0x8f2c('0xa6')],'as':'Contacts','where':_0x136805,'limit':0x1,'order':[[_0x8f2c('0x90'),_0x8f2c('0xa7')]]}]});})[_0x8f2c('0x31')](handleEntityNotFound(_0x226d48,null))['then'](function(_0x34ea8c){if(_0x34ea8c){_0x103a83[_0x8f2c('0xa8')]=_['omit'](_0x34ea8c,[_0x8f2c('0xa9')]);if(_0x34ea8c[_0x8f2c('0xa9')][_0x8f2c('0x44')]){return _0x34ea8c[_0x8f2c('0xa9')][0x0];}var _0x3fb2e8=_[_0x8f2c('0x18')](_0x103a83[_0x8f2c('0x5e')],{'firstName':_0x103a83['body'][_0x8f2c('0x95')],'ListId':_0x34ea8c['id']});_0x3fb2e8[_0x103a83[_0x8f2c('0x5e')]['mapKey']]=_0x103a83[_0x8f2c('0x5e')][_0x8f2c('0x95')];return db['CmContact'][_0x8f2c('0x56')](_0x3fb2e8,{'fields':_0x49851c,'raw':!![]});}})['then'](handleEntityNotFound(_0x226d48,null))[_0x8f2c('0x31')](function(_0x24dcb0){if(_0x24dcb0){_0x103a83[_0x8f2c('0xaa')]=_0x24dcb0;var _0xc1c808={'ContactId':_0x24dcb0['id'],'phone':_0x103a83['body'][_0x8f2c('0x95')],'WhatsappAccountId':_0x103bfe[_0x8f2c('0x51')]['id']};var _0xd868bf={'ContactId':_0x24dcb0['id'],'WhatsappAccountId':_0x103bfe['params']['id'],'closed':![]};return db[_0x8f2c('0xab')][_0x8f2c('0x55')]({'where':_0xd868bf})[_0x8f2c('0x31')](function(_0x4cfd7a){if(_0x4cfd7a){return[_0x4cfd7a,![]];}return db[_0x8f2c('0xab')][_0x8f2c('0x56')](_0xc1c808)[_0x8f2c('0x31')](function(_0x477697){return[_0x477697,!![]];});});}})[_0x8f2c('0x6f')](function(_0x55cff1,_0x41cb1f){_0x103a83[_0x8f2c('0xac')]=_0x55cff1['get']({'plain':!![]});_0x103a83[_0x8f2c('0xac')][_0x8f2c('0xad')]=![];if(_0x41cb1f){if(_0x103a83[_0x8f2c('0x83')]['autoclose']){_0x103a83[_0x8f2c('0x89')]['push']({'id':0x0,'priority':_0x103a83['applications']['length']+0x1,'app':'close','appdata':_0x8f2c('0xae'),'interval':_0x8f2c('0xaf')});}_0x103a83['interaction']['created']=!![];}return db[_0x8f2c('0x85')][_0x8f2c('0x56')]({'phone':_0x103a83['body']['from'],'messageId':_0x103a83[_0x8f2c('0x5e')]['messageId'],'body':_0x103a83[_0x8f2c('0x5e')][_0x8f2c('0x5e')],'WhatsappAccountId':_0x103bfe[_0x8f2c('0x51')]['id'],'WhatsappInteractionId':_0x55cff1['id'],'direction':'in','ContactId':_0x55cff1[_0x8f2c('0xb0')],'AttachmentId':_0x103a83[_0x8f2c('0x5e')][_0x8f2c('0xb1')]});})[_0x8f2c('0x31')](function(_0x445bee){_0x103a83[_0x8f2c('0x26')]=_0x445bee;if(_0x103a83[_0x8f2c('0xac')][_0x8f2c('0xb2')]){return db['User'][_0x8f2c('0x55')]({'attributes':['id',_0x8f2c('0x37')],'where':{'id':_0x103a83[_0x8f2c('0xac')][_0x8f2c('0xb2')]}})[_0x8f2c('0x31')](function(_0x3c2665){if(_0x3c2665){_0x103a83['applications'][_0x8f2c('0xb3')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3c2665[_0x8f2c('0x37')]+','+(_0x103a83[_0x8f2c('0x83')][_0x8f2c('0xb4')]||0xa),'interval':_0x8f2c('0xaf')});}return respondWithRpcPromise(_0x8f2c('0xb5'),_0x8f2c('0xb6'),_0x103a83);});}return respondWithRpcPromise(_0x8f2c('0xb5'),'startRouting',_0x103a83);})['then'](function(_0x223d2a){if(_0x223d2a){var _0x38350=0xc8;var _0x1928a5=_0x8f2c('0xb7');logger[_0x8f2c('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1928a5,_0x38350,_0x8f2c('0xb8'));logger[_0x8f2c('0x22')](_0x8f2c('0xb9'),_0x1928a5,_0x38350,_0x8f2c('0xb8'),JSON['stringify'](_0x223d2a));if(_0x103a83[_0x8f2c('0x83')]['type']==='twilio'){return _0x226d48[_0x8f2c('0x29')](_0x38350)['set'](_0x8f2c('0xba'),_0x8f2c('0xbb'))[_0x8f2c('0x38')](_0x8f2c('0xbc'));}else{return _0x226d48['status'](_0x38350)['json'](_0x223d2a);}}});})[_0x8f2c('0x28')](handleError(_0x226d48,null));};exports['send']=function(_0x3e1c0b,_0xa62d9f,_0x14049b){var _0x54a3ae,_0x1f78a3,_0x2ccd25;if(_['isNil'](_0x3e1c0b[_0x8f2c('0x5e')]['body'])||_0x3e1c0b['body']['body']===''){throw new db['Sequelize'][(_0x8f2c('0x8d'))](_0x8f2c('0xa1'));}if(_[_0x8f2c('0x9f')](_0x3e1c0b['body']['to'])){throw new db[(_0x8f2c('0x8c'))][(_0x8f2c('0x8d'))](_0x8f2c('0xbd'));}_0x54a3ae=_0x3e1c0b[_0x8f2c('0x5e')]['to'];return db[_0x8f2c('0x3b')][_0x8f2c('0x55')]({'where':{'id':_0x3e1c0b[_0x8f2c('0x51')]['id']},'include':[{'model':db[_0x8f2c('0xa5')],'as':'List','include':[{'model':db[_0x8f2c('0xa6')],'as':_0x8f2c('0xa9'),'where':{'mobile':_0x54a3ae},'limit':0x1,'order':[['updatedAt',_0x8f2c('0xa7')]]}]}]})[_0x8f2c('0x31')](handleEntityNotFound(_0xa62d9f,null))[_0x8f2c('0x31')](function(_0xbbb915){if(_0xbbb915&&_0xbbb915['List']){_0x1f78a3=_0xbbb915[_0x8f2c('0x33')]({'plain':!![]});if(_0x1f78a3[_0x8f2c('0xbe')]&&_0x1f78a3[_0x8f2c('0xbe')][_0x8f2c('0xa9')][_0x8f2c('0x44')]){return _0x1f78a3['List'][_0x8f2c('0xa9')][0x0];}return db[_0x8f2c('0xa6')][_0x8f2c('0x56')](_[_0x8f2c('0x18')](_0x3e1c0b[_0x8f2c('0x5e')],{'firstName':_0x54a3ae,'mobile':_0x54a3ae,'phone':_0x54a3ae,'ListId':_0x1f78a3[_0x8f2c('0xbf')]}));}})[_0x8f2c('0x31')](handleEntityNotFound(_0xa62d9f,null))[_0x8f2c('0x31')](function(_0x4f193b){if(_0x4f193b){_0x2ccd25=_0x4f193b;return db[_0x8f2c('0xab')]['find']({'where':{'ContactId':_0x2ccd25['id'],'closed':![],'WhatsappAccountId':_0x1f78a3['id']}})[_0x8f2c('0x31')](function(_0x51e3ff){if(_0x51e3ff){return[_0x51e3ff,![]];}return db[_0x8f2c('0xab')][_0x8f2c('0x56')]({'UserId':_0x3e1c0b[_0x8f2c('0x57')]['id'],'ContactId':_0x2ccd25['id'],'WhatsappAccountId':_0x1f78a3['id'],'phone':_0x54a3ae,'firstMsgDirection':_0x8f2c('0xc0'),'Messages':[_[_0x8f2c('0x4a')](_0x3e1c0b[_0x8f2c('0x5e')],{'read':![],'body':_0x3e1c0b[_0x8f2c('0x5e')][_0x8f2c('0x5e')],'phone':_0x54a3ae,'WhatsappAccountId':_0x1f78a3['id'],'UserId':_0x3e1c0b[_0x8f2c('0x57')]['id'],'ContactId':_0x2ccd25['id']})]},{'include':[{'model':db[_0x8f2c('0x85')],'as':_0x8f2c('0xc1')}]})[_0x8f2c('0x31')](function(_0x1dd2d0){return[_0x1dd2d0,!![]];});});}})[_0x8f2c('0x6f')](function(_0x3899f4,_0x74b053){if(_0x74b053){return _0x3899f4;}return db['WhatsappMessage'][_0x8f2c('0x56')](_[_0x8f2c('0x4a')](_0x3e1c0b[_0x8f2c('0x5e')],{'read':![],'body':_0x3e1c0b['body'][_0x8f2c('0x5e')],'phone':_0x54a3ae,'WhatsappAccountId':_0x1f78a3['id'],'WhatsappInteractionId':_0x3899f4['id'],'UserId':_0x3e1c0b[_0x8f2c('0x57')]['id'],'ContactId':_0x2ccd25['id']}))[_0x8f2c('0x31')](function(_0x3097e5){_0x3899f4[_0x8f2c('0xc2')][_0x8f2c('0xc1')]=[];_0x3899f4[_0x8f2c('0xc2')][_0x8f2c('0xc1')]['push'](_0x3097e5[_0x8f2c('0xc2')]);return _0x3899f4;});})[_0x8f2c('0x31')](respondWithResult(_0xa62d9f,null))['catch'](handleError(_0xa62d9f,null));}; \ No newline at end of file +var _0x2986=['UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','length','hasOwnProperty','filter','findAll','rows','ids','WhatsappAccountId','CannedAnswer','removeAnswers','addAgents','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','getApplications','whatsapp','Applications','account','sinch','statuses','state','WhatsappMessage','timestamp','orderBy','asc','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','MessageSid','notifications','messageId','message_id','Sequelize','from\x20is\x20mandatory','isNil','ValidationError','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','DESC','omit','Contacts','contact','WhatsappInteraction','spread','interaction','created','autoclose','applications','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','List','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get'];(function(_0xf1026c,_0x205857){var _0x29185d=function(_0x134a13){while(--_0x134a13){_0xf1026c['push'](_0xf1026c['shift']());}};_0x29185d(++_0x205857);}(_0x2986,0x8c));var _0x6298=function(_0x36211a,_0x3459ac){_0x36211a=_0x36211a-0x0;var _0x55dcff=_0x2986[_0x36211a];return _0x55dcff;};'use strict';var emlformat=require(_0x6298('0x0'));var rimraf=require(_0x6298('0x1'));var zipdir=require(_0x6298('0x2'));var jsonpatch=require(_0x6298('0x3'));var rp=require(_0x6298('0x4'));var moment=require('moment');var BPromise=require(_0x6298('0x5'));var Mustache=require(_0x6298('0x6'));var util=require(_0x6298('0x7'));var path=require(_0x6298('0x8'));var sox=require(_0x6298('0x9'));var csv=require(_0x6298('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6298('0xb'));var _=require(_0x6298('0xc'));var squel=require('squel');var crypto=require(_0x6298('0xd'));var jsforce=require(_0x6298('0xe'));var deskjs=require(_0x6298('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6298('0x10'));var Papa=require(_0x6298('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6298('0x12'));var hardwareService=require(_0x6298('0x13'));var logger=require(_0x6298('0x14'))(_0x6298('0x15'));var utils=require(_0x6298('0x16'));var config=require(_0x6298('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6298('0x18'))['db'];config[_0x6298('0x19')]=_[_0x6298('0x1a')](config[_0x6298('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x6298('0x1b'))(new Redis(config[_0x6298('0x19')]));require('./whatsappAccount.socket')[_0x6298('0x1c')](socket);var jayson=require(_0x6298('0x1d'));var client=jayson[_0x6298('0x1e')][_0x6298('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x5e5d4f,_0x441643,_0x3bf756,_0x774f5){return new BPromise(function(_0x385642,_0x25c03e){var _0x5dd432=_0x774f5||client;return _0x5dd432[_0x6298('0x20')](_0x5e5d4f,_0x3bf756)[_0x6298('0x21')](function(_0x33973){logger['info'](_0x6298('0x22'),_0x441643,_0x6298('0x23'));logger[_0x6298('0x24')](_0x6298('0x25'),_0x441643,_0x6298('0x23'),JSON[_0x6298('0x26')](_0x33973));if(_0x33973['error']){if(_0x33973['error'][_0x6298('0x27')]===0x1f4){logger[_0x6298('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x441643,_0x33973[_0x6298('0x28')][_0x6298('0x29')]);return _0x25c03e(_0x33973['error'][_0x6298('0x29')]);}logger[_0x6298('0x28')](_0x6298('0x22'),_0x441643,_0x33973[_0x6298('0x28')][_0x6298('0x29')]);return _0x385642(_0x33973[_0x6298('0x28')]['message']);}else{logger[_0x6298('0x2a')](_0x6298('0x22'),_0x441643,_0x6298('0x23'));_0x385642(_0x33973[_0x6298('0x2b')][_0x6298('0x29')]);}})['catch'](function(_0x4ba54e){logger[_0x6298('0x28')](_0x6298('0x22'),_0x441643,_0x4ba54e);_0x25c03e(_0x4ba54e);});});}function respondWithStatusCode(_0x32b5b5,_0x4c5382){_0x4c5382=_0x4c5382||0xcc;return function(_0x1fdb8d){if(_0x1fdb8d){return _0x32b5b5[_0x6298('0x2c')](_0x4c5382);}return _0x32b5b5[_0x6298('0x2d')](_0x4c5382)[_0x6298('0x2e')]();};}function respondWithResult(_0x422e9a,_0x1f58e4){_0x1f58e4=_0x1f58e4||0xc8;return function(_0x3c05e8){if(_0x3c05e8){return _0x422e9a[_0x6298('0x2d')](_0x1f58e4)[_0x6298('0x2f')](_0x3c05e8);}};}function respondWithFilteredResult(_0x12ee1f,_0x511520){return function(_0x5a7a32){if(_0x5a7a32){var _0xff6860=typeof _0x511520[_0x6298('0x30')]===_0x6298('0x31')&&typeof _0x511520[_0x6298('0x32')]===_0x6298('0x31');var _0x404626=_0x5a7a32[_0x6298('0x33')];var _0x846de0=_0xff6860?0x0:_0x511520[_0x6298('0x30')];var _0x3f7756=_0xff6860?_0x5a7a32[_0x6298('0x33')]:_0x511520['offset']+_0x511520[_0x6298('0x32')];var _0x618352;if(_0x3f7756>=_0x404626){_0x3f7756=_0x404626;_0x618352=0xc8;}else{_0x618352=0xce;}_0x12ee1f[_0x6298('0x2d')](_0x618352);return _0x12ee1f[_0x6298('0x34')](_0x6298('0x35'),_0x846de0+'-'+_0x3f7756+'/'+_0x404626)['json'](_0x5a7a32);}return null;};}function patchUpdates(_0x5e40bf){return function(_0x3a198c){try{jsonpatch[_0x6298('0x36')](_0x3a198c,_0x5e40bf,!![]);}catch(_0x2b8dae){return BPromise[_0x6298('0x37')](_0x2b8dae);}return _0x3a198c[_0x6298('0x38')]();};}function saveUpdates(_0x88d0fc,_0x456aba){return function(_0x38a6f0){if(_0x38a6f0){return _0x38a6f0[_0x6298('0x39')](_0x88d0fc)['then'](function(_0x19c5dc){return _0x19c5dc;});}return null;};}function removeEntity(_0x5d5088,_0x5dcebf){return function(_0x5cc915){if(_0x5cc915){return _0x5cc915[_0x6298('0x3a')]()['then'](function(){var _0x206fdd=_0x5cc915[_0x6298('0x3b')]({'plain':!![]});var _0x4ec7d1='WhatsappAccounts';return db[_0x6298('0x3c')][_0x6298('0x3a')]({'where':{'type':_0x4ec7d1,'resourceId':_0x206fdd['id']}})[_0x6298('0x21')](function(){return _0x5cc915;});})['then'](function(){_0x5d5088['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c4ea1,_0x1b5d7c){return function(_0x3711ba){if(!_0x3711ba){_0x4c4ea1['sendStatus'](0x194);}return _0x3711ba;};}function handleError(_0x3f82ed,_0x338165){_0x338165=_0x338165||0x1f4;return function(_0x4cd825){logger[_0x6298('0x28')](_0x4cd825[_0x6298('0x3d')]);if(_0x4cd825[_0x6298('0x3e')]){delete _0x4cd825[_0x6298('0x3e')];}_0x3f82ed[_0x6298('0x2d')](_0x338165)[_0x6298('0x3f')](_0x4cd825);};}exports[_0x6298('0x40')]=function(_0x62a27,_0x40d6db){var _0x3cf968={'include':[{'model':db[_0x6298('0x41')],'as':_0x6298('0x42')}]},_0x2d38cf={},_0x3c810d={'count':0x0,'rows':[]};var _0x346b8f=_[_0x6298('0x43')](db[_0x6298('0x44')][_0x6298('0x45')],function(_0x307196){return{'name':_0x307196[_0x6298('0x46')],'type':_0x307196[_0x6298('0x47')]['key']};});_0x2d38cf[_0x6298('0x48')]=_[_0x6298('0x43')](_0x346b8f,'name');_0x2d38cf[_0x6298('0x49')]=_[_0x6298('0x4a')](_0x62a27[_0x6298('0x49')]);_0x2d38cf[_0x6298('0x4b')]=_[_0x6298('0x4c')](_0x2d38cf[_0x6298('0x48')],_0x2d38cf[_0x6298('0x49')]);_0x3cf968[_0x6298('0x4d')]=_[_0x6298('0x4c')](_0x2d38cf['model'],qs[_0x6298('0x4e')](_0x62a27['query'][_0x6298('0x4e')]));_0x3cf968[_0x6298('0x4d')]=_0x3cf968[_0x6298('0x4d')]['length']?_0x3cf968[_0x6298('0x4d')]:_0x2d38cf['model'];if(!_0x62a27[_0x6298('0x49')]['hasOwnProperty'](_0x6298('0x4f'))){_0x3cf968['limit']=qs[_0x6298('0x32')](_0x62a27[_0x6298('0x49')][_0x6298('0x32')]);_0x3cf968['offset']=qs[_0x6298('0x30')](_0x62a27['query'][_0x6298('0x30')]);}_0x3cf968[_0x6298('0x50')]=qs['sort'](_0x62a27[_0x6298('0x49')][_0x6298('0x51')]);_0x3cf968[_0x6298('0x52')]=qs[_0x6298('0x4b')](_[_0x6298('0x53')](_0x62a27[_0x6298('0x49')],_0x2d38cf[_0x6298('0x4b')]),_0x346b8f);if(_0x62a27['query']['filter']){_0x3cf968[_0x6298('0x52')]=_['merge'](_0x3cf968[_0x6298('0x52')],{'$or':_[_0x6298('0x43')](_0x346b8f,function(_0x4e49b5){if(_0x4e49b5['type']!==_0x6298('0x54')){var _0x12d300={};_0x12d300[_0x4e49b5[_0x6298('0x3e')]]={'$like':'%'+_0x62a27['query']['filter']+'%'};return _0x12d300;}})});}_0x3cf968=_[_0x6298('0x55')]({},_0x3cf968,_0x62a27[_0x6298('0x56')]);var _0x7be2bb={'where':_0x3cf968[_0x6298('0x52')]};return db[_0x6298('0x44')]['count'](_0x7be2bb)['then'](function(_0x3b31bb){_0x3c810d[_0x6298('0x33')]=_0x3b31bb;if(_0x62a27[_0x6298('0x49')][_0x6298('0x57')]){_0x3cf968[_0x6298('0x58')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x3cf968);})['then'](function(_0x464986){_0x3c810d['rows']=_0x464986;return _0x3c810d;})[_0x6298('0x21')](respondWithFilteredResult(_0x40d6db,_0x3cf968))[_0x6298('0x59')](handleError(_0x40d6db,null));};exports[_0x6298('0x5a')]=function(_0x1a603a,_0x3e756e){var _0x265405={'raw':![],'where':{'id':_0x1a603a[_0x6298('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0x6298('0x42')}]},_0x132b90={};_0x132b90[_0x6298('0x48')]=_['keys'](db[_0x6298('0x44')][_0x6298('0x45')]);_0x132b90[_0x6298('0x49')]=_[_0x6298('0x4a')](_0x1a603a[_0x6298('0x49')]);_0x132b90[_0x6298('0x4b')]=_['intersection'](_0x132b90[_0x6298('0x48')],_0x132b90[_0x6298('0x49')]);_0x265405[_0x6298('0x4d')]=_[_0x6298('0x4c')](_0x132b90['model'],qs[_0x6298('0x4e')](_0x1a603a[_0x6298('0x49')][_0x6298('0x4e')]));_0x265405[_0x6298('0x4d')]=_0x265405[_0x6298('0x4d')]['length']?_0x265405['attributes']:_0x132b90[_0x6298('0x48')];if(_0x1a603a['query']['includeAll']){_0x265405[_0x6298('0x58')]=[{'all':!![]}];}_0x265405=_[_0x6298('0x55')]({},_0x265405,_0x1a603a[_0x6298('0x56')]);return db['WhatsappAccount'][_0x6298('0x5c')](_0x265405)[_0x6298('0x21')](handleEntityNotFound(_0x3e756e,null))['then'](respondWithResult(_0x3e756e,null))[_0x6298('0x59')](handleError(_0x3e756e,null));};exports[_0x6298('0x5d')]=function(_0x4903df,_0x5e3846){return db[_0x6298('0x44')]['create'](_0x4903df[_0x6298('0x5e')],{})[_0x6298('0x21')](function(_0x2130c9){var _0x2ec03f=_0x4903df[_0x6298('0x5f')][_0x6298('0x3b')]({'plain':!![]});if(!_0x2ec03f)throw new Error(_0x6298('0x60'));if(_0x2ec03f[_0x6298('0x61')]==='user'){var _0x4c75c2=_0x2130c9[_0x6298('0x3b')]({'plain':!![]});var _0x3458fb=_0x6298('0x62');return db['UserProfileSection']['find']({'where':{'name':_0x3458fb,'userProfileId':_0x2ec03f[_0x6298('0x63')]},'raw':!![]})[_0x6298('0x21')](function(_0x5796e0){if(_0x5796e0&&_0x5796e0[_0x6298('0x64')]===0x0){return db[_0x6298('0x3c')][_0x6298('0x5d')]({'name':_0x4c75c2[_0x6298('0x3e')],'resourceId':_0x4c75c2['id'],'type':_0x5796e0[_0x6298('0x3e')],'sectionId':_0x5796e0['id']},{})[_0x6298('0x21')](function(){return _0x2130c9;});}else{return _0x2130c9;}})['catch'](function(_0xf12d){logger['error'](_0x6298('0x65'),_0xf12d);throw _0xf12d;});}return _0x2130c9;})[_0x6298('0x21')](respondWithResult(_0x5e3846,0xc9))[_0x6298('0x59')](handleError(_0x5e3846,null));};exports[_0x6298('0x39')]=function(_0x3f3630,_0xc54776){if(_0x3f3630[_0x6298('0x5e')]['id']){delete _0x3f3630[_0x6298('0x5e')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x3f3630['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x6298('0x21')](handleEntityNotFound(_0xc54776,null))[_0x6298('0x21')](saveUpdates(_0x3f3630[_0x6298('0x5e')],null))[_0x6298('0x21')](respondWithResult(_0xc54776,null))['catch'](handleError(_0xc54776,null));};exports['destroy']=function(_0x59f24a,_0x408092){return db[_0x6298('0x44')]['find']({'where':{'id':_0x59f24a[_0x6298('0x5b')]['id']}})['then'](handleEntityNotFound(_0x408092,null))['then'](removeEntity(_0x408092,null))['catch'](handleError(_0x408092,null));};exports[_0x6298('0x66')]=function(_0xff1f50,_0x377ece){return db['WhatsappAccount'][_0x6298('0x66')]()['then'](respondWithResult(_0x377ece,null))[_0x6298('0x59')](handleError(_0x377ece,null));};exports[_0x6298('0x67')]=function(_0x451513,_0x30e3e1,_0x581f52){if(_0x451513[_0x6298('0x5e')]['id']){delete _0x451513[_0x6298('0x5e')]['id'];}return db[_0x6298('0x44')][_0x6298('0x5c')]({'where':{'id':_0x451513[_0x6298('0x5b')]['id']}})[_0x6298('0x21')](handleEntityNotFound(_0x30e3e1,null))[_0x6298('0x21')](function(_0x2bf9ed){if(_0x2bf9ed){_0x451513[_0x6298('0x5e')]['WhatsappAccountId']=_0x2bf9ed['id'];return db['Disposition']['create'](_0x451513[_0x6298('0x5e')]);}})[_0x6298('0x21')](respondWithResult(_0x30e3e1,null))[_0x6298('0x59')](handleError(_0x30e3e1,null));};exports[_0x6298('0x68')]=function(_0x2dd7ae,_0x8246ae,_0x4ac67a){var _0x39d907={'raw':![],'where':{}};var _0xa1471d={};var _0x542fd9={'count':0x0,'rows':[]};return db[_0x6298('0x44')][_0x6298('0x69')]({'where':{'id':_0x2dd7ae['params']['id']}})['then'](handleEntityNotFound(_0x8246ae,null))[_0x6298('0x21')](function(_0x2c28c6){if(_0x2c28c6){_0xa1471d[_0x6298('0x48')]=_[_0x6298('0x4a')](db[_0x6298('0x6a')][_0x6298('0x45')]);_0xa1471d[_0x6298('0x49')]=_[_0x6298('0x4a')](_0x2dd7ae[_0x6298('0x49')]);_0xa1471d[_0x6298('0x4b')]=_[_0x6298('0x4c')](_0xa1471d[_0x6298('0x48')],_0xa1471d[_0x6298('0x49')]);_0x39d907[_0x6298('0x4d')]=_[_0x6298('0x4c')](_0xa1471d[_0x6298('0x48')],qs[_0x6298('0x4e')](_0x2dd7ae[_0x6298('0x49')][_0x6298('0x4e')]));_0x39d907[_0x6298('0x4d')]=_0x39d907[_0x6298('0x4d')][_0x6298('0x6b')]?_0x39d907[_0x6298('0x4d')]:_0xa1471d[_0x6298('0x48')];if(!_0x2dd7ae['query'][_0x6298('0x6c')](_0x6298('0x4f'))){_0x39d907['limit']=qs[_0x6298('0x32')](_0x2dd7ae[_0x6298('0x49')][_0x6298('0x32')]);_0x39d907[_0x6298('0x30')]=qs['offset'](_0x2dd7ae[_0x6298('0x49')][_0x6298('0x30')]);}_0x39d907[_0x6298('0x50')]=qs['sort'](_0x2dd7ae[_0x6298('0x49')][_0x6298('0x51')]);_0x39d907[_0x6298('0x52')]=qs[_0x6298('0x4b')](_[_0x6298('0x53')](_0x2dd7ae[_0x6298('0x49')],_0xa1471d[_0x6298('0x4b')]));_0x39d907[_0x6298('0x52')]['WhatsappAccountId']=_0x2c28c6['id'];if(_0x2dd7ae['query']['filter']){_0x39d907[_0x6298('0x52')]=_[_0x6298('0x55')](_0x39d907[_0x6298('0x52')],{'$or':_[_0x6298('0x43')](_0x39d907[_0x6298('0x4d')],function(_0x4eae46){var _0x26a3b8={};_0x26a3b8[_0x4eae46]={'$like':'%'+_0x2dd7ae[_0x6298('0x49')][_0x6298('0x6d')]+'%'};return _0x26a3b8;})});}_0x39d907=_[_0x6298('0x55')]({},_0x39d907,_0x2dd7ae[_0x6298('0x56')]);return db[_0x6298('0x6a')][_0x6298('0x33')]({'where':_0x39d907[_0x6298('0x52')]})[_0x6298('0x21')](function(_0x1eef72){_0x542fd9[_0x6298('0x33')]=_0x1eef72;if(_0x2dd7ae[_0x6298('0x49')][_0x6298('0x57')]){_0x39d907[_0x6298('0x58')]=[{'all':!![]}];}return db[_0x6298('0x6a')][_0x6298('0x6e')](_0x39d907);})[_0x6298('0x21')](function(_0x2572fb){_0x542fd9[_0x6298('0x6f')]=_0x2572fb;return _0x542fd9;});}})['then'](respondWithFilteredResult(_0x8246ae,_0x39d907))[_0x6298('0x59')](handleError(_0x8246ae,null));};exports['removeDispositions']=function(_0x3935b2,_0xb4f645,_0x345c5d){return db['WhatsappAccount'][_0x6298('0x5c')]({'where':{'id':_0x3935b2[_0x6298('0x5b')]['id']}})[_0x6298('0x21')](handleEntityNotFound(_0xb4f645,null))['then'](function(_0x138290){if(_0x138290){return _0x138290['removeDispositions'](_0x3935b2[_0x6298('0x49')][_0x6298('0x70')]);}})[_0x6298('0x21')](respondWithStatusCode(_0xb4f645,null))['catch'](handleError(_0xb4f645,null));};exports['addAnswer']=function(_0x2887a5,_0x4486cf,_0x226fc2){if(_0x2887a5[_0x6298('0x5e')]['id']){delete _0x2887a5[_0x6298('0x5e')]['id'];}return db[_0x6298('0x44')][_0x6298('0x5c')]({'where':{'id':_0x2887a5[_0x6298('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4486cf,null))['then'](function(_0x3bfad0){if(_0x3bfad0){_0x2887a5[_0x6298('0x5e')][_0x6298('0x71')]=_0x3bfad0['id'];return db[_0x6298('0x72')][_0x6298('0x5d')](_0x2887a5['body']);}})[_0x6298('0x21')](respondWithResult(_0x4486cf,null))[_0x6298('0x59')](handleError(_0x4486cf,null));};exports['getAnswers']=function(_0x432a6d,_0x5c58be,_0x341b8e){var _0x49d2bd={'raw':![],'where':{}};var _0x2305ac={};var _0x3eb9b4={'count':0x0,'rows':[]};return db[_0x6298('0x44')]['findOne']({'where':{'id':_0x432a6d[_0x6298('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5c58be,null))[_0x6298('0x21')](function(_0x5a4b30){if(_0x5a4b30){_0x2305ac[_0x6298('0x48')]=_[_0x6298('0x4a')](db[_0x6298('0x72')][_0x6298('0x45')]);_0x2305ac['query']=_[_0x6298('0x4a')](_0x432a6d['query']);_0x2305ac[_0x6298('0x4b')]=_['intersection'](_0x2305ac[_0x6298('0x48')],_0x2305ac[_0x6298('0x49')]);_0x49d2bd[_0x6298('0x4d')]=_[_0x6298('0x4c')](_0x2305ac[_0x6298('0x48')],qs['fields'](_0x432a6d['query'][_0x6298('0x4e')]));_0x49d2bd['attributes']=_0x49d2bd['attributes'][_0x6298('0x6b')]?_0x49d2bd[_0x6298('0x4d')]:_0x2305ac[_0x6298('0x48')];if(!_0x432a6d[_0x6298('0x49')]['hasOwnProperty'](_0x6298('0x4f'))){_0x49d2bd[_0x6298('0x32')]=qs['limit'](_0x432a6d['query'][_0x6298('0x32')]);_0x49d2bd['offset']=qs[_0x6298('0x30')](_0x432a6d[_0x6298('0x49')][_0x6298('0x30')]);}_0x49d2bd['order']=qs[_0x6298('0x51')](_0x432a6d[_0x6298('0x49')][_0x6298('0x51')]);_0x49d2bd[_0x6298('0x52')]=qs[_0x6298('0x4b')](_[_0x6298('0x53')](_0x432a6d['query'],_0x2305ac[_0x6298('0x4b')]));_0x49d2bd[_0x6298('0x52')][_0x6298('0x71')]=_0x5a4b30['id'];if(_0x432a6d[_0x6298('0x49')][_0x6298('0x6d')]){_0x49d2bd['where']=_[_0x6298('0x55')](_0x49d2bd['where'],{'$or':_['map'](_0x49d2bd[_0x6298('0x4d')],function(_0x18ebc4){var _0x3ad1e0={};_0x3ad1e0[_0x18ebc4]={'$like':'%'+_0x432a6d['query'][_0x6298('0x6d')]+'%'};return _0x3ad1e0;})});}_0x49d2bd=_[_0x6298('0x55')]({},_0x49d2bd,_0x432a6d[_0x6298('0x56')]);return db[_0x6298('0x72')][_0x6298('0x33')]({'where':_0x49d2bd[_0x6298('0x52')]})[_0x6298('0x21')](function(_0x906066){_0x3eb9b4[_0x6298('0x33')]=_0x906066;if(_0x432a6d[_0x6298('0x49')][_0x6298('0x57')]){_0x49d2bd['include']=[{'all':!![]}];}return db[_0x6298('0x72')][_0x6298('0x6e')](_0x49d2bd);})[_0x6298('0x21')](function(_0x38e515){_0x3eb9b4['rows']=_0x38e515;return _0x3eb9b4;});}})[_0x6298('0x21')](respondWithFilteredResult(_0x5c58be,_0x49d2bd))[_0x6298('0x59')](handleError(_0x5c58be,null));};exports['removeAnswers']=function(_0x454d9f,_0x267a87,_0x357c9){return db[_0x6298('0x44')][_0x6298('0x5c')]({'where':{'id':_0x454d9f['params']['id']}})[_0x6298('0x21')](handleEntityNotFound(_0x267a87,null))[_0x6298('0x21')](function(_0x13ebed){if(_0x13ebed){return _0x13ebed[_0x6298('0x73')](_0x454d9f[_0x6298('0x49')][_0x6298('0x70')]);}})[_0x6298('0x21')](respondWithStatusCode(_0x267a87,null))['catch'](handleError(_0x267a87,null));};exports['addAgents']=function(_0x307ae3,_0x79bc7d,_0xd74abe){return db['WhatsappAccount']['find']({'where':{'id':_0x307ae3[_0x6298('0x5b')]['id']}})['then'](handleEntityNotFound(_0x79bc7d,null))[_0x6298('0x21')](function(_0x26410b){if(_0x26410b){return _0x26410b[_0x6298('0x74')](_0x307ae3[_0x6298('0x5e')][_0x6298('0x70')],_['omit'](_0x307ae3[_0x6298('0x5e')],[_0x6298('0x70'),'id'])||{})['spread'](function(_0x585242){for(var _0x55f9c5=0x0;_0x55f9c5<_0x307ae3['body'][_0x6298('0x70')][_0x6298('0x6b')];_0x55f9c5+=0x1){socket[_0x6298('0x75')](_0x6298('0x76'),{'UserId':Number(_0x307ae3[_0x6298('0x5e')][_0x6298('0x70')][_0x55f9c5]),'WhatsappAccountId':Number(_0x307ae3[_0x6298('0x5b')]['id'])});}return _0x585242;});}})[_0x6298('0x21')](respondWithResult(_0x79bc7d,null))[_0x6298('0x59')](handleError(_0x79bc7d,null));};exports[_0x6298('0x77')]=function(_0xf99d0f,_0x548ace,_0x58602a){return db[_0x6298('0x44')][_0x6298('0x5c')]({'where':{'id':_0xf99d0f[_0x6298('0x5b')]['id']}})[_0x6298('0x21')](handleEntityNotFound(_0x548ace,null))['then'](function(_0x43d330){if(_0x43d330){return _0x43d330[_0x6298('0x77')](_0xf99d0f[_0x6298('0x49')]['ids'])[_0x6298('0x21')](function(){if(_[_0x6298('0x78')](_0xf99d0f[_0x6298('0x49')]['ids'])){for(var _0x42042d=0x0;_0x42042d<_0xf99d0f['query'][_0x6298('0x70')][_0x6298('0x6b')];_0x42042d+=0x1){socket[_0x6298('0x75')](_0x6298('0x79'),{'UserId':Number(_0xf99d0f['query'][_0x6298('0x70')][_0x42042d]),'WhatsappAccountId':Number(_0xf99d0f['params']['id'])});}}else{socket[_0x6298('0x75')](_0x6298('0x79'),{'UserId':Number(_0xf99d0f[_0x6298('0x49')][_0x6298('0x70')]),'WhatsappAccountId':Number(_0xf99d0f[_0x6298('0x5b')]['id'])});}});}})[_0x6298('0x21')](respondWithStatusCode(_0x548ace,null))['catch'](handleError(_0x548ace,null));};exports[_0x6298('0x7a')]=function(_0x30ca13,_0x5d2f84,_0x3186e4){var _0x5bf9f1={};var _0x407803={};var _0x5ffa8a;var _0x32ae3a;return db[_0x6298('0x44')][_0x6298('0x69')]({'where':{'id':_0x30ca13[_0x6298('0x5b')]['id']}})[_0x6298('0x21')](handleEntityNotFound(_0x5d2f84,null))[_0x6298('0x21')](function(_0x27fa32){if(_0x27fa32){_0x5ffa8a=_0x27fa32;_0x407803[_0x6298('0x48')]=_[_0x6298('0x4a')](db[_0x6298('0x7b')][_0x6298('0x45')]);_0x407803[_0x6298('0x49')]=_[_0x6298('0x4a')](_0x30ca13[_0x6298('0x49')]);_0x407803[_0x6298('0x4b')]=_[_0x6298('0x4c')](_0x407803['model'],_0x407803[_0x6298('0x49')]);_0x5bf9f1['attributes']=_['intersection'](_0x407803[_0x6298('0x48')],qs[_0x6298('0x4e')](_0x30ca13[_0x6298('0x49')][_0x6298('0x4e')]));_0x5bf9f1[_0x6298('0x4d')]=_0x5bf9f1[_0x6298('0x4d')][_0x6298('0x6b')]?_0x5bf9f1[_0x6298('0x4d')]:_0x407803[_0x6298('0x48')];_0x5bf9f1[_0x6298('0x50')]=qs[_0x6298('0x51')](_0x30ca13[_0x6298('0x49')][_0x6298('0x51')]);_0x5bf9f1['where']=qs[_0x6298('0x4b')](_['pick'](_0x30ca13[_0x6298('0x49')],_0x407803[_0x6298('0x4b')]));if(_0x30ca13['query'][_0x6298('0x6d')]){_0x5bf9f1[_0x6298('0x52')]=_[_0x6298('0x55')](_0x5bf9f1[_0x6298('0x52')],{'$or':_[_0x6298('0x43')](_0x5bf9f1[_0x6298('0x4d')],function(_0x2fd782){var _0x5d2551={};_0x5d2551[_0x2fd782]={'$like':'%'+_0x30ca13[_0x6298('0x49')][_0x6298('0x6d')]+'%'};return _0x5d2551;})});}_0x5bf9f1=_['merge']({},_0x5bf9f1,_0x30ca13[_0x6298('0x56')]);return _0x5ffa8a[_0x6298('0x7a')](_0x5bf9f1);}})[_0x6298('0x21')](function(_0x9b028f){if(_0x9b028f){_0x32ae3a=_0x9b028f[_0x6298('0x6b')];if(!_0x30ca13[_0x6298('0x49')][_0x6298('0x6c')](_0x6298('0x4f'))){_0x5bf9f1[_0x6298('0x32')]=qs[_0x6298('0x32')](_0x30ca13['query'][_0x6298('0x32')]);_0x5bf9f1[_0x6298('0x30')]=qs[_0x6298('0x30')](_0x30ca13[_0x6298('0x49')][_0x6298('0x30')]);}return _0x5ffa8a[_0x6298('0x7a')](_0x5bf9f1);}})[_0x6298('0x21')](function(_0x51980c){if(_0x51980c){return _0x51980c?{'count':_0x32ae3a,'rows':_0x51980c}:null;}})[_0x6298('0x21')](respondWithResult(_0x5d2f84,null))[_0x6298('0x59')](handleError(_0x5d2f84,null));};exports['addApplications']=function(_0x400688,_0x26bd0f){var _0x3b571a=_0x400688[_0x6298('0x5b')]['id'];var _0x56f1b=_0x400688[_0x6298('0x5e')];var _0x5bacdc=0xc8;var _0x54d66e=null;return db['sequelize'][_0x6298('0x7c')]({'isolationLevel':db[_0x6298('0x7d')][_0x6298('0x7e')][_0x6298('0x7f')][_0x6298('0x80')]},function(_0x3ae1f8){return db[_0x6298('0x44')]['findOne']({'where':{'id':_0x3b571a},'transaction':_0x3ae1f8})[_0x6298('0x21')](function(_0x112b0e){if(_0x112b0e){return db[_0x6298('0x81')][_0x6298('0x3a')]({'where':{'WhatsappAccountId':_0x3b571a},'transaction':_0x3ae1f8})[_0x6298('0x21')](function(){var _0x331663=_[_0x6298('0x43')](_0x56f1b,function(_0x3372a0){_0x3372a0[_0x6298('0x71')]=_0x3b571a;return _0x3372a0;});return db[_0x6298('0x81')]['bulkCreate'](_0x331663,{'transaction':_0x3ae1f8});});}else{_0x5bacdc=0x194;_0x54d66e=[];}});})[_0x6298('0x21')](function(){if(_0x5bacdc!==0x194){return db['WhatsappApplication'][_0x6298('0x82')]({'where':{'WhatsappAccountId':_0x3b571a},'order':_0x6298('0x83')})[_0x6298('0x21')](function(_0x26f42a){_0x54d66e=_0x26f42a;});}})[_0x6298('0x59')](function(_0x6ff51b){_0x5bacdc=0x1f4;logger['error'](_0x6ff51b['stack']);if(_0x6ff51b[_0x6298('0x3e')]){delete _0x6ff51b[_0x6298('0x3e')];}_0x54d66e=_0x6ff51b;})['finally'](function(){if(_0x54d66e===null){_0x26bd0f['sendStatus'](_0x5bacdc);}else{if(_0x5bacdc===0x1f4){_0x26bd0f[_0x6298('0x2d')](_0x5bacdc)[_0x6298('0x3f')](_0x54d66e);}else{_0x26bd0f[_0x6298('0x2d')](_0x5bacdc)[_0x6298('0x2f')](_0x54d66e);}}});};exports[_0x6298('0x84')]=function(_0x2c0c50,_0x3ef94e,_0x463c61){var _0x4e5062={};var _0x1bbc69={};var _0x4ed1d7;var _0x3dbb72;return db[_0x6298('0x44')][_0x6298('0x69')]({'where':{'id':_0x2c0c50[_0x6298('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3ef94e,null))[_0x6298('0x21')](function(_0x15fb24){if(_0x15fb24){_0x4ed1d7=_0x15fb24;_0x1bbc69[_0x6298('0x48')]=_['keys'](db[_0x6298('0x81')][_0x6298('0x45')]);_0x1bbc69[_0x6298('0x49')]=_['keys'](_0x2c0c50['query']);_0x1bbc69[_0x6298('0x4b')]=_[_0x6298('0x4c')](_0x1bbc69[_0x6298('0x48')],_0x1bbc69[_0x6298('0x49')]);_0x4e5062[_0x6298('0x4d')]=_[_0x6298('0x4c')](_0x1bbc69[_0x6298('0x48')],qs['fields'](_0x2c0c50[_0x6298('0x49')]['fields']));_0x4e5062['attributes']=_0x4e5062[_0x6298('0x4d')][_0x6298('0x6b')]?_0x4e5062['attributes']:_0x1bbc69[_0x6298('0x48')];_0x4e5062[_0x6298('0x50')]=qs[_0x6298('0x51')](_0x2c0c50[_0x6298('0x49')][_0x6298('0x51')]);_0x4e5062[_0x6298('0x52')]=qs['filters'](_['pick'](_0x2c0c50[_0x6298('0x49')],_0x1bbc69[_0x6298('0x4b')]));if(_0x2c0c50['query']['filter']){_0x4e5062[_0x6298('0x52')]=_[_0x6298('0x55')](_0x4e5062[_0x6298('0x52')],{'$or':_[_0x6298('0x43')](_0x4e5062['attributes'],function(_0x2efbc1){var _0x26963a={};_0x26963a[_0x2efbc1]={'$like':'%'+_0x2c0c50[_0x6298('0x49')][_0x6298('0x6d')]+'%'};return _0x26963a;})});}_0x4e5062=_['merge']({},_0x4e5062,_0x2c0c50[_0x6298('0x56')]);return _0x4ed1d7[_0x6298('0x84')](_0x4e5062);}})['then'](function(_0x305618){if(_0x305618){_0x3dbb72=_0x305618[_0x6298('0x6b')];if(!_0x2c0c50[_0x6298('0x49')][_0x6298('0x6c')]('nolimit')){_0x4e5062[_0x6298('0x32')]=qs[_0x6298('0x32')](_0x2c0c50[_0x6298('0x49')]['limit']);_0x4e5062['offset']=qs[_0x6298('0x30')](_0x2c0c50[_0x6298('0x49')][_0x6298('0x30')]);}return _0x4ed1d7[_0x6298('0x84')](_0x4e5062);}})[_0x6298('0x21')](function(_0x8c71e5){if(_0x8c71e5){return _0x8c71e5?{'count':_0x3dbb72,'rows':_0x8c71e5}:null;}})[_0x6298('0x21')](respondWithResult(_0x3ef94e,null))[_0x6298('0x59')](handleError(_0x3ef94e,null));};exports['notify']=function(_0x94574a,_0x4fefba,_0x5a5d00){var _0x51f7b7={'channel':_0x6298('0x85')};var _0x50dcbd=[];var _0x57060=[];var _0x21cc01={};return db['WhatsappAccount']['find']({'where':{'id':_0x94574a['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x6298('0x86')}]})['then'](handleEntityNotFound(_0x4fefba,null))[_0x6298('0x21')](function(_0x52e860){_0x51f7b7[_0x6298('0x87')]=_0x52e860;if(_0x51f7b7[_0x6298('0x87')]&&_0x51f7b7[_0x6298('0x87')]['type']===_0x6298('0x88')&&_0x94574a[_0x6298('0x5e')][_0x6298('0x89')]){if(_0x94574a['body'][_0x6298('0x89')][_0x6298('0x6b')]===0x0)return;if(_0x94574a[_0x6298('0x5e')]['statuses'][0x0][_0x6298('0x8a')]!=='read')return;return db[_0x6298('0x8b')][_0x6298('0x39')]({'read':!![],'readAt':_0x94574a['body']['statuses'][0x0][_0x6298('0x8c')]},{'where':{'messageId':_0x94574a['body'][_0x6298('0x89')][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x3bb3dc){return _0x4fefba[_0x6298('0x2d')](0xc8)[_0x6298('0x2f')](_0x3bb3dc);});}_0x51f7b7['applications']=_[_0x6298('0x8d')](_0x52e860[_0x6298('0x86')],[_0x6298('0x83')],[_0x6298('0x8e')]);if(_0x51f7b7[_0x6298('0x87')][_0x6298('0x86')]){delete _0x51f7b7[_0x6298('0x87')][_0x6298('0x86')];}return db[_0x6298('0x8f')][_0x6298('0x66')]()[_0x6298('0x21')](function(_0x5b6a61){if(!_0x5b6a61){throw new db['Sequelize']['ValidationError'](_0x6298('0x90'));}_0x50dcbd=_[_0x6298('0x91')](_[_0x6298('0x4a')](_0x5b6a61),[_0x6298('0x92'),_0x6298('0x93')]);_0x57060=_[_0x6298('0x91')](_[_0x6298('0x4a')](_0x5b6a61),[_0x6298('0x92'),'updatedAt',_0x6298('0x94'),_0x6298('0x95')]);_0x51f7b7['body']={'mapKey':_0x6298('0x96')};if(_0x51f7b7[_0x6298('0x87')]&&_0x51f7b7[_0x6298('0x87')]['type']===_0x6298('0x97')){_0x51f7b7['body'][_0x6298('0x98')]=_0x94574a[_0x6298('0x5e')][_0x6298('0x99')][_0x6298('0x9a')](_0x6298('0x9b'),'');_0x51f7b7[_0x6298('0x5e')]['body']=_0x94574a['body'][_0x6298('0x9c')];_0x51f7b7['body']['messageId']=_0x94574a['body'][_0x6298('0x9d')];}if(_0x51f7b7[_0x6298('0x87')]&&_0x51f7b7[_0x6298('0x87')][_0x6298('0x47')]==='sinch'){_0x51f7b7['body'][_0x6298('0x98')]=_0x94574a[_0x6298('0x5e')][_0x6298('0x9e')][0x0][_0x6298('0x98')];_0x51f7b7[_0x6298('0x5e')]['body']=_0x94574a[_0x6298('0x5e')][_0x6298('0x9e')][0x0][_0x6298('0x29')][_0x6298('0x5e')];_0x51f7b7[_0x6298('0x5e')][_0x6298('0x9f')]=_0x94574a[_0x6298('0x5e')]['notifications'][0x0][_0x6298('0xa0')];}if(_0x51f7b7[_0x6298('0x5e')]['id']){delete _0x51f7b7[_0x6298('0x5e')]['id'];}if(_['isNil'](_0x51f7b7[_0x6298('0x5e')][_0x6298('0x98')])){throw new db[(_0x6298('0xa1'))]['ValidationError'](_0x6298('0xa2'));}if(_[_0x6298('0xa3')](_0x51f7b7['body'][_0x6298('0x5e')])||_0x51f7b7['body'][_0x6298('0x5e')]===''){throw new db['Sequelize'][(_0x6298('0xa4'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x51f7b7['body']['mapKey'])){throw new db[(_0x6298('0xa1'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x57060);}if(!_[_0x6298('0xa5')](_0x57060,_0x51f7b7[_0x6298('0x5e')][_0x6298('0xa6')])){throw new db[(_0x6298('0xa1'))][(_0x6298('0xa4'))](_0x6298('0xa7')+_0x57060);}_0x21cc01[_0x51f7b7[_0x6298('0x5e')][_0x6298('0xa6')]]=_0x51f7b7[_0x6298('0x5e')][_0x6298('0x98')];return db['CmList']['find']({'where':{'id':_0x51f7b7[_0x6298('0x87')][_0x6298('0x95')]},'include':[{'model':db[_0x6298('0x8f')],'as':'Contacts','where':_0x21cc01,'limit':0x1,'order':[[_0x6298('0x93'),_0x6298('0xa8')]]}]});})[_0x6298('0x21')](handleEntityNotFound(_0x4fefba,null))[_0x6298('0x21')](function(_0x13f969){if(_0x13f969){_0x51f7b7['list']=_[_0x6298('0xa9')](_0x13f969,[_0x6298('0xaa')]);if(_0x13f969[_0x6298('0xaa')][_0x6298('0x6b')]){return _0x13f969['Contacts'][0x0];}var _0x461089=_[_0x6298('0x1a')](_0x51f7b7[_0x6298('0x5e')],{'firstName':_0x51f7b7[_0x6298('0x5e')][_0x6298('0x98')],'ListId':_0x13f969['id']});_0x461089[_0x51f7b7[_0x6298('0x5e')][_0x6298('0xa6')]]=_0x51f7b7['body'][_0x6298('0x98')];return db[_0x6298('0x8f')][_0x6298('0x5d')](_0x461089,{'fields':_0x50dcbd,'raw':!![]});}})[_0x6298('0x21')](handleEntityNotFound(_0x4fefba,null))[_0x6298('0x21')](function(_0x1cae61){if(_0x1cae61){_0x51f7b7[_0x6298('0xab')]=_0x1cae61;var _0x1ce486={'ContactId':_0x1cae61['id'],'phone':_0x51f7b7[_0x6298('0x5e')][_0x6298('0x98')],'WhatsappAccountId':_0x94574a[_0x6298('0x5b')]['id']};var _0x230c1d={'ContactId':_0x1cae61['id'],'WhatsappAccountId':_0x94574a[_0x6298('0x5b')]['id'],'closed':![]};return db[_0x6298('0xac')][_0x6298('0x5c')]({'where':_0x230c1d})[_0x6298('0x21')](function(_0x44f3b6){if(_0x44f3b6){return[_0x44f3b6,![]];}return db['WhatsappInteraction']['create'](_0x1ce486)[_0x6298('0x21')](function(_0x555d8c){return[_0x555d8c,!![]];});});}})[_0x6298('0xad')](function(_0x3b54f4,_0x1a8f9a){_0x51f7b7[_0x6298('0xae')]=_0x3b54f4[_0x6298('0x3b')]({'plain':!![]});_0x51f7b7['interaction'][_0x6298('0xaf')]=![];if(_0x1a8f9a){if(_0x51f7b7['account'][_0x6298('0xb0')]){_0x51f7b7[_0x6298('0xb1')]['push']({'id':0x0,'priority':_0x51f7b7[_0x6298('0xb1')][_0x6298('0x6b')]+0x1,'app':_0x6298('0xb2'),'appdata':_0x6298('0xb3'),'interval':_0x6298('0xb4')});}_0x51f7b7[_0x6298('0xae')][_0x6298('0xaf')]=!![];}return db[_0x6298('0x8b')]['create']({'phone':_0x51f7b7[_0x6298('0x5e')][_0x6298('0x98')],'messageId':_0x51f7b7['body'][_0x6298('0x9f')],'body':_0x51f7b7[_0x6298('0x5e')][_0x6298('0x5e')],'WhatsappAccountId':_0x94574a[_0x6298('0x5b')]['id'],'WhatsappInteractionId':_0x3b54f4['id'],'direction':'in','ContactId':_0x3b54f4[_0x6298('0xb5')],'AttachmentId':_0x51f7b7[_0x6298('0x5e')][_0x6298('0xb6')]});})[_0x6298('0x21')](function(_0x3da1fc){_0x51f7b7[_0x6298('0x29')]=_0x3da1fc;if(_0x51f7b7[_0x6298('0xae')][_0x6298('0xb7')]){return db[_0x6298('0x7b')][_0x6298('0x5c')]({'attributes':['id',_0x6298('0x3e')],'where':{'id':_0x51f7b7[_0x6298('0xae')][_0x6298('0xb7')]}})[_0x6298('0x21')](function(_0x425ec9){if(_0x425ec9){_0x51f7b7[_0x6298('0xb1')][_0x6298('0xb8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x425ec9[_0x6298('0x3e')]+','+(_0x51f7b7[_0x6298('0x87')][_0x6298('0xb9')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x6298('0xba'),'startRouting',_0x51f7b7);});}return respondWithRpcPromise(_0x6298('0xba'),_0x6298('0xbb'),_0x51f7b7);})[_0x6298('0x21')](function(_0x30dafd){if(_0x30dafd){var _0x4aeb0e=0xc8;var _0x4f85fa=_0x6298('0xbc');logger['info'](_0x6298('0x25'),_0x4f85fa,_0x4aeb0e,_0x6298('0xbd'));logger[_0x6298('0x24')](_0x6298('0xbe'),_0x4f85fa,_0x4aeb0e,'entity\x20found',JSON[_0x6298('0x26')](_0x30dafd));if(_0x51f7b7[_0x6298('0x87')][_0x6298('0x47')]==='twilio'){return _0x4fefba[_0x6298('0x2d')](_0x4aeb0e)[_0x6298('0x34')]('Content-Type',_0x6298('0xbf'))[_0x6298('0x3f')](_0x6298('0xc0'));}else{return _0x4fefba[_0x6298('0x2d')](_0x4aeb0e)[_0x6298('0x2f')](_0x30dafd);}}});})[_0x6298('0x59')](handleError(_0x4fefba,null));};exports['send']=function(_0x59cefb,_0x3a0bad,_0x2fa101){var _0x114255,_0x286e3c,_0x8fae96;if(_[_0x6298('0xa3')](_0x59cefb[_0x6298('0x5e')][_0x6298('0x5e')])||_0x59cefb[_0x6298('0x5e')][_0x6298('0x5e')]===''){throw new db[(_0x6298('0xa1'))][(_0x6298('0xa4'))](_0x6298('0xc1'));}if(_[_0x6298('0xa3')](_0x59cefb[_0x6298('0x5e')]['to'])){throw new db['Sequelize']['ValidationError']('to\x20is\x20mandatory');}_0x114255=_0x59cefb['body']['to'];return db[_0x6298('0x44')]['find']({'where':{'id':_0x59cefb[_0x6298('0x5b')]['id']},'include':[{'model':db[_0x6298('0xc2')],'as':'List','include':[{'model':db['CmContact'],'as':_0x6298('0xaa'),'where':{'mobile':_0x114255},'limit':0x1,'order':[['updatedAt',_0x6298('0xa8')]]}]}]})[_0x6298('0x21')](handleEntityNotFound(_0x3a0bad,null))['then'](function(_0x27eaa7){if(_0x27eaa7&&_0x27eaa7[_0x6298('0xc3')]){_0x286e3c=_0x27eaa7[_0x6298('0x3b')]({'plain':!![]});if(_0x286e3c['List']&&_0x286e3c[_0x6298('0xc3')][_0x6298('0xaa')][_0x6298('0x6b')]){return _0x286e3c['List'][_0x6298('0xaa')][0x0];}return db[_0x6298('0x8f')][_0x6298('0x5d')](_[_0x6298('0x1a')](_0x59cefb[_0x6298('0x5e')],{'firstName':_0x114255,'mobile':_0x114255,'phone':_0x114255,'ListId':_0x286e3c[_0x6298('0x95')]}));}})[_0x6298('0x21')](handleEntityNotFound(_0x3a0bad,null))[_0x6298('0x21')](function(_0xc973b8){if(_0xc973b8){_0x8fae96=_0xc973b8;return db[_0x6298('0xac')]['find']({'where':{'ContactId':_0x8fae96['id'],'closed':![],'WhatsappAccountId':_0x286e3c['id']}})['then'](function(_0x12470b){if(_0x12470b){return[_0x12470b,![]];}return db['WhatsappInteraction'][_0x6298('0x5d')]({'UserId':_0x59cefb['user']['id'],'ContactId':_0x8fae96['id'],'WhatsappAccountId':_0x286e3c['id'],'phone':_0x114255,'firstMsgDirection':_0x6298('0xc4'),'Messages':[_[_0x6298('0x55')](_0x59cefb['body'],{'read':![],'body':_0x59cefb[_0x6298('0x5e')][_0x6298('0x5e')],'phone':_0x114255,'WhatsappAccountId':_0x286e3c['id'],'UserId':_0x59cefb[_0x6298('0x5f')]['id'],'ContactId':_0x8fae96['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x6298('0xc5')}]})[_0x6298('0x21')](function(_0x1113c5){return[_0x1113c5,!![]];});});}})[_0x6298('0xad')](function(_0x38fbca,_0x471a89){if(_0x471a89){return _0x38fbca;}return db[_0x6298('0x8b')][_0x6298('0x5d')](_[_0x6298('0x55')](_0x59cefb[_0x6298('0x5e')],{'read':![],'body':_0x59cefb['body'][_0x6298('0x5e')],'phone':_0x114255,'WhatsappAccountId':_0x286e3c['id'],'WhatsappInteractionId':_0x38fbca['id'],'UserId':_0x59cefb[_0x6298('0x5f')]['id'],'ContactId':_0x8fae96['id']}))[_0x6298('0x21')](function(_0x52a384){_0x38fbca[_0x6298('0xc6')][_0x6298('0xc5')]=[];_0x38fbca[_0x6298('0xc6')][_0x6298('0xc5')][_0x6298('0xc7')](_0x52a384['dataValues']);return _0x38fbca;});})[_0x6298('0x21')](respondWithResult(_0x3a0bad,null))[_0x6298('0x59')](handleError(_0x3a0bad,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 54d32d4..68ea07a 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 _0x6b2e=['save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x3f73f5,_0x851903){var _0x4b93d6=function(_0xe47e1f){while(--_0xe47e1f){_0x3f73f5['push'](_0x3f73f5['shift']());}};_0x4b93d6(++_0x851903);}(_0x6b2e,0x1c6));var _0xe6b2=function(_0x54c99c,_0x1f92f3){_0x54c99c=_0x54c99c-0x0;var _0x51ddaa=_0x6b2e[_0x54c99c];return _0x51ddaa;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xe6b2('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe6b2('0x1')](0x0);var events={'afterCreate':_0xe6b2('0x2'),'afterUpdate':'update','afterDestroy':_0xe6b2('0x3')};function emitEvent(_0x168781){return function(_0x25481d,_0x1b34b5,_0x5b5d2b){WhatsappAccountEvents[_0xe6b2('0x4')](_0x168781+':'+_0x25481d['id'],_0x25481d);WhatsappAccountEvents[_0xe6b2('0x4')](_0x168781,_0x25481d);_0x5b5d2b(null);};}for(var e in events){if(events[_0xe6b2('0x5')](e)){var event=events[e];WhatsappAccount[_0xe6b2('0x6')](e,emitEvent(event));}}module[_0xe6b2('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0xaf7b=['events','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x444951,_0x197960){var _0x5af4d9=function(_0x3405f9){while(--_0x3405f9){_0x444951['push'](_0x444951['shift']());}};_0x5af4d9(++_0x197960);}(_0xaf7b,0x12c));var _0xbaf7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xaf7b[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0xbaf7('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0xbaf7('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xbaf7('0x2')](0x0);var events={'afterCreate':_0xbaf7('0x3'),'afterUpdate':_0xbaf7('0x4'),'afterDestroy':_0xbaf7('0x5')};function emitEvent(_0x5c1541){return function(_0x1de3bd,_0x50c634,_0x46fa0f){WhatsappAccountEvents[_0xbaf7('0x6')](_0x5c1541+':'+_0x1de3bd['id'],_0x1de3bd);WhatsappAccountEvents['emit'](_0x5c1541,_0x1de3bd);_0x46fa0f(null);};}for(var e in events){if(events[_0xbaf7('0x7')](e)){var event=events[e];WhatsappAccount[_0xbaf7('0x8')](e,emitEvent(event));}}module[_0xbaf7('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 4d551e1..4f7d429 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 _0x898e=['exports','define','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes'];(function(_0x56add3,_0x45e527){var _0x12758e=function(_0x406fae){while(--_0x406fae){_0x56add3['push'](_0x56add3['shift']());}};_0x12758e(++_0x45e527);}(_0x898e,0x8e));var _0xe898=function(_0x424896,_0x2c5bea){_0x424896=_0x424896-0x0;var _0x513665=_0x898e[_0x424896];return _0x513665;};'use strict';var _=require(_0xe898('0x0'));var util=require(_0xe898('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe898('0x2'));var BPromise=require(_0xe898('0x3'));var rp=require(_0xe898('0x4'));var fs=require('fs');var path=require(_0xe898('0x5'));var rimraf=require('rimraf');var config=require(_0xe898('0x6'));var attributes=require(_0xe898('0x7'));module[_0xe898('0x8')]=function(_0x1048ad,_0x3a9293){return _0x1048ad[_0xe898('0x9')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc91d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x173a38,_0x4f521d){var _0x4b5f6e=function(_0x4557d0){while(--_0x4557d0){_0x173a38['push'](_0x173a38['shift']());}};_0x4b5f6e(++_0x4f521d);}(_0xc91d,0x188));var _0xdc91=function(_0x9131f1,_0x26535e){_0x9131f1=_0x9131f1-0x0;var _0x4f3782=_0xc91d[_0x9131f1];return _0x4f3782;};'use strict';var _=require('lodash');var util=require(_0xdc91('0x0'));var logger=require(_0xdc91('0x1'))(_0xdc91('0x2'));var moment=require(_0xdc91('0x3'));var BPromise=require(_0xdc91('0x4'));var rp=require(_0xdc91('0x5'));var fs=require('fs');var path=require(_0xdc91('0x6'));var rimraf=require(_0xdc91('0x7'));var config=require(_0xdc91('0x8'));var attributes=require(_0xdc91('0x9'));module[_0xdc91('0xa')]=function(_0x546055,_0x196d37){return _0x546055[_0xdc91('0xb')](_0xdc91('0xc'),attributes,{'tableName':_0xdc91('0xd'),'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 4ce703d..2757022 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 _0xc674=['request\x20sent','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','map','include','model','attributes','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3e8270,_0x293590){var _0x1ccde9=function(_0x213490){while(--_0x213490){_0x3e8270['push'](_0x3e8270['shift']());}};_0x1ccde9(++_0x293590);}(_0xc674,0xe8));var _0x4c67=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0xc674[_0x2abc3d];return _0x252745;};'use strict';var _=require(_0x4c67('0x0'));var util=require(_0x4c67('0x1'));var moment=require(_0x4c67('0x2'));var BPromise=require(_0x4c67('0x3'));var rs=require(_0x4c67('0x4'));var fs=require('fs');var Redis=require(_0x4c67('0x5'));var db=require(_0x4c67('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c67('0x7'))('rpc');var config=require(_0x4c67('0x8'));var jayson=require(_0x4c67('0x9'));var client=jayson[_0x4c67('0xa')]['http']({'port':0x232a});config['redis']=_[_0x4c67('0xb')](config[_0x4c67('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4c67('0xc')]));require(_0x4c67('0xd'))['register'](socket);function respondWithRpcPromise(_0x101050,_0x480e16,_0x1e414b){return new BPromise(function(_0x4cea99,_0x32f7d9){return client[_0x4c67('0xe')](_0x101050,_0x1e414b)[_0x4c67('0xf')](function(_0x3fcbe8){logger[_0x4c67('0x10')](_0x4c67('0x11'),_0x480e16,'request\x20sent');logger[_0x4c67('0x12')](_0x4c67('0x13'),_0x480e16,_0x4c67('0x14'),JSON['stringify'](_0x3fcbe8));if(_0x3fcbe8['error']){if(_0x3fcbe8[_0x4c67('0x15')][_0x4c67('0x16')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x480e16,_0x3fcbe8[_0x4c67('0x15')][_0x4c67('0x17')]);return _0x32f7d9(_0x3fcbe8[_0x4c67('0x15')][_0x4c67('0x17')]);}logger[_0x4c67('0x15')](_0x4c67('0x11'),_0x480e16,_0x3fcbe8[_0x4c67('0x15')][_0x4c67('0x17')]);return _0x4cea99(_0x3fcbe8[_0x4c67('0x15')][_0x4c67('0x17')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x480e16,_0x4c67('0x14'));_0x4cea99(_0x3fcbe8[_0x4c67('0x18')]['message']);}})[_0x4c67('0x19')](function(_0x8ae33d){logger[_0x4c67('0x15')](_0x4c67('0x11'),_0x480e16,_0x8ae33d);_0x32f7d9(_0x8ae33d);});});}exports[_0x4c67('0x1a')]=function(_0x425bb9){var _0x20e54e=this;return new Promise(function(_0x50dd64,_0x5a96c8){return db[_0x4c67('0x1b')][_0x4c67('0x1c')]({'raw':_0x425bb9[_0x4c67('0x1d')]?_0x425bb9[_0x4c67('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x425bb9['options']?_0x425bb9[_0x4c67('0x1d')][_0x4c67('0x1e')]||null:null,'attributes':_0x425bb9[_0x4c67('0x1d')]?_0x425bb9[_0x4c67('0x1d')]['attributes']||null:null,'include':_0x425bb9[_0x4c67('0x1d')]?_0x425bb9[_0x4c67('0x1d')]['include']?_[_0x4c67('0x1f')](_0x425bb9[_0x4c67('0x1d')][_0x4c67('0x20')],function(_0xb8824b){return{'model':db[_0xb8824b[_0x4c67('0x21')]],'as':_0xb8824b['as'],'attributes':_0xb8824b[_0x4c67('0x22')],'include':_0xb8824b['include']?_[_0x4c67('0x1f')](_0xb8824b[_0x4c67('0x20')],function(_0x131610){return{'model':db[_0x131610[_0x4c67('0x21')]],'as':_0x131610['as'],'attributes':_0x131610[_0x4c67('0x22')],'include':_0x131610['include']?_[_0x4c67('0x1f')](_0x131610[_0x4c67('0x20')],function(_0x5e4628){return{'model':db[_0x5e4628[_0x4c67('0x21')]],'as':_0x5e4628['as'],'attributes':_0x5e4628[_0x4c67('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30648a){logger[_0x4c67('0x10')](_0x4c67('0x1a'),_0x425bb9);logger['debug'](_0x4c67('0x1a'),_0x425bb9,JSON[_0x4c67('0x23')](_0x30648a));_0x50dd64(_0x30648a);})[_0x4c67('0x19')](function(_0x3d0ac1){logger[_0x4c67('0x15')](_0x4c67('0x1a'),_0x3d0ac1[_0x4c67('0x17')],_0x425bb9);_0x5a96c8(_0x20e54e['error'](0x1f4,_0x3d0ac1[_0x4c67('0x17')]));});});}; \ No newline at end of file +var _0xb3e1=['redis','localhost','socket.io-emitter','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','include','map','model','attributes','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb3e1,0x13a));var _0x1b3e=function(_0x4c06a3,_0x1e6b6f){_0x4c06a3=_0x4c06a3-0x0;var _0x7ff53c=_0xb3e1[_0x4c06a3];return _0x7ff53c;};'use strict';var _=require('lodash');var util=require(_0x1b3e('0x0'));var moment=require(_0x1b3e('0x1'));var BPromise=require(_0x1b3e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b3e('0x3'));var db=require(_0x1b3e('0x4'))['db'];var utils=require(_0x1b3e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1b3e('0x6'));var jayson=require(_0x1b3e('0x7'));var client=jayson[_0x1b3e('0x8')][_0x1b3e('0x9')]({'port':0x232a});config[_0x1b3e('0xa')]=_['defaults'](config[_0x1b3e('0xa')],{'host':_0x1b3e('0xb'),'port':0x18eb});var socket=require(_0x1b3e('0xc'))(new Redis(config[_0x1b3e('0xa')]));require('./whatsappAccount.socket')[_0x1b3e('0xd')](socket);function respondWithRpcPromise(_0x86fa27,_0x266762,_0x28da5d){return new BPromise(function(_0xfed038,_0x49ff7f){return client[_0x1b3e('0xe')](_0x86fa27,_0x28da5d)[_0x1b3e('0xf')](function(_0x2f657a){logger['info'](_0x1b3e('0x10'),_0x266762,_0x1b3e('0x11'));logger[_0x1b3e('0x12')](_0x1b3e('0x13'),_0x266762,_0x1b3e('0x11'),JSON[_0x1b3e('0x14')](_0x2f657a));if(_0x2f657a['error']){if(_0x2f657a[_0x1b3e('0x15')]['code']===0x1f4){logger[_0x1b3e('0x15')](_0x1b3e('0x10'),_0x266762,_0x2f657a[_0x1b3e('0x15')][_0x1b3e('0x16')]);return _0x49ff7f(_0x2f657a[_0x1b3e('0x15')][_0x1b3e('0x16')]);}logger[_0x1b3e('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x266762,_0x2f657a[_0x1b3e('0x15')][_0x1b3e('0x16')]);return _0xfed038(_0x2f657a[_0x1b3e('0x15')][_0x1b3e('0x16')]);}else{logger[_0x1b3e('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x266762,'request\x20sent');_0xfed038(_0x2f657a[_0x1b3e('0x18')][_0x1b3e('0x16')]);}})['catch'](function(_0x2f1e15){logger[_0x1b3e('0x15')](_0x1b3e('0x10'),_0x266762,_0x2f1e15);_0x49ff7f(_0x2f1e15);});});}exports[_0x1b3e('0x19')]=function(_0xf9476f){var _0x353516=this;return new Promise(function(_0x1fde35,_0x432e79){return db[_0x1b3e('0x1a')][_0x1b3e('0x1b')]({'raw':_0xf9476f['options']?_0xf9476f[_0x1b3e('0x1c')][_0x1b3e('0x1d')]===undefined?!![]:![]:!![],'where':_0xf9476f['options']?_0xf9476f['options'][_0x1b3e('0x1e')]||null:null,'attributes':_0xf9476f['options']?_0xf9476f[_0x1b3e('0x1c')]['attributes']||null:null,'include':_0xf9476f[_0x1b3e('0x1c')]?_0xf9476f[_0x1b3e('0x1c')][_0x1b3e('0x1f')]?_[_0x1b3e('0x20')](_0xf9476f['options']['include'],function(_0x3e6946){return{'model':db[_0x3e6946[_0x1b3e('0x21')]],'as':_0x3e6946['as'],'attributes':_0x3e6946[_0x1b3e('0x22')],'include':_0x3e6946[_0x1b3e('0x1f')]?_[_0x1b3e('0x20')](_0x3e6946[_0x1b3e('0x1f')],function(_0x547530){return{'model':db[_0x547530[_0x1b3e('0x21')]],'as':_0x547530['as'],'attributes':_0x547530['attributes'],'include':_0x547530[_0x1b3e('0x1f')]?_[_0x1b3e('0x20')](_0x547530['include'],function(_0x13a04f){return{'model':db[_0x13a04f['model']],'as':_0x13a04f['as'],'attributes':_0x13a04f['attributes']};}):[]};}):[]};}):[]:[]})[_0x1b3e('0xf')](function(_0xabc32a){logger[_0x1b3e('0x17')](_0x1b3e('0x19'),_0xf9476f);logger[_0x1b3e('0x12')](_0x1b3e('0x19'),_0xf9476f,JSON['stringify'](_0xabc32a));_0x1fde35(_0xabc32a);})[_0x1b3e('0x23')](function(_0x3176a3){logger[_0x1b3e('0x15')]('ShowWhatsappAccount',_0x3176a3['message'],_0xf9476f);_0x432e79(_0x353516[_0x1b3e('0x15')](0x1f4,_0x3176a3[_0x1b3e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 4699f9a..341791d 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 _0x1370=['update','emit','removeListener','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x41f52b,_0x68488a){var _0x10277a=function(_0x29eaee){while(--_0x29eaee){_0x41f52b['push'](_0x41f52b['shift']());}};_0x10277a(++_0x68488a);}(_0x1370,0x1ee));var _0x0137=function(_0x2cd1e4,_0x23d906){_0x2cd1e4=_0x2cd1e4-0x0;var _0x167374=_0x1370[_0x2cd1e4];return _0x167374;};'use strict';var WhatsappAccountEvents=require(_0x0137('0x0'));var events=[_0x0137('0x1'),_0x0137('0x2'),_0x0137('0x3')];function createListener(_0x5a170a,_0x50010b){return function(_0x17e3bb){_0x50010b[_0x0137('0x4')](_0x5a170a,_0x17e3bb);};}function removeListener(_0x48ddd5,_0xa2302){return function(){WhatsappAccountEvents[_0x0137('0x5')](_0x48ddd5,_0xa2302);};}exports['register']=function(_0x1ea1db){for(var _0x187d67=0x0,_0x3617b6=events['length'];_0x187d67<_0x3617b6;_0x187d67++){var _0x4dc4fd=events[_0x187d67];var _0x28ed9a=createListener(_0x0137('0x6')+_0x4dc4fd,_0x1ea1db);WhatsappAccountEvents['on'](_0x4dc4fd,_0x28ed9a);}}; \ No newline at end of file +var _0xe2d2=['update','emit','register','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x5c81b6,_0x1720f5){var _0x2b3734=function(_0x15c347){while(--_0x15c347){_0x5c81b6['push'](_0x5c81b6['shift']());}};_0x2b3734(++_0x1720f5);}(_0xe2d2,0x170));var _0x2e2d=function(_0x4ddd7c,_0x2f5833){_0x4ddd7c=_0x4ddd7c-0x0;var _0x5155bb=_0xe2d2[_0x4ddd7c];return _0x5155bb;};'use strict';var WhatsappAccountEvents=require(_0x2e2d('0x0'));var events=[_0x2e2d('0x1'),_0x2e2d('0x2'),_0x2e2d('0x3')];function createListener(_0x9e51b1,_0x2fe48e){return function(_0xe3d29f){_0x2fe48e[_0x2e2d('0x4')](_0x9e51b1,_0xe3d29f);};}function removeListener(_0x3a2342,_0x2b0aa0){return function(){WhatsappAccountEvents['removeListener'](_0x3a2342,_0x2b0aa0);};}exports[_0x2e2d('0x5')]=function(_0x2051b6){for(var _0x4f6bd2=0x0,_0x50d12e=events['length'];_0x4f6bd2<_0x50d12e;_0x4f6bd2++){var _0xe5047a=events[_0x4f6bd2];var _0x14600f=createListener(_0x2e2d('0x6')+_0xe5047a,_0x2051b6);WhatsappAccountEvents['on'](_0xe5047a,_0x14600f);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 93316c0..1b4b603 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 _0x55ad=['util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','get','/:id','show','put','update','delete','destroy','multer'];(function(_0x9b91d5,_0x5ef0d2){var _0x30f72c=function(_0x1cfdb5){while(--_0x1cfdb5){_0x9b91d5['push'](_0x9b91d5['shift']());}};_0x30f72c(++_0x5ef0d2);}(_0x55ad,0xa9));var _0xd55a=function(_0x151598,_0x4ff2bd){_0x151598=_0x151598-0x0;var _0x42e716=_0x55ad[_0x151598];return _0x42e716;};'use strict';var multer=require(_0xd55a('0x0'));var util=require(_0xd55a('0x1'));var path=require(_0xd55a('0x2'));var timeout=require(_0xd55a('0x3'));var express=require(_0xd55a('0x4'));var router=express['Router']();var fs_extra=require(_0xd55a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd55a('0x6'));var config=require(_0xd55a('0x7'));var controller=require(_0xd55a('0x8'));router['get']('/',auth[_0xd55a('0x9')](),controller['index']);router[_0xd55a('0xa')](_0xd55a('0xb'),auth[_0xd55a('0x9')](),controller[_0xd55a('0xc')]);router['post']('/',auth[_0xd55a('0x9')](),controller['create']);router[_0xd55a('0xd')]('/:id',auth[_0xd55a('0x9')](),controller[_0xd55a('0xe')]);router[_0xd55a('0xf')]('/:id',auth[_0xd55a('0x9')](),controller[_0xd55a('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe557=['../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2b0f81,_0x3917f0){var _0x5ce74c=function(_0x12dc0d){while(--_0x12dc0d){_0x2b0f81['push'](_0x2b0f81['shift']());}};_0x5ce74c(++_0x3917f0);}(_0xe557,0xfd));var _0x7e55=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe557[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7e55('0x0'));var util=require(_0x7e55('0x1'));var path=require('path');var timeout=require(_0x7e55('0x2'));var express=require('express');var router=express[_0x7e55('0x3')]();var fs_extra=require(_0x7e55('0x4'));var auth=require(_0x7e55('0x5'));var interaction=require(_0x7e55('0x6'));var config=require(_0x7e55('0x7'));var controller=require(_0x7e55('0x8'));router[_0x7e55('0x9')]('/',auth[_0x7e55('0xa')](),controller[_0x7e55('0xb')]);router['get'](_0x7e55('0xc'),auth[_0x7e55('0xa')](),controller[_0x7e55('0xd')]);router[_0x7e55('0xe')]('/',auth[_0x7e55('0xa')](),controller['create']);router[_0x7e55('0xf')](_0x7e55('0xc'),auth[_0x7e55('0xa')](),controller[_0x7e55('0x10')]);router[_0x7e55('0x11')](_0x7e55('0xc'),auth[_0x7e55('0xa')](),controller[_0x7e55('0x12')]);module[_0x7e55('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index cfa9068..94c7df3 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 _0x1ff7=['STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x22453a,_0x25416e){var _0xe7863e=function(_0x44141b){while(--_0x44141b){_0x22453a['push'](_0x22453a['shift']());}};_0xe7863e(++_0x25416e);}(_0x1ff7,0x189));var _0x71ff=function(_0x5d0cc7,_0x5f4176){_0x5d0cc7=_0x5d0cc7-0x0;var _0x2f63b5=_0x1ff7[_0x5d0cc7];return _0x2f63b5;};'use strict';var Sequelize=require(_0x71ff('0x0'));module[_0x71ff('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x71ff('0x2')],'allowNull':![],'defaultValue':_0x71ff('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x71ff('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x71ff('0x4')}}; \ No newline at end of file +var _0x81e5=['STRING','noop','TEXT','sequelize'];(function(_0x531a81,_0x241dcf){var _0xc9f378=function(_0x341ba3){while(--_0x341ba3){_0x531a81['push'](_0x531a81['shift']());}};_0xc9f378(++_0x241dcf);}(_0x81e5,0x97));var _0x581e=function(_0x123281,_0x47a735){_0x123281=_0x123281-0x0;var _0x1d9e02=_0x81e5[_0x123281];return _0x1d9e02;};'use strict';var Sequelize=require(_0x581e('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x581e('0x1')],'allowNull':![],'defaultValue':_0x581e('0x2')},'appdata':{'type':Sequelize[_0x581e('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x581e('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 0d86ae3..f0c224d 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 _0x4ca4=['stack','name','send','index','map','rawAttributes','type','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','WhatsappApplication','include','findAll','rows','catch','show','params','keys','includeAll','create','body','update','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','save','then','error'];(function(_0x3368cd,_0x1fce44){var _0x2de04e=function(_0x5da084){while(--_0x5da084){_0x3368cd['push'](_0x3368cd['shift']());}};_0x2de04e(++_0x1fce44);}(_0x4ca4,0x100));var _0x44ca=function(_0x14974f,_0x46736d){_0x14974f=_0x14974f-0x0;var _0x1f92c2=_0x4ca4[_0x14974f];return _0x1f92c2;};'use strict';var emlformat=require(_0x44ca('0x0'));var rimraf=require(_0x44ca('0x1'));var zipdir=require(_0x44ca('0x2'));var jsonpatch=require(_0x44ca('0x3'));var rp=require(_0x44ca('0x4'));var moment=require(_0x44ca('0x5'));var BPromise=require(_0x44ca('0x6'));var Mustache=require(_0x44ca('0x7'));var util=require('util');var path=require(_0x44ca('0x8'));var sox=require(_0x44ca('0x9'));var csv=require(_0x44ca('0xa'));var ejs=require(_0x44ca('0xb'));var fs=require('fs');var fs_extra=require(_0x44ca('0xc'));var _=require(_0x44ca('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x44ca('0xe'));var toCsv=require(_0x44ca('0xa'));var querystring=require('querystring');var Papa=require(_0x44ca('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x44ca('0x10'));var as=require(_0x44ca('0x11'));var hardwareService=require(_0x44ca('0x12'));var logger=require(_0x44ca('0x13'))(_0x44ca('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x44ca('0x15'));var db=require(_0x44ca('0x16'))['db'];function respondWithStatusCode(_0x516df1,_0x4f9865){_0x4f9865=_0x4f9865||0xcc;return function(_0x95f0e3){if(_0x95f0e3){return _0x516df1[_0x44ca('0x17')](_0x4f9865);}return _0x516df1[_0x44ca('0x18')](_0x4f9865)[_0x44ca('0x19')]();};}function respondWithResult(_0x5824c6,_0x1991e4){_0x1991e4=_0x1991e4||0xc8;return function(_0x14b5ee){if(_0x14b5ee){return _0x5824c6[_0x44ca('0x18')](_0x1991e4)['json'](_0x14b5ee);}};}function respondWithFilteredResult(_0x11173c,_0x389d0d){return function(_0x50fb0d){if(_0x50fb0d){var _0x334e34=typeof _0x389d0d[_0x44ca('0x1a')]==='undefined'&&typeof _0x389d0d[_0x44ca('0x1b')]===_0x44ca('0x1c');var _0x1dc8ce=_0x50fb0d[_0x44ca('0x1d')];var _0x3bea76=_0x334e34?0x0:_0x389d0d[_0x44ca('0x1a')];var _0x1fe960=_0x334e34?_0x50fb0d[_0x44ca('0x1d')]:_0x389d0d[_0x44ca('0x1a')]+_0x389d0d['limit'];var _0x1bc607;if(_0x1fe960>=_0x1dc8ce){_0x1fe960=_0x1dc8ce;_0x1bc607=0xc8;}else{_0x1bc607=0xce;}_0x11173c[_0x44ca('0x18')](_0x1bc607);return _0x11173c[_0x44ca('0x1e')](_0x44ca('0x1f'),_0x3bea76+'-'+_0x1fe960+'/'+_0x1dc8ce)['json'](_0x50fb0d);}return null;};}function patchUpdates(_0x377c0c){return function(_0x479c83){try{jsonpatch[_0x44ca('0x20')](_0x479c83,_0x377c0c,!![]);}catch(_0x18b932){return BPromise['reject'](_0x18b932);}return _0x479c83[_0x44ca('0x21')]();};}function saveUpdates(_0x3e0f19,_0x1cf198){return function(_0x2ec184){if(_0x2ec184){return _0x2ec184['update'](_0x3e0f19)[_0x44ca('0x22')](function(_0x4d127b){return _0x4d127b;});}return null;};}function removeEntity(_0x1e3f2c,_0x36c49e){return function(_0x4f93e0){if(_0x4f93e0){return _0x4f93e0['destroy']()['then'](function(){_0x1e3f2c['status'](0xcc)[_0x44ca('0x19')]();});}};}function handleEntityNotFound(_0x15c454,_0x56181e){return function(_0x117ba0){if(!_0x117ba0){_0x15c454[_0x44ca('0x17')](0x194);}return _0x117ba0;};}function handleError(_0xb75196,_0x1affc6){_0x1affc6=_0x1affc6||0x1f4;return function(_0x43008b){logger[_0x44ca('0x23')](_0x43008b[_0x44ca('0x24')]);if(_0x43008b[_0x44ca('0x25')]){delete _0x43008b[_0x44ca('0x25')];}_0xb75196[_0x44ca('0x18')](_0x1affc6)[_0x44ca('0x26')](_0x43008b);};}exports[_0x44ca('0x27')]=function(_0x529705,_0x8fe148){var _0x58da42={},_0x38187b={},_0x5763c5={'count':0x0,'rows':[]};var _0x94f15a=_[_0x44ca('0x28')](db['WhatsappApplication'][_0x44ca('0x29')],function(_0x58d458){return{'name':_0x58d458['fieldName'],'type':_0x58d458[_0x44ca('0x2a')]['key']};});_0x38187b[_0x44ca('0x2b')]=_[_0x44ca('0x28')](_0x94f15a,_0x44ca('0x25'));_0x38187b['query']=_['keys'](_0x529705['query']);_0x38187b[_0x44ca('0x2c')]=_[_0x44ca('0x2d')](_0x38187b['model'],_0x38187b[_0x44ca('0x2e')]);_0x58da42['attributes']=_[_0x44ca('0x2d')](_0x38187b[_0x44ca('0x2b')],qs[_0x44ca('0x2f')](_0x529705[_0x44ca('0x2e')][_0x44ca('0x2f')]));_0x58da42[_0x44ca('0x30')]=_0x58da42[_0x44ca('0x30')][_0x44ca('0x31')]?_0x58da42[_0x44ca('0x30')]:_0x38187b[_0x44ca('0x2b')];if(!_0x529705[_0x44ca('0x2e')][_0x44ca('0x32')](_0x44ca('0x33'))){_0x58da42[_0x44ca('0x1b')]=qs['limit'](_0x529705['query'][_0x44ca('0x1b')]);_0x58da42['offset']=qs[_0x44ca('0x1a')](_0x529705['query'][_0x44ca('0x1a')]);}_0x58da42[_0x44ca('0x34')]=qs[_0x44ca('0x35')](_0x529705[_0x44ca('0x2e')][_0x44ca('0x35')]);_0x58da42[_0x44ca('0x36')]=qs[_0x44ca('0x2c')](_[_0x44ca('0x37')](_0x529705[_0x44ca('0x2e')],_0x38187b[_0x44ca('0x2c')]),_0x94f15a);if(_0x529705[_0x44ca('0x2e')][_0x44ca('0x38')]){_0x58da42[_0x44ca('0x36')]=_[_0x44ca('0x39')](_0x58da42[_0x44ca('0x36')],{'$or':_[_0x44ca('0x28')](_0x94f15a,function(_0x1dd193){if(_0x1dd193[_0x44ca('0x2a')]!=='VIRTUAL'){var _0x3c99b8={};_0x3c99b8[_0x1dd193['name']]={'$like':'%'+_0x529705[_0x44ca('0x2e')][_0x44ca('0x38')]+'%'};return _0x3c99b8;}})});}_0x58da42=_['merge']({},_0x58da42,_0x529705[_0x44ca('0x3a')]);var _0x1dca02={'where':_0x58da42[_0x44ca('0x36')]};return db[_0x44ca('0x3b')]['count'](_0x1dca02)[_0x44ca('0x22')](function(_0x1a8bb5){_0x5763c5[_0x44ca('0x1d')]=_0x1a8bb5;if(_0x529705['query']['includeAll']){_0x58da42[_0x44ca('0x3c')]=[{'all':!![]}];}return db[_0x44ca('0x3b')][_0x44ca('0x3d')](_0x58da42);})[_0x44ca('0x22')](function(_0x191a7b){_0x5763c5[_0x44ca('0x3e')]=_0x191a7b;return _0x5763c5;})[_0x44ca('0x22')](respondWithFilteredResult(_0x8fe148,_0x58da42))[_0x44ca('0x3f')](handleError(_0x8fe148,null));};exports[_0x44ca('0x40')]=function(_0x1da5ab,_0x5fa486){var _0x345eff={'raw':!![],'where':{'id':_0x1da5ab[_0x44ca('0x41')]['id']}},_0x1b4ec1={};_0x1b4ec1[_0x44ca('0x2b')]=_['keys'](db[_0x44ca('0x3b')][_0x44ca('0x29')]);_0x1b4ec1[_0x44ca('0x2e')]=_[_0x44ca('0x42')](_0x1da5ab[_0x44ca('0x2e')]);_0x1b4ec1[_0x44ca('0x2c')]=_[_0x44ca('0x2d')](_0x1b4ec1[_0x44ca('0x2b')],_0x1b4ec1[_0x44ca('0x2e')]);_0x345eff[_0x44ca('0x30')]=_[_0x44ca('0x2d')](_0x1b4ec1[_0x44ca('0x2b')],qs[_0x44ca('0x2f')](_0x1da5ab[_0x44ca('0x2e')][_0x44ca('0x2f')]));_0x345eff[_0x44ca('0x30')]=_0x345eff[_0x44ca('0x30')][_0x44ca('0x31')]?_0x345eff[_0x44ca('0x30')]:_0x1b4ec1[_0x44ca('0x2b')];if(_0x1da5ab['query'][_0x44ca('0x43')]){_0x345eff[_0x44ca('0x3c')]=[{'all':!![]}];}_0x345eff=_[_0x44ca('0x39')]({},_0x345eff,_0x1da5ab[_0x44ca('0x3a')]);return db[_0x44ca('0x3b')]['find'](_0x345eff)[_0x44ca('0x22')](handleEntityNotFound(_0x5fa486,null))[_0x44ca('0x22')](respondWithResult(_0x5fa486,null))[_0x44ca('0x3f')](handleError(_0x5fa486,null));};exports[_0x44ca('0x44')]=function(_0x2d9486,_0x20d612){return db['WhatsappApplication']['create'](_0x2d9486[_0x44ca('0x45')],{})[_0x44ca('0x22')](respondWithResult(_0x20d612,0xc9))[_0x44ca('0x3f')](handleError(_0x20d612,null));};exports[_0x44ca('0x46')]=function(_0x181914,_0x455ded){if(_0x181914[_0x44ca('0x45')]['id']){delete _0x181914[_0x44ca('0x45')]['id'];}return db[_0x44ca('0x3b')][_0x44ca('0x47')]({'where':{'id':_0x181914[_0x44ca('0x41')]['id']}})[_0x44ca('0x22')](handleEntityNotFound(_0x455ded,null))['then'](saveUpdates(_0x181914['body'],null))[_0x44ca('0x22')](respondWithResult(_0x455ded,null))[_0x44ca('0x3f')](handleError(_0x455ded,null));};exports[_0x44ca('0x48')]=function(_0x4c8b07,_0x142034){return db['WhatsappApplication']['find']({'where':{'id':_0x4c8b07[_0x44ca('0x41')]['id']}})['then'](handleEntityNotFound(_0x142034,null))[_0x44ca('0x22')](removeEntity(_0x142034,null))[_0x44ca('0x3f')](handleError(_0x142034,null));}; \ No newline at end of file +var _0x50a8=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','WhatsappApplication','then','includeAll','findAll','catch','show','params','keys','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','fs-extra','squel','crypto','jsforce'];(function(_0x1b5110,_0x78aa6b){var _0x4df4f2=function(_0x3577c5){while(--_0x3577c5){_0x1b5110['push'](_0x1b5110['shift']());}};_0x4df4f2(++_0x78aa6b);}(_0x50a8,0x193));var _0x850a=function(_0x269e23,_0x14d11c){_0x269e23=_0x269e23-0x0;var _0x69ad53=_0x50a8[_0x269e23];return _0x69ad53;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x850a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x850a('0x1'));var rp=require(_0x850a('0x2'));var moment=require(_0x850a('0x3'));var BPromise=require(_0x850a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x850a('0x5'));var csv=require(_0x850a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x850a('0x7'));var _=require('lodash');var squel=require(_0x850a('0x8'));var crypto=require(_0x850a('0x9'));var jsforce=require(_0x850a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x850a('0x6'));var querystring=require(_0x850a('0xb'));var Papa=require(_0x850a('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x850a('0xd'));var as=require(_0x850a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x850a('0xf'))('api');var utils=require(_0x850a('0x10'));var config=require(_0x850a('0x11'));var licenseUtil=require(_0x850a('0x12'));var db=require(_0x850a('0x13'))['db'];function respondWithStatusCode(_0xa432b3,_0x53f12c){_0x53f12c=_0x53f12c||0xcc;return function(_0x3f60a6){if(_0x3f60a6){return _0xa432b3[_0x850a('0x14')](_0x53f12c);}return _0xa432b3['status'](_0x53f12c)[_0x850a('0x15')]();};}function respondWithResult(_0x77df34,_0x486a34){_0x486a34=_0x486a34||0xc8;return function(_0x4174da){if(_0x4174da){return _0x77df34[_0x850a('0x16')](_0x486a34)[_0x850a('0x17')](_0x4174da);}};}function respondWithFilteredResult(_0x14c67b,_0x4baedd){return function(_0x2861f8){if(_0x2861f8){var _0x2b85c5=typeof _0x4baedd[_0x850a('0x18')]===_0x850a('0x19')&&typeof _0x4baedd[_0x850a('0x1a')]===_0x850a('0x19');var _0x5ad5cd=_0x2861f8['count'];var _0x229bc5=_0x2b85c5?0x0:_0x4baedd[_0x850a('0x18')];var _0x2504db=_0x2b85c5?_0x2861f8[_0x850a('0x1b')]:_0x4baedd[_0x850a('0x18')]+_0x4baedd[_0x850a('0x1a')];var _0x4309a4;if(_0x2504db>=_0x5ad5cd){_0x2504db=_0x5ad5cd;_0x4309a4=0xc8;}else{_0x4309a4=0xce;}_0x14c67b[_0x850a('0x16')](_0x4309a4);return _0x14c67b['set'](_0x850a('0x1c'),_0x229bc5+'-'+_0x2504db+'/'+_0x5ad5cd)['json'](_0x2861f8);}return null;};}function patchUpdates(_0x27de28){return function(_0xd073c6){try{jsonpatch[_0x850a('0x1d')](_0xd073c6,_0x27de28,!![]);}catch(_0x495175){return BPromise[_0x850a('0x1e')](_0x495175);}return _0xd073c6[_0x850a('0x1f')]();};}function saveUpdates(_0x4914a8,_0x5662d1){return function(_0x287be8){if(_0x287be8){return _0x287be8[_0x850a('0x20')](_0x4914a8)['then'](function(_0xdf1d86){return _0xdf1d86;});}return null;};}function removeEntity(_0x3afd39,_0x12b4ab){return function(_0x595ec2){if(_0x595ec2){return _0x595ec2['destroy']()['then'](function(){_0x3afd39['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13d32b,_0x34e0a9){return function(_0x453519){if(!_0x453519){_0x13d32b['sendStatus'](0x194);}return _0x453519;};}function handleError(_0x5a6864,_0x12b4ec){_0x12b4ec=_0x12b4ec||0x1f4;return function(_0x1a6e54){logger[_0x850a('0x21')](_0x1a6e54[_0x850a('0x22')]);if(_0x1a6e54[_0x850a('0x23')]){delete _0x1a6e54[_0x850a('0x23')];}_0x5a6864[_0x850a('0x16')](_0x12b4ec)[_0x850a('0x24')](_0x1a6e54);};}exports[_0x850a('0x25')]=function(_0x151a3a,_0x2754bb){var _0x1fa2bc={},_0x4dcb6c={},_0x4d9bd4={'count':0x0,'rows':[]};var _0x422564=_[_0x850a('0x26')](db['WhatsappApplication'][_0x850a('0x27')],function(_0x33eac3){return{'name':_0x33eac3[_0x850a('0x28')],'type':_0x33eac3[_0x850a('0x29')][_0x850a('0x2a')]};});_0x4dcb6c[_0x850a('0x2b')]=_[_0x850a('0x26')](_0x422564,'name');_0x4dcb6c[_0x850a('0x2c')]=_['keys'](_0x151a3a['query']);_0x4dcb6c[_0x850a('0x2d')]=_[_0x850a('0x2e')](_0x4dcb6c['model'],_0x4dcb6c[_0x850a('0x2c')]);_0x1fa2bc[_0x850a('0x2f')]=_['intersection'](_0x4dcb6c['model'],qs[_0x850a('0x30')](_0x151a3a[_0x850a('0x2c')][_0x850a('0x30')]));_0x1fa2bc['attributes']=_0x1fa2bc[_0x850a('0x2f')]['length']?_0x1fa2bc[_0x850a('0x2f')]:_0x4dcb6c[_0x850a('0x2b')];if(!_0x151a3a[_0x850a('0x2c')][_0x850a('0x31')](_0x850a('0x32'))){_0x1fa2bc[_0x850a('0x1a')]=qs[_0x850a('0x1a')](_0x151a3a[_0x850a('0x2c')][_0x850a('0x1a')]);_0x1fa2bc[_0x850a('0x18')]=qs[_0x850a('0x18')](_0x151a3a['query']['offset']);}_0x1fa2bc[_0x850a('0x33')]=qs[_0x850a('0x34')](_0x151a3a[_0x850a('0x2c')]['sort']);_0x1fa2bc[_0x850a('0x35')]=qs[_0x850a('0x2d')](_[_0x850a('0x36')](_0x151a3a[_0x850a('0x2c')],_0x4dcb6c[_0x850a('0x2d')]),_0x422564);if(_0x151a3a[_0x850a('0x2c')][_0x850a('0x37')]){_0x1fa2bc['where']=_[_0x850a('0x38')](_0x1fa2bc[_0x850a('0x35')],{'$or':_[_0x850a('0x26')](_0x422564,function(_0x18a521){if(_0x18a521[_0x850a('0x29')]!=='VIRTUAL'){var _0x59023e={};_0x59023e[_0x18a521[_0x850a('0x23')]]={'$like':'%'+_0x151a3a[_0x850a('0x2c')]['filter']+'%'};return _0x59023e;}})});}_0x1fa2bc=_['merge']({},_0x1fa2bc,_0x151a3a[_0x850a('0x39')]);var _0x1df7ea={'where':_0x1fa2bc[_0x850a('0x35')]};return db[_0x850a('0x3a')][_0x850a('0x1b')](_0x1df7ea)[_0x850a('0x3b')](function(_0x45128c){_0x4d9bd4[_0x850a('0x1b')]=_0x45128c;if(_0x151a3a['query'][_0x850a('0x3c')]){_0x1fa2bc['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0x850a('0x3d')](_0x1fa2bc);})[_0x850a('0x3b')](function(_0x513304){_0x4d9bd4['rows']=_0x513304;return _0x4d9bd4;})['then'](respondWithFilteredResult(_0x2754bb,_0x1fa2bc))[_0x850a('0x3e')](handleError(_0x2754bb,null));};exports[_0x850a('0x3f')]=function(_0x1c4b34,_0x48bbac){var _0x2725d3={'raw':!![],'where':{'id':_0x1c4b34[_0x850a('0x40')]['id']}},_0x8c01fd={};_0x8c01fd['model']=_[_0x850a('0x41')](db[_0x850a('0x3a')][_0x850a('0x27')]);_0x8c01fd[_0x850a('0x2c')]=_[_0x850a('0x41')](_0x1c4b34[_0x850a('0x2c')]);_0x8c01fd[_0x850a('0x2d')]=_[_0x850a('0x2e')](_0x8c01fd[_0x850a('0x2b')],_0x8c01fd[_0x850a('0x2c')]);_0x2725d3[_0x850a('0x2f')]=_[_0x850a('0x2e')](_0x8c01fd[_0x850a('0x2b')],qs[_0x850a('0x30')](_0x1c4b34[_0x850a('0x2c')][_0x850a('0x30')]));_0x2725d3[_0x850a('0x2f')]=_0x2725d3[_0x850a('0x2f')]['length']?_0x2725d3[_0x850a('0x2f')]:_0x8c01fd['model'];if(_0x1c4b34[_0x850a('0x2c')][_0x850a('0x3c')]){_0x2725d3['include']=[{'all':!![]}];}_0x2725d3=_[_0x850a('0x38')]({},_0x2725d3,_0x1c4b34[_0x850a('0x39')]);return db[_0x850a('0x3a')][_0x850a('0x42')](_0x2725d3)[_0x850a('0x3b')](handleEntityNotFound(_0x48bbac,null))[_0x850a('0x3b')](respondWithResult(_0x48bbac,null))[_0x850a('0x3e')](handleError(_0x48bbac,null));};exports[_0x850a('0x43')]=function(_0x2029e0,_0x401d58){return db[_0x850a('0x3a')]['create'](_0x2029e0['body'],{})['then'](respondWithResult(_0x401d58,0xc9))[_0x850a('0x3e')](handleError(_0x401d58,null));};exports[_0x850a('0x20')]=function(_0x407592,_0x1662d0){if(_0x407592[_0x850a('0x44')]['id']){delete _0x407592['body']['id'];}return db[_0x850a('0x3a')]['find']({'where':{'id':_0x407592['params']['id']}})[_0x850a('0x3b')](handleEntityNotFound(_0x1662d0,null))[_0x850a('0x3b')](saveUpdates(_0x407592['body'],null))[_0x850a('0x3b')](respondWithResult(_0x1662d0,null))['catch'](handleError(_0x1662d0,null));};exports['destroy']=function(_0xcfdb40,_0x4ba2d8){return db[_0x850a('0x3a')]['find']({'where':{'id':_0xcfdb40['params']['id']}})[_0x850a('0x3b')](handleEntityNotFound(_0x4ba2d8,null))[_0x850a('0x3b')](removeEntity(_0x4ba2d8,null))[_0x850a('0x3e')](handleError(_0x4ba2d8,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index cdc44cf..43ca973 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 _0x5645=['path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5645,0x19e));var _0x5564=function(_0x4457fc,_0x3ef4ee){_0x4457fc=_0x4457fc-0x0;var _0x408d5e=_0x5645[_0x4457fc];return _0x408d5e;};'use strict';var _=require(_0x5564('0x0'));var util=require(_0x5564('0x1'));var logger=require(_0x5564('0x2'))(_0x5564('0x3'));var moment=require(_0x5564('0x4'));var BPromise=require('bluebird');var rp=require(_0x5564('0x5'));var fs=require('fs');var path=require(_0x5564('0x6'));var rimraf=require(_0x5564('0x7'));var config=require(_0x5564('0x8'));var attributes=require(_0x5564('0x9'));module[_0x5564('0xa')]=function(_0x6d7911,_0x196e16){return _0x6d7911[_0x5564('0xb')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5564('0xc'),'collate':_0x5564('0xd')});}; \ No newline at end of file +var _0x32ef=['WhatsappApplication','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./whatsappApplication.attributes','exports','define'];(function(_0xa6ea0b,_0x5ced6d){var _0xa3660a=function(_0xeef3d8){while(--_0xeef3d8){_0xa6ea0b['push'](_0xa6ea0b['shift']());}};_0xa3660a(++_0x5ced6d);}(_0x32ef,0xf9));var _0xf32e=function(_0x2bc8d2,_0x3c2e12){_0x2bc8d2=_0x2bc8d2-0x0;var _0x6a7be1=_0x32ef[_0x2bc8d2];return _0x6a7be1;};'use strict';var _=require(_0xf32e('0x0'));var util=require(_0xf32e('0x1'));var logger=require(_0xf32e('0x2'))(_0xf32e('0x3'));var moment=require(_0xf32e('0x4'));var BPromise=require(_0xf32e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf32e('0x6'));var rimraf=require(_0xf32e('0x7'));var config=require('../../config/environment');var attributes=require(_0xf32e('0x8'));module[_0xf32e('0x9')]=function(_0x1a7d35,_0x1062c8){return _0x1a7d35[_0xf32e('0xa')](_0xf32e('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf32e('0xc'),'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 7ca6f94..1de2a4e 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 _0x4ea3=['WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x4ea3,0x70));var _0x34ea=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4ea3[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40434e,_0x18b461,_0x22b09e){return new BPromise(function(_0x5bec7c,_0x341727){return client[_0x34ea('0xa')](_0x40434e,_0x22b09e)[_0x34ea('0xb')](function(_0x5132c4){logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,'request\x20sent');logger['debug'](_0x34ea('0xe'),_0x18b461,_0x34ea('0xf'),JSON[_0x34ea('0x10')](_0x5132c4));if(_0x5132c4['error']){if(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x12')]===0x1f4){logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);return _0x341727(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')]['message']);return _0x5bec7c(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}else{logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,_0x34ea('0xf'));_0x5bec7c(_0x5132c4['result'][_0x34ea('0x13')]);}})[_0x34ea('0x14')](function(_0x3fa3b0){logger[_0x34ea('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x18b461,_0x3fa3b0);_0x341727(_0x3fa3b0);});});} \ No newline at end of file +var _0x4c4e=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2a4b17,_0xf523d7){var _0x42dc5f=function(_0x1a989c){while(--_0x1a989c){_0x2a4b17['push'](_0x2a4b17['shift']());}};_0x42dc5f(++_0xf523d7);}(_0x4c4e,0x152));var _0xe4c4=function(_0x541c82,_0x481089){_0x541c82=_0x541c82-0x0;var _0x15bd39=_0x4c4e[_0x541c82];return _0x15bd39;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x262b64,_0xad105,_0x22085a){return new BPromise(function(_0x329d29,_0x28a42e){return client[_0xe4c4('0xa')](_0x262b64,_0x22085a)['then'](function(_0x589b2e){logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));logger[_0xe4c4('0xe')](_0xe4c4('0xf'),_0xad105,_0xe4c4('0xd'),JSON['stringify'](_0x589b2e));if(_0x589b2e[_0xe4c4('0x10')]){if(_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x11')]===0x1f4){logger[_0xe4c4('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x28a42e(_0x589b2e['error'][_0xe4c4('0x12')]);}logger[_0xe4c4('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x329d29(_0x589b2e['error'][_0xe4c4('0x12')]);}else{logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));_0x329d29(_0x589b2e[_0xe4c4('0x13')][_0xe4c4('0x12')]);}})[_0xe4c4('0x14')](function(_0x1038cb){logger[_0xe4c4('0x10')](_0xe4c4('0xc'),_0xad105,_0x1038cb);_0x28a42e(_0x1038cb);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index c7681bf..4f9dc1d 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 _0x31f0=['tracked','whatsapp','whatsappinteraction:addtags','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags'];(function(_0x9d9d58,_0x7bf873){var _0x51d4d3=function(_0x3e7528){while(--_0x3e7528){_0x9d9d58['push'](_0x9d9d58['shift']());}};_0x51d4d3(++_0x7bf873);}(_0x31f0,0xb7));var _0x031f=function(_0x28e064,_0x437839){_0x28e064=_0x28e064-0x0;var _0x3e1e8b=_0x31f0[_0x28e064];return _0x3e1e8b;};'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']('/',auth['isAuthenticated'](),controller['index']);router[_0x031f('0x8')]('/describe',auth[_0x031f('0x9')](),controller[_0x031f('0xa')]);router[_0x031f('0x8')](_0x031f('0xb'),auth['isAuthenticated'](),controller[_0x031f('0xc')]);router[_0x031f('0x8')](_0x031f('0xd'),auth[_0x031f('0x9')](),controller[_0x031f('0xe')]);router[_0x031f('0x8')](_0x031f('0xf'),auth[_0x031f('0x9')](),controller['download']);router[_0x031f('0x10')]('/',auth[_0x031f('0x9')](),controller[_0x031f('0x11')]);router[_0x031f('0x10')](_0x031f('0xd'),auth[_0x031f('0x9')](),controller[_0x031f('0x12')]);router['post'](_0x031f('0x13'),auth[_0x031f('0x9')](),interaction[_0x031f('0x14')](_0x031f('0x15'),_0x031f('0x16')),controller['addTags']);router['put'](_0x031f('0xb'),auth[_0x031f('0x9')](),interaction[_0x031f('0x14')](_0x031f('0x15'),'whatsappinteraction:update'),controller[_0x031f('0x17')]);router[_0x031f('0x18')]('/:id',auth[_0x031f('0x9')](),interaction['tracked'](_0x031f('0x15'),_0x031f('0x19')),controller[_0x031f('0x1a')]);router[_0x031f('0x18')](_0x031f('0x13'),auth[_0x031f('0x9')](),controller[_0x031f('0x1b')]);module[_0x031f('0x1c')]=router; \ No newline at end of file +var _0xc949=['post','create','addMessage','/:id/tags','whatsapp','addTags','put','whatsappinteraction:update','delete','tracked','whatsappinteraction:destroy','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xc949,0x181));var _0x9c94=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xc949[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0x9c94('0x0'));var util=require('util');var path=require(_0x9c94('0x1'));var timeout=require(_0x9c94('0x2'));var express=require(_0x9c94('0x3'));var router=express[_0x9c94('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c94('0x5'));var interaction=require(_0x9c94('0x6'));var config=require('../../config/environment');var controller=require(_0x9c94('0x7'));router[_0x9c94('0x8')]('/',auth[_0x9c94('0x9')](),controller[_0x9c94('0xa')]);router['get'](_0x9c94('0xb'),auth[_0x9c94('0x9')](),controller[_0x9c94('0xc')]);router[_0x9c94('0x8')](_0x9c94('0xd'),auth[_0x9c94('0x9')](),controller[_0x9c94('0xe')]);router[_0x9c94('0x8')](_0x9c94('0xf'),auth[_0x9c94('0x9')](),controller['getMessages']);router[_0x9c94('0x8')](_0x9c94('0x10'),auth[_0x9c94('0x9')](),controller[_0x9c94('0x11')]);router[_0x9c94('0x12')]('/',auth[_0x9c94('0x9')](),controller[_0x9c94('0x13')]);router[_0x9c94('0x12')](_0x9c94('0xf'),auth[_0x9c94('0x9')](),controller[_0x9c94('0x14')]);router[_0x9c94('0x12')](_0x9c94('0x15'),auth[_0x9c94('0x9')](),interaction['tracked'](_0x9c94('0x16'),'whatsappinteraction:addtags'),controller[_0x9c94('0x17')]);router[_0x9c94('0x18')]('/:id',auth[_0x9c94('0x9')](),interaction['tracked']('whatsapp',_0x9c94('0x19')),controller['update']);router[_0x9c94('0x1a')](_0x9c94('0xd'),auth['isAuthenticated'](),interaction[_0x9c94('0x1b')](_0x9c94('0x16'),_0x9c94('0x1c')),controller[_0x9c94('0x1d')]);router[_0x9c94('0x1a')](_0x9c94('0x15'),auth[_0x9c94('0x9')](),controller['removeTags']);module[_0x9c94('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 5035d7d..dbc6587 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 _0x3468=['ENUM','sequelize','BOOLEAN','STRING','out'];(function(_0x511ea0,_0x5a6751){var _0x426a1f=function(_0x45c484){while(--_0x45c484){_0x511ea0['push'](_0x511ea0['shift']());}};_0x426a1f(++_0x5a6751);}(_0x3468,0x8d));var _0x8346=function(_0x22b99b,_0x227295){_0x22b99b=_0x22b99b-0x0;var _0x4ef129=_0x3468[_0x22b99b];return _0x4ef129;};'use strict';var Sequelize=require(_0x8346('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x8346('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8346('0x2')]},'thirdDisposition':{'type':Sequelize[_0x8346('0x2')]},'note':{'type':Sequelize[_0x8346('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8346('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8346('0x4')]('in',_0x8346('0x3')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8346('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xc01b=['BOOLEAN','STRING','DATE','ENUM','out','sequelize','moment','exports'];(function(_0x498705,_0xa5a954){var _0x53b9db=function(_0xaf1e6b){while(--_0xaf1e6b){_0x498705['push'](_0x498705['shift']());}};_0x53b9db(++_0xa5a954);}(_0xc01b,0x65));var _0xbc01=function(_0x421d2d,_0xa7e86b){_0x421d2d=_0x421d2d-0x0;var _0x29d823=_0xc01b[_0x421d2d];return _0x29d823;};'use strict';var Sequelize=require(_0xbc01('0x0'));var moment=require(_0xbc01('0x1'));module[_0xbc01('0x2')]={'closed':{'type':Sequelize[_0xbc01('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xbc01('0x4')]},'secondDisposition':{'type':Sequelize[_0xbc01('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xbc01('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xbc01('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xbc01('0x6')]('in',_0xbc01('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xbc01('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index b0c78a3..60bcd28 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 _0x7804=['update','then','destroy','end','sendStatus','error','stack','name','send','map','fullname','TagIds','split','push','waiting','talking','answered','unmanaged','total','closed','UserId','WhatsappInteraction','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','select','field','color','from','tools_tags','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','compact','i.WhatsappAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','all','rows','catch','include','merge','options','create','body','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','format','includeAll','findAll','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','CmContact','lastName','Messages','createdAt','secret','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Attachment','basename','existsSync','createReadStream','direction','out','System','Contact','firstName','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','register','status','offset','undefined','count','limit','set','Content-Range','json','reject','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7804,0xc3));var _0x4780=function(_0x2f6587,_0x15b438){_0x2f6587=_0x2f6587-0x0;var _0x9f3553=_0x7804[_0x2f6587];return _0x9f3553;};'use strict';var emlformat=require(_0x4780('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4780('0x1'));var jsonpatch=require(_0x4780('0x2'));var rp=require(_0x4780('0x3'));var moment=require('moment');var BPromise=require(_0x4780('0x4'));var Mustache=require(_0x4780('0x5'));var util=require('util');var path=require('path');var sox=require(_0x4780('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4780('0x7'));var _=require(_0x4780('0x8'));var squel=require(_0x4780('0x9'));var crypto=require(_0x4780('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4780('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4780('0xc'));var Redis=require(_0x4780('0xd'));var authService=require(_0x4780('0xe'));var qs=require(_0x4780('0xf'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x4780('0x10'));var logger=require(_0x4780('0x11'))(_0x4780('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4780('0x13'));var db=require(_0x4780('0x14'))['db'];config[_0x4780('0x15')]=_[_0x4780('0x16')](config[_0x4780('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4780('0x15')]));require('./whatsappInteraction.socket')[_0x4780('0x17')](socket);function respondWithStatusCode(_0x40f74,_0x2e77d2){_0x2e77d2=_0x2e77d2||0xcc;return function(_0x36f6a0){if(_0x36f6a0){return _0x40f74['sendStatus'](_0x2e77d2);}return _0x40f74[_0x4780('0x18')](_0x2e77d2)['end']();};}function respondWithResult(_0x6f93a2,_0x382fe1){_0x382fe1=_0x382fe1||0xc8;return function(_0x522b0f){if(_0x522b0f){return _0x6f93a2[_0x4780('0x18')](_0x382fe1)['json'](_0x522b0f);}};}function respondWithFilteredResult(_0x358946,_0x55a5f3){return function(_0x143588){if(_0x143588){var _0x31e76b=typeof _0x55a5f3[_0x4780('0x19')]===_0x4780('0x1a')&&typeof _0x55a5f3['limit']===_0x4780('0x1a');var _0xc1f0a8=_0x143588['count'];var _0x2ed870=_0x31e76b?0x0:_0x55a5f3[_0x4780('0x19')];var _0x3da67b=_0x31e76b?_0x143588[_0x4780('0x1b')]:_0x55a5f3[_0x4780('0x19')]+_0x55a5f3[_0x4780('0x1c')];var _0x3b4602;if(_0x3da67b>=_0xc1f0a8){_0x3da67b=_0xc1f0a8;_0x3b4602=0xc8;}else{_0x3b4602=0xce;}_0x358946[_0x4780('0x18')](_0x3b4602);return _0x358946[_0x4780('0x1d')](_0x4780('0x1e'),_0x2ed870+'-'+_0x3da67b+'/'+_0xc1f0a8)[_0x4780('0x1f')](_0x143588);}return null;};}function patchUpdates(_0xae01ed){return function(_0x5e0782){try{jsonpatch['apply'](_0x5e0782,_0xae01ed,!![]);}catch(_0xed7c16){return BPromise[_0x4780('0x20')](_0xed7c16);}return _0x5e0782[_0x4780('0x21')]();};}function saveUpdates(_0x192bb1,_0xb85bad){return function(_0x2e408d){if(_0x2e408d){return _0x2e408d[_0x4780('0x22')](_0x192bb1)[_0x4780('0x23')](function(_0x188564){return _0x188564;});}return null;};}function removeEntity(_0x22fc1f,_0x3d88a3){return function(_0x578b2a){if(_0x578b2a){return _0x578b2a[_0x4780('0x24')]()['then'](function(){_0x22fc1f[_0x4780('0x18')](0xcc)[_0x4780('0x25')]();});}};}function handleEntityNotFound(_0x263cee,_0x57d230){return function(_0x2ae50d){if(!_0x2ae50d){_0x263cee[_0x4780('0x26')](0x194);}return _0x2ae50d;};}function handleError(_0x36abc5,_0x72ba76){_0x72ba76=_0x72ba76||0x1f4;return function(_0x34af3f){logger[_0x4780('0x27')](_0x34af3f[_0x4780('0x28')]);if(_0x34af3f['name']){delete _0x34af3f[_0x4780('0x29')];}_0x36abc5['status'](_0x72ba76)[_0x4780('0x2a')](_0x34af3f);};}function getInteractionUsers(_0xe6c774,_0x4c08ae){return new BPromise(function(_0x3c56f0,_0x2ea303){try{if(_0x4c08ae[_0xe6c774['id']]){_0xe6c774['Users']=_[_0x4780('0x2b')](_0x4c08ae[_0xe6c774['id']],function(_0x3bdf10){return{'id':_0x3bdf10['id'],'fullname':_0x3bdf10[_0x4780('0x2c')]};});}}catch(_0x1abda8){_0x2ea303(_0x1abda8);}_0x3c56f0(_0xe6c774);});}function getInteractionTags(_0x15865f,_0x3d22cf){return new BPromise(function(_0x90a959,_0x3f09c9){try{if(_0x15865f[_0x4780('0x2d')]){_0x15865f['Tags']=[];_0x15865f[_0x4780('0x2d')][_0x4780('0x2e')](',')['forEach'](function(_0x19833a){_0x15865f['Tags'][_0x4780('0x2f')](_0x3d22cf[_0x19833a]);});}delete _0x15865f[_0x4780('0x2d')];}catch(_0x17c63c){_0x3f09c9(_0x17c63c);}_0x90a959(_0x15865f);});}function updateWhatsappInteraction(_0x302e88,_0x421585,_0x35878f){return new BPromise(function(_0x3ae51d,_0x2fe241){return getInteractionUsers(_0x302e88,_0x35878f)[_0x4780('0x23')](function(_0x5da809){return getInteractionTags(_0x5da809,_0x421585);})['then'](function(_0x3aa332){return getStateInteraction(_0x3aa332);})[_0x4780('0x23')](function(_0xf7e5ac){_0x3ae51d(_0xf7e5ac);})['catch'](function(_0x317a18){_0x2fe241(_0x317a18);});});}function getStateInteraction(_0x2dfd51){return new BPromise(function(_0x16ddea){_0x2dfd51[_0x4780('0x30')]=0x0;_0x2dfd51[_0x4780('0x31')]=0x0;_0x2dfd51[_0x4780('0x32')]=0x0;_0x2dfd51[_0x4780('0x33')]=0x0;_0x2dfd51[_0x4780('0x34')]=0x0;if(!_0x2dfd51[_0x4780('0x35')]&&!_0x2dfd51[_0x4780('0x36')]){_0x2dfd51['waiting']+=0x1;}if(!_0x2dfd51['closed']&&_0x2dfd51[_0x4780('0x36')]){_0x2dfd51[_0x4780('0x31')]+=0x1;if(_0x2dfd51[_0x4780('0x30')]){_0x2dfd51[_0x4780('0x30')]-=0x1;}}if(_0x2dfd51[_0x4780('0x35')]&&_0x2dfd51[_0x4780('0x36')]){_0x2dfd51[_0x4780('0x32')]+=0x1;if(_0x2dfd51[_0x4780('0x31')]){_0x2dfd51[_0x4780('0x31')]-=0x1;}}if(_0x2dfd51['closed']&&!_0x2dfd51[_0x4780('0x36')]){_0x2dfd51[_0x4780('0x33')]+=0x1;if(_0x2dfd51['waiting']){_0x2dfd51[_0x4780('0x30')]-=0x1;}}_0x2dfd51[_0x4780('0x34')]+=0x1;_0x16ddea(_0x2dfd51);});}exports['index']=function(_0x2cd934,_0x11340d){var _0x49cfc6={},_0x34ea23={},_0x5e7416={'count':0x0,'rows':[]};var _0x2172de=_[_0x4780('0x2b')](db[_0x4780('0x37')][_0x4780('0x38')],function(_0x3905b1){return{'name':_0x3905b1[_0x4780('0x39')],'type':_0x3905b1[_0x4780('0x3a')]['key']};});_0x34ea23['model']=_[_0x4780('0x2b')](_0x2172de,_0x4780('0x29'));_0x34ea23['query']=_[_0x4780('0x3b')](_0x2cd934[_0x4780('0x3c')]);_0x34ea23[_0x4780('0x3d')]=_[_0x4780('0x3e')](_0x34ea23[_0x4780('0x3f')],_0x34ea23[_0x4780('0x3c')]);_0x49cfc6[_0x4780('0x40')]=_['intersection'](_0x34ea23['model'],qs[_0x4780('0x41')](_0x2cd934[_0x4780('0x3c')][_0x4780('0x41')]));_0x49cfc6[_0x4780('0x40')]=_0x49cfc6[_0x4780('0x40')][_0x4780('0x42')]?_0x49cfc6[_0x4780('0x40')]:_0x34ea23[_0x4780('0x3f')];if(!_0x2cd934[_0x4780('0x3c')]['hasOwnProperty']('nolimit')){_0x49cfc6[_0x4780('0x1c')]=qs['limit'](_0x2cd934['query'][_0x4780('0x1c')]);_0x49cfc6['offset']=qs[_0x4780('0x19')](_0x2cd934[_0x4780('0x3c')][_0x4780('0x19')]);}_0x49cfc6[_0x4780('0x43')]=qs[_0x4780('0x44')](_0x2cd934[_0x4780('0x3c')][_0x4780('0x44')]);_0x49cfc6[_0x4780('0x45')]=qs['filters'](_[_0x4780('0x46')](_0x2cd934[_0x4780('0x3c')],_0x34ea23['filters']),_0x2172de);var _0x5cc1bf=[];var _0x2aeaa7=squel[_0x4780('0x47')]()[_0x4780('0x48')]('id')[_0x4780('0x48')]('name')[_0x4780('0x48')](_0x4780('0x49'))[_0x4780('0x4a')](_0x4780('0x4b'));var _0x558705=squel[_0x4780('0x47')]()[_0x4780('0x48')]('u.id')[_0x4780('0x48')](_0x4780('0x4c'))[_0x4780('0x48')](_0x4780('0x4d'))[_0x4780('0x4a')](_0x4780('0x4e'),'ui')['left_join'](_0x4780('0x4f'),'u',_0x4780('0x50'));var _0x4c9031=squel[_0x4780('0x47')]()[_0x4780('0x4a')](_0x4780('0x51'),'i')[_0x4780('0x52')](_0x4780('0x53'),'c',_0x4780('0x54'))[_0x4780('0x52')]('users','o','o.id\x20=\x20i.UserId')[_0x4780('0x52')](_0x4780('0x55'),'a','a.id\x20=\x20i.WhatsappAccountId')['left_join']('whatsapp_messages','me',_0x4780('0x56'))[_0x4780('0x52')](_0x4780('0x57'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x4780('0x52')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x1860f9=squel[_0x4780('0x58')]();var _0x22b3cb=[];var _0x3d7064=squel[_0x4780('0x58')]();var _0x453705;if(_0x2cd934['query']['search']){_0x453705=as[_0x4780('0x59')](_0x2cd934['query'][_0x4780('0x5a')]);var _0x436959=_0x453705[_0x4780('0x5b')];for(var _0x1cbd42=0x0;_0x1cbd42<_0x453705[_0x4780('0x5c')][_0x4780('0x42')];_0x1cbd42++){var _0x267a73=_0x453705[_0x4780('0x5c')][_0x1cbd42];var _0xbac1e8='i';var _0x4fb0c=_[_0x4780('0x5d')](_0x2172de,['name',_0x267a73[_0x4780('0x48')]]);if(!_0x4fb0c){switch(_0x267a73[_0x4780('0x48')]){case _0x4780('0x5e'):if(_0x267a73[_0x4780('0x5f')]==0x1){_0x4c9031[_0x4780('0x60')]('`'+_0x267a73[_0x4780('0x48')]+'`\x20=\x200');}else{_0x4c9031[_0x4780('0x60')]('`'+_0x267a73[_0x4780('0x48')]+_0x4780('0x61'));}break;case'Contact':if(_0x267a73[_0x4780('0x62')]===_0x4780('0x63')){if(_0x267a73[_0x4780('0x5f')]['split']('\x20')[_0x4780('0x42')]>0x1){_0x1860f9[_0x436959](_0x4780('0x64'),qs[_0x4780('0x65')](_0x267a73[_0x4780('0x5f')]),null);}else{var _0x582310='%'+_0x267a73[_0x4780('0x5f')]+'%';_0x1860f9[_0x436959]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x582310,_0x582310,_0x582310);}}else{_0x4fb0c=_['find'](_0x2172de,[_0x4780('0x29'),'ContactId']);_0x267a73['field']=_0x4780('0x66');_0x4c223f=as[_0x4780('0x67')](_0xbac1e8,_0x4fb0c['type'],_0x267a73);_0x1860f9[_0x436959](_0x4c223f[_0x4780('0x68')],_0x4c223f[_0x4780('0x5f')][_0x4780('0x69')],_0x4c223f[_0x4780('0x5f')][_0x4780('0x25')]);}break;case _0x4780('0x6a'):var _0x28606e=_0x267a73[_0x4780('0x5f')][_0x4780('0x2e')](',')[_0x4780('0x2b')](function(_0x45ba1c){return Number(_0x45ba1c);});_0x28606e[_0x4780('0x6b')](function(_0x282f0c){_0x3d7064['or'](_0x4780('0x6c'),'%,'+_0x282f0c+',%');});_0x22b3cb=_[_0x4780('0x6d')](_0x22b3cb,_0x28606e);break;case'User':if(_0x267a73[_0x4780('0x62')]===_0x4780('0x63')){_0x1860f9[_0x436959](_0x4780('0x6e'),'%'+_0x267a73['value']+'%',null);}else{_0x4fb0c=_['find'](_0x2172de,[_0x4780('0x29'),_0x4780('0x36')]);_0x267a73[_0x4780('0x48')]=_0x4780('0x36');_0x4c223f=as['buildExpression'](_0xbac1e8,_0x4fb0c['type'],_0x267a73);_0x1860f9[_0x436959](_0x4c223f[_0x4780('0x68')],_0x4c223f[_0x4780('0x5f')]['start'],_0x4c223f['value'][_0x4780('0x25')]);}break;case'body':_0x4c223f=as['buildExpression']('me',null,_0x267a73);_0x1860f9[_0x436959](_0x4c223f[_0x4780('0x68')],_0x4c223f[_0x4780('0x5f')]['start'],_0x4c223f[_0x4780('0x5f')][_0x4780('0x25')]);break;}}else{var _0x4c223f=as[_0x4780('0x67')](_0xbac1e8,_0x4fb0c[_0x4780('0x3a')],_0x267a73);_0x1860f9[_0x436959](_0x4c223f[_0x4780('0x68')],_0x4c223f['value'][_0x4780('0x69')],_0x4c223f[_0x4780('0x5f')][_0x4780('0x25')]);}}}else{var _0x4e800c=_(_0x2cd934[_0x4780('0x3c')])[_0x4780('0x3b')]()['map'](function(_0x5cec7b){return _['some'](_0x2172de,[_0x4780('0x29'),_0x5cec7b])?_0x5cec7b:undefined;})[_0x4780('0x6f')]()[_0x4780('0x5f')]();if(!_['isEmpty'](_0x4e800c)){_0x4e800c['forEach'](function(_0x54ac0c){if(_0x54ac0c==='WhatsappAccountId'){_0x4c9031[_0x4780('0x45')](_0x4780('0x70'),[][_0x4780('0x71')](_0x2cd934['query'][_0x54ac0c]));}else if(_0x54ac0c==='createdAt'){var _0x3ec4de=JSON['parse'](_0x2cd934['query'][_0x54ac0c])[_0x4780('0x72')];var _0x1b2ce7=JSON[_0x4780('0x73')](_0x2cd934[_0x4780('0x3c')][_0x54ac0c])[_0x4780('0x74')];_0x4c9031[_0x4780('0x45')](_0x4780('0x75'),_0x3ec4de,_0x1b2ce7);}else{if(_0x2cd934[_0x4780('0x3c')][_0x54ac0c]===_0x4780('0x76')){_0x4c9031[_0x4780('0x45')]('i.'+_0x54ac0c+_0x4780('0x77'));}else{_0x4c9031[_0x4780('0x45')]('i.'+_0x54ac0c+_0x4780('0x78'),_0x2cd934[_0x4780('0x3c')][_0x54ac0c]);}}});}if(_0x2cd934['query'][_0x4780('0x79')]){if(_0x2cd934['query'][_0x4780('0x79')]==0x1){_0x4c9031[_0x4780('0x60')]('`unreadMessages`\x20=\x200');}else{_0x4c9031[_0x4780('0x60')]('`unreadMessages`\x20>\x200');}}if(_0x2cd934[_0x4780('0x3c')][_0x4780('0x7a')]){_0x22b3cb=_[_0x4780('0x7b')](_0x2cd934[_0x4780('0x3c')][_0x4780('0x7a')])?_0x2cd934[_0x4780('0x3c')][_0x4780('0x7a')]:new Array(_0x2cd934[_0x4780('0x3c')][_0x4780('0x7a')]);_0x22b3cb['forEach'](function(_0x295e0f){_0x3d7064['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x295e0f+',%');});}if(_0x2cd934[_0x4780('0x3c')][_0x4780('0x7c')]){var _0x48bb84=_0x2cd934[_0x4780('0x3c')]['filter'][_0x4780('0x7d')]('\x5c','\x5c\x5c')[_0x4780('0x7d')](/'/g,'\x27\x27');if(qs[_0x4780('0x7e')](_0x48bb84)){_0x1860f9['or'](_0x4780('0x7f'),_0x48bb84+'%')['or'](_0x4780('0x80'),_0x48bb84+'%');}else{_0x1860f9['or'](_0x4780('0x81'),qs[_0x4780('0x65')](_0x48bb84))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x48bb84+'%');}}}_0x4c9031[_0x4780('0x45')](_0x1860f9);_0x4c9031[_0x4780('0x82')](_0x4780('0x83'));var _0x48503e={'type':db[_0x4780('0x84')]['QueryTypes'][_0x4780('0x85')],'raw':!![]};var _0x1c568f=_0x4c9031[_0x4780('0x86')]();_0x1c568f[_0x4780('0x48')]('i.id');_0x1c568f[_0x4780('0x48')](_0x4780('0x87'),_0x4780('0x5e'));if(_0x49cfc6[_0x4780('0x43')]){_0x49cfc6[_0x4780('0x43')]['forEach'](function(_0x4fa4e0){var _0x4f9dd0=_0x4fa4e0[0x0]===_0x4780('0x88')?_0x4fa4e0[0x0]:'i.'+_0x4fa4e0[0x0];_0x4c9031['order'](_0x4f9dd0,_0x4fa4e0[0x1]===_0x4780('0x89')?![]:!![]);});}if(!_[_0x4780('0x8a')](_0x22b3cb)){_0x4c9031[_0x4780('0x60')](_0x3d7064);_0x1c568f[_0x4780('0x45')](_0x4780('0x8b'),_0x22b3cb);}BPromise[_0x4780('0x8c')]()[_0x4780('0x23')](function(){if(!_0x453705){if(_0x2cd934[_0x4780('0x3c')][_0x4780('0x8d')])return;_0x1c568f[_0x4780('0x45')](_0x4780('0x8e'));_0x4c9031['where'](_0x4780('0x8e'));return;}if(_0x2cd934['user'][_0x4780('0x8f')]!==_0x4780('0x90'))return;return _0x2cd934[_0x4780('0x91')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x4780('0x23')](function(_0x1b0198){if(_['isEmpty'](_0x1b0198)){_0x1c568f[_0x4780('0x45')](_0x4780('0x92'));_0x4c9031[_0x4780('0x45')](_0x4780('0x92'));}else{_0x1c568f[_0x4780('0x45')](_0x4780('0x70'),_[_0x4780('0x2b')](_0x1b0198,'id'));_0x4c9031[_0x4780('0x45')]('i.WhatsappAccountId\x20IN\x20?',_[_0x4780('0x2b')](_0x1b0198,'id'));}});})[_0x4780('0x23')](function(){if(_0x2cd934['user'][_0x4780('0x8f')]===_0x4780('0x90')&&!_0x453705&&!_0x2cd934[_0x4780('0x3c')][_0x4780('0x8d')])return[];return db[_0x4780('0x93')]['query'](_0x1c568f[_0x4780('0x94')](),_0x48503e);})[_0x4780('0x23')](function(_0x54de38){_0x5e7416[_0x4780('0x1b')]=_0x54de38['length'];if(_0x5e7416[_0x4780('0x1b')]===0x0)return[];return db[_0x4780('0x93')][_0x4780('0x3c')](_0x2aeaa7['toString'](),_0x48503e)[_0x4780('0x23')](function(_0x395051){_0x5cc1bf=_[_0x4780('0x95')](_0x395051,'id');_0x48503e=_['merge'](_0x48503e,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2cd934[_0x4780('0x3c')][_0x4780('0x41')]){_0x49cfc6[_0x4780('0x40')][_0x4780('0x6b')](function(_0x4bb7d8){_0x4c9031[_0x4780('0x48')]('i.'+_0x4bb7d8);});}else{_0x4c9031['field'](_0x4780('0x87'),_0x4780('0x5e'));_0x4c9031['field'](_0x4780('0x96'),'Account.key');_0x4c9031['field'](_0x4780('0x97'),'Account.mandatoryDisposition');_0x4c9031[_0x4780('0x48')](_0x4780('0x98'),_0x4780('0x88'));_0x4c9031['field']('i.*');_0x4c9031['field']('c.firstName',_0x4780('0x99'));_0x4c9031['field']('c.lastName',_0x4780('0x9a'));_0x4c9031[_0x4780('0x48')](_0x4780('0x9b'),_0x4780('0x9c'));_0x4c9031[_0x4780('0x48')]('c.phone',_0x4780('0x9d'));_0x4c9031['field'](_0x4780('0x9e'),'Contact.mobile');_0x4c9031[_0x4780('0x48')](_0x4780('0x9f'),'Contact.fax');_0x4c9031[_0x4780('0x48')]('o.fullname',_0x4780('0xa0'));_0x4c9031[_0x4780('0x48')](_0x4780('0xa1'),_0x4780('0xa2'));_0x4c9031[_0x4780('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x49cfc6[_0x4780('0x1c')])_0x4c9031[_0x4780('0x1c')](_0x49cfc6[_0x4780('0x1c')]);if(_0x49cfc6['offset'])_0x4c9031[_0x4780('0x19')](_0x49cfc6[_0x4780('0x19')]);return db[_0x4780('0x93')]['query'](_0x4c9031[_0x4780('0x94')](),_0x48503e);})[_0x4780('0x23')](function(_0x456e34){if(_0x456e34[_0x4780('0x42')]>0x0)_0x558705['where'](_0x4780('0xa3'),_[_0x4780('0x2b')](_0x456e34,'id'));return db[_0x4780('0x93')]['query'](_0x558705[_0x4780('0x94')](),_0x48503e)[_0x4780('0x23')](function(_0x4c21b6){var _0x47fd84=_['groupBy'](_0x4c21b6,_0x4780('0xa4'));var _0x22aa8d=[];_0x456e34[_0x4780('0x6b')](function(_0x55c9e0){_0x22aa8d['push'](updateWhatsappInteraction(_0x55c9e0,_0x5cc1bf,_0x47fd84));});return BPromise[_0x4780('0xa5')](_0x22aa8d);});});})['then'](function(_0x104c3a){_0x5e7416[_0x4780('0xa6')]=_0x104c3a;return _0x5e7416;})[_0x4780('0x23')](respondWithFilteredResult(_0x11340d,_0x49cfc6))[_0x4780('0xa7')](handleError(_0x11340d,null));};exports['show']=function(_0x178072,_0x480771){var _0x150370={'raw':![],'where':{'id':_0x178072['params']['id']}},_0x559137={};_0x559137[_0x4780('0x3f')]=_[_0x4780('0x3b')](db[_0x4780('0x37')][_0x4780('0x38')]);_0x559137[_0x4780('0x3c')]=_[_0x4780('0x3b')](_0x178072[_0x4780('0x3c')]);_0x559137[_0x4780('0x3d')]=_[_0x4780('0x3e')](_0x559137[_0x4780('0x3f')],_0x559137[_0x4780('0x3c')]);_0x150370[_0x4780('0x40')]=_['intersection'](_0x559137['model'],qs[_0x4780('0x41')](_0x178072[_0x4780('0x3c')][_0x4780('0x41')]));_0x150370[_0x4780('0x40')]=_0x150370[_0x4780('0x40')][_0x4780('0x42')]?_0x150370[_0x4780('0x40')]:_0x559137[_0x4780('0x3f')];if(_0x178072[_0x4780('0x3c')]['includeAll']){_0x150370[_0x4780('0xa8')]=[{'all':!![]}];}_0x150370=_[_0x4780('0xa9')]({},_0x150370,_0x178072[_0x4780('0xaa')]);return db[_0x4780('0x37')][_0x4780('0x5d')](_0x150370)[_0x4780('0x23')](handleEntityNotFound(_0x480771,null))['then'](respondWithResult(_0x480771,null))['catch'](handleError(_0x480771,null));};exports[_0x4780('0xab')]=function(_0x16831c,_0x308be0){return db[_0x4780('0x37')]['create'](_0x16831c[_0x4780('0xac')],{})[_0x4780('0x23')](respondWithResult(_0x308be0,0xc9))['catch'](handleError(_0x308be0,null));};exports['update']=function(_0x4ffc66,_0x4930f7){if(_0x4ffc66['body']['id']){delete _0x4ffc66['body']['id'];}return db[_0x4780('0x37')][_0x4780('0x5d')]({'where':{'id':_0x4ffc66[_0x4780('0xad')]['id']}})[_0x4780('0x23')](handleEntityNotFound(_0x4930f7,null))['then'](saveUpdates(_0x4ffc66[_0x4780('0xac')],null))[_0x4780('0x23')](respondWithResult(_0x4930f7,null))[_0x4780('0xa7')](handleError(_0x4930f7,null));};exports[_0x4780('0x24')]=function(_0x4e2328,_0x18413a){return db[_0x4780('0x37')]['find']({'where':{'id':_0x4e2328[_0x4780('0xad')]['id']}})[_0x4780('0x23')](handleEntityNotFound(_0x18413a,null))['then'](removeEntity(_0x18413a,null))[_0x4780('0xa7')](handleError(_0x18413a,null));};exports['describe']=function(_0x556515,_0x11b051){return db[_0x4780('0x37')][_0x4780('0xae')]()[_0x4780('0x23')](respondWithResult(_0x11b051,null))[_0x4780('0xa7')](handleError(_0x11b051,null));};exports[_0x4780('0xaf')]=function(_0x23d383,_0x493ee6,_0x5236b6){return db[_0x4780('0xb0')][_0x4780('0x5d')]({'where':{'id':_0x23d383[_0x4780('0xad')]['id']}})['then'](handleEntityNotFound(_0x493ee6,null))[_0x4780('0x23')](function(_0x2cf4be){if(_0x2cf4be){return _0x2cf4be[_0x4780('0xaf')](_0x23d383['body'][_0x4780('0xb1')],_[_0x4780('0xb2')](_0x23d383[_0x4780('0xac')],[_0x4780('0xb1'),'id'])||{});}})[_0x4780('0x23')](respondWithResult(_0x493ee6,null))[_0x4780('0xa7')](handleError(_0x493ee6,null));};exports[_0x4780('0xb3')]=function(_0x575b46,_0x2cf440,_0x1883b3){var _0x1f9aaa={'raw':![],'where':{}};var _0x52046b={};var _0x59742a={'count':0x0,'rows':[]};return db[_0x4780('0x37')][_0x4780('0xb4')]({'where':{'id':_0x575b46['params']['id']}})[_0x4780('0x23')](handleEntityNotFound(_0x2cf440,null))[_0x4780('0x23')](function(_0x54b75f){if(_0x54b75f){_0x52046b[_0x4780('0x3f')]=_[_0x4780('0x3b')](db[_0x4780('0xb0')][_0x4780('0x38')]);_0x52046b[_0x4780('0x3c')]=_[_0x4780('0x3b')](_0x575b46['query']);_0x52046b['filters']=_[_0x4780('0x3e')](_0x52046b[_0x4780('0x3f')],_0x52046b['query']);_0x1f9aaa['attributes']=_[_0x4780('0x3e')](_0x52046b[_0x4780('0x3f')],qs[_0x4780('0x41')](_0x575b46[_0x4780('0x3c')][_0x4780('0x41')]));_0x1f9aaa[_0x4780('0x40')]=_0x1f9aaa['attributes'][_0x4780('0x42')]?_0x1f9aaa['attributes']:_0x52046b[_0x4780('0x3f')];if(!_0x575b46['query'][_0x4780('0xb5')]('nolimit')){_0x1f9aaa[_0x4780('0x1c')]=qs[_0x4780('0x1c')](_0x575b46['query'][_0x4780('0x1c')]);_0x1f9aaa[_0x4780('0x19')]=qs[_0x4780('0x19')](_0x575b46[_0x4780('0x3c')][_0x4780('0x19')]);}_0x1f9aaa[_0x4780('0x43')]=qs['sort'](_0x575b46[_0x4780('0x3c')][_0x4780('0x44')]);_0x1f9aaa['where']=qs[_0x4780('0x3d')](_[_0x4780('0x46')](_0x575b46[_0x4780('0x3c')],_0x52046b[_0x4780('0x3d')]));_0x1f9aaa['where'][_0x4780('0xa4')]=_0x54b75f['id'];if(_0x575b46[_0x4780('0x3c')][_0x4780('0x7c')]){_0x1f9aaa[_0x4780('0x45')]=_['merge'](_0x1f9aaa['where'],{'$or':_['map'](_0x1f9aaa['attributes'],function(_0x58de8a){var _0x2091af={};_0x2091af[_0x58de8a]={'$like':'%'+_0x575b46[_0x4780('0x3c')][_0x4780('0x7c')]+'%'};return _0x2091af;})});}if(_0x575b46[_0x4780('0x3c')][_0x4780('0x72')]){var _0x6f867a=_0x575b46['query'][_0x4780('0x72')][_0x4780('0x2e')](',');var _0x440672={};_0x440672[_0x6f867a[0x0]]={'$gte':moment(_0x6f867a[0x1])[_0x4780('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1f9aaa['where']=_['merge'](_0x1f9aaa[_0x4780('0x45')],_0x440672);}_0x1f9aaa=_[_0x4780('0xa9')]({},_0x1f9aaa,_0x575b46[_0x4780('0xaa')]);return db[_0x4780('0xb0')][_0x4780('0x1b')]({'where':_0x1f9aaa['where']})[_0x4780('0x23')](function(_0x39fdec){_0x59742a[_0x4780('0x1b')]=_0x39fdec;if(_0x575b46[_0x4780('0x3c')][_0x4780('0xb7')]){_0x1f9aaa['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x4780('0xb8')](_0x1f9aaa);})[_0x4780('0x23')](function(_0x529210){_0x59742a[_0x4780('0xa6')]=_0x529210;return _0x59742a;});}})[_0x4780('0x23')](respondWithFilteredResult(_0x2cf440,_0x1f9aaa))[_0x4780('0xa7')](handleError(_0x2cf440,null));};exports['addTags']=function(_0x1e84e3,_0x126979,_0x28e385){return db[_0x4780('0x37')][_0x4780('0x5d')]({'where':{'id':_0x1e84e3[_0x4780('0xad')]['id']}})[_0x4780('0x23')](handleEntityNotFound(_0x126979,null))[_0x4780('0x23')](function(_0x378162){if(_0x378162){return _0x378162['setTags'](_0x1e84e3[_0x4780('0xac')][_0x4780('0xb1')],_[_0x4780('0xb2')](_0x1e84e3[_0x4780('0xac')],['ids','id'])||{})[_0x4780('0xb9')](function(){return db[_0x4780('0x6a')]['findAll']({'attributes':['id',_0x4780('0x29'),_0x4780('0x49')],'where':{'id':_0x1e84e3[_0x4780('0xac')][_0x4780('0xb1')]}});})[_0x4780('0x23')](function(_0x58f4fa){socket[_0x4780('0xba')](_0x4780('0xbb'),{'id':Number(_0x1e84e3['params']['id']),'tags':_0x58f4fa||[]});return{'id':Number(_0x1e84e3['params']['id']),'tags':_0x58f4fa||[]};});}})[_0x4780('0x23')](respondWithResult(_0x126979,null))[_0x4780('0xa7')](handleError(_0x126979,null));};exports['removeTags']=function(_0x6d022d,_0x165638,_0x424c50){return db[_0x4780('0x37')][_0x4780('0x5d')]({'where':{'id':_0x6d022d[_0x4780('0xad')]['id']}})[_0x4780('0x23')](handleEntityNotFound(_0x165638,null))[_0x4780('0x23')](function(_0x324241){if(_0x324241){return _0x324241[_0x4780('0xbc')](_0x6d022d[_0x4780('0x3c')]['ids']);}})[_0x4780('0x23')](respondWithStatusCode(_0x165638,null))['catch'](handleError(_0x165638,null));};exports[_0x4780('0xbd')]=function(_0x6d808f,_0x3bb6ed){var _0x532bdc=moment()[_0x4780('0xbe')]()[_0x4780('0x94')]();var _0xd28106=path[_0x4780('0xbf')](config[_0x4780('0xc0')],_0x4780('0xc1'),_0x4780('0xc2'),_0x4780('0xc3'));var _0x3d5dff=path[_0x4780('0xbf')](config[_0x4780('0xc0')],'server',_0x4780('0xc2'),_0x4780('0xc4'));var _0x5ae085=path[_0x4780('0xbf')](_0xd28106,_0x532bdc);var _0x2abcba=util['format'](_0x4780('0xc5'),_0x6d808f[_0x4780('0xad')]['id'],_0x532bdc);var _0x3fb57c=path['join'](_0xd28106,_0x2abcba);var _0x3d4b3d=[];_0x3d4b3d[_0x4780('0x2f')]({'model':db[_0x4780('0xc6')],'as':_0x4780('0xc6'),'attributes':['id',_0x4780('0x2c')],'raw':!![]});_0x3d4b3d[_0x4780('0x2f')]({'model':db[_0x4780('0xc7')],'as':'Contact','attributes':['id','firstName',_0x4780('0xc8')],'raw':!![]});if(_0x6d808f[_0x4780('0x3c')][_0x4780('0xc4')]){_0x3d4b3d[_0x4780('0x2f')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x535a7e=[{'model':db[_0x4780('0xb0')],'as':_0x4780('0xc9'),'attributes':['id',_0x4780('0xac'),_0x4780('0xca'),'direction',_0x4780('0xcb'),_0x4780('0x79')],'include':_0x3d4b3d}];_0x535a7e[_0x4780('0x2f')]({'model':db[_0x4780('0xcc')],'as':_0x4780('0xcd'),'attributes':['id',_0x4780('0x29')]});_0x535a7e[_0x4780('0x2f')]({'model':db[_0x4780('0xc6')],'as':'Owner','attributes':['id',_0x4780('0x2c')]});return db[_0x4780('0x37')][_0x4780('0x5d')]({'where':{'id':_0x6d808f[_0x4780('0xad')]['id']},'include':_0x535a7e})['then'](handleEntityNotFound(_0x3bb6ed,null))[_0x4780('0x23')](function(_0xd7268c){if(_0xd7268c){var _0x44ebfe=_0xd7268c[_0x4780('0xce')]({'plain':!![]});fs[_0x4780('0xcf')](_0x5ae085);var _0x3dd3d6={'channel':_0x4780('0xd0'),'account':_0x44ebfe[_0x4780('0xcd')][_0x4780('0x29')],'agent':_0x44ebfe['Owner']?_0x44ebfe[_0x4780('0xd1')][_0x4780('0x2c')]:_0x4780('0xd2'),'createdAt':moment(_0x44ebfe[_0x4780('0xca')])[_0x4780('0xb6')](_0x4780('0xd3'))[_0x4780('0x94')](),'closedAt':_0x44ebfe[_0x4780('0x35')]?moment(_0x44ebfe[_0x4780('0xd4')])[_0x4780('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4780('0x94')]():'','disposition':_0x44ebfe[_0x4780('0xd5')],'messages':_(_0x44ebfe[_0x4780('0xc9')])[_0x4780('0x7c')]({'secret':![]})[_0x4780('0x2b')](function(_0x4bfcec){if(_0x4bfcec[_0x4780('0xd6')]){var _0x3ba1aa=path['join'](_0x3d5dff,_0x4bfcec['Attachment'][_0x4780('0xd7')]);if(fs[_0x4780('0xd8')](_0x3ba1aa)){fs[_0x4780('0xd9')](_0x3ba1aa)['pipe'](fs['createWriteStream'](path[_0x4780('0xbf')](_0x5ae085,_0x4bfcec[_0x4780('0xd6')][_0x4780('0xd7')])));}}return{'date':moment(_0x4bfcec[_0x4780('0xca')])[_0x4780('0xb6')](_0x4780('0xd3'))[_0x4780('0x94')](),'sender':_0x4bfcec[_0x4780('0xda')]===_0x4780('0xdb')?_0x4bfcec['User']?_0x4bfcec[_0x4780('0xc6')][_0x4780('0x2c')]:_0x4780('0xdc'):_0x4bfcec[_0x4780('0xdd')][_0x4780('0xde')]+(_0x4bfcec['Contact'][_0x4780('0xc8')]?'\x20'+_0x4bfcec[_0x4780('0xdd')]['lastName']:''),'body':_0x4bfcec['Attachment']?_0x4bfcec[_0x4780('0xd6')][_0x4780('0xd7')]:_0x4bfcec[_0x4780('0xac')],'direction':_0x4bfcec[_0x4780('0xda')]===_0x4780('0xdb')?'A':'C','secret':_0x4bfcec[_0x4780('0xcb')],'read':_0x4bfcec[_0x4780('0x79')],'attachment':_0x4bfcec[_0x4780('0xd6')]};})[_0x4780('0x5f')]()};return ejs[_0x4780('0xdf')](path[_0x4780('0xbf')](config[_0x4780('0xc0')],_0x4780('0xc1'),_0x4780('0xe0'),_0x4780('0xe1')),{'interaction':_0x3dd3d6})['then'](function(_0x213756){var _0x344690=path[_0x4780('0xbf')](_0x5ae085,_0x4780('0xe2')+_0x44ebfe['id']+'-'+_0x532bdc+'.pdf');var _0x15ebcc={'path':_0x344690,'channel':_0x4780('0xd0'),'interactionId':_0x44ebfe['id']};return pdf[_0x4780('0xe3')](_0x213756,_0x15ebcc);})['then'](function(){return new BPromise(function(_0x1403d5,_0x146334){zipdir(_0x5ae085,{'saveTo':_0x3fb57c},function(_0x342386,_0x4c9212){if(_0x342386)return _0x146334(_0x342386);return _0x1403d5(_0x4c9212);});})[_0x4780('0x23')](function(){return new BPromise(function(_0x51ad2a,_0x24cb34){rimraf(_0x5ae085,function(_0x2b5b26){if(_0x2b5b26)_0x24cb34(_0x2b5b26);return _0x51ad2a();});});})[_0x4780('0x23')](function(){return _0x3bb6ed[_0x4780('0xbd')](_0x3fb57c,_0x2abcba,function(_0x54aba9){if(_0x54aba9){console[_0x4780('0xe4')]('err',_0x54aba9);}else{fs['unlinkSync'](_0x3fb57c);}});});});}else{return _0x3bb6ed[_0x4780('0x26')](0xc8);}})[_0x4780('0xa7')](handleError(_0x3bb6ed,null));}; \ No newline at end of file +var _0x6691=['all','rows','show','params','includeAll','options','create','update','addMessage','ids','omit','findOne','WhatsappMessage','sort','WhatsappInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','out','System','Contact','renderFile','views','downloadInteraction.ejs','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','end','error','stack','name','Users','fullname','TagIds','forEach','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','WhatsappInteraction','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','field','from','tools_tags','select','u.id','u.fullname','user_has_whatsapp_interactions','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','`\x20=\x200','having','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','buildExpression','type','text','body','some','compact','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','i.WhatsappAccountId\x20IS\x20NULL','agent','toString','sequelize','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy'];(function(_0x2825c3,_0x243920){var _0x535437=function(_0x4c10d1){while(--_0x4c10d1){_0x2825c3['push'](_0x2825c3['shift']());}};_0x535437(++_0x243920);}(_0x6691,0x12d));var _0x1669=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x6691[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0x1669('0x0'));var rimraf=require(_0x1669('0x1'));var zipdir=require(_0x1669('0x2'));var jsonpatch=require(_0x1669('0x3'));var rp=require(_0x1669('0x4'));var moment=require(_0x1669('0x5'));var BPromise=require(_0x1669('0x6'));var Mustache=require(_0x1669('0x7'));var util=require(_0x1669('0x8'));var path=require(_0x1669('0x9'));var sox=require('sox');var csv=require(_0x1669('0xa'));var ejs=require(_0x1669('0xb'));var fs=require('fs');var fs_extra=require(_0x1669('0xc'));var _=require(_0x1669('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1669('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1669('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1669('0x10'));var as=require(_0x1669('0x11'));var pdf=require(_0x1669('0x12'));var hardwareService=require(_0x1669('0x13'));var logger=require(_0x1669('0x14'))(_0x1669('0x15'));var utils=require(_0x1669('0x16'));var config=require(_0x1669('0x17'));var licenseUtil=require(_0x1669('0x18'));var db=require(_0x1669('0x19'))['db'];config[_0x1669('0x1a')]=_[_0x1669('0x1b')](config[_0x1669('0x1a')],{'host':_0x1669('0x1c'),'port':0x18eb});var socket=require(_0x1669('0x1d'))(new Redis(config[_0x1669('0x1a')]));require(_0x1669('0x1e'))[_0x1669('0x1f')](socket);function respondWithStatusCode(_0x455b15,_0x318db1){_0x318db1=_0x318db1||0xcc;return function(_0x14eb3e){if(_0x14eb3e){return _0x455b15[_0x1669('0x20')](_0x318db1);}return _0x455b15[_0x1669('0x21')](_0x318db1)['end']();};}function respondWithResult(_0x21a5d2,_0x1ed6f6){_0x1ed6f6=_0x1ed6f6||0xc8;return function(_0x4281dc){if(_0x4281dc){return _0x21a5d2[_0x1669('0x21')](_0x1ed6f6)[_0x1669('0x22')](_0x4281dc);}};}function respondWithFilteredResult(_0x5d7585,_0x56e3d9){return function(_0x201c59){if(_0x201c59){var _0x31600f=typeof _0x56e3d9[_0x1669('0x23')]===_0x1669('0x24')&&typeof _0x56e3d9[_0x1669('0x25')]===_0x1669('0x24');var _0x3bec8e=_0x201c59['count'];var _0x31483f=_0x31600f?0x0:_0x56e3d9[_0x1669('0x23')];var _0x51297e=_0x31600f?_0x201c59[_0x1669('0x26')]:_0x56e3d9[_0x1669('0x23')]+_0x56e3d9['limit'];var _0x2a5ef1;if(_0x51297e>=_0x3bec8e){_0x51297e=_0x3bec8e;_0x2a5ef1=0xc8;}else{_0x2a5ef1=0xce;}_0x5d7585[_0x1669('0x21')](_0x2a5ef1);return _0x5d7585[_0x1669('0x27')](_0x1669('0x28'),_0x31483f+'-'+_0x51297e+'/'+_0x3bec8e)[_0x1669('0x22')](_0x201c59);}return null;};}function patchUpdates(_0x5c66cb){return function(_0x41bc1e){try{jsonpatch[_0x1669('0x29')](_0x41bc1e,_0x5c66cb,!![]);}catch(_0x344eaf){return BPromise['reject'](_0x344eaf);}return _0x41bc1e[_0x1669('0x2a')]();};}function saveUpdates(_0x553b09,_0x50b7b2){return function(_0x238ce2){if(_0x238ce2){return _0x238ce2['update'](_0x553b09)[_0x1669('0x2b')](function(_0x3ce429){return _0x3ce429;});}return null;};}function removeEntity(_0x1ab80f,_0x51eacb){return function(_0x50abe4){if(_0x50abe4){return _0x50abe4[_0x1669('0x2c')]()[_0x1669('0x2b')](function(){_0x1ab80f['status'](0xcc)[_0x1669('0x2d')]();});}};}function handleEntityNotFound(_0x597c69,_0x207c9f){return function(_0x334bb7){if(!_0x334bb7){_0x597c69['sendStatus'](0x194);}return _0x334bb7;};}function handleError(_0xfca7c6,_0x590053){_0x590053=_0x590053||0x1f4;return function(_0x29aff9){logger[_0x1669('0x2e')](_0x29aff9[_0x1669('0x2f')]);if(_0x29aff9[_0x1669('0x30')]){delete _0x29aff9['name'];}_0xfca7c6['status'](_0x590053)['send'](_0x29aff9);};}function getInteractionUsers(_0x104c63,_0x6429dc){return new BPromise(function(_0x1cbaa7,_0x1eaa0c){try{if(_0x6429dc[_0x104c63['id']]){_0x104c63[_0x1669('0x31')]=_['map'](_0x6429dc[_0x104c63['id']],function(_0x322235){return{'id':_0x322235['id'],'fullname':_0x322235[_0x1669('0x32')]};});}}catch(_0x3734e6){_0x1eaa0c(_0x3734e6);}_0x1cbaa7(_0x104c63);});}function getInteractionTags(_0x2689b5,_0x345960){return new BPromise(function(_0x24fa95,_0x1a5763){try{if(_0x2689b5[_0x1669('0x33')]){_0x2689b5['Tags']=[];_0x2689b5[_0x1669('0x33')]['split'](',')[_0x1669('0x34')](function(_0x4b51c4){_0x2689b5['Tags'][_0x1669('0x35')](_0x345960[_0x4b51c4]);});}delete _0x2689b5[_0x1669('0x33')];}catch(_0x196b20){_0x1a5763(_0x196b20);}_0x24fa95(_0x2689b5);});}function updateWhatsappInteraction(_0x43c46a,_0xafbce1,_0x257ef0){return new BPromise(function(_0x25db25,_0x222900){return getInteractionUsers(_0x43c46a,_0x257ef0)[_0x1669('0x2b')](function(_0x5326c5){return getInteractionTags(_0x5326c5,_0xafbce1);})[_0x1669('0x2b')](function(_0x40fc23){return getStateInteraction(_0x40fc23);})[_0x1669('0x2b')](function(_0x475aea){_0x25db25(_0x475aea);})[_0x1669('0x36')](function(_0x998010){_0x222900(_0x998010);});});}function getStateInteraction(_0x20e81d){return new BPromise(function(_0x4eaf00){_0x20e81d[_0x1669('0x37')]=0x0;_0x20e81d[_0x1669('0x38')]=0x0;_0x20e81d[_0x1669('0x39')]=0x0;_0x20e81d[_0x1669('0x3a')]=0x0;_0x20e81d[_0x1669('0x3b')]=0x0;if(!_0x20e81d[_0x1669('0x3c')]&&!_0x20e81d['UserId']){_0x20e81d['waiting']+=0x1;}if(!_0x20e81d['closed']&&_0x20e81d[_0x1669('0x3d')]){_0x20e81d[_0x1669('0x38')]+=0x1;if(_0x20e81d[_0x1669('0x37')]){_0x20e81d[_0x1669('0x37')]-=0x1;}}if(_0x20e81d[_0x1669('0x3c')]&&_0x20e81d[_0x1669('0x3d')]){_0x20e81d[_0x1669('0x39')]+=0x1;if(_0x20e81d['talking']){_0x20e81d[_0x1669('0x38')]-=0x1;}}if(_0x20e81d[_0x1669('0x3c')]&&!_0x20e81d['UserId']){_0x20e81d['unmanaged']+=0x1;if(_0x20e81d[_0x1669('0x37')]){_0x20e81d[_0x1669('0x37')]-=0x1;}}_0x20e81d[_0x1669('0x3b')]+=0x1;_0x4eaf00(_0x20e81d);});}exports[_0x1669('0x3e')]=function(_0x476edc,_0x52747f){var _0xf271d6={},_0x5ba428={},_0x47b396={'count':0x0,'rows':[]};var _0x110f4e=_['map'](db[_0x1669('0x3f')][_0x1669('0x40')],function(_0x374552){return{'name':_0x374552[_0x1669('0x41')],'type':_0x374552['type'][_0x1669('0x42')]};});_0x5ba428[_0x1669('0x43')]=_[_0x1669('0x44')](_0x110f4e,'name');_0x5ba428[_0x1669('0x45')]=_[_0x1669('0x46')](_0x476edc[_0x1669('0x45')]);_0x5ba428[_0x1669('0x47')]=_[_0x1669('0x48')](_0x5ba428[_0x1669('0x43')],_0x5ba428[_0x1669('0x45')]);_0xf271d6['attributes']=_[_0x1669('0x48')](_0x5ba428['model'],qs[_0x1669('0x49')](_0x476edc['query'][_0x1669('0x49')]));_0xf271d6[_0x1669('0x4a')]=_0xf271d6[_0x1669('0x4a')][_0x1669('0x4b')]?_0xf271d6[_0x1669('0x4a')]:_0x5ba428[_0x1669('0x43')];if(!_0x476edc['query'][_0x1669('0x4c')](_0x1669('0x4d'))){_0xf271d6[_0x1669('0x25')]=qs['limit'](_0x476edc['query']['limit']);_0xf271d6['offset']=qs[_0x1669('0x23')](_0x476edc[_0x1669('0x45')][_0x1669('0x23')]);}_0xf271d6['order']=qs['sort'](_0x476edc[_0x1669('0x45')]['sort']);_0xf271d6[_0x1669('0x4e')]=qs[_0x1669('0x47')](_[_0x1669('0x4f')](_0x476edc[_0x1669('0x45')],_0x5ba428[_0x1669('0x47')]),_0x110f4e);var _0x2ad0eb=[];var _0x410299=squel['select']()[_0x1669('0x50')]('id')['field'](_0x1669('0x30'))['field']('color')[_0x1669('0x51')](_0x1669('0x52'));var _0x42ec31=squel[_0x1669('0x53')]()[_0x1669('0x50')](_0x1669('0x54'))['field'](_0x1669('0x55'))[_0x1669('0x50')]('ui.WhatsappInteractionId')[_0x1669('0x51')](_0x1669('0x56'),'ui')['left_join']('users','u',_0x1669('0x57'));var _0x3b68e7=squel[_0x1669('0x53')]()[_0x1669('0x51')]('whatsapp_interactions','i')[_0x1669('0x58')](_0x1669('0x59'),'c',_0x1669('0x5a'))['left_join'](_0x1669('0x5b'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x1669('0x5c'),'a','a.id\x20=\x20i.WhatsappAccountId')['left_join'](_0x1669('0x5d'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x1669('0x58')](_0x1669('0x5e'),'it',_0x1669('0x5f'))[_0x1669('0x58')]('tools_tags','t',_0x1669('0x60'));var _0x4ef07c=squel['expr']();var _0x4846d9=[];var _0x119b99=squel[_0x1669('0x61')]();var _0x25385f;if(_0x476edc[_0x1669('0x45')][_0x1669('0x62')]){_0x25385f=as[_0x1669('0x63')](_0x476edc[_0x1669('0x45')][_0x1669('0x62')]);var _0x43636c=_0x25385f[_0x1669('0x64')];for(var _0x20828f=0x0;_0x20828f<_0x25385f[_0x1669('0x65')]['length'];_0x20828f++){var _0xa7793f=_0x25385f['conditions'][_0x20828f];var _0x5e2f02='i';var _0x46ce2c=_['find'](_0x110f4e,[_0x1669('0x30'),_0xa7793f[_0x1669('0x50')]]);if(!_0x46ce2c){switch(_0xa7793f[_0x1669('0x50')]){case _0x1669('0x66'):if(_0xa7793f['value']==0x1){_0x3b68e7['having']('`'+_0xa7793f['field']+_0x1669('0x67'));}else{_0x3b68e7[_0x1669('0x68')]('`'+_0xa7793f[_0x1669('0x50')]+'`\x20>\x200');}break;case'Contact':if(_0xa7793f[_0x1669('0x69')]===_0x1669('0x6a')){if(_0xa7793f[_0x1669('0x6b')][_0x1669('0x6c')]('\x20')['length']>0x1){_0x4ef07c[_0x43636c](_0x1669('0x6d'),qs[_0x1669('0x6e')](_0xa7793f[_0x1669('0x6b')]),null);}else{var _0x31caaa='%'+_0xa7793f[_0x1669('0x6b')]+'%';_0x4ef07c[_0x43636c]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x31caaa,_0x31caaa,_0x31caaa);}}else{_0x46ce2c=_['find'](_0x110f4e,['name',_0x1669('0x6f')]);_0xa7793f[_0x1669('0x50')]=_0x1669('0x6f');_0x8e4a05=as['buildExpression'](_0x5e2f02,_0x46ce2c['type'],_0xa7793f);_0x4ef07c[_0x43636c](_0x8e4a05['text'],_0x8e4a05['value'][_0x1669('0x70')],_0x8e4a05[_0x1669('0x6b')][_0x1669('0x2d')]);}break;case _0x1669('0x71'):var _0x53b31d=_0xa7793f[_0x1669('0x6b')][_0x1669('0x6c')](',')[_0x1669('0x44')](function(_0x408602){return Number(_0x408602);});_0x53b31d[_0x1669('0x34')](function(_0x525662){_0x119b99['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x525662+',%');});_0x4846d9=_[_0x1669('0x72')](_0x4846d9,_0x53b31d);break;case _0x1669('0x73'):if(_0xa7793f['operator']===_0x1669('0x6a')){_0x4ef07c[_0x43636c](_0x1669('0x74'),'%'+_0xa7793f[_0x1669('0x6b')]+'%',null);}else{_0x46ce2c=_[_0x1669('0x75')](_0x110f4e,['name','UserId']);_0xa7793f[_0x1669('0x50')]=_0x1669('0x3d');_0x8e4a05=as[_0x1669('0x76')](_0x5e2f02,_0x46ce2c[_0x1669('0x77')],_0xa7793f);_0x4ef07c[_0x43636c](_0x8e4a05[_0x1669('0x78')],_0x8e4a05[_0x1669('0x6b')][_0x1669('0x70')],_0x8e4a05['value'][_0x1669('0x2d')]);}break;case _0x1669('0x79'):_0x8e4a05=as['buildExpression']('me',null,_0xa7793f);_0x4ef07c[_0x43636c](_0x8e4a05[_0x1669('0x78')],_0x8e4a05[_0x1669('0x6b')]['start'],_0x8e4a05['value'][_0x1669('0x2d')]);break;}}else{var _0x8e4a05=as[_0x1669('0x76')](_0x5e2f02,_0x46ce2c[_0x1669('0x77')],_0xa7793f);_0x4ef07c[_0x43636c](_0x8e4a05[_0x1669('0x78')],_0x8e4a05[_0x1669('0x6b')][_0x1669('0x70')],_0x8e4a05[_0x1669('0x6b')][_0x1669('0x2d')]);}}}else{var _0xae224c=_(_0x476edc[_0x1669('0x45')])[_0x1669('0x46')]()[_0x1669('0x44')](function(_0x426943){return _[_0x1669('0x7a')](_0x110f4e,['name',_0x426943])?_0x426943:undefined;})[_0x1669('0x7b')]()[_0x1669('0x6b')]();if(!_['isEmpty'](_0xae224c)){_0xae224c[_0x1669('0x34')](function(_0x23aed9){if(_0x23aed9==='WhatsappAccountId'){_0x3b68e7['where'](_0x1669('0x7c'),[][_0x1669('0x7d')](_0x476edc['query'][_0x23aed9]));}else if(_0x23aed9==='createdAt'){var _0x1c545d=JSON[_0x1669('0x7e')](_0x476edc[_0x1669('0x45')][_0x23aed9])[_0x1669('0x7f')];var _0x3260f4=JSON[_0x1669('0x7e')](_0x476edc[_0x1669('0x45')][_0x23aed9])['$lte'];_0x3b68e7['where'](_0x1669('0x80'),_0x1c545d,_0x3260f4);}else{if(_0x476edc[_0x1669('0x45')][_0x23aed9]===_0x1669('0x81')){_0x3b68e7[_0x1669('0x4e')]('i.'+_0x23aed9+'\x20IS\x20NULL');}else{_0x3b68e7[_0x1669('0x4e')]('i.'+_0x23aed9+_0x1669('0x82'),_0x476edc[_0x1669('0x45')][_0x23aed9]);}}});}if(_0x476edc[_0x1669('0x45')]['read']){if(_0x476edc[_0x1669('0x45')]['read']==0x1){_0x3b68e7[_0x1669('0x68')]('`unreadMessages`\x20=\x200');}else{_0x3b68e7['having'](_0x1669('0x83'));}}if(_0x476edc[_0x1669('0x45')][_0x1669('0x84')]){_0x4846d9=_[_0x1669('0x85')](_0x476edc[_0x1669('0x45')][_0x1669('0x84')])?_0x476edc[_0x1669('0x45')]['tag']:new Array(_0x476edc[_0x1669('0x45')][_0x1669('0x84')]);_0x4846d9[_0x1669('0x34')](function(_0x448564){_0x119b99['or'](_0x1669('0x86'),'%,'+_0x448564+',%');});}if(_0x476edc[_0x1669('0x45')][_0x1669('0x87')]){var _0x355e3a=_0x476edc[_0x1669('0x45')][_0x1669('0x87')][_0x1669('0x88')]('\x5c','\x5c\x5c')[_0x1669('0x88')](/'/g,'\x27\x27');if(qs[_0x1669('0x89')](_0x355e3a)){_0x4ef07c['or'](_0x1669('0x8a'),_0x355e3a+'%')['or']('i.phone\x20LIKE\x20?',_0x355e3a+'%');}else{_0x4ef07c['or'](_0x1669('0x8b'),qs[_0x1669('0x6e')](_0x355e3a))['or'](_0x1669('0x8c'),_0x355e3a+'%');}}}_0x3b68e7[_0x1669('0x4e')](_0x4ef07c);_0x3b68e7['group'](_0x1669('0x8d'));var _0x35dddf={'type':db[_0x1669('0x8e')][_0x1669('0x8f')]['SELECT'],'raw':!![]};var _0x2eb2bd=_0x3b68e7[_0x1669('0x90')]();_0x2eb2bd[_0x1669('0x50')](_0x1669('0x8d'));_0x2eb2bd[_0x1669('0x50')](_0x1669('0x91'),_0x1669('0x66'));if(_0xf271d6[_0x1669('0x92')]){_0xf271d6[_0x1669('0x92')][_0x1669('0x34')](function(_0x977353){var _0x1f0a68=_0x977353[0x0]===_0x1669('0x93')?_0x977353[0x0]:'i.'+_0x977353[0x0];_0x3b68e7[_0x1669('0x92')](_0x1f0a68,_0x977353[0x1]===_0x1669('0x94')?![]:!![]);});}if(!_[_0x1669('0x95')](_0x4846d9)){_0x3b68e7['having'](_0x119b99);_0x2eb2bd[_0x1669('0x4e')]('t.id\x20IN\x20?',_0x4846d9);}BPromise['resolve']()['then'](function(){if(!_0x25385f){if(_0x476edc['query']['WhatsappAccountId'])return;_0x2eb2bd['where'](_0x1669('0x96'));_0x3b68e7[_0x1669('0x4e')](_0x1669('0x96'));return;}if(_0x476edc[_0x1669('0x97')][_0x1669('0x98')]!=='agent')return;return _0x476edc['user']['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x5b6f4a){if(_['isEmpty'](_0x5b6f4a)){_0x2eb2bd['where'](_0x1669('0x99'));_0x3b68e7[_0x1669('0x4e')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x2eb2bd[_0x1669('0x4e')](_0x1669('0x7c'),_[_0x1669('0x44')](_0x5b6f4a,'id'));_0x3b68e7[_0x1669('0x4e')](_0x1669('0x7c'),_[_0x1669('0x44')](_0x5b6f4a,'id'));}});})[_0x1669('0x2b')](function(){if(_0x476edc['user'][_0x1669('0x98')]===_0x1669('0x9a')&&!_0x25385f&&!_0x476edc[_0x1669('0x45')]['WhatsappAccountId'])return[];return db['sequelize'][_0x1669('0x45')](_0x2eb2bd[_0x1669('0x9b')](),_0x35dddf);})[_0x1669('0x2b')](function(_0x5d5df8){_0x47b396[_0x1669('0x26')]=_0x5d5df8[_0x1669('0x4b')];if(_0x47b396['count']===0x0)return[];return db[_0x1669('0x9c')][_0x1669('0x45')](_0x410299[_0x1669('0x9b')](),_0x35dddf)[_0x1669('0x2b')](function(_0x485e9b){_0x2ad0eb=_['keyBy'](_0x485e9b,'id');_0x35dddf=_[_0x1669('0x9d')](_0x35dddf,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x476edc[_0x1669('0x45')][_0x1669('0x49')]){_0xf271d6[_0x1669('0x4a')][_0x1669('0x34')](function(_0x4895af){_0x3b68e7[_0x1669('0x50')]('i.'+_0x4895af);});}else{_0x3b68e7[_0x1669('0x50')](_0x1669('0x91'),_0x1669('0x66'));_0x3b68e7[_0x1669('0x50')]('a.key',_0x1669('0x9e'));_0x3b68e7['field'](_0x1669('0x9f'),_0x1669('0xa0'));_0x3b68e7['field'](_0x1669('0xa1'),_0x1669('0x93'));_0x3b68e7[_0x1669('0x50')](_0x1669('0xa2'));_0x3b68e7[_0x1669('0x50')]('c.firstName',_0x1669('0xa3'));_0x3b68e7[_0x1669('0x50')]('c.lastName','Contact.lastName');_0x3b68e7[_0x1669('0x50')]('c.email','Contact.email');_0x3b68e7[_0x1669('0x50')]('c.phone','Contact.phone');_0x3b68e7[_0x1669('0x50')](_0x1669('0xa4'),_0x1669('0xa5'));_0x3b68e7['field']('c.fax',_0x1669('0xa6'));_0x3b68e7['field'](_0x1669('0xa7'),'Owner.fullname');_0x3b68e7['field'](_0x1669('0xa8'),'Owner.internal');_0x3b68e7['field'](_0x1669('0xa9'),_0x1669('0x33'));}if(_0xf271d6[_0x1669('0x25')])_0x3b68e7[_0x1669('0x25')](_0xf271d6[_0x1669('0x25')]);if(_0xf271d6[_0x1669('0x23')])_0x3b68e7[_0x1669('0x23')](_0xf271d6[_0x1669('0x23')]);return db['sequelize'][_0x1669('0x45')](_0x3b68e7[_0x1669('0x9b')](),_0x35dddf);})[_0x1669('0x2b')](function(_0x50f9ae){if(_0x50f9ae[_0x1669('0x4b')]>0x0)_0x42ec31[_0x1669('0x4e')]('ui.WhatsappInteractionId\x20IN\x20?',_['map'](_0x50f9ae,'id'));return db[_0x1669('0x9c')][_0x1669('0x45')](_0x42ec31[_0x1669('0x9b')](),_0x35dddf)[_0x1669('0x2b')](function(_0x31a515){var _0x127d36=_[_0x1669('0xaa')](_0x31a515,'WhatsappInteractionId');var _0x1e5b23=[];_0x50f9ae['forEach'](function(_0x3abcb6){_0x1e5b23['push'](updateWhatsappInteraction(_0x3abcb6,_0x2ad0eb,_0x127d36));});return BPromise[_0x1669('0xab')](_0x1e5b23);});});})[_0x1669('0x2b')](function(_0x26d83f){_0x47b396[_0x1669('0xac')]=_0x26d83f;return _0x47b396;})[_0x1669('0x2b')](respondWithFilteredResult(_0x52747f,_0xf271d6))[_0x1669('0x36')](handleError(_0x52747f,null));};exports[_0x1669('0xad')]=function(_0x221e4b,_0x57be8e){var _0x5c8126={'raw':![],'where':{'id':_0x221e4b[_0x1669('0xae')]['id']}},_0x354799={};_0x354799[_0x1669('0x43')]=_[_0x1669('0x46')](db[_0x1669('0x3f')][_0x1669('0x40')]);_0x354799[_0x1669('0x45')]=_[_0x1669('0x46')](_0x221e4b[_0x1669('0x45')]);_0x354799[_0x1669('0x47')]=_['intersection'](_0x354799[_0x1669('0x43')],_0x354799[_0x1669('0x45')]);_0x5c8126[_0x1669('0x4a')]=_[_0x1669('0x48')](_0x354799[_0x1669('0x43')],qs[_0x1669('0x49')](_0x221e4b['query'][_0x1669('0x49')]));_0x5c8126[_0x1669('0x4a')]=_0x5c8126[_0x1669('0x4a')][_0x1669('0x4b')]?_0x5c8126[_0x1669('0x4a')]:_0x354799[_0x1669('0x43')];if(_0x221e4b[_0x1669('0x45')][_0x1669('0xaf')]){_0x5c8126['include']=[{'all':!![]}];}_0x5c8126=_[_0x1669('0x9d')]({},_0x5c8126,_0x221e4b[_0x1669('0xb0')]);return db['WhatsappInteraction']['find'](_0x5c8126)[_0x1669('0x2b')](handleEntityNotFound(_0x57be8e,null))['then'](respondWithResult(_0x57be8e,null))[_0x1669('0x36')](handleError(_0x57be8e,null));};exports[_0x1669('0xb1')]=function(_0x2bc29e,_0x500810){return db[_0x1669('0x3f')][_0x1669('0xb1')](_0x2bc29e[_0x1669('0x79')],{})['then'](respondWithResult(_0x500810,0xc9))[_0x1669('0x36')](handleError(_0x500810,null));};exports[_0x1669('0xb2')]=function(_0x4a0c7d,_0x455501){if(_0x4a0c7d[_0x1669('0x79')]['id']){delete _0x4a0c7d[_0x1669('0x79')]['id'];}return db['WhatsappInteraction'][_0x1669('0x75')]({'where':{'id':_0x4a0c7d[_0x1669('0xae')]['id']}})[_0x1669('0x2b')](handleEntityNotFound(_0x455501,null))['then'](saveUpdates(_0x4a0c7d[_0x1669('0x79')],null))['then'](respondWithResult(_0x455501,null))[_0x1669('0x36')](handleError(_0x455501,null));};exports[_0x1669('0x2c')]=function(_0x1becf6,_0x265551){return db[_0x1669('0x3f')][_0x1669('0x75')]({'where':{'id':_0x1becf6[_0x1669('0xae')]['id']}})[_0x1669('0x2b')](handleEntityNotFound(_0x265551,null))[_0x1669('0x2b')](removeEntity(_0x265551,null))[_0x1669('0x36')](handleError(_0x265551,null));};exports['describe']=function(_0x3453f1,_0x413113){return db[_0x1669('0x3f')]['describe']()[_0x1669('0x2b')](respondWithResult(_0x413113,null))[_0x1669('0x36')](handleError(_0x413113,null));};exports[_0x1669('0xb3')]=function(_0x4b9a2e,_0x2a52cc,_0x490c5e){return db['WhatsappMessage'][_0x1669('0x75')]({'where':{'id':_0x4b9a2e[_0x1669('0xae')]['id']}})['then'](handleEntityNotFound(_0x2a52cc,null))[_0x1669('0x2b')](function(_0x24bd42){if(_0x24bd42){return _0x24bd42[_0x1669('0xb3')](_0x4b9a2e['body'][_0x1669('0xb4')],_[_0x1669('0xb5')](_0x4b9a2e['body'],[_0x1669('0xb4'),'id'])||{});}})['then'](respondWithResult(_0x2a52cc,null))['catch'](handleError(_0x2a52cc,null));};exports['getMessages']=function(_0x5e8b65,_0x1276e2,_0x39bafb){var _0x3ac122={'raw':![],'where':{}};var _0x3cb415={};var _0x2d1910={'count':0x0,'rows':[]};return db[_0x1669('0x3f')][_0x1669('0xb6')]({'where':{'id':_0x5e8b65['params']['id']}})[_0x1669('0x2b')](handleEntityNotFound(_0x1276e2,null))[_0x1669('0x2b')](function(_0x22a79c){if(_0x22a79c){_0x3cb415['model']=_[_0x1669('0x46')](db[_0x1669('0xb7')][_0x1669('0x40')]);_0x3cb415[_0x1669('0x45')]=_[_0x1669('0x46')](_0x5e8b65[_0x1669('0x45')]);_0x3cb415['filters']=_[_0x1669('0x48')](_0x3cb415['model'],_0x3cb415['query']);_0x3ac122[_0x1669('0x4a')]=_['intersection'](_0x3cb415[_0x1669('0x43')],qs[_0x1669('0x49')](_0x5e8b65['query'][_0x1669('0x49')]));_0x3ac122[_0x1669('0x4a')]=_0x3ac122['attributes'][_0x1669('0x4b')]?_0x3ac122[_0x1669('0x4a')]:_0x3cb415[_0x1669('0x43')];if(!_0x5e8b65['query'][_0x1669('0x4c')](_0x1669('0x4d'))){_0x3ac122[_0x1669('0x25')]=qs[_0x1669('0x25')](_0x5e8b65[_0x1669('0x45')][_0x1669('0x25')]);_0x3ac122[_0x1669('0x23')]=qs[_0x1669('0x23')](_0x5e8b65[_0x1669('0x45')][_0x1669('0x23')]);}_0x3ac122[_0x1669('0x92')]=qs[_0x1669('0xb8')](_0x5e8b65['query'][_0x1669('0xb8')]);_0x3ac122['where']=qs['filters'](_[_0x1669('0x4f')](_0x5e8b65[_0x1669('0x45')],_0x3cb415['filters']));_0x3ac122[_0x1669('0x4e')][_0x1669('0xb9')]=_0x22a79c['id'];if(_0x5e8b65[_0x1669('0x45')][_0x1669('0x87')]){_0x3ac122[_0x1669('0x4e')]=_[_0x1669('0x9d')](_0x3ac122[_0x1669('0x4e')],{'$or':_['map'](_0x3ac122['attributes'],function(_0x4021b4){var _0x405bb4={};_0x405bb4[_0x4021b4]={'$like':'%'+_0x5e8b65['query']['filter']+'%'};return _0x405bb4;})});}if(_0x5e8b65[_0x1669('0x45')][_0x1669('0x7f')]){var _0x1c2c6e=_0x5e8b65[_0x1669('0x45')][_0x1669('0x7f')][_0x1669('0x6c')](',');var _0x453ed6={};_0x453ed6[_0x1c2c6e[0x0]]={'$gte':moment(_0x1c2c6e[0x1])[_0x1669('0xba')](_0x1669('0xbb'))};_0x3ac122[_0x1669('0x4e')]=_[_0x1669('0x9d')](_0x3ac122[_0x1669('0x4e')],_0x453ed6);}_0x3ac122=_['merge']({},_0x3ac122,_0x5e8b65['options']);return db[_0x1669('0xb7')][_0x1669('0x26')]({'where':_0x3ac122[_0x1669('0x4e')]})['then'](function(_0x403d07){_0x2d1910[_0x1669('0x26')]=_0x403d07;if(_0x5e8b65[_0x1669('0x45')]['includeAll']){_0x3ac122['include']=[{'all':!![]}];}return db[_0x1669('0xb7')][_0x1669('0xbc')](_0x3ac122);})[_0x1669('0x2b')](function(_0x5cc855){_0x2d1910['rows']=_0x5cc855;return _0x2d1910;});}})[_0x1669('0x2b')](respondWithFilteredResult(_0x1276e2,_0x3ac122))[_0x1669('0x36')](handleError(_0x1276e2,null));};exports[_0x1669('0xbd')]=function(_0xc44242,_0x34c737,_0xb763dd){return db[_0x1669('0x3f')][_0x1669('0x75')]({'where':{'id':_0xc44242[_0x1669('0xae')]['id']}})[_0x1669('0x2b')](handleEntityNotFound(_0x34c737,null))['then'](function(_0x36d7a3){if(_0x36d7a3){return _0x36d7a3[_0x1669('0xbe')](_0xc44242[_0x1669('0x79')]['ids'],_[_0x1669('0xb5')](_0xc44242[_0x1669('0x79')],[_0x1669('0xb4'),'id'])||{})['spread'](function(){return db['Tag'][_0x1669('0xbc')]({'attributes':['id',_0x1669('0x30'),_0x1669('0xbf')],'where':{'id':_0xc44242[_0x1669('0x79')][_0x1669('0xb4')]}});})['then'](function(_0x380182){socket[_0x1669('0xc0')](_0x1669('0xc1'),{'id':Number(_0xc44242[_0x1669('0xae')]['id']),'tags':_0x380182||[]});return{'id':Number(_0xc44242[_0x1669('0xae')]['id']),'tags':_0x380182||[]};});}})['then'](respondWithResult(_0x34c737,null))['catch'](handleError(_0x34c737,null));};exports[_0x1669('0xc2')]=function(_0x2fb0d2,_0x4fe54c,_0x1607da){return db[_0x1669('0x3f')]['find']({'where':{'id':_0x2fb0d2['params']['id']}})['then'](handleEntityNotFound(_0x4fe54c,null))[_0x1669('0x2b')](function(_0x27792f){if(_0x27792f){return _0x27792f[_0x1669('0xc2')](_0x2fb0d2[_0x1669('0x45')]['ids']);}})[_0x1669('0x2b')](respondWithStatusCode(_0x4fe54c,null))[_0x1669('0x36')](handleError(_0x4fe54c,null));};exports[_0x1669('0xc3')]=function(_0x25ce63,_0x1a890a){var _0x45d36a=moment()[_0x1669('0xc4')]()[_0x1669('0x9b')]();var _0x487f77=path[_0x1669('0xc5')](config[_0x1669('0xc6')],_0x1669('0xc7'),'files',_0x1669('0xc8'));var _0x49c793=path[_0x1669('0xc5')](config[_0x1669('0xc6')],_0x1669('0xc7'),_0x1669('0xc9'),_0x1669('0xca'));var _0xdd65d9=path[_0x1669('0xc5')](_0x487f77,_0x45d36a);var _0x921616=util[_0x1669('0xba')](_0x1669('0xcb'),_0x25ce63['params']['id'],_0x45d36a);var _0xbf72a9=path[_0x1669('0xc5')](_0x487f77,_0x921616);var _0x5285e0=[];_0x5285e0[_0x1669('0x35')]({'model':db[_0x1669('0x73')],'as':_0x1669('0x73'),'attributes':['id',_0x1669('0x32')],'raw':!![]});_0x5285e0[_0x1669('0x35')]({'model':db[_0x1669('0xcc')],'as':'Contact','attributes':['id',_0x1669('0xcd'),_0x1669('0xce')],'raw':!![]});if(_0x25ce63[_0x1669('0x45')][_0x1669('0xca')]){_0x5285e0[_0x1669('0x35')]({'model':db[_0x1669('0xcf')],'as':_0x1669('0xcf'),'raw':!![]});}var _0x23c8f5=[{'model':db[_0x1669('0xb7')],'as':'Messages','attributes':['id','body',_0x1669('0xd0'),_0x1669('0xd1'),_0x1669('0xd2'),_0x1669('0xd3')],'include':_0x5285e0}];_0x23c8f5['push']({'model':db[_0x1669('0xd4')],'as':_0x1669('0xd5'),'attributes':['id',_0x1669('0x30')]});_0x23c8f5[_0x1669('0x35')]({'model':db[_0x1669('0x73')],'as':_0x1669('0xd6'),'attributes':['id',_0x1669('0x32')]});return db['WhatsappInteraction'][_0x1669('0x75')]({'where':{'id':_0x25ce63['params']['id']},'include':_0x23c8f5})[_0x1669('0x2b')](handleEntityNotFound(_0x1a890a,null))[_0x1669('0x2b')](function(_0xf05230){if(_0xf05230){var _0x5f5c5f=_0xf05230[_0x1669('0xd7')]({'plain':!![]});fs[_0x1669('0xd8')](_0xdd65d9);var _0x249ea3={'channel':_0x1669('0xd9'),'account':_0x5f5c5f['Account'][_0x1669('0x30')],'agent':_0x5f5c5f[_0x1669('0xd6')]?_0x5f5c5f[_0x1669('0xd6')][_0x1669('0x32')]:_0x1669('0xda'),'createdAt':moment(_0x5f5c5f[_0x1669('0xd0')])[_0x1669('0xba')](_0x1669('0xbb'))['toString'](),'closedAt':_0x5f5c5f[_0x1669('0x3c')]?moment(_0x5f5c5f[_0x1669('0xdb')])[_0x1669('0xba')](_0x1669('0xbb'))[_0x1669('0x9b')]():'','disposition':_0x5f5c5f[_0x1669('0xdc')],'messages':_(_0x5f5c5f[_0x1669('0xdd')])[_0x1669('0x87')]({'secret':![]})[_0x1669('0x44')](function(_0x29c966){if(_0x29c966[_0x1669('0xcf')]){var _0x24e09b=path[_0x1669('0xc5')](_0x49c793,_0x29c966[_0x1669('0xcf')][_0x1669('0xde')]);if(fs[_0x1669('0xdf')](_0x24e09b)){fs[_0x1669('0xe0')](_0x24e09b)[_0x1669('0xe1')](fs['createWriteStream'](path[_0x1669('0xc5')](_0xdd65d9,_0x29c966[_0x1669('0xcf')][_0x1669('0xde')])));}}return{'date':moment(_0x29c966[_0x1669('0xd0')])[_0x1669('0xba')](_0x1669('0xbb'))[_0x1669('0x9b')](),'sender':_0x29c966[_0x1669('0xd1')]===_0x1669('0xe2')?_0x29c966[_0x1669('0x73')]?_0x29c966[_0x1669('0x73')][_0x1669('0x32')]:_0x1669('0xe3'):_0x29c966['Contact'][_0x1669('0xcd')]+(_0x29c966[_0x1669('0xe4')][_0x1669('0xce')]?'\x20'+_0x29c966['Contact'][_0x1669('0xce')]:''),'body':_0x29c966[_0x1669('0xcf')]?_0x29c966[_0x1669('0xcf')][_0x1669('0xde')]:_0x29c966['body'],'direction':_0x29c966[_0x1669('0xd1')]===_0x1669('0xe2')?'A':'C','secret':_0x29c966[_0x1669('0xd2')],'read':_0x29c966[_0x1669('0xd3')],'attachment':_0x29c966[_0x1669('0xcf')]};})[_0x1669('0x6b')]()};return ejs[_0x1669('0xe5')](path[_0x1669('0xc5')](config[_0x1669('0xc6')],_0x1669('0xc7'),_0x1669('0xe6'),_0x1669('0xe7')),{'interaction':_0x249ea3})['then'](function(_0x42f984){var _0x40aa5a=path[_0x1669('0xc5')](_0xdd65d9,'transcript-'+_0x5f5c5f['id']+'-'+_0x45d36a+_0x1669('0xe8'));var _0x59e891={'path':_0x40aa5a,'channel':_0x1669('0xd9'),'interactionId':_0x5f5c5f['id']};return pdf['createPdfFromHTML'](_0x42f984,_0x59e891);})[_0x1669('0x2b')](function(){return new BPromise(function(_0x536597,_0x55dd4d){zipdir(_0xdd65d9,{'saveTo':_0xbf72a9},function(_0x3faf29,_0x19ca04){if(_0x3faf29)return _0x55dd4d(_0x3faf29);return _0x536597(_0x19ca04);});})[_0x1669('0x2b')](function(){return new BPromise(function(_0x3860e5,_0x59c3cb){rimraf(_0xdd65d9,function(_0x1f748e){if(_0x1f748e)_0x59c3cb(_0x1f748e);return _0x3860e5();});});})[_0x1669('0x2b')](function(){return _0x1a890a['download'](_0xbf72a9,_0x921616,function(_0x430da3){if(_0x430da3){console[_0x1669('0xe9')](_0x1669('0xea'),_0x430da3);}else{fs[_0x1669('0xeb')](_0xbf72a9);}});});});}else{return _0x1a890a['sendStatus'](0xc8);}})[_0x1669('0x36')](handleError(_0x1a890a,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 13789b4..96e56c3 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 _0xce3a=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage'];(function(_0x46fd61,_0x462dd4){var _0x436b0a=function(_0x81a00e){while(--_0x81a00e){_0x46fd61['push'](_0x46fd61['shift']());}};_0x436b0a(++_0x462dd4);}(_0xce3a,0x194));var _0xace3=function(_0x25e0ef,_0x413cad){_0x25e0ef=_0x25e0ef-0x0;var _0x366de5=_0xce3a[_0x25e0ef];return _0x366de5;};'use strict';var EventEmitter=require(_0xace3('0x0'));var WhatsappInteraction=require(_0xace3('0x1'))['db'][_0xace3('0x2')];var WhatsappMessage=require(_0xace3('0x1'))['db'][_0xace3('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xace3('0x4')](0x0);var events={'afterCreate':_0xace3('0x5'),'afterUpdate':_0xace3('0x6'),'afterDestroy':_0xace3('0x7')};function emitEvent(_0x80eaaf){return function(_0x17d5af,_0x47707b,_0x4c3ae9){_0x17d5af[_0xace3('0x8')]({'attributes':['id'],'raw':!![]})[_0xace3('0x9')](function(_0x4d5360){_0x17d5af[_0xace3('0xa')]('Users',_0x4d5360[_0xace3('0xb')](function(_0x5609f2){return{'id':_0x5609f2['id']};}));return WhatsappMessage[_0xace3('0xc')]({'where':{'WhatsappInteractionId':_0x17d5af['id'],'direction':'in','read':![]},'raw':!![]});})[_0xace3('0x9')](function(_0x2bc454){_0x17d5af[_0xace3('0xa')](_0xace3('0xd'),_0x2bc454[_0xace3('0xe')]);WhatsappInteractionEvents[_0xace3('0xf')](_0x80eaaf+':'+_0x17d5af['id'],_0x17d5af);WhatsappInteractionEvents[_0xace3('0xf')](_0x80eaaf,_0x17d5af);_0x4c3ae9(null);})['catch'](_0x4c3ae9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xace3('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xbde2=['setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','then'];(function(_0x42ccbc,_0x5c3d87){var _0x5607ad=function(_0x1e92ce){while(--_0x1e92ce){_0x42ccbc['push'](_0x42ccbc['shift']());}};_0x5607ad(++_0x5c3d87);}(_0xbde2,0x7a));var _0x2bde=function(_0x1811b6,_0x26d9db){_0x1811b6=_0x1811b6-0x0;var _0x10f9eb=_0xbde2[_0x1811b6];return _0x10f9eb;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x2bde('0x0'))['db'][_0x2bde('0x1')];var WhatsappMessage=require(_0x2bde('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x2bde('0x2')](0x0);var events={'afterCreate':_0x2bde('0x3'),'afterUpdate':_0x2bde('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3622bb){return function(_0x211d7c,_0x2a8d2e,_0x3b3039){_0x211d7c['getUsers']({'attributes':['id'],'raw':!![]})[_0x2bde('0x5')](function(_0x7b834d){_0x211d7c[_0x2bde('0x6')](_0x2bde('0x7'),_0x7b834d[_0x2bde('0x8')](function(_0x27eda4){return{'id':_0x27eda4['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x211d7c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4a4bf0){_0x211d7c[_0x2bde('0x6')](_0x2bde('0x9'),_0x4a4bf0[_0x2bde('0xa')]);WhatsappInteractionEvents['emit'](_0x3622bb+':'+_0x211d7c['id'],_0x211d7c);WhatsappInteractionEvents[_0x2bde('0xb')](_0x3622bb,_0x211d7c);_0x3b3039(null);})[_0x2bde('0xc')](_0x3b3039(null));};}for(var e in events){if(events[_0x2bde('0xd')](e)){var event=events[e];WhatsappInteraction[_0x2bde('0xe')](e,emitEvent(event));}}module[_0x2bde('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 6a1156f..cdd814f 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 _0xa7b6=['../../config/environment','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xa07ec5,_0xd94082){var _0x470e57=function(_0x26a595){while(--_0x26a595){_0xa07ec5['push'](_0xa07ec5['shift']());}};_0x470e57(++_0xd94082);}(_0xa7b6,0x16d));var _0x6a7b=function(_0x1b5a05,_0x2c80de){_0x1b5a05=_0x1b5a05-0x0;var _0x347931=_0xa7b6[_0x1b5a05];return _0x347931;};'use strict';var _=require(_0x6a7b('0x0'));var util=require(_0x6a7b('0x1'));var logger=require(_0x6a7b('0x2'))(_0x6a7b('0x3'));var moment=require(_0x6a7b('0x4'));var BPromise=require(_0x6a7b('0x5'));var rp=require(_0x6a7b('0x6'));var fs=require('fs');var path=require(_0x6a7b('0x7'));var rimraf=require(_0x6a7b('0x8'));var config=require(_0x6a7b('0x9'));var attributes=require('./whatsappInteraction.attributes');module[_0x6a7b('0xa')]=function(_0x2252a3,_0x4df088){return _0x2252a3[_0x6a7b('0xb')](_0x6a7b('0xc'),attributes,{'tableName':_0x6a7b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1f5aa7,_0x4af290,_0xdb0649){if(_0x1f5aa7[_0x6a7b('0xe')]('closed')){_0x1f5aa7[_0x6a7b('0xf')]=moment()['format'](_0x6a7b('0x10'));}_0xdb0649(null,_0x1f5aa7);}}});}; \ No newline at end of file +var _0x1d1d=['../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xe090ca,_0x49efcf){var _0x5ab2b9=function(_0xd01a9f){while(--_0xd01a9f){_0xe090ca['push'](_0xe090ca['shift']());}};_0x5ab2b9(++_0x49efcf);}(_0x1d1d,0x1cc));var _0xd1d1=function(_0x4f7537,_0x3efb7d){_0x4f7537=_0x4f7537-0x0;var _0x56da00=_0x1d1d[_0x4f7537];return _0x56da00;};'use strict';var _=require(_0xd1d1('0x0'));var util=require('util');var logger=require(_0xd1d1('0x1'))(_0xd1d1('0x2'));var moment=require(_0xd1d1('0x3'));var BPromise=require(_0xd1d1('0x4'));var rp=require(_0xd1d1('0x5'));var fs=require('fs');var path=require(_0xd1d1('0x6'));var rimraf=require(_0xd1d1('0x7'));var config=require(_0xd1d1('0x8'));var attributes=require(_0xd1d1('0x9'));module[_0xd1d1('0xa')]=function(_0x52ff1e,_0x31a8d2){return _0x52ff1e[_0xd1d1('0xb')]('WhatsappInteraction',attributes,{'tableName':_0xd1d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d9ba8,_0x2bae48,_0x554fef){if(_0x2d9ba8[_0xd1d1('0xd')](_0xd1d1('0xe'))){_0x2d9ba8[_0xd1d1('0xf')]=moment()[_0xd1d1('0x10')](_0xd1d1('0x11'));}_0x554fef(null,_0x2d9ba8);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 65ef15e..75ebfbc 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 _0xd2b4=['WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappInteraction','body','options','raw','where','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','ids','omit','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x42dcbc,_0x308015){var _0x1d8569=function(_0xc4eb10){while(--_0xc4eb10){_0x42dcbc['push'](_0x42dcbc['shift']());}};_0x1d8569(++_0x308015);}(_0xd2b4,0xd0));var _0x4d2b=function(_0x1c0f3d,_0x55a9e2){_0x1c0f3d=_0x1c0f3d-0x0;var _0x4d71a8=_0xd2b4[_0x1c0f3d];return _0x4d71a8;};'use strict';var _=require(_0x4d2b('0x0'));var util=require(_0x4d2b('0x1'));var moment=require(_0x4d2b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d2b('0x3'));var db=require(_0x4d2b('0x4'))['db'];var utils=require(_0x4d2b('0x5'));var logger=require('../../config/logger')(_0x4d2b('0x6'));var config=require(_0x4d2b('0x7'));var jayson=require(_0x4d2b('0x8'));var client=jayson['client'][_0x4d2b('0x9')]({'port':0x232a});config[_0x4d2b('0xa')]=_[_0x4d2b('0xb')](config[_0x4d2b('0xa')],{'host':_0x4d2b('0xc'),'port':0x18eb});var socket=require(_0x4d2b('0xd'))(new Redis(config[_0x4d2b('0xa')]));require(_0x4d2b('0xe'))['register'](socket);function respondWithRpcPromise(_0x16e3dd,_0x2504b7,_0x122156){return new BPromise(function(_0x57eb46,_0x4f9010){return client['request'](_0x16e3dd,_0x122156)[_0x4d2b('0xf')](function(_0x34a3af){logger[_0x4d2b('0x10')](_0x4d2b('0x11'),_0x2504b7,_0x4d2b('0x12'));logger[_0x4d2b('0x13')](_0x4d2b('0x14'),_0x2504b7,_0x4d2b('0x12'),JSON[_0x4d2b('0x15')](_0x34a3af));if(_0x34a3af[_0x4d2b('0x16')]){if(_0x34a3af[_0x4d2b('0x16')][_0x4d2b('0x17')]===0x1f4){logger[_0x4d2b('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x2504b7,_0x34a3af[_0x4d2b('0x16')][_0x4d2b('0x18')]);return _0x4f9010(_0x34a3af[_0x4d2b('0x16')][_0x4d2b('0x18')]);}logger['error'](_0x4d2b('0x11'),_0x2504b7,_0x34a3af[_0x4d2b('0x16')][_0x4d2b('0x18')]);return _0x57eb46(_0x34a3af[_0x4d2b('0x16')][_0x4d2b('0x18')]);}else{logger[_0x4d2b('0x10')](_0x4d2b('0x11'),_0x2504b7,'request\x20sent');_0x57eb46(_0x34a3af[_0x4d2b('0x19')][_0x4d2b('0x18')]);}})[_0x4d2b('0x1a')](function(_0x537cca){logger[_0x4d2b('0x16')](_0x4d2b('0x11'),_0x2504b7,_0x537cca);_0x4f9010(_0x537cca);});});}exports['UpdateWhatsappInteraction']=function(_0x571a90){var _0x1fc3a8=this;return new Promise(function(_0x3d939f,_0x53f48c){return db[_0x4d2b('0x1b')]['update'](_0x571a90[_0x4d2b('0x1c')],{'raw':_0x571a90[_0x4d2b('0x1d')]?_0x571a90[_0x4d2b('0x1d')][_0x4d2b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x571a90[_0x4d2b('0x1d')]?_0x571a90[_0x4d2b('0x1d')][_0x4d2b('0x1f')]||null:null,'attributes':_0x571a90[_0x4d2b('0x1d')]?_0x571a90[_0x4d2b('0x1d')]['attributes']||null:null,'limit':_0x571a90[_0x4d2b('0x1d')]?_0x571a90[_0x4d2b('0x1d')]['limit']||null:null})[_0x4d2b('0xf')](function(_0x19433a){logger[_0x4d2b('0x10')](_0x4d2b('0x20'),_0x571a90);logger[_0x4d2b('0x13')](_0x4d2b('0x20'),_0x571a90,JSON['stringify'](_0x19433a));_0x3d939f(_0x19433a);})[_0x4d2b('0x1a')](function(_0x1b2e28){logger[_0x4d2b('0x16')](_0x4d2b('0x20'),_0x1b2e28['message'],_0x571a90);_0x53f48c(_0x1fc3a8[_0x4d2b('0x16')](0x1f4,_0x1b2e28[_0x4d2b('0x18')]));});});};exports[_0x4d2b('0x21')]=function(_0x142017){return new Promise(function(_0x38c35f,_0x3649a2){return db['WhatsappInteraction']['find']({'where':_0x142017[_0x4d2b('0x1d')]?_0x142017['options']['where']||null:null})[_0x4d2b('0xf')](function(_0x42eaa2){if(_0x42eaa2){return _0x42eaa2['addTags'](_0x142017[_0x4d2b('0x1c')][_0x4d2b('0x22')],_[_0x4d2b('0x23')](_0x142017['body'],[_0x4d2b('0x22'),'id'])||{});}})[_0x4d2b('0x24')](function(_0x23c409){logger[_0x4d2b('0x10')](_0x4d2b('0x25'),_0x142017);logger['debug'](_0x4d2b('0x25'),_0x142017,JSON['stringify'](_0x23c409));_0x38c35f(_0x23c409);})[_0x4d2b('0x1a')](function(_0x512905){logger['error'](_0x4d2b('0x25'),_0x512905[_0x4d2b('0x18')],_0x142017);_0x3649a2(_this[_0x4d2b('0x16')](0x1f4,_0x512905[_0x4d2b('0x18')]));});});}; \ No newline at end of file +var _0x8a7d=['result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','raw','options','where','attributes','stringify','then','addTags','body','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8a7d,0x12f));var _0xd8a7=function(_0x2ce075,_0x5be470){_0x2ce075=_0x2ce075-0x0;var _0x28eb66=_0x8a7d[_0x2ce075];return _0x28eb66;};'use strict';var _=require(_0xd8a7('0x0'));var util=require(_0xd8a7('0x1'));var moment=require(_0xd8a7('0x2'));var BPromise=require(_0xd8a7('0x3'));var rs=require(_0xd8a7('0x4'));var fs=require('fs');var Redis=require(_0xd8a7('0x5'));var db=require(_0xd8a7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd8a7('0x7'))(_0xd8a7('0x8'));var config=require('../../config/environment');var jayson=require(_0xd8a7('0x9'));var client=jayson['client'][_0xd8a7('0xa')]({'port':0x232a});config[_0xd8a7('0xb')]=_[_0xd8a7('0xc')](config['redis'],{'host':_0xd8a7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8a7('0xb')]));require(_0xd8a7('0xe'))[_0xd8a7('0xf')](socket);function respondWithRpcPromise(_0x395b25,_0x521d7a,_0xd6e062){return new BPromise(function(_0x22683c,_0x44719a){return client[_0xd8a7('0x10')](_0x395b25,_0xd6e062)['then'](function(_0xda9f33){logger[_0xd8a7('0x11')](_0xd8a7('0x12'),_0x521d7a,_0xd8a7('0x13'));logger[_0xd8a7('0x14')](_0xd8a7('0x15'),_0x521d7a,'request\x20sent',JSON['stringify'](_0xda9f33));if(_0xda9f33[_0xd8a7('0x16')]){if(_0xda9f33['error'][_0xd8a7('0x17')]===0x1f4){logger[_0xd8a7('0x16')](_0xd8a7('0x12'),_0x521d7a,_0xda9f33[_0xd8a7('0x16')][_0xd8a7('0x18')]);return _0x44719a(_0xda9f33[_0xd8a7('0x16')][_0xd8a7('0x18')]);}logger[_0xd8a7('0x16')](_0xd8a7('0x12'),_0x521d7a,_0xda9f33[_0xd8a7('0x16')][_0xd8a7('0x18')]);return _0x22683c(_0xda9f33['error']['message']);}else{logger[_0xd8a7('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x521d7a,_0xd8a7('0x13'));_0x22683c(_0xda9f33[_0xd8a7('0x19')][_0xd8a7('0x18')]);}})[_0xd8a7('0x1a')](function(_0x3c6c16){logger[_0xd8a7('0x16')](_0xd8a7('0x12'),_0x521d7a,_0x3c6c16);_0x44719a(_0x3c6c16);});});}exports[_0xd8a7('0x1b')]=function(_0x5ef345){var _0x3783ca=this;return new Promise(function(_0x28a36d,_0x1b7900){return db[_0xd8a7('0x1c')][_0xd8a7('0x1d')](_0x5ef345['body'],{'raw':_0x5ef345['options']?_0x5ef345['options'][_0xd8a7('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ef345['options']?_0x5ef345[_0xd8a7('0x1f')][_0xd8a7('0x20')]||null:null,'attributes':_0x5ef345[_0xd8a7('0x1f')]?_0x5ef345['options'][_0xd8a7('0x21')]||null:null,'limit':_0x5ef345[_0xd8a7('0x1f')]?_0x5ef345['options']['limit']||null:null})['then'](function(_0x236034){logger[_0xd8a7('0x11')](_0xd8a7('0x1b'),_0x5ef345);logger['debug']('UpdateWhatsappInteraction',_0x5ef345,JSON[_0xd8a7('0x22')](_0x236034));_0x28a36d(_0x236034);})[_0xd8a7('0x1a')](function(_0x4e0015){logger[_0xd8a7('0x16')]('UpdateWhatsappInteraction',_0x4e0015[_0xd8a7('0x18')],_0x5ef345);_0x1b7900(_0x3783ca[_0xd8a7('0x16')](0x1f4,_0x4e0015[_0xd8a7('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x5526ec){return new Promise(function(_0x1e128c,_0x53affb){return db[_0xd8a7('0x1c')]['find']({'where':_0x5526ec[_0xd8a7('0x1f')]?_0x5526ec['options'][_0xd8a7('0x20')]||null:null})[_0xd8a7('0x23')](function(_0x9714){if(_0x9714){return _0x9714[_0xd8a7('0x24')](_0x5526ec[_0xd8a7('0x25')][_0xd8a7('0x26')],_[_0xd8a7('0x27')](_0x5526ec['body'],['ids','id'])||{});}})['spread'](function(_0x883b46){logger[_0xd8a7('0x11')](_0xd8a7('0x28'),_0x5526ec);logger[_0xd8a7('0x14')](_0xd8a7('0x28'),_0x5526ec,JSON['stringify'](_0x883b46));_0x1e128c(_0x883b46);})[_0xd8a7('0x1a')](function(_0x1d7ece){logger[_0xd8a7('0x16')](_0xd8a7('0x28'),_0x1d7ece[_0xd8a7('0x18')],_0x5526ec);_0x53affb(_this[_0xd8a7('0x16')](0x1f4,_0x1d7ece[_0xd8a7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 42ca0fd..504118c 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 _0x7a5b=['remove','update','emit','removeListener','length','whatsappInteraction:','save'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x7a5b,0x164));var _0xb7a5=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0x7a5b[_0x50cfc3];return _0x5c11ef;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xb7a5('0x0'),_0xb7a5('0x1'),_0xb7a5('0x2')];function createListener(_0x519e66,_0x2d1181){return function(_0x414835){_0x2d1181[_0xb7a5('0x3')](_0x519e66,_0x414835);};}function removeListener(_0x27f9ef,_0x15c359){return function(){WhatsappInteractionEvents[_0xb7a5('0x4')](_0x27f9ef,_0x15c359);};}exports['register']=function(_0x3da68e){for(var _0x3780bf=0x0,_0x58146d=events[_0xb7a5('0x5')];_0x3780bf<_0x58146d;_0x3780bf++){var _0x5d8871=events[_0x3780bf];var _0x4029ba=createListener(_0xb7a5('0x6')+_0x5d8871,_0x3da68e);WhatsappInteractionEvents['on'](_0x5d8871,_0x4029ba);}}; \ No newline at end of file +var _0x91ed=['length','whatsappInteraction:','./whatsappInteraction.events','save','emit','removeListener','register'];(function(_0x55f795,_0x11c4e1){var _0x3d673b=function(_0x55361d){while(--_0x55361d){_0x55f795['push'](_0x55f795['shift']());}};_0x3d673b(++_0x11c4e1);}(_0x91ed,0x12f));var _0xd91e=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x91ed[_0x36ed48];return _0x51c63a;};'use strict';var WhatsappInteractionEvents=require(_0xd91e('0x0'));var events=[_0xd91e('0x1'),'remove','update'];function createListener(_0x25b81d,_0x2582c6){return function(_0x1af551){_0x2582c6[_0xd91e('0x2')](_0x25b81d,_0x1af551);};}function removeListener(_0x306d9e,_0x37b87f){return function(){WhatsappInteractionEvents[_0xd91e('0x3')](_0x306d9e,_0x37b87f);};}exports[_0xd91e('0x4')]=function(_0x3c764c){for(var _0x41bea5=0x0,_0x5d2b41=events[_0xd91e('0x5')];_0x41bea5<_0x5d2b41;_0x41bea5++){var _0xb54bc9=events[_0x41bea5];var _0xaf5e91=createListener(_0xd91e('0x6')+_0xb54bc9,_0x3c764c);WhatsappInteractionEvents['on'](_0xb54bc9,_0xaf5e91);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 4c99131..a9edbae 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 _0x49f2=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','whatsapp','whatsappmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','delete','destroy','exports'];(function(_0x4cff29,_0x17024b){var _0x4d4d09=function(_0x366350){while(--_0x366350){_0x4cff29['push'](_0x4cff29['shift']());}};_0x4d4d09(++_0x17024b);}(_0x49f2,0xc4));var _0x249f=function(_0x3f0d2e,_0x259757){_0x3f0d2e=_0x3f0d2e-0x0;var _0x22bd62=_0x49f2[_0x3f0d2e];return _0x22bd62;};'use strict';var multer=require(_0x249f('0x0'));var util=require(_0x249f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x249f('0x2'));var router=express[_0x249f('0x3')]();var fs_extra=require(_0x249f('0x4'));var auth=require(_0x249f('0x5'));var interaction=require(_0x249f('0x6'));var config=require('../../config/environment');var controller=require(_0x249f('0x7'));router[_0x249f('0x8')]('/',auth[_0x249f('0x9')](),controller[_0x249f('0xa')]);router[_0x249f('0x8')](_0x249f('0xb'),auth[_0x249f('0x9')](),controller[_0x249f('0xc')]);router[_0x249f('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x249f('0xd')]);router[_0x249f('0xe')]('/',auth[_0x249f('0x9')](),interaction[_0x249f('0xf')](_0x249f('0x10'),_0x249f('0x11')),controller[_0x249f('0x12')]);router[_0x249f('0xe')]('/:id/status',controller['status']);router[_0x249f('0x13')](_0x249f('0x14'),auth[_0x249f('0x9')](),controller[_0x249f('0x15')]);router['put'](_0x249f('0x16'),auth[_0x249f('0x9')](),controller[_0x249f('0x17')]);router[_0x249f('0x13')](_0x249f('0x18'),auth[_0x249f('0x9')](),controller['reject']);router[_0x249f('0x19')](_0x249f('0x14'),auth['isAuthenticated'](),controller[_0x249f('0x1a')]);module[_0x249f('0x1b')]=router; \ No newline at end of file +var _0x53bb=['describe','/:id','show','tracked','whatsapp','whatsappmessage:create','post','/:id/status','status','update','put','accept','/:id/reject','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x3030a9,_0x3e7be2){var _0x5e6b29=function(_0x4be727){while(--_0x4be727){_0x3030a9['push'](_0x3030a9['shift']());}};_0x5e6b29(++_0x3e7be2);}(_0x53bb,0x126));var _0xb53b=function(_0x4c3cdd,_0x47fbe1){_0x4c3cdd=_0x4c3cdd-0x0;var _0x1e4a12=_0x53bb[_0x4c3cdd];return _0x1e4a12;};'use strict';var multer=require('multer');var util=require(_0xb53b('0x0'));var path=require(_0xb53b('0x1'));var timeout=require(_0xb53b('0x2'));var express=require(_0xb53b('0x3'));var router=express[_0xb53b('0x4')]();var fs_extra=require(_0xb53b('0x5'));var auth=require(_0xb53b('0x6'));var interaction=require(_0xb53b('0x7'));var config=require(_0xb53b('0x8'));var controller=require(_0xb53b('0x9'));router[_0xb53b('0xa')]('/',auth[_0xb53b('0xb')](),controller[_0xb53b('0xc')]);router['get'](_0xb53b('0xd'),auth['isAuthenticated'](),controller[_0xb53b('0xe')]);router['get'](_0xb53b('0xf'),auth['isAuthenticated'](),controller[_0xb53b('0x10')]);router['post']('/',auth[_0xb53b('0xb')](),interaction[_0xb53b('0x11')](_0xb53b('0x12'),_0xb53b('0x13')),controller['create']);router[_0xb53b('0x14')](_0xb53b('0x15'),controller[_0xb53b('0x16')]);router['put'](_0xb53b('0xf'),auth[_0xb53b('0xb')](),controller[_0xb53b('0x17')]);router[_0xb53b('0x18')]('/:id/accept',auth[_0xb53b('0xb')](),controller[_0xb53b('0x19')]);router['put'](_0xb53b('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete']('/:id',auth[_0xb53b('0xb')](),controller[_0xb53b('0x1b')]);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 7a4c751..36be641 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 _0xe74d=['STRING','DATE','sequelize','exports','BOOLEAN','ENUM','out'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe74d,0x16e));var _0xde74=function(_0x526876,_0x2473ec){_0x526876=_0x526876-0x0;var _0x379ab5=_0xe74d[_0x526876];return _0x379ab5;};'use strict';var Sequelize=require(_0xde74('0x0'));module[_0xde74('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xde74('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xde74('0x3')]('in',_0xde74('0x4')),'defaultValue':_0xde74('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xde74('0x5')]},'readAt':{'type':Sequelize[_0xde74('0x6')]},'secret':{'type':Sequelize[_0xde74('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xde74('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4215=['BOOLEAN','ENUM','out','STRING','TEXT','sequelize','medium'];(function(_0xf363f0,_0x3b5eeb){var _0x55a386=function(_0x548349){while(--_0x548349){_0xf363f0['push'](_0xf363f0['shift']());}};_0x55a386(++_0x3b5eeb);}(_0x4215,0x6e));var _0x5421=function(_0x339984,_0x4e41ad){_0x339984=_0x339984-0x0;var _0xffa454=_0x4215[_0x339984];return _0xffa454;};'use strict';var Sequelize=require(_0x5421('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x5421('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x5421('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5421('0x3')]('in',_0x5421('0x4')),'defaultValue':_0x5421('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5421('0x5')](0xbe)},'phone':{'type':Sequelize[_0x5421('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x5421('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x5421('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 6142850..8a2f476 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 _0x6df4=['[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','interface','motionChannel','channel','event','EventManager','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','contact','SIP/%s','reject','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','http','client','request','then','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','WhatsappMessage','includeAll','findAll','rows','show','params','include','find','create','body','describe','../../config/logger','accept','whatsapp','read','readAt','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6df4,0xb6));var _0x46df=function(_0x3fe393,_0x234a3a){_0x3fe393=_0x3fe393-0x0;var _0x534d14=_0x6df4[_0x3fe393];return _0x534d14;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46df('0x0'));var zipdir=require(_0x46df('0x1'));var jsonpatch=require(_0x46df('0x2'));var rp=require('request-promise');var moment=require(_0x46df('0x3'));var BPromise=require(_0x46df('0x4'));var Mustache=require(_0x46df('0x5'));var util=require(_0x46df('0x6'));var path=require('path');var sox=require(_0x46df('0x7'));var csv=require(_0x46df('0x8'));var ejs=require(_0x46df('0x9'));var fs=require('fs');var fs_extra=require(_0x46df('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x46df('0xb'));var jsforce=require(_0x46df('0xc'));var deskjs=require(_0x46df('0xd'));var toCsv=require(_0x46df('0x8'));var querystring=require(_0x46df('0xe'));var Papa=require(_0x46df('0xf'));var Redis=require(_0x46df('0x10'));var authService=require(_0x46df('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x46df('0x12'));var hardwareService=require(_0x46df('0x13'));var logger=require('../../config/logger')(_0x46df('0x14'));var utils=require(_0x46df('0x15'));var config=require(_0x46df('0x16'));var licenseUtil=require(_0x46df('0x17'));var db=require('../../mysqldb')['db'];config[_0x46df('0x18')]=_[_0x46df('0x19')](config[_0x46df('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x46df('0x1a'))(new Redis(config[_0x46df('0x18')]));require(_0x46df('0x1b'))[_0x46df('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x46df('0x1d')]({'port':0x232c});var client9002=jayson[_0x46df('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x313d45,_0x2f9b09,_0x521823,_0x327eec){return new BPromise(function(_0x4f1f2c,_0x177ea8){var _0x556e63=_0x327eec||client;return _0x556e63[_0x46df('0x1f')](_0x313d45,_0x521823)[_0x46df('0x20')](function(_0x47046a){logger[_0x46df('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x2f9b09,'request\x20sent');logger[_0x46df('0x22')](_0x46df('0x23'),_0x2f9b09,_0x46df('0x24'),JSON[_0x46df('0x25')](_0x47046a));if(_0x47046a['error']){if(_0x47046a[_0x46df('0x26')][_0x46df('0x27')]===0x1f4){logger[_0x46df('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x2f9b09,_0x47046a[_0x46df('0x26')][_0x46df('0x28')]);return _0x177ea8(_0x47046a[_0x46df('0x26')][_0x46df('0x28')]);}logger[_0x46df('0x26')](_0x46df('0x29'),_0x2f9b09,_0x47046a[_0x46df('0x26')]['message']);return _0x4f1f2c(_0x47046a[_0x46df('0x26')]['message']);}else{logger[_0x46df('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x2f9b09,_0x46df('0x24'));_0x4f1f2c(_0x47046a[_0x46df('0x2a')][_0x46df('0x28')]);}})[_0x46df('0x2b')](function(_0x1947de){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x2f9b09,_0x1947de);_0x177ea8(_0x1947de);});});}function respondWithStatusCode(_0x4f576e,_0x5f3071){_0x5f3071=_0x5f3071||0xcc;return function(_0x1858f3){if(_0x1858f3){return _0x4f576e[_0x46df('0x2c')](_0x5f3071);}return _0x4f576e[_0x46df('0x2d')](_0x5f3071)[_0x46df('0x2e')]();};}function respondWithResult(_0x14d094,_0x2d6491){_0x2d6491=_0x2d6491||0xc8;return function(_0x1ae60d){if(_0x1ae60d){return _0x14d094[_0x46df('0x2d')](_0x2d6491)['json'](_0x1ae60d);}};}function respondWithFilteredResult(_0x1e09fd,_0x2113df){return function(_0x50b72d){if(_0x50b72d){var _0x1a6662=typeof _0x2113df[_0x46df('0x2f')]===_0x46df('0x30')&&typeof _0x2113df['limit']===_0x46df('0x30');var _0x55742d=_0x50b72d[_0x46df('0x31')];var _0x3feaaf=_0x1a6662?0x0:_0x2113df[_0x46df('0x2f')];var _0x5d5c69=_0x1a6662?_0x50b72d[_0x46df('0x31')]:_0x2113df[_0x46df('0x2f')]+_0x2113df['limit'];var _0x5e1653;if(_0x5d5c69>=_0x55742d){_0x5d5c69=_0x55742d;_0x5e1653=0xc8;}else{_0x5e1653=0xce;}_0x1e09fd['status'](_0x5e1653);return _0x1e09fd[_0x46df('0x32')](_0x46df('0x33'),_0x3feaaf+'-'+_0x5d5c69+'/'+_0x55742d)[_0x46df('0x34')](_0x50b72d);}return null;};}function patchUpdates(_0x5106fc){return function(_0x3741a4){try{jsonpatch[_0x46df('0x35')](_0x3741a4,_0x5106fc,!![]);}catch(_0x2b3b3b){return BPromise['reject'](_0x2b3b3b);}return _0x3741a4['save']();};}function saveUpdates(_0x39c6ab,_0x4d815d){return function(_0x4db861){if(_0x4db861){return _0x4db861[_0x46df('0x36')](_0x39c6ab)[_0x46df('0x20')](function(_0x353fed){return _0x353fed;});}return null;};}function removeEntity(_0x596fa7,_0x46599a){return function(_0x44a435){if(_0x44a435){return _0x44a435[_0x46df('0x37')]()['then'](function(){_0x596fa7['status'](0xcc)[_0x46df('0x2e')]();});}};}function handleEntityNotFound(_0x2f99b6,_0x531aa7){return function(_0x31ba1b){if(!_0x31ba1b){_0x2f99b6[_0x46df('0x2c')](0x194);}return _0x31ba1b;};}function handleError(_0x5bb2d8,_0x1b581a){_0x1b581a=_0x1b581a||0x1f4;return function(_0x1efa3d){logger['error'](_0x1efa3d[_0x46df('0x38')]);if(_0x1efa3d[_0x46df('0x39')]){delete _0x1efa3d[_0x46df('0x39')];}_0x5bb2d8[_0x46df('0x2d')](_0x1b581a)[_0x46df('0x3a')](_0x1efa3d);};}exports[_0x46df('0x3b')]=function(_0x47ff7c,_0xc1e456){var _0x306ba9={},_0x35bdc7={},_0x2d9677={'count':0x0,'rows':[]};var _0x211956=_[_0x46df('0x3c')](db['WhatsappMessage'][_0x46df('0x3d')],function(_0x19d646){return{'name':_0x19d646[_0x46df('0x3e')],'type':_0x19d646[_0x46df('0x3f')][_0x46df('0x40')]};});_0x35bdc7[_0x46df('0x41')]=_[_0x46df('0x3c')](_0x211956,_0x46df('0x39'));_0x35bdc7['query']=_[_0x46df('0x42')](_0x47ff7c[_0x46df('0x43')]);_0x35bdc7[_0x46df('0x44')]=_[_0x46df('0x45')](_0x35bdc7[_0x46df('0x41')],_0x35bdc7[_0x46df('0x43')]);_0x306ba9[_0x46df('0x46')]=_[_0x46df('0x45')](_0x35bdc7[_0x46df('0x41')],qs['fields'](_0x47ff7c[_0x46df('0x43')][_0x46df('0x47')]));_0x306ba9[_0x46df('0x46')]=_0x306ba9['attributes'][_0x46df('0x48')]?_0x306ba9[_0x46df('0x46')]:_0x35bdc7[_0x46df('0x41')];if(!_0x47ff7c[_0x46df('0x43')][_0x46df('0x49')](_0x46df('0x4a'))){_0x306ba9[_0x46df('0x4b')]=qs[_0x46df('0x4b')](_0x47ff7c[_0x46df('0x43')][_0x46df('0x4b')]);_0x306ba9['offset']=qs[_0x46df('0x2f')](_0x47ff7c[_0x46df('0x43')][_0x46df('0x2f')]);}_0x306ba9[_0x46df('0x4c')]=qs[_0x46df('0x4d')](_0x47ff7c['query'][_0x46df('0x4d')]);_0x306ba9[_0x46df('0x4e')]=qs[_0x46df('0x44')](_[_0x46df('0x4f')](_0x47ff7c[_0x46df('0x43')],_0x35bdc7[_0x46df('0x44')]),_0x211956);if(_0x47ff7c[_0x46df('0x43')]['filter']){_0x306ba9[_0x46df('0x4e')]=_[_0x46df('0x50')](_0x306ba9[_0x46df('0x4e')],{'$or':_[_0x46df('0x3c')](_0x211956,function(_0x2582bc){if(_0x2582bc['type']!==_0x46df('0x51')){var _0x18614e={};_0x18614e[_0x2582bc[_0x46df('0x39')]]={'$like':'%'+_0x47ff7c[_0x46df('0x43')]['filter']+'%'};return _0x18614e;}})});}_0x306ba9=_['merge']({},_0x306ba9,_0x47ff7c[_0x46df('0x52')]);var _0x2a3192={'where':_0x306ba9[_0x46df('0x4e')]};return db[_0x46df('0x53')][_0x46df('0x31')](_0x2a3192)['then'](function(_0x448db7){_0x2d9677[_0x46df('0x31')]=_0x448db7;if(_0x47ff7c[_0x46df('0x43')][_0x46df('0x54')]){_0x306ba9['include']=[{'all':!![]}];}return db[_0x46df('0x53')][_0x46df('0x55')](_0x306ba9);})['then'](function(_0x9659ad){_0x2d9677[_0x46df('0x56')]=_0x9659ad;return _0x2d9677;})['then'](respondWithFilteredResult(_0xc1e456,_0x306ba9))[_0x46df('0x2b')](handleError(_0xc1e456,null));};exports[_0x46df('0x57')]=function(_0x2fc3b3,_0x3f907a){var _0x53fcb3={'raw':!![],'where':{'id':_0x2fc3b3[_0x46df('0x58')]['id']}},_0x34cb58={};_0x34cb58[_0x46df('0x41')]=_[_0x46df('0x42')](db['WhatsappMessage'][_0x46df('0x3d')]);_0x34cb58[_0x46df('0x43')]=_['keys'](_0x2fc3b3[_0x46df('0x43')]);_0x34cb58[_0x46df('0x44')]=_['intersection'](_0x34cb58['model'],_0x34cb58[_0x46df('0x43')]);_0x53fcb3[_0x46df('0x46')]=_[_0x46df('0x45')](_0x34cb58[_0x46df('0x41')],qs[_0x46df('0x47')](_0x2fc3b3[_0x46df('0x43')][_0x46df('0x47')]));_0x53fcb3[_0x46df('0x46')]=_0x53fcb3[_0x46df('0x46')]['length']?_0x53fcb3['attributes']:_0x34cb58[_0x46df('0x41')];if(_0x2fc3b3['query'][_0x46df('0x54')]){_0x53fcb3[_0x46df('0x59')]=[{'all':!![]}];}_0x53fcb3=_['merge']({},_0x53fcb3,_0x2fc3b3[_0x46df('0x52')]);return db[_0x46df('0x53')][_0x46df('0x5a')](_0x53fcb3)[_0x46df('0x20')](handleEntityNotFound(_0x3f907a,null))[_0x46df('0x20')](respondWithResult(_0x3f907a,null))[_0x46df('0x2b')](handleError(_0x3f907a,null));};exports['create']=function(_0x334519,_0x3a7876){return db[_0x46df('0x53')][_0x46df('0x5b')](_0x334519[_0x46df('0x5c')],{})['then'](respondWithResult(_0x3a7876,0xc9))[_0x46df('0x2b')](handleError(_0x3a7876,null));};exports[_0x46df('0x36')]=function(_0x4059b7,_0x42f006){if(_0x4059b7[_0x46df('0x5c')]['id']){delete _0x4059b7[_0x46df('0x5c')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x4059b7['params']['id']}})[_0x46df('0x20')](handleEntityNotFound(_0x42f006,null))['then'](saveUpdates(_0x4059b7[_0x46df('0x5c')],null))[_0x46df('0x20')](respondWithResult(_0x42f006,null))['catch'](handleError(_0x42f006,null));};exports[_0x46df('0x37')]=function(_0x31cc4c,_0x1b6ca6){return db['WhatsappMessage'][_0x46df('0x5a')]({'where':{'id':_0x31cc4c[_0x46df('0x58')]['id']}})['then'](handleEntityNotFound(_0x1b6ca6,null))[_0x46df('0x20')](removeEntity(_0x1b6ca6,null))['catch'](handleError(_0x1b6ca6,null));};exports[_0x46df('0x5d')]=function(_0xe691ed,_0x435425){return db[_0x46df('0x53')][_0x46df('0x5d')]()['then'](respondWithResult(_0x435425,null))[_0x46df('0x2b')](handleError(_0x435425,null));};var interaction_log=require(_0x46df('0x5e'))('whatsapp-interactions');exports[_0x46df('0x5f')]=function(_0x12573e,_0x33ef7e,_0x5c3067){var _0x2d1c77={'agent':{},'channel':_0x46df('0x60')};if(_0x12573e[_0x46df('0x5c')]['id']){delete _0x12573e[_0x46df('0x5c')]['id'];}_0x12573e['body'][_0x46df('0x61')]=!![];_0x12573e['body'][_0x46df('0x62')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x12573e[_0x46df('0x5c')][_0x46df('0x63')]=_0x12573e[_0x46df('0x5c')][_0x46df('0x63')]||_0x12573e[_0x46df('0x64')]['id'];_0x2d1c77[_0x46df('0x65')]['id']=_0x12573e[_0x46df('0x5c')][_0x46df('0x63')];return db[_0x46df('0x53')][_0x46df('0x5a')]({'where':{'id':_0x12573e[_0x46df('0x58')]['id'],'UserId':null}})[_0x46df('0x20')](handleEntityNotFound(_0x33ef7e,null))[_0x46df('0x20')](saveUpdates(_0x12573e[_0x46df('0x5c')],null))[_0x46df('0x20')](function(_0x2aa767){if(_0x2aa767){_0x2d1c77[_0x46df('0x28')]=_0x2aa767[_0x46df('0x66')]({'plain':!![]});return db[_0x46df('0x67')][_0x46df('0x5a')]({'where':{'id':_0x2aa767[_0x46df('0x68')]}});}return null;})[_0x46df('0x20')](handleEntityNotFound(_0x33ef7e,null))[_0x46df('0x20')](function(_0x15bf44){if(_0x15bf44){return _0x15bf44[_0x46df('0x36')]({'UserId':_0x12573e[_0x46df('0x5c')][_0x46df('0x63')],'read1stAt':_[_0x46df('0x69')](_0x15bf44['read1stAt'])?moment()[_0x46df('0x6a')](_0x46df('0x6b')):undefined});}return null;})[_0x46df('0x20')](function(_0x19fc84){if(_0x19fc84){_0x2d1c77['interaction']=_0x19fc84[_0x46df('0x66')]({'plain':!![]});interaction_log[_0x46df('0x21')](_0x46df('0x6c'),_0x12573e[_0x46df('0x64')]['id'],_0x12573e[_0x46df('0x64')]['name'],_0x12573e[_0x46df('0x64')][_0x46df('0x6d')],_0x2d1c77[_0x46df('0x6e')]['id'],_0x12573e[_0x46df('0x5c')]?JSON[_0x46df('0x25')](_0x12573e[_0x46df('0x5c')]):_0x46df('0x6f'));return respondWithRpcPromise(_0x46df('0x70'),_0x46df('0x71'),_0x2d1c77);}return null;})[_0x46df('0x20')](function(_0x39a82c){var _0x473f4e=_0x46df('0x72')+_0x39a82c[_0x46df('0x28')][_0x46df('0x73')];return db[_0x46df('0x74')][_0x46df('0x43')](_0x473f4e,{'type':db[_0x46df('0x75')][_0x46df('0x76')][_0x46df('0x77')],'raw':!![]})[_0x46df('0x20')](function(_0x55aacc){return _0x55aacc;});})[_0x46df('0x20')](function(_0x54f9e0){if(_0x54f9e0){_0x2d1c77['message']['contact']=_0x54f9e0[0x0];if(!_0x12573e['body']['UserId'])return;return db[_0x46df('0x78')][_0x46df('0x5a')]({'where':{'id':_0x12573e['body'][_0x46df('0x63')],'role':_0x46df('0x65')},'attributes':['id',_0x46df('0x39'),_0x46df('0x79'),_0x46df('0x7a'),_0x46df('0x7b')],'raw':!![]});}return null;})[_0x46df('0x20')](function(_0x4d6006){if(!_0x4d6006)return null;_0x2d1c77[_0x46df('0x28')][_0x46df('0x65')]=_0x4d6006;return _0x2d1c77;})[_0x46df('0x20')](function(_0x3ff736){if(_0x3ff736){if(_0x12573e[_0x46df('0x5c')]['manual']){_0x2d1c77[_0x46df('0x28')][_0x46df('0x7c')]=util[_0x46df('0x6a')]('SIP/%s',_0x12573e[_0x46df('0x64')]['name']);_0x2d1c77['message']['channel']=_0x2d1c77['channel'];_0x2d1c77[_0x46df('0x28')][_0x46df('0x7d')]=_0x2d1c77[_0x46df('0x7e')];_0x2d1c77[_0x46df('0x28')][_0x46df('0x7f')]=_0x46df('0x5f');return respondWithRpcPromise(_0x46df('0x80'),'EventManager',{'event':_0x46df('0x81'),'message':_0x2d1c77[_0x46df('0x28')]},client9002)[_0x46df('0x20')](function(){return _0x2d1c77;});}return _0x2d1c77;}return null;})[_0x46df('0x20')](respondWithResult(_0x33ef7e,null))[_0x46df('0x2b')](handleError(_0x33ef7e,null));};var interaction_log=require(_0x46df('0x5e'))(_0x46df('0x82'));exports['reject']=function(_0x38916b,_0x5bf2ad,_0x288f32){var _0x558ab9={'agent':{},'channel':_0x46df('0x60')};if(_0x38916b[_0x46df('0x5c')]['id']){delete _0x38916b[_0x46df('0x5c')]['id'];}_0x38916b[_0x46df('0x5c')][_0x46df('0x63')]=_0x38916b['body']['UserId']||_0x38916b['user']['id'];_0x558ab9['agent']['id']=_0x38916b[_0x46df('0x5c')][_0x46df('0x63')];return db[_0x46df('0x53')][_0x46df('0x5a')]({'where':{'id':_0x38916b[_0x46df('0x58')]['id'],'UserId':null}})[_0x46df('0x20')](handleEntityNotFound(_0x5bf2ad,null))[_0x46df('0x20')](function(_0x297327){if(_0x297327){_0x558ab9['message']=_0x297327[_0x46df('0x66')]({'plain':!![]});return db[_0x46df('0x67')][_0x46df('0x5a')]({'where':{'id':_0x297327['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5bf2ad,null))['then'](function(_0x1cefa5){if(_0x1cefa5){_0x558ab9[_0x46df('0x6e')]=_0x1cefa5['get']({'plain':!![]});interaction_log[_0x46df('0x21')](_0x46df('0x83'),_0x38916b[_0x46df('0x64')]['id'],_0x38916b['user'][_0x46df('0x39')],_0x38916b['user'][_0x46df('0x6d')],_0x558ab9['interaction']['id'],_0x38916b[_0x46df('0x5c')]?JSON['stringify'](_0x38916b[_0x46df('0x5c')]):_0x46df('0x6f'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x558ab9);}return null;})[_0x46df('0x20')](function(_0x42b46c){var _0x111298='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x42b46c[_0x46df('0x28')]['ContactId'];return db['sequelize'][_0x46df('0x43')](_0x111298,{'type':db['Sequelize'][_0x46df('0x76')][_0x46df('0x77')],'raw':!![]})[_0x46df('0x20')](function(_0x4f81b5){return _0x4f81b5;});})['then'](function(_0x170062){if(_0x170062){_0x558ab9[_0x46df('0x28')][_0x46df('0x84')]=_0x170062[0x0];if(!_0x38916b[_0x46df('0x5c')][_0x46df('0x63')])return;return db[_0x46df('0x78')][_0x46df('0x5a')]({'where':{'id':_0x38916b[_0x46df('0x5c')][_0x46df('0x63')],'role':_0x46df('0x65')},'attributes':['id','name','fullname',_0x46df('0x7a'),_0x46df('0x7b')],'raw':!![]});}return null;})[_0x46df('0x20')](function(_0x468b91){if(!_0x468b91)return null;_0x558ab9[_0x46df('0x28')][_0x46df('0x65')]=_0x468b91;return _0x558ab9;})['then'](function(_0x291667){if(_0x291667){_0x291667[_0x46df('0x28')][_0x46df('0x7c')]=util[_0x46df('0x6a')](_0x46df('0x85'),_0x38916b[_0x46df('0x64')][_0x46df('0x39')]);_0x291667[_0x46df('0x28')]['channel']=_0x558ab9[_0x46df('0x7e')];_0x291667['message'][_0x46df('0x7d')]=_0x558ab9[_0x46df('0x7e')];_0x291667[_0x46df('0x28')][_0x46df('0x7f')]=_0x46df('0x86');respondWithRpcPromise(_0x46df('0x80'),'EventManager',{'event':_0x46df('0x87'),'message':_0x291667[_0x46df('0x28')]},client9002);return _0x558ab9;}return null;})[_0x46df('0x20')](respondWithResult(_0x5bf2ad,null))['catch'](handleError(_0x5bf2ad,null));};exports[_0x46df('0x2d')]=function(_0x5b4cee,_0x344a8e,_0x433346){if(_0x5b4cee[_0x46df('0x5c')]['id']){delete _0x5b4cee[_0x46df('0x5c')]['id'];}var _0x2fb368;return db[_0x46df('0x53')]['find']({'where':{'id':_0x5b4cee['params']['id']}})[_0x46df('0x20')](handleEntityNotFound(_0x344a8e,null))['then'](function(_0x55be48){if(_0x55be48){_0x2fb368=_0x55be48;return db[_0x46df('0x88')][_0x46df('0x5a')]({'where':{'id':_0x55be48['WhatsappAccountId']}});}})[_0x46df('0x20')](handleEntityNotFound(_0x344a8e,null))[_0x46df('0x20')](function(_0x2321da){if(_0x2321da){logger[_0x46df('0x22')](_0x46df('0x89'),_0x46df('0x2d'),_0x46df('0x8a'),_0x2321da['type'],util[_0x46df('0x8b')](_0x5b4cee[_0x46df('0x5c')],{'showHidden':![],'depth':null}));switch(_0x2321da[_0x46df('0x3f')]){case _0x46df('0x8c'):if(_0x5b4cee[_0x46df('0x5c')][_0x46df('0x8d')]&&_0x5b4cee[_0x46df('0x5c')][_0x46df('0x8d')]===_0x2fb368[_0x46df('0x8e')]&&_0x5b4cee['body'][_0x46df('0x8f')]&&_0x5b4cee[_0x46df('0x5c')][_0x46df('0x8f')]===_0x46df('0x61')){return _0x2fb368[_0x46df('0x36')]({'read':!![]});}else{logger[_0x46df('0x26')](_0x46df('0x90'),_0x46df('0x2d'),_0x46df('0x8c'),util[_0x46df('0x8b')](_0x5b4cee[_0x46df('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x2fb368;}})[_0x46df('0x20')](respondWithResult(_0x344a8e,null))[_0x46df('0x2b')](handleError(_0x344a8e,null));}; \ No newline at end of file +var _0x2829=['lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','params','keys','find','create','body','describe','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','email','internal','agent','manual','channel','motionChannel','event','accept','EventManager','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','User','fullname','interface','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','MessageStatus','twilio','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra'];(function(_0x9ee7de,_0x57dcd0){var _0x5a2ee1=function(_0xe50dda){while(--_0xe50dda){_0x9ee7de['push'](_0x9ee7de['shift']());}};_0x5a2ee1(++_0x57dcd0);}(_0x2829,0xfc));var _0x9282=function(_0x52ef94,_0xd169ea){_0x52ef94=_0x52ef94-0x0;var _0x501a71=_0x2829[_0x52ef94];return _0x501a71;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9282('0x0'));var jsonpatch=require(_0x9282('0x1'));var rp=require(_0x9282('0x2'));var moment=require('moment');var BPromise=require(_0x9282('0x3'));var Mustache=require(_0x9282('0x4'));var util=require(_0x9282('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9282('0x6'));var fs=require('fs');var fs_extra=require(_0x9282('0x7'));var _=require(_0x9282('0x8'));var squel=require(_0x9282('0x9'));var crypto=require('crypto');var jsforce=require(_0x9282('0xa'));var deskjs=require(_0x9282('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9282('0xc'));var Papa=require(_0x9282('0xd'));var Redis=require('ioredis');var authService=require(_0x9282('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9282('0xf'))(_0x9282('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9282('0x11'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x9282('0x12')],{'host':_0x9282('0x13'),'port':0x18eb});var socket=require(_0x9282('0x14'))(new Redis(config[_0x9282('0x12')]));require(_0x9282('0x15'))['register'](socket);var jayson=require(_0x9282('0x16'));var client=jayson[_0x9282('0x17')][_0x9282('0x18')]({'port':0x232c});var client9002=jayson[_0x9282('0x17')][_0x9282('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x46ff45,_0x404457,_0x2ed29c,_0x2d649a){return new BPromise(function(_0xf3eaf1,_0x418081){var _0x301627=_0x2d649a||client;return _0x301627[_0x9282('0x19')](_0x46ff45,_0x2ed29c)[_0x9282('0x1a')](function(_0x530e80){logger['info'](_0x9282('0x1b'),_0x404457,'request\x20sent');logger[_0x9282('0x1c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x404457,_0x9282('0x1d'),JSON[_0x9282('0x1e')](_0x530e80));if(_0x530e80[_0x9282('0x1f')]){if(_0x530e80['error']['code']===0x1f4){logger['error'](_0x9282('0x1b'),_0x404457,_0x530e80[_0x9282('0x1f')][_0x9282('0x20')]);return _0x418081(_0x530e80['error'][_0x9282('0x20')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x404457,_0x530e80[_0x9282('0x1f')]['message']);return _0xf3eaf1(_0x530e80[_0x9282('0x1f')][_0x9282('0x20')]);}else{logger['info'](_0x9282('0x1b'),_0x404457,_0x9282('0x1d'));_0xf3eaf1(_0x530e80[_0x9282('0x21')][_0x9282('0x20')]);}})[_0x9282('0x22')](function(_0x183ee9){logger[_0x9282('0x1f')]('WhatsappMessage,\x20%s,\x20%s',_0x404457,_0x183ee9);_0x418081(_0x183ee9);});});}function respondWithStatusCode(_0xa9ed2b,_0x1828fd){_0x1828fd=_0x1828fd||0xcc;return function(_0x4cec58){if(_0x4cec58){return _0xa9ed2b['sendStatus'](_0x1828fd);}return _0xa9ed2b[_0x9282('0x23')](_0x1828fd)[_0x9282('0x24')]();};}function respondWithResult(_0x385f49,_0x5109b1){_0x5109b1=_0x5109b1||0xc8;return function(_0x31dbed){if(_0x31dbed){return _0x385f49[_0x9282('0x23')](_0x5109b1)[_0x9282('0x25')](_0x31dbed);}};}function respondWithFilteredResult(_0x2c9880,_0x21f8a8){return function(_0x3a59cf){if(_0x3a59cf){var _0x4a26a5=typeof _0x21f8a8['offset']==='undefined'&&typeof _0x21f8a8[_0x9282('0x26')]===_0x9282('0x27');var _0x2a8c94=_0x3a59cf[_0x9282('0x28')];var _0x250d44=_0x4a26a5?0x0:_0x21f8a8[_0x9282('0x29')];var _0x217977=_0x4a26a5?_0x3a59cf[_0x9282('0x28')]:_0x21f8a8['offset']+_0x21f8a8['limit'];var _0x3cc676;if(_0x217977>=_0x2a8c94){_0x217977=_0x2a8c94;_0x3cc676=0xc8;}else{_0x3cc676=0xce;}_0x2c9880[_0x9282('0x23')](_0x3cc676);return _0x2c9880[_0x9282('0x2a')]('Content-Range',_0x250d44+'-'+_0x217977+'/'+_0x2a8c94)['json'](_0x3a59cf);}return null;};}function patchUpdates(_0x3f1d4c){return function(_0x230c16){try{jsonpatch[_0x9282('0x2b')](_0x230c16,_0x3f1d4c,!![]);}catch(_0x501ba9){return BPromise[_0x9282('0x2c')](_0x501ba9);}return _0x230c16[_0x9282('0x2d')]();};}function saveUpdates(_0x35308b,_0x1d2c74){return function(_0x5f57f4){if(_0x5f57f4){return _0x5f57f4[_0x9282('0x2e')](_0x35308b)[_0x9282('0x1a')](function(_0x388b17){return _0x388b17;});}return null;};}function removeEntity(_0x3dc6a1,_0x231d97){return function(_0x3907d5){if(_0x3907d5){return _0x3907d5[_0x9282('0x2f')]()[_0x9282('0x1a')](function(){_0x3dc6a1[_0x9282('0x23')](0xcc)[_0x9282('0x24')]();});}};}function handleEntityNotFound(_0x1025e2,_0x27a5df){return function(_0xd5582a){if(!_0xd5582a){_0x1025e2[_0x9282('0x30')](0x194);}return _0xd5582a;};}function handleError(_0x2c91b8,_0x52605f){_0x52605f=_0x52605f||0x1f4;return function(_0x542f87){logger[_0x9282('0x1f')](_0x542f87[_0x9282('0x31')]);if(_0x542f87[_0x9282('0x32')]){delete _0x542f87[_0x9282('0x32')];}_0x2c91b8[_0x9282('0x23')](_0x52605f)[_0x9282('0x33')](_0x542f87);};}exports['index']=function(_0x3180e5,_0x247e8c){var _0xb0735a={},_0x109366={},_0xec1403={'count':0x0,'rows':[]};var _0x19ff49=_[_0x9282('0x34')](db[_0x9282('0x35')][_0x9282('0x36')],function(_0x5ec237){return{'name':_0x5ec237[_0x9282('0x37')],'type':_0x5ec237[_0x9282('0x38')]['key']};});_0x109366['model']=_[_0x9282('0x34')](_0x19ff49,'name');_0x109366[_0x9282('0x39')]=_['keys'](_0x3180e5[_0x9282('0x39')]);_0x109366[_0x9282('0x3a')]=_[_0x9282('0x3b')](_0x109366[_0x9282('0x3c')],_0x109366[_0x9282('0x39')]);_0xb0735a[_0x9282('0x3d')]=_[_0x9282('0x3b')](_0x109366[_0x9282('0x3c')],qs[_0x9282('0x3e')](_0x3180e5[_0x9282('0x39')][_0x9282('0x3e')]));_0xb0735a[_0x9282('0x3d')]=_0xb0735a[_0x9282('0x3d')][_0x9282('0x3f')]?_0xb0735a['attributes']:_0x109366[_0x9282('0x3c')];if(!_0x3180e5[_0x9282('0x39')]['hasOwnProperty'](_0x9282('0x40'))){_0xb0735a[_0x9282('0x26')]=qs[_0x9282('0x26')](_0x3180e5[_0x9282('0x39')][_0x9282('0x26')]);_0xb0735a[_0x9282('0x29')]=qs[_0x9282('0x29')](_0x3180e5[_0x9282('0x39')][_0x9282('0x29')]);}_0xb0735a[_0x9282('0x41')]=qs[_0x9282('0x42')](_0x3180e5['query'][_0x9282('0x42')]);_0xb0735a[_0x9282('0x43')]=qs[_0x9282('0x3a')](_['pick'](_0x3180e5[_0x9282('0x39')],_0x109366[_0x9282('0x3a')]),_0x19ff49);if(_0x3180e5['query'][_0x9282('0x44')]){_0xb0735a[_0x9282('0x43')]=_[_0x9282('0x45')](_0xb0735a[_0x9282('0x43')],{'$or':_[_0x9282('0x34')](_0x19ff49,function(_0x3af4dd){if(_0x3af4dd[_0x9282('0x38')]!==_0x9282('0x46')){var _0x1b94a8={};_0x1b94a8[_0x3af4dd[_0x9282('0x32')]]={'$like':'%'+_0x3180e5[_0x9282('0x39')]['filter']+'%'};return _0x1b94a8;}})});}_0xb0735a=_[_0x9282('0x45')]({},_0xb0735a,_0x3180e5['options']);var _0x5241cb={'where':_0xb0735a[_0x9282('0x43')]};return db[_0x9282('0x35')]['count'](_0x5241cb)[_0x9282('0x1a')](function(_0x3db585){_0xec1403[_0x9282('0x28')]=_0x3db585;if(_0x3180e5[_0x9282('0x39')][_0x9282('0x47')]){_0xb0735a[_0x9282('0x48')]=[{'all':!![]}];}return db[_0x9282('0x35')]['findAll'](_0xb0735a);})[_0x9282('0x1a')](function(_0xa40691){_0xec1403[_0x9282('0x49')]=_0xa40691;return _0xec1403;})[_0x9282('0x1a')](respondWithFilteredResult(_0x247e8c,_0xb0735a))[_0x9282('0x22')](handleError(_0x247e8c,null));};exports['show']=function(_0x426cbd,_0x366e10){var _0x64e613={'raw':!![],'where':{'id':_0x426cbd[_0x9282('0x4a')]['id']}},_0xb135a={};_0xb135a[_0x9282('0x3c')]=_[_0x9282('0x4b')](db['WhatsappMessage']['rawAttributes']);_0xb135a[_0x9282('0x39')]=_['keys'](_0x426cbd[_0x9282('0x39')]);_0xb135a[_0x9282('0x3a')]=_[_0x9282('0x3b')](_0xb135a[_0x9282('0x3c')],_0xb135a[_0x9282('0x39')]);_0x64e613[_0x9282('0x3d')]=_[_0x9282('0x3b')](_0xb135a[_0x9282('0x3c')],qs[_0x9282('0x3e')](_0x426cbd['query'][_0x9282('0x3e')]));_0x64e613[_0x9282('0x3d')]=_0x64e613[_0x9282('0x3d')][_0x9282('0x3f')]?_0x64e613[_0x9282('0x3d')]:_0xb135a['model'];if(_0x426cbd[_0x9282('0x39')]['includeAll']){_0x64e613['include']=[{'all':!![]}];}_0x64e613=_[_0x9282('0x45')]({},_0x64e613,_0x426cbd['options']);return db['WhatsappMessage'][_0x9282('0x4c')](_0x64e613)[_0x9282('0x1a')](handleEntityNotFound(_0x366e10,null))[_0x9282('0x1a')](respondWithResult(_0x366e10,null))[_0x9282('0x22')](handleError(_0x366e10,null));};exports[_0x9282('0x4d')]=function(_0x33afc0,_0x2ea605){return db['WhatsappMessage'][_0x9282('0x4d')](_0x33afc0[_0x9282('0x4e')],{})[_0x9282('0x1a')](respondWithResult(_0x2ea605,0xc9))[_0x9282('0x22')](handleError(_0x2ea605,null));};exports[_0x9282('0x2e')]=function(_0x12da0e,_0x4a2ca6){if(_0x12da0e['body']['id']){delete _0x12da0e['body']['id'];}return db[_0x9282('0x35')]['find']({'where':{'id':_0x12da0e['params']['id']}})[_0x9282('0x1a')](handleEntityNotFound(_0x4a2ca6,null))['then'](saveUpdates(_0x12da0e[_0x9282('0x4e')],null))['then'](respondWithResult(_0x4a2ca6,null))[_0x9282('0x22')](handleError(_0x4a2ca6,null));};exports[_0x9282('0x2f')]=function(_0x432092,_0x33a5ef){return db['WhatsappMessage'][_0x9282('0x4c')]({'where':{'id':_0x432092[_0x9282('0x4a')]['id']}})[_0x9282('0x1a')](handleEntityNotFound(_0x33a5ef,null))[_0x9282('0x1a')](removeEntity(_0x33a5ef,null))[_0x9282('0x22')](handleError(_0x33a5ef,null));};exports[_0x9282('0x4f')]=function(_0x5f2843,_0x1212e0){return db[_0x9282('0x35')]['describe']()[_0x9282('0x1a')](respondWithResult(_0x1212e0,null))[_0x9282('0x22')](handleError(_0x1212e0,null));};var interaction_log=require(_0x9282('0xf'))('whatsapp-interactions');exports['accept']=function(_0x37a8c1,_0x2e3653,_0x2c613c){var _0x1c6437={'agent':{},'channel':_0x9282('0x50')};if(_0x37a8c1[_0x9282('0x4e')]['id']){delete _0x37a8c1[_0x9282('0x4e')]['id'];}_0x37a8c1[_0x9282('0x4e')][_0x9282('0x51')]=!![];_0x37a8c1[_0x9282('0x4e')][_0x9282('0x52')]=moment()[_0x9282('0x53')](_0x9282('0x54'));_0x37a8c1[_0x9282('0x4e')][_0x9282('0x55')]=_0x37a8c1[_0x9282('0x4e')][_0x9282('0x55')]||_0x37a8c1['user']['id'];_0x1c6437['agent']['id']=_0x37a8c1[_0x9282('0x4e')][_0x9282('0x55')];return db[_0x9282('0x35')]['find']({'where':{'id':_0x37a8c1[_0x9282('0x4a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2e3653,null))[_0x9282('0x1a')](saveUpdates(_0x37a8c1[_0x9282('0x4e')],null))[_0x9282('0x1a')](function(_0x4eb13c){if(_0x4eb13c){_0x1c6437[_0x9282('0x20')]=_0x4eb13c[_0x9282('0x56')]({'plain':!![]});return db[_0x9282('0x57')][_0x9282('0x4c')]({'where':{'id':_0x4eb13c[_0x9282('0x58')]}});}return null;})[_0x9282('0x1a')](handleEntityNotFound(_0x2e3653,null))[_0x9282('0x1a')](function(_0x50467b){if(_0x50467b){return _0x50467b[_0x9282('0x2e')]({'UserId':_0x37a8c1['body'][_0x9282('0x55')],'read1stAt':_[_0x9282('0x59')](_0x50467b[_0x9282('0x5a')])?moment()[_0x9282('0x53')](_0x9282('0x54')):undefined});}return null;})[_0x9282('0x1a')](function(_0x3a5c87){if(_0x3a5c87){_0x1c6437[_0x9282('0x5b')]=_0x3a5c87[_0x9282('0x56')]({'plain':!![]});interaction_log[_0x9282('0x5c')](_0x9282('0x5d'),_0x37a8c1['user']['id'],_0x37a8c1[_0x9282('0x5e')][_0x9282('0x32')],_0x37a8c1[_0x9282('0x5e')][_0x9282('0x5f')],_0x1c6437[_0x9282('0x5b')]['id'],_0x37a8c1['body']?JSON[_0x9282('0x1e')](_0x37a8c1[_0x9282('0x4e')]):_0x9282('0x60'));return respondWithRpcPromise(_0x9282('0x61'),_0x9282('0x62'),_0x1c6437);}return null;})['then'](function(_0x4d9ad9){var _0x65a5=_0x9282('0x63')+_0x4d9ad9[_0x9282('0x20')][_0x9282('0x64')];return db[_0x9282('0x65')]['query'](_0x65a5,{'type':db[_0x9282('0x66')]['QueryTypes'][_0x9282('0x67')],'raw':!![]})[_0x9282('0x1a')](function(_0x27b3b6){return _0x27b3b6;});})['then'](function(_0x512c74){if(_0x512c74){_0x1c6437['message'][_0x9282('0x68')]=_0x512c74[0x0];if(!_0x37a8c1[_0x9282('0x4e')][_0x9282('0x55')])return;return db['User'][_0x9282('0x4c')]({'where':{'id':_0x37a8c1['body'][_0x9282('0x55')],'role':'agent'},'attributes':['id',_0x9282('0x32'),'fullname',_0x9282('0x69'),_0x9282('0x6a')],'raw':!![]});}return null;})[_0x9282('0x1a')](function(_0x1aac8b){if(!_0x1aac8b)return null;_0x1c6437[_0x9282('0x20')][_0x9282('0x6b')]=_0x1aac8b;return _0x1c6437;})[_0x9282('0x1a')](function(_0x530843){if(_0x530843){if(_0x37a8c1['body'][_0x9282('0x6c')]){_0x1c6437[_0x9282('0x20')]['interface']=util[_0x9282('0x53')]('SIP/%s',_0x37a8c1[_0x9282('0x5e')][_0x9282('0x32')]);_0x1c6437[_0x9282('0x20')][_0x9282('0x6d')]=_0x1c6437[_0x9282('0x6d')];_0x1c6437[_0x9282('0x20')][_0x9282('0x6e')]=_0x1c6437[_0x9282('0x6d')];_0x1c6437['message'][_0x9282('0x6f')]=_0x9282('0x70');return respondWithRpcPromise(_0x9282('0x71'),'EventManager',{'event':_0x9282('0x72'),'message':_0x1c6437[_0x9282('0x20')]},client9002)[_0x9282('0x1a')](function(){return _0x1c6437;});}return _0x1c6437;}return null;})['then'](respondWithResult(_0x2e3653,null))['catch'](handleError(_0x2e3653,null));};var interaction_log=require('../../config/logger')(_0x9282('0x73'));exports['reject']=function(_0x370869,_0xe4a5b7,_0x3afa41){var _0x85dbd2={'agent':{},'channel':'whatsapp'};if(_0x370869['body']['id']){delete _0x370869[_0x9282('0x4e')]['id'];}_0x370869[_0x9282('0x4e')][_0x9282('0x55')]=_0x370869[_0x9282('0x4e')][_0x9282('0x55')]||_0x370869['user']['id'];_0x85dbd2['agent']['id']=_0x370869[_0x9282('0x4e')][_0x9282('0x55')];return db[_0x9282('0x35')][_0x9282('0x4c')]({'where':{'id':_0x370869[_0x9282('0x4a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xe4a5b7,null))[_0x9282('0x1a')](function(_0x15150a){if(_0x15150a){_0x85dbd2[_0x9282('0x20')]=_0x15150a[_0x9282('0x56')]({'plain':!![]});return db[_0x9282('0x57')]['find']({'where':{'id':_0x15150a[_0x9282('0x58')]}});}return null;})['then'](handleEntityNotFound(_0xe4a5b7,null))[_0x9282('0x1a')](function(_0xd0a180){if(_0xd0a180){_0x85dbd2['interaction']=_0xd0a180[_0x9282('0x56')]({'plain':!![]});interaction_log[_0x9282('0x5c')](_0x9282('0x74'),_0x370869['user']['id'],_0x370869[_0x9282('0x5e')][_0x9282('0x32')],_0x370869[_0x9282('0x5e')][_0x9282('0x5f')],_0x85dbd2[_0x9282('0x5b')]['id'],_0x370869[_0x9282('0x4e')]?JSON[_0x9282('0x1e')](_0x370869[_0x9282('0x4e')]):_0x9282('0x60'));return respondWithRpcPromise(_0x9282('0x75'),_0x9282('0x76'),_0x85dbd2);}return null;})[_0x9282('0x1a')](function(_0xb48ed6){var _0xd584ee=_0x9282('0x63')+_0xb48ed6[_0x9282('0x20')][_0x9282('0x64')];return db[_0x9282('0x65')][_0x9282('0x39')](_0xd584ee,{'type':db[_0x9282('0x66')][_0x9282('0x77')][_0x9282('0x67')],'raw':!![]})[_0x9282('0x1a')](function(_0x2661fe){return _0x2661fe;});})[_0x9282('0x1a')](function(_0x5080d0){if(_0x5080d0){_0x85dbd2['message']['contact']=_0x5080d0[0x0];if(!_0x370869[_0x9282('0x4e')][_0x9282('0x55')])return;return db[_0x9282('0x78')]['find']({'where':{'id':_0x370869[_0x9282('0x4e')][_0x9282('0x55')],'role':_0x9282('0x6b')},'attributes':['id',_0x9282('0x32'),_0x9282('0x79'),'email',_0x9282('0x6a')],'raw':!![]});}return null;})[_0x9282('0x1a')](function(_0x341515){if(!_0x341515)return null;_0x85dbd2[_0x9282('0x20')][_0x9282('0x6b')]=_0x341515;return _0x85dbd2;})[_0x9282('0x1a')](function(_0x25ccb4){if(_0x25ccb4){_0x25ccb4[_0x9282('0x20')][_0x9282('0x7a')]=util['format']('SIP/%s',_0x370869[_0x9282('0x5e')][_0x9282('0x32')]);_0x25ccb4[_0x9282('0x20')][_0x9282('0x6d')]=_0x85dbd2[_0x9282('0x6d')];_0x25ccb4[_0x9282('0x20')][_0x9282('0x6e')]=_0x85dbd2[_0x9282('0x6d')];_0x25ccb4[_0x9282('0x20')][_0x9282('0x6f')]=_0x9282('0x2c');respondWithRpcPromise(_0x9282('0x71'),'EventManager',{'event':'rejectmessage','message':_0x25ccb4['message']},client9002);return _0x85dbd2;}return null;})[_0x9282('0x1a')](respondWithResult(_0xe4a5b7,null))[_0x9282('0x22')](handleError(_0xe4a5b7,null));};exports['status']=function(_0xcf0afb,_0x5677fe,_0xd12af2){if(_0xcf0afb['body']['id']){delete _0xcf0afb['body']['id'];}var _0x3a9c28;return db[_0x9282('0x35')][_0x9282('0x4c')]({'where':{'id':_0xcf0afb[_0x9282('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5677fe,null))[_0x9282('0x1a')](function(_0x489749){if(_0x489749){_0x3a9c28=_0x489749;return db[_0x9282('0x7b')][_0x9282('0x4c')]({'where':{'id':_0x489749[_0x9282('0x7c')]}});}})[_0x9282('0x1a')](handleEntityNotFound(_0x5677fe,null))[_0x9282('0x1a')](function(_0x4617c8){if(_0x4617c8){logger['debug'](_0x9282('0x7d'),_0x9282('0x23'),'received\x20delivery\x20report\x20from',_0x4617c8[_0x9282('0x38')],util[_0x9282('0x7e')](_0xcf0afb[_0x9282('0x4e')],{'showHidden':![],'depth':null}));switch(_0x4617c8[_0x9282('0x38')]){case'twilio':if(_0xcf0afb[_0x9282('0x4e')][_0x9282('0x7f')]&&_0xcf0afb[_0x9282('0x4e')][_0x9282('0x7f')]===_0x3a9c28['messageId']&&_0xcf0afb[_0x9282('0x4e')][_0x9282('0x80')]&&_0xcf0afb[_0x9282('0x4e')][_0x9282('0x80')]===_0x9282('0x51')){return _0x3a9c28['update']({'read':!![]});}else{logger[_0x9282('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x9282('0x23'),_0x9282('0x81'),util[_0x9282('0x7e')](_0xcf0afb[_0x9282('0x4e')],{'showHidden':![],'depth':null}));}break;}return _0x3a9c28;}})[_0x9282('0x1a')](respondWithResult(_0x5677fe,null))['catch'](handleError(_0x5677fe,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index b5da571..303500c 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 _0x3c81=['hook','exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x11dbbe,_0x7b04d3){var _0x475061=function(_0x3677d3){while(--_0x3677d3){_0x11dbbe['push'](_0x11dbbe['shift']());}};_0x475061(++_0x7b04d3);}(_0x3c81,0x102));var _0x13c8=function(_0x1c1f1d,_0x5833cf){_0x1c1f1d=_0x1c1f1d-0x0;var _0x4bd6e2=_0x3c81[_0x1c1f1d];return _0x4bd6e2;};'use strict';var EventEmitter=require(_0x13c8('0x0'));var WhatsappMessage=require(_0x13c8('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x13c8('0x2')](0x0);var events={'afterCreate':_0x13c8('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c3ba4){return function(_0x548599,_0x101d4f,_0x3ec886){WhatsappMessageEvents[_0x13c8('0x4')](_0x5c3ba4+':'+_0x548599['id'],_0x548599);WhatsappMessageEvents[_0x13c8('0x4')](_0x5c3ba4,_0x548599);_0x3ec886(null);};}for(var e in events){if(events[_0x13c8('0x5')](e)){var event=events[e];WhatsappMessage[_0x13c8('0x6')](e,emitEvent(event));}}module[_0x13c8('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0xa571=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa571,0x107));var _0x1a57=function(_0x271c34,_0x266fa2){_0x271c34=_0x271c34-0x0;var _0x3d60d1=_0xa571[_0x271c34];return _0x3d60d1;};'use strict';var EventEmitter=require(_0x1a57('0x0'));var WhatsappMessage=require(_0x1a57('0x1'))['db'][_0x1a57('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x1a57('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1a57('0x4'),'afterDestroy':_0x1a57('0x5')};function emitEvent(_0x4d5f7a){return function(_0x5ec815,_0x1f2c44,_0x5067fa){WhatsappMessageEvents[_0x1a57('0x6')](_0x4d5f7a+':'+_0x5ec815['id'],_0x5ec815);WhatsappMessageEvents[_0x1a57('0x6')](_0x4d5f7a,_0x5ec815);_0x5067fa(null);};}for(var e in events){if(events[_0x1a57('0x7')](e)){var event=events[e];WhatsappMessage[_0x1a57('0x8')](e,emitEvent(event));}}module[_0x1a57('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 3c1fd54..328babf 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 _0x58d1=['FULLTEXT','models','get','direction','toLowerCase','out','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','secret','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','authToken','phone','accountSid','messages','create','body','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','message_id','statuses','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x58d1,0x15f));var _0x158d=function(_0x2db025,_0x1cf6de){_0x2db025=_0x2db025-0x0;var _0x47afbe=_0x58d1[_0x2db025];return _0x47afbe;};'use strict';var _=require('lodash');var util=require(_0x158d('0x0'));var logger=require(_0x158d('0x1'))(_0x158d('0x2'));var moment=require(_0x158d('0x3'));var BPromise=require(_0x158d('0x4'));var rp=require('request-promise');var fetch=require(_0x158d('0x5'));var fs=require('fs');var path=require(_0x158d('0x6'));var rimraf=require(_0x158d('0x7'));var config=require(_0x158d('0x8'));var attributes=require(_0x158d('0x9'));module[_0x158d('0xa')]=function(_0x22be8a,_0x3e614e){return _0x22be8a[_0x158d('0xb')]('WhatsappMessage',attributes,{'tableName':_0x158d('0xc'),'paranoid':![],'indexes':[{'name':_0x158d('0xd'),'fields':[_0x158d('0xd')]},{'name':_0x158d('0xe'),'fields':['body'],'type':_0x158d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x175359,_0x12eaf2,_0x5f04ae){var _0x4844c3=_0x22be8a[_0x158d('0x10')];var _0x2cc79e=_0x175359[_0x158d('0x11')]({'plain':!![]});if(_0x2cc79e[_0x158d('0x12')][_0x158d('0x13')]()==='in'||_0x2cc79e[_0x158d('0x12')]['toLowerCase']()===_0x158d('0x14')&&!_0x2cc79e['secret']&&!_[_0x158d('0x15')](_0x2cc79e['UserId'])){_0x4844c3[_0x158d('0x16')][_0x158d('0x17')]({'where':{'id':_0x2cc79e[_0x158d('0x18')]}})['then'](function(_0x56efc2){if(_0x56efc2){_0x56efc2[_0x158d('0x19')]({'lastMsgAt':_0x2cc79e[_0x158d('0x1a')],'lastMsgDirection':_0x2cc79e[_0x158d('0x12')][_0x158d('0x13')]()});}})['catch'](function(_0x5291e8){console['error'](_0x5291e8);});}if(_0x2cc79e[_0x158d('0x12')]==='out'&&!_0x2cc79e[_0x158d('0x1b')]){var _0x4bb720;_0x4844c3[_0x158d('0x1c')][_0x158d('0x1d')]({'where':{'id':_0x2cc79e[_0x158d('0x1e')]},'raw':!![]})[_0x158d('0x1f')](function(_0x4d3126){_0x4bb720=_0x4d3126;if(_0x4bb720&&_0x4bb720[_0x158d('0x20')]){switch(_0x4bb720['type']){case _0x158d('0x21'):var _0x3f32a5=require(_0x158d('0x21'));if(_0x4bb720['accountSid']&&_0x4bb720[_0x158d('0x22')]&&_0x4bb720[_0x158d('0x23')]){var _0x180e25=new _0x3f32a5(_0x4bb720[_0x158d('0x24')],_0x4bb720[_0x158d('0x22')]);_0x180e25[_0x158d('0x25')][_0x158d('0x26')]({'body':_0x2cc79e[_0x158d('0x27')],'to':'whatsapp:'+_0x2cc79e[_0x158d('0x23')],'from':'whatsapp:'+_0x4bb720['phone'],'statusCallback':_0x4bb720['remote']+'/api/whatsapp/messages/'+_0x2cc79e['id']+_0x158d('0x28')+_0x4bb720[_0x158d('0x29')]})[_0x158d('0x1f')](function(_0x519412){if(_0x519412['sid']){return _0x175359[_0x158d('0x19')]({'messageId':_0x519412[_0x158d('0x2a')]});}})[_0x158d('0x2b')](function(_0xe0944f){logger['error'](_0x158d('0x2c'),_0x158d('0x2d'),'twilio',util[_0x158d('0x2e')](_0xe0944f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x158d('0x2c'),_0x158d('0x2d'),'twilio',_0x158d('0x2f'));}break;case _0x158d('0x30'):var _0x3ef3b3=_0x4bb720[_0x158d('0x24')];var _0x297e8b=_0x4bb720['authToken'];var _0xe7693=_0x4bb720[_0x158d('0x31')]+_0x158d('0x32')+_0x3ef3b3+'/messages/';var _0x47e86d={'to':[_0x2cc79e['phone']],'message':{'type':_0x158d('0x33'),'text':_0x2cc79e[_0x158d('0x27')]}};var _0x20676f={'method':_0x158d('0x34'),'uri':_0xe7693,'headers':{'Authorization':_0x158d('0x35')+_0x297e8b,'Content-Type':_0x158d('0x36')},'body':_0x47e86d,'json':!![]};rp(_0x20676f)['then'](function(_0x1bdbc0){if(_0x1bdbc0['statuses'][0x0][_0x158d('0x37')]){return _0x175359[_0x158d('0x19')]({'messageId':_0x1bdbc0[_0x158d('0x38')][0x0][_0x158d('0x37')]});}})[_0x158d('0x2b')](function(_0x20366c){logger[_0x158d('0x39')](_0x158d('0x3a'),_0x20366c);});break;}}})['finally'](function(){_0x5f04ae();});}else{_0x5f04ae();}}},'charset':_0x158d('0x3b'),'collate':_0x158d('0x3c')});}; \ No newline at end of file +var _0x4131=['direction','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','phone','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','update','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','text','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then'];(function(_0x596ef4,_0x2432d6){var _0x5046a5=function(_0xc6a49b){while(--_0xc6a49b){_0x596ef4['push'](_0x596ef4['shift']());}};_0x5046a5(++_0x2432d6);}(_0x4131,0x17b));var _0x1413=function(_0x24431a,_0x52459a){_0x24431a=_0x24431a-0x0;var _0x454ec7=_0x4131[_0x24431a];return _0x454ec7;};'use strict';var _=require('lodash');var util=require(_0x1413('0x0'));var logger=require(_0x1413('0x1'))(_0x1413('0x2'));var moment=require(_0x1413('0x3'));var BPromise=require(_0x1413('0x4'));var rp=require(_0x1413('0x5'));var fetch=require(_0x1413('0x6'));var fs=require('fs');var path=require(_0x1413('0x7'));var rimraf=require(_0x1413('0x8'));var config=require(_0x1413('0x9'));var attributes=require(_0x1413('0xa'));module[_0x1413('0xb')]=function(_0x39c24d,_0x3ea37f){return _0x39c24d[_0x1413('0xc')](_0x1413('0xd'),attributes,{'tableName':_0x1413('0xe'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x1413('0xf')]},{'name':_0x1413('0x10'),'fields':[_0x1413('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1af9a9,_0x4195e1,_0x108696){var _0x5b4858=_0x39c24d[_0x1413('0x12')];var _0xe7fd8e=_0x1af9a9['get']({'plain':!![]});if(_0xe7fd8e['direction'][_0x1413('0x13')]()==='in'||_0xe7fd8e['direction'][_0x1413('0x13')]()===_0x1413('0x14')&&!_0xe7fd8e[_0x1413('0x15')]&&!_['isNil'](_0xe7fd8e[_0x1413('0x16')])){_0x5b4858[_0x1413('0x17')][_0x1413('0x18')]({'where':{'id':_0xe7fd8e[_0x1413('0x19')]}})[_0x1413('0x1a')](function(_0x2ed212){if(_0x2ed212){_0x2ed212['update']({'lastMsgAt':_0xe7fd8e['createdAt'],'lastMsgDirection':_0xe7fd8e[_0x1413('0x1b')][_0x1413('0x13')]()});}})[_0x1413('0x1c')](function(_0x2af8b5){console[_0x1413('0x1d')](_0x2af8b5);});}if(_0xe7fd8e['direction']==='out'&&!_0xe7fd8e[_0x1413('0x15')]){var _0x24fdde;_0x5b4858[_0x1413('0x1e')][_0x1413('0x1f')]({'where':{'id':_0xe7fd8e[_0x1413('0x20')]},'raw':!![]})['then'](function(_0x27dbb5){_0x24fdde=_0x27dbb5;if(_0x24fdde&&_0x24fdde[_0x1413('0x21')]){switch(_0x24fdde[_0x1413('0x21')]){case _0x1413('0x22'):var _0x521ce4=require('twilio');if(_0x24fdde[_0x1413('0x23')]&&_0x24fdde[_0x1413('0x24')]&&_0x24fdde['phone']){var _0x478484=new _0x521ce4(_0x24fdde[_0x1413('0x23')],_0x24fdde[_0x1413('0x24')]);_0x478484[_0x1413('0x25')]['create']({'body':_0xe7fd8e['body'],'to':'whatsapp:'+_0xe7fd8e[_0x1413('0x26')],'from':_0x1413('0x27')+_0x24fdde[_0x1413('0x26')],'statusCallback':_0x24fdde[_0x1413('0x28')]+_0x1413('0x29')+_0xe7fd8e['id']+_0x1413('0x2a')+_0x24fdde[_0x1413('0x2b')]})[_0x1413('0x1a')](function(_0x3322b3){if(_0x3322b3['sid']){return _0x1af9a9[_0x1413('0x2c')]({'messageId':_0x3322b3[_0x1413('0x2d')]});}})[_0x1413('0x1c')](function(_0x3c246b){logger['error'](_0x1413('0x2e'),_0x1413('0x2f'),_0x1413('0x22'),util[_0x1413('0x30')](_0x3c246b,{'showHidden':![],'depth':null}));});}else{logger[_0x1413('0x1d')](_0x1413('0x2e'),_0x1413('0x2f'),'twilio',_0x1413('0x31'));}break;case'sinch':var _0x3f2365=_0x24fdde['accountSid'];var _0x493bed=_0x24fdde[_0x1413('0x24')];var _0x3e35cd=_0x24fdde['baseUrl']+'/whatsapp/v1/'+_0x3f2365+'/messages/';var _0xc770f2={'to':[_0xe7fd8e[_0x1413('0x26')]],'message':{'type':_0x1413('0x32'),'text':_0xe7fd8e[_0x1413('0x11')]}};var _0x40bd73={'method':'POST','uri':_0x3e35cd,'headers':{'Authorization':_0x1413('0x33')+_0x493bed,'Content-Type':_0x1413('0x34')},'body':_0xc770f2,'json':!![]};rp(_0x40bd73)[_0x1413('0x1a')](function(_0x2ea0ee){if(_0x2ea0ee[_0x1413('0x35')][0x0][_0x1413('0x36')]){return _0x1af9a9[_0x1413('0x2c')]({'messageId':_0x2ea0ee['statuses'][0x0][_0x1413('0x36')]});}})[_0x1413('0x1c')](function(_0x24f71b){logger[_0x1413('0x37')](_0x1413('0x38'),_0x24f71b);});break;}}})['finally'](function(){_0x108696();});}else{_0x108696();}}},'charset':'utf8mb4','collate':_0x1413('0x39')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 5646c14..c143bb4 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 _0x85a9=['client','redis','defaults','localhost','register','request','then','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','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x85a9,0x10d));var _0x985a=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x85a9[_0x236d24];return _0x1574cf;};'use strict';var _=require(_0x985a('0x0'));var util=require(_0x985a('0x1'));var moment=require(_0x985a('0x2'));var BPromise=require(_0x985a('0x3'));var rs=require(_0x985a('0x4'));var fs=require('fs');var Redis=require(_0x985a('0x5'));var db=require(_0x985a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x985a('0x7'))(_0x985a('0x8'));var config=require(_0x985a('0x9'));var jayson=require(_0x985a('0xa'));var client=jayson[_0x985a('0xb')]['http']({'port':0x232a});config[_0x985a('0xc')]=_[_0x985a('0xd')](config[_0x985a('0xc')],{'host':_0x985a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x985a('0xc')]));require('./whatsappMessage.socket')[_0x985a('0xf')](socket);function respondWithRpcPromise(_0x36de29,_0x146e9e,_0x222389){return new BPromise(function(_0x143ef7,_0x260976){return client[_0x985a('0x10')](_0x36de29,_0x222389)[_0x985a('0x11')](function(_0x27b9f3){logger[_0x985a('0x12')](_0x985a('0x13'),_0x146e9e,_0x985a('0x14'));logger[_0x985a('0x15')](_0x985a('0x16'),_0x146e9e,_0x985a('0x14'),JSON[_0x985a('0x17')](_0x27b9f3));if(_0x27b9f3[_0x985a('0x18')]){if(_0x27b9f3[_0x985a('0x18')][_0x985a('0x19')]===0x1f4){logger[_0x985a('0x18')](_0x985a('0x13'),_0x146e9e,_0x27b9f3[_0x985a('0x18')]['message']);return _0x260976(_0x27b9f3[_0x985a('0x18')][_0x985a('0x1a')]);}logger[_0x985a('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x146e9e,_0x27b9f3['error'][_0x985a('0x1a')]);return _0x143ef7(_0x27b9f3[_0x985a('0x18')][_0x985a('0x1a')]);}else{logger['info'](_0x985a('0x13'),_0x146e9e,_0x985a('0x14'));_0x143ef7(_0x27b9f3[_0x985a('0x1b')]['message']);}})[_0x985a('0x1c')](function(_0x512ee3){logger['error'](_0x985a('0x13'),_0x146e9e,_0x512ee3);_0x260976(_0x512ee3);});});}exports[_0x985a('0x1d')]=function(_0xceb84){var _0x8108a9=this;return new Promise(function(_0x3a54d9,_0xa4e4a3){return db[_0x985a('0x1e')][_0x985a('0x1f')](_0xceb84[_0x985a('0x20')],{'raw':_0xceb84[_0x985a('0x21')]?_0xceb84[_0x985a('0x21')][_0x985a('0x22')]===undefined?!![]:![]:!![]})[_0x985a('0x11')](function(_0x28ea3d){logger[_0x985a('0x12')](_0x985a('0x1d'),_0xceb84);logger[_0x985a('0x15')](_0x985a('0x1d'),_0xceb84,JSON[_0x985a('0x17')](_0x28ea3d));_0x3a54d9(_0x28ea3d);})[_0x985a('0x1c')](function(_0xe52f83){logger['error'](_0x985a('0x1d'),_0xe52f83[_0x985a('0x1a')],_0xceb84);_0xa4e4a3(_0x8108a9[_0x985a('0x18')](0x1f4,_0xe52f83[_0x985a('0x1a')]));});});}; \ No newline at end of file +var _0x8ac3=['request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappMessage.socket','register'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x8ac3,0x1b4));var _0x38ac=function(_0x18d4b1,_0x5419bc){_0x18d4b1=_0x18d4b1-0x0;var _0x39cee1=_0x8ac3[_0x18d4b1];return _0x39cee1;};'use strict';var _=require(_0x38ac('0x0'));var util=require(_0x38ac('0x1'));var moment=require(_0x38ac('0x2'));var BPromise=require(_0x38ac('0x3'));var rs=require(_0x38ac('0x4'));var fs=require('fs');var Redis=require(_0x38ac('0x5'));var db=require(_0x38ac('0x6'))['db'];var utils=require(_0x38ac('0x7'));var logger=require(_0x38ac('0x8'))(_0x38ac('0x9'));var config=require(_0x38ac('0xa'));var jayson=require(_0x38ac('0xb'));var client=jayson[_0x38ac('0xc')][_0x38ac('0xd')]({'port':0x232a});config['redis']=_[_0x38ac('0xe')](config[_0x38ac('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x38ac('0x10'))(new Redis(config[_0x38ac('0xf')]));require(_0x38ac('0x11'))[_0x38ac('0x12')](socket);function respondWithRpcPromise(_0x149008,_0x196c66,_0x39a740){return new BPromise(function(_0xc91b1e,_0x44b9e2){return client[_0x38ac('0x13')](_0x149008,_0x39a740)[_0x38ac('0x14')](function(_0x2460e3){logger[_0x38ac('0x15')](_0x38ac('0x16'),_0x196c66,_0x38ac('0x17'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x196c66,'request\x20sent',JSON[_0x38ac('0x18')](_0x2460e3));if(_0x2460e3[_0x38ac('0x19')]){if(_0x2460e3[_0x38ac('0x19')]['code']===0x1f4){logger[_0x38ac('0x19')]('WhatsappMessage,\x20%s,\x20%s',_0x196c66,_0x2460e3[_0x38ac('0x19')][_0x38ac('0x1a')]);return _0x44b9e2(_0x2460e3[_0x38ac('0x19')][_0x38ac('0x1a')]);}logger[_0x38ac('0x19')]('WhatsappMessage,\x20%s,\x20%s',_0x196c66,_0x2460e3['error'][_0x38ac('0x1a')]);return _0xc91b1e(_0x2460e3[_0x38ac('0x19')][_0x38ac('0x1a')]);}else{logger['info'](_0x38ac('0x16'),_0x196c66,'request\x20sent');_0xc91b1e(_0x2460e3[_0x38ac('0x1b')][_0x38ac('0x1a')]);}})[_0x38ac('0x1c')](function(_0x36a5bb){logger[_0x38ac('0x19')](_0x38ac('0x16'),_0x196c66,_0x36a5bb);_0x44b9e2(_0x36a5bb);});});}exports[_0x38ac('0x1d')]=function(_0x17cd1a){var _0x49affe=this;return new Promise(function(_0x3675b2,_0x28f70a){return db[_0x38ac('0x1e')][_0x38ac('0x1f')](_0x17cd1a['body'],{'raw':_0x17cd1a[_0x38ac('0x20')]?_0x17cd1a[_0x38ac('0x20')][_0x38ac('0x21')]===undefined?!![]:![]:!![]})[_0x38ac('0x14')](function(_0xb7a3b4){logger['info']('CreateWhatsappMessage',_0x17cd1a);logger[_0x38ac('0x22')]('CreateWhatsappMessage',_0x17cd1a,JSON[_0x38ac('0x18')](_0xb7a3b4));_0x3675b2(_0xb7a3b4);})[_0x38ac('0x1c')](function(_0x4a281d){logger['error'](_0x38ac('0x1d'),_0x4a281d[_0x38ac('0x1a')],_0x17cd1a);_0x28f70a(_0x49affe[_0x38ac('0x19')](0x1f4,_0x4a281d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 32d28e4..22690b4 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 _0x63bc=['removeListener','length','./whatsappMessage.events','save','remove','update','emit'];(function(_0x22f935,_0x145e60){var _0x21a3aa=function(_0x68fbef){while(--_0x68fbef){_0x22f935['push'](_0x22f935['shift']());}};_0x21a3aa(++_0x145e60);}(_0x63bc,0x17c));var _0xc63b=function(_0x4f6d65,_0x28f63b){_0x4f6d65=_0x4f6d65-0x0;var _0x28a839=_0x63bc[_0x4f6d65];return _0x28a839;};'use strict';var WhatsappMessageEvents=require(_0xc63b('0x0'));var events=[_0xc63b('0x1'),_0xc63b('0x2'),_0xc63b('0x3')];function createListener(_0xa9a622,_0x4a5562){return function(_0x6356d9){_0x4a5562[_0xc63b('0x4')](_0xa9a622,_0x6356d9);};}function removeListener(_0x4527b1,_0x51e735){return function(){WhatsappMessageEvents[_0xc63b('0x5')](_0x4527b1,_0x51e735);};}exports['register']=function(_0x509eeb){for(var _0x1076c8=0x0,_0x4258b2=events[_0xc63b('0x6')];_0x1076c8<_0x4258b2;_0x1076c8++){var _0x3c9789=events[_0x1076c8];var _0x504c89=createListener('whatsappMessage:'+_0x3c9789,_0x509eeb);WhatsappMessageEvents['on'](_0x3c9789,_0x504c89);}}; \ No newline at end of file +var _0x6fb2=['removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit'];(function(_0x5da05b,_0x282251){var _0x2d5689=function(_0xad8586){while(--_0xad8586){_0x5da05b['push'](_0x5da05b['shift']());}};_0x2d5689(++_0x282251);}(_0x6fb2,0x124));var _0x26fb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6fb2[_0x2dafbe];return _0x58a45a;};'use strict';var WhatsappMessageEvents=require(_0x26fb('0x0'));var events=[_0x26fb('0x1'),_0x26fb('0x2'),_0x26fb('0x3')];function createListener(_0x512365,_0x1e9628){return function(_0x598377){_0x1e9628[_0x26fb('0x4')](_0x512365,_0x598377);};}function removeListener(_0xbaea46,_0xf80725){return function(){WhatsappMessageEvents[_0x26fb('0x5')](_0xbaea46,_0xf80725);};}exports[_0x26fb('0x6')]=function(_0x4f4d47){for(var _0x526789=0x0,_0x4df1c0=events[_0x26fb('0x7')];_0x526789<_0x4df1c0;_0x526789++){var _0x1dae23=events[_0x526789];var _0x4da93a=createListener(_0x26fb('0x8')+_0x1dae23,_0x4f4d47);WhatsappMessageEvents['on'](_0x1dae23,_0x4da93a);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 6a4f483..a33a5c7 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 _0x0f0c=['/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','post','create','/:id/teams','addTeams','put','delete','removeTeams','removeAgents','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index'];(function(_0x2842ef,_0x19279a){var _0x3bb513=function(_0x1ac918){while(--_0x1ac918){_0x2842ef['push'](_0x2842ef['shift']());}};_0x3bb513(++_0x19279a);}(_0x0f0c,0x1d8));var _0xc0f0=function(_0x3eb969,_0x11c187){_0x3eb969=_0x3eb969-0x0;var _0x5e62e0=_0x0f0c[_0x3eb969];return _0x5e62e0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc0f0('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc0f0('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xc0f0('0x2'));var interaction=require(_0xc0f0('0x3'));var config=require(_0xc0f0('0x4'));var controller=require(_0xc0f0('0x5'));router[_0xc0f0('0x6')]('/',auth['isAuthenticated'](),controller[_0xc0f0('0x7')]);router[_0xc0f0('0x6')](_0xc0f0('0x8'),auth[_0xc0f0('0x9')](),controller[_0xc0f0('0xa')]);router['get'](_0xc0f0('0xb'),auth[_0xc0f0('0x9')](),controller['show']);router['get'](_0xc0f0('0xc'),auth[_0xc0f0('0x9')](),controller[_0xc0f0('0xd')]);router[_0xc0f0('0x6')]('/:id/teams',auth[_0xc0f0('0x9')](),controller[_0xc0f0('0xe')]);router[_0xc0f0('0x6')](_0xc0f0('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0xc0f0('0x10')]('/',auth[_0xc0f0('0x9')](),controller[_0xc0f0('0x11')]);router[_0xc0f0('0x10')](_0xc0f0('0x12'),auth[_0xc0f0('0x9')](),controller[_0xc0f0('0x13')]);router[_0xc0f0('0x10')](_0xc0f0('0xf'),auth[_0xc0f0('0x9')](),controller['addAgents']);router[_0xc0f0('0x14')](_0xc0f0('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc0f0('0x15')](_0xc0f0('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xc0f0('0x15')](_0xc0f0('0x12'),auth[_0xc0f0('0x9')](),controller[_0xc0f0('0x16')]);router[_0xc0f0('0x15')](_0xc0f0('0xf'),auth['isAuthenticated'](),controller[_0xc0f0('0x17')]);module['exports']=router; \ No newline at end of file +var _0xa9b8=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','getTeams','/:id/users','getAgents','create','/:id/teams','addTeams','addAgents','update','destroy','delete','exports','multer','util','path','connect-timeout'];(function(_0x470894,_0x19adec){var _0x1de50a=function(_0x29166a){while(--_0x29166a){_0x470894['push'](_0x470894['shift']());}};_0x1de50a(++_0x19adec);}(_0xa9b8,0x140));var _0x8a9b=function(_0x59ca1b,_0x190aee){_0x59ca1b=_0x59ca1b-0x0;var _0x41c74e=_0xa9b8[_0x59ca1b];return _0x41c74e;};'use strict';var multer=require(_0x8a9b('0x0'));var util=require(_0x8a9b('0x1'));var path=require(_0x8a9b('0x2'));var timeout=require(_0x8a9b('0x3'));var express=require(_0x8a9b('0x4'));var router=express[_0x8a9b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8a9b('0x6'));var interaction=require(_0x8a9b('0x7'));var config=require(_0x8a9b('0x8'));var controller=require(_0x8a9b('0x9'));router[_0x8a9b('0xa')]('/',auth[_0x8a9b('0xb')](),controller['index']);router[_0x8a9b('0xa')]('/describe',auth[_0x8a9b('0xb')](),controller[_0x8a9b('0xc')]);router[_0x8a9b('0xa')](_0x8a9b('0xd'),auth[_0x8a9b('0xb')](),controller[_0x8a9b('0xe')]);router[_0x8a9b('0xa')](_0x8a9b('0xf'),auth[_0x8a9b('0xb')](),controller['getMembers']);router[_0x8a9b('0xa')]('/:id/teams',auth[_0x8a9b('0xb')](),controller[_0x8a9b('0x10')]);router[_0x8a9b('0xa')](_0x8a9b('0x11'),auth[_0x8a9b('0xb')](),controller[_0x8a9b('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8a9b('0x13')]);router['post'](_0x8a9b('0x14'),auth['isAuthenticated'](),controller[_0x8a9b('0x15')]);router['post'](_0x8a9b('0x11'),auth['isAuthenticated'](),controller[_0x8a9b('0x16')]);router['put'](_0x8a9b('0xd'),auth[_0x8a9b('0xb')](),controller[_0x8a9b('0x17')]);router['delete'](_0x8a9b('0xd'),auth[_0x8a9b('0xb')](),controller[_0x8a9b('0x18')]);router[_0x8a9b('0x19')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0x8a9b('0x19')]('/:id/users',auth[_0x8a9b('0xb')](),controller['removeAgents']);module[_0x8a9b('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 580aa90..3b4af84 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 _0x1cf3=['STRING','name','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x3bf456,_0x1e7b7a){var _0x2ff9c7=function(_0x3f00b6){while(--_0x3f00b6){_0x3bf456['push'](_0x3bf456['shift']());}};_0x2ff9c7(++_0x1e7b7a);}(_0x1cf3,0x1be));var _0x31cf=function(_0x41be8d,_0x58ffef){_0x41be8d=_0x41be8d-0x0;var _0x27a91d=_0x1cf3[_0x41be8d];return _0x27a91d;};'use strict';var Sequelize=require(_0x31cf('0x0'));module[_0x31cf('0x1')]={'name':{'type':Sequelize[_0x31cf('0x2')],'unique':_0x31cf('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x31cf('0x4')]('rrmemory',_0x31cf('0x5'),_0x31cf('0x6'))},'description':{'type':Sequelize[_0x31cf('0x2')]}}; \ No newline at end of file +var _0xc79f=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0xc79f,0x82));var _0xfc79=function(_0x10cd1d,_0x30642e){_0x10cd1d=_0x10cd1d-0x0;var _0x4d2a1c=_0xc79f[_0x10cd1d];return _0x4d2a1c;};'use strict';var Sequelize=require(_0xfc79('0x0'));module[_0xfc79('0x1')]={'name':{'type':Sequelize[_0xfc79('0x2')],'unique':_0xfc79('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xfc79('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xfc79('0x5'),_0xfc79('0x6'),_0xfc79('0x7'))},'description':{'type':Sequelize[_0xfc79('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 0db6cc1..db16456 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 _0xc933=['describe','getMembers','findOne','UserWhatsappQueue','findAll','User','findAndCountAll','whatsappPause','updatedAt','createdAt','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','online','interface','flatMap','transaction','each','findOrCreate','forEach','field','tq.TeamId','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappQueue.socket','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','WhatsappQueues','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','WhatsappQueue','includeAll','rows','catch','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','params'];(function(_0x321234,_0x4d480b){var _0x3df48b=function(_0x55bc9d){while(--_0x55bc9d){_0x321234['push'](_0x321234['shift']());}};_0x3df48b(++_0x4d480b);}(_0xc933,0xc2));var _0x3c93=function(_0x29672e,_0x1df252){_0x29672e=_0x29672e-0x0;var _0xc5afaa=_0xc933[_0x29672e];return _0xc5afaa;};'use strict';var emlformat=require(_0x3c93('0x0'));var rimraf=require(_0x3c93('0x1'));var zipdir=require(_0x3c93('0x2'));var jsonpatch=require(_0x3c93('0x3'));var rp=require(_0x3c93('0x4'));var moment=require('moment');var BPromise=require(_0x3c93('0x5'));var Mustache=require(_0x3c93('0x6'));var util=require(_0x3c93('0x7'));var path=require('path');var sox=require(_0x3c93('0x8'));var csv=require(_0x3c93('0x9'));var ejs=require(_0x3c93('0xa'));var fs=require('fs');var fs_extra=require(_0x3c93('0xb'));var _=require(_0x3c93('0xc'));var squel=require(_0x3c93('0xd'));var crypto=require(_0x3c93('0xe'));var jsforce=require(_0x3c93('0xf'));var deskjs=require(_0x3c93('0x10'));var toCsv=require(_0x3c93('0x9'));var querystring=require('querystring');var Papa=require(_0x3c93('0x11'));var Redis=require(_0x3c93('0x12'));var authService=require(_0x3c93('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3c93('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c93('0x15'))('api');var utils=require(_0x3c93('0x16'));var config=require(_0x3c93('0x17'));var licenseUtil=require(_0x3c93('0x18'));var db=require(_0x3c93('0x19'))['db'];config['redis']=_[_0x3c93('0x1a')](config[_0x3c93('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x3c93('0x1c'))(new Redis(config[_0x3c93('0x1b')]));require(_0x3c93('0x1d'))['register'](socket);function respondWithStatusCode(_0x175a47,_0x2afc75){_0x2afc75=_0x2afc75||0xcc;return function(_0x46c7be){if(_0x46c7be){return _0x175a47['sendStatus'](_0x2afc75);}return _0x175a47[_0x3c93('0x1e')](_0x2afc75)[_0x3c93('0x1f')]();};}function respondWithResult(_0x5e161c,_0x104b33){_0x104b33=_0x104b33||0xc8;return function(_0x3aeaf3){if(_0x3aeaf3){return _0x5e161c[_0x3c93('0x1e')](_0x104b33)[_0x3c93('0x20')](_0x3aeaf3);}};}function respondWithFilteredResult(_0x39cdcb,_0x121192){return function(_0xa2af0f){if(_0xa2af0f){var _0x2759a5=typeof _0x121192[_0x3c93('0x21')]===_0x3c93('0x22')&&typeof _0x121192[_0x3c93('0x23')]===_0x3c93('0x22');var _0x56b486=_0xa2af0f['count'];var _0x260b2c=_0x2759a5?0x0:_0x121192[_0x3c93('0x21')];var _0x3d56a3=_0x2759a5?_0xa2af0f[_0x3c93('0x24')]:_0x121192[_0x3c93('0x21')]+_0x121192[_0x3c93('0x23')];var _0x3e33b5;if(_0x3d56a3>=_0x56b486){_0x3d56a3=_0x56b486;_0x3e33b5=0xc8;}else{_0x3e33b5=0xce;}_0x39cdcb[_0x3c93('0x1e')](_0x3e33b5);return _0x39cdcb[_0x3c93('0x25')]('Content-Range',_0x260b2c+'-'+_0x3d56a3+'/'+_0x56b486)[_0x3c93('0x20')](_0xa2af0f);}return null;};}function patchUpdates(_0x53b980){return function(_0x54946d){try{jsonpatch[_0x3c93('0x26')](_0x54946d,_0x53b980,!![]);}catch(_0x32d201){return BPromise[_0x3c93('0x27')](_0x32d201);}return _0x54946d['save']();};}function saveUpdates(_0x1b851c,_0x1153f4){return function(_0x2115dd){if(_0x2115dd){return _0x2115dd[_0x3c93('0x28')](_0x1b851c)[_0x3c93('0x29')](function(_0x2c99e6){return _0x2c99e6;});}return null;};}function removeEntity(_0x38b6bc,_0x55360c){return function(_0x5b2e83){if(_0x5b2e83){return _0x5b2e83[_0x3c93('0x2a')]()[_0x3c93('0x29')](function(){var _0x363e2e=_0x5b2e83['get']({'plain':!![]});var _0x4a4a5a=_0x3c93('0x2b');return db['UserProfileResource'][_0x3c93('0x2a')]({'where':{'type':_0x4a4a5a,'resourceId':_0x363e2e['id']}})[_0x3c93('0x29')](function(){return _0x5b2e83;});})[_0x3c93('0x29')](function(){_0x38b6bc[_0x3c93('0x1e')](0xcc)[_0x3c93('0x1f')]();});}};}function handleEntityNotFound(_0x5fe665,_0x273996){return function(_0x39f76e){if(!_0x39f76e){_0x5fe665[_0x3c93('0x2c')](0x194);}return _0x39f76e;};}function handleError(_0x3c095b,_0x13c3db){_0x13c3db=_0x13c3db||0x1f4;return function(_0x2cfaf8){logger['error'](_0x2cfaf8[_0x3c93('0x2d')]);if(_0x2cfaf8[_0x3c93('0x2e')]){delete _0x2cfaf8[_0x3c93('0x2e')];}_0x3c095b[_0x3c93('0x1e')](_0x13c3db)[_0x3c93('0x2f')](_0x2cfaf8);};}exports[_0x3c93('0x30')]=function(_0x5d3847,_0x573e7f){var _0x3218e8={},_0x38e576={},_0x3c779c={'count':0x0,'rows':[]};var _0x245bf1=_[_0x3c93('0x31')](db['WhatsappQueue'][_0x3c93('0x32')],function(_0x5441ce){return{'name':_0x5441ce[_0x3c93('0x33')],'type':_0x5441ce['type'][_0x3c93('0x34')]};});_0x38e576[_0x3c93('0x35')]=_[_0x3c93('0x31')](_0x245bf1,_0x3c93('0x2e'));_0x38e576[_0x3c93('0x36')]=_[_0x3c93('0x37')](_0x5d3847[_0x3c93('0x36')]);_0x38e576[_0x3c93('0x38')]=_['intersection'](_0x38e576[_0x3c93('0x35')],_0x38e576['query']);_0x3218e8['attributes']=_[_0x3c93('0x39')](_0x38e576[_0x3c93('0x35')],qs[_0x3c93('0x3a')](_0x5d3847[_0x3c93('0x36')]['fields']));_0x3218e8[_0x3c93('0x3b')]=_0x3218e8[_0x3c93('0x3b')][_0x3c93('0x3c')]?_0x3218e8['attributes']:_0x38e576['model'];if(!_0x5d3847[_0x3c93('0x36')][_0x3c93('0x3d')](_0x3c93('0x3e'))){_0x3218e8[_0x3c93('0x23')]=qs['limit'](_0x5d3847[_0x3c93('0x36')][_0x3c93('0x23')]);_0x3218e8['offset']=qs[_0x3c93('0x21')](_0x5d3847[_0x3c93('0x36')][_0x3c93('0x21')]);}_0x3218e8[_0x3c93('0x3f')]=qs[_0x3c93('0x40')](_0x5d3847[_0x3c93('0x36')][_0x3c93('0x40')]);_0x3218e8[_0x3c93('0x41')]=qs[_0x3c93('0x38')](_[_0x3c93('0x42')](_0x5d3847[_0x3c93('0x36')],_0x38e576['filters']),_0x245bf1);if(_0x5d3847[_0x3c93('0x36')][_0x3c93('0x43')]){_0x3218e8[_0x3c93('0x41')]=_[_0x3c93('0x44')](_0x3218e8[_0x3c93('0x41')],{'$or':_[_0x3c93('0x31')](_0x245bf1,function(_0x54d9c1){if(_0x54d9c1[_0x3c93('0x45')]!==_0x3c93('0x46')){var _0x5f0c2e={};_0x5f0c2e[_0x54d9c1[_0x3c93('0x2e')]]={'$like':'%'+_0x5d3847[_0x3c93('0x36')][_0x3c93('0x43')]+'%'};return _0x5f0c2e;}})});}_0x3218e8=_[_0x3c93('0x44')]({},_0x3218e8,_0x5d3847[_0x3c93('0x47')]);var _0x52518b={'where':_0x3218e8[_0x3c93('0x41')]};return db[_0x3c93('0x48')][_0x3c93('0x24')](_0x52518b)[_0x3c93('0x29')](function(_0x511224){_0x3c779c['count']=_0x511224;if(_0x5d3847[_0x3c93('0x36')][_0x3c93('0x49')]){_0x3218e8['include']=[{'all':!![]}];}return db[_0x3c93('0x48')]['findAll'](_0x3218e8);})[_0x3c93('0x29')](function(_0x1a6943){_0x3c779c[_0x3c93('0x4a')]=_0x1a6943;return _0x3c779c;})['then'](respondWithFilteredResult(_0x573e7f,_0x3218e8))[_0x3c93('0x4b')](handleError(_0x573e7f,null));};exports['show']=function(_0x404890,_0x281dc4){var _0x598a7e={'raw':!![],'where':{'id':_0x404890['params']['id']}},_0xb49d88={};_0xb49d88[_0x3c93('0x35')]=_['keys'](db[_0x3c93('0x48')][_0x3c93('0x32')]);_0xb49d88[_0x3c93('0x36')]=_[_0x3c93('0x37')](_0x404890[_0x3c93('0x36')]);_0xb49d88[_0x3c93('0x38')]=_[_0x3c93('0x39')](_0xb49d88[_0x3c93('0x35')],_0xb49d88[_0x3c93('0x36')]);_0x598a7e['attributes']=_[_0x3c93('0x39')](_0xb49d88[_0x3c93('0x35')],qs[_0x3c93('0x3a')](_0x404890[_0x3c93('0x36')][_0x3c93('0x3a')]));_0x598a7e[_0x3c93('0x3b')]=_0x598a7e[_0x3c93('0x3b')][_0x3c93('0x3c')]?_0x598a7e[_0x3c93('0x3b')]:_0xb49d88['model'];if(_0x404890['query'][_0x3c93('0x49')]){_0x598a7e[_0x3c93('0x4c')]=[{'all':!![]}];}_0x598a7e=_['merge']({},_0x598a7e,_0x404890[_0x3c93('0x47')]);return db[_0x3c93('0x48')][_0x3c93('0x4d')](_0x598a7e)[_0x3c93('0x29')](handleEntityNotFound(_0x281dc4,null))[_0x3c93('0x29')](respondWithResult(_0x281dc4,null))[_0x3c93('0x4b')](handleError(_0x281dc4,null));};exports[_0x3c93('0x4e')]=function(_0x18cb77,_0x68b521){return db[_0x3c93('0x48')][_0x3c93('0x4e')](_0x18cb77[_0x3c93('0x4f')],{})[_0x3c93('0x29')](function(_0x4a947c){var _0x33c3a5=_0x18cb77['user'][_0x3c93('0x50')]({'plain':!![]});if(!_0x33c3a5)throw new Error(_0x3c93('0x51'));if(_0x33c3a5[_0x3c93('0x52')]===_0x3c93('0x53')){var _0xff77dc=_0x4a947c[_0x3c93('0x50')]({'plain':!![]});var _0x457db6=_0x3c93('0x2b');return db[_0x3c93('0x54')][_0x3c93('0x4d')]({'where':{'name':_0x457db6,'userProfileId':_0x33c3a5[_0x3c93('0x55')]},'raw':!![]})['then'](function(_0x5a9740){if(_0x5a9740&&_0x5a9740[_0x3c93('0x56')]===0x0){return db[_0x3c93('0x57')][_0x3c93('0x4e')]({'name':_0xff77dc[_0x3c93('0x2e')],'resourceId':_0xff77dc['id'],'type':_0x5a9740[_0x3c93('0x2e')],'sectionId':_0x5a9740['id']},{})['then'](function(){return _0x4a947c;});}else{return _0x4a947c;}})[_0x3c93('0x4b')](function(_0x4e041b){logger[_0x3c93('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e041b);throw _0x4e041b;});}return _0x4a947c;})[_0x3c93('0x29')](respondWithResult(_0x68b521,0xc9))[_0x3c93('0x4b')](handleError(_0x68b521,null));};exports[_0x3c93('0x28')]=function(_0x418e56,_0x4e0e48){if(_0x418e56[_0x3c93('0x4f')]['id']){delete _0x418e56['body']['id'];}return db['WhatsappQueue'][_0x3c93('0x4d')]({'where':{'id':_0x418e56['params']['id']}})[_0x3c93('0x29')](handleEntityNotFound(_0x4e0e48,null))[_0x3c93('0x29')](saveUpdates(_0x418e56[_0x3c93('0x4f')],null))[_0x3c93('0x29')](respondWithResult(_0x4e0e48,null))['catch'](handleError(_0x4e0e48,null));};exports[_0x3c93('0x2a')]=function(_0x29fea0,_0x1f9963){return db[_0x3c93('0x48')][_0x3c93('0x4d')]({'where':{'id':_0x29fea0[_0x3c93('0x59')]['id']}})['then'](handleEntityNotFound(_0x1f9963,null))['then'](removeEntity(_0x1f9963,null))[_0x3c93('0x4b')](handleError(_0x1f9963,null));};exports[_0x3c93('0x5a')]=function(_0x3c6907,_0x13a52f){return db['WhatsappQueue'][_0x3c93('0x5a')]()[_0x3c93('0x29')](respondWithResult(_0x13a52f,null))[_0x3c93('0x4b')](handleError(_0x13a52f,null));};exports[_0x3c93('0x5b')]=function(_0x567b75,_0x3d9f67,_0x30a101){var _0x382c60={'raw':!![],'where':{}},_0x32d533={},_0x1bf3e1;return db['WhatsappQueue'][_0x3c93('0x5c')]({'where':{'id':_0x567b75[_0x3c93('0x59')]['id']}})['then'](handleEntityNotFound(_0x3d9f67,null))[_0x3c93('0x29')](function(_0x1c8ad9){if(_0x1c8ad9){_0x1bf3e1=_0x1c8ad9[_0x3c93('0x50')]({'plain':!![]});_0x32d533[_0x3c93('0x35')]=_[_0x3c93('0x37')](db[_0x3c93('0x5d')]['rawAttributes']);_0x32d533[_0x3c93('0x36')]=_[_0x3c93('0x37')](_0x567b75[_0x3c93('0x36')]);_0x32d533['filters']=_[_0x3c93('0x39')](_0x32d533[_0x3c93('0x35')],_0x32d533[_0x3c93('0x36')]);_0x382c60['attributes']=_[_0x3c93('0x39')](_0x32d533[_0x3c93('0x35')],qs[_0x3c93('0x3a')](_0x567b75[_0x3c93('0x36')][_0x3c93('0x3a')]));_0x382c60[_0x3c93('0x3b')]=_0x382c60[_0x3c93('0x3b')][_0x3c93('0x3c')]?_0x382c60['attributes']:_0x32d533[_0x3c93('0x35')];if(!_0x567b75[_0x3c93('0x36')][_0x3c93('0x3d')](_0x3c93('0x3e'))){_0x382c60[_0x3c93('0x23')]=qs[_0x3c93('0x23')](_0x567b75[_0x3c93('0x36')][_0x3c93('0x23')]);_0x382c60[_0x3c93('0x21')]=qs[_0x3c93('0x21')](_0x567b75[_0x3c93('0x36')]['offset']);}_0x382c60[_0x3c93('0x3f')]=qs[_0x3c93('0x40')](_0x567b75['query']['sort']);_0x382c60[_0x3c93('0x41')]=qs[_0x3c93('0x38')](_['pick'](_0x567b75[_0x3c93('0x36')],_0x32d533[_0x3c93('0x38')]));_0x382c60['where']['WhatsappQueueId']=_0x1c8ad9['id'];if(_0x567b75[_0x3c93('0x36')][_0x3c93('0x43')]){_0x382c60['where']=_[_0x3c93('0x44')](_0x382c60[_0x3c93('0x41')],{'$or':_[_0x3c93('0x31')](_0x382c60[_0x3c93('0x3b')],function(_0x5d6fb0){var _0x2a9f79={};_0x2a9f79[_0x5d6fb0]={'$like':'%'+_0x567b75[_0x3c93('0x36')][_0x3c93('0x43')]+'%'};return _0x2a9f79;})});}_0x382c60=_[_0x3c93('0x44')]({},_0x382c60,_0x567b75[_0x3c93('0x47')]);return db['UserWhatsappQueue'][_0x3c93('0x5e')](_0x382c60);}})[_0x3c93('0x29')](function(_0xf4a55a){if(_0xf4a55a){return db[_0x3c93('0x5f')][_0x3c93('0x60')]({'where':{'id':_[_0x3c93('0x31')](_0xf4a55a,'UserId'),'role':'agent'},'attributes':['id',_0x3c93('0x2e'),_0x3c93('0x61'),_0x3c93('0x62'),_0x3c93('0x63')]});}})[_0x3c93('0x29')](function(_0x1a9a91){if(_0x1a9a91){return{'count':_0x1a9a91[_0x3c93('0x24')],'rows':_[_0x3c93('0x31')](_0x1a9a91[_0x3c93('0x4a')],function(_0x56feda){return{'membername':_0x56feda[_0x3c93('0x2e')],'UserId':_0x56feda['id'],'queue_name':_0x1bf3e1[_0x3c93('0x2e')],'WhatsappQueueId':_0x1bf3e1['id'],'interface':util['format'](_0x3c93('0x64'),_0x3c93('0x65'),_0x56feda['name']),'penalty':0x0,'paused':_0x56feda['whatsappPause'],'createdAt':_0x56feda[_0x3c93('0x63')],'updatedAt':_0x56feda[_0x3c93('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3c93('0x29')](respondWithFilteredResult(_0x3d9f67,_0x382c60))['catch'](handleError(_0x3d9f67,null));};exports['getTeams']=function(_0x4b6c89,_0x2663aa,_0x411963){var _0x2ae1ab={};var _0x34b295={};var _0x15d0a0;var _0x2e6d25;return db[_0x3c93('0x48')][_0x3c93('0x5c')]({'where':{'id':_0x4b6c89[_0x3c93('0x59')]['id']}})[_0x3c93('0x29')](handleEntityNotFound(_0x2663aa,null))[_0x3c93('0x29')](function(_0x413ea4){if(_0x413ea4){_0x15d0a0=_0x413ea4;_0x34b295[_0x3c93('0x35')]=_[_0x3c93('0x37')](db[_0x3c93('0x66')][_0x3c93('0x32')]);_0x34b295[_0x3c93('0x36')]=_[_0x3c93('0x37')](_0x4b6c89['query']);_0x34b295[_0x3c93('0x38')]=_[_0x3c93('0x39')](_0x34b295[_0x3c93('0x35')],_0x34b295['query']);_0x2ae1ab['attributes']=_[_0x3c93('0x39')](_0x34b295[_0x3c93('0x35')],qs['fields'](_0x4b6c89[_0x3c93('0x36')][_0x3c93('0x3a')]));_0x2ae1ab[_0x3c93('0x3b')]=_0x2ae1ab['attributes']['length']?_0x2ae1ab[_0x3c93('0x3b')]:_0x34b295[_0x3c93('0x35')];_0x2ae1ab[_0x3c93('0x3f')]=qs[_0x3c93('0x40')](_0x4b6c89[_0x3c93('0x36')][_0x3c93('0x40')]);_0x2ae1ab['where']=qs[_0x3c93('0x38')](_['pick'](_0x4b6c89['query'],_0x34b295[_0x3c93('0x38')]));if(_0x4b6c89[_0x3c93('0x36')][_0x3c93('0x43')]){_0x2ae1ab['where']=_['merge'](_0x2ae1ab['where'],{'$or':_[_0x3c93('0x31')](_0x2ae1ab[_0x3c93('0x3b')],function(_0x4ee420){var _0x2b5a99={};_0x2b5a99[_0x4ee420]={'$like':'%'+_0x4b6c89['query']['filter']+'%'};return _0x2b5a99;})});}_0x2ae1ab=_[_0x3c93('0x44')]({},_0x2ae1ab,_0x4b6c89[_0x3c93('0x47')]);return _0x15d0a0[_0x3c93('0x67')](_0x2ae1ab);}})[_0x3c93('0x29')](function(_0x833c7e){if(_0x833c7e){_0x2e6d25=_0x833c7e['length'];if(!_0x4b6c89[_0x3c93('0x36')][_0x3c93('0x3d')](_0x3c93('0x3e'))){_0x2ae1ab[_0x3c93('0x23')]=qs['limit'](_0x4b6c89[_0x3c93('0x36')]['limit']);_0x2ae1ab[_0x3c93('0x21')]=qs[_0x3c93('0x21')](_0x4b6c89['query']['offset']);}return _0x15d0a0[_0x3c93('0x67')](_0x2ae1ab);}})[_0x3c93('0x29')](function(_0xa065a9){if(_0xa065a9){return _0xa065a9?{'count':_0x2e6d25,'rows':_0xa065a9}:null;}})[_0x3c93('0x29')](respondWithResult(_0x2663aa,null))[_0x3c93('0x4b')](handleError(_0x2663aa,null));};exports[_0x3c93('0x68')]=function(_0x51fd10,_0x461d20,_0xd6a203){var _0x40e5e8=_0x51fd10[_0x3c93('0x4f')][_0x3c93('0x69')];return db['Team']['findAll']({'where':{'id':_0x40e5e8},'attributes':['id'],'include':[{'model':db[_0x3c93('0x5f')],'as':_0x3c93('0x6a'),'attributes':['id',_0x3c93('0x2e'),_0x3c93('0x6b'),'voicePause',_0x3c93('0x6c')],'raw':!![]}]})[_0x3c93('0x29')](function(_0x22a60c){if(_0x22a60c){var _0x5ade9f=_[_0x3c93('0x6d')](_0x22a60c,function(_0x13db09){var _0x3c7791=_0x13db09[_0x3c93('0x50')]({'plain':!![]});return _0x3c7791[_0x3c93('0x6a')];});return db[_0x3c93('0x48')][_0x3c93('0x4d')]({'where':{'id':_0x51fd10[_0x3c93('0x59')]['id']}})['then'](function(_0x46b5e4){return db['sequelize'][_0x3c93('0x6e')](function(_0x42567d){return _0x46b5e4[_0x3c93('0x68')](_0x40e5e8,{'transaction':_0x42567d})[_0x3c93('0x29')](function(){return BPromise[_0x3c93('0x6f')](_0x5ade9f,function(_0x2c00c8){return db['UserWhatsappQueue'][_0x3c93('0x70')]({'where':{'UserId':_0x2c00c8['id'],'WhatsappQueueId':_0x51fd10[_0x3c93('0x59')]['id']},'transaction':_0x42567d});});})[_0x3c93('0x29')](function(){_0x5ade9f[_0x3c93('0x71')](function(_0x2bddea){socket['emit']('userWhatsappQueue:save',{'UserId':_0x2bddea['id'],'WhatsappQueueId':_0x46b5e4['id']});});});});});}})[_0x3c93('0x29')](respondWithStatusCode(_0x461d20,null))['catch'](handleError(_0x461d20,null));};exports['removeTeams']=function(_0x20d5b5,_0x16fc88,_0x47eb47){return db[_0x3c93('0x66')]['findAll']({'where':{'id':_0x20d5b5[_0x3c93('0x36')][_0x3c93('0x69')]},'attributes':['id'],'include':[{'model':db[_0x3c93('0x5f')],'as':_0x3c93('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x3c93('0x29')](handleEntityNotFound(_0x16fc88,null))[_0x3c93('0x29')](function(_0x337c80){var _0x581e38=_[_0x3c93('0x31')](_0x337c80,'id');var _0x1a3f49=[];var _0x16cc85=[];var _0x258a79=squel['select']();_0x258a79[_0x3c93('0x72')](_0x3c93('0x73'))['from'](_0x3c93('0x74'),'tq')[_0x3c93('0x75')]('user_has_teams','ut',_0x3c93('0x76'))[_0x3c93('0x41')](_0x3c93('0x77'),_0x20d5b5[_0x3c93('0x59')]['id']);for(var _0x33552b=0x0;_0x33552b<_0x337c80[_0x3c93('0x3c')];_0x33552b+=0x1){let _0x543637=_0x337c80[_0x33552b];for(var _0x18cee9=0x0;_0x18cee9<_0x543637['Agents'][_0x3c93('0x3c')];_0x18cee9+=0x1){let _0x518458=_0x543637[_0x3c93('0x6a')][_0x18cee9];var _0x4d9f1a=_0x258a79[_0x3c93('0x78')]();_0x4d9f1a[_0x3c93('0x41')](_0x3c93('0x79'),_0x518458['id']);_0x16cc85['push'](db[_0x3c93('0x7a')][_0x3c93('0x36')](_0x4d9f1a[_0x3c93('0x7b')](),{'type':db[_0x3c93('0x7a')]['QueryTypes'][_0x3c93('0x7c')]})[_0x3c93('0x29')](function(_0x20a7e8){if(_0x20a7e8[_0x3c93('0x3c')]===0x1){return _0x518458['id'];}else{var _0xcbc0e4=_[_0x3c93('0x7d')](_['map'](_0x20a7e8,_0x3c93('0x7e')),function(_0x52e232){return _[_0x3c93('0x7f')](_0x581e38,_0x52e232);});if(_0xcbc0e4){return _0x518458['id'];}}}));}}return BPromise[_0x3c93('0x80')](_0x16cc85)['then'](function(_0x24c472){_0x1a3f49=_(_0x1a3f49)[_0x3c93('0x81')](_0x24c472)[_0x3c93('0x82')]()[_0x3c93('0x83')]();return db['WhatsappQueue'][_0x3c93('0x4d')]({'where':{'id':_0x20d5b5[_0x3c93('0x59')]['id']}})[_0x3c93('0x29')](function(_0x3c3bc5){return db[_0x3c93('0x7a')][_0x3c93('0x6e')](function(_0x34a1b3){return _0x3c3bc5[_0x3c93('0x84')](_0x20d5b5[_0x3c93('0x36')]['ids'],{'transaction':_0x34a1b3})[_0x3c93('0x29')](function(){if(!_['isEmpty'](_0x1a3f49)){return _0x3c3bc5[_0x3c93('0x85')](_0x1a3f49,{'transaction':_0x34a1b3});}})[_0x3c93('0x29')](function(){_0x1a3f49['forEach'](function(_0x141970){socket[_0x3c93('0x86')](_0x3c93('0x87'),{'UserId':_0x141970,'WhatsappQueueId':_0x3c3bc5['id']});});});});});});})['then'](respondWithStatusCode(_0x16fc88,null))[_0x3c93('0x4b')](handleError(_0x16fc88,null));};exports[_0x3c93('0x88')]=function(_0x10bb79,_0x4ebb12,_0x263554){return db['WhatsappQueue']['find']({'where':{'id':_0x10bb79['params']['id']}})['then'](handleEntityNotFound(_0x4ebb12,null))[_0x3c93('0x29')](function(_0x1646e8){if(_0x1646e8){return _0x1646e8[_0x3c93('0x88')](_0x10bb79[_0x3c93('0x4f')][_0x3c93('0x69')],_[_0x3c93('0x89')](_0x10bb79[_0x3c93('0x4f')],[_0x3c93('0x69'),'id'])||{})[_0x3c93('0x8a')](function(_0x4d4f54){for(var _0x286dea=0x0;_0x286dea<_0x10bb79[_0x3c93('0x4f')][_0x3c93('0x69')][_0x3c93('0x3c')];_0x286dea+=0x1){socket[_0x3c93('0x86')](_0x3c93('0x8b'),{'UserId':Number(_0x10bb79['body'][_0x3c93('0x69')][_0x286dea]),'WhatsappQueueId':Number(_0x10bb79[_0x3c93('0x59')]['id'])});}return _0x4d4f54;});}})[_0x3c93('0x29')](respondWithResult(_0x4ebb12,null))[_0x3c93('0x4b')](handleError(_0x4ebb12,null));};exports[_0x3c93('0x85')]=function(_0x11fe6a,_0x565cd6,_0x18801a){return db[_0x3c93('0x48')][_0x3c93('0x4d')]({'where':{'id':_0x11fe6a['params']['id']}})['then'](handleEntityNotFound(_0x565cd6,null))[_0x3c93('0x29')](function(_0x2aa45a){if(_0x2aa45a){return _0x2aa45a[_0x3c93('0x85')](_0x11fe6a[_0x3c93('0x36')]['ids'])['then'](function(){if(_[_0x3c93('0x8c')](_0x11fe6a[_0x3c93('0x36')][_0x3c93('0x69')])){for(var _0x13d19a=0x0;_0x13d19a<_0x11fe6a[_0x3c93('0x36')][_0x3c93('0x69')][_0x3c93('0x3c')];_0x13d19a+=0x1){socket[_0x3c93('0x86')](_0x3c93('0x87'),{'UserId':Number(_0x11fe6a[_0x3c93('0x36')][_0x3c93('0x69')][_0x13d19a]),'WhatsappQueueId':Number(_0x11fe6a[_0x3c93('0x59')]['id'])});}}else{socket[_0x3c93('0x86')](_0x3c93('0x87'),{'UserId':Number(_0x11fe6a['query']['ids']),'WhatsappQueueId':Number(_0x11fe6a[_0x3c93('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x565cd6,null))[_0x3c93('0x4b')](handleError(_0x565cd6,null));};exports[_0x3c93('0x8d')]=function(_0x4a8608,_0x2718fb,_0x2a9d0a){var _0x20d22b={};var _0xe13234={};var _0x1d548e;var _0x24f0c7;return db[_0x3c93('0x48')][_0x3c93('0x5c')]({'where':{'id':_0x4a8608[_0x3c93('0x59')]['id']}})[_0x3c93('0x29')](handleEntityNotFound(_0x2718fb,null))[_0x3c93('0x29')](function(_0x19c7b4){if(_0x19c7b4){_0x1d548e=_0x19c7b4;_0xe13234[_0x3c93('0x35')]=_[_0x3c93('0x37')](db['User'][_0x3c93('0x32')]);_0xe13234[_0x3c93('0x36')]=_[_0x3c93('0x37')](_0x4a8608['query']);_0xe13234[_0x3c93('0x38')]=_[_0x3c93('0x39')](_0xe13234[_0x3c93('0x35')],_0xe13234['query']);_0x20d22b['attributes']=_[_0x3c93('0x39')](_0xe13234[_0x3c93('0x35')],qs[_0x3c93('0x3a')](_0x4a8608['query'][_0x3c93('0x3a')]));_0x20d22b[_0x3c93('0x3b')]=_0x20d22b[_0x3c93('0x3b')]['length']?_0x20d22b[_0x3c93('0x3b')]:_0xe13234['model'];_0x20d22b['order']=qs[_0x3c93('0x40')](_0x4a8608[_0x3c93('0x36')][_0x3c93('0x40')]);_0x20d22b[_0x3c93('0x41')]=qs[_0x3c93('0x38')](_[_0x3c93('0x42')](_0x4a8608[_0x3c93('0x36')],_0xe13234[_0x3c93('0x38')]));if(_0x4a8608[_0x3c93('0x36')]['filter']){_0x20d22b[_0x3c93('0x41')]=_[_0x3c93('0x44')](_0x20d22b['where'],{'$or':_[_0x3c93('0x31')](_0x20d22b[_0x3c93('0x3b')],function(_0x4c6492){var _0x4eaddd={};_0x4eaddd[_0x4c6492]={'$like':'%'+_0x4a8608[_0x3c93('0x36')]['filter']+'%'};return _0x4eaddd;})});}_0x20d22b=_[_0x3c93('0x44')]({},_0x20d22b,_0x4a8608[_0x3c93('0x47')]);return _0x1d548e[_0x3c93('0x8d')](_0x20d22b);}})[_0x3c93('0x29')](function(_0x5258e0){if(_0x5258e0){_0x24f0c7=_0x5258e0['length'];if(!_0x4a8608[_0x3c93('0x36')]['hasOwnProperty']('nolimit')){_0x20d22b[_0x3c93('0x23')]=qs[_0x3c93('0x23')](_0x4a8608[_0x3c93('0x36')][_0x3c93('0x23')]);_0x20d22b[_0x3c93('0x21')]=qs[_0x3c93('0x21')](_0x4a8608[_0x3c93('0x36')]['offset']);}return _0x1d548e[_0x3c93('0x8d')](_0x20d22b);}})[_0x3c93('0x29')](function(_0x1863fe){if(_0x1863fe){return _0x1863fe?{'count':_0x24f0c7,'rows':_0x1863fe}:null;}})[_0x3c93('0x29')](respondWithResult(_0x2718fb,null))[_0x3c93('0x4b')](handleError(_0x2718fb,null));}; \ No newline at end of file +var _0x06e7=['defaults','localhost','./whatsappQueue.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','stack','name','send','index','WhatsappQueue','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','pick','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','addTeams','ids','Team','voicePause','interface','flatMap','Agents','sequelize','transaction','each','UserWhatsappQueue','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x479c27,_0x1cd463){var _0x12b756=function(_0x16f6a8){while(--_0x16f6a8){_0x479c27['push'](_0x479c27['shift']());}};_0x12b756(++_0x1cd463);}(_0x06e7,0x18d));var _0x706e=function(_0x5a4d79,_0x3c9916){_0x5a4d79=_0x5a4d79-0x0;var _0x474850=_0x06e7[_0x5a4d79];return _0x474850;};'use strict';var emlformat=require(_0x706e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x706e('0x1'));var jsonpatch=require(_0x706e('0x2'));var rp=require(_0x706e('0x3'));var moment=require(_0x706e('0x4'));var BPromise=require(_0x706e('0x5'));var Mustache=require(_0x706e('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x706e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x706e('0x8'));var crypto=require(_0x706e('0x9'));var jsforce=require(_0x706e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x706e('0xb'));var querystring=require(_0x706e('0xc'));var Papa=require('papaparse');var Redis=require(_0x706e('0xd'));var authService=require(_0x706e('0xe'));var qs=require(_0x706e('0xf'));var as=require(_0x706e('0x10'));var hardwareService=require(_0x706e('0x11'));var logger=require(_0x706e('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x706e('0x13'));var licenseUtil=require(_0x706e('0x14'));var db=require(_0x706e('0x15'))['db'];config[_0x706e('0x16')]=_[_0x706e('0x17')](config[_0x706e('0x16')],{'host':_0x706e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x706e('0x16')]));require(_0x706e('0x19'))[_0x706e('0x1a')](socket);function respondWithStatusCode(_0x16ff76,_0x3b5f55){_0x3b5f55=_0x3b5f55||0xcc;return function(_0x29c902){if(_0x29c902){return _0x16ff76[_0x706e('0x1b')](_0x3b5f55);}return _0x16ff76['status'](_0x3b5f55)[_0x706e('0x1c')]();};}function respondWithResult(_0x1fe1ef,_0xf84b9c){_0xf84b9c=_0xf84b9c||0xc8;return function(_0x52d54a){if(_0x52d54a){return _0x1fe1ef[_0x706e('0x1d')](_0xf84b9c)[_0x706e('0x1e')](_0x52d54a);}};}function respondWithFilteredResult(_0x3c60c4,_0x2e6c7b){return function(_0x4a6163){if(_0x4a6163){var _0x777803=typeof _0x2e6c7b['offset']===_0x706e('0x1f')&&typeof _0x2e6c7b[_0x706e('0x20')]==='undefined';var _0x85c46a=_0x4a6163[_0x706e('0x21')];var _0xa794c4=_0x777803?0x0:_0x2e6c7b[_0x706e('0x22')];var _0x100697=_0x777803?_0x4a6163[_0x706e('0x21')]:_0x2e6c7b[_0x706e('0x22')]+_0x2e6c7b[_0x706e('0x20')];var _0x5d98ed;if(_0x100697>=_0x85c46a){_0x100697=_0x85c46a;_0x5d98ed=0xc8;}else{_0x5d98ed=0xce;}_0x3c60c4[_0x706e('0x1d')](_0x5d98ed);return _0x3c60c4[_0x706e('0x23')](_0x706e('0x24'),_0xa794c4+'-'+_0x100697+'/'+_0x85c46a)[_0x706e('0x1e')](_0x4a6163);}return null;};}function patchUpdates(_0x15e263){return function(_0xa66622){try{jsonpatch['apply'](_0xa66622,_0x15e263,!![]);}catch(_0x19da55){return BPromise[_0x706e('0x25')](_0x19da55);}return _0xa66622[_0x706e('0x26')]();};}function saveUpdates(_0x3b399c,_0x5e2d30){return function(_0x3e4abd){if(_0x3e4abd){return _0x3e4abd[_0x706e('0x27')](_0x3b399c)[_0x706e('0x28')](function(_0x1b5a53){return _0x1b5a53;});}return null;};}function removeEntity(_0xe6aa2d,_0x4c92b6){return function(_0x38a912){if(_0x38a912){return _0x38a912[_0x706e('0x29')]()[_0x706e('0x28')](function(){var _0x1dbff4=_0x38a912[_0x706e('0x2a')]({'plain':!![]});var _0xa5ca7c=_0x706e('0x2b');return db[_0x706e('0x2c')][_0x706e('0x29')]({'where':{'type':_0xa5ca7c,'resourceId':_0x1dbff4['id']}})[_0x706e('0x28')](function(){return _0x38a912;});})[_0x706e('0x28')](function(){_0xe6aa2d[_0x706e('0x1d')](0xcc)[_0x706e('0x1c')]();});}};}function handleEntityNotFound(_0x488d62,_0x2d0793){return function(_0x1e152b){if(!_0x1e152b){_0x488d62[_0x706e('0x1b')](0x194);}return _0x1e152b;};}function handleError(_0x49fb6c,_0x51a651){_0x51a651=_0x51a651||0x1f4;return function(_0x1e4fce){logger['error'](_0x1e4fce[_0x706e('0x2d')]);if(_0x1e4fce['name']){delete _0x1e4fce[_0x706e('0x2e')];}_0x49fb6c[_0x706e('0x1d')](_0x51a651)[_0x706e('0x2f')](_0x1e4fce);};}exports[_0x706e('0x30')]=function(_0x24a60a,_0x23902d){var _0x55f454={},_0x13a426={},_0x325f90={'count':0x0,'rows':[]};var _0x96d6c3=_['map'](db[_0x706e('0x31')]['rawAttributes'],function(_0x2b1460){return{'name':_0x2b1460[_0x706e('0x32')],'type':_0x2b1460[_0x706e('0x33')][_0x706e('0x34')]};});_0x13a426[_0x706e('0x35')]=_[_0x706e('0x36')](_0x96d6c3,_0x706e('0x2e'));_0x13a426[_0x706e('0x37')]=_[_0x706e('0x38')](_0x24a60a[_0x706e('0x37')]);_0x13a426['filters']=_[_0x706e('0x39')](_0x13a426[_0x706e('0x35')],_0x13a426[_0x706e('0x37')]);_0x55f454[_0x706e('0x3a')]=_[_0x706e('0x39')](_0x13a426['model'],qs[_0x706e('0x3b')](_0x24a60a[_0x706e('0x37')]['fields']));_0x55f454['attributes']=_0x55f454[_0x706e('0x3a')][_0x706e('0x3c')]?_0x55f454[_0x706e('0x3a')]:_0x13a426[_0x706e('0x35')];if(!_0x24a60a['query']['hasOwnProperty'](_0x706e('0x3d'))){_0x55f454[_0x706e('0x20')]=qs[_0x706e('0x20')](_0x24a60a[_0x706e('0x37')][_0x706e('0x20')]);_0x55f454['offset']=qs[_0x706e('0x22')](_0x24a60a['query'][_0x706e('0x22')]);}_0x55f454[_0x706e('0x3e')]=qs[_0x706e('0x3f')](_0x24a60a[_0x706e('0x37')]['sort']);_0x55f454[_0x706e('0x40')]=qs['filters'](_['pick'](_0x24a60a[_0x706e('0x37')],_0x13a426[_0x706e('0x41')]),_0x96d6c3);if(_0x24a60a[_0x706e('0x37')][_0x706e('0x42')]){_0x55f454['where']=_[_0x706e('0x43')](_0x55f454[_0x706e('0x40')],{'$or':_[_0x706e('0x36')](_0x96d6c3,function(_0x32f8a8){if(_0x32f8a8[_0x706e('0x33')]!==_0x706e('0x44')){var _0x523137={};_0x523137[_0x32f8a8[_0x706e('0x2e')]]={'$like':'%'+_0x24a60a['query'][_0x706e('0x42')]+'%'};return _0x523137;}})});}_0x55f454=_[_0x706e('0x43')]({},_0x55f454,_0x24a60a[_0x706e('0x45')]);var _0x211487={'where':_0x55f454[_0x706e('0x40')]};return db[_0x706e('0x31')][_0x706e('0x21')](_0x211487)[_0x706e('0x28')](function(_0x6f89e1){_0x325f90[_0x706e('0x21')]=_0x6f89e1;if(_0x24a60a['query'][_0x706e('0x46')]){_0x55f454['include']=[{'all':!![]}];}return db[_0x706e('0x31')][_0x706e('0x47')](_0x55f454);})[_0x706e('0x28')](function(_0x555aa3){_0x325f90[_0x706e('0x48')]=_0x555aa3;return _0x325f90;})['then'](respondWithFilteredResult(_0x23902d,_0x55f454))[_0x706e('0x49')](handleError(_0x23902d,null));};exports['show']=function(_0x46ad21,_0x5b2095){var _0x586f83={'raw':!![],'where':{'id':_0x46ad21[_0x706e('0x4a')]['id']}},_0x5cac18={};_0x5cac18[_0x706e('0x35')]=_[_0x706e('0x38')](db[_0x706e('0x31')][_0x706e('0x4b')]);_0x5cac18[_0x706e('0x37')]=_['keys'](_0x46ad21['query']);_0x5cac18[_0x706e('0x41')]=_[_0x706e('0x39')](_0x5cac18[_0x706e('0x35')],_0x5cac18[_0x706e('0x37')]);_0x586f83['attributes']=_[_0x706e('0x39')](_0x5cac18[_0x706e('0x35')],qs[_0x706e('0x3b')](_0x46ad21[_0x706e('0x37')][_0x706e('0x3b')]));_0x586f83[_0x706e('0x3a')]=_0x586f83[_0x706e('0x3a')][_0x706e('0x3c')]?_0x586f83[_0x706e('0x3a')]:_0x5cac18[_0x706e('0x35')];if(_0x46ad21[_0x706e('0x37')][_0x706e('0x46')]){_0x586f83[_0x706e('0x4c')]=[{'all':!![]}];}_0x586f83=_[_0x706e('0x43')]({},_0x586f83,_0x46ad21[_0x706e('0x45')]);return db[_0x706e('0x31')][_0x706e('0x4d')](_0x586f83)[_0x706e('0x28')](handleEntityNotFound(_0x5b2095,null))['then'](respondWithResult(_0x5b2095,null))['catch'](handleError(_0x5b2095,null));};exports[_0x706e('0x4e')]=function(_0x2d6ff3,_0x13e304){return db[_0x706e('0x31')][_0x706e('0x4e')](_0x2d6ff3[_0x706e('0x4f')],{})['then'](function(_0x44429d){var _0x417c0e=_0x2d6ff3[_0x706e('0x50')][_0x706e('0x2a')]({'plain':!![]});if(!_0x417c0e)throw new Error(_0x706e('0x51'));if(_0x417c0e[_0x706e('0x52')]===_0x706e('0x50')){var _0x3248f5=_0x44429d['get']({'plain':!![]});var _0x22243c='WhatsappQueues';return db['UserProfileSection'][_0x706e('0x4d')]({'where':{'name':_0x22243c,'userProfileId':_0x417c0e['userProfileId']},'raw':!![]})['then'](function(_0x6426ef){if(_0x6426ef&&_0x6426ef['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3248f5[_0x706e('0x2e')],'resourceId':_0x3248f5['id'],'type':_0x6426ef[_0x706e('0x2e')],'sectionId':_0x6426ef['id']},{})[_0x706e('0x28')](function(){return _0x44429d;});}else{return _0x44429d;}})[_0x706e('0x49')](function(_0xd22e3b){logger['error'](_0x706e('0x53'),_0xd22e3b);throw _0xd22e3b;});}return _0x44429d;})['then'](respondWithResult(_0x13e304,0xc9))[_0x706e('0x49')](handleError(_0x13e304,null));};exports[_0x706e('0x27')]=function(_0x2ed0b4,_0x439d8c){if(_0x2ed0b4[_0x706e('0x4f')]['id']){delete _0x2ed0b4[_0x706e('0x4f')]['id'];}return db[_0x706e('0x31')][_0x706e('0x4d')]({'where':{'id':_0x2ed0b4[_0x706e('0x4a')]['id']}})[_0x706e('0x28')](handleEntityNotFound(_0x439d8c,null))[_0x706e('0x28')](saveUpdates(_0x2ed0b4[_0x706e('0x4f')],null))[_0x706e('0x28')](respondWithResult(_0x439d8c,null))[_0x706e('0x49')](handleError(_0x439d8c,null));};exports['destroy']=function(_0x3ac87d,_0xdea80a){return db[_0x706e('0x31')][_0x706e('0x4d')]({'where':{'id':_0x3ac87d[_0x706e('0x4a')]['id']}})['then'](handleEntityNotFound(_0xdea80a,null))['then'](removeEntity(_0xdea80a,null))[_0x706e('0x49')](handleError(_0xdea80a,null));};exports[_0x706e('0x54')]=function(_0x3e34df,_0x50c8ac){return db[_0x706e('0x31')][_0x706e('0x54')]()['then'](respondWithResult(_0x50c8ac,null))['catch'](handleError(_0x50c8ac,null));};exports[_0x706e('0x55')]=function(_0x440393,_0xd290ff,_0x15eb0f){var _0x102d82={'raw':!![],'where':{}},_0x5110bf={},_0x107301;return db[_0x706e('0x31')][_0x706e('0x56')]({'where':{'id':_0x440393['params']['id']}})['then'](handleEntityNotFound(_0xd290ff,null))[_0x706e('0x28')](function(_0x5309b7){if(_0x5309b7){_0x107301=_0x5309b7[_0x706e('0x2a')]({'plain':!![]});_0x5110bf[_0x706e('0x35')]=_[_0x706e('0x38')](db['UserWhatsappQueue'][_0x706e('0x4b')]);_0x5110bf[_0x706e('0x37')]=_['keys'](_0x440393['query']);_0x5110bf[_0x706e('0x41')]=_['intersection'](_0x5110bf[_0x706e('0x35')],_0x5110bf['query']);_0x102d82['attributes']=_[_0x706e('0x39')](_0x5110bf[_0x706e('0x35')],qs[_0x706e('0x3b')](_0x440393['query'][_0x706e('0x3b')]));_0x102d82['attributes']=_0x102d82[_0x706e('0x3a')][_0x706e('0x3c')]?_0x102d82[_0x706e('0x3a')]:_0x5110bf[_0x706e('0x35')];if(!_0x440393[_0x706e('0x37')]['hasOwnProperty'](_0x706e('0x3d'))){_0x102d82[_0x706e('0x20')]=qs[_0x706e('0x20')](_0x440393[_0x706e('0x37')][_0x706e('0x20')]);_0x102d82['offset']=qs[_0x706e('0x22')](_0x440393[_0x706e('0x37')][_0x706e('0x22')]);}_0x102d82[_0x706e('0x3e')]=qs[_0x706e('0x3f')](_0x440393[_0x706e('0x37')][_0x706e('0x3f')]);_0x102d82[_0x706e('0x40')]=qs[_0x706e('0x41')](_[_0x706e('0x57')](_0x440393['query'],_0x5110bf['filters']));_0x102d82[_0x706e('0x40')][_0x706e('0x58')]=_0x5309b7['id'];if(_0x440393[_0x706e('0x37')]['filter']){_0x102d82['where']=_['merge'](_0x102d82[_0x706e('0x40')],{'$or':_[_0x706e('0x36')](_0x102d82[_0x706e('0x3a')],function(_0x1f7321){var _0x5dc4a2={};_0x5dc4a2[_0x1f7321]={'$like':'%'+_0x440393[_0x706e('0x37')][_0x706e('0x42')]+'%'};return _0x5dc4a2;})});}_0x102d82=_[_0x706e('0x43')]({},_0x102d82,_0x440393[_0x706e('0x45')]);return db['UserWhatsappQueue'][_0x706e('0x47')](_0x102d82);}})[_0x706e('0x28')](function(_0x2d4123){if(_0x2d4123){return db[_0x706e('0x59')][_0x706e('0x5a')]({'where':{'id':_[_0x706e('0x36')](_0x2d4123,'UserId'),'role':_0x706e('0x5b')},'attributes':['id',_0x706e('0x2e'),_0x706e('0x5c'),_0x706e('0x5d'),'createdAt']});}})[_0x706e('0x28')](function(_0x120208){if(_0x120208){return{'count':_0x120208[_0x706e('0x21')],'rows':_[_0x706e('0x36')](_0x120208[_0x706e('0x48')],function(_0x20c89c){return{'membername':_0x20c89c[_0x706e('0x2e')],'UserId':_0x20c89c['id'],'queue_name':_0x107301[_0x706e('0x2e')],'WhatsappQueueId':_0x107301['id'],'interface':util[_0x706e('0x5e')](_0x706e('0x5f'),_0x706e('0x60'),_0x20c89c[_0x706e('0x2e')]),'penalty':0x0,'paused':_0x20c89c[_0x706e('0x5c')],'createdAt':_0x20c89c[_0x706e('0x61')],'updatedAt':_0x20c89c[_0x706e('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x706e('0x28')](respondWithFilteredResult(_0xd290ff,_0x102d82))[_0x706e('0x49')](handleError(_0xd290ff,null));};exports[_0x706e('0x62')]=function(_0xb42de7,_0x3f006b,_0x167c51){var _0x35ec3d={};var _0x2cce65={};var _0x5dbf81;var _0x2c4a36;return db[_0x706e('0x31')][_0x706e('0x56')]({'where':{'id':_0xb42de7[_0x706e('0x4a')]['id']}})[_0x706e('0x28')](handleEntityNotFound(_0x3f006b,null))[_0x706e('0x28')](function(_0x297d0d){if(_0x297d0d){_0x5dbf81=_0x297d0d;_0x2cce65[_0x706e('0x35')]=_['keys'](db['Team'][_0x706e('0x4b')]);_0x2cce65[_0x706e('0x37')]=_[_0x706e('0x38')](_0xb42de7[_0x706e('0x37')]);_0x2cce65['filters']=_[_0x706e('0x39')](_0x2cce65[_0x706e('0x35')],_0x2cce65[_0x706e('0x37')]);_0x35ec3d[_0x706e('0x3a')]=_[_0x706e('0x39')](_0x2cce65[_0x706e('0x35')],qs[_0x706e('0x3b')](_0xb42de7[_0x706e('0x37')][_0x706e('0x3b')]));_0x35ec3d[_0x706e('0x3a')]=_0x35ec3d[_0x706e('0x3a')][_0x706e('0x3c')]?_0x35ec3d[_0x706e('0x3a')]:_0x2cce65[_0x706e('0x35')];_0x35ec3d[_0x706e('0x3e')]=qs[_0x706e('0x3f')](_0xb42de7['query']['sort']);_0x35ec3d[_0x706e('0x40')]=qs[_0x706e('0x41')](_[_0x706e('0x57')](_0xb42de7[_0x706e('0x37')],_0x2cce65[_0x706e('0x41')]));if(_0xb42de7[_0x706e('0x37')][_0x706e('0x42')]){_0x35ec3d[_0x706e('0x40')]=_[_0x706e('0x43')](_0x35ec3d['where'],{'$or':_['map'](_0x35ec3d[_0x706e('0x3a')],function(_0x52c179){var _0x1d996a={};_0x1d996a[_0x52c179]={'$like':'%'+_0xb42de7[_0x706e('0x37')]['filter']+'%'};return _0x1d996a;})});}_0x35ec3d=_['merge']({},_0x35ec3d,_0xb42de7[_0x706e('0x45')]);return _0x5dbf81[_0x706e('0x62')](_0x35ec3d);}})[_0x706e('0x28')](function(_0x1bc7d5){if(_0x1bc7d5){_0x2c4a36=_0x1bc7d5[_0x706e('0x3c')];if(!_0xb42de7[_0x706e('0x37')]['hasOwnProperty']('nolimit')){_0x35ec3d[_0x706e('0x20')]=qs[_0x706e('0x20')](_0xb42de7['query'][_0x706e('0x20')]);_0x35ec3d[_0x706e('0x22')]=qs[_0x706e('0x22')](_0xb42de7[_0x706e('0x37')][_0x706e('0x22')]);}return _0x5dbf81[_0x706e('0x62')](_0x35ec3d);}})[_0x706e('0x28')](function(_0x357697){if(_0x357697){return _0x357697?{'count':_0x2c4a36,'rows':_0x357697}:null;}})['then'](respondWithResult(_0x3f006b,null))['catch'](handleError(_0x3f006b,null));};exports[_0x706e('0x63')]=function(_0x2c6dc0,_0x1109e1,_0x28c6f2){var _0x440554=_0x2c6dc0[_0x706e('0x4f')][_0x706e('0x64')];return db[_0x706e('0x65')][_0x706e('0x47')]({'where':{'id':_0x440554},'attributes':['id'],'include':[{'model':db[_0x706e('0x59')],'as':'Agents','attributes':['id',_0x706e('0x2e'),'online',_0x706e('0x66'),_0x706e('0x67')],'raw':!![]}]})[_0x706e('0x28')](function(_0x1bc02d){if(_0x1bc02d){var _0x4d564c=_[_0x706e('0x68')](_0x1bc02d,function(_0x3c92f1){var _0x1bd898=_0x3c92f1[_0x706e('0x2a')]({'plain':!![]});return _0x1bd898[_0x706e('0x69')];});return db['WhatsappQueue']['find']({'where':{'id':_0x2c6dc0[_0x706e('0x4a')]['id']}})[_0x706e('0x28')](function(_0x5ce530){return db[_0x706e('0x6a')][_0x706e('0x6b')](function(_0x56fe6e){return _0x5ce530['addTeams'](_0x440554,{'transaction':_0x56fe6e})[_0x706e('0x28')](function(){return BPromise[_0x706e('0x6c')](_0x4d564c,function(_0x183867){return db[_0x706e('0x6d')][_0x706e('0x6e')]({'where':{'UserId':_0x183867['id'],'WhatsappQueueId':_0x2c6dc0['params']['id']},'transaction':_0x56fe6e});});})['then'](function(){_0x4d564c[_0x706e('0x6f')](function(_0x5c2c70){socket[_0x706e('0x70')](_0x706e('0x71'),{'UserId':_0x5c2c70['id'],'WhatsappQueueId':_0x5ce530['id']});});});});});}})[_0x706e('0x28')](respondWithStatusCode(_0x1109e1,null))[_0x706e('0x49')](handleError(_0x1109e1,null));};exports[_0x706e('0x72')]=function(_0x58e0a4,_0x19070e,_0x4bde28){return db['Team'][_0x706e('0x47')]({'where':{'id':_0x58e0a4[_0x706e('0x37')][_0x706e('0x64')]},'attributes':['id'],'include':[{'model':db[_0x706e('0x59')],'as':_0x706e('0x69'),'attributes':['id'],'raw':!![]}]})[_0x706e('0x28')](handleEntityNotFound(_0x19070e,null))[_0x706e('0x28')](function(_0x181bc8){var _0x36f724=_[_0x706e('0x36')](_0x181bc8,'id');var _0x285afc=[];var _0x865cf2=[];var _0x1c0635=squel[_0x706e('0x73')]();_0x1c0635['field'](_0x706e('0x74'))[_0x706e('0x75')](_0x706e('0x76'),'tq')['join'](_0x706e('0x77'),'ut',_0x706e('0x78'))[_0x706e('0x40')](_0x706e('0x79'),_0x58e0a4['params']['id']);for(var _0x2042e6=0x0;_0x2042e6<_0x181bc8[_0x706e('0x3c')];_0x2042e6+=0x1){let _0x32e48d=_0x181bc8[_0x2042e6];for(var _0x26d724=0x0;_0x26d724<_0x32e48d['Agents'][_0x706e('0x3c')];_0x26d724+=0x1){let _0x7dba14=_0x32e48d[_0x706e('0x69')][_0x26d724];var _0x31034c=_0x1c0635['clone']();_0x31034c[_0x706e('0x40')]('ut.UserId\x20=\x20?',_0x7dba14['id']);_0x865cf2[_0x706e('0x7a')](db[_0x706e('0x6a')][_0x706e('0x37')](_0x31034c[_0x706e('0x7b')](),{'type':db[_0x706e('0x6a')][_0x706e('0x7c')][_0x706e('0x7d')]})[_0x706e('0x28')](function(_0x2fbd14){if(_0x2fbd14[_0x706e('0x3c')]===0x1){return _0x7dba14['id'];}else{var _0x583cc6=_[_0x706e('0x7e')](_[_0x706e('0x36')](_0x2fbd14,_0x706e('0x7f')),function(_0x5523b0){return _[_0x706e('0x80')](_0x36f724,_0x5523b0);});if(_0x583cc6){return _0x7dba14['id'];}}}));}}return BPromise[_0x706e('0x81')](_0x865cf2)['then'](function(_0x171f92){_0x285afc=_(_0x285afc)[_0x706e('0x82')](_0x171f92)[_0x706e('0x83')]()['value']();return db[_0x706e('0x31')][_0x706e('0x4d')]({'where':{'id':_0x58e0a4[_0x706e('0x4a')]['id']}})[_0x706e('0x28')](function(_0x9e4fdc){return db[_0x706e('0x6a')][_0x706e('0x6b')](function(_0x26c741){return _0x9e4fdc['removeTeams'](_0x58e0a4[_0x706e('0x37')][_0x706e('0x64')],{'transaction':_0x26c741})[_0x706e('0x28')](function(){if(!_[_0x706e('0x84')](_0x285afc)){return _0x9e4fdc[_0x706e('0x85')](_0x285afc,{'transaction':_0x26c741});}})[_0x706e('0x28')](function(){_0x285afc[_0x706e('0x6f')](function(_0x551846){socket[_0x706e('0x70')](_0x706e('0x86'),{'UserId':_0x551846,'WhatsappQueueId':_0x9e4fdc['id']});});});});});});})[_0x706e('0x28')](respondWithStatusCode(_0x19070e,null))[_0x706e('0x49')](handleError(_0x19070e,null));};exports['addAgents']=function(_0x5605f8,_0x278287,_0x32f2c5){return db['WhatsappQueue'][_0x706e('0x4d')]({'where':{'id':_0x5605f8[_0x706e('0x4a')]['id']}})[_0x706e('0x28')](handleEntityNotFound(_0x278287,null))[_0x706e('0x28')](function(_0x4e60a5){if(_0x4e60a5){return _0x4e60a5[_0x706e('0x87')](_0x5605f8[_0x706e('0x4f')][_0x706e('0x64')],_[_0x706e('0x88')](_0x5605f8[_0x706e('0x4f')],[_0x706e('0x64'),'id'])||{})['spread'](function(_0x3161f9){for(var _0x46d93a=0x0;_0x46d93a<_0x5605f8[_0x706e('0x4f')][_0x706e('0x64')][_0x706e('0x3c')];_0x46d93a+=0x1){socket[_0x706e('0x70')](_0x706e('0x71'),{'UserId':Number(_0x5605f8[_0x706e('0x4f')]['ids'][_0x46d93a]),'WhatsappQueueId':Number(_0x5605f8[_0x706e('0x4a')]['id'])});}return _0x3161f9;});}})[_0x706e('0x28')](respondWithResult(_0x278287,null))['catch'](handleError(_0x278287,null));};exports[_0x706e('0x85')]=function(_0x8df78b,_0x5e041e,_0x300513){return db['WhatsappQueue'][_0x706e('0x4d')]({'where':{'id':_0x8df78b[_0x706e('0x4a')]['id']}})[_0x706e('0x28')](handleEntityNotFound(_0x5e041e,null))[_0x706e('0x28')](function(_0x4faea7){if(_0x4faea7){return _0x4faea7[_0x706e('0x85')](_0x8df78b[_0x706e('0x37')][_0x706e('0x64')])[_0x706e('0x28')](function(){if(_[_0x706e('0x89')](_0x8df78b[_0x706e('0x37')][_0x706e('0x64')])){for(var _0x2b7c11=0x0;_0x2b7c11<_0x8df78b[_0x706e('0x37')]['ids'][_0x706e('0x3c')];_0x2b7c11+=0x1){socket[_0x706e('0x70')](_0x706e('0x86'),{'UserId':Number(_0x8df78b[_0x706e('0x37')]['ids'][_0x2b7c11]),'WhatsappQueueId':Number(_0x8df78b[_0x706e('0x4a')]['id'])});}}else{socket[_0x706e('0x70')](_0x706e('0x86'),{'UserId':Number(_0x8df78b['query'][_0x706e('0x64')]),'WhatsappQueueId':Number(_0x8df78b[_0x706e('0x4a')]['id'])});}});}})[_0x706e('0x28')](respondWithStatusCode(_0x5e041e,null))[_0x706e('0x49')](handleError(_0x5e041e,null));};exports[_0x706e('0x8a')]=function(_0x2129a3,_0x3a88ab,_0x13d6e0){var _0x1d6cb6={};var _0x18c696={};var _0x260cfc;var _0x171d03;return db[_0x706e('0x31')][_0x706e('0x56')]({'where':{'id':_0x2129a3[_0x706e('0x4a')]['id']}})[_0x706e('0x28')](handleEntityNotFound(_0x3a88ab,null))['then'](function(_0x6f6878){if(_0x6f6878){_0x260cfc=_0x6f6878;_0x18c696['model']=_[_0x706e('0x38')](db['User'][_0x706e('0x4b')]);_0x18c696[_0x706e('0x37')]=_[_0x706e('0x38')](_0x2129a3[_0x706e('0x37')]);_0x18c696[_0x706e('0x41')]=_['intersection'](_0x18c696[_0x706e('0x35')],_0x18c696['query']);_0x1d6cb6[_0x706e('0x3a')]=_[_0x706e('0x39')](_0x18c696[_0x706e('0x35')],qs[_0x706e('0x3b')](_0x2129a3[_0x706e('0x37')][_0x706e('0x3b')]));_0x1d6cb6[_0x706e('0x3a')]=_0x1d6cb6[_0x706e('0x3a')][_0x706e('0x3c')]?_0x1d6cb6['attributes']:_0x18c696[_0x706e('0x35')];_0x1d6cb6[_0x706e('0x3e')]=qs[_0x706e('0x3f')](_0x2129a3['query'][_0x706e('0x3f')]);_0x1d6cb6[_0x706e('0x40')]=qs[_0x706e('0x41')](_[_0x706e('0x57')](_0x2129a3[_0x706e('0x37')],_0x18c696[_0x706e('0x41')]));if(_0x2129a3[_0x706e('0x37')]['filter']){_0x1d6cb6[_0x706e('0x40')]=_[_0x706e('0x43')](_0x1d6cb6[_0x706e('0x40')],{'$or':_[_0x706e('0x36')](_0x1d6cb6[_0x706e('0x3a')],function(_0x30a5b2){var _0x22a9f7={};_0x22a9f7[_0x30a5b2]={'$like':'%'+_0x2129a3[_0x706e('0x37')][_0x706e('0x42')]+'%'};return _0x22a9f7;})});}_0x1d6cb6=_[_0x706e('0x43')]({},_0x1d6cb6,_0x2129a3['options']);return _0x260cfc['getAgents'](_0x1d6cb6);}})[_0x706e('0x28')](function(_0x4439f8){if(_0x4439f8){_0x171d03=_0x4439f8[_0x706e('0x3c')];if(!_0x2129a3[_0x706e('0x37')][_0x706e('0x8b')](_0x706e('0x3d'))){_0x1d6cb6[_0x706e('0x20')]=qs[_0x706e('0x20')](_0x2129a3[_0x706e('0x37')][_0x706e('0x20')]);_0x1d6cb6[_0x706e('0x22')]=qs[_0x706e('0x22')](_0x2129a3['query']['offset']);}return _0x260cfc[_0x706e('0x8a')](_0x1d6cb6);}})[_0x706e('0x28')](function(_0x3ccf35){if(_0x3ccf35){return _0x3ccf35?{'count':_0x171d03,'rows':_0x3ccf35}:null;}})['then'](respondWithResult(_0x3a88ab,null))[_0x706e('0x49')](handleError(_0x3a88ab,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 32ed98d..fb0d04d 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 _0xd84f=['save','update','remove','emit','exports','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x8261bb,_0x48e718){var _0x530867=function(_0x4b2b4e){while(--_0x4b2b4e){_0x8261bb['push'](_0x8261bb['shift']());}};_0x530867(++_0x48e718);}(_0xd84f,0x1ed));var _0xfd84=function(_0x916258,_0x406e00){_0x916258=_0x916258-0x0;var _0x38a153=_0xd84f[_0x916258];return _0x38a153;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xfd84('0x0'))['db'][_0xfd84('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xfd84('0x2')](0x0);var events={'afterCreate':_0xfd84('0x3'),'afterUpdate':_0xfd84('0x4'),'afterDestroy':_0xfd84('0x5')};function emitEvent(_0x1ecd6c){return function(_0x524ba1,_0x396457,_0x1bd434){WhatsappQueueEvents[_0xfd84('0x6')](_0x1ecd6c+':'+_0x524ba1['id'],_0x524ba1);WhatsappQueueEvents[_0xfd84('0x6')](_0x1ecd6c,_0x524ba1);_0x1bd434(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xfd84('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xf0c3=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappQueue'];(function(_0x3082e1,_0x1e9248){var _0x26fdea=function(_0x2acede){while(--_0x2acede){_0x3082e1['push'](_0x3082e1['shift']());}};_0x26fdea(++_0x1e9248);}(_0xf0c3,0x9d));var _0x3f0c=function(_0x9d4d51,_0x3e61d3){_0x9d4d51=_0x9d4d51-0x0;var _0x69aa95=_0xf0c3[_0x9d4d51];return _0x69aa95;};'use strict';var EventEmitter=require(_0x3f0c('0x0'));var WhatsappQueue=require(_0x3f0c('0x1'))['db'][_0x3f0c('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x3f0c('0x3')](0x0);var events={'afterCreate':_0x3f0c('0x4'),'afterUpdate':_0x3f0c('0x5'),'afterDestroy':_0x3f0c('0x6')};function emitEvent(_0x2ceb50){return function(_0x2c5d97,_0x4857bd,_0x1f5e69){WhatsappQueueEvents[_0x3f0c('0x7')](_0x2ceb50+':'+_0x2c5d97['id'],_0x2c5d97);WhatsappQueueEvents['emit'](_0x2ceb50,_0x2c5d97);_0x1f5e69(null);};}for(var e in events){if(events[_0x3f0c('0x8')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x3f0c('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 6de7944..053c48b 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 _0x9efa=['request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','util','../../config/logger','api','moment'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x9efa,0x96));var _0xa9ef=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x9efa[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var util=require(_0xa9ef('0x0'));var logger=require(_0xa9ef('0x1'))(_0xa9ef('0x2'));var moment=require(_0xa9ef('0x3'));var BPromise=require('bluebird');var rp=require(_0xa9ef('0x4'));var fs=require('fs');var path=require(_0xa9ef('0x5'));var rimraf=require(_0xa9ef('0x6'));var config=require(_0xa9ef('0x7'));var attributes=require(_0xa9ef('0x8'));module[_0xa9ef('0x9')]=function(_0x351e83,_0x52480e){return _0x351e83['define'](_0xa9ef('0xa'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9941=['WhatsappQueue','lodash','../../config/logger','api','bluebird','rimraf','exports'];(function(_0x57ae65,_0x481e17){var _0x3e8633=function(_0x1962c9){while(--_0x1962c9){_0x57ae65['push'](_0x57ae65['shift']());}};_0x3e8633(++_0x481e17);}(_0x9941,0x14a));var _0x1994=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x9941[_0x1d1d09];return _0x8827e;};'use strict';var _=require(_0x1994('0x0'));var util=require('util');var logger=require(_0x1994('0x1'))(_0x1994('0x2'));var moment=require('moment');var BPromise=require(_0x1994('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1994('0x4'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x1994('0x5')]=function(_0x4626d5,_0x1503a7){return _0x4626d5['define'](_0x1994('0x6'),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 06affa8..d969ed6 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 _0x46ef=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','raw','options','where','attributes','limit','map','model','include','find','ShowWhatsappQueue','lodash','util','moment'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x46ef,0xcf));var _0xf46e=function(_0x388acd,_0x3afea3){_0x388acd=_0x388acd-0x0;var _0x57a2da=_0x46ef[_0x388acd];return _0x57a2da;};'use strict';var _=require(_0xf46e('0x0'));var util=require(_0xf46e('0x1'));var moment=require(_0xf46e('0x2'));var BPromise=require(_0xf46e('0x3'));var rs=require(_0xf46e('0x4'));var fs=require('fs');var Redis=require(_0xf46e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf46e('0x6'));var logger=require(_0xf46e('0x7'))('rpc');var config=require(_0xf46e('0x8'));var jayson=require(_0xf46e('0x9'));var client=jayson[_0xf46e('0xa')][_0xf46e('0xb')]({'port':0x232a});config['redis']=_[_0xf46e('0xc')](config[_0xf46e('0xd')],{'host':_0xf46e('0xe'),'port':0x18eb});var socket=require(_0xf46e('0xf'))(new Redis(config[_0xf46e('0xd')]));require('./whatsappQueue.socket')[_0xf46e('0x10')](socket);function respondWithRpcPromise(_0x2c76e5,_0x574341,_0x22d90f){return new BPromise(function(_0x339549,_0xf877d){return client['request'](_0x2c76e5,_0x22d90f)[_0xf46e('0x11')](function(_0x52872b){logger[_0xf46e('0x12')](_0xf46e('0x13'),_0x574341,_0xf46e('0x14'));logger[_0xf46e('0x15')](_0xf46e('0x16'),_0x574341,_0xf46e('0x14'),JSON[_0xf46e('0x17')](_0x52872b));if(_0x52872b['error']){if(_0x52872b['error'][_0xf46e('0x18')]===0x1f4){logger[_0xf46e('0x19')](_0xf46e('0x13'),_0x574341,_0x52872b[_0xf46e('0x19')][_0xf46e('0x1a')]);return _0xf877d(_0x52872b[_0xf46e('0x19')][_0xf46e('0x1a')]);}logger[_0xf46e('0x19')](_0xf46e('0x13'),_0x574341,_0x52872b[_0xf46e('0x19')][_0xf46e('0x1a')]);return _0x339549(_0x52872b[_0xf46e('0x19')][_0xf46e('0x1a')]);}else{logger[_0xf46e('0x12')](_0xf46e('0x13'),_0x574341,_0xf46e('0x14'));_0x339549(_0x52872b[_0xf46e('0x1b')][_0xf46e('0x1a')]);}})[_0xf46e('0x1c')](function(_0x26a7dc){logger[_0xf46e('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x574341,_0x26a7dc);_0xf877d(_0x26a7dc);});});}exports[_0xf46e('0x1d')]=function(_0x17bace){var _0x5d4ea2=this;return new Promise(function(_0x259512,_0x5e100b){return db[_0xf46e('0x1e')][_0xf46e('0x1f')]({'raw':_0x17bace['options']?_0x17bace['options'][_0xf46e('0x20')]===undefined?!![]:![]:!![],'where':_0x17bace[_0xf46e('0x21')]?_0x17bace[_0xf46e('0x21')][_0xf46e('0x22')]||null:null,'attributes':_0x17bace[_0xf46e('0x21')]?_0x17bace['options'][_0xf46e('0x23')]||null:null,'limit':_0x17bace[_0xf46e('0x21')]?_0x17bace[_0xf46e('0x21')][_0xf46e('0x24')]||null:null,'include':_0x17bace['options']?_0x17bace[_0xf46e('0x21')]['include']?_[_0xf46e('0x25')](_0x17bace[_0xf46e('0x21')]['include'],function(_0x2aca61){return{'model':db[_0x2aca61[_0xf46e('0x26')]],'as':_0x2aca61['as'],'attributes':_0x2aca61[_0xf46e('0x23')],'include':_0x2aca61[_0xf46e('0x27')]?_[_0xf46e('0x25')](_0x2aca61[_0xf46e('0x27')],function(_0x59ca22){return{'model':db[_0x59ca22[_0xf46e('0x26')]],'as':_0x59ca22['as'],'attributes':_0x59ca22[_0xf46e('0x23')],'include':_0x59ca22[_0xf46e('0x27')]?_[_0xf46e('0x25')](_0x59ca22[_0xf46e('0x27')],function(_0x11933c){return{'model':db[_0x11933c[_0xf46e('0x26')]],'as':_0x11933c['as'],'attributes':_0x11933c[_0xf46e('0x23')]};}):[]};}):[]};}):[]:[]})[_0xf46e('0x11')](function(_0x36e2ad){logger[_0xf46e('0x12')]('GetWhatsappQueue',_0x17bace);logger[_0xf46e('0x15')](_0xf46e('0x1d'),_0x17bace,JSON[_0xf46e('0x17')](_0x36e2ad));_0x259512(_0x36e2ad);})[_0xf46e('0x1c')](function(_0x32b9a1){logger[_0xf46e('0x19')]('GetWhatsappQueue',_0x32b9a1['message'],_0x17bace);_0x5e100b(_0x5d4ea2[_0xf46e('0x19')](0x1f4,_0x32b9a1[_0xf46e('0x1a')]));});});};exports['ShowWhatsappQueue']=function(_0x3f9277){var _0x44cac4=this;return new Promise(function(_0x12e0cc,_0x4f12a1){return db['WhatsappQueue'][_0xf46e('0x28')]({'raw':_0x3f9277[_0xf46e('0x21')]?_0x3f9277['options'][_0xf46e('0x20')]===undefined?!![]:![]:!![],'where':_0x3f9277[_0xf46e('0x21')]?_0x3f9277[_0xf46e('0x21')][_0xf46e('0x22')]||null:null,'attributes':_0x3f9277[_0xf46e('0x21')]?_0x3f9277['options'][_0xf46e('0x23')]||null:null,'include':_0x3f9277[_0xf46e('0x21')]?_0x3f9277[_0xf46e('0x21')]['include']?_[_0xf46e('0x25')](_0x3f9277[_0xf46e('0x21')][_0xf46e('0x27')],function(_0x47a942){return{'model':db[_0x47a942['model']],'as':_0x47a942['as'],'attributes':_0x47a942['attributes'],'include':_0x47a942['include']?_['map'](_0x47a942[_0xf46e('0x27')],function(_0x276e00){return{'model':db[_0x276e00['model']],'as':_0x276e00['as'],'attributes':_0x276e00['attributes'],'include':_0x276e00[_0xf46e('0x27')]?_['map'](_0x276e00['include'],function(_0x2c6c66){return{'model':db[_0x2c6c66[_0xf46e('0x26')]],'as':_0x2c6c66['as'],'attributes':_0x2c6c66[_0xf46e('0x23')]};}):[]};}):[]};}):[]:[]})[_0xf46e('0x11')](function(_0x151959){logger['info'](_0xf46e('0x29'),_0x3f9277);logger[_0xf46e('0x15')]('ShowWhatsappQueue',_0x3f9277,JSON[_0xf46e('0x17')](_0x151959));_0x12e0cc(_0x151959);})['catch'](function(_0x5762a8){logger[_0xf46e('0x19')](_0xf46e('0x29'),_0x5762a8['message'],_0x3f9277);_0x4f12a1(_0x44cac4[_0xf46e('0x19')](0x1f4,_0x5762a8[_0xf46e('0x1a')]));});});}; \ No newline at end of file +var _0xa810=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','limit','include','map','model','then','debug','ShowWhatsappQueue','find','where','util','moment','bluebird','randomstring','ioredis'];(function(_0x35e4b3,_0x124a14){var _0x1e2822=function(_0x2a7075){while(--_0x2a7075){_0x35e4b3['push'](_0x35e4b3['shift']());}};_0x1e2822(++_0x124a14);}(_0xa810,0x1d4));var _0x0a81=function(_0x1be03d,_0x46cccf){_0x1be03d=_0x1be03d-0x0;var _0x45aeda=_0xa810[_0x1be03d];return _0x45aeda;};'use strict';var _=require('lodash');var util=require(_0x0a81('0x0'));var moment=require(_0x0a81('0x1'));var BPromise=require(_0x0a81('0x2'));var rs=require(_0x0a81('0x3'));var fs=require('fs');var Redis=require(_0x0a81('0x4'));var db=require(_0x0a81('0x5'))['db'];var utils=require(_0x0a81('0x6'));var logger=require(_0x0a81('0x7'))('rpc');var config=require(_0x0a81('0x8'));var jayson=require(_0x0a81('0x9'));var client=jayson[_0x0a81('0xa')][_0x0a81('0xb')]({'port':0x232a});config['redis']=_[_0x0a81('0xc')](config[_0x0a81('0xd')],{'host':_0x0a81('0xe'),'port':0x18eb});var socket=require(_0x0a81('0xf'))(new Redis(config[_0x0a81('0xd')]));require('./whatsappQueue.socket')[_0x0a81('0x10')](socket);function respondWithRpcPromise(_0x1f2d3c,_0x554f5d,_0x40bb20){return new BPromise(function(_0x2976b2,_0x203d62){return client[_0x0a81('0x11')](_0x1f2d3c,_0x40bb20)['then'](function(_0x34c97b){logger[_0x0a81('0x12')](_0x0a81('0x13'),_0x554f5d,_0x0a81('0x14'));logger['debug'](_0x0a81('0x15'),_0x554f5d,_0x0a81('0x14'),JSON[_0x0a81('0x16')](_0x34c97b));if(_0x34c97b[_0x0a81('0x17')]){if(_0x34c97b['error'][_0x0a81('0x18')]===0x1f4){logger[_0x0a81('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x554f5d,_0x34c97b[_0x0a81('0x17')][_0x0a81('0x19')]);return _0x203d62(_0x34c97b[_0x0a81('0x17')][_0x0a81('0x19')]);}logger[_0x0a81('0x17')](_0x0a81('0x13'),_0x554f5d,_0x34c97b[_0x0a81('0x17')][_0x0a81('0x19')]);return _0x2976b2(_0x34c97b['error']['message']);}else{logger['info'](_0x0a81('0x13'),_0x554f5d,'request\x20sent');_0x2976b2(_0x34c97b[_0x0a81('0x1a')][_0x0a81('0x19')]);}})[_0x0a81('0x1b')](function(_0x5cd24d){logger[_0x0a81('0x17')](_0x0a81('0x13'),_0x554f5d,_0x5cd24d);_0x203d62(_0x5cd24d);});});}exports[_0x0a81('0x1c')]=function(_0xd943f6){var _0x119ef4=this;return new Promise(function(_0x3db2fa,_0x20c9f8){return db[_0x0a81('0x1d')][_0x0a81('0x1e')]({'raw':_0xd943f6[_0x0a81('0x1f')]?_0xd943f6[_0x0a81('0x1f')][_0x0a81('0x20')]===undefined?!![]:![]:!![],'where':_0xd943f6['options']?_0xd943f6[_0x0a81('0x1f')]['where']||null:null,'attributes':_0xd943f6[_0x0a81('0x1f')]?_0xd943f6[_0x0a81('0x1f')][_0x0a81('0x21')]||null:null,'limit':_0xd943f6['options']?_0xd943f6[_0x0a81('0x1f')][_0x0a81('0x22')]||null:null,'include':_0xd943f6['options']?_0xd943f6['options'][_0x0a81('0x23')]?_[_0x0a81('0x24')](_0xd943f6[_0x0a81('0x1f')][_0x0a81('0x23')],function(_0x5c16ef){return{'model':db[_0x5c16ef[_0x0a81('0x25')]],'as':_0x5c16ef['as'],'attributes':_0x5c16ef['attributes'],'include':_0x5c16ef[_0x0a81('0x23')]?_[_0x0a81('0x24')](_0x5c16ef[_0x0a81('0x23')],function(_0x12e750){return{'model':db[_0x12e750[_0x0a81('0x25')]],'as':_0x12e750['as'],'attributes':_0x12e750[_0x0a81('0x21')],'include':_0x12e750[_0x0a81('0x23')]?_[_0x0a81('0x24')](_0x12e750[_0x0a81('0x23')],function(_0x1da2d7){return{'model':db[_0x1da2d7[_0x0a81('0x25')]],'as':_0x1da2d7['as'],'attributes':_0x1da2d7[_0x0a81('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0a81('0x26')](function(_0x254f0c){logger[_0x0a81('0x12')](_0x0a81('0x1c'),_0xd943f6);logger[_0x0a81('0x27')](_0x0a81('0x1c'),_0xd943f6,JSON[_0x0a81('0x16')](_0x254f0c));_0x3db2fa(_0x254f0c);})['catch'](function(_0xbcc028){logger[_0x0a81('0x17')](_0x0a81('0x1c'),_0xbcc028[_0x0a81('0x19')],_0xd943f6);_0x20c9f8(_0x119ef4[_0x0a81('0x17')](0x1f4,_0xbcc028['message']));});});};exports[_0x0a81('0x28')]=function(_0x43e846){var _0xe0df84=this;return new Promise(function(_0x2ffea4,_0x5562c4){return db['WhatsappQueue'][_0x0a81('0x29')]({'raw':_0x43e846[_0x0a81('0x1f')]?_0x43e846[_0x0a81('0x1f')][_0x0a81('0x20')]===undefined?!![]:![]:!![],'where':_0x43e846[_0x0a81('0x1f')]?_0x43e846[_0x0a81('0x1f')][_0x0a81('0x2a')]||null:null,'attributes':_0x43e846[_0x0a81('0x1f')]?_0x43e846['options'][_0x0a81('0x21')]||null:null,'include':_0x43e846[_0x0a81('0x1f')]?_0x43e846[_0x0a81('0x1f')][_0x0a81('0x23')]?_[_0x0a81('0x24')](_0x43e846[_0x0a81('0x1f')][_0x0a81('0x23')],function(_0x52e053){return{'model':db[_0x52e053['model']],'as':_0x52e053['as'],'attributes':_0x52e053[_0x0a81('0x21')],'include':_0x52e053[_0x0a81('0x23')]?_['map'](_0x52e053['include'],function(_0x757674){return{'model':db[_0x757674[_0x0a81('0x25')]],'as':_0x757674['as'],'attributes':_0x757674[_0x0a81('0x21')],'include':_0x757674[_0x0a81('0x23')]?_[_0x0a81('0x24')](_0x757674[_0x0a81('0x23')],function(_0x12a273){return{'model':db[_0x12a273[_0x0a81('0x25')]],'as':_0x12a273['as'],'attributes':_0x12a273[_0x0a81('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0a81('0x26')](function(_0x5b8992){logger['info'](_0x0a81('0x28'),_0x43e846);logger[_0x0a81('0x27')](_0x0a81('0x28'),_0x43e846,JSON[_0x0a81('0x16')](_0x5b8992));_0x2ffea4(_0x5b8992);})[_0x0a81('0x1b')](function(_0x233015){logger[_0x0a81('0x17')]('ShowWhatsappQueue',_0x233015[_0x0a81('0x19')],_0x43e846);_0x5562c4(_0xe0df84[_0x0a81('0x17')](0x1f4,_0x233015[_0x0a81('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 0a4723d..40d996c 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 _0xbed9=['update','emit','register','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x57f951,_0x4c6cd5){var _0x4243e0=function(_0x87cefe){while(--_0x87cefe){_0x57f951['push'](_0x57f951['shift']());}};_0x4243e0(++_0x4c6cd5);}(_0xbed9,0x12a));var _0x9bed=function(_0x1d035b,_0x515523){_0x1d035b=_0x1d035b-0x0;var _0x3fcab1=_0xbed9[_0x1d035b];return _0x3fcab1;};'use strict';var WhatsappQueueEvents=require(_0x9bed('0x0'));var events=[_0x9bed('0x1'),'remove',_0x9bed('0x2')];function createListener(_0x2dca70,_0x48155e){return function(_0x156519){_0x48155e[_0x9bed('0x3')](_0x2dca70,_0x156519);};}function removeListener(_0x4a3e6e,_0x380f6c){return function(){WhatsappQueueEvents['removeListener'](_0x4a3e6e,_0x380f6c);};}exports[_0x9bed('0x4')]=function(_0x5bdd8e){for(var _0xee95b2=0x0,_0x28d916=events['length'];_0xee95b2<_0x28d916;_0xee95b2++){var _0x4b1bc0=events[_0xee95b2];var _0x459959=createListener(_0x9bed('0x5')+_0x4b1bc0,_0x5bdd8e);WhatsappQueueEvents['on'](_0x4b1bc0,_0x459959);}}; \ No newline at end of file +var _0xb1ff=['whatsappQueue:','./whatsappQueue.events','update','emit','removeListener','register','length'];(function(_0x549996,_0xd04634){var _0x4de5d1=function(_0x1883a7){while(--_0x1883a7){_0x549996['push'](_0x549996['shift']());}};_0x4de5d1(++_0xd04634);}(_0xb1ff,0x1c8));var _0xfb1f=function(_0x5e7b6c,_0x4916d0){_0x5e7b6c=_0x5e7b6c-0x0;var _0x3afdbd=_0xb1ff[_0x5e7b6c];return _0x3afdbd;};'use strict';var WhatsappQueueEvents=require(_0xfb1f('0x0'));var events=['save','remove',_0xfb1f('0x1')];function createListener(_0x1c15ba,_0x18c475){return function(_0x211828){_0x18c475[_0xfb1f('0x2')](_0x1c15ba,_0x211828);};}function removeListener(_0x579ca5,_0x12678b){return function(){WhatsappQueueEvents[_0xfb1f('0x3')](_0x579ca5,_0x12678b);};}exports[_0xfb1f('0x4')]=function(_0xcef878){for(var _0x81d7ae=0x0,_0x2f3338=events[_0xfb1f('0x5')];_0x81d7ae<_0x2f3338;_0x81d7ae++){var _0x29bbc9=events[_0x81d7ae];var _0x4221f8=createListener(_0xfb1f('0x6')+_0x29bbc9,_0xcef878);WhatsappQueueEvents['on'](_0x29bbc9,_0x4221f8);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index d445c21..93c0c8c 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 _0xeebc=['exports','multer','path','express','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x134511,_0x16d233){var _0xf91a5b=function(_0x323e5e){while(--_0x323e5e){_0x134511['push'](_0x134511['shift']());}};_0xf91a5b(++_0x16d233);}(_0xeebc,0x79));var _0xceeb=function(_0x196bbf,_0x3a0d24){_0x196bbf=_0x196bbf-0x0;var _0x155966=_0xeebc[_0x196bbf];return _0x155966;};'use strict';var multer=require(_0xceeb('0x0'));var util=require('util');var path=require(_0xceeb('0x1'));var timeout=require('connect-timeout');var express=require(_0xceeb('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xceeb('0x3'));var config=require(_0xceeb('0x4'));var controller=require(_0xceeb('0x5'));router[_0xceeb('0x6')]('/',auth[_0xceeb('0x7')](),controller[_0xceeb('0x8')]);router[_0xceeb('0x6')](_0xceeb('0x9'),auth[_0xceeb('0x7')](),controller[_0xceeb('0xa')]);router['get'](_0xceeb('0xb'),auth[_0xceeb('0x7')](),controller[_0xceeb('0xc')]);router[_0xceeb('0xd')]('/',auth[_0xceeb('0x7')](),controller[_0xceeb('0xe')]);router[_0xceeb('0xf')](_0xceeb('0xb'),auth[_0xceeb('0x7')](),controller[_0xceeb('0x10')]);router[_0xceeb('0x11')]('/:id',auth[_0xceeb('0x7')](),controller[_0xceeb('0x12')]);module[_0xceeb('0x13')]=router; \ No newline at end of file +var _0x1c96=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','/describe','describe','create','put','/:id','update','delete'];(function(_0x16410f,_0x2c9289){var _0x453146=function(_0x4cfedd){while(--_0x4cfedd){_0x16410f['push'](_0x16410f['shift']());}};_0x453146(++_0x2c9289);}(_0x1c96,0x1c3));var _0x61c9=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0x1c96[_0x79b649];return _0x1af9b1;};'use strict';var multer=require(_0x61c9('0x0'));var util=require(_0x61c9('0x1'));var path=require('path');var timeout=require(_0x61c9('0x2'));var express=require(_0x61c9('0x3'));var router=express[_0x61c9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x61c9('0x5'));var interaction=require(_0x61c9('0x6'));var config=require(_0x61c9('0x7'));var controller=require(_0x61c9('0x8'));router['get']('/',auth[_0x61c9('0x9')](),controller['index']);router['get'](_0x61c9('0xa'),auth[_0x61c9('0x9')](),controller[_0x61c9('0xb')]);router['get']('/:id',auth[_0x61c9('0x9')](),controller['show']);router['post']('/',auth[_0x61c9('0x9')](),controller[_0x61c9('0xc')]);router[_0x61c9('0xd')](_0x61c9('0xe'),auth[_0x61c9('0x9')](),controller[_0x61c9('0xf')]);router[_0x61c9('0x10')](_0x61c9('0xe'),auth[_0x61c9('0x9')](),controller['destroy']);module[_0x61c9('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index e49e7df..8d6a8e0 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(_0x17c18f,_0x26621c){var _0xcfe29c=function(_0x4688be){while(--_0x4688be){_0x17c18f['push'](_0x17c18f['shift']());}};_0xcfe29c(++_0x26621c);}(_0x7a54,0x106));var _0x47a5=function(_0x44ea90,_0x12a4d2){_0x44ea90=_0x44ea90-0x0;var _0x3b975a=_0x7a54[_0x44ea90];return _0x3b975a;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x1ac260,_0x21e3c6){var _0x3e9412=function(_0x3a1148){while(--_0x3a1148){_0x1ac260['push'](_0x1ac260['shift']());}};_0x3e9412(++_0x21e3c6);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 9d7d0c6..ed2828b 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 _0x1c7c=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','error','name','index','map','WhatsappQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x7feb90,_0x28e700){var _0x3c5b33=function(_0x113cfa){while(--_0x113cfa){_0x7feb90['push'](_0x7feb90['shift']());}};_0x3c5b33(++_0x28e700);}(_0x1c7c,0x164));var _0xc1c7=function(_0x4fbde0,_0x47c1a0){_0x4fbde0=_0x4fbde0-0x0;var _0xe5be4d=_0x1c7c[_0x4fbde0];return _0xe5be4d;};'use strict';var emlformat=require(_0xc1c7('0x0'));var rimraf=require(_0xc1c7('0x1'));var zipdir=require(_0xc1c7('0x2'));var jsonpatch=require(_0xc1c7('0x3'));var rp=require('request-promise');var moment=require(_0xc1c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1c7('0x5'));var util=require(_0xc1c7('0x6'));var path=require(_0xc1c7('0x7'));var sox=require(_0xc1c7('0x8'));var csv=require(_0xc1c7('0x9'));var ejs=require(_0xc1c7('0xa'));var fs=require('fs');var fs_extra=require(_0xc1c7('0xb'));var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0x9'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c7('0x1a'))['db'];function respondWithStatusCode(_0x44bf88,_0x376cab){_0x376cab=_0x376cab||0xcc;return function(_0x35feaa){if(_0x35feaa){return _0x44bf88[_0xc1c7('0x1b')](_0x376cab);}return _0x44bf88[_0xc1c7('0x1c')](_0x376cab)[_0xc1c7('0x1d')]();};}function respondWithResult(_0x1b57ab,_0xdfc7d9){_0xdfc7d9=_0xdfc7d9||0xc8;return function(_0x1b6905){if(_0x1b6905){return _0x1b57ab[_0xc1c7('0x1c')](_0xdfc7d9)[_0xc1c7('0x1e')](_0x1b6905);}};}function respondWithFilteredResult(_0x49576d,_0x3e1f0e){return function(_0x335600){if(_0x335600){var _0x21911c=typeof _0x3e1f0e['offset']===_0xc1c7('0x1f')&&typeof _0x3e1f0e[_0xc1c7('0x20')]===_0xc1c7('0x1f');var _0x39ac54=_0x335600[_0xc1c7('0x21')];var _0xb42702=_0x21911c?0x0:_0x3e1f0e[_0xc1c7('0x22')];var _0x2e93e5=_0x21911c?_0x335600['count']:_0x3e1f0e[_0xc1c7('0x22')]+_0x3e1f0e[_0xc1c7('0x20')];var _0x3ec66a;if(_0x2e93e5>=_0x39ac54){_0x2e93e5=_0x39ac54;_0x3ec66a=0xc8;}else{_0x3ec66a=0xce;}_0x49576d[_0xc1c7('0x1c')](_0x3ec66a);return _0x49576d['set'](_0xc1c7('0x23'),_0xb42702+'-'+_0x2e93e5+'/'+_0x39ac54)['json'](_0x335600);}return null;};}function patchUpdates(_0x5e7e4a){return function(_0x195c5f){try{jsonpatch['apply'](_0x195c5f,_0x5e7e4a,!![]);}catch(_0x5846f0){return BPromise[_0xc1c7('0x24')](_0x5846f0);}return _0x195c5f[_0xc1c7('0x25')]();};}function saveUpdates(_0x2f1b87,_0x4c6b34){return function(_0x813853){if(_0x813853){return _0x813853[_0xc1c7('0x26')](_0x2f1b87)[_0xc1c7('0x27')](function(_0x31a0e0){return _0x31a0e0;});}return null;};}function removeEntity(_0x2e64c4,_0x3a2483){return function(_0x3180fd){if(_0x3180fd){return _0x3180fd[_0xc1c7('0x28')]()[_0xc1c7('0x27')](function(){_0x2e64c4[_0xc1c7('0x1c')](0xcc)[_0xc1c7('0x1d')]();});}};}function handleEntityNotFound(_0x363fbc,_0x33aac7){return function(_0x260a3f){if(!_0x260a3f){_0x363fbc[_0xc1c7('0x1b')](0x194);}return _0x260a3f;};}function handleError(_0x21563a,_0x5edb34){_0x5edb34=_0x5edb34||0x1f4;return function(_0xf0ab9c){logger[_0xc1c7('0x29')](_0xf0ab9c['stack']);if(_0xf0ab9c['name']){delete _0xf0ab9c[_0xc1c7('0x2a')];}_0x21563a['status'](_0x5edb34)['send'](_0xf0ab9c);};}exports[_0xc1c7('0x2b')]=function(_0x1b873c,_0x46d045){var _0x243450={},_0x461360={},_0x4adb81={'count':0x0,'rows':[]};var _0x574e1c=_[_0xc1c7('0x2c')](db[_0xc1c7('0x2d')][_0xc1c7('0x2e')],function(_0x3a786f){return{'name':_0x3a786f[_0xc1c7('0x2f')],'type':_0x3a786f['type']['key']};});_0x461360[_0xc1c7('0x30')]=_[_0xc1c7('0x2c')](_0x574e1c,'name');_0x461360[_0xc1c7('0x31')]=_[_0xc1c7('0x32')](_0x1b873c[_0xc1c7('0x31')]);_0x461360[_0xc1c7('0x33')]=_[_0xc1c7('0x34')](_0x461360[_0xc1c7('0x30')],_0x461360[_0xc1c7('0x31')]);_0x243450['attributes']=_[_0xc1c7('0x34')](_0x461360[_0xc1c7('0x30')],qs[_0xc1c7('0x35')](_0x1b873c[_0xc1c7('0x31')][_0xc1c7('0x35')]));_0x243450[_0xc1c7('0x36')]=_0x243450[_0xc1c7('0x36')][_0xc1c7('0x37')]?_0x243450[_0xc1c7('0x36')]:_0x461360['model'];if(!_0x1b873c['query'][_0xc1c7('0x38')](_0xc1c7('0x39'))){_0x243450[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x1b873c[_0xc1c7('0x31')][_0xc1c7('0x20')]);_0x243450[_0xc1c7('0x22')]=qs[_0xc1c7('0x22')](_0x1b873c[_0xc1c7('0x31')][_0xc1c7('0x22')]);}_0x243450[_0xc1c7('0x3a')]=qs[_0xc1c7('0x3b')](_0x1b873c[_0xc1c7('0x31')][_0xc1c7('0x3b')]);_0x243450[_0xc1c7('0x3c')]=qs[_0xc1c7('0x33')](_[_0xc1c7('0x3d')](_0x1b873c[_0xc1c7('0x31')],_0x461360[_0xc1c7('0x33')]),_0x574e1c);if(_0x1b873c[_0xc1c7('0x31')][_0xc1c7('0x3e')]){_0x243450['where']=_['merge'](_0x243450['where'],{'$or':_[_0xc1c7('0x2c')](_0x574e1c,function(_0x4f4312){if(_0x4f4312['type']!==_0xc1c7('0x3f')){var _0x24ceb4={};_0x24ceb4[_0x4f4312[_0xc1c7('0x2a')]]={'$like':'%'+_0x1b873c[_0xc1c7('0x31')]['filter']+'%'};return _0x24ceb4;}})});}_0x243450=_[_0xc1c7('0x40')]({},_0x243450,_0x1b873c[_0xc1c7('0x41')]);var _0x32e9fd={'where':_0x243450[_0xc1c7('0x3c')]};return db[_0xc1c7('0x2d')][_0xc1c7('0x21')](_0x32e9fd)[_0xc1c7('0x27')](function(_0x26343d){_0x4adb81[_0xc1c7('0x21')]=_0x26343d;if(_0x1b873c[_0xc1c7('0x31')][_0xc1c7('0x42')]){_0x243450[_0xc1c7('0x43')]=[{'all':!![]}];}return db[_0xc1c7('0x2d')]['findAll'](_0x243450);})[_0xc1c7('0x27')](function(_0x412520){_0x4adb81['rows']=_0x412520;return _0x4adb81;})[_0xc1c7('0x27')](respondWithFilteredResult(_0x46d045,_0x243450))[_0xc1c7('0x44')](handleError(_0x46d045,null));};exports[_0xc1c7('0x45')]=function(_0x7131b1,_0x46a1b5){var _0x2c09de={'raw':!![],'where':{'id':_0x7131b1[_0xc1c7('0x46')]['id']}},_0xd5e06a={};_0xd5e06a[_0xc1c7('0x30')]=_[_0xc1c7('0x32')](db['WhatsappQueueReport'][_0xc1c7('0x2e')]);_0xd5e06a[_0xc1c7('0x31')]=_['keys'](_0x7131b1['query']);_0xd5e06a[_0xc1c7('0x33')]=_[_0xc1c7('0x34')](_0xd5e06a[_0xc1c7('0x30')],_0xd5e06a[_0xc1c7('0x31')]);_0x2c09de[_0xc1c7('0x36')]=_['intersection'](_0xd5e06a[_0xc1c7('0x30')],qs[_0xc1c7('0x35')](_0x7131b1['query']['fields']));_0x2c09de['attributes']=_0x2c09de[_0xc1c7('0x36')][_0xc1c7('0x37')]?_0x2c09de[_0xc1c7('0x36')]:_0xd5e06a['model'];if(_0x7131b1[_0xc1c7('0x31')][_0xc1c7('0x42')]){_0x2c09de['include']=[{'all':!![]}];}_0x2c09de=_[_0xc1c7('0x40')]({},_0x2c09de,_0x7131b1[_0xc1c7('0x41')]);return db[_0xc1c7('0x2d')][_0xc1c7('0x47')](_0x2c09de)[_0xc1c7('0x27')](handleEntityNotFound(_0x46a1b5,null))[_0xc1c7('0x27')](respondWithResult(_0x46a1b5,null))[_0xc1c7('0x44')](handleError(_0x46a1b5,null));};exports[_0xc1c7('0x48')]=function(_0x35141f,_0x3ec5de){return db[_0xc1c7('0x2d')][_0xc1c7('0x48')](_0x35141f[_0xc1c7('0x49')],{})[_0xc1c7('0x27')](respondWithResult(_0x3ec5de,0xc9))[_0xc1c7('0x44')](handleError(_0x3ec5de,null));};exports[_0xc1c7('0x26')]=function(_0x2967b7,_0x1addc8){if(_0x2967b7['body']['id']){delete _0x2967b7[_0xc1c7('0x49')]['id'];}return db['WhatsappQueueReport'][_0xc1c7('0x47')]({'where':{'id':_0x2967b7[_0xc1c7('0x46')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x1addc8,null))['then'](saveUpdates(_0x2967b7[_0xc1c7('0x49')],null))[_0xc1c7('0x27')](respondWithResult(_0x1addc8,null))['catch'](handleError(_0x1addc8,null));};exports['destroy']=function(_0x5c96cc,_0x302185){return db[_0xc1c7('0x2d')]['find']({'where':{'id':_0x5c96cc[_0xc1c7('0x46')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x302185,null))[_0xc1c7('0x27')](removeEntity(_0x302185,null))[_0xc1c7('0x44')](handleError(_0x302185,null));};exports[_0xc1c7('0x4a')]=function(_0x13569a,_0x4cad6a){return db[_0xc1c7('0x2d')]['describe']()[_0xc1c7('0x27')](respondWithResult(_0x4cad6a,null))[_0xc1c7('0x44')](handleError(_0x4cad6a,null));}; \ No newline at end of file +var _0x282b=['intersection','attributes','model','fields','hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','show','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','error','name','send','map','rawAttributes','fieldName','type','key','query','keys'];(function(_0xaf59b6,_0x4c7422){var _0x26a299=function(_0x40c912){while(--_0x40c912){_0xaf59b6['push'](_0xaf59b6['shift']());}};_0x26a299(++_0x4c7422);}(_0x282b,0xec));var _0xb282=function(_0x48fffe,_0x596c09){_0x48fffe=_0x48fffe-0x0;var _0x3fb9d0=_0x282b[_0x48fffe];return _0x3fb9d0;};'use strict';var emlformat=require(_0xb282('0x0'));var rimraf=require(_0xb282('0x1'));var zipdir=require(_0xb282('0x2'));var jsonpatch=require(_0xb282('0x3'));var rp=require(_0xb282('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb282('0x5'));var util=require('util');var path=require(_0xb282('0x6'));var sox=require(_0xb282('0x7'));var csv=require(_0xb282('0x8'));var ejs=require(_0xb282('0x9'));var fs=require('fs');var fs_extra=require(_0xb282('0xa'));var _=require(_0xb282('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb282('0xc'));var deskjs=require(_0xb282('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb282('0xe'));var Papa=require(_0xb282('0xf'));var Redis=require(_0xb282('0x10'));var authService=require(_0xb282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb282('0x12'));var logger=require(_0xb282('0x13'))(_0xb282('0x14'));var utils=require(_0xb282('0x15'));var config=require(_0xb282('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x338bdb,_0xc08746){_0xc08746=_0xc08746||0xcc;return function(_0x40d7b8){if(_0x40d7b8){return _0x338bdb[_0xb282('0x17')](_0xc08746);}return _0x338bdb[_0xb282('0x18')](_0xc08746)['end']();};}function respondWithResult(_0x34c595,_0x5adf7f){_0x5adf7f=_0x5adf7f||0xc8;return function(_0xe1d53){if(_0xe1d53){return _0x34c595[_0xb282('0x18')](_0x5adf7f)['json'](_0xe1d53);}};}function respondWithFilteredResult(_0x525cfa,_0x5bc7c3){return function(_0x13cea1){if(_0x13cea1){var _0x350676=typeof _0x5bc7c3[_0xb282('0x19')]===_0xb282('0x1a')&&typeof _0x5bc7c3[_0xb282('0x1b')]==='undefined';var _0x191a31=_0x13cea1[_0xb282('0x1c')];var _0xca5f12=_0x350676?0x0:_0x5bc7c3[_0xb282('0x19')];var _0x3f8a3f=_0x350676?_0x13cea1['count']:_0x5bc7c3['offset']+_0x5bc7c3[_0xb282('0x1b')];var _0x2cdeb1;if(_0x3f8a3f>=_0x191a31){_0x3f8a3f=_0x191a31;_0x2cdeb1=0xc8;}else{_0x2cdeb1=0xce;}_0x525cfa['status'](_0x2cdeb1);return _0x525cfa[_0xb282('0x1d')](_0xb282('0x1e'),_0xca5f12+'-'+_0x3f8a3f+'/'+_0x191a31)[_0xb282('0x1f')](_0x13cea1);}return null;};}function patchUpdates(_0x438dbe){return function(_0x1c3084){try{jsonpatch['apply'](_0x1c3084,_0x438dbe,!![]);}catch(_0x1de407){return BPromise[_0xb282('0x20')](_0x1de407);}return _0x1c3084[_0xb282('0x21')]();};}function saveUpdates(_0x4b79d7,_0x437d66){return function(_0x2a7ef8){if(_0x2a7ef8){return _0x2a7ef8[_0xb282('0x22')](_0x4b79d7)[_0xb282('0x23')](function(_0x680095){return _0x680095;});}return null;};}function removeEntity(_0x56645f,_0x4d624f){return function(_0x360f15){if(_0x360f15){return _0x360f15[_0xb282('0x24')]()['then'](function(){_0x56645f['status'](0xcc)[_0xb282('0x25')]();});}};}function handleEntityNotFound(_0x114f77,_0x3451e5){return function(_0x3c4018){if(!_0x3c4018){_0x114f77[_0xb282('0x17')](0x194);}return _0x3c4018;};}function handleError(_0x2b1303,_0x5b1d3d){_0x5b1d3d=_0x5b1d3d||0x1f4;return function(_0xa0d7fb){logger[_0xb282('0x26')](_0xa0d7fb['stack']);if(_0xa0d7fb[_0xb282('0x27')]){delete _0xa0d7fb[_0xb282('0x27')];}_0x2b1303[_0xb282('0x18')](_0x5b1d3d)[_0xb282('0x28')](_0xa0d7fb);};}exports['index']=function(_0x1520b1,_0x1fb89f){var _0xe337b8={},_0x433ad5={},_0x4cee93={'count':0x0,'rows':[]};var _0xfddd2e=_[_0xb282('0x29')](db['WhatsappQueueReport'][_0xb282('0x2a')],function(_0x1e2861){return{'name':_0x1e2861[_0xb282('0x2b')],'type':_0x1e2861[_0xb282('0x2c')][_0xb282('0x2d')]};});_0x433ad5['model']=_[_0xb282('0x29')](_0xfddd2e,'name');_0x433ad5[_0xb282('0x2e')]=_[_0xb282('0x2f')](_0x1520b1[_0xb282('0x2e')]);_0x433ad5['filters']=_[_0xb282('0x30')](_0x433ad5['model'],_0x433ad5[_0xb282('0x2e')]);_0xe337b8[_0xb282('0x31')]=_[_0xb282('0x30')](_0x433ad5[_0xb282('0x32')],qs[_0xb282('0x33')](_0x1520b1[_0xb282('0x2e')]['fields']));_0xe337b8[_0xb282('0x31')]=_0xe337b8[_0xb282('0x31')]['length']?_0xe337b8['attributes']:_0x433ad5[_0xb282('0x32')];if(!_0x1520b1[_0xb282('0x2e')][_0xb282('0x34')]('nolimit')){_0xe337b8['limit']=qs['limit'](_0x1520b1[_0xb282('0x2e')][_0xb282('0x1b')]);_0xe337b8[_0xb282('0x19')]=qs[_0xb282('0x19')](_0x1520b1[_0xb282('0x2e')][_0xb282('0x19')]);}_0xe337b8[_0xb282('0x35')]=qs['sort'](_0x1520b1[_0xb282('0x2e')]['sort']);_0xe337b8[_0xb282('0x36')]=qs[_0xb282('0x37')](_[_0xb282('0x38')](_0x1520b1['query'],_0x433ad5[_0xb282('0x37')]),_0xfddd2e);if(_0x1520b1['query'][_0xb282('0x39')]){_0xe337b8[_0xb282('0x36')]=_[_0xb282('0x3a')](_0xe337b8[_0xb282('0x36')],{'$or':_['map'](_0xfddd2e,function(_0x5c86bb){if(_0x5c86bb[_0xb282('0x2c')]!==_0xb282('0x3b')){var _0x3791fd={};_0x3791fd[_0x5c86bb[_0xb282('0x27')]]={'$like':'%'+_0x1520b1['query'][_0xb282('0x39')]+'%'};return _0x3791fd;}})});}_0xe337b8=_['merge']({},_0xe337b8,_0x1520b1[_0xb282('0x3c')]);var _0x1a1b50={'where':_0xe337b8['where']};return db[_0xb282('0x3d')][_0xb282('0x1c')](_0x1a1b50)[_0xb282('0x23')](function(_0x2c988a){_0x4cee93[_0xb282('0x1c')]=_0x2c988a;if(_0x1520b1[_0xb282('0x2e')][_0xb282('0x3e')]){_0xe337b8[_0xb282('0x3f')]=[{'all':!![]}];}return db[_0xb282('0x3d')][_0xb282('0x40')](_0xe337b8);})[_0xb282('0x23')](function(_0x91fe43){_0x4cee93[_0xb282('0x41')]=_0x91fe43;return _0x4cee93;})[_0xb282('0x23')](respondWithFilteredResult(_0x1fb89f,_0xe337b8))[_0xb282('0x42')](handleError(_0x1fb89f,null));};exports[_0xb282('0x43')]=function(_0x2416a4,_0x7332d2){var _0x573da7={'raw':!![],'where':{'id':_0x2416a4['params']['id']}},_0x310ad1={};_0x310ad1[_0xb282('0x32')]=_[_0xb282('0x2f')](db[_0xb282('0x3d')][_0xb282('0x2a')]);_0x310ad1[_0xb282('0x2e')]=_[_0xb282('0x2f')](_0x2416a4['query']);_0x310ad1['filters']=_[_0xb282('0x30')](_0x310ad1['model'],_0x310ad1[_0xb282('0x2e')]);_0x573da7[_0xb282('0x31')]=_['intersection'](_0x310ad1[_0xb282('0x32')],qs[_0xb282('0x33')](_0x2416a4[_0xb282('0x2e')]['fields']));_0x573da7['attributes']=_0x573da7[_0xb282('0x31')]['length']?_0x573da7[_0xb282('0x31')]:_0x310ad1[_0xb282('0x32')];if(_0x2416a4[_0xb282('0x2e')][_0xb282('0x3e')]){_0x573da7[_0xb282('0x3f')]=[{'all':!![]}];}_0x573da7=_[_0xb282('0x3a')]({},_0x573da7,_0x2416a4['options']);return db[_0xb282('0x3d')][_0xb282('0x44')](_0x573da7)[_0xb282('0x23')](handleEntityNotFound(_0x7332d2,null))['then'](respondWithResult(_0x7332d2,null))[_0xb282('0x42')](handleError(_0x7332d2,null));};exports['create']=function(_0x32fc1d,_0x4b0822){return db[_0xb282('0x3d')]['create'](_0x32fc1d['body'],{})['then'](respondWithResult(_0x4b0822,0xc9))[_0xb282('0x42')](handleError(_0x4b0822,null));};exports[_0xb282('0x22')]=function(_0x42d99f,_0x7a5aa4){if(_0x42d99f['body']['id']){delete _0x42d99f['body']['id'];}return db['WhatsappQueueReport'][_0xb282('0x44')]({'where':{'id':_0x42d99f[_0xb282('0x45')]['id']}})[_0xb282('0x23')](handleEntityNotFound(_0x7a5aa4,null))[_0xb282('0x23')](saveUpdates(_0x42d99f['body'],null))[_0xb282('0x23')](respondWithResult(_0x7a5aa4,null))[_0xb282('0x42')](handleError(_0x7a5aa4,null));};exports['destroy']=function(_0x33bded,_0x9f4d79){return db[_0xb282('0x3d')][_0xb282('0x44')]({'where':{'id':_0x33bded[_0xb282('0x45')]['id']}})['then'](handleEntityNotFound(_0x9f4d79,null))[_0xb282('0x23')](removeEntity(_0x9f4d79,null))[_0xb282('0x42')](handleError(_0x9f4d79,null));};exports[_0xb282('0x46')]=function(_0x22d129,_0x308aa8){return db[_0xb282('0x3d')]['describe']()[_0xb282('0x23')](respondWithResult(_0x308aa8,null))['catch'](handleError(_0x308aa8,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 9583a3a..24e8bd4 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 _0x2757=['report_whatsapp_queue','uniqueid','lodash','util','bluebird','path','rimraf','./whatsappQueueReport.attributes','exports','WhatsappQueueReport'];(function(_0x42c1be,_0x3cb873){var _0x3e7faf=function(_0x24a992){while(--_0x24a992){_0x42c1be['push'](_0x42c1be['shift']());}};_0x3e7faf(++_0x3cb873);}(_0x2757,0xca));var _0x7275=function(_0x1ad96d,_0x3eb003){_0x1ad96d=_0x1ad96d-0x0;var _0x30831e=_0x2757[_0x1ad96d];return _0x30831e;};'use strict';var _=require(_0x7275('0x0'));var util=require(_0x7275('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7275('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7275('0x3'));var rimraf=require(_0x7275('0x4'));var config=require('../../config/environment');var attributes=require(_0x7275('0x5'));module[_0x7275('0x6')]=function(_0xa3b78e,_0x4eaef7){return _0xa3b78e['define'](_0x7275('0x7'),attributes,{'tableName':_0x7275('0x8'),'paranoid':![],'indexes':[{'name':_0x7275('0x9'),'fields':[_0x7275('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x19ba=['../../config/logger','moment','bluebird','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','lodash','util'];(function(_0x1ec337,_0x249d31){var _0x1b4508=function(_0x6dafc0){while(--_0x6dafc0){_0x1ec337['push'](_0x1ec337['shift']());}};_0x1b4508(++_0x249d31);}(_0x19ba,0x13d));var _0xa19b=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0x19ba[_0x240261];return _0x45c332;};'use strict';var _=require(_0xa19b('0x0'));var util=require(_0xa19b('0x1'));var logger=require(_0xa19b('0x2'))('api');var moment=require(_0xa19b('0x3'));var BPromise=require(_0xa19b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa19b('0x5'));var config=require(_0xa19b('0x6'));var attributes=require(_0xa19b('0x7'));module[_0xa19b('0x8')]=function(_0x211e55,_0x4cea1e){return _0x211e55[_0xa19b('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0xa19b('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 29cd69b..218803d 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 _0xd0a1=['info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','WhatsappQueueReport','body','options','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','raw','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','request','then'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd0a1,0x1c6));var _0x1d0a=function(_0x2c93a2,_0x1c1e3b){_0x2c93a2=_0x2c93a2-0x0;var _0x5bde6c=_0xd0a1[_0x2c93a2];return _0x5bde6c;};'use strict';var _=require(_0x1d0a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1d0a('0x1'));var rs=require(_0x1d0a('0x2'));var fs=require('fs');var Redis=require(_0x1d0a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d0a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x1d0a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1d0a('0x6')][_0x1d0a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x47d91b,_0x14add6,_0xb10346){return new BPromise(function(_0x4865b8,_0xc4033d){return client[_0x1d0a('0x8')](_0x47d91b,_0xb10346)[_0x1d0a('0x9')](function(_0x40e68b){logger[_0x1d0a('0xa')](_0x1d0a('0xb'),_0x14add6,_0x1d0a('0xc'));logger[_0x1d0a('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x14add6,_0x1d0a('0xc'),JSON[_0x1d0a('0xe')](_0x40e68b));if(_0x40e68b[_0x1d0a('0xf')]){if(_0x40e68b['error']['code']===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x14add6,_0x40e68b['error'][_0x1d0a('0x10')]);return _0xc4033d(_0x40e68b[_0x1d0a('0xf')][_0x1d0a('0x10')]);}logger[_0x1d0a('0xf')](_0x1d0a('0xb'),_0x14add6,_0x40e68b[_0x1d0a('0xf')][_0x1d0a('0x10')]);return _0x4865b8(_0x40e68b['error'][_0x1d0a('0x10')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x14add6,_0x1d0a('0xc'));_0x4865b8(_0x40e68b[_0x1d0a('0x11')][_0x1d0a('0x10')]);}})[_0x1d0a('0x12')](function(_0x17055b){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x14add6,_0x17055b);_0xc4033d(_0x17055b);});});}exports['CreateWhatsappQueueReport']=function(_0x2f8c58){var _0x1501f2=this;return new Promise(function(_0x231794,_0x20ff10){return db[_0x1d0a('0x13')]['create'](_0x2f8c58[_0x1d0a('0x14')],{'raw':_0x2f8c58['options']?_0x2f8c58[_0x1d0a('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x1d0a('0x9')](function(_0x4eef14){logger['info'](_0x1d0a('0x16'),_0x2f8c58);logger[_0x1d0a('0xd')](_0x1d0a('0x16'),_0x2f8c58,JSON[_0x1d0a('0xe')](_0x4eef14));_0x231794(_0x4eef14);})[_0x1d0a('0x12')](function(_0x441b92){logger[_0x1d0a('0xf')]('CreateWhatsappQueueReport',_0x441b92[_0x1d0a('0x10')],_0x2f8c58);_0x20ff10(_0x1501f2[_0x1d0a('0xf')](0x1f4,_0x441b92[_0x1d0a('0x10')]));});});};exports[_0x1d0a('0x17')]=function(_0xbbf0e6){var _0x4da3ef=this;return new Promise(function(_0x349501,_0x300dd9){return db['WhatsappQueueReport'][_0x1d0a('0x18')](_0xbbf0e6[_0x1d0a('0x14')],{'raw':_0xbbf0e6['options']?_0xbbf0e6['options'][_0x1d0a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbbf0e6['options']?_0xbbf0e6[_0x1d0a('0x15')][_0x1d0a('0x1a')]||null:null,'attributes':_0xbbf0e6['options']?_0xbbf0e6[_0x1d0a('0x15')][_0x1d0a('0x1b')]||null:null,'limit':_0xbbf0e6[_0x1d0a('0x15')]?_0xbbf0e6['options'][_0x1d0a('0x1c')]||null:null})[_0x1d0a('0x9')](function(_0x2e0889){logger[_0x1d0a('0xa')](_0x1d0a('0x17'),_0xbbf0e6);logger[_0x1d0a('0xd')]('UpdateWhatsappQueueReport',_0xbbf0e6,JSON[_0x1d0a('0xe')](_0x2e0889));_0x349501(_0x2e0889);})['catch'](function(_0x4f74ef){logger[_0x1d0a('0xf')](_0x1d0a('0x17'),_0x4f74ef['message'],_0xbbf0e6);_0x300dd9(_0x4da3ef['error'](0x1f4,_0x4f74ef[_0x1d0a('0x10')]));});});}; \ No newline at end of file +var _0xf470=['message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','then','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s'];(function(_0x189b3b,_0x484de8){var _0x7c4721=function(_0x1ca32b){while(--_0x1ca32b){_0x189b3b['push'](_0x189b3b['shift']());}};_0x7c4721(++_0x484de8);}(_0xf470,0x19b));var _0x0f47=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xf470[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x0f47('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0f47('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f47('0x2'))['db'];var utils=require(_0x0f47('0x3'));var logger=require(_0x0f47('0x4'))(_0x0f47('0x5'));var config=require(_0x0f47('0x6'));var jayson=require(_0x0f47('0x7'));var client=jayson[_0x0f47('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3359ce,_0x43ee2f,_0x40a1e2){return new BPromise(function(_0x579b00,_0x233a20){return client[_0x0f47('0x9')](_0x3359ce,_0x40a1e2)['then'](function(_0x4ad269){logger[_0x0f47('0xa')]('WhatsappQueueReport,\x20%s,\x20%s',_0x43ee2f,_0x0f47('0xb'));logger[_0x0f47('0xc')](_0x0f47('0xd'),_0x43ee2f,_0x0f47('0xb'),JSON[_0x0f47('0xe')](_0x4ad269));if(_0x4ad269[_0x0f47('0xf')]){if(_0x4ad269[_0x0f47('0xf')][_0x0f47('0x10')]===0x1f4){logger[_0x0f47('0xf')](_0x0f47('0x11'),_0x43ee2f,_0x4ad269[_0x0f47('0xf')][_0x0f47('0x12')]);return _0x233a20(_0x4ad269[_0x0f47('0xf')]['message']);}logger[_0x0f47('0xf')](_0x0f47('0x11'),_0x43ee2f,_0x4ad269[_0x0f47('0xf')][_0x0f47('0x12')]);return _0x579b00(_0x4ad269['error'][_0x0f47('0x12')]);}else{logger['info'](_0x0f47('0x11'),_0x43ee2f,'request\x20sent');_0x579b00(_0x4ad269[_0x0f47('0x13')][_0x0f47('0x12')]);}})[_0x0f47('0x14')](function(_0x292b8f){logger[_0x0f47('0xf')](_0x0f47('0x11'),_0x43ee2f,_0x292b8f);_0x233a20(_0x292b8f);});});}exports[_0x0f47('0x15')]=function(_0xa33dc4){var _0x1765d2=this;return new Promise(function(_0xec8217,_0x304682){return db[_0x0f47('0x16')][_0x0f47('0x17')](_0xa33dc4[_0x0f47('0x18')],{'raw':_0xa33dc4['options']?_0xa33dc4[_0x0f47('0x19')][_0x0f47('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xaf2495){logger[_0x0f47('0xa')](_0x0f47('0x15'),_0xa33dc4);logger[_0x0f47('0xc')](_0x0f47('0x15'),_0xa33dc4,JSON[_0x0f47('0xe')](_0xaf2495));_0xec8217(_0xaf2495);})[_0x0f47('0x14')](function(_0x21eaf9){logger[_0x0f47('0xf')]('CreateWhatsappQueueReport',_0x21eaf9[_0x0f47('0x12')],_0xa33dc4);_0x304682(_0x1765d2[_0x0f47('0xf')](0x1f4,_0x21eaf9[_0x0f47('0x12')]));});});};exports[_0x0f47('0x1b')]=function(_0x3d9d4e){var _0x575098=this;return new Promise(function(_0x255202,_0x2a35a0){return db[_0x0f47('0x16')][_0x0f47('0x1c')](_0x3d9d4e[_0x0f47('0x18')],{'raw':_0x3d9d4e['options']?_0x3d9d4e[_0x0f47('0x19')][_0x0f47('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d9d4e['options']?_0x3d9d4e[_0x0f47('0x19')][_0x0f47('0x1d')]||null:null,'attributes':_0x3d9d4e[_0x0f47('0x19')]?_0x3d9d4e['options'][_0x0f47('0x1e')]||null:null,'limit':_0x3d9d4e[_0x0f47('0x19')]?_0x3d9d4e[_0x0f47('0x19')][_0x0f47('0x1f')]||null:null})[_0x0f47('0x20')](function(_0x4decda){logger[_0x0f47('0xa')](_0x0f47('0x1b'),_0x3d9d4e);logger[_0x0f47('0xc')](_0x0f47('0x1b'),_0x3d9d4e,JSON[_0x0f47('0xe')](_0x4decda));_0x255202(_0x4decda);})['catch'](function(_0x54aeff){logger[_0x0f47('0xf')]('UpdateWhatsappQueueReport',_0x54aeff[_0x0f47('0x12')],_0x3d9d4e);_0x2a35a0(_0x575098[_0x0f47('0xf')](0x1f4,_0x54aeff[_0x0f47('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 4471216..02bf335 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 _0xbf05=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x3a470a,_0x56e3b6){var _0x4c27b8=function(_0x58ab01){while(--_0x58ab01){_0x3a470a['push'](_0x3a470a['shift']());}};_0x4c27b8(++_0x56e3b6);}(_0xbf05,0x138));var _0x5bf0=function(_0x46d0a0,_0x50b301){_0x46d0a0=_0x46d0a0-0x0;var _0x42d290=_0xbf05[_0x46d0a0];return _0x42d290;};'use strict';var multer=require(_0x5bf0('0x0'));var util=require(_0x5bf0('0x1'));var path=require(_0x5bf0('0x2'));var timeout=require(_0x5bf0('0x3'));var express=require(_0x5bf0('0x4'));var router=express[_0x5bf0('0x5')]();var fs_extra=require(_0x5bf0('0x6'));var auth=require(_0x5bf0('0x7'));var interaction=require(_0x5bf0('0x8'));var config=require(_0x5bf0('0x9'));var controller=require(_0x5bf0('0xa'));router[_0x5bf0('0xb')]('/',auth['isAuthenticated'](),controller[_0x5bf0('0xc')]);router[_0x5bf0('0xb')](_0x5bf0('0xd'),auth[_0x5bf0('0xe')](),controller[_0x5bf0('0xf')]);router[_0x5bf0('0xb')](_0x5bf0('0x10'),auth['isAuthenticated'](),controller[_0x5bf0('0x11')]);router[_0x5bf0('0x12')]('/',auth[_0x5bf0('0xe')](),controller[_0x5bf0('0x13')]);router['put']('/:id',auth[_0x5bf0('0xe')](),controller[_0x5bf0('0x14')]);router[_0x5bf0('0x15')](_0x5bf0('0x10'),auth[_0x5bf0('0xe')](),controller[_0x5bf0('0x16')]);module[_0x5bf0('0x17')]=router; \ No newline at end of file +var _0x8244=['../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','delete','destroy','exports','util','connect-timeout','Router'];(function(_0x151d1e,_0x3707d5){var _0x56d4cf=function(_0x1ef203){while(--_0x1ef203){_0x151d1e['push'](_0x151d1e['shift']());}};_0x56d4cf(++_0x3707d5);}(_0x8244,0x1c8));var _0x4824=function(_0x24bfff,_0x2a78ab){_0x24bfff=_0x24bfff-0x0;var _0xf8a4fd=_0x8244[_0x24bfff];return _0xf8a4fd;};'use strict';var multer=require('multer');var util=require(_0x4824('0x0'));var path=require('path');var timeout=require(_0x4824('0x1'));var express=require('express');var router=express[_0x4824('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4824('0x3'));var controller=require(_0x4824('0x4'));router[_0x4824('0x5')]('/',auth[_0x4824('0x6')](),controller[_0x4824('0x7')]);router[_0x4824('0x5')](_0x4824('0x8'),auth[_0x4824('0x6')](),controller[_0x4824('0x9')]);router['get'](_0x4824('0xa'),auth[_0x4824('0x6')](),controller['show']);router[_0x4824('0xb')]('/',auth[_0x4824('0x6')](),controller[_0x4824('0xc')]);router['put'](_0x4824('0xa'),auth[_0x4824('0x6')](),controller[_0x4824('0xd')]);router[_0x4824('0xe')](_0x4824('0xa'),auth[_0x4824('0x6')](),controller[_0x4824('0xf')]);module[_0x4824('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 267cb75..0f49ef9 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 _0x6c9f=['queue','DATE','sequelize','STRING','account','agent'];(function(_0x3b87f4,_0x112243){var _0x63d16e=function(_0x3e7323){while(--_0x3e7323){_0x3b87f4['push'](_0x3b87f4['shift']());}};_0x63d16e(++_0x112243);}(_0x6c9f,0x16a));var _0xf6c9=function(_0x216ece,_0x24672c){_0x216ece=_0x216ece-0x0;var _0x5abb08=_0x6c9f[_0x216ece];return _0x5abb08;};'use strict';var Sequelize=require(_0xf6c9('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xf6c9('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf6c9('0x2'),_0xf6c9('0x3'),_0xf6c9('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf6c9('0x5')]}}; \ No newline at end of file +var _0xd914=['ENUM','account','agent','queue','DATE','sequelize','exports'];(function(_0x34e111,_0x3c2abd){var _0x4dcc22=function(_0x5d9293){while(--_0x5d9293){_0x34e111['push'](_0x34e111['shift']());}};_0x4dcc22(++_0x3c2abd);}(_0xd914,0x17f));var _0x4d91=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xd914[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require(_0x4d91('0x0'));module[_0x4d91('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4d91('0x2')](_0x4d91('0x3'),_0x4d91('0x4'),_0x4d91('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x4d91('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 963e611..6edef09 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 _0x2e54=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','then','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','WhatsappTransferReport','include','findAll','catch','show','params','includeAll','create','body','find','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x23b86a,_0xecd294){var _0x42cf1d=function(_0x263317){while(--_0x263317){_0x23b86a['push'](_0x23b86a['shift']());}};_0x42cf1d(++_0xecd294);}(_0x2e54,0xc1));var _0x42e5=function(_0x581901,_0x2a6882){_0x581901=_0x581901-0x0;var _0x497252=_0x2e54[_0x581901];return _0x497252;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x42e5('0x0'));var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require('mustache');var util=require(_0x42e5('0x5'));var path=require(_0x42e5('0x6'));var sox=require(_0x42e5('0x7'));var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x42e5('0xa'));var crypto=require(_0x42e5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x42e5('0xc'));var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require('papaparse');var Redis=require(_0x42e5('0xe'));var authService=require(_0x42e5('0xf'));var qs=require(_0x42e5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x42e5('0x11'));var logger=require('../../config/logger')(_0x42e5('0x12'));var utils=require(_0x42e5('0x13'));var config=require(_0x42e5('0x14'));var licenseUtil=require(_0x42e5('0x15'));var db=require(_0x42e5('0x16'))['db'];function respondWithStatusCode(_0x5b741f,_0x309f36){_0x309f36=_0x309f36||0xcc;return function(_0x244bc4){if(_0x244bc4){return _0x5b741f[_0x42e5('0x17')](_0x309f36);}return _0x5b741f[_0x42e5('0x18')](_0x309f36)[_0x42e5('0x19')]();};}function respondWithResult(_0x3090aa,_0x4289ed){_0x4289ed=_0x4289ed||0xc8;return function(_0x306efd){if(_0x306efd){return _0x3090aa[_0x42e5('0x18')](_0x4289ed)[_0x42e5('0x1a')](_0x306efd);}};}function respondWithFilteredResult(_0x467103,_0x588a4b){return function(_0x51dcf3){if(_0x51dcf3){var _0x23c4e7=typeof _0x588a4b[_0x42e5('0x1b')]===_0x42e5('0x1c')&&typeof _0x588a4b[_0x42e5('0x1d')]===_0x42e5('0x1c');var _0x498864=_0x51dcf3[_0x42e5('0x1e')];var _0x143733=_0x23c4e7?0x0:_0x588a4b[_0x42e5('0x1b')];var _0x4a3ba4=_0x23c4e7?_0x51dcf3[_0x42e5('0x1e')]:_0x588a4b[_0x42e5('0x1b')]+_0x588a4b['limit'];var _0x435dfd;if(_0x4a3ba4>=_0x498864){_0x4a3ba4=_0x498864;_0x435dfd=0xc8;}else{_0x435dfd=0xce;}_0x467103['status'](_0x435dfd);return _0x467103['set']('Content-Range',_0x143733+'-'+_0x4a3ba4+'/'+_0x498864)[_0x42e5('0x1a')](_0x51dcf3);}return null;};}function patchUpdates(_0x2e8502){return function(_0x4334c8){try{jsonpatch['apply'](_0x4334c8,_0x2e8502,!![]);}catch(_0xdf97f0){return BPromise[_0x42e5('0x1f')](_0xdf97f0);}return _0x4334c8[_0x42e5('0x20')]();};}function saveUpdates(_0x1a79e6,_0x1fc835){return function(_0x5bdbe2){if(_0x5bdbe2){return _0x5bdbe2['update'](_0x1a79e6)[_0x42e5('0x21')](function(_0x17b5d3){return _0x17b5d3;});}return null;};}function removeEntity(_0x525657,_0x24a33f){return function(_0x11d530){if(_0x11d530){return _0x11d530['destroy']()[_0x42e5('0x21')](function(){_0x525657['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b5480,_0x527426){return function(_0x3359de){if(!_0x3359de){_0x1b5480[_0x42e5('0x17')](0x194);}return _0x3359de;};}function handleError(_0x5b637e,_0x192d2d){_0x192d2d=_0x192d2d||0x1f4;return function(_0x1b4c83){logger['error'](_0x1b4c83[_0x42e5('0x22')]);if(_0x1b4c83[_0x42e5('0x23')]){delete _0x1b4c83[_0x42e5('0x23')];}_0x5b637e[_0x42e5('0x18')](_0x192d2d)[_0x42e5('0x24')](_0x1b4c83);};}exports[_0x42e5('0x25')]=function(_0x4c2597,_0xf173ca){var _0x400d11={},_0x2bc40e={},_0xb93ffb={'count':0x0,'rows':[]};var _0x178c03=_['map'](db['WhatsappTransferReport'][_0x42e5('0x26')],function(_0x520507){return{'name':_0x520507[_0x42e5('0x27')],'type':_0x520507[_0x42e5('0x28')][_0x42e5('0x29')]};});_0x2bc40e[_0x42e5('0x2a')]=_['map'](_0x178c03,_0x42e5('0x23'));_0x2bc40e[_0x42e5('0x2b')]=_[_0x42e5('0x2c')](_0x4c2597['query']);_0x2bc40e[_0x42e5('0x2d')]=_[_0x42e5('0x2e')](_0x2bc40e[_0x42e5('0x2a')],_0x2bc40e[_0x42e5('0x2b')]);_0x400d11['attributes']=_[_0x42e5('0x2e')](_0x2bc40e[_0x42e5('0x2a')],qs[_0x42e5('0x2f')](_0x4c2597['query'][_0x42e5('0x2f')]));_0x400d11[_0x42e5('0x30')]=_0x400d11['attributes'][_0x42e5('0x31')]?_0x400d11[_0x42e5('0x30')]:_0x2bc40e[_0x42e5('0x2a')];if(!_0x4c2597[_0x42e5('0x2b')][_0x42e5('0x32')]('nolimit')){_0x400d11['limit']=qs[_0x42e5('0x1d')](_0x4c2597['query'][_0x42e5('0x1d')]);_0x400d11[_0x42e5('0x1b')]=qs[_0x42e5('0x1b')](_0x4c2597[_0x42e5('0x2b')][_0x42e5('0x1b')]);}_0x400d11[_0x42e5('0x33')]=qs[_0x42e5('0x34')](_0x4c2597[_0x42e5('0x2b')]['sort']);_0x400d11[_0x42e5('0x35')]=qs[_0x42e5('0x2d')](_[_0x42e5('0x36')](_0x4c2597['query'],_0x2bc40e['filters']),_0x178c03);if(_0x4c2597[_0x42e5('0x2b')][_0x42e5('0x37')]){_0x400d11[_0x42e5('0x35')]=_[_0x42e5('0x38')](_0x400d11[_0x42e5('0x35')],{'$or':_[_0x42e5('0x39')](_0x178c03,function(_0x4a4d5b){if(_0x4a4d5b[_0x42e5('0x28')]!=='VIRTUAL'){var _0x291101={};_0x291101[_0x4a4d5b[_0x42e5('0x23')]]={'$like':'%'+_0x4c2597[_0x42e5('0x2b')][_0x42e5('0x37')]+'%'};return _0x291101;}})});}_0x400d11=_[_0x42e5('0x38')]({},_0x400d11,_0x4c2597[_0x42e5('0x3a')]);var _0x11638c={'where':_0x400d11[_0x42e5('0x35')]};return db[_0x42e5('0x3b')][_0x42e5('0x1e')](_0x11638c)[_0x42e5('0x21')](function(_0x5d178e){_0xb93ffb[_0x42e5('0x1e')]=_0x5d178e;if(_0x4c2597[_0x42e5('0x2b')]['includeAll']){_0x400d11[_0x42e5('0x3c')]=[{'all':!![]}];}return db[_0x42e5('0x3b')][_0x42e5('0x3d')](_0x400d11);})[_0x42e5('0x21')](function(_0x2f265e){_0xb93ffb['rows']=_0x2f265e;return _0xb93ffb;})[_0x42e5('0x21')](respondWithFilteredResult(_0xf173ca,_0x400d11))[_0x42e5('0x3e')](handleError(_0xf173ca,null));};exports[_0x42e5('0x3f')]=function(_0x5290a1,_0xb6dc5c){var _0x5e02a5={'raw':!![],'where':{'id':_0x5290a1[_0x42e5('0x40')]['id']}},_0x301abe={};_0x301abe[_0x42e5('0x2a')]=_[_0x42e5('0x2c')](db['WhatsappTransferReport'][_0x42e5('0x26')]);_0x301abe[_0x42e5('0x2b')]=_['keys'](_0x5290a1[_0x42e5('0x2b')]);_0x301abe[_0x42e5('0x2d')]=_['intersection'](_0x301abe['model'],_0x301abe[_0x42e5('0x2b')]);_0x5e02a5[_0x42e5('0x30')]=_[_0x42e5('0x2e')](_0x301abe[_0x42e5('0x2a')],qs[_0x42e5('0x2f')](_0x5290a1['query'][_0x42e5('0x2f')]));_0x5e02a5[_0x42e5('0x30')]=_0x5e02a5[_0x42e5('0x30')][_0x42e5('0x31')]?_0x5e02a5[_0x42e5('0x30')]:_0x301abe['model'];if(_0x5290a1[_0x42e5('0x2b')][_0x42e5('0x41')]){_0x5e02a5[_0x42e5('0x3c')]=[{'all':!![]}];}_0x5e02a5=_['merge']({},_0x5e02a5,_0x5290a1['options']);return db[_0x42e5('0x3b')]['find'](_0x5e02a5)['then'](handleEntityNotFound(_0xb6dc5c,null))[_0x42e5('0x21')](respondWithResult(_0xb6dc5c,null))[_0x42e5('0x3e')](handleError(_0xb6dc5c,null));};exports[_0x42e5('0x42')]=function(_0x244a30,_0x4471e7){return db[_0x42e5('0x3b')][_0x42e5('0x42')](_0x244a30[_0x42e5('0x43')],{})[_0x42e5('0x21')](respondWithResult(_0x4471e7,0xc9))[_0x42e5('0x3e')](handleError(_0x4471e7,null));};exports['update']=function(_0x4b6211,_0x26146e){if(_0x4b6211[_0x42e5('0x43')]['id']){delete _0x4b6211[_0x42e5('0x43')]['id'];}return db[_0x42e5('0x3b')][_0x42e5('0x44')]({'where':{'id':_0x4b6211[_0x42e5('0x40')]['id']}})['then'](handleEntityNotFound(_0x26146e,null))[_0x42e5('0x21')](saveUpdates(_0x4b6211[_0x42e5('0x43')],null))['then'](respondWithResult(_0x26146e,null))['catch'](handleError(_0x26146e,null));};exports[_0x42e5('0x45')]=function(_0x30ef33,_0x37ef00){return db['WhatsappTransferReport'][_0x42e5('0x44')]({'where':{'id':_0x30ef33[_0x42e5('0x40')]['id']}})[_0x42e5('0x21')](handleEntityNotFound(_0x37ef00,null))['then'](removeEntity(_0x37ef00,null))[_0x42e5('0x3e')](handleError(_0x37ef00,null));};exports[_0x42e5('0x46')]=function(_0x1345c8,_0x3994de){return db[_0x42e5('0x3b')][_0x42e5('0x46')]()['then'](respondWithResult(_0x3994de,null))[_0x42e5('0x3e')](handleError(_0x3994de,null));}; \ No newline at end of file +var _0x62ff=['apply','update','then','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x483e8a,_0x370d68){var _0x11f823=function(_0x1be097){while(--_0x1be097){_0x483e8a['push'](_0x483e8a['shift']());}};_0x11f823(++_0x370d68);}(_0x62ff,0x1e5));var _0xf62f=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x62ff[_0x1589dd];return _0x1bddd1;};'use strict';var emlformat=require(_0xf62f('0x0'));var rimraf=require(_0xf62f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf62f('0x2'));var rp=require(_0xf62f('0x3'));var moment=require(_0xf62f('0x4'));var BPromise=require(_0xf62f('0x5'));var Mustache=require(_0xf62f('0x6'));var util=require(_0xf62f('0x7'));var path=require(_0xf62f('0x8'));var sox=require('sox');var csv=require(_0xf62f('0x9'));var ejs=require(_0xf62f('0xa'));var fs=require('fs');var fs_extra=require(_0xf62f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf62f('0xc'));var jsforce=require(_0xf62f('0xd'));var deskjs=require(_0xf62f('0xe'));var toCsv=require(_0xf62f('0x9'));var querystring=require(_0xf62f('0xf'));var Papa=require(_0xf62f('0x10'));var Redis=require('ioredis');var authService=require(_0xf62f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf62f('0x12'));var hardwareService=require(_0xf62f('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xf62f('0x14'));var config=require(_0xf62f('0x15'));var licenseUtil=require(_0xf62f('0x16'));var db=require(_0xf62f('0x17'))['db'];function respondWithStatusCode(_0x23de64,_0x1118d2){_0x1118d2=_0x1118d2||0xcc;return function(_0x32bb9e){if(_0x32bb9e){return _0x23de64[_0xf62f('0x18')](_0x1118d2);}return _0x23de64[_0xf62f('0x19')](_0x1118d2)['end']();};}function respondWithResult(_0x237115,_0x469fbf){_0x469fbf=_0x469fbf||0xc8;return function(_0x172faf){if(_0x172faf){return _0x237115[_0xf62f('0x19')](_0x469fbf)['json'](_0x172faf);}};}function respondWithFilteredResult(_0x5e4773,_0x4821db){return function(_0x6ce8b8){if(_0x6ce8b8){var _0x5cd973=typeof _0x4821db[_0xf62f('0x1a')]===_0xf62f('0x1b')&&typeof _0x4821db[_0xf62f('0x1c')]===_0xf62f('0x1b');var _0x4ac698=_0x6ce8b8['count'];var _0x379534=_0x5cd973?0x0:_0x4821db[_0xf62f('0x1a')];var _0x52db07=_0x5cd973?_0x6ce8b8[_0xf62f('0x1d')]:_0x4821db[_0xf62f('0x1a')]+_0x4821db[_0xf62f('0x1c')];var _0x1f0073;if(_0x52db07>=_0x4ac698){_0x52db07=_0x4ac698;_0x1f0073=0xc8;}else{_0x1f0073=0xce;}_0x5e4773[_0xf62f('0x19')](_0x1f0073);return _0x5e4773[_0xf62f('0x1e')](_0xf62f('0x1f'),_0x379534+'-'+_0x52db07+'/'+_0x4ac698)[_0xf62f('0x20')](_0x6ce8b8);}return null;};}function patchUpdates(_0x2f8a91){return function(_0x1266f6){try{jsonpatch[_0xf62f('0x21')](_0x1266f6,_0x2f8a91,!![]);}catch(_0x542399){return BPromise['reject'](_0x542399);}return _0x1266f6['save']();};}function saveUpdates(_0x1dddc2,_0x2b6387){return function(_0x5791a7){if(_0x5791a7){return _0x5791a7[_0xf62f('0x22')](_0x1dddc2)[_0xf62f('0x23')](function(_0xa85e09){return _0xa85e09;});}return null;};}function removeEntity(_0x2ee1d1,_0x59af30){return function(_0x193d6f){if(_0x193d6f){return _0x193d6f['destroy']()['then'](function(){_0x2ee1d1[_0xf62f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x512985,_0x319097){return function(_0x1fa792){if(!_0x1fa792){_0x512985['sendStatus'](0x194);}return _0x1fa792;};}function handleError(_0x5e4f8b,_0x47bddb){_0x47bddb=_0x47bddb||0x1f4;return function(_0x2e1f26){logger['error'](_0x2e1f26[_0xf62f('0x24')]);if(_0x2e1f26[_0xf62f('0x25')]){delete _0x2e1f26[_0xf62f('0x25')];}_0x5e4f8b[_0xf62f('0x19')](_0x47bddb)[_0xf62f('0x26')](_0x2e1f26);};}exports[_0xf62f('0x27')]=function(_0x23dec6,_0x3b241f){var _0x31c28b={},_0x37da66={},_0x1b2f33={'count':0x0,'rows':[]};var _0x18f351=_[_0xf62f('0x28')](db[_0xf62f('0x29')]['rawAttributes'],function(_0x46701d){return{'name':_0x46701d[_0xf62f('0x2a')],'type':_0x46701d[_0xf62f('0x2b')][_0xf62f('0x2c')]};});_0x37da66['model']=_[_0xf62f('0x28')](_0x18f351,_0xf62f('0x25'));_0x37da66[_0xf62f('0x2d')]=_[_0xf62f('0x2e')](_0x23dec6['query']);_0x37da66['filters']=_[_0xf62f('0x2f')](_0x37da66[_0xf62f('0x30')],_0x37da66[_0xf62f('0x2d')]);_0x31c28b['attributes']=_['intersection'](_0x37da66[_0xf62f('0x30')],qs[_0xf62f('0x31')](_0x23dec6[_0xf62f('0x2d')]['fields']));_0x31c28b['attributes']=_0x31c28b[_0xf62f('0x32')][_0xf62f('0x33')]?_0x31c28b['attributes']:_0x37da66[_0xf62f('0x30')];if(!_0x23dec6[_0xf62f('0x2d')][_0xf62f('0x34')](_0xf62f('0x35'))){_0x31c28b[_0xf62f('0x1c')]=qs[_0xf62f('0x1c')](_0x23dec6['query'][_0xf62f('0x1c')]);_0x31c28b[_0xf62f('0x1a')]=qs[_0xf62f('0x1a')](_0x23dec6[_0xf62f('0x2d')]['offset']);}_0x31c28b[_0xf62f('0x36')]=qs[_0xf62f('0x37')](_0x23dec6[_0xf62f('0x2d')][_0xf62f('0x37')]);_0x31c28b[_0xf62f('0x38')]=qs[_0xf62f('0x39')](_['pick'](_0x23dec6[_0xf62f('0x2d')],_0x37da66[_0xf62f('0x39')]),_0x18f351);if(_0x23dec6[_0xf62f('0x2d')][_0xf62f('0x3a')]){_0x31c28b[_0xf62f('0x38')]=_[_0xf62f('0x3b')](_0x31c28b['where'],{'$or':_['map'](_0x18f351,function(_0x3ff900){if(_0x3ff900[_0xf62f('0x2b')]!=='VIRTUAL'){var _0x7f460f={};_0x7f460f[_0x3ff900[_0xf62f('0x25')]]={'$like':'%'+_0x23dec6[_0xf62f('0x2d')][_0xf62f('0x3a')]+'%'};return _0x7f460f;}})});}_0x31c28b=_[_0xf62f('0x3b')]({},_0x31c28b,_0x23dec6[_0xf62f('0x3c')]);var _0x2920fc={'where':_0x31c28b[_0xf62f('0x38')]};return db[_0xf62f('0x29')]['count'](_0x2920fc)['then'](function(_0x19d1ae){_0x1b2f33['count']=_0x19d1ae;if(_0x23dec6['query'][_0xf62f('0x3d')]){_0x31c28b[_0xf62f('0x3e')]=[{'all':!![]}];}return db[_0xf62f('0x29')][_0xf62f('0x3f')](_0x31c28b);})[_0xf62f('0x23')](function(_0x5f2327){_0x1b2f33[_0xf62f('0x40')]=_0x5f2327;return _0x1b2f33;})[_0xf62f('0x23')](respondWithFilteredResult(_0x3b241f,_0x31c28b))['catch'](handleError(_0x3b241f,null));};exports[_0xf62f('0x41')]=function(_0x506a41,_0x17cad6){var _0x16ca96={'raw':!![],'where':{'id':_0x506a41[_0xf62f('0x42')]['id']}},_0x4d7057={};_0x4d7057[_0xf62f('0x30')]=_[_0xf62f('0x2e')](db[_0xf62f('0x29')][_0xf62f('0x43')]);_0x4d7057['query']=_[_0xf62f('0x2e')](_0x506a41[_0xf62f('0x2d')]);_0x4d7057[_0xf62f('0x39')]=_['intersection'](_0x4d7057[_0xf62f('0x30')],_0x4d7057[_0xf62f('0x2d')]);_0x16ca96[_0xf62f('0x32')]=_[_0xf62f('0x2f')](_0x4d7057[_0xf62f('0x30')],qs['fields'](_0x506a41[_0xf62f('0x2d')][_0xf62f('0x31')]));_0x16ca96[_0xf62f('0x32')]=_0x16ca96[_0xf62f('0x32')][_0xf62f('0x33')]?_0x16ca96[_0xf62f('0x32')]:_0x4d7057[_0xf62f('0x30')];if(_0x506a41['query'][_0xf62f('0x3d')]){_0x16ca96[_0xf62f('0x3e')]=[{'all':!![]}];}_0x16ca96=_[_0xf62f('0x3b')]({},_0x16ca96,_0x506a41[_0xf62f('0x3c')]);return db[_0xf62f('0x29')][_0xf62f('0x44')](_0x16ca96)['then'](handleEntityNotFound(_0x17cad6,null))[_0xf62f('0x23')](respondWithResult(_0x17cad6,null))[_0xf62f('0x45')](handleError(_0x17cad6,null));};exports[_0xf62f('0x46')]=function(_0x35aca9,_0x20ace3){return db[_0xf62f('0x29')][_0xf62f('0x46')](_0x35aca9[_0xf62f('0x47')],{})[_0xf62f('0x23')](respondWithResult(_0x20ace3,0xc9))[_0xf62f('0x45')](handleError(_0x20ace3,null));};exports[_0xf62f('0x22')]=function(_0x533b19,_0x11916){if(_0x533b19[_0xf62f('0x47')]['id']){delete _0x533b19[_0xf62f('0x47')]['id'];}return db[_0xf62f('0x29')][_0xf62f('0x44')]({'where':{'id':_0x533b19[_0xf62f('0x42')]['id']}})['then'](handleEntityNotFound(_0x11916,null))[_0xf62f('0x23')](saveUpdates(_0x533b19[_0xf62f('0x47')],null))[_0xf62f('0x23')](respondWithResult(_0x11916,null))[_0xf62f('0x45')](handleError(_0x11916,null));};exports[_0xf62f('0x48')]=function(_0xe0c98d,_0x58e366){return db[_0xf62f('0x29')][_0xf62f('0x44')]({'where':{'id':_0xe0c98d[_0xf62f('0x42')]['id']}})['then'](handleEntityNotFound(_0x58e366,null))[_0xf62f('0x23')](removeEntity(_0x58e366,null))[_0xf62f('0x45')](handleError(_0x58e366,null));};exports[_0xf62f('0x49')]=function(_0x4eddc0,_0xf28ca7){return db['WhatsappTransferReport'][_0xf62f('0x49')]()[_0xf62f('0x23')](respondWithResult(_0xf28ca7,null))[_0xf62f('0x45')](handleError(_0xf28ca7,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index f2fc405..83937be 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 _0x3459=['api','moment','path','rimraf','exports','define','WhatsappTransferReport','report_whatsapp_transfer','lodash','util','../../config/logger'];(function(_0x1f942c,_0x1ac9ce){var _0xdb79ad=function(_0x2ab04d){while(--_0x2ab04d){_0x1f942c['push'](_0x1f942c['shift']());}};_0xdb79ad(++_0x1ac9ce);}(_0x3459,0x173));var _0x9345=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3459[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x9345('0x0'));var util=require(_0x9345('0x1'));var logger=require(_0x9345('0x2'))(_0x9345('0x3'));var moment=require(_0x9345('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9345('0x5'));var rimraf=require(_0x9345('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0x9345('0x7')]=function(_0x51707c,_0x1100f3){return _0x51707c[_0x9345('0x8')](_0x9345('0x9'),attributes,{'tableName':_0x9345('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x94ee=['report_whatsapp_transfer','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport'];(function(_0x18afaf,_0x2e65c3){var _0x28e323=function(_0x28d80a){while(--_0x28d80a){_0x18afaf['push'](_0x18afaf['shift']());}};_0x28e323(++_0x2e65c3);}(_0x94ee,0x9e));var _0xe94e=function(_0x548fba,_0x35955d){_0x548fba=_0x548fba-0x0;var _0x1636c9=_0x94ee[_0x548fba];return _0x1636c9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe94e('0x0'))(_0xe94e('0x1'));var moment=require(_0xe94e('0x2'));var BPromise=require(_0xe94e('0x3'));var rp=require(_0xe94e('0x4'));var fs=require('fs');var path=require(_0xe94e('0x5'));var rimraf=require(_0xe94e('0x6'));var config=require(_0xe94e('0x7'));var attributes=require(_0xe94e('0x8'));module[_0xe94e('0x9')]=function(_0x87af00,_0x2c3631){return _0x87af00['define'](_0xe94e('0xa'),attributes,{'tableName':_0xe94e('0xb'),'paranoid':![],'indexes':[{'name':_0xe94e('0xc'),'fields':[_0xe94e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 4c31067..53d215e 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 _0xf605=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0xf2ca8d,_0x334967){var _0x3f4c5a=function(_0x2a4cde){while(--_0x2a4cde){_0xf2ca8d['push'](_0xf2ca8d['shift']());}};_0x3f4c5a(++_0x334967);}(_0xf605,0xd7));var _0x5f60=function(_0x9b6a52,_0x3cb0ab){_0x9b6a52=_0x9b6a52-0x0;var _0x5c5c6f=_0xf605[_0x9b6a52];return _0x5c5c6f;};'use strict';var _=require(_0x5f60('0x0'));var util=require('util');var moment=require(_0x5f60('0x1'));var BPromise=require(_0x5f60('0x2'));var rs=require(_0x5f60('0x3'));var fs=require('fs');var Redis=require(_0x5f60('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f60('0x5'));var logger=require(_0x5f60('0x6'))(_0x5f60('0x7'));var config=require(_0x5f60('0x8'));var jayson=require(_0x5f60('0x9'));var client=jayson[_0x5f60('0xa')][_0x5f60('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2678be,_0x14960e,_0x5179c2){return new BPromise(function(_0x124020,_0x2c9324){return client['request'](_0x2678be,_0x5179c2)[_0x5f60('0xc')](function(_0x341288){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x14960e,_0x5f60('0xd'));logger[_0x5f60('0xe')](_0x5f60('0xf'),_0x14960e,_0x5f60('0xd'),JSON['stringify'](_0x341288));if(_0x341288['error']){if(_0x341288[_0x5f60('0x10')][_0x5f60('0x11')]===0x1f4){logger['error'](_0x5f60('0x12'),_0x14960e,_0x341288[_0x5f60('0x10')][_0x5f60('0x13')]);return _0x2c9324(_0x341288['error'][_0x5f60('0x13')]);}logger[_0x5f60('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x14960e,_0x341288[_0x5f60('0x10')][_0x5f60('0x13')]);return _0x124020(_0x341288[_0x5f60('0x10')][_0x5f60('0x13')]);}else{logger['info'](_0x5f60('0x12'),_0x14960e,_0x5f60('0xd'));_0x124020(_0x341288[_0x5f60('0x14')][_0x5f60('0x13')]);}})[_0x5f60('0x15')](function(_0x1dc981){logger[_0x5f60('0x10')](_0x5f60('0x12'),_0x14960e,_0x1dc981);_0x2c9324(_0x1dc981);});});} \ No newline at end of file +var _0x59f8=['WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then'];(function(_0x248ef7,_0x5cf848){var _0x5bad0b=function(_0x1e19ad){while(--_0x1e19ad){_0x248ef7['push'](_0x248ef7['shift']());}};_0x5bad0b(++_0x5cf848);}(_0x59f8,0x1d2));var _0x859f=function(_0x229f8d,_0x48402c){_0x229f8d=_0x229f8d-0x0;var _0x3e193c=_0x59f8[_0x229f8d];return _0x3e193c;};'use strict';var _=require(_0x859f('0x0'));var util=require(_0x859f('0x1'));var moment=require('moment');var BPromise=require(_0x859f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x859f('0x3'))['db'];var utils=require(_0x859f('0x4'));var logger=require(_0x859f('0x5'))(_0x859f('0x6'));var config=require(_0x859f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x50e18d,_0x4ed4d9,_0x10b3bd){return new BPromise(function(_0x25842a,_0x57b470){return client[_0x859f('0x8')](_0x50e18d,_0x10b3bd)[_0x859f('0x9')](function(_0x112e3c){logger['info'](_0x859f('0xa'),_0x4ed4d9,_0x859f('0xb'));logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x4ed4d9,'request\x20sent',JSON['stringify'](_0x112e3c));if(_0x112e3c['error']){if(_0x112e3c[_0x859f('0xc')][_0x859f('0xd')]===0x1f4){logger[_0x859f('0xc')](_0x859f('0xa'),_0x4ed4d9,_0x112e3c['error'][_0x859f('0xe')]);return _0x57b470(_0x112e3c[_0x859f('0xc')]['message']);}logger[_0x859f('0xc')](_0x859f('0xa'),_0x4ed4d9,_0x112e3c[_0x859f('0xc')][_0x859f('0xe')]);return _0x25842a(_0x112e3c[_0x859f('0xc')][_0x859f('0xe')]);}else{logger[_0x859f('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4ed4d9,'request\x20sent');_0x25842a(_0x112e3c[_0x859f('0x10')][_0x859f('0xe')]);}})['catch'](function(_0x26b5ef){logger[_0x859f('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4ed4d9,_0x26b5ef);_0x57b470(_0x26b5ef);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 2a7a7e9..b07e495 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbeff=['log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','default','listen','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','Online\x20apps:','name','join','Offline\x20apps:','status','online'];(function(_0x2ecea0,_0x36a83d){var _0x17ab22=function(_0x768e97){while(--_0x768e97){_0x2ecea0['push'](_0x2ecea0['shift']());}};_0x17ab22(++_0x36a83d);}(_0xbeff,0x8e));var _0xfbef=function(_0x1e7799,_0x4e004f){_0x1e7799=_0x1e7799-0x0;var _0x30e0ad=_0xbeff[_0x1e7799];return _0x30e0ad;};'use strict';var _=require('lodash');var db=require(_0xfbef('0x0'))['db'];var seedDb=require(_0xfbef('0x1'));var checkLicense=require(_0xfbef('0x2'));var rpc=require(_0xfbef('0x3'));var config=require(_0xfbef('0x4'));var logger=require('./config/logger')('app');var pm2=require(_0xfbef('0x5'));var pm2Config=require(_0xfbef('0x6'));var schedule=require(_0xfbef('0x7'));var chat=require(_0xfbef('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xfbef('0x9'));var provider=require(_0xfbef('0xa'));function main(){return db['sequelize'][_0xfbef('0xb')]()[_0xfbef('0xc')](function(){if(config['seedDB']){return seedDb[_0xfbef('0xd')]();}})['then'](function(){return checkLicense[_0xfbef('0xd')]();})['then'](function(){return rpc[_0xfbef('0xe')]();})[_0xfbef('0xc')](function(_0x15e369){logger[_0xfbef('0xf')](_0x15e369);return chat[_0xfbef('0x10')]();})[_0xfbef('0xc')](function(){return whatsapp[_0xfbef('0x10')]();})[_0xfbef('0xc')](function(){return schedule['start']();})[_0xfbef('0xc')](function(){return transcribe[_0xfbef('0x10')]();})[_0xfbef('0xc')](function(){return provider[_0xfbef('0x10')]();})[_0xfbef('0xc')](function(_0x33ed6c){logger[_0xfbef('0xf')](_0x33ed6c);return pm2['start'](pm2Config);})['then'](function(_0x58ec38){var _0x5d1761=_0x58ec38[_0xfbef('0x11')](function(_0x353a5b){return typeof _0x353a5b[_0xfbef('0x12')]==='number'&&_0x353a5b[_0xfbef('0x12')]>=0x0;});if(_0x5d1761[_0xfbef('0x13')]>0x0){throw new Error(_0x5d1761[_0xfbef('0x13')]+_0xfbef('0x14')+_[_0xfbef('0x15')](_0x5d1761,function(_0x1fc8ac){return'\x22'+_0x1fc8ac['pm2_env']['name']+'\x22';}));}logger[_0xfbef('0xf')](_0xfbef('0x16'),_[_0xfbef('0x15')](_[_0xfbef('0x11')](_0x58ec38,{'status':'online'}),_0xfbef('0x17'))[_0xfbef('0x18')]());logger[_0xfbef('0xf')](_0xfbef('0x19'),_[_0xfbef('0x15')](_[_0xfbef('0x11')](_0x58ec38,function(_0x5a264f){return _0x5a264f[_0xfbef('0x1a')]!==_0xfbef('0x1b');}),'name')[_0xfbef('0x18')]()||'None');console[_0xfbef('0x1c')](_0xfbef('0x1d'));})[_0xfbef('0x1e')](function(_0x356502){console[_0xfbef('0x1c')](_0xfbef('0x1f'),_0x356502);logger['error'](_0xfbef('0x20'),_0x356502);process[_0xfbef('0x21')](0x1);});}main(); \ No newline at end of file +var _0x0f9f=['default','listen','info','start','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','filter','online','join','Offline\x20apps:','status','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then'];(function(_0x2b19da,_0x2d4ce6){var _0x8f7dc4=function(_0x148a8a){while(--_0x148a8a){_0x2b19da['push'](_0x2b19da['shift']());}};_0x8f7dc4(++_0x2d4ce6);}(_0x0f9f,0xae));var _0xf0f9=function(_0x496af1,_0x2d5f59){_0x496af1=_0x496af1-0x0;var _0x5700b3=_0x0f9f[_0x496af1];return _0x5700b3;};'use strict';var _=require(_0xf0f9('0x0'));var db=require(_0xf0f9('0x1'))['db'];var seedDb=require(_0xf0f9('0x2'));var checkLicense=require(_0xf0f9('0x3'));var rpc=require(_0xf0f9('0x4'));var config=require(_0xf0f9('0x5'));var logger=require(_0xf0f9('0x6'))(_0xf0f9('0x7'));var pm2=require(_0xf0f9('0x8'));var pm2Config=require(_0xf0f9('0x9'));var schedule=require(_0xf0f9('0xa'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xf0f9('0xb'));var transcribe=require(_0xf0f9('0xc'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xf0f9('0xd')][_0xf0f9('0xe')]()[_0xf0f9('0xf')](function(){if(config['seedDB']){return seedDb[_0xf0f9('0x10')]();}})[_0xf0f9('0xf')](function(){return checkLicense['default']();})[_0xf0f9('0xf')](function(){return rpc[_0xf0f9('0x11')]();})[_0xf0f9('0xf')](function(_0x3be7af){logger[_0xf0f9('0x12')](_0x3be7af);return chat[_0xf0f9('0x13')]();})[_0xf0f9('0xf')](function(){return whatsapp[_0xf0f9('0x13')]();})['then'](function(){return schedule[_0xf0f9('0x13')]();})[_0xf0f9('0xf')](function(){return transcribe[_0xf0f9('0x13')]();})[_0xf0f9('0xf')](function(){return provider['start']();})[_0xf0f9('0xf')](function(_0xd4e645){logger['info'](_0xd4e645);return pm2[_0xf0f9('0x13')](pm2Config);})['then'](function(_0x538864){var _0x2c832a=_0x538864['filter'](function(_0x3e1587){return typeof _0x3e1587['exitCode']===_0xf0f9('0x14')&&_0x3e1587[_0xf0f9('0x15')]>=0x0;});if(_0x2c832a[_0xf0f9('0x16')]>0x0){throw new Error(_0x2c832a[_0xf0f9('0x16')]+_0xf0f9('0x17')+_[_0xf0f9('0x18')](_0x2c832a,function(_0x10dae6){return'\x22'+_0x10dae6['pm2_env'][_0xf0f9('0x19')]+'\x22';}));}logger[_0xf0f9('0x12')](_0xf0f9('0x1a'),_[_0xf0f9('0x18')](_[_0xf0f9('0x1b')](_0x538864,{'status':_0xf0f9('0x1c')}),_0xf0f9('0x19'))[_0xf0f9('0x1d')]());logger['info'](_0xf0f9('0x1e'),_['map'](_[_0xf0f9('0x1b')](_0x538864,function(_0x510119){return _0x510119[_0xf0f9('0x1f')]!==_0xf0f9('0x1c');}),_0xf0f9('0x19'))[_0xf0f9('0x1d')]()||_0xf0f9('0x20'));console[_0xf0f9('0x21')]('App\x20Ready!');})[_0xf0f9('0x22')](function(_0x535c2c){console[_0xf0f9('0x21')](_0xf0f9('0x23'),_0x535c2c);logger['error'](_0xf0f9('0x24'),_0x535c2c);process[_0xf0f9('0x25')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 2ee53c2..b1c8b96 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 _0x54ef=['../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','moment','secrets','session','fullname','internal','email','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','disposition','then','status','unmanaged','json','Forbidden.','headers','authorization','Basic','User','find','name','authenticate','Wrong\x20credentials.','catch','startsWith','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','disabled','blocked','blockDuration','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','splice','encryptString','join','promisify','sign','secret','payload','options','toString','hex','floor','HS512','../../mysqldb','../../config/environment'];(function(_0x368327,_0x4e1d9b){var _0x1abc53=function(_0x28b567){while(--_0x28b567){_0x368327['push'](_0x368327['shift']());}};_0x1abc53(++_0x4e1d9b);}(_0x54ef,0x112));var _0xf54e=function(_0x294855,_0x1ddd3e){_0x294855=_0x294855-0x0;var _0x36178b=_0x54ef[_0x294855];return _0x36178b;};'use strict';var db=require(_0xf54e('0x0'))['db'];var config=require(_0xf54e('0x1'));var hardwareConf=require(_0xf54e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xf54e('0x3'));var _=require(_0xf54e('0x4'));var jwt=require(_0xf54e('0x5'));var expressJwt=require(_0xf54e('0x6'));var compose=require(_0xf54e('0x7'));var basicAuth=require(_0xf54e('0x8'));var crypto=require(_0xf54e('0x9'));var BPromise=require('bluebird');var util=require('util');var moment=require(_0xf54e('0xa'));var validateJwt=expressJwt({'secret':config[_0xf54e('0xb')][_0xf54e('0xc')]});var userAttributes=['id','role',_0xf54e('0xd'),'name',_0xf54e('0xe'),_0xf54e('0xf'),'userpic',_0xf54e('0x10'),_0xf54e('0x11'),_0xf54e('0x12'),_0xf54e('0x13'),'mailPause',_0xf54e('0x14'),_0xf54e('0x15'),_0xf54e('0x16'),_0xf54e('0x17'),'showWebBar',_0xf54e('0x18'),'lastPauseAt','crudPermissions',_0xf54e('0x19'),_0xf54e('0x1a'),_0xf54e('0x1b'),_0xf54e('0x1c'),'phoneBarAutoAnswerDelay',_0xf54e('0x1d'),_0xf54e('0x1e'),_0xf54e('0x1f'),_0xf54e('0x20'),'phoneBarExpires',_0xf54e('0x21'),_0xf54e('0x22'),_0xf54e('0x23'),'hotdesk','interface',_0xf54e('0x24'),_0xf54e('0x25'),_0xf54e('0x26'),_0xf54e('0x27'),_0xf54e('0x28'),_0xf54e('0x29'),_0xf54e('0x2a'),_0xf54e('0x2b'),_0xf54e('0x2c'),_0xf54e('0x2d'),_0xf54e('0x2e'),'emailAutoanswer','emailAutoanswerDelay',_0xf54e('0x2f'),'smsAutoanswerDelay',_0xf54e('0x30'),_0xf54e('0x31'),_0xf54e('0x32'),_0xf54e('0x33'),_0xf54e('0x34'),_0xf54e('0x35')];exports[_0xf54e('0x36')]=function(){return this[_0xf54e('0x37')](!![])[_0xf54e('0x38')](function(_0x5f9eea,_0x1c58bd,_0x5b83df){if(_0x5f9eea[_0xf54e('0x39')]){_0x5b83df();}else{return db['ChatInteraction'][_0xf54e('0x3a')]({'where':{'id':_0x5f9eea[_0xf54e('0x3b')]['id']},'attributes':['id',_0xf54e('0x3c'),_0xf54e('0x3d')],'raw':!![]})[_0xf54e('0x3e')](function(_0x160160){if(_0x160160&&_0x160160[_0xf54e('0x3c')]){return _0x1c58bd[_0xf54e('0x3f')](_0x160160[_0xf54e('0x3d')]===_0xf54e('0x40')?0x195:0x193)[_0xf54e('0x41')]({'message':_0x160160[_0xf54e('0x3d')]===_0xf54e('0x40')?'Unmanaged.':_0xf54e('0x42')});}else{_0x5b83df();}})['catch'](function(_0x282c63){_0x5b83df(_0x282c63);});}});};exports['isAuthenticated']=function isAuthenticated(_0x15b888){return compose()[_0xf54e('0x38')](function(_0x21ba00,_0xa13cd0,_0x25b643){var _0x3993e4;if(_0x21ba00[_0xf54e('0x43')]['authorization']){if(_['startsWith'](_0x21ba00[_0xf54e('0x43')][_0xf54e('0x44')],_0xf54e('0x45'))){var _0x16d00f=basicAuth(_0x21ba00);db[_0xf54e('0x46')][_0xf54e('0x47')]({'where':{'name':_0x16d00f[_0xf54e('0x48')]}})[_0xf54e('0x3e')](function(_0x3ae704){if(!_0x3ae704||!_0x3ae704[_0xf54e('0x49')](_0x16d00f['pass'])){return _0xa13cd0['status'](0x191)[_0xf54e('0x41')]({'message':_0xf54e('0x4a')});}_0x21ba00['user']={'id':_0x3ae704['id']};_0x25b643();})[_0xf54e('0x4b')](function(_0x82e313){_0x25b643(_0x82e313);});}else if(_[_0xf54e('0x4c')](_0x21ba00[_0xf54e('0x43')]['authorization'],'Bearer')){validateJwt(_0x21ba00,_0xa13cd0,_0x25b643);}else{if(_0x15b888){_0x25b643();}else{return _0xa13cd0['status'](0x193)[_0xf54e('0x41')]({'message':_0xf54e('0x4d')});}}}else if(_0x21ba00[_0xf54e('0x4e')][_0xf54e('0x4f')]){try{var _0x29dc39={'audience':hardwareConf[_0xf54e('0x50')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x21ba00['query']['apikey'],_0x29dc39)[_0xf54e('0x3e')](function(_0x734187){return db['User']['find']({'where':{'id':_0x734187[_0xf54e('0x51')]}})[_0xf54e('0x3e')](function(_0x173e6c){_0x3993e4=_0x173e6c;return db['Setting'][_0xf54e('0x3a')]({'where':{'id':0x1},'attributes':[_0xf54e('0x52'),'blockDuration'],'raw':!![]});})[_0xf54e('0x3e')](function(_0x6e5bdf){if(!_0x3993e4||!_[_0xf54e('0x53')](_0x3993e4[_0xf54e('0x54')],_0x734187[_0xf54e('0x55')])){return _0xa13cd0[_0xf54e('0x3f')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x3993e4[_0xf54e('0x56')]){return _0xa13cd0[_0xf54e('0x3f')](0x191)[_0xf54e('0x41')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x3993e4[_0xf54e('0x57')]){if(_0x6e5bdf[_0xf54e('0x58')]>0x0){if(moment(_0x3993e4[_0xf54e('0x59')])[_0xf54e('0x5a')](_0x6e5bdf[_0xf54e('0x58')],_0xf54e('0x5b'))>moment()){return _0xa13cd0[_0xf54e('0x3f')](0x191)[_0xf54e('0x41')]({'message':_0xf54e('0x5c')});}}else{return _0xa13cd0[_0xf54e('0x3f')](0x191)[_0xf54e('0x41')]({'message':_0xf54e('0x5c')});}}_0x21ba00[_0xf54e('0x39')]={'id':_0x3993e4['id']};_0x25b643();});})[_0xf54e('0x4b')](function(){return _0xa13cd0[_0xf54e('0x3f')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x533423){_0x25b643(_0x533423);}}else if(_0x15b888){_0x25b643();}else{return _0xa13cd0[_0xf54e('0x3f')](0x193)[_0xf54e('0x41')]({'message':'Unknown\x20authorization\x20format'});}})[_0xf54e('0x38')](function(_0x311ce1,_0x381c03,_0x4f61d7){if(_0x311ce1[_0xf54e('0x39')]){db[_0xf54e('0x46')][_0xf54e('0x47')]({'where':{'id':_0x311ce1[_0xf54e('0x39')]['id']},'attributes':userAttributes})[_0xf54e('0x3e')](function(_0x143a39){if(!_0x143a39){return _0x381c03[_0xf54e('0x3f')](0x194)[_0xf54e('0x41')]({'message':_0xf54e('0x5d')});}_0x311ce1['user']=_0x143a39;_0x4f61d7();})[_0xf54e('0x4b')](function(_0x3447fd){_0x4f61d7(_0x3447fd);});}else if(_0x15b888){_0x4f61d7();}else{return _0x381c03[_0xf54e('0x3f')](0x194)[_0xf54e('0x41')]({'message':_0xf54e('0x5e')});}});};exports[_0xf54e('0x5f')]=function canUpdate(){return compose()['use'](function(_0x23a4a1,_0x59af72,_0x1d16e0){return licenseUtil['getLicense']()[_0xf54e('0x3e')](function(_0x331b16){if(_0x331b16[_0xf54e('0x60')]){_0x1d16e0();}else{return _0x59af72['status'](0x193)[_0xf54e('0x41')]({'message':_0xf54e('0x61')});}})[_0xf54e('0x4b')](function(_0x32fb46){_0x1d16e0(_0x32fb46);});});};exports[_0xf54e('0x62')]=function isWebrtcLicence(){return compose()['use'](function(_0x427799,_0x297737,_0x346bb4){return licenseUtil[_0xf54e('0x63')]()['then'](function(_0x1bdb5a){if(_0x1bdb5a[_0xf54e('0x64')]){_0x346bb4();}else{return _0x297737['status'](0x193)[_0xf54e('0x41')]({'message':_0xf54e('0x61')});}})[_0xf54e('0x4b')](function(_0xca0141){_0x346bb4(_0xca0141);});});};exports['isMiddleware']=function(_0x196e68,_0x2b645e,_0x2527f6){_0x196e68[_0xf54e('0x65')]=!![];return _0x2527f6();};exports[_0xf54e('0x66')]=function signToken(_0x3237ef){return signJwt(_0x3237ef);};exports[_0xf54e('0x67')]=function(_0xd7b0c5,_0x15bfef){if(!_0xd7b0c5[_0xf54e('0x39')]){return _0x15bfef[_0xf54e('0x3f')](0x194)[_0xf54e('0x41')]({'message':_0xf54e('0x68')});}var _0x2de1fe={'payload':{'id':_0xd7b0c5[_0xf54e('0x39')]['id'],'role':_0xd7b0c5[_0xf54e('0x39')][_0xf54e('0x69')]},'options':{'expiresIn':0x15180}};return signJwt(_0x2de1fe)[_0xf54e('0x3e')](function(_0x21fd80){_0x15bfef[_0xf54e('0x6a')]('motion.token',_0x21fd80);_0x15bfef['redirect'](_0xf54e('0x6b'));})[_0xf54e('0x4b')](function(_0x45861b){return _0x15bfef[_0xf54e('0x3f')](0x1f4)[_0xf54e('0x6c')](_0x45861b);});};exports[_0xf54e('0x6d')]=function(_0x22763f){if(_[_0xf54e('0x6e')](_0x22763f[_0xf54e('0x54')])||_[_0xf54e('0x6e')](_0x22763f[_0xf54e('0x6f')])){return null;}else{return createJwt(_0x22763f);}};exports['generateApiKey']=function(_0x2aacf6){_0x2aacf6[_0xf54e('0x54')]=generateNonce();_0x2aacf6[_0xf54e('0x6f')]=generateIssuedAt();return createJwt(_0x2aacf6);};exports[_0xf54e('0x70')]=function(_0x1b8f16,_0x30f53b){var _0x18a25f=_0x1b8f16['query'][_0xf54e('0x4f')];if(_0x18a25f){var _0x5fabd2={'nonce':_0x30f53b[_0xf54e('0x54')],'iat':_0x30f53b['apiKeyIat'],'audience':hardwareConf[_0xf54e('0x50')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x18a25f,_0x5fabd2)[_0xf54e('0x3e')](function(){return generateApiKey(_0x30f53b);});}else{throw{'message':_0xf54e('0x71')};}};exports[_0xf54e('0x72')]=function(_0x5b882f){var _0x1d8ccf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1d8ccf[_0xf54e('0x73')](_0x5b882f))throw new db[(_0xf54e('0x74'))][(_0xf54e('0x75'))](_0xf54e('0x76'));return;};exports[_0xf54e('0x77')]=function(_0x21d485,_0x55d57f,_0x55de5c){var _0x4270e1=encryptor[_0xf54e('0x78')](_0x55d57f)['split'](',');for(var _0x29743e=0x0;_0x29743e<_0x55de5c;_0x29743e++){if(!_0x4270e1[_0x29743e])break;if(_0x21d485['toLowerCase']()===_0x4270e1[_0x29743e][_0xf54e('0x79')]()){var _0x528a64=util[_0xf54e('0x7a')](_0xf54e('0x7b'),_0x55de5c);if(_0x55de5c===0x1){_0x528a64=_0xf54e('0x7c');}throw new db[(_0xf54e('0x74'))][(_0xf54e('0x75'))](_0x528a64);}}return;};exports[_0xf54e('0x7d')]=function(_0x556e55,_0x479572){var _0x79345=_0x479572?encryptor[_0xf54e('0x78')](_0x479572)['split'](','):[];if(_0x79345['length']===0x5){_0x79345[_0xf54e('0x7e')](-0x1,0x1);}_0x79345['unshift'](_0x556e55);return encryptor[_0xf54e('0x7f')](_0x79345[_0xf54e('0x80')](','));};function signJwt(_0x47596c){var _0x2b11f8=BPromise[_0xf54e('0x81')](jwt[_0xf54e('0x82')],{'context':jwt});var _0x3bf476=_0x47596c[_0xf54e('0x83')]||config[_0xf54e('0xb')][_0xf54e('0xc')];return new BPromise(function(_0x1f9dad,_0x2c6d0e){_0x2b11f8(_0x47596c[_0xf54e('0x84')],_0x3bf476,_0x47596c[_0xf54e('0x85')])['then'](function(_0x302f3d){_0x1f9dad(_0x302f3d);})[_0xf54e('0x4b')](function(_0xb7ff4d){_0x2c6d0e(_0xb7ff4d);});});}function verifyJwt(_0x11908b,_0x1e4c0d,_0x494629){var _0xf50b1b=BPromise[_0xf54e('0x81')](jwt['verify'],{'context':jwt});var _0x51ec35=_0x494629||config[_0xf54e('0xb')]['session'];return new BPromise(function(_0x26322a,_0x39c5eb){_0xf50b1b(_0x11908b,_0x51ec35,_0x1e4c0d)[_0xf54e('0x3e')](function(_0x9789b9){_0x26322a(_0x9789b9);})['catch'](function(_0x2ecda1){_0x39c5eb(_0x2ecda1);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xf54e('0x86')](_0xf54e('0x87'));}function generateIssuedAt(){return Math[_0xf54e('0x88')](Date['now']()/0x3e8)[_0xf54e('0x86')]();}function createJwt(_0x504ec7){var _0x3f7224={'payload':{'iat':_0x504ec7[_0xf54e('0x6f')],'nonce':_0x504ec7['apiKeyNonce']},'options':{'algorithm':_0xf54e('0x89'),'subject':_0x504ec7['id']['toString'](),'issuer':hardwareConf[_0xf54e('0x50')](),'audience':hardwareConf[_0xf54e('0x50')]()}};return signJwt(_0x3f7224)[_0xf54e('0x3e')](function(_0x38405c){return{'iat':_0x504ec7[_0xf54e('0x6f')],'nonce':_0x504ec7['apiKeyNonce'],'token':_0x38405c};});} \ No newline at end of file +var _0x00bb=['lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','use','user','findOne','params','disposition','then','closed','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','Basic','User','find','pass','status','Wrong\x20credentials.','Bearer','json','Unknown\x20authorization\x20format','query','getUuid','apikey','sub','Setting','allowedLoginAttempts','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','join','promisify','sign','secret','options','verify','toString','hex','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','jsonwebtoken','express-jwt','basic-auth','crypto','secrets','session','role','fullname','name','internal','permissions','md5secret','voicePause','chatPause','mailPause','smsPause'];(function(_0x22ab6f,_0xfa5f4b){var _0x432d82=function(_0x1c27f2){while(--_0x1c27f2){_0x22ab6f['push'](_0x22ab6f['shift']());}};_0x432d82(++_0xfa5f4b);}(_0x00bb,0x1d8));var _0xb00b=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x00bb[_0x411add];return _0x238242;};'use strict';var db=require(_0xb00b('0x0'))['db'];var config=require(_0xb00b('0x1'));var hardwareConf=require(_0xb00b('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xb00b('0x3'));var _=require('lodash');var jwt=require(_0xb00b('0x4'));var expressJwt=require(_0xb00b('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0xb00b('0x6'));var crypto=require(_0xb00b('0x7'));var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xb00b('0x8')][_0xb00b('0x9')]});var userAttributes=['id',_0xb00b('0xa'),_0xb00b('0xb'),_0xb00b('0xc'),_0xb00b('0xd'),'email','userpic',_0xb00b('0xe'),_0xb00b('0xf'),_0xb00b('0x10'),_0xb00b('0x11'),_0xb00b('0x12'),'faxPause',_0xb00b('0x13'),'openchannelPause','pauseType','showWebBar',_0xb00b('0x14'),_0xb00b('0x15'),_0xb00b('0x16'),_0xb00b('0x17'),_0xb00b('0x18'),_0xb00b('0x19'),'phoneBarAutoAnswer',_0xb00b('0x1a'),_0xb00b('0x1b'),'phoneBarEnableRecording',_0xb00b('0x1c'),_0xb00b('0x1d'),'phoneBarExpires','phoneBarPrefixRequired',_0xb00b('0x1e'),'phoneBarRemoteControlPort','hotdesk',_0xb00b('0x1f'),_0xb00b('0x20'),_0xb00b('0x21'),_0xb00b('0x22'),'wssPort',_0xb00b('0x23'),'downloadOmnichannelInteractions',_0xb00b('0x24'),'ignorePauseForPreviewCalls',_0xb00b('0x25'),'chatAutoanswer',_0xb00b('0x26'),_0xb00b('0x27'),'emailAutoanswerDelay','smsAutoanswer',_0xb00b('0x28'),'openchannelAutoanswer',_0xb00b('0x29'),_0xb00b('0x2a'),_0xb00b('0x2b'),_0xb00b('0x2c'),'whatsappAutoanswerDelay'];exports[_0xb00b('0x2d')]=function(){return this['isAuthenticated'](!![])[_0xb00b('0x2e')](function(_0x121ec7,_0x51b841,_0x231293){if(_0x121ec7[_0xb00b('0x2f')]){_0x231293();}else{return db['ChatInteraction'][_0xb00b('0x30')]({'where':{'id':_0x121ec7[_0xb00b('0x31')]['id']},'attributes':['id','closed',_0xb00b('0x32')],'raw':!![]})[_0xb00b('0x33')](function(_0x3c9500){if(_0x3c9500&&_0x3c9500[_0xb00b('0x34')]){return _0x51b841['status'](_0x3c9500['disposition']===_0xb00b('0x35')?0x195:0x193)['json']({'message':_0x3c9500['disposition']==='unmanaged'?_0xb00b('0x36'):_0xb00b('0x37')});}else{_0x231293();}})[_0xb00b('0x38')](function(_0x3825af){_0x231293(_0x3825af);});}});};exports[_0xb00b('0x39')]=function isAuthenticated(_0x197379){return compose()[_0xb00b('0x2e')](function(_0x4a8d2b,_0x22c22d,_0x503c9c){var _0x450129;if(_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')]){if(_['startsWith'](_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')],_0xb00b('0x3c'))){var _0x183233=basicAuth(_0x4a8d2b);db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'name':_0x183233[_0xb00b('0xc')]}})[_0xb00b('0x33')](function(_0x149c1a){if(!_0x149c1a||!_0x149c1a['authenticate'](_0x183233[_0xb00b('0x3f')])){return _0x22c22d[_0xb00b('0x40')](0x191)['json']({'message':_0xb00b('0x41')});}_0x4a8d2b[_0xb00b('0x2f')]={'id':_0x149c1a['id']};_0x503c9c();})['catch'](function(_0x456241){_0x503c9c(_0x456241);});}else if(_['startsWith'](_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')],_0xb00b('0x42'))){validateJwt(_0x4a8d2b,_0x22c22d,_0x503c9c);}else{if(_0x197379){_0x503c9c();}else{return _0x22c22d[_0xb00b('0x40')](0x193)[_0xb00b('0x43')]({'message':_0xb00b('0x44')});}}}else if(_0x4a8d2b[_0xb00b('0x45')]['apikey']){try{var _0x57e8f9={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb00b('0x46')]()};verifyJwt(_0x4a8d2b[_0xb00b('0x45')][_0xb00b('0x47')],_0x57e8f9)[_0xb00b('0x33')](function(_0x5cfa60){return db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'id':_0x5cfa60[_0xb00b('0x48')]}})[_0xb00b('0x33')](function(_0x261c80){_0x450129=_0x261c80;return db[_0xb00b('0x49')][_0xb00b('0x30')]({'where':{'id':0x1},'attributes':[_0xb00b('0x4a'),'blockDuration'],'raw':!![]});})['then'](function(_0x2ea41d){if(!_0x450129||!_['isEqual'](_0x450129[_0xb00b('0x4b')],_0x5cfa60[_0xb00b('0x4c')])){return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4d')});}if(_0x450129[_0xb00b('0x4e')]){return _0x22c22d[_0xb00b('0x40')](0x191)['json']({'message':_0xb00b('0x4f')});}if(_0x450129[_0xb00b('0x50')]){if(_0x2ea41d[_0xb00b('0x51')]>0x0){if(moment(_0x450129[_0xb00b('0x52')])[_0xb00b('0x53')](_0x2ea41d[_0xb00b('0x51')],'minutes')>moment()){return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4f')});}}_0x4a8d2b[_0xb00b('0x2f')]={'id':_0x450129['id']};_0x503c9c();});})[_0xb00b('0x38')](function(){return _0x22c22d['status'](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4f')});});}catch(_0xb76ede){_0x503c9c(_0xb76ede);}}else if(_0x197379){_0x503c9c();}else{return _0x22c22d[_0xb00b('0x40')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0xb00b('0x2e')](function(_0xf6ae0c,_0x10a348,_0x152437){if(_0xf6ae0c[_0xb00b('0x2f')]){db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'id':_0xf6ae0c['user']['id']},'attributes':userAttributes})[_0xb00b('0x33')](function(_0x3b72c4){if(!_0x3b72c4){return _0x10a348[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x54')});}_0xf6ae0c[_0xb00b('0x2f')]=_0x3b72c4;_0x152437();})[_0xb00b('0x38')](function(_0x974a29){_0x152437(_0x974a29);});}else if(_0x197379){_0x152437();}else{return _0x10a348[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x55')});}});};exports[_0xb00b('0x56')]=function canUpdate(){return compose()['use'](function(_0x3da23c,_0x35a0ba,_0xd07fb8){return licenseUtil[_0xb00b('0x57')]()[_0xb00b('0x33')](function(_0x2d9174){if(_0x2d9174[_0xb00b('0x58')]){_0xd07fb8();}else{return _0x35a0ba[_0xb00b('0x40')](0x193)[_0xb00b('0x43')]({'message':_0xb00b('0x59')});}})[_0xb00b('0x38')](function(_0x3b3031){_0xd07fb8(_0x3b3031);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x47c6c0,_0x3f8f60,_0x23d858){return licenseUtil['getLicense']()[_0xb00b('0x33')](function(_0x3c0fa){if(_0x3c0fa[_0xb00b('0x5a')]){_0x23d858();}else{return _0x3f8f60[_0xb00b('0x40')](0x193)['json']({'message':'Forbidden'});}})[_0xb00b('0x38')](function(_0x40c2fd){_0x23d858(_0x40c2fd);});});};exports['isMiddleware']=function(_0x514c5b,_0x154759,_0x3a205d){_0x514c5b['isMiddleware']=!![];return _0x3a205d();};exports[_0xb00b('0x5b')]=function signToken(_0x47a814){return signJwt(_0x47a814);};exports['setTokenCookie']=function(_0x4bcc9e,_0x465d90){if(!_0x4bcc9e['user']){return _0x465d90[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x5c')});}var _0xe724a5={'payload':{'id':_0x4bcc9e[_0xb00b('0x2f')]['id'],'role':_0x4bcc9e[_0xb00b('0x2f')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0xe724a5)['then'](function(_0x1d2a0d){_0x465d90[_0xb00b('0x5d')]('motion.token',_0x1d2a0d);_0x465d90[_0xb00b('0x5e')](_0xb00b('0x5f'));})['catch'](function(_0x15dcbf){return _0x465d90[_0xb00b('0x40')](0x1f4)[_0xb00b('0x60')](_0x15dcbf);});};exports['retrieveApiKey']=function(_0x501cbe){if(_[_0xb00b('0x61')](_0x501cbe[_0xb00b('0x4b')])||_[_0xb00b('0x61')](_0x501cbe[_0xb00b('0x62')])){return null;}else{return createJwt(_0x501cbe);}};exports['generateApiKey']=function(_0x380acb){_0x380acb[_0xb00b('0x4b')]=generateNonce();_0x380acb['apiKeyIat']=generateIssuedAt();return createJwt(_0x380acb);};exports['regenerateApiKey']=function(_0x160965,_0x524b05){var _0x1ab196=_0x160965[_0xb00b('0x45')][_0xb00b('0x47')];if(_0x1ab196){var _0x222459={'nonce':_0x524b05[_0xb00b('0x4b')],'iat':_0x524b05[_0xb00b('0x62')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb00b('0x46')]()};return verifyJwt(_0x1ab196,_0x222459)['then'](function(){return generateApiKey(_0x524b05);});}else{throw{'message':_0xb00b('0x63')};}};exports[_0xb00b('0x64')]=function(_0x4129ba){var _0x5ac79e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5ac79e[_0xb00b('0x65')](_0x4129ba))throw new db[(_0xb00b('0x66'))][(_0xb00b('0x67'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0xb00b('0x68')]=function(_0x309ae6,_0x219b74,_0x385029){var _0x131848=encryptor[_0xb00b('0x69')](_0x219b74)[_0xb00b('0x6a')](',');for(var _0x3a0b90=0x0;_0x3a0b90<_0x385029;_0x3a0b90++){if(!_0x131848[_0x3a0b90])break;if(_0x309ae6['toLowerCase']()===_0x131848[_0x3a0b90][_0xb00b('0x6b')]()){var _0x2cbe80=util[_0xb00b('0x6c')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x385029);if(_0x385029===0x1){_0x2cbe80=_0xb00b('0x6d');}throw new db[(_0xb00b('0x66'))][(_0xb00b('0x67'))](_0x2cbe80);}}return;};exports[_0xb00b('0x6e')]=function(_0x1ad387,_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b?encryptor[_0xb00b('0x69')](_0x4bfe0b)[_0xb00b('0x6a')](','):[];if(_0xfd4ecc[_0xb00b('0x6f')]===0x5){_0xfd4ecc['splice'](-0x1,0x1);}_0xfd4ecc[_0xb00b('0x70')](_0x1ad387);return encryptor[_0xb00b('0x71')](_0xfd4ecc[_0xb00b('0x72')](','));};function signJwt(_0x2d73bb){var _0x161216=BPromise[_0xb00b('0x73')](jwt[_0xb00b('0x74')],{'context':jwt});var _0x542223=_0x2d73bb[_0xb00b('0x75')]||config['secrets'][_0xb00b('0x9')];return new BPromise(function(_0x4c2186,_0x3b3272){_0x161216(_0x2d73bb['payload'],_0x542223,_0x2d73bb[_0xb00b('0x76')])['then'](function(_0x3dffaf){_0x4c2186(_0x3dffaf);})[_0xb00b('0x38')](function(_0x3bae02){_0x3b3272(_0x3bae02);});});}function verifyJwt(_0x4d1cec,_0x51fbe2,_0x4f7a59){var _0x21a53d=BPromise[_0xb00b('0x73')](jwt[_0xb00b('0x77')],{'context':jwt});var _0x49246b=_0x4f7a59||config[_0xb00b('0x8')][_0xb00b('0x9')];return new BPromise(function(_0xca87d4,_0x2ddba4){_0x21a53d(_0x4d1cec,_0x49246b,_0x51fbe2)[_0xb00b('0x33')](function(_0x485033){_0xca87d4(_0x485033);})[_0xb00b('0x38')](function(_0x27b13b){_0x2ddba4(_0x27b13b);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xb00b('0x78')](_0xb00b('0x79'));}function generateIssuedAt(){return Math[_0xb00b('0x7a')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x359669){var _0x188da7={'payload':{'iat':_0x359669[_0xb00b('0x62')],'nonce':_0x359669['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x359669['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xb00b('0x46')]()}};return signJwt(_0x188da7)['then'](function(_0x2434a0){return{'iat':_0x359669[_0xb00b('0x62')],'nonce':_0x359669['apiKeyNonce'],'token':_0x2434a0};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 83d65d0..03694b1 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 _0x0807=['algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','update','binary','end','final','write','close','createDecipher','encryptString','base64','decryptString','secret','utf8','crypto','lodash','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt'];(function(_0x54b4b1,_0x5167ed){var _0x3543e8=function(_0x595ed0){while(--_0x595ed0){_0x54b4b1['push'](_0x54b4b1['shift']());}};_0x3543e8(++_0x5167ed);}(_0x0807,0x129));var _0x7080=function(_0x508b34,_0x580a1c){_0x508b34=_0x508b34-0x0;var _0x5db234=_0x0807[_0x508b34];return _0x5db234;};'use strict';var crypto=require(_0x7080('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x7080('0x1'));var config=require(_0x7080('0x2'));var logger=require(_0x7080('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x7080('0x4')][_0x7080('0x5')],'algorithm':_0x7080('0x6')};const fileOptions={'algorithm':_0x7080('0x7')};if(config[_0x7080('0x8')]&&config['encrypt'][_0x7080('0x9')]){var isSupported=isAlgorithmSupported(config[_0x7080('0x8')][_0x7080('0x9')]);if(isSupported){fileOptions['algorithm']=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x7080('0xa')](',\x20');logger[_0x7080('0xb')](config[_0x7080('0x8')][_0x7080('0x9')],_0x7080('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x2613cb){return AES_SUPPORTED_RX[_0x7080('0xd')](_0x2613cb);}function getSupportedCiphers(){return crypto[_0x7080('0xe')]()[_0x7080('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x9d1a37){return getSupportedCiphers()[_0x7080('0x10')](_0x9d1a37)>-0x1;}function combineOptions(_0x7e5c2d){var _0x45d324={};for(var _0x4a2a53 in fileOptions){if(fileOptions[_0x7080('0x11')](_0x4a2a53)){_0x45d324[_0x4a2a53]=fileOptions[_0x4a2a53];}}if(_0x7e5c2d){for(var _0x28a890 in _0x7e5c2d){if(_0x7e5c2d[_0x7080('0x11')](_0x28a890)){_0x45d324[_0x28a890]=_0x7e5c2d[_0x28a890];}}}return _0x45d324;}exports[_0x7080('0x12')]=function(_0x234904,_0x148f8d,_0x52a403,_0x39cb80){return new BPromise(function(_0x3a2800,_0x19e468){_0x39cb80=combineOptions(_0x39cb80);var _0x41d9ea=new Buffer(_0x52a403);var _0x27b6b2=fs[_0x7080('0x13')](_0x234904);var _0x37ac9c=fs[_0x7080('0x14')](_0x148f8d);var _0x52abae=crypto[_0x7080('0x15')](_0x39cb80[_0x7080('0x9')],_0x41d9ea);_0x27b6b2['on']('data',function(_0x1dd56c){var _0x48c4ba=new Buffer(_0x52abae[_0x7080('0x16')](_0x1dd56c),_0x7080('0x17'));_0x37ac9c['write'](_0x48c4ba);});_0x27b6b2['on'](_0x7080('0x18'),function(){try{var _0x274e99=new Buffer(_0x52abae[_0x7080('0x19')]('binary'),'binary');_0x37ac9c[_0x7080('0x1a')](_0x274e99);_0x37ac9c[_0x7080('0x18')]();_0x37ac9c['on'](_0x7080('0x1b'),function(){return _0x3a2800(_0x148f8d);});}catch(_0x15e8d6){fs['unlink'](_0x148f8d);return _0x19e468(_0x15e8d6);}});});};exports['decryptFile']=function(_0x583058,_0xfe7353,_0x1b74bd,_0x597f3c){return new BPromise(function(_0x4285bc,_0x1a57ff){_0x597f3c=combineOptions(_0x597f3c);var _0x1e3bb7=new Buffer(_0x1b74bd);var _0x4225cd=fs[_0x7080('0x13')](_0x583058);var _0x30e97c=fs[_0x7080('0x14')](_0xfe7353);var _0x30f0e8=crypto[_0x7080('0x1c')](_0x597f3c['algorithm'],_0x1e3bb7);_0x4225cd['on']('data',function(_0x583d16){var _0x2bb1e7=new Buffer(_0x30f0e8[_0x7080('0x16')](_0x583d16),_0x7080('0x17'));_0x30e97c['write'](_0x2bb1e7);});_0x4225cd['on']('end',function(){try{var _0x2e8ecc=new Buffer(_0x30f0e8[_0x7080('0x19')](_0x7080('0x17')),_0x7080('0x17'));_0x30e97c[_0x7080('0x1a')](_0x2e8ecc);_0x30e97c[_0x7080('0x18')]();_0x30e97c['on'](_0x7080('0x1b'),function(){return _0x4285bc(_0xfe7353);});}catch(_0x5643bd){fs['unlink'](_0xfe7353);return _0x1a57ff(_0x5643bd);}});});};exports[_0x7080('0x1d')]=function(_0x2f0259,_0x9e666,_0xdecade){var _0x304a92=_0xdecade||stringOptions[_0x7080('0x9')];var _0x4e9b2f=_0x9e666||stringOptions['secret'];var _0x454a4c=crypto[_0x7080('0x15')](_0x304a92,_0x4e9b2f);var _0x55ccb5=_0x454a4c['update'](_0x2f0259,'utf8','base64');_0x55ccb5+=_0x454a4c['final'](_0x7080('0x1e'));return _0x55ccb5;};exports[_0x7080('0x1f')]=function(_0x569232,_0x1634c8,_0xc614e0){var _0x3b5212=_0xc614e0||stringOptions['algorithm'];var _0x30b7bd=_0x1634c8||stringOptions[_0x7080('0x20')];var _0x564703=crypto['createDecipher'](_0x3b5212,_0x30b7bd);var _0xeed3e6=_0x564703[_0x7080('0x16')](_0x569232,_0x7080('0x1e'),'utf8');_0xeed3e6+=_0x564703['final'](_0x7080('0x21'));return _0xeed3e6;}; \ No newline at end of file +var _0x08e1=['../../config/environment','secrets','session','aes-256-ctr','encrypt','algorithm','join','test','getCiphers','filter','indexOf','createWriteStream','createCipher','update','write','end','final','binary','unlink','createReadStream','createDecipher','data','close','encryptString','secret','base64','decryptString','utf8','crypto','bluebird','lodash'];(function(_0x4020c6,_0x42e3ec){var _0x1778bd=function(_0x1400cd){while(--_0x1400cd){_0x4020c6['push'](_0x4020c6['shift']());}};_0x1778bd(++_0x42e3ec);}(_0x08e1,0x79));var _0x108e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x08e1[_0x34bf97];return _0x292719;};'use strict';var crypto=require(_0x108e('0x0'));var fs=require('fs');var BPromise=require(_0x108e('0x1'));var _=require(_0x108e('0x2'));var config=require(_0x108e('0x3'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x108e('0x4')][_0x108e('0x5')],'algorithm':_0x108e('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0x108e('0x7')]&&config[_0x108e('0x7')][_0x108e('0x8')]){var isSupported=isAlgorithmSupported(config[_0x108e('0x7')][_0x108e('0x8')]);if(isSupported){fileOptions[_0x108e('0x8')]=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x108e('0x9')](',\x20');logger['error'](config['encrypt'][_0x108e('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x8c34a4){return AES_SUPPORTED_RX[_0x108e('0xa')](_0x8c34a4);}function getSupportedCiphers(){return crypto[_0x108e('0xb')]()[_0x108e('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0xc29ff6){return getSupportedCiphers()[_0x108e('0xd')](_0xc29ff6)>-0x1;}function combineOptions(_0x223f04){var _0x3be024={};for(var _0xf1f949 in fileOptions){if(fileOptions['hasOwnProperty'](_0xf1f949)){_0x3be024[_0xf1f949]=fileOptions[_0xf1f949];}}if(_0x223f04){for(var _0x156f53 in _0x223f04){if(_0x223f04['hasOwnProperty'](_0x156f53)){_0x3be024[_0x156f53]=_0x223f04[_0x156f53];}}}return _0x3be024;}exports['encryptFile']=function(_0x3dc9da,_0xfb0dd,_0x250f2b,_0x57c427){return new BPromise(function(_0x5856ab,_0x9fe723){_0x57c427=combineOptions(_0x57c427);var _0x115c77=new Buffer(_0x250f2b);var _0x54a115=fs['createReadStream'](_0x3dc9da);var _0x7bb1fb=fs[_0x108e('0xe')](_0xfb0dd);var _0x1ca365=crypto[_0x108e('0xf')](_0x57c427[_0x108e('0x8')],_0x115c77);_0x54a115['on']('data',function(_0xe4df22){var _0xb6d529=new Buffer(_0x1ca365[_0x108e('0x10')](_0xe4df22),'binary');_0x7bb1fb[_0x108e('0x11')](_0xb6d529);});_0x54a115['on'](_0x108e('0x12'),function(){try{var _0x2c7848=new Buffer(_0x1ca365[_0x108e('0x13')]('binary'),_0x108e('0x14'));_0x7bb1fb[_0x108e('0x11')](_0x2c7848);_0x7bb1fb['end']();_0x7bb1fb['on']('close',function(){return _0x5856ab(_0xfb0dd);});}catch(_0x31b3de){fs[_0x108e('0x15')](_0xfb0dd);return _0x9fe723(_0x31b3de);}});});};exports['decryptFile']=function(_0x535c9d,_0x10cb30,_0x551fc2,_0x443c96){return new BPromise(function(_0x91d0cb,_0x58d311){_0x443c96=combineOptions(_0x443c96);var _0x4b7272=new Buffer(_0x551fc2);var _0x27c26d=fs[_0x108e('0x16')](_0x535c9d);var _0xdd7eb4=fs[_0x108e('0xe')](_0x10cb30);var _0x5c4d26=crypto[_0x108e('0x17')](_0x443c96[_0x108e('0x8')],_0x4b7272);_0x27c26d['on'](_0x108e('0x18'),function(_0x51d126){var _0x7d3507=new Buffer(_0x5c4d26['update'](_0x51d126),'binary');_0xdd7eb4['write'](_0x7d3507);});_0x27c26d['on'](_0x108e('0x12'),function(){try{var _0x446be4=new Buffer(_0x5c4d26[_0x108e('0x13')]('binary'),_0x108e('0x14'));_0xdd7eb4['write'](_0x446be4);_0xdd7eb4[_0x108e('0x12')]();_0xdd7eb4['on'](_0x108e('0x19'),function(){return _0x91d0cb(_0x10cb30);});}catch(_0x1cdb52){fs['unlink'](_0x10cb30);return _0x58d311(_0x1cdb52);}});});};exports[_0x108e('0x1a')]=function(_0x2e70b5,_0x3133e2,_0x92fc95){var _0x4d8510=_0x92fc95||stringOptions[_0x108e('0x8')];var _0x2cda49=_0x3133e2||stringOptions[_0x108e('0x1b')];var _0x387d48=crypto['createCipher'](_0x4d8510,_0x2cda49);var _0x92aba9=_0x387d48[_0x108e('0x10')](_0x2e70b5,'utf8',_0x108e('0x1c'));_0x92aba9+=_0x387d48[_0x108e('0x13')](_0x108e('0x1c'));return _0x92aba9;};exports[_0x108e('0x1d')]=function(_0x14fd6f,_0xb6c211,_0x5b9e24){var _0x4fe9b6=_0x5b9e24||stringOptions[_0x108e('0x8')];var _0x56fe66=_0xb6c211||stringOptions['secret'];var _0x1904d5=crypto['createDecipher'](_0x4fe9b6,_0x56fe66);var _0xa65e89=_0x1904d5['update'](_0x14fd6f,_0x108e('0x1c'),_0x108e('0x1e'));_0xa65e89+=_0x1904d5[_0x108e('0x13')](_0x108e('0x1e'));return _0xa65e89;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index f981cc3..37c39de 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 _0x5744=['query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','existsSync','join','each','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','then','splitSizeCsv','sequelize'];(function(_0x3330b8,_0x19b32a){var _0x191799=function(_0xb95e53){while(--_0xb95e53){_0x3330b8['push'](_0x3330b8['shift']());}};_0x191799(++_0x19b32a);}(_0x5744,0x118));var _0x4574=function(_0x257ad4,_0x4815c0){_0x257ad4=_0x257ad4-0x0;var _0xd8daf0=_0x5744[_0x257ad4];return _0xd8daf0;};'use strict';var util=require(_0x4574('0x0'));var path=require(_0x4574('0x1'));var _=require(_0x4574('0x2'));var csv=require(_0x4574('0x3'));var fs=require('fs');var BPromise=require(_0x4574('0x4'));var zipdir=require(_0x4574('0x5'));var rimraf=require(_0x4574('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4574('0x7'))[_0x4574('0x8')];var logger=require('../../config/logger')(_0x4574('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x4574('0xa')][0x2]);var QUERY=process[_0x4574('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x45a596,_0x8db9d8){var _0x1d477a={'status':_0x45a596};var _0x1c9f0b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8db9d8){_0x1d477a[_0x4574('0xb')]=_0x8db9d8;}return db['AnalyticExtractedReport']['update'](_0x1d477a,_0x1c9f0b);}function main(){var _0x50dbe6=0x1388;var _0x41a1de;logger['info'](util[_0x4574('0xc')](_0x4574('0xd'),EXTRACTED_REPORT_ID,_0x4574('0xe')));return db[_0x4574('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4574('0x10'),'splitSizeCsv']})[_0x4574('0x11')](function(_0x5473d6){if(_0x5473d6){_0x41a1de=_0x5473d6;_0x50dbe6=_0x41a1de[_0x4574('0x12')]||0x1388;}})[_0x4574('0x11')](function(){return dbH[_0x4574('0x13')][_0x4574('0x14')](util[_0x4574('0xc')](_0x4574('0x15'),QUERY),{'type':dbH[_0x4574('0x13')][_0x4574('0x16')]['SELECT']});})[_0x4574('0x11')](function(_0x2312e8){if(!_0x2312e8[0x0][_0x4574('0x17')]){return analyticExtractedReport(_0x4574('0x18'));}var _0x4e4a0a=[];var _0x25a85b=0x0;if(_0x41a1de[_0x4574('0x10')]){if(_0x2312e8&&_0x2312e8[_0x4574('0x19')]){var _0x236355=_['range'](_0x2312e8[0x0]['num']/_0x50dbe6);var _0x27115b=Number[_0x4574('0x1a')](_0x2312e8[0x0][_0x4574('0x17')]/_0x50dbe6)?_0x2312e8[0x0][_0x4574('0x17')]%_0x50dbe6:0x0;_0x236355[_0x4574('0x1b')](function(_0x2376ef){if(_0x2376ef>0x0){_0x25a85b+=_0x50dbe6;}_0x4e4a0a[_0x4574('0x1c')](dbH[_0x4574('0x13')][_0x4574('0x14')](util[_0x4574('0xc')](_0x4574('0x1d'),QUERY,_0x50dbe6,_0x25a85b),{'type':dbH[_0x4574('0x13')]['QueryTypes'][_0x4574('0x1e')]}));});if(_0x27115b>0x0){_0x25a85b+=_0x50dbe6;_0x4e4a0a[_0x4574('0x1c')](dbH[_0x4574('0x13')]['query'](util[_0x4574('0xc')](_0x4574('0x1d'),QUERY,_0x27115b,_0x25a85b),{'type':dbH[_0x4574('0x13')][_0x4574('0x16')][_0x4574('0x1e')]}));}}}else{_0x4e4a0a[_0x4574('0x1c')](dbH[_0x4574('0x13')][_0x4574('0x14')](QUERY,{'type':dbH[_0x4574('0x13')]['QueryTypes'][_0x4574('0x1e')]}));}var _0x4eab4a=path[_0x4574('0x1f')](PATH);var _0xa767a9=path[_0x4574('0x20')](PATH,_0x4574('0x21'));var _0x18d69b=_0x41a1de['split']&&_0x4e4a0a[_0x4574('0x19')]>0x1;var _0x1cf4ac=[];if(!fs[_0x4574('0x22')](path['join'](_0x4eab4a,_0xa767a9))&&_0x18d69b){fs['mkdirSync'](path[_0x4574('0x23')](_0x4eab4a,_0xa767a9));}return BPromise[_0x4574('0x24')](_0x4e4a0a,function(_0x21700a){_0x1cf4ac['push'](_0x21700a);})[_0x4574('0x11')](function(){for(var _0x3754f5=0x0;_0x3754f5<_0x1cf4ac[_0x4574('0x19')];_0x3754f5+=0x1){var _0x16988b;var _0x301c60=_0x1cf4ac[_0x3754f5];if(_0x18d69b){_0x16988b=path[_0x4574('0x23')](_0x4eab4a,_0xa767a9,util[_0x4574('0xc')]('%s%d.%s',_0xa767a9,_0x3754f5,_0x4574('0x25')));}else{_0x16988b=path['join'](_0x4eab4a,util[_0x4574('0xc')](_0x4574('0x26'),_0xa767a9,_0x4574('0x25')));}fs[_0x4574('0x27')](_0x16988b,csv(_0x301c60));}})['then'](function(){if(_0x18d69b){return new Promise(function(_0x2af301){zipdir(path['join'](_0x4eab4a,_0xa767a9),{'saveTo':path[_0x4574('0x23')](_0x4eab4a,util['format'](_0x4574('0x26'),_0xa767a9,_0x4574('0x28')))},function(_0x40e23b,_0x488cca){rimraf(path[_0x4574('0x23')](_0x4eab4a,_0xa767a9),function(){});_0x2af301(_0x4574('0x29'));});});}})[_0x4574('0x11')](function(){logger['info'](util[_0x4574('0xc')](_0x4574('0x2a'),EXTRACTED_REPORT_ID,_0x4574('0xe')));return analyticExtractedReport(_0x4574('0x2b'),_0x18d69b?util[_0x4574('0xc')](_0x4574('0x26'),_0xa767a9,_0x18d69b?_0x4574('0x28'):_0x4574('0x25')):null);});})['catch'](function(_0x5319bd){logger[_0x4574('0x2c')](util[_0x4574('0xc')](_0x4574('0x2d'),EXTRACTED_REPORT_ID,_0x4574('0xe')),util[_0x4574('0x2e')](_0x5319bd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4574('0x2f'));})[_0x4574('0x30')](function(){process[_0x4574('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xbf83=['split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','QueryTypes','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','inspect','Failed','exit','util','path','to-csv','bluebird','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x39b727,_0x4f4437){var _0x238a93=function(_0x1bdfb0){while(--_0x1bdfb0){_0x39b727['push'](_0x39b727['shift']());}};_0x238a93(++_0x4f4437);}(_0xbf83,0x13c));var _0x3bf8=function(_0x246d03,_0x529f8a){_0x246d03=_0x246d03-0x0;var _0x1fd11c=_0xbf83[_0x246d03];return _0x1fd11c;};'use strict';var util=require(_0x3bf8('0x0'));var path=require(_0x3bf8('0x1'));var _=require('lodash');var csv=require(_0x3bf8('0x2'));var fs=require('fs');var BPromise=require(_0x3bf8('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x3bf8('0x4'));var db=require(_0x3bf8('0x5'))['db'];var dbH=require(_0x3bf8('0x5'))['dbH'];var logger=require(_0x3bf8('0x6'))(_0x3bf8('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x3bf8('0x8')][0x2]);var QUERY=process[_0x3bf8('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x211911,_0x30eee8){var _0x125b62={'status':_0x211911};var _0x38bb7b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x30eee8){_0x125b62['savename']=_0x30eee8;}return db[_0x3bf8('0x9')]['update'](_0x125b62,_0x38bb7b);}function main(){var _0x5aa4f4=0x1388;var _0x4691eb;logger[_0x3bf8('0xa')](util[_0x3bf8('0xb')](_0x3bf8('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3bf8('0xd'),_0x3bf8('0xe')]})[_0x3bf8('0xf')](function(_0x16647d){if(_0x16647d){_0x4691eb=_0x16647d;_0x5aa4f4=_0x4691eb[_0x3bf8('0xe')]||0x1388;}})['then'](function(){return dbH[_0x3bf8('0x10')][_0x3bf8('0x11')](util['format'](_0x3bf8('0x12'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x3bf8('0x13')]});})['then'](function(_0x43fb04){if(!_0x43fb04[0x0][_0x3bf8('0x14')]){return analyticExtractedReport('Empty');}var _0x38da73=[];var _0x2e0edc=0x0;if(_0x4691eb['split']){if(_0x43fb04&&_0x43fb04[_0x3bf8('0x15')]){var _0x2af17b=_[_0x3bf8('0x16')](_0x43fb04[0x0][_0x3bf8('0x14')]/_0x5aa4f4);var _0xc58171=Number[_0x3bf8('0x17')](_0x43fb04[0x0][_0x3bf8('0x14')]/_0x5aa4f4)?_0x43fb04[0x0]['num']%_0x5aa4f4:0x0;_0x2af17b[_0x3bf8('0x18')](function(_0x542369){if(_0x542369>0x0){_0x2e0edc+=_0x5aa4f4;}_0x38da73['push'](dbH['sequelize'][_0x3bf8('0x11')](util[_0x3bf8('0xb')](_0x3bf8('0x19'),QUERY,_0x5aa4f4,_0x2e0edc),{'type':dbH[_0x3bf8('0x10')]['QueryTypes']['SELECT']}));});if(_0xc58171>0x0){_0x2e0edc+=_0x5aa4f4;_0x38da73[_0x3bf8('0x1a')](dbH[_0x3bf8('0x10')][_0x3bf8('0x11')](util[_0x3bf8('0xb')](_0x3bf8('0x19'),QUERY,_0xc58171,_0x2e0edc),{'type':dbH[_0x3bf8('0x10')][_0x3bf8('0x1b')][_0x3bf8('0x13')]}));}}}else{_0x38da73['push'](dbH[_0x3bf8('0x10')][_0x3bf8('0x11')](QUERY,{'type':dbH[_0x3bf8('0x10')][_0x3bf8('0x1b')][_0x3bf8('0x13')]}));}var _0x237bc6=path[_0x3bf8('0x1c')](PATH);var _0x100f4e=path[_0x3bf8('0x1d')](PATH,'.csv');var _0x2f8c6e=_0x4691eb['split']&&_0x38da73[_0x3bf8('0x15')]>0x1;var _0x41bbb4=[];if(!fs[_0x3bf8('0x1e')](path[_0x3bf8('0x1f')](_0x237bc6,_0x100f4e))&&_0x2f8c6e){fs[_0x3bf8('0x20')](path[_0x3bf8('0x1f')](_0x237bc6,_0x100f4e));}return BPromise[_0x3bf8('0x21')](_0x38da73,function(_0x2b9741){_0x41bbb4[_0x3bf8('0x1a')](_0x2b9741);})[_0x3bf8('0xf')](function(){for(var _0x236ddb=0x0;_0x236ddb<_0x41bbb4[_0x3bf8('0x15')];_0x236ddb+=0x1){var _0xa0f960;var _0x3e98b5=_0x41bbb4[_0x236ddb];if(_0x2f8c6e){_0xa0f960=path['join'](_0x237bc6,_0x100f4e,util[_0x3bf8('0xb')](_0x3bf8('0x22'),_0x100f4e,_0x236ddb,_0x3bf8('0x23')));}else{_0xa0f960=path[_0x3bf8('0x1f')](_0x237bc6,util[_0x3bf8('0xb')](_0x3bf8('0x24'),_0x100f4e,_0x3bf8('0x23')));}fs[_0x3bf8('0x25')](_0xa0f960,csv(_0x3e98b5));}})[_0x3bf8('0xf')](function(){if(_0x2f8c6e){return new Promise(function(_0x312c5e){zipdir(path[_0x3bf8('0x1f')](_0x237bc6,_0x100f4e),{'saveTo':path[_0x3bf8('0x1f')](_0x237bc6,util[_0x3bf8('0xb')](_0x3bf8('0x24'),_0x100f4e,'zip'))},function(_0x3d4f85,_0x4f19ad){rimraf(path[_0x3bf8('0x1f')](_0x237bc6,_0x100f4e),function(){});_0x312c5e('zip\x20finished');});});}})[_0x3bf8('0xf')](function(){logger['info'](util[_0x3bf8('0xb')](_0x3bf8('0x26'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x3bf8('0x27'),_0x2f8c6e?util['format'](_0x3bf8('0x24'),_0x100f4e,_0x2f8c6e?_0x3bf8('0x28'):_0x3bf8('0x23')):null);});})[_0x3bf8('0x29')](function(_0x3c41d6){logger['info'](util[_0x3bf8('0xb')](_0x3bf8('0x2a'),EXTRACTED_REPORT_ID,_0x3bf8('0x2b')),util[_0x3bf8('0x2c')](_0x3c41d6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3bf8('0x2d'));})['finally'](function(){process[_0x3bf8('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index cba373c..d2b3fde 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 _0x4aa2=['channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','util','path','html-to-pdfmake','rimraf','jsdom','JSDOM','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','value','length','auto','body','push','concat','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','header','pageBreak','before','landscape','\x20/\x20','footer','Arial','black','right','num','find','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','pdf','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d'];(function(_0x177076,_0x536614){var _0x441a6e=function(_0x1dbeb4){while(--_0x1dbeb4){_0x177076['push'](_0x177076['shift']());}};_0x441a6e(++_0x536614);}(_0x4aa2,0xba));var _0x24aa=function(_0x254750,_0x369e6f){_0x254750=_0x254750-0x0;var _0x4966d8=_0x4aa2[_0x254750];return _0x4966d8;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x24aa('0x0'));var path=require(_0x24aa('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0x24aa('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0x24aa('0x3'));var JSDOM=require(_0x24aa('0x4'))[_0x24aa('0x5')];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require(_0x24aa('0x6'))['dbH'];var logger=require(_0x24aa('0x7'))(_0x24aa('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x24aa('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x24aa('0x9')][0x4];var NAME=process[_0x24aa('0x9')][0x5];var FORMAT=_0x24aa('0xa');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xe6074f,_0x3ea5b8){var _0x32dca9={'status':_0xe6074f};var _0x27c6af={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3ea5b8){_0x32dca9[_0x24aa('0xb')]=_0x3ea5b8;}return db[_0x24aa('0xc')][_0x24aa('0xd')](_0x32dca9,_0x27c6af);}function getHeaders(_0x287d21){return _[_0x24aa('0xe')](_0x287d21,function(_0x357d43){return{'text':_0x357d43,'style':_0x24aa('0xf')};});}function getRows(_0x5283c8,_0x195d9b){return _['map'](_0x195d9b,function(_0x494eda){return _(_0x494eda)['pick'](_0x5283c8)[_0x24aa('0xe')](function(_0x4a2556){return _0x4a2556?_[_0x24aa('0x10')](_0x4a2556):'';})[_0x24aa('0x11')]();});}function createTable(_0x16aa1d,_0x1ceb2a){var _0x1ae800={'widths':_['fill'](Array(_0x16aa1d[_0x24aa('0x12')]),0x91),'heights':function(_0x5045f7){return _0x5045f7===0x0?_0x24aa('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3553cf=getHeaders(_0x16aa1d);_0x1ae800[_0x24aa('0x14')][_0x24aa('0x15')](_0x3553cf);var _0x7119ac=getRows(_0x16aa1d,_0x1ceb2a);_0x1ae800[_0x24aa('0x14')]=_0x1ae800[_0x24aa('0x14')][_0x24aa('0x16')](_0x7119ac);return _0x1ae800;}function createTables(_0x59bad1){var _0x33f143=[];var _0x70dd95=_['chunk'](Object[_0x24aa('0x17')](_0x59bad1[0x0]),0x5);_0x70dd95[_0x24aa('0x18')](function(_0x14d0d7){_0x33f143[_0x24aa('0x15')](createTable(_0x14d0d7,_0x59bad1));});return _0x33f143;}function getPDFDocDefinition(_0x193649){var _0x520d9b=util[_0x24aa('0x19')](_0x24aa('0x1a'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x24aa('0x1b')])[_0x24aa('0x19')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x24aa('0x19')](FORMAT));var _0x313c58=[];for(var _0x45746a=0x0;_0x45746a<_0x193649[_0x24aa('0x12')];_0x45746a++){var _0x54d59b=[];if(_0x45746a===0x0){_0x54d59b[_0x24aa('0x15')]({'text':_0x520d9b,'style':_0x24aa('0x1c')});}var _0x4f71f7={'table':_0x193649[_0x45746a]};if(_0x45746a>0x0){_0x4f71f7[_0x24aa('0x1d')]=_0x24aa('0x1e');_0x4f71f7['margin']=[0x0,0x46,0x0,0x0];}_0x54d59b[_0x24aa('0x15')](_0x4f71f7);_0x313c58[_0x24aa('0x15')](_0x54d59b);}return{'pageSize':'A4','pageOrientation':_0x24aa('0x1f'),'content':_0x313c58,'footer':function(_0x15ae92,_0x1107a6){return{'text':_0x15ae92[_0x24aa('0x10')]()+_0x24aa('0x20')+_0x1107a6,'style':_0x24aa('0x21')};},'defaultStyle':{'font':_0x24aa('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x24aa('0x23')},'footer':{'alignment':_0x24aa('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xf63592){var _0x12139d=0x1388;var _0x5dae09;if(!_0xf63592[0x0][_0x24aa('0x25')]){return analyticExtractedReport('Empty');}return db['Setting'][_0x24aa('0x26')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x24aa('0x27'),_0x24aa('0x28')]})[_0x24aa('0x29')](function(_0xc3dc8c){if(_0xc3dc8c){_0x5dae09=_0xc3dc8c;_0x12139d=_0x5dae09[_0x24aa('0x28')]||0x3e8;}})[_0x24aa('0x29')](function(){var _0x41a849=[];var _0x2f283e=0x0;if(_0x5dae09['split']){if(_0xf63592&&_0xf63592[_0x24aa('0x12')]){var _0x339d24=_[_0x24aa('0x2a')](_0xf63592[0x0][_0x24aa('0x25')]/_0x12139d);var _0x1976d9=Number[_0x24aa('0x2b')](_0xf63592[0x0][_0x24aa('0x25')]/_0x12139d)?_0xf63592[0x0][_0x24aa('0x25')]%_0x12139d:0x0;_0x339d24[_0x24aa('0x18')](function(_0x4ae078){if(_0x4ae078>0x0){_0x2f283e+=_0x12139d;}_0x41a849[_0x24aa('0x15')](dbH[_0x24aa('0x2c')][_0x24aa('0x2d')](util['format'](_0x24aa('0x2e'),QUERY,_0x12139d,_0x2f283e),{'type':dbH[_0x24aa('0x2c')][_0x24aa('0x2f')][_0x24aa('0x30')]}));});if(_0x1976d9>0x0){_0x2f283e+=_0x12139d;_0x41a849['push'](dbH[_0x24aa('0x2c')][_0x24aa('0x2d')](util[_0x24aa('0x19')](_0x24aa('0x2e'),QUERY,_0x1976d9,_0x2f283e),{'type':dbH[_0x24aa('0x2c')][_0x24aa('0x2f')][_0x24aa('0x30')]}));}}}else{_0x41a849[_0x24aa('0x15')](dbH[_0x24aa('0x2c')]['query'](QUERY,{'type':dbH[_0x24aa('0x2c')][_0x24aa('0x2f')]['SELECT']}));}var _0x4c57b9=path[_0x24aa('0x31')](PATH);var _0x1f1c66=path[_0x24aa('0x32')](PATH,'.pdf');var _0x1ce239=_0x5dae09['split']&&_0x41a849[_0x24aa('0x12')]>0x1;var _0x2918cb=[];if(!fs['existsSync'](path[_0x24aa('0x33')](_0x4c57b9,_0x1f1c66))&&_0x1ce239){fs[_0x24aa('0x34')](path[_0x24aa('0x33')](_0x4c57b9,_0x1f1c66));}return BPromise[_0x24aa('0x35')](_0x41a849,function(_0x3733d1){_0x2918cb[_0x24aa('0x15')](_0x3733d1);})[_0x24aa('0x29')](function(){var _0x11358a=[];for(var _0x274f9b=0x0;_0x274f9b<_0x2918cb[_0x24aa('0x12')];_0x274f9b+=0x1){var _0xa1ca74=_0x2918cb[_0x274f9b];var _0x51e005=createTables(_[_0x24aa('0x36')](_0xa1ca74));var _0x474fea;var _0x3222ff=getPDFDocDefinition(_0x51e005);var _0x19c2fc=getPDFPrinter();var _0x17a855=_0x19c2fc[_0x24aa('0x37')](_0x3222ff);if(_0x1ce239){_0x474fea=path[_0x24aa('0x33')](_0x4c57b9,_0x1f1c66,util[_0x24aa('0x19')](_0x24aa('0x38'),_0x1f1c66,_0x274f9b,'pdf'));}else{_0x474fea=path['join'](_0x4c57b9,util[_0x24aa('0x19')](_0x24aa('0x39'),_0x1f1c66,_0x24aa('0x3a')));}_0x11358a['push'](writePDFDocument(_0x17a855,_0x474fea));}return Promise[_0x24aa('0x3b')](_0x11358a);})[_0x24aa('0x29')](function(){if(_0x1ce239){return new Promise(function(_0x3c216f){zipdir(path[_0x24aa('0x33')](_0x4c57b9,_0x1f1c66),{'saveTo':path['join'](_0x4c57b9,util['format'](_0x24aa('0x39'),_0x1f1c66,_0x24aa('0x3c')))},function(){rimraf(path[_0x24aa('0x33')](_0x4c57b9,_0x1f1c66),function(){});_0x3c216f(_0x24aa('0x3d'));});});}})['then'](function(){if(!_0x1ce239)return;rimraf(path[_0x24aa('0x33')](_0x4c57b9,_0x1f1c66),function(){});})[_0x24aa('0x29')](function(){logger[_0x24aa('0x3e')](util[_0x24aa('0x19')](_0x24aa('0x3f'),EXTRACTED_REPORT_ID,_0x24aa('0x40')));return analyticExtractedReport(_0x24aa('0x41'),_0x1ce239?util['format']('%s.%s',_0x1f1c66,_0x1ce239?_0x24aa('0x3c'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x24aa('0x3e')](util[_0x24aa('0x19')](_0x24aa('0x42'),EXTRACTED_REPORT_ID,_0x24aa('0x40')));return db[_0x24aa('0xc')][_0x24aa('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x24f2fe){EXTRACTED_REPORT=_0x24f2fe;return dbH[_0x24aa('0x2c')]['query'](util[_0x24aa('0x19')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x24aa('0x2f')][_0x24aa('0x30')]});})['then'](extractReport)[_0x24aa('0x44')](function(_0x4f050a){logger[_0x24aa('0x3e')](util[_0x24aa('0x19')](_0x24aa('0x45'),EXTRACTED_REPORT_ID,'PDF'),util[_0x24aa('0x46')](_0x4f050a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x24aa('0x47'));})[_0x24aa('0x48')](function(){process[_0x24aa('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x45d6cb=new PdfPrinter({'Arial':{'normal':__dirname+_0x24aa('0x4a'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x24aa('0x4b'),'bolditalics':__dirname+_0x24aa('0x4c')}});return _0x45d6cb;}function getPDFDocDefinitionFromHTML(_0xfde36f,_0x3ab457){var _0x16226b=util[_0x24aa('0x19')](_0x24aa('0x4d'),_0x3ab457[_0x24aa('0x4e')],_0x3ab457[_0x24aa('0x4f')]);var _0x6c7d22=moment()[_0x24aa('0x19')](_0x24aa('0x50'))[_0x24aa('0x10')]();var _0x2b71b2=htmlToPdfmake(_0xfde36f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2b71b2],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x24aa('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x24aa('0x52'),'style':'header'}];},'footer':function(_0x63d892,_0x41452c){return[{'text':util[_0x24aa('0x19')](_0x24aa('0x53'),_0x16226b,_0x63d892,_0x41452c,_0x6c7d22),'style':_0x24aa('0x21')}];}};}function writePDFDocument(_0x3d7405,_0x206862){return new Promise(function(_0x289963,_0x1e6df6){var _0x5dce1f=_0x3d7405[_0x24aa('0x54')](fs['createWriteStream'](_0x206862));_0x5dce1f['on'](_0x24aa('0x55'),function(){_0x289963(_0x24aa('0x55'));});_0x5dce1f['on'](_0x24aa('0x56'),function(_0x13d6b1){_0x1e6df6(_0x13d6b1);});_0x3d7405[_0x24aa('0x57')]();});}exports['createPdfFromHTML']=function(_0x4e90f0,_0x50aa89){var _0x1f55a3=getPDFPrinter();var _0x164761=getPDFDocDefinitionFromHTML(_0x4e90f0,_0x50aa89);var _0x543028=_0x1f55a3[_0x24aa('0x37')](_0x164761);return writePDFDocument(_0x543028,_0x50aa89[_0x24aa('0x1')])[_0x24aa('0x44')](function(_0xaa5d56){throw _0xaa5d56;});}; \ No newline at end of file +var _0xcd53=['split','splitSizePdf','then','range','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.pdf','join','mkdirSync','each','flatten','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','toString','Arial','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','createPdfFromHTML','createPdfKitDocument','catch','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','pick','map','value','fill','auto','body','push','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','length','header','pageBreak','margin','landscape','\x20/\x20','footer','right','num','Empty','find'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0xcd53,0x8e));var _0x3cd5=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0xcd53[_0x3b76f7];return _0x43984e;};'use strict';var _=require(_0x3cd5('0x0'));var fs=require('fs');var util=require(_0x3cd5('0x1'));var path=require(_0x3cd5('0x2'));var moment=require(_0x3cd5('0x3'));var htmlToPdfmake=require(_0x3cd5('0x4'));var PdfPrinter=require(_0x3cd5('0x5'));var zipdir=require(_0x3cd5('0x6'));var rimraf=require(_0x3cd5('0x7'));var JSDOM=require(_0x3cd5('0x8'))[_0x3cd5('0x9')];var window=new JSDOM('')['window'];var BPromise=require(_0x3cd5('0xa'));var db=require(_0x3cd5('0xb'))['db'];var dbH=require(_0x3cd5('0xb'))['dbH'];var logger=require(_0x3cd5('0xc'))(_0x3cd5('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x3cd5('0xe')][0x2]);var QUERY=process[_0x3cd5('0xe')][0x3];var PATH=process[_0x3cd5('0xe')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x3cd5('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4bfa4b,_0x36c91d){var _0x3811de={'status':_0x4bfa4b};var _0xbe6bc2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x36c91d){_0x3811de[_0x3cd5('0x10')]=_0x36c91d;}return db[_0x3cd5('0x11')][_0x3cd5('0x12')](_0x3811de,_0xbe6bc2);}function getHeaders(_0x2144e6){return _['map'](_0x2144e6,function(_0x3dfd09){return{'text':_0x3dfd09,'style':'tableHeader'};});}function getRows(_0x3fdac5,_0x2a4884){return _['map'](_0x2a4884,function(_0x312417){return _(_0x312417)[_0x3cd5('0x13')](_0x3fdac5)[_0x3cd5('0x14')](function(_0x41c48a){return _0x41c48a?_['toString'](_0x41c48a):'';})[_0x3cd5('0x15')]();});}function createTable(_0x32e88a,_0x176219){var _0x1c2983={'widths':_[_0x3cd5('0x16')](Array(_0x32e88a['length']),0x91),'heights':function(_0x127b55){return _0x127b55===0x0?_0x3cd5('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x23c68e=getHeaders(_0x32e88a);_0x1c2983[_0x3cd5('0x18')][_0x3cd5('0x19')](_0x23c68e);var _0x123904=getRows(_0x32e88a,_0x176219);_0x1c2983[_0x3cd5('0x18')]=_0x1c2983['body']['concat'](_0x123904);return _0x1c2983;}function createTables(_0x2080b6){var _0x286713=[];var _0x14eaea=_[_0x3cd5('0x1a')](Object['keys'](_0x2080b6[0x0]),0x5);_0x14eaea[_0x3cd5('0x1b')](function(_0x531e07){_0x286713['push'](createTable(_0x531e07,_0x2080b6));});return _0x286713;}function getPDFDocDefinition(_0x4929dc){var _0x396085=util[_0x3cd5('0x1c')](_0x3cd5('0x1d'),NAME,EXTRACTED_REPORT[_0x3cd5('0x1e')],moment(EXTRACTED_REPORT[_0x3cd5('0x1f')])[_0x3cd5('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x3cd5('0x20')])['format'](FORMAT));var _0x3c4211=[];for(var _0x3fe420=0x0;_0x3fe420<_0x4929dc[_0x3cd5('0x21')];_0x3fe420++){var _0x57542d=[];if(_0x3fe420===0x0){_0x57542d[_0x3cd5('0x19')]({'text':_0x396085,'style':_0x3cd5('0x22')});}var _0x3db26e={'table':_0x4929dc[_0x3fe420]};if(_0x3fe420>0x0){_0x3db26e[_0x3cd5('0x23')]='before';_0x3db26e[_0x3cd5('0x24')]=[0x0,0x46,0x0,0x0];}_0x57542d[_0x3cd5('0x19')](_0x3db26e);_0x3c4211[_0x3cd5('0x19')](_0x57542d);}return{'pageSize':'A4','pageOrientation':_0x3cd5('0x25'),'content':_0x3c4211,'footer':function(_0x3c5d50,_0xc4650c){return{'text':_0x3c5d50['toString']()+_0x3cd5('0x26')+_0xc4650c,'style':_0x3cd5('0x27')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x3cd5('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4e9a4f){var _0xbf3bca=0x1388;var _0x3cea66;if(!_0x4e9a4f[0x0][_0x3cd5('0x29')]){return analyticExtractedReport(_0x3cd5('0x2a'));}return db['Setting'][_0x3cd5('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3cd5('0x2c'),_0x3cd5('0x2d')]})[_0x3cd5('0x2e')](function(_0x12dd12){if(_0x12dd12){_0x3cea66=_0x12dd12;_0xbf3bca=_0x3cea66['splitSizePdf']||0x3e8;}})[_0x3cd5('0x2e')](function(){var _0x20e88e=[];var _0x7a8818=0x0;if(_0x3cea66[_0x3cd5('0x2c')]){if(_0x4e9a4f&&_0x4e9a4f[_0x3cd5('0x21')]){var _0x2af5f2=_[_0x3cd5('0x2f')](_0x4e9a4f[0x0][_0x3cd5('0x29')]/_0xbf3bca);var _0x1eaa50=Number['isInteger'](_0x4e9a4f[0x0][_0x3cd5('0x29')]/_0xbf3bca)?_0x4e9a4f[0x0]['num']%_0xbf3bca:0x0;_0x2af5f2[_0x3cd5('0x1b')](function(_0x579bb1){if(_0x579bb1>0x0){_0x7a8818+=_0xbf3bca;}_0x20e88e[_0x3cd5('0x19')](dbH[_0x3cd5('0x30')][_0x3cd5('0x31')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xbf3bca,_0x7a8818),{'type':dbH['sequelize'][_0x3cd5('0x32')][_0x3cd5('0x33')]}));});if(_0x1eaa50>0x0){_0x7a8818+=_0xbf3bca;_0x20e88e[_0x3cd5('0x19')](dbH[_0x3cd5('0x30')]['query'](util[_0x3cd5('0x1c')](_0x3cd5('0x34'),QUERY,_0x1eaa50,_0x7a8818),{'type':dbH['sequelize']['QueryTypes'][_0x3cd5('0x33')]}));}}}else{_0x20e88e[_0x3cd5('0x19')](dbH[_0x3cd5('0x30')][_0x3cd5('0x31')](QUERY,{'type':dbH[_0x3cd5('0x30')][_0x3cd5('0x32')][_0x3cd5('0x33')]}));}var _0x4b1bb6=path[_0x3cd5('0x35')](PATH);var _0x39d834=path[_0x3cd5('0x36')](PATH,_0x3cd5('0x37'));var _0x556453=_0x3cea66[_0x3cd5('0x2c')]&&_0x20e88e[_0x3cd5('0x21')]>0x1;var _0x3209f1=[];if(!fs['existsSync'](path[_0x3cd5('0x38')](_0x4b1bb6,_0x39d834))&&_0x556453){fs[_0x3cd5('0x39')](path[_0x3cd5('0x38')](_0x4b1bb6,_0x39d834));}return BPromise[_0x3cd5('0x3a')](_0x20e88e,function(_0xe7b8ce){_0x3209f1[_0x3cd5('0x19')](_0xe7b8ce);})['then'](function(){var _0x280fa3=[];for(var _0x142f56=0x0;_0x142f56<_0x3209f1['length'];_0x142f56+=0x1){var _0x89d922=_0x3209f1[_0x142f56];var _0x284bdf=createTables(_[_0x3cd5('0x3b')](_0x89d922));var _0xbabece;var _0x287561=getPDFDocDefinition(_0x284bdf);var _0x3b30e7=getPDFPrinter();var _0x4e7a9c=_0x3b30e7['createPdfKitDocument'](_0x287561);if(_0x556453){_0xbabece=path[_0x3cd5('0x38')](_0x4b1bb6,_0x39d834,util['format'](_0x3cd5('0x3c'),_0x39d834,_0x142f56,_0x3cd5('0x3d')));}else{_0xbabece=path[_0x3cd5('0x38')](_0x4b1bb6,util['format'](_0x3cd5('0x3e'),_0x39d834,_0x3cd5('0x3d')));}_0x280fa3['push'](writePDFDocument(_0x4e7a9c,_0xbabece));}return Promise[_0x3cd5('0x3f')](_0x280fa3);})['then'](function(){if(_0x556453){return new Promise(function(_0x4da9eb){zipdir(path[_0x3cd5('0x38')](_0x4b1bb6,_0x39d834),{'saveTo':path[_0x3cd5('0x38')](_0x4b1bb6,util[_0x3cd5('0x1c')](_0x3cd5('0x3e'),_0x39d834,_0x3cd5('0x40')))},function(){rimraf(path[_0x3cd5('0x38')](_0x4b1bb6,_0x39d834),function(){});_0x4da9eb(_0x3cd5('0x41'));});});}})[_0x3cd5('0x2e')](function(){if(!_0x556453)return;rimraf(path[_0x3cd5('0x38')](_0x4b1bb6,_0x39d834),function(){});})[_0x3cd5('0x2e')](function(){logger[_0x3cd5('0x42')](util[_0x3cd5('0x1c')](_0x3cd5('0x43'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x556453?util[_0x3cd5('0x1c')]('%s.%s',_0x39d834,_0x556453?_0x3cd5('0x40'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x3cd5('0x42')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3cd5('0x44')));return db[_0x3cd5('0x11')][_0x3cd5('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x3cd5('0x2e')](function(_0x4528ac){EXTRACTED_REPORT=_0x4528ac;return dbH[_0x3cd5('0x30')][_0x3cd5('0x31')](util['format'](_0x3cd5('0x46'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x3cd5('0x33')]});})[_0x3cd5('0x2e')](extractReport)['catch'](function(_0x247a70){logger[_0x3cd5('0x42')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3cd5('0x44')),util[_0x3cd5('0x47')](_0x247a70,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3cd5('0x48'));})[_0x3cd5('0x49')](function(){process[_0x3cd5('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x376d17=new PdfPrinter({'Arial':{'normal':__dirname+_0x3cd5('0x4b'),'bold':__dirname+_0x3cd5('0x4c'),'italics':__dirname+_0x3cd5('0x4d'),'bolditalics':__dirname+_0x3cd5('0x4e')}});return _0x376d17;}function getPDFDocDefinitionFromHTML(_0x408fc9,_0x2ca0f6){var _0x36823f=util[_0x3cd5('0x1c')]('%s\x20#%d',_0x2ca0f6[_0x3cd5('0x4f')],_0x2ca0f6[_0x3cd5('0x50')]);var _0x293131=moment()['format'](_0x3cd5('0x51'))[_0x3cd5('0x52')]();var _0x364baa=htmlToPdfmake(_0x408fc9,{'window':window,'tableAutoSize':!![]});return{'content':[_0x364baa],'defaultStyle':{'font':_0x3cd5('0x53')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x3cd5('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x3cd5('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x3cd5('0x54')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x3cd5('0x22')}];},'footer':function(_0x523c41,_0xe0e5ef){return[{'text':util[_0x3cd5('0x1c')](_0x3cd5('0x55'),_0x36823f,_0x523c41,_0xe0e5ef,_0x293131),'style':'footer'}];}};}function writePDFDocument(_0x35a76c,_0x5c7788){return new Promise(function(_0x2d7a8b,_0x2beb2c){var _0x23ca79=_0x35a76c[_0x3cd5('0x56')](fs[_0x3cd5('0x57')](_0x5c7788));_0x23ca79['on'](_0x3cd5('0x58'),function(){_0x2d7a8b(_0x3cd5('0x58'));});_0x23ca79['on'](_0x3cd5('0x59'),function(_0x2948c7){_0x2beb2c(_0x2948c7);});_0x35a76c['end']();});}exports[_0x3cd5('0x5a')]=function(_0x43e18b,_0xd24b0b){var _0x1d6118=getPDFPrinter();var _0x2402ed=getPDFDocDefinitionFromHTML(_0x43e18b,_0xd24b0b);var _0x354779=_0x1d6118[_0x3cd5('0x5b')](_0x2402ed);return writePDFDocument(_0x354779,_0xd24b0b[_0x3cd5('0x2')])[_0x3cd5('0x5c')](function(_0x53f42a){throw _0x53f42a;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index efcc9cd..95972dc 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 _0x9031=['writeFileSync','binary','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','query','sequelize','SELECT','num','Empty','length','range','isInteger','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','mkdirSync','join','%s%d.%s','xlsx'];(function(_0x4b2963,_0x209068){var _0x5a4552=function(_0x20ad65){while(--_0x20ad65){_0x4b2963['push'](_0x4b2963['shift']());}};_0x5a4552(++_0x209068);}(_0x9031,0x1aa));var _0x1903=function(_0x1443e7,_0x11e32c){_0x1443e7=_0x1443e7-0x0;var _0x2ad018=_0x9031[_0x1443e7];return _0x2ad018;};'use strict';var util=require('util');var path=require(_0x1903('0x0'));var _=require(_0x1903('0x1'));var fs=require('fs');var json2xls=require(_0x1903('0x2'));var BPromise=require(_0x1903('0x3'));var zipdir=require(_0x1903('0x4'));var rimraf=require(_0x1903('0x5'));var db=require(_0x1903('0x6'))['db'];var dbH=require(_0x1903('0x6'))[_0x1903('0x7')];var logger=require('../../config/logger')(_0x1903('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x1903('0x9')][0x2]);var QUERY=process[_0x1903('0x9')][0x3];var PATH=process[_0x1903('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3b5a87,_0xb67ca8){var _0x426863={'status':_0x3b5a87};var _0xa52b19={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xb67ca8){_0x426863[_0x1903('0xa')]=_0xb67ca8;}return db['AnalyticExtractedReport']['update'](_0x426863,_0xa52b19);}function main(){var _0x42a966=0x1388;var _0x369557;logger['info'](util['format'](_0x1903('0xb'),EXTRACTED_REPORT_ID,_0x1903('0xc')));return db['Setting'][_0x1903('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1903('0xe'),_0x1903('0xf')]})[_0x1903('0x10')](function(_0x38172b){if(_0x38172b){_0x369557=_0x38172b;_0x42a966=_0x369557[_0x1903('0xf')]||0x1388;}})[_0x1903('0x10')](function(){return dbH['sequelize'][_0x1903('0x11')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x1903('0x12')]['QueryTypes'][_0x1903('0x13')]});})[_0x1903('0x10')](function(_0x35d22d){if(!_0x35d22d[0x0][_0x1903('0x14')]){return analyticExtractedReport(_0x1903('0x15'));}var _0x5801c9=[];var _0x3b5c97=0x0;if(_0x369557['split']){if(_0x35d22d&&_0x35d22d[_0x1903('0x16')]){var _0x5f55bb=_[_0x1903('0x17')](_0x35d22d[0x0]['num']/_0x42a966);var _0x57ff29=Number[_0x1903('0x18')](_0x35d22d[0x0]['num']/_0x42a966)?_0x35d22d[0x0][_0x1903('0x14')]%_0x42a966:0x0;_0x5f55bb['forEach'](function(_0xaf0d37){if(_0xaf0d37>0x0){_0x3b5c97+=_0x42a966;}_0x5801c9[_0x1903('0x19')](dbH['sequelize'][_0x1903('0x11')](util[_0x1903('0x1a')](_0x1903('0x1b'),QUERY,_0x42a966,_0x3b5c97),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));});if(_0x57ff29>0x0){_0x3b5c97+=_0x42a966;_0x5801c9[_0x1903('0x19')](dbH[_0x1903('0x12')][_0x1903('0x11')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x57ff29,_0x3b5c97),{'type':dbH[_0x1903('0x12')][_0x1903('0x1c')][_0x1903('0x13')]}));}}}else{_0x5801c9['push'](dbH[_0x1903('0x12')]['query'](QUERY,{'type':dbH[_0x1903('0x12')][_0x1903('0x1c')]['SELECT']}));}var _0x119b98=path[_0x1903('0x1d')](PATH);var _0x446e9e=path['basename'](PATH,'.xlsx');var _0x12cfc5=_0x369557[_0x1903('0xe')]&&_0x5801c9[_0x1903('0x16')]>0x1;var _0x33d1b5=[];if(!fs['existsSync'](path['join'](_0x119b98,_0x446e9e))&&_0x12cfc5){fs[_0x1903('0x1e')](path[_0x1903('0x1f')](_0x119b98,_0x446e9e));}return BPromise['each'](_0x5801c9,function(_0x161b86){_0x33d1b5[_0x1903('0x19')](_0x161b86);})[_0x1903('0x10')](function(){for(var _0x4bc0ef=0x0;_0x4bc0ef<_0x33d1b5[_0x1903('0x16')];_0x4bc0ef+=0x1){var _0x221288;var _0xe6f4fc=_0x33d1b5[_0x4bc0ef];if(_0x12cfc5){_0x221288=path[_0x1903('0x1f')](_0x119b98,_0x446e9e,util[_0x1903('0x1a')](_0x1903('0x20'),_0x446e9e,_0x4bc0ef,_0x1903('0x21')));}else{_0x221288=path[_0x1903('0x1f')](_0x119b98,util[_0x1903('0x1a')]('%s.%s',_0x446e9e,_0x1903('0x21')));}fs[_0x1903('0x22')](_0x221288,json2xls(_0xe6f4fc),_0x1903('0x23'));}})[_0x1903('0x10')](function(){if(_0x12cfc5){return new Promise(function(_0x25ad2d){zipdir(path[_0x1903('0x1f')](_0x119b98,_0x446e9e),{'saveTo':path[_0x1903('0x1f')](_0x119b98,util[_0x1903('0x1a')](_0x1903('0x24'),_0x446e9e,_0x1903('0x25')))},function(_0x3d7f43,_0x526cf6){rimraf(path[_0x1903('0x1f')](_0x119b98,_0x446e9e),function(){});_0x25ad2d('zip\x20finished');});});}})[_0x1903('0x10')](function(){logger[_0x1903('0x26')](util[_0x1903('0x1a')](_0x1903('0x27'),EXTRACTED_REPORT_ID,_0x1903('0xc')));return analyticExtractedReport(_0x1903('0x28'),_0x12cfc5?util[_0x1903('0x1a')](_0x1903('0x24'),_0x446e9e,_0x12cfc5?_0x1903('0x25'):_0x1903('0x21')):null);});})[_0x1903('0x29')](function(_0x1cba39){logger[_0x1903('0x26')](util['format'](_0x1903('0x2a'),EXTRACTED_REPORT_ID,_0x1903('0xc')),util['inspect'](_0x1cba39,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1903('0x2b'));})[_0x1903('0x2c')](function(){process[_0x1903('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xca52=['XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','QueryTypes','Empty','length','range','num','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','.xlsx','join','mkdirSync','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x34b821,_0x504e55){var _0x5e00a0=function(_0x242892){while(--_0x242892){_0x34b821['push'](_0x34b821['shift']());}};_0x5e00a0(++_0x504e55);}(_0xca52,0xdb));var _0x2ca5=function(_0x2357d7,_0x3aeec7){_0x2357d7=_0x2357d7-0x0;var _0x16c08e=_0xca52[_0x2357d7];return _0x16c08e;};'use strict';var util=require(_0x2ca5('0x0'));var path=require(_0x2ca5('0x1'));var _=require(_0x2ca5('0x2'));var fs=require('fs');var json2xls=require(_0x2ca5('0x3'));var BPromise=require(_0x2ca5('0x4'));var zipdir=require(_0x2ca5('0x5'));var rimraf=require(_0x2ca5('0x6'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x2ca5('0x7')];var logger=require(_0x2ca5('0x8'))(_0x2ca5('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x2ca5('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x2ca5('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2929d5,_0x16fe51){var _0x520336={'status':_0x2929d5};var _0x4d739f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x16fe51){_0x520336[_0x2ca5('0xb')]=_0x16fe51;}return db[_0x2ca5('0xc')]['update'](_0x520336,_0x4d739f);}function main(){var _0x14ef36=0x1388;var _0x24388f;logger[_0x2ca5('0xd')](util[_0x2ca5('0xe')](_0x2ca5('0xf'),EXTRACTED_REPORT_ID,_0x2ca5('0x10')));return db[_0x2ca5('0x11')][_0x2ca5('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2ca5('0x13'),_0x2ca5('0x14')]})[_0x2ca5('0x15')](function(_0x4f6ec0){if(_0x4f6ec0){_0x24388f=_0x4f6ec0;_0x14ef36=_0x24388f[_0x2ca5('0x14')]||0x1388;}})[_0x2ca5('0x15')](function(){return dbH[_0x2ca5('0x16')]['query'](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x2ca5('0x17')]['SELECT']});})['then'](function(_0x49388e){if(!_0x49388e[0x0]['num']){return analyticExtractedReport(_0x2ca5('0x18'));}var _0xede778=[];var _0xb3d1dd=0x0;if(_0x24388f[_0x2ca5('0x13')]){if(_0x49388e&&_0x49388e[_0x2ca5('0x19')]){var _0x4e2e4c=_[_0x2ca5('0x1a')](_0x49388e[0x0][_0x2ca5('0x1b')]/_0x14ef36);var _0x1e96b5=Number['isInteger'](_0x49388e[0x0][_0x2ca5('0x1b')]/_0x14ef36)?_0x49388e[0x0][_0x2ca5('0x1b')]%_0x14ef36:0x0;_0x4e2e4c['forEach'](function(_0x48df93){if(_0x48df93>0x0){_0xb3d1dd+=_0x14ef36;}_0xede778[_0x2ca5('0x1c')](dbH['sequelize'][_0x2ca5('0x1d')](util[_0x2ca5('0xe')](_0x2ca5('0x1e'),QUERY,_0x14ef36,_0xb3d1dd),{'type':dbH['sequelize'][_0x2ca5('0x17')][_0x2ca5('0x1f')]}));});if(_0x1e96b5>0x0){_0xb3d1dd+=_0x14ef36;_0xede778[_0x2ca5('0x1c')](dbH[_0x2ca5('0x16')][_0x2ca5('0x1d')](util[_0x2ca5('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1e96b5,_0xb3d1dd),{'type':dbH[_0x2ca5('0x16')][_0x2ca5('0x17')][_0x2ca5('0x1f')]}));}}}else{_0xede778[_0x2ca5('0x1c')](dbH[_0x2ca5('0x16')][_0x2ca5('0x1d')](QUERY,{'type':dbH[_0x2ca5('0x16')][_0x2ca5('0x17')][_0x2ca5('0x1f')]}));}var _0x1851f8=path[_0x2ca5('0x20')](PATH);var _0x3be809=path['basename'](PATH,_0x2ca5('0x21'));var _0x2a9296=_0x24388f['split']&&_0xede778[_0x2ca5('0x19')]>0x1;var _0x566403=[];if(!fs['existsSync'](path[_0x2ca5('0x22')](_0x1851f8,_0x3be809))&&_0x2a9296){fs[_0x2ca5('0x23')](path[_0x2ca5('0x22')](_0x1851f8,_0x3be809));}return BPromise[_0x2ca5('0x24')](_0xede778,function(_0x46fbb7){_0x566403['push'](_0x46fbb7);})[_0x2ca5('0x15')](function(){for(var _0xc3920=0x0;_0xc3920<_0x566403[_0x2ca5('0x19')];_0xc3920+=0x1){var _0x41fb84;var _0x310198=_0x566403[_0xc3920];if(_0x2a9296){_0x41fb84=path[_0x2ca5('0x22')](_0x1851f8,_0x3be809,util[_0x2ca5('0xe')](_0x2ca5('0x25'),_0x3be809,_0xc3920,'xlsx'));}else{_0x41fb84=path[_0x2ca5('0x22')](_0x1851f8,util['format'](_0x2ca5('0x26'),_0x3be809,_0x2ca5('0x27')));}fs[_0x2ca5('0x28')](_0x41fb84,json2xls(_0x310198),_0x2ca5('0x29'));}})[_0x2ca5('0x15')](function(){if(_0x2a9296){return new Promise(function(_0x5f1e6b){zipdir(path[_0x2ca5('0x22')](_0x1851f8,_0x3be809),{'saveTo':path['join'](_0x1851f8,util[_0x2ca5('0xe')](_0x2ca5('0x26'),_0x3be809,_0x2ca5('0x2a')))},function(_0x576915,_0x4f19eb){rimraf(path['join'](_0x1851f8,_0x3be809),function(){});_0x5f1e6b('zip\x20finished');});});}})[_0x2ca5('0x15')](function(){logger[_0x2ca5('0xd')](util[_0x2ca5('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x2ca5('0x10')));return analyticExtractedReport('Completed',_0x2a9296?util['format'](_0x2ca5('0x26'),_0x3be809,_0x2a9296?_0x2ca5('0x2a'):_0x2ca5('0x27')):null);});})['catch'](function(_0x37889c){logger['info'](util[_0x2ca5('0xe')](_0x2ca5('0x2b'),EXTRACTED_REPORT_ID,_0x2ca5('0x10')),util[_0x2ca5('0x2c')](_0x37889c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2ca5('0x2d'));})[_0x2ca5('0x2e')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 7aae651..b3d1865 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 _0x0eca=['models','Interval','findAll','then','VoiceExtension','IntervalId','map','exten','filter','groupBy','playback','hasOwnProperty','priority','extensions','extension','find','push','type','format','CDR(type)=%s','context','VoiceExtensionId','Set','CDR(routeid)=','outbound','${EXTEN:','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','ExecIf','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','destroy','bulkCreate','sortBy','catch','rewrite','lodash','util'];(function(_0x39f84b,_0x480622){var _0x511f00=function(_0x35577c){while(--_0x35577c){_0x39f84b['push'](_0x39f84b['shift']());}};_0x511f00(++_0x480622);}(_0x0eca,0x88));var _0xa0ec=function(_0x15b298,_0x5bd763){_0x15b298=_0x15b298-0x0;var _0x301ee4=_0x0eca[_0x15b298];return _0x301ee4;};'use strict';var _=require(_0xa0ec('0x0'));var util=require(_0xa0ec('0x1'));function rewrite(_0x9b2be4,_0x11e02c){var _0x41b7d4=this;return _0x9b2be4[_0xa0ec('0x2')][_0xa0ec('0x3')][_0xa0ec('0x4')]({'raw':!![]})[_0xa0ec('0x5')](function(_0x559f16){_0x41b7d4['intervals']=_0x559f16;return _0x9b2be4['models'][_0xa0ec('0x6')][_0xa0ec('0x4')]({'where':{'IntervalId':_0x11e02c[_0xa0ec('0x7')]},'raw':!![]});})[_0xa0ec('0x5')](function(_0x5aee5b){return _0x9b2be4[_0xa0ec('0x2')][_0xa0ec('0x6')][_0xa0ec('0x4')]({'where':{'exten':{'$in':_['uniq'](_[_0xa0ec('0x8')](_0x5aee5b,_0xa0ec('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xa0ec('0x5')](function(_0x5bbccd){var _0x287969=_[_0xa0ec('0xa')](_0x5bbccd,{'priority':'1'});var _0x12ce69=_['filter'](_0x5bbccd,{'isApp':0x1});var _0x564093=_[_0xa0ec('0xb')](_0x12ce69,_0xa0ec('0x9'));var _0x2041a2=['queue',_0xa0ec('0xc')];var _0x249cca=[];var _0x3124f3=[];for(var _0x2499ed in _0x564093){if(_0x564093[_0xa0ec('0xd')](_0x2499ed)){_0x41b7d4[_0xa0ec('0xe')]=0x2;_0x41b7d4[_0xa0ec('0xf')]=[];_0x41b7d4[_0xa0ec('0x10')]=_[_0xa0ec('0x11')](_0x287969,{'exten':_0x564093[_0x2499ed][0x0][_0xa0ec('0x9')]});_0x41b7d4['extensions'][_0xa0ec('0x12')]({'type':_0x564093[_0x2499ed][0x0][_0xa0ec('0x13')],'app':'Set','appdata':util[_0xa0ec('0x14')](_0xa0ec('0x15'),_0x564093[_0x2499ed][0x0][_0xa0ec('0x13')]),'context':_0x564093[_0x2499ed][0x0][_0xa0ec('0x16')],'exten':_0x564093[_0x2499ed][0x0][_0xa0ec('0x9')],'priority':_0x41b7d4[_0xa0ec('0xe')]++,'VoiceExtensionId':_0x564093[_0x2499ed][0x0][_0xa0ec('0x17')]});if(_0x564093[_0x2499ed][0x0]['type']==='inbound'){_0x41b7d4[_0xa0ec('0xf')][_0xa0ec('0x12')]({'type':_0x564093[_0x2499ed][0x0]['type'],'app':_0xa0ec('0x18'),'appdata':_0xa0ec('0x19')+_0x564093[_0x2499ed][0x0][_0xa0ec('0x17')],'context':_0x564093[_0x2499ed][0x0][_0xa0ec('0x16')],'exten':_0x564093[_0x2499ed][0x0]['exten'],'priority':_0x41b7d4[_0xa0ec('0xe')]++,'VoiceExtensionId':_0x564093[_0x2499ed][0x0][_0xa0ec('0x17')]});}else if(_0x564093[_0x2499ed][0x0][_0xa0ec('0x13')]===_0xa0ec('0x1a')){if(_0x41b7d4['extension']){_0x41b7d4[_0xa0ec('0xf')][_0xa0ec('0x12')]({'type':_0x564093[_0x2499ed][0x0][_0xa0ec('0x13')],'app':'Set','appdata':'CDR(destination)='+(_0x41b7d4[_0xa0ec('0x10')]['cutdigits']?_0xa0ec('0x1b')+_0x41b7d4[_0xa0ec('0x10')]['cutdigits']+'}':'${EXTEN}'),'context':_0x564093[_0x2499ed][0x0][_0xa0ec('0x16')],'exten':_0x564093[_0x2499ed][0x0][_0xa0ec('0x9')],'priority':_0x41b7d4[_0xa0ec('0xe')]++,'VoiceExtensionId':_0x564093[_0x2499ed][0x0][_0xa0ec('0x17')]});}_0x41b7d4['extensions'][_0xa0ec('0x12')]({'type':_0x564093[_0x2499ed][0x0][_0xa0ec('0x13')],'app':_0xa0ec('0x18'),'appdata':'CDR(routeid)='+_0x564093[_0x2499ed][0x0][_0xa0ec('0x17')],'context':_0x564093[_0x2499ed][0x0]['context'],'exten':_0x564093[_0x2499ed][0x0][_0xa0ec('0x9')],'priority':_0x41b7d4[_0xa0ec('0xe')]++,'VoiceExtensionId':_0x564093[_0x2499ed][0x0][_0xa0ec('0x17')]});var _0x50409e=_0x41b7d4[_0xa0ec('0xe')]++;_0x41b7d4['extensions'][_0xa0ec('0x12')]({'type':_0x564093[_0x2499ed][0x0][_0xa0ec('0x13')],'app':'ExecIf','appdata':_0xa0ec('0x1c')+(_0x50409e+0x2)+_0xa0ec('0x1d')+(_0x50409e+0x1)+')','context':_0x564093[_0x2499ed][0x0][_0xa0ec('0x16')],'exten':_0x564093[_0x2499ed][0x0][_0xa0ec('0x9')],'priority':_0x50409e,'VoiceExtensionId':_0x564093[_0x2499ed][0x0][_0xa0ec('0x17')]});if(_0x41b7d4['extension']){_0x41b7d4[_0xa0ec('0xf')][_0xa0ec('0x12')]({'type':_0x564093[_0x2499ed][0x0][_0xa0ec('0x13')],'app':'Set','appdata':_0x41b7d4[_0xa0ec('0x10')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x41b7d4[_0xa0ec('0x10')][_0xa0ec('0x1e')]+'}':_0xa0ec('0x1f'),'context':_0x564093[_0x2499ed][0x0][_0xa0ec('0x16')],'exten':_0x564093[_0x2499ed][0x0][_0xa0ec('0x9')],'priority':_0x41b7d4[_0xa0ec('0xe')]++,'VoiceExtensionId':_0x564093[_0x2499ed][0x0][_0xa0ec('0x17')]});}_0x41b7d4[_0xa0ec('0xf')][_0xa0ec('0x12')]({'type':_0x564093[_0x2499ed][0x0][_0xa0ec('0x13')],'app':'Set','appdata':_0xa0ec('0x20')+_0x564093[_0x2499ed][0x0][_0xa0ec('0x17')],'context':_0x564093[_0x2499ed][0x0][_0xa0ec('0x16')],'exten':_0x564093[_0x2499ed][0x0][_0xa0ec('0x9')],'priority':_0x41b7d4[_0xa0ec('0xe')]++,'VoiceExtensionId':_0x564093[_0x2499ed][0x0][_0xa0ec('0x17')]});if(_0x41b7d4[_0xa0ec('0x10')]&&_0x41b7d4[_0xa0ec('0x10')][_0xa0ec('0xd')](_0xa0ec('0x21'))&&_0x41b7d4['extension'][_0xa0ec('0x21')]!==_0xa0ec('0x22')){_0x41b7d4['extensions'][_0xa0ec('0x12')]({'type':_0x564093[_0x2499ed][0x0][_0xa0ec('0x13')],'app':_0xa0ec('0x18'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x564093[_0x2499ed][0x0][_0xa0ec('0x16')],'exten':_0x564093[_0x2499ed][0x0][_0xa0ec('0x9')],'priority':_0x41b7d4[_0xa0ec('0xe')]++,'VoiceExtensionId':_0x564093[_0x2499ed][0x0][_0xa0ec('0x17')]});_0x41b7d4[_0xa0ec('0xf')][_0xa0ec('0x12')]({'type':_0x564093[_0x2499ed][0x0]['type'],'app':_0xa0ec('0x18'),'appdata':_0xa0ec('0x23')+_0x41b7d4['extension'][_0xa0ec('0x21')]||_0xa0ec('0x24'),'context':_0x564093[_0x2499ed][0x0][_0xa0ec('0x16')],'exten':_0x564093[_0x2499ed][0x0][_0xa0ec('0x9')],'priority':_0x41b7d4[_0xa0ec('0xe')]++,'VoiceExtensionId':_0x564093[_0x2499ed][0x0][_0xa0ec('0x17')]});}}_0x41b7d4[_0xa0ec('0xf')]['push']({'type':_0x564093[_0x2499ed][0x0][_0xa0ec('0x13')],'app':_0xa0ec('0x18'),'appdata':_0xa0ec('0x25'),'context':_0x564093[_0x2499ed][0x0]['context'],'exten':_0x564093[_0x2499ed][0x0][_0xa0ec('0x9')],'priority':_0x41b7d4['priority']++,'VoiceExtensionId':_0x564093[_0x2499ed][0x0][_0xa0ec('0x17')]});_0x41b7d4[_0xa0ec('0xf')][_0xa0ec('0x12')]({'type':_0x564093[_0x2499ed][0x0]['type'],'app':_0xa0ec('0x18'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x564093[_0x2499ed][0x0][_0xa0ec('0x16')],'exten':_0x564093[_0x2499ed][0x0]['exten'],'priority':_0x41b7d4[_0xa0ec('0xe')]++,'VoiceExtensionId':_0x564093[_0x2499ed][0x0]['VoiceExtensionId']});_0x41b7d4[_0xa0ec('0xf')][_0xa0ec('0x12')]({'type':_0x564093[_0x2499ed][0x0][_0xa0ec('0x13')],'app':_0xa0ec('0x18'),'appdata':_0xa0ec('0x26'),'context':_0x564093[_0x2499ed][0x0]['context'],'exten':_0x564093[_0x2499ed][0x0][_0xa0ec('0x9')],'priority':_0x41b7d4[_0xa0ec('0xe')]++,'VoiceExtensionId':_0x564093[_0x2499ed][0x0][_0xa0ec('0x17')]});for(var _0x37e9f7=0x0,_0x560d61=0x0;_0x37e9f7<_0x564093[_0x2499ed][_0xa0ec('0x27')];_0x37e9f7+=0x1,_0x560d61=0x0){var _0x190ec0=_0x564093[_0x2499ed][_0x37e9f7];if(_0x190ec0['type']){_0x190ec0[_0xa0ec('0x13')]=_0x190ec0[_0xa0ec('0x13')][_0xa0ec('0x28')]();}var _0x479325=[];var _0x588d68=[];delete _0x190ec0['id'];delete _0x190ec0[_0xa0ec('0x29')];delete _0x190ec0[_0xa0ec('0x2a')];var _0xb400c3=_0x190ec0[_0xa0ec('0x2b')]!==_0xa0ec('0x2c')?[_0x190ec0['interval']]:_0x190ec0[_0xa0ec('0x7')]?_['map'](_['filter'](_0x41b7d4[_0xa0ec('0x2d')],{'IntervalId':_0x190ec0['IntervalId']}),_0xa0ec('0x2b')):[];if(_0x190ec0[_0xa0ec('0xd')]('tag')){if(_0x190ec0[_0xa0ec('0x2e')]&&_0x190ec0['tag']!=='--'){_0x479325[_0xa0ec('0x12')]({'type':_0x190ec0[_0xa0ec('0x13')],'app':'Set','appdata':_0xa0ec('0x2f')+_0x190ec0[_0xa0ec('0x2e')],'context':_0x190ec0[_0xa0ec('0x16')],'exten':_0x190ec0[_0xa0ec('0x9')],'priority':_0xb400c3['length']+_0x41b7d4[_0xa0ec('0xe')]+_0x560d61++,'VoiceExtensionId':_0x190ec0[_0xa0ec('0x17')]});}}if(_0x190ec0[_0xa0ec('0x13')]===_0xa0ec('0x1a')&&_0x190ec0['hasOwnProperty'](_0xa0ec('0x30'))){if(_0x190ec0[_0xa0ec('0x30')]){_0x479325['push']({'type':_0x190ec0['type'],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x190ec0[_0xa0ec('0x30')]+')','context':_0x190ec0[_0xa0ec('0x16')],'exten':_0x190ec0['exten'],'priority':_0xb400c3[_0xa0ec('0x27')]+_0x41b7d4['priority']+_0x560d61++,'VoiceExtensionId':_0x190ec0[_0xa0ec('0x17')]});}else{_0x479325['push']({'type':_0x190ec0[_0xa0ec('0x13')],'app':'ExecIf','appdata':_0xa0ec('0x31'),'context':_0x190ec0[_0xa0ec('0x16')],'exten':_0x190ec0['exten'],'priority':_0xb400c3[_0xa0ec('0x27')]+_0x41b7d4[_0xa0ec('0xe')]+_0x560d61++,'VoiceExtensionId':_0x190ec0[_0xa0ec('0x17')]});}}if(_0x190ec0[_0xa0ec('0xd')]('answer')){if(_0x2041a2[_0xa0ec('0x32')](_0x190ec0[_0xa0ec('0x33')][_0xa0ec('0x28')]())>=0x0&&_0x190ec0[_0xa0ec('0x34')]!==_0xa0ec('0x35')){if(_0x190ec0[_0xa0ec('0x36')]){_0x479325[_0xa0ec('0x12')]({'type':_0x190ec0[_0xa0ec('0x13')],'app':_0xa0ec('0x37'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x190ec0[_0xa0ec('0x16')],'exten':_0x190ec0[_0xa0ec('0x9')],'priority':_0xb400c3[_0xa0ec('0x27')]+_0x41b7d4[_0xa0ec('0xe')]+_0x560d61++,'VoiceExtensionId':_0x190ec0[_0xa0ec('0x17')]});_0x479325['push']({'type':_0x190ec0[_0xa0ec('0x13')],'app':_0xa0ec('0x18'),'appdata':_0xa0ec('0x38'),'context':_0x190ec0[_0xa0ec('0x16')],'exten':_0x190ec0[_0xa0ec('0x9')],'priority':_0xb400c3['length']+_0x41b7d4[_0xa0ec('0xe')]+_0x560d61++,'VoiceExtensionId':_0x190ec0[_0xa0ec('0x17')]});}else{_0x479325[_0xa0ec('0x12')]({'type':_0x190ec0[_0xa0ec('0x13')],'app':_0xa0ec('0x37'),'appdata':_0xa0ec('0x39'),'context':_0x190ec0[_0xa0ec('0x16')],'exten':_0x190ec0[_0xa0ec('0x9')],'priority':_0xb400c3[_0xa0ec('0x27')]+_0x41b7d4['priority']+_0x560d61++,'VoiceExtensionId':_0x190ec0[_0xa0ec('0x17')]});_0x479325['push']({'type':_0x190ec0['type'],'app':_0xa0ec('0x18'),'appdata':_0xa0ec('0x3a'),'context':_0x190ec0[_0xa0ec('0x16')],'exten':_0x190ec0[_0xa0ec('0x9')],'priority':_0xb400c3[_0xa0ec('0x27')]+_0x41b7d4[_0xa0ec('0xe')]+_0x560d61++,'VoiceExtensionId':_0x190ec0[_0xa0ec('0x17')]});}}}for(var _0x208379=0x0;_0x208379<_0xb400c3[_0xa0ec('0x27')];_0x208379+=0x1){var _0x10c059=_0x41b7d4[_0xa0ec('0xe')]+_0xb400c3[_0xa0ec('0x27')];var _0x439cf9=_0x208379===_0xb400c3[_0xa0ec('0x27')]-0x1?_0x41b7d4[_0xa0ec('0xe')]+_0x479325[_0xa0ec('0x27')]+_0x588d68['length']+0x2:_0x41b7d4['priority']+_0x208379+0x1;_0x479325[_0xa0ec('0x3b')](_0x208379,0x0,{'type':_0x190ec0[_0xa0ec('0x13')],'app':_0xa0ec('0x3c'),'appdata':_0xb400c3[_0x208379]+'?'+_0x190ec0[_0xa0ec('0x16')]+_0xa0ec('0x3d')+_0x10c059+':'+_0x190ec0['context']+_0xa0ec('0x3d')+_0x439cf9,'exten':_0x190ec0['exten'],'context':_0x190ec0['context'],'priority':_0x41b7d4[_0xa0ec('0xe')]+_0x208379,'VoiceExtensionId':_0x564093[_0x2499ed][0x0]['VoiceExtensionId']});}_0x190ec0[_0xa0ec('0xe')]=_0x479325['length']?_[_0xa0ec('0x3e')](_0x479325)[_0xa0ec('0xe')]+0x1:_0x41b7d4[_0xa0ec('0xe')];_0x41b7d4[_0xa0ec('0xe')]=(_0x588d68[_0xa0ec('0x27')]?_[_0xa0ec('0x3e')](_0x588d68)[_0xa0ec('0xe')]:_0x190ec0[_0xa0ec('0xe')])+0x1;_0x41b7d4[_0xa0ec('0xf')]=_['concat'](_0x41b7d4[_0xa0ec('0xf')],_0x479325,[_0x190ec0],_0x588d68);}_0x41b7d4['extensions'][_0xa0ec('0x12')]({'type':_0x564093[_0x2499ed][0x0][_0xa0ec('0x13')],'app':_0xa0ec('0x3f'),'exten':_0x564093[_0x2499ed][0x0][_0xa0ec('0x9')],'context':_0x564093[_0x2499ed][0x0]['context'],'priority':_0x41b7d4[_0xa0ec('0xe')],'VoiceExtensionId':_0x564093[_0x2499ed][0x0][_0xa0ec('0x17')]});_0x249cca[_0xa0ec('0x12')](_0x564093[_0x2499ed][0x0][_0xa0ec('0x17')]);_0x3124f3=_['concat'](_0x3124f3,_0x41b7d4[_0xa0ec('0xf')]);}}return _0x9b2be4['transaction'](function(_0x4045eb){return _0x9b2be4['models'][_0xa0ec('0x6')][_0xa0ec('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x249cca}},'transaction':_0x4045eb})[_0xa0ec('0x5')](function(_0x5d3ae4){return _0x9b2be4['models'][_0xa0ec('0x6')][_0xa0ec('0x41')](_[_0xa0ec('0x42')](_0x3124f3,_0xa0ec('0xe')),{'transaction':_0x4045eb});});});})[_0xa0ec('0x43')](function(_0x44b5ac){console['error'](_0x44b5ac);});}exports[_0xa0ec('0x44')]=rewrite; \ No newline at end of file +var _0xefe5=['createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','length','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-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','catch','error','rewrite','lodash','util','Interval','findAll','then','intervals','models','IntervalId','VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','hasOwnProperty','extensions','extension','find','push','type','Set','CDR(type)=%s','context','VoiceExtensionId','CDR(routeid)=','priority','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase'];(function(_0x54bdd1,_0x52b169){var _0x3fa79e=function(_0x1bfed7){while(--_0x1bfed7){_0x54bdd1['push'](_0x54bdd1['shift']());}};_0x3fa79e(++_0x52b169);}(_0xefe5,0x65));var _0x5efe=function(_0x45a91e,_0x5bedcc){_0x45a91e=_0x45a91e-0x0;var _0x469c56=_0xefe5[_0x45a91e];return _0x469c56;};'use strict';var _=require(_0x5efe('0x0'));var util=require(_0x5efe('0x1'));function rewrite(_0x3e1da8,_0x2612c4){var _0x4b9cb4=this;return _0x3e1da8['models'][_0x5efe('0x2')][_0x5efe('0x3')]({'raw':!![]})[_0x5efe('0x4')](function(_0xe9d784){_0x4b9cb4[_0x5efe('0x5')]=_0xe9d784;return _0x3e1da8[_0x5efe('0x6')]['VoiceExtension'][_0x5efe('0x3')]({'where':{'IntervalId':_0x2612c4[_0x5efe('0x7')]},'raw':!![]});})[_0x5efe('0x4')](function(_0x660c7d){return _0x3e1da8[_0x5efe('0x6')][_0x5efe('0x8')][_0x5efe('0x3')]({'where':{'exten':{'$in':_[_0x5efe('0x9')](_[_0x5efe('0xa')](_0x660c7d,'exten'))}},'order':[{'raw':_0x5efe('0xb')}],'raw':!![]});})['then'](function(_0x18f70a){var _0x382fd6=_[_0x5efe('0xc')](_0x18f70a,{'priority':'1'});var _0x5cea3b=_['filter'](_0x18f70a,{'isApp':0x1});var _0x5e253b=_[_0x5efe('0xd')](_0x5cea3b,_0x5efe('0xe'));var _0xe11a6a=['queue','playback'];var _0x3ec79d=[];var _0x24f51f=[];for(var _0x24d68b in _0x5e253b){if(_0x5e253b[_0x5efe('0xf')](_0x24d68b)){_0x4b9cb4['priority']=0x2;_0x4b9cb4[_0x5efe('0x10')]=[];_0x4b9cb4[_0x5efe('0x11')]=_[_0x5efe('0x12')](_0x382fd6,{'exten':_0x5e253b[_0x24d68b][0x0]['exten']});_0x4b9cb4[_0x5efe('0x10')][_0x5efe('0x13')]({'type':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x14')],'app':_0x5efe('0x15'),'appdata':util['format'](_0x5efe('0x16'),_0x5e253b[_0x24d68b][0x0]['type']),'context':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x17')],'exten':_0x5e253b[_0x24d68b][0x0][_0x5efe('0xe')],'priority':_0x4b9cb4['priority']++,'VoiceExtensionId':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x18')]});if(_0x5e253b[_0x24d68b][0x0][_0x5efe('0x14')]==='inbound'){_0x4b9cb4[_0x5efe('0x10')][_0x5efe('0x13')]({'type':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x14')],'app':_0x5efe('0x15'),'appdata':_0x5efe('0x19')+_0x5e253b[_0x24d68b][0x0]['VoiceExtensionId'],'context':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x17')],'exten':_0x5e253b[_0x24d68b][0x0]['exten'],'priority':_0x4b9cb4[_0x5efe('0x1a')]++,'VoiceExtensionId':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x18')]});}else if(_0x5e253b[_0x24d68b][0x0][_0x5efe('0x14')]===_0x5efe('0x1b')){if(_0x4b9cb4[_0x5efe('0x11')]){_0x4b9cb4['extensions'][_0x5efe('0x13')]({'type':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x14')],'app':_0x5efe('0x15'),'appdata':_0x5efe('0x1c')+(_0x4b9cb4[_0x5efe('0x11')][_0x5efe('0x1d')]?_0x5efe('0x1e')+_0x4b9cb4[_0x5efe('0x11')][_0x5efe('0x1d')]+'}':_0x5efe('0x1f')),'context':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x17')],'exten':_0x5e253b[_0x24d68b][0x0]['exten'],'priority':_0x4b9cb4[_0x5efe('0x1a')]++,'VoiceExtensionId':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x18')]});}_0x4b9cb4[_0x5efe('0x10')][_0x5efe('0x13')]({'type':_0x5e253b[_0x24d68b][0x0]['type'],'app':_0x5efe('0x15'),'appdata':_0x5efe('0x19')+_0x5e253b[_0x24d68b][0x0]['VoiceExtensionId'],'context':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x17')],'exten':_0x5e253b[_0x24d68b][0x0][_0x5efe('0xe')],'priority':_0x4b9cb4[_0x5efe('0x1a')]++,'VoiceExtensionId':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x18')]});var _0x18791b=_0x4b9cb4[_0x5efe('0x1a')]++;_0x4b9cb4['extensions']['push']({'type':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x14')],'app':_0x5efe('0x20'),'appdata':_0x5efe('0x21')+(_0x18791b+0x2)+'):Goto('+(_0x18791b+0x1)+')','context':_0x5e253b[_0x24d68b][0x0]['context'],'exten':_0x5e253b[_0x24d68b][0x0][_0x5efe('0xe')],'priority':_0x18791b,'VoiceExtensionId':_0x5e253b[_0x24d68b][0x0]['VoiceExtensionId']});if(_0x4b9cb4[_0x5efe('0x11')]){_0x4b9cb4['extensions'][_0x5efe('0x13')]({'type':_0x5e253b[_0x24d68b][0x0]['type'],'app':_0x5efe('0x15'),'appdata':_0x4b9cb4[_0x5efe('0x11')][_0x5efe('0x1d')]?_0x5efe('0x22')+_0x4b9cb4['extension'][_0x5efe('0x1d')]+'}':'CDR(prefix)=noprefix','context':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x17')],'exten':_0x5e253b[_0x24d68b][0x0][_0x5efe('0xe')],'priority':_0x4b9cb4[_0x5efe('0x1a')]++,'VoiceExtensionId':_0x5e253b[_0x24d68b][0x0]['VoiceExtensionId']});}_0x4b9cb4[_0x5efe('0x10')][_0x5efe('0x13')]({'type':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x14')],'app':'Set','appdata':'outboundrouteid='+_0x5e253b[_0x24d68b][0x0][_0x5efe('0x18')],'context':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x17')],'exten':_0x5e253b[_0x24d68b][0x0]['exten'],'priority':_0x4b9cb4[_0x5efe('0x1a')]++,'VoiceExtensionId':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x18')]});if(_0x4b9cb4['extension']&&_0x4b9cb4['extension'][_0x5efe('0xf')]('recordingFormat')&&_0x4b9cb4['extension'][_0x5efe('0x23')]!==_0x5efe('0x24')){_0x4b9cb4[_0x5efe('0x10')]['push']({'type':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x14')],'app':_0x5efe('0x15'),'appdata':_0x5efe('0x25'),'context':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x17')],'exten':_0x5e253b[_0x24d68b][0x0][_0x5efe('0xe')],'priority':_0x4b9cb4['priority']++,'VoiceExtensionId':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x18')]});_0x4b9cb4[_0x5efe('0x10')][_0x5efe('0x13')]({'type':_0x5e253b[_0x24d68b][0x0]['type'],'app':_0x5efe('0x15'),'appdata':_0x5efe('0x26')+_0x4b9cb4[_0x5efe('0x11')]['recordingFormat']||'wav','context':_0x5e253b[_0x24d68b][0x0]['context'],'exten':_0x5e253b[_0x24d68b][0x0][_0x5efe('0xe')],'priority':_0x4b9cb4[_0x5efe('0x1a')]++,'VoiceExtensionId':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x18')]});}}_0x4b9cb4[_0x5efe('0x10')][_0x5efe('0x13')]({'type':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x14')],'app':'Set','appdata':_0x5efe('0x27'),'context':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x17')],'exten':_0x5e253b[_0x24d68b][0x0][_0x5efe('0xe')],'priority':_0x4b9cb4[_0x5efe('0x1a')]++,'VoiceExtensionId':_0x5e253b[_0x24d68b][0x0]['VoiceExtensionId']});_0x4b9cb4[_0x5efe('0x10')][_0x5efe('0x13')]({'type':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x14')],'app':_0x5efe('0x15'),'appdata':_0x5efe('0x28'),'context':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x17')],'exten':_0x5e253b[_0x24d68b][0x0][_0x5efe('0xe')],'priority':_0x4b9cb4[_0x5efe('0x1a')]++,'VoiceExtensionId':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x18')]});_0x4b9cb4[_0x5efe('0x10')][_0x5efe('0x13')]({'type':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x14')],'app':_0x5efe('0x15'),'appdata':_0x5efe('0x29'),'context':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x17')],'exten':_0x5e253b[_0x24d68b][0x0]['exten'],'priority':_0x4b9cb4[_0x5efe('0x1a')]++,'VoiceExtensionId':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x18')]});for(var _0x239fc4=0x0,_0xa074a4=0x0;_0x239fc4<_0x5e253b[_0x24d68b]['length'];_0x239fc4+=0x1,_0xa074a4=0x0){var _0x5daaa3=_0x5e253b[_0x24d68b][_0x239fc4];if(_0x5daaa3['type']){_0x5daaa3['type']=_0x5daaa3[_0x5efe('0x14')][_0x5efe('0x2a')]();}var _0x254663=[];var _0x5ab718=[];delete _0x5daaa3['id'];delete _0x5daaa3[_0x5efe('0x2b')];delete _0x5daaa3[_0x5efe('0x2c')];var _0x37343f=_0x5daaa3[_0x5efe('0x2d')]!==_0x5efe('0x2e')?[_0x5daaa3[_0x5efe('0x2d')]]:_0x5daaa3[_0x5efe('0x7')]?_[_0x5efe('0xa')](_['filter'](_0x4b9cb4['intervals'],{'IntervalId':_0x5daaa3[_0x5efe('0x7')]}),'interval'):[];if(_0x5daaa3['hasOwnProperty'](_0x5efe('0x2f'))){if(_0x5daaa3[_0x5efe('0x2f')]&&_0x5daaa3[_0x5efe('0x2f')]!=='--'){_0x254663[_0x5efe('0x13')]({'type':_0x5daaa3[_0x5efe('0x14')],'app':_0x5efe('0x15'),'appdata':_0x5efe('0x30')+_0x5daaa3[_0x5efe('0x2f')],'context':_0x5daaa3[_0x5efe('0x17')],'exten':_0x5daaa3['exten'],'priority':_0x37343f[_0x5efe('0x31')]+_0x4b9cb4['priority']+_0xa074a4++,'VoiceExtensionId':_0x5daaa3[_0x5efe('0x18')]});}}if(_0x5daaa3['type']===_0x5efe('0x1b')&&_0x5daaa3[_0x5efe('0xf')]('callerID')){if(_0x5daaa3[_0x5efe('0x32')]){_0x254663[_0x5efe('0x13')]({'type':_0x5daaa3['type'],'app':_0x5efe('0x20'),'appdata':_0x5efe('0x33')+_0x5daaa3['callerID']+')','context':_0x5daaa3[_0x5efe('0x17')],'exten':_0x5daaa3['exten'],'priority':_0x37343f[_0x5efe('0x31')]+_0x4b9cb4[_0x5efe('0x1a')]+_0xa074a4++,'VoiceExtensionId':_0x5daaa3[_0x5efe('0x18')]});}else{_0x254663[_0x5efe('0x13')]({'type':_0x5daaa3[_0x5efe('0x14')],'app':_0x5efe('0x20'),'appdata':_0x5efe('0x34'),'context':_0x5daaa3[_0x5efe('0x17')],'exten':_0x5daaa3[_0x5efe('0xe')],'priority':_0x37343f[_0x5efe('0x31')]+_0x4b9cb4[_0x5efe('0x1a')]+_0xa074a4++,'VoiceExtensionId':_0x5daaa3['VoiceExtensionId']});}}if(_0x5daaa3['hasOwnProperty'](_0x5efe('0x35'))){if(_0xe11a6a[_0x5efe('0x36')](_0x5daaa3[_0x5efe('0x37')][_0x5efe('0x2a')]())>=0x0&&_0x5daaa3[_0x5efe('0x38')]!==_0x5efe('0x39')){if(_0x5daaa3[_0x5efe('0x35')]){_0x254663[_0x5efe('0x13')]({'type':_0x5daaa3[_0x5efe('0x14')],'app':'ExecIf','appdata':_0x5efe('0x3a'),'context':_0x5daaa3[_0x5efe('0x17')],'exten':_0x5daaa3[_0x5efe('0xe')],'priority':_0x37343f[_0x5efe('0x31')]+_0x4b9cb4['priority']+_0xa074a4++,'VoiceExtensionId':_0x5daaa3[_0x5efe('0x18')]});_0x254663['push']({'type':_0x5daaa3[_0x5efe('0x14')],'app':_0x5efe('0x15'),'appdata':_0x5efe('0x3b'),'context':_0x5daaa3[_0x5efe('0x17')],'exten':_0x5daaa3[_0x5efe('0xe')],'priority':_0x37343f[_0x5efe('0x31')]+_0x4b9cb4[_0x5efe('0x1a')]+_0xa074a4++,'VoiceExtensionId':_0x5daaa3[_0x5efe('0x18')]});}else{_0x254663['push']({'type':_0x5daaa3[_0x5efe('0x14')],'app':_0x5efe('0x20'),'appdata':_0x5efe('0x3c'),'context':_0x5daaa3[_0x5efe('0x17')],'exten':_0x5daaa3[_0x5efe('0xe')],'priority':_0x37343f[_0x5efe('0x31')]+_0x4b9cb4['priority']+_0xa074a4++,'VoiceExtensionId':_0x5daaa3[_0x5efe('0x18')]});_0x254663[_0x5efe('0x13')]({'type':_0x5daaa3['type'],'app':_0x5efe('0x15'),'appdata':_0x5efe('0x3d'),'context':_0x5daaa3[_0x5efe('0x17')],'exten':_0x5daaa3['exten'],'priority':_0x37343f[_0x5efe('0x31')]+_0x4b9cb4[_0x5efe('0x1a')]+_0xa074a4++,'VoiceExtensionId':_0x5daaa3['VoiceExtensionId']});}}}for(var _0x5df2d1=0x0;_0x5df2d1<_0x37343f[_0x5efe('0x31')];_0x5df2d1+=0x1){var _0x504e70=_0x4b9cb4[_0x5efe('0x1a')]+_0x37343f[_0x5efe('0x31')];var _0x2cd506=_0x5df2d1===_0x37343f[_0x5efe('0x31')]-0x1?_0x4b9cb4['priority']+_0x254663[_0x5efe('0x31')]+_0x5ab718[_0x5efe('0x31')]+0x2:_0x4b9cb4[_0x5efe('0x1a')]+_0x5df2d1+0x1;_0x254663[_0x5efe('0x3e')](_0x5df2d1,0x0,{'type':_0x5daaa3[_0x5efe('0x14')],'app':_0x5efe('0x3f'),'appdata':_0x37343f[_0x5df2d1]+'?'+_0x5daaa3[_0x5efe('0x17')]+_0x5efe('0x40')+_0x504e70+':'+_0x5daaa3[_0x5efe('0x17')]+_0x5efe('0x40')+_0x2cd506,'exten':_0x5daaa3[_0x5efe('0xe')],'context':_0x5daaa3[_0x5efe('0x17')],'priority':_0x4b9cb4['priority']+_0x5df2d1,'VoiceExtensionId':_0x5e253b[_0x24d68b][0x0]['VoiceExtensionId']});}_0x5daaa3[_0x5efe('0x1a')]=_0x254663['length']?_[_0x5efe('0x41')](_0x254663)[_0x5efe('0x1a')]+0x1:_0x4b9cb4['priority'];_0x4b9cb4[_0x5efe('0x1a')]=(_0x5ab718[_0x5efe('0x31')]?_[_0x5efe('0x41')](_0x5ab718)[_0x5efe('0x1a')]:_0x5daaa3[_0x5efe('0x1a')])+0x1;_0x4b9cb4[_0x5efe('0x10')]=_[_0x5efe('0x42')](_0x4b9cb4[_0x5efe('0x10')],_0x254663,[_0x5daaa3],_0x5ab718);}_0x4b9cb4[_0x5efe('0x10')][_0x5efe('0x13')]({'type':_0x5e253b[_0x24d68b][0x0]['type'],'app':_0x5efe('0x43'),'exten':_0x5e253b[_0x24d68b][0x0][_0x5efe('0xe')],'context':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x17')],'priority':_0x4b9cb4[_0x5efe('0x1a')],'VoiceExtensionId':_0x5e253b[_0x24d68b][0x0][_0x5efe('0x18')]});_0x3ec79d['push'](_0x5e253b[_0x24d68b][0x0]['VoiceExtensionId']);_0x24f51f=_[_0x5efe('0x42')](_0x24f51f,_0x4b9cb4['extensions']);}}return _0x3e1da8[_0x5efe('0x44')](function(_0x43d4ae){return _0x3e1da8[_0x5efe('0x6')][_0x5efe('0x8')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x3ec79d}},'transaction':_0x43d4ae})['then'](function(_0x1d9713){return _0x3e1da8[_0x5efe('0x6')][_0x5efe('0x8')]['bulkCreate'](_['sortBy'](_0x24f51f,_0x5efe('0x1a')),{'transaction':_0x43d4ae});});});})[_0x5efe('0x45')](function(_0x43d17e){console[_0x5efe('0x46')](_0x43d17e);});}exports[_0x5efe('0x47')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index e8ab8d7..3487326 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 _0x4a38=['parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','Missing\x20filepath\x20parameter!','null','undefined','Missing\x20binding\x20parameters!','zipObject','split','error','contact','test','isNil','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','insert','fromQuery','ContactId','ListId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','cm_hopper','str','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','into','cm_hopper_black','ListId\x20=\x20?','VoiceQueue','outbound','dialCheckDuplicateType','query','VoiceQueueId','sequelize','all','findAll','CmList','BlackLists','Campaign','Lists','get','always','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','resolve','contact:csv_','unlinkSync','exit','SIGINT','info','createReadStream'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0x4a38,0x145));var _0x84a3=function(_0x1a9009,_0x1a1fe4){_0x1a9009=_0x1a9009-0x0;var _0x1afe1e=_0x4a38[_0x1a9009];return _0x1afe1e;};'use strict';var BPromise=require('bluebird');var util=require(_0x84a3('0x0'));var _=require(_0x84a3('0x1'));var fs=require('fs');var squel=require(_0x84a3('0x2'));var Papa=require(_0x84a3('0x3'));var Redis=require(_0x84a3('0x4'));var db=require(_0x84a3('0x5'))['db'];var config=require(_0x84a3('0x6'));var logger=require(_0x84a3('0x7'))(_0x84a3('0x8'));config[_0x84a3('0x9')]=_[_0x84a3('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x84a3('0xb'))(new Redis(config[_0x84a3('0x9')]));require(_0x84a3('0xc'))[_0x84a3('0xd')](socket);try{if(!process[_0x84a3('0xe')][0x2]||process[_0x84a3('0xe')][0x2]==='undefined'||process[_0x84a3('0xe')][0x2]==='null'){throw new Error(_0x84a3('0xf'));}var FILEPATH=process[_0x84a3('0xe')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]==='undefined'||process[_0x84a3('0xe')][0x3]===_0x84a3('0x10')||!process[_0x84a3('0xe')][0x4]||process['argv'][0x4]===_0x84a3('0x11')||process[_0x84a3('0xe')][0x4]===_0x84a3('0x10')){throw new Error(_0x84a3('0x12'));}var FIELDS=_[_0x84a3('0x13')](process[_0x84a3('0xe')][0x3]['split'](','),process[_0x84a3('0xe')][0x4][_0x84a3('0x14')](','));if(!process['argv'][0x5]||process['argv'][0x5]==='undefined'||process[_0x84a3('0xe')][0x5]===_0x84a3('0x10')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x84a3('0xe')][0x6]&&process['argv'][0x6]!=='undefined'&&process['argv'][0x6]!==_0x84a3('0x10')?process[_0x84a3('0xe')][0x6]:null;var DUPLICATES=process[_0x84a3('0xe')][0x7]&&process['argv'][0x7]!==_0x84a3('0x11')&&process[_0x84a3('0xe')][0x7]!=='null'?process[_0x84a3('0xe')][0x7]:null;if(!process[_0x84a3('0xe')][0x8]||process['argv'][0x8]===_0x84a3('0x11')||process[_0x84a3('0xe')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x84a3('0xe')][0x8];}catch(_0x1c7554){logger[_0x84a3('0x15')](_0x1c7554);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(_0x33175b,_0x566f1a,_0x262860,_0x3e0a10){var _0x4ad6be={'message':_0x566f1a};_0x4ad6be[_0x33175b]=!![];if(_0x262860){_0x4ad6be[_0x84a3('0x16')]=_0x262860;}if(_0x3e0a10){_0x4ad6be['index']=_0x3e0a10;}return _0x4ad6be;}function isEmail(_0x3bd3ac){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))*$/[_0x84a3('0x17')](_0x3bd3ac);}function checkRow(_0x35b543,_0x234abf,_0x36ed99){return new BPromise(function(_0x39b52a,_0x595a93){if(_[_0x84a3('0x18')](_0x35b543)){return _0x595a93(handleCheckRowError(_0x84a3('0x15'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x36ed99));}if(_0x35b543[_0x84a3('0x19')]&&_0x35b543[_0x84a3('0x19')][_0x84a3('0x1a')]){var _0x2a48c5=_[_0x84a3('0x1b')](_0x35b543['errors'],_0x84a3('0x1c'))[_0x84a3('0x1d')](';');return _0x595a93(handleCheckRowError(_0x84a3('0x15'),_0x2a48c5,null,_0x36ed99));}var _0x47e12c={};for(var _0x4d0338 in FIELDS){if(FIELDS[_0x84a3('0x1e')](_0x4d0338)&&FIELDS[_0x4d0338]){_0x47e12c[_0x4d0338]=_0x35b543['data'][0x0][FIELDS[_0x4d0338]]||_0x35b543[_0x84a3('0x1f')][0x0]['\ufeff'+FIELDS[_0x4d0338]];}}if(!_0x47e12c[_0x84a3('0x20')]){return _0x595a93(handleCheckRowError(_0x84a3('0x15'),_0x84a3('0x21'),null,_0x36ed99));}if(!_0x47e12c[_0x84a3('0x22')]){return _0x595a93(handleCheckRowError('error',_0x84a3('0x23'),null,_0x36ed99));}if(_0x47e12c['birthDate']){var _0xba9997=moment(_0x47e12c['birthDate'],_0x84a3('0x24'));if(!_0xba9997[_0x84a3('0x25')]()){return _0x595a93(handleCheckRowError(_0x84a3('0x15'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x36ed99));}}if(_0x47e12c[_0x84a3('0x26')]){if(!isEmail(_0x47e12c[_0x84a3('0x26')])){return _0x595a93(handleCheckRowError(_0x84a3('0x15'),_0x84a3('0x27'),null,_0x36ed99));}}_0x47e12c['ListId']=LISTID;_0x47e12c[_0x84a3('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x84a3('0x1a')]&&_0x234abf){var _0x53fb17={};for(var _0xa01d51=0x0,_0x721424=DUPLICATES[_0x84a3('0x1a')];_0xa01d51<_0x721424;_0xa01d51+=0x1){_0x53fb17[DUPLICATES[_0xa01d51]]=_0x47e12c[DUPLICATES[_0xa01d51]];}var _0x38e934=_[_0x84a3('0x29')](_0x234abf,_0x53fb17);if(_0x38e934){return _0x595a93(handleCheckRowError(_0x84a3('0x2a'),_0x84a3('0x2b'),_0x38e934,_0x36ed99));}}return db[_0x84a3('0x2c')]['create'](_0x47e12c,{'raw':!![],'hooks':![],'fields':_['keys'](_0x47e12c)})[_0x84a3('0x2d')](function(_0x1a4e7e){if(DUPLICATES&&DUPLICATES[_0x84a3('0x1a')]&&_0x234abf){_0x234abf[_0x84a3('0x2e')](_[_0x84a3('0x2f')](_0x47e12c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1a4e7e['id'];return _0x39b52a();})[_0x84a3('0x30')](function(_0x1fd357){return _0x595a93(handleCheckRowError(_0x84a3('0x15'),_0x84a3('0x31')+(_0x1fd357['message']||JSON[_0x84a3('0x32')](_0x1fd357)),null,_0x36ed99));});});}function checkHopper(){function _0x2a51e4(){return function(_0x3bca12){logger[_0x84a3('0x15')](_0x84a3('0x33'),_0x84a3('0x34'),util['inspect'](_0x3bca12,{'showHidden':![],'depth':null}));};}var _0x5c35cc=function(_0x3508ff,_0x132ec3){var _0x1187c5=squel[_0x84a3('0x35')]()['into']('cm_hopper')[_0x84a3('0x36')]([_0x84a3('0x22'),'scheduledAt',_0x84a3('0x37'),_0x84a3('0x38'),_0x132ec3,_0x84a3('0x39'),_0x84a3('0x3a')],squel[_0x84a3('0x3b')]()['field'](_0x84a3('0x22'),_0x84a3('0x22'))[_0x84a3('0x3c')](_0x84a3('0x3d'),_0x84a3('0x3e'))[_0x84a3('0x3c')]('id',_0x84a3('0x37'))[_0x84a3('0x3c')](LISTID[_0x84a3('0x3f')](),'ListId')['field'](_0x3508ff['id']['toString'](),_0x132ec3)['field']('NOW()','createdAt')[_0x84a3('0x3c')](_0x84a3('0x3d'),_0x84a3('0x3a'))[_0x84a3('0x40')](_0x84a3('0x41'))[_0x84a3('0x42')](_0x84a3('0x43'))[_0x84a3('0x42')]('ListId\x20=\x20?',LISTID[_0x84a3('0x3f')]())[_0x84a3('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0x84a3('0x42')](_0x84a3('0x44'),squel[_0x84a3('0x3b')]()['field'](_0x84a3('0x22'))[_0x84a3('0x40')]('cm_hopper')['where'](_0x132ec3+_0x84a3('0x45'),_0x3508ff['id'][_0x84a3('0x3f')]())))['toString']();return _0x1187c5;};var _0x555f6b=function(_0x5ead15,_0x46a8d9){var _0x137157=squel['insert']()['into'](_0x84a3('0x46'))['fromQuery']([_0x84a3('0x22'),_0x84a3('0x3e'),'ContactId',_0x84a3('0x38'),_0x46a8d9,_0x84a3('0x39'),_0x84a3('0x3a')],squel[_0x84a3('0x3b')]()[_0x84a3('0x3c')](_0x84a3('0x22'),_0x84a3('0x22'))['field'](_0x84a3('0x3d'),_0x84a3('0x3e'))['field']('id',_0x84a3('0x37'))['field'](LISTID[_0x84a3('0x3f')](),_0x84a3('0x38'))[_0x84a3('0x3c')](_0x5ead15['id'][_0x84a3('0x3f')](),_0x46a8d9)[_0x84a3('0x3c')](_0x84a3('0x3d'),_0x84a3('0x39'))[_0x84a3('0x3c')](_0x84a3('0x3d'),_0x84a3('0x3a'))[_0x84a3('0x40')](_0x84a3('0x41'))['where'](_0x84a3('0x43'))[_0x84a3('0x42')]('ListId\x20=\x20?',LISTID[_0x84a3('0x3f')]())['where']('id\x20IN\x20?',squel[_0x84a3('0x47')](hopperContacts))[_0x84a3('0x42')](_0x84a3('0x48'))['where'](_0x84a3('0x44'),squel['select']()[_0x84a3('0x3c')]('calleridnum')[_0x84a3('0x40')](_0x84a3('0x49'))['where'](_0x46a8d9+_0x84a3('0x45'),_0x5ead15['id'][_0x84a3('0x3f')]()))['where'](_0x84a3('0x44'),squel[_0x84a3('0x3b')]()[_0x84a3('0x3c')](_0x84a3('0x22'))[_0x84a3('0x40')](_0x84a3('0x46'))[_0x84a3('0x42')](_0x46a8d9+'\x20=\x20?',_0x5ead15['id'][_0x84a3('0x3f')]())))[_0x84a3('0x3f')]();return _0x137157;};function _0x5ec463(_0x1369c8,_0x5a02ad){var _0x121bf9=squel[_0x84a3('0x35')]()['into']('cm_hopper')[_0x84a3('0x36')]([_0x84a3('0x22'),_0x84a3('0x3e'),'ContactId',_0x84a3('0x38'),_0x5a02ad,_0x84a3('0x39'),_0x84a3('0x3a')],squel[_0x84a3('0x3b')]()[_0x84a3('0x3c')](_0x84a3('0x22'),_0x84a3('0x22'))[_0x84a3('0x3c')](_0x84a3('0x3d'),_0x84a3('0x3e'))[_0x84a3('0x3c')]('id',_0x84a3('0x37'))[_0x84a3('0x3c')](LISTID[_0x84a3('0x3f')](),_0x84a3('0x38'))['field'](_0x1369c8['id'][_0x84a3('0x3f')](),_0x5a02ad)[_0x84a3('0x3c')](_0x84a3('0x3d'),_0x84a3('0x39'))[_0x84a3('0x3c')](_0x84a3('0x3d'),_0x84a3('0x3a'))[_0x84a3('0x40')](_0x84a3('0x41'))[_0x84a3('0x42')](_0x84a3('0x43'))[_0x84a3('0x42')]('ListId\x20=\x20?',LISTID[_0x84a3('0x3f')]())[_0x84a3('0x42')]('id\x20IN\x20?',squel[_0x84a3('0x47')](hopperContacts))[_0x84a3('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0x84a3('0x3f')]();return _0x121bf9;}function _0x2f5aff(_0x1d103e,_0x18122f){var _0x398d37=squel[_0x84a3('0x35')]()[_0x84a3('0x4a')](_0x84a3('0x4b'))['fromQuery'](['phone','ContactId',_0x84a3('0x38'),_0x18122f,_0x84a3('0x39'),_0x84a3('0x3a')],squel['select']()[_0x84a3('0x3c')](_0x84a3('0x22'),_0x84a3('0x22'))[_0x84a3('0x3c')]('id',_0x84a3('0x37'))[_0x84a3('0x3c')](LISTID[_0x84a3('0x3f')](),'ListId')[_0x84a3('0x3c')](_0x1d103e['id'][_0x84a3('0x3f')](),_0x18122f)[_0x84a3('0x3c')](_0x84a3('0x3d'),_0x84a3('0x39'))[_0x84a3('0x3c')](_0x84a3('0x3d'),'updatedAt')['from']('cm_contacts')['where'](_0x84a3('0x43'))['where'](_0x84a3('0x4c'),LISTID[_0x84a3('0x3f')]())['where']('id\x20IN\x20?',squel[_0x84a3('0x47')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x84a3('0x3f')]();return _0x398d37;}return db[_0x84a3('0x4d')]['findAll']({'where':{'type':_0x84a3('0x4e')},'attributes':['id',_0x84a3('0x4f')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x2a3ee2){var _0xe9589c=[];if(_0x2a3ee2){var _0x27296e;for(var _0x1227ce=0x0,_0x284dc6;_0x1227ce<_0x2a3ee2['length'];_0x1227ce+=0x1){_0x284dc6=_0x2a3ee2[_0x1227ce]['get']({'plain':!![]});switch(_0x284dc6[_0x84a3('0x4f')]){case'always':_0xe9589c[_0x84a3('0x2e')](db['sequelize'][_0x84a3('0x50')](_0x555f6b(_0x284dc6,_0x84a3('0x51')))[_0x84a3('0x2d')](function(){})[_0x84a3('0x30')](_0x2a51e4()));break;case'onlyIfOpen':_0xe9589c['push'](db[_0x84a3('0x52')][_0x84a3('0x50')](_0x5c35cc(_0x284dc6,_0x84a3('0x51')))[_0x84a3('0x2d')](function(){})['catch'](_0x2a51e4()));break;default:_0xe9589c[_0x84a3('0x2e')](db[_0x84a3('0x52')][_0x84a3('0x50')](_0x5ec463(_0x284dc6,_0x84a3('0x51')))[_0x84a3('0x2d')](function(){})[_0x84a3('0x30')](_0x2a51e4()));}}}return _0xe9589c;})[_0x84a3('0x53')]()[_0x84a3('0x2d')](function(){return db[_0x84a3('0x4d')][_0x84a3('0x54')]({'where':{'type':_0x84a3('0x4e')},'attributes':['id'],'include':[{'model':db[_0x84a3('0x55')],'as':_0x84a3('0x56'),'where':{'id':LISTID}}]})['then'](function(_0x48a73b){var _0x2661c6=[];if(_0x48a73b){var _0x19f6a9;for(var _0x2d3581=0x0,_0xd0e62e;_0x2d3581<_0x48a73b['length'];_0x2d3581+=0x1){_0xd0e62e=_0x48a73b[_0x2d3581]['get']({'plain':!![]});_0x2661c6[_0x84a3('0x2e')](db[_0x84a3('0x52')]['query'](_0x2f5aff(_0xd0e62e,_0x84a3('0x51')))[_0x84a3('0x2d')](function(){})[_0x84a3('0x30')](_0x2a51e4()));}}return _0x2661c6;})['all']();})['then'](function(){return db[_0x84a3('0x57')][_0x84a3('0x54')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x84a3('0x55')],'as':_0x84a3('0x58'),'where':{'id':LISTID}}]})[_0x84a3('0x2d')](function(_0xd4e24){var _0x396cae=[];if(_0xd4e24){for(var _0x4498de=0x0,_0x2c5e38;_0x4498de<_0xd4e24[_0x84a3('0x1a')];_0x4498de+=0x1){_0x2c5e38=_0xd4e24[_0x4498de][_0x84a3('0x59')]({'plain':!![]});switch(_0x2c5e38[_0x84a3('0x4f')]){case _0x84a3('0x5a'):_0x396cae[_0x84a3('0x2e')](db[_0x84a3('0x52')][_0x84a3('0x50')](_0x555f6b(_0x2c5e38,_0x84a3('0x5b')))[_0x84a3('0x2d')](function(){})['catch'](_0x2a51e4()));break;case'onlyIfOpen':_0x396cae['push'](db['sequelize']['query'](_0x5c35cc(_0x2c5e38,_0x84a3('0x5b')))[_0x84a3('0x2d')](function(){})[_0x84a3('0x30')](_0x2a51e4()));break;default:_0x396cae['push'](db[_0x84a3('0x52')][_0x84a3('0x50')](_0x5ec463(_0x2c5e38,'CampaignId'))['then'](function(){})[_0x84a3('0x30')](_0x2a51e4()));}}}return _0x396cae;})['all']();})['then'](function(){return db[_0x84a3('0x57')][_0x84a3('0x54')]({'attributes':['id'],'include':[{'model':db[_0x84a3('0x55')],'as':_0x84a3('0x56'),'where':{'id':LISTID}}]})[_0x84a3('0x2d')](function(_0x2847f8){var _0x1af4d4=[];if(_0x2847f8){for(var _0x216c92=0x0,_0x408789;_0x216c92<_0x2847f8[_0x84a3('0x1a')];_0x216c92+=0x1){_0x408789=_0x2847f8[_0x216c92][_0x84a3('0x59')]({'plain':!![]});_0x1af4d4[_0x84a3('0x2e')](db[_0x84a3('0x52')][_0x84a3('0x50')](_0x2f5aff(_0x408789,'CampaignId'))[_0x84a3('0x2d')](function(){})[_0x84a3('0x30')](_0x2a51e4()));}}return _0x1af4d4;})[_0x84a3('0x53')]();})[_0x84a3('0x30')](function(_0x2c2542){logger[_0x84a3('0x15')]('cmContact,\x20%s,\x20%s',_0x84a3('0x5c'),_0x2c2542[_0x84a3('0x1c')]);});}var processPromises=function(_0xc61b84){return BPromise[_0x84a3('0x53')](promises)[_0x84a3('0x2d')](function(_0x49db2a){})[_0x84a3('0x30')](function(_0x1e1d03){logger[_0x84a3('0x15')](_0x84a3('0x5d'),JSON['stringify'](_0x1e1d03));})[_0x84a3('0x5e')](function(){socket[_0x84a3('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xc61b84){return _0xc61b84['resume']();}});};var endCsv=function(){return BPromise[_0x84a3('0x60')]()[_0x84a3('0x2d')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x84a3('0x5f')](_0x84a3('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x84a3('0x62')](FILEPATH);}catch(_0x577dc3){logger[_0x84a3('0x15')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x84a3('0x32')](_0x577dc3));}finally{process[_0x84a3('0x63')](0x0);}});};process['on'](_0x84a3('0x64'),function(){logger[_0x84a3('0x65')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x84a3('0x60')]()[_0x84a3('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x84a3('0x2c')][_0x84a3('0x54')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x474760){var _0xee069d=fs[_0x84a3('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x84a3('0x67')](_0xee069d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1013b9,_0x5c2c7a){total+=0x1;var _0x88ef9e=total;promises[_0x84a3('0x2e')](checkRow(_0x1013b9,_0x474760,_0x88ef9e)['then'](function(){success+=0x1;})['catch'](function(_0x25d588){if(_0x25d588[_0x84a3('0x15')]){errors+=0x1;delete _0x25d588[_0x84a3('0x15')];}else if(_0x25d588[_0x84a3('0x2a')]){duplicates+=0x1;delete _0x25d588['duplicate'];}rows[_0x84a3('0x2e')](_0x25d588);}));if(total%0xc8===0x0){_0x5c2c7a[_0x84a3('0x68')]();return processPromises(_0x5c2c7a);}},'complete':function(){return processPromises()[_0x84a3('0x2d')](function(){logger[_0x84a3('0x65')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x26611a,_0x43f03d){logger[_0x84a3('0x65')](_0x84a3('0x69'),JSON[_0x84a3('0x32')](_0x26611a));endCsv();}});})[_0x84a3('0x30')](function(_0x41d145){logger[_0x84a3('0x15')](_0x84a3('0x6a'),JSON[_0x84a3('0x32')](_0x41d145));});}main(); \ No newline at end of file +var _0xdab6=['firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','Duplicate\x20Contact','CmContact','create','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','inspect','insert','into','cm_hopper','scheduledAt','updatedAt','select','field','phone','ContactId','toString','createdAt','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','fromQuery','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','always','sequelize','query','VoiceQueueId','then','push','all','CmList','BlackLists','Campaign','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','createReadStream','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','squel','ioredis','../../../config/logger','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','map','errors','message','hasOwnProperty','data','firstName'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xdab6,0x12b));var _0x6dab=function(_0x50e6c6,_0x1507e5){_0x50e6c6=_0x50e6c6-0x0;var _0x1858a3=_0xdab6[_0x50e6c6];return _0x1858a3;};'use strict';var BPromise=require(_0x6dab('0x0'));var util=require(_0x6dab('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x6dab('0x2'));var Papa=require('papaparse');var Redis=require(_0x6dab('0x3'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x6dab('0x4'))('api');config['redis']=_[_0x6dab('0x5')](config[_0x6dab('0x6')],{'host':_0x6dab('0x7'),'port':0x18eb});var socket=require(_0x6dab('0x8'))(new Redis(config[_0x6dab('0x6')]));require(_0x6dab('0x9'))[_0x6dab('0xa')](socket);try{if(!process[_0x6dab('0xb')][0x2]||process['argv'][0x2]===_0x6dab('0xc')||process[_0x6dab('0xb')][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x6dab('0xb')][0x3]||process[_0x6dab('0xb')][0x3]==='undefined'||process[_0x6dab('0xb')][0x3]===_0x6dab('0xd')||!process[_0x6dab('0xb')][0x4]||process['argv'][0x4]===_0x6dab('0xc')||process['argv'][0x4]===_0x6dab('0xd')){throw new Error(_0x6dab('0xe'));}var FIELDS=_[_0x6dab('0xf')](process['argv'][0x3]['split'](','),process[_0x6dab('0xb')][0x4][_0x6dab('0x10')](','));if(!process[_0x6dab('0xb')][0x5]||process[_0x6dab('0xb')][0x5]===_0x6dab('0xc')||process[_0x6dab('0xb')][0x5]===_0x6dab('0xd')){throw new Error(_0x6dab('0x11'));}var LISTID=process[_0x6dab('0xb')][0x5];var COMPANYID=process[_0x6dab('0xb')][0x6]&&process['argv'][0x6]!==_0x6dab('0xc')&&process[_0x6dab('0xb')][0x6]!==_0x6dab('0xd')?process[_0x6dab('0xb')][0x6]:null;var DUPLICATES=process[_0x6dab('0xb')][0x7]&&process[_0x6dab('0xb')][0x7]!==_0x6dab('0xc')&&process[_0x6dab('0xb')][0x7]!=='null'?process[_0x6dab('0xb')][0x7]:null;if(!process[_0x6dab('0xb')][0x8]||process[_0x6dab('0xb')][0x8]==='undefined'||process[_0x6dab('0xb')][0x8]===_0x6dab('0xd')){throw new Error(_0x6dab('0x12'));}var SOCKET_TIMESTAMP=process[_0x6dab('0xb')][0x8];}catch(_0x4a1316){logger[_0x6dab('0x13')](_0x4a1316);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(_0x3f72cc,_0x4abe84,_0xf7dc65,_0xd7f889){var _0x5e9cc8={'message':_0x4abe84};_0x5e9cc8[_0x3f72cc]=!![];if(_0xf7dc65){_0x5e9cc8[_0x6dab('0x14')]=_0xf7dc65;}if(_0xd7f889){_0x5e9cc8[_0x6dab('0x15')]=_0xd7f889;}return _0x5e9cc8;}function isEmail(_0x5a46d8){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))*$/[_0x6dab('0x16')](_0x5a46d8);}function checkRow(_0x5eb69e,_0x2c54d8,_0x4e1556){return new BPromise(function(_0x4dc1e8,_0xcf141a){if(_[_0x6dab('0x17')](_0x5eb69e)){return _0xcf141a(handleCheckRowError(_0x6dab('0x13'),_0x6dab('0x18'),null,_0x4e1556));}if(_0x5eb69e['errors']&&_0x5eb69e['errors']['length']){var _0x48cb92=_[_0x6dab('0x19')](_0x5eb69e[_0x6dab('0x1a')],_0x6dab('0x1b'))['join'](';');return _0xcf141a(handleCheckRowError(_0x6dab('0x13'),_0x48cb92,null,_0x4e1556));}var _0x4aa7ae={};for(var _0xe73ffb in FIELDS){if(FIELDS[_0x6dab('0x1c')](_0xe73ffb)&&FIELDS[_0xe73ffb]){_0x4aa7ae[_0xe73ffb]=_0x5eb69e[_0x6dab('0x1d')][0x0][FIELDS[_0xe73ffb]]||_0x5eb69e[_0x6dab('0x1d')][0x0]['\ufeff'+FIELDS[_0xe73ffb]];}}if(!_0x4aa7ae[_0x6dab('0x1e')]){return _0xcf141a(handleCheckRowError(_0x6dab('0x13'),_0x6dab('0x1f'),null,_0x4e1556));}if(!_0x4aa7ae['phone']){return _0xcf141a(handleCheckRowError('error','phone\x20not\x20specified!',null,_0x4e1556));}if(_0x4aa7ae[_0x6dab('0x20')]){var _0x2de314=moment(_0x4aa7ae[_0x6dab('0x20')],_0x6dab('0x21'));if(!_0x2de314['isValid']()){return _0xcf141a(handleCheckRowError(_0x6dab('0x13'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4e1556));}}if(_0x4aa7ae[_0x6dab('0x22')]){if(!isEmail(_0x4aa7ae['email'])){return _0xcf141a(handleCheckRowError('error',_0x6dab('0x23'),null,_0x4e1556));}}_0x4aa7ae[_0x6dab('0x24')]=LISTID;_0x4aa7ae[_0x6dab('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6dab('0x26')]&&_0x2c54d8){var _0x25355b={};for(var _0xf5152d=0x0,_0xe44c1f=DUPLICATES[_0x6dab('0x26')];_0xf5152d<_0xe44c1f;_0xf5152d+=0x1){_0x25355b[DUPLICATES[_0xf5152d]]=_0x4aa7ae[DUPLICATES[_0xf5152d]];}var _0x724abc=_[_0x6dab('0x27')](_0x2c54d8,_0x25355b);if(_0x724abc){return _0xcf141a(handleCheckRowError('duplicate',_0x6dab('0x28'),_0x724abc,_0x4e1556));}}return db[_0x6dab('0x29')][_0x6dab('0x2a')](_0x4aa7ae,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4aa7ae)})['then'](function(_0x53e8ca){if(DUPLICATES&&DUPLICATES['length']&&_0x2c54d8){_0x2c54d8['push'](_[_0x6dab('0x2b')](_0x4aa7ae,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x53e8ca['id'];return _0x4dc1e8();})[_0x6dab('0x2c')](function(_0xf4f922){return _0xcf141a(handleCheckRowError('error',_0x6dab('0x2d')+(_0xf4f922[_0x6dab('0x1b')]||JSON[_0x6dab('0x2e')](_0xf4f922)),null,_0x4e1556));});});}function checkHopper(){function _0x128ded(){return function(_0x4abf79){logger['error']('cmContact','checkHopper',util[_0x6dab('0x2f')](_0x4abf79,{'showHidden':![],'depth':null}));};}var _0x1b6610=function(_0x83d7d7,_0xee6c7f){var _0x2d3184=squel[_0x6dab('0x30')]()[_0x6dab('0x31')](_0x6dab('0x32'))['fromQuery'](['phone',_0x6dab('0x33'),'ContactId','ListId',_0xee6c7f,'createdAt',_0x6dab('0x34')],squel[_0x6dab('0x35')]()[_0x6dab('0x36')]('phone',_0x6dab('0x37'))[_0x6dab('0x36')]('NOW()',_0x6dab('0x33'))[_0x6dab('0x36')]('id',_0x6dab('0x38'))[_0x6dab('0x36')](LISTID['toString'](),'ListId')[_0x6dab('0x36')](_0x83d7d7['id'][_0x6dab('0x39')](),_0xee6c7f)[_0x6dab('0x36')]('NOW()',_0x6dab('0x3a'))[_0x6dab('0x36')](_0x6dab('0x3b'),_0x6dab('0x34'))[_0x6dab('0x3c')](_0x6dab('0x3d'))[_0x6dab('0x3e')](_0x6dab('0x3f'))[_0x6dab('0x3e')](_0x6dab('0x40'),LISTID[_0x6dab('0x39')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x6dab('0x3e')](_0x6dab('0x41'),squel['select']()[_0x6dab('0x36')]('phone')[_0x6dab('0x3c')]('cm_hopper')[_0x6dab('0x3e')](_0xee6c7f+_0x6dab('0x42'),_0x83d7d7['id']['toString']())))[_0x6dab('0x39')]();return _0x2d3184;};var _0x20970c=function(_0x1a852f,_0x5b1964){var _0x5d50a0=squel[_0x6dab('0x30')]()['into'](_0x6dab('0x32'))['fromQuery'](['phone','scheduledAt',_0x6dab('0x38'),_0x6dab('0x24'),_0x5b1964,_0x6dab('0x3a'),'updatedAt'],squel[_0x6dab('0x35')]()[_0x6dab('0x36')](_0x6dab('0x37'),_0x6dab('0x37'))[_0x6dab('0x36')](_0x6dab('0x3b'),_0x6dab('0x33'))['field']('id',_0x6dab('0x38'))[_0x6dab('0x36')](LISTID['toString'](),'ListId')['field'](_0x1a852f['id'][_0x6dab('0x39')](),_0x5b1964)[_0x6dab('0x36')](_0x6dab('0x3b'),_0x6dab('0x3a'))[_0x6dab('0x36')]('NOW()',_0x6dab('0x34'))[_0x6dab('0x3c')](_0x6dab('0x3d'))[_0x6dab('0x3e')]('deletedAt\x20IS\x20NULL')['where'](_0x6dab('0x40'),LISTID[_0x6dab('0x39')]())['where'](_0x6dab('0x43'),squel[_0x6dab('0x44')](hopperContacts))[_0x6dab('0x3e')](_0x6dab('0x45'))[_0x6dab('0x3e')](_0x6dab('0x41'),squel[_0x6dab('0x35')]()[_0x6dab('0x36')](_0x6dab('0x46'))[_0x6dab('0x3c')](_0x6dab('0x47'))[_0x6dab('0x3e')](_0x5b1964+_0x6dab('0x42'),_0x1a852f['id']['toString']()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x6dab('0x36')]('phone')['from'](_0x6dab('0x32'))[_0x6dab('0x3e')](_0x5b1964+_0x6dab('0x42'),_0x1a852f['id'][_0x6dab('0x39')]())))[_0x6dab('0x39')]();return _0x5d50a0;};function _0x4fdac8(_0x28fe8e,_0x5072f3){var _0x11510c=squel[_0x6dab('0x30')]()['into'](_0x6dab('0x32'))[_0x6dab('0x48')]([_0x6dab('0x37'),_0x6dab('0x33'),'ContactId',_0x6dab('0x24'),_0x5072f3,_0x6dab('0x3a'),_0x6dab('0x34')],squel['select']()[_0x6dab('0x36')](_0x6dab('0x37'),'phone')[_0x6dab('0x36')]('NOW()',_0x6dab('0x33'))['field']('id',_0x6dab('0x38'))[_0x6dab('0x36')](LISTID[_0x6dab('0x39')](),_0x6dab('0x24'))[_0x6dab('0x36')](_0x28fe8e['id'][_0x6dab('0x39')](),_0x5072f3)[_0x6dab('0x36')](_0x6dab('0x3b'),_0x6dab('0x3a'))[_0x6dab('0x36')](_0x6dab('0x3b'),_0x6dab('0x34'))[_0x6dab('0x3c')](_0x6dab('0x3d'))[_0x6dab('0x3e')](_0x6dab('0x3f'))[_0x6dab('0x3e')]('ListId\x20=\x20?',LISTID[_0x6dab('0x39')]())[_0x6dab('0x3e')](_0x6dab('0x43'),squel[_0x6dab('0x44')](hopperContacts))[_0x6dab('0x3e')](_0x6dab('0x45')))[_0x6dab('0x39')]();return _0x11510c;}function _0x4dc390(_0x31de6c,_0x6ff631){var _0x39507f=squel[_0x6dab('0x30')]()[_0x6dab('0x31')](_0x6dab('0x49'))['fromQuery'](['phone',_0x6dab('0x38'),_0x6dab('0x24'),_0x6ff631,'createdAt',_0x6dab('0x34')],squel['select']()[_0x6dab('0x36')](_0x6dab('0x37'),_0x6dab('0x37'))[_0x6dab('0x36')]('id',_0x6dab('0x38'))[_0x6dab('0x36')](LISTID[_0x6dab('0x39')](),'ListId')[_0x6dab('0x36')](_0x31de6c['id'][_0x6dab('0x39')](),_0x6ff631)[_0x6dab('0x36')](_0x6dab('0x3b'),_0x6dab('0x3a'))[_0x6dab('0x36')](_0x6dab('0x3b'),_0x6dab('0x34'))[_0x6dab('0x3c')](_0x6dab('0x3d'))[_0x6dab('0x3e')](_0x6dab('0x3f'))[_0x6dab('0x3e')](_0x6dab('0x40'),LISTID[_0x6dab('0x39')]())[_0x6dab('0x3e')](_0x6dab('0x43'),squel['str'](hopperContacts))['where'](_0x6dab('0x45')))[_0x6dab('0x39')]();return _0x39507f;}return db[_0x6dab('0x4a')][_0x6dab('0x4b')]({'where':{'type':_0x6dab('0x4c')},'attributes':['id',_0x6dab('0x4d')],'include':[{'model':db['CmList'],'as':_0x6dab('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x3f4767){var _0x43bae9=[];if(_0x3f4767){var _0x1b3d7b;for(var _0x1368b5=0x0,_0x45a9ee;_0x1368b5<_0x3f4767[_0x6dab('0x26')];_0x1368b5+=0x1){_0x45a9ee=_0x3f4767[_0x1368b5][_0x6dab('0x4f')]({'plain':!![]});switch(_0x45a9ee[_0x6dab('0x4d')]){case _0x6dab('0x50'):_0x43bae9['push'](db[_0x6dab('0x51')][_0x6dab('0x52')](_0x20970c(_0x45a9ee,'VoiceQueueId'))['then'](function(){})[_0x6dab('0x2c')](_0x128ded()));break;case'onlyIfOpen':_0x43bae9['push'](db[_0x6dab('0x51')][_0x6dab('0x52')](_0x1b6610(_0x45a9ee,_0x6dab('0x53')))[_0x6dab('0x54')](function(){})['catch'](_0x128ded()));break;default:_0x43bae9[_0x6dab('0x55')](db[_0x6dab('0x51')][_0x6dab('0x52')](_0x4fdac8(_0x45a9ee,_0x6dab('0x53')))[_0x6dab('0x54')](function(){})[_0x6dab('0x2c')](_0x128ded()));}}}return _0x43bae9;})[_0x6dab('0x56')]()[_0x6dab('0x54')](function(){return db[_0x6dab('0x4a')][_0x6dab('0x4b')]({'where':{'type':_0x6dab('0x4c')},'attributes':['id'],'include':[{'model':db[_0x6dab('0x57')],'as':_0x6dab('0x58'),'where':{'id':LISTID}}]})[_0x6dab('0x54')](function(_0x1f7ab9){var _0x56f84b=[];if(_0x1f7ab9){var _0x1a194e;for(var _0x5d08f0=0x0,_0x308d2e;_0x5d08f0<_0x1f7ab9[_0x6dab('0x26')];_0x5d08f0+=0x1){_0x308d2e=_0x1f7ab9[_0x5d08f0][_0x6dab('0x4f')]({'plain':!![]});_0x56f84b[_0x6dab('0x55')](db[_0x6dab('0x51')]['query'](_0x4dc390(_0x308d2e,_0x6dab('0x53')))[_0x6dab('0x54')](function(){})[_0x6dab('0x2c')](_0x128ded()));}}return _0x56f84b;})[_0x6dab('0x56')]();})[_0x6dab('0x54')](function(){return db[_0x6dab('0x59')][_0x6dab('0x4b')]({'attributes':['id',_0x6dab('0x4d')],'include':[{'model':db['CmList'],'as':_0x6dab('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x55eb1c){var _0x187f32=[];if(_0x55eb1c){for(var _0x1a0a6d=0x0,_0x4c6b2e;_0x1a0a6d<_0x55eb1c['length'];_0x1a0a6d+=0x1){_0x4c6b2e=_0x55eb1c[_0x1a0a6d][_0x6dab('0x4f')]({'plain':!![]});switch(_0x4c6b2e[_0x6dab('0x4d')]){case _0x6dab('0x50'):_0x187f32['push'](db[_0x6dab('0x51')]['query'](_0x20970c(_0x4c6b2e,_0x6dab('0x5a')))[_0x6dab('0x54')](function(){})[_0x6dab('0x2c')](_0x128ded()));break;case _0x6dab('0x5b'):_0x187f32['push'](db[_0x6dab('0x51')][_0x6dab('0x52')](_0x1b6610(_0x4c6b2e,_0x6dab('0x5a')))[_0x6dab('0x54')](function(){})[_0x6dab('0x2c')](_0x128ded()));break;default:_0x187f32[_0x6dab('0x55')](db[_0x6dab('0x51')]['query'](_0x4fdac8(_0x4c6b2e,_0x6dab('0x5a')))[_0x6dab('0x54')](function(){})[_0x6dab('0x2c')](_0x128ded()));}}}return _0x187f32;})[_0x6dab('0x56')]();})['then'](function(){return db['Campaign'][_0x6dab('0x4b')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x6dab('0x58'),'where':{'id':LISTID}}]})[_0x6dab('0x54')](function(_0x14371a){var _0x5dd787=[];if(_0x14371a){for(var _0x4f64f7=0x0,_0x5ca913;_0x4f64f7<_0x14371a[_0x6dab('0x26')];_0x4f64f7+=0x1){_0x5ca913=_0x14371a[_0x4f64f7][_0x6dab('0x4f')]({'plain':!![]});_0x5dd787[_0x6dab('0x55')](db['sequelize'][_0x6dab('0x52')](_0x4dc390(_0x5ca913,'CampaignId'))['then'](function(){})['catch'](_0x128ded()));}}return _0x5dd787;})[_0x6dab('0x56')]();})['catch'](function(_0x26a097){logger[_0x6dab('0x13')](_0x6dab('0x5c'),_0x6dab('0x5d'),_0x26a097[_0x6dab('0x1b')]);});}var processPromises=function(_0x2304c3){return BPromise['all'](promises)[_0x6dab('0x54')](function(_0x518106){})['catch'](function(_0x46e7ba){logger[_0x6dab('0x13')](_0x6dab('0x5e'),JSON['stringify'](_0x46e7ba));})[_0x6dab('0x5f')](function(){socket[_0x6dab('0x60')](_0x6dab('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2304c3){return _0x2304c3[_0x6dab('0x62')]();}});};var endCsv=function(){return BPromise[_0x6dab('0x63')]()[_0x6dab('0x54')](function(){if(hopperContacts){return checkHopper();}})[_0x6dab('0x54')](function(){socket[_0x6dab('0x60')](_0x6dab('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x6dab('0x64')](FILEPATH);}catch(_0x45c1a8){logger[_0x6dab('0x13')](_0x6dab('0x65'),JSON[_0x6dab('0x2e')](_0x45c1a8));}finally{process[_0x6dab('0x66')](0x0);}});};process['on']('SIGINT',function(){logger[_0x6dab('0x67')](_0x6dab('0x68'));endCsv();});function main(){return BPromise[_0x6dab('0x63')]()[_0x6dab('0x54')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6dab('0x10')](',');return db[_0x6dab('0x29')][_0x6dab('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6dab('0x54')](function(_0x241526){var _0x1d82be=fs[_0x6dab('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x1d82be,{'header':!![],'skipEmptyLines':!![],'step':function(_0x37f0eb,_0x23ba74){total+=0x1;var _0x630b09=total;promises[_0x6dab('0x55')](checkRow(_0x37f0eb,_0x241526,_0x630b09)['then'](function(){success+=0x1;})[_0x6dab('0x2c')](function(_0x4bee63){if(_0x4bee63['error']){errors+=0x1;delete _0x4bee63[_0x6dab('0x13')];}else if(_0x4bee63[_0x6dab('0x6a')]){duplicates+=0x1;delete _0x4bee63[_0x6dab('0x6a')];}rows[_0x6dab('0x55')](_0x4bee63);}));if(total%0xc8===0x0){_0x23ba74[_0x6dab('0x6b')]();return processPromises(_0x23ba74);}},'complete':function(){return processPromises()[_0x6dab('0x54')](function(){logger[_0x6dab('0x67')](_0x6dab('0x6c'));endCsv();});},'error':function(_0x3790cd,_0x513b88){logger[_0x6dab('0x67')](_0x6dab('0x6d'),JSON[_0x6dab('0x2e')](_0x3790cd));endCsv();}});})[_0x6dab('0x2c')](function(_0x12423f){logger[_0x6dab('0x13')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x12423f));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index d44933d..01a143e 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 _0x1bb0=['campaigns_has_cm_blacklists','voice_queues_has_cm_lists','finish','affectedRows','unlink','arguments\x20\x20\x20','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','YYYY-MM-DD\x20HH:mm:ss','format','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','then','length','push','all','AdditionalPhones','split','isNil','filter','findOne','CmContactHasItem','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_contacts.ListId','cm_hopper_black','fromQuery','ContactId','ListId','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','\x22always\x22','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId','deletedAt\x20IS\x20NULL','MIN(id)','group','Received\x20SIGINT','error','message','exit','errors','code','info','sequelize','query','spread','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','catch','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','main','send','start','binding','clone','root','server/files/tmp','.csv','includes','header','name','_description','parse','data','find','hasOwnProperty','trim','isValid','isNaN','isNumber','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','replace','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId'];(function(_0x2e0dca,_0x45a901){var _0x31605b=function(_0x4dbb8a){while(--_0x4dbb8a){_0x2e0dca['push'](_0x2e0dca['shift']());}};_0x31605b(++_0x45a901);}(_0x1bb0,0xc9));var _0x01bb=function(_0x2abf9f,_0xe0fb28){_0x2abf9f=_0x2abf9f-0x0;var _0x22af19=_0x1bb0[_0x2abf9f];return _0x22af19;};'use strict';var fs=require('fs');var path=require(_0x01bb('0x0'));var _=require('lodash');var Papa=require(_0x01bb('0x1'));var util=require(_0x01bb('0x2'));var BPromise=require(_0x01bb('0x3'));var moment=require(_0x01bb('0x4'));var squel=require(_0x01bb('0x5'));var Redis=require(_0x01bb('0x6'));var db=require(_0x01bb('0x7'))['db'];var config=require(_0x01bb('0x8'));var shared=require('../../../config/environment/shared');var logger=require('../../../config/logger')(_0x01bb('0x9'));config[_0x01bb('0xa')]=_[_0x01bb('0xb')](config[_0x01bb('0xa')],{'host':_0x01bb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x01bb('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x01bb('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x01bb('0xe')](_0x01bb('0xd'));function isEmail(_0x5e6252){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'](_0x5e6252);}function selectNotIn(_0x40dca3,_0x159c6b,_0xc22278,_0x29101a,_0x5ab6eb){return squel[_0x01bb('0xf')]()[_0x01bb('0x10')](_0x01bb('0x11'))[_0x01bb('0x12')](_0x29101a)[_0x01bb('0x13')](_0x159c6b,null,_0x159c6b+_0x01bb('0x14')+_0x29101a+'.'+_0xc22278)[_0x01bb('0x15')](_0x29101a+'.'+_0xc22278+_0x01bb('0x16')+_0x40dca3+'.'+_0xc22278)[_0x01bb('0x15')](_0x159c6b+_0x01bb('0x17')+_0x5ab6eb[_0x01bb('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2f4731,_0x441a6a){promisesAdditionalPhones=[];return db[_0x01bb('0x18')]['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x01bb('0x19')](function(_0x530f4b){if(_0x530f4b!==null){var _0x4107e8=[];for(var _0x3ffb0e=0x0;_0x3ffb0e<_0x530f4b[_0x01bb('0x1a')];_0x3ffb0e++){var _0x4058f8=_0x530f4b[_0x3ffb0e];_0x4107e8[_0x01bb('0x1b')](insertAdditionalPhones(_0x4058f8));}}Promise[_0x01bb('0x1c')](_0x4107e8)['then'](function(){_0x2f4731({'val':0x1});});});});}function insertAdditionalPhones(_0x2ca802){return new Promise(function(_0x2342f7,_0x5422ff){var _0x38a681=_0x2ca802[_0x01bb('0x1d')];var _0x283736=_0x38a681[_0x01bb('0x1e')](';');var _0x306c16=[];orderBy=0x0;for(var _0x427387=0x0;_0x427387<_0x283736['length'];_0x427387++){_0x306c16[_0x01bb('0x1b')](splitAdditionalPhone(_0x2ca802['id'],_0x283736[_0x427387]));}Promise[_0x01bb('0x1c')](_0x306c16)[_0x01bb('0x19')](function(){_0x2342f7({'val':_0x283736[_0x01bb('0x1a')]});});});}function splitAdditionalPhone(_0x3953cd,_0x5388ee){return new Promise(function(_0x500488,_0x5318a4){var _0x4ea912=_0x5388ee[_0x01bb('0x1e')](':');var _0x56331e=_0x4ea912[0x0];var _0x1f214e=_0x4ea912[0x1];if(!_[_0x01bb('0x1f')](_0x1f214e)){var _0xc277ca=_0x1f214e['split']('|');var _0x1cceaa=[];for(var _0x1aa1c7=0x0;_0x1aa1c7<_0xc277ca['length'];_0x1aa1c7++){if(_0xc277ca[_0x1aa1c7]!==''){var _0x580fa4=_[_0x01bb('0x20')](promisesAdditionalPhones,{'contactId':_0x3953cd,'phone':_0xc277ca[_0x1aa1c7]});if(_0x580fa4[_0x01bb('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x3953cd,'contactTypeId':_0x56331e,'phone':_0xc277ca[_0x1aa1c7],'orderBy':orderBy});}}}_0x500488({'ok':0x1});}else _0x500488({'res':0x0});});}function createAdditionalPhone(_0x137fff,_0x1c6514,_0x347af4,_0x36813d){var _0x5a0887='';var _0x5551ab='';var _0x3680ef=_0x347af4[_0x01bb('0x1e')]('§');_0x5a0887=_0x3680ef[0x0];if(_0x3680ef[_0x01bb('0x1a')]==0x2)_0x5551ab=_0x3680ef[0x1];return new Promise(function(_0x17f7a1,_0x19fdd1){return db['CmContactHasItem'][_0x01bb('0x21')]({'where':{'CmContactId':_0x137fff,'item':_0x5a0887}})[_0x01bb('0x19')](function(_0xeb80ab){if(_0xeb80ab){return db[_0x01bb('0x22')][_0x01bb('0x23')]({'ItemTypeId':_0x1c6514,'description':_0x5551ab,'OrderBy':_0x36813d},{'where':{'CmContactId':_0x137fff,'item':_0x5a0887}})['then'](function(_0x4f76d1){_0x17f7a1({'res':'updated'});});}else{return db[_0x01bb('0x22')][_0x01bb('0x24')]({'CmContactId':_0x137fff,'item':_0x5a0887,'description':_0x5551ab,'ItemTypeId':_0x1c6514,'OrderBy':_0x36813d,'ItemClass':_0x01bb('0x25')})['then'](function(_0x1747a6){_0x17f7a1({'res':_0x01bb('0x26')});});}});});}function insertCmHopper(_0x434dc5,_0x3dc422,_0x2386ca,_0x326073,_0x3be297){var _0x724e7a=[_0x01bb('0x27'),_0x01bb('0x28'),'cm_contacts.id','cm_contacts.ListId',_0x3dc422+'.'+_0x326073,_0x01bb('0x29'),_0x01bb('0x2a'),_0x01bb('0x2b'),_0x01bb('0x2c'),'\x22'+_0x3be297+'\x22'];return squel[_0x01bb('0x2d')]()[_0x01bb('0x2e')](_0x01bb('0x2f'))['fromQuery']([_0x01bb('0x11'),_0x01bb('0x30'),'ContactId','ListId',_0x326073,_0x01bb('0x31'),_0x01bb('0x32'),_0x01bb('0x33'),_0x01bb('0x34'),_0x01bb('0x35')],squel[_0x01bb('0xf')]()[_0x01bb('0x36')](_0x724e7a)[_0x01bb('0x12')](_0x3dc422)['join'](_0x01bb('0x37'),null,_0x01bb('0x38')+_0x3dc422+_0x01bb('0x39'))[_0x01bb('0x13')](_0x2386ca,null,_0x2386ca+_0x01bb('0x14')+_0x3dc422+'.'+_0x326073)[_0x01bb('0x15')](_0x3dc422+_0x01bb('0x3a'),_0x434dc5)[_0x01bb('0x15')](_0x01bb('0x3b'),NOW)[_0x01bb('0x15')](_0x01bb('0x3c'),selectNotIn(_0x3dc422,_0x2386ca,_0x326073,_0x01bb('0x2f'),['\x22always\x22',_0x01bb('0x3d')]))[_0x01bb('0x15')](_0x01bb('0x3c'),selectNotIn(_0x3dc422,_0x2386ca,_0x326073,_0x01bb('0x2f'),['\x22always\x22'])))[_0x01bb('0x3e')]();}function insertCmHopperBlack(_0x4af544,_0x5be73b,_0xcaa154,_0x490a33){var _0x3c2e71=['cm_contacts.phone',_0x01bb('0x3f'),_0x01bb('0x40'),_0x5be73b+'.'+_0x490a33,'cm_contacts.createdAt',_0x01bb('0x2a')];return squel[_0x01bb('0x2d')]()[_0x01bb('0x2e')](_0x01bb('0x41'))[_0x01bb('0x42')]([_0x01bb('0x11'),_0x01bb('0x43'),_0x01bb('0x44'),_0x490a33,'createdAt',_0x01bb('0x32')],squel[_0x01bb('0xf')]()['fields'](_0x3c2e71)[_0x01bb('0x12')](_0x5be73b)[_0x01bb('0x13')](_0x01bb('0x37'),null,_0x01bb('0x38')+_0x5be73b+_0x01bb('0x39'))['join'](_0xcaa154,null,_0xcaa154+_0x01bb('0x14')+_0x5be73b+'.'+_0x490a33)[_0x01bb('0x15')](_0x5be73b+_0x01bb('0x3a'),_0x4af544)[_0x01bb('0x15')](_0x01bb('0x3b'),NOW)[_0x01bb('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x01bb('0xf')]()['field']('phone')[_0x01bb('0x12')](_0x01bb('0x41'))[_0x01bb('0x15')](_0x01bb('0x45'),_0x4af544)[_0x01bb('0x15')](_0x490a33+_0x01bb('0x16')+_0x5be73b+'.'+_0x490a33)))['toString']();}function insertTzCmHopper(_0x214f4a,_0x5dce34,_0x5911c6,_0x5bce7d,_0x11708f,_0x568f33){var _0x333868=[_0x01bb('0x27'),_0x01bb('0x46')+_0x568f33+_0x01bb('0x47'),_0x01bb('0x3f'),'cm_contacts.ListId',_0x5dce34+'.'+_0x5bce7d,_0x01bb('0x29'),_0x01bb('0x2a'),_0x01bb('0x2b'),'cm_contacts.UserId','\x22'+_0x11708f+'\x22'];var _0x106b11=squel['insert']()[_0x01bb('0x2e')](_0x01bb('0x2f'))[_0x01bb('0x42')]([_0x01bb('0x11'),_0x01bb('0x30'),_0x01bb('0x43'),_0x01bb('0x44'),_0x5bce7d,_0x01bb('0x31'),_0x01bb('0x32'),_0x01bb('0x33'),'UserId',_0x01bb('0x35')],squel['select']()[_0x01bb('0x36')](_0x333868)[_0x01bb('0x12')](_0x5dce34)[_0x01bb('0x13')]('cm_contacts',null,_0x01bb('0x38')+_0x5dce34+_0x01bb('0x39'))[_0x01bb('0x13')](_0x5911c6,null,_0x5911c6+_0x01bb('0x14')+_0x5dce34+'.'+_0x5bce7d)[_0x01bb('0x13')](_0x568f33,null,_0x568f33+_0x01bb('0x14')+_0x5dce34+'.'+_0x5bce7d)[_0x01bb('0x15')](_0x5dce34+_0x01bb('0x3a'),_0x214f4a)[_0x01bb('0x15')](_0x01bb('0x3b'),NOW)[_0x01bb('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5dce34,_0x5911c6,_0x5bce7d,_0x01bb('0x2f'),[_0x01bb('0x48'),'\x22onlyIfOpen\x22']))['where'](_0x01bb('0x3c'),selectNotIn(_0x5dce34,_0x5911c6,_0x5bce7d,_0x01bb('0x2f'),[_0x01bb('0x48')])))[_0x01bb('0x3e')]();return _0x106b11;}function insertTzCmHopperBlack(_0x485401,_0x1744cb,_0x551758,_0x30df10){var _0x48882c=[_0x01bb('0x27'),_0x01bb('0x3f'),_0x01bb('0x40'),_0x1744cb+'.'+_0x30df10,_0x01bb('0x29'),_0x01bb('0x2a')];return squel['insert']()[_0x01bb('0x2e')](_0x01bb('0x41'))[_0x01bb('0x42')](['phone',_0x01bb('0x43'),'ListId',_0x30df10,'createdAt',_0x01bb('0x32')],squel[_0x01bb('0xf')]()[_0x01bb('0x36')](_0x48882c)[_0x01bb('0x12')](_0x1744cb)[_0x01bb('0x13')]('cm_contacts',null,_0x01bb('0x38')+_0x1744cb+_0x01bb('0x39'))[_0x01bb('0x13')](_0x551758,null,_0x551758+_0x01bb('0x14')+_0x1744cb+'.'+_0x30df10)[_0x01bb('0x15')](_0x1744cb+_0x01bb('0x3a'),_0x485401)[_0x01bb('0x15')](_0x01bb('0x3b'),NOW)['where'](_0x01bb('0x3c'),squel[_0x01bb('0xf')]()[_0x01bb('0x10')]('phone')[_0x01bb('0x12')](_0x01bb('0x41'))['where'](_0x01bb('0x45'),_0x485401)[_0x01bb('0x15')](_0x30df10+'\x20=\x20'+_0x1744cb+'.'+_0x30df10)))[_0x01bb('0x3e')]();}function insertCmHopperAdditionalPhones(_0x57b292){var _0x44637a=[_0x01bb('0x49'),_0x01bb('0x4a'),_0x01bb('0x4b'),_0x01bb('0x4c'),_0x01bb('0x4d')];return squel['insert']()[_0x01bb('0x2e')](_0x01bb('0x4e'))[_0x01bb('0x42')]([_0x01bb('0x4f'),'phone',_0x01bb('0x50'),_0x01bb('0x31'),_0x01bb('0x32')],squel['select']()[_0x01bb('0x36')](_0x44637a)['from'](_0x01bb('0x2f'))[_0x01bb('0x13')](_0x01bb('0x37'),null,_0x01bb('0x51'))[_0x01bb('0x13')](_0x01bb('0x52'),null,_0x01bb('0x53'))[_0x01bb('0x15')](_0x01bb('0x54'),_0x57b292)[_0x01bb('0x15')](_0x01bb('0x3b'),NOW))[_0x01bb('0x3e')]();}function insertCmContact(_0x1e11f8,_0x36495e,_0x47cdde,_0x2ca6c6){var _0x45ee05=_['concat'](_[_0x01bb('0x55')](_0x2ca6c6),[_0x01bb('0x44'),_0x01bb('0x56'),'createdAt',_0x01bb('0x32')]);return squel[_0x01bb('0x2d')]()[_0x01bb('0x2e')](_0x01bb('0x37'))[_0x01bb('0x42')](_0x45ee05,squel['select']()['fields'](_0x45ee05)[_0x01bb('0x12')](_0x36495e)[_0x01bb('0x15')]('('+_0x47cdde[_0x01bb('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0x01bb('0xf')]()[_0x01bb('0x36')](_0x47cdde)['from'](_0x01bb('0x37'))[_0x01bb('0x15')](_0x01bb('0x45'),_0x1e11f8)[_0x01bb('0x15')](_0x01bb('0x57')))['where']('id\x20IN\x20?',squel[_0x01bb('0xf')]()['field'](_0x01bb('0x58'),'min_id')['from'](_0x36495e)[_0x01bb('0x59')](_0x47cdde[_0x01bb('0x13')](','))))[_0x01bb('0x3e')]();}function handleStop(){logger['info'](_0x01bb('0x5a'));stopped=!![];}function handleUncaughtException(_0x55f87b){logger[_0x01bb('0x5b')](_0x55f87b[_0x01bb('0x5c')]);process[_0x01bb('0x5d')](0x1);}function handleError(_0x3a3c71,_0x457815){stats[_0x01bb('0x5e')][_0x01bb('0x1b')]({'name':_0x457815[_0x01bb('0x5f')],'message':_0x457815['message'],'row':_0x3a3c71});}function handleQuery(_0x2b5ab6){logger[_0x01bb('0x60')](_0x2b5ab6);return db[_0x01bb('0x61')][_0x01bb('0x62')](_0x2b5ab6)[_0x01bb('0x63')](function(_0x2d2fb5){results[_0x01bb('0x1b')](_0x2d2fb5);})['catch'](function(_0x3dd9d8){logger[_0x01bb('0x5b')](_0x3dd9d8['message']);});}function updateTzCampaigns(_0x9c475a){return new Promise(function(_0x4ea7c2,_0x323e58){var _0x1513c3=squel[_0x01bb('0xf')]()['fields']([_0x01bb('0x64'),'campaigns.dialTimezone'])[_0x01bb('0x12')](_0x01bb('0x65'))[_0x01bb('0x13')](_0x01bb('0x66'),null,_0x01bb('0x67'))[_0x01bb('0x15')](_0x01bb('0x68')+_0x9c475a);db[_0x01bb('0x61')][_0x01bb('0x62')](_0x1513c3[_0x01bb('0x3e')]())[_0x01bb('0x63')](function(_0x39d772){var _0x2eb4a6=[];for(var _0x4b2235=0x0;_0x4b2235<_0x39d772['length'];_0x4b2235++){_0x2eb4a6[_0x01bb('0x1b')](getTimezoneData(_0x39d772[_0x4b2235],tmp_campaigns));}BPromise[_0x01bb('0x1c')](_0x2eb4a6)[_0x01bb('0x19')](function(){_0x4ea7c2({'val':0x1});});})[_0x01bb('0x69')](function(_0x42c78e){logger[_0x01bb('0x5b')](_0x42c78e[_0x01bb('0x5c')]);_0x4ea7c2({'val':0x0});});});}function updateTzVoiceQueues(_0x3d2574){return new Promise(function(_0x215190,_0x47080a){var _0xeb0b1f=squel[_0x01bb('0xf')]()[_0x01bb('0x36')](['voice_queues.id','voice_queues.dialTimezone'])[_0x01bb('0x12')](_0x01bb('0x6a'))['join']('voice_queues_has_cm_lists',null,_0x01bb('0x6b'))[_0x01bb('0x15')](_0x01bb('0x6c')+_0x3d2574);db[_0x01bb('0x61')][_0x01bb('0x62')](_0xeb0b1f[_0x01bb('0x3e')]())[_0x01bb('0x63')](function(_0x83c899){var _0x1cc43b=[];for(var _0x29cc90=0x0;_0x29cc90<_0x83c899[_0x01bb('0x1a')];_0x29cc90++){_0x1cc43b[_0x01bb('0x1b')](getTimezoneData(_0x83c899[_0x29cc90],tmp_voice_queues));}BPromise[_0x01bb('0x1c')](_0x1cc43b)[_0x01bb('0x19')](function(){_0x215190({'val':0x1});});})['catch'](function(_0x23beab){logger['error'](_0x23beab[_0x01bb('0x5c')]);_0x215190({'val':0x0});});});}function getTimezoneData(_0x296814,_0x2b72a1){return new Promise(function(_0x2e435d,_0x150bcd){var _0x4623a9=shared[_0x01bb('0x6d')];var _0x2cc0b8=_0x4623a9[_0x296814[_0x01bb('0x6e')]];if(_[_0x01bb('0x1f')](_0x2cc0b8)){_0x2e435d({'ret':0x1});}else{var _0x4313b1=_0x2cc0b8[_0x01bb('0x6f')];var _0x4943ae=squel['insert']()[_0x01bb('0x2e')](_0x2b72a1)[_0x01bb('0x70')]('id',_0x296814['id'])['set'](_0x01bb('0x71'),_0x4313b1)['set']('dialTimezone',_0x296814[_0x01bb('0x6e')])[_0x01bb('0x3e')]();return db[_0x01bb('0x61')][_0x01bb('0x62')](_0x4943ae)[_0x01bb('0x63')](function(_0x15bfd0){_0x2e435d({'ret':0x1});})[_0x01bb('0x69')](function(_0x9c116f){logger[_0x01bb('0x5b')](_0x9c116f[_0x01bb('0x5c')]);_0x150bcd({'ret':0x1});});}});}function handleTZQuery(_0x20450c){logger[_0x01bb('0x60')](_0x20450c);return db[_0x01bb('0x61')][_0x01bb('0x62')](_0x20450c)['spread'](function(_0x383d0b){})['catch'](function(_0x4d9286){logger['error'](_0x4d9286[_0x01bb('0x5c')]);});}function main(_0xaccb95,_0x712769,_0x5b75a5,_0x5ab8ca){logger[_0x01bb('0x60')](_0x01bb('0x72'),_0xaccb95,JSON['stringify'](_0x712769));process[_0x01bb('0x73')](_0x01bb('0x74'));var _0x8efa23=_0x712769[_0x01bb('0x75')];var _0x186dfb=_[_0x01bb('0x76')](_0x8efa23);var _0x1ec603=_0x712769['socket_timestamp'];var _0x5b0921=path[_0x01bb('0x13')](config[_0x01bb('0x77')],_0x01bb('0x78'),_0x1ec603+_0x01bb('0x79'));hasTZ=_[_0x01bb('0x55')](_0x8efa23)[_0x01bb('0x7a')](_0x01bb('0x6e'));var _0x1ef011=_['keys'](_0x8efa23)[_0x01bb('0x13')]();logger[_0x01bb('0x60')](_0x01bb('0x7b'),_0x1ef011);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x01bb('0x7c')]})[_0x01bb('0x19')](function(_0x29aa46){for(var _0x5d8e80=0x0;_0x5d8e80<_0x29aa46[_0x01bb('0x1a')];_0x5d8e80++){if(_0x29aa46[_0x5d8e80][_0x01bb('0x7c')]in _0x8efa23){contactItemTypes[_0x01bb('0x1b')](_0x29aa46[_0x5d8e80]);delete _0x186dfb[_0x29aa46[_0x5d8e80][_0x01bb('0x7c')]];hasAdditionalPhones=!![];}for(var _0x50be33 in _0x8efa23){if(_0x29aa46[_0x5d8e80][_0x01bb('0x7c')]+_0x01bb('0x7d')===_0x50be33){phoneDescriptions[_0x01bb('0x1b')]({'itemTypeId':_0x29aa46[_0x5d8e80]['id'],'description':_0x50be33});delete _0x186dfb[_0x50be33];}}}if(hasAdditionalPhones)_0x186dfb[_0x01bb('0x1d')]='';var _0x59e110=_[_0x01bb('0x55')](_0x186dfb)[_0x01bb('0x13')]();logger['info']('header',_0x59e110);fs['writeFileSync'](_0x5b0921,_0x59e110+'\x0a');Papa[_0x01bb('0x7e')](fs['createReadStream'](_0xaccb95),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1ff182,_0x32740f){try{for(var _0x3a1699=0x0,_0x22485f=[];_0x3a1699<_0x1ff182[_0x01bb('0x7f')][_0x01bb('0x1a')];_0x3a1699++){stats['rows']+=0x1;if(_0x1ff182[_0x01bb('0x5e')][_0x3a1699]){handleError(_0x1ff182[_0x01bb('0x7f')][_0x3a1699],_0x1ff182[_0x01bb('0x5e')][_0x3a1699]);}else{var _0x431f3c=[];var _0x4677da=[];var _0x2d6b75={};for(var _0x4adedd in _0x8efa23){let _0x5003e2=contactItemTypes[_0x01bb('0x80')](_0x5e422e=>_0x5e422e['name']===_0x4adedd);let _0x120fc0=contactItemTypes[_0x01bb('0x80')](_0x1c285d=>_0x1c285d[_0x01bb('0x7c')]+'_description'===_0x4adedd);if(_[_0x01bb('0x1f')](_0x5003e2)&&_['isNil'](_0x120fc0)){if(_0x8efa23[_0x01bb('0x81')](_0x4adedd)){if(_0x1ff182[_0x01bb('0x7f')][_0x3a1699][_0x8efa23[_0x4adedd]]){var _0x1f1cf4=_[_0x01bb('0x82')](_0x1ff182[_0x01bb('0x7f')][_0x3a1699][_0x8efa23[_0x4adedd]]['replace'](/"/g,'\x27'));switch(_0x4adedd){case _0x01bb('0x30'):var _0x2bb7d4=moment(_0x1f1cf4,_0x01bb('0xd'),!![]);if(_0x2bb7d4[_0x01bb('0x83')]()){_0x22485f[_0x01bb('0x1b')]('\x22'+_0x1f1cf4+'\x22');}else{_0x431f3c['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x17afb9=parseInt(_0x1f1cf4);_0x1f1cf4=_[_0x01bb('0x84')](_0x17afb9)||_0x17afb9<0x0||_0x17afb9>0x4?_0x5ab8ca?0x3:0x2:_0x17afb9;_0x22485f[_0x01bb('0x1b')]('\x22'+_0x1f1cf4+'\x22');break;case _0x01bb('0x34'):var _0xb00daf=parseInt(_0x1f1cf4);if(_[_0x01bb('0x85')](_0xb00daf)&&_['includes'](_0x5b75a5,_0xb00daf)){_0x22485f[_0x01bb('0x1b')]('\x22'+_0xb00daf+'\x22');}else{_0x431f3c['push']('agent\x20not\x20exists');}break;case _0x01bb('0x86'):if(isEmail(_0x1f1cf4)){_0x22485f[_0x01bb('0x1b')]('\x22'+_0x1f1cf4+'\x22');}else{_0x431f3c['push'](_0x01bb('0x87'));}break;case _0x01bb('0x88'):var _0x58b205=moment(_0x1f1cf4,'YYYY-MM-DD',!![]);if(_0x58b205[_0x01bb('0x83')]()){_0x22485f[_0x01bb('0x1b')]('\x22'+_0x1f1cf4+'\x22');}else{_0x431f3c['push'](_0x01bb('0x89'));}break;case _0x01bb('0x6e'):var _0x5bb8e2=shared[_0x01bb('0x6d')];var _0x35d9e1=_0x5bb8e2[_0x1f1cf4];if(!_[_0x01bb('0x1f')](_0x35d9e1)){var _0x13cc7f=_0x35d9e1['utcOffset'];_0x22485f['push']('\x22'+_0x1f1cf4+'\x22');_0x22485f[_0x01bb('0x1b')]('\x22'+_0x13cc7f+'\x22');}break;default:_0x22485f[_0x01bb('0x1b')]('\x22'+_0x1f1cf4+'\x22');}}else{switch(_0x4adedd){case _0x01bb('0x8a'):case _0x01bb('0x11'):_0x431f3c[_0x01bb('0x1b')](_0x4adedd+_0x01bb('0x8b'));break;default:_0x22485f['push']('\x22\x22');}}}}else{var _0x555768='';if(!_[_0x01bb('0x1f')](_0x5003e2)){if(!_0x2d6b75[_0x01bb('0x81')](_0x5003e2['id'])){if(!_[_0x01bb('0x1f')](_0x1ff182[_0x01bb('0x7f')][_0x3a1699][_0x8efa23[_0x4adedd]])){var _0x1f1cf4=_[_0x01bb('0x82')](_0x1ff182['data'][_0x3a1699][_0x8efa23[_0x4adedd]][_0x01bb('0x8c')](/"/g,'\x27'));var _0x50249e=phoneDescriptions[_0x01bb('0x80')](_0x22f1dd=>_0x22f1dd[_0x01bb('0x8d')]===_0x5003e2['id']);if(!_[_0x01bb('0x1f')](_0x50249e)){var _0x26097c=_[_0x01bb('0x82')](_0x1ff182[_0x01bb('0x7f')][_0x3a1699][_0x8efa23[_0x50249e[_0x01bb('0x8e')]]][_0x01bb('0x8c')](/"/g,'\x27'));if(!_[_0x01bb('0x1f')](_0x26097c))_0x1f1cf4=_0x1f1cf4+'§'+_0x26097c;}if(_0x555768=='')_0x555768=_0x1f1cf4;else _0x555768+='|'+_0x1f1cf4;}_0x4677da[_0x01bb('0x1b')](_0x5003e2['id']+':'+_0x555768);_0x2d6b75[_0x5003e2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x22485f[_0x01bb('0x1b')]('\x22'+_0x4677da[_0x01bb('0x13')](';')+'\x22');}if(_0x431f3c['length']){handleError(_0x1ff182['data'][_0x3a1699],{'code':_0x01bb('0x8f'),'message':_0x431f3c[_0x01bb('0x13')]()});}else{fs[_0x01bb('0x90')](_0x5b0921,_0x22485f['join']()+'\x0a');}_0x22485f=[];}if(!(stats['rows']%0xc8)){socket[_0x01bb('0x91')](_0x01bb('0x92')+_0x1ec603,stats);stats[_0x01bb('0x5e')]=[];}}if(stopped){logger[_0x01bb('0x60')](_0x01bb('0x93'));_0x32740f[_0x01bb('0x94')]();}}catch(_0x5bc76d){handleError(_0x1ff182[_0x01bb('0x7f')][_0x3a1699],{'code':_0x01bb('0x95'),'message':_0x5bc76d[_0x01bb('0x5c')]});logger[_0x01bb('0x5b')](_0x01bb('0x96'),_0x5bc76d[_0x01bb('0x5c')]);}},'complete':function(){try{var _0x102f2b=[];var _0x655386=[];var _0x184e54=_0x01bb('0x37');if(_0x712769[_0x01bb('0x97')]&&_0x712769['duplicates'][_0x01bb('0x1a')]){_0x184e54=_0x01bb('0x98')+_0x1ec603;_0x102f2b[_0x01bb('0x1b')]('CREATE\x20TABLE\x20'+_0x184e54+_0x01bb('0x99'));}tmp_campaigns=_0x01bb('0x9a')+_0x1ec603;tmp_voice_queues=_0x01bb('0x9b')+_0x1ec603;_0x655386[_0x01bb('0x1b')](_0x01bb('0x9c')+tmp_campaigns+_0x01bb('0x9d'));_0x655386[_0x01bb('0x1b')](_0x01bb('0x9c')+tmp_voice_queues+_0x01bb('0x9d'));BPromise[_0x01bb('0x9e')](_0x655386,handleTZQuery)[_0x01bb('0x19')](function(_0x111bff){updateTzCampaigns(_0x712769[_0x01bb('0x44')])[_0x01bb('0x19')](function(_0x4ec625){updateTzVoiceQueues(_0x712769[_0x01bb('0x44')])[_0x01bb('0x19')](function(_0x2d0653){if(hasTZ)_0x59e110=_0x59e110[_0x01bb('0x8c')](_0x01bb('0x6e'),'dialTimezone,utcOffset');var _0x251fc8=util[_0x01bb('0xe')](_0x01bb('0x9f'),_0x5b0921,_0x184e54,_0x59e110,_0x712769['ListId'],_0x712769['CompanyId']||null,NOW,NOW);if(_[_0x01bb('0x1f')](_0x8efa23['scheduledat'])){_0x251fc8+=_0x01bb('0xa0');}_0x102f2b['push'](_0x251fc8);if(_0x712769[_0x01bb('0x97')]&&_0x712769['duplicates'][_0x01bb('0x1a')]){_0x102f2b[_0x01bb('0x1b')](insertCmContact(_0x712769[_0x01bb('0x44')],_0x184e54,_0x712769['duplicates'],_0x8efa23));_0x102f2b[_0x01bb('0x1b')](_0x01bb('0xa1')+_0x184e54+';');}BPromise[_0x01bb('0x9e')](_0x102f2b,handleQuery)[_0x01bb('0x19')](function(_0x2d399a){BPromise['all']([handleAdditionalPhones()])[_0x01bb('0x19')](function(){_0x102f2b=[];for(var _0x26af1b=0x0;_0x26af1b\x20\x20'];(function(_0x30a604,_0x243139){var _0x4d918b=function(_0x4353f6){while(--_0x4353f6){_0x30a604['push'](_0x30a604['shift']());}};_0x4d918b(++_0x243139);}(_0x502a,0xb5));var _0xa502=function(_0x59fea3,_0x340c0d){_0x59fea3=_0x59fea3-0x0;var _0x5ea398=_0x502a[_0x59fea3];return _0x5ea398;};'use strict';var fs=require('fs');var path=require(_0xa502('0x0'));var _=require(_0xa502('0x1'));var Papa=require(_0xa502('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0xa502('0x3'));var squel=require(_0xa502('0x4'));var Redis=require(_0xa502('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xa502('0x6'));var shared=require(_0xa502('0x7'));var logger=require('../../../config/logger')('import');config[_0xa502('0x8')]=_['defaults'](config['redis'],{'host':_0xa502('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa502('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xa502('0xa'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xa502('0xb')](_0xa502('0xa'));function isEmail(_0x896461){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'](_0x896461);}function selectNotIn(_0xe3e3d,_0x36671f,_0x49c120,_0x2b0259,_0x4cc5dc){return squel[_0xa502('0xc')]()[_0xa502('0xd')]('phone')[_0xa502('0xe')](_0x2b0259)[_0xa502('0xf')](_0x36671f,null,_0x36671f+_0xa502('0x10')+_0x2b0259+'.'+_0x49c120)['where'](_0x2b0259+'.'+_0x49c120+_0xa502('0x11')+_0xe3e3d+'.'+_0x49c120)['where'](_0x36671f+'.dialCheckDuplicateType\x20IN\x20('+_0x4cc5dc['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x33e8ff,_0x31c340){promisesAdditionalPhones=[];return db['CmContact'][_0xa502('0x12')]({'raw':!![],'attributes':['id',_0xa502('0x13')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xa502('0x14')](function(_0x36c18f){if(_0x36c18f!==null){var _0x571806=[];for(var _0x52d0bd=0x0;_0x52d0bd<_0x36c18f[_0xa502('0x15')];_0x52d0bd++){var _0x356ebe=_0x36c18f[_0x52d0bd];_0x571806[_0xa502('0x16')](insertAdditionalPhones(_0x356ebe));}}Promise['all'](_0x571806)[_0xa502('0x14')](function(){_0x33e8ff({'val':0x1});});});});}function insertAdditionalPhones(_0x505cba){return new Promise(function(_0x421cc9,_0x21f339){var _0x22b015=_0x505cba[_0xa502('0x13')];var _0x379e7f=_0x22b015['split'](';');var _0xdb7535=[];orderBy=0x0;for(var _0x5368db=0x0;_0x5368db<_0x379e7f[_0xa502('0x15')];_0x5368db++){_0xdb7535['push'](splitAdditionalPhone(_0x505cba['id'],_0x379e7f[_0x5368db]));}Promise[_0xa502('0x17')](_0xdb7535)[_0xa502('0x14')](function(){_0x421cc9({'val':_0x379e7f['length']});});});}function splitAdditionalPhone(_0x1f56dd,_0x18b9be){return new Promise(function(_0x4c0f21,_0x4b4a6d){var _0x46a9a0=_0x18b9be[_0xa502('0x18')](':');var _0x145b66=_0x46a9a0[0x0];var _0x46f227=_0x46a9a0[0x1];if(!_['isNil'](_0x46f227)){var _0x163b8d=_0x46f227[_0xa502('0x18')]('|');var _0x2607dd=[];for(var _0x34428d=0x0;_0x34428d<_0x163b8d[_0xa502('0x15')];_0x34428d++){if(_0x163b8d[_0x34428d]!==''){var _0x2eb46c=_[_0xa502('0x19')](promisesAdditionalPhones,{'contactId':_0x1f56dd,'phone':_0x163b8d[_0x34428d]});if(_0x2eb46c['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x1f56dd,'contactTypeId':_0x145b66,'phone':_0x163b8d[_0x34428d],'orderBy':orderBy});}}}_0x4c0f21({'ok':0x1});}else _0x4c0f21({'res':0x0});});}function createAdditionalPhone(_0x10cdaf,_0x572f45,_0x34f7e6,_0x477c43){var _0x457ee0='';var _0x495420='';var _0x184eae=_0x34f7e6[_0xa502('0x18')]('§');_0x457ee0=_0x184eae[0x0];if(_0x184eae[_0xa502('0x15')]==0x2)_0x495420=_0x184eae[0x1];return new Promise(function(_0x19a3b4,_0x5489df){return db[_0xa502('0x1a')]['findOne']({'where':{'CmContactId':_0x10cdaf,'item':_0x457ee0}})[_0xa502('0x14')](function(_0x370a1d){if(_0x370a1d){return db['CmContactHasItem']['update']({'ItemTypeId':_0x572f45,'description':_0x495420,'OrderBy':_0x477c43},{'where':{'CmContactId':_0x10cdaf,'item':_0x457ee0}})[_0xa502('0x14')](function(_0x5363d3){_0x19a3b4({'res':_0xa502('0x1b')});});}else{return db[_0xa502('0x1a')][_0xa502('0x1c')]({'CmContactId':_0x10cdaf,'item':_0x457ee0,'description':_0x495420,'ItemTypeId':_0x572f45,'OrderBy':_0x477c43,'ItemClass':'PHONE'})['then'](function(_0x3cb2d9){_0x19a3b4({'res':_0xa502('0x1d')});});}});});}function insertCmHopper(_0x3e5cf6,_0x241622,_0xd232f0,_0x1fb2ea,_0x429468){var _0x4225fe=[_0xa502('0x1e'),'cm_contacts.scheduledat','cm_contacts.id',_0xa502('0x1f'),_0x241622+'.'+_0x1fb2ea,'cm_contacts.createdAt',_0xa502('0x20'),_0xa502('0x21'),_0xa502('0x22'),'\x22'+_0x429468+'\x22'];return squel[_0xa502('0x23')]()[_0xa502('0x24')](_0xa502('0x25'))[_0xa502('0x26')](['phone',_0xa502('0x27'),_0xa502('0x28'),_0xa502('0x29'),_0x1fb2ea,'createdAt',_0xa502('0x2a'),_0xa502('0x2b'),_0xa502('0x2c'),'recallme'],squel[_0xa502('0xc')]()[_0xa502('0x2d')](_0x4225fe)[_0xa502('0xe')](_0x241622)[_0xa502('0xf')](_0xa502('0x2e'),null,'cm_contacts.ListId\x20=\x20'+_0x241622+'.CmListId')[_0xa502('0xf')](_0xd232f0,null,_0xd232f0+_0xa502('0x10')+_0x241622+'.'+_0x1fb2ea)[_0xa502('0x2f')](_0x241622+'.CmListId\x20=\x20?',_0x3e5cf6)[_0xa502('0x2f')](_0xa502('0x30'),NOW)[_0xa502('0x2f')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x241622,_0xd232f0,_0x1fb2ea,_0xa502('0x25'),['\x22always\x22',_0xa502('0x31')]))[_0xa502('0x2f')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x241622,_0xd232f0,_0x1fb2ea,_0xa502('0x25'),[_0xa502('0x32')])))[_0xa502('0x33')]();}function insertCmHopperBlack(_0x127b70,_0x175757,_0x476d3d,_0xedd482){var _0x49567d=[_0xa502('0x1e'),_0xa502('0x34'),_0xa502('0x1f'),_0x175757+'.'+_0xedd482,_0xa502('0x35'),_0xa502('0x20')];return squel[_0xa502('0x23')]()[_0xa502('0x24')]('cm_hopper_black')[_0xa502('0x26')]([_0xa502('0x36'),_0xa502('0x28'),_0xa502('0x29'),_0xedd482,_0xa502('0x37'),_0xa502('0x2a')],squel[_0xa502('0xc')]()[_0xa502('0x2d')](_0x49567d)[_0xa502('0xe')](_0x175757)[_0xa502('0xf')](_0xa502('0x2e'),null,_0xa502('0x38')+_0x175757+_0xa502('0x39'))[_0xa502('0xf')](_0x476d3d,null,_0x476d3d+_0xa502('0x10')+_0x175757+'.'+_0xedd482)[_0xa502('0x2f')](_0x175757+_0xa502('0x3a'),_0x127b70)[_0xa502('0x2f')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xa502('0x2f')](_0xa502('0x3b'),squel['select']()[_0xa502('0xd')](_0xa502('0x36'))['from'](_0xa502('0x3c'))[_0xa502('0x2f')]('ListId\x20=\x20?',_0x127b70)[_0xa502('0x2f')](_0xedd482+'\x20=\x20'+_0x175757+'.'+_0xedd482)))['toString']();}function insertTzCmHopper(_0x2ce644,_0x1a630b,_0x4cec0a,_0x3c9685,_0x16c8cf,_0x4e1328){var _0x228d5f=['cm_contacts.phone',_0xa502('0x3d')+_0x4e1328+'.offset-cm_contacts.utcOffset\x20minute)',_0xa502('0x34'),_0xa502('0x1f'),_0x1a630b+'.'+_0x3c9685,_0xa502('0x35'),_0xa502('0x20'),_0xa502('0x21'),_0xa502('0x22'),'\x22'+_0x16c8cf+'\x22'];var _0x8955e=squel[_0xa502('0x23')]()[_0xa502('0x24')](_0xa502('0x25'))[_0xa502('0x26')](['phone',_0xa502('0x27'),'ContactId',_0xa502('0x29'),_0x3c9685,_0xa502('0x37'),'updatedAt',_0xa502('0x2b'),'UserId',_0xa502('0x3e')],squel[_0xa502('0xc')]()[_0xa502('0x2d')](_0x228d5f)['from'](_0x1a630b)[_0xa502('0xf')](_0xa502('0x2e'),null,_0xa502('0x38')+_0x1a630b+_0xa502('0x39'))[_0xa502('0xf')](_0x4cec0a,null,_0x4cec0a+'.id\x20=\x20'+_0x1a630b+'.'+_0x3c9685)[_0xa502('0xf')](_0x4e1328,null,_0x4e1328+_0xa502('0x10')+_0x1a630b+'.'+_0x3c9685)[_0xa502('0x2f')](_0x1a630b+_0xa502('0x3a'),_0x2ce644)['where'](_0xa502('0x30'),NOW)[_0xa502('0x2f')](_0xa502('0x3b'),selectNotIn(_0x1a630b,_0x4cec0a,_0x3c9685,_0xa502('0x25'),[_0xa502('0x32'),'\x22onlyIfOpen\x22']))[_0xa502('0x2f')](_0xa502('0x3b'),selectNotIn(_0x1a630b,_0x4cec0a,_0x3c9685,'cm_hopper',[_0xa502('0x32')])))['toString']();return _0x8955e;}function insertTzCmHopperBlack(_0x301902,_0x5d00cd,_0x1f47fd,_0x1b6824){var _0xacfabe=[_0xa502('0x1e'),_0xa502('0x34'),_0xa502('0x1f'),_0x5d00cd+'.'+_0x1b6824,_0xa502('0x35'),'cm_contacts.updatedAt'];return squel['insert']()[_0xa502('0x24')](_0xa502('0x3c'))['fromQuery']([_0xa502('0x36'),_0xa502('0x28'),_0xa502('0x29'),_0x1b6824,_0xa502('0x37'),_0xa502('0x2a')],squel[_0xa502('0xc')]()[_0xa502('0x2d')](_0xacfabe)[_0xa502('0xe')](_0x5d00cd)['join'](_0xa502('0x2e'),null,_0xa502('0x38')+_0x5d00cd+'.CmListId')[_0xa502('0xf')](_0x1f47fd,null,_0x1f47fd+'.id\x20=\x20'+_0x5d00cd+'.'+_0x1b6824)['where'](_0x5d00cd+_0xa502('0x3a'),_0x301902)[_0xa502('0x2f')](_0xa502('0x30'),NOW)[_0xa502('0x2f')](_0xa502('0x3b'),squel['select']()['field']('phone')[_0xa502('0xe')]('cm_hopper_black')[_0xa502('0x2f')](_0xa502('0x3f'),_0x301902)[_0xa502('0x2f')](_0x1b6824+_0xa502('0x11')+_0x5d00cd+'.'+_0x1b6824)))['toString']();}function insertCmHopperAdditionalPhones(_0x2b7259){var _0x2d7bb6=[_0xa502('0x40'),_0xa502('0x41'),_0xa502('0x42'),_0xa502('0x43'),_0xa502('0x44')];return squel[_0xa502('0x23')]()[_0xa502('0x24')](_0xa502('0x45'))['fromQuery']([_0xa502('0x46'),_0xa502('0x36'),'OrderBy',_0xa502('0x37'),_0xa502('0x2a')],squel[_0xa502('0xc')]()[_0xa502('0x2d')](_0x2d7bb6)[_0xa502('0xe')](_0xa502('0x25'))[_0xa502('0xf')](_0xa502('0x2e'),null,_0xa502('0x47'))[_0xa502('0xf')](_0xa502('0x48'),null,_0xa502('0x49'))[_0xa502('0x2f')](_0xa502('0x4a'),_0x2b7259)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0xa502('0x33')]();}function insertCmContact(_0x5de6df,_0x3e959d,_0x5d1da5,_0x24a4a1){var _0x4a20b0=_['concat'](_[_0xa502('0x4b')](_0x24a4a1),[_0xa502('0x29'),'CompanyId',_0xa502('0x37'),_0xa502('0x2a')]);return squel[_0xa502('0x23')]()[_0xa502('0x24')]('cm_contacts')[_0xa502('0x26')](_0x4a20b0,squel['select']()[_0xa502('0x2d')](_0x4a20b0)[_0xa502('0xe')](_0x3e959d)[_0xa502('0x2f')]('('+_0x5d1da5[_0xa502('0xf')](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0xa502('0x2d')](_0x5d1da5)[_0xa502('0xe')](_0xa502('0x2e'))[_0xa502('0x2f')](_0xa502('0x3f'),_0x5de6df)[_0xa502('0x2f')]('deletedAt\x20IS\x20NULL'))[_0xa502('0x2f')]('id\x20IN\x20?',squel[_0xa502('0xc')]()[_0xa502('0xd')]('MIN(id)',_0xa502('0x4c'))[_0xa502('0xe')](_0x3e959d)[_0xa502('0x4d')](_0x5d1da5[_0xa502('0xf')](','))))[_0xa502('0x33')]();}function handleStop(){logger[_0xa502('0x4e')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0xddca88){logger[_0xa502('0x4f')](_0xddca88[_0xa502('0x50')]);process[_0xa502('0x51')](0x1);}function handleError(_0x3d6937,_0x26413b){stats[_0xa502('0x52')][_0xa502('0x16')]({'name':_0x26413b[_0xa502('0x53')],'message':_0x26413b['message'],'row':_0x3d6937});}function handleQuery(_0x1566ac){logger[_0xa502('0x4e')](_0x1566ac);return db[_0xa502('0x54')][_0xa502('0x55')](_0x1566ac)['spread'](function(_0x1878e9){results[_0xa502('0x16')](_0x1878e9);})[_0xa502('0x56')](function(_0x499025){logger['error'](_0x499025[_0xa502('0x50')]);});}function updateTzCampaigns(_0xc2879e){return new Promise(function(_0x33f2a5,_0x1ea04e){var _0x42bf96=squel['select']()[_0xa502('0x2d')](['campaigns.id',_0xa502('0x57')])['from'](_0xa502('0x58'))[_0xa502('0xf')](_0xa502('0x59'),null,_0xa502('0x5a'))[_0xa502('0x2f')](_0xa502('0x5b')+_0xc2879e);db[_0xa502('0x54')][_0xa502('0x55')](_0x42bf96[_0xa502('0x33')]())[_0xa502('0x5c')](function(_0x374a8b){var _0x5f37e1=[];for(var _0x10ee04=0x0;_0x10ee04<_0x374a8b[_0xa502('0x15')];_0x10ee04++){_0x5f37e1[_0xa502('0x16')](getTimezoneData(_0x374a8b[_0x10ee04],tmp_campaigns));}BPromise[_0xa502('0x17')](_0x5f37e1)[_0xa502('0x14')](function(){_0x33f2a5({'val':0x1});});})['catch'](function(_0x119a46){logger[_0xa502('0x4f')](_0x119a46['message']);_0x33f2a5({'val':0x0});});});}function updateTzVoiceQueues(_0x58ef43){return new Promise(function(_0x1f7832,_0x462598){var _0x1e15e0=squel[_0xa502('0xc')]()[_0xa502('0x2d')]([_0xa502('0x5d'),'voice_queues.dialTimezone'])[_0xa502('0xe')]('voice_queues')['join'](_0xa502('0x5e'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xa502('0x2f')](_0xa502('0x5f')+_0x58ef43);db[_0xa502('0x54')][_0xa502('0x55')](_0x1e15e0[_0xa502('0x33')]())[_0xa502('0x5c')](function(_0x30f2e1){var _0x56d880=[];for(var _0x58a4b9=0x0;_0x58a4b9<_0x30f2e1[_0xa502('0x15')];_0x58a4b9++){_0x56d880[_0xa502('0x16')](getTimezoneData(_0x30f2e1[_0x58a4b9],tmp_voice_queues));}BPromise[_0xa502('0x17')](_0x56d880)[_0xa502('0x14')](function(){_0x1f7832({'val':0x1});});})[_0xa502('0x56')](function(_0x1d60c9){logger[_0xa502('0x4f')](_0x1d60c9[_0xa502('0x50')]);_0x1f7832({'val':0x0});});});}function getTimezoneData(_0x1ff5c3,_0x44c944){return new Promise(function(_0x1e2e7c,_0x47cf17){var _0x113b32=shared[_0xa502('0x60')];var _0x421edb=_0x113b32[_0x1ff5c3[_0xa502('0x61')]];if(_[_0xa502('0x62')](_0x421edb)){_0x1e2e7c({'ret':0x1});}else{var _0x584b77=_0x421edb[_0xa502('0x63')];var _0x3062cb=squel[_0xa502('0x23')]()['into'](_0x44c944)[_0xa502('0x64')]('id',_0x1ff5c3['id'])[_0xa502('0x64')]('offset',_0x584b77)['set'](_0xa502('0x61'),_0x1ff5c3['dialTimezone'])[_0xa502('0x33')]();return db[_0xa502('0x54')]['query'](_0x3062cb)[_0xa502('0x5c')](function(_0x4584a5){_0x1e2e7c({'ret':0x1});})['catch'](function(_0x390435){logger[_0xa502('0x4f')](_0x390435['message']);_0x47cf17({'ret':0x1});});}});}function handleTZQuery(_0x413f68){logger[_0xa502('0x4e')](_0x413f68);return db[_0xa502('0x54')][_0xa502('0x55')](_0x413f68)[_0xa502('0x5c')](function(_0x4bb3a5){})['catch'](function(_0x197614){logger[_0xa502('0x4f')](_0x197614['message']);});}function main(_0x127e3b,_0x41bcf8,_0x57ca09,_0x287f4e){logger[_0xa502('0x4e')](_0xa502('0x65'),_0x127e3b,JSON[_0xa502('0x66')](_0x41bcf8));process[_0xa502('0x67')]('start');var _0x40af17=_0x41bcf8[_0xa502('0x68')];var _0x1d2592=_[_0xa502('0x69')](_0x40af17);var _0x54d0e7=_0x41bcf8['socket_timestamp'];var _0x684075=path['join'](config[_0xa502('0x6a')],_0xa502('0x6b'),_0x54d0e7+'.csv');hasTZ=_[_0xa502('0x4b')](_0x40af17)[_0xa502('0x6c')](_0xa502('0x61'));var _0x21fd65=_[_0xa502('0x4b')](_0x40af17)[_0xa502('0xf')]();logger['info']('header',_0x21fd65);db[_0xa502('0x6d')][_0xa502('0x12')]({'raw':!![],'attributes':['id','name']})[_0xa502('0x14')](function(_0x52330a){for(var _0x4839bc=0x0;_0x4839bc<_0x52330a[_0xa502('0x15')];_0x4839bc++){if(_0x52330a[_0x4839bc]['name']in _0x40af17){contactItemTypes['push'](_0x52330a[_0x4839bc]);delete _0x1d2592[_0x52330a[_0x4839bc][_0xa502('0x6e')]];hasAdditionalPhones=!![];}for(var _0x195add in _0x40af17){if(_0x52330a[_0x4839bc]['name']+_0xa502('0x6f')===_0x195add){phoneDescriptions[_0xa502('0x16')]({'itemTypeId':_0x52330a[_0x4839bc]['id'],'description':_0x195add});delete _0x1d2592[_0x195add];}}}if(hasAdditionalPhones)_0x1d2592[_0xa502('0x13')]='';var _0x1dbcc7=_[_0xa502('0x4b')](_0x1d2592)[_0xa502('0xf')]();logger[_0xa502('0x4e')](_0xa502('0x70'),_0x1dbcc7);fs[_0xa502('0x71')](_0x684075,_0x1dbcc7+'\x0a');Papa[_0xa502('0x72')](fs['createReadStream'](_0x127e3b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x152ed8,_0x1c86db){try{for(var _0x3055c0=0x0,_0x173478=[];_0x3055c0<_0x152ed8[_0xa502('0x73')][_0xa502('0x15')];_0x3055c0++){stats[_0xa502('0x74')]+=0x1;if(_0x152ed8[_0xa502('0x52')][_0x3055c0]){handleError(_0x152ed8[_0xa502('0x73')][_0x3055c0],_0x152ed8['errors'][_0x3055c0]);}else{var _0x34c810=[];var _0x38de77=[];var _0x4709f9={};for(var _0x4b2188 in _0x40af17){let _0x2559ac=contactItemTypes[_0xa502('0x75')](_0x321a99=>_0x321a99[_0xa502('0x6e')]===_0x4b2188);let _0x459c56=contactItemTypes[_0xa502('0x75')](_0x3ca335=>_0x3ca335[_0xa502('0x6e')]+_0xa502('0x6f')===_0x4b2188);if(_[_0xa502('0x62')](_0x2559ac)&&_[_0xa502('0x62')](_0x459c56)){if(_0x40af17[_0xa502('0x76')](_0x4b2188)){if(_0x152ed8[_0xa502('0x73')][_0x3055c0][_0x40af17[_0x4b2188]]){var _0x1d28d6=_[_0xa502('0x77')](_0x152ed8[_0xa502('0x73')][_0x3055c0][_0x40af17[_0x4b2188]][_0xa502('0x78')](/"/g,'\x27'));switch(_0x4b2188){case'scheduledat':var _0x120345=moment(_0x1d28d6,_0xa502('0xa'),!![]);if(_0x120345[_0xa502('0x79')]()){_0x173478[_0xa502('0x16')]('\x22'+_0x1d28d6+'\x22');}else{_0x34c810[_0xa502('0x16')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xa502('0x2b'):var _0x12b989=parseInt(_0x1d28d6);_0x1d28d6=_[_0xa502('0x7a')](_0x12b989)||_0x12b989<0x0||_0x12b989>0x4?_0x287f4e?0x3:0x2:_0x12b989;_0x173478[_0xa502('0x16')]('\x22'+_0x1d28d6+'\x22');break;case'UserId':var _0x1a0628=parseInt(_0x1d28d6);if(_['isNumber'](_0x1a0628)&&_[_0xa502('0x6c')](_0x57ca09,_0x1a0628)){_0x173478[_0xa502('0x16')]('\x22'+_0x1a0628+'\x22');}else{_0x34c810[_0xa502('0x16')](_0xa502('0x7b'));}break;case _0xa502('0x7c'):if(isEmail(_0x1d28d6)){_0x173478[_0xa502('0x16')]('\x22'+_0x1d28d6+'\x22');}else{_0x34c810[_0xa502('0x16')](_0xa502('0x7d'));}break;case _0xa502('0x7e'):var _0x418111=moment(_0x1d28d6,_0xa502('0x7f'),!![]);if(_0x418111[_0xa502('0x79')]()){_0x173478[_0xa502('0x16')]('\x22'+_0x1d28d6+'\x22');}else{_0x34c810[_0xa502('0x16')](_0xa502('0x80'));}break;case _0xa502('0x61'):var _0x429565=shared[_0xa502('0x60')];var _0x58ee8d=_0x429565[_0x1d28d6];if(!_[_0xa502('0x62')](_0x58ee8d)){var _0x3b7ca0=_0x58ee8d[_0xa502('0x63')];_0x173478[_0xa502('0x16')]('\x22'+_0x1d28d6+'\x22');_0x173478[_0xa502('0x16')]('\x22'+_0x3b7ca0+'\x22');}break;default:_0x173478[_0xa502('0x16')]('\x22'+_0x1d28d6+'\x22');}}else{switch(_0x4b2188){case _0xa502('0x81'):case _0xa502('0x36'):_0x34c810[_0xa502('0x16')](_0x4b2188+_0xa502('0x82'));break;default:_0x173478[_0xa502('0x16')]('\x22\x22');}}}}else{var _0x2f0cab='';if(!_['isNil'](_0x2559ac)){if(!_0x4709f9[_0xa502('0x76')](_0x2559ac['id'])){if(!_[_0xa502('0x62')](_0x152ed8[_0xa502('0x73')][_0x3055c0][_0x40af17[_0x4b2188]])){var _0x1d28d6=_[_0xa502('0x77')](_0x152ed8[_0xa502('0x73')][_0x3055c0][_0x40af17[_0x4b2188]][_0xa502('0x78')](/"/g,'\x27'));var _0x1ea0d2=phoneDescriptions[_0xa502('0x75')](_0x5d5842=>_0x5d5842[_0xa502('0x83')]===_0x2559ac['id']);if(!_['isNil'](_0x1ea0d2)){var _0x14bbd9=_[_0xa502('0x77')](_0x152ed8['data'][_0x3055c0][_0x40af17[_0x1ea0d2[_0xa502('0x84')]]][_0xa502('0x78')](/"/g,'\x27'));if(!_[_0xa502('0x62')](_0x14bbd9))_0x1d28d6=_0x1d28d6+'§'+_0x14bbd9;}if(_0x2f0cab=='')_0x2f0cab=_0x1d28d6;else _0x2f0cab+='|'+_0x1d28d6;}_0x38de77[_0xa502('0x16')](_0x2559ac['id']+':'+_0x2f0cab);_0x4709f9[_0x2559ac['id']]=0x1;}}}}if(hasAdditionalPhones){_0x173478[_0xa502('0x16')]('\x22'+_0x38de77[_0xa502('0xf')](';')+'\x22');}if(_0x34c810[_0xa502('0x15')]){handleError(_0x152ed8['data'][_0x3055c0],{'code':_0xa502('0x85'),'message':_0x34c810[_0xa502('0xf')]()});}else{fs[_0xa502('0x86')](_0x684075,_0x173478[_0xa502('0xf')]()+'\x0a');}_0x173478=[];}if(!(stats[_0xa502('0x74')]%0xc8)){socket[_0xa502('0x87')](_0xa502('0x88')+_0x54d0e7,stats);stats['errors']=[];}}if(stopped){logger['info'](_0xa502('0x89'));_0x1c86db[_0xa502('0x8a')]();}}catch(_0xb052e){handleError(_0x152ed8['data'][_0x3055c0],{'code':_0xa502('0x8b'),'message':_0xb052e['message']});logger['error'](_0xa502('0x8c'),_0xb052e['message']);}},'complete':function(){try{var _0x314926=[];var _0x175b52=[];var _0x13e4e8=_0xa502('0x2e');if(_0x41bcf8['duplicates']&&_0x41bcf8[_0xa502('0x8d')][_0xa502('0x15')]){_0x13e4e8=_0xa502('0x8e')+_0x54d0e7;_0x314926[_0xa502('0x16')](_0xa502('0x8f')+_0x13e4e8+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xa502('0x90')+_0x54d0e7;tmp_voice_queues='voice_queues_'+_0x54d0e7;_0x175b52[_0xa502('0x16')](_0xa502('0x8f')+tmp_campaigns+_0xa502('0x91'));_0x175b52['push'](_0xa502('0x8f')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xa502('0x92')](_0x175b52,handleTZQuery)[_0xa502('0x14')](function(_0x9cb094){updateTzCampaigns(_0x41bcf8[_0xa502('0x29')])[_0xa502('0x14')](function(_0x37cb24){updateTzVoiceQueues(_0x41bcf8[_0xa502('0x29')])[_0xa502('0x14')](function(_0xce3548){if(hasTZ)_0x1dbcc7=_0x1dbcc7['replace'](_0xa502('0x61'),_0xa502('0x93'));var _0x2bd4cf=util[_0xa502('0xb')](_0xa502('0x94'),_0x684075,_0x13e4e8,_0x1dbcc7,_0x41bcf8[_0xa502('0x29')],_0x41bcf8[_0xa502('0x95')]||null,NOW,NOW);if(_[_0xa502('0x62')](_0x40af17['scheduledat'])){_0x2bd4cf+=_0xa502('0x96');}_0x314926[_0xa502('0x16')](_0x2bd4cf);if(_0x41bcf8[_0xa502('0x8d')]&&_0x41bcf8[_0xa502('0x8d')][_0xa502('0x15')]){_0x314926[_0xa502('0x16')](insertCmContact(_0x41bcf8['ListId'],_0x13e4e8,_0x41bcf8['duplicates'],_0x40af17));_0x314926[_0xa502('0x16')](_0xa502('0x97')+_0x13e4e8+';');}BPromise['each'](_0x314926,handleQuery)[_0xa502('0x14')](function(_0x304487){BPromise[_0xa502('0x17')]([handleAdditionalPhones()])[_0xa502('0x14')](function(){_0x314926=[];for(var _0x5d30fb=0x0;_0x5d30fb_0x5ef819['name']===_0x48848e);let _0x199126=contactItemTypes[_0xe6f3('0x72')](_0x263927=>_0x263927['name']+_0xe6f3('0x6b')===_0x48848e);if(_[_0xe6f3('0x20')](_0x448c42)&&_['isNil'](_0x199126)){if(_0x907685['hasOwnProperty'](_0x48848e)){if(_0x2807bf[_0xe6f3('0x70')][_0x29428b][_0x907685[_0x48848e]]){var _0x290cb3=_[_0xe6f3('0x73')](_0x2807bf[_0xe6f3('0x70')][_0x29428b][_0x907685[_0x48848e]][_0xe6f3('0x74')](/"/g,'\x27'));switch(_0x48848e){case'scheduledat':var _0x41ef0a=moment(_0x290cb3,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x41ef0a[_0xe6f3('0x75')]()){_0x5e825c[_0xe6f3('0x22')]('\x22'+_0x290cb3+'\x22');}else{_0x4875e9[_0xe6f3('0x22')](_0xe6f3('0x76'));}break;case _0xe6f3('0x3b'):var _0x39d70f=parseInt(_0x290cb3);_0x290cb3=_['isNaN'](_0x39d70f)||_0x39d70f<0x0||_0x39d70f>0x4?_0x47016e?0x3:0x2:_0x39d70f;_0x5e825c[_0xe6f3('0x22')]('\x22'+_0x290cb3+'\x22');break;case _0xe6f3('0x3c'):var _0x568f86=parseInt(_0x290cb3);if(_[_0xe6f3('0x77')](_0x568f86)&&_[_0xe6f3('0x78')](_0x2900b2,_0x568f86)){_0x5e825c[_0xe6f3('0x22')]('\x22'+_0x568f86+'\x22');}else{_0x4875e9[_0xe6f3('0x22')](_0xe6f3('0x79'));}break;case _0xe6f3('0x7a'):if(isEmail(_0x290cb3)){_0x5e825c[_0xe6f3('0x22')]('\x22'+_0x290cb3+'\x22');}else{_0x4875e9[_0xe6f3('0x22')](_0xe6f3('0x7b'));}break;case _0xe6f3('0x7c'):var _0x1393c8=moment(_0x290cb3,_0xe6f3('0x7d'),!![]);if(_0x1393c8['isValid']()){_0x5e825c[_0xe6f3('0x22')]('\x22'+_0x290cb3+'\x22');}else{_0x4875e9[_0xe6f3('0x22')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x5e825c['push']('\x22'+_0x290cb3+'\x22');}}else{switch(_0x48848e){case _0xe6f3('0x7e'):case _0xe6f3('0x14'):_0x4875e9[_0xe6f3('0x22')](_0x48848e+_0xe6f3('0x7f'));break;default:_0x5e825c[_0xe6f3('0x22')]('\x22\x22');}}}}else{var _0x2fd567='';if(!_['isNil'](_0x448c42)){if(!_0x5b9657[_0xe6f3('0x80')](_0x448c42['id'])){for(var _0x2885f0=0x0;_0x2885f0<_0x907685[_0x48848e][_0xe6f3('0x1f')];_0x2885f0++){var _0x290cb3=_[_0xe6f3('0x73')](_0x2807bf[_0xe6f3('0x70')][_0x29428b][_0x907685[_0x48848e][_0x2885f0]]['replace'](/"/g,'\x27'));var _0x2799a3=phoneDescriptions[_0xe6f3('0x72')](_0x55ec3a=>_0x55ec3a[_0xe6f3('0x81')]===_0x448c42['id']);if(!_['isNil'](_0x2799a3)){var _0x2b22a0=_['trim'](_0x2807bf[_0xe6f3('0x70')][_0x29428b][_0x907685[_0x2799a3[_0xe6f3('0x82')]][0x0]][_0xe6f3('0x74')](/"/g,'\x27'));if(!_[_0xe6f3('0x20')](_0x2b22a0))_0x290cb3=_0x290cb3+'§'+_0x2b22a0;}if(_0x2fd567=='')_0x2fd567=_0x290cb3;else _0x2fd567+='|'+_0x290cb3;}_0x26b982[_0xe6f3('0x22')](_0x448c42['id']+':'+_0x2fd567);_0x5b9657[_0x448c42['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5e825c[_0xe6f3('0x22')]('\x22'+_0x26b982['join'](';')+'\x22');}if(_0x4875e9[_0xe6f3('0x1f')]){handleError(_0x2807bf['data'][_0x29428b],{'code':_0xe6f3('0x83'),'message':_0x4875e9[_0xe6f3('0x1a')]()});}else{fs[_0xe6f3('0x84')](_0x455113,_0x5e825c[_0xe6f3('0x1a')]()+'\x0a');}_0x5e825c=[];}if(!(stats[_0xe6f3('0x71')]%0xc8)){socket[_0xe6f3('0x85')](_0xe6f3('0x86')+_0x427c03,stats);stats['errors']=[];}}if(stopped){logger[_0xe6f3('0x5c')](_0xe6f3('0x87'));_0x24dbd2[_0xe6f3('0x88')]();}}catch(_0x5ecb7f){handleError(_0x2807bf['data'][_0x29428b],{'code':_0xe6f3('0x89'),'message':_0x5ecb7f[_0xe6f3('0x26')]});logger[_0xe6f3('0x25')]('step',_0x5ecb7f[_0xe6f3('0x26')]);}},'complete':function(){try{var _0xbafd24=[];var _0x3700a2=tempTableName;_0xbafd24[_0xe6f3('0x22')](_0xe6f3('0x8a')+_0x3700a2+'\x20LIKE\x20cm_contacts;');logger[_0xe6f3('0x5c')](_0xe6f3('0x8b'),contactItemTypes[_0xe6f3('0x1f')]);var _0x53bf42=util[_0xe6f3('0xf')](_0xe6f3('0x8c'),_0x455113,_0x3700a2,_0x2ab40c,_0x45597f['ListId'],_0x45597f['CompanyId']||null,NOW,NOW);if(_[_0xe6f3('0x20')](_0x907685['scheduledat'])){_0x53bf42+=_0xe6f3('0x8d');}_0xbafd24['push'](_0x53bf42);BPromise['each'](_0xbafd24,handleQuery)['then'](function(_0x542642){BPromise[_0xe6f3('0x23')]([handleAdditionalPhones()])[_0xe6f3('0x29')](function(){_0xbafd24=[];for(var _0x5ecb52=0x0;_0x5ecb52\x20\x20');}var _0x1b9904=path[_0xe6f3('0x1a')](config[_0xe6f3('0x65')],_0xe6f3('0x66'),process['argv'][0x2]);if(!fs[_0xe6f3('0x96')](_0x1b9904)){throw new Error(_0xe6f3('0x97'));}var _0x593951={};try{_0x593951=JSON[_0xe6f3('0x6e')](process[_0xe6f3('0x95')][0x3]);if(!_0x593951[_0xe6f3('0x63')]){throw new Error(_0xe6f3('0x98'));}var _0x39271b=0x0;if(_0x593951[_0xe6f3('0x63')][_0xe6f3('0x3c')]){_0x39271b=0x1;}if(!_0x593951[_0xe6f3('0x39')]){throw new Error(_0xe6f3('0x99'));}}catch(_0x553d51){throw new Error(_0xe6f3('0x9a'));}var _0x417e83=[];try{_0x417e83=_[_0xe6f3('0x9b')](JSON['parse'](process[_0xe6f3('0x95')][0x4]),'id');}catch(_0x110ada){logger[_0xe6f3('0x5c')]('No\x20agent\x20available');}main(_0x1b9904,_0x593951,_0x417e83,_0x39271b);}validate();process['on']('SIGINT',handleStop);process['on'](_0xe6f3('0x9c'),handleUncaughtException); \ No newline at end of file +var _0x974c=['send','start','binding','socket_timestamp','root','server/files/tmp','.csv','body','findAll','name','header','writeFileSync','rows','data','find','_description','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','itemTypeId','description','appendFileSync','emit','Abort\x20parser','abort','SystemError','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','contactId','contactTypeId','DROP\x20TABLE\x20','finish','affectedRows','contact:import:','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','select','field','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','spread','length','isNil','phone','AdditionalPhones','push','all','then','error','message','split','filter','CmContactHasItem','findOne','updated','create','inserted','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','into','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.updatedAt','insert','cm_hopper_black','from','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_hopper_additional_phones','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','concat','keys','ListId','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','exit','errors','info','sequelize','catch'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0x974c,0xd4));var _0xc974=function(_0x282fab,_0x6c7111){_0x282fab=_0x282fab-0x0;var _0x687be=_0x974c[_0x282fab];return _0x687be;};'use strict';var fs=require('fs');var path=require(_0xc974('0x0'));var _=require(_0xc974('0x1'));var Papa=require(_0xc974('0x2'));var util=require(_0xc974('0x3'));var BPromise=require('bluebird');var moment=require(_0xc974('0x4'));var squel=require(_0xc974('0x5'));var Redis=require(_0xc974('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0xc974('0x7'));var logger=require(_0xc974('0x8'))(_0xc974('0x9'));config['redis']=_[_0xc974('0xa')](config[_0xc974('0xb')],{'host':_0xc974('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc974('0xb')]));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()[_0xc974('0xd')](_0xc974('0xe'));var tempTableName='cm_contacts_temp_'+moment()[_0xc974('0xd')](_0xc974('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2f46df){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))*$/[_0xc974('0x10')](_0x2f46df);}function selectNotIn(_0x1c56cb,_0x21c5dc,_0x2019cd,_0x643b68,_0x5812a2){return squel[_0xc974('0x11')]()[_0xc974('0x12')]('phone')['from'](_0x643b68)[_0xc974('0x13')](_0x21c5dc,null,_0x21c5dc+'.id\x20=\x20'+_0x643b68+'.'+_0x2019cd)[_0xc974('0x14')](_0x643b68+'.'+_0x2019cd+_0xc974('0x15')+_0x1c56cb+'.'+_0x2019cd)[_0xc974('0x14')](_0x21c5dc+_0xc974('0x16')+_0x5812a2['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x18bff3,_0x3a8300){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xc974('0x17')](_0xc974('0x18')+tempTableName)[_0xc974('0x19')](function(_0x3873db){if(_0x3873db!==null){var _0x3e9d47=[];for(var _0x356a82=0x0;_0x356a82<_0x3873db[_0xc974('0x1a')];_0x356a82++){var _0x276ec=_0x3873db[_0x356a82];if(!_[_0xc974('0x1b')](_0x276ec[_0xc974('0x1c')])){if(!_[_0xc974('0x1b')](_0x276ec[_0xc974('0x1d')]))_0x3e9d47['push'](insertAdditionalPhones(_0x276ec));promisesContact[_0xc974('0x1e')]({'contact':_0x276ec});}}}Promise[_0xc974('0x1f')](_0x3e9d47)[_0xc974('0x20')](function(){_0x18bff3({'val':0x1});});})['catch'](function(_0x196106){logger[_0xc974('0x21')](_0x196106[_0xc974('0x22')]);});});}function insertAdditionalPhones(_0x39335d){return new Promise(function(_0x44bf5c,_0x2b738e){var _0xdf28bf=_0x39335d[_0xc974('0x1d')];if(_[_0xc974('0x1b')](_0xdf28bf))_0x2b738e({'val':0x0});else{var _0xef948f=_0xdf28bf[_0xc974('0x23')](';');var _0x18f6c9=[];orderBy=0x0;for(var _0x5bd3c5=0x0;_0x5bd3c5<_0xef948f[_0xc974('0x1a')];_0x5bd3c5++){_0x18f6c9[_0xc974('0x1e')](splitAdditionalPhone(_0x39335d['id'],_0xef948f[_0x5bd3c5]));}Promise[_0xc974('0x1f')](_0x18f6c9)[_0xc974('0x20')](function(){_0x44bf5c({'val':_0xef948f[_0xc974('0x1a')]});});}});}function splitAdditionalPhone(_0x2c8c56,_0x460a38){return new Promise(function(_0x25d8fd,_0x1304bd){var _0xac77b=_0x460a38[_0xc974('0x23')](':');var _0x121384=_0xac77b[0x0];var _0x5eb36f=_0xac77b[0x1];if(_0x5eb36f!==''){var _0x4f09ee=_0x5eb36f['split']('|');var _0x4ae691=[];for(var _0x347db5=0x0;_0x347db5<_0x4f09ee[_0xc974('0x1a')];_0x347db5++){if(_0x4f09ee[_0x347db5]!==''){var _0x133c24=_[_0xc974('0x24')](promisesAdditionalPhones,{'contactId':_0x2c8c56,'phone':_0x4f09ee[_0x347db5]});if(_0x133c24['length']==0x0){orderBy++;promisesAdditionalPhones[_0xc974('0x1e')]({'contactId':_0x2c8c56,'contactTypeId':_0x121384,'phone':_0x4f09ee[_0x347db5],'orderBy':orderBy});}}}_0x25d8fd({'ok':0x1});}else _0x25d8fd({'res':0x0});});}function createAdditionalPhone(_0x24ca17,_0x3df307,_0x45627a,_0x107eec){var _0x465957='';var _0xcd28d1='';var _0x3977ff=_0x45627a[_0xc974('0x23')]('§');_0x465957=_0x3977ff[0x0];if(_0x3977ff[_0xc974('0x1a')]==0x2)_0xcd28d1=_0x3977ff[0x1];return new Promise(function(_0xcaa7ff,_0xc4e65a){return db[_0xc974('0x25')][_0xc974('0x26')]({'where':{'CmContactId':_0x24ca17,'item':_0x465957}})[_0xc974('0x20')](function(_0x190dfe){if(_0x190dfe){return db['CmContactHasItem']['update']({'ItemTypeId':_0x3df307,'description':_0xcd28d1,'OrderBy':_0x107eec},{'where':{'CmContactId':_0x24ca17,'item':_0x465957}})[_0xc974('0x20')](function(_0x3ee3f3){_0xcaa7ff({'res':_0xc974('0x27')});});}else{return db[_0xc974('0x25')][_0xc974('0x28')]({'CmContactId':_0x24ca17,'item':_0x465957,'ItemTypeId':_0x3df307,'description':_0xcd28d1,'OrderBy':_0x107eec,'ItemClass':'PHONE'})[_0xc974('0x20')](function(_0x65a177){_0xcaa7ff({'res':_0xc974('0x29')});});}});});}function updateContact(_0x34c37c){return new Promise(function(_0x5dee43,_0x30fff0){var _0x3dbf81=_0x34c37c['id'];delete _0x34c37c['id'];return db['CmContact'][_0xc974('0x2a')](_0x34c37c,{'where':{'id':_0x3dbf81}})[_0xc974('0x20')](function(_0x1049dd){updatedRows+=0x1;return db[_0xc974('0x2b')][_0xc974('0x2a')]({'phone':_0x34c37c[_0xc974('0x1c')]},{'where':{'ContactId':_0x3dbf81}})[_0xc974('0x20')](function(_0x19f990){_0x5dee43({'ret':'OK'});});});});}function insertCmHopper(_0x28bbc1,_0x3437b9,_0x153a18,_0x1df516,_0x467e6d){var _0x29f005=[_0xc974('0x2c'),_0xc974('0x2d'),_0xc974('0x2e'),_0xc974('0x2f'),_0x3437b9+'.'+_0x1df516,_0xc974('0x30'),'cm_contacts.updatedAt',_0xc974('0x31'),_0xc974('0x32'),'\x22'+_0x467e6d+'\x22'];return squel['insert']()[_0xc974('0x33')]('cm_hopper')[_0xc974('0x34')]([_0xc974('0x1c'),_0xc974('0x35'),_0xc974('0x36'),'ListId',_0x1df516,_0xc974('0x37'),_0xc974('0x38'),_0xc974('0x39'),_0xc974('0x3a'),_0xc974('0x3b')],squel[_0xc974('0x11')]()[_0xc974('0x3c')](_0x29f005)['from'](_0x3437b9)['join'](_0xc974('0x3d'),null,'cm_contacts.ListId\x20=\x20'+_0x3437b9+_0xc974('0x3e'))[_0xc974('0x13')](_0x153a18,null,_0x153a18+_0xc974('0x3f')+_0x3437b9+'.'+_0x1df516)[_0xc974('0x14')](_0x3437b9+_0xc974('0x40'),_0x28bbc1)['where'](_0xc974('0x41'),NOW)[_0xc974('0x14')](_0xc974('0x42'),selectNotIn(_0x3437b9,_0x153a18,_0x1df516,_0xc974('0x43'),[_0xc974('0x44'),_0xc974('0x45')]))[_0xc974('0x14')](_0xc974('0x42'),selectNotIn(_0x3437b9,_0x153a18,_0x1df516,'cm_hopper',[_0xc974('0x44')])))[_0xc974('0x46')]();}function insertCmHopperBlack(_0x49fc81,_0x309637,_0x56bead,_0x385f62){var _0x70d678=[_0xc974('0x2c'),'cm_contacts.id',_0xc974('0x2f'),_0x309637+'.'+_0x385f62,_0xc974('0x30'),_0xc974('0x47')];return squel[_0xc974('0x48')]()[_0xc974('0x33')](_0xc974('0x49'))[_0xc974('0x34')]([_0xc974('0x1c'),_0xc974('0x36'),'ListId',_0x385f62,'createdAt',_0xc974('0x38')],squel[_0xc974('0x11')]()[_0xc974('0x3c')](_0x70d678)[_0xc974('0x4a')](_0x309637)[_0xc974('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x309637+_0xc974('0x3e'))['join'](_0x56bead,null,_0x56bead+'.id\x20=\x20'+_0x309637+'.'+_0x385f62)[_0xc974('0x14')](_0x309637+_0xc974('0x40'),_0x49fc81)[_0xc974('0x14')](_0xc974('0x41'),NOW)[_0xc974('0x14')](_0xc974('0x42'),squel[_0xc974('0x11')]()[_0xc974('0x12')]('phone')[_0xc974('0x4a')](_0xc974('0x49'))[_0xc974('0x14')](_0xc974('0x4b'),_0x49fc81)[_0xc974('0x14')](_0x385f62+_0xc974('0x4c'),_0x309637+'.'+_0x385f62)))[_0xc974('0x46')]();}function insertCmHopperAdditionalPhones(_0x593f10){var _0x52082=[_0xc974('0x4d'),_0xc974('0x4e'),_0xc974('0x4f'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel['insert']()[_0xc974('0x33')](_0xc974('0x50'))['fromQuery'](['CmHopperId',_0xc974('0x1c'),'OrderBy','createdAt',_0xc974('0x38')],squel[_0xc974('0x11')]()[_0xc974('0x3c')](_0x52082)[_0xc974('0x4a')](_0xc974('0x43'))[_0xc974('0x13')](_0xc974('0x3d'),null,_0xc974('0x51'))[_0xc974('0x13')](_0xc974('0x52'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where']('cm_hopper.ListId\x20=\x20?',_0x593f10)[_0xc974('0x14')](_0xc974('0x41'),NOW))['toString']();}function insertCmContact(_0x34b212,_0x59cfb5,_0x1c4bbe,_0x1dbfe8){var _0x5327cd=_[_0xc974('0x53')](_[_0xc974('0x54')](_0x1dbfe8),[_0xc974('0x55'),'CompanyId',_0xc974('0x37'),_0xc974('0x38')]);return squel[_0xc974('0x48')]()[_0xc974('0x33')](_0xc974('0x3d'))[_0xc974('0x34')](_0x5327cd,squel[_0xc974('0x11')]()[_0xc974('0x3c')](_0x5327cd)[_0xc974('0x4a')](_0x59cfb5)['where']('('+_0x1c4bbe['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xc974('0x11')]()[_0xc974('0x3c')](_0x1c4bbe)[_0xc974('0x4a')]('cm_contacts')[_0xc974('0x14')]('ListId\x20=\x20?',_0x34b212))['where'](_0xc974('0x56'),squel[_0xc974('0x11')]()['field'](_0xc974('0x57'),_0xc974('0x58'))['from'](_0x59cfb5)[_0xc974('0x59')](_0x1c4bbe['join'](','))))[_0xc974('0x46')]();}function handleStop(){logger['info'](_0xc974('0x5a'));stopped=!![];}function handleUncaughtException(_0x4c6093){logger[_0xc974('0x21')](_0x4c6093['message']);process[_0xc974('0x5b')](0x1);}function handleError(_0x25fadb,_0x499532){stats[_0xc974('0x5c')][_0xc974('0x1e')]({'name':_0x499532['code'],'message':_0x499532[_0xc974('0x22')],'row':_0x25fadb});}function handleQuery(_0x1c3bca){logger[_0xc974('0x5d')](_0x1c3bca);return db[_0xc974('0x5e')][_0xc974('0x17')](_0x1c3bca)[_0xc974('0x19')](function(_0x41f383){results['push'](_0x41f383);})[_0xc974('0x5f')](function(_0x5e96e8){logger[_0xc974('0x21')](_0x5e96e8['message']);});}function main(_0x448ced,_0x2901e4,_0x480c22,_0x5dd027){logger[_0xc974('0x5d')]('main',_0x448ced,JSON['stringify'](_0x2901e4));process[_0xc974('0x60')](_0xc974('0x61'));var _0x452484=_0x2901e4[_0xc974('0x62')];var _0x49c583=_['clone'](_0x452484);var _0x3170a9=_0x2901e4[_0xc974('0x63')];var _0x3e2104=path['join'](config[_0xc974('0x64')],_0xc974('0x65'),_0x3170a9+_0xc974('0x66'));logger[_0xc974('0x5d')](_0xc974('0x67'),_0x2901e4);db['ContactItemType'][_0xc974('0x68')]({'raw':!![],'attributes':['id',_0xc974('0x69')]})[_0xc974('0x20')](function(_0x2098a8){for(var _0x3f7780=0x0;_0x3f7780<_0x2098a8[_0xc974('0x1a')];_0x3f7780++){if(_0x2098a8[_0x3f7780][_0xc974('0x69')]in _0x452484){contactItemTypes[_0xc974('0x1e')](_0x2098a8[_0x3f7780]);delete _0x49c583[_0x2098a8[_0x3f7780][_0xc974('0x69')]];hasAdditionalPhones=!![];}for(var _0x59ea79 in _0x452484){if(_0x2098a8[_0x3f7780][_0xc974('0x69')]+'_description'===_0x59ea79){phoneDescriptions['push']({'itemTypeId':_0x2098a8[_0x3f7780]['id'],'description':_0x59ea79});delete _0x49c583[_0x59ea79];}}}if(hasAdditionalPhones)_0x49c583[_0xc974('0x1d')]='';var _0x167f50=_[_0xc974('0x54')](_0x49c583)[_0xc974('0x13')]();logger[_0xc974('0x5d')](_0xc974('0x6a'),_0x167f50);fs[_0xc974('0x6b')](_0x3e2104,_0x167f50+'\x0a');Papa['parse'](fs['createReadStream'](_0x448ced),{'header':!![],'skipEmptyLines':!![],'step':function(_0x264e9e,_0x5ef692){try{for(var _0x435d66=0x0,_0x361e4c=[];_0x435d66<_0x264e9e['data']['length'];_0x435d66++){stats[_0xc974('0x6c')]+=0x1;if(_0x264e9e['errors'][_0x435d66]){handleError(_0x264e9e[_0xc974('0x6d')][_0x435d66],_0x264e9e[_0xc974('0x5c')][_0x435d66]);}else{var _0xcc861a=[];var _0x902fc5=[];var _0x5ae7a4={};for(var _0x20cf26 in _0x452484){let _0x5e44c0=contactItemTypes['find'](_0x59ecb9=>_0x59ecb9['name']===_0x20cf26);let _0x19af8e=contactItemTypes[_0xc974('0x6e')](_0x1fec0a=>_0x1fec0a['name']+_0xc974('0x6f')===_0x20cf26);if(_['isNil'](_0x5e44c0)&&_['isNil'](_0x19af8e)){if(_0x452484['hasOwnProperty'](_0x20cf26)){if(_0x264e9e[_0xc974('0x6d')][_0x435d66][_0x452484[_0x20cf26]]){var _0x1efbcf=_[_0xc974('0x70')](_0x264e9e[_0xc974('0x6d')][_0x435d66][_0x452484[_0x20cf26]][_0xc974('0x71')](/"/g,'\x27'));switch(_0x20cf26){case _0xc974('0x35'):var _0x2e46b4=moment(_0x1efbcf,_0xc974('0xe'),!![]);if(_0x2e46b4[_0xc974('0x72')]()){_0x361e4c[_0xc974('0x1e')]('\x22'+_0x1efbcf+'\x22');}else{_0xcc861a[_0xc974('0x1e')](_0xc974('0x73'));}break;case _0xc974('0x39'):var _0x1abe81=parseInt(_0x1efbcf);_0x1efbcf=_[_0xc974('0x74')](_0x1abe81)||_0x1abe81<0x0||_0x1abe81>0x4?_0x5dd027?0x3:0x2:_0x1abe81;_0x361e4c['push']('\x22'+_0x1efbcf+'\x22');break;case _0xc974('0x3a'):var _0x1631a5=parseInt(_0x1efbcf);if(_[_0xc974('0x75')](_0x1631a5)&&_[_0xc974('0x76')](_0x480c22,_0x1631a5)){_0x361e4c[_0xc974('0x1e')]('\x22'+_0x1631a5+'\x22');}else{_0xcc861a[_0xc974('0x1e')](_0xc974('0x77'));}break;case'email':if(isEmail(_0x1efbcf)){_0x361e4c[_0xc974('0x1e')]('\x22'+_0x1efbcf+'\x22');}else{_0xcc861a[_0xc974('0x1e')]('email\x20wrong\x20format');}break;case _0xc974('0x78'):var _0x5a277e=moment(_0x1efbcf,_0xc974('0x79'),!![]);if(_0x5a277e[_0xc974('0x72')]()){_0x361e4c['push']('\x22'+_0x1efbcf+'\x22');}else{_0xcc861a['push'](_0xc974('0x7a'));}break;default:_0x361e4c[_0xc974('0x1e')]('\x22'+_0x1efbcf+'\x22');}}else{switch(_0x20cf26){case'firstName':case _0xc974('0x1c'):_0xcc861a['push'](_0x20cf26+_0xc974('0x7b'));break;default:_0x361e4c[_0xc974('0x1e')]('\x22\x22');}}}}else{var _0x12e633='';if(!_[_0xc974('0x1b')](_0x5e44c0)){if(!_0x5ae7a4['hasOwnProperty'](_0x5e44c0['id'])){for(var _0x364a2a=0x0;_0x364a2a<_0x452484[_0x20cf26][_0xc974('0x1a')];_0x364a2a++){var _0x1efbcf=_['trim'](_0x264e9e[_0xc974('0x6d')][_0x435d66][_0x452484[_0x20cf26][_0x364a2a]][_0xc974('0x71')](/"/g,'\x27'));var _0x4ef457=phoneDescriptions[_0xc974('0x6e')](_0x14fcf7=>_0x14fcf7[_0xc974('0x7c')]===_0x5e44c0['id']);if(!_[_0xc974('0x1b')](_0x4ef457)){var _0x433940=_[_0xc974('0x70')](_0x264e9e[_0xc974('0x6d')][_0x435d66][_0x452484[_0x4ef457[_0xc974('0x7d')]][0x0]][_0xc974('0x71')](/"/g,'\x27'));if(!_[_0xc974('0x1b')](_0x433940))_0x1efbcf=_0x1efbcf+'§'+_0x433940;}if(_0x12e633=='')_0x12e633=_0x1efbcf;else _0x12e633+='|'+_0x1efbcf;}_0x902fc5[_0xc974('0x1e')](_0x5e44c0['id']+':'+_0x12e633);_0x5ae7a4[_0x5e44c0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x361e4c[_0xc974('0x1e')]('\x22'+_0x902fc5['join'](';')+'\x22');}if(_0xcc861a[_0xc974('0x1a')]){handleError(_0x264e9e['data'][_0x435d66],{'code':'SystemRow','message':_0xcc861a[_0xc974('0x13')]()});}else{fs[_0xc974('0x7e')](_0x3e2104,_0x361e4c[_0xc974('0x13')]()+'\x0a');}_0x361e4c=[];}if(!(stats[_0xc974('0x6c')]%0xc8)){socket[_0xc974('0x7f')]('contact:import:'+_0x3170a9,stats);stats[_0xc974('0x5c')]=[];}}if(stopped){logger[_0xc974('0x5d')](_0xc974('0x80'));_0x5ef692[_0xc974('0x81')]();}}catch(_0x58b45c){handleError(_0x264e9e[_0xc974('0x6d')][_0x435d66],{'code':_0xc974('0x82'),'message':_0x58b45c['message']});logger[_0xc974('0x21')]('step',_0x58b45c[_0xc974('0x22')]);}},'complete':function(){try{var _0x2223ee=[];var _0x16f927=tempTableName;_0x2223ee[_0xc974('0x1e')](_0xc974('0x83')+_0x16f927+_0xc974('0x84'));logger[_0xc974('0x5d')](_0xc974('0x85'),contactItemTypes['length']);var _0x14fda4=util[_0xc974('0xd')](_0xc974('0x86'),_0x3e2104,_0x16f927,_0x167f50,_0x2901e4[_0xc974('0x55')],_0x2901e4[_0xc974('0x87')]||null,NOW,NOW);if(_[_0xc974('0x1b')](_0x452484[_0xc974('0x35')])){_0x14fda4+=_0xc974('0x88');}_0x2223ee['push'](_0x14fda4);BPromise['each'](_0x2223ee,handleQuery)[_0xc974('0x20')](function(_0x539e33){BPromise['all']([handleAdditionalPhones()])[_0xc974('0x20')](function(){_0x2223ee=[];for(var _0x5e5164=0x0;_0x5e5164=_0x57e48f){return _0x49277f[_0x9bb2('0x15')](0x193)[_0x9bb2('0x16')]({'message':util['format'](_0x9bb2('0x17'),_0x2012a9)});}_0x440019();})['catch'](function(_0x49ddf5){_0x440019(_0x49ddf5);});});}function isUserLimit(){return isLimit(_0x9bb2('0x18'),0x1,db[_0x9bb2('0x19')],{'where':{'$or':[{'role':_0x9bb2('0x1a')},{'role':_0x9bb2('0x1b')}]}});}exports[_0x9bb2('0x1c')]=isUserLimit; \ No newline at end of file +var _0x2986=['User','isUserLimit','util','composable-middleware','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','findOne','then','count','status','users'];(function(_0x34c4d3,_0x1d0a3a){var _0x2aa322=function(_0x43d0b4){while(--_0x43d0b4){_0x34c4d3['push'](_0x34c4d3['shift']());}};_0x2aa322(++_0x1d0a3a);}(_0x2986,0xf4));var _0x6298=function(_0x3812bb,_0x95d8e){_0x3812bb=_0x3812bb-0x0;var _0x3d7fd6=_0x2986[_0x3812bb];return _0x3d7fd6;};'use strict';var crypto=require('crypto');var util=require(_0x6298('0x0'));var compose=require(_0x6298('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x6298('0x2'));function getValueFromLicense(_0x11f075,_0x9a845b){if(_0x11f075&&_0x9a845b){if(_0x9a845b[_0x6298('0x3')]&&_0x9a845b[_0x6298('0x4')]){var _0x2919df=_0x9a845b[_0x6298('0x3')];var _0x1f2dca=_0x9a845b[_0x6298('0x4')];var _0x2c5847=_0x2919df[_0x6298('0x5')]('-')[0x4];var _0x3b99e8=_0x2919df[_0x6298('0x5')]('-')[0x0];var _0x33afaa=crypto['createDecipher'](_0x6298('0x6'),util[_0x6298('0x7')](_0x6298('0x8'),_0x2c5847,_0x2919df,_0x3b99e8));var _0x2637d8=_0x33afaa['update'](_0x1f2dca,_0x6298('0x9'),_0x6298('0xa'));_0x2637d8+=_0x33afaa[_0x6298('0xb')](_0x6298('0xa'));var _0x538427=JSON[_0x6298('0xc')](_0x2637d8);return _0x538427[_0x6298('0xd')](_0x11f075)?_0x538427[_0x11f075]:null;}}return null;}function isLimit(_0x738693,_0x105eff,_0x25bfb5,_0x9c5a8d){var _0x4ec723=_0x105eff;return compose()[_0x6298('0xe')](function(_0x5c0162,_0x2ab9c0,_0x463380){return db['License'][_0x6298('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x6298('0x10')](function(_0x3cf605){var _0x217177=getValueFromLicense(_0x738693,_0x3cf605);return _0x217177?_0x217177:_0x4ec723;})[_0x6298('0x10')](function(_0x5baf49){_0x4ec723=_0x5baf49;return _0x25bfb5[_0x6298('0x11')](_0x9c5a8d);})['then'](function(_0x1d975c){if(_0x1d975c>=_0x4ec723){return _0x2ab9c0[_0x6298('0x12')](0x193)['json']({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x738693)});}_0x463380();})['catch'](function(_0x48b27e){_0x463380(_0x48b27e);});});}function isUserLimit(){return isLimit(_0x6298('0x13'),0x1,db[_0x6298('0x14')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x6298('0x15')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index e8b470a..b5010f5 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 _0x0c3d=['hours','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith','[$or]','replace','[$and]','split','slice','forEach','shift','match','push','buildExpression','operator','$eq','$between','value','$gt','$lte','days','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','text','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','add'];(function(_0x4113a3,_0x3eb56b){var _0x491e1f=function(_0x132633){while(--_0x132633){_0x4113a3['push'](_0x4113a3['shift']());}};_0x491e1f(++_0x3eb56b);}(_0x0c3d,0x1ab));var _0xd0c3=function(_0x31b7d7,_0x3de9ed){_0x31b7d7=_0x31b7d7-0x0;var _0x3a376e=_0x0c3d[_0x31b7d7];return _0x3a376e;};'use strict';var _=require(_0xd0c3('0x0'));var moment=require('moment');exports[_0xd0c3('0x1')]=function(_0x237f5f){var _0x1560de={'conditions':[]};_0x1560de[_0xd0c3('0x2')]=_[_0xd0c3('0x3')](_0x237f5f,_0xd0c3('0x4'))?'or':'and';var _0x580b25=_0x237f5f[_0xd0c3('0x5')](_0xd0c3('0x6'),'')['replace'](_0xd0c3('0x4'),'')['split']('||');for(var _0x3f7458=0x0;_0x3f7458<_0x580b25['length'];_0x3f7458++){var _0x24cc00=_0x580b25[_0x3f7458][_0xd0c3('0x7')](':=');var _0x3b1818=_0x24cc00[0x0];var _0x1f3289=_0x24cc00[_0xd0c3('0x8')](0x1);_0x1f3289[_0xd0c3('0x9')](function(_0x54b80b){var _0x5204da=_0x54b80b[_0xd0c3('0x7')]('[')[_0xd0c3('0xa')]();var _0x1c78d7=_0x54b80b[_0xd0c3('0xb')](/\[(.*?)\]/g);_0x1c78d7['forEach'](function(_0x2aa211){var _0x478a1c=_0x2aa211['split']('[')['filter'](function(_0x556cf1){return _0x556cf1['indexOf'](']')>-0x1;})['map'](function(_0x2607e3){return _0x2607e3[_0xd0c3('0x7')](']')[0x0];})[0x0];_0x1560de['conditions'][_0xd0c3('0xc')]({'field':_0x3b1818,'operator':_0x5204da,'value':_0x478a1c});});});}return _0x1560de;};exports[_0xd0c3('0xd')]=function(_0x2721df,_0x219c73,_0x2a5d80){var _0x264686={};if(_0x219c73==='DATE'){if(_0x2a5d80[_0xd0c3('0xe')]===_0xd0c3('0xf')){_0x2a5d80[_0xd0c3('0xe')]=_0xd0c3('0x10');_0x2a5d80[_0xd0c3('0x11')]+=','+_0x2a5d80[_0xd0c3('0x11')];}else if(_['includes']([_0xd0c3('0x12'),_0xd0c3('0x13')],_0x2a5d80[_0xd0c3('0xe')])){_0x2a5d80['value']=moment(_0x2a5d80[_0xd0c3('0x11')])['add'](0x1,_0xd0c3('0x14'))[_0xd0c3('0x15')](_0xd0c3('0x16'));}}if(_0x2a5d80[_0xd0c3('0x17')]){_0x219c73=_0x2a5d80[_0xd0c3('0x17')];_0x264686['text']=_0xd0c3('0x18')+_0x2721df+'.'+_0x2a5d80[_0xd0c3('0x19')]+_0xd0c3('0x1a')+_0x2a5d80[_0xd0c3('0x17')]+')\x20'+parseOperator(_0x2a5d80[_0xd0c3('0xe')]);}else{_0x264686[_0xd0c3('0x1b')]=_0x2721df+'.'+_0x2a5d80[_0xd0c3('0x19')]+'\x20'+parseOperator(_0x2a5d80[_0xd0c3('0xe')]);}if(_['includes']([_0xd0c3('0x1c'),_0xd0c3('0x1d')],_0x2a5d80['operator']))_0x264686[_0xd0c3('0x1b')]='('+_0x264686[_0xd0c3('0x1b')]+'\x20OR\x20'+_0x2721df+'.'+_0x2a5d80[_0xd0c3('0x19')]+_0xd0c3('0x1e');_0x264686[_0xd0c3('0x11')]=parseValue(_0x219c73,_0x2a5d80[_0xd0c3('0xe')],_0x2a5d80[_0xd0c3('0x11')]);return _0x264686;};function parseOperator(_0x4afc0a){var _0x180b83;switch(_0x4afc0a){case _0xd0c3('0x1f'):_0x180b83=_0xd0c3('0x20');break;case'$notIn':_0x180b83=_0xd0c3('0x21');break;case'$eq':_0x180b83=_0xd0c3('0x22');break;case _0xd0c3('0x1c'):_0x180b83=_0xd0c3('0x23');break;case'$substring':case _0xd0c3('0x24'):case'$endsWith':_0x180b83=_0xd0c3('0x25');break;case _0xd0c3('0x26'):_0x180b83=_0xd0c3('0x27');break;case'$gt':_0x180b83=_0xd0c3('0x28');break;case'$lte':_0x180b83=_0xd0c3('0x29');break;case _0xd0c3('0x2a'):_0x180b83=_0xd0c3('0x2b');break;case _0xd0c3('0x10'):_0x180b83=_0xd0c3('0x2c');break;}return _0x180b83;}function parseValue(_0xd40a2,_0xf7cf04,_0x495e81){var _0x1caf25={'start':undefined,'end':undefined};switch(_0xf7cf04){case _0xd0c3('0x1f'):case _0xd0c3('0x1d'):_0x1caf25['start']=_0x495e81[_0xd0c3('0x7')](',');break;case'$substring':_0x1caf25['start']='%'+_0x495e81+'%';break;case _0xd0c3('0x24'):_0x1caf25['start']=_0x495e81+'%';break;case'$endsWith':_0x1caf25[_0xd0c3('0x2d')]='%'+_0x495e81;break;case'$between':var _0x52fede=_0x495e81[_0xd0c3('0x7')](',');var _0x495e81=_0x52fede[_0xd0c3('0xa')]();var _0x5004df=_0x52fede[_0xd0c3('0x2e')]();if(_0xd40a2===_0xd0c3('0x2f')){_0x495e81=moment(_0x495e81)[_0xd0c3('0x30')](0x0,!![])[_0xd0c3('0x15')]();_0x5004df=moment(_0x5004df)[_0xd0c3('0x30')](0x0,!![])[_0xd0c3('0x31')](0x17,_0xd0c3('0x32'))[_0xd0c3('0x31')](0x3b,_0xd0c3('0x33'))[_0xd0c3('0x31')](0x3b,_0xd0c3('0x34'))[_0xd0c3('0x15')]();}_0x1caf25={'start':_0x495e81,'end':_0x5004df};break;default:_0x1caf25[_0xd0c3('0x2d')]=_0x495e81;break;}return _0x1caf25;} \ No newline at end of file +var _0xcb1f=['format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','and','replace','[$and]','[$or]','split','length','forEach','shift','match','filter','indexOf','map','conditions','push','DATE','$eq','$between','value','includes','$gt','operator','add','days'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xcb1f,0x182));var _0xfcb1=function(_0x28c27f,_0x350b7e){_0x28c27f=_0x28c27f-0x0;var _0x576ea3=_0xcb1f[_0x28c27f];return _0x576ea3;};'use strict';var _=require('lodash');var moment=require(_0xfcb1('0x0'));exports[_0xfcb1('0x1')]=function(_0x243574){var _0x26d376={'conditions':[]};_0x26d376[_0xfcb1('0x2')]=_[_0xfcb1('0x3')](_0x243574,'[$or]')?'or':_0xfcb1('0x4');var _0x1d2b8f=_0x243574[_0xfcb1('0x5')](_0xfcb1('0x6'),'')['replace'](_0xfcb1('0x7'),'')[_0xfcb1('0x8')]('||');for(var _0x302255=0x0;_0x302255<_0x1d2b8f[_0xfcb1('0x9')];_0x302255++){var _0x33c728=_0x1d2b8f[_0x302255][_0xfcb1('0x8')](':=');var _0x7f8dd8=_0x33c728[0x0];var _0x2a5c23=_0x33c728['slice'](0x1);_0x2a5c23[_0xfcb1('0xa')](function(_0x5ce1ef){var _0x3a4002=_0x5ce1ef[_0xfcb1('0x8')]('[')[_0xfcb1('0xb')]();var _0x28993=_0x5ce1ef[_0xfcb1('0xc')](/\[(.*?)\]/g);_0x28993[_0xfcb1('0xa')](function(_0xfe9acd){var _0x416fd5=_0xfe9acd[_0xfcb1('0x8')]('[')[_0xfcb1('0xd')](function(_0x1fa9f1){return _0x1fa9f1[_0xfcb1('0xe')](']')>-0x1;})[_0xfcb1('0xf')](function(_0x17bdca){return _0x17bdca[_0xfcb1('0x8')](']')[0x0];})[0x0];_0x26d376[_0xfcb1('0x10')][_0xfcb1('0x11')]({'field':_0x7f8dd8,'operator':_0x3a4002,'value':_0x416fd5});});});}return _0x26d376;};exports['buildExpression']=function(_0xde01d1,_0x36157a,_0x3c459d){var _0x4d5a94={};if(_0x36157a===_0xfcb1('0x12')){if(_0x3c459d['operator']===_0xfcb1('0x13')){_0x3c459d['operator']=_0xfcb1('0x14');_0x3c459d[_0xfcb1('0x15')]+=','+_0x3c459d[_0xfcb1('0x15')];}else if(_[_0xfcb1('0x16')]([_0xfcb1('0x17'),'$lte'],_0x3c459d[_0xfcb1('0x18')])){_0x3c459d['value']=moment(_0x3c459d[_0xfcb1('0x15')])[_0xfcb1('0x19')](0x1,_0xfcb1('0x1a'))[_0xfcb1('0x1b')](_0xfcb1('0x1c'));}}if(_0x3c459d[_0xfcb1('0x1d')]){_0x36157a=_0x3c459d['castTo'];_0x4d5a94[_0xfcb1('0x1e')]=_0xfcb1('0x1f')+_0xde01d1+'.'+_0x3c459d[_0xfcb1('0x20')]+_0xfcb1('0x21')+_0x3c459d[_0xfcb1('0x1d')]+')\x20'+parseOperator(_0x3c459d[_0xfcb1('0x18')]);}else{_0x4d5a94[_0xfcb1('0x1e')]=_0xde01d1+'.'+_0x3c459d[_0xfcb1('0x20')]+'\x20'+parseOperator(_0x3c459d[_0xfcb1('0x18')]);}if(_[_0xfcb1('0x16')]([_0xfcb1('0x22'),_0xfcb1('0x23')],_0x3c459d[_0xfcb1('0x18')]))_0x4d5a94[_0xfcb1('0x1e')]='('+_0x4d5a94['text']+_0xfcb1('0x24')+_0xde01d1+'.'+_0x3c459d[_0xfcb1('0x20')]+_0xfcb1('0x25');_0x4d5a94[_0xfcb1('0x15')]=parseValue(_0x36157a,_0x3c459d[_0xfcb1('0x18')],_0x3c459d['value']);return _0x4d5a94;};function parseOperator(_0x457b68){var _0x1a5ecb;switch(_0x457b68){case _0xfcb1('0x26'):_0x1a5ecb=_0xfcb1('0x27');break;case _0xfcb1('0x23'):_0x1a5ecb=_0xfcb1('0x28');break;case _0xfcb1('0x13'):_0x1a5ecb='=\x20?';break;case _0xfcb1('0x22'):_0x1a5ecb=_0xfcb1('0x29');break;case _0xfcb1('0x2a'):case _0xfcb1('0x2b'):case _0xfcb1('0x2c'):_0x1a5ecb=_0xfcb1('0x2d');break;case _0xfcb1('0x2e'):_0x1a5ecb=_0xfcb1('0x2f');break;case _0xfcb1('0x17'):_0x1a5ecb=_0xfcb1('0x30');break;case'$lte':_0x1a5ecb=_0xfcb1('0x31');break;case _0xfcb1('0x32'):_0x1a5ecb=_0xfcb1('0x33');break;case'$between':_0x1a5ecb=_0xfcb1('0x34');break;}return _0x1a5ecb;}function parseValue(_0x1e614f,_0x4427c7,_0x2147d4){var _0x9ba4e6={'start':undefined,'end':undefined};switch(_0x4427c7){case _0xfcb1('0x26'):case _0xfcb1('0x23'):_0x9ba4e6['start']=_0x2147d4[_0xfcb1('0x8')](',');break;case'$substring':_0x9ba4e6[_0xfcb1('0x35')]='%'+_0x2147d4+'%';break;case _0xfcb1('0x2b'):_0x9ba4e6[_0xfcb1('0x35')]=_0x2147d4+'%';break;case _0xfcb1('0x2c'):_0x9ba4e6[_0xfcb1('0x35')]='%'+_0x2147d4;break;case _0xfcb1('0x14'):var _0x46c1e9=_0x2147d4['split'](',');var _0x2147d4=_0x46c1e9['shift']();var _0x41a007=_0x46c1e9[_0xfcb1('0x36')]();if(_0x1e614f===_0xfcb1('0x12')){_0x2147d4=moment(_0x2147d4)[_0xfcb1('0x37')](0x0,!![])[_0xfcb1('0x1b')]();_0x41a007=moment(_0x41a007)[_0xfcb1('0x37')](0x0,!![])[_0xfcb1('0x19')](0x17,_0xfcb1('0x38'))['add'](0x3b,_0xfcb1('0x39'))[_0xfcb1('0x19')](0x3b,_0xfcb1('0x3a'))[_0xfcb1('0x1b')]();}_0x9ba4e6={'start':_0x2147d4,'end':_0x41a007};break;default:_0x9ba4e6[_0xfcb1('0x35')]=_0x2147d4;break;}return _0x9ba4e6;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 97729a3..1f225c4 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 _0x2d17=['indexOf','unsigned','substr','priority','cast','col','length','omit','unset','match','^[+]?[0-9]*$','isEmail','forEach','replace','join','getOptions','query','$id','model','name','keys','intersection','attributes','hasOwnProperty','offset','order','where','pick','filter','object','columns','merge','VIRTUAL','lower','lodash','sequelize','parse','includes','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','uniqueid','isArray','limit','sort','map'];(function(_0x185803,_0x552733){var _0x211da9=function(_0x39d7a5){while(--_0x39d7a5){_0x185803['push'](_0x185803['shift']());}};_0x211da9(++_0x552733);}(_0x2d17,0x17e));var _0x72d1=function(_0x386d0e,_0x4623ef){_0x386d0e=_0x386d0e-0x0;var _0x4cf25d=_0x2d17[_0x386d0e];return _0x4cf25d;};'use strict';var _=require(_0x72d1('0x0'));var sequelize=require(_0x72d1('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x12f23c){var _0x4727f9=['ne'];try{var _0x531f4e=JSON[_0x72d1('0x2')](_0x12f23c);var _0x38fec7=Object['keys'](_0x531f4e)[0x0];return _0x4727f9[_0x72d1('0x3')](_0x38fec7);}catch(_0x4dfee1){return![];}}function getOperatorValue(_0x39150f){var _0x50f551=JSON[_0x72d1('0x2')](_0x39150f);var _0x239d1f=Object['keys'](_0x50f551)[0x0];var _0x477264=_0x50f551[_0x239d1f];return{['$'+_0x239d1f]:_0x477264};}exports[_0x72d1('0x4')]=function(_0x19e248){var _0x4e7f3e=null;if(_0x19e248){_0x4e7f3e=_0x19e248[_0x72d1('0x5')](',');}return _0x4e7f3e;};exports[_0x72d1('0x6')]=function(_0x283775,_0x593c91){var _0x1d7520={};if(!_[_0x72d1('0x7')](_0x283775)){_[_0x72d1('0x8')](_0x283775,function(_0x14a41e,_0x3cb9c2){try{if(_0x593c91){var _0x3916f2=_[_0x72d1('0x9')](_0x593c91,{'name':_0x3cb9c2})||{};if(hasSequelizeOperator(_0x14a41e)){_0x1d7520[_0x3cb9c2]=getOperatorValue(_0x14a41e);}else if(_0x3916f2[_0x72d1('0xa')]===_0x72d1('0xb')&&_[_0x72d1('0xc')](_0x14a41e)){var _0x5ad4df=JSON[_0x72d1('0x2')](_0x14a41e);var _0x37017c={'$gte':moment(moment(_0x5ad4df[_0x72d1('0xd')])[_0x72d1('0xe')](_0x72d1('0xf')))[_0x72d1('0x10')]()[_0x72d1('0xe')](),'$lte':moment(moment(_0x5ad4df[_0x72d1('0x11')])[_0x72d1('0xe')](_0x72d1('0xf')))[_0x72d1('0x10')]()[_0x72d1('0x12')](0x1,'s')[_0x72d1('0xe')]()};_0x1d7520[_0x3cb9c2]=_0x37017c;}else if(_0x3916f2['name']===_0x72d1('0x13')){_0x1d7520[_0x3cb9c2]=_0x14a41e;}else{_0x1d7520[_0x3cb9c2]=_['isArray'](_0x14a41e)?_0x14a41e:JSON[_0x72d1('0x2')](_0x14a41e);}}else{_0x1d7520[_0x3cb9c2]=_[_0x72d1('0x14')](_0x14a41e)?_0x14a41e:JSON['parse'](_0x14a41e);}}catch(_0x1061b7){_0x1d7520[_0x3cb9c2]=_0x14a41e[_0x72d1('0x5')](',');}});}return _0x1d7520;};exports[_0x72d1('0x15')]=function(_0x49caf4){_0x49caf4=parseInt(_0x49caf4,0xa);if(!_0x49caf4||_0x49caf4<0x0){_0x49caf4=LIMIT_VALUE;}return _0x49caf4;};exports['offset']=function(_0x313d7b){_0x313d7b=parseInt(_0x313d7b,0xa);if(!_0x313d7b||_0x313d7b<0x0){_0x313d7b=0x0;}return _0x313d7b;};exports[_0x72d1('0x16')]=function(_0x2233cb){var _0x1865c1,_0x8d6890=null;if(_0x2233cb){_0x1865c1=_0x2233cb[_0x72d1('0x5')](',');_0x8d6890=_[_0x72d1('0x17')](_0x1865c1,function(_0x5c7982){if(_0x5c7982[_0x72d1('0x18')]('-')===0x0){return[_0x5c7982==='priority'?sequelize['cast'](sequelize['col']('priority'),_0x72d1('0x19')):_0x5c7982[_0x72d1('0x1a')](0x1),'DESC'];}else{return[_0x5c7982===_0x72d1('0x1b')?sequelize[_0x72d1('0x1c')](sequelize[_0x72d1('0x1d')](_0x72d1('0x1b')),_0x72d1('0x19')):_0x5c7982,'ASC'];}});}return _0x8d6890;};exports['omit']=function(_0x188eca,_0x36bc65){if(_[_0x72d1('0x7')](_0x188eca)){return _0x188eca;}if(_[_0x72d1('0x14')](_0x188eca)){for(var _0xdf6a69=0x0;_0xdf6a69<_0x188eca[_0x72d1('0x1e')];_0xdf6a69+=0x1){_0x188eca[_0xdf6a69]=this[_0x72d1('0x1f')](_0x188eca[_0xdf6a69],_0x36bc65);}return _0x188eca;}if(!_['isObject'](_0x188eca)){return _0x188eca;}if(_['isString'](_0x36bc65)){_0x36bc65=[_0x36bc65];}if(!_[_0x72d1('0x14')](_0x36bc65)){return _0x188eca;}for(var _0x482cb8=0x0;_0x482cb8<_0x36bc65[_0x72d1('0x1e')];_0x482cb8+=0x1){_[_0x72d1('0x20')](_0x188eca,_0x36bc65[_0x482cb8]);}for(var _0x2c113d in _0x188eca){if(_0x188eca['hasOwnProperty'](_0x2c113d)){_0x188eca[_0x2c113d]=this[_0x72d1('0x1f')](_0x188eca[_0x2c113d],_0x36bc65);}}return _0x188eca;};exports['isNumeric']=function(_0x707cd0){return _0x707cd0[_0x72d1('0x21')](RegExp(_0x72d1('0x22')))?!![]:![];};exports[_0x72d1('0x23')]=function(_0x51242b){return _0x51242b[_0x72d1('0x21')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x42c03c){var _0x32dc5e=[];_0x42c03c['split'](/[ ,]+/)[_0x72d1('0x24')](function(_0x358b0c){_0x358b0c=_0x358b0c[_0x72d1('0x25')](/([^:]")"+/g,'$1');_0x358b0c='+'+_0x358b0c+'*';var _0x11ea2f=/[ `!@#$%^&*()_\-?~]/;if(_0x358b0c[_0x72d1('0x21')](_0x11ea2f))_0x358b0c='\x22'+_0x358b0c+'\x22';_0x32dc5e['push'](_0x358b0c);});return _0x32dc5e[_0x72d1('0x26')]('\x20');};exports[_0x72d1('0x27')]=function(_0x9efc2f,_0x482033,_0x244f4a){var _0x14669a={},_0x4a2909={};if(_0x482033[_0x72d1('0x28')][_0x72d1('0x29')]){_0x482033[_0x72d1('0x28')]['id']=_0x482033['query'][_0x72d1('0x29')];delete _0x482033['query'][_0x72d1('0x29')];}_0x14669a[_0x72d1('0x2a')]=_[_0x72d1('0x17')](_0x9efc2f,_0x72d1('0x2b'));_0x14669a[_0x72d1('0x28')]=_[_0x72d1('0x2c')](_0x482033[_0x72d1('0x28')]);_0x14669a[_0x72d1('0x6')]=_[_0x72d1('0x2d')](_0x14669a[_0x72d1('0x2a')],_0x14669a[_0x72d1('0x28')]);_0x4a2909['attributes']=_[_0x72d1('0x2d')](_0x14669a[_0x72d1('0x2a')],this[_0x72d1('0x4')](_0x482033[_0x72d1('0x28')]['fields']));_0x4a2909[_0x72d1('0x2e')]=_0x4a2909[_0x72d1('0x2e')][_0x72d1('0x1e')]?_0x4a2909['attributes']:_0x14669a[_0x72d1('0x2a')];if(!_0x482033[_0x72d1('0x28')][_0x72d1('0x2f')]('nolimit')){_0x4a2909[_0x72d1('0x15')]=this[_0x72d1('0x15')](_0x482033[_0x72d1('0x28')]['limit']);_0x4a2909[_0x72d1('0x30')]=this[_0x72d1('0x30')](_0x482033[_0x72d1('0x28')][_0x72d1('0x30')]);}_0x4a2909[_0x72d1('0x31')]=this[_0x72d1('0x16')](_0x482033[_0x72d1('0x28')]['sort']);_0x4a2909[_0x72d1('0x32')]=this[_0x72d1('0x6')](_[_0x72d1('0x33')](_0x482033[_0x72d1('0x28')],_0x14669a[_0x72d1('0x6')]),_0x9efc2f);if(_0x482033[_0x72d1('0x28')][_0x72d1('0x34')]){var _0x1d4fdf=_0x9efc2f;var _0x55438b=_0x482033[_0x72d1('0x28')][_0x72d1('0x34')];if(typeof _0x55438b===_0x72d1('0x35')){_0x1d4fdf=_[_0x72d1('0x34')](_0x9efc2f,function(_0x45870b){return _[_0x72d1('0x3')](_0x55438b[_0x72d1('0x36')],_0x45870b[_0x72d1('0x2b')]);});_0x55438b=_0x55438b['value'];}_0x4a2909['where']=_[_0x72d1('0x37')](_0x4a2909[_0x72d1('0x32')],{'$or':_[_0x72d1('0x17')](_0x1d4fdf,function(_0x21d361){if(_0x21d361['type']!==_0x72d1('0x38')){if(_0x244f4a){return sequelize[_0x72d1('0x32')](sequelize['fn']('lower',sequelize[_0x72d1('0x1d')](_0x21d361['name'])),{'$like':sequelize['fn'](_0x72d1('0x39'),'%'+_0x482033[_0x72d1('0x28')]['filter']+'%')});}else{var _0x37c69a={};_0x37c69a[_0x21d361['name']]={'$like':'%'+_0x482033['query']['filter']+'%'};return _0x37c69a;}}})});}_0x4a2909=_[_0x72d1('0x37')]({},_0x4a2909,_0x482033['options']);return _0x4a2909;}; \ No newline at end of file +var _0x207c=['forOwn','find','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','name','uniqueid','isArray','split','sort','map','indexOf','priority','cast','col','substr','unsigned','ASC','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','attributes','intersection','limit','offset','order','filter','object','columns','value','where','merge','type','VIRTUAL','lower','options','sequelize','moment','parse','includes','keys','fields','filters','isEmpty'];(function(_0x1ebd03,_0xb4268b){var _0x754983=function(_0x5c7ad6){while(--_0x5c7ad6){_0x1ebd03['push'](_0x1ebd03['shift']());}};_0x754983(++_0xb4268b);}(_0x207c,0x1e8));var _0xc207=function(_0x44dc4c,_0x357e6a){_0x44dc4c=_0x44dc4c-0x0;var _0x4e644e=_0x207c[_0x44dc4c];return _0x4e644e;};'use strict';var _=require('lodash');var sequelize=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1a420a){var _0xaaba3d=['ne'];try{var _0x2b40be=JSON[_0xc207('0x2')](_0x1a420a);var _0x1dd107=Object['keys'](_0x2b40be)[0x0];return _0xaaba3d[_0xc207('0x3')](_0x1dd107);}catch(_0x59bc89){return![];}}function getOperatorValue(_0x5a727b){var _0x55023e=JSON[_0xc207('0x2')](_0x5a727b);var _0x314561=Object[_0xc207('0x4')](_0x55023e)[0x0];var _0x59ff6f=_0x55023e[_0x314561];return{['$'+_0x314561]:_0x59ff6f};}exports[_0xc207('0x5')]=function(_0xad159b){var _0x3c579f=null;if(_0xad159b){_0x3c579f=_0xad159b['split'](',');}return _0x3c579f;};exports[_0xc207('0x6')]=function(_0x817576,_0x216e14){var _0x13ec41={};if(!_[_0xc207('0x7')](_0x817576)){_[_0xc207('0x8')](_0x817576,function(_0x487d95,_0x574425){try{if(_0x216e14){var _0x5b556f=_[_0xc207('0x9')](_0x216e14,{'name':_0x574425})||{};if(hasSequelizeOperator(_0x487d95)){_0x13ec41[_0x574425]=getOperatorValue(_0x487d95);}else if(_0x5b556f['type']===_0xc207('0xa')&&_[_0xc207('0xb')](_0x487d95)){var _0x59d401=JSON[_0xc207('0x2')](_0x487d95);var _0xb86b06={'$gte':moment(moment(_0x59d401[_0xc207('0xc')])[_0xc207('0xd')](_0xc207('0xe')))['utc']()[_0xc207('0xd')](),'$lte':moment(moment(_0x59d401[_0xc207('0xf')])[_0xc207('0xd')](_0xc207('0xe')))['utc']()['subtract'](0x1,'s')['format']()};_0x13ec41[_0x574425]=_0xb86b06;}else if(_0x5b556f[_0xc207('0x10')]===_0xc207('0x11')){_0x13ec41[_0x574425]=_0x487d95;}else{_0x13ec41[_0x574425]=_[_0xc207('0x12')](_0x487d95)?_0x487d95:JSON[_0xc207('0x2')](_0x487d95);}}else{_0x13ec41[_0x574425]=_['isArray'](_0x487d95)?_0x487d95:JSON[_0xc207('0x2')](_0x487d95);}}catch(_0x282595){_0x13ec41[_0x574425]=_0x487d95[_0xc207('0x13')](',');}});}return _0x13ec41;};exports['limit']=function(_0x4129b8){_0x4129b8=parseInt(_0x4129b8,0xa);if(!_0x4129b8||_0x4129b8<0x0){_0x4129b8=LIMIT_VALUE;}return _0x4129b8;};exports['offset']=function(_0x42c8ba){_0x42c8ba=parseInt(_0x42c8ba,0xa);if(!_0x42c8ba||_0x42c8ba<0x0){_0x42c8ba=0x0;}return _0x42c8ba;};exports[_0xc207('0x14')]=function(_0x131dc8){var _0x461f6a,_0xce0770=null;if(_0x131dc8){_0x461f6a=_0x131dc8[_0xc207('0x13')](',');_0xce0770=_[_0xc207('0x15')](_0x461f6a,function(_0x464dea){if(_0x464dea[_0xc207('0x16')]('-')===0x0){return[_0x464dea===_0xc207('0x17')?sequelize[_0xc207('0x18')](sequelize[_0xc207('0x19')](_0xc207('0x17')),'unsigned'):_0x464dea[_0xc207('0x1a')](0x1),'DESC'];}else{return[_0x464dea===_0xc207('0x17')?sequelize[_0xc207('0x18')](sequelize[_0xc207('0x19')](_0xc207('0x17')),_0xc207('0x1b')):_0x464dea,_0xc207('0x1c')];}});}return _0xce0770;};exports[_0xc207('0x1d')]=function(_0x1493fb,_0xa52138){if(_[_0xc207('0x7')](_0x1493fb)){return _0x1493fb;}if(_[_0xc207('0x12')](_0x1493fb)){for(var _0x27df03=0x0;_0x27df03<_0x1493fb[_0xc207('0x1e')];_0x27df03+=0x1){_0x1493fb[_0x27df03]=this[_0xc207('0x1d')](_0x1493fb[_0x27df03],_0xa52138);}return _0x1493fb;}if(!_[_0xc207('0x1f')](_0x1493fb)){return _0x1493fb;}if(_['isString'](_0xa52138)){_0xa52138=[_0xa52138];}if(!_[_0xc207('0x12')](_0xa52138)){return _0x1493fb;}for(var _0x5e0bd1=0x0;_0x5e0bd1<_0xa52138['length'];_0x5e0bd1+=0x1){_[_0xc207('0x20')](_0x1493fb,_0xa52138[_0x5e0bd1]);}for(var _0x3a05f3 in _0x1493fb){if(_0x1493fb[_0xc207('0x21')](_0x3a05f3)){_0x1493fb[_0x3a05f3]=this[_0xc207('0x1d')](_0x1493fb[_0x3a05f3],_0xa52138);}}return _0x1493fb;};exports[_0xc207('0x22')]=function(_0x478af7){return _0x478af7[_0xc207('0x23')](RegExp(_0xc207('0x24')))?!![]:![];};exports[_0xc207('0x25')]=function(_0x1bec3f){return _0x1bec3f[_0xc207('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0xc207('0x26')]=function(_0x2e6a3e){var _0x27bc72=[];_0x2e6a3e[_0xc207('0x13')](/[ ,]+/)[_0xc207('0x27')](function(_0x2043cf){_0x2043cf=_0x2043cf[_0xc207('0x28')](/([^:]")"+/g,'$1');_0x2043cf='+'+_0x2043cf+'*';var _0x3cd4b4=/[ `!@#$%^&*()_\-?~]/;if(_0x2043cf['match'](_0x3cd4b4))_0x2043cf='\x22'+_0x2043cf+'\x22';_0x27bc72[_0xc207('0x29')](_0x2043cf);});return _0x27bc72[_0xc207('0x2a')]('\x20');};exports[_0xc207('0x2b')]=function(_0x448df1,_0x24df00,_0x2ce133){var _0x47d4c9={},_0x18bf7e={};if(_0x24df00[_0xc207('0x2c')][_0xc207('0x2d')]){_0x24df00[_0xc207('0x2c')]['id']=_0x24df00['query'][_0xc207('0x2d')];delete _0x24df00[_0xc207('0x2c')][_0xc207('0x2d')];}_0x47d4c9[_0xc207('0x2e')]=_[_0xc207('0x15')](_0x448df1,_0xc207('0x10'));_0x47d4c9[_0xc207('0x2c')]=_[_0xc207('0x4')](_0x24df00[_0xc207('0x2c')]);_0x47d4c9['filters']=_['intersection'](_0x47d4c9[_0xc207('0x2e')],_0x47d4c9[_0xc207('0x2c')]);_0x18bf7e[_0xc207('0x2f')]=_[_0xc207('0x30')](_0x47d4c9['model'],this[_0xc207('0x5')](_0x24df00[_0xc207('0x2c')][_0xc207('0x5')]));_0x18bf7e[_0xc207('0x2f')]=_0x18bf7e[_0xc207('0x2f')]['length']?_0x18bf7e[_0xc207('0x2f')]:_0x47d4c9[_0xc207('0x2e')];if(!_0x24df00['query'][_0xc207('0x21')]('nolimit')){_0x18bf7e[_0xc207('0x31')]=this[_0xc207('0x31')](_0x24df00['query'][_0xc207('0x31')]);_0x18bf7e[_0xc207('0x32')]=this[_0xc207('0x32')](_0x24df00['query']['offset']);}_0x18bf7e[_0xc207('0x33')]=this[_0xc207('0x14')](_0x24df00[_0xc207('0x2c')][_0xc207('0x14')]);_0x18bf7e['where']=this[_0xc207('0x6')](_['pick'](_0x24df00['query'],_0x47d4c9['filters']),_0x448df1);if(_0x24df00['query'][_0xc207('0x34')]){var _0x370d0d=_0x448df1;var _0xdde267=_0x24df00['query'][_0xc207('0x34')];if(typeof _0xdde267===_0xc207('0x35')){_0x370d0d=_[_0xc207('0x34')](_0x448df1,function(_0x5ae1ab){return _['includes'](_0xdde267[_0xc207('0x36')],_0x5ae1ab[_0xc207('0x10')]);});_0xdde267=_0xdde267[_0xc207('0x37')];}_0x18bf7e[_0xc207('0x38')]=_[_0xc207('0x39')](_0x18bf7e['where'],{'$or':_[_0xc207('0x15')](_0x370d0d,function(_0x19a67d){if(_0x19a67d[_0xc207('0x3a')]!==_0xc207('0x3b')){if(_0x2ce133){return sequelize[_0xc207('0x38')](sequelize['fn'](_0xc207('0x3c'),sequelize[_0xc207('0x19')](_0x19a67d[_0xc207('0x10')])),{'$like':sequelize['fn'](_0xc207('0x3c'),'%'+_0x24df00['query'][_0xc207('0x34')]+'%')});}else{var _0x16ed4f={};_0x16ed4f[_0x19a67d['name']]={'$like':'%'+_0x24df00[_0xc207('0x2c')][_0xc207('0x34')]+'%'};return _0x16ed4f;}}})});}_0x18bf7e=_[_0xc207('0x39')]({},_0x18bf7e,_0x24df00[_0xc207('0x3d')]);return _0x18bf7e;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 260c6de..d2b016f 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x3098f2,_0x859a3d){var _0x4f9e1a=function(_0x5e517f){while(--_0x5e517f){_0x3098f2['push'](_0x3098f2['shift']());}};_0x4f9e1a(++_0x859a3d);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _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(_0x590ef3,_0x3b2dd2){var _0x4502be=function(_0x2c8011){while(--_0x2c8011){_0x590ef3['push'](_0x590ef3['shift']());}};_0x4502be(++_0x3b2dd2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 118ecc4..b159f86 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 _0x5cbe=['length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','ipAddress','hex','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','orderBy','keys'];(function(_0x25bf56,_0x561e8){var _0x1119b4=function(_0x384d5d){while(--_0x384d5d){_0x25bf56['push'](_0x25bf56['shift']());}};_0x1119b4(++_0x561e8);}(_0x5cbe,0xf5));var _0xe5cb=function(_0x1d2d80,_0x2521b7){_0x1d2d80=_0x1d2d80-0x0;var _0x18e4be=_0x5cbe[_0x1d2d80];return _0x18e4be;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xe5cb('0x0'));var machine=require(_0xe5cb('0x1'));var exec=require(_0xe5cb('0x2'))[_0xe5cb('0x3')];var config=require(_0xe5cb('0x4'));function getInterfaces(){var _0x353057=[];var _0x105b7e=os['networkInterfaces']();var _0x4304e0=_[_0xe5cb('0x5')](_[_0xe5cb('0x6')](_0x105b7e));for(var _0x3baf72=0x0;_0x3baf72<_0x4304e0[_0xe5cb('0x7')];_0x3baf72++){var _0x5625b7=_0x105b7e[_0x4304e0[_0x3baf72]][_0xe5cb('0x8')](function(_0x2713e4){return _0x2713e4[_0xe5cb('0x9')]===_0xe5cb('0xa')&&_0x2713e4[_0xe5cb('0xb')]===![];});_0x353057=_0x353057[_0xe5cb('0xc')](_0x5625b7);}return _0x353057;}function getFirstInterface(){var _0x37206a=_[_0xe5cb('0xd')](getInterfaces());return{'macAddress':_0x37206a&&_0x37206a[_0xe5cb('0xe')]?_0x37206a[_0xe5cb('0xe')]:_0xe5cb('0xf'),'ipAddress':_0x37206a&&_0x37206a[_0xe5cb('0x10')]?_0x37206a['address']:_0xe5cb('0x11')};}exports[_0xe5cb('0x12')]=getFirstInterface;function getCPUhash(){var _0x1b1f5a=_[_0xe5cb('0x5')](os[_0xe5cb('0x13')]()[_0xe5cb('0x14')](function(_0x262cea){return _0x262cea[_0xe5cb('0x15')];}))[_0xe5cb('0x16')](':');return crypto[_0xe5cb('0x17')](_0xe5cb('0x18'))[_0xe5cb('0x19')](_0x1b1f5a)[_0xe5cb('0x1a')]('hex');}exports['getUuid']=function(){var _0x4e6851=os[_0xe5cb('0x1b')]();var _0xb4ccb1=/[0-9a-f-]{36}/;if(config[_0xe5cb('0x1c')]&&_0xb4ccb1[_0xe5cb('0x1d')](config[_0xe5cb('0x1c')])){return config['licenseToken'];}else if(_0x4e6851===_0xe5cb('0x1e')){return exec(_0xe5cb('0x1f'),{'encoding':_0xe5cb('0x20')})['replace']('\x0d\x0a','');}else{var _0x36b79c=getFirstInterface();var _0x2d7d76=getCPUhash();var _0x520a59=_0x2d7d76+'|'+os['hostname']()+'|'+_0x36b79c['macAddress']+'|'+_0x36b79c[_0xe5cb('0x21')];var _0x4c4aba=crypto[_0xe5cb('0x17')](_0xe5cb('0x18'))[_0xe5cb('0x19')](_0x520a59)[_0xe5cb('0x1a')](_0xe5cb('0x22'));return _0x4c4aba['substring'](0x0,0x8)+'-'+_0x4c4aba['substring'](0x8,0xc)+'-'+_0x4c4aba[_0xe5cb('0x23')](0xc,0x10)+'-'+_0x4c4aba[_0xe5cb('0x23')](0x10,0x14)+'-'+_0x4c4aba[_0xe5cb('0x23')](0x14);}}; \ No newline at end of file +var _0x0acf=['cpus','map','join','createHash','md5','digest','hex','getUuid','platform','licenseToken','test','win32','utf8','replace','hostname','ipAddress','substring','crypto','child_process','execSync','networkInterfaces','orderBy','keys','length','family','internal','mac','address','127.0.0.1','getFirstInterface'];(function(_0x5e370b,_0x152770){var _0x2e7dda=function(_0x453ebf){while(--_0x453ebf){_0x5e370b['push'](_0x5e370b['shift']());}};_0x2e7dda(++_0x152770);}(_0x0acf,0x1d3));var _0xf0ac=function(_0x2cad63,_0x15a505){_0x2cad63=_0x2cad63-0x0;var _0x2ac69e=_0x0acf[_0x2cad63];return _0x2ac69e;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xf0ac('0x0'));var machine=require('bimedia-machine-uuid');var exec=require(_0xf0ac('0x1'))[_0xf0ac('0x2')];var config=require('../environment');function getInterfaces(){var _0x3f2fb4=[];var _0x505d7f=os[_0xf0ac('0x3')]();var _0x12ee4b=_[_0xf0ac('0x4')](_[_0xf0ac('0x5')](_0x505d7f));for(var _0x336381=0x0;_0x336381<_0x12ee4b[_0xf0ac('0x6')];_0x336381++){var _0x473fe3=_0x505d7f[_0x12ee4b[_0x336381]]['filter'](function(_0x6a6e7f){return _0x6a6e7f[_0xf0ac('0x7')]==='IPv4'&&_0x6a6e7f[_0xf0ac('0x8')]===![];});_0x3f2fb4=_0x3f2fb4['concat'](_0x473fe3);}return _0x3f2fb4;}function getFirstInterface(){var _0x1b10cb=_['head'](getInterfaces());return{'macAddress':_0x1b10cb&&_0x1b10cb[_0xf0ac('0x9')]?_0x1b10cb[_0xf0ac('0x9')]:'00:00:00:00:00:00','ipAddress':_0x1b10cb&&_0x1b10cb[_0xf0ac('0xa')]?_0x1b10cb[_0xf0ac('0xa')]:_0xf0ac('0xb')};}exports[_0xf0ac('0xc')]=getFirstInterface;function getCPUhash(){var _0x39bfcf=_[_0xf0ac('0x4')](os[_0xf0ac('0xd')]()[_0xf0ac('0xe')](function(_0x18ee01){return _0x18ee01['model'];}))[_0xf0ac('0xf')](':');return crypto[_0xf0ac('0x10')](_0xf0ac('0x11'))['update'](_0x39bfcf)[_0xf0ac('0x12')](_0xf0ac('0x13'));}exports[_0xf0ac('0x14')]=function(){var _0x4dcf5f=os[_0xf0ac('0x15')]();var _0x28c721=/[0-9a-f-]{36}/;if(config[_0xf0ac('0x16')]&&_0x28c721[_0xf0ac('0x17')](config[_0xf0ac('0x16')])){return config[_0xf0ac('0x16')];}else if(_0x4dcf5f===_0xf0ac('0x18')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xf0ac('0x19')})[_0xf0ac('0x1a')]('\x0d\x0a','');}else{var _0x192379=getFirstInterface();var _0x357121=getCPUhash();var _0x4c1a1d=_0x357121+'|'+os[_0xf0ac('0x1b')]()+'|'+_0x192379['macAddress']+'|'+_0x192379[_0xf0ac('0x1c')];var _0x4f4397=crypto[_0xf0ac('0x10')](_0xf0ac('0x11'))['update'](_0x4c1a1d)[_0xf0ac('0x12')](_0xf0ac('0x13'));return _0x4f4397['substring'](0x0,0x8)+'-'+_0x4f4397[_0xf0ac('0x1d')](0x8,0xc)+'-'+_0x4f4397[_0xf0ac('0x1d')](0xc,0x10)+'-'+_0x4f4397[_0xf0ac('0x1d')](0x10,0x14)+'-'+_0x4f4397[_0xf0ac('0x1d')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index ee6da85..c1c2938 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 _0x4264=['catch','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s'];(function(_0x5401e2,_0x19d9b9){var _0x45d1f8=function(_0xa6985c){while(--_0xa6985c){_0x5401e2['push'](_0x5401e2['shift']());}};_0x45d1f8(++_0x19d9b9);}(_0x4264,0xd6));var _0x4426=function(_0x511c21,_0x5c08f6){_0x511c21=_0x511c21-0x0;var _0x53c462=_0x4264[_0x511c21];return _0x53c462;};'use strict';var util=require(_0x4426('0x0'));var moment=require(_0x4426('0x1'));var rp=require(_0x4426('0x2'));var BPromise=require(_0x4426('0x3'));var pkginfo=require('pkginfo')(module,_0x4426('0x4'));var db=require(_0x4426('0x5'))['db'];var encryptor=require(_0x4426('0x6'));var hardware=require('./hardware');var logger=require('../logger')(_0x4426('0x7'));var HOST=_0x4426('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x443104){return new BPromise(function(_0x15edc2,_0x2e2e5f){var _0x43c1e6=util[_0x4426('0x9')](_0x4426('0xa'),HOST,_0x443104,module[_0x4426('0xb')]['version']);if(oldToken){_0x43c1e6=util[_0x4426('0x9')](_0x4426('0xc'),HOST,_0x443104,module[_0x4426('0xb')][_0x4426('0x4')],oldToken);}var _0x3613cb={'uri':_0x43c1e6,'method':_0x4426('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x3613cb)[_0x4426('0xe')](function(_0x3b84bd){_0x15edc2(_0x3b84bd);})['catch'](function(_0x49899b){_0x2e2e5f(_0x49899b);});});}function manageLicense(_0x2e9931,_0x4510d9){var _0x3b4532=_0x4510d9[_0x4426('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x3b4532[_0x4426('0x10')]!==_0x2e9931&&!_0x3b4532['data2']){oldToken=_0x3b4532[_0x4426('0x10')];}httpRequest(_0x2e9931)[_0x4426('0xe')](function(_0x32d3e1){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x32d3e1[_0x4426('0x11')]){isOldTokenSent=![];if(!_0x3b4532['license']&&_0x3b4532[_0x4426('0x7')]!=_0x32d3e1[_0x4426('0x7')]||_0x3b4532[_0x4426('0x7')]&&_0x3b4532[_0x4426('0x12')]){logger[_0x4426('0x13')](_0x4426('0x14'));}if(_0x3b4532[_0x4426('0x7')]&&!_0x3b4532[_0x4426('0x12')]&&_0x3b4532[_0x4426('0x7')]!=_0x32d3e1[_0x4426('0x7')]){logger[_0x4426('0x13')](_0x4426('0x15'));}if(_0x3b4532[_0x4426('0x7')]&&!_0x3b4532['data2']&&_0x3b4532[_0x4426('0x7')]==_0x32d3e1[_0x4426('0x7')]){return _0x4510d9;}return _0x4510d9[_0x4426('0x16')]({'data1':_0x2e9931,'data2':null,'license':_0x32d3e1[_0x4426('0x7')]});}else{if(_0x32d3e1[_0x4426('0x7')]||_0x3b4532[_0x4426('0x7')]){if(!_0x3b4532[_0x4426('0x12')]){if(_0x3b4532['data1']==_0x2e9931){GRAY_PERIOD_REASON=_0x4426('0x17');logger[_0x4426('0x13')](_0x4426('0x18'));}else{GRAY_PERIOD_REASON=_0x4426('0x19');logger[_0x4426('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3b4532['data1'],_0x2e9931);}logger['info'](_0x4426('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0x4426('0x1b')));return _0x4510d9[_0x4426('0x16')]({'data2':encryptor[_0x4426('0x1c')](moment()['format'](_0x4426('0x1b')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x3b4532['data2']),_0x4426('0x1d'))>DAYS){logger['info'](_0x4426('0x1e'),moment()[_0x4426('0x9')](_0x4426('0x1b')));isOldTokenSent=![];return _0x4510d9['update']({'data1':_0x2e9931,'data2':null,'license':null});}}}else{if(_0x3b4532[_0x4426('0x10')]!=_0x2e9931){logger[_0x4426('0x13')](_0x4426('0x1f'),_0x3b4532[_0x4426('0x10')],_0x2e9931);return _0x4510d9['update']({'data1':_0x2e9931,'data2':null,'license':null});}}}return _0x4510d9;})[_0x4426('0xe')](function(_0x363e41){_0x4510d9=_0x363e41;})[_0x4426('0x20')](function(_0x3eb176){logger['error'](_0x3eb176['message']);})[_0x4426('0x21')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x4510d9);},TIME);});}function defaultLicense(){var _0xe83519=hardware[_0x4426('0x22')]();if(_0xe83519){return db[_0x4426('0x23')][_0x4426('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0xe83519}})[_0x4426('0x25')](function(_0x3453e8,_0x59b02d){logger[_0x4426('0x13')](_0x4426('0x26'),_0xe83519);manageLicense(_0xe83519,_0x3453e8);})[_0x4426('0x20')](function(_0x54ccfd){logger['error'](_0x54ccfd[_0x4426('0x27')]);});}}exports[_0x4426('0x28')]=defaultLicense; \ No newline at end of file +var _0x860a=['toUpperCase','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s'];(function(_0xc5bb7f,_0x336c16){var _0x5ed8f7=function(_0x6c77bf){while(--_0x6c77bf){_0xc5bb7f['push'](_0xc5bb7f['shift']());}};_0x5ed8f7(++_0x336c16);}(_0x860a,0x126));var _0xa860=function(_0x1bfc0a,_0x12e81a){_0x1bfc0a=_0x1bfc0a-0x0;var _0xca4adb=_0x860a[_0x1bfc0a];return _0xca4adb;};'use strict';var util=require(_0xa860('0x0'));var moment=require(_0xa860('0x1'));var rp=require(_0xa860('0x2'));var BPromise=require(_0xa860('0x3'));var pkginfo=require('pkginfo')(module,_0xa860('0x4'));var db=require(_0xa860('0x5'))['db'];var encryptor=require(_0xa860('0x6'));var hardware=require(_0xa860('0x7'));var logger=require('../logger')(_0xa860('0x8'));var HOST=_0xa860('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x6f7c84){return new BPromise(function(_0x4f8576,_0xaba604){var _0x4c655d=util[_0xa860('0xa')](_0xa860('0xb'),HOST,_0x6f7c84,module[_0xa860('0xc')]['version']);if(oldToken){_0x4c655d=util['format'](_0xa860('0xd'),HOST,_0x6f7c84,module[_0xa860('0xc')][_0xa860('0x4')],oldToken);}var _0x42be6b={'uri':_0x4c655d,'method':_0xa860('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x42be6b)[_0xa860('0xf')](function(_0x441646){_0x4f8576(_0x441646);})[_0xa860('0x10')](function(_0x441e02){_0xaba604(_0x441e02);});});}function manageLicense(_0x1a8342,_0x2a2696){var _0x3c32a6=_0x2a2696[_0xa860('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x3c32a6[_0xa860('0x12')]!==_0x1a8342&&!_0x3c32a6[_0xa860('0x13')]){oldToken=_0x3c32a6[_0xa860('0x12')];}httpRequest(_0x1a8342)[_0xa860('0xf')](function(_0x29c845){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x29c845['active']){isOldTokenSent=![];if(!_0x3c32a6[_0xa860('0x8')]&&_0x3c32a6['license']!=_0x29c845[_0xa860('0x8')]||_0x3c32a6[_0xa860('0x8')]&&_0x3c32a6[_0xa860('0x13')]){logger['info'](_0xa860('0x14'));}if(_0x3c32a6[_0xa860('0x8')]&&!_0x3c32a6[_0xa860('0x13')]&&_0x3c32a6[_0xa860('0x8')]!=_0x29c845[_0xa860('0x8')]){logger[_0xa860('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3c32a6['license']&&!_0x3c32a6[_0xa860('0x13')]&&_0x3c32a6[_0xa860('0x8')]==_0x29c845[_0xa860('0x8')]){return _0x2a2696;}return _0x2a2696[_0xa860('0x16')]({'data1':_0x1a8342,'data2':null,'license':_0x29c845[_0xa860('0x8')]});}else{if(_0x29c845[_0xa860('0x8')]||_0x3c32a6['license']){if(!_0x3c32a6[_0xa860('0x13')]){if(_0x3c32a6[_0xa860('0x12')]==_0x1a8342){GRAY_PERIOD_REASON=_0xa860('0x17');logger['info'](_0xa860('0x18'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xa860('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3c32a6[_0xa860('0x12')],_0x1a8342);}logger[_0xa860('0x15')](_0xa860('0x19'),GRAY_PERIOD_REASON[_0xa860('0x1a')](),moment()[_0xa860('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x2a2696[_0xa860('0x16')]({'data2':encryptor[_0xa860('0x1b')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xa860('0x1c')](encryptor[_0xa860('0x1d')](_0x3c32a6[_0xa860('0x13')]),_0xa860('0x1e'))>DAYS){logger[_0xa860('0x15')](_0xa860('0x1f'),moment()[_0xa860('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x2a2696[_0xa860('0x16')]({'data1':_0x1a8342,'data2':null,'license':null});}}}else{if(_0x3c32a6[_0xa860('0x12')]!=_0x1a8342){logger[_0xa860('0x15')](_0xa860('0x20'),_0x3c32a6[_0xa860('0x12')],_0x1a8342);return _0x2a2696[_0xa860('0x16')]({'data1':_0x1a8342,'data2':null,'license':null});}}}return _0x2a2696;})[_0xa860('0xf')](function(_0x32e187){_0x2a2696=_0x32e187;})[_0xa860('0x10')](function(_0x1e278d){logger[_0xa860('0x21')](_0x1e278d[_0xa860('0x22')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xa860('0x23')](),_0x2a2696);},TIME);});}function defaultLicense(){var _0x4974fd=hardware[_0xa860('0x23')]();if(_0x4974fd){return db['License'][_0xa860('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x4974fd}})[_0xa860('0x25')](function(_0x3dadaf,_0x3d6c0a){logger['info'](_0xa860('0x26'),_0x4974fd);manageLicense(_0x4974fd,_0x3dadaf);})['catch'](function(_0x4f7321){logger[_0xa860('0x21')](_0x4f7321['message']);});}}exports[_0xa860('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index c82b30a..d37dc94 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 _0xc5cb=['telephones','forEach','count','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','bluebird','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s','parse','demo','machineUuid','decryptString','gray','deadline','add','disabled','message','User','findAll','role','sequelize','COUNT','col','admin','user','telephone','users'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5cb,0x8e));var _0xbc5c=function(_0x50a031,_0x331563){_0x50a031=_0x50a031-0x0;var _0x241914=_0xc5cb[_0x50a031];return _0x241914;};'use strict';var util=require(_0xbc5c('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0xbc5c('0x1'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0xbc5c('0x2'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbc5c('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xbc5c('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbc5c('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xbc5c('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x13ccc2){return new BPromise(function(_0x550d27,_0x4ed3b3){return db[_0xbc5c('0x6')][_0xbc5c('0x7')](_[_0xbc5c('0x8')](_0x13ccc2,{'raw':!![],'where':{'id':0x1}}))[_0xbc5c('0x9')](function(_0x256304){return checkLicense(_0x256304,null);})['then'](function(_0x1daacf){_0x550d27(_0x1daacf);return;})[_0xbc5c('0xa')](function(_0x15d0e6){_0x4ed3b3(_0x15d0e6);});});}function checkLicense(_0x4ed507,_0xd5478c){if(!_0x4ed507){demoLicense[_0xbc5c('0xb')]=_0x4ed507[_0xbc5c('0xc')];return demoLicense;}try{var _0x3cd9b2=_0xd5478c||_0x4ed507[_0xbc5c('0xd')];if(_['isEmpty'](_0x3cd9b2)){throw new Error(_0xbc5c('0xe'));}var _0x5b7626=_0x4ed507[_0xbc5c('0xc')];var _0x31b089=_0x4ed507[_0xbc5c('0xf')];var _0x1c3c0e=_0x5b7626[_0xbc5c('0x10')]('-')[0x4];var _0x5e07c8=_0x5b7626[_0xbc5c('0x10')]('-')[0x0];var _0x3a4144=encryptor['decryptString'](_0x3cd9b2,util[_0xbc5c('0x11')](_0xbc5c('0x12'),_0x1c3c0e,_0x5b7626,_0x5e07c8));var _0x226490=JSON[_0xbc5c('0x13')](_0x3a4144);_0x226490[_0xbc5c('0x14')]=![];_0x226490[_0xbc5c('0xb')]=_0x5b7626;_0x226490[_0xbc5c('0x15')]=hardware[_0xbc5c('0x4')]();if(_0x31b089){var _0xd21bd5=encryptor[_0xbc5c('0x16')](_0x31b089);_0x226490[_0xbc5c('0x17')]=_0xd21bd5;_0x226490[_0xbc5c('0x18')]=moment(_0xd21bd5)[_0xbc5c('0x19')](0x7,'days')[_0xbc5c('0x11')]();_0x226490['grayReason']=_0x226490[_0xbc5c('0xb')]!=_0x226490['machineUuid']?'changed':_0xbc5c('0x1a');}return _0x226490;}catch(_0x2e8f02){breakingLicense[_0xbc5c('0xb')]=_0x4ed507[_0xbc5c('0xc')];breakingLicense['message']=_0x2e8f02[_0xbc5c('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3c7760,_0x2ee26c){getLicense()[_0xbc5c('0x9')](function(_0x1b6346){return db[_0xbc5c('0x1c')][_0xbc5c('0x1d')]({'attributes':[_0xbc5c('0x1e'),[db[_0xbc5c('0x1f')]['fn'](_0xbc5c('0x20'),db[_0xbc5c('0x1f')][_0xbc5c('0x21')](_0xbc5c('0x1e'))),'count']],'group':'role','where':{'role':{'$or':[_0xbc5c('0x22'),_0xbc5c('0x23'),_0xbc5c('0x24')]}},'raw':!![]})[_0xbc5c('0x9')](function(_0x9c23c6){var _0x5be7dd={'user':_0x1b6346[_0xbc5c('0x25')]||0x0,'telephone':_0x1b6346[_0xbc5c('0x26')]||0x0};_0x9c23c6[_0xbc5c('0x27')](function(_0x2898de){var _0x361e1f=_0x2898de[_0xbc5c('0x1e')]==='admin'?'user':_0x2898de['role'];_0x5be7dd[_0x361e1f]-=_0x2898de[_0xbc5c('0x28')];if(_0x5be7dd[_0x361e1f]<0x0)_0x5be7dd[_0x361e1f]=0x0;});_0x3c7760(_0x5be7dd);return;});})[_0xbc5c('0xa')](function(_0x35d544){_0x2ee26c(_0x35d544);});});}function checkUserLimits(_0x17f7da){return new BPromise(function(_0x597d78,_0x2f9bd0){getLimits()['then'](function(_0x31537d){var _0x46b519=_[_0xbc5c('0x29')](_[_0xbc5c('0x2a')](_0x17f7da,_0xbc5c('0x1e')),[_0xbc5c('0x22'),_0xbc5c('0x23'),_0xbc5c('0x24')]);var _0x1d4fc7=(_0x46b519['admin']||0x0)+(_0x46b519[_0xbc5c('0x23')]||0x0);var _0x321432=_0x46b519[_0xbc5c('0x24')]||0x0;if(_0x1d4fc7>_0x31537d['user'])return _0x2f9bd0('License\x20limit\x20reached\x20for\x20users');if(_0x321432>_0x31537d[_0xbc5c('0x24')])return _0x2f9bd0(_0xbc5c('0x2b'));return _0x597d78();})['catch'](function(_0x45e4fc){_0x2f9bd0(_0x45e4fc);});});}module[_0xbc5c('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xda4c=['admin','user','telephone','users','telephones','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','License','find','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','demo','machineUuid','deadline','grayReason','changed','disabled','message','findAll','sequelize','role','count'];(function(_0x57ff6d,_0x9b9ccb){var _0x5ca05=function(_0x4de92d){while(--_0x4de92d){_0x57ff6d['push'](_0x57ff6d['shift']());}};_0x5ca05(++_0x9b9ccb);}(_0xda4c,0x1ba));var _0xcda4=function(_0x431087,_0x11d9a6){_0x431087=_0x431087-0x0;var _0x2f0326=_0xda4c[_0x431087];return _0x2f0326;};'use strict';var util=require(_0xcda4('0x0'));var _=require('lodash');var moment=require(_0xcda4('0x1'));var BPromise=require('bluebird');var hardware=require(_0xcda4('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0xcda4('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcda4('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xcda4('0x5'),'machineUuid':hardware['getUuid'](),'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':_0xcda4('0x6'),'machineUuid':hardware[_0xcda4('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2f6af7){return new BPromise(function(_0x3f4933,_0x1ebbf9){return db[_0xcda4('0x8')][_0xcda4('0x9')](_['defaults'](_0x2f6af7,{'raw':!![],'where':{'id':0x1}}))[_0xcda4('0xa')](function(_0x4ef7a5){return checkLicense(_0x4ef7a5,null);})['then'](function(_0x150784){_0x3f4933(_0x150784);return;})['catch'](function(_0x3fc2ad){_0x1ebbf9(_0x3fc2ad);});});}function checkLicense(_0x1b7dab,_0x36ddaf){if(!_0x1b7dab){demoLicense[_0xcda4('0xb')]=_0x1b7dab[_0xcda4('0xc')];return demoLicense;}try{var _0x54c913=_0x36ddaf||_0x1b7dab[_0xcda4('0xd')];if(_[_0xcda4('0xe')](_0x54c913)){throw new Error(_0xcda4('0xf'));}var _0x17e9b4=_0x1b7dab[_0xcda4('0xc')];var _0x3768a6=_0x1b7dab['data2'];var _0xaa9256=_0x17e9b4[_0xcda4('0x10')]('-')[0x4];var _0x517760=_0x17e9b4['split']('-')[0x0];var _0xb5e315=encryptor[_0xcda4('0x11')](_0x54c913,util[_0xcda4('0x12')](_0xcda4('0x13'),_0xaa9256,_0x17e9b4,_0x517760));var _0x18bc48=JSON['parse'](_0xb5e315);_0x18bc48[_0xcda4('0x14')]=![];_0x18bc48['uuid']=_0x17e9b4;_0x18bc48[_0xcda4('0x15')]=hardware[_0xcda4('0x7')]();if(_0x3768a6){var _0x67684c=encryptor[_0xcda4('0x11')](_0x3768a6);_0x18bc48['gray']=_0x67684c;_0x18bc48[_0xcda4('0x16')]=moment(_0x67684c)['add'](0x7,'days')[_0xcda4('0x12')]();_0x18bc48[_0xcda4('0x17')]=_0x18bc48['uuid']!=_0x18bc48[_0xcda4('0x15')]?_0xcda4('0x18'):_0xcda4('0x19');}return _0x18bc48;}catch(_0x59589c){breakingLicense[_0xcda4('0xb')]=_0x1b7dab[_0xcda4('0xc')];breakingLicense['message']=_0x59589c[_0xcda4('0x1a')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x39376e,_0x540db6){getLicense()[_0xcda4('0xa')](function(_0x5cea75){return db['User'][_0xcda4('0x1b')]({'attributes':['role',[db[_0xcda4('0x1c')]['fn']('COUNT',db[_0xcda4('0x1c')]['col'](_0xcda4('0x1d'))),_0xcda4('0x1e')]],'group':_0xcda4('0x1d'),'where':{'role':{'$or':[_0xcda4('0x1f'),_0xcda4('0x20'),_0xcda4('0x21')]}},'raw':!![]})[_0xcda4('0xa')](function(_0x2aad3f){var _0x4b2778={'user':_0x5cea75[_0xcda4('0x22')]||0x0,'telephone':_0x5cea75[_0xcda4('0x23')]||0x0};_0x2aad3f[_0xcda4('0x24')](function(_0x5536f6){var _0x40eb77=_0x5536f6[_0xcda4('0x1d')]===_0xcda4('0x1f')?_0xcda4('0x20'):_0x5536f6[_0xcda4('0x1d')];_0x4b2778[_0x40eb77]-=_0x5536f6[_0xcda4('0x1e')];if(_0x4b2778[_0x40eb77]<0x0)_0x4b2778[_0x40eb77]=0x0;});_0x39376e(_0x4b2778);return;});})[_0xcda4('0x25')](function(_0x4b3fa7){_0x540db6(_0x4b3fa7);});});}function checkUserLimits(_0x470669){return new BPromise(function(_0x32f99e,_0x228d2a){getLimits()[_0xcda4('0xa')](function(_0x34223c){var _0x3942b7=_[_0xcda4('0x26')](_[_0xcda4('0x27')](_0x470669,_0xcda4('0x1d')),['admin',_0xcda4('0x20'),_0xcda4('0x21')]);var _0x3f0970=(_0x3942b7[_0xcda4('0x1f')]||0x0)+(_0x3942b7[_0xcda4('0x20')]||0x0);var _0x353fe0=_0x3942b7['telephone']||0x0;if(_0x3f0970>_0x34223c['user'])return _0x228d2a(_0xcda4('0x28'));if(_0x353fe0>_0x34223c[_0xcda4('0x21')])return _0x228d2a(_0xcda4('0x29'));return _0x32f99e();})['catch'](function(_0x5b52b0){_0x228d2a(_0x5b52b0);});});}module[_0xcda4('0x2a')]={'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 dd087a6..dbe94d7 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 _0x6a95=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x13d040,_0x3ee9cc){var _0x2f162c=function(_0x43cbc0){while(--_0x43cbc0){_0x13d040['push'](_0x13d040['shift']());}};_0x2f162c(++_0x3ee9cc);}(_0x6a95,0x1db));var _0x56a9=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x6a95[_0x220dbb];return _0x2b77de;};'use strict';module[_0x56a9('0x0')]={'DOMAIN':_0x56a9('0x1'),'SESSION_SECRET':_0x56a9('0x2'),'GOOGLE_ID':_0x56a9('0x3'),'GOOGLE_SECRET':_0x56a9('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x5eb8=['app-id','secret','myappanuglar-secret'];(function(_0x19d20f,_0x8b783e){var _0x25b511=function(_0x220b40){while(--_0x220b40){_0x19d20f['push'](_0x19d20f['shift']());}};_0x25b511(++_0x8b783e);}(_0x5eb8,0xb0));var _0x85eb=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0x5eb8[_0xa1e3ca];return _0x5005ab;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x85eb('0x0'),'GOOGLE_ID':_0x85eb('0x1'),'GOOGLE_SECRET':_0x85eb('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 60bd8ca..cf99e42 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7cf8=['exports','../utils/loggers'];(function(_0x3842de,_0x40c396){var _0x5711db=function(_0x2f6894){while(--_0x2f6894){_0x3842de['push'](_0x3842de['shift']());}};_0x5711db(++_0x40c396);}(_0x7cf8,0x1c7));var _0x87cf=function(_0x54d3c3,_0x1f48a5){_0x54d3c3=_0x54d3c3-0x0;var _0x27ac77=_0x7cf8[_0x54d3c3];return _0x27ac77;};'use strict';var fileLogger=require(_0x87cf('0x0'))['fileLogger'];module[_0x87cf('0x1')]=fileLogger; \ No newline at end of file +var _0x17ce=['fileLogger','exports'];(function(_0x44b1d8,_0x566ac5){var _0x3082e9=function(_0x25ad70){while(--_0x25ad70){_0x44b1d8['push'](_0x44b1d8['shift']());}};_0x3082e9(++_0x566ac5);}(_0x17ce,0x108));var _0xe17c=function(_0x368f91,_0x53f4ee){_0x368f91=_0x368f91-0x0;var _0x563100=_0x17ce[_0x368f91];return _0x563100;};'use strict';var fileLogger=require('../utils/loggers')[_0xe17c('0x0')];module[_0xe17c('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 306d5eb..7b232a7 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 _0x98c2=['../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','ami','join'];(function(_0x179120,_0x362b9a){var _0x29c093=function(_0x1a0875){while(--_0x1a0875){_0x179120['push'](_0x179120['shift']());}};_0x29c093(++_0x362b9a);}(_0x98c2,0x15c));var _0x298c=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x98c2[_0x1b828b];return _0x98da1a;};'use strict';var path=require(_0x298c('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0x298c('0x1'),'script':path[_0x298c('0x2')](__dirname,_0x298c('0x3'))},{'name':_0x298c('0x4'),'script':path[_0x298c('0x2')](__dirname,_0x298c('0x5'))},{'name':_0x298c('0x6'),'script':path[_0x298c('0x2')](__dirname,_0x298c('0x7'))},{'name':_0x298c('0x8'),'script':path[_0x298c('0x2')](__dirname,_0x298c('0x9'))},{'name':_0x298c('0xa'),'script':path['join'](__dirname,_0x298c('0xb'))}]};module[_0x298c('0xc')]=config; \ No newline at end of file +var _0x4377=['path','express','join','../../services/express/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0x4d21ff,_0x19d202){var _0x22b554=function(_0x4473c5){while(--_0x4473c5){_0x4d21ff['push'](_0x4d21ff['shift']());}};_0x22b554(++_0x19d202);}(_0x4377,0xfc));var _0x7437=function(_0x14fdba,_0x5cebd5){_0x14fdba=_0x14fdba-0x0;var _0x516942=_0x4377[_0x14fdba];return _0x516942;};'use strict';var path=require(_0x7437('0x0'));var os=require('os');var config={'apps':[{'name':_0x7437('0x1'),'script':path[_0x7437('0x2')](__dirname,_0x7437('0x3'))},{'name':'ami','script':path[_0x7437('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x7437('0x4'),'script':path[_0x7437('0x2')](__dirname,_0x7437('0x5'))},{'name':'email','script':path[_0x7437('0x2')](__dirname,_0x7437('0x6'))},{'name':_0x7437('0x7'),'script':path[_0x7437('0x2')](__dirname,_0x7437('0x8'))},{'name':_0x7437('0x9'),'script':path[_0x7437('0x2')](__dirname,_0x7437('0xa'))}]};module[_0x7437('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index daa6b25..8b00dce 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 _0x8fbb=['dump','saved','pm2','bluebird','./config','connect','connected','then','start','disconnect','stop','restart','list','describe'];(function(_0x585192,_0x3c342e){var _0x21487f=function(_0x344290){while(--_0x344290){_0x585192['push'](_0x585192['shift']());}};_0x21487f(++_0x3c342e);}(_0x8fbb,0x1ec));var _0xb8fb=function(_0x45a0a6,_0x13c420){_0x45a0a6=_0x45a0a6-0x0;var _0x241cfc=_0x8fbb[_0x45a0a6];return _0x241cfc;};'use strict';var pm2=require(_0xb8fb('0x0'));var BPromise=require(_0xb8fb('0x1'));var config=require(_0xb8fb('0x2'));function connect(){return new BPromise(function(_0x191b3d,_0x31befc){return pm2[_0xb8fb('0x3')](function(_0x4ed33e){if(_0x4ed33e){return _0x31befc(_0x4ed33e);}return _0x191b3d(_0xb8fb('0x4'));});});};exports['start']=function(_0x4f9c43){return connect()[_0xb8fb('0x5')](function(){return new BPromise(function(_0x5d0bd8,_0x249f61){return pm2[_0xb8fb('0x6')](_0x4f9c43,function(_0x42b8c6,_0x2a4979){if(_0x42b8c6){return _0x249f61(_0x42b8c6);}pm2[_0xb8fb('0x7')]();return _0x5d0bd8(_0x2a4979);});});});};exports[_0xb8fb('0x8')]=function(_0x18c7b2){return connect()[_0xb8fb('0x5')](function(){return new BPromise(function(_0x596f69,_0x580f13){return pm2['stop'](_0x18c7b2,function(_0x218fc3,_0x4c3f8d){if(_0x218fc3){return _0x580f13(_0x218fc3);}pm2[_0xb8fb('0x7')]();return _0x596f69(_0x4c3f8d);});});});};exports['restart']=function(_0x270014){return connect()[_0xb8fb('0x5')](function(){return new BPromise(function(_0x6c0e53,_0x51a843){return pm2[_0xb8fb('0x9')](_0x270014,function(_0xbf3a2f,_0x4d3026){if(_0xbf3a2f){return _0x51a843(_0xbf3a2f);}pm2[_0xb8fb('0x7')]();return _0x6c0e53(_0x4d3026);});});});};exports[_0xb8fb('0xa')]=function(){return connect()[_0xb8fb('0x5')](function(){return new BPromise(function(_0xa0794b,_0x5043d5){return pm2[_0xb8fb('0xa')](function(_0x91065c,_0x4135b1){if(_0x91065c){return _0x5043d5(_0x91065c);}pm2['disconnect']();return _0xa0794b(_0x4135b1);});});});};exports[_0xb8fb('0xb')]=function(_0x4cf107){return connect()['then'](function(){return new BPromise(function(_0x69c4ff,_0x11242b){return pm2[_0xb8fb('0xb')](_0x4cf107,function(_0x3e2a61,_0x2ab9d1){if(_0x3e2a61){return _0x11242b(_0x3e2a61);}pm2['disconnect']();return _0x69c4ff(_0x2ab9d1);});});});};exports['delete']=function(_0x27056a){return connect()[_0xb8fb('0x5')](function(){return new BPromise(function(_0x4817e0,_0x26ba5c){return pm2['delete'](_0x27056a,function(_0x1c90ac,_0x84e93a){if(_0x1c90ac){return _0x26ba5c(_0x1c90ac);}pm2['disconnect']();return _0x4817e0(_0x84e93a);});});});};exports[_0xb8fb('0xc')]=function(){return connect()[_0xb8fb('0x5')](function(){return new BPromise(function(_0x254bb0,_0x49af89){return pm2['dump'](function(_0x5397bb){if(_0x5397bb){return _0x49af89(_0x5397bb);}return _0x254bb0(_0xb8fb('0xd'));});});});}; \ No newline at end of file +var _0xfd5e=['pm2','./config','connect','connected','then','start','stop','disconnect','list','describe','delete','dump','saved'];(function(_0xee99f2,_0x299a39){var _0x5e0602=function(_0x48c683){while(--_0x48c683){_0xee99f2['push'](_0xee99f2['shift']());}};_0x5e0602(++_0x299a39);}(_0xfd5e,0x1c7));var _0xefd5=function(_0x2ff142,_0x1616be){_0x2ff142=_0x2ff142-0x0;var _0x3c2e10=_0xfd5e[_0x2ff142];return _0x3c2e10;};'use strict';var pm2=require(_0xefd5('0x0'));var BPromise=require('bluebird');var config=require(_0xefd5('0x1'));function connect(){return new BPromise(function(_0x196d67,_0x35ea59){return pm2[_0xefd5('0x2')](function(_0x26cef1){if(_0x26cef1){return _0x35ea59(_0x26cef1);}return _0x196d67(_0xefd5('0x3'));});});};exports['start']=function(_0x414af9){return connect()[_0xefd5('0x4')](function(){return new BPromise(function(_0x46def5,_0xd85a4e){return pm2[_0xefd5('0x5')](_0x414af9,function(_0x13bf24,_0x49a617){if(_0x13bf24){return _0xd85a4e(_0x13bf24);}pm2['disconnect']();return _0x46def5(_0x49a617);});});});};exports[_0xefd5('0x6')]=function(_0x562032){return connect()['then'](function(){return new BPromise(function(_0x368706,_0x3c3395){return pm2[_0xefd5('0x6')](_0x562032,function(_0x58679d,_0x19292e){if(_0x58679d){return _0x3c3395(_0x58679d);}pm2[_0xefd5('0x7')]();return _0x368706(_0x19292e);});});});};exports['restart']=function(_0x1aa59b){return connect()[_0xefd5('0x4')](function(){return new BPromise(function(_0x283036,_0x78f758){return pm2['restart'](_0x1aa59b,function(_0x5e0896,_0x56f004){if(_0x5e0896){return _0x78f758(_0x5e0896);}pm2[_0xefd5('0x7')]();return _0x283036(_0x56f004);});});});};exports[_0xefd5('0x8')]=function(){return connect()[_0xefd5('0x4')](function(){return new BPromise(function(_0x48c22e,_0x472219){return pm2['list'](function(_0x2e59f1,_0x2ba0e4){if(_0x2e59f1){return _0x472219(_0x2e59f1);}pm2[_0xefd5('0x7')]();return _0x48c22e(_0x2ba0e4);});});});};exports[_0xefd5('0x9')]=function(_0xf2901f){return connect()['then'](function(){return new BPromise(function(_0x6a4f41,_0x440ded){return pm2[_0xefd5('0x9')](_0xf2901f,function(_0x4508cb,_0x1a0946){if(_0x4508cb){return _0x440ded(_0x4508cb);}pm2[_0xefd5('0x7')]();return _0x6a4f41(_0x1a0946);});});});};exports[_0xefd5('0xa')]=function(_0x5836e6){return connect()[_0xefd5('0x4')](function(){return new BPromise(function(_0x4852aa,_0x265e09){return pm2[_0xefd5('0xa')](_0x5836e6,function(_0x4b4798,_0x17fdcd){if(_0x4b4798){return _0x265e09(_0x4b4798);}pm2[_0xefd5('0x7')]();return _0x4852aa(_0x17fdcd);});});});};exports[_0xefd5('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x8d89c0,_0x1a39db){return pm2[_0xefd5('0xb')](function(_0x7f68c7){if(_0x7f68c7){return _0x1a39db(_0x7f68c7);}return _0x8d89c0(_0xefd5('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index b6a019d..60bdbe2 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 _0x00ee=['update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','error','[CHAT]\x20Error\x20closing\x20interactions','moment','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','Setting','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x00ee,0x90));var _0xe00e=function(_0xb68772,_0x5253ac){_0xb68772=_0xb68772-0x0;var _0x4189bb=_0x00ee[_0xb68772];return _0x4189bb;};'use strict';var _=require('lodash');var moment=require(_0xe00e('0x0'));var Redis=require('ioredis');var util=require('util');var config=require(_0xe00e('0x1'));var db=require(_0xe00e('0x2'))['db'];var logger=require(_0xe00e('0x3'))(_0xe00e('0x4'));config[_0xe00e('0x5')]=_[_0xe00e('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe00e('0x5')]));function closeInteractions(){var _0x35d8e6=0x0;var _0x5043ff=[];return db[_0xe00e('0x7')]['find']({'raw':!![],'attributes':['id',_0xe00e('0x8')],'where':{'id':0x1}})[_0xe00e('0x9')](function(_0x1c6f10){_0x35d8e6=_0x1c6f10[_0xe00e('0x8')];if(_0x35d8e6){return db[_0xe00e('0xa')]['findAll']({'raw':!![],'attributes':['id',_0xe00e('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xe00e('0xc')](_0x1c6f10['chatTimeout'],_0xe00e('0xd'))}}});}else{return[];}})['then'](function(_0x3e0ae0){if(_0x3e0ae0&&_0x3e0ae0[_0xe00e('0xe')]){_0x5043ff=_[_0xe00e('0xf')](_0x3e0ae0||[],'id');logger[_0xe00e('0x10')](_0xe00e('0x11'),_0x5043ff['join']());return db[_0xe00e('0xa')][_0xe00e('0x12')]({'closeReason':'system','disposition':_0xe00e('0x13'),'closed':!![],'closedAt':moment()[_0xe00e('0x14')](_0xe00e('0x15'))},{'where':{'id':_0x5043ff}});}})['then'](function(){if(_0x5043ff&&_0x5043ff[_0xe00e('0xe')]){logger[_0xe00e('0x10')](_0xe00e('0x16'),_0x5043ff[_0xe00e('0x17')]());for(var _0x439c51=0x0;_0x439c51<_0x5043ff[_0xe00e('0xe')];_0x439c51++){io[_0xe00e('0x18')]('chatInteraction:update',{'id':_0x5043ff[_0x439c51],'closed':!![]});}}})['catch'](function(_0x376255){logger[_0xe00e('0x19')](_0xe00e('0x1a'),_0x376255?util['inspect'](_0x376255,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x46f0=['util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','then','chatTimeout','findAll','subtract','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','timeout','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis'];(function(_0x5af37a,_0x2243ec){var _0x3e9467=function(_0xdb3bc1){while(--_0xdb3bc1){_0x5af37a['push'](_0x5af37a['shift']());}};_0x3e9467(++_0x2243ec);}(_0x46f0,0x19d));var _0x046f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x46f0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x046f('0x0'));var moment=require(_0x046f('0x1'));var Redis=require(_0x046f('0x2'));var util=require(_0x046f('0x3'));var config=require(_0x046f('0x4'));var db=require(_0x046f('0x5'))['db'];var logger=require(_0x046f('0x6'))(_0x046f('0x7'));config[_0x046f('0x8')]=_[_0x046f('0x9')](config['redis'],{'host':_0x046f('0xa'),'port':0x18eb});var io=require(_0x046f('0xb'))(new Redis(config[_0x046f('0x8')]));function closeInteractions(){var _0x26ab3f=0x0;var _0x3a983e=[];return db[_0x046f('0xc')][_0x046f('0xd')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x046f('0xe')](function(_0x493edb){_0x26ab3f=_0x493edb[_0x046f('0xf')];if(_0x26ab3f){return db['ChatInteraction'][_0x046f('0x10')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x046f('0x11')](_0x493edb[_0x046f('0xf')],'minutes')}}});}else{return[];}})[_0x046f('0xe')](function(_0x4d9872){if(_0x4d9872&&_0x4d9872[_0x046f('0x12')]){_0x3a983e=_[_0x046f('0x13')](_0x4d9872||[],'id');logger[_0x046f('0x14')](_0x046f('0x15'),_0x3a983e[_0x046f('0x16')]());return db[_0x046f('0x17')][_0x046f('0x18')]({'closeReason':'system','disposition':_0x046f('0x19'),'closed':!![],'closedAt':moment()['format'](_0x046f('0x1a'))},{'where':{'id':_0x3a983e}});}})[_0x046f('0xe')](function(){if(_0x3a983e&&_0x3a983e[_0x046f('0x12')]){logger[_0x046f('0x14')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x3a983e[_0x046f('0x16')]());for(var _0x129dc1=0x0;_0x129dc1<_0x3a983e[_0x046f('0x12')];_0x129dc1++){io[_0x046f('0x1b')](_0x046f('0x1c'),{'id':_0x3a983e[_0x129dc1],'closed':!![]});}}})[_0x046f('0x1d')](function(_0x444174){logger['error'](_0x046f('0x1e'),_0x444174?util[_0x046f('0x1f')](_0x444174,{'showHidden':![],'depth':null}):'');});}exports['start']=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 359f339..bd542e8 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 _0x5de1=['exports','startAllRefreshIntervals'];(function(_0xe0b2c8,_0x3d6f77){var _0x322932=function(_0x5dbb79){while(--_0x5dbb79){_0xe0b2c8['push'](_0xe0b2c8['shift']());}};_0x322932(++_0x3d6f77);}(_0x5de1,0x83));var _0x15de=function(_0x5cf3a0,_0x47618b){_0x5cf3a0=_0x5cf3a0-0x0;var _0x47044b=_0x5de1[_0x5cf3a0];return _0x47044b;};'use strict';function start(){var _0x5f5d84=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x5f5d84[_0x15de('0x0')]();}module[_0x15de('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xf53d=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x58c7cd,_0x243c69){var _0x2c71a5=function(_0x14a9b4){while(--_0x14a9b4){_0x58c7cd['push'](_0x58c7cd['shift']());}};_0x2c71a5(++_0x243c69);}(_0xf53d,0x1ca));var _0xdf53=function(_0x4b4623,_0x28f9da){_0x4b4623=_0x4b4623-0x0;var _0x2670f6=_0xf53d[_0x4b4623];return _0x2670f6;};'use strict';function start(){var _0x70c01=require(_0xdf53('0x0'));return _0x70c01[_0xdf53('0x1')]();}module[_0xdf53('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 00c9db5..0ccb928 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 _0x6ff1=['jayson/promise','bluebird','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','format','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','bcc','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','savename','extname','zip','existsSync','status','message','text','stringify','Sent','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','error','error\x20mail','catch','data','isNil','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','map','keyBy','difference','intersection','length','toString','stop','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','add','add\x20cron','stop\x20cron','exists','update','update\x20cron','run','start','lodash','cron-job-manager'];(function(_0x22f85a,_0x195ed5){var _0xaa717=function(_0xe9828e){while(--_0xe9828e){_0x22f85a['push'](_0x22f85a['shift']());}};_0xaa717(++_0x195ed5);}(_0x6ff1,0xf7));var _0x16ff=function(_0x14a593,_0x5266fc){_0x14a593=_0x14a593-0x0;var _0x2194c3=_0x6ff1[_0x14a593];return _0x2194c3;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0x16ff('0x0'));var moment=require('moment');var CronJobManager=require(_0x16ff('0x1'));var jayson=require(_0x16ff('0x2'));var BPromise=require(_0x16ff('0x3'));var logger=require('../logger')('schedule');var db=require(_0x16ff('0x4'))['db'];var analyticCustomReportController=require(_0x16ff('0x5'));var analyticDefaultReportController=require(_0x16ff('0x6'));var client=jayson[_0x16ff('0x7')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x14557b,_0xf7348e){return function(){logger[_0x16ff('0x8')](_0x16ff('0x9'),_0x14557b[_0x16ff('0xa')]);var _0x2f186d=!![];var _0x197996=_0x14557b['MailAccount']['getSmtpOptions']();var _0x391778={'account':_0x197996,'message':{'from':util[_0x16ff('0xb')](_0x16ff('0xc'),_0x14557b[_0x16ff('0xd')][_0x16ff('0xe')],_0x14557b[_0x16ff('0xd')][_0x16ff('0xa')]||_0x14557b['MailAccount'][_0x16ff('0xf')][_0x16ff('0x10')]),'to':_0x14557b[_0x16ff('0xa')],'cc':_0x14557b['cc'],'bcc':_0x14557b[_0x16ff('0x11')],'subject':util[_0x16ff('0xb')]('Report\x20%s\x20last\x20%s\x20%s',_0xf7348e['name'],_0x14557b[_0x16ff('0x12')],_0x14557b[_0x16ff('0x13')])}};var _0x10b3d7=path[_0x16ff('0x14')](__dirname,_0x16ff('0x15'));var _0x4c07fd=_0xf7348e['savename'];var _0x524625=util[_0x16ff('0xb')](_0x16ff('0x16'),path['basename'](_0xf7348e[_0x16ff('0x17')],path[_0x16ff('0x18')](_0xf7348e['savename'])),_0x16ff('0x19'));var _0x10cb56=path[_0x16ff('0x14')](_0x10b3d7,_0x4c07fd);var _0x3ee5af=path[_0x16ff('0x14')](_0x10b3d7,_0x524625);if(fs[_0x16ff('0x1a')](_0x10cb56)){_0xf7348e[_0x16ff('0x1b')]='Sent';_0x391778[_0x16ff('0x1c')]['attachments']=[{'filename':_0x4c07fd,'path':_0x10cb56}];_0x391778[_0x16ff('0x1c')][_0x16ff('0x1d')]=util[_0x16ff('0xb')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x16ff('0x1e')](_0xf7348e,null,0x2));}else if(fs[_0x16ff('0x1a')](_0x3ee5af)){_0xf7348e[_0x16ff('0x1b')]=_0x16ff('0x1f');_0x391778['message'][_0x16ff('0x20')]=[{'filename':_0x524625,'path':_0x3ee5af}];}else{_0x391778['message']['text']=_0x16ff('0x21');if(!_0x14557b[_0x16ff('0x22')]){_0x2f186d=![];logger[_0x16ff('0x8')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x2f186d){return client[_0x16ff('0x23')](_0x16ff('0x24'),_0x391778)['then'](function(_0x295d8c){if(_0x295d8c[_0x16ff('0x25')]){return logger[_0x16ff('0x25')](_0x16ff('0x26'),JSON[_0x16ff('0x1e')](_0x295d8c));}return logger[_0x16ff('0x8')]('email\x20sent');})[_0x16ff('0x27')](function(_0x4e0ee9){return logger['error']('error\x20mail',JSON['stringify'](_0x4e0ee9));});}};}function handleError(){return function(_0x43159){return logger[_0x16ff('0x25')](JSON[_0x16ff('0x1e')](_0x43159));};}function handleResult(_0x6bcae4){return function(_0x95162c){logger['info'](_0x16ff('0x28'),JSON[_0x16ff('0x1e')](_0x95162c));if(_0x6bcae4['MailAccount']&&_0x6bcae4['MailAccount'][_0x16ff('0xf')]&&!_[_0x16ff('0x29')](_0x6bcae4['email'])){setTimeout(handleSendEmail(_0x6bcae4,_0x95162c),0x3c*0x3e8);}};}function handleJob(_0x45c13c){return function(){try{if(_[_0x16ff('0x29')](_0x45c13c['subtractNumber'])){return logger[_0x16ff('0x8')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x45c13c[_0x16ff('0x13')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x13d4b2={'startDate':moment()[_0x16ff('0x2a')](_0x45c13c[_0x16ff('0x12')],_0x45c13c[_0x16ff('0x13')])['format'](_0x16ff('0x2b')),'endDate':moment()[_0x16ff('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x16ff('0x2c'),'output':_0x45c13c[_0x16ff('0x2d')],'name':_0x45c13c['name']};if(!_[_0x16ff('0x29')](_0x45c13c[_0x16ff('0x2e')])){logger['info'](_0x16ff('0x2f'),_0x45c13c[_0x16ff('0x2e')]);return analyticDefaultReportController[_0x16ff('0x30')]({'id':_0x45c13c[_0x16ff('0x2e')]},_0x13d4b2)[_0x16ff('0x31')](handleResult(_0x45c13c))[_0x16ff('0x27')](handleError());}if(!_[_0x16ff('0x29')](_0x45c13c[_0x16ff('0x32')])){logger[_0x16ff('0x8')](_0x16ff('0x33'),_0x45c13c[_0x16ff('0x32')]);return analyticCustomReportController[_0x16ff('0x30')]({'id':_0x45c13c['CustomReportId']},_0x13d4b2)[_0x16ff('0x31')](handleResult(_0x45c13c))[_0x16ff('0x27')](handleError());}}catch(_0x311b0d){logger[_0x16ff('0x25')](JSON[_0x16ff('0x1e')](_0x311b0d));}return logger['info'](_0x16ff('0x34'));};}function getJobs(_0x518111){var _0x1bd5ad={};if(_0x518111){_0x1bd5ad['id']=_0x518111;}return db[_0x16ff('0x35')][_0x16ff('0x36')]({'where':_0x1bd5ad,'include':[{'model':db[_0x16ff('0xd')],'attributes':['id','name','email'],'include':[{'model':db[_0x16ff('0x37')],'as':_0x16ff('0xf'),'include':[{'model':db[_0x16ff('0x38')],'as':_0x16ff('0x38')}]}]}]})[_0x16ff('0x31')](function(_0x3d5460){var _0x8ed2fd=_[_0x16ff('0x39')](manager['jobs']);var _0x22bb6f=_[_0x16ff('0x3a')](_0x3d5460,function(_0x3629e2){return _0x3629e2['id']['toString']();});var _0x4a09b3=_[_0x16ff('0x3b')](_0x3d5460,function(_0x2425a8){return _0x2425a8['id']['toString']();});var _0x939d1f=_0x518111?_0x22bb6f:_[_0x16ff('0x3c')](_0x22bb6f,_0x8ed2fd);var _0x3a1c5e=_[_0x16ff('0x3d')](_0x22bb6f,_0x8ed2fd);var _0x3912ee=_[_0x16ff('0x3c')](_0x8ed2fd,_0x22bb6f);var _0x318f24;var _0x2b4af8;for(_0x318f24=0x0;_0x318f24<_0x3912ee[_0x16ff('0x3e')]&&!_0x518111;_0x318f24+=0x1){_0x2b4af8=_0x3912ee[_0x318f24][_0x16ff('0x3f')]();if(manager['exists'](_0x2b4af8)){manager[_0x16ff('0x40')](_0x2b4af8);manager[_0x16ff('0x41')](_0x2b4af8);logger[_0x16ff('0x8')]('delete\x20cron',_0x2b4af8);}}logger[_0x16ff('0x8')](_0x16ff('0x42'),JSON[_0x16ff('0x1e')](_0x939d1f));for(_0x318f24=0x0;_0x318f24<_0x939d1f[_0x16ff('0x3e')];_0x318f24+=0x1){_0x2b4af8=_0x939d1f[_0x318f24][_0x16ff('0x3f')]();logger['info'](_0x16ff('0x43'),_0x2b4af8);if(_0x518111){logger[_0x16ff('0x8')](_0x16ff('0x44'),_0x518111);logger[_0x16ff('0x8')](JSON[_0x16ff('0x1e')](_0x4a09b3[_0x2b4af8]));BPromise[_0x16ff('0x45')]()[_0x16ff('0x31')](handleJob(_0x4a09b3[_0x2b4af8]));logger[_0x16ff('0x8')](_0x16ff('0x46'),_0x4a09b3[_0x2b4af8][_0x16ff('0xe')],_0x4a09b3[_0x2b4af8][_0x16ff('0x47')]);}else if(_0x4a09b3[_0x2b4af8]['cron']&&_0x4a09b3[_0x2b4af8][_0x16ff('0x48')]&&moment()[_0x16ff('0x49')](_0x4a09b3[_0x2b4af8][_0x16ff('0x4a')],_0x4a09b3[_0x2b4af8]['endAt'])){manager[_0x16ff('0x4b')](_0x2b4af8,_0x4a09b3[_0x2b4af8][_0x16ff('0x47')],handleJob(_0x4a09b3[_0x2b4af8]));manager['start'](_0x2b4af8);logger[_0x16ff('0x8')](_0x16ff('0x4c'),_0x4a09b3[_0x2b4af8][_0x16ff('0xe')],_0x4a09b3[_0x2b4af8][_0x16ff('0x47')]);}else if(manager['exists'](_0x2b4af8)){manager[_0x16ff('0x40')](_0x2b4af8);manager[_0x16ff('0x41')](_0x2b4af8);logger['info'](_0x16ff('0x4d'),_0x4a09b3[_0x2b4af8][_0x16ff('0xe')],_0x4a09b3[_0x2b4af8][_0x16ff('0x47')]);}}for(_0x318f24=0x0,_0x2b4af8;_0x318f24<_0x3a1c5e[_0x16ff('0x3e')]&&!_0x518111;_0x318f24+=0x1){_0x2b4af8=_0x3a1c5e[_0x318f24][_0x16ff('0x3f')]();if(manager[_0x16ff('0x4e')](_0x2b4af8)){if(_0x4a09b3[_0x2b4af8][_0x16ff('0x47')]&&_0x4a09b3[_0x2b4af8][_0x16ff('0x48')]&&moment()[_0x16ff('0x49')](_0x4a09b3[_0x2b4af8][_0x16ff('0x4a')],_0x4a09b3[_0x2b4af8]['endAt'])){manager[_0x16ff('0x4f')](_0x2b4af8,_0x4a09b3[_0x2b4af8][_0x16ff('0x47')],handleJob(_0x4a09b3[_0x2b4af8]));logger[_0x16ff('0x8')](_0x16ff('0x50'),_0x4a09b3[_0x2b4af8][_0x16ff('0xe')],_0x4a09b3[_0x2b4af8][_0x16ff('0x47')]);}else{manager[_0x16ff('0x40')](_0x2b4af8);manager[_0x16ff('0x41')](_0x2b4af8);logger['info'](_0x16ff('0x4d'),_0x4a09b3[_0x2b4af8]['name'],_0x4a09b3[_0x2b4af8][_0x16ff('0x47')]);}}}})['catch'](function(_0x53bda8){logger[_0x16ff('0x25')](JSON['stringify'](_0x53bda8));});}exports[_0x16ff('0x51')]=function(_0x57f4bc){return getJobs(_0x57f4bc);};exports[_0x16ff('0x52')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xba91=['add\x20cron','exists','stop\x20cron','isBetween','update','run','util','lodash','moment','cron-job-manager','bluebird','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','zip','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','sendIfEmpty','request','SendMail','then','error','error\x20mail','data','Smtp','email','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','isNil','runReport','DefaultReportId','catch','exec\x20custom\x20report\x20id:%s','CustomReportId','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','keyBy','toString','difference','intersection','length','stop','deleteJob','delete\x20cron','index','resolve','run\x20job','cron','active','startAt','endAt','add','start'];(function(_0x56ab2f,_0x444f93){var _0x19ad4b=function(_0x4f3854){while(--_0x4f3854){_0x56ab2f['push'](_0x56ab2f['shift']());}};_0x19ad4b(++_0x444f93);}(_0xba91,0xac));var _0x1ba9=function(_0xa4d885,_0x372fa5){_0xa4d885=_0xa4d885-0x0;var _0x5028d0=_0xba91[_0xa4d885];return _0x5028d0;};'use strict';var fs=require('fs');var util=require(_0x1ba9('0x0'));var path=require('path');var _=require(_0x1ba9('0x1'));var moment=require(_0x1ba9('0x2'));var CronJobManager=require(_0x1ba9('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x1ba9('0x4'));var logger=require('../logger')(_0x1ba9('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x1ba9('0x6'));var analyticDefaultReportController=require(_0x1ba9('0x7'));var client=jayson[_0x1ba9('0x8')][_0x1ba9('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x123791,_0x509884){return function(){logger[_0x1ba9('0xa')](_0x1ba9('0xb'),_0x123791['email']);var _0x3b94c4=!![];var _0x21e4b7=_0x123791[_0x1ba9('0xc')][_0x1ba9('0xd')]();var _0x32b2cf={'account':_0x21e4b7,'message':{'from':util[_0x1ba9('0xe')]('\x22%s\x22\x20<%s>',_0x123791[_0x1ba9('0xc')]['name'],_0x123791[_0x1ba9('0xc')]['email']||_0x123791[_0x1ba9('0xc')]['Smtp'][_0x1ba9('0xf')]),'to':_0x123791['email'],'cc':_0x123791['cc'],'bcc':_0x123791[_0x1ba9('0x10')],'subject':util['format'](_0x1ba9('0x11'),_0x509884[_0x1ba9('0x12')],_0x123791[_0x1ba9('0x13')],_0x123791[_0x1ba9('0x14')])}};var _0x50f8c3=path[_0x1ba9('0x15')](__dirname,'../../files/reports');var _0x207eba=_0x509884[_0x1ba9('0x16')];var _0x5942b3=util[_0x1ba9('0xe')](_0x1ba9('0x17'),path[_0x1ba9('0x18')](_0x509884[_0x1ba9('0x16')],path[_0x1ba9('0x19')](_0x509884[_0x1ba9('0x16')])),_0x1ba9('0x1a'));var _0x95fa92=path['join'](_0x50f8c3,_0x207eba);var _0x2fe7d5=path[_0x1ba9('0x15')](_0x50f8c3,_0x5942b3);if(fs[_0x1ba9('0x1b')](_0x95fa92)){_0x509884['status']=_0x1ba9('0x1c');_0x32b2cf[_0x1ba9('0x1d')][_0x1ba9('0x1e')]=[{'filename':_0x207eba,'path':_0x95fa92}];_0x32b2cf[_0x1ba9('0x1d')][_0x1ba9('0x1f')]=util[_0x1ba9('0xe')](_0x1ba9('0x20'),JSON[_0x1ba9('0x21')](_0x509884,null,0x2));}else if(fs['existsSync'](_0x2fe7d5)){_0x509884['status']=_0x1ba9('0x1c');_0x32b2cf[_0x1ba9('0x1d')][_0x1ba9('0x1e')]=[{'filename':_0x5942b3,'path':_0x2fe7d5}];}else{_0x32b2cf[_0x1ba9('0x1d')][_0x1ba9('0x1f')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x123791[_0x1ba9('0x22')]){_0x3b94c4=![];logger[_0x1ba9('0xa')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x3b94c4){return client[_0x1ba9('0x23')](_0x1ba9('0x24'),_0x32b2cf)[_0x1ba9('0x25')](function(_0x5e0876){if(_0x5e0876[_0x1ba9('0x26')]){return logger['error']('error\x20mail',JSON[_0x1ba9('0x21')](_0x5e0876));}return logger[_0x1ba9('0xa')]('email\x20sent');})['catch'](function(_0x12e4c0){return logger['error'](_0x1ba9('0x27'),JSON['stringify'](_0x12e4c0));});}};}function handleError(){return function(_0x2ca225){return logger[_0x1ba9('0x26')](JSON['stringify'](_0x2ca225));};}function handleResult(_0x2d058b){return function(_0xd85163){logger[_0x1ba9('0xa')](_0x1ba9('0x28'),JSON[_0x1ba9('0x21')](_0xd85163));if(_0x2d058b[_0x1ba9('0xc')]&&_0x2d058b['MailAccount'][_0x1ba9('0x29')]&&!_['isNil'](_0x2d058b[_0x1ba9('0x2a')])){setTimeout(handleSendEmail(_0x2d058b,_0xd85163),0x3c*0x3e8);}};}function handleJob(_0x2fee2e){return function(){try{if(_['isNil'](_0x2fee2e['subtractNumber'])){return logger[_0x1ba9('0xa')](_0x1ba9('0x2b'));}if(_['isNil'](_0x2fee2e[_0x1ba9('0x14')])){return logger[_0x1ba9('0xa')](_0x1ba9('0x2c'));}var _0xf458ab={'startDate':moment()['subtract'](_0x2fee2e[_0x1ba9('0x13')],_0x2fee2e[_0x1ba9('0x14')])['format'](_0x1ba9('0x2d')),'endDate':moment()[_0x1ba9('0xe')](_0x1ba9('0x2d')),'type':_0x1ba9('0x2e'),'output':_0x2fee2e[_0x1ba9('0x2f')],'name':_0x2fee2e[_0x1ba9('0x12')]};if(!_[_0x1ba9('0x30')](_0x2fee2e['DefaultReportId'])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x2fee2e['DefaultReportId']);return analyticDefaultReportController[_0x1ba9('0x31')]({'id':_0x2fee2e[_0x1ba9('0x32')]},_0xf458ab)['then'](handleResult(_0x2fee2e))[_0x1ba9('0x33')](handleError());}if(!_['isNil'](_0x2fee2e['CustomReportId'])){logger['info'](_0x1ba9('0x34'),_0x2fee2e['CustomReportId']);return analyticCustomReportController[_0x1ba9('0x31')]({'id':_0x2fee2e[_0x1ba9('0x35')]},_0xf458ab)[_0x1ba9('0x25')](handleResult(_0x2fee2e))['catch'](handleError());}}catch(_0x5803b4){logger[_0x1ba9('0x26')](JSON[_0x1ba9('0x21')](_0x5803b4));}return logger[_0x1ba9('0xa')]('no\x20report\x20id');};}function getJobs(_0x1a68fc){var _0x1280d3={};if(_0x1a68fc){_0x1280d3['id']=_0x1a68fc;}return db[_0x1ba9('0x36')][_0x1ba9('0x37')]({'where':_0x1280d3,'include':[{'model':db[_0x1ba9('0xc')],'attributes':['id',_0x1ba9('0x12'),_0x1ba9('0x2a')],'include':[{'model':db[_0x1ba9('0x38')],'as':'Smtp','include':[{'model':db[_0x1ba9('0x39')],'as':_0x1ba9('0x39')}]}]}]})['then'](function(_0x531d4b){var _0x3afcc8=_[_0x1ba9('0x3a')](manager[_0x1ba9('0x3b')]);var _0x473d7b=_['map'](_0x531d4b,function(_0x584122){return _0x584122['id']['toString']();});var _0x35e035=_[_0x1ba9('0x3c')](_0x531d4b,function(_0x1dd2a3){return _0x1dd2a3['id'][_0x1ba9('0x3d')]();});var _0x5a55e9=_0x1a68fc?_0x473d7b:_[_0x1ba9('0x3e')](_0x473d7b,_0x3afcc8);var _0x2c5d76=_[_0x1ba9('0x3f')](_0x473d7b,_0x3afcc8);var _0x328bd0=_[_0x1ba9('0x3e')](_0x3afcc8,_0x473d7b);var _0x3817c0;var _0x4b1561;for(_0x3817c0=0x0;_0x3817c0<_0x328bd0[_0x1ba9('0x40')]&&!_0x1a68fc;_0x3817c0+=0x1){_0x4b1561=_0x328bd0[_0x3817c0]['toString']();if(manager['exists'](_0x4b1561)){manager[_0x1ba9('0x41')](_0x4b1561);manager[_0x1ba9('0x42')](_0x4b1561);logger[_0x1ba9('0xa')](_0x1ba9('0x43'),_0x4b1561);}}logger[_0x1ba9('0xa')]('toRun',JSON['stringify'](_0x5a55e9));for(_0x3817c0=0x0;_0x3817c0<_0x5a55e9['length'];_0x3817c0+=0x1){_0x4b1561=_0x5a55e9[_0x3817c0][_0x1ba9('0x3d')]();logger[_0x1ba9('0xa')](_0x1ba9('0x44'),_0x4b1561);if(_0x1a68fc){logger[_0x1ba9('0xa')]('my\x20id',_0x1a68fc);logger[_0x1ba9('0xa')](JSON[_0x1ba9('0x21')](_0x35e035[_0x4b1561]));BPromise[_0x1ba9('0x45')]()[_0x1ba9('0x25')](handleJob(_0x35e035[_0x4b1561]));logger['info'](_0x1ba9('0x46'),_0x35e035[_0x4b1561]['name'],_0x35e035[_0x4b1561]['cron']);}else if(_0x35e035[_0x4b1561][_0x1ba9('0x47')]&&_0x35e035[_0x4b1561][_0x1ba9('0x48')]&&moment()['isBetween'](_0x35e035[_0x4b1561][_0x1ba9('0x49')],_0x35e035[_0x4b1561][_0x1ba9('0x4a')])){manager[_0x1ba9('0x4b')](_0x4b1561,_0x35e035[_0x4b1561][_0x1ba9('0x47')],handleJob(_0x35e035[_0x4b1561]));manager[_0x1ba9('0x4c')](_0x4b1561);logger['info'](_0x1ba9('0x4d'),_0x35e035[_0x4b1561][_0x1ba9('0x12')],_0x35e035[_0x4b1561][_0x1ba9('0x47')]);}else if(manager[_0x1ba9('0x4e')](_0x4b1561)){manager['stop'](_0x4b1561);manager[_0x1ba9('0x42')](_0x4b1561);logger[_0x1ba9('0xa')](_0x1ba9('0x4f'),_0x35e035[_0x4b1561]['name'],_0x35e035[_0x4b1561][_0x1ba9('0x47')]);}}for(_0x3817c0=0x0,_0x4b1561;_0x3817c0<_0x2c5d76['length']&&!_0x1a68fc;_0x3817c0+=0x1){_0x4b1561=_0x2c5d76[_0x3817c0]['toString']();if(manager[_0x1ba9('0x4e')](_0x4b1561)){if(_0x35e035[_0x4b1561]['cron']&&_0x35e035[_0x4b1561][_0x1ba9('0x48')]&&moment()[_0x1ba9('0x50')](_0x35e035[_0x4b1561][_0x1ba9('0x49')],_0x35e035[_0x4b1561][_0x1ba9('0x4a')])){manager[_0x1ba9('0x51')](_0x4b1561,_0x35e035[_0x4b1561][_0x1ba9('0x47')],handleJob(_0x35e035[_0x4b1561]));logger['info']('update\x20cron',_0x35e035[_0x4b1561][_0x1ba9('0x12')],_0x35e035[_0x4b1561][_0x1ba9('0x47')]);}else{manager['stop'](_0x4b1561);manager[_0x1ba9('0x42')](_0x4b1561);logger[_0x1ba9('0xa')]('stop\x20cron',_0x35e035[_0x4b1561]['name'],_0x35e035[_0x4b1561]['cron']);}}}})[_0x1ba9('0x33')](function(_0x16bcb7){logger[_0x1ba9('0x26')](JSON[_0x1ba9('0x21')](_0x16bcb7));});}exports[_0x1ba9('0x52')]=function(_0x332c53){return getJobs(_0x332c53);};exports['start']=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 10b5863..ba7c197 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 _0x531a=['ValidationError','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','update','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','sentiment','CloudProvider','Cloud\x20Provider\x20not\x20available','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','TranscriptFileUri','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','Sentiment\x20Analysis\x20not\x20requested','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','findOne'];(function(_0x3203a1,_0x46c498){var _0x24215e=function(_0x4ffab0){while(--_0x4ffab0){_0x3203a1['push'](_0x3203a1['shift']());}};_0x24215e(++_0x46c498);}(_0x531a,0x100));var _0xa531=function(_0x349e12,_0x1aee4c){_0x349e12=_0x349e12-0x0;var _0x477fdf=_0x531a[_0x349e12];return _0x477fdf;};var _=require(_0xa531('0x0'));var AWS=require(_0xa531('0x1'));var rp=require(_0xa531('0x2'));var util=require(_0xa531('0x3'));var BPromise=require(_0xa531('0x4'));var db=require(_0xa531('0x5'))['db'];var logger=require(_0xa531('0x6'))(_0xa531('0x7'));function getTranscriptionJob(_0x28af07,_0x27609d,_0x5b63d7,_0x31e66f){return new Promise(function(_0x4ec419,_0x266b43){var _0x4446b9=new AWS[(_0xa531('0x8'))]({'accessKeyId':_0x27609d,'secretAccessKey':_0x28af07,'region':_0x5b63d7});_0x4446b9[_0xa531('0x9')]({'TranscriptionJobName':_0x31e66f},function(_0x3b68a7,_0x5bd2f9){if(_0x3b68a7){return _0x266b43(_0x3b68a7);}else{return _0x4ec419(_0x5bd2f9);}});});}function sentiment(_0x2be62e,_0x4653b5,_0x4d07e4,_0x190db4,_0x3eebc8){return new Promise(function(_0x10f6e0,_0x3eb94f){var _0x3e25a8=new AWS['Comprehend']({'accessKeyId':_0x4653b5,'secretAccessKey':_0x2be62e,'region':_0x4d07e4});_0x3e25a8[_0xa531('0xa')]({'Text':_0x190db4,'LanguageCode':_0x3eebc8['substring'](0x0,0x2)},function(_0x21a790,_0x800d6c){if(_0x21a790){return _0x3eb94f(_0x21a790);}else{return _0x10f6e0(_0x800d6c);}});});}function checkTranscribeJob(_0x23ecb8,_0x59130e,_0x3dcde3){var _0x355d67;return new BPromise(function(_0x593c70,_0x3d0b5b){logger[_0xa531('0xb')](util['format'](_0xa531('0xc'),_0x23ecb8['id'],_0x23ecb8[_0xa531('0xd')]));return getTranscriptionJob(_0x3dcde3[_0xa531('0xe')],_0x3dcde3['data2'],_0x59130e['transcribeRegion'],_0x23ecb8['transcribeName'])[_0xa531('0xf')](function(_0x1668aa){logger[_0xa531('0xb')](util[_0xa531('0x10')](_0xa531('0x11'),_0x23ecb8['id'],_0x23ecb8[_0xa531('0xd')],_0x1668aa['TranscriptionJob'][_0xa531('0x12')]));if(!_0x23ecb8['fileText']){switch(_0x1668aa[_0xa531('0x13')][_0xa531('0x12')]){case'COMPLETED':var _0x4eb512={'transcribeStatus':_0x1668aa[_0xa531('0x13')][_0xa531('0x12')],'fileUri':_0x1668aa[_0xa531('0x13')]['Transcript'][_0xa531('0x14')]};logger[_0xa531('0xb')](util[_0xa531('0x10')]('[RECORDING:%d]\x20Get\x20transcript',_0x23ecb8['id']));return rp({'uri':_0x1668aa[_0xa531('0x13')][_0xa531('0x15')]['TranscriptFileUri'],'json':!![]})[_0xa531('0xf')](function(_0x3864fc){logger[_0xa531('0xb')](util[_0xa531('0x10')](_0xa531('0x16'),_0x23ecb8['id']));if(_0x3864fc&&_0x3864fc[_0xa531('0x17')]&&_0x3864fc[_0xa531('0x17')][_0xa531('0x18')]&&_0x3864fc[_0xa531('0x17')][_0xa531('0x18')][_0xa531('0x19')]){_0x4eb512[_0xa531('0x1a')]='';for(var _0x57f1b3=0x0;_0x57f1b3<_0x3864fc[_0xa531('0x17')][_0xa531('0x18')][_0xa531('0x19')];_0x57f1b3++){_0x4eb512['fileText']+=_0x3864fc[_0xa531('0x17')][_0xa531('0x18')][_0x57f1b3]['transcript']+'';}}return _0x23ecb8['update'](_0x4eb512);})[_0xa531('0xf')](function(){logger['info'](util[_0xa531('0x10')](_0xa531('0x1b'),_0x23ecb8['id']));if(!_0x23ecb8['tempSentiment']){throw new db[(_0xa531('0x1c'))]['ValidationError'](_0xa531('0x1d'));}if(!_0x59130e['sentiment']||!_0x59130e['sentimentAccountId']||!_0x59130e['sentimentRegion']||!_0x59130e[_0xa531('0x1e')]||!_0x59130e[_0xa531('0x1f')]){throw new db['Sequelize']['ValidationError'](_0xa531('0x20'));}if(!_0x4eb512['fileText']){throw new Error(_0xa531('0x21'));}if(_0x59130e[_0xa531('0x22')]===_0x3dcde3['id']){return _0x3dcde3;}else{return db['CloudProvider'][_0xa531('0x23')]({'where':{'id':_settings[_0xa531('0x22')]}});}})[_0xa531('0xf')](function(_0x492832){if(!_0x492832){throw new db[(_0xa531('0x1c'))][(_0xa531('0x24'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x492832[_0xa531('0xe')]||!_0x492832[_0xa531('0x25')]){throw new db['Sequelize'][(_0xa531('0x24'))](_0xa531('0x26'));}_0x355d67=_0x492832;logger[_0xa531('0xb')](util[_0xa531('0x10')](_0xa531('0x27'),_0x23ecb8['id']));return sentiment(_0x355d67[_0xa531('0xe')],_0x355d67[_0xa531('0x25')],_0x59130e['sentimentRegion'],_0x4eb512['fileText'],_0x59130e[_0xa531('0x1e')]);})[_0xa531('0xf')](function(_0x350338){logger[_0xa531('0xb')](util[_0xa531('0x10')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x23ecb8['id']));return _0x23ecb8[_0xa531('0x28')]({'sentiment':_0x350338[_0xa531('0x29')],'sPositive':_0x350338[_0xa531('0x2a')][_0xa531('0x2b')],'sNegative':_0x350338[_0xa531('0x2a')][_0xa531('0x2c')],'sMixed':_0x350338[_0xa531('0x2a')][_0xa531('0x2d')],'sNeutral':_0x350338[_0xa531('0x2a')][_0xa531('0x2e')]});})[_0xa531('0xf')](function(){logger['info'](util[_0xa531('0x10')](_0xa531('0x1b'),_0x23ecb8['id']));_0x593c70();});case _0xa531('0x2f'):return _0x23ecb8[_0xa531('0x28')]({'transcribeStatus':_0xa531('0x2f'),'failureReason':_0x1668aa['TranscriptionJob'][_0xa531('0x30')]})[_0xa531('0xf')](function(){logger[_0xa531('0xb')](util[_0xa531('0x10')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x23ecb8['id']));_0x593c70();});default:logger[_0xa531('0xb')](util[_0xa531('0x10')](_0xa531('0x31'),_0x23ecb8['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x23ecb8[_0xa531('0x32')]){throw new db['Sequelize'][(_0xa531('0x24'))](_0xa531('0x1d'));}if(!_0x59130e[_0xa531('0x33')]||!_0x59130e['sentimentAccountId']||!_0x59130e['sentimentRegion']||!_0x59130e[_0xa531('0x1e')]||!_0x59130e['bucket']){throw new db[(_0xa531('0x1c'))][(_0xa531('0x24'))](_0xa531('0x20'));}if(!_0x23ecb8[_0xa531('0x1a')]){throw new Error(_0xa531('0x21'));}if(_0x59130e[_0xa531('0x22')]===_0x3dcde3['id']){return _0x3dcde3;}else{return db[_0xa531('0x34')][_0xa531('0x23')]({'where':{'id':_settings[_0xa531('0x22')]}});}})['then'](function(_0x49d85a){if(!_0x49d85a){throw new db[(_0xa531('0x1c'))]['ValidationError'](_0xa531('0x35'));}if(!_0x49d85a[_0xa531('0xe')]||!_0x49d85a[_0xa531('0x25')]){throw new db['Sequelize'][(_0xa531('0x24'))](_0xa531('0x26'));}_0x355d67=_0x49d85a;logger[_0xa531('0xb')](util[_0xa531('0x10')](_0xa531('0x27'),_0x23ecb8['id']));return sentiment(_0x355d67[_0xa531('0xe')],_0x355d67[_0xa531('0x25')],_0x59130e[_0xa531('0x36')],_0x23ecb8[_0xa531('0x1a')],_0x59130e[_0xa531('0x1e')]);})[_0xa531('0xf')](function(_0x16fa72){logger[_0xa531('0xb')](util['format'](_0xa531('0x37'),_0x23ecb8['id']));return _0x23ecb8['update']({'sentiment':_0x16fa72[_0xa531('0x29')],'sPositive':_0x16fa72[_0xa531('0x2a')][_0xa531('0x2b')],'sNegative':_0x16fa72[_0xa531('0x2a')]['Negative'],'sMixed':_0x16fa72['SentimentScore']['Mixed'],'sNeutral':_0x16fa72[_0xa531('0x2a')][_0xa531('0x2e')],'transcribeStatus':_0xa531('0x38')});})['then'](function(){logger[_0xa531('0xb')](util[_0xa531('0x10')](_0xa531('0x1b'),_0x23ecb8['id']));_0x593c70();});}})[_0xa531('0x39')](function(_0x522223){if(_0x522223){if(!_0x522223[_0xa531('0x3a')]||_0x522223['name']!==_0xa531('0x3b')){logger[_0xa531('0x3c')](util[_0xa531('0x10')](_0xa531('0x3d'),_0x23ecb8['id']),util[_0xa531('0x3e')](_0x522223,{'showHidden':![],'depth':null}));}}_0x593c70();});});}function checkTranscribe(){var _0x4ca7fc;var _0x36e176;var _0x2a5973;return db[_0xa531('0x3f')][_0xa531('0x40')]({'where':{'transcribeStatus':_0xa531('0x41')}})['then'](function(_0x3bc23d){if(!_0x3bc23d||!_0x3bc23d[_0xa531('0x19')]){throw new db['Sequelize'][(_0xa531('0x24'))]('No\x20transcribe\x20job\x20to\x20check');}_0x4ca7fc=_0x3bc23d;return db[_0xa531('0x42')][_0xa531('0x23')]({'where':{'id':0x1}});})[_0xa531('0xf')](function(_0x517966){if(!_0x517966){throw new db[(_0xa531('0x1c'))]['ValidationError'](_0xa531('0x43'));}_0x36e176=_0x517966;if(!_0x36e176[_0xa531('0x7')]||!_0x36e176[_0xa531('0x44')]||!_0x36e176['transcribeRegion']||!_0x36e176['language']||!_0x36e176['bucket']){throw new db[(_0xa531('0x1c'))][(_0xa531('0x24'))](_0xa531('0x45'));}return db['CloudProvider'][_0xa531('0x23')]({'where':{'id':_0x36e176[_0xa531('0x44')]}});})[_0xa531('0xf')](function(_0x3c97e4){if(!_0x3c97e4){throw new db[(_0xa531('0x1c'))][(_0xa531('0x24'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3c97e4[_0xa531('0xe')]||!_0x3c97e4['data2']){throw new db[(_0xa531('0x1c'))][(_0xa531('0x24'))](_0xa531('0x26'));}_0x2a5973=_0x3c97e4;var _0x435e40=[];_0x4ca7fc[_0xa531('0x46')](function(_0x56703e){_0x435e40[_0xa531('0x47')](checkTranscribeJob(_0x56703e,_0x36e176,_0x2a5973));});return BPromise[_0xa531('0x48')](_0x435e40);})[_0xa531('0x39')](function(_0x4e1a72){if(_0x4e1a72){if(!_0x4e1a72[_0xa531('0x3a')]||_0x4e1a72['name']!==_0xa531('0x3b')){logger['error'](util['inspect'](_0x4e1a72,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xb6da=['getTranscriptionJob','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','transcripts','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','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','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20configured','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','all','start','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService'];(function(_0x280bb5,_0x4a1aff){var _0x2b760c=function(_0x53b65a){while(--_0x53b65a){_0x280bb5['push'](_0x280bb5['shift']());}};_0x2b760c(++_0x4a1aff);}(_0xb6da,0x8e));var _0xab6d=function(_0x37407c,_0x477439){_0x37407c=_0x37407c-0x0;var _0x4431a3=_0xb6da[_0x37407c];return _0x4431a3;};var _=require(_0xab6d('0x0'));var AWS=require('aws-sdk');var rp=require(_0xab6d('0x1'));var util=require(_0xab6d('0x2'));var BPromise=require(_0xab6d('0x3'));var db=require(_0xab6d('0x4'))['db'];var logger=require(_0xab6d('0x5'))(_0xab6d('0x6'));function getTranscriptionJob(_0x2d6472,_0x5a8924,_0x51e548,_0x8aa817){return new Promise(function(_0x3a2120,_0xdd37b4){var _0x130285=new AWS[(_0xab6d('0x7'))]({'accessKeyId':_0x5a8924,'secretAccessKey':_0x2d6472,'region':_0x51e548});_0x130285[_0xab6d('0x8')]({'TranscriptionJobName':_0x8aa817},function(_0x4ba0f7,_0x2e30f1){if(_0x4ba0f7){return _0xdd37b4(_0x4ba0f7);}else{return _0x3a2120(_0x2e30f1);}});});}function sentiment(_0x53a2d8,_0x31cdfa,_0x590cfa,_0x5345c7,_0x18edc2){return new Promise(function(_0x170d3e,_0x5ad276){var _0x352f46=new AWS['Comprehend']({'accessKeyId':_0x31cdfa,'secretAccessKey':_0x53a2d8,'region':_0x590cfa});_0x352f46['detectSentiment']({'Text':_0x5345c7,'LanguageCode':_0x18edc2[_0xab6d('0x9')](0x0,0x2)},function(_0x39942e,_0x36ce0c){if(_0x39942e){return _0x5ad276(_0x39942e);}else{return _0x170d3e(_0x36ce0c);}});});}function checkTranscribeJob(_0x35dca1,_0x1d8936,_0x3868e3){var _0x2c80c8;return new BPromise(function(_0x445deb,_0x58686f){logger[_0xab6d('0xa')](util[_0xab6d('0xb')](_0xab6d('0xc'),_0x35dca1['id'],_0x35dca1[_0xab6d('0xd')]));return getTranscriptionJob(_0x3868e3[_0xab6d('0xe')],_0x3868e3[_0xab6d('0xf')],_0x1d8936['transcribeRegion'],_0x35dca1[_0xab6d('0xd')])[_0xab6d('0x10')](function(_0x30e11a){logger['info'](util[_0xab6d('0xb')](_0xab6d('0x11'),_0x35dca1['id'],_0x35dca1[_0xab6d('0xd')],_0x30e11a[_0xab6d('0x12')][_0xab6d('0x13')]));if(!_0x35dca1[_0xab6d('0x14')]){switch(_0x30e11a[_0xab6d('0x12')][_0xab6d('0x13')]){case _0xab6d('0x15'):var _0x386d8e={'transcribeStatus':_0x30e11a[_0xab6d('0x12')][_0xab6d('0x13')],'fileUri':_0x30e11a[_0xab6d('0x12')][_0xab6d('0x16')][_0xab6d('0x17')]};logger[_0xab6d('0xa')](util[_0xab6d('0xb')](_0xab6d('0x18'),_0x35dca1['id']));return rp({'uri':_0x30e11a[_0xab6d('0x12')]['Transcript'][_0xab6d('0x17')],'json':!![]})['then'](function(_0x962b3a){logger['info'](util[_0xab6d('0xb')](_0xab6d('0x19'),_0x35dca1['id']));if(_0x962b3a&&_0x962b3a[_0xab6d('0x1a')]&&_0x962b3a[_0xab6d('0x1a')]['transcripts']&&_0x962b3a[_0xab6d('0x1a')]['transcripts'][_0xab6d('0x1b')]){_0x386d8e['fileText']='';for(var _0x31e9f8=0x0;_0x31e9f8<_0x962b3a[_0xab6d('0x1a')]['transcripts'][_0xab6d('0x1b')];_0x31e9f8++){_0x386d8e[_0xab6d('0x14')]+=_0x962b3a['results'][_0xab6d('0x1c')][_0x31e9f8]['transcript']+'';}}return _0x35dca1['update'](_0x386d8e);})['then'](function(){logger[_0xab6d('0xa')](util[_0xab6d('0xb')](_0xab6d('0x1d'),_0x35dca1['id']));if(!_0x35dca1[_0xab6d('0x1e')]){throw new db[(_0xab6d('0x1f'))][(_0xab6d('0x20'))](_0xab6d('0x21'));}if(!_0x1d8936[_0xab6d('0x22')]||!_0x1d8936[_0xab6d('0x23')]||!_0x1d8936[_0xab6d('0x24')]||!_0x1d8936[_0xab6d('0x25')]||!_0x1d8936[_0xab6d('0x26')]){throw new db[(_0xab6d('0x1f'))][(_0xab6d('0x20'))](_0xab6d('0x27'));}if(!_0x386d8e[_0xab6d('0x14')]){throw new Error(_0xab6d('0x28'));}if(_0x1d8936[_0xab6d('0x23')]===_0x3868e3['id']){return _0x3868e3;}else{return db[_0xab6d('0x29')][_0xab6d('0x2a')]({'where':{'id':_settings[_0xab6d('0x23')]}});}})[_0xab6d('0x10')](function(_0x396398){if(!_0x396398){throw new db[(_0xab6d('0x1f'))]['ValidationError'](_0xab6d('0x2b'));}if(!_0x396398['data1']||!_0x396398[_0xab6d('0xf')]){throw new db[(_0xab6d('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x2c80c8=_0x396398;logger[_0xab6d('0xa')](util[_0xab6d('0xb')](_0xab6d('0x2c'),_0x35dca1['id']));return sentiment(_0x2c80c8['data1'],_0x2c80c8[_0xab6d('0xf')],_0x1d8936['sentimentRegion'],_0x386d8e[_0xab6d('0x14')],_0x1d8936[_0xab6d('0x25')]);})[_0xab6d('0x10')](function(_0x18b787){logger[_0xab6d('0xa')](util[_0xab6d('0xb')](_0xab6d('0x2d'),_0x35dca1['id']));return _0x35dca1[_0xab6d('0x2e')]({'sentiment':_0x18b787[_0xab6d('0x2f')],'sPositive':_0x18b787[_0xab6d('0x30')][_0xab6d('0x31')],'sNegative':_0x18b787[_0xab6d('0x30')][_0xab6d('0x32')],'sMixed':_0x18b787[_0xab6d('0x30')]['Mixed'],'sNeutral':_0x18b787['SentimentScore'][_0xab6d('0x33')]});})[_0xab6d('0x10')](function(){logger[_0xab6d('0xa')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x35dca1['id']));_0x445deb();});case'FAILED':return _0x35dca1[_0xab6d('0x2e')]({'transcribeStatus':_0xab6d('0x34'),'failureReason':_0x30e11a[_0xab6d('0x12')][_0xab6d('0x35')]})[_0xab6d('0x10')](function(){logger[_0xab6d('0xa')](util[_0xab6d('0xb')](_0xab6d('0x1d'),_0x35dca1['id']));_0x445deb();});default:logger[_0xab6d('0xa')](util[_0xab6d('0xb')](_0xab6d('0x36'),_0x35dca1['id']));break;}}else{return BPromise[_0xab6d('0x37')]()[_0xab6d('0x10')](function(){if(!_0x35dca1[_0xab6d('0x1e')]){throw new db[(_0xab6d('0x1f'))][(_0xab6d('0x20'))](_0xab6d('0x21'));}if(!_0x1d8936[_0xab6d('0x22')]||!_0x1d8936[_0xab6d('0x23')]||!_0x1d8936[_0xab6d('0x24')]||!_0x1d8936['language']||!_0x1d8936[_0xab6d('0x26')]){throw new db['Sequelize'][(_0xab6d('0x20'))](_0xab6d('0x27'));}if(!_0x35dca1['fileText']){throw new Error(_0xab6d('0x28'));}if(_0x1d8936['sentimentAccountId']===_0x3868e3['id']){return _0x3868e3;}else{return db['CloudProvider'][_0xab6d('0x2a')]({'where':{'id':_settings[_0xab6d('0x23')]}});}})[_0xab6d('0x10')](function(_0x5718ee){if(!_0x5718ee){throw new db[(_0xab6d('0x1f'))][(_0xab6d('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5718ee[_0xab6d('0xe')]||!_0x5718ee['data2']){throw new db['Sequelize'][(_0xab6d('0x20'))](_0xab6d('0x38'));}_0x2c80c8=_0x5718ee;logger[_0xab6d('0xa')](util[_0xab6d('0xb')](_0xab6d('0x2c'),_0x35dca1['id']));return sentiment(_0x2c80c8[_0xab6d('0xe')],_0x2c80c8['data2'],_0x1d8936['sentimentRegion'],_0x35dca1['fileText'],_0x1d8936[_0xab6d('0x25')]);})[_0xab6d('0x10')](function(_0x364977){logger[_0xab6d('0xa')](util[_0xab6d('0xb')](_0xab6d('0x2d'),_0x35dca1['id']));return _0x35dca1[_0xab6d('0x2e')]({'sentiment':_0x364977[_0xab6d('0x2f')],'sPositive':_0x364977[_0xab6d('0x30')][_0xab6d('0x31')],'sNegative':_0x364977[_0xab6d('0x30')][_0xab6d('0x32')],'sMixed':_0x364977[_0xab6d('0x30')][_0xab6d('0x39')],'sNeutral':_0x364977[_0xab6d('0x30')][_0xab6d('0x33')],'transcribeStatus':_0xab6d('0x15')});})[_0xab6d('0x10')](function(){logger[_0xab6d('0xa')](util[_0xab6d('0xb')](_0xab6d('0x1d'),_0x35dca1['id']));_0x445deb();});}})[_0xab6d('0x3a')](function(_0x3a62f5){if(_0x3a62f5){if(!_0x3a62f5[_0xab6d('0x3b')]||_0x3a62f5[_0xab6d('0x3b')]!==_0xab6d('0x3c')){logger[_0xab6d('0x3d')](util[_0xab6d('0xb')](_0xab6d('0x3e'),_0x35dca1['id']),util[_0xab6d('0x3f')](_0x3a62f5,{'showHidden':![],'depth':null}));}}_0x445deb();});});}function checkTranscribe(){var _0x14646d;var _0x295753;var _0x17db7a;return db['VoiceRecording'][_0xab6d('0x40')]({'where':{'transcribeStatus':_0xab6d('0x41')}})[_0xab6d('0x10')](function(_0x732bfd){if(!_0x732bfd||!_0x732bfd['length']){throw new db[(_0xab6d('0x1f'))][(_0xab6d('0x20'))](_0xab6d('0x42'));}_0x14646d=_0x732bfd;return db[_0xab6d('0x43')][_0xab6d('0x2a')]({'where':{'id':0x1}});})[_0xab6d('0x10')](function(_0x86552b){if(!_0x86552b){throw new db['Sequelize']['ValidationError'](_0xab6d('0x44'));}_0x295753=_0x86552b;if(!_0x295753[_0xab6d('0x6')]||!_0x295753[_0xab6d('0x45')]||!_0x295753[_0xab6d('0x46')]||!_0x295753[_0xab6d('0x25')]||!_0x295753[_0xab6d('0x26')]){throw new db[(_0xab6d('0x1f'))][(_0xab6d('0x20'))](_0xab6d('0x47'));}return db['CloudProvider'][_0xab6d('0x2a')]({'where':{'id':_0x295753[_0xab6d('0x45')]}});})[_0xab6d('0x10')](function(_0x4b664b){if(!_0x4b664b){throw new db['Sequelize']['ValidationError'](_0xab6d('0x2b'));}if(!_0x4b664b[_0xab6d('0xe')]||!_0x4b664b[_0xab6d('0xf')]){throw new db['Sequelize']['ValidationError'](_0xab6d('0x38'));}_0x17db7a=_0x4b664b;var _0x422f71=[];_0x14646d[_0xab6d('0x48')](function(_0xb671f3){_0x422f71['push'](checkTranscribeJob(_0xb671f3,_0x295753,_0x17db7a));});return BPromise[_0xab6d('0x49')](_0x422f71);})[_0xab6d('0x3a')](function(_0x2f7663){if(_0x2f7663){if(!_0x2f7663['name']||_0x2f7663[_0xab6d('0x3b')]!=='SequelizeValidationError'){logger[_0xab6d('0x3d')](util[_0xab6d('0x3f')](_0x2f7663,{'showHidden':![],'depth':null}));}}});}exports[_0xab6d('0x4a')]=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 aa9ed43..4f198bb 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 _0x9ade=['lastMsgAt','subtract','hours','then','length','map','info','join','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','WhatsappInteraction','findAll'];(function(_0x16ac1e,_0x49cef6){var _0x206606=function(_0x162278){while(--_0x162278){_0x16ac1e['push'](_0x16ac1e['shift']());}};_0x206606(++_0x49cef6);}(_0x9ade,0x8e));var _0xe9ad=function(_0x58581e,_0x3a3aef){_0x58581e=_0x58581e-0x0;var _0x1a0645=_0x9ade[_0x58581e];return _0x1a0645;};'use strict';var _=require(_0xe9ad('0x0'));var moment=require(_0xe9ad('0x1'));var Redis=require(_0xe9ad('0x2'));var util=require(_0xe9ad('0x3'));var config=require(_0xe9ad('0x4'));var db=require(_0xe9ad('0x5'))['db'];var logger=require(_0xe9ad('0x6'))(_0xe9ad('0x7'));config[_0xe9ad('0x8')]=_[_0xe9ad('0x9')](config['redis'],{'host':_0xe9ad('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x382206=[];return db[_0xe9ad('0xb')][_0xe9ad('0xc')]({'raw':!![],'attributes':['id',_0xe9ad('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xe9ad('0xe')](0x18,_0xe9ad('0xf'))}}})[_0xe9ad('0x10')](function(_0x138724){if(_0x138724&&_0x138724[_0xe9ad('0x11')]){_0x382206=_[_0xe9ad('0x12')](_0x138724||[],'id');logger[_0xe9ad('0x13')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x382206[_0xe9ad('0x14')]());return db[_0xe9ad('0xb')]['update']({'closeReason':_0xe9ad('0x15'),'disposition':_0xe9ad('0x16'),'closed':!![],'closedAt':moment()[_0xe9ad('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x382206}});}})[_0xe9ad('0x10')](function(){if(_0x382206&&_0x382206['length']){logger['info'](_0xe9ad('0x18'),_0x382206[_0xe9ad('0x14')]());for(var _0x2296ba=0x0;_0x2296ba<_0x382206[_0xe9ad('0x11')];_0x2296ba++){io[_0xe9ad('0x19')](_0xe9ad('0x1a'),{'id':_0x382206[_0x2296ba],'closed':!![]});}}})[_0xe9ad('0x1b')](function(_0x33e6ce){logger['error'](_0xe9ad('0x1c'),_0x33e6ce?util[_0xe9ad('0x1d')](_0x33e6ce,{'showHidden':![],'depth':null}):'');});}exports[_0xe9ad('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x4dbc=['length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','then'];(function(_0x59f54a,_0x507a13){var _0x4b90d2=function(_0xf0d0ca){while(--_0xf0d0ca){_0x59f54a['push'](_0x59f54a['shift']());}};_0x4b90d2(++_0x507a13);}(_0x4dbc,0x1df));var _0xc4db=function(_0xfc0206,_0x4df746){_0xfc0206=_0xfc0206-0x0;var _0x9d03c3=_0x4dbc[_0xfc0206];return _0x9d03c3;};'use strict';var _=require(_0xc4db('0x0'));var moment=require(_0xc4db('0x1'));var Redis=require(_0xc4db('0x2'));var util=require(_0xc4db('0x3'));var config=require(_0xc4db('0x4'));var db=require(_0xc4db('0x5'))['db'];var logger=require('../logger')(_0xc4db('0x6'));config[_0xc4db('0x7')]=_['defaults'](config[_0xc4db('0x7')],{'host':_0xc4db('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x2adb90=[];return db[_0xc4db('0x9')][_0xc4db('0xa')]({'raw':!![],'attributes':['id',_0xc4db('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xc4db('0xc')](0x18,'hours')}}})[_0xc4db('0xd')](function(_0x174368){if(_0x174368&&_0x174368[_0xc4db('0xe')]){_0x2adb90=_[_0xc4db('0xf')](_0x174368||[],'id');logger[_0xc4db('0x10')](_0xc4db('0x11'),_0x2adb90[_0xc4db('0x12')]());return db['WhatsappInteraction'][_0xc4db('0x13')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0xc4db('0x14'))},{'where':{'id':_0x2adb90}});}})[_0xc4db('0xd')](function(){if(_0x2adb90&&_0x2adb90[_0xc4db('0xe')]){logger[_0xc4db('0x10')](_0xc4db('0x15'),_0x2adb90[_0xc4db('0x12')]());for(var _0x4e175c=0x0;_0x4e175c<_0x2adb90[_0xc4db('0xe')];_0x4e175c++){io[_0xc4db('0x16')](_0xc4db('0x17'),{'id':_0x2adb90[_0x4e175c],'closed':!![]});}}})[_0xc4db('0x18')](function(_0x41cc5b){logger[_0xc4db('0x19')](_0xc4db('0x1a'),_0x41cc5b?util[_0xc4db('0x1b')](_0x41cc5b,{'showHidden':![],'depth':null}):'');});}exports[_0xc4db('0x1c')]=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 7e6751a..aa94691 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd35f=['log','contacts1','CmHopper','finished\x20populating','hopper1','contacts2','hopper2','catch','util','../mysqldb','Innocenzo','@xcally.com','push','now','Biondo','CmContact','destroy','then','bulkCreate'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xd35f,0xc6));var _0xfd35=function(_0x30c7c5,_0x168208){_0x30c7c5=_0x30c7c5-0x0;var _0x29e24e=_0xd35f[_0x30c7c5];return _0x29e24e;};'use strict';var util=require(_0xfd35('0x0'));var db=require(_0xfd35('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xfd35('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xfd35('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xfd35('0x4')]({'id':i,'active':![],'scheduledat':Date[_0xfd35('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xfd35('0x5')](),'updatedAt':Date[_0xfd35('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xfd35('0x4')]({'id':i,'firstName':_0xfd35('0x2')+i,'lastName':_0xfd35('0x6')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xfd35('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xfd35('0x4')]({'id':i,'active':![],'scheduledat':Date[_0xfd35('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xfd35('0x5')](),'updatedAt':Date[_0xfd35('0x5')]()});}db[_0xfd35('0x7')][_0xfd35('0x8')]({'where':{}})[_0xfd35('0x9')](function(){return db[_0xfd35('0x7')][_0xfd35('0xa')](contacts);})[_0xfd35('0x9')](function(){console[_0xfd35('0xb')]('finished\x20populating',_0xfd35('0xc'));return db[_0xfd35('0xd')][_0xfd35('0x8')]({'where':{}});})[_0xfd35('0x9')](function(){return db[_0xfd35('0xd')][_0xfd35('0xa')](hopper);})['then'](function(){console[_0xfd35('0xb')](_0xfd35('0xe'),_0xfd35('0xf'));return db[_0xfd35('0x7')]['bulkCreate'](contacts2);})[_0xfd35('0x9')](function(){console[_0xfd35('0xb')](_0xfd35('0xe'),_0xfd35('0x10'));return db['CmHopper'][_0xfd35('0xa')](hopper2);})['then'](function(){console[_0xfd35('0xb')](_0xfd35('0xe'),_0xfd35('0x11'));})[_0xfd35('0x12')](function(_0x36044d){console[_0xfd35('0xb')](_0x36044d);}); \ No newline at end of file +var _0xa00b=['Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','util','../mysqldb','push','Innocenzo'];(function(_0x588db0,_0x1f8f51){var _0x1a33a9=function(_0x5570d){while(--_0x5570d){_0x588db0['push'](_0x588db0['shift']());}};_0x1a33a9(++_0x1f8f51);}(_0xa00b,0x13f));var _0xba00=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa00b[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xba00('0x0'));var db=require(_0xba00('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xba00('0x2')]({'id':i,'firstName':_0xba00('0x3')+i,'lastName':_0xba00('0x4')+i,'phone':0xf879fb460+i,'email':_0xba00('0x5')+i+_0xba00('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xba00('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xba00('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xba00('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xba00('0x5')+i+_0xba00('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xba00('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xba00('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xba00('0x7')]()});}db[_0xba00('0x8')][_0xba00('0x9')]({'where':{}})[_0xba00('0xa')](function(){return db['CmContact'][_0xba00('0xb')](contacts);})['then'](function(){console[_0xba00('0xc')](_0xba00('0xd'),_0xba00('0xe'));return db[_0xba00('0xf')]['destroy']({'where':{}});})[_0xba00('0xa')](function(){return db[_0xba00('0xf')][_0xba00('0xb')](hopper);})['then'](function(){console['log']('finished\x20populating',_0xba00('0x10'));return db['CmContact']['bulkCreate'](contacts2);})[_0xba00('0xa')](function(){console[_0xba00('0xc')](_0xba00('0xd'),_0xba00('0x11'));return db[_0xba00('0xf')]['bulkCreate'](hopper2);})[_0xba00('0xa')](function(){console[_0xba00('0xc')](_0xba00('0xd'),_0xba00('0x12'));})['catch'](function(_0x2128fe){console[_0xba00('0xc')](_0x2128fe);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 603e3de..709a72c 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f57=['wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','bulkCreate','log','add\x20user','util','../mysqldb','push','agent','format','%s%s','%s%s@xcally.com','password','friend','udp'];(function(_0x41f0ca,_0x5f2934){var _0x55a459=function(_0x21717c){while(--_0x21717c){_0x41f0ca['push'](_0x41f0ca['shift']());}};_0x55a459(++_0x5f2934);}(_0x1f57,0x126));var _0x71f5=function(_0xdf6bc0,_0x423af0){_0xdf6bc0=_0xdf6bc0-0x0;var _0x4f6516=_0x1f57[_0xdf6bc0];return _0x4f6516;};'use strict';var util=require(_0x71f5('0x0'));var db=require(_0x71f5('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x71f5('0x2')]({'name':util['format']('%s%s',_0x71f5('0x3'),i),'fullname':util[_0x71f5('0x4')](_0x71f5('0x5'),_0x71f5('0x3'),i),'email':util[_0x71f5('0x4')](_0x71f5('0x6'),_0x71f5('0x3'),i),'role':_0x71f5('0x3'),'password':_0x71f5('0x7'),'internal':0xfa0+i,'type':_0x71f5('0x8'),'transport':[_0x71f5('0x9'),'ws',_0x71f5('0xa')],'disallow':[_0x71f5('0xb')],'allow':[_0x71f5('0xc')],'defaultuser':util[_0x71f5('0x4')](_0x71f5('0x5'),_0x71f5('0x3'),i),'encryption':_0x71f5('0xd'),'avpf':_0x71f5('0xd'),'force_avp':_0x71f5('0xd'),'icesupport':_0x71f5('0xd'),'dtlsenable':_0x71f5('0xd'),'dtlsverify':'no','dtlscertfile':_0x71f5('0xe'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x71f5('0xf'),'callerid':util['format']('\x22%s\x22\x20<%s>',util['format'](_0x71f5('0x5'),_0x71f5('0x3'),i),0xfa0+i)});}db['User'][_0x71f5('0x10')](users)['then'](function(){console[_0x71f5('0x11')](_0x71f5('0x12'));})['catch'](function(_0x4eb2a5){console[_0x71f5('0x11')](_0x4eb2a5);}); \ No newline at end of file +var _0x149f=['catch','log','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','add\x20user'];(function(_0x3c803b,_0x2da4cb){var _0x2e84b5=function(_0x1f97f9){while(--_0x1f97f9){_0x3c803b['push'](_0x3c803b['shift']());}};_0x2e84b5(++_0x2da4cb);}(_0x149f,0xd3));var _0xf149=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x149f[_0xaa0309];return _0x5de7ce;};'use strict';var util=require('util');var db=require(_0xf149('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf149('0x1')]({'name':util[_0xf149('0x2')](_0xf149('0x3'),_0xf149('0x4'),i),'fullname':util['format'](_0xf149('0x3'),'agent',i),'email':util[_0xf149('0x2')](_0xf149('0x5'),_0xf149('0x4'),i),'role':'agent','password':_0xf149('0x6'),'internal':0xfa0+i,'type':_0xf149('0x7'),'transport':['udp','ws','wss'],'disallow':[_0xf149('0x8')],'allow':[_0xf149('0x9')],'defaultuser':util[_0xf149('0x2')](_0xf149('0x3'),_0xf149('0x4'),i),'encryption':'yes','avpf':'yes','force_avp':_0xf149('0xa'),'icesupport':_0xf149('0xa'),'dtlsenable':_0xf149('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xf149('0xb'),'dtlssetup':_0xf149('0xc'),'callerid':util['format'](_0xf149('0xd'),util[_0xf149('0x2')](_0xf149('0x3'),'agent',i),0xfa0+i)});}db[_0xf149('0xe')]['bulkCreate'](users)[_0xf149('0xf')](function(){console['log'](_0xf149('0x10'));})[_0xf149('0x11')](function(_0x15144e){console[_0xf149('0x12')](_0x15144e);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 336dec4..240abff 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa46e=['Campaign','user','SmsQueues','WhatsappQueues','WhatsappQueue','Trunk','agent','getVoiceQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','leave','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','SmsInteractions','emit','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remotePort','SocketIO\x20','nsp','CONNECTED','lodash','util','../mysqldb','./environment','name','User','role','type','ivr','then','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','format','Agents','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','FaxInteraction','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue'];(function(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_0xa46e,0x8a));var _0xea46=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0xa46e[_0x87239];return _0x53af1e;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var BPromise=require('bluebird');var db=require(_0xea46('0x2'))['db'];var config=require(_0xea46('0x3'));var queryQueues={'attributes':['id',_0xea46('0x4')],'include':[{'as':'Agents','model':db[_0xea46('0x5')],'attributes':['id','name',_0xea46('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xea46('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xea46('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xea46('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xea46('0x4'),_0xea46('0x7')],'where':{'type':_0xea46('0x8')}};function getAssociatedResources(_0x3db7a2,_0x468322,_0x4cf206){return db['UserProfileSection']['findOne']({'where':{'name':_0x3db7a2,'userProfileId':_0x468322},'raw':!![]})[_0xea46('0x9')](function(_0x45550a){if(_0x45550a){if(_0x45550a['autoAssociation']){switch(_0x3db7a2){case _0xea46('0xa'):case _0xea46('0xb'):case _0xea46('0xc'):case'SmsQueues':case _0xea46('0xd'):case _0xea46('0xe'):case'WhatsappQueues':return db[_0x4cf206][_0xea46('0xf')](queryQueues);case _0xea46('0x10'):return db[_0x4cf206]['findAll'](queryTelephones);case _0xea46('0x11'):return db[_0x4cf206]['findAll'](queryTrunks);case _0xea46('0x12'):return db[_0x4cf206][_0xea46('0xf')](queryCampaigns);}}else{return db[_0xea46('0x13')][_0xea46('0xf')]({'attributes':[_0xea46('0x14')],'where':{'sectionId':_0x45550a['id']},'raw':!![]})[_0xea46('0x9')](function(_0x81ee45){if(_0x81ee45){var _0x20a79c={'where':{'id':_[_0xea46('0x15')](_0x81ee45,'resourceId')},'raw':!![]};switch(_0x4cf206){case _0xea46('0x5'):_0x20a79c[_0xea46('0x16')][_0xea46('0x6')]='telephone';break;case'Campaign':_0x20a79c[_0xea46('0x16')][_0xea46('0x7')]='ivr';break;}return db[_0x4cf206]['findAll'](_0x20a79c);}else{return[];}});}}else{return[];}})[_0xea46('0x9')](function(_0x9b7d04){return _0x9b7d04;});}function joinOrLeaveQueues(_0x4ff93d,_0x40316b,_0x16ae38,_0x1adba1){_0x4ff93d[_0x40316b](util[_0xea46('0x17')]('%s:queue:%s',_0x16ae38,_0x1adba1[_0xea46('0x4')]));if(_0x1adba1['Agents']){for(var _0x515e32=0x0;_0x515e32<_0x1adba1[_0xea46('0x18')]['length'];_0x515e32+=0x1){_0x4ff93d[_0x40316b](util['format']('user:%s',_0x1adba1[_0xea46('0x18')][_0x515e32][_0xea46('0x4')]));}}}function joinOrLeave(_0x3d1850,_0x5beb44,_0x16f8fa){var _0x59b10d;if(_0x3d1850[_0xea46('0x19')][_0xea46('0x1a')]['id']){db['User'][_0xea46('0x1b')]({'attributes':['id','name',_0xea46('0x6'),_0xea46('0x1c')],'where':{'id':_0x3d1850[_0xea46('0x19')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0xea46('0x1d'),'attributes':['id'],'raw':!![]},{'model':db[_0xea46('0x1e')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xea46('0x1f')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xea46('0x20')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xea46('0x21')],'as':_0xea46('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xea46('0x23')],'as':_0xea46('0x24'),'attributes':['id'],'raw':!![]}]})[_0xea46('0x9')](function(_0x174345){if(_0x174345){_0x59b10d=_0x174345;_0x3d1850[_0x5beb44](util['format'](_0xea46('0x25'),_0x174345[_0xea46('0x4')]));var _0x200e10=[];switch(_0x174345['role']){case _0xea46('0x26'):_0x3d1850[_0x5beb44](_0xea46('0x27'));_0x3d1850[_0x5beb44](_0xea46('0x28'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues['include'];}_0x200e10[_0xea46('0x29')](db[_0xea46('0x2a')][_0xea46('0xf')](queryQueues));_0x200e10[_0xea46('0x29')](db[_0xea46('0x2b')][_0xea46('0xf')](queryQueues));_0x200e10[_0xea46('0x29')](db[_0xea46('0x2c')][_0xea46('0xf')](queryQueues));_0x200e10[_0xea46('0x29')](db[_0xea46('0x2d')]['findAll'](queryQueues));_0x200e10[_0xea46('0x29')](db[_0xea46('0x2e')][_0xea46('0xf')](queryQueues));_0x200e10[_0xea46('0x29')](db[_0xea46('0x2f')][_0xea46('0xf')](queryQueues));_0x200e10[_0xea46('0x29')](db['WhatsappQueue'][_0xea46('0xf')](queryQueues));_0x200e10[_0xea46('0x29')](db[_0xea46('0x5')][_0xea46('0xf')](queryTelephones));_0x200e10[_0xea46('0x29')](db['Trunk']['findAll'](queryTrunks));_0x200e10[_0xea46('0x29')](db[_0xea46('0x30')]['findAll'](queryCampaigns));_0x200e10[_0xea46('0x29')](db[_0xea46('0x5')][_0xea46('0xf')](queryAgents));break;case _0xea46('0x31'):_0x3d1850[_0x5beb44]('voice:inbound');_0x3d1850[_0x5beb44]('voice:outbound');_0x200e10[_0xea46('0x29')](getAssociatedResources('VoiceQueues',_0x174345[_0xea46('0x1c')],_0xea46('0x2a')));_0x200e10['push'](getAssociatedResources(_0xea46('0xb'),_0x174345[_0xea46('0x1c')],'ChatQueue'));_0x200e10[_0xea46('0x29')](getAssociatedResources(_0xea46('0xc'),_0x174345['userProfileId'],_0xea46('0x2c')));_0x200e10[_0xea46('0x29')](getAssociatedResources(_0xea46('0x32'),_0x174345[_0xea46('0x1c')],'SmsQueue'));_0x200e10[_0xea46('0x29')](getAssociatedResources(_0xea46('0xd'),_0x174345[_0xea46('0x1c')],_0xea46('0x2e')));_0x200e10[_0xea46('0x29')](getAssociatedResources('OpenchannelQueues',_0x174345[_0xea46('0x1c')],_0xea46('0x2f')));_0x200e10['push'](getAssociatedResources(_0xea46('0x33'),_0x174345[_0xea46('0x1c')],_0xea46('0x34')));_0x200e10[_0xea46('0x29')](getAssociatedResources('Telephones',_0x174345[_0xea46('0x1c')],_0xea46('0x5')));_0x200e10[_0xea46('0x29')](getAssociatedResources('Trunks',_0x174345[_0xea46('0x1c')],_0xea46('0x35')));_0x200e10[_0xea46('0x29')](getAssociatedResources(_0xea46('0x12'),_0x174345[_0xea46('0x1c')],_0xea46('0x30')));_0x200e10[_0xea46('0x29')](db[_0xea46('0x5')][_0xea46('0xf')](queryAgents));break;case _0xea46('0x36'):_0x3d1850[_0x5beb44](_0xea46('0x27'));_0x3d1850[_0x5beb44](_0xea46('0x28'));_0x200e10[_0xea46('0x29')](_0x174345[_0xea46('0x37')]({'attributes':['id',_0xea46('0x4')]}));_0x200e10['push'](_0x174345['getChatQueues']({'attributes':['id',_0xea46('0x4')]}));_0x200e10[_0xea46('0x29')](_0x174345[_0xea46('0x38')]({'attributes':['id',_0xea46('0x4')]}));_0x200e10['push'](_0x174345['getSmsQueues']({'attributes':['id','name']}));_0x200e10[_0xea46('0x29')](_0x174345[_0xea46('0x39')]({'attributes':['id','name']}));_0x200e10[_0xea46('0x29')](_0x174345[_0xea46('0x3a')]({'attributes':['id',_0xea46('0x4')]}));_0x200e10[_0xea46('0x29')](_0x174345[_0xea46('0x3b')]({'attributes':['id','name']}));break;}return BPromise[_0xea46('0x3c')](_0x200e10);}})['then'](function(_0x22d9a2){if(_0x22d9a2&&_0x22d9a2[_0xea46('0x3d')]){for(var _0x45ee37=0x0;_0x45ee37<_0x22d9a2[_0xea46('0x3d')];_0x45ee37+=0x1){for(var _0x9c26cf=0x0;_0x9c26cf<_0x22d9a2[_0x45ee37][_0xea46('0x3d')];_0x9c26cf+=0x1){switch(_0x45ee37){case 0x0:joinOrLeaveQueues(_0x3d1850,_0x5beb44,_0xea46('0x3e'),_0x22d9a2[_0x45ee37][_0x9c26cf]);break;case 0x1:joinOrLeaveQueues(_0x3d1850,_0x5beb44,'chat',_0x22d9a2[_0x45ee37][_0x9c26cf]);break;case 0x2:joinOrLeaveQueues(_0x3d1850,_0x5beb44,_0xea46('0x3f'),_0x22d9a2[_0x45ee37][_0x9c26cf]);break;case 0x3:joinOrLeaveQueues(_0x3d1850,_0x5beb44,_0xea46('0x40'),_0x22d9a2[_0x45ee37][_0x9c26cf]);break;case 0x4:joinOrLeaveQueues(_0x3d1850,_0x5beb44,'mail',_0x22d9a2[_0x45ee37][_0x9c26cf]);break;case 0x5:joinOrLeaveQueues(_0x3d1850,_0x5beb44,_0xea46('0x41'),_0x22d9a2[_0x45ee37][_0x9c26cf]);break;case 0x6:joinOrLeaveQueues(_0x3d1850,_0x5beb44,_0xea46('0x42'),_0x22d9a2[_0x45ee37][_0x9c26cf]);break;case 0x7:if(_0x59b10d[_0xea46('0x6')]!=='agent')_0x3d1850[_0x5beb44](util['format'](_0xea46('0x43'),_0x22d9a2[_0x45ee37][_0x9c26cf][_0xea46('0x4')]));break;case 0x8:if(_0x59b10d[_0xea46('0x6')]!==_0xea46('0x36'))_0x3d1850[_0x5beb44](util[_0xea46('0x17')](_0xea46('0x44'),_0x22d9a2[_0x45ee37][_0x9c26cf][_0xea46('0x4')]));break;case 0x9:if(_0x59b10d[_0xea46('0x6')]!==_0xea46('0x36'))_0x3d1850[_0x5beb44](util[_0xea46('0x17')]('campaign:%s:%s',_0x22d9a2[_0x45ee37][_0x9c26cf][_0xea46('0x7')],_0x22d9a2[_0x45ee37][_0x9c26cf]['name']));break;case 0xa:_0x3d1850[_0x5beb44](util[_0xea46('0x17')](_0xea46('0x25'),_0x22d9a2[_0x45ee37][_0x9c26cf][_0xea46('0x4')]));break;}}}}})['then'](function(){if(_0x5beb44===_0xea46('0x45')){var _0x125abb=_[_0xea46('0x15')](_0x59b10d[_0xea46('0x1d')],'id');return _0x59b10d['removeChatInteractions'](_0x125abb)['then'](function(){for(var _0x6584e9=0x0;_0x6584e9<_0x125abb[_0xea46('0x3d')];_0x6584e9+=0x1){_0x16f8fa['emit'](_0xea46('0x46'),{'ChatInteractionId':Number(_0x125abb[_0x6584e9]),'UserId':Number(_0x59b10d['id'])});}});}})['then'](function(){if(_0x5beb44===_0xea46('0x45')){var _0x3830fe=_[_0xea46('0x15')](_0x59b10d[_0xea46('0x47')],'id');return _0x59b10d[_0xea46('0x48')](_0x3830fe)[_0xea46('0x9')](function(){for(var _0x391eae=0x0;_0x391eae<_0x3830fe['length'];_0x391eae+=0x1){_0x16f8fa['emit'](_0xea46('0x49'),{'MailInteractionId':Number(_0x3830fe[_0x391eae]),'UserId':Number(_0x59b10d['id'])});}});}})['then'](function(){if(_0x5beb44===_0xea46('0x45')){var _0x16022f=_[_0xea46('0x15')](_0x59b10d['FaxInteractions'],'id');return _0x59b10d[_0xea46('0x4a')](_0x16022f)['then'](function(){for(var _0xc12018=0x0;_0xc12018<_0x16022f[_0xea46('0x3d')];_0xc12018+=0x1){_0x16f8fa['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x16022f[_0xc12018]),'UserId':Number(_0x59b10d['id'])});}});}})[_0xea46('0x9')](function(){if(_0x5beb44===_0xea46('0x45')){var _0x3199f2=_['map'](_0x59b10d[_0xea46('0x4b')],'id');return _0x59b10d['removeSmsInteractions'](_0x3199f2)[_0xea46('0x9')](function(){for(var _0x5944ba=0x0;_0x5944ba<_0x3199f2[_0xea46('0x3d')];_0x5944ba+=0x1){_0x16f8fa[_0xea46('0x4c')](_0xea46('0x4d'),{'SmsInteractionId':Number(_0x3199f2[_0x5944ba]),'UserId':Number(_0x59b10d['id'])});}});}})[_0xea46('0x9')](function(){if(_0x5beb44===_0xea46('0x45')){var _0x4c5beb=_[_0xea46('0x15')](_0x59b10d[_0xea46('0x22')],'id');return _0x59b10d[_0xea46('0x4e')](_0x4c5beb)['then'](function(){for(var _0x4e75a7=0x0;_0x4e75a7<_0x4c5beb[_0xea46('0x3d')];_0x4e75a7+=0x1){_0x16f8fa[_0xea46('0x4c')](_0xea46('0x4f'),{'OpenchannelInteractionId':Number(_0x4c5beb[_0x4e75a7]),'UserId':Number(_0x59b10d['id'])});}});}})[_0xea46('0x9')](function(){if(_0x5beb44===_0xea46('0x45')){var _0x175a42=_[_0xea46('0x15')](_0x59b10d[_0xea46('0x24')],'id');return _0x59b10d[_0xea46('0x50')](_0x175a42)[_0xea46('0x9')](function(){for(var _0xa307cf=0x0;_0xa307cf<_0x175a42[_0xea46('0x3d')];_0xa307cf+=0x1){_0x16f8fa[_0xea46('0x4c')](_0xea46('0x51'),{'WhatsappInteractionId':Number(_0x175a42[_0xa307cf]),'UserId':Number(_0x59b10d['id'])});}});}})[_0xea46('0x52')](function(_0x487b4e){_0x3d1850[_0xea46('0x53')](_0x487b4e);});}}function onDisconnect(_0x2c248c,_0x397e98){joinOrLeave(_0x2c248c,_0xea46('0x45'),_0x397e98);}function onConnect(_0x5b353f){joinOrLeave(_0x5b353f,_0xea46('0x54'));}exports[_0xea46('0x55')]=function(_0x5b5142){_0x5b5142['on'](_0xea46('0x56'),function(_0x419f86){_0x419f86['setMaxListeners'](0x0);_0x419f86[_0xea46('0x57')]=_0x419f86[_0xea46('0x58')][_0xea46('0x56')]['remoteAddress']+':'+_0x419f86[_0xea46('0x58')][_0xea46('0x56')][_0xea46('0x59')];_0x419f86['connectedAt']=new Date();_0x419f86['log']=function(_0x587bd3){console[_0xea46('0x53')](_0xea46('0x5a')+_0x419f86[_0xea46('0x5b')][_0xea46('0x4')]+'['+_0x419f86[_0xea46('0x57')]+']',_0x587bd3);};_0x419f86['on']('disconnect',function(){onDisconnect(_0x419f86,_0x5b5142);_0x419f86[_0xea46('0x53')]('DISCONNECTED');});onConnect(_0x419f86);_0x419f86[_0xea46('0x53')](_0xea46('0x5c'));});}; \ No newline at end of file +var _0x2dd8=['openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','emit','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','connection','address','request','remoteAddress','remotePort','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','./environment','name','Agents','User','role','agent','telephone','type','ivr','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','then','map','where','Campaign','format','length','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','sms','mail'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2dd8,0x143));var _0x82dd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2dd8[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x82dd('0x0'));var util=require(_0x82dd('0x1'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0x82dd('0x2'));var queryQueues={'attributes':['id',_0x82dd('0x3')],'include':[{'as':_0x82dd('0x4'),'model':db[_0x82dd('0x5')],'attributes':['id',_0x82dd('0x3'),_0x82dd('0x6')],'raw':!![],'where':{'role':_0x82dd('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x82dd('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x82dd('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x82dd('0x3')],'where':{'role':_0x82dd('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x82dd('0x9')],'where':{'type':_0x82dd('0xa')}};function getAssociatedResources(_0x1769f7,_0xa20f80,_0x488126){return db['UserProfileSection'][_0x82dd('0xb')]({'where':{'name':_0x1769f7,'userProfileId':_0xa20f80},'raw':!![]})['then'](function(_0x29308f){if(_0x29308f){if(_0x29308f[_0x82dd('0xc')]){switch(_0x1769f7){case _0x82dd('0xd'):case _0x82dd('0xe'):case _0x82dd('0xf'):case'SmsQueues':case _0x82dd('0x10'):case _0x82dd('0x11'):case _0x82dd('0x12'):return db[_0x488126][_0x82dd('0x13')](queryQueues);case _0x82dd('0x14'):return db[_0x488126]['findAll'](queryTelephones);case'Trunks':return db[_0x488126][_0x82dd('0x13')](queryTrunks);case _0x82dd('0x15'):return db[_0x488126][_0x82dd('0x13')](queryCampaigns);}}else{return db[_0x82dd('0x16')][_0x82dd('0x13')]({'attributes':[_0x82dd('0x17')],'where':{'sectionId':_0x29308f['id']},'raw':!![]})[_0x82dd('0x18')](function(_0x275802){if(_0x275802){var _0x101eb7={'where':{'id':_[_0x82dd('0x19')](_0x275802,_0x82dd('0x17'))},'raw':!![]};switch(_0x488126){case _0x82dd('0x5'):_0x101eb7[_0x82dd('0x1a')]['role']=_0x82dd('0x8');break;case _0x82dd('0x1b'):_0x101eb7[_0x82dd('0x1a')][_0x82dd('0x9')]=_0x82dd('0xa');break;}return db[_0x488126][_0x82dd('0x13')](_0x101eb7);}else{return[];}});}}else{return[];}})[_0x82dd('0x18')](function(_0x1e8ea2){return _0x1e8ea2;});}function joinOrLeaveQueues(_0x26373a,_0x392d3f,_0x295aad,_0x21d655){_0x26373a[_0x392d3f](util[_0x82dd('0x1c')]('%s:queue:%s',_0x295aad,_0x21d655[_0x82dd('0x3')]));if(_0x21d655[_0x82dd('0x4')]){for(var _0x28352e=0x0;_0x28352e<_0x21d655[_0x82dd('0x4')][_0x82dd('0x1d')];_0x28352e+=0x1){_0x26373a[_0x392d3f](util[_0x82dd('0x1c')](_0x82dd('0x1e'),_0x21d655[_0x82dd('0x4')][_0x28352e]['name']));}}}function joinOrLeave(_0x5e94ee,_0x1c095e,_0x96dbc0){var _0x4e1463;if(_0x5e94ee['handshake'][_0x82dd('0x1f')]['id']){db[_0x82dd('0x5')][_0x82dd('0x20')]({'attributes':['id',_0x82dd('0x3'),_0x82dd('0x6'),_0x82dd('0x21')],'where':{'id':_0x5e94ee[_0x82dd('0x22')][_0x82dd('0x1f')]['id']},'include':[{'model':db[_0x82dd('0x23')],'as':_0x82dd('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x82dd('0x25')],'as':_0x82dd('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x82dd('0x27')],'as':_0x82dd('0x28'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x82dd('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x82dd('0x2a')],'as':_0x82dd('0x2b'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x82dd('0x2c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x15f31f){if(_0x15f31f){_0x4e1463=_0x15f31f;_0x5e94ee[_0x1c095e](util[_0x82dd('0x1c')](_0x82dd('0x1e'),_0x15f31f['name']));var _0x21fe78=[];switch(_0x15f31f[_0x82dd('0x6')]){case'admin':_0x5e94ee[_0x1c095e]('voice:inbound');_0x5e94ee[_0x1c095e](_0x82dd('0x2d'));if(queryQueues[_0x82dd('0x2e')]('include')){delete queryQueues[_0x82dd('0x2f')];}_0x21fe78[_0x82dd('0x30')](db[_0x82dd('0x31')]['findAll'](queryQueues));_0x21fe78[_0x82dd('0x30')](db[_0x82dd('0x32')]['findAll'](queryQueues));_0x21fe78['push'](db[_0x82dd('0x33')][_0x82dd('0x13')](queryQueues));_0x21fe78['push'](db[_0x82dd('0x34')][_0x82dd('0x13')](queryQueues));_0x21fe78[_0x82dd('0x30')](db[_0x82dd('0x35')][_0x82dd('0x13')](queryQueues));_0x21fe78['push'](db[_0x82dd('0x36')][_0x82dd('0x13')](queryQueues));_0x21fe78['push'](db[_0x82dd('0x37')][_0x82dd('0x13')](queryQueues));_0x21fe78[_0x82dd('0x30')](db[_0x82dd('0x5')]['findAll'](queryTelephones));_0x21fe78[_0x82dd('0x30')](db[_0x82dd('0x38')][_0x82dd('0x13')](queryTrunks));_0x21fe78[_0x82dd('0x30')](db[_0x82dd('0x1b')][_0x82dd('0x13')](queryCampaigns));_0x21fe78[_0x82dd('0x30')](db[_0x82dd('0x5')]['findAll'](queryAgents));break;case _0x82dd('0x39'):_0x5e94ee[_0x1c095e]('voice:inbound');_0x5e94ee[_0x1c095e](_0x82dd('0x2d'));_0x21fe78[_0x82dd('0x30')](getAssociatedResources(_0x82dd('0xd'),_0x15f31f['userProfileId'],_0x82dd('0x31')));_0x21fe78[_0x82dd('0x30')](getAssociatedResources(_0x82dd('0xe'),_0x15f31f[_0x82dd('0x21')],'ChatQueue'));_0x21fe78['push'](getAssociatedResources(_0x82dd('0xf'),_0x15f31f[_0x82dd('0x21')],_0x82dd('0x33')));_0x21fe78[_0x82dd('0x30')](getAssociatedResources('SmsQueues',_0x15f31f['userProfileId'],_0x82dd('0x34')));_0x21fe78[_0x82dd('0x30')](getAssociatedResources('MailQueues',_0x15f31f[_0x82dd('0x21')],_0x82dd('0x35')));_0x21fe78[_0x82dd('0x30')](getAssociatedResources(_0x82dd('0x11'),_0x15f31f[_0x82dd('0x21')],_0x82dd('0x36')));_0x21fe78[_0x82dd('0x30')](getAssociatedResources(_0x82dd('0x12'),_0x15f31f[_0x82dd('0x21')],_0x82dd('0x37')));_0x21fe78[_0x82dd('0x30')](getAssociatedResources(_0x82dd('0x14'),_0x15f31f[_0x82dd('0x21')],_0x82dd('0x5')));_0x21fe78[_0x82dd('0x30')](getAssociatedResources(_0x82dd('0x3a'),_0x15f31f[_0x82dd('0x21')],_0x82dd('0x38')));_0x21fe78[_0x82dd('0x30')](getAssociatedResources('IvrCampaigns',_0x15f31f[_0x82dd('0x21')],'Campaign'));_0x21fe78['push'](db[_0x82dd('0x5')][_0x82dd('0x13')](queryAgents));break;case _0x82dd('0x7'):_0x5e94ee[_0x1c095e]('voice:inbound');_0x5e94ee[_0x1c095e](_0x82dd('0x2d'));_0x21fe78[_0x82dd('0x30')](_0x15f31f[_0x82dd('0x3b')]({'attributes':['id',_0x82dd('0x3')]}));_0x21fe78[_0x82dd('0x30')](_0x15f31f[_0x82dd('0x3c')]({'attributes':['id','name']}));_0x21fe78[_0x82dd('0x30')](_0x15f31f[_0x82dd('0x3d')]({'attributes':['id',_0x82dd('0x3')]}));_0x21fe78[_0x82dd('0x30')](_0x15f31f[_0x82dd('0x3e')]({'attributes':['id','name']}));_0x21fe78[_0x82dd('0x30')](_0x15f31f[_0x82dd('0x3f')]({'attributes':['id','name']}));_0x21fe78[_0x82dd('0x30')](_0x15f31f[_0x82dd('0x40')]({'attributes':['id',_0x82dd('0x3')]}));_0x21fe78[_0x82dd('0x30')](_0x15f31f[_0x82dd('0x41')]({'attributes':['id',_0x82dd('0x3')]}));break;}return BPromise['all'](_0x21fe78);}})[_0x82dd('0x18')](function(_0x1a1cbb){if(_0x1a1cbb&&_0x1a1cbb[_0x82dd('0x1d')]){for(var _0x1c6fa3=0x0;_0x1c6fa3<_0x1a1cbb['length'];_0x1c6fa3+=0x1){for(var _0x23b4c6=0x0;_0x23b4c6<_0x1a1cbb[_0x1c6fa3][_0x82dd('0x1d')];_0x23b4c6+=0x1){switch(_0x1c6fa3){case 0x0:joinOrLeaveQueues(_0x5e94ee,_0x1c095e,_0x82dd('0x42'),_0x1a1cbb[_0x1c6fa3][_0x23b4c6]);break;case 0x1:joinOrLeaveQueues(_0x5e94ee,_0x1c095e,'chat',_0x1a1cbb[_0x1c6fa3][_0x23b4c6]);break;case 0x2:joinOrLeaveQueues(_0x5e94ee,_0x1c095e,'fax',_0x1a1cbb[_0x1c6fa3][_0x23b4c6]);break;case 0x3:joinOrLeaveQueues(_0x5e94ee,_0x1c095e,_0x82dd('0x43'),_0x1a1cbb[_0x1c6fa3][_0x23b4c6]);break;case 0x4:joinOrLeaveQueues(_0x5e94ee,_0x1c095e,_0x82dd('0x44'),_0x1a1cbb[_0x1c6fa3][_0x23b4c6]);break;case 0x5:joinOrLeaveQueues(_0x5e94ee,_0x1c095e,_0x82dd('0x45'),_0x1a1cbb[_0x1c6fa3][_0x23b4c6]);break;case 0x6:joinOrLeaveQueues(_0x5e94ee,_0x1c095e,_0x82dd('0x46'),_0x1a1cbb[_0x1c6fa3][_0x23b4c6]);break;case 0x7:if(_0x4e1463[_0x82dd('0x6')]!=='agent')_0x5e94ee[_0x1c095e](util['format'](_0x82dd('0x47'),_0x1a1cbb[_0x1c6fa3][_0x23b4c6][_0x82dd('0x3')]));break;case 0x8:if(_0x4e1463['role']!=='agent')_0x5e94ee[_0x1c095e](util['format'](_0x82dd('0x48'),_0x1a1cbb[_0x1c6fa3][_0x23b4c6]['name']));break;case 0x9:if(_0x4e1463[_0x82dd('0x6')]!==_0x82dd('0x7'))_0x5e94ee[_0x1c095e](util[_0x82dd('0x1c')](_0x82dd('0x49'),_0x1a1cbb[_0x1c6fa3][_0x23b4c6][_0x82dd('0x9')],_0x1a1cbb[_0x1c6fa3][_0x23b4c6][_0x82dd('0x3')]));break;case 0xa:_0x5e94ee[_0x1c095e](util[_0x82dd('0x1c')](_0x82dd('0x1e'),_0x1a1cbb[_0x1c6fa3][_0x23b4c6][_0x82dd('0x3')]));break;}}}}})['then'](function(){if(_0x1c095e===_0x82dd('0x4a')){var _0x1a9479=_[_0x82dd('0x19')](_0x4e1463[_0x82dd('0x24')],'id');return _0x4e1463[_0x82dd('0x4b')](_0x1a9479)[_0x82dd('0x18')](function(){for(var _0x36246c=0x0;_0x36246c<_0x1a9479[_0x82dd('0x1d')];_0x36246c+=0x1){_0x96dbc0['emit'](_0x82dd('0x4c'),{'ChatInteractionId':Number(_0x1a9479[_0x36246c]),'UserId':Number(_0x4e1463['id'])});}});}})[_0x82dd('0x18')](function(){if(_0x1c095e===_0x82dd('0x4a')){var _0x135e83=_[_0x82dd('0x19')](_0x4e1463[_0x82dd('0x26')],'id');return _0x4e1463[_0x82dd('0x4d')](_0x135e83)['then'](function(){for(var _0xea9687=0x0;_0xea9687<_0x135e83[_0x82dd('0x1d')];_0xea9687+=0x1){_0x96dbc0['emit'](_0x82dd('0x4e'),{'MailInteractionId':Number(_0x135e83[_0xea9687]),'UserId':Number(_0x4e1463['id'])});}});}})[_0x82dd('0x18')](function(){if(_0x1c095e===_0x82dd('0x4a')){var _0x494e2b=_[_0x82dd('0x19')](_0x4e1463['FaxInteractions'],'id');return _0x4e1463[_0x82dd('0x4f')](_0x494e2b)[_0x82dd('0x18')](function(){for(var _0x463ea9=0x0;_0x463ea9<_0x494e2b[_0x82dd('0x1d')];_0x463ea9+=0x1){_0x96dbc0[_0x82dd('0x50')](_0x82dd('0x51'),{'FaxInteractionId':Number(_0x494e2b[_0x463ea9]),'UserId':Number(_0x4e1463['id'])});}});}})[_0x82dd('0x18')](function(){if(_0x1c095e===_0x82dd('0x4a')){var _0x186db4=_['map'](_0x4e1463[_0x82dd('0x29')],'id');return _0x4e1463[_0x82dd('0x52')](_0x186db4)[_0x82dd('0x18')](function(){for(var _0x4b279b=0x0;_0x4b279b<_0x186db4[_0x82dd('0x1d')];_0x4b279b+=0x1){_0x96dbc0[_0x82dd('0x50')](_0x82dd('0x53'),{'SmsInteractionId':Number(_0x186db4[_0x4b279b]),'UserId':Number(_0x4e1463['id'])});}});}})[_0x82dd('0x18')](function(){if(_0x1c095e==='leave'){var _0x32bad0=_[_0x82dd('0x19')](_0x4e1463[_0x82dd('0x2b')],'id');return _0x4e1463[_0x82dd('0x54')](_0x32bad0)[_0x82dd('0x18')](function(){for(var _0x37a4a5=0x0;_0x37a4a5<_0x32bad0['length'];_0x37a4a5+=0x1){_0x96dbc0[_0x82dd('0x50')](_0x82dd('0x55'),{'OpenchannelInteractionId':Number(_0x32bad0[_0x37a4a5]),'UserId':Number(_0x4e1463['id'])});}});}})[_0x82dd('0x18')](function(){if(_0x1c095e===_0x82dd('0x4a')){var _0x493000=_[_0x82dd('0x19')](_0x4e1463['WhatsappInteractions'],'id');return _0x4e1463[_0x82dd('0x56')](_0x493000)[_0x82dd('0x18')](function(){for(var _0x5e3e94=0x0;_0x5e3e94<_0x493000[_0x82dd('0x1d')];_0x5e3e94+=0x1){_0x96dbc0['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x493000[_0x5e3e94]),'UserId':Number(_0x4e1463['id'])});}});}})[_0x82dd('0x57')](function(_0x48d67c){_0x5e94ee[_0x82dd('0x58')](_0x48d67c);});}}function onDisconnect(_0x5b3581,_0x16a4ff){joinOrLeave(_0x5b3581,_0x82dd('0x4a'),_0x16a4ff);}function onConnect(_0x57fc51){joinOrLeave(_0x57fc51,'join');}exports['default']=function(_0x355ae6){_0x355ae6['on'](_0x82dd('0x59'),function(_0x427457){_0x427457['setMaxListeners'](0x0);_0x427457[_0x82dd('0x5a')]=_0x427457[_0x82dd('0x5b')]['connection'][_0x82dd('0x5c')]+':'+_0x427457['request']['connection'][_0x82dd('0x5d')];_0x427457['connectedAt']=new Date();_0x427457[_0x82dd('0x58')]=function(_0x4a2e22){console[_0x82dd('0x58')](_0x82dd('0x5e')+_0x427457['nsp'][_0x82dd('0x3')]+'['+_0x427457['address']+']',_0x4a2e22);};_0x427457['on'](_0x82dd('0x5f'),function(){onDisconnect(_0x427457,_0x355ae6);_0x427457[_0x82dd('0x58')](_0x82dd('0x60'));});onConnect(_0x427457);_0x427457[_0x82dd('0x58')](_0x82dd('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 26d9b22..04d9b77 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 _0xb416=['info','error','code','Trigger,\x20%s','catch','get','channel','motionChannel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','QueryTypes','SELECT','contact','UserId','interface','format','agent','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','opened','Sequelize','SIP/%s','name','AfterCreate','closed','changed','substatus','sequelize','AfterUpdate','fullname','email','internal','default','length','hasOwnProperty','model','callback','toLowerCase','condition','util','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then'];(function(_0x459828,_0x4d4d45){var _0x5c1098=function(_0x5f0d19){while(--_0x5f0d19){_0x459828['push'](_0x459828['shift']());}};_0x5c1098(++_0x4d4d45);}(_0xb416,0x1aa));var _0x6b41=function(_0x31f58a,_0xa8b866){_0x31f58a=_0x31f58a-0x0;var _0x3b3be6=_0xb416[_0x31f58a];return _0x3b3be6;};'use strict';var util=require(_0x6b41('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x6b41('0x1'));var logger=require(_0x6b41('0x2'))(_0x6b41('0x3'));var client=jayson[_0x6b41('0x4')][_0x6b41('0x5')]({'port':0x232a});var triggers=[{'channel':_0x6b41('0x6'),'model':_0x6b41('0x7'),'event':_0x6b41('0x8'),'condition':_0x6b41('0x9'),'callback':afterCreate},{'channel':_0x6b41('0x6'),'model':_0x6b41('0x7'),'event':_0x6b41('0xa'),'condition':_0x6b41('0xb'),'callback':afterUpdate},{'channel':_0x6b41('0x6'),'model':_0x6b41('0xc'),'event':_0x6b41('0x8'),'condition':_0x6b41('0xd'),'callback':afterCreateMessage},{'channel':_0x6b41('0x6'),'model':'ChatOfflineMessage','event':'afterCreate','condition':_0x6b41('0xd'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':'SmsInteraction','event':_0x6b41('0x8'),'condition':_0x6b41('0x9'),'callback':afterCreate},{'channel':'Sms','model':_0x6b41('0xe'),'event':_0x6b41('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':_0x6b41('0xf'),'event':_0x6b41('0x8'),'condition':_0x6b41('0xd'),'callback':afterCreateMessage},{'channel':_0x6b41('0x10'),'model':_0x6b41('0x11'),'event':'afterCreate','condition':_0x6b41('0x9'),'callback':afterCreate},{'channel':_0x6b41('0x10'),'model':_0x6b41('0x11'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':'Whatsapp','model':_0x6b41('0x12'),'event':_0x6b41('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0x6b41('0x13'),'event':'afterCreate','condition':_0x6b41('0x9'),'callback':afterCreate},{'channel':_0x6b41('0x14'),'model':_0x6b41('0x13'),'event':_0x6b41('0xa'),'condition':_0x6b41('0xb'),'callback':afterUpdate},{'channel':_0x6b41('0x14'),'model':'FaxMessage','event':_0x6b41('0x8'),'condition':_0x6b41('0xd'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x6b41('0x15'),'event':_0x6b41('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x6b41('0x16'),'model':_0x6b41('0x15'),'event':'afterUpdate','condition':_0x6b41('0xb'),'callback':afterUpdate},{'channel':_0x6b41('0x16'),'model':_0x6b41('0x17'),'event':_0x6b41('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x6b41('0x18'),'model':_0x6b41('0x19'),'event':'afterCreate','condition':_0x6b41('0x9'),'callback':afterCreate},{'channel':_0x6b41('0x18'),'model':_0x6b41('0x19'),'event':_0x6b41('0xa'),'condition':_0x6b41('0xb'),'callback':afterUpdate},{'channel':_0x6b41('0x18'),'model':_0x6b41('0x1a'),'event':_0x6b41('0x8'),'condition':_0x6b41('0xd'),'callback':afterCreateMessage}];function request(_0x2c1e97){return client[_0x6b41('0x1b')](_0x6b41('0x1c'),_0x2c1e97)[_0x6b41('0x1d')](function(_0x1b79ec){logger[_0x6b41('0x1e')]('Trigger,\x20%s',_0x6b41('0x1c'),_0x1b79ec);if(_0x1b79ec[_0x6b41('0x1f')]){if(_0x1b79ec[_0x6b41('0x1f')][_0x6b41('0x20')]===0x1f4){logger[_0x6b41('0x1f')](_0x6b41('0x21'),_0x6b41('0x1c'),_0x1b79ec[_0x6b41('0x1f')]);}}})[_0x6b41('0x22')](function(_0x51d8d3){logger[_0x6b41('0x1f')](_0x6b41('0x21'),'EventManager',_0x51d8d3);});}function afterCreateMessage(_0x90f64){return function(_0x3a4b1f){_0x3a4b1f=_0x3a4b1f[_0x6b41('0x23')]({'plain':!![]});_0x3a4b1f[_0x6b41('0x24')]=_0x90f64;_0x3a4b1f[_0x6b41('0x25')]=_0x90f64;_0x3a4b1f[_0x6b41('0x26')]=_0x3a4b1f[_0x6b41('0x27')];Promise[_0x6b41('0x28')]()['then'](function(){if(typeof _0x3a4b1f[_0x6b41('0x29')]===_0x6b41('0x2a'))return null;var _0x30aee3=_0x6b41('0x2b')+_0x3a4b1f[_0x6b41('0x29')];return db['sequelize'][_0x6b41('0x2c')](_0x30aee3,{'type':db['Sequelize'][_0x6b41('0x2d')][_0x6b41('0x2e')],'raw':!![]});})[_0x6b41('0x1d')](function(_0x1cd55e){if(_0x1cd55e){_0x3a4b1f[_0x6b41('0x2f')]=_0x1cd55e[0x0];}if(typeof _0x3a4b1f['UserId']==='undefined')return;return getAgent(_0x3a4b1f[_0x6b41('0x30')]);})[_0x6b41('0x1d')](function(_0x68ee3d){if(_0x68ee3d){_0x3a4b1f[_0x6b41('0x31')]=util[_0x6b41('0x32')]('SIP/%s',_0x68ee3d['name']);_0x3a4b1f[_0x6b41('0x33')]=_0x68ee3d;_0x3a4b1f[_0x6b41('0x24')]=_0x90f64;return request({'event':_0x6b41('0x34'),'message':_0x3a4b1f});}else{return request({'event':_0x6b41('0x35'),'message':_0x3a4b1f});}})[_0x6b41('0x22')](function(_0x26b06f){logger[_0x6b41('0x1f')]('Trigger,\x20%s',_0x6b41('0x36'),_0x26b06f);});};}function afterCreateOfflineMessage(_0x159a9d){return function(_0x241eb4){_0x241eb4=_0x241eb4[_0x6b41('0x23')]({'plain':!![]});_0x241eb4[_0x6b41('0x24')]=_0x159a9d;_0x241eb4[_0x6b41('0x25')]=_0x159a9d;_0x241eb4[_0x6b41('0x26')]=_0x6b41('0x37');return request({'event':_0x241eb4['event'],'message':_0x241eb4});};}function afterCreate(_0x1e0ad4,_0x446f55){return function(_0xe596b8){_0xe596b8=_0xe596b8['get']({'plain':!![]});_0xe596b8[_0x6b41('0x24')]=_0x1e0ad4;_0xe596b8[_0x6b41('0x25')]=_0x1e0ad4;_0xe596b8[_0x6b41('0x26')]=_0x6b41('0x38');Promise['resolve']()[_0x6b41('0x1d')](function(){var _0x4ad2ce=_0x6b41('0x2b')+_0xe596b8[_0x6b41('0x29')];return db['sequelize'][_0x6b41('0x2c')](_0x4ad2ce,{'type':db[_0x6b41('0x39')][_0x6b41('0x2d')][_0x6b41('0x2e')],'raw':!![]});})[_0x6b41('0x1d')](function(_0x18a0b6){if(_0x18a0b6){_0xe596b8[_0x6b41('0x2f')]=_0x18a0b6[0x0];}if(typeof _0xe596b8[_0x6b41('0x30')]===_0x6b41('0x2a'))return;return getAgent(_0xe596b8[_0x6b41('0x30')]);})[_0x6b41('0x1d')](function(_0x46f149){if(_0x46f149){_0xe596b8['interface']=util[_0x6b41('0x32')](_0x6b41('0x3a'),_0x46f149[_0x6b41('0x3b')]);_0xe596b8[_0x6b41('0x33')]=_0x46f149;}return request({'event':_0x446f55,'message':_0xe596b8});})['catch'](function(_0x3909ea){logger['error'](_0x6b41('0x21'),_0x6b41('0x3c'),_0x3909ea);});};}function afterUpdate(_0x239980){return function(_0x296ad5){var _0x2f6fd3=_0x296ad5['changed']('closed')&&_0x296ad5[_0x6b41('0x3d')];var _0x3533e7=_0x296ad5[_0x6b41('0x3e')](_0x6b41('0x3f'));if(_0x2f6fd3||_0x3533e7){var _0x5284de=_0x2f6fd3?'closedinteraction':_0x6b41('0x3f');var _0x4287ab=_0x296ad5[_0x6b41('0x23')]({'plain':!![]});_0x4287ab[_0x6b41('0x24')]=_0x239980;_0x4287ab[_0x6b41('0x25')]=_0x239980;_0x4287ab[_0x6b41('0x26')]=_0x2f6fd3?'closed':_0x6b41('0x3f');var _0x1fe44e=_0x6b41('0x2b')+_0x4287ab[_0x6b41('0x29')];return db[_0x6b41('0x40')][_0x6b41('0x2c')](_0x1fe44e,{'type':db[_0x6b41('0x39')][_0x6b41('0x2d')][_0x6b41('0x2e')],'raw':!![]})[_0x6b41('0x1d')](function(_0x229b01){if(_0x229b01){_0x4287ab[_0x6b41('0x2f')]=_0x229b01[0x0];}if(typeof _0x4287ab[_0x6b41('0x30')]===_0x6b41('0x2a'))return;return getAgent(_0x4287ab['UserId']);})['then'](function(_0x3369a6){if(_0x3369a6){_0x4287ab[_0x6b41('0x31')]=util[_0x6b41('0x32')](_0x6b41('0x3a'),_0x3369a6[_0x6b41('0x3b')]);_0x4287ab[_0x6b41('0x33')]=_0x3369a6;}return request({'event':_0x5284de,'message':_0x4287ab});})[_0x6b41('0x22')](function(_0x422524){logger['error'](_0x6b41('0x21'),_0x6b41('0x41'),_0x422524);});}};}function getAgent(_0x1a49fb){return db['User']['find']({'where':{'id':_0x1a49fb},'attributes':['id','name',_0x6b41('0x42'),_0x6b41('0x43'),_0x6b41('0x44')],'raw':!![]})['then'](function(_0x9ce98){return _0x9ce98;});}exports[_0x6b41('0x45')]=function(){for(var _0x57f722=0x0;_0x57f722=_0x3df637[_0x3b71('0x17')]){throw Error(_0x3b71('0x18'));}_0x3a48e7(_0x22db09);})[_0x3b71('0x19')](function(_0x1428ca){_0x5521be(_0x1428ca);});});}; \ No newline at end of file +var _0xf55e=['mail','fax','sms','openchannel','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','User','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','voice'];(function(_0x4031a3,_0x43e43f){var _0x458a80=function(_0x143a91){while(--_0x143a91){_0x4031a3['push'](_0x4031a3['shift']());}};_0x458a80(++_0x43e43f);}(_0xf55e,0x74));var _0xef55=function(_0x1b9132,_0x5ab496){_0x1b9132=_0x1b9132-0x0;var _0xc1042b=_0xf55e[_0x1b9132];return _0xc1042b;};'use strict';var _=require(_0xef55('0x0'));var BPromise=require('bluebird');var db=require(_0xef55('0x1'))['db'];var util=require(_0xef55('0x2'));var channels=[_0xef55('0x3'),_0xef55('0x4'),'chat',_0xef55('0x5'),_0xef55('0x6'),'whatsapp',_0xef55('0x7')];exports[_0xef55('0x8')]=function(){return channels;};exports[_0xef55('0x9')]=function(_0x2b164a){_0x2b164a=_0x2b164a[_0xef55('0xa')]();return _['includes'](channels,_0x2b164a);};exports[_0xef55('0xb')]=function(_0x4bc21f,_0x58bda0,_0x2b6ff5,_0x2a0d87){var _0xc44a1a={'loginAttempts':_0x58bda0,'blocked':_0x2b6ff5};if(!_[_0xef55('0xc')](_0x2a0d87)){_0xc44a1a[_0xef55('0xd')]=_0x2a0d87;}return _0x4bc21f[_0xef55('0xe')](_0xc44a1a);};exports[_0xef55('0xf')]=function(_0x68dfb5){return new BPromise(function(_0x5c9017,_0x1243fa){var _0x229ce1=0x0;if(_0x68dfb5[_0xef55('0x10')]!=='agent'){_0x5c9017(_0x68dfb5);}db[_0xef55('0x11')][_0xef55('0x12')]({'where':{'role':_0xef55('0x13'),'online':!![],'id':{'$ne':_0x68dfb5['id']}}})[_0xef55('0x14')](function(_0x3b4f16){_0x229ce1=_0x3b4f16;return util[_0xef55('0xf')]();})[_0xef55('0x14')](function(_0x483360){if(_0x483360&&_0x483360[_0xef55('0x15')]&&_0x229ce1>=_0x483360[_0xef55('0x15')]){throw Error(_0xef55('0x16'));}_0x5c9017(_0x68dfb5);})[_0xef55('0x17')](function(_0x3ad963){_0x1243fa(_0x3ad963);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 72525ae..3fe6ece 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb81d=['status','render','json','exports'];(function(_0x5e7ac9,_0x4136d0){var _0x14f311=function(_0x4749d2){while(--_0x4749d2){_0x5e7ac9['push'](_0x5e7ac9['shift']());}};_0x14f311(++_0x4136d0);}(_0xb81d,0x73));var _0xdb81=function(_0x15eda2,_0x42ef53){_0x15eda2=_0x15eda2-0x0;var _0x8921a9=_0xb81d[_0x15eda2];return _0x8921a9;};'use strict';module[_0xdb81('0x0')][0x194]=function pageNotFound(_0x4db427,_0x11a98d){var _0x3f766c='404';var _0x58d7cb=0x194;var _0x242df5={'status':_0x58d7cb};_0x11a98d['status'](_0x242df5[_0xdb81('0x1')]);_0x11a98d[_0xdb81('0x2')](_0x3f766c,{},function(_0x13988d,_0x14fc7d){if(_0x13988d){return _0x11a98d[_0xdb81('0x1')](_0x242df5[_0xdb81('0x1')])[_0xdb81('0x3')](_0x242df5);}_0x11a98d['send'](_0x14fc7d);});}; \ No newline at end of file +var _0xc102=['status','render','json','send','exports','404'];(function(_0x6ce934,_0x1fa284){var _0x569c2c=function(_0x456919){while(--_0x456919){_0x6ce934['push'](_0x6ce934['shift']());}};_0x569c2c(++_0x1fa284);}(_0xc102,0xb8));var _0x2c10=function(_0x172235,_0x5a9701){_0x172235=_0x172235-0x0;var _0x13fac8=_0xc102[_0x172235];return _0x13fac8;};'use strict';module[_0x2c10('0x0')][0x194]=function pageNotFound(_0x28a6e3,_0x3da8f1){var _0x1113a4=_0x2c10('0x1');var _0x120faa=0x194;var _0x269c47={'status':_0x120faa};_0x3da8f1[_0x2c10('0x2')](_0x269c47[_0x2c10('0x2')]);_0x3da8f1[_0x2c10('0x3')](_0x1113a4,{},function(_0x178f61,_0x1de28e){if(_0x178f61){return _0x3da8f1[_0x2c10('0x2')](_0x269c47[_0x2c10('0x2')])[_0x2c10('0x4')](_0x269c47);}_0x3da8f1[_0x2c10('0x5')](_0x1de28e);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 1e768fe..30ddac4 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf1b=['../api/user-setting/user-setting.model','hasOne','cascade','hasMany','VoiceRecording','UserId','UserVoiceQueueRt','VoiceQueuesRt','Extensions','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','SenderId','belongsTo','userProfileId','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','VoicePrefixes','MailQueues','ChatQueue','ChatQueues','SmsQueue','SmsQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccount','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperFinals','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','BlackLists','ScreenRecording','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','ContactId','MailServerIn','MailAccountId','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Messages','Interactions','List','ListId','TemplateId','team_has_mail_queues','Account','Contact','Owner','mail_interaction_has_tags','ThroughTags','Users','MailInteractionId','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','Dashboard','Items','FaxAccountId','Exntensions','FaxQueue','FaxInteraction','FaxInteractionId','Tags','fax_interaction_has_tags','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','ProactiveActions','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','ChatGroupId','chat_group_has_users','Website','CompanyId','Phones','CmContactId','cm_contact_has_tags','CmHopperId','Agent','Queue','Campaign','CampaignId','OwnerId','OneAll','AutomationAllId','Automation','Any','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','CmContactHasItem','ContactItemType','ItemType','Hopper','AllConditions','TriggerAllId','TriggerAnyId','Fields','MetricId','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Field','VariableId','SugarcrmConfiguration','SugarcrmAccount','Description','int_desk_configuration_has_tags','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','ServicenowConfiguration','Dynamics365Configuration','FromId','SessionId','ProjectId','FaxQueues','team_has_openchannel_queues','team_has_whatsapp_queues','TeamVoicePrefix','HopperHistories','HopperBlacks','TrunkBackup','SquareProjectId','campaigns_has_cm_blacklists','FromAccount','FromUserId','ToUserId','ToAgent','ToQueue','ToAccount','FromChatWebsiteId','FromAgent','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','Queues','voice_queues_has_cm_lists','UserProfileSections','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappQueueReport','ToQueueId','WhatsappQueueId','user','exports','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xC@LL1234','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','127.0.0.1','username','options','database','password','User','import','../api/user/user.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','SquareReport','SquareDetailsReport','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting'];(function(_0x51eedc,_0x4409cb){var _0x24a7bb=function(_0x39683c){while(--_0x39683c){_0x51eedc['push'](_0x51eedc['shift']());}};_0x24a7bb(++_0x4409cb);}(_0xcf1b,0xea));var _0xbcf1=function(_0x508bce,_0x17a185){_0x508bce=_0x508bce-0x0;var _0x284aa7=_0xcf1b[_0x508bce];return _0x284aa7;};'use strict';var config=require(_0xbcf1('0x0'));var Sequelize=require(_0xbcf1('0x1'));var _=require('lodash');var jstz=require(_0xbcf1('0x2'));var timezone=jstz[_0xbcf1('0x3')]();config[_0xbcf1('0x1')]=_[_0xbcf1('0x4')](config[_0xbcf1('0x1')],{'database':_0xbcf1('0x5'),'username':'xcall','password':_0xbcf1('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xbcf1('0x7'),'dialectOptions':{'charset':_0xbcf1('0x8')},'logging':![],'timezone':timezone[_0xbcf1('0x9')](),'define':{'charset':_0xbcf1('0xa'),'collate':_0xbcf1('0xb')}}});config[_0xbcf1('0xc')]=_[_0xbcf1('0x4')](config[_0xbcf1('0xc')],{'database':_0xbcf1('0x5'),'username':'xcall','password':_0xbcf1('0x6'),'options':{'host':_0xbcf1('0xd'),'port':0xcea,'dialect':_0xbcf1('0x7'),'dialectOptions':{'charset':_0xbcf1('0x8')},'logging':![],'timezone':timezone[_0xbcf1('0x9')](),'define':{'charset':'utf8','collate':_0xbcf1('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xbcf1('0x1')]['database'],config[_0xbcf1('0x1')][_0xbcf1('0xe')],config['sequelize']['password'],config[_0xbcf1('0x1')][_0xbcf1('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xbcf1('0xc')][_0xbcf1('0x10')],config[_0xbcf1('0xc')]['username'],config[_0xbcf1('0xc')][_0xbcf1('0x11')],config[_0xbcf1('0xc')][_0xbcf1('0xf')])};db[_0xbcf1('0x12')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x14'));db['VoiceChanSpy']=db['sequelize'][_0xbcf1('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xbcf1('0x15')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x16'));db[_0xbcf1('0x17')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x18'));db['VoiceMusicOnHold']=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x19'));db['VoiceQueue']=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x1a'));db['VoiceRecording']=db['sequelize']['import'](_0xbcf1('0x1b'));db['ScreenRecording']=db[_0xbcf1('0x1')]['import'](_0xbcf1('0x1c'));db[_0xbcf1('0x1d')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x1e'));db[_0xbcf1('0x1f')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xbcf1('0x20')]=db[_0xbcf1('0x1')]['import'](_0xbcf1('0x21'));db[_0xbcf1('0x22')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x23'));db[_0xbcf1('0x24')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x25'));db[_0xbcf1('0x26')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xbcf1('0x27')]=db[_0xbcf1('0x1')]['import']('../api/memberReport/memberReport.model');db[_0xbcf1('0x28')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/trunk/trunk.model');db[_0xbcf1('0x29')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x2a'));db['UserVoiceQueueRt']=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x2b'));db[_0xbcf1('0x2c')]=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0x2d'));db[_0xbcf1('0x2e')]=db['sequelize'][_0xbcf1('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0xbcf1('0x2f')]=db[_0xbcf1('0x1')]['import'](_0xbcf1('0x30'));db[_0xbcf1('0x31')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x32'));db[_0xbcf1('0x33')]=db[_0xbcf1('0x1')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0xbcf1('0x34')]=db['sequelize']['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xbcf1('0x35')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x36'));db['MailServerIn']=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/mailServerIn/mailServerIn.model');db[_0xbcf1('0x37')]=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0x38'));db[_0xbcf1('0x39')]=db[_0xbcf1('0x1')]['import'](_0xbcf1('0x3a'));db[_0xbcf1('0x3b')]=db[_0xbcf1('0x1')]['import']('../api/mailQueue/mailQueue.model');db[_0xbcf1('0x3c')]=db[_0xbcf1('0x1')]['import'](_0xbcf1('0x3d'));db[_0xbcf1('0x3e')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x3f'));db[_0xbcf1('0x40')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x41'));db[_0xbcf1('0x42')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x43'));db[_0xbcf1('0x44')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x45'));db['Dashboard']=db['sequelize']['import'](_0xbcf1('0x46'));db[_0xbcf1('0x47')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x48'));db['FaxAccount']=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0x49'));db[_0xbcf1('0x4a')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x4b'));db['FaxInteraction']=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x4c'));db[_0xbcf1('0x4d')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x4e'));db['FaxQueue']=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x4f'));db[_0xbcf1('0x50')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x51'));db[_0xbcf1('0x52')]=db[_0xbcf1('0x1')]['import'](_0xbcf1('0x53'));db[_0xbcf1('0x54')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x55'));db[_0xbcf1('0x56')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x57'));db[_0xbcf1('0x58')]=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0x59'));db['SmsQueue']=db[_0xbcf1('0x1')]['import'](_0xbcf1('0x5a'));db['OpenchannelAccount']=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0x5b'));db[_0xbcf1('0x5c')]=db[_0xbcf1('0x1')]['import'](_0xbcf1('0x5d'));db[_0xbcf1('0x5e')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x5f'));db[_0xbcf1('0x60')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x61'));db[_0xbcf1('0x62')]=db[_0xbcf1('0x1')]['import'](_0xbcf1('0x63'));db[_0xbcf1('0x64')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0xbcf1('0x65')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xbcf1('0x66')]=db[_0xbcf1('0x1')]['import']('../api/chatApplication/chatApplication.model');db[_0xbcf1('0x67')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x68'));db[_0xbcf1('0x69')]=db['sequelize']['import'](_0xbcf1('0x6a'));db['ChatOfflineMessage']=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0x6b'));db['ChatQueue']=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x6c'));db[_0xbcf1('0x6d')]=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0x6e'));db[_0xbcf1('0x6f')]=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0x70'));db[_0xbcf1('0x71')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x72'));db[_0xbcf1('0x73')]=db[_0xbcf1('0x1')]['import'](_0xbcf1('0x74'));db[_0xbcf1('0x75')]=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0x76'));db[_0xbcf1('0x77')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xbcf1('0x78')]=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0x79'));db['CmHopperHistory']=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x7a'));db[_0xbcf1('0x7b')]=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0x7c'));db[_0xbcf1('0x7d')]=db['sequelize'][_0xbcf1('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0xbcf1('0x7e')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/action/action.model');db['Automation']=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0x7f'));db[_0xbcf1('0x80')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/cannedAnswer/cannedAnswer.model');db[_0xbcf1('0x81')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x82'));db[_0xbcf1('0x83')]=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0x84'));db[_0xbcf1('0x85')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x86'));db['Pause']=db[_0xbcf1('0x1')]['import'](_0xbcf1('0x87'));db['Cdr']=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x88'));db[_0xbcf1('0x89')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x8a'));db[_0xbcf1('0x8b')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x8c'));db[_0xbcf1('0x8d')]=db['sequelize'][_0xbcf1('0x13')]('../api/tag/tag.model');db['ContactItemType']=db[_0xbcf1('0x1')]['import'](_0xbcf1('0x8e'));db['CmContactHasItem']=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0x8f'));db[_0xbcf1('0x90')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x91'));db[_0xbcf1('0x92')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/template/template.model');db[_0xbcf1('0x93')]=db[_0xbcf1('0x1')]['import'](_0xbcf1('0x94'));db[_0xbcf1('0x95')]=db['sequelize']['import'](_0xbcf1('0x96'));db[_0xbcf1('0x97')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x98'));db[_0xbcf1('0x99')]=db[_0xbcf1('0x1')]['import']('../api/integrationReport/integrationReport.model');db[_0xbcf1('0x9a')]=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0x9b'));db[_0xbcf1('0x9c')]=db[_0xbcf1('0x1')]['import'](_0xbcf1('0x9d'));db['AnalyticExtractedReport']=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x9e'));db[_0xbcf1('0x9f')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xa0'));db[_0xbcf1('0xa1')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xbcf1('0xa2')]=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0xa3'));db[_0xbcf1('0xa4')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xa5'));db[_0xbcf1('0xa6')]=db[_0xbcf1('0x1')]['import'](_0xbcf1('0xa7'));db[_0xbcf1('0xa8')]=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0xa9'));db['SugarcrmAccount']=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0xbcf1('0x1')]['import'](_0xbcf1('0xaa'));db[_0xbcf1('0xab')]=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0xac'));db[_0xbcf1('0xad')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xae'));db[_0xbcf1('0xaf')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xb0'));db[_0xbcf1('0xb1')]=db['sequelize']['import'](_0xbcf1('0xb2'));db[_0xbcf1('0xb3')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/intZohoAccount/intZohoAccount.model');db[_0xbcf1('0xb4')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xb5'));db[_0xbcf1('0xb6')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xb7'));db[_0xbcf1('0xb8')]=db[_0xbcf1('0x1')]['import'](_0xbcf1('0xb9'));db[_0xbcf1('0xba')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xbb'));db['ZendeskField']=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xbc'));db[_0xbcf1('0xbd')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xbe'));db[_0xbcf1('0xbf')]=db['sequelize']['import'](_0xbcf1('0xc0'));db['FreshdeskField']=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xc1'));db['VtigerAccount']=db[_0xbcf1('0x1')]['import'](_0xbcf1('0xc2'));db[_0xbcf1('0xc3')]=db['sequelize'][_0xbcf1('0x13')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xbcf1('0xc4')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xc5'));db[_0xbcf1('0xc6')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xc7'));db['ServicenowConfiguration']=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0xc8'));db[_0xbcf1('0xc9')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xca'));db[_0xbcf1('0xcb')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xcc'));db[_0xbcf1('0xcd')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xce'));db[_0xbcf1('0xcf')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xd0'));db[_0xbcf1('0xd1')]=db[_0xbcf1('0x1')]['import'](_0xbcf1('0xd2'));db[_0xbcf1('0xd3')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xd4'));db[_0xbcf1('0x97')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x98'));db[_0xbcf1('0xd5')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xd6'));db[_0xbcf1('0xd7')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0xbcf1('0xd8')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xd9'));db[_0xbcf1('0xda')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xdb'));db[_0xbcf1('0xdc')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xdd'));db[_0xbcf1('0xde')]=db[_0xbcf1('0x1')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xbcf1('0xdf')]=db[_0xbcf1('0x1')]['import']('../api/smsQueueReport/smsQueueReport.model');db[_0xbcf1('0xe0')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/squareReport/squareReport.model');db[_0xbcf1('0xe1')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/squareReportDetail/squareReportDetail.model');db[_0xbcf1('0xe2')]=db[_0xbcf1('0x1')]['import']('../api/jscriptyProject/jscriptyProject.model');db[_0xbcf1('0xe3')]=db[_0xbcf1('0x1')]['import'](_0xbcf1('0xe4'));db[_0xbcf1('0xe5')]=db[_0xbcf1('0x1')]['import'](_0xbcf1('0xe6'));db[_0xbcf1('0xe7')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xe8'));db[_0xbcf1('0xe9')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xea'));db[_0xbcf1('0xeb')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/squareMessage/squareMessage.model');db[_0xbcf1('0xec')]=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0xed'));db[_0xbcf1('0xee')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xef'));db['Campaign']=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/campaign/campaign.model');db[_0xbcf1('0xf0')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xf1'));db[_0xbcf1('0xf2')]=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0xf3'));db['Plugin']=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xf4'));db[_0xbcf1('0xf5')]=db['sequelize']['import'](_0xbcf1('0xf6'));db[_0xbcf1('0xf7')]=db[_0xbcf1('0x1')]['import'](_0xbcf1('0xf8'));db['FaxTransferReport']=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xf9'));db[_0xbcf1('0xfa')]=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0xfb'));db[_0xbcf1('0xfc')]=db[_0xbcf1('0x1')]['import'](_0xbcf1('0xfd'));db[_0xbcf1('0xfe')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0xff'));db[_0xbcf1('0x100')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x101'));db[_0xbcf1('0x102')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x103'));db[_0xbcf1('0x104')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x105'));db[_0xbcf1('0x106')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/userProfileResource/userProfileResource.model');db[_0xbcf1('0x107')]=db['sequelize']['import'](_0xbcf1('0x108'));db[_0xbcf1('0x109')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x10a'));db['WhatsappApplication']=db[_0xbcf1('0x1')]['import'](_0xbcf1('0x10b'));db[_0xbcf1('0x10c')]=db['sequelize']['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0xbcf1('0x10d')]=db[_0xbcf1('0x1')]['import'](_0xbcf1('0x10e'));db['WhatsappQueueReport']=db[_0xbcf1('0x1')][_0xbcf1('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xbcf1('0x10f')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x110'));db[_0xbcf1('0x111')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x112'));db['CloudProvider']=db['sequelize'][_0xbcf1('0x13')](_0xbcf1('0x113'));db[_0xbcf1('0x114')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x115'));db['TeamVoicePrefix']=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x116'));db[_0xbcf1('0x117')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x118'));db[_0xbcf1('0x119')]=db[_0xbcf1('0x1')][_0xbcf1('0x13')](_0xbcf1('0x11a'));db[_0xbcf1('0x12')][_0xbcf1('0x11b')](db[_0xbcf1('0x1d')],{'as':'VoiceMail','onDelete':_0xbcf1('0x11c'),'foreignKey':'UserId'});db[_0xbcf1('0x12')][_0xbcf1('0x11b')](db[_0xbcf1('0x119')],{'as':'userSetting','onDelete':_0xbcf1('0x11c'),'foreignKey':'UserId'});db[_0xbcf1('0x12')][_0xbcf1('0x11d')](db[_0xbcf1('0x11e')],{'as':'Recordings','foreignKey':_0xbcf1('0x11f')});db['User'][_0xbcf1('0x11d')](db[_0xbcf1('0x120')],{'as':_0xbcf1('0x121'),'foreignKey':_0xbcf1('0x11f')});db['User']['hasMany'](db['VoiceExtension'],{'as':_0xbcf1('0x122'),'onDelete':_0xbcf1('0x11c'),'hooks':!![]});db['User']['hasMany'](db[_0xbcf1('0x78')],{'as':'HopperFinals','foreignKey':_0xbcf1('0x11f')});db['User'][_0xbcf1('0x11d')](db[_0xbcf1('0x123')],{'as':_0xbcf1('0x124'),'foreignKey':_0xbcf1('0x11f')});db[_0xbcf1('0x12')][_0xbcf1('0x11d')](db[_0xbcf1('0x7b')],{'as':_0xbcf1('0x7b'),'foreignKey':_0xbcf1('0x11f')});db[_0xbcf1('0x12')][_0xbcf1('0x11d')](db[_0xbcf1('0x5e')],{'as':_0xbcf1('0x125'),'foreignKey':'UserId'});db[_0xbcf1('0x12')][_0xbcf1('0x11d')](db[_0xbcf1('0x67')],{'as':_0xbcf1('0x126'),'foreignKey':_0xbcf1('0x11f')});db[_0xbcf1('0x12')][_0xbcf1('0x11d')](db[_0xbcf1('0x56')],{'as':_0xbcf1('0x127'),'foreignKey':_0xbcf1('0x11f')});db['User'][_0xbcf1('0x11d')](db['FaxInteraction'],{'as':_0xbcf1('0x128'),'foreignKey':_0xbcf1('0x11f')});db[_0xbcf1('0x12')][_0xbcf1('0x11d')](db['MailInteraction'],{'as':_0xbcf1('0x129'),'foreignKey':_0xbcf1('0x11f')});db[_0xbcf1('0x12')][_0xbcf1('0x11d')](db[_0xbcf1('0x10c')],{'as':'WhatsappInteractions','foreignKey':_0xbcf1('0x11f')});db[_0xbcf1('0x12')][_0xbcf1('0x11d')](db[_0xbcf1('0x107')],{'as':'UserNotifications','foreignKey':_0xbcf1('0x12a')});db[_0xbcf1('0x12')][_0xbcf1('0x12b')](db['UserProfile'],{'as':_0xbcf1('0x102'),'foreignKey':_0xbcf1('0x12c')});db[_0xbcf1('0x12')][_0xbcf1('0x12d')](db['ChatGroup'],{'as':'Groups','through':'chat_group_has_users'});db[_0xbcf1('0x12')][_0xbcf1('0x12d')](db[_0xbcf1('0x73')],{'as':_0xbcf1('0x12e'),'through':_0xbcf1('0x12f')});db[_0xbcf1('0x12')][_0xbcf1('0x12d')](db[_0xbcf1('0xfe')],{'as':_0xbcf1('0x130'),'through':_0xbcf1('0x131')});db[_0xbcf1('0x12')]['belongsToMany'](db[_0xbcf1('0xec')],{'through':_0xbcf1('0x132')});db[_0xbcf1('0x12')][_0xbcf1('0x12d')](db[_0xbcf1('0x3e')],{'as':_0xbcf1('0x129'),'through':_0xbcf1('0x133')});db[_0xbcf1('0x12')][_0xbcf1('0x12d')](db[_0xbcf1('0x67')],{'as':'ChatInteractions','through':_0xbcf1('0x134')});db['User'][_0xbcf1('0x12d')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0xbcf1('0x135')});db['User'][_0xbcf1('0x12d')](db[_0xbcf1('0x56')],{'as':_0xbcf1('0x127'),'through':_0xbcf1('0x136')});db['User']['belongsToMany'](db[_0xbcf1('0x5e')],{'as':_0xbcf1('0x125'),'through':_0xbcf1('0x137')});db['User']['belongsToMany'](db['WhatsappInteraction'],{'as':_0xbcf1('0x138'),'through':_0xbcf1('0x139')});db[_0xbcf1('0x12')][_0xbcf1('0x12d')](db[_0xbcf1('0x13a')],{'as':_0xbcf1('0x13b'),'through':_0xbcf1('0x2c'),'required':![]});db[_0xbcf1('0x12')][_0xbcf1('0x12d')](db[_0xbcf1('0x100')],{'as':_0xbcf1('0x13c'),'through':'UserVoicePrefix','required':![]});db[_0xbcf1('0x12')]['belongsToMany'](db[_0xbcf1('0x3b')],{'as':_0xbcf1('0x13d'),'through':_0xbcf1('0x2f'),'required':![]});db[_0xbcf1('0x12')]['belongsToMany'](db[_0xbcf1('0x13e')],{'as':_0xbcf1('0x13f'),'through':_0xbcf1('0x2e'),'required':![],'hooks':!![]});db[_0xbcf1('0x12')][_0xbcf1('0x12d')](db['FaxQueue'],{'as':'FaxQueues','through':_0xbcf1('0x31'),'required':![]});db[_0xbcf1('0x12')][_0xbcf1('0x12d')](db[_0xbcf1('0x140')],{'as':_0xbcf1('0x141'),'through':_0xbcf1('0x33'),'required':![]});db['User'][_0xbcf1('0x12d')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0xbcf1('0x12')]['belongsToMany'](db[_0xbcf1('0x111')],{'as':_0xbcf1('0x142'),'through':_0xbcf1('0x35'),'required':![]});db['User'][_0xbcf1('0x12d')](db[_0xbcf1('0xfe')],{'through':_0xbcf1('0x131')});db[_0xbcf1('0x12')][_0xbcf1('0x12d')](db[_0xbcf1('0x64')],{'as':_0xbcf1('0x143'),'through':_0xbcf1('0x144')});db[_0xbcf1('0x12')][_0xbcf1('0x12d')](db[_0xbcf1('0x145')],{'as':'FaxAccounts','through':_0xbcf1('0x146')});db[_0xbcf1('0x12')]['belongsToMany'](db[_0xbcf1('0x39')],{'as':_0xbcf1('0x147'),'through':_0xbcf1('0x148')});db['User']['belongsToMany'](db[_0xbcf1('0x149')],{'as':'OpenchannelAccounts','through':_0xbcf1('0x14a')});db[_0xbcf1('0x12')]['belongsToMany'](db[_0xbcf1('0x52')],{'as':_0xbcf1('0x14b'),'through':'user_has_sms_accounts'});db[_0xbcf1('0x12')][_0xbcf1('0x12d')](db[_0xbcf1('0x109')],{'as':_0xbcf1('0x14c'),'through':_0xbcf1('0x14d')});db['User'][_0xbcf1('0x12d')](db[_0xbcf1('0xe7')],{'as':_0xbcf1('0x14e'),'through':_0xbcf1('0x14f')});db[_0xbcf1('0x150')]['hasMany'](db[_0xbcf1('0x17')],{'as':_0xbcf1('0x151'),'onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x152')});db[_0xbcf1('0x15')]['hasMany'](db[_0xbcf1('0x17')],{'onDelete':_0xbcf1('0x11c')});db[_0xbcf1('0x17')][_0xbcf1('0x11d')](db['VoiceExtension'],{'as':_0xbcf1('0x153'),'onDelete':'cascade'});db[_0xbcf1('0x154')][_0xbcf1('0x12d')](db['Sound'],{'as':_0xbcf1('0x155'),'through':_0xbcf1('0x156')});db[_0xbcf1('0x13a')][_0xbcf1('0x11d')](db[_0xbcf1('0x120')],{'as':_0xbcf1('0x157'),'foreignKey':'VoiceQueueId'});db[_0xbcf1('0x13a')][_0xbcf1('0x11d')](db['CmHopper'],{'as':_0xbcf1('0x158'),'foreignKey':_0xbcf1('0x159')});db[_0xbcf1('0x13a')]['hasMany'](db[_0xbcf1('0x78')],{'as':_0xbcf1('0x15a'),'foreignKey':_0xbcf1('0x159')});db[_0xbcf1('0x13a')][_0xbcf1('0x11d')](db[_0xbcf1('0x123')],{'as':'HopperHistories','foreignKey':_0xbcf1('0x159')});db[_0xbcf1('0x13a')][_0xbcf1('0x11d')](db['ReportAgentPreview'],{'as':_0xbcf1('0x7b'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0xbcf1('0x77')],{'as':'HopperBlacks','foreignKey':_0xbcf1('0x159')});db['VoiceQueue'][_0xbcf1('0x11d')](db[_0xbcf1('0xde')],{'as':_0xbcf1('0x15b'),'foreignKey':_0xbcf1('0x159')});db[_0xbcf1('0x13a')][_0xbcf1('0x12b')](db[_0xbcf1('0x28')],{'as':'Trunk','foreignKey':_0xbcf1('0x15c')});db[_0xbcf1('0x13a')]['belongsTo'](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0xbcf1('0x15d')});db[_0xbcf1('0x13a')]['belongsTo'](db[_0xbcf1('0x85')],{'as':_0xbcf1('0x85'),'foreignKey':_0xbcf1('0x15e')});db[_0xbcf1('0x13a')]['belongsTo'](db[_0xbcf1('0x15f')],{'as':_0xbcf1('0x160'),'foreignKey':_0xbcf1('0x161')});db[_0xbcf1('0x13a')][_0xbcf1('0x12d')](db['CmList'],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0xbcf1('0x13a')]['belongsToMany'](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x162'),'through':_0xbcf1('0x2c')});db[_0xbcf1('0x13a')][_0xbcf1('0x12d')](db[_0xbcf1('0xec')],{'as':_0xbcf1('0x163'),'through':_0xbcf1('0x114')});db['VoiceQueue'][_0xbcf1('0x12d')](db[_0xbcf1('0xfe')],{'as':_0xbcf1('0x164'),'through':'voice_queues_has_cm_blacklists'});db[_0xbcf1('0x11e')]['belongsTo'](db['User'],{'as':'User','foreignKey':'UserId'});db[_0xbcf1('0x165')][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x12'),'foreignKey':'UserId'});db[_0xbcf1('0x1d')][_0xbcf1('0x11d')](db[_0xbcf1('0x1f')],{'as':'Messages','onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x166'),'sourceKey':_0xbcf1('0x167')});db['VoiceMailMessage'][_0xbcf1('0x12b')](db[_0xbcf1('0x1d')],{'foreignKey':_0xbcf1('0x166'),'targetKey':_0xbcf1('0x167')});db[_0xbcf1('0x20')]['hasMany'](db[_0xbcf1('0x26')],{'as':_0xbcf1('0x168'),'foreignKey':_0xbcf1('0x169'),'constraints':![]});db[_0xbcf1('0x20')][_0xbcf1('0x11d')](db[_0xbcf1('0x24')],{'as':_0xbcf1('0x16a'),'foreignKey':_0xbcf1('0x169'),'constraints':![]});db[_0xbcf1('0x20')][_0xbcf1('0x12b')](db['User'],{'as':_0xbcf1('0x12'),'foreignKey':_0xbcf1('0x11f')});db['VoiceCallReport'][_0xbcf1('0x12b')](db['CmContact'],{'as':'Contact','foreignKey':_0xbcf1('0x16b')});db[_0xbcf1('0x16c')][_0xbcf1('0x12b')](db[_0xbcf1('0x39')],{'as':'MailAccount','foreignKey':_0xbcf1('0x16d')});db[_0xbcf1('0x16c')][_0xbcf1('0x12b')](db['CloudProvider'],{'as':_0xbcf1('0x16e'),'foreignKey':_0xbcf1('0x16f'),'onDelete':_0xbcf1('0x170')});db[_0xbcf1('0x37')][_0xbcf1('0x12b')](db['MailAccount'],{'as':_0xbcf1('0x39'),'foreignKey':_0xbcf1('0x16d')});db[_0xbcf1('0x37')][_0xbcf1('0x12b')](db[_0xbcf1('0x16e')],{'as':_0xbcf1('0x16e'),'foreignKey':_0xbcf1('0x16f'),'onDelete':_0xbcf1('0x170')});db['MailAccount'][_0xbcf1('0x11b')](db[_0xbcf1('0x16c')],{'as':_0xbcf1('0x171'),'onDelete':_0xbcf1('0x11c')});db['MailAccount'][_0xbcf1('0x11b')](db[_0xbcf1('0x37')],{'as':_0xbcf1('0x172'),'onDelete':_0xbcf1('0x11c')});db['MailAccount']['hasMany'](db['Disposition'],{'as':_0xbcf1('0x173'),'foreignKey':_0xbcf1('0x16d'),'onDelete':_0xbcf1('0x11c')});db[_0xbcf1('0x39')][_0xbcf1('0x11d')](db[_0xbcf1('0x80')],{'as':_0xbcf1('0x174'),'foreignKey':'MailAccountId'});db[_0xbcf1('0x39')][_0xbcf1('0x11d')](db['MailMessage'],{'as':_0xbcf1('0x175'),'foreignKey':_0xbcf1('0x16d')});db[_0xbcf1('0x39')]['hasMany'](db['MailInteraction'],{'as':_0xbcf1('0x176')});db[_0xbcf1('0x39')][_0xbcf1('0x11d')](db['MailApplication'],{'as':_0xbcf1('0x153')});db[_0xbcf1('0x39')]['belongsTo'](db[_0xbcf1('0xfe')],{'as':_0xbcf1('0x177'),'foreignKey':_0xbcf1('0x178')});db[_0xbcf1('0x39')][_0xbcf1('0x12b')](db[_0xbcf1('0x92')],{'as':_0xbcf1('0x92'),'foreignKey':_0xbcf1('0x179')});db[_0xbcf1('0x39')][_0xbcf1('0x12b')](db[_0xbcf1('0x15f')],{'as':_0xbcf1('0x160'),'foreignKey':_0xbcf1('0x161')});db[_0xbcf1('0x39')][_0xbcf1('0x12d')](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x162'),'through':_0xbcf1('0x148')});db[_0xbcf1('0x3b')][_0xbcf1('0x12d')](db['User'],{'as':_0xbcf1('0x162'),'through':'UserMailQueue'});db[_0xbcf1('0x3b')][_0xbcf1('0x12d')](db[_0xbcf1('0xec')],{'through':_0xbcf1('0x17a'),'as':_0xbcf1('0x163')});db[_0xbcf1('0x3e')]['hasMany'](db['MailMessage'],{'as':_0xbcf1('0x175'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0xbcf1('0x3e')][_0xbcf1('0x12b')](db[_0xbcf1('0x39')],{'as':_0xbcf1('0x17b'),'foreignKey':_0xbcf1('0x16d')});db[_0xbcf1('0x3e')][_0xbcf1('0x12b')](db[_0xbcf1('0x73')],{'as':_0xbcf1('0x17c'),'foreignKey':'ContactId'});db[_0xbcf1('0x3e')][_0xbcf1('0x12b')](db['User'],{'as':_0xbcf1('0x17d'),'foreignKey':_0xbcf1('0x11f')});db[_0xbcf1('0x3e')][_0xbcf1('0x12d')](db[_0xbcf1('0x8d')],{'through':_0xbcf1('0x17e'),'as':'Tags'});db[_0xbcf1('0x3e')][_0xbcf1('0x12d')](db['Tag'],{'through':_0xbcf1('0x17e'),'as':_0xbcf1('0x17f')});db[_0xbcf1('0x3e')][_0xbcf1('0x12d')](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x180'),'through':_0xbcf1('0x133'),'foreignKey':_0xbcf1('0x181')});db[_0xbcf1('0x40')][_0xbcf1('0x11d')](db[_0xbcf1('0xf2')],{'as':'Attachments','onDelete':_0xbcf1('0x11c')});db[_0xbcf1('0x40')][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x12')});db[_0xbcf1('0x40')][_0xbcf1('0x12b')](db[_0xbcf1('0x73')],{'onDelete':'cascade','as':'Contact'});db['MailMessage'][_0xbcf1('0x12b')](db[_0xbcf1('0x3e')],{'as':_0xbcf1('0x182'),'foreignKey':_0xbcf1('0x181')});db[_0xbcf1('0x40')][_0xbcf1('0x12b')](db['MailAccount'],{'as':_0xbcf1('0x17b'),'foreignKey':_0xbcf1('0x16d')});db['MailMessage']['belongsTo'](db[_0xbcf1('0x64')],{'as':_0xbcf1('0x64'),'foreignKey':_0xbcf1('0x183')});db[_0xbcf1('0x40')][_0xbcf1('0x12b')](db['ChatOfflineMessage'],{'as':_0xbcf1('0x184'),'foreignKey':_0xbcf1('0x185')});db[_0xbcf1('0x42')][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'onDelete':_0xbcf1('0x170')});db[_0xbcf1('0x42')][_0xbcf1('0x12b')](db[_0xbcf1('0x3b')],{'onDelete':_0xbcf1('0x170')});db[_0xbcf1('0x42')]['belongsTo'](db[_0xbcf1('0x39')],{'onDelete':_0xbcf1('0x170')});db[_0xbcf1('0x42')][_0xbcf1('0x12b')](db[_0xbcf1('0x85')],{'onDelete':_0xbcf1('0x170'),'foreignKey':_0xbcf1('0x15e')});db[_0xbcf1('0x42')]['belongsTo'](db[_0xbcf1('0x8d')],{'onDelete':_0xbcf1('0x170'),'foreignKey':_0xbcf1('0x186')});db[_0xbcf1('0x44')][_0xbcf1('0x12b')](db[_0xbcf1('0x39')],{});db['MailQueueReport'][_0xbcf1('0x12b')](db[_0xbcf1('0xfe')],{'as':_0xbcf1('0x177'),'foreignKey':'ListId'});db['MailQueueReport'][_0xbcf1('0x12b')](db[_0xbcf1('0x73')],{'as':_0xbcf1('0x17c'),'foreignKey':_0xbcf1('0x16b')});db[_0xbcf1('0x44')][_0xbcf1('0x12b')](db['MailInteraction'],{});db[_0xbcf1('0x44')]['belongsTo'](db[_0xbcf1('0x40')],{});db['MailQueueReport'][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{});db[_0xbcf1('0x44')][_0xbcf1('0x12b')](db['MailQueue'],{});db[_0xbcf1('0x187')]['hasMany'](db['DashboardItem'],{'as':_0xbcf1('0x188'),'onDelete':_0xbcf1('0x11c')});db[_0xbcf1('0x145')]['hasMany'](db[_0xbcf1('0x81')],{'as':_0xbcf1('0x173'),'foreignKey':_0xbcf1('0x189'),'onDelete':'cascade'});db['FaxAccount']['hasMany'](db[_0xbcf1('0x80')],{'as':'Answers','foreignKey':_0xbcf1('0x189')});db['FaxAccount']['hasMany'](db['FaxInteraction'],{'as':'Interactions'});db[_0xbcf1('0x145')][_0xbcf1('0x11d')](db['FaxApplication'],{'as':'Applications'});db[_0xbcf1('0x145')][_0xbcf1('0x11d')](db[_0xbcf1('0x17')],{'as':_0xbcf1('0x18a'),'onDelete':_0xbcf1('0x11c')});db[_0xbcf1('0x145')][_0xbcf1('0x11d')](db[_0xbcf1('0x4d')],{'as':'Messages'});db['FaxAccount'][_0xbcf1('0x12b')](db['Trunk'],{'as':_0xbcf1('0x28')});db[_0xbcf1('0x145')][_0xbcf1('0x12b')](db['CmList'],{'as':_0xbcf1('0x177'),'foreignKey':_0xbcf1('0x178')});db['FaxAccount'][_0xbcf1('0x12b')](db[_0xbcf1('0x15f')],{'as':_0xbcf1('0x160'),'foreignKey':_0xbcf1('0x161')});db['FaxAccount'][_0xbcf1('0x12d')](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x162'),'through':_0xbcf1('0x146')});db[_0xbcf1('0x4a')]['belongsTo'](db[_0xbcf1('0x12')],{'onDelete':_0xbcf1('0x170')});db['FaxApplication']['belongsTo'](db[_0xbcf1('0x18b')],{'onDelete':_0xbcf1('0x170')});db['FaxApplication'][_0xbcf1('0x12b')](db['FaxAccount'],{'onDelete':_0xbcf1('0x170')});db['FaxApplication'][_0xbcf1('0x12b')](db[_0xbcf1('0x8d')],{'onDelete':_0xbcf1('0x170'),'foreignKey':'TagId'});db[_0xbcf1('0x18c')][_0xbcf1('0x11d')](db[_0xbcf1('0x4d')],{'as':_0xbcf1('0x175'),'onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x18d')});db[_0xbcf1('0x18c')][_0xbcf1('0x12b')](db['FaxAccount'],{'as':_0xbcf1('0x17b'),'foreignKey':_0xbcf1('0x189')});db['FaxInteraction'][_0xbcf1('0x12b')](db[_0xbcf1('0x73')],{'as':_0xbcf1('0x17c'),'foreignKey':'ContactId'});db['FaxInteraction'][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x17d'),'foreignKey':_0xbcf1('0x11f')});db['FaxInteraction'][_0xbcf1('0x12d')](db[_0xbcf1('0x8d')],{'through':'fax_interaction_has_tags','as':_0xbcf1('0x18e')});db[_0xbcf1('0x18c')][_0xbcf1('0x12d')](db['Tag'],{'through':_0xbcf1('0x18f'),'as':_0xbcf1('0x17f')});db['FaxInteraction'][_0xbcf1('0x12d')](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x180'),'through':_0xbcf1('0x135'),'foreignKey':_0xbcf1('0x18d')});db['FaxMessage'][_0xbcf1('0x12b')](db['User'],{'onDelete':_0xbcf1('0x11c'),'as':_0xbcf1('0x12')});db[_0xbcf1('0x4d')][_0xbcf1('0x12b')](db[_0xbcf1('0x18c')],{'as':_0xbcf1('0x182'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0xbcf1('0x12b')](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db[_0xbcf1('0x4d')][_0xbcf1('0x12b')](db[_0xbcf1('0xf2')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xbcf1('0x4d')]['belongsTo'](db[_0xbcf1('0x145')],{'as':'Account','foreignKey':_0xbcf1('0x189')});db[_0xbcf1('0x18b')][_0xbcf1('0x12d')](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x162'),'through':_0xbcf1('0x31')});db['FaxQueue'][_0xbcf1('0x12d')](db[_0xbcf1('0xec')],{'through':_0xbcf1('0x190'),'as':'Teams'});db['FaxQueueReport'][_0xbcf1('0x12b')](db[_0xbcf1('0x145')],{});db[_0xbcf1('0x50')][_0xbcf1('0x12b')](db[_0xbcf1('0xfe')],{'as':_0xbcf1('0x177'),'foreignKey':_0xbcf1('0x178')});db[_0xbcf1('0x50')][_0xbcf1('0x12b')](db[_0xbcf1('0x73')],{'as':_0xbcf1('0x17c'),'foreignKey':_0xbcf1('0x16b')});db[_0xbcf1('0x50')][_0xbcf1('0x12b')](db[_0xbcf1('0x18c')],{});db['FaxQueueReport'][_0xbcf1('0x12b')](db[_0xbcf1('0x4d')],{});db['FaxQueueReport'][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{});db[_0xbcf1('0x50')][_0xbcf1('0x12b')](db['FaxQueue'],{});db['SmsAccount'][_0xbcf1('0x11d')](db[_0xbcf1('0x81')],{'as':'Dispositions','foreignKey':_0xbcf1('0x191'),'onDelete':_0xbcf1('0x11c')});db['SmsAccount'][_0xbcf1('0x11d')](db[_0xbcf1('0x80')],{'as':'Answers','foreignKey':_0xbcf1('0x191')});db['SmsAccount']['hasMany'](db[_0xbcf1('0x58')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0xbcf1('0x52')][_0xbcf1('0x11d')](db[_0xbcf1('0x56')],{'as':_0xbcf1('0x176')});db['SmsAccount'][_0xbcf1('0x11d')](db[_0xbcf1('0x54')],{'as':'Applications'});db[_0xbcf1('0x52')]['belongsTo'](db['CmList'],{'as':_0xbcf1('0x177'),'foreignKey':_0xbcf1('0x178')});db[_0xbcf1('0x52')][_0xbcf1('0x12b')](db[_0xbcf1('0x15f')],{'as':_0xbcf1('0x160'),'foreignKey':_0xbcf1('0x161')});db[_0xbcf1('0x52')][_0xbcf1('0x12d')](db[_0xbcf1('0x12')],{'as':'Agents','through':_0xbcf1('0x192')});db[_0xbcf1('0x54')]['belongsTo'](db[_0xbcf1('0x12')],{'onDelete':_0xbcf1('0x170')});db['SmsApplication'][_0xbcf1('0x12b')](db[_0xbcf1('0x140')],{'onDelete':'restrict'});db[_0xbcf1('0x54')][_0xbcf1('0x12b')](db[_0xbcf1('0x52')],{'onDelete':_0xbcf1('0x170')});db['SmsApplication'][_0xbcf1('0x12b')](db[_0xbcf1('0x85')],{'onDelete':_0xbcf1('0x170'),'foreignKey':_0xbcf1('0x15e')});db[_0xbcf1('0x54')][_0xbcf1('0x12b')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db['SmsInteraction'][_0xbcf1('0x11d')](db[_0xbcf1('0x58')],{'as':_0xbcf1('0x175'),'onDelete':'cascade','foreignKey':_0xbcf1('0x193')});db[_0xbcf1('0x56')]['belongsTo'](db[_0xbcf1('0x52')],{'as':_0xbcf1('0x17b'),'foreignKey':_0xbcf1('0x191')});db[_0xbcf1('0x56')][_0xbcf1('0x12b')](db[_0xbcf1('0x73')],{'as':_0xbcf1('0x17c'),'foreignKey':_0xbcf1('0x16b')});db[_0xbcf1('0x56')][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0xbcf1('0x56')][_0xbcf1('0x12d')](db[_0xbcf1('0x8d')],{'through':'sms_interaction_has_tags','as':_0xbcf1('0x18e')});db['SmsInteraction']['belongsToMany'](db['Tag'],{'through':_0xbcf1('0x194'),'as':_0xbcf1('0x17f')});db[_0xbcf1('0x56')][_0xbcf1('0x12d')](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x180'),'through':_0xbcf1('0x136'),'foreignKey':_0xbcf1('0x193')});db[_0xbcf1('0x58')][_0xbcf1('0x12b')](db['User'],{'as':_0xbcf1('0x12')});db[_0xbcf1('0x58')]['belongsTo'](db[_0xbcf1('0x73')],{'onDelete':_0xbcf1('0x11c'),'as':_0xbcf1('0x17c')});db[_0xbcf1('0x58')][_0xbcf1('0x12b')](db[_0xbcf1('0x56')],{'onDelete':_0xbcf1('0x11c'),'as':_0xbcf1('0x182'),'foreignKey':_0xbcf1('0x193')});db[_0xbcf1('0x58')][_0xbcf1('0x12b')](db[_0xbcf1('0x52')],{'as':_0xbcf1('0x17b'),'foreignKey':_0xbcf1('0x191')});db[_0xbcf1('0x140')][_0xbcf1('0x12d')](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x162'),'through':'UserSmsQueue','foreignKey':_0xbcf1('0x195')});db[_0xbcf1('0x140')][_0xbcf1('0x12d')](db[_0xbcf1('0xec')],{'through':_0xbcf1('0x196'),'as':'Teams'});db['OpenchannelAccount'][_0xbcf1('0x11d')](db[_0xbcf1('0x81')],{'as':'Dispositions','foreignKey':_0xbcf1('0x197'),'onDelete':_0xbcf1('0x11c')});db[_0xbcf1('0x149')][_0xbcf1('0x11d')](db[_0xbcf1('0x80')],{'as':_0xbcf1('0x174'),'foreignKey':_0xbcf1('0x197')});db['OpenchannelAccount'][_0xbcf1('0x11d')](db[_0xbcf1('0x5e')],{'as':_0xbcf1('0x176'),'foreignKey':_0xbcf1('0x197')});db[_0xbcf1('0x149')][_0xbcf1('0x11d')](db[_0xbcf1('0x60')],{'as':'Messages','foreignKey':_0xbcf1('0x197')});db['OpenchannelAccount'][_0xbcf1('0x11d')](db['OpenchannelApplication'],{'as':_0xbcf1('0x153'),'foreignKey':_0xbcf1('0x197')});db[_0xbcf1('0x149')][_0xbcf1('0x12b')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xbcf1('0x149')][_0xbcf1('0x12b')](db[_0xbcf1('0x15f')],{'as':_0xbcf1('0x160'),'foreignKey':_0xbcf1('0x161')});db[_0xbcf1('0x149')][_0xbcf1('0x12d')](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x162'),'through':_0xbcf1('0x14a')});db['OpenchannelApplication']['belongsTo'](db['User'],{'onDelete':_0xbcf1('0x170')});db[_0xbcf1('0x5c')][_0xbcf1('0x12b')](db[_0xbcf1('0x62')],{'onDelete':_0xbcf1('0x170'),'foreignKey':_0xbcf1('0x198')});db['OpenchannelApplication']['belongsTo'](db[_0xbcf1('0x149')],{'onDelete':_0xbcf1('0x170'),'foreignKey':_0xbcf1('0x197')});db['OpenchannelApplication']['belongsTo'](db['Interval'],{'onDelete':_0xbcf1('0x170'),'foreignKey':'IntervalId'});db['OpenchannelApplication']['belongsTo'](db[_0xbcf1('0x8d')],{'onDelete':_0xbcf1('0x170'),'foreignKey':_0xbcf1('0x186')});db[_0xbcf1('0x5e')]['hasMany'](db[_0xbcf1('0x60')],{'as':_0xbcf1('0x175'),'onDelete':'cascade','foreignKey':_0xbcf1('0x199')});db[_0xbcf1('0x5e')][_0xbcf1('0x12b')](db[_0xbcf1('0x149')],{'as':'Account','foreignKey':_0xbcf1('0x197')});db[_0xbcf1('0x5e')]['belongsTo'](db['CmContact'],{'as':_0xbcf1('0x17c'),'foreignKey':_0xbcf1('0x16b')});db[_0xbcf1('0x5e')][_0xbcf1('0x12b')](db['User'],{'as':'Owner','foreignKey':_0xbcf1('0x11f')});db[_0xbcf1('0x5e')][_0xbcf1('0x12d')](db['Tag'],{'through':_0xbcf1('0x19a'),'as':'Tags'});db[_0xbcf1('0x5e')]['belongsToMany'](db[_0xbcf1('0x8d')],{'through':_0xbcf1('0x19a'),'as':_0xbcf1('0x17f')});db[_0xbcf1('0x5e')][_0xbcf1('0x12d')](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x180'),'through':_0xbcf1('0x137'),'foreignKey':_0xbcf1('0x199')});db[_0xbcf1('0x60')][_0xbcf1('0x12b')](db['User'],{'onDelete':_0xbcf1('0x11c'),'as':'User'});db[_0xbcf1('0x60')]['belongsTo'](db[_0xbcf1('0x73')],{'onDelete':_0xbcf1('0x11c'),'as':_0xbcf1('0x17c')});db[_0xbcf1('0x60')]['belongsTo'](db[_0xbcf1('0x5e')],{'onDelete':_0xbcf1('0x11c'),'as':_0xbcf1('0x182'),'foreignKey':_0xbcf1('0x199')});db[_0xbcf1('0x60')]['belongsTo'](db[_0xbcf1('0xf2')],{'as':_0xbcf1('0xf2'),'foreignKey':_0xbcf1('0x19b')});db['OpenchannelMessage'][_0xbcf1('0x12b')](db[_0xbcf1('0x149')],{'as':_0xbcf1('0x17b'),'foreignKey':_0xbcf1('0x197')});db[_0xbcf1('0x62')][_0xbcf1('0x12d')](db['User'],{'as':'Agents','through':_0xbcf1('0x34'),'foreignKey':_0xbcf1('0x198')});db['OpenchannelQueue']['belongsToMany'](db[_0xbcf1('0xec')],{'through':'team_has_openchannel_queues','as':_0xbcf1('0x163')});db[_0xbcf1('0x64')][_0xbcf1('0x11d')](db['Disposition'],{'as':_0xbcf1('0x173'),'foreignKey':'ChatWebsiteId','onDelete':_0xbcf1('0x11c')});db[_0xbcf1('0x64')][_0xbcf1('0x11d')](db[_0xbcf1('0x80')],{'as':'Answers','foreignKey':'ChatWebsiteId'});db[_0xbcf1('0x64')][_0xbcf1('0x11d')](db[_0xbcf1('0x6f')],{'as':_0xbcf1('0x19c')});db[_0xbcf1('0x64')][_0xbcf1('0x11d')](db[_0xbcf1('0x67')],{'as':_0xbcf1('0x176')});db['ChatWebsite'][_0xbcf1('0x11d')](db[_0xbcf1('0x66')],{'as':_0xbcf1('0x153')});db[_0xbcf1('0x64')][_0xbcf1('0x11d')](db[_0xbcf1('0x69')],{'as':_0xbcf1('0x175')});db['ChatWebsite'][_0xbcf1('0x12b')](db[_0xbcf1('0xfe')],{'as':'List','foreignKey':_0xbcf1('0x178')});db['ChatWebsite']['belongsTo'](db['Interval'],{'as':_0xbcf1('0x85'),'foreignKey':'IntervalId'});db[_0xbcf1('0x64')][_0xbcf1('0x12b')](db[_0xbcf1('0x39')],{'as':_0xbcf1('0x39'),'foreignKey':'MailAccountId'});db[_0xbcf1('0x64')]['belongsTo'](db[_0xbcf1('0x15f')],{'as':_0xbcf1('0x160'),'foreignKey':_0xbcf1('0x161')});db[_0xbcf1('0x64')][_0xbcf1('0x12d')](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x162'),'through':_0xbcf1('0x144')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0xbcf1('0x65')][_0xbcf1('0x12b')](db['CmList'],{'as':_0xbcf1('0x177'),'foreignKey':_0xbcf1('0x178')});db[_0xbcf1('0x65')][_0xbcf1('0x12b')](db[_0xbcf1('0x73')],{'as':_0xbcf1('0x17c'),'foreignKey':_0xbcf1('0x16b')});db[_0xbcf1('0x65')][_0xbcf1('0x12b')](db[_0xbcf1('0x5e')],{});db[_0xbcf1('0x65')][_0xbcf1('0x12b')](db[_0xbcf1('0x60')],{});db['OpenchannelQueueReport'][_0xbcf1('0x12b')](db['User'],{});db['OpenchannelQueueReport'][_0xbcf1('0x12b')](db[_0xbcf1('0x62')],{});db[_0xbcf1('0x66')][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'as':'Agent','foreignKey':_0xbcf1('0x11f'),'onDelete':_0xbcf1('0x170')});db[_0xbcf1('0x66')]['belongsTo'](db[_0xbcf1('0x13e')],{'as':'Queue','foreignKey':_0xbcf1('0x19d'),'onDelete':_0xbcf1('0x170')});db['ChatApplication'][_0xbcf1('0x12b')](db[_0xbcf1('0x64')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0xbcf1('0x170')});db[_0xbcf1('0x66')][_0xbcf1('0x12b')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xbcf1('0x186')});db[_0xbcf1('0x67')][_0xbcf1('0x11d')](db[_0xbcf1('0x69')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xbcf1('0x19e')});db[_0xbcf1('0x67')][_0xbcf1('0x12b')](db[_0xbcf1('0x64')],{'as':_0xbcf1('0x17b'),'foreignKey':_0xbcf1('0x183')});db[_0xbcf1('0x67')][_0xbcf1('0x12b')](db[_0xbcf1('0x73')],{'as':'Contact','foreignKey':_0xbcf1('0x16b')});db[_0xbcf1('0x67')]['belongsTo'](db['User'],{'as':_0xbcf1('0x17d'),'foreignKey':'UserId'});db[_0xbcf1('0x67')]['belongsToMany'](db[_0xbcf1('0x8d')],{'through':_0xbcf1('0x19f'),'as':_0xbcf1('0x18e')});db[_0xbcf1('0x67')][_0xbcf1('0x12d')](db[_0xbcf1('0x8d')],{'through':_0xbcf1('0x19f'),'as':_0xbcf1('0x17f')});db[_0xbcf1('0x67')][_0xbcf1('0x12d')](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x180'),'through':_0xbcf1('0x134'),'foreignKey':_0xbcf1('0x19e')});db[_0xbcf1('0x69')][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'onDelete':'cascade','as':_0xbcf1('0x12')});db['ChatMessage']['belongsTo'](db[_0xbcf1('0x73')],{'onDelete':_0xbcf1('0x11c'),'as':_0xbcf1('0x17c'),'foreignKey':_0xbcf1('0x16b')});db['ChatMessage'][_0xbcf1('0x12b')](db['ChatInteraction'],{'onDelete':_0xbcf1('0x11c'),'as':_0xbcf1('0x182'),'foreignKey':_0xbcf1('0x19e')});db['ChatMessage']['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0xbcf1('0x19b')});db[_0xbcf1('0x69')][_0xbcf1('0x12b')](db['ChatWebsite'],{'as':'Account','foreignKey':_0xbcf1('0x183')});db[_0xbcf1('0x184')][_0xbcf1('0x11d')](db[_0xbcf1('0xf2')],{'as':_0xbcf1('0x1a0'),'foreignKey':_0xbcf1('0x185'),'onDelete':_0xbcf1('0x11c'),'hooks':!![]});db[_0xbcf1('0x184')][_0xbcf1('0x12b')](db[_0xbcf1('0x73')],{'onDelete':_0xbcf1('0x11c'),'as':'Contact','foreignKey':_0xbcf1('0x16b')});db[_0xbcf1('0x184')][_0xbcf1('0x12b')](db['ChatWebsite'],{'as':_0xbcf1('0x17b'),'foreignKey':'ChatWebsiteId'});db[_0xbcf1('0x13e')][_0xbcf1('0x12d')](db['User'],{'as':_0xbcf1('0x162'),'through':'UserChatQueue','hooks':!![]});db[_0xbcf1('0x13e')]['belongsToMany'](db[_0xbcf1('0xec')],{'through':_0xbcf1('0x1a1'),'as':_0xbcf1('0x163')});db[_0xbcf1('0x6d')][_0xbcf1('0x11d')](db['ChatInternalMessage'],{'as':_0xbcf1('0x175'),'foreignKey':_0xbcf1('0x1a2'),'onDelete':_0xbcf1('0x11c')});db[_0xbcf1('0x6d')][_0xbcf1('0x12d')](db[_0xbcf1('0x12')],{'as':'Members','through':_0xbcf1('0x1a3')});db[_0xbcf1('0x6f')][_0xbcf1('0x12b')](db['ChatWebsite'],{'as':_0xbcf1('0x1a4'),'foreignKey':'ChatWebsiteId'});db[_0xbcf1('0x71')][_0xbcf1('0x11d')](db[_0xbcf1('0x73')],{'as':_0xbcf1('0x12e'),'foreignKey':_0xbcf1('0x1a5')});db[_0xbcf1('0x73')][_0xbcf1('0x11d')](db['CmContactHasItem'],{'as':_0xbcf1('0x1a6'),'foreignKey':_0xbcf1('0x1a7')});db[_0xbcf1('0x73')]['hasMany'](db[_0xbcf1('0x75')],{'as':_0xbcf1('0x158'),'foreignKey':_0xbcf1('0x16b')});db[_0xbcf1('0x73')]['hasMany'](db[_0xbcf1('0x78')],{'as':_0xbcf1('0x15a'),'foreignKey':_0xbcf1('0x16b')});db[_0xbcf1('0x73')][_0xbcf1('0x11d')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0xbcf1('0x16b')});db[_0xbcf1('0x73')][_0xbcf1('0x11d')](db['ReportAgentPreview'],{'as':_0xbcf1('0x7b'),'foreignKey':'ContactId'});db[_0xbcf1('0x73')][_0xbcf1('0x11d')](db[_0xbcf1('0xde')],{'as':'JscriptySessions','foreignKey':_0xbcf1('0x16b')});db['CmContact'][_0xbcf1('0x11d')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0xbcf1('0x16b'),'onDelete':_0xbcf1('0x170')});db['CmContact'][_0xbcf1('0x11d')](db[_0xbcf1('0x67')],{'as':_0xbcf1('0x126'),'foreignKey':_0xbcf1('0x16b'),'onDelete':'restrict'});db[_0xbcf1('0x73')]['hasMany'](db[_0xbcf1('0x56')],{'as':_0xbcf1('0x127'),'foreignKey':_0xbcf1('0x16b'),'onDelete':_0xbcf1('0x170')});db[_0xbcf1('0x73')][_0xbcf1('0x11d')](db['FaxInteraction'],{'as':_0xbcf1('0x128'),'foreignKey':_0xbcf1('0x16b'),'onDelete':_0xbcf1('0x170')});db[_0xbcf1('0x73')]['hasMany'](db[_0xbcf1('0x3e')],{'as':_0xbcf1('0x129'),'foreignKey':_0xbcf1('0x16b'),'onDelete':_0xbcf1('0x170')});db['CmContact'][_0xbcf1('0x12b')](db['CmCompany'],{'as':'Company','foreignKey':_0xbcf1('0x1a5')});db[_0xbcf1('0x73')][_0xbcf1('0x12b')](db['CmList'],{'as':_0xbcf1('0x177'),'foreignKey':_0xbcf1('0x178'),'onDelete':'cascade'});db[_0xbcf1('0x73')]['belongsToMany'](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x180'),'through':_0xbcf1('0x12f')});db[_0xbcf1('0x73')][_0xbcf1('0x12d')](db[_0xbcf1('0x8d')],{'as':_0xbcf1('0x18e'),'through':_0xbcf1('0x1a8')});db[_0xbcf1('0x73')][_0xbcf1('0x12d')](db['Tag'],{'through':_0xbcf1('0x1a8'),'as':'ThroughTags'});db[_0xbcf1('0x75')][_0xbcf1('0x11d')](db[_0xbcf1('0x90')],{'as':'AdditionalPhones','foreignKey':_0xbcf1('0x1a9')});db['CmHopper'][_0xbcf1('0x12b')](db[_0xbcf1('0x73')],{'as':'Contact','foreignKey':_0xbcf1('0x16b'),'onDelete':_0xbcf1('0x11c')});db['CmHopper'][_0xbcf1('0x12b')](db[_0xbcf1('0xfe')],{'as':_0xbcf1('0x177'),'foreignKey':_0xbcf1('0x178'),'onDelete':_0xbcf1('0x11c')});db[_0xbcf1('0x75')][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x1aa'),'foreignKey':_0xbcf1('0x11f')});db[_0xbcf1('0x75')][_0xbcf1('0x12b')](db[_0xbcf1('0x13a')],{'as':_0xbcf1('0x1ab'),'foreignKey':_0xbcf1('0x159'),'onDelete':_0xbcf1('0x11c')});db[_0xbcf1('0x75')][_0xbcf1('0x12b')](db[_0xbcf1('0x1ac')],{'as':'Campaign','foreignKey':_0xbcf1('0x1ad'),'onDelete':_0xbcf1('0x11c')});db[_0xbcf1('0x75')][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'as':'Owner','foreignKey':_0xbcf1('0x1ae')});db[_0xbcf1('0x77')][_0xbcf1('0x12b')](db[_0xbcf1('0x73')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0xbcf1('0x11c')});db[_0xbcf1('0x77')][_0xbcf1('0x12b')](db[_0xbcf1('0xfe')],{'as':'List','foreignKey':_0xbcf1('0x178'),'onDelete':_0xbcf1('0x11c')});db[_0xbcf1('0x77')][_0xbcf1('0x12b')](db[_0xbcf1('0x13a')],{'as':_0xbcf1('0x1ab'),'foreignKey':_0xbcf1('0x159'),'onDelete':_0xbcf1('0x11c')});db[_0xbcf1('0x77')][_0xbcf1('0x12b')](db[_0xbcf1('0x1ac')],{'as':_0xbcf1('0x1ac'),'foreignKey':_0xbcf1('0x1ad'),'onDelete':_0xbcf1('0x11c')});db['Automation'][_0xbcf1('0x11d')](db['Condition'],{'as':{'plural':'All','singular':_0xbcf1('0x1af')},'foreignKey':_0xbcf1('0x1b0'),'onDelete':_0xbcf1('0x11c'),'hooks':!![]});db[_0xbcf1('0x1b1')][_0xbcf1('0x11d')](db[_0xbcf1('0x83')],{'as':{'plural':_0xbcf1('0x1b2'),'singular':'OneAny'},'foreignKey':_0xbcf1('0x1b3'),'onDelete':_0xbcf1('0x11c'),'hooks':!![]});db[_0xbcf1('0x1b1')][_0xbcf1('0x11d')](db[_0xbcf1('0x7e')],{'as':_0xbcf1('0x1b4'),'foreignKey':_0xbcf1('0x1b5'),'onDelete':_0xbcf1('0x11c'),'hooks':!![]});db[_0xbcf1('0x81')]['hasMany'](db[_0xbcf1('0x81')],{'as':_0xbcf1('0x173'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0xbcf1('0x85')]['hasMany'](db['Interval'],{'as':_0xbcf1('0x1b6'),'foreignKey':_0xbcf1('0x15e'),'onDelete':_0xbcf1('0x11c'),'hooks':!![],'required':![]});db[_0xbcf1('0x85')][_0xbcf1('0x11d')](db[_0xbcf1('0x17')],{'as':_0xbcf1('0x122'),'foreignKey':_0xbcf1('0x15e'),'onDelete':_0xbcf1('0x170')});db[_0xbcf1('0x85')]['hasMany'](db[_0xbcf1('0x42')],{'as':_0xbcf1('0x1b7'),'foreignKey':_0xbcf1('0x15e')});db[_0xbcf1('0x85')][_0xbcf1('0x11d')](db[_0xbcf1('0x66')],{'as':'ChatApplications','foreignKey':_0xbcf1('0x15e')});db[_0xbcf1('0x85')][_0xbcf1('0x11d')](db[_0xbcf1('0x4a')],{'as':'FaxApplications','foreignKey':'IntervalId'});db[_0xbcf1('0x85')][_0xbcf1('0x11d')](db[_0xbcf1('0x54')],{'as':_0xbcf1('0x1b8'),'foreignKey':_0xbcf1('0x15e')});db[_0xbcf1('0x89')][_0xbcf1('0x12b')](db[_0xbcf1('0x39')],{});db[_0xbcf1('0x89')][_0xbcf1('0x12b')](db['AnalyticDefaultReport'],{'foreignKey':_0xbcf1('0x1b9')});db['Schedule'][_0xbcf1('0x12b')](db['AnalyticCustomReport'],{'foreignKey':_0xbcf1('0x1ba')});db[_0xbcf1('0x8b')][_0xbcf1('0x12d')](db[_0xbcf1('0x154')],{'as':_0xbcf1('0x1bb'),'through':_0xbcf1('0x156'),'onDelete':_0xbcf1('0x170')});db['Tag'][_0xbcf1('0x12d')](db[_0xbcf1('0x73')],{'through':_0xbcf1('0x1a8')});db[_0xbcf1('0x8d')][_0xbcf1('0x12d')](db['ChatInteraction'],{'through':_0xbcf1('0x19f')});db[_0xbcf1('0x8d')][_0xbcf1('0x12d')](db[_0xbcf1('0x3e')],{'through':'mail_interaction_has_tags'});db[_0xbcf1('0x8d')][_0xbcf1('0x12d')](db[_0xbcf1('0x56')],{'through':_0xbcf1('0x194')});db['Tag'][_0xbcf1('0x12d')](db[_0xbcf1('0x18c')],{'through':'fax_interaction_has_tags'});db['Tag'][_0xbcf1('0x12d')](db['OpenchannelInteraction'],{'through':_0xbcf1('0x19a')});db[_0xbcf1('0x8d')]['belongsToMany'](db[_0xbcf1('0x10c')],{'through':'whatsapp_interaction_has_tags'});db[_0xbcf1('0x1bc')][_0xbcf1('0x12b')](db[_0xbcf1('0x1bd')],{'as':_0xbcf1('0x1be'),'foreignKey':'ItemTypeId'});db[_0xbcf1('0x90')][_0xbcf1('0x12b')](db[_0xbcf1('0x75')],{'as':_0xbcf1('0x1bf'),'foreignKey':_0xbcf1('0x1a9')});db[_0xbcf1('0x1bc')][_0xbcf1('0x12b')](db[_0xbcf1('0x73')],{'as':_0xbcf1('0x17c'),'foreignKey':_0xbcf1('0x1a7')});db[_0xbcf1('0x93')]['hasMany'](db['Condition'],{'as':{'plural':_0xbcf1('0x1c0'),'singular':'AllCondition'},'foreignKey':_0xbcf1('0x1c1'),'onDelete':_0xbcf1('0x11c'),'hooks':!![]});db[_0xbcf1('0x93')]['hasMany'](db[_0xbcf1('0x83')],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0xbcf1('0x1c2'),'onDelete':_0xbcf1('0x11c'),'hooks':!![]});db[_0xbcf1('0x93')][_0xbcf1('0x11d')](db['Action'],{'as':_0xbcf1('0x1b4'),'foreignKey':'TriggerId','onDelete':_0xbcf1('0x11c'),'hooks':!![]});db[_0xbcf1('0x9a')][_0xbcf1('0x11d')](db[_0xbcf1('0xa1')],{'as':_0xbcf1('0x1c3'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0xbcf1('0x11d')](db[_0xbcf1('0xa1')],{'as':'Fields','onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1b9')});db['AnalyticMetric']['hasMany'](db['AnalyticFieldReport'],{'as':_0xbcf1('0x1c3'),'onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1c4')});db['AnalyticFieldReport'][_0xbcf1('0x12b')](db[_0xbcf1('0x9f')],{'foreignKey':_0xbcf1('0x1c4')});db[_0xbcf1('0xa4')][_0xbcf1('0x11d')](db[_0xbcf1('0xa6')],{'as':_0xbcf1('0x1c5'),'onDelete':_0xbcf1('0x11c'),'foreignKey':'AccountId'});db['SalesforceConfiguration']['hasMany'](db[_0xbcf1('0xa8')],{'as':_0xbcf1('0x1c6'),'onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1c7')});db[_0xbcf1('0xa6')][_0xbcf1('0x11d')](db[_0xbcf1('0xa8')],{'as':_0xbcf1('0x1c8'),'onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1c9')});db[_0xbcf1('0xa6')][_0xbcf1('0x11d')](db[_0xbcf1('0xa8')],{'as':_0xbcf1('0x1c3'),'onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1ca')});db[_0xbcf1('0xa6')]['belongsTo'](db[_0xbcf1('0xa4')],{'as':'Account','foreignKey':_0xbcf1('0x1cb')});db['SalesforceField'][_0xbcf1('0x11d')](db[_0xbcf1('0xa8')],{'as':_0xbcf1('0x1cc'),'foreignKey':_0xbcf1('0x1c7')});db[_0xbcf1('0xa8')]['hasMany'](db[_0xbcf1('0xa8')],{'as':'Description','foreignKey':_0xbcf1('0x1c9')});db[_0xbcf1('0xa8')]['hasMany'](db['SalesforceField'],{'as':_0xbcf1('0x1cd'),'foreignKey':'FieldId'});db['SalesforceField'][_0xbcf1('0x12b')](db['Variable'],{'as':'Variable','foreignKey':_0xbcf1('0x1ce')});db['SugarcrmAccount']['hasMany'](db[_0xbcf1('0x1cf')],{'as':_0xbcf1('0x1c5'),'onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1cb')});db['SugarcrmConfiguration'][_0xbcf1('0x11d')](db[_0xbcf1('0xab')],{'as':'Subjects','onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1c7')});db['SugarcrmConfiguration'][_0xbcf1('0x11d')](db[_0xbcf1('0xab')],{'as':_0xbcf1('0x1c8'),'onDelete':'cascade','foreignKey':_0xbcf1('0x1c9')});db[_0xbcf1('0x1cf')]['hasMany'](db[_0xbcf1('0xab')],{'as':'Fields','onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1ca')});db[_0xbcf1('0x1cf')][_0xbcf1('0x12b')](db[_0xbcf1('0x1d0')],{'as':_0xbcf1('0x17b'),'foreignKey':_0xbcf1('0x1cb')});db[_0xbcf1('0xab')]['hasMany'](db['SugarcrmField'],{'as':_0xbcf1('0x1cc'),'foreignKey':_0xbcf1('0x1c7')});db[_0xbcf1('0xab')]['hasMany'](db[_0xbcf1('0xab')],{'as':_0xbcf1('0x1d1'),'foreignKey':'DescriptionId'});db[_0xbcf1('0xab')][_0xbcf1('0x11d')](db[_0xbcf1('0xab')],{'as':_0xbcf1('0x1cd'),'foreignKey':_0xbcf1('0x1ca')});db[_0xbcf1('0xab')][_0xbcf1('0x12b')](db[_0xbcf1('0x95')],{'as':'Variable','foreignKey':_0xbcf1('0x1ce')});db[_0xbcf1('0xad')][_0xbcf1('0x11d')](db[_0xbcf1('0xaf')],{'as':'Configurations','onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1cb')});db['DeskConfiguration'][_0xbcf1('0x11d')](db[_0xbcf1('0xb1')],{'as':_0xbcf1('0x1c6'),'onDelete':_0xbcf1('0x11c'),'foreignKey':'SubjectId'});db['DeskConfiguration']['hasMany'](db[_0xbcf1('0xb1')],{'as':_0xbcf1('0x1c8'),'onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1c9')});db[_0xbcf1('0xaf')][_0xbcf1('0x11d')](db[_0xbcf1('0xb1')],{'as':'Fields','onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1ca')});db[_0xbcf1('0xaf')][_0xbcf1('0x12b')](db[_0xbcf1('0xad')],{'as':_0xbcf1('0x17b'),'foreignKey':_0xbcf1('0x1cb')});db[_0xbcf1('0xaf')]['belongsToMany'](db[_0xbcf1('0x8d')],{'through':_0xbcf1('0x1d2')});db['DeskField'][_0xbcf1('0x11d')](db[_0xbcf1('0xb1')],{'as':'Subject','foreignKey':_0xbcf1('0x1c7')});db['DeskField'][_0xbcf1('0x11d')](db[_0xbcf1('0xb1')],{'as':_0xbcf1('0x1d1'),'foreignKey':_0xbcf1('0x1c9')});db[_0xbcf1('0xb1')]['hasMany'](db[_0xbcf1('0xb1')],{'as':'Field','foreignKey':'FieldId'});db['DeskField'][_0xbcf1('0x12b')](db['Variable'],{'as':_0xbcf1('0x95'),'foreignKey':_0xbcf1('0x1ce')});db[_0xbcf1('0xb3')][_0xbcf1('0x11d')](db['ZohoConfiguration'],{'as':_0xbcf1('0x1c5'),'onDelete':_0xbcf1('0x11c'),'foreignKey':'AccountId'});db['ZohoConfiguration'][_0xbcf1('0x11d')](db[_0xbcf1('0xb6')],{'as':_0xbcf1('0x1c6'),'onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1c7')});db['ZohoConfiguration'][_0xbcf1('0x11d')](db[_0xbcf1('0xb6')],{'as':_0xbcf1('0x1c8'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xbcf1('0xb4')][_0xbcf1('0x11d')](db[_0xbcf1('0xb6')],{'as':'Fields','onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1ca')});db[_0xbcf1('0xb4')]['belongsTo'](db[_0xbcf1('0xb3')],{'as':_0xbcf1('0x17b'),'foreignKey':_0xbcf1('0x1cb')});db['ZohoField'][_0xbcf1('0x11d')](db['ZohoField'],{'as':'Subject','foreignKey':_0xbcf1('0x1c7')});db[_0xbcf1('0xb6')][_0xbcf1('0x11d')](db[_0xbcf1('0xb6')],{'as':'Description','foreignKey':_0xbcf1('0x1c9')});db[_0xbcf1('0xb6')][_0xbcf1('0x11d')](db[_0xbcf1('0xb6')],{'as':_0xbcf1('0x1cd'),'foreignKey':_0xbcf1('0x1ca')});db[_0xbcf1('0xb6')][_0xbcf1('0x12b')](db[_0xbcf1('0x95')],{'as':_0xbcf1('0x95'),'foreignKey':'VariableId'});db['ZendeskAccount'][_0xbcf1('0x11d')](db[_0xbcf1('0xba')],{'as':_0xbcf1('0x1c5'),'onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1cb')});db['ZendeskConfiguration'][_0xbcf1('0x11d')](db[_0xbcf1('0x1d3')],{'as':_0xbcf1('0x1c6'),'foreignKey':_0xbcf1('0x1c7')});db[_0xbcf1('0xba')][_0xbcf1('0x11d')](db[_0xbcf1('0x1d3')],{'as':'Descriptions','foreignKey':_0xbcf1('0x1c9')});db[_0xbcf1('0xba')][_0xbcf1('0x11d')](db['ZendeskField'],{'as':_0xbcf1('0x1c3'),'foreignKey':_0xbcf1('0x1ca')});db['ZendeskConfiguration'][_0xbcf1('0x12b')](db[_0xbcf1('0xb8')],{'as':'Account','foreignKey':_0xbcf1('0x1cb')});db[_0xbcf1('0xba')][_0xbcf1('0x12d')](db[_0xbcf1('0x8d')],{'through':_0xbcf1('0x1d4')});db[_0xbcf1('0x1d3')]['hasMany'](db[_0xbcf1('0x1d3')],{'as':_0xbcf1('0x1cc'),'foreignKey':'SubjectId'});db[_0xbcf1('0x1d3')][_0xbcf1('0x11d')](db[_0xbcf1('0x1d3')],{'as':_0xbcf1('0x1d1'),'foreignKey':_0xbcf1('0x1c9')});db[_0xbcf1('0x1d3')]['hasMany'](db[_0xbcf1('0x1d3')],{'as':_0xbcf1('0x1cd'),'foreignKey':_0xbcf1('0x1ca')});db['ZendeskField'][_0xbcf1('0x12b')](db[_0xbcf1('0x95')],{'as':_0xbcf1('0x95'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0xbcf1('0x11d')](db[_0xbcf1('0xbf')],{'as':_0xbcf1('0x1c5'),'onDelete':'cascade','foreignKey':_0xbcf1('0x1cb')});db[_0xbcf1('0xbf')][_0xbcf1('0x11d')](db[_0xbcf1('0x1d5')],{'as':_0xbcf1('0x1c6'),'onDelete':_0xbcf1('0x11c'),'foreignKey':'SubjectId'});db[_0xbcf1('0xbf')][_0xbcf1('0x11d')](db['FreshdeskField'],{'as':_0xbcf1('0x1c8'),'onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1c9')});db['FreshdeskConfiguration']['hasMany'](db[_0xbcf1('0x1d5')],{'as':_0xbcf1('0x1c3'),'onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1ca')});db[_0xbcf1('0xbf')][_0xbcf1('0x12b')](db[_0xbcf1('0xbd')],{'as':_0xbcf1('0x17b'),'foreignKey':_0xbcf1('0x1cb')});db[_0xbcf1('0xbf')][_0xbcf1('0x12d')](db['Tag'],{'through':_0xbcf1('0x1d6')});db[_0xbcf1('0x1d5')]['hasMany'](db[_0xbcf1('0x1d5')],{'as':'Subject','foreignKey':_0xbcf1('0x1c7')});db[_0xbcf1('0x1d5')]['hasMany'](db[_0xbcf1('0x1d5')],{'as':_0xbcf1('0x1d1'),'foreignKey':_0xbcf1('0x1c9')});db['FreshdeskField'][_0xbcf1('0x11d')](db['FreshdeskField'],{'as':_0xbcf1('0x1cd'),'foreignKey':_0xbcf1('0x1ca')});db['FreshdeskField'][_0xbcf1('0x12b')](db[_0xbcf1('0x95')],{'as':_0xbcf1('0x95'),'foreignKey':_0xbcf1('0x1ce')});db['VtigerAccount']['hasMany'](db[_0xbcf1('0xc3')],{'as':_0xbcf1('0x1c5'),'onDelete':_0xbcf1('0x11c'),'foreignKey':'AccountId'});db[_0xbcf1('0xc3')]['hasMany'](db[_0xbcf1('0xc4')],{'as':'Subjects','foreignKey':_0xbcf1('0x1c7')});db['VtigerConfiguration'][_0xbcf1('0x11d')](db[_0xbcf1('0xc4')],{'as':_0xbcf1('0x1c8'),'foreignKey':_0xbcf1('0x1c9')});db[_0xbcf1('0xc3')][_0xbcf1('0x11d')](db[_0xbcf1('0xc4')],{'as':_0xbcf1('0x1c3'),'foreignKey':_0xbcf1('0x1ca')});db[_0xbcf1('0xc3')][_0xbcf1('0x12b')](db['VtigerAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0xbcf1('0xc4')][_0xbcf1('0x11d')](db[_0xbcf1('0xc4')],{'as':_0xbcf1('0x1cc'),'foreignKey':_0xbcf1('0x1c7')});db[_0xbcf1('0xc4')][_0xbcf1('0x11d')](db[_0xbcf1('0xc4')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xbcf1('0xc4')][_0xbcf1('0x11d')](db[_0xbcf1('0xc4')],{'as':_0xbcf1('0x1cd'),'foreignKey':'FieldId'});db[_0xbcf1('0xc4')][_0xbcf1('0x12b')](db[_0xbcf1('0x95')],{'as':'Variable','foreignKey':_0xbcf1('0x1ce')});db['ServicenowAccount'][_0xbcf1('0x11d')](db[_0xbcf1('0x1d7')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xbcf1('0x1cb')});db[_0xbcf1('0x1d7')][_0xbcf1('0x11d')](db['ServicenowField'],{'as':_0xbcf1('0x1c6'),'foreignKey':_0xbcf1('0x1c7')});db[_0xbcf1('0x1d7')][_0xbcf1('0x11d')](db[_0xbcf1('0xc9')],{'as':'Descriptions','foreignKey':_0xbcf1('0x1c9')});db[_0xbcf1('0x1d7')][_0xbcf1('0x11d')](db[_0xbcf1('0xc9')],{'as':_0xbcf1('0x1c3'),'foreignKey':_0xbcf1('0x1ca')});db['ServicenowConfiguration'][_0xbcf1('0x12b')](db['ServicenowAccount'],{'as':_0xbcf1('0x17b'),'foreignKey':'AccountId'});db[_0xbcf1('0xc9')]['hasMany'](db[_0xbcf1('0xc9')],{'as':_0xbcf1('0x1cc'),'foreignKey':_0xbcf1('0x1c7')});db[_0xbcf1('0xc9')][_0xbcf1('0x11d')](db[_0xbcf1('0xc9')],{'as':_0xbcf1('0x1d1'),'foreignKey':_0xbcf1('0x1c9')});db[_0xbcf1('0xc9')][_0xbcf1('0x11d')](db[_0xbcf1('0xc9')],{'as':_0xbcf1('0x1cd'),'foreignKey':_0xbcf1('0x1ca')});db[_0xbcf1('0xc9')][_0xbcf1('0x12b')](db[_0xbcf1('0x95')],{'as':'Variable','foreignKey':_0xbcf1('0x1ce')});db['Dynamics365Account'][_0xbcf1('0x11d')](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xbcf1('0xcb')][_0xbcf1('0x12b')](db[_0xbcf1('0x16e')],{'as':_0xbcf1('0x16e'),'foreignKey':'CloudProviderId'});db[_0xbcf1('0x1d8')][_0xbcf1('0x11d')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xbcf1('0x1c7')});db[_0xbcf1('0x1d8')][_0xbcf1('0x11d')](db[_0xbcf1('0xcd')],{'as':_0xbcf1('0x1c8'),'onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1c9')});db[_0xbcf1('0x1d8')]['hasMany'](db['Dynamics365Field'],{'as':'Fields','onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1ca')});db['Dynamics365Configuration'][_0xbcf1('0x12b')](db[_0xbcf1('0xcb')],{'as':_0xbcf1('0x17b'),'foreignKey':_0xbcf1('0x1cb')});db[_0xbcf1('0xcd')][_0xbcf1('0x11d')](db['Dynamics365Field'],{'as':_0xbcf1('0x1cc'),'foreignKey':_0xbcf1('0x1c7')});db[_0xbcf1('0xcd')]['hasMany'](db['Dynamics365Field'],{'as':_0xbcf1('0x1d1'),'foreignKey':_0xbcf1('0x1c9')});db[_0xbcf1('0xcd')][_0xbcf1('0x11d')](db[_0xbcf1('0xcd')],{'as':_0xbcf1('0x1cd'),'foreignKey':'FieldId'});db[_0xbcf1('0xcd')]['belongsTo'](db[_0xbcf1('0x95')],{'as':_0xbcf1('0x95'),'foreignKey':'VariableId'});db['FreshsalesAccount'][_0xbcf1('0x11d')](db[_0xbcf1('0xd1')],{'as':_0xbcf1('0x1c5'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xbcf1('0xd1')][_0xbcf1('0x11d')](db[_0xbcf1('0xd3')],{'as':_0xbcf1('0x1c6'),'foreignKey':_0xbcf1('0x1c7')});db[_0xbcf1('0xd1')][_0xbcf1('0x11d')](db[_0xbcf1('0xd3')],{'as':_0xbcf1('0x1c8'),'foreignKey':_0xbcf1('0x1c9')});db[_0xbcf1('0xd1')][_0xbcf1('0x11d')](db[_0xbcf1('0xd3')],{'as':_0xbcf1('0x1c3'),'foreignKey':_0xbcf1('0x1ca')});db[_0xbcf1('0xd1')][_0xbcf1('0x12b')](db[_0xbcf1('0xcf')],{'as':_0xbcf1('0x17b'),'foreignKey':_0xbcf1('0x1cb')});db[_0xbcf1('0xd3')]['hasMany'](db[_0xbcf1('0xd3')],{'as':'Subject','foreignKey':_0xbcf1('0x1c7')});db[_0xbcf1('0xd3')][_0xbcf1('0x11d')](db[_0xbcf1('0xd3')],{'as':_0xbcf1('0x1d1'),'foreignKey':'DescriptionId'});db['FreshsalesField'][_0xbcf1('0x11d')](db[_0xbcf1('0xd3')],{'as':'Field','foreignKey':'FieldId'});db[_0xbcf1('0xd3')][_0xbcf1('0x12b')](db['Variable'],{'as':_0xbcf1('0x95'),'foreignKey':_0xbcf1('0x1ce')});db['ChatQueueReport'][_0xbcf1('0x12b')](db['ChatWebsite'],{});db['ChatQueueReport'][_0xbcf1('0x12b')](db[_0xbcf1('0xfe')],{'as':_0xbcf1('0x177'),'foreignKey':_0xbcf1('0x178')});db['ChatQueueReport']['belongsTo'](db[_0xbcf1('0x73')],{'as':'Contact','foreignKey':_0xbcf1('0x16b')});db[_0xbcf1('0xd7')][_0xbcf1('0x12b')](db[_0xbcf1('0x67')],{});db[_0xbcf1('0xd7')][_0xbcf1('0x12b')](db[_0xbcf1('0x69')],{});db[_0xbcf1('0xd7')][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{});db['ChatQueueReport'][_0xbcf1('0x12b')](db[_0xbcf1('0x13e')],{});db[_0xbcf1('0xd8')][_0xbcf1('0x12b')](db['User'],{'onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1d9')});db[_0xbcf1('0xd8')]['belongsTo'](db[_0xbcf1('0x12')],{'onDelete':'cascade','foreignKey':'ToId'});db[_0xbcf1('0xde')][_0xbcf1('0x11d')](db[_0xbcf1('0xdc')],{'foreignKey':_0xbcf1('0x1da'),'onDelete':_0xbcf1('0x11c')});db[_0xbcf1('0xde')][_0xbcf1('0x11d')](db[_0xbcf1('0xda')],{'foreignKey':'SessionId','onDelete':_0xbcf1('0x11c')});db['SmsQueueReport'][_0xbcf1('0x12b')](db['SmsAccount'],{});db[_0xbcf1('0xdf')][_0xbcf1('0x12b')](db['CmList'],{'as':_0xbcf1('0x177'),'foreignKey':_0xbcf1('0x178')});db[_0xbcf1('0xdf')][_0xbcf1('0x12b')](db['CmContact'],{'as':_0xbcf1('0x17c'),'foreignKey':_0xbcf1('0x16b')});db[_0xbcf1('0xdf')]['belongsTo'](db[_0xbcf1('0x56')],{});db[_0xbcf1('0xdf')][_0xbcf1('0x12b')](db[_0xbcf1('0x58')],{});db[_0xbcf1('0xdf')][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{});db[_0xbcf1('0xdf')][_0xbcf1('0x12b')](db[_0xbcf1('0x140')],{});db[_0xbcf1('0xe2')][_0xbcf1('0x11d')](db['JscriptySessionReport'],{'foreignKey':_0xbcf1('0x1db')});db[_0xbcf1('0xe2')][_0xbcf1('0x11d')](db['JscriptyQuestionReport'],{'foreignKey':_0xbcf1('0x1db')});db[_0xbcf1('0xe2')][_0xbcf1('0x11d')](db['JscriptyAnswerReport'],{'foreignKey':_0xbcf1('0x1db')});db[_0xbcf1('0xe7')][_0xbcf1('0x12d')](db[_0xbcf1('0x12')],{'as':'Users','through':_0xbcf1('0x14f')});db[_0xbcf1('0xec')][_0xbcf1('0x12d')](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x162'),'through':'user_has_teams'});db[_0xbcf1('0xec')][_0xbcf1('0x12d')](db[_0xbcf1('0x13a')],{'through':'TeamVoiceQueue','as':_0xbcf1('0x13b')});db['Team'][_0xbcf1('0x12d')](db[_0xbcf1('0x3b')],{'through':_0xbcf1('0x17a'),'as':_0xbcf1('0x13d')});db[_0xbcf1('0xec')][_0xbcf1('0x12d')](db[_0xbcf1('0x13e')],{'through':'team_has_chat_queues','as':'ChatQueues'});db['Team']['belongsToMany'](db[_0xbcf1('0x18b')],{'through':_0xbcf1('0x190'),'as':_0xbcf1('0x1dc')});db[_0xbcf1('0xec')][_0xbcf1('0x12d')](db[_0xbcf1('0x140')],{'through':_0xbcf1('0x196'),'as':'SmsQueues'});db[_0xbcf1('0xec')]['belongsToMany'](db['OpenchannelQueue'],{'through':_0xbcf1('0x1dd'),'as':'OpenchannelQueues'});db[_0xbcf1('0xec')][_0xbcf1('0x12d')](db['WhatsappQueue'],{'through':_0xbcf1('0x1de'),'as':_0xbcf1('0x142')});db[_0xbcf1('0xec')][_0xbcf1('0x12d')](db[_0xbcf1('0x100')],{'through':_0xbcf1('0x1df'),'as':_0xbcf1('0x13c')});db[_0xbcf1('0x1ac')][_0xbcf1('0x11d')](db[_0xbcf1('0x75')],{'as':'Hoppers','foreignKey':_0xbcf1('0x1ad')});db[_0xbcf1('0x1ac')][_0xbcf1('0x11d')](db[_0xbcf1('0x78')],{'as':_0xbcf1('0x15a'),'foreignKey':_0xbcf1('0x1ad')});db[_0xbcf1('0x1ac')][_0xbcf1('0x11d')](db['CmHopperHistory'],{'as':_0xbcf1('0x1e0'),'foreignKey':'CampaignId'});db[_0xbcf1('0x1ac')][_0xbcf1('0x11d')](db[_0xbcf1('0x77')],{'as':_0xbcf1('0x1e1'),'foreignKey':_0xbcf1('0x1ad')});db[_0xbcf1('0x1ac')][_0xbcf1('0x12b')](db[_0xbcf1('0x28')],{'as':_0xbcf1('0x28'),'foreignKey':_0xbcf1('0x15c')});db['Campaign'][_0xbcf1('0x12b')](db[_0xbcf1('0x28')],{'as':_0xbcf1('0x1e2'),'foreignKey':_0xbcf1('0x15d')});db['Campaign'][_0xbcf1('0x12b')](db[_0xbcf1('0x85')],{'as':_0xbcf1('0x85'),'foreignKey':_0xbcf1('0x15e')});db[_0xbcf1('0x1ac')][_0xbcf1('0x12b')](db[_0xbcf1('0xe7')],{'as':'SquareProject','foreignKey':_0xbcf1('0x1e3')});db[_0xbcf1('0x1ac')][_0xbcf1('0x12d')](db[_0xbcf1('0xfe')],{'as':_0xbcf1('0x130'),'through':'campaigns_has_cm_lists'});db[_0xbcf1('0x1ac')][_0xbcf1('0x12d')](db[_0xbcf1('0xfe')],{'as':_0xbcf1('0x164'),'through':_0xbcf1('0x1e4')});db['Attachment'][_0xbcf1('0x12b')](db['ChatOfflineMessage'],{'as':_0xbcf1('0x184'),'foreignKey':_0xbcf1('0x185')});db[_0xbcf1('0xf5')][_0xbcf1('0x12b')](db[_0xbcf1('0x40')],{});db['MailTransferReport']['belongsTo'](db[_0xbcf1('0x3e')],{});db[_0xbcf1('0xf5')][_0xbcf1('0x12b')](db[_0xbcf1('0x39')],{'foreignKey':'FromMailAccountId','as':_0xbcf1('0x1e5')});db['MailTransferReport'][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'foreignKey':_0xbcf1('0x1e6'),'as':'FromAgent'});db[_0xbcf1('0xf5')][_0xbcf1('0x12b')](db['User'],{'foreignKey':_0xbcf1('0x1e7'),'as':_0xbcf1('0x1e8')});db[_0xbcf1('0xf5')][_0xbcf1('0x12b')](db[_0xbcf1('0x3b')],{'foreignKey':'ToMailQueueId','as':_0xbcf1('0x1e9')});db['MailTransferReport']['belongsTo'](db[_0xbcf1('0x39')],{'foreignKey':'ToMailAccountId','as':_0xbcf1('0x1ea')});db[_0xbcf1('0xf7')][_0xbcf1('0x12b')](db['ChatMessage'],{});db['ChatTransferReport'][_0xbcf1('0x12b')](db[_0xbcf1('0x67')],{});db[_0xbcf1('0xf7')][_0xbcf1('0x12b')](db[_0xbcf1('0x64')],{'foreignKey':_0xbcf1('0x1eb'),'as':_0xbcf1('0x1e5')});db[_0xbcf1('0xf7')][_0xbcf1('0x12b')](db['User'],{'foreignKey':_0xbcf1('0x1e6'),'as':_0xbcf1('0x1ec')});db[_0xbcf1('0xf7')][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'foreignKey':_0xbcf1('0x1e7'),'as':_0xbcf1('0x1e8')});db[_0xbcf1('0xf7')][_0xbcf1('0x12b')](db[_0xbcf1('0x13e')],{'foreignKey':_0xbcf1('0x1ed'),'as':_0xbcf1('0x1e9')});db[_0xbcf1('0xf7')][_0xbcf1('0x12b')](db[_0xbcf1('0x64')],{'foreignKey':_0xbcf1('0x1ee'),'as':_0xbcf1('0x1ea')});db[_0xbcf1('0x1ef')][_0xbcf1('0x12b')](db[_0xbcf1('0x4d')],{});db[_0xbcf1('0x1ef')]['belongsTo'](db[_0xbcf1('0x18c')],{});db[_0xbcf1('0x1ef')][_0xbcf1('0x12b')](db[_0xbcf1('0x145')],{'foreignKey':_0xbcf1('0x1f0'),'as':'FromAccount'});db[_0xbcf1('0x1ef')][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'foreignKey':_0xbcf1('0x1e6'),'as':'FromAgent'});db[_0xbcf1('0x1ef')][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'foreignKey':'ToUserId','as':_0xbcf1('0x1e8')});db[_0xbcf1('0x1ef')][_0xbcf1('0x12b')](db[_0xbcf1('0x18b')],{'foreignKey':_0xbcf1('0x1f1'),'as':_0xbcf1('0x1e9')});db['FaxTransferReport'][_0xbcf1('0x12b')](db[_0xbcf1('0x145')],{'foreignKey':_0xbcf1('0x1f2'),'as':'ToAccount'});db[_0xbcf1('0xfa')][_0xbcf1('0x12b')](db[_0xbcf1('0x60')],{});db[_0xbcf1('0xfa')][_0xbcf1('0x12b')](db[_0xbcf1('0x5e')],{});db[_0xbcf1('0xfa')]['belongsTo'](db[_0xbcf1('0x149')],{'foreignKey':'FromOpenchannelAccountId','as':_0xbcf1('0x1e5')});db['OpenchannelTransferReport'][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'foreignKey':_0xbcf1('0x1e6'),'as':_0xbcf1('0x1ec')});db['OpenchannelTransferReport'][_0xbcf1('0x12b')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db['OpenchannelTransferReport']['belongsTo'](db[_0xbcf1('0x62')],{'foreignKey':_0xbcf1('0x1f3'),'as':_0xbcf1('0x1e9')});db['OpenchannelTransferReport'][_0xbcf1('0x12b')](db[_0xbcf1('0x149')],{'foreignKey':_0xbcf1('0x1f4'),'as':_0xbcf1('0x1ea')});db[_0xbcf1('0xfc')][_0xbcf1('0x12b')](db[_0xbcf1('0x58')],{});db['SmsTransferReport']['belongsTo'](db[_0xbcf1('0x56')],{});db[_0xbcf1('0xfc')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0xbcf1('0x1f5'),'as':_0xbcf1('0x1e5')});db[_0xbcf1('0xfc')][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'foreignKey':_0xbcf1('0x1e6'),'as':_0xbcf1('0x1ec')});db[_0xbcf1('0xfc')][_0xbcf1('0x12b')](db['User'],{'foreignKey':_0xbcf1('0x1e7'),'as':_0xbcf1('0x1e8')});db[_0xbcf1('0xfc')][_0xbcf1('0x12b')](db[_0xbcf1('0x140')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db[_0xbcf1('0xfc')][_0xbcf1('0x12b')](db[_0xbcf1('0x52')],{'foreignKey':_0xbcf1('0x1f6'),'as':'ToAccount'});db[_0xbcf1('0xfe')][_0xbcf1('0x11d')](db[_0xbcf1('0x81')],{'as':_0xbcf1('0x173'),'foreignKey':_0xbcf1('0x178'),'onDelete':_0xbcf1('0x11c')});db[_0xbcf1('0xfe')][_0xbcf1('0x11d')](db['CmCustomField'],{'as':'CustomFields','foreignKey':'ListId'});db[_0xbcf1('0xfe')][_0xbcf1('0x11d')](db['CmContact'],{'as':_0xbcf1('0x12e'),'onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x178')});db[_0xbcf1('0xfe')][_0xbcf1('0x11d')](db[_0xbcf1('0x78')],{'as':_0xbcf1('0x15a'),'foreignKey':'ListId'});db['CmList'][_0xbcf1('0x11d')](db[_0xbcf1('0x123')],{'as':_0xbcf1('0x124'),'foreignKey':_0xbcf1('0x178')});db[_0xbcf1('0xfe')]['hasMany'](db[_0xbcf1('0x7b')],{'as':_0xbcf1('0x7b'),'foreignKey':'ListId'});db[_0xbcf1('0xfe')][_0xbcf1('0x12d')](db[_0xbcf1('0x13a')],{'as':_0xbcf1('0x1f7'),'through':_0xbcf1('0x1f8')});db[_0xbcf1('0xfe')][_0xbcf1('0x12d')](db['User'],{'as':_0xbcf1('0x162'),'through':_0xbcf1('0x131')});db['VoicePrefix']['hasMany'](db[_0xbcf1('0x17')],{'as':_0xbcf1('0x122'),'onDelete':_0xbcf1('0x11c')});db['VoicePrefix']['belongsToMany'](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x162'),'through':_0xbcf1('0x117')});db[_0xbcf1('0x100')]['belongsToMany'](db[_0xbcf1('0xec')],{'through':_0xbcf1('0x1df'),'as':_0xbcf1('0x163')});db[_0xbcf1('0x102')]['hasMany'](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x180'),'foreignKey':_0xbcf1('0x12c')});db[_0xbcf1('0x102')][_0xbcf1('0x11d')](db[_0xbcf1('0x104')],{'as':_0xbcf1('0x1f9'),'foreignKey':'userProfileId','onDelete':_0xbcf1('0x11c')});db[_0xbcf1('0x104')][_0xbcf1('0x11d')](db[_0xbcf1('0x106')],{'as':'Resources','foreignKey':_0xbcf1('0x1fa'),'onDelete':_0xbcf1('0x11c')});db['WhatsappAccount']['hasMany'](db['Disposition'],{'as':_0xbcf1('0x173'),'foreignKey':_0xbcf1('0x1fb'),'onDelete':_0xbcf1('0x11c')});db[_0xbcf1('0x109')][_0xbcf1('0x11d')](db['CannedAnswer'],{'as':_0xbcf1('0x174'),'foreignKey':_0xbcf1('0x1fb')});db[_0xbcf1('0x109')]['hasMany'](db[_0xbcf1('0x10d')],{'as':_0xbcf1('0x175'),'foreignKey':_0xbcf1('0x1fb')});db[_0xbcf1('0x109')][_0xbcf1('0x11d')](db[_0xbcf1('0x10c')],{'as':_0xbcf1('0x176')});db[_0xbcf1('0x109')][_0xbcf1('0x11d')](db[_0xbcf1('0x1fc')],{'as':_0xbcf1('0x153')});db[_0xbcf1('0x109')]['belongsTo'](db['CmList'],{'as':_0xbcf1('0x177'),'foreignKey':_0xbcf1('0x178')});db['WhatsappAccount'][_0xbcf1('0x12b')](db[_0xbcf1('0x15f')],{'as':_0xbcf1('0x160'),'foreignKey':_0xbcf1('0x161')});db[_0xbcf1('0x109')]['belongsToMany'](db['User'],{'as':_0xbcf1('0x162'),'through':'user_has_whatsapp_accounts'});db[_0xbcf1('0x1fc')][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'onDelete':'restrict'});db['WhatsappApplication'][_0xbcf1('0x12b')](db[_0xbcf1('0x111')],{'onDelete':_0xbcf1('0x170')});db['WhatsappApplication'][_0xbcf1('0x12b')](db[_0xbcf1('0x109')],{'onDelete':'restrict'});db[_0xbcf1('0x1fc')][_0xbcf1('0x12b')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xbcf1('0x15e')});db[_0xbcf1('0x1fc')][_0xbcf1('0x12b')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xbcf1('0x186')});db[_0xbcf1('0x10c')][_0xbcf1('0x11d')](db['WhatsappMessage'],{'as':_0xbcf1('0x175'),'onDelete':_0xbcf1('0x11c'),'foreignKey':_0xbcf1('0x1fd')});db['WhatsappInteraction'][_0xbcf1('0x12b')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0xbcf1('0x1fb')});db[_0xbcf1('0x10c')][_0xbcf1('0x12b')](db[_0xbcf1('0x73')],{'as':'Contact','foreignKey':_0xbcf1('0x16b')});db[_0xbcf1('0x10c')][_0xbcf1('0x12b')](db['User'],{'as':_0xbcf1('0x17d'),'foreignKey':_0xbcf1('0x11f')});db[_0xbcf1('0x10c')][_0xbcf1('0x12d')](db['Tag'],{'through':_0xbcf1('0x1fe'),'as':_0xbcf1('0x18e')});db[_0xbcf1('0x10c')][_0xbcf1('0x12d')](db[_0xbcf1('0x8d')],{'through':_0xbcf1('0x1fe'),'as':_0xbcf1('0x17f')});db[_0xbcf1('0x10c')]['belongsToMany'](db[_0xbcf1('0x12')],{'as':'Users','through':_0xbcf1('0x139'),'foreignKey':_0xbcf1('0x1fd')});db[_0xbcf1('0x10d')][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'as':'User'});db[_0xbcf1('0x10d')][_0xbcf1('0x12b')](db['CmContact'],{'onDelete':_0xbcf1('0x11c'),'as':_0xbcf1('0x17c')});db[_0xbcf1('0x10d')][_0xbcf1('0x12b')](db['WhatsappInteraction'],{'onDelete':_0xbcf1('0x11c'),'as':_0xbcf1('0x182'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0xbcf1('0x12b')](db[_0xbcf1('0x109')],{'as':_0xbcf1('0x17b'),'foreignKey':_0xbcf1('0x1fb')});db['WhatsappQueueReport'][_0xbcf1('0x12b')](db[_0xbcf1('0x109')],{});db[_0xbcf1('0x1ff')][_0xbcf1('0x12b')](db[_0xbcf1('0xfe')],{'as':_0xbcf1('0x177'),'foreignKey':_0xbcf1('0x178')});db[_0xbcf1('0x1ff')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xbcf1('0x16b')});db[_0xbcf1('0x1ff')]['belongsTo'](db['WhatsappInteraction'],{});db[_0xbcf1('0x1ff')][_0xbcf1('0x12b')](db[_0xbcf1('0x111')],{});db['WhatsappQueueReport'][_0xbcf1('0x12b')](db[_0xbcf1('0x10d')],{});db[_0xbcf1('0x1ff')]['belongsTo'](db['User'],{});db[_0xbcf1('0x10f')][_0xbcf1('0x12b')](db[_0xbcf1('0x10d')],{});db[_0xbcf1('0x10f')][_0xbcf1('0x12b')](db['WhatsappInteraction'],{});db[_0xbcf1('0x10f')][_0xbcf1('0x12b')](db[_0xbcf1('0x109')],{'foreignKey':'FromWhatsappAccountId','as':_0xbcf1('0x1e5')});db['WhatsappTransferReport'][_0xbcf1('0x12b')](db[_0xbcf1('0x109')],{'foreignKey':'ToWhatsappAccountId','as':_0xbcf1('0x1ea')});db['WhatsappTransferReport'][_0xbcf1('0x12b')](db[_0xbcf1('0x111')],{'foreignKey':_0xbcf1('0x200'),'as':_0xbcf1('0x1e9')});db[_0xbcf1('0x10f')][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'foreignKey':_0xbcf1('0x1e6'),'as':'FromAgent'});db[_0xbcf1('0x10f')][_0xbcf1('0x12b')](db[_0xbcf1('0x12')],{'foreignKey':'ToUserId','as':_0xbcf1('0x1e8')});db[_0xbcf1('0x111')][_0xbcf1('0x12d')](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x162'),'through':'UserWhatsappQueue','foreignKey':_0xbcf1('0x201')});db[_0xbcf1('0x111')]['belongsToMany'](db['Team'],{'through':_0xbcf1('0x1de'),'as':_0xbcf1('0x163')});db[_0xbcf1('0x119')]['belongsTo'](db[_0xbcf1('0x12')],{'as':_0xbcf1('0x202'),'foreignKey':_0xbcf1('0x11f'),'onDelete':'cascade','hooks':!![]});db['CloudProvider'][_0xbcf1('0x11b')](db[_0xbcf1('0xcb')],{'as':_0xbcf1('0xcb'),'onDelete':_0xbcf1('0x170')});db[_0xbcf1('0x16e')]['hasOne'](db[_0xbcf1('0x16c')],{'as':'Imap','onDelete':_0xbcf1('0x170')});db[_0xbcf1('0x16e')][_0xbcf1('0x11b')](db[_0xbcf1('0x37')],{'as':'Smtp','onDelete':_0xbcf1('0x170')});module[_0xbcf1('0x203')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x4f80=['JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','../api/campaign/campaign.model','Migration','Attachment','Plugin','MailTransferReport','ChatTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','SenderId','belongsTo','belongsToMany','Groups','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','VoiceChanSpy','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','Trunk','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','Messages','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccount','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Interactions','List','ListId','team_has_mail_queues','MailInteractionId','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','TagId','Items','FaxAccountId','Answers','Exntensions','user_has_fax_accounts','fax_interaction_has_tags','FaxInteractionId','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','Owner','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','UserOpenchannelQueue','team_has_openchannel_queues','ProactiveActions','ChatMessage','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','AttachmentId','team_has_chat_queues','ChatGroupId','Contacts','CompanyId','Phones','CmContactId','cm_contact_has_tags','AdditionalPhones','CmHopperId','Agent','Campaign','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','Action','Actions','ParentId','Intervals','ChatApplications','Schedule','DefaultReportId','Mohs','WhatsappInteraction','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','CustomReportId','AnalyticFieldReport','MetricId','Configurations','AccountId','DescriptionId','FieldId','Subject','SubjectId','Description','Field','VariableId','SugarcrmConfiguration','Subjects','Descriptions','DeskConfiguration','ZohoAccount','ZohoConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowConfiguration','Dynamics365Field','FreshsalesConfiguration','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyProject','ProjectId','user_has_square_projects','VoiceQueues','OpenchannelQueues','WhatsappQueue','team_has_whatsapp_queues','VoicePrefixes','TrunkId','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','BlackLists','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailAccountId','FromChatWebsiteId','FromAgent','ToChatQueueId','ToChatWebsiteId','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToQueue','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','userProfileId','UserProfileSection','Resources','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','UserWhatsappQueue','WhatsappQueueId','user','../config/environment','lodash','jstz','determine','sequelize','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','defaultsDeep','motion2','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','ContactItemType','CmContactHasItem','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model'];(function(_0x38450e,_0x51c4e5){var _0x355a79=function(_0x4c382b){while(--_0x4c382b){_0x38450e['push'](_0x38450e['shift']());}};_0x355a79(++_0x51c4e5);}(_0x4f80,0x126));var _0x04f8=function(_0x4eb517,_0x385479){_0x4eb517=_0x4eb517-0x0;var _0x30e9ed=_0x4f80[_0x4eb517];return _0x30e9ed;};'use strict';var config=require(_0x04f8('0x0'));var Sequelize=require('sequelize');var _=require(_0x04f8('0x1'));var jstz=require(_0x04f8('0x2'));var timezone=jstz[_0x04f8('0x3')]();config['sequelize']=_['defaultsDeep'](config[_0x04f8('0x4')],{'database':'motion2','username':_0x04f8('0x5'),'password':_0x04f8('0x6'),'options':{'host':_0x04f8('0x7'),'port':0xcea,'dialect':_0x04f8('0x8'),'dialectOptions':{'charset':_0x04f8('0x9')},'logging':![],'timezone':timezone[_0x04f8('0xa')](),'define':{'charset':_0x04f8('0xb'),'collate':'utf8_general_ci'}}});config[_0x04f8('0xc')]=_[_0x04f8('0xd')](config['sequelizeHistory'],{'database':_0x04f8('0xe'),'username':_0x04f8('0x5'),'password':_0x04f8('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x04f8('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x04f8('0xa')](),'define':{'charset':_0x04f8('0xb'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x04f8('0xf')],config[_0x04f8('0x4')][_0x04f8('0x10')],config[_0x04f8('0x4')][_0x04f8('0x11')],config[_0x04f8('0x4')][_0x04f8('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x04f8('0xc')][_0x04f8('0xf')],config[_0x04f8('0xc')][_0x04f8('0x10')],config[_0x04f8('0xc')][_0x04f8('0x11')],config['sequelizeHistory'][_0x04f8('0x12')])};db[_0x04f8('0x13')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x15'));db['VoiceChanSpy']=db[_0x04f8('0x4')]['import'](_0x04f8('0x16'));db['VoiceContext']=db[_0x04f8('0x4')]['import']('../api/voiceContext/voiceContext.model');db[_0x04f8('0x17')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x18'));db[_0x04f8('0x19')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x1a'));db[_0x04f8('0x1b')]=db['sequelize'][_0x04f8('0x14')](_0x04f8('0x1c'));db[_0x04f8('0x1d')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/voiceRecording/voiceRecording.model');db[_0x04f8('0x1e')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x1f'));db['VoiceMail']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x20'));db[_0x04f8('0x21')]=db[_0x04f8('0x4')]['import'](_0x04f8('0x22'));db['VoiceCallReport']=db['sequelize'][_0x04f8('0x14')]('../api/voiceCallReport/voiceCallReport.model');db[_0x04f8('0x23')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/voiceDialReport/voiceDialReport.model');db[_0x04f8('0x24')]=db['sequelize'][_0x04f8('0x14')](_0x04f8('0x25'));db[_0x04f8('0x26')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x27'));db[_0x04f8('0x28')]=db[_0x04f8('0x4')]['import'](_0x04f8('0x29'));db['Trunk']=db['sequelize'][_0x04f8('0x14')](_0x04f8('0x2a'));db[_0x04f8('0x2b')]=db['sequelize']['import'](_0x04f8('0x2c'));db[_0x04f8('0x2d')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x2e'));db[_0x04f8('0x2f')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x04f8('0x30')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/userChatQueue/userChatQueue.model');db[_0x04f8('0x31')]=db['sequelize'][_0x04f8('0x14')](_0x04f8('0x32'));db[_0x04f8('0x33')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/userFaxQueue/userFaxQueue.model');db[_0x04f8('0x34')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db['sequelize'][_0x04f8('0x14')](_0x04f8('0x35'));db['UserWhatsappQueue']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x36'));db[_0x04f8('0x37')]=db[_0x04f8('0x4')]['import'](_0x04f8('0x38'));db[_0x04f8('0x39')]=db[_0x04f8('0x4')]['import'](_0x04f8('0x3a'));db['MailAccount']=db['sequelize'][_0x04f8('0x14')](_0x04f8('0x3b'));db[_0x04f8('0x3c')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x3d'));db['MailSubstatus']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x3e'));db['MailInteraction']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x3f'));db[_0x04f8('0x40')]=db[_0x04f8('0x4')]['import'](_0x04f8('0x41'));db[_0x04f8('0x42')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x43'));db[_0x04f8('0x44')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x45'));db[_0x04f8('0x46')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x47'));db['DashboardItem']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x48'));db[_0x04f8('0x49')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x4a'));db[_0x04f8('0x4b')]=db[_0x04f8('0x4')]['import'](_0x04f8('0x4c'));db[_0x04f8('0x4d')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/faxInteraction/faxInteraction.model');db[_0x04f8('0x4e')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x4f'));db[_0x04f8('0x50')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/faxQueue/faxQueue.model');db[_0x04f8('0x51')]=db[_0x04f8('0x4')]['import'](_0x04f8('0x52'));db[_0x04f8('0x53')]=db[_0x04f8('0x4')]['import'](_0x04f8('0x54'));db['SmsApplication']=db[_0x04f8('0x4')]['import'](_0x04f8('0x55'));db[_0x04f8('0x56')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x57'));db[_0x04f8('0x58')]=db[_0x04f8('0x4')]['import'](_0x04f8('0x59'));db[_0x04f8('0x5a')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x5b'));db['OpenchannelAccount']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x5c'));db['OpenchannelApplication']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x5d'));db['OpenchannelInteraction']=db['sequelize'][_0x04f8('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x04f8('0x5e')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x5f'));db['OpenchannelQueue']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x60'));db[_0x04f8('0x61')]=db[_0x04f8('0x4')]['import'](_0x04f8('0x62'));db[_0x04f8('0x63')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x64'));db[_0x04f8('0x65')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/chatApplication/chatApplication.model');db[_0x04f8('0x66')]=db['sequelize']['import']('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/chatMessage/chatMessage.model');db[_0x04f8('0x67')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x68'));db[_0x04f8('0x69')]=db[_0x04f8('0x4')]['import'](_0x04f8('0x6a'));db[_0x04f8('0x6b')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x6c'));db[_0x04f8('0x6d')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x04f8('0x6e')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/cmCompany/cmCompany.model');db[_0x04f8('0x6f')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x70'));db[_0x04f8('0x71')]=db[_0x04f8('0x4')]['import'](_0x04f8('0x72'));db[_0x04f8('0x73')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x04f8('0x74')]=db[_0x04f8('0x4')]['import'](_0x04f8('0x75'));db['CmHopperHistory']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x76'));db[_0x04f8('0x77')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x78'));db[_0x04f8('0x79')]=db[_0x04f8('0x4')]['import'](_0x04f8('0x7a'));db['Action']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x7b'));db[_0x04f8('0x7c')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x7d'));db[_0x04f8('0x7e')]=db['sequelize'][_0x04f8('0x14')](_0x04f8('0x7f'));db[_0x04f8('0x80')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/disposition/disposition.model');db[_0x04f8('0x81')]=db[_0x04f8('0x4')]['import'](_0x04f8('0x82'));db[_0x04f8('0x83')]=db['sequelize'][_0x04f8('0x14')](_0x04f8('0x84'));db[_0x04f8('0x85')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x86'));db[_0x04f8('0x87')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x88'));db[_0x04f8('0x89')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x8a'));db['Schedule']=db['sequelize'][_0x04f8('0x14')](_0x04f8('0x8b'));db[_0x04f8('0x8c')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x8d'));db['Tag']=db[_0x04f8('0x4')]['import']('../api/tag/tag.model');db[_0x04f8('0x8e')]=db[_0x04f8('0x4')]['import']('../api/contactItemType/contactItemType.model');db[_0x04f8('0x8f')]=db['sequelize'][_0x04f8('0x14')]('../api/cmContactHasItem/cmContactHasItem.model');db[_0x04f8('0x90')]=db[_0x04f8('0x4')]['import'](_0x04f8('0x91'));db[_0x04f8('0x92')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/template/template.model');db[_0x04f8('0x93')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x94'));db[_0x04f8('0x95')]=db[_0x04f8('0x4')]['import'](_0x04f8('0x96'));db['Integration']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x97'));db[_0x04f8('0x98')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x99'));db[_0x04f8('0x9a')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x9b'));db[_0x04f8('0x9c')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x04f8('0x9d')]=db['sequelize'][_0x04f8('0x14')](_0x04f8('0x9e'));db[_0x04f8('0x9f')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xa0'));db['AnalyticFieldReport']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xa1'));db[_0x04f8('0xa2')]=db['sequelize']['import'](_0x04f8('0xa3'));db[_0x04f8('0xa4')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xa5'));db[_0x04f8('0xa6')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xa7'));db[_0x04f8('0xa8')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xa9'));db[_0x04f8('0xaa')]=db['sequelize'][_0x04f8('0x14')](_0x04f8('0xab'));db['SugarcrmConfiguration']=db[_0x04f8('0x4')]['import'](_0x04f8('0xac'));db[_0x04f8('0xad')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xae'));db[_0x04f8('0xaf')]=db[_0x04f8('0x4')]['import'](_0x04f8('0xb0'));db['DeskConfiguration']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xb1'));db[_0x04f8('0xb2')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xb3'));db['ZohoConfiguration']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xb4'));db[_0x04f8('0xb5')]=db['sequelize'][_0x04f8('0x14')](_0x04f8('0xb6'));db[_0x04f8('0xb7')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x04f8('0xb8')]=db['sequelize'][_0x04f8('0x14')](_0x04f8('0xb9'));db[_0x04f8('0xba')]=db[_0x04f8('0x4')]['import'](_0x04f8('0xbb'));db['FreshdeskAccount']=db['sequelize'][_0x04f8('0x14')](_0x04f8('0xbc'));db[_0x04f8('0xbd')]=db['sequelize'][_0x04f8('0x14')](_0x04f8('0xbe'));db[_0x04f8('0xbf')]=db[_0x04f8('0x4')]['import'](_0x04f8('0xc0'));db[_0x04f8('0xc1')]=db[_0x04f8('0x4')]['import'](_0x04f8('0xc2'));db['VtigerConfiguration']=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x04f8('0xc3')]=db['sequelize'][_0x04f8('0x14')](_0x04f8('0xc4'));db[_0x04f8('0xc5')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xc6'));db['ServicenowConfiguration']=db[_0x04f8('0x4')]['import'](_0x04f8('0xc7'));db[_0x04f8('0xc8')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/intServicenowField/intServicenowField.model');db[_0x04f8('0xc9')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xca'));db[_0x04f8('0xcb')]=db['sequelize'][_0x04f8('0x14')](_0x04f8('0xcc'));db['Dynamics365Field']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xcd'));db[_0x04f8('0xce')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xcf'));db['FreshsalesConfiguration']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xd0'));db[_0x04f8('0xd1')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xd2'));db[_0x04f8('0xd3')]=db['sequelize']['import']('../api/integration/integration.model');db['Network']=db['sequelize'][_0x04f8('0x14')](_0x04f8('0xd4'));db[_0x04f8('0xd5')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/chatQueueReport/chatQueueReport.model');db[_0x04f8('0xd6')]=db['sequelize'][_0x04f8('0x14')](_0x04f8('0xd7'));db[_0x04f8('0xd8')]=db[_0x04f8('0x4')]['import'](_0x04f8('0xd9'));db['JscriptyQuestionReport']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xda'));db[_0x04f8('0xdb')]=db[_0x04f8('0x4')]['import'](_0x04f8('0xdc'));db[_0x04f8('0xdd')]=db['sequelize'][_0x04f8('0x14')](_0x04f8('0xde'));db['SquareReport']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xdf'));db['SquareDetailsReport']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xe0'));db['JscriptyProject']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xe1'));db[_0x04f8('0xe2')]=db['sequelize']['import']('../api/setting/setting.model');db[_0x04f8('0xe3')]=db[_0x04f8('0x4')]['import'](_0x04f8('0xe4'));db['SquareProject']=db['sequelize']['import'](_0x04f8('0xe5'));db[_0x04f8('0xe6')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xe7'));db[_0x04f8('0xe8')]=db['sequelize'][_0x04f8('0x14')](_0x04f8('0xe9'));db[_0x04f8('0xea')]=db['sequelize']['import']('../api/team/team.model');db[_0x04f8('0xeb')]=db[_0x04f8('0x4')]['import'](_0x04f8('0xec'));db['Campaign']=db['sequelize'][_0x04f8('0x14')](_0x04f8('0xed'));db[_0x04f8('0xee')]=db['sequelize'][_0x04f8('0x14')]('../api/migration/migration.model');db[_0x04f8('0xef')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/attachment/attachment.model');db[_0x04f8('0xf0')]=db['sequelize'][_0x04f8('0x14')]('../api/plugin/plugin.model');db[_0x04f8('0xf1')]=db['sequelize']['import']('../api/mailTransferReport/mailTransferReport.model');db[_0x04f8('0xf2')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xf3'));db[_0x04f8('0xf4')]=db['sequelize'][_0x04f8('0x14')](_0x04f8('0xf5'));db[_0x04f8('0xf6')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xf7'));db[_0x04f8('0xf8')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xf9'));db[_0x04f8('0xfa')]=db['sequelize']['import'](_0x04f8('0xfb'));db[_0x04f8('0xfc')]=db['sequelize']['import'](_0x04f8('0xfd'));db['UserProfileSection']=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/userProfileSection/userProfileSection.model');db[_0x04f8('0xfe')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0xff'));db[_0x04f8('0x100')]=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x101'));db[_0x04f8('0x102')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x103'));db['WhatsappInteraction']=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x04f8('0x104')]=db[_0x04f8('0x4')]['import'](_0x04f8('0x105'));db['WhatsappQueueReport']=db['sequelize'][_0x04f8('0x14')](_0x04f8('0x106'));db['WhatsappTransferReport']=db[_0x04f8('0x4')][_0x04f8('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db['sequelize']['import'](_0x04f8('0x107'));db[_0x04f8('0x108')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x109'));db[_0x04f8('0x10a')]=db[_0x04f8('0x4')]['import']('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x04f8('0x10b')]=db['sequelize'][_0x04f8('0x14')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x04f8('0x10c')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x10d'));db[_0x04f8('0x10e')]=db[_0x04f8('0x4')][_0x04f8('0x14')](_0x04f8('0x10f'));db[_0x04f8('0x13')][_0x04f8('0x110')](db[_0x04f8('0x111')],{'as':_0x04f8('0x111'),'onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x113')});db[_0x04f8('0x13')][_0x04f8('0x110')](db[_0x04f8('0x10e')],{'as':'userSetting','onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x113')});db[_0x04f8('0x13')][_0x04f8('0x114')](db['VoiceRecording'],{'as':_0x04f8('0x115'),'foreignKey':_0x04f8('0x113')});db[_0x04f8('0x13')][_0x04f8('0x114')](db[_0x04f8('0x2d')],{'as':_0x04f8('0x116'),'foreignKey':_0x04f8('0x113')});db[_0x04f8('0x13')][_0x04f8('0x114')](db[_0x04f8('0x17')],{'as':_0x04f8('0x117'),'onDelete':_0x04f8('0x112'),'hooks':!![]});db[_0x04f8('0x13')][_0x04f8('0x114')](db[_0x04f8('0x74')],{'as':_0x04f8('0x118'),'foreignKey':_0x04f8('0x113')});db['User'][_0x04f8('0x114')](db[_0x04f8('0x119')],{'as':'HopperHistory','foreignKey':_0x04f8('0x113')});db[_0x04f8('0x13')][_0x04f8('0x114')](db[_0x04f8('0x77')],{'as':_0x04f8('0x77'),'foreignKey':_0x04f8('0x113')});db[_0x04f8('0x13')][_0x04f8('0x114')](db[_0x04f8('0x11a')],{'as':_0x04f8('0x11b'),'foreignKey':_0x04f8('0x113')});db[_0x04f8('0x13')][_0x04f8('0x114')](db[_0x04f8('0x66')],{'as':_0x04f8('0x11c'),'foreignKey':_0x04f8('0x113')});db[_0x04f8('0x13')][_0x04f8('0x114')](db[_0x04f8('0x56')],{'as':_0x04f8('0x11d'),'foreignKey':_0x04f8('0x113')});db['User'][_0x04f8('0x114')](db['FaxInteraction'],{'as':_0x04f8('0x11e'),'foreignKey':_0x04f8('0x113')});db['User']['hasMany'](db[_0x04f8('0x11f')],{'as':'MailInteractions','foreignKey':_0x04f8('0x113')});db[_0x04f8('0x13')]['hasMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0x04f8('0x113')});db[_0x04f8('0x13')]['hasMany'](db[_0x04f8('0x100')],{'as':'UserNotifications','foreignKey':_0x04f8('0x120')});db[_0x04f8('0x13')][_0x04f8('0x121')](db[_0x04f8('0xfc')],{'as':_0x04f8('0xfc'),'foreignKey':'userProfileId'});db[_0x04f8('0x13')][_0x04f8('0x122')](db[_0x04f8('0x6b')],{'as':_0x04f8('0x123'),'through':'chat_group_has_users'});db[_0x04f8('0x13')][_0x04f8('0x122')](db['CmContact'],{'as':'Contacts','through':_0x04f8('0x124')});db[_0x04f8('0x13')]['belongsToMany'](db[_0x04f8('0xf8')],{'as':_0x04f8('0x125'),'through':_0x04f8('0x126')});db[_0x04f8('0x13')][_0x04f8('0x122')](db[_0x04f8('0xea')],{'through':_0x04f8('0x127')});db[_0x04f8('0x13')][_0x04f8('0x122')](db['MailInteraction'],{'as':_0x04f8('0x128'),'through':_0x04f8('0x129')});db[_0x04f8('0x13')][_0x04f8('0x122')](db['ChatInteraction'],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db['User'][_0x04f8('0x122')](db['FaxInteraction'],{'as':_0x04f8('0x11e'),'through':'user_has_fax_interactions'});db[_0x04f8('0x13')][_0x04f8('0x122')](db[_0x04f8('0x56')],{'as':_0x04f8('0x11d'),'through':_0x04f8('0x12a')});db[_0x04f8('0x13')]['belongsToMany'](db[_0x04f8('0x11a')],{'as':'OpenchannelInteractions','through':_0x04f8('0x12b')});db[_0x04f8('0x13')][_0x04f8('0x122')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0x04f8('0x12c')});db[_0x04f8('0x13')]['belongsToMany'](db[_0x04f8('0x1b')],{'as':'VoiceQueues','through':_0x04f8('0x2f'),'required':![]});db[_0x04f8('0x13')]['belongsToMany'](db[_0x04f8('0xfa')],{'as':'VoicePrefixes','through':'UserVoicePrefix','required':![]});db[_0x04f8('0x13')][_0x04f8('0x122')](db[_0x04f8('0x3c')],{'as':'MailQueues','through':'UserMailQueue','required':![]});db[_0x04f8('0x13')][_0x04f8('0x122')](db['ChatQueue'],{'as':_0x04f8('0x12d'),'through':_0x04f8('0x30'),'required':![],'hooks':!![]});db[_0x04f8('0x13')]['belongsToMany'](db[_0x04f8('0x50')],{'as':_0x04f8('0x12e'),'through':'UserFaxQueue','required':![]});db[_0x04f8('0x13')]['belongsToMany'](db[_0x04f8('0x5a')],{'as':_0x04f8('0x12f'),'through':_0x04f8('0x34'),'required':![]});db['User'][_0x04f8('0x122')](db[_0x04f8('0x130')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0x04f8('0x13')][_0x04f8('0x122')](db['WhatsappQueue'],{'as':_0x04f8('0x131'),'through':'UserWhatsappQueue','required':![]});db[_0x04f8('0x13')]['belongsToMany'](db[_0x04f8('0xf8')],{'through':_0x04f8('0x126')});db['User'][_0x04f8('0x122')](db[_0x04f8('0x61')],{'as':_0x04f8('0x132'),'through':_0x04f8('0x133')});db[_0x04f8('0x13')][_0x04f8('0x122')](db[_0x04f8('0x49')],{'as':_0x04f8('0x134'),'through':'user_has_fax_accounts'});db['User'][_0x04f8('0x122')](db['MailAccount'],{'as':_0x04f8('0x135'),'through':_0x04f8('0x136')});db[_0x04f8('0x13')][_0x04f8('0x122')](db[_0x04f8('0x137')],{'as':'OpenchannelAccounts','through':_0x04f8('0x138')});db[_0x04f8('0x13')]['belongsToMany'](db[_0x04f8('0x53')],{'as':_0x04f8('0x139'),'through':_0x04f8('0x13a')});db[_0x04f8('0x13')][_0x04f8('0x122')](db[_0x04f8('0x13b')],{'as':_0x04f8('0x13c'),'through':_0x04f8('0x13d')});db['User'][_0x04f8('0x122')](db[_0x04f8('0x13e')],{'as':_0x04f8('0x13f'),'through':'user_has_square_projects'});db[_0x04f8('0x140')]['hasMany'](db[_0x04f8('0x17')],{'as':_0x04f8('0x141'),'onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x142')});db[_0x04f8('0x143')][_0x04f8('0x114')](db['VoiceExtension'],{'onDelete':_0x04f8('0x112')});db[_0x04f8('0x17')][_0x04f8('0x114')](db[_0x04f8('0x17')],{'as':_0x04f8('0x144'),'onDelete':_0x04f8('0x112')});db[_0x04f8('0x19')]['belongsToMany'](db[_0x04f8('0x8c')],{'as':_0x04f8('0x145'),'through':_0x04f8('0x146')});db[_0x04f8('0x1b')][_0x04f8('0x114')](db[_0x04f8('0x2d')],{'as':_0x04f8('0x147'),'foreignKey':_0x04f8('0x148')});db[_0x04f8('0x1b')]['hasMany'](db[_0x04f8('0x71')],{'as':_0x04f8('0x149'),'foreignKey':'VoiceQueueId'});db[_0x04f8('0x1b')]['hasMany'](db[_0x04f8('0x74')],{'as':_0x04f8('0x118'),'foreignKey':_0x04f8('0x148')});db[_0x04f8('0x1b')][_0x04f8('0x114')](db[_0x04f8('0x119')],{'as':_0x04f8('0x14a'),'foreignKey':'VoiceQueueId'});db[_0x04f8('0x1b')][_0x04f8('0x114')](db['ReportAgentPreview'],{'as':_0x04f8('0x77'),'foreignKey':_0x04f8('0x148')});db[_0x04f8('0x1b')][_0x04f8('0x114')](db[_0x04f8('0x73')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0x04f8('0x1b')][_0x04f8('0x114')](db[_0x04f8('0xdb')],{'as':_0x04f8('0x14b'),'foreignKey':_0x04f8('0x148')});db['VoiceQueue'][_0x04f8('0x121')](db[_0x04f8('0x14c')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x04f8('0x1b')][_0x04f8('0x121')](db[_0x04f8('0x14c')],{'as':_0x04f8('0x14d'),'foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0x04f8('0x121')](db[_0x04f8('0x83')],{'as':'Interval','foreignKey':_0x04f8('0x14e')});db['VoiceQueue']['belongsTo'](db['Pause'],{'as':_0x04f8('0x14f'),'foreignKey':_0x04f8('0x150')});db[_0x04f8('0x1b')][_0x04f8('0x122')](db[_0x04f8('0xf8')],{'as':_0x04f8('0x125'),'through':_0x04f8('0x151')});db[_0x04f8('0x1b')][_0x04f8('0x122')](db['User'],{'as':_0x04f8('0x152'),'through':_0x04f8('0x2f')});db['VoiceQueue'][_0x04f8('0x122')](db[_0x04f8('0xea')],{'as':_0x04f8('0x153'),'through':_0x04f8('0x10a')});db[_0x04f8('0x1b')]['belongsToMany'](db[_0x04f8('0xf8')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0x04f8('0x1d')][_0x04f8('0x121')](db['User'],{'as':_0x04f8('0x13'),'foreignKey':'UserId'});db[_0x04f8('0x1e')]['belongsTo'](db['User'],{'as':_0x04f8('0x13'),'foreignKey':_0x04f8('0x113')});db[_0x04f8('0x111')][_0x04f8('0x114')](db['VoiceMailMessage'],{'as':_0x04f8('0x154'),'onDelete':'cascade','foreignKey':_0x04f8('0x155'),'sourceKey':'mailbox'});db[_0x04f8('0x21')]['belongsTo'](db[_0x04f8('0x111')],{'foreignKey':_0x04f8('0x155'),'targetKey':'mailbox'});db[_0x04f8('0x156')][_0x04f8('0x114')](db[_0x04f8('0x26')],{'as':_0x04f8('0x157'),'foreignKey':_0x04f8('0x158'),'constraints':![]});db['VoiceCallReport'][_0x04f8('0x114')](db['VoiceAgentReport'],{'as':_0x04f8('0x159'),'foreignKey':_0x04f8('0x158'),'constraints':![]});db[_0x04f8('0x156')]['belongsTo'](db['User'],{'as':_0x04f8('0x13'),'foreignKey':'UserId'});db[_0x04f8('0x156')][_0x04f8('0x121')](db[_0x04f8('0x6f')],{'as':_0x04f8('0x15a'),'foreignKey':_0x04f8('0x15b')});db[_0x04f8('0x37')][_0x04f8('0x121')](db[_0x04f8('0x15c')],{'as':'MailAccount','foreignKey':_0x04f8('0x15d')});db['MailServerIn'][_0x04f8('0x121')](db['CloudProvider'],{'as':_0x04f8('0x108'),'foreignKey':_0x04f8('0x15e'),'onDelete':_0x04f8('0x15f')});db['MailServerOut'][_0x04f8('0x121')](db[_0x04f8('0x15c')],{'as':'MailAccount','foreignKey':_0x04f8('0x15d')});db[_0x04f8('0x39')][_0x04f8('0x121')](db[_0x04f8('0x108')],{'as':_0x04f8('0x108'),'foreignKey':_0x04f8('0x15e'),'onDelete':_0x04f8('0x15f')});db[_0x04f8('0x15c')]['hasOne'](db[_0x04f8('0x37')],{'as':_0x04f8('0x160'),'onDelete':_0x04f8('0x112')});db['MailAccount']['hasOne'](db['MailServerOut'],{'as':_0x04f8('0x161'),'onDelete':_0x04f8('0x112')});db['MailAccount'][_0x04f8('0x114')](db[_0x04f8('0x80')],{'as':_0x04f8('0x162'),'foreignKey':'MailAccountId','onDelete':'cascade'});db[_0x04f8('0x15c')][_0x04f8('0x114')](db[_0x04f8('0x7e')],{'as':'Answers','foreignKey':_0x04f8('0x15d')});db[_0x04f8('0x15c')]['hasMany'](db[_0x04f8('0x40')],{'as':'Messages','foreignKey':_0x04f8('0x15d')});db[_0x04f8('0x15c')][_0x04f8('0x114')](db['MailInteraction'],{'as':_0x04f8('0x163')});db[_0x04f8('0x15c')][_0x04f8('0x114')](db[_0x04f8('0x42')],{'as':_0x04f8('0x144')});db[_0x04f8('0x15c')]['belongsTo'](db[_0x04f8('0xf8')],{'as':_0x04f8('0x164'),'foreignKey':_0x04f8('0x165')});db['MailAccount'][_0x04f8('0x121')](db[_0x04f8('0x92')],{'as':_0x04f8('0x92'),'foreignKey':'TemplateId'});db[_0x04f8('0x15c')][_0x04f8('0x121')](db[_0x04f8('0x85')],{'as':_0x04f8('0x14f'),'foreignKey':_0x04f8('0x150')});db['MailAccount'][_0x04f8('0x122')](db[_0x04f8('0x13')],{'as':_0x04f8('0x152'),'through':_0x04f8('0x136')});db[_0x04f8('0x3c')][_0x04f8('0x122')](db[_0x04f8('0x13')],{'as':_0x04f8('0x152'),'through':_0x04f8('0x31')});db[_0x04f8('0x3c')]['belongsToMany'](db[_0x04f8('0xea')],{'through':_0x04f8('0x166'),'as':_0x04f8('0x153')});db['MailInteraction'][_0x04f8('0x114')](db[_0x04f8('0x40')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x04f8('0x167')});db['MailInteraction'][_0x04f8('0x121')](db[_0x04f8('0x15c')],{'as':'Account','foreignKey':_0x04f8('0x15d')});db[_0x04f8('0x11f')][_0x04f8('0x121')](db[_0x04f8('0x6f')],{'as':'Contact','foreignKey':_0x04f8('0x15b')});db[_0x04f8('0x11f')][_0x04f8('0x121')](db[_0x04f8('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0x04f8('0x11f')][_0x04f8('0x122')](db[_0x04f8('0x168')],{'through':_0x04f8('0x169'),'as':_0x04f8('0x16a')});db[_0x04f8('0x11f')]['belongsToMany'](db[_0x04f8('0x168')],{'through':_0x04f8('0x169'),'as':_0x04f8('0x16b')});db['MailInteraction'][_0x04f8('0x122')](db[_0x04f8('0x13')],{'as':_0x04f8('0x16c'),'through':_0x04f8('0x129'),'foreignKey':_0x04f8('0x167')});db[_0x04f8('0x40')][_0x04f8('0x114')](db[_0x04f8('0xef')],{'as':_0x04f8('0x16d'),'onDelete':_0x04f8('0x112')});db[_0x04f8('0x40')][_0x04f8('0x121')](db[_0x04f8('0x13')],{'as':'User'});db[_0x04f8('0x40')][_0x04f8('0x121')](db[_0x04f8('0x6f')],{'onDelete':_0x04f8('0x112'),'as':_0x04f8('0x15a')});db[_0x04f8('0x40')]['belongsTo'](db['MailInteraction'],{'as':_0x04f8('0x16e'),'foreignKey':'MailInteractionId'});db[_0x04f8('0x40')][_0x04f8('0x121')](db[_0x04f8('0x15c')],{'as':_0x04f8('0x16f'),'foreignKey':_0x04f8('0x15d')});db[_0x04f8('0x40')][_0x04f8('0x121')](db[_0x04f8('0x61')],{'as':_0x04f8('0x61'),'foreignKey':_0x04f8('0x170')});db[_0x04f8('0x40')]['belongsTo'](db[_0x04f8('0x67')],{'as':'ChatOfflineMessage','foreignKey':_0x04f8('0x171')});db['MailApplication']['belongsTo'](db[_0x04f8('0x13')],{'onDelete':_0x04f8('0x15f')});db[_0x04f8('0x42')][_0x04f8('0x121')](db[_0x04f8('0x3c')],{'onDelete':_0x04f8('0x15f')});db['MailApplication'][_0x04f8('0x121')](db[_0x04f8('0x15c')],{'onDelete':'restrict'});db[_0x04f8('0x42')][_0x04f8('0x121')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x04f8('0x42')][_0x04f8('0x121')](db[_0x04f8('0x168')],{'onDelete':_0x04f8('0x15f'),'foreignKey':_0x04f8('0x172')});db[_0x04f8('0x44')][_0x04f8('0x121')](db['MailAccount'],{});db[_0x04f8('0x44')]['belongsTo'](db[_0x04f8('0xf8')],{'as':_0x04f8('0x164'),'foreignKey':'ListId'});db[_0x04f8('0x44')][_0x04f8('0x121')](db['CmContact'],{'as':_0x04f8('0x15a'),'foreignKey':_0x04f8('0x15b')});db[_0x04f8('0x44')][_0x04f8('0x121')](db[_0x04f8('0x11f')],{});db[_0x04f8('0x44')][_0x04f8('0x121')](db[_0x04f8('0x40')],{});db[_0x04f8('0x44')]['belongsTo'](db['User'],{});db[_0x04f8('0x44')][_0x04f8('0x121')](db[_0x04f8('0x3c')],{});db[_0x04f8('0x46')][_0x04f8('0x114')](db['DashboardItem'],{'as':_0x04f8('0x173'),'onDelete':_0x04f8('0x112')});db[_0x04f8('0x49')]['hasMany'](db['Disposition'],{'as':_0x04f8('0x162'),'foreignKey':_0x04f8('0x174'),'onDelete':_0x04f8('0x112')});db[_0x04f8('0x49')][_0x04f8('0x114')](db['CannedAnswer'],{'as':_0x04f8('0x175'),'foreignKey':'FaxAccountId'});db[_0x04f8('0x49')][_0x04f8('0x114')](db[_0x04f8('0x4d')],{'as':_0x04f8('0x163')});db['FaxAccount'][_0x04f8('0x114')](db['FaxApplication'],{'as':_0x04f8('0x144')});db[_0x04f8('0x49')][_0x04f8('0x114')](db['VoiceExtension'],{'as':_0x04f8('0x176'),'onDelete':'cascade'});db[_0x04f8('0x49')][_0x04f8('0x114')](db[_0x04f8('0x4e')],{'as':'Messages'});db[_0x04f8('0x49')]['belongsTo'](db[_0x04f8('0x14c')],{'as':_0x04f8('0x14c')});db['FaxAccount'][_0x04f8('0x121')](db[_0x04f8('0xf8')],{'as':'List','foreignKey':_0x04f8('0x165')});db[_0x04f8('0x49')][_0x04f8('0x121')](db[_0x04f8('0x85')],{'as':_0x04f8('0x14f'),'foreignKey':_0x04f8('0x150')});db[_0x04f8('0x49')][_0x04f8('0x122')](db['User'],{'as':'Agents','through':_0x04f8('0x177')});db['FaxApplication']['belongsTo'](db['User'],{'onDelete':'restrict'});db['FaxApplication'][_0x04f8('0x121')](db['FaxQueue'],{'onDelete':_0x04f8('0x15f')});db[_0x04f8('0x4b')][_0x04f8('0x121')](db['FaxAccount'],{'onDelete':_0x04f8('0x15f')});db[_0x04f8('0x4b')][_0x04f8('0x121')](db[_0x04f8('0x168')],{'onDelete':_0x04f8('0x15f'),'foreignKey':'TagId'});db['FaxInteraction'][_0x04f8('0x114')](db[_0x04f8('0x4e')],{'as':_0x04f8('0x154'),'onDelete':_0x04f8('0x112'),'foreignKey':'FaxInteractionId'});db[_0x04f8('0x4d')][_0x04f8('0x121')](db[_0x04f8('0x49')],{'as':_0x04f8('0x16f'),'foreignKey':_0x04f8('0x174')});db[_0x04f8('0x4d')][_0x04f8('0x121')](db['CmContact'],{'as':_0x04f8('0x15a'),'foreignKey':'ContactId'});db['FaxInteraction']['belongsTo'](db[_0x04f8('0x13')],{'as':'Owner','foreignKey':_0x04f8('0x113')});db[_0x04f8('0x4d')][_0x04f8('0x122')](db[_0x04f8('0x168')],{'through':_0x04f8('0x178'),'as':_0x04f8('0x16a')});db[_0x04f8('0x4d')][_0x04f8('0x122')](db['Tag'],{'through':_0x04f8('0x178'),'as':_0x04f8('0x16b')});db[_0x04f8('0x4d')]['belongsToMany'](db[_0x04f8('0x13')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0x04f8('0x179')});db[_0x04f8('0x4e')]['belongsTo'](db[_0x04f8('0x13')],{'onDelete':_0x04f8('0x112'),'as':_0x04f8('0x13')});db[_0x04f8('0x4e')]['belongsTo'](db[_0x04f8('0x4d')],{'as':_0x04f8('0x16e'),'foreignKey':_0x04f8('0x179')});db[_0x04f8('0x4e')]['belongsTo'](db[_0x04f8('0x6f')],{'onDelete':_0x04f8('0x112'),'as':_0x04f8('0x15a')});db['FaxMessage'][_0x04f8('0x121')](db[_0x04f8('0xef')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x04f8('0x4e')][_0x04f8('0x121')](db[_0x04f8('0x49')],{'as':_0x04f8('0x16f'),'foreignKey':'FaxAccountId'});db[_0x04f8('0x50')][_0x04f8('0x122')](db[_0x04f8('0x13')],{'as':_0x04f8('0x152'),'through':_0x04f8('0x33')});db[_0x04f8('0x50')][_0x04f8('0x122')](db[_0x04f8('0xea')],{'through':_0x04f8('0x17a'),'as':_0x04f8('0x153')});db[_0x04f8('0x51')][_0x04f8('0x121')](db[_0x04f8('0x49')],{});db[_0x04f8('0x51')][_0x04f8('0x121')](db[_0x04f8('0xf8')],{'as':'List','foreignKey':_0x04f8('0x165')});db[_0x04f8('0x51')][_0x04f8('0x121')](db[_0x04f8('0x6f')],{'as':_0x04f8('0x15a'),'foreignKey':_0x04f8('0x15b')});db[_0x04f8('0x51')]['belongsTo'](db['FaxInteraction'],{});db[_0x04f8('0x51')][_0x04f8('0x121')](db[_0x04f8('0x4e')],{});db['FaxQueueReport'][_0x04f8('0x121')](db[_0x04f8('0x13')],{});db[_0x04f8('0x51')][_0x04f8('0x121')](db[_0x04f8('0x50')],{});db[_0x04f8('0x53')]['hasMany'](db[_0x04f8('0x80')],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':_0x04f8('0x112')});db[_0x04f8('0x53')][_0x04f8('0x114')](db[_0x04f8('0x7e')],{'as':_0x04f8('0x175'),'foreignKey':'SmsAccountId'});db[_0x04f8('0x53')][_0x04f8('0x114')](db[_0x04f8('0x58')],{'as':_0x04f8('0x154'),'foreignKey':_0x04f8('0x17b')});db[_0x04f8('0x53')][_0x04f8('0x114')](db['SmsInteraction'],{'as':_0x04f8('0x163')});db['SmsAccount'][_0x04f8('0x114')](db['SmsApplication'],{'as':_0x04f8('0x144')});db['SmsAccount'][_0x04f8('0x121')](db[_0x04f8('0xf8')],{'as':_0x04f8('0x164'),'foreignKey':_0x04f8('0x165')});db[_0x04f8('0x53')][_0x04f8('0x121')](db[_0x04f8('0x85')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x04f8('0x53')][_0x04f8('0x122')](db[_0x04f8('0x13')],{'as':_0x04f8('0x152'),'through':_0x04f8('0x13a')});db[_0x04f8('0x17c')]['belongsTo'](db[_0x04f8('0x13')],{'onDelete':_0x04f8('0x15f')});db[_0x04f8('0x17c')][_0x04f8('0x121')](db[_0x04f8('0x5a')],{'onDelete':'restrict'});db[_0x04f8('0x17c')]['belongsTo'](db[_0x04f8('0x53')],{'onDelete':_0x04f8('0x15f')});db[_0x04f8('0x17c')][_0x04f8('0x121')](db[_0x04f8('0x83')],{'onDelete':_0x04f8('0x15f'),'foreignKey':_0x04f8('0x14e')});db[_0x04f8('0x17c')][_0x04f8('0x121')](db[_0x04f8('0x168')],{'onDelete':_0x04f8('0x15f'),'foreignKey':_0x04f8('0x172')});db[_0x04f8('0x56')][_0x04f8('0x114')](db[_0x04f8('0x58')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x04f8('0x17d')});db[_0x04f8('0x56')]['belongsTo'](db[_0x04f8('0x53')],{'as':_0x04f8('0x16f'),'foreignKey':'SmsAccountId'});db['SmsInteraction'][_0x04f8('0x121')](db[_0x04f8('0x6f')],{'as':_0x04f8('0x15a'),'foreignKey':'ContactId'});db[_0x04f8('0x56')]['belongsTo'](db[_0x04f8('0x13')],{'as':_0x04f8('0x17e'),'foreignKey':_0x04f8('0x113')});db['SmsInteraction'][_0x04f8('0x122')](db[_0x04f8('0x168')],{'through':_0x04f8('0x17f'),'as':_0x04f8('0x16a')});db['SmsInteraction'][_0x04f8('0x122')](db[_0x04f8('0x168')],{'through':_0x04f8('0x17f'),'as':_0x04f8('0x16b')});db[_0x04f8('0x56')][_0x04f8('0x122')](db[_0x04f8('0x13')],{'as':_0x04f8('0x16c'),'through':_0x04f8('0x12a'),'foreignKey':_0x04f8('0x17d')});db[_0x04f8('0x58')]['belongsTo'](db[_0x04f8('0x13')],{'as':_0x04f8('0x13')});db[_0x04f8('0x58')][_0x04f8('0x121')](db[_0x04f8('0x6f')],{'onDelete':'cascade','as':'Contact'});db[_0x04f8('0x58')][_0x04f8('0x121')](db[_0x04f8('0x56')],{'onDelete':_0x04f8('0x112'),'as':_0x04f8('0x16e'),'foreignKey':_0x04f8('0x17d')});db['SmsMessage'][_0x04f8('0x121')](db[_0x04f8('0x53')],{'as':_0x04f8('0x16f'),'foreignKey':'SmsAccountId'});db[_0x04f8('0x5a')][_0x04f8('0x122')](db['User'],{'as':_0x04f8('0x152'),'through':_0x04f8('0x34'),'foreignKey':'SmsQueueId'});db[_0x04f8('0x5a')][_0x04f8('0x122')](db[_0x04f8('0xea')],{'through':_0x04f8('0x180'),'as':'Teams'});db[_0x04f8('0x137')]['hasMany'](db[_0x04f8('0x80')],{'as':_0x04f8('0x162'),'foreignKey':_0x04f8('0x181'),'onDelete':_0x04f8('0x112')});db[_0x04f8('0x137')][_0x04f8('0x114')](db['CannedAnswer'],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0x04f8('0x137')][_0x04f8('0x114')](db[_0x04f8('0x11a')],{'as':'Interactions','foreignKey':_0x04f8('0x181')});db[_0x04f8('0x137')][_0x04f8('0x114')](db[_0x04f8('0x5e')],{'as':_0x04f8('0x154'),'foreignKey':_0x04f8('0x181')});db[_0x04f8('0x137')][_0x04f8('0x114')](db[_0x04f8('0x182')],{'as':_0x04f8('0x144'),'foreignKey':_0x04f8('0x181')});db[_0x04f8('0x137')][_0x04f8('0x121')](db[_0x04f8('0xf8')],{'as':_0x04f8('0x164'),'foreignKey':_0x04f8('0x165')});db[_0x04f8('0x137')][_0x04f8('0x121')](db[_0x04f8('0x85')],{'as':_0x04f8('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0x04f8('0x122')](db[_0x04f8('0x13')],{'as':_0x04f8('0x152'),'through':_0x04f8('0x138')});db[_0x04f8('0x182')][_0x04f8('0x121')](db[_0x04f8('0x13')],{'onDelete':_0x04f8('0x15f')});db[_0x04f8('0x182')][_0x04f8('0x121')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x04f8('0x183')});db[_0x04f8('0x182')]['belongsTo'](db[_0x04f8('0x137')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0x04f8('0x182')]['belongsTo'](db[_0x04f8('0x83')],{'onDelete':'restrict','foreignKey':_0x04f8('0x14e')});db['OpenchannelApplication']['belongsTo'](db[_0x04f8('0x168')],{'onDelete':_0x04f8('0x15f'),'foreignKey':_0x04f8('0x172')});db[_0x04f8('0x11a')][_0x04f8('0x114')](db[_0x04f8('0x5e')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x04f8('0x184')});db['OpenchannelInteraction'][_0x04f8('0x121')](db['OpenchannelAccount'],{'as':_0x04f8('0x16f'),'foreignKey':_0x04f8('0x181')});db[_0x04f8('0x11a')][_0x04f8('0x121')](db['CmContact'],{'as':_0x04f8('0x15a'),'foreignKey':'ContactId'});db[_0x04f8('0x11a')][_0x04f8('0x121')](db[_0x04f8('0x13')],{'as':_0x04f8('0x17e'),'foreignKey':_0x04f8('0x113')});db[_0x04f8('0x11a')][_0x04f8('0x122')](db[_0x04f8('0x168')],{'through':_0x04f8('0x185'),'as':_0x04f8('0x16a')});db[_0x04f8('0x11a')][_0x04f8('0x122')](db[_0x04f8('0x168')],{'through':'openchannel_interaction_has_tags','as':_0x04f8('0x16b')});db[_0x04f8('0x11a')][_0x04f8('0x122')](db[_0x04f8('0x13')],{'as':_0x04f8('0x16c'),'through':_0x04f8('0x12b'),'foreignKey':'OpenchannelInteractionId'});db[_0x04f8('0x5e')][_0x04f8('0x121')](db[_0x04f8('0x13')],{'onDelete':'cascade','as':_0x04f8('0x13')});db[_0x04f8('0x5e')][_0x04f8('0x121')](db['CmContact'],{'onDelete':'cascade','as':_0x04f8('0x15a')});db[_0x04f8('0x5e')][_0x04f8('0x121')](db['OpenchannelInteraction'],{'onDelete':_0x04f8('0x112'),'as':_0x04f8('0x16e'),'foreignKey':'OpenchannelInteractionId'});db[_0x04f8('0x5e')][_0x04f8('0x121')](db[_0x04f8('0xef')],{'as':_0x04f8('0xef'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x04f8('0x121')](db[_0x04f8('0x137')],{'as':_0x04f8('0x16f'),'foreignKey':_0x04f8('0x181')});db['OpenchannelQueue']['belongsToMany'](db[_0x04f8('0x13')],{'as':_0x04f8('0x152'),'through':_0x04f8('0x186'),'foreignKey':_0x04f8('0x183')});db[_0x04f8('0x130')][_0x04f8('0x122')](db[_0x04f8('0xea')],{'through':_0x04f8('0x187'),'as':_0x04f8('0x153')});db[_0x04f8('0x61')][_0x04f8('0x114')](db[_0x04f8('0x80')],{'as':'Dispositions','foreignKey':_0x04f8('0x170'),'onDelete':_0x04f8('0x112')});db['ChatWebsite'][_0x04f8('0x114')](db[_0x04f8('0x7e')],{'as':_0x04f8('0x175'),'foreignKey':_0x04f8('0x170')});db[_0x04f8('0x61')][_0x04f8('0x114')](db[_0x04f8('0x6d')],{'as':_0x04f8('0x188')});db[_0x04f8('0x61')][_0x04f8('0x114')](db[_0x04f8('0x66')],{'as':_0x04f8('0x163')});db[_0x04f8('0x61')][_0x04f8('0x114')](db[_0x04f8('0x65')],{'as':'Applications'});db['ChatWebsite']['hasMany'](db[_0x04f8('0x189')],{'as':_0x04f8('0x154')});db[_0x04f8('0x61')]['belongsTo'](db[_0x04f8('0xf8')],{'as':'List','foreignKey':_0x04f8('0x165')});db[_0x04f8('0x61')][_0x04f8('0x121')](db[_0x04f8('0x83')],{'as':_0x04f8('0x83'),'foreignKey':'IntervalId'});db['ChatWebsite']['belongsTo'](db[_0x04f8('0x15c')],{'as':'MailAccount','foreignKey':_0x04f8('0x15d')});db[_0x04f8('0x61')][_0x04f8('0x121')](db[_0x04f8('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0x04f8('0x150')});db[_0x04f8('0x61')][_0x04f8('0x122')](db[_0x04f8('0x13')],{'as':_0x04f8('0x152'),'through':'user_has_chat_websites'});db[_0x04f8('0x63')]['belongsTo'](db[_0x04f8('0x137')],{});db[_0x04f8('0x63')][_0x04f8('0x121')](db[_0x04f8('0xf8')],{'as':_0x04f8('0x164'),'foreignKey':_0x04f8('0x165')});db[_0x04f8('0x63')][_0x04f8('0x121')](db[_0x04f8('0x6f')],{'as':_0x04f8('0x15a'),'foreignKey':_0x04f8('0x15b')});db[_0x04f8('0x63')][_0x04f8('0x121')](db['OpenchannelInteraction'],{});db[_0x04f8('0x63')][_0x04f8('0x121')](db[_0x04f8('0x5e')],{});db[_0x04f8('0x63')][_0x04f8('0x121')](db['User'],{});db[_0x04f8('0x63')][_0x04f8('0x121')](db[_0x04f8('0x130')],{});db[_0x04f8('0x65')][_0x04f8('0x121')](db[_0x04f8('0x13')],{'as':'Agent','foreignKey':_0x04f8('0x113'),'onDelete':'restrict'});db[_0x04f8('0x65')]['belongsTo'](db['ChatQueue'],{'as':_0x04f8('0x18a'),'foreignKey':_0x04f8('0x18b'),'onDelete':'restrict'});db[_0x04f8('0x65')][_0x04f8('0x121')](db[_0x04f8('0x61')],{'as':_0x04f8('0x18c'),'foreignKey':'ChatWebsiteId','onDelete':_0x04f8('0x15f')});db[_0x04f8('0x65')][_0x04f8('0x121')](db[_0x04f8('0x168')],{'onDelete':_0x04f8('0x15f'),'foreignKey':_0x04f8('0x172')});db[_0x04f8('0x66')][_0x04f8('0x114')](db[_0x04f8('0x189')],{'as':_0x04f8('0x154'),'onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x18d')});db[_0x04f8('0x66')][_0x04f8('0x121')](db[_0x04f8('0x61')],{'as':_0x04f8('0x16f'),'foreignKey':'ChatWebsiteId'});db[_0x04f8('0x66')]['belongsTo'](db['CmContact'],{'as':_0x04f8('0x15a'),'foreignKey':_0x04f8('0x15b')});db[_0x04f8('0x66')]['belongsTo'](db[_0x04f8('0x13')],{'as':_0x04f8('0x17e'),'foreignKey':'UserId'});db[_0x04f8('0x66')][_0x04f8('0x122')](db[_0x04f8('0x168')],{'through':_0x04f8('0x18e'),'as':_0x04f8('0x16a')});db[_0x04f8('0x66')][_0x04f8('0x122')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x04f8('0x16b')});db[_0x04f8('0x66')]['belongsToMany'](db['User'],{'as':_0x04f8('0x16c'),'through':_0x04f8('0x18f'),'foreignKey':_0x04f8('0x18d')});db[_0x04f8('0x189')][_0x04f8('0x121')](db[_0x04f8('0x13')],{'onDelete':_0x04f8('0x112'),'as':_0x04f8('0x13')});db[_0x04f8('0x189')][_0x04f8('0x121')](db[_0x04f8('0x6f')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x04f8('0x15b')});db['ChatMessage'][_0x04f8('0x121')](db['ChatInteraction'],{'onDelete':_0x04f8('0x112'),'as':'Interaction','foreignKey':_0x04f8('0x18d')});db[_0x04f8('0x189')]['belongsTo'](db['Attachment'],{'as':_0x04f8('0xef'),'foreignKey':_0x04f8('0x190')});db['ChatMessage'][_0x04f8('0x121')](db[_0x04f8('0x61')],{'as':_0x04f8('0x16f'),'foreignKey':'ChatWebsiteId'});db[_0x04f8('0x67')]['hasMany'](db[_0x04f8('0xef')],{'as':_0x04f8('0x16d'),'foreignKey':_0x04f8('0x171'),'onDelete':_0x04f8('0x112'),'hooks':!![]});db[_0x04f8('0x67')]['belongsTo'](db[_0x04f8('0x6f')],{'onDelete':_0x04f8('0x112'),'as':_0x04f8('0x15a'),'foreignKey':_0x04f8('0x15b')});db['ChatOfflineMessage'][_0x04f8('0x121')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x04f8('0x170')});db[_0x04f8('0x69')][_0x04f8('0x122')](db[_0x04f8('0x13')],{'as':_0x04f8('0x152'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0x04f8('0x122')](db[_0x04f8('0xea')],{'through':_0x04f8('0x191'),'as':'Teams'});db['ChatGroup']['hasMany'](db[_0x04f8('0xd6')],{'as':_0x04f8('0x154'),'foreignKey':_0x04f8('0x192'),'onDelete':_0x04f8('0x112')});db[_0x04f8('0x6b')]['belongsToMany'](db['User'],{'as':_0x04f8('0x147'),'through':'chat_group_has_users'});db[_0x04f8('0x6d')][_0x04f8('0x121')](db[_0x04f8('0x61')],{'as':_0x04f8('0x18c'),'foreignKey':_0x04f8('0x170')});db[_0x04f8('0x6e')]['hasMany'](db[_0x04f8('0x6f')],{'as':_0x04f8('0x193'),'foreignKey':_0x04f8('0x194')});db[_0x04f8('0x6f')][_0x04f8('0x114')](db[_0x04f8('0x8f')],{'as':_0x04f8('0x195'),'foreignKey':_0x04f8('0x196')});db[_0x04f8('0x6f')][_0x04f8('0x114')](db[_0x04f8('0x71')],{'as':_0x04f8('0x149'),'foreignKey':_0x04f8('0x15b')});db[_0x04f8('0x6f')][_0x04f8('0x114')](db[_0x04f8('0x74')],{'as':_0x04f8('0x118'),'foreignKey':_0x04f8('0x15b')});db[_0x04f8('0x6f')][_0x04f8('0x114')](db[_0x04f8('0x119')],{'as':_0x04f8('0x14a'),'foreignKey':_0x04f8('0x15b')});db[_0x04f8('0x6f')][_0x04f8('0x114')](db[_0x04f8('0x77')],{'as':_0x04f8('0x77'),'foreignKey':_0x04f8('0x15b')});db[_0x04f8('0x6f')][_0x04f8('0x114')](db[_0x04f8('0xdb')],{'as':_0x04f8('0x14b'),'foreignKey':'ContactId'});db[_0x04f8('0x6f')][_0x04f8('0x114')](db['OpenchannelInteraction'],{'as':_0x04f8('0x11b'),'foreignKey':_0x04f8('0x15b'),'onDelete':_0x04f8('0x15f')});db[_0x04f8('0x6f')][_0x04f8('0x114')](db['ChatInteraction'],{'as':_0x04f8('0x11c'),'foreignKey':_0x04f8('0x15b'),'onDelete':_0x04f8('0x15f')});db[_0x04f8('0x6f')][_0x04f8('0x114')](db[_0x04f8('0x56')],{'as':_0x04f8('0x11d'),'foreignKey':_0x04f8('0x15b'),'onDelete':_0x04f8('0x15f')});db['CmContact']['hasMany'](db[_0x04f8('0x4d')],{'as':_0x04f8('0x11e'),'foreignKey':_0x04f8('0x15b'),'onDelete':_0x04f8('0x15f')});db[_0x04f8('0x6f')]['hasMany'](db[_0x04f8('0x11f')],{'as':_0x04f8('0x128'),'foreignKey':_0x04f8('0x15b'),'onDelete':_0x04f8('0x15f')});db[_0x04f8('0x6f')][_0x04f8('0x121')](db[_0x04f8('0x6e')],{'as':'Company','foreignKey':_0x04f8('0x194')});db[_0x04f8('0x6f')][_0x04f8('0x121')](db[_0x04f8('0xf8')],{'as':'List','foreignKey':_0x04f8('0x165'),'onDelete':'cascade'});db[_0x04f8('0x6f')][_0x04f8('0x122')](db[_0x04f8('0x13')],{'as':_0x04f8('0x16c'),'through':_0x04f8('0x124')});db[_0x04f8('0x6f')][_0x04f8('0x122')](db['Tag'],{'as':_0x04f8('0x16a'),'through':_0x04f8('0x197')});db[_0x04f8('0x6f')][_0x04f8('0x122')](db[_0x04f8('0x168')],{'through':_0x04f8('0x197'),'as':_0x04f8('0x16b')});db['CmHopper'][_0x04f8('0x114')](db[_0x04f8('0x90')],{'as':_0x04f8('0x198'),'foreignKey':_0x04f8('0x199')});db[_0x04f8('0x71')]['belongsTo'](db[_0x04f8('0x6f')],{'as':_0x04f8('0x15a'),'foreignKey':_0x04f8('0x15b'),'onDelete':_0x04f8('0x112')});db[_0x04f8('0x71')][_0x04f8('0x121')](db[_0x04f8('0xf8')],{'as':_0x04f8('0x164'),'foreignKey':_0x04f8('0x165'),'onDelete':_0x04f8('0x112')});db['CmHopper']['belongsTo'](db[_0x04f8('0x13')],{'as':_0x04f8('0x19a'),'foreignKey':_0x04f8('0x113')});db[_0x04f8('0x71')][_0x04f8('0x121')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x04f8('0x148'),'onDelete':_0x04f8('0x112')});db[_0x04f8('0x71')][_0x04f8('0x121')](db['Campaign'],{'as':_0x04f8('0x19b'),'foreignKey':_0x04f8('0x19c'),'onDelete':_0x04f8('0x112')});db[_0x04f8('0x71')][_0x04f8('0x121')](db['User'],{'as':'Owner','foreignKey':_0x04f8('0x19d')});db[_0x04f8('0x73')][_0x04f8('0x121')](db[_0x04f8('0x6f')],{'as':_0x04f8('0x15a'),'foreignKey':_0x04f8('0x15b'),'onDelete':_0x04f8('0x112')});db['CmHopperBlack']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x04f8('0x165'),'onDelete':_0x04f8('0x112')});db[_0x04f8('0x73')]['belongsTo'](db[_0x04f8('0x1b')],{'as':_0x04f8('0x18a'),'foreignKey':_0x04f8('0x148'),'onDelete':'cascade'});db[_0x04f8('0x73')][_0x04f8('0x121')](db[_0x04f8('0x19b')],{'as':_0x04f8('0x19b'),'foreignKey':_0x04f8('0x19c'),'onDelete':_0x04f8('0x112')});db[_0x04f8('0x7c')][_0x04f8('0x114')](db[_0x04f8('0x81')],{'as':{'plural':_0x04f8('0x19e'),'singular':_0x04f8('0x19f')},'foreignKey':_0x04f8('0x1a0'),'onDelete':_0x04f8('0x112'),'hooks':!![]});db[_0x04f8('0x7c')][_0x04f8('0x114')](db[_0x04f8('0x81')],{'as':{'plural':_0x04f8('0x1a1'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x04f8('0x7c')][_0x04f8('0x114')](db[_0x04f8('0x1a2')],{'as':_0x04f8('0x1a3'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x04f8('0x80')][_0x04f8('0x114')](db[_0x04f8('0x80')],{'as':_0x04f8('0x162'),'foreignKey':_0x04f8('0x1a4'),'onDelete':_0x04f8('0x112')});db['Interval'][_0x04f8('0x114')](db[_0x04f8('0x83')],{'as':_0x04f8('0x1a5'),'foreignKey':_0x04f8('0x14e'),'onDelete':_0x04f8('0x112'),'hooks':!![],'required':![]});db[_0x04f8('0x83')][_0x04f8('0x114')](db[_0x04f8('0x17')],{'as':_0x04f8('0x117'),'foreignKey':'IntervalId','onDelete':'restrict'});db[_0x04f8('0x83')][_0x04f8('0x114')](db[_0x04f8('0x42')],{'as':'MailApplications','foreignKey':_0x04f8('0x14e')});db['Interval'][_0x04f8('0x114')](db['ChatApplication'],{'as':_0x04f8('0x1a6'),'foreignKey':'IntervalId'});db[_0x04f8('0x83')][_0x04f8('0x114')](db[_0x04f8('0x4b')],{'as':'FaxApplications','foreignKey':'IntervalId'});db[_0x04f8('0x83')][_0x04f8('0x114')](db[_0x04f8('0x17c')],{'as':'SmsApplications','foreignKey':_0x04f8('0x14e')});db['Schedule'][_0x04f8('0x121')](db[_0x04f8('0x15c')],{});db[_0x04f8('0x1a7')][_0x04f8('0x121')](db[_0x04f8('0x9c')],{'foreignKey':_0x04f8('0x1a8')});db[_0x04f8('0x1a7')][_0x04f8('0x121')](db[_0x04f8('0x9a')],{'foreignKey':'CustomReportId'});db[_0x04f8('0x8c')][_0x04f8('0x122')](db[_0x04f8('0x19')],{'as':_0x04f8('0x1a9'),'through':_0x04f8('0x146'),'onDelete':'restrict'});db[_0x04f8('0x168')]['belongsToMany'](db[_0x04f8('0x6f')],{'through':_0x04f8('0x197')});db[_0x04f8('0x168')][_0x04f8('0x122')](db[_0x04f8('0x66')],{'through':'chat_interaction_has_tags'});db[_0x04f8('0x168')][_0x04f8('0x122')](db[_0x04f8('0x11f')],{'through':'mail_interaction_has_tags'});db['Tag'][_0x04f8('0x122')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db['Tag'][_0x04f8('0x122')](db['FaxInteraction'],{'through':_0x04f8('0x178')});db[_0x04f8('0x168')][_0x04f8('0x122')](db['OpenchannelInteraction'],{'through':_0x04f8('0x185')});db[_0x04f8('0x168')][_0x04f8('0x122')](db[_0x04f8('0x1aa')],{'through':_0x04f8('0x1ab')});db[_0x04f8('0x8f')][_0x04f8('0x121')](db['ContactItemType'],{'as':_0x04f8('0x1ac'),'foreignKey':_0x04f8('0x1ad')});db[_0x04f8('0x90')][_0x04f8('0x121')](db[_0x04f8('0x71')],{'as':_0x04f8('0x1ae'),'foreignKey':_0x04f8('0x199')});db[_0x04f8('0x8f')][_0x04f8('0x121')](db[_0x04f8('0x6f')],{'as':_0x04f8('0x15a'),'foreignKey':'CmContactId'});db['Trigger'][_0x04f8('0x114')](db[_0x04f8('0x81')],{'as':{'plural':'AllConditions','singular':_0x04f8('0x1af')},'foreignKey':_0x04f8('0x1b0'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x04f8('0x114')](db[_0x04f8('0x81')],{'as':{'plural':_0x04f8('0x1b1'),'singular':'AnyCondition'},'foreignKey':_0x04f8('0x1b2'),'onDelete':_0x04f8('0x112'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x04f8('0x1a2')],{'as':_0x04f8('0x1a3'),'foreignKey':_0x04f8('0x1b3'),'onDelete':_0x04f8('0x112'),'hooks':!![]});db[_0x04f8('0x9a')][_0x04f8('0x114')](db['AnalyticFieldReport'],{'as':_0x04f8('0x1b4'),'onDelete':'cascade','foreignKey':_0x04f8('0x1b5'),'hooks':!![]});db[_0x04f8('0x9c')][_0x04f8('0x114')](db[_0x04f8('0x1b6')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x04f8('0x1a8')});db[_0x04f8('0x9f')][_0x04f8('0x114')](db[_0x04f8('0x1b6')],{'as':'Fields','onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1b7')});db['AnalyticFieldReport'][_0x04f8('0x121')](db['AnalyticMetric'],{'foreignKey':_0x04f8('0x1b7')});db['SalesforceAccount'][_0x04f8('0x114')](db[_0x04f8('0xa6')],{'as':_0x04f8('0x1b8'),'onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1b9')});db[_0x04f8('0xa6')][_0x04f8('0x114')](db['SalesforceField'],{'as':'Subjects','onDelete':_0x04f8('0x112'),'foreignKey':'SubjectId'});db[_0x04f8('0xa6')][_0x04f8('0x114')](db['SalesforceField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x04f8('0x1ba')});db[_0x04f8('0xa6')][_0x04f8('0x114')](db[_0x04f8('0xa8')],{'as':_0x04f8('0x1b4'),'onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1bb')});db[_0x04f8('0xa6')][_0x04f8('0x121')](db[_0x04f8('0xa4')],{'as':_0x04f8('0x16f'),'foreignKey':_0x04f8('0x1b9')});db['SalesforceField']['hasMany'](db[_0x04f8('0xa8')],{'as':_0x04f8('0x1bc'),'foreignKey':_0x04f8('0x1bd')});db['SalesforceField'][_0x04f8('0x114')](db['SalesforceField'],{'as':_0x04f8('0x1be'),'foreignKey':_0x04f8('0x1ba')});db['SalesforceField'][_0x04f8('0x114')](db[_0x04f8('0xa8')],{'as':_0x04f8('0x1bf'),'foreignKey':_0x04f8('0x1bb')});db[_0x04f8('0xa8')][_0x04f8('0x121')](db[_0x04f8('0x95')],{'as':'Variable','foreignKey':_0x04f8('0x1c0')});db[_0x04f8('0xaa')][_0x04f8('0x114')](db[_0x04f8('0x1c1')],{'as':'Configurations','onDelete':_0x04f8('0x112'),'foreignKey':'AccountId'});db[_0x04f8('0x1c1')][_0x04f8('0x114')](db[_0x04f8('0xad')],{'as':_0x04f8('0x1c2'),'onDelete':'cascade','foreignKey':_0x04f8('0x1bd')});db['SugarcrmConfiguration']['hasMany'](db[_0x04f8('0xad')],{'as':_0x04f8('0x1c3'),'onDelete':'cascade','foreignKey':_0x04f8('0x1ba')});db[_0x04f8('0x1c1')][_0x04f8('0x114')](db[_0x04f8('0xad')],{'as':_0x04f8('0x1b4'),'onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1bb')});db[_0x04f8('0x1c1')][_0x04f8('0x121')](db['SugarcrmAccount'],{'as':'Account','foreignKey':'AccountId'});db['SugarcrmField'][_0x04f8('0x114')](db[_0x04f8('0xad')],{'as':_0x04f8('0x1bc'),'foreignKey':'SubjectId'});db[_0x04f8('0xad')][_0x04f8('0x114')](db[_0x04f8('0xad')],{'as':_0x04f8('0x1be'),'foreignKey':'DescriptionId'});db[_0x04f8('0xad')]['hasMany'](db['SugarcrmField'],{'as':_0x04f8('0x1bf'),'foreignKey':'FieldId'});db[_0x04f8('0xad')][_0x04f8('0x121')](db[_0x04f8('0x95')],{'as':_0x04f8('0x95'),'foreignKey':_0x04f8('0x1c0')});db[_0x04f8('0xaf')][_0x04f8('0x114')](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1b9')});db['DeskConfiguration'][_0x04f8('0x114')](db[_0x04f8('0xb2')],{'as':_0x04f8('0x1c2'),'onDelete':'cascade','foreignKey':_0x04f8('0x1bd')});db[_0x04f8('0x1c4')][_0x04f8('0x114')](db[_0x04f8('0xb2')],{'as':_0x04f8('0x1c3'),'onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1ba')});db['DeskConfiguration'][_0x04f8('0x114')](db[_0x04f8('0xb2')],{'as':_0x04f8('0x1b4'),'onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1bb')});db['DeskConfiguration'][_0x04f8('0x121')](db[_0x04f8('0xaf')],{'as':_0x04f8('0x16f'),'foreignKey':_0x04f8('0x1b9')});db[_0x04f8('0x1c4')][_0x04f8('0x122')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0x04f8('0xb2')][_0x04f8('0x114')](db[_0x04f8('0xb2')],{'as':_0x04f8('0x1bc'),'foreignKey':_0x04f8('0x1bd')});db['DeskField'][_0x04f8('0x114')](db[_0x04f8('0xb2')],{'as':_0x04f8('0x1be'),'foreignKey':_0x04f8('0x1ba')});db[_0x04f8('0xb2')][_0x04f8('0x114')](db[_0x04f8('0xb2')],{'as':_0x04f8('0x1bf'),'foreignKey':_0x04f8('0x1bb')});db[_0x04f8('0xb2')][_0x04f8('0x121')](db[_0x04f8('0x95')],{'as':_0x04f8('0x95'),'foreignKey':_0x04f8('0x1c0')});db[_0x04f8('0x1c5')]['hasMany'](db['ZohoConfiguration'],{'as':'Configurations','onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1b9')});db[_0x04f8('0x1c6')][_0x04f8('0x114')](db[_0x04f8('0xb5')],{'as':'Subjects','onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1bd')});db[_0x04f8('0x1c6')][_0x04f8('0x114')](db['ZohoField'],{'as':_0x04f8('0x1c3'),'onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1ba')});db[_0x04f8('0x1c6')][_0x04f8('0x114')](db[_0x04f8('0xb5')],{'as':_0x04f8('0x1b4'),'onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1bb')});db[_0x04f8('0x1c6')][_0x04f8('0x121')](db[_0x04f8('0x1c5')],{'as':_0x04f8('0x16f'),'foreignKey':_0x04f8('0x1b9')});db[_0x04f8('0xb5')]['hasMany'](db[_0x04f8('0xb5')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x04f8('0xb5')][_0x04f8('0x114')](db['ZohoField'],{'as':_0x04f8('0x1be'),'foreignKey':_0x04f8('0x1ba')});db[_0x04f8('0xb5')][_0x04f8('0x114')](db[_0x04f8('0xb5')],{'as':_0x04f8('0x1bf'),'foreignKey':_0x04f8('0x1bb')});db['ZohoField']['belongsTo'](db[_0x04f8('0x95')],{'as':_0x04f8('0x95'),'foreignKey':_0x04f8('0x1c0')});db['ZendeskAccount'][_0x04f8('0x114')](db['ZendeskConfiguration'],{'as':_0x04f8('0x1b8'),'onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1b9')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0x04f8('0x1c2'),'foreignKey':_0x04f8('0x1bd')});db[_0x04f8('0xb8')][_0x04f8('0x114')](db[_0x04f8('0xba')],{'as':_0x04f8('0x1c3'),'foreignKey':_0x04f8('0x1ba')});db['ZendeskConfiguration'][_0x04f8('0x114')](db[_0x04f8('0xba')],{'as':'Fields','foreignKey':_0x04f8('0x1bb')});db[_0x04f8('0xb8')][_0x04f8('0x121')](db[_0x04f8('0xb7')],{'as':'Account','foreignKey':'AccountId'});db[_0x04f8('0xb8')][_0x04f8('0x122')](db[_0x04f8('0x168')],{'through':_0x04f8('0x1c7')});db[_0x04f8('0xba')][_0x04f8('0x114')](db[_0x04f8('0xba')],{'as':'Subject','foreignKey':_0x04f8('0x1bd')});db[_0x04f8('0xba')][_0x04f8('0x114')](db[_0x04f8('0xba')],{'as':_0x04f8('0x1be'),'foreignKey':_0x04f8('0x1ba')});db[_0x04f8('0xba')][_0x04f8('0x114')](db[_0x04f8('0xba')],{'as':'Field','foreignKey':_0x04f8('0x1bb')});db[_0x04f8('0xba')][_0x04f8('0x121')](db['Variable'],{'as':'Variable','foreignKey':_0x04f8('0x1c0')});db[_0x04f8('0x1c8')]['hasMany'](db[_0x04f8('0xbd')],{'as':_0x04f8('0x1b8'),'onDelete':'cascade','foreignKey':_0x04f8('0x1b9')});db[_0x04f8('0xbd')][_0x04f8('0x114')](db[_0x04f8('0xbf')],{'as':_0x04f8('0x1c2'),'onDelete':_0x04f8('0x112'),'foreignKey':'SubjectId'});db[_0x04f8('0xbd')][_0x04f8('0x114')](db[_0x04f8('0xbf')],{'as':_0x04f8('0x1c3'),'onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1ba')});db['FreshdeskConfiguration'][_0x04f8('0x114')](db[_0x04f8('0xbf')],{'as':_0x04f8('0x1b4'),'onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1bb')});db[_0x04f8('0xbd')][_0x04f8('0x121')](db[_0x04f8('0x1c8')],{'as':_0x04f8('0x16f'),'foreignKey':_0x04f8('0x1b9')});db[_0x04f8('0xbd')][_0x04f8('0x122')](db['Tag'],{'through':_0x04f8('0x1c9')});db[_0x04f8('0xbf')][_0x04f8('0x114')](db[_0x04f8('0xbf')],{'as':_0x04f8('0x1bc'),'foreignKey':'SubjectId'});db[_0x04f8('0xbf')][_0x04f8('0x114')](db[_0x04f8('0xbf')],{'as':_0x04f8('0x1be'),'foreignKey':'DescriptionId'});db[_0x04f8('0xbf')][_0x04f8('0x114')](db[_0x04f8('0xbf')],{'as':'Field','foreignKey':'FieldId'});db[_0x04f8('0xbf')]['belongsTo'](db[_0x04f8('0x95')],{'as':_0x04f8('0x95'),'foreignKey':_0x04f8('0x1c0')});db['VtigerAccount'][_0x04f8('0x114')](db['VtigerConfiguration'],{'as':_0x04f8('0x1b8'),'onDelete':'cascade','foreignKey':_0x04f8('0x1b9')});db[_0x04f8('0x1ca')][_0x04f8('0x114')](db[_0x04f8('0xc3')],{'as':'Subjects','foreignKey':_0x04f8('0x1bd')});db[_0x04f8('0x1ca')][_0x04f8('0x114')](db['VtigerField'],{'as':_0x04f8('0x1c3'),'foreignKey':'DescriptionId'});db[_0x04f8('0x1ca')][_0x04f8('0x114')](db['VtigerField'],{'as':_0x04f8('0x1b4'),'foreignKey':'FieldId'});db[_0x04f8('0x1ca')][_0x04f8('0x121')](db['VtigerAccount'],{'as':_0x04f8('0x16f'),'foreignKey':_0x04f8('0x1b9')});db[_0x04f8('0xc3')][_0x04f8('0x114')](db['VtigerField'],{'as':_0x04f8('0x1bc'),'foreignKey':_0x04f8('0x1bd')});db[_0x04f8('0xc3')]['hasMany'](db['VtigerField'],{'as':_0x04f8('0x1be'),'foreignKey':_0x04f8('0x1ba')});db[_0x04f8('0xc3')][_0x04f8('0x114')](db[_0x04f8('0xc3')],{'as':_0x04f8('0x1bf'),'foreignKey':_0x04f8('0x1bb')});db[_0x04f8('0xc3')][_0x04f8('0x121')](db[_0x04f8('0x95')],{'as':'Variable','foreignKey':_0x04f8('0x1c0')});db[_0x04f8('0xc5')][_0x04f8('0x114')](db['ServicenowConfiguration'],{'as':_0x04f8('0x1b8'),'onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1b9')});db['ServicenowConfiguration'][_0x04f8('0x114')](db[_0x04f8('0xc8')],{'as':_0x04f8('0x1c2'),'foreignKey':_0x04f8('0x1bd')});db[_0x04f8('0x1cb')][_0x04f8('0x114')](db['ServicenowField'],{'as':_0x04f8('0x1c3'),'foreignKey':_0x04f8('0x1ba')});db[_0x04f8('0x1cb')][_0x04f8('0x114')](db[_0x04f8('0xc8')],{'as':_0x04f8('0x1b4'),'foreignKey':_0x04f8('0x1bb')});db['ServicenowConfiguration']['belongsTo'](db[_0x04f8('0xc5')],{'as':_0x04f8('0x16f'),'foreignKey':_0x04f8('0x1b9')});db[_0x04f8('0xc8')][_0x04f8('0x114')](db[_0x04f8('0xc8')],{'as':_0x04f8('0x1bc'),'foreignKey':'SubjectId'});db['ServicenowField']['hasMany'](db['ServicenowField'],{'as':_0x04f8('0x1be'),'foreignKey':_0x04f8('0x1ba')});db['ServicenowField'][_0x04f8('0x114')](db['ServicenowField'],{'as':'Field','foreignKey':_0x04f8('0x1bb')});db[_0x04f8('0xc8')]['belongsTo'](db[_0x04f8('0x95')],{'as':'Variable','foreignKey':_0x04f8('0x1c0')});db[_0x04f8('0xc9')][_0x04f8('0x114')](db['Dynamics365Configuration'],{'as':_0x04f8('0x1b8'),'onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1b9')});db[_0x04f8('0xc9')][_0x04f8('0x121')](db[_0x04f8('0x108')],{'as':'CloudProvider','foreignKey':_0x04f8('0x15e')});db[_0x04f8('0xcb')][_0x04f8('0x114')](db[_0x04f8('0x1cc')],{'as':_0x04f8('0x1c2'),'onDelete':_0x04f8('0x112'),'foreignKey':'SubjectId'});db[_0x04f8('0xcb')]['hasMany'](db[_0x04f8('0x1cc')],{'as':'Descriptions','onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1ba')});db['Dynamics365Configuration'][_0x04f8('0x114')](db['Dynamics365Field'],{'as':_0x04f8('0x1b4'),'onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1bb')});db[_0x04f8('0xcb')][_0x04f8('0x121')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0x04f8('0x1b9')});db[_0x04f8('0x1cc')][_0x04f8('0x114')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0x04f8('0x1bd')});db[_0x04f8('0x1cc')][_0x04f8('0x114')](db['Dynamics365Field'],{'as':_0x04f8('0x1be'),'foreignKey':_0x04f8('0x1ba')});db['Dynamics365Field'][_0x04f8('0x114')](db[_0x04f8('0x1cc')],{'as':_0x04f8('0x1bf'),'foreignKey':_0x04f8('0x1bb')});db[_0x04f8('0x1cc')][_0x04f8('0x121')](db[_0x04f8('0x95')],{'as':_0x04f8('0x95'),'foreignKey':_0x04f8('0x1c0')});db[_0x04f8('0xce')][_0x04f8('0x114')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1b9')});db['FreshsalesConfiguration'][_0x04f8('0x114')](db[_0x04f8('0xd1')],{'as':_0x04f8('0x1c2'),'foreignKey':_0x04f8('0x1bd')});db[_0x04f8('0x1cd')]['hasMany'](db[_0x04f8('0xd1')],{'as':_0x04f8('0x1c3'),'foreignKey':'DescriptionId'});db[_0x04f8('0x1cd')][_0x04f8('0x114')](db[_0x04f8('0xd1')],{'as':'Fields','foreignKey':_0x04f8('0x1bb')});db['FreshsalesConfiguration'][_0x04f8('0x121')](db[_0x04f8('0xce')],{'as':_0x04f8('0x16f'),'foreignKey':_0x04f8('0x1b9')});db[_0x04f8('0xd1')][_0x04f8('0x114')](db[_0x04f8('0xd1')],{'as':_0x04f8('0x1bc'),'foreignKey':_0x04f8('0x1bd')});db[_0x04f8('0xd1')][_0x04f8('0x114')](db[_0x04f8('0xd1')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x04f8('0xd1')][_0x04f8('0x114')](db[_0x04f8('0xd1')],{'as':'Field','foreignKey':_0x04f8('0x1bb')});db['FreshsalesField']['belongsTo'](db[_0x04f8('0x95')],{'as':_0x04f8('0x95'),'foreignKey':_0x04f8('0x1c0')});db[_0x04f8('0xd5')][_0x04f8('0x121')](db[_0x04f8('0x61')],{});db[_0x04f8('0xd5')][_0x04f8('0x121')](db[_0x04f8('0xf8')],{'as':_0x04f8('0x164'),'foreignKey':_0x04f8('0x165')});db[_0x04f8('0xd5')][_0x04f8('0x121')](db['CmContact'],{'as':_0x04f8('0x15a'),'foreignKey':'ContactId'});db[_0x04f8('0xd5')]['belongsTo'](db[_0x04f8('0x66')],{});db['ChatQueueReport']['belongsTo'](db['ChatMessage'],{});db[_0x04f8('0xd5')][_0x04f8('0x121')](db['User'],{});db[_0x04f8('0xd5')]['belongsTo'](db['ChatQueue'],{});db[_0x04f8('0xd6')][_0x04f8('0x121')](db['User'],{'onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1ce')});db[_0x04f8('0xd6')]['belongsTo'](db[_0x04f8('0x13')],{'onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x1cf')});db[_0x04f8('0xdb')][_0x04f8('0x114')](db[_0x04f8('0x1d0')],{'foreignKey':'SessionId','onDelete':_0x04f8('0x112')});db[_0x04f8('0xdb')][_0x04f8('0x114')](db[_0x04f8('0xd8')],{'foreignKey':_0x04f8('0x1d1'),'onDelete':_0x04f8('0x112')});db['SmsQueueReport'][_0x04f8('0x121')](db[_0x04f8('0x53')],{});db[_0x04f8('0xdd')][_0x04f8('0x121')](db[_0x04f8('0xf8')],{'as':_0x04f8('0x164'),'foreignKey':_0x04f8('0x165')});db['SmsQueueReport']['belongsTo'](db[_0x04f8('0x6f')],{'as':_0x04f8('0x15a'),'foreignKey':'ContactId'});db[_0x04f8('0xdd')][_0x04f8('0x121')](db[_0x04f8('0x56')],{});db[_0x04f8('0xdd')][_0x04f8('0x121')](db[_0x04f8('0x58')],{});db[_0x04f8('0xdd')]['belongsTo'](db[_0x04f8('0x13')],{});db[_0x04f8('0xdd')]['belongsTo'](db[_0x04f8('0x5a')],{});db[_0x04f8('0x1d2')][_0x04f8('0x114')](db[_0x04f8('0xdb')],{'foreignKey':_0x04f8('0x1d3')});db[_0x04f8('0x1d2')]['hasMany'](db[_0x04f8('0x1d0')],{'foreignKey':_0x04f8('0x1d3')});db[_0x04f8('0x1d2')][_0x04f8('0x114')](db[_0x04f8('0xd8')],{'foreignKey':_0x04f8('0x1d3')});db[_0x04f8('0x13e')][_0x04f8('0x122')](db['User'],{'as':_0x04f8('0x16c'),'through':_0x04f8('0x1d4')});db[_0x04f8('0xea')][_0x04f8('0x122')](db['User'],{'as':'Agents','through':_0x04f8('0x127')});db['Team'][_0x04f8('0x122')](db[_0x04f8('0x1b')],{'through':_0x04f8('0x10a'),'as':_0x04f8('0x1d5')});db['Team']['belongsToMany'](db[_0x04f8('0x3c')],{'through':_0x04f8('0x166'),'as':'MailQueues'});db[_0x04f8('0xea')][_0x04f8('0x122')](db[_0x04f8('0x69')],{'through':_0x04f8('0x191'),'as':'ChatQueues'});db[_0x04f8('0xea')][_0x04f8('0x122')](db[_0x04f8('0x50')],{'through':_0x04f8('0x17a'),'as':_0x04f8('0x12e')});db[_0x04f8('0xea')][_0x04f8('0x122')](db['SmsQueue'],{'through':_0x04f8('0x180'),'as':'SmsQueues'});db['Team'][_0x04f8('0x122')](db[_0x04f8('0x130')],{'through':'team_has_openchannel_queues','as':_0x04f8('0x1d6')});db[_0x04f8('0xea')][_0x04f8('0x122')](db[_0x04f8('0x1d7')],{'through':_0x04f8('0x1d8'),'as':'WhatsappQueues'});db[_0x04f8('0xea')][_0x04f8('0x122')](db[_0x04f8('0xfa')],{'through':_0x04f8('0x10b'),'as':_0x04f8('0x1d9')});db[_0x04f8('0x19b')]['hasMany'](db['CmHopper'],{'as':_0x04f8('0x149'),'foreignKey':_0x04f8('0x19c')});db[_0x04f8('0x19b')][_0x04f8('0x114')](db[_0x04f8('0x74')],{'as':_0x04f8('0x118'),'foreignKey':_0x04f8('0x19c')});db[_0x04f8('0x19b')][_0x04f8('0x114')](db[_0x04f8('0x119')],{'as':_0x04f8('0x14a'),'foreignKey':_0x04f8('0x19c')});db[_0x04f8('0x19b')][_0x04f8('0x114')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x04f8('0x19b')][_0x04f8('0x121')](db[_0x04f8('0x14c')],{'as':'Trunk','foreignKey':_0x04f8('0x1da')});db['Campaign'][_0x04f8('0x121')](db['Trunk'],{'as':_0x04f8('0x14d'),'foreignKey':_0x04f8('0x1db')});db[_0x04f8('0x19b')][_0x04f8('0x121')](db[_0x04f8('0x83')],{'as':_0x04f8('0x83'),'foreignKey':_0x04f8('0x14e')});db[_0x04f8('0x19b')][_0x04f8('0x121')](db[_0x04f8('0x13e')],{'as':'SquareProject','foreignKey':_0x04f8('0x1dc')});db['Campaign'][_0x04f8('0x122')](db[_0x04f8('0xf8')],{'as':_0x04f8('0x125'),'through':_0x04f8('0x1dd')});db[_0x04f8('0x19b')][_0x04f8('0x122')](db[_0x04f8('0xf8')],{'as':_0x04f8('0x1de'),'through':'campaigns_has_cm_blacklists'});db['Attachment']['belongsTo'](db[_0x04f8('0x67')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db['MailTransferReport'][_0x04f8('0x121')](db[_0x04f8('0x40')],{});db[_0x04f8('0xf1')][_0x04f8('0x121')](db[_0x04f8('0x11f')],{});db[_0x04f8('0xf1')]['belongsTo'](db['MailAccount'],{'foreignKey':_0x04f8('0x1df'),'as':_0x04f8('0x1e0')});db[_0x04f8('0xf1')]['belongsTo'](db[_0x04f8('0x13')],{'foreignKey':_0x04f8('0x1e1'),'as':'FromAgent'});db['MailTransferReport'][_0x04f8('0x121')](db['User'],{'foreignKey':_0x04f8('0x1e2'),'as':_0x04f8('0x1e3')});db[_0x04f8('0xf1')]['belongsTo'](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db['MailTransferReport']['belongsTo'](db[_0x04f8('0x15c')],{'foreignKey':_0x04f8('0x1e4'),'as':'ToAccount'});db[_0x04f8('0xf2')][_0x04f8('0x121')](db[_0x04f8('0x189')],{});db[_0x04f8('0xf2')][_0x04f8('0x121')](db[_0x04f8('0x66')],{});db[_0x04f8('0xf2')][_0x04f8('0x121')](db['ChatWebsite'],{'foreignKey':_0x04f8('0x1e5'),'as':'FromAccount'});db[_0x04f8('0xf2')][_0x04f8('0x121')](db[_0x04f8('0x13')],{'foreignKey':_0x04f8('0x1e1'),'as':_0x04f8('0x1e6')});db['ChatTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x04f8('0x1e2'),'as':_0x04f8('0x1e3')});db[_0x04f8('0xf2')][_0x04f8('0x121')](db['ChatQueue'],{'foreignKey':_0x04f8('0x1e7'),'as':'ToQueue'});db[_0x04f8('0xf2')]['belongsTo'](db[_0x04f8('0x61')],{'foreignKey':_0x04f8('0x1e8'),'as':_0x04f8('0x1e9')});db[_0x04f8('0x1ea')][_0x04f8('0x121')](db[_0x04f8('0x4e')],{});db[_0x04f8('0x1ea')][_0x04f8('0x121')](db[_0x04f8('0x4d')],{});db[_0x04f8('0x1ea')]['belongsTo'](db[_0x04f8('0x49')],{'foreignKey':_0x04f8('0x1eb'),'as':'FromAccount'});db['FaxTransferReport']['belongsTo'](db[_0x04f8('0x13')],{'foreignKey':_0x04f8('0x1e1'),'as':_0x04f8('0x1e6')});db[_0x04f8('0x1ea')][_0x04f8('0x121')](db[_0x04f8('0x13')],{'foreignKey':_0x04f8('0x1e2'),'as':_0x04f8('0x1e3')});db[_0x04f8('0x1ea')][_0x04f8('0x121')](db[_0x04f8('0x50')],{'foreignKey':_0x04f8('0x1ec'),'as':'ToQueue'});db[_0x04f8('0x1ea')]['belongsTo'](db[_0x04f8('0x49')],{'foreignKey':_0x04f8('0x1ed'),'as':_0x04f8('0x1e9')});db[_0x04f8('0xf4')][_0x04f8('0x121')](db['OpenchannelMessage'],{});db[_0x04f8('0xf4')][_0x04f8('0x121')](db[_0x04f8('0x11a')],{});db[_0x04f8('0xf4')][_0x04f8('0x121')](db[_0x04f8('0x137')],{'foreignKey':'FromOpenchannelAccountId','as':_0x04f8('0x1e0')});db[_0x04f8('0xf4')][_0x04f8('0x121')](db['User'],{'foreignKey':_0x04f8('0x1e1'),'as':'FromAgent'});db[_0x04f8('0xf4')][_0x04f8('0x121')](db[_0x04f8('0x13')],{'foreignKey':_0x04f8('0x1e2'),'as':_0x04f8('0x1e3')});db[_0x04f8('0xf4')][_0x04f8('0x121')](db['OpenchannelQueue'],{'foreignKey':_0x04f8('0x1ee'),'as':_0x04f8('0x1ef')});db[_0x04f8('0xf4')][_0x04f8('0x121')](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0x04f8('0x1e9')});db[_0x04f8('0xf6')]['belongsTo'](db[_0x04f8('0x58')],{});db[_0x04f8('0xf6')]['belongsTo'](db['SmsInteraction'],{});db[_0x04f8('0xf6')][_0x04f8('0x121')](db[_0x04f8('0x53')],{'foreignKey':_0x04f8('0x1f0'),'as':_0x04f8('0x1e0')});db[_0x04f8('0xf6')]['belongsTo'](db[_0x04f8('0x13')],{'foreignKey':'FromUserId','as':_0x04f8('0x1e6')});db['SmsTransferReport'][_0x04f8('0x121')](db[_0x04f8('0x13')],{'foreignKey':_0x04f8('0x1e2'),'as':_0x04f8('0x1e3')});db['SmsTransferReport'][_0x04f8('0x121')](db[_0x04f8('0x5a')],{'foreignKey':_0x04f8('0x1f1'),'as':_0x04f8('0x1ef')});db[_0x04f8('0xf6')][_0x04f8('0x121')](db[_0x04f8('0x53')],{'foreignKey':_0x04f8('0x1f2'),'as':_0x04f8('0x1e9')});db['CmList'][_0x04f8('0x114')](db['Disposition'],{'as':_0x04f8('0x162'),'foreignKey':_0x04f8('0x165'),'onDelete':'cascade'});db['CmList'][_0x04f8('0x114')](db[_0x04f8('0x79')],{'as':_0x04f8('0x1f3'),'foreignKey':'ListId'});db[_0x04f8('0xf8')]['hasMany'](db[_0x04f8('0x6f')],{'as':'Contacts','onDelete':_0x04f8('0x112'),'foreignKey':_0x04f8('0x165')});db[_0x04f8('0xf8')]['hasMany'](db[_0x04f8('0x74')],{'as':_0x04f8('0x118'),'foreignKey':'ListId'});db[_0x04f8('0xf8')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x04f8('0x165')});db[_0x04f8('0xf8')]['hasMany'](db[_0x04f8('0x77')],{'as':_0x04f8('0x77'),'foreignKey':_0x04f8('0x165')});db['CmList']['belongsToMany'](db[_0x04f8('0x1b')],{'as':_0x04f8('0x1f4'),'through':_0x04f8('0x151')});db[_0x04f8('0xf8')][_0x04f8('0x122')](db[_0x04f8('0x13')],{'as':_0x04f8('0x152'),'through':'cm_user_has_lists'});db[_0x04f8('0xfa')][_0x04f8('0x114')](db[_0x04f8('0x17')],{'as':'Extensions','onDelete':_0x04f8('0x112')});db['VoicePrefix'][_0x04f8('0x122')](db[_0x04f8('0x13')],{'as':_0x04f8('0x152'),'through':_0x04f8('0x10c')});db[_0x04f8('0xfa')]['belongsToMany'](db['Team'],{'through':_0x04f8('0x10b'),'as':_0x04f8('0x153')});db[_0x04f8('0xfc')][_0x04f8('0x114')](db[_0x04f8('0x13')],{'as':_0x04f8('0x16c'),'foreignKey':_0x04f8('0x1f5')});db[_0x04f8('0xfc')][_0x04f8('0x114')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x04f8('0x1f5'),'onDelete':'cascade'});db[_0x04f8('0x1f6')]['hasMany'](db[_0x04f8('0xfe')],{'as':_0x04f8('0x1f7'),'foreignKey':'sectionId','onDelete':_0x04f8('0x112')});db[_0x04f8('0x13b')]['hasMany'](db[_0x04f8('0x80')],{'as':_0x04f8('0x162'),'foreignKey':'WhatsappAccountId','onDelete':_0x04f8('0x112')});db[_0x04f8('0x13b')][_0x04f8('0x114')](db['CannedAnswer'],{'as':_0x04f8('0x175'),'foreignKey':_0x04f8('0x1f8')});db['WhatsappAccount']['hasMany'](db['WhatsappMessage'],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0x04f8('0x13b')][_0x04f8('0x114')](db[_0x04f8('0x1aa')],{'as':_0x04f8('0x163')});db[_0x04f8('0x13b')]['hasMany'](db[_0x04f8('0x102')],{'as':_0x04f8('0x144')});db[_0x04f8('0x13b')][_0x04f8('0x121')](db[_0x04f8('0xf8')],{'as':_0x04f8('0x164'),'foreignKey':_0x04f8('0x165')});db['WhatsappAccount'][_0x04f8('0x121')](db['Pause'],{'as':_0x04f8('0x14f'),'foreignKey':_0x04f8('0x150')});db[_0x04f8('0x13b')][_0x04f8('0x122')](db['User'],{'as':_0x04f8('0x152'),'through':_0x04f8('0x13d')});db[_0x04f8('0x102')][_0x04f8('0x121')](db[_0x04f8('0x13')],{'onDelete':_0x04f8('0x15f')});db[_0x04f8('0x102')][_0x04f8('0x121')](db[_0x04f8('0x1d7')],{'onDelete':_0x04f8('0x15f')});db[_0x04f8('0x102')][_0x04f8('0x121')](db[_0x04f8('0x13b')],{'onDelete':'restrict'});db[_0x04f8('0x102')]['belongsTo'](db[_0x04f8('0x83')],{'onDelete':_0x04f8('0x15f'),'foreignKey':_0x04f8('0x14e')});db[_0x04f8('0x102')][_0x04f8('0x121')](db[_0x04f8('0x168')],{'onDelete':_0x04f8('0x15f'),'foreignKey':'TagId'});db[_0x04f8('0x1aa')]['hasMany'](db[_0x04f8('0x104')],{'as':_0x04f8('0x154'),'onDelete':_0x04f8('0x112'),'foreignKey':'WhatsappInteractionId'});db[_0x04f8('0x1aa')][_0x04f8('0x121')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x04f8('0x1f8')});db[_0x04f8('0x1aa')][_0x04f8('0x121')](db[_0x04f8('0x6f')],{'as':'Contact','foreignKey':_0x04f8('0x15b')});db[_0x04f8('0x1aa')][_0x04f8('0x121')](db[_0x04f8('0x13')],{'as':_0x04f8('0x17e'),'foreignKey':_0x04f8('0x113')});db[_0x04f8('0x1aa')][_0x04f8('0x122')](db['Tag'],{'through':_0x04f8('0x1ab'),'as':_0x04f8('0x16a')});db['WhatsappInteraction'][_0x04f8('0x122')](db[_0x04f8('0x168')],{'through':_0x04f8('0x1ab'),'as':'ThroughTags'});db[_0x04f8('0x1aa')][_0x04f8('0x122')](db[_0x04f8('0x13')],{'as':'Users','through':_0x04f8('0x12c'),'foreignKey':_0x04f8('0x1f9')});db['WhatsappMessage'][_0x04f8('0x121')](db['User'],{'as':_0x04f8('0x13')});db[_0x04f8('0x104')][_0x04f8('0x121')](db['CmContact'],{'onDelete':_0x04f8('0x112'),'as':_0x04f8('0x15a')});db[_0x04f8('0x104')][_0x04f8('0x121')](db[_0x04f8('0x1aa')],{'onDelete':_0x04f8('0x112'),'as':'Interaction','foreignKey':_0x04f8('0x1f9')});db[_0x04f8('0x104')][_0x04f8('0x121')](db[_0x04f8('0x13b')],{'as':_0x04f8('0x16f'),'foreignKey':_0x04f8('0x1f8')});db[_0x04f8('0x1fa')][_0x04f8('0x121')](db[_0x04f8('0x13b')],{});db['WhatsappQueueReport'][_0x04f8('0x121')](db[_0x04f8('0xf8')],{'as':'List','foreignKey':_0x04f8('0x165')});db[_0x04f8('0x1fa')][_0x04f8('0x121')](db[_0x04f8('0x6f')],{'as':_0x04f8('0x15a'),'foreignKey':_0x04f8('0x15b')});db[_0x04f8('0x1fa')]['belongsTo'](db['WhatsappInteraction'],{});db[_0x04f8('0x1fa')][_0x04f8('0x121')](db[_0x04f8('0x1d7')],{});db[_0x04f8('0x1fa')][_0x04f8('0x121')](db[_0x04f8('0x104')],{});db['WhatsappQueueReport'][_0x04f8('0x121')](db[_0x04f8('0x13')],{});db['WhatsappTransferReport'][_0x04f8('0x121')](db[_0x04f8('0x104')],{});db['WhatsappTransferReport'][_0x04f8('0x121')](db[_0x04f8('0x1aa')],{});db[_0x04f8('0x1fb')][_0x04f8('0x121')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0x04f8('0x1e0')});db['WhatsappTransferReport']['belongsTo'](db[_0x04f8('0x13b')],{'foreignKey':_0x04f8('0x1fc'),'as':_0x04f8('0x1e9')});db['WhatsappTransferReport']['belongsTo'](db[_0x04f8('0x1d7')],{'foreignKey':_0x04f8('0x1fd'),'as':_0x04f8('0x1ef')});db[_0x04f8('0x1fb')]['belongsTo'](db[_0x04f8('0x13')],{'foreignKey':'FromUserId','as':_0x04f8('0x1e6')});db[_0x04f8('0x1fb')][_0x04f8('0x121')](db[_0x04f8('0x13')],{'foreignKey':_0x04f8('0x1e2'),'as':'ToAgent'});db[_0x04f8('0x1d7')][_0x04f8('0x122')](db[_0x04f8('0x13')],{'as':_0x04f8('0x152'),'through':_0x04f8('0x1fe'),'foreignKey':_0x04f8('0x1ff')});db['WhatsappQueue'][_0x04f8('0x122')](db['Team'],{'through':_0x04f8('0x1d8'),'as':_0x04f8('0x153')});db[_0x04f8('0x10e')][_0x04f8('0x121')](db['User'],{'as':_0x04f8('0x200'),'foreignKey':_0x04f8('0x113'),'onDelete':'cascade','hooks':!![]});db[_0x04f8('0x108')][_0x04f8('0x110')](db[_0x04f8('0xc9')],{'as':_0x04f8('0xc9'),'onDelete':_0x04f8('0x15f')});db['CloudProvider']['hasOne'](db[_0x04f8('0x37')],{'as':'Imap','onDelete':_0x04f8('0x15f')});db[_0x04f8('0x108')][_0x04f8('0x110')](db[_0x04f8('0x39')],{'as':_0x04f8('0x161'),'onDelete':_0x04f8('0x15f')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index bdc438e..73b8dc0 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc08b=['/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','./api/intSugarcrmAccount','/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/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappQueue','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','/api/auth/google','/api/auth/activedirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','join','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','/index.html','express','./utils/client-side-logger','./api/client-side-logs','then','use','./api/user','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc08b,0x1c4));var _0xbc08=function(_0xf6b8e9,_0x14b756){_0xf6b8e9=_0xf6b8e9-0x0;var _0x1910ff=_0xc08b[_0xf6b8e9];return _0x1910ff;};'use strict';var path=require('path');var express=require(_0xbc08('0x0'));var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require(_0xbc08('0x1'))['setupLoggers'];var clientSideLogs=require(_0xbc08('0x2'));exports['default']=function(_0x4cda1b){return setupLoggers(_0x4cda1b)[_0xbc08('0x3')](function(){_0x4cda1b[_0xbc08('0x4')]('/api/users',require(_0xbc08('0x5')));_0x4cda1b[_0xbc08('0x4')]('/api/voice/chanspy',require(_0xbc08('0x6')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x7'),require('./api/voiceContext'));_0x4cda1b['use'](_0xbc08('0x8'),require(_0xbc08('0x9')));_0x4cda1b['use'](_0xbc08('0xa'),require(_0xbc08('0xb')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xc'),require(_0xbc08('0xd')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xe'),require(_0xbc08('0xf')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x10'),require(_0xbc08('0x11')));_0x4cda1b['use'](_0xbc08('0x12'),require(_0xbc08('0x13')));_0x4cda1b[_0xbc08('0x4')]('/api/voice/mails/messages',require(_0xbc08('0x14')));_0x4cda1b[_0xbc08('0x4')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x15'),require(_0xbc08('0x16')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x17'),require(_0xbc08('0x18')));_0x4cda1b['use'](_0xbc08('0x19'),require('./api/voiceQueueReport'));_0x4cda1b['use']('/api/members/reports',require('./api/memberReport'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x1a'),require(_0xbc08('0x1b')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x1c'),require(_0xbc08('0x1d')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x1e'),require(_0xbc08('0x1f')));_0x4cda1b[_0xbc08('0x4')]('/api/mail/accounts',require(_0xbc08('0x20')));_0x4cda1b['use'](_0xbc08('0x21'),require(_0xbc08('0x22')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x23'),require(_0xbc08('0x24')));_0x4cda1b[_0xbc08('0x4')]('/api/mail/interactions',require(_0xbc08('0x25')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x26'),require(_0xbc08('0x27')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x28'),require(_0xbc08('0x29')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x2a'),require('./api/mailQueueReport'));_0x4cda1b['use'](_0xbc08('0x2b'),require(_0xbc08('0x2c')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x2d'),require(_0xbc08('0x2e')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x2f'),require(_0xbc08('0x30')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x31'),require(_0xbc08('0x32')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x33'),require(_0xbc08('0x34')));_0x4cda1b['use'](_0xbc08('0x35'),require('./api/faxMessage'));_0x4cda1b['use'](_0xbc08('0x36'),require(_0xbc08('0x37')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x38'),require(_0xbc08('0x39')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x3a'),require(_0xbc08('0x3b')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x3c'),require(_0xbc08('0x3d')));_0x4cda1b[_0xbc08('0x4')]('/api/sms/interactions',require('./api/smsInteraction'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x3e'),require(_0xbc08('0x3f')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x40'),require('./api/smsQueue'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x41'),require('./api/openchannelAccount'));_0x4cda1b['use'](_0xbc08('0x42'),require(_0xbc08('0x43')));_0x4cda1b[_0xbc08('0x4')]('/api/openchannel/interactions',require(_0xbc08('0x44')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x45'),require(_0xbc08('0x46')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x47'),require(_0xbc08('0x48')));_0x4cda1b['use']('/api/chat/websites',require(_0xbc08('0x49')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x4a'),require('./api/openchannelQueueReport'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x4b'),require(_0xbc08('0x4c')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x4d'),require('./api/chatInteraction'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x4e'),require(_0xbc08('0x4f')));_0x4cda1b['use'](_0xbc08('0x50'),require(_0xbc08('0x51')));_0x4cda1b[_0xbc08('0x4')]('/api/chat/queues',require(_0xbc08('0x52')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x53'),require(_0xbc08('0x54')));_0x4cda1b['use'](_0xbc08('0x55'),require(_0xbc08('0x56')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x57'),require(_0xbc08('0x58')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x59'),require('./api/cmContact'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x5a'),require('./api/cmHopper'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x5b'),require(_0xbc08('0x5c')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x5d'),require(_0xbc08('0x5e')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x5f'),require('./api/cmHopperHistory'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x60'),require(_0xbc08('0x61')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x62'),require(_0xbc08('0x63')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x64'),require(_0xbc08('0x65')));_0x4cda1b['use'](_0xbc08('0x66'),require(_0xbc08('0x67')));_0x4cda1b[_0xbc08('0x4')]('/api/dispositions',require(_0xbc08('0x68')));_0x4cda1b['use'](_0xbc08('0x69'),require(_0xbc08('0x6a')));_0x4cda1b['use'](_0xbc08('0x6b'),require(_0xbc08('0x6c')));_0x4cda1b['use'](_0xbc08('0x6d'),require(_0xbc08('0x6e')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x6f'),require(_0xbc08('0x70')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x71'),require('./api/voiceQueuesLog'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x72'),require('./api/schedule'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x73'),require(_0xbc08('0x74')));_0x4cda1b['use'](_0xbc08('0x75'),require(_0xbc08('0x76')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x77'),require(_0xbc08('0x78')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x79'),require(_0xbc08('0x7a')));_0x4cda1b['use'](_0xbc08('0x7b'),require(_0xbc08('0x7c')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x7d'),require(_0xbc08('0x7e')));_0x4cda1b['use'](_0xbc08('0x7f'),require('./api/trigger'));_0x4cda1b['use'](_0xbc08('0x80'),require(_0xbc08('0x81')));_0x4cda1b['use'](_0xbc08('0x82'),require(_0xbc08('0x83')));_0x4cda1b['use'](_0xbc08('0x84'),require(_0xbc08('0x85')));_0x4cda1b[_0xbc08('0x4')]('/api/analytics/custom_reports',require(_0xbc08('0x86')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x87'),require('./api/analyticDefaultReport'));_0x4cda1b['use'](_0xbc08('0x88'),require(_0xbc08('0x89')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x8a'),require('./api/analyticMetric'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x8b'),require(_0xbc08('0x8c')));_0x4cda1b[_0xbc08('0x4')]('/api/analytics/tree_reports',require(_0xbc08('0x8d')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x8e'),require('./api/intSalesforceAccount'));_0x4cda1b['use'](_0xbc08('0x8f'),require(_0xbc08('0x90')));_0x4cda1b[_0xbc08('0x4')]('/api/integrations/salesforce/fields',require(_0xbc08('0x91')));_0x4cda1b[_0xbc08('0x4')]('/api/integrations/sugarcrm/accounts',require(_0xbc08('0x92')));_0x4cda1b['use'](_0xbc08('0x93'),require(_0xbc08('0x94')));_0x4cda1b['use'](_0xbc08('0x95'),require(_0xbc08('0x96')));_0x4cda1b['use'](_0xbc08('0x97'),require(_0xbc08('0x98')));_0x4cda1b[_0xbc08('0x4')]('/api/integrations/desk/configurations',require(_0xbc08('0x99')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x9a'),require(_0xbc08('0x9b')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x9c'),require('./api/intZohoAccount'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x9d'),require(_0xbc08('0x9e')));_0x4cda1b[_0xbc08('0x4')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x4cda1b['use']('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x9f'),require(_0xbc08('0xa0')));_0x4cda1b['use']('/api/integrations/zendesk/fields',require(_0xbc08('0xa1')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xa2'),require(_0xbc08('0xa3')));_0x4cda1b[_0xbc08('0x4')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x4cda1b['use'](_0xbc08('0xa4'),require(_0xbc08('0xa5')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xa6'),require(_0xbc08('0xa7')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xa8'),require(_0xbc08('0xa9')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xaa'),require(_0xbc08('0xab')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xac'),require(_0xbc08('0xad')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xae'),require(_0xbc08('0xaf')));_0x4cda1b[_0xbc08('0x4')]('/api/integrations/servicenow/fields',require(_0xbc08('0xb0')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xb1'),require(_0xbc08('0xb2')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xb3'),require('./api/intDynamics365Configuration'));_0x4cda1b['use'](_0xbc08('0xb4'),require(_0xbc08('0xb5')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xb6'),require(_0xbc08('0xb7')));_0x4cda1b['use'](_0xbc08('0xb8'),require(_0xbc08('0xb9')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xba'),require(_0xbc08('0xbb')));_0x4cda1b['use'](_0xbc08('0xbc'),require(_0xbc08('0xbd')));_0x4cda1b['use'](_0xbc08('0xbe'),require(_0xbc08('0xbf')));_0x4cda1b[_0xbc08('0x4')]('/api/chat/internal/messages',require(_0xbc08('0xc0')));_0x4cda1b[_0xbc08('0x4')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xc1'),require(_0xbc08('0xc2')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xc3'),require('./api/jscriptySessionReport'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xc4'),require(_0xbc08('0xc5')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xc6'),require(_0xbc08('0xc7')));_0x4cda1b['use'](_0xbc08('0xc8'),require('./api/squareReportDetail'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xc9'),require('./api/jscriptyProject'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xca'),require(_0xbc08('0xcb')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xcc'),require(_0xbc08('0xcd')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xce'),require(_0xbc08('0xcf')));_0x4cda1b['use'](_0xbc08('0xd0'),require(_0xbc08('0xd1')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xd2'),require(_0xbc08('0xd3')));_0x4cda1b[_0xbc08('0x4')]('/api/teams',require('./api/team'));_0x4cda1b[_0xbc08('0x4')]('/api/license',require(_0xbc08('0xd4')));_0x4cda1b[_0xbc08('0x4')]('/api/campaigns',require(_0xbc08('0xd5')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xd6'),require(_0xbc08('0xd7')));_0x4cda1b['use'](_0xbc08('0xd8'),require(_0xbc08('0xd9')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xda'),require(_0xbc08('0xdb')));_0x4cda1b[_0xbc08('0x4')]('/api/mail/reports/transfer',require(_0xbc08('0xdc')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xdd'),require('./api/chatTransferReport'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xde'),require(_0xbc08('0xdf')));_0x4cda1b[_0xbc08('0x4')]('/api/openchannel/reports/transfer',require(_0xbc08('0xe0')));_0x4cda1b['use']('/api/sms/reports/transfer',require(_0xbc08('0xe1')));_0x4cda1b[_0xbc08('0x4')]('/api/cm/lists',require(_0xbc08('0xe2')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xe3'),require(_0xbc08('0xe4')));_0x4cda1b['use'](_0xbc08('0xe5'),require(_0xbc08('0xe6')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xe7'),require(_0xbc08('0xe8')));_0x4cda1b['use'](_0xbc08('0xe9'),require(_0xbc08('0xea')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xeb'),require(_0xbc08('0xec')));_0x4cda1b['use'](_0xbc08('0xed'),require(_0xbc08('0xee')));_0x4cda1b[_0xbc08('0x4')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xef'),require(_0xbc08('0xf0')));_0x4cda1b['use']('/api/whatsapp/messages',require(_0xbc08('0xf1')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xf2'),require(_0xbc08('0xf3')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xf4'),require('./api/whatsappTransferReport'));_0x4cda1b['use']('/api/whatsapp/queues',require(_0xbc08('0xf5')));_0x4cda1b[_0xbc08('0x4')]('/api/cloudProviders',require('./api/cloudProvider'));_0x4cda1b['use'](_0xbc08('0xf6'),require(_0xbc08('0xf7')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xf8'),require(_0xbc08('0xf9')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xfa'),require('./api/authLocal'));_0x4cda1b['use'](_0xbc08('0xfb'),require('./api/authGoogle'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xfc'),require('./api/authActiveDirectory'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xfd'),require('./api/jira'));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0xfe'),require(_0xbc08('0xff')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x100'),require(_0xbc08('0x101')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x102'),require(_0xbc08('0x103')));_0x4cda1b['use'](_0xbc08('0x104'),require(_0xbc08('0x105')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x106'),require(_0xbc08('0x107')));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x108'),clientSideLogs);_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x109'),express[_0xbc08('0x10a')](path['join'](config[_0xbc08('0x10b')],_0xbc08('0x109'))));_0x4cda1b[_0xbc08('0x4')]('/www',express[_0xbc08('0x10a')](path[_0xbc08('0x10c')](config[_0xbc08('0x10b')],_0xbc08('0x10d'))));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x10e'),express[_0xbc08('0x10a')](path[_0xbc08('0x10c')](config[_0xbc08('0x10b')],_0xbc08('0x10e'))));_0x4cda1b[_0xbc08('0x4')](_0xbc08('0x10f'),express[_0xbc08('0x10a')](path[_0xbc08('0x10c')](config[_0xbc08('0x10b')],_0xbc08('0x110'),_0xbc08('0x111'))));_0x4cda1b['use'](_0xbc08('0x112'),express[_0xbc08('0x10a')](path[_0xbc08('0x10c')](config[_0xbc08('0x10b')],_0xbc08('0x113'))));_0x4cda1b['route'](_0xbc08('0x114'))[_0xbc08('0x115')](errors[0x194]);_0x4cda1b[_0xbc08('0x116')]('/*')[_0xbc08('0x115')](function(_0x3d6796,_0x6596c7){_0x6596c7[_0xbc08('0x117')](path[_0xbc08('0x118')](_0x4cda1b[_0xbc08('0x115')](_0xbc08('0x119'))+_0xbc08('0x11a')));});return _0x4cda1b;});}; \ No newline at end of file +var _0xa23f=['/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/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/jscripty/questions/reports','./api/jscriptySessionReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','root','/www','static','join','/demo','3.0.0','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','path','express','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','then','/api/users','/api/voice/chanspy','use','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','./api/faxApplication'];(function(_0x2795a5,_0x23e930){var _0x21b06d=function(_0xe9b56b){while(--_0xe9b56b){_0x2795a5['push'](_0x2795a5['shift']());}};_0x21b06d(++_0x23e930);}(_0xa23f,0xe4));var _0xfa23=function(_0x121a36,_0x3742ea){_0x121a36=_0x121a36-0x0;var _0x5ca081=_0xa23f[_0x121a36];return _0x5ca081;};'use strict';var path=require(_0xfa23('0x0'));var express=require(_0xfa23('0x1'));var errors=require(_0xfa23('0x2'));var config=require(_0xfa23('0x3'));var setupLoggers=require(_0xfa23('0x4'))['setupLoggers'];var clientSideLogs=require(_0xfa23('0x5'));exports['default']=function(_0x4393eb){return setupLoggers(_0x4393eb)[_0xfa23('0x6')](function(){_0x4393eb['use'](_0xfa23('0x7'),require('./api/user'));_0x4393eb['use'](_0xfa23('0x8'),require('./api/voiceChanSpy'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xa'),require('./api/voiceContext'));_0x4393eb['use'](_0xfa23('0xb'),require(_0xfa23('0xc')));_0x4393eb[_0xfa23('0x9')]('/api/voice/mohs',require(_0xfa23('0xd')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xe'),require('./api/voiceQueue'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xf'),require(_0xfa23('0x10')));_0x4393eb[_0xfa23('0x9')]('/api/screen/recordings',require(_0xfa23('0x11')));_0x4393eb['use'](_0xfa23('0x12'),require('./api/voiceMail'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x13'),require(_0xfa23('0x14')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x15'),require('./api/voiceCallReport'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x16'),require(_0xfa23('0x17')));_0x4393eb[_0xfa23('0x9')]('/api/voice/agents/reports',require(_0xfa23('0x18')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x19'),require('./api/voiceQueueReport'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x1a'),require('./api/memberReport'));_0x4393eb[_0xfa23('0x9')]('/api/trunks',require('./api/trunk'));_0x4393eb['use'](_0xfa23('0x1b'),require(_0xfa23('0x1c')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x1d'),require(_0xfa23('0x1e')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x1f'),require(_0xfa23('0x20')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x21'),require(_0xfa23('0x22')));_0x4393eb[_0xfa23('0x9')]('/api/mail/substatuses',require(_0xfa23('0x23')));_0x4393eb[_0xfa23('0x9')]('/api/mail/interactions',require('./api/mailInteraction'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x24'),require(_0xfa23('0x25')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x26'),require(_0xfa23('0x27')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x28'),require(_0xfa23('0x29')));_0x4393eb['use'](_0xfa23('0x2a'),require(_0xfa23('0x2b')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x2c'),require(_0xfa23('0x2d')));_0x4393eb['use']('/api/fax/accounts',require('./api/faxAccount'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x2e'),require(_0xfa23('0x2f')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x30'),require(_0xfa23('0x31')));_0x4393eb[_0xfa23('0x9')]('/api/fax/messages',require(_0xfa23('0x32')));_0x4393eb['use'](_0xfa23('0x33'),require(_0xfa23('0x34')));_0x4393eb[_0xfa23('0x9')]('/api/fax/reports/queue',require(_0xfa23('0x35')));_0x4393eb[_0xfa23('0x9')]('/api/sms/accounts',require(_0xfa23('0x36')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x37'),require(_0xfa23('0x38')));_0x4393eb['use'](_0xfa23('0x39'),require(_0xfa23('0x3a')));_0x4393eb[_0xfa23('0x9')]('/api/sms/messages',require(_0xfa23('0x3b')));_0x4393eb['use'](_0xfa23('0x3c'),require(_0xfa23('0x3d')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x3e'),require(_0xfa23('0x3f')));_0x4393eb['use'](_0xfa23('0x40'),require(_0xfa23('0x41')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x42'),require(_0xfa23('0x43')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x44'),require(_0xfa23('0x45')));_0x4393eb[_0xfa23('0x9')]('/api/openchannel/queues',require(_0xfa23('0x46')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x47'),require(_0xfa23('0x48')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x49'),require('./api/openchannelQueueReport'));_0x4393eb['use'](_0xfa23('0x4a'),require(_0xfa23('0x4b')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x4c'),require('./api/chatInteraction'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x4d'),require(_0xfa23('0x4e')));_0x4393eb['use']('/api/chat/offline_messages',require(_0xfa23('0x4f')));_0x4393eb[_0xfa23('0x9')]('/api/chat/queues',require(_0xfa23('0x50')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x51'),require(_0xfa23('0x52')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x53'),require(_0xfa23('0x54')));_0x4393eb['use'](_0xfa23('0x55'),require(_0xfa23('0x56')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x57'),require('./api/cmContact'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x58'),require(_0xfa23('0x59')));_0x4393eb['use'](_0xfa23('0x5a'),require('./api/cmHopperBlack'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x5b'),require(_0xfa23('0x5c')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x5d'),require(_0xfa23('0x5e')));_0x4393eb['use'](_0xfa23('0x5f'),require(_0xfa23('0x60')));_0x4393eb['use']('/api/actions',require(_0xfa23('0x61')));_0x4393eb['use'](_0xfa23('0x62'),require(_0xfa23('0x63')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x64'),require(_0xfa23('0x65')));_0x4393eb[_0xfa23('0x9')]('/api/dispositions',require(_0xfa23('0x66')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x67'),require('./api/condition'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x68'),require(_0xfa23('0x69')));_0x4393eb[_0xfa23('0x9')]('/api/pauses',require(_0xfa23('0x6a')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x6b'),require('./api/cdr'));_0x4393eb[_0xfa23('0x9')]('/api/voiceQueuesLog',require(_0xfa23('0x6c')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x6d'),require(_0xfa23('0x6e')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x6f'),require(_0xfa23('0x70')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x71'),require(_0xfa23('0x72')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x73'),require(_0xfa23('0x74')));_0x4393eb[_0xfa23('0x9')]('/api/cm_contact_has_items',require(_0xfa23('0x75')));_0x4393eb[_0xfa23('0x9')]('/api/cm_hopper_additional_phones',require(_0xfa23('0x76')));_0x4393eb['use'](_0xfa23('0x77'),require(_0xfa23('0x78')));_0x4393eb[_0xfa23('0x9')]('/api/triggers',require(_0xfa23('0x79')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x7a'),require(_0xfa23('0x7b')));_0x4393eb[_0xfa23('0x9')]('/api/integrations',require('./api/integration'));_0x4393eb['use'](_0xfa23('0x7c'),require(_0xfa23('0x7d')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x7e'),require(_0xfa23('0x7f')));_0x4393eb[_0xfa23('0x9')]('/api/analytics/default_reports',require(_0xfa23('0x80')));_0x4393eb['use'](_0xfa23('0x81'),require(_0xfa23('0x82')));_0x4393eb['use']('/api/analytics/metrics',require(_0xfa23('0x83')));_0x4393eb['use'](_0xfa23('0x84'),require(_0xfa23('0x85')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x86'),require(_0xfa23('0x87')));_0x4393eb[_0xfa23('0x9')]('/api/integrations/salesforce/accounts',require(_0xfa23('0x88')));_0x4393eb['use'](_0xfa23('0x89'),require('./api/intSalesforceConfiguration'));_0x4393eb[_0xfa23('0x9')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x4393eb[_0xfa23('0x9')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x8a'),require('./api/intSugarcrmConfiguration'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x8b'),require(_0xfa23('0x8c')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x8d'),require(_0xfa23('0x8e')));_0x4393eb['use'](_0xfa23('0x8f'),require(_0xfa23('0x90')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x91'),require(_0xfa23('0x92')));_0x4393eb[_0xfa23('0x9')]('/api/integrations/zoho/accounts',require(_0xfa23('0x93')));_0x4393eb['use'](_0xfa23('0x94'),require(_0xfa23('0x95')));_0x4393eb['use'](_0xfa23('0x96'),require(_0xfa23('0x97')));_0x4393eb['use'](_0xfa23('0x98'),require('./api/intZendeskAccount'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x99'),require(_0xfa23('0x9a')));_0x4393eb['use'](_0xfa23('0x9b'),require(_0xfa23('0x9c')));_0x4393eb[_0xfa23('0x9')]('/api/integrations/freshdesk/accounts',require(_0xfa23('0x9d')));_0x4393eb['use'](_0xfa23('0x9e'),require(_0xfa23('0x9f')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xa0'),require(_0xfa23('0xa1')));_0x4393eb[_0xfa23('0x9')]('/api/integrations/vtiger/accounts',require(_0xfa23('0xa2')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xa3'),require(_0xfa23('0xa4')));_0x4393eb['use'](_0xfa23('0xa5'),require(_0xfa23('0xa6')));_0x4393eb['use'](_0xfa23('0xa7'),require(_0xfa23('0xa8')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xa9'),require(_0xfa23('0xaa')));_0x4393eb[_0xfa23('0x9')]('/api/integrations/servicenow/fields',require(_0xfa23('0xab')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xac'),require(_0xfa23('0xad')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xae'),require('./api/intDynamics365Configuration'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xaf'),require(_0xfa23('0xb0')));_0x4393eb[_0xfa23('0x9')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xb1'),require(_0xfa23('0xb2')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xb3'),require(_0xfa23('0xb4')));_0x4393eb['use'](_0xfa23('0xb5'),require('./api/network'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xb6'),require(_0xfa23('0xb7')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xb8'),require(_0xfa23('0xb9')));_0x4393eb['use'](_0xfa23('0xba'),require('./api/jscriptyAnswerReport'));_0x4393eb['use'](_0xfa23('0xbb'),require('./api/jscriptyQuestionReport'));_0x4393eb[_0xfa23('0x9')]('/api/jscripty/sessions/reports',require(_0xfa23('0xbc')));_0x4393eb['use']('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xbd'),require(_0xfa23('0xbe')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xbf'),require(_0xfa23('0xc0')));_0x4393eb[_0xfa23('0x9')]('/api/jscripty/projects',require(_0xfa23('0xc1')));_0x4393eb['use'](_0xfa23('0xc2'),require(_0xfa23('0xc3')));_0x4393eb['use'](_0xfa23('0xc4'),require(_0xfa23('0xc5')));_0x4393eb['use']('/api/square/projects',require(_0xfa23('0xc6')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xc7'),require(_0xfa23('0xc8')));_0x4393eb[_0xfa23('0x9')]('/api/square/messages',require(_0xfa23('0xc9')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xca'),require(_0xfa23('0xcb')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xcc'),require(_0xfa23('0xcd')));_0x4393eb['use']('/api/campaigns',require(_0xfa23('0xce')));_0x4393eb['use'](_0xfa23('0xcf'),require('./api/migration'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xd0'),require(_0xfa23('0xd1')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xd2'),require(_0xfa23('0xd3')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xd4'),require('./api/mailTransferReport'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xd5'),require(_0xfa23('0xd6')));_0x4393eb['use']('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xd7'),require(_0xfa23('0xd8')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xd9'),require(_0xfa23('0xda')));_0x4393eb[_0xfa23('0x9')]('/api/cm/lists',require(_0xfa23('0xdb')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xdc'),require(_0xfa23('0xdd')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xde'),require(_0xfa23('0xdf')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xe0'),require(_0xfa23('0xe1')));_0x4393eb[_0xfa23('0x9')]('/api/userProfile/resources',require(_0xfa23('0xe2')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xe3'),require(_0xfa23('0xe4')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xe5'),require('./api/whatsappAccount'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xe6'),require('./api/whatsappApplication'));_0x4393eb['use'](_0xfa23('0xe7'),require(_0xfa23('0xe8')));_0x4393eb['use'](_0xfa23('0xe9'),require(_0xfa23('0xea')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xeb'),require(_0xfa23('0xec')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xed'),require(_0xfa23('0xee')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xef'),require(_0xfa23('0xf0')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xf1'),require(_0xfa23('0xf2')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xf3'),require(_0xfa23('0xf4')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xf5'),require('./api/user-setting'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xf6'),require(_0xfa23('0xf7')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xf8'),require('./api/authGoogle'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xf9'),require('./api/authActiveDirectory'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xfa'),require(_0xfa23('0xfb')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xfc'),require('./api/rpc'));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xfd'),require(_0xfa23('0xfe')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0xff'),require(_0xfa23('0x100')));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x101'),require(_0xfa23('0x102')));_0x4393eb['use'](_0xfa23('0x103'),require('./api/webbar'));_0x4393eb['use'](_0xfa23('0x104'),clientSideLogs);_0x4393eb[_0xfa23('0x9')](_0xfa23('0x105'),express['static'](path['join'](config[_0xfa23('0x106')],_0xfa23('0x105'))));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x107'),express[_0xfa23('0x108')](path[_0xfa23('0x109')](config[_0xfa23('0x106')],_0xfa23('0x107'))));_0x4393eb['use'](_0xfa23('0x10a'),express[_0xfa23('0x108')](path[_0xfa23('0x109')](config[_0xfa23('0x106')],_0xfa23('0x10a'))));_0x4393eb[_0xfa23('0x9')]('/snippet',express[_0xfa23('0x108')](path[_0xfa23('0x109')](config[_0xfa23('0x106')],'snippet',_0xfa23('0x10b'))));_0x4393eb[_0xfa23('0x9')](_0xfa23('0x10c'),express[_0xfa23('0x108')](path[_0xfa23('0x109')](config[_0xfa23('0x106')],_0xfa23('0x10d'))));_0x4393eb['route'](_0xfa23('0x10e'))[_0xfa23('0x10f')](errors[0x194]);_0x4393eb[_0xfa23('0x110')]('/*')['get'](function(_0x2780dd,_0x320cd2){_0x320cd2[_0xfa23('0x111')](path[_0xfa23('0x112')](_0x4393eb[_0xfa23('0x10f')](_0xfa23('0x113'))+'/index.html'));});return _0x4393eb;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index ddf9db0..04b22d5 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d74=['../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.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/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc'];(function(_0x5b4cca,_0x269d1f){var _0x55ce74=function(_0x503c52){while(--_0x503c52){_0x5b4cca['push'](_0x5b4cca['shift']());}};_0x55ce74(++_0x269d1f);}(_0x0d74,0x1c9));var _0x40d7=function(_0x5b3d88,_0x370a35){_0x5b3d88=_0x5b3d88-0x0;var _0x2e9d36=_0x0d74[_0x5b3d88];return _0x2e9d36;};'use strict';var jayson=require('jayson/promise');var _=require(_0x40d7('0x0'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x59820e,_0xc5649c){var _0x28cf22={};_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require('../api/user/user.rpc'));_0x28cf22=_['merge'](_0x28cf22,require(_0x40d7('0x2')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x3')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x4')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x5')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x28cf22=_['merge'](_0x28cf22,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x6')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x7')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x8')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x9')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0xa')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0xb')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0xc')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0xd')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0xe')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require('../api/mailMessage/mailMessage.rpc'));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0xf')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x10')));_0x28cf22=_['merge'](_0x28cf22,require(_0x40d7('0x11')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x12')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x13')));_0x28cf22=_['merge'](_0x28cf22,require(_0x40d7('0x14')));_0x28cf22=_['merge'](_0x28cf22,require(_0x40d7('0x15')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x16')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x17')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x18')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x19')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x1a')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x28cf22=_['merge'](_0x28cf22,require(_0x40d7('0x1b')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x1c')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require('../api/chatInteraction/chatInteraction.rpc'));_0x28cf22=_['merge'](_0x28cf22,require('../api/chatMessage/chatMessage.rpc'));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x1d')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x1e')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require('../api/cmHopper/cmHopper.rpc'));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x1f')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x20')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x21')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x22')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x23')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x24')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x25')));_0x28cf22=_['merge'](_0x28cf22,require(_0x40d7('0x26')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x27')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x28')));_0x28cf22=_['merge'](_0x28cf22,require(_0x40d7('0x29')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x2a')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x2b')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x2c')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x2d')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x2e')));_0x28cf22=_['merge'](_0x28cf22,require(_0x40d7('0x2f')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x30')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x31')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x32')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x33')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require('../api/setting/setting.rpc'));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require('../api/squareOdbc/squareOdbc.rpc'));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x34')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x35')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x36')));_0x28cf22=_['merge'](_0x28cf22,require(_0x40d7('0x37')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x38')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x39')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x3a')));_0x28cf22=_['merge'](_0x28cf22,require(_0x40d7('0x3b')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x3c')));_0x28cf22=_[_0x40d7('0x1')](_0x28cf22,require(_0x40d7('0x3d')));var _0xa4b366=jayson[_0x40d7('0x3e')](_0x28cf22)[_0x40d7('0x3f')]();var _0x39780b=config[_0x40d7('0x40')]['port']||config[_0x40d7('0x41')]+0x1;var _0x3fedc3=config[_0x40d7('0x40')]['ip']||'localhost';_0xa4b366['on'](_0x40d7('0x42'),function(_0x16954a){return _0xc5649c(_0x16954a);});_0xa4b366['listen'](_0x39780b,_0x3fedc3,function(){console[_0x40d7('0x43')](_0x40d7('0x44'),_0x3fedc3,_0x39780b);require(_0x40d7('0x45'))[_0x40d7('0x46')]();return _0x59820e(_0x40d7('0x47')+_0x3fedc3+':'+_0x39780b);});});}; \ No newline at end of file +var _0x74ae=['../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.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/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/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/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc'];(function(_0x7730a6,_0x18fe9a){var _0x1a7d71=function(_0xa05329){while(--_0xa05329){_0x7730a6['push'](_0x7730a6['shift']());}};_0x1a7d71(++_0x18fe9a);}(_0x74ae,0x1d6));var _0xe74a=function(_0x4e7a0d,_0xb49b8c){_0x4e7a0d=_0x4e7a0d-0x0;var _0x3ed3d1=_0x74ae[_0x4e7a0d];return _0x3ed3d1;};'use strict';var jayson=require(_0xe74a('0x0'));var _=require(_0xe74a('0x1'));var config=require(_0xe74a('0x2'));exports[_0xe74a('0x3')]=function(){return new Promise(function(_0x5b8ed6,_0x1cbeff){var _0x591aba={};_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0x4')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require('../api/voiceExtension/voiceExtension.rpc'));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x6')));_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0x7')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x8')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x9')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0xa')));_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0xb')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require('../api/memberReport/memberReport.rpc'));_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0xc')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0xd')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0xe')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require('../api/mailAccount/mailAccount.rpc'));_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0xf')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x10')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x11')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x12')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x591aba=_['merge'](_0x591aba,require('../api/faxAccount/faxAccount.rpc'));_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0x13')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require('../api/faxInteraction/faxInteraction.rpc'));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x14')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x15')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x16')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x17')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x18')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require('../api/smsMessage/smsMessage.rpc'));_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0x19')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x1a')));_0x591aba=_['merge'](_0x591aba,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x1b')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x1c')));_0x591aba=_['merge'](_0x591aba,require('../api/chatMessage/chatMessage.rpc'));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x1d')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require('../api/cmContact/cmContact.rpc'));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x1e')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x1f')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x20')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x21')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0x22')));_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0x23')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x24')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x25')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require('../api/template/template.rpc'));_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0x26')));_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0x27')));_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0x28')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x29')));_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0x2a')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x2b')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x2c')));_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0x2d')));_0x591aba=_['merge'](_0x591aba,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x2e')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x2f')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0x30')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x31')));_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0x32')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x33')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x34')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x35')));_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0x36')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require('../api/squareMessage/squareMessage.rpc'));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x37')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x38')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x39')));_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0x3a')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x3b')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x3c')));_0x591aba=_[_0xe74a('0x5')](_0x591aba,require(_0xe74a('0x3d')));_0x591aba=_['merge'](_0x591aba,require(_0xe74a('0x3e')));var _0x1e3aa6=jayson[_0xe74a('0x3f')](_0x591aba)[_0xe74a('0x40')]();var _0x33b322=config[_0xe74a('0x41')][_0xe74a('0x42')]||config[_0xe74a('0x42')]+0x1;var _0x1c5959=config['rpc']['ip']||'localhost';_0x1e3aa6['on']('error',function(_0x8e4792){return _0x1cbeff(_0x8e4792);});_0x1e3aa6[_0xe74a('0x3')](_0x33b322,_0x1c5959,function(){console[_0xe74a('0x43')](_0xe74a('0x44'),_0x1c5959,_0x33b322);require(_0xe74a('0x45'))['default']();return _0x5b8ed6(_0xe74a('0x46')+_0x1c5959+':'+_0x33b322);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 5263324..64d848c 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 _0x0d17=['E_AGI_SOCKET_TIMEOUT','destroy','command','write','inherits','sendRequest','prototype','ANSWER','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','format','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','ready','line','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','timeout'];(function(_0x12d67c,_0x704d2c){var _0x419e0e=function(_0x359aaf){while(--_0x359aaf){_0x12d67c['push'](_0x12d67c['shift']());}};_0x419e0e(++_0x704d2c);}(_0x0d17,0x119));var _0x70d1=function(_0x3a2cce,_0x57f8f6){_0x3a2cce=_0x3a2cce-0x0;var _0x1e277f=_0x0d17[_0x3a2cce];return _0x1e277f;};'use strict';var util=require(_0x70d1('0x0'));var _=require('lodash');var EventEmitter=require(_0x70d1('0x1'))[_0x70d1('0x2')];var AGIReply=require(_0x70d1('0x3'));var AGIError=require(_0x70d1('0x4'));function AGIChannel(_0x45cdaf){var _0x246c62=this,_0x1e2126=new AGIReply(),_0x5751b8=![],_0x497fe7={};EventEmitter[_0x70d1('0x5')](_0x246c62);_0x45cdaf[_0x70d1('0x6')](_0x70d1('0x7'));_0x45cdaf[_0x70d1('0x8')](0x8*0x3c*0x3c*0x3e8);_0x1e2126[_0x70d1('0x6')](_0x70d1('0x7'));_0x1e2126['on'](_0x70d1('0x9'),function(_0x41918a){for(var _0x59a4d5 in _0x41918a){_0x246c62[_0x59a4d5]=_0x41918a[_0x59a4d5];}_0x246c62['emit'](_0x70d1('0xa'));});_0x1e2126['on'](_0x70d1('0xb'),function(_0x21b3af){if(_0x21b3af['toLowerCase']()==_0x70d1('0xc')){_0x246c62[_0x70d1('0xd')](_0x70d1('0xc'));return;}if(_0x21b3af[_0x70d1('0xe')](0x0,0xb)==_0x70d1('0xf')){_0x5751b8=!![];}if(_0x5751b8){_0x497fe7['rx']+=_0x21b3af+'\x0a';if(_0x21b3af[_0x70d1('0x10')](_0x70d1('0x11'))!=-0x1){_0x5751b8=![];}}else{_0x497fe7['rx']=_0x21b3af;}if(_0x5751b8){return;}if(typeof _0x497fe7['cb']==_0x70d1('0x12')){var _0x2d258e=_0x497fe7['rx'][_0x70d1('0xe')](0x0,0x3),_0x4359d5=null,_0xb7899f=null;_0x2d258e=parseInt(_0x2d258e);if(isNaN(_0x2d258e)){_0x497fe7['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x70d1('0x13')});return;}if(_0x2d258e!=0xc8){_0x497fe7['cb'](null,{'code':_0x2d258e,'result':-0x1,'extra':'KO'});return;}_0x4359d5=_0x497fe7['rx'][_0x70d1('0xe')](0x4)[_0x70d1('0x14')]('result=','');if(_0x4359d5[_0x70d1('0x15')]('\x20')!=-0x1){_0x4359d5=_0x4359d5[_0x70d1('0x16')](0x0,_0x4359d5[_0x70d1('0x15')]('\x20'));}if(_[_0x70d1('0x17')](_0x4359d5,'-1')){_0x4359d5=parseInt(_0x4359d5);}_0xb7899f=_0x497fe7['rx'][_0x70d1('0x18')]('\x20');if(_0xb7899f[_0x70d1('0x19')]==0x3){_0xb7899f=_0xb7899f[0x2][_0x70d1('0xe')](0x1,_0xb7899f[0x2][_0x70d1('0x19')]-0x1);}else if(_0xb7899f[_0x70d1('0x19')]>0x3){var _0x5c1f9c=/\((.+)\)/;var _0x5d60df=_0x497fe7['rx']['match'](_0x5c1f9c);if(_0x5d60df){_0xb7899f=_0x5d60df[0x1];}else{_0xb7899f=null;}}else{_0xb7899f=null;}_0x497fe7['cb'](null,{'code':_0x2d258e,'result':_0x4359d5,'extra':_0xb7899f});}});_0x45cdaf['on'](_0x70d1('0x1a'),function(_0x5c78a2){_0x246c62[_0x70d1('0xd')](_0x70d1('0x1a'),new AGIError(_0x70d1('0x1b'),_0x5c78a2[_0x70d1('0x1c')]));});_0x45cdaf['on'](_0x70d1('0x1d'),function(){_0x246c62['emit']('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x45cdaf['on']('timeout',function(){_0x246c62[_0x70d1('0xd')](_0x70d1('0x1e'),new AGIError(_0x70d1('0x1f')));_0x45cdaf[_0x70d1('0x20')]();});_0x45cdaf['pipe'](_0x1e2126);this[_0x70d1('0x21')]=function(_0x389b04,_0x3d7d19){var _0x389b04=_0x389b04||'',_0x3d7d19=typeof _0x3d7d19==_0x70d1('0x12')?_0x3d7d19:new Function();_0x497fe7={'tx':_0x389b04,'rx':'','cb':_0x3d7d19};_0x45cdaf[_0x70d1('0x22')](_0x389b04+'\x0a');},this['close']=function(){_0x45cdaf['destroy']();};}util[_0x70d1('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x70d1('0x24')]=function(_0x1249ef){return this[_0x70d1('0x21')]['sync'](this,_0x1249ef);};AGIChannel[_0x70d1('0x25')]['answer']=function(){return this[_0x70d1('0x24')](_0x70d1('0x26'));};AGIChannel[_0x70d1('0x25')]['getData']=function(_0x382967,_0x4e1fec,_0x61e7ef){_0x382967=_0x382967===undefined?_0x70d1('0x27'):_0x382967;_0x4e1fec=_0x4e1fec===undefined?'5':_0x4e1fec;_0x61e7ef=_0x61e7ef===undefined?'1':_0x61e7ef;return this['sendRequest'](util['format'](_0x70d1('0x28'),_0x382967,_0x4e1fec*0x3e8,_0x61e7ef));};AGIChannel[_0x70d1('0x25')][_0x70d1('0x29')]=function(_0x5db86b){_0x5db86b=_0x5db86b||_0x70d1('0x2a');return this[_0x70d1('0x24')](util['format'](_0x70d1('0x2b'),_0x5db86b));};AGIChannel['prototype'][_0x70d1('0x2c')]=function(_0x5c7d27,_0xe355ee){if(_['isArray'](_0xe355ee)){return this[_0x70d1('0x24')](util[_0x70d1('0x2d')](_0x70d1('0x2e'),_0x5c7d27,_0xe355ee[_0x70d1('0x2f')](',')));}return this[_0x70d1('0x24')](util['format'](_0x70d1('0x2e'),_0x5c7d27,_0xe355ee));};AGIChannel['prototype'][_0x70d1('0x30')]=function(_0x3ac51d){return this[_0x70d1('0x24')](util[_0x70d1('0x2d')](_0x70d1('0x31'),_0x3ac51d));};AGIChannel[_0x70d1('0x25')][_0x70d1('0x32')]=function(_0x334d52){return this['sendRequest'](util['format'](_0x70d1('0x33'),_0x334d52));};AGIChannel[_0x70d1('0x25')][_0x70d1('0x34')]=function(_0x315b3e){return this[_0x70d1('0x24')](util[_0x70d1('0x2d')]('SET\x20PRIORITY\x20%s',_0x315b3e));};AGIChannel['prototype'][_0x70d1('0xc')]=function(){return this[_0x70d1('0x24')](_0x70d1('0x35'));};AGIChannel[_0x70d1('0x25')][_0x70d1('0x36')]=function(_0xdfc9df,_0x4859f7){var _0x3bc558=_['isBoolean'](_0x4859f7)||_[_0x70d1('0x37')](_0x4859f7)?_0x4859f7['toString']():_0x4859f7;return this[_0x70d1('0x24')](util[_0x70d1('0x2d')](_0x70d1('0x38'),_0xdfc9df,_0x3bc558?_0x3bc558['toString']()[_0x70d1('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x70d1('0x39')]=function(_0x26ad0b,_0x5a6e72){return this['sendRequest'](util[_0x70d1('0x2d')](_0x70d1('0x3a'),_0x26ad0b,_0x5a6e72));};AGIChannel[_0x70d1('0x25')][_0x70d1('0x3b')]=function(_0xfc11e9,_0x1b1ae0){return this[_0x70d1('0x24')](util['format']('SAY\x20DIGITS\x20%s\x20%s',_0xfc11e9,_0x1b1ae0));};AGIChannel[_0x70d1('0x25')][_0x70d1('0x3c')]=function(_0xae15bd,_0xeedf63){return this[_0x70d1('0x24')](util[_0x70d1('0x2d')](_0x70d1('0x3d'),_0xae15bd,_0xeedf63));};AGIChannel[_0x70d1('0x25')][_0x70d1('0x3e')]=function(_0x186dd3,_0x19c5cd,_0x4b1f07){_0x19c5cd=_0x19c5cd||this[_0x70d1('0x3f')];_0x4b1f07=_0x4b1f07||0x1;this[_0x70d1('0x30')](_0x186dd3);this[_0x70d1('0x32')](_0x19c5cd);this[_0x70d1('0x34')](_0x4b1f07);return this[_0x70d1('0x29')](util['format'](_0x70d1('0x40'),_0x186dd3,_0x19c5cd,_0x4b1f07));};AGIChannel[_0x70d1('0x25')][_0x70d1('0x41')]=function(_0x5bc7c6){return this[_0x70d1('0x24')](util[_0x70d1('0x2d')](_0x70d1('0x42'),_0x5bc7c6));};AGIChannel[_0x70d1('0x25')][_0x70d1('0x43')]=function(_0x14dc5c,_0x39d5bb,_0xeff3a2,_0x2fef5c,_0x1ba719,_0x5dd69a){_0x39d5bb=_0x39d5bb||_0x70d1('0x44');_0xeff3a2=_0xeff3a2||'';_0x2fef5c=_0x2fef5c===undefined?-0x1:_0x2fef5c==='-1'?-0x1:_0x2fef5c*0x3e8;_0x1ba719=_0x1ba719===undefined?'':'s='+_0x1ba719;_0x5dd69a=_0x5dd69a?_0x70d1('0x45'):'';return this[_0x70d1('0x24')](util[_0x70d1('0x2d')](_0x70d1('0x46'),_0x14dc5c,_0x39d5bb,_0xeff3a2,_0x2fef5c,_0x5dd69a,_0x1ba719));};AGIChannel[_0x70d1('0x25')]['streamFile']=function(_0x3305bd,_0x291b0a){_0x291b0a=_0x291b0a||'';return this[_0x70d1('0x24')](util[_0x70d1('0x2d')](_0x70d1('0x47'),_0x3305bd,_0x291b0a));};AGIChannel[_0x70d1('0x25')][_0x70d1('0x48')]=function(_0x12f2c8){return this[_0x70d1('0x2c')](_0x70d1('0x49'),_0x12f2c8);};AGIChannel['prototype'][_0x70d1('0x4a')]=function(_0x2810b3){return this[_0x70d1('0x2c')](_0x70d1('0x4b'),_0x2810b3);};AGIChannel[_0x70d1('0x25')][_0x70d1('0x1a')]=function(_0x47e38f,_0x5a0095){this[_0x70d1('0x29')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x47e38f['id'],_0x47e38f[_0x70d1('0x4c')],_0x5a0095));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x70d1('0x4d')]=AGIChannel; \ No newline at end of file +var _0x2297=['hangup','substring','520-Invalid','function','no\x20code','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','wait','WAIT','label','lodash','events','EventEmitter','./error','call','utf8','setTimeout','setEncoding','headers','emit','ready','line'];(function(_0x23b5eb,_0x25a261){var _0xad18c=function(_0x1270e3){while(--_0x1270e3){_0x23b5eb['push'](_0x23b5eb['shift']());}};_0xad18c(++_0x25a261);}(_0x2297,0x186));var _0x7229=function(_0x56255e,_0x2e008c){_0x56255e=_0x56255e-0x0;var _0x326431=_0x2297[_0x56255e];return _0x326431;};'use strict';var util=require('util');var _=require(_0x7229('0x0'));var EventEmitter=require(_0x7229('0x1'))[_0x7229('0x2')];var AGIReply=require('./reply');var AGIError=require(_0x7229('0x3'));function AGIChannel(_0x150791){var _0x187313=this,_0x5211b0=new AGIReply(),_0x36caa5=![],_0x4b7667={};EventEmitter[_0x7229('0x4')](_0x187313);_0x150791['setEncoding'](_0x7229('0x5'));_0x150791[_0x7229('0x6')](0x8*0x3c*0x3c*0x3e8);_0x5211b0[_0x7229('0x7')](_0x7229('0x5'));_0x5211b0['on'](_0x7229('0x8'),function(_0x3100bf){for(var _0x15589c in _0x3100bf){_0x187313[_0x15589c]=_0x3100bf[_0x15589c];}_0x187313[_0x7229('0x9')](_0x7229('0xa'));});_0x5211b0['on'](_0x7229('0xb'),function(_0x1ac8a4){if(_0x1ac8a4['toLowerCase']()==_0x7229('0xc')){_0x187313[_0x7229('0x9')](_0x7229('0xc'));return;}if(_0x1ac8a4[_0x7229('0xd')](0x0,0xb)==_0x7229('0xe')){_0x36caa5=!![];}if(_0x36caa5){_0x4b7667['rx']+=_0x1ac8a4+'\x0a';if(_0x1ac8a4['search']('520\x20End\x20of\x20proper')!=-0x1){_0x36caa5=![];}}else{_0x4b7667['rx']=_0x1ac8a4;}if(_0x36caa5){return;}if(typeof _0x4b7667['cb']==_0x7229('0xf')){var _0x3cb1b3=_0x4b7667['rx'][_0x7229('0xd')](0x0,0x3),_0x2286ec=null,_0x4fff3d=null;_0x3cb1b3=parseInt(_0x3cb1b3);if(isNaN(_0x3cb1b3)){_0x4b7667['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x7229('0x10')});return;}if(_0x3cb1b3!=0xc8){_0x4b7667['cb'](null,{'code':_0x3cb1b3,'result':-0x1,'extra':'KO'});return;}_0x2286ec=_0x4b7667['rx'][_0x7229('0xd')](0x4)['replace']('result=','');if(_0x2286ec[_0x7229('0x11')]('\x20')!=-0x1){_0x2286ec=_0x2286ec[_0x7229('0x12')](0x0,_0x2286ec[_0x7229('0x11')]('\x20'));}if(_['startsWith'](_0x2286ec,'-1')){_0x2286ec=parseInt(_0x2286ec);}_0x4fff3d=_0x4b7667['rx'][_0x7229('0x13')]('\x20');if(_0x4fff3d[_0x7229('0x14')]==0x3){_0x4fff3d=_0x4fff3d[0x2][_0x7229('0xd')](0x1,_0x4fff3d[0x2][_0x7229('0x14')]-0x1);}else if(_0x4fff3d['length']>0x3){var _0x42b9c1=/\((.+)\)/;var _0x2b5996=_0x4b7667['rx'][_0x7229('0x15')](_0x42b9c1);if(_0x2b5996){_0x4fff3d=_0x2b5996[0x1];}else{_0x4fff3d=null;}}else{_0x4fff3d=null;}_0x4b7667['cb'](null,{'code':_0x3cb1b3,'result':_0x2286ec,'extra':_0x4fff3d});}});_0x150791['on'](_0x7229('0x16'),function(_0x222138){_0x187313[_0x7229('0x9')](_0x7229('0x16'),new AGIError(_0x7229('0x17'),_0x222138['code']));});_0x150791['on'](_0x7229('0x18'),function(){_0x187313[_0x7229('0x9')](_0x7229('0x18'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x150791['on'](_0x7229('0x19'),function(){_0x187313[_0x7229('0x9')]('timeout',new AGIError(_0x7229('0x1a')));_0x150791[_0x7229('0x1b')]();});_0x150791[_0x7229('0x1c')](_0x5211b0);this[_0x7229('0x1d')]=function(_0x4b5c84,_0x585b66){var _0x4b5c84=_0x4b5c84||'',_0x585b66=typeof _0x585b66=='function'?_0x585b66:new Function();_0x4b7667={'tx':_0x4b5c84,'rx':'','cb':_0x585b66};_0x150791[_0x7229('0x1e')](_0x4b5c84+'\x0a');},this[_0x7229('0x18')]=function(){_0x150791['destroy']();};}util[_0x7229('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x7229('0x20')][_0x7229('0x21')]=function(_0x1355d9){return this['command']['sync'](this,_0x1355d9);};AGIChannel['prototype']['answer']=function(){return this[_0x7229('0x21')](_0x7229('0x22'));};AGIChannel[_0x7229('0x20')][_0x7229('0x23')]=function(_0x5bf347,_0x3bdeb0,_0x1649e2){_0x5bf347=_0x5bf347===undefined?_0x7229('0x24'):_0x5bf347;_0x3bdeb0=_0x3bdeb0===undefined?'5':_0x3bdeb0;_0x1649e2=_0x1649e2===undefined?'1':_0x1649e2;return this[_0x7229('0x21')](util['format'](_0x7229('0x25'),_0x5bf347,_0x3bdeb0*0x3e8,_0x1649e2));};AGIChannel[_0x7229('0x20')][_0x7229('0x26')]=function(_0x19c0d3){_0x19c0d3=_0x19c0d3||_0x7229('0x27');return this[_0x7229('0x21')](util[_0x7229('0x28')]('VERBOSE\x20\x22%s\x22',_0x19c0d3));};AGIChannel['prototype'][_0x7229('0x29')]=function(_0x227442,_0x526262){if(_[_0x7229('0x2a')](_0x526262)){return this[_0x7229('0x21')](util['format'](_0x7229('0x2b'),_0x227442,_0x526262[_0x7229('0x2c')](',')));}return this[_0x7229('0x21')](util['format'](_0x7229('0x2b'),_0x227442,_0x526262));};AGIChannel[_0x7229('0x20')][_0x7229('0x2d')]=function(_0x16295a){return this[_0x7229('0x21')](util['format'](_0x7229('0x2e'),_0x16295a));};AGIChannel[_0x7229('0x20')]['setExtension']=function(_0x3696fc){return this[_0x7229('0x21')](util[_0x7229('0x28')](_0x7229('0x2f'),_0x3696fc));};AGIChannel['prototype'][_0x7229('0x30')]=function(_0x58dc4c){return this[_0x7229('0x21')](util[_0x7229('0x28')](_0x7229('0x31'),_0x58dc4c));};AGIChannel[_0x7229('0x20')][_0x7229('0xc')]=function(){return this[_0x7229('0x21')](_0x7229('0x32'));};AGIChannel[_0x7229('0x20')][_0x7229('0x33')]=function(_0x314cd5,_0x147933){var _0x1f858f=_['isBoolean'](_0x147933)||_['isNumber'](_0x147933)?_0x147933[_0x7229('0x34')]():_0x147933;return this[_0x7229('0x21')](util[_0x7229('0x28')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x314cd5,_0x1f858f?_0x1f858f[_0x7229('0x34')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x7229('0x35')]=function(_0x396cd3,_0x1fa28d){return this['sendRequest'](util[_0x7229('0x28')](_0x7229('0x36'),_0x396cd3,_0x1fa28d));};AGIChannel[_0x7229('0x20')][_0x7229('0x37')]=function(_0x517ba1,_0x44282e){return this[_0x7229('0x21')](util['format']('SAY\x20DIGITS\x20%s\x20%s',_0x517ba1,_0x44282e));};AGIChannel[_0x7229('0x20')][_0x7229('0x38')]=function(_0x18433b,_0x4f6b80){return this[_0x7229('0x21')](util[_0x7229('0x28')](_0x7229('0x39'),_0x18433b,_0x4f6b80));};AGIChannel[_0x7229('0x20')]['continueAt']=function(_0x73b1ab,_0x127033,_0x1ae92c){_0x127033=_0x127033||this['extension'];_0x1ae92c=_0x1ae92c||0x1;this['setContext'](_0x73b1ab);this['setExtension'](_0x127033);this['setPriority'](_0x1ae92c);return this[_0x7229('0x26')](util['format'](_0x7229('0x3a'),_0x73b1ab,_0x127033,_0x1ae92c));};AGIChannel[_0x7229('0x20')]['getVariable']=function(_0x5b0a2c){return this[_0x7229('0x21')](util[_0x7229('0x28')](_0x7229('0x3b'),_0x5b0a2c));};AGIChannel[_0x7229('0x20')]['recordFile']=function(_0x9fe757,_0x260e7d,_0x304a7b,_0x54a5ab,_0x47d477,_0x5e9d06){_0x260e7d=_0x260e7d||'wav';_0x304a7b=_0x304a7b||'';_0x54a5ab=_0x54a5ab===undefined?-0x1:_0x54a5ab==='-1'?-0x1:_0x54a5ab*0x3e8;_0x47d477=_0x47d477===undefined?'':'s='+_0x47d477;_0x5e9d06=_0x5e9d06?_0x7229('0x3c'):'';return this['sendRequest'](util[_0x7229('0x28')](_0x7229('0x3d'),_0x9fe757,_0x260e7d,_0x304a7b,_0x54a5ab,_0x5e9d06,_0x47d477));};AGIChannel[_0x7229('0x20')][_0x7229('0x3e')]=function(_0x7d7620,_0x31816a){_0x31816a=_0x31816a||'';return this[_0x7229('0x21')](util[_0x7229('0x28')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x7d7620,_0x31816a));};AGIChannel[_0x7229('0x20')][_0x7229('0x3f')]=function(_0x3cfc0e){return this[_0x7229('0x29')]('AGI',_0x3cfc0e);};AGIChannel[_0x7229('0x20')][_0x7229('0x40')]=function(_0x281138){return this['exec'](_0x7229('0x41'),_0x281138);};AGIChannel[_0x7229('0x20')][_0x7229('0x16')]=function(_0x30c885,_0x305445){this['noop'](util[_0x7229('0x28')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x30c885['id'],_0x30c885[_0x7229('0x42')],_0x305445));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 73ee4a1..aeab09d 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 _0x7eab=['E_AGI_UNDEFINED','push','format','apply','message','name','util','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7eab,0x1d6));var _0xb7ea=function(_0x20e210,_0x3cb35e){_0x20e210=_0x20e210-0x0;var _0x4d6937=_0x7eab[_0x20e210];return _0x4d6937;};'use strict';var util=require(_0xb7ea('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xb7ea('0x1'),'E_AGI_SERVER_CLOSE':_0xb7ea('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xb7ea('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xb7ea('0x4'),'E_AGI_SOCKET_CLOSE':_0xb7ea('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xb7ea('0x6'),'E_AGI_COMMAND_EMPTY':_0xb7ea('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xb7ea('0x8'),'E_AGI_IVR_ENTRY':_0xb7ea('0x9')};function AGIError(_0xd51c1b){var _0xd51c1b=_0xd51c1b||null,_0x4a4028=_0x4a4028||[],_0x5a3bc2=0x1,_0x3dfbca='';if(!error[_0xd51c1b]){_0xd51c1b=_0xb7ea('0xa');}_0x4a4028[_0xb7ea('0xb')](error[_0xd51c1b]);while(arguments[_0x5a3bc2]){_0x4a4028['push'](arguments[_0x5a3bc2]);_0x5a3bc2++;}_0x3dfbca=util[_0xb7ea('0xc')][_0xb7ea('0xd')](util,_0x4a4028);this[_0xb7ea('0xe')]=_0x3dfbca;this[_0xb7ea('0xf')]=_0xd51c1b;}module['exports']=AGIError; \ No newline at end of file +var _0x9249=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x9249,0x1b5));var _0x9924=function(_0x3f993e,_0x2d5757){_0x3f993e=_0x3f993e-0x0;var _0x39c135=_0x9249[_0x3f993e];return _0x39c135;};'use strict';var util=require(_0x9924('0x0'));var error={'E_AGI_UNDEFINED':_0x9924('0x1'),'E_AGI_ARGUMENT_PORT':_0x9924('0x2'),'E_AGI_SERVER_ERROR':_0x9924('0x3'),'E_AGI_SERVER_CLOSE':_0x9924('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x9924('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x9924('0x6'),'E_AGI_SOCKET_ERROR':_0x9924('0x7'),'E_AGI_SOCKET_CLOSE':_0x9924('0x8'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x9924('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x9924('0xa'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x39f4c4){var _0x39f4c4=_0x39f4c4||null,_0x573ee8=_0x573ee8||[],_0x44ab87=0x1,_0x17e9fe='';if(!error[_0x39f4c4]){_0x39f4c4=_0x9924('0xb');}_0x573ee8[_0x9924('0xc')](error[_0x39f4c4]);while(arguments[_0x44ab87]){_0x573ee8['push'](arguments[_0x44ab87]);_0x44ab87++;}_0x17e9fe=util['format'][_0x9924('0xd')](util,_0x573ee8);this[_0x9924('0xe')]=_0x17e9fe;this[_0x9924('0xf')]=_0x39f4c4;}module[_0x9924('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 2758911..70d7fa3 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 _0xe716=['length','condition','split','agicommand','vswitch','target','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','lodash','menu','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','size','relations','getVertex','traverseBFS','info','stop\x20traverse','no\x20edge/s\x20available'];(function(_0x38231c,_0x1a5931){var _0x5be4e8=function(_0x15bfb0){while(--_0x15bfb0){_0x38231c['push'](_0x38231c['shift']());}};_0x5be4e8(++_0x1a5931);}(_0xe716,0x77));var _0x6e71=function(_0x30d5bf,_0xbdb85b){_0x30d5bf=_0x30d5bf-0x0;var _0x2977d7=_0xe716[_0x30d5bf];return _0x2977d7;};'use strict';var _=require(_0x6e71('0x0'));var logger=require('../../../config/logger')('agi');var verticesWithRetry=[_0x6e71('0x1'),'getdigits',_0x6e71('0x2')];var Graph=function(){this[_0x6e71('0x3')]={};this[_0x6e71('0x4')]={};this[_0x6e71('0x5')]=0x0;};Graph[_0x6e71('0x6')][_0x6e71('0x7')]=function(_0x65a50){this[_0x6e71('0x3')][_0x65a50['id']]=_0x65a50;this[_0x6e71('0x4')][_0x65a50['id']]=[];};Graph['prototype'][_0x6e71('0x8')]=function(_0x38b140,_0x20b225,_0x16636b){this[_0x6e71('0x4')][_0x38b140]['push']({'target':_0x20b225,'condition':_0x16636b});this[_0x6e71('0x5')]+=0x1;};Graph[_0x6e71('0x6')]['size']=function(){return _[_0x6e71('0x9')](this['vertices']);};Graph[_0x6e71('0x6')][_0x6e71('0xa')]=function(){return this[_0x6e71('0x5')];};Graph[_0x6e71('0x6')][_0x6e71('0xb')]=function(_0x22bee7){return this[_0x6e71('0x3')][_0x22bee7];};Graph[_0x6e71('0x6')][_0x6e71('0xc')]=function(_0x28846b,_0x9fd065){if(!this[_0x6e71('0x3')][_0x28846b]){return logger[_0x6e71('0xd')]('no\x20vertex\x20found');}var _0x596716=_0x9fd065(this[_0x6e71('0x3')][_0x28846b]);if(!_0x596716){return logger[_0x6e71('0xd')](_0x6e71('0xe'));}if(this['edges'][_0x28846b]['length']===0x0){return logger[_0x6e71('0xd')](_0x6e71('0xf'));}for(var _0x332ce7=0x0,_0x166841=[],_0xb94040=![];_0x332ce7\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','uniqueid','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','mxGraphModel','agicommand','hasOwnProperty','retry','maxRetry','mxCell','length','target','addEdge','source','value','getSquareProject','then','catch','indexOf','agi_','stringify','close','hangup','sync','production','debug','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','start','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString'];(function(_0x30ae91,_0x3295f5){var _0x3f182b=function(_0x1dc94f){while(--_0x1dc94f){_0x30ae91['push'](_0x30ae91['shift']());}};_0x3f182b(++_0x3295f5);}(_0x9e94,0x16a));var _0x49e9=function(_0x58e00b,_0x5e6b48){_0x58e00b=_0x58e00b-0x0;var _0x3a1431=_0x9e94[_0x58e00b];return _0x3a1431;};'use strict';var parser=require(_0x49e9('0x0'));var _=require(_0x49e9('0x1'));var syncho=require(_0x49e9('0x2'));var util=require(_0x49e9('0x3'));var moment=require(_0x49e9('0x4'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x49e9('0x5'));var utilLicense=require(_0x49e9('0x6'));var rpc=require(_0x49e9('0x7'));var mailRpc=require(_0x49e9('0x8'));var Graph=require(_0x49e9('0x9'));var Vertices=require(_0x49e9('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x49e9('0x5')]=_[_0x49e9('0xb')](config[_0x49e9('0x5')],{'ip':_0x49e9('0xc'),'port':0x11dd});function connectionHandler(_0x12465){process[_0x49e9('0xd')](function(){syncho(function(){try{setChannelVariables(_0x12465);agiHandler(_0x12465);}catch(_0x447326){logger[_0x49e9('0xe')](_0x447326['stack']);}});});}function listeningHandler(){console[_0x49e9('0xf')](_0x49e9('0x10'),config[_0x49e9('0x5')][_0x49e9('0x11')]);logger['info'](util['format'](_0x49e9('0x12'),config[_0x49e9('0x5')]['ip'],config[_0x49e9('0x5')]['port']));}function errorHandler(_0x4d876e){if(_0x4d876e&&_0x4d876e[_0x49e9('0x13')]&&_0x4d876e[_0x49e9('0x14')]){logger[_0x49e9('0xe')](util[_0x49e9('0x15')](_0x49e9('0x16'),_0x4d876e[_0x49e9('0x13')],_0x4d876e[_0x49e9('0x14')]));}else{logger['error'](util[_0x49e9('0x15')]('[ERROR]\x20%s',_0x4d876e[_0x49e9('0x17')]));}}function closeHandler(){logger['info'](util[_0x49e9('0x15')](_0x49e9('0x18'),this['arg_1'],this[_0x49e9('0x19')],this[_0x49e9('0x1a')],this['dnid'],this[_0x49e9('0x1b')]));try{createSquareReport(this);}catch(_0x37470d){logger[_0x49e9('0xe')](_0x37470d[_0x49e9('0x17')]);}}function timeoutHandler(){logger[_0x49e9('0x1c')](util[_0x49e9('0x15')](_0x49e9('0x1d'),this[_0x49e9('0x1e')],this['calleridname'],this[_0x49e9('0x1a')],this[_0x49e9('0x1f')],this[_0x49e9('0x1b')]));}function hangupHandler(){logger['info'](util[_0x49e9('0x15')](_0x49e9('0x20'),this[_0x49e9('0x1e')],this['calleridname'],this[_0x49e9('0x1a')],this[_0x49e9('0x1f')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x59bc95){return parser['toJson'](_0x59bc95,{'object':!![]})[_0x49e9('0x21')]['root'];}function addVertex(_0xaf9fca,_0x5ce8fa,_0x4236e3){_0x5ce8fa[_0x49e9('0x22')]=_0x4236e3;if(_0x5ce8fa[_0x49e9('0x23')](_0x49e9('0x24'))){_0x5ce8fa[_0x49e9('0x25')]=parseInt(_0x5ce8fa[_0x49e9('0x24')],0xa);}_0xaf9fca['addVertex'](_['omit'](_0x5ce8fa,_0x49e9('0x26')));}function initGraph(_0x352901,_0x4d75f0){var _0x597d0f=new Graph();for(var _0x4f4a6d in _0x352901){if(_0x352901[_0x49e9('0x23')](_0x4f4a6d)){if(_['isArray'](_0x352901[_0x4f4a6d])){for(var _0x227cd5=0x0;_0x227cd5<_0x352901[_0x4f4a6d][_0x49e9('0x27')];_0x227cd5+=0x1){addVertex(_0x597d0f,_0x352901[_0x4f4a6d][_0x227cd5],_0x4f4a6d);}}else{addVertex(_0x597d0f,_0x352901[_0x4f4a6d],_0x4f4a6d);}}}for(var _0x339f45=0x0;_0x339f45<_0x4d75f0[_0x49e9('0x27')];_0x339f45+=0x1){if(_0x4d75f0[_0x339f45]['source']&&_0x4d75f0[_0x339f45][_0x49e9('0x28')]){_0x597d0f[_0x49e9('0x29')](_0x4d75f0[_0x339f45][_0x49e9('0x2a')],_0x4d75f0[_0x339f45][_0x49e9('0x28')],_0x4d75f0[_0x339f45][_0x49e9('0x2b')]);}}return _0x597d0f;}function getSquareProject(_0x446bb8,_0x56f4b5){rpc[_0x49e9('0x2c')](_0x446bb8)[_0x49e9('0x2d')](function(_0x150204){_0x56f4b5(null,_0x150204);})[_0x49e9('0x2e')](function(_0x25d6d6){_0x56f4b5(null,_0x25d6d6);});}function createSquareReport(_0x2fb831,_0x25523e){rpc['createSquareReport'](_0x2fb831)[_0x49e9('0x2d')](function(_0x123849){if(_0x25523e){_0x25523e(null,_0x123849);}})[_0x49e9('0x2e')](function(_0x31f722){if(_0x25523e){_0x25523e(null,_0x31f722);}});}function setChannelVariables(_0x1c0d8b){for(var _0x2bd1cf in _0x1c0d8b){if(_0x1c0d8b['hasOwnProperty'](_0x2bd1cf)){if(_0x2bd1cf[_0x49e9('0x2f')](_0x49e9('0x30'))===0x0){_0x1c0d8b[_0x2bd1cf['substring'](0x4)]=_0x1c0d8b[_0x2bd1cf];delete _0x1c0d8b[_0x2bd1cf];}}}}function getLogFromObject(_0x18e58d){return util['inspect'](_0x18e58d,{'showHidden':![],'depth':null});}function agiHandler(_0x272cb6){var _0x168a4a,_0x1524ff,_0x2dc823,_0x1dc69e,_0x4033ef;logger['debug']('variables',JSON[_0x49e9('0x31')](_0x272cb6,null,0x2));logger['info'](util[_0x49e9('0x15')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x272cb6[_0x49e9('0x1e')],_0x272cb6[_0x49e9('0x19')],_0x272cb6[_0x49e9('0x1a')],_0x272cb6[_0x49e9('0x1f')],_0x272cb6[_0x49e9('0x1b')]));_0x272cb6['on'](_0x49e9('0xe'),errorHandler);_0x272cb6['on'](_0x49e9('0x32'),closeHandler);_0x272cb6['on']('timeout',timeoutHandler);_0x272cb6['evtHangup']=![];_0x272cb6['on'](_0x49e9('0x33'),hangupHandler);var _0x1883df=getSquareProject[_0x49e9('0x34')](null,_0x272cb6[_0x49e9('0x1e')]);if(_0x1883df){if(_0x1883df[_0x49e9('0x35')]){_0x168a4a=getRoot(_0x1883df[_0x49e9('0x35')]);if(_0x168a4a&&_0x168a4a['start']){logger[_0x49e9('0x36')](_0x49e9('0x37'),JSON[_0x49e9('0x31')](_0x168a4a,null,0x2));_0x272cb6[_0x49e9('0x38')]=moment()[_0x49e9('0x15')](_0x49e9('0x39'));_0x1524ff=initGraph(_[_0x49e9('0x3a')](_0x168a4a,_0x49e9('0x26')),_0x168a4a[_0x49e9('0x26')]);_0x2dc823=new Vertices(_0x272cb6,rpc,mailRpc);logger[_0x49e9('0x1c')](util[_0x49e9('0x15')](_0x49e9('0x3b'),_0x272cb6['arg_1'],_0x272cb6[_0x49e9('0x19')],_0x272cb6[_0x49e9('0x1a')],_0x272cb6['dnid'],_0x272cb6[_0x49e9('0x1b')]));_0x1524ff['traverseBFS'](_0x168a4a[_0x49e9('0x3c')]['id'],function(_0x1e7ffa){try{_0x1e7ffa=_0x2dc823[_0x49e9('0x3d')](_0x1e7ffa);logger['debug'](_0x49e9('0x3e'),JSON[_0x49e9('0x31')](_0x1e7ffa,null,0x2));if(_0x1e7ffa['agicommand']===_0x49e9('0x3f')){logger[_0x49e9('0x1c')](_0x49e9('0x40'));_0x272cb6[_0x49e9('0x41')]=_0x1e7ffa[_0x49e9('0x41')]||_0x272cb6[_0x49e9('0x41')];_0x272cb6[_0x49e9('0x42')]=_0x1e7ffa[_0x49e9('0x42')];_0x272cb6[_0x49e9('0x43')]=_0x1e7ffa[_0x49e9('0x43')]?_0x1e7ffa[_0x49e9('0x43')]-0x1:0x1;return null;}else if(_0x1e7ffa&&_0x2dc823[_0x1e7ffa['agicommand']]){_0x4033ef=_0x2dc823[_0x1e7ffa[_0x49e9('0x22')]](_0x1e7ffa);logger[_0x49e9('0x1c')](_0x49e9('0x44'),JSON[_0x49e9('0x31')](_0x4033ef,null,0x2));if(_0x4033ef&&_0x4033ef[_0x49e9('0x45')]===AGI_CODE_SUCCESS&&_0x4033ef[_0x49e9('0x46')]!==AGI_RESULT_ERROR&&!_0x272cb6['evtHangup']){logger[_0x49e9('0x36')](_0x49e9('0x44'),getLogFromObject(_0x4033ef));return _[_0x49e9('0x47')](_0x4033ef['result'])?null:_0x4033ef[_0x49e9('0x46')][_0x49e9('0x48')]();}else{logger[_0x49e9('0xe')]('response',getLogFromObject(_0x4033ef));return null;}}else{logger[_0x49e9('0xe')](_0x49e9('0x49'));return null;}}catch(_0x4e68eb){logger['error'](_0x4e68eb['stack']);return null;}});if(_0x168a4a['finally']){logger[_0x49e9('0x1c')](util[_0x49e9('0x15')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x272cb6[_0x49e9('0x1e')],_0x272cb6[_0x49e9('0x19')],_0x272cb6[_0x49e9('0x1a')],_0x272cb6[_0x49e9('0x1f')],_0x272cb6[_0x49e9('0x1b')]));_0x1524ff[_0x49e9('0x4a')](_0x168a4a['finally']['id'],function(_0x450af1){try{_0x450af1=_0x2dc823[_0x49e9('0x3d')](_0x450af1);logger[_0x49e9('0x36')](_0x49e9('0x3e'),JSON['stringify'](_0x450af1,null,0x2));if(_0x450af1&&_0x2dc823[_0x450af1['agicommand']]){_0x4033ef=_0x2dc823[_0x450af1['agicommand']](_0x450af1);if(_0x4033ef){logger['debug'](_0x49e9('0x44'),getLogFromObject(_0x4033ef));return _[_0x49e9('0x47')](_0x4033ef[_0x49e9('0x46')])?null:_0x4033ef[_0x49e9('0x46')]['toString']();}else{logger[_0x49e9('0xe')](_0x49e9('0x44'),getLogFromObject(_0x4033ef));return null;}}else{logger[_0x49e9('0xe')](_0x49e9('0x49'));return null;}}catch(_0x333f3f){logger[_0x49e9('0xe')](_0x333f3f[_0x49e9('0x17')]);return null;}});}logger[_0x49e9('0x1c')](util[_0x49e9('0x15')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x272cb6[_0x49e9('0x1e')],_0x272cb6[_0x49e9('0x19')],_0x272cb6[_0x49e9('0x1a')],_0x272cb6[_0x49e9('0x1f')],_0x272cb6[_0x49e9('0x1b')]));logger[_0x49e9('0x1c')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x272cb6[_0x49e9('0x41')],_0x272cb6['extension'],parseInt(_0x272cb6[_0x49e9('0x43')],0xa)+0x1));_0x272cb6[_0x49e9('0x4b')](_0x272cb6[_0x49e9('0x41')],_0x272cb6['extension'],parseInt(_0x272cb6[_0x49e9('0x43')],0xa)+0x1);_0x272cb6['close']();}}else{logger[_0x49e9('0xe')](util[_0x49e9('0x15')](_0x49e9('0x4c'),_0x272cb6[_0x49e9('0x1e')]));_0x272cb6[_0x49e9('0x4b')](_0x272cb6['context'],_0x272cb6[_0x49e9('0x42')],parseInt(_0x272cb6[_0x49e9('0x43')],0xa)+0x1);_0x272cb6['close']();}}else{logger[_0x49e9('0xe')](util[_0x49e9('0x15')](_0x49e9('0x4d'),_0x272cb6[_0x49e9('0x1e')]));_0x272cb6[_0x49e9('0x4b')](_0x272cb6[_0x49e9('0x41')],_0x272cb6[_0x49e9('0x42')],parseInt(_0x272cb6[_0x49e9('0x43')],0xa)+0x1);_0x272cb6[_0x49e9('0x32')]();}}function main(){var _0x2bdcf0;return utilLicense[_0x49e9('0x4e')]()['then'](function(_0x3cb7e4){if(_0x3cb7e4){if(_0x3cb7e4[_0x49e9('0x4f')]){if(_0x3cb7e4[_0x49e9('0x50')]&&_0x3cb7e4[_0x49e9('0x50')]>0x0){logger[_0x49e9('0x1c')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x3cb7e4[_0x49e9('0x50')]));_0x2bdcf0=_0x3cb7e4['callysquare'];}else{logger['info'](_0x49e9('0x51'));}}else{logger[_0x49e9('0x1c')](_0x49e9('0x52'));_0x2bdcf0=-0x1;}}})[_0x49e9('0x2e')](function(_0x5df873){logger[_0x49e9('0xe')]('[LICENSE]',_0x5df873[_0x49e9('0x17')]);})[_0x49e9('0x53')](function(){var _0x3620ce=require(_0x49e9('0x54'))(config[_0x49e9('0x5')]['port'],config[_0x49e9('0x5')]['ip'],_0x2bdcf0);_0x3620ce['on']('error',errorHandler);_0x3620ce['on'](_0x49e9('0x55'),listeningHandler);_0x3620ce['on'](_0x49e9('0x56'),connectionHandler);_0x3620ce['on'](_0x49e9('0x32'),closeHandler);});}main(); \ No newline at end of file +var _0x4ae2=['priority','response','code','result','isUndefined','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','xml2json','lodash','syncho','util','moment','../../config/logger','agi','../../config/license/util','./rpc','./graph','defaults','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','addVertex','omit','isArray','length','source','addEdge','target','value','then','catch','indexOf','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','sync','production','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','clear','gotoc','context','extension'];(function(_0x5eb65f,_0x2b90bf){var _0x305552=function(_0x52eb1b){while(--_0x52eb1b){_0x5eb65f['push'](_0x5eb65f['shift']());}};_0x305552(++_0x2b90bf);}(_0x4ae2,0xc9));var _0x24ae=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x4ae2[_0x31ced5];return _0x10d9e5;};'use strict';var parser=require(_0x24ae('0x0'));var _=require(_0x24ae('0x1'));var syncho=require(_0x24ae('0x2'));var util=require(_0x24ae('0x3'));var moment=require(_0x24ae('0x4'));var config=require('../../config/environment');var logger=require(_0x24ae('0x5'))(_0x24ae('0x6'));var utilLicense=require(_0x24ae('0x7'));var rpc=require(_0x24ae('0x8'));var mailRpc=require('./mailRpc');var Graph=require(_0x24ae('0x9'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x24ae('0x6')]=_[_0x24ae('0xa')](config[_0x24ae('0x6')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x463384){process[_0x24ae('0xb')](function(){syncho(function(){try{setChannelVariables(_0x463384);agiHandler(_0x463384);}catch(_0x241997){logger[_0x24ae('0xc')](_0x241997[_0x24ae('0xd')]);}});});}function listeningHandler(){console[_0x24ae('0xe')](_0x24ae('0xf'),config[_0x24ae('0x6')][_0x24ae('0x10')]);logger[_0x24ae('0x11')](util[_0x24ae('0x12')](_0x24ae('0x13'),config[_0x24ae('0x6')]['ip'],config[_0x24ae('0x6')][_0x24ae('0x10')]));}function errorHandler(_0x2bb757){if(_0x2bb757&&_0x2bb757[_0x24ae('0x14')]&&_0x2bb757[_0x24ae('0x15')]){logger['error'](util[_0x24ae('0x12')](_0x24ae('0x16'),_0x2bb757['name'],_0x2bb757['message']));}else{logger[_0x24ae('0xc')](util[_0x24ae('0x12')](_0x24ae('0x17'),_0x2bb757[_0x24ae('0xd')]));}}function closeHandler(){logger[_0x24ae('0x11')](util[_0x24ae('0x12')](_0x24ae('0x18'),this[_0x24ae('0x19')],this[_0x24ae('0x1a')],this['callerid'],this[_0x24ae('0x1b')],this[_0x24ae('0x1c')]));try{createSquareReport(this);}catch(_0x36a0e2){logger[_0x24ae('0xc')](_0x36a0e2[_0x24ae('0xd')]);}}function timeoutHandler(){logger[_0x24ae('0x11')](util[_0x24ae('0x12')](_0x24ae('0x1d'),this[_0x24ae('0x19')],this[_0x24ae('0x1a')],this[_0x24ae('0x1e')],this['dnid'],this[_0x24ae('0x1c')]));}function hangupHandler(){logger['info'](util[_0x24ae('0x12')](_0x24ae('0x1f'),this[_0x24ae('0x19')],this[_0x24ae('0x1a')],this[_0x24ae('0x1e')],this[_0x24ae('0x1b')],this[_0x24ae('0x1c')]));this[_0x24ae('0x20')]=!![];}function getRoot(_0x497ffa){return parser[_0x24ae('0x21')](_0x497ffa,{'object':!![]})[_0x24ae('0x22')][_0x24ae('0x23')];}function addVertex(_0x37aa22,_0x5660b6,_0x526868){_0x5660b6[_0x24ae('0x24')]=_0x526868;if(_0x5660b6[_0x24ae('0x25')]('retry')){_0x5660b6['maxRetry']=parseInt(_0x5660b6[_0x24ae('0x26')],0xa);}_0x37aa22[_0x24ae('0x27')](_[_0x24ae('0x28')](_0x5660b6,'mxCell'));}function initGraph(_0x347bf8,_0x3ff4ac){var _0x25543a=new Graph();for(var _0x3c6c1f in _0x347bf8){if(_0x347bf8[_0x24ae('0x25')](_0x3c6c1f)){if(_[_0x24ae('0x29')](_0x347bf8[_0x3c6c1f])){for(var _0x44987c=0x0;_0x44987c<_0x347bf8[_0x3c6c1f][_0x24ae('0x2a')];_0x44987c+=0x1){addVertex(_0x25543a,_0x347bf8[_0x3c6c1f][_0x44987c],_0x3c6c1f);}}else{addVertex(_0x25543a,_0x347bf8[_0x3c6c1f],_0x3c6c1f);}}}for(var _0x349c37=0x0;_0x349c37<_0x3ff4ac[_0x24ae('0x2a')];_0x349c37+=0x1){if(_0x3ff4ac[_0x349c37][_0x24ae('0x2b')]&&_0x3ff4ac[_0x349c37]['target']){_0x25543a[_0x24ae('0x2c')](_0x3ff4ac[_0x349c37][_0x24ae('0x2b')],_0x3ff4ac[_0x349c37][_0x24ae('0x2d')],_0x3ff4ac[_0x349c37][_0x24ae('0x2e')]);}}return _0x25543a;}function getSquareProject(_0x5a59af,_0x145f54){rpc['getSquareProject'](_0x5a59af)['then'](function(_0x2a608a){_0x145f54(null,_0x2a608a);})['catch'](function(_0x1a6643){_0x145f54(null,_0x1a6643);});}function createSquareReport(_0x314776,_0x4d0b38){rpc['createSquareReport'](_0x314776)[_0x24ae('0x2f')](function(_0x1e2017){if(_0x4d0b38){_0x4d0b38(null,_0x1e2017);}})[_0x24ae('0x30')](function(_0x33fd45){if(_0x4d0b38){_0x4d0b38(null,_0x33fd45);}});}function setChannelVariables(_0x1e796a){for(var _0x373225 in _0x1e796a){if(_0x1e796a[_0x24ae('0x25')](_0x373225)){if(_0x373225[_0x24ae('0x31')]('agi_')===0x0){_0x1e796a[_0x373225['substring'](0x4)]=_0x1e796a[_0x373225];delete _0x1e796a[_0x373225];}}}}function getLogFromObject(_0x3581e9){return util[_0x24ae('0x32')](_0x3581e9,{'showHidden':![],'depth':null});}function agiHandler(_0x275bce){var _0x4ef937,_0x417245,_0x5043b9,_0xe06f54,_0x24c1c5;logger['debug'](_0x24ae('0x33'),JSON[_0x24ae('0x34')](_0x275bce,null,0x2));logger[_0x24ae('0x11')](util[_0x24ae('0x12')](_0x24ae('0x35'),_0x275bce[_0x24ae('0x19')],_0x275bce[_0x24ae('0x1a')],_0x275bce['callerid'],_0x275bce[_0x24ae('0x1b')],_0x275bce[_0x24ae('0x1c')]));_0x275bce['on']('error',errorHandler);_0x275bce['on'](_0x24ae('0x36'),closeHandler);_0x275bce['on']('timeout',timeoutHandler);_0x275bce['evtHangup']=![];_0x275bce['on'](_0x24ae('0x37'),hangupHandler);var _0xd15a78=getSquareProject[_0x24ae('0x38')](null,_0x275bce[_0x24ae('0x19')]);if(_0xd15a78){if(_0xd15a78['production']){_0x4ef937=getRoot(_0xd15a78[_0x24ae('0x39')]);if(_0x4ef937&&_0x4ef937['start']){logger[_0x24ae('0x3a')](_0x24ae('0x23'),JSON['stringify'](_0x4ef937,null,0x2));_0x275bce[_0x24ae('0x3b')]=moment()[_0x24ae('0x12')](_0x24ae('0x3c'));_0x417245=initGraph(_[_0x24ae('0x28')](_0x4ef937,_0x24ae('0x3d')),_0x4ef937[_0x24ae('0x3d')]);_0x5043b9=new Vertices(_0x275bce,rpc,mailRpc);logger['info'](util['format'](_0x24ae('0x3e'),_0x275bce[_0x24ae('0x19')],_0x275bce['calleridname'],_0x275bce[_0x24ae('0x1e')],_0x275bce[_0x24ae('0x1b')],_0x275bce[_0x24ae('0x1c')]));_0x417245[_0x24ae('0x3f')](_0x4ef937[_0x24ae('0x40')]['id'],function(_0x2ab45c){try{_0x2ab45c=_0x5043b9[_0x24ae('0x41')](_0x2ab45c);logger[_0x24ae('0x3a')]('vertex',JSON['stringify'](_0x2ab45c,null,0x2));if(_0x2ab45c[_0x24ae('0x24')]===_0x24ae('0x42')){logger[_0x24ae('0x11')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x275bce['context']=_0x2ab45c[_0x24ae('0x43')]||_0x275bce['context'];_0x275bce[_0x24ae('0x44')]=_0x2ab45c[_0x24ae('0x44')];_0x275bce[_0x24ae('0x45')]=_0x2ab45c[_0x24ae('0x45')]?_0x2ab45c['priority']-0x1:0x1;return null;}else if(_0x2ab45c&&_0x5043b9[_0x2ab45c[_0x24ae('0x24')]]){_0x24c1c5=_0x5043b9[_0x2ab45c['agicommand']](_0x2ab45c);logger['info'](_0x24ae('0x46'),JSON[_0x24ae('0x34')](_0x24c1c5,null,0x2));if(_0x24c1c5&&_0x24c1c5[_0x24ae('0x47')]===AGI_CODE_SUCCESS&&_0x24c1c5[_0x24ae('0x48')]!==AGI_RESULT_ERROR&&!_0x275bce[_0x24ae('0x20')]){logger[_0x24ae('0x3a')]('response',getLogFromObject(_0x24c1c5));return _[_0x24ae('0x49')](_0x24c1c5[_0x24ae('0x48')])?null:_0x24c1c5[_0x24ae('0x48')]['toString']();}else{logger[_0x24ae('0xc')](_0x24ae('0x46'),getLogFromObject(_0x24c1c5));return null;}}else{logger[_0x24ae('0xc')](_0x24ae('0x4a'));return null;}}catch(_0x957b9a){logger[_0x24ae('0xc')](_0x957b9a[_0x24ae('0xd')]);return null;}});if(_0x4ef937['finally']){logger[_0x24ae('0x11')](util[_0x24ae('0x12')](_0x24ae('0x4b'),_0x275bce[_0x24ae('0x19')],_0x275bce[_0x24ae('0x1a')],_0x275bce[_0x24ae('0x1e')],_0x275bce[_0x24ae('0x1b')],_0x275bce['uniqueid']));_0x417245[_0x24ae('0x3f')](_0x4ef937[_0x24ae('0x4c')]['id'],function(_0x237016){try{_0x237016=_0x5043b9['clear'](_0x237016);logger['debug'](_0x24ae('0x4d'),JSON['stringify'](_0x237016,null,0x2));if(_0x237016&&_0x5043b9[_0x237016[_0x24ae('0x24')]]){_0x24c1c5=_0x5043b9[_0x237016[_0x24ae('0x24')]](_0x237016);if(_0x24c1c5){logger['debug'](_0x24ae('0x46'),getLogFromObject(_0x24c1c5));return _['isUndefined'](_0x24c1c5[_0x24ae('0x48')])?null:_0x24c1c5['result']['toString']();}else{logger[_0x24ae('0xc')](_0x24ae('0x46'),getLogFromObject(_0x24c1c5));return null;}}else{logger[_0x24ae('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x3e625f){logger[_0x24ae('0xc')](_0x3e625f[_0x24ae('0xd')]);return null;}});}logger['info'](util[_0x24ae('0x12')](_0x24ae('0x4e'),_0x275bce[_0x24ae('0x19')],_0x275bce[_0x24ae('0x1a')],_0x275bce[_0x24ae('0x1e')],_0x275bce[_0x24ae('0x1b')],_0x275bce[_0x24ae('0x1c')]));logger[_0x24ae('0x11')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x275bce['context'],_0x275bce['extension'],parseInt(_0x275bce[_0x24ae('0x45')],0xa)+0x1));_0x275bce[_0x24ae('0x4f')](_0x275bce[_0x24ae('0x43')],_0x275bce[_0x24ae('0x44')],parseInt(_0x275bce[_0x24ae('0x45')],0xa)+0x1);_0x275bce[_0x24ae('0x36')]();}}else{logger[_0x24ae('0xc')](util[_0x24ae('0x12')](_0x24ae('0x50'),_0x275bce[_0x24ae('0x19')]));_0x275bce[_0x24ae('0x4f')](_0x275bce[_0x24ae('0x43')],_0x275bce[_0x24ae('0x44')],parseInt(_0x275bce[_0x24ae('0x45')],0xa)+0x1);_0x275bce[_0x24ae('0x36')]();}}else{logger[_0x24ae('0xc')](util['format']('Project\x20%s\x20not\x20found',_0x275bce[_0x24ae('0x19')]));_0x275bce['continueAt'](_0x275bce[_0x24ae('0x43')],_0x275bce[_0x24ae('0x44')],parseInt(_0x275bce[_0x24ae('0x45')],0xa)+0x1);_0x275bce[_0x24ae('0x36')]();}}function main(){var _0x2f31e4;return utilLicense[_0x24ae('0x51')]()[_0x24ae('0x2f')](function(_0x5a8ff6){if(_0x5a8ff6){if(_0x5a8ff6[_0x24ae('0x52')]){if(_0x5a8ff6[_0x24ae('0x53')]&&_0x5a8ff6['callysquare']>0x0){logger[_0x24ae('0x11')](util[_0x24ae('0x12')](_0x24ae('0x54'),_0x5a8ff6['callysquare']));_0x2f31e4=_0x5a8ff6['callysquare'];}else{logger[_0x24ae('0x11')](_0x24ae('0x55'));}}else{logger['info'](_0x24ae('0x56'));_0x2f31e4=-0x1;}}})['catch'](function(_0x9772c5){logger['error'](_0x24ae('0x57'),_0x9772c5[_0x24ae('0xd')]);})['finally'](function(){var _0x28940f=require(_0x24ae('0x58'))(config[_0x24ae('0x6')][_0x24ae('0x10')],config[_0x24ae('0x6')]['ip'],_0x2f31e4);_0x28940f['on'](_0x24ae('0xc'),errorHandler);_0x28940f['on'](_0x24ae('0x59'),listeningHandler);_0x28940f['on']('connection',connectionHandler);_0x28940f['on'](_0x24ae('0x36'),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 09c9305..e722589 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 _0xe29e=['then','error','result','sendMailMessage','SendMail','bluebird','request'];(function(_0x7d6899,_0x3a7cf5){var _0x2fc710=function(_0xf08d49){while(--_0xf08d49){_0x7d6899['push'](_0x7d6899['shift']());}};_0x2fc710(++_0x3a7cf5);}(_0xe29e,0x132));var _0xee29=function(_0x70db02,_0xd30ea5){_0x70db02=_0x70db02-0x0;var _0x4e01fd=_0xe29e[_0x70db02];return _0x4e01fd;};'use strict';var BPromise=require(_0xee29('0x0'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function request(_0xc3bccd,_0x141115){return new BPromise(function(_0xde50df,_0x52dc68){return client[_0xee29('0x1')](_0xc3bccd,_0x141115)[_0xee29('0x2')](function(_0x284ec9){if(_0x284ec9[_0xee29('0x3')]){return _0x52dc68(_0x284ec9[_0xee29('0x3')]['message']);}else{return _0xde50df(_0x284ec9[_0xee29('0x4')]);}})['catch'](function(_0x26221a){return _0x52dc68(_0x26221a);});});}exports[_0xee29('0x5')]=function(_0x1a7dc5,_0x3bf0ca){return request(_0xee29('0x6'),{'account':_0x1a7dc5,'message':_0x3bf0ca});}; \ No newline at end of file +var _0x33f5=['sendMailMessage','SendMail','bluebird','jayson/promise','client','request','then','error','message','result','catch'];(function(_0x307fcf,_0x340119){var _0x4d95c8=function(_0x56bdd3){while(--_0x56bdd3){_0x307fcf['push'](_0x307fcf['shift']());}};_0x4d95c8(++_0x340119);}(_0x33f5,0xff));var _0x533f=function(_0x4d1496,_0x424f22){_0x4d1496=_0x4d1496-0x0;var _0x1187c9=_0x33f5[_0x4d1496];return _0x1187c9;};'use strict';var BPromise=require(_0x533f('0x0'));var jayson=require(_0x533f('0x1'));var client=jayson[_0x533f('0x2')]['http']({'port':0x232b});function request(_0x2bc0f1,_0x335cef){return new BPromise(function(_0x373767,_0x18e447){return client[_0x533f('0x3')](_0x2bc0f1,_0x335cef)[_0x533f('0x4')](function(_0x58e33f){if(_0x58e33f[_0x533f('0x5')]){return _0x18e447(_0x58e33f[_0x533f('0x5')][_0x533f('0x6')]);}else{return _0x373767(_0x58e33f[_0x533f('0x7')]);}})[_0x533f('0x8')](function(_0x4c46ed){return _0x18e447(_0x4c46ed);});});}exports[_0x533f('0x9')]=function(_0x1c9497,_0x10cd65){return request(_0x533f('0xa'),{'account':_0x1c9497,'message':_0x10cd65});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index f9efebf..b940e7d 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 _0x86e7=['prototype','\x0d\x0a\x0d\x0a','indexOf','substring','length','split','slice','trim','emit','headers','_inBody','line','exports','util','stream','Transform','call','_localBuffer','inherits'];(function(_0x6dce05,_0x539eb6){var _0x7f486=function(_0x1a2510){while(--_0x1a2510){_0x6dce05['push'](_0x6dce05['shift']());}};_0x7f486(++_0x539eb6);}(_0x86e7,0xf1));var _0x786e=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x86e7[_0x209fcd];return _0x501d5e;};'use strict';var util=require(_0x786e('0x0'));var Transform=require(_0x786e('0x1'))[_0x786e('0x2')];function AGIReply(_0x4e7681){Transform[_0x786e('0x3')](this,_0x4e7681);this[_0x786e('0x4')]='';this['_inBody']=![];}util[_0x786e('0x5')](AGIReply,Transform);AGIReply[_0x786e('0x6')]['_transform']=function(_0x4dff74,_0x537082,_0x1e271c){var _0xf48ca7='\x0a',_0x5c7ee9=['\x0a\x0a',_0x786e('0x7')],_0x35b309=-0x1,_0x19c83e=-0x1,_0x1488f1='',_0x36d5ed=0x0,_0x25e711='',_0x3b4db8='';this['_localBuffer']+=_0x4dff74['toString']();_0x25e711=this['_localBuffer'];if(!this['_inBody']){_0x36d5ed=0x0;while(_0x5c7ee9[_0x36d5ed]){while((_0x19c83e=_0x25e711[_0x786e('0x8')](_0x5c7ee9[_0x36d5ed]))!=-0x1){_0x1488f1=_0x5c7ee9[_0x36d5ed];_0x3b4db8=_0x25e711[_0x786e('0x9')](0x0,_0x19c83e);_0x25e711=_0x25e711['substring'](_0x19c83e+_0x1488f1[_0x786e('0xa')]);var _0x1f4b9d=_0x3b4db8[_0x786e('0xb')](_0xf48ca7),_0x1e1c35=0x0,_0x354bca={},_0x228d4d='',_0x597791='',_0x321f87=-0x1;while(_0x1f4b9d[_0x1e1c35]){_0x321f87=_0x1f4b9d[_0x1e1c35]['indexOf'](':');if(_0x321f87!=-0x1){_0x228d4d=_0x1f4b9d[_0x1e1c35][_0x786e('0xc')](0x0,_0x321f87)[_0x786e('0xd')]();_0x597791=_0x1f4b9d[_0x1e1c35]['slice'](_0x321f87+0x1)[_0x786e('0xd')]();if(_0x228d4d[_0x786e('0xa')]>0x0){_0x354bca[_0x228d4d]=_0x597791;}}else{}_0x1e1c35++;}this[_0x786e('0xe')](_0x786e('0xf'),_0x354bca);this[_0x786e('0x10')]=!![];}_0x36d5ed++;}this[_0x786e('0x4')]=_0x25e711;}else{while((_0x35b309=_0x25e711[_0x786e('0x8')](_0xf48ca7))!=-0x1){_0x3b4db8=_0x25e711[_0x786e('0x9')](0x0,_0x35b309);this[_0x786e('0xe')](_0x786e('0x11'),_0x3b4db8);_0x25e711=_0x25e711[_0x786e('0x9')](_0x35b309+_0xf48ca7[_0x786e('0xa')]);}this[_0x786e('0x4')]=_0x25e711;}_0x1e271c();};module[_0x786e('0x12')]=AGIReply; \ No newline at end of file +var _0x2bc1=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','indexOf','substring','split','trim','slice','emit','exports','stream','Transform'];(function(_0x329ba0,_0x2e889b){var _0x526123=function(_0x42656e){while(--_0x42656e){_0x329ba0['push'](_0x329ba0['shift']());}};_0x526123(++_0x2e889b);}(_0x2bc1,0x11e));var _0x12bc=function(_0x4e9e56,_0x609173){_0x4e9e56=_0x4e9e56-0x0;var _0xca3c9d=_0x2bc1[_0x4e9e56];return _0xca3c9d;};'use strict';var util=require('util');var Transform=require(_0x12bc('0x0'))[_0x12bc('0x1')];function AGIReply(_0x573bd7){Transform[_0x12bc('0x2')](this,_0x573bd7);this['_localBuffer']='';this[_0x12bc('0x3')]=![];}util[_0x12bc('0x4')](AGIReply,Transform);AGIReply[_0x12bc('0x5')][_0x12bc('0x6')]=function(_0x4fcc0d,_0x5264fa,_0x7d82b2){var _0x28b14e='\x0a',_0x31f56e=['\x0a\x0a',_0x12bc('0x7')],_0x2b5b68=-0x1,_0xd60229=-0x1,_0x17c481='',_0x8313f0=0x0,_0xcf6268='',_0x1236ab='';this[_0x12bc('0x8')]+=_0x4fcc0d['toString']();_0xcf6268=this[_0x12bc('0x8')];if(!this[_0x12bc('0x3')]){_0x8313f0=0x0;while(_0x31f56e[_0x8313f0]){while((_0xd60229=_0xcf6268[_0x12bc('0x9')](_0x31f56e[_0x8313f0]))!=-0x1){_0x17c481=_0x31f56e[_0x8313f0];_0x1236ab=_0xcf6268[_0x12bc('0xa')](0x0,_0xd60229);_0xcf6268=_0xcf6268[_0x12bc('0xa')](_0xd60229+_0x17c481['length']);var _0x533e65=_0x1236ab[_0x12bc('0xb')](_0x28b14e),_0x3e95ec=0x0,_0x243e04={},_0x4bbba6='',_0x3da572='',_0x5a7c4d=-0x1;while(_0x533e65[_0x3e95ec]){_0x5a7c4d=_0x533e65[_0x3e95ec][_0x12bc('0x9')](':');if(_0x5a7c4d!=-0x1){_0x4bbba6=_0x533e65[_0x3e95ec]['slice'](0x0,_0x5a7c4d)[_0x12bc('0xc')]();_0x3da572=_0x533e65[_0x3e95ec][_0x12bc('0xd')](_0x5a7c4d+0x1)[_0x12bc('0xc')]();if(_0x4bbba6['length']>0x0){_0x243e04[_0x4bbba6]=_0x3da572;}}else{}_0x3e95ec++;}this[_0x12bc('0xe')]('headers',_0x243e04);this[_0x12bc('0x3')]=!![];}_0x8313f0++;}this[_0x12bc('0x8')]=_0xcf6268;}else{while((_0x2b5b68=_0xcf6268[_0x12bc('0x9')](_0x28b14e))!=-0x1){_0x1236ab=_0xcf6268['substring'](0x0,_0x2b5b68);this[_0x12bc('0xe')]('line',_0x1236ab);_0xcf6268=_0xcf6268['substring'](_0x2b5b68+_0x28b14e['length']);}this[_0x12bc('0x8')]=_0xcf6268;}_0x7d82b2();};module[_0x12bc('0xf')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 8860d34..512bbc6 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 _0xb44c=['Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareReport','CreateSquareReport','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','client','http','then','error','message','catch','GetSquareProjects','production','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','save_name'];(function(_0x22ba54,_0x3c105b){var _0x17af5b=function(_0x345a36){while(--_0x345a36){_0x22ba54['push'](_0x22ba54['shift']());}};_0x17af5b(++_0x3c105b);}(_0xb44c,0x10e));var _0xcb44=function(_0xc84e3,_0xd631b){_0xc84e3=_0xc84e3-0x0;var _0x437a90=_0xb44c[_0xc84e3];return _0x437a90;};'use strict';var BPromise=require(_0xcb44('0x0'));var moment=require(_0xcb44('0x1'));var _=require(_0xcb44('0x2'));var util=require(_0xcb44('0x3'));var jayson=require('jayson/promise');var client=jayson[_0xcb44('0x4')][_0xcb44('0x5')]({'port':0x2329});function request(_0x4ac9ab,_0xf11cb6){return new BPromise(function(_0x425639,_0x43935f){return client['request'](_0x4ac9ab,_0xf11cb6)[_0xcb44('0x6')](function(_0x4215f9){if(_0x4215f9[_0xcb44('0x7')]){return _0x43935f(_0x4215f9[_0xcb44('0x7')][_0xcb44('0x8')]);}else{return _0x425639(_0x4215f9['result']);}})[_0xcb44('0x9')](function(_0x23361e){return _0x43935f(_0x23361e);});});}exports['getSquareProjects']=function(){return request(_0xcb44('0xa'),{'options':{'raw':![],'attributes':['id','name',_0xcb44('0xb')]}});};exports['getSquareProject']=function(_0x429891){return request(_0xcb44('0xc'),{'options':{'raw':![],'where':{'name':_0x429891},'attributes':['production']}});};exports[_0xcb44('0xd')]=function(_0x18ce07){return request(_0xcb44('0xe'),{'options':{'raw':![],'where':{'id':_0x18ce07},'include':[{'model':_0xcb44('0xf'),'as':_0xcb44('0x10'),'include':[{'model':_0xcb44('0x11'),'as':'CloudProvider'}]}],'attributes':['id',_0xcb44('0x12'),_0xcb44('0x13')],'smtp':!![]}});};exports[_0xcb44('0x14')]=function(_0x4d54e4){return request(_0xcb44('0xc'),{'options':{'where':{'id':_0x4d54e4},'attributes':['name']}});};exports[_0xcb44('0x15')]=function(_0x13b714){return request(_0xcb44('0x16'),{'options':{'where':{'id':_0x13b714},'attributes':[_0xcb44('0x12')]}});};exports['getVariableById']=function(_0x51e113){return request(_0xcb44('0x17'),{'options':{'where':{'id':_0x51e113},'attributes':['name']}});};exports[_0xcb44('0x18')]=function(_0x1b1d10){return request(_0xcb44('0x19'),{'options':{'where':{'id':_0x1b1d10},'attributes':[_0xcb44('0x1a')]}});};exports[_0xcb44('0x1b')]=function(_0x127a10){return request(_0xcb44('0x1c'),{'options':{'where':{'id':_0x127a10},'attributes':[_0xcb44('0x12')]}});};exports[_0xcb44('0x1d')]=function(_0x502d90){return request(_0xcb44('0x1e'),{'options':{'where':{'phone':_0x502d90[_0xcb44('0x1f')]},'attributes':['id']}});};exports[_0xcb44('0x20')]=function(_0x3c150a){return request('ShowTrunk',{'options':{'where':{'id':_0x3c150a},'attributes':['name']}});};exports[_0xcb44('0x21')]=function(_0xc48106){return request('ShowSound',{'options':{'where':{'id':_0xc48106},'attributes':[_0xcb44('0x22')]}});};exports['getIntervalById']=function(_0x1e82d5){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x1e82d5},'include':[{'model':_0xcb44('0x23'),'as':'Intervals'}]}});};exports[_0xcb44('0x24')]=function(_0x34930d){return request(_0xcb44('0x25'),{'options':{'where':{'id':_0x34930d},'attributes':['id',_0xcb44('0x12')]}});};exports[_0xcb44('0x26')]=function(_0x589565){return request(_0xcb44('0x27'),{'body':_0x589565});};exports['createSquareDetailsReport']=function(_0x16d257){return request('CreateSquareDetailsReport',{'body':_0x16d257});};exports[_0xcb44('0x28')]=function(_0x49c5ae){return request(_0xcb44('0x29'),{'body':_['merge'](_0x49c5ae,{'project_name':_0x49c5ae[_0xcb44('0x2a')],'prev_project_name':_0x49c5ae[_0xcb44('0x2b')]||'','is_subproject':_0x49c5ae[_0xcb44('0x2b')]?!![]:![],'leaveAt':moment()['format'](_0xcb44('0x2c'))})});};exports[_0xcb44('0x2d')]=function(_0x7c8fe6){return request('CreateSquareRecording',{'body':_0x7c8fe6});};exports[_0xcb44('0x2e')]=function(_0x225c52){return request(_0xcb44('0x2f'),{'body':_0x225c52});};exports[_0xcb44('0x30')]=function(_0x14dc3d){return request(_0xcb44('0x31'),{'options':{'raw':![],'where':{'phone':_0x14dc3d[_0xcb44('0x1f')],'ListId':_0x14dc3d[_0xcb44('0x32')]}}})['then'](function(_0x3bbde5){if(_0x3bbde5){return _0x3bbde5;}return request(_0xcb44('0x33'),{'body':_0x14dc3d});});};exports[_0xcb44('0x34')]=function(_0x104cdf){return request(_0xcb44('0x35'),{'options':{'where':{'id':_0x104cdf},'attributes':[_0xcb44('0x12')]}});};exports[_0xcb44('0x36')]=function(_0x26a683,_0x3c0ae1){return request('LoginUser',{'body':{'interface':_0x3c0ae1},'options':{'where':_0x26a683}});};exports[_0xcb44('0x37')]=function(_0x379bd9,_0xcb11df,_0x13b96b){return request(_0xcb44('0x38'),{'body':{'type':_0xcb11df,'uniqueid':_0x13b96b},'options':{'where':_0x379bd9}});};exports[_0xcb44('0x39')]=function(_0x5f09c5){return request(_0xcb44('0x3a'),{'body':{},'options':{'where':_0x5f09c5}});};exports[_0xcb44('0x3b')]=function(_0x41636b){return request(_0xcb44('0x3c'),{'body':{},'options':{'where':_0x41636b}});}; \ No newline at end of file +var _0x1ac2=['CloudProvider','name','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','bluebird','moment','lodash','jayson/promise','http','request','then','error','message','result','getSquareProjects','getSquareProject','getMailAccountById','ShowMailAccount','MailServerOut'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0x1ac2,0x177));var _0x21ac=function(_0x55afc1,_0x25d8fc){_0x55afc1=_0x55afc1-0x0;var _0x150431=_0x1ac2[_0x55afc1];return _0x150431;};'use strict';var BPromise=require(_0x21ac('0x0'));var moment=require(_0x21ac('0x1'));var _=require(_0x21ac('0x2'));var util=require('util');var jayson=require(_0x21ac('0x3'));var client=jayson['client'][_0x21ac('0x4')]({'port':0x2329});function request(_0x59b8fb,_0x15c500){return new BPromise(function(_0xd07d9a,_0x1c69c5){return client[_0x21ac('0x5')](_0x59b8fb,_0x15c500)[_0x21ac('0x6')](function(_0xcf622a){if(_0xcf622a[_0x21ac('0x7')]){return _0x1c69c5(_0xcf622a['error'][_0x21ac('0x8')]);}else{return _0xd07d9a(_0xcf622a[_0x21ac('0x9')]);}})['catch'](function(_0x4384a8){return _0x1c69c5(_0x4384a8);});});}exports[_0x21ac('0xa')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x21ac('0xb')]=function(_0x25ca35){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x25ca35},'attributes':['production']}});};exports[_0x21ac('0xc')]=function(_0x58a2ab){return request(_0x21ac('0xd'),{'options':{'raw':![],'where':{'id':_0x58a2ab},'include':[{'model':_0x21ac('0xe'),'as':'Smtp','include':[{'model':_0x21ac('0xf'),'as':_0x21ac('0xf')}]}],'attributes':['id',_0x21ac('0x10'),_0x21ac('0x11')],'smtp':!![]}});};exports[_0x21ac('0x12')]=function(_0x3bf509){return request(_0x21ac('0x13'),{'options':{'where':{'id':_0x3bf509},'attributes':['name']}});};exports[_0x21ac('0x14')]=function(_0x10e194){return request(_0x21ac('0x15'),{'options':{'where':{'id':_0x10e194},'attributes':['name']}});};exports[_0x21ac('0x16')]=function(_0x3ea5db){return request(_0x21ac('0x17'),{'options':{'where':{'id':_0x3ea5db},'attributes':[_0x21ac('0x10')]}});};exports[_0x21ac('0x18')]=function(_0x384001){return request(_0x21ac('0x19'),{'options':{'where':{'id':_0x384001},'attributes':['dsn']}});};exports[_0x21ac('0x1a')]=function(_0x509062){return request(_0x21ac('0x1b'),{'options':{'where':{'id':_0x509062},'attributes':[_0x21ac('0x10')]}});};exports[_0x21ac('0x1c')]=function(_0x46a052){return request(_0x21ac('0x1d'),{'options':{'where':{'phone':_0x46a052[_0x21ac('0x1e')]},'attributes':['id']}});};exports[_0x21ac('0x1f')]=function(_0x56516b){return request(_0x21ac('0x20'),{'options':{'where':{'id':_0x56516b},'attributes':['name']}});};exports['getSoundById']=function(_0x2567e6){return request(_0x21ac('0x21'),{'options':{'where':{'id':_0x2567e6},'attributes':[_0x21ac('0x22')]}});};exports[_0x21ac('0x23')]=function(_0x503554){return request(_0x21ac('0x24'),{'options':{'raw':![],'where':{'id':_0x503554},'include':[{'model':_0x21ac('0x25'),'as':'Intervals'}]}});};exports[_0x21ac('0x26')]=function(_0x2418fc){return request(_0x21ac('0x27'),{'options':{'where':{'id':_0x2418fc},'attributes':['id',_0x21ac('0x10')]}});};exports[_0x21ac('0x28')]=function(_0x54e88c){return request(_0x21ac('0x29'),{'body':_0x54e88c});};exports['createSquareDetailsReport']=function(_0x1c5896){return request(_0x21ac('0x2a'),{'body':_0x1c5896});};exports[_0x21ac('0x2b')]=function(_0x377b3f){return request(_0x21ac('0x2c'),{'body':_['merge'](_0x377b3f,{'project_name':_0x377b3f[_0x21ac('0x2d')],'prev_project_name':_0x377b3f[_0x21ac('0x2e')]||'','is_subproject':_0x377b3f[_0x21ac('0x2e')]?!![]:![],'leaveAt':moment()[_0x21ac('0x2f')](_0x21ac('0x30'))})});};exports['createSquareRecording']=function(_0x4b332c){return request(_0x21ac('0x31'),{'body':_0x4b332c});};exports[_0x21ac('0x32')]=function(_0x6df866){return request(_0x21ac('0x33'),{'body':_0x6df866});};exports[_0x21ac('0x34')]=function(_0x5b9871){return request(_0x21ac('0x35'),{'options':{'raw':![],'where':{'phone':_0x5b9871['phone'],'ListId':_0x5b9871[_0x21ac('0x36')]}}})[_0x21ac('0x6')](function(_0x3f913b){if(_0x3f913b){return _0x3f913b;}return request(_0x21ac('0x37'),{'body':_0x5b9871});});};exports[_0x21ac('0x38')]=function(_0x2003ef){return request(_0x21ac('0x39'),{'options':{'where':{'id':_0x2003ef},'attributes':[_0x21ac('0x10')]}});};exports[_0x21ac('0x3a')]=function(_0x8e3bf1,_0x12a73c){return request(_0x21ac('0x3b'),{'body':{'interface':_0x12a73c},'options':{'where':_0x8e3bf1}});};exports[_0x21ac('0x3c')]=function(_0x290b9c,_0x2903e3,_0x503c0a){return request(_0x21ac('0x3d'),{'body':{'type':_0x2903e3,'uniqueid':_0x503c0a},'options':{'where':_0x290b9c}});};exports[_0x21ac('0x3e')]=function(_0x134f7a){return request(_0x21ac('0x3f'),{'body':{},'options':{'where':_0x134f7a}});};exports[_0x21ac('0x40')]=function(_0x23d9e3){return request('LogoutUser',{'body':{},'options':{'where':_0x23d9e3}});}; \ 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 09651f6..2d5d3c4 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 _0x7919=['exports','./polly','./lex'];(function(_0x26df16,_0x5ad3b9){var _0x1430b1=function(_0x63f3cc){while(--_0x63f3cc){_0x26df16['push'](_0x26df16['shift']());}};_0x1430b1(++_0x5ad3b9);}(_0x7919,0xeb));var _0x9791=function(_0x241099,_0x2997a9){_0x241099=_0x241099-0x0;var _0x164e96=_0x7919[_0x241099];return _0x164e96;};var polly=require(_0x9791('0x0'));var lex=require(_0x9791('0x1'));module[_0x9791('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x8506=['./lex'];(function(_0x49336c,_0x4940c8){var _0x257fd6=function(_0x3ee0e1){while(--_0x3ee0e1){_0x49336c['push'](_0x49336c['shift']());}};_0x257fd6(++_0x4940c8);}(_0x8506,0xe8));var _0x6850=function(_0x4ee545,_0x13cb6c){_0x4ee545=_0x4ee545-0x0;var _0x428264=_0x8506[_0x4ee545];return _0x428264;};var polly=require('./polly');var lex=require(_0x6850('0x0'));module['exports']={'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 8a8cd59..7818710 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 _0xac4a=['exports','./lib/api'];(function(_0x1b1d70,_0x10a336){var _0x5df8ad=function(_0x2f4ad8){while(--_0x2f4ad8){_0x1b1d70['push'](_0x1b1d70['shift']());}};_0x5df8ad(++_0x10a336);}(_0xac4a,0x13f));var _0xaac4=function(_0x1531fe,_0x54057c){_0x1531fe=_0x1531fe-0x0;var _0x2348f2=_0xac4a[_0x1531fe];return _0x2348f2;};'use strict';var lex=require(_0xaac4('0x0'));module[_0xaac4('0x1')]=function(_0x2e2ad0,_0x132fc3,_0x38f4f4,_0x1dc251,_0x5aeb7d,_0x58626e){return lex(_0x2e2ad0,_0x132fc3,_0x38f4f4,_0x1dc251,_0x5aeb7d,_0x58626e);}; \ No newline at end of file +var _0xb4e6=['./lib/api'];(function(_0x302f55,_0x31872f){var _0x55ca94=function(_0x477ac3){while(--_0x477ac3){_0x302f55['push'](_0x302f55['shift']());}};_0x55ca94(++_0x31872f);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x1196bd,_0xba4aea){_0x1196bd=_0x1196bd-0x0;var _0x26014f=_0xb4e6[_0x1196bd];return _0x26014f;};'use strict';var lex=require(_0x6b4e('0x0'));module['exports']=function(_0x2708ca,_0x1afd20,_0x365912,_0x25ffcb,_0x44e781,_0x31e8ad){return lex(_0x2708ca,_0x1afd20,_0x365912,_0x25ffcb,_0x44e781,_0x31e8ad);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 7a1357f..bffd5f9 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(_0x273059,_0x46ab75){var _0x2ed256=function(_0x234dfa){while(--_0x234dfa){_0x273059['push'](_0x273059['shift']());}};_0x2ed256(++_0x46ab75);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x49ff3c,_0xd16ab5){var _0x1f9018=function(_0x1a5f49){while(--_0x1a5f49){_0x49ff3c['push'](_0x49ff3c['shift']());}};_0x1f9018(++_0xd16ab5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 445d2e2..2816518 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 _0xb388=['exports'];(function(_0x50caa0,_0x2431be){var _0x11b0c9=function(_0xa6a09d){while(--_0xa6a09d){_0x50caa0['push'](_0x50caa0['shift']());}};_0x11b0c9(++_0x2431be);}(_0xb388,0xb4));var _0x8b38=function(_0x5c4e4a,_0x4ce3ed){_0x5c4e4a=_0x5c4e4a-0x0;var _0xb497b2=_0xb388[_0x5c4e4a];return _0xb497b2;};'use strict';var polly=require('./lib/api');module[_0x8b38('0x0')]=function(_0x4262a9,_0x32f9fc,_0x10ff35,_0x3292ff,_0x194870,_0x324a35,_0x19ad14){return polly(_0x4262a9,_0x32f9fc,_0x10ff35,_0x3292ff,_0x194870,_0x324a35,_0x19ad14);}; \ No newline at end of file +'use strict';var polly=require('./lib/api');module['exports']=function(_0x195344,_0x8b32ae,_0x33c076,_0x5e02ea,_0x1c42e6,_0x5ba496,_0x178ec7){return polly(_0x195344,_0x8b32ae,_0x33c076,_0x5e02ea,_0x1c42e6,_0x5ba496,_0x178ec7);}; \ 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 211702c..40fa9af 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 _0xa369=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x2ba033,_0x3d56d6){var _0x4f7eec=function(_0x3817e2){while(--_0x3817e2){_0x2ba033['push'](_0x2ba033['shift']());}};_0x4f7eec(++_0x3d56d6);}(_0xa369,0xb0));var _0x9a36=function(_0x42de2a,_0x64001e){_0x42de2a=_0x42de2a-0x0;var _0x1c712a=_0xa369[_0x42de2a];return _0x1c712a;};'use strict';var fs=require('fs');var path=require(_0x9a36('0x0'));var BPromise=require(_0x9a36('0x1'));var rs=require(_0x9a36('0x2'));var AWS=require(_0x9a36('0x3'));function pollyResult(_0x3249ef,_0x260555,_0x78d29f){return new BPromise(function(_0x4ec476,_0x2a2064){_0x3249ef[_0x9a36('0x4')](_0x260555,function(_0x1840ac,_0x37cc31){if(_0x1840ac){_0x2a2064(_0x1840ac);}else if(_0x37cc31){if(_0x37cc31[_0x9a36('0x5')]instanceof Buffer){fs[_0x9a36('0x6')](_0x78d29f,_0x37cc31[_0x9a36('0x5')],function(_0x5c4cbb){if(_0x5c4cbb){_0x2a2064(_0x5c4cbb);}else{_0x4ec476();}});}else{_0x2a2064(new Error(_0x9a36('0x7')));}}else{_0x2a2064(new Error(_0x9a36('0x8')));}});});}module[_0x9a36('0x9')]=function(_0x1358ad,_0x16446a,_0x129405,_0x2c5f26,_0xd5cdf0,_0x346e21,_0x3dbf2c){var _0x38c7a9=new AWS[(_0x9a36('0xa'))]({'accessKeyId':_0x1358ad,'secretAccessKey':_0x16446a,'region':_0x129405});var _0x26e500={'Text':_0xd5cdf0,'TextType':_0x346e21||_0x9a36('0xb'),'OutputFormat':_0x9a36('0xc'),'VoiceId':_0x2c5f26};return pollyResult(_0x38c7a9,_0x26e500,_0x3dbf2c);}; \ No newline at end of file +var _0x2107=['path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3'];(function(_0x336c53,_0x3f9c03){var _0x127e36=function(_0x439ad0){while(--_0x439ad0){_0x336c53['push'](_0x336c53['shift']());}};_0x127e36(++_0x3f9c03);}(_0x2107,0x108));var _0x7210=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0x2107[_0x3ec1da];return _0x472358;};'use strict';var fs=require('fs');var path=require(_0x7210('0x0'));var BPromise=require(_0x7210('0x1'));var rs=require(_0x7210('0x2'));var AWS=require(_0x7210('0x3'));function pollyResult(_0x2a485f,_0x49cf8b,_0x4f1071){return new BPromise(function(_0x5a8d8d,_0x545510){_0x2a485f[_0x7210('0x4')](_0x49cf8b,function(_0x5d9368,_0x4c058f){if(_0x5d9368){_0x545510(_0x5d9368);}else if(_0x4c058f){if(_0x4c058f[_0x7210('0x5')]instanceof Buffer){fs['writeFile'](_0x4f1071,_0x4c058f[_0x7210('0x5')],function(_0x4fddae){if(_0x4fddae){_0x545510(_0x4fddae);}else{_0x5a8d8d();}});}else{_0x545510(new Error(_0x7210('0x6')));}}else{_0x545510(new Error(_0x7210('0x7')));}});});}module[_0x7210('0x8')]=function(_0x496e4e,_0xccbf97,_0x4605c6,_0x39d4d2,_0x210859,_0x3f193e,_0x4cb6f2){var _0x199b54=new AWS[(_0x7210('0x9'))]({'accessKeyId':_0x496e4e,'secretAccessKey':_0xccbf97,'region':_0x4605c6});var _0x584b97={'Text':_0x210859,'TextType':_0x3f193e||_0x7210('0xa'),'OutputFormat':_0x7210('0xb'),'VoiceId':_0x39d4d2};return pollyResult(_0x199b54,_0x584b97,_0x4cb6f2);}; \ 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 7b3a003..34358d5 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 _0x6740=['./lib/api','exports'];(function(_0x536545,_0x134ee9){var _0x1d12a1=function(_0x41bfab){while(--_0x41bfab){_0x536545['push'](_0x536545['shift']());}};_0x1d12a1(++_0x134ee9);}(_0x6740,0x10a));var _0x0674=function(_0x5de9a0,_0x1a23ef){_0x5de9a0=_0x5de9a0-0x0;var _0x4b75ec=_0x6740[_0x5de9a0];return _0x4b75ec;};'use strict';var asr=require(_0x0674('0x0'));module[_0x0674('0x1')]=function(_0x57a59d,_0x1ebba7,_0x10d756,_0xad6fa){return asr(_0x57a59d,_0x1ebba7,_0x10d756);}; \ No newline at end of file +var _0x217d=['exports','./lib/api'];(function(_0x99facc,_0x548cd6){var _0xd39ed0=function(_0x207e47){while(--_0x207e47){_0x99facc['push'](_0x99facc['shift']());}};_0xd39ed0(++_0x548cd6);}(_0x217d,0xc9));var _0xd217=function(_0x88ad80,_0x1a154d){_0x88ad80=_0x88ad80-0x0;var _0x2c83ce=_0x217d[_0x88ad80];return _0x2c83ce;};'use strict';var asr=require(_0xd217('0x0'));module[_0xd217('0x1')]=function(_0x1604b5,_0x1e9e0c,_0x520610,_0x1bdc9b){return asr(_0x1604b5,_0x1e9e0c,_0x520610);}; \ 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 8c4cc8d..be79490 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 _0x0f9f=['readFileSync','toString','POST','/v1/speech:recognize?key=','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x678dda,_0x4bd7a9){var _0x430464=function(_0x1da5b1){while(--_0x1da5b1){_0x678dda['push'](_0x678dda['shift']());}};_0x430464(++_0x4bd7a9);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x0f9f[_0x2dadb9];return _0x2f0097;};'use strict';var url=require('url');var BPromise=require(_0xf0f9('0x0'));var fs=require('fs');var host=_0xf0f9('0x1');module[_0xf0f9('0x2')]=function(_0x48fa0e,_0x5cf55e,_0x45cc98){return new BPromise(function(_0x257b44,_0x17eab4){var _0x2f8d38;if(typeof _0x48fa0e!==_0xf0f9('0x3')||_0x48fa0e[_0xf0f9('0x4')]===0x0){return _0x17eab4(_0xf0f9('0x5'));}if(typeof _0x5cf55e!==_0xf0f9('0x3')||_0x5cf55e[_0xf0f9('0x4')]===0x0){return _0x17eab4('key\x20should\x20be\x20a\x20string');}if(typeof _0x45cc98!==_0xf0f9('0x6')&&(typeof _0x45cc98!==_0xf0f9('0x3')||_0x45cc98['length']===0x0)){return _0x17eab4(_0xf0f9('0x7'));}try{_0x2f8d38=fs[_0xf0f9('0x8')](_0x48fa0e)[_0xf0f9('0x9')]('base64');}catch(_0x196f21){return _0x17eab4(_0x196f21);}return _0x257b44({'method':_0xf0f9('0xa'),'uri':host+_0xf0f9('0xb')+_0x5cf55e,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x45cc98},'audio':{'content':_0x2f8d38}},'json':!![]});});}; \ No newline at end of file +var _0x2209=['bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST','LINEAR16','8000','url'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2209,0x95));var _0x9220=function(_0x51bd54,_0xb164b7){_0x51bd54=_0x51bd54-0x0;var _0x5aeaea=_0x2209[_0x51bd54];return _0x5aeaea;};'use strict';var url=require(_0x9220('0x0'));var BPromise=require(_0x9220('0x1'));var fs=require('fs');var host=_0x9220('0x2');module[_0x9220('0x3')]=function(_0x29dc9b,_0x5d3fe2,_0x2b23aa){return new BPromise(function(_0x5cc72c,_0x348220){var _0x2fddae;if(typeof _0x29dc9b!==_0x9220('0x4')||_0x29dc9b[_0x9220('0x5')]===0x0){return _0x348220(_0x9220('0x6'));}if(typeof _0x5d3fe2!==_0x9220('0x4')||_0x5d3fe2[_0x9220('0x5')]===0x0){return _0x348220(_0x9220('0x7'));}if(typeof _0x2b23aa!==_0x9220('0x8')&&(typeof _0x2b23aa!=='string'||_0x2b23aa[_0x9220('0x5')]===0x0)){return _0x348220(_0x9220('0x9'));}try{_0x2fddae=fs['readFileSync'](_0x29dc9b)[_0x9220('0xa')](_0x9220('0xb'));}catch(_0x18550a){return _0x348220(_0x18550a);}return _0x5cc72c({'method':_0x9220('0xc'),'uri':host+'/v1/speech:recognize?key='+_0x5d3fe2,'body':{'config':{'encoding':_0x9220('0xd'),'sampleRateHertz':_0x9220('0xe'),'languageCode':_0x2b23aa},'audio':{'content':_0x2fddae}},'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 0e048e0..d5ee2cd 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 _0xf071=['exports','./asr'];(function(_0x55a76a,_0x2d0203){var _0x45885a=function(_0x4348d5){while(--_0x4348d5){_0x55a76a['push'](_0x55a76a['shift']());}};_0x45885a(++_0x2d0203);}(_0xf071,0x9d));var _0x1f07=function(_0x52896c,_0x305745){_0x52896c=_0x52896c-0x0;var _0x1feded=_0xf071[_0x52896c];return _0x1feded;};var asr=require(_0x1f07('0x0'));module[_0x1f07('0x1')]={'asr':asr}; \ No newline at end of file +var _0xbbea=['./asr'];(function(_0x25287e,_0x1b51cc){var _0x1de56f=function(_0x2b0cae){while(--_0x2b0cae){_0x25287e['push'](_0x25287e['shift']());}};_0x1de56f(++_0x1b51cc);}(_0xbbea,0x181));var _0xabbe=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xbbea[_0xfae23b];return _0x200640;};var asr=require(_0xabbe('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 40a6c0e..cc0969e 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 _0xaf91=['googleCloudTTS\x20path','split','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','.wav','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','source','result','actionIncomplete','fulfillment','speech','score','status','metadata','isFallbackIntent','googleDialogflowV2','replace','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','ispeechTTS','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','bluebird','dialogflow','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','end','request\x20to\x20','transcode','wav','start','resolve','generate','writeFileSync','chmodSync','777','readFileSync','toString','base64','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','MP3','POST','.mp3','from','audioContent','then','tmp'];(function(_0x5f219f,_0x123fdd){var _0x1eb7c9=function(_0x1cb615){while(--_0x1cb615){_0x5f219f['push'](_0x5f219f['shift']());}};_0x1eb7c9(++_0x123fdd);}(_0xaf91,0x14e));var _0x1af9=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xaf91[_0x34bf97];return _0x292719;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x1af9('0x0'));var dialogflow=require(_0x1af9('0x1'));var fs=require('fs');var http=require('http');var https=require(_0x1af9('0x2'));var md5=require(_0x1af9('0x3'));var path=require('path');var querystring=require(_0x1af9('0x4'));var rp=require(_0x1af9('0x5'));var rs=require(_0x1af9('0x6'));var sox=require(_0x1af9('0x7'));var tts=require(_0x1af9('0x8'));var urlParse=require(_0x1af9('0x9'))[_0x1af9('0xa')];var util=require(_0x1af9('0xb'));var aws=require(_0x1af9('0xc'));var google=require(_0x1af9('0xd'));var sestek=require(_0x1af9('0xe'));var tilde=require(_0x1af9('0xf'));var logger=require(_0x1af9('0x10'))(_0x1af9('0x11'));var ISPEECH_API=_0x1af9('0x12');function downloadFile(_0x3fc73c,_0x4f8206){return new BPromise(function(_0x4c5ef2,_0x1e225e){var _0x19c7c9=urlParse(_0x3fc73c);var _0x503b12=_0x19c7c9[_0x1af9('0x13')]===_0x1af9('0x14')?https:http;var _0x3cfa49={'host':_0x19c7c9[_0x1af9('0x15')],'path':_0x19c7c9[_0x1af9('0x16')],'headers':{'user-agent':'WHAT_EVER'}};_0x503b12[_0x1af9('0x17')](_0x3cfa49,function(_0x3d12ab){if(_0x3d12ab[_0x1af9('0x18')]!==0xc8){logger[_0x1af9('0x19')]('request\x20to\x20'+_0x3fc73c+_0x1af9('0x1a')+_0x3d12ab[_0x1af9('0x18')]+'\x20('+_0x3d12ab[_0x1af9('0x1b')]+')');_0x1e225e(new Error('request\x20to\x20'+_0x3fc73c+'\x20failed,\x20status\x20code\x20=\x20'+_0x3d12ab['statusCode']+'\x20('+_0x3d12ab[_0x1af9('0x1b')]+')'));return;}var _0x36b867=fs[_0x1af9('0x1c')](_0x4f8206);_0x36b867['on'](_0x1af9('0x1d'),function(){logger[_0x1af9('0x1e')](_0x1af9('0x1f'));_0x36b867[_0x1af9('0x20')](_0x4c5ef2);});_0x36b867['on'](_0x1af9('0x19'),function(_0x1de785){fs[_0x1af9('0x21')](_0x4f8206);logger[_0x1af9('0x19')]('download\x20error',_0x1de785);_0x1e225e(_0x1de785);});_0x3d12ab['pipe'](_0x36b867);})['on'](_0x1af9('0x19'),function(_0x3a7c7d){logger[_0x1af9('0x19')](_0x3a7c7d);_0x1e225e(_0x3a7c7d);})[_0x1af9('0x22')]();});}function uploadFile(_0x216b07){return new BPromise(function(_0x5179dc,_0xc8d72c){var _0x5452d9=urlParse(_0x216b07);var _0x132bb1=_0x5452d9[_0x1af9('0x13')]==='https:'?https:http;var _0x586f55={'host':_0x5452d9[_0x1af9('0x15')],'path':_0x5452d9[_0x1af9('0x16')],'headers':{'user-agent':'WHAT_EVER'}};_0x132bb1[_0x1af9('0x17')](_0x586f55,function(_0x3ed0d6){if(_0x3ed0d6[_0x1af9('0x18')]!==0xc8){_0xc8d72c(new Error(_0x1af9('0x23')+_0x216b07+_0x1af9('0x1a')+_0x3ed0d6[_0x1af9('0x18')]+'\x20('+_0x3ed0d6[_0x1af9('0x1b')]+')'));return;}var _0x5ef46a='';_0x3ed0d6['on']('data',function(_0x2bf174){_0x5ef46a+=_0x2bf174;});_0x3ed0d6['on'](_0x1af9('0x22'),function(){_0x5179dc(_0x5ef46a);});})['on']('error',function(_0x5ba376){_0xc8d72c(_0x5ba376);})[_0x1af9('0x22')]();});}function convertFile(_0x51e86d,_0x37a59b){return new BPromise(function(_0x36f925,_0x2230af){var _0x317808=sox[_0x1af9('0x24')](_0x51e86d,_0x37a59b,{'sampleRate':0x1f40,'format':_0x1af9('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x317808['on'](_0x1af9('0x19'),function(_0x3fc655){logger['error']('error\x20convert',_0x3fc655);_0x2230af(_0x3fc655);});_0x317808['on'](_0x1af9('0x22'),function(){logger[_0x1af9('0x1e')]('finish\x20to\x20convert');_0x36f925();});_0x317808[_0x1af9('0x26')]();});}function base64Decode(_0x402e3a,_0xe17969){var _0x54d09f=path[_0x1af9('0x27')](__dirname,'tmp',rs[_0x1af9('0x28')](0x4)+'.wav');fs[_0x1af9('0x29')](_0x54d09f,_0x402e3a,'base64');return convertFile(_0x54d09f,_0xe17969)['then'](function(){try{fs[_0x1af9('0x21')](_0x54d09f);fs[_0x1af9('0x2a')](_0xe17969,_0x1af9('0x2b'));}catch(_0x4df5a6){logger['error'](_0x4df5a6);}return _0xe17969['split']('.')[0x0];});}function base64Encode(_0x1a6d3d){var _0xe4d051=fs[_0x1af9('0x2c')](_0x1a6d3d);return new Buffer(_0xe4d051)[_0x1af9('0x2d')](_0x1af9('0x2e'));}exports['googleCloudTTS']=function(_0x236296,_0xc20249,_0x4b15bb,_0x155d4a,_0x11968b,_0x4cff92){var _0x175091,_0x5b1657;var _0x5e9958=_0x1af9('0x2f');var _0x330c5b=_0x1af9('0x30')+_0x236296;var _0x4f80bf={};if(_0xc20249===_0x1af9('0x31')){_0x4f80bf['input']={'ssml':_0x4b15bb};}else{_0x4f80bf[_0x1af9('0x32')]={'text':_0x4b15bb};};_0x4f80bf['voice']={'languageCode':_0x155d4a,'ssmlGender':_0x11968b};_0x4f80bf[_0x1af9('0x33')]={'audioEncoding':_0x1af9('0x34'),'sampleRateHertz':0x1f40};var _0x457ad4={'url':_0x5e9958+'text:synthesize'+_0x330c5b,'method':_0x1af9('0x35'),'json':!![],'body':_0x4f80bf};return rp(_0x457ad4)['then'](function(_0x400203){return new BPromise(function(_0x4ed820,_0x4e8d9a){_0x175091=path[_0x1af9('0x27')](__dirname,'tmp',rs[_0x1af9('0x28')](0x4)+_0x1af9('0x36'));var _0x4e81a8=Buffer[_0x1af9('0x37')](_0x400203[_0x1af9('0x38')],_0x1af9('0x2e'));return fs['writeFile'](_0x175091,_0x4e81a8,function(_0x345a35){_0x4e8d9a(_0x345a35);},function(_0x2b4e45){fs[_0x1af9('0x2a')](_0x175091,_0x1af9('0x2b'));_0x4ed820(_0x2b4e45);});});})[_0x1af9('0x39')](function(_0x4a1511){_0x5b1657=path['resolve'](__dirname,_0x1af9('0x3a'),rs[_0x1af9('0x28')](0x4)+'.wav');return convertFile(_0x175091,_0x5b1657);})['then'](function(){try{fs[_0x1af9('0x21')](_0x175091);fs[_0x1af9('0x2a')](_0x5b1657,_0x1af9('0x2b'));}catch(_0x567547){logger['error'](_0x567547);}logger[_0x1af9('0x1e')](_0x1af9('0x3b'),_0x5b1657['split']('.')[0x0]);return _0x5b1657[_0x1af9('0x3c')]('.')[0x0];});};exports[_0x1af9('0x3d')]=function(_0x1c7f24,_0x4272bf){var _0xdd74bb='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x4bf35a,_0x4771b8;var _0x1698a1;var _0x53538b={'encoding':_0x1af9('0x3e'),'method':_0x1af9('0x35'),'timeout':0x2710,'url':_0xdd74bb,'headers':{'Content-Type':_0x1af9('0x3f')},'body':_0x1af9('0x40')+encodeURIComponent(JSON[_0x1af9('0x41')]([[[_0x1af9('0x42'),JSON[_0x1af9('0x41')]([_0x1c7f24,_0x4272bf||'en',![],_0x1af9('0x43')]),null,'generic']]]))};return rp(_0x53538b)['then'](function(_0x404cf2){try{_0x1698a1=eval(_0x404cf2[_0x1af9('0x44')](0x5))[0x0][0x2];}catch(_0x175556){throw new Error(_0x1af9('0x45')+_0x404cf2[_0x1af9('0x46')]);}if(!_0x1698a1){if(_0x1c7f24[_0x1af9('0x47')]>0xc8){throw new Error(_0x1af9('0x48'));}else{throw new Error('lang\x20\x22'+_0x4272bf+'\x22\x20might\x20not\x20exist');}}try{_0x1698a1=eval(_0x1698a1)[0x0];}catch(_0x37a6ee){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x1af9('0x46')]);}const _0x2adf3b=_0x1698a1;_0x4bf35a=path['resolve'](__dirname,_0x1af9('0x3a'),rs[_0x1af9('0x28')](0x4)+_0x1af9('0x36'));fs[_0x1af9('0x29')](_0x4bf35a,_0x1698a1,{'encoding':'base64'});_0x4771b8=path[_0x1af9('0x27')](__dirname,_0x1af9('0x3a'),rs[_0x1af9('0x28')](0x4)+_0x1af9('0x49'));return convertFile(_0x4bf35a,_0x4771b8);})[_0x1af9('0x39')](function(){try{fs[_0x1af9('0x21')](_0x4bf35a);fs[_0x1af9('0x2a')](_0x4771b8,_0x1af9('0x2b'));}catch(_0x507477){logger[_0x1af9('0x19')](_0x507477);}logger['info'](_0x1af9('0x4a'),_0x4771b8[_0x1af9('0x3c')]('.')[0x0]);return _0x4771b8[_0x1af9('0x3c')]('.')[0x0];});};exports['googleASR']=function(_0x47c79c,_0x47b821,_0x25cd08){return google[_0x1af9('0x4b')](_0x47c79c,_0x47b821,_0x25cd08)[_0x1af9('0x39')](function(_0x8ee283){logger[_0x1af9('0x1e')](_0x8ee283[_0x1af9('0x4c')]);return rp(_0x8ee283);})[_0x1af9('0x39')](function(_0x484f11){var _0x66a520='';var _0x847ea1=0x0;try{fs[_0x1af9('0x21')](_0x47c79c);}catch(_0x4e0b20){logger[_0x1af9('0x19')](_0x4e0b20);}if(_0x484f11&&_0x484f11[_0x1af9('0x4d')]){_0x66a520=_0x484f11[_0x1af9('0x4d')][_0x1af9('0x4e')](function(_0x6a153a){return _0x6a153a&&_0x6a153a[_0x1af9('0x4f')][0x0]&&_0x6a153a[_0x1af9('0x4f')][0x0][_0x1af9('0x50')]?_0x6a153a[_0x1af9('0x4f')][0x0][_0x1af9('0x50')]:'';})[_0x1af9('0x51')]('\x0a');_0x847ea1=_0x484f11['results'][_0x1af9('0x4e')](function(_0x44eb99){return _0x44eb99&&_0x44eb99[_0x1af9('0x4f')][0x0]&&_0x44eb99[_0x1af9('0x4f')][0x0]['confidence']?_0x44eb99[_0x1af9('0x4f')][0x0][_0x1af9('0x52')]:0x0;})[_0x1af9('0x51')]('\x0a');}logger[_0x1af9('0x1e')]('googleASR\x20transcription',_0x66a520);logger[_0x1af9('0x1e')](_0x1af9('0x53'),_0x847ea1);return{'transcript':_0x66a520,'confidence':_0x847ea1};})[_0x1af9('0x54')](function(_0xf25ce4){logger[_0x1af9('0x19')](_0x1af9('0x55'),_0xf25ce4[_0x1af9('0x18')],_0xf25ce4[_0x1af9('0x56')],_0xf25ce4[_0x1af9('0x57')]);});};exports[_0x1af9('0x58')]=function(_0x565e44,_0x547d59,_0x4e8019,_0x128934){var _0x5c352e=apiai(_0x547d59,{'language':_0x128934||'en'});return _0x5c352e['textRequest'](_0x4e8019,{'sessionId':md5(_0x565e44)})['then'](function(_0x5bea01){logger['info'](JSON['stringify'](_0x5bea01));return{'source':_0x5bea01['result'][_0x1af9('0x59')],'resolvedQuery':_0x5bea01[_0x1af9('0x5a')]['resolvedQuery'],'action':_0x5bea01[_0x1af9('0x5a')]['action'],'actionIncomplete':_0x5bea01[_0x1af9('0x5a')][_0x1af9('0x5b')],'speech':_0x5bea01['result'][_0x1af9('0x5c')][_0x1af9('0x5d')],'score':_0x5bea01[_0x1af9('0x5a')][_0x1af9('0x5e')],'statusCode':_0x5bea01[_0x1af9('0x5f')]['code'],'endConversation':_0x5bea01['result'][_0x1af9('0x60')]['endConversation']||![],'isFallbackIntent':_0x5bea01[_0x1af9('0x5a')][_0x1af9('0x60')][_0x1af9('0x61')]};});};exports[_0x1af9('0x62')]=function(_0x5d2285,_0xa92b,_0x494335,_0x1ee70b,_0x105067,_0x1f1d6c){var _0x3ff57b=_0x1ee70b[_0x1af9('0x63')](/\\n/g,'\x0a');var _0x17f29a={'credentials':{'private_key':_0x3ff57b,'client_email':_0x494335}};var _0x1e8f24=new dialogflow['SessionsClient'](_0x17f29a);var _0x5c8bab=_0x1e8f24['sessionPath'](_0xa92b,md5(_0x5d2285));var _0x3f3d1a={'session':_0x5c8bab,'queryInput':{'text':{'text':_0x105067,'languageCode':_0x1f1d6c}}};return _0x1e8f24[_0x1af9('0x64')](_0x3f3d1a)[_0x1af9('0x39')](function(_0x279e34){if(_0x279e34&&_0x279e34[_0x1af9('0x47')]){logger[_0x1af9('0x1e')](_0x1af9('0x65'),JSON[_0x1af9('0x41')](_0x279e34));var _0x4d66bf=_0x279e34[0x0];if(_0x4d66bf){var _0x24f5f5={'action':_0x4d66bf[_0x1af9('0x66')]['action'],'allRequiredParamsPresent':_0x4d66bf['queryResult'][_0x1af9('0x67')],'endConversation':_0x4d66bf['queryResult'][_0x1af9('0x68')]&&_0x4d66bf[_0x1af9('0x66')]['diagnosticInfo'][_0x1af9('0x69')]?_0x4d66bf[_0x1af9('0x66')][_0x1af9('0x68')][_0x1af9('0x69')][_0x1af9('0x6a')][_0x1af9('0x6b')]:![],'fulfillmentText':_0x4d66bf['queryResult'][_0x1af9('0x6c')],'intentName':_0x4d66bf[_0x1af9('0x66')][_0x1af9('0x6d')][_0x1af9('0x56')],'intentDisplayName':_0x4d66bf[_0x1af9('0x66')][_0x1af9('0x6d')][_0x1af9('0x6e')],'isFallbackIntent':_0x4d66bf[_0x1af9('0x66')][_0x1af9('0x6d')][_0x1af9('0x6f')],'languageCode':_0x4d66bf[_0x1af9('0x66')][_0x1af9('0x70')],'queryText':_0x4d66bf[_0x1af9('0x66')][_0x1af9('0x71')],'responseId':_0x4d66bf[_0x1af9('0x72')],'score':_0x4d66bf[_0x1af9('0x66')][_0x1af9('0x73')],'speech':_0x4d66bf['queryResult'][_0x1af9('0x6c')],'providerResponse':JSON['stringify'](_0x279e34)};return _0x24f5f5;}}});};exports[_0x1af9('0x74')]=function(_0x5bcc44,_0x1f3ab0,_0x28f5a9,_0x2bc2cd){return tilde[_0x1af9('0x4b')](_0x5bcc44,_0x1f3ab0,_0x28f5a9,_0x2bc2cd)[_0x1af9('0x39')](function(_0x5489af){try{fs[_0x1af9('0x21')](_0x5bcc44);}catch(_0x22dbc5){logger[_0x1af9('0x19')](_0x22dbc5);}logger[_0x1af9('0x1e')](_0x1af9('0x75'),_0x5489af['transcript']);logger[_0x1af9('0x1e')](_0x1af9('0x76'),_0x5489af[_0x1af9('0x52')]);return _0x5489af;});};exports['awsPolly']=function(_0x4a3f85,_0x19596b,_0xfd4912,_0x5b125b,_0x17a02d,_0xb0c414){var _0x133b1a=path[_0x1af9('0x27')](__dirname,_0x1af9('0x3a'),rs[_0x1af9('0x28')](0x4)+'.mp3');var _0x494e19;return aws['polly'](_0x4a3f85,_0x19596b,_0xfd4912,_0x5b125b,_0x17a02d,_0xb0c414,_0x133b1a)['then'](function(){_0x494e19=path[_0x1af9('0x27')](__dirname,_0x1af9('0x3a'),rs[_0x1af9('0x28')](0x4)+'.wav');return convertFile(_0x133b1a,_0x494e19);})[_0x1af9('0x39')](function(){try{fs[_0x1af9('0x21')](_0x133b1a);fs[_0x1af9('0x2a')](_0x494e19,_0x1af9('0x2b'));}catch(_0x5c7184){logger['error'](_0x5c7184);}return _0x494e19[_0x1af9('0x3c')]('.')[0x0];});};exports['awsLex']=function(_0x2b3690,_0x508d64,_0x48d5e1,_0x38e551,_0x4aa388,_0xf7779){return aws['lex'](_0x2b3690,_0x508d64,_0x48d5e1,_0x38e551,_0x4aa388,_0xf7779)[_0x1af9('0x39')](function(_0x3e2f56){logger[_0x1af9('0x1e')](JSON['stringify'](_0x3e2f56));return _0x3e2f56;});};exports[_0x1af9('0x77')]=function(_0x5016ad,_0x19bde8,_0x10734f,_0x2eff1b){var _0x54dd98=util[_0x1af9('0x78')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x5016ad,encodeURIComponent(_0x19bde8),_0x10734f,_0x2eff1b);var _0x5cb6c7=path['resolve'](__dirname,_0x1af9('0x3a'),rs['generate'](0x4)+_0x1af9('0x36'));var _0x926b7b;return downloadFile(_0x54dd98,_0x5cb6c7)[_0x1af9('0x39')](function(){_0x926b7b=path['resolve'](__dirname,'tmp',rs[_0x1af9('0x28')](0x4)+'.wav');return convertFile(_0x5cb6c7,_0x926b7b);})[_0x1af9('0x39')](function(){try{fs['unlink'](_0x5cb6c7);fs[_0x1af9('0x2a')](_0x926b7b,_0x1af9('0x2b'));}catch(_0x2d6415){logger[_0x1af9('0x19')](_0x2d6415);}return _0x926b7b['split']('.')[0x0];});};exports['ispeechASR']=function(_0x5355e2,_0x24c8aa,_0x2c1924,_0x25f37f){var _0x1eeceb=util[_0x1af9('0x78')](_0x1af9('0x79'),ISPEECH_API,_0x24c8aa,_0x2c1924,base64Encode(_0x5355e2),_0x25f37f?util[_0x1af9('0x78')](_0x1af9('0x7a'),encodeURIComponent(_0x25f37f)):'freeform=3');return uploadFile(_0x1eeceb)[_0x1af9('0x39')](function(_0x42d34f){return querystring['parse'](_0x42d34f);});};exports[_0x1af9('0x7b')]=function(_0xba2348,_0x207eef){return sestek['nda'](_0xba2348,_0x207eef)[_0x1af9('0x39')](function(_0x16836c){logger[_0x1af9('0x1e')](JSON[_0x1af9('0x41')](_0x16836c));var _0x37ff5c={'speech':_0x16836c[_0x1af9('0x7c')],'action':_0x16836c[_0x1af9('0x7d')]?_0x16836c['channelData'][_0x1af9('0x7e')]:undefined,'actiondata':_0x16836c[_0x1af9('0x7d')]?_0x16836c[_0x1af9('0x7d')][_0x1af9('0x7f')]:undefined};if(_0x16836c['channelData']&&_0x16836c['channelData'][_0x1af9('0x80')]){return base64Decode(_0x16836c['channelData'][_0x1af9('0x80')][_0x1af9('0x81')],path['resolve'](__dirname,'tmp',rs[_0x1af9('0x28')](0x4)+_0x1af9('0x49')))[_0x1af9('0x39')](function(_0x15d296){_0x37ff5c[_0x1af9('0x82')]=_0x15d296;return _0x37ff5c;});}return _0x37ff5c;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x87d6=['status','code','metadata','googleDialogflowV2','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','Tilde\x20ASR\x20confidence','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','parse','sestekNDA','nda','CustomAction','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','md5','path','querystring','request-promise','sox','google-tts-api','url','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','error','download\x20error','pipe','end','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','unlink','readFileSync','toString','base64','googleCloudTTS','?key=','ssml','input','audioConfig','MP3','text:synthesize','POST','then','from','audioContent','chmodSync','777','googleCloudTTS\x20path','split','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','.mp3','writeFileSync','goggleTTS\x20path','asr','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','action','actionIncomplete','fulfillment','speech'];(function(_0x547d34,_0x162c19){var _0xe1ae7a=function(_0x394405){while(--_0x394405){_0x547d34['push'](_0x547d34['shift']());}};_0xe1ae7a(++_0x162c19);}(_0x87d6,0x1ba));var _0x687d=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x87d6[_0x12f688];return _0x59c3de;};'use strict';var apiai=require(_0x687d('0x0'));var BPromise=require(_0x687d('0x1'));var dialogflow=require(_0x687d('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x687d('0x3'));var md5=require(_0x687d('0x4'));var path=require(_0x687d('0x5'));var querystring=require(_0x687d('0x6'));var rp=require(_0x687d('0x7'));var rs=require('randomstring');var sox=require(_0x687d('0x8'));var tts=require(_0x687d('0x9'));var urlParse=require(_0x687d('0xa'))['parse'];var util=require(_0x687d('0xb'));var aws=require(_0x687d('0xc'));var google=require('./google');var sestek=require(_0x687d('0xd'));var tilde=require(_0x687d('0xe'));var logger=require(_0x687d('0xf'))(_0x687d('0x10'));var ISPEECH_API=_0x687d('0x11');function downloadFile(_0x7e5cee,_0x482dc2){return new BPromise(function(_0x7bf8b8,_0x4e8b2a){var _0x1ac0ea=urlParse(_0x7e5cee);var _0x39d5e0=_0x1ac0ea[_0x687d('0x12')]===_0x687d('0x13')?https:http;var _0x3fff8f={'host':_0x1ac0ea[_0x687d('0x14')],'path':_0x1ac0ea['path'],'headers':{'user-agent':_0x687d('0x15')}};_0x39d5e0[_0x687d('0x16')](_0x3fff8f,function(_0x121e29){if(_0x121e29[_0x687d('0x17')]!==0xc8){logger['error'](_0x687d('0x18')+_0x7e5cee+_0x687d('0x19')+_0x121e29[_0x687d('0x17')]+'\x20('+_0x121e29[_0x687d('0x1a')]+')');_0x4e8b2a(new Error(_0x687d('0x18')+_0x7e5cee+_0x687d('0x19')+_0x121e29[_0x687d('0x17')]+'\x20('+_0x121e29[_0x687d('0x1a')]+')'));return;}var _0x193d90=fs[_0x687d('0x1b')](_0x482dc2);_0x193d90['on'](_0x687d('0x1c'),function(){logger[_0x687d('0x1d')](_0x687d('0x1e'));_0x193d90['close'](_0x7bf8b8);});_0x193d90['on']('error',function(_0x4ef85e){fs['unlink'](_0x482dc2);logger[_0x687d('0x1f')](_0x687d('0x20'),_0x4ef85e);_0x4e8b2a(_0x4ef85e);});_0x121e29[_0x687d('0x21')](_0x193d90);})['on'](_0x687d('0x1f'),function(_0x59053c){logger['error'](_0x59053c);_0x4e8b2a(_0x59053c);})[_0x687d('0x22')]();});}function uploadFile(_0x27f2e2){return new BPromise(function(_0x4f39e1,_0x38329b){var _0x41b989=urlParse(_0x27f2e2);var _0x4ac9e=_0x41b989[_0x687d('0x12')]===_0x687d('0x13')?https:http;var _0x4f85e6={'host':_0x41b989[_0x687d('0x14')],'path':_0x41b989['path'],'headers':{'user-agent':_0x687d('0x15')}};_0x4ac9e[_0x687d('0x16')](_0x4f85e6,function(_0x1fa699){if(_0x1fa699[_0x687d('0x17')]!==0xc8){_0x38329b(new Error(_0x687d('0x18')+_0x27f2e2+'\x20failed,\x20status\x20code\x20=\x20'+_0x1fa699[_0x687d('0x17')]+'\x20('+_0x1fa699[_0x687d('0x1a')]+')'));return;}var _0x530fb9='';_0x1fa699['on']('data',function(_0x3d2f3d){_0x530fb9+=_0x3d2f3d;});_0x1fa699['on']('end',function(){_0x4f39e1(_0x530fb9);});})['on'](_0x687d('0x1f'),function(_0x440431){_0x38329b(_0x440431);})[_0x687d('0x22')]();});}function convertFile(_0x5d0de6,_0x5b0eb9){return new BPromise(function(_0x2f42b2,_0x5f11ca){var _0x18e92a=sox['transcode'](_0x5d0de6,_0x5b0eb9,{'sampleRate':0x1f40,'format':_0x687d('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x18e92a['on'](_0x687d('0x1f'),function(_0x2aab34){logger[_0x687d('0x1f')](_0x687d('0x24'),_0x2aab34);_0x5f11ca(_0x2aab34);});_0x18e92a['on'](_0x687d('0x22'),function(){logger[_0x687d('0x1d')](_0x687d('0x25'));_0x2f42b2();});_0x18e92a[_0x687d('0x26')]();});}function base64Decode(_0x3dbe17,_0xe22638){var _0x17f943=path[_0x687d('0x27')](__dirname,_0x687d('0x28'),rs[_0x687d('0x29')](0x4)+_0x687d('0x2a'));fs['writeFileSync'](_0x17f943,_0x3dbe17,'base64');return convertFile(_0x17f943,_0xe22638)['then'](function(){try{fs[_0x687d('0x2b')](_0x17f943);fs['chmodSync'](_0xe22638,'777');}catch(_0x37e61c){logger[_0x687d('0x1f')](_0x37e61c);}return _0xe22638['split']('.')[0x0];});}function base64Encode(_0x55dc21){var _0x1337bb=fs[_0x687d('0x2c')](_0x55dc21);return new Buffer(_0x1337bb)[_0x687d('0x2d')](_0x687d('0x2e'));}exports[_0x687d('0x2f')]=function(_0x562ae0,_0x2acc5d,_0x3c82a5,_0x5a5ec5,_0x13bbb4,_0x1aa0d1){var _0x46caa5,_0x32cbdd;var _0x4fbe5a='https://texttospeech.googleapis.com/v1/';var _0x702b20=_0x687d('0x30')+_0x562ae0;var _0x15c771={};if(_0x2acc5d===_0x687d('0x31')){_0x15c771[_0x687d('0x32')]={'ssml':_0x3c82a5};}else{_0x15c771[_0x687d('0x32')]={'text':_0x3c82a5};};_0x15c771['voice']={'languageCode':_0x5a5ec5,'ssmlGender':_0x13bbb4};_0x15c771[_0x687d('0x33')]={'audioEncoding':_0x687d('0x34'),'sampleRateHertz':0x1f40};var _0x3e5d41={'url':_0x4fbe5a+_0x687d('0x35')+_0x702b20,'method':_0x687d('0x36'),'json':!![],'body':_0x15c771};return rp(_0x3e5d41)[_0x687d('0x37')](function(_0x44c722){return new BPromise(function(_0xc2ee2e,_0x2fba02){_0x46caa5=path[_0x687d('0x27')](__dirname,_0x687d('0x28'),rs['generate'](0x4)+'.mp3');var _0x4b538b=Buffer[_0x687d('0x38')](_0x44c722[_0x687d('0x39')],_0x687d('0x2e'));return fs['writeFile'](_0x46caa5,_0x4b538b,function(_0x16e9f1){_0x2fba02(_0x16e9f1);},function(_0x3d17b4){fs[_0x687d('0x3a')](_0x46caa5,'777');_0xc2ee2e(_0x3d17b4);});});})[_0x687d('0x37')](function(_0x2f4865){_0x32cbdd=path[_0x687d('0x27')](__dirname,_0x687d('0x28'),rs['generate'](0x4)+_0x687d('0x2a'));return convertFile(_0x46caa5,_0x32cbdd);})[_0x687d('0x37')](function(){try{fs['unlink'](_0x46caa5);fs[_0x687d('0x3a')](_0x32cbdd,_0x687d('0x3b'));}catch(_0x19792a){logger['error'](_0x19792a);}logger[_0x687d('0x1d')](_0x687d('0x3c'),_0x32cbdd[_0x687d('0x3d')]('.')[0x0]);return _0x32cbdd[_0x687d('0x3d')]('.')[0x0];});};exports['googleTTS']=function(_0x304e83,_0x47448d){var _0xdcdd14=_0x687d('0x3e');var _0x182be9,_0x2082e1;var _0x45805d;var _0x187dd6={'encoding':'utf8','method':_0x687d('0x36'),'timeout':0x2710,'url':_0xdcdd14,'headers':{'Content-Type':_0x687d('0x3f')},'body':_0x687d('0x40')+encodeURIComponent(JSON[_0x687d('0x41')]([[['jQ1olc',JSON[_0x687d('0x41')]([_0x304e83,_0x47448d||'en',![],_0x687d('0x42')]),null,_0x687d('0x43')]]]))};return rp(_0x187dd6)[_0x687d('0x37')](function(_0x147a6a){try{_0x45805d=eval(_0x147a6a[_0x687d('0x44')](0x5))[0x0][0x2];}catch(_0x35c741){throw new Error(_0x687d('0x45')+_0x147a6a[_0x687d('0x46')]);}if(!_0x45805d){if(_0x304e83[_0x687d('0x47')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x47448d+'\x22\x20might\x20not\x20exist');}}try{_0x45805d=eval(_0x45805d)[0x0];}catch(_0x429447){throw new Error(_0x687d('0x45')+res[_0x687d('0x46')]);}const _0x18df07=_0x45805d;_0x182be9=path[_0x687d('0x27')](__dirname,_0x687d('0x28'),rs[_0x687d('0x29')](0x4)+_0x687d('0x48'));fs[_0x687d('0x49')](_0x182be9,_0x45805d,{'encoding':_0x687d('0x2e')});_0x2082e1=path[_0x687d('0x27')](__dirname,_0x687d('0x28'),rs[_0x687d('0x29')](0x4)+_0x687d('0x2a'));return convertFile(_0x182be9,_0x2082e1);})[_0x687d('0x37')](function(){try{fs['unlink'](_0x182be9);fs['chmodSync'](_0x2082e1,'777');}catch(_0x4dca87){logger[_0x687d('0x1f')](_0x4dca87);}logger[_0x687d('0x1d')](_0x687d('0x4a'),_0x2082e1['split']('.')[0x0]);return _0x2082e1[_0x687d('0x3d')]('.')[0x0];});};exports['googleASR']=function(_0x1758ea,_0x287000,_0x22363e){return google[_0x687d('0x4b')](_0x1758ea,_0x287000,_0x22363e)[_0x687d('0x37')](function(_0x53a101){logger['info'](_0x53a101['uri']);return rp(_0x53a101);})['then'](function(_0x535c70){var _0x3b9eb2='';var _0x25b6c7=0x0;try{fs[_0x687d('0x2b')](_0x1758ea);}catch(_0x4a7c60){logger['error'](_0x4a7c60);}if(_0x535c70&&_0x535c70[_0x687d('0x4c')]){_0x3b9eb2=_0x535c70[_0x687d('0x4c')]['map'](function(_0x21dcf6){return _0x21dcf6&&_0x21dcf6[_0x687d('0x4d')][0x0]&&_0x21dcf6[_0x687d('0x4d')][0x0][_0x687d('0x4e')]?_0x21dcf6[_0x687d('0x4d')][0x0][_0x687d('0x4e')]:'';})[_0x687d('0x4f')]('\x0a');_0x25b6c7=_0x535c70[_0x687d('0x4c')][_0x687d('0x50')](function(_0x433643){return _0x433643&&_0x433643['alternatives'][0x0]&&_0x433643[_0x687d('0x4d')][0x0]['confidence']?_0x433643['alternatives'][0x0][_0x687d('0x51')]:0x0;})[_0x687d('0x4f')]('\x0a');}logger[_0x687d('0x1d')](_0x687d('0x52'),_0x3b9eb2);logger[_0x687d('0x1d')](_0x687d('0x53'),_0x25b6c7);return{'transcript':_0x3b9eb2,'confidence':_0x25b6c7};})[_0x687d('0x54')](function(_0x377c94){logger[_0x687d('0x1f')]('[%s]\x20%s:%s',_0x377c94[_0x687d('0x17')],_0x377c94[_0x687d('0x55')],_0x377c94[_0x687d('0x56')]);});};exports[_0x687d('0x57')]=function(_0x24dbcd,_0x375ade,_0x1ae8a2,_0x13fcb3){var _0x2de977=apiai(_0x375ade,{'language':_0x13fcb3||'en'});return _0x2de977[_0x687d('0x58')](_0x1ae8a2,{'sessionId':md5(_0x24dbcd)})[_0x687d('0x37')](function(_0x3dc543){logger[_0x687d('0x1d')](JSON[_0x687d('0x41')](_0x3dc543));return{'source':_0x3dc543[_0x687d('0x59')]['source'],'resolvedQuery':_0x3dc543['result']['resolvedQuery'],'action':_0x3dc543[_0x687d('0x59')][_0x687d('0x5a')],'actionIncomplete':_0x3dc543[_0x687d('0x59')][_0x687d('0x5b')],'speech':_0x3dc543[_0x687d('0x59')][_0x687d('0x5c')][_0x687d('0x5d')],'score':_0x3dc543[_0x687d('0x59')]['score'],'statusCode':_0x3dc543[_0x687d('0x5e')][_0x687d('0x5f')],'endConversation':_0x3dc543[_0x687d('0x59')]['metadata']['endConversation']||![],'isFallbackIntent':_0x3dc543[_0x687d('0x59')][_0x687d('0x60')]['isFallbackIntent']};});};exports[_0x687d('0x61')]=function(_0x2e297d,_0x576c17,_0x444efe,_0x564b10,_0x3ce0d8,_0x3a02df){var _0x589348=_0x564b10[_0x687d('0x62')](/\\n/g,'\x0a');var _0x380c2a={'credentials':{'private_key':_0x589348,'client_email':_0x444efe}};var _0x289568=new dialogflow[(_0x687d('0x63'))](_0x380c2a);var _0x529684=_0x289568['sessionPath'](_0x576c17,md5(_0x2e297d));var _0x457b93={'session':_0x529684,'queryInput':{'text':{'text':_0x3ce0d8,'languageCode':_0x3a02df}}};return _0x289568[_0x687d('0x64')](_0x457b93)[_0x687d('0x37')](function(_0x325b5a){if(_0x325b5a&&_0x325b5a['length']){logger[_0x687d('0x1d')](_0x687d('0x65'),JSON[_0x687d('0x41')](_0x325b5a));var _0x2bfe82=_0x325b5a[0x0];if(_0x2bfe82){var _0x2a5127={'action':_0x2bfe82[_0x687d('0x66')]['action'],'allRequiredParamsPresent':_0x2bfe82[_0x687d('0x66')][_0x687d('0x67')],'endConversation':_0x2bfe82[_0x687d('0x66')][_0x687d('0x68')]&&_0x2bfe82[_0x687d('0x66')]['diagnosticInfo']['fields']?_0x2bfe82[_0x687d('0x66')][_0x687d('0x68')][_0x687d('0x69')][_0x687d('0x6a')][_0x687d('0x6b')]:![],'fulfillmentText':_0x2bfe82[_0x687d('0x66')][_0x687d('0x6c')],'intentName':_0x2bfe82[_0x687d('0x66')][_0x687d('0x6d')][_0x687d('0x55')],'intentDisplayName':_0x2bfe82[_0x687d('0x66')][_0x687d('0x6d')][_0x687d('0x6e')],'isFallbackIntent':_0x2bfe82['queryResult']['intent'][_0x687d('0x6f')],'languageCode':_0x2bfe82['queryResult'][_0x687d('0x70')],'queryText':_0x2bfe82[_0x687d('0x66')]['queryText'],'responseId':_0x2bfe82[_0x687d('0x71')],'score':_0x2bfe82[_0x687d('0x66')][_0x687d('0x72')],'speech':_0x2bfe82['queryResult'][_0x687d('0x6c')],'providerResponse':JSON[_0x687d('0x41')](_0x325b5a)};return _0x2a5127;}}});};exports['tildeASR']=function(_0x409b1f,_0x2cd1b1,_0x246450,_0x43ef4a){return tilde[_0x687d('0x4b')](_0x409b1f,_0x2cd1b1,_0x246450,_0x43ef4a)[_0x687d('0x37')](function(_0x3e99bd){try{fs[_0x687d('0x2b')](_0x409b1f);}catch(_0x1c5b89){logger['error'](_0x1c5b89);}logger['info']('Tilde\x20ASR\x20transcription',_0x3e99bd['transcript']);logger[_0x687d('0x1d')](_0x687d('0x73'),_0x3e99bd[_0x687d('0x51')]);return _0x3e99bd;});};exports['awsPolly']=function(_0x126748,_0x20f904,_0x2e9601,_0x2c87e5,_0x431f64,_0x364250){var _0x4c07a6=path[_0x687d('0x27')](__dirname,_0x687d('0x28'),rs[_0x687d('0x29')](0x4)+_0x687d('0x48'));var _0x35e8be;return aws[_0x687d('0x74')](_0x126748,_0x20f904,_0x2e9601,_0x2c87e5,_0x431f64,_0x364250,_0x4c07a6)[_0x687d('0x37')](function(){_0x35e8be=path[_0x687d('0x27')](__dirname,_0x687d('0x28'),rs[_0x687d('0x29')](0x4)+_0x687d('0x2a'));return convertFile(_0x4c07a6,_0x35e8be);})['then'](function(){try{fs['unlink'](_0x4c07a6);fs[_0x687d('0x3a')](_0x35e8be,'777');}catch(_0x482043){logger['error'](_0x482043);}return _0x35e8be['split']('.')[0x0];});};exports[_0x687d('0x75')]=function(_0x3c3107,_0x5c0e1d,_0x447860,_0x3cd9e0,_0x36553e,_0x537874){return aws['lex'](_0x3c3107,_0x5c0e1d,_0x447860,_0x3cd9e0,_0x36553e,_0x537874)[_0x687d('0x37')](function(_0x1465cb){logger[_0x687d('0x1d')](JSON[_0x687d('0x41')](_0x1465cb));return _0x1465cb;});};exports[_0x687d('0x76')]=function(_0x1e47d8,_0x12ea33,_0x18f479,_0x3207b7){var _0x44794a=util[_0x687d('0x77')](_0x687d('0x78'),ISPEECH_API,_0x1e47d8,encodeURIComponent(_0x12ea33),_0x18f479,_0x3207b7);var _0x45d474=path['resolve'](__dirname,_0x687d('0x28'),rs[_0x687d('0x29')](0x4)+_0x687d('0x48'));var _0x46835c;return downloadFile(_0x44794a,_0x45d474)[_0x687d('0x37')](function(){_0x46835c=path[_0x687d('0x27')](__dirname,_0x687d('0x28'),rs[_0x687d('0x29')](0x4)+_0x687d('0x2a'));return convertFile(_0x45d474,_0x46835c);})[_0x687d('0x37')](function(){try{fs[_0x687d('0x2b')](_0x45d474);fs['chmodSync'](_0x46835c,_0x687d('0x3b'));}catch(_0x2f56d1){logger[_0x687d('0x1f')](_0x2f56d1);}return _0x46835c['split']('.')[0x0];});};exports[_0x687d('0x79')]=function(_0x300cbf,_0x1efcbe,_0x5494e2,_0x4022fa){var _0x35c4a9=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1efcbe,_0x5494e2,base64Encode(_0x300cbf),_0x4022fa?util[_0x687d('0x77')](_0x687d('0x7a'),encodeURIComponent(_0x4022fa)):_0x687d('0x7b'));return uploadFile(_0x35c4a9)[_0x687d('0x37')](function(_0x31c4b9){return querystring[_0x687d('0x7c')](_0x31c4b9);});};exports[_0x687d('0x7d')]=function(_0x287839,_0x371311){return sestek[_0x687d('0x7e')](_0x287839,_0x371311)[_0x687d('0x37')](function(_0x31d829){logger['info'](JSON['stringify'](_0x31d829));var _0x2062c0={'speech':_0x31d829['text'],'action':_0x31d829['channelData']?_0x31d829['channelData'][_0x687d('0x7f')]:undefined,'actiondata':_0x31d829['channelData']?_0x31d829[_0x687d('0x80')][_0x687d('0x81')]:undefined};if(_0x31d829[_0x687d('0x80')]&&_0x31d829[_0x687d('0x80')]['AudioFromTts']){return base64Decode(_0x31d829['channelData'][_0x687d('0x82')][_0x687d('0x83')],path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x687d('0x2a')))['then'](function(_0x19e3d0){_0x2062c0[_0x687d('0x84')]=_0x19e3d0;return _0x2062c0;});}return _0x2062c0;});};exports[_0x687d('0x85')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index ea2f3a4..6203957 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 _0x846d=['exports'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x846d,0x186));var _0xd846=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0x846d[_0x9d1e6b];return _0x2b3070;};var nda=require('./nda');module[_0xd846('0x0')]={'nda':nda}; \ No newline at end of file +var _0xfe92=['exports'];(function(_0xdc0783,_0x2ba12c){var _0x3e2db6=function(_0x56bd8e){while(--_0x56bd8e){_0xdc0783['push'](_0xdc0783['shift']());}};_0x3e2db6(++_0x2ba12c);}(_0xfe92,0x132));var _0x2fe9=function(_0x5816bf,_0x3f0cd7){_0x5816bf=_0x5816bf-0x0;var _0x1cd8a3=_0xfe92[_0x5816bf];return _0x1cd8a3;};var nda=require('./nda');module[_0x2fe9('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index f9b8dfb..3ae9a19 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 _0x1782=['uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','channelData','ProjectName','ndagenerate_audio','body','AudioOutputSettings','audio/wav','CustomAction','custom_action_data','info','request-promise','../../../../../config/logger','agi','exports','POST','resolve','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda'];(function(_0x3b3c57,_0x38ff50){var _0x594aa0=function(_0x447767){while(--_0x447767){_0x3b3c57['push'](_0x3b3c57['shift']());}};_0x594aa0(++_0x38ff50);}(_0x1782,0x13e));var _0x2178=function(_0x29c708,_0x86df4f){_0x29c708=_0x29c708-0x0;var _0x18e405=_0x1782[_0x29c708];return _0x18e405;};'use strict';var rp=require(_0x2178('0x0'));var url=require('url');var logger=require(_0x2178('0x1'))(_0x2178('0x2'));module[_0x2178('0x3')]=function(_0x1c92e6,_0x17b0da){var _0x4a185d={'method':_0x2178('0x4'),'uri':url[_0x2178('0x5')](_0x17b0da['ndauth_url'],'/token'),'form':{'grant_type':_0x2178('0x6'),'username':_0x17b0da[_0x2178('0x7')],'password':_0x17b0da['password']},'json':!![]};return rp(_0x4a185d)['then'](function(_0x4cf22a){var _0x3b4115={'method':_0x2178('0x4'),'uri':url[_0x2178('0x5')](_0x17b0da[_0x2178('0x8')],_0x2178('0x9')),'body':{'type':_0x17b0da[_0x2178('0xa')]||'message','channelId':_0x2178('0xb'),'conversation':{'id':_0x1c92e6[_0x2178('0xc')]},'from':{'id':_0x1c92e6[_0x2178('0xd')],'name':_0x1c92e6[_0x2178('0xe')]},'recipient':{'id':_0x1c92e6[_0x2178('0xf')],'name':_0x1c92e6[_0x2178('0x10')]},'text':_0x17b0da[_0x2178('0x11')],'channelData':{}},'headers':{'Authorization':_0x2178('0x12')+_0x4cf22a[_0x2178('0x13')]},'json':!![]};if(_0x17b0da[_0x2178('0x14')]){_0x3b4115['body'][_0x2178('0x15')][_0x2178('0x16')]=_0x17b0da['project'];}if(_0x17b0da[_0x2178('0x17')]=='1'){_0x3b4115[_0x2178('0x18')][_0x2178('0x15')][_0x2178('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x2178('0x1a')};}if(_0x17b0da['custom_action']){_0x3b4115['body']['channelData'][_0x2178('0x1b')]=_0x17b0da['custom_action'];if(_0x17b0da[_0x2178('0x1c')]){_0x3b4115[_0x2178('0x18')]['channelData']['CustomActionData']=_0x17b0da[_0x2178('0x1c')];}}logger[_0x2178('0x1d')](JSON['stringify'](_0x3b4115));return rp(_0x3b4115);});}; \ No newline at end of file +var _0xbd20=['body','channelData','custom_action','CustomAction','custom_action_data','CustomActionData','request-promise','agi','exports','resolve','ndauth_url','/token','username','password','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','Nda','uniqueid','callerid','calleridname','dnid','text','access_token','project','ProjectName','ndagenerate_audio'];(function(_0x476b00,_0x250877){var _0x44ec8e=function(_0xec6b23){while(--_0xec6b23){_0x476b00['push'](_0x476b00['shift']());}};_0x44ec8e(++_0x250877);}(_0xbd20,0x14a));var _0x0bd2=function(_0x503ba3,_0x70f5df){_0x503ba3=_0x503ba3-0x0;var _0x2991cf=_0xbd20[_0x503ba3];return _0x2991cf;};'use strict';var rp=require(_0x0bd2('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0x0bd2('0x1'));module[_0x0bd2('0x2')]=function(_0x46cde4,_0x34986a){var _0x2f1ff7={'method':'POST','uri':url[_0x0bd2('0x3')](_0x34986a[_0x0bd2('0x4')],_0x0bd2('0x5')),'form':{'grant_type':'password','username':_0x34986a[_0x0bd2('0x6')],'password':_0x34986a[_0x0bd2('0x7')]},'json':!![]};return rp(_0x2f1ff7)['then'](function(_0x57dc02){var _0x377853={'method':_0x0bd2('0x8'),'uri':url[_0x0bd2('0x3')](_0x34986a[_0x0bd2('0x9')],_0x0bd2('0xa')),'body':{'type':_0x34986a['ndaactivity_type']||'message','channelId':_0x0bd2('0xb'),'conversation':{'id':_0x46cde4[_0x0bd2('0xc')]},'from':{'id':_0x46cde4[_0x0bd2('0xd')],'name':_0x46cde4[_0x0bd2('0xe')]},'recipient':{'id':_0x46cde4[_0x0bd2('0xf')],'name':_0x46cde4['extension']},'text':_0x34986a[_0x0bd2('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x57dc02[_0x0bd2('0x11')]},'json':!![]};if(_0x34986a[_0x0bd2('0x12')]){_0x377853['body']['channelData'][_0x0bd2('0x13')]=_0x34986a[_0x0bd2('0x12')];}if(_0x34986a[_0x0bd2('0x14')]=='1'){_0x377853[_0x0bd2('0x15')][_0x0bd2('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x34986a[_0x0bd2('0x17')]){_0x377853[_0x0bd2('0x15')]['channelData'][_0x0bd2('0x18')]=_0x34986a[_0x0bd2('0x17')];if(_0x34986a[_0x0bd2('0x19')]){_0x377853[_0x0bd2('0x15')][_0x0bd2('0x16')][_0x0bd2('0x1a')]=_0x34986a[_0x0bd2('0x19')];}}logger['info'](JSON['stringify'](_0x377853));return rp(_0x377853);});}; \ 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 7d5f496..04de897 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 _0x39c3=['exports'];(function(_0x3f4dcf,_0x388cca){var _0x427da9=function(_0xa4a727){while(--_0xa4a727){_0x3f4dcf['push'](_0x3f4dcf['shift']());}};_0x427da9(++_0x388cca);}(_0x39c3,0x179));var _0x339c=function(_0x47bc58,_0x1e1998){_0x47bc58=_0x47bc58-0x0;var _0x4a0860=_0x39c3[_0x47bc58];return _0x4a0860;};'use strict';var asr=require('./lib/api');module[_0x339c('0x0')]=function(_0x4f0d72,_0x5af711,_0x5e1db2,_0x4cf74a){return asr(_0x4f0d72,_0x5af711,_0x5e1db2,_0x4cf74a);}; \ No newline at end of file +var _0x1966=['./lib/api','exports'];(function(_0x30ffad,_0x4f3d16){var _0x40e03b=function(_0x5dfcfe){while(--_0x5dfcfe){_0x30ffad['push'](_0x30ffad['shift']());}};_0x40e03b(++_0x4f3d16);}(_0x1966,0x148));var _0x6196=function(_0x480fe5,_0xd77acf){_0x480fe5=_0x480fe5-0x0;var _0x31bdc8=_0x1966[_0x480fe5];return _0x31bdc8;};'use strict';var asr=require(_0x6196('0x0'));module[_0x6196('0x1')]=function(_0x5f225c,_0x14bb6a,_0x181ea3,_0x3d99a1){return asr(_0x5f225c,_0x14bb6a,_0x181ea3,_0x3d99a1);}; \ 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 1eddca5..3e9dae3 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 _0xd2cc=['createHash','sha1','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','isObject','open','message','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE'];(function(_0xb66c12,_0x24f744){var _0x34a4c7=function(_0x36dca9){while(--_0x36dca9){_0xb66c12['push'](_0xb66c12['shift']());}};_0x34a4c7(++_0x24f744);}(_0xd2cc,0x127));var _0xcd2c=function(_0x59e2e7,_0x84f335){_0x59e2e7=_0x59e2e7-0x0;var _0x3bbe7d=_0xd2cc[_0x59e2e7];return _0x3bbe7d;};'use strict';var BPromise=require(_0xcd2c('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xcd2c('0x1'));var crypto=require(_0xcd2c('0x2'));var logger=require(_0xcd2c('0x3'))(_0xcd2c('0x4'));module[_0xcd2c('0x5')]=function(_0x2cc2da,_0x57cc9b,_0x18c47a,_0x49ce5e){return new BPromise(function(_0x409b5f,_0xeec1c9){logger[_0xcd2c('0x6')](_0xcd2c('0x7'),_0x49ce5e||_0xcd2c('0x8'));var _0x192142=new WebSocket(_0x49ce5e||_0xcd2c('0x8'),{'perMessageDeflate':![]});var _0x444feb='';var _0x53a945='0';var _0x4e0dc3='1';var _0x3178fd='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x184c49(_0x39faef){var _0x154d2d=crypto[_0xcd2c('0x9')](_0xcd2c('0xa'));_0x154d2d['update'](_0x39faef);return _0x154d2d['digest'](_0xcd2c('0xb'));}function _0x4a02a9(){try{logger[_0xcd2c('0x6')](_0xcd2c('0xc'));var _0x4e37e1=moment()['unix']();var _0x16b678=_0x184c49(_0x4e37e1+_0x57cc9b+_0x18c47a);_0x192142[_0xcd2c('0xd')](JSON[_0xcd2c('0xe')]({'appID':_0x57cc9b,'timestamp':_0x4e37e1,'appKey':_0x16b678}));var _0x4002d7=fs[_0xcd2c('0xf')](_0x2cc2da);_0x4002d7['on'](_0xcd2c('0x10'),function(_0x43ca6e){_0x192142['send'](_0x43ca6e);});_0x4002d7['on'](_0xcd2c('0x11'),function(){_0x192142['send'](_0xcd2c('0x12'));});}catch(_0x36063b){logger[_0xcd2c('0x13')](_0xcd2c('0x14'),JSON[_0xcd2c('0xe')](_0x36063b));_0x192142[_0xcd2c('0x15')]();}}function _0x3fff26(_0x46168d){try{if(_0x46168d){var _0x44ad09=JSON[_0xcd2c('0x16')](_0x46168d);switch(_0x44ad09['status']){case 0x0:if(_0x44ad09[_0xcd2c('0x17')]){if(_0x44ad09[_0xcd2c('0x17')][_0xcd2c('0x18')]){logger['info'](_0xcd2c('0x19'),JSON[_0xcd2c('0xe')](_0x44ad09['result']['hypotheses']));_0x444feb=_0x44ad09['result']['hypotheses'][0x0]['transcript'];_0x53a945=_0x44ad09[_0xcd2c('0x17')][_0xcd2c('0x1a')][0x0][_0xcd2c('0x1b')];_0x4e0dc3='0';_0x3178fd=_0xcd2c('0x1c');_0x192142[_0xcd2c('0x15')]();}}break;case 0x1:logger['info'](_0xcd2c('0x1d'));_0x4e0dc3='1';_0x3178fd='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xcd2c('0x6')](_0xcd2c('0x1e'));_0x4e0dc3='2';_0x3178fd=_0xcd2c('0x1e');break;case 0x9:logger[_0xcd2c('0x6')](_0xcd2c('0x1f'));_0x4e0dc3='9';_0x3178fd=_0xcd2c('0x1f');break;case 0xa:logger['info'](_0xcd2c('0x20'));_0x4e0dc3='10';_0x3178fd=_0xcd2c('0x20');break;case 0xb:logger[_0xcd2c('0x6')](_0xcd2c('0x21'));_0x4e0dc3='11';_0x3178fd=_0xcd2c('0x21');}}}catch(_0x523580){logger[_0xcd2c('0x13')](_0xcd2c('0x22'),JSON[_0xcd2c('0xe')](_0x523580));_0x192142[_0xcd2c('0x15')]();}}function _0x507d42(){logger[_0xcd2c('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x409b5f({'transcript':_0x444feb,'confidence':_0x53a945,'status':_0x4e0dc3,'status_message':_0x3178fd});}function _0x363284(_0x244ec0){logger[_0xcd2c('0x13')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x244ec0)){logger['error'](_[_0xcd2c('0x23')](_0x244ec0)?JSON[_0xcd2c('0xe')](_0x244ec0):_0x244ec0);}}_0x192142['on'](_0xcd2c('0x24'),_0x4a02a9);_0x192142['on'](_0xcd2c('0x25'),_0x3fff26);_0x192142['on']('close',_0x507d42);_0x192142['on'](_0xcd2c('0x13'),_0x363284);});}; \ No newline at end of file +var _0xff05=['transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','lodash','moment','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','final'];(function(_0x32f0d7,_0x5bee5c){var _0x481711=function(_0x1c56d8){while(--_0x1c56d8){_0x32f0d7['push'](_0x32f0d7['shift']());}};_0x481711(++_0x5bee5c);}(_0xff05,0xca));var _0x5ff0=function(_0x1a1831,_0x131e07){_0x1a1831=_0x1a1831-0x0;var _0x391337=_0xff05[_0x1a1831];return _0x391337;};'use strict';var BPromise=require('bluebird');var _=require(_0x5ff0('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x5ff0('0x1'));var crypto=require('crypto');var logger=require(_0x5ff0('0x2'))(_0x5ff0('0x3'));module[_0x5ff0('0x4')]=function(_0x4d315d,_0x533c91,_0x17714b,_0x26bfc2){return new BPromise(function(_0x165f74,_0x48c6cb){logger['info'](_0x5ff0('0x5'),_0x26bfc2||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x1ea776=new WebSocket(_0x26bfc2||_0x5ff0('0x6'),{'perMessageDeflate':![]});var _0x12b056='';var _0x4e4a38='0';var _0x2c0d4c='1';var _0x36c987='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x4b0bf6(_0x5b7520){var _0x4aabc8=crypto[_0x5ff0('0x7')](_0x5ff0('0x8'));_0x4aabc8[_0x5ff0('0x9')](_0x5b7520);return _0x4aabc8['digest'](_0x5ff0('0xa'));}function _0x2748a8(){try{logger[_0x5ff0('0xb')](_0x5ff0('0xc'));var _0x59acb8=moment()[_0x5ff0('0xd')]();var _0x4c3b00=_0x4b0bf6(_0x59acb8+_0x533c91+_0x17714b);_0x1ea776[_0x5ff0('0xe')](JSON[_0x5ff0('0xf')]({'appID':_0x533c91,'timestamp':_0x59acb8,'appKey':_0x4c3b00}));var _0x29e4ba=fs[_0x5ff0('0x10')](_0x4d315d);_0x29e4ba['on'](_0x5ff0('0x11'),function(_0x4eb3a2){_0x1ea776[_0x5ff0('0xe')](_0x4eb3a2);});_0x29e4ba['on'](_0x5ff0('0x12'),function(){_0x1ea776[_0x5ff0('0xe')](_0x5ff0('0x13'));});}catch(_0x133743){logger[_0x5ff0('0x14')](_0x5ff0('0x15'),JSON[_0x5ff0('0xf')](_0x133743));_0x1ea776[_0x5ff0('0x16')]();}}function _0x4719e5(_0x3a4842){try{if(_0x3a4842){var _0x194253=JSON[_0x5ff0('0x17')](_0x3a4842);switch(_0x194253['status']){case 0x0:if(_0x194253['result']){if(_0x194253[_0x5ff0('0x18')][_0x5ff0('0x19')]){logger[_0x5ff0('0xb')]('Tilde\x20ASR\x20hypoteses',JSON[_0x5ff0('0xf')](_0x194253[_0x5ff0('0x18')]['hypotheses']));_0x12b056=_0x194253[_0x5ff0('0x18')]['hypotheses'][0x0][_0x5ff0('0x1a')];_0x4e4a38=_0x194253[_0x5ff0('0x18')]['hypotheses'][0x0][_0x5ff0('0x1b')];_0x2c0d4c='0';_0x36c987=_0x5ff0('0x1c');_0x1ea776[_0x5ff0('0x16')]();}}break;case 0x1:logger[_0x5ff0('0xb')](_0x5ff0('0x1d'));_0x2c0d4c='1';_0x36c987=_0x5ff0('0x1d');break;case 0x2:logger[_0x5ff0('0xb')](_0x5ff0('0x1e'));_0x2c0d4c='2';_0x36c987=_0x5ff0('0x1e');break;case 0x9:logger[_0x5ff0('0xb')](_0x5ff0('0x1f'));_0x2c0d4c='9';_0x36c987=_0x5ff0('0x1f');break;case 0xa:logger['info']('Authentication\x20failed.');_0x2c0d4c='10';_0x36c987=_0x5ff0('0x20');break;case 0xb:logger['info'](_0x5ff0('0x21'));_0x2c0d4c='11';_0x36c987=_0x5ff0('0x21');}}}catch(_0xe44673){logger['error'](_0x5ff0('0x22'),JSON[_0x5ff0('0xf')](_0xe44673));_0x1ea776[_0x5ff0('0x16')]();}}function _0x37b2dd(){logger[_0x5ff0('0xb')](_0x5ff0('0x23'));_0x165f74({'transcript':_0x12b056,'confidence':_0x4e4a38,'status':_0x2c0d4c,'status_message':_0x36c987});}function _0x555eb2(_0x545b13){logger[_0x5ff0('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x5ff0('0x24')](_0x545b13)){logger[_0x5ff0('0x14')](_[_0x5ff0('0x25')](_0x545b13)?JSON['stringify'](_0x545b13):_0x545b13);}}_0x1ea776['on']('open',_0x2748a8);_0x1ea776['on']('message',_0x4719e5);_0x1ea776['on']('close',_0x37b2dd);_0x1ea776['on'](_0x5ff0('0x14'),_0x555eb2);});}; \ 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 54da42d..a149692 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 _0xb352=['./asr','exports'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0xb352,0x8e));var _0x2b35=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xb352[_0x4f9b18];return _0x29f20c;};var asr=require(_0x2b35('0x0'));module[_0x2b35('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7d1a=['./asr','exports'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x7d1a,0xd2));var _0xa7d1=function(_0x4ca9d1,_0x3f699d){_0x4ca9d1=_0x4ca9d1-0x0;var _0xa08ac1=_0x7d1a[_0x4ca9d1];return _0xa08ac1;};var asr=require(_0xa7d1('0x0'));module[_0xa7d1('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index ecce257..0aa7aa8 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 _0xca58=['createServer','listen','listening','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net','events','./error','./channel','127.0.0.1','call','emit','error'];(function(_0xe1f011,_0x4030b3){var _0xfa9442=function(_0x175b64){while(--_0x175b64){_0xe1f011['push'](_0xe1f011['shift']());}};_0xfa9442(++_0x4030b3);}(_0xca58,0x17f));var _0x8ca5=function(_0x49db06,_0x2ed893){_0x49db06=_0x49db06-0x0;var _0x22244c=_0xca58[_0x49db06];return _0x22244c;};'use strict';var util=require('util');var net=require(_0x8ca5('0x0'));var EventEmitter=require(_0x8ca5('0x1'))['EventEmitter'];var AGIError=require(_0x8ca5('0x2'));var AGIChannel=require(_0x8ca5('0x3'));var AGIServer=function(_0x5b2b4d,_0x474ffb,_0x51c455){var _0x53f06c=this,_0x5b2b4d=_0x5b2b4d||0x11dd,_0x474ffb=_0x474ffb||_0x8ca5('0x4'),_0x1e2b3a=null,_0x516eac=0x0;EventEmitter[_0x8ca5('0x5')](_0x53f06c);function _0x55f628(){if(!_0x5b2b4d){_0x53f06c[_0x8ca5('0x6')](_0x8ca5('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x1e2b3a=net[_0x8ca5('0x8')]();_0x1e2b3a[_0x8ca5('0x9')](_0x5b2b4d,_0x474ffb);_0x1e2b3a['on'](_0x8ca5('0xa'),function(){_0x53f06c[_0x8ca5('0x6')](_0x8ca5('0xa'));});_0x1e2b3a['on'](_0x8ca5('0xb'),function(_0x7de11){_0x1e2b3a['getConnections'](function(_0x3ed7aa,_0x4b5827){if(_0x3ed7aa){_0x53f06c[_0x8ca5('0x6')](_0x8ca5('0x7'),new AGIError(_0x8ca5('0xc'),_0x3ed7aa));}else if(_0x51c455&&_0x51c455<0x0){_0x53f06c[_0x8ca5('0x6')]('error',new AGIError(_0x8ca5('0xd')));_0x7de11['destroy']();}else if(_0x51c455&&_0x51c455>0x0&&_0x51c455<_0x4b5827){_0x516eac+=0x1;_0x53f06c['emit']('error',new AGIError(_0x8ca5('0xe'),_0x516eac));_0x7de11[_0x8ca5('0xf')]();}else{var _0xde3cee=new AGIChannel(_0x7de11);_0xde3cee['on'](_0x8ca5('0x10'),function(){_0x53f06c[_0x8ca5('0x6')]('connection',_0xde3cee);});}});});_0x1e2b3a['on'](_0x8ca5('0x7'),function(_0x33811a){_0x53f06c[_0x8ca5('0x6')](_0x8ca5('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x33811a[_0x8ca5('0x11')]));});_0x1e2b3a['on'](_0x8ca5('0x12'),function(){_0x53f06c[_0x8ca5('0x6')](_0x8ca5('0x12'),new AGIError(_0x8ca5('0x13')));});}process[_0x8ca5('0x14')](function(){_0x55f628();});};util[_0x8ca5('0x15')](AGIServer,EventEmitter);module[_0x8ca5('0x16')]=function(_0x3cd058,_0x107846,_0x59147d){return new AGIServer(_0x3cd058,_0x107846,_0x59147d);}; \ No newline at end of file +var _0x702e=['emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','code','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','EventEmitter','./channel','127.0.0.1'];(function(_0x13327b,_0x47093a){var _0x26e5a1=function(_0x316132){while(--_0x316132){_0x13327b['push'](_0x13327b['shift']());}};_0x26e5a1(++_0x47093a);}(_0x702e,0xd2));var _0xe702=function(_0x258d8f,_0xa0d9fa){_0x258d8f=_0x258d8f-0x0;var _0x2dbc80=_0x702e[_0x258d8f];return _0x2dbc80;};'use strict';var util=require(_0xe702('0x0'));var net=require(_0xe702('0x1'));var EventEmitter=require(_0xe702('0x2'))[_0xe702('0x3')];var AGIError=require('./error');var AGIChannel=require(_0xe702('0x4'));var AGIServer=function(_0x254645,_0x47273f,_0x2076b5){var _0x518279=this,_0x254645=_0x254645||0x11dd,_0x47273f=_0x47273f||_0xe702('0x5'),_0x457257=null,_0x2c6c72=0x0;EventEmitter['call'](_0x518279);function _0x3df6bc(){if(!_0x254645){_0x518279[_0xe702('0x6')](_0xe702('0x7'),new AGIError(_0xe702('0x8')));return![];}_0x457257=net[_0xe702('0x9')]();_0x457257[_0xe702('0xa')](_0x254645,_0x47273f);_0x457257['on'](_0xe702('0xb'),function(){_0x518279[_0xe702('0x6')](_0xe702('0xb'));});_0x457257['on'](_0xe702('0xc'),function(_0x182977){_0x457257[_0xe702('0xd')](function(_0x286ff7,_0x4528e5){if(_0x286ff7){_0x518279['emit'](_0xe702('0x7'),new AGIError(_0xe702('0xe'),_0x286ff7));}else if(_0x2076b5&&_0x2076b5<0x0){_0x518279[_0xe702('0x6')](_0xe702('0x7'),new AGIError(_0xe702('0xf')));_0x182977['destroy']();}else if(_0x2076b5&&_0x2076b5>0x0&&_0x2076b5<_0x4528e5){_0x2c6c72+=0x1;_0x518279[_0xe702('0x6')](_0xe702('0x7'),new AGIError(_0xe702('0x10'),_0x2c6c72));_0x182977[_0xe702('0x11')]();}else{var _0x37b285=new AGIChannel(_0x182977);_0x37b285['on'](_0xe702('0x12'),function(){_0x518279[_0xe702('0x6')](_0xe702('0xc'),_0x37b285);});}});});_0x457257['on'](_0xe702('0x7'),function(_0x78522f){_0x518279[_0xe702('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x78522f[_0xe702('0x13')]));});_0x457257['on'](_0xe702('0x14'),function(){_0x518279['emit'](_0xe702('0x14'),new AGIError(_0xe702('0x15')));});}process['nextTick'](function(){_0x3df6bc();});};util[_0xe702('0x16')](AGIServer,EventEmitter);module[_0xe702('0x17')]=function(_0x19ebf7,_0x127121,_0x458720){return new AGIServer(_0x19ebf7,_0x127121,_0x458720);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 5b63651..5a68225 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 _0x253d=['getsecretdigits','channel','prototype','rpc','getVariableById','then','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','catch','getSquareOdbc','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agentUnpause','agentLogout','agent','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','number','timeout','includes','POST','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','url','parse','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','options','googleDialogflow','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','ispeechTTS','key','ispeech_tts_language','en-US','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','getAndSetVariable','extra','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','MRCPRecog','result','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','RECOG_CONFIDENCE()','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','getUser','no\x20user\x20found','SIP/%s','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20private_key\x20configured','bot','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','opts','DIAL','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws_bot_name','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','continueAt','context','extension','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','toLowerCase','QUEUE','macro','gosub','record','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','statusMessage','saydigits','sayDigits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','no\x20mail\x20account\x20found','email','Smtp','user','bcc','subject','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','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','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','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','no\x20variable\x20selected','join','util','moment','mustache','request-promise','../../config/logger','agi','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits'];(function(_0x36b96a,_0x41f4f1){var _0x36cf7d=function(_0x1a0004){while(--_0x1a0004){_0x36b96a['push'](_0x36b96a['shift']());}};_0x36cf7d(++_0x41f4f1);}(_0x253d,0x1b3));var _0xd253=function(_0x5b770a,_0x3176cb){_0x5b770a=_0x5b770a-0x0;var _0x1aad80=_0x253d[_0x5b770a];return _0x1aad80;};'use strict';var fs=require('fs');var util=require(_0xd253('0x0'));var _=require('lodash');var sh=require('shelljs');var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0xd253('0x1'));var Mustache=require(_0xd253('0x2'));var rp=require(_0xd253('0x3'));var logger=require(_0xd253('0x4'))(_0xd253('0x5'));var config=require('../../config/environment');var shared=require(_0xd253('0x6'));var scripts=require(_0xd253('0x7'));var FILES_PATH=_0xd253('0x8');var recursiveMapAttributes=[_0xd253('0x9'),_0xd253('0xa')];var verticesWithRetry=['menu',_0xd253('0xb'),_0xd253('0xc')];var AGIVertices=function(_0x3e7a77,_0x453396,_0x351047){this[_0xd253('0xd')]=_0x3e7a77;this['rpc']=_0x453396;this['mailRpc']=_0x351047;};AGIVertices[_0xd253('0xe')]['getVariable']=function(_0xb22c83,_0x10c39d){this[_0xd253('0xf')][_0xd253('0x10')](_0xb22c83)[_0xd253('0x11')](function(_0x18cf67){_0x10c39d(null,_0x18cf67?_0x18cf67['name']:![]);})['catch'](function(_0x195cdd){_0x10c39d(_0x195cdd);});};AGIVertices[_0xd253('0xe')][_0xd253('0x12')]=function(_0x59c367,_0x4ce442){this[_0xd253('0xf')][_0xd253('0x13')](_0x59c367)[_0xd253('0x11')](function(_0x4a2ba8){_0x4ce442(null,_0x4a2ba8?_0x4a2ba8[_0xd253('0x14')]:![]);})['catch'](function(_0x8b15a6){_0x4ce442(_0x8b15a6);});};AGIVertices[_0xd253('0xe')][_0xd253('0x15')]=function(_0x5196a3,_0x1b7ed1){this['rpc'][_0xd253('0x16')](_0x5196a3)[_0xd253('0x11')](function(_0x5e4051){_0x1b7ed1(null,_0x5e4051?_0x5e4051[_0xd253('0x14')]:![]);})[_0xd253('0x17')](function(_0x5b24ff){_0x1b7ed1(_0x5b24ff);});};AGIVertices['prototype'][_0xd253('0x18')]=function(_0x548e04,_0x5cc55f){this[_0xd253('0xf')]['getSquareOdbcById'](_0x548e04)[_0xd253('0x11')](function(_0x1e48c3){_0x5cc55f(null,_0x1e48c3?_0x1e48c3[_0xd253('0x19')]:![]);})[_0xd253('0x17')](function(_0x524487){_0x5cc55f(_0x524487);});};AGIVertices[_0xd253('0xe')]['getUser']=function(_0x2166fa,_0x50f8b5){this[_0xd253('0xf')][_0xd253('0x1a')](_0x2166fa)[_0xd253('0x11')](function(_0x471f14){_0x50f8b5(null,_0x471f14?_0x471f14['name']:![]);})[_0xd253('0x17')](function(_0x34d98d){_0x50f8b5(_0x34d98d);});};AGIVertices['prototype'][_0xd253('0x1b')]=function(_0x434be5,_0x136c52){this[_0xd253('0xf')][_0xd253('0x1c')](_0x434be5)[_0xd253('0x11')](function(_0xb9a661){_0x136c52(null,_0xb9a661?_0xb9a661['name']:![]);})[_0xd253('0x17')](function(_0x4e89ed){_0x136c52(_0x4e89ed);});};AGIVertices['prototype'][_0xd253('0x1d')]=function(_0x3e36cc,_0x4a4ba1){var _0x542494=this;this[_0xd253('0xf')][_0xd253('0x1e')](_0x3e36cc)['then'](function(_0x3955a0){_0x4a4ba1(null,_0x3955a0?_0x542494[_0xd253('0x1f')](_0x3955a0[_0xd253('0x20')]):![]);})[_0xd253('0x17')](function(_0x534949){_0x4a4ba1(_0x534949);});};AGIVertices['prototype'][_0xd253('0x21')]=function(_0x31a217,_0x3d0e0b){this['rpc'][_0xd253('0x22')](_0x31a217)['then'](function(_0x204a78){_0x3d0e0b(null,_0x204a78?_0x204a78:![]);})[_0xd253('0x17')](function(_0x2b36a6){_0x3d0e0b(_0x2b36a6);});};AGIVertices[_0xd253('0xe')][_0xd253('0x23')]=function(_0x16d6d2,_0xeb767c,_0x3e4fda){this[_0xd253('0x24')][_0xd253('0x23')](_0x16d6d2,_0xeb767c)['then'](function(){_0x3e4fda(null);})[_0xd253('0x17')](function(_0x423bc4){_0x3e4fda(_0x423bc4);});};AGIVertices['prototype']['getIntervals']=function(_0x15f42b,_0x4f48f7){this[_0xd253('0xf')][_0xd253('0x25')](_0x15f42b)[_0xd253('0x11')](function(_0x13880e){if(_0x13880e){if(_0x13880e['IntervalId']){_0x4f48f7(null,[_0x13880e[_0xd253('0x26')]]);}else{_0x4f48f7(null,_[_0xd253('0x27')](_0x13880e[_0xd253('0x28')],_0xd253('0x26')));}}else{_0x4f48f7(null,![]);}})[_0xd253('0x17')](function(_0x3142b5){_0x4f48f7(_0x3142b5);});};AGIVertices[_0xd253('0xe')]['getSoundPath']=function(_0x191e20){return util[_0xd253('0x29')](_0xd253('0x2a'),FILES_PATH,_0x191e20);};AGIVertices[_0xd253('0xe')][_0xd253('0x2b')]=function(_0x5bed92,_0x104853,_0x5b01e3){odbc[_0xd253('0x2c')](_0x5bed92,function(_0xe857de){if(_0xe857de){logger[_0xd253('0x2d')](_0xd253('0x2e'),_0xe857de);_0x5b01e3(_0xe857de);}else{logger['info'](_0xd253('0x2f'));odbc[_0xd253('0x30')](_0x104853,function(_0x1425fd,_0x380bd2){if(_0x1425fd){logger[_0xd253('0x31')](_0xd253('0x32'),_0x104853);_0x5b01e3(_0x1425fd);}else{logger[_0xd253('0x31')](_0xd253('0x33'),_0x104853);odbc[_0xd253('0x34')](function(_0x1653a8){if(_0x1653a8){logger[_0xd253('0x2d')](_0xd253('0x35'),_0x1653a8);}_0x5b01e3(null,_0x380bd2);});}});}});};AGIVertices[_0xd253('0xe')][_0xd253('0x36')]=function(_0x4b58f0,_0x262031){this[_0xd253('0xf')][_0xd253('0x37')](_0x4b58f0)['then'](function(_0x3ee06c){_0x262031(null,_0x3ee06c?_0x3ee06c:![]);})[_0xd253('0x17')](function(_0x435094){_0x262031(_0x435094);});};AGIVertices[_0xd253('0xe')]['createSmsMessage']=function(_0x40536b,_0x374fc7){this['rpc'][_0xd253('0x38')](_0x40536b)[_0xd253('0x11')](function(_0x3423b9){_0x374fc7(null,_0x3423b9);})[_0xd253('0x17')](function(_0x28d029){_0x374fc7(_0x28d029);});};AGIVertices[_0xd253('0xe')][_0xd253('0x39')]=function(_0x27ba21,_0x1403ca,_0x43e69b){this['rpc'][_0xd253('0x39')]({'uniqueid':this[_0xd253('0xd')][_0xd253('0x3a')],'node':_0x27ba21[_0xd253('0x3b')],'application':_0x27ba21['agicommand'],'data':_0x1403ca||null,'project_name':this['channel'][_0xd253('0x3c')],'callerid':this[_0xd253('0xd')][_0xd253('0x3d')]})[_0xd253('0x11')](function(_0x2e5f29){if(_0x43e69b){_0x43e69b(null,_0x2e5f29);}})[_0xd253('0x17')](function(_0x38118c){if(_0x43e69b){_0x43e69b(_0x38118c);}});};AGIVertices['prototype'][_0xd253('0x3e')]=function(_0x440e8f,_0x57ea14,_0x1f791d,_0xfd4161){this[_0xd253('0xf')][_0xd253('0x3e')]({'uniqueid':this['channel'][_0xd253('0x3a')],'callerid':this['channel'][_0xd253('0x3d')],'calleridname':this['channel'][_0xd253('0x3f')],'context':this[_0xd253('0xd')]['context'],'extension':this['channel']['extension'],'priority':this[_0xd253('0xd')]['priority'],'accountcode':this['channel'][_0xd253('0x40')],'dnid':this[_0xd253('0xd')][_0xd253('0x41')],'projectName':this[_0xd253('0xd')]['arg_1'],'saveName':_0x57ea14,'filename':_0x440e8f[_0xd253('0x42')]||_0x57ea14,'savePath':_0x1f791d})['then'](function(_0x5d6795){_0xfd4161(null,_0x5d6795);})[_0xd253('0x17')](function(_0x282dc7){_0xfd4161(_0x282dc7);});};AGIVertices[_0xd253('0xe')][_0xd253('0x43')]=function(_0x8d7f15,_0x33479c,_0x16ab6b,_0x2fb051,_0x2c6af6){this[_0xd253('0xf')][_0xd253('0x43')]({'uniqueid':this[_0xd253('0xd')][_0xd253('0x3a')],'body':_0x8d7f15,'direction':_0x33479c,'providerName':_0x16ab6b,'providerResponse':_0x2fb051})[_0xd253('0x11')](function(_0x1f2653){if(_0x2c6af6){_0x2c6af6(null,_0x1f2653);}})[_0xd253('0x17')](function(_0x19ed63){if(_0x2c6af6){_0x2c6af6(_0x19ed63);}});};AGIVertices[_0xd253('0xe')][_0xd253('0x44')]=function(_0x3de79a,_0x2c33ea){this[_0xd253('0xf')][_0xd253('0x44')]({'firstName':_[_0xd253('0x45')](_0x3de79a[_0xd253('0x14')])||_[_0xd253('0x46')](_0x3de79a['name'])?_0xd253('0x47')+Math[_0xd253('0x48')]():_0x3de79a[_0xd253('0x14')],'lastName':_['isEmpty'](_0x3de79a[_0xd253('0x49')])||_['isNil'](_0x3de79a[_0xd253('0x49')])?null:_0x3de79a[_0xd253('0x49')],'phone':_0x3de79a[_0xd253('0x4a')],'ListId':_0x3de79a[_0xd253('0x4b')],'scheduledat':_0x3de79a[_0xd253('0x4c')],'callbackUniqueid':this[_0xd253('0xd')][_0xd253('0x3a')],'tags':_0xd253('0x4d'),'description':_0xd253('0x4e')+_0x3de79a[_0xd253('0x4c')][_0xd253('0x4f')](),'priority':_0x3de79a[_0xd253('0x50')]})[_0xd253('0x11')](function(_0x410d4f){_0x2c33ea(null,_0x410d4f);})[_0xd253('0x17')](function(_0x2179f5){_0x2c33ea(_0x2179f5);});};AGIVertices['prototype'][_0xd253('0x51')]=function(_0x2ac8e2,_0x5505bc){this[_0xd253('0xf')]['getPauseById'](_0x2ac8e2)[_0xd253('0x11')](function(_0x4cec88){_0x5505bc(null,_0x4cec88?_0x4cec88[_0xd253('0x14')]:![]);})[_0xd253('0x17')](function(_0x2cfb7f){_0x5505bc(_0x2cfb7f);});};AGIVertices[_0xd253('0xe')][_0xd253('0x52')]=function(_0x2e1548,_0xc5353a,_0x29b06a){var _0xbdbc65={'role':'agent'};_0xbdbc65[_0x2e1548]=this[_0xd253('0xd')]['callerid'];this['rpc'][_0xd253('0x52')](_0xbdbc65,_0xc5353a,this[_0xd253('0xd')][_0xd253('0x3a')])[_0xd253('0x11')](function(_0x15d966){_0x29b06a(null,_[_0xd253('0x46')](_0x15d966)?![]:!![]);})[_0xd253('0x17')](function(_0x4ae153){logger['error'](_0x4ae153);_0x29b06a(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x320e27,_0x264438){var _0xf7cadc={'role':'agent'};_0xf7cadc[_0x320e27]=this[_0xd253('0xd')][_0xd253('0x3d')];this[_0xd253('0xf')][_0xd253('0x53')](_0xf7cadc)[_0xd253('0x11')](function(_0x30320b){_0x264438(null,_['isNil'](_0x30320b)?![]:!![]);})[_0xd253('0x17')](function(_0x109888){logger[_0xd253('0x2d')](_0x109888);_0x264438(null,![]);});};AGIVertices[_0xd253('0xe')][_0xd253('0x54')]=function(_0x5c7001,_0x2c5d04){var _0x23cd8f={'role':_0xd253('0x55')};_0x23cd8f[_0x5c7001]=this[_0xd253('0xd')][_0xd253('0x3d')];this[_0xd253('0xf')][_0xd253('0x54')](_0x23cd8f)['then'](function(_0x3657a3){_0x2c5d04(null,_[_0xd253('0x46')](_0x3657a3)?![]:!![]);})[_0xd253('0x17')](function(_0x36d49f){logger[_0xd253('0x2d')](_0x36d49f);_0x2c5d04(null,![]);});};AGIVertices[_0xd253('0xe')]['agentLogin']=function(_0x3d62fd,_0x2aac7e){var _0x599497={'role':_0xd253('0x55')};_0x599497[_0x3d62fd]=this[_0xd253('0xd')][_0xd253('0x3d')];var _0x20aa11=_0x3d62fd!=_0xd253('0x56')?util['format'](_0xd253('0x57'),_0xd253('0x58'),this['channel'][_0xd253('0x3d')]):undefined;this['rpc'][_0xd253('0x59')](_0x599497,_0x20aa11)[_0xd253('0x11')](function(_0x43e78c){_0x2aac7e(null,_[_0xd253('0x46')](_0x43e78c)?![]:!![]);})['catch'](function(_0x276c61){logger[_0xd253('0x2d')](_0x276c61);_0x2aac7e(null,![]);});};AGIVertices[_0xd253('0xe')][_0xd253('0x5a')]=function(_0x224ce4,_0xa5f613){sh[_0xd253('0x5b')](_[_0xd253('0x5c')](_0x224ce4),function(_0x529232,_0x2339cf){var _0x8edff=_0x2339cf[_0xd253('0x5d')](/(\r\n|\n|\r)/gm,'');_0xa5f613(null,_0x8edff);});};AGIVertices[_0xd253('0xe')][_0xd253('0x5e')]=function(_0x5dc0ee,_0x1af33f){scripts[_0xd253('0x5e')](_0x5dc0ee[_0xd253('0x5f')],_0x5dc0ee[_0xd253('0x60')]||_0xd253('0x61'),_0x5dc0ee['text'],_0x5dc0ee[_0xd253('0x62')]||'en-US',_0x5dc0ee[_0xd253('0x63')]||_0xd253('0x64'),_0x5dc0ee[_0xd253('0x65')]||_0xd253('0x66'))[_0xd253('0x11')](function(_0x48b5e0){_0x1af33f(null,_0x48b5e0);})[_0xd253('0x17')](function(_0xf23a4d){_0x1af33f(_0xf23a4d);});};AGIVertices[_0xd253('0xe')][_0xd253('0x67')]=function(_0x72118,_0x1a5899){scripts[_0xd253('0x67')](_0x72118[_0xd253('0x61')],_0x72118[_0xd253('0x68')]||'en',0x1)[_0xd253('0x11')](function(_0x4ed33c){_0x1a5899(null,_0x4ed33c);})[_0xd253('0x17')](function(_0x39f4ab){_0x1a5899(_0x39f4ab);});};AGIVertices['prototype'][_0xd253('0x69')]=function(_0x73590c,_0x428618){var _0x25869d={'uri':_0x73590c['url'],'method':_0x73590c[_0xd253('0x6a')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x73590c['timeout'])===_0xd253('0x6b')&&parseInt(_0x73590c[_0xd253('0x6c')])>=0x1?parseInt(_0x73590c[_0xd253('0x6c')])*0x3e8:0x5*0x3e8};if(_[_0xd253('0x6d')]([_0xd253('0x6e'),'PUT'],_0x25869d[_0xd253('0x6a')][_0xd253('0x6f')]())){try{_0x25869d[_0xd253('0x70')]=_0x73590c['rawBody']?JSON['parse'](_0x73590c['rawBody']):{};}catch(_0x50a322){logger[_0xd253('0x2d')](_0xd253('0x71'),_0x50a322);}}try{_0x25869d[_0xd253('0x72')]=_0x73590c[_0xd253('0x9')]?JSON['parse'](_0x73590c[_0xd253('0x9')]):{};}catch(_0x81022e){logger[_0xd253('0x2d')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x81022e);}if(_0x73590c[_0xd253('0x73')]){try{var _0x5ae835=require(_0x73590c[_0xd253('0x73')])[_0xd253('0x74')](this,_0x25869d);_0x25869d[_0xd253('0x75')]=Mustache[_0xd253('0x76')](_0x73590c[_0xd253('0x77')],_0x5ae835,{},['$$','$$']);if(_0x25869d['headers']){_0x25869d['headers']=JSON[_0xd253('0x78')](Mustache[_0xd253('0x76')](JSON[_0xd253('0x79')](_0x25869d['headers']),_0x5ae835,{},['$$','$$']));}if(_0x25869d[_0xd253('0x70')]){_0x25869d[_0xd253('0x70')]=JSON[_0xd253('0x78')](Mustache[_0xd253('0x76')](JSON[_0xd253('0x79')](_0x25869d[_0xd253('0x70')]),_0x5ae835,{},['$$','$$']));}}catch(_0x4adfac){logger[_0xd253('0x2d')](_0xd253('0x7a'),_0x4adfac);}}rp(_0x25869d)['then'](function(_0x3577c8){var _0x26266f={'statusCode':_0x3577c8[_0xd253('0x7b')]||0xc8,'statusMessage':_0x3577c8['statusMessage']||'OK','headers':_0x3577c8[_0xd253('0x72')]||{},'body':_0x3577c8[_0xd253('0x70')]||{}};_0x428618(null,_0x26266f);})[_0xd253('0x17')](function(_0x3754e7){var _0x19f4d0={'statusCode':_0x3754e7[_0xd253('0x7b')]||0x1f4,'statusMessage':_0x3754e7[_0xd253('0x7c')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x3754e7['options'][_0xd253('0x72')]||{},'body':_0x3754e7[_0xd253('0x7d')][_0xd253('0x70')]||{}};_0x428618(null,_0x19f4d0);});};AGIVertices['prototype'][_0xd253('0x7e')]=function(_0x49b50a,_0x2e23cb){scripts[_0xd253('0x7e')](this[_0xd253('0xd')][_0xd253('0x3a')],_0x49b50a['key'],_0x49b50a[_0xd253('0x61')],_0x49b50a['dialogflow_language']||'en')['then'](function(_0x2aa06b){_0x2e23cb(null,_0x2aa06b);})['catch'](function(_0x38a80c){_0x2e23cb(_0x38a80c);});};AGIVertices[_0xd253('0xe')][_0xd253('0x7f')]=function(_0x5b07a3,_0x3b6411){scripts['googleDialogflowV2'](this['channel'][_0xd253('0x3a')],_0x5b07a3[_0xd253('0x80')],_0x5b07a3['client_email'],_0x5b07a3[_0xd253('0x81')],_0x5b07a3[_0xd253('0x61')],_0x5b07a3[_0xd253('0x82')]||'en')[_0xd253('0x11')](function(_0x2e497e){_0x3b6411(null,_0x2e497e);})[_0xd253('0x17')](function(_0x41bf8d){_0x3b6411(_0x41bf8d);});};AGIVertices['prototype']['sestekNDA']=function(_0x20ee38,_0x138074){scripts['sestekNDA'](this[_0xd253('0xd')],_0x20ee38)[_0xd253('0x11')](function(_0x3bb0cc){_0x138074(null,_0x3bb0cc);})[_0xd253('0x17')](function(_0x2ecada){_0x138074(_0x2ecada);});};AGIVertices[_0xd253('0xe')][_0xd253('0x83')]=function(_0x1a49c0,_0x239dbc){scripts[_0xd253('0x83')](_0x1a49c0[_0xd253('0x84')],_0x1a49c0[_0xd253('0x61')],_0x1a49c0[_0xd253('0x85')]||_0xd253('0x86'),_0x1a49c0['speed'])[_0xd253('0x11')](function(_0x401420){_0x239dbc(null,_0x401420);})[_0xd253('0x17')](function(_0x5a40ed){_0x239dbc(_0x5a40ed);});};AGIVertices['prototype']['ispeechASR']=function(_0x1bfb37,_0x355200,_0x7dbe69){scripts[_0xd253('0x87')](_0x355200,_0x1bfb37['key'],_0x1bfb37[_0xd253('0x88')]||'en-US',this[_0xd253('0x89')](_0x1bfb37[_0xd253('0x8a')])?_0x1bfb37[_0xd253('0x8a')]:undefined)[_0xd253('0x11')](function(_0x57d0de){_0x7dbe69(null,_0x57d0de);})[_0xd253('0x17')](function(_0x377ee6){_0x7dbe69(_0x377ee6);});};AGIVertices['prototype']['awsPolly']=function(_0x4076ae,_0x4ca77d){scripts[_0xd253('0x8b')](_0x4076ae[_0xd253('0x8c')],_0x4076ae[_0xd253('0x8d')],_0x4076ae[_0xd253('0x8e')],_0x4076ae['aws_polly_voice']||'Amy',_0x4076ae['text'],_0x4076ae[_0xd253('0x8f')]||_0xd253('0x61'))['then'](function(_0x3f9a05){_0x4ca77d(null,_0x3f9a05);})['catch'](function(_0x29f473){_0x4ca77d(_0x29f473);});};AGIVertices[_0xd253('0xe')][_0xd253('0x90')]=function(_0xb7a71c,_0x1465c8){scripts['awsLex'](this[_0xd253('0xd')][_0xd253('0x3a')],_0xb7a71c[_0xd253('0x8c')],_0xb7a71c[_0xd253('0x8d')],_0xb7a71c[_0xd253('0x91')],_0xb7a71c[_0xd253('0x61')],_0xb7a71c['aws_bot_name'])['then'](function(_0x1d0143){_0x1465c8(null,_0x1d0143);})[_0xd253('0x17')](function(_0x468ec9){_0x1465c8(_0x468ec9);});};AGIVertices[_0xd253('0xe')][_0xd253('0x92')]=function(_0x38f983,_0x264dbf,_0x46ed80){scripts[_0xd253('0x92')](_0x264dbf,_0x38f983[_0xd253('0x84')],_0x38f983[_0xd253('0x93')]||_0xd253('0x86'))[_0xd253('0x11')](function(_0x31661f){_0x46ed80(null,_0x31661f);})[_0xd253('0x17')](function(_0x4f24cf){_0x46ed80(_0x4f24cf);});};AGIVertices[_0xd253('0xe')][_0xd253('0x94')]=function(_0x206dbe,_0x197826,_0x511474){scripts[_0xd253('0x94')](_0x197826,_0x206dbe['appid'],_0x206dbe[_0xd253('0x95')],_0x206dbe[_0xd253('0x75')])[_0xd253('0x11')](function(_0x2f3b55){_0x511474(null,_0x2f3b55);})['catch'](function(_0x375798){_0x511474(_0x375798);});};AGIVertices['prototype']['clear']=function(_0x44d80d){var _0x548d16=_[_0xd253('0x6d')](verticesWithRetry,_0x44d80d['agicommand'])?_0x44d80d:_[_0xd253('0x96')](_0x44d80d);for(var _0x58c88b in _0x548d16){if(_0x548d16[_0xd253('0x97')](_0x58c88b)){if(_0x548d16[_0x58c88b]&&_[_0xd253('0x98')](_0x548d16[_0x58c88b])){if(_['includes'](recursiveMapAttributes,_0x58c88b)){_0x548d16[_0x58c88b]=this[_0xd253('0x99')](_0x548d16[_0x58c88b]);}else{_0x548d16[_0x58c88b]=this[_0xd253('0x9a')](_0x548d16[_0x58c88b]);}}}}return _0x548d16;};AGIVertices[_0xd253('0xe')]['recursiveNodeIndex']=function(_0x2c73df){for(var _0x566e2b in _0x2c73df){if(_0x2c73df['hasOwnProperty'](_0x566e2b)){if(_[_0xd253('0x9b')](_0x2c73df[_0x566e2b])){this[_0xd253('0x9c')](_0x2c73df[_0x566e2b]);}else if(_[_0xd253('0x9d')](_0x2c73df[_0x566e2b])){for(var _0x5cb968=0x0;_0x5cb968<_0x2c73df[_0x566e2b][_0xd253('0x9e')];_0x5cb968++){this[_0xd253('0x9c')](_0x2c73df[_0x566e2b][_0x5cb968]);}}else if(_['isString'](_0x2c73df[_0x566e2b])){_0x2c73df[_0x566e2b]=this[_0xd253('0x9a')](_0x2c73df[_0x566e2b]);}}}};AGIVertices[_0xd253('0xe')][_0xd253('0x9f')]=function(_0x445e51,_0x5842f2){for(var _0x4e1b61 in _0x445e51){if(_0x445e51[_0xd253('0x97')](_0x4e1b61)){if(_[_0xd253('0x9b')](_0x445e51[_0x4e1b61])){if(!_[_0xd253('0x45')](_0x445e51[_0x4e1b61])){this[_0xd253('0x9f')](_0x445e51[_0x4e1b61],util['format']('%s.%s',_0x5842f2,_0x4e1b61));}}else if(_[_0xd253('0x9d')](_0x445e51[_0x4e1b61])){for(var _0x22c8a=0x0;_0x22c8a<_0x445e51[_0x4e1b61]['length'];_0x22c8a++){this[_0xd253('0x9f')](_0x445e51[_0x4e1b61][_0x22c8a],util['format'](_0xd253('0xa0'),_0x5842f2,_0x4e1b61+'['+_0x22c8a+']'));}}else{if(!_[_0xd253('0x46')](_0x445e51[_0x4e1b61])){this[_0xd253('0xd')][_0xd253('0xa1')](util[_0xd253('0x29')](_0xd253('0xa0'),_0x5842f2,_0x4e1b61),_0x445e51[_0x4e1b61]);}}}}};AGIVertices[_0xd253('0xe')][_0xd253('0x99')]=function(_0x366f24){try{var _0x5aeca1=JSON[_0xd253('0x78')](_0x366f24);this[_0xd253('0x9c')](_0x5aeca1);return JSON[_0xd253('0x79')](_0x5aeca1);}catch(_0x127582){return this['replaceAllVariables'](_0x366f24);}};AGIVertices[_0xd253('0xe')][_0xd253('0x9a')]=function(_0x55f5e3){var _0x1332d9=_0x55f5e3['split']('{');for(var _0x24fddc=0x1;_0x24fddc<_0x1332d9['length'];_0x24fddc+=0x1){var _0x3b6d49=_0x1332d9[_0x24fddc][_0xd253('0xa2')]('}');if(_0x3b6d49['length']>0x1){_0x55f5e3=_0x55f5e3[_0xd253('0xa3')]('{'+_0x3b6d49[0x0]+'}',this['channel'][_0xd253('0xa4')](_0x3b6d49[0x0])['extra']||_0x3b6d49[0x0]);}}if(_0x1332d9['length']===0x1){return _0x55f5e3['toString']();}return this[_0xd253('0x9a')](_0x55f5e3);};AGIVertices[_0xd253('0xe')][_0xd253('0xa5')]=function(_0x2e460b,_0xd78726){var _0x3e414f=this[_0xd253('0xd')][_0xd253('0xa4')](_0x2e460b);if(_0x3e414f['result']===-0x1){return _0x3e414f;}logger['info'](util[_0xd253('0x29')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0xd78726,_0x3e414f['extra']));return this[_0xd253('0xd')][_0xd253('0xa1')](_0xd78726,_0x3e414f[_0xd253('0xa6')]);};AGIVertices[_0xd253('0xe')][_0xd253('0x89')]=function(_0x2a2dc9){return _0x2a2dc9&&_0x2a2dc9!=='0'&&_0x2a2dc9!=='-1'&&_0x2a2dc9!=='';};AGIVertices[_0xd253('0xe')][_0xd253('0xa7')]=function(_0x127de7){this[_0xd253('0x39')]['sync'](this,_0x127de7,'-');_0x127de7['retry']=_0x127de7[_0xd253('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd253('0xe')][_0xd253('0xa8')]=function(_0x41fa12){logger[_0xd253('0x31')](util['format'](_0xd253('0xa9'),_0x41fa12[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x41fa12['text'])){return this[_0xd253('0xd')][_0xd253('0xaa')]('no\x20text\x20configured');}var _0x5dbc61='\x22'+_0x41fa12[_0xd253('0x61')]+'\x22';if(this[_0xd253('0x89')](_0x41fa12[_0xd253('0x7d')])){_0x5dbc61+=','+_0x41fa12[_0xd253('0x7d')];}var _0x3c72ec=this['channel'][_0xd253('0x5b')](_0xd253('0xab'),_0x5dbc61);if(_0x3c72ec['result']===-0x1){return _0x3c72ec;}return this['channel'][_0xd253('0xaa')](util['format'](_0xd253('0xac'),_0x5dbc61));};AGIVertices[_0xd253('0xe')][_0xd253('0xad')]=function(_0x4c0147){logger['info'](util[_0xd253('0x29')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x4c0147['label']));if(!this['isConfigured'](_0x4c0147[_0xd253('0xae')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x48b06c=_0x4c0147['grammar'];if(this[_0xd253('0x89')](_0x4c0147['options'])){_0x48b06c+=','+_0x4c0147[_0xd253('0x7d')];}var _0x15e121=this['channel'][_0xd253('0x5b')](_0xd253('0xaf'),_0x48b06c);if(_0x15e121[_0xd253('0xb0')]===-0x1){return _0x15e121;}var _0x5a1995=this[_0xd253('0xa5')]('RECOG_CONFIDENCE()',_0xd253('0xb1'));if(_0x5a1995[_0xd253('0xb0')]===-0x1){return _0x5a1995;}var _0xc66cfe=this[_0xd253('0xa5')](_0xd253('0xb2'),_0xd253('0xb3'));if(_0xc66cfe['result']===-0x1){return _0xc66cfe;}var _0x59ada8=this[_0xd253('0xa5')](_0xd253('0xb4'),_0xd253('0xb5'));if(_0x59ada8[_0xd253('0xb0')]===-0x1){return _0x59ada8;}return this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0xb6'),_0x48b06c));};AGIVertices[_0xd253('0xe')][_0xd253('0x5')]=function(_0x964eae){logger['info'](util[_0xd253('0x29')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x964eae[_0xd253('0x3b')]));return this[_0xd253('0xd')]['agi']([_0x964eae[_0xd253('0xb7')],_0x964eae[_0xd253('0xb8')]]);};AGIVertices[_0xd253('0xe')]['answer']=function(_0x3cf027){logger['info'](util[_0xd253('0x29')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x3cf027[_0xd253('0x3b')]));if(this[_0xd253('0x89')](_0x3cf027['timeout'])){logger['info'](util[_0xd253('0x29')](_0xd253('0xb9'),_0x3cf027[_0xd253('0x6c')]));var _0x50ee7a=this[_0xd253('0xd')][_0xd253('0xba')](_0x3cf027[_0xd253('0x6c')]);if(_0x50ee7a[_0xd253('0xb0')]===-0x1){return _0x50ee7a;}}return this['channel'][_0xd253('0xbb')]();};AGIVertices[_0xd253('0xe')][_0xd253('0x4d')]=function(_0x73c32f){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0xbc'),_0x73c32f[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x73c32f[_0xd253('0x4b')])){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x73c32f,_0xd253('0xbd'));}_0x73c32f['scheduledAt']=moment();if(this[_0xd253('0x89')](_0x73c32f[_0xd253('0xbe')])){_0x73c32f[_0xd253('0x4c')]=moment()[_0xd253('0xbf')](_0x73c32f[_0xd253('0xbe')],_0xd253('0xc0'));}if(!this[_0xd253('0x89')](_0x73c32f[_0xd253('0x50')])){_0x73c32f[_0xd253('0x50')]=0x2;}this['createCmContact'][_0xd253('0x74')](this,_0x73c32f);return this[_0xd253('0xd')]['noop'](util[_0xd253('0x29')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x73c32f['phone'],_0x73c32f['list_id'],_0x73c32f[_0xd253('0x4c')]));};AGIVertices['prototype'][_0xd253('0xc1')]=function(_0x1122e1){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0xc2'),_0x1122e1['label']));var _0x4474da=this['channel']['exec'](_0x1122e1['application'],_0x1122e1['options']);if(_0x4474da[_0xd253('0xb0')]===-0x1){return _0x4474da;}return this[_0xd253('0xd')]['noop'](util[_0xd253('0x29')]('Executed\x20command\x20%s\x20%s',_0x1122e1[_0xd253('0xc3')],_0x1122e1[_0xd253('0x7d')]));};AGIVertices[_0xd253('0xe')]['lumenvoxtts']=function(_0x4f5430){logger[_0xd253('0x31')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x4f5430[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x4f5430[_0xd253('0x61')])){return this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0xc4'));}var _0xf6c47c='\x22'+_0x4f5430['text']+'\x22';if(this['isConfigured'](_0x4f5430['options'])){_0xf6c47c+=','+_0x4f5430['options'];}var _0x442905=this[_0xd253('0xd')][_0xd253('0x5b')](_0xd253('0xab'),_0xf6c47c);if(_0x442905[_0xd253('0xb0')]===-0x1){return _0x442905;}return this[_0xd253('0xd')]['noop'](util[_0xd253('0x29')](_0xd253('0xac'),_0xf6c47c));};AGIVertices[_0xd253('0xe')][_0xd253('0xc5')]=function(_0x3dd7a3){logger['info'](util['format'](_0xd253('0xc6'),_0x3dd7a3[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x3dd7a3[_0xd253('0x61')])){return this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0xc4'));}var _0x4b1695='\x22'+_0x3dd7a3[_0xd253('0x61')]+'\x22';if(this['isConfigured'](_0x3dd7a3[_0xd253('0x7d')])){_0x4b1695+=','+_0x3dd7a3['options'];}var _0x4da5c5=this[_0xd253('0xd')][_0xd253('0x5b')]('MRCPSynth',_0x4b1695);if(_0x4da5c5[_0xd253('0xb0')]===-0x1){return _0x4da5c5;}return this[_0xd253('0xd')]['noop'](util[_0xd253('0x29')](_0xd253('0xac'),_0x4b1695));};AGIVertices[_0xd253('0xe')]['lumenvoxasr']=function(_0x5de6cc){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0xc7'),_0x5de6cc[_0xd253('0x3b')]));if(!this['isConfigured'](_0x5de6cc[_0xd253('0xae')])){return this[_0xd253('0xd')][_0xd253('0xaa')]('no\x20grammar\x20configured');}var _0x2e986f=_0x5de6cc[_0xd253('0xae')];if(this['isConfigured'](_0x5de6cc['options'])){_0x2e986f+=','+_0x5de6cc[_0xd253('0x7d')];}var _0x44a9b1=this['channel'][_0xd253('0x5b')](_0xd253('0xaf'),_0x2e986f);if(_0x44a9b1[_0xd253('0xb0')]===-0x1){return _0x44a9b1;}var _0x56179b=this[_0xd253('0xa5')]('RECOG_CONFIDENCE()',_0xd253('0xc8'));if(_0x56179b[_0xd253('0xb0')]===-0x1){return _0x56179b;}var _0xe37625=this[_0xd253('0xa5')](_0xd253('0xb2'),_0xd253('0xc9'));if(_0xe37625[_0xd253('0xb0')]===-0x1){return _0xe37625;}var _0x112a1f=this[_0xd253('0xa5')](_0xd253('0xb4'),_0xd253('0xca'));if(_0x112a1f[_0xd253('0xb0')]===-0x1){return _0x112a1f;}return this[_0xd253('0xd')][_0xd253('0xaa')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x2e986f));};AGIVertices[_0xd253('0xe')]['sestekasr']=function(_0x268c65){logger[_0xd253('0x31')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x268c65[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x268c65['grammar'])){return this[_0xd253('0xd')][_0xd253('0xaa')]('no\x20grammar\x20configured');}var _0x5f1c66=_0x268c65['grammar'];if(this[_0xd253('0x89')](_0x268c65[_0xd253('0x7d')])){_0x5f1c66+=','+_0x268c65['options'];}var _0x418df6=this['channel'][_0xd253('0x5b')](_0xd253('0xaf'),_0x5f1c66);if(_0x418df6['result']===-0x1){return _0x418df6;}var _0x2e4d29=this[_0xd253('0xa5')](_0xd253('0xcb'),'SESTEK_ASR_CONFIDENCE');if(_0x2e4d29[_0xd253('0xb0')]===-0x1){return _0x2e4d29;}var _0xfc077d=this[_0xd253('0xa5')](_0xd253('0xb2'),_0xd253('0xcc'));if(_0xfc077d[_0xd253('0xb0')]===-0x1){return _0xfc077d;}var _0x62b4e2=this[_0xd253('0xa5')](_0xd253('0xb4'),_0xd253('0xcd'));if(_0x62b4e2[_0xd253('0xb0')]===-0x1){return _0x62b4e2;}return this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0xb6'),_0x5f1c66));};AGIVertices[_0xd253('0xe')][_0xd253('0xce')]=function(_0x4763e3){logger[_0xd253('0x31')](util[_0xd253('0x29')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x4763e3[_0xd253('0x3b')]));if(!this['isConfigured'](_0x4763e3[_0xd253('0xcf')])){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x4763e3,'no\x20database\x20selected');}var _0x595d70=this[_0xd253('0x18')][_0xd253('0x74')](this,_0x4763e3['odbc_id']);if(!_0x595d70){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x4763e3,_0xd253('0xd0'));}if(!this[_0xd253('0x89')](_0x4763e3[_0xd253('0x30')])){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x4763e3,_0xd253('0xd1'));}var _0x5e0586=_0x4763e3['query'][_0xd253('0x5d')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xd253('0xaa')](util['format'](_0xd253('0xd2'),_0x5e0586));var _0x374839=this[_0xd253('0x2b')][_0xd253('0x74')](this,_0x595d70,_0x5e0586);this[_0xd253('0x39')][_0xd253('0x74')](this,_0x4763e3,_0x5e0586);if(!this[_0xd253('0x89')](_0x4763e3['variable_id'])){return this[_0xd253('0xd')]['noop'](_0xd253('0xd3'));}var _0x589a56=this[_0xd253('0xa4')]['sync'](this,_0x4763e3[_0xd253('0xd4')]);if(!_0x589a56){return this['channel'][_0xd253('0x2d')](_0x4763e3,_0xd253('0xd5'));}var _0x56fa9f=this;_0x374839[_0xd253('0xd6')](function(_0x429976,_0x760a9){Object[_0xd253('0xd7')](_0x429976)[_0xd253('0xd6')](function(_0x4feb57){_0x56fa9f[_0xd253('0xd')][_0xd253('0xa1')](util[_0xd253('0x29')]('%s[%s][%s]',_0x589a56,_0x760a9,_0x4feb57),_0x429976[_0x4feb57]);});});this[_0xd253('0xd')][_0xd253('0xa1')](util[_0xd253('0x29')]('%s_ROWS_COUNT',_0x589a56),_0x374839[_0xd253('0x9e')]);return this['channel'][_0xd253('0xaa')](util[_0xd253('0x29')]('variable\x20%s\x20set',_0x589a56));};AGIVertices[_0xd253('0xe')][_0xd253('0xd8')]=function(_0x95c23f){logger[_0xd253('0xd9')](util[_0xd253('0x29')](_0xd253('0xda'),_0x95c23f[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x95c23f['sip_id'])){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x95c23f,_0xd253('0xdb'));}var _0x58c99f=this[_0xd253('0xdc')][_0xd253('0x74')](this,_0x95c23f['sip_id']);if(!_0x58c99f){return this['channel']['error'](_0x95c23f,_0xd253('0xdd'));}var _0x48a7ac=this[_0xd253('0xd')]['exec']('DIAL',[util[_0xd253('0x29')](_0xd253('0xde'),_0x58c99f),_0x95c23f[_0xd253('0x6c')],_0x95c23f['opts'],_0x95c23f[_0xd253('0x77')]]);if(_0x48a7ac[_0xd253('0xb0')]===-0x1){return _0x48a7ac;}return this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0xdf'),'DIAL'));};AGIVertices[_0xd253('0xe')][_0xd253('0xe0')]=function(_0x150bc2){logger[_0xd253('0x31')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x150bc2[_0xd253('0x3b')]));if(!this['isConfigured'](_0x150bc2[_0xd253('0x84')])){return this['channel']['noop'](_0xd253('0xe1'));}if(!this[_0xd253('0x89')](_0x150bc2[_0xd253('0x61')])){return this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0xc4'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x150bc2);this['createSquareMessage'](_0x150bc2[_0xd253('0x61')],'in','','');this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0xe2'),_0x150bc2[_0xd253('0x61')]));var _0x3dc1b8=this[_0xd253('0x7e')][_0xd253('0x74')](this,_0x150bc2);if(_0x3dc1b8){for(var _0x5ca488 in _0x3dc1b8){if(_0x3dc1b8['hasOwnProperty'](_0x5ca488)){this[_0xd253('0xd')][_0xd253('0xa1')](util[_0xd253('0x29')](_0xd253('0xe3'),_0x5ca488['toUpperCase']()),_0x3dc1b8[_0x5ca488]);}}this['createSquareMessage'](_0x3dc1b8[_0xd253('0xe4')],'out',_0xd253('0xe0'),'');return this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0xe5'),_0x3dc1b8['speech']));}return this[_0xd253('0xd')][_0xd253('0x2d')](_0x150bc2,_0xd253('0xe6'));};AGIVertices[_0xd253('0xe')][_0xd253('0xe7')]=function(_0x75900a){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0xe8'),_0x75900a[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x75900a['dialogflowV2_project_id'])){return this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0xe9'));}if(!this[_0xd253('0x89')](_0x75900a[_0xd253('0xea')])){return this[_0xd253('0xd')][_0xd253('0xaa')]('no\x20client_email\x20configured');}if(!this[_0xd253('0x89')](_0x75900a[_0xd253('0x81')])){return this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0xeb'));}if(!this[_0xd253('0x89')](_0x75900a[_0xd253('0x82')])){return this[_0xd253('0xd')][_0xd253('0xaa')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x75900a[_0xd253('0x61')])){return this['channel'][_0xd253('0xaa')](_0xd253('0xc4'));}this[_0xd253('0xd')][_0xd253('0xec')]=!![];this[_0xd253('0x39')](_0x75900a);this[_0xd253('0x43')](_0x75900a['text'],'in','','');this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')]('Trying\x20DialogflowV2:\x20%s',_0x75900a['text']));var _0x2facea=this[_0xd253('0x7f')]['sync'](this,_0x75900a);if(_0x2facea){for(var _0x30e9ba in _0x2facea){if(_0x2facea[_0xd253('0x97')](_0x30e9ba)){if(_0x30e9ba!==_0xd253('0xed')){this['channel'][_0xd253('0xa1')](util[_0xd253('0x29')](_0xd253('0xe3'),_0x30e9ba[_0xd253('0x6f')]()),_0x2facea[_0x30e9ba]);}}}this[_0xd253('0x43')](_0x2facea['speech'],'out',_0xd253('0xe7'),_0x2facea[_0xd253('0xed')]);return this['channel'][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0xee'),_0x2facea[_0xd253('0xe4')]));}return this[_0xd253('0xd')][_0xd253('0x2d')](_0x75900a,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype'][_0xd253('0xef')]=function(_0x460d31){logger['info'](util[_0xd253('0x29')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x460d31['label']));if(!this['isConfigured'](_0x460d31['ndauth_url'])){return this[_0xd253('0xd')]['noop'](_0xd253('0xf0'));}if(!this[_0xd253('0x89')](_0x460d31[_0xd253('0xf1')])){return this['channel'][_0xd253('0xaa')](_0xd253('0xf2'));}if(!this[_0xd253('0x89')](_0x460d31[_0xd253('0xf3')])){return this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0xf4'));}if(!this['isConfigured'](_0x460d31[_0xd253('0xf5')])){return this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0xc4'));}this[_0xd253('0xd')][_0xd253('0xec')]=!![];this[_0xd253('0x39')](_0x460d31);this[_0xd253('0x43')](_0x460d31[_0xd253('0x61')],'in','','');this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0xf6'),_0x460d31[_0xd253('0x61')]));var _0x27fec8=this[_0xd253('0xf7')]['sync'](this,_0x460d31);if(_0x27fec8){for(var _0x46ba46 in _0x27fec8){if(_0x27fec8[_0xd253('0x97')](_0x46ba46)){this['channel']['setVariable'](util['format'](_0xd253('0xf8'),_0x46ba46[_0xd253('0x6f')]()),_0x27fec8[_0x46ba46]);}}this[_0xd253('0x43')](_0x27fec8[_0xd253('0xe4')],'out',_0xd253('0xef'),'');if(_0x27fec8[_0xd253('0xf9')]){this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0xfa'),_0x27fec8['audiofile']));var _0x774ebb=this['channel'][_0xd253('0xfb')](_0x27fec8[_0xd253('0xf9')]);try{fs[_0xd253('0xfc')](_0x27fec8[_0xd253('0xf9')]+_0xd253('0xfd'));}catch(_0x72ec93){logger[_0xd253('0x2d')](_0x72ec93);}return _0x774ebb;}else{return this['channel'][_0xd253('0xaa')](util['format'](_0xd253('0xfe'),_0x27fec8[_0xd253('0xe4')]));}}return this[_0xd253('0xd')][_0xd253('0x2d')](_0x460d31,_0xd253('0xff'));};AGIVertices['prototype'][_0xd253('0x100')]=function(_0x5dd2c7){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x101'),_0x5dd2c7['label']));return this[_0xd253('0xd')][_0xd253('0xaa')]('end');};AGIVertices['prototype'][_0xd253('0x102')]=function(_0x255777){logger['info'](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x255777[_0xd253('0x3b')]));var _0x331cbb='';if(_0x255777[_0xd253('0x103')]){if(!this[_0xd253('0x89')](_0x255777[_0xd253('0x103')])){return this['channel'][_0xd253('0x2d')](_0x255777,'no\x20trunk\x20selected');}else{var _0x40a371=parseInt(_0x255777[_0xd253('0x103')],0xa);if(isNaN(_0x40a371)){_0x331cbb=_0x255777[_0xd253('0x103')];}else{_0x331cbb=this[_0xd253('0x1b')]['sync'](this,_0x255777[_0xd253('0x103')]);if(!_0x331cbb){return this['channel'][_0xd253('0x2d')](_0x255777,'no\x20trunk\x20found');}}}}else if(_0x255777['trunk_name']){_0x331cbb=_0x255777['trunk_name'];}else{return this['channel'][_0xd253('0x2d')](_0x255777,'no\x20trunk\x20selected');}var _0x4fdcd=this[_0xd253('0xd')][_0xd253('0x5b')]('DIAL',[util[_0xd253('0x29')]('SIP/%s/%s',_0x331cbb,_0x255777[_0xd253('0x4a')]),_0x255777['timeout'],_0x255777[_0xd253('0x104')],_0x255777['url']]);if(_0x4fdcd[_0xd253('0xb0')]===-0x1){return _0x4fdcd;}return this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0xdf'),_0xd253('0x105')));};AGIVertices[_0xd253('0xe')][_0xd253('0x106')]=function(_0x452c6f){logger[_0xd253('0x31')](util['format'](_0xd253('0x107'),_0x452c6f['label']));return this[_0xd253('0xd')][_0xd253('0xaa')]('finally');};AGIVertices[_0xd253('0xe')][_0xd253('0xb')]=function(_0x1ade1f){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x108'),_0x1ade1f[_0xd253('0x3b')]));if(_0x1ade1f[_0xd253('0x109')]===0x0){return this['maxRetry'](_0x1ade1f);}_0x1ade1f[_0xd253('0x109')]-=0x1;if(!this['isConfigured'](_0x1ade1f[_0xd253('0x10a')])){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x1ade1f,_0xd253('0x10b'));}var _0x3ab977=this[_0xd253('0x1d')][_0xd253('0x74')](this,_0x1ade1f[_0xd253('0x10a')]);if(!_0x3ab977){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x1ade1f,_0xd253('0x10c'));}if(!this[_0xd253('0x89')](_0x1ade1f[_0xd253('0xd4')])){return this[_0xd253('0xd')][_0xd253('0x2d')](_0xd253('0xd3'));}var _0x34ffb0=this[_0xd253('0xd')][_0xd253('0x10d')](_0x3ab977,_0x1ade1f['response'],_0x1ade1f['maxdigit']);var _0xa5e9bc=_0x34ffb0[_0xd253('0xb0')]?_0x34ffb0[_0xd253('0xb0')][_0xd253('0x4f')]():'';logger[_0xd253('0x31')](_0xd253('0x10e'),JSON[_0xd253('0x79')](_0x34ffb0));if(_0x34ffb0[_0xd253('0xb0')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x1ade1f,_0xa5e9bc);return _0x34ffb0;}else if(_0x34ffb0[_0xd253('0xa6')]===_0xd253('0x6c')){_0x34ffb0[_0xd253('0xb0')]=_0xa5e9bc[_0xd253('0x9e')]>=parseInt(_0x1ade1f[_0xd253('0x10f')])?'x':'i';}else{_0x34ffb0['result']=_0xa5e9bc[_0xd253('0x9e')]>=parseInt(_0x1ade1f[_0xd253('0x10f')])&&_0xa5e9bc['length']<=parseInt(_0x1ade1f[_0xd253('0x110')])?'x':'i';}var _0x170faf=this['getVariable'][_0xd253('0x74')](this,_0x1ade1f[_0xd253('0xd4')]);if(!_0x170faf){return this['channel']['error'](_0x1ade1f,_0xd253('0xd5'));}this[_0xd253('0xd')][_0xd253('0xa1')](_0x170faf,_0xa5e9bc);if(this[_0xd253('0x89')](_0x1ade1f['hiddendigitsnum'])){var _0x1024be=parseInt(_0x1ade1f[_0xd253('0x111')],0xa);var _0x48100e=rs[_0xd253('0x112')]({'charset':'*','length':_0x1024be});var _0x4f482f=_0xa5e9bc['length'];if(_0x4f482f>0x0){if(_0x4f482f>_0x1024be){this[_0xd253('0x39')][_0xd253('0x74')](this,_0x1ade1f,_0x1ade1f[_0xd253('0x113')]==='first'?_0x48100e+_0xa5e9bc[_0xd253('0x114')](_0x1024be):_0xa5e9bc[_0xd253('0x114')](0x0,_0x4f482f-_0x1024be)+_0x48100e);}else{this[_0xd253('0x39')][_0xd253('0x74')](this,_0x1ade1f,rs['generate']({'charset':'*','length':_0x4f482f}));}}else{this[_0xd253('0x39')][_0xd253('0x74')](this,_0x1ade1f,'');}}else{this[_0xd253('0x39')]['sync'](this,_0x1ade1f,_0xa5e9bc);}return _0x34ffb0;};AGIVertices[_0xd253('0xe')][_0xd253('0xc')]=function(_0x58a11b){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x115'),_0x58a11b[_0xd253('0x3b')]));return this[_0xd253('0xb')](_0x58a11b);};AGIVertices[_0xd253('0xe')][_0xd253('0x116')]=function(_0xa09544){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x117'),_0xa09544[_0xd253('0x3b')]));this[_0xd253('0x39')][_0xd253('0x74')](this,_0xa09544,_0xa09544[_0xd253('0x118')]);return this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0x119'),_0xa09544['goalname']));};AGIVertices['prototype'][_0xd253('0x11a')]=function(_0x32fb8d){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x11b'),_0x32fb8d[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x32fb8d['aws_access_key_id'])||!this[_0xd253('0x89')](_0x32fb8d['aws_secret_access_key'])){return this[_0xd253('0xd')][_0xd253('0xaa')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xd253('0x89')](_0x32fb8d[_0xd253('0x61')])){return this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0xc4'));}this['channel'][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0x11c'),_0x32fb8d[_0xd253('0x61')]));var _0x3b53c4=this[_0xd253('0x8b')][_0xd253('0x74')](this,_0x32fb8d);if(_0x3b53c4){this[_0xd253('0xd')][_0xd253('0xaa')](util['format'](_0xd253('0x11d'),_0x3b53c4));var _0x561b43=this['channel'][_0xd253('0xfb')](_0x3b53c4);try{fs[_0xd253('0xfc')](_0x3b53c4+_0xd253('0xfd'));}catch(_0x246334){logger[_0xd253('0x2d')](_0x246334);}return _0x561b43;}return this['channel']['error'](_0x32fb8d,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xd253('0xe')]['awslex']=function(_0x204a13){logger['info'](util[_0xd253('0x29')](_0xd253('0x11e'),_0x204a13[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x204a13['aws_access_key_id'])||!this[_0xd253('0x89')](_0x204a13[_0xd253('0x8d')])){return this['channel']['noop'](_0xd253('0x11f'));}if(!this[_0xd253('0x89')](_0x204a13[_0xd253('0x120')])){return this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0x121'));}if(!this[_0xd253('0x89')](_0x204a13[_0xd253('0x61')])){return this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0xc4'));}this[_0xd253('0xd')][_0xd253('0xec')]=!![];this[_0xd253('0x39')](_0x204a13);this[_0xd253('0x43')](_0x204a13['text'],'in','','');this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')]('Trying\x20Amazon\x20Lex:\x20%s',_0x204a13[_0xd253('0x61')]));var _0x371011=this['awsLex'][_0xd253('0x74')](this,_0x204a13);if(_0x371011){for(var _0x3e72b3 in _0x371011){if(_0x371011[_0xd253('0x97')](_0x3e72b3)&&_[_0xd253('0x98')](_0x371011[_0x3e72b3])){this[_0xd253('0xd')][_0xd253('0xa1')](util[_0xd253('0x29')](_0xd253('0x122'),_0x3e72b3[_0xd253('0x6f')]()),_0x371011[_0x3e72b3]);}}if(_['isNil'](_0x371011['message'])){return this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0x123'));}else{this[_0xd253('0x43')](_0x371011['message'],'out','amazonlex','');return this['channel'][_0xd253('0xaa')](util[_0xd253('0x29')]('Amazon\x20Lex\x20Result\x20%s',_0x371011[_0xd253('0x7c')]));}}return this['channel'][_0xd253('0x2d')](_0x204a13,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xd253('0xe')][_0xd253('0x124')]=function(_0xc8764a){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x125'),_0xc8764a['label'],_0xc8764a[_0xd253('0x6c')]));if(!this[_0xd253('0x89')](_0xc8764a[_0xd253('0x84')])){return this['channel'][_0xd253('0xaa')](_0xd253('0xe1'));}var _0x59c001=_0xd253('0x126');var _0x1b57fb=util[_0xd253('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0xd253('0x112')](0x4));var _0x563e46=util[_0xd253('0x29')](_0xd253('0xa0'),_0x1b57fb,_0x59c001);var _0x3d527d=!![];if(_0xc8764a[_0xd253('0x127')]===_0xd253('0x128')){_0x3d527d=![];}var _0x554a2c=this[_0xd253('0xd')][_0xd253('0x129')](_0x1b57fb,_0x59c001,_0xc8764a['intKey'],_0xc8764a[_0xd253('0x6c')],undefined,_0x3d527d);if(_0x554a2c[_0xd253('0xb0')]!==-0x1){this[_0xd253('0xd')][_0xd253('0xaa')](util['format'](_0xd253('0x12a'),_0x563e46));var _0xe2ba22=this[_0xd253('0x92')][_0xd253('0x74')](this,_0xc8764a,_0x563e46);if(_0xe2ba22){for(var _0x57cdf1 in _0xe2ba22){if(_0xe2ba22[_0xd253('0x97')](_0x57cdf1)){this[_0xd253('0xd')][_0xd253('0xa1')](util[_0xd253('0x29')]('GOOGLE_ASR_%s',_0x57cdf1[_0xd253('0x6f')]()),_0xe2ba22[_0x57cdf1]);}}return this[_0xd253('0xd')]['noop'](util[_0xd253('0x29')](_0xd253('0x12b'),JSON[_0xd253('0x79')](_0xe2ba22)));}}return _0x554a2c;};AGIVertices['prototype']['tildeasr']=function(_0xc0ee04){logger[_0xd253('0x31')](util['format'](_0xd253('0x12c'),_0xc0ee04[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0xc0ee04[_0xd253('0x12d')])){return this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0x12e'));}if(!this[_0xd253('0x89')](_0xc0ee04[_0xd253('0x95')])){return this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0x12f'));}var _0x55d2fb='wav';var _0x379b60=util[_0xd253('0x29')](_0xd253('0x130'),FILES_PATH,rs[_0xd253('0x112')](0x4));var _0x2f5830=util[_0xd253('0x29')](_0xd253('0xa0'),_0x379b60,_0x55d2fb);var _0xc468fb=!![];if(_0xc0ee04[_0xd253('0x127')]==='NOBEEP'){_0xc468fb=![];}var _0x557393=this[_0xd253('0xd')][_0xd253('0x129')](_0x379b60,_0x55d2fb,_0xc0ee04[_0xd253('0x131')],_0xc0ee04[_0xd253('0x6c')],undefined,_0xc468fb);if(_0x557393[_0xd253('0xb0')]!==-0x1){this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0x132'),_0x2f5830));var _0x4401c5=this['tildeASR'][_0xd253('0x74')](this,_0xc0ee04,_0x2f5830);if(_0x4401c5){for(var _0x28ff40 in _0x4401c5){if(_0x4401c5[_0xd253('0x97')](_0x28ff40)){this[_0xd253('0xd')][_0xd253('0xa1')](util[_0xd253('0x29')](_0xd253('0x133'),_0x28ff40[_0xd253('0x6f')]()),_0x4401c5[_0x28ff40]);}}return this[_0xd253('0xd')]['noop'](util[_0xd253('0x29')]('TildeASR\x20Result\x20%s',JSON[_0xd253('0x79')](_0x4401c5)));}}return _0x557393;};AGIVertices[_0xd253('0xe')][_0xd253('0x134')]=function(_0x3a984e){logger[_0xd253('0x31')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x3a984e[_0xd253('0x3b')]));return this[_0xd253('0xd')][_0xd253('0x135')](_0x3a984e[_0xd253('0x136')],_0x3a984e[_0xd253('0x137')],_0x3a984e[_0xd253('0x138')]);};AGIVertices[_0xd253('0xe')]['gotoif']=function(_0x4db177){logger[_0xd253('0x31')](util['format'](_0xd253('0x139'),_0x4db177[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x4db177['condition'])){return this['channel'][_0xd253('0x2d')](_0x4db177,_0xd253('0x13a'));}try{var _0x459189=eval(_0x4db177[_0xd253('0x13b')])?'true':'false';this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0x13c'),_0x4db177[_0xd253('0x13b')],_0x459189));return{'code':0xc8,'result':_0x459189};}catch(_0x42f85b){return{'code':0xc8,'result':_0xd253('0x13d')};}};AGIVertices['prototype'][_0xd253('0x13e')]=function(_0x46bc3b){logger['info'](util[_0xd253('0x29')](_0xd253('0x13f'),_0x46bc3b[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x46bc3b[_0xd253('0x140')])){return this['channel'][_0xd253('0x2d')](_0x46bc3b,_0xd253('0x141'));}var _0x3c86b5=this[_0xd253('0x142')][_0xd253('0x74')](this,_0x46bc3b[_0xd253('0x140')]);if(!_0x3c86b5){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x46bc3b,_0xd253('0x143'));}for(var _0x2cf82e=0x0;_0x2cf82e<_0x3c86b5[_0xd253('0x9e')];_0x2cf82e+=0x1){var _0x2692bf=this[_0xd253('0xd')][_0xd253('0xa4')](util[_0xd253('0x29')](_0xd253('0x144'),_0x3c86b5[_0x2cf82e]));if(_0x2692bf[_0xd253('0xb0')]===-0x1){return _0x2692bf;}logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x145'),_0x3c86b5[_0x2cf82e],_0x2692bf[_0xd253('0xa6')]));if(_0x2692bf[_0xd253('0xa6')]===_0xd253('0x146')){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x145'),_0x3c86b5[_0x2cf82e],_0xd253('0x146')));this['channel']['noop'](util[_0xd253('0x29')](_0xd253('0x145'),_0x3c86b5[_0x2cf82e],_0xd253('0x146')));return{'code':0xc8,'result':'true'};}else{logger[_0xd253('0x31')](util['format'](_0xd253('0x145'),_0x3c86b5[_0x2cf82e],'false'));this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')]('IFTIME\x20%s\x20%s',_0x3c86b5[_0x2cf82e],'false'));}}return{'code':0xc8,'result':_0xd253('0x13d')};};AGIVertices[_0xd253('0xe')][_0xd253('0x147')]=function(_0x4525d6){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x148'),_0x4525d6['label']));return this[_0xd253('0xd')]['hangup']();};AGIVertices[_0xd253('0xe')][_0xd253('0x149')]=function(_0x5ce66a){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x14a'),_0x5ce66a[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x5ce66a[_0xd253('0x84')])){return this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0xe1'));}var _0x41f717=_0xd253('0x126');var _0x2e9def=util[_0xd253('0x29')](_0xd253('0x130'),FILES_PATH,rs[_0xd253('0x112')](0x4));var _0x3512cf=util[_0xd253('0x29')](_0xd253('0xa0'),_0x2e9def,_0x41f717);var _0x40e149=!![];if(_0x5ce66a[_0xd253('0x127')]===_0xd253('0x128')){_0x40e149=![];}var _0x25bf9a=this['channel']['recordFile'](_0x2e9def,_0x41f717,_0x5ce66a[_0xd253('0x131')],_0x5ce66a['timeout'],undefined,_0x40e149);if(_0x25bf9a[_0xd253('0xb0')]!==-0x1){this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0x14b'),_0x3512cf));var _0x35cb59=this[_0xd253('0x87')][_0xd253('0x74')](this,_0x5ce66a,_0x3512cf);if(_0x35cb59){for(var _0x2e84dc in _0x35cb59){if(_0x35cb59['hasOwnProperty'](_0x2e84dc)){this[_0xd253('0xd')][_0xd253('0xa1')](util['format']('ISPEECH_ASR_%s',_0x2e84dc[_0xd253('0x6f')]()),_0x35cb59[_0x2e84dc]);}}return this[_0xd253('0xd')][_0xd253('0xaa')](util['format'](_0xd253('0x14c'),JSON[_0xd253('0x79')](_0x35cb59)));}}return _0x25bf9a;};AGIVertices['prototype'][_0xd253('0x14d')]=function(_0x5ab955){logger[_0xd253('0x31')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x5ab955[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x5ab955[_0xd253('0x84')])){return this['channel'][_0xd253('0xaa')](_0xd253('0xe1'));}if(!this[_0xd253('0x89')](_0x5ab955['text'])){return this[_0xd253('0xd')][_0xd253('0xaa')]('no\x20text\x20configured');}this['channel']['noop'](util[_0xd253('0x29')]('Trying\x20ispeech\x20TTS\x20%s',_0x5ab955[_0xd253('0x61')]));var _0x228b83=this[_0xd253('0x83')][_0xd253('0x74')](this,_0x5ab955);if(_0x228b83){this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')]('ispeech\x20%s\x20file\x20created',_0x228b83));var _0x50abe2=this[_0xd253('0xd')][_0xd253('0xfb')](_0x228b83,_0x5ab955['intKey']);try{fs['unlink'](_0x228b83+_0xd253('0xfd'));}catch(_0xb99b97){logger[_0xd253('0x2d')](_0xb99b97);}return _0x50abe2;}return this[_0xd253('0xd')][_0xd253('0x2d')](_0x5ab955,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xd253('0x14e')]=function(_0x528a5a){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x14f'),_0x528a5a[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x528a5a[_0xd253('0x150')])){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x528a5a,_0xd253('0x151'));}logger['info'](util[_0xd253('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xd253('0x3d')],_0x528a5a[_0xd253('0x150')]));var _0x24cd4d=this['agentLogin'][_0xd253('0x74')](this,_0x528a5a[_0xd253('0x150')]);if(_0x24cd4d){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x152'),this[_0xd253('0xd')][_0xd253('0x3d')],_0x528a5a[_0xd253('0x150')]));this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0x152'),this[_0xd253('0xd')][_0xd253('0x3d')],_0x528a5a[_0xd253('0x150')]));return{'code':0xc8,'result':_0xd253('0x153')};}else{logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x154'),this[_0xd253('0xd')][_0xd253('0x3d')],_0x528a5a['findBy']));this['channel'][_0xd253('0xaa')](util[_0xd253('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xd253('0x3d')],_0x528a5a['findBy']));return{'code':0xc8,'result':_0xd253('0x155')};}};AGIVertices[_0xd253('0xe')][_0xd253('0x156')]=function(_0x3fa766){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x157'),_0x3fa766['label']));if(!this[_0xd253('0x89')](_0x3fa766['findBy'])){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x3fa766,'no\x20find\x20by\x20configured');}logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x158'),this[_0xd253('0xd')][_0xd253('0x3d')],_0x3fa766[_0xd253('0x150')]));var _0x123c19=this[_0xd253('0x54')][_0xd253('0x74')](this,_0x3fa766[_0xd253('0x150')]);if(_0x123c19){logger['info'](util[_0xd253('0x29')](_0xd253('0x152'),this[_0xd253('0xd')]['callerid'],_0x3fa766[_0xd253('0x150')]));this[_0xd253('0xd')][_0xd253('0xaa')](util['format'](_0xd253('0x152'),this['channel'][_0xd253('0x3d')],_0x3fa766[_0xd253('0x150')]));return{'code':0xc8,'result':_0xd253('0x153')};}else{logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x154'),this[_0xd253('0xd')][_0xd253('0x3d')],_0x3fa766['findBy']));this['channel'][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0x154'),this['channel'][_0xd253('0x3d')],_0x3fa766[_0xd253('0x150')]));return{'code':0xc8,'result':_0xd253('0x155')};}};AGIVertices[_0xd253('0xe')]['math']=function(_0x2157dc){logger['info'](util[_0xd253('0x29')](_0xd253('0x159'),_0x2157dc[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x2157dc[_0xd253('0x15a')])){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x2157dc,_0xd253('0x15b'));}this[_0xd253('0xd')][_0xd253('0xaa')](util['format'](_0xd253('0x15c'),_0x2157dc[_0xd253('0x15a')]));var _0x31f8e7=eval(_0x2157dc[_0xd253('0x15a')]);if(!this[_0xd253('0x89')](_0x2157dc[_0xd253('0xd4')])){return this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0xd3'));}var _0x39de88=this[_0xd253('0xa4')][_0xd253('0x74')](this,_0x2157dc[_0xd253('0xd4')]);if(!_0x39de88){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x2157dc,'no\x20variable\x20found');}if(_[_0xd253('0x9d')](_0x31f8e7)){var _0x5543dd=this;_0x31f8e7[_0xd253('0xd6')](function(_0x474874,_0x5e95be){_0x5543dd['channel'][_0xd253('0xa1')](util[_0xd253('0x29')](_0xd253('0x15d'),_0x39de88,_0x5e95be),_0x474874);});return this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0x15e'),_0x39de88));}else{return this[_0xd253('0xd')][_0xd253('0xa1')](_0x39de88,_0x31f8e7);}};AGIVertices['prototype'][_0xd253('0x15f')]=function(_0x48013e){logger['info'](util[_0xd253('0x29')](_0xd253('0x160'),_0x48013e[_0xd253('0x3b')]));if(_0x48013e[_0xd253('0x109')]===0x0){return this[_0xd253('0xa7')](_0x48013e);}_0x48013e[_0xd253('0x109')]-=0x1;if(!this[_0xd253('0x89')](_0x48013e[_0xd253('0x10a')])){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x48013e,'no\x20file\x20audio\x20selected');}var _0x43c170=this[_0xd253('0x1d')][_0xd253('0x74')](this,_0x48013e[_0xd253('0x10a')]);if(!_0x43c170){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x48013e,_0xd253('0x10c'));}var _0x376e9c=this[_0xd253('0xd')][_0xd253('0x10d')](_0x43c170,_0x48013e[_0xd253('0x161')],_0x48013e[_0xd253('0x162')]);var _0xa8d9ff=_0x376e9c[_0xd253('0xb0')];if(_0x376e9c[_0xd253('0xb0')]===-0x1){this[_0xd253('0x39')][_0xd253('0x74')](this,_0x48013e,'-1');return _0x376e9c;}else if(_0x376e9c[_0xd253('0xa6')]==='timeout'){_0x376e9c[_0xd253('0xb0')]=_0x376e9c[_0xd253('0xb0')][_0xd253('0x9e')]>0x0?_0x376e9c[_0xd253('0xb0')]:'t';}else if(_[_0xd253('0x45')](_0x376e9c[_0xd253('0xb0')])){_0x376e9c[_0xd253('0xb0')]='#';_0xa8d9ff='#';}if(!this[_0xd253('0x89')](_0x48013e[_0xd253('0xd4')])){this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0xd3'));}else{var _0x598003=this[_0xd253('0xa4')][_0xd253('0x74')](this,_0x48013e[_0xd253('0xd4')]);if(!_0x598003){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x48013e,_0xd253('0xd5'));}this['channel'][_0xd253('0xa1')](_0x598003,_0xa8d9ff);}this[_0xd253('0x39')][_0xd253('0x74')](this,_0x48013e,_0xa8d9ff);return _0x376e9c;};AGIVertices[_0xd253('0xe')][_0xd253('0xaa')]=function(_0xbea405){logger[_0xd253('0x31')](util['format'](_0xd253('0x163'),_0xbea405[_0xd253('0x3b')]));return this[_0xd253('0xd')][_0xd253('0xaa')](_0xbea405[_0xd253('0x164')]||_0xbea405[_0xd253('0x3b')]);};AGIVertices[_0xd253('0xe')][_0xd253('0x165')]=function(_0x52c725){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x166'),_0x52c725[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x52c725['findBy'])){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x52c725,_0xd253('0x151'));}logger[_0xd253('0x31')](util['format'](_0xd253('0x158'),this[_0xd253('0xd')][_0xd253('0x3d')],_0x52c725[_0xd253('0x150')]));var _0x1e1db9=this[_0xd253('0x51')]['sync'](this,_0x52c725['pause_id']);var _0x398ab3=this[_0xd253('0x52')][_0xd253('0x74')](this,_0x52c725['findBy'],_0x1e1db9);if(_0x398ab3){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x152'),this[_0xd253('0xd')][_0xd253('0x3d')],_0x52c725['findBy']));this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0x152'),this[_0xd253('0xd')][_0xd253('0x3d')],_0x52c725[_0xd253('0x150')]));return{'code':0xc8,'result':_0xd253('0x153')};}else{logger[_0xd253('0x31')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd253('0xd')][_0xd253('0x3d')],_0x52c725['findBy']));this[_0xd253('0xd')][_0xd253('0xaa')](util['format'](_0xd253('0x152'),this[_0xd253('0xd')]['callerid'],_0x52c725[_0xd253('0x150')]));return{'code':0xc8,'result':_0xd253('0x155')};}};AGIVertices['prototype'][_0xd253('0x167')]=function(_0x45ae23){logger['info'](util[_0xd253('0x29')](_0xd253('0x168'),_0x45ae23['label']));if(!this[_0xd253('0x89')](_0x45ae23[_0xd253('0x10a')])){return this[_0xd253('0xd')]['error'](_0x45ae23,_0xd253('0x10b'));}var _0x3021f3=this['getSound'][_0xd253('0x74')](this,_0x45ae23[_0xd253('0x10a')]);if(!_0x3021f3){return this[_0xd253('0xd')]['error'](_0x45ae23,_0xd253('0x10c'));}var _0x5902b1=this['channel'][_0xd253('0x5b')]('PLAYBACK',[_0x3021f3,_0x45ae23[_0xd253('0x104')]]);if(_0x5902b1[_0xd253('0xb0')]===-0x1){return _0x5902b1;}return this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0x169'),_0xd253('0x16a'),_0x3021f3));};AGIVertices[_0xd253('0xe')][_0xd253('0x16b')]=function(_0x5ea3d8){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x16c'),_0x5ea3d8[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x5ea3d8[_0xd253('0x16d')])){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x5ea3d8,_0xd253('0x16e'));}var _0x247465='';var _0x335e5c=parseInt(_0x5ea3d8['queue_id'],0xa);if(isNaN(_0x335e5c)){_0x247465=_0x5ea3d8[_0xd253('0x16d')];}else{_0x247465=this['getVoiceQueue'][_0xd253('0x74')](this,_0x5ea3d8[_0xd253('0x16d')]);if(!_0x247465){return this[_0xd253('0xd')]['error'](_0x5ea3d8,'no\x20queue\x20found');}}var _0x54b4f9='';if(this[_0xd253('0x89')](_0x5ea3d8[_0xd253('0x10a')])){var _0x10d8ef=this[_0xd253('0x1d')][_0xd253('0x74')](this,_0x5ea3d8['file_id']);if(_0x10d8ef){_0x54b4f9=_0x10d8ef;}}this[_0xd253('0x39')][_0xd253('0x74')](this,_0x5ea3d8,_0x247465);if(_0x5ea3d8[_0xd253('0x104')][_0xd253('0x16f')]('x')<0x0){_0x5ea3d8[_0xd253('0x104')]+='x';}if(_0x5ea3d8[_0xd253('0x104')][_0xd253('0x16f')]('X')<0x0){_0x5ea3d8['opts']+='X';}this[_0xd253('0xd')]['setVariable']('XMCS-QUEUE',_0x247465?_0x247465[_0xd253('0x170')]():'');var _0x38126b=this[_0xd253('0xd')][_0xd253('0x5b')](_0xd253('0x171'),[_0x247465,_0x5ea3d8[_0xd253('0x104')],_0x5ea3d8[_0xd253('0x77')],_0x54b4f9,_0x5ea3d8[_0xd253('0x6c')],_0x5ea3d8[_0xd253('0x5')],_0x5ea3d8[_0xd253('0x172')],_0x5ea3d8[_0xd253('0x173')],'',_0x5ea3d8['position']]);if(_0x38126b[_0xd253('0xb0')]===-0x1){return _0x38126b;}return this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0x169'),'QUEUE',_0x247465));};AGIVertices[_0xd253('0xe')][_0xd253('0x174')]=function(_0x1e3401){logger[_0xd253('0x31')](util[_0xd253('0x29')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x1e3401[_0xd253('0x3b')]));var _0x9cd912=_0x1e3401['recordingFormat']||_0xd253('0x126');var _0x137f3c=util[_0xd253('0x29')](_0xd253('0x175'),this[_0xd253('0xd')][_0xd253('0x3a')],rs[_0xd253('0x112')](0x5));var _0x515271=util[_0xd253('0x29')](_0xd253('0x176'),FILES_PATH,_0x137f3c,_0x9cd912);var _0x399e7f=util['format'](_0xd253('0x130'),FILES_PATH,_0x137f3c);this[_0xd253('0x3e')][_0xd253('0x74')](this,_0x1e3401,_0x137f3c,_0x515271);this[_0xd253('0xd')][_0xd253('0xa1')](_0xd253('0x177'),_0x137f3c);logger[_0xd253('0x31')](_0xd253('0x178'),_0x399e7f,_0x9cd912,_0x1e3401['escape_digits'],_0x1e3401[_0xd253('0x6c')]);return this[_0xd253('0xd')][_0xd253('0x129')](_0x399e7f,_0x9cd912,_0x1e3401[_0xd253('0x179')],_0x1e3401[_0xd253('0x6c')],undefined,!![]);};AGIVertices[_0xd253('0xe')][_0xd253('0x17a')]=function(_0x429352){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x17b'),_0x429352[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x429352[_0xd253('0x77')])){return this[_0xd253('0xd')][_0xd253('0xaa')]('no\x20url\x20configured');}var _0x40c4ec=this[_0xd253('0x69')]['sync'](this,_0x429352);logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x17c'),util['inspect'](_0x40c4ec,{'showHidden':![],'depth':null})));if(!this[_0xd253('0x89')](_0x429352['variable_id'])){return this['channel'][_0xd253('0xaa')](_0xd253('0x17d'));}var _0xdbd32d=this[_0xd253('0xa4')][_0xd253('0x74')](this,_0x429352[_0xd253('0xd4')]);if(!_0xdbd32d){return this['channel']['error'](_0x429352,_0xd253('0xd5'));}this[_0xd253('0xd')]['setVariable'](util['format']('%s_STATUS_CODE',_0xdbd32d),_0x40c4ec[_0xd253('0x7b')]?_0x40c4ec['statusCode']:_0xd253('0x17e'));this[_0xd253('0xd')]['setVariable'](util[_0xd253('0x29')](_0xd253('0x17f'),_0xdbd32d),_0x40c4ec['statusMessage']?_0x40c4ec[_0xd253('0x180')]:'OK');if(_0x40c4ec[_0xd253('0x70')]){try{this['saveRestApiResult'](_0x40c4ec[_0xd253('0x70')],_0xdbd32d);}catch(_0x4e2233){logger[_0xd253('0x2d')](util[_0xd253('0x29')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0xdbd32d));}}return this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')]('variable\x20%s\x20set',_0xdbd32d));};AGIVertices['prototype'][_0xd253('0x181')]=function(_0x49e092){logger[_0xd253('0x31')](util[_0xd253('0x29')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x49e092['label']));return this[_0xd253('0xd')][_0xd253('0x182')](_0x49e092['digits'][_0xd253('0x5d')](/\s+/g,''),_0x49e092[_0xd253('0x179')]);};AGIVertices['prototype']['saynumber']=function(_0x2302a5){logger['info'](util['format'](_0xd253('0x183'),_0x2302a5['label']));return this['channel']['sayNumber'](_0x2302a5[_0xd253('0x6b')][_0xd253('0x5d')](/\s+/g,''),_0x2302a5['escape_digits']);};AGIVertices[_0xd253('0xe')][_0xd253('0x184')]=function(_0x4bebcd){logger[_0xd253('0x31')](util['format'](_0xd253('0x185'),_0x4bebcd[_0xd253('0x3b')]));return this[_0xd253('0xd')][_0xd253('0x186')](_0x4bebcd[_0xd253('0x61')],_0x4bebcd[_0xd253('0x179')]);};AGIVertices[_0xd253('0xe')]['sendMail']=function(_0x5fcab8){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x187'),_0x5fcab8['label']));if(!this['isConfigured'](_0x5fcab8['account_id'])){return this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0x188'));}var _0x1ad9c0=this[_0xd253('0x21')][_0xd253('0x74')](this,_0x5fcab8[_0xd253('0x189')]);if(!_0x1ad9c0||!_0x1ad9c0['Smtp']){return this[_0xd253('0xd')]['error'](_0x5fcab8,_0xd253('0x18a'));}var _0x458b1e={'from':util[_0xd253('0x29')]('\x22%s\x22\x20<%s>',_0x1ad9c0[_0xd253('0x14')],_0x1ad9c0[_0xd253('0x18b')]||_0x1ad9c0[_0xd253('0x18c')][_0xd253('0x18d')]),'to':_0x5fcab8['to']||'','cc':_0x5fcab8['cc']||'','bcc':_0x5fcab8[_0xd253('0x18e')]||'','subject':_0x5fcab8[_0xd253('0x18f')],'html':_0x5fcab8[_0xd253('0x61')],'text':_0x5fcab8['text']};if(this[_0xd253('0x89')](_0x5fcab8['template_id'])){}logger[_0xd253('0xd9')]('sendMail\x20message',JSON[_0xd253('0x79')](_0x458b1e));this[_0xd253('0x39')]['sync'](this,_0x5fcab8,_0x5fcab8['account_id']);this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0x190'),_0x1ad9c0[_0xd253('0x14')]));this[_0xd253('0x23')][_0xd253('0x74')](this,_0x1ad9c0[_0xd253('0x191')],_0x458b1e);return this[_0xd253('0xd')]['noop'](_0xd253('0x192'));};AGIVertices[_0xd253('0xe')]['sendFax']=function(_0x914fcc){logger['info'](util[_0xd253('0x29')](_0xd253('0x193'),_0x914fcc[_0xd253('0x3b')]));return this[_0xd253('0xd')][_0xd253('0xaa')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xd253('0xe')]['sendSMS']=function(_0x18efb8){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x194'),_0x18efb8[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x18efb8[_0xd253('0x195')])){return this[_0xd253('0xd')]['noop']('no\x20sms\x20account\x20configured');}var _0x2abbb0=this['getSmsAccount'][_0xd253('0x74')](this,_0x18efb8['sms_account_id']);if(!_0x2abbb0){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x18efb8,'no\x20sms\x20account\x20found');}var _0x276f33={'body':_0x18efb8[_0xd253('0x196')],'phone':_0x18efb8['to']||'','SmsAccountId':_0x2abbb0['id']};logger[_0xd253('0xd9')](_0xd253('0x197'),JSON['stringify'](_0x276f33));this[_0xd253('0x39')][_0xd253('0x74')](this,_0x18efb8,_0x18efb8[_0xd253('0x195')]);this['channel']['noop'](util['format'](_0xd253('0x198'),_0x2abbb0['name']));this['createSmsMessage'][_0xd253('0x74')](this,_0x276f33);return this[_0xd253('0xd')]['noop'](_0xd253('0x199'));};AGIVertices['prototype'][_0xd253('0x19a')]=function(_0x3dc793){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x19b'),_0x3dc793['label']));if(!this[_0xd253('0x89')](_0x3dc793[_0xd253('0xd4')])){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x3dc793,'no\x20variable\x20selected');}var _0x3889f2=this[_0xd253('0xa4')][_0xd253('0x74')](this,_0x3dc793[_0xd253('0xd4')]);if(!_0x3889f2){return this['channel']['error'](_0x3dc793,_0xd253('0xd5'));}return this['channel'][_0xd253('0xa1')](_0x3889f2,_0x3dc793['variable_value']);};AGIVertices[_0xd253('0xe')][_0xd253('0x19c')]=function(_0x3ff83c){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x19d'),_0x3ff83c['label']));this[_0xd253('0xd')]['noop'](_0xd253('0x19e'));if(_0x3ff83c[_0xd253('0xbb')]===_0xd253('0x19f')){this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0x1a0'));return this[_0xd253('0xd')][_0xd253('0xbb')]();}return this['channel'][_0xd253('0xaa')](_0xd253('0x1a1'));};AGIVertices[_0xd253('0xe')][_0xd253('0x1a2')]=function(_0x23a314){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x1a3'),_0x23a314[_0xd253('0x3b')]));if(!this[_0xd253('0x89')](_0x23a314[_0xd253('0x1a4')])){return this['channel'][_0xd253('0x2d')](_0x23a314,_0xd253('0x1a5'));}var _0x39476e=this[_0xd253('0x15')][_0xd253('0x74')](this,_0x23a314[_0xd253('0x1a4')]);if(!this['isConfigured'](_0x39476e)){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x23a314,util['format'](_0xd253('0x1a6'),_0x23a314['project_id']));}if(_0x39476e===this[_0xd253('0xd')][_0xd253('0x3c')]){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x23a314,_0xd253('0x1a7'));}this[_0xd253('0x39')][_0xd253('0x74')](this,_0x23a314,_0x39476e);var _0x40da23=this[_0xd253('0xd')][_0xd253('0x5b')]('AGI',util['format'](_0xd253('0x1a8'),config[_0xd253('0x5')][_0xd253('0x1a9')]||_0xd253('0x1aa'),_0x39476e,this['channel'][_0xd253('0x3c')]));if(_0x40da23['result']===-0x1){return _0x40da23;}return this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0x169'),_0xd253('0x1ab'),_0x39476e));};AGIVertices[_0xd253('0xe')][_0xd253('0x1ac')]=function(_0x46164e){logger[_0xd253('0x31')](util[_0xd253('0x29')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x46164e[_0xd253('0x3b')]));var _0xfb0fb8=this[_0xd253('0x5a')][_0xd253('0x74')](this,_0x46164e[_0xd253('0xb7')]);this[_0xd253('0x39')]['sync'](this,_0x46164e,_0x46164e[_0xd253('0xb7')]);if(this[_0xd253('0x89')](_0x46164e[_0xd253('0xd4')])){var _0x21755c=this['getVariable'][_0xd253('0x74')](this,_0x46164e[_0xd253('0xd4')]);if(_0x21755c){this[_0xd253('0xd')]['setVariable'](_0x21755c,_0xfb0fb8);return this['channel'][_0xd253('0xaa')](util['format'](_0xd253('0x1ad'),_0x46164e[_0xd253('0xb7')],_0x21755c));}}return this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0x1ae'),_0x46164e[_0xd253('0xb7')]));};AGIVertices[_0xd253('0xe')][_0xd253('0x1af')]=function(_0x133382){logger[_0xd253('0x31')](util[_0xd253('0x29')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x133382[_0xd253('0x3b')]));_0x133382[_0xd253('0x61')]=_0x133382['text'][_0xd253('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd253('0x89')](_0x133382[_0xd253('0x5f')])){return this['channel'][_0xd253('0xaa')](_0xd253('0x1b0'));}if(!this['isConfigured'](_0x133382[_0xd253('0x61')])){return this[_0xd253('0xd')][_0xd253('0xaa')]('no\x20text\x20configured');}this['channel'][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0x1b1'),_0x133382[_0xd253('0x61')]));var _0x145a6c=this[_0xd253('0x5e')][_0xd253('0x74')](this,_0x133382);if(_0x145a6c){this['channel'][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0x1b2'),_0x145a6c));var _0x41efa6=this[_0xd253('0xd')][_0xd253('0xfb')](_0x145a6c);try{fs[_0xd253('0xfc')](_0x145a6c+'.wav');}catch(_0x5b7822){logger['error'](_0x5b7822);}return _0x41efa6;}return this[_0xd253('0xd')][_0xd253('0x2d')](_0x133382,_0xd253('0x1b3'));};AGIVertices['prototype'][_0xd253('0x1b4')]=function(_0x135833){logger[_0xd253('0x31')](util[_0xd253('0x29')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x135833[_0xd253('0x3b')]));_0x135833[_0xd253('0x61')]=_0x135833['text'][_0xd253('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x135833[_0xd253('0x61')])){return this[_0xd253('0xd')][_0xd253('0xaa')](_0xd253('0xc4'));}this['channel'][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0x1b5'),_0x135833[_0xd253('0x61')]));var _0x49749a=this[_0xd253('0x67')][_0xd253('0x74')](this,_0x135833);if(_0x49749a){this[_0xd253('0xd')]['noop'](util[_0xd253('0x29')](_0xd253('0x1b6'),_0x49749a));var _0x190d09=this[_0xd253('0xd')][_0xd253('0xfb')](_0x49749a);try{fs['unlink'](_0x49749a+_0xd253('0xfd'));}catch(_0x504771){logger['error'](_0x504771);}return _0x190d09;}return this[_0xd253('0xd')][_0xd253('0x2d')](_0x135833,_0xd253('0x1b7'));};AGIVertices[_0xd253('0xe')]['unpause']=function(_0x1d1e36){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x1b8'),_0x1d1e36[_0xd253('0x3b')]));if(!this['isConfigured'](_0x1d1e36[_0xd253('0x150')])){return this['channel'][_0xd253('0x2d')](_0x1d1e36,_0xd253('0x151'));}logger[_0xd253('0x31')](util[_0xd253('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xd253('0xd')][_0xd253('0x3d')],_0x1d1e36[_0xd253('0x150')]));var _0x343b6e=this[_0xd253('0x53')]['sync'](this,_0x1d1e36[_0xd253('0x150')]);if(_0x343b6e){logger['info'](util[_0xd253('0x29')](_0xd253('0x152'),this[_0xd253('0xd')]['callerid'],_0x1d1e36[_0xd253('0x150')]));this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')](_0xd253('0x152'),this[_0xd253('0xd')]['callerid'],_0x1d1e36[_0xd253('0x150')]));return{'code':0xc8,'result':_0xd253('0x153')};}else{logger['info'](util[_0xd253('0x29')](_0xd253('0x154'),this[_0xd253('0xd')][_0xd253('0x3d')],_0x1d1e36[_0xd253('0x150')]));this[_0xd253('0xd')][_0xd253('0xaa')](util[_0xd253('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd253('0xd')][_0xd253('0x3d')],_0x1d1e36[_0xd253('0x150')]));return{'code':0xc8,'result':_0xd253('0x155')};}};AGIVertices[_0xd253('0xe')][_0xd253('0x1b9')]=function(_0x154904){logger[_0xd253('0x31')](util[_0xd253('0x29')](_0xd253('0x1ba'),_0x154904[_0xd253('0x3b')]));var _0x305807=this[_0xd253('0xd')]['exec'](_0xd253('0x1bb'),[_0x154904[_0xd253('0x1bc')],_0x154904[_0xd253('0x7d')]]);if(_0x305807[_0xd253('0xb0')]===-0x1){return _0x305807;}return this[_0xd253('0xd')]['noop'](util[_0xd253('0x29')](_0xd253('0x169'),'VOICEMAIL',_0x154904['mailbox']));};AGIVertices['prototype']['vswitch']=function(_0x3facc8){logger['info'](util[_0xd253('0x29')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x3facc8['label']));if(!this[_0xd253('0x89')](_0x3facc8[_0xd253('0xd4')])){return this['channel']['error'](_0x3facc8,_0xd253('0x1bd'));}var _0x67b59=this[_0xd253('0xa4')]['sync'](this,_0x3facc8[_0xd253('0xd4')]);if(!_0x67b59){return this[_0xd253('0xd')][_0xd253('0x2d')](_0x3facc8,_0xd253('0xd5'));}var _0x573a78=this[_0xd253('0xd')][_0xd253('0xa4')](_0x67b59);return{'code':0xc8,'result':_0x573a78[_0xd253('0xa6')]?_0x573a78[_0xd253('0xa6')]:'-'};};String['prototype'][_0xd253('0xa3')]=function(_0xad4c0c,_0xdfc48f){return this[_0xd253('0xa2')](_0xad4c0c)[_0xd253('0x1be')](_0xdfc48f);};module['exports']=AGIVertices; \ No newline at end of file +var _0x2c54=['aws_text_type','aws_lex_region','googleASR','tildeASR','appid','appsecret','clear','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','length','saveRestApiResult','%s.%s','isArray','split','replaceAll','extra','getAndSetVariable','result','setVariable','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','minutes','createCmContact','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','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','createSquareMessage','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','dialogflowV2_language','no\x20anguage\x20configured','bot','providerResponse','out','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','%s/recordings/%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','output','pause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','toLowerCase','macro','gosub','QUEUE','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','replace','sayNumber','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','getSquareProject','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','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','mailbox','join','util','lodash','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment/shared','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueueById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','getIntervals','getIntervalById','interval','map','format','getQueryOdbc','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','dnid','file','uniqueid','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agentPause','agent','error','agentUnpause','agentLogout','%s/%s@from-sip/n','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','render','headers','parse','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','key','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c54,0x136));var _0x42c5=function(_0x4eb364,_0x93560f){_0x4eb364=_0x4eb364-0x0;var _0x10ac9e=_0x2c54[_0x4eb364];return _0x10ac9e;};'use strict';var fs=require('fs');var util=require(_0x42c5('0x0'));var _=require(_0x42c5('0x1'));var sh=require(_0x42c5('0x2'));var odbc=require('odbc')();var rs=require(_0x42c5('0x3'));var moment=require(_0x42c5('0x4'));var Mustache=require(_0x42c5('0x5'));var rp=require(_0x42c5('0x6'));var logger=require(_0x42c5('0x7'))(_0x42c5('0x8'));var config=require('../../config/environment');var shared=require(_0x42c5('0x9'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x42c5('0xa'),_0x42c5('0xb')];var verticesWithRetry=[_0x42c5('0xc'),_0x42c5('0xd'),_0x42c5('0xe')];var AGIVertices=function(_0x4ce554,_0x21d563,_0x3ca4de){this[_0x42c5('0xf')]=_0x4ce554;this[_0x42c5('0x10')]=_0x21d563;this[_0x42c5('0x11')]=_0x3ca4de;};AGIVertices[_0x42c5('0x12')][_0x42c5('0x13')]=function(_0x2390c7,_0x2b0167){this[_0x42c5('0x10')][_0x42c5('0x14')](_0x2390c7)[_0x42c5('0x15')](function(_0xb5c314){_0x2b0167(null,_0xb5c314?_0xb5c314[_0x42c5('0x16')]:![]);})[_0x42c5('0x17')](function(_0x391716){_0x2b0167(_0x391716);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x1b1db5,_0xc17623){this[_0x42c5('0x10')][_0x42c5('0x18')](_0x1b1db5)['then'](function(_0x374218){_0xc17623(null,_0x374218?_0x374218[_0x42c5('0x16')]:![]);})[_0x42c5('0x17')](function(_0x4efb1a){_0xc17623(_0x4efb1a);});};AGIVertices[_0x42c5('0x12')]['getSquareProject']=function(_0x48d227,_0x466b47){this['rpc']['getSquareProjectById'](_0x48d227)[_0x42c5('0x15')](function(_0x3a2115){_0x466b47(null,_0x3a2115?_0x3a2115[_0x42c5('0x16')]:![]);})[_0x42c5('0x17')](function(_0x431f4e){_0x466b47(_0x431f4e);});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x19')]=function(_0x34f31b,_0x29ca68){this[_0x42c5('0x10')][_0x42c5('0x1a')](_0x34f31b)[_0x42c5('0x15')](function(_0x11c6e8){_0x29ca68(null,_0x11c6e8?_0x11c6e8[_0x42c5('0x1b')]:![]);})['catch'](function(_0x102294){_0x29ca68(_0x102294);});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x1c')]=function(_0x56fc64,_0x245e72){this[_0x42c5('0x10')]['getUserById'](_0x56fc64)[_0x42c5('0x15')](function(_0xd577c8){_0x245e72(null,_0xd577c8?_0xd577c8[_0x42c5('0x16')]:![]);})[_0x42c5('0x17')](function(_0x119580){_0x245e72(_0x119580);});};AGIVertices[_0x42c5('0x12')]['getTrunk']=function(_0x2d319d,_0x5b61e4){this[_0x42c5('0x10')][_0x42c5('0x1d')](_0x2d319d)['then'](function(_0x44040a){_0x5b61e4(null,_0x44040a?_0x44040a['name']:![]);})[_0x42c5('0x17')](function(_0x45e9bf){_0x5b61e4(_0x45e9bf);});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x1e')]=function(_0x2cb126,_0x4431ff){var _0x4d852b=this;this[_0x42c5('0x10')]['getSoundById'](_0x2cb126)[_0x42c5('0x15')](function(_0x2daef6){_0x4431ff(null,_0x2daef6?_0x4d852b[_0x42c5('0x1f')](_0x2daef6[_0x42c5('0x20')]):![]);})['catch'](function(_0x5a3cd8){_0x4431ff(_0x5a3cd8);});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x21')]=function(_0x55e7dd,_0x13daf0){this['rpc'][_0x42c5('0x22')](_0x55e7dd)['then'](function(_0x246575){_0x13daf0(null,_0x246575?_0x246575:![]);})[_0x42c5('0x17')](function(_0x8ca711){_0x13daf0(_0x8ca711);});};AGIVertices['prototype']['sendMailMessage']=function(_0x35ab1b,_0x449b36,_0x393321){this[_0x42c5('0x11')]['sendMailMessage'](_0x35ab1b,_0x449b36)['then'](function(){_0x393321(null);})[_0x42c5('0x17')](function(_0x389b1b){_0x393321(_0x389b1b);});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x23')]=function(_0x401e62,_0x5b8e8e){this[_0x42c5('0x10')][_0x42c5('0x24')](_0x401e62)['then'](function(_0x3c1b0b){if(_0x3c1b0b){if(_0x3c1b0b['IntervalId']){_0x5b8e8e(null,[_0x3c1b0b[_0x42c5('0x25')]]);}else{_0x5b8e8e(null,_[_0x42c5('0x26')](_0x3c1b0b['Intervals'],'interval'));}}else{_0x5b8e8e(null,![]);}})['catch'](function(_0x541291){_0x5b8e8e(_0x541291);});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x1f')]=function(_0x10006e){return util[_0x42c5('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x10006e);};AGIVertices[_0x42c5('0x12')][_0x42c5('0x28')]=function(_0x416198,_0x3d0146,_0x481202){odbc['open'](_0x416198,function(_0x2c4c8d){if(_0x2c4c8d){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x2c4c8d);_0x481202(_0x2c4c8d);}else{logger['info'](_0x42c5('0x29'));odbc[_0x42c5('0x2a')](_0x3d0146,function(_0x35e1e7,_0xd81e49){if(_0x35e1e7){logger[_0x42c5('0x2b')](_0x42c5('0x2c'),_0x3d0146);_0x481202(_0x35e1e7);}else{logger[_0x42c5('0x2b')](_0x42c5('0x2d'),_0x3d0146);odbc[_0x42c5('0x2e')](function(_0x43ebce){if(_0x43ebce){logger['error'](_0x42c5('0x2f'),_0x43ebce);}_0x481202(null,_0xd81e49);});}});}});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x30')]=function(_0x1a6d9b,_0x355e4a){this['rpc'][_0x42c5('0x31')](_0x1a6d9b)['then'](function(_0x9692f1){_0x355e4a(null,_0x9692f1?_0x9692f1:![]);})[_0x42c5('0x17')](function(_0x116cbf){_0x355e4a(_0x116cbf);});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x32')]=function(_0x462409,_0x356835){this[_0x42c5('0x10')][_0x42c5('0x32')](_0x462409)[_0x42c5('0x15')](function(_0x41c586){_0x356835(null,_0x41c586);})[_0x42c5('0x17')](function(_0x1b5079){_0x356835(_0x1b5079);});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x33')]=function(_0x341aee,_0x166f2b,_0x187437){this[_0x42c5('0x10')][_0x42c5('0x33')]({'uniqueid':this[_0x42c5('0xf')]['uniqueid'],'node':_0x341aee[_0x42c5('0x34')],'application':_0x341aee[_0x42c5('0x35')],'data':_0x166f2b||null,'project_name':this['channel'][_0x42c5('0x36')],'callerid':this[_0x42c5('0xf')]['callerid']})[_0x42c5('0x15')](function(_0x4298d8){if(_0x187437){_0x187437(null,_0x4298d8);}})[_0x42c5('0x17')](function(_0x2e7e89){if(_0x187437){_0x187437(_0x2e7e89);}});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x37')]=function(_0x548a2a,_0x575a7e,_0x548f85,_0x45c6ed){this[_0x42c5('0x10')][_0x42c5('0x37')]({'uniqueid':this[_0x42c5('0xf')]['uniqueid'],'callerid':this['channel'][_0x42c5('0x38')],'calleridname':this[_0x42c5('0xf')][_0x42c5('0x39')],'context':this[_0x42c5('0xf')][_0x42c5('0x3a')],'extension':this['channel'][_0x42c5('0x3b')],'priority':this[_0x42c5('0xf')][_0x42c5('0x3c')],'accountcode':this[_0x42c5('0xf')]['accountcode'],'dnid':this[_0x42c5('0xf')][_0x42c5('0x3d')],'projectName':this[_0x42c5('0xf')][_0x42c5('0x36')],'saveName':_0x575a7e,'filename':_0x548a2a[_0x42c5('0x3e')]||_0x575a7e,'savePath':_0x548f85})[_0x42c5('0x15')](function(_0x4079a8){_0x45c6ed(null,_0x4079a8);})[_0x42c5('0x17')](function(_0x40496c){_0x45c6ed(_0x40496c);});};AGIVertices[_0x42c5('0x12')]['createSquareMessage']=function(_0x1b9e51,_0x473723,_0x175323,_0x5176d7,_0x2fd384){this[_0x42c5('0x10')]['createSquareMessage']({'uniqueid':this[_0x42c5('0xf')][_0x42c5('0x3f')],'body':_0x1b9e51,'direction':_0x473723,'providerName':_0x175323,'providerResponse':_0x5176d7})[_0x42c5('0x15')](function(_0x447922){if(_0x2fd384){_0x2fd384(null,_0x447922);}})['catch'](function(_0x41752f){if(_0x2fd384){_0x2fd384(_0x41752f);}});};AGIVertices[_0x42c5('0x12')]['createCmContact']=function(_0x4d676a,_0x30faa5){this[_0x42c5('0x10')]['createCmContact']({'firstName':_['isEmpty'](_0x4d676a['name'])||_[_0x42c5('0x40')](_0x4d676a['name'])?_0x42c5('0x41')+Math[_0x42c5('0x42')]():_0x4d676a[_0x42c5('0x16')],'lastName':_[_0x42c5('0x43')](_0x4d676a[_0x42c5('0x44')])||_[_0x42c5('0x40')](_0x4d676a[_0x42c5('0x44')])?null:_0x4d676a[_0x42c5('0x44')],'phone':_0x4d676a[_0x42c5('0x45')],'ListId':_0x4d676a[_0x42c5('0x46')],'scheduledat':_0x4d676a[_0x42c5('0x47')],'callbackUniqueid':this[_0x42c5('0xf')][_0x42c5('0x3f')],'tags':_0x42c5('0x48'),'description':'Callback\x20scheduled\x20at\x20'+_0x4d676a[_0x42c5('0x47')][_0x42c5('0x49')](),'priority':_0x4d676a[_0x42c5('0x4a')]})[_0x42c5('0x15')](function(_0x21f4e1){_0x30faa5(null,_0x21f4e1);})[_0x42c5('0x17')](function(_0x3b00ee){_0x30faa5(_0x3b00ee);});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x4b')]=function(_0x5206b3,_0x35b179){this[_0x42c5('0x10')][_0x42c5('0x4c')](_0x5206b3)[_0x42c5('0x15')](function(_0x476281){_0x35b179(null,_0x476281?_0x476281['name']:![]);})[_0x42c5('0x17')](function(_0x3a7a3f){_0x35b179(_0x3a7a3f);});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x4d')]=function(_0x477f30,_0x1ca3f0,_0x19fa8b){var _0x43167b={'role':_0x42c5('0x4e')};_0x43167b[_0x477f30]=this['channel'][_0x42c5('0x38')];this['rpc'][_0x42c5('0x4d')](_0x43167b,_0x1ca3f0,this['channel']['uniqueid'])[_0x42c5('0x15')](function(_0x5e0647){_0x19fa8b(null,_[_0x42c5('0x40')](_0x5e0647)?![]:!![]);})['catch'](function(_0x41a33e){logger[_0x42c5('0x4f')](_0x41a33e);_0x19fa8b(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x21173c,_0xed290){var _0x17e0c0={'role':_0x42c5('0x4e')};_0x17e0c0[_0x21173c]=this[_0x42c5('0xf')][_0x42c5('0x38')];this[_0x42c5('0x10')][_0x42c5('0x50')](_0x17e0c0)[_0x42c5('0x15')](function(_0x15d325){_0xed290(null,_['isNil'](_0x15d325)?![]:!![]);})[_0x42c5('0x17')](function(_0x19bb6f){logger[_0x42c5('0x4f')](_0x19bb6f);_0xed290(null,![]);});};AGIVertices[_0x42c5('0x12')]['agentLogout']=function(_0x2ce9ae,_0x3b6b6f){var _0x27dd64={'role':_0x42c5('0x4e')};_0x27dd64[_0x2ce9ae]=this[_0x42c5('0xf')][_0x42c5('0x38')];this[_0x42c5('0x10')][_0x42c5('0x51')](_0x27dd64)[_0x42c5('0x15')](function(_0xd17953){_0x3b6b6f(null,_[_0x42c5('0x40')](_0xd17953)?![]:!![]);})[_0x42c5('0x17')](function(_0x17a0d9){logger[_0x42c5('0x4f')](_0x17a0d9);_0x3b6b6f(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x41dc2d,_0x217db6){var _0x3973d7={'role':'agent'};_0x3973d7[_0x41dc2d]=this[_0x42c5('0xf')][_0x42c5('0x38')];var _0x23f7e2=_0x41dc2d!='internal'?util[_0x42c5('0x27')](_0x42c5('0x52'),'LOCAL',this[_0x42c5('0xf')]['callerid']):undefined;this[_0x42c5('0x10')]['agentLogin'](_0x3973d7,_0x23f7e2)[_0x42c5('0x15')](function(_0x25caa5){_0x217db6(null,_['isNil'](_0x25caa5)?![]:!![]);})['catch'](function(_0x1f2122){logger[_0x42c5('0x4f')](_0x1f2122);_0x217db6(null,![]);});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x53')]=function(_0x38429e,_0x5df2c3){sh[_0x42c5('0x54')](_[_0x42c5('0x55')](_0x38429e),function(_0x19e20b,_0x370f0b){var _0x3877da=_0x370f0b['replace'](/(\r\n|\n|\r)/gm,'');_0x5df2c3(null,_0x3877da);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x4f3cc8,_0x322542){scripts[_0x42c5('0x56')](_0x4f3cc8[_0x42c5('0x57')],_0x4f3cc8[_0x42c5('0x58')]||_0x42c5('0x59'),_0x4f3cc8[_0x42c5('0x59')],_0x4f3cc8[_0x42c5('0x5a')]||_0x42c5('0x5b'),_0x4f3cc8['ssmlGender']||_0x42c5('0x5c'),_0x4f3cc8[_0x42c5('0x5d')]||_0x42c5('0x5e'))[_0x42c5('0x15')](function(_0x4c83ec){_0x322542(null,_0x4c83ec);})[_0x42c5('0x17')](function(_0x33a2d1){_0x322542(_0x33a2d1);});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x5f')]=function(_0x340e7,_0x4b23a5){scripts[_0x42c5('0x5f')](_0x340e7['text'],_0x340e7[_0x42c5('0x60')]||'en',0x1)[_0x42c5('0x15')](function(_0x1406a5){_0x4b23a5(null,_0x1406a5);})[_0x42c5('0x17')](function(_0x4da8d8){_0x4b23a5(_0x4da8d8);});};AGIVertices['prototype'][_0x42c5('0x61')]=function(_0x540ff6,_0x515d05){var _0x5279c1={'uri':_0x540ff6[_0x42c5('0x62')],'method':_0x540ff6[_0x42c5('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x540ff6[_0x42c5('0x64')])===_0x42c5('0x65')&&parseInt(_0x540ff6[_0x42c5('0x64')])>=0x1?parseInt(_0x540ff6['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x42c5('0x66')]([_0x42c5('0x67'),_0x42c5('0x68')],_0x5279c1[_0x42c5('0x63')][_0x42c5('0x69')]())){try{_0x5279c1[_0x42c5('0x6a')]=_0x540ff6[_0x42c5('0xb')]?JSON['parse'](_0x540ff6[_0x42c5('0xb')]):{};}catch(_0x31ad28){logger[_0x42c5('0x4f')](_0x42c5('0x6b'),_0x31ad28);}}try{_0x5279c1['headers']=_0x540ff6['rawHeaders']?JSON['parse'](_0x540ff6[_0x42c5('0xa')]):{};}catch(_0x22cc8c){logger['error'](_0x42c5('0x6c'),_0x22cc8c);}if(_0x540ff6['computedVariables']){try{var _0x409225=require(_0x540ff6['computedVariables'])[_0x42c5('0x6d')](this,_0x5279c1);_0x5279c1[_0x42c5('0x6e')]=Mustache[_0x42c5('0x6f')](_0x540ff6[_0x42c5('0x62')],_0x409225,{},['$$','$$']);if(_0x5279c1['headers']){_0x5279c1[_0x42c5('0x70')]=JSON[_0x42c5('0x71')](Mustache[_0x42c5('0x6f')](JSON[_0x42c5('0x72')](_0x5279c1['headers']),_0x409225,{},['$$','$$']));}if(_0x5279c1[_0x42c5('0x6a')]){_0x5279c1['body']=JSON['parse'](Mustache[_0x42c5('0x6f')](JSON['stringify'](_0x5279c1[_0x42c5('0x6a')]),_0x409225,{},['$$','$$']));}}catch(_0xc9ff20){logger[_0x42c5('0x4f')](_0x42c5('0x73'),_0xc9ff20);}}rp(_0x5279c1)['then'](function(_0x221fc9){var _0x1fa9e4={'statusCode':_0x221fc9[_0x42c5('0x74')]||0xc8,'statusMessage':_0x221fc9[_0x42c5('0x75')]||'OK','headers':_0x221fc9['headers']||{},'body':_0x221fc9['body']||{}};_0x515d05(null,_0x1fa9e4);})[_0x42c5('0x17')](function(_0x1336ff){var _0xa18694={'statusCode':_0x1336ff[_0x42c5('0x74')]||0x1f4,'statusMessage':_0x1336ff[_0x42c5('0x76')]||_0x42c5('0x77'),'headers':_0x1336ff[_0x42c5('0x78')]['headers']||{},'body':_0x1336ff[_0x42c5('0x78')]['body']||{}};_0x515d05(null,_0xa18694);});};AGIVertices[_0x42c5('0x12')]['googleDialogflow']=function(_0x1afe8e,_0x31ca80){scripts[_0x42c5('0x79')](this[_0x42c5('0xf')]['uniqueid'],_0x1afe8e['key'],_0x1afe8e[_0x42c5('0x59')],_0x1afe8e[_0x42c5('0x7a')]||'en')[_0x42c5('0x15')](function(_0x510df7){_0x31ca80(null,_0x510df7);})[_0x42c5('0x17')](function(_0x476ef4){_0x31ca80(_0x476ef4);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x2c3b6e,_0x3cc7e4){scripts[_0x42c5('0x7b')](this[_0x42c5('0xf')]['uniqueid'],_0x2c3b6e[_0x42c5('0x7c')],_0x2c3b6e[_0x42c5('0x7d')],_0x2c3b6e[_0x42c5('0x7e')],_0x2c3b6e[_0x42c5('0x59')],_0x2c3b6e['dialogflowV2_language']||'en')[_0x42c5('0x15')](function(_0x82d849){_0x3cc7e4(null,_0x82d849);})['catch'](function(_0x5a9a09){_0x3cc7e4(_0x5a9a09);});};AGIVertices[_0x42c5('0x12')]['sestekNDA']=function(_0x59bbeb,_0x21427c){scripts[_0x42c5('0x7f')](this[_0x42c5('0xf')],_0x59bbeb)[_0x42c5('0x15')](function(_0x3b85ee){_0x21427c(null,_0x3b85ee);})['catch'](function(_0xdf607d){_0x21427c(_0xdf607d);});};AGIVertices[_0x42c5('0x12')]['ispeechTTS']=function(_0x42a340,_0x2551b5){scripts[_0x42c5('0x80')](_0x42a340['key'],_0x42a340[_0x42c5('0x59')],_0x42a340[_0x42c5('0x81')]||_0x42c5('0x5b'),_0x42a340['speed'])['then'](function(_0x200bdc){_0x2551b5(null,_0x200bdc);})[_0x42c5('0x17')](function(_0x4e704c){_0x2551b5(_0x4e704c);});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x82')]=function(_0x11fcdc,_0x56f840,_0x5ea013){scripts['ispeechASR'](_0x56f840,_0x11fcdc[_0x42c5('0x83')],_0x11fcdc['ispeech_asr_language']||_0x42c5('0x5b'),this[_0x42c5('0x84')](_0x11fcdc[_0x42c5('0x85')])?_0x11fcdc[_0x42c5('0x85')]:undefined)['then'](function(_0x31ed24){_0x5ea013(null,_0x31ed24);})[_0x42c5('0x17')](function(_0x10fe57){_0x5ea013(_0x10fe57);});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x86')]=function(_0x5899a8,_0x2cd563){scripts[_0x42c5('0x86')](_0x5899a8[_0x42c5('0x87')],_0x5899a8[_0x42c5('0x88')],_0x5899a8[_0x42c5('0x89')],_0x5899a8['aws_polly_voice']||_0x42c5('0x8a'),_0x5899a8[_0x42c5('0x59')],_0x5899a8[_0x42c5('0x8b')]||_0x42c5('0x59'))['then'](function(_0x1ab396){_0x2cd563(null,_0x1ab396);})['catch'](function(_0x36c762){_0x2cd563(_0x36c762);});};AGIVertices['prototype']['awsLex']=function(_0x4c7e88,_0x48176e){scripts['awsLex'](this[_0x42c5('0xf')]['uniqueid'],_0x4c7e88[_0x42c5('0x87')],_0x4c7e88[_0x42c5('0x88')],_0x4c7e88[_0x42c5('0x8c')],_0x4c7e88[_0x42c5('0x59')],_0x4c7e88['aws_bot_name'])[_0x42c5('0x15')](function(_0x4fef84){_0x48176e(null,_0x4fef84);})[_0x42c5('0x17')](function(_0x370744){_0x48176e(_0x370744);});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x8d')]=function(_0x54ff6b,_0x300de7,_0x37767f){scripts['googleASR'](_0x300de7,_0x54ff6b[_0x42c5('0x83')],_0x54ff6b['google_asr_language']||_0x42c5('0x5b'))[_0x42c5('0x15')](function(_0x303969){_0x37767f(null,_0x303969);})[_0x42c5('0x17')](function(_0x36b7fb){_0x37767f(_0x36b7fb);});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x8e')]=function(_0x409299,_0x1a88fb,_0x1c3478){scripts[_0x42c5('0x8e')](_0x1a88fb,_0x409299[_0x42c5('0x8f')],_0x409299[_0x42c5('0x90')],_0x409299[_0x42c5('0x6e')])[_0x42c5('0x15')](function(_0x427ca7){_0x1c3478(null,_0x427ca7);})[_0x42c5('0x17')](function(_0xef2dfd){_0x1c3478(_0xef2dfd);});};AGIVertices[_0x42c5('0x12')][_0x42c5('0x91')]=function(_0x4fda3e){var _0x81e997=_[_0x42c5('0x66')](verticesWithRetry,_0x4fda3e[_0x42c5('0x35')])?_0x4fda3e:_['clone'](_0x4fda3e);for(var _0x1349ae in _0x81e997){if(_0x81e997[_0x42c5('0x92')](_0x1349ae)){if(_0x81e997[_0x1349ae]&&_[_0x42c5('0x93')](_0x81e997[_0x1349ae])){if(_['includes'](recursiveMapAttributes,_0x1349ae)){_0x81e997[_0x1349ae]=this[_0x42c5('0x94')](_0x81e997[_0x1349ae]);}else{_0x81e997[_0x1349ae]=this[_0x42c5('0x95')](_0x81e997[_0x1349ae]);}}}}return _0x81e997;};AGIVertices[_0x42c5('0x12')]['recursiveNodeIndex']=function(_0x15e565){for(var _0x541e09 in _0x15e565){if(_0x15e565[_0x42c5('0x92')](_0x541e09)){if(_[_0x42c5('0x96')](_0x15e565[_0x541e09])){this[_0x42c5('0x97')](_0x15e565[_0x541e09]);}else if(_['isArray'](_0x15e565[_0x541e09])){for(var _0x5e7c81=0x0;_0x5e7c81<_0x15e565[_0x541e09][_0x42c5('0x98')];_0x5e7c81++){this[_0x42c5('0x97')](_0x15e565[_0x541e09][_0x5e7c81]);}}else if(_[_0x42c5('0x93')](_0x15e565[_0x541e09])){_0x15e565[_0x541e09]=this[_0x42c5('0x95')](_0x15e565[_0x541e09]);}}}};AGIVertices[_0x42c5('0x12')]['saveRestApiResult']=function(_0x3dce9e,_0x388c4a){for(var _0x1b128b in _0x3dce9e){if(_0x3dce9e[_0x42c5('0x92')](_0x1b128b)){if(_[_0x42c5('0x96')](_0x3dce9e[_0x1b128b])){if(!_[_0x42c5('0x43')](_0x3dce9e[_0x1b128b])){this[_0x42c5('0x99')](_0x3dce9e[_0x1b128b],util[_0x42c5('0x27')](_0x42c5('0x9a'),_0x388c4a,_0x1b128b));}}else if(_[_0x42c5('0x9b')](_0x3dce9e[_0x1b128b])){for(var _0x3cda12=0x0;_0x3cda12<_0x3dce9e[_0x1b128b][_0x42c5('0x98')];_0x3cda12++){this['saveRestApiResult'](_0x3dce9e[_0x1b128b][_0x3cda12],util[_0x42c5('0x27')](_0x42c5('0x9a'),_0x388c4a,_0x1b128b+'['+_0x3cda12+']'));}}else{if(!_[_0x42c5('0x40')](_0x3dce9e[_0x1b128b])){this[_0x42c5('0xf')]['setVariable'](util['format'](_0x42c5('0x9a'),_0x388c4a,_0x1b128b),_0x3dce9e[_0x1b128b]);}}}}};AGIVertices['prototype'][_0x42c5('0x94')]=function(_0x5dbe70){try{var _0x7951f1=JSON[_0x42c5('0x71')](_0x5dbe70);this['recursiveNodeIndex'](_0x7951f1);return JSON[_0x42c5('0x72')](_0x7951f1);}catch(_0x3b2835){return this[_0x42c5('0x95')](_0x5dbe70);}};AGIVertices[_0x42c5('0x12')][_0x42c5('0x95')]=function(_0x1a920d){var _0x1dcd1f=_0x1a920d[_0x42c5('0x9c')]('{');for(var _0xaf385e=0x1;_0xaf385e<_0x1dcd1f[_0x42c5('0x98')];_0xaf385e+=0x1){var _0x6a5d6e=_0x1dcd1f[_0xaf385e]['split']('}');if(_0x6a5d6e[_0x42c5('0x98')]>0x1){_0x1a920d=_0x1a920d[_0x42c5('0x9d')]('{'+_0x6a5d6e[0x0]+'}',this[_0x42c5('0xf')][_0x42c5('0x13')](_0x6a5d6e[0x0])[_0x42c5('0x9e')]||_0x6a5d6e[0x0]);}}if(_0x1dcd1f[_0x42c5('0x98')]===0x1){return _0x1a920d[_0x42c5('0x49')]();}return this[_0x42c5('0x95')](_0x1a920d);};AGIVertices[_0x42c5('0x12')][_0x42c5('0x9f')]=function(_0x5c9d6c,_0x41e4b7){var _0x2e85bb=this[_0x42c5('0xf')][_0x42c5('0x13')](_0x5c9d6c);if(_0x2e85bb[_0x42c5('0xa0')]===-0x1){return _0x2e85bb;}logger[_0x42c5('0x2b')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x41e4b7,_0x2e85bb[_0x42c5('0x9e')]));return this['channel'][_0x42c5('0xa1')](_0x41e4b7,_0x2e85bb[_0x42c5('0x9e')]);};AGIVertices[_0x42c5('0x12')][_0x42c5('0x84')]=function(_0x301664){return _0x301664&&_0x301664!=='0'&&_0x301664!=='-1'&&_0x301664!=='';};AGIVertices[_0x42c5('0x12')][_0x42c5('0xa2')]=function(_0x64d616){this['createSquareDetailsReport'][_0x42c5('0x6d')](this,_0x64d616,'-');_0x64d616[_0x42c5('0xa3')]=_0x64d616[_0x42c5('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x42c5('0xa4')]=function(_0x47fa36){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0xa5'),_0x47fa36[_0x42c5('0x34')]));if(!this[_0x42c5('0x84')](_0x47fa36[_0x42c5('0x59')])){return this[_0x42c5('0xf')][_0x42c5('0xa6')](_0x42c5('0xa7'));}var _0x11c4e2='\x22'+_0x47fa36[_0x42c5('0x59')]+'\x22';if(this[_0x42c5('0x84')](_0x47fa36[_0x42c5('0x78')])){_0x11c4e2+=','+_0x47fa36[_0x42c5('0x78')];}var _0x1fa71e=this[_0x42c5('0xf')][_0x42c5('0x54')]('MRCPSynth',_0x11c4e2);if(_0x1fa71e['result']===-0x1){return _0x1fa71e;}return this[_0x42c5('0xf')]['noop'](util[_0x42c5('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x11c4e2));};AGIVertices[_0x42c5('0x12')][_0x42c5('0xa8')]=function(_0x4b4df2){logger[_0x42c5('0x2b')](util['format'](_0x42c5('0xa9'),_0x4b4df2[_0x42c5('0x34')]));if(!this['isConfigured'](_0x4b4df2['grammar'])){return this[_0x42c5('0xf')][_0x42c5('0xa6')](_0x42c5('0xaa'));}var _0x46bf1b=_0x4b4df2[_0x42c5('0xab')];if(this[_0x42c5('0x84')](_0x4b4df2[_0x42c5('0x78')])){_0x46bf1b+=','+_0x4b4df2[_0x42c5('0x78')];}var _0x55ecd7=this['channel'][_0x42c5('0x54')](_0x42c5('0xac'),_0x46bf1b);if(_0x55ecd7[_0x42c5('0xa0')]===-0x1){return _0x55ecd7;}var _0x10a2c2=this[_0x42c5('0x9f')](_0x42c5('0xad'),'MRCP_RECOG_CONFIDENCE');if(_0x10a2c2[_0x42c5('0xa0')]===-0x1){return _0x10a2c2;}var _0x3aa679=this[_0x42c5('0x9f')](_0x42c5('0xae'),_0x42c5('0xaf'));if(_0x3aa679[_0x42c5('0xa0')]===-0x1){return _0x3aa679;}var _0x3aab6d=this[_0x42c5('0x9f')]('RECOG_INSTANCE()',_0x42c5('0xb0'));if(_0x3aab6d['result']===-0x1){return _0x3aab6d;}return this[_0x42c5('0xf')]['noop'](util[_0x42c5('0x27')](_0x42c5('0xb1'),_0x46bf1b));};AGIVertices['prototype']['agi']=function(_0x10bdb5){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0xb2'),_0x10bdb5['label']));return this[_0x42c5('0xf')]['agi']([_0x10bdb5['command'],_0x10bdb5[_0x42c5('0xb3')]]);};AGIVertices[_0x42c5('0x12')]['answer']=function(_0x2f22fa){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x2f22fa[_0x42c5('0x34')]));if(this[_0x42c5('0x84')](_0x2f22fa['timeout'])){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0xb4'),_0x2f22fa[_0x42c5('0x64')]));var _0x3a9b85=this['channel'][_0x42c5('0xb5')](_0x2f22fa[_0x42c5('0x64')]);if(_0x3a9b85[_0x42c5('0xa0')]===-0x1){return _0x3a9b85;}}return this[_0x42c5('0xf')][_0x42c5('0xb6')]();};AGIVertices[_0x42c5('0x12')]['callback']=function(_0x3086f8){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0xb7'),_0x3086f8['label']));if(!this[_0x42c5('0x84')](_0x3086f8[_0x42c5('0x46')])){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x3086f8,'no\x20list\x20selected');}_0x3086f8[_0x42c5('0x47')]=moment();if(this[_0x42c5('0x84')](_0x3086f8[_0x42c5('0xb8')])){_0x3086f8[_0x42c5('0x47')]=moment()['add'](_0x3086f8['delay'],_0x42c5('0xb9'));}if(!this[_0x42c5('0x84')](_0x3086f8[_0x42c5('0x4a')])){_0x3086f8['callback_priority']=0x2;}this[_0x42c5('0xba')][_0x42c5('0x6d')](this,_0x3086f8);return this['channel'][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0xbb'),_0x3086f8[_0x42c5('0x45')],_0x3086f8[_0x42c5('0x46')],_0x3086f8[_0x42c5('0x47')]));};AGIVertices[_0x42c5('0x12')][_0x42c5('0xbc')]=function(_0x65fe4c){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0xbd'),_0x65fe4c[_0x42c5('0x34')]));var _0x3fcd58=this[_0x42c5('0xf')]['exec'](_0x65fe4c['application'],_0x65fe4c['options']);if(_0x3fcd58[_0x42c5('0xa0')]===-0x1){return _0x3fcd58;}return this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0xbe'),_0x65fe4c[_0x42c5('0xbf')],_0x65fe4c[_0x42c5('0x78')]));};AGIVertices[_0x42c5('0x12')][_0x42c5('0xc0')]=function(_0x21f894){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0xc1'),_0x21f894[_0x42c5('0x34')]));if(!this[_0x42c5('0x84')](_0x21f894[_0x42c5('0x59')])){return this[_0x42c5('0xf')][_0x42c5('0xa6')](_0x42c5('0xa7'));}var _0x4f849f='\x22'+_0x21f894[_0x42c5('0x59')]+'\x22';if(this[_0x42c5('0x84')](_0x21f894['options'])){_0x4f849f+=','+_0x21f894['options'];}var _0x1237dc=this[_0x42c5('0xf')][_0x42c5('0x54')](_0x42c5('0xc2'),_0x4f849f);if(_0x1237dc[_0x42c5('0xa0')]===-0x1){return _0x1237dc;}return this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0xc3'),_0x4f849f));};AGIVertices[_0x42c5('0x12')]['sestektts']=function(_0x15e577){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x15e577[_0x42c5('0x34')]));if(!this[_0x42c5('0x84')](_0x15e577[_0x42c5('0x59')])){return this['channel'][_0x42c5('0xa6')](_0x42c5('0xa7'));}var _0x284b3e='\x22'+_0x15e577[_0x42c5('0x59')]+'\x22';if(this['isConfigured'](_0x15e577[_0x42c5('0x78')])){_0x284b3e+=','+_0x15e577[_0x42c5('0x78')];}var _0x1d6b63=this[_0x42c5('0xf')][_0x42c5('0x54')](_0x42c5('0xc2'),_0x284b3e);if(_0x1d6b63[_0x42c5('0xa0')]===-0x1){return _0x1d6b63;}return this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x284b3e));};AGIVertices['prototype']['lumenvoxasr']=function(_0x29f479){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0xc4'),_0x29f479[_0x42c5('0x34')]));if(!this[_0x42c5('0x84')](_0x29f479[_0x42c5('0xab')])){return this[_0x42c5('0xf')]['noop'](_0x42c5('0xaa'));}var _0xb09743=_0x29f479[_0x42c5('0xab')];if(this[_0x42c5('0x84')](_0x29f479[_0x42c5('0x78')])){_0xb09743+=','+_0x29f479[_0x42c5('0x78')];}var _0x5aab70=this[_0x42c5('0xf')]['exec'](_0x42c5('0xac'),_0xb09743);if(_0x5aab70[_0x42c5('0xa0')]===-0x1){return _0x5aab70;}var _0x3e365a=this[_0x42c5('0x9f')]('RECOG_CONFIDENCE()',_0x42c5('0xc5'));if(_0x3e365a['result']===-0x1){return _0x3e365a;}var _0x5a043f=this[_0x42c5('0x9f')](_0x42c5('0xae'),_0x42c5('0xc6'));if(_0x5a043f[_0x42c5('0xa0')]===-0x1){return _0x5a043f;}var _0x2e202a=this[_0x42c5('0x9f')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x2e202a[_0x42c5('0xa0')]===-0x1){return _0x2e202a;}return this[_0x42c5('0xf')]['noop'](util[_0x42c5('0x27')](_0x42c5('0xb1'),_0xb09743));};AGIVertices[_0x42c5('0x12')][_0x42c5('0xc7')]=function(_0x493029){logger[_0x42c5('0x2b')](util['format'](_0x42c5('0xc8'),_0x493029['label']));if(!this[_0x42c5('0x84')](_0x493029[_0x42c5('0xab')])){return this['channel']['noop'](_0x42c5('0xaa'));}var _0x3f8195=_0x493029[_0x42c5('0xab')];if(this[_0x42c5('0x84')](_0x493029['options'])){_0x3f8195+=','+_0x493029[_0x42c5('0x78')];}var _0x150b1e=this[_0x42c5('0xf')][_0x42c5('0x54')]('MRCPRecog',_0x3f8195);if(_0x150b1e[_0x42c5('0xa0')]===-0x1){return _0x150b1e;}var _0x1b79b0=this[_0x42c5('0x9f')]('RECOG_CONFIDENCE()',_0x42c5('0xc9'));if(_0x1b79b0[_0x42c5('0xa0')]===-0x1){return _0x1b79b0;}var _0x5430f0=this[_0x42c5('0x9f')](_0x42c5('0xae'),_0x42c5('0xca'));if(_0x5430f0['result']===-0x1){return _0x5430f0;}var _0x243fab=this[_0x42c5('0x9f')](_0x42c5('0xcb'),_0x42c5('0xcc'));if(_0x243fab[_0x42c5('0xa0')]===-0x1){return _0x243fab;}return this['channel']['noop'](util[_0x42c5('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3f8195));};AGIVertices[_0x42c5('0x12')][_0x42c5('0xcd')]=function(_0x1e077d){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0xce'),_0x1e077d[_0x42c5('0x34')]));if(!this[_0x42c5('0x84')](_0x1e077d[_0x42c5('0xcf')])){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x1e077d,_0x42c5('0xd0'));}var _0x15710b=this[_0x42c5('0x19')][_0x42c5('0x6d')](this,_0x1e077d[_0x42c5('0xcf')]);if(!_0x15710b){return this[_0x42c5('0xf')]['error'](_0x1e077d,_0x42c5('0xd1'));}if(!this[_0x42c5('0x84')](_0x1e077d[_0x42c5('0x2a')])){return this['channel'][_0x42c5('0x4f')](_0x1e077d,_0x42c5('0xd2'));}var _0xeacbb3=_0x1e077d[_0x42c5('0x2a')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')]('query:\x20%s',_0xeacbb3));var _0x563a47=this[_0x42c5('0x28')][_0x42c5('0x6d')](this,_0x15710b,_0xeacbb3);this['createSquareDetailsReport'][_0x42c5('0x6d')](this,_0x1e077d,_0xeacbb3);if(!this[_0x42c5('0x84')](_0x1e077d[_0x42c5('0xd3')])){return this['channel'][_0x42c5('0xa6')](_0x42c5('0xd4'));}var _0x3f5639=this[_0x42c5('0x13')][_0x42c5('0x6d')](this,_0x1e077d[_0x42c5('0xd3')]);if(!_0x3f5639){return this['channel'][_0x42c5('0x4f')](_0x1e077d,_0x42c5('0xd5'));}var _0x21b396=this;_0x563a47[_0x42c5('0xd6')](function(_0x2c7a2f,_0x4e21a6){Object['keys'](_0x2c7a2f)['forEach'](function(_0x1f29b8){_0x21b396[_0x42c5('0xf')][_0x42c5('0xa1')](util[_0x42c5('0x27')]('%s[%s][%s]',_0x3f5639,_0x4e21a6,_0x1f29b8),_0x2c7a2f[_0x1f29b8]);});});this[_0x42c5('0xf')][_0x42c5('0xa1')](util[_0x42c5('0x27')](_0x42c5('0xd7'),_0x3f5639),_0x563a47[_0x42c5('0x98')]);return this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0xd8'),_0x3f5639));};AGIVertices['prototype'][_0x42c5('0xd9')]=function(_0x3a92c8){logger['debug'](util[_0x42c5('0x27')](_0x42c5('0xda'),_0x3a92c8[_0x42c5('0x34')]));if(!this[_0x42c5('0x84')](_0x3a92c8[_0x42c5('0xdb')])){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x3a92c8,'no\x20user\x20selected');}var _0x394de2=this[_0x42c5('0x1c')][_0x42c5('0x6d')](this,_0x3a92c8['sip_id']);if(!_0x394de2){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x3a92c8,_0x42c5('0xdc'));}var _0x584c8a=this['channel'][_0x42c5('0x54')]('DIAL',[util[_0x42c5('0x27')](_0x42c5('0xdd'),_0x394de2),_0x3a92c8[_0x42c5('0x64')],_0x3a92c8[_0x42c5('0xde')],_0x3a92c8[_0x42c5('0x62')]]);if(_0x584c8a[_0x42c5('0xa0')]===-0x1){return _0x584c8a;}return this['channel'][_0x42c5('0xa6')](util['format'](_0x42c5('0xdf'),_0x42c5('0xe0')));};AGIVertices[_0x42c5('0x12')][_0x42c5('0xe1')]=function(_0x5af68e){logger['info'](util[_0x42c5('0x27')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x5af68e['label']));if(!this['isConfigured'](_0x5af68e['key'])){return this[_0x42c5('0xf')][_0x42c5('0xa6')]('no\x20key\x20configured');}if(!this[_0x42c5('0x84')](_0x5af68e[_0x42c5('0x59')])){return this[_0x42c5('0xf')][_0x42c5('0xa6')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x42c5('0x33')](_0x5af68e);this[_0x42c5('0xe2')](_0x5af68e[_0x42c5('0x59')],'in','','');this['channel'][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0xe3'),_0x5af68e['text']));var _0x3aa43c=this[_0x42c5('0x79')][_0x42c5('0x6d')](this,_0x5af68e);if(_0x3aa43c){for(var _0x2d6a61 in _0x3aa43c){if(_0x3aa43c['hasOwnProperty'](_0x2d6a61)){this['channel'][_0x42c5('0xa1')](util[_0x42c5('0x27')](_0x42c5('0xe4'),_0x2d6a61[_0x42c5('0x69')]()),_0x3aa43c[_0x2d6a61]);}}this[_0x42c5('0xe2')](_0x3aa43c['speech'],'out','dialogflow','');return this[_0x42c5('0xf')][_0x42c5('0xa6')](util['format'](_0x42c5('0xe5'),_0x3aa43c[_0x42c5('0xe6')]));}return this['channel'][_0x42c5('0x4f')](_0x5af68e,_0x42c5('0xe7'));};AGIVertices['prototype'][_0x42c5('0xe8')]=function(_0x993cee){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0xe9'),_0x993cee[_0x42c5('0x34')]));if(!this[_0x42c5('0x84')](_0x993cee[_0x42c5('0x7c')])){return this[_0x42c5('0xf')][_0x42c5('0xa6')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x993cee[_0x42c5('0x7d')])){return this[_0x42c5('0xf')][_0x42c5('0xa6')](_0x42c5('0xea'));}if(!this[_0x42c5('0x84')](_0x993cee[_0x42c5('0x7e')])){return this[_0x42c5('0xf')]['noop']('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x993cee[_0x42c5('0xeb')])){return this[_0x42c5('0xf')]['noop'](_0x42c5('0xec'));}if(!this[_0x42c5('0x84')](_0x993cee['text'])){return this['channel'][_0x42c5('0xa6')](_0x42c5('0xa7'));}this[_0x42c5('0xf')][_0x42c5('0xed')]=!![];this[_0x42c5('0x33')](_0x993cee);this[_0x42c5('0xe2')](_0x993cee['text'],'in','','');this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')]('Trying\x20DialogflowV2:\x20%s',_0x993cee[_0x42c5('0x59')]));var _0xff0a6b=this[_0x42c5('0x7b')]['sync'](this,_0x993cee);if(_0xff0a6b){for(var _0x4b854a in _0xff0a6b){if(_0xff0a6b[_0x42c5('0x92')](_0x4b854a)){if(_0x4b854a!==_0x42c5('0xee')){this[_0x42c5('0xf')]['setVariable'](util[_0x42c5('0x27')]('DIALOGFLOW_%s',_0x4b854a[_0x42c5('0x69')]()),_0xff0a6b[_0x4b854a]);}}}this[_0x42c5('0xe2')](_0xff0a6b['speech'],_0x42c5('0xef'),_0x42c5('0xe8'),_0xff0a6b['providerResponse']);return this['channel'][_0x42c5('0xa6')](util['format']('DialogflowV2\x20Result\x20%s',_0xff0a6b['speech']));}return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x993cee,_0x42c5('0xf0'));};AGIVertices['prototype'][_0x42c5('0xf1')]=function(_0x4181b2){logger[_0x42c5('0x2b')](util['format'](_0x42c5('0xf2'),_0x4181b2[_0x42c5('0x34')]));if(!this[_0x42c5('0x84')](_0x4181b2['ndauth_url'])){return this[_0x42c5('0xf')][_0x42c5('0xa6')](_0x42c5('0xf3'));}if(!this[_0x42c5('0x84')](_0x4181b2['username'])){return this[_0x42c5('0xf')][_0x42c5('0xa6')](_0x42c5('0xf4'));}if(!this[_0x42c5('0x84')](_0x4181b2['password'])){return this[_0x42c5('0xf')]['noop']('no\x20password\x20configured');}if(!this[_0x42c5('0x84')](_0x4181b2[_0x42c5('0xf5')])){return this['channel'][_0x42c5('0xa6')](_0x42c5('0xa7'));}this[_0x42c5('0xf')]['bot']=!![];this['createSquareDetailsReport'](_0x4181b2);this[_0x42c5('0xe2')](_0x4181b2[_0x42c5('0x59')],'in','','');this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0xf6'),_0x4181b2['text']));var _0xbdccd0=this['sestekNDA'][_0x42c5('0x6d')](this,_0x4181b2);if(_0xbdccd0){for(var _0x281bd8 in _0xbdccd0){if(_0xbdccd0[_0x42c5('0x92')](_0x281bd8)){this[_0x42c5('0xf')][_0x42c5('0xa1')](util[_0x42c5('0x27')](_0x42c5('0xf7'),_0x281bd8[_0x42c5('0x69')]()),_0xbdccd0[_0x281bd8]);}}this[_0x42c5('0xe2')](_0xbdccd0[_0x42c5('0xe6')],_0x42c5('0xef'),_0x42c5('0xf1'),'');if(_0xbdccd0[_0x42c5('0xf8')]){this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')]('Sestek\x20NDA\x20%s\x20file\x20created',_0xbdccd0[_0x42c5('0xf8')]));var _0x294f75=this[_0x42c5('0xf')][_0x42c5('0xf9')](_0xbdccd0['audiofile']);try{fs[_0x42c5('0xfa')](_0xbdccd0[_0x42c5('0xf8')]+_0x42c5('0xfb'));}catch(_0x1a35aa){logger[_0x42c5('0x4f')](_0x1a35aa);}return _0x294f75;}else{return this[_0x42c5('0xf')]['noop'](util[_0x42c5('0x27')](_0x42c5('0xfc'),_0xbdccd0[_0x42c5('0xe6')]));}}return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x4181b2,_0x42c5('0xfd'));};AGIVertices[_0x42c5('0x12')][_0x42c5('0xfe')]=function(_0x200317){logger[_0x42c5('0x2b')](util['format'](_0x42c5('0xff'),_0x200317['label']));return this['channel'][_0x42c5('0xa6')](_0x42c5('0xfe'));};AGIVertices[_0x42c5('0x12')][_0x42c5('0x100')]=function(_0x400d14){logger['info'](util[_0x42c5('0x27')](_0x42c5('0x101'),_0x400d14[_0x42c5('0x34')]));var _0x479b72='';if(_0x400d14[_0x42c5('0x102')]){if(!this[_0x42c5('0x84')](_0x400d14[_0x42c5('0x102')])){return this['channel'][_0x42c5('0x4f')](_0x400d14,_0x42c5('0x103'));}else{var _0x17c5f6=parseInt(_0x400d14[_0x42c5('0x102')],0xa);if(isNaN(_0x17c5f6)){_0x479b72=_0x400d14[_0x42c5('0x102')];}else{_0x479b72=this[_0x42c5('0x104')][_0x42c5('0x6d')](this,_0x400d14[_0x42c5('0x102')]);if(!_0x479b72){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x400d14,_0x42c5('0x105'));}}}}else if(_0x400d14[_0x42c5('0x106')]){_0x479b72=_0x400d14[_0x42c5('0x106')];}else{return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x400d14,_0x42c5('0x103'));}var _0x3fe881=this['channel'][_0x42c5('0x54')](_0x42c5('0xe0'),[util[_0x42c5('0x27')](_0x42c5('0x107'),_0x479b72,_0x400d14['phone']),_0x400d14['timeout'],_0x400d14[_0x42c5('0xde')],_0x400d14['url']]);if(_0x3fe881[_0x42c5('0xa0')]===-0x1){return _0x3fe881;}return this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0xdf'),_0x42c5('0xe0')));};AGIVertices[_0x42c5('0x12')][_0x42c5('0x108')]=function(_0x200983){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0x109'),_0x200983['label']));return this['channel']['noop'](_0x42c5('0x108'));};AGIVertices[_0x42c5('0x12')][_0x42c5('0xd')]=function(_0x11d4f1){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x11d4f1['label']));if(_0x11d4f1['retry']===0x0){return this['maxRetry'](_0x11d4f1);}_0x11d4f1[_0x42c5('0xa3')]-=0x1;if(!this[_0x42c5('0x84')](_0x11d4f1[_0x42c5('0x10a')])){return this['channel'][_0x42c5('0x4f')](_0x11d4f1,_0x42c5('0x10b'));}var _0x8d0db0=this['getSound'][_0x42c5('0x6d')](this,_0x11d4f1[_0x42c5('0x10a')]);if(!_0x8d0db0){return this['channel'][_0x42c5('0x4f')](_0x11d4f1,_0x42c5('0x10c'));}if(!this['isConfigured'](_0x11d4f1[_0x42c5('0xd3')])){return this[_0x42c5('0xf')]['error'](_0x42c5('0xd4'));}var _0x22f4d7=this[_0x42c5('0xf')][_0x42c5('0x10d')](_0x8d0db0,_0x11d4f1['response'],_0x11d4f1[_0x42c5('0x10e')]);var _0x2d8b43=_0x22f4d7[_0x42c5('0xa0')]?_0x22f4d7[_0x42c5('0xa0')][_0x42c5('0x49')]():'';logger[_0x42c5('0x2b')](_0x42c5('0x10f'),JSON[_0x42c5('0x72')](_0x22f4d7));if(_0x22f4d7[_0x42c5('0xa0')]===-0x1){this[_0x42c5('0x33')]['sync'](this,_0x11d4f1,_0x2d8b43);return _0x22f4d7;}else if(_0x22f4d7[_0x42c5('0x9e')]==='timeout'){_0x22f4d7[_0x42c5('0xa0')]=_0x2d8b43[_0x42c5('0x98')]>=parseInt(_0x11d4f1[_0x42c5('0x110')])?'x':'i';}else{_0x22f4d7[_0x42c5('0xa0')]=_0x2d8b43[_0x42c5('0x98')]>=parseInt(_0x11d4f1[_0x42c5('0x110')])&&_0x2d8b43[_0x42c5('0x98')]<=parseInt(_0x11d4f1[_0x42c5('0x10e')])?'x':'i';}var _0x33dee6=this[_0x42c5('0x13')][_0x42c5('0x6d')](this,_0x11d4f1[_0x42c5('0xd3')]);if(!_0x33dee6){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x11d4f1,_0x42c5('0xd5'));}this[_0x42c5('0xf')][_0x42c5('0xa1')](_0x33dee6,_0x2d8b43);if(this[_0x42c5('0x84')](_0x11d4f1[_0x42c5('0x111')])){var _0x36a335=parseInt(_0x11d4f1[_0x42c5('0x111')],0xa);var _0x108c62=rs[_0x42c5('0x112')]({'charset':'*','length':_0x36a335});var _0x1fa87d=_0x2d8b43['length'];if(_0x1fa87d>0x0){if(_0x1fa87d>_0x36a335){this[_0x42c5('0x33')][_0x42c5('0x6d')](this,_0x11d4f1,_0x11d4f1[_0x42c5('0x113')]===_0x42c5('0x114')?_0x108c62+_0x2d8b43[_0x42c5('0x115')](_0x36a335):_0x2d8b43[_0x42c5('0x115')](0x0,_0x1fa87d-_0x36a335)+_0x108c62);}else{this[_0x42c5('0x33')][_0x42c5('0x6d')](this,_0x11d4f1,rs[_0x42c5('0x112')]({'charset':'*','length':_0x1fa87d}));}}else{this[_0x42c5('0x33')][_0x42c5('0x6d')](this,_0x11d4f1,'');}}else{this['createSquareDetailsReport'][_0x42c5('0x6d')](this,_0x11d4f1,_0x2d8b43);}return _0x22f4d7;};AGIVertices[_0x42c5('0x12')][_0x42c5('0xe')]=function(_0x255345){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x255345['label']));return this[_0x42c5('0xd')](_0x255345);};AGIVertices[_0x42c5('0x12')][_0x42c5('0x116')]=function(_0x4cf756){logger['info'](util[_0x42c5('0x27')](_0x42c5('0x117'),_0x4cf756[_0x42c5('0x34')]));this[_0x42c5('0x33')]['sync'](this,_0x4cf756,_0x4cf756[_0x42c5('0x118')]);return this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0x119'),_0x4cf756[_0x42c5('0x118')]));};AGIVertices[_0x42c5('0x12')][_0x42c5('0x11a')]=function(_0x5bf7bb){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0x11b'),_0x5bf7bb[_0x42c5('0x34')]));if(!this[_0x42c5('0x84')](_0x5bf7bb[_0x42c5('0x87')])||!this[_0x42c5('0x84')](_0x5bf7bb['aws_secret_access_key'])){return this[_0x42c5('0xf')][_0x42c5('0xa6')](_0x42c5('0x11c'));}if(!this[_0x42c5('0x84')](_0x5bf7bb[_0x42c5('0x59')])){return this[_0x42c5('0xf')][_0x42c5('0xa6')]('no\x20text\x20configured');}this['channel'][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0x11d'),_0x5bf7bb[_0x42c5('0x59')]));var _0x44ac59=this[_0x42c5('0x86')][_0x42c5('0x6d')](this,_0x5bf7bb);if(_0x44ac59){this[_0x42c5('0xf')]['noop'](util[_0x42c5('0x27')](_0x42c5('0x11e'),_0x44ac59));var _0x3ea9a0=this[_0x42c5('0xf')][_0x42c5('0xf9')](_0x44ac59);try{fs[_0x42c5('0xfa')](_0x44ac59+_0x42c5('0xfb'));}catch(_0x363693){logger['error'](_0x363693);}return _0x3ea9a0;}return this[_0x42c5('0xf')]['error'](_0x5bf7bb,_0x42c5('0x11f'));};AGIVertices['prototype'][_0x42c5('0x120')]=function(_0x4afd24){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x4afd24[_0x42c5('0x34')]));if(!this[_0x42c5('0x84')](_0x4afd24[_0x42c5('0x87')])||!this[_0x42c5('0x84')](_0x4afd24['aws_secret_access_key'])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x42c5('0x84')](_0x4afd24[_0x42c5('0x121')])){return this['channel'][_0x42c5('0xa6')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x4afd24['text'])){return this['channel'][_0x42c5('0xa6')](_0x42c5('0xa7'));}this['channel'][_0x42c5('0xed')]=!![];this[_0x42c5('0x33')](_0x4afd24);this[_0x42c5('0xe2')](_0x4afd24[_0x42c5('0x59')],'in','','');this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0x122'),_0x4afd24['text']));var _0x500a78=this[_0x42c5('0x123')][_0x42c5('0x6d')](this,_0x4afd24);if(_0x500a78){for(var _0x816c76 in _0x500a78){if(_0x500a78['hasOwnProperty'](_0x816c76)&&_['isString'](_0x500a78[_0x816c76])){this[_0x42c5('0xf')][_0x42c5('0xa1')](util[_0x42c5('0x27')](_0x42c5('0x124'),_0x816c76[_0x42c5('0x69')]()),_0x500a78[_0x816c76]);}}if(_[_0x42c5('0x40')](_0x500a78['message'])){return this[_0x42c5('0xf')][_0x42c5('0xa6')](_0x42c5('0x125'));}else{this[_0x42c5('0xe2')](_0x500a78[_0x42c5('0x76')],_0x42c5('0xef'),'amazonlex','');return this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0x126'),_0x500a78['message']));}}return this['channel'][_0x42c5('0x4f')](_0x4afd24,_0x42c5('0x127'));};AGIVertices['prototype'][_0x42c5('0x128')]=function(_0xc9c530){logger['info'](util['format'](_0x42c5('0x129'),_0xc9c530['label'],_0xc9c530[_0x42c5('0x64')]));if(!this[_0x42c5('0x84')](_0xc9c530['key'])){return this[_0x42c5('0xf')][_0x42c5('0xa6')](_0x42c5('0x12a'));}var _0x2cb800=_0x42c5('0x12b');var _0x1de79=util[_0x42c5('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0x42c5('0x112')](0x4));var _0xf53f5a=util[_0x42c5('0x27')](_0x42c5('0x9a'),_0x1de79,_0x2cb800);var _0x46753e=!![];if(_0xc9c530[_0x42c5('0x12c')]===_0x42c5('0x12d')){_0x46753e=![];}var _0x437c2f=this[_0x42c5('0xf')][_0x42c5('0x12e')](_0x1de79,_0x2cb800,_0xc9c530[_0x42c5('0x12f')],_0xc9c530[_0x42c5('0x64')],undefined,_0x46753e);if(_0x437c2f[_0x42c5('0xa0')]!==-0x1){this['channel']['noop'](util[_0x42c5('0x27')](_0x42c5('0x130'),_0xf53f5a));var _0x5a465b=this[_0x42c5('0x8d')]['sync'](this,_0xc9c530,_0xf53f5a);if(_0x5a465b){for(var _0x5cf4cc in _0x5a465b){if(_0x5a465b[_0x42c5('0x92')](_0x5cf4cc)){this[_0x42c5('0xf')][_0x42c5('0xa1')](util['format'](_0x42c5('0x131'),_0x5cf4cc[_0x42c5('0x69')]()),_0x5a465b[_0x5cf4cc]);}}return this[_0x42c5('0xf')][_0x42c5('0xa6')](util['format']('GoogleASR\x20Result\x20%s',JSON[_0x42c5('0x72')](_0x5a465b)));}}return _0x437c2f;};AGIVertices[_0x42c5('0x12')][_0x42c5('0x132')]=function(_0x45e313){logger['info'](util['format'](_0x42c5('0x133'),_0x45e313[_0x42c5('0x34')]));if(!this[_0x42c5('0x84')](_0x45e313[_0x42c5('0x8f')])){return this['channel'][_0x42c5('0xa6')](_0x42c5('0x134'));}if(!this[_0x42c5('0x84')](_0x45e313[_0x42c5('0x90')])){return this['channel'][_0x42c5('0xa6')]('no\x20appsecret\x20configured');}var _0x11c7ee=_0x42c5('0x12b');var _0x220f40=util[_0x42c5('0x27')](_0x42c5('0x135'),FILES_PATH,rs[_0x42c5('0x112')](0x4));var _0x84fc4b=util[_0x42c5('0x27')]('%s.%s',_0x220f40,_0x11c7ee);var _0x3f20f6=!![];if(_0x45e313['beep']==='NOBEEP'){_0x3f20f6=![];}var _0x55065b=this['channel'][_0x42c5('0x12e')](_0x220f40,_0x11c7ee,_0x45e313[_0x42c5('0x12f')],_0x45e313[_0x42c5('0x64')],undefined,_0x3f20f6);if(_0x55065b[_0x42c5('0xa0')]!==-0x1){this['channel'][_0x42c5('0xa6')](util[_0x42c5('0x27')]('tilde\x20%s\x20file\x20created',_0x84fc4b));var _0x1a0dc9=this[_0x42c5('0x8e')]['sync'](this,_0x45e313,_0x84fc4b);if(_0x1a0dc9){for(var _0x483fbb in _0x1a0dc9){if(_0x1a0dc9[_0x42c5('0x92')](_0x483fbb)){this['channel'][_0x42c5('0xa1')](util[_0x42c5('0x27')]('TILDE_ASR_%s',_0x483fbb[_0x42c5('0x69')]()),_0x1a0dc9[_0x483fbb]);}}return this[_0x42c5('0xf')]['noop'](util[_0x42c5('0x27')](_0x42c5('0x136'),JSON[_0x42c5('0x72')](_0x1a0dc9)));}}return _0x55065b;};AGIVertices[_0x42c5('0x12')][_0x42c5('0x137')]=function(_0x183860){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0x138'),_0x183860[_0x42c5('0x34')]));return this[_0x42c5('0xf')][_0x42c5('0x139')](_0x183860['context'],_0x183860[_0x42c5('0x3b')],_0x183860[_0x42c5('0x3c')]);};AGIVertices[_0x42c5('0x12')][_0x42c5('0x13a')]=function(_0xddbdec){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0x13b'),_0xddbdec[_0x42c5('0x34')]));if(!this[_0x42c5('0x84')](_0xddbdec[_0x42c5('0x13c')])){return this['channel']['error'](_0xddbdec,'no\x20condition\x20configured');}try{var _0x59ca96=eval(_0xddbdec[_0x42c5('0x13c')])?_0x42c5('0x13d'):_0x42c5('0x13e');this[_0x42c5('0xf')]['noop'](util['format'](_0x42c5('0x13f'),_0xddbdec[_0x42c5('0x13c')],_0x59ca96));return{'code':0xc8,'result':_0x59ca96};}catch(_0x176ced){return{'code':0xc8,'result':_0x42c5('0x13e')};}};AGIVertices[_0x42c5('0x12')][_0x42c5('0x140')]=function(_0x717a4d){logger[_0x42c5('0x2b')](util['format'](_0x42c5('0x141'),_0x717a4d['label']));if(!this[_0x42c5('0x84')](_0x717a4d[_0x42c5('0x142')])){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x717a4d,_0x42c5('0x143'));}var _0x568637=this[_0x42c5('0x23')]['sync'](this,_0x717a4d['interval_id']);if(!_0x568637){return this[_0x42c5('0xf')]['error'](_0x717a4d,_0x42c5('0x144'));}for(var _0x3a6b1e=0x0;_0x3a6b1e<_0x568637['length'];_0x3a6b1e+=0x1){var _0x510ebd=this['channel'][_0x42c5('0x13')](util[_0x42c5('0x27')](_0x42c5('0x145'),_0x568637[_0x3a6b1e]));if(_0x510ebd[_0x42c5('0xa0')]===-0x1){return _0x510ebd;}logger[_0x42c5('0x2b')](util['format'](_0x42c5('0x146'),_0x568637[_0x3a6b1e],_0x510ebd[_0x42c5('0x9e')]));if(_0x510ebd[_0x42c5('0x9e')]==='true'){logger[_0x42c5('0x2b')](util['format'](_0x42c5('0x146'),_0x568637[_0x3a6b1e],_0x42c5('0x13d')));this['channel'][_0x42c5('0xa6')](util['format'](_0x42c5('0x146'),_0x568637[_0x3a6b1e],_0x42c5('0x13d')));return{'code':0xc8,'result':_0x42c5('0x13d')};}else{logger['info'](util[_0x42c5('0x27')]('IFTIME\x20%s\x20%s',_0x568637[_0x3a6b1e],_0x42c5('0x13e')));this['channel'][_0x42c5('0xa6')](util['format'](_0x42c5('0x146'),_0x568637[_0x3a6b1e],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x42c5('0x12')][_0x42c5('0x147')]=function(_0x4134fc){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0x148'),_0x4134fc[_0x42c5('0x34')]));return this[_0x42c5('0xf')][_0x42c5('0x147')]();};AGIVertices[_0x42c5('0x12')][_0x42c5('0x149')]=function(_0x3ae26f){logger[_0x42c5('0x2b')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x3ae26f['label']));if(!this[_0x42c5('0x84')](_0x3ae26f[_0x42c5('0x83')])){return this[_0x42c5('0xf')][_0x42c5('0xa6')](_0x42c5('0x12a'));}var _0x52ce39=_0x42c5('0x12b');var _0x3777d8=util[_0x42c5('0x27')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x2ef8c0=util[_0x42c5('0x27')](_0x42c5('0x9a'),_0x3777d8,_0x52ce39);var _0x322135=!![];if(_0x3ae26f[_0x42c5('0x12c')]===_0x42c5('0x12d')){_0x322135=![];}var _0x2918e5=this['channel'][_0x42c5('0x12e')](_0x3777d8,_0x52ce39,_0x3ae26f[_0x42c5('0x12f')],_0x3ae26f[_0x42c5('0x64')],undefined,_0x322135);if(_0x2918e5[_0x42c5('0xa0')]!==-0x1){this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0x14a'),_0x2ef8c0));var _0x3823c8=this[_0x42c5('0x82')][_0x42c5('0x6d')](this,_0x3ae26f,_0x2ef8c0);if(_0x3823c8){for(var _0x181b34 in _0x3823c8){if(_0x3823c8[_0x42c5('0x92')](_0x181b34)){this[_0x42c5('0xf')]['setVariable'](util['format']('ISPEECH_ASR_%s',_0x181b34['toUpperCase']()),_0x3823c8[_0x181b34]);}}return this['channel'][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0x14b'),JSON[_0x42c5('0x72')](_0x3823c8)));}}return _0x2918e5;};AGIVertices[_0x42c5('0x12')][_0x42c5('0x14c')]=function(_0x2a5eda){logger[_0x42c5('0x2b')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x2a5eda[_0x42c5('0x34')]));if(!this[_0x42c5('0x84')](_0x2a5eda[_0x42c5('0x83')])){return this['channel'][_0x42c5('0xa6')](_0x42c5('0x12a'));}if(!this['isConfigured'](_0x2a5eda[_0x42c5('0x59')])){return this['channel'][_0x42c5('0xa6')]('no\x20text\x20configured');}this['channel'][_0x42c5('0xa6')](util[_0x42c5('0x27')]('Trying\x20ispeech\x20TTS\x20%s',_0x2a5eda['text']));var _0x29f352=this[_0x42c5('0x80')]['sync'](this,_0x2a5eda);if(_0x29f352){this[_0x42c5('0xf')]['noop'](util['format'](_0x42c5('0x14a'),_0x29f352));var _0x220d7f=this['channel'][_0x42c5('0xf9')](_0x29f352,_0x2a5eda[_0x42c5('0x12f')]);try{fs['unlink'](_0x29f352+_0x42c5('0xfb'));}catch(_0x34684c){logger['error'](_0x34684c);}return _0x220d7f;}return this['channel'][_0x42c5('0x4f')](_0x2a5eda,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x42c5('0x14d')]=function(_0x229b60){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0x14e'),_0x229b60[_0x42c5('0x34')]));if(!this[_0x42c5('0x84')](_0x229b60[_0x42c5('0x14f')])){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x229b60,_0x42c5('0x150'));}logger['info'](util['format'](_0x42c5('0x151'),this['channel'][_0x42c5('0x38')],_0x229b60[_0x42c5('0x14f')]));var _0x4db901=this['agentLogin'][_0x42c5('0x6d')](this,_0x229b60[_0x42c5('0x14f')]);if(_0x4db901){logger[_0x42c5('0x2b')](util['format'](_0x42c5('0x152'),this[_0x42c5('0xf')][_0x42c5('0x38')],_0x229b60[_0x42c5('0x14f')]));this[_0x42c5('0xf')]['noop'](util['format'](_0x42c5('0x152'),this['channel'][_0x42c5('0x38')],_0x229b60['findBy']));return{'code':0xc8,'result':_0x42c5('0x153')};}else{logger[_0x42c5('0x2b')](util[_0x42c5('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x42c5('0x38')],_0x229b60[_0x42c5('0x14f')]));this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0x154'),this[_0x42c5('0xf')][_0x42c5('0x38')],_0x229b60[_0x42c5('0x14f')]));return{'code':0xc8,'result':_0x42c5('0x155')};}};AGIVertices[_0x42c5('0x12')]['logout']=function(_0x3e0cf1){logger['info'](util[_0x42c5('0x27')](_0x42c5('0x156'),_0x3e0cf1[_0x42c5('0x34')]));if(!this[_0x42c5('0x84')](_0x3e0cf1[_0x42c5('0x14f')])){return this['channel'][_0x42c5('0x4f')](_0x3e0cf1,_0x42c5('0x150'));}logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0x151'),this[_0x42c5('0xf')][_0x42c5('0x38')],_0x3e0cf1['findBy']));var _0x44033b=this[_0x42c5('0x51')][_0x42c5('0x6d')](this,_0x3e0cf1[_0x42c5('0x14f')]);if(_0x44033b){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x42c5('0xf')][_0x42c5('0x38')],_0x3e0cf1[_0x42c5('0x14f')]));this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x42c5('0xf')][_0x42c5('0x38')],_0x3e0cf1[_0x42c5('0x14f')]));return{'code':0xc8,'result':_0x42c5('0x153')};}else{logger[_0x42c5('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x42c5('0x38')],_0x3e0cf1[_0x42c5('0x14f')]));this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0x154'),this[_0x42c5('0xf')][_0x42c5('0x38')],_0x3e0cf1['findBy']));return{'code':0xc8,'result':_0x42c5('0x155')};}};AGIVertices['prototype'][_0x42c5('0x157')]=function(_0x3e2f04){logger[_0x42c5('0x2b')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x3e2f04[_0x42c5('0x34')]));if(!this[_0x42c5('0x84')](_0x3e2f04[_0x42c5('0x158')])){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x3e2f04,_0x42c5('0x159'));}this['channel']['noop'](util['format'](_0x42c5('0x15a'),_0x3e2f04[_0x42c5('0x158')]));var _0x36ad0e=eval(_0x3e2f04[_0x42c5('0x158')]);if(!this[_0x42c5('0x84')](_0x3e2f04[_0x42c5('0xd3')])){return this[_0x42c5('0xf')][_0x42c5('0xa6')](_0x42c5('0xd4'));}var _0x5aed38=this[_0x42c5('0x13')][_0x42c5('0x6d')](this,_0x3e2f04[_0x42c5('0xd3')]);if(!_0x5aed38){return this['channel'][_0x42c5('0x4f')](_0x3e2f04,'no\x20variable\x20found');}if(_['isArray'](_0x36ad0e)){var _0x44e507=this;_0x36ad0e[_0x42c5('0xd6')](function(_0xd307ca,_0x58368a){_0x44e507[_0x42c5('0xf')]['setVariable'](util[_0x42c5('0x27')](_0x42c5('0x15b'),_0x5aed38,_0x58368a),_0xd307ca);});return this['channel'][_0x42c5('0xa6')](util['format'](_0x42c5('0x15c'),_0x5aed38));}else{return this['channel'][_0x42c5('0xa1')](_0x5aed38,_0x36ad0e);}};AGIVertices[_0x42c5('0x12')]['menu']=function(_0x1e92ac){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0x15d'),_0x1e92ac['label']));if(_0x1e92ac[_0x42c5('0xa3')]===0x0){return this['maxRetry'](_0x1e92ac);}_0x1e92ac[_0x42c5('0xa3')]-=0x1;if(!this[_0x42c5('0x84')](_0x1e92ac[_0x42c5('0x10a')])){return this[_0x42c5('0xf')]['error'](_0x1e92ac,_0x42c5('0x10b'));}var _0xabc27c=this[_0x42c5('0x1e')][_0x42c5('0x6d')](this,_0x1e92ac[_0x42c5('0x10a')]);if(!_0xabc27c){return this[_0x42c5('0xf')]['error'](_0x1e92ac,_0x42c5('0x10c'));}var _0x4ac56f=this[_0x42c5('0xf')][_0x42c5('0x10d')](_0xabc27c,_0x1e92ac[_0x42c5('0x15e')],_0x1e92ac[_0x42c5('0x15f')]);var _0x4a3ad3=_0x4ac56f[_0x42c5('0xa0')];if(_0x4ac56f[_0x42c5('0xa0')]===-0x1){this[_0x42c5('0x33')][_0x42c5('0x6d')](this,_0x1e92ac,'-1');return _0x4ac56f;}else if(_0x4ac56f[_0x42c5('0x9e')]===_0x42c5('0x64')){_0x4ac56f['result']=_0x4ac56f[_0x42c5('0xa0')][_0x42c5('0x98')]>0x0?_0x4ac56f[_0x42c5('0xa0')]:'t';}else if(_[_0x42c5('0x43')](_0x4ac56f['result'])){_0x4ac56f['result']='#';_0x4a3ad3='#';}if(!this[_0x42c5('0x84')](_0x1e92ac['variable_id'])){this['channel'][_0x42c5('0xa6')](_0x42c5('0xd4'));}else{var _0x2b3236=this['getVariable'][_0x42c5('0x6d')](this,_0x1e92ac[_0x42c5('0xd3')]);if(!_0x2b3236){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x1e92ac,_0x42c5('0xd5'));}this[_0x42c5('0xf')][_0x42c5('0xa1')](_0x2b3236,_0x4a3ad3);}this[_0x42c5('0x33')][_0x42c5('0x6d')](this,_0x1e92ac,_0x4a3ad3);return _0x4ac56f;};AGIVertices[_0x42c5('0x12')][_0x42c5('0xa6')]=function(_0x57c123){logger['info'](util[_0x42c5('0x27')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x57c123['label']));return this['channel'][_0x42c5('0xa6')](_0x57c123[_0x42c5('0x160')]||_0x57c123[_0x42c5('0x34')]);};AGIVertices[_0x42c5('0x12')][_0x42c5('0x161')]=function(_0x5570f4){logger['info'](util[_0x42c5('0x27')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x5570f4[_0x42c5('0x34')]));if(!this[_0x42c5('0x84')](_0x5570f4['findBy'])){return this['channel'][_0x42c5('0x4f')](_0x5570f4,'no\x20find\x20by\x20configured');}logger[_0x42c5('0x2b')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x42c5('0xf')][_0x42c5('0x38')],_0x5570f4[_0x42c5('0x14f')]));var _0x3bc564=this['getPause']['sync'](this,_0x5570f4[_0x42c5('0x162')]);var _0xc56e51=this['agentPause'][_0x42c5('0x6d')](this,_0x5570f4[_0x42c5('0x14f')],_0x3bc564);if(_0xc56e51){logger['info'](util[_0x42c5('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x42c5('0xf')][_0x42c5('0x38')],_0x5570f4['findBy']));this['channel'][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0x152'),this[_0x42c5('0xf')][_0x42c5('0x38')],_0x5570f4[_0x42c5('0x14f')]));return{'code':0xc8,'result':_0x42c5('0x153')};}else{logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0x154'),this[_0x42c5('0xf')]['callerid'],_0x5570f4['findBy']));this[_0x42c5('0xf')]['noop'](util[_0x42c5('0x27')](_0x42c5('0x152'),this[_0x42c5('0xf')][_0x42c5('0x38')],_0x5570f4[_0x42c5('0x14f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x42c5('0x12')]['playback']=function(_0x262ff3){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0x163'),_0x262ff3[_0x42c5('0x34')]));if(!this['isConfigured'](_0x262ff3[_0x42c5('0x10a')])){return this['channel'][_0x42c5('0x4f')](_0x262ff3,'no\x20file\x20audio\x20selected');}var _0xfd648e=this['getSound'][_0x42c5('0x6d')](this,_0x262ff3[_0x42c5('0x10a')]);if(!_0xfd648e){return this['channel'][_0x42c5('0x4f')](_0x262ff3,_0x42c5('0x10c'));}var _0x37ce76=this['channel'][_0x42c5('0x54')](_0x42c5('0x164'),[_0xfd648e,_0x262ff3[_0x42c5('0xde')]]);if(_0x37ce76[_0x42c5('0xa0')]===-0x1){return _0x37ce76;}return this['channel'][_0x42c5('0xa6')](util['format']('Executed\x20command\x20%s\x20%s',_0x42c5('0x164'),_0xfd648e));};AGIVertices[_0x42c5('0x12')]['queue']=function(_0x4e5844){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0x165'),_0x4e5844[_0x42c5('0x34')]));if(!this['isConfigured'](_0x4e5844[_0x42c5('0x166')])){return this[_0x42c5('0xf')]['error'](_0x4e5844,_0x42c5('0x167'));}var _0x1f5ef3='';var _0x4bc593=parseInt(_0x4e5844['queue_id'],0xa);if(isNaN(_0x4bc593)){_0x1f5ef3=_0x4e5844[_0x42c5('0x166')];}else{_0x1f5ef3=this[_0x42c5('0x168')]['sync'](this,_0x4e5844[_0x42c5('0x166')]);if(!_0x1f5ef3){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x4e5844,_0x42c5('0x169'));}}var _0x4f68c1='';if(this['isConfigured'](_0x4e5844[_0x42c5('0x10a')])){var _0x23548d=this[_0x42c5('0x1e')][_0x42c5('0x6d')](this,_0x4e5844[_0x42c5('0x10a')]);if(_0x23548d){_0x4f68c1=_0x23548d;}}this[_0x42c5('0x33')][_0x42c5('0x6d')](this,_0x4e5844,_0x1f5ef3);if(_0x4e5844[_0x42c5('0xde')][_0x42c5('0x16a')]('x')<0x0){_0x4e5844[_0x42c5('0xde')]+='x';}if(_0x4e5844[_0x42c5('0xde')][_0x42c5('0x16a')]('X')<0x0){_0x4e5844[_0x42c5('0xde')]+='X';}this[_0x42c5('0xf')]['setVariable']('XMCS-QUEUE',_0x1f5ef3?_0x1f5ef3[_0x42c5('0x16b')]():'');var _0x4bc06b=this[_0x42c5('0xf')][_0x42c5('0x54')]('QUEUE',[_0x1f5ef3,_0x4e5844[_0x42c5('0xde')],_0x4e5844['url'],_0x4f68c1,_0x4e5844[_0x42c5('0x64')],_0x4e5844['agi'],_0x4e5844[_0x42c5('0x16c')],_0x4e5844[_0x42c5('0x16d')],'',_0x4e5844['position']]);if(_0x4bc06b['result']===-0x1){return _0x4bc06b;}return this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0xbe'),_0x42c5('0x16e'),_0x1f5ef3));};AGIVertices[_0x42c5('0x12')][_0x42c5('0x16f')]=function(_0x45439b){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x45439b[_0x42c5('0x34')]));var _0x24bf19=_0x45439b[_0x42c5('0x170')]||'wav';var _0x5bcbea=util['format'](_0x42c5('0x171'),this[_0x42c5('0xf')][_0x42c5('0x3f')],rs['generate'](0x5));var _0x30eae0=util[_0x42c5('0x27')](_0x42c5('0x172'),FILES_PATH,_0x5bcbea,_0x24bf19);var _0x565924=util['format'](_0x42c5('0x135'),FILES_PATH,_0x5bcbea);this[_0x42c5('0x37')][_0x42c5('0x6d')](this,_0x45439b,_0x5bcbea,_0x30eae0);this[_0x42c5('0xf')][_0x42c5('0xa1')](_0x42c5('0x173'),_0x5bcbea);logger[_0x42c5('0x2b')](_0x42c5('0x174'),_0x565924,_0x24bf19,_0x45439b[_0x42c5('0x175')],_0x45439b[_0x42c5('0x64')]);return this[_0x42c5('0xf')][_0x42c5('0x12e')](_0x565924,_0x24bf19,_0x45439b[_0x42c5('0x175')],_0x45439b[_0x42c5('0x64')],undefined,!![]);};AGIVertices[_0x42c5('0x12')]['restapi']=function(_0x3e14f9){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0x176'),_0x3e14f9['label']));if(!this['isConfigured'](_0x3e14f9[_0x42c5('0x62')])){return this[_0x42c5('0xf')][_0x42c5('0xa6')](_0x42c5('0x177'));}var _0x30b392=this[_0x42c5('0x61')][_0x42c5('0x6d')](this,_0x3e14f9);logger[_0x42c5('0x2b')](util['format'](_0x42c5('0x178'),util[_0x42c5('0x179')](_0x30b392,{'showHidden':![],'depth':null})));if(!this[_0x42c5('0x84')](_0x3e14f9['variable_id'])){return this[_0x42c5('0xf')][_0x42c5('0xa6')](_0x42c5('0x17a'));}var _0x280b05=this[_0x42c5('0x13')][_0x42c5('0x6d')](this,_0x3e14f9[_0x42c5('0xd3')]);if(!_0x280b05){return this['channel'][_0x42c5('0x4f')](_0x3e14f9,'no\x20variable\x20found');}this[_0x42c5('0xf')]['setVariable'](util[_0x42c5('0x27')](_0x42c5('0x17b'),_0x280b05),_0x30b392['statusCode']?_0x30b392['statusCode']:_0x42c5('0x17c'));this[_0x42c5('0xf')][_0x42c5('0xa1')](util['format'](_0x42c5('0x17d'),_0x280b05),_0x30b392[_0x42c5('0x75')]?_0x30b392['statusMessage']:'OK');if(_0x30b392[_0x42c5('0x6a')]){try{this[_0x42c5('0x99')](_0x30b392[_0x42c5('0x6a')],_0x280b05);}catch(_0x5d9cf7){logger[_0x42c5('0x4f')](util[_0x42c5('0x27')](_0x42c5('0x17e'),_0x280b05));}}return this['channel']['noop'](util['format'](_0x42c5('0xd8'),_0x280b05));};AGIVertices['prototype'][_0x42c5('0x17f')]=function(_0x19737e){logger['info'](util[_0x42c5('0x27')](_0x42c5('0x180'),_0x19737e[_0x42c5('0x34')]));return this[_0x42c5('0xf')][_0x42c5('0x181')](_0x19737e['digits'][_0x42c5('0x182')](/\s+/g,''),_0x19737e['escape_digits']);};AGIVertices['prototype']['saynumber']=function(_0x2ea01e){logger[_0x42c5('0x2b')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x2ea01e['label']));return this['channel'][_0x42c5('0x183')](_0x2ea01e[_0x42c5('0x65')][_0x42c5('0x182')](/\s+/g,''),_0x2ea01e[_0x42c5('0x175')]);};AGIVertices[_0x42c5('0x12')]['sayphonetic']=function(_0x5a7de0){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x5a7de0['label']));return this[_0x42c5('0xf')][_0x42c5('0x184')](_0x5a7de0[_0x42c5('0x59')],_0x5a7de0[_0x42c5('0x175')]);};AGIVertices[_0x42c5('0x12')][_0x42c5('0x185')]=function(_0x23c50c){logger[_0x42c5('0x2b')](util['format'](_0x42c5('0x186'),_0x23c50c[_0x42c5('0x34')]));if(!this['isConfigured'](_0x23c50c[_0x42c5('0x187')])){return this['channel'][_0x42c5('0xa6')](_0x42c5('0x188'));}var _0x347fbd=this[_0x42c5('0x21')]['sync'](this,_0x23c50c[_0x42c5('0x187')]);if(!_0x347fbd||!_0x347fbd[_0x42c5('0x189')]){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x23c50c,_0x42c5('0x18a'));}var _0x1fa38e={'from':util[_0x42c5('0x27')](_0x42c5('0x18b'),_0x347fbd[_0x42c5('0x16')],_0x347fbd['email']||_0x347fbd[_0x42c5('0x189')][_0x42c5('0x18c')]),'to':_0x23c50c['to']||'','cc':_0x23c50c['cc']||'','bcc':_0x23c50c[_0x42c5('0x18d')]||'','subject':_0x23c50c[_0x42c5('0x18e')],'html':_0x23c50c[_0x42c5('0x59')],'text':_0x23c50c[_0x42c5('0x59')]};if(this[_0x42c5('0x84')](_0x23c50c['template_id'])){}logger[_0x42c5('0x18f')](_0x42c5('0x190'),JSON['stringify'](_0x1fa38e));this[_0x42c5('0x33')][_0x42c5('0x6d')](this,_0x23c50c,_0x23c50c[_0x42c5('0x187')]);this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0x191'),_0x347fbd[_0x42c5('0x16')]));this[_0x42c5('0x192')][_0x42c5('0x6d')](this,_0x347fbd['smtpOptions'],_0x1fa38e);return this[_0x42c5('0xf')][_0x42c5('0xa6')](_0x42c5('0x193'));};AGIVertices[_0x42c5('0x12')][_0x42c5('0x194')]=function(_0x652972){logger['info'](util['format'](_0x42c5('0x195'),_0x652972[_0x42c5('0x34')]));return this[_0x42c5('0xf')]['noop'](_0x42c5('0x196'));};AGIVertices['prototype']['sendSMS']=function(_0x3fb7ed){logger[_0x42c5('0x2b')](util['format'](_0x42c5('0x197'),_0x3fb7ed[_0x42c5('0x34')]));if(!this['isConfigured'](_0x3fb7ed['sms_account_id'])){return this['channel'][_0x42c5('0xa6')](_0x42c5('0x198'));}var _0x57a717=this[_0x42c5('0x30')]['sync'](this,_0x3fb7ed[_0x42c5('0x199')]);if(!_0x57a717){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x3fb7ed,'no\x20sms\x20account\x20found');}var _0x2a1ffa={'body':_0x3fb7ed[_0x42c5('0x19a')],'phone':_0x3fb7ed['to']||'','SmsAccountId':_0x57a717['id']};logger[_0x42c5('0x18f')](_0x42c5('0x19b'),JSON[_0x42c5('0x72')](_0x2a1ffa));this[_0x42c5('0x33')][_0x42c5('0x6d')](this,_0x3fb7ed,_0x3fb7ed[_0x42c5('0x199')]);this[_0x42c5('0xf')]['noop'](util[_0x42c5('0x27')](_0x42c5('0x19c'),_0x57a717[_0x42c5('0x16')]));this[_0x42c5('0x32')][_0x42c5('0x6d')](this,_0x2a1ffa);return this[_0x42c5('0xf')][_0x42c5('0xa6')](_0x42c5('0x19d'));};AGIVertices[_0x42c5('0x12')]['set']=function(_0x3a2778){logger[_0x42c5('0x2b')](util['format'](_0x42c5('0x19e'),_0x3a2778[_0x42c5('0x34')]));if(!this['isConfigured'](_0x3a2778['variable_id'])){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x3a2778,'no\x20variable\x20selected');}var _0x552d26=this[_0x42c5('0x13')][_0x42c5('0x6d')](this,_0x3a2778[_0x42c5('0xd3')]);if(!_0x552d26){return this['channel'][_0x42c5('0x4f')](_0x3a2778,'no\x20variable\x20found');}return this['channel'][_0x42c5('0xa1')](_0x552d26,_0x3a2778[_0x42c5('0x19f')]);};AGIVertices['prototype'][_0x42c5('0x1a0')]=function(_0x169c32){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0x1a1'),_0x169c32[_0x42c5('0x34')]));this[_0x42c5('0xf')][_0x42c5('0xa6')](_0x42c5('0x1a2'));if(_0x169c32['answer']===_0x42c5('0x1a3')){this['channel'][_0x42c5('0xa6')]('Answer');return this['channel'][_0x42c5('0xb6')]();}return this[_0x42c5('0xf')][_0x42c5('0xa6')](_0x42c5('0x1a4'));};AGIVertices[_0x42c5('0x12')][_0x42c5('0x1a5')]=function(_0x1a995b){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x1a995b[_0x42c5('0x34')]));if(!this['isConfigured'](_0x1a995b[_0x42c5('0x1a6')])){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x1a995b,_0x42c5('0x1a7'));}var _0x452ff8=this[_0x42c5('0x1a8')][_0x42c5('0x6d')](this,_0x1a995b[_0x42c5('0x1a6')]);if(!this[_0x42c5('0x84')](_0x452ff8)){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x1a995b,util[_0x42c5('0x27')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x1a995b[_0x42c5('0x1a6')]));}if(_0x452ff8===this[_0x42c5('0xf')][_0x42c5('0x36')]){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x1a995b,_0x42c5('0x1a9'));}this[_0x42c5('0x33')][_0x42c5('0x6d')](this,_0x1a995b,_0x452ff8);var _0x30a9d5=this[_0x42c5('0xf')]['exec']('AGI',util[_0x42c5('0x27')](_0x42c5('0x1aa'),config['agi'][_0x42c5('0x1ab')]||_0x42c5('0x1ac'),_0x452ff8,this['channel'][_0x42c5('0x36')]));if(_0x30a9d5[_0x42c5('0xa0')]===-0x1){return _0x30a9d5;}return this['channel'][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0xbe'),_0x42c5('0x1ad'),_0x452ff8));};AGIVertices[_0x42c5('0x12')][_0x42c5('0x1ae')]=function(_0x31c590){logger['info'](util[_0x42c5('0x27')](_0x42c5('0x1af'),_0x31c590[_0x42c5('0x34')]));var _0x1f4529=this[_0x42c5('0x53')]['sync'](this,_0x31c590[_0x42c5('0x1b0')]);this[_0x42c5('0x33')]['sync'](this,_0x31c590,_0x31c590[_0x42c5('0x1b0')]);if(this['isConfigured'](_0x31c590[_0x42c5('0xd3')])){var _0x908d=this[_0x42c5('0x13')][_0x42c5('0x6d')](this,_0x31c590['variable_id']);if(_0x908d){this[_0x42c5('0xf')][_0x42c5('0xa1')](_0x908d,_0x1f4529);return this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0x1b1'),_0x31c590['command'],_0x908d));}}return this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x31c590['command']));};AGIVertices['prototype'][_0x42c5('0x1b2')]=function(_0x543589){logger['info'](util['format'](_0x42c5('0x1b3'),_0x543589[_0x42c5('0x34')]));_0x543589['text']=_0x543589[_0x42c5('0x59')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x42c5('0x84')](_0x543589['apiKey'])){return this['channel'][_0x42c5('0xa6')](_0x42c5('0x1b4'));}if(!this['isConfigured'](_0x543589['text'])){return this['channel'][_0x42c5('0xa6')](_0x42c5('0xa7'));}this[_0x42c5('0xf')][_0x42c5('0xa6')](util['format'](_0x42c5('0x1b5'),_0x543589[_0x42c5('0x59')]));var _0xd3ef3b=this['googleCloudTTS'][_0x42c5('0x6d')](this,_0x543589);if(_0xd3ef3b){this['channel'][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0x1b6'),_0xd3ef3b));var _0x4c3db7=this[_0x42c5('0xf')]['streamFile'](_0xd3ef3b);try{fs[_0x42c5('0xfa')](_0xd3ef3b+_0x42c5('0xfb'));}catch(_0x53c2c9){logger[_0x42c5('0x4f')](_0x53c2c9);}return _0x4c3db7;}return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x543589,_0x42c5('0x1b7'));};AGIVertices['prototype'][_0x42c5('0x1b8')]=function(_0x274151){logger[_0x42c5('0x2b')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x274151[_0x42c5('0x34')]));_0x274151[_0x42c5('0x59')]=_0x274151[_0x42c5('0x59')][_0x42c5('0x182')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x274151[_0x42c5('0x59')])){return this[_0x42c5('0xf')][_0x42c5('0xa6')](_0x42c5('0xa7'));}this[_0x42c5('0xf')][_0x42c5('0xa6')](util['format'](_0x42c5('0x1b9'),_0x274151[_0x42c5('0x59')]));var _0x3300e8=this[_0x42c5('0x5f')][_0x42c5('0x6d')](this,_0x274151);if(_0x3300e8){this[_0x42c5('0xf')][_0x42c5('0xa6')](util['format'](_0x42c5('0x1ba'),_0x3300e8));var _0x428b9b=this[_0x42c5('0xf')][_0x42c5('0xf9')](_0x3300e8);try{fs['unlink'](_0x3300e8+_0x42c5('0xfb'));}catch(_0x9e6f62){logger['error'](_0x9e6f62);}return _0x428b9b;}return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x274151,_0x42c5('0x1bb'));};AGIVertices[_0x42c5('0x12')]['unpause']=function(_0xbf86ba){logger['info'](util[_0x42c5('0x27')](_0x42c5('0x1bc'),_0xbf86ba[_0x42c5('0x34')]));if(!this['isConfigured'](_0xbf86ba[_0x42c5('0x14f')])){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0xbf86ba,'no\x20find\x20by\x20configured');}logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0x151'),this[_0x42c5('0xf')][_0x42c5('0x38')],_0xbf86ba[_0x42c5('0x14f')]));var _0x101d8e=this[_0x42c5('0x50')]['sync'](this,_0xbf86ba[_0x42c5('0x14f')]);if(_0x101d8e){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0x152'),this[_0x42c5('0xf')]['callerid'],_0xbf86ba[_0x42c5('0x14f')]));this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0x152'),this[_0x42c5('0xf')][_0x42c5('0x38')],_0xbf86ba[_0x42c5('0x14f')]));return{'code':0xc8,'result':_0x42c5('0x153')};}else{logger[_0x42c5('0x2b')](util[_0x42c5('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x42c5('0x38')],_0xbf86ba['findBy']));this['channel'][_0x42c5('0xa6')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x42c5('0xf')][_0x42c5('0x38')],_0xbf86ba['findBy']));return{'code':0xc8,'result':_0x42c5('0x155')};}};AGIVertices[_0x42c5('0x12')][_0x42c5('0x1bd')]=function(_0x194adf){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')](_0x42c5('0x1be'),_0x194adf[_0x42c5('0x34')]));var _0x5ba4cb=this[_0x42c5('0xf')][_0x42c5('0x54')]('VOICEMAIL',[_0x194adf[_0x42c5('0x1bf')],_0x194adf[_0x42c5('0x78')]]);if(_0x5ba4cb[_0x42c5('0xa0')]===-0x1){return _0x5ba4cb;}return this[_0x42c5('0xf')][_0x42c5('0xa6')](util[_0x42c5('0x27')](_0x42c5('0xbe'),'VOICEMAIL',_0x194adf[_0x42c5('0x1bf')]));};AGIVertices[_0x42c5('0x12')]['vswitch']=function(_0x16d59d){logger[_0x42c5('0x2b')](util[_0x42c5('0x27')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x16d59d[_0x42c5('0x34')]));if(!this[_0x42c5('0x84')](_0x16d59d[_0x42c5('0xd3')])){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x16d59d,'no\x20variable\x20selected');}var _0x5141a0=this[_0x42c5('0x13')][_0x42c5('0x6d')](this,_0x16d59d['variable_id']);if(!_0x5141a0){return this[_0x42c5('0xf')][_0x42c5('0x4f')](_0x16d59d,_0x42c5('0xd5'));}var _0x280e72=this[_0x42c5('0xf')]['getVariable'](_0x5141a0);return{'code':0xc8,'result':_0x280e72[_0x42c5('0x9e')]?_0x280e72[_0x42c5('0x9e')]:'-'};};String[_0x42c5('0x12')]['replaceAll']=function(_0x4e77e2,_0x38b9b8){return this['split'](_0x4e77e2)[_0x42c5('0x1c0')](_0x38b9b8);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index edd2685..78a1c34 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 _0x88b3=['[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','lodash','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncAgentRingNoAnswer','syncAttendedTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnectPreview]\x20%s','isUndefined'];(function(_0x241424,_0x25eb5d){var _0x3da798=function(_0x415153){while(--_0x415153){_0x241424['push'](_0x241424['shift']());}};_0x3da798(++_0x25eb5d);}(_0x88b3,0x67));var _0x388b=function(_0x5e836a,_0x156644){_0x5e836a=_0x5e836a-0x0;var _0x484835=_0x88b3[_0x5e836a];return _0x484835;};'use strict';var util=require('util');var _=require(_0x388b('0x0'));var moment=require(_0x388b('0x1'));var ami=require(_0x388b('0x2'));var logger=require(_0x388b('0x3'))(_0x388b('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x388b('0x5'));function Acw(_0x233788){this[_0x388b('0x6')]=_0x233788[_0x388b('0x6')];this[_0x388b('0x7')]=_0x233788[_0x388b('0x7')];this[_0x388b('0x8')]=_0x233788[_0x388b('0x8')];this[_0x388b('0x9')]={};ami['on']('agentconnect',this[_0x388b('0xa')][_0x388b('0xb')](this));ami['on'](_0x388b('0xc'),this[_0x388b('0xd')][_0x388b('0xb')](this));ami['on'](_0x388b('0xe'),this['syncHangup'][_0x388b('0xb')](this));ami['on']('agentringnoanswer',this[_0x388b('0xf')][_0x388b('0xb')](this));ami['on']('attendedtransfer',this[_0x388b('0x10')][_0x388b('0xb')](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));ami['on'](_0x388b('0x11'),this[_0x388b('0x12')][_0x388b('0xb')](this));}function getDiff(_0x73743){var _0x30a51d=moment()[_0x388b('0x13')](0x0);var _0x377034=moment(_0x73743)[_0x388b('0x13')](0x0);return _0x30a51d[_0x388b('0x14')](_0x377034,_0x388b('0x15'));}Acw[_0x388b('0x16')][_0x388b('0x17')]=function(_0x58d51d){try{var _0x2b3491=this;var _0x75dea4=this['channels'][_0x58d51d][_0x388b('0x18')];var _0x562810=this[_0x388b('0x9')][_0x58d51d][_0x388b('0x19')];var _0x3b8a24=this['voiceQueues'][_0x562810];var _0x4e402f=![];var _0x46730f=_0x388b('0x1a');if(_0x3b8a24[_0x388b('0x1b')]){if(_0x3b8a24[_0x388b('0x1c')]['name']){_0x4e402f=!![];_0x46730f=_0x3b8a24[_0x388b('0x1c')][_0x388b('0x1d')];}}ami[_0x388b('0x1e')]({'action':_0x388b('0x1f'),'interface':_0x75dea4,'paused':!![],'reason':_0x46730f})['then'](function(_0x1f7ec8){if(_0x2b3491[_0x388b('0x7')][_0x75dea4]){return RpcUser[_0x388b('0x20')](_0x2b3491[_0x388b('0x7')][_0x75dea4]['id'])['then'](function(_0x5d823e){if(_0x5d823e&&!_0x5d823e[_0x388b('0x21')]){logger[_0x388b('0x22')](_0x388b('0x23'),_0x58d51d,_0x75dea4,_0x562810);var _0x24d441=_0x2b3491[_0x388b('0x9')][_0x58d51d][_0x388b('0x24')]&&_0x2b3491['channels'][_0x58d51d][_0x388b('0x25')]?_0x2b3491['channels'][_0x58d51d][_0x388b('0x25')]:_0x58d51d;return RpcUser[_0x388b('0x26')](_0x2b3491[_0x388b('0x7')][_0x75dea4],_0x46730f,_0x24d441)[_0x388b('0x27')](function(_0x27b392){if(!_0x4e402f){_0x2b3491[_0x388b('0x8')][_0x75dea4]={};logger[_0x388b('0x22')](_0x388b('0x28'),_0x58d51d,_0x2b3491[_0x388b('0x6')][_0x562810]['acwTimeout'],_0x75dea4,_0x562810);_0x2b3491[_0x388b('0x8')][_0x75dea4][_0x388b('0x29')]=setTimeout(_0x2b3491['stopAcw']['bind'](_0x2b3491,_0x75dea4),_0x2b3491[_0x388b('0x6')][_0x562810][_0x388b('0x2a')]*0x3e8);_0x2b3491[_0x388b('0x8')][_0x75dea4][_0x388b('0x2b')]=moment()[_0x388b('0x2c')](_0x388b('0x2d'));_0x2b3491[_0x388b('0x8')][_0x75dea4][_0x388b('0x2e')]=_0x58d51d;_0x2b3491[_0x388b('0x8')][_0x75dea4][_0x388b('0x19')]=_0x562810;_0x2b3491[_0x388b('0x8')][_0x75dea4][_0x388b('0x2f')]=function(){var _0x13050e=getDiff(_0x2b3491['timers'][_0x75dea4][_0x388b('0x2b')]);clearTimeout(_0x2b3491[_0x388b('0x8')][_0x75dea4][_0x388b('0x29')]);_0x2b3491[_0x388b('0x8')][_0x75dea4][_0x388b('0x29')]=![];RpcVoiceAgentReport[_0x388b('0x30')]({'acwtime':_0x13050e},_0x2b3491[_0x388b('0x8')][_0x75dea4][_0x388b('0x2e')],_0x75dea4)[_0x388b('0x27')](function(_0x2ba1cb){logger[_0x388b('0x22')](_0x388b('0x31'),_0x58d51d,_0x13050e,_0x2ba1cb);})[_0x388b('0x32')](function(_0x4edda3){logger[_0x388b('0x33')](_0x388b('0x34'),_0x58d51d,_0x4edda3);});delete _0x2b3491[_0x388b('0x8')][_0x75dea4];};}});}else{logger[_0x388b('0x22')](_0x388b('0x35'),_0x58d51d,_0x75dea4,_0x562810);}});}})[_0x388b('0x32')](function(_0x23ea88){logger[_0x388b('0x33')](_0x388b('0x28'),_0x58d51d,_0x2b3491[_0x388b('0x6')][_0x562810][_0x388b('0x2a')],_0x75dea4,_0x562810);})['finally'](function(){delete _0x2b3491[_0x388b('0x9')][_0x58d51d];});}catch(_0x3427d0){logger[_0x388b('0x33')]('[ACW][START]\x20%s',_0x3427d0[_0x388b('0x36')]);}};Acw[_0x388b('0x16')][_0x388b('0x37')]=function(_0x52b78d){try{var _0x564c13=this;if(_0x564c13[_0x388b('0x8')][_0x52b78d]){_0x564c13[_0x388b('0x8')][_0x52b78d][_0x388b('0x29')]=![];var _0x17f295=_0x564c13['timers'][_0x52b78d][_0x388b('0x2e')];var _0xae2d42=_0x564c13[_0x388b('0x8')][_0x52b78d][_0x388b('0x19')];var _0x4482e0=_0x564c13[_0x388b('0x6')][_0xae2d42][_0x388b('0x2a')];logger[_0x388b('0x22')](_0x388b('0x38'),_0x17f295,_0x52b78d);RpcUser[_0x388b('0x39')](this[_0x388b('0x7')][_0x52b78d]);RpcVoiceAgentReport[_0x388b('0x30')]({'acwtime':_0x4482e0,'agentacw':!![]},_0x17f295,_0x52b78d)[_0x388b('0x27')](function(_0x44ac4d){logger[_0x388b('0x22')](_0x388b('0x31'),_0x17f295,_0x4482e0,_0x44ac4d);})[_0x388b('0x32')](function(_0x3407ed){logger[_0x388b('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x17f295,_0x3407ed);});}else{logger[_0x388b('0x33')](_0x388b('0x3a'),_0x52b78d);if(_0x564c13['timers']){logger['info'](_0x388b('0x3b'),JSON[_0x388b('0x3c')](_0x564c13[_0x388b('0x8')]));}}}catch(_0x5953f1){logger[_0x388b('0x33')]('[ACW][STOP]\x20%s',_0x5953f1[_0x388b('0x36')]);}};Acw[_0x388b('0x16')][_0x388b('0xa')]=function(_0x557bd0){try{if(this['voiceQueues'][_0x557bd0['queue']]&&(this[_0x388b('0x6')][_0x557bd0[_0x388b('0x19')]][_0x388b('0x4')]||this[_0x388b('0x6')][_0x557bd0[_0x388b('0x19')]][_0x388b('0x1b')])){if(this['agents'][_0x557bd0['interface']]){this[_0x388b('0x9')][_0x557bd0[_0x388b('0x2e')]]={'queue':_0x557bd0[_0x388b('0x19')],'interface':_0x557bd0[_0x388b('0x18')],'destlinkedid':_0x557bd0['destlinkedid']};}}}catch(_0x182983){logger[_0x388b('0x33')]('[ACW][syncAgentConnect]\x20%s',_0x182983[_0x388b('0x36')]);}};Acw[_0x388b('0x16')][_0x388b('0x12')]=function(_0x1bfaf5){try{if(this[_0x388b('0x6')][_0x1bfaf5[_0x388b('0x19')]]&&(this[_0x388b('0x6')][_0x1bfaf5[_0x388b('0x19')]][_0x388b('0x4')]||this['voiceQueues'][_0x1bfaf5[_0x388b('0x19')]][_0x388b('0x1b')])){if(this[_0x388b('0x7')][_0x1bfaf5[_0x388b('0x18')]]){this[_0x388b('0x9')][_0x1bfaf5[_0x388b('0x2e')]]={'queue':_0x1bfaf5[_0x388b('0x19')],'interface':_0x1bfaf5[_0x388b('0x18')]};}}}catch(_0x1d3e8b){logger['error'](_0x388b('0x3d'),_0x1d3e8b[_0x388b('0x36')]);}};Acw['prototype'][_0x388b('0xd')]=function(_0x573994){try{if(this[_0x388b('0x9')][_0x573994['uniqueid']]&&_[_0x388b('0x3e')](this[_0x388b('0x9')][_0x573994[_0x388b('0x2e')]][_0x388b('0x24')])){logger['info'](_0x388b('0x3f'),_0x573994[_0x388b('0x2e')]);this[_0x388b('0x17')](_0x573994[_0x388b('0x2e')]);}else if(this[_0x388b('0x9')][_0x573994[_0x388b('0x40')]]&&_[_0x388b('0x3e')](this[_0x388b('0x9')][_0x573994[_0x388b('0x40')]][_0x388b('0x24')])){logger['info'](_0x388b('0x41'),_0x573994[_0x388b('0x40')]);this['startAcw'](_0x573994[_0x388b('0x40')]);}}catch(_0x582ae9){logger['error'](_0x388b('0x42'),_0x582ae9[_0x388b('0x36')]);}};Acw[_0x388b('0x16')][_0x388b('0x43')]=function(_0x47aea2){try{if(this[_0x388b('0x9')][_0x47aea2[_0x388b('0x2e')]]&&this[_0x388b('0x9')][_0x47aea2[_0x388b('0x2e')]][_0x388b('0x24')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x47aea2['uniqueid']);this[_0x388b('0x17')](_0x47aea2['uniqueid']);}else if(this[_0x388b('0x9')][_0x47aea2['linkedid']]&&this[_0x388b('0x9')][_0x47aea2[_0x388b('0x40')]][_0x388b('0x24')]){logger[_0x388b('0x22')](_0x388b('0x44'),_0x47aea2['linkedid']);this[_0x388b('0x17')](_0x47aea2[_0x388b('0x40')]);}}catch(_0x55c999){logger[_0x388b('0x33')](_0x388b('0x45'),_0x55c999[_0x388b('0x36')]);}};Acw[_0x388b('0x16')][_0x388b('0x10')]=function(_0x1ccc43){try{if(!_[_0x388b('0x46')](this[_0x388b('0x9')][_0x1ccc43[_0x388b('0x47')]])){this[_0x388b('0x17')](_0x1ccc43['transfereeuniqueid']);if(this[_0x388b('0x9')][_0x1ccc43[_0x388b('0x48')]]){this['channels'][_0x1ccc43[_0x388b('0x48')]][_0x388b('0x24')]=!![];this['channels'][_0x1ccc43[_0x388b('0x49')]]=this[_0x388b('0x9')][_0x1ccc43[_0x388b('0x48')]];delete this['channels'][_0x1ccc43[_0x388b('0x48')]];}}else if(!_[_0x388b('0x46')](this[_0x388b('0x9')][_0x1ccc43[_0x388b('0x49')]])){this[_0x388b('0x17')](_0x1ccc43[_0x388b('0x49')]);if(this[_0x388b('0x9')][_0x1ccc43[_0x388b('0x4a')]]){this[_0x388b('0x9')][_0x1ccc43[_0x388b('0x4a')]]['attended']=!![];this['channels'][_0x1ccc43['transfereeuniqueid']]=this[_0x388b('0x9')][_0x1ccc43[_0x388b('0x4a')]];delete this['channels'][_0x1ccc43['origtransfereruniqueid']];}}}catch(_0xe6e0a2){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0xe6e0a2['message']);}};Acw[_0x388b('0x16')][_0x388b('0x4b')]=function(_0x423c3b){try{if(this['channels'][_0x423c3b[_0x388b('0x4c')]]){logger[_0x388b('0x22')](_0x388b('0x4d'),JSON[_0x388b('0x3c')](_0x423c3b[_0x388b('0x4c')]));this[_0x388b('0x17')](_0x423c3b[_0x388b('0x4c')]);}else if(this[_0x388b('0x9')][_0x423c3b[_0x388b('0x4e')]]){logger[_0x388b('0x22')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x388b('0x3c')](_0x423c3b[_0x388b('0x4e')]));this[_0x388b('0x17')](_0x423c3b[_0x388b('0x4e')]);}}catch(_0x38c0ba){logger['error'](_0x388b('0x4f'),_0x38c0ba[_0x388b('0x36')]);}};Acw[_0x388b('0x16')][_0x388b('0xf')]=function(_0xbe14b2){try{if(this['voiceQueues'][_0xbe14b2['queue']]&&this['voiceQueues'][_0xbe14b2[_0x388b('0x19')]][_0x388b('0x50')]==='all'){if(this[_0x388b('0x7')][_0xbe14b2['interface']]){logger[_0x388b('0x22')](_0x388b('0x51'),_0xbe14b2[_0x388b('0x2e')],_0xbe14b2[_0x388b('0x18')],_0xbe14b2[_0x388b('0x19')]);return RpcUser[_0x388b('0x26')](this[_0x388b('0x7')][_0xbe14b2[_0x388b('0x18')]],_0x388b('0x52'),_0xbe14b2[_0x388b('0x2e')]);}}}catch(_0x43e263){logger[_0x388b('0x33')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x43e263[_0x388b('0x36')]);}};module['exports']=Acw; \ No newline at end of file +var _0x4494=['interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','attended','destlinkedid','info','acwTimeout','timer','stopAcw','format','uniqueid','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','prototype'];(function(_0x1436b5,_0x2c76d2){var _0x268f41=function(_0x2c42f8){while(--_0x2c42f8){_0x1436b5['push'](_0x1436b5['shift']());}};_0x268f41(++_0x2c76d2);}(_0x4494,0x8d));var _0x4449=function(_0x2d94b1,_0x1a91b5){_0x2d94b1=_0x2d94b1-0x0;var _0x48f80c=_0x4494[_0x2d94b1];return _0x48f80c;};'use strict';var util=require(_0x4449('0x0'));var _=require(_0x4449('0x1'));var moment=require(_0x4449('0x2'));var ami=require(_0x4449('0x3'));var logger=require(_0x4449('0x4'))(_0x4449('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x4449('0x6'));function Acw(_0x26e4e1){this[_0x4449('0x7')]=_0x26e4e1[_0x4449('0x7')];this[_0x4449('0x8')]=_0x26e4e1['agents'];this[_0x4449('0x9')]=_0x26e4e1[_0x4449('0x9')];this[_0x4449('0xa')]={};ami['on'](_0x4449('0xb'),this[_0x4449('0xc')][_0x4449('0xd')](this));ami['on'](_0x4449('0xe'),this[_0x4449('0xf')][_0x4449('0xd')](this));ami['on'](_0x4449('0x10'),this[_0x4449('0x11')]['bind'](this));ami['on'](_0x4449('0x12'),this[_0x4449('0x13')]['bind'](this));ami['on']('attendedtransfer',this[_0x4449('0x14')]['bind'](this));ami['on'](_0x4449('0x15'),this[_0x4449('0x16')][_0x4449('0xd')](this));ami['on'](_0x4449('0x17'),this['syncAgentConnectPreview'][_0x4449('0xd')](this));}function getDiff(_0x35eb0d){var _0x1739b2=moment()[_0x4449('0x18')](0x0);var _0x3e7160=moment(_0x35eb0d)[_0x4449('0x18')](0x0);return _0x1739b2[_0x4449('0x19')](_0x3e7160,'seconds');}Acw[_0x4449('0x1a')]['startAcw']=function(_0x4c566c){try{var _0x8552be=this;var _0x225018=this[_0x4449('0xa')][_0x4c566c][_0x4449('0x1b')];var _0x50ad06=this[_0x4449('0xa')][_0x4c566c][_0x4449('0x1c')];var _0x2bb06f=this[_0x4449('0x7')][_0x50ad06];var _0x56e36c=![];var _0x2a6c29=_0x4449('0x1d');if(_0x2bb06f[_0x4449('0x1e')]){if(_0x2bb06f[_0x4449('0x1f')][_0x4449('0x20')]){_0x56e36c=!![];_0x2a6c29=_0x2bb06f[_0x4449('0x1f')][_0x4449('0x20')];}}ami[_0x4449('0x21')]({'action':_0x4449('0x22'),'interface':_0x225018,'paused':!![],'reason':_0x2a6c29})[_0x4449('0x23')](function(_0x2be5e3){if(_0x8552be[_0x4449('0x8')][_0x225018]){return RpcUser[_0x4449('0x24')](_0x8552be[_0x4449('0x8')][_0x225018]['id'])[_0x4449('0x23')](function(_0x22f61e){if(_0x22f61e&&!_0x22f61e[_0x4449('0x25')]){logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x4c566c,_0x225018,_0x50ad06);var _0x536329=_0x8552be[_0x4449('0xa')][_0x4c566c][_0x4449('0x26')]&&_0x8552be['channels'][_0x4c566c][_0x4449('0x27')]?_0x8552be[_0x4449('0xa')][_0x4c566c][_0x4449('0x27')]:_0x4c566c;return RpcUser['savePause'](_0x8552be['agents'][_0x225018],_0x2a6c29,_0x536329)[_0x4449('0x23')](function(_0x82096a){if(!_0x56e36c){_0x8552be[_0x4449('0x9')][_0x225018]={};logger[_0x4449('0x28')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4c566c,_0x8552be[_0x4449('0x7')][_0x50ad06][_0x4449('0x29')],_0x225018,_0x50ad06);_0x8552be[_0x4449('0x9')][_0x225018][_0x4449('0x2a')]=setTimeout(_0x8552be[_0x4449('0x2b')][_0x4449('0xd')](_0x8552be,_0x225018),_0x8552be[_0x4449('0x7')][_0x50ad06][_0x4449('0x29')]*0x3e8);_0x8552be[_0x4449('0x9')][_0x225018]['lastPauseAt']=moment()[_0x4449('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');_0x8552be['timers'][_0x225018][_0x4449('0x2d')]=_0x4c566c;_0x8552be[_0x4449('0x9')][_0x225018]['queue']=_0x50ad06;_0x8552be[_0x4449('0x9')][_0x225018]['updateAcw']=function(){var _0x252264=getDiff(_0x8552be[_0x4449('0x9')][_0x225018][_0x4449('0x2e')]);clearTimeout(_0x8552be['timers'][_0x225018]['timer']);_0x8552be[_0x4449('0x9')][_0x225018][_0x4449('0x2a')]=![];RpcVoiceAgentReport[_0x4449('0x2f')]({'acwtime':_0x252264},_0x8552be[_0x4449('0x9')][_0x225018]['uniqueid'],_0x225018)[_0x4449('0x23')](function(_0x395bef){logger['info'](_0x4449('0x30'),_0x4c566c,_0x252264,_0x395bef);})[_0x4449('0x31')](function(_0x399b24){logger[_0x4449('0x32')]('[%s][UPDATE][ERRORS:%s]',_0x4c566c,_0x399b24);});delete _0x8552be[_0x4449('0x9')][_0x225018];};}});}else{logger[_0x4449('0x28')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x4c566c,_0x225018,_0x50ad06);}});}})['catch'](function(_0x43384d){logger[_0x4449('0x32')](_0x4449('0x33'),_0x4c566c,_0x8552be[_0x4449('0x7')][_0x50ad06][_0x4449('0x29')],_0x225018,_0x50ad06);})[_0x4449('0x34')](function(){delete _0x8552be[_0x4449('0xa')][_0x4c566c];});}catch(_0x2eee34){logger[_0x4449('0x32')](_0x4449('0x35'),_0x2eee34[_0x4449('0x36')]);}};Acw[_0x4449('0x1a')][_0x4449('0x2b')]=function(_0x1dc299){try{var _0x421453=this;if(_0x421453[_0x4449('0x9')][_0x1dc299]){_0x421453[_0x4449('0x9')][_0x1dc299][_0x4449('0x2a')]=![];var _0x55f781=_0x421453[_0x4449('0x9')][_0x1dc299][_0x4449('0x2d')];var _0x741dad=_0x421453[_0x4449('0x9')][_0x1dc299][_0x4449('0x1c')];var _0x1adc3b=_0x421453[_0x4449('0x7')][_0x741dad][_0x4449('0x29')];logger[_0x4449('0x28')]('[%s][TIMER][STOP][AGENT:%s]',_0x55f781,_0x1dc299);RpcUser['saveUnpause'](this[_0x4449('0x8')][_0x1dc299]);RpcVoiceAgentReport[_0x4449('0x2f')]({'acwtime':_0x1adc3b,'agentacw':!![]},_0x55f781,_0x1dc299)[_0x4449('0x23')](function(_0x8bb8a2){logger[_0x4449('0x28')](_0x4449('0x30'),_0x55f781,_0x1adc3b,_0x8bb8a2);})[_0x4449('0x31')](function(_0x360972){logger['error'](_0x4449('0x37'),_0x55f781,_0x360972);});}else{logger[_0x4449('0x32')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x1dc299);if(_0x421453['timers']){logger['info'](_0x4449('0x38'),JSON[_0x4449('0x39')](_0x421453[_0x4449('0x9')]));}}}catch(_0x10a270){logger[_0x4449('0x32')](_0x4449('0x3a'),_0x10a270['message']);}};Acw[_0x4449('0x1a')][_0x4449('0xc')]=function(_0x16abec){try{if(this[_0x4449('0x7')][_0x16abec[_0x4449('0x1c')]]&&(this[_0x4449('0x7')][_0x16abec[_0x4449('0x1c')]][_0x4449('0x5')]||this[_0x4449('0x7')][_0x16abec[_0x4449('0x1c')]][_0x4449('0x1e')])){if(this[_0x4449('0x8')][_0x16abec['interface']]){this[_0x4449('0xa')][_0x16abec[_0x4449('0x2d')]]={'queue':_0x16abec[_0x4449('0x1c')],'interface':_0x16abec[_0x4449('0x1b')],'destlinkedid':_0x16abec[_0x4449('0x27')]};}}}catch(_0x3f07a5){logger[_0x4449('0x32')](_0x4449('0x3b'),_0x3f07a5[_0x4449('0x36')]);}};Acw[_0x4449('0x1a')]['syncAgentConnectPreview']=function(_0x1ac56b){try{if(this[_0x4449('0x7')][_0x1ac56b[_0x4449('0x1c')]]&&(this['voiceQueues'][_0x1ac56b['queue']][_0x4449('0x5')]||this['voiceQueues'][_0x1ac56b[_0x4449('0x1c')]][_0x4449('0x1e')])){if(this[_0x4449('0x8')][_0x1ac56b[_0x4449('0x1b')]]){this[_0x4449('0xa')][_0x1ac56b[_0x4449('0x2d')]]={'queue':_0x1ac56b['queue'],'interface':_0x1ac56b[_0x4449('0x1b')]};}}}catch(_0x4ba479){logger[_0x4449('0x32')](_0x4449('0x3c'),_0x4ba479['message']);}};Acw[_0x4449('0x1a')]['syncHangupRequest']=function(_0x5d1245){try{if(this[_0x4449('0xa')][_0x5d1245[_0x4449('0x2d')]]&&_[_0x4449('0x3d')](this['channels'][_0x5d1245[_0x4449('0x2d')]][_0x4449('0x26')])){logger[_0x4449('0x28')](_0x4449('0x3e'),_0x5d1245['uniqueid']);this[_0x4449('0x3f')](_0x5d1245[_0x4449('0x2d')]);}else if(this[_0x4449('0xa')][_0x5d1245[_0x4449('0x40')]]&&_['isUndefined'](this[_0x4449('0xa')][_0x5d1245[_0x4449('0x40')]][_0x4449('0x26')])){logger['info'](_0x4449('0x41'),_0x5d1245[_0x4449('0x40')]);this['startAcw'](_0x5d1245[_0x4449('0x40')]);}}catch(_0xe29bb2){logger[_0x4449('0x32')](_0x4449('0x42'),_0xe29bb2[_0x4449('0x36')]);}};Acw['prototype'][_0x4449('0x11')]=function(_0x48a41d){try{if(this[_0x4449('0xa')][_0x48a41d[_0x4449('0x2d')]]&&this[_0x4449('0xa')][_0x48a41d[_0x4449('0x2d')]]['attended']){logger[_0x4449('0x28')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x48a41d[_0x4449('0x2d')]);this[_0x4449('0x3f')](_0x48a41d['uniqueid']);}else if(this['channels'][_0x48a41d[_0x4449('0x40')]]&&this['channels'][_0x48a41d[_0x4449('0x40')]][_0x4449('0x26')]){logger[_0x4449('0x28')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x48a41d[_0x4449('0x40')]);this[_0x4449('0x3f')](_0x48a41d[_0x4449('0x40')]);}}catch(_0x8f6086){logger[_0x4449('0x32')](_0x4449('0x43'),_0x8f6086[_0x4449('0x36')]);}};Acw[_0x4449('0x1a')][_0x4449('0x14')]=function(_0x19e54){try{if(!_['isNil'](this[_0x4449('0xa')][_0x19e54['transfereeuniqueid']])){this[_0x4449('0x3f')](_0x19e54[_0x4449('0x44')]);if(this[_0x4449('0xa')][_0x19e54[_0x4449('0x45')]]){this[_0x4449('0xa')][_0x19e54[_0x4449('0x45')]]['attended']=!![];this[_0x4449('0xa')][_0x19e54[_0x4449('0x46')]]=this[_0x4449('0xa')][_0x19e54[_0x4449('0x45')]];delete this['channels'][_0x19e54['secondtransfereruniqueid']];}}else if(!_[_0x4449('0x47')](this['channels'][_0x19e54[_0x4449('0x46')]])){this[_0x4449('0x3f')](_0x19e54[_0x4449('0x46')]);if(this[_0x4449('0xa')][_0x19e54[_0x4449('0x48')]]){this['channels'][_0x19e54[_0x4449('0x48')]]['attended']=!![];this[_0x4449('0xa')][_0x19e54['transfereeuniqueid']]=this['channels'][_0x19e54[_0x4449('0x48')]];delete this[_0x4449('0xa')][_0x19e54[_0x4449('0x48')]];}}}catch(_0x1291fb){logger[_0x4449('0x32')](_0x4449('0x49'),_0x1291fb[_0x4449('0x36')]);}};Acw['prototype'][_0x4449('0x16')]=function(_0x5a3704){try{if(this[_0x4449('0xa')][_0x5a3704['transfereruniqueid']]){logger[_0x4449('0x28')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x5a3704[_0x4449('0x4a')]));this[_0x4449('0x3f')](_0x5a3704[_0x4449('0x4a')]);}else if(this[_0x4449('0xa')][_0x5a3704[_0x4449('0x4b')]]){logger[_0x4449('0x28')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x4449('0x39')](_0x5a3704[_0x4449('0x4b')]));this[_0x4449('0x3f')](_0x5a3704[_0x4449('0x4b')]);}}catch(_0x399df6){logger[_0x4449('0x32')](_0x4449('0x4c'),_0x399df6[_0x4449('0x36')]);}};Acw[_0x4449('0x1a')]['syncAgentRingNoAnswer']=function(_0x46a649){try{if(this[_0x4449('0x7')][_0x46a649[_0x4449('0x1c')]]&&this[_0x4449('0x7')][_0x46a649[_0x4449('0x1c')]][_0x4449('0x4d')]===_0x4449('0x4e')){if(this['agents'][_0x46a649[_0x4449('0x1b')]]){logger['info'](_0x4449('0x4f'),_0x46a649['uniqueid'],_0x46a649[_0x4449('0x1b')],_0x46a649[_0x4449('0x1c')]);return RpcUser[_0x4449('0x50')](this[_0x4449('0x8')][_0x46a649['interface']],_0x4449('0x51'),_0x46a649[_0x4449('0x2d')]);}}}catch(_0x231e5b){logger['error'](_0x4449('0x52'),_0x231e5b[_0x4449('0x36')]);}};module[_0x4449('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 37cecf3..8128342 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 _0xd8b0=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','asterisk','port','username','password','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','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0x5865b8,_0x306f58){var _0x18bca4=function(_0x2ef2dc){while(--_0x2ef2dc){_0x5865b8['push'](_0x5865b8['shift']());}};_0x18bca4(++_0x306f58);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Manager=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var moment=require('moment');var util=require('util');var _=require('lodash');var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var ami=new Manager(config[_0x0d8b('0x5')][_0x0d8b('0x6')],config['asterisk']['ip'],config['asterisk'][_0x0d8b('0x7')],config[_0x0d8b('0x5')][_0x0d8b('0x8')],!![]);ami['keepConnected']();ami[_0x0d8b('0x9')]=BPromise[_0x0d8b('0xa')](ami['action']);function error(_0x129310){logger[_0x0d8b('0xb')](util[_0x0d8b('0xc')](_0x0d8b('0xd'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port'],util[_0x0d8b('0xe')](_0x129310,![],null)));}function close(){logger['error'](util[_0x0d8b('0xc')](_0x0d8b('0xf'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')]));}ami[_0x0d8b('0x10')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x11')});};};ami[_0x0d8b('0x12')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x13')});};};ami[_0x0d8b('0x14')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x15')});};};ami[_0x0d8b('0x16')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x17')});};};ami[_0x0d8b('0x18')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x19')});};};function connect(_0x4586c2){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x1b'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config['asterisk'][_0x0d8b('0x6')]));ami[_0x0d8b('0x1c')](_0x0d8b('0xb'),error);ami[_0x0d8b('0x1c')](_0x0d8b('0x1d'),close);}ami['on'](_0x0d8b('0x1e'),connect);ami['on'](_0x0d8b('0x1f'),function(_0x352c17){logger['info'](util['format'](_0x0d8b('0x20'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')],util[_0x0d8b('0xe')](_0x352c17,![],null)));});ami['on'](_0x0d8b('0x21'),function(_0x221071){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x22'),config[_0x0d8b('0x5')]['username'],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port']));return BPromise[_0x0d8b('0x23')]()['then'](ami[_0x0d8b('0x10')]())[_0x0d8b('0x24')](ami[_0x0d8b('0x12')]())['then'](ami['actionSipPeerStatus']())[_0x0d8b('0x24')](ami[_0x0d8b('0x16')]())['then'](ami[_0x0d8b('0x18')]())['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x25'),util['inspect'](_0x1b2b59,{'showHidden':![],'depth':null}));});});ami[_0x0d8b('0x1c')]('error',error);ami[_0x0d8b('0x1c')]('close',close);module[_0x0d8b('0x26')]=ami; \ No newline at end of file +var _0xbaf0=['once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','exports','bluebird','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x5efecc,_0x206fd8){var _0x11a09a=function(_0x38ff08){while(--_0x38ff08){_0x5efecc['push'](_0x5efecc['shift']());}};_0x11a09a(++_0x206fd8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var _=require(_0x0baf('0x3'));var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0x0baf('0x6')][_0x0baf('0x7')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')][_0x0baf('0x9')],!![]);ami[_0x0baf('0xa')]();ami[_0x0baf('0xb')]=BPromise['promisify'](ami[_0x0baf('0xc')]);function error(_0x5f20aa){logger[_0x0baf('0xd')](util[_0x0baf('0xe')](_0x0baf('0xf'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')],util[_0x0baf('0x10')](_0x5f20aa,![],null)));}function close(){logger[_0x0baf('0xd')](util[_0x0baf('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x0baf('0xb')]({'action':'sipshowregistry'});};};ami[_0x0baf('0x11')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x12')});};};ami[_0x0baf('0x13')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x0baf('0x15')});};};ami[_0x0baf('0x16')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x17')});};};function connect(_0x2cf7da){logger[_0x0baf('0x18')](util['format'](_0x0baf('0x19'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));ami['once']('error',error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);}ami['on'](_0x0baf('0x1c'),connect);ami['on'](_0x0baf('0x1d'),function(_0x1fa92b){logger[_0x0baf('0x18')](util[_0x0baf('0xe')](_0x0baf('0x1e'),config[_0x0baf('0x6')][_0x0baf('0x8')],config['asterisk']['ip'],config[_0x0baf('0x6')]['port'],util[_0x0baf('0x10')](_0x1fa92b,![],null)));});ami['on']('fullybooted',function(_0x4de74c){logger[_0x0baf('0x18')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));return BPromise['resolve']()[_0x0baf('0x1f')](ami[_0x0baf('0x20')]())[_0x0baf('0x1f')](ami[_0x0baf('0x11')]())[_0x0baf('0x1f')](ami[_0x0baf('0x13')]())[_0x0baf('0x1f')](ami['actionQueueSummary']())[_0x0baf('0x1f')](ami[_0x0baf('0x16')]())[_0x0baf('0x21')](function(_0x265915){logger['error'](_0x0baf('0x22'),util[_0x0baf('0x10')](_0x265915,{'showHidden':![],'depth':null}));});});ami['once'](_0x0baf('0xd'),error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);module[_0x0baf('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 6c58c1f..ed6801b 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 _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x290fa6,_0x16d017){var _0x47f1f3=function(_0x2b5eb8){while(--_0x2b5eb8){_0x290fa6['push'](_0x290fa6['shift']());}};_0x47f1f3(++_0x16d017);}(_0x9bde,0xe1));var _0xe9bd=function(_0x24758c,_0x261b98){_0x24758c=_0x24758c-0x0;var _0x605918=_0x9bde[_0x24758c];return _0x605918;};'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 +var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x4d394d,_0x40e7b3){var _0x4f0003=function(_0x56d25d){while(--_0x56d25d){_0x4d394d['push'](_0x4d394d['shift']());}};_0x4f0003(++_0x40e7b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index b4aa0f3..bfd60c8 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89c9=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','prototype','getCaller','voiceQueue','dialCutDigit','substring','getQueue','lodash','moment','string','Contact','number','phone','queue','name','type','dialQueueTimeout','countbusyretry'];(function(_0x3f22fd,_0x429bb8){var _0x4678c1=function(_0x71e704){while(--_0x71e704){_0x3f22fd['push'](_0x3f22fd['shift']());}};_0x4678c1(++_0x429bb8);}(_0x89c9,0x18c));var _0x989c=function(_0x4da4ea,_0x2875d3){_0x4da4ea=_0x4da4ea-0x0;var _0x3cc102=_0x89c9[_0x4da4ea];return _0x3cc102;};'use strict';var util=require('util');var _=require(_0x989c('0x0'));var moment=require(_0x989c('0x1'));function checkNameSurname(_0x288f49,_0x8d8e10,_0x1c732d){var _0x23447d='';if(!_['isNil'](_0x8d8e10)&&_0x989c('0x2')===typeof _0x8d8e10){_0x23447d+=_0x8d8e10;}if(!_['isNil'](_0x1c732d)&&'string'===typeof _0x1c732d){_0x23447d+='\x20'+_0x1c732d;}if(_0x23447d!==''){return _0x23447d;}return _0x288f49;}function Action(_0xfb0e61,_0x191e07,_0x549b76){this['voiceQueue']=_0xfb0e61;this['uniqueid']=_0x549b76||undefined;this['name']=checkNameSurname(_0x191e07[_0x989c('0x3')]['phone'],_0x191e07[_0x989c('0x3')]['firstName'],_0x191e07['Contact']['lastName']);this[_0x989c('0x4')]=_0x191e07[_0x989c('0x5')];this[_0x989c('0x6')]=_0xfb0e61[_0x989c('0x7')];this['active']=_0x191e07['active']||![];this[_0x989c('0x8')]=_0xfb0e61['type'];this[_0x989c('0x9')]=_0xfb0e61[_0x989c('0x9')]||0x3;this['scheduledat']=_0x191e07['scheduledat'];this[_0x989c('0xa')]=_0x191e07[_0x989c('0xa')];this[_0x989c('0xb')]=_0x191e07[_0x989c('0xb')];this[_0x989c('0xc')]=_0x191e07[_0x989c('0xc')];this[_0x989c('0xd')]=_0x191e07['countnosuchnumberretry'];this[_0x989c('0xe')]=_0x191e07[_0x989c('0xe')];this[_0x989c('0xf')]=_0x191e07[_0x989c('0xf')];this[_0x989c('0x10')]=_0x191e07[_0x989c('0x10')];this['countagentrejectretry']=_0x191e07[_0x989c('0x11')];this[_0x989c('0x12')]=_0x191e07[_0x989c('0x12')];this['ListId']=_0x191e07[_0x989c('0x13')];this[_0x989c('0x14')]=_0x191e07[_0x989c('0x14')];this[_0x989c('0x15')]=_0x191e07[_0x989c('0x15')];this['CampaignId']=_0x191e07[_0x989c('0x16')];this[_0x989c('0x17')]=_0x191e07['id'];this[_0x989c('0x18')]=_0x191e07['Contact']['firstName']||'';this[_0x989c('0x19')]=moment()[_0x989c('0x1a')](_0x989c('0x1b'));this['callback']=_0x191e07['callback'];this[_0x989c('0x1c')]=_0x191e07[_0x989c('0x1c')];this[_0x989c('0x1d')]=_0x191e07[_0x989c('0x1d')];this[_0x989c('0x1e')]=_0x191e07['recallme'];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x989c('0x1f')][_0x989c('0x20')]=function(){return util[_0x989c('0x1a')]('\x22%s\x22\x20<%s>',this[_0x989c('0x7')],this[_0x989c('0x21')][_0x989c('0x22')]>0x0?this[_0x989c('0x4')][_0x989c('0x23')](this['voiceQueue']['dialCutDigit']):this[_0x989c('0x4')]);};Action['prototype'][_0x989c('0x24')]=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file +var _0x741b=['callback','callbackuniqueid','originatecalleridnum','originatecalleridname','prototype','getCaller','format','dialCutDigit','getQueue','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x741b,0x18c));var _0xb741=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x741b[_0xbb091];return _0x467a04;};'use strict';var util=require(_0xb741('0x0'));var _=require(_0xb741('0x1'));var moment=require(_0xb741('0x2'));function checkNameSurname(_0x2dc9fb,_0x5ebb8c,_0x4a323e){var _0x4a4f05='';if(!_[_0xb741('0x3')](_0x5ebb8c)&&'string'===typeof _0x5ebb8c){_0x4a4f05+=_0x5ebb8c;}if(!_[_0xb741('0x3')](_0x4a323e)&&_0xb741('0x4')===typeof _0x4a323e){_0x4a4f05+='\x20'+_0x4a323e;}if(_0x4a4f05!==''){return _0x4a4f05;}return _0x2dc9fb;}function Action(_0x144a9d,_0x1842fc,_0x3a6c27){this[_0xb741('0x5')]=_0x144a9d;this[_0xb741('0x6')]=_0x3a6c27||undefined;this[_0xb741('0x7')]=checkNameSurname(_0x1842fc[_0xb741('0x8')][_0xb741('0x9')],_0x1842fc[_0xb741('0x8')][_0xb741('0xa')],_0x1842fc[_0xb741('0x8')][_0xb741('0xb')]);this[_0xb741('0xc')]=_0x1842fc['phone'];this[_0xb741('0xd')]=_0x144a9d[_0xb741('0x7')];this[_0xb741('0xe')]=_0x1842fc['active']||![];this[_0xb741('0xf')]=_0x144a9d[_0xb741('0xf')];this['dialQueueTimeout']=_0x144a9d[_0xb741('0x10')]||0x3;this[_0xb741('0x11')]=_0x1842fc[_0xb741('0x11')];this[_0xb741('0x12')]=_0x1842fc['countbusyretry'];this[_0xb741('0x13')]=_0x1842fc[_0xb741('0x13')];this[_0xb741('0x14')]=_0x1842fc[_0xb741('0x14')];this[_0xb741('0x15')]=_0x1842fc['countnosuchnumberretry'];this['countdropretry']=_0x1842fc[_0xb741('0x16')];this[_0xb741('0x17')]=_0x1842fc[_0xb741('0x17')];this[_0xb741('0x18')]=_0x1842fc[_0xb741('0x18')];this['countagentrejectretry']=_0x1842fc[_0xb741('0x19')];this[_0xb741('0x1a')]=_0x1842fc['ContactId'];this[_0xb741('0x1b')]=_0x1842fc[_0xb741('0x1b')];this[_0xb741('0x1c')]=_0x1842fc[_0xb741('0x1c')];this['VoiceQueueId']=_0x1842fc['VoiceQueueId'];this[_0xb741('0x1d')]=_0x1842fc[_0xb741('0x1d')];this[_0xb741('0x1e')]=_0x1842fc['id'];this[_0xb741('0x1f')]=_0x1842fc[_0xb741('0x8')][_0xb741('0xa')]||'';this[_0xb741('0x20')]=moment()['format'](_0xb741('0x21'));this['callback']=_0x1842fc[_0xb741('0x22')];this[_0xb741('0x23')]=_0x1842fc['callbackuniqueid'];this['callbackat']=_0x1842fc['callbackat'];this['recallme']=_0x1842fc['recallme'];this[_0xb741('0x24')]='';this[_0xb741('0x25')]='';}Action[_0xb741('0x26')][_0xb741('0x27')]=function(){return util[_0xb741('0x28')]('\x22%s\x22\x20<%s>',this[_0xb741('0x7')],this[_0xb741('0x5')]['dialCutDigit']>0x0?this['number']['substring'](this[_0xb741('0x5')][_0xb741('0x29')]):this[_0xb741('0xc')]);};Action[_0xb741('0x26')][_0xb741('0x2a')]=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index c30095d..13f9b6c 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8313=['outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','number','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype'];(function(_0xa5856f,_0x537dd7){var _0x146ffd=function(_0x5e66a2){while(--_0x5e66a2){_0xa5856f['push'](_0xa5856f['shift']());}};_0x146ffd(++_0x537dd7);}(_0x8313,0x120));var _0x3831=function(_0x3600b7,_0xfe18e7){_0x3600b7=_0x3600b7-0x0;var _0x4d6471=_0x8313[_0x3600b7];return _0x4d6471;};'use strict';var util=require(_0x3831('0x0'));var _=require(_0x3831('0x1'));var moment=require('moment');function getSeconds(_0x5a9a51,_0x1342e0){var _0x4784f0=moment(_0x5a9a51)[_0x3831('0x2')](0x0);var _0x16403e=moment(_0x1342e0)[_0x3831('0x2')](0x0);return _0x4784f0['diff'](_0x16403e,_0x3831('0x3'));}function AdditionalPhone(_0x308e3b){this[_0x3831('0x4')]=_0x308e3b[_0x3831('0x4')];this[_0x3831('0x5')]=_0x308e3b[_0x3831('0x5')]||undefined;this[_0x3831('0x6')]=_0x308e3b[_0x3831('0x6')];this[_0x3831('0x7')]=_0x308e3b[_0x3831('0x6')]===_0x3831('0x8')?_0x3831('0x9'):_0x308e3b['type'];this['countbusyretry']=_0x308e3b['countbusyretry'];this['countcongestionretry']=_0x308e3b[_0x3831('0xa')];this['countnoanswerretry']=_0x308e3b[_0x3831('0xb')];this[_0x3831('0xc')]=_0x308e3b[_0x3831('0xd')]+_0x308e3b[_0x3831('0xa')]+_0x308e3b['countnoanswerretry']+_0x308e3b['countnosuchnumberretry']+_0x308e3b[_0x3831('0xe')]+_0x308e3b[_0x3831('0xf')]+_0x308e3b[_0x3831('0x10')]+_0x308e3b[_0x3831('0x11')];this[_0x3831('0x12')]=_0x308e3b[_0x3831('0x12')];this[_0x3831('0xe')]=_0x308e3b['countdropretry'];this[_0x3831('0xf')]=_0x308e3b[_0x3831('0xf')];this['countmachineretry']=_0x308e3b[_0x3831('0x10')];this[_0x3831('0x11')]=_0x308e3b['countagentrejectretry'];this[_0x3831('0x9')]=_0x308e3b[_0x3831('0x9')];this['calleridname']=_0x308e3b['name'];this['calleridnum']=_0x308e3b[_0x3831('0x13')];this[_0x3831('0x14')]=_0x308e3b[_0x3831('0x14')];this[_0x3831('0x15')]=_0x308e3b[_0x3831('0x15')];this[_0x3831('0x16')]=_0x308e3b[_0x3831('0x15')];this[_0x3831('0x17')]=getSeconds(_0x308e3b[_0x3831('0x15')],_0x308e3b[_0x3831('0x14')]);this[_0x3831('0x18')]=0x0;this['talktime']=0x0;this[_0x3831('0x19')]=_0x308e3b[_0x3831('0x19')];this[_0x3831('0x1a')]=_0x308e3b['callbackuniqueid'];this[_0x3831('0x1b')]=_0x308e3b[_0x3831('0x1b')];this[_0x3831('0x1c')]=_0x308e3b['recallme'];this[_0x3831('0x1d')]=_0x308e3b[_0x3831('0x1d')];this['ListId']=_0x308e3b[_0x3831('0x1e')];this[_0x3831('0x1f')]=_0x308e3b[_0x3831('0x1f')];this[_0x3831('0x20')]=_0x308e3b[_0x3831('0x20')];this[_0x3831('0x21')]=_0x308e3b['CampaignId'];this[_0x3831('0x22')]=_0x308e3b[_0x3831('0x22')]||'';this[_0x3831('0x23')]=_0x308e3b['originatecalleridname']||'';}module[_0x3831('0x24')]=History; \ No newline at end of file +var _0xad01=['outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','name','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype'];(function(_0x6bd6ba,_0x537bab){var _0x444258=function(_0x55297d){while(--_0x55297d){_0x6bd6ba['push'](_0x6bd6ba['shift']());}};_0x444258(++_0x537bab);}(_0xad01,0x1af));var _0x1ad0=function(_0x49b167,_0x2dc3e0){_0x49b167=_0x49b167-0x0;var _0x48c139=_0xad01[_0x49b167];return _0x48c139;};'use strict';var util=require(_0x1ad0('0x0'));var _=require(_0x1ad0('0x1'));var moment=require('moment');function getSeconds(_0x37120b,_0x6e2689){var _0x3684ce=moment(_0x37120b)[_0x1ad0('0x2')](0x0);var _0x4d0755=moment(_0x6e2689)[_0x1ad0('0x2')](0x0);return _0x3684ce[_0x1ad0('0x3')](_0x4d0755,_0x1ad0('0x4'));}function AdditionalPhone(_0x1134fb){this[_0x1ad0('0x5')]=_0x1134fb[_0x1ad0('0x5')];this[_0x1ad0('0x6')]=_0x1134fb[_0x1ad0('0x6')]||undefined;this['type']=_0x1134fb[_0x1ad0('0x7')];this[_0x1ad0('0x8')]=_0x1134fb[_0x1ad0('0x7')]===_0x1ad0('0x9')?'queue':_0x1134fb[_0x1ad0('0x7')];this['countbusyretry']=_0x1134fb[_0x1ad0('0xa')];this['countcongestionretry']=_0x1134fb[_0x1ad0('0xb')];this[_0x1ad0('0xc')]=_0x1134fb[_0x1ad0('0xc')];this[_0x1ad0('0xd')]=_0x1134fb['countbusyretry']+_0x1134fb[_0x1ad0('0xb')]+_0x1134fb[_0x1ad0('0xc')]+_0x1134fb[_0x1ad0('0xe')]+_0x1134fb[_0x1ad0('0xf')]+_0x1134fb[_0x1ad0('0x10')]+_0x1134fb[_0x1ad0('0x11')]+_0x1134fb[_0x1ad0('0x12')];this[_0x1ad0('0xe')]=_0x1134fb['countnosuchnumberretry'];this['countdropretry']=_0x1134fb[_0x1ad0('0xf')];this['countabandonedretry']=_0x1134fb[_0x1ad0('0x10')];this['countmachineretry']=_0x1134fb[_0x1ad0('0x11')];this['countagentrejectretry']=_0x1134fb['countagentrejectretry'];this[_0x1ad0('0x13')]=_0x1134fb['queue'];this[_0x1ad0('0x14')]=_0x1134fb[_0x1ad0('0x15')];this['calleridnum']=_0x1134fb[_0x1ad0('0x16')];this['starttime']=_0x1134fb[_0x1ad0('0x17')];this['responsetime']=_0x1134fb[_0x1ad0('0x18')];this[_0x1ad0('0x19')]=_0x1134fb[_0x1ad0('0x18')];this['ringtime']=getSeconds(_0x1134fb[_0x1ad0('0x18')],_0x1134fb['starttime']);this[_0x1ad0('0x1a')]=0x0;this[_0x1ad0('0x1b')]=0x0;this[_0x1ad0('0x1c')]=_0x1134fb[_0x1ad0('0x1c')];this['callbackuniqueid']=_0x1134fb[_0x1ad0('0x1d')];this[_0x1ad0('0x1e')]=_0x1134fb[_0x1ad0('0x1e')];this[_0x1ad0('0x1f')]=_0x1134fb['recallme'];this[_0x1ad0('0x20')]=_0x1134fb[_0x1ad0('0x20')];this[_0x1ad0('0x21')]=_0x1134fb[_0x1ad0('0x21')];this[_0x1ad0('0x22')]=_0x1134fb[_0x1ad0('0x22')];this[_0x1ad0('0x23')]=_0x1134fb['VoiceQueueId'];this[_0x1ad0('0x24')]=_0x1134fb[_0x1ad0('0x24')];this['originatecalleridnum']=_0x1134fb[_0x1ad0('0x25')]||'';this['originatecalleridname']=_0x1134fb[_0x1ad0('0x26')]||'';}module[_0x1ad0('0x27')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index df9de34..1f67022 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c55=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','answertime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','state','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name','number','starttime','responsetime'];(function(_0x2bb597,_0x48d81a){var _0x2b6539=function(_0xe1f5a8){while(--_0xe1f5a8){_0x2bb597['push'](_0x2bb597['shift']());}};_0x2b6539(++_0x48d81a);}(_0x9c55,0x6e));var _0x59c5=function(_0x353c53,_0x2102c0){_0x353c53=_0x353c53-0x0;var _0x2c55da=_0x9c55[_0x353c53];return _0x2c55da;};'use strict';var util=require(_0x59c5('0x0'));var _=require(_0x59c5('0x1'));var moment=require(_0x59c5('0x2'));function getSeconds(_0x35e6d5,_0x3c5840){var _0x6b6e2f=moment(_0x35e6d5)[_0x59c5('0x3')](0x0);var _0x3bc44b=moment(_0x3c5840)[_0x59c5('0x3')](0x0);return _0x6b6e2f[_0x59c5('0x4')](_0x3bc44b,'seconds');}function AgentComplete(_0x2f1783,_0x1c9cd3){this[_0x59c5('0x5')]=0x4;this['statedesc']=_0x59c5('0x6');this[_0x59c5('0x7')]=_0x2f1783[_0x59c5('0x7')];this[_0x59c5('0x8')]=_0x2f1783[_0x59c5('0x8')];this['campaigntype']=_0x2f1783[_0x59c5('0x8')]===_0x59c5('0x9')?_0x59c5('0xa'):_0x2f1783[_0x59c5('0x8')];this[_0x59c5('0xb')]=_0x2f1783[_0x59c5('0xb')];this[_0x59c5('0xc')]=_0x2f1783['countcongestionretry'];this[_0x59c5('0xd')]=_0x2f1783[_0x59c5('0xd')];this[_0x59c5('0xe')]=_0x2f1783[_0x59c5('0xb')]+_0x2f1783[_0x59c5('0xc')]+_0x2f1783[_0x59c5('0xd')]+_0x2f1783[_0x59c5('0xf')]+_0x2f1783[_0x59c5('0x10')]+_0x2f1783[_0x59c5('0x11')]+_0x2f1783['countmachineretry']+_0x2f1783[_0x59c5('0x12')];this[_0x59c5('0xf')]=_0x2f1783[_0x59c5('0xf')];this['countdropretry']=_0x2f1783['countdropretry'];this[_0x59c5('0x11')]=_0x2f1783[_0x59c5('0x11')];this[_0x59c5('0x13')]=_0x2f1783[_0x59c5('0x13')];this[_0x59c5('0x12')]=_0x2f1783['countagentrejectretry'];this[_0x59c5('0x14')]=_0x1c9cd3[_0x59c5('0x14')];this['calleridname']=_0x2f1783[_0x59c5('0x15')];this['calleridnum']=_0x2f1783[_0x59c5('0x16')];this[_0x59c5('0x17')]=_0x2f1783[_0x59c5('0x17')];this[_0x59c5('0x18')]=_0x2f1783[_0x59c5('0x18')];this['answertime']=_0x2f1783['answertime'];this[_0x59c5('0x19')]=moment()[_0x59c5('0x1a')](_0x59c5('0x1b'));this[_0x59c5('0x1c')]=getSeconds(_0x2f1783[_0x59c5('0x18')],_0x2f1783[_0x59c5('0x17')]);this[_0x59c5('0x1d')]=getSeconds(_0x2f1783[_0x59c5('0x1e')],_0x2f1783[_0x59c5('0x18')]);this[_0x59c5('0x1f')]=getSeconds(this[_0x59c5('0x19')],_0x2f1783[_0x59c5('0x1e')]);this[_0x59c5('0xa')]=_0x1c9cd3[_0x59c5('0xa')];this[_0x59c5('0x20')]=_0x1c9cd3[_0x59c5('0x20')];this[_0x59c5('0x21')]=_0x1c9cd3[_0x59c5('0x21')];this[_0x59c5('0x22')]=_0x2f1783['callback'];this['callbackuniqueid']=_0x2f1783[_0x59c5('0x23')];this[_0x59c5('0x24')]=_0x2f1783['callbackat'];this['recallme']=_0x2f1783[_0x59c5('0x25')];this['ContactId']=_0x2f1783[_0x59c5('0x26')];this['ListId']=_0x2f1783[_0x59c5('0x27')];this['UserId']=_0x2f1783[_0x59c5('0x28')];this[_0x59c5('0x29')]=_0x2f1783[_0x59c5('0x29')];this[_0x59c5('0x2a')]=_0x2f1783['CampaignId'];this['originatecalleridnum']=_0x2f1783[_0x59c5('0x2b')]||'';this[_0x59c5('0x2c')]=_0x2f1783[_0x59c5('0x2c')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0xc580=['Answer','scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countbusyretry','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','uniqueid','name','number','starttime','responsetime','answertime','endtime','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','state'];(function(_0x177d5,_0xf7e83d){var _0x4774aa=function(_0x5a8a02){while(--_0x5a8a02){_0x177d5['push'](_0x177d5['shift']());}};_0x4774aa(++_0xf7e83d);}(_0xc580,0xa6));var _0x0c58=function(_0xb40216,_0x4661b9){_0xb40216=_0xb40216-0x0;var _0x44f553=_0xc580[_0xb40216];return _0x44f553;};'use strict';var util=require('util');var _=require(_0x0c58('0x0'));var moment=require(_0x0c58('0x1'));function getSeconds(_0x14bfcf,_0x303c09){var _0x25cb34=moment(_0x14bfcf)[_0x0c58('0x2')](0x0);var _0x1ccfb3=moment(_0x303c09)[_0x0c58('0x2')](0x0);return _0x25cb34[_0x0c58('0x3')](_0x1ccfb3,_0x0c58('0x4'));}function AgentComplete(_0x4672b8,_0x306b66){this[_0x0c58('0x5')]=0x4;this['statedesc']=_0x0c58('0x6');this[_0x0c58('0x7')]=_0x4672b8[_0x0c58('0x7')];this[_0x0c58('0x8')]=_0x4672b8[_0x0c58('0x8')];this['campaigntype']=_0x4672b8[_0x0c58('0x8')]===_0x0c58('0x9')?_0x0c58('0xa'):_0x4672b8[_0x0c58('0x8')];this['countbusyretry']=_0x4672b8['countbusyretry'];this[_0x0c58('0xb')]=_0x4672b8[_0x0c58('0xb')];this[_0x0c58('0xc')]=_0x4672b8['countnoanswerretry'];this['countglobal']=_0x4672b8[_0x0c58('0xd')]+_0x4672b8[_0x0c58('0xb')]+_0x4672b8['countnoanswerretry']+_0x4672b8[_0x0c58('0xe')]+_0x4672b8['countdropretry']+_0x4672b8[_0x0c58('0xf')]+_0x4672b8['countmachineretry']+_0x4672b8['countagentrejectretry'];this[_0x0c58('0xe')]=_0x4672b8[_0x0c58('0xe')];this['countdropretry']=_0x4672b8[_0x0c58('0x10')];this[_0x0c58('0xf')]=_0x4672b8[_0x0c58('0xf')];this['countmachineretry']=_0x4672b8[_0x0c58('0x11')];this[_0x0c58('0x12')]=_0x4672b8[_0x0c58('0x12')];this['uniqueid']=_0x306b66[_0x0c58('0x13')];this['calleridname']=_0x4672b8[_0x0c58('0x14')];this['calleridnum']=_0x4672b8[_0x0c58('0x15')];this[_0x0c58('0x16')]=_0x4672b8[_0x0c58('0x16')];this[_0x0c58('0x17')]=_0x4672b8[_0x0c58('0x17')];this[_0x0c58('0x18')]=_0x4672b8[_0x0c58('0x18')];this[_0x0c58('0x19')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0c58('0x1a')]=getSeconds(_0x4672b8[_0x0c58('0x17')],_0x4672b8[_0x0c58('0x16')]);this[_0x0c58('0x1b')]=getSeconds(_0x4672b8['answertime'],_0x4672b8['responsetime']);this[_0x0c58('0x1c')]=getSeconds(this[_0x0c58('0x19')],_0x4672b8[_0x0c58('0x18')]);this[_0x0c58('0xa')]=_0x306b66[_0x0c58('0xa')];this[_0x0c58('0x1d')]=_0x306b66[_0x0c58('0x1d')];this[_0x0c58('0x1e')]=_0x306b66['reason'];this[_0x0c58('0x1f')]=_0x4672b8[_0x0c58('0x1f')];this[_0x0c58('0x20')]=_0x4672b8[_0x0c58('0x20')];this[_0x0c58('0x21')]=_0x4672b8[_0x0c58('0x21')];this[_0x0c58('0x22')]=_0x4672b8['recallme'];this[_0x0c58('0x23')]=_0x4672b8[_0x0c58('0x23')];this[_0x0c58('0x24')]=_0x4672b8[_0x0c58('0x24')];this[_0x0c58('0x25')]=_0x4672b8['UserId'];this['VoiceQueueId']=_0x4672b8[_0x0c58('0x26')];this[_0x0c58('0x27')]=_0x4672b8[_0x0c58('0x27')];this[_0x0c58('0x28')]=_0x4672b8['originatecalleridnum']||'';this[_0x0c58('0x29')]=_0x4672b8['originatecalleridname']||'';}module[_0x0c58('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 0c0714d..00289ee 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca9e=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','calleridname','calleridnum','responsetime','endtime','ringtime'];(function(_0x3a41cf,_0xc08ce4){var _0x75e5b0=function(_0x828bd4){while(--_0x828bd4){_0x3a41cf['push'](_0x3a41cf['shift']());}};_0x75e5b0(++_0xc08ce4);}(_0xca9e,0x136));var _0xeca9=function(_0x43711f,_0x457b90){_0x43711f=_0x43711f-0x0;var _0x513b81=_0xca9e[_0x43711f];return _0x513b81;};'use strict';var util=require(_0xeca9('0x0'));var _=require(_0xeca9('0x1'));var moment=require(_0xeca9('0x2'));function getSeconds(_0x1c579d,_0x2df937){var _0x1443e3=moment(_0x1c579d)[_0xeca9('0x3')](0x0);var _0x2c6185=moment(_0x2df937)[_0xeca9('0x3')](0x0);return _0x1443e3[_0xeca9('0x4')](_0x2c6185,_0xeca9('0x5'));}function Final(_0x1c4ce6){this[_0xeca9('0x6')]=_0x1c4ce6[_0xeca9('0x6')];this['scheduledat']=_0x1c4ce6[_0xeca9('0x7')];this[_0xeca9('0x8')]=_0x1c4ce6['type'];this['campaigntype']=_0x1c4ce6[_0xeca9('0x8')]===_0xeca9('0x9')?_0xeca9('0xa'):_0x1c4ce6['type'];this[_0xeca9('0xb')]=_0x1c4ce6[_0xeca9('0xb')];this[_0xeca9('0xc')]=_0x1c4ce6[_0xeca9('0xc')];this[_0xeca9('0xd')]=_0x1c4ce6[_0xeca9('0xd')];this['countglobal']=_0x1c4ce6[_0xeca9('0xb')]+_0x1c4ce6[_0xeca9('0xc')]+_0x1c4ce6['countnoanswerretry']+_0x1c4ce6[_0xeca9('0xe')]+_0x1c4ce6['countdropretry']+_0x1c4ce6[_0xeca9('0xf')]+_0x1c4ce6[_0xeca9('0x10')]+_0x1c4ce6['countagentrejectretry'];this[_0xeca9('0xe')]=_0x1c4ce6[_0xeca9('0xe')];this[_0xeca9('0x11')]=_0x1c4ce6['countdropretry'];this[_0xeca9('0xf')]=_0x1c4ce6[_0xeca9('0xf')];this[_0xeca9('0x10')]=_0x1c4ce6[_0xeca9('0x10')];this['countagentrejectretry']=_0x1c4ce6['countagentrejectretry'];this[_0xeca9('0xa')]=_0x1c4ce6[_0xeca9('0xa')];this['calleridname']=_0x1c4ce6[_0xeca9('0x12')];this[_0xeca9('0x13')]=_0x1c4ce6['calleridnum'];this['starttime']=_0x1c4ce6['starttime'];this[_0xeca9('0x14')]=_0x1c4ce6[_0xeca9('0x14')];this[_0xeca9('0x15')]=_0x1c4ce6['responsetime'];this[_0xeca9('0x16')]=_0x1c4ce6['ringtime']||0x0;this['holdtime']=_0x1c4ce6[_0xeca9('0x17')]||0x0;this['talktime']=_0x1c4ce6[_0xeca9('0x18')]||0x0;this[_0xeca9('0x19')]=_0x1c4ce6['callback'];this[_0xeca9('0x1a')]=_0x1c4ce6[_0xeca9('0x1a')];this['callbackat']=_0x1c4ce6[_0xeca9('0x1b')];this['recallme']=_0x1c4ce6[_0xeca9('0x1c')];this[_0xeca9('0x1d')]=_0x1c4ce6[_0xeca9('0x1d')];this['ListId']=_0x1c4ce6[_0xeca9('0x1e')];this[_0xeca9('0x1f')]=_0x1c4ce6['UserId'];this[_0xeca9('0x20')]=_0x1c4ce6[_0xeca9('0x20')];this[_0xeca9('0x21')]=_0x1c4ce6[_0xeca9('0x21')];this['originatecalleridnum']=_0x1c4ce6[_0xeca9('0x22')]||'';this['originatecalleridname']=_0x1c4ce6[_0xeca9('0x23')]||'';}module[_0xeca9('0x24')]=Final; \ No newline at end of file +var _0x7579=['endtime','ringtime','holdtime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime'];(function(_0x5ed6e1,_0x1a7656){var _0x4dd4c2=function(_0x47bc89){while(--_0x47bc89){_0x5ed6e1['push'](_0x5ed6e1['shift']());}};_0x4dd4c2(++_0x1a7656);}(_0x7579,0x1e2));var _0x9757=function(_0x12d9ff,_0x2847a0){_0x12d9ff=_0x12d9ff-0x0;var _0x3c0a7e=_0x7579[_0x12d9ff];return _0x3c0a7e;};'use strict';var util=require(_0x9757('0x0'));var _=require(_0x9757('0x1'));var moment=require(_0x9757('0x2'));function getSeconds(_0x30eeec,_0x2e6afa){var _0x304b14=moment(_0x30eeec)['milliseconds'](0x0);var _0x399165=moment(_0x2e6afa)[_0x9757('0x3')](0x0);return _0x304b14[_0x9757('0x4')](_0x399165,_0x9757('0x5'));}function Final(_0x4c1a67){this[_0x9757('0x6')]=_0x4c1a67[_0x9757('0x6')];this[_0x9757('0x7')]=_0x4c1a67['scheduledat'];this[_0x9757('0x8')]=_0x4c1a67['type'];this[_0x9757('0x9')]=_0x4c1a67[_0x9757('0x8')]===_0x9757('0xa')?'queue':_0x4c1a67[_0x9757('0x8')];this[_0x9757('0xb')]=_0x4c1a67[_0x9757('0xb')];this[_0x9757('0xc')]=_0x4c1a67[_0x9757('0xc')];this[_0x9757('0xd')]=_0x4c1a67[_0x9757('0xd')];this[_0x9757('0xe')]=_0x4c1a67[_0x9757('0xb')]+_0x4c1a67[_0x9757('0xc')]+_0x4c1a67[_0x9757('0xd')]+_0x4c1a67['countnosuchnumberretry']+_0x4c1a67[_0x9757('0xf')]+_0x4c1a67[_0x9757('0x10')]+_0x4c1a67[_0x9757('0x11')]+_0x4c1a67['countagentrejectretry'];this[_0x9757('0x12')]=_0x4c1a67[_0x9757('0x12')];this[_0x9757('0xf')]=_0x4c1a67[_0x9757('0xf')];this[_0x9757('0x10')]=_0x4c1a67[_0x9757('0x10')];this[_0x9757('0x11')]=_0x4c1a67['countmachineretry'];this[_0x9757('0x13')]=_0x4c1a67['countagentrejectretry'];this[_0x9757('0x14')]=_0x4c1a67[_0x9757('0x14')];this[_0x9757('0x15')]=_0x4c1a67[_0x9757('0x15')];this[_0x9757('0x16')]=_0x4c1a67[_0x9757('0x16')];this['starttime']=_0x4c1a67[_0x9757('0x17')];this[_0x9757('0x18')]=_0x4c1a67[_0x9757('0x18')];this[_0x9757('0x19')]=_0x4c1a67[_0x9757('0x18')];this[_0x9757('0x1a')]=_0x4c1a67[_0x9757('0x1a')]||0x0;this['holdtime']=_0x4c1a67[_0x9757('0x1b')]||0x0;this['talktime']=_0x4c1a67['talktime']||0x0;this[_0x9757('0x1c')]=_0x4c1a67[_0x9757('0x1c')];this[_0x9757('0x1d')]=_0x4c1a67[_0x9757('0x1d')];this['callbackat']=_0x4c1a67['callbackat'];this['recallme']=_0x4c1a67[_0x9757('0x1e')];this[_0x9757('0x1f')]=_0x4c1a67[_0x9757('0x1f')];this[_0x9757('0x20')]=_0x4c1a67['ListId'];this[_0x9757('0x21')]=_0x4c1a67[_0x9757('0x21')];this['VoiceQueueId']=_0x4c1a67[_0x9757('0x22')];this[_0x9757('0x23')]=_0x4c1a67['CampaignId'];this[_0x9757('0x24')]=_0x4c1a67[_0x9757('0x24')]||'';this[_0x9757('0x25')]=_0x4c1a67[_0x9757('0x25')]||'';}module[_0x9757('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 4ceca9f..5c5f82b 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4cf=['VoiceQueueId','CampaignId','moment','milliseconds','diff','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','endtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x1f2ef9,_0x39b473){var _0x5d3905=function(_0x30c284){while(--_0x30c284){_0x1f2ef9['push'](_0x1f2ef9['shift']());}};_0x5d3905(++_0x39b473);}(_0xc4cf,0x121));var _0xfc4c=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xc4cf[_0x4ed520];return _0x4415a6;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xfc4c('0x0'));function getSeconds(_0x1ce302,_0x3dc977){var _0x44b0a4=moment(_0x1ce302)[_0xfc4c('0x1')](0x0);var _0x59366b=moment(_0x3dc977)[_0xfc4c('0x1')](0x0);return _0x44b0a4[_0xfc4c('0x2')](_0x59366b,'seconds');}function Hangup(_0x5dbb6e,_0x41b536){this['state']=0x4;this[_0xfc4c('0x3')]=_0xfc4c('0x4');this[_0xfc4c('0x5')]=_0x5dbb6e[_0xfc4c('0x5')];this[_0xfc4c('0x6')]=_0x5dbb6e[_0xfc4c('0x6')];this[_0xfc4c('0x7')]=_0x5dbb6e[_0xfc4c('0x6')]===_0xfc4c('0x8')?_0xfc4c('0x9'):_0x5dbb6e[_0xfc4c('0x6')];this[_0xfc4c('0xa')]=_0x5dbb6e['countbusyretry'];this[_0xfc4c('0xb')]=_0x5dbb6e[_0xfc4c('0xb')];this['countnoanswerretry']=_0x5dbb6e[_0xfc4c('0xc')];this[_0xfc4c('0xd')]=_0x5dbb6e[_0xfc4c('0xa')]+_0x5dbb6e[_0xfc4c('0xb')]+_0x5dbb6e['countnoanswerretry']+_0x5dbb6e[_0xfc4c('0xe')]+_0x5dbb6e['countdropretry']+_0x5dbb6e['countabandonedretry']+_0x5dbb6e['countmachineretry']+_0x5dbb6e['countagentrejectretry'];this['countnosuchnumberretry']=_0x5dbb6e[_0xfc4c('0xe')];this['countdropretry']=_0x5dbb6e[_0xfc4c('0xf')];this[_0xfc4c('0x10')]=_0x5dbb6e['countabandonedretry'];this[_0xfc4c('0x11')]=_0x5dbb6e[_0xfc4c('0x11')];this[_0xfc4c('0x12')]=_0x5dbb6e['countagentrejectretry'];this[_0xfc4c('0x13')]=_0x41b536['uniqueid'];this['calleridname']=_0x5dbb6e['name'];this[_0xfc4c('0x14')]=_0x5dbb6e[_0xfc4c('0x15')];this[_0xfc4c('0x16')]=_0x5dbb6e[_0xfc4c('0x16')];this[_0xfc4c('0x17')]=_0x5dbb6e[_0xfc4c('0x17')];this['endtime']=moment()['format'](_0xfc4c('0x18'));this[_0xfc4c('0x19')]=getSeconds(_0x5dbb6e[_0xfc4c('0x17')],_0x5dbb6e[_0xfc4c('0x16')]);this['holdtime']=0x0;this[_0xfc4c('0x1a')]=getSeconds(this[_0xfc4c('0x1b')],_0x5dbb6e['responsetime']);this[_0xfc4c('0x9')]=_0x5dbb6e[_0xfc4c('0x9')];this[_0xfc4c('0x1c')]=_0xfc4c('0x1d');this[_0xfc4c('0x1e')]=_0x41b536[_0xfc4c('0x1f')];this[_0xfc4c('0x20')]=_0x5dbb6e['callback'];this[_0xfc4c('0x21')]=_0x5dbb6e[_0xfc4c('0x21')];this[_0xfc4c('0x22')]=_0x5dbb6e[_0xfc4c('0x22')];this[_0xfc4c('0x23')]=_0x5dbb6e['recallme'];this['ContactId']=_0x5dbb6e[_0xfc4c('0x24')];this[_0xfc4c('0x25')]=_0x5dbb6e[_0xfc4c('0x25')];this[_0xfc4c('0x26')]=_0x5dbb6e[_0xfc4c('0x26')];this['VoiceQueueId']=_0x5dbb6e[_0xfc4c('0x27')];this['CampaignId']=_0x5dbb6e[_0xfc4c('0x28')];}module['exports']=Hangup; \ No newline at end of file +var _0x5329=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','cause-txt'];(function(_0x1e3b89,_0x48c27a){var _0x2edce2=function(_0x36eadd){while(--_0x36eadd){_0x1e3b89['push'](_0x1e3b89['shift']());}};_0x2edce2(++_0x48c27a);}(_0x5329,0x8d));var _0x9532=function(_0x3d1fd8,_0x2421fc){_0x3d1fd8=_0x3d1fd8-0x0;var _0x1c9984=_0x5329[_0x3d1fd8];return _0x1c9984;};'use strict';var util=require(_0x9532('0x0'));var _=require(_0x9532('0x1'));var moment=require(_0x9532('0x2'));function getSeconds(_0x212cf7,_0x387f95){var _0x35899b=moment(_0x212cf7)[_0x9532('0x3')](0x0);var _0x453d21=moment(_0x387f95)[_0x9532('0x3')](0x0);return _0x35899b[_0x9532('0x4')](_0x453d21,'seconds');}function Hangup(_0x4f05b7,_0x1b2c35){this[_0x9532('0x5')]=0x4;this[_0x9532('0x6')]=_0x9532('0x7');this[_0x9532('0x8')]=_0x4f05b7[_0x9532('0x8')];this[_0x9532('0x9')]=_0x4f05b7[_0x9532('0x9')];this[_0x9532('0xa')]=_0x4f05b7[_0x9532('0x9')]===_0x9532('0xb')?_0x9532('0xc'):_0x4f05b7[_0x9532('0x9')];this[_0x9532('0xd')]=_0x4f05b7[_0x9532('0xd')];this['countcongestionretry']=_0x4f05b7[_0x9532('0xe')];this[_0x9532('0xf')]=_0x4f05b7[_0x9532('0xf')];this[_0x9532('0x10')]=_0x4f05b7[_0x9532('0xd')]+_0x4f05b7['countcongestionretry']+_0x4f05b7['countnoanswerretry']+_0x4f05b7[_0x9532('0x11')]+_0x4f05b7[_0x9532('0x12')]+_0x4f05b7[_0x9532('0x13')]+_0x4f05b7[_0x9532('0x14')]+_0x4f05b7['countagentrejectretry'];this[_0x9532('0x11')]=_0x4f05b7['countnosuchnumberretry'];this['countdropretry']=_0x4f05b7[_0x9532('0x12')];this[_0x9532('0x13')]=_0x4f05b7[_0x9532('0x13')];this[_0x9532('0x14')]=_0x4f05b7[_0x9532('0x14')];this['countagentrejectretry']=_0x4f05b7[_0x9532('0x15')];this['uniqueid']=_0x1b2c35[_0x9532('0x16')];this[_0x9532('0x17')]=_0x4f05b7[_0x9532('0x18')];this[_0x9532('0x19')]=_0x4f05b7['number'];this[_0x9532('0x1a')]=_0x4f05b7[_0x9532('0x1a')];this[_0x9532('0x1b')]=_0x4f05b7[_0x9532('0x1b')];this[_0x9532('0x1c')]=moment()[_0x9532('0x1d')](_0x9532('0x1e'));this[_0x9532('0x1f')]=getSeconds(_0x4f05b7[_0x9532('0x1b')],_0x4f05b7[_0x9532('0x1a')]);this['holdtime']=0x0;this[_0x9532('0x20')]=getSeconds(this[_0x9532('0x1c')],_0x4f05b7[_0x9532('0x1b')]);this[_0x9532('0xc')]=_0x4f05b7[_0x9532('0xc')];this[_0x9532('0x21')]='IVR';this['reason']=_0x1b2c35[_0x9532('0x22')];this['callback']=_0x4f05b7['callback'];this[_0x9532('0x23')]=_0x4f05b7[_0x9532('0x23')];this[_0x9532('0x24')]=_0x4f05b7[_0x9532('0x24')];this[_0x9532('0x25')]=_0x4f05b7['recallme'];this[_0x9532('0x26')]=_0x4f05b7[_0x9532('0x26')];this[_0x9532('0x27')]=_0x4f05b7['ListId'];this[_0x9532('0x28')]=_0x4f05b7[_0x9532('0x28')];this[_0x9532('0x29')]=_0x4f05b7[_0x9532('0x29')];this[_0x9532('0x2a')]=_0x4f05b7['CampaignId'];}module[_0x9532('0x2b')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 4096049..953d9ad 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4357=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','responsetime','endtime','ringtime','starttime','holdtime','callback','callbackat','recallme'];(function(_0x2136a6,_0x35af63){var _0x55b948=function(_0x288a75){while(--_0x288a75){_0x2136a6['push'](_0x2136a6['shift']());}};_0x55b948(++_0x35af63);}(_0x4357,0x142));var _0x7435=function(_0x3c80e8,_0x2bb4ff){_0x3c80e8=_0x3c80e8-0x0;var _0xe57191=_0x4357[_0x3c80e8];return _0xe57191;};'use strict';var util=require('util');var _=require(_0x7435('0x0'));var moment=require('moment');function getSeconds(_0x252164,_0x41d6f9){var _0x48d14e=moment(_0x252164)[_0x7435('0x1')](0x0);var _0xb9d4e1=moment(_0x41d6f9)[_0x7435('0x1')](0x0);return _0x48d14e[_0x7435('0x2')](_0xb9d4e1,_0x7435('0x3'));}function History(_0x23f54a){this[_0x7435('0x4')]=_0x23f54a[_0x7435('0x4')];this[_0x7435('0x5')]=_0x23f54a[_0x7435('0x5')]||undefined;this['type']=_0x23f54a[_0x7435('0x6')];this['campaigntype']=_0x23f54a[_0x7435('0x6')]===_0x7435('0x7')?_0x7435('0x8'):_0x23f54a[_0x7435('0x6')];this['countbusyretry']=_0x23f54a[_0x7435('0x9')];this['countcongestionretry']=_0x23f54a[_0x7435('0xa')];this[_0x7435('0xb')]=_0x23f54a['countnoanswerretry'];this['countglobal']=_0x23f54a[_0x7435('0x9')]+_0x23f54a['countcongestionretry']+_0x23f54a['countnoanswerretry']+_0x23f54a[_0x7435('0xc')]+_0x23f54a[_0x7435('0xd')]+_0x23f54a[_0x7435('0xe')]+_0x23f54a[_0x7435('0xf')]+_0x23f54a[_0x7435('0x10')];this[_0x7435('0xc')]=_0x23f54a[_0x7435('0xc')];this[_0x7435('0xd')]=_0x23f54a[_0x7435('0xd')];this[_0x7435('0xe')]=_0x23f54a['countabandonedretry'];this['countmachineretry']=_0x23f54a[_0x7435('0xf')];this[_0x7435('0x10')]=_0x23f54a['countagentrejectretry'];this['queue']=_0x23f54a['queue'];this[_0x7435('0x11')]=_0x23f54a['name'];this[_0x7435('0x12')]=_0x23f54a[_0x7435('0x13')];this['starttime']=_0x23f54a['starttime'];this['responsetime']=_0x23f54a[_0x7435('0x14')];this[_0x7435('0x15')]=_0x23f54a[_0x7435('0x14')];this[_0x7435('0x16')]=getSeconds(_0x23f54a[_0x7435('0x14')],_0x23f54a[_0x7435('0x17')]);this[_0x7435('0x18')]=0x0;this['talktime']=0x0;this[_0x7435('0x19')]=_0x23f54a[_0x7435('0x19')];this['callbackuniqueid']=_0x23f54a['callbackuniqueid'];this[_0x7435('0x1a')]=_0x23f54a[_0x7435('0x1a')];this[_0x7435('0x1b')]=_0x23f54a[_0x7435('0x1b')];this[_0x7435('0x1c')]=_0x23f54a['ContactId'];this[_0x7435('0x1d')]=_0x23f54a[_0x7435('0x1d')];this['UserId']=_0x23f54a[_0x7435('0x1e')];this[_0x7435('0x1f')]=_0x23f54a['VoiceQueueId'];this[_0x7435('0x20')]=_0x23f54a[_0x7435('0x20')];this[_0x7435('0x21')]=_0x23f54a[_0x7435('0x21')]||'';this[_0x7435('0x22')]=_0x23f54a[_0x7435('0x22')]||'';}module['exports']=History; \ No newline at end of file +var _0x5392=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countmachineretry','name','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x5f0c50,_0x3c3101){var _0x5112a0=function(_0x1d5f99){while(--_0x1d5f99){_0x5f0c50['push'](_0x5f0c50['shift']());}};_0x5112a0(++_0x3c3101);}(_0x5392,0x9a));var _0x2539=function(_0x5aca54,_0x5d4def){_0x5aca54=_0x5aca54-0x0;var _0x2a0610=_0x5392[_0x5aca54];return _0x2a0610;};'use strict';var util=require(_0x2539('0x0'));var _=require('lodash');var moment=require(_0x2539('0x1'));function getSeconds(_0x5988a5,_0x541de7){var _0x30ac7e=moment(_0x5988a5)[_0x2539('0x2')](0x0);var _0x3da213=moment(_0x541de7)['milliseconds'](0x0);return _0x30ac7e[_0x2539('0x3')](_0x3da213,_0x2539('0x4'));}function History(_0x24c09d){this[_0x2539('0x5')]=_0x24c09d[_0x2539('0x5')];this[_0x2539('0x6')]=_0x24c09d[_0x2539('0x6')]||undefined;this[_0x2539('0x7')]=_0x24c09d['type'];this['campaigntype']=_0x24c09d[_0x2539('0x7')]==='outbound'?_0x2539('0x8'):_0x24c09d[_0x2539('0x7')];this[_0x2539('0x9')]=_0x24c09d[_0x2539('0x9')];this[_0x2539('0xa')]=_0x24c09d[_0x2539('0xa')];this[_0x2539('0xb')]=_0x24c09d[_0x2539('0xb')];this['countglobal']=_0x24c09d[_0x2539('0x9')]+_0x24c09d[_0x2539('0xa')]+_0x24c09d['countnoanswerretry']+_0x24c09d[_0x2539('0xc')]+_0x24c09d[_0x2539('0xd')]+_0x24c09d['countabandonedretry']+_0x24c09d['countmachineretry']+_0x24c09d[_0x2539('0xe')];this[_0x2539('0xc')]=_0x24c09d['countnosuchnumberretry'];this['countdropretry']=_0x24c09d[_0x2539('0xd')];this['countabandonedretry']=_0x24c09d['countabandonedretry'];this['countmachineretry']=_0x24c09d[_0x2539('0xf')];this[_0x2539('0xe')]=_0x24c09d[_0x2539('0xe')];this[_0x2539('0x8')]=_0x24c09d[_0x2539('0x8')];this['calleridname']=_0x24c09d[_0x2539('0x10')];this[_0x2539('0x11')]=_0x24c09d[_0x2539('0x12')];this[_0x2539('0x13')]=_0x24c09d['starttime'];this[_0x2539('0x14')]=_0x24c09d['responsetime'];this[_0x2539('0x15')]=_0x24c09d[_0x2539('0x14')];this['ringtime']=getSeconds(_0x24c09d['responsetime'],_0x24c09d[_0x2539('0x13')]);this[_0x2539('0x16')]=0x0;this[_0x2539('0x17')]=0x0;this[_0x2539('0x18')]=_0x24c09d[_0x2539('0x18')];this[_0x2539('0x19')]=_0x24c09d[_0x2539('0x19')];this[_0x2539('0x1a')]=_0x24c09d['callbackat'];this[_0x2539('0x1b')]=_0x24c09d[_0x2539('0x1b')];this['ContactId']=_0x24c09d[_0x2539('0x1c')];this[_0x2539('0x1d')]=_0x24c09d[_0x2539('0x1d')];this[_0x2539('0x1e')]=_0x24c09d['UserId'];this[_0x2539('0x1f')]=_0x24c09d['VoiceQueueId'];this[_0x2539('0x20')]=_0x24c09d[_0x2539('0x20')];this[_0x2539('0x21')]=_0x24c09d[_0x2539('0x21')]||'';this[_0x2539('0x22')]=_0x24c09d['originatecalleridname']||'';}module[_0x2539('0x23')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index edab735..dc0a6af 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 _0x89a2=['dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','CampaignId','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','membername','countabandonedretry','createStateFinal','add','[syncHangupIvr]','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','cause-txt','Unknow','[syncHangupIvr][createHistory]','reason','agent','dialQueueProject2','[syncAgentComplete][createHistory]','syncAgentConnect','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','agiafterat','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','actionid','stateinterface','locked','push','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','Failure','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','content','command','indexOf','true','all','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','dialMethod','progressive','power','handlePower','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','handleIvr','checkIsTrunkReachable','dialTimezone','checkIfTimeIntervals','checkDialMethod','[syncQueueSummary]','dialPreviewRecallmeReminder','syncCampaigns','dialGlobalInterval','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','Contact','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','SIP/%s/%s%s','dialPrefix','substring','dialCutDigit','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','response','callProgressDetecting','checkRetriveMax','countbusyretry','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','dialBusyMaxRetry','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','floor','predictiveIntervalHitRate','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','available','busyFactor','[getDataPredictive]','Unknown\x20Predictive','outboundQueuePauses','[CatchErlangB]','check\x20failure','one\x20call\x20every:','[handlePredictive]','UserId','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','maxNumberOriginate','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','[countReScheduled]\x20','ACTIVE','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','abandonmentRate','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','bluebird','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperAdditionalPhone','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','channels','contactsId','optionPredictive','startPredictive','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','message','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','predictiveIntervalAvgTalktime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','stack','inspect','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','uniqueId','[uniqueid]','actions','[actions]','isNil','Action','status','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','checkIsBlackList','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','VoiceQueueId','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','variable','exten','xcally-motion-dialer','HANGUP','HangupInAMD','custom:amd','buildObj','amd','[syncHangupInAMD]','dialAMDActive','value','MACHINE','uniqueid','Machine','AMD','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countcongestionretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0x89a2,0x127));var _0x289a=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0x89a2[_0x35a140];return _0x30ab82;};'use strict';var util=require(_0x289a('0x0'));var _=require('lodash');var BPromise=require(_0x289a('0x1'));var uuid=require('uuid');var moment=require(_0x289a('0x2'));var rr=require('rr');var md5=require(_0x289a('0x3'));var Redis=require(_0x289a('0x4'));var ut=require('../preview/util/util');var config=require(_0x289a('0x5'));var logger=require(_0x289a('0x6'))(_0x289a('0x7'));var loggerBooked=require('../../../config/logger')(_0x289a('0x8'));var loggerPredictive=require(_0x289a('0x6'))(_0x289a('0x9'));var loggerPredictiveCalls=require(_0x289a('0x6'))(_0x289a('0xa'));var loggerSyncQueueSummary=require(_0x289a('0x6'))(_0x289a('0xb'));var ami=require(_0x289a('0xc'));config[_0x289a('0xd')]=_['defaults'](config[_0x289a('0xd')],{'host':_0x289a('0xe'),'port':0x18eb});var io=require(_0x289a('0xf'))(new Redis(config['redis']));var cmHopper=require(_0x289a('0x10'));var cmHopperHistory=require(_0x289a('0x11'));var cmHopperFinal=require(_0x289a('0x12'));var cmHopperAdditionalPhone=require(_0x289a('0x13'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x289a('0x14'));var RpcSetting=require(_0x289a('0x15'));var Action=require(_0x289a('0x16'));var History=require(_0x289a('0x17'));var Final=require(_0x289a('0x18'));var AgentComplete=require(_0x289a('0x19'));var QueueCallerAbandon=require(_0x289a('0x1a'));var Hangup=require('./hangup');var ipAgi=process[_0x289a('0x1b')][_0x289a('0x1c')]||'127.0.0.1';var strategy={'rrmemory':_0x289a('0x1d'),'roundrobin':_0x289a('0x1e')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x289a('0x1f')][_0x289a('0x20')]=function(_0x37719c){this['tail']=this[_0x289a('0x21')]?this[_0x289a('0x21')][_0x289a('0x22')](_0x37719c):_0x37719c();};function Dialer(_0x62cffb,_0x27d940){this[_0x289a('0x23')]=new Sequence();this[_0x289a('0x24')]=_0x27d940;this[_0x289a('0x25')]=_0x62cffb[_0x289a('0x25')];this[_0x289a('0x26')]=_0x62cffb[_0x289a('0x26')];this[_0x289a('0x27')]=_0x62cffb[_0x289a('0x27')];this['trunks']=_0x62cffb[_0x289a('0x28')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0x289a('0x29')]={};this['actions']={};this[_0x289a('0x2a')]={};this['uniqueId']={};this[_0x289a('0x2b')]={};this[_0x289a('0x2c')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0x289a('0x2d')]={};this[_0x289a('0x2e')]={};ami['on'](_0x289a('0x2f'),this['syncAgentConnect'][_0x289a('0x30')](this));ami['on'](_0x289a('0x31'),this[_0x289a('0x32')][_0x289a('0x30')](this));ami['on']('originateresponse',this[_0x289a('0x33')][_0x289a('0x30')](this));ami['on'](_0x289a('0x34'),this[_0x289a('0x35')]['bind'](this));ami['on']('custom:queuesummary',this[_0x289a('0xb')][_0x289a('0x30')](this));ami['on'](_0x289a('0x36'),this[_0x289a('0x37')][_0x289a('0x30')](this));ami['on']('newexten',this[_0x289a('0x38')]['bind'](this));ami['on'](_0x289a('0x39'),this[_0x289a('0x3a')][_0x289a('0x30')](this));ami['on'](_0x289a('0x3b'),this[_0x289a('0x3c')][_0x289a('0x30')](this));ami['on']('queuestatuscomplete',this[_0x289a('0x3d')][_0x289a('0x30')](this));this[_0x289a('0x3e')]();this[_0x289a('0x3f')]();RpcSetting[_0x289a('0x40')]()['then'](function(_0x19dd5b){previewRecallmeReminderInterval=_0x19dd5b[_0x289a('0x41')];});}function isNotNull(_0x166d83){return _0x166d83!==null&&!_['isUndefined'](_0x166d83);}function checkIsLoggedIn(_0x5b61b4,_0x3a9dc5){return function(){if(_0x3a9dc5<=0x0){_0x5b61b4['message']=_0x289a('0x42');throw _0x5b61b4[_0x289a('0x43')]+_0x289a('0x44');}};}function isActive(_0x5a9f36){return _0x5a9f36;}function checkIsActive(_0x3b5fc1,_0x1c2187){return function(){if(!isActive(_0x1c2187)){_0x3b5fc1['message']=_0x289a('0x45');throw _0x3b5fc1[_0x289a('0x43')]+_0x289a('0x46');}};}function checkInterval(_0x554429){return function(){if(!isNotNull(_0x554429[_0x289a('0x47')])){_0x554429['message']=_0x289a('0x48');throw _0x554429[_0x289a('0x43')]+_0x289a('0x49');}if(!isNotNull(_0x554429[_0x289a('0x47')][_0x289a('0x4a')])){_0x554429[_0x289a('0x4b')]=_0x289a('0x48');throw _0x554429[_0x289a('0x43')]+_0x289a('0x49');}if(!isNotNull(_[_0x289a('0x4c')](_0x554429['Interval']['Intervals']))){_0x554429['message']=_0x289a('0x48');throw _0x554429[_0x289a('0x43')]+_0x289a('0x49');}};}function msgResponse(_0x3e1b86,_0x1a158a,_0x3bd9cb){return{'action':_0x3e1b86,'response':_0x1a158a,'message':_0x3bd9cb,'stack':_0x3bd9cb};}function myreject(_0x152610){return function(_0x3c48c1){return _0x152610(msgResponse(_0x289a('0x4d'),_0x289a('0x4e'),JSON[_0x289a('0x4f')](_0x3c48c1)));};}function getSeconds(_0xb26d5c,_0x4f1efe){var _0x407d9d=moment(_0xb26d5c)[_0x289a('0x50')](0x0);var _0x3fcec5=moment(_0x4f1efe)['milliseconds'](0x0);return _0x407d9d[_0x289a('0x51')](_0x3fcec5,_0x289a('0x52'));}function emit(_0x308eb1,_0x3eb37d,_0x3c28ad){io['to'](_0x308eb1)[_0x289a('0x53')](_0x3eb37d,_0x3c28ad);}function emitVoiceQueueSummary(_0x42271c){if(_0x42271c[_0x289a('0x54')]===_0x289a('0x55')){var _0x4d208e={'id':_0x42271c['id'],'name':_0x42271c[_0x289a('0x43')],'strategy':_0x42271c[_0x289a('0x56')],'answered':_0x42271c[_0x289a('0x57')],'available':_0x42271c['available'],'loggedIn':_0x42271c[_0x289a('0x58')],'pTalking':_0x42271c[_0x289a('0x59')],'sumBillable':_0x42271c[_0x289a('0x5a')],'sumDuration':_0x42271c[_0x289a('0x5b')],'sumHoldTime':_0x42271c['sumHoldTime']||0x0,'talking':_0x42271c[_0x289a('0x5c')],'total':_0x42271c['total'],'type':_0x42271c[_0x289a('0x54')],'unmanaged':_0x42271c[_0x289a('0x5d')],'abandoned':_0x42271c[_0x289a('0x5e')],'waiting':_0x42271c[_0x289a('0x5f')],'loggedInDb':_0x42271c[_0x289a('0x60')],'dialActive':_0x42271c[_0x289a('0x61')],'dialMethod':_0x42271c['dialMethod'],'dialOriginateCallerIdName':_0x42271c[_0x289a('0x62')],'dialOriginateCallerIdNumber':_0x42271c[_0x289a('0x63')],'dialOriginateTimeout':_0x42271c[_0x289a('0x64')],'dialPrefix':_0x42271c['dialPrefix'],'outboundAnswerAgiCallsDay':_0x42271c[_0x289a('0x65')],'outboundAnswerCallsDay':_0x42271c[_0x289a('0x66')],'outboundBlacklistCallsDay':_0x42271c['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x42271c[_0x289a('0x67')],'outboundCongestionCallsDay':_0x42271c[_0x289a('0x68')],'outboundDropCallsDayACS':_0x42271c[_0x289a('0x69')],'outboundDropCallsDayCallersExit':_0x42271c[_0x289a('0x6a')],'outboundDropCallsDayTimeout':_0x42271c[_0x289a('0x6b')],'outboundNoAnswerCallsDay':_0x42271c['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x42271c[_0x289a('0x6c')],'outboundOriginateFailureCallsDay':_0x42271c[_0x289a('0x6d')],'outboundReCallsDay':_0x42271c['outboundReCallsDay'],'outboundRejectCallsDay':_0x42271c['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x42271c['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x42271c['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x42271c[_0x289a('0x6e')],'predictiveIntervalAvgTalktime':_0x42271c['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x42271c[_0x289a('0x6f')],'predictiveIntervalDroppedCallsTimeout':_0x42271c[_0x289a('0x70')],'predictiveIntervalErlangCalls':_0x42271c[_0x289a('0x71')],'predictiveIntervalErlangCallsDroppedCalls':_0x42271c['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x42271c['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x42271c[_0x289a('0x72')],'predictiveIntervalPauses':_0x42271c[_0x289a('0x73')],'predictiveIntervalAvailable':_0x42271c['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x42271c[_0x289a('0x74')],'message':_0x42271c['message'],'originated':_0x42271c[_0x289a('0x75')],'erlangCalls':_0x42271c[_0x289a('0x76')],'erlangCallToSecond':_0x42271c[_0x289a('0x77')],'erlangAbandonmentRate':_0x42271c[_0x289a('0x78')],'erlangBusyFactor':_0x42271c[_0x289a('0x79')],'startPredictive':_0x42271c[_0x289a('0x2c')],'startProgressive':_0x42271c[_0x289a('0x7a')]};if(_0x42271c['Trunk']){_0x4d208e['Trunk']={'id':_0x42271c['Trunk']['id'],'name':_0x42271c[_0x289a('0x7b')][_0x289a('0x43')],'active':_0x42271c['Trunk'][_0x289a('0x7c')],'callerid':_0x42271c['Trunk'][_0x289a('0x7d')]};}if(_0x42271c[_0x289a('0x47')]){_0x4d208e[_0x289a('0x47')]={'id':_0x42271c[_0x289a('0x47')]['id'],'name':_0x42271c[_0x289a('0x47')][_0x289a('0x43')]};}var _0x5ed552=md5(JSON['stringify'](_0x4d208e));if(_0x42271c['md5']!==_0x5ed552){_0x42271c[_0x289a('0x3')]=_0x5ed552;emit(util[_0x289a('0x7e')](_0x289a('0x7f'),_0x4d208e[_0x289a('0x43')]),_0x289a('0x80'),_0x4d208e);}}}function emitCampaignSummary(_0xe3a158){if(_0xe3a158[_0x289a('0x54')]===_0x289a('0x81')){emit(util['format']('campaign:ivr:%s',_0xe3a158[_0x289a('0x43')]),_0x289a('0x82'),_0xe3a158);}}function checkGetDataPredictive(_0x17743c){if(isNotNull(_0x17743c)&&!_[_0x289a('0x4c')](_0x17743c)){loggerPredictive[_0x289a('0x83')](_0x289a('0x84'));loggerPredictive[_0x289a('0x83')](_0x289a('0x85'),_0x17743c['predictiveIntervalTotalCalls']);loggerPredictive[_0x289a('0x83')](_0x289a('0x86'),_0x17743c[_0x289a('0x87')]);loggerPredictive[_0x289a('0x83')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x17743c[_0x289a('0x70')]);loggerPredictive[_0x289a('0x83')](_0x289a('0x88'),_0x17743c[_0x289a('0x6f')]);loggerPredictive[_0x289a('0x83')](_0x289a('0x89'),_0x17743c[_0x289a('0x6e')]);loggerPredictive[_0x289a('0x83')](_0x289a('0x8a'),_0x17743c['predictiveIntervalAvgTalktime']);loggerPredictive[_0x289a('0x83')](_0x289a('0x8b'));if(_0x17743c[_0x289a('0x74')]>0x0){if(!_[_0x289a('0x8c')](_0x17743c[_0x289a('0x8d')])&&_0x17743c[_0x289a('0x8d')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x289a('0x8c')](_0x17743c['predictiveIntervalAvgHoldtime'])&&_0x17743c[_0x289a('0x6e')]>0x0){return!![];}loggerPredictive[_0x289a('0x83')](_0x289a('0x8e'));}else{loggerPredictive[_0x289a('0x83')](_0x289a('0x8f'));}}else{loggerPredictive[_0x289a('0x83')](_0x289a('0x90'));}return![];}function mergeDataErlangB(_0xd7f96e){return function(_0x55971e){loggerPredictive['info'](_0x289a('0x91'));loggerPredictive[_0x289a('0x83')](_0x289a('0x92'),_0x55971e['erlangCalls']);loggerPredictive[_0x289a('0x83')](_0x289a('0x93'),_0x55971e[_0x289a('0x77')]);loggerPredictive[_0x289a('0x83')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x55971e[_0x289a('0x78')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x55971e[_0x289a('0x79')]);loggerPredictive[_0x289a('0x83')](_0x289a('0x94'),_0x55971e[_0x289a('0x78')]);loggerPredictive[_0x289a('0x83')](_0x289a('0x8b'));_[_0x289a('0x95')](_0xd7f96e,_0x55971e);};}function getDiff(_0x458844){var _0x214706=moment()[_0x289a('0x50')](0x0);var _0x5669c2=moment(_0x458844)[_0x289a('0x50')](0x0);return _0x214706[_0x289a('0x51')](_0x5669c2,_0x289a('0x52'));}function ifInterval(_0x46856c,_0x58dfbe){if(_[_0x289a('0x8c')](_0x58dfbe)){return![];}return getDiff(_0x58dfbe)<_0x46856c*0x3c;}function freeVariablesPredictive(_0x3ebebe){if(isNotNull(_0x3ebebe)){if(!_[_0x289a('0x8c')](_0x3ebebe[_0x289a('0x7a')])){_0x3ebebe[_0x289a('0x7a')]=undefined;loggerPredictive['info'](_0x3ebebe['name'],_0x289a('0x96'));}if(!_['isUndefined'](_0x3ebebe[_0x289a('0x2c')])){_0x3ebebe[_0x289a('0x2c')]=undefined;loggerPredictive['info'](_0x3ebebe[_0x289a('0x43')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x289a('0x8c')](_0x3ebebe['handlePredictive'])){clearInterval(_0x3ebebe[_0x289a('0x97')]);_0x3ebebe[_0x289a('0x97')]=undefined;loggerPredictive[_0x289a('0x83')](_0x3ebebe['name'],_0x289a('0x98'));}}}function erlangb(_0x21366f,_0x24ee05){if(_0x24ee05===0x0){return 0x0;}var _0x333108=0x1;for(var _0x306fca=0x1;_0x306fca<=_0x24ee05;_0x306fca+=0x1){_0x333108=0x1+_0x333108*_0x306fca/_0x21366f;}return 0x1/_0x333108;}function isVoiceQueueOutbound(_0x9f050b){return _0x9f050b==='outbound';}function isNotPreview(_0x46b81a){return _0x46b81a!=='preview';}function isCampaignIvr(_0x559be9){return _0x559be9===_0x289a('0x81');}function getCallerId(_0x34a4d5,_0x255702,_0x794469){if(!_[_0x289a('0x8c')](_0x794469)&&typeof _0x794469==='string'&&!_['isEmpty'](_0x794469)){if(!_['isUndefined'](_0x255702)&&typeof _0x255702===_0x289a('0x99')&&!_[_0x289a('0x4c')](_0x255702)){return util['format'](_0x289a('0x9a'),_0x255702,_0x794469);}return util[_0x289a('0x7e')](_0x289a('0x9a'),_0x794469,_0x794469);}if(!_['isUndefined'](_0x34a4d5)&&typeof _0x34a4d5===_0x289a('0x99')&&!_[_0x289a('0x4c')](_0x34a4d5)){return _0x34a4d5;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x37b915,_0x2a1283){return function(_0x4dddd5){freeVariablesPredictive(_0x2a1283);emitVoiceQueueSummary(_0x2a1283);emitCampaignSummary(_0x2a1283);loggerSyncQueueSummary['error'](_0x37b915,util['inspect'](_0x4dddd5,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x515cba,_0x411d74){return function(_0x8319b0){loggerPredictive[_0x289a('0x9b')](_0x411d74[_0x289a('0x43')],_0x515cba);loggerPredictive[_0x289a('0x9b')](_0x8319b0[_0x289a('0x9c')]);freeVariablesPredictive(_0x411d74);};}function loggerCatch(_0x2eec63){return function(_0x1dbef2){logger[_0x289a('0x9b')](_0x2eec63,util[_0x289a('0x9d')](_0x1dbef2,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x29f461){return _0x29f461&&!_['isUndefined'](_0x29f461)&&_0x29f461['length']>0x0;}function decremetOriginate(_0x254c06){if(!_['isUndefined'](_0x254c06)&&_0x254c06!==null){if(typeof _0x254c06[_0x289a('0x75')]!==_0x289a('0x9e')){if(_0x254c06[_0x289a('0x75')]>0x0){_0x254c06[_0x289a('0x75')]-=0x1;}else{logger[_0x289a('0x9b')](_0x289a('0x9f'));}}}else{logger['error'](_0x289a('0xa0'));}}function checkContactLowerLimitOriginate(_0x19b00e,_0x22546a,_0xfd9d7f){if(_0x22546a>_0xfd9d7f){for(var _0x40320c=0x0;_0x40320c<_0x22546a-_0xfd9d7f;_0x40320c+=0x1){decremetOriginate(_0x19b00e);}}}function loggerGetContactDialer(_0x266acb,_0x3d29eb,_0x121512){return function(_0x3e757d){checkContactLowerLimitOriginate(_0x3d29eb,_0x121512,0x0);logger[_0x289a('0x9b')](_0x266acb,util[_0x289a('0x9d')](_0x3e757d,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3e08be){return function(_0x4a1f1d){if(isNotNull(_0x4a1f1d)&&isNotNull(_0x4a1f1d[0x0])){if(_0x4a1f1d[0x0][_0x289a('0xa1')]>0x0){_0x3e08be[_0x289a('0x4b')]=_0x289a('0xa2');logger[_0x289a('0x83')](_0x289a('0xa3')+_0x3e08be[_0x289a('0x43')],_0x4a1f1d[0x0][_0x289a('0xa1')],_0x289a('0xa4'));}else{_0x3e08be[_0x289a('0x4b')]=_0x289a('0xa5');logger[_0x289a('0x83')]('[getContactDialer2][Empty]'+_0x3e08be[_0x289a('0x43')]);}}};}function notSendMessagesQueue(_0x28786d){if(_0x28786d['sendMessageOneNotActive']){freeVariablesPredictive(_0x28786d);if(_0x28786d[_0x289a('0x75')]===0x0&&_0x28786d['talking']===0x0&&_0x28786d[_0x289a('0x5f')]===0x0&&(_0x28786d[_0x289a('0x59')]||0x0)===0x0){_0x28786d['sendMessageOneNotActive']=![];_0x28786d['available']=0x0;_0x28786d['message']=_0x289a('0x45');loggerSyncQueueSummary[_0x289a('0x9b')](_0x289a('0xa6'),_0x28786d[_0x289a('0x43')],_0x289a('0xa7'));}else{_0x28786d[_0x289a('0x4b')]=_0x289a('0xa8');loggerSyncQueueSummary[_0x289a('0x9b')](_0x289a('0xa6'),_0x28786d['name'],_0x289a('0xa9'));}emitVoiceQueueSummary(_0x28786d);}}function notSendMessagesCampaign(_0x16ddfe){if(_0x16ddfe['sendMessageOneNotActive']){if(_0x16ddfe[_0x289a('0x75')]===0x0){_0x16ddfe[_0x289a('0xaa')]=![];_0x16ddfe[_0x289a('0x4b')]=_0x289a('0x45');loggerSyncQueueSummary[_0x289a('0x9b')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x16ddfe[_0x289a('0x43')],'is\x20not\x20active');}else{_0x16ddfe[_0x289a('0x4b')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x289a('0x9b')](_0x289a('0xab'),_0x16ddfe[_0x289a('0x43')],_0x289a('0xa9'));}emitCampaignSummary(_0x16ddfe);}}function createObjHistory(_0x5da4f6,_0x3c7174,_0x3bca28,_0x4c3e36,_0x1d2496){_0x5da4f6[_0x289a('0x4b')]=_0x3bca28;var _0x1a9755=new Action(_0x5da4f6,_0x3c7174);var _0x376cdb=new History(_0x1a9755);_0x376cdb[_0x289a('0xac')]=_0x4c3e36;_0x376cdb[_0x289a('0xad')]=_0x1d2496;_0x376cdb[_0x289a('0xae')]=_0x1a9755[_0x289a('0xaf')];return _0x376cdb;}Dialer[_0x289a('0x1f')][_0x289a('0x3f')]=function(){var _0x28efd2=this;setInterval(function(){_0x28efd2[_0x289a('0xb0')](_0x28efd2[_0x289a('0xb1')],_0x289a('0xb2'));_0x28efd2[_0x289a('0xb0')](_0x28efd2[_0x289a('0xb3')],_0x289a('0xb4'));},0x32c8);};Dialer[_0x289a('0x1f')][_0x289a('0xb0')]=function(_0x1b93e3,_0x5a8282){var _0x238f1c=this;for(var _0x685b8b in _0x1b93e3){if(typeof _0x1b93e3[_0x685b8b]!=='undefined'){this[_0x289a('0x23')][_0x289a('0x20')](function(){if(!_[_0x289a('0xb5')](_0x1b93e3[_0x685b8b])){return ami[_0x289a('0xb6')]({'action':_0x289a('0xb7'),'channel':_0x1b93e3[_0x685b8b][_0x289a('0xb8')]})[_0x289a('0xb9')](function(_0x50314c){if(_0x50314c[_0x289a('0x4b')]===_0x289a('0xba')){setTimeout(function(){if(_0x1b93e3[_0x685b8b]&&_0x1b93e3[_0x685b8b]['type']!==_0x289a('0x81')){_0x238f1c['updateOriginated'](_0x238f1c[_0x289a('0x25')][_0x1b93e3[_0x685b8b][_0x289a('0xbb')]]);logger[_0x289a('0x9b')](_0x289a('0xbc'),_0x5a8282,_0x685b8b,_0x1b93e3[_0x685b8b][_0x289a('0xbb')]);delete _0x1b93e3[_0x685b8b];}if(_0x1b93e3[_0x685b8b]&&_0x1b93e3[_0x685b8b][_0x289a('0x54')]==='ivr'){_0x238f1c[_0x289a('0xbd')](_0x238f1c[_0x289a('0x26')][_0x1b93e3[_0x685b8b][_0x289a('0xbb')]]);logger['error'](_0x289a('0xbe'),_0x5a8282,_0x685b8b,_0x1b93e3[_0x685b8b]['queue']);delete _0x1b93e3[_0x685b8b];}},0x2328);}});}});}}};Dialer[_0x289a('0x1f')][_0x289a('0xbf')]=function(_0x366115){return BPromise[_0x289a('0xc0')]()[_0x289a('0xc1')](cmHopper[_0x289a('0xbf')](_0x366115))[_0x289a('0xb9')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x289a('0x1f')][_0x289a('0xc2')]=function(_0x2faebe){return BPromise[_0x289a('0xc0')]()[_0x289a('0xc1')](cmHopperBlack[_0x289a('0xc2')](_0x2faebe))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x289a('0x1f')][_0x289a('0xc3')]=function(_0x242693,_0x246400,_0x47fe6e){return BPromise[_0x289a('0xc0')]()[_0x289a('0xc1')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x242693,_0x246400,_0x47fe6e))['catch'](loggerCatch(_0x289a('0xc4')));};Dialer[_0x289a('0x1f')]['swapAdditionalPhones']=function(_0x595d34,_0x15ca6c,_0x258d75){return BPromise[_0x289a('0xc0')]()[_0x289a('0xc1')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x595d34,_0x15ca6c,_0x258d75))['catch'](loggerCatch(_0x289a('0xc5')));};Dialer[_0x289a('0x1f')]['checkIsBlackListIvr']=function(_0xcb6fb5){return BPromise[_0x289a('0xc0')]()[_0x289a('0xc1')](cmHopperBlack['checkIsBlackListIvr'](_0xcb6fb5))[_0x289a('0xb9')](loggerCatch(_0x289a('0xc6')));};Dialer[_0x289a('0x1f')][_0x289a('0xc7')]=function(_0x2bf28c){return BPromise['resolve']()[_0x289a('0xc1')](cmHopperHistory[_0x289a('0xc8')](_0x2bf28c))[_0x289a('0xb9')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x289a('0x1f')][_0x289a('0xc9')]=function(_0x599912){return BPromise['resolve']()['then'](cmHopper['rescheduleContact'](_0x599912))[_0x289a('0xb9')](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype'][_0x289a('0xca')]=function(_0x1e16bb,_0x141443,_0x3ac7b8){return BPromise[_0x289a('0xc0')]()[_0x289a('0xc1')](cmHopper[_0x289a('0xca')](_0x1e16bb,_0x141443,_0x3ac7b8))[_0x289a('0xb9')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x289a('0x1f')][_0x289a('0xcb')]=function(_0x33fe31,_0x156a62,_0x203b85,_0x53799d,_0x2e732f){return BPromise[_0x289a('0xc0')]()[_0x289a('0xc1')](cmHopper[_0x289a('0xcb')](_0x33fe31,_0x156a62,_0x203b85,_0x53799d))['catch'](function(_0x19a28a){_0x2e732f['temp']-=_0x203b85;_0x2e732f['temp']=_0x2e732f[_0x289a('0xcc')]>0x0?_0x2e732f[_0x289a('0xcc')]:0x0;loggerCatch(_0x289a('0xcd'))(_0x19a28a);});};Dialer[_0x289a('0x1f')]['getContactDialerIvr']=function(_0x11dd53,_0x4a4603,_0x5add11,_0x404d1a){return BPromise[_0x289a('0xc0')]()[_0x289a('0xc1')](cmHopper[_0x289a('0xce')](_0x11dd53,_0x4a4603,_0x5add11))[_0x289a('0xb9')](function(_0x18f035){_0x404d1a['temp']-=_0x4a4603;_0x404d1a[_0x289a('0xcc')]=_0x404d1a[_0x289a('0xcc')]>0x0?_0x404d1a['temp']:0x0;loggerCatch(_0x289a('0xcf'))(_0x18f035);});};Dialer[_0x289a('0x1f')][_0x289a('0xd0')]=function(_0x48b97c){return BPromise[_0x289a('0xc0')]()[_0x289a('0xc1')](voiceQueueRt[_0x289a('0xd0')](_0x48b97c))['catch'](loggerCatch(_0x289a('0xd1')));};Dialer[_0x289a('0x1f')]['moveContactManagedDialer']=function(_0x48cd0c){return BPromise[_0x289a('0xc0')]()[_0x289a('0xc1')](cmHopper[_0x289a('0xd2')](_0x48cd0c))[_0x289a('0xb9')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x289a('0x1f')][_0x289a('0xd3')]=function(_0x3b348e){return BPromise[_0x289a('0xc0')]()['then'](cmHopperHistory['createHistory'](_0x3b348e))['catch'](loggerCatch(_0x289a('0xd4')));};Dialer[_0x289a('0x1f')]['updateOriginated']=function(_0x518d36){if(!_[_0x289a('0x8c')](_0x518d36)&&_0x518d36!==null){if(typeof _0x518d36[_0x289a('0x75')]!==_0x289a('0x9e')){if(_0x518d36[_0x289a('0x75')]>0x0){_0x518d36[_0x289a('0x75')]-=0x1;}else{logger[_0x289a('0x9b')](_0x289a('0xd5'));}}}else{logger[_0x289a('0x9b')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x289a('0x1f')][_0x289a('0xd6')]=function(_0x4071f9,_0x238da3){var _0x5241cf=this;return function(_0x4650bf){_0x5241cf[_0x289a('0xbd')](_0x238da3);logger[_0x289a('0x9b')](_0x4071f9,util[_0x289a('0x9d')](_0x4650bf,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x289a('0xd7')]=function(_0x3162b1,_0x45e6d7,_0x2f2593){var _0x5c67f7={'state':0x19,'statedesc':_0x289a('0xd8')};this[_0x289a('0xbd')](_0x45e6d7);this[_0x289a('0xd9')](_[_0x289a('0x95')](_0x5c67f7,_[_0x289a('0xda')](_0x2f2593,[_0x289a('0xdb'),'ListId','UserId',_0x289a('0xdc'),'CampaignId'])),'[emptyContact][createHistory]',_0x289a('0xdd'));logger[_0x289a('0x9b')](_0x3162b1);};Dialer['prototype'][_0x289a('0xde')]=function(_0x3da5c5){return _0x3da5c5===_0x289a('0xdf');};Dialer[_0x289a('0x1f')][_0x289a('0xe0')]=function(_0x4414f1){return!_['isUndefined'](_0x4414f1)&&_0x4414f1&&!_[_0x289a('0x8c')](_0x4414f1[_0x289a('0x43')])&&!_[_0x289a('0x8c')](_0x4414f1[_0x289a('0x7c')])&&_0x4414f1[_0x289a('0x7c')]&&(this[_0x289a('0x28')][util[_0x289a('0x7e')](_0x289a('0xe1'),_0x4414f1[_0x289a('0x43')])][_0x289a('0xb7')]===_0x289a('0xe2')||this[_0x289a('0x28')][util[_0x289a('0x7e')](_0x289a('0xe1'),_0x4414f1[_0x289a('0x43')])][_0x289a('0xb7')]===_0x289a('0xe3'));};Dialer[_0x289a('0x1f')][_0x289a('0xd9')]=function(_0x273dca,_0x443794,_0x380751){this['createHistory'](_0x273dca)[_0x289a('0xb9')](loggerCatch(_0x443794));this[_0x289a('0xd2')](_0x273dca)[_0x289a('0xb9')](loggerCatch(_0x380751));};Dialer[_0x289a('0x1f')][_0x289a('0x3a')]=function(_0x2420fb){var _0x11e177=this['uniqueId'][_0x2420fb['uniqueid']];var _0x5c6fb8;if(!_[_0x289a('0xb5')](_0x2420fb)&&!_[_0x289a('0xb5')](_0x2420fb[_0x289a('0xe4')])&&!_['isNil'](_0x2420fb['variable']['amdstatus'])&&_0x2420fb[_0x289a('0xe5')]===_0x289a('0xe6')&&_0x11e177){if(_0x11e177[_0x289a('0x54')]!=='ivr'&&this[_0x289a('0x25')][_0x11e177['queue']]['dialAMDActive']&&_0x2420fb['value']===_0x289a('0xe7')){delete this[_0x289a('0xb1')][_0x2420fb['uniqueid']];this[_0x289a('0xbd')](this['voiceQueues'][_0x11e177[_0x289a('0xbb')]]);this['voiceQueues'][_0x11e177['queue']][_0x289a('0x66')]+=0x1;this[_0x289a('0x25')][_0x11e177[_0x289a('0xbb')]][_0x289a('0x65')]+=0x1;_0x5c6fb8=new Hangup(_0x11e177,_0x2420fb);_0x5c6fb8['state']=0x12;_0x5c6fb8[_0x289a('0xad')]=_0x289a('0xe8');_0x5c6fb8['membername']='AMD';ami['emit'](_0x289a('0xe9'),ut[_0x289a('0xea')](_0x5c6fb8,_0x289a('0xeb')));this['saveInDb'](_0x5c6fb8,'[syncHangupInAMD][createHistory]',_0x289a('0xec'));}if(_0x11e177[_0x289a('0x54')]!==_0x289a('0x81')&&this[_0x289a('0x25')][_0x11e177[_0x289a('0xbb')]][_0x289a('0xed')]&&_0x2420fb[_0x289a('0xee')]===_0x289a('0xef')){var _0x472b39=this;return new BPromise(function(_0xf3d57,_0x46aed0){delete _0x472b39[_0x289a('0xb1')][_0x2420fb[_0x289a('0xf0')]];_0x472b39[_0x289a('0xbd')](_0x472b39['voiceQueues'][_0x11e177[_0x289a('0xbb')]]);_0x472b39['voiceQueues'][_0x11e177[_0x289a('0xbb')]]['outboundAnswerCallsDay']+=0x1;_0x472b39[_0x289a('0x25')][_0x11e177['queue']][_0x289a('0x65')]+=0x1;var _0x27f88f=_0x472b39['voiceQueues'][_0x11e177[_0x289a('0xbb')]];var _0x275c5c=new Hangup(_0x11e177,_0x2420fb);_0x275c5c[_0x289a('0xac')]=0x13;_0x275c5c[_0x289a('0xad')]=_0x289a('0xf1');_0x275c5c['membername']=_0x289a('0xf2');_0x275c5c[_0x289a('0xf3')]+=0x1;_0x275c5c[_0x289a('0xf4')]+=0x1;_0x275c5c[_0x289a('0xeb')]=!![];ami['emit'](_0x289a('0xe9'),ut[_0x289a('0xea')](_0x275c5c,'amd'));_0x472b39['createHistory'](_0x275c5c)['catch'](loggerCatch(_0x289a('0xf5')));if(_0x275c5c['countbusyretry']+_0x275c5c[_0x289a('0xf6')]+_0x275c5c['countnoanswerretry']+_0x275c5c[_0x289a('0xf7')]+_0x275c5c[_0x289a('0xf8')]+_0x275c5c['countabandonedretry']+_0x275c5c[_0x289a('0xf3')]+_0x275c5c[_0x289a('0xf9')]>=_0x27f88f[_0x289a('0xfa')]){_0x472b39[_0x289a('0xfb')](_0x275c5c,_0xf3d57,_0x46aed0,_0x289a('0xfc'));}else{if(_0x275c5c[_0x289a('0xf3')]>=_0x27f88f[_0x289a('0xfd')]){_0x472b39['createStateFinal'](_0x275c5c,_0xf3d57,_0x46aed0,_0x289a('0xfe'));}else{_0x472b39[_0x289a('0xc9')]({'active':![],'countmachineretry':_0x275c5c['countmachineretry'],'scheduledat':moment()['add'](_0x27f88f[_0x289a('0xff')],_0x289a('0x100'))['format'](_0x289a('0x101')),'ContactId':_0x275c5c['ContactId'],'ListId':_0x275c5c[_0x289a('0x102')],'VoiceQueueId':_0x275c5c[_0x289a('0xdc')]||undefined,'CampaignId':_0x275c5c[_0x289a('0x103')]||undefined})[_0x289a('0xb9')](loggerCatch(_0x289a('0x104')));_0xf3d57({'reschedule':0x1});}}});}if(_0x11e177[_0x289a('0x54')]===_0x289a('0x81')&&this[_0x289a('0x26')][_0x11e177[_0x289a('0xbb')]][_0x289a('0xed')]&&_0x2420fb[_0x289a('0xee')]===_0x289a('0xe7')){delete this['uniqueId'][_0x2420fb['uniqueid']];this[_0x289a('0xbd')](this[_0x289a('0x26')][_0x11e177['queue']]);_0x5c6fb8=new Hangup(_0x11e177,_0x2420fb);_0x5c6fb8[_0x289a('0xac')]=0x12;_0x5c6fb8[_0x289a('0xad')]=_0x289a('0xe8');_0x5c6fb8['membername']='AMD';ami[_0x289a('0x53')](_0x289a('0xe9'),ut['buildObj'](_0x5c6fb8,_0x289a('0xeb')));this[_0x289a('0xd9')](_0x5c6fb8,'[syncHangupInAMDIvr][createHistory]',_0x289a('0x105'));}if(_0x11e177[_0x289a('0x54')]==='ivr'&&this[_0x289a('0x26')][_0x11e177[_0x289a('0xbb')]][_0x289a('0xed')]&&_0x2420fb['value']===_0x289a('0xef')){var _0x472b39=this;return new BPromise(function(_0x126f15,_0x200337){delete _0x472b39[_0x289a('0xb1')][_0x2420fb[_0x289a('0xf0')]];_0x472b39[_0x289a('0xbd')](_0x472b39[_0x289a('0x26')][_0x11e177[_0x289a('0xbb')]]);_0x472b39[_0x289a('0x26')][_0x11e177[_0x289a('0xbb')]][_0x289a('0x66')]+=0x1;_0x472b39[_0x289a('0x26')][_0x11e177[_0x289a('0xbb')]][_0x289a('0x65')]+=0x1;var _0x3ea240=_0x472b39['campaigns'][_0x11e177[_0x289a('0xbb')]];var _0x460233=new Hangup(_0x11e177,_0x2420fb);_0x460233[_0x289a('0xac')]=0x13;_0x460233[_0x289a('0xad')]=_0x289a('0xf1');_0x460233[_0x289a('0x106')]='AMD';_0x460233[_0x289a('0xf3')]+=0x1;_0x460233['countglobal']+=0x1;_0x460233[_0x289a('0xeb')]=!![];ami[_0x289a('0x53')](_0x289a('0xe9'),ut['buildObj'](_0x460233,_0x289a('0xeb')));_0x472b39[_0x289a('0xd3')](_0x460233)[_0x289a('0xb9')](loggerCatch(_0x289a('0xf5')));if(_0x460233['countbusyretry']+_0x460233[_0x289a('0xf6')]+_0x460233['countnoanswerretry']+_0x460233[_0x289a('0xf7')]+_0x460233[_0x289a('0xf8')]+_0x460233[_0x289a('0x107')]+_0x460233[_0x289a('0xf3')]+_0x460233[_0x289a('0xf9')]>=_0x3ea240[_0x289a('0xfa')]){_0x472b39[_0x289a('0xfb')](_0x460233,_0x126f15,_0x200337,_0x289a('0xfc'));}else{if(_0x460233[_0x289a('0xf3')]>=_0x3ea240['dialMachineMaxRetry']){_0x472b39[_0x289a('0x108')](_0x460233,_0x126f15,_0x200337,_0x289a('0xfe'));}else{_0x472b39[_0x289a('0xc9')]({'active':![],'countmachineretry':_0x460233[_0x289a('0xf3')],'scheduledat':moment()[_0x289a('0x109')](_0x3ea240[_0x289a('0xff')],_0x289a('0x100'))[_0x289a('0x7e')](_0x289a('0x101')),'ContactId':_0x460233[_0x289a('0xdb')],'ListId':_0x460233[_0x289a('0x102')],'VoiceQueueId':_0x460233[_0x289a('0xdc')]||undefined,'CampaignId':_0x460233[_0x289a('0x103')]||undefined})[_0x289a('0xb9')](loggerCatch('[rescheduleContact][Machine]'));_0x126f15({'reschedule':0x1});}}});}}};Dialer[_0x289a('0x1f')][_0x289a('0x37')]=function(_0x2b38cb){var _0x1fc9e6=this['uniqueId'][_0x2b38cb[_0x289a('0xf0')]];var _0x20d193=this;var _0x44fb4f;if(_0x1fc9e6&&_0x1fc9e6[_0x289a('0x54')]==='ivr'){delete this[_0x289a('0xb1')][_0x2b38cb['uniqueid']];this[_0x289a('0xbd')](this[_0x289a('0x26')][_0x1fc9e6[_0x289a('0xbb')]]);this[_0x289a('0x26')][_0x1fc9e6[_0x289a('0xbb')]]['ivrAnswerCallsDay']+=0x1;_0x44fb4f=new Hangup(_0x1fc9e6,_0x2b38cb);this[_0x289a('0xd3')](_0x44fb4f)[_0x289a('0xb9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x289a('0xd2')](_0x44fb4f)[_0x289a('0xb9')](loggerCatch(_0x289a('0x10a')));}if(_0x1fc9e6&&_0x1fc9e6['type']!==_0x289a('0x81')&&isNotNull(this[_0x289a('0x25')][_0x1fc9e6[_0x289a('0xbb')]][_0x289a('0x10b')])){delete this['uniqueId'][_0x2b38cb[_0x289a('0xf0')]];this[_0x289a('0xbd')](this[_0x289a('0x25')][_0x1fc9e6[_0x289a('0xbb')]]);this[_0x289a('0x25')][_0x1fc9e6[_0x289a('0xbb')]][_0x289a('0x66')]+=0x1;this[_0x289a('0x25')][_0x1fc9e6[_0x289a('0xbb')]]['outboundAnswerAgiCallsDay']+=0x1;_0x44fb4f=new Hangup(_0x1fc9e6,_0x2b38cb);_0x44fb4f[_0x289a('0xac')]=0x10;_0x44fb4f[_0x289a('0xad')]=_0x289a('0x10c');_0x44fb4f['membername']='AGI';this[_0x289a('0xd3')](_0x44fb4f)[_0x289a('0xb9')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x44fb4f)[_0x289a('0xb9')](loggerCatch(_0x289a('0x10a')));}if(_0x1fc9e6&&_0x1fc9e6['type']!=='ivr'&&!isNotNull(this[_0x289a('0x25')][_0x1fc9e6[_0x289a('0xbb')]][_0x289a('0x10b')])){delete this[_0x289a('0xb1')][_0x2b38cb[_0x289a('0xf0')]];this['updateOriginated'](this[_0x289a('0x25')][_0x1fc9e6[_0x289a('0xbb')]]);this['voiceQueues'][_0x1fc9e6['queue']][_0x289a('0x10d')]+=0x1;_0x44fb4f=new Hangup(_0x1fc9e6,_0x2b38cb);_0x44fb4f[_0x289a('0xac')]=0xc;_0x44fb4f['statedesc']=_0x2b38cb[_0x289a('0x10e')];_0x44fb4f[_0x289a('0x106')]=_0x289a('0x10f');this[_0x289a('0xd3')](_0x44fb4f)[_0x289a('0xb9')](loggerCatch(_0x289a('0x110')));this[_0x289a('0xd2')](_0x44fb4f)[_0x289a('0xb9')](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype'][_0x289a('0x35')]=function(_0x3011a7){var _0x27991e=this[_0x289a('0xb1')][_0x3011a7[_0x289a('0xf0')]];var _0x147976=this;if(this[_0x289a('0x25')][_0x3011a7[_0x289a('0xbb')]]){if(_0x27991e&&_0x27991e[_0x289a('0x54')]!==_0x289a('0x81')){delete this['uniqueId'][_0x3011a7['uniqueid']];this[_0x289a('0x25')][_0x3011a7[_0x289a('0xbb')]][_0x289a('0x66')]+=0x1;var _0x4333a7=new AgentComplete(_0x27991e,_0x3011a7);if(_0x3011a7[_0x289a('0x111')]===_0x289a('0x112')){_0x4333a7['agiafterat']=this[_0x289a('0x25')][_0x3011a7['queue']][_0x289a('0x113')]&&this['voiceQueues'][_0x3011a7[_0x289a('0xbb')]]['dialAgiAfterHangupAgent']?moment()[_0x289a('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x289a('0xd3')](_0x4333a7)[_0x289a('0xb9')](loggerCatch(_0x289a('0x114')));this[_0x289a('0xd2')](_0x4333a7)[_0x289a('0xb9')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0x289a('0x115')]=function(_0x301835){if(this[_0x289a('0x25')][_0x301835['queue']]){if(this[_0x289a('0xb1')][_0x301835[_0x289a('0xf0')]]&&this[_0x289a('0xb1')][_0x301835[_0x289a('0xf0')]][_0x289a('0x54')]!==_0x289a('0x81')){this['updateOriginated'](this['voiceQueues'][_0x301835[_0x289a('0xbb')]]);this['uniqueId'][_0x301835[_0x289a('0xf0')]]['answertime']=moment()[_0x289a('0x7e')](_0x289a('0x101'));}}};Dialer['prototype'][_0x289a('0x116')]=function(_0x92802f,_0xfbcda1){this[_0x289a('0xd3')](_0x92802f)[_0x289a('0xb9')](loggerCatch(_0x289a('0x114')));if(_0xfbcda1==0x0){this[_0x289a('0xd2')](_0x92802f)['catch'](loggerCatch(_0x289a('0x117')));}};Dialer[_0x289a('0x1f')][_0x289a('0x32')]=function(_0x986bca){var _0x28a018=this[_0x289a('0xb1')][_0x986bca['uniqueid']];var _0x53ebce=this;var _0x4f6eeb=![];var _0x4dd6c4;var _0x399398;if(this[_0x289a('0x25')][_0x986bca[_0x289a('0xbb')]]){if(_0x28a018&&_0x28a018[_0x289a('0x54')]!==_0x289a('0x81')){delete this[_0x289a('0xb1')][_0x986bca[_0x289a('0xf0')]];this[_0x289a('0xbd')](this[_0x289a('0x25')][_0x986bca[_0x289a('0xbb')]]);_0x28a018['droptime']=moment()[_0x289a('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x55cb09=new QueueCallerAbandon(_0x28a018,_0x986bca);if(getSeconds(_0x28a018['droptime'],_0x28a018[_0x289a('0x118')])>=_0x28a018[_0x289a('0x119')]){this['voiceQueues'][_0x986bca['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x986bca[_0x289a('0xbb')]][_0x289a('0x6b')]+=0x1;this[_0x289a('0x25')][_0x986bca['queue']][_0x289a('0x11a')]+=0x1;_0x55cb09['state']=0xa;_0x55cb09[_0x289a('0xad')]=_0x289a('0x11b');_0x55cb09[_0x289a('0x11c')]=_0x289a('0x11d');_0x55cb09[_0x289a('0x11e')]=this[_0x289a('0x25')][_0x986bca[_0x289a('0xbb')]][_0x289a('0x113')]?moment()['format'](_0x289a('0x101')):undefined;_0x55cb09[_0x289a('0xf8')]+=0x1;_0x55cb09['countglobal']+=0x1;_0x4dd6c4=this[_0x289a('0x25')][_0x986bca['queue']][_0x289a('0x11f')];_0x399398=this['voiceQueues'][_0x986bca['queue']][_0x289a('0x120')];_0x53ebce['verifyAdditionalPhones'](_0x55cb09,_0x55cb09['state'],_0x28a018[_0x289a('0x121')])[_0x289a('0xc1')](function(_0x1dd09d){_0x4f6eeb=_0x1dd09d[_0x289a('0x122')]==0x1;if(_0x55cb09['countdropretry']>=_0x53ebce['voiceQueues'][_0x986bca[_0x289a('0xbb')]][_0x289a('0x123')]){_0x53ebce[_0x289a('0x116')](_0x55cb09,_0x1dd09d[_0x289a('0x122')]);}else{_0x53ebce[_0x289a('0xc9')]({'active':![],'countdropretry':_0x55cb09[_0x289a('0xf8')],'scheduledat':moment()[_0x289a('0x109')](_0x53ebce[_0x289a('0x25')][_0x986bca['queue']]['dialDropRetryFrequency'],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x28a018[_0x289a('0xdb')],'ListId':_0x28a018[_0x289a('0x102')],'VoiceQueueId':_0x28a018['VoiceQueueId']||undefined,'CampaignId':_0x28a018[_0x289a('0x103')]||undefined})[_0x289a('0xb9')](loggerCatch(_0x289a('0x124')));var _0x561f1e=new History(_0x55cb09);_0x561f1e['state']=0xa;_0x561f1e['statedesc']=_0x289a('0x11b');_0x561f1e[_0x289a('0xaf')]=moment()[_0x289a('0x7e')](_0x289a('0x101'));_0x561f1e['endtime']=_0x561f1e['starttime'];_0x561f1e[_0x289a('0x125')]=_0x55cb09[_0x289a('0x125')];_0x561f1e[_0x289a('0x126')]=_0x55cb09[_0x289a('0x126')];_0x53ebce[_0x289a('0xd3')](_0x561f1e)[_0x289a('0xb9')](loggerCatch(_0x289a('0x127')));}})[_0x289a('0xc1')](function(_0x334d5e){if(_0x4f6eeb)_0x53ebce[_0x289a('0x128')](_0x55cb09,_0x4dd6c4,_0x399398)[_0x289a('0xc1')](function(_0x40e6a9){return 0x1;});});}else{this[_0x289a('0x25')][_0x986bca['queue']][_0x289a('0x6f')]+=0x1;this['voiceQueues'][_0x986bca['queue']][_0x289a('0x6a')]+=0x1;_0x55cb09[_0x289a('0xac')]=0xb;_0x55cb09[_0x289a('0xad')]='Abandoned';_0x55cb09[_0x289a('0x11c')]='CALLEREXIT';_0x55cb09['countabandonedretry']+=0x1;_0x55cb09['countglobal']+=0x1;_0x4dd6c4=this['voiceQueues'][_0x986bca['queue']][_0x289a('0x129')];_0x399398=this['voiceQueues'][_0x986bca[_0x289a('0xbb')]][_0x289a('0x120')];_0x53ebce[_0x289a('0xc3')](_0x55cb09,_0x55cb09[_0x289a('0xac')],_0x28a018[_0x289a('0x121')])[_0x289a('0xc1')](function(_0x35defd){if(_0x55cb09['countabandonedretry']>=_0x53ebce[_0x289a('0x25')][_0x986bca['queue']][_0x289a('0x12a')]){_0x53ebce['queueCallerAbandonCreateState'](_0x55cb09,_0x35defd['additional']);}else{_0x53ebce['rescheduleContact']({'active':![],'countabandonedretry':_0x55cb09[_0x289a('0x107')],'scheduledat':moment()['add'](_0x53ebce[_0x289a('0x25')][_0x986bca[_0x289a('0xbb')]][_0x289a('0x129')],_0x289a('0x100'))[_0x289a('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x28a018[_0x289a('0xdb')],'ListId':_0x28a018['ListId'],'VoiceQueueId':_0x28a018[_0x289a('0xdc')]||undefined,'CampaignId':_0x28a018['CampaignId']||undefined})['catch'](loggerCatch(_0x289a('0x12b')));var _0x33eb1d=new History(_0x55cb09);_0x33eb1d[_0x289a('0xac')]=0xb;_0x33eb1d[_0x289a('0xad')]=_0x289a('0x12c');_0x33eb1d['starttime']=moment()[_0x289a('0x7e')](_0x289a('0x101'));_0x33eb1d['endtime']=_0x33eb1d[_0x289a('0xaf')];_0x33eb1d[_0x289a('0x125')]=_0x55cb09[_0x289a('0x125')];_0x33eb1d['calleridnum']=_0x55cb09[_0x289a('0x126')];_0x53ebce[_0x289a('0xd3')](_0x33eb1d)['catch'](loggerCatch(_0x289a('0x12d')));}})[_0x289a('0xc1')](function(_0x7d10b0){if(_0x4f6eeb)_0x53ebce[_0x289a('0x128')](_0x55cb09,_0x4dd6c4,_0x399398)[_0x289a('0xc1')](function(_0x596fb1){return 0x1;});});}}}};Dialer[_0x289a('0x1f')][_0x289a('0x38')]=function(_0x2e402b){if(this[_0x289a('0xb3')][_0x2e402b[_0x289a('0xf0')]]){this['actions'][_0x2e402b[_0x289a('0xf0')]][_0x289a('0xb8')]=_0x2e402b[_0x289a('0xb8')];}if(this[_0x289a('0xb1')][_0x2e402b[_0x289a('0xf0')]]){this[_0x289a('0xb1')][_0x2e402b[_0x289a('0xf0')]]['channel']=_0x2e402b[_0x289a('0xb8')];}};Dialer[_0x289a('0x1f')]['syncQueueMember']=function(_0x3dca28){if(strategy[this['voiceQueues'][this[_0x289a('0xb3')][_0x3dca28[_0x289a('0x12e')]]['queue']]['strategy']]==='roundrobin'){if(this[_0x289a('0xb3')][_0x3dca28[_0x289a('0x12e')]]&&_[_0x289a('0xb5')](this[_0x289a('0xb3')][_0x3dca28[_0x289a('0x12e')]]['locked'])&&_0x3dca28[_0x289a('0xb7')]==='1'&&_0x3dca28['paused']==='0'){if(this['agents'][_0x3dca28[_0x289a('0x12f')]]){if(!this[_0x289a('0x27')][_0x3dca28['stateinterface']][_0x289a('0x130')]){this[_0x289a('0x27')][_0x3dca28[_0x289a('0x12f')]][_0x289a('0x130')]=!![];this[_0x289a('0xb3')][_0x3dca28[_0x289a('0x12e')]][_0x289a('0x130')]=!![];this[_0x289a('0xb3')][_0x3dca28[_0x289a('0x12e')]]['stateinterface']=_0x3dca28['stateinterface'];}}}}else if((strategy[this[_0x289a('0x25')][this[_0x289a('0xb3')][_0x3dca28[_0x289a('0x12e')]][_0x289a('0xbb')]]['strategy']]||_0x289a('0x1d'))==='rrmemory'){if(this[_0x289a('0xb3')][_0x3dca28[_0x289a('0x12e')]]){if(this[_0x289a('0x27')][_0x3dca28[_0x289a('0x12f')]]){this[_0x289a('0xb3')][_0x3dca28[_0x289a('0x12e')]][_0x289a('0x12f')]=_0x3dca28['stateinterface'];if(_['isNil'](this[_0x289a('0x2d')][this[_0x289a('0xb3')][_0x3dca28[_0x289a('0x12e')]][_0x289a('0xbb')]])){this[_0x289a('0x2d')][this[_0x289a('0xb3')][_0x3dca28[_0x289a('0x12e')]][_0x289a('0xbb')]]=[];}this[_0x289a('0x2d')][this['actions'][_0x3dca28[_0x289a('0x12e')]][_0x289a('0xbb')]][_0x289a('0x131')](_[_0x289a('0x95')](_[_0x289a('0xda')](this['actions'][_0x3dca28['actionid']],[_0x289a('0x132'),_0x289a('0x12f')]),{'status':_0x3dca28[_0x289a('0xb7')],'paused':_0x3dca28[_0x289a('0x133')]}));}}}};function unlockQueueStatus(_0x4eecd6,_0x26c1db){setTimeout(function(){if(_['isUndefined'](_0x4eecd6[_0x289a('0x134')])){loggerBooked[_0x289a('0x9b')](_0x289a('0x135'),_0x26c1db);}_0x4eecd6[_0x289a('0x134')]=!![];loggerBooked[_0x289a('0x83')]('[booked][unlockQueueStatus]',_0x26c1db,JSON[_0x289a('0x4f')](_['pick'](_0x4eecd6,[_0x289a('0x43'),_0x289a('0x134')])));},0x1f3);}Dialer[_0x289a('0x1f')]['syncQueueStatusComplete']=function(_0xdf4895){var _0x11cdf4=this;var _0x4cbd3e=_0x11cdf4[_0x289a('0x25')][_0x11cdf4[_0x289a('0xb3')][_0xdf4895[_0x289a('0x12e')]][_0x289a('0xbb')]];if(strategy[this[_0x289a('0x25')][this['actions'][_0xdf4895['actionid']]['queue']][_0x289a('0x56')]]===_0x289a('0x1e')){if(this[_0x289a('0xb3')][_0xdf4895[_0x289a('0x12e')]]&&this[_0x289a('0xb3')][_0xdf4895[_0x289a('0x12e')]][_0x289a('0x12f')]){this[_0x289a('0x24')]['run'](this[_0x289a('0xb3')][_0xdf4895[_0x289a('0x12e')]][_0x289a('0x132')],this[_0x289a('0xb3')][_0xdf4895[_0x289a('0x12e')]][_0x289a('0x12f')])[_0x289a('0xb9')](function(_0x1dc5ab){logger['error'](_0x289a('0x136'),util[_0x289a('0x9d')](_0x1dc5ab,{'showHidden':![],'depth':null}));})[_0x289a('0x22')](function(){_0x11cdf4[_0x289a('0xbd')](_0x11cdf4[_0x289a('0x25')][_0x11cdf4['actions'][_0xdf4895['actionid']][_0x289a('0xbb')]]);_0x11cdf4['agents'][_0x11cdf4['actions'][_0xdf4895[_0x289a('0x12e')]]['stateinterface']][_0x289a('0x130')]=![];delete _0x11cdf4['actions'][_0xdf4895[_0x289a('0x12e')]];unlockQueueStatus(_0x4cbd3e);});}else{this[_0x289a('0xbd')](this[_0x289a('0x25')][this[_0x289a('0xb3')][_0xdf4895['actionid']][_0x289a('0xbb')]]);this[_0x289a('0xc9')]({'active':![],'ContactId':this[_0x289a('0xb3')][_0xdf4895[_0x289a('0x12e')]]['ContactId'],'ListId':this[_0x289a('0xb3')][_0xdf4895[_0x289a('0x12e')]][_0x289a('0x102')],'VoiceQueueId':this[_0x289a('0xb3')][_0xdf4895[_0x289a('0x12e')]][_0x289a('0xdc')]||undefined,'CampaignId':this[_0x289a('0xb3')][_0xdf4895[_0x289a('0x12e')]][_0x289a('0x103')]||undefined})['catch'](loggerCatch(_0x289a('0x137')));delete this[_0x289a('0xb3')][_0xdf4895[_0x289a('0x12e')]];unlockQueueStatus(_0x4cbd3e);}}else if((strategy[this[_0x289a('0x25')][this[_0x289a('0xb3')][_0xdf4895[_0x289a('0x12e')]][_0x289a('0xbb')]][_0x289a('0x56')]]||'rrmemory')==='rrmemory'){var _0x17f0b2;if(this[_0x289a('0xb3')][_0xdf4895[_0x289a('0x12e')]]&&!_[_0x289a('0x4c')](this[_0x289a('0x2d')][this['actions'][_0xdf4895[_0x289a('0x12e')]][_0x289a('0xbb')]])){if(this[_0x289a('0x2e')][_0x11cdf4[_0x289a('0xb3')][_0xdf4895['actionid']]['queue']]){this[_0x289a('0x2e')][_0x11cdf4[_0x289a('0xb3')][_0xdf4895[_0x289a('0x12e')]][_0x289a('0xbb')]]=this['queueBookedRR'][this[_0x289a('0xb3')][_0xdf4895['actionid']]['queue']]?this[_0x289a('0x2e')][this['actions'][_0xdf4895[_0x289a('0x12e')]]['queue']]:this[_0x289a('0x2d')][this[_0x289a('0xb3')][_0xdf4895[_0x289a('0x12e')]][_0x289a('0xbb')]]?this['queueBooked'][this[_0x289a('0xb3')][_0xdf4895[_0x289a('0x12e')]][_0x289a('0xbb')]][_0x289a('0x138')]||0x0:0x0;}this[_0x289a('0x2d')][this[_0x289a('0xb3')][_0xdf4895[_0x289a('0x12e')]][_0x289a('0xbb')]][_0x289a('0x138')]=this[_0x289a('0x2e')][this['actions'][_0xdf4895[_0x289a('0x12e')]][_0x289a('0xbb')]];for(var _0x5a5aa1=0x0;_0x5a5aa1=0x0;})[_0x289a('0xb9')](myreject(_0x2cb85d)));}}else{_0x17f419[_0x289a('0x131')](ami[_0x289a('0xb6')]({'action':_0x289a('0x152'),'command':util[_0x289a('0x7e')](_0x289a('0x14f'),_0x46b752,!_['isUndefined'](config[_0x289a('0x14a')][_0x3a0325])?_0x3a0325:'')})[_0x289a('0xc1')](function(_0xb963ca){return _0xb963ca[_0x289a('0x151')][_0x289a('0x153')](_0x289a('0x154'))>=0x0;})[_0x289a('0xb9')](myreject(_0x2cb85d)));}BPromise[_0x289a('0x155')](_0x17f419)[_0x289a('0xc1')](function(_0x935174){var _0x3c8b12=_['some'](_0x935174);if(_0x3c8b12){return _0x46d8ff(_0x3c8b12);}else{_0x4bcbc5[_0x289a('0x4b')]=_0x5090dc?'GLOBAL_INTERVAL_IS_OVERTIME':_0x289a('0x156');return _0x2cb85d(msgResponse(_0x289a('0x157'),_0x289a('0x14c'),_0x289a('0x158')+_0x5090dc+'\x20'+_0x4c182b+_0x289a('0x159')+util[_0x289a('0x9d')](_0x46b752,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x3a0325));}})[_0x289a('0xb9')](function(_0x45e654){return _0x2cb85d(msgResponse(_0x289a('0x147'),_0x289a('0x14c'),JSON[_0x289a('0x4f')](_0x45e654)));});});};Dialer['prototype']['checkDialMethod']=function(_0x497a8c){var _0x39dcfc=this;return function(){switch(_0x497a8c[_0x289a('0x15a')]){case _0x289a('0x15b'):freeVariablesPredictive(_0x497a8c);_0x39dcfc['handlePower'](_0x497a8c,0x1);break;case _0x289a('0x15c'):freeVariablesPredictive(_0x497a8c);_0x39dcfc[_0x289a('0x15d')](_0x497a8c,_0x497a8c['dialPowerLevel']);break;case _0x289a('0x9'):_0x39dcfc[_0x289a('0x9')](_0x497a8c);break;case'booked':freeVariablesPredictive(_0x497a8c);_0x39dcfc[_0x289a('0x15d')](_0x497a8c,0x1);break;default:freeVariablesPredictive(_0x497a8c);logger[_0x289a('0x9b')](_0x289a('0x15e'),_0x497a8c['name'],_0x289a('0x15f'));}};};Dialer[_0x289a('0x1f')][_0x289a('0x160')]=function(_0x277099){return BPromise[_0x289a('0xc0')]()[_0x289a('0xc1')](cmHopper[_0x289a('0x161')](_0x277099['id'],previewRecallmeReminderInterval))[_0x289a('0xc1')](function(_0xe1d384){for(var _0x34ad51=0x0;_0x34ad51<_0xe1d384[_0x289a('0x139')];_0x34ad51++){var _0x4013a5=_0xe1d384[_0x34ad51][_0x289a('0x162')][_0x289a('0x43')];if(_0x4013a5)io['to'](util[_0x289a('0x7e')](_0x289a('0x163'),_0x4013a5))['emit']('user:dialPreviewRecallReminder',{'hopper':_0xe1d384[_0x34ad51]});}})['catch'](function(_0x44165f){});};Dialer[_0x289a('0x1f')]['launchHandleIvr']=function(_0xd036e1){var _0x25a2e9=this;return function(){_0x25a2e9[_0x289a('0x164')](_0xd036e1);};};Dialer[_0x289a('0x1f')][_0x289a('0xb')]=function(_0x1b8062){var _0x12640e=this;if(isNotPreview(_0x1b8062[_0x289a('0x15a')])){if(isVoiceQueueOutbound(_0x1b8062[_0x289a('0x54')])&&isActive(_0x1b8062[_0x289a('0x61')])){_0x1b8062[_0x289a('0xaa')]=!![];BPromise[_0x289a('0xc0')]()[_0x289a('0xc1')](checkIsLoggedIn(_0x1b8062,_0x1b8062[_0x289a('0x58')]))[_0x289a('0xc1')](checkIsActive(_0x1b8062,_0x1b8062[_0x289a('0x61')]))[_0x289a('0xc1')](checkInterval(_0x1b8062))[_0x289a('0xc1')](_0x12640e[_0x289a('0x165')](_0x1b8062))[_0x289a('0xc1')](_0x12640e[_0x289a('0x146')](_0x1b8062['dialGlobalInterval'],_0x1b8062[_0x289a('0x166')],_0x1b8062[_0x289a('0x43')],_0x1b8062))['then'](_0x12640e[_0x289a('0x167')](_0x1b8062['Interval'],_0x1b8062[_0x289a('0x166')],_0x1b8062[_0x289a('0x43')],_0x1b8062))[_0x289a('0xc1')](_0x12640e[_0x289a('0x168')](_0x1b8062))[_0x289a('0xb9')](loggerCatchQueueSummary(_0x289a('0x169'),_0x1b8062));}else{notSendMessagesQueue(_0x1b8062);}}else{freeVariablesPredictive(_0x1b8062);if(_0x1b8062[_0x289a('0x16a')]){_0x12640e[_0x289a('0x160')](_0x1b8062);}}};Dialer['prototype'][_0x289a('0x16b')]=function(){var _0x56efa4=this;var _0x2dc92;for(var _0xe0548e in this[_0x289a('0x26')]){if(typeof this[_0x289a('0x26')][_0xe0548e]!==_0x289a('0x9e')){_0x2dc92=this['campaigns'][_0xe0548e];if(isCampaignIvr(_0x2dc92[_0x289a('0x54')])&&isActive(_0x2dc92[_0x289a('0x7c')])){_0x2dc92['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0x289a('0xc1')](checkIsActive(_0x2dc92,_0x2dc92[_0x289a('0x7c')]))['then'](checkInterval(_0x2dc92))[_0x289a('0xc1')](_0x56efa4[_0x289a('0x165')](_0x2dc92))[_0x289a('0xc1')](_0x56efa4[_0x289a('0x146')](_0x2dc92[_0x289a('0x16c')],_0x2dc92[_0x289a('0x166')],_0x2dc92[_0x289a('0x43')],_0x2dc92))[_0x289a('0xc1')](_0x56efa4['checkIfTimeIntervals'](_0x2dc92[_0x289a('0x47')],_0x2dc92[_0x289a('0x166')],_0x2dc92['name'],_0x2dc92))['then'](_0x56efa4[_0x289a('0x16d')](_0x2dc92))['catch'](loggerCatchQueueSummary(_0x289a('0x16e'),_0x2dc92));}else{notSendMessagesCampaign(_0x2dc92);}}}};function getCallerIdRandom(_0x31f58e,_0x2080ff){var _0x1d6cef;var _0x9e40eb;var _0x4edb56;if(_0x2080ff<=0x0){_0x2080ff=0x1;}_0x1d6cef=new RegExp(_0x289a('0x16f')+_0x2080ff+'}$');_0x9e40eb=Math[_0x289a('0x170')](0xa,_0x2080ff-0x1);_0x4edb56=Math[_0x289a('0x170')](0xa,_0x2080ff)-0x1;return util[_0x289a('0x7e')]('%s',_[_0x289a('0x171')](_0x31f58e,_0x1d6cef,_[_0x289a('0x172')](_0x9e40eb,_0x4edb56)));}function extractCalleridName(_0x5de2fd){var _0x34b7a5=_0x5de2fd[_0x289a('0x173')](/"(.*?)"/);return _0x34b7a5?_0x34b7a5[0x1]:_0x5de2fd;}function extractCalleridNumber(_0x5c9291){var _0x58142f=_0x5c9291[_0x289a('0x173')](/<(.*?)>/);return _0x58142f?_0x58142f[0x1]:_0x5c9291;}Dialer[_0x289a('0x1f')][_0x289a('0x174')]=function(_0x529952,_0x521aee){var _0x39009c=this;var _0x5615d3=uuid['v4']();this[_0x289a('0xb3')][_0x5615d3]=new Action(_0x529952,_0x521aee,_0x5615d3);return new BPromise(function(_0x23cd0f,_0x24c4b4){if(_['isUndefined'](_0x529952)&&typeof _0x529952!=='object'){return _0x24c4b4(msgResponse(_0x289a('0x175'),_0x289a('0x14c'),_0x289a('0x176')));}if(_[_0x289a('0x8c')](_0x521aee[_0x289a('0x177')])||_0x521aee['phone']===null){return _0x24c4b4(msgResponse(_0x289a('0x175'),_0x289a('0x14c'),_0x289a('0x178')));}var _0x56571b={'XMD-CALLERID':_0x39009c['actions'][_0x5615d3][_0x289a('0x179')](),'XMD-AGI':_0x529952[_0x289a('0x10b')]?util[_0x289a('0x7e')]('\x22agi://%s/square,%s\x22',ipAgi,_0x529952['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x529952[_0x289a('0x113')]?util[_0x289a('0x7e')](_0x289a('0x17a'),ipAgi,_0x529952[_0x289a('0x113')]):_0x289a('0x17b'),'XMD-QUEUE':_0x529952[_0x289a('0x54')]===_0x289a('0x55')?util[_0x289a('0x7e')]('\x22%s,%s%s,,,%s\x22',_0x529952['name'],_0x529952[_0x289a('0x17c')]||'',_0x529952[_0x289a('0x17d')]?'c':'',_0x529952['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x521aee[_0x289a('0xdb')],'XMD-CDRTYPE':_0x289a('0x7'),'CALLERID(all)':_0x39009c['actions'][_0x5615d3][_0x289a('0x179')](),'XMD-AMD':_0x529952[_0x289a('0xed')]?'ACTIVE':_0x289a('0x17b'),'XMD-DESTINATION':_0x289a('0xe6')};if(_0x529952[_0x289a('0xed')]){_0x56571b[_0x289a('0x17e')]=_0x529952[_0x289a('0x17f')]||0x9c4;_0x56571b[_0x289a('0x180')]=_0x529952[_0x289a('0x181')]||0x5dc;_0x56571b[_0x289a('0x182')]=_0x529952[_0x289a('0x183')]||0x320;_0x56571b[_0x289a('0x184')]=_0x529952[_0x289a('0x185')]||0x1388;_0x56571b[_0x289a('0x186')]=_0x529952[_0x289a('0x187')]||0x64;_0x56571b[_0x289a('0x188')]=_0x529952[_0x289a('0x189')]||0x32;_0x56571b[_0x289a('0x18a')]=_0x529952['dialAMDMaximumNumberOfWords']||0x3;_0x56571b['XMD-AMDSILENCETHRESHOLD']=_0x529952['dialAMDSilenceThreshold']||0x100;_0x56571b[_0x289a('0x18b')]=_0x529952['dialAMDMaximumWordLength']||0x1388;}if(_0x529952[_0x289a('0x54')]===_0x289a('0x55')){_0x56571b[_0x289a('0x18c')]=_0x521aee[_0x289a('0xdc')];}else{_0x56571b['XMD-CAMPAIGNID']=_0x521aee['CampaignId'];}for(var _0x204181 in _0x521aee['Contact']){if(typeof _0x521aee[_0x289a('0x18d')][_0x204181]!==_0x289a('0x9e')){if(isNotNull(_0x521aee[_0x289a('0x18d')][_0x204181])&&_0x204181!=='id'&&_0x204181!=='tags'&&_0x204181!=='createdAt'&&_0x204181!==_0x289a('0x18e')){_0x56571b[util[_0x289a('0x7e')]('%s%s',_0x289a('0x18f'),_[_0x289a('0x190')](_0x204181))]=_0x521aee[_0x289a('0x18d')][_0x204181];}}}var _0x5e6617=_0x39009c['isTrunkReachable'](_0x529952['Trunk'])?getCallerId(_0x529952[_0x289a('0x7b')][_0x289a('0x7d')],_0x529952[_0x289a('0x62')],_0x529952[_0x289a('0x191')]>0x0?getCallerIdRandom(_0x529952['dialOriginateCallerIdNumber'],_0x529952[_0x289a('0x191')]):_0x529952[_0x289a('0x63')]):getCallerId(_['isNil'](_0x529952[_0x289a('0x192')])?_0x529952[_0x289a('0x7b')][_0x289a('0x7d')]:_0x529952[_0x289a('0x192')]['callerid'],_0x529952[_0x289a('0x62')],_0x529952[_0x289a('0x191')]>0x0?getCallerIdRandom(_0x529952[_0x289a('0x63')],_0x529952[_0x289a('0x191')]):_0x529952[_0x289a('0x63')]);if(_0x5e6617){_0x56571b[_0x289a('0x193')]=_0x39009c['actions'][_0x5615d3][_0x289a('0x194')]=extractCalleridName(_0x5e6617);_0x56571b['XMD-ORIGINATECALLERIDNUM']=_0x521aee[_0x289a('0x177')];}return ami[_0x289a('0xb6')]({'actionid':_0x5615d3,'action':_0x289a('0x175'),'channel':_0x39009c['isTrunkReachable'](_0x529952[_0x289a('0x7b')])?util[_0x289a('0x7e')](_0x289a('0x195'),_0x529952[_0x289a('0x7b')][_0x289a('0x43')],isNotNull(_0x529952[_0x289a('0x196')])?_0x529952[_0x289a('0x196')]['trim']()||'':'',_0x529952['dialCutDigit']>0x0?_0x521aee[_0x289a('0x177')][_0x289a('0x197')](_0x529952['dialCutDigit']):_0x521aee[_0x289a('0x177')]):util[_0x289a('0x7e')]('SIP/%s/%s%s',_['isNil'](_0x529952[_0x289a('0x192')])?_0x529952[_0x289a('0x7b')][_0x289a('0x43')]:_0x529952[_0x289a('0x192')][_0x289a('0x43')],isNotNull(_0x529952[_0x289a('0x196')])?_0x529952[_0x289a('0x196')]['trim']()||'':'',_0x529952[_0x289a('0x198')]>0x0?_0x521aee[_0x289a('0x177')][_0x289a('0x197')](_0x529952['dialCutDigit']):_0x521aee[_0x289a('0x177')]),'callerid':_0x5e6617,'Exten':_0x289a('0xe6'),'Context':_0x289a('0x199'),'Priority':'1','variable':_0x56571b,'timeout':(_0x529952[_0x289a('0x64')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5615d3})[_0x289a('0xc1')](function(_0x58c55a){return _0x23cd0f(_0x58c55a);})['catch'](function(_0x3e9a59){_0x529952[_0x289a('0x6d')]+=0x1;var _0x4026a1=new History(_0x39009c[_0x289a('0xb3')][_0x5615d3]);logger[_0x289a('0x9b')](util['format'](_0x289a('0x19a'),JSON[_0x289a('0x4f')](_0x3e9a59)));_0x4026a1[_0x289a('0xac')]=0xe;_0x4026a1[_0x289a('0xad')]=_0x289a('0x19b');_0x4026a1['starttime']=moment()[_0x289a('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x4026a1[_0x289a('0xae')]=_0x4026a1[_0x289a('0xaf')];_0x39009c[_0x289a('0xd3')](_0x4026a1)[_0x289a('0xb9')](loggerCatch(_0x289a('0x19c')));_0x39009c['moveContactManagedDialer'](_0x4026a1)[_0x289a('0xb9')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x39009c[_0x289a('0xb3')][_0x5615d3];return _0x24c4b4(msgResponse(_0x289a('0x175'),_0x289a('0x4e'),'originate\x20action\x20Error'));});});});};Dialer[_0x289a('0x1f')][_0x289a('0x33')]=function(_0x578b89){var _0x355c89=this['actions'][_0x578b89[_0x289a('0x12e')]];if(_0x355c89){delete this[_0x289a('0xb3')][_0x578b89[_0x289a('0x12e')]];_0x355c89[_0x289a('0x118')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x39b7e4=_0x355c89[_0x289a('0x54')]===_0x289a('0x81')?this[_0x289a('0x26')][_0x355c89[_0x289a('0xbb')]]:this[_0x289a('0x25')][_0x355c89[_0x289a('0x19d')]()];if(!this[_0x289a('0xde')](_0x578b89[_0x289a('0x19e')])){this[_0x289a('0xbd')](_0x39b7e4);return this[_0x289a('0x19f')](_0x355c89,_0x39b7e4,_0x578b89)[_0x289a('0xb9')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x289a('0xb1')][_0x578b89['uniqueid']]=_0x355c89;}};Dialer['prototype'][_0x289a('0x1a0')]=function(_0x10282f,_0xbd3bea,_0x13e13d){var _0x5b7dc4=new History(_0xbd3bea);if(_0x5b7dc4[_0x289a('0x1a1')]+_0x5b7dc4['countcongestionretry']+_0x5b7dc4[_0x289a('0x1a2')]+_0x5b7dc4[_0x289a('0xf7')]+_0x5b7dc4[_0x289a('0xf8')]+_0x5b7dc4[_0x289a('0x107')]+_0x5b7dc4[_0x289a('0xf3')]+_0x5b7dc4[_0x289a('0xf9')]>=_0x13e13d[_0x289a('0xfa')]-0x1){return!![];}switch(_0x10282f){case 0x3:if(_0x5b7dc4[_0x289a('0x1a2')]>=_0x13e13d[_0x289a('0x1a3')]-0x1){return!![];}this[_0x289a('0xc9')]({'active':![],'countnoanswerretry':_0x5b7dc4['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x289a('0x109')](_0x13e13d[_0x289a('0x1a4')],_0x289a('0x100'))['format'](_0x289a('0x101')),'ContactId':_0x5b7dc4[_0x289a('0xdb')],'ListId':_0x5b7dc4['ListId'],'VoiceQueueId':_0x5b7dc4[_0x289a('0xdc')]||undefined,'CampaignId':_0x5b7dc4[_0x289a('0x103')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x5b7dc4[_0x289a('0x1a1')]>=_0x13e13d['dialBusyMaxRetry']-0x1){return!![];}this[_0x289a('0xc9')]({'active':![],'countbusyretry':_0x5b7dc4[_0x289a('0x1a1')]+=0x1,'scheduledat':moment()[_0x289a('0x109')](_0x13e13d[_0x289a('0x1a5')],'minutes')['format'](_0x289a('0x101')),'ContactId':_0x5b7dc4[_0x289a('0xdb')],'ListId':_0x5b7dc4[_0x289a('0x102')],'VoiceQueueId':_0x5b7dc4[_0x289a('0xdc')]||undefined,'CampaignId':_0x5b7dc4[_0x289a('0x103')]||undefined})['catch'](loggerCatch(_0x289a('0x1a6')));break;case 0x8:if(_0x5b7dc4[_0x289a('0xf6')]>=_0x13e13d[_0x289a('0x1a7')]-0x1){return!![];}this[_0x289a('0xc9')]({'active':![],'countcongestionretry':_0x5b7dc4['countcongestionretry']+=0x1,'scheduledat':moment()[_0x289a('0x109')](_0x13e13d[_0x289a('0x1a8')],'minutes')[_0x289a('0x7e')](_0x289a('0x101')),'ContactId':_0x5b7dc4['ContactId'],'ListId':_0x5b7dc4[_0x289a('0x102')],'VoiceQueueId':_0x5b7dc4[_0x289a('0xdc')]||undefined,'CampaignId':_0x5b7dc4['CampaignId']||undefined})[_0x289a('0xb9')](loggerCatch(_0x289a('0x1a9')));break;case 0x0:if(_0x5b7dc4[_0x289a('0xf7')]>=_0x13e13d[_0x289a('0x1aa')]-0x1){return!![];}else{this[_0x289a('0xc9')]({'active':![],'countnosuchnumberretry':_0x5b7dc4[_0x289a('0xf7')]+=0x1,'scheduledat':moment()[_0x289a('0x109')](_0x13e13d[_0x289a('0x1ab')],_0x289a('0x100'))[_0x289a('0x7e')](_0x289a('0x101')),'ContactId':_0x5b7dc4[_0x289a('0xdb')],'ListId':_0x5b7dc4[_0x289a('0x102')],'VoiceQueueId':_0x5b7dc4['VoiceQueueId']||undefined,'CampaignId':_0x5b7dc4['CampaignId']||undefined})[_0x289a('0xb9')](loggerCatch(_0x289a('0x1ac')));}break;case 0xa:if(_0x5b7dc4['countdropretry']>=_0x13e13d[_0x289a('0x123')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x5b7dc4['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x13e13d['dialDropRetryFrequency'],'minutes')[_0x289a('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5b7dc4[_0x289a('0xdb')],'ListId':_0x5b7dc4[_0x289a('0x102')],'VoiceQueueId':_0x5b7dc4[_0x289a('0xdc')]||undefined,'CampaignId':_0x5b7dc4['CampaignId']||undefined})[_0x289a('0xb9')](loggerCatch(_0x289a('0x124')));break;case 0xb:if(_0x5b7dc4[_0x289a('0x107')]>=_0x13e13d[_0x289a('0x12a')]-0x1){return!![];}this[_0x289a('0xc9')]({'active':![],'countabandonedretry':_0x5b7dc4[_0x289a('0x107')]+=0x1,'scheduledat':moment()[_0x289a('0x109')](_0x13e13d['dialAbandonedRetryFrequency'],_0x289a('0x100'))[_0x289a('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5b7dc4[_0x289a('0xdb')],'ListId':_0x5b7dc4['ListId'],'VoiceQueueId':_0x5b7dc4[_0x289a('0xdc')]||undefined,'CampaignId':_0x5b7dc4[_0x289a('0x103')]||undefined})[_0x289a('0xb9')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x5b7dc4['countmachineretry']>=_0x13e13d[_0x289a('0xfd')]-0x1){return!![];}this[_0x289a('0xc9')]({'active':![],'countmachineretry':_0x5b7dc4[_0x289a('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x13e13d[_0x289a('0xff')],'minutes')[_0x289a('0x7e')](_0x289a('0x101')),'ContactId':_0x5b7dc4[_0x289a('0xdb')],'ListId':_0x5b7dc4[_0x289a('0x102')],'VoiceQueueId':_0x5b7dc4[_0x289a('0xdc')]||undefined,'CampaignId':_0x5b7dc4[_0x289a('0x103')]||undefined})['catch'](loggerCatch(_0x289a('0x104')));break;case 0x14:if(_0x5b7dc4[_0x289a('0xf9')]>=_0x13e13d[_0x289a('0x1ad')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x5b7dc4[_0x289a('0xf9')]+=0x1,'scheduledat':moment()[_0x289a('0x109')](_0x13e13d[_0x289a('0x1ae')],'minutes')['format'](_0x289a('0x101')),'ContactId':_0x5b7dc4[_0x289a('0xdb')],'ListId':_0x5b7dc4[_0x289a('0x102')],'VoiceQueueId':_0x5b7dc4[_0x289a('0xdc')]||undefined,'CampaignId':_0x5b7dc4['CampaignId']||undefined})[_0x289a('0xb9')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x289a('0x1f')][_0x289a('0x19f')]=function(_0x202b7d,_0x5b1a97,_0x475428){var _0x14d7c3=this;var _0x2b5a13=new History(_0x202b7d);var _0x2a3c40=![];var _0x346958;var _0x196118;return new BPromise(function(_0x15fa58,_0x7d41f){if(_[_0x289a('0x8c')](_0x5b1a97)&&typeof _0x5b1a97!==_0x289a('0x1af')){return _0x7d41f(msgResponse(_0x289a('0x1b0'),_0x289a('0x14c'),_0x289a('0x1b1')));}if(_[_0x289a('0x8c')](_0x475428)&&typeof _0x475428!==_0x289a('0x1af')){return _0x7d41f(msgResponse(_0x289a('0x1b0'),_0x289a('0x14c'),_0x289a('0x1b2')));}_0x14d7c3[_0x289a('0xc3')](_0x2b5a13,_0x475428['reason'],_0x5b1a97)[_0x289a('0xc1')](function(_0x189bc7){if(_0x189bc7[_0x289a('0x122')]==0x1)_0x2a3c40=!![];switch(_0x475428[_0x289a('0x111')]){case'0':_0x5b1a97['outboundNoSuchCallsDay']+=0x1;_0x2b5a13['state']=0x0;_0x2b5a13['statedesc']=_0x289a('0x1b3');_0x2b5a13[_0x289a('0xf7')]+=0x1;_0x2b5a13['countglobal']+=0x1;ami[_0x289a('0x53')](_0x289a('0x1b4'),ut[_0x289a('0xea')](_0x202b7d,'nosuchnumber'));_0x346958=_0x5b1a97[_0x289a('0x1ab')];_0x196118=_0x5b1a97[_0x289a('0x120')];_0x14d7c3[_0x289a('0xd3')](_0x2b5a13)[_0x289a('0xb9')](loggerCatch(_0x289a('0xf5')));if(_0x14d7c3[_0x289a('0x1a0')](0x0,_0x202b7d,_0x5b1a97)&&!_0x2a3c40){if(_0x2b5a13[_0x289a('0xf7')]>=_0x5b1a97['dialNoSuchNumberMaxRetry']){_0x14d7c3[_0x289a('0x108')](_0x2b5a13,_0x15fa58,_0x7d41f,_0x289a('0x1b5'));}else{_0x14d7c3[_0x289a('0xfb')](_0x2b5a13,_0x15fa58,_0x7d41f,_0x289a('0x1b5'));}}break;case'3':_0x5b1a97[_0x289a('0x1b6')]+=0x1;_0x2b5a13[_0x289a('0xac')]=0x3;_0x2b5a13[_0x289a('0xad')]='NoAnswer';_0x2b5a13[_0x289a('0x1a2')]+=0x1;_0x2b5a13[_0x289a('0xf4')]+=0x1;ami[_0x289a('0x53')](_0x289a('0x1b7'),ut[_0x289a('0xea')](_0x202b7d,_0x289a('0x1b8')));_0x346958=_0x5b1a97[_0x289a('0x1a4')];_0x196118=_0x5b1a97[_0x289a('0x120')];_0x14d7c3[_0x289a('0xd3')](_0x2b5a13)[_0x289a('0xb9')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x14d7c3[_0x289a('0x1a0')](0x3,_0x202b7d,_0x5b1a97)&&!_0x2a3c40){if(_0x2b5a13[_0x289a('0x1a2')]>=_0x5b1a97[_0x289a('0x1a3')]){_0x14d7c3['createStateFinal'](_0x2b5a13,_0x15fa58,_0x7d41f,_0x289a('0x1b9'));}else{_0x14d7c3[_0x289a('0xfb')](_0x2b5a13,_0x15fa58,_0x7d41f,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x5b1a97['outboundBusyCallsDay']+=0x1;_0x2b5a13[_0x289a('0xac')]=0x5;_0x2b5a13[_0x289a('0xad')]=_0x289a('0x1ba');_0x2b5a13['countbusyretry']+=0x1;_0x2b5a13[_0x289a('0xf4')]+=0x1;ami[_0x289a('0x53')](_0x289a('0x1bb'),ut['buildObj'](_0x202b7d,_0x289a('0x1bc')));_0x346958=_0x5b1a97['dialBusyRetryFrequency'];_0x196118=_0x5b1a97[_0x289a('0x120')];_0x14d7c3[_0x289a('0xd3')](_0x2b5a13)[_0x289a('0xb9')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x14d7c3[_0x289a('0x1a0')](0x5,_0x202b7d,_0x5b1a97)&&!_0x2a3c40){if(_0x2b5a13[_0x289a('0x1a1')]>=_0x5b1a97[_0x289a('0x1bd')]){_0x14d7c3['createStateFinal'](_0x2b5a13,_0x15fa58,_0x7d41f,'reason\x205\x20busy');}else{_0x14d7c3[_0x289a('0xfb')](_0x2b5a13,_0x15fa58,_0x7d41f,'reason\x205\x20busy');}}break;case'8':_0x5b1a97[_0x289a('0x68')]+=0x1;_0x2b5a13[_0x289a('0xac')]=0x8;_0x2b5a13[_0x289a('0xad')]=_0x289a('0x1be');_0x2b5a13[_0x289a('0xf6')]+=0x1;_0x2b5a13[_0x289a('0xf4')]+=0x1;_0x346958=_0x5b1a97['dialCongestionRetryFrequency'];_0x196118=_0x5b1a97['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentcongestion',ut[_0x289a('0xea')](_0x202b7d,_0x289a('0x1bf')));_0x14d7c3[_0x289a('0xd3')](_0x2b5a13)[_0x289a('0xb9')](loggerCatch(_0x289a('0x1c0')));if(_0x14d7c3['checkRetriveMax'](0x8,_0x202b7d,_0x5b1a97)&&!_0x2a3c40){if(_0x2b5a13[_0x289a('0xf6')]>=_0x5b1a97[_0x289a('0x1a7')]){_0x14d7c3[_0x289a('0x108')](_0x2b5a13,_0x15fa58,_0x7d41f,_0x289a('0x1c1'));}else{_0x14d7c3[_0x289a('0xfb')](_0x2b5a13,_0x15fa58,_0x7d41f,_0x289a('0x1c1'));}}break;case'11':_0x5b1a97[_0x289a('0x1c2')]+=0x1;_0x2b5a13['state']=0xb;_0x2b5a13['statedesc']='Abandoned';_0x2b5a13['countabandonedretry']+=0x1;_0x2b5a13[_0x289a('0xf4')]+=0x1;_0x346958=_0x5b1a97[_0x289a('0x129')];_0x196118=_0x5b1a97[_0x289a('0x120')];_0x14d7c3[_0x289a('0xd3')](_0x2b5a13)[_0x289a('0xb9')](loggerCatch(_0x289a('0x12d')));if(_0x14d7c3[_0x289a('0x1a0')](0xb,_0x202b7d,_0x5b1a97)&&!_0x2a3c40){if(_0x2b5a13[_0x289a('0x107')]>=_0x5b1a97['dialAbandonedMaxRetry']){_0x14d7c3[_0x289a('0x108')](_0x2b5a13,_0x15fa58,_0x7d41f,_0x289a('0x1c3'));}else{_0x14d7c3['stateGlobal'](_0x2b5a13,_0x15fa58,_0x7d41f,_0x289a('0x1c3'));}}break;case'20':_0x5b1a97[_0x289a('0x1c4')]+=0x1;_0x2b5a13[_0x289a('0xac')]=0x14;_0x2b5a13['statedesc']=_0x289a('0x1c5');_0x2b5a13[_0x289a('0xf9')]+=0x1;_0x2b5a13[_0x289a('0xf4')]+=0x1;_0x346958=_0x5b1a97['dialAgentRejectRetryFrequency'];_0x196118=_0x5b1a97['callAdditionalPhoneAfterMin'];ami[_0x289a('0x53')](_0x289a('0x1c6'),ut['buildObj'](_0x202b7d,'agentreject'));_0x14d7c3['createHistory'](_0x2b5a13)['catch'](loggerCatch(_0x289a('0x1c7')));if(_0x14d7c3[_0x289a('0x1a0')](0x14,_0x202b7d,_0x5b1a97)&&!_0x2a3c40){if(_0x2b5a13[_0x289a('0xf9')]>=_0x5b1a97['dialAgentRejectMaxRetry']){_0x14d7c3[_0x289a('0x108')](_0x2b5a13,_0x15fa58,_0x7d41f,_0x289a('0x1c8'));}else{_0x14d7c3[_0x289a('0xfb')](_0x2b5a13,_0x15fa58,_0x7d41f,_0x289a('0x1c8'));}}break;default:_0x5b1a97[_0x289a('0x10d')]+=0x1;_0x2b5a13[_0x289a('0xac')]=0xc;_0x2b5a13[_0x289a('0xad')]=_0x475428[_0x289a('0x111')];_0x346958=_0x5b1a97[_0x289a('0x1ae')];_0x196118=_0x5b1a97[_0x289a('0x120')];_0x14d7c3[_0x289a('0xd3')](_0x2b5a13)[_0x289a('0xb9')](loggerCatch(_0x289a('0x1c9')));if(_0x14d7c3[_0x289a('0x1a0')](_0x475428['reason'],_0x202b7d,_0x5b1a97)&&!_0x2a3c40){if(_0x2b5a13[_0x289a('0x1a1')]+_0x2b5a13[_0x289a('0xf6')]+_0x2b5a13[_0x289a('0x1a2')]+_0x2b5a13['countnosuchnumberretry']+_0x2b5a13[_0x289a('0xf8')]+_0x2b5a13[_0x289a('0x107')]+_0x2b5a13['countmachineretry']+_0x2b5a13[_0x289a('0xf9')]>=_0x5b1a97[_0x289a('0xfa')]){_0x14d7c3[_0x289a('0xfb')](_0x2b5a13,_0x15fa58,_0x7d41f,_0x475428[_0x289a('0x111')]);}else{_0x14d7c3[_0x289a('0x108')](_0x2b5a13,_0x15fa58,_0x7d41f,_0x475428[_0x289a('0x111')]);}}}})[_0x289a('0xc1')](function(_0x17d3a1){if(_0x2a3c40){_0x14d7c3[_0x289a('0x128')](_0x2b5a13,_0x346958,_0x196118)[_0x289a('0xc1')](function(_0x597733){return _0x15fa58(0x1);});}});});};Dialer[_0x289a('0x1f')][_0x289a('0xfb')]=function(_0xb536,_0x58fdab,_0x38f4e4,_0x582cc0){var _0x5c8771=new Final(_0xb536);_0x5c8771[_0x289a('0xac')]=0xf;_0x5c8771[_0x289a('0xad')]=_0x289a('0x1ca');this[_0x289a('0x108')](_0x5c8771,_0x58fdab,_0x38f4e4,_0x582cc0);};Dialer['prototype']['createStateFinal']=function(_0x2d9b25,_0xe3d266,_0x46f943,_0x46afcc){this[_0x289a('0xd2')](_0x2d9b25)['then'](function(){return _0xe3d266(msgResponse(_0x289a('0x1b0'),'Success',_0x46afcc));})['catch'](function(){return _0x46f943(msgResponse(_0x289a('0x1cb'),_0x289a('0x14c'),_0x289a('0x1cc')));});};Dialer[_0x289a('0x1f')][_0x289a('0x9')]=function(_0x19913e){var _0x13d5aa=_0x19913e[_0x289a('0x1cd')]/0x64;var _0x195e4f=_0x19913e[_0x289a('0x6b')]/(_0x19913e['outboundDropCallsDayTimeout']+_0x19913e['outboundAnswerCallsDay']);var _0x2f205a=Math[_0x289a('0x1ce')](_0x19913e['predictiveIntervalAvailable']*(_0x19913e[_0x289a('0x1cf')]/0x64));var _0x39d382=Math['round'](_0x19913e[_0x289a('0x1d0')]*(_0x19913e['predictiveIntervalMinThreshold']/0x64));var _0xa28cf9=_0x19913e['available']+_0x19913e['talking'];var _0x23af22=Math[_0x289a('0x1d1')](_0x19913e[_0x289a('0x76')]*_0x19913e['erlangAbandonmentRate']*_0x19913e[_0x289a('0x1d2')]*_0x19913e[_0x289a('0x72')]);if(_['isUndefined'](_0x19913e[_0x289a('0x7a')])){if(!_[_0x289a('0x8c')](_0x19913e[_0x289a('0x2c')])){_0x19913e[_0x289a('0x2c')]=undefined;loggerPredictive[_0x289a('0x9b')]('[startMethodPredictive][StartProgressive]',_0x289a('0x1d3'));}if(!_[_0x289a('0x8c')](_0x19913e[_0x289a('0x97')])){loggerPredictive[_0x289a('0x9b')](_0x289a('0x1d4'),_0x289a('0x1d5'));clearInterval(_0x19913e[_0x289a('0x97')]);_0x19913e[_0x289a('0x97')]=undefined;}_0x19913e[_0x289a('0x7a')]=moment()[_0x289a('0x7e')](_0x289a('0x101'));loggerPredictive['info'](_0x19913e[_0x289a('0x43')],'collection\x20data\x20in\x20progressive\x20at',_0x19913e[_0x289a('0x7a')]);this['handlePower'](_0x19913e,0x1);}else if(ifInterval(_0x19913e[_0x289a('0x1d6')],_0x19913e[_0x289a('0x7a')])){this[_0x289a('0x15d')](_0x19913e,0x1);loggerPredictiveCalls['info'](_0x289a('0x1d7'),_0x19913e['startProgressive'],_0x19913e[_0x289a('0x43')]);_0x19913e[_0x289a('0x76')]=0x0;_0x19913e[_0x289a('0x11a')]=0x0;}else if(_0x13d5aa<_0x195e4f&&_0x19913e['dialPredictiveOptimization']===_0x289a('0x1d8')){freeVariablesPredictive(_0x19913e);loggerPredictive[_0x289a('0x83')](_0x289a('0x1d9'),_0x289a('0x1da'),_0x195e4f,'startProgressive',_0x19913e[_0x289a('0x43')]);}else if(_0x23af22<_0x19913e[_0x289a('0x11a')]&&_0x19913e[_0x289a('0x1db')]==='dropRate'){freeVariablesPredictive(_0x19913e);loggerPredictive[_0x289a('0x83')](_0x289a('0x1dc'),_0x289a('0x1dd'),_0x23af22,_0x289a('0x1de'),_0x19913e[_0x289a('0x11a')],'startProgressive',_0x19913e[_0x289a('0x43')]);}else if(!ifInterval(_0x19913e[_0x289a('0x1d6')],_0x19913e[_0x289a('0x7a')])&&_['isUndefined'](_0x19913e[_0x289a('0x2c')])&&!_[_0x289a('0x8c')](_0x19913e[_0x289a('0x7a')])){_0x19913e[_0x289a('0x2c')]=moment()[_0x289a('0x7e')](_0x289a('0x101'));loggerPredictive['info'](_0x19913e[_0x289a('0x43')],_0x289a('0x1df'),_0x19913e[_0x289a('0x2c')]);this[_0x289a('0xc7')](_0x19913e[_0x289a('0x1d6')])['then'](this[_0x289a('0x1e0')](_0x19913e))['then'](mergeDataErlangB(_0x19913e))['then'](this[_0x289a('0x1e1')](_0x19913e))[_0x289a('0xb9')](loggerCatchPredictive(_0x289a('0x1e2'),_0x19913e));}else if(!ifInterval(_0x19913e[_0x289a('0x1d6')],_0x19913e['startPredictive'])){_0x19913e[_0x289a('0x11a')]=0x0;_0x19913e['startPredictive']=moment()[_0x289a('0x7e')](_0x289a('0x101'));loggerPredictive[_0x289a('0x83')](_0x19913e['name'],_0x289a('0x1e3'),_0x19913e[_0x289a('0x2c')]);clearInterval(_0x19913e[_0x289a('0x97')]);_0x19913e[_0x289a('0x97')]=undefined;this[_0x289a('0xc7')](_0x19913e['dialPredictiveInterval'])[_0x289a('0xc1')](this[_0x289a('0x1e0')](_0x19913e))[_0x289a('0xc1')](mergeDataErlangB(_0x19913e))[_0x289a('0xc1')](this[_0x289a('0x1e1')](_0x19913e))[_0x289a('0xb9')](loggerCatchPredictive(_0x289a('0x1e4'),_0x19913e));}else if(_0x19913e[_0x289a('0x1d0')]&&_0xa28cf9<_0x19913e['predictiveIntervalAvailable']-_0x39d382){freeVariablesPredictive(_0x19913e);loggerPredictive[_0x289a('0x83')](_0x19913e[_0x289a('0x43')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0xa28cf9,_0x289a('0x1e5'),_0x19913e['predictiveIntervalAvailable'],'-',_0x39d382,'=',_0x19913e['predictiveIntervalAvailable']-_0x39d382,')');}else if(_0x19913e[_0x289a('0x1d0')]&&_0xa28cf9>_0x19913e[_0x289a('0x1d0')]+_0x2f205a){freeVariablesPredictive(_0x19913e);loggerPredictive[_0x289a('0x83')](_0x19913e[_0x289a('0x43')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0xa28cf9,_0x289a('0x1e6'),_0x19913e['predictiveIntervalAvailable'],'+',_0x2f205a,'=',_0x19913e[_0x289a('0x1d0')]+_0x2f205a,')');}};Dialer[_0x289a('0x1f')]['getDataPredictive']=function(_0x39b4be){var _0x4de7e0=this;return function(_0x56a073){return new BPromise(function(_0x75561b,_0x252748){_[_0x289a('0x95')](_0x39b4be,_0x56a073[0x0]);if(checkGetDataPredictive(_0x56a073[0x0])){var _0x262871=_0x39b4be['predictiveIntervalAvailable']=_0x39b4be[_0x289a('0x5c')]+_0x39b4be[_0x289a('0x1e7')];var _0x17bd83=_0x39b4be[_0x289a('0x1d6')]*0x3c;var _0x53526d=_0x56a073[0x0][_0x289a('0x8d')]+_0x56a073[0x0]['predictiveIntervalAvgHoldtime'];var _0x3fb234=(_0x56a073[0x0][_0x289a('0x87')]+_0x56a073[0x0][_0x289a('0x70')]+_0x56a073[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x56a073[0x0]['predictiveIntervalTotalCalls'];_0x39b4be[_0x289a('0x1d2')]=_0x3fb234>0x0?_0x3fb234:0x1;switch(_0x39b4be['dialPredictiveOptimization']){case _0x289a('0x1d8'):var _0x5f1115=_0x39b4be[_0x289a('0x1cd')]/0x64;return _0x4de7e0['abandonmentRate'](_0x262871,_0x17bd83,_0x53526d,_0x3fb234,_0x5f1115)[_0x289a('0xc1')](function(_0x26e6a5){return _0x75561b(_0x26e6a5);});case'agentBusyFactor':var _0x5981b2=_0x39b4be[_0x289a('0x1cd')]/0x64;return _0x4de7e0[_0x289a('0x1e8')](_0x262871,_0x17bd83,_0x53526d,_0x3fb234,_0x5981b2)['then'](function(_0x301f4b){return _0x75561b(_0x301f4b);});default:return _0x252748(msgResponse(_0x289a('0x1e9'),_0x289a('0x14c'),_0x289a('0x1ea')));}}else{return _0x252748(msgResponse(_0x289a('0x1e9'),'Failure','check\x20failure'));}});};};Dialer[_0x289a('0x1f')]['getDataPredictiveOld']=function(_0x48ccc7){var _0x3b0522=this;return function(_0x4a00c9){return new BPromise(function(_0x23a710,_0x500902){_[_0x289a('0x95')](_0x48ccc7,_0x4a00c9[0x0]);if(checkGetDataPredictive(_0x4a00c9[0x0])){loggerPredictive[_0x289a('0x83')](JSON[_0x289a('0x4f')](_0x4a00c9[0x0]));if(_0x48ccc7[_0x289a('0x1db')]==='dropRate'){return _0x3b0522[_0x289a('0xd0')](_0x48ccc7['id'])[_0x289a('0xc1')](function(_0x5b0850){var _0x12a014=_0x48ccc7['loggedIn']-_0x5b0850[0x0][_0x289a('0x1eb')];var _0x3f979d=_0x48ccc7[_0x289a('0x1d6')]*0x3c;var _0x3bb4c6=_0x4a00c9[0x0][_0x289a('0x8d')]+_0x4a00c9[0x0][_0x289a('0x6e')];var _0x35218e=(_0x4a00c9[0x0][_0x289a('0x87')]+_0x4a00c9[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4a00c9[0x0][_0x289a('0x6f')])/_0x4a00c9[0x0][_0x289a('0x74')];var _0x57703d=_0x48ccc7[_0x289a('0x1cd')]/0x64;_0x48ccc7[_0x289a('0x73')]=_0x5b0850[0x0][_0x289a('0x1eb')]||0x0;_0x48ccc7['predictiveIntervalHitRate']=_0x35218e>0x0?_0x35218e:0x1;return _0x3b0522['abandonmentRate'](_0x12a014,_0x3f979d,_0x3bb4c6,_0x35218e,_0x57703d);})[_0x289a('0xc1')](function(_0x3291a6){return _0x23a710(_0x3291a6);})[_0x289a('0xb9')](function(_0x111072){return _0x500902(msgResponse(_0x289a('0x1ec'),_0x289a('0x14c'),JSON[_0x289a('0x4f')](_0x111072)));});}if(_0x48ccc7[_0x289a('0x1db')]==='agentBusyFactor'){return _0x3b0522['getVoiceQueueRtPauses'](_0x48ccc7['id'])[_0x289a('0xc1')](function(_0x323b25){var _0x2e541b=_0x48ccc7[_0x289a('0x58')]-_0x323b25[0x0][_0x289a('0x1eb')];var _0x1cbf1b=_0x48ccc7[_0x289a('0x1d6')]*0x3c;var _0x47b2ac=_0x4a00c9[0x0][_0x289a('0x8d')]+_0x4a00c9[0x0][_0x289a('0x6e')];var _0x566b84=(_0x4a00c9[0x0][_0x289a('0x87')]+_0x4a00c9[0x0][_0x289a('0x70')]+_0x4a00c9[0x0][_0x289a('0x6f')])/_0x4a00c9[0x0]['predictiveIntervalTotalCalls'];var _0x5440a5=_0x48ccc7['dialPredictiveOptimizationPercentage']/0x64;_0x48ccc7[_0x289a('0x73')]=_0x323b25[0x0]['outboundQueuePauses']||0x0;_0x48ccc7[_0x289a('0x1d2')]=_0x566b84>0x0?_0x566b84:0x1;return _0x3b0522['busyFactor'](_0x2e541b,_0x1cbf1b,_0x47b2ac,_0x566b84,_0x5440a5);})[_0x289a('0xc1')](function(_0x4bdc96){return _0x23a710(_0x4bdc96);})[_0x289a('0xb9')](function(_0x26c1e0){return _0x500902(msgResponse(_0x289a('0x1ec'),_0x289a('0x14c'),JSON[_0x289a('0x4f')](_0x26c1e0)));});}}else{return _0x500902(msgResponse(_0x289a('0x1e9'),_0x289a('0x14c'),_0x289a('0x1ed')));}});};};Dialer['prototype'][_0x289a('0x1e1')]=function(_0x31cf54){var _0x21f5c8=this;return function(){var _0x1fc821=0x0;var _0x23b029=Math['floor'](_0x31cf54[_0x289a('0x77')]*0x3e8);if(_0x23b029>0x0){_0x23b029=_0x23b029<0x64?0x64:_0x23b029;loggerPredictive[_0x289a('0x83')](_0x31cf54[_0x289a('0x43')],_0x289a('0x1ee'),_0x23b029,_0x289a('0x50'));_0x31cf54[_0x289a('0x97')]=setInterval(function(){_0x21f5c8['handlePredictive'](_0x31cf54);loggerPredictiveCalls[_0x289a('0x83')](_0x289a('0x1ef'),_0x1fc821+=0x1);},_0x23b029);}else{loggerPredictive[_0x289a('0x83')](_0x31cf54[_0x289a('0x43')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x289a('0x1f')]['checkContactBlack']=function(_0x172011,_0x41d9af){var _0x3c4118=this;return function(_0x449105){if(_[_0x289a('0x4c')](_0x449105)){if(_[_0x289a('0xb5')](_0x41d9af[_0x289a('0x1f0')])||!_0x41d9af['recallme']){if(_0x172011['dialMethod']===_0x289a('0x8')){_0x172011[_0x289a('0x134')]=_['isUndefined'](_0x172011['queueStatusComplete'])?!![]:_0x172011[_0x289a('0x134')];var _0x4c05c0=uuid['v4']();_0x3c4118[_0x289a('0xb3')][_0x4c05c0]=new Action(_0x172011,_0x41d9af,_0x4c05c0);loggerBooked[_0x289a('0x83')]('[booked][checkContactBlack]',_0x4c05c0,_0x289a('0x1f1'),JSON['stringify'](_0x172011['queueStatusComplete']),'Queue:\x20',_0x172011['name']);if(_0x172011[_0x289a('0x134')]){_0x172011[_0x289a('0x134')]=![];_0x3c4118[_0x289a('0x2d')][_0x3c4118[_0x289a('0xb3')][_0x4c05c0][_0x289a('0xbb')]]=[];ami['Action']({'actionid':_0x4c05c0,'action':_0x289a('0x1f2'),'queue':_0x172011[_0x289a('0x43')]})[_0x289a('0xb9')](function(){_0x3c4118[_0x289a('0xbd')](_0x172011);_0x3c4118[_0x289a('0xc9')]({'active':![],'ContactId':_0x3c4118[_0x289a('0xb3')][_0x4c05c0][_0x289a('0xdb')],'ListId':_0x3c4118[_0x289a('0xb3')][_0x4c05c0][_0x289a('0x102')],'VoiceQueueId':_0x3c4118[_0x289a('0xb3')][_0x4c05c0][_0x289a('0xdc')]||undefined,'CampaignId':_0x3c4118[_0x289a('0xb3')][_0x4c05c0]['CampaignId']||undefined})[_0x289a('0xb9')](loggerCatch(_0x289a('0x1f3')));delete _0x3c4118[_0x289a('0xb3')][_0x4c05c0];});}else{loggerBooked[_0x289a('0x83')]('[booked][checkContactBlack][else]',JSON[_0x289a('0x4f')](_0x172011[_0x289a('0x134')]),'Queue:\x20',_0x172011['name']);_0x3c4118[_0x289a('0xbd')](_0x172011);_0x3c4118['rescheduleContact']({'active':![],'ContactId':_0x3c4118[_0x289a('0xb3')][_0x4c05c0]['ContactId'],'ListId':_0x3c4118[_0x289a('0xb3')][_0x4c05c0][_0x289a('0x102')],'VoiceQueueId':_0x3c4118['actions'][_0x4c05c0][_0x289a('0xdc')]||undefined,'CampaignId':_0x3c4118[_0x289a('0xb3')][_0x4c05c0][_0x289a('0x103')]||undefined})['catch'](loggerCatch(_0x289a('0x1f3')));delete _0x3c4118[_0x289a('0xb3')][_0x4c05c0];}}else{return _0x3c4118['actionOriginate'](_0x172011,_0x41d9af);}}else{if(getDiff(_0x41d9af[_0x289a('0x1f4')])<_0x172011[_0x289a('0x1f5')]*0x3c){if(_0x41d9af['Agent']&&!_0x41d9af[_0x289a('0x162')][_0x289a('0x1f6')]){_0x3c4118[_0x289a('0x24')][_0x289a('0x13d')](_0x41d9af['id'])[_0x289a('0x22')](function(){_0x3c4118[_0x289a('0xbd')](_0x172011);});}else{_0x3c4118[_0x289a('0xca')]({'active':![]},_0x41d9af['id'],0x1)[_0x289a('0x22')](function(){_0x3c4118[_0x289a('0xbd')](_0x172011);});}}else{_0x172011[_0x289a('0x1f7')]+=0x1;_0x3c4118[_0x289a('0xbd')](_0x172011);if(_0x172011[_0x289a('0x1f8')]){_0x3c4118[_0x289a('0xc9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x41d9af['ContactId'],'ListId':_0x41d9af[_0x289a('0x102')],'VoiceQueueId':_0x41d9af['VoiceQueueId']||undefined,'CampaignId':_0x41d9af[_0x289a('0x103')]||undefined})[_0x289a('0xb9')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x3c4118[_0x289a('0xd3')](createObjHistory(_0x172011,_0x41d9af,_0x289a('0x1f9'),0x17,_0x289a('0x1fa')))[_0x289a('0xb9')](loggerCatch(_0x289a('0x1fb')));}else{_0x3c4118['saveInDb'](createObjHistory(_0x172011,_0x41d9af,'RECALLFAILEDTIMEOUT',0x16,_0x289a('0x1fc')),_0x289a('0x1fd'),_0x289a('0x1fe'));}}}}else{_0x172011[_0x289a('0x1ff')]+=0x1;_0x3c4118[_0x289a('0xd9')](createObjHistory(_0x172011,_0x41d9af,_0x289a('0x200'),0xd,_0x289a('0x201')),_0x289a('0x202'),_0x289a('0x203'));throw'inBlackList';}};};Dialer[_0x289a('0x1f')]['handleIvr']=function(_0x3295f9){var _0xdc3358=this;var _0x2a9019=_0x3295f9[_0x289a('0x204')]-_0x3295f9[_0x289a('0x75')]-_0x3295f9[_0x289a('0xcc')];emitCampaignSummary(_0x3295f9);if(_0x2a9019>0x0){if(_0x2a9019>this[_0x289a('0x205')]){_0x2a9019=this[_0x289a('0x205')];}_0x3295f9[_0x289a('0xcc')]+=_0x2a9019;this[_0x289a('0xce')](_0x3295f9['id'],_0x2a9019,_0x3295f9[_0x289a('0x206')],_0x3295f9)[_0x289a('0xc1')](function(_0x5e452f){_0x3295f9['temp']-=_0x2a9019;_0x3295f9['temp']=_0x3295f9[_0x289a('0xcc')]>0x0?_0x3295f9[_0x289a('0xcc')]:0x0;if(!checkContactEmpty(_0x5e452f)){_0x3295f9['message']=_0x289a('0xa5');logger[_0x289a('0x83')](_0x289a('0x207')+_0x3295f9[_0x289a('0x43')]);}else{_0x3295f9[_0x289a('0x75')]+=_0x5e452f[_0x289a('0x139')];_0x3295f9[_0x289a('0x4b')]=_0x289a('0x208');for(var _0x54b543=0x0;_0x54b543<_0x5e452f[_0x289a('0x139')];_0x54b543+=0x1){_0x3295f9['ivrTotalCallsDays']+=0x1;if(_[_0x289a('0xb5')](_0x5e452f[_0x54b543])||_[_0x289a('0xb5')](_0x5e452f[_0x54b543][_0x289a('0x18d')])||_[_0x289a('0xb5')](_0x5e452f[_0x54b543][_0x289a('0x177')])){_0xdc3358[_0x289a('0xd7')]('[actionOriginate]\x20',_0x3295f9,_0x5e452f[_0x54b543]);}else{_0xdc3358['checkIsBlackListIvr'](_[_0x289a('0xda')](_0x5e452f[_0x54b543],[_0x289a('0x103'),_0x289a('0x209')]))[_0x289a('0xc1')](_0xdc3358[_0x289a('0x20a')](_0x3295f9,_0x5e452f[_0x54b543]))['catch'](_0xdc3358[_0x289a('0xd6')](_0x289a('0x20b'),_0x3295f9));}}}})[_0x289a('0xb9')](loggerGetContactDialer('[getContactCampaign2]',_0x3295f9,_0x2a9019));}};Dialer['prototype'][_0x289a('0x15d')]=function(_0x3ffaad,_0x834bd9){var _0x22b2c9=this;var _0x11f148=[];var _0x1ecd16=_0x834bd9>=0x1?_0x834bd9:0x1;if(_0x3ffaad[_0x289a('0x15a')]==='booked'){_0x1ecd16=0x1;}var _0x8591d0=Math[_0x289a('0x1d1')](_0x3ffaad[_0x289a('0x1e7')]*_0x1ecd16)-_0x3ffaad[_0x289a('0x75')]-_0x3ffaad['temp'];emitVoiceQueueSummary(_0x3ffaad);if(_0x3ffaad[_0x289a('0x20c')]>0x0){var _0x16de33=_0x3ffaad['dialLimitQueue']-_0x3ffaad[_0x289a('0x75')]-_0x3ffaad['talking']-_0x3ffaad[_0x289a('0xcc')]-_0x3ffaad['pTalking'];if(_0x8591d0>_0x16de33){_0x8591d0=_0x16de33;}}if(_0x8591d0>0x0){if(_0x3ffaad['dialMethod']===_0x289a('0x8')){_0x8591d0=0x1;}if(_0x8591d0>this[_0x289a('0x205')]){_0x8591d0=this[_0x289a('0x205')];}_0x3ffaad['temp']+=_0x8591d0;for(var _0x30b091 in this[_0x289a('0x27')]){if(typeof this[_0x289a('0x27')][_0x30b091]!==_0x289a('0x9e')){if(this[_0x289a('0x27')][_0x30b091][_0x289a('0xac')]===_0x289a('0x20d')&&this[_0x289a('0x27')][_0x30b091]['status']==='reachable'){_0x11f148[_0x289a('0x131')](this[_0x289a('0x27')][_0x30b091]['id']);}}}this['getContactDialer'](_0x3ffaad['id'],_0x11f148,_0x8591d0,_0x3ffaad[_0x289a('0x206')],_0x3ffaad)[_0x289a('0xc1')](function(_0x59518c){_0x3ffaad[_0x289a('0xcc')]-=_0x8591d0;_0x3ffaad[_0x289a('0xcc')]=_0x3ffaad[_0x289a('0xcc')]>0x0?_0x3ffaad['temp']:0x0;if(!checkContactEmpty(_0x59518c)){_0x22b2c9[_0x289a('0xbf')](_0x3ffaad)[_0x289a('0xc1')](sendMessageReschedule(_0x3ffaad))[_0x289a('0xb9')](loggerCatch(_0x289a('0x20e')));}else{_0x3ffaad[_0x289a('0x75')]+=_0x59518c[_0x289a('0x139')];_0x3ffaad[_0x289a('0x4b')]=_0x3ffaad[_0x289a('0x15a')]===_0x289a('0x8')?_0x289a('0x20f'):_0x289a('0x208');for(var _0x55487f=0x0;_0x55487f<_0x59518c[_0x289a('0x139')];_0x55487f+=0x1){if(_[_0x289a('0xb5')](_0x59518c[_0x55487f])||_['isNil'](_0x59518c[_0x55487f][_0x289a('0x18d')])||_[_0x289a('0xb5')](_0x59518c[_0x55487f]['phone'])){_0x22b2c9['emptyContact']('[actionOriginate]\x20',_0x3ffaad,_0x59518c[_0x55487f]);}else{_0x22b2c9[_0x289a('0xc2')](_['pick'](_0x59518c[_0x55487f],[_0x289a('0xdc'),_0x289a('0x209')]))['then'](_0x22b2c9[_0x289a('0x20a')](_0x3ffaad,_0x59518c[_0x55487f]))[_0x289a('0xb9')](_0x22b2c9[_0x289a('0xd6')](_0x289a('0x210'),_0x3ffaad));}}}})[_0x289a('0xb9')](loggerGetContactDialer(_0x289a('0x211'),_0x3ffaad,_0x8591d0));}};Dialer['prototype'][_0x289a('0x97')]=function(_0x460a51){if(_0x460a51[_0x289a('0x20c')]>0x0){var _0x21388b=_0x460a51[_0x289a('0x20c')]-_0x460a51['originated']-_0x460a51['talking'];if(_0x21388b>0x0){this[_0x289a('0x212')](_0x460a51);}else{loggerPredictiveCalls[_0x289a('0x83')](_0x289a('0x213'));}}else{this['tryOriginatePredictive'](_0x460a51);}};Dialer[_0x289a('0x1f')][_0x289a('0x212')]=function(_0x554728){var _0x1b60a9=this;var _0x46399c=[];_0x554728['originated']+=0x1;for(var _0x5b4efb in this['agents']){if(typeof this[_0x289a('0x27')][_0x5b4efb]!==_0x289a('0x9e')){if(this[_0x289a('0x27')][_0x5b4efb]['state']==='not_inuse'&&this[_0x289a('0x27')][_0x5b4efb][_0x289a('0xb7')]===_0x289a('0xe2')){_0x46399c[_0x289a('0x131')](this[_0x289a('0x27')][_0x5b4efb]['id']);}}}this['getContactDialer'](_0x554728['id'],_0x46399c,0x1,_0x554728[_0x289a('0x206')],_0x554728)[_0x289a('0xc1')](function(_0x2457b4){if(!checkContactEmpty(_0x2457b4)){checkContactLowerLimitOriginate(_0x554728,0x1,0x0);_0x1b60a9[_0x289a('0xbf')](_0x554728)[_0x289a('0xc1')](sendMessageReschedule(_0x554728))[_0x289a('0xb9')](loggerCatch('[countReScheduled]\x20'));}else{_0x554728[_0x289a('0x4b')]=_0x289a('0x208');if(_['isNil'](_0x2457b4[0x0])||_[_0x289a('0xb5')](_0x2457b4[0x0][_0x289a('0x18d')])||_[_0x289a('0xb5')](_0x2457b4[0x0]['phone'])){_0x1b60a9[_0x289a('0xd7')](_0x289a('0x210'),_0x554728,_0x2457b4[0x0]);}else{_0x1b60a9[_0x289a('0xc2')](_[_0x289a('0xda')](_0x2457b4[0x0],[_0x289a('0xdc'),'Contact.phone']))['then'](_0x1b60a9[_0x289a('0x20a')](_0x554728,_0x2457b4[0x0]))['catch'](_0x1b60a9[_0x289a('0xd6')](_0x289a('0x214'),_0x554728));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x554728,0x1));emitVoiceQueueSummary(_0x554728);};Dialer[_0x289a('0x1f')][_0x289a('0x215')]=function(_0x1d66f4,_0x32a591,_0x3fb63,_0x28500d,_0x15fb48,_0x16b55a){loggerPredictive[_0x289a('0x83')](_0x289a('0x216'));loggerPredictive['info'](_0x289a('0x217'),_0x1d66f4);loggerPredictive[_0x289a('0x83')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x32a591);loggerPredictive['info'](_0x289a('0x218'),_0x3fb63);loggerPredictive[_0x289a('0x83')](_0x289a('0x219'),_0x28500d);loggerPredictive[_0x289a('0x83')](_0x289a('0x21a'),_0x15fb48);loggerPredictive[_0x289a('0x83')](_0x289a('0x8b'));return new BPromise(function(_0x7456a4,_0x237a16){if(_0x1d66f4<=0x0||isNaN(_0x1d66f4)){return _0x237a16(msgResponse(_0x289a('0x21b'),_0x289a('0x4e'),_0x289a('0x21c')+_0x1d66f4));}if(_0x3fb63<=0x0||isNaN(_0x3fb63)){return _0x237a16(msgResponse('[abandonmentRate]',_0x289a('0x4e'),_0x289a('0x21d')+_0x3fb63));}if(_0x28500d<=0x0||isNaN(_0x28500d)){return _0x237a16(msgResponse(_0x289a('0x21b'),_0x289a('0x4e'),_0x289a('0x21e')+_0x28500d));}if(_0x32a591<=0x0||isNaN(_0x32a591)){return _0x237a16(msgResponse(_0x289a('0x21b'),_0x289a('0x4e'),_0x289a('0x21f')+_0x32a591));}if(_0x15fb48<=0x0||isNaN(_0x15fb48)){return _0x237a16(msgResponse('[abandonmentRate]',_0x289a('0x4e'),_0x289a('0x220')+_0x15fb48));}_0x16b55a=_0x16b55a||0x0;var _0x4ba1a5=0x1/_0x3fb63;var _0x13c2b6=0x0;var _0x33b11f=0x0;var _0x1e5aa4=0x0;var _0x6aefe0=0x0;for(var _0x443ade=0x0;_0x1e5aa4<_0x15fb48;_0x443ade+=0x1){_0x33b11f=_0x443ade/_0x32a591;_0x13c2b6=(_0x28500d*_0x33b11f+_0x16b55a)/_0x4ba1a5;_0x1e5aa4=erlangb(_0x13c2b6,_0x1d66f4);_0x6aefe0=_0x13c2b6/_0x1d66f4*(0x1-erlangb(_0x13c2b6,_0x1d66f4));}return _0x7456a4({'erlangCalls':_0x443ade,'erlangCallToSecond':_0x32a591/_0x443ade,'erlangAbandonmentRate':_0x1e5aa4,'erlangBusyFactor':_0x6aefe0});});};Dialer['prototype'][_0x289a('0x1e8')]=function(_0x3833b0,_0x4dfb9d,_0x2acce8,_0x135230,_0x3c742e,_0x44268d){loggerPredictive[_0x289a('0x83')](_0x289a('0x221'));loggerPredictive[_0x289a('0x83')](_0x289a('0x217'),_0x3833b0);loggerPredictive[_0x289a('0x83')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4dfb9d);loggerPredictive['info'](_0x289a('0x218'),_0x2acce8);loggerPredictive['info'](_0x289a('0x219'),_0x135230);loggerPredictive[_0x289a('0x83')](_0x289a('0x222'),_0x3c742e);loggerPredictive[_0x289a('0x83')](_0x289a('0x8b'));return new BPromise(function(_0x34c12d,_0x3d7ca3){if(_0x3833b0<=0x0||isNaN(_0x3833b0)){return _0x3d7ca3(msgResponse(_0x289a('0x223'),_0x289a('0x4e'),_0x289a('0x21c')+_0x3833b0));}if(_0x2acce8<=0x0||isNaN(_0x2acce8)){return _0x3d7ca3(msgResponse('[busyFactor]',_0x289a('0x4e'),'Ts\x20=\x20'+_0x2acce8));}if(_0x135230<=0x0||isNaN(_0x135230)){return _0x3d7ca3(msgResponse(_0x289a('0x223'),_0x289a('0x4e'),_0x289a('0x21e')+_0x135230));}if(_0x4dfb9d<=0x0||isNaN(_0x4dfb9d)){return _0x3d7ca3(msgResponse(_0x289a('0x223'),_0x289a('0x4e'),_0x289a('0x21f')+_0x4dfb9d));}if(_0x3c742e<=0x0||isNaN(_0x3c742e)){return _0x3d7ca3(msgResponse(_0x289a('0x223'),'Error',_0x289a('0x224')+_0x3c742e));}_0x44268d=_0x44268d||0x0;var _0x2582a3=0x1/_0x2acce8;var _0x330cdf=0x0;var _0x304d1e=0x0;var _0x5b7892=0x0;var _0x4e5948=0x0;for(var _0x2ab125=0x0;_0x4e5948<_0x3c742e;_0x2ab125+=0x1){_0x304d1e=_0x2ab125/_0x4dfb9d;_0x330cdf=(_0x135230*_0x304d1e+_0x44268d)/_0x2582a3;_0x5b7892=erlangb(_0x330cdf,_0x3833b0);_0x4e5948=_0x330cdf/_0x3833b0*(0x1-erlangb(_0x330cdf,_0x3833b0));}return _0x34c12d({'erlangCalls':_0x2ab125,'erlangCallToSecond':_0x4dfb9d/_0x2ab125,'erlangAbandonmentRate':_0x5b7892,'erlangBusyFactor':_0x4e5948});});};module[_0x289a('0x225')]=Dialer; \ No newline at end of file +var _0x1c88=['-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\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','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','startProgressive','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','clearZombieChannels','uniqueId','[uniqueid]','actions','[actions]','enqueue','isNil','Action','status','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','countReScheduled','[countReScheduled]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','verifyAdditionalPhones','swapAdditionalPhones','catch','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD]','value','MACHINE','Machine','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr][createHistory]','countdropretry','YYYY-MM-DD\x20HH:mm:ss','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','syncAgentComplete','reason','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','dropreason','TIMEOUT','agiafterat','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused','stateinterface','push','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','syncQueueStatusComplete','preview','idHopper','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','command','iftime\x20%s,%s','interval','content','indexOf','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','dialPreviewRecallmeReminder','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','object','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialQueueTimeout','getCaller','ACTIVE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','updatedAt','XMD-','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAbandonedMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','dialNoAnswerRetryFrequency','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','erlangCalls','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','dialOrderByScheduledAt','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','dialLimitQueue','not_inuse','RUNNING','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\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]','Umin\x20=\x20','util','bluebird','uuid','moment','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./hangup','env','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','startPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','name','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','outbound','strategy','available','loggedIn','pTalking','sumDuration','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','info'];(function(_0x1ad7b5,_0x3c1cb6){var _0x4f7d91=function(_0x217775){while(--_0x217775){_0x1ad7b5['push'](_0x1ad7b5['shift']());}};_0x4f7d91(++_0x3c1cb6);}(_0x1c88,0x1a9));var _0x81c8=function(_0x44d28c,_0x3a197b){_0x44d28c=_0x44d28c-0x0;var _0x754673=_0x1c88[_0x44d28c];return _0x754673;};'use strict';var util=require(_0x81c8('0x0'));var _=require('lodash');var BPromise=require(_0x81c8('0x1'));var uuid=require(_0x81c8('0x2'));var moment=require(_0x81c8('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require(_0x81c8('0x4'));var config=require(_0x81c8('0x5'));var logger=require(_0x81c8('0x6'))(_0x81c8('0x7'));var loggerBooked=require(_0x81c8('0x6'))(_0x81c8('0x8'));var loggerPredictive=require(_0x81c8('0x6'))(_0x81c8('0x9'));var loggerPredictiveCalls=require(_0x81c8('0x6'))(_0x81c8('0xa'));var loggerSyncQueueSummary=require(_0x81c8('0x6'))(_0x81c8('0xb'));var ami=require(_0x81c8('0xc'));config['redis']=_[_0x81c8('0xd')](config[_0x81c8('0xe')],{'host':_0x81c8('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0x81c8('0x10'));var cmHopperHistory=require(_0x81c8('0x11'));var cmHopperFinal=require(_0x81c8('0x12'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x81c8('0x13'));var voiceQueueRt=require(_0x81c8('0x14'));var RpcSetting=require('../rpc/setting');var Action=require(_0x81c8('0x15'));var History=require(_0x81c8('0x16'));var Final=require(_0x81c8('0x17'));var AgentComplete=require(_0x81c8('0x18'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x81c8('0x19'));var ipAgi=process[_0x81c8('0x1a')][_0x81c8('0x1b')]||'127.0.0.1';var strategy={'rrmemory':_0x81c8('0x1c'),'roundrobin':_0x81c8('0x1d')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x81c8('0x1e')]['enqueue']=function(_0x10732c){this[_0x81c8('0x1f')]=this[_0x81c8('0x1f')]?this[_0x81c8('0x1f')][_0x81c8('0x20')](_0x10732c):_0x10732c();};function Dialer(_0x4e2289,_0x3f7bf3){this[_0x81c8('0x21')]=new Sequence();this['preview']=_0x3f7bf3;this[_0x81c8('0x22')]=_0x4e2289[_0x81c8('0x22')];this[_0x81c8('0x23')]=_0x4e2289[_0x81c8('0x23')];this[_0x81c8('0x24')]=_0x4e2289[_0x81c8('0x24')];this[_0x81c8('0x25')]=_0x4e2289[_0x81c8('0x25')];this[_0x81c8('0x26')]=config['maxNumberOriginate']||0x2;this[_0x81c8('0x27')]={};this['actions']={};this['contactsId']={};this['uniqueId']={};this['optionPredictive']={};this[_0x81c8('0x28')]={};this['startProgressive']={};this[_0x81c8('0x29')]={};this[_0x81c8('0x2a')]={};this[_0x81c8('0x2b')]={};ami['on'](_0x81c8('0x2c'),this[_0x81c8('0x2d')][_0x81c8('0x2e')](this));ami['on'](_0x81c8('0x2f'),this[_0x81c8('0x30')][_0x81c8('0x2e')](this));ami['on'](_0x81c8('0x31'),this[_0x81c8('0x32')][_0x81c8('0x2e')](this));ami['on'](_0x81c8('0x33'),this['syncAgentComplete'][_0x81c8('0x2e')](this));ami['on'](_0x81c8('0x34'),this[_0x81c8('0xb')][_0x81c8('0x2e')](this));ami['on']('hangup',this[_0x81c8('0x35')]['bind'](this));ami['on'](_0x81c8('0x36'),this[_0x81c8('0x37')][_0x81c8('0x2e')](this));ami['on'](_0x81c8('0x38'),this[_0x81c8('0x39')][_0x81c8('0x2e')](this));ami['on'](_0x81c8('0x3a'),this[_0x81c8('0x3b')]['bind'](this));ami['on'](_0x81c8('0x3c'),this['syncQueueStatusComplete'][_0x81c8('0x2e')](this));this[_0x81c8('0x3d')]();this[_0x81c8('0x3e')]();RpcSetting[_0x81c8('0x3f')]()[_0x81c8('0x40')](function(_0x1d580f){previewRecallmeReminderInterval=_0x1d580f[_0x81c8('0x41')];});}function isNotNull(_0x4e83e7){return _0x4e83e7!==null&&!_[_0x81c8('0x42')](_0x4e83e7);}function checkIsLoggedIn(_0x5a3b64,_0x35b19d){return function(){if(_0x35b19d<=0x0){_0x5a3b64[_0x81c8('0x43')]=_0x81c8('0x44');throw _0x5a3b64['name']+_0x81c8('0x45');}};}function isActive(_0x10a7e7){return _0x10a7e7;}function checkIsActive(_0x583c98,_0xf0bfb7){return function(){if(!isActive(_0xf0bfb7)){_0x583c98['message']=_0x81c8('0x46');throw _0x583c98['name']+_0x81c8('0x47');}};}function checkInterval(_0x481b7a){return function(){if(!isNotNull(_0x481b7a[_0x81c8('0x48')])){_0x481b7a[_0x81c8('0x43')]=_0x81c8('0x49');throw _0x481b7a[_0x81c8('0x4a')]+_0x81c8('0x4b');}if(!isNotNull(_0x481b7a[_0x81c8('0x48')][_0x81c8('0x4c')])){_0x481b7a[_0x81c8('0x43')]='INTERVAL_IS_NULL';throw _0x481b7a[_0x81c8('0x4a')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x81c8('0x4d')](_0x481b7a[_0x81c8('0x48')][_0x81c8('0x4c')]))){_0x481b7a[_0x81c8('0x43')]=_0x81c8('0x49');throw _0x481b7a['name']+_0x81c8('0x4b');}};}function msgResponse(_0x5f5c42,_0x156add,_0x1be3d3){return{'action':_0x5f5c42,'response':_0x156add,'message':_0x1be3d3,'stack':_0x1be3d3};}function myreject(_0x115f9f){return function(_0x12a5fc){return _0x115f9f(msgResponse(_0x81c8('0x4e'),_0x81c8('0x4f'),JSON['stringify'](_0x12a5fc)));};}function getSeconds(_0x255543,_0x376d5b){var _0x44512d=moment(_0x255543)[_0x81c8('0x50')](0x0);var _0x2e27ad=moment(_0x376d5b)[_0x81c8('0x50')](0x0);return _0x44512d[_0x81c8('0x51')](_0x2e27ad,_0x81c8('0x52'));}function emit(_0x11539b,_0x82d608,_0x5349ab){io['to'](_0x11539b)[_0x81c8('0x53')](_0x82d608,_0x5349ab);}function emitVoiceQueueSummary(_0x1f0a08){if(_0x1f0a08['type']===_0x81c8('0x54')){var _0x291f8f={'id':_0x1f0a08['id'],'name':_0x1f0a08[_0x81c8('0x4a')],'strategy':_0x1f0a08[_0x81c8('0x55')],'answered':_0x1f0a08['answered'],'available':_0x1f0a08[_0x81c8('0x56')],'loggedIn':_0x1f0a08[_0x81c8('0x57')],'pTalking':_0x1f0a08[_0x81c8('0x58')],'sumBillable':_0x1f0a08['sumBillable'],'sumDuration':_0x1f0a08[_0x81c8('0x59')],'sumHoldTime':_0x1f0a08['sumHoldTime']||0x0,'talking':_0x1f0a08[_0x81c8('0x5a')],'total':_0x1f0a08[_0x81c8('0x5b')],'type':_0x1f0a08[_0x81c8('0x5c')],'unmanaged':_0x1f0a08[_0x81c8('0x5d')],'abandoned':_0x1f0a08[_0x81c8('0x5e')],'waiting':_0x1f0a08[_0x81c8('0x5f')],'loggedInDb':_0x1f0a08[_0x81c8('0x60')],'dialActive':_0x1f0a08[_0x81c8('0x61')],'dialMethod':_0x1f0a08[_0x81c8('0x62')],'dialOriginateCallerIdName':_0x1f0a08[_0x81c8('0x63')],'dialOriginateCallerIdNumber':_0x1f0a08['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x1f0a08[_0x81c8('0x64')],'dialPrefix':_0x1f0a08['dialPrefix'],'outboundAnswerAgiCallsDay':_0x1f0a08['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x1f0a08[_0x81c8('0x65')],'outboundBlacklistCallsDay':_0x1f0a08[_0x81c8('0x66')],'outboundBusyCallsDay':_0x1f0a08['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1f0a08[_0x81c8('0x67')],'outboundDropCallsDayACS':_0x1f0a08[_0x81c8('0x68')],'outboundDropCallsDayCallersExit':_0x1f0a08['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x1f0a08[_0x81c8('0x69')],'outboundNoAnswerCallsDay':_0x1f0a08['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1f0a08[_0x81c8('0x6a')],'outboundOriginateFailureCallsDay':_0x1f0a08[_0x81c8('0x6b')],'outboundReCallsDay':_0x1f0a08[_0x81c8('0x6c')],'outboundRejectCallsDay':_0x1f0a08[_0x81c8('0x6d')],'outboundUnknownCallsDay':_0x1f0a08[_0x81c8('0x6e')],'predictiveIntervalAnsweredCalls':_0x1f0a08[_0x81c8('0x6f')],'predictiveIntervalAvgHoldtime':_0x1f0a08[_0x81c8('0x70')],'predictiveIntervalAvgTalktime':_0x1f0a08[_0x81c8('0x71')],'predictiveIntervalDroppedCallsCallersExit':_0x1f0a08[_0x81c8('0x72')],'predictiveIntervalDroppedCallsTimeout':_0x1f0a08[_0x81c8('0x73')],'predictiveIntervalErlangCalls':_0x1f0a08[_0x81c8('0x74')],'predictiveIntervalErlangCallsDroppedCalls':_0x1f0a08[_0x81c8('0x75')],'predictiveIntervalHitRate':_0x1f0a08[_0x81c8('0x76')],'predictiveIntervalMultiplicativeFactor':_0x1f0a08[_0x81c8('0x77')],'predictiveIntervalPauses':_0x1f0a08[_0x81c8('0x78')],'predictiveIntervalAvailable':_0x1f0a08[_0x81c8('0x79')],'predictiveIntervalTotalCalls':_0x1f0a08[_0x81c8('0x7a')],'message':_0x1f0a08[_0x81c8('0x43')],'originated':_0x1f0a08['originated'],'erlangCalls':_0x1f0a08['erlangCalls'],'erlangCallToSecond':_0x1f0a08['erlangCallToSecond'],'erlangAbandonmentRate':_0x1f0a08[_0x81c8('0x7b')],'erlangBusyFactor':_0x1f0a08[_0x81c8('0x7c')],'startPredictive':_0x1f0a08[_0x81c8('0x28')],'startProgressive':_0x1f0a08['startProgressive']};if(_0x1f0a08[_0x81c8('0x7d')]){_0x291f8f['Trunk']={'id':_0x1f0a08['Trunk']['id'],'name':_0x1f0a08[_0x81c8('0x7d')][_0x81c8('0x4a')],'active':_0x1f0a08['Trunk'][_0x81c8('0x7e')],'callerid':_0x1f0a08['Trunk'][_0x81c8('0x7f')]};}if(_0x1f0a08[_0x81c8('0x48')]){_0x291f8f[_0x81c8('0x48')]={'id':_0x1f0a08[_0x81c8('0x48')]['id'],'name':_0x1f0a08[_0x81c8('0x48')]['name']};}var _0x2b87fd=md5(JSON['stringify'](_0x291f8f));if(_0x1f0a08['md5']!==_0x2b87fd){_0x1f0a08['md5']=_0x2b87fd;emit(util['format'](_0x81c8('0x80'),_0x291f8f[_0x81c8('0x4a')]),_0x81c8('0x81'),_0x291f8f);}}}function emitCampaignSummary(_0x3d0305){if(_0x3d0305['type']===_0x81c8('0x82')){emit(util[_0x81c8('0x83')](_0x81c8('0x84'),_0x3d0305['name']),_0x81c8('0x85'),_0x3d0305);}}function checkGetDataPredictive(_0x540b93){if(isNotNull(_0x540b93)&&!_['isEmpty'](_0x540b93)){loggerPredictive[_0x81c8('0x86')](_0x81c8('0x87'));loggerPredictive[_0x81c8('0x86')](_0x81c8('0x88'),_0x540b93[_0x81c8('0x7a')]);loggerPredictive[_0x81c8('0x86')](_0x81c8('0x89'),_0x540b93[_0x81c8('0x6f')]);loggerPredictive['info'](_0x81c8('0x8a'),_0x540b93[_0x81c8('0x73')]);loggerPredictive[_0x81c8('0x86')](_0x81c8('0x8b'),_0x540b93[_0x81c8('0x72')]);loggerPredictive[_0x81c8('0x86')](_0x81c8('0x8c'),_0x540b93[_0x81c8('0x70')]);loggerPredictive[_0x81c8('0x86')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x540b93[_0x81c8('0x71')]);loggerPredictive[_0x81c8('0x86')](_0x81c8('0x8d'));if(_0x540b93['predictiveIntervalTotalCalls']>0x0){if(!_[_0x81c8('0x42')](_0x540b93[_0x81c8('0x71')])&&_0x540b93['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x540b93[_0x81c8('0x70')])&&_0x540b93[_0x81c8('0x70')]>0x0){return!![];}loggerPredictive[_0x81c8('0x86')](_0x81c8('0x8e'));}else{loggerPredictive[_0x81c8('0x86')](_0x81c8('0x8f'));}}else{loggerPredictive[_0x81c8('0x86')](_0x81c8('0x90'));}return![];}function mergeDataErlangB(_0x3dcbf6){return function(_0x58d167){loggerPredictive[_0x81c8('0x86')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x81c8('0x86')](_0x81c8('0x91'),_0x58d167['erlangCalls']);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58d167[_0x81c8('0x92')]);loggerPredictive['info'](_0x81c8('0x93'),_0x58d167[_0x81c8('0x7b')]);loggerPredictive['info'](_0x81c8('0x94'),_0x58d167[_0x81c8('0x7c')]);loggerPredictive[_0x81c8('0x86')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58d167[_0x81c8('0x7b')]);loggerPredictive[_0x81c8('0x86')](_0x81c8('0x8d'));_[_0x81c8('0x95')](_0x3dcbf6,_0x58d167);};}function getDiff(_0x59e1bc){var _0xe35394=moment()['milliseconds'](0x0);var _0x570e1f=moment(_0x59e1bc)[_0x81c8('0x50')](0x0);return _0xe35394[_0x81c8('0x51')](_0x570e1f,_0x81c8('0x52'));}function ifInterval(_0x42810e,_0x4603a2){if(_[_0x81c8('0x42')](_0x4603a2)){return![];}return getDiff(_0x4603a2)<_0x42810e*0x3c;}function freeVariablesPredictive(_0x2d51da){if(isNotNull(_0x2d51da)){if(!_['isUndefined'](_0x2d51da[_0x81c8('0x96')])){_0x2d51da['startProgressive']=undefined;loggerPredictive[_0x81c8('0x86')](_0x2d51da['name'],_0x81c8('0x97'));}if(!_['isUndefined'](_0x2d51da['startPredictive'])){_0x2d51da[_0x81c8('0x28')]=undefined;loggerPredictive[_0x81c8('0x86')](_0x2d51da['name'],_0x81c8('0x98'));}if(!_[_0x81c8('0x42')](_0x2d51da[_0x81c8('0x99')])){clearInterval(_0x2d51da[_0x81c8('0x99')]);_0x2d51da['handlePredictive']=undefined;loggerPredictive['info'](_0x2d51da[_0x81c8('0x4a')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x5a8139,_0x1c0469){if(_0x1c0469===0x0){return 0x0;}var _0x1c17dc=0x1;for(var _0x5b6047=0x1;_0x5b6047<=_0x1c0469;_0x5b6047+=0x1){_0x1c17dc=0x1+_0x1c17dc*_0x5b6047/_0x5a8139;}return 0x1/_0x1c17dc;}function isVoiceQueueOutbound(_0x3d9e18){return _0x3d9e18===_0x81c8('0x54');}function isNotPreview(_0x2f822a){return _0x2f822a!=='preview';}function isCampaignIvr(_0x58e446){return _0x58e446===_0x81c8('0x82');}function getCallerId(_0x4b1986,_0x39e314,_0x595084){if(!_[_0x81c8('0x42')](_0x595084)&&typeof _0x595084===_0x81c8('0x9a')&&!_[_0x81c8('0x4d')](_0x595084)){if(!_[_0x81c8('0x42')](_0x39e314)&&typeof _0x39e314===_0x81c8('0x9a')&&!_[_0x81c8('0x4d')](_0x39e314)){return util[_0x81c8('0x83')](_0x81c8('0x9b'),_0x39e314,_0x595084);}return util['format'](_0x81c8('0x9b'),_0x595084,_0x595084);}if(!_['isUndefined'](_0x4b1986)&&typeof _0x4b1986==='string'&&!_['isEmpty'](_0x4b1986)){return _0x4b1986;}return _0x81c8('0x9c');}function loggerCatchQueueSummary(_0x3ffa54,_0x31ed0c){return function(_0x16fb81){freeVariablesPredictive(_0x31ed0c);emitVoiceQueueSummary(_0x31ed0c);emitCampaignSummary(_0x31ed0c);loggerSyncQueueSummary[_0x81c8('0x9d')](_0x3ffa54,util[_0x81c8('0x9e')](_0x16fb81,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1abbef,_0x336b97){return function(_0x472630){loggerPredictive[_0x81c8('0x9d')](_0x336b97[_0x81c8('0x4a')],_0x1abbef);loggerPredictive['error'](_0x472630['stack']);freeVariablesPredictive(_0x336b97);};}function loggerCatch(_0x26c5df){return function(_0x1e04ba){logger[_0x81c8('0x9d')](_0x26c5df,util[_0x81c8('0x9e')](_0x1e04ba,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x393b7f){return _0x393b7f&&!_[_0x81c8('0x42')](_0x393b7f)&&_0x393b7f[_0x81c8('0x9f')]>0x0;}function decremetOriginate(_0x4c4551){if(!_[_0x81c8('0x42')](_0x4c4551)&&_0x4c4551!==null){if(typeof _0x4c4551[_0x81c8('0xa0')]!==_0x81c8('0xa1')){if(_0x4c4551[_0x81c8('0xa0')]>0x0){_0x4c4551['originated']-=0x1;}else{logger[_0x81c8('0x9d')](_0x81c8('0xa2'));}}}else{logger[_0x81c8('0x9d')](_0x81c8('0xa3'));}}function checkContactLowerLimitOriginate(_0x2a45c7,_0x40d7bd,_0x3a585a){if(_0x40d7bd>_0x3a585a){for(var _0x231739=0x0;_0x231739<_0x40d7bd-_0x3a585a;_0x231739+=0x1){decremetOriginate(_0x2a45c7);}}}function loggerGetContactDialer(_0x3410ea,_0x569b73,_0x436a5d){return function(_0x10761c){checkContactLowerLimitOriginate(_0x569b73,_0x436a5d,0x0);logger['error'](_0x3410ea,util[_0x81c8('0x9e')](_0x10761c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x540ff4){return function(_0x5be374){if(isNotNull(_0x5be374)&&isNotNull(_0x5be374[0x0])){if(_0x5be374[0x0][_0x81c8('0xa4')]>0x0){_0x540ff4[_0x81c8('0x43')]=_0x81c8('0xa5');logger[_0x81c8('0x86')](_0x81c8('0xa6')+_0x540ff4[_0x81c8('0x4a')],_0x5be374[0x0]['contactsRescheduled'],_0x81c8('0xa7'));}else{_0x540ff4[_0x81c8('0x43')]=_0x81c8('0xa8');logger[_0x81c8('0x86')](_0x81c8('0xa9')+_0x540ff4[_0x81c8('0x4a')]);}}};}function notSendMessagesQueue(_0x4127e7){if(_0x4127e7[_0x81c8('0xaa')]){freeVariablesPredictive(_0x4127e7);if(_0x4127e7[_0x81c8('0xa0')]===0x0&&_0x4127e7['talking']===0x0&&_0x4127e7[_0x81c8('0x5f')]===0x0&&(_0x4127e7[_0x81c8('0x58')]||0x0)===0x0){_0x4127e7[_0x81c8('0xaa')]=![];_0x4127e7[_0x81c8('0x56')]=0x0;_0x4127e7[_0x81c8('0x43')]=_0x81c8('0x46');loggerSyncQueueSummary[_0x81c8('0x9d')](_0x81c8('0xab'),_0x4127e7['name'],_0x81c8('0xac'));}else{_0x4127e7['message']=_0x81c8('0xad');loggerSyncQueueSummary[_0x81c8('0x9d')](_0x81c8('0xab'),_0x4127e7['name'],_0x81c8('0xae'));}emitVoiceQueueSummary(_0x4127e7);}}function notSendMessagesCampaign(_0x36d6bd){if(_0x36d6bd[_0x81c8('0xaa')]){if(_0x36d6bd['originated']===0x0){_0x36d6bd[_0x81c8('0xaa')]=![];_0x36d6bd[_0x81c8('0x43')]=_0x81c8('0x46');loggerSyncQueueSummary[_0x81c8('0x9d')](_0x81c8('0xaf'),_0x36d6bd['name'],_0x81c8('0xac'));}else{_0x36d6bd[_0x81c8('0x43')]=_0x81c8('0xad');loggerSyncQueueSummary[_0x81c8('0x9d')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x36d6bd[_0x81c8('0x4a')],'is\x20disactive');}emitCampaignSummary(_0x36d6bd);}}function createObjHistory(_0x539fea,_0x73009c,_0x2d2c17,_0x9bae86,_0x5c31f8){_0x539fea[_0x81c8('0x43')]=_0x2d2c17;var _0x3096e1=new Action(_0x539fea,_0x73009c);var _0x9250d0=new History(_0x3096e1);_0x9250d0[_0x81c8('0xb0')]=_0x9bae86;_0x9250d0[_0x81c8('0xb1')]=_0x5c31f8;_0x9250d0[_0x81c8('0xb2')]=_0x3096e1['starttime'];return _0x9250d0;}Dialer[_0x81c8('0x1e')][_0x81c8('0x3e')]=function(){var _0x536a39=this;setInterval(function(){_0x536a39[_0x81c8('0xb3')](_0x536a39[_0x81c8('0xb4')],_0x81c8('0xb5'));_0x536a39['clearZombieChannels'](_0x536a39[_0x81c8('0xb6')],_0x81c8('0xb7'));},0x32c8);};Dialer[_0x81c8('0x1e')][_0x81c8('0xb3')]=function(_0x3fce42,_0x585d17){var _0x2a5c44=this;for(var _0x3398e1 in _0x3fce42){if(typeof _0x3fce42[_0x3398e1]!==_0x81c8('0xa1')){this[_0x81c8('0x21')][_0x81c8('0xb8')](function(){if(!_[_0x81c8('0xb9')](_0x3fce42[_0x3398e1])){return ami[_0x81c8('0xba')]({'action':_0x81c8('0xbb'),'channel':_0x3fce42[_0x3398e1]['channel']})['catch'](function(_0x562d63){if(_0x562d63[_0x81c8('0x43')]===_0x81c8('0xbc')){setTimeout(function(){if(_0x3fce42[_0x3398e1]&&_0x3fce42[_0x3398e1]['type']!==_0x81c8('0x82')){_0x2a5c44['updateOriginated'](_0x2a5c44[_0x81c8('0x22')][_0x3fce42[_0x3398e1][_0x81c8('0xbd')]]);logger['error'](_0x81c8('0xbe'),_0x585d17,_0x3398e1,_0x3fce42[_0x3398e1][_0x81c8('0xbd')]);delete _0x3fce42[_0x3398e1];}if(_0x3fce42[_0x3398e1]&&_0x3fce42[_0x3398e1]['type']===_0x81c8('0x82')){_0x2a5c44[_0x81c8('0xbf')](_0x2a5c44['campaigns'][_0x3fce42[_0x3398e1]['queue']]);logger[_0x81c8('0x9d')]('[Dialer][checkChannel][ivr]',_0x585d17,_0x3398e1,_0x3fce42[_0x3398e1]['queue']);delete _0x3fce42[_0x3398e1];}},0x2328);}});}});}}};Dialer['prototype'][_0x81c8('0xc0')]=function(_0x4e59f0){return BPromise['resolve']()[_0x81c8('0x40')](cmHopper[_0x81c8('0xc0')](_0x4e59f0))['catch'](loggerCatch(_0x81c8('0xc1')));};Dialer[_0x81c8('0x1e')][_0x81c8('0xc2')]=function(_0x515748){return BPromise[_0x81c8('0xc3')]()['then'](cmHopperBlack[_0x81c8('0xc2')](_0x515748))['catch'](loggerCatch(_0x81c8('0xc4')));};Dialer[_0x81c8('0x1e')][_0x81c8('0xc5')]=function(_0x3c588e,_0x1abb88,_0x406714){return BPromise[_0x81c8('0xc3')]()[_0x81c8('0x40')](cmHopperAdditionalPhone[_0x81c8('0xc5')](_0x3c588e,_0x1abb88,_0x406714))['catch'](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer['prototype'][_0x81c8('0xc6')]=function(_0x137414,_0x140b98,_0x251b33){return BPromise[_0x81c8('0xc3')]()['then'](cmHopperAdditionalPhone[_0x81c8('0xc6')](_0x137414,_0x140b98,_0x251b33))[_0x81c8('0xc7')](loggerCatch(_0x81c8('0xc8')));};Dialer['prototype'][_0x81c8('0xc9')]=function(_0x18cf70){return BPromise[_0x81c8('0xc3')]()[_0x81c8('0x40')](cmHopperBlack[_0x81c8('0xc9')](_0x18cf70))[_0x81c8('0xc7')](loggerCatch(_0x81c8('0xca')));};Dialer[_0x81c8('0x1e')][_0x81c8('0xcb')]=function(_0xb296b2){return BPromise[_0x81c8('0xc3')]()['then'](cmHopperHistory[_0x81c8('0xcc')](_0xb296b2))[_0x81c8('0xc7')](loggerCatch(_0x81c8('0xcd')));};Dialer[_0x81c8('0x1e')][_0x81c8('0xce')]=function(_0x527eda){return BPromise[_0x81c8('0xc3')]()['then'](cmHopper[_0x81c8('0xce')](_0x527eda))['catch'](loggerCatch(_0x81c8('0xcf')));};Dialer[_0x81c8('0x1e')][_0x81c8('0xd0')]=function(_0x35f31c,_0x4ae2ab,_0x4d8065){return BPromise['resolve']()[_0x81c8('0x40')](cmHopper[_0x81c8('0xd0')](_0x35f31c,_0x4ae2ab,_0x4d8065))[_0x81c8('0xc7')](loggerCatch(_0x81c8('0xd1')));};Dialer[_0x81c8('0x1e')]['getContactDialer']=function(_0x47e14f,_0x1c1545,_0x5b21f4,_0x3e92e8,_0x5bd182){return BPromise[_0x81c8('0xc3')]()[_0x81c8('0x40')](cmHopper[_0x81c8('0xd2')](_0x47e14f,_0x1c1545,_0x5b21f4,_0x3e92e8))[_0x81c8('0xc7')](function(_0x16b7b0){_0x5bd182[_0x81c8('0xd3')]-=_0x5b21f4;_0x5bd182['temp']=_0x5bd182['temp']>0x0?_0x5bd182[_0x81c8('0xd3')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x16b7b0);});};Dialer[_0x81c8('0x1e')]['getContactDialerIvr']=function(_0x43ee3f,_0x28d4a8,_0x11106a,_0xa48261){return BPromise['resolve']()[_0x81c8('0x40')](cmHopper[_0x81c8('0xd4')](_0x43ee3f,_0x28d4a8,_0x11106a))[_0x81c8('0xc7')](function(_0x4eef57){_0xa48261[_0x81c8('0xd3')]-=_0x28d4a8;_0xa48261['temp']=_0xa48261[_0x81c8('0xd3')]>0x0?_0xa48261['temp']:0x0;loggerCatch(_0x81c8('0xd5'))(_0x4eef57);});};Dialer[_0x81c8('0x1e')][_0x81c8('0xd6')]=function(_0x318ac2){return BPromise[_0x81c8('0xc3')]()[_0x81c8('0x40')](voiceQueueRt[_0x81c8('0xd6')](_0x318ac2))['catch'](loggerCatch(_0x81c8('0xd7')));};Dialer[_0x81c8('0x1e')][_0x81c8('0xd8')]=function(_0x3a61cf){return BPromise[_0x81c8('0xc3')]()[_0x81c8('0x40')](cmHopper['moveContactManagedDialer'](_0x3a61cf))[_0x81c8('0xc7')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype'][_0x81c8('0xd9')]=function(_0xbd3fb9){return BPromise['resolve']()['then'](cmHopperHistory[_0x81c8('0xd9')](_0xbd3fb9))[_0x81c8('0xc7')](loggerCatch('[createHistory]\x20'));};Dialer[_0x81c8('0x1e')][_0x81c8('0xbf')]=function(_0x5785d7){if(!_[_0x81c8('0x42')](_0x5785d7)&&_0x5785d7!==null){if(typeof _0x5785d7[_0x81c8('0xa0')]!=='undefined'){if(_0x5785d7['originated']>0x0){_0x5785d7[_0x81c8('0xa0')]-=0x1;}else{logger[_0x81c8('0x9d')](_0x81c8('0xda'));}}}else{logger['error'](_0x81c8('0xdb'));}};Dialer['prototype'][_0x81c8('0xdc')]=function(_0x18417d,_0x5d83c5){var _0x4267f6=this;return function(_0x2b4c24){_0x4267f6[_0x81c8('0xbf')](_0x5d83c5);logger['error'](_0x18417d,util[_0x81c8('0x9e')](_0x2b4c24,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x81c8('0xdd')]=function(_0x1d210e,_0x40ae17,_0xef9960){var _0x566b96={'state':0x19,'statedesc':_0x81c8('0xde')};this['updateOriginated'](_0x40ae17);this[_0x81c8('0xdf')](_[_0x81c8('0x95')](_0x566b96,_[_0x81c8('0xe0')](_0xef9960,[_0x81c8('0xe1'),_0x81c8('0xe2'),_0x81c8('0xe3'),_0x81c8('0xe4'),_0x81c8('0xe5')])),_0x81c8('0xe6'),_0x81c8('0xe7'));logger[_0x81c8('0x9d')](_0x1d210e);};Dialer[_0x81c8('0x1e')][_0x81c8('0xe8')]=function(_0x28fd66){return _0x28fd66==='Success';};Dialer['prototype'][_0x81c8('0xe9')]=function(_0x218118){return!_[_0x81c8('0x42')](_0x218118)&&_0x218118&&!_['isUndefined'](_0x218118[_0x81c8('0x4a')])&&!_[_0x81c8('0x42')](_0x218118[_0x81c8('0x7e')])&&_0x218118['active']&&(this[_0x81c8('0x25')][util[_0x81c8('0x83')](_0x81c8('0xea'),_0x218118[_0x81c8('0x4a')])][_0x81c8('0xbb')]===_0x81c8('0xeb')||this['trunks'][util[_0x81c8('0x83')](_0x81c8('0xea'),_0x218118[_0x81c8('0x4a')])][_0x81c8('0xbb')]===_0x81c8('0xec'));};Dialer['prototype'][_0x81c8('0xdf')]=function(_0xea4041,_0x40d115,_0x20923c){this[_0x81c8('0xd9')](_0xea4041)[_0x81c8('0xc7')](loggerCatch(_0x40d115));this[_0x81c8('0xd8')](_0xea4041)['catch'](loggerCatch(_0x20923c));};Dialer[_0x81c8('0x1e')]['syncVarSet']=function(_0x29db5f){var _0x51e289=this[_0x81c8('0xb4')][_0x29db5f[_0x81c8('0xed')]];var _0xdd0156;if(!_[_0x81c8('0xb9')](_0x29db5f)&&!_[_0x81c8('0xb9')](_0x29db5f[_0x81c8('0xee')])&&!_['isNil'](_0x29db5f[_0x81c8('0xee')][_0x81c8('0xef')])&&_0x29db5f[_0x81c8('0xf0')]===_0x81c8('0xf1')&&_0x51e289){if(_0x51e289[_0x81c8('0x5c')]!==_0x81c8('0x82')&&this[_0x81c8('0x22')][_0x51e289[_0x81c8('0xbd')]][_0x81c8('0xf2')]&&_0x29db5f['value']==='HANGUP'){delete this[_0x81c8('0xb4')][_0x29db5f[_0x81c8('0xed')]];this[_0x81c8('0xbf')](this[_0x81c8('0x22')][_0x51e289[_0x81c8('0xbd')]]);this[_0x81c8('0x22')][_0x51e289['queue']][_0x81c8('0x65')]+=0x1;this[_0x81c8('0x22')][_0x51e289['queue']][_0x81c8('0xf3')]+=0x1;_0xdd0156=new Hangup(_0x51e289,_0x29db5f);_0xdd0156[_0x81c8('0xb0')]=0x12;_0xdd0156[_0x81c8('0xb1')]=_0x81c8('0xf4');_0xdd0156[_0x81c8('0xf5')]=_0x81c8('0xf6');ami[_0x81c8('0x53')](_0x81c8('0xf7'),ut[_0x81c8('0xf8')](_0xdd0156,_0x81c8('0xf9')));this[_0x81c8('0xdf')](_0xdd0156,'[syncHangupInAMD][createHistory]',_0x81c8('0xfa'));}if(_0x51e289[_0x81c8('0x5c')]!==_0x81c8('0x82')&&this[_0x81c8('0x22')][_0x51e289[_0x81c8('0xbd')]][_0x81c8('0xf2')]&&_0x29db5f[_0x81c8('0xfb')]===_0x81c8('0xfc')){var _0x83925f=this;return new BPromise(function(_0x26d9c8,_0xbf1faf){delete _0x83925f[_0x81c8('0xb4')][_0x29db5f[_0x81c8('0xed')]];_0x83925f[_0x81c8('0xbf')](_0x83925f[_0x81c8('0x22')][_0x51e289[_0x81c8('0xbd')]]);_0x83925f[_0x81c8('0x22')][_0x51e289[_0x81c8('0xbd')]][_0x81c8('0x65')]+=0x1;_0x83925f[_0x81c8('0x22')][_0x51e289[_0x81c8('0xbd')]][_0x81c8('0xf3')]+=0x1;var _0x5a6355=_0x83925f[_0x81c8('0x22')][_0x51e289[_0x81c8('0xbd')]];var _0x15ef72=new Hangup(_0x51e289,_0x29db5f);_0x15ef72[_0x81c8('0xb0')]=0x13;_0x15ef72[_0x81c8('0xb1')]=_0x81c8('0xfd');_0x15ef72[_0x81c8('0xf5')]=_0x81c8('0xf6');_0x15ef72['countmachineretry']+=0x1;_0x15ef72[_0x81c8('0xfe')]+=0x1;_0x15ef72['amd']=!![];ami['emit'](_0x81c8('0xf7'),ut[_0x81c8('0xf8')](_0x15ef72,_0x81c8('0xf9')));_0x83925f[_0x81c8('0xd9')](_0x15ef72)[_0x81c8('0xc7')](loggerCatch(_0x81c8('0xff')));if(_0x15ef72[_0x81c8('0x100')]+_0x15ef72[_0x81c8('0x101')]+_0x15ef72[_0x81c8('0x102')]+_0x15ef72[_0x81c8('0x103')]+_0x15ef72['countdropretry']+_0x15ef72[_0x81c8('0x104')]+_0x15ef72[_0x81c8('0x105')]+_0x15ef72[_0x81c8('0x106')]>=_0x5a6355[_0x81c8('0x107')]){_0x83925f[_0x81c8('0x108')](_0x15ef72,_0x26d9c8,_0xbf1faf,_0x81c8('0x109'));}else{if(_0x15ef72['countmachineretry']>=_0x5a6355[_0x81c8('0x10a')]){_0x83925f[_0x81c8('0x10b')](_0x15ef72,_0x26d9c8,_0xbf1faf,_0x81c8('0x10c'));}else{_0x83925f[_0x81c8('0xce')]({'active':![],'countmachineretry':_0x15ef72['countmachineretry'],'scheduledat':moment()[_0x81c8('0x10d')](_0x5a6355[_0x81c8('0x10e')],_0x81c8('0x10f'))[_0x81c8('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x15ef72['ContactId'],'ListId':_0x15ef72[_0x81c8('0xe2')],'VoiceQueueId':_0x15ef72['VoiceQueueId']||undefined,'CampaignId':_0x15ef72[_0x81c8('0xe5')]||undefined})['catch'](loggerCatch(_0x81c8('0x110')));_0x26d9c8({'reschedule':0x1});}}});}if(_0x51e289[_0x81c8('0x5c')]==='ivr'&&this[_0x81c8('0x23')][_0x51e289['queue']][_0x81c8('0xf2')]&&_0x29db5f[_0x81c8('0xfb')]===_0x81c8('0x111')){delete this['uniqueId'][_0x29db5f[_0x81c8('0xed')]];this[_0x81c8('0xbf')](this[_0x81c8('0x23')][_0x51e289['queue']]);_0xdd0156=new Hangup(_0x51e289,_0x29db5f);_0xdd0156[_0x81c8('0xb0')]=0x12;_0xdd0156[_0x81c8('0xb1')]=_0x81c8('0xf4');_0xdd0156[_0x81c8('0xf5')]=_0x81c8('0xf6');ami[_0x81c8('0x53')]('custom:amd',ut[_0x81c8('0xf8')](_0xdd0156,_0x81c8('0xf9')));this[_0x81c8('0xdf')](_0xdd0156,_0x81c8('0x112'),'[syncHangupInAMDIvr]');}if(_0x51e289[_0x81c8('0x5c')]===_0x81c8('0x82')&&this['campaigns'][_0x51e289[_0x81c8('0xbd')]][_0x81c8('0xf2')]&&_0x29db5f['value']===_0x81c8('0xfc')){var _0x83925f=this;return new BPromise(function(_0x4217aa,_0x3019f5){delete _0x83925f[_0x81c8('0xb4')][_0x29db5f[_0x81c8('0xed')]];_0x83925f[_0x81c8('0xbf')](_0x83925f[_0x81c8('0x23')][_0x51e289[_0x81c8('0xbd')]]);_0x83925f['campaigns'][_0x51e289[_0x81c8('0xbd')]]['outboundAnswerCallsDay']+=0x1;_0x83925f['campaigns'][_0x51e289[_0x81c8('0xbd')]][_0x81c8('0xf3')]+=0x1;var _0x51b04e=_0x83925f[_0x81c8('0x23')][_0x51e289[_0x81c8('0xbd')]];var _0x3463b2=new Hangup(_0x51e289,_0x29db5f);_0x3463b2[_0x81c8('0xb0')]=0x13;_0x3463b2[_0x81c8('0xb1')]='Machine';_0x3463b2['membername']='AMD';_0x3463b2[_0x81c8('0x105')]+=0x1;_0x3463b2[_0x81c8('0xfe')]+=0x1;_0x3463b2[_0x81c8('0xf9')]=!![];ami[_0x81c8('0x53')]('custom:amd',ut['buildObj'](_0x3463b2,_0x81c8('0xf9')));_0x83925f['createHistory'](_0x3463b2)[_0x81c8('0xc7')](loggerCatch(_0x81c8('0xff')));if(_0x3463b2[_0x81c8('0x100')]+_0x3463b2[_0x81c8('0x101')]+_0x3463b2[_0x81c8('0x102')]+_0x3463b2['countnosuchnumberretry']+_0x3463b2[_0x81c8('0x113')]+_0x3463b2[_0x81c8('0x104')]+_0x3463b2[_0x81c8('0x105')]+_0x3463b2[_0x81c8('0x106')]>=_0x51b04e[_0x81c8('0x107')]){_0x83925f[_0x81c8('0x108')](_0x3463b2,_0x4217aa,_0x3019f5,'reason19\x20machine....');}else{if(_0x3463b2[_0x81c8('0x105')]>=_0x51b04e[_0x81c8('0x10a')]){_0x83925f[_0x81c8('0x10b')](_0x3463b2,_0x4217aa,_0x3019f5,_0x81c8('0x10c'));}else{_0x83925f[_0x81c8('0xce')]({'active':![],'countmachineretry':_0x3463b2[_0x81c8('0x105')],'scheduledat':moment()['add'](_0x51b04e[_0x81c8('0x10e')],'minutes')[_0x81c8('0x83')](_0x81c8('0x114')),'ContactId':_0x3463b2[_0x81c8('0xe1')],'ListId':_0x3463b2[_0x81c8('0xe2')],'VoiceQueueId':_0x3463b2[_0x81c8('0xe4')]||undefined,'CampaignId':_0x3463b2[_0x81c8('0xe5')]||undefined})['catch'](loggerCatch(_0x81c8('0x110')));_0x4217aa({'reschedule':0x1});}}});}}};Dialer[_0x81c8('0x1e')][_0x81c8('0x35')]=function(_0x10c85e){var _0x5b6b58=this[_0x81c8('0xb4')][_0x10c85e['uniqueid']];var _0x535e40=this;var _0x490a79;if(_0x5b6b58&&_0x5b6b58[_0x81c8('0x5c')]==='ivr'){delete this[_0x81c8('0xb4')][_0x10c85e['uniqueid']];this[_0x81c8('0xbf')](this[_0x81c8('0x23')][_0x5b6b58[_0x81c8('0xbd')]]);this[_0x81c8('0x23')][_0x5b6b58[_0x81c8('0xbd')]]['ivrAnswerCallsDay']+=0x1;_0x490a79=new Hangup(_0x5b6b58,_0x10c85e);this['createHistory'](_0x490a79)[_0x81c8('0xc7')](loggerCatch(_0x81c8('0x115')));this[_0x81c8('0xd8')](_0x490a79)['catch'](loggerCatch(_0x81c8('0x116')));}if(_0x5b6b58&&_0x5b6b58[_0x81c8('0x5c')]!==_0x81c8('0x82')&&isNotNull(this[_0x81c8('0x22')][_0x5b6b58[_0x81c8('0xbd')]][_0x81c8('0x117')])){delete this['uniqueId'][_0x10c85e[_0x81c8('0xed')]];this['updateOriginated'](this[_0x81c8('0x22')][_0x5b6b58['queue']]);this[_0x81c8('0x22')][_0x5b6b58[_0x81c8('0xbd')]][_0x81c8('0x65')]+=0x1;this['voiceQueues'][_0x5b6b58[_0x81c8('0xbd')]][_0x81c8('0xf3')]+=0x1;_0x490a79=new Hangup(_0x5b6b58,_0x10c85e);_0x490a79['state']=0x10;_0x490a79['statedesc']=_0x81c8('0x118');_0x490a79[_0x81c8('0xf5')]=_0x81c8('0x119');this['createHistory'](_0x490a79)[_0x81c8('0xc7')](loggerCatch(_0x81c8('0x115')));this[_0x81c8('0xd8')](_0x490a79)[_0x81c8('0xc7')](loggerCatch(_0x81c8('0x116')));}if(_0x5b6b58&&_0x5b6b58[_0x81c8('0x5c')]!==_0x81c8('0x82')&&!isNotNull(this[_0x81c8('0x22')][_0x5b6b58[_0x81c8('0xbd')]][_0x81c8('0x117')])){delete this[_0x81c8('0xb4')][_0x10c85e[_0x81c8('0xed')]];this[_0x81c8('0xbf')](this[_0x81c8('0x22')][_0x5b6b58[_0x81c8('0xbd')]]);this[_0x81c8('0x22')][_0x5b6b58[_0x81c8('0xbd')]][_0x81c8('0x6e')]+=0x1;_0x490a79=new Hangup(_0x5b6b58,_0x10c85e);_0x490a79['state']=0xc;_0x490a79['statedesc']=_0x10c85e[_0x81c8('0x11a')];_0x490a79[_0x81c8('0xf5')]=_0x81c8('0x11b');this[_0x81c8('0xd9')](_0x490a79)[_0x81c8('0xc7')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x490a79)[_0x81c8('0xc7')](loggerCatch(_0x81c8('0x116')));}};Dialer['prototype'][_0x81c8('0x11c')]=function(_0x5a4b81){var _0x1be195=this[_0x81c8('0xb4')][_0x5a4b81[_0x81c8('0xed')]];var _0x4fe97f=this;if(this['voiceQueues'][_0x5a4b81[_0x81c8('0xbd')]]){if(_0x1be195&&_0x1be195[_0x81c8('0x5c')]!==_0x81c8('0x82')){delete this[_0x81c8('0xb4')][_0x5a4b81['uniqueid']];this[_0x81c8('0x22')][_0x5a4b81['queue']][_0x81c8('0x65')]+=0x1;var _0xd6a96c=new AgentComplete(_0x1be195,_0x5a4b81);if(_0x5a4b81[_0x81c8('0x11d')]==='agent'){_0xd6a96c['agiafterat']=this[_0x81c8('0x22')][_0x5a4b81[_0x81c8('0xbd')]][_0x81c8('0x11e')]&&this[_0x81c8('0x22')][_0x5a4b81[_0x81c8('0xbd')]][_0x81c8('0x11f')]?moment()['format'](_0x81c8('0x114')):undefined;}this[_0x81c8('0xd9')](_0xd6a96c)[_0x81c8('0xc7')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x81c8('0xd8')](_0xd6a96c)[_0x81c8('0xc7')](loggerCatch(_0x81c8('0x120')));}}};Dialer['prototype'][_0x81c8('0x2d')]=function(_0x4084cd){if(this[_0x81c8('0x22')][_0x4084cd[_0x81c8('0xbd')]]){if(this[_0x81c8('0xb4')][_0x4084cd[_0x81c8('0xed')]]&&this[_0x81c8('0xb4')][_0x4084cd[_0x81c8('0xed')]][_0x81c8('0x5c')]!==_0x81c8('0x82')){this[_0x81c8('0xbf')](this[_0x81c8('0x22')][_0x4084cd[_0x81c8('0xbd')]]);this[_0x81c8('0xb4')][_0x4084cd[_0x81c8('0xed')]]['answertime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x81c8('0x1e')][_0x81c8('0x121')]=function(_0x2952ff,_0x68f6b6){this[_0x81c8('0xd9')](_0x2952ff)[_0x81c8('0xc7')](loggerCatch(_0x81c8('0x122')));if(_0x68f6b6==0x0){this[_0x81c8('0xd8')](_0x2952ff)[_0x81c8('0xc7')](loggerCatch(_0x81c8('0x123')));}};Dialer[_0x81c8('0x1e')][_0x81c8('0x30')]=function(_0xddd454){var _0x50eca7=this[_0x81c8('0xb4')][_0xddd454[_0x81c8('0xed')]];var _0x4e52cf=this;var _0x3ba02c=![];var _0x40fdd4;var _0x31d838;if(this[_0x81c8('0x22')][_0xddd454[_0x81c8('0xbd')]]){if(_0x50eca7&&_0x50eca7[_0x81c8('0x5c')]!==_0x81c8('0x82')){delete this[_0x81c8('0xb4')][_0xddd454[_0x81c8('0xed')]];this[_0x81c8('0xbf')](this[_0x81c8('0x22')][_0xddd454[_0x81c8('0xbd')]]);_0x50eca7[_0x81c8('0x124')]=moment()[_0x81c8('0x83')](_0x81c8('0x114'));var _0x5a5b7f=new QueueCallerAbandon(_0x50eca7,_0xddd454);if(getSeconds(_0x50eca7[_0x81c8('0x124')],_0x50eca7[_0x81c8('0x125')])>=_0x50eca7['dialQueueTimeout']){this[_0x81c8('0x22')][_0xddd454['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x81c8('0x22')][_0xddd454[_0x81c8('0xbd')]][_0x81c8('0x69')]+=0x1;this['voiceQueues'][_0xddd454['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x5a5b7f[_0x81c8('0xb0')]=0xa;_0x5a5b7f[_0x81c8('0xb1')]=_0x81c8('0x126');_0x5a5b7f[_0x81c8('0x127')]=_0x81c8('0x128');_0x5a5b7f[_0x81c8('0x129')]=this['voiceQueues'][_0xddd454['queue']]['dialQueueProject2']?moment()[_0x81c8('0x83')](_0x81c8('0x114')):undefined;_0x5a5b7f[_0x81c8('0x113')]+=0x1;_0x5a5b7f[_0x81c8('0xfe')]+=0x1;_0x40fdd4=this[_0x81c8('0x22')][_0xddd454[_0x81c8('0xbd')]][_0x81c8('0x12a')];_0x31d838=this['voiceQueues'][_0xddd454[_0x81c8('0xbd')]][_0x81c8('0x12b')];_0x4e52cf['verifyAdditionalPhones'](_0x5a5b7f,_0x5a5b7f['state'],_0x50eca7[_0x81c8('0x12c')])[_0x81c8('0x40')](function(_0x5b580f){_0x3ba02c=_0x5b580f[_0x81c8('0x12d')]==0x1;if(_0x5a5b7f['countdropretry']>=_0x4e52cf[_0x81c8('0x22')][_0xddd454[_0x81c8('0xbd')]][_0x81c8('0x12e')]){_0x4e52cf[_0x81c8('0x121')](_0x5a5b7f,_0x5b580f['additional']);}else{_0x4e52cf[_0x81c8('0xce')]({'active':![],'countdropretry':_0x5a5b7f[_0x81c8('0x113')],'scheduledat':moment()[_0x81c8('0x10d')](_0x4e52cf[_0x81c8('0x22')][_0xddd454[_0x81c8('0xbd')]]['dialDropRetryFrequency'],_0x81c8('0x10f'))[_0x81c8('0x83')](_0x81c8('0x114')),'ContactId':_0x50eca7[_0x81c8('0xe1')],'ListId':_0x50eca7[_0x81c8('0xe2')],'VoiceQueueId':_0x50eca7[_0x81c8('0xe4')]||undefined,'CampaignId':_0x50eca7[_0x81c8('0xe5')]||undefined})[_0x81c8('0xc7')](loggerCatch('[rescheduleContact][Drop]'));var _0x5542b8=new History(_0x5a5b7f);_0x5542b8[_0x81c8('0xb0')]=0xa;_0x5542b8[_0x81c8('0xb1')]=_0x81c8('0x126');_0x5542b8[_0x81c8('0x12f')]=moment()[_0x81c8('0x83')](_0x81c8('0x114'));_0x5542b8['endtime']=_0x5542b8['starttime'];_0x5542b8[_0x81c8('0x130')]=_0x5a5b7f[_0x81c8('0x130')];_0x5542b8[_0x81c8('0x131')]=_0x5a5b7f[_0x81c8('0x131')];_0x4e52cf[_0x81c8('0xd9')](_0x5542b8)['catch'](loggerCatch(_0x81c8('0x132')));}})[_0x81c8('0x40')](function(_0x244c6c){if(_0x3ba02c)_0x4e52cf[_0x81c8('0xc6')](_0x5a5b7f,_0x40fdd4,_0x31d838)[_0x81c8('0x40')](function(_0x230872){return 0x1;});});}else{this['voiceQueues'][_0xddd454[_0x81c8('0xbd')]][_0x81c8('0x72')]+=0x1;this[_0x81c8('0x22')][_0xddd454['queue']][_0x81c8('0x133')]+=0x1;_0x5a5b7f[_0x81c8('0xb0')]=0xb;_0x5a5b7f[_0x81c8('0xb1')]=_0x81c8('0x134');_0x5a5b7f[_0x81c8('0x127')]=_0x81c8('0x135');_0x5a5b7f[_0x81c8('0x104')]+=0x1;_0x5a5b7f['countglobal']+=0x1;_0x40fdd4=this['voiceQueues'][_0xddd454[_0x81c8('0xbd')]][_0x81c8('0x136')];_0x31d838=this[_0x81c8('0x22')][_0xddd454[_0x81c8('0xbd')]][_0x81c8('0x12b')];_0x4e52cf['verifyAdditionalPhones'](_0x5a5b7f,_0x5a5b7f[_0x81c8('0xb0')],_0x50eca7[_0x81c8('0x12c')])['then'](function(_0x119451){if(_0x5a5b7f[_0x81c8('0x104')]>=_0x4e52cf[_0x81c8('0x22')][_0xddd454[_0x81c8('0xbd')]]['dialAbandonedMaxRetry']){_0x4e52cf[_0x81c8('0x121')](_0x5a5b7f,_0x119451['additional']);}else{_0x4e52cf[_0x81c8('0xce')]({'active':![],'countabandonedretry':_0x5a5b7f['countabandonedretry'],'scheduledat':moment()[_0x81c8('0x10d')](_0x4e52cf[_0x81c8('0x22')][_0xddd454[_0x81c8('0xbd')]][_0x81c8('0x136')],_0x81c8('0x10f'))[_0x81c8('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x50eca7['ContactId'],'ListId':_0x50eca7[_0x81c8('0xe2')],'VoiceQueueId':_0x50eca7[_0x81c8('0xe4')]||undefined,'CampaignId':_0x50eca7[_0x81c8('0xe5')]||undefined})[_0x81c8('0xc7')](loggerCatch(_0x81c8('0x137')));var _0x45ef95=new History(_0x5a5b7f);_0x45ef95[_0x81c8('0xb0')]=0xb;_0x45ef95[_0x81c8('0xb1')]=_0x81c8('0x134');_0x45ef95[_0x81c8('0x12f')]=moment()[_0x81c8('0x83')](_0x81c8('0x114'));_0x45ef95['endtime']=_0x45ef95[_0x81c8('0x12f')];_0x45ef95['calleridname']=_0x5a5b7f[_0x81c8('0x130')];_0x45ef95[_0x81c8('0x131')]=_0x5a5b7f[_0x81c8('0x131')];_0x4e52cf[_0x81c8('0xd9')](_0x45ef95)['catch'](loggerCatch(_0x81c8('0x138')));}})[_0x81c8('0x40')](function(_0x5f2298){if(_0x3ba02c)_0x4e52cf[_0x81c8('0xc6')](_0x5a5b7f,_0x40fdd4,_0x31d838)[_0x81c8('0x40')](function(_0x2e5a29){return 0x1;});});}}}};Dialer[_0x81c8('0x1e')][_0x81c8('0x37')]=function(_0x1fdbdb){if(this[_0x81c8('0xb6')][_0x1fdbdb[_0x81c8('0xed')]]){this[_0x81c8('0xb6')][_0x1fdbdb[_0x81c8('0xed')]][_0x81c8('0x139')]=_0x1fdbdb[_0x81c8('0x139')];}if(this['uniqueId'][_0x1fdbdb[_0x81c8('0xed')]]){this[_0x81c8('0xb4')][_0x1fdbdb[_0x81c8('0xed')]]['channel']=_0x1fdbdb[_0x81c8('0x139')];}};Dialer[_0x81c8('0x1e')][_0x81c8('0x3b')]=function(_0x49bbae){if(strategy[this['voiceQueues'][this[_0x81c8('0xb6')][_0x49bbae[_0x81c8('0x13a')]]['queue']][_0x81c8('0x55')]]===_0x81c8('0x1d')){if(this['actions'][_0x49bbae[_0x81c8('0x13a')]]&&_[_0x81c8('0xb9')](this[_0x81c8('0xb6')][_0x49bbae[_0x81c8('0x13a')]][_0x81c8('0x13b')])&&_0x49bbae[_0x81c8('0xbb')]==='1'&&_0x49bbae[_0x81c8('0x13c')]==='0'){if(this[_0x81c8('0x24')][_0x49bbae['stateinterface']]){if(!this['agents'][_0x49bbae[_0x81c8('0x13d')]][_0x81c8('0x13b')]){this[_0x81c8('0x24')][_0x49bbae[_0x81c8('0x13d')]]['locked']=!![];this[_0x81c8('0xb6')][_0x49bbae[_0x81c8('0x13a')]][_0x81c8('0x13b')]=!![];this[_0x81c8('0xb6')][_0x49bbae[_0x81c8('0x13a')]]['stateinterface']=_0x49bbae[_0x81c8('0x13d')];}}}}else if((strategy[this[_0x81c8('0x22')][this[_0x81c8('0xb6')][_0x49bbae['actionid']][_0x81c8('0xbd')]][_0x81c8('0x55')]]||_0x81c8('0x1c'))===_0x81c8('0x1c')){if(this[_0x81c8('0xb6')][_0x49bbae[_0x81c8('0x13a')]]){if(this['agents'][_0x49bbae[_0x81c8('0x13d')]]){this[_0x81c8('0xb6')][_0x49bbae['actionid']]['stateinterface']=_0x49bbae[_0x81c8('0x13d')];if(_['isNil'](this['queueBooked'][this['actions'][_0x49bbae[_0x81c8('0x13a')]][_0x81c8('0xbd')]])){this[_0x81c8('0x2a')][this['actions'][_0x49bbae['actionid']][_0x81c8('0xbd')]]=[];}this[_0x81c8('0x2a')][this['actions'][_0x49bbae[_0x81c8('0x13a')]][_0x81c8('0xbd')]][_0x81c8('0x13e')](_[_0x81c8('0x95')](_['pick'](this[_0x81c8('0xb6')][_0x49bbae[_0x81c8('0x13a')]],['idHopper',_0x81c8('0x13d')]),{'status':_0x49bbae[_0x81c8('0xbb')],'paused':_0x49bbae['paused']}));}}}};function unlockQueueStatus(_0x2f09f1,_0x4ee188){setTimeout(function(){if(_[_0x81c8('0x42')](_0x2f09f1[_0x81c8('0x13f')])){loggerBooked[_0x81c8('0x9d')](_0x81c8('0x140'),_0x4ee188);}_0x2f09f1['queueStatusComplete']=!![];loggerBooked['info'](_0x81c8('0x141'),_0x4ee188,JSON[_0x81c8('0x142')](_[_0x81c8('0xe0')](_0x2f09f1,['name','queueStatusComplete'])));},0x1f3);}Dialer[_0x81c8('0x1e')][_0x81c8('0x143')]=function(_0x496a9e){var _0x3d5fe6=this;var _0x1c2223=_0x3d5fe6[_0x81c8('0x22')][_0x3d5fe6[_0x81c8('0xb6')][_0x496a9e[_0x81c8('0x13a')]][_0x81c8('0xbd')]];if(strategy[this[_0x81c8('0x22')][this[_0x81c8('0xb6')][_0x496a9e[_0x81c8('0x13a')]][_0x81c8('0xbd')]]['strategy']]===_0x81c8('0x1d')){if(this['actions'][_0x496a9e['actionid']]&&this[_0x81c8('0xb6')][_0x496a9e[_0x81c8('0x13a')]]['stateinterface']){this[_0x81c8('0x144')]['run'](this['actions'][_0x496a9e[_0x81c8('0x13a')]][_0x81c8('0x145')],this[_0x81c8('0xb6')][_0x496a9e[_0x81c8('0x13a')]][_0x81c8('0x13d')])['catch'](function(_0x3d9c18){logger['error'](_0x81c8('0x146'),util[_0x81c8('0x9e')](_0x3d9c18,{'showHidden':![],'depth':null}));})[_0x81c8('0x20')](function(){_0x3d5fe6['updateOriginated'](_0x3d5fe6[_0x81c8('0x22')][_0x3d5fe6['actions'][_0x496a9e[_0x81c8('0x13a')]]['queue']]);_0x3d5fe6[_0x81c8('0x24')][_0x3d5fe6['actions'][_0x496a9e['actionid']][_0x81c8('0x13d')]][_0x81c8('0x13b')]=![];delete _0x3d5fe6[_0x81c8('0xb6')][_0x496a9e['actionid']];unlockQueueStatus(_0x1c2223);});}else{this[_0x81c8('0xbf')](this[_0x81c8('0x22')][this[_0x81c8('0xb6')][_0x496a9e[_0x81c8('0x13a')]][_0x81c8('0xbd')]]);this[_0x81c8('0xce')]({'active':![],'ContactId':this[_0x81c8('0xb6')][_0x496a9e[_0x81c8('0x13a')]][_0x81c8('0xe1')],'ListId':this[_0x81c8('0xb6')][_0x496a9e[_0x81c8('0x13a')]][_0x81c8('0xe2')],'VoiceQueueId':this[_0x81c8('0xb6')][_0x496a9e['actionid']][_0x81c8('0xe4')]||undefined,'CampaignId':this['actions'][_0x496a9e[_0x81c8('0x13a')]]['CampaignId']||undefined})[_0x81c8('0xc7')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x496a9e[_0x81c8('0x13a')]];unlockQueueStatus(_0x1c2223);}}else if((strategy[this['voiceQueues'][this[_0x81c8('0xb6')][_0x496a9e['actionid']][_0x81c8('0xbd')]][_0x81c8('0x55')]]||_0x81c8('0x1c'))===_0x81c8('0x1c')){var _0x2d5b60;if(this[_0x81c8('0xb6')][_0x496a9e[_0x81c8('0x13a')]]&&!_['isEmpty'](this[_0x81c8('0x2a')][this[_0x81c8('0xb6')][_0x496a9e[_0x81c8('0x13a')]][_0x81c8('0xbd')]])){if(this['queueBookedRR'][_0x3d5fe6['actions'][_0x496a9e[_0x81c8('0x13a')]][_0x81c8('0xbd')]]){this[_0x81c8('0x2b')][_0x3d5fe6[_0x81c8('0xb6')][_0x496a9e['actionid']][_0x81c8('0xbd')]]=this[_0x81c8('0x2b')][this[_0x81c8('0xb6')][_0x496a9e[_0x81c8('0x13a')]][_0x81c8('0xbd')]]?this[_0x81c8('0x2b')][this['actions'][_0x496a9e[_0x81c8('0x13a')]][_0x81c8('0xbd')]]:this[_0x81c8('0x2a')][this[_0x81c8('0xb6')][_0x496a9e[_0x81c8('0x13a')]]['queue']]?this['queueBooked'][this[_0x81c8('0xb6')][_0x496a9e[_0x81c8('0x13a')]][_0x81c8('0xbd')]][_0x81c8('0x147')]||0x0:0x0;}this[_0x81c8('0x2a')][this[_0x81c8('0xb6')][_0x496a9e[_0x81c8('0x13a')]]['queue']][_0x81c8('0x147')]=this[_0x81c8('0x2b')][this[_0x81c8('0xb6')][_0x496a9e['actionid']][_0x81c8('0xbd')]];for(var _0x32c5b6=0x0;_0x32c5b6=0x0;})[_0x81c8('0xc7')](myreject(_0x5d105b)));}}else{_0x11cf11[_0x81c8('0x13e')](ami[_0x81c8('0xba')]({'action':_0x81c8('0x162'),'command':util['format']('iftime\x20%s,%s',_0x3b016d,!_[_0x81c8('0x42')](config[_0x81c8('0x15f')][_0x32ab8f])?_0x32ab8f:'')})[_0x81c8('0x40')](function(_0x1d150c){return _0x1d150c[_0x81c8('0x165')][_0x81c8('0x166')]('true')>=0x0;})[_0x81c8('0xc7')](myreject(_0x5d105b)));}BPromise['all'](_0x11cf11)['then'](function(_0x3b7fd4){var _0x27382d=_['some'](_0x3b7fd4);if(_0x27382d){return _0x84902e(_0x27382d);}else{_0x311c9d[_0x81c8('0x43')]=_0x4ee5ec?_0x81c8('0x167'):_0x81c8('0x168');return _0x5d105b(msgResponse(_0x81c8('0x169'),_0x81c8('0x15c'),_0x81c8('0x16a')+_0x4ee5ec+'\x20'+_0x2b9bea+_0x81c8('0x16b')+util[_0x81c8('0x9e')](_0x3b016d,{'showHidden':![],'depth':null})+_0x81c8('0x16c')+_0x32ab8f));}})[_0x81c8('0xc7')](function(_0x412f49){return _0x5d105b(msgResponse(_0x81c8('0x15a'),_0x81c8('0x15c'),JSON[_0x81c8('0x142')](_0x412f49)));});});};Dialer['prototype'][_0x81c8('0x16d')]=function(_0x54cb5e){var _0x5e5f17=this;return function(){switch(_0x54cb5e[_0x81c8('0x62')]){case _0x81c8('0x16e'):freeVariablesPredictive(_0x54cb5e);_0x5e5f17[_0x81c8('0x16f')](_0x54cb5e,0x1);break;case _0x81c8('0x170'):freeVariablesPredictive(_0x54cb5e);_0x5e5f17[_0x81c8('0x16f')](_0x54cb5e,_0x54cb5e[_0x81c8('0x171')]);break;case _0x81c8('0x9'):_0x5e5f17[_0x81c8('0x9')](_0x54cb5e);break;case _0x81c8('0x8'):freeVariablesPredictive(_0x54cb5e);_0x5e5f17['handlePower'](_0x54cb5e,0x1);break;default:freeVariablesPredictive(_0x54cb5e);logger[_0x81c8('0x9d')](_0x81c8('0x172'),_0x54cb5e['name'],'method\x20not\x20recognized');}};};Dialer[_0x81c8('0x1e')][_0x81c8('0x173')]=function(_0x91d63f){return BPromise[_0x81c8('0xc3')]()['then'](cmHopper[_0x81c8('0x174')](_0x91d63f['id'],previewRecallmeReminderInterval))[_0x81c8('0x40')](function(_0x28ea4d){for(var _0x14e2b4=0x0;_0x14e2b4<_0x28ea4d[_0x81c8('0x9f')];_0x14e2b4++){var _0x17df95=_0x28ea4d[_0x14e2b4][_0x81c8('0x175')]['name'];if(_0x17df95)io['to'](util[_0x81c8('0x83')](_0x81c8('0x176'),_0x17df95))['emit'](_0x81c8('0x177'),{'hopper':_0x28ea4d[_0x14e2b4]});}})[_0x81c8('0xc7')](function(_0x3a7730){});};Dialer['prototype']['launchHandleIvr']=function(_0x5b5f86){var _0x14b84f=this;return function(){_0x14b84f[_0x81c8('0x178')](_0x5b5f86);};};Dialer[_0x81c8('0x1e')][_0x81c8('0xb')]=function(_0x26b77b){var _0x864d13=this;if(isNotPreview(_0x26b77b[_0x81c8('0x62')])){if(isVoiceQueueOutbound(_0x26b77b[_0x81c8('0x5c')])&&isActive(_0x26b77b[_0x81c8('0x61')])){_0x26b77b[_0x81c8('0xaa')]=!![];BPromise[_0x81c8('0xc3')]()[_0x81c8('0x40')](checkIsLoggedIn(_0x26b77b,_0x26b77b[_0x81c8('0x57')]))['then'](checkIsActive(_0x26b77b,_0x26b77b['dialActive']))[_0x81c8('0x40')](checkInterval(_0x26b77b))[_0x81c8('0x40')](_0x864d13[_0x81c8('0x155')](_0x26b77b))[_0x81c8('0x40')](_0x864d13[_0x81c8('0x159')](_0x26b77b[_0x81c8('0x179')],_0x26b77b[_0x81c8('0x17a')],_0x26b77b[_0x81c8('0x4a')],_0x26b77b))['then'](_0x864d13['checkIfTimeIntervals'](_0x26b77b[_0x81c8('0x48')],_0x26b77b[_0x81c8('0x17a')],_0x26b77b['name'],_0x26b77b))[_0x81c8('0x40')](_0x864d13[_0x81c8('0x16d')](_0x26b77b))[_0x81c8('0xc7')](loggerCatchQueueSummary(_0x81c8('0x17b'),_0x26b77b));}else{notSendMessagesQueue(_0x26b77b);}}else{freeVariablesPredictive(_0x26b77b);if(_0x26b77b[_0x81c8('0x17c')]){_0x864d13[_0x81c8('0x173')](_0x26b77b);}}};Dialer[_0x81c8('0x1e')]['syncCampaigns']=function(){var _0x2c7f24=this;var _0x52bb23;for(var _0x2c4ecf in this[_0x81c8('0x23')]){if(typeof this[_0x81c8('0x23')][_0x2c4ecf]!==_0x81c8('0xa1')){_0x52bb23=this['campaigns'][_0x2c4ecf];if(isCampaignIvr(_0x52bb23[_0x81c8('0x5c')])&&isActive(_0x52bb23[_0x81c8('0x7e')])){_0x52bb23[_0x81c8('0xaa')]=!![];BPromise[_0x81c8('0xc3')]()[_0x81c8('0x40')](checkIsActive(_0x52bb23,_0x52bb23[_0x81c8('0x7e')]))['then'](checkInterval(_0x52bb23))[_0x81c8('0x40')](_0x2c7f24['checkIsTrunkReachable'](_0x52bb23))[_0x81c8('0x40')](_0x2c7f24[_0x81c8('0x159')](_0x52bb23['dialGlobalInterval'],_0x52bb23[_0x81c8('0x17a')],_0x52bb23['name'],_0x52bb23))[_0x81c8('0x40')](_0x2c7f24[_0x81c8('0x15b')](_0x52bb23['Interval'],_0x52bb23[_0x81c8('0x17a')],_0x52bb23[_0x81c8('0x4a')],_0x52bb23))[_0x81c8('0x40')](_0x2c7f24[_0x81c8('0x17d')](_0x52bb23))[_0x81c8('0xc7')](loggerCatchQueueSummary(_0x81c8('0x17e'),_0x52bb23));}else{notSendMessagesCampaign(_0x52bb23);}}}};function getCallerIdRandom(_0x4bd48a,_0x161b2e){var _0xe865de;var _0x8f8a03;var _0x4bcbc5;if(_0x161b2e<=0x0){_0x161b2e=0x1;}_0xe865de=new RegExp(_0x81c8('0x17f')+_0x161b2e+'}$');_0x8f8a03=Math[_0x81c8('0x180')](0xa,_0x161b2e-0x1);_0x4bcbc5=Math[_0x81c8('0x180')](0xa,_0x161b2e)-0x1;return util['format']('%s',_[_0x81c8('0x181')](_0x4bd48a,_0xe865de,_['random'](_0x8f8a03,_0x4bcbc5)));}function extractCalleridName(_0x250fce){var _0x355f7=_0x250fce[_0x81c8('0x182')](/"(.*?)"/);return _0x355f7?_0x355f7[0x1]:_0x250fce;}function extractCalleridNumber(_0x455d96){var _0x2963b1=_0x455d96[_0x81c8('0x182')](/<(.*?)>/);return _0x2963b1?_0x2963b1[0x1]:_0x455d96;}Dialer[_0x81c8('0x1e')][_0x81c8('0x183')]=function(_0x581681,_0x57e742){var _0x1b9d1a=this;var _0x1ea3c0=uuid['v4']();this[_0x81c8('0xb6')][_0x1ea3c0]=new Action(_0x581681,_0x57e742,_0x1ea3c0);return new BPromise(function(_0x56b423,_0x3e1181){if(_[_0x81c8('0x42')](_0x581681)&&typeof _0x581681!==_0x81c8('0x184')){return _0x3e1181(msgResponse('originate',_0x81c8('0x15c'),'voiceQueue\x20is\x20undefine'));}if(_[_0x81c8('0x42')](_0x57e742[_0x81c8('0x185')])||_0x57e742[_0x81c8('0x185')]===null){return _0x3e1181(msgResponse(_0x81c8('0x186'),'Failure',_0x81c8('0x187')));}var _0x3da2e2={'XMD-CALLERID':_0x1b9d1a['actions'][_0x1ea3c0]['getCaller'](),'XMD-AGI':_0x581681[_0x81c8('0x117')]?util['format'](_0x81c8('0x188'),ipAgi,_0x581681[_0x81c8('0x117')]):_0x81c8('0x189'),'XMD-AGIAFTER':_0x581681['dialQueueProject2']?util[_0x81c8('0x83')](_0x81c8('0x188'),ipAgi,_0x581681[_0x81c8('0x11e')]):_0x81c8('0x189'),'XMD-QUEUE':_0x581681[_0x81c8('0x5c')]===_0x81c8('0x54')?util[_0x81c8('0x83')]('\x22%s,%s%s,,,%s\x22',_0x581681[_0x81c8('0x4a')],_0x581681[_0x81c8('0x18a')]||'',_0x581681[_0x81c8('0x11f')]?'c':'',_0x581681[_0x81c8('0x18b')]||0x3):_0x81c8('0x189'),'XMD-CONTACTID':_0x57e742['ContactId'],'XMD-CDRTYPE':_0x81c8('0x7'),'CALLERID(all)':_0x1b9d1a[_0x81c8('0xb6')][_0x1ea3c0][_0x81c8('0x18c')](),'XMD-AMD':_0x581681[_0x81c8('0xf2')]?_0x81c8('0x18d'):'NONE','XMD-DESTINATION':_0x81c8('0xf1')};if(_0x581681[_0x81c8('0xf2')]){_0x3da2e2['XMD-AMDINITIALSILENCE']=_0x581681[_0x81c8('0x18e')]||0x9c4;_0x3da2e2['XMD-AMDGREETING']=_0x581681[_0x81c8('0x18f')]||0x5dc;_0x3da2e2[_0x81c8('0x190')]=_0x581681['dialAMDAfterGreetingSilence']||0x320;_0x3da2e2['XMD-AMDTOTALANALYSISTIME']=_0x581681[_0x81c8('0x191')]||0x1388;_0x3da2e2[_0x81c8('0x192')]=_0x581681['dialAMDMinWordLength']||0x64;_0x3da2e2[_0x81c8('0x193')]=_0x581681[_0x81c8('0x194')]||0x32;_0x3da2e2[_0x81c8('0x195')]=_0x581681[_0x81c8('0x196')]||0x3;_0x3da2e2[_0x81c8('0x197')]=_0x581681['dialAMDSilenceThreshold']||0x100;_0x3da2e2[_0x81c8('0x198')]=_0x581681[_0x81c8('0x199')]||0x1388;}if(_0x581681[_0x81c8('0x5c')]==='outbound'){_0x3da2e2[_0x81c8('0x19a')]=_0x57e742[_0x81c8('0xe4')];}else{_0x3da2e2[_0x81c8('0x19b')]=_0x57e742['CampaignId'];}for(var _0x401921 in _0x57e742[_0x81c8('0x19c')]){if(typeof _0x57e742[_0x81c8('0x19c')][_0x401921]!=='undefined'){if(isNotNull(_0x57e742[_0x81c8('0x19c')][_0x401921])&&_0x401921!=='id'&&_0x401921!=='tags'&&_0x401921!=='createdAt'&&_0x401921!==_0x81c8('0x19d')){_0x3da2e2[util['format']('%s%s',_0x81c8('0x19e'),_['toUpper'](_0x401921))]=_0x57e742[_0x81c8('0x19c')][_0x401921];}}}var _0x166780=_0x1b9d1a[_0x81c8('0xe9')](_0x581681[_0x81c8('0x7d')])?getCallerId(_0x581681[_0x81c8('0x7d')]['callerid'],_0x581681['dialOriginateCallerIdName'],_0x581681['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x581681['dialOriginateCallerIdNumber'],_0x581681[_0x81c8('0x19f')]):_0x581681[_0x81c8('0x1a0')]):getCallerId(_[_0x81c8('0xb9')](_0x581681[_0x81c8('0x156')])?_0x581681[_0x81c8('0x7d')][_0x81c8('0x7f')]:_0x581681[_0x81c8('0x156')][_0x81c8('0x7f')],_0x581681['dialOriginateCallerIdName'],_0x581681[_0x81c8('0x19f')]>0x0?getCallerIdRandom(_0x581681['dialOriginateCallerIdNumber'],_0x581681[_0x81c8('0x19f')]):_0x581681[_0x81c8('0x1a0')]);if(_0x166780){_0x3da2e2['XMD-ORIGINATECALLERIDNAME']=_0x1b9d1a['actions'][_0x1ea3c0]['originatecalleridname']=extractCalleridName(_0x166780);_0x3da2e2[_0x81c8('0x1a1')]=_0x57e742[_0x81c8('0x185')];}return ami[_0x81c8('0xba')]({'actionid':_0x1ea3c0,'action':_0x81c8('0x186'),'channel':_0x1b9d1a[_0x81c8('0xe9')](_0x581681[_0x81c8('0x7d')])?util['format'](_0x81c8('0x1a2'),_0x581681['Trunk'][_0x81c8('0x4a')],isNotNull(_0x581681['dialPrefix'])?_0x581681[_0x81c8('0x1a3')]['trim']()||'':'',_0x581681[_0x81c8('0x1a4')]>0x0?_0x57e742['phone'][_0x81c8('0x1a5')](_0x581681[_0x81c8('0x1a4')]):_0x57e742[_0x81c8('0x185')]):util['format'](_0x81c8('0x1a2'),_[_0x81c8('0xb9')](_0x581681[_0x81c8('0x156')])?_0x581681[_0x81c8('0x7d')][_0x81c8('0x4a')]:_0x581681['TrunkBackup'][_0x81c8('0x4a')],isNotNull(_0x581681[_0x81c8('0x1a3')])?_0x581681[_0x81c8('0x1a3')]['trim']()||'':'',_0x581681[_0x81c8('0x1a4')]>0x0?_0x57e742[_0x81c8('0x185')][_0x81c8('0x1a5')](_0x581681[_0x81c8('0x1a4')]):_0x57e742[_0x81c8('0x185')]),'callerid':_0x166780,'Exten':_0x81c8('0xf1'),'Context':_0x81c8('0x1a6'),'Priority':'1','variable':_0x3da2e2,'timeout':(_0x581681[_0x81c8('0x64')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1ea3c0})[_0x81c8('0x40')](function(_0x1faff5){return _0x56b423(_0x1faff5);})['catch'](function(_0x32f8ba){_0x581681[_0x81c8('0x6b')]+=0x1;var _0x1b309e=new History(_0x1b9d1a[_0x81c8('0xb6')][_0x1ea3c0]);logger['error'](util[_0x81c8('0x83')]('[originateError]:\x20%s',JSON[_0x81c8('0x142')](_0x32f8ba)));_0x1b309e[_0x81c8('0xb0')]=0xe;_0x1b309e[_0x81c8('0xb1')]=_0x81c8('0x1a7');_0x1b309e[_0x81c8('0x12f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1b309e[_0x81c8('0xb2')]=_0x1b309e['starttime'];_0x1b9d1a[_0x81c8('0xd9')](_0x1b309e)[_0x81c8('0xc7')](loggerCatch(_0x81c8('0x1a8')));_0x1b9d1a[_0x81c8('0xd8')](_0x1b309e)[_0x81c8('0xc7')](loggerCatch(_0x81c8('0x1a8')))[_0x81c8('0x20')](function(){delete _0x1b9d1a[_0x81c8('0xb6')][_0x1ea3c0];return _0x3e1181(msgResponse('originate',_0x81c8('0x4f'),_0x81c8('0x1a9')));});});});};Dialer[_0x81c8('0x1e')]['syncOriginateResponse']=function(_0x5eaa50){var _0x590063=this[_0x81c8('0xb6')][_0x5eaa50[_0x81c8('0x13a')]];if(_0x590063){delete this[_0x81c8('0xb6')][_0x5eaa50[_0x81c8('0x13a')]];_0x590063[_0x81c8('0x125')]=moment()[_0x81c8('0x83')](_0x81c8('0x114'));var _0x5de59b=_0x590063[_0x81c8('0x5c')]===_0x81c8('0x82')?this['campaigns'][_0x590063[_0x81c8('0xbd')]]:this[_0x81c8('0x22')][_0x590063[_0x81c8('0x1aa')]()];if(!this[_0x81c8('0xe8')](_0x5eaa50[_0x81c8('0x1ab')])){this['updateOriginated'](_0x5de59b);return this[_0x81c8('0x1ac')](_0x590063,_0x5de59b,_0x5eaa50)[_0x81c8('0xc7')](loggerCatch(_0x81c8('0x1ad')));}this[_0x81c8('0xb4')][_0x5eaa50[_0x81c8('0xed')]]=_0x590063;}};Dialer[_0x81c8('0x1e')][_0x81c8('0x1ae')]=function(_0x1378ef,_0x50055c,_0x2e7e2b){var _0x2a6e94=new History(_0x50055c);if(_0x2a6e94['countbusyretry']+_0x2a6e94['countcongestionretry']+_0x2a6e94['countnoanswerretry']+_0x2a6e94[_0x81c8('0x103')]+_0x2a6e94['countdropretry']+_0x2a6e94[_0x81c8('0x104')]+_0x2a6e94[_0x81c8('0x105')]+_0x2a6e94[_0x81c8('0x106')]>=_0x2e7e2b[_0x81c8('0x107')]-0x1){return!![];}switch(_0x1378ef){case 0x3:if(_0x2a6e94['countnoanswerretry']>=_0x2e7e2b['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x81c8('0xce')]({'active':![],'countnoanswerretry':_0x2a6e94[_0x81c8('0x102')]+=0x1,'scheduledat':moment()['add'](_0x2e7e2b['dialNoAnswerRetryFrequency'],_0x81c8('0x10f'))[_0x81c8('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2a6e94['ContactId'],'ListId':_0x2a6e94[_0x81c8('0xe2')],'VoiceQueueId':_0x2a6e94[_0x81c8('0xe4')]||undefined,'CampaignId':_0x2a6e94[_0x81c8('0xe5')]||undefined})['catch'](loggerCatch(_0x81c8('0x1af')));break;case 0x5:if(_0x2a6e94[_0x81c8('0x100')]>=_0x2e7e2b[_0x81c8('0x1b0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x2a6e94[_0x81c8('0x100')]+=0x1,'scheduledat':moment()[_0x81c8('0x10d')](_0x2e7e2b[_0x81c8('0x1b1')],_0x81c8('0x10f'))[_0x81c8('0x83')](_0x81c8('0x114')),'ContactId':_0x2a6e94['ContactId'],'ListId':_0x2a6e94['ListId'],'VoiceQueueId':_0x2a6e94[_0x81c8('0xe4')]||undefined,'CampaignId':_0x2a6e94[_0x81c8('0xe5')]||undefined})[_0x81c8('0xc7')](loggerCatch(_0x81c8('0x1b2')));break;case 0x8:if(_0x2a6e94[_0x81c8('0x101')]>=_0x2e7e2b[_0x81c8('0x1b3')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x2a6e94[_0x81c8('0x101')]+=0x1,'scheduledat':moment()[_0x81c8('0x10d')](_0x2e7e2b['dialCongestionRetryFrequency'],_0x81c8('0x10f'))[_0x81c8('0x83')](_0x81c8('0x114')),'ContactId':_0x2a6e94[_0x81c8('0xe1')],'ListId':_0x2a6e94[_0x81c8('0xe2')],'VoiceQueueId':_0x2a6e94['VoiceQueueId']||undefined,'CampaignId':_0x2a6e94['CampaignId']||undefined})[_0x81c8('0xc7')](loggerCatch(_0x81c8('0x1b4')));break;case 0x0:if(_0x2a6e94[_0x81c8('0x103')]>=_0x2e7e2b[_0x81c8('0x1b5')]-0x1){return!![];}else{this[_0x81c8('0xce')]({'active':![],'countnosuchnumberretry':_0x2a6e94['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x81c8('0x10d')](_0x2e7e2b[_0x81c8('0x1b6')],'minutes')[_0x81c8('0x83')](_0x81c8('0x114')),'ContactId':_0x2a6e94[_0x81c8('0xe1')],'ListId':_0x2a6e94[_0x81c8('0xe2')],'VoiceQueueId':_0x2a6e94[_0x81c8('0xe4')]||undefined,'CampaignId':_0x2a6e94['CampaignId']||undefined})['catch'](loggerCatch(_0x81c8('0x1b7')));}break;case 0xa:if(_0x2a6e94[_0x81c8('0x113')]>=_0x2e7e2b[_0x81c8('0x12e')]-0x1){return!![];}this[_0x81c8('0xce')]({'active':![],'countdropretry':_0x2a6e94[_0x81c8('0x113')]+=0x1,'scheduledat':moment()[_0x81c8('0x10d')](_0x2e7e2b[_0x81c8('0x12a')],_0x81c8('0x10f'))[_0x81c8('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2a6e94[_0x81c8('0xe1')],'ListId':_0x2a6e94['ListId'],'VoiceQueueId':_0x2a6e94[_0x81c8('0xe4')]||undefined,'CampaignId':_0x2a6e94[_0x81c8('0xe5')]||undefined})[_0x81c8('0xc7')](loggerCatch(_0x81c8('0x1b8')));break;case 0xb:if(_0x2a6e94[_0x81c8('0x104')]>=_0x2e7e2b[_0x81c8('0x1b9')]-0x1){return!![];}this[_0x81c8('0xce')]({'active':![],'countabandonedretry':_0x2a6e94[_0x81c8('0x104')]+=0x1,'scheduledat':moment()['add'](_0x2e7e2b[_0x81c8('0x136')],_0x81c8('0x10f'))[_0x81c8('0x83')](_0x81c8('0x114')),'ContactId':_0x2a6e94[_0x81c8('0xe1')],'ListId':_0x2a6e94[_0x81c8('0xe2')],'VoiceQueueId':_0x2a6e94['VoiceQueueId']||undefined,'CampaignId':_0x2a6e94[_0x81c8('0xe5')]||undefined})[_0x81c8('0xc7')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x2a6e94[_0x81c8('0x105')]>=_0x2e7e2b[_0x81c8('0x10a')]-0x1){return!![];}this[_0x81c8('0xce')]({'active':![],'countmachineretry':_0x2a6e94['countmachineretry']+=0x1,'scheduledat':moment()[_0x81c8('0x10d')](_0x2e7e2b[_0x81c8('0x10e')],_0x81c8('0x10f'))['format'](_0x81c8('0x114')),'ContactId':_0x2a6e94[_0x81c8('0xe1')],'ListId':_0x2a6e94[_0x81c8('0xe2')],'VoiceQueueId':_0x2a6e94[_0x81c8('0xe4')]||undefined,'CampaignId':_0x2a6e94[_0x81c8('0xe5')]||undefined})[_0x81c8('0xc7')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x2a6e94[_0x81c8('0x106')]>=_0x2e7e2b['dialAgentRejectMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x2a6e94[_0x81c8('0x106')]+=0x1,'scheduledat':moment()['add'](_0x2e7e2b[_0x81c8('0x1ba')],_0x81c8('0x10f'))[_0x81c8('0x83')](_0x81c8('0x114')),'ContactId':_0x2a6e94[_0x81c8('0xe1')],'ListId':_0x2a6e94[_0x81c8('0xe2')],'VoiceQueueId':_0x2a6e94['VoiceQueueId']||undefined,'CampaignId':_0x2a6e94[_0x81c8('0xe5')]||undefined})[_0x81c8('0xc7')](loggerCatch(_0x81c8('0x1bb')));break;default:return!![];}};Dialer[_0x81c8('0x1e')][_0x81c8('0x1ac')]=function(_0x43e461,_0x481edc,_0x19abd8){var _0x34a114=this;var _0x5541da=new History(_0x43e461);var _0x1d1c46=![];var _0x87bb2;var _0x3a240b;return new BPromise(function(_0x315411,_0x57e904){if(_['isUndefined'](_0x481edc)&&typeof _0x481edc!==_0x81c8('0x184')){return _0x57e904(msgResponse(_0x81c8('0x1bc'),_0x81c8('0x15c'),_0x81c8('0x1bd')));}if(_['isUndefined'](_0x19abd8)&&typeof _0x19abd8!=='object'){return _0x57e904(msgResponse('[callProgressDetecting]',_0x81c8('0x15c'),_0x81c8('0x1be')));}_0x34a114[_0x81c8('0xc5')](_0x5541da,_0x19abd8[_0x81c8('0x11d')],_0x481edc)[_0x81c8('0x40')](function(_0x4241e8){if(_0x4241e8[_0x81c8('0x12d')]==0x1)_0x1d1c46=!![];switch(_0x19abd8['reason']){case'0':_0x481edc[_0x81c8('0x6a')]+=0x1;_0x5541da['state']=0x0;_0x5541da['statedesc']=_0x81c8('0x1bf');_0x5541da[_0x81c8('0x103')]+=0x1;_0x5541da[_0x81c8('0xfe')]+=0x1;ami[_0x81c8('0x53')](_0x81c8('0x1c0'),ut['buildObj'](_0x43e461,_0x81c8('0x1c1')));_0x87bb2=_0x481edc[_0x81c8('0x1b6')];_0x3a240b=_0x481edc[_0x81c8('0x12b')];_0x34a114['createHistory'](_0x5541da)['catch'](loggerCatch(_0x81c8('0xff')));if(_0x34a114['checkRetriveMax'](0x0,_0x43e461,_0x481edc)&&!_0x1d1c46){if(_0x5541da[_0x81c8('0x103')]>=_0x481edc[_0x81c8('0x1b5')]){_0x34a114[_0x81c8('0x10b')](_0x5541da,_0x315411,_0x57e904,'reason\x200\x20no\x20such\x20number....');}else{_0x34a114[_0x81c8('0x108')](_0x5541da,_0x315411,_0x57e904,_0x81c8('0x1c2'));}}break;case'3':_0x481edc[_0x81c8('0x1c3')]+=0x1;_0x5541da['state']=0x3;_0x5541da[_0x81c8('0xb1')]=_0x81c8('0x1c4');_0x5541da[_0x81c8('0x102')]+=0x1;_0x5541da[_0x81c8('0xfe')]+=0x1;ami[_0x81c8('0x53')](_0x81c8('0x1c5'),ut[_0x81c8('0xf8')](_0x43e461,_0x81c8('0x1c6')));_0x87bb2=_0x481edc[_0x81c8('0x1c7')];_0x3a240b=_0x481edc[_0x81c8('0x12b')];_0x34a114['createHistory'](_0x5541da)[_0x81c8('0xc7')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x34a114[_0x81c8('0x1ae')](0x3,_0x43e461,_0x481edc)&&!_0x1d1c46){if(_0x5541da[_0x81c8('0x102')]>=_0x481edc[_0x81c8('0x1c8')]){_0x34a114['createStateFinal'](_0x5541da,_0x315411,_0x57e904,_0x81c8('0x1c9'));}else{_0x34a114[_0x81c8('0x108')](_0x5541da,_0x315411,_0x57e904,_0x81c8('0x1c9'));}}break;case'5':_0x481edc[_0x81c8('0x1ca')]+=0x1;_0x5541da[_0x81c8('0xb0')]=0x5;_0x5541da[_0x81c8('0xb1')]=_0x81c8('0x1cb');_0x5541da[_0x81c8('0x100')]+=0x1;_0x5541da['countglobal']+=0x1;ami['emit'](_0x81c8('0x1cc'),ut['buildObj'](_0x43e461,_0x81c8('0x1cd')));_0x87bb2=_0x481edc[_0x81c8('0x1b1')];_0x3a240b=_0x481edc['callAdditionalPhoneAfterMin'];_0x34a114[_0x81c8('0xd9')](_0x5541da)[_0x81c8('0xc7')](loggerCatch(_0x81c8('0x1ce')));if(_0x34a114['checkRetriveMax'](0x5,_0x43e461,_0x481edc)&&!_0x1d1c46){if(_0x5541da[_0x81c8('0x100')]>=_0x481edc[_0x81c8('0x1b0')]){_0x34a114[_0x81c8('0x10b')](_0x5541da,_0x315411,_0x57e904,_0x81c8('0x1cf'));}else{_0x34a114[_0x81c8('0x108')](_0x5541da,_0x315411,_0x57e904,'reason\x205\x20busy');}}break;case'8':_0x481edc[_0x81c8('0x67')]+=0x1;_0x5541da['state']=0x8;_0x5541da['statedesc']=_0x81c8('0x1d0');_0x5541da['countcongestionretry']+=0x1;_0x5541da[_0x81c8('0xfe')]+=0x1;_0x87bb2=_0x481edc['dialCongestionRetryFrequency'];_0x3a240b=_0x481edc[_0x81c8('0x12b')];ami[_0x81c8('0x53')](_0x81c8('0x1d1'),ut[_0x81c8('0xf8')](_0x43e461,_0x81c8('0x1d2')));_0x34a114[_0x81c8('0xd9')](_0x5541da)[_0x81c8('0xc7')](loggerCatch(_0x81c8('0x1d3')));if(_0x34a114[_0x81c8('0x1ae')](0x8,_0x43e461,_0x481edc)&&!_0x1d1c46){if(_0x5541da['countcongestionretry']>=_0x481edc['dialCongestionMaxRetry']){_0x34a114['createStateFinal'](_0x5541da,_0x315411,_0x57e904,'reason\x208\x20congestion');}else{_0x34a114[_0x81c8('0x108')](_0x5541da,_0x315411,_0x57e904,_0x81c8('0x1d4'));}}break;case'11':_0x481edc[_0x81c8('0x1d5')]+=0x1;_0x5541da[_0x81c8('0xb0')]=0xb;_0x5541da['statedesc']=_0x81c8('0x134');_0x5541da[_0x81c8('0x104')]+=0x1;_0x5541da[_0x81c8('0xfe')]+=0x1;_0x87bb2=_0x481edc['dialAbandonedRetryFrequency'];_0x3a240b=_0x481edc[_0x81c8('0x12b')];_0x34a114[_0x81c8('0xd9')](_0x5541da)['catch'](loggerCatch(_0x81c8('0x138')));if(_0x34a114[_0x81c8('0x1ae')](0xb,_0x43e461,_0x481edc)&&!_0x1d1c46){if(_0x5541da['countabandonedretry']>=_0x481edc[_0x81c8('0x1b9')]){_0x34a114[_0x81c8('0x10b')](_0x5541da,_0x315411,_0x57e904,_0x81c8('0x1d6'));}else{_0x34a114[_0x81c8('0x108')](_0x5541da,_0x315411,_0x57e904,'reason\x2011\x20abandoned');}}break;case'20':_0x481edc[_0x81c8('0x6d')]+=0x1;_0x5541da[_0x81c8('0xb0')]=0x14;_0x5541da[_0x81c8('0xb1')]='AgentReject';_0x5541da[_0x81c8('0x106')]+=0x1;_0x5541da[_0x81c8('0xfe')]+=0x1;_0x87bb2=_0x481edc['dialAgentRejectRetryFrequency'];_0x3a240b=_0x481edc['callAdditionalPhoneAfterMin'];ami[_0x81c8('0x53')](_0x81c8('0x1d7'),ut['buildObj'](_0x43e461,_0x81c8('0x1d8')));_0x34a114[_0x81c8('0xd9')](_0x5541da)[_0x81c8('0xc7')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x34a114[_0x81c8('0x1ae')](0x14,_0x43e461,_0x481edc)&&!_0x1d1c46){if(_0x5541da[_0x81c8('0x106')]>=_0x481edc[_0x81c8('0x1d9')]){_0x34a114[_0x81c8('0x10b')](_0x5541da,_0x315411,_0x57e904,'reason\x2020\x20agentreject');}else{_0x34a114['stateGlobal'](_0x5541da,_0x315411,_0x57e904,_0x81c8('0x1da'));}}break;default:_0x481edc[_0x81c8('0x6e')]+=0x1;_0x5541da['state']=0xc;_0x5541da[_0x81c8('0xb1')]=_0x19abd8[_0x81c8('0x11d')];_0x87bb2=_0x481edc[_0x81c8('0x1ba')];_0x3a240b=_0x481edc[_0x81c8('0x12b')];_0x34a114[_0x81c8('0xd9')](_0x5541da)[_0x81c8('0xc7')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x34a114[_0x81c8('0x1ae')](_0x19abd8[_0x81c8('0x11d')],_0x43e461,_0x481edc)&&!_0x1d1c46){if(_0x5541da[_0x81c8('0x100')]+_0x5541da[_0x81c8('0x101')]+_0x5541da['countnoanswerretry']+_0x5541da['countnosuchnumberretry']+_0x5541da['countdropretry']+_0x5541da[_0x81c8('0x104')]+_0x5541da['countmachineretry']+_0x5541da[_0x81c8('0x106')]>=_0x481edc[_0x81c8('0x107')]){_0x34a114[_0x81c8('0x108')](_0x5541da,_0x315411,_0x57e904,_0x19abd8[_0x81c8('0x11d')]);}else{_0x34a114[_0x81c8('0x10b')](_0x5541da,_0x315411,_0x57e904,_0x19abd8[_0x81c8('0x11d')]);}}}})[_0x81c8('0x40')](function(_0x5be663){if(_0x1d1c46){_0x34a114[_0x81c8('0xc6')](_0x5541da,_0x87bb2,_0x3a240b)[_0x81c8('0x40')](function(_0x3aff2f){return _0x315411(0x1);});}});});};Dialer['prototype'][_0x81c8('0x108')]=function(_0x47ee4b,_0x18d839,_0x304341,_0x20766f){var _0x4e9993=new Final(_0x47ee4b);_0x4e9993[_0x81c8('0xb0')]=0xf;_0x4e9993['statedesc']='Global';this[_0x81c8('0x10b')](_0x4e9993,_0x18d839,_0x304341,_0x20766f);};Dialer[_0x81c8('0x1e')][_0x81c8('0x10b')]=function(_0x37e580,_0x33a99b,_0x17ae87,_0x17c70d){this[_0x81c8('0xd8')](_0x37e580)[_0x81c8('0x40')](function(){return _0x33a99b(msgResponse(_0x81c8('0x1bc'),_0x81c8('0x1db'),_0x17c70d));})[_0x81c8('0xc7')](function(){return _0x17ae87(msgResponse(_0x81c8('0x1dc'),_0x81c8('0x15c'),_0x81c8('0x1dd')));});};Dialer[_0x81c8('0x1e')][_0x81c8('0x9')]=function(_0x386634){var _0x3b7046=_0x386634[_0x81c8('0x1de')]/0x64;var _0x47812b=_0x386634[_0x81c8('0x69')]/(_0x386634['outboundDropCallsDayTimeout']+_0x386634[_0x81c8('0x65')]);var _0x3454ee=Math[_0x81c8('0x1df')](_0x386634[_0x81c8('0x79')]*(_0x386634[_0x81c8('0x1e0')]/0x64));var _0x5314c8=Math['round'](_0x386634['predictiveIntervalAvailable']*(_0x386634[_0x81c8('0x1e1')]/0x64));var _0x35be04=_0x386634[_0x81c8('0x56')]+_0x386634['talking'];var _0x37071e=Math[_0x81c8('0x1e2')](_0x386634[_0x81c8('0x1e3')]*_0x386634[_0x81c8('0x7b')]*_0x386634[_0x81c8('0x76')]*_0x386634[_0x81c8('0x77')]);if(_[_0x81c8('0x42')](_0x386634[_0x81c8('0x96')])){if(!_[_0x81c8('0x42')](_0x386634[_0x81c8('0x28')])){_0x386634['startPredictive']=undefined;loggerPredictive[_0x81c8('0x9d')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x81c8('0x42')](_0x386634[_0x81c8('0x99')])){loggerPredictive[_0x81c8('0x9d')](_0x81c8('0x1e4'),_0x81c8('0x1e5'));clearInterval(_0x386634[_0x81c8('0x99')]);_0x386634['handlePredictive']=undefined;}_0x386634['startProgressive']=moment()['format'](_0x81c8('0x114'));loggerPredictive[_0x81c8('0x86')](_0x386634[_0x81c8('0x4a')],_0x81c8('0x1e6'),_0x386634[_0x81c8('0x96')]);this['handlePower'](_0x386634,0x1);}else if(ifInterval(_0x386634[_0x81c8('0x1e7')],_0x386634[_0x81c8('0x96')])){this[_0x81c8('0x16f')](_0x386634,0x1);loggerPredictiveCalls[_0x81c8('0x86')](_0x81c8('0x1e8'),_0x386634[_0x81c8('0x96')],_0x386634[_0x81c8('0x4a')]);_0x386634['erlangCalls']=0x0;_0x386634[_0x81c8('0x75')]=0x0;}else if(_0x3b7046<_0x47812b&&_0x386634[_0x81c8('0x1e9')]==='dropRate'){freeVariablesPredictive(_0x386634);loggerPredictive[_0x81c8('0x86')](_0x81c8('0x1ea'),_0x81c8('0x1eb'),_0x47812b,'startProgressive',_0x386634[_0x81c8('0x4a')]);}else if(_0x37071e<_0x386634[_0x81c8('0x75')]&&_0x386634['dialPredictiveOptimization']===_0x81c8('0x1ec')){freeVariablesPredictive(_0x386634);loggerPredictive[_0x81c8('0x86')](_0x81c8('0x1ed'),_0x81c8('0x1ee'),_0x37071e,'Drop\x20in\x20this\x20interval',_0x386634[_0x81c8('0x75')],'startProgressive',_0x386634[_0x81c8('0x4a')]);}else if(!ifInterval(_0x386634[_0x81c8('0x1e7')],_0x386634[_0x81c8('0x96')])&&_[_0x81c8('0x42')](_0x386634[_0x81c8('0x28')])&&!_['isUndefined'](_0x386634[_0x81c8('0x96')])){_0x386634['startPredictive']=moment()['format'](_0x81c8('0x114'));loggerPredictive[_0x81c8('0x86')](_0x386634['name'],_0x81c8('0x1ef'),_0x386634['startPredictive']);this[_0x81c8('0xcb')](_0x386634[_0x81c8('0x1e7')])[_0x81c8('0x40')](this[_0x81c8('0x1f0')](_0x386634))[_0x81c8('0x40')](mergeDataErlangB(_0x386634))[_0x81c8('0x40')](this[_0x81c8('0x1f1')](_0x386634))[_0x81c8('0xc7')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x386634));}else if(!ifInterval(_0x386634[_0x81c8('0x1e7')],_0x386634[_0x81c8('0x28')])){_0x386634['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x386634[_0x81c8('0x28')]=moment()['format'](_0x81c8('0x114'));loggerPredictive[_0x81c8('0x86')](_0x386634['name'],_0x81c8('0x1f2'),_0x386634['startPredictive']);clearInterval(_0x386634[_0x81c8('0x99')]);_0x386634[_0x81c8('0x99')]=undefined;this[_0x81c8('0xcb')](_0x386634[_0x81c8('0x1e7')])[_0x81c8('0x40')](this[_0x81c8('0x1f0')](_0x386634))[_0x81c8('0x40')](mergeDataErlangB(_0x386634))[_0x81c8('0x40')](this[_0x81c8('0x1f1')](_0x386634))[_0x81c8('0xc7')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x386634));}else if(_0x386634['predictiveIntervalAvailable']&&_0x35be04<_0x386634[_0x81c8('0x79')]-_0x5314c8){freeVariablesPredictive(_0x386634);loggerPredictive[_0x81c8('0x86')](_0x386634[_0x81c8('0x4a')],_0x81c8('0x1f3'),_0x35be04,_0x81c8('0x1f4'),_0x386634[_0x81c8('0x79')],'-',_0x5314c8,'=',_0x386634[_0x81c8('0x79')]-_0x5314c8,')');}else if(_0x386634[_0x81c8('0x79')]&&_0x35be04>_0x386634[_0x81c8('0x79')]+_0x3454ee){freeVariablesPredictive(_0x386634);loggerPredictive[_0x81c8('0x86')](_0x386634[_0x81c8('0x4a')],_0x81c8('0x1f3'),_0x35be04,_0x81c8('0x1f5'),_0x386634[_0x81c8('0x79')],'+',_0x3454ee,'=',_0x386634['predictiveIntervalAvailable']+_0x3454ee,')');}};Dialer[_0x81c8('0x1e')]['getDataPredictive']=function(_0x3181e6){var _0x40c398=this;return function(_0x277053){return new BPromise(function(_0x9c8ddb,_0x2af8a4){_['merge'](_0x3181e6,_0x277053[0x0]);if(checkGetDataPredictive(_0x277053[0x0])){var _0x1961a1=_0x3181e6['predictiveIntervalAvailable']=_0x3181e6[_0x81c8('0x5a')]+_0x3181e6[_0x81c8('0x56')];var _0x44c76f=_0x3181e6[_0x81c8('0x1e7')]*0x3c;var _0x137cf8=_0x277053[0x0][_0x81c8('0x71')]+_0x277053[0x0][_0x81c8('0x70')];var _0x19fe69=(_0x277053[0x0][_0x81c8('0x6f')]+_0x277053[0x0][_0x81c8('0x73')]+_0x277053[0x0][_0x81c8('0x72')])/_0x277053[0x0][_0x81c8('0x7a')];_0x3181e6[_0x81c8('0x76')]=_0x19fe69>0x0?_0x19fe69:0x1;switch(_0x3181e6[_0x81c8('0x1e9')]){case'dropRate':var _0x1b1864=_0x3181e6[_0x81c8('0x1de')]/0x64;return _0x40c398[_0x81c8('0x1f6')](_0x1961a1,_0x44c76f,_0x137cf8,_0x19fe69,_0x1b1864)['then'](function(_0x1272bc){return _0x9c8ddb(_0x1272bc);});case _0x81c8('0x1f7'):var _0x486651=_0x3181e6[_0x81c8('0x1de')]/0x64;return _0x40c398[_0x81c8('0x1f8')](_0x1961a1,_0x44c76f,_0x137cf8,_0x19fe69,_0x486651)[_0x81c8('0x40')](function(_0x15ccfa){return _0x9c8ddb(_0x15ccfa);});default:return _0x2af8a4(msgResponse(_0x81c8('0x1f9'),_0x81c8('0x15c'),_0x81c8('0x1fa')));}}else{return _0x2af8a4(msgResponse(_0x81c8('0x1f9'),'Failure',_0x81c8('0x1fb')));}});};};Dialer[_0x81c8('0x1e')][_0x81c8('0x1fc')]=function(_0x513158){var _0x5f16e7=this;return function(_0x3e06c4){return new BPromise(function(_0x369b10,_0x26f6e8){_['merge'](_0x513158,_0x3e06c4[0x0]);if(checkGetDataPredictive(_0x3e06c4[0x0])){loggerPredictive[_0x81c8('0x86')](JSON[_0x81c8('0x142')](_0x3e06c4[0x0]));if(_0x513158[_0x81c8('0x1e9')]===_0x81c8('0x1ec')){return _0x5f16e7[_0x81c8('0xd6')](_0x513158['id'])[_0x81c8('0x40')](function(_0x56eba5){var _0x2554d0=_0x513158[_0x81c8('0x57')]-_0x56eba5[0x0]['outboundQueuePauses'];var _0x23118c=_0x513158[_0x81c8('0x1e7')]*0x3c;var _0x3e9c20=_0x3e06c4[0x0]['predictiveIntervalAvgTalktime']+_0x3e06c4[0x0][_0x81c8('0x70')];var _0x281b0d=(_0x3e06c4[0x0]['predictiveIntervalAnsweredCalls']+_0x3e06c4[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3e06c4[0x0][_0x81c8('0x72')])/_0x3e06c4[0x0][_0x81c8('0x7a')];var _0x291011=_0x513158[_0x81c8('0x1de')]/0x64;_0x513158[_0x81c8('0x78')]=_0x56eba5[0x0][_0x81c8('0x1fd')]||0x0;_0x513158[_0x81c8('0x76')]=_0x281b0d>0x0?_0x281b0d:0x1;return _0x5f16e7[_0x81c8('0x1f6')](_0x2554d0,_0x23118c,_0x3e9c20,_0x281b0d,_0x291011);})[_0x81c8('0x40')](function(_0x2e80a3){return _0x369b10(_0x2e80a3);})[_0x81c8('0xc7')](function(_0x68b83e){return _0x26f6e8(msgResponse('[CatchErlangB]',_0x81c8('0x15c'),JSON[_0x81c8('0x142')](_0x68b83e)));});}if(_0x513158[_0x81c8('0x1e9')]===_0x81c8('0x1f7')){return _0x5f16e7['getVoiceQueueRtPauses'](_0x513158['id'])['then'](function(_0x1afba6){var _0x46ff68=_0x513158['loggedIn']-_0x1afba6[0x0][_0x81c8('0x1fd')];var _0x3d547f=_0x513158[_0x81c8('0x1e7')]*0x3c;var _0x52b0f3=_0x3e06c4[0x0][_0x81c8('0x71')]+_0x3e06c4[0x0][_0x81c8('0x70')];var _0x2de21f=(_0x3e06c4[0x0][_0x81c8('0x6f')]+_0x3e06c4[0x0][_0x81c8('0x73')]+_0x3e06c4[0x0][_0x81c8('0x72')])/_0x3e06c4[0x0][_0x81c8('0x7a')];var _0x5c79a9=_0x513158['dialPredictiveOptimizationPercentage']/0x64;_0x513158[_0x81c8('0x78')]=_0x1afba6[0x0][_0x81c8('0x1fd')]||0x0;_0x513158[_0x81c8('0x76')]=_0x2de21f>0x0?_0x2de21f:0x1;return _0x5f16e7['busyFactor'](_0x46ff68,_0x3d547f,_0x52b0f3,_0x2de21f,_0x5c79a9);})[_0x81c8('0x40')](function(_0x42f441){return _0x369b10(_0x42f441);})[_0x81c8('0xc7')](function(_0x59fa7f){return _0x26f6e8(msgResponse(_0x81c8('0x1fe'),_0x81c8('0x15c'),JSON[_0x81c8('0x142')](_0x59fa7f)));});}}else{return _0x26f6e8(msgResponse(_0x81c8('0x1f9'),'Failure',_0x81c8('0x1fb')));}});};};Dialer[_0x81c8('0x1e')][_0x81c8('0x1f1')]=function(_0x3da1e1){var _0x14ef18=this;return function(){var _0x50b3f1=0x0;var _0x202a1a=Math[_0x81c8('0x1e2')](_0x3da1e1[_0x81c8('0x92')]*0x3e8);if(_0x202a1a>0x0){_0x202a1a=_0x202a1a<0x64?0x64:_0x202a1a;loggerPredictive[_0x81c8('0x86')](_0x3da1e1[_0x81c8('0x4a')],_0x81c8('0x1ff'),_0x202a1a,'milliseconds');_0x3da1e1[_0x81c8('0x99')]=setInterval(function(){_0x14ef18['handlePredictive'](_0x3da1e1);loggerPredictiveCalls[_0x81c8('0x86')](_0x81c8('0x200'),_0x50b3f1+=0x1);},_0x202a1a);}else{loggerPredictive[_0x81c8('0x86')](_0x3da1e1[_0x81c8('0x4a')],_0x81c8('0x201'));}};};Dialer[_0x81c8('0x1e')][_0x81c8('0x202')]=function(_0x2daea1,_0x19059c){var _0x41c2a8=this;return function(_0x56f9cf){if(_[_0x81c8('0x4d')](_0x56f9cf)){if(_[_0x81c8('0xb9')](_0x19059c[_0x81c8('0xe3')])||!_0x19059c[_0x81c8('0x203')]){if(_0x2daea1[_0x81c8('0x62')]===_0x81c8('0x8')){_0x2daea1['queueStatusComplete']=_['isUndefined'](_0x2daea1['queueStatusComplete'])?!![]:_0x2daea1['queueStatusComplete'];var _0x4ff074=uuid['v4']();_0x41c2a8[_0x81c8('0xb6')][_0x4ff074]=new Action(_0x2daea1,_0x19059c,_0x4ff074);loggerBooked[_0x81c8('0x86')](_0x81c8('0x204'),_0x4ff074,_0x81c8('0x205'),JSON['stringify'](_0x2daea1[_0x81c8('0x13f')]),_0x81c8('0x206'),_0x2daea1[_0x81c8('0x4a')]);if(_0x2daea1[_0x81c8('0x13f')]){_0x2daea1['queueStatusComplete']=![];_0x41c2a8[_0x81c8('0x2a')][_0x41c2a8[_0x81c8('0xb6')][_0x4ff074]['queue']]=[];ami['Action']({'actionid':_0x4ff074,'action':'queuestatus','queue':_0x2daea1[_0x81c8('0x4a')]})[_0x81c8('0xc7')](function(){_0x41c2a8[_0x81c8('0xbf')](_0x2daea1);_0x41c2a8[_0x81c8('0xce')]({'active':![],'ContactId':_0x41c2a8[_0x81c8('0xb6')][_0x4ff074][_0x81c8('0xe1')],'ListId':_0x41c2a8[_0x81c8('0xb6')][_0x4ff074][_0x81c8('0xe2')],'VoiceQueueId':_0x41c2a8[_0x81c8('0xb6')][_0x4ff074][_0x81c8('0xe4')]||undefined,'CampaignId':_0x41c2a8[_0x81c8('0xb6')][_0x4ff074][_0x81c8('0xe5')]||undefined})['catch'](loggerCatch(_0x81c8('0x207')));delete _0x41c2a8[_0x81c8('0xb6')][_0x4ff074];});}else{loggerBooked[_0x81c8('0x86')](_0x81c8('0x208'),JSON[_0x81c8('0x142')](_0x2daea1[_0x81c8('0x13f')]),_0x81c8('0x206'),_0x2daea1[_0x81c8('0x4a')]);_0x41c2a8[_0x81c8('0xbf')](_0x2daea1);_0x41c2a8[_0x81c8('0xce')]({'active':![],'ContactId':_0x41c2a8['actions'][_0x4ff074]['ContactId'],'ListId':_0x41c2a8[_0x81c8('0xb6')][_0x4ff074][_0x81c8('0xe2')],'VoiceQueueId':_0x41c2a8['actions'][_0x4ff074]['VoiceQueueId']||undefined,'CampaignId':_0x41c2a8['actions'][_0x4ff074][_0x81c8('0xe5')]||undefined})[_0x81c8('0xc7')](loggerCatch(_0x81c8('0x207')));delete _0x41c2a8['actions'][_0x4ff074];}}else{return _0x41c2a8[_0x81c8('0x183')](_0x2daea1,_0x19059c);}}else{if(getDiff(_0x19059c[_0x81c8('0x209')])<_0x2daea1[_0x81c8('0x20a')]*0x3c){if(_0x19059c[_0x81c8('0x175')]&&!_0x19059c['Agent'][_0x81c8('0x20b')]){_0x41c2a8[_0x81c8('0x144')][_0x81c8('0x14b')](_0x19059c['id'])['finally'](function(){_0x41c2a8['updateOriginated'](_0x2daea1);});}else{_0x41c2a8[_0x81c8('0xd0')]({'active':![]},_0x19059c['id'],0x1)['finally'](function(){_0x41c2a8['updateOriginated'](_0x2daea1);});}}else{_0x2daea1['outboundReCallsDay']+=0x1;_0x41c2a8[_0x81c8('0xbf')](_0x2daea1);if(_0x2daea1[_0x81c8('0x20c')]){_0x41c2a8['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x19059c[_0x81c8('0xe1')],'ListId':_0x19059c['ListId'],'VoiceQueueId':_0x19059c[_0x81c8('0xe4')]||undefined,'CampaignId':_0x19059c[_0x81c8('0xe5')]||undefined})['catch'](loggerCatch(_0x81c8('0x20d')));_0x41c2a8[_0x81c8('0xd9')](createObjHistory(_0x2daea1,_0x19059c,'RECALLINQUEUE',0x17,_0x81c8('0x20e')))[_0x81c8('0xc7')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x41c2a8[_0x81c8('0xdf')](createObjHistory(_0x2daea1,_0x19059c,_0x81c8('0x20f'),0x16,_0x81c8('0x210')),_0x81c8('0x211'),_0x81c8('0x212'));}}}}else{_0x2daea1[_0x81c8('0x66')]+=0x1;_0x41c2a8[_0x81c8('0xdf')](createObjHistory(_0x2daea1,_0x19059c,_0x81c8('0x213'),0xd,_0x81c8('0x214')),_0x81c8('0x215'),_0x81c8('0x216'));throw _0x81c8('0x217');}};};Dialer[_0x81c8('0x1e')]['handleIvr']=function(_0x2b443c){var _0x285047=this;var _0x59caaa=_0x2b443c['limitCalls']-_0x2b443c[_0x81c8('0xa0')]-_0x2b443c['temp'];emitCampaignSummary(_0x2b443c);if(_0x59caaa>0x0){if(_0x59caaa>this[_0x81c8('0x26')]){_0x59caaa=this[_0x81c8('0x26')];}_0x2b443c[_0x81c8('0xd3')]+=_0x59caaa;this[_0x81c8('0xd4')](_0x2b443c['id'],_0x59caaa,_0x2b443c[_0x81c8('0x218')],_0x2b443c)['then'](function(_0x34f115){_0x2b443c['temp']-=_0x59caaa;_0x2b443c[_0x81c8('0xd3')]=_0x2b443c[_0x81c8('0xd3')]>0x0?_0x2b443c[_0x81c8('0xd3')]:0x0;if(!checkContactEmpty(_0x34f115)){_0x2b443c['message']=_0x81c8('0xa8');logger[_0x81c8('0x86')]('[getContactCampaign2][Empty]'+_0x2b443c[_0x81c8('0x4a')]);}else{_0x2b443c['originated']+=_0x34f115[_0x81c8('0x9f')];_0x2b443c['message']='RUNNING';for(var _0x391a05=0x0;_0x391a05<_0x34f115['length'];_0x391a05+=0x1){_0x2b443c[_0x81c8('0x219')]+=0x1;if(_[_0x81c8('0xb9')](_0x34f115[_0x391a05])||_[_0x81c8('0xb9')](_0x34f115[_0x391a05]['Contact'])||_[_0x81c8('0xb9')](_0x34f115[_0x391a05][_0x81c8('0x185')])){_0x285047[_0x81c8('0xdd')](_0x81c8('0x21a'),_0x2b443c,_0x34f115[_0x391a05]);}else{_0x285047[_0x81c8('0xc9')](_[_0x81c8('0xe0')](_0x34f115[_0x391a05],[_0x81c8('0xe5'),_0x81c8('0x21b')]))['then'](_0x285047[_0x81c8('0x202')](_0x2b443c,_0x34f115[_0x391a05]))['catch'](_0x285047[_0x81c8('0xdc')]('[actionOriginateIvr]\x20',_0x2b443c));}}}})[_0x81c8('0xc7')](loggerGetContactDialer('[getContactCampaign2]',_0x2b443c,_0x59caaa));}};Dialer['prototype'][_0x81c8('0x16f')]=function(_0x5e2515,_0x28dbbc){var _0x448874=this;var _0x4fdd9c=[];var _0x15d9b7=_0x28dbbc>=0x1?_0x28dbbc:0x1;if(_0x5e2515[_0x81c8('0x62')]===_0x81c8('0x8')){_0x15d9b7=0x1;}var _0x23dd27=Math[_0x81c8('0x1e2')](_0x5e2515[_0x81c8('0x56')]*_0x15d9b7)-_0x5e2515[_0x81c8('0xa0')]-_0x5e2515[_0x81c8('0xd3')];emitVoiceQueueSummary(_0x5e2515);if(_0x5e2515[_0x81c8('0x21c')]>0x0){var _0x5ab998=_0x5e2515[_0x81c8('0x21c')]-_0x5e2515[_0x81c8('0xa0')]-_0x5e2515[_0x81c8('0x5a')]-_0x5e2515[_0x81c8('0xd3')]-_0x5e2515[_0x81c8('0x58')];if(_0x23dd27>_0x5ab998){_0x23dd27=_0x5ab998;}}if(_0x23dd27>0x0){if(_0x5e2515[_0x81c8('0x62')]===_0x81c8('0x8')){_0x23dd27=0x1;}if(_0x23dd27>this['maxNumberOriginate']){_0x23dd27=this[_0x81c8('0x26')];}_0x5e2515['temp']+=_0x23dd27;for(var _0x4125e8 in this[_0x81c8('0x24')]){if(typeof this[_0x81c8('0x24')][_0x4125e8]!=='undefined'){if(this[_0x81c8('0x24')][_0x4125e8][_0x81c8('0xb0')]===_0x81c8('0x21d')&&this[_0x81c8('0x24')][_0x4125e8][_0x81c8('0xbb')]==='reachable'){_0x4fdd9c['push'](this[_0x81c8('0x24')][_0x4125e8]['id']);}}}this[_0x81c8('0xd2')](_0x5e2515['id'],_0x4fdd9c,_0x23dd27,_0x5e2515[_0x81c8('0x218')],_0x5e2515)['then'](function(_0x5565d4){_0x5e2515['temp']-=_0x23dd27;_0x5e2515[_0x81c8('0xd3')]=_0x5e2515[_0x81c8('0xd3')]>0x0?_0x5e2515[_0x81c8('0xd3')]:0x0;if(!checkContactEmpty(_0x5565d4)){_0x448874[_0x81c8('0xc0')](_0x5e2515)[_0x81c8('0x40')](sendMessageReschedule(_0x5e2515))[_0x81c8('0xc7')](loggerCatch('[countReScheduled]\x20'));}else{_0x5e2515[_0x81c8('0xa0')]+=_0x5565d4[_0x81c8('0x9f')];_0x5e2515[_0x81c8('0x43')]=_0x5e2515['dialMethod']==='booked'?_0x81c8('0x18d'):_0x81c8('0x21e');for(var _0x4c15c9=0x0;_0x4c15c9<_0x5565d4[_0x81c8('0x9f')];_0x4c15c9+=0x1){if(_[_0x81c8('0xb9')](_0x5565d4[_0x4c15c9])||_[_0x81c8('0xb9')](_0x5565d4[_0x4c15c9][_0x81c8('0x19c')])||_['isNil'](_0x5565d4[_0x4c15c9]['phone'])){_0x448874[_0x81c8('0xdd')](_0x81c8('0x21a'),_0x5e2515,_0x5565d4[_0x4c15c9]);}else{_0x448874[_0x81c8('0xc2')](_[_0x81c8('0xe0')](_0x5565d4[_0x4c15c9],['VoiceQueueId',_0x81c8('0x21b')]))[_0x81c8('0x40')](_0x448874[_0x81c8('0x202')](_0x5e2515,_0x5565d4[_0x4c15c9]))[_0x81c8('0xc7')](_0x448874['loggerHandler'](_0x81c8('0x21a'),_0x5e2515));}}}})[_0x81c8('0xc7')](loggerGetContactDialer(_0x81c8('0x21f'),_0x5e2515,_0x23dd27));}};Dialer[_0x81c8('0x1e')][_0x81c8('0x99')]=function(_0x17900d){if(_0x17900d[_0x81c8('0x21c')]>0x0){var _0x38988d=_0x17900d[_0x81c8('0x21c')]-_0x17900d['originated']-_0x17900d[_0x81c8('0x5a')];if(_0x38988d>0x0){this[_0x81c8('0x220')](_0x17900d);}else{loggerPredictiveCalls[_0x81c8('0x86')](_0x81c8('0x221'));}}else{this[_0x81c8('0x220')](_0x17900d);}};Dialer['prototype'][_0x81c8('0x220')]=function(_0x2065ca){var _0x161469=this;var _0x2e5609=[];_0x2065ca['originated']+=0x1;for(var _0x4be282 in this['agents']){if(typeof this[_0x81c8('0x24')][_0x4be282]!==_0x81c8('0xa1')){if(this[_0x81c8('0x24')][_0x4be282]['state']==='not_inuse'&&this['agents'][_0x4be282][_0x81c8('0xbb')]==='reachable'){_0x2e5609[_0x81c8('0x13e')](this[_0x81c8('0x24')][_0x4be282]['id']);}}}this[_0x81c8('0xd2')](_0x2065ca['id'],_0x2e5609,0x1,_0x2065ca[_0x81c8('0x218')],_0x2065ca)[_0x81c8('0x40')](function(_0x2567c3){if(!checkContactEmpty(_0x2567c3)){checkContactLowerLimitOriginate(_0x2065ca,0x1,0x0);_0x161469['countReScheduled'](_0x2065ca)[_0x81c8('0x40')](sendMessageReschedule(_0x2065ca))[_0x81c8('0xc7')](loggerCatch(_0x81c8('0xc1')));}else{_0x2065ca[_0x81c8('0x43')]=_0x81c8('0x21e');if(_['isNil'](_0x2567c3[0x0])||_['isNil'](_0x2567c3[0x0][_0x81c8('0x19c')])||_[_0x81c8('0xb9')](_0x2567c3[0x0][_0x81c8('0x185')])){_0x161469[_0x81c8('0xdd')](_0x81c8('0x21a'),_0x2065ca,_0x2567c3[0x0]);}else{_0x161469[_0x81c8('0xc2')](_[_0x81c8('0xe0')](_0x2567c3[0x0],[_0x81c8('0xe4'),_0x81c8('0x21b')]))[_0x81c8('0x40')](_0x161469['checkContactBlack'](_0x2065ca,_0x2567c3[0x0]))['catch'](_0x161469[_0x81c8('0xdc')]('[actionOriginatePredictive]\x20',_0x2065ca));}}})[_0x81c8('0xc7')](loggerGetContactDialer(_0x81c8('0x222'),_0x2065ca,0x1));emitVoiceQueueSummary(_0x2065ca);};Dialer['prototype'][_0x81c8('0x1f6')]=function(_0x7a9ec5,_0x1d2050,_0x726639,_0x1c66ce,_0x1cc62a,_0xbefe4d){loggerPredictive[_0x81c8('0x86')](_0x81c8('0x223'));loggerPredictive[_0x81c8('0x86')](_0x81c8('0x224'),_0x7a9ec5);loggerPredictive['info'](_0x81c8('0x225'),_0x1d2050);loggerPredictive[_0x81c8('0x86')]('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',_0x726639);loggerPredictive[_0x81c8('0x86')](_0x81c8('0x226'),_0x1c66ce);loggerPredictive[_0x81c8('0x86')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1cc62a);loggerPredictive[_0x81c8('0x86')](_0x81c8('0x8d'));return new BPromise(function(_0x20ebf6,_0xd017d9){if(_0x7a9ec5<=0x0||isNaN(_0x7a9ec5)){return _0xd017d9(msgResponse(_0x81c8('0x227'),_0x81c8('0x4f'),_0x81c8('0x228')+_0x7a9ec5));}if(_0x726639<=0x0||isNaN(_0x726639)){return _0xd017d9(msgResponse(_0x81c8('0x227'),_0x81c8('0x4f'),_0x81c8('0x229')+_0x726639));}if(_0x1c66ce<=0x0||isNaN(_0x1c66ce)){return _0xd017d9(msgResponse(_0x81c8('0x227'),_0x81c8('0x4f'),_0x81c8('0x22a')+_0x1c66ce));}if(_0x1d2050<=0x0||isNaN(_0x1d2050)){return _0xd017d9(msgResponse('[abandonmentRate]',_0x81c8('0x4f'),_0x81c8('0x22b')+_0x1d2050));}if(_0x1cc62a<=0x0||isNaN(_0x1cc62a)){return _0xd017d9(msgResponse(_0x81c8('0x227'),_0x81c8('0x4f'),'Amax\x20=\x20'+_0x1cc62a));}_0xbefe4d=_0xbefe4d||0x0;var _0x7b9d05=0x1/_0x726639;var _0x1ba37d=0x0;var _0x367e7b=0x0;var _0x5ae743=0x0;var _0x5d67b3=0x0;for(var _0x41eb27=0x0;_0x5ae743<_0x1cc62a;_0x41eb27+=0x1){_0x367e7b=_0x41eb27/_0x1d2050;_0x1ba37d=(_0x1c66ce*_0x367e7b+_0xbefe4d)/_0x7b9d05;_0x5ae743=erlangb(_0x1ba37d,_0x7a9ec5);_0x5d67b3=_0x1ba37d/_0x7a9ec5*(0x1-erlangb(_0x1ba37d,_0x7a9ec5));}return _0x20ebf6({'erlangCalls':_0x41eb27,'erlangCallToSecond':_0x1d2050/_0x41eb27,'erlangAbandonmentRate':_0x5ae743,'erlangBusyFactor':_0x5d67b3});});};Dialer[_0x81c8('0x1e')][_0x81c8('0x1f8')]=function(_0x4ffff2,_0x4e710d,_0x35c95f,_0x54fc3c,_0x204209,_0x381b47){loggerPredictive[_0x81c8('0x86')](_0x81c8('0x22c'));loggerPredictive[_0x81c8('0x86')]('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',_0x4ffff2);loggerPredictive[_0x81c8('0x86')](_0x81c8('0x225'),_0x4e710d);loggerPredictive[_0x81c8('0x86')](_0x81c8('0x22d'),_0x35c95f);loggerPredictive[_0x81c8('0x86')](_0x81c8('0x226'),_0x54fc3c);loggerPredictive[_0x81c8('0x86')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x204209);loggerPredictive['info'](_0x81c8('0x8d'));return new BPromise(function(_0x38ef6e,_0x188eff){if(_0x4ffff2<=0x0||isNaN(_0x4ffff2)){return _0x188eff(msgResponse(_0x81c8('0x22e'),_0x81c8('0x4f'),'m\x20=\x20'+_0x4ffff2));}if(_0x35c95f<=0x0||isNaN(_0x35c95f)){return _0x188eff(msgResponse(_0x81c8('0x22e'),_0x81c8('0x4f'),'Ts\x20=\x20'+_0x35c95f));}if(_0x54fc3c<=0x0||isNaN(_0x54fc3c)){return _0x188eff(msgResponse(_0x81c8('0x22e'),'Error',_0x81c8('0x22a')+_0x54fc3c));}if(_0x4e710d<=0x0||isNaN(_0x4e710d)){return _0x188eff(msgResponse(_0x81c8('0x22e'),'Error',_0x81c8('0x22b')+_0x4e710d));}if(_0x204209<=0x0||isNaN(_0x204209)){return _0x188eff(msgResponse(_0x81c8('0x22e'),_0x81c8('0x4f'),_0x81c8('0x22f')+_0x204209));}_0x381b47=_0x381b47||0x0;var _0xdebda6=0x1/_0x35c95f;var _0x379a78=0x0;var _0x384c40=0x0;var _0xbf7fb4=0x0;var _0x53e828=0x0;for(var _0x4ad924=0x0;_0x53e828<_0x204209;_0x4ad924+=0x1){_0x384c40=_0x4ad924/_0x4e710d;_0x379a78=(_0x54fc3c*_0x384c40+_0x381b47)/_0xdebda6;_0xbf7fb4=erlangb(_0x379a78,_0x4ffff2);_0x53e828=_0x379a78/_0x4ffff2*(0x1-erlangb(_0x379a78,_0x4ffff2));}return _0x38ef6e({'erlangCalls':_0x4ad924,'erlangCallToSecond':_0x4e710d/_0x4ad924,'erlangAbandonmentRate':_0xbf7fb4,'erlangBusyFactor':_0x53e828});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index e1fa3da..f3cce75 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc474=['starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum'];(function(_0x19befc,_0xb3fe7e){var _0x3760c7=function(_0x15f10a){while(--_0x15f10a){_0x19befc['push'](_0x19befc['shift']());}};_0x3760c7(++_0xb3fe7e);}(_0xc474,0x92));var _0x4c47=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xc474[_0x9cd4c3];return _0x4c9025;};'use strict';var util=require('util');var _=require(_0x4c47('0x0'));var moment=require(_0x4c47('0x1'));function getSeconds(_0x1f0115,_0x158f09){var _0x4dc2fd=moment(_0x1f0115)[_0x4c47('0x2')](0x0);var _0x54b1a5=moment(_0x158f09)[_0x4c47('0x2')](0x0);return _0x4dc2fd[_0x4c47('0x3')](_0x54b1a5,'seconds');}function QueueCallerAbandon(_0x50d85d,_0x496cbc){this[_0x4c47('0x4')]=_0x50d85d[_0x4c47('0x4')];this[_0x4c47('0x5')]=_0x50d85d[_0x4c47('0x5')];this[_0x4c47('0x6')]=_0x50d85d[_0x4c47('0x5')]===_0x4c47('0x7')?_0x4c47('0x8'):_0x50d85d[_0x4c47('0x5')];this[_0x4c47('0x9')]=_0x50d85d[_0x4c47('0x9')];this[_0x4c47('0xa')]=_0x50d85d['countcongestionretry'];this[_0x4c47('0xb')]=_0x50d85d[_0x4c47('0xb')];this[_0x4c47('0xc')]=_0x50d85d[_0x4c47('0x9')]+_0x50d85d[_0x4c47('0xa')]+_0x50d85d[_0x4c47('0xb')]+_0x50d85d[_0x4c47('0xd')]+_0x50d85d[_0x4c47('0xe')]+_0x50d85d[_0x4c47('0xf')]+_0x50d85d[_0x4c47('0x10')]+_0x50d85d[_0x4c47('0x11')];this['countnosuchnumberretry']=_0x50d85d[_0x4c47('0xd')];this[_0x4c47('0xe')]=_0x50d85d[_0x4c47('0xe')];this[_0x4c47('0xf')]=_0x50d85d['countabandonedretry'];this[_0x4c47('0x10')]=_0x50d85d[_0x4c47('0x10')];this[_0x4c47('0x11')]=_0x50d85d[_0x4c47('0x11')];this[_0x4c47('0x12')]=_0x496cbc[_0x4c47('0x12')];this[_0x4c47('0x13')]=_0x50d85d[_0x4c47('0x14')];this[_0x4c47('0x15')]=_0x50d85d['number'];this[_0x4c47('0x16')]=_0x50d85d['starttime'];this[_0x4c47('0x17')]=_0x50d85d['responsetime'];this[_0x4c47('0x18')]=_0x50d85d[_0x4c47('0x18')];this[_0x4c47('0x19')]=this[_0x4c47('0x18')];this[_0x4c47('0x1a')]=getSeconds(_0x50d85d[_0x4c47('0x17')],_0x50d85d[_0x4c47('0x16')]);this[_0x4c47('0x1b')]=getSeconds(this[_0x4c47('0x18')],_0x50d85d[_0x4c47('0x17')]);this[_0x4c47('0x1c')]=0x0;this[_0x4c47('0x8')]=_0x496cbc[_0x4c47('0x8')];this['membername']=_0x496cbc[_0x4c47('0x1d')];this[_0x4c47('0x1e')]=_0x496cbc[_0x4c47('0x1e')];this[_0x4c47('0x1f')]=_0x50d85d[_0x4c47('0x1f')];this['callbackuniqueid']=_0x50d85d[_0x4c47('0x20')];this[_0x4c47('0x21')]=_0x50d85d['callbackat'];this[_0x4c47('0x22')]=_0x50d85d[_0x4c47('0x22')];this[_0x4c47('0x23')]=_0x50d85d[_0x4c47('0x23')];this['ListId']=_0x50d85d[_0x4c47('0x24')];this['UserId']=_0x50d85d[_0x4c47('0x25')];this[_0x4c47('0x26')]=_0x50d85d[_0x4c47('0x26')];this[_0x4c47('0x27')]=_0x50d85d['CampaignId'];this[_0x4c47('0x28')]=_0x50d85d[_0x4c47('0x28')]||'';this[_0x4c47('0x29')]=_0x50d85d[_0x4c47('0x29')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x3e6d=['moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','ringtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash'];(function(_0x1ba912,_0x447a8f){var _0x3fa2d4=function(_0x506d7a){while(--_0x506d7a){_0x1ba912['push'](_0x1ba912['shift']());}};_0x3fa2d4(++_0x447a8f);}(_0x3e6d,0xdf));var _0xd3e6=function(_0xfbcb18,_0x17af19){_0xfbcb18=_0xfbcb18-0x0;var _0x238f87=_0x3e6d[_0xfbcb18];return _0x238f87;};'use strict';var util=require(_0xd3e6('0x0'));var _=require(_0xd3e6('0x1'));var moment=require(_0xd3e6('0x2'));function getSeconds(_0x15b267,_0x3253e8){var _0x5369da=moment(_0x15b267)[_0xd3e6('0x3')](0x0);var _0x5563c0=moment(_0x3253e8)['milliseconds'](0x0);return _0x5369da[_0xd3e6('0x4')](_0x5563c0,_0xd3e6('0x5'));}function QueueCallerAbandon(_0x467eb5,_0x3e1b2e){this[_0xd3e6('0x6')]=_0x467eb5[_0xd3e6('0x6')];this[_0xd3e6('0x7')]=_0x467eb5[_0xd3e6('0x7')];this[_0xd3e6('0x8')]=_0x467eb5[_0xd3e6('0x7')]===_0xd3e6('0x9')?'queue':_0x467eb5[_0xd3e6('0x7')];this[_0xd3e6('0xa')]=_0x467eb5[_0xd3e6('0xa')];this[_0xd3e6('0xb')]=_0x467eb5[_0xd3e6('0xb')];this[_0xd3e6('0xc')]=_0x467eb5['countnoanswerretry'];this[_0xd3e6('0xd')]=_0x467eb5[_0xd3e6('0xa')]+_0x467eb5[_0xd3e6('0xb')]+_0x467eb5[_0xd3e6('0xc')]+_0x467eb5[_0xd3e6('0xe')]+_0x467eb5['countdropretry']+_0x467eb5['countabandonedretry']+_0x467eb5['countmachineretry']+_0x467eb5[_0xd3e6('0xf')];this[_0xd3e6('0xe')]=_0x467eb5[_0xd3e6('0xe')];this[_0xd3e6('0x10')]=_0x467eb5[_0xd3e6('0x10')];this['countabandonedretry']=_0x467eb5[_0xd3e6('0x11')];this[_0xd3e6('0x12')]=_0x467eb5[_0xd3e6('0x12')];this[_0xd3e6('0xf')]=_0x467eb5['countagentrejectretry'];this['uniqueid']=_0x3e1b2e[_0xd3e6('0x13')];this[_0xd3e6('0x14')]=_0x467eb5[_0xd3e6('0x15')];this[_0xd3e6('0x16')]=_0x467eb5[_0xd3e6('0x17')];this[_0xd3e6('0x18')]=_0x467eb5[_0xd3e6('0x18')];this[_0xd3e6('0x19')]=_0x467eb5[_0xd3e6('0x19')];this[_0xd3e6('0x1a')]=_0x467eb5[_0xd3e6('0x1a')];this['endtime']=this[_0xd3e6('0x1a')];this[_0xd3e6('0x1b')]=getSeconds(_0x467eb5[_0xd3e6('0x19')],_0x467eb5['starttime']);this['holdtime']=getSeconds(this[_0xd3e6('0x1a')],_0x467eb5[_0xd3e6('0x19')]);this[_0xd3e6('0x1c')]=0x0;this[_0xd3e6('0x1d')]=_0x3e1b2e[_0xd3e6('0x1d')];this[_0xd3e6('0x1e')]=_0x3e1b2e[_0xd3e6('0x1f')];this[_0xd3e6('0x20')]=_0x3e1b2e[_0xd3e6('0x20')];this[_0xd3e6('0x21')]=_0x467eb5[_0xd3e6('0x21')];this[_0xd3e6('0x22')]=_0x467eb5[_0xd3e6('0x22')];this['callbackat']=_0x467eb5[_0xd3e6('0x23')];this[_0xd3e6('0x24')]=_0x467eb5[_0xd3e6('0x24')];this[_0xd3e6('0x25')]=_0x467eb5[_0xd3e6('0x25')];this['ListId']=_0x467eb5[_0xd3e6('0x26')];this[_0xd3e6('0x27')]=_0x467eb5[_0xd3e6('0x27')];this['VoiceQueueId']=_0x467eb5[_0xd3e6('0x28')];this['CampaignId']=_0x467eb5[_0xd3e6('0x29')];this[_0xd3e6('0x2a')]=_0x467eb5['originatecalleridnum']||'';this[_0xd3e6('0x2b')]=_0x467eb5[_0xd3e6('0x2b')]||'';}module[_0xd3e6('0x2c')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 5d7741b..ada17df 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(_0x2ac3cf,_0x465bb6){var _0x27dcca=function(_0x33f954){while(--_0x33f954){_0x2ac3cf['push'](_0x2ac3cf['shift']());}};_0x27dcca(++_0x465bb6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x5d6a1d,_0x3104e1){var _0x55eafd=function(_0x5c8668){while(--_0x5c8668){_0x5d6a1d['push'](_0x5d6a1d['shift']());}};_0x55eafd(++_0x3104e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index b4b8ba2..3d528b0 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 _0x5ec6=['checkTrunk','isTrunkReachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','moment','tiff2pdf','../../../config/logger','../ami','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','newchannel','syncNewchannel','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','bind','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','value','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','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','path','%s/%s.tif','XMF-PATH','Action','variablesAction','addVariables','isNil','active','SIP/%s','reachable','unmonitored'];(function(_0x574978,_0xa28350){var _0x382a94=function(_0x1482f1){while(--_0x1482f1){_0x574978['push'](_0x574978['shift']());}};_0x382a94(++_0xa28350);}(_0x5ec6,0x7f));var _0x65ec=function(_0x2dc9fc,_0x2fe8fc){_0x2dc9fc=_0x2dc9fc-0x0;var _0x4c19aa=_0x5ec6[_0x2dc9fc];return _0x4c19aa;};'use strict';var util=require(_0x65ec('0x0'));var _=require(_0x65ec('0x1'));var BPromise=require(_0x65ec('0x2'));var uuid=require('uuid');var moment=require(_0x65ec('0x3'));var path=require('path');var tiff2pdf=require(_0x65ec('0x4'));var gs=require('./util/gs');var logger=require(_0x65ec('0x5'))('fax');var ami=require(_0x65ec('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0x65ec('0x7'));var ut=require(_0x65ec('0x8'));var Action=require('./action');var faxAccount=require(_0x65ec('0x9'));var attachment=require(_0x65ec('0xa'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x28aa8f){this[_0x65ec('0xb')]={};this[_0x65ec('0xc')]=_0x28aa8f['faxAccounts'];this['trunks']=_0x28aa8f[_0x65ec('0xd')];this['actions']={};ami['on'](_0x65ec('0xe'),this[_0x65ec('0xf')]['bind'](this));ami['on'](_0x65ec('0x10'),this[_0x65ec('0x11')]['bind'](this));ami['on'](_0x65ec('0x12'),this[_0x65ec('0x13')]['bind'](this));ami['on'](_0x65ec('0x14'),this[_0x65ec('0x15')][_0x65ec('0x16')](this));ami['on'](_0x65ec('0x17'),this[_0x65ec('0x18')][_0x65ec('0x16')](this));ami['on'](_0x65ec('0x19'),this[_0x65ec('0x1a')]['bind'](this));ami['on'](_0x65ec('0x1b'),this[_0x65ec('0x1c')][_0x65ec('0x16')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x65ec('0x16')](this));}Fax[_0x65ec('0x1d')][_0x65ec('0xf')]=function(_0x4f2c63){if(_0x4f2c63[_0x65ec('0x1e')]===_0x65ec('0x1f')){for(var _0x1254f8 in this[_0x65ec('0xc')]){if(this[_0x65ec('0xc')][_0x65ec('0x20')](_0x1254f8)){if(_0x4f2c63[_0x65ec('0x21')]===this[_0x65ec('0xc')][_0x1254f8][_0x65ec('0x22')]){this[_0x65ec('0xb')][_0x4f2c63[_0x65ec('0x23')]]={};this[_0x65ec('0xb')][_0x4f2c63[_0x65ec('0x23')]][_0x65ec('0x24')]=_0x4f2c63[_0x65ec('0x24')];this[_0x65ec('0xb')][_0x4f2c63[_0x65ec('0x23')]]['id']=this[_0x65ec('0xc')][_0x1254f8]['id'];this[_0x65ec('0xb')][_0x4f2c63['uniqueid']][_0x65ec('0x25')]=this[_0x65ec('0xc')][_0x1254f8][_0x65ec('0x25')];logger[_0x65ec('0x26')](_0x4f2c63[_0x65ec('0x23')],_0x65ec('0x27'));}}}}if(this[_0x65ec('0x28')][_0x4f2c63['uniqueid']]){this[_0x65ec('0xb')][_0x4f2c63[_0x65ec('0x23')]]={};this[_0x65ec('0xb')][_0x4f2c63[_0x65ec('0x23')]][_0x65ec('0x24')]=_0x4f2c63[_0x65ec('0x24')];logger[_0x65ec('0x26')](_0x4f2c63[_0x65ec('0x23')],_0x65ec('0x27'));}};Fax['prototype'][_0x65ec('0x11')]=function(_0x30f0cf){if(this[_0x65ec('0xb')][_0x30f0cf[_0x65ec('0x23')]]){for(var _0x4de451 in _0x30f0cf[_0x65ec('0x29')]){if(_0x30f0cf['variable'][_0x65ec('0x20')](_0x4de451)){this[_0x65ec('0xb')][_0x30f0cf[_0x65ec('0x23')]][_0x4de451]=_0x30f0cf[_0x65ec('0x2a')];}}}};Fax[_0x65ec('0x1d')][_0x65ec('0x13')]=function(_0x46bf66){if(this[_0x65ec('0xb')][_0x46bf66[_0x65ec('0x23')]]){this[_0x65ec('0xb')][_0x46bf66[_0x65ec('0x23')]]['channelstate']=_0x46bf66['channelstate'];this[_0x65ec('0xb')][_0x46bf66['uniqueid']][_0x65ec('0x2b')]=_0x46bf66[_0x65ec('0x2b')];}};Fax['prototype'][_0x65ec('0x15')]=function(_0x42fa88){if(this[_0x65ec('0xb')][_0x42fa88[_0x65ec('0x23')]]){for(var _0x491dc6 in _0x42fa88[_0x65ec('0x29')]){if(_0x42fa88[_0x65ec('0x29')][_0x65ec('0x20')](_0x491dc6)){this[_0x65ec('0xb')][_0x42fa88[_0x65ec('0x23')]][_0x491dc6]=_0x42fa88[_0x65ec('0x2a')];}}}};Fax[_0x65ec('0x1d')][_0x65ec('0x18')]=function(_0x3c6cae){if(this[_0x65ec('0xb')][_0x3c6cae['uniqueid']]){this[_0x65ec('0xb')][_0x3c6cae[_0x65ec('0x23')]]['operation']=_0x3c6cae[_0x65ec('0x2c')];this[_0x65ec('0xb')][_0x3c6cae[_0x65ec('0x23')]][_0x65ec('0x2d')]=_0x3c6cae[_0x65ec('0x2d')];this[_0x65ec('0xb')][_0x3c6cae[_0x65ec('0x23')]]['localstationid']=_0x3c6cae[_0x65ec('0x22')];this[_0x65ec('0xb')][_0x3c6cae[_0x65ec('0x23')]][_0x65ec('0x2e')]=_0x3c6cae['filename'];logger[_0x65ec('0x26')](_0x3c6cae[_0x65ec('0x23')],_0x65ec('0x2f'));}};Fax[_0x65ec('0x1d')]['syncReceiveFax']=function(_0x59a1c2){var _0x279ca1=this;if(this['channels'][_0x59a1c2[_0x65ec('0x23')]]){var _0x167564=this['channels'][_0x59a1c2[_0x65ec('0x23')]]['id'];this[_0x65ec('0xb')][_0x59a1c2[_0x65ec('0x23')]][_0x65ec('0x30')]=_0x59a1c2[_0x65ec('0x30')];this[_0x65ec('0xb')][_0x59a1c2[_0x65ec('0x23')]][_0x65ec('0x31')]=_0x59a1c2[_0x65ec('0x31')];this[_0x65ec('0xb')][_0x59a1c2[_0x65ec('0x23')]]['localstationid']=_0x59a1c2[_0x65ec('0x22')];this['channels'][_0x59a1c2[_0x65ec('0x23')]][_0x65ec('0x32')]=_0x59a1c2[_0x65ec('0x32')];this[_0x65ec('0xb')][_0x59a1c2[_0x65ec('0x23')]][_0x65ec('0x33')]=_0x59a1c2['transferrate'];this[_0x65ec('0xb')][_0x59a1c2['uniqueid']]['filename']=_0x59a1c2[_0x65ec('0x2e')];this[_0x65ec('0xb')][_0x59a1c2[_0x65ec('0x23')]][_0x65ec('0x34')]=_0x59a1c2[_0x65ec('0x34')];if(this['channels'][_0x59a1c2['uniqueid']][_0x65ec('0x31')]>0x0){tiff2pdf(_0x59a1c2[_0x65ec('0x2e')],_0x65ec('0x35'),function(_0x149237){logger[_0x65ec('0x26')](_0x59a1c2['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x149237[_0x65ec('0x36')]);attachment[_0x65ec('0x37')]({'name':path[_0x65ec('0x38')](_0x59a1c2[_0x65ec('0x2e')])[_0x65ec('0x25')],'basename':path[_0x65ec('0x38')](_0x59a1c2[_0x65ec('0x2e')])['name']+_0x65ec('0x39'),'type':_0x65ec('0x3a')})[_0x65ec('0x3b')](function(_0x4fcfd4){faxAccount[_0x65ec('0x3c')](_0x167564,{'from':_0x59a1c2[_0x65ec('0x34')],'mapKey':'fax','body':path[_0x65ec('0x38')](_0x59a1c2[_0x65ec('0x2e')])[_0x65ec('0x25')]+_0x65ec('0x39'),'AttachmentId':_0x4fcfd4['id']})[_0x65ec('0x3d')](function(_0x4c3698){logger[_0x65ec('0x3e')](_0x59a1c2[_0x65ec('0x23')],_0x65ec('0x3f'),JSON[_0x65ec('0x40')](_0x4c3698));});})['catch'](function(_0x1fdfea){logger['error'](_0x59a1c2[_0x65ec('0x23')],_0x65ec('0x41'),JSON[_0x65ec('0x40')](_0x1fdfea));});});}logger['info'](_0x59a1c2['uniqueid'],_0x65ec('0x41'));}};Fax[_0x65ec('0x1d')][_0x65ec('0x42')]=function(_0x2111af){if(this[_0x65ec('0x28')][_0x2111af[_0x65ec('0x23')]]){_[_0x65ec('0x43')](this[_0x65ec('0xb')][_0x2111af[_0x65ec('0x23')]],_[_0x65ec('0x44')](_0x2111af,[_0x65ec('0x45'),_0x65ec('0x46')]));}};function updateStatus(_0x2150bc){if(_0x2150bc[_0x65ec('0x47')]){faxMessage[_0x65ec('0x48')](_0x2150bc[_0x65ec('0x47')],{'failMessage':_0x65ec('0x49')})['then'](function(_0x4debd6){ut[_0x65ec('0x4a')]('[Fax][Message][Error][Updated]',_0x4debd6);})[_0x65ec('0x3d')](function(_0x7add40){ut[_0x65ec('0x4a')]('[Fax][Message][Error][NoUpdate1]',_0x7add40);});}else{ut[_0x65ec('0x4a')](_0x65ec('0x4b'));}}Fax[_0x65ec('0x1d')]['updateStatus']=function(_0xabb4e3,_0x5e5e48,_0x4c9905){var _0x2b2af6=this;var _0x8d0bae={};if(_0x5e5e48){_0x8d0bae={'read':_0x5e5e48};}else{_0x8d0bae={'failMessage':_0x4c9905};}if(this[_0x65ec('0x28')][_0xabb4e3]['AttachmentId']){faxMessage[_0x65ec('0x48')](this[_0x65ec('0x28')][_0xabb4e3][_0x65ec('0x47')],_0x8d0bae)[_0x65ec('0x3b')](function(_0x44c878){ut[_0x65ec('0x4a')](_0x65ec('0x4c'),_0x44c878);})[_0x65ec('0x3d')](function(_0x462ed5){ut['logger']('[Fax][Message][NoUpdate1]',_0x462ed5);})[_0x65ec('0x4d')](function(){delete _0x2b2af6['channels'][_0xabb4e3];delete _0x2b2af6[_0x65ec('0x28')][_0xabb4e3];});}else{ut['logger'](_0x65ec('0x4e'));delete this[_0x65ec('0xb')][_0xabb4e3];delete this[_0x65ec('0x28')][_0xabb4e3];}};Fax[_0x65ec('0x1d')][_0x65ec('0x1c')]=function(_0x40d6b5){var _0x355c4c=this;if(this['channels'][_0x40d6b5[_0x65ec('0x23')]]){if(this[_0x65ec('0x28')][_0x40d6b5[_0x65ec('0x23')]]){this[_0x65ec('0xb')][_0x40d6b5[_0x65ec('0x23')]]['id']=this['actions'][_0x40d6b5[_0x65ec('0x23')]]['id'];this[_0x65ec('0xb')][_0x40d6b5[_0x65ec('0x23')]][_0x65ec('0x25')]=this[_0x65ec('0x28')][_0x40d6b5[_0x65ec('0x23')]][_0x65ec('0x25')];}logger[_0x65ec('0x26')](_0x40d6b5['uniqueid'],this[_0x65ec('0x28')][_0x40d6b5[_0x65ec('0x23')]]?_0x65ec('0x4f'):_0x65ec('0x50'),JSON[_0x65ec('0x40')](this[_0x65ec('0xb')][_0x40d6b5[_0x65ec('0x23')]]));if(this['actions'][_0x40d6b5['uniqueid']]){if(this[_0x65ec('0xb')][_0x40d6b5['uniqueid']][_0x65ec('0x51')]>0x0&&this[_0x65ec('0xb')][_0x40d6b5['uniqueid']][_0x65ec('0x17')]===_0x65ec('0x52')){this[_0x65ec('0x53')](_0x40d6b5[_0x65ec('0x23')],!![]);}else{this[_0x65ec('0x53')](_0x40d6b5[_0x65ec('0x23')],![],this[_0x65ec('0xb')][_0x40d6b5['uniqueid']]['faxstatusstring']?_0x65ec('0x54')+this[_0x65ec('0xb')][_0x40d6b5[_0x65ec('0x23')]]['faxstatusstring']:_0x65ec('0x55'));}}}};Fax[_0x65ec('0x1d')][_0x65ec('0x56')]=function(_0x3d761f){var _0x21096d=this;return new BPromise(function(_0x18a950,_0x334edc){_0x21096d['execOriginate'](_0x3d761f,_0x21096d[_0x65ec('0xc')][_0x3d761f[_0x65ec('0x57')]])[_0x65ec('0x3b')](function(_0xdfc384){ut[_0x65ec('0x4a')](_0x65ec('0x58'),_0xdfc384);_0x18a950(ut[_0x65ec('0x36')](_0x65ec('0x59')));})[_0x65ec('0x3d')](function(_0x584811){ut['logger'](_0x65ec('0x5a'),_0x584811);updateStatus(_0x3d761f);_0x334edc(ut['message']('Fax\x20failed'));});});};Fax[_0x65ec('0x1d')][_0x65ec('0x5b')]=function(_0x39d0ce){var _0x547057=this;return new BPromise(function(_0x501775,_0x29b958){var _0x5f0daa=_0x547057['checkTrunk'](_0x547057['faxAccounts'][_0x39d0ce[_0x65ec('0x57')]]['Trunk'],_0x39d0ce);if(_0x5f0daa[_0x65ec('0x5c')]){_0x501775(ut[_0x65ec('0x36')](_0x65ec('0x5d')));}else{_0x29b958(ut['message'](_0x5f0daa['message']));}});};function originate(_0x258e14,_0x54f1cb,_0x244d12){return new BPromise(function(_0x1c2972,_0xf78f6a){if(_0x244d12){var _0x290c68=util[_0x65ec('0x5e')](_0x65ec('0x5f'),path[_0x65ec('0x38')](_0x258e14[_0x65ec('0x60')])[_0x65ec('0x25')],_0x258e14[_0x65ec('0x60')]);gs['execute'](_0x290c68)[_0x65ec('0x3b')](function(){_0x258e14['path']=util[_0x65ec('0x5e')](_0x65ec('0x61'),path[_0x65ec('0x38')](_0x258e14[_0x65ec('0x60')])['dir'],path[_0x65ec('0x38')](_0x258e14['path'])[_0x65ec('0x25')]);_0x54f1cb[_0x65ec('0x62')]=_0x258e14[_0x65ec('0x60')];ut[_0x65ec('0x4a')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut['variablesAction'](_0x258e14,_0x54f1cb))[_0x65ec('0x3b')](function(_0x1ebe40){_0x1c2972(_0x1ebe40);})[_0x65ec('0x3d')](function(_0x161061){_0xf78f6a(_0x161061);});})[_0x65ec('0x3d')](function(_0x3465f8){_0xf78f6a(_0x3465f8);});}else{ami[_0x65ec('0x63')](ut[_0x65ec('0x64')](_0x258e14,_0x54f1cb))[_0x65ec('0x3b')](function(_0x36af5c){_0x1c2972(_0x36af5c);})[_0x65ec('0x3d')](function(_0x29be1a){_0xf78f6a(_0x29be1a);});}});}Fax[_0x65ec('0x1d')]['execOriginate']=function(_0x154241,_0x1691c6){var _0x412159=this;return new BPromise(function(_0x46906e,_0x7dbd56){var _0x12656c=uuid['v4']();var _0x1541fc=ut[_0x65ec('0x65')](_0x154241,_0x1691c6);_0x412159[_0x65ec('0x28')][_0x12656c]=new Action(_0x12656c,_0x1691c6,_0x154241);var _0x26ac0e=_0x412159['actions'][_0x12656c];if(path[_0x65ec('0x38')](_0x154241['path'])['ext']===_0x65ec('0x39')){originate(_0x26ac0e,_0x1541fc,!![])[_0x65ec('0x3b')](function(_0x272432){_0x46906e(_0x272432);})[_0x65ec('0x3d')](function(_0x1641e0){_0x7dbd56(_0x1641e0);});}else{originate(_0x26ac0e,_0x1541fc,![])[_0x65ec('0x3b')](function(_0x1178e0){_0x46906e(_0x1178e0);})[_0x65ec('0x3d')](function(_0x4ea663){_0x7dbd56(_0x4ea663);});}});};Fax[_0x65ec('0x1d')]['isTrunkReachable']=function(_0x3850fd){return!_[_0x65ec('0x66')](_0x3850fd)&&!_[_0x65ec('0x66')](_0x3850fd['name'])&&!_[_0x65ec('0x66')](_0x3850fd[_0x65ec('0x67')])&&_0x3850fd[_0x65ec('0x67')]&&!_[_0x65ec('0x66')](this[_0x65ec('0xd')][util[_0x65ec('0x5e')](_0x65ec('0x68'),_0x3850fd['name'])])&&!_[_0x65ec('0x66')](this[_0x65ec('0xd')][util[_0x65ec('0x5e')](_0x65ec('0x68'),_0x3850fd['name'])]['status'])&&(this[_0x65ec('0xd')][util[_0x65ec('0x5e')](_0x65ec('0x68'),_0x3850fd[_0x65ec('0x25')])][_0x65ec('0x2d')]===_0x65ec('0x69')||this['trunks'][util[_0x65ec('0x5e')](_0x65ec('0x68'),_0x3850fd[_0x65ec('0x25')])][_0x65ec('0x2d')]===_0x65ec('0x6a'));};Fax[_0x65ec('0x1d')][_0x65ec('0x6b')]=function(_0x360623,_0x4de295){if(!this[_0x65ec('0x6c')](_0x360623)){ut[_0x65ec('0x4a')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x65ec('0x66')](_0x360623)?'':_0x360623[_0x65ec('0x25')]+_0x65ec('0x6d'));return{'isValid':![],'message':_0x65ec('0x6e')};}if(_[_0x65ec('0x66')](_0x4de295[_0x65ec('0x6f')])){ut[_0x65ec('0x4a')](_0x65ec('0x70'),JSON[_0x65ec('0x40')](_0x4de295));return{'isValid':![],'message':_0x65ec('0x71')};}if(_['isNil'](_0x4de295['path'])){ut[_0x65ec('0x4a')](_0x65ec('0x72'),JSON[_0x65ec('0x40')](_0x4de295));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x65ec('0x73')};};module[_0x65ec('0x74')]=Fax; \ No newline at end of file +var _0x4483=['catch','error','\x20notify\x20','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','then','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','stringify','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','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','XMF-PATH','Action','variablesAction','execOriginate','addVariables','ext','isNil','active','SIP/%s','unmonitored','checkTrunk','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','hasOwnProperty','syncNewState','channelstate','channelstatedesc','syncNewExten','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','fax'];(function(_0x4421c3,_0x9d82dd){var _0xf5683a=function(_0x2b7eba){while(--_0x2b7eba){_0x4421c3['push'](_0x4421c3['shift']());}};_0xf5683a(++_0x9d82dd);}(_0x4483,0x1a3));var _0x3448=function(_0x21ad71,_0xccbafe){_0x21ad71=_0x21ad71-0x0;var _0x1a2d9b=_0x4483[_0x21ad71];return _0x1a2d9b;};'use strict';var util=require(_0x3448('0x0'));var _=require(_0x3448('0x1'));var BPromise=require(_0x3448('0x2'));var uuid=require('uuid');var moment=require(_0x3448('0x3'));var path=require(_0x3448('0x4'));var tiff2pdf=require(_0x3448('0x5'));var gs=require(_0x3448('0x6'));var logger=require(_0x3448('0x7'))('fax');var ami=require(_0x3448('0x8'));var rpcDb=require(_0x3448('0x9'));var Channel=require(_0x3448('0xa'));var ut=require(_0x3448('0xb'));var Action=require(_0x3448('0xc'));var faxAccount=require(_0x3448('0xd'));var attachment=require(_0x3448('0xe'));var faxMessage=require(_0x3448('0xf'));function Fax(_0x5923ee){this['channels']={};this[_0x3448('0x10')]=_0x5923ee[_0x3448('0x10')];this[_0x3448('0x11')]=_0x5923ee[_0x3448('0x11')];this[_0x3448('0x12')]={};ami['on'](_0x3448('0x13'),this[_0x3448('0x14')][_0x3448('0x15')](this));ami['on'](_0x3448('0x16'),this[_0x3448('0x17')][_0x3448('0x15')](this));ami['on']('newstate',this['syncNewState'][_0x3448('0x15')](this));ami['on'](_0x3448('0x18'),this['syncNewExten'][_0x3448('0x15')](this));ami['on'](_0x3448('0x19'),this[_0x3448('0x1a')]['bind'](this));ami['on'](_0x3448('0x1b'),this[_0x3448('0x1c')]['bind'](this));ami['on'](_0x3448('0x1d'),this[_0x3448('0x1e')][_0x3448('0x15')](this));ami['on']('originateresponse',this[_0x3448('0x1f')][_0x3448('0x15')](this));}Fax[_0x3448('0x20')][_0x3448('0x14')]=function(_0x400af8){if(_0x400af8[_0x3448('0x21')]===_0x3448('0x22')){for(var _0x425514 in this['faxAccounts']){if(this[_0x3448('0x10')]['hasOwnProperty'](_0x425514)){if(_0x400af8['exten']===this['faxAccounts'][_0x425514][_0x3448('0x23')]){this[_0x3448('0x24')][_0x400af8[_0x3448('0x25')]]={};this['channels'][_0x400af8[_0x3448('0x25')]][_0x3448('0x26')]=_0x400af8[_0x3448('0x26')];this[_0x3448('0x24')][_0x400af8[_0x3448('0x25')]]['id']=this[_0x3448('0x10')][_0x425514]['id'];this['channels'][_0x400af8['uniqueid']]['name']=this[_0x3448('0x10')][_0x425514][_0x3448('0x27')];logger['info'](_0x400af8['uniqueid'],_0x3448('0x28'));}}}}if(this[_0x3448('0x12')][_0x400af8[_0x3448('0x25')]]){this[_0x3448('0x24')][_0x400af8[_0x3448('0x25')]]={};this['channels'][_0x400af8[_0x3448('0x25')]][_0x3448('0x26')]=_0x400af8[_0x3448('0x26')];logger[_0x3448('0x29')](_0x400af8[_0x3448('0x25')],'\x20syncNewchannel\x20');}};Fax[_0x3448('0x20')][_0x3448('0x17')]=function(_0x52c163){if(this[_0x3448('0x24')][_0x52c163[_0x3448('0x25')]]){for(var _0x310912 in _0x52c163[_0x3448('0x2a')]){if(_0x52c163[_0x3448('0x2a')][_0x3448('0x2b')](_0x310912)){this[_0x3448('0x24')][_0x52c163[_0x3448('0x25')]][_0x310912]=_0x52c163['value'];}}}};Fax[_0x3448('0x20')][_0x3448('0x2c')]=function(_0xcfdc5){if(this['channels'][_0xcfdc5[_0x3448('0x25')]]){this['channels'][_0xcfdc5['uniqueid']]['channelstate']=_0xcfdc5[_0x3448('0x2d')];this[_0x3448('0x24')][_0xcfdc5['uniqueid']]['channelstatedesc']=_0xcfdc5[_0x3448('0x2e')];}};Fax[_0x3448('0x20')][_0x3448('0x2f')]=function(_0x1e99ff){if(this['channels'][_0x1e99ff[_0x3448('0x25')]]){for(var _0x3b6ff9 in _0x1e99ff[_0x3448('0x2a')]){if(_0x1e99ff['variable'][_0x3448('0x2b')](_0x3b6ff9)){this[_0x3448('0x24')][_0x1e99ff['uniqueid']][_0x3b6ff9]=_0x1e99ff['value'];}}}};Fax[_0x3448('0x20')][_0x3448('0x1a')]=function(_0x3c7eb1){if(this[_0x3448('0x24')][_0x3c7eb1['uniqueid']]){this[_0x3448('0x24')][_0x3c7eb1[_0x3448('0x25')]][_0x3448('0x30')]=_0x3c7eb1[_0x3448('0x30')];this['channels'][_0x3c7eb1[_0x3448('0x25')]][_0x3448('0x31')]=_0x3c7eb1['status'];this[_0x3448('0x24')][_0x3c7eb1[_0x3448('0x25')]][_0x3448('0x23')]=_0x3c7eb1[_0x3448('0x23')];this[_0x3448('0x24')][_0x3c7eb1[_0x3448('0x25')]][_0x3448('0x32')]=_0x3c7eb1[_0x3448('0x32')];logger[_0x3448('0x29')](_0x3c7eb1['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0x3448('0x20')]['syncReceiveFax']=function(_0x22bb31){var _0x3048fa=this;if(this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]]){var _0x5af6cd=this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]]['id'];this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]][_0x3448('0x33')]=_0x22bb31[_0x3448('0x33')];this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]][_0x3448('0x34')]=_0x22bb31['pagestransferred'];this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]][_0x3448('0x23')]=_0x22bb31[_0x3448('0x23')];this[_0x3448('0x24')][_0x22bb31['uniqueid']][_0x3448('0x35')]=_0x22bb31[_0x3448('0x35')];this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]][_0x3448('0x36')]=_0x22bb31[_0x3448('0x36')];this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]]['filename']=_0x22bb31[_0x3448('0x32')];this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]]['calleridnum']=_0x22bb31[_0x3448('0x37')];if(this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]][_0x3448('0x34')]>0x0){tiff2pdf(_0x22bb31[_0x3448('0x32')],_0x3448('0x38'),function(_0x213065){logger['info'](_0x22bb31[_0x3448('0x25')],_0x3448('0x39'),_0x213065[_0x3448('0x3a')]);attachment[_0x3448('0x3b')]({'name':path[_0x3448('0x3c')](_0x22bb31[_0x3448('0x32')])['name'],'basename':path[_0x3448('0x3c')](_0x22bb31['filename'])['name']+_0x3448('0x3d'),'type':_0x3448('0x3e')})['then'](function(_0x3a700f){faxAccount[_0x3448('0x3f')](_0x5af6cd,{'from':_0x22bb31['calleridnum'],'mapKey':_0x3448('0x40'),'body':path[_0x3448('0x3c')](_0x22bb31['filename'])[_0x3448('0x27')]+_0x3448('0x3d'),'AttachmentId':_0x3a700f['id']})[_0x3448('0x41')](function(_0x2be597){logger[_0x3448('0x42')](_0x22bb31[_0x3448('0x25')],_0x3448('0x43'),JSON['stringify'](_0x2be597));});})['catch'](function(_0x38aca7){logger[_0x3448('0x42')](_0x22bb31[_0x3448('0x25')],_0x3448('0x44'),JSON['stringify'](_0x38aca7));});});}logger[_0x3448('0x29')](_0x22bb31[_0x3448('0x25')],_0x3448('0x44'));}};Fax[_0x3448('0x20')][_0x3448('0x1f')]=function(_0x5d942b){if(this[_0x3448('0x12')][_0x5d942b['uniqueid']]){_[_0x3448('0x45')](this[_0x3448('0x24')][_0x5d942b['uniqueid']],_[_0x3448('0x46')](_0x5d942b,[_0x3448('0x47'),_0x3448('0x48')]));}};function updateStatus(_0x19c283){if(_0x19c283[_0x3448('0x49')]){faxMessage[_0x3448('0x4a')](_0x19c283[_0x3448('0x49')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x3448('0x4b')](function(_0x9fbee8){ut['logger']('[Fax][Message][Error][Updated]',_0x9fbee8);})[_0x3448('0x41')](function(_0x3d6598){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x3d6598);});}else{ut[_0x3448('0x4c')](_0x3448('0x4d'));}}Fax[_0x3448('0x20')][_0x3448('0x4e')]=function(_0x176e60,_0x39db50,_0x2aea70){var _0x4c0053=this;var _0x5ee303={};if(_0x39db50){_0x5ee303={'read':_0x39db50};}else{_0x5ee303={'failMessage':_0x2aea70};}if(this['actions'][_0x176e60][_0x3448('0x49')]){faxMessage[_0x3448('0x4a')](this['actions'][_0x176e60][_0x3448('0x49')],_0x5ee303)[_0x3448('0x4b')](function(_0x5a4cde){ut[_0x3448('0x4c')](_0x3448('0x4f'),_0x5a4cde);})['catch'](function(_0x2afe2a){ut[_0x3448('0x4c')](_0x3448('0x50'),_0x2afe2a);})[_0x3448('0x51')](function(){delete _0x4c0053[_0x3448('0x24')][_0x176e60];delete _0x4c0053[_0x3448('0x12')][_0x176e60];});}else{ut[_0x3448('0x4c')](_0x3448('0x52'));delete this[_0x3448('0x24')][_0x176e60];delete this['actions'][_0x176e60];}};Fax[_0x3448('0x20')]['syncHangup']=function(_0x2991e8){var _0x108b99=this;if(this[_0x3448('0x24')][_0x2991e8[_0x3448('0x25')]]){if(this[_0x3448('0x12')][_0x2991e8[_0x3448('0x25')]]){this['channels'][_0x2991e8[_0x3448('0x25')]]['id']=this['actions'][_0x2991e8[_0x3448('0x25')]]['id'];this[_0x3448('0x24')][_0x2991e8[_0x3448('0x25')]][_0x3448('0x27')]=this[_0x3448('0x12')][_0x2991e8['uniqueid']]['name'];}logger[_0x3448('0x29')](_0x2991e8[_0x3448('0x25')],this[_0x3448('0x12')][_0x2991e8['uniqueid']]?_0x3448('0x53'):_0x3448('0x54'),JSON[_0x3448('0x55')](this[_0x3448('0x24')][_0x2991e8[_0x3448('0x25')]]));if(this[_0x3448('0x12')][_0x2991e8[_0x3448('0x25')]]){if(this[_0x3448('0x24')][_0x2991e8[_0x3448('0x25')]][_0x3448('0x56')]>0x0&&this[_0x3448('0x24')][_0x2991e8[_0x3448('0x25')]][_0x3448('0x19')]===_0x3448('0x57')){this[_0x3448('0x4e')](_0x2991e8[_0x3448('0x25')],!![]);}else{this[_0x3448('0x4e')](_0x2991e8[_0x3448('0x25')],![],this['channels'][_0x2991e8[_0x3448('0x25')]]['faxstatusstring']?_0x3448('0x58')+this['channels'][_0x2991e8[_0x3448('0x25')]][_0x3448('0x59')]:'SENDING\x20FAILED');}}}};Fax[_0x3448('0x20')][_0x3448('0x5a')]=function(_0x54cddd){var _0x4f6902=this;return new BPromise(function(_0x599350,_0x4864ae){_0x4f6902['execOriginate'](_0x54cddd,_0x4f6902[_0x3448('0x10')][_0x54cddd[_0x3448('0x5b')]])['then'](function(_0x5e1cbf){ut[_0x3448('0x4c')](_0x3448('0x5c'),_0x5e1cbf);_0x599350(ut[_0x3448('0x3a')](_0x3448('0x5d')));})[_0x3448('0x41')](function(_0x27003f){ut[_0x3448('0x4c')](_0x3448('0x5e'),_0x27003f);updateStatus(_0x54cddd);_0x4864ae(ut[_0x3448('0x3a')](_0x3448('0x5f')));});});};Fax[_0x3448('0x20')][_0x3448('0x60')]=function(_0x41f84c){var _0x387ab2=this;return new BPromise(function(_0x5476dd,_0x18c449){var _0x2dcf50=_0x387ab2['checkTrunk'](_0x387ab2[_0x3448('0x10')][_0x41f84c[_0x3448('0x5b')]]['Trunk'],_0x41f84c);if(_0x2dcf50[_0x3448('0x61')]){_0x5476dd(ut[_0x3448('0x3a')](_0x3448('0x62')));}else{_0x18c449(ut['message'](_0x2dcf50['message']));}});};function originate(_0x41d459,_0x489b70,_0x31dfc5){return new BPromise(function(_0x42c146,_0x5d952a){if(_0x31dfc5){var _0x50b81b=util[_0x3448('0x63')](_0x3448('0x64'),path[_0x3448('0x3c')](_0x41d459['path'])['name'],_0x41d459[_0x3448('0x4')]);gs[_0x3448('0x65')](_0x50b81b)[_0x3448('0x4b')](function(){_0x41d459[_0x3448('0x4')]=util[_0x3448('0x63')](_0x3448('0x66'),path['parse'](_0x41d459[_0x3448('0x4')])['dir'],path[_0x3448('0x3c')](_0x41d459[_0x3448('0x4')])['name']);_0x489b70[_0x3448('0x67')]=_0x41d459[_0x3448('0x4')];ut['logger']('Convert\x20pdf\x20to\x20tif','');ami[_0x3448('0x68')](ut[_0x3448('0x69')](_0x41d459,_0x489b70))[_0x3448('0x4b')](function(_0x392874){_0x42c146(_0x392874);})[_0x3448('0x41')](function(_0xfdd159){_0x5d952a(_0xfdd159);});})[_0x3448('0x41')](function(_0x29f39b){_0x5d952a(_0x29f39b);});}else{ami[_0x3448('0x68')](ut[_0x3448('0x69')](_0x41d459,_0x489b70))[_0x3448('0x4b')](function(_0xc0d8f1){_0x42c146(_0xc0d8f1);})[_0x3448('0x41')](function(_0x11d62f){_0x5d952a(_0x11d62f);});}});}Fax[_0x3448('0x20')][_0x3448('0x6a')]=function(_0x4cfab2,_0x4efd6c){var _0x42ac4f=this;return new BPromise(function(_0x4d2af5,_0x223a6b){var _0x155ee2=uuid['v4']();var _0x584229=ut[_0x3448('0x6b')](_0x4cfab2,_0x4efd6c);_0x42ac4f['actions'][_0x155ee2]=new Action(_0x155ee2,_0x4efd6c,_0x4cfab2);var _0x15d898=_0x42ac4f[_0x3448('0x12')][_0x155ee2];if(path[_0x3448('0x3c')](_0x4cfab2[_0x3448('0x4')])[_0x3448('0x6c')]==='.pdf'){originate(_0x15d898,_0x584229,!![])[_0x3448('0x4b')](function(_0x2e2b73){_0x4d2af5(_0x2e2b73);})[_0x3448('0x41')](function(_0x4aad6d){_0x223a6b(_0x4aad6d);});}else{originate(_0x15d898,_0x584229,![])[_0x3448('0x4b')](function(_0x15a3b2){_0x4d2af5(_0x15a3b2);})[_0x3448('0x41')](function(_0x5d14ac){_0x223a6b(_0x5d14ac);});}});};Fax[_0x3448('0x20')]['isTrunkReachable']=function(_0x48d320){return!_[_0x3448('0x6d')](_0x48d320)&&!_['isNil'](_0x48d320[_0x3448('0x27')])&&!_['isNil'](_0x48d320[_0x3448('0x6e')])&&_0x48d320[_0x3448('0x6e')]&&!_['isNil'](this['trunks'][util[_0x3448('0x63')](_0x3448('0x6f'),_0x48d320['name'])])&&!_[_0x3448('0x6d')](this[_0x3448('0x11')][util['format'](_0x3448('0x6f'),_0x48d320[_0x3448('0x27')])][_0x3448('0x31')])&&(this[_0x3448('0x11')][util['format'](_0x3448('0x6f'),_0x48d320['name'])][_0x3448('0x31')]==='reachable'||this[_0x3448('0x11')][util[_0x3448('0x63')](_0x3448('0x6f'),_0x48d320['name'])][_0x3448('0x31')]===_0x3448('0x70'));};Fax['prototype'][_0x3448('0x71')]=function(_0x51f6b0,_0x520950){if(!this[_0x3448('0x72')](_0x51f6b0)){ut['logger'](_0x3448('0x73'),_[_0x3448('0x6d')](_0x51f6b0)?'':_0x51f6b0[_0x3448('0x27')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x3448('0x74')};}if(_[_0x3448('0x6d')](_0x520950[_0x3448('0x40')])){ut[_0x3448('0x4c')](_0x3448('0x75'),JSON[_0x3448('0x55')](_0x520950));return{'isValid':![],'message':_0x3448('0x76')};}if(_[_0x3448('0x6d')](_0x520950[_0x3448('0x4')])){ut[_0x3448('0x4c')](_0x3448('0x77'),JSON[_0x3448('0x55')](_0x520950));return{'isValid':![],'message':_0x3448('0x78')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 60a8e23..c48674f 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 _0x2c5f=['lodash','error','inspect','notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x20e9f6,_0x289e34){var _0x436892=function(_0x183951){while(--_0x183951){_0x20e9f6['push'](_0x20e9f6['shift']());}};_0x436892(++_0x289e34);}(_0x2c5f,0x11c));var _0xf2c5=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x2c5f[_0x44a64f];return _0x52024b;};'use strict';var util=require(_0xf2c5('0x0'));var BPromise=require(_0xf2c5('0x1'));var logger=require(_0xf2c5('0x2'))(_0xf2c5('0x3'));var _=require(_0xf2c5('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x555084){return function(_0x120826){logger[_0xf2c5('0x5')](_0x555084,util[_0xf2c5('0x6')](_0x120826,{'showHidden':![],'depth':null}));};}exports[_0xf2c5('0x7')]=function(_0x2cb7a1,_0x557c7d){return BPromise[_0xf2c5('0x8')]()[_0xf2c5('0x9')](faxAccount['notify'](_0x2cb7a1,_0x557c7d))[_0xf2c5('0xa')](loggerCatch(_0xf2c5('0xb')));}; \ No newline at end of file +var _0x35ad=['then','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','resolve'];(function(_0x2c2a8e,_0x1dfe39){var _0x3b9e38=function(_0x115a84){while(--_0x115a84){_0x2c2a8e['push'](_0x2c2a8e['shift']());}};_0x3b9e38(++_0x1dfe39);}(_0x35ad,0x19c));var _0xd35a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x35ad[_0x59ee6f];return _0x4c0979;};'use strict';var util=require(_0xd35a('0x0'));var BPromise=require(_0xd35a('0x1'));var logger=require(_0xd35a('0x2'))(_0xd35a('0x3'));var _=require(_0xd35a('0x4'));var faxAccount=require(_0xd35a('0x5'));function loggerCatch(_0x4e132a){return function(_0x21b3d4){logger[_0xd35a('0x6')](_0x4e132a,util['inspect'](_0x21b3d4,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0xdbdcea,_0xf54895){return BPromise[_0xd35a('0x7')]()[_0xd35a('0x8')](faxAccount['notify'](_0xdbdcea,_0xf54895))['catch'](loggerCatch(_0xd35a('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 dca514e..f56e7e2 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 _0x3321=['../../../../config/logger','fax','child_process','exec','info','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0x73a414,_0x219122){var _0xe34ec2=function(_0x3cc198){while(--_0x3cc198){_0x73a414['push'](_0x73a414['shift']());}};_0xe34ec2(++_0x219122);}(_0x3321,0x188));var _0x1332=function(_0x1ab20a,_0x50a80a){_0x1ab20a=_0x1ab20a-0x0;var _0x42c089=_0x3321[_0x1ab20a];return _0x42c089;};'use strict';var util=require('util');var logger=require(_0x1332('0x0'))(_0x1332('0x1'));var BPromise=require('bluebird');var exec=require(_0x1332('0x2'))[_0x1332('0x3')];exports['execute']=function(_0x383669){return new BPromise(function(_0x1e0a36,_0x5b024f){exec(_0x383669,function(_0x9b7723,_0x12378b,_0x925db5){logger[_0x1332('0x4')](_0x1332('0x5'),_0x12378b);if(_0x9b7723){logger['info']('Exec\x20gs',_0x1332('0x6'),util[_0x1332('0x7')](_0x9b7723,{'showHidden':![],'depth':null}),_0x12378b,_0x925db5);_0x5b024f(_0x9b7723);}_0x1e0a36(_0x12378b);});});}; \ No newline at end of file +var _0x5f6d=['info','Exec\x20gs','util','../../../../config/logger','child_process','exec'];(function(_0x4b32d5,_0x54b694){var _0x230836=function(_0x3e313d){while(--_0x3e313d){_0x4b32d5['push'](_0x4b32d5['shift']());}};_0x230836(++_0x54b694);}(_0x5f6d,0xb6));var _0xd5f6=function(_0x305be7,_0x527c99){_0x305be7=_0x305be7-0x0;var _0x122e11=_0x5f6d[_0x305be7];return _0x122e11;};'use strict';var util=require(_0xd5f6('0x0'));var logger=require(_0xd5f6('0x1'))('fax');var BPromise=require('bluebird');var exec=require(_0xd5f6('0x2'))[_0xd5f6('0x3')];exports['execute']=function(_0x28a5d8){return new BPromise(function(_0x5016eb,_0x5eddb7){exec(_0x28a5d8,function(_0x343995,_0x250e8c,_0x8f4e08){logger[_0xd5f6('0x4')](_0xd5f6('0x5'),_0x250e8c);if(_0x343995){logger['info']('Exec\x20gs','\x20Error\x20:',util['inspect'](_0x343995,{'showHidden':![],'depth':null}),_0x250e8c,_0x8f4e08);_0x5eddb7(_0x343995);}_0x5016eb(_0x250e8c);});});}; \ 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 b3ddd77..e185494 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 _0xb253=['faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','channel','xcally-motion-fax','format','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway'];(function(_0x4e3040,_0x58d4b5){var _0x54f700=function(_0x44ea87){while(--_0x44ea87){_0x4e3040['push'](_0x4e3040['shift']());}};_0x54f700(++_0x58d4b5);}(_0xb253,0x15b));var _0x3b25=function(_0x71d35a,_0x4608e0){_0x71d35a=_0x71d35a-0x0;var _0x2fcd4c=_0xb253[_0x71d35a];return _0x2fcd4c;};'use strict';var util=require(_0x3b25('0x0'));var _=require(_0x3b25('0x1'));var moment=require(_0x3b25('0x2'));var logger=require(_0x3b25('0x3'))(_0x3b25('0x4'));exports[_0x3b25('0x5')]=function(_0x1ed144){return{'message':_0x1ed144};};exports[_0x3b25('0x6')]=function(_0x340330,_0x1a44b7){logger[_0x3b25('0x7')](_0x340330,util[_0x3b25('0x8')](_0x1a44b7,{'showHidden':![],'depth':null}));};exports[_0x3b25('0x9')]=function(_0x174e89,_0x13181e){var _0x77fd52={'XMF-ECM':_0x13181e[_0x3b25('0xa')],'XMF-HEADERINFO':_0x13181e[_0x3b25('0xb')],'XMF-MINRATE':_0x13181e[_0x3b25('0xc')],'XMF-MAXRATE':_0x13181e[_0x3b25('0xd')],'XMF-MODEM':util['format'](_0x3b25('0xe'),_0x13181e[_0x3b25('0xf')]),'XMF-GATEWAY':_0x13181e[_0x3b25('0x10')],'XMF-FAXDETECT':_0x13181e[_0x3b25('0x11')],'XMF-T38TIMEOUT':_0x13181e[_0x3b25('0x12')],'XMF-LOCALSTATIONID':_0x13181e[_0x3b25('0x13')],'XMF-PATH':_0x174e89[_0x3b25('0x14')]};return _0x77fd52;};exports[_0x3b25('0x15')]=function(_0x2feebe,_0x56aecb){return{'actionid':_0x2feebe[_0x3b25('0x16')],'action':'originate','channel':_0x2feebe[_0x3b25('0x17')],'Exten':_0x3b25('0x18'),'Context':'from-sip','Priority':'1','callerid':util[_0x3b25('0x19')]('\x22%s\x22\x20<%s>',_0x2feebe[_0x3b25('0xb')]?_0x2feebe[_0x3b25('0xb')]:'',_0x2feebe[_0x3b25('0x13')]),'variable':_0x56aecb,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2feebe[_0x3b25('0x16')]};}; \ No newline at end of file +var _0x207f=['moment','../../../../config/logger','fax','inspect','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','modem','faxdetect','t38timeout','path','uniqueid','originate','from-sip','\x22%s\x22\x20<%s>','localstationid','util','lodash'];(function(_0x33c2af,_0x163198){var _0x13c04a=function(_0x4de68e){while(--_0x4de68e){_0x33c2af['push'](_0x33c2af['shift']());}};_0x13c04a(++_0x163198);}(_0x207f,0x124));var _0xf207=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x207f[_0x3947c9];return _0x2e7871;};'use strict';var util=require(_0xf207('0x0'));var _=require(_0xf207('0x1'));var moment=require(_0xf207('0x2'));var logger=require(_0xf207('0x3'))(_0xf207('0x4'));exports['message']=function(_0x2c6a96){return{'message':_0x2c6a96};};exports['logger']=function(_0x214b38,_0x21f6a6){logger['info'](_0x214b38,util[_0xf207('0x5')](_0x21f6a6,{'showHidden':![],'depth':null}));};exports[_0xf207('0x6')]=function(_0x4a643c,_0x297a75){var _0x3d6dda={'XMF-ECM':_0x297a75[_0xf207('0x7')],'XMF-HEADERINFO':_0x297a75[_0xf207('0x8')],'XMF-MINRATE':_0x297a75[_0xf207('0x9')],'XMF-MAXRATE':_0x297a75['maxrate'],'XMF-MODEM':util[_0xf207('0xa')](_0xf207('0xb'),_0x297a75[_0xf207('0xc')]),'XMF-GATEWAY':_0x297a75['gateway'],'XMF-FAXDETECT':_0x297a75[_0xf207('0xd')],'XMF-T38TIMEOUT':_0x297a75[_0xf207('0xe')],'XMF-LOCALSTATIONID':_0x297a75['localstationid'],'XMF-PATH':_0x4a643c[_0xf207('0xf')]};return _0x3d6dda;};exports['variablesAction']=function(_0x1e5fa2,_0xc72c52){return{'actionid':_0x1e5fa2[_0xf207('0x10')],'action':_0xf207('0x11'),'channel':_0x1e5fa2['channel'],'Exten':'xcally-motion-fax','Context':_0xf207('0x12'),'Priority':'1','callerid':util[_0xf207('0xa')](_0xf207('0x13'),_0x1e5fa2['headerinfo']?_0x1e5fa2['headerinfo']:'',_0x1e5fa2[_0xf207('0x14')]),'variable':_0xc72c52,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1e5fa2[_0xf207('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index b985117..5490520 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 _0x652c=['getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','[index.js][main]','bluebird','util','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./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','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory'];(function(_0x15fe47,_0x52ff92){var _0xb9486a=function(_0x5613a7){while(--_0x5613a7){_0x15fe47['push'](_0x15fe47['shift']());}};_0xb9486a(++_0x52ff92);}(_0x652c,0x9a));var _0xc652=function(_0x3e35b4,_0x1afff4){_0x3e35b4=_0x3e35b4-0x0;var _0x5b0871=_0x652c[_0x3e35b4];return _0x5b0871;};'use strict';var BPromise=require(_0xc652('0x0'));var util=require(_0xc652('0x1'));var moment=require(_0xc652('0x2'));var server=require(_0xc652('0x3'));var Realtime=require(_0xc652('0x4'));var Report=require(_0xc652('0x5'));var Acw=require('./acw');var Trigger=require(_0xc652('0x6'));var Dialer=require(_0xc652('0x7'));var Preview=require(_0xc652('0x8'));var Fax=require(_0xc652('0x9'));var user=require('./rpc/user');var voiceQueue=require(_0xc652('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xc652('0xb'));var trigger=require(_0xc652('0xc'));var template=require(_0xc652('0xd'));var cmHopperHistory=require(_0xc652('0xe'));var campaign=require(_0xc652('0xf'));var voiceExtension=require(_0xc652('0x10'));var faxAccount=require(_0xc652('0x11'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xc652('0x12'));var sugarcrm=require(_0xc652('0x13'));var freshdesk=require(_0xc652('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xc652('0x15'));var vtiger=require(_0xc652('0x16'));var freshsales=require(_0xc652('0x17'));var servicenow=require(_0xc652('0x18'));var dynamics365=require(_0xc652('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xc652('0x1a'))(_0xc652('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xc652('0x1c')](_0xc652('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xc652('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xc652('0x1e')]()[_0xc652('0x1f')](user[_0xc652('0x20')]())[_0xc652('0x1f')](realtime[_0xc652('0x21')]())['then'](user[_0xc652('0x22')]())[_0xc652('0x1f')](realtime[_0xc652('0x23')]())[_0xc652('0x1f')](trunk[_0xc652('0x24')]())[_0xc652('0x1f')](realtime[_0xc652('0x25')]())[_0xc652('0x1f')](voiceQueue['getVoiceQueues']())[_0xc652('0x1f')](realtime[_0xc652('0x26')]())[_0xc652('0x1f')](trigger[_0xc652('0x27')]())[_0xc652('0x1f')](realtime[_0xc652('0x28')]())['then'](template[_0xc652('0x29')]())[_0xc652('0x1f')](realtime[_0xc652('0x2a')]())[_0xc652('0x1f')](zendesk['getZendeskAccounts']())[_0xc652('0x1f')](realtime[_0xc652('0x2b')]())[_0xc652('0x1f')](salesforce[_0xc652('0x2c')]())['then'](realtime['initSalesforceAccounts']())[_0xc652('0x1f')](sugarcrm[_0xc652('0x2d')]())[_0xc652('0x1f')](realtime[_0xc652('0x2e')]())[_0xc652('0x1f')](freshdesk[_0xc652('0x2f')]())[_0xc652('0x1f')](realtime[_0xc652('0x30')]())[_0xc652('0x1f')](desk[_0xc652('0x31')]())['then'](realtime[_0xc652('0x32')]())[_0xc652('0x1f')](zoho[_0xc652('0x33')]())[_0xc652('0x1f')](realtime[_0xc652('0x34')]())['then'](vtiger[_0xc652('0x35')]())[_0xc652('0x1f')](realtime['initVtigerAccounts']())['then'](freshsales[_0xc652('0x36')]())[_0xc652('0x1f')](realtime['initFreshsalesAccounts']())[_0xc652('0x1f')](servicenow['getServicenowAccounts']())[_0xc652('0x1f')](realtime[_0xc652('0x37')]())[_0xc652('0x1f')](dynamics365[_0xc652('0x38')]())[_0xc652('0x1f')](realtime[_0xc652('0x39')]())[_0xc652('0x1f')](campaign[_0xc652('0x3a')]())[_0xc652('0x1f')](realtime[_0xc652('0x3b')]())[_0xc652('0x1f')](voiceExtension[_0xc652('0x3c')]())['then'](realtime['initVoiceExtensions']())[_0xc652('0x1f')](faxAccount[_0xc652('0x3d')]())[_0xc652('0x1f')](realtime[_0xc652('0x3e')]())[_0xc652('0x1f')](function(){return realtime;});}function initParams(){return BPromise[_0xc652('0x1e')]()[_0xc652('0x1f')](voiceQueueReport[_0xc652('0x3f')]())['then'](realtime[_0xc652('0x40')]())[_0xc652('0x1f')](cmHopperHistory[_0xc652('0x41')]())[_0xc652('0x1f')](realtime[_0xc652('0x42')]())[_0xc652('0x1f')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime[_0xc652('0x43')]())[_0xc652('0x1f')](voiceCallReport[_0xc652('0x44')]())[_0xc652('0x1f')](realtime[_0xc652('0x45')]())['catch'](function(_0xf526c3){logger[_0xc652('0x46')](_0xc652('0x47'),util[_0xc652('0x48')](_0xf526c3,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xc652('0x1f')](function(_0x54471d){return initRealtime();})[_0xc652('0x1f')](function(){return initParams();})[_0xc652('0x1f')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x51ea1f){logger[_0xc652('0x46')](_0xc652('0x49'),util[_0xc652('0x48')](_0x51ea1f,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xf280=['./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','hour','then','initAgents','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','moment','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf280,0x113));var _0x0f28=function(_0x5400a1,_0x2275aa){_0x5400a1=_0x5400a1-0x0;var _0x4006c7=_0xf280[_0x5400a1];return _0x4006c7;};'use strict';var BPromise=require(_0x0f28('0x0'));var util=require('util');var moment=require(_0x0f28('0x1'));var server=require(_0x0f28('0x2'));var Realtime=require(_0x0f28('0x3'));var Report=require(_0x0f28('0x4'));var Acw=require(_0x0f28('0x5'));var Trigger=require(_0x0f28('0x6'));var Dialer=require('./dialer');var Preview=require(_0x0f28('0x7'));var Fax=require(_0x0f28('0x8'));var user=require(_0x0f28('0x9'));var voiceQueue=require(_0x0f28('0xa'));var voiceQueueReport=require(_0x0f28('0xb'));var voiceCallReport=require(_0x0f28('0xc'));var trunk=require(_0x0f28('0xd'));var trigger=require(_0x0f28('0xe'));var template=require(_0x0f28('0xf'));var cmHopperHistory=require(_0x0f28('0x10'));var campaign=require(_0x0f28('0x11'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x0f28('0x12'));var zendesk=require(_0x0f28('0x13'));var salesforce=require(_0x0f28('0x14'));var sugarcrm=require(_0x0f28('0x15'));var freshdesk=require(_0x0f28('0x16'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x0f28('0x17'));var vtiger=require(_0x0f28('0x18'));var freshsales=require(_0x0f28('0x19'));var servicenow=require(_0x0f28('0x1a'));var dynamics365=require(_0x0f28('0x1b'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x0f28('0x1c'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x0f28('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x0f28('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user['getAgents']())[_0x0f28('0x1e')](realtime[_0x0f28('0x1f')]())['then'](user['getTelephones']())[_0x0f28('0x1e')](realtime[_0x0f28('0x20')]())['then'](trunk[_0x0f28('0x21')]())[_0x0f28('0x1e')](realtime['initTrunks']())[_0x0f28('0x1e')](voiceQueue[_0x0f28('0x22')]())[_0x0f28('0x1e')](realtime[_0x0f28('0x23')]())[_0x0f28('0x1e')](trigger[_0x0f28('0x24')]())['then'](realtime[_0x0f28('0x25')]())['then'](template[_0x0f28('0x26')]())[_0x0f28('0x1e')](realtime[_0x0f28('0x27')]())[_0x0f28('0x1e')](zendesk['getZendeskAccounts']())[_0x0f28('0x1e')](realtime[_0x0f28('0x28')]())[_0x0f28('0x1e')](salesforce['getSalesforceAccounts']())[_0x0f28('0x1e')](realtime[_0x0f28('0x29')]())['then'](sugarcrm[_0x0f28('0x2a')]())['then'](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x0f28('0x2b')]())[_0x0f28('0x1e')](realtime[_0x0f28('0x2c')]())[_0x0f28('0x1e')](desk[_0x0f28('0x2d')]())[_0x0f28('0x1e')](realtime[_0x0f28('0x2e')]())[_0x0f28('0x1e')](zoho[_0x0f28('0x2f')]())[_0x0f28('0x1e')](realtime[_0x0f28('0x30')]())[_0x0f28('0x1e')](vtiger[_0x0f28('0x31')]())[_0x0f28('0x1e')](realtime[_0x0f28('0x32')]())[_0x0f28('0x1e')](freshsales[_0x0f28('0x33')]())[_0x0f28('0x1e')](realtime['initFreshsalesAccounts']())['then'](servicenow[_0x0f28('0x34')]())[_0x0f28('0x1e')](realtime['initServicenowAccounts']())[_0x0f28('0x1e')](dynamics365[_0x0f28('0x35')]())['then'](realtime['initDynamics365Accounts']())[_0x0f28('0x1e')](campaign['getCampaigns']())[_0x0f28('0x1e')](realtime[_0x0f28('0x36')]())[_0x0f28('0x1e')](voiceExtension[_0x0f28('0x37')]())[_0x0f28('0x1e')](realtime[_0x0f28('0x38')]())[_0x0f28('0x1e')](faxAccount[_0x0f28('0x39')]())[_0x0f28('0x1e')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x0f28('0x3a')]()[_0x0f28('0x1e')](voiceQueueReport[_0x0f28('0x3b')]())[_0x0f28('0x1e')](realtime[_0x0f28('0x3c')]())['then'](cmHopperHistory[_0x0f28('0x3d')]())[_0x0f28('0x1e')](realtime[_0x0f28('0x3e')]())[_0x0f28('0x1e')](cmHopperHistory[_0x0f28('0x3f')]())['then'](realtime[_0x0f28('0x40')]())[_0x0f28('0x1e')](voiceCallReport['getVoiceCallReports']())[_0x0f28('0x1e')](realtime[_0x0f28('0x41')]())[_0x0f28('0x42')](function(_0x3d0f7d){logger[_0x0f28('0x43')](_0x0f28('0x44'),util[_0x0f28('0x45')](_0x3d0f7d,{'showHidden':![],'depth':null}));});}function main(){return server[_0x0f28('0x46')](realtime,preview,fax)[_0x0f28('0x1e')](function(_0x17b8b3){return initRealtime();})[_0x0f28('0x1e')](function(){return initParams();})['then'](function(){report[_0x0f28('0x47')]();setInterval(initRealtime,0x1388);})[_0x0f28('0x42')](function(_0x55fe58){logger[_0x0f28('0x43')](_0x0f28('0x48'),util[_0x0f28('0x45')](_0x55fe58,{'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 a1a2616..17fa503 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 _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x337ae1,_0x8acb0b){var _0x5c901a=function(_0x19cf1c){while(--_0x19cf1c){_0x337ae1['push'](_0x337ae1['shift']());}};_0x5c901a(++_0x8acb0b);}(_0xe706,0xa3));var _0x6e70=function(_0x4ed2c1,_0x8c9475){_0x4ed2c1=_0x4ed2c1-0x0;var _0x397295=_0xe706[_0x4ed2c1];return _0x397295;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file +var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x5534b9,_0x4bf176){var _0x472bb4=function(_0x5b32ff){while(--_0x5b32ff){_0x5534b9['push'](_0x5534b9['shift']());}};_0x472bb4(++_0x4bf176);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 557d2c1..29522cd 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 _0xa744=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Interval','dialQueueProject','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0x43aafe,_0x132a63){var _0x4b66b3=function(_0x5a3b6e){while(--_0x5a3b6e){_0x43aafe['push'](_0x43aafe['shift']());}};_0x4b66b3(++_0x132a63);}(_0xa744,0x14f));var _0x4a74=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa744[_0x20a584];return _0x4b41a8;};'use strict';function Campaign(_0x585a50){this['id']=_0x585a50['id']||0x0;this[_0x4a74('0x0')]=_0x585a50[_0x4a74('0x0')]||'';this[_0x4a74('0x1')]=_0x585a50[_0x4a74('0x1')]||'campaign';this['originated']=0x0;this[_0x4a74('0x2')]=0x0;this[_0x4a74('0x3')]=0x0;this[_0x4a74('0x4')]=0x0;this[_0x4a74('0x5')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x585a50['active'];this['limitCalls']=_0x585a50[_0x4a74('0x6')];this[_0x4a74('0x7')]=_0x585a50[_0x4a74('0x7')]||null;this[_0x4a74('0x8')]=_0x585a50[_0x4a74('0x8')]?_0x585a50[_0x4a74('0x8')]:null;this[_0x4a74('0x9')]=_0x585a50[_0x4a74('0x9')];this[_0x4a74('0xa')]=_0x585a50[_0x4a74('0xa')];this['dialOriginateTimeout']=_0x585a50[_0x4a74('0xb')]||0x1e;this[_0x4a74('0xc')]=_0x585a50[_0x4a74('0xc')];this['dialCongestionRetryFrequency']=_0x585a50[_0x4a74('0xd')];this['dialBusyMaxRetry']=_0x585a50['dialBusyMaxRetry'];this[_0x4a74('0xe')]=_0x585a50[_0x4a74('0xe')];this[_0x4a74('0xf')]=_0x585a50[_0x4a74('0xf')];this[_0x4a74('0x10')]=_0x585a50[_0x4a74('0x10')];this[_0x4a74('0x11')]=_0x585a50[_0x4a74('0x11')];this['dialNoSuchNumberMaxRetry']=_0x585a50['dialNoSuchNumberMaxRetry']||0x3;this[_0x4a74('0x12')]=_0x585a50[_0x4a74('0x12')]||0x96;this[_0x4a74('0x13')]=_0x585a50['dialDropMaxRetry']||0x3;this[_0x4a74('0x14')]=_0x585a50['dialDropRetryFrequency']||0x96;this[_0x4a74('0x15')]=_0x585a50[_0x4a74('0x15')]||0x3;this[_0x4a74('0x16')]=_0x585a50[_0x4a74('0x16')]||0x96;this[_0x4a74('0x17')]=_0x585a50['dialMachineMaxRetry']||0x3;this[_0x4a74('0x18')]=_0x585a50[_0x4a74('0x18')]||0x96;this[_0x4a74('0x19')]=_0x585a50[_0x4a74('0x19')]||0x3;this[_0x4a74('0x1a')]=_0x585a50[_0x4a74('0x1a')]||0x96;this[_0x4a74('0x1b')]=_0x585a50[_0x4a74('0x1b')]||_0x4a74('0x1c');this[_0x4a74('0x1d')]=_0x585a50[_0x4a74('0x1d')]||undefined;this[_0x4a74('0x1e')]=_0x585a50[_0x4a74('0x1e')]||undefined;this[_0x4a74('0x1f')]=_0x585a50[_0x4a74('0x1f')]||undefined;this[_0x4a74('0x20')]=_0x585a50[_0x4a74('0x20')]?_0x585a50['TrunkBackup']:undefined;this['Trunk']=_0x585a50['Trunk']?_0x585a50['Trunk']:undefined;this[_0x4a74('0x21')]=_0x585a50['Interval']?_0x585a50[_0x4a74('0x21')]:undefined;this['SquareProject']=_0x585a50['SquareProject']?_0x585a50['SquareProject']:undefined;this[_0x4a74('0x22')]=_0x585a50[_0x4a74('0x23')]?_0x585a50[_0x4a74('0x23')][_0x4a74('0x0')]:undefined;this[_0x4a74('0x24')]=_0x585a50[_0x4a74('0x24')]||![];this[_0x4a74('0x25')]=_0x585a50[_0x4a74('0x25')];this[_0x4a74('0x26')]=_0x585a50[_0x4a74('0x26')];this[_0x4a74('0x27')]=_0x585a50[_0x4a74('0x27')];this[_0x4a74('0x28')]=_0x585a50[_0x4a74('0x28')];this[_0x4a74('0x29')]=_0x585a50['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x585a50[_0x4a74('0x2a')];this[_0x4a74('0x2b')]=_0x585a50[_0x4a74('0x2b')];this[_0x4a74('0x2c')]=_0x585a50[_0x4a74('0x2c')];this[_0x4a74('0x2d')]=_0x585a50[_0x4a74('0x2d')];}module[_0x4a74('0x2e')]=Campaign; \ No newline at end of file +var _0x2d15=['SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval'];(function(_0x3a1fdb,_0x7d345b){var _0x7e6002=function(_0x4b65de){while(--_0x4b65de){_0x3a1fdb['push'](_0x3a1fdb['shift']());}};_0x7e6002(++_0x7d345b);}(_0x2d15,0x19d));var _0x52d1=function(_0x43bd65,_0x31351f){_0x43bd65=_0x43bd65-0x0;var _0x165acb=_0x2d15[_0x43bd65];return _0x165acb;};'use strict';function Campaign(_0x86b81){this['id']=_0x86b81['id']||0x0;this[_0x52d1('0x0')]=_0x86b81[_0x52d1('0x0')]||'';this[_0x52d1('0x1')]=_0x86b81[_0x52d1('0x1')]||'campaign';this[_0x52d1('0x2')]=0x0;this[_0x52d1('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x52d1('0x4')]='';this['sendMessageOneNotActive']=!![];this[_0x52d1('0x5')]=_0x86b81['active'];this[_0x52d1('0x6')]=_0x86b81['limitCalls'];this[_0x52d1('0x7')]=_0x86b81[_0x52d1('0x7')]||null;this[_0x52d1('0x8')]=_0x86b81[_0x52d1('0x8')]?_0x86b81[_0x52d1('0x8')]:null;this[_0x52d1('0x9')]=_0x86b81[_0x52d1('0x9')];this[_0x52d1('0xa')]=_0x86b81[_0x52d1('0xa')];this[_0x52d1('0xb')]=_0x86b81[_0x52d1('0xb')]||0x1e;this[_0x52d1('0xc')]=_0x86b81[_0x52d1('0xc')];this['dialCongestionRetryFrequency']=_0x86b81[_0x52d1('0xd')];this[_0x52d1('0xe')]=_0x86b81[_0x52d1('0xe')];this[_0x52d1('0xf')]=_0x86b81['dialBusyRetryFrequency'];this[_0x52d1('0x10')]=_0x86b81[_0x52d1('0x10')];this[_0x52d1('0x11')]=_0x86b81[_0x52d1('0x11')];this[_0x52d1('0x12')]=_0x86b81[_0x52d1('0x12')];this[_0x52d1('0x13')]=_0x86b81[_0x52d1('0x13')]||0x3;this[_0x52d1('0x14')]=_0x86b81[_0x52d1('0x14')]||0x96;this['dialDropMaxRetry']=_0x86b81[_0x52d1('0x15')]||0x3;this[_0x52d1('0x16')]=_0x86b81['dialDropRetryFrequency']||0x96;this[_0x52d1('0x17')]=_0x86b81[_0x52d1('0x17')]||0x3;this['dialAbandonedRetryFrequency']=_0x86b81[_0x52d1('0x18')]||0x96;this[_0x52d1('0x19')]=_0x86b81[_0x52d1('0x19')]||0x3;this[_0x52d1('0x1a')]=_0x86b81[_0x52d1('0x1a')]||0x96;this[_0x52d1('0x1b')]=_0x86b81[_0x52d1('0x1b')]||0x3;this[_0x52d1('0x1c')]=_0x86b81[_0x52d1('0x1c')]||0x96;this[_0x52d1('0x1d')]=_0x86b81[_0x52d1('0x1d')]||_0x52d1('0x1e');this[_0x52d1('0x1f')]=_0x86b81[_0x52d1('0x1f')]||undefined;this[_0x52d1('0x20')]=_0x86b81[_0x52d1('0x20')]||undefined;this[_0x52d1('0x21')]=_0x86b81[_0x52d1('0x21')]||undefined;this[_0x52d1('0x22')]=_0x86b81[_0x52d1('0x22')]?_0x86b81['TrunkBackup']:undefined;this[_0x52d1('0x23')]=_0x86b81[_0x52d1('0x23')]?_0x86b81['Trunk']:undefined;this['Interval']=_0x86b81[_0x52d1('0x24')]?_0x86b81[_0x52d1('0x24')]:undefined;this[_0x52d1('0x25')]=_0x86b81['SquareProject']?_0x86b81[_0x52d1('0x25')]:undefined;this[_0x52d1('0x26')]=_0x86b81[_0x52d1('0x25')]?_0x86b81[_0x52d1('0x25')][_0x52d1('0x0')]:undefined;this[_0x52d1('0x27')]=_0x86b81[_0x52d1('0x27')]||![];this['dialAMDInitialSilence']=_0x86b81[_0x52d1('0x28')];this[_0x52d1('0x29')]=_0x86b81['dialAMDGreeting'];this[_0x52d1('0x2a')]=_0x86b81[_0x52d1('0x2a')];this[_0x52d1('0x2b')]=_0x86b81[_0x52d1('0x2b')];this[_0x52d1('0x2c')]=_0x86b81[_0x52d1('0x2c')];this[_0x52d1('0x2d')]=_0x86b81['dialAMDBetweenWordsSilence'];this[_0x52d1('0x2e')]=_0x86b81[_0x52d1('0x2e')];this[_0x52d1('0x2f')]=_0x86b81[_0x52d1('0x2f')];this[_0x52d1('0x30')]=_0x86b81[_0x52d1('0x30')];}module[_0x52d1('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 d08f6fe..3c7c0c6 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 _0xc38e=['holdtime','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','billableseconds'];(function(_0x28a85c,_0x4aaabe){var _0x30aa4b=function(_0x4ed9e5){while(--_0x4ed9e5){_0x28a85c['push'](_0x28a85c['shift']());}};_0x30aa4b(++_0x4aaabe);}(_0xc38e,0x19e));var _0xec38=function(_0x550ff0,_0x22661e){_0x550ff0=_0x550ff0-0x0;var _0x251fc5=_0xc38e[_0x550ff0];return _0x251fc5;};'use strict';function Channel(){this[_0xec38('0x0')]=null;this[_0xec38('0x1')]='';this[_0xec38('0x2')]='';this['calleridnum']=0x0;this[_0xec38('0x3')]='';this[_0xec38('0x4')]=undefined;this[_0xec38('0x5')]=undefined;this[_0xec38('0x6')]=0x0;this['context']='';this[_0xec38('0x7')]=0x0;this[_0xec38('0x8')]=0x0;this[_0xec38('0x9')]=0x0;this[_0xec38('0xa')]=![];this[_0xec38('0xb')]=null;this[_0xec38('0xc')]=null;this['unmanaged']=![];this[_0xec38('0xd')]=![];this[_0xec38('0xe')]='';this[_0xec38('0xf')]='';this[_0xec38('0x10')]=0x0;this[_0xec38('0x11')]=0x0;this[_0xec38('0x12')]=0x0;this[_0xec38('0x13')]=null;this['tag']=null;this[_0xec38('0x14')]=null;this[_0xec38('0x15')]=![];this[_0xec38('0x16')]=null;this[_0xec38('0x17')]=null;this[_0xec38('0x18')]=[];this[_0xec38('0x19')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0xec38('0x1a')]=Channel; \ No newline at end of file +var _0x1c77=['transferType','mohtime','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answered','answertime','abandoned','lastapplication','lastdata','duration','holdtime','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum'];(function(_0x14801a,_0x1c219c){var _0x1c36a8=function(_0x42fc75){while(--_0x42fc75){_0x14801a['push'](_0x14801a['shift']());}};_0x1c36a8(++_0x1c219c);}(_0x1c77,0xed));var _0x71c7=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x1c77[_0x5cc8b9];return _0x58892e;};'use strict';function Channel(){this['starttime']=null;this[_0x71c7('0x0')]='';this[_0x71c7('0x1')]='';this[_0x71c7('0x2')]=0x0;this[_0x71c7('0x3')]='';this[_0x71c7('0x4')]=undefined;this['connectedlinename']=undefined;this[_0x71c7('0x5')]=0x0;this[_0x71c7('0x6')]='';this[_0x71c7('0x7')]=0x0;this[_0x71c7('0x8')]=0x0;this[_0x71c7('0x9')]=0x0;this[_0x71c7('0xa')]=![];this[_0x71c7('0xb')]=null;this['endtime']=null;this['unmanaged']=![];this[_0x71c7('0xc')]=![];this[_0x71c7('0xd')]='';this[_0x71c7('0xe')]='';this[_0x71c7('0xf')]=0x0;this['billableseconds']=0x0;this[_0x71c7('0x10')]=0x0;this['type']=null;this['tag']=null;this[_0x71c7('0x11')]=null;this[_0x71c7('0x12')]=![];this[_0x71c7('0x13')]=null;this[_0x71c7('0x14')]=null;this[_0x71c7('0x15')]=[];this['transfercalleridnum']=undefined;this[_0x71c7('0x16')]=undefined;this[_0x71c7('0x17')]=undefined;this[_0x71c7('0x18')]=0x0;}module[_0x71c7('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index ec4cb27..fe58cb6 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 _0x0986=['name','username','remoteUri','authType','password','consumerKey','token','tokenSecret','serverUrl','Configurations'];(function(_0x41e292,_0x1ec07a){var _0x4c87cf=function(_0x43f55c){while(--_0x43f55c){_0x41e292['push'](_0x41e292['shift']());}};_0x4c87cf(++_0x1ec07a);}(_0x0986,0x6e));var _0x6098=function(_0x37ce8,_0x38e539){_0x37ce8=_0x37ce8-0x0;var _0x4e7cc9=_0x0986[_0x37ce8];return _0x4e7cc9;};'use strict';function DeskAccount(_0x598a7f){this['id']=_0x598a7f['id']||0x0;this[_0x6098('0x0')]=_0x598a7f[_0x6098('0x0')]||'';this[_0x6098('0x1')]=_0x598a7f['username']||'';this['remoteUri']=_0x598a7f[_0x6098('0x2')]||'';this['authType']=_0x598a7f[_0x6098('0x3')]||'';this[_0x6098('0x4')]=_0x598a7f[_0x6098('0x4')]||'';this[_0x6098('0x5')]=_0x598a7f[_0x6098('0x5')]||'';this['consumerSecret']=_0x598a7f['consumerSecret']||'';this[_0x6098('0x6')]=_0x598a7f[_0x6098('0x6')]||'';this[_0x6098('0x7')]=_0x598a7f['tokenSecret']||'';this['type']=_0x598a7f['type']||'';this[_0x6098('0x8')]=_0x598a7f['serverUrl']||'';this[_0x6098('0x9')]=_0x598a7f[_0x6098('0x9')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xc532=['password','consumerKey','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0xc532,0x170));var _0x2c53=function(_0x2c3dc4,_0x4afc63){_0x2c3dc4=_0x2c3dc4-0x0;var _0x492b08=_0xc532[_0x2c3dc4];return _0x492b08;};'use strict';function DeskAccount(_0xf65579){this['id']=_0xf65579['id']||0x0;this[_0x2c53('0x0')]=_0xf65579[_0x2c53('0x0')]||'';this[_0x2c53('0x1')]=_0xf65579[_0x2c53('0x1')]||'';this[_0x2c53('0x2')]=_0xf65579[_0x2c53('0x2')]||'';this[_0x2c53('0x3')]=_0xf65579[_0x2c53('0x3')]||'';this[_0x2c53('0x4')]=_0xf65579[_0x2c53('0x4')]||'';this['consumerKey']=_0xf65579[_0x2c53('0x5')]||'';this['consumerSecret']=_0xf65579['consumerSecret']||'';this[_0x2c53('0x6')]=_0xf65579[_0x2c53('0x6')]||'';this['tokenSecret']=_0xf65579[_0x2c53('0x7')]||'';this[_0x2c53('0x8')]=_0xf65579['type']||'';this[_0x2c53('0x9')]=_0xf65579['serverUrl']||'';this[_0x2c53('0xa')]=_0xf65579[_0x2c53('0xa')]||{};}module[_0x2c53('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 a29b550..c3cdd42 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 _0xe26e=['clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','remoteUri','tenantId'];(function(_0x4e8282,_0x38e31a){var _0x309162=function(_0x61811b){while(--_0x61811b){_0x4e8282['push'](_0x4e8282['shift']());}};_0x309162(++_0x38e31a);}(_0xe26e,0xee));var _0xee26=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xe26e[_0x178e48];return _0x440d7e;};'use strict';function Dynamics365Account(_0x1c2ab6){this['id']=_0x1c2ab6['id']||0x0;this[_0xee26('0x0')]=_0x1c2ab6['name']||'';this[_0xee26('0x1')]=_0x1c2ab6[_0xee26('0x1')]||'';this['password']=_0x1c2ab6['password']||'';this[_0xee26('0x2')]=_0x1c2ab6[_0xee26('0x2')]||'';this[_0xee26('0x3')]=_0x1c2ab6['tenantId']||'';this[_0xee26('0x4')]=_0x1c2ab6[_0xee26('0x4')]||'';this[_0xee26('0x5')]=_0x1c2ab6[_0xee26('0x5')]||{};this[_0xee26('0x6')]=_0x1c2ab6['serverUrl']||'';this[_0xee26('0x7')]=_0x1c2ab6['modernAuthentication']||![];this['Configurations']=_0x1c2ab6[_0xee26('0x8')]||{};this[_0xee26('0x9')]=_0x1c2ab6[_0xee26('0x9')]||{};}module[_0xee26('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x5485=['remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name','username'];(function(_0x3fe27c,_0x540b90){var _0x3b99f5=function(_0x2218b7){while(--_0x2218b7){_0x3fe27c['push'](_0x3fe27c['shift']());}};_0x3b99f5(++_0x540b90);}(_0x5485,0x1a2));var _0x5548=function(_0x5b2d5d,_0x56aee6){_0x5b2d5d=_0x5b2d5d-0x0;var _0x3ab435=_0x5485[_0x5b2d5d];return _0x3ab435;};'use strict';function Dynamics365Account(_0x42bacc){this['id']=_0x42bacc['id']||0x0;this[_0x5548('0x0')]=_0x42bacc['name']||'';this['username']=_0x42bacc[_0x5548('0x1')]||'';this['password']=_0x42bacc['password']||'';this[_0x5548('0x2')]=_0x42bacc['remoteUri']||'';this[_0x5548('0x3')]=_0x42bacc[_0x5548('0x3')]||'';this['clientId']=_0x42bacc[_0x5548('0x4')]||'';this['clientSecret']=_0x42bacc[_0x5548('0x5')]||{};this[_0x5548('0x6')]=_0x42bacc[_0x5548('0x6')]||'';this[_0x5548('0x7')]=_0x42bacc[_0x5548('0x7')]||![];this[_0x5548('0x8')]=_0x42bacc['Configurations']||{};this[_0x5548('0x9')]=_0x42bacc['CloudProvider']||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index fab0d77..16b2824 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 _0x56d9=['minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid'];(function(_0x12292c,_0x363bd2){var _0x5b3777=function(_0x1bc7cc){while(--_0x1bc7cc){_0x12292c['push'](_0x12292c['shift']());}};_0x5b3777(++_0x363bd2);}(_0x56d9,0x79));var _0x956d=function(_0x32292b,_0x4e9525){_0x32292b=_0x32292b-0x0;var _0x1845b4=_0x56d9[_0x32292b];return _0x1845b4;};'use strict';function FaxAccount(_0x9f77c6){this['id']=_0x9f77c6['id']||0x0;this[_0x956d('0x0')]=_0x9f77c6['name']||'';this[_0x956d('0x1')]=_0x9f77c6['description'];this[_0x956d('0x2')]=_0x9f77c6[_0x956d('0x2')];this[_0x956d('0x3')]=_0x9f77c6[_0x956d('0x3')];this[_0x956d('0x4')]=_0x9f77c6[_0x956d('0x4')];this[_0x956d('0x5')]=_0x9f77c6[_0x956d('0x5')]||0x960;this[_0x956d('0x6')]=_0x9f77c6[_0x956d('0x6')]||0x3840;this[_0x956d('0x7')]=_0x9f77c6['modem']||_0x956d('0x8');this['gateway']=_0x9f77c6[_0x956d('0x9')]||'no';this[_0x956d('0xa')]=_0x9f77c6['faxdetect']||'no';this[_0x956d('0xb')]=_0x9f77c6[_0x956d('0xb')]||0x1388;this[_0x956d('0xc')]=_0x9f77c6['tech']||_0x956d('0xd');this[_0x956d('0xe')]=_0x9f77c6[_0x956d('0xe')]?_0x9f77c6[_0x956d('0xe')]:undefined;this[_0x956d('0xf')]=_0x9f77c6[_0x956d('0xf')];this[_0x956d('0x10')]=_0x9f77c6[_0x956d('0x10')];}module[_0x956d('0x11')]=FaxAccount; \ No newline at end of file +var _0x5313=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x5313,0x120));var _0x3531=function(_0x104cff,_0x2359a1){_0x104cff=_0x104cff-0x0;var _0x506266=_0x5313[_0x104cff];return _0x506266;};'use strict';function FaxAccount(_0xd3db36){this['id']=_0xd3db36['id']||0x0;this['name']=_0xd3db36[_0x3531('0x0')]||'';this[_0x3531('0x1')]=_0xd3db36[_0x3531('0x1')];this[_0x3531('0x2')]=_0xd3db36['ecm'];this['headerinfo']=_0xd3db36[_0x3531('0x3')];this['localstationid']=_0xd3db36[_0x3531('0x4')];this['minrate']=_0xd3db36[_0x3531('0x5')]||0x960;this[_0x3531('0x6')]=_0xd3db36[_0x3531('0x6')]||0x3840;this[_0x3531('0x7')]=_0xd3db36[_0x3531('0x7')]||_0x3531('0x8');this['gateway']=_0xd3db36[_0x3531('0x9')]||'no';this[_0x3531('0xa')]=_0xd3db36['faxdetect']||'no';this[_0x3531('0xb')]=_0xd3db36[_0x3531('0xb')]||0x1388;this[_0x3531('0xc')]=_0xd3db36[_0x3531('0xc')]||'SIP';this['Trunk']=_0xd3db36[_0x3531('0xd')]?_0xd3db36[_0x3531('0xd')]:undefined;this[_0x3531('0xe')]=_0xd3db36[_0x3531('0xe')];this['key']=_0xd3db36[_0x3531('0xf')];}module[_0x3531('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 66b19ec..38441fb 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 _0x5f13=['username','apiKey','token','serverUrl','Configurations','name'];(function(_0x4a189f,_0x2118b2){var _0x3f348f=function(_0x126d14){while(--_0x126d14){_0x4a189f['push'](_0x4a189f['shift']());}};_0x3f348f(++_0x2118b2);}(_0x5f13,0x14f));var _0x35f1=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x5f13[_0x139a3c];return _0x2b375b;};'use strict';function FreshdeskAccount(_0x2bedca){this['id']=_0x2bedca['id']||0x0;this['name']=_0x2bedca[_0x35f1('0x0')]||'';this[_0x35f1('0x1')]=_0x2bedca[_0x35f1('0x1')]||'';this[_0x35f1('0x2')]=_0x2bedca[_0x35f1('0x3')]||'';this['remoteUri']=_0x2bedca['remoteUri']||'';this[_0x35f1('0x4')]=_0x2bedca[_0x35f1('0x4')]||'';this['Configurations']=_0x2bedca[_0x35f1('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xbe43=['Configurations','name','username','remoteUri','serverUrl'];(function(_0x298583,_0x348863){var _0x2f5791=function(_0x17212b){while(--_0x17212b){_0x298583['push'](_0x298583['shift']());}};_0x2f5791(++_0x348863);}(_0xbe43,0x169));var _0x3be4=function(_0x121e6f,_0x127465){_0x121e6f=_0x121e6f-0x0;var _0x503dfe=_0xbe43[_0x121e6f];return _0x503dfe;};'use strict';function FreshdeskAccount(_0x40caaa){this['id']=_0x40caaa['id']||0x0;this['name']=_0x40caaa[_0x3be4('0x0')]||'';this[_0x3be4('0x1')]=_0x40caaa['username']||'';this['apiKey']=_0x40caaa['token']||'';this[_0x3be4('0x2')]=_0x40caaa[_0x3be4('0x2')]||'';this[_0x3be4('0x3')]=_0x40caaa[_0x3be4('0x3')]||'';this[_0x3be4('0x4')]=_0x40caaa[_0x3be4('0x4')]||{};}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 ff3bbe3..464c193 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 _0xd9ef=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x41eb93,_0x19c6f1){var _0x4ddf78=function(_0x288fdd){while(--_0x288fdd){_0x41eb93['push'](_0x41eb93['shift']());}};_0x4ddf78(++_0x19c6f1);}(_0xd9ef,0x95));var _0xfd9e=function(_0x64d236,_0x4eb476){_0x64d236=_0x64d236-0x0;var _0xe52ab=_0xd9ef[_0x64d236];return _0xe52ab;};'use strict';function FreshsalesAccount(_0x42ec20){this['id']=_0x42ec20['id']||0x0;this[_0xfd9e('0x0')]=_0x42ec20['name']||'';this[_0xfd9e('0x1')]=_0x42ec20['username']||'';this['apiKey']=_0x42ec20['token']||'';this[_0xfd9e('0x2')]=_0x42ec20[_0xfd9e('0x2')]||'';this[_0xfd9e('0x3')]=_0x42ec20[_0xfd9e('0x3')]||'';this[_0xfd9e('0x4')]=_0x42ec20[_0xfd9e('0x4')]||{};}module[_0xfd9e('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0x6b4e=['remoteUri','serverUrl','Configurations','exports','name','token'];(function(_0x77fc10,_0x5db82b){var _0x562e8d=function(_0x2543d5){while(--_0x2543d5){_0x77fc10['push'](_0x77fc10['shift']());}};_0x562e8d(++_0x5db82b);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x2ad3ce,_0x4ebaa3){_0x2ad3ce=_0x2ad3ce-0x0;var _0x68395d=_0x6b4e[_0x2ad3ce];return _0x68395d;};'use strict';function FreshsalesAccount(_0x400121){this['id']=_0x400121['id']||0x0;this[_0xe6b4('0x0')]=_0x400121['name']||'';this['username']=_0x400121['username']||'';this['apiKey']=_0x400121[_0xe6b4('0x1')]||'';this[_0xe6b4('0x2')]=_0x400121[_0xe6b4('0x2')]||'';this[_0xe6b4('0x3')]=_0x400121[_0xe6b4('0x3')]||'';this[_0xe6b4('0x4')]=_0x400121['Configurations']||{};}module[_0xe6b4('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 809a8b0..1c2e08b 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 _0xecd3=['queue','queuecallerjoinAt','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','originalposition','connectedlinename','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','mohtime','inbound','uniqueid','calleridnum','calleridname'];(function(_0x15ba9f,_0x44773c){var _0x128cba=function(_0x3457e6){while(--_0x3457e6){_0x15ba9f['push'](_0x15ba9f['shift']());}};_0x128cba(++_0x44773c);}(_0xecd3,0xf3));var _0x3ecd=function(_0x1dee8d,_0x50a97d){_0x1dee8d=_0x1dee8d-0x0;var _0x206955=_0xecd3[_0x1dee8d];return _0x206955;};'use strict';function QueueReport(){this['type']=_0x3ecd('0x0');this[_0x3ecd('0x1')]='';this[_0x3ecd('0x2')]='';this[_0x3ecd('0x3')]='';this[_0x3ecd('0x4')]='';this[_0x3ecd('0x5')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this['count']=0x1;this[_0x3ecd('0x6')]=![];this[_0x3ecd('0x7')]=null;this['queuecallercomplete']=![];this[_0x3ecd('0x8')]=null;this[_0x3ecd('0x9')]=![];this['queuecallerexitAt']=null;this[_0x3ecd('0xa')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0x3ecd('0xb')]='';this['accountcode']='';this['context']='';this[_0x3ecd('0xc')]='';this[_0x3ecd('0xd')]='';this[_0x3ecd('0xe')]=0x0;this[_0x3ecd('0xf')]=![];this[_0x3ecd('0x10')]='';this[_0x3ecd('0x11')]='voice';this[_0x3ecd('0x12')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file +var _0xa2a9=['lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinenum','connectedlinename','holdtime','assigned'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xa2a9,0x131));var _0x9a2a=function(_0x2d7625,_0x5ba1bc){_0x2d7625=_0x2d7625-0x0;var _0x46c66a=_0xa2a9[_0x2d7625];return _0x46c66a;};'use strict';function QueueReport(){this[_0x9a2a('0x0')]='inbound';this[_0x9a2a('0x1')]='';this['calleridnum']='';this[_0x9a2a('0x2')]='';this[_0x9a2a('0x3')]='';this[_0x9a2a('0x4')]=null;this[_0x9a2a('0x5')]=null;this[_0x9a2a('0x6')]=0x1;this['count']=0x1;this[_0x9a2a('0x7')]=![];this[_0x9a2a('0x8')]=null;this[_0x9a2a('0x9')]=![];this[_0x9a2a('0xa')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x9a2a('0xb')]=0x1;this[_0x9a2a('0xc')]='';this[_0x9a2a('0xd')]='';this[_0x9a2a('0xe')]='';this['accountcode']='';this['context']='';this['exten']='';this['priority']='';this[_0x9a2a('0xf')]=0x0;this[_0x9a2a('0x10')]=![];this[_0x9a2a('0x11')]='';this[_0x9a2a('0x12')]=_0x9a2a('0x13');this[_0x9a2a('0x14')]=0x0;this[_0x9a2a('0x15')]={};}module[_0x9a2a('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index e215c1a..a31df3d 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 _0x2ef4=['type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x3b7d38,_0x4bb89f){var _0x14f115=function(_0x3d5f55){while(--_0x3d5f55){_0x3b7d38['push'](_0x3b7d38['shift']());}};_0x14f115(++_0x4bb89f);}(_0x2ef4,0x143));var _0x42ef=function(_0x54d581,_0x2b61f3){_0x54d581=_0x54d581-0x0;var _0x344aea=_0x2ef4[_0x54d581];return _0x344aea;};'use strict';function SalesforceAccount(_0x48ee77){this['id']=_0x48ee77['id']||0x0;this['name']=_0x48ee77[_0x42ef('0x0')]||'';this[_0x42ef('0x1')]=_0x48ee77[_0x42ef('0x1')]||'';this[_0x42ef('0x2')]=_0x48ee77['remoteUri']||'';this['password']=_0x48ee77[_0x42ef('0x3')]||'';this['clientId']=_0x48ee77[_0x42ef('0x4')]||'';this[_0x42ef('0x5')]=_0x48ee77[_0x42ef('0x5')]||'';this['securityToken']=_0x48ee77[_0x42ef('0x6')]||'';this[_0x42ef('0x7')]=_0x48ee77[_0x42ef('0x7')]||_0x42ef('0x8');this['serverUrl']=_0x48ee77[_0x42ef('0x9')]||'';this[_0x42ef('0xa')]=_0x48ee77[_0x42ef('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xe814=['password','clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x3b095d,_0xe57d04){var _0x1fecd6=function(_0x2b7df4){while(--_0x2b7df4){_0x3b095d['push'](_0x3b095d['shift']());}};_0x1fecd6(++_0xe57d04);}(_0xe814,0x1b5));var _0x4e81=function(_0x4eaafd,_0x1d584d){_0x4eaafd=_0x4eaafd-0x0;var _0x30a344=_0xe814[_0x4eaafd];return _0x30a344;};'use strict';function SalesforceAccount(_0x542708){this['id']=_0x542708['id']||0x0;this[_0x4e81('0x0')]=_0x542708[_0x4e81('0x0')]||'';this[_0x4e81('0x1')]=_0x542708[_0x4e81('0x1')]||'';this[_0x4e81('0x2')]=_0x542708[_0x4e81('0x2')]||'';this['password']=_0x542708[_0x4e81('0x3')]||'';this['clientId']=_0x542708['clientId']||'';this['clientSecret']=_0x542708[_0x4e81('0x4')]||'';this[_0x4e81('0x5')]=_0x542708[_0x4e81('0x5')]||'';this[_0x4e81('0x6')]=_0x542708[_0x4e81('0x6')]||'integrationTab';this[_0x4e81('0x7')]=_0x542708[_0x4e81('0x7')]||'';this[_0x4e81('0x8')]=_0x542708[_0x4e81('0x8')]||{};}module[_0x4e81('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index fff3eb5..9fad347 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 _0xc550=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x480f4a,_0x2ea3f8){var _0xdccb7d=function(_0x151258){while(--_0x151258){_0x480f4a['push'](_0x480f4a['shift']());}};_0xdccb7d(++_0x2ea3f8);}(_0xc550,0x10a));var _0x0c55=function(_0x164c6e,_0x25abdb){_0x164c6e=_0x164c6e-0x0;var _0xe3731a=_0xc550[_0x164c6e];return _0xe3731a;};'use strict';function ServicenowAccount(_0x568529){this['id']=_0x568529['id']||0x0;this[_0x0c55('0x0')]=_0x568529['name']||'';this[_0x0c55('0x1')]=_0x568529[_0x0c55('0x1')]||'';this['password']=_0x568529[_0x0c55('0x2')]||'';this[_0x0c55('0x3')]=_0x568529['remoteUri']||'';this['serverUrl']=_0x568529[_0x0c55('0x4')]||'';this[_0x0c55('0x5')]=_0x568529[_0x0c55('0x5')]||{};}module[_0x0c55('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x6b07=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x20cea6,_0x3a0611){var _0x29f2ae=function(_0x204b68){while(--_0x204b68){_0x20cea6['push'](_0x20cea6['shift']());}};_0x29f2ae(++_0x3a0611);}(_0x6b07,0x17a));var _0x76b0=function(_0x4df39d,_0x23d9c0){_0x4df39d=_0x4df39d-0x0;var _0x40ccf3=_0x6b07[_0x4df39d];return _0x40ccf3;};'use strict';function ServicenowAccount(_0x55c5dd){this['id']=_0x55c5dd['id']||0x0;this[_0x76b0('0x0')]=_0x55c5dd[_0x76b0('0x0')]||'';this[_0x76b0('0x1')]=_0x55c5dd['username']||'';this['password']=_0x55c5dd[_0x76b0('0x2')]||'';this[_0x76b0('0x3')]=_0x55c5dd[_0x76b0('0x3')]||'';this[_0x76b0('0x4')]=_0x55c5dd[_0x76b0('0x4')]||'';this[_0x76b0('0x5')]=_0x55c5dd[_0x76b0('0x5')]||{};}module[_0x76b0('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 8161ddf..3d1fc5f 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 _0x8d14=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x10f7f7,_0x457207){var _0x4ca615=function(_0x3db9aa){while(--_0x3db9aa){_0x10f7f7['push'](_0x10f7f7['shift']());}};_0x4ca615(++_0x457207);}(_0x8d14,0x1dd));var _0x48d1=function(_0x32b1cc,_0x11fe43){_0x32b1cc=_0x32b1cc-0x0;var _0x229a63=_0x8d14[_0x32b1cc];return _0x229a63;};'use strict';function SugarcrmAccount(_0x3a96d4){this['id']=_0x3a96d4['id']||0x0;this[_0x48d1('0x0')]=_0x3a96d4[_0x48d1('0x0')]||'';this[_0x48d1('0x1')]=_0x3a96d4['username']||'';this['password']=_0x3a96d4[_0x48d1('0x2')]||'';this[_0x48d1('0x3')]=_0x3a96d4[_0x48d1('0x3')]||'';this[_0x48d1('0x4')]=_0x3a96d4[_0x48d1('0x4')]||'';this[_0x48d1('0x5')]=_0x3a96d4[_0x48d1('0x5')]||{};}module[_0x48d1('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xde84=['exports','name','username','password','serverUrl','Configurations'];(function(_0x2e26da,_0x3261c6){var _0x1fa337=function(_0x2c2af4){while(--_0x2c2af4){_0x2e26da['push'](_0x2e26da['shift']());}};_0x1fa337(++_0x3261c6);}(_0xde84,0x127));var _0x4de8=function(_0x1e24d3,_0x48bba4){_0x1e24d3=_0x1e24d3-0x0;var _0x136f73=_0xde84[_0x1e24d3];return _0x136f73;};'use strict';function SugarcrmAccount(_0x30e9c4){this['id']=_0x30e9c4['id']||0x0;this[_0x4de8('0x0')]=_0x30e9c4['name']||'';this[_0x4de8('0x1')]=_0x30e9c4[_0x4de8('0x1')]||'';this[_0x4de8('0x2')]=_0x30e9c4[_0x4de8('0x2')]||'';this['remoteUri']=_0x30e9c4['remoteUri']||'';this[_0x4de8('0x3')]=_0x30e9c4['serverUrl']||'';this['Configurations']=_0x30e9c4[_0x4de8('0x4')]||{};}module[_0x4de8('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 413ac41..8e8d19f 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 _0xa9bf=['exports','name','accountcode','state','unknown'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xa9bf,0x8d));var _0xfa9b=function(_0x416ca3,_0x22ed17){_0x416ca3=_0x416ca3-0x0;var _0x894f17=_0xa9bf[_0x416ca3];return _0x894f17;};'use strict';function Telephone(_0x1aa073){this['id']=_0x1aa073['id']||0x0;this['name']=_0x1aa073[_0xfa9b('0x0')]||'';this[_0xfa9b('0x1')]=_0x1aa073[_0xfa9b('0x1')]||'';this[_0xfa9b('0x2')]=_0xfa9b('0x3');this['stateTime']=0x0;this['status']=_0xfa9b('0x3');this['address']='';}module[_0xfa9b('0x4')]=Telephone; \ No newline at end of file +var _0x7d98=['stateTime','status','address','name','accountcode','state'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d98,0xe7));var _0x87d9=function(_0x15942a,_0x13b58c){_0x15942a=_0x15942a-0x0;var _0x36a9fb=_0x7d98[_0x15942a];return _0x36a9fb;};'use strict';function Telephone(_0x20137c){this['id']=_0x20137c['id']||0x0;this['name']=_0x20137c[_0x87d9('0x0')]||'';this[_0x87d9('0x1')]=_0x20137c[_0x87d9('0x1')]||'';this[_0x87d9('0x2')]='unknown';this[_0x87d9('0x3')]=0x0;this[_0x87d9('0x4')]='unknown';this[_0x87d9('0x5')]='';}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 1b30b9c..edaf3f0 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x5560a4,_0x23f2eb){var _0x173dc9=function(_0x5d8fd3){while(--_0x5d8fd3){_0x5560a4['push'](_0x5560a4['shift']());}};_0x173dc9(++_0x23f2eb);}(_0xb10b,0x12a));var _0xbb10=function(_0x5cd65a,_0x301f8f){_0x5cd65a=_0x5cd65a-0x0;var _0x1606f8=_0xb10b[_0x5cd65a];return _0x1606f8;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x56b0ed,_0xd471b2){var _0x1f08fb=function(_0x345e49){while(--_0x345e49){_0x56b0ed['push'](_0x56b0ed['shift']());}};_0x1f08fb(++_0xd471b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 55aa1a2..0f8f22a 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 _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file +var _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x152fe3,_0x12b0c8){_0x152fe3=_0x152fe3-0x0;var _0xc5bb39=_0x0b0e[_0x152fe3];return _0xc5bb39;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 5b1b21f..b0cd944 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 _0x8b05=['split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','registry','indexOf'];(function(_0x17e13d,_0x3dcc2b){var _0x3465dd=function(_0x4eb02c){while(--_0x4eb02c){_0x17e13d['push'](_0x17e13d['shift']());}};_0x3465dd(++_0x3dcc2b);}(_0x8b05,0x107));var _0x58b0=function(_0x18f256,_0x4a867e){_0x18f256=_0x18f256-0x0;var _0x2041a6=_0x8b05[_0x18f256];return _0x2041a6;};'use strict';function Trunk(_0x5c2636){this['id']=_0x5c2636['id']||0x0;this['active']=_0x5c2636[_0x58b0('0x0')]||![];this[_0x58b0('0x1')]=_0x5c2636[_0x58b0('0x1')]||'';this[_0x58b0('0x2')]=_0x58b0('0x3');this[_0x58b0('0x4')]=0x0;this['status']=_0x58b0('0x3');this[_0x58b0('0x5')]=_0x5c2636[_0x58b0('0x5')]&&_0x5c2636['registry'][_0x58b0('0x6')](':')?_0x5c2636['registry'][_0x58b0('0x7')](':')[0x0]:'';this[_0x58b0('0x8')]='';this[_0x58b0('0x9')]='';this[_0x58b0('0xa')]='';this[_0x58b0('0xb')]='';this[_0x58b0('0xc')]='';this[_0x58b0('0xd')]=_0x58b0('0x3');this[_0x58b0('0xe')]='';this[_0x58b0('0xf')]='';this[_0x58b0('0x10')]=_0x5c2636['defaultuser']||'';}module[_0x58b0('0x11')]=Trunk; \ No newline at end of file +var _0x5b47=['indexOf','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','status','registry'];(function(_0x553399,_0x4443eb){var _0x35bc61=function(_0x1c46e4){while(--_0x1c46e4){_0x553399['push'](_0x553399['shift']());}};_0x35bc61(++_0x4443eb);}(_0x5b47,0x17a));var _0x75b4=function(_0x1ad0ee,_0x34ea2f){_0x1ad0ee=_0x1ad0ee-0x0;var _0x5419f1=_0x5b47[_0x1ad0ee];return _0x5419f1;};'use strict';function Trunk(_0x2a57aa){this['id']=_0x2a57aa['id']||0x0;this[_0x75b4('0x0')]=_0x2a57aa[_0x75b4('0x0')]||![];this[_0x75b4('0x1')]=_0x2a57aa[_0x75b4('0x1')]||'';this[_0x75b4('0x2')]=_0x75b4('0x3');this['stateTime']=0x0;this[_0x75b4('0x4')]=_0x75b4('0x3');this[_0x75b4('0x5')]=_0x2a57aa['registry']&&_0x2a57aa['registry'][_0x75b4('0x6')](':')?_0x2a57aa['registry']['split'](':')[0x0]:'';this['host']='';this[_0x75b4('0x7')]='';this[_0x75b4('0x8')]='';this[_0x75b4('0x9')]='';this[_0x75b4('0xa')]='';this[_0x75b4('0xb')]=_0x75b4('0x3');this[_0x75b4('0xc')]='';this[_0x75b4('0xd')]='';this[_0x75b4('0xe')]=_0x2a57aa[_0x75b4('0xe')]||'';}module[_0x75b4('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 27d2653..9b58cba 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 _0xb793=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x9908e1,_0x4ef18e){var _0xedff05=function(_0x665935){while(--_0x665935){_0x9908e1['push'](_0x9908e1['shift']());}};_0xedff05(++_0x4ef18e);}(_0xb793,0xf6));var _0x3b79=function(_0x2bb1db,_0x3923de){_0x2bb1db=_0x2bb1db-0x0;var _0xe883e6=_0xb793[_0x2bb1db];return _0xe883e6;};'use strict';function voiceExtension(_0x359e4e){this['id']=_0x359e4e['id']||0x0;this[_0x3b79('0x0')]=_0x359e4e[_0x3b79('0x0')]||'';this[_0x3b79('0x1')]=_0x359e4e[_0x3b79('0x1')]||_0x3b79('0x2');this[_0x3b79('0x3')]=_0x359e4e['mandatoryDisposition']||![];}module[_0x3b79('0x4')]=voiceExtension; \ No newline at end of file +var _0xe1c2=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x163cd0,_0x461c03){var _0x166213=function(_0x450910){while(--_0x450910){_0x163cd0['push'](_0x163cd0['shift']());}};_0x166213(++_0x461c03);}(_0xe1c2,0xb6));var _0x2e1c=function(_0x2a6e4c,_0xa8cd1e){_0x2a6e4c=_0x2a6e4c-0x0;var _0x3a905e=_0xe1c2[_0x2a6e4c];return _0x3a905e;};'use strict';function voiceExtension(_0x582c6f){this['id']=_0x582c6f['id']||0x0;this[_0x2e1c('0x0')]=_0x582c6f[_0x2e1c('0x0')]||'';this[_0x2e1c('0x1')]=_0x582c6f['recordingFormat']||_0x2e1c('0x2');this[_0x2e1c('0x3')]=_0x582c6f[_0x2e1c('0x3')]||![];}module[_0x2e1c('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 63e5799..c895504 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 _0x151f=['dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','onhold','wav49','roundrobin','name','monitor_format','type','inbound','talking','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry'];(function(_0x235500,_0x37296d){var _0x2eaa32=function(_0x518bd3){while(--_0x518bd3){_0x235500['push'](_0x235500['shift']());}};_0x2eaa32(++_0x37296d);}(_0x151f,0xa9));var _0xf151=function(_0x64edaf,_0x6c4be6){_0x64edaf=_0x64edaf-0x0;var _0x147b1f=_0x151f[_0x64edaf];return _0x147b1f;};'use strict';var statusDesc=[_0xf151('0x0'),_0xf151('0x1'),_0xf151('0x2'),_0xf151('0x3'),_0xf151('0x4'),_0xf151('0x5'),'ringing','ringinuse',_0xf151('0x6')];var monitorFormat={'wav':'wav','wav49':_0xf151('0x7'),'gsm':'gsm'};var strategy={'rrmemory':'rrmemory','roundrobin':_0xf151('0x8')};function VoiceQueue(_0x2ac572){this['id']=_0x2ac572['id']||0x0;this['name']=_0x2ac572[_0xf151('0x9')]||'';this['monitor_format']=_0x2ac572[_0xf151('0xa')]||'';this[_0xf151('0xb')]=_0x2ac572[_0xf151('0xb')]||_0xf151('0xc');this['waiting']=0x0;this[_0xf151('0xd')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0xf151('0xe')]=0x0;this[_0xf151('0xf')]=0x0;this[_0xf151('0x10')]=0x0;this[_0xf151('0x11')]=0x0;this[_0xf151('0x12')]=0x0;this[_0xf151('0x13')]=0x0;this[_0xf151('0x14')]=0x0;this[_0xf151('0x15')]=_0x2ac572[_0xf151('0x15')]||![];this[_0xf151('0x16')]=_0x2ac572['acwTimeout']||0xa;this['autopause']=_0x2ac572[_0xf151('0x17')]||'no';this[_0xf151('0x18')]=!![];this[_0xf151('0x19')]='';this[_0xf151('0x1a')]=0x0;this[_0xf151('0x1b')]=0x0;this[_0xf151('0x1c')]=_0x2ac572[_0xf151('0x1c')]||null;this[_0xf151('0x1d')]=_0x2ac572[_0xf151('0x1d')]?_0x2ac572[_0xf151('0x1d')]:null;this[_0xf151('0x1e')]=_0x2ac572[_0xf151('0x1e')];this[_0xf151('0x1f')]=_0x2ac572[_0xf151('0x1f')]||'progressive';this[_0xf151('0x20')]=_0x2ac572['dialLimitChannel']||0x0;this[_0xf151('0x21')]=_0x2ac572[_0xf151('0x21')]||0x0;this['dialPowerLevel']=_0x2ac572['dialPowerLevel']||0x1;this[_0xf151('0x22')]=_0x2ac572[_0xf151('0x22')]||_0xf151('0x23');this[_0xf151('0x24')]=_0x2ac572[_0xf151('0x24')]||0.03;this[_0xf151('0x25')]=_0x2ac572[_0xf151('0x25')]||0x258;this[_0xf151('0x26')]=_0x2ac572['dialOriginateCallerIdName']||_0xf151('0x27');this['dialOriginateCallerIdNumber']=_0x2ac572['dialOriginateCallerIdNumber']||'anonymous';this['dialOriginateTimeout']=_0x2ac572[_0xf151('0x28')]||0x1e;this[_0xf151('0x29')]=_0x2ac572[_0xf151('0x29')]||'tTxX';this[_0xf151('0x2a')]=_0x2ac572[_0xf151('0x2a')]||0x3;this[_0xf151('0x2b')]=_0x2ac572['dialQueueProject']||undefined;this[_0xf151('0x2c')]=_0x2ac572[_0xf151('0x2c')]||0x3;this[_0xf151('0x2d')]=_0x2ac572[_0xf151('0x2d')]||0x96;this[_0xf151('0x2e')]=_0x2ac572[_0xf151('0x2e')]||0x3;this[_0xf151('0x2f')]=_0x2ac572['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x2ac572['dialNoAnswerMaxRetry']||0x3;this[_0xf151('0x30')]=_0x2ac572[_0xf151('0x30')]||0x96;this[_0xf151('0x31')]=_0x2ac572[_0xf151('0x31')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x2ac572[_0xf151('0x32')]||0x96;this['dialDropMaxRetry']=_0x2ac572['dialDropMaxRetry']||0x3;this[_0xf151('0x33')]=_0x2ac572['dialDropRetryFrequency']||0x96;this[_0xf151('0x34')]=_0x2ac572[_0xf151('0x34')]||0x3;this[_0xf151('0x35')]=_0x2ac572[_0xf151('0x35')]||0x96;this[_0xf151('0x36')]=_0x2ac572[_0xf151('0x36')]||0x3;this[_0xf151('0x37')]=_0x2ac572[_0xf151('0x37')]||0x96;this[_0xf151('0x38')]=_0x2ac572['dialAgentRejectMaxRetry']||0x3;this[_0xf151('0x39')]=_0x2ac572[_0xf151('0x39')]||0x96;this[_0xf151('0x3a')]=_0x2ac572[_0xf151('0x3a')]||0x3;this['dialGlobalMaxRetry']=_0x2ac572['dialGlobalMaxRetry']||0x4;this[_0xf151('0x3b')]=_0x2ac572[_0xf151('0x3b')]?_0x2ac572[_0xf151('0x3b')]:undefined;this[_0xf151('0x3c')]=_0x2ac572[_0xf151('0x3c')]?_0x2ac572[_0xf151('0x3c')]:undefined;this['dialPrefix']=_0x2ac572['dialPrefix']||undefined;this[_0xf151('0x3d')]=_0x2ac572[_0xf151('0x3d')]?_0x2ac572['Interval']:undefined;this[_0xf151('0x3e')]=_0x2ac572[_0xf151('0x3e')]||'DESC';this[_0xf151('0x3f')]=_0x2ac572[_0xf151('0x3f')]||undefined;this['dialCutDigit']=_0x2ac572[_0xf151('0x40')]||undefined;this['strategy']=strategy[_0x2ac572[_0xf151('0x41')]]||_0xf151('0x42');this['queueStatusComplete']=!![];this['dialAMDActive']=_0x2ac572[_0xf151('0x43')]||![];this[_0xf151('0x44')]=_0x2ac572[_0xf151('0x44')];this[_0xf151('0x45')]=_0x2ac572[_0xf151('0x45')];this['dialAMDAfterGreetingSilence']=_0x2ac572[_0xf151('0x46')];this[_0xf151('0x47')]=_0x2ac572['dialAMDTotalAnalysisTime'];this[_0xf151('0x48')]=_0x2ac572[_0xf151('0x48')];this[_0xf151('0x49')]=_0x2ac572[_0xf151('0x49')];this[_0xf151('0x4a')]=_0x2ac572[_0xf151('0x4a')];this[_0xf151('0x4b')]=_0x2ac572[_0xf151('0x4b')];this[_0xf151('0x4c')]=_0x2ac572[_0xf151('0x4c')];this[_0xf151('0x4d')]=0x0;this[_0xf151('0x4e')]=0x0;this[_0xf151('0x4f')]=_0x2ac572[_0xf151('0x4f')];this[_0xf151('0x50')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xf151('0x51')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xf151('0x52')]=0x0;this[_0xf151('0x53')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xf151('0x54')]=0x0;this[_0xf151('0x55')]=0x0;this[_0xf151('0x56')]=0x0;this['startProgressive']=undefined;this[_0xf151('0x57')]=undefined;this[_0xf151('0x58')]=undefined;this[_0xf151('0x59')]=1.05;this[_0xf151('0x5a')]=0x0;this[_0xf151('0x5b')]=0x0;this[_0xf151('0x5c')]=0x0;this[_0xf151('0x5d')]=0x0;this[_0xf151('0x5e')]=0x0;this[_0xf151('0x5f')]=0x0;this[_0xf151('0x60')]=0x0;this[_0xf151('0x61')]=0x0;this[_0xf151('0x62')]=_0x2ac572[_0xf151('0x63')]||0x14;this[_0xf151('0x64')]=_0x2ac572[_0xf151('0x63')]||0xa;this[_0xf151('0x65')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xf151('0x66')]=0x1;this[_0xf151('0x67')]=0x0;this['erlangCallToSecond']=0x0;this[_0xf151('0x68')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x2ac572[_0xf151('0x69')]||0x1e;this['dialRecallInQueue']=_0x2ac572[_0xf151('0x6a')]||![];this[_0xf151('0x6b')]=!!_0x2ac572[_0xf151('0x6b')]||![];this['dialPreviewRecallmeReminder']=!!_0x2ac572['dialPreviewRecallmeReminder']||![];this[_0xf151('0x6c')]=_0x2ac572[_0xf151('0x6c')]||undefined;this['dialAgiAfterHangupClient']=_0x2ac572['dialAgiAfterHangupClient']||![];this[_0xf151('0x6d')]=_0x2ac572[_0xf151('0x6d')]||![];this[_0xf151('0xa')]=monitorFormat[_0x2ac572[_0xf151('0xa')]]?monitorFormat[_0x2ac572[_0xf151('0xa')]]:undefined;this['mandatoryDisposition']=_0x2ac572[_0xf151('0x6e')]||![];this[_0xf151('0x6f')]=_0x2ac572[_0xf151('0x6f')]?_0x2ac572['mandatoryDispositionPause']:undefined;}module[_0xf151('0x70')]=VoiceQueue; \ No newline at end of file +var _0xa3f7=['outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','roundrobin','monitor_format','type','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking'];(function(_0x107b17,_0x3fea7e){var _0xbbd80f=function(_0x2900ab){while(--_0x2900ab){_0x107b17['push'](_0x107b17['shift']());}};_0xbbd80f(++_0x3fea7e);}(_0xa3f7,0x11b));var _0x7a3f=function(_0x559c33,_0x33f5b0){_0x559c33=_0x559c33-0x0;var _0x2d1b3f=_0xa3f7[_0x559c33];return _0x2d1b3f;};'use strict';var statusDesc=[_0x7a3f('0x0'),_0x7a3f('0x1'),_0x7a3f('0x2'),_0x7a3f('0x3'),_0x7a3f('0x4'),_0x7a3f('0x5'),_0x7a3f('0x6'),_0x7a3f('0x7'),_0x7a3f('0x8')];var monitorFormat={'wav':_0x7a3f('0x9'),'wav49':'wav49','gsm':_0x7a3f('0xa')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x7a3f('0xb')};function VoiceQueue(_0x58af7c){this['id']=_0x58af7c['id']||0x0;this['name']=_0x58af7c['name']||'';this['monitor_format']=_0x58af7c[_0x7a3f('0xc')]||'';this[_0x7a3f('0xd')]=_0x58af7c[_0x7a3f('0xd')]||'inbound';this['waiting']=0x0;this[_0x7a3f('0xe')]=0x0;this[_0x7a3f('0xf')]=0x0;this[_0x7a3f('0x10')]=0x0;this[_0x7a3f('0x11')]=0x0;this[_0x7a3f('0x12')]=0x0;this[_0x7a3f('0x13')]=0x0;this[_0x7a3f('0x14')]=0x0;this[_0x7a3f('0x15')]=0x0;this[_0x7a3f('0x16')]=0x0;this[_0x7a3f('0x17')]=0x0;this['acw']=_0x58af7c[_0x7a3f('0x18')]||![];this[_0x7a3f('0x19')]=_0x58af7c[_0x7a3f('0x19')]||0xa;this[_0x7a3f('0x1a')]=_0x58af7c[_0x7a3f('0x1a')]||'no';this[_0x7a3f('0x1b')]=!![];this[_0x7a3f('0x1c')]='';this[_0x7a3f('0x1d')]=0x0;this[_0x7a3f('0x1e')]=0x0;this[_0x7a3f('0x1f')]=_0x58af7c[_0x7a3f('0x1f')]||null;this[_0x7a3f('0x20')]=_0x58af7c[_0x7a3f('0x20')]?_0x58af7c[_0x7a3f('0x20')]:null;this[_0x7a3f('0x21')]=_0x58af7c[_0x7a3f('0x21')];this[_0x7a3f('0x22')]=_0x58af7c[_0x7a3f('0x22')]||'progressive';this['dialLimitChannel']=_0x58af7c[_0x7a3f('0x23')]||0x0;this['dialLimitQueue']=_0x58af7c[_0x7a3f('0x24')]||0x0;this[_0x7a3f('0x25')]=_0x58af7c[_0x7a3f('0x25')]||0x1;this['dialPredictiveOptimization']=_0x58af7c['dialPredictiveOptimization']||_0x7a3f('0x26');this[_0x7a3f('0x27')]=_0x58af7c[_0x7a3f('0x27')]||0.03;this['dialPredictiveInterval']=_0x58af7c[_0x7a3f('0x28')]||0x258;this[_0x7a3f('0x29')]=_0x58af7c[_0x7a3f('0x29')]||_0x7a3f('0x2a');this[_0x7a3f('0x2b')]=_0x58af7c[_0x7a3f('0x2b')]||_0x7a3f('0x2a');this[_0x7a3f('0x2c')]=_0x58af7c['dialOriginateTimeout']||0x1e;this[_0x7a3f('0x2d')]=_0x58af7c['dialQueueOptions']||_0x7a3f('0x2e');this[_0x7a3f('0x2f')]=_0x58af7c[_0x7a3f('0x2f')]||0x3;this[_0x7a3f('0x30')]=_0x58af7c[_0x7a3f('0x30')]||undefined;this['dialCongestionMaxRetry']=_0x58af7c[_0x7a3f('0x31')]||0x3;this[_0x7a3f('0x32')]=_0x58af7c['dialCongestionRetryFrequency']||0x96;this[_0x7a3f('0x33')]=_0x58af7c[_0x7a3f('0x33')]||0x3;this['dialBusyRetryFrequency']=_0x58af7c[_0x7a3f('0x34')]||0x96;this[_0x7a3f('0x35')]=_0x58af7c[_0x7a3f('0x35')]||0x3;this[_0x7a3f('0x36')]=_0x58af7c[_0x7a3f('0x36')]||0x96;this[_0x7a3f('0x37')]=_0x58af7c[_0x7a3f('0x37')]||0x3;this[_0x7a3f('0x38')]=_0x58af7c[_0x7a3f('0x38')]||0x96;this[_0x7a3f('0x39')]=_0x58af7c[_0x7a3f('0x39')]||0x3;this[_0x7a3f('0x3a')]=_0x58af7c[_0x7a3f('0x3a')]||0x96;this[_0x7a3f('0x3b')]=_0x58af7c[_0x7a3f('0x3b')]||0x3;this[_0x7a3f('0x3c')]=_0x58af7c[_0x7a3f('0x3c')]||0x96;this[_0x7a3f('0x3d')]=_0x58af7c[_0x7a3f('0x3d')]||0x3;this['dialMachineRetryFrequency']=_0x58af7c[_0x7a3f('0x3e')]||0x96;this['dialAgentRejectMaxRetry']=_0x58af7c[_0x7a3f('0x3f')]||0x3;this[_0x7a3f('0x40')]=_0x58af7c['dialAgentRejectRetryFrequency']||0x96;this[_0x7a3f('0x41')]=_0x58af7c[_0x7a3f('0x41')]||0x3;this[_0x7a3f('0x42')]=_0x58af7c[_0x7a3f('0x42')]||0x4;this[_0x7a3f('0x43')]=_0x58af7c[_0x7a3f('0x43')]?_0x58af7c[_0x7a3f('0x43')]:undefined;this[_0x7a3f('0x44')]=_0x58af7c['TrunkBackup']?_0x58af7c[_0x7a3f('0x44')]:undefined;this[_0x7a3f('0x45')]=_0x58af7c[_0x7a3f('0x45')]||undefined;this[_0x7a3f('0x46')]=_0x58af7c[_0x7a3f('0x46')]?_0x58af7c[_0x7a3f('0x46')]:undefined;this[_0x7a3f('0x47')]=_0x58af7c['dialOrderByScheduledAt']||_0x7a3f('0x48');this['dialRandomLastDigitCallerIdNumber']=_0x58af7c[_0x7a3f('0x49')]||undefined;this[_0x7a3f('0x4a')]=_0x58af7c[_0x7a3f('0x4a')]||undefined;this['strategy']=strategy[_0x58af7c[_0x7a3f('0x4b')]]||_0x7a3f('0x4c');this[_0x7a3f('0x4d')]=!![];this[_0x7a3f('0x4e')]=_0x58af7c[_0x7a3f('0x4e')]||![];this[_0x7a3f('0x4f')]=_0x58af7c[_0x7a3f('0x4f')];this[_0x7a3f('0x50')]=_0x58af7c[_0x7a3f('0x50')];this[_0x7a3f('0x51')]=_0x58af7c['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x58af7c[_0x7a3f('0x52')];this[_0x7a3f('0x53')]=_0x58af7c['dialAMDMinWordLength'];this[_0x7a3f('0x54')]=_0x58af7c[_0x7a3f('0x54')];this[_0x7a3f('0x55')]=_0x58af7c['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x58af7c[_0x7a3f('0x56')];this['dialAMDMaximumWordLength']=_0x58af7c['dialAMDMaximumWordLength'];this[_0x7a3f('0x57')]=0x0;this[_0x7a3f('0x58')]=0x0;this['timeout']=_0x58af7c['timeout'];this[_0x7a3f('0x59')]=0x0;this[_0x7a3f('0x5a')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x7a3f('0x5b')]=0x0;this[_0x7a3f('0x5c')]=0x0;this[_0x7a3f('0x5d')]=0x0;this[_0x7a3f('0x5e')]=0x0;this[_0x7a3f('0x5f')]=0x0;this[_0x7a3f('0x60')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x7a3f('0x61')]=0x0;this[_0x7a3f('0x62')]=0x0;this[_0x7a3f('0x63')]=undefined;this[_0x7a3f('0x64')]=undefined;this[_0x7a3f('0x65')]=undefined;this[_0x7a3f('0x66')]=1.05;this[_0x7a3f('0x67')]=0x0;this[_0x7a3f('0x68')]=0x0;this[_0x7a3f('0x69')]=0x0;this[_0x7a3f('0x6a')]=0x0;this[_0x7a3f('0x6b')]=0x0;this[_0x7a3f('0x6c')]=0x0;this[_0x7a3f('0x6d')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x58af7c[_0x7a3f('0x6e')]||0x14;this[_0x7a3f('0x6f')]=_0x58af7c[_0x7a3f('0x6e')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x7a3f('0x70')]=0x0;this[_0x7a3f('0x71')]=0x0;this[_0x7a3f('0x72')]=0x0;this[_0x7a3f('0x73')]=0x0;this['dialRecallMeTimeout']=_0x58af7c[_0x7a3f('0x74')]||0x1e;this['dialRecallInQueue']=_0x58af7c['dialRecallInQueue']||![];this['dialPreviewAutoRecallMe']=!!_0x58af7c[_0x7a3f('0x75')]||![];this['dialPreviewRecallmeReminder']=!!_0x58af7c['dialPreviewRecallmeReminder']||![];this[_0x7a3f('0x76')]=_0x58af7c[_0x7a3f('0x76')]||undefined;this[_0x7a3f('0x77')]=_0x58af7c[_0x7a3f('0x77')]||![];this[_0x7a3f('0x78')]=_0x58af7c[_0x7a3f('0x78')]||![];this[_0x7a3f('0xc')]=monitorFormat[_0x58af7c['monitor_format']]?monitorFormat[_0x58af7c['monitor_format']]:undefined;this[_0x7a3f('0x79')]=_0x58af7c[_0x7a3f('0x79')]||![];this['mandatoryDispositionPause']=_0x58af7c[_0x7a3f('0x7a')]?_0x58af7c[_0x7a3f('0x7a')]:undefined;}module[_0x7a3f('0x7b')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index ef9d162..de8f24d 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 _0xa0de=['serverUrl','Configurations','name','username','accessKey','remoteUri'];(function(_0x2d2629,_0x368b00){var _0x29883c=function(_0x3a6799){while(--_0x3a6799){_0x2d2629['push'](_0x2d2629['shift']());}};_0x29883c(++_0x368b00);}(_0xa0de,0xc8));var _0xea0d=function(_0x343975,_0xad5e5b){_0x343975=_0x343975-0x0;var _0x54b991=_0xa0de[_0x343975];return _0x54b991;};'use strict';function VtigerAccount(_0x491889){this['id']=_0x491889['id']||0x0;this['name']=_0x491889[_0xea0d('0x0')]||'';this['username']=_0x491889[_0xea0d('0x1')]||'';this[_0xea0d('0x2')]=_0x491889[_0xea0d('0x2')]||'';this[_0xea0d('0x3')]=_0x491889['remoteUri']||'';this[_0xea0d('0x4')]=_0x491889[_0xea0d('0x4')]||'';this[_0xea0d('0x5')]=_0x491889[_0xea0d('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xa1d0=['serverUrl','Configurations','name','username','accessKey','remoteUri'];(function(_0x26f06b,_0x53095e){var _0x146810=function(_0x218462){while(--_0x218462){_0x26f06b['push'](_0x26f06b['shift']());}};_0x146810(++_0x53095e);}(_0xa1d0,0x110));var _0x0a1d=function(_0x20c69b,_0x22af1c){_0x20c69b=_0x20c69b-0x0;var _0x300e1a=_0xa1d0[_0x20c69b];return _0x300e1a;};'use strict';function VtigerAccount(_0x462cd4){this['id']=_0x462cd4['id']||0x0;this[_0x0a1d('0x0')]=_0x462cd4['name']||'';this[_0x0a1d('0x1')]=_0x462cd4[_0x0a1d('0x1')]||'';this['accessKey']=_0x462cd4[_0x0a1d('0x2')]||'';this[_0x0a1d('0x3')]=_0x462cd4[_0x0a1d('0x3')]||'';this[_0x0a1d('0x4')]=_0x462cd4[_0x0a1d('0x4')]||'';this[_0x0a1d('0x5')]=_0x462cd4[_0x0a1d('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index f0f6931..2e7d6fc 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 _0x1da8=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type'];(function(_0xf2fd54,_0x165b97){var _0x2b224b=function(_0x4804da){while(--_0x4804da){_0xf2fd54['push'](_0xf2fd54['shift']());}};_0x2b224b(++_0x165b97);}(_0x1da8,0xb7));var _0x81da=function(_0x8d9f01,_0x58a312){_0x8d9f01=_0x8d9f01-0x0;var _0x222a55=_0x1da8[_0x8d9f01];return _0x222a55;};'use strict';function ZendeskAccount(_0x5cecda){this['id']=_0x5cecda['id']||0x0;this[_0x81da('0x0')]=_0x5cecda['name']||'';this[_0x81da('0x1')]=_0x5cecda[_0x81da('0x1')]||'';this[_0x81da('0x2')]=_0x5cecda[_0x81da('0x2')]||'';this['token']=_0x5cecda[_0x81da('0x3')]||'';this[_0x81da('0x4')]=_0x5cecda[_0x81da('0x4')]||'';this['authType']=_0x5cecda[_0x81da('0x5')]||'';this[_0x81da('0x6')]=_0x5cecda[_0x81da('0x6')]||'integrationTab';this[_0x81da('0x7')]=_0x5cecda[_0x81da('0x7')]||'';this[_0x81da('0x8')]=_0x5cecda['Configurations']||{};}module[_0x81da('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x5a17=['username','password','token','remoteUri','authType','type','serverUrl','Configurations','exports','name'];(function(_0x2af276,_0xb15ec5){var _0x4c586e=function(_0x681843){while(--_0x681843){_0x2af276['push'](_0x2af276['shift']());}};_0x4c586e(++_0xb15ec5);}(_0x5a17,0x171));var _0x75a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a17[_0x3dd15e];return _0x231fd0;};'use strict';function ZendeskAccount(_0x5493e9){this['id']=_0x5493e9['id']||0x0;this[_0x75a1('0x0')]=_0x5493e9[_0x75a1('0x0')]||'';this[_0x75a1('0x1')]=_0x5493e9[_0x75a1('0x1')]||'';this[_0x75a1('0x2')]=_0x5493e9[_0x75a1('0x2')]||'';this['token']=_0x5493e9[_0x75a1('0x3')]||'';this['remoteUri']=_0x5493e9[_0x75a1('0x4')]||'';this[_0x75a1('0x5')]=_0x5493e9['authType']||'';this[_0x75a1('0x6')]=_0x5493e9[_0x75a1('0x6')]||'integrationTab';this[_0x75a1('0x7')]=_0x5493e9[_0x75a1('0x7')]||'';this[_0x75a1('0x8')]=_0x5493e9[_0x75a1('0x8')]||{};}module[_0x75a1('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 b53329d..6dd18a5 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 _0xb83e=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x75dd2d,_0x3d48ba){var _0x3f53e5=function(_0x4ed171){while(--_0x4ed171){_0x75dd2d['push'](_0x75dd2d['shift']());}};_0x3f53e5(++_0x3d48ba);}(_0xb83e,0xb8));var _0xeb83=function(_0x302ab9,_0xe05019){_0x302ab9=_0x302ab9-0x0;var _0x2ef63a=_0xb83e[_0x302ab9];return _0x2ef63a;};'use strict';function ZohoAccount(_0x294079){this['id']=_0x294079['id']||0x0;this['name']=_0x294079[_0xeb83('0x0')]||'';this[_0xeb83('0x1')]=_0x294079[_0xeb83('0x1')]||'';this['host']=_0x294079[_0xeb83('0x2')]||'';this[_0xeb83('0x3')]=_0x294079[_0xeb83('0x3')]||'';this[_0xeb83('0x4')]=_0x294079[_0xeb83('0x4')]||'';this[_0xeb83('0x5')]=_0x294079['clientSecret']||'';this[_0xeb83('0x6')]=_0x294079[_0xeb83('0x6')]||'';this[_0xeb83('0x7')]=_0x294079[_0xeb83('0x7')]||'';this[_0xeb83('0x8')]=_0x294079[_0xeb83('0x8')]||'';this['Configurations']=_0x294079[_0xeb83('0x9')]||{};}module[_0xeb83('0xa')]=ZohoAccount; \ No newline at end of file +var _0xdc47=['clientId','clientSecret','serverUrl','code','refreshToken','exports','name','description','host'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc47,0xcc));var _0x7dc4=function(_0x164760,_0x5874b0){_0x164760=_0x164760-0x0;var _0x8b91b2=_0xdc47[_0x164760];return _0x8b91b2;};'use strict';function ZohoAccount(_0x6da41){this['id']=_0x6da41['id']||0x0;this['name']=_0x6da41[_0x7dc4('0x0')]||'';this[_0x7dc4('0x1')]=_0x6da41[_0x7dc4('0x1')]||'';this['host']=_0x6da41[_0x7dc4('0x2')]||'';this['zone']=_0x6da41['zone']||'';this[_0x7dc4('0x3')]=_0x6da41['clientId']||'';this[_0x7dc4('0x4')]=_0x6da41[_0x7dc4('0x4')]||'';this['serverUrl']=_0x6da41[_0x7dc4('0x5')]||'';this[_0x7dc4('0x6')]=_0x6da41[_0x7dc4('0x6')]||'';this[_0x7dc4('0x7')]=_0x6da41[_0x7dc4('0x7')]||'';this['Configurations']=_0x6da41['Configurations']||{};}module[_0x7dc4('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 fa05d26..be91c39 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 _0x6a95=['format','number','util','lodash','moment','isNil','string','queue','name','type','campaigntype','dialAnswer','membername','Agent','SIP/%s','calleridname','Contact','phone','firstName','lastName','calleridnum','scheduledat','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6a95,0x1db));var _0x56a9=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x6a95[_0x373dee];return _0x46798f;};'use strict';var util=require(_0x56a9('0x0'));var _=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));function checkNameSurname(_0xce37aa,_0x36f87a,_0x26e006){var _0x235917='';if(!_['isNil'](_0x36f87a)&&'string'===typeof _0x36f87a){_0x235917+=_0x36f87a;}if(!_[_0x56a9('0x3')](_0x26e006)&&_0x56a9('0x4')===typeof _0x26e006){_0x235917+='\x20'+_0x26e006;}if(_0x235917!==''){return _0x235917;}return _0xce37aa;}function Action(_0x1b42ac,_0x2eb132,_0x3c15b6,_0x365093,_0xd8aa7c){this['uniqueid']=_0x3c15b6||undefined;this['idContact']=_0x1b42ac['id'];this[_0x56a9('0x5')]=_0x2eb132[_0x56a9('0x6')];this['type']=_0x2eb132[_0x56a9('0x7')];this[_0x56a9('0x8')]=_0x56a9('0x5');this[_0x56a9('0x9')]=![];this[_0x56a9('0xa')]=_[_0x56a9('0x3')](_0x1b42ac[_0x56a9('0xb')])?undefined:_0x1b42ac[_0x56a9('0xb')][_0x56a9('0x6')];this['channelAgent']=this[_0x56a9('0xa')]?util['format'](_0x56a9('0xc'),this[_0x56a9('0xa')]):_0x365093||undefined;this[_0x56a9('0xd')]=checkNameSurname(_0x1b42ac[_0x56a9('0xe')][_0x56a9('0xf')],_0x1b42ac[_0x56a9('0xe')][_0x56a9('0x10')],_0x1b42ac[_0x56a9('0xe')][_0x56a9('0x11')]);this['active']=_0x1b42ac['active']||![];this[_0x56a9('0x12')]=_0x1b42ac[_0x56a9('0xf')];this[_0x56a9('0x13')]=_0x1b42ac[_0x56a9('0x13')];this['countbusyretry']=_0x1b42ac[_0x56a9('0x14')]||0x0;this['countcongestionretry']=_0x1b42ac['countcongestionretry']||0x0;this['countnoanswerretry']=_0x1b42ac[_0x56a9('0x15')]||0x0;this[_0x56a9('0x16')]=(_0x1b42ac[_0x56a9('0x14')]||0x0)+(_0x1b42ac[_0x56a9('0x17')]||0x0)+(_0x1b42ac[_0x56a9('0x15')]||0x0)+(_0x1b42ac[_0x56a9('0x18')]||0x0)+(_0x1b42ac[_0x56a9('0x19')]||0x0)+(_0x1b42ac[_0x56a9('0x1a')]||0x0)+(_0x1b42ac[_0x56a9('0x1b')]||0x0)+(_0x1b42ac[_0x56a9('0x1c')]||0x0);this[_0x56a9('0x18')]=_0x1b42ac[_0x56a9('0x18')]||0x0;this['countdropretry']=_0x1b42ac['countdropretry']||0x0;this[_0x56a9('0x1a')]=_0x1b42ac[_0x56a9('0x1a')]||0x0;this[_0x56a9('0x1b')]=_0x1b42ac[_0x56a9('0x1b')]||0x0;this['countagentrejectretry']=_0x1b42ac[_0x56a9('0x1c')]||0x0;this[_0x56a9('0x1d')]=_0x1b42ac[_0x56a9('0x1d')];this[_0x56a9('0x1e')]=_0x1b42ac['callbackuniqueid'];this[_0x56a9('0x1f')]=_0x1b42ac[_0x56a9('0x1f')];this[_0x56a9('0x20')]=_0x1b42ac[_0x56a9('0x20')];this[_0x56a9('0x21')]=_0x1b42ac['ContactId'];this[_0x56a9('0x22')]=_0x1b42ac[_0x56a9('0x22')];this[_0x56a9('0x23')]=_['isNil'](_0x1b42ac[_0x56a9('0xb')])?_0x1b42ac['UserId']:_0x1b42ac[_0x56a9('0xb')]['id'];this[_0x56a9('0x24')]=_0x1b42ac[_0x56a9('0x24')];this[_0x56a9('0x25')]='';this[_0x56a9('0x26')]='';}Action[_0x56a9('0x27')][_0x56a9('0x28')]=function(){return util[_0x56a9('0x29')]('\x22%s\x22\x20<%s>',this[_0x56a9('0xd')],this[_0x56a9('0x2a')]);};module['exports']=Action; \ No newline at end of file +var _0xa456=['originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','name','channelAgent','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countcongestionretry','countnoanswerretry','countbusyretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','Agent','VoiceQueueId'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xa456,0x142));var _0x6a45=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xa456[_0x2faddb];return _0x273c05;};'use strict';var util=require(_0x6a45('0x0'));var _=require(_0x6a45('0x1'));var moment=require(_0x6a45('0x2'));function checkNameSurname(_0xd5464e,_0x587626,_0x3bfbe6){var _0x206f6b='';if(!_[_0x6a45('0x3')](_0x587626)&&'string'===typeof _0x587626){_0x206f6b+=_0x587626;}if(!_[_0x6a45('0x3')](_0x3bfbe6)&&_0x6a45('0x4')===typeof _0x3bfbe6){_0x206f6b+='\x20'+_0x3bfbe6;}if(_0x206f6b!==''){return _0x206f6b;}return _0xd5464e;}function Action(_0x1e5882,_0x14da6b,_0x4dfbfa,_0x25cf8d,_0x26bfc0){this[_0x6a45('0x5')]=_0x4dfbfa||undefined;this[_0x6a45('0x6')]=_0x1e5882['id'];this[_0x6a45('0x7')]=_0x14da6b['name'];this[_0x6a45('0x8')]=_0x14da6b['type'];this[_0x6a45('0x9')]=_0x6a45('0x7');this[_0x6a45('0xa')]=![];this[_0x6a45('0xb')]=_[_0x6a45('0x3')](_0x1e5882['Agent'])?undefined:_0x1e5882['Agent'][_0x6a45('0xc')];this[_0x6a45('0xd')]=this['membername']?util['format']('SIP/%s',this[_0x6a45('0xb')]):_0x25cf8d||undefined;this[_0x6a45('0xe')]=checkNameSurname(_0x1e5882[_0x6a45('0xf')][_0x6a45('0x10')],_0x1e5882[_0x6a45('0xf')]['firstName'],_0x1e5882['Contact'][_0x6a45('0x11')]);this[_0x6a45('0x12')]=_0x1e5882['active']||![];this[_0x6a45('0x13')]=_0x1e5882[_0x6a45('0x10')];this[_0x6a45('0x14')]=_0x1e5882[_0x6a45('0x14')];this['countbusyretry']=_0x1e5882['countbusyretry']||0x0;this['countcongestionretry']=_0x1e5882[_0x6a45('0x15')]||0x0;this[_0x6a45('0x16')]=_0x1e5882[_0x6a45('0x16')]||0x0;this['countglobal']=(_0x1e5882[_0x6a45('0x17')]||0x0)+(_0x1e5882[_0x6a45('0x15')]||0x0)+(_0x1e5882[_0x6a45('0x16')]||0x0)+(_0x1e5882['countnosuchnumberretry']||0x0)+(_0x1e5882['countdropretry']||0x0)+(_0x1e5882['countabandonedretry']||0x0)+(_0x1e5882[_0x6a45('0x18')]||0x0)+(_0x1e5882[_0x6a45('0x19')]||0x0);this['countnosuchnumberretry']=_0x1e5882[_0x6a45('0x1a')]||0x0;this[_0x6a45('0x1b')]=_0x1e5882['countdropretry']||0x0;this[_0x6a45('0x1c')]=_0x1e5882[_0x6a45('0x1c')]||0x0;this[_0x6a45('0x18')]=_0x1e5882[_0x6a45('0x18')]||0x0;this[_0x6a45('0x19')]=_0x1e5882['countagentrejectretry']||0x0;this['callback']=_0x1e5882[_0x6a45('0x1d')];this[_0x6a45('0x1e')]=_0x1e5882[_0x6a45('0x1e')];this[_0x6a45('0x1f')]=_0x1e5882[_0x6a45('0x1f')];this[_0x6a45('0x20')]=_0x1e5882[_0x6a45('0x20')];this[_0x6a45('0x21')]=_0x1e5882[_0x6a45('0x21')];this[_0x6a45('0x22')]=_0x1e5882[_0x6a45('0x22')];this[_0x6a45('0x23')]=_['isNil'](_0x1e5882[_0x6a45('0x24')])?_0x1e5882['UserId']:_0x1e5882[_0x6a45('0x24')]['id'];this[_0x6a45('0x25')]=_0x1e5882[_0x6a45('0x25')];this[_0x6a45('0x26')]='';this[_0x6a45('0x27')]='';}Action['prototype'][_0x6a45('0x28')]=function(){return util[_0x6a45('0x29')](_0x6a45('0x2a'),this[_0x6a45('0xe')],this[_0x6a45('0x2b')]);};module[_0x6a45('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index b2726ad..d53ec3f 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 _0xa9e0=['outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','hasOwnProperty','dialMethod','booked','clearZombieChannels','type','outbound','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','Action','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','logger2','disableContact','starttime','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','rescheduleContact','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','BUSY','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','additional','countbusyretry','dialBusyMaxRetry','scheduledAt','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','status','SIP/%s','execRun','recallme','validateContact','isValid','phone','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','logLookAgent','clone','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','filterKey','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','md5','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','defaults','socket.io-emitter','redis','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var uuid=require('uuid');var moment=require('moment');var md5=require(_0x0a9e('0x3'));var Redis=require('ioredis');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x7'));var ami=require('../ami');var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require(_0x0a9e('0x9'));var Action=require(_0x0a9e('0xa'));var ut=require('./util/util');config['redis']=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0xc'))(new Redis(config[_0x0a9e('0xd')]));var Sequence=function(){};Sequence[_0x0a9e('0xe')][_0x0a9e('0xf')]=function(_0xfeb75b){this[_0x0a9e('0x10')]=this['tail']?this['tail']['finally'](_0xfeb75b):_0xfeb75b();};function Preview(_0x4cfe67){this[_0x0a9e('0x11')]=new Sequence();this[_0x0a9e('0x12')]=_0x4cfe67[_0x0a9e('0x13')];this[_0x0a9e('0x14')]=_0x4cfe67[_0x0a9e('0x14')];this[_0x0a9e('0x15')]={};this['agents']=_0x4cfe67[_0x0a9e('0x16')];this[_0x0a9e('0x17')]=0x0;ami['on'](_0x0a9e('0x18'),this[_0x0a9e('0x19')][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x1b'),this['syncHangup'][_0x0a9e('0x1a')](this));ami['on']('hanguprequest',this[_0x0a9e('0x1c')]['bind'](this));ami['on'](_0x0a9e('0x1d'),this[_0x0a9e('0x1e')]['bind'](this));ami['on'](_0x0a9e('0x1f'),this['syncNewExten'][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x24'),this[_0x0a9e('0x25')][_0x0a9e('0x1a')](this));this[_0x0a9e('0x26')](this[_0x0a9e('0x12')]);}function emit(_0x4bb1e3,_0x2c3407,_0x155cce){io['to'](_0x4bb1e3)['emit'](_0x2c3407,_0x155cce);}function emitCampaignPreview(_0x20f109){if(_0x20f109['type']==='outbound'){var _0x3a02e1={'id':_0x20f109['id'],'name':_0x20f109[_0x0a9e('0x27')],'strategy':_0x20f109[_0x0a9e('0x28')],'answered':_0x20f109[_0x0a9e('0x29')],'available':_0x20f109['available'],'loggedIn':_0x20f109[_0x0a9e('0x2a')],'pTalking':_0x20f109[_0x0a9e('0x2b')],'sumBillable':_0x20f109[_0x0a9e('0x2c')],'sumDuration':_0x20f109[_0x0a9e('0x2d')],'sumHoldTime':_0x20f109[_0x0a9e('0x2e')]||0x0,'talking':_0x20f109[_0x0a9e('0x2f')],'total':_0x20f109[_0x0a9e('0x30')],'type':_0x20f109['type'],'unmanaged':_0x20f109['unmanaged'],'abandoned':_0x20f109[_0x0a9e('0x31')],'waiting':_0x20f109[_0x0a9e('0x32')],'loggedInDb':_0x20f109[_0x0a9e('0x33')],'dialActive':_0x20f109[_0x0a9e('0x34')],'dialMethod':_0x20f109['dialMethod'],'dialOriginateCallerIdName':_0x20f109[_0x0a9e('0x35')],'dialOriginateCallerIdNumber':_0x20f109['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x20f109[_0x0a9e('0x36')],'dialPrefix':_0x20f109['dialPrefix'],'outboundAnswerAgiCallsDay':_0x20f109[_0x0a9e('0x37')],'outboundAnswerCallsDay':_0x20f109[_0x0a9e('0x38')],'outboundBlacklistCallsDay':_0x20f109[_0x0a9e('0x39')],'outboundBusyCallsDay':_0x20f109[_0x0a9e('0x3a')],'outboundCongestionCallsDay':_0x20f109[_0x0a9e('0x3b')],'outboundDropCallsDayACS':_0x20f109[_0x0a9e('0x3c')],'outboundDropCallsDayCallersExit':_0x20f109[_0x0a9e('0x3d')],'outboundDropCallsDayTimeout':_0x20f109[_0x0a9e('0x3e')],'outboundNoAnswerCallsDay':_0x20f109['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x20f109[_0x0a9e('0x3f')],'outboundOriginateFailureCallsDay':_0x20f109[_0x0a9e('0x40')],'outboundReCallsDay':_0x20f109[_0x0a9e('0x41')],'outboundRejectCallsDay':_0x20f109[_0x0a9e('0x42')],'outboundUnknownCallsDay':_0x20f109['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x20f109[_0x0a9e('0x43')],'predictiveIntervalAnsweredCalls':_0x20f109[_0x0a9e('0x44')],'predictiveIntervalAvgHoldtime':_0x20f109[_0x0a9e('0x45')],'predictiveIntervalAvgTalktime':_0x20f109[_0x0a9e('0x46')],'predictiveIntervalDroppedCallsCallersExit':_0x20f109[_0x0a9e('0x47')],'predictiveIntervalDroppedCallsTimeout':_0x20f109[_0x0a9e('0x48')],'predictiveIntervalErlangCalls':_0x20f109[_0x0a9e('0x49')],'predictiveIntervalErlangCallsDroppedCalls':_0x20f109[_0x0a9e('0x4a')],'predictiveIntervalHitRate':_0x20f109[_0x0a9e('0x4b')],'predictiveIntervalMultiplicativeFactor':_0x20f109['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x20f109[_0x0a9e('0x4c')],'predictiveIntervalAvailable':_0x20f109['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x20f109[_0x0a9e('0x4d')],'message':_0x20f109[_0x0a9e('0x4e')],'originated':_0x20f109[_0x0a9e('0x4f')],'erlangCalls':_0x20f109[_0x0a9e('0x50')],'erlangCallToSecond':_0x20f109[_0x0a9e('0x51')],'erlangAbandonmentRate':_0x20f109['erlangAbandonmentRate'],'erlangBusyFactor':_0x20f109[_0x0a9e('0x52')],'startPredictive':_0x20f109[_0x0a9e('0x53')],'startProgressive':_0x20f109[_0x0a9e('0x54')]};if(_0x20f109[_0x0a9e('0x55')]){_0x3a02e1[_0x0a9e('0x55')]={'id':_0x20f109[_0x0a9e('0x55')]['id'],'name':_0x20f109[_0x0a9e('0x55')][_0x0a9e('0x27')],'active':_0x20f109['Trunk'][_0x0a9e('0x56')],'callerid':_0x20f109['Trunk'][_0x0a9e('0x57')]};}if(_0x20f109[_0x0a9e('0x58')]){_0x3a02e1[_0x0a9e('0x58')]={'id':_0x20f109[_0x0a9e('0x58')]['id'],'name':_0x20f109['Interval'][_0x0a9e('0x27')]};}var _0xd1836d=md5(JSON[_0x0a9e('0x59')](_0x3a02e1));if(_0x20f109[_0x0a9e('0x3')]!==_0xd1836d){_0x20f109['md5']=_0xd1836d;emit(util['format'](_0x0a9e('0x5a'),_0x3a02e1['name']),_0x0a9e('0x5b'),_0x3a02e1);}}}function emitVoiceQueueChannelRemove(_0x3d9717){logger[_0x0a9e('0x5c')](_0x0a9e('0x5d'),JSON['stringify'](_0x3d9717));emit(util[_0x0a9e('0x5e')](_0x0a9e('0x5a'),_0x3d9717[_0x0a9e('0x27')]),'voice_queue_channel:remove',_0x3d9717);io[_0x0a9e('0x5f')](_0x0a9e('0x60'),_0x3d9717);}function notSendMessagesQueue(_0x289467){if(_0x289467['sendMessageOneNotActive']){if(_0x289467['originated']===0x0&&_0x289467[_0x0a9e('0x2b')]===0x0){_0x289467[_0x0a9e('0x61')]=![];_0x289467['available']=0x0;_0x289467[_0x0a9e('0x62')]=0x0;_0x289467[_0x0a9e('0x4e')]=_0x0a9e('0x63');ut[_0x0a9e('0x64')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x289467['name']+_0x0a9e('0x65'));}else{_0x289467[_0x0a9e('0x4e')]='IS_DISACTIVED';ut[_0x0a9e('0x64')](_0x0a9e('0x66'),_0x289467[_0x0a9e('0x27')]+'\x20is\x20disactive');}emitCampaignPreview(_0x289467);}}Preview[_0x0a9e('0xe')][_0x0a9e('0x26')]=function(){var _0x274e8e=this;setInterval(function(){_0x274e8e[_0x0a9e('0x67')]();},0x7cf);};Preview[_0x0a9e('0xe')][_0x0a9e('0x67')]=function(){var _0x2881b3=this[_0x0a9e('0x12')];this[_0x0a9e('0x17')]+=0x1;for(var _0x3da2cd in _0x2881b3){if(_0x2881b3[_0x0a9e('0x68')](_0x3da2cd)&&(_0x2881b3[_0x3da2cd][_0x0a9e('0x69')]===_0x0a9e('0x6')||_0x2881b3[_0x3da2cd][_0x0a9e('0x69')]===_0x0a9e('0x6a'))&&_0x2881b3[_0x3da2cd]['type']==='outbound'){if(this[_0x0a9e('0x17')]>0x7){this[_0x0a9e('0x17')]=0x0;this[_0x0a9e('0x6b')]();}}if(_0x2881b3[_0x0a9e('0x68')](_0x3da2cd)&&_0x2881b3[_0x3da2cd][_0x0a9e('0x69')]===_0x0a9e('0x6')&&_0x2881b3[_0x3da2cd][_0x0a9e('0x6c')]===_0x0a9e('0x6d')){if(_0x2881b3[_0x3da2cd][_0x0a9e('0x34')]){this[_0x0a9e('0x6e')](_0x2881b3[_0x3da2cd]);if(_0x2881b3[_0x3da2cd][_0x0a9e('0x6f')])this[_0x0a9e('0x70')](_0x2881b3[_0x3da2cd]);}else{notSendMessagesQueue(_0x2881b3[_0x3da2cd]);}}}};Preview['prototype'][_0x0a9e('0x71')]=function(_0x138b8b){var _0xdd268f=this;this[_0x0a9e('0x11')][_0x0a9e('0xf')](function(){if(!_[_0x0a9e('0x72')](_0xdd268f[_0x0a9e('0x15')][_0x138b8b])){loggerAction[_0x0a9e('0x5c')]('[clearZombieChannels][talking]',_0x138b8b,_0x0a9e('0x73'),_0xdd268f['actions'][_0x138b8b][_0x0a9e('0x74')],_0x0a9e('0x75'),JSON[_0x0a9e('0x59')](_0xdd268f['campaignsPreview'][_0xdd268f[_0x0a9e('0x15')][_0x138b8b][_0x0a9e('0x74')]][_0x0a9e('0x4f')]),_0x0a9e('0x76'),JSON[_0x0a9e('0x59')](_0xdd268f[_0x0a9e('0x12')][_0xdd268f[_0x0a9e('0x15')][_0x138b8b]['queue']][_0x0a9e('0x2b')]),JSON[_0x0a9e('0x59')](_0xdd268f[_0x0a9e('0x15')][_0x138b8b][_0x0a9e('0x77')]),JSON[_0x0a9e('0x59')](_[_0x0a9e('0x78')](_0xdd268f[_0x0a9e('0x15')][_0x138b8b],[_0x0a9e('0x79'),_0x0a9e('0x7a'),'VoiceQueueId',_0x0a9e('0x7b')])));return ami[_0x0a9e('0x7c')]({'action':'status','channel':_0xdd268f['actions'][_0x138b8b]['channel']})[_0x0a9e('0x7d')](function(_0x4317e3){if(_0x4317e3[_0x0a9e('0x4e')]===_0x0a9e('0x7e')){setTimeout(function(){if(_0xdd268f[_0x0a9e('0x15')][_0x138b8b]){ut[_0x0a9e('0x7f')](_0xdd268f[_0x0a9e('0x12')][_0xdd268f[_0x0a9e('0x15')][_0x138b8b]['queue']],'[clearZombieChannel]');if(_0xdd268f['actions'][_0x138b8b][_0x0a9e('0x77')]===!![]){ut[_0x0a9e('0x80')](_0xdd268f[_0x0a9e('0x12')][_0xdd268f['actions'][_0x138b8b][_0x0a9e('0x74')]],_0x0a9e('0x81'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x138b8b,_0xdd268f[_0x0a9e('0x15')][_0x138b8b]['queue']);}ut[_0x0a9e('0x82')]('[Dialer][checkChannel][Preview]'+_0x138b8b,_0xdd268f[_0x0a9e('0x15')][_0x138b8b][_0x0a9e('0x74')]);delete _0xdd268f[_0x0a9e('0x15')][_0x138b8b];}},0x2328);}});}});};Preview['prototype'][_0x0a9e('0x6b')]=function(){var _0x1bf38a=this;loggerAction['info']('[action]',_[_0x0a9e('0x83')](this[_0x0a9e('0x15')]));for(var _0x49c095 in this[_0x0a9e('0x15')]){if(_0x1bf38a['actions'][_0x0a9e('0x68')](_0x49c095)){_0x1bf38a['clearZombieChannel'](_0x49c095);}}};Preview[_0x0a9e('0xe')]['recallMe']=function(_0x5da27d){var _0x5df0ad=this;rpcDb[_0x0a9e('0x84')](_0x5da27d['id'],ut['agentReadyId'](this[_0x0a9e('0x16')]))[_0x0a9e('0x85')](function(_0x3cfd00){if(!_[_0x0a9e('0x72')](_0x3cfd00)){for(var _0x232830=0x0;_0x232830<_0x3cfd00[_0x0a9e('0x86')];_0x232830+=0x1){if(ut[_0x0a9e('0x87')](_0x3cfd00[_0x232830][_0x0a9e('0x88')])<_0x5da27d['dialRecallMeTimeout']*0x3c){if(_0x3cfd00[_0x232830][_0x0a9e('0x89')]&&!_0x3cfd00[_0x232830][_0x0a9e('0x89')][_0x0a9e('0x8a')]){_0x5df0ad[_0x0a9e('0x8b')](_0x3cfd00[_0x232830]['id'])[_0x0a9e('0x85')](ut[_0x0a9e('0x8c')]('[RecallMe]'))[_0x0a9e('0x7d')](ut[_0x0a9e('0x8c')]('[RecallMe]'));}else{rpcDb[_0x0a9e('0x8d')](_0x3cfd00[_0x232830]['id']);}}else{var _0x5cc8fb=new Action(_0x3cfd00[_0x232830],_0x5da27d);_0x5cc8fb[_0x0a9e('0x8e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5da27d['outboundReCallsDay']+=0x1;ut[_0x0a9e('0x8f')](_0x5cc8fb,0x17,'RecallInQueue');if(_0x5da27d[_0x0a9e('0x90')]){rpcDb[_0x0a9e('0x91')](ut[_0x0a9e('0x92')](_0x3cfd00[_0x232830]));rpcDb[_0x0a9e('0x93')](_0x5cc8fb,_0x0a9e('0x94'));}else{ut[_0x0a9e('0x8f')](_0x5cc8fb,0x16,'RecallFailedTimeout');rpcDb[_0x0a9e('0x93')](_0x5cc8fb,'[HistoryRecallClose]');rpcDb[_0x0a9e('0x95')](_0x5cc8fb,_0x0a9e('0x96'));}}}}})[_0x0a9e('0x7d')](ut['logger2'](_0x0a9e('0x97')));};Preview[_0x0a9e('0xe')][_0x0a9e('0x6e')]=function(_0x32e134){_0x32e134['sendMessageOneNotActive']=!![];if(ut[_0x0a9e('0x98')](_0x32e134[_0x0a9e('0x2a')])){_0x32e134['message']=_0x0a9e('0x99');}else if(!ut[_0x0a9e('0x9a')](_0x32e134[_0x0a9e('0x34')])){_0x32e134[_0x0a9e('0x4e')]=_0x0a9e('0x63');}else if(!this['isTrunkReachable'](_0x32e134[_0x0a9e('0x55')])){if(!this[_0x0a9e('0x9b')](_0x32e134[_0x0a9e('0x9c')])){_0x32e134['message']=_0x0a9e('0x9d');}else{_0x32e134['message']='ACTIVE';}}else{_0x32e134[_0x0a9e('0x4e')]=_0x0a9e('0x9e');}emitCampaignPreview(_0x32e134);};Preview[_0x0a9e('0xe')][_0x0a9e('0x9f')]=function(_0x186f39,_0xc8c264,_0x387489){var _0x54a37d=this;var _0x2d7205=this[_0x0a9e('0x15')][_0xc8c264];var _0x2e89b7=this[_0x0a9e('0x12')][_0x2d7205[_0x0a9e('0x74')]];var _0x2b8192;var _0x320898=![];var _0x412a72=0x2;var _0x2a28c0=0x3;if(_0x2e89b7){switch(_0x387489){case'1':_0x2e89b7[_0x0a9e('0x3f')]+=0x1;_0x2d7205['countnosuchnumberretry']+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x0,'NoSuchNumber');ami[_0x0a9e('0x5f')](_0x0a9e('0xa2'),ut['buildObj'](_0x2d7205,_0x0a9e('0xa3')));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xa4'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'0',_0x2e89b7)[_0x0a9e('0x85')](function(_0x4a43a8){_0x320898=_0x4a43a8['additional']==0x1;_0x412a72=_0x2e89b7['dialNoSuchNumberRetryFrequency'];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xaa'));}else{if(_0x2d7205[_0x0a9e('0xab')]>=_0x2e89b7['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xaa'));}else{rpcDb[_0x0a9e('0xac')](ut['scheduledAt'](_0x2d7205,_0x0a9e('0xab'),_0x2e89b7['dialNoSuchNumberRetryFrequency']),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}delete this['actions'][_0x186f39[_0x0a9e('0xaf')]];}else{_0x2d7205[_0x0a9e('0xab')]++;logger[_0x0a9e('0x5c')](_0x0a9e('0xb0'),_0x2d7205['countnosuchnumberretry']);logger[_0x0a9e('0x5c')]('id',_0x2d7205[_0x0a9e('0xb1')]);_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnosuchnumberretry':_0x2d7205['countnosuchnumberretry']}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xb4'):var _0x4abc8f=moment()[_0x0a9e('0x5e')](_0x0a9e('0xb5'));_0x2d7205[_0x0a9e('0xb6')]=_0x4abc8f;_0x2d7205[_0x0a9e('0xb7')]=_0x4abc8f;_0x2d7205[_0x0a9e('0x77')]=!![];_0x2e89b7[_0x0a9e('0x2b')]+=0x1;logger[_0x0a9e('0x5c')](_0x0a9e('0xb8'),_0x2d7205[_0x0a9e('0xb9')],_0x0a9e('0xba'),_0x2e89b7[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x2e89b7[_0x0a9e('0x2b')]);ami[_0x0a9e('0x5f')]('custom:agentconnect',ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xbc'),this[_0x0a9e('0x12')][_0x2d7205['queue']]));if(_0x2e89b7[_0x0a9e('0xbd')]){ami[_0x0a9e('0x5f')](_0x0a9e('0xbe'),ut[_0x0a9e('0xbf')](_0x2d7205));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xc0'),this['campaignsPreview'][_0x2d7205[_0x0a9e('0x74')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2d7205,_0x0a9e('0xc0')));_0x2e89b7[_0x0a9e('0x38')]+=0x1;_0x2e89b7['total']+=0x1;_0x2e89b7[_0x0a9e('0x29')]+=0x1;ut[_0x0a9e('0x80')](_0x2e89b7,_0x0a9e('0xc1'));_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x4,_0x0a9e('0xc2'));rpcDb['createCustomerHistory'](_0x2d7205,_0x0a9e('0xc3'));rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xc4'));rpcDb[_0x0a9e('0xc5')](_0x2d7205);_0x2e89b7['sumDuration']+=_0x2d7205[_0x0a9e('0xc6')];_0x2e89b7[_0x0a9e('0x2c')]+=_0x2d7205['talktime'];logger[_0x0a9e('0x5c')]('[syncHangup][talking][decrement]',_0x2d7205[_0x0a9e('0xb9')],_0x0a9e('0xba'),_0x2e89b7[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x2e89b7['pTalking']);delete this['actions'][_0x186f39[_0x0a9e('0xaf')]];break;case _0x0a9e('0xc7'):_0x2e89b7[_0x0a9e('0x3a')]+=0x1;_0x2d7205['countbusyretry']+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut['logCustomer'](_0x2d7205,0x5,'Busy');_0x412a72=_0x2e89b7[_0x0a9e('0xc8')];_0x2a28c0=_0x2e89b7['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentbusy',ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xc9')));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xca'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'5',_0x2e89b7)[_0x0a9e('0x85')](function(_0x5a8854){_0x320898=_0x5a8854[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut['totalGlobal'](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x2d7205[_0x0a9e('0xcc')]>=_0x2e89b7[_0x0a9e('0xcd')]){rpcDb[_0x0a9e('0x95')](_0x2d7205,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x0a9e('0xac')](ut[_0x0a9e('0xce')](_0x2d7205,_0x0a9e('0xcc'),_0x2e89b7[_0x0a9e('0xc8')]),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xcc')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205['idContact'],'field':{'countbusyretry':_0x2d7205[_0x0a9e('0xcc')]}})[_0x0a9e('0x85')](function(){_0x54a37d['swapAdditionalPhones'](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xcf'):_0x2e89b7[_0x0a9e('0xd0')]+=0x1;_0x2d7205['countnoanswerretry']+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut['totalGlobal'](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x3,_0x0a9e('0xd1'));_0x412a72=_0x2e89b7[_0x0a9e('0xd2')];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];ami[_0x0a9e('0x5f')](_0x0a9e('0xd3'),ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xd4')));rpcDb['createCustomerHistory'](_0x2d7205,_0x0a9e('0xd5'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'3',_0x2e89b7)[_0x0a9e('0x85')](function(_0x30ef6e){_0x320898=_0x30ef6e[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xd6'));}else{if(_0x2d7205[_0x0a9e('0xd7')]>=_0x2e89b7[_0x0a9e('0xd8')]){rpcDb['createCustomerFinal'](_0x2d7205,_0x0a9e('0xd5'));}else{rpcDb[_0x0a9e('0xac')](ut[_0x0a9e('0xce')](_0x2d7205,_0x0a9e('0xd7'),_0x2e89b7[_0x0a9e('0xd2')]),_0x2d7205['unlockAgent'],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d['incrementPreviewCounters']({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205['countnoanswerretry']}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xd9'):_0x2e89b7['outboundCongestionCallsDay']+=0x1;_0x2d7205[_0x0a9e('0xda')]+=0x1;_0x2d7205['countglobal']=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x8,'Congestion');_0x412a72=_0x2e89b7[_0x0a9e('0xdb')];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];ami[_0x0a9e('0x5f')]('custom:agentcongestion',ut['buildObj'](_0x2d7205,_0x0a9e('0xdc')));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xdd'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'8',_0x2e89b7)[_0x0a9e('0x85')](function(_0x2450a8){_0x320898=_0x2450a8[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut['cloneAction'](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb['createCustomerFinal'](_0x2b8192,_0x0a9e('0xde'));}else{if(_0x2d7205[_0x0a9e('0xda')]>=_0x2e89b7[_0x0a9e('0xdf')]){rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xdd'));}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xce')](_0x2d7205,_0x0a9e('0xda'),_0x2e89b7[_0x0a9e('0xc8')]),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205['countcongestionretry']++;_0x54a37d['incrementPreviewCounters']({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countcongestionretry':_0x2d7205['countcongestionretry']}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xe0'):_0x2e89b7[_0x0a9e('0x42')]+=0x1;_0x2d7205[_0x0a9e('0xe1')]+=0x1;_0x2d7205['countglobal']=ut['totalGlobal'](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x14,'AgentReject');_0x412a72=_0x2e89b7[_0x0a9e('0xe2')];_0x2a28c0=_0x2e89b7['callAdditionalPhoneAfterMin'];ami[_0x0a9e('0x5f')]('custom:agentreject',ut['buildObj'](_0x2d7205,_0x0a9e('0xe3')));rpcDb[_0x0a9e('0x93')](_0x2d7205,'[syncHangupRequest][logAgentReject]');_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'20',_0x2e89b7)[_0x0a9e('0x85')](function(_0x15c6b9){_0x320898=_0x15c6b9[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7['dialGlobalMaxRetry']){_0x2b8192=ut['cloneAction'](_0x2d7205,0x14,_0x0a9e('0xe4'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xe5'));}else{if(_0x2d7205[_0x0a9e('0xe1')]>=_0x2e89b7[_0x0a9e('0xe6')]){rpcDb['createCustomerFinal'](_0x2d7205,_0x0a9e('0xe5'));}else{rpcDb[_0x0a9e('0xac')](ut['scheduledAt'](_0x2d7205,_0x0a9e('0xe1'),_0x2e89b7[_0x0a9e('0xe2')]),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)['then'](function(){});});}});break;case _0x0a9e('0xe7'):_0x2e89b7[_0x0a9e('0x43')]+=0x1;_0x2d7205[_0x0a9e('0xe8')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut['logCustomer'](_0x2d7205,0xb,'Abandoned');rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xe9'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'11',_0x2e89b7)[_0x0a9e('0x85')](function(_0x34f7b5){_0x320898=_0x34f7b5['additional']==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,'Global');rpcDb[_0x0a9e('0x95')](_0x2b8192,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2d7205[_0x0a9e('0xea')]>=_0x2e89b7['dialAbandonedMaxRety']){rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xe9'));}else{rpcDb[_0x0a9e('0xac')](ut['scheduledAt'](_0x2d7205,_0x0a9e('0xe8'),_0x2e89b7['dialAbandonedRetryFrequency']),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case'18':_0x2e89b7[_0x0a9e('0xeb')]+=0x1;_0x2d7205[_0x0a9e('0xec')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x12,_0x186f39[_0x0a9e('0xed')]||_0x186f39[_0x0a9e('0xee')]);ami['emit']('custom:amd',ut[_0x0a9e('0xbb')](_0x2d7205,'amd'));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xef'));_0x54a37d['verifyAdditionalPhones'](_0x2d7205,'18',_0x2e89b7)[_0x0a9e('0x85')](function(_0xe2b083){_0x320898=_0xe2b083[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7['dialGlobalMaxRetry']){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0x12,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xef'));}else{rpcDb['createCustomerFinal'](_0x2d7205,_0x0a9e('0xef'));}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205['idContact'],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)['then'](function(){});});}});delete this[_0x0a9e('0x15')][_0x186f39[_0x0a9e('0xaf')]];break;case'19':_0x2e89b7[_0x0a9e('0xeb')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut['logCustomer'](_0x2d7205,0x13,_0x186f39[_0x0a9e('0xed')]||_0x186f39[_0x0a9e('0xee')]);ami['emit'](_0x0a9e('0xf0'),ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xf1')));rpcDb['createCustomerHistory'](_0x2d7205,'[callProgressDetectingCustomer][machine]');_0x54a37d['verifyAdditionalPhones'](_0x2d7205,'18',_0x2e89b7)[_0x0a9e('0x85')](function(_0x4a70ce){_0x320898=_0x4a70ce['additional']==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,'Global');rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xf2'));}else{rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xf2'));}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d['swapAdditionalPhones'](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});delete this['actions'][_0x186f39[_0x0a9e('0xaf')]];break;default:if(_0x2d7205[_0x0a9e('0x77')]){ut[_0x0a9e('0x80')](_0x2e89b7,_0x0a9e('0xf3'));ut[_0x0a9e('0x82')](_0x0a9e('0xf4')+_0x2e89b7['name'],_0x186f39);}_0x2e89b7[_0x0a9e('0xeb')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0xc,_0x186f39['cause-txt']||_0x186f39[_0x0a9e('0xee')]);_0x412a72=_0x2e89b7[_0x0a9e('0xe2')];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xf5'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'20',_0x2e89b7)[_0x0a9e('0x85')](function(_0x25931e){_0x320898=_0x25931e[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7['dialGlobalMaxRetry']){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xf6'));}else{rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xf6'));}delete this[_0x0a9e('0x15')][_0x186f39[_0x0a9e('0xaf')]];}else{_0x54a37d['swapAdditionalPhones'](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(_0xd2391){});}});}if(!(_0x2d7205[_0x0a9e('0x77')]&&_0x387489==='16')){ut['updateOriginated'](_0x2e89b7,_0x0a9e('0xf7'));logger[_0x0a9e('0x5c')](_0x0a9e('0xf8'),_0x2d7205[_0x0a9e('0xb9')],_0x0a9e('0xba'),_0x2e89b7[_0x0a9e('0x27')],_0x0a9e('0x75'),_0x2e89b7[_0x0a9e('0x4f')]);}if(_0x387489!==_0x0a9e('0xb4')){delete this[_0x0a9e('0x15')][_0x186f39['linkedid']];delete this[_0x0a9e('0x15')][_0x186f39[_0x0a9e('0xf9')]];}}};Preview[_0x0a9e('0xe')][_0x0a9e('0xfa')]=function(_0x2b624e,_0x3942fd,_0x5cb48d){if(_[_0x0a9e('0xfb')](_0x3942fd)&&'object'!==typeof _0x3942fd){return;}if(_['isUndefined'](_0x5cb48d)&&'object'!==typeof _0x5cb48d){return;}switch(_0x5cb48d[_0x0a9e('0xfc')]){case'0':ut[_0x0a9e('0xfd')](_0x2b624e,0x0,_0x0a9e('0xfe'));rpcDb[_0x0a9e('0xff')](_0x2b624e,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x0a9e('0xfd')](_0x2b624e,0x3,_0x0a9e('0xd1'));rpcDb[_0x0a9e('0xff')](_0x2b624e,_0x0a9e('0x100'));break;case'5':ut[_0x0a9e('0xfd')](_0x2b624e,0x5,'Busy');rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x101'));break;case'8':ut[_0x0a9e('0xfd')](_0x2b624e,0x8,_0x0a9e('0x102'));rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x103'));break;case'22':ut[_0x0a9e('0xfd')](_0x2b624e,0x16,_0x0a9e('0x104'));rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x105'));break;default:ut[_0x0a9e('0xfd')](_0x2b624e,0xc,_0x5cb48d[_0x0a9e('0xfc')]);rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x103'));}ut[_0x0a9e('0x7f')](_0x3942fd,_0x0a9e('0x106'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x2b624e['uniqueid'],_0x0a9e('0xba'),_0x3942fd[_0x0a9e('0x27')],_0x0a9e('0x75'),_0x3942fd[_0x0a9e('0x4f')]);delete this['actions'][_0x2b624e[_0x0a9e('0xb9')]];};Preview['prototype'][_0x0a9e('0xa5')]=function(_0x2ff2ab,_0x242f23,_0x57f673){return BPromise[_0x0a9e('0x107')]()[_0x0a9e('0x85')](cmHopperAdditionalPhone[_0x0a9e('0xa5')](_0x2ff2ab,_0x242f23,_0x57f673))['catch'](logger[_0x0a9e('0x5c')]('[verifyAdditionalPhone]\x20'));};Preview[_0x0a9e('0xe')]['swapAdditionalPhones']=function(_0x41b90a,_0x57b7d4,_0xb14971){return BPromise[_0x0a9e('0x107')]()[_0x0a9e('0x85')](cmHopperAdditionalPhone[_0x0a9e('0xb3')](_0x41b90a,_0x57b7d4,_0xb14971))[_0x0a9e('0x7d')](logger[_0x0a9e('0x5c')](_0x0a9e('0x108')));};Preview['prototype'][_0x0a9e('0xb2')]=function(_0x1c9ea2){return BPromise['resolve']()[_0x0a9e('0x85')](cmHopperAdditionalPhone[_0x0a9e('0xb2')](_0x1c9ea2))['catch'](logger[_0x0a9e('0x5c')](_0x0a9e('0x109')));};Preview[_0x0a9e('0xe')]['checkInBlack']=function(_0x3766d7,_0xf49ed4,_0xdeb5e4,_0x3f0d64,_0x2003bc){var _0x29fdfe=this;return new BPromise(function(_0x3ba897,_0x74d9b8){if(_[_0x0a9e('0x72')](_0xf49ed4)||_[_0x0a9e('0x72')](_0xf49ed4['Contact'])||_[_0x0a9e('0x72')](_0xf49ed4['phone'])||_[_0x0a9e('0x72')](_0xf49ed4[_0x0a9e('0x10a')])){_0x74d9b8(ut[_0x0a9e('0x4e')](_0x0a9e('0x10b'),_0x3f0d64,_0x2003bc));return;}var _0x5d577b=uuid['v4']();var _0x2d45db=_0x29fdfe['campaignsPreview'][_0xf49ed4[_0x0a9e('0x73')][_0x0a9e('0x27')]];var _0x2977a7=_0xdeb5e4?_0x29fdfe['agents'][_0xdeb5e4]['id']:undefined;_0x29fdfe[_0x0a9e('0x15')][_0x5d577b]=new Action(_0xf49ed4,_0x2d45db,_0x5d577b,_0xdeb5e4,_0x2977a7);var _0x402544=_0x29fdfe[_0x0a9e('0x15')][_0x5d577b];_0x402544[_0x0a9e('0xad')]=_0x3f0d64;_0x402544[_0x0a9e('0xae')]=_0x2003bc;_0x402544[_0x0a9e('0x10c')]=_0xdeb5e4;if(_[_0x0a9e('0x10d')](_0x3766d7)){_0x29fdfe['execCall'](_0x402544,_0x2d45db,_0xf49ed4,_0xdeb5e4)[_0x0a9e('0x85')](function(_0x228c10){logger[_0x0a9e('0x5c')](_0x0a9e('0x10e'),_0x0a9e('0x10f')+_0x402544[_0x0a9e('0x74')]+_0x0a9e('0x110')+_0x402544['idContact'],JSON['stringify'](_0x228c10));ami[_0x0a9e('0x5f')](_0x0a9e('0x111'),ut[_0x0a9e('0xbb')](_0x402544,_0x0a9e('0x112'),_0x29fdfe[_0x0a9e('0x12')][_0x402544[_0x0a9e('0x74')]]));_0x3ba897(ut[_0x0a9e('0x4e')]('Calling'));})[_0x0a9e('0x7d')](function(_0x1d7fc4){ut[_0x0a9e('0x64')](_0x0a9e('0x113'),_0x1d7fc4);_0x74d9b8(ut[_0x0a9e('0x4e')](_0x0a9e('0x114'),_0x3f0d64,_0x2003bc));});}else{_0x2d45db[_0x0a9e('0x39')]+=0x1;ut['logBlacklist'](_0x402544);rpcDb[_0x0a9e('0x115')](_0x402544,_0x0a9e('0x116'));delete _0x29fdfe[_0x0a9e('0x15')][_0x5d577b];_0x74d9b8(ut['message'](_0x0a9e('0x117'),_0x3f0d64,_0x2003bc));}});};Preview[_0x0a9e('0xe')][_0x0a9e('0x9b')]=function(_0x292f02){return!_['isNil'](_0x292f02)&&!_[_0x0a9e('0x72')](_0x292f02[_0x0a9e('0x27')])&&!_[_0x0a9e('0x72')](_0x292f02[_0x0a9e('0x56')])&&_0x292f02[_0x0a9e('0x56')]&&!_[_0x0a9e('0x72')](this[_0x0a9e('0x14')][util[_0x0a9e('0x5e')]('SIP/%s',_0x292f02[_0x0a9e('0x27')])])&&!_[_0x0a9e('0x72')](this[_0x0a9e('0x14')][util[_0x0a9e('0x5e')]('SIP/%s',_0x292f02['name'])][_0x0a9e('0x118')])&&(this[_0x0a9e('0x14')][util[_0x0a9e('0x5e')]('SIP/%s',_0x292f02[_0x0a9e('0x27')])][_0x0a9e('0x118')]==='reachable'||this[_0x0a9e('0x14')][util['format'](_0x0a9e('0x119'),_0x292f02['name'])]['status']==='unmonitored');};Preview[_0x0a9e('0xe')][_0x0a9e('0x8b')]=function(_0x19f800,_0x20007e){var _0x7d59a9=this;return new BPromise(function(_0xe17af8,_0x48fbef){_0x7d59a9[_0x0a9e('0x11a')](_0x19f800,_0x20007e)[_0x0a9e('0x85')](function(_0x1713a7){_0xe17af8(_[_0x0a9e('0x78')](_0x1713a7,[_0x0a9e('0x4e')]));})[_0x0a9e('0x7d')](function(_0x31c937){if(_0x31c937['unlock']){rpcDb['unlockContact'](_0x19f800);}if(_0x31c937[_0x0a9e('0x56')]){rpcDb['disableContact'](_0x19f800);}_0x48fbef(_[_0x0a9e('0x78')](_0x31c937,[_0x0a9e('0x4e')]));});});};Preview[_0x0a9e('0xe')][_0x0a9e('0x11a')]=function(_0x37a448,_0x383dd8){var _0x594f25=this;return new BPromise(function(_0x4716d1,_0x59b872){var _0x50e32a,_0x504403;rpcDb['getContactPreview'](_0x37a448)[_0x0a9e('0x85')](function(_0x5dc978){if(!_['isNil'](_0x5dc978[0x0])){_0x504403=_0x5dc978[0x0][_0x0a9e('0x11b')]?![]:!![];_0x50e32a=_0x5dc978[0x0]['recallme']?!![]:![];_0x50e32a=_0x383dd8?!![]:_0x50e32a;}var _0x24470a=_0x594f25[_0x0a9e('0x11c')](_0x5dc978);if(_0x24470a[_0x0a9e('0x11d')]){rpcDb['checkIsBlackList'](_[_0x0a9e('0x78')](_0x5dc978[0x0],[_0x0a9e('0x10a'),_0x0a9e('0x11e')]))['then'](function(_0x5236c9){_0x594f25[_0x0a9e('0x11f')](_0x5236c9,_0x5dc978[0x0],_0x383dd8,_0x504403,_0x50e32a)[_0x0a9e('0x85')](function(_0x89d2cb){_0x4716d1(_0x89d2cb);})[_0x0a9e('0x7d')](function(_0x3b0db2){_0x59b872(_0x3b0db2);});})[_0x0a9e('0x7d')](function(_0x247a6c){ut[_0x0a9e('0x64')](_0x0a9e('0x120'),_0x247a6c);_0x59b872(ut[_0x0a9e('0x4e')]('Call\x20unsuccessful',_0x504403,_0x50e32a));});}else{_0x59b872(ut['message'](_0x24470a['message'],_0x504403,_0x50e32a));}})[_0x0a9e('0x7d')](function(_0x19dcc2){ut[_0x0a9e('0x64')](_0x0a9e('0x121'),_0x19dcc2);_0x59b872(ut[_0x0a9e('0x4e')](_0x0a9e('0x122'),![],!![]));});});};Preview[_0x0a9e('0xe')][_0x0a9e('0x11c')]=function(_0x5d74e9){if(_['isNil'](_0x5d74e9)||_[_0x0a9e('0x10d')](_0x5d74e9)||!_[_0x0a9e('0x72')](_0x5d74e9[0x0]['Agent'])&&_[_0x0a9e('0x72')](_0x5d74e9[0x0][_0x0a9e('0x89')][_0x0a9e('0x27')])){ut[_0x0a9e('0x64')](_0x0a9e('0x123'),_0x5d74e9);return{'isValid':![],'message':_0x0a9e('0x124')};}var _0x167196=this[_0x0a9e('0x12')][_0x5d74e9[0x0][_0x0a9e('0x73')][_0x0a9e('0x27')]];_0x167196[_0x0a9e('0x4e')]=_0x0a9e('0x9e');if(_['isNil'](_0x167196)){ut[_0x0a9e('0x64')](_0x0a9e('0x125'),_0x167196);return{'isValid':![],'message':_0x0a9e('0x126')};}if(!this[_0x0a9e('0x9b')](_0x167196[_0x0a9e('0x55')])){ut[_0x0a9e('0x64')](_0x0a9e('0x127'),_0x0a9e('0x128')+_0x167196[_0x0a9e('0x27')]+_0x0a9e('0x129'));if(!this[_0x0a9e('0x9b')](_0x167196[_0x0a9e('0x9c')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x167196[_0x0a9e('0x27')]+_0x0a9e('0x12a'));return{'isValid':![],'message':_0x0a9e('0x12b')};}}if(!ut[_0x0a9e('0x9a')](_0x167196[_0x0a9e('0x34')])){ut[_0x0a9e('0x64')](_0x0a9e('0x12c'),_0x167196['name']+_0x0a9e('0x12d'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x167196[_0x0a9e('0x27')]+_0x0a9e('0x12d')};}return{'isValid':!![],'message':_0x0a9e('0x12e')};};Preview[_0x0a9e('0xe')][_0x0a9e('0x12f')]=function(_0x358f74,_0x465003,_0x261eca,_0xa7a754){var _0x32a199=this;return new BPromise(function(_0x39d367,_0x8231e5){var _0x43111e=_0x358f74[_0x0a9e('0xb9')];var _0x3c8a9a=_0x32a199[_0x0a9e('0x9b')](_0x465003['Trunk'])?util['format'](_0x0a9e('0x130'),_0x465003[_0x0a9e('0x55')]['name'],_['isNil'](_0x465003[_0x0a9e('0x131')])?'':_0x465003[_0x0a9e('0x131')][_0x0a9e('0x132')]()||'',_0x465003['dialCutDigit']>0x0?_0x261eca[_0x0a9e('0x11e')]['substring'](_0x465003[_0x0a9e('0x133')]):_0x261eca['phone']):util[_0x0a9e('0x5e')]('SIP/%s/%s%s',_[_0x0a9e('0x72')](_0x465003[_0x0a9e('0x9c')])?_0x465003[_0x0a9e('0x55')]['name']:_0x465003[_0x0a9e('0x9c')]['name'],_['isNil'](_0x465003[_0x0a9e('0x131')])?'':_0x465003[_0x0a9e('0x131')][_0x0a9e('0x132')]()||'',_0x465003[_0x0a9e('0x133')]>0x0?_0x261eca[_0x0a9e('0x11e')][_0x0a9e('0x134')](_0x465003[_0x0a9e('0x133')]):_0x261eca[_0x0a9e('0x11e')]);var _0x1a3143=_0x32a199[_0x0a9e('0x9b')](_0x465003[_0x0a9e('0x55')])?ut[_0x0a9e('0x135')](_0x465003[_0x0a9e('0x55')][_0x0a9e('0x57')],_0x465003[_0x0a9e('0x35')],_0x465003[_0x0a9e('0x136')]>0x0?ut[_0x0a9e('0x137')](_0x465003[_0x0a9e('0x138')],_0x465003[_0x0a9e('0x136')]):_0x465003['dialOriginateCallerIdNumber']):ut[_0x0a9e('0x135')](_[_0x0a9e('0x72')](_0x465003[_0x0a9e('0x9c')])?_0x465003[_0x0a9e('0x55')]['callerid']:_0x465003['TrunkBackup']['callerid'],_0x465003[_0x0a9e('0x35')],_0x465003['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0a9e('0x137')](_0x465003[_0x0a9e('0x138')],_0x465003[_0x0a9e('0x136')]):_0x465003[_0x0a9e('0x138')]);if(_0x1a3143){_0x358f74[_0x0a9e('0x139')]=ut[_0x0a9e('0x13a')](_0x1a3143);_0x358f74[_0x0a9e('0x13b')]=ut[_0x0a9e('0x13c')](_0x1a3143);}var _0x2154d8=ut[_0x0a9e('0x13d')](_0x465003,_0x261eca,_0x3c8a9a,_0x1a3143,_0x43111e,_0x358f74);_['merge'](_0x358f74,ut[_0x0a9e('0x13e')](_0x2154d8));_0x358f74['starttime']=moment()[_0x0a9e('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x0a9e('0x7c')](ut[_0x0a9e('0x13f')](_0x358f74,_0x465003,_0x2154d8,_0x358f74[_0x0a9e('0xae')],_0xa7a754))['then'](function(_0x920ad8){_0x465003[_0x0a9e('0x4f')]+=0x1;logger['info']('[originated][increment]',_0x43111e,_0x0a9e('0xba'),_0x465003[_0x0a9e('0x27')],_0x0a9e('0x75'),_0x465003['originated']);_0x39d367(_0x920ad8);})['catch'](function(_0x4869c1){ut[_0x0a9e('0xfd')](_0x358f74,0xe,_0x0a9e('0x140'));rpcDb[_0x0a9e('0xff')](_0x358f74,_0x0a9e('0x141'));_0x8231e5(_0x4869c1);});});};Preview[_0x0a9e('0xe')][_0x0a9e('0x142')]=function(_0x183b9b){if(this[_0x0a9e('0x15')][_0x183b9b[_0x0a9e('0xaf')]]){this[_0x0a9e('0x15')][_0x183b9b[_0x0a9e('0xaf')]][_0x0a9e('0x143')]=_0x183b9b[_0x0a9e('0x143')];}};Preview[_0x0a9e('0xe')][_0x0a9e('0x19')]=function(_0x1a74c4){var _0x94e69b=this;var _0x320367=this['actions'][_0x1a74c4[_0x0a9e('0x144')]];if(_0x320367){if(_0x320367[_0x0a9e('0x10c')]&&this[_0x0a9e('0x16')][_0x320367[_0x0a9e('0x10c')]]){ut[_0x0a9e('0x145')](_0x320367,this[_0x0a9e('0x16')][_0x320367['lookAgent']][_0x0a9e('0x27')],this[_0x0a9e('0x16')][_0x320367[_0x0a9e('0x10c')]]['id']);}var _0x1109de=_[_0x0a9e('0x146')](_0x320367);_0x1109de[_0x0a9e('0xb6')]=moment()[_0x0a9e('0x5e')](_0x0a9e('0xb5'));var _0x4175a6=_0x94e69b['campaignsPreview'][_0x320367['queue']];if(ut[_0x0a9e('0x147')](_0x1a74c4[_0x0a9e('0x148')])){if(_0x320367['unlockAgent']){rpcDb[_0x0a9e('0x149')](_0x320367[_0x0a9e('0xb1')]);}if(_0x320367['activeContact']){rpcDb[_0x0a9e('0x8d')](_0x320367['idContact']);}ami[_0x0a9e('0x5f')](_0x0a9e('0x14a'),ut['buildObj'](_0x320367,_0x0a9e('0x14b'),this[_0x0a9e('0x12')][_0x320367['queue']]));this[_0x0a9e('0xfa')](_0x1109de,_0x4175a6,_0x1a74c4);}else{_0x320367[_0x0a9e('0x8e')]=moment()['format'](_0x0a9e('0xb5'));ut[_0x0a9e('0xfd')](_0x1109de,0x4,_0x0a9e('0xc2'));rpcDb[_0x0a9e('0xff')](_0x1109de,_0x0a9e('0x14c'));}}};Preview[_0x0a9e('0xe')]['syncHangup']=function(_0x1e5b09){var _0x36dc4f=this;var _0x51e697=this[_0x0a9e('0x15')][_0x1e5b09[_0x0a9e('0xaf')]];var _0x22c390;if(_0x51e697){_0x22c390=this[_0x0a9e('0x12')][_0x51e697[_0x0a9e('0x74')]];logger[_0x0a9e('0x5c')](_0x0a9e('0x14d'),_0x1e5b09['linkedid'],'\x20Queue',_0x22c390['name'],'pTalking:\x20',_0x22c390['pTalking']);}if(this[_0x0a9e('0x15')][_0x1e5b09[_0x0a9e('0xaf')]]&&_0x1e5b09['linkedid']!==_0x1e5b09['uniqueid']){if(_0x1e5b09[_0x0a9e('0x14e')]==='16'&&this['actions'][_0x1e5b09[_0x0a9e('0xaf')]][_0x0a9e('0x77')]){this[_0x0a9e('0x9f')](_0x1e5b09,_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')]);}else if(this[_0x0a9e('0x15')][_0x1e5b09['linkedid']][_0x0a9e('0x77')]){logger[_0x0a9e('0x5c')]('[syncHangup][talking][cause]',_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')],_0x0a9e('0xba'),_0x22c390[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x22c390[_0x0a9e('0x2b')]);this[_0x0a9e('0x9f')](_0x1e5b09,_0x1e5b09['linkedid'],_0x1e5b09[_0x0a9e('0x14e')]);}}else if(_0x51e697&&_['isNil'](_0x51e697[_0x0a9e('0x14f')])&&_0x22c390[_0x0a9e('0x150')]&&_0x1e5b09['linkedid']===_0x1e5b09[_0x0a9e('0xb9')]&&_[_0x0a9e('0x72')](_0x1e5b09['reason'])&&_0x1e5b09[_0x0a9e('0x14e')]==='16'&&_0x1e5b09['channelstate']==='6'&&_[_0x0a9e('0xfb')](_0x51e697[_0x0a9e('0x151')])){if(_0x51e697['unlockAgent']){rpcDb[_0x0a9e('0x149')](_0x51e697['idContact']);}if(_0x51e697[_0x0a9e('0xae')]){rpcDb[_0x0a9e('0x8d')](_0x51e697[_0x0a9e('0xb1')]);}_0x1e5b09[_0x0a9e('0xfc')]='22';this[_0x0a9e('0xfa')](_0x51e697,_0x22c390,_0x1e5b09);}else if(_0x51e697&&_0x51e697[_0x0a9e('0x151')]){if(_0x1e5b09[_0x0a9e('0x14e')]==='16'&&this['actions'][_0x1e5b09[_0x0a9e('0xaf')]][_0x0a9e('0x77')]){logger[_0x0a9e('0x5c')](_0x0a9e('0x152'),_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09['cause'],_0x0a9e('0xba'),_0x22c390['name'],'pTalking:\x20',_0x22c390[_0x0a9e('0x2b')]);this['callProgressDetectingCustomer'](_0x1e5b09,_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')]);}else if(this['actions'][_0x1e5b09[_0x0a9e('0xaf')]][_0x0a9e('0x77')]){logger[_0x0a9e('0x5c')](_0x0a9e('0x153'),_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')],_0x0a9e('0xba'),_0x22c390[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x22c390['pTalking']);this[_0x0a9e('0x9f')](_0x1e5b09,_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')]);}}};Preview[_0x0a9e('0xe')]['syncDialEnd']=function(_0x38d95a){if(this[_0x0a9e('0x15')][_0x38d95a[_0x0a9e('0xf9')]]&&_0x38d95a['destlinkedid']!==_0x38d95a[_0x0a9e('0x154')]){this[_0x0a9e('0x9f')](_0x38d95a,_0x38d95a[_0x0a9e('0xf9')],_0x38d95a['dialstatus']);}};Preview[_0x0a9e('0xe')]['syncHangupRequest']=function(_0x2394f2){if(this[_0x0a9e('0x15')][_0x2394f2[_0x0a9e('0xaf')]]&&_0x2394f2[_0x0a9e('0xaf')]!==_0x2394f2[_0x0a9e('0xb9')]&&!this[_0x0a9e('0x15')][_0x2394f2[_0x0a9e('0xaf')]]['dialAnswer']){if(_0x2394f2[_0x0a9e('0x14e')]==='1'){this[_0x0a9e('0x9f')](_0x2394f2,_0x2394f2[_0x0a9e('0xaf')],_0x2394f2[_0x0a9e('0x14e')]);}}};Preview[_0x0a9e('0xe')][_0x0a9e('0x155')]=function(_0x3a4def,_0x2670f5,_0x2310ca){if(this[_0x0a9e('0x15')][_0x3a4def]){if(_[_0x0a9e('0x72')](this[_0x0a9e('0x15')][_0x3a4def][_0x0a9e('0x156')])){this[_0x0a9e('0x15')][_0x3a4def][_0x0a9e('0x156')]={};}this[_0x0a9e('0x15')][_0x3a4def][_0x0a9e('0x156')][_0x2670f5]=_0x2310ca;}};Preview[_0x0a9e('0xe')][_0x0a9e('0x21')]=function(_0x611e46){try{if(!_[_0x0a9e('0x72')](_0x611e46)){if(ut[_0x0a9e('0x157')](_[_0x0a9e('0x158')](_0x611e46['variable'])[0x0])){this[_0x0a9e('0x155')](_0x611e46[_0x0a9e('0xb9')],_[_0x0a9e('0x158')](_0x611e46['variable'])[0x0],_0x611e46[_0x0a9e('0x159')]);}}}catch(_0x4c925e){logger[_0x0a9e('0x15a')](_0x0a9e('0x15b'),util[_0x0a9e('0x15c')](_0x4c925e,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xe')][_0x0a9e('0x23')]=function(_0xb09ef6){if(_0xb09ef6){if(this[_0x0a9e('0x15')][_0xb09ef6[_0x0a9e('0x15d')]]){this['actions'][_0xb09ef6[_0x0a9e('0x15d')]][_0x0a9e('0x151')]=!![];}}};Preview['prototype'][_0x0a9e('0x25')]=function(_0x2db8fe){if(_0x2db8fe){if(this[_0x0a9e('0x15')][_0x2db8fe['transfererlinkedid']]){this[_0x0a9e('0x15')][_0x2db8fe[_0x0a9e('0x15e')]][_0x0a9e('0x151')]=!![];}}};module[_0x0a9e('0x15f')]=Preview; \ No newline at end of file +var _0xa9e0=['outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','hasOwnProperty','dialMethod','booked','clearZombieChannels','type','outbound','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','Action','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','logger2','disableContact','starttime','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','rescheduleContact','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','BUSY','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','additional','countbusyretry','dialBusyMaxRetry','scheduledAt','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','status','SIP/%s','execRun','recallme','validateContact','isValid','phone','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','logLookAgent','clone','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','filterKey','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','md5','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','defaults','socket.io-emitter','redis','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var uuid=require('uuid');var moment=require('moment');var md5=require(_0x0a9e('0x3'));var Redis=require('ioredis');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x7'));var ami=require('../ami');var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require(_0x0a9e('0x9'));var Action=require(_0x0a9e('0xa'));var ut=require('./util/util');config['redis']=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0xc'))(new Redis(config[_0x0a9e('0xd')]));var Sequence=function(){};Sequence[_0x0a9e('0xe')][_0x0a9e('0xf')]=function(_0xfeb75b){this[_0x0a9e('0x10')]=this['tail']?this['tail']['finally'](_0xfeb75b):_0xfeb75b();};function Preview(_0x4cfe67){this[_0x0a9e('0x11')]=new Sequence();this[_0x0a9e('0x12')]=_0x4cfe67[_0x0a9e('0x13')];this[_0x0a9e('0x14')]=_0x4cfe67[_0x0a9e('0x14')];this[_0x0a9e('0x15')]={};this['agents']=_0x4cfe67[_0x0a9e('0x16')];this[_0x0a9e('0x17')]=0x0;ami['on'](_0x0a9e('0x18'),this[_0x0a9e('0x19')][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x1b'),this['syncHangup'][_0x0a9e('0x1a')](this));ami['on']('hanguprequest',this[_0x0a9e('0x1c')]['bind'](this));ami['on'](_0x0a9e('0x1d'),this[_0x0a9e('0x1e')]['bind'](this));ami['on'](_0x0a9e('0x1f'),this['syncNewExten'][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x24'),this[_0x0a9e('0x25')][_0x0a9e('0x1a')](this));this[_0x0a9e('0x26')](this[_0x0a9e('0x12')]);}function emit(_0x4bb1e3,_0x2c3407,_0x155cce){io['to'](_0x4bb1e3)['emit'](_0x2c3407,_0x155cce);}function emitCampaignPreview(_0x20f109){if(_0x20f109['type']==='outbound'){var _0x3a02e1={'id':_0x20f109['id'],'name':_0x20f109[_0x0a9e('0x27')],'strategy':_0x20f109[_0x0a9e('0x28')],'answered':_0x20f109[_0x0a9e('0x29')],'available':_0x20f109['available'],'loggedIn':_0x20f109[_0x0a9e('0x2a')],'pTalking':_0x20f109[_0x0a9e('0x2b')],'sumBillable':_0x20f109[_0x0a9e('0x2c')],'sumDuration':_0x20f109[_0x0a9e('0x2d')],'sumHoldTime':_0x20f109[_0x0a9e('0x2e')]||0x0,'talking':_0x20f109[_0x0a9e('0x2f')],'total':_0x20f109[_0x0a9e('0x30')],'type':_0x20f109['type'],'unmanaged':_0x20f109['unmanaged'],'abandoned':_0x20f109[_0x0a9e('0x31')],'waiting':_0x20f109[_0x0a9e('0x32')],'loggedInDb':_0x20f109[_0x0a9e('0x33')],'dialActive':_0x20f109[_0x0a9e('0x34')],'dialMethod':_0x20f109['dialMethod'],'dialOriginateCallerIdName':_0x20f109[_0x0a9e('0x35')],'dialOriginateCallerIdNumber':_0x20f109['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x20f109[_0x0a9e('0x36')],'dialPrefix':_0x20f109['dialPrefix'],'outboundAnswerAgiCallsDay':_0x20f109[_0x0a9e('0x37')],'outboundAnswerCallsDay':_0x20f109[_0x0a9e('0x38')],'outboundBlacklistCallsDay':_0x20f109[_0x0a9e('0x39')],'outboundBusyCallsDay':_0x20f109[_0x0a9e('0x3a')],'outboundCongestionCallsDay':_0x20f109[_0x0a9e('0x3b')],'outboundDropCallsDayACS':_0x20f109[_0x0a9e('0x3c')],'outboundDropCallsDayCallersExit':_0x20f109[_0x0a9e('0x3d')],'outboundDropCallsDayTimeout':_0x20f109[_0x0a9e('0x3e')],'outboundNoAnswerCallsDay':_0x20f109['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x20f109[_0x0a9e('0x3f')],'outboundOriginateFailureCallsDay':_0x20f109[_0x0a9e('0x40')],'outboundReCallsDay':_0x20f109[_0x0a9e('0x41')],'outboundRejectCallsDay':_0x20f109[_0x0a9e('0x42')],'outboundUnknownCallsDay':_0x20f109['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x20f109[_0x0a9e('0x43')],'predictiveIntervalAnsweredCalls':_0x20f109[_0x0a9e('0x44')],'predictiveIntervalAvgHoldtime':_0x20f109[_0x0a9e('0x45')],'predictiveIntervalAvgTalktime':_0x20f109[_0x0a9e('0x46')],'predictiveIntervalDroppedCallsCallersExit':_0x20f109[_0x0a9e('0x47')],'predictiveIntervalDroppedCallsTimeout':_0x20f109[_0x0a9e('0x48')],'predictiveIntervalErlangCalls':_0x20f109[_0x0a9e('0x49')],'predictiveIntervalErlangCallsDroppedCalls':_0x20f109[_0x0a9e('0x4a')],'predictiveIntervalHitRate':_0x20f109[_0x0a9e('0x4b')],'predictiveIntervalMultiplicativeFactor':_0x20f109['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x20f109[_0x0a9e('0x4c')],'predictiveIntervalAvailable':_0x20f109['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x20f109[_0x0a9e('0x4d')],'message':_0x20f109[_0x0a9e('0x4e')],'originated':_0x20f109[_0x0a9e('0x4f')],'erlangCalls':_0x20f109[_0x0a9e('0x50')],'erlangCallToSecond':_0x20f109[_0x0a9e('0x51')],'erlangAbandonmentRate':_0x20f109['erlangAbandonmentRate'],'erlangBusyFactor':_0x20f109[_0x0a9e('0x52')],'startPredictive':_0x20f109[_0x0a9e('0x53')],'startProgressive':_0x20f109[_0x0a9e('0x54')]};if(_0x20f109[_0x0a9e('0x55')]){_0x3a02e1[_0x0a9e('0x55')]={'id':_0x20f109[_0x0a9e('0x55')]['id'],'name':_0x20f109[_0x0a9e('0x55')][_0x0a9e('0x27')],'active':_0x20f109['Trunk'][_0x0a9e('0x56')],'callerid':_0x20f109['Trunk'][_0x0a9e('0x57')]};}if(_0x20f109[_0x0a9e('0x58')]){_0x3a02e1[_0x0a9e('0x58')]={'id':_0x20f109[_0x0a9e('0x58')]['id'],'name':_0x20f109['Interval'][_0x0a9e('0x27')]};}var _0xd1836d=md5(JSON[_0x0a9e('0x59')](_0x3a02e1));if(_0x20f109[_0x0a9e('0x3')]!==_0xd1836d){_0x20f109['md5']=_0xd1836d;emit(util['format'](_0x0a9e('0x5a'),_0x3a02e1['name']),_0x0a9e('0x5b'),_0x3a02e1);}}}function emitVoiceQueueChannelRemove(_0x3d9717){logger[_0x0a9e('0x5c')](_0x0a9e('0x5d'),JSON['stringify'](_0x3d9717));emit(util[_0x0a9e('0x5e')](_0x0a9e('0x5a'),_0x3d9717[_0x0a9e('0x27')]),'voice_queue_channel:remove',_0x3d9717);io[_0x0a9e('0x5f')](_0x0a9e('0x60'),_0x3d9717);}function notSendMessagesQueue(_0x289467){if(_0x289467['sendMessageOneNotActive']){if(_0x289467['originated']===0x0&&_0x289467[_0x0a9e('0x2b')]===0x0){_0x289467[_0x0a9e('0x61')]=![];_0x289467['available']=0x0;_0x289467[_0x0a9e('0x62')]=0x0;_0x289467[_0x0a9e('0x4e')]=_0x0a9e('0x63');ut[_0x0a9e('0x64')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x289467['name']+_0x0a9e('0x65'));}else{_0x289467[_0x0a9e('0x4e')]='IS_DISACTIVED';ut[_0x0a9e('0x64')](_0x0a9e('0x66'),_0x289467[_0x0a9e('0x27')]+'\x20is\x20disactive');}emitCampaignPreview(_0x289467);}}Preview[_0x0a9e('0xe')][_0x0a9e('0x26')]=function(){var _0x274e8e=this;setInterval(function(){_0x274e8e[_0x0a9e('0x67')]();},0x7cf);};Preview[_0x0a9e('0xe')][_0x0a9e('0x67')]=function(){var _0x2881b3=this[_0x0a9e('0x12')];this[_0x0a9e('0x17')]+=0x1;for(var _0x3da2cd in _0x2881b3){if(_0x2881b3[_0x0a9e('0x68')](_0x3da2cd)&&(_0x2881b3[_0x3da2cd][_0x0a9e('0x69')]===_0x0a9e('0x6')||_0x2881b3[_0x3da2cd][_0x0a9e('0x69')]===_0x0a9e('0x6a'))&&_0x2881b3[_0x3da2cd]['type']==='outbound'){if(this[_0x0a9e('0x17')]>0x7){this[_0x0a9e('0x17')]=0x0;this[_0x0a9e('0x6b')]();}}if(_0x2881b3[_0x0a9e('0x68')](_0x3da2cd)&&_0x2881b3[_0x3da2cd][_0x0a9e('0x69')]===_0x0a9e('0x6')&&_0x2881b3[_0x3da2cd][_0x0a9e('0x6c')]===_0x0a9e('0x6d')){if(_0x2881b3[_0x3da2cd][_0x0a9e('0x34')]){this[_0x0a9e('0x6e')](_0x2881b3[_0x3da2cd]);if(_0x2881b3[_0x3da2cd][_0x0a9e('0x6f')])this[_0x0a9e('0x70')](_0x2881b3[_0x3da2cd]);}else{notSendMessagesQueue(_0x2881b3[_0x3da2cd]);}}}};Preview['prototype'][_0x0a9e('0x71')]=function(_0x138b8b){var _0xdd268f=this;this[_0x0a9e('0x11')][_0x0a9e('0xf')](function(){if(!_[_0x0a9e('0x72')](_0xdd268f[_0x0a9e('0x15')][_0x138b8b])){loggerAction[_0x0a9e('0x5c')]('[clearZombieChannels][talking]',_0x138b8b,_0x0a9e('0x73'),_0xdd268f['actions'][_0x138b8b][_0x0a9e('0x74')],_0x0a9e('0x75'),JSON[_0x0a9e('0x59')](_0xdd268f['campaignsPreview'][_0xdd268f[_0x0a9e('0x15')][_0x138b8b][_0x0a9e('0x74')]][_0x0a9e('0x4f')]),_0x0a9e('0x76'),JSON[_0x0a9e('0x59')](_0xdd268f[_0x0a9e('0x12')][_0xdd268f[_0x0a9e('0x15')][_0x138b8b]['queue']][_0x0a9e('0x2b')]),JSON[_0x0a9e('0x59')](_0xdd268f[_0x0a9e('0x15')][_0x138b8b][_0x0a9e('0x77')]),JSON[_0x0a9e('0x59')](_[_0x0a9e('0x78')](_0xdd268f[_0x0a9e('0x15')][_0x138b8b],[_0x0a9e('0x79'),_0x0a9e('0x7a'),'VoiceQueueId',_0x0a9e('0x7b')])));return ami[_0x0a9e('0x7c')]({'action':'status','channel':_0xdd268f['actions'][_0x138b8b]['channel']})[_0x0a9e('0x7d')](function(_0x4317e3){if(_0x4317e3[_0x0a9e('0x4e')]===_0x0a9e('0x7e')){setTimeout(function(){if(_0xdd268f[_0x0a9e('0x15')][_0x138b8b]){ut[_0x0a9e('0x7f')](_0xdd268f[_0x0a9e('0x12')][_0xdd268f[_0x0a9e('0x15')][_0x138b8b]['queue']],'[clearZombieChannel]');if(_0xdd268f['actions'][_0x138b8b][_0x0a9e('0x77')]===!![]){ut[_0x0a9e('0x80')](_0xdd268f[_0x0a9e('0x12')][_0xdd268f['actions'][_0x138b8b][_0x0a9e('0x74')]],_0x0a9e('0x81'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x138b8b,_0xdd268f[_0x0a9e('0x15')][_0x138b8b]['queue']);}ut[_0x0a9e('0x82')]('[Dialer][checkChannel][Preview]'+_0x138b8b,_0xdd268f[_0x0a9e('0x15')][_0x138b8b][_0x0a9e('0x74')]);delete _0xdd268f[_0x0a9e('0x15')][_0x138b8b];}},0x2328);}});}});};Preview['prototype'][_0x0a9e('0x6b')]=function(){var _0x1bf38a=this;loggerAction['info']('[action]',_[_0x0a9e('0x83')](this[_0x0a9e('0x15')]));for(var _0x49c095 in this[_0x0a9e('0x15')]){if(_0x1bf38a['actions'][_0x0a9e('0x68')](_0x49c095)){_0x1bf38a['clearZombieChannel'](_0x49c095);}}};Preview[_0x0a9e('0xe')]['recallMe']=function(_0x5da27d){var _0x5df0ad=this;rpcDb[_0x0a9e('0x84')](_0x5da27d['id'],ut['agentReadyId'](this[_0x0a9e('0x16')]))[_0x0a9e('0x85')](function(_0x3cfd00){if(!_[_0x0a9e('0x72')](_0x3cfd00)){for(var _0x232830=0x0;_0x232830<_0x3cfd00[_0x0a9e('0x86')];_0x232830+=0x1){if(ut[_0x0a9e('0x87')](_0x3cfd00[_0x232830][_0x0a9e('0x88')])<_0x5da27d['dialRecallMeTimeout']*0x3c){if(_0x3cfd00[_0x232830][_0x0a9e('0x89')]&&!_0x3cfd00[_0x232830][_0x0a9e('0x89')][_0x0a9e('0x8a')]){_0x5df0ad[_0x0a9e('0x8b')](_0x3cfd00[_0x232830]['id'])[_0x0a9e('0x85')](ut[_0x0a9e('0x8c')]('[RecallMe]'))[_0x0a9e('0x7d')](ut[_0x0a9e('0x8c')]('[RecallMe]'));}else{rpcDb[_0x0a9e('0x8d')](_0x3cfd00[_0x232830]['id']);}}else{var _0x5cc8fb=new Action(_0x3cfd00[_0x232830],_0x5da27d);_0x5cc8fb[_0x0a9e('0x8e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5da27d['outboundReCallsDay']+=0x1;ut[_0x0a9e('0x8f')](_0x5cc8fb,0x17,'RecallInQueue');if(_0x5da27d[_0x0a9e('0x90')]){rpcDb[_0x0a9e('0x91')](ut[_0x0a9e('0x92')](_0x3cfd00[_0x232830]));rpcDb[_0x0a9e('0x93')](_0x5cc8fb,_0x0a9e('0x94'));}else{ut[_0x0a9e('0x8f')](_0x5cc8fb,0x16,'RecallFailedTimeout');rpcDb[_0x0a9e('0x93')](_0x5cc8fb,'[HistoryRecallClose]');rpcDb[_0x0a9e('0x95')](_0x5cc8fb,_0x0a9e('0x96'));}}}}})[_0x0a9e('0x7d')](ut['logger2'](_0x0a9e('0x97')));};Preview[_0x0a9e('0xe')][_0x0a9e('0x6e')]=function(_0x32e134){_0x32e134['sendMessageOneNotActive']=!![];if(ut[_0x0a9e('0x98')](_0x32e134[_0x0a9e('0x2a')])){_0x32e134['message']=_0x0a9e('0x99');}else if(!ut[_0x0a9e('0x9a')](_0x32e134[_0x0a9e('0x34')])){_0x32e134[_0x0a9e('0x4e')]=_0x0a9e('0x63');}else if(!this['isTrunkReachable'](_0x32e134[_0x0a9e('0x55')])){if(!this[_0x0a9e('0x9b')](_0x32e134[_0x0a9e('0x9c')])){_0x32e134['message']=_0x0a9e('0x9d');}else{_0x32e134['message']='ACTIVE';}}else{_0x32e134[_0x0a9e('0x4e')]=_0x0a9e('0x9e');}emitCampaignPreview(_0x32e134);};Preview[_0x0a9e('0xe')][_0x0a9e('0x9f')]=function(_0x186f39,_0xc8c264,_0x387489){var _0x54a37d=this;var _0x2d7205=this[_0x0a9e('0x15')][_0xc8c264];var _0x2e89b7=this[_0x0a9e('0x12')][_0x2d7205[_0x0a9e('0x74')]];var _0x2b8192;var _0x320898=![];var _0x412a72=0x2;var _0x2a28c0=0x3;if(_0x2e89b7){switch(_0x387489){case'1':_0x2e89b7[_0x0a9e('0x3f')]+=0x1;_0x2d7205['countnosuchnumberretry']+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x0,'NoSuchNumber');ami[_0x0a9e('0x5f')](_0x0a9e('0xa2'),ut['buildObj'](_0x2d7205,_0x0a9e('0xa3')));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xa4'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'0',_0x2e89b7)[_0x0a9e('0x85')](function(_0x4a43a8){_0x320898=_0x4a43a8['additional']==0x1;_0x412a72=_0x2e89b7['dialNoSuchNumberRetryFrequency'];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xaa'));}else{if(_0x2d7205[_0x0a9e('0xab')]>=_0x2e89b7['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xaa'));}else{rpcDb[_0x0a9e('0xac')](ut['scheduledAt'](_0x2d7205,_0x0a9e('0xab'),_0x2e89b7['dialNoSuchNumberRetryFrequency']),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}delete this['actions'][_0x186f39[_0x0a9e('0xaf')]];}else{_0x2d7205[_0x0a9e('0xab')]++;logger[_0x0a9e('0x5c')](_0x0a9e('0xb0'),_0x2d7205['countnosuchnumberretry']);logger[_0x0a9e('0x5c')]('id',_0x2d7205[_0x0a9e('0xb1')]);_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnosuchnumberretry':_0x2d7205['countnosuchnumberretry']}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xb4'):var _0x4abc8f=moment()[_0x0a9e('0x5e')](_0x0a9e('0xb5'));_0x2d7205[_0x0a9e('0xb6')]=_0x4abc8f;_0x2d7205[_0x0a9e('0xb7')]=_0x4abc8f;_0x2d7205[_0x0a9e('0x77')]=!![];_0x2e89b7[_0x0a9e('0x2b')]+=0x1;logger[_0x0a9e('0x5c')](_0x0a9e('0xb8'),_0x2d7205[_0x0a9e('0xb9')],_0x0a9e('0xba'),_0x2e89b7[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x2e89b7[_0x0a9e('0x2b')]);ami[_0x0a9e('0x5f')]('custom:agentconnect',ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xbc'),this[_0x0a9e('0x12')][_0x2d7205['queue']]));if(_0x2e89b7[_0x0a9e('0xbd')]){ami[_0x0a9e('0x5f')](_0x0a9e('0xbe'),ut[_0x0a9e('0xbf')](_0x2d7205));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xc0'),this['campaignsPreview'][_0x2d7205[_0x0a9e('0x74')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2d7205,_0x0a9e('0xc0')));_0x2e89b7[_0x0a9e('0x38')]+=0x1;_0x2e89b7['total']+=0x1;_0x2e89b7[_0x0a9e('0x29')]+=0x1;ut[_0x0a9e('0x80')](_0x2e89b7,_0x0a9e('0xc1'));_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x4,_0x0a9e('0xc2'));rpcDb['createCustomerHistory'](_0x2d7205,_0x0a9e('0xc3'));rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xc4'));rpcDb[_0x0a9e('0xc5')](_0x2d7205);_0x2e89b7['sumDuration']+=_0x2d7205[_0x0a9e('0xc6')];_0x2e89b7[_0x0a9e('0x2c')]+=_0x2d7205['talktime'];logger[_0x0a9e('0x5c')]('[syncHangup][talking][decrement]',_0x2d7205[_0x0a9e('0xb9')],_0x0a9e('0xba'),_0x2e89b7[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x2e89b7['pTalking']);delete this['actions'][_0x186f39[_0x0a9e('0xaf')]];break;case _0x0a9e('0xc7'):_0x2e89b7[_0x0a9e('0x3a')]+=0x1;_0x2d7205['countbusyretry']+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut['logCustomer'](_0x2d7205,0x5,'Busy');_0x412a72=_0x2e89b7[_0x0a9e('0xc8')];_0x2a28c0=_0x2e89b7['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentbusy',ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xc9')));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xca'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'5',_0x2e89b7)[_0x0a9e('0x85')](function(_0x5a8854){_0x320898=_0x5a8854[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut['totalGlobal'](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x2d7205[_0x0a9e('0xcc')]>=_0x2e89b7[_0x0a9e('0xcd')]){rpcDb[_0x0a9e('0x95')](_0x2d7205,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x0a9e('0xac')](ut[_0x0a9e('0xce')](_0x2d7205,_0x0a9e('0xcc'),_0x2e89b7[_0x0a9e('0xc8')]),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xcc')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205['idContact'],'field':{'countbusyretry':_0x2d7205[_0x0a9e('0xcc')]}})[_0x0a9e('0x85')](function(){_0x54a37d['swapAdditionalPhones'](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xcf'):_0x2e89b7[_0x0a9e('0xd0')]+=0x1;_0x2d7205['countnoanswerretry']+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut['totalGlobal'](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x3,_0x0a9e('0xd1'));_0x412a72=_0x2e89b7[_0x0a9e('0xd2')];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];ami[_0x0a9e('0x5f')](_0x0a9e('0xd3'),ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xd4')));rpcDb['createCustomerHistory'](_0x2d7205,_0x0a9e('0xd5'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'3',_0x2e89b7)[_0x0a9e('0x85')](function(_0x30ef6e){_0x320898=_0x30ef6e[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xd6'));}else{if(_0x2d7205[_0x0a9e('0xd7')]>=_0x2e89b7[_0x0a9e('0xd8')]){rpcDb['createCustomerFinal'](_0x2d7205,_0x0a9e('0xd5'));}else{rpcDb[_0x0a9e('0xac')](ut[_0x0a9e('0xce')](_0x2d7205,_0x0a9e('0xd7'),_0x2e89b7[_0x0a9e('0xd2')]),_0x2d7205['unlockAgent'],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d['incrementPreviewCounters']({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205['countnoanswerretry']}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xd9'):_0x2e89b7['outboundCongestionCallsDay']+=0x1;_0x2d7205[_0x0a9e('0xda')]+=0x1;_0x2d7205['countglobal']=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x8,'Congestion');_0x412a72=_0x2e89b7[_0x0a9e('0xdb')];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];ami[_0x0a9e('0x5f')]('custom:agentcongestion',ut['buildObj'](_0x2d7205,_0x0a9e('0xdc')));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xdd'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'8',_0x2e89b7)[_0x0a9e('0x85')](function(_0x2450a8){_0x320898=_0x2450a8[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut['cloneAction'](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb['createCustomerFinal'](_0x2b8192,_0x0a9e('0xde'));}else{if(_0x2d7205[_0x0a9e('0xda')]>=_0x2e89b7[_0x0a9e('0xdf')]){rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xdd'));}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xce')](_0x2d7205,_0x0a9e('0xda'),_0x2e89b7[_0x0a9e('0xc8')]),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205['countcongestionretry']++;_0x54a37d['incrementPreviewCounters']({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countcongestionretry':_0x2d7205['countcongestionretry']}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xe0'):_0x2e89b7[_0x0a9e('0x42')]+=0x1;_0x2d7205[_0x0a9e('0xe1')]+=0x1;_0x2d7205['countglobal']=ut['totalGlobal'](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x14,'AgentReject');_0x412a72=_0x2e89b7[_0x0a9e('0xe2')];_0x2a28c0=_0x2e89b7['callAdditionalPhoneAfterMin'];ami[_0x0a9e('0x5f')]('custom:agentreject',ut['buildObj'](_0x2d7205,_0x0a9e('0xe3')));rpcDb[_0x0a9e('0x93')](_0x2d7205,'[syncHangupRequest][logAgentReject]');_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'20',_0x2e89b7)[_0x0a9e('0x85')](function(_0x15c6b9){_0x320898=_0x15c6b9[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7['dialGlobalMaxRetry']){_0x2b8192=ut['cloneAction'](_0x2d7205,0x14,_0x0a9e('0xe4'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xe5'));}else{if(_0x2d7205[_0x0a9e('0xe1')]>=_0x2e89b7[_0x0a9e('0xe6')]){rpcDb['createCustomerFinal'](_0x2d7205,_0x0a9e('0xe5'));}else{rpcDb[_0x0a9e('0xac')](ut['scheduledAt'](_0x2d7205,_0x0a9e('0xe1'),_0x2e89b7[_0x0a9e('0xe2')]),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)['then'](function(){});});}});break;case _0x0a9e('0xe7'):_0x2e89b7[_0x0a9e('0x43')]+=0x1;_0x2d7205[_0x0a9e('0xe8')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut['logCustomer'](_0x2d7205,0xb,'Abandoned');rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xe9'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'11',_0x2e89b7)[_0x0a9e('0x85')](function(_0x34f7b5){_0x320898=_0x34f7b5['additional']==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,'Global');rpcDb[_0x0a9e('0x95')](_0x2b8192,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2d7205[_0x0a9e('0xea')]>=_0x2e89b7['dialAbandonedMaxRety']){rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xe9'));}else{rpcDb[_0x0a9e('0xac')](ut['scheduledAt'](_0x2d7205,_0x0a9e('0xe8'),_0x2e89b7['dialAbandonedRetryFrequency']),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case'18':_0x2e89b7[_0x0a9e('0xeb')]+=0x1;_0x2d7205[_0x0a9e('0xec')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x12,_0x186f39[_0x0a9e('0xed')]||_0x186f39[_0x0a9e('0xee')]);ami['emit']('custom:amd',ut[_0x0a9e('0xbb')](_0x2d7205,'amd'));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xef'));_0x54a37d['verifyAdditionalPhones'](_0x2d7205,'18',_0x2e89b7)[_0x0a9e('0x85')](function(_0xe2b083){_0x320898=_0xe2b083[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7['dialGlobalMaxRetry']){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0x12,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xef'));}else{rpcDb['createCustomerFinal'](_0x2d7205,_0x0a9e('0xef'));}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205['idContact'],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)['then'](function(){});});}});delete this[_0x0a9e('0x15')][_0x186f39[_0x0a9e('0xaf')]];break;case'19':_0x2e89b7[_0x0a9e('0xeb')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut['logCustomer'](_0x2d7205,0x13,_0x186f39[_0x0a9e('0xed')]||_0x186f39[_0x0a9e('0xee')]);ami['emit'](_0x0a9e('0xf0'),ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xf1')));rpcDb['createCustomerHistory'](_0x2d7205,'[callProgressDetectingCustomer][machine]');_0x54a37d['verifyAdditionalPhones'](_0x2d7205,'18',_0x2e89b7)[_0x0a9e('0x85')](function(_0x4a70ce){_0x320898=_0x4a70ce['additional']==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,'Global');rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xf2'));}else{rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xf2'));}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d['swapAdditionalPhones'](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});delete this['actions'][_0x186f39[_0x0a9e('0xaf')]];break;default:if(_0x2d7205[_0x0a9e('0x77')]){ut[_0x0a9e('0x80')](_0x2e89b7,_0x0a9e('0xf3'));ut[_0x0a9e('0x82')](_0x0a9e('0xf4')+_0x2e89b7['name'],_0x186f39);}_0x2e89b7[_0x0a9e('0xeb')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0xc,_0x186f39['cause-txt']||_0x186f39[_0x0a9e('0xee')]);_0x412a72=_0x2e89b7[_0x0a9e('0xe2')];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xf5'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'20',_0x2e89b7)[_0x0a9e('0x85')](function(_0x25931e){_0x320898=_0x25931e[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7['dialGlobalMaxRetry']){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xf6'));}else{rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xf6'));}delete this[_0x0a9e('0x15')][_0x186f39[_0x0a9e('0xaf')]];}else{_0x54a37d['swapAdditionalPhones'](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(_0xd2391){});}});}if(!(_0x2d7205[_0x0a9e('0x77')]&&_0x387489==='16')){ut['updateOriginated'](_0x2e89b7,_0x0a9e('0xf7'));logger[_0x0a9e('0x5c')](_0x0a9e('0xf8'),_0x2d7205[_0x0a9e('0xb9')],_0x0a9e('0xba'),_0x2e89b7[_0x0a9e('0x27')],_0x0a9e('0x75'),_0x2e89b7[_0x0a9e('0x4f')]);}if(_0x387489!==_0x0a9e('0xb4')){delete this[_0x0a9e('0x15')][_0x186f39['linkedid']];delete this[_0x0a9e('0x15')][_0x186f39[_0x0a9e('0xf9')]];}}};Preview[_0x0a9e('0xe')][_0x0a9e('0xfa')]=function(_0x2b624e,_0x3942fd,_0x5cb48d){if(_[_0x0a9e('0xfb')](_0x3942fd)&&'object'!==typeof _0x3942fd){return;}if(_['isUndefined'](_0x5cb48d)&&'object'!==typeof _0x5cb48d){return;}switch(_0x5cb48d[_0x0a9e('0xfc')]){case'0':ut[_0x0a9e('0xfd')](_0x2b624e,0x0,_0x0a9e('0xfe'));rpcDb[_0x0a9e('0xff')](_0x2b624e,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x0a9e('0xfd')](_0x2b624e,0x3,_0x0a9e('0xd1'));rpcDb[_0x0a9e('0xff')](_0x2b624e,_0x0a9e('0x100'));break;case'5':ut[_0x0a9e('0xfd')](_0x2b624e,0x5,'Busy');rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x101'));break;case'8':ut[_0x0a9e('0xfd')](_0x2b624e,0x8,_0x0a9e('0x102'));rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x103'));break;case'22':ut[_0x0a9e('0xfd')](_0x2b624e,0x16,_0x0a9e('0x104'));rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x105'));break;default:ut[_0x0a9e('0xfd')](_0x2b624e,0xc,_0x5cb48d[_0x0a9e('0xfc')]);rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x103'));}ut[_0x0a9e('0x7f')](_0x3942fd,_0x0a9e('0x106'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x2b624e['uniqueid'],_0x0a9e('0xba'),_0x3942fd[_0x0a9e('0x27')],_0x0a9e('0x75'),_0x3942fd[_0x0a9e('0x4f')]);delete this['actions'][_0x2b624e[_0x0a9e('0xb9')]];};Preview['prototype'][_0x0a9e('0xa5')]=function(_0x2ff2ab,_0x242f23,_0x57f673){return BPromise[_0x0a9e('0x107')]()[_0x0a9e('0x85')](cmHopperAdditionalPhone[_0x0a9e('0xa5')](_0x2ff2ab,_0x242f23,_0x57f673))['catch'](logger[_0x0a9e('0x5c')]('[verifyAdditionalPhone]\x20'));};Preview[_0x0a9e('0xe')]['swapAdditionalPhones']=function(_0x41b90a,_0x57b7d4,_0xb14971){return BPromise[_0x0a9e('0x107')]()[_0x0a9e('0x85')](cmHopperAdditionalPhone[_0x0a9e('0xb3')](_0x41b90a,_0x57b7d4,_0xb14971))[_0x0a9e('0x7d')](logger[_0x0a9e('0x5c')](_0x0a9e('0x108')));};Preview['prototype'][_0x0a9e('0xb2')]=function(_0x1c9ea2){return BPromise['resolve']()[_0x0a9e('0x85')](cmHopperAdditionalPhone[_0x0a9e('0xb2')](_0x1c9ea2))['catch'](logger[_0x0a9e('0x5c')](_0x0a9e('0x109')));};Preview[_0x0a9e('0xe')]['checkInBlack']=function(_0x3766d7,_0xf49ed4,_0xdeb5e4,_0x3f0d64,_0x2003bc){var _0x29fdfe=this;return new BPromise(function(_0x3ba897,_0x74d9b8){if(_[_0x0a9e('0x72')](_0xf49ed4)||_[_0x0a9e('0x72')](_0xf49ed4['Contact'])||_[_0x0a9e('0x72')](_0xf49ed4['phone'])||_[_0x0a9e('0x72')](_0xf49ed4[_0x0a9e('0x10a')])){_0x74d9b8(ut[_0x0a9e('0x4e')](_0x0a9e('0x10b'),_0x3f0d64,_0x2003bc));return;}var _0x5d577b=uuid['v4']();var _0x2d45db=_0x29fdfe['campaignsPreview'][_0xf49ed4[_0x0a9e('0x73')][_0x0a9e('0x27')]];var _0x2977a7=_0xdeb5e4?_0x29fdfe['agents'][_0xdeb5e4]['id']:undefined;_0x29fdfe[_0x0a9e('0x15')][_0x5d577b]=new Action(_0xf49ed4,_0x2d45db,_0x5d577b,_0xdeb5e4,_0x2977a7);var _0x402544=_0x29fdfe[_0x0a9e('0x15')][_0x5d577b];_0x402544[_0x0a9e('0xad')]=_0x3f0d64;_0x402544[_0x0a9e('0xae')]=_0x2003bc;_0x402544[_0x0a9e('0x10c')]=_0xdeb5e4;if(_[_0x0a9e('0x10d')](_0x3766d7)){_0x29fdfe['execCall'](_0x402544,_0x2d45db,_0xf49ed4,_0xdeb5e4)[_0x0a9e('0x85')](function(_0x228c10){logger[_0x0a9e('0x5c')](_0x0a9e('0x10e'),_0x0a9e('0x10f')+_0x402544[_0x0a9e('0x74')]+_0x0a9e('0x110')+_0x402544['idContact'],JSON['stringify'](_0x228c10));ami[_0x0a9e('0x5f')](_0x0a9e('0x111'),ut[_0x0a9e('0xbb')](_0x402544,_0x0a9e('0x112'),_0x29fdfe[_0x0a9e('0x12')][_0x402544[_0x0a9e('0x74')]]));_0x3ba897(ut[_0x0a9e('0x4e')]('Calling'));})[_0x0a9e('0x7d')](function(_0x1d7fc4){ut[_0x0a9e('0x64')](_0x0a9e('0x113'),_0x1d7fc4);_0x74d9b8(ut[_0x0a9e('0x4e')](_0x0a9e('0x114'),_0x3f0d64,_0x2003bc));});}else{_0x2d45db[_0x0a9e('0x39')]+=0x1;ut['logBlacklist'](_0x402544);rpcDb[_0x0a9e('0x115')](_0x402544,_0x0a9e('0x116'));delete _0x29fdfe[_0x0a9e('0x15')][_0x5d577b];_0x74d9b8(ut['message'](_0x0a9e('0x117'),_0x3f0d64,_0x2003bc));}});};Preview[_0x0a9e('0xe')][_0x0a9e('0x9b')]=function(_0x292f02){return!_['isNil'](_0x292f02)&&!_[_0x0a9e('0x72')](_0x292f02[_0x0a9e('0x27')])&&!_[_0x0a9e('0x72')](_0x292f02[_0x0a9e('0x56')])&&_0x292f02[_0x0a9e('0x56')]&&!_[_0x0a9e('0x72')](this[_0x0a9e('0x14')][util[_0x0a9e('0x5e')]('SIP/%s',_0x292f02[_0x0a9e('0x27')])])&&!_[_0x0a9e('0x72')](this[_0x0a9e('0x14')][util[_0x0a9e('0x5e')]('SIP/%s',_0x292f02['name'])][_0x0a9e('0x118')])&&(this[_0x0a9e('0x14')][util[_0x0a9e('0x5e')]('SIP/%s',_0x292f02[_0x0a9e('0x27')])][_0x0a9e('0x118')]==='reachable'||this[_0x0a9e('0x14')][util['format'](_0x0a9e('0x119'),_0x292f02['name'])]['status']==='unmonitored');};Preview[_0x0a9e('0xe')][_0x0a9e('0x8b')]=function(_0x19f800,_0x20007e){var _0x7d59a9=this;return new BPromise(function(_0xe17af8,_0x48fbef){_0x7d59a9[_0x0a9e('0x11a')](_0x19f800,_0x20007e)[_0x0a9e('0x85')](function(_0x1713a7){_0xe17af8(_[_0x0a9e('0x78')](_0x1713a7,[_0x0a9e('0x4e')]));})[_0x0a9e('0x7d')](function(_0x31c937){if(_0x31c937['unlock']){rpcDb['unlockContact'](_0x19f800);}if(_0x31c937[_0x0a9e('0x56')]){rpcDb['disableContact'](_0x19f800);}_0x48fbef(_[_0x0a9e('0x78')](_0x31c937,[_0x0a9e('0x4e')]));});});};Preview[_0x0a9e('0xe')][_0x0a9e('0x11a')]=function(_0x37a448,_0x383dd8){var _0x594f25=this;return new BPromise(function(_0x4716d1,_0x59b872){var _0x50e32a,_0x504403;rpcDb['getContactPreview'](_0x37a448)[_0x0a9e('0x85')](function(_0x5dc978){if(!_['isNil'](_0x5dc978[0x0])){_0x504403=_0x5dc978[0x0][_0x0a9e('0x11b')]?![]:!![];_0x50e32a=_0x5dc978[0x0]['recallme']?!![]:![];_0x50e32a=_0x383dd8?!![]:_0x50e32a;}var _0x24470a=_0x594f25[_0x0a9e('0x11c')](_0x5dc978);if(_0x24470a[_0x0a9e('0x11d')]){rpcDb['checkIsBlackList'](_[_0x0a9e('0x78')](_0x5dc978[0x0],[_0x0a9e('0x10a'),_0x0a9e('0x11e')]))['then'](function(_0x5236c9){_0x594f25[_0x0a9e('0x11f')](_0x5236c9,_0x5dc978[0x0],_0x383dd8,_0x504403,_0x50e32a)[_0x0a9e('0x85')](function(_0x89d2cb){_0x4716d1(_0x89d2cb);})[_0x0a9e('0x7d')](function(_0x3b0db2){_0x59b872(_0x3b0db2);});})[_0x0a9e('0x7d')](function(_0x247a6c){ut[_0x0a9e('0x64')](_0x0a9e('0x120'),_0x247a6c);_0x59b872(ut[_0x0a9e('0x4e')]('Call\x20unsuccessful',_0x504403,_0x50e32a));});}else{_0x59b872(ut['message'](_0x24470a['message'],_0x504403,_0x50e32a));}})[_0x0a9e('0x7d')](function(_0x19dcc2){ut[_0x0a9e('0x64')](_0x0a9e('0x121'),_0x19dcc2);_0x59b872(ut[_0x0a9e('0x4e')](_0x0a9e('0x122'),![],!![]));});});};Preview[_0x0a9e('0xe')][_0x0a9e('0x11c')]=function(_0x5d74e9){if(_['isNil'](_0x5d74e9)||_[_0x0a9e('0x10d')](_0x5d74e9)||!_[_0x0a9e('0x72')](_0x5d74e9[0x0]['Agent'])&&_[_0x0a9e('0x72')](_0x5d74e9[0x0][_0x0a9e('0x89')][_0x0a9e('0x27')])){ut[_0x0a9e('0x64')](_0x0a9e('0x123'),_0x5d74e9);return{'isValid':![],'message':_0x0a9e('0x124')};}var _0x167196=this[_0x0a9e('0x12')][_0x5d74e9[0x0][_0x0a9e('0x73')][_0x0a9e('0x27')]];_0x167196[_0x0a9e('0x4e')]=_0x0a9e('0x9e');if(_['isNil'](_0x167196)){ut[_0x0a9e('0x64')](_0x0a9e('0x125'),_0x167196);return{'isValid':![],'message':_0x0a9e('0x126')};}if(!this[_0x0a9e('0x9b')](_0x167196[_0x0a9e('0x55')])){ut[_0x0a9e('0x64')](_0x0a9e('0x127'),_0x0a9e('0x128')+_0x167196[_0x0a9e('0x27')]+_0x0a9e('0x129'));if(!this[_0x0a9e('0x9b')](_0x167196[_0x0a9e('0x9c')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x167196[_0x0a9e('0x27')]+_0x0a9e('0x12a'));return{'isValid':![],'message':_0x0a9e('0x12b')};}}if(!ut[_0x0a9e('0x9a')](_0x167196[_0x0a9e('0x34')])){ut[_0x0a9e('0x64')](_0x0a9e('0x12c'),_0x167196['name']+_0x0a9e('0x12d'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x167196[_0x0a9e('0x27')]+_0x0a9e('0x12d')};}return{'isValid':!![],'message':_0x0a9e('0x12e')};};Preview[_0x0a9e('0xe')][_0x0a9e('0x12f')]=function(_0x358f74,_0x465003,_0x261eca,_0xa7a754){var _0x32a199=this;return new BPromise(function(_0x39d367,_0x8231e5){var _0x43111e=_0x358f74[_0x0a9e('0xb9')];var _0x3c8a9a=_0x32a199[_0x0a9e('0x9b')](_0x465003['Trunk'])?util['format'](_0x0a9e('0x130'),_0x465003[_0x0a9e('0x55')]['name'],_['isNil'](_0x465003[_0x0a9e('0x131')])?'':_0x465003[_0x0a9e('0x131')][_0x0a9e('0x132')]()||'',_0x465003['dialCutDigit']>0x0?_0x261eca[_0x0a9e('0x11e')]['substring'](_0x465003[_0x0a9e('0x133')]):_0x261eca['phone']):util[_0x0a9e('0x5e')]('SIP/%s/%s%s',_[_0x0a9e('0x72')](_0x465003[_0x0a9e('0x9c')])?_0x465003[_0x0a9e('0x55')]['name']:_0x465003[_0x0a9e('0x9c')]['name'],_['isNil'](_0x465003[_0x0a9e('0x131')])?'':_0x465003[_0x0a9e('0x131')][_0x0a9e('0x132')]()||'',_0x465003[_0x0a9e('0x133')]>0x0?_0x261eca[_0x0a9e('0x11e')][_0x0a9e('0x134')](_0x465003[_0x0a9e('0x133')]):_0x261eca[_0x0a9e('0x11e')]);var _0x1a3143=_0x32a199[_0x0a9e('0x9b')](_0x465003[_0x0a9e('0x55')])?ut[_0x0a9e('0x135')](_0x465003[_0x0a9e('0x55')][_0x0a9e('0x57')],_0x465003[_0x0a9e('0x35')],_0x465003[_0x0a9e('0x136')]>0x0?ut[_0x0a9e('0x137')](_0x465003[_0x0a9e('0x138')],_0x465003[_0x0a9e('0x136')]):_0x465003['dialOriginateCallerIdNumber']):ut[_0x0a9e('0x135')](_[_0x0a9e('0x72')](_0x465003[_0x0a9e('0x9c')])?_0x465003[_0x0a9e('0x55')]['callerid']:_0x465003['TrunkBackup']['callerid'],_0x465003[_0x0a9e('0x35')],_0x465003['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0a9e('0x137')](_0x465003[_0x0a9e('0x138')],_0x465003[_0x0a9e('0x136')]):_0x465003[_0x0a9e('0x138')]);if(_0x1a3143){_0x358f74[_0x0a9e('0x139')]=ut[_0x0a9e('0x13a')](_0x1a3143);_0x358f74[_0x0a9e('0x13b')]=ut[_0x0a9e('0x13c')](_0x1a3143);}var _0x2154d8=ut[_0x0a9e('0x13d')](_0x465003,_0x261eca,_0x3c8a9a,_0x1a3143,_0x43111e,_0x358f74);_['merge'](_0x358f74,ut[_0x0a9e('0x13e')](_0x2154d8));_0x358f74['starttime']=moment()[_0x0a9e('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x0a9e('0x7c')](ut[_0x0a9e('0x13f')](_0x358f74,_0x465003,_0x2154d8,_0x358f74[_0x0a9e('0xae')],_0xa7a754))['then'](function(_0x920ad8){_0x465003[_0x0a9e('0x4f')]+=0x1;logger['info']('[originated][increment]',_0x43111e,_0x0a9e('0xba'),_0x465003[_0x0a9e('0x27')],_0x0a9e('0x75'),_0x465003['originated']);_0x39d367(_0x920ad8);})['catch'](function(_0x4869c1){ut[_0x0a9e('0xfd')](_0x358f74,0xe,_0x0a9e('0x140'));rpcDb[_0x0a9e('0xff')](_0x358f74,_0x0a9e('0x141'));_0x8231e5(_0x4869c1);});});};Preview[_0x0a9e('0xe')][_0x0a9e('0x142')]=function(_0x183b9b){if(this[_0x0a9e('0x15')][_0x183b9b[_0x0a9e('0xaf')]]){this[_0x0a9e('0x15')][_0x183b9b[_0x0a9e('0xaf')]][_0x0a9e('0x143')]=_0x183b9b[_0x0a9e('0x143')];}};Preview[_0x0a9e('0xe')][_0x0a9e('0x19')]=function(_0x1a74c4){var _0x94e69b=this;var _0x320367=this['actions'][_0x1a74c4[_0x0a9e('0x144')]];if(_0x320367){if(_0x320367[_0x0a9e('0x10c')]&&this[_0x0a9e('0x16')][_0x320367[_0x0a9e('0x10c')]]){ut[_0x0a9e('0x145')](_0x320367,this[_0x0a9e('0x16')][_0x320367['lookAgent']][_0x0a9e('0x27')],this[_0x0a9e('0x16')][_0x320367[_0x0a9e('0x10c')]]['id']);}var _0x1109de=_[_0x0a9e('0x146')](_0x320367);_0x1109de[_0x0a9e('0xb6')]=moment()[_0x0a9e('0x5e')](_0x0a9e('0xb5'));var _0x4175a6=_0x94e69b['campaignsPreview'][_0x320367['queue']];if(ut[_0x0a9e('0x147')](_0x1a74c4[_0x0a9e('0x148')])){if(_0x320367['unlockAgent']){rpcDb[_0x0a9e('0x149')](_0x320367[_0x0a9e('0xb1')]);}if(_0x320367['activeContact']){rpcDb[_0x0a9e('0x8d')](_0x320367['idContact']);}ami[_0x0a9e('0x5f')](_0x0a9e('0x14a'),ut['buildObj'](_0x320367,_0x0a9e('0x14b'),this[_0x0a9e('0x12')][_0x320367['queue']]));this[_0x0a9e('0xfa')](_0x1109de,_0x4175a6,_0x1a74c4);}else{_0x320367[_0x0a9e('0x8e')]=moment()['format'](_0x0a9e('0xb5'));ut[_0x0a9e('0xfd')](_0x1109de,0x4,_0x0a9e('0xc2'));rpcDb[_0x0a9e('0xff')](_0x1109de,_0x0a9e('0x14c'));}}};Preview[_0x0a9e('0xe')]['syncHangup']=function(_0x1e5b09){var _0x36dc4f=this;var _0x51e697=this[_0x0a9e('0x15')][_0x1e5b09[_0x0a9e('0xaf')]];var _0x22c390;if(_0x51e697){_0x22c390=this[_0x0a9e('0x12')][_0x51e697[_0x0a9e('0x74')]];logger[_0x0a9e('0x5c')](_0x0a9e('0x14d'),_0x1e5b09['linkedid'],'\x20Queue',_0x22c390['name'],'pTalking:\x20',_0x22c390['pTalking']);}if(this[_0x0a9e('0x15')][_0x1e5b09[_0x0a9e('0xaf')]]&&_0x1e5b09['linkedid']!==_0x1e5b09['uniqueid']){if(_0x1e5b09[_0x0a9e('0x14e')]==='16'&&this['actions'][_0x1e5b09[_0x0a9e('0xaf')]][_0x0a9e('0x77')]){this[_0x0a9e('0x9f')](_0x1e5b09,_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')]);}else if(this[_0x0a9e('0x15')][_0x1e5b09['linkedid']][_0x0a9e('0x77')]){logger[_0x0a9e('0x5c')]('[syncHangup][talking][cause]',_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')],_0x0a9e('0xba'),_0x22c390[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x22c390[_0x0a9e('0x2b')]);this[_0x0a9e('0x9f')](_0x1e5b09,_0x1e5b09['linkedid'],_0x1e5b09[_0x0a9e('0x14e')]);}}else if(_0x51e697&&_['isNil'](_0x51e697[_0x0a9e('0x14f')])&&_0x22c390[_0x0a9e('0x150')]&&_0x1e5b09['linkedid']===_0x1e5b09[_0x0a9e('0xb9')]&&_[_0x0a9e('0x72')](_0x1e5b09['reason'])&&_0x1e5b09[_0x0a9e('0x14e')]==='16'&&_0x1e5b09['channelstate']==='6'&&_[_0x0a9e('0xfb')](_0x51e697[_0x0a9e('0x151')])){if(_0x51e697['unlockAgent']){rpcDb[_0x0a9e('0x149')](_0x51e697['idContact']);}if(_0x51e697[_0x0a9e('0xae')]){rpcDb[_0x0a9e('0x8d')](_0x51e697[_0x0a9e('0xb1')]);}_0x1e5b09[_0x0a9e('0xfc')]='22';this[_0x0a9e('0xfa')](_0x51e697,_0x22c390,_0x1e5b09);}else if(_0x51e697&&_0x51e697[_0x0a9e('0x151')]){if(_0x1e5b09[_0x0a9e('0x14e')]==='16'&&this['actions'][_0x1e5b09[_0x0a9e('0xaf')]][_0x0a9e('0x77')]){logger[_0x0a9e('0x5c')](_0x0a9e('0x152'),_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09['cause'],_0x0a9e('0xba'),_0x22c390['name'],'pTalking:\x20',_0x22c390[_0x0a9e('0x2b')]);this['callProgressDetectingCustomer'](_0x1e5b09,_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')]);}else if(this['actions'][_0x1e5b09[_0x0a9e('0xaf')]][_0x0a9e('0x77')]){logger[_0x0a9e('0x5c')](_0x0a9e('0x153'),_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')],_0x0a9e('0xba'),_0x22c390[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x22c390['pTalking']);this[_0x0a9e('0x9f')](_0x1e5b09,_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')]);}}};Preview[_0x0a9e('0xe')]['syncDialEnd']=function(_0x38d95a){if(this[_0x0a9e('0x15')][_0x38d95a[_0x0a9e('0xf9')]]&&_0x38d95a['destlinkedid']!==_0x38d95a[_0x0a9e('0x154')]){this[_0x0a9e('0x9f')](_0x38d95a,_0x38d95a[_0x0a9e('0xf9')],_0x38d95a['dialstatus']);}};Preview[_0x0a9e('0xe')]['syncHangupRequest']=function(_0x2394f2){if(this[_0x0a9e('0x15')][_0x2394f2[_0x0a9e('0xaf')]]&&_0x2394f2[_0x0a9e('0xaf')]!==_0x2394f2[_0x0a9e('0xb9')]&&!this[_0x0a9e('0x15')][_0x2394f2[_0x0a9e('0xaf')]]['dialAnswer']){if(_0x2394f2[_0x0a9e('0x14e')]==='1'){this[_0x0a9e('0x9f')](_0x2394f2,_0x2394f2[_0x0a9e('0xaf')],_0x2394f2[_0x0a9e('0x14e')]);}}};Preview[_0x0a9e('0xe')][_0x0a9e('0x155')]=function(_0x3a4def,_0x2670f5,_0x2310ca){if(this[_0x0a9e('0x15')][_0x3a4def]){if(_[_0x0a9e('0x72')](this[_0x0a9e('0x15')][_0x3a4def][_0x0a9e('0x156')])){this[_0x0a9e('0x15')][_0x3a4def][_0x0a9e('0x156')]={};}this[_0x0a9e('0x15')][_0x3a4def][_0x0a9e('0x156')][_0x2670f5]=_0x2310ca;}};Preview[_0x0a9e('0xe')][_0x0a9e('0x21')]=function(_0x611e46){try{if(!_[_0x0a9e('0x72')](_0x611e46)){if(ut[_0x0a9e('0x157')](_[_0x0a9e('0x158')](_0x611e46['variable'])[0x0])){this[_0x0a9e('0x155')](_0x611e46[_0x0a9e('0xb9')],_[_0x0a9e('0x158')](_0x611e46['variable'])[0x0],_0x611e46[_0x0a9e('0x159')]);}}}catch(_0x4c925e){logger[_0x0a9e('0x15a')](_0x0a9e('0x15b'),util[_0x0a9e('0x15c')](_0x4c925e,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xe')][_0x0a9e('0x23')]=function(_0xb09ef6){if(_0xb09ef6){if(this[_0x0a9e('0x15')][_0xb09ef6[_0x0a9e('0x15d')]]){this['actions'][_0xb09ef6[_0x0a9e('0x15d')]][_0x0a9e('0x151')]=!![];}}};Preview['prototype'][_0x0a9e('0x25')]=function(_0x2db8fe){if(_0x2db8fe){if(this[_0x0a9e('0x15')][_0x2db8fe['transfererlinkedid']]){this[_0x0a9e('0x15')][_0x2db8fe[_0x0a9e('0x15e')]][_0x0a9e('0x151')]=!![];}}};module[_0x0a9e('0x15f')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 4127a1c..ec67e07 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 _0xee8f=['queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','checkIsBlackList','getContactPreview','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0xee8f,0x185));var _0xfee8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xee8f[_0x17d9e3];return _0x14192d;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xfee8('0x0'))(_0xfee8('0x1'));var _=require(_0xfee8('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xfee8('0x3'));var cmHopperHistory=require(_0xfee8('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xfee8('0x5'));var voiceQueueReport=require(_0xfee8('0x6'));function loggerCatch(_0x149848){return function(_0xe5b4e4){logger[_0xfee8('0x7')](_0x149848,util['inspect'](_0xe5b4e4,{'showHidden':![],'depth':null}));};}function create(_0x4feb6e){return BPromise[_0xfee8('0x8')]()['then'](cmHopperHistory[_0xfee8('0x9')](_0x4feb6e))[_0xfee8('0xa')](loggerCatch(_0xfee8('0xb')));}function createAgent(_0x4affd5){return BPromise[_0xfee8('0x8')]()['then'](agentReportPreview[_0xfee8('0x9')](_0x4affd5))[_0xfee8('0xa')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x2ea959){return BPromise['resolve']()[_0xfee8('0xc')](cmHopper[_0xfee8('0xd')](_0x2ea959,!![]))[_0xfee8('0xa')](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x433ad7){return BPromise[_0xfee8('0x8')]()['then'](cmHopperBlack[_0xfee8('0xe')](_0x433ad7))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x406d3c){return BPromise[_0xfee8('0x8')]()['then'](cmHopper[_0xfee8('0xf')](_0x406d3c))['catch'](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0xd90c44,_0x3a85f0){create(_0xd90c44)[_0xfee8('0xa')](loggerCatch(_0x3a85f0));moveContact(_0xd90c44)[_0xfee8('0xa')](loggerCatch(_0x3a85f0));};exports[_0xfee8('0x10')]=function(_0x4ae1fa,_0x18139c){createAgent(_0x4ae1fa)['catch'](loggerCatch(_0x18139c));};exports[_0xfee8('0x11')]=function(_0x554b0c,_0x375af9){create(_0x554b0c)[_0xfee8('0xa')](loggerCatch(_0x375af9));};exports['createCustomerFinal']=function(_0x3d2417,_0x3e6305){moveContact(_0x3d2417)[_0xfee8('0xa')](loggerCatch(_0x3e6305));};exports[_0xfee8('0x12')]=function(_0x5092cc,_0x3f115a,_0x237d91){if(_0x3f115a){_0x5092cc[_0xfee8('0x13')]=null;}if(_0x237d91){_0x5092cc[_0xfee8('0x14')]=![];}return BPromise['resolve']()[_0xfee8('0xc')](cmHopper[_0xfee8('0x12')](_0x5092cc))['catch'](loggerCatch(_0xfee8('0x15')));};exports[_0xfee8('0x16')]=function(_0xf4c08f){return BPromise[_0xfee8('0x8')]()[_0xfee8('0xc')](cmHopper[_0xfee8('0x16')](_0xf4c08f))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0xfee8('0x17')]=function(_0x14563f){return BPromise[_0xfee8('0x8')]()['then'](cmHopper[_0xfee8('0x17')]({'UserId':null},_0x14563f,0x1))['catch'](loggerCatch(_0xfee8('0x18')));};exports[_0xfee8('0x19')]=function(_0x153c81){return BPromise['resolve']()[_0xfee8('0xc')](cmHopper[_0xfee8('0x17')]({'active':![]},_0x153c81,0x1))[_0xfee8('0xa')](loggerCatch(_0xfee8('0x1a')));};exports[_0xfee8('0x1b')]=function(_0x3b768e){var _0x3d2298={};_0x3d2298['type']=_0x3b768e[_0xfee8('0x1c')];_0x3d2298[_0xfee8('0x1d')]=_0x3b768e['uniqueid'];_0x3d2298[_0xfee8('0x1e')]=_0x3b768e[_0xfee8('0x1e')];_0x3d2298[_0xfee8('0x1f')]=_0x3b768e[_0xfee8('0x1f')];_0x3d2298['queue']=_0x3b768e[_0xfee8('0x20')];_0x3d2298['queuecallerjoinAt']=_0x3b768e[_0xfee8('0x21')];_0x3d2298[_0xfee8('0x22')]=_0x3b768e[_0xfee8('0x21')];_0x3d2298[_0xfee8('0x23')]=0x1;_0x3d2298[_0xfee8('0x24')]=_0x3b768e[_0xfee8('0x25')];_0x3d2298[_0xfee8('0x26')]=_0x3b768e[_0xfee8('0x27')];_0x3d2298[_0xfee8('0x28')]=_0xfee8('0x29');_0x3d2298[_0xfee8('0x2a')]='xcally-motion-preview';_0x3d2298['holdtime']=0x0;_0x3d2298[_0xfee8('0x2b')]=0x1;_0x3d2298[_0xfee8('0x2c')]=_0x3b768e[_0xfee8('0x27')];_0x3d2298[_0xfee8('0x2d')]=_0xfee8('0x2e');return BPromise['resolve']()[_0xfee8('0xc')](voiceQueueReport[_0xfee8('0x2f')](_0x3d2298))[_0xfee8('0xa')](loggerCatch(_0xfee8('0x30')));};exports[_0xfee8('0x31')]=function(_0x3997f4,_0x15056e){return BPromise[_0xfee8('0x8')]()[_0xfee8('0xc')](cmHopper[_0xfee8('0x31')](_0x3997f4,_0x15056e))[_0xfee8('0xa')](loggerCatch(_0xfee8('0x32')));};exports[_0xfee8('0x33')]=function(_0x1d7cb8){return BPromise[_0xfee8('0x8')]()[_0xfee8('0xc')](cmHopper['rescheduleContact'](_0x1d7cb8,!![],!![]))[_0xfee8('0xa')](loggerCatch(_0xfee8('0x34')));}; \ No newline at end of file +var _0x340c=['createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','from-sip','xcally-motion-preview','membername','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','resolve','then','createHistory','catch','[createHistory]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20'];(function(_0x5bc004,_0x47089f){var _0x44aa6b=function(_0x387a42){while(--_0x387a42){_0x5bc004['push'](_0x5bc004['shift']());}};_0x44aa6b(++_0x47089f);}(_0x340c,0x105));var _0xc340=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x340c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xc340('0x0'));var BPromise=require(_0xc340('0x1'));var logger=require('../../../config/logger')('preview');var _=require('lodash');var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xc340('0x2'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xc340('0x3'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xc340('0x4'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x32662b){return function(_0x47e702){logger[_0xc340('0x5')](_0x32662b,util['inspect'](_0x47e702,{'showHidden':![],'depth':null}));};}function create(_0x4e2c85){return BPromise[_0xc340('0x6')]()[_0xc340('0x7')](cmHopperHistory[_0xc340('0x8')](_0x4e2c85))[_0xc340('0x9')](loggerCatch(_0xc340('0xa')));}function createAgent(_0x10b62b){return BPromise[_0xc340('0x6')]()[_0xc340('0x7')](agentReportPreview[_0xc340('0x8')](_0x10b62b))[_0xc340('0x9')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x300d22){return BPromise[_0xc340('0x6')]()[_0xc340('0x7')](cmHopper['moveContactManagedDialer'](_0x300d22,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xc340('0xb')]=function(_0x5ce26e){return BPromise[_0xc340('0x6')]()[_0xc340('0x7')](cmHopperBlack[_0xc340('0xb')](_0x5ce26e))[_0xc340('0x9')](loggerCatch(_0xc340('0xc')));};exports['getContactPreview']=function(_0x2bc47b){return BPromise[_0xc340('0x6')]()[_0xc340('0x7')](cmHopper[_0xc340('0xd')](_0x2bc47b))[_0xc340('0x9')](loggerCatch(_0xc340('0xe')));};exports[_0xc340('0x8')]=function(_0x2d0eec,_0x11b497){create(_0x2d0eec)[_0xc340('0x9')](loggerCatch(_0x11b497));moveContact(_0x2d0eec)[_0xc340('0x9')](loggerCatch(_0x11b497));};exports[_0xc340('0xf')]=function(_0x3413c1,_0x5029ef){createAgent(_0x3413c1)[_0xc340('0x9')](loggerCatch(_0x5029ef));};exports[_0xc340('0x10')]=function(_0xdabe11,_0x3561d5){create(_0xdabe11)[_0xc340('0x9')](loggerCatch(_0x3561d5));};exports['createCustomerFinal']=function(_0x2af042,_0x5cadad){moveContact(_0x2af042)[_0xc340('0x9')](loggerCatch(_0x5cadad));};exports[_0xc340('0x11')]=function(_0x705abd,_0x784678,_0x30d7eb){if(_0x784678){_0x705abd[_0xc340('0x12')]=null;}if(_0x30d7eb){_0x705abd[_0xc340('0x13')]=![];}return BPromise[_0xc340('0x6')]()[_0xc340('0x7')](cmHopper[_0xc340('0x11')](_0x705abd))['catch'](loggerCatch(_0xc340('0x14')));};exports['countReScheduled']=function(_0x531a78){return BPromise[_0xc340('0x6')]()['then'](cmHopper['countReScheduled'](_0x531a78))['catch'](loggerCatch(_0xc340('0x15')));};exports['unlockContact']=function(_0x24013f){return BPromise[_0xc340('0x6')]()[_0xc340('0x7')](cmHopper[_0xc340('0x16')]({'UserId':null},_0x24013f,0x1))[_0xc340('0x9')](loggerCatch(_0xc340('0x17')));};exports['disableContact']=function(_0x4c59b4){return BPromise[_0xc340('0x6')]()[_0xc340('0x7')](cmHopper['unlockContact']({'active':![]},_0x4c59b4,0x1))[_0xc340('0x9')](loggerCatch(_0xc340('0x18')));};exports['crateCustomerReportQueue']=function(_0x55ed02){var _0x2d703e={};_0x2d703e[_0xc340('0x19')]=_0x55ed02[_0xc340('0x19')];_0x2d703e[_0xc340('0x1a')]=_0x55ed02['uniqueid'];_0x2d703e[_0xc340('0x1b')]=_0x55ed02[_0xc340('0x1b')];_0x2d703e[_0xc340('0x1c')]=_0x55ed02[_0xc340('0x1c')];_0x2d703e[_0xc340('0x1d')]=_0x55ed02[_0xc340('0x1d')];_0x2d703e[_0xc340('0x1e')]=_0x55ed02[_0xc340('0x1f')];_0x2d703e['queuecallerleaveAt']=_0x55ed02['answertime'];_0x2d703e[_0xc340('0x20')]=0x1;_0x2d703e[_0xc340('0x21')]=_0x55ed02[_0xc340('0x22')];_0x2d703e[_0xc340('0x23')]=_0x55ed02['membername'];_0x2d703e['context']=_0xc340('0x24');_0x2d703e['exten']=_0xc340('0x25');_0x2d703e['holdtime']=0x0;_0x2d703e['assigned']=0x1;_0x2d703e['lastAssignedTo']=_0x55ed02[_0xc340('0x26')];_0x2d703e[_0xc340('0x27')]='COMPLETED';return BPromise[_0xc340('0x6')]()[_0xc340('0x7')](voiceQueueReport[_0xc340('0x28')](_0x2d703e))['catch'](loggerCatch(_0xc340('0x29')));};exports[_0xc340('0x2a')]=function(_0x1d81be,_0x4dd9f2){return BPromise[_0xc340('0x6')]()[_0xc340('0x7')](cmHopper[_0xc340('0x2a')](_0x1d81be,_0x4dd9f2))[_0xc340('0x9')](loggerCatch(_0xc340('0x2b')));};exports[_0xc340('0x2c')]=function(_0x56a649){return BPromise[_0xc340('0x6')]()[_0xc340('0x7')](cmHopper[_0xc340('0x11')](_0x56a649,!![],!![]))[_0xc340('0x9')](loggerCatch(_0xc340('0x2d')));}; \ 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 8ff1760..163f594 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 _0x20bc=['127.0.0.1','diff','seconds','error','inspect','logger','info','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','responsetime','endtime','logAgent','statedesc','ringtime','starttime','logLookAgent','UserId','logCustomer','state','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','channelAgent','timeout','countbusyretry','countcongestionretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','reachable','push','milliseconds','createBody','idContact','type','dialAnswer','membername','calleridname','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-dialurl','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','env'];(function(_0x15d702,_0x38e186){var _0xbb1193=function(_0x17dbd7){while(--_0x17dbd7){_0x15d702['push'](_0x15d702['shift']());}};_0xbb1193(++_0x38e186);}(_0x20bc,0x188));var _0xc20b=function(_0x5055f1,_0x3cbb87){_0x5055f1=_0x5055f1-0x0;var _0x28a9f0=_0x20bc[_0x5055f1];return _0x28a9f0;};'use strict';var util=require(_0xc20b('0x0'));var _=require(_0xc20b('0x1'));var moment=require(_0xc20b('0x2'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0xc20b('0x3')]['XCALLY_IP_AGI']||_0xc20b('0x4');function getSeconds(_0x4a8bf2,_0x429ef6){var _0x3265c1=moment(_0x4a8bf2)['milliseconds'](0x0);var _0x21ac20=moment(_0x429ef6)['milliseconds'](0x0);return _0x3265c1[_0xc20b('0x5')](_0x21ac20,_0xc20b('0x6'));}exports['loggerCatch']=function(_0x4fb9f8){return function(_0x57272f){logger[_0xc20b('0x7')](_0x4fb9f8,util[_0xc20b('0x8')](_0x57272f,{'showHidden':![],'depth':null}));};};exports[_0xc20b('0x9')]=function(_0x11b4f0,_0x20e973){logger['info'](_0x11b4f0,util['inspect'](_0x20e973,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x27231e,_0xd210e1){logger['error'](_0x27231e,util[_0xc20b('0x8')](_0xd210e1,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x304c5c){return function(_0x3a8817){logger[_0xc20b('0xa')](_0x304c5c,util[_0xc20b('0x8')](_0x3a8817,{'showHidden':![],'depth':null}));};};exports[_0xc20b('0xb')]=function(_0x5db7fb,_0x49e56e,_0x36fe93){return{'message':_0x5db7fb,'unlock':_0x49e56e,'active':_0x36fe93};};exports['getCallerId']=function(_0x35db99,_0x5ef197,_0x14dfb9){if(!_[_0xc20b('0xc')](_0x14dfb9)&&_0xc20b('0xd')===typeof _0x14dfb9&&!_[_0xc20b('0xe')](_0x14dfb9)){if(!_[_0xc20b('0xc')](_0x5ef197)&&_0xc20b('0xd')===typeof _0x5ef197&&!_['isEmpty'](_0x5ef197)){return util[_0xc20b('0xf')](_0xc20b('0x10'),_0x5ef197,_0x14dfb9);}return util[_0xc20b('0xf')](_0xc20b('0x10'),_0x14dfb9,_0x14dfb9);}if(!_[_0xc20b('0xc')](_0x35db99)&&_0xc20b('0xd')===typeof _0x35db99&&!_[_0xc20b('0xe')](_0x35db99)){return _0x35db99;}return _0xc20b('0x11');};exports[_0xc20b('0x12')]=function(_0x27e691){if(_['isNil'](_0x27e691)){return![];}return _0x27e691;};exports['addVariables']=function(_0x13d5d7,_0x3b2bee,_0x4f346c,_0x24bb18,_0xd00a37,_0x5bf7d2){var _0x332312={'XMD-QUEUE':_0x3b2bee[_0xc20b('0x13')]?_0x3b2bee[_0xc20b('0x13')][_0xc20b('0x14')]:'','XMD-CALLERID':_0x24bb18,'XMD-CALLERID-PREVIEW':_0x5bf7d2?util[_0xc20b('0xf')](_0xc20b('0x10'),_0x5bf7d2['calleridname'],_0x5bf7d2[_0xc20b('0x15')]):_0x24bb18,'XMD-DIALID':_0xd00a37,'XMD-CONTACTID':_0x3b2bee[_0xc20b('0x16')],'XMD-CDRTYPE':_0xc20b('0x17'),'CALLERID(all)':_0x24bb18,'XMD-VOICEQUEUEID':_0x3b2bee[_0xc20b('0x18')],'XMD-DIALCHANNEL':_0x4f346c,'XMD-DIALTIMEOUT':_0x13d5d7[_0xc20b('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0xc20b('0xf')]('\x22rtTxX%s%s\x22',_0x13d5d7[_0xc20b('0x1a')]?'g':'',_[_0xc20b('0xe')](_0x13d5d7[_0xc20b('0x1b')])?'':_0xc20b('0x1c')),'XMD-DIALURL':_0x13d5d7['dialPreviewUrl']||'','XMD-AGI':_0x13d5d7[_0xc20b('0x1d')]?util['format'](_0xc20b('0x1e'),ipAgi,_0x13d5d7[_0xc20b('0x1d')]):_0xc20b('0x1f'),'XMD-AGIAFTER':_0x13d5d7[_0xc20b('0x1a')]?util[_0xc20b('0xf')](_0xc20b('0x1e'),ipAgi,_0x13d5d7['dialQueueProject2']):_0xc20b('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x5bf7d2?_0x5bf7d2[_0xc20b('0x20')]:'','XMD-ORIGINATECALLERIDNAME':_0x5bf7d2?_0x5bf7d2[_0xc20b('0x21')]:'','XMD-DESTINATION':_0xc20b('0x22'),'SIPADDHEADER':_0xc20b('0x23')};if(!_[_0xc20b('0xe')](_0x13d5d7[_0xc20b('0x1b')])){_0x332312[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x13d5d7[_0xc20b('0x1b')];_0x332312[util[_0xc20b('0xf')]('%s',_0xc20b('0x24'))]=_0xd00a37;}if(_0x3b2bee&&_0x3b2bee[_0xc20b('0x25')]){for(var _0x5925cf in _0x3b2bee[_0xc20b('0x25')]){if(_0x3b2bee[_0xc20b('0x25')][_0xc20b('0x26')](_0x5925cf)){if(!_[_0xc20b('0x27')](_0x3b2bee['Contact'][_0x5925cf])&&_0x5925cf!=='id'&&_0x5925cf!=='tags'&&_0x5925cf!=='createdAt'&&_0x5925cf!==_0xc20b('0x28')){_0x332312[util['format'](_0xc20b('0x29'),_0xc20b('0x2a'),_[_0xc20b('0x2b')](_0x5925cf))]=_0x3b2bee[_0xc20b('0x25')][_0x5925cf];}}}}return _0x332312;};exports[_0xc20b('0x2c')]=function(_0x1ec3db){var _0x2ccd18={};for(var _0x1dfb37 in _0x1ec3db){if(_0x1ec3db[_0xc20b('0x26')](_0x1dfb37)){_0x2ccd18[util[_0xc20b('0xf')]('%s',_[_0xc20b('0x2d')](_0x1dfb37))]=_0x1ec3db[_0x1dfb37];}}return{'variables':_0x2ccd18};};exports['updateOriginated']=function(_0x54d838,_0x49aeb7){if(!_[_0xc20b('0x27')](_0x54d838)){if(_0x54d838[_0xc20b('0x26')](_0xc20b('0x2e'))){if(_0x54d838[_0xc20b('0x2e')]>0x0){_0x54d838['originated']-=0x1;}else{logger[_0xc20b('0x7')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x49aeb7);}}}else{logger[_0xc20b('0x7')](_0xc20b('0x2f'),_0x49aeb7);}};exports['logBlacklist']=function(_0x249f1a){var _0x5e1caf=moment()['format'](_0xc20b('0x30'));_0x249f1a['state']=0xd;_0x249f1a['statedesc']='Blacklist';_0x249f1a['starttime']=_0x5e1caf;_0x249f1a[_0xc20b('0x31')]=_0x5e1caf;_0x249f1a[_0xc20b('0x32')]=_0x5e1caf;};exports[_0xc20b('0x33')]=function(_0x4302e9,_0x3face6,_0x38b13c){var _0x222ea3=moment()[_0xc20b('0xf')](_0xc20b('0x30'));_0x4302e9['state']=_0x3face6;_0x4302e9[_0xc20b('0x34')]=_0x38b13c;_0x4302e9[_0xc20b('0x31')]=_0x222ea3;_0x4302e9[_0xc20b('0x35')]=getSeconds(_0x4302e9['responsetime'],_0x4302e9[_0xc20b('0x36')]);};exports[_0xc20b('0x37')]=function(_0x15d3f2,_0x1fdf9b,_0x395ab0){_0x15d3f2['membername']=_0x1fdf9b;_0x15d3f2[_0xc20b('0x38')]=_0x395ab0;};exports[_0xc20b('0x39')]=function(_0x2243ef,_0x1c4e6f,_0x3308b4){var _0x483de0=moment()[_0xc20b('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x2243ef[_0xc20b('0x3a')]=_0x1c4e6f;_0x2243ef[_0xc20b('0x34')]=_0x3308b4;_0x2243ef[_0xc20b('0x31')]=_0x2243ef[_0xc20b('0x31')]?_0x2243ef[_0xc20b('0x31')]:_0x483de0;_0x2243ef[_0xc20b('0x32')]=_0x2243ef[_0xc20b('0x32')]?_0x2243ef[_0xc20b('0x32')]:_0x483de0;_0x2243ef[_0xc20b('0x35')]=getSeconds(_0x2243ef['responsetime']||0x0,_0x2243ef[_0xc20b('0x36')]||0x0);_0x2243ef[_0xc20b('0x3b')]=_0x2243ef[_0xc20b('0x3c')]?getSeconds(_0x2243ef[_0xc20b('0x32')],_0x2243ef[_0xc20b('0x3c')]):0x0;};exports[_0xc20b('0x3d')]=function(_0x4f4d73){return _0x4f4d73===_0xc20b('0x3e');};exports[_0xc20b('0x3f')]=function(_0x28c122,_0x4ba0ea,_0xd6c50d,_0x5aa565,_0x278c94){var _0x5a0905=_0x5aa565?_0xc20b('0x40'):_0x28c122['calleridname'];_0x5a0905=_0x278c94?_0xc20b('0x41'):_0x5a0905;return{'actionid':_0x28c122[_0xc20b('0x42')],'action':'originate','channel':_0x28c122[_0xc20b('0x43')],'callerid':util[_0xc20b('0xf')](_0xc20b('0x10'),_0x5a0905,_0x28c122[_0xc20b('0x15')]),'Exten':_0xc20b('0x22'),'Context':'from-sip','Priority':'1','variable':_0xd6c50d,'timeout':(_0x4ba0ea[_0xc20b('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x28c122[_0xc20b('0x42')]};};exports['totalGlobal']=function(_0x1fbc9b){return _0x1fbc9b[_0xc20b('0x45')]+_0x1fbc9b[_0xc20b('0x46')]+_0x1fbc9b['countnoanswerretry']+_0x1fbc9b['countagentrejectretry']+_0x1fbc9b[_0xc20b('0x47')];};exports[_0xc20b('0x48')]=function(_0x30692e){var _0x119bc8=_[_0xc20b('0x49')](_0x30692e);_0x119bc8[_0xc20b('0x3a')]=0xf;_0x119bc8[_0xc20b('0x34')]=_0xc20b('0x4a');return _0x119bc8;};exports[_0xc20b('0x4b')]=function(_0x46698d,_0x53ecd4,_0x3f3f7a){var _0xa1cb3b={};_0xa1cb3b[_0x53ecd4]=_0x46698d[_0x53ecd4];_0xa1cb3b[_0xc20b('0x4c')]=![];_0xa1cb3b[_0xc20b('0x4d')]=moment()[_0xc20b('0x4e')](_0x3f3f7a,_0xc20b('0x4f'))['format'](_0xc20b('0x30'));_0xa1cb3b['ContactId']=_0x46698d[_0xc20b('0x16')];_0xa1cb3b[_0xc20b('0x50')]=_0x46698d[_0xc20b('0x50')];_0xa1cb3b[_0xc20b('0x18')]=_0x46698d[_0xc20b('0x18')]||undefined;return _0xa1cb3b;};exports[_0xc20b('0x51')]=function(_0x1bb73d,_0x2eb9bb){if(!_['isNil'](_0x1bb73d)){if(_0x1bb73d['pTalking']>0x0){_0x1bb73d[_0xc20b('0x52')]-=0x1;}else{logger[_0xc20b('0x7')](_0x2eb9bb,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xc20b('0x7')](_0x2eb9bb,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xc20b('0x53')]=function(_0x3eff3e){if(_0x3eff3e<=0x0){return!![];}return![];};exports['buildObj']=function(_0x10a6b2,_0x1788c6,_0x2ef539){_0x10a6b2[_0xc20b('0x54')]=_0x1788c6;_0x10a6b2['name']=_0x10a6b2[_0xc20b('0x55')];_0x10a6b2[_0xc20b('0x56')]=_0x10a6b2[_0xc20b('0x43')];_0x10a6b2[_0xc20b('0x57')]=_0xc20b('0x58');if(_0x2ef539){_0x10a6b2[_0xc20b('0x59')]=_0x2ef539['mandatoryDisposition'];}return _0x10a6b2;};exports[_0xc20b('0x5a')]=function(_0x1e476f){var _0x3d45dd={};_0x3d45dd['queue']=_0x1e476f['queue'];_0x3d45dd[_0xc20b('0x56')]=_0x1e476f[_0xc20b('0x43')];_0x3d45dd[_0xc20b('0x42')]=_0x1e476f[_0xc20b('0x42')];return _0x3d45dd;};exports['agentReadyId']=function(_0x503072){var _0x2990d4=[];for(var _0x8e6dab in _0x503072){if(_0x503072[_0xc20b('0x26')](_0x8e6dab)){if(!_['isNil'](_0x503072[_0x8e6dab])&&_0x503072[_0x8e6dab][_0xc20b('0x3a')]==='not_inuse'&&_0x503072[_0x8e6dab]['status']===_0xc20b('0x5b')){_0x2990d4[_0xc20b('0x5c')](_0x503072[_0x8e6dab]['id']);}}}return _0x2990d4;};exports['getDiff']=function(_0x493d35){var _0x26f6fb=moment()[_0xc20b('0x5d')](0x0);var _0x308512=moment(_0x493d35)['milliseconds'](0x0);return _0x26f6fb[_0xc20b('0x5')](_0x308512,'seconds');};exports[_0xc20b('0x5e')]=function(_0x44f911){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x44f911[_0xc20b('0x16')],'ListId':_0x44f911['ListId'],'VoiceQueueId':_0x44f911[_0xc20b('0x18')]||undefined,'CampaignId':_0x44f911['CampaignId']||undefined};};exports['filterKey']=function(_0x2defea){if(_0x2defea===_0xc20b('0x42')||_0x2defea===_0xc20b('0x5f')||_0x2defea==='queue'||_0x2defea===_0xc20b('0x60')||_0x2defea==='campaigntype'||_0x2defea===_0xc20b('0x61')||_0x2defea===_0xc20b('0x62')||_0x2defea===_0xc20b('0x43')||_0x2defea===_0xc20b('0x63')||_0x2defea===_0xc20b('0x4c')||_0x2defea===_0xc20b('0x15')||_0x2defea===_0xc20b('0x4d')||_0x2defea===_0xc20b('0x45')||_0x2defea===_0xc20b('0x46')||_0x2defea===_0xc20b('0x64')||_0x2defea===_0xc20b('0x65')||_0x2defea===_0xc20b('0x66')||_0x2defea===_0xc20b('0x67')||_0x2defea===_0xc20b('0x68')||_0x2defea===_0xc20b('0x69')||_0x2defea===_0xc20b('0x16')||_0x2defea==='ListId'||_0x2defea===_0xc20b('0x38')||_0x2defea===_0xc20b('0x18')||_0x2defea==='sipcallid'||_0x2defea===_0xc20b('0x6a')||_0x2defea===_0xc20b('0x6b')||_0x2defea==='xmd-phone'||_0x2defea==='xmd-listid'||_0x2defea===_0xc20b('0x6c')||_0x2defea==='xmd-dialtimeout'||_0x2defea==='xmd-dialoptions'||_0x2defea===_0xc20b('0x6d')||_0x2defea===_0xc20b('0x6e')||_0x2defea==='xmd-contactid'||_0x2defea===_0xc20b('0x6f')||_0x2defea===_0xc20b('0x70')||_0x2defea===_0xc20b('0x71')||_0x2defea===_0xc20b('0x72')||_0x2defea===_0xc20b('0x73')||_0x2defea==='rtpaudioqosbridged'||_0x2defea===_0xc20b('0x74')||_0x2defea===_0xc20b('0x75')||_0x2defea===_0xc20b('0x76')||_0x2defea==='rtpaudioqoslossbridged'||_0x2defea===_0xc20b('0x77')||_0x2defea===_0xc20b('0x78')||_0x2defea===_0xc20b('0x73')||_0x2defea===_0xc20b('0x79')||_0x2defea===_0xc20b('0x74')||_0x2defea==='rtpaudioqosjitterbridged'||_0x2defea===_0xc20b('0x76')||_0x2defea===_0xc20b('0x7a')||_0x2defea===_0xc20b('0x77')||_0x2defea===_0xc20b('0x78')||_0x2defea===_0xc20b('0x7b')||_0x2defea===_0xc20b('0x7c')||_0x2defea==='state'||_0x2defea===_0xc20b('0x34')){return![];}return!![];};exports[_0xc20b('0x7d')]=function(_0x17c04c,_0x1d6d22){var _0x4faf8b,_0x4d262b,_0x43a178;if(_0x1d6d22<=0x0){_0x1d6d22=0x1;}_0x4faf8b=new RegExp('\x5cw{0,'+_0x1d6d22+'}$');_0x4d262b=Math[_0xc20b('0x7e')](0xa,_0x1d6d22-0x1);_0x43a178=Math['pow'](0xa,_0x1d6d22)-0x1;return util[_0xc20b('0xf')]('%s',_[_0xc20b('0x7f')](_0x17c04c,_0x4faf8b,_[_0xc20b('0x80')](_0x4d262b,_0x43a178)));};exports[_0xc20b('0x81')]=function(_0x41d66f){var _0x13d57d=_0x41d66f[_0xc20b('0x82')](/"(.*?)"/);return _0x13d57d?_0x13d57d[0x1]:_0x41d66f;};exports[_0xc20b('0x83')]=function(_0x5f018c){var _0x532dc8=_0x5f018c[_0xc20b('0x82')](/<(.*?)>/);return _0x532dc8?_0x532dc8[0x1]:_0x5f018c;}; \ No newline at end of file +var _0x34bb=['preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','%s%s','XMD-','toUpper','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','talktime','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','scheduledat','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','queue','motionChannel','mandatoryDisposition','buildAcw','interface','agentReadyId','status','reachable','push','getDiff','filterKey','idContact','campaigntype','active','countnoanswerretry','callback','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','moment','../../../../config/logger'];(function(_0x1182bd,_0x52ebf2){var _0x5c868b=function(_0x2c905f){while(--_0x2c905f){_0x1182bd['push'](_0x1182bd['shift']());}};_0x5c868b(++_0x52ebf2);}(_0x34bb,0x11d));var _0xb34b=function(_0x4ce5a0,_0x55f3e8){_0x4ce5a0=_0x4ce5a0-0x0;var _0x2d4d84=_0x34bb[_0x4ce5a0];return _0x2d4d84;};'use strict';var util=require(_0xb34b('0x0'));var _=require('lodash');var moment=require(_0xb34b('0x1'));var logger=require(_0xb34b('0x2'))(_0xb34b('0x3'));var ipAgi=process[_0xb34b('0x4')][_0xb34b('0x5')]||_0xb34b('0x6');function getSeconds(_0x4fda09,_0x39318f){var _0x4eb3cc=moment(_0x4fda09)[_0xb34b('0x7')](0x0);var _0x51550a=moment(_0x39318f)[_0xb34b('0x7')](0x0);return _0x4eb3cc[_0xb34b('0x8')](_0x51550a,_0xb34b('0x9'));}exports[_0xb34b('0xa')]=function(_0x31508d){return function(_0x1c148b){logger[_0xb34b('0xb')](_0x31508d,util[_0xb34b('0xc')](_0x1c148b,{'showHidden':![],'depth':null}));};};exports[_0xb34b('0xd')]=function(_0x1ec8bf,_0x226b51){logger[_0xb34b('0xe')](_0x1ec8bf,util[_0xb34b('0xc')](_0x226b51,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x94c21c,_0x3b03a0){logger[_0xb34b('0xb')](_0x94c21c,util[_0xb34b('0xc')](_0x3b03a0,{'showHidden':![],'depth':null}));};exports[_0xb34b('0xf')]=function(_0xe8563){return function(_0x1f4558){logger[_0xb34b('0xe')](_0xe8563,util[_0xb34b('0xc')](_0x1f4558,{'showHidden':![],'depth':null}));};};exports[_0xb34b('0x10')]=function(_0x39032d,_0x3b1288,_0xf7c67c){return{'message':_0x39032d,'unlock':_0x3b1288,'active':_0xf7c67c};};exports[_0xb34b('0x11')]=function(_0x2d7038,_0x4aeb20,_0x348c54){if(!_[_0xb34b('0x12')](_0x348c54)&&'string'===typeof _0x348c54&&!_[_0xb34b('0x13')](_0x348c54)){if(!_['isUndefined'](_0x4aeb20)&&_0xb34b('0x14')===typeof _0x4aeb20&&!_[_0xb34b('0x13')](_0x4aeb20)){return util[_0xb34b('0x15')]('\x22%s\x22\x20<%s>',_0x4aeb20,_0x348c54);}return util[_0xb34b('0x15')](_0xb34b('0x16'),_0x348c54,_0x348c54);}if(!_[_0xb34b('0x12')](_0x2d7038)&&_0xb34b('0x14')===typeof _0x2d7038&&!_[_0xb34b('0x13')](_0x2d7038)){return _0x2d7038;}return _0xb34b('0x17');};exports[_0xb34b('0x18')]=function(_0x1d38ba){if(_[_0xb34b('0x19')](_0x1d38ba)){return![];}return _0x1d38ba;};exports[_0xb34b('0x1a')]=function(_0x658406,_0x2c98be,_0x5c1423,_0x151a64,_0xe24024,_0x1e9dca){var _0x1db8bd={'XMD-QUEUE':_0x2c98be[_0xb34b('0x1b')]?_0x2c98be[_0xb34b('0x1b')][_0xb34b('0x1c')]:'','XMD-CALLERID':_0x151a64,'XMD-CALLERID-PREVIEW':_0x1e9dca?util[_0xb34b('0x15')]('\x22%s\x22\x20<%s>',_0x1e9dca['calleridname'],_0x1e9dca[_0xb34b('0x1d')]):_0x151a64,'XMD-DIALID':_0xe24024,'XMD-CONTACTID':_0x2c98be[_0xb34b('0x1e')],'XMD-CDRTYPE':_0xb34b('0x1f'),'CALLERID(all)':_0x151a64,'XMD-VOICEQUEUEID':_0x2c98be[_0xb34b('0x20')],'XMD-DIALCHANNEL':_0x5c1423,'XMD-DIALTIMEOUT':_0x658406[_0xb34b('0x21')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xb34b('0x22'),_0x658406[_0xb34b('0x23')]?'g':'',_[_0xb34b('0x13')](_0x658406[_0xb34b('0x24')])?'':_0xb34b('0x25')),'XMD-DIALURL':_0x658406[_0xb34b('0x26')]||'','XMD-AGI':_0x658406['dialQueueProject']?util[_0xb34b('0x15')](_0xb34b('0x27'),ipAgi,_0x658406['dialQueueProject']):_0xb34b('0x28'),'XMD-AGIAFTER':_0x658406[_0xb34b('0x23')]?util[_0xb34b('0x15')](_0xb34b('0x27'),ipAgi,_0x658406['dialQueueProject2']):_0xb34b('0x28'),'XMD-ORIGINATECALLERIDNUM':_0x1e9dca?_0x1e9dca['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x1e9dca?_0x1e9dca[_0xb34b('0x29')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xb34b('0x2a')};if(!_[_0xb34b('0x13')](_0x658406[_0xb34b('0x24')])){_0x1db8bd[util['format']('%s',_0xb34b('0x2b'))]=_0x658406[_0xb34b('0x24')];_0x1db8bd[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0xe24024;}if(_0x2c98be&&_0x2c98be['Contact']){for(var _0xb82c0e in _0x2c98be['Contact']){if(_0x2c98be[_0xb34b('0x2c')][_0xb34b('0x2d')](_0xb82c0e)){if(!_['isNil'](_0x2c98be[_0xb34b('0x2c')][_0xb82c0e])&&_0xb82c0e!=='id'&&_0xb82c0e!==_0xb34b('0x2e')&&_0xb82c0e!=='createdAt'&&_0xb82c0e!=='updatedAt'){_0x1db8bd[util['format'](_0xb34b('0x2f'),_0xb34b('0x30'),_[_0xb34b('0x31')](_0xb82c0e))]=_0x2c98be[_0xb34b('0x2c')][_0xb82c0e];}}}}return _0x1db8bd;};exports['toLowerVariables']=function(_0x15b324){var _0x32a8e9={};for(var _0x2a7f2f in _0x15b324){if(_0x15b324[_0xb34b('0x2d')](_0x2a7f2f)){_0x32a8e9[util[_0xb34b('0x15')]('%s',_[_0xb34b('0x32')](_0x2a7f2f))]=_0x15b324[_0x2a7f2f];}}return{'variables':_0x32a8e9};};exports[_0xb34b('0x33')]=function(_0x4b99fd,_0x301cec){if(!_[_0xb34b('0x19')](_0x4b99fd)){if(_0x4b99fd[_0xb34b('0x2d')](_0xb34b('0x34'))){if(_0x4b99fd['originated']>0x0){_0x4b99fd[_0xb34b('0x34')]-=0x1;}else{logger[_0xb34b('0xb')](_0xb34b('0x35'),_0x301cec);}}}else{logger[_0xb34b('0xb')](_0xb34b('0x36'),_0x301cec);}};exports[_0xb34b('0x37')]=function(_0x24341e){var _0x17770c=moment()['format'](_0xb34b('0x38'));_0x24341e[_0xb34b('0x39')]=0xd;_0x24341e[_0xb34b('0x3a')]=_0xb34b('0x3b');_0x24341e[_0xb34b('0x3c')]=_0x17770c;_0x24341e[_0xb34b('0x3d')]=_0x17770c;_0x24341e[_0xb34b('0x3e')]=_0x17770c;};exports[_0xb34b('0x3f')]=function(_0x3e2e31,_0x4ecae3,_0x1193af){var _0x237e97=moment()[_0xb34b('0x15')](_0xb34b('0x38'));_0x3e2e31[_0xb34b('0x39')]=_0x4ecae3;_0x3e2e31[_0xb34b('0x3a')]=_0x1193af;_0x3e2e31[_0xb34b('0x3d')]=_0x237e97;_0x3e2e31[_0xb34b('0x40')]=getSeconds(_0x3e2e31['responsetime'],_0x3e2e31[_0xb34b('0x3c')]);};exports[_0xb34b('0x41')]=function(_0x5f4298,_0x5e7f2f,_0x274a72){_0x5f4298[_0xb34b('0x42')]=_0x5e7f2f;_0x5f4298[_0xb34b('0x43')]=_0x274a72;};exports['logCustomer']=function(_0xe133a8,_0x372433,_0x311155){var _0x228b71=moment()[_0xb34b('0x15')](_0xb34b('0x38'));_0xe133a8['state']=_0x372433;_0xe133a8[_0xb34b('0x3a')]=_0x311155;_0xe133a8[_0xb34b('0x3d')]=_0xe133a8['responsetime']?_0xe133a8['responsetime']:_0x228b71;_0xe133a8[_0xb34b('0x3e')]=_0xe133a8['endtime']?_0xe133a8['endtime']:_0x228b71;_0xe133a8[_0xb34b('0x40')]=getSeconds(_0xe133a8['responsetime']||0x0,_0xe133a8['starttime']||0x0);_0xe133a8[_0xb34b('0x44')]=_0xe133a8['answertime']?getSeconds(_0xe133a8['endtime'],_0xe133a8[_0xb34b('0x45')]):0x0;};exports[_0xb34b('0x46')]=function(_0x7b6e19){return _0x7b6e19===_0xb34b('0x47');};exports[_0xb34b('0x48')]=function(_0x47350a,_0x49365a,_0x5867a5,_0x3971d9,_0x1b8882){var _0x197c8c=_0x3971d9?_0xb34b('0x49'):_0x47350a[_0xb34b('0x4a')];_0x197c8c=_0x1b8882?_0xb34b('0x4b'):_0x197c8c;return{'actionid':_0x47350a[_0xb34b('0x4c')],'action':_0xb34b('0x4d'),'channel':_0x47350a[_0xb34b('0x4e')],'callerid':util[_0xb34b('0x15')](_0xb34b('0x16'),_0x197c8c,_0x47350a['calleridnum']),'Exten':'xcally-motion-preview','Context':_0xb34b('0x4f'),'Priority':'1','variable':_0x5867a5,'timeout':(_0x49365a[_0xb34b('0x50')]||0x1e)*0x3e8,'async':!![],'channelid':_0x47350a[_0xb34b('0x4c')]};};exports[_0xb34b('0x51')]=function(_0x411b51){return _0x411b51[_0xb34b('0x52')]+_0x411b51[_0xb34b('0x53')]+_0x411b51['countnoanswerretry']+_0x411b51[_0xb34b('0x54')]+_0x411b51['countnosuchnumberretry'];};exports[_0xb34b('0x55')]=function(_0x3af837){var _0x492a85=_[_0xb34b('0x56')](_0x3af837);_0x492a85[_0xb34b('0x39')]=0xf;_0x492a85['statedesc']=_0xb34b('0x57');return _0x492a85;};exports[_0xb34b('0x58')]=function(_0x3d374c,_0x2c073d,_0x350d0d){var _0x1d2750={};_0x1d2750[_0x2c073d]=_0x3d374c[_0x2c073d];_0x1d2750['active']=![];_0x1d2750[_0xb34b('0x59')]=moment()['add'](_0x350d0d,'minutes')[_0xb34b('0x15')](_0xb34b('0x38'));_0x1d2750[_0xb34b('0x1e')]=_0x3d374c[_0xb34b('0x1e')];_0x1d2750[_0xb34b('0x5a')]=_0x3d374c[_0xb34b('0x5a')];_0x1d2750[_0xb34b('0x20')]=_0x3d374c[_0xb34b('0x20')]||undefined;return _0x1d2750;};exports[_0xb34b('0x5b')]=function(_0x232c9a,_0x352a8e){if(!_[_0xb34b('0x19')](_0x232c9a)){if(_0x232c9a[_0xb34b('0x5c')]>0x0){_0x232c9a['pTalking']-=0x1;}else{logger[_0xb34b('0xb')](_0x352a8e,_0xb34b('0x5d'));}}else{logger[_0xb34b('0xb')](_0x352a8e,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xb34b('0x5e')]=function(_0x385840){if(_0x385840<=0x0){return!![];}return![];};exports[_0xb34b('0x5f')]=function(_0x532d1f,_0x23ba93,_0x3f1797){_0x532d1f['lastevent']=_0x23ba93;_0x532d1f['name']=_0x532d1f[_0xb34b('0x60')];_0x532d1f['interface']=_0x532d1f['channelAgent'];_0x532d1f[_0xb34b('0x61')]='voice';if(_0x3f1797){_0x532d1f[_0xb34b('0x62')]=_0x3f1797['mandatoryDisposition'];}return _0x532d1f;};exports[_0xb34b('0x63')]=function(_0x502067){var _0x318de7={};_0x318de7[_0xb34b('0x60')]=_0x502067[_0xb34b('0x60')];_0x318de7[_0xb34b('0x64')]=_0x502067[_0xb34b('0x4e')];_0x318de7['uniqueid']=_0x502067['uniqueid'];return _0x318de7;};exports[_0xb34b('0x65')]=function(_0x340457){var _0x19ac2e=[];for(var _0xc8305b in _0x340457){if(_0x340457[_0xb34b('0x2d')](_0xc8305b)){if(!_[_0xb34b('0x19')](_0x340457[_0xc8305b])&&_0x340457[_0xc8305b][_0xb34b('0x39')]==='not_inuse'&&_0x340457[_0xc8305b][_0xb34b('0x66')]===_0xb34b('0x67')){_0x19ac2e[_0xb34b('0x68')](_0x340457[_0xc8305b]['id']);}}}return _0x19ac2e;};exports[_0xb34b('0x69')]=function(_0x364d3f){var _0x1a0931=moment()[_0xb34b('0x7')](0x0);var _0xdc9e41=moment(_0x364d3f)[_0xb34b('0x7')](0x0);return _0x1a0931[_0xb34b('0x8')](_0xdc9e41,'seconds');};exports['createBody']=function(_0x5b1962){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5b1962[_0xb34b('0x1e')],'ListId':_0x5b1962[_0xb34b('0x5a')],'VoiceQueueId':_0x5b1962[_0xb34b('0x20')]||undefined,'CampaignId':_0x5b1962['CampaignId']||undefined};};exports[_0xb34b('0x6a')]=function(_0x4208ab){if(_0x4208ab===_0xb34b('0x4c')||_0x4208ab===_0xb34b('0x6b')||_0x4208ab==='queue'||_0x4208ab==='type'||_0x4208ab===_0xb34b('0x6c')||_0x4208ab==='dialAnswer'||_0x4208ab==='membername'||_0x4208ab===_0xb34b('0x4e')||_0x4208ab===_0xb34b('0x4a')||_0x4208ab===_0xb34b('0x6d')||_0x4208ab==='calleridnum'||_0x4208ab===_0xb34b('0x59')||_0x4208ab===_0xb34b('0x52')||_0x4208ab===_0xb34b('0x53')||_0x4208ab===_0xb34b('0x6e')||_0x4208ab==='countglobal'||_0x4208ab===_0xb34b('0x6f')||_0x4208ab==='callbackuniqueid'||_0x4208ab==='callbackat'||_0x4208ab===_0xb34b('0x70')||_0x4208ab===_0xb34b('0x1e')||_0x4208ab===_0xb34b('0x5a')||_0x4208ab==='UserId'||_0x4208ab===_0xb34b('0x20')||_0x4208ab===_0xb34b('0x71')||_0x4208ab===_0xb34b('0x72')||_0x4208ab===_0xb34b('0x73')||_0x4208ab===_0xb34b('0x74')||_0x4208ab===_0xb34b('0x75')||_0x4208ab===_0xb34b('0x76')||_0x4208ab===_0xb34b('0x77')||_0x4208ab===_0xb34b('0x78')||_0x4208ab===_0xb34b('0x79')||_0x4208ab==='xmd-dialchannel'||_0x4208ab===_0xb34b('0x7a')||_0x4208ab===_0xb34b('0x7b')||_0x4208ab===_0xb34b('0x7c')||_0x4208ab===_0xb34b('0x7d')||_0x4208ab===_0xb34b('0x7e')||_0x4208ab===_0xb34b('0x7f')||_0x4208ab===_0xb34b('0x80')||_0x4208ab===_0xb34b('0x81')||_0x4208ab===_0xb34b('0x82')||_0x4208ab===_0xb34b('0x83')||_0x4208ab===_0xb34b('0x84')||_0x4208ab===_0xb34b('0x85')||_0x4208ab==='rtpaudioqosrttbridged'||_0x4208ab===_0xb34b('0x7f')||_0x4208ab===_0xb34b('0x80')||_0x4208ab===_0xb34b('0x81')||_0x4208ab===_0xb34b('0x82')||_0x4208ab===_0xb34b('0x83')||_0x4208ab===_0xb34b('0x84')||_0x4208ab==='rtpaudioqosrtt'||_0x4208ab==='rtpaudioqosrttbridged'||_0x4208ab===_0xb34b('0x86')||_0x4208ab===_0xb34b('0x87')||_0x4208ab===_0xb34b('0x39')||_0x4208ab===_0xb34b('0x3a')){return![];}return!![];};exports[_0xb34b('0x88')]=function(_0x7353bf,_0xafc73d){var _0x3b4086,_0x32de80,_0x17ce51;if(_0xafc73d<=0x0){_0xafc73d=0x1;}_0x3b4086=new RegExp(_0xb34b('0x89')+_0xafc73d+'}$');_0x32de80=Math[_0xb34b('0x8a')](0xa,_0xafc73d-0x1);_0x17ce51=Math[_0xb34b('0x8a')](0xa,_0xafc73d)-0x1;return util[_0xb34b('0x15')]('%s',_[_0xb34b('0x8b')](_0x7353bf,_0x3b4086,_[_0xb34b('0x8c')](_0x32de80,_0x17ce51)));};exports[_0xb34b('0x8d')]=function(_0x15fe58){var _0x1a4ffe=_0x15fe58[_0xb34b('0x8e')](/"(.*?)"/);return _0x1a4ffe?_0x1a4ffe[0x1]:_0x15fe58;};exports[_0xb34b('0x8f')]=function(_0x522aef){var _0x417f2b=_0x522aef[_0xb34b('0x8e')](/<(.*?)>/);return _0x417f2b?_0x417f2b[0x1]:_0x522aef;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index d0edfeb..3342012 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 _0x356f=['voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queuepause','voicequeuechannel','voicechannel'];(function(_0x3ce984,_0x4c7241){var _0x3e5aef=function(_0x3a2172){while(--_0x3a2172){_0x3ce984['push'](_0x3ce984['shift']());}};_0x3e5aef(++_0x4c7241);}(_0x356f,0x6e));var _0xf356=function(_0x403ce8,_0x5c25ba){_0x403ce8=_0x403ce8-0x0;var _0xc4581e=_0x356f[_0x403ce8];return _0xc4581e;};'use strict';exports[_0xf356('0x0')]={'queue':{'type':_0xf356('0x1'),'required':!![]},'interface':{'type':_0xf356('0x1'),'required':!![]},'membername':{'type':_0xf356('0x1'),'required':!![]},'penalty':{'type':_0xf356('0x2'),'required':![]},'paused':{'type':_0xf356('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':_0xf356('0x1'),'required':!![]}};exports[_0xf356('0x4')]={'interface':{'type':_0xf356('0x1'),'required':!![]},'paused':{'type':_0xf356('0x3')},'reason':{'type':_0xf356('0x1'),'required':![]}};exports['reload']={'module':{'type':_0xf356('0x1'),'required':![]}};exports[_0xf356('0x5')]={'uniqueid':{'type':_0xf356('0x1'),'required':!![]}};exports[_0xf356('0x6')]={'uniqueid':{'type':_0xf356('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xf356('0x1')},'mixmonitorid':{'type':_0xf356('0x1')}};exports[_0xf356('0x7')]={'uniqueid':{'type':_0xf356('0x1'),'required':!![]}};exports[_0xf356('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xf356('0x1'),'required':!![]},'context':{'type':_0xf356('0x1')}}; \ No newline at end of file +var _0xe99c=['voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean','queueremove','reload'];(function(_0x469d40,_0x24e378){var _0x5c0b73=function(_0x47079d){while(--_0x47079d){_0x469d40['push'](_0x469d40['shift']());}};_0x5c0b73(++_0x24e378);}(_0xe99c,0xd3));var _0xce99=function(_0x153d2c,_0x2263bd){_0x153d2c=_0x153d2c-0x0;var _0x5e5b0e=_0xe99c[_0x153d2c];return _0x5e5b0e;};'use strict';exports[_0xce99('0x0')]={'queue':{'type':_0xce99('0x1'),'required':!![]},'interface':{'type':_0xce99('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xce99('0x2'),'required':![]}};exports[_0xce99('0x3')]={'queue':{'type':_0xce99('0x1'),'required':!![]},'interface':{'type':_0xce99('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xce99('0x1'),'required':!![]},'paused':{'type':_0xce99('0x2')},'reason':{'type':_0xce99('0x1'),'required':![]}};exports[_0xce99('0x4')]={'module':{'type':_0xce99('0x1'),'required':![]}};exports[_0xce99('0x5')]={'uniqueid':{'type':_0xce99('0x1'),'required':!![]}};exports[_0xce99('0x6')]={'uniqueid':{'type':_0xce99('0x1'),'required':!![]},'filename':{'type':_0xce99('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xce99('0x1')}};exports[_0xce99('0x7')]={'uniqueid':{'type':_0xce99('0x1'),'required':!![]}};exports[_0xce99('0x8')]={'uniqueid':{'type':_0xce99('0x1'),'required':!![]},'exten':{'type':_0xce99('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 6cab203..6dfbb99 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 _0xd669=['sumHoldTime','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isNil','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','seconds','diff','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','templates','outbound','channels','queueChannels','timers','salesforceAccounts','sugarcrmAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','name','interface','SIP/%s','total','answered','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0xd669,0xa6));var _0x9d66=function(_0x459a0a,_0x25c46f){_0x459a0a=_0x459a0a-0x0;var _0x4ab46c=_0xd669[_0x459a0a];return _0x4ab46c;};'use strict';var BPromise=require(_0x9d66('0x0'));var util=require(_0x9d66('0x1'));var _=require(_0x9d66('0x2'));var moment=require('moment');var Agent=require(_0x9d66('0x3'));var Telephone=require(_0x9d66('0x4'));var Trunk=require(_0x9d66('0x5'));var VoiceQueue=require(_0x9d66('0x6'));var Trigger=require(_0x9d66('0x7'));var Template=require('../model/template');var Campaign=require(_0x9d66('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x9d66('0x9'));var SalesforceAccount=require(_0x9d66('0xa'));var FreshdeskAccount=require(_0x9d66('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x9d66('0xc'));var DeskAccount=require(_0x9d66('0xd'));var VtigerAccount=require(_0x9d66('0xe'));var ServicenowAccount=require(_0x9d66('0xf'));var Dynamics365Account=require(_0x9d66('0x10'));var FreshsalesAccount=require(_0x9d66('0x11'));var FaxAccount=require(_0x9d66('0x12'));var Realtime=function(){this[_0x9d66('0x13')]={};this[_0x9d66('0x14')]={};this[_0x9d66('0x15')]={};this[_0x9d66('0x16')]={};this[_0x9d66('0x17')]={};this['campaigns']={};this[_0x9d66('0x18')]={};this[_0x9d66('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x9d66('0x1a')]={};this[_0x9d66('0x1b')]={};this['outboundChannels']={};this[_0x9d66('0x1c')]={};this['settings']={};this['zendeskAccounts']={};this[_0x9d66('0x1d')]={};this[_0x9d66('0x1e')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this['deskAccounts']={};this[_0x9d66('0x1f')]={};this[_0x9d66('0x20')]={};this[_0x9d66('0x21')]={};this[_0x9d66('0x22')]={};this[_0x9d66('0x23')]={};};function freeIsNotKey(_0x413b29,_0x31d12f,_0x298c10){var _0x1a6620=_['mapKeys'](_0x413b29,function(_0x162d64,_0x31e1c9){return _0x162d64[_0x298c10];});for(var _0x1ef3fc in _0x31d12f){if(_0x31d12f[_0x9d66('0x24')](_0x1ef3fc)){if(!_0x1a6620[_0x1ef3fc]){delete _0x31d12f[_0x1ef3fc];}}}}function freeIsNotKeySip(_0x3c19f2,_0x2a9f51){var _0x5e5c93=_[_0x9d66('0x25')](_0x3c19f2,function(_0x20a7cf,_0x4eca14){return util[_0x9d66('0x26')]('SIP/%s',_0x20a7cf[_0x9d66('0x27')]);});for(var _0x108793 in _0x2a9f51){if(_0x2a9f51['hasOwnProperty'](_0x108793)){if(!_0x5e5c93[_0x108793]){delete _0x2a9f51[_0x108793];}}}}function freeIsNotKeyAgent(_0x14f703,_0x2252fb){var _0x2131a5=_['mapKeys'](_0x14f703,function(_0x363404,_0x124e0c){var _0x1998d6=_['isNil'](_0x363404[_0x9d66('0x28')])?util['format'](_0x9d66('0x29'),_0x363404[_0x9d66('0x27')]):_0x363404[_0x9d66('0x28')];return _0x1998d6;});for(var _0x5902fc in _0x2252fb){if(_0x2252fb[_0x9d66('0x24')](_0x5902fc)){if(!_0x2131a5[_0x5902fc]){delete _0x2252fb[_0x5902fc];}}}}function clearVoiceCallReports(_0x29a8c2){_0x29a8c2[_0x9d66('0x2a')]=0x0;_0x29a8c2[_0x9d66('0x2b')]=0x0;_0x29a8c2['sumHoldTime']=0x0;_0x29a8c2[_0x9d66('0x2c')]=0x0;_0x29a8c2[_0x9d66('0x2d')]=0x0;}function clearCampaigns(_0x11e4a4){if(!_['isEmpty'](_0x11e4a4)){for(var _0x1903a1 in _0x11e4a4){if(_0x11e4a4[_0x9d66('0x24')](_0x1903a1)){_0x11e4a4[_0x1903a1][_0x9d66('0x2e')]=0x0;_0x11e4a4[_0x1903a1]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x3821b5){if(!_[_0x9d66('0x2f')](_0x3821b5)){for(var _0x308172 in _0x3821b5){if(_0x3821b5[_0x9d66('0x24')](_0x308172)){_0x3821b5[_0x308172][_0x9d66('0x2a')]=0x0;_0x3821b5[_0x308172][_0x9d66('0x2b')]=0x0;_0x3821b5[_0x308172][_0x9d66('0x30')]=0x0;_0x3821b5[_0x308172][_0x9d66('0x31')]=0x0;_0x3821b5[_0x308172][_0x9d66('0x32')]=0x0;_0x3821b5[_0x308172][_0x9d66('0x2c')]=0x0;_0x3821b5[_0x308172][_0x9d66('0x2d')]=0x0;_0x3821b5[_0x308172][_0x9d66('0x33')]=0x0;_0x3821b5[_0x308172]['outboundNoAnswerCallsDay']=0x0;_0x3821b5[_0x308172][_0x9d66('0x34')]=0x0;_0x3821b5[_0x308172][_0x9d66('0x35')]=0x0;_0x3821b5[_0x308172][_0x9d66('0x36')]=0x0;_0x3821b5[_0x308172][_0x9d66('0x37')]=0x0;_0x3821b5[_0x308172]['outboundDropCallsDayTimeout']=0x0;_0x3821b5[_0x308172]['outboundDropCallsDayCallersExit']=0x0;_0x3821b5[_0x308172][_0x9d66('0x38')]=0x0;_0x3821b5[_0x308172]['outboundOriginateFailureCallsDay']=0x0;_0x3821b5[_0x308172][_0x9d66('0x39')]=0x0;_0x3821b5[_0x308172][_0x9d66('0x3a')]=0x0;_0x3821b5[_0x308172][_0x9d66('0x33')]=0x0;_0x3821b5[_0x308172][_0x9d66('0x3b')]=0x0;_0x3821b5[_0x308172][_0x9d66('0x3c')]=!![];}}}}Realtime[_0x9d66('0x3d')][_0x9d66('0x3e')]=function(_0x4f45a4,_0xc2a9a3){for(var _0x4a30fb in _0xc2a9a3){if(_0x4f45a4['hasOwnProperty'](_0x4a30fb)){_0x4f45a4[_0x4a30fb]=_0xc2a9a3[_0x4a30fb];}}};Realtime[_0x9d66('0x3d')]['initAgents']=function(){var _0x128d7a=this;return function(_0x1389d2){if(_0x1389d2){freeIsNotKeyAgent(_0x1389d2,_0x128d7a[_0x9d66('0x13')]);for(var _0x753b7=0x0,_0x266ff4={},_0x538142={};_0x753b7<_0x1389d2[_0x9d66('0x3f')];_0x753b7+=0x1){_0x266ff4=_0x1389d2[_0x753b7];var _0x59d44b=_[_0x9d66('0x40')](_0x266ff4[_0x9d66('0x28')])?util['format'](_0x9d66('0x29'),_0x266ff4[_0x9d66('0x27')]):_0x266ff4['interface'];if(_[_0x9d66('0x41')](_0x128d7a[_0x9d66('0x13')][_0x59d44b])){_0x128d7a[_0x9d66('0x13')][_0x59d44b]=new Agent(_0x266ff4);}else{_0x128d7a[_0x9d66('0x3e')](_0x128d7a[_0x9d66('0x13')][_0x59d44b],_0x266ff4);}}}return _0x128d7a[_0x9d66('0x13')];};};Realtime[_0x9d66('0x3d')][_0x9d66('0x42')]=function(){var _0x35e9ad=this;return function(_0x455344){if(_0x455344){freeIsNotKeySip(_0x455344,_0x35e9ad['telephones']);for(var _0x423b9d=0x0,_0x25b83e={},_0x32a8c8={};_0x423b9d<_0x455344[_0x9d66('0x3f')];_0x423b9d+=0x1){_0x25b83e=_0x455344[_0x423b9d];if(_[_0x9d66('0x41')](_0x35e9ad[_0x9d66('0x14')][util['format'](_0x9d66('0x29'),_0x25b83e['name'])])){_0x35e9ad[_0x9d66('0x14')][util[_0x9d66('0x26')](_0x9d66('0x29'),_0x25b83e[_0x9d66('0x27')])]=new Telephone(_0x25b83e);}else{_0x35e9ad[_0x9d66('0x3e')](_0x35e9ad[_0x9d66('0x14')][util[_0x9d66('0x26')](_0x9d66('0x29'),_0x25b83e[_0x9d66('0x27')])],_0x25b83e);}}}return _0x35e9ad[_0x9d66('0x14')];};};Realtime[_0x9d66('0x3d')][_0x9d66('0x43')]=function(){var _0x4b33c0=this;return function(_0x4c7b43){if(_0x4c7b43){freeIsNotKeySip(_0x4c7b43,_0x4b33c0['trunks']);for(var _0x30ca46=0x0,_0x53f5e1={},_0x2a5416={};_0x30ca46<_0x4c7b43[_0x9d66('0x3f')];_0x30ca46+=0x1){_0x53f5e1=_0x4c7b43[_0x30ca46];if(_['isUndefined'](_0x4b33c0[_0x9d66('0x15')][util[_0x9d66('0x26')](_0x9d66('0x29'),_0x53f5e1[_0x9d66('0x27')])])){_0x4b33c0['trunks'][util[_0x9d66('0x26')](_0x9d66('0x29'),_0x53f5e1['name'])]=new Trunk(_0x53f5e1);}else{_0x4b33c0[_0x9d66('0x3e')](_0x4b33c0[_0x9d66('0x15')][util[_0x9d66('0x26')](_0x9d66('0x29'),_0x53f5e1['name'])],_0x53f5e1);}}}return _0x4b33c0[_0x9d66('0x15')];};};Realtime['prototype'][_0x9d66('0x44')]=function(){var _0x5a7cf2=this;return function(_0x465703){if(_0x465703){freeIsNotKey(_0x465703,_0x5a7cf2[_0x9d66('0x16')],'name');for(var _0x13fc1a=0x0,_0x172dee={},_0x255a79={};_0x13fc1a<_0x465703[_0x9d66('0x3f')];_0x13fc1a+=0x1){_0x172dee=_0x465703[_0x13fc1a];if(_['isUndefined'](_0x5a7cf2[_0x9d66('0x16')][_0x172dee[_0x9d66('0x27')]])){_0x5a7cf2[_0x9d66('0x16')][_0x172dee['name']]=new VoiceQueue(_0x172dee);}else{_0x5a7cf2['mergeFromDatabase'](_0x5a7cf2[_0x9d66('0x16')][_0x172dee['name']],_0x172dee);}}}return _0x5a7cf2[_0x9d66('0x16')];};};Realtime['prototype'][_0x9d66('0x45')]=function(){var _0xa82d88=this;return function(_0x3a9904){if(_0x3a9904){freeIsNotKey(_0x3a9904,_0xa82d88[_0x9d66('0x17')],'id');for(var _0x6f719c=0x0,_0x4dbbe6={},_0x161159={};_0x6f719c<_0x3a9904[_0x9d66('0x3f')];_0x6f719c+=0x1){_0x4dbbe6=_0x3a9904[_0x6f719c];if(_[_0x9d66('0x41')](_0xa82d88['triggers'][_0x4dbbe6['id']])){_0xa82d88[_0x9d66('0x17')][_0x4dbbe6['id']]=new Trigger(_0x4dbbe6);}else{_0xa82d88['mergeFromDatabase'](_0xa82d88[_0x9d66('0x17')][_0x4dbbe6['id']],_0x4dbbe6);}}}return _0xa82d88[_0x9d66('0x17')];};};Realtime['prototype'][_0x9d66('0x46')]=function(){var _0x140aff=this;return function(_0x11d295){if(_0x11d295){freeIsNotKey(_0x11d295,_0x140aff['templates'],'id');for(var _0x463cd8=0x0,_0xdbf15c={},_0x4ed9d1={};_0x463cd8<_0x11d295[_0x9d66('0x3f')];_0x463cd8+=0x1){_0xdbf15c=_0x11d295[_0x463cd8];if(_[_0x9d66('0x41')](_0x140aff[_0x9d66('0x18')][_0xdbf15c['id']])){_0x140aff['templates'][_0xdbf15c['id']]=new Template(_0xdbf15c);}else{_0x140aff[_0x9d66('0x3e')](_0x140aff[_0x9d66('0x18')][_0xdbf15c['id']],_0xdbf15c);}}}return _0x140aff[_0x9d66('0x18')];};};Realtime['prototype'][_0x9d66('0x47')]=function(){var _0x169db2=this;return function(_0x58851d){if(_0x58851d){freeIsNotKey(_0x58851d,_0x169db2[_0x9d66('0x48')],'id');for(var _0x1dcdc7=0x0,_0x3bd713={},_0x1584d9={};_0x1dcdc7<_0x58851d[_0x9d66('0x3f')];_0x1dcdc7+=0x1){_0x3bd713=_0x58851d[_0x1dcdc7];if(_[_0x9d66('0x41')](_0x169db2[_0x9d66('0x48')][_0x3bd713['id']])){_0x169db2[_0x9d66('0x48')][_0x3bd713['id']]=new ZendeskAccount(_0x3bd713);}else{_0x169db2[_0x9d66('0x3e')](_0x169db2[_0x9d66('0x48')][_0x3bd713['id']],_0x3bd713);}}}return _0x169db2[_0x9d66('0x48')];};};Realtime[_0x9d66('0x3d')][_0x9d66('0x49')]=function(){var _0x40a343=this;return function(_0x49343f){if(_0x49343f){freeIsNotKey(_0x49343f,_0x40a343[_0x9d66('0x1d')],'id');for(var _0x187470=0x0,_0x834d35={},_0x38f09f={};_0x187470<_0x49343f[_0x9d66('0x3f')];_0x187470+=0x1){_0x834d35=_0x49343f[_0x187470];if(_[_0x9d66('0x41')](_0x40a343[_0x9d66('0x1d')][_0x834d35['id']])){_0x40a343[_0x9d66('0x1d')][_0x834d35['id']]=new SalesforceAccount(_0x834d35);}else{_0x40a343[_0x9d66('0x3e')](_0x40a343['salesforceAccounts'][_0x834d35['id']],_0x834d35);}}}return _0x40a343['salesforceAccounts'];};};Realtime[_0x9d66('0x3d')][_0x9d66('0x4a')]=function(){var _0x27b185=this;return function(_0x3207fc){if(_0x3207fc){freeIsNotKey(_0x3207fc,_0x27b185[_0x9d66('0x4b')],'id');for(var _0xfdd6d6=0x0,_0xa2bd8b={},_0x23caae={};_0xfdd6d6<_0x3207fc[_0x9d66('0x3f')];_0xfdd6d6+=0x1){_0xa2bd8b=_0x3207fc[_0xfdd6d6];if(_[_0x9d66('0x41')](_0x27b185[_0x9d66('0x4b')][_0xa2bd8b['id']])){_0x27b185[_0x9d66('0x4b')][_0xa2bd8b['id']]=new FreshdeskAccount(_0xa2bd8b);}else{_0x27b185['mergeFromDatabase'](_0x27b185[_0x9d66('0x4b')][_0xa2bd8b['id']],_0xa2bd8b);}}}return _0x27b185[_0x9d66('0x4b')];};};Realtime[_0x9d66('0x3d')]['initZohoAccounts']=function(){var _0x12803f=this;return function(_0x454334){if(_0x454334){freeIsNotKey(_0x454334,_0x12803f[_0x9d66('0x4c')],'id');for(var _0xe65004=0x0,_0x27b103={},_0x51b91b={};_0xe65004<_0x454334[_0x9d66('0x3f')];_0xe65004+=0x1){_0x27b103=_0x454334[_0xe65004];if(_[_0x9d66('0x41')](_0x12803f[_0x9d66('0x4c')][_0x27b103['id']])){_0x12803f[_0x9d66('0x4c')][_0x27b103['id']]=new ZohoAccount(_0x27b103);}else{_0x12803f['mergeFromDatabase'](_0x12803f[_0x9d66('0x4c')][_0x27b103['id']],_0x27b103);}}}return _0x12803f[_0x9d66('0x4c')];};};Realtime[_0x9d66('0x3d')][_0x9d66('0x4d')]=function(){var _0xde6e4c=this;return function(_0x3444b8){if(_0x3444b8){freeIsNotKey(_0x3444b8,_0xde6e4c[_0x9d66('0x4e')],'id');for(var _0xfefb35=0x0,_0x333c15={},_0x38c668={};_0xfefb35<_0x3444b8[_0x9d66('0x3f')];_0xfefb35+=0x1){_0x333c15=_0x3444b8[_0xfefb35];if(_[_0x9d66('0x41')](_0xde6e4c[_0x9d66('0x4e')][_0x333c15['id']])){_0xde6e4c['deskAccounts'][_0x333c15['id']]=new DeskAccount(_0x333c15);}else{_0xde6e4c[_0x9d66('0x3e')](_0xde6e4c[_0x9d66('0x4e')][_0x333c15['id']],_0x333c15);}}}return _0xde6e4c[_0x9d66('0x4e')];};};Realtime[_0x9d66('0x3d')][_0x9d66('0x4f')]=function(){var _0x171a0f=this;return function(_0x194b9c){if(_0x194b9c){freeIsNotKey(_0x194b9c,_0x171a0f[_0x9d66('0x1e')],'id');for(var _0x4a7053=0x0,_0x2f96da={},_0x55e6ba={};_0x4a7053<_0x194b9c['length'];_0x4a7053+=0x1){_0x2f96da=_0x194b9c[_0x4a7053];if(_[_0x9d66('0x41')](_0x171a0f[_0x9d66('0x1e')][_0x2f96da['id']])){_0x171a0f[_0x9d66('0x1e')][_0x2f96da['id']]=new SugarcrmAccount(_0x2f96da);}else{_0x171a0f[_0x9d66('0x3e')](_0x171a0f[_0x9d66('0x1e')][_0x2f96da['id']],_0x2f96da);}}}return _0x171a0f[_0x9d66('0x1e')];};};Realtime[_0x9d66('0x3d')]['initVtigerAccounts']=function(){var _0x4ef47b=this;return function(_0x2b3bfd){if(_0x2b3bfd){freeIsNotKey(_0x2b3bfd,_0x4ef47b['vtigerAccounts'],'id');for(var _0x1a641b=0x0,_0x36f4ef={},_0x1f6c98={};_0x1a641b<_0x2b3bfd[_0x9d66('0x3f')];_0x1a641b+=0x1){_0x36f4ef=_0x2b3bfd[_0x1a641b];if(_[_0x9d66('0x41')](_0x4ef47b[_0x9d66('0x1f')][_0x36f4ef['id']])){_0x4ef47b['vtigerAccounts'][_0x36f4ef['id']]=new VtigerAccount(_0x36f4ef);}else{_0x4ef47b[_0x9d66('0x3e')](_0x4ef47b[_0x9d66('0x1f')][_0x36f4ef['id']],_0x36f4ef);}}}return _0x4ef47b[_0x9d66('0x1f')];};};Realtime[_0x9d66('0x3d')][_0x9d66('0x50')]=function(){var _0x164315=this;return function(_0x443e2f){if(_0x443e2f){freeIsNotKey(_0x443e2f,_0x164315[_0x9d66('0x20')],'id');for(var _0x137624=0x0,_0x491e3e={},_0x270b26={};_0x137624<_0x443e2f[_0x9d66('0x3f')];_0x137624+=0x1){_0x491e3e=_0x443e2f[_0x137624];if(_[_0x9d66('0x41')](_0x164315[_0x9d66('0x20')][_0x491e3e['id']])){_0x164315[_0x9d66('0x20')][_0x491e3e['id']]=new ServicenowAccount(_0x491e3e);}else{_0x164315['mergeFromDatabase'](_0x164315[_0x9d66('0x20')][_0x491e3e['id']],_0x491e3e);}}}return _0x164315['servicenowAccounts'];};};Realtime[_0x9d66('0x3d')][_0x9d66('0x51')]=function(){var _0x57d791=this;return function(_0xfbda47){if(_0xfbda47){freeIsNotKey(_0xfbda47,_0x57d791[_0x9d66('0x21')],'id');for(var _0x29ab8b=0x0,_0x59a81d={},_0x24a121={};_0x29ab8b<_0xfbda47['length'];_0x29ab8b+=0x1){_0x59a81d=_0xfbda47[_0x29ab8b];if(_[_0x9d66('0x41')](_0x57d791[_0x9d66('0x21')][_0x59a81d['id']])){_0x57d791[_0x9d66('0x21')][_0x59a81d['id']]=new Dynamics365Account(_0x59a81d);}else{_0x57d791['mergeFromDatabase'](_0x57d791[_0x9d66('0x21')][_0x59a81d['id']],_0x59a81d);}}}return _0x57d791[_0x9d66('0x21')];};};Realtime[_0x9d66('0x3d')][_0x9d66('0x52')]=function(){var _0x56a3d2=this;return function(_0x53e045){if(_0x53e045){freeIsNotKey(_0x53e045,_0x56a3d2[_0x9d66('0x22')],'id');for(var _0x171c8e=0x0,_0x522f76={},_0x2f7e4d={};_0x171c8e<_0x53e045[_0x9d66('0x3f')];_0x171c8e+=0x1){_0x522f76=_0x53e045[_0x171c8e];if(_[_0x9d66('0x41')](_0x56a3d2[_0x9d66('0x22')][_0x522f76['id']])){_0x56a3d2['freshsalesAccounts'][_0x522f76['id']]=new FreshsalesAccount(_0x522f76);}else{_0x56a3d2[_0x9d66('0x3e')](_0x56a3d2[_0x9d66('0x22')][_0x522f76['id']],_0x522f76);}}}return _0x56a3d2[_0x9d66('0x22')];};};Realtime[_0x9d66('0x3d')][_0x9d66('0x53')]=function(){var _0x230b39=this;return function(_0x10863c){for(var _0xc47331=0x0;_0xc47331<_0x10863c[_0x9d66('0x3f')];_0xc47331+=0x1){_[_0x9d66('0x54')](_0x230b39[_0x9d66('0x16')][_0x10863c[_0xc47331][_0x9d66('0x27')]],_0x10863c[_0xc47331]);}return _0x230b39[_0x9d66('0x16')];};};Realtime[_0x9d66('0x3d')][_0x9d66('0x55')]=function(){var _0x2e36cc=this;return function(_0x5660aa){clearVoiceQueues(_0x2e36cc[_0x9d66('0x16')]);if(_0x5660aa){_0x5660aa=_['groupBy'](_0x5660aa,'uniqueid');for(var _0xd2995c in _0x5660aa){if(_0x5660aa[_0x9d66('0x24')](_0xd2995c)){var _0x1f7ac2={};for(var _0x19ea6d=0x0;_0x19ea6d<_0x5660aa[_0xd2995c][_0x9d66('0x3f')];_0x19ea6d+=0x1){var _0x19c363=_0x5660aa[_0xd2995c][_0x19ea6d][_0x9d66('0x56')];if(_0x2e36cc[_0x9d66('0x16')][_0x19c363]){if(_0x5660aa[_0xd2995c][_0x19ea6d][_0x9d66('0x57')]){_0x2e36cc['voiceQueues'][_0x19c363][_0x9d66('0x30')]+=0x1;}if(_0x5660aa[_0xd2995c][_0x19ea6d][_0x9d66('0x58')]){_0x2e36cc['voiceQueues'][_0x19c363]['abandoned']+=0x1;}_0x2e36cc[_0x9d66('0x16')][_0x19c363][_0x9d66('0x32')]+=moment(_0x5660aa[_0xd2995c][_0x19ea6d][_0x9d66('0x59')])['diff'](moment(_0x5660aa[_0xd2995c][_0x19ea6d][_0x9d66('0x5a')]),'seconds')||0x0;if(_0x19ea6d===_0x5660aa[_0xd2995c][_0x9d66('0x3f')]-0x1){_0x2e36cc[_0x9d66('0x16')][_0x19c363][_0x9d66('0x2c')]+=moment(_0x5660aa[_0xd2995c][_0x19ea6d][_0x9d66('0x5b')]||_0x5660aa[_0xd2995c][_0x19ea6d][_0x9d66('0x5c')]||_0x5660aa[_0xd2995c][_0x19ea6d]['queuecallerexitAt'])['diff'](moment(_0x5660aa[_0xd2995c][_0x19ea6d][_0x9d66('0x5a')]),_0x9d66('0x5d'))||0x0;_0x2e36cc[_0x9d66('0x16')][_0x19c363][_0x9d66('0x2a')]+=0x1;if(_0x5660aa[_0xd2995c][_0x19ea6d]['queuecallercomplete']){_0x2e36cc['voiceQueues'][_0x19c363]['answered']+=0x1;_0x2e36cc[_0x9d66('0x16')][_0x19c363][_0x9d66('0x2d')]+=moment(_0x5660aa[_0xd2995c][_0x19ea6d]['queuecallercompleteAt'])[_0x9d66('0x5e')](moment(_0x5660aa[_0xd2995c][_0x19ea6d][_0x9d66('0x59')]),_0x9d66('0x5d'))||0x0;}}else{_0x2e36cc['voiceQueues'][_0x19c363][_0x9d66('0x2c')]+=_0x2e36cc['voiceQueues'][_0x19c363][_0x9d66('0x32')]||0x0;}}}}}}return _0x2e36cc[_0x9d66('0x16')];};};Realtime[_0x9d66('0x3d')][_0x9d66('0x5f')]=function(){var _0x4762e8=this;return function(_0x403962){clearVoiceCallReports(_0x4762e8['outbound']);if(_0x403962){for(var _0x3e327c=0x0;_0x3e327c<_0x403962['length'];_0x3e327c+=0x1){_0x4762e8[_0x9d66('0x19')][_0x9d66('0x2a')]+=0x1;_0x4762e8['outbound'][_0x9d66('0x2c')]+=_0x403962[_0x3e327c][_0x9d66('0x60')];if(_0x403962[_0x3e327c]['disposition']===_0x9d66('0x61')){_0x4762e8[_0x9d66('0x19')][_0x9d66('0x2b')]+=0x1;_0x4762e8[_0x9d66('0x19')][_0x9d66('0x32')]+=_0x403962[_0x3e327c][_0x9d66('0x60')]-_0x403962[_0x3e327c][_0x9d66('0x62')]||0x0;_0x4762e8[_0x9d66('0x19')][_0x9d66('0x2d')]+=_0x403962[_0x3e327c][_0x9d66('0x62')];}}}return _0x4762e8['outbound'];};};Realtime[_0x9d66('0x3d')][_0x9d66('0x63')]=function(){var _0x559d9d=this;return function(_0x3e1bb6){if(_0x3e1bb6){freeIsNotKey(_0x3e1bb6,_0x559d9d[_0x9d66('0x64')],_0x9d66('0x27'));for(var _0x2aa30c=0x0,_0x42c1f2={};_0x2aa30c<_0x3e1bb6[_0x9d66('0x3f')];_0x2aa30c+=0x1){_0x42c1f2=_0x3e1bb6[_0x2aa30c];if(_[_0x9d66('0x41')](_0x559d9d[_0x9d66('0x64')][_0x42c1f2[_0x9d66('0x27')]])){_0x559d9d[_0x9d66('0x64')][_0x42c1f2['name']]=new Campaign(_0x42c1f2);}else{_0x559d9d['mergeFromDatabase'](_0x559d9d[_0x9d66('0x64')][_0x42c1f2['name']],_0x42c1f2);_0x559d9d[_0x9d66('0x64')][_0x42c1f2[_0x9d66('0x27')]][_0x9d66('0x65')]=_0x42c1f2[_0x9d66('0x66')]?_0x42c1f2[_0x9d66('0x66')][_0x9d66('0x27')]:undefined;}}}return _0x559d9d[_0x9d66('0x64')];};};Realtime[_0x9d66('0x3d')][_0x9d66('0x67')]=function(){var _0x47f9fc=this;return function(_0x4c5dd5){if(_0x4c5dd5){freeIsNotKey(_0x4c5dd5,_0x47f9fc[_0x9d66('0x68')],'id');for(var _0x34e808=0x0,_0x59336b={};_0x34e808<_0x4c5dd5[_0x9d66('0x3f')];_0x34e808+=0x1){_0x59336b=_0x4c5dd5[_0x34e808];if(_[_0x9d66('0x41')](_0x47f9fc[_0x9d66('0x68')][_0x59336b['id']])){_0x47f9fc[_0x9d66('0x68')][_0x59336b['id']]=new VoiceExtension(_0x59336b);}else{_0x47f9fc[_0x9d66('0x3e')](_0x47f9fc['voiceExtensions'][_0x59336b['id']],_0x59336b);}}}return _0x47f9fc['voiceExtensions'];};};Realtime[_0x9d66('0x3d')][_0x9d66('0x69')]=function(){var _0x308482=this;return function(_0x146ea8){clearCampaigns(_0x308482[_0x9d66('0x64')]);for(var _0x3dfc21=0x0;_0x3dfc21<_0x146ea8[_0x9d66('0x3f')];_0x3dfc21+=0x1){_[_0x9d66('0x54')](_0x308482[_0x9d66('0x64')][_0x146ea8[_0x3dfc21][_0x9d66('0x27')]],_0x146ea8[_0x3dfc21]);}return _0x308482[_0x9d66('0x64')];};};Realtime[_0x9d66('0x3d')][_0x9d66('0x6a')]=function(){var _0x2a7301=this;return function(_0x561631){if(_0x561631){freeIsNotKey(_0x561631,_0x2a7301[_0x9d66('0x23')],'id');for(var _0x4480dc=0x0,_0x5af36c={},_0x3bfdeb={};_0x4480dc<_0x561631[_0x9d66('0x3f')];_0x4480dc+=0x1){_0x5af36c=_0x561631[_0x4480dc];if(_['isUndefined'](_0x2a7301[_0x9d66('0x23')][_0x5af36c['id']])){_0x2a7301[_0x9d66('0x23')][_0x5af36c['id']]=new FaxAccount(_0x5af36c);}else{_0x2a7301[_0x9d66('0x3e')](_0x2a7301['faxAccounts'][_0x5af36c['id']],_0x5af36c);}}}return _0x2a7301['faxAccounts'];};};module[_0x9d66('0x6b')]=Realtime; \ No newline at end of file +var _0x3dc3=['initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','total','queuecallercomplete','diff','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initFaxAccounts','faxAccounts','exports','moment','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','triggers','templates','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','mapKeys','format','name','hasOwnProperty','isNil','interface','SIP/%s','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','sumHoldTime','sumBillable','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','initTrunks','trunks','voiceQueues','initTriggers','initTemplates'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x3dc3,0x16a));var _0x33dc=function(_0x539010,_0x4a5c61){_0x539010=_0x539010-0x0;var _0x448990=_0x3dc3[_0x539010];return _0x448990;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var moment=require(_0x33dc('0x0'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x33dc('0x1'));var Template=require(_0x33dc('0x2'));var Campaign=require(_0x33dc('0x3'));var VoiceExtension=require(_0x33dc('0x4'));var ZendeskAccount=require(_0x33dc('0x5'));var SalesforceAccount=require(_0x33dc('0x6'));var FreshdeskAccount=require(_0x33dc('0x7'));var SugarcrmAccount=require(_0x33dc('0x8'));var ZohoAccount=require(_0x33dc('0x9'));var DeskAccount=require(_0x33dc('0xa'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x33dc('0xb'));var Dynamics365Account=require(_0x33dc('0xc'));var FreshsalesAccount=require(_0x33dc('0xd'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x33dc('0xe')]={};this[_0x33dc('0xf')]={};this['trunks']={};this['voiceQueues']={};this[_0x33dc('0x10')]={};this['campaigns']={};this[_0x33dc('0x11')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x33dc('0x12')]={};this[_0x33dc('0x13')]={};this[_0x33dc('0x14')]={};this[_0x33dc('0x15')]={};this[_0x33dc('0x16')]={};this[_0x33dc('0x17')]={};this[_0x33dc('0x18')]={};this['sugarcrmAccounts']={};this[_0x33dc('0x19')]={};this[_0x33dc('0x1a')]={};this[_0x33dc('0x1b')]={};this[_0x33dc('0x1c')]={};this['servicenowAccounts']={};this['dynamics365Accounts']={};this['freshsalesAccounts']={};this['faxAccounts']={};};function freeIsNotKey(_0x57269d,_0x35f6aa,_0x579b15){var _0x6838b9=_['mapKeys'](_0x57269d,function(_0x49fae5,_0x26a4b3){return _0x49fae5[_0x579b15];});for(var _0x2e29a5 in _0x35f6aa){if(_0x35f6aa['hasOwnProperty'](_0x2e29a5)){if(!_0x6838b9[_0x2e29a5]){delete _0x35f6aa[_0x2e29a5];}}}}function freeIsNotKeySip(_0xf3562a,_0x3923d5){var _0x3d8783=_[_0x33dc('0x1d')](_0xf3562a,function(_0x5c860f,_0x46305f){return util[_0x33dc('0x1e')]('SIP/%s',_0x5c860f[_0x33dc('0x1f')]);});for(var _0xe4a9d2 in _0x3923d5){if(_0x3923d5[_0x33dc('0x20')](_0xe4a9d2)){if(!_0x3d8783[_0xe4a9d2]){delete _0x3923d5[_0xe4a9d2];}}}}function freeIsNotKeyAgent(_0x42bce3,_0x362f25){var _0x46280a=_[_0x33dc('0x1d')](_0x42bce3,function(_0x174ffe,_0x331e25){var _0xa62389=_[_0x33dc('0x21')](_0x174ffe[_0x33dc('0x22')])?util['format'](_0x33dc('0x23'),_0x174ffe['name']):_0x174ffe[_0x33dc('0x22')];return _0xa62389;});for(var _0x3c2114 in _0x362f25){if(_0x362f25[_0x33dc('0x20')](_0x3c2114)){if(!_0x46280a[_0x3c2114]){delete _0x362f25[_0x3c2114];}}}}function clearVoiceCallReports(_0x29c509){_0x29c509['total']=0x0;_0x29c509['answered']=0x0;_0x29c509['sumHoldTime']=0x0;_0x29c509[_0x33dc('0x24')]=0x0;_0x29c509['sumBillable']=0x0;}function clearCampaigns(_0x225688){if(!_[_0x33dc('0x25')](_0x225688)){for(var _0xc43e09 in _0x225688){if(_0x225688[_0x33dc('0x20')](_0xc43e09)){_0x225688[_0xc43e09][_0x33dc('0x26')]=0x0;_0x225688[_0xc43e09][_0x33dc('0x27')]=0x0;}}}}function clearVoiceQueues(_0x1712ad){if(!_[_0x33dc('0x25')](_0x1712ad)){for(var _0x1b0781 in _0x1712ad){if(_0x1712ad[_0x33dc('0x20')](_0x1b0781)){_0x1712ad[_0x1b0781]['total']=0x0;_0x1712ad[_0x1b0781][_0x33dc('0x28')]=0x0;_0x1712ad[_0x1b0781][_0x33dc('0x29')]=0x0;_0x1712ad[_0x1b0781][_0x33dc('0x2a')]=0x0;_0x1712ad[_0x1b0781][_0x33dc('0x2b')]=0x0;_0x1712ad[_0x1b0781]['sumDuration']=0x0;_0x1712ad[_0x1b0781][_0x33dc('0x2c')]=0x0;_0x1712ad[_0x1b0781]['outboundAnswerAgiCallsDay']=0x0;_0x1712ad[_0x1b0781]['outboundNoAnswerCallsDay']=0x0;_0x1712ad[_0x1b0781][_0x33dc('0x2d')]=0x0;_0x1712ad[_0x1b0781][_0x33dc('0x2e')]=0x0;_0x1712ad[_0x1b0781][_0x33dc('0x2f')]=0x0;_0x1712ad[_0x1b0781][_0x33dc('0x30')]=0x0;_0x1712ad[_0x1b0781][_0x33dc('0x31')]=0x0;_0x1712ad[_0x1b0781]['outboundDropCallsDayCallersExit']=0x0;_0x1712ad[_0x1b0781][_0x33dc('0x32')]=0x0;_0x1712ad[_0x1b0781][_0x33dc('0x33')]=0x0;_0x1712ad[_0x1b0781][_0x33dc('0x34')]=0x0;_0x1712ad[_0x1b0781][_0x33dc('0x35')]=0x0;_0x1712ad[_0x1b0781]['outboundAnswerAgiCallsDay']=0x0;_0x1712ad[_0x1b0781][_0x33dc('0x36')]=0x0;_0x1712ad[_0x1b0781][_0x33dc('0x37')]=!![];}}}}Realtime[_0x33dc('0x38')][_0x33dc('0x39')]=function(_0x6c0f25,_0x3568c9){for(var _0x75313d in _0x3568c9){if(_0x6c0f25[_0x33dc('0x20')](_0x75313d)){_0x6c0f25[_0x75313d]=_0x3568c9[_0x75313d];}}};Realtime[_0x33dc('0x38')]['initAgents']=function(){var _0x47751b=this;return function(_0x4a2770){if(_0x4a2770){freeIsNotKeyAgent(_0x4a2770,_0x47751b[_0x33dc('0xe')]);for(var _0x2d69fa=0x0,_0x5bab1c={},_0x4f14d1={};_0x2d69fa<_0x4a2770[_0x33dc('0x3a')];_0x2d69fa+=0x1){_0x5bab1c=_0x4a2770[_0x2d69fa];var _0x423b20=_['isNil'](_0x5bab1c[_0x33dc('0x22')])?util[_0x33dc('0x1e')]('SIP/%s',_0x5bab1c[_0x33dc('0x1f')]):_0x5bab1c['interface'];if(_[_0x33dc('0x3b')](_0x47751b[_0x33dc('0xe')][_0x423b20])){_0x47751b[_0x33dc('0xe')][_0x423b20]=new Agent(_0x5bab1c);}else{_0x47751b[_0x33dc('0x39')](_0x47751b[_0x33dc('0xe')][_0x423b20],_0x5bab1c);}}}return _0x47751b[_0x33dc('0xe')];};};Realtime[_0x33dc('0x38')][_0x33dc('0x3c')]=function(){var _0x8e9559=this;return function(_0x7a53c5){if(_0x7a53c5){freeIsNotKeySip(_0x7a53c5,_0x8e9559[_0x33dc('0xf')]);for(var _0x19caf2=0x0,_0x31375d={},_0x2c937c={};_0x19caf2<_0x7a53c5[_0x33dc('0x3a')];_0x19caf2+=0x1){_0x31375d=_0x7a53c5[_0x19caf2];if(_[_0x33dc('0x3b')](_0x8e9559['telephones'][util['format'](_0x33dc('0x23'),_0x31375d['name'])])){_0x8e9559[_0x33dc('0xf')][util[_0x33dc('0x1e')](_0x33dc('0x23'),_0x31375d[_0x33dc('0x1f')])]=new Telephone(_0x31375d);}else{_0x8e9559['mergeFromDatabase'](_0x8e9559[_0x33dc('0xf')][util[_0x33dc('0x1e')](_0x33dc('0x23'),_0x31375d[_0x33dc('0x1f')])],_0x31375d);}}}return _0x8e9559[_0x33dc('0xf')];};};Realtime[_0x33dc('0x38')][_0x33dc('0x3d')]=function(){var _0x1beb57=this;return function(_0x11e656){if(_0x11e656){freeIsNotKeySip(_0x11e656,_0x1beb57['trunks']);for(var _0xaeca53=0x0,_0x530b01={},_0x219b4a={};_0xaeca53<_0x11e656[_0x33dc('0x3a')];_0xaeca53+=0x1){_0x530b01=_0x11e656[_0xaeca53];if(_['isUndefined'](_0x1beb57[_0x33dc('0x3e')][util[_0x33dc('0x1e')](_0x33dc('0x23'),_0x530b01[_0x33dc('0x1f')])])){_0x1beb57['trunks'][util[_0x33dc('0x1e')](_0x33dc('0x23'),_0x530b01[_0x33dc('0x1f')])]=new Trunk(_0x530b01);}else{_0x1beb57[_0x33dc('0x39')](_0x1beb57[_0x33dc('0x3e')][util[_0x33dc('0x1e')]('SIP/%s',_0x530b01[_0x33dc('0x1f')])],_0x530b01);}}}return _0x1beb57[_0x33dc('0x3e')];};};Realtime[_0x33dc('0x38')]['initVoiceQueues']=function(){var _0x3e46ba=this;return function(_0x555458){if(_0x555458){freeIsNotKey(_0x555458,_0x3e46ba[_0x33dc('0x3f')],_0x33dc('0x1f'));for(var _0x275b56=0x0,_0x182ebf={},_0x10df37={};_0x275b56<_0x555458['length'];_0x275b56+=0x1){_0x182ebf=_0x555458[_0x275b56];if(_[_0x33dc('0x3b')](_0x3e46ba[_0x33dc('0x3f')][_0x182ebf[_0x33dc('0x1f')]])){_0x3e46ba[_0x33dc('0x3f')][_0x182ebf[_0x33dc('0x1f')]]=new VoiceQueue(_0x182ebf);}else{_0x3e46ba['mergeFromDatabase'](_0x3e46ba['voiceQueues'][_0x182ebf['name']],_0x182ebf);}}}return _0x3e46ba['voiceQueues'];};};Realtime[_0x33dc('0x38')][_0x33dc('0x40')]=function(){var _0x1b6f14=this;return function(_0x40e5db){if(_0x40e5db){freeIsNotKey(_0x40e5db,_0x1b6f14[_0x33dc('0x10')],'id');for(var _0x564633=0x0,_0x4e30c2={},_0x31e97e={};_0x564633<_0x40e5db['length'];_0x564633+=0x1){_0x4e30c2=_0x40e5db[_0x564633];if(_[_0x33dc('0x3b')](_0x1b6f14[_0x33dc('0x10')][_0x4e30c2['id']])){_0x1b6f14[_0x33dc('0x10')][_0x4e30c2['id']]=new Trigger(_0x4e30c2);}else{_0x1b6f14[_0x33dc('0x39')](_0x1b6f14[_0x33dc('0x10')][_0x4e30c2['id']],_0x4e30c2);}}}return _0x1b6f14['triggers'];};};Realtime[_0x33dc('0x38')][_0x33dc('0x41')]=function(){var _0x5619da=this;return function(_0x55f6ac){if(_0x55f6ac){freeIsNotKey(_0x55f6ac,_0x5619da[_0x33dc('0x11')],'id');for(var _0x4e5b55=0x0,_0xaa6342={},_0x1665c6={};_0x4e5b55<_0x55f6ac['length'];_0x4e5b55+=0x1){_0xaa6342=_0x55f6ac[_0x4e5b55];if(_[_0x33dc('0x3b')](_0x5619da[_0x33dc('0x11')][_0xaa6342['id']])){_0x5619da[_0x33dc('0x11')][_0xaa6342['id']]=new Template(_0xaa6342);}else{_0x5619da[_0x33dc('0x39')](_0x5619da['templates'][_0xaa6342['id']],_0xaa6342);}}}return _0x5619da[_0x33dc('0x11')];};};Realtime[_0x33dc('0x38')]['initZendeskAccounts']=function(){var _0x2a42cb=this;return function(_0x14ed6d){if(_0x14ed6d){freeIsNotKey(_0x14ed6d,_0x2a42cb['zendeskAccounts'],'id');for(var _0x1c5e47=0x0,_0x3fb7d9={},_0x488358={};_0x1c5e47<_0x14ed6d['length'];_0x1c5e47+=0x1){_0x3fb7d9=_0x14ed6d[_0x1c5e47];if(_[_0x33dc('0x3b')](_0x2a42cb[_0x33dc('0x17')][_0x3fb7d9['id']])){_0x2a42cb[_0x33dc('0x17')][_0x3fb7d9['id']]=new ZendeskAccount(_0x3fb7d9);}else{_0x2a42cb[_0x33dc('0x39')](_0x2a42cb[_0x33dc('0x17')][_0x3fb7d9['id']],_0x3fb7d9);}}}return _0x2a42cb[_0x33dc('0x17')];};};Realtime[_0x33dc('0x38')]['initSalesforceAccounts']=function(){var _0x2f2ee1=this;return function(_0x42c548){if(_0x42c548){freeIsNotKey(_0x42c548,_0x2f2ee1[_0x33dc('0x18')],'id');for(var _0x467561=0x0,_0x2b8f6a={},_0x47da9f={};_0x467561<_0x42c548['length'];_0x467561+=0x1){_0x2b8f6a=_0x42c548[_0x467561];if(_[_0x33dc('0x3b')](_0x2f2ee1[_0x33dc('0x18')][_0x2b8f6a['id']])){_0x2f2ee1[_0x33dc('0x18')][_0x2b8f6a['id']]=new SalesforceAccount(_0x2b8f6a);}else{_0x2f2ee1[_0x33dc('0x39')](_0x2f2ee1[_0x33dc('0x18')][_0x2b8f6a['id']],_0x2b8f6a);}}}return _0x2f2ee1[_0x33dc('0x18')];};};Realtime[_0x33dc('0x38')]['initFreshdeskAccounts']=function(){var _0x5d5f08=this;return function(_0x18c141){if(_0x18c141){freeIsNotKey(_0x18c141,_0x5d5f08['freshdeskAccounts'],'id');for(var _0x117021=0x0,_0x579635={},_0x3eb68b={};_0x117021<_0x18c141[_0x33dc('0x3a')];_0x117021+=0x1){_0x579635=_0x18c141[_0x117021];if(_['isUndefined'](_0x5d5f08[_0x33dc('0x19')][_0x579635['id']])){_0x5d5f08['freshdeskAccounts'][_0x579635['id']]=new FreshdeskAccount(_0x579635);}else{_0x5d5f08[_0x33dc('0x39')](_0x5d5f08[_0x33dc('0x19')][_0x579635['id']],_0x579635);}}}return _0x5d5f08[_0x33dc('0x19')];};};Realtime['prototype'][_0x33dc('0x42')]=function(){var _0x5a8e6f=this;return function(_0x495be7){if(_0x495be7){freeIsNotKey(_0x495be7,_0x5a8e6f[_0x33dc('0x1a')],'id');for(var _0x32fe1e=0x0,_0x4b2c0c={},_0x478cd8={};_0x32fe1e<_0x495be7[_0x33dc('0x3a')];_0x32fe1e+=0x1){_0x4b2c0c=_0x495be7[_0x32fe1e];if(_[_0x33dc('0x3b')](_0x5a8e6f[_0x33dc('0x1a')][_0x4b2c0c['id']])){_0x5a8e6f[_0x33dc('0x1a')][_0x4b2c0c['id']]=new ZohoAccount(_0x4b2c0c);}else{_0x5a8e6f[_0x33dc('0x39')](_0x5a8e6f['zohoAccounts'][_0x4b2c0c['id']],_0x4b2c0c);}}}return _0x5a8e6f[_0x33dc('0x1a')];};};Realtime[_0x33dc('0x38')][_0x33dc('0x43')]=function(){var _0x5e5d1f=this;return function(_0x4a77a2){if(_0x4a77a2){freeIsNotKey(_0x4a77a2,_0x5e5d1f['deskAccounts'],'id');for(var _0x17e3d5=0x0,_0x1e2279={},_0x3ad3e3={};_0x17e3d5<_0x4a77a2[_0x33dc('0x3a')];_0x17e3d5+=0x1){_0x1e2279=_0x4a77a2[_0x17e3d5];if(_[_0x33dc('0x3b')](_0x5e5d1f[_0x33dc('0x1b')][_0x1e2279['id']])){_0x5e5d1f[_0x33dc('0x1b')][_0x1e2279['id']]=new DeskAccount(_0x1e2279);}else{_0x5e5d1f[_0x33dc('0x39')](_0x5e5d1f['deskAccounts'][_0x1e2279['id']],_0x1e2279);}}}return _0x5e5d1f[_0x33dc('0x1b')];};};Realtime[_0x33dc('0x38')][_0x33dc('0x44')]=function(){var _0x21106c=this;return function(_0x508afc){if(_0x508afc){freeIsNotKey(_0x508afc,_0x21106c[_0x33dc('0x45')],'id');for(var _0x1fd2d3=0x0,_0x12e7a1={},_0x17d96d={};_0x1fd2d3<_0x508afc[_0x33dc('0x3a')];_0x1fd2d3+=0x1){_0x12e7a1=_0x508afc[_0x1fd2d3];if(_[_0x33dc('0x3b')](_0x21106c[_0x33dc('0x45')][_0x12e7a1['id']])){_0x21106c[_0x33dc('0x45')][_0x12e7a1['id']]=new SugarcrmAccount(_0x12e7a1);}else{_0x21106c['mergeFromDatabase'](_0x21106c['sugarcrmAccounts'][_0x12e7a1['id']],_0x12e7a1);}}}return _0x21106c['sugarcrmAccounts'];};};Realtime[_0x33dc('0x38')][_0x33dc('0x46')]=function(){var _0x52007f=this;return function(_0x445ebb){if(_0x445ebb){freeIsNotKey(_0x445ebb,_0x52007f[_0x33dc('0x1c')],'id');for(var _0x323b9c=0x0,_0x7c722a={},_0x48d358={};_0x323b9c<_0x445ebb[_0x33dc('0x3a')];_0x323b9c+=0x1){_0x7c722a=_0x445ebb[_0x323b9c];if(_[_0x33dc('0x3b')](_0x52007f[_0x33dc('0x1c')][_0x7c722a['id']])){_0x52007f['vtigerAccounts'][_0x7c722a['id']]=new VtigerAccount(_0x7c722a);}else{_0x52007f[_0x33dc('0x39')](_0x52007f[_0x33dc('0x1c')][_0x7c722a['id']],_0x7c722a);}}}return _0x52007f[_0x33dc('0x1c')];};};Realtime[_0x33dc('0x38')][_0x33dc('0x47')]=function(){var _0x10e9a4=this;return function(_0x1bbaef){if(_0x1bbaef){freeIsNotKey(_0x1bbaef,_0x10e9a4[_0x33dc('0x48')],'id');for(var _0x53bccf=0x0,_0x1f6f3e={},_0xe5ef7b={};_0x53bccf<_0x1bbaef[_0x33dc('0x3a')];_0x53bccf+=0x1){_0x1f6f3e=_0x1bbaef[_0x53bccf];if(_[_0x33dc('0x3b')](_0x10e9a4[_0x33dc('0x48')][_0x1f6f3e['id']])){_0x10e9a4['servicenowAccounts'][_0x1f6f3e['id']]=new ServicenowAccount(_0x1f6f3e);}else{_0x10e9a4[_0x33dc('0x39')](_0x10e9a4[_0x33dc('0x48')][_0x1f6f3e['id']],_0x1f6f3e);}}}return _0x10e9a4[_0x33dc('0x48')];};};Realtime[_0x33dc('0x38')][_0x33dc('0x49')]=function(){var _0x5d4d45=this;return function(_0x2a352f){if(_0x2a352f){freeIsNotKey(_0x2a352f,_0x5d4d45[_0x33dc('0x4a')],'id');for(var _0x50ecfc=0x0,_0x54eb3a={},_0x1d1110={};_0x50ecfc<_0x2a352f[_0x33dc('0x3a')];_0x50ecfc+=0x1){_0x54eb3a=_0x2a352f[_0x50ecfc];if(_['isUndefined'](_0x5d4d45[_0x33dc('0x4a')][_0x54eb3a['id']])){_0x5d4d45['dynamics365Accounts'][_0x54eb3a['id']]=new Dynamics365Account(_0x54eb3a);}else{_0x5d4d45[_0x33dc('0x39')](_0x5d4d45[_0x33dc('0x4a')][_0x54eb3a['id']],_0x54eb3a);}}}return _0x5d4d45[_0x33dc('0x4a')];};};Realtime['prototype'][_0x33dc('0x4b')]=function(){var _0x1d20bc=this;return function(_0x56b853){if(_0x56b853){freeIsNotKey(_0x56b853,_0x1d20bc[_0x33dc('0x4c')],'id');for(var _0x47beec=0x0,_0x3a8e07={},_0x152308={};_0x47beec<_0x56b853['length'];_0x47beec+=0x1){_0x3a8e07=_0x56b853[_0x47beec];if(_[_0x33dc('0x3b')](_0x1d20bc[_0x33dc('0x4c')][_0x3a8e07['id']])){_0x1d20bc['freshsalesAccounts'][_0x3a8e07['id']]=new FreshsalesAccount(_0x3a8e07);}else{_0x1d20bc[_0x33dc('0x39')](_0x1d20bc[_0x33dc('0x4c')][_0x3a8e07['id']],_0x3a8e07);}}}return _0x1d20bc[_0x33dc('0x4c')];};};Realtime[_0x33dc('0x38')][_0x33dc('0x4d')]=function(){var _0x53a77c=this;return function(_0x46e43a){for(var _0x36d1ff=0x0;_0x36d1ff<_0x46e43a[_0x33dc('0x3a')];_0x36d1ff+=0x1){_[_0x33dc('0x4e')](_0x53a77c[_0x33dc('0x3f')][_0x46e43a[_0x36d1ff][_0x33dc('0x1f')]],_0x46e43a[_0x36d1ff]);}return _0x53a77c[_0x33dc('0x3f')];};};Realtime[_0x33dc('0x38')][_0x33dc('0x4f')]=function(){var _0x42d665=this;return function(_0x2cd453){clearVoiceQueues(_0x42d665[_0x33dc('0x3f')]);if(_0x2cd453){_0x2cd453=_[_0x33dc('0x50')](_0x2cd453,_0x33dc('0x51'));for(var _0x412fb8 in _0x2cd453){if(_0x2cd453[_0x33dc('0x20')](_0x412fb8)){var _0x3e201d={};for(var _0x19a4f1=0x0;_0x19a4f1<_0x2cd453[_0x412fb8][_0x33dc('0x3a')];_0x19a4f1+=0x1){var _0x1b4c6c=_0x2cd453[_0x412fb8][_0x19a4f1][_0x33dc('0x52')];if(_0x42d665[_0x33dc('0x3f')][_0x1b4c6c]){if(_0x2cd453[_0x412fb8][_0x19a4f1][_0x33dc('0x53')]){_0x42d665[_0x33dc('0x3f')][_0x1b4c6c]['unmanaged']+=0x1;}if(_0x2cd453[_0x412fb8][_0x19a4f1][_0x33dc('0x54')]){_0x42d665['voiceQueues'][_0x1b4c6c][_0x33dc('0x2a')]+=0x1;}_0x42d665[_0x33dc('0x3f')][_0x1b4c6c]['sumHoldTime']+=moment(_0x2cd453[_0x412fb8][_0x19a4f1]['queuecallerleaveAt'])['diff'](moment(_0x2cd453[_0x412fb8][_0x19a4f1][_0x33dc('0x55')]),_0x33dc('0x56'))||0x0;if(_0x19a4f1===_0x2cd453[_0x412fb8][_0x33dc('0x3a')]-0x1){_0x42d665['voiceQueues'][_0x1b4c6c][_0x33dc('0x24')]+=moment(_0x2cd453[_0x412fb8][_0x19a4f1][_0x33dc('0x57')]||_0x2cd453[_0x412fb8][_0x19a4f1][_0x33dc('0x58')]||_0x2cd453[_0x412fb8][_0x19a4f1][_0x33dc('0x59')])['diff'](moment(_0x2cd453[_0x412fb8][_0x19a4f1][_0x33dc('0x55')]),_0x33dc('0x56'))||0x0;_0x42d665[_0x33dc('0x3f')][_0x1b4c6c][_0x33dc('0x5a')]+=0x1;if(_0x2cd453[_0x412fb8][_0x19a4f1][_0x33dc('0x5b')]){_0x42d665['voiceQueues'][_0x1b4c6c][_0x33dc('0x28')]+=0x1;_0x42d665['voiceQueues'][_0x1b4c6c][_0x33dc('0x2c')]+=moment(_0x2cd453[_0x412fb8][_0x19a4f1][_0x33dc('0x57')])[_0x33dc('0x5c')](moment(_0x2cd453[_0x412fb8][_0x19a4f1][_0x33dc('0x5d')]),_0x33dc('0x56'))||0x0;}}else{_0x42d665[_0x33dc('0x3f')][_0x1b4c6c][_0x33dc('0x24')]+=_0x42d665[_0x33dc('0x3f')][_0x1b4c6c][_0x33dc('0x2b')]||0x0;}}}}}}return _0x42d665['voiceQueues'];};};Realtime[_0x33dc('0x38')][_0x33dc('0x5e')]=function(){var _0x416264=this;return function(_0x1bc745){clearVoiceCallReports(_0x416264[_0x33dc('0x5f')]);if(_0x1bc745){for(var _0x21924c=0x0;_0x21924c<_0x1bc745['length'];_0x21924c+=0x1){_0x416264['outbound'][_0x33dc('0x5a')]+=0x1;_0x416264['outbound'][_0x33dc('0x24')]+=_0x1bc745[_0x21924c][_0x33dc('0x60')];if(_0x1bc745[_0x21924c][_0x33dc('0x61')]===_0x33dc('0x62')){_0x416264[_0x33dc('0x5f')][_0x33dc('0x28')]+=0x1;_0x416264[_0x33dc('0x5f')][_0x33dc('0x2b')]+=_0x1bc745[_0x21924c]['duration']-_0x1bc745[_0x21924c]['billableseconds']||0x0;_0x416264[_0x33dc('0x5f')][_0x33dc('0x2c')]+=_0x1bc745[_0x21924c]['billableseconds'];}}}return _0x416264[_0x33dc('0x5f')];};};Realtime['prototype'][_0x33dc('0x63')]=function(){var _0x15e31f=this;return function(_0x98f89e){if(_0x98f89e){freeIsNotKey(_0x98f89e,_0x15e31f[_0x33dc('0x64')],_0x33dc('0x1f'));for(var _0x5741de=0x0,_0xfbc2f={};_0x5741de<_0x98f89e[_0x33dc('0x3a')];_0x5741de+=0x1){_0xfbc2f=_0x98f89e[_0x5741de];if(_['isUndefined'](_0x15e31f['campaigns'][_0xfbc2f[_0x33dc('0x1f')]])){_0x15e31f[_0x33dc('0x64')][_0xfbc2f[_0x33dc('0x1f')]]=new Campaign(_0xfbc2f);}else{_0x15e31f[_0x33dc('0x39')](_0x15e31f[_0x33dc('0x64')][_0xfbc2f[_0x33dc('0x1f')]],_0xfbc2f);_0x15e31f[_0x33dc('0x64')][_0xfbc2f[_0x33dc('0x1f')]][_0x33dc('0x65')]=_0xfbc2f['SquareProject']?_0xfbc2f[_0x33dc('0x66')]['name']:undefined;}}}return _0x15e31f[_0x33dc('0x64')];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x8629b=this;return function(_0x1dc10a){if(_0x1dc10a){freeIsNotKey(_0x1dc10a,_0x8629b[_0x33dc('0x67')],'id');for(var _0x4b5a18=0x0,_0x1a44bf={};_0x4b5a18<_0x1dc10a[_0x33dc('0x3a')];_0x4b5a18+=0x1){_0x1a44bf=_0x1dc10a[_0x4b5a18];if(_[_0x33dc('0x3b')](_0x8629b[_0x33dc('0x67')][_0x1a44bf['id']])){_0x8629b[_0x33dc('0x67')][_0x1a44bf['id']]=new VoiceExtension(_0x1a44bf);}else{_0x8629b[_0x33dc('0x39')](_0x8629b[_0x33dc('0x67')][_0x1a44bf['id']],_0x1a44bf);}}}return _0x8629b[_0x33dc('0x67')];};};Realtime[_0x33dc('0x38')]['initCampaignHopperHistory']=function(){var _0x4e7fd0=this;return function(_0x1cb29f){clearCampaigns(_0x4e7fd0[_0x33dc('0x64')]);for(var _0x1235ec=0x0;_0x1235ec<_0x1cb29f['length'];_0x1235ec+=0x1){_[_0x33dc('0x4e')](_0x4e7fd0[_0x33dc('0x64')][_0x1cb29f[_0x1235ec][_0x33dc('0x1f')]],_0x1cb29f[_0x1235ec]);}return _0x4e7fd0[_0x33dc('0x64')];};};Realtime[_0x33dc('0x38')][_0x33dc('0x68')]=function(){var _0x2b23a5=this;return function(_0x510212){if(_0x510212){freeIsNotKey(_0x510212,_0x2b23a5[_0x33dc('0x69')],'id');for(var _0x5374c9=0x0,_0x5adf99={},_0x3a03ae={};_0x5374c9<_0x510212[_0x33dc('0x3a')];_0x5374c9+=0x1){_0x5adf99=_0x510212[_0x5374c9];if(_['isUndefined'](_0x2b23a5[_0x33dc('0x69')][_0x5adf99['id']])){_0x2b23a5[_0x33dc('0x69')][_0x5adf99['id']]=new FaxAccount(_0x5adf99);}else{_0x2b23a5[_0x33dc('0x39')](_0x2b23a5[_0x33dc('0x69')][_0x5adf99['id']],_0x5adf99);}}}return _0x2b23a5[_0x33dc('0x69')];};};module[_0x33dc('0x6a')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index e0a02e4..4a9506b 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 _0xeb70=['queue','lastdata','context','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','callerid','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','type','UserId','membername','monitorFilename','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','Local','substring','indexOf','phone','lastIndexOf','blindTransfer','transfererlinkedid','lodash','moment','util','../rpc/voiceAgentReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','realtime','agents','telephones','sync','xdr','disabled','custom:voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','name','isNil','accountcode','find','SIP/%s','prototype','voiceQueueReport','length','connectedlinenum','assigned','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','format','create','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','internal','destination','exten','dialer'];(function(_0xa99a9c,_0x1e7e48){var _0x12380f=function(_0x2a7dcc){while(--_0x2a7dcc){_0xa99a9c['push'](_0xa99a9c['shift']());}};_0x12380f(++_0x1e7e48);}(_0xeb70,0xdb));var _0x0eb7=function(_0x3efc03,_0x165d06){_0x3efc03=_0x3efc03-0x0;var _0x11a8e2=_0xeb70[_0x3efc03];return _0x11a8e2;};'use strict';var _=require(_0x0eb7('0x0'));var moment=require(_0x0eb7('0x1'));var util=require(_0x0eb7('0x2'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x0eb7('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x0eb7('0x4'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x0eb7('0x5'));var RpcVoiceTransferReport=require(_0x0eb7('0x6'));var VoiceQueueReport=require(_0x0eb7('0x7'));var VoiceCallReport=require(_0x0eb7('0x8'));var VoiceAgentReport=require(_0x0eb7('0x9'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x17ad66){this[_0x0eb7('0xa')]=_0x17ad66;this[_0x0eb7('0xb')]=_0x17ad66[_0x0eb7('0xb')];this['telephones']=_0x17ad66[_0x0eb7('0xc')];}Report['prototype'][_0x0eb7('0xd')]=function(_0x998021){var _0x4a0453=new VoiceQueueReport(this[_0x0eb7('0xa')]);var _0x251e32=new VoiceAgentReport(this[_0x0eb7('0xa')]);var _0x1bf4cc=new VoiceDialReport(this['realtime']);var _0xff265=new VoiceCallReport(this['realtime']);var _0x50744c=new UserReport(this[_0x0eb7('0xa')]);if(config[_0x0eb7('0xe')]&&config['xdr'][_0x0eb7('0xf')]){ami['on'](_0x0eb7('0x10'),this['voiceQueueReport'][_0x0eb7('0x11')](this));ami['on']('custom:voiceCallReport',this[_0x0eb7('0x12')][_0x0eb7('0x11')](this));ami['on'](_0x0eb7('0x13'),this[_0x0eb7('0x14')][_0x0eb7('0x11')](this));ami['on'](_0x0eb7('0x15'),this[_0x0eb7('0x16')][_0x0eb7('0x11')](this));ami['on'](_0x0eb7('0x17'),this['blindTransfer'][_0x0eb7('0x11')](this));ami['on'](_0x0eb7('0x18'),this[_0x0eb7('0x19')][_0x0eb7('0x11')](this));}};Report['prototype'][_0x0eb7('0x1a')]=function(_0xd2c04b){var _0x3862d0;_0x3862d0=_['find'](this[_0x0eb7('0xb')],function(_0x235b20){return _0x235b20['accountcode']==_0xd2c04b||_0x235b20[_0x0eb7('0x1b')]==_0xd2c04b;});if(_[_0x0eb7('0x1c')](_0x3862d0)){var _0x2249de=_['find'](this[_0x0eb7('0xc')],function(_0x2fe8a7){return _0x2fe8a7[_0x0eb7('0x1d')]==_0xd2c04b||_0x2fe8a7[_0x0eb7('0x1b')]==_0xd2c04b;});if(_0x2249de){_0x3862d0=_[_0x0eb7('0x1e')](this['agents'],function(_0x23a8ae){return _0x23a8ae['interface']==util['format'](_0x0eb7('0x1f'),_0x2249de['name']);});}}return _0x3862d0;};Report[_0x0eb7('0x20')][_0x0eb7('0x21')]=function(_0x38a9cc){for(var _0x5545f3=0x0;_0x5545f3<_0x38a9cc[_0x0eb7('0x22')];_0x5545f3+=0x1){var _0xa6e79b=this[_0x0eb7('0x1a')](_0x38a9cc[_0x5545f3][_0x0eb7('0x23')]);if(_0xa6e79b){_0x38a9cc[_0x5545f3][_0x0eb7('0x1d')]=_0xa6e79b[_0x0eb7('0x1d')];_0x38a9cc[_0x5545f3][_0x0eb7('0x24')]=!![];_0x38a9cc[_0x5545f3][_0x0eb7('0x25')]=_0xa6e79b['name'];_0x38a9cc[_0x5545f3][_0x0eb7('0x26')]=_['isNil'](_0xa6e79b[_0x0eb7('0x26')])?util['format'](_0x0eb7('0x1f'),_0xa6e79b[_0x0eb7('0x1b')]):_0xa6e79b[_0x0eb7('0x26')];if(_0x38a9cc[_0x5545f3][_0x0eb7('0x27')]){_0x38a9cc[_0x5545f3][_0x0eb7('0x28')]=moment()['format'](_0x0eb7('0x29'));}if(_0x38a9cc[_0x5545f3][_0x0eb7('0x2a')]){_0x38a9cc[_0x5545f3][_0x0eb7('0x2b')]=moment()[_0x0eb7('0x2c')](_0x0eb7('0x29'));}RpcMemberReport[_0x0eb7('0x21')](_0x38a9cc[_0x5545f3]);}RpcVoiceQueueReport[_0x0eb7('0x2d')](_0x38a9cc[_0x5545f3]);}};function extractCalleridNumber(_0x59af3f){var _0x35d401=_0x59af3f['match'](/<(.*?)>/);return _0x35d401?_0x35d401[0x1]:_0x59af3f;}Report[_0x0eb7('0x20')][_0x0eb7('0x2e')]=function(_0x35cfd4){for(var _0x27f550=0x0;_0x27f550','linkedid','transfereelinkedid','blindTransfer','transfers','membername','monitor','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','indexOf','mobile','phone','substring','SIP/%s','attendedTransfer','exports','lodash','util','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','attendedtransfer','find','accountcode','name','isNil','interface','voiceQueueReport','length','findAgent','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','format','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','internal','destination','exten'];(function(_0x4f8126,_0x2eacbd){var _0x3dccf8=function(_0x1b8b0c){while(--_0x1b8b0c){_0x4f8126['push'](_0x4f8126['shift']());}};_0x3dccf8(++_0x2eacbd);}(_0x4e7f,0xda));var _0xf4e7=function(_0x3d83ac,_0x1d0135){_0x3d83ac=_0x3d83ac-0x0;var _0x299760=_0x4e7f[_0x3d83ac];return _0x299760;};'use strict';var _=require(_0xf4e7('0x0'));var moment=require('moment');var util=require(_0xf4e7('0x1'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xf4e7('0x2'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xf4e7('0x3'));var RpcVoiceRecording=require(_0xf4e7('0x4'));var RpcVoiceTransferReport=require(_0xf4e7('0x5'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xf4e7('0x6'));var VoiceAgentReport=require(_0xf4e7('0x7'));var VoiceDialReport=require(_0xf4e7('0x8'));var UserReport=require('./userReport');function Report(_0x325afe){this[_0xf4e7('0x9')]=_0x325afe;this[_0xf4e7('0xa')]=_0x325afe['agents'];this[_0xf4e7('0xb')]=_0x325afe[_0xf4e7('0xb')];}Report[_0xf4e7('0xc')][_0xf4e7('0xd')]=function(_0xf4ce03){var _0x5c54ca=new VoiceQueueReport(this[_0xf4e7('0x9')]);var _0x5ab2ce=new VoiceAgentReport(this[_0xf4e7('0x9')]);var _0x2f0254=new VoiceDialReport(this[_0xf4e7('0x9')]);var _0x54fa95=new VoiceCallReport(this[_0xf4e7('0x9')]);var _0x54ec86=new UserReport(this[_0xf4e7('0x9')]);if(config[_0xf4e7('0xe')]&&config[_0xf4e7('0xe')][_0xf4e7('0xf')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0xf4e7('0x10')](this));ami['on'](_0xf4e7('0x11'),this[_0xf4e7('0x12')][_0xf4e7('0x10')](this));ami['on'](_0xf4e7('0x13'),this[_0xf4e7('0x14')]['bind'](this));ami['on'](_0xf4e7('0x15'),this[_0xf4e7('0x16')]['bind'](this));ami['on']('blindtransfer',this['blindTransfer'][_0xf4e7('0x10')](this));ami['on'](_0xf4e7('0x17'),this['attendedTransfer'][_0xf4e7('0x10')](this));}};Report[_0xf4e7('0xc')]['findAgent']=function(_0x30bb8c){var _0x25d3e3;_0x25d3e3=_[_0xf4e7('0x18')](this[_0xf4e7('0xa')],function(_0x3e2a89){return _0x3e2a89[_0xf4e7('0x19')]==_0x30bb8c||_0x3e2a89[_0xf4e7('0x1a')]==_0x30bb8c;});if(_[_0xf4e7('0x1b')](_0x25d3e3)){var _0x230a51=_[_0xf4e7('0x18')](this['telephones'],function(_0x3169d4){return _0x3169d4[_0xf4e7('0x19')]==_0x30bb8c||_0x3169d4['name']==_0x30bb8c;});if(_0x230a51){_0x25d3e3=_[_0xf4e7('0x18')](this[_0xf4e7('0xa')],function(_0x4a78e7){return _0x4a78e7[_0xf4e7('0x1c')]==util['format']('SIP/%s',_0x230a51[_0xf4e7('0x1a')]);});}}return _0x25d3e3;};Report[_0xf4e7('0xc')][_0xf4e7('0x1d')]=function(_0x541574){for(var _0x534997=0x0;_0x534997<_0x541574[_0xf4e7('0x1e')];_0x534997+=0x1){var _0x568b9a=this[_0xf4e7('0x1f')](_0x541574[_0x534997][_0xf4e7('0x20')]);if(_0x568b9a){_0x541574[_0x534997][_0xf4e7('0x19')]=_0x568b9a[_0xf4e7('0x19')];_0x541574[_0x534997][_0xf4e7('0x21')]=!![];_0x541574[_0x534997][_0xf4e7('0x22')]=_0x568b9a[_0xf4e7('0x1a')];_0x541574[_0x534997][_0xf4e7('0x1c')]=_[_0xf4e7('0x1b')](_0x568b9a[_0xf4e7('0x1c')])?util['format']('SIP/%s',_0x568b9a[_0xf4e7('0x1a')]):_0x568b9a[_0xf4e7('0x1c')];if(_0x541574[_0x534997][_0xf4e7('0x23')]){_0x541574[_0x534997][_0xf4e7('0x24')]=moment()['format'](_0xf4e7('0x25'));}if(_0x541574[_0x534997]['queuecallerexit']){_0x541574[_0x534997][_0xf4e7('0x26')]=moment()[_0xf4e7('0x27')](_0xf4e7('0x25'));}RpcMemberReport['voiceQueueReport'](_0x541574[_0x534997]);}RpcVoiceQueueReport[_0xf4e7('0x28')](_0x541574[_0x534997]);}};function extractCalleridNumber(_0x85c323){var _0x2914b5=_0x85c323[_0xf4e7('0x29')](/<(.*?)>/);return _0x2914b5?_0x2914b5[0x1]:_0x85c323;}Report[_0xf4e7('0xc')][_0xf4e7('0x2a')]=function(_0x1fef75){for(var _0x21016f=0x0;_0x21016f0x0?_0x4bb2e0:0x0;this[_0x15ac('0x14')][_0x2d536b[_0x15ac('0x6a')]]['talking']=this[_0x15ac('0x14')][_0x2d536b[_0x15ac('0x6a')]]['talking']>_[_0x15ac('0x71')](_0x2d536b[_0x15ac('0x70')])?_[_0x15ac('0x71')](_0x2d536b[_0x15ac('0x70')]):this[_0x15ac('0x14')][_0x2d536b[_0x15ac('0x6a')]]['talking'];this[_0x15ac('0x4f')](this[_0x15ac('0x14')][_0x2d536b[_0x15ac('0x6a')]],_0x15ac('0x18'));}logger[_0x15ac('0x42')](_0x15ac('0x72'),util[_0x15ac('0x3b')](this[_0x15ac('0x14')][_0x2d536b[_0x15ac('0x6a')]],{'showHidden':![],'depth':null}));ami[_0x15ac('0x40')](_0x15ac('0x73'),this[_0x15ac('0x14')][_0x2d536b[_0x15ac('0x6a')]]);}}}catch(_0x27f03a){logger[_0x15ac('0x3a')](_0x15ac('0x69'),util[_0x15ac('0x3b')](_0x27f03a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x15ac('0xd')][_0x15ac('0x1c')]=function(_0x586683){logger[_0x15ac('0x42')](_0x15ac('0x74'),util['inspect'](_0x586683,{'showHidden':![],'depth':null}));this[_0x15ac('0x15')]=!![];};VoiceQueueReport[_0x15ac('0xd')][_0x15ac('0x1d')]=function(_0x488647){try{if(this['isNotNull'](_0x488647)){logger['debug'](_0x15ac('0x75'),_0x488647[_0x15ac('0x45')],util[_0x15ac('0x3b')](_0x488647,{'showHidden':![],'depth':null}));if(_[_0x15ac('0x66')](this['queueReports'][_0x488647['uniqueid']]))this[_0x15ac('0x12')][_0x488647[_0x15ac('0x45')]]=[];if(_[_0x15ac('0x66')](this['channels'][_0x488647[_0x15ac('0x45')]]))this[_0x15ac('0x13')][_0x488647[_0x15ac('0x45')]]={};var _0x135f66=new QueueReport();_0x135f66[_0x15ac('0x47')]=_0x488647[_0x15ac('0x6a')];_0x135f66[_0x15ac('0x50')]=this[_0x15ac('0x14')][_0x135f66[_0x15ac('0x47')]]&&this[_0x15ac('0x14')][_0x135f66['name']]['type']?this[_0x15ac('0x14')][_0x135f66[_0x15ac('0x47')]][_0x15ac('0x50')]||_0x15ac('0x51'):_0x15ac('0x51');_0x135f66['queue']=_0x488647[_0x15ac('0x6a')];_0x135f66[_0x15ac('0x76')]=moment()[_0x15ac('0x63')](_0x15ac('0x77'));_0x135f66['position']=_0x488647[_0x15ac('0x78')];_0x135f66[_0x15ac('0x79')]=_0x488647[_0x15ac('0x79')];_0x135f66[_0x15ac('0x45')]=_0x488647[_0x15ac('0x45')];_0x135f66[_0x15ac('0x7a')]=this['channels'][_0x488647['uniqueid']][_0x15ac('0x7a')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x135f66['name'],_0x135f66[_0x15ac('0x50')]);_[_0x15ac('0x7b')](_0x135f66,_[_0x15ac('0x7c')](_0x488647,_['keys'](_0x135f66)));this[_0x15ac('0x12')][_0x488647[_0x15ac('0x45')]][_0x15ac('0x7d')](_0x135f66);this[_0x15ac('0x13')][_0x488647[_0x15ac('0x45')]]=_0x135f66;this['emitVoiceQueueChannelSave'](_0x135f66,_0x15ac('0x7e'));}}catch(_0x423f32){logger[_0x15ac('0x3a')](_0x15ac('0x75'),_0x488647[_0x15ac('0x45')],util['inspect'](_0x423f32,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x15ac('0xd')][_0x15ac('0x7f')]=function(_0xb29d1f){try{if(this[_0x15ac('0x65')](_0xb29d1f)){logger[_0x15ac('0x42')]('[%s][voiceQueueReport][queuecallerabandon]',_0xb29d1f[_0x15ac('0x45')],util[_0x15ac('0x3b')](_0xb29d1f,{'showHidden':![],'depth':null}));if(this[_0x15ac('0x12')][_0xb29d1f[_0x15ac('0x45')]]){var _0x53d6b4=_[_0x15ac('0x80')](this[_0x15ac('0x12')][_0xb29d1f['uniqueid']]);_0x53d6b4[_0x15ac('0x81')]=![];_0x53d6b4[_0x15ac('0x82')]=null;_0x53d6b4['holdtime']=_0xb29d1f[_0x15ac('0x83')];_0x53d6b4['originalposition']=_0xb29d1f[_0x15ac('0x84')];_0x53d6b4[_0x15ac('0x1e')]=!![];_0x53d6b4['queuecallerabandonAt']=moment()[_0x15ac('0x63')](_0x15ac('0x77'));_0x53d6b4[_0x15ac('0x4c')]='ABANDONED';_0x53d6b4[_0x15ac('0x85')]=null;logger['info'](_0x15ac('0x86'),_0x53d6b4[_0x15ac('0x47')],_0x53d6b4[_0x15ac('0x50')]);this[_0x15ac('0x13')][_0xb29d1f[_0x15ac('0x45')]]=_0x53d6b4;this[_0x15ac('0x4a')](_0x53d6b4,_0x15ac('0x1e'));}}}catch(_0x1cc47d){logger[_0x15ac('0x3a')](_0x15ac('0x87'),_0xb29d1f[_0x15ac('0x45')],util[_0x15ac('0x3b')](_0x1cc47d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x15ac('0xd')][_0x15ac('0x88')]=function(_0x3bf3cb){try{if(this[_0x15ac('0x65')](_0x3bf3cb)){logger['debug'](_0x15ac('0x89'),_0x3bf3cb[_0x15ac('0x45')],util['inspect'](_0x3bf3cb,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3bf3cb[_0x15ac('0x45')]]){var _0x1d8dfe=_[_0x15ac('0x80')](this['queueReports'][_0x3bf3cb['uniqueid']]);_0x1d8dfe[_0x15ac('0x8a')]=moment()['format'](_0x15ac('0x77'));_0x1d8dfe['connectedlinenum']=_0x3bf3cb[_0x15ac('0x8b')];_0x1d8dfe[_0x15ac('0x8c')]=_0x3bf3cb[_0x15ac('0x8c')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x1d8dfe['name'],_0x1d8dfe['type'],_0x3bf3cb[_0x15ac('0x8b')],_0x3bf3cb[_0x15ac('0x8c')]);this['channels'][_0x3bf3cb['uniqueid']]=_0x1d8dfe;this['emitVoiceQueueChannelSave'](_0x1d8dfe,_0x15ac('0x1f'));}}}catch(_0x2f61e1){logger[_0x15ac('0x3a')](_0x15ac('0x89'),_0x3bf3cb[_0x15ac('0x45')],util['inspect'](_0x2f61e1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x15ac('0xd')][_0x15ac('0x21')]=function(_0x32dbc8){try{if(this[_0x15ac('0x65')](_0x32dbc8)){logger[_0x15ac('0x42')](_0x15ac('0x8d'),_0x32dbc8[_0x15ac('0x45')],util[_0x15ac('0x3b')](_0x32dbc8,{'showHidden':![],'depth':null}));if(this[_0x15ac('0x12')][_0x32dbc8[_0x15ac('0x45')]]){var _0x3ea99f=_['last'](this[_0x15ac('0x12')][_0x32dbc8[_0x15ac('0x45')]]);_0x3ea99f[_0x15ac('0x81')]=!![];_0x3ea99f[_0x15ac('0x4c')]=_0x15ac('0x8e');logger[_0x15ac('0x6c')](_0x15ac('0x8f'),_0x3ea99f[_0x15ac('0x47')],_0x3ea99f[_0x15ac('0x50')]);}}}catch(_0x238ab3){logger[_0x15ac('0x3a')](_0x15ac('0x8d'),_0x32dbc8[_0x15ac('0x45')],util[_0x15ac('0x3b')](_0x238ab3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x15ac('0xd')][_0x15ac('0x90')]=function(_0x583f95){try{if(this[_0x15ac('0x65')](_0x583f95)){logger[_0x15ac('0x42')](_0x15ac('0x91'),_0x583f95[_0x15ac('0x45')],util[_0x15ac('0x3b')](_0x583f95,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x583f95[_0x15ac('0x45')]]){var _0x3a7799=_['last'](this[_0x15ac('0x12')][_0x583f95[_0x15ac('0x45')]]);_0x3a7799['queuecallerabandon']=![];_0x3a7799[_0x15ac('0x92')]=null;_0x3a7799[_0x15ac('0x93')]=!![];_0x3a7799[_0x15ac('0x85')]=_0x583f95[_0x15ac('0x94')];_0x3a7799['holdtime']=_0x583f95['holdtime'];_0x3a7799['queuecallercomplete']=!![];_0x3a7799[_0x15ac('0x95')]=![];_0x3a7799[_0x15ac('0x96')]=null;if(!_0x3a7799[_0x15ac('0x97')]){if(_0x583f95['reason']==_0x15ac('0x97')){_0x3a7799[_0x15ac('0x4c')]=_0x15ac('0x98');logger[_0x15ac('0x6c')](_0x15ac('0x99'),_0x3a7799['name'],_0x3a7799['type']);}else{if(_['startsWith'](_0x583f95['channel'][_0x15ac('0x9a')](),_0x15ac('0x9b'))){if(this[_0x15ac('0x12')][_0x583f95[_0x15ac('0x9c')]]){var _0x500182=_[_0x15ac('0x80')](this[_0x15ac('0x12')][_0x583f95[_0x15ac('0x9c')]]);_0x500182[_0x15ac('0x81')]=![];_0x500182[_0x15ac('0x95')]=!![];_0x500182['queuecallerexitAt']=moment(_0x3a7799['queuecallerjoinAt'])[_0x15ac('0x9d')](_0x583f95['holdtime'],'seconds')[_0x15ac('0x63')](_0x15ac('0x77'));_0x500182['queuecallerexitreason']='FORWARDTRANSFER';_0x500182[_0x15ac('0x97')]=!![];_0x500182['transfertype']=_0x15ac('0x9e');_0x500182['transferexten']=_0x583f95[_0x15ac('0x9f')];_0x500182[_0x15ac('0xa0')]=_0x583f95[_0x15ac('0x45')];logger[_0x15ac('0x6c')](_0x15ac('0xa1'),_0x500182[_0x15ac('0x47')],_0x500182[_0x15ac('0x50')]);var _0x4d22ca=this[_0x15ac('0x12')][_0x583f95[_0x15ac('0x9c')]];this[_0x15ac('0x12')][_0x583f95[_0x15ac('0x9c')]]=this[_0x15ac('0x12')][_0x583f95[_0x15ac('0x45')]];this['queueReports'][_0x583f95[_0x15ac('0x45')]]=_0x4d22ca;}}else{_0x3a7799[_0x15ac('0x4c')]=_0x15ac('0xa2')+_0x583f95[_0x15ac('0xa3')][_0x15ac('0xa4')]();logger[_0x15ac('0x6c')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x3a7799[_0x15ac('0x47')],_0x3a7799[_0x15ac('0x50')],_0x3a7799[_0x15ac('0x4c')]);}}}this[_0x15ac('0x13')][_0x583f95['uniqueid']]=_0x3a7799;this[_0x15ac('0x4a')](_0x3a7799,_0x15ac('0x20'));}}}catch(_0x20d4ae){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0x583f95[_0x15ac('0x45')],util[_0x15ac('0x3b')](_0x20d4ae,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x15ac('0x23')]=function(_0x370191){try{if(this[_0x15ac('0x65')](_0x370191)){logger['debug'](_0x15ac('0xa5'),_0x370191[_0x15ac('0x45')],util[_0x15ac('0x3b')](_0x370191,{'showHidden':![],'depth':null}));this[_0x15ac('0xa6')](_0x370191['uniqueid'],_[_0x15ac('0xa7')](_0x370191[_0x15ac('0xa8')])[0x0],_0x370191[_0x15ac('0xa9')]);if(this['queueReports'][_0x370191[_0x15ac('0x45')]]){var _0x52461c=_['last'](this[_0x15ac('0x12')][_0x370191['uniqueid']]);if(_0x52461c){if(this[_0x15ac('0x65')](_0x370191['variable'])&&this[_0x15ac('0x65')](_0x370191[_0x15ac('0xa8')][_0x15ac('0xaa')])){switch(_0x370191['value']){case'CONTINUE':_0x52461c[_0x15ac('0x95')]=![];_0x52461c[_0x15ac('0x96')]=null;break;case _0x15ac('0xab'):_0x52461c[_0x15ac('0xac')]=_0x15ac('0xad');_0x52461c[_0x15ac('0x95')]=!![];_0x52461c['queuecallerexitAt']=moment()[_0x15ac('0x63')](_0x15ac('0x77'));_0x52461c[_0x15ac('0x8a')]=moment()[_0x15ac('0x63')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0x15ac('0xae'),_0x370191[_0x15ac('0x45')],util['inspect'](_0x52461c,{'showHidden':![],'depth':null}));ami[_0x15ac('0x40')](_0x15ac('0xaf'),_0x52461c);break;default:_0x52461c['queuecallerexit']=!![];_0x52461c[_0x15ac('0x96')]=moment()[_0x15ac('0x63')](_0x15ac('0x77'));_0x52461c[_0x15ac('0x8a')]=moment()[_0x15ac('0x63')](_0x15ac('0x77'));}_0x52461c[_0x15ac('0x1e')]=![];_0x52461c[_0x15ac('0x92')]=null;_0x52461c[_0x15ac('0x4c')]=_0x370191[_0x15ac('0xa9')];this[_0x15ac('0x13')][_0x370191[_0x15ac('0x45')]]=_0x52461c;this[_0x15ac('0x4a')](_0x52461c,_0x15ac('0x22'));}else if(this[_0x15ac('0x65')](_0x370191[_0x15ac('0xa8')])&&this[_0x15ac('0x65')](_0x370191[_0x15ac('0xa8')]['queueposition'])){if(!_0x52461c[_0x15ac('0x1e')]){_0x52461c[_0x15ac('0x95')]=!![];_0x52461c[_0x15ac('0x96')]=moment()[_0x15ac('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x52461c[_0x15ac('0x4c')]='EXITWITHKEY';_0x52461c['queuecallerleaveAt']=moment()[_0x15ac('0x63')](_0x15ac('0x77'));this[_0x15ac('0x13')][_0x370191[_0x15ac('0x45')]]=_0x52461c;}}logger[_0x15ac('0x6c')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x370191[_0x15ac('0x45')],_0x52461c[_0x15ac('0x47')],_0x52461c[_0x15ac('0x50')],_[_0x15ac('0xa7')](_0x370191[_0x15ac('0xa8')])[0x0],_0x370191['value']);_0x52461c['variables']=this[_0x15ac('0x17')][_0x370191['uniqueid']];}}}}catch(_0x23c6d2){logger[_0x15ac('0x3a')]('[%s][voiceQueueReport][varset]',_0x370191[_0x15ac('0x45')],util[_0x15ac('0x3b')](_0x23c6d2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x15ac('0xd')][_0x15ac('0xa6')]=function(_0x4f0073,_0x1f973f,_0x412be4){var _0x570a56=[_0x15ac('0xb0'),_0x15ac('0xb1'),_0x15ac('0xb2'),_0x15ac('0xb3'),_0x15ac('0xb4'),_0x15ac('0xb5'),_0x15ac('0xb6'),'rtpaudioqosrttbridged',_0x15ac('0xb7'),'sipuri',_0x15ac('0xb8'),_0x15ac('0xb9'),_0x15ac('0xba'),'memberdynamic',_0x15ac('0xbb'),_0x15ac('0xbc'),'membername',_0x15ac('0xbd'),'memberrealtime'];if(!_[_0x15ac('0x36')](_0x1f973f)&&!_['includes'](_0x570a56,_0x1f973f)){if(_[_0x15ac('0x66')](this[_0x15ac('0x17')][_0x4f0073])){this['variables'][_0x4f0073]={};}this['variables'][_0x4f0073][_0x1f973f]=_0x412be4;}};VoiceQueueReport['prototype'][_0x15ac('0x24')]=function(_0x1b8bff){try{if(this[_0x15ac('0x65')](_0x1b8bff)){logger[_0x15ac('0x42')](_0x15ac('0xbe'),_0x1b8bff['uniqueid'],util[_0x15ac('0x3b')](_0x1b8bff,{'showHidden':![],'depth':null}));if(this[_0x15ac('0x12')][_0x1b8bff['uniqueid']]){for(var _0x3b2810=0x0,_0x29a513={};_0x3b28100x0?_0x257103:0x0;this[_0x50d6('0x12')][_0x5d3875[_0x50d6('0x69')]][_0x50d6('0x33')]=this['voiceQueues'][_0x5d3875['queue']][_0x50d6('0x33')]>_['toNumber'](_0x5d3875[_0x50d6('0x6f')])?_[_0x50d6('0x6e')](_0x5d3875[_0x50d6('0x6f')]):this[_0x50d6('0x12')][_0x5d3875[_0x50d6('0x69')]][_0x50d6('0x33')];this[_0x50d6('0x53')](this[_0x50d6('0x12')][_0x5d3875[_0x50d6('0x69')]],_0x50d6('0x15'));}logger['debug'](_0x50d6('0x70'),util[_0x50d6('0x3e')](this[_0x50d6('0x12')][_0x5d3875['queue']],{'showHidden':![],'depth':null}));ami[_0x50d6('0x44')](_0x50d6('0x71'),this[_0x50d6('0x12')][_0x5d3875[_0x50d6('0x69')]]);}}}catch(_0x1d3ba4){logger[_0x50d6('0x3b')](_0x50d6('0x67'),util[_0x50d6('0x3e')](_0x1d3ba4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x11d89f){logger[_0x50d6('0x46')](_0x50d6('0x72'),util[_0x50d6('0x3e')](_0x11d89f,{'showHidden':![],'depth':null}));this[_0x50d6('0x66')]=!![];};VoiceQueueReport[_0x50d6('0xb')][_0x50d6('0x73')]=function(_0x2d27df){try{if(this[_0x50d6('0x61')](_0x2d27df)){logger[_0x50d6('0x46')]('[%s][voiceQueueReport][queuecallerjoin]',_0x2d27df[_0x50d6('0x49')],util[_0x50d6('0x3e')](_0x2d27df,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x50d6('0xe')][_0x2d27df[_0x50d6('0x49')]]))this['queueReports'][_0x2d27df[_0x50d6('0x49')]]=[];if(_[_0x50d6('0x62')](this[_0x50d6('0x10')][_0x2d27df[_0x50d6('0x49')]]))this['channels'][_0x2d27df[_0x50d6('0x49')]]={};var _0x40ac8e=new QueueReport();_0x40ac8e[_0x50d6('0x4b')]=_0x2d27df[_0x50d6('0x69')];_0x40ac8e[_0x50d6('0x54')]=this['voiceQueues'][_0x40ac8e[_0x50d6('0x4b')]]&&this['voiceQueues'][_0x40ac8e['name']][_0x50d6('0x54')]?this[_0x50d6('0x12')][_0x40ac8e['name']][_0x50d6('0x54')]||_0x50d6('0x55'):_0x50d6('0x55');_0x40ac8e[_0x50d6('0x69')]=_0x2d27df[_0x50d6('0x69')];_0x40ac8e['queuecallerjoinAt']=moment()[_0x50d6('0x50')](_0x50d6('0x74'));_0x40ac8e[_0x50d6('0x75')]=_0x2d27df[_0x50d6('0x75')];_0x40ac8e[_0x50d6('0x76')]=_0x2d27df['count'];_0x40ac8e[_0x50d6('0x49')]=_0x2d27df[_0x50d6('0x49')];_0x40ac8e[_0x50d6('0x77')]=this[_0x50d6('0x10')][_0x2d27df[_0x50d6('0x49')]][_0x50d6('0x77')];logger['info'](_0x50d6('0x78'),_0x40ac8e[_0x50d6('0x4b')],_0x40ac8e[_0x50d6('0x54')]);_[_0x50d6('0x79')](_0x40ac8e,_['pick'](_0x2d27df,_[_0x50d6('0x7a')](_0x40ac8e)));this[_0x50d6('0xe')][_0x2d27df[_0x50d6('0x49')]]['push'](_0x40ac8e);this[_0x50d6('0x10')][_0x2d27df[_0x50d6('0x49')]]=_0x40ac8e;this['emitVoiceQueueChannelSave'](_0x40ac8e,_0x50d6('0x19'));}}catch(_0x283c5d){logger[_0x50d6('0x3b')]('[%s][voiceQueueReport][queuecallerjoin]',_0x2d27df[_0x50d6('0x49')],util[_0x50d6('0x3e')](_0x283c5d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x50d6('0xb')][_0x50d6('0x7b')]=function(_0x3304e3){try{if(this['isNotNull'](_0x3304e3)){logger[_0x50d6('0x46')](_0x50d6('0x7c'),_0x3304e3[_0x50d6('0x49')],util[_0x50d6('0x3e')](_0x3304e3,{'showHidden':![],'depth':null}));if(this[_0x50d6('0xe')][_0x3304e3[_0x50d6('0x49')]]){var _0x222546=_[_0x50d6('0x7d')](this[_0x50d6('0xe')][_0x3304e3[_0x50d6('0x49')]]);_0x222546[_0x50d6('0x7e')]=![];_0x222546[_0x50d6('0x7f')]=null;_0x222546[_0x50d6('0x80')]=_0x3304e3['holdtime'];_0x222546[_0x50d6('0x81')]=_0x3304e3['originalposition'];_0x222546[_0x50d6('0x1a')]=!![];_0x222546[_0x50d6('0x82')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x222546[_0x50d6('0x4e')]='ABANDONED';_0x222546[_0x50d6('0x83')]=null;logger[_0x50d6('0x6b')](_0x50d6('0x84'),_0x222546[_0x50d6('0x4b')],_0x222546['type']);this[_0x50d6('0x10')][_0x3304e3['uniqueid']]=_0x222546;this[_0x50d6('0x42')](_0x222546,'queuecallerabandon');}}}catch(_0x483ad9){logger[_0x50d6('0x3b')](_0x50d6('0x7c'),_0x3304e3[_0x50d6('0x49')],util[_0x50d6('0x3e')](_0x483ad9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x50d6('0x1c')]=function(_0x3d2ff6){try{if(this[_0x50d6('0x61')](_0x3d2ff6)){logger['debug'](_0x50d6('0x85'),_0x3d2ff6[_0x50d6('0x49')],util[_0x50d6('0x3e')](_0x3d2ff6,{'showHidden':![],'depth':null}));if(this[_0x50d6('0xe')][_0x3d2ff6['uniqueid']]){var _0x3a4fc6=_[_0x50d6('0x7d')](this['queueReports'][_0x3d2ff6[_0x50d6('0x49')]]);_0x3a4fc6[_0x50d6('0x86')]=moment()[_0x50d6('0x50')](_0x50d6('0x74'));_0x3a4fc6[_0x50d6('0x87')]=_0x3d2ff6['connectedlinenum'];_0x3a4fc6['connectedlinename']=_0x3d2ff6['connectedlinename'];logger[_0x50d6('0x6b')](_0x50d6('0x88'),_0x3a4fc6[_0x50d6('0x4b')],_0x3a4fc6[_0x50d6('0x54')],_0x3d2ff6['connectedlinenum'],_0x3d2ff6[_0x50d6('0x89')]);this[_0x50d6('0x10')][_0x3d2ff6[_0x50d6('0x49')]]=_0x3a4fc6;this[_0x50d6('0x45')](_0x3a4fc6,_0x50d6('0x1b'));}}}catch(_0x1e1d18){logger[_0x50d6('0x3b')](_0x50d6('0x85'),_0x3d2ff6[_0x50d6('0x49')],util[_0x50d6('0x3e')](_0x1e1d18,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x50d6('0xb')][_0x50d6('0x20')]=function(_0x36ce9f){try{if(this['isNotNull'](_0x36ce9f)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x36ce9f[_0x50d6('0x49')],util['inspect'](_0x36ce9f,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x36ce9f[_0x50d6('0x49')]]){var _0x2de2fe=_[_0x50d6('0x7d')](this[_0x50d6('0xe')][_0x36ce9f['uniqueid']]);_0x2de2fe[_0x50d6('0x7e')]=!![];_0x2de2fe[_0x50d6('0x4e')]='COMPLETEDBYAGENT';logger[_0x50d6('0x6b')](_0x50d6('0x8a'),_0x2de2fe[_0x50d6('0x4b')],_0x2de2fe['type']);}}}catch(_0x4a6b69){logger[_0x50d6('0x3b')](_0x50d6('0x8b'),_0x36ce9f[_0x50d6('0x49')],util['inspect'](_0x4a6b69,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x50d6('0xb')][_0x50d6('0x1e')]=function(_0x474706){try{if(this[_0x50d6('0x61')](_0x474706)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x474706[_0x50d6('0x49')],util[_0x50d6('0x3e')](_0x474706,{'showHidden':![],'depth':null}));if(this[_0x50d6('0xe')][_0x474706[_0x50d6('0x49')]]){var _0x2c332d=_[_0x50d6('0x7d')](this['queueReports'][_0x474706[_0x50d6('0x49')]]);_0x2c332d[_0x50d6('0x1a')]=![];_0x2c332d[_0x50d6('0x82')]=null;_0x2c332d[_0x50d6('0x8c')]=!![];_0x2c332d[_0x50d6('0x83')]=_0x474706[_0x50d6('0x8d')];_0x2c332d['holdtime']=_0x474706[_0x50d6('0x80')];_0x2c332d['queuecallercomplete']=!![];_0x2c332d['queuecallerexit']=![];_0x2c332d[_0x50d6('0x8e')]=null;if(!_0x2c332d['transfer']){if(_0x474706[_0x50d6('0x8f')]==_0x50d6('0x90')){_0x2c332d['queuecallerexitreason']=_0x50d6('0x91');logger[_0x50d6('0x6b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x2c332d[_0x50d6('0x4b')],_0x2c332d[_0x50d6('0x54')]);}else{if(_[_0x50d6('0x92')](_0x474706[_0x50d6('0x39')][_0x50d6('0x93')](),_0x50d6('0x94'))){if(this[_0x50d6('0xe')][_0x474706[_0x50d6('0x95')]]){var _0x264939=_['last'](this[_0x50d6('0xe')][_0x474706[_0x50d6('0x95')]]);_0x264939[_0x50d6('0x7e')]=![];_0x264939['queuecallerexit']=!![];_0x264939[_0x50d6('0x8e')]=moment(_0x2c332d[_0x50d6('0x96')])[_0x50d6('0x97')](_0x474706['holdtime'],_0x50d6('0x98'))[_0x50d6('0x50')](_0x50d6('0x74'));_0x264939[_0x50d6('0x4e')]=_0x50d6('0x99');_0x264939[_0x50d6('0x90')]=!![];_0x264939[_0x50d6('0x9a')]=_0x50d6('0x9b');_0x264939[_0x50d6('0x9c')]=_0x474706[_0x50d6('0x9d')];_0x264939[_0x50d6('0x9e')]=_0x474706[_0x50d6('0x49')];logger[_0x50d6('0x6b')](_0x50d6('0x9f'),_0x264939[_0x50d6('0x4b')],_0x264939[_0x50d6('0x54')]);var _0x325321=this['queueReports'][_0x474706[_0x50d6('0x95')]];this[_0x50d6('0xe')][_0x474706[_0x50d6('0x95')]]=this[_0x50d6('0xe')][_0x474706['uniqueid']];this[_0x50d6('0xe')][_0x474706[_0x50d6('0x49')]]=_0x325321;}}else{_0x2c332d[_0x50d6('0x4e')]=_0x50d6('0xa0')+_0x474706['reason']['toUpperCase']();logger[_0x50d6('0x6b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x2c332d[_0x50d6('0x4b')],_0x2c332d['type'],_0x2c332d['queuecallerexitreason']);}}}this[_0x50d6('0x10')][_0x474706[_0x50d6('0x49')]]=_0x2c332d;this['emitVoiceQueueChannelRemove'](_0x2c332d,'agentcomplete');}}}catch(_0x147a01){logger[_0x50d6('0x3b')](_0x50d6('0xa1'),_0x474706[_0x50d6('0x49')],util[_0x50d6('0x3e')](_0x147a01,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x50d6('0xb')]['syncVarSet']=function(_0x48bcbb){try{if(this['isNotNull'](_0x48bcbb)){logger[_0x50d6('0x46')](_0x50d6('0xa2'),_0x48bcbb['uniqueid'],util[_0x50d6('0x3e')](_0x48bcbb,{'showHidden':![],'depth':null}));this['addVariable'](_0x48bcbb[_0x50d6('0x49')],_['keys'](_0x48bcbb['variable'])[0x0],_0x48bcbb['value']);if(this[_0x50d6('0xe')][_0x48bcbb['uniqueid']]){var _0x16a615=_[_0x50d6('0x7d')](this['queueReports'][_0x48bcbb[_0x50d6('0x49')]]);if(_0x16a615){if(this[_0x50d6('0x61')](_0x48bcbb[_0x50d6('0xa3')])&&this['isNotNull'](_0x48bcbb[_0x50d6('0xa3')][_0x50d6('0xa4')])){switch(_0x48bcbb[_0x50d6('0xa5')]){case _0x50d6('0xa6'):_0x16a615[_0x50d6('0xa7')]=![];_0x16a615[_0x50d6('0x8e')]=null;break;case _0x50d6('0xa8'):_0x16a615['lastevent']=_0x50d6('0xa9');_0x16a615[_0x50d6('0xa7')]=!![];_0x16a615[_0x50d6('0x8e')]=moment()[_0x50d6('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x16a615[_0x50d6('0x86')]=moment()[_0x50d6('0x50')](_0x50d6('0x74'));logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x48bcbb['uniqueid'],util[_0x50d6('0x3e')](_0x16a615,{'showHidden':![],'depth':null}));ami[_0x50d6('0x44')](_0x50d6('0xaa'),_0x16a615);break;default:_0x16a615['queuecallerexit']=!![];_0x16a615['queuecallerexitAt']=moment()['format'](_0x50d6('0x74'));_0x16a615[_0x50d6('0x86')]=moment()[_0x50d6('0x50')](_0x50d6('0x74'));}_0x16a615[_0x50d6('0x1a')]=![];_0x16a615[_0x50d6('0x82')]=null;_0x16a615[_0x50d6('0x4e')]=_0x48bcbb[_0x50d6('0xa5')];this['channels'][_0x48bcbb[_0x50d6('0x49')]]=_0x16a615;this[_0x50d6('0x42')](_0x16a615,_0x50d6('0x21'));}else if(this[_0x50d6('0x61')](_0x48bcbb[_0x50d6('0xa3')])&&this[_0x50d6('0x61')](_0x48bcbb[_0x50d6('0xa3')][_0x50d6('0xab')])){if(!_0x16a615[_0x50d6('0x1a')]){_0x16a615['queuecallerexit']=!![];_0x16a615[_0x50d6('0x8e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x16a615[_0x50d6('0x4e')]=_0x50d6('0xac');_0x16a615[_0x50d6('0x86')]=moment()[_0x50d6('0x50')](_0x50d6('0x74'));this[_0x50d6('0x10')][_0x48bcbb['uniqueid']]=_0x16a615;}}logger['info'](_0x50d6('0xad'),_0x48bcbb['uniqueid'],_0x16a615['name'],_0x16a615[_0x50d6('0x54')],_[_0x50d6('0x7a')](_0x48bcbb[_0x50d6('0xa3')])[0x0],_0x48bcbb[_0x50d6('0xa5')]);_0x16a615['variables']=this[_0x50d6('0x14')][_0x48bcbb[_0x50d6('0x49')]];}}}}catch(_0x48dfc6){logger[_0x50d6('0x3b')]('[%s][voiceQueueReport][varset]',_0x48bcbb[_0x50d6('0x49')],util[_0x50d6('0x3e')](_0x48dfc6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x50d6('0xb')]['addVariable']=function(_0x5e73bc,_0x3b895b,_0xaeac71){var _0x3057ec=[_0x50d6('0xae'),_0x50d6('0xaf'),_0x50d6('0xb0'),'rtpaudioqosjitterbridged',_0x50d6('0xb1'),_0x50d6('0xb2'),'rtpaudioqosrtt',_0x50d6('0xb3'),_0x50d6('0xb4'),_0x50d6('0xb5'),'bridgepeer',_0x50d6('0xb6'),_0x50d6('0xb7'),'memberdynamic','memberinterface','memberlastcall',_0x50d6('0x8d'),_0x50d6('0xb8'),_0x50d6('0xb9')];if(!_['isNil'](_0x3b895b)&&!_[_0x50d6('0xba')](_0x3057ec,_0x3b895b)){if(_[_0x50d6('0x62')](this[_0x50d6('0x14')][_0x5e73bc])){this['variables'][_0x5e73bc]={};}this[_0x50d6('0x14')][_0x5e73bc][_0x3b895b]=_0xaeac71;}};VoiceQueueReport['prototype'][_0x50d6('0x24')]=function(_0x1381b1){try{if(this['isNotNull'](_0x1381b1)){logger[_0x50d6('0x46')](_0x50d6('0xbb'),_0x1381b1[_0x50d6('0x49')],util[_0x50d6('0x3e')](_0x1381b1,{'showHidden':![],'depth':null}));if(this[_0x50d6('0xe')][_0x1381b1['uniqueid']]){for(var _0x182349=0x0,_0x44e0b1={};_0x182349=0x0?moment(_0x3b59e1['endtime'])[_0xa6b4('0xc')](_0x3b59e1[_0xa6b4('0x18')],_0xa6b4('0xd')):null,'data1':_0xa6b4('0x1a'),'data2':_0x3b59e1['accountcode'],'data3':_0x3b59e1[_0xa6b4('0x10')],'data4':_0x3b59e1[_0xa6b4('0x1b')]||null,'role':_0xa6b4('0x1c'),'internal':_0x3b59e1['accountcode']?_['toNumber'](_0x3b59e1[_0xa6b4('0x12')]):undefined,'uniqueid':_0x3b59e1[_0xa6b4('0x14')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xf130=['util','../client','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','interface','queuecallerleaveAt','diff','seconds','calleridnum','queue','accountcode','toNumber','uniqueid','voiceDialReport','membername','TALKING','starttime','endtime','outbound','exten','dialstring','agent','lodash'];(function(_0x2901ea,_0x3f1e69){var _0xd002da=function(_0x17ee66){while(--_0x17ee66){_0x2901ea['push'](_0x2901ea['shift']());}};_0xd002da(++_0x3f1e69);}(_0xf130,0x1af));var _0x0f13=function(_0x1d14f8,_0x31282b){_0x1d14f8=_0x1d14f8-0x0;var _0x532c65=_0xf130[_0x1d14f8];return _0x532c65;};'use strict';var moment=require('moment');var _=require(_0x0f13('0x0'));var util=require(_0x0f13('0x1'));var client=require(_0x0f13('0x2'));exports[_0x0f13('0x3')]=function(_0x2f6bb4){var _0x1d65c5=_0x2f6bb4['queuecallercompleteAt']||_0x2f6bb4[_0x0f13('0x4')];return client[_0x0f13('0x5')](_0x0f13('0x6'),{'body':{'channel':_0x0f13('0x7'),'membername':_0x2f6bb4[_0x0f13('0x8')],'interface':_['isNil'](_0x2f6bb4['interface'])?util['format']('SIP/%s',_0x2f6bb4[_0x0f13('0x8')]):_0x2f6bb4[_0x0f13('0x9')],'type':'TALKING','enterAt':_0x2f6bb4[_0x0f13('0xa')],'exitAt':_0x1d65c5,'duration':moment(_0x1d65c5)[_0x0f13('0xb')](_0x2f6bb4[_0x0f13('0xa')],_0x0f13('0xc')),'data1':'inbound','data2':_0x2f6bb4[_0x0f13('0xd')],'data3':_0x2f6bb4['exten'],'data4':null,'data5':_0x2f6bb4[_0x0f13('0xe')],'role':'agent','internal':_0x2f6bb4[_0x0f13('0xf')]?_[_0x0f13('0x10')](_0x2f6bb4['accountcode']):undefined,'uniqueid':_0x2f6bb4[_0x0f13('0x11')]},'log':_0x0f13('0x6')});};exports[_0x0f13('0x12')]=function(_0x3f128c){return client['Request'](_0x0f13('0x6'),{'body':{'channel':_0x0f13('0x7'),'membername':_0x3f128c[_0x0f13('0x13')],'interface':_0x3f128c[_0x0f13('0x9')],'type':_0x0f13('0x14'),'enterAt':_0x3f128c[_0x0f13('0x15')],'exitAt':_0x3f128c[_0x0f13('0x16')],'duration':moment(_0x3f128c[_0x0f13('0x16')])['diff'](_0x3f128c['starttime'],'seconds')>=0x0?moment(_0x3f128c[_0x0f13('0x16')])[_0x0f13('0xb')](_0x3f128c['starttime'],_0x0f13('0xc')):null,'data1':_0x0f13('0x17'),'data2':_0x3f128c[_0x0f13('0xf')],'data3':_0x3f128c[_0x0f13('0x18')],'data4':_0x3f128c[_0x0f13('0x19')]||null,'role':_0x0f13('0x1a'),'internal':_0x3f128c[_0x0f13('0xf')]?_[_0x0f13('0x10')](_0x3f128c['accountcode']):undefined,'uniqueid':_0x3f128c[_0x0f13('0x11')]},'log':_0x0f13('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 5a2f0d4..bff7806 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 _0x4cf8=['Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings'];(function(_0x1e659f,_0x2d9a20){var _0x20ffbc=function(_0x48b037){while(--_0x48b037){_0x1e659f['push'](_0x1e659f['shift']());}};_0x20ffbc(++_0x2d9a20);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x45a7a6,_0x380289){_0x45a7a6=_0x45a7a6-0x0;var _0x514f51=_0x4cf8[_0x45a7a6];return _0x514f51;};'use strict';var client=require(_0x84cf('0x0'));exports[_0x84cf('0x1')]=function(){return client[_0x84cf('0x2')](_0x84cf('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x84cf('0x4'),_0x84cf('0x5')]},'log':_0x84cf('0x6')});}; \ No newline at end of file +var _0x9703=['ShowSetting','stopRecordingOnTransfer','GetSettings','Request'];(function(_0x192cf2,_0x46cfe0){var _0x2dfb66=function(_0x237b37){while(--_0x237b37){_0x192cf2['push'](_0x192cf2['shift']());}};_0x2dfb66(++_0x46cfe0);}(_0x9703,0xdb));var _0x3970=function(_0x174ae9,_0x1c4662){_0x174ae9=_0x174ae9-0x0;var _0x45d532=_0x9703[_0x174ae9];return _0x45d532;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x3970('0x0')](_0x3970('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3970('0x2'),'previewRecallmeReminderInterval']},'log':_0x3970('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 87cff07..949f8da 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 _0x60d7=['html','../client','getTemplates','GetTemplate'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x60d7,0x139));var _0x760d=function(_0xc96118,_0x32aa9b){_0xc96118=_0xc96118-0x0;var _0x22c80c=_0x60d7[_0xc96118];return _0x22c80c;};'use strict';var client=require(_0x760d('0x0'));exports[_0x760d('0x1')]=function(_0x4dec65){return function(_0x1b4317){return client['Request'](_0x760d('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x760d('0x3')]},'log':_0x760d('0x2')});};}; \ No newline at end of file +var _0x52b0=['Request','GetTemplate','../client','getTemplates'];(function(_0x2390cc,_0x52baaa){var _0x227be9=function(_0x34b40c){while(--_0x34b40c){_0x2390cc['push'](_0x2390cc['shift']());}};_0x227be9(++_0x52baaa);}(_0x52b0,0x17e));var _0x052b=function(_0x4c13c7,_0x1c2f16){_0x4c13c7=_0x4c13c7-0x0;var _0x739178=_0x52b0[_0x4c13c7];return _0x739178;};'use strict';var client=require(_0x052b('0x0'));exports[_0x052b('0x1')]=function(_0x3c32e6){return function(_0x5a0e87){return client[_0x052b('0x2')](_0x052b('0x3'),{'options':{'raw':!![],'attributes':['id','name','html']},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 6375579..252f298 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 _0xb81c=['Condition','AnyConditions','field','operator','value','Action','Actions','action','data1','data2','data3','data4','data6','data7','../client','getTriggers','GetTrigger','name','channel','status'];(function(_0x30ef37,_0xb9245d){var _0x3fedc4=function(_0x4e6196){while(--_0x4e6196){_0x30ef37['push'](_0x30ef37['shift']());}};_0x3fedc4(++_0xb9245d);}(_0xb81c,0x1c6));var _0xcb81=function(_0x33b9ef,_0x5edeb5){_0x33b9ef=_0x33b9ef-0x0;var _0x44414b=_0xb81c[_0x33b9ef];return _0x44414b;};'use strict';var client=require(_0xcb81('0x0'));exports[_0xcb81('0x1')]=function(_0x301fe9){return function(_0xa3c3b0){return client['Request'](_0xcb81('0x2'),{'options':{'raw':![],'attributes':['id',_0xcb81('0x3'),_0xcb81('0x4'),_0xcb81('0x5')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id','field','operator','value']},{'model':_0xcb81('0x6'),'as':_0xcb81('0x7'),'attributes':['id',_0xcb81('0x8'),_0xcb81('0x9'),_0xcb81('0xa')]},{'model':_0xcb81('0xb'),'as':_0xcb81('0xc'),'attributes':['id',_0xcb81('0xd'),_0xcb81('0xe'),_0xcb81('0xf'),_0xcb81('0x10'),_0xcb81('0x11'),'data5',_0xcb81('0x12'),_0xcb81('0x13')]}]},'log':_0xcb81('0x2')});};}; \ No newline at end of file +var _0xe115=['Action','Actions','action','data1','data2','data4','data5','data6','../client','getTriggers','Request','GetTrigger','field','operator','value','AnyConditions'];(function(_0x33829d,_0x149a3a){var _0x14ba98=function(_0x125635){while(--_0x125635){_0x33829d['push'](_0x33829d['shift']());}};_0x14ba98(++_0x149a3a);}(_0xe115,0x188));var _0x5e11=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xe115[_0x42f009];return _0x22a1e0;};'use strict';var client=require(_0x5e11('0x0'));exports[_0x5e11('0x1')]=function(_0x40f3f6){return function(_0x1ab75e){return client[_0x5e11('0x2')](_0x5e11('0x3'),{'options':{'raw':![],'attributes':['id','name','channel','status'],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x5e11('0x4'),_0x5e11('0x5'),_0x5e11('0x6')]},{'model':'Condition','as':_0x5e11('0x7'),'attributes':['id','field',_0x5e11('0x5'),_0x5e11('0x6')]},{'model':_0x5e11('0x8'),'as':_0x5e11('0x9'),'attributes':['id',_0x5e11('0xa'),_0x5e11('0xb'),_0x5e11('0xc'),'data3',_0x5e11('0xd'),_0x5e11('0xe'),_0x5e11('0xf'),'data7']}]},'log':_0x5e11('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 4342a15..4feb671 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 _0x28aa=['GetTrunk','name','defaultuser','getTrunks','Request'];(function(_0x449dda,_0x500a2f){var _0xa079dd=function(_0x5073eb){while(--_0x5073eb){_0x449dda['push'](_0x449dda['shift']());}};_0xa079dd(++_0x500a2f);}(_0x28aa,0xf8));var _0xa28a=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x28aa[_0x1b7368];return _0x25d54c;};'use strict';var client=require('../client');exports[_0xa28a('0x0')]=function(_0x293c33){return function(_0x8af9dd){return client[_0xa28a('0x1')](_0xa28a('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa28a('0x3'),'registry',_0xa28a('0x4')]},'log':_0xa28a('0x2')});};}; \ No newline at end of file +var _0xe6c5=['Request','GetTrunk','name','registry','defaultuser','../client','getTrunks'];(function(_0x528751,_0x5b6fb6){var _0xcc69a6=function(_0x1505ce){while(--_0x1505ce){_0x528751['push'](_0x528751['shift']());}};_0xcc69a6(++_0x5b6fb6);}(_0xe6c5,0x1e8));var _0x5e6c=function(_0x1786a8,_0x3d4096){_0x1786a8=_0x1786a8-0x0;var _0x2101b5=_0xe6c5[_0x1786a8];return _0x2101b5;};'use strict';var client=require(_0x5e6c('0x0'));exports[_0x5e6c('0x1')]=function(_0x11843d){return function(_0x5db04a){return client[_0x5e6c('0x2')](_0x5e6c('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5e6c('0x4'),_0x5e6c('0x5'),_0x5e6c('0x6')]},'log':_0x5e6c('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 2323169..698b032 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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x578473,_0x4bf1cf){var _0x3bf875=function(_0x3dee43){while(--_0x3dee43){_0x578473['push'](_0x578473['shift']());}};_0x3bf875(++_0x4bf1cf);}(_0x34e8,0x12c));var _0x834e=function(_0x4e240d,_0x230032){_0x4e240d=_0x4e240d-0x0;var _0x578cc8=_0x34e8[_0x4e240d];return _0x578cc8;};'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 0a83308..8d07cc2 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 _0x9dd7=['Request','UpdateVoiceAgentReport','../client','CreateVoiceAgentReport','update'];(function(_0x385476,_0x25463a){var _0x124f7b=function(_0x1ea9ae){while(--_0x1ea9ae){_0x385476['push'](_0x385476['shift']());}};_0x124f7b(++_0x25463a);}(_0x9dd7,0x1ab));var _0x79dd=function(_0x109a8c,_0x1e68d4){_0x109a8c=_0x109a8c-0x0;var _0x39e33e=_0x9dd7[_0x109a8c];return _0x39e33e;};'use strict';var client=require(_0x79dd('0x0'));exports['create']=function(_0x29d24c){return client['Request'](_0x79dd('0x1'),{'body':_0x29d24c,'log':_0x79dd('0x1')});};exports[_0x79dd('0x2')]=function(_0x316d13,_0x2b54b1,_0x25497a){return client[_0x79dd('0x3')]('UpdateVoiceAgentReport',{'body':_0x316d13,'options':{'where':{'uniqueid':_0x2b54b1,'interface':_0x25497a,'agentcomplete':!![]}},'log':_0x79dd('0x4')});}; \ No newline at end of file +var _0x2687=['create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0x4e5de1,_0x95135f){var _0x1595c8=function(_0x4cf905){while(--_0x4cf905){_0x4e5de1['push'](_0x4e5de1['shift']());}};_0x1595c8(++_0x95135f);}(_0x2687,0x12b));var _0x7268=function(_0x28407a,_0x2a7269){_0x28407a=_0x28407a-0x0;var _0x8bd6ef=_0x2687[_0x28407a];return _0x8bd6ef;};'use strict';var client=require(_0x7268('0x0'));exports[_0x7268('0x1')]=function(_0x25a28c){return client[_0x7268('0x2')](_0x7268('0x3'),{'body':_0x25a28c,'log':_0x7268('0x3')});};exports['update']=function(_0x2e19c5,_0x575f65,_0xa7086a){return client['Request'](_0x7268('0x4'),{'body':_0x2e19c5,'options':{'where':{'uniqueid':_0x575f65,'interface':_0xa7086a,'agentcomplete':!![]}},'log':_0x7268('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 0665227..c1e7bff 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 _0x4890=['disposition','duration','billableseconds','GetVoiceCallReports','moment','../client','create','CreateVoiceCallReport','merge','calleridnum','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type'];(function(_0x426124,_0xa6a35b){var _0xcfeaa=function(_0x2c3dbb){while(--_0x2c3dbb){_0x426124['push'](_0x426124['shift']());}};_0xcfeaa(++_0xa6a35b);}(_0x4890,0x158));var _0x0489=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0x4890[_0x2ca9d4];return _0x258956;};'use strict';var moment=require(_0x0489('0x0'));var util=require('util');var _=require('lodash');var client=require(_0x0489('0x1'));exports[_0x0489('0x2')]=function(_0x139811){return client['Request'](_0x0489('0x3'),{'body':_[_0x0489('0x4')](_0x139811,{'source':_0x139811[_0x0489('0x5')],'destinationcontext':_0x139811['context'],'callerid':_0x139811['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0x0489('0x3')});};exports[_0x0489('0x6')]=function(){return function(){return client[_0x0489('0x7')](_0x0489('0x8'),{'options':{'where':{'type':[_0x0489('0x9')],'createdAt':{'$between':[moment()[_0x0489('0xa')](_0x0489('0xb'))[_0x0489('0xc')](_0x0489('0xd')),moment()[_0x0489('0xe')](_0x0489('0xb'))['format'](_0x0489('0xd'))]}},'attributes':[_0x0489('0xf'),_0x0489('0x10'),_0x0489('0x11'),_0x0489('0x12')]},'log':_0x0489('0x13')});};}; \ No newline at end of file +var _0xf723=['calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','disposition','duration','billableseconds','GetVoiceCallReports','../client','Request','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf723,0x179));var _0x3f72=function(_0x491cbe,_0x45c8ba){_0x491cbe=_0x491cbe-0x0;var _0x59449d=_0xf723[_0x491cbe];return _0x59449d;};'use strict';var moment=require('moment');var util=require('util');var _=require('lodash');var client=require(_0x3f72('0x0'));exports['create']=function(_0x5cd719){return client[_0x3f72('0x1')]('CreateVoiceCallReport',{'body':_[_0x3f72('0x2')](_0x5cd719,{'source':_0x5cd719[_0x3f72('0x3')],'destinationcontext':_0x5cd719[_0x3f72('0x4')],'callerid':_0x5cd719[_0x3f72('0x5')],'amaflags':_0x3f72('0x6')}),'log':_0x3f72('0x7')});};exports[_0x3f72('0x8')]=function(){return function(){return client[_0x3f72('0x1')](_0x3f72('0x9'),{'options':{'where':{'type':[_0x3f72('0xa')],'createdAt':{'$between':[moment()[_0x3f72('0xb')]('day')[_0x3f72('0xc')](_0x3f72('0xd')),moment()[_0x3f72('0xe')](_0x3f72('0xf'))['format'](_0x3f72('0xd'))]}},'attributes':['type',_0x3f72('0x10'),_0x3f72('0x11'),_0x3f72('0x12')]},'log':_0x3f72('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 3c1ea1c..23631a5 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 _0x53ff=['Request','CreateVoiceDialReport','create'];(function(_0x3c4e4c,_0x36ff70){var _0x144a87=function(_0x5efb4b){while(--_0x5efb4b){_0x3c4e4c['push'](_0x3c4e4c['shift']());}};_0x144a87(++_0x36ff70);}(_0x53ff,0xe9));var _0xf53f=function(_0x2ecf17,_0x45b8db){_0x2ecf17=_0x2ecf17-0x0;var _0xd0ffde=_0x53ff[_0x2ecf17];return _0xd0ffde;};'use strict';var client=require('../client');exports[_0xf53f('0x0')]=function(_0x222bf3){return client[_0xf53f('0x1')](_0xf53f('0x2'),{'body':_0x222bf3,'log':_0xf53f('0x2')});}; \ No newline at end of file +var _0xc24b=['Request','CreateVoiceDialReport','../client'];(function(_0x2a230a,_0x31b3e3){var _0x341639=function(_0x3f857a){while(--_0x3f857a){_0x2a230a['push'](_0x2a230a['shift']());}};_0x341639(++_0x31b3e3);}(_0xc24b,0x1c7));var _0xbc24=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0xc24b[_0x556927];return _0x5f1235;};'use strict';var client=require(_0xbc24('0x0'));exports['create']=function(_0x47a897){return client[_0xbc24('0x1')]('CreateVoiceDialReport',{'body':_0x47a897,'log':_0xbc24('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index e6839f5..adc5299 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 _0xb43b=['getVoiceExtensions','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x916cb0,_0x4ca98a){var _0x2e5280=function(_0x2c1447){while(--_0x2c1447){_0x916cb0['push'](_0x916cb0['shift']());}};_0x2e5280(++_0x4ca98a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2c44d0,_0x7cc1a8){_0x2c44d0=_0x2c44d0-0x0;var _0x7fc8f8=_0xb43b[_0x2c44d0];return _0x7fc8f8;};'use strict';var client=require(_0xbb43('0x0'));exports[_0xbb43('0x1')]=function(){return function(){return client['Request'](_0xbb43('0x2'),{'options':{'raw':!![],'attributes':['id',_0xbb43('0x3'),_0xbb43('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xfd6f=['Request','GetVoiceExtension','exten','../client','getVoiceExtensions'];(function(_0x46e8b0,_0x4ba162){var _0x50089a=function(_0x417864){while(--_0x417864){_0x46e8b0['push'](_0x46e8b0['shift']());}};_0x50089a(++_0x4ba162);}(_0xfd6f,0x19d));var _0xffd6=function(_0x303c3b,_0x3b50b5){_0x303c3b=_0x303c3b-0x0;var _0x305948=_0xfd6f[_0x303c3b];return _0x305948;};'use strict';var client=require(_0xffd6('0x0'));exports[_0xffd6('0x1')]=function(){return function(){return client[_0xffd6('0x2')](_0xffd6('0x3'),{'options':{'raw':!![],'attributes':['id',_0xffd6('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xffd6('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 4c9ad05..bd7231e 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 _0xd1ed=['dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','name','callerid','active','mandatoryDispositionPause','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialOriginateCallerIdName','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd1ed,0xe8));var _0xdd1e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd1ed[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xdd1e('0x0')]=function(){return function(){return client[_0xdd1e('0x1')](_0xdd1e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xdd1e('0x3'),_0xdd1e('0x4'),'autopause',_0xdd1e('0x5'),_0xdd1e('0x6'),_0xdd1e('0x7'),_0xdd1e('0x8'),_0xdd1e('0x9'),_0xdd1e('0xa'),_0xdd1e('0xb'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0xdd1e('0xc'),'dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions',_0xdd1e('0xd'),_0xdd1e('0xe'),_0xdd1e('0xf'),_0xdd1e('0x10'),'dialBusyMaxRetry',_0xdd1e('0x11'),_0xdd1e('0x12'),_0xdd1e('0x13'),'dialGlobalMaxRetry',_0xdd1e('0x14'),_0xdd1e('0x15'),_0xdd1e('0x16'),_0xdd1e('0x17'),_0xdd1e('0x18'),_0xdd1e('0x19'),_0xdd1e('0x1a'),_0xdd1e('0x1b'),_0xdd1e('0x1c'),_0xdd1e('0x1d'),_0xdd1e('0x1e'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0xdd1e('0x1f'),_0xdd1e('0x20'),_0xdd1e('0x21'),_0xdd1e('0x22'),_0xdd1e('0x23'),_0xdd1e('0x24'),_0xdd1e('0x25'),_0xdd1e('0x26'),_0xdd1e('0x5'),'strategy',_0xdd1e('0x27'),_0xdd1e('0x28'),_0xdd1e('0x29'),_0xdd1e('0x2a'),_0xdd1e('0x2b'),_0xdd1e('0x2c'),_0xdd1e('0x2d'),_0xdd1e('0x2e'),_0xdd1e('0x2f'),_0xdd1e('0x30'),_0xdd1e('0x31'),_0xdd1e('0x32'),_0xdd1e('0x33'),_0xdd1e('0x34'),_0xdd1e('0x35'),_0xdd1e('0x36'),_0xdd1e('0x37'),_0xdd1e('0x38')],'include':[{'model':'Trunk','as':_0xdd1e('0x39'),'attributes':['id',_0xdd1e('0x3a'),_0xdd1e('0x3b'),_0xdd1e('0x3c')]},{'model':'Pause','as':_0xdd1e('0x3d'),'attributes':['id',_0xdd1e('0x3a')]},{'model':_0xdd1e('0x39'),'as':'TrunkBackup','attributes':['id',_0xdd1e('0x3a'),'callerid',_0xdd1e('0x3c')]},{'model':_0xdd1e('0x3e'),'as':_0xdd1e('0x3e'),'attributes':['id',_0xdd1e('0x3a')],'include':[{'model':_0xdd1e('0x3e'),'as':_0xdd1e('0x3f'),'attributes':['id',_0xdd1e('0x3a'),_0xdd1e('0x40')]}]}]},'log':_0xdd1e('0x0')});};}; \ No newline at end of file +var _0x89ea=['dialPreviewAutoRecallMe','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold'];(function(_0x508103,_0xa835ae){var _0x1ce818=function(_0xf28019){while(--_0xf28019){_0x508103['push'](_0x508103['shift']());}};_0x1ce818(++_0xa835ae);}(_0x89ea,0xba));var _0xa89e=function(_0x15b33d,_0x3a17b0){_0x15b33d=_0x15b33d-0x0;var _0x3b09b6=_0x89ea[_0x15b33d];return _0x3b09b6;};'use strict';var client=require(_0xa89e('0x0'));exports[_0xa89e('0x1')]=function(){return function(){return client[_0xa89e('0x2')](_0xa89e('0x3'),{'options':{'raw':![],'attributes':['id',_0xa89e('0x4'),_0xa89e('0x5'),_0xa89e('0x6'),_0xa89e('0x7'),_0xa89e('0x8'),_0xa89e('0x9'),_0xa89e('0xa'),'dialMethod',_0xa89e('0xb'),_0xa89e('0xc'),_0xa89e('0xd'),_0xa89e('0xe'),'dialPredictiveOptimizationPercentage',_0xa89e('0xf'),_0xa89e('0x10'),_0xa89e('0x11'),_0xa89e('0x12'),_0xa89e('0x13'),'dialQueueTimeout','dialQueueProject',_0xa89e('0x14'),'dialCongestionRetryFrequency',_0xa89e('0x15'),_0xa89e('0x16'),'dialNoAnswerMaxRetry',_0xa89e('0x17'),_0xa89e('0x18'),_0xa89e('0x19'),'dialGlobalInterval','dialPrefix','dialCheckDuplicateType',_0xa89e('0x1a'),_0xa89e('0x1b'),_0xa89e('0x1c'),'dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime',_0xa89e('0x1d'),_0xa89e('0x1e'),_0xa89e('0x1f'),_0xa89e('0x20'),'dialAMDMaximumWordLength',_0xa89e('0x21'),'dialRecallMeTimeout','dialRecallInQueue',_0xa89e('0x22'),_0xa89e('0x23'),_0xa89e('0x24'),_0xa89e('0x25'),_0xa89e('0x8'),_0xa89e('0x26'),_0xa89e('0x27'),_0xa89e('0x28'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0xa89e('0x29'),'dialDropRetryFrequency',_0xa89e('0x2a'),_0xa89e('0x2b'),_0xa89e('0x2c'),_0xa89e('0x2d'),'dialAgentRejectMaxRetry',_0xa89e('0x2e'),_0xa89e('0x2f'),_0xa89e('0x30'),_0xa89e('0x31'),_0xa89e('0x32'),'dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin'],'include':[{'model':'Trunk','as':_0xa89e('0x33'),'attributes':['id',_0xa89e('0x4'),_0xa89e('0x34'),'active']},{'model':_0xa89e('0x35'),'as':_0xa89e('0x36'),'attributes':['id',_0xa89e('0x4')]},{'model':_0xa89e('0x33'),'as':_0xa89e('0x37'),'attributes':['id',_0xa89e('0x4'),_0xa89e('0x34'),_0xa89e('0x38')]},{'model':'Interval','as':_0xa89e('0x39'),'attributes':['id',_0xa89e('0x4')],'include':[{'model':_0xa89e('0x39'),'as':'Intervals','attributes':['id',_0xa89e('0x4'),_0xa89e('0x3a')]}]}]},'log':_0xa89e('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 568f6ff..aca58c4 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(_0x1da36f,_0x2536f8){var _0x502f45=function(_0x9b2ef3){while(--_0x9b2ef3){_0x1da36f['push'](_0x1da36f['shift']());}};_0x502f45(++_0x2536f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x210379,_0x104329){var _0x3e1265=function(_0x124759){while(--_0x124759){_0x210379['push'](_0x210379['shift']());}};_0x3e1265(++_0x104329);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 828ca87..459beef 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 _0x0ead=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x4291c0,_0x18961f){var _0x52726e=function(_0x1c76df){while(--_0x1c76df){_0x4291c0['push'](_0x4291c0['shift']());}};_0x52726e(++_0x18961f);}(_0x0ead,0x73));var _0xd0ea=function(_0x1323f4,_0x100ad0){_0x1323f4=_0x1323f4-0x0;var _0x3c618c=_0x0ead[_0x1323f4];return _0x3c618c;};'use strict';var client=require(_0xd0ea('0x0'));exports[_0xd0ea('0x1')]=function(_0x5253f6){return function(){return client['Request'](_0xd0ea('0x2'),{'options':{'where':{'VoiceQueueId':_0x5253f6,'paused':!![]},'raw':!![]},'log':_0xd0ea('0x1')});};}; \ No newline at end of file +var _0xf841=['getVoiceQueueRtPauses','../client','GetVoiceQueueRtPauses'];(function(_0x1930b4,_0x7e9f4f){var _0x33de7f=function(_0x9219c3){while(--_0x9219c3){_0x1930b4['push'](_0x1930b4['shift']());}};_0x33de7f(++_0x7e9f4f);}(_0xf841,0x121));var _0x1f84=function(_0x3bb63a,_0x15af8f){_0x3bb63a=_0x3bb63a-0x0;var _0x3b822a=_0xf841[_0x3bb63a];return _0x3b822a;};'use strict';var client=require(_0x1f84('0x0'));exports['getVoiceQueueRtPauses']=function(_0x202601){return function(){return client['Request'](_0x1f84('0x1'),{'options':{'where':{'VoiceQueueId':_0x202601,'paused':!![]},'raw':!![]},'log':_0x1f84('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index a68bd21..54b9048 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(_0x2b7879,_0x5667ba){var _0xe7bbec=function(_0x31b68b){while(--_0x31b68b){_0x2b7879['push'](_0x2b7879['shift']());}};_0xe7bbec(++_0x5667ba);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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(_0x1191a2,_0x2a981f){var _0x4d655b=function(_0x249b82){while(--_0x249b82){_0x1191a2['push'](_0x1191a2['shift']());}};_0x4d655b(++_0x2a981f);}(_0x7a54,0x106));var _0x47a5=function(_0x2a8cd3,_0x131a90){_0x2a8cd3=_0x2a8cd3-0x0;var _0xbcaf83=_0x7a54[_0x2a8cd3];return _0xbcaf83;};'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 7b9e043..a81055d 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 _0x0835=['transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0x0835,0x1ee));var _0x5083=function(_0x24584d,_0x46c433){_0x24584d=_0x24584d-0x0;var _0x355d7d=_0x0835[_0x24584d];return _0x355d7d;};'use strict';var client=require(_0x5083('0x0'));exports['transfers']={};exports[_0x5083('0x1')]=function(_0x36aa3a){return client[_0x5083('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x36aa3a[_0x5083('0x3')],'transfererchannel':_0x36aa3a[_0x5083('0x4')],'transferercalleridnum':_0x36aa3a[_0x5083('0x5')],'transferercalleridname':_0x36aa3a[_0x5083('0x6')],'transfererconnectedlinenum':_0x36aa3a[_0x5083('0x7')],'transfererconnectedlinename':_0x36aa3a[_0x5083('0x8')],'transfereraccountcode':_0x36aa3a[_0x5083('0x9')],'transferercontext':_0x36aa3a[_0x5083('0xa')],'transfererexten':_0x36aa3a[_0x5083('0xb')],'transfererlinkedid':_0x36aa3a[_0x5083('0xc')],'transfereechannel':_0x36aa3a[_0x5083('0xd')],'transfereecalleridnum':_0x36aa3a[_0x5083('0xe')],'transfereecalleridname':_0x36aa3a[_0x5083('0xf')],'transfereeconnectedlinenum':_0x36aa3a[_0x5083('0x10')],'transfereeconnectedlinename':_0x36aa3a[_0x5083('0x11')],'transfereeaccountcode':_0x36aa3a['transfereeaccountcode'],'transfereecontext':_0x36aa3a[_0x5083('0x12')],'transfereeexten':_0x36aa3a[_0x5083('0x13')],'transfereelinkedid':_0x36aa3a[_0x5083('0x14')],'isexternal':_0x36aa3a[_0x5083('0x15')],'context':_0x36aa3a[_0x5083('0x16')],'extension':_0x36aa3a['extension'],'type':_0x5083('0x17')},'log':_0x5083('0x18')});};exports['attendedTransfer']=function(_0x2cc785){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x2cc785[_0x5083('0x3')],'transfererchannel':_0x2cc785[_0x5083('0x19')],'transferercalleridnum':_0x2cc785[_0x5083('0x1a')],'transferercalleridname':_0x2cc785[_0x5083('0x1b')],'transfererconnectedlinenum':_0x2cc785['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2cc785[_0x5083('0x1c')],'transfereraccountcode':_0x2cc785[_0x5083('0x1d')],'transferercontext':_0x2cc785[_0x5083('0x1e')],'transfererexten':_0x2cc785['secondtransfererexten'],'transfererlinkedid':_0x2cc785['origtransfererlinkedid'],'transfereechannel':_0x2cc785[_0x5083('0x1f')],'transfereecalleridnum':_0x2cc785[_0x5083('0x20')],'transfereecalleridname':_0x2cc785[_0x5083('0x21')],'transfereeconnectedlinenum':_0x2cc785[_0x5083('0x22')],'transfereeconnectedlinename':_0x2cc785[_0x5083('0x23')],'transfereeaccountcode':_0x2cc785['transfertargetaccountcode'],'transfereecontext':_0x2cc785[_0x5083('0x24')],'transfereeexten':_0x2cc785[_0x5083('0x25')],'transfereelinkedid':_0x2cc785[_0x5083('0x26')],'isexternal':_0x2cc785['isexternal'],'context':_0x2cc785[_0x5083('0x27')],'extension':_0x2cc785[_0x5083('0x28')],'type':_0x5083('0x29')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x13c1=['transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname'];(function(_0x3af4d9,_0x403500){var _0x799eb9=function(_0x3b8072){while(--_0x3b8072){_0x3af4d9['push'](_0x3af4d9['shift']());}};_0x799eb9(++_0x403500);}(_0x13c1,0xb5));var _0x113c=function(_0x5b1c50,_0x56225f){_0x5b1c50=_0x5b1c50-0x0;var _0x5bcc45=_0x13c1[_0x5b1c50];return _0x5bcc45;};'use strict';var client=require(_0x113c('0x0'));exports[_0x113c('0x1')]={};exports['blindTransfer']=function(_0x15f594){return client[_0x113c('0x2')](_0x113c('0x3'),{'body':{'result':_0x15f594['result'],'transfererchannel':_0x15f594[_0x113c('0x4')],'transferercalleridnum':_0x15f594[_0x113c('0x5')],'transferercalleridname':_0x15f594['transferercalleridname'],'transfererconnectedlinenum':_0x15f594[_0x113c('0x6')],'transfererconnectedlinename':_0x15f594[_0x113c('0x7')],'transfereraccountcode':_0x15f594[_0x113c('0x8')],'transferercontext':_0x15f594[_0x113c('0x9')],'transfererexten':_0x15f594[_0x113c('0xa')],'transfererlinkedid':_0x15f594[_0x113c('0xb')],'transfereechannel':_0x15f594[_0x113c('0xc')],'transfereecalleridnum':_0x15f594['transfereecalleridnum'],'transfereecalleridname':_0x15f594[_0x113c('0xd')],'transfereeconnectedlinenum':_0x15f594[_0x113c('0xe')],'transfereeconnectedlinename':_0x15f594[_0x113c('0xf')],'transfereeaccountcode':_0x15f594[_0x113c('0x10')],'transfereecontext':_0x15f594[_0x113c('0x11')],'transfereeexten':_0x15f594[_0x113c('0x12')],'transfereelinkedid':_0x15f594['transfereelinkedid'],'isexternal':_0x15f594[_0x113c('0x13')],'context':_0x15f594['context'],'extension':_0x15f594[_0x113c('0x14')],'type':_0x113c('0x15')},'log':_0x113c('0x3')});};exports[_0x113c('0x16')]=function(_0x5e2d25){return client['Request'](_0x113c('0x3'),{'body':{'result':_0x5e2d25[_0x113c('0x17')],'transfererchannel':_0x5e2d25[_0x113c('0x18')],'transferercalleridnum':_0x5e2d25[_0x113c('0x19')],'transferercalleridname':_0x5e2d25[_0x113c('0x1a')],'transfererconnectedlinenum':_0x5e2d25[_0x113c('0x1b')],'transfererconnectedlinename':_0x5e2d25[_0x113c('0x1c')],'transfereraccountcode':_0x5e2d25['origtransfereraccountcode'],'transferercontext':_0x5e2d25['secondtransferercontext'],'transfererexten':_0x5e2d25[_0x113c('0x1d')],'transfererlinkedid':_0x5e2d25[_0x113c('0x1e')],'transfereechannel':_0x5e2d25['transfertargetchannel'],'transfereecalleridnum':_0x5e2d25[_0x113c('0x1f')],'transfereecalleridname':_0x5e2d25[_0x113c('0x20')],'transfereeconnectedlinenum':_0x5e2d25['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5e2d25['transfertargetconnectedlinename'],'transfereeaccountcode':_0x5e2d25[_0x113c('0x21')],'transfereecontext':_0x5e2d25[_0x113c('0x22')],'transfereeexten':_0x5e2d25['transfertargetexten'],'transfereelinkedid':_0x5e2d25[_0x113c('0x23')],'isexternal':_0x5e2d25[_0x113c('0x13')],'context':_0x5e2d25[_0x113c('0x24')],'extension':_0x5e2d25[_0x113c('0x25')],'type':_0x113c('0x26')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 16a97df..817c5d8 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 _0xef17=['active','callerid','Interval','push','omit','undefined','length','voicechannel','map','find','channel','%s.%s','uniqueid','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','resolve','Action','StopMixMonitor','stop','filename','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','values','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','context','agents','telephones','trunks','event','custom:','send','checkAfterSend','listen','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','format','%s/%s','SIP','name','timers','updateAcw','pause','isConnected','error','asterisk','join','keys','module','then','message','username','ami\x20disconnected','pick','command','action','Command','content','catch','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','sumBillable','sumHoldTime','talking','unmanaged','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk'];(function(_0x582409,_0x523017){var _0x52574d=function(_0x4f3859){while(--_0x4f3859){_0x582409['push'](_0x582409['shift']());}};_0x52574d(++_0x523017);}(_0xef17,0x136));var _0x7ef1=function(_0x218b9e,_0x3315b0){_0x218b9e=_0x218b9e-0x0;var _0x12e70e=_0xef17[_0x218b9e];return _0x12e70e;};'use strict';var _=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var jayson=require(_0x7ef1('0x2'));var schema=require(_0x7ef1('0x3'));var BPromise=require(_0x7ef1('0x4'));var moment=require(_0x7ef1('0x5'));var config=require(_0x7ef1('0x6'));var properties=require(_0x7ef1('0x7'));var ami=require(_0x7ef1('0x8'));exports['listen']=function(_0x1d2f83,_0x514b70,_0x138ed1){return new BPromise(function(_0x498596,_0x34a040){var _0x4ba2f0={'QueuePause':function(_0x5aec63){return new Promise(function(_0x10c896,_0x3398a6){var _0x56ab07=util[_0x7ef1('0x9')](_0x7ef1('0xa'),_0x7ef1('0xb'),_0x5aec63[_0x7ef1('0xc')]);if(_0x1d2f83[_0x7ef1('0xd')]&&_0x1d2f83[_0x7ef1('0xd')][_0x56ab07]&&_0x1d2f83[_0x7ef1('0xd')][_0x56ab07]['timer']){_0x1d2f83['timers'][_0x56ab07][_0x7ef1('0xe')]();}if(_0x1d2f83['agents'][_0x56ab07]){_0x1d2f83['agents'][_0x56ab07]['updateStatusRealtime']({'statePause':_0x5aec63[_0x7ef1('0xf')]?!![]:![]});}_0x10c896({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x36ddf9){var _0x29c920=this;return new Promise(function(_0x32eed0,_0x598680){if(ami[_0x7ef1('0x10')]()==![]){return _0x598680(_0x29c920[_0x7ef1('0x11')](0x1f4,[config[_0x7ef1('0x12')]['ip'],config[_0x7ef1('0x12')]['username'],'ami\x20disconnected'][_0x7ef1('0x13')]('\x20')));}_0x36ddf9=_['pick'](_0x36ddf9,_[_0x7ef1('0x14')](properties[_0x7ef1('0x15')]));_0x36ddf9['action']='Reload';return ami['Action'](_0x36ddf9)[_0x7ef1('0x16')](function(_0x4da0fa){_0x32eed0({'code':0xc8,'message':_0x4da0fa[_0x7ef1('0x17')]});})['catch'](function(_0x5a7b2b){_0x598680(_0x29c920['error'](0x1f5,_0x5a7b2b[_0x7ef1('0x17')]));});});},'Command':function(_0x575a75){var _0x38c5a7=this;return new Promise(function(_0x2a8fab,_0x5291b0){if(ami['isConnected']()==![]){return _0x5291b0(_0x38c5a7[_0x7ef1('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x7ef1('0x12')][_0x7ef1('0x18')],_0x7ef1('0x19')][_0x7ef1('0x13')]('\x20')));}_0x575a75=_[_0x7ef1('0x1a')](_0x575a75,_0x7ef1('0x1b'));_0x575a75[_0x7ef1('0x1c')]=_0x7ef1('0x1d');return ami['Action'](_0x575a75)[_0x7ef1('0x16')](function(_0x3b118f){_0x2a8fab({'code':0xc8,'message':_0x3b118f[_0x7ef1('0x1e')]});})[_0x7ef1('0x1f')](function(_0x31b5bf){_0x5291b0(_0x38c5a7[_0x7ef1('0x11')](0x1f5,_0x31b5bf[_0x7ef1('0x17')]));});});},'VoiceQueues':function(_0x144e74){return new Promise(function(_0x508a5f,_0x4b1ace){var _0x33e008=[];for(var _0x12ef5a in _0x1d2f83[_0x7ef1('0x20')]){if(_0x1d2f83[_0x7ef1('0x20')][_0x7ef1('0x21')](_0x12ef5a)){var _0x4cfa16=_0x1d2f83[_0x7ef1('0x20')][_0x12ef5a];var _0x9eca93={'id':_0x4cfa16['id'],'name':_0x4cfa16[_0x7ef1('0xc')],'strategy':_0x4cfa16[_0x7ef1('0x22')],'answered':_0x4cfa16[_0x7ef1('0x23')],'available':_0x4cfa16[_0x7ef1('0x24')],'loggedIn':_0x4cfa16[_0x7ef1('0x25')],'pTalking':_0x4cfa16['pTalking'],'sumBillable':_0x4cfa16[_0x7ef1('0x26')],'sumDuration':_0x4cfa16['sumDuration'],'sumHoldTime':_0x4cfa16[_0x7ef1('0x27')]||0x0,'talking':_0x4cfa16[_0x7ef1('0x28')],'total':_0x4cfa16['total'],'type':_0x4cfa16['type'],'unmanaged':_0x4cfa16[_0x7ef1('0x29')],'abandoned':_0x4cfa16[_0x7ef1('0x2a')],'waiting':_0x4cfa16['waiting'],'loggedInDb':_0x4cfa16[_0x7ef1('0x2b')]};if(_0x4cfa16['type']===_0x7ef1('0x2c')){_0x9eca93['dialActive']=_0x4cfa16[_0x7ef1('0x2d')];_0x9eca93[_0x7ef1('0x2e')]=_0x4cfa16['dialMethod'];_0x9eca93['dialOriginateCallerIdName']=_0x4cfa16['dialOriginateCallerIdName'];_0x9eca93['dialOriginateCallerIdNumber']=_0x4cfa16[_0x7ef1('0x2f')];_0x9eca93[_0x7ef1('0x30')]=_0x4cfa16['dialOriginateTimeout'];_0x9eca93[_0x7ef1('0x31')]=_0x4cfa16['dialPrefix'];_0x9eca93['temp']=_0x4cfa16[_0x7ef1('0x32')];_0x9eca93['outboundAnswerAgiCallsDay']=_0x4cfa16[_0x7ef1('0x33')];_0x9eca93[_0x7ef1('0x34')]=_0x4cfa16[_0x7ef1('0x34')];_0x9eca93[_0x7ef1('0x35')]=_0x4cfa16['outboundBlacklistCallsDay'];_0x9eca93[_0x7ef1('0x36')]=_0x4cfa16[_0x7ef1('0x36')];_0x9eca93['outboundCongestionCallsDay']=_0x4cfa16['outboundCongestionCallsDay'];_0x9eca93['outboundDropCallsDayACS']=_0x4cfa16['outboundDropCallsDayACS'];_0x9eca93[_0x7ef1('0x37')]=_0x4cfa16['outboundDropCallsDayCallersExit'];_0x9eca93[_0x7ef1('0x38')]=_0x4cfa16[_0x7ef1('0x38')];_0x9eca93[_0x7ef1('0x39')]=_0x4cfa16[_0x7ef1('0x39')];_0x9eca93[_0x7ef1('0x3a')]=_0x4cfa16[_0x7ef1('0x3a')];_0x9eca93[_0x7ef1('0x3b')]=_0x4cfa16[_0x7ef1('0x3b')];_0x9eca93[_0x7ef1('0x3c')]=_0x4cfa16[_0x7ef1('0x3c')];_0x9eca93[_0x7ef1('0x3d')]=_0x4cfa16['outboundRejectCallsDay'];_0x9eca93[_0x7ef1('0x3e')]=_0x4cfa16[_0x7ef1('0x3e')];_0x9eca93['predictiveIntervalAnsweredCalls']=_0x4cfa16[_0x7ef1('0x3f')];_0x9eca93[_0x7ef1('0x40')]=_0x4cfa16[_0x7ef1('0x40')];_0x9eca93[_0x7ef1('0x41')]=_0x4cfa16[_0x7ef1('0x41')];_0x9eca93['predictiveIntervalDroppedCallsCallersExit']=_0x4cfa16[_0x7ef1('0x42')];_0x9eca93[_0x7ef1('0x43')]=_0x4cfa16[_0x7ef1('0x43')];_0x9eca93[_0x7ef1('0x44')]=_0x4cfa16[_0x7ef1('0x44')];_0x9eca93[_0x7ef1('0x45')]=_0x4cfa16[_0x7ef1('0x45')];_0x9eca93[_0x7ef1('0x46')]=_0x4cfa16[_0x7ef1('0x46')];_0x9eca93[_0x7ef1('0x47')]=_0x4cfa16[_0x7ef1('0x47')];_0x9eca93[_0x7ef1('0x48')]=_0x4cfa16[_0x7ef1('0x48')];_0x9eca93[_0x7ef1('0x49')]=_0x4cfa16[_0x7ef1('0x49')];_0x9eca93['predictiveIntervalTotalCalls']=_0x4cfa16[_0x7ef1('0x4a')];_0x9eca93[_0x7ef1('0x17')]=_0x4cfa16[_0x7ef1('0x17')];_0x9eca93[_0x7ef1('0x4b')]=_0x4cfa16[_0x7ef1('0x4b')];_0x9eca93[_0x7ef1('0x4c')]=_0x4cfa16[_0x7ef1('0x4c')];_0x9eca93[_0x7ef1('0x4d')]=_0x4cfa16[_0x7ef1('0x4d')];_0x9eca93[_0x7ef1('0x4e')]=_0x4cfa16[_0x7ef1('0x4e')];_0x9eca93[_0x7ef1('0x4f')]=_0x4cfa16[_0x7ef1('0x4f')];_0x9eca93['startPredictive']=_0x4cfa16[_0x7ef1('0x50')];_0x9eca93[_0x7ef1('0x51')]=_0x4cfa16[_0x7ef1('0x51')];}if(_0x4cfa16[_0x7ef1('0x52')]){_0x9eca93[_0x7ef1('0x52')]={'id':_0x4cfa16[_0x7ef1('0x52')]['id'],'name':_0x4cfa16['Trunk'][_0x7ef1('0xc')],'active':_0x4cfa16[_0x7ef1('0x52')][_0x7ef1('0x53')],'callerid':_0x4cfa16[_0x7ef1('0x52')][_0x7ef1('0x54')]};}if(_0x4cfa16[_0x7ef1('0x55')]){_0x9eca93['Interval']={'id':_0x4cfa16[_0x7ef1('0x55')]['id'],'name':_0x4cfa16[_0x7ef1('0x55')][_0x7ef1('0xc')]};}_0x33e008[_0x7ef1('0x56')](_0x9eca93);}}_0x508a5f({'count':_0x33e008['length'],'rows':_0x33e008});});},'UpdateVoiceQueue':function(_0xe33b02){return new Promise(function(_0x58059e,_0x4db6bf){var _0x3af85c=_['find'](_0x1d2f83[_0x7ef1('0x20')],{'id':parseInt(_0xe33b02['id'])});var _0x53bb12=_[_0x7ef1('0x57')](_0xe33b02,['id']);if(_0x3af85c){for(var _0x17e41f in _0x53bb12){if(typeof _0x53bb12[_0x17e41f]!==_0x7ef1('0x58')&&typeof _0x3af85c[_0x17e41f]!==_0x7ef1('0x58')){_0x3af85c[_0x17e41f]=_0x53bb12[_0x17e41f];}}_0x58059e(_0x3af85c);}else{_0x4db6bf();}});},'VoiceChannels':function(_0x1d40ca){return new Promise(function(_0x2cd383,_0x144947){var _0x106096=_['values'](_0x1d2f83['channels']);_0x2cd383({'count':_0x106096[_0x7ef1('0x59')],'rows':_0x106096});});},'VoiceChannelMixMonitor':function(_0x2d4398){var _0x5bf125=this;return new Promise(function(_0x1d067d,_0x2b1141){if(ami[_0x7ef1('0x10')]()==![]){return _0x2b1141(_0x5bf125['error'](0x1f4,[config['asterisk']['ip'],config[_0x7ef1('0x12')]['username'],'ami\x20disconnected'][_0x7ef1('0x13')]('\x20')));}var _0x2ddf03=schema(properties[_0x7ef1('0x5a')])[_0x7ef1('0x3')](_0x2d4398);if(_0x2ddf03[_0x7ef1('0x59')]>0x0){return _0x2b1141(_0x5bf125['error'](0x1f4,_[_0x7ef1('0x5b')](_0x2ddf03,'message')[_0x7ef1('0x13')](',\x20')));}var _0x5da62c=_[_0x7ef1('0x5c')](_0x1d2f83['channels'],{'uniqueid':_0x2d4398['uniqueid']});if(_0x5da62c&&_0x5da62c[_0x7ef1('0x5d')]){var _0x560bc0=util[_0x7ef1('0x9')](_0x7ef1('0x5e'),_0x2d4398['filename']||_0x2d4398[_0x7ef1('0x5f')],_0x2d4398[_0x7ef1('0x9')]||_0x7ef1('0x60'));return ami['Action']({'action':_0x7ef1('0x61'),'channel':_0x5da62c[_0x7ef1('0x5d')],'file':_0x560bc0,'options':'ai(mixmonitorid)'})[_0x7ef1('0x16')](function(_0xfb8eb0){var _0x119cf2=_[_0x7ef1('0x5c')](_0x5da62c[_0x7ef1('0x62')],{'filename':_0x7ef1('0x63')+_0x560bc0[_0x7ef1('0x64')]()});if(_['isNil'](_0x119cf2)){_0x5da62c['monitors'][_0x7ef1('0x56')]({'filename':_0x7ef1('0x63')+_0x560bc0[_0x7ef1('0x64')](),'createdAt':moment()[_0x7ef1('0x9')](_0x7ef1('0x65')),'mixmonitorid':_0xfb8eb0[_0x7ef1('0x66')],'status':_0x7ef1('0x67')});}else{_0x119cf2[_0x7ef1('0x66')]=_0xfb8eb0[_0x7ef1('0x66')];_0x119cf2[_0x7ef1('0x68')]=_0x7ef1('0x67');}_0x1d067d({'code':0xc8,'message':[_0x2d4398['uniqueid'],_0x7ef1('0x69'),_0xfb8eb0[_0x7ef1('0x66')]][_0x7ef1('0x13')]('\x20'),'mixmonitorid':_0xfb8eb0[_0x7ef1('0x66')]});})[_0x7ef1('0x1f')](function(_0x587254){_0x2b1141(_0x5bf125[_0x7ef1('0x11')](0x1f5,[_0x2d4398[_0x7ef1('0x5f')],_0x587254[_0x7ef1('0x17')]['toLowerCase']()][_0x7ef1('0x13')]('\x20')));});}else{return _0x2b1141(_0x5bf125[_0x7ef1('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x3237ac){var _0x2ce9c6=this;return new Promise(function(_0x10a3ba,_0x2d285f){if(ami[_0x7ef1('0x10')]()==![]){return _0x2d285f(_0x2ce9c6[_0x7ef1('0x11')](0x1f4,[config[_0x7ef1('0x12')]['ip'],config[_0x7ef1('0x12')][_0x7ef1('0x18')],_0x7ef1('0x19')][_0x7ef1('0x13')]('\x20')));}var _0x510d7f=schema(properties[_0x7ef1('0x5a')])[_0x7ef1('0x3')](_0x3237ac);if(_0x510d7f['length']>0x0){return _0x2d285f(_0x2ce9c6[_0x7ef1('0x11')](0x1f4,_[_0x7ef1('0x5b')](_0x510d7f,_0x7ef1('0x17'))['join'](',\x20')));}var _0x381c5b=_[_0x7ef1('0x5c')](_0x1d2f83['channels'],{'uniqueid':_0x3237ac[_0x7ef1('0x5f')]});if(_0x381c5b){return BPromise[_0x7ef1('0x6a')]()[_0x7ef1('0x16')](function(){if(_0x381c5b['channel']){return ami[_0x7ef1('0x6b')]({'action':_0x7ef1('0x6c'),'channel':_0x381c5b[_0x7ef1('0x5d')],'mixmonitorid':_0x3237ac['mixmonitorid']})[_0x7ef1('0x1f')](function(_0x188503){});}})[_0x7ef1('0x16')](function(){if(_0x381c5b['destinationchannel']){return ami[_0x7ef1('0x6b')]({'action':_0x7ef1('0x6c'),'channel':_0x381c5b['destinationchannel'],'mixmonitorid':_0x3237ac[_0x7ef1('0x66')]})[_0x7ef1('0x1f')](function(_0x2de250){});}})[_0x7ef1('0x16')](function(_0x431844){var _0x2b3119=_[_0x7ef1('0x5c')](_0x381c5b[_0x7ef1('0x62')],{'mixmonitorid':_0x3237ac[_0x7ef1('0x66')]});if(_0x2b3119){_0x2b3119['status']=_0x7ef1('0x6d');}})['then'](function(){var _0x253f6b=util['format'](_0x7ef1('0x5e'),_0x3237ac[_0x7ef1('0x6e')]||_0x3237ac[_0x7ef1('0x5f')],_0x3237ac[_0x7ef1('0x9')]||'wav');var _0x1f29f6=_[_0x7ef1('0x5c')](_0x381c5b[_0x7ef1('0x62')],{'filename':_0x7ef1('0x63')+_0x253f6b[_0x7ef1('0x64')]()});if(_0x1f29f6){_0x1f29f6['status']=_0x7ef1('0x6d');}})['then'](function(){_0x10a3ba({'code':0xc8,'message':[_0x3237ac['uniqueid'],_0x7ef1('0x6f')][_0x7ef1('0x13')]('\x20')});})[_0x7ef1('0x1f')](function(_0x45ef7c){_0x2d285f(_0x2ce9c6[_0x7ef1('0x11')](0x1f5,[_0x3237ac['uniqueid'],_0x45ef7c[_0x7ef1('0x17')][_0x7ef1('0x64')]()]['join']('\x20')));});}else{return _0x2d285f(_0x2ce9c6[_0x7ef1('0x11')](0x1f5,_0x7ef1('0x70')));}});},'VoiceQueuesChannels':function(_0x27d1ee){return new Promise(function(_0x350210,_0x588e49){var _0x17709d=_[_0x7ef1('0x71')](_0x1d2f83[_0x7ef1('0x72')]);_0x350210({'count':_0x17709d[_0x7ef1('0x59')],'rows':_0x17709d});});},'VoiceQueuesChannel':function(_0x55061c){var _0x5dbc7b=this;return new Promise(function(_0x321473,_0xad1e71){var _0x1f1f56=schema(properties[_0x7ef1('0x73')])[_0x7ef1('0x3')](_0x55061c);if(_0x1f1f56[_0x7ef1('0x59')]>0x0){return _0xad1e71(_0x5dbc7b['error'](0x1f4,_['map'](_0x1f1f56,'message')[_0x7ef1('0x13')](',\x20')));}var _0x52593d=_['find'](_0x1d2f83[_0x7ef1('0x72')],{'uniqueid':_0x55061c[_0x7ef1('0x5f')]});if(_0x52593d){_0x321473(_0x52593d);}else{return _0xad1e71(_0x5dbc7b['error'](0x1f5,_0x7ef1('0x70')));}});},'VoiceQueuesChannelHangup':function(_0x989610){var _0x323912=this;return new Promise(function(_0xfd038d,_0x12c7c1){if(ami[_0x7ef1('0x10')]()==![]){return _0x12c7c1(_0x323912[_0x7ef1('0x11')](0x1f4,[config[_0x7ef1('0x12')]['ip'],config[_0x7ef1('0x12')][_0x7ef1('0x18')],_0x7ef1('0x19')][_0x7ef1('0x13')]('\x20')));}var _0x507693=schema(properties[_0x7ef1('0x74')])['validate'](_0x989610);if(_0x507693[_0x7ef1('0x59')]>0x0){return _0x12c7c1(_0x323912['error'](0x1f4,_['map'](_0x507693,_0x7ef1('0x17'))[_0x7ef1('0x13')](',\x20')));}var _0xebae30=_[_0x7ef1('0x5c')](_0x1d2f83[_0x7ef1('0x72')],{'uniqueid':_0x989610[_0x7ef1('0x5f')]});if(_0xebae30&&_0xebae30['channel']){return ami[_0x7ef1('0x6b')]({'action':_0x7ef1('0x75'),'channel':_0xebae30[_0x7ef1('0x5d')]})[_0x7ef1('0x16')](function(_0x254577){_0xfd038d({'code':0xc8,'message':[_0x989610[_0x7ef1('0x5f')],_0x254577[_0x7ef1('0x17')]['toLowerCase']()]['join']('\x20')});})[_0x7ef1('0x1f')](function(_0x22bf32){_0x12c7c1(_0x323912[_0x7ef1('0x11')](0x1f5,[_0x989610[_0x7ef1('0x5f')],_0x22bf32[_0x7ef1('0x17')][_0x7ef1('0x64')]()][_0x7ef1('0x13')]('\x20')));});}else{return _0x12c7c1(_0x323912['error'](0x1f5,_0x7ef1('0x70')));}});},'VoiceQueuesChannelRedirect':function(_0x1a89d4){var _0xc169c0=this;return new Promise(function(_0x5db8a0,_0x549d49){if(ami[_0x7ef1('0x10')]()==![]){return _0x549d49(_0xc169c0[_0x7ef1('0x11')](0x1f4,[config[_0x7ef1('0x12')]['ip'],config[_0x7ef1('0x12')]['username'],_0x7ef1('0x19')][_0x7ef1('0x13')]('\x20')));}var _0x33c1b8=schema(properties['voicequeuechannelredirect'])['validate'](_0x1a89d4);if(_0x33c1b8['length']>0x0){return _0x549d49(_0xc169c0['error'](0x1f4,_[_0x7ef1('0x5b')](_0x33c1b8,_0x7ef1('0x17'))[_0x7ef1('0x13')](',\x20')));}var _0x3a21a1=_[_0x7ef1('0x5c')](_0x1d2f83[_0x7ef1('0x72')],{'uniqueid':_0x1a89d4[_0x7ef1('0x5f')]});if(_0x3a21a1&&_0x3a21a1['channel']){return ami[_0x7ef1('0x6b')]({'action':_0x7ef1('0x76'),'channel':_0x3a21a1['channel'],'exten':_0x1a89d4['exten'],'context':_0x1a89d4[_0x7ef1('0x77')]||_0x3a21a1[_0x7ef1('0x77')],'priority':0x1})[_0x7ef1('0x16')](function(_0x478d2a){_0x5db8a0({'code':0xc8,'message':[_0x1a89d4[_0x7ef1('0x5f')],_0x478d2a[_0x7ef1('0x17')][_0x7ef1('0x64')]()][_0x7ef1('0x13')]('\x20')});})[_0x7ef1('0x1f')](function(_0x24c10d){_0x549d49(_0xc169c0['error'](0x1f5,[_0x1a89d4['uniqueid'],_0x24c10d[_0x7ef1('0x17')][_0x7ef1('0x64')]()][_0x7ef1('0x13')]('\x20')));});}else{return _0x549d49(_0xc169c0[_0x7ef1('0x11')](0x1f5,_0x7ef1('0x70')));}});},'Agents':function(_0x374617){return new Promise(function(_0x20a84b,_0x7b989){var _0x2f40e2=_[_0x7ef1('0x71')](_0x1d2f83[_0x7ef1('0x78')]);_0x20a84b({'count':_0x2f40e2[_0x7ef1('0x59')],'rows':_0x2f40e2});});},'Telephones':function(_0xb31eb3){return new Promise(function(_0x5d3506,_0x2f346b){var _0x2fffcc=_[_0x7ef1('0x71')](_0x1d2f83[_0x7ef1('0x79')]);_0x5d3506({'count':_0x2fffcc[_0x7ef1('0x59')],'rows':_0x2fffcc});});},'Trunks':function(_0x3df2e5){return new Promise(function(_0x14919c,_0x256c87){var _0x471951=_[_0x7ef1('0x71')](_0x1d2f83[_0x7ef1('0x7a')]);_0x14919c({'count':_0x471951[_0x7ef1('0x59')],'rows':_0x471951});});},'OutboundChannels':function(_0x3bb6ee){return new Promise(function(_0x5e13e6,_0x1ea4f2){var _0x95771d=_[_0x7ef1('0x71')](_0x1d2f83['outboundChannels']);_0x5e13e6({'count':_0x95771d[_0x7ef1('0x59')],'rows':_0x95771d});});},'Outbound':function(_0x1a8904){return new Promise(function(_0x27cd17,_0x2ab54b){_0x27cd17(_0x1d2f83[_0x7ef1('0x2c')]);});},'Campaigns':function(_0x4d13af){return new Promise(function(_0x42121d,_0x286340){var _0x41a913=_[_0x7ef1('0x71')](_0x1d2f83['campaigns']);_0x42121d({'count':_0x41a913[_0x7ef1('0x59')],'rows':_0x41a913});});},'VoiceQueuesPreview':function(_0x15201a){var _0x1112f2=this;return new Promise(function(_0x6698b0,_0x360b1a){_0x514b70['run'](_0x15201a['id'])[_0x7ef1('0x16')](function(_0x2d8f54){_0x6698b0({'code':0xc8,'message':_0x2d8f54[_0x7ef1('0x17')]});})[_0x7ef1('0x1f')](function(_0x55cd1f){_0x360b1a(_0x1112f2['error'](0x1f4,_0x55cd1f[_0x7ef1('0x17')]));});});},'EventManager':function(_0x159023){var _0x1b72cb=this;return new Promise(function(_0x1a0040,_0x2857da){if(!_0x159023[_0x7ef1('0x7b')]){return _0x2857da(_0x1b72cb[_0x7ef1('0x11')](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x7ef1('0x7c')+_0x159023['event'],_0x159023[_0x7ef1('0x17')]);_0x1a0040({'code':0xc8,'message':_0x159023});});},'FaxAccounts':function(_0xbbae4){return new Promise(function(_0x1ed60e,_0x4aab34){var _0x4acced=_[_0x7ef1('0x71')](_0x1d2f83['faxAccounts']);_0x1ed60e({'count':_0x4acced[_0x7ef1('0x59')],'rows':_0x4acced});});},'SendFax':function(_0x1a2bb9){var _0x3db6a1=this;return new Promise(function(_0x227dc4,_0x3a1c63){_0x138ed1[_0x7ef1('0x7d')](_0x1a2bb9)[_0x7ef1('0x16')](function(_0x5c8941){_0x227dc4({'code':0xc8,'message':_0x5c8941['message']});})[_0x7ef1('0x1f')](function(_0x5b0110){_0x3a1c63(_0x3db6a1[_0x7ef1('0x11')](0x1f4,_0x5b0110[_0x7ef1('0x17')]));});});},'CheckAfterSend':function(_0x4bb8aa){var _0x492e8e=this;return new Promise(function(_0xd9d5e,_0x1519ee){_0x138ed1[_0x7ef1('0x7e')](_0x4bb8aa)['then'](function(_0x417734){_0xd9d5e({'code':0xc8,'message':_0x417734['message']});})['catch'](function(_0x313900){_0x1519ee(_0x492e8e[_0x7ef1('0x11')](0x1f4,_0x313900[_0x7ef1('0x17')]));});});}};var _0x5dc605=jayson['server'](_0x4ba2f0)['http']();_0x5dc605['on'](_0x7ef1('0x11'),function(_0x2dfa67){return _0x34a040(_0x2dfa67);});_0x5dc605[_0x7ef1('0x7f')](0x232a,'127.0.0.1',function(){console[_0x7ef1('0x80')](_0x7ef1('0x81'),0x232a);return _0x498596(_0x7ef1('0x82')+0x232a);});});}; \ No newline at end of file +var _0xe2fe=['checkAfterSend','server','http','127.0.0.1','log','lodash','validate','moment','../../../config/environment','../properties','../ami','listen','format','SIP','name','timers','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','ami\x20disconnected','join','pick','keys','module','Reload','then','message','error','command','action','Command','Action','content','catch','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','total','type','unmanaged','abandoned','waiting','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','find','omit','undefined','username','length','map','uniqueid','channel','%s.%s','filename','wav','MixMonitor','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','push','mixmonitorid','rec','status','channels','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannel','Channel\x20doesn\x27t\x20exist','voicequeuechannelredirect','exten','agents','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','custom:','faxAccounts'];(function(_0x21c568,_0x4aa33b){var _0x5edbc6=function(_0x2d1f74){while(--_0x2d1f74){_0x21c568['push'](_0x21c568['shift']());}};_0x5edbc6(++_0x4aa33b);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var jayson=require('jayson/promise');var schema=require(_0xee2f('0x1'));var BPromise=require('bluebird');var moment=require(_0xee2f('0x2'));var config=require(_0xee2f('0x3'));var properties=require(_0xee2f('0x4'));var ami=require(_0xee2f('0x5'));exports[_0xee2f('0x6')]=function(_0x4ba89f,_0x311a2f,_0x2b7e7c){return new BPromise(function(_0x49926b,_0x1533a0){var _0x2e1c8c={'QueuePause':function(_0x5a7975){return new Promise(function(_0x3c4095,_0x5ea796){var _0x34007e=util[_0xee2f('0x7')]('%s/%s',_0xee2f('0x8'),_0x5a7975[_0xee2f('0x9')]);if(_0x4ba89f['timers']&&_0x4ba89f['timers'][_0x34007e]&&_0x4ba89f['timers'][_0x34007e]['timer']){_0x4ba89f[_0xee2f('0xa')][_0x34007e]['updateAcw']();}if(_0x4ba89f['agents'][_0x34007e]){_0x4ba89f['agents'][_0x34007e][_0xee2f('0xb')]({'statePause':_0x5a7975[_0xee2f('0xc')]?!![]:![]});}_0x3c4095({'code':0xc8,'message':_0xee2f('0xd')});});},'Reload':function(_0x100449){var _0x131874=this;return new Promise(function(_0x3ab91f,_0x4faa8f){if(ami[_0xee2f('0xe')]()==![]){return _0x4faa8f(_0x131874['error'](0x1f4,[config[_0xee2f('0xf')]['ip'],config[_0xee2f('0xf')]['username'],_0xee2f('0x10')][_0xee2f('0x11')]('\x20')));}_0x100449=_[_0xee2f('0x12')](_0x100449,_[_0xee2f('0x13')](properties[_0xee2f('0x14')]));_0x100449['action']=_0xee2f('0x15');return ami['Action'](_0x100449)[_0xee2f('0x16')](function(_0x3359ff){_0x3ab91f({'code':0xc8,'message':_0x3359ff['message']});})['catch'](function(_0x40b5bc){_0x4faa8f(_0x131874['error'](0x1f5,_0x40b5bc[_0xee2f('0x17')]));});});},'Command':function(_0x3e0b31){var _0x28549d=this;return new Promise(function(_0x5b83b5,_0x35e1a4){if(ami[_0xee2f('0xe')]()==![]){return _0x35e1a4(_0x28549d[_0xee2f('0x18')](0x1f4,[config[_0xee2f('0xf')]['ip'],config[_0xee2f('0xf')]['username'],'ami\x20disconnected'][_0xee2f('0x11')]('\x20')));}_0x3e0b31=_[_0xee2f('0x12')](_0x3e0b31,_0xee2f('0x19'));_0x3e0b31[_0xee2f('0x1a')]=_0xee2f('0x1b');return ami[_0xee2f('0x1c')](_0x3e0b31)[_0xee2f('0x16')](function(_0x4d68d3){_0x5b83b5({'code':0xc8,'message':_0x4d68d3[_0xee2f('0x1d')]});})[_0xee2f('0x1e')](function(_0x15ceda){_0x35e1a4(_0x28549d[_0xee2f('0x18')](0x1f5,_0x15ceda[_0xee2f('0x17')]));});});},'VoiceQueues':function(_0xf77cf5){return new Promise(function(_0x15a1b1,_0x13013f){var _0x382174=[];for(var _0x1e394f in _0x4ba89f[_0xee2f('0x1f')]){if(_0x4ba89f[_0xee2f('0x1f')][_0xee2f('0x20')](_0x1e394f)){var _0x45c4a0=_0x4ba89f['voiceQueues'][_0x1e394f];var _0x4ef690={'id':_0x45c4a0['id'],'name':_0x45c4a0['name'],'strategy':_0x45c4a0[_0xee2f('0x21')],'answered':_0x45c4a0[_0xee2f('0x22')],'available':_0x45c4a0[_0xee2f('0x23')],'loggedIn':_0x45c4a0[_0xee2f('0x24')],'pTalking':_0x45c4a0[_0xee2f('0x25')],'sumBillable':_0x45c4a0[_0xee2f('0x26')],'sumDuration':_0x45c4a0['sumDuration'],'sumHoldTime':_0x45c4a0[_0xee2f('0x27')]||0x0,'talking':_0x45c4a0['talking'],'total':_0x45c4a0[_0xee2f('0x28')],'type':_0x45c4a0[_0xee2f('0x29')],'unmanaged':_0x45c4a0[_0xee2f('0x2a')],'abandoned':_0x45c4a0[_0xee2f('0x2b')],'waiting':_0x45c4a0[_0xee2f('0x2c')],'loggedInDb':_0x45c4a0['loggedInDb']};if(_0x45c4a0[_0xee2f('0x29')]===_0xee2f('0x2d')){_0x4ef690['dialActive']=_0x45c4a0['dialActive'];_0x4ef690[_0xee2f('0x2e')]=_0x45c4a0['dialMethod'];_0x4ef690[_0xee2f('0x2f')]=_0x45c4a0[_0xee2f('0x2f')];_0x4ef690['dialOriginateCallerIdNumber']=_0x45c4a0[_0xee2f('0x30')];_0x4ef690['dialOriginateTimeout']=_0x45c4a0['dialOriginateTimeout'];_0x4ef690['dialPrefix']=_0x45c4a0[_0xee2f('0x31')];_0x4ef690[_0xee2f('0x32')]=_0x45c4a0['temp'];_0x4ef690[_0xee2f('0x33')]=_0x45c4a0[_0xee2f('0x33')];_0x4ef690[_0xee2f('0x34')]=_0x45c4a0[_0xee2f('0x34')];_0x4ef690[_0xee2f('0x35')]=_0x45c4a0['outboundBlacklistCallsDay'];_0x4ef690[_0xee2f('0x36')]=_0x45c4a0['outboundBusyCallsDay'];_0x4ef690[_0xee2f('0x37')]=_0x45c4a0[_0xee2f('0x37')];_0x4ef690[_0xee2f('0x38')]=_0x45c4a0['outboundDropCallsDayACS'];_0x4ef690[_0xee2f('0x39')]=_0x45c4a0['outboundDropCallsDayCallersExit'];_0x4ef690[_0xee2f('0x3a')]=_0x45c4a0['outboundDropCallsDayTimeout'];_0x4ef690[_0xee2f('0x3b')]=_0x45c4a0[_0xee2f('0x3b')];_0x4ef690[_0xee2f('0x3c')]=_0x45c4a0[_0xee2f('0x3c')];_0x4ef690[_0xee2f('0x3d')]=_0x45c4a0[_0xee2f('0x3d')];_0x4ef690[_0xee2f('0x3e')]=_0x45c4a0[_0xee2f('0x3e')];_0x4ef690[_0xee2f('0x3f')]=_0x45c4a0[_0xee2f('0x3f')];_0x4ef690[_0xee2f('0x40')]=_0x45c4a0['outboundUnknownCallsDay'];_0x4ef690[_0xee2f('0x41')]=_0x45c4a0['predictiveIntervalAnsweredCalls'];_0x4ef690[_0xee2f('0x42')]=_0x45c4a0[_0xee2f('0x42')];_0x4ef690[_0xee2f('0x43')]=_0x45c4a0[_0xee2f('0x43')];_0x4ef690[_0xee2f('0x44')]=_0x45c4a0[_0xee2f('0x44')];_0x4ef690[_0xee2f('0x45')]=_0x45c4a0[_0xee2f('0x45')];_0x4ef690['predictiveIntervalErlangCalls']=_0x45c4a0['predictiveIntervalErlangCalls'];_0x4ef690['predictiveIntervalErlangCallsDroppedCalls']=_0x45c4a0[_0xee2f('0x46')];_0x4ef690['predictiveIntervalHitRate']=_0x45c4a0[_0xee2f('0x47')];_0x4ef690['predictiveIntervalMultiplicativeFactor']=_0x45c4a0['predictiveIntervalMultiplicativeFactor'];_0x4ef690['predictiveIntervalPauses']=_0x45c4a0['predictiveIntervalPauses'];_0x4ef690[_0xee2f('0x48')]=_0x45c4a0[_0xee2f('0x48')];_0x4ef690[_0xee2f('0x49')]=_0x45c4a0[_0xee2f('0x49')];_0x4ef690['message']=_0x45c4a0['message'];_0x4ef690[_0xee2f('0x4a')]=_0x45c4a0['originated'];_0x4ef690['erlangCalls']=_0x45c4a0[_0xee2f('0x4b')];_0x4ef690[_0xee2f('0x4c')]=_0x45c4a0[_0xee2f('0x4c')];_0x4ef690['erlangAbandonmentRate']=_0x45c4a0[_0xee2f('0x4d')];_0x4ef690[_0xee2f('0x4e')]=_0x45c4a0[_0xee2f('0x4e')];_0x4ef690['startPredictive']=_0x45c4a0['startPredictive'];_0x4ef690[_0xee2f('0x4f')]=_0x45c4a0[_0xee2f('0x4f')];}if(_0x45c4a0[_0xee2f('0x50')]){_0x4ef690[_0xee2f('0x50')]={'id':_0x45c4a0['Trunk']['id'],'name':_0x45c4a0[_0xee2f('0x50')][_0xee2f('0x9')],'active':_0x45c4a0[_0xee2f('0x50')][_0xee2f('0x51')],'callerid':_0x45c4a0[_0xee2f('0x50')][_0xee2f('0x52')]};}if(_0x45c4a0[_0xee2f('0x53')]){_0x4ef690[_0xee2f('0x53')]={'id':_0x45c4a0[_0xee2f('0x53')]['id'],'name':_0x45c4a0[_0xee2f('0x53')]['name']};}_0x382174['push'](_0x4ef690);}}_0x15a1b1({'count':_0x382174['length'],'rows':_0x382174});});},'UpdateVoiceQueue':function(_0x4a0bcb){return new Promise(function(_0x11aecb,_0x3e0d7b){var _0x34ce9c=_[_0xee2f('0x54')](_0x4ba89f[_0xee2f('0x1f')],{'id':parseInt(_0x4a0bcb['id'])});var _0x556239=_[_0xee2f('0x55')](_0x4a0bcb,['id']);if(_0x34ce9c){for(var _0x36c5cc in _0x556239){if(typeof _0x556239[_0x36c5cc]!==_0xee2f('0x56')&&typeof _0x34ce9c[_0x36c5cc]!==_0xee2f('0x56')){_0x34ce9c[_0x36c5cc]=_0x556239[_0x36c5cc];}}_0x11aecb(_0x34ce9c);}else{_0x3e0d7b();}});},'VoiceChannels':function(_0x57f493){return new Promise(function(_0x5c887b,_0x5aac72){var _0x1609f0=_['values'](_0x4ba89f['channels']);_0x5c887b({'count':_0x1609f0['length'],'rows':_0x1609f0});});},'VoiceChannelMixMonitor':function(_0x5f39b4){var _0x3834d1=this;return new Promise(function(_0x3ebb54,_0x32da72){if(ami['isConnected']()==![]){return _0x32da72(_0x3834d1[_0xee2f('0x18')](0x1f4,[config['asterisk']['ip'],config[_0xee2f('0xf')][_0xee2f('0x57')],_0xee2f('0x10')][_0xee2f('0x11')]('\x20')));}var _0x3d86b4=schema(properties['voicechannel'])['validate'](_0x5f39b4);if(_0x3d86b4[_0xee2f('0x58')]>0x0){return _0x32da72(_0x3834d1['error'](0x1f4,_[_0xee2f('0x59')](_0x3d86b4,_0xee2f('0x17'))[_0xee2f('0x11')](',\x20')));}var _0x88e683=_['find'](_0x4ba89f['channels'],{'uniqueid':_0x5f39b4[_0xee2f('0x5a')]});if(_0x88e683&&_0x88e683[_0xee2f('0x5b')]){var _0x1b00a8=util[_0xee2f('0x7')](_0xee2f('0x5c'),_0x5f39b4[_0xee2f('0x5d')]||_0x5f39b4[_0xee2f('0x5a')],_0x5f39b4[_0xee2f('0x7')]||_0xee2f('0x5e'));return ami[_0xee2f('0x1c')]({'action':_0xee2f('0x5f'),'channel':_0x88e683[_0xee2f('0x5b')],'file':_0x1b00a8,'options':'ai(mixmonitorid)'})[_0xee2f('0x16')](function(_0x236dba){var _0x307975=_[_0xee2f('0x54')](_0x88e683['monitors'],{'filename':_0xee2f('0x60')+_0x1b00a8[_0xee2f('0x61')]()});if(_[_0xee2f('0x62')](_0x307975)){_0x88e683[_0xee2f('0x63')][_0xee2f('0x64')]({'filename':'/var/spool/asterisk/monitor/'+_0x1b00a8[_0xee2f('0x61')](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x236dba[_0xee2f('0x65')],'status':_0xee2f('0x66')});}else{_0x307975[_0xee2f('0x65')]=_0x236dba[_0xee2f('0x65')];_0x307975[_0xee2f('0x67')]=_0xee2f('0x66');}_0x3ebb54({'code':0xc8,'message':[_0x5f39b4[_0xee2f('0x5a')],'MixMonitor\x20Success',_0x236dba[_0xee2f('0x65')]][_0xee2f('0x11')]('\x20'),'mixmonitorid':_0x236dba[_0xee2f('0x65')]});})[_0xee2f('0x1e')](function(_0x15fb49){_0x32da72(_0x3834d1[_0xee2f('0x18')](0x1f5,[_0x5f39b4[_0xee2f('0x5a')],_0x15fb49[_0xee2f('0x17')][_0xee2f('0x61')]()]['join']('\x20')));});}else{return _0x32da72(_0x3834d1[_0xee2f('0x18')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x1b4ee6){var _0x38ada3=this;return new Promise(function(_0x1dbbf2,_0x11ba31){if(ami[_0xee2f('0xe')]()==![]){return _0x11ba31(_0x38ada3['error'](0x1f4,[config[_0xee2f('0xf')]['ip'],config[_0xee2f('0xf')][_0xee2f('0x57')],_0xee2f('0x10')]['join']('\x20')));}var _0x51dc08=schema(properties['voicechannel'])['validate'](_0x1b4ee6);if(_0x51dc08['length']>0x0){return _0x11ba31(_0x38ada3[_0xee2f('0x18')](0x1f4,_['map'](_0x51dc08,_0xee2f('0x17'))[_0xee2f('0x11')](',\x20')));}var _0xd967e9=_[_0xee2f('0x54')](_0x4ba89f[_0xee2f('0x68')],{'uniqueid':_0x1b4ee6[_0xee2f('0x5a')]});if(_0xd967e9){return BPromise['resolve']()['then'](function(){if(_0xd967e9[_0xee2f('0x5b')]){return ami['Action']({'action':_0xee2f('0x69'),'channel':_0xd967e9['channel'],'mixmonitorid':_0x1b4ee6[_0xee2f('0x65')]})['catch'](function(_0x1f75f6){});}})[_0xee2f('0x16')](function(){if(_0xd967e9[_0xee2f('0x6a')]){return ami['Action']({'action':_0xee2f('0x69'),'channel':_0xd967e9[_0xee2f('0x6a')],'mixmonitorid':_0x1b4ee6[_0xee2f('0x65')]})[_0xee2f('0x1e')](function(_0xfeddec){});}})[_0xee2f('0x16')](function(_0xf0c721){var _0x54f48f=_[_0xee2f('0x54')](_0xd967e9[_0xee2f('0x63')],{'mixmonitorid':_0x1b4ee6[_0xee2f('0x65')]});if(_0x54f48f){_0x54f48f[_0xee2f('0x67')]=_0xee2f('0x6b');}})[_0xee2f('0x16')](function(){var _0x8ccc9d=util[_0xee2f('0x7')](_0xee2f('0x5c'),_0x1b4ee6[_0xee2f('0x5d')]||_0x1b4ee6[_0xee2f('0x5a')],_0x1b4ee6['format']||_0xee2f('0x5e'));var _0xf15bc1=_['find'](_0xd967e9[_0xee2f('0x63')],{'filename':'/var/spool/asterisk/monitor/'+_0x8ccc9d[_0xee2f('0x61')]()});if(_0xf15bc1){_0xf15bc1['status']='stop';}})[_0xee2f('0x16')](function(){_0x1dbbf2({'code':0xc8,'message':[_0x1b4ee6[_0xee2f('0x5a')],_0xee2f('0x6c')][_0xee2f('0x11')]('\x20')});})[_0xee2f('0x1e')](function(_0x59c035){_0x11ba31(_0x38ada3[_0xee2f('0x18')](0x1f5,[_0x1b4ee6[_0xee2f('0x5a')],_0x59c035[_0xee2f('0x17')]['toLowerCase']()][_0xee2f('0x11')]('\x20')));});}else{return _0x11ba31(_0x38ada3[_0xee2f('0x18')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x1f1c55){return new Promise(function(_0x32800d,_0x337d7f){var _0x42d256=_[_0xee2f('0x6d')](_0x4ba89f[_0xee2f('0x6e')]);_0x32800d({'count':_0x42d256[_0xee2f('0x58')],'rows':_0x42d256});});},'VoiceQueuesChannel':function(_0x97edb2){var _0x37935e=this;return new Promise(function(_0x4adcbe,_0x5cc502){var _0x58d16e=schema(properties[_0xee2f('0x6f')])[_0xee2f('0x1')](_0x97edb2);if(_0x58d16e[_0xee2f('0x58')]>0x0){return _0x5cc502(_0x37935e[_0xee2f('0x18')](0x1f4,_[_0xee2f('0x59')](_0x58d16e,'message')[_0xee2f('0x11')](',\x20')));}var _0x3a4464=_['find'](_0x4ba89f[_0xee2f('0x6e')],{'uniqueid':_0x97edb2[_0xee2f('0x5a')]});if(_0x3a4464){_0x4adcbe(_0x3a4464);}else{return _0x5cc502(_0x37935e[_0xee2f('0x18')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x3637cd){var _0x4858a3=this;return new Promise(function(_0x41fce2,_0x9732af){if(ami['isConnected']()==![]){return _0x9732af(_0x4858a3[_0xee2f('0x18')](0x1f4,[config[_0xee2f('0xf')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0xee2f('0x11')]('\x20')));}var _0x5d9054=schema(properties['voicequeuechannelhangup'])[_0xee2f('0x1')](_0x3637cd);if(_0x5d9054[_0xee2f('0x58')]>0x0){return _0x9732af(_0x4858a3['error'](0x1f4,_[_0xee2f('0x59')](_0x5d9054,'message')[_0xee2f('0x11')](',\x20')));}var _0x10d5f2=_[_0xee2f('0x54')](_0x4ba89f[_0xee2f('0x6e')],{'uniqueid':_0x3637cd[_0xee2f('0x5a')]});if(_0x10d5f2&&_0x10d5f2[_0xee2f('0x5b')]){return ami[_0xee2f('0x1c')]({'action':'Hangup','channel':_0x10d5f2[_0xee2f('0x5b')]})[_0xee2f('0x16')](function(_0x2d4a66){_0x41fce2({'code':0xc8,'message':[_0x3637cd[_0xee2f('0x5a')],_0x2d4a66[_0xee2f('0x17')]['toLowerCase']()][_0xee2f('0x11')]('\x20')});})[_0xee2f('0x1e')](function(_0x1c28a1){_0x9732af(_0x4858a3[_0xee2f('0x18')](0x1f5,[_0x3637cd[_0xee2f('0x5a')],_0x1c28a1[_0xee2f('0x17')]['toLowerCase']()]['join']('\x20')));});}else{return _0x9732af(_0x4858a3[_0xee2f('0x18')](0x1f5,_0xee2f('0x70')));}});},'VoiceQueuesChannelRedirect':function(_0x3691b3){var _0x40d38f=this;return new Promise(function(_0x11316b,_0x266fb7){if(ami[_0xee2f('0xe')]()==![]){return _0x266fb7(_0x40d38f['error'](0x1f4,[config['asterisk']['ip'],config[_0xee2f('0xf')][_0xee2f('0x57')],_0xee2f('0x10')][_0xee2f('0x11')]('\x20')));}var _0x38ee46=schema(properties[_0xee2f('0x71')])[_0xee2f('0x1')](_0x3691b3);if(_0x38ee46[_0xee2f('0x58')]>0x0){return _0x266fb7(_0x40d38f[_0xee2f('0x18')](0x1f4,_[_0xee2f('0x59')](_0x38ee46,_0xee2f('0x17'))[_0xee2f('0x11')](',\x20')));}var _0x563d01=_['find'](_0x4ba89f[_0xee2f('0x6e')],{'uniqueid':_0x3691b3['uniqueid']});if(_0x563d01&&_0x563d01['channel']){return ami['Action']({'action':'Redirect','channel':_0x563d01[_0xee2f('0x5b')],'exten':_0x3691b3[_0xee2f('0x72')],'context':_0x3691b3['context']||_0x563d01['context'],'priority':0x1})[_0xee2f('0x16')](function(_0x458dfc){_0x11316b({'code':0xc8,'message':[_0x3691b3[_0xee2f('0x5a')],_0x458dfc['message']['toLowerCase']()][_0xee2f('0x11')]('\x20')});})[_0xee2f('0x1e')](function(_0x499d0e){_0x266fb7(_0x40d38f['error'](0x1f5,[_0x3691b3[_0xee2f('0x5a')],_0x499d0e['message'][_0xee2f('0x61')]()]['join']('\x20')));});}else{return _0x266fb7(_0x40d38f[_0xee2f('0x18')](0x1f5,_0xee2f('0x70')));}});},'Agents':function(_0x238040){return new Promise(function(_0x47db82,_0x5a87da){var _0x186780=_[_0xee2f('0x6d')](_0x4ba89f[_0xee2f('0x73')]);_0x47db82({'count':_0x186780['length'],'rows':_0x186780});});},'Telephones':function(_0x685fa6){return new Promise(function(_0xcced1e,_0x3a3e67){var _0x346fc2=_[_0xee2f('0x6d')](_0x4ba89f[_0xee2f('0x74')]);_0xcced1e({'count':_0x346fc2[_0xee2f('0x58')],'rows':_0x346fc2});});},'Trunks':function(_0x16326e){return new Promise(function(_0x449656,_0x1db0b5){var _0x9f06f9=_[_0xee2f('0x6d')](_0x4ba89f[_0xee2f('0x75')]);_0x449656({'count':_0x9f06f9[_0xee2f('0x58')],'rows':_0x9f06f9});});},'OutboundChannels':function(_0x56d36d){return new Promise(function(_0x92aef8,_0x2954c8){var _0xa852c9=_[_0xee2f('0x6d')](_0x4ba89f[_0xee2f('0x76')]);_0x92aef8({'count':_0xa852c9[_0xee2f('0x58')],'rows':_0xa852c9});});},'Outbound':function(_0x34cd09){return new Promise(function(_0x36010e,_0x2fcdad){_0x36010e(_0x4ba89f[_0xee2f('0x2d')]);});},'Campaigns':function(_0x301316){return new Promise(function(_0x49c92f,_0x19e538){var _0x3a988c=_[_0xee2f('0x6d')](_0x4ba89f[_0xee2f('0x77')]);_0x49c92f({'count':_0x3a988c['length'],'rows':_0x3a988c});});},'VoiceQueuesPreview':function(_0x15ca4e){var _0xecfe5=this;return new Promise(function(_0x1e67ea,_0x5d0aae){_0x311a2f['run'](_0x15ca4e['id'])[_0xee2f('0x16')](function(_0x48fe47){_0x1e67ea({'code':0xc8,'message':_0x48fe47['message']});})['catch'](function(_0x1d80fe){_0x5d0aae(_0xecfe5[_0xee2f('0x18')](0x1f4,_0x1d80fe[_0xee2f('0x17')]));});});},'EventManager':function(_0x172cee){var _0x539d82=this;return new Promise(function(_0x33c47a,_0x39d66f){if(!_0x172cee[_0xee2f('0x78')]){return _0x39d66f(_0x539d82['error'](0x1f4,_0xee2f('0x79')));}ami['emit'](_0xee2f('0x7a')+_0x172cee['event'],_0x172cee['message']);_0x33c47a({'code':0xc8,'message':_0x172cee});});},'FaxAccounts':function(_0xc8c0b2){return new Promise(function(_0x4d2d5b,_0x152b39){var _0x5a95e0=_['values'](_0x4ba89f[_0xee2f('0x7b')]);_0x4d2d5b({'count':_0x5a95e0[_0xee2f('0x58')],'rows':_0x5a95e0});});},'SendFax':function(_0x4fed80){var _0x2685ed=this;return new Promise(function(_0x34f882,_0x4fe164){_0x2b7e7c['send'](_0x4fed80)[_0xee2f('0x16')](function(_0x2dd38c){_0x34f882({'code':0xc8,'message':_0x2dd38c['message']});})[_0xee2f('0x1e')](function(_0x35dcf7){_0x4fe164(_0x2685ed[_0xee2f('0x18')](0x1f4,_0x35dcf7[_0xee2f('0x17')]));});});},'CheckAfterSend':function(_0x2c03fd){var _0x4f20e9=this;return new Promise(function(_0x5031d1,_0x567de2){_0x2b7e7c[_0xee2f('0x7c')](_0x2c03fd)[_0xee2f('0x16')](function(_0x38cb0e){_0x5031d1({'code':0xc8,'message':_0x38cb0e[_0xee2f('0x17')]});})[_0xee2f('0x1e')](function(_0x1ff82b){_0x567de2(_0x4f20e9[_0xee2f('0x18')](0x1f4,_0x1ff82b[_0xee2f('0x17')]));});});}};var _0x25a278=jayson[_0xee2f('0x7d')](_0x2e1c8c)[_0xee2f('0x7e')]();_0x25a278['on'](_0xee2f('0x18'),function(_0x14cdcd){return _0x1533a0(_0x14cdcd);});_0x25a278[_0xee2f('0x6')](0x232a,_0xee2f('0x7f'),function(){console[_0xee2f('0x80')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x49926b('RPC\x20listening\x20on\x20port:'+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 fd66bee..eb01cbc 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 _0x05a0=['merge','lodash','bluebird','ioredis','util','trigger','defaults','redis','localhost','info','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','phone','map','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','updatedAt','union','then','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridname','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','Unknown','format','user:%s','trigger:%s','action'];(function(_0x414f67,_0x861aed){var _0x338537=function(_0x4696fd){while(--_0x4696fd){_0x414f67['push'](_0x414f67['shift']());}};_0x338537(++_0x861aed);}(_0x05a0,0x94));var _0x005a=function(_0x59cdf6,_0x5d85e8){_0x59cdf6=_0x59cdf6-0x0;var _0x21a5d0=_0x05a0[_0x59cdf6];return _0x21a5d0;};'use strict';var _=require(_0x005a('0x0'));var BPromise=require(_0x005a('0x1'));var Redis=require(_0x005a('0x2'));var util=require(_0x005a('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x005a('0x4'));var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0x005a('0x5')](config[_0x005a('0x6')],{'host':_0x005a('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x3ee62b,_0x3f0a06,_0x166b10,_0x24c8ea,_0x486ba7){logger[_0x005a('0x8')]('[CM][%s][%s]',_0x3ee62b,_0x3f0a06['id'],_0x166b10,_0x24c8ea,JSON[_0x005a('0x9')](_0x486ba7));io['to'](_0x166b10)[_0x005a('0xa')](_0x24c8ea,_0x486ba7);}exports[_0x005a('0xb')]=function(_0x54e9d0,_0x3d9541,_0x1b06e9,_0x267499){var _0x3f45b3,_0xaf61e1;var _0xb4767d={};var _0xe74073;var _0x35f83f=Number(_0x1b06e9[_0x005a('0xc')]);var _0x217675=_0x1b06e9['data2']?Boolean(Number(_0x1b06e9[_0x005a('0xd')])):![];var _0x987d;var _0x546b7a=![];if(!_['isNil'](_0x1b06e9['data5'])){if(_0x1b06e9['data5']=='1')_0x546b7a=!![];}if(!_0x546b7a){if(_0x267499['xmd-contactid']){_0xb4767d['id']=_0x267499[_0x005a('0xe')];}}if(!_0xb4767d['id']){_0xb4767d[_0x005a('0xf')]=_0x35f83f;_0x987d=_0x1b06e9['data3']&&_0x1b06e9[_0x005a('0x10')]!=='0'?_0x1b06e9['data3']['split'](','):[_0x005a('0x11')];_0xb4767d['$or']=_[_0x005a('0x12')](_0x987d,function(_0x469bbf){var _0x188dcc={};_0x188dcc[_0x469bbf]=_0x267499['routeId']?_0x267499[_0x005a('0x13')]:_0x267499[_0x005a('0x14')];return _0x188dcc;});_0xe74073=_0x267499['routeId']?_0x267499[_0x005a('0x13')]:_0x267499[_0x005a('0x14')];}var _0x1db252=['id',_0x005a('0x15'),_0x005a('0x16'),_0x005a('0x11'),_0x005a('0x17'),_0x005a('0x18'),'ListId',_0x005a('0x19'),'scheduledAt',_0x005a('0x1a')];var _0x5d0ddb=_[_0x005a('0x1b')](_0x1db252,_0x987d);BPromise['resolve']()[_0x005a('0x1c')](cmContactRpc['getContacts']({'attributes':_0x5d0ddb,'where':_0xb4767d,'phone':_0xe74073}))[_0x005a('0x1c')](function(_0x45ec1f){_0xaf61e1=_0x45ec1f;if(!_['isEmpty'](_0xaf61e1)){if(_0xaf61e1['length']===0x1){_0x3f45b3=_0xaf61e1[0x0];logger['info']('[CM][%s][%s]\x20Contact\x20found:%s',_0x267499['uniqueid'],_0x3d9541['id'],_0x3f45b3['id']);}else{logger[_0x005a('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x267499[_0x005a('0x1d')],_0x3d9541['id'],_['map'](_0xaf61e1,'id')[_0x005a('0x1e')](','));}return;}else{logger[_0x005a('0x8')](_0x005a('0x1f'),_0x267499['uniqueid'],_0x3d9541['id']);var _0x2b9a17={'ListId':_0x35f83f};var _0x27b972=_0x1b06e9['data4']&&_0x1b06e9[_0x005a('0x20')]!=='0'?_0x1b06e9[_0x005a('0x20')]:'phone';if(_0x217675){logger['info'](_0x005a('0x21'),_0x267499[_0x005a('0x1d')],_0x3d9541['id']);_0x2b9a17[_0x27b972]=_[_0x005a('0x22')](_0x267499[_0x005a('0x23')])?_0x267499[_0x005a('0x14')]:_0x267499[_0x005a('0x13')];if(_[_0x005a('0x22')](_0x267499[_0x005a('0x23')])){_0x2b9a17[_0x005a('0x15')]=_0x267499[_0x005a('0x24')]&&_0x267499[_0x005a('0x24')]!==''?_0x267499[_0x005a('0x24')]:'Unknown';}else{_0x2b9a17[_0x005a('0x15')]=_0x267499[_0x005a('0x25')]&&_0x267499['destcalleridname']!==_0x005a('0x26')?_0x267499[_0x005a('0x25')]:'Unknown';}return BPromise['resolve']()['then'](cmContactRpc[_0x005a('0x27')](_0x2b9a17))[_0x005a('0x1c')](function(_0x5d896e){_0x3f45b3=_0x5d896e;_0xaf61e1[_0x005a('0x28')](_0x5d896e);if(_0x3f45b3){logger[_0x005a('0x8')](_0x005a('0x29'),_0x267499[_0x005a('0x1d')],_0x3d9541['id'],_0x3f45b3['id']);}return;});}else{logger['info'](_0x005a('0x2a'),_0x267499[_0x005a('0x1d')],_0x3d9541['id']);_0x2b9a17[_0x27b972]=_[_0x005a('0x22')](_0x267499[_0x005a('0x23')])?_0x267499[_0x005a('0x14')]:_0x267499['destcalleridnum'];if(_['isNil'](_0x267499[_0x005a('0x23')])){_0x2b9a17[_0x005a('0x15')]=_0x267499['calleridname']&&_0x267499[_0x005a('0x24')]!==_0x005a('0x26')?_0x267499[_0x005a('0x24')]:_0x005a('0x2b');}else{_0x2b9a17['firstName']=_0x267499[_0x005a('0x25')]&&_0x267499[_0x005a('0x25')]!==''?_0x267499[_0x005a('0x25')]:_0x005a('0x2b');}_0x3f45b3=_0x2b9a17;_0xaf61e1['push'](_0x2b9a17);return;}}})[_0x005a('0x1c')](function(){if(_0x54e9d0){emit(_0x267499[_0x005a('0x1d')],_0x3d9541,util[_0x005a('0x2c')](_0x005a('0x2d'),_0x54e9d0['name']),util[_0x005a('0x2c')](_0x005a('0x2e'),_0x1b06e9[_0x005a('0x2f')]['toLowerCase']()),{'evt':_[_0x005a('0x30')](_0x267499,{'autoCreate':_0x217675}),'contact':_0x3f45b3===undefined?{}:_0x3f45b3,'contacts':_0xaf61e1['length']===0x0?undefined:_0xaf61e1});}});}; \ No newline at end of file +var _0x0310=['format','user:%s','name','trigger:%s','action','merge','lodash','bluebird','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','[CM][%s][%s]','stringify','emit','data1','data2','data5','xmd-contactid','data3','split','phone','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[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','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x0310,0x128));var _0x0031=function(_0x9367e,_0x51ade2){_0x9367e=_0x9367e-0x0;var _0x51a8f8=_0x0310[_0x9367e];return _0x51a8f8;};'use strict';var _=require(_0x0031('0x0'));var BPromise=require(_0x0031('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x0031('0x2'));var logger=require(_0x0031('0x3'))(_0x0031('0x4'));var cmContactRpc=require(_0x0031('0x5'));config[_0x0031('0x6')]=_[_0x0031('0x7')](config['redis'],{'host':_0x0031('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0031('0x6')]));function emit(_0x11fe97,_0x1420ce,_0x476e4,_0x537c91,_0x2f8eb6){logger[_0x0031('0x9')](_0x0031('0xa'),_0x11fe97,_0x1420ce['id'],_0x476e4,_0x537c91,JSON[_0x0031('0xb')](_0x2f8eb6));io['to'](_0x476e4)[_0x0031('0xc')](_0x537c91,_0x2f8eb6);}exports['exec']=function(_0x16a08c,_0x165b15,_0x296712,_0x54106b){var _0x3d7a6d,_0x7be94d;var _0x464a9a={};var _0x2de7a2;var _0x1987b0=Number(_0x296712[_0x0031('0xd')]);var _0x2ec21d=_0x296712[_0x0031('0xe')]?Boolean(Number(_0x296712['data2'])):![];var _0xb89d6a;var _0x50f24a=![];if(!_['isNil'](_0x296712[_0x0031('0xf')])){if(_0x296712[_0x0031('0xf')]=='1')_0x50f24a=!![];}if(!_0x50f24a){if(_0x54106b[_0x0031('0x10')]){_0x464a9a['id']=_0x54106b['xmd-contactid'];}}if(!_0x464a9a['id']){_0x464a9a['ListId']=_0x1987b0;_0xb89d6a=_0x296712['data3']&&_0x296712[_0x0031('0x11')]!=='0'?_0x296712[_0x0031('0x11')][_0x0031('0x12')](','):[_0x0031('0x13')];_0x464a9a['$or']=_[_0x0031('0x14')](_0xb89d6a,function(_0x36f121){var _0xebfcb={};_0xebfcb[_0x36f121]=_0x54106b[_0x0031('0x15')]?_0x54106b[_0x0031('0x16')]:_0x54106b[_0x0031('0x17')];return _0xebfcb;});_0x2de7a2=_0x54106b[_0x0031('0x15')]?_0x54106b[_0x0031('0x16')]:_0x54106b[_0x0031('0x17')];}var _0x130ef8=['id',_0x0031('0x18'),_0x0031('0x19'),'phone',_0x0031('0x1a'),_0x0031('0x1b'),_0x0031('0x1c'),'createdAt',_0x0031('0x1d'),_0x0031('0x1e')];var _0x5251a2=_[_0x0031('0x1f')](_0x130ef8,_0xb89d6a);BPromise[_0x0031('0x20')]()[_0x0031('0x21')](cmContactRpc[_0x0031('0x22')]({'attributes':_0x5251a2,'where':_0x464a9a,'phone':_0x2de7a2}))[_0x0031('0x21')](function(_0x5b38e0){_0x7be94d=_0x5b38e0;if(!_[_0x0031('0x23')](_0x7be94d)){if(_0x7be94d[_0x0031('0x24')]===0x1){_0x3d7a6d=_0x7be94d[0x0];logger[_0x0031('0x9')](_0x0031('0x25'),_0x54106b['uniqueid'],_0x165b15['id'],_0x3d7a6d['id']);}else{logger[_0x0031('0x9')](_0x0031('0x26'),_0x54106b[_0x0031('0x27')],_0x165b15['id'],_[_0x0031('0x14')](_0x7be94d,'id')[_0x0031('0x28')](','));}return;}else{logger[_0x0031('0x9')](_0x0031('0x29'),_0x54106b[_0x0031('0x27')],_0x165b15['id']);var _0x3a0d9d={'ListId':_0x1987b0};var _0x95af15=_0x296712[_0x0031('0x2a')]&&_0x296712[_0x0031('0x2a')]!=='0'?_0x296712[_0x0031('0x2a')]:'phone';if(_0x2ec21d){logger[_0x0031('0x9')](_0x0031('0x2b'),_0x54106b[_0x0031('0x27')],_0x165b15['id']);_0x3a0d9d[_0x95af15]=_[_0x0031('0x2c')](_0x54106b[_0x0031('0x15')])?_0x54106b[_0x0031('0x17')]:_0x54106b['destcalleridnum'];if(_[_0x0031('0x2c')](_0x54106b[_0x0031('0x15')])){_0x3a0d9d['firstName']=_0x54106b['calleridname']&&_0x54106b[_0x0031('0x2d')]!==''?_0x54106b[_0x0031('0x2d')]:_0x0031('0x2e');}else{_0x3a0d9d[_0x0031('0x18')]=_0x54106b[_0x0031('0x2f')]&&_0x54106b[_0x0031('0x2f')]!==_0x0031('0x30')?_0x54106b[_0x0031('0x2f')]:_0x0031('0x2e');}return BPromise['resolve']()['then'](cmContactRpc[_0x0031('0x31')](_0x3a0d9d))[_0x0031('0x21')](function(_0x52b99c){_0x3d7a6d=_0x52b99c;_0x7be94d[_0x0031('0x32')](_0x52b99c);if(_0x3d7a6d){logger[_0x0031('0x9')](_0x0031('0x33'),_0x54106b[_0x0031('0x27')],_0x165b15['id'],_0x3d7a6d['id']);}return;});}else{logger[_0x0031('0x9')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x54106b[_0x0031('0x27')],_0x165b15['id']);_0x3a0d9d[_0x95af15]=_[_0x0031('0x2c')](_0x54106b[_0x0031('0x15')])?_0x54106b[_0x0031('0x17')]:_0x54106b[_0x0031('0x16')];if(_[_0x0031('0x2c')](_0x54106b[_0x0031('0x15')])){_0x3a0d9d['firstName']=_0x54106b[_0x0031('0x2d')]&&_0x54106b['calleridname']!==_0x0031('0x30')?_0x54106b[_0x0031('0x2d')]:_0x0031('0x2e');}else{_0x3a0d9d[_0x0031('0x18')]=_0x54106b[_0x0031('0x2f')]&&_0x54106b['destcalleridname']!==''?_0x54106b[_0x0031('0x2f')]:_0x0031('0x2e');}_0x3d7a6d=_0x3a0d9d;_0x7be94d['push'](_0x3a0d9d);return;}}})['then'](function(){if(_0x16a08c){emit(_0x54106b[_0x0031('0x27')],_0x165b15,util[_0x0031('0x34')](_0x0031('0x35'),_0x16a08c[_0x0031('0x36')]),util[_0x0031('0x34')](_0x0031('0x37'),_0x296712[_0x0031('0x38')]['toLowerCase']()),{'evt':_[_0x0031('0x39')](_0x54106b,{'autoCreate':_0x2ec21d}),'contact':_0x3d7a6d===undefined?{}:_0x3d7a6d,'contacts':_0x7be94d[_0x0031('0x24')]===0x0?undefined:_0x7be94d});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index dd335ac..b02d083 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 _0xaf97=['voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','stringify','motionChannel','undefined','voice','interface','checkTriggers','merge','variables','Actions','action','toLowerCase','contactmanager','motionbar','browser','html','render','data2','uri','isNil','data3','data4','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winApplication','winArguments','format','user:%s','data1','trigger:%s','name','exec','queue','routeId','urlforward','buildUri','parse','search','checkTrigger','channel','AllConditions','length','every','checkConditions','AnyConditions','some','field','chat','ChatWebsiteId','value','upperFirst','AccountId','operator','message','event','agent','membername','lastevent','substatus','offlineMessage','created','equals','exports','util','lodash','url','mustache','ioredis','./integration','./cmContact','./script','../../../config/environment','trigger','../ami','redis','defaults','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates'];(function(_0x137798,_0x2e76be){var _0x26888c=function(_0x169181){while(--_0x169181){_0x137798['push'](_0x137798['shift']());}};_0x26888c(++_0x2e76be);}(_0xaf97,0x15a));var _0x7af9=function(_0x577683,_0x36165f){_0x577683=_0x577683-0x0;var _0x59119c=_0xaf97[_0x577683];return _0x59119c;};'use strict';var util=require(_0x7af9('0x0'));var _=require(_0x7af9('0x1'));var url=require(_0x7af9('0x2'));var Mustache=require(_0x7af9('0x3'));var Redis=require(_0x7af9('0x4'));var urlforward=require('./urlforward');var integration=require(_0x7af9('0x5'));var cmContact=require(_0x7af9('0x6'));var script=require(_0x7af9('0x7'));var config=require(_0x7af9('0x8'));var logger=require('../../../config/logger')(_0x7af9('0x9'));var ami=require(_0x7af9('0xa'));config[_0x7af9('0xb')]=_[_0x7af9('0xc')](config['redis'],{'host':_0x7af9('0xd'),'port':0x18eb});var io=require(_0x7af9('0xe'))(new Redis(config[_0x7af9('0xb')]));var operators={'equals':function(_0x4220ff,_0x3010c5){return _0x4220ff==_0x3010c5;},'not_equals':function(_0x44867d,_0x4c6058){return _0x44867d!=_0x4c6058;}};var barAndWebActions=['popup',_0x7af9('0x2'),_0x7af9('0xf')];function Trigger(_0x225167){this['triggers']=_0x225167[_0x7af9('0x10')];this[_0x7af9('0x11')]=_0x225167[_0x7af9('0x11')];this['voiceQueues']=_0x225167[_0x7af9('0x12')];this[_0x7af9('0x13')]=_0x225167[_0x7af9('0x13')];this[_0x7af9('0x14')]=_0x225167[_0x7af9('0x14')];this['zendeskAccounts']=_0x225167[_0x7af9('0x15')];this[_0x7af9('0x16')]=_0x225167[_0x7af9('0x16')];this[_0x7af9('0x17')]=_0x225167['salesforceAccounts'];this[_0x7af9('0x18')]=_0x225167[_0x7af9('0x18')];this[_0x7af9('0x19')]=_0x225167[_0x7af9('0x19')];this[_0x7af9('0x1a')]=_0x225167[_0x7af9('0x1a')];this[_0x7af9('0x1b')]=_0x225167[_0x7af9('0x1b')];this['servicenowAccounts']=_0x225167['servicenowAccounts'];this[_0x7af9('0x1c')]=_0x225167[_0x7af9('0x1c')];this[_0x7af9('0x1d')]=_0x225167[_0x7af9('0x1d')];this[_0x7af9('0x1e')]={'zendesk':this[_0x7af9('0x15')],'salesforce':this[_0x7af9('0x17')],'freshdesk':this[_0x7af9('0x16')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this['zohoAccounts'],'desk':this[_0x7af9('0x1a')],'vtiger':this[_0x7af9('0x1b')],'dynamics365':this[_0x7af9('0x1c')],'freshsales':this[_0x7af9('0x1d')],'servicenow':this['servicenowAccounts']};ami['on'](_0x7af9('0x1f'),this[_0x7af9('0x20')][_0x7af9('0x21')](this));ami['on']('custom:agentconnect',this[_0x7af9('0x20')][_0x7af9('0x21')](this));ami['on']('custom:agentringnoanswer',this[_0x7af9('0x20')]['bind'](this));ami['on'](_0x7af9('0x22'),this['syncCustomEvent'][_0x7af9('0x21')](this));ami['on'](_0x7af9('0x23'),this[_0x7af9('0x20')][_0x7af9('0x21')](this));ami['on']('custom:agentnoanswer',this[_0x7af9('0x20')][_0x7af9('0x21')](this));ami['on'](_0x7af9('0x24'),this[_0x7af9('0x20')]['bind'](this));ami['on'](_0x7af9('0x25'),this[_0x7af9('0x20')][_0x7af9('0x21')](this));ami['on'](_0x7af9('0x26'),this['syncCustomEvent'][_0x7af9('0x21')](this));ami['on'](_0x7af9('0x27'),this[_0x7af9('0x20')]['bind'](this));ami['on'](_0x7af9('0x28'),this[_0x7af9('0x20')][_0x7af9('0x21')](this));ami['on'](_0x7af9('0x29'),this[_0x7af9('0x20')][_0x7af9('0x21')](this));ami['on'](_0x7af9('0x2a'),this[_0x7af9('0x2b')][_0x7af9('0x21')](this));ami['on'](_0x7af9('0x2c'),this[_0x7af9('0x2b')][_0x7af9('0x21')](this));ami['on']('custom:dialend',this[_0x7af9('0x2b')][_0x7af9('0x21')](this));ami['on'](_0x7af9('0x2d'),this[_0x7af9('0x20')]['bind'](this));ami['on'](_0x7af9('0x2e'),this[_0x7af9('0x20')][_0x7af9('0x21')](this));ami['on']('custom:substatus',this['syncCustomEvent'][_0x7af9('0x21')](this));ami['on'](_0x7af9('0x2f'),this[_0x7af9('0x20')][_0x7af9('0x21')](this));ami['on'](_0x7af9('0x30'),this[_0x7af9('0x20')][_0x7af9('0x21')](this));ami['on'](_0x7af9('0x31'),this[_0x7af9('0x20')][_0x7af9('0x21')](this));ami['on'](_0x7af9('0x32'),this['syncCustomEvent'][_0x7af9('0x21')](this));ami['on'](_0x7af9('0x33'),this['syncCustomEvent'][_0x7af9('0x21')](this));}Trigger[_0x7af9('0x34')][_0x7af9('0x35')]=function(_0x48e096,_0x129f40,_0x1c9e89){logger[_0x7af9('0x36')](_0x48e096,_0x129f40,JSON[_0x7af9('0x37')](_0x1c9e89));io['to'](_0x48e096)['emit'](_0x129f40,_0x1c9e89);};Trigger[_0x7af9('0x34')][_0x7af9('0x20')]=function(_0x415629){var _0x5e6333=_['clone'](_0x415629);if(typeof _0x5e6333[_0x7af9('0x38')]===_0x7af9('0x39')){_0x5e6333[_0x7af9('0x38')]=_0x7af9('0x3a');}this['checkTriggers'](_0x5e6333);};Trigger[_0x7af9('0x34')][_0x7af9('0x2b')]=function(_0x827a2c){if(this[_0x7af9('0x11')][_0x827a2c[_0x7af9('0x3b')]]){this['syncCustomEvent'](_0x827a2c);}};Trigger[_0x7af9('0x34')][_0x7af9('0x3c')]=function(_0x4e6cc2){var _0x446a5c;for(var _0xd8e33f in this[_0x7af9('0x10')]){if(this[_0x7af9('0x10')]['hasOwnProperty'](_0xd8e33f)){if(this[_0x7af9('0x10')][_0xd8e33f]['status']){_0x446a5c=this['checkTrigger'](this['triggers'][_0xd8e33f],_0x4e6cc2);if(_0x446a5c){_[_0x7af9('0x3d')](_0x4e6cc2,_0x4e6cc2[_0x7af9('0x3e')]);for(var _0x48330b=0x0,_0x4cffc8,_0x3671d1,_0x4537b6;_0x48330b0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x489672,_0x41bd29){var _0x4e00da=function(_0x4e6a8e){while(--_0x4e6a8e){_0x489672['push'](_0x489672['shift']());}};_0x4e00da(++_0x41bd29);}(_0x3e74,0x175));var _0x43e7=function(_0x460d0a,_0x830082){_0x460d0a=_0x460d0a-0x0;var _0x208973=_0x3e74[_0x460d0a];return _0x208973;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_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 diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 7d91790..1089598 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 _0xd4f4=['Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','ticketType','headers','odata-entityid','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','monitor_format','info','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','4.0','validateEmail','email','userEmail','length','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','substring','lastIndexOf','enduserId','telephone1','contacts?$select=telephone1&$filter=','\x20eq\x20\x27','replace','%2b','value','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','nameField','idField','indexOf','content','incidents','assign','getString'];(function(_0xc3004f,_0x1107a0){var _0x57a856=function(_0x2a542a){while(--_0x2a542a){_0xc3004f['push'](_0xc3004f['shift']());}};_0x57a856(++_0x1107a0);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x405470,_0x4a3029){_0x405470=_0x405470-0x0;var _0xcade01=_0xd4f4[_0x405470];return _0xcade01;};'use strict';var _=require(_0x4d4f('0x0'));var rp=require(_0x4d4f('0x1'));var util=require(_0x4d4f('0x2'));var intUtil=require(_0x4d4f('0x3'));var md5=require(_0x4d4f('0x4'));var Redis=require(_0x4d4f('0x5'));var logger=require(_0x4d4f('0x6'))(_0x4d4f('0x7'));var config=require(_0x4d4f('0x8'));config[_0x4d4f('0x9')]=_[_0x4d4f('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4d4f('0x9')]));function getAuthToken(_0xecc103,_0x150bd6,_0xea29b){if(_0xecc103[_0x4d4f('0xb')]){_0xecc103[_0x4d4f('0xc')]=_0xecc103[_0x4d4f('0xd')][_0x4d4f('0xe')];_0xecc103[_0x4d4f('0xf')]=_0xecc103[_0x4d4f('0xd')][_0x4d4f('0x10')];return Promise[_0x4d4f('0x11')](_0xecc103[_0x4d4f('0xd')][_0x4d4f('0x12')]);}var _0x6d6e5e={'method':_0x4d4f('0x13'),'uri':_0x150bd6,'form':{'client_id':_0xecc103[_0x4d4f('0x14')],'resource':_0xecc103[_0x4d4f('0xc')],'username':_0xecc103['username'],'password':_0xecc103['password'],'grant_type':'password','client_secret':_0xecc103[_0x4d4f('0x15')]},'json':!![]};return rp(_0x6d6e5e)[_0x4d4f('0x16')](function(_0x4b7472){return _0x4b7472[_0x4d4f('0x17')];})[_0x4d4f('0x18')](function(_0x1878b6){logger['error']('['+[_0xea29b[_0x4d4f('0x19')]()]+_0x4d4f('0x1a'));return _0x1878b6[_0x4d4f('0x1b')];});}function getUser(_0x4a3364,_0x59bfb5,_0x5e4ff5,_0x18a528,_0x16f8e7,_0x4170ca){return new Promise(function(_0x5aec1b,_0x30b6b1){return getAuthToken(_0x59bfb5,_0x18a528,_0x4170ca)[_0x4d4f('0x16')](function(_0x51dcf1){var _0x5dbbeb={'method':'GET','uri':_0x16f8e7+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x51dcf1,'OData-Version':_0x4d4f('0x1c')},'json':!![]};return rp(_0x5dbbeb);})[_0x4d4f('0x16')](function(_0x433222){var _0x3566a5=_0x433222['value'];var _0x5b2863=![];var _0x1e1ae2=null;if(!_['isNil'](_0x5e4ff5)){if(intUtil[_0x4d4f('0x1d')](_0x5e4ff5[_0x4d4f('0x1e')])){_0x4a3364[_0x4d4f('0x1f')]=_0x5e4ff5[_0x4d4f('0x1e')];for(_0x1e1ae2=0x0;_0x1e1ae2<_0x3566a5[_0x4d4f('0x20')];_0x1e1ae2++){if(_0x3566a5[_0x1e1ae2]['internalemailaddress']===_0x5e4ff5['email']&&!_0x3566a5[_0x1e1ae2][_0x4d4f('0x21')]){_0x5b2863=!![];logger['info']('['+[_0x4170ca[_0x4d4f('0x19')]()]+_0x4d4f('0x22')+_0x3566a5[_0x1e1ae2][_0x4d4f('0x23')]+'!');_0x4a3364[_0x4d4f('0x24')]=_0x3566a5[_0x1e1ae2][_0x4d4f('0x23')];}}}}if(!_0x5b2863){logger['info']('['+[_0x4170ca[_0x4d4f('0x19')]()]+_0x4d4f('0x25'));_0x4a3364[_0x4d4f('0x1f')]=_0x59bfb5[_0x4d4f('0x26')];for(_0x1e1ae2=0x0;_0x1e1ae2<_0x3566a5['length'];_0x1e1ae2++){if(_0x3566a5[_0x1e1ae2]['internalemailaddress']===_0x59bfb5[_0x4d4f('0x26')]){_0x4a3364[_0x4d4f('0x24')]=_0x3566a5[_0x1e1ae2][_0x4d4f('0x23')];}}}_0x5aec1b(_0x4a3364);})[_0x4d4f('0x18')](function(_0x58acbe){_0x30b6b1(_0x58acbe[_0x4d4f('0x1b')]);});});}function createEndUser(_0x380ebf,_0x388593,_0x2e91b2,_0x4effb1,_0x338ba2,_0x51cb3d){return new Promise(function(_0x1688bb,_0x333a40){return getAuthToken(_0x388593,_0x2e91b2,_0x51cb3d)['then'](function(_0x2768f1){var _0x123383=_0x51cb3d[_0x4d4f('0x27')]()===_0x4d4f('0x28')?_0x338ba2[_0x4d4f('0x29')]:_0x338ba2[_0x4d4f('0x2a')];var _0x4c69cb={'method':_0x4d4f('0x13'),'uri':_0x4effb1+_0x4d4f('0x2b'),'body':{'telephone1':_0x123383,'fullname':_0x123383,'firstname':_0x123383,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x4d4f('0x2c')+_0x380ebf[_0x4d4f('0x24')]+')'},'headers':{'Authorization':_0x4d4f('0x2d')+_0x2768f1,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x4c69cb);})[_0x4d4f('0x16')](function(_0x486e33){var _0x35f9e2=_0x486e33['headers']['odata-entityid'];var _0x5c751e=_0x35f9e2[_0x4d4f('0x2e')](_0x35f9e2['lastIndexOf']('(')+0x1,_0x35f9e2[_0x4d4f('0x2f')](')'));_0x380ebf[_0x4d4f('0x30')]=_0x5c751e;_0x1688bb(_0x380ebf);})[_0x4d4f('0x18')](function(_0x4f79f9){_0x333a40(_0x4f79f9[_0x4d4f('0x1b')]);});});}function getEndUser(_0x1ab7c4,_0x6baae8,_0x4cac5d,_0x6a30c4,_0x49e2db,_0x3f9618,_0x2f18df,_0x1a7cb3){var _0x128e3d=_0x3f9618[_0x4d4f('0x27')]()===_0x4d4f('0x28')?_0x49e2db[_0x4d4f('0x29')]:_0x49e2db[_0x4d4f('0x2a')];return getAuthToken(_0x6baae8,_0x4cac5d,_0x3f9618)['then'](function(_0x54a21e){_0x1a7cb3=_0x1a7cb3?_0x1a7cb3:_0x4d4f('0x31');var _0x559441={'method':'GET','uri':_0x6a30c4+_0x4d4f('0x32')+_0x1a7cb3+_0x4d4f('0x33')+_0x128e3d[_0x4d4f('0x34')]('+',_0x4d4f('0x35'))+'\x27','headers':{'Authorization':_0x4d4f('0x2d')+_0x54a21e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x559441);})[_0x4d4f('0x16')](function(_0x27466f){var _0x5cc3e7=![];if(!_0x27466f)return _0x5cc3e7;var _0x32af9a=_0x27466f[_0x4d4f('0x36')];for(var _0x336625=0x0;_0x336625<_0x32af9a[_0x4d4f('0x20')];_0x336625++){if(_0x32af9a[_0x336625][_0x4d4f('0x31')]===_0x128e3d){_0x5cc3e7=!![];_0x1ab7c4[_0x4d4f('0x30')]=_0x32af9a[_0x336625][_0x4d4f('0x37')];}}return _0x5cc3e7;})[_0x4d4f('0x16')](function(_0x157ccd){if(_0x157ccd)return _0x1ab7c4;if(_0x2f18df==='nothing'){logger['info']('['+[_0x3f9618[_0x4d4f('0x19')]()]+_0x4d4f('0x38'));return _0x1ab7c4;}return createEndUser(_0x1ab7c4,_0x6baae8,_0x4cac5d,_0x6a30c4,_0x49e2db,_0x3f9618)[_0x4d4f('0x16')](function(_0x131282){logger['info']('['+[_0x3f9618['toUpperCase']()]+_0x4d4f('0x39'),_0x131282[_0x4d4f('0x30')]);return _0x131282;});});}function getCustomFields(_0x58b52c,_0x546933,_0x3591b7){var _0x209cd0={};if(_0x58b52c['length']>0x0){_[_0x4d4f('0x3a')](_0x58b52c,function(_0x330bca){if(_[_0x4d4f('0x3b')]([_0x4d4f('0x3c'),_0x4d4f('0x3d')],_0x330bca['type'])&&_0x330bca[_0x4d4f('0x3e')]&&!_0x330bca['customField']){var _0x45a0c1=_0x330bca[_0x4d4f('0x3f')]['toLowerCase']();var _0x14a8f5=_0x45a0c1[_0x4d4f('0x2e')](0x0,_0x45a0c1[_0x4d4f('0x40')]('_'));var _0x489abe=_0x45a0c1[_0x4d4f('0x2e')](_0x45a0c1['indexOf']('_')+0x1);if(_0x14a8f5===_0x3591b7){_0x209cd0[_0x489abe]=_0x330bca[_0x4d4f('0x41')];}}});}return _0x209cd0;}function getTicket(_0x54fd8d,_0x18af23,_0x9f55b5,_0x231134,_0x2939cb,_0x198c3a,_0x4a53e4){return new Promise(function(_0x5f0d35,_0x29c065){var _0x351a1c;return getAuthToken(_0x18af23,_0x9f55b5,_0x4a53e4)[_0x4d4f('0x16')](function(_0x290bdc){if(_0x198c3a['ticketType']==='incident'){_0x351a1c={'method':'POST','uri':_0x231134+_0x4d4f('0x42'),'body':Object[_0x4d4f('0x43')]({},{'title':intUtil[_0x4d4f('0x44')](_0x198c3a[_0x4d4f('0x45')],_0x2939cb,'\x20'),'description':intUtil[_0x4d4f('0x44')](_0x198c3a[_0x4d4f('0x46')],_0x2939cb,'\x0a'),'customerid_contact@odata.bind':_0x54fd8d[_0x4d4f('0x30')]?_0x4d4f('0x47')+_0x54fd8d[_0x4d4f('0x30')]+')':undefined,'ownerid@odata.bind':_0x4d4f('0x2c')+_0x54fd8d[_0x4d4f('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x198c3a[_0x4d4f('0x48')],_0x2939cb,_0x198c3a['ticketType'])),'headers':{'Authorization':_0x4d4f('0x2d')+_0x290bdc,'OData-Version':_0x4d4f('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x198c3a['ticketType']===_0x4d4f('0x49')){var _0x4983d2=_0x54fd8d[_0x4d4f('0x30')]?[{'partyid_systemuser@odata.bind':_0x4d4f('0x2c')+_0x54fd8d['userId']+')','participationtypemask':_0x54fd8d[_0x4d4f('0x4a')]===_0x4d4f('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0x4d4f('0x47')+_0x54fd8d[_0x4d4f('0x30')]+')','participationtypemask':_0x54fd8d[_0x4d4f('0x4a')]===_0x4d4f('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x4d4f('0x2c')+_0x54fd8d[_0x4d4f('0x24')]+')','participationtypemask':_0x54fd8d[_0x4d4f('0x4a')]===_0x4d4f('0x4b')?0x2:0x1}];_0x351a1c={'method':_0x4d4f('0x13'),'uri':_0x231134+_0x4d4f('0x4c'),'body':Object['assign']({},{'subject':intUtil[_0x4d4f('0x44')](_0x198c3a['Subjects'],_0x2939cb,'\x20'),'phonenumber':String(_0x2939cb['calleridnum']),'description':intUtil['getString'](_0x198c3a[_0x4d4f('0x46')],_0x2939cb,'\x0a'),'regardingobjectid_contact@odata.bind':_0x54fd8d[_0x4d4f('0x30')]?'/contacts('+_0x54fd8d['enduserId']+')':undefined,'ownerid@odata.bind':_0x4d4f('0x2c')+_0x54fd8d[_0x4d4f('0x24')]+')','directioncode':_0x54fd8d['callDirection']===_0x4d4f('0x4b')?![]:!![],'phonecall_activity_parties':_0x4983d2},getCustomFields(_0x198c3a['Fields'],_0x2939cb,_0x198c3a[_0x4d4f('0x4d')])),'headers':{'Authorization':_0x4d4f('0x2d')+_0x290bdc,'OData-Version':_0x4d4f('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x351a1c);})[_0x4d4f('0x16')](function(_0x58b743){var _0x224b83=_0x58b743[_0x4d4f('0x4e')][_0x4d4f('0x4f')];var _0xf430b0=_0x224b83[_0x4d4f('0x2e')](_0x224b83['lastIndexOf']('(')+0x1,_0x224b83[_0x4d4f('0x2f')](')'));_0x54fd8d['ticketId']=_0xf430b0;_0x5f0d35(_0x54fd8d);})[_0x4d4f('0x18')](function(_0x4d7f8f){_0x29c065(_0x4d7f8f[_0x4d4f('0x1b')]);});});}function emit(_0xc23eb6,_0x57f4b3,_0x1c072d,_0x1d8ae6){var _0x4d08c8={'uri':util[_0x4d4f('0x50')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0xc23eb6,_0x1c072d,_0x1d8ae6)};io['to'](util[_0x4d4f('0x50')]('user:%s',_0x57f4b3))['emit'](_0x4d4f('0x51'),_0x4d08c8);}exports['cs']=function(_0x333a24,_0x23bf8e,_0x213cdb,_0x29a3a1,_0x57c928,_0x4aff5e,_0xeaccdd,_0x52641a){var _0x2c3bd4={};_0x4aff5e[_0x4d4f('0xc')]=_0x4aff5e[_0x4d4f('0xb')]?intUtil[_0x4d4f('0x52')](_0x4aff5e[_0x4d4f('0xd')][_0x4d4f('0xe')]):intUtil['stripTrailingSlash'](_0x4aff5e[_0x4d4f('0xc')]);_0x4aff5e[_0x4d4f('0x53')]=intUtil[_0x4d4f('0x52')](_0x4aff5e['serverUrl']);_0x2c3bd4[_0x4d4f('0x4a')]=_0x52641a===_0x4d4f('0x4b')||_0x52641a===_0x4d4f('0x54')?'queue':_0x4d4f('0x28');var _0x559189=_0x4aff5e[_0x4d4f('0xb')]?util[_0x4d4f('0x50')](_0x4d4f('0x55'),_0x4aff5e[_0x4d4f('0xd')][_0x4d4f('0xe')]):util[_0x4d4f('0x50')](_0x4d4f('0x55'),_0x4aff5e[_0x4d4f('0xc')]);var _0xa64ebd=util['format'](_0x4d4f('0x56'),_0x4aff5e[_0x4d4f('0xf')]);var _0x4907b6=util[_0x4d4f('0x50')](_0x4d4f('0x57'),_0x4aff5e[_0x4d4f('0x53')],_0x23bf8e[_0x4d4f('0x58')],md5(_0x23bf8e['uniqueid']));if(_0x57c928&&_0x57c928[_0x4d4f('0x59')]){logger[_0x4d4f('0x5a')]('[QUEUE]','Recording\x20is\x20enabled!');_0x23bf8e[_0x4d4f('0x5b')]=_0x4907b6;}else if(_0xeaccdd&&_0xeaccdd[_0x4d4f('0x5c')]&&_0xeaccdd['recordingFormat']!=='none'){logger['info'](_0x4d4f('0x5d'),_0x4d4f('0x5e'));_0x23bf8e['recordingURL']=_0x4907b6;}else{_0x23bf8e[_0x4d4f('0x5b')]='';}return getUser(_0x2c3bd4,_0x4aff5e,_0x29a3a1,_0xa64ebd,_0x559189,_0x52641a)[_0x4d4f('0x16')](function(_0x1259e1){logger[_0x4d4f('0x5a')]('['+_0x52641a[_0x4d4f('0x19')]()+_0x4d4f('0x5f'),_0x1259e1[_0x4d4f('0x24')]);logger[_0x4d4f('0x5a')]('['+_0x52641a['toUpperCase']()+_0x4d4f('0x60'),_0x1259e1['userEmail']);return getEndUser(_0x1259e1,_0x4aff5e,_0xa64ebd,_0x559189,_0x23bf8e,_0x52641a,_0x213cdb[_0x4d4f('0x61')],_0x213cdb[_0x4d4f('0x62')]);})[_0x4d4f('0x16')](function(_0x5d51f7){logger[_0x4d4f('0x5a')]('['+_0x52641a[_0x4d4f('0x19')]()+_0x4d4f('0x63'),_0x5d51f7[_0x4d4f('0x30')]);logger['info']('['+_0x52641a[_0x4d4f('0x19')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x23bf8e[_0x4d4f('0x2a')]);return getTicket(_0x5d51f7,_0x4aff5e,_0xa64ebd,_0x559189,_0x23bf8e,_0x213cdb,_0x52641a);})['then'](function(_0x525cf8){logger[_0x4d4f('0x5a')](util[_0x4d4f('0x50')]('['+_0x52641a['toUpperCase']()+_0x4d4f('0x64'),_0x213cdb['ticketType'],_0x525cf8[_0x4d4f('0x65')]));logger[_0x4d4f('0x5a')](util[_0x4d4f('0x50')]('['+_0x52641a[_0x4d4f('0x19')]()+']\x20Call\x20direction:\x20%s',_0x52641a));if(_0x52641a!==_0x4d4f('0x54')){logger[_0x4d4f('0x5a')]('['+_0x52641a[_0x4d4f('0x19')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4aff5e[_0x4d4f('0xc')],_0x29a3a1[_0x4d4f('0x66')],_0x213cdb[_0x4d4f('0x4d')],_0x525cf8[_0x4d4f('0x65')]);}})[_0x4d4f('0x18')](function(_0x3aae6d){logger['error']('['+_0x52641a['toUpperCase']()+_0x4d4f('0x67'),_0x3aae6d[_0x4d4f('0x1b')]);});}; \ No newline at end of file +var _0xfc5e=['substring','lastIndexOf','enduserId','destcalleridnum','contacts?$select=','\x20eq\x20\x27','replace','contactid',']\x20Enduser\x20created!','forEach','picklist','type','nameField','idField','indexOf','content','ticketType','incident','assign','getString','Descriptions','/contacts(','phonecall','callDirection','queue','phonecalls','Subjects','Fields','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','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','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','name',']\x20Error\x20running\x20Dynamics365\x20integration','request-promise','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','catch','toLowerCase','outbound','calleridnum','contacts','/systemusers(','4.0','body','headers','odata-entityid'];(function(_0x42fb06,_0xc8e815){var _0x5580ad=function(_0x4345ff){while(--_0x4345ff){_0x42fb06['push'](_0x42fb06['shift']());}};_0x5580ad(++_0xc8e815);}(_0xfc5e,0x9d));var _0xefc5=function(_0x339202,_0x33d46b){_0x339202=_0x339202-0x0;var _0x107c7b=_0xfc5e[_0x339202];return _0x107c7b;};'use strict';var _=require('lodash');var rp=require(_0xefc5('0x0'));var util=require('util');var intUtil=require(_0xefc5('0x1'));var md5=require('md5');var Redis=require(_0xefc5('0x2'));var logger=require(_0xefc5('0x3'))(_0xefc5('0x4'));var config=require(_0xefc5('0x5'));config['redis']=_[_0xefc5('0x6')](config[_0xefc5('0x7')],{'host':_0xefc5('0x8'),'port':0x18eb});var io=require(_0xefc5('0x9'))(new Redis(config[_0xefc5('0x7')]));function getAuthToken(_0x5d8151,_0x59beb1,_0x2a5527){if(_0x5d8151[_0xefc5('0xa')]){_0x5d8151[_0xefc5('0xb')]=_0x5d8151[_0xefc5('0xc')][_0xefc5('0xd')];_0x5d8151[_0xefc5('0xe')]=_0x5d8151[_0xefc5('0xc')][_0xefc5('0xf')];return Promise[_0xefc5('0x10')](_0x5d8151[_0xefc5('0xc')][_0xefc5('0x11')]);}var _0x3f3ce5={'method':_0xefc5('0x12'),'uri':_0x59beb1,'form':{'client_id':_0x5d8151[_0xefc5('0x13')],'resource':_0x5d8151[_0xefc5('0xb')],'username':_0x5d8151[_0xefc5('0x14')],'password':_0x5d8151['password'],'grant_type':_0xefc5('0x15'),'client_secret':_0x5d8151[_0xefc5('0x16')]},'json':!![]};return rp(_0x3f3ce5)[_0xefc5('0x17')](function(_0x5ba0bf){return _0x5ba0bf[_0xefc5('0x18')];})['catch'](function(_0x2e79c1){logger[_0xefc5('0x19')]('['+[_0x2a5527[_0xefc5('0x1a')]()]+_0xefc5('0x1b'));return _0x2e79c1[_0xefc5('0x1c')];});}function getUser(_0x35982b,_0xb08425,_0x18a717,_0x3841b5,_0x15363a,_0x28cf86){return new Promise(function(_0x3e0554,_0x1bb349){return getAuthToken(_0xb08425,_0x3841b5,_0x28cf86)['then'](function(_0x155b9a){var _0x2b294b={'method':_0xefc5('0x1d'),'uri':_0x15363a+_0xefc5('0x1e'),'headers':{'Authorization':_0xefc5('0x1f')+_0x155b9a,'OData-Version':'4.0'},'json':!![]};return rp(_0x2b294b);})[_0xefc5('0x17')](function(_0x38b0ef){var _0x111a57=_0x38b0ef[_0xefc5('0x20')];var _0x220337=![];var _0x21889a=null;if(!_[_0xefc5('0x21')](_0x18a717)){if(intUtil[_0xefc5('0x22')](_0x18a717[_0xefc5('0x23')])){_0x35982b[_0xefc5('0x24')]=_0x18a717['email'];for(_0x21889a=0x0;_0x21889a<_0x111a57[_0xefc5('0x25')];_0x21889a++){if(_0x111a57[_0x21889a][_0xefc5('0x26')]===_0x18a717['email']&&!_0x111a57[_0x21889a]['isdisabled']){_0x220337=!![];logger[_0xefc5('0x27')]('['+[_0x28cf86['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x111a57[_0x21889a][_0xefc5('0x28')]+'!');_0x35982b['userId']=_0x111a57[_0x21889a][_0xefc5('0x28')];}}}}if(!_0x220337){logger[_0xefc5('0x27')]('['+[_0x28cf86[_0xefc5('0x1a')]()]+_0xefc5('0x29'));_0x35982b[_0xefc5('0x24')]=_0xb08425['username'];for(_0x21889a=0x0;_0x21889a<_0x111a57[_0xefc5('0x25')];_0x21889a++){if(_0x111a57[_0x21889a][_0xefc5('0x26')]===_0xb08425[_0xefc5('0x14')]){_0x35982b[_0xefc5('0x2a')]=_0x111a57[_0x21889a][_0xefc5('0x28')];}}}_0x3e0554(_0x35982b);})[_0xefc5('0x2b')](function(_0xf9924a){_0x1bb349(_0xf9924a['message']);});});}function createEndUser(_0xf6ebba,_0xe4b484,_0x5c04f6,_0x270f29,_0x34db73,_0x1d863b,_0x457536){return new Promise(function(_0x2eb0a6,_0x3eb3f4){return getAuthToken(_0xe4b484,_0x5c04f6,_0x1d863b)[_0xefc5('0x17')](function(_0x3c3694){var _0x2b8b4a=_0x1d863b[_0xefc5('0x2c')]()===_0xefc5('0x2d')?_0x34db73['destcalleridnum']:_0x34db73[_0xefc5('0x2e')];var _0x5e6fdb={'method':_0xefc5('0x12'),'uri':_0x270f29+_0xefc5('0x2f'),'body':{'fullname':_0x2b8b4a,'firstname':_0x2b8b4a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xefc5('0x30')+_0xf6ebba[_0xefc5('0x2a')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x3c3694,'OData-Version':_0xefc5('0x31')},'json':!![],'resolveWithFullResponse':!![]};_0x5e6fdb[_0xefc5('0x32')][_0x457536]=_0x2b8b4a;return rp(_0x5e6fdb);})[_0xefc5('0x17')](function(_0x306d21){var _0x4cccea=_0x306d21[_0xefc5('0x33')][_0xefc5('0x34')];var _0x156c95=_0x4cccea[_0xefc5('0x35')](_0x4cccea['lastIndexOf']('(')+0x1,_0x4cccea[_0xefc5('0x36')](')'));_0xf6ebba[_0xefc5('0x37')]=_0x156c95;_0x2eb0a6(_0xf6ebba);})[_0xefc5('0x2b')](function(_0x40177e){_0x3eb3f4(_0x40177e['message']);});});}function getEndUser(_0xaba280,_0x17397d,_0x49ec62,_0x131a96,_0x1221ce,_0x411338,_0x45937d,_0x1526e7){var _0x628d4e=_0x411338['toLowerCase']()===_0xefc5('0x2d')?_0x1221ce[_0xefc5('0x38')]:_0x1221ce[_0xefc5('0x2e')];return getAuthToken(_0x17397d,_0x49ec62,_0x411338)[_0xefc5('0x17')](function(_0x10463a){_0x1526e7=_0x1526e7?_0x1526e7:'telephone1';var _0x547334={'method':_0xefc5('0x1d'),'uri':_0x131a96+_0xefc5('0x39')+_0x1526e7+'&$filter='+_0x1526e7+_0xefc5('0x3a')+_0x628d4e[_0xefc5('0x3b')]('+','%2b')+'\x27','headers':{'Authorization':_0xefc5('0x1f')+_0x10463a,'If-None-Match':null,'OData-Version':_0xefc5('0x31')},'json':!![]};return rp(_0x547334);})['then'](function(_0x2511e7){var _0x47dfdd=![];if(!_0x2511e7)return _0x47dfdd;var _0x4903b9=_0x2511e7[_0xefc5('0x20')];for(var _0x232c9e=0x0;_0x232c9e<_0x4903b9['length'];_0x232c9e++){if(_0x4903b9[_0x232c9e][_0x1526e7]===_0x628d4e){_0x47dfdd=!![];_0xaba280[_0xefc5('0x37')]=_0x4903b9[_0x232c9e][_0xefc5('0x3c')];}}return _0x47dfdd;})[_0xefc5('0x17')](function(_0x1685a9){if(_0x1685a9)return _0xaba280;if(_0x45937d==='nothing'){logger[_0xefc5('0x27')]('['+[_0x411338['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0xaba280;}return createEndUser(_0xaba280,_0x17397d,_0x49ec62,_0x131a96,_0x1221ce,_0x411338,_0x1526e7)[_0xefc5('0x17')](function(_0x93dd3d){logger[_0xefc5('0x27')]('['+[_0x411338[_0xefc5('0x1a')]()]+_0xefc5('0x3d'),_0x93dd3d['enduserId']);return _0x93dd3d;});});}function getCustomFields(_0x832e94,_0xa8613b,_0x1234c6){var _0x4b5794={};if(_0x832e94['length']>0x0){_[_0xefc5('0x3e')](_0x832e94,function(_0x58ec8f){if(_['includes'](['string',_0xefc5('0x3f')],_0x58ec8f[_0xefc5('0x40')])&&_0x58ec8f[_0xefc5('0x41')]&&!_0x58ec8f['customField']){var _0x5a5b68=_0x58ec8f[_0xefc5('0x42')][_0xefc5('0x2c')]();var _0x210484=_0x5a5b68['substring'](0x0,_0x5a5b68['indexOf']('_'));var _0x20c8dd=_0x5a5b68[_0xefc5('0x35')](_0x5a5b68[_0xefc5('0x43')]('_')+0x1);if(_0x210484===_0x1234c6){_0x4b5794[_0x20c8dd]=_0x58ec8f[_0xefc5('0x44')];}}});}return _0x4b5794;}function getTicket(_0xb2822b,_0xac0bbb,_0x3ca226,_0x525bfb,_0x1fa3a6,_0x1aeac2,_0x7b1109){return new Promise(function(_0x20aaf9,_0x21d984){var _0x562b1c;return getAuthToken(_0xac0bbb,_0x3ca226,_0x7b1109)[_0xefc5('0x17')](function(_0x2efae5){if(_0x1aeac2[_0xefc5('0x45')]===_0xefc5('0x46')){_0x562b1c={'method':_0xefc5('0x12'),'uri':_0x525bfb+'incidents','body':Object[_0xefc5('0x47')]({},{'title':intUtil['getString'](_0x1aeac2['Subjects'],_0x1fa3a6,'\x20'),'description':intUtil[_0xefc5('0x48')](_0x1aeac2[_0xefc5('0x49')],_0x1fa3a6,'\x0a'),'customerid_contact@odata.bind':_0xb2822b[_0xefc5('0x37')]?_0xefc5('0x4a')+_0xb2822b[_0xefc5('0x37')]+')':undefined,'ownerid@odata.bind':_0xefc5('0x30')+_0xb2822b[_0xefc5('0x2a')]+')','caseorigincode':'1'},getCustomFields(_0x1aeac2['Fields'],_0x1fa3a6,_0x1aeac2[_0xefc5('0x45')])),'headers':{'Authorization':_0xefc5('0x1f')+_0x2efae5,'OData-Version':_0xefc5('0x31')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1aeac2['ticketType']===_0xefc5('0x4b')){var _0x326700=_0xb2822b['enduserId']?[{'partyid_systemuser@odata.bind':_0xefc5('0x30')+_0xb2822b[_0xefc5('0x2a')]+')','participationtypemask':_0xb2822b[_0xefc5('0x4c')]===_0xefc5('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0xefc5('0x4a')+_0xb2822b[_0xefc5('0x37')]+')','participationtypemask':_0xb2822b[_0xefc5('0x4c')]===_0xefc5('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xefc5('0x30')+_0xb2822b['userId']+')','participationtypemask':_0xb2822b[_0xefc5('0x4c')]==='queue'?0x2:0x1}];_0x562b1c={'method':_0xefc5('0x12'),'uri':_0x525bfb+_0xefc5('0x4e'),'body':Object[_0xefc5('0x47')]({},{'subject':intUtil[_0xefc5('0x48')](_0x1aeac2[_0xefc5('0x4f')],_0x1fa3a6,'\x20'),'phonenumber':String(_0x1fa3a6[_0xefc5('0x2e')]),'description':intUtil['getString'](_0x1aeac2[_0xefc5('0x49')],_0x1fa3a6,'\x0a'),'regardingobjectid_contact@odata.bind':_0xb2822b[_0xefc5('0x37')]?'/contacts('+_0xb2822b[_0xefc5('0x37')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0xb2822b[_0xefc5('0x2a')]+')','directioncode':_0xb2822b[_0xefc5('0x4c')]===_0xefc5('0x4d')?![]:!![],'phonecall_activity_parties':_0x326700},getCustomFields(_0x1aeac2[_0xefc5('0x50')],_0x1fa3a6,_0x1aeac2['ticketType'])),'headers':{'Authorization':_0xefc5('0x1f')+_0x2efae5,'OData-Version':_0xefc5('0x31')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x562b1c);})['then'](function(_0x3e1ef3){var _0x2ae9d7=_0x3e1ef3[_0xefc5('0x33')][_0xefc5('0x34')];var _0x5169f9=_0x2ae9d7['substring'](_0x2ae9d7[_0xefc5('0x36')]('(')+0x1,_0x2ae9d7['lastIndexOf'](')'));_0xb2822b['ticketId']=_0x5169f9;_0x20aaf9(_0xb2822b);})[_0xefc5('0x2b')](function(_0x5601b6){_0x21d984(_0x5601b6[_0xefc5('0x1c')]);});});}function emit(_0x486f63,_0x5851cc,_0x19e7d1,_0x3d0647){var _0x18c391={'uri':util['format'](_0xefc5('0x51'),_0x486f63,_0x19e7d1,_0x3d0647)};io['to'](util[_0xefc5('0x52')](_0xefc5('0x53'),_0x5851cc))[_0xefc5('0x54')]('trigger:browser:url',_0x18c391);}exports['cs']=function(_0x412191,_0x297ad2,_0x1fee24,_0x11c402,_0x1162e1,_0x294e27,_0x1021e2,_0x3fc3b1){var _0x44b5bc={};_0x294e27[_0xefc5('0xb')]=_0x294e27[_0xefc5('0xa')]?intUtil['stripTrailingSlash'](_0x294e27[_0xefc5('0xc')][_0xefc5('0xd')]):intUtil[_0xefc5('0x55')](_0x294e27['remoteUri']);_0x294e27[_0xefc5('0x56')]=intUtil[_0xefc5('0x55')](_0x294e27[_0xefc5('0x56')]);_0x44b5bc[_0xefc5('0x4c')]=_0x3fc3b1===_0xefc5('0x4d')||_0x3fc3b1===_0xefc5('0x57')?_0xefc5('0x4d'):_0xefc5('0x2d');var _0x1a1535=_0x294e27['modernAuthentication']?util[_0xefc5('0x52')](_0xefc5('0x58'),_0x294e27[_0xefc5('0xc')][_0xefc5('0xd')]):util[_0xefc5('0x52')](_0xefc5('0x58'),_0x294e27[_0xefc5('0xb')]);var _0x3529db=util['format'](_0xefc5('0x59'),_0x294e27[_0xefc5('0xe')]);var _0x323542=util[_0xefc5('0x52')](_0xefc5('0x5a'),_0x294e27[_0xefc5('0x56')],_0x297ad2['uniqueid'],md5(_0x297ad2['uniqueid']));if(_0x1162e1&&_0x1162e1[_0xefc5('0x5b')]){logger['info'](_0xefc5('0x5c'),_0xefc5('0x5d'));_0x297ad2['recordingURL']=_0x323542;}else if(_0x1021e2&&_0x1021e2[_0xefc5('0x5e')]&&_0x1021e2[_0xefc5('0x5e')]!==_0xefc5('0x5f')){logger[_0xefc5('0x27')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x297ad2[_0xefc5('0x60')]=_0x323542;}else{_0x297ad2[_0xefc5('0x60')]='';}return getUser(_0x44b5bc,_0x294e27,_0x11c402,_0x3529db,_0x1a1535,_0x3fc3b1)[_0xefc5('0x17')](function(_0x422274){logger[_0xefc5('0x27')]('['+_0x3fc3b1[_0xefc5('0x1a')]()+']\x20The\x20User\x20ID\x20is:',_0x422274[_0xefc5('0x2a')]);logger['info']('['+_0x3fc3b1['toUpperCase']()+_0xefc5('0x61'),_0x422274[_0xefc5('0x24')]);return getEndUser(_0x422274,_0x294e27,_0x3529db,_0x1a1535,_0x297ad2,_0x3fc3b1,_0x1fee24['moduleCreate'],_0x1fee24[_0xefc5('0x62')]);})[_0xefc5('0x17')](function(_0x354698){logger['info']('['+_0x3fc3b1[_0xefc5('0x1a')]()+_0xefc5('0x63'),_0x354698[_0xefc5('0x37')]);logger[_0xefc5('0x27')]('['+_0x3fc3b1['toUpperCase']()+_0xefc5('0x64'),_0x297ad2['calleridnum']);return getTicket(_0x354698,_0x294e27,_0x3529db,_0x1a1535,_0x297ad2,_0x1fee24,_0x3fc3b1);})[_0xefc5('0x17')](function(_0x33795b){logger[_0xefc5('0x27')](util['format']('['+_0x3fc3b1[_0xefc5('0x1a')]()+_0xefc5('0x65'),_0x1fee24['ticketType'],_0x33795b[_0xefc5('0x66')]));logger[_0xefc5('0x27')](util['format']('['+_0x3fc3b1['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x3fc3b1));if(_0x3fc3b1!==_0xefc5('0x57')){logger[_0xefc5('0x27')]('['+_0x3fc3b1[_0xefc5('0x1a')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x294e27[_0xefc5('0xb')],_0x11c402[_0xefc5('0x67')],_0x1fee24[_0xefc5('0x45')],_0x33795b[_0xefc5('0x66')]);}})[_0xefc5('0x2b')](function(_0x3d5c2e){logger[_0xefc5('0x19')]('['+_0x3fc3b1['toUpperCase']()+_0xefc5('0x68'),_0x3d5c2e['message']);});}; \ 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 3284296..1a31c79 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 _0x790e=['idField','push','content','variableName','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\x20Enduser\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','trigger:browser:url','unmanaged','The\x20Ticket\x20ID\x20is:','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','type','nameField','customField','picklist'];(function(_0x289d28,_0x2e8ac5){var _0x2b0966=function(_0x4021d5){while(--_0x4021d5){_0x289d28['push'](_0x289d28['shift']());}};_0x2b0966(++_0x2e8ac5);}(_0x790e,0x125));var _0xe790=function(_0x19a58d,_0xb23e7f){_0x19a58d=_0x19a58d-0x0;var _0x1c559f=_0x790e[_0x19a58d];return _0x1c559f;};'use strict';var _=require(_0xe790('0x0'));var rp=require(_0xe790('0x1'));var md5=require(_0xe790('0x2'));var util=require(_0xe790('0x3'));var Redis=require(_0xe790('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xe790('0x5'))(_0xe790('0x6'));config[_0xe790('0x7')]=_[_0xe790('0x8')](config[_0xe790('0x7')],{'host':_0xe790('0x9'),'port':0x18eb});var io=require(_0xe790('0xa'))(new Redis(config[_0xe790('0x7')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0xcdea11,_0x5cf00d,_0x2f1a7d){io['to'](_0xcdea11)['emit'](_0x5cf00d,_0x2f1a7d);}function getTicket(_0x22f3e1,_0x21036a,_0x10fe18,_0x1b7d25,_0x2078e2){logger[_0xe790('0xb')]('Creating\x20new\x20ticket...');var _0x2f9096=_[_0xe790('0xc')]({'responder_id':_0x21036a['id'],'requester_id':_0x10fe18['id'],'name':util[_0xe790('0xd')](_0xe790('0xe'),_0x2078e2[_0xe790('0xf')]),'phone':_0x2078e2[_0xe790('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe790('0x11')](_0x1b7d25[_0xe790('0x12')],_0x2078e2,'\x20'),'description':intUtil['getString'](_0x1b7d25[_0xe790('0x13')],_0x2078e2,_0xe790('0x14')),'tags':getTags(_0x1b7d25[_0xe790('0x15')],'name')},getCustomFields(_0x1b7d25[_0xe790('0x16')],_0x2078e2));_0x2f9096[_0xe790('0x17')]=_[_0xe790('0x18')](_[_0xe790('0x19')](_0x2f9096[_0xe790('0x17')],'id'),'value');return request({'uri':util[_0xe790('0xd')](_0xe790('0x1a'),_0x22f3e1[_0xe790('0x1b')]),'method':_0xe790('0x1c'),'body':_0x2f9096})[_0xe790('0x1d')](function(_0x40ef42){logger[_0xe790('0xb')](_0xe790('0x1e'));return _0x40ef42;});}function getUser(_0x2aab31,_0x253b6){if(intUtil[_0xe790('0x1f')](_0x253b6)){return request({'uri':util['format'](_0xe790('0x20'),_0x2aab31['remoteUri']),'qs':{'email':_0x253b6}})[_0xe790('0x1d')](function(_0x3981f4){if(_0x3981f4[_0xe790('0x21')]){logger[_0xe790('0xb')](_0xe790('0x22'));return _[_0xe790('0x23')](_0x3981f4,function(_0x10bdae){return _0x10bdae['contact'][_0xe790('0x24')]===_0x253b6;});}else{logger[_0xe790('0xb')](_0xe790('0x25'));return request({'uri':util[_0xe790('0xd')](_0xe790('0x26'),_0x2aab31[_0xe790('0x1b')])})[_0xe790('0x1d')](function(_0x52330b){logger[_0xe790('0xb')]('Admin\x20account\x20selected.');return _0x52330b;});}});}else{logger[_0xe790('0xb')](_0xe790('0x27'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x2aab31['remoteUri'])})[_0xe790('0x1d')](function(_0x173ac9){logger[_0xe790('0xb')]('Admin\x20account\x20selected.');return _0x173ac9;});}}function getEndUser(_0xc2ebec,_0x1da0b7,_0x112dd3){logger[_0xe790('0xb')]('Searching\x20enduser\x20with\x20phone',_0x112dd3);return request({'uri':util[_0xe790('0xd')]('%s/api/v2/contacts',_0xc2ebec[_0xe790('0x1b')]),'qs':{'phone':_0x112dd3}})[_0xe790('0x1d')](function(_0x383791){if(_0x383791['length']){logger['info']('Enduser\x20found!');return _[_0xe790('0x23')](_0x383791,{'phone':_0x112dd3});}else{logger[_0xe790('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xe790('0x28'),_0xc2ebec[_0xe790('0x1b')]),'method':'POST','body':{'name':_0x1da0b7,'phone':_0x112dd3}})[_0xe790('0x1d')](function(_0x2c0968){logger[_0xe790('0xb')]('Enduser\x20created.');return _0x2c0968;});}});}function getAuth(_0xef75b4){return util['format']('Basic\x20%s',new Buffer(_0xef75b4['apiKey']+':X')[_0xe790('0x29')](_0xe790('0x2a')));}function request(_0x3273cb){logger[_0xe790('0x2b')](_0xe790('0x2c'),JSON[_0xe790('0x2d')](_0x3273cb));return rp(_['defaults'](_0x3273cb,{'method':_0xe790('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x191580,_0x323975){var _0xb27246=[];if(_0x191580&&_0x191580[_0xe790('0x21')]>0x0){_0xb27246=_[_0xe790('0x2f')](_0x191580,_0x323975);}return _0xb27246;}function getCustomFields(_0x9d29b5,_0x41f757){var _0x8c16bb=[];var _0x176e4c={'custom_fields':[]};if(_0x9d29b5[_0xe790('0x21')]>0x0){_[_0xe790('0x30')](_0x9d29b5,function(_0x1fab4f){if(_[_0xe790('0x31')]([_0xe790('0x32'),'picklist'],_0x1fab4f[_0xe790('0x33')])&&_0x1fab4f[_0xe790('0x34')]&&!_0x1fab4f[_0xe790('0x35')]){_0x176e4c[_0x1fab4f[_0xe790('0x34')]['toLowerCase']()]=_0x1fab4f['content'][_0xe790('0x29')]();}else if(_['includes']([_0xe790('0x32'),_0xe790('0x36')],_0x1fab4f[_0xe790('0x33')])&&_0x1fab4f[_0xe790('0x37')]&&_0x1fab4f[_0xe790('0x35')]){_0x176e4c[_0xe790('0x17')][_0xe790('0x38')]({'id':_0x1fab4f['idField'],'value':_0x1fab4f[_0xe790('0x39')][_0xe790('0x29')]()});}else if(_0x1fab4f[_0xe790('0x33')]==='variable'&&_0x1fab4f[_0xe790('0x3a')]&&_0x1fab4f[_0xe790('0x37')]&&_0x1fab4f[_0xe790('0x35')]){_0x41f757[_0x1fab4f[_0xe790('0x3a')]]&&_0x176e4c[_0xe790('0x17')][_0xe790('0x38')]({'id':_0x1fab4f['idField'],'value':_0x41f757[_0x1fab4f[_0xe790('0x3a')]][_0xe790('0x29')]()});}else if(_0x1fab4f[_0xe790('0x33')]==='customVariable'&&_0x1fab4f[_0xe790('0x3b')]&&_0x1fab4f[_0xe790('0x3b')][_0xe790('0x3c')]&&_0x1fab4f[_0xe790('0x37')]&&_0x1fab4f[_0xe790('0x35')]){_0x41f757[_0x1fab4f[_0xe790('0x3b')][_0xe790('0x3c')]['toLowerCase']()]&&_0x176e4c[_0xe790('0x17')][_0xe790('0x38')]({'id':_0x1fab4f['idField'],'value':_0x41f757[_0x1fab4f['Variable']['name']['toLowerCase']()][_0xe790('0x29')]()});}});}return _0x176e4c;}exports[_0xe790('0x3d')]=function(_0x3d64bc,_0x2a131e,_0x58f3e9,_0x5c820a,_0x5e2f42,_0x3f9fa2){var _0x5bb5a6,_0x3f4094;_0x3f9fa2['remoteUri']=intUtil[_0xe790('0x3e')](_0x3f9fa2[_0xe790('0x1b')]);_0x3f9fa2[_0xe790('0x3f')]=intUtil['stripTrailingSlash'](_0x3f9fa2[_0xe790('0x3f')]);if(_0x5e2f42&&_0x5e2f42[_0xe790('0x40')]){logger[_0xe790('0xb')](_0xe790('0x41'),_0xe790('0x42'));_0x2a131e[_0xe790('0x43')]=util[_0xe790('0xd')](_0xe790('0x44'),_0x3f9fa2[_0xe790('0x3f')],_0x2a131e[_0xe790('0x45')],md5(_0x2a131e[_0xe790('0x45')]));}else{_0x2a131e[_0xe790('0x43')]='';}headers[_0xe790('0x46')]=getAuth(_0x3f9fa2);return getUser(_0x3f9fa2,_0x5c820a[_0xe790('0x24')])[_0xe790('0x1d')](function(_0x3f0759){_0x5bb5a6=_0x3f0759;logger['info']('The\x20User\x20ID\x20is:',_0x5bb5a6['id']);return getEndUser(_0x3f9fa2,_0x2a131e['calleridname'],_0x2a131e['calleridnum']);})['then'](function(_0x6deedd){_0x3f4094=_0x6deedd;logger[_0xe790('0xb')](_0xe790('0x47'),_0x3f4094['id']);return getTicket(_0x3f9fa2,_0x5bb5a6,_0x3f4094,_0x58f3e9,_0x2a131e);})[_0xe790('0x1d')](function(_0x5881a2){if(_0x5881a2&&_0x5881a2['id']){logger[_0xe790('0xb')](_0xe790('0x1e'));logger[_0xe790('0xb')]('The\x20Ticket\x20ID\x20is:',_0x5881a2['id']);logger[_0xe790('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe790('0xd')](_0xe790('0x48'),_0x5c820a[_0xe790('0x3c')]),'trigger:browser:url',{'uri':util[_0xe790('0xd')](_0xe790('0x49'),_0x3f9fa2[_0xe790('0x1b')],_0x5881a2['id'])});}})[_0xe790('0x4a')](function(_0x5f5b76){logger[_0xe790('0x4b')](_0xe790('0x41'),JSON[_0xe790('0x2d')](_0x5f5b76));});};exports[_0xe790('0x4c')]=function(_0x55ab39,_0x7f4963,_0x81e1ec,_0x3b5346,_0x4d98be,_0x1f9367,_0x1b2c48){var _0x42f97c,_0x1b92cb;_0x1f9367[_0xe790('0x1b')]=intUtil[_0xe790('0x3e')](_0x1f9367[_0xe790('0x1b')]);_0x1f9367[_0xe790('0x3f')]=intUtil[_0xe790('0x3e')](_0x1f9367[_0xe790('0x3f')]);if(_0x1b2c48&&_0x1b2c48[_0xe790('0x4d')]&&_0x1b2c48[_0xe790('0x4d')]!==_0xe790('0x4e')){logger[_0xe790('0xb')](_0xe790('0x4f'),_0xe790('0x42'));_0x7f4963[_0xe790('0x43')]=util[_0xe790('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1f9367[_0xe790('0x3f')],_0x7f4963[_0xe790('0x45')],md5(_0x7f4963[_0xe790('0x45')]));}headers[_0xe790('0x46')]=getAuth(_0x1f9367);return getUser(_0x1f9367,_0x3b5346['email'])[_0xe790('0x1d')](function(_0x2b7d40){_0x42f97c=_0x2b7d40;logger[_0xe790('0xb')](_0xe790('0x50'),_0x42f97c['id']);return getEndUser(_0x1f9367,_0x7f4963['destcalleridname'],_0x7f4963[_0xe790('0x51')]);})[_0xe790('0x1d')](function(_0x594e2e){_0x1b92cb=_0x594e2e;logger[_0xe790('0xb')](_0xe790('0x47'),_0x1b92cb['id']);return getTicket(_0x1f9367,_0x42f97c,_0x1b92cb,_0x81e1ec,_0x7f4963);})['then'](function(_0x232839){if(_0x232839&&_0x232839['id']){logger[_0xe790('0xb')](_0xe790('0x1e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x232839['id']);logger[_0xe790('0xb')](_0xe790('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x3b5346[_0xe790('0x3c')]),_0xe790('0x52'),{'uri':util[_0xe790('0xd')](_0xe790('0x49'),_0x1f9367[_0xe790('0x1b')],_0x232839['id'])});}})['catch'](function(_0x32f3eb){logger['error'](_0xe790('0x4f'),JSON[_0xe790('0x2d')](_0x32f3eb));});};exports[_0xe790('0x53')]=function(_0x1e9742,_0x162740,_0x5b5044,_0x54a9f0,_0x4166a1,_0x42841e){var _0xea001e,_0x16446b;_0x42841e[_0xe790('0x1b')]=intUtil[_0xe790('0x3e')](_0x42841e[_0xe790('0x1b')]);_0x42841e[_0xe790('0x3f')]=intUtil[_0xe790('0x3e')](_0x42841e[_0xe790('0x3f')]);if(_0x4166a1&&_0x4166a1[_0xe790('0x40')]){logger[_0xe790('0xb')]('['+_0x162740['lastevent']['toUpperCase']()+']',_0xe790('0x42'));_0x162740[_0xe790('0x43')]=util[_0xe790('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x42841e[_0xe790('0x3f')],_0x162740['uniqueid'],md5(_0x162740[_0xe790('0x45')]));}else{_0x162740[_0xe790('0x43')]='';}headers[_0xe790('0x46')]=getAuth(_0x42841e);return getUser(_0x42841e,'')[_0xe790('0x1d')](function(_0x123da5){_0xea001e=_0x123da5;logger['info'](_0xe790('0x50'),_0xea001e['id']);return getEndUser(_0x42841e,_0x162740['calleridname'],_0x162740[_0xe790('0x10')]);})[_0xe790('0x1d')](function(_0xe30f3b){_0x16446b=_0xe30f3b;logger[_0xe790('0xb')]('The\x20Enduser\x20ID\x20is:',_0x16446b['id']);return getTicket(_0x42841e,_0xea001e,_0x16446b,_0x5b5044,_0x162740);})[_0xe790('0x1d')](function(_0x31c0e7){if(_0x31c0e7){logger[_0xe790('0xb')](_0xe790('0x1e'));logger[_0xe790('0xb')](_0xe790('0x54'),_0x31c0e7['id']);}})[_0xe790('0x4a')](function(_0x1c17f3){logger[_0xe790('0x4b')]('['+_0x162740[_0xe790('0x55')][_0xe790('0x56')]()+']',JSON[_0xe790('0x2d')](_0x1c17f3));});}; \ No newline at end of file +var _0xeeed=['Authorization','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','lastevent','calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Descriptions','
','Tags','name','Fields','mapValues','keyBy','custom_fields','%s/api/v2/tickets','remoteUri','POST','then','validateEmail','length','find','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','stringify','defaults','GET','forEach','includes','string','picklist','type','nameField','idField','push','content','variable','customField','variableName','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xeeed,0x128));var _0xdeee=function(_0x3fbf66,_0x3968c2){_0x3fbf66=_0x3fbf66-0x0;var _0x3d61af=_0xeeed[_0x3fbf66];return _0x3d61af;};'use strict';var _=require(_0xdeee('0x0'));var rp=require(_0xdeee('0x1'));var md5=require(_0xdeee('0x2'));var util=require(_0xdeee('0x3'));var Redis=require(_0xdeee('0x4'));var intUtil=require(_0xdeee('0x5'));var config=require('../../../../config/environment');var logger=require(_0xdeee('0x6'))(_0xdeee('0x7'));config[_0xdeee('0x8')]=_['defaults'](config[_0xdeee('0x8')],{'host':_0xdeee('0x9'),'port':0x18eb});var io=require(_0xdeee('0xa'))(new Redis(config[_0xdeee('0x8')]));var headers={'Content-Type':_0xdeee('0xb'),'Accept':'application/json'};function emit(_0x3e15e3,_0x2de884,_0x176051){io['to'](_0x3e15e3)[_0xdeee('0xc')](_0x2de884,_0x176051);}function getTicket(_0x2c7dbb,_0x2f4feb,_0x51c25d,_0x22ce91,_0x45775b){logger[_0xdeee('0xd')](_0xdeee('0xe'));var _0x1ff8e9=_[_0xdeee('0xf')]({'responder_id':_0x2f4feb['id'],'requester_id':_0x51c25d['id'],'name':util[_0xdeee('0x10')](_0xdeee('0x11'),_0x45775b['calleridname']),'phone':_0x45775b[_0xdeee('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xdeee('0x13')](_0x22ce91['Subjects'],_0x45775b,'\x20'),'description':intUtil['getString'](_0x22ce91[_0xdeee('0x14')],_0x45775b,_0xdeee('0x15')),'tags':getTags(_0x22ce91[_0xdeee('0x16')],_0xdeee('0x17'))},getCustomFields(_0x22ce91[_0xdeee('0x18')],_0x45775b));_0x1ff8e9['custom_fields']=_[_0xdeee('0x19')](_[_0xdeee('0x1a')](_0x1ff8e9[_0xdeee('0x1b')],'id'),'value');return request({'uri':util[_0xdeee('0x10')](_0xdeee('0x1c'),_0x2c7dbb[_0xdeee('0x1d')]),'method':_0xdeee('0x1e'),'body':_0x1ff8e9})[_0xdeee('0x1f')](function(_0x283859){logger[_0xdeee('0xd')]('Ticket\x20created!');return _0x283859;});}function getUser(_0xc66205,_0x41e099){if(intUtil[_0xdeee('0x20')](_0x41e099)){return request({'uri':util[_0xdeee('0x10')]('%s/api/v2/agents',_0xc66205[_0xdeee('0x1d')]),'qs':{'email':_0x41e099}})[_0xdeee('0x1f')](function(_0x28279c){if(_0x28279c[_0xdeee('0x21')]){logger[_0xdeee('0xd')]('Agent\x20found!');return _[_0xdeee('0x22')](_0x28279c,function(_0x29618a){return _0x29618a['contact'][_0xdeee('0x23')]===_0x41e099;});}else{logger[_0xdeee('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xdeee('0x10')](_0xdeee('0x24'),_0xc66205[_0xdeee('0x1d')])})[_0xdeee('0x1f')](function(_0x5bdf8c){logger[_0xdeee('0xd')](_0xdeee('0x25'));return _0x5bdf8c;});}});}else{logger[_0xdeee('0xd')](_0xdeee('0x26'));return request({'uri':util[_0xdeee('0x10')](_0xdeee('0x24'),_0xc66205[_0xdeee('0x1d')])})[_0xdeee('0x1f')](function(_0x35b640){logger[_0xdeee('0xd')](_0xdeee('0x25'));return _0x35b640;});}}function getEndUser(_0x2c2229,_0x1eecb6,_0x128510){logger[_0xdeee('0xd')]('Searching\x20enduser\x20with\x20phone',_0x128510);return request({'uri':util['format']('%s/api/v2/contacts',_0x2c2229['remoteUri']),'qs':{'phone':_0x128510}})['then'](function(_0x53d735){if(_0x53d735[_0xdeee('0x21')]){logger['info'](_0xdeee('0x27'));return _[_0xdeee('0x22')](_0x53d735,{'phone':_0x128510});}else{logger[_0xdeee('0xd')](_0xdeee('0x28'));return request({'uri':util[_0xdeee('0x10')](_0xdeee('0x29'),_0x2c2229[_0xdeee('0x1d')]),'method':_0xdeee('0x1e'),'body':{'name':_0x1eecb6,'phone':_0x128510}})[_0xdeee('0x1f')](function(_0x36a748){logger[_0xdeee('0xd')](_0xdeee('0x2a'));return _0x36a748;});}});}function getAuth(_0x501c5f){return util[_0xdeee('0x10')](_0xdeee('0x2b'),new Buffer(_0x501c5f[_0xdeee('0x2c')]+':X')[_0xdeee('0x2d')](_0xdeee('0x2e')));}function request(_0x220c1e){logger['debug']('[HTTP]',JSON[_0xdeee('0x2f')](_0x220c1e));return rp(_[_0xdeee('0x30')](_0x220c1e,{'method':_0xdeee('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x4e3258,_0x332254){var _0x3b31a6=[];if(_0x4e3258&&_0x4e3258[_0xdeee('0x21')]>0x0){_0x3b31a6=_['map'](_0x4e3258,_0x332254);}return _0x3b31a6;}function getCustomFields(_0x379a6e,_0x55dd3f){var _0x3779a6=[];var _0x35e7e0={'custom_fields':[]};if(_0x379a6e[_0xdeee('0x21')]>0x0){_[_0xdeee('0x32')](_0x379a6e,function(_0xadd63f){if(_[_0xdeee('0x33')]([_0xdeee('0x34'),_0xdeee('0x35')],_0xadd63f[_0xdeee('0x36')])&&_0xadd63f[_0xdeee('0x37')]&&!_0xadd63f['customField']){_0x35e7e0[_0xadd63f['nameField']['toLowerCase']()]=_0xadd63f['content'][_0xdeee('0x2d')]();}else if(_['includes'](['string',_0xdeee('0x35')],_0xadd63f[_0xdeee('0x36')])&&_0xadd63f[_0xdeee('0x38')]&&_0xadd63f['customField']){_0x35e7e0[_0xdeee('0x1b')][_0xdeee('0x39')]({'id':_0xadd63f['idField'],'value':_0xadd63f[_0xdeee('0x3a')]['toString']()});}else if(_0xadd63f[_0xdeee('0x36')]===_0xdeee('0x3b')&&_0xadd63f['variableName']&&_0xadd63f[_0xdeee('0x38')]&&_0xadd63f[_0xdeee('0x3c')]){_0x55dd3f[_0xadd63f[_0xdeee('0x3d')]]&&_0x35e7e0[_0xdeee('0x1b')][_0xdeee('0x39')]({'id':_0xadd63f[_0xdeee('0x38')],'value':_0x55dd3f[_0xadd63f[_0xdeee('0x3d')]]['toString']()});}else if(_0xadd63f[_0xdeee('0x36')]==='customVariable'&&_0xadd63f[_0xdeee('0x3e')]&&_0xadd63f[_0xdeee('0x3e')][_0xdeee('0x17')]&&_0xadd63f[_0xdeee('0x38')]&&_0xadd63f['customField']){_0x55dd3f[_0xadd63f[_0xdeee('0x3e')][_0xdeee('0x17')][_0xdeee('0x3f')]()]&&_0x35e7e0['custom_fields'][_0xdeee('0x39')]({'id':_0xadd63f[_0xdeee('0x38')],'value':_0x55dd3f[_0xadd63f['Variable'][_0xdeee('0x17')]['toLowerCase']()][_0xdeee('0x2d')]()});}});}return _0x35e7e0;}exports['queue']=function(_0x39cd9c,_0x154418,_0x5d27a1,_0x2c837a,_0x4db974,_0x55a614){var _0x49432a,_0x5f1cad;_0x55a614['remoteUri']=intUtil[_0xdeee('0x40')](_0x55a614[_0xdeee('0x1d')]);_0x55a614['serverUrl']=intUtil['stripTrailingSlash'](_0x55a614[_0xdeee('0x41')]);if(_0x4db974&&_0x4db974[_0xdeee('0x42')]){logger['info'](_0xdeee('0x43'),_0xdeee('0x44'));_0x154418[_0xdeee('0x45')]=util[_0xdeee('0x10')](_0xdeee('0x46'),_0x55a614[_0xdeee('0x41')],_0x154418[_0xdeee('0x47')],md5(_0x154418[_0xdeee('0x47')]));}else{_0x154418['recordingURL']='';}headers[_0xdeee('0x48')]=getAuth(_0x55a614);return getUser(_0x55a614,_0x2c837a['email'])[_0xdeee('0x1f')](function(_0x2f0c63){_0x49432a=_0x2f0c63;logger[_0xdeee('0xd')](_0xdeee('0x49'),_0x49432a['id']);return getEndUser(_0x55a614,_0x154418['calleridname'],_0x154418['calleridnum']);})[_0xdeee('0x1f')](function(_0x41e1ef){_0x5f1cad=_0x41e1ef;logger[_0xdeee('0xd')]('The\x20Enduser\x20ID\x20is:',_0x5f1cad['id']);return getTicket(_0x55a614,_0x49432a,_0x5f1cad,_0x5d27a1,_0x154418);})[_0xdeee('0x1f')](function(_0x2f94f6){if(_0x2f94f6&&_0x2f94f6['id']){logger['info'](_0xdeee('0x4a'));logger['info'](_0xdeee('0x4b'),_0x2f94f6['id']);logger[_0xdeee('0xd')]('[QUEUE]',_0xdeee('0x4c'));emit(util['format'](_0xdeee('0x4d'),_0x2c837a['name']),_0xdeee('0x4e'),{'uri':util[_0xdeee('0x10')](_0xdeee('0x4f'),_0x55a614[_0xdeee('0x1d')],_0x2f94f6['id'])});}})[_0xdeee('0x50')](function(_0xbf1b94){logger[_0xdeee('0x51')]('[QUEUE]',JSON[_0xdeee('0x2f')](_0xbf1b94));});};exports[_0xdeee('0x52')]=function(_0x480501,_0x2efbb2,_0x525fcf,_0x354337,_0x574575,_0x440420,_0xf4776e){var _0x2d7792,_0x442346;_0x440420['remoteUri']=intUtil[_0xdeee('0x40')](_0x440420[_0xdeee('0x1d')]);_0x440420[_0xdeee('0x41')]=intUtil[_0xdeee('0x40')](_0x440420['serverUrl']);if(_0xf4776e&&_0xf4776e[_0xdeee('0x53')]&&_0xf4776e[_0xdeee('0x53')]!==_0xdeee('0x54')){logger['info'](_0xdeee('0x55'),'Recording\x20is\x20enabled!');_0x2efbb2[_0xdeee('0x45')]=util['format'](_0xdeee('0x46'),_0x440420[_0xdeee('0x41')],_0x2efbb2[_0xdeee('0x47')],md5(_0x2efbb2['uniqueid']));}headers[_0xdeee('0x48')]=getAuth(_0x440420);return getUser(_0x440420,_0x354337[_0xdeee('0x23')])[_0xdeee('0x1f')](function(_0x4aeee7){_0x2d7792=_0x4aeee7;logger[_0xdeee('0xd')]('The\x20User\x20ID\x20is:',_0x2d7792['id']);return getEndUser(_0x440420,_0x2efbb2[_0xdeee('0x56')],_0x2efbb2[_0xdeee('0x57')]);})[_0xdeee('0x1f')](function(_0x319c7e){_0x442346=_0x319c7e;logger[_0xdeee('0xd')](_0xdeee('0x58'),_0x442346['id']);return getTicket(_0x440420,_0x2d7792,_0x442346,_0x525fcf,_0x2efbb2);})[_0xdeee('0x1f')](function(_0x194bb6){if(_0x194bb6&&_0x194bb6['id']){logger[_0xdeee('0xd')]('Ticket\x20created!');logger[_0xdeee('0xd')](_0xdeee('0x4b'),_0x194bb6['id']);logger[_0xdeee('0xd')](_0xdeee('0x55'),_0xdeee('0x4c'));emit(util[_0xdeee('0x10')](_0xdeee('0x4d'),_0x354337['name']),'trigger:browser:url',{'uri':util[_0xdeee('0x10')](_0xdeee('0x4f'),_0x440420[_0xdeee('0x1d')],_0x194bb6['id'])});}})['catch'](function(_0x1b90a1){logger[_0xdeee('0x51')](_0xdeee('0x55'),JSON[_0xdeee('0x2f')](_0x1b90a1));});};exports['unmanaged']=function(_0x4b9891,_0x2236b9,_0x288ada,_0xecc447,_0x1ff0c1,_0x48e170){var _0x24c0c9,_0x38c447;_0x48e170[_0xdeee('0x1d')]=intUtil[_0xdeee('0x40')](_0x48e170['remoteUri']);_0x48e170[_0xdeee('0x41')]=intUtil[_0xdeee('0x40')](_0x48e170[_0xdeee('0x41')]);if(_0x1ff0c1&&_0x1ff0c1[_0xdeee('0x42')]){logger[_0xdeee('0xd')]('['+_0x2236b9[_0xdeee('0x59')]['toUpperCase']()+']',_0xdeee('0x44'));_0x2236b9[_0xdeee('0x45')]=util[_0xdeee('0x10')](_0xdeee('0x46'),_0x48e170[_0xdeee('0x41')],_0x2236b9[_0xdeee('0x47')],md5(_0x2236b9[_0xdeee('0x47')]));}else{_0x2236b9[_0xdeee('0x45')]='';}headers[_0xdeee('0x48')]=getAuth(_0x48e170);return getUser(_0x48e170,'')[_0xdeee('0x1f')](function(_0x50b431){_0x24c0c9=_0x50b431;logger[_0xdeee('0xd')]('The\x20User\x20ID\x20is:',_0x24c0c9['id']);return getEndUser(_0x48e170,_0x2236b9[_0xdeee('0x5a')],_0x2236b9[_0xdeee('0x12')]);})[_0xdeee('0x1f')](function(_0x24522f){_0x38c447=_0x24522f;logger[_0xdeee('0xd')](_0xdeee('0x58'),_0x38c447['id']);return getTicket(_0x48e170,_0x24c0c9,_0x38c447,_0x288ada,_0x2236b9);})[_0xdeee('0x1f')](function(_0x3f86f2){if(_0x3f86f2){logger[_0xdeee('0xd')](_0xdeee('0x4a'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x3f86f2['id']);}})['catch'](function(_0x343269){logger[_0xdeee('0x51')]('['+_0x2236b9[_0xdeee('0x59')][_0xdeee('0x5b')]()+']',JSON['stringify'](_0x343269));});}; \ 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 fb007be..7e91acf 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 _0x0baa=['username','toLowerCase','destcalleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','catch','&entities=contact','find','contacts','format','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','POST','getString','Subjects','Descriptions','Contact','add','task','Task\x20created:','ticketId','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x0baa,0x158));var _0xa0ba=function(_0x4c46f2,_0x2245e0){_0x4c46f2=_0x4c46f2-0x0;var _0x56a445=_0x0baa[_0x4c46f2];return _0x56a445;};'use strict';var _=require(_0xa0ba('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xa0ba('0x1'));var moment=require(_0xa0ba('0x2'));var Promise=require(_0xa0ba('0x3'));var Redis=require('ioredis');var intUtil=require(_0xa0ba('0x4'));var config=require(_0xa0ba('0x5'));var logger=require(_0xa0ba('0x6'))('freshsales');config[_0xa0ba('0x7')]=_[_0xa0ba('0x8')](config[_0xa0ba('0x7')],{'host':_0xa0ba('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa0ba('0x7')]));function getAdminId(_0x391754,_0x120d3c,_0x40298c,_0x43a417){return new Promise(function(_0x503139,_0x47d991){var _0x12a664=![];var _0x178f6b={'method':_0xa0ba('0xa'),'uri':_0x43a417+_0xa0ba('0xb'),'json':!![]};_0x178f6b[_0xa0ba('0xc')]=_0x40298c;logger[_0xa0ba('0xd')](_0xa0ba('0xe'));return rp(_0x178f6b)[_0xa0ba('0xf')](function(_0x5cec62){if(_0x5cec62){var _0x2ad739=_0x5cec62[_0xa0ba('0x10')];var _0x9122b2=null;for(_0x9122b2=0x0;_0x9122b2<_0x2ad739[_0xa0ba('0x11')];_0x9122b2++){if(_0x2ad739[_0x9122b2]['email']===_0x391754[_0xa0ba('0x12')]){_0x391754[_0xa0ba('0x13')]=_0x2ad739[_0x9122b2]['id'];_0x12a664=!![];}}if(_0x12a664){logger[_0xa0ba('0xd')]('Admin\x20found:',_0x391754[_0xa0ba('0x13')]);_0x503139(_0x391754);}else{_0x47d991({'statusCode':0x194,'message':_0xa0ba('0x14')});}}else{_0x47d991({'statusCode':0x194,'message':_0xa0ba('0x14')});}})['catch'](function(_0x110a4e){logger[_0xa0ba('0x15')]('['+[_0x120d3c[_0xa0ba('0x16')]()]+']',_0x110a4e[_0xa0ba('0x17')]);_0x47d991(_0x110a4e);});});}function getUser(_0x1d4372,_0x4e5d60,_0x10aec1){return function(_0x3cd474){return new Promise(function(_0x1138a6,_0x48bf4c){var _0xb12ba1={'method':'GET','uri':_0x10aec1+'/api/selector/owners','json':!![]};_0xb12ba1[_0xa0ba('0xc')]=_0x4e5d60;logger[_0xa0ba('0xd')]('Getting\x20user\x20list');return rp(_0xb12ba1)[_0xa0ba('0xf')](function(_0x33815e){if(_0x33815e){var _0x3ef86e=_0x33815e['users'];var _0x46ec3c=![];var _0x2f4b6e=null;if(_0x3cd474[_0xa0ba('0x18')]!==null){logger[_0xa0ba('0xd')](_0xa0ba('0x19'),_0x3cd474[_0xa0ba('0x18')]);_0x3cd474['userEmail']=_0x3cd474['agentEmail'];for(_0x2f4b6e=0x0;_0x2f4b6e<_0x3ef86e[_0xa0ba('0x11')];_0x2f4b6e++){if(_0x3ef86e[_0x2f4b6e]['email']===_0x3cd474[_0xa0ba('0x18')]){_0x46ec3c=!![];_0x3cd474[_0xa0ba('0x1a')]=_0x3ef86e[_0x2f4b6e]['id'];logger[_0xa0ba('0xd')](_0xa0ba('0x1b'),_0x3cd474['userId']);}}}if(!_0x46ec3c){logger['info'](_0xa0ba('0x1c'));_0x3cd474[_0xa0ba('0x1d')]=_0x3cd474[_0xa0ba('0x12')];_0x3cd474[_0xa0ba('0x1a')]=_0x3cd474[_0xa0ba('0x13')];_0x46ec3c=!![];}if(_0x46ec3c){_0x1138a6(_0x3cd474);}else{_0x48bf4c({'statusCode':0x194,'message':_0xa0ba('0x14')});}}else{_0x48bf4c({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xa0ba('0x1e')](function(_0x4f0027){logger[_0xa0ba('0x15')]('['+[_0x1d4372['toUpperCase']()]+']',_0x4f0027[_0xa0ba('0x17')]);_0x48bf4c(_0x4f0027);});});};}function searchContact(_0x1c7add,_0x176d9e,_0xf6c699,_0x267720){return new Promise(function(_0x213193,_0x53da0e){var _0x36ba52={'method':_0xa0ba('0xa'),'headers':_0x176d9e,'uri':_0x1c7add+'/api/lookup?q='+_0x267720+'&f='+_0xf6c699+_0xa0ba('0x1f'),'json':!![]};rp(_0x36ba52)[_0xa0ba('0xf')](function(_0x9fc715){var _0x1cff5d=_[_0xa0ba('0x20')](_0x9fc715[_0xa0ba('0x21')][_0xa0ba('0x21')],[_0xf6c699,_0x267720]);_0x213193(_0x1cff5d);})[_0xa0ba('0x1e')](function(_0x219067){_0x53da0e(_0x219067);});});}function getEndUser(_0x3ddfb2,_0x358cbc,_0x3db9b9){return function(_0x5091c6){return new Promise(function(_0x107438,_0x8e3e28){logger[_0xa0ba('0xd')](util[_0xa0ba('0x22')]('Searching\x20contact\x20with\x20phone\x20%s',_0x5091c6['contactNumber']));searchContact(_0x3db9b9,_0x358cbc,_0xa0ba('0x23'),_0x5091c6[_0xa0ba('0x24')])['then'](function(_0x3b9377){if(_0x3b9377){_0x5091c6[_0xa0ba('0x25')]=_0x3b9377['id'];logger[_0xa0ba('0xd')](_0xa0ba('0x26'),_0x5091c6[_0xa0ba('0x25')]);return _0x107438(_0x5091c6);}searchContact(_0x3db9b9,_0x358cbc,'work_number',_0x5091c6[_0xa0ba('0x24')])['then'](function(_0x220f9e){if(_0x220f9e){_0x5091c6[_0xa0ba('0x25')]=_0x220f9e['id'];logger[_0xa0ba('0xd')](_0xa0ba('0x27'),_0x5091c6[_0xa0ba('0x25')]);return _0x107438(_0x5091c6);}createEndUser(_0x5091c6,_0x3ddfb2,_0x358cbc,_0x3db9b9)[_0xa0ba('0xf')](function(_0x209ab7){logger['info'](_0xa0ba('0x28'),_0x209ab7[_0xa0ba('0x25')]);return _0x107438(_0x209ab7);});});})[_0xa0ba('0x1e')](function(_0xc42f55){_0x8e3e28(_0xc42f55);});});};}function createEndUser(_0x68b99,_0xaf5898,_0x322602,_0x1eb0ea){return new Promise(function(_0x3a8610,_0xae9f88){var _0x4bf963=moment();var _0x51c67a={'method':'POST','uri':_0x1eb0ea+'/api/contacts','body':{'contact':{'last_name':_0x68b99[_0xa0ba('0x24')],'work_number':_0x68b99[_0xa0ba('0x24')],'mobile_number':_0x68b99[_0xa0ba('0x24')],'owner_id':_0x68b99[_0xa0ba('0x1a')],'created_at':_0x4bf963['format'](_0xa0ba('0x29'))}},'json':!![]};_0x51c67a['headers']=_0x322602;logger[_0xa0ba('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x51c67a)['then'](function(_0x5c6b7c){_0x68b99[_0xa0ba('0x25')]=_0x5c6b7c[_0xa0ba('0x2a')]['id'];_0x3a8610(_0x68b99);})[_0xa0ba('0x1e')](function(_0xd3c231){logger['error']('['+[_0xaf5898['toUpperCase']()]+']',_0xd3c231[_0xa0ba('0x17')]);_0xae9f88(_0xd3c231[_0xa0ba('0x17')]);});});}function getTicket(_0x4f74b0,_0x2eb8fb,_0xb6a9bc,_0xbc1281,_0x23415f){return function(_0x4c9941){logger[_0xa0ba('0xd')](_0xa0ba('0x2b'));return new Promise(function(_0x503d87,_0x1e4972){var _0x47c4f9=moment();var _0x26e56f={'method':_0xa0ba('0x2c'),'uri':_0xb6a9bc+'/api/tasks','body':{'title':intUtil[_0xa0ba('0x2d')](_0xbc1281[_0xa0ba('0x2e')],_0x23415f,'\x20'),'description':intUtil['getString'](_0xbc1281[_0xa0ba('0x2f')],_0x23415f,'\x0a'),'owner_id':_0x4c9941[_0xa0ba('0x1a')],'creater_id':_0x4c9941[_0xa0ba('0x13')],'targetable_id':_0x4c9941['endUserId'],'targetable_type':_0xa0ba('0x30'),'created_at':_0x47c4f9[_0xa0ba('0x22')](_0xa0ba('0x29')),'due_date':_0x47c4f9[_0xa0ba('0x31')](0x1e,'m')[_0xa0ba('0x22')](_0xa0ba('0x29'))},'json':!![]};_0x26e56f[_0xa0ba('0xc')]=_0x2eb8fb;return rp(_0x26e56f)['then'](function(_0xe78188){_0x4c9941['ticketId']=_0xe78188[_0xa0ba('0x32')]['id'];logger['info'](_0xa0ba('0x33'),_0x4c9941[_0xa0ba('0x34')]);_0x503d87(_0x4c9941);})[_0xa0ba('0x1e')](function(_0x4d5662){logger['error']('['+[_0x4f74b0[_0xa0ba('0x16')]()]+']',_0x4d5662[_0xa0ba('0x17')]);_0x1e4972(_0x4d5662['message']);});});};}function emit(_0xbcfe55,_0x286c03,_0x3be4b5){var _0x594c99={'uri':_0xbcfe55+_0xa0ba('0x35')+_0x3be4b5};io['to'](util[_0xa0ba('0x22')](_0xa0ba('0x36'),_0x286c03))['emit'](_0xa0ba('0x37'),_0x594c99);}exports['cs']=function(_0x1ce499,_0x56ffce,_0x5e4b26,_0x3d30dd,_0x38fb7a,_0x306812,_0x5ce8f8,_0x1b22b4){var _0x32eb3f={};var _0x135a85={'Authorization':_0xa0ba('0x38')+_0x306812[_0xa0ba('0x39')]};_0x306812['remoteUri']=intUtil[_0xa0ba('0x3a')](_0x306812[_0xa0ba('0x3b')]);_0x306812[_0xa0ba('0x3c')]=intUtil[_0xa0ba('0x3a')](_0x306812[_0xa0ba('0x3c')]);var _0x1182e1=_0x306812[_0xa0ba('0x3b')];_0x32eb3f[_0xa0ba('0x12')]=_0x306812[_0xa0ba('0x3d')];_0x32eb3f[_0xa0ba('0x24')]=_0x1b22b4[_0xa0ba('0x3e')]()==='outbound'?_0x56ffce[_0xa0ba('0x3f')]:_0x56ffce['calleridnum'];_0x32eb3f[_0xa0ba('0x40')]=_0x1b22b4===_0xa0ba('0x41')||_0x1b22b4===_0xa0ba('0x42')?'queue':_0xa0ba('0x43');if(_0x3d30dd){_0x32eb3f[_0xa0ba('0x18')]=_0x3d30dd['email'];}var _0x55486d=util[_0xa0ba('0x22')](_0xa0ba('0x44'),_0x306812[_0xa0ba('0x3c')],_0x56ffce[_0xa0ba('0x45')],md5(_0x56ffce[_0xa0ba('0x45')]));if(_0x38fb7a&&_0x38fb7a[_0xa0ba('0x46')]){logger[_0xa0ba('0xd')](_0xa0ba('0x47'),_0xa0ba('0x48'));_0x56ffce[_0xa0ba('0x49')]=_0x55486d;}else if(_0x5ce8f8&&_0x5ce8f8['recordingFormat']&&_0x5ce8f8['recordingFormat']!==_0xa0ba('0x4a')){logger[_0xa0ba('0xd')](_0xa0ba('0x4b'),_0xa0ba('0x48'));_0x56ffce['recordingURL']=_0x55486d;}else{_0x56ffce[_0xa0ba('0x49')]='';}return getAdminId(_0x32eb3f,_0x1b22b4,_0x135a85,_0x1182e1)['then'](getUser(_0x1b22b4,_0x135a85,_0x1182e1))['then'](getEndUser(_0x1b22b4,_0x135a85,_0x1182e1))[_0xa0ba('0xf')](getTicket(_0x1b22b4,_0x135a85,_0x1182e1,_0x5e4b26,_0x56ffce))[_0xa0ba('0xf')](function(_0x24e061){logger['info'](util[_0xa0ba('0x22')](_0xa0ba('0x4c'),_0x24e061[_0xa0ba('0x34')]));if(_0x1b22b4!==_0xa0ba('0x42')){logger[_0xa0ba('0xd')]('['+[_0x1b22b4['toUpperCase']()]+']',_0xa0ba('0x4d'));emit(_0x1182e1,_0x3d30dd[_0xa0ba('0x4e')],_0x24e061[_0xa0ba('0x25')]);}})[_0xa0ba('0x1e')](function(_0x9be180){logger['error']('['+[_0x1b22b4['toUpperCase']()]+_0xa0ba('0x4f'),util[_0xa0ba('0x50')](_0x9be180,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0e97=['../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','length','userId','User\x20found:','Admin\x20selected','adminEmail','error','message','GET','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','destcalleridnum','calleridnum','queue','unmanaged','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x0e97,0x1ab));var _0x70e9=function(_0x20218c,_0x7f5d20){_0x20218c=_0x20218c-0x0;var _0x15ccbc=_0x0e97[_0x20218c];return _0x15ccbc;};'use strict';var _=require(_0x70e9('0x0'));var rp=require(_0x70e9('0x1'));var md5=require(_0x70e9('0x2'));var util=require(_0x70e9('0x3'));var moment=require(_0x70e9('0x4'));var Promise=require(_0x70e9('0x5'));var Redis=require(_0x70e9('0x6'));var intUtil=require(_0x70e9('0x7'));var config=require(_0x70e9('0x8'));var logger=require(_0x70e9('0x9'))(_0x70e9('0xa'));config[_0x70e9('0xb')]=_['defaults'](config[_0x70e9('0xb')],{'host':_0x70e9('0xc'),'port':0x18eb});var io=require(_0x70e9('0xd'))(new Redis(config[_0x70e9('0xb')]));function getAdminId(_0x564507,_0x4e089e,_0x597599,_0x26421a){return new Promise(function(_0x304a1e,_0x3c3f07){var _0x3a6cc6=![];var _0x7f51e={'method':'GET','uri':_0x26421a+_0x70e9('0xe'),'json':!![]};_0x7f51e[_0x70e9('0xf')]=_0x597599;logger[_0x70e9('0x10')](_0x70e9('0x11'));return rp(_0x7f51e)[_0x70e9('0x12')](function(_0x2becda){if(_0x2becda){var _0x4e5902=_0x2becda[_0x70e9('0x13')];var _0x5b3d84=null;for(_0x5b3d84=0x0;_0x5b3d84<_0x4e5902['length'];_0x5b3d84++){if(_0x4e5902[_0x5b3d84][_0x70e9('0x14')]===_0x564507['adminEmail']){_0x564507[_0x70e9('0x15')]=_0x4e5902[_0x5b3d84]['id'];_0x3a6cc6=!![];}}if(_0x3a6cc6){logger[_0x70e9('0x10')](_0x70e9('0x16'),_0x564507['adminId']);_0x304a1e(_0x564507);}else{_0x3c3f07({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3c3f07({'statusCode':0x194,'message':_0x70e9('0x17')});}})[_0x70e9('0x18')](function(_0x452d52){logger['error']('['+[_0x4e089e[_0x70e9('0x19')]()]+']',_0x452d52['message']);_0x3c3f07(_0x452d52);});});}function getUser(_0x480a1e,_0xcfeacb,_0x35d7d2){return function(_0x4caf7c){return new Promise(function(_0x222cc8,_0xf2ce5e){var _0x37f8fa={'method':'GET','uri':_0x35d7d2+_0x70e9('0xe'),'json':!![]};_0x37f8fa[_0x70e9('0xf')]=_0xcfeacb;logger[_0x70e9('0x10')](_0x70e9('0x1a'));return rp(_0x37f8fa)[_0x70e9('0x12')](function(_0x2ee76d){if(_0x2ee76d){var _0x7e6783=_0x2ee76d[_0x70e9('0x13')];var _0x1fd51f=![];var _0x29ed09=null;if(_0x4caf7c['agentEmail']!==null){logger[_0x70e9('0x10')](_0x70e9('0x1b'),_0x4caf7c[_0x70e9('0x1c')]);_0x4caf7c[_0x70e9('0x1d')]=_0x4caf7c[_0x70e9('0x1c')];for(_0x29ed09=0x0;_0x29ed09<_0x7e6783[_0x70e9('0x1e')];_0x29ed09++){if(_0x7e6783[_0x29ed09][_0x70e9('0x14')]===_0x4caf7c[_0x70e9('0x1c')]){_0x1fd51f=!![];_0x4caf7c[_0x70e9('0x1f')]=_0x7e6783[_0x29ed09]['id'];logger[_0x70e9('0x10')](_0x70e9('0x20'),_0x4caf7c[_0x70e9('0x1f')]);}}}if(!_0x1fd51f){logger[_0x70e9('0x10')](_0x70e9('0x21'));_0x4caf7c['userEmail']=_0x4caf7c[_0x70e9('0x22')];_0x4caf7c['userId']=_0x4caf7c[_0x70e9('0x15')];_0x1fd51f=!![];}if(_0x1fd51f){_0x222cc8(_0x4caf7c);}else{_0xf2ce5e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xf2ce5e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x95c55f){logger[_0x70e9('0x23')]('['+[_0x480a1e[_0x70e9('0x19')]()]+']',_0x95c55f[_0x70e9('0x24')]);_0xf2ce5e(_0x95c55f);});});};}function searchContact(_0x5cecfc,_0x11ce9d,_0x3dbc84,_0x2c53db){return new Promise(function(_0x479588,_0x4f6dfe){var _0xc53327={'method':_0x70e9('0x25'),'headers':_0x11ce9d,'uri':_0x5cecfc+'/api/lookup?q='+_0x2c53db+'&f='+_0x3dbc84+_0x70e9('0x26'),'json':!![]};rp(_0xc53327)[_0x70e9('0x12')](function(_0x39c3ce){var _0x97db0a=_[_0x70e9('0x27')](_0x39c3ce[_0x70e9('0x28')][_0x70e9('0x28')],[_0x3dbc84,_0x2c53db]);_0x479588(_0x97db0a);})[_0x70e9('0x18')](function(_0x426945){_0x4f6dfe(_0x426945);});});}function getEndUser(_0x4ed250,_0x407a55,_0x29b134){return function(_0x2229a3){return new Promise(function(_0x13adb5,_0x13950e){logger[_0x70e9('0x10')](util[_0x70e9('0x29')](_0x70e9('0x2a'),_0x2229a3[_0x70e9('0x2b')]));searchContact(_0x29b134,_0x407a55,_0x70e9('0x2c'),_0x2229a3[_0x70e9('0x2b')])['then'](function(_0x3fd5f7){if(_0x3fd5f7){_0x2229a3[_0x70e9('0x2d')]=_0x3fd5f7['id'];logger[_0x70e9('0x10')](_0x70e9('0x2e'),_0x2229a3['endUserId']);return _0x13adb5(_0x2229a3);}searchContact(_0x29b134,_0x407a55,_0x70e9('0x2f'),_0x2229a3[_0x70e9('0x2b')])[_0x70e9('0x12')](function(_0x3781e2){if(_0x3781e2){_0x2229a3[_0x70e9('0x2d')]=_0x3781e2['id'];logger[_0x70e9('0x10')](_0x70e9('0x30'),_0x2229a3['endUserId']);return _0x13adb5(_0x2229a3);}createEndUser(_0x2229a3,_0x4ed250,_0x407a55,_0x29b134)[_0x70e9('0x12')](function(_0x1b4122){logger[_0x70e9('0x10')](_0x70e9('0x31'),_0x1b4122[_0x70e9('0x2d')]);return _0x13adb5(_0x1b4122);});});})[_0x70e9('0x18')](function(_0x1ff2f3){_0x13950e(_0x1ff2f3);});});};}function createEndUser(_0x30a55e,_0x3d9b37,_0x1a8346,_0x108816){return new Promise(function(_0x25cad9,_0x401a57){var _0x3cd170=moment();var _0x26a10a={'method':_0x70e9('0x32'),'uri':_0x108816+'/api/contacts','body':{'contact':{'last_name':_0x30a55e[_0x70e9('0x2b')],'work_number':_0x30a55e[_0x70e9('0x2b')],'mobile_number':_0x30a55e[_0x70e9('0x2b')],'owner_id':_0x30a55e['userId'],'created_at':_0x3cd170[_0x70e9('0x29')](_0x70e9('0x33'))}},'json':!![]};_0x26a10a['headers']=_0x1a8346;logger[_0x70e9('0x10')](_0x70e9('0x34'));return rp(_0x26a10a)['then'](function(_0x5cd344){_0x30a55e[_0x70e9('0x2d')]=_0x5cd344[_0x70e9('0x35')]['id'];_0x25cad9(_0x30a55e);})[_0x70e9('0x18')](function(_0x45f866){logger[_0x70e9('0x23')]('['+[_0x3d9b37[_0x70e9('0x19')]()]+']',_0x45f866['message']);_0x401a57(_0x45f866[_0x70e9('0x24')]);});});}function getTicket(_0x243461,_0x75fb2f,_0x5cb1b6,_0x3870ac,_0x2541b3){return function(_0x5b747b){logger[_0x70e9('0x10')](_0x70e9('0x36'));return new Promise(function(_0x509a83,_0x4db008){var _0x29c0ef=moment();var _0x290cdf={'method':_0x70e9('0x32'),'uri':_0x5cb1b6+_0x70e9('0x37'),'body':{'title':intUtil[_0x70e9('0x38')](_0x3870ac[_0x70e9('0x39')],_0x2541b3,'\x20'),'description':intUtil[_0x70e9('0x38')](_0x3870ac[_0x70e9('0x3a')],_0x2541b3,'\x0a'),'owner_id':_0x5b747b[_0x70e9('0x1f')],'creater_id':_0x5b747b[_0x70e9('0x15')],'targetable_id':_0x5b747b[_0x70e9('0x2d')],'targetable_type':_0x70e9('0x3b'),'created_at':_0x29c0ef[_0x70e9('0x29')](_0x70e9('0x33')),'due_date':_0x29c0ef['add'](0x1e,'m')[_0x70e9('0x29')](_0x70e9('0x33'))},'json':!![]};_0x290cdf[_0x70e9('0xf')]=_0x75fb2f;return rp(_0x290cdf)[_0x70e9('0x12')](function(_0x9eac72){_0x5b747b[_0x70e9('0x3c')]=_0x9eac72[_0x70e9('0x3d')]['id'];logger['info'](_0x70e9('0x3e'),_0x5b747b[_0x70e9('0x3c')]);_0x509a83(_0x5b747b);})[_0x70e9('0x18')](function(_0x3d82d9){logger[_0x70e9('0x23')]('['+[_0x243461['toUpperCase']()]+']',_0x3d82d9[_0x70e9('0x24')]);_0x4db008(_0x3d82d9[_0x70e9('0x24')]);});});};}function emit(_0x585218,_0x39a2ec,_0x3007f4){var _0x5b493a={'uri':_0x585218+_0x70e9('0x3f')+_0x3007f4};io['to'](util[_0x70e9('0x29')](_0x70e9('0x40'),_0x39a2ec))[_0x70e9('0x41')]('trigger:browser:url',_0x5b493a);}exports['cs']=function(_0x47da84,_0x39b174,_0x5c8016,_0x486607,_0x27d996,_0x460c37,_0x3fb21f,_0x342a14){var _0x571462={};var _0x2408d9={'Authorization':_0x70e9('0x42')+_0x460c37[_0x70e9('0x43')]};_0x460c37['remoteUri']=intUtil[_0x70e9('0x44')](_0x460c37[_0x70e9('0x45')]);_0x460c37[_0x70e9('0x46')]=intUtil['stripTrailingSlash'](_0x460c37[_0x70e9('0x46')]);var _0x24c3aa=_0x460c37[_0x70e9('0x45')];_0x571462['adminEmail']=_0x460c37[_0x70e9('0x47')];_0x571462[_0x70e9('0x2b')]=_0x342a14['toLowerCase']()==='outbound'?_0x39b174[_0x70e9('0x48')]:_0x39b174[_0x70e9('0x49')];_0x571462['callDirection']=_0x342a14===_0x70e9('0x4a')||_0x342a14===_0x70e9('0x4b')?_0x70e9('0x4a'):'outbound';if(_0x486607){_0x571462['agentEmail']=_0x486607[_0x70e9('0x14')];}var _0x31a3db=util[_0x70e9('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x460c37[_0x70e9('0x46')],_0x39b174[_0x70e9('0x4c')],md5(_0x39b174[_0x70e9('0x4c')]));if(_0x27d996&&_0x27d996[_0x70e9('0x4d')]){logger[_0x70e9('0x10')]('[QUEUE]',_0x70e9('0x4e'));_0x39b174[_0x70e9('0x4f')]=_0x31a3db;}else if(_0x3fb21f&&_0x3fb21f[_0x70e9('0x50')]&&_0x3fb21f[_0x70e9('0x50')]!==_0x70e9('0x51')){logger[_0x70e9('0x10')](_0x70e9('0x52'),_0x70e9('0x4e'));_0x39b174[_0x70e9('0x4f')]=_0x31a3db;}else{_0x39b174[_0x70e9('0x4f')]='';}return getAdminId(_0x571462,_0x342a14,_0x2408d9,_0x24c3aa)[_0x70e9('0x12')](getUser(_0x342a14,_0x2408d9,_0x24c3aa))['then'](getEndUser(_0x342a14,_0x2408d9,_0x24c3aa))[_0x70e9('0x12')](getTicket(_0x342a14,_0x2408d9,_0x24c3aa,_0x5c8016,_0x39b174))[_0x70e9('0x12')](function(_0x307f0f){logger['info'](util[_0x70e9('0x29')]('The\x20ticket\x20ID\x20is:\x20%s',_0x307f0f[_0x70e9('0x3c')]));if(_0x342a14!==_0x70e9('0x4b')){logger[_0x70e9('0x10')]('['+[_0x342a14[_0x70e9('0x19')]()]+']',_0x70e9('0x53'));emit(_0x24c3aa,_0x486607[_0x70e9('0x54')],_0x307f0f[_0x70e9('0x2d')]);}})['catch'](function(_0x45f5c8){logger[_0x70e9('0x23')]('['+[_0x342a14[_0x70e9('0x19')]()]+_0x70e9('0x55'),util[_0x70e9('0x56')](_0x45f5c8,{'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 2ba79c6..a330095 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 _0x2732=['data2','Configurations','data3','queue','routeId','log','unmanaged','zoho','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase'];(function(_0x12be93,_0x1fcef0){var _0x519e43=function(_0x397495){while(--_0x397495){_0x12be93['push'](_0x12be93['shift']());}};_0x519e43(++_0x1fcef0);}(_0x2732,0xa2));var _0x2273=function(_0x1e425b,_0x5b1ed4){_0x1e425b=_0x1e425b-0x0;var _0x833bc2=_0x2732[_0x1e425b];return _0x833bc2;};'use strict';var _=require(_0x2273('0x0'));var util=require(_0x2273('0x1'));var zendesk=require(_0x2273('0x2'));var salesforce=require(_0x2273('0x3'));var sugarcrm=require(_0x2273('0x4'));var freshdesk=require(_0x2273('0x5'));var zoho=require(_0x2273('0x6'));var desk=require(_0x2273('0x7'));var vtiger=require('./vtiger');var servicenow=require(_0x2273('0x8'));var dynamics365=require(_0x2273('0x9'));var freshsales=require('./freshsales');var integrations=[_0x2273('0xa'),_0x2273('0xb'),_0x2273('0xc'),_0x2273('0xd'),'zoho',_0x2273('0xe'),_0x2273('0xf'),_0x2273('0x10'),_0x2273('0x11'),_0x2273('0x12')];exports[_0x2273('0x13')]=function(_0x9b1a34,_0x3f73a1,_0x291fbb,_0x3d469a,_0x20cf9c,_0x355979){if(_0x291fbb){if(_[_0x2273('0x14')](integrations,_0x9b1a34[_0x2273('0x15')][_0x2273('0x16')]())){try{var _0x2e80ba=null;var _0x11f693='';var _0x1ffdd9=_0x291fbb[_0x9b1a34['data1'][_0x2273('0x16')]()];if(_0x1ffdd9){var _0x3ad85a=_0x1ffdd9[_0x9b1a34[_0x2273('0x17')]];if(_0x3ad85a){var _0x3e2ed9=_['find'](_0x3ad85a[_0x2273('0x18')],{'id':parseInt(_0x9b1a34[_0x2273('0x19')],0xa)});if(_0x3e2ed9){if(_0x3d469a){if(_0x20cf9c&&_0x3f73a1[_0x2273('0x1a')]){_0x11f693='queue';}else if(_0x3f73a1[_0x2273('0x1b')]){_0x11f693='outbound';}else{console[_0x2273('0x1c')]('EVENT\x20UNKNOWN',_0x3f73a1);}}else{_0x11f693=_0x2273('0x1d');}switch(_0x9b1a34[_0x2273('0x15')][_0x2273('0x16')]()){case'zendesk':zendesk[_0x11f693](_0x9b1a34,_0x3f73a1,_0x3e2ed9,_0x3d469a,_0x20cf9c,_0x3ad85a,_0x355979);break;case'salesforce':salesforce[_0x11f693](_0x9b1a34,_0x3f73a1,_0x3e2ed9,_0x3d469a,_0x20cf9c,_0x3ad85a,_0x355979);break;case _0x2273('0xc'):sugarcrm[_0x11f693](_0x9b1a34,_0x3f73a1,_0x3e2ed9,_0x3d469a,_0x20cf9c,_0x3ad85a,_0x355979);break;case'freshdesk':freshdesk[_0x11f693](_0x9b1a34,_0x3f73a1,_0x3e2ed9,_0x3d469a,_0x20cf9c,_0x3ad85a,_0x355979);break;case _0x2273('0x1e'):zoho[_0x11f693](_0x9b1a34,_0x3f73a1,_0x3e2ed9,_0x3d469a,_0x20cf9c,_0x3ad85a,_0x355979);break;case'desk':desk[_0x11f693](_0x9b1a34,_0x3f73a1,_0x3e2ed9,_0x3d469a,_0x20cf9c,_0x3ad85a,_0x355979);break;case _0x2273('0xf'):vtiger[_0x11f693](_0x9b1a34,_0x3f73a1,_0x3e2ed9,_0x3d469a,_0x20cf9c,_0x3ad85a,_0x355979);break;case _0x2273('0x11'):freshsales['cs'](_0x9b1a34,_0x3f73a1,_0x3e2ed9,_0x3d469a,_0x20cf9c,_0x3ad85a,_0x355979,_0x11f693);break;case _0x2273('0x12'):servicenow['cs'](_0x9b1a34,_0x3f73a1,_0x3e2ed9,_0x3d469a,_0x20cf9c,_0x3ad85a,_0x355979,_0x11f693);break;case'dynamics365':dynamics365['cs'](_0x9b1a34,_0x3f73a1,_0x3e2ed9,_0x3d469a,_0x20cf9c,_0x3ad85a,_0x355979,_0x11f693);break;default:console[_0x2273('0x1c')](_0x2273('0x1f'));}}else{_0x2e80ba=require(_0x2273('0x20'))(_0x9b1a34[_0x2273('0x15')][_0x2273('0x16')]());_0x2e80ba[_0x2273('0x21')](_0x2273('0x22'),util[_0x2273('0x23')](_0x2273('0x24'),_0x9b1a34['data1']['toLowerCase'](),_0x9b1a34[_0x2273('0x19')]));}}else{_0x2e80ba=require(_0x2273('0x20'))(_0x9b1a34['data1'][_0x2273('0x16')]());_0x2e80ba[_0x2273('0x21')]('[EXEC]',util[_0x2273('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x9b1a34[_0x2273('0x15')][_0x2273('0x16')](),_0x9b1a34[_0x2273('0x17')]));}}else{}}catch(_0x5a2b78){console[_0x2273('0x21')](_0x5a2b78);}}}}; \ No newline at end of file +var _0x8122=['exec','data1','toLowerCase','data2','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','salesforce','zoho','dynamics365','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','sugarcrm','freshdesk','vtiger','freshsales','servicenow'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8122,0x17d));var _0x2812=function(_0x52f390,_0x540f1f){_0x52f390=_0x52f390-0x0;var _0x372a2f=_0x8122[_0x52f390];return _0x372a2f;};'use strict';var _=require(_0x2812('0x0'));var util=require(_0x2812('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x2812('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x2812('0x3'));var zoho=require(_0x2812('0x4'));var desk=require(_0x2812('0x5'));var vtiger=require(_0x2812('0x6'));var servicenow=require(_0x2812('0x7'));var dynamics365=require(_0x2812('0x8'));var freshsales=require('./freshsales');var integrations=[_0x2812('0x9'),'salesforce',_0x2812('0xa'),_0x2812('0xb'),'zoho','desk',_0x2812('0xc'),'dynamics365',_0x2812('0xd'),_0x2812('0xe')];exports[_0x2812('0xf')]=function(_0x333ddf,_0x449e35,_0x3386b4,_0x611f00,_0x3c7c44,_0x5058b9){if(_0x3386b4){if(_['includes'](integrations,_0x333ddf[_0x2812('0x10')][_0x2812('0x11')]())){try{var _0x56c17a=null;var _0x5cb233='';var _0x3b7a4a=_0x3386b4[_0x333ddf[_0x2812('0x10')][_0x2812('0x11')]()];if(_0x3b7a4a){var _0x3033de=_0x3b7a4a[_0x333ddf[_0x2812('0x12')]];if(_0x3033de){var _0x42c9be=_['find'](_0x3033de[_0x2812('0x13')],{'id':parseInt(_0x333ddf[_0x2812('0x14')],0xa)});if(_0x42c9be){if(_0x611f00){if(_0x3c7c44&&_0x449e35['queue']){_0x5cb233=_0x2812('0x15');}else if(_0x449e35[_0x2812('0x16')]){_0x5cb233=_0x2812('0x17');}else{console['log'](_0x2812('0x18'),_0x449e35);}}else{_0x5cb233=_0x2812('0x19');}switch(_0x333ddf[_0x2812('0x10')][_0x2812('0x11')]()){case _0x2812('0x9'):zendesk[_0x5cb233](_0x333ddf,_0x449e35,_0x42c9be,_0x611f00,_0x3c7c44,_0x3033de,_0x5058b9);break;case _0x2812('0x1a'):salesforce[_0x5cb233](_0x333ddf,_0x449e35,_0x42c9be,_0x611f00,_0x3c7c44,_0x3033de,_0x5058b9);break;case _0x2812('0xa'):sugarcrm[_0x5cb233](_0x333ddf,_0x449e35,_0x42c9be,_0x611f00,_0x3c7c44,_0x3033de,_0x5058b9);break;case'freshdesk':freshdesk[_0x5cb233](_0x333ddf,_0x449e35,_0x42c9be,_0x611f00,_0x3c7c44,_0x3033de,_0x5058b9);break;case _0x2812('0x1b'):zoho[_0x5cb233](_0x333ddf,_0x449e35,_0x42c9be,_0x611f00,_0x3c7c44,_0x3033de,_0x5058b9);break;case'desk':desk[_0x5cb233](_0x333ddf,_0x449e35,_0x42c9be,_0x611f00,_0x3c7c44,_0x3033de,_0x5058b9);break;case _0x2812('0xc'):vtiger[_0x5cb233](_0x333ddf,_0x449e35,_0x42c9be,_0x611f00,_0x3c7c44,_0x3033de,_0x5058b9);break;case'freshsales':freshsales['cs'](_0x333ddf,_0x449e35,_0x42c9be,_0x611f00,_0x3c7c44,_0x3033de,_0x5058b9,_0x5cb233);break;case _0x2812('0xe'):servicenow['cs'](_0x333ddf,_0x449e35,_0x42c9be,_0x611f00,_0x3c7c44,_0x3033de,_0x5058b9,_0x5cb233);break;case _0x2812('0x1c'):dynamics365['cs'](_0x333ddf,_0x449e35,_0x42c9be,_0x611f00,_0x3c7c44,_0x3033de,_0x5058b9,_0x5cb233);break;default:console[_0x2812('0x1d')](_0x2812('0x1e'));}}else{_0x56c17a=require(_0x2812('0x1f'))(_0x333ddf[_0x2812('0x10')][_0x2812('0x11')]());_0x56c17a[_0x2812('0x20')](_0x2812('0x21'),util[_0x2812('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0x333ddf['data1']['toLowerCase'](),_0x333ddf[_0x2812('0x14')]));}}else{_0x56c17a=require(_0x2812('0x1f'))(_0x333ddf[_0x2812('0x10')]['toLowerCase']());_0x56c17a[_0x2812('0x20')]('[EXEC]',util[_0x2812('0x22')](_0x2812('0x23'),_0x333ddf[_0x2812('0x10')][_0x2812('0x11')](),_0x333ddf[_0x2812('0x12')]));}}else{}}catch(_0x50109b){console[_0x2812('0x20')](_0x50109b);}}}}; \ 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 629ec5c..95ed75b 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 _0x388c=['moduleCreate','LastName','','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','format','upperFirst','create','string','idField','content','toString','variable','variableName','Variable','name','password','concat','securityToken','https://login.salesforce.com','clientId','login','Connection\x20established.','queue','remoteUri','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','Task','IsRecurrence','contact','endUserType','lead','WhoId','account','WhatId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','additionalSearchContact','merge','$or','additionalSearchLead','Lead','cloneDeep','additionalSearchAccount','Account','Contact','first','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x388c,0x139));var _0xc388=function(_0x51a2f3,_0x392d3d){_0x51a2f3=_0x51a2f3-0x0;var _0x2ddc5c=_0x388c[_0x51a2f3];return _0x2ddc5c;};'use strict';var _=require(_0xc388('0x0'));var rp=require(_0xc388('0x1'));var moment=require(_0xc388('0x2'));var BPromise=require(_0xc388('0x3'));var md5=require('md5');var jsforce=require(_0xc388('0x4'));var util=require(_0xc388('0x5'));var Redis=require(_0xc388('0x6'));var intUtil=require(_0xc388('0x7'));var config=require('../../../../config/environment');var logger=require(_0xc388('0x8'))('salesforce');config[_0xc388('0x9')]=_[_0xc388('0xa')](config[_0xc388('0x9')],{'host':_0xc388('0xb'),'port':0x18eb});var io=require(_0xc388('0xc'))(new Redis(config[_0xc388('0x9')]));function emit(_0xfaea1,_0x3f89d8,_0x249faa){io['to'](_0xfaea1)[_0xc388('0xd')](_0x3f89d8,_0x249faa);}function getTicket(_0x318c22,_0xf66e9f,_0x532544,_0x11b6c0,_0x57dd63,_0x36a479,_0xcb4ffc,_0x3bf62e){var _0x1bcb10=Object[_0xc388('0xe')]({},{'OwnerId':_0xf66e9f['id'],'Subject':intUtil[_0xc388('0xf')](_0x11b6c0['Subjects'],_0x57dd63,'\x20'),'Description':intUtil[_0xc388('0xf')](_0x11b6c0[_0xc388('0x10')],_0x57dd63,'\x0a')},getCustomFields(_0x36a479,_0x57dd63));if(_0x532544){if(_0x11b6c0[_0xc388('0x11')]===_0xc388('0x12')){_0x1bcb10['ActivityDate']=moment['utc']();_0x1bcb10['IsReminderSet']=![];_0x1bcb10[_0xc388('0x13')]=![];if(_0x532544['endUserType']===_0xc388('0x14')||_0x532544[_0xc388('0x15')]===_0xc388('0x16')){_0x1bcb10[_0xc388('0x17')]=_0x532544['id'];}else if(_0x532544['endUserType']===_0xc388('0x18')){_0x1bcb10[_0xc388('0x19')]=_0x532544['id'];}}else if(_0x11b6c0[_0xc388('0x11')]==='Case'){if(_0x532544[_0xc388('0x15')]==='contact'){_0x1bcb10['ContactId']=_0x532544['id'];}else if(_0x532544[_0xc388('0x15')]===_0xc388('0x18')){_0x1bcb10[_0xc388('0x1a')]=_0x532544['id'];}else if(_0x532544[_0xc388('0x15')]===_0xc388('0x16')&&_0x11b6c0[_0xc388('0x1b')]){_0x1bcb10[_0x11b6c0[_0xc388('0x1b')]]=_0x532544['id'];}else{logger[_0xc388('0x1c')](_0xc388('0x1d'));}}}return _0xcb4ffc[_0xc388('0x1e')](_0x11b6c0[_0xc388('0x11')])['create'](_0x1bcb10);}function getUser(_0x3d56ad,_0x49b5f7,_0x1a03d5){if(!_[_0xc388('0x1f')](_0x49b5f7)&&intUtil[_0xc388('0x20')](_0x49b5f7)){var _0x266798={'Email':_0x49b5f7};var _0x534527={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1a03d5[_0xc388('0x1e')](_0xc388('0x21'))[_0xc388('0x22')](_0x266798,_0x534527)[_0xc388('0x23')]()[_0xc388('0x24')](function(_0x362bbe){if(_0x362bbe[_0xc388('0x25')]){var _0xa3b915=_[_0xc388('0x22')](_0x362bbe,function(_0xb9698d){return _0xb9698d[_0xc388('0x26')]===_0x49b5f7;});if(_0xa3b915){logger[_0xc388('0x1c')](_0xc388('0x27'),_0x49b5f7);return BPromise[_0xc388('0x28')]({'id':_0xa3b915['Id'],'name':_0xa3b915[_0xc388('0x29')]});}}else{logger[_0xc388('0x1c')](_0xc388('0x2a'),_0x49b5f7);return _0x1a03d5[_0xc388('0x2b')]()[_0xc388('0x24')](function(_0x476087){return BPromise['resolve']({'id':_0x476087[_0xc388('0x2c')],'name':_0x476087[_0xc388('0x2d')]});});}});}else{logger[_0xc388('0x1c')](_0xc388('0x2a'),_0x49b5f7);return _0x1a03d5[_0xc388('0x2b')]()['then'](function(_0x54f8cf){return BPromise[_0xc388('0x28')]({'id':_0x54f8cf['user_id'],'name':_0x54f8cf[_0xc388('0x2d')]});});}}function getEndUser(_0x5d5c6d,_0x235a65,_0x37abf7,_0x592d27,_0x587e18){var _0x2c90c1={'$or':{'Phone':_0x592d27}};var _0x45a636={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xc388('0x24')](function(){logger[_0xc388('0x1c')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x592d27,_0x235a65[_0xc388('0x2e')]);switch(_0x235a65[_0xc388('0x2e')]){case _0xc388('0x2f'):var _0x5e279e=_['cloneDeep'](_0x2c90c1);if(_0x235a65['additionalSearchContact']){var _0x42fe7e={};_0x42fe7e[_0x235a65[_0xc388('0x30')]]=_0x592d27;_[_0xc388('0x31')](_0x5e279e[_0xc388('0x32')],_0x42fe7e);}return _0x587e18[_0xc388('0x1e')]('Contact')['find'](_0x5e279e,_0x45a636)[_0xc388('0x23')]()['then'](function(_0x5ee029){if(_0x5ee029&&_0x5ee029[_0xc388('0x25')]){return _0x5ee029;}else{var _0x5a729c=_['cloneDeep'](_0x2c90c1);if(_0x235a65['additionalSearchLead']){var _0x1a8088={};_0x1a8088[_0x235a65[_0xc388('0x33')]]=_0x592d27;_['merge'](_0x5a729c[_0xc388('0x32')],_0x1a8088);}return _0x587e18[_0xc388('0x1e')](_0xc388('0x34'))['find'](_0x5a729c,_0x45a636);}});case'account_contact_lead':var _0x2a7623=_[_0xc388('0x35')](_0x2c90c1);if(_0x235a65[_0xc388('0x36')]){var _0x42fe7e={};_0x42fe7e[_0x235a65[_0xc388('0x36')]]=_0x592d27;_[_0xc388('0x31')](_0x2a7623[_0xc388('0x32')],_0x42fe7e);}return _0x587e18[_0xc388('0x1e')](_0xc388('0x37'))['find'](_0x2a7623,_0x45a636)[_0xc388('0x23')]()[_0xc388('0x24')](function(_0x602da4){if(_0x602da4&&_0x602da4[_0xc388('0x25')]){return _0x602da4;}else{var _0x19cbfa=_[_0xc388('0x35')](_0x2c90c1);if(_0x235a65[_0xc388('0x30')]){var _0x1cc32a={};_0x1cc32a[_0x235a65[_0xc388('0x30')]]=_0x592d27;_[_0xc388('0x31')](_0x19cbfa[_0xc388('0x32')],_0x1cc32a);}return _0x587e18[_0xc388('0x1e')](_0xc388('0x38'))[_0xc388('0x22')](_0x19cbfa,_0x45a636)[_0xc388('0x24')](function(_0x454241){if(_0x454241&&_0x454241[_0xc388('0x25')]){return _0x454241;}else{var _0x30f0d4=_[_0xc388('0x35')](_0x2c90c1);if(_0x235a65['additionalSearchLead']){var _0x59993f={};_0x59993f[_0x235a65[_0xc388('0x33')]]=_0x592d27;_['merge'](_0x30f0d4[_0xc388('0x32')],_0x59993f);}return _0x587e18[_0xc388('0x1e')](_0xc388('0x34'))[_0xc388('0x22')](_0x30f0d4,_0x45a636);}});}});case _0xc388('0x14'):var _0x5e279e=_[_0xc388('0x35')](_0x2c90c1);if(_0x235a65[_0xc388('0x30')]){var _0x42fe7e={};_0x42fe7e[_0x235a65['additionalSearchContact']]=_0x592d27;_['merge'](_0x5e279e[_0xc388('0x32')],_0x42fe7e);}return _0x587e18['sobject'](_0xc388('0x38'))[_0xc388('0x22')](_0x5e279e,_0x45a636)[_0xc388('0x23')]();case'lead':var _0x2e9ad1=_[_0xc388('0x35')](_0x2c90c1);if(_0x235a65['additionalSearchLead']){var _0x42fe7e={};_0x42fe7e[_0x235a65['additionalSearchLead']]=_0x592d27;_[_0xc388('0x31')](_0x2e9ad1[_0xc388('0x32')],_0x42fe7e);}return _0x587e18['sobject']('Lead')[_0xc388('0x22')](_0x2e9ad1,_0x45a636);case _0xc388('0x18'):var _0x2a7623=_['cloneDeep'](_0x2c90c1);if(_0x235a65[_0xc388('0x36')]){var _0x42fe7e={};_0x42fe7e[_0x235a65[_0xc388('0x36')]]=_0x592d27;_[_0xc388('0x31')](_0x2a7623[_0xc388('0x32')],_0x42fe7e);}return _0x587e18['sobject']('Account')[_0xc388('0x22')](_0x2a7623,_0x45a636);default:return null;}})[_0xc388('0x24')](function(_0x5df740){if(_0x5df740&&_0x5df740[_0xc388('0x25')]){var _0x5d16dd=_[_0xc388('0x39')](_0x5df740);if(_0x5d16dd){return BPromise[_0xc388('0x28')]({'id':_0x5d16dd['Id'],'name':_0x5d16dd[_0xc388('0x29')],'phone':_0x5d16dd['Phone'],'endUserType':_0x5d16dd['attributes'][_0xc388('0x3a')][_0xc388('0x3b')]()});}}})[_0xc388('0x24')](function(_0x3e6363){if(_0x3e6363){logger['info'](_0xc388('0x3c'),_0x3e6363[_0xc388('0x15')],_0x592d27);return BPromise[_0xc388('0x28')](_0x3e6363);}else{logger['info'](_0xc388('0x3d'),_0x592d27);var _0x213d5a={'Phone':_0x592d27};if(_0x235a65[_0xc388('0x3e')]){if(_0x235a65[_0xc388('0x3e')]===_0xc388('0x14')){logger[_0xc388('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x592d27,_0x235a65['moduleCreate']);_0x213d5a[_0xc388('0x3f')]=_0x37abf7!==_0xc388('0x40')?_0x37abf7:util['format'](_0xc388('0x41'),_0x592d27);}else if(_0x235a65['moduleCreate']===_0xc388('0x16')){logger['info'](_0xc388('0x42'),_0x592d27,_0x235a65[_0xc388('0x3e')]);_0x213d5a['LastName']=_0x37abf7!==_0xc388('0x40')?_0x37abf7:util['format'](_0xc388('0x41'),_0x592d27);_0x213d5a[_0xc388('0x43')]=_0xc388('0x44');}else if(_0x235a65[_0xc388('0x3e')]===_0xc388('0x18')){logger[_0xc388('0x1c')](_0xc388('0x42'),_0x592d27,_0x235a65['moduleCreate']);_0x213d5a[_0xc388('0x29')]=_0x37abf7!==_0xc388('0x40')?_0x37abf7:util[_0xc388('0x45')](_0xc388('0x41'),_0x592d27);}else{return null;}}return _0x587e18[_0xc388('0x1e')](_[_0xc388('0x46')](_0x235a65[_0xc388('0x3e')]))[_0xc388('0x47')](_0x213d5a)[_0xc388('0x24')](function(_0x285a19){return BPromise['resolve']({'id':_0x285a19['id'],'endUserType':_0x235a65[_0xc388('0x3e')]});});}});}function getCustomFields(_0x45134e,_0x5efd25){var _0x2b5f36={};if(_0x45134e['length']>0x0){_['forEach'](_0x45134e,function(_0x4eee97){if(_['includes']([_0xc388('0x48'),'picklist'],_0x4eee97[_0xc388('0x3a')])&&_0x4eee97[_0xc388('0x49')]){_0x2b5f36[_0x4eee97[_0xc388('0x49')]]=_0x4eee97[_0xc388('0x4a')][_0xc388('0x4b')]();}else if(_0x4eee97['type']===_0xc388('0x4c')&&_0x4eee97['variableName']&&_0x4eee97[_0xc388('0x49')]){_0x5efd25[_0x4eee97['variableName']]&&(_0x2b5f36[_0x4eee97['idField']]=_0x5efd25[_0x4eee97[_0xc388('0x4d')]][_0xc388('0x4b')]());}else if(_0x4eee97[_0xc388('0x3a')]==='customVariable'&&_0x4eee97[_0xc388('0x4e')]&&_0x4eee97[_0xc388('0x4e')][_0xc388('0x4f')]&&_0x4eee97[_0xc388('0x49')]){_0x5efd25[_0x4eee97[_0xc388('0x4e')][_0xc388('0x4f')][_0xc388('0x3b')]()]&&(_0x2b5f36[_0x4eee97[_0xc388('0x49')]]=_0x5efd25[_0x4eee97[_0xc388('0x4e')][_0xc388('0x4f')][_0xc388('0x3b')]()][_0xc388('0x4b')]());}});}return _0x2b5f36;}function getConnection(_0x59f2a9){var _0x1cbed9=_0x59f2a9[_0xc388('0x50')][_0xc388('0x51')](_0x59f2a9[_0xc388('0x52')]);var _0x4f6216=new jsforce['Connection']({'oauth2':{'loginUrl':_0x59f2a9['remoteUri']||_0xc388('0x53'),'clientId':_0x59f2a9[_0xc388('0x54')],'clientSecret':_0x59f2a9['clientSecret']}});return _0x4f6216[_0xc388('0x55')](_0x59f2a9['username'],_0x1cbed9)['then'](function(){logger['info'](_0xc388('0x56'));return _0x4f6216;});}exports[_0xc388('0x57')]=function(_0x4384df,_0x14aa5a,_0x6187cc,_0x44e1eb,_0x79be11,_0x1febb1){var _0x370ee3,_0x260496,_0xc51254,_0xaa261c;_0x1febb1['serverUrl']=intUtil['stripTrailingSlash'](_0x1febb1['serverUrl']);_0x1febb1[_0xc388('0x58')]=intUtil[_0xc388('0x59')](_0x1febb1[_0xc388('0x58')]);if(_0x79be11&&_0x79be11['monitor_format']){logger[_0xc388('0x1c')](_0xc388('0x5a'),_0xc388('0x5b'));_0x14aa5a[_0xc388('0x5c')]=util[_0xc388('0x45')](_0xc388('0x5d'),_0x1febb1[_0xc388('0x5e')],_0x14aa5a[_0xc388('0x5f')],md5(_0x14aa5a[_0xc388('0x5f')]));}else{_0x14aa5a[_0xc388('0x5c')]='';}return getConnection(_0x1febb1)[_0xc388('0x24')](function(_0x1af5eb){_0xaa261c=_0x1af5eb;return getUser(_0x1febb1,_0x44e1eb[_0xc388('0x60')],_0xaa261c);})[_0xc388('0x24')](function(_0x5070bc){_0x370ee3=_0x5070bc;return getEndUser(_0x1febb1,_0x6187cc,_0x14aa5a[_0xc388('0x61')],_0x14aa5a['calleridnum'],_0xaa261c);})[_0xc388('0x24')](function(_0x5933de){_0x260496=_0x5933de;return getTicket(_0x1febb1,_0x370ee3,_0x260496,_0x6187cc,_0x14aa5a,_0x6187cc['Fields'],_0xaa261c,'queue');})['then'](function(_0x426826){_0xc51254=_0x426826;logger[_0xc388('0x1c')](_0xc388('0x62'),_0xc51254['id']);logger[_0xc388('0x1c')](_0xc388('0x63'),_0xc51254['id'],_0x44e1eb[_0xc388('0x4f')],_0x1febb1[_0xc388('0x3a')]);switch(_0x1febb1[_0xc388('0x3a')]){case _0xc388('0x64'):emit(util[_0xc388('0x45')](_0xc388('0x65'),_0x44e1eb[_0xc388('0x4f')]),_0xc388('0x66'),{'recordId':_0xc51254['id']});break;case _0xc388('0x67'):emit(util[_0xc388('0x45')]('user:%s',_0x44e1eb[_0xc388('0x4f')]),'trigger:browser:url',{'uri':util[_0xc388('0x45')](_0xc388('0x68'),_0xaa261c[_0xc388('0x69')],_0xc51254['id'])});break;default:logger[_0xc388('0x6a')](_0xc388('0x6b'));}})['catch'](function(_0x48b1d3){logger[_0xc388('0x6a')](_0xc388('0x5a'),_0x48b1d3);});};exports[_0xc388('0x6c')]=function(_0xdddce3,_0x32e593,_0x588526,_0x5b3047,_0x5d76ca,_0x94e106,_0x110738){var _0x3967bb,_0x2bebda,_0xe72c6c,_0x28cadc;_0x94e106[_0xc388('0x5e')]=intUtil[_0xc388('0x59')](_0x94e106[_0xc388('0x5e')]);_0x94e106[_0xc388('0x58')]=intUtil['stripTrailingSlash'](_0x94e106[_0xc388('0x58')]);if(_0x110738&&_0x110738[_0xc388('0x6d')]&&_0x110738[_0xc388('0x6d')]!==_0xc388('0x6e')){logger[_0xc388('0x1c')]('[OUTBOUND]',_0xc388('0x5b'));_0x32e593[_0xc388('0x5c')]=util[_0xc388('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x94e106[_0xc388('0x5e')],_0x32e593[_0xc388('0x5f')],md5(_0x32e593[_0xc388('0x5f')]));}return getConnection(_0x94e106)[_0xc388('0x24')](function(_0x31b6a1){_0x28cadc=_0x31b6a1;return getUser(_0x94e106,_0x5b3047[_0xc388('0x60')],_0x28cadc);})[_0xc388('0x24')](function(_0x7a952b){_0x3967bb=_0x7a952b;return getEndUser(_0x94e106,_0x588526,_0x32e593['destcalleridname'],_0x32e593[_0xc388('0x6f')],_0x28cadc);})[_0xc388('0x24')](function(_0x1c7d20){_0x2bebda=_0x1c7d20;return getTicket(_0x94e106,_0x3967bb,_0x2bebda,_0x588526,_0x32e593,_0x588526['Fields'],_0x28cadc,_0xc388('0x6c'));})[_0xc388('0x24')](function(_0x5f41eb){_0xe72c6c=_0x5f41eb;logger['info'](_0xc388('0x70'),_0xe72c6c['id']);logger[_0xc388('0x1c')](_0xc388('0x71'),_0xe72c6c['id'],_0x5b3047[_0xc388('0x4f')],_0x94e106['type']);switch(_0x94e106[_0xc388('0x3a')]){case _0xc388('0x64'):emit(util[_0xc388('0x45')](_0xc388('0x65'),_0x5b3047['name']),_0xc388('0x66'),{'recordId':_0xe72c6c['id']});break;case _0xc388('0x67'):emit(util[_0xc388('0x45')](_0xc388('0x65'),_0x5b3047[_0xc388('0x4f')]),_0xc388('0x72'),{'uri':util[_0xc388('0x45')](_0xc388('0x68'),_0x28cadc['instanceUrl'],_0xe72c6c['id'])});break;default:logger['error']('[OUTBOUND]',_0xc388('0x73'));}})[_0xc388('0x74')](function(_0x4a37a3){logger['error'](_0xc388('0x75'),_0x4a37a3);});};exports[_0xc388('0x76')]=function(_0x408475,_0xb18723,_0x340d23,_0x1af7c1,_0x3203fd,_0x15a949){var _0x4e02d7,_0x3a0811,_0x16217e,_0x57375b;_0x15a949['serverUrl']=intUtil[_0xc388('0x59')](_0x15a949['serverUrl']);_0x15a949['remoteUri']=intUtil[_0xc388('0x59')](_0x15a949[_0xc388('0x58')]);if(_0x3203fd&&_0x3203fd[_0xc388('0x77')]){logger[_0xc388('0x1c')]('['+_0xb18723[_0xc388('0x78')][_0xc388('0x79')]()+']',_0xc388('0x5b'));_0xb18723[_0xc388('0x5c')]=util[_0xc388('0x45')](_0xc388('0x5d'),_0x15a949[_0xc388('0x5e')],_0xb18723[_0xc388('0x5f')],md5(_0xb18723[_0xc388('0x5f')]));}else{_0xb18723[_0xc388('0x5c')]='';}return getConnection(_0x15a949)[_0xc388('0x24')](function(_0x11a2ea){_0x57375b=_0x11a2ea;if(!_[_0xc388('0x1f')](_0x1af7c1)){return getUser(_0x15a949,_0x1af7c1[_0xc388('0x4f')],_0x57375b);}else{return getUser(_0x15a949,null,_0x57375b);}})['then'](function(_0x575e3b){_0x4e02d7=_0x575e3b;return getEndUser(_0x15a949,_0x340d23,_0xb18723[_0xc388('0x61')],_0xb18723[_0xc388('0x7a')],_0x57375b);})['then'](function(_0x15707){_0x3a0811=_0x15707;return getTicket(_0x15a949,_0x4e02d7,_0x3a0811,_0x340d23,_0xb18723,_0x340d23['Fields'],_0x57375b);})['then'](function(_0x2d4a63){_0x16217e=_0x2d4a63;logger[_0xc388('0x1c')]('['+_0xb18723[_0xc388('0x78')]['toUpperCase']()+_0xc388('0x7b'),_0x16217e['id']);logger[_0xc388('0x1c')]('['+_0xb18723[_0xc388('0x78')]['toUpperCase']()+_0xc388('0x7c'),_0x15a949[_0xc388('0x3a')]);})[_0xc388('0x74')](function(_0x3ff130){logger[_0xc388('0x6a')]('['+_0xb18723['lastevent'][_0xc388('0x79')]()+']',_0x3ff130);});}; \ No newline at end of file +var _0xfd12=['error','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','isNil','calleridname','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','moment','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','account','WhatId','Case','ContactId','AccountId','lead','info','create','User','find','then','Email','Agent\x20%s\x20found.','resolve','Name','identity','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','sobject','Contact','length','additionalSearchLead','$or','account_contact_lead','execute','Lead','additionalSearchAccount','first','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','','Company','No\x20Company','upperFirst','forEach','includes','string','idField','content','toString','variable','variableName','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch'];(function(_0x1dfdd3,_0x3e1a05){var _0x4dbacf=function(_0x414411){while(--_0x414411){_0x1dfdd3['push'](_0x1dfdd3['shift']());}};_0x4dbacf(++_0x3e1a05);}(_0xfd12,0x113));var _0x2fd1=function(_0x3d73ba,_0x356e23){_0x3d73ba=_0x3d73ba-0x0;var _0x47e406=_0xfd12[_0x3d73ba];return _0x47e406;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x2fd1('0x0'));var BPromise=require(_0x2fd1('0x1'));var md5=require(_0x2fd1('0x2'));var jsforce=require('jsforce');var util=require(_0x2fd1('0x3'));var Redis=require(_0x2fd1('0x4'));var intUtil=require(_0x2fd1('0x5'));var config=require(_0x2fd1('0x6'));var logger=require(_0x2fd1('0x7'))(_0x2fd1('0x8'));config['redis']=_[_0x2fd1('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2fd1('0xa'))(new Redis(config['redis']));function emit(_0x48dece,_0x42df8d,_0x316871){io['to'](_0x48dece)[_0x2fd1('0xb')](_0x42df8d,_0x316871);}function getTicket(_0x4828c1,_0x505a8e,_0x422a37,_0xcb9afe,_0x98ce27,_0x3df652,_0x532ac6,_0x3d183f){var _0xad30f1=Object[_0x2fd1('0xc')]({},{'OwnerId':_0x505a8e['id'],'Subject':intUtil[_0x2fd1('0xd')](_0xcb9afe[_0x2fd1('0xe')],_0x98ce27,'\x20'),'Description':intUtil[_0x2fd1('0xd')](_0xcb9afe[_0x2fd1('0xf')],_0x98ce27,'\x0a')},getCustomFields(_0x3df652,_0x98ce27));if(_0x422a37){if(_0xcb9afe[_0x2fd1('0x10')]===_0x2fd1('0x11')){_0xad30f1[_0x2fd1('0x12')]=moment[_0x2fd1('0x13')]();_0xad30f1[_0x2fd1('0x14')]=![];_0xad30f1[_0x2fd1('0x15')]=![];if(_0x422a37[_0x2fd1('0x16')]===_0x2fd1('0x17')||_0x422a37[_0x2fd1('0x16')]==='lead'){_0xad30f1[_0x2fd1('0x18')]=_0x422a37['id'];}else if(_0x422a37['endUserType']===_0x2fd1('0x19')){_0xad30f1[_0x2fd1('0x1a')]=_0x422a37['id'];}}else if(_0xcb9afe[_0x2fd1('0x10')]===_0x2fd1('0x1b')){if(_0x422a37[_0x2fd1('0x16')]==='contact'){_0xad30f1[_0x2fd1('0x1c')]=_0x422a37['id'];}else if(_0x422a37[_0x2fd1('0x16')]==='account'){_0xad30f1[_0x2fd1('0x1d')]=_0x422a37['id'];}else if(_0x422a37[_0x2fd1('0x16')]===_0x2fd1('0x1e')&&_0xcb9afe['leadId']){_0xad30f1[_0xcb9afe['leadId']]=_0x422a37['id'];}else{logger[_0x2fd1('0x1f')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x532ac6['sobject'](_0xcb9afe[_0x2fd1('0x10')])[_0x2fd1('0x20')](_0xad30f1);}function getUser(_0x2b76b3,_0x10c350,_0x16e5fe){if(!_['isNil'](_0x10c350)&&intUtil['validateEmail'](_0x10c350)){var _0x46734a={'Email':_0x10c350};var _0x3b48cd={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x16e5fe['sobject'](_0x2fd1('0x21'))[_0x2fd1('0x22')](_0x46734a,_0x3b48cd)['execute']()[_0x2fd1('0x23')](function(_0x59c42e){if(_0x59c42e['length']){var _0x377868=_['find'](_0x59c42e,function(_0x510e5a){return _0x510e5a[_0x2fd1('0x24')]===_0x10c350;});if(_0x377868){logger[_0x2fd1('0x1f')](_0x2fd1('0x25'),_0x10c350);return BPromise[_0x2fd1('0x26')]({'id':_0x377868['Id'],'name':_0x377868[_0x2fd1('0x27')]});}}else{logger[_0x2fd1('0x1f')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x10c350);return _0x16e5fe[_0x2fd1('0x28')]()['then'](function(_0x551500){return BPromise[_0x2fd1('0x26')]({'id':_0x551500[_0x2fd1('0x29')],'name':_0x551500['display_name']});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x10c350);return _0x16e5fe['identity']()['then'](function(_0x59aac0){return BPromise[_0x2fd1('0x26')]({'id':_0x59aac0[_0x2fd1('0x29')],'name':_0x59aac0['display_name']});});}}function getEndUser(_0x1f53a6,_0x467ed1,_0x51411,_0x5de165,_0xcf329e){var _0x26379f={'$or':{'Phone':_0x5de165}};var _0x5ac258={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x2fd1('0x23')](function(){logger[_0x2fd1('0x1f')](_0x2fd1('0x2a'),_0x5de165,_0x467ed1[_0x2fd1('0x2b')]);switch(_0x467ed1[_0x2fd1('0x2b')]){case _0x2fd1('0x2c'):var _0x405681=_[_0x2fd1('0x2d')](_0x26379f);if(_0x467ed1[_0x2fd1('0x2e')]){var _0x58c4e6={};_0x58c4e6[_0x467ed1['additionalSearchContact']]=_0x5de165;_[_0x2fd1('0x2f')](_0x405681['$or'],_0x58c4e6);}return _0xcf329e[_0x2fd1('0x30')](_0x2fd1('0x31'))[_0x2fd1('0x22')](_0x405681,_0x5ac258)['execute']()[_0x2fd1('0x23')](function(_0x114f06){if(_0x114f06&&_0x114f06[_0x2fd1('0x32')]){return _0x114f06;}else{var _0x199ad1=_[_0x2fd1('0x2d')](_0x26379f);if(_0x467ed1[_0x2fd1('0x33')]){var _0x10c53e={};_0x10c53e[_0x467ed1['additionalSearchLead']]=_0x5de165;_[_0x2fd1('0x2f')](_0x199ad1[_0x2fd1('0x34')],_0x10c53e);}return _0xcf329e[_0x2fd1('0x30')]('Lead')['find'](_0x199ad1,_0x5ac258);}});case _0x2fd1('0x35'):var _0x866927=_[_0x2fd1('0x2d')](_0x26379f);if(_0x467ed1['additionalSearchAccount']){var _0x58c4e6={};_0x58c4e6[_0x467ed1['additionalSearchAccount']]=_0x5de165;_['merge'](_0x866927[_0x2fd1('0x34')],_0x58c4e6);}return _0xcf329e[_0x2fd1('0x30')]('Account')[_0x2fd1('0x22')](_0x866927,_0x5ac258)[_0x2fd1('0x36')]()['then'](function(_0x57e080){if(_0x57e080&&_0x57e080['length']){return _0x57e080;}else{var _0x24b35d=_[_0x2fd1('0x2d')](_0x26379f);if(_0x467ed1[_0x2fd1('0x2e')]){var _0xc7e2bd={};_0xc7e2bd[_0x467ed1[_0x2fd1('0x2e')]]=_0x5de165;_['merge'](_0x24b35d[_0x2fd1('0x34')],_0xc7e2bd);}return _0xcf329e[_0x2fd1('0x30')]('Contact')[_0x2fd1('0x22')](_0x24b35d,_0x5ac258)[_0x2fd1('0x23')](function(_0x1fb49b){if(_0x1fb49b&&_0x1fb49b[_0x2fd1('0x32')]){return _0x1fb49b;}else{var _0x1067d5=_[_0x2fd1('0x2d')](_0x26379f);if(_0x467ed1[_0x2fd1('0x33')]){var _0x12b781={};_0x12b781[_0x467ed1[_0x2fd1('0x33')]]=_0x5de165;_['merge'](_0x1067d5[_0x2fd1('0x34')],_0x12b781);}return _0xcf329e[_0x2fd1('0x30')](_0x2fd1('0x37'))['find'](_0x1067d5,_0x5ac258);}});}});case _0x2fd1('0x17'):var _0x405681=_[_0x2fd1('0x2d')](_0x26379f);if(_0x467ed1[_0x2fd1('0x2e')]){var _0x58c4e6={};_0x58c4e6[_0x467ed1['additionalSearchContact']]=_0x5de165;_['merge'](_0x405681[_0x2fd1('0x34')],_0x58c4e6);}return _0xcf329e['sobject'](_0x2fd1('0x31'))[_0x2fd1('0x22')](_0x405681,_0x5ac258)[_0x2fd1('0x36')]();case'lead':var _0x6f0f64=_['cloneDeep'](_0x26379f);if(_0x467ed1[_0x2fd1('0x33')]){var _0x58c4e6={};_0x58c4e6[_0x467ed1['additionalSearchLead']]=_0x5de165;_['merge'](_0x6f0f64[_0x2fd1('0x34')],_0x58c4e6);}return _0xcf329e[_0x2fd1('0x30')](_0x2fd1('0x37'))['find'](_0x6f0f64,_0x5ac258);case'account':var _0x866927=_[_0x2fd1('0x2d')](_0x26379f);if(_0x467ed1['additionalSearchAccount']){var _0x58c4e6={};_0x58c4e6[_0x467ed1[_0x2fd1('0x38')]]=_0x5de165;_[_0x2fd1('0x2f')](_0x866927[_0x2fd1('0x34')],_0x58c4e6);}return _0xcf329e['sobject']('Account')[_0x2fd1('0x22')](_0x866927,_0x5ac258);default:return null;}})[_0x2fd1('0x23')](function(_0x3da5f2){if(_0x3da5f2&&_0x3da5f2[_0x2fd1('0x32')]){var _0x4c5204=_[_0x2fd1('0x39')](_0x3da5f2);if(_0x4c5204){return BPromise[_0x2fd1('0x26')]({'id':_0x4c5204['Id'],'name':_0x4c5204[_0x2fd1('0x27')],'phone':_0x4c5204[_0x2fd1('0x3a')],'endUserType':_0x4c5204[_0x2fd1('0x3b')][_0x2fd1('0x3c')][_0x2fd1('0x3d')]()});}}})[_0x2fd1('0x23')](function(_0x1d7780){if(_0x1d7780){logger[_0x2fd1('0x1f')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x1d7780['endUserType'],_0x5de165);return BPromise[_0x2fd1('0x26')](_0x1d7780);}else{logger[_0x2fd1('0x1f')](_0x2fd1('0x3e'),_0x5de165);var _0xbec88d={'Phone':_0x5de165};if(_0x467ed1['moduleCreate']){if(_0x467ed1[_0x2fd1('0x3f')]==='contact'){logger[_0x2fd1('0x1f')](_0x2fd1('0x40'),_0x5de165,_0x467ed1[_0x2fd1('0x3f')]);_0xbec88d[_0x2fd1('0x41')]=_0x51411!==''?_0x51411:util[_0x2fd1('0x42')](_0x2fd1('0x43'),_0x5de165);}else if(_0x467ed1[_0x2fd1('0x3f')]===_0x2fd1('0x1e')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5de165,_0x467ed1[_0x2fd1('0x3f')]);_0xbec88d[_0x2fd1('0x41')]=_0x51411!==_0x2fd1('0x44')?_0x51411:util['format'](_0x2fd1('0x43'),_0x5de165);_0xbec88d[_0x2fd1('0x45')]=_0x2fd1('0x46');}else if(_0x467ed1['moduleCreate']===_0x2fd1('0x19')){logger[_0x2fd1('0x1f')](_0x2fd1('0x40'),_0x5de165,_0x467ed1[_0x2fd1('0x3f')]);_0xbec88d[_0x2fd1('0x27')]=_0x51411!==''?_0x51411:util[_0x2fd1('0x42')](_0x2fd1('0x43'),_0x5de165);}else{return null;}}return _0xcf329e['sobject'](_[_0x2fd1('0x47')](_0x467ed1[_0x2fd1('0x3f')]))[_0x2fd1('0x20')](_0xbec88d)[_0x2fd1('0x23')](function(_0x3fca64){return BPromise[_0x2fd1('0x26')]({'id':_0x3fca64['id'],'endUserType':_0x467ed1['moduleCreate']});});}});}function getCustomFields(_0x58b4d6,_0x55ce02){var _0x5141b6={};if(_0x58b4d6[_0x2fd1('0x32')]>0x0){_[_0x2fd1('0x48')](_0x58b4d6,function(_0xc4233d){if(_[_0x2fd1('0x49')]([_0x2fd1('0x4a'),'picklist'],_0xc4233d[_0x2fd1('0x3c')])&&_0xc4233d[_0x2fd1('0x4b')]){_0x5141b6[_0xc4233d[_0x2fd1('0x4b')]]=_0xc4233d[_0x2fd1('0x4c')][_0x2fd1('0x4d')]();}else if(_0xc4233d[_0x2fd1('0x3c')]===_0x2fd1('0x4e')&&_0xc4233d[_0x2fd1('0x4f')]&&_0xc4233d[_0x2fd1('0x4b')]){_0x55ce02[_0xc4233d[_0x2fd1('0x4f')]]&&(_0x5141b6[_0xc4233d[_0x2fd1('0x4b')]]=_0x55ce02[_0xc4233d[_0x2fd1('0x4f')]][_0x2fd1('0x4d')]());}else if(_0xc4233d[_0x2fd1('0x3c')]==='customVariable'&&_0xc4233d[_0x2fd1('0x50')]&&_0xc4233d[_0x2fd1('0x50')][_0x2fd1('0x51')]&&_0xc4233d[_0x2fd1('0x4b')]){_0x55ce02[_0xc4233d[_0x2fd1('0x50')][_0x2fd1('0x51')]['toLowerCase']()]&&(_0x5141b6[_0xc4233d['idField']]=_0x55ce02[_0xc4233d[_0x2fd1('0x50')]['name'][_0x2fd1('0x3d')]()][_0x2fd1('0x4d')]());}});}return _0x5141b6;}function getConnection(_0x8bdb73){var _0xeb487a=_0x8bdb73['password'][_0x2fd1('0x52')](_0x8bdb73[_0x2fd1('0x53')]);var _0x3924b9=new jsforce[(_0x2fd1('0x54'))]({'oauth2':{'loginUrl':_0x8bdb73[_0x2fd1('0x55')]||_0x2fd1('0x56'),'clientId':_0x8bdb73[_0x2fd1('0x57')],'clientSecret':_0x8bdb73[_0x2fd1('0x58')]}});return _0x3924b9[_0x2fd1('0x59')](_0x8bdb73[_0x2fd1('0x5a')],_0xeb487a)['then'](function(){logger[_0x2fd1('0x1f')](_0x2fd1('0x5b'));return _0x3924b9;});}exports[_0x2fd1('0x5c')]=function(_0x5d26a6,_0x3e2e7d,_0x4c2a5d,_0x14f578,_0x4dfba0,_0x11d187){var _0x559156,_0xaed26e,_0x37d707,_0x5412d0;_0x11d187['serverUrl']=intUtil['stripTrailingSlash'](_0x11d187[_0x2fd1('0x5d')]);_0x11d187['remoteUri']=intUtil['stripTrailingSlash'](_0x11d187[_0x2fd1('0x55')]);if(_0x4dfba0&&_0x4dfba0[_0x2fd1('0x5e')]){logger[_0x2fd1('0x1f')](_0x2fd1('0x5f'),_0x2fd1('0x60'));_0x3e2e7d['recordingURL']=util[_0x2fd1('0x42')](_0x2fd1('0x61'),_0x11d187[_0x2fd1('0x5d')],_0x3e2e7d[_0x2fd1('0x62')],md5(_0x3e2e7d[_0x2fd1('0x62')]));}else{_0x3e2e7d[_0x2fd1('0x63')]='';}return getConnection(_0x11d187)[_0x2fd1('0x23')](function(_0x52d959){_0x5412d0=_0x52d959;return getUser(_0x11d187,_0x14f578[_0x2fd1('0x64')],_0x5412d0);})[_0x2fd1('0x23')](function(_0x5e3172){_0x559156=_0x5e3172;return getEndUser(_0x11d187,_0x4c2a5d,_0x3e2e7d['calleridname'],_0x3e2e7d[_0x2fd1('0x65')],_0x5412d0);})['then'](function(_0x5d9824){_0xaed26e=_0x5d9824;return getTicket(_0x11d187,_0x559156,_0xaed26e,_0x4c2a5d,_0x3e2e7d,_0x4c2a5d['Fields'],_0x5412d0,_0x2fd1('0x5c'));})['then'](function(_0x59aac6){_0x37d707=_0x59aac6;logger[_0x2fd1('0x1f')](_0x2fd1('0x66'),_0x37d707['id']);logger[_0x2fd1('0x1f')](_0x2fd1('0x67'),_0x37d707['id'],_0x14f578[_0x2fd1('0x51')],_0x11d187[_0x2fd1('0x3c')]);switch(_0x11d187[_0x2fd1('0x3c')]){case _0x2fd1('0x68'):emit(util[_0x2fd1('0x42')]('user:%s',_0x14f578[_0x2fd1('0x51')]),_0x2fd1('0x69'),{'recordId':_0x37d707['id']});break;case _0x2fd1('0x6a'):emit(util[_0x2fd1('0x42')](_0x2fd1('0x6b'),_0x14f578[_0x2fd1('0x51')]),'trigger:browser:url',{'uri':util[_0x2fd1('0x42')](_0x2fd1('0x6c'),_0x5412d0[_0x2fd1('0x6d')],_0x37d707['id'])});break;default:logger['error'](_0x2fd1('0x6e'));}})[_0x2fd1('0x6f')](function(_0xdbcf61){logger[_0x2fd1('0x70')](_0x2fd1('0x5f'),_0xdbcf61);});};exports[_0x2fd1('0x71')]=function(_0x577bd1,_0x42bf92,_0x5b254e,_0x553c57,_0x2c9979,_0x400829,_0x4d5d4e){var _0x430d82,_0x5828c3,_0x4bc614,_0x4a36a5;_0x400829['serverUrl']=intUtil['stripTrailingSlash'](_0x400829['serverUrl']);_0x400829[_0x2fd1('0x55')]=intUtil[_0x2fd1('0x72')](_0x400829[_0x2fd1('0x55')]);if(_0x4d5d4e&&_0x4d5d4e[_0x2fd1('0x73')]&&_0x4d5d4e['recordingFormat']!==_0x2fd1('0x74')){logger[_0x2fd1('0x1f')](_0x2fd1('0x75'),_0x2fd1('0x60'));_0x42bf92[_0x2fd1('0x63')]=util[_0x2fd1('0x42')](_0x2fd1('0x61'),_0x400829['serverUrl'],_0x42bf92[_0x2fd1('0x62')],md5(_0x42bf92['uniqueid']));}return getConnection(_0x400829)[_0x2fd1('0x23')](function(_0x514619){_0x4a36a5=_0x514619;return getUser(_0x400829,_0x553c57[_0x2fd1('0x64')],_0x4a36a5);})[_0x2fd1('0x23')](function(_0x481c7e){_0x430d82=_0x481c7e;return getEndUser(_0x400829,_0x5b254e,_0x42bf92[_0x2fd1('0x76')],_0x42bf92['destcalleridnum'],_0x4a36a5);})[_0x2fd1('0x23')](function(_0x4c728d){_0x5828c3=_0x4c728d;return getTicket(_0x400829,_0x430d82,_0x5828c3,_0x5b254e,_0x42bf92,_0x5b254e[_0x2fd1('0x77')],_0x4a36a5,'outbound');})[_0x2fd1('0x23')](function(_0x385c35){_0x4bc614=_0x385c35;logger[_0x2fd1('0x1f')](_0x2fd1('0x78'),_0x4bc614['id']);logger['info'](_0x2fd1('0x79'),_0x4bc614['id'],_0x553c57[_0x2fd1('0x51')],_0x400829[_0x2fd1('0x3c')]);switch(_0x400829[_0x2fd1('0x3c')]){case _0x2fd1('0x68'):emit(util[_0x2fd1('0x42')]('user:%s',_0x553c57[_0x2fd1('0x51')]),_0x2fd1('0x69'),{'recordId':_0x4bc614['id']});break;case'newTab':emit(util['format'](_0x2fd1('0x6b'),_0x553c57[_0x2fd1('0x51')]),'trigger:browser:url',{'uri':util['format'](_0x2fd1('0x6c'),_0x4a36a5[_0x2fd1('0x6d')],_0x4bc614['id'])});break;default:logger['error']('[OUTBOUND]',_0x2fd1('0x7a'));}})[_0x2fd1('0x6f')](function(_0x5450c3){logger[_0x2fd1('0x70')](_0x2fd1('0x75'),_0x5450c3);});};exports['unmanaged']=function(_0x127244,_0xa89aab,_0x586914,_0x10c4bc,_0x4229fa,_0x49e31b){var _0x42f78c,_0x463f5c,_0x2dd038,_0x25f64f;_0x49e31b['serverUrl']=intUtil[_0x2fd1('0x72')](_0x49e31b[_0x2fd1('0x5d')]);_0x49e31b[_0x2fd1('0x55')]=intUtil[_0x2fd1('0x72')](_0x49e31b[_0x2fd1('0x55')]);if(_0x4229fa&&_0x4229fa['monitor_format']){logger[_0x2fd1('0x1f')]('['+_0xa89aab[_0x2fd1('0x7b')]['toUpperCase']()+']',_0x2fd1('0x60'));_0xa89aab[_0x2fd1('0x63')]=util[_0x2fd1('0x42')](_0x2fd1('0x61'),_0x49e31b[_0x2fd1('0x5d')],_0xa89aab[_0x2fd1('0x62')],md5(_0xa89aab['uniqueid']));}else{_0xa89aab[_0x2fd1('0x63')]='';}return getConnection(_0x49e31b)[_0x2fd1('0x23')](function(_0x4a3a47){_0x25f64f=_0x4a3a47;if(!_[_0x2fd1('0x7c')](_0x10c4bc)){return getUser(_0x49e31b,_0x10c4bc['name'],_0x25f64f);}else{return getUser(_0x49e31b,null,_0x25f64f);}})[_0x2fd1('0x23')](function(_0x20a8de){_0x42f78c=_0x20a8de;return getEndUser(_0x49e31b,_0x586914,_0xa89aab[_0x2fd1('0x7d')],_0xa89aab['calleridnum'],_0x25f64f);})[_0x2fd1('0x23')](function(_0x360198){_0x463f5c=_0x360198;return getTicket(_0x49e31b,_0x42f78c,_0x463f5c,_0x586914,_0xa89aab,_0x586914['Fields'],_0x25f64f);})['then'](function(_0x4e6a57){_0x2dd038=_0x4e6a57;logger[_0x2fd1('0x1f')]('['+_0xa89aab[_0x2fd1('0x7b')][_0x2fd1('0x7e')]()+_0x2fd1('0x7f'),_0x2dd038['id']);logger[_0x2fd1('0x1f')]('['+_0xa89aab[_0x2fd1('0x7b')][_0x2fd1('0x7e')]()+_0x2fd1('0x80'),_0x49e31b[_0x2fd1('0x3c')]);})[_0x2fd1('0x6f')](function(_0x326ab2){logger['error']('['+_0xa89aab[_0x2fd1('0x7b')][_0x2fd1('0x7e')]()+']',_0x326ab2);});}; \ 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 822b735..16f0051 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 _0x0d84=['true','userId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','variableName','idField','toString','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','catch','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length'];(function(_0xdb0316,_0x1699ee){var _0xe43c0d=function(_0x104299){while(--_0x104299){_0xdb0316['push'](_0xdb0316['shift']());}};_0xe43c0d(++_0x1699ee);}(_0x0d84,0x198));var _0x40d8=function(_0x38dca,_0x14fb81){_0x38dca=_0x38dca-0x0;var _0x1e93f3=_0x0d84[_0x38dca];return _0x1e93f3;};'use strict';var _=require(_0x40d8('0x0'));var Promise=require(_0x40d8('0x1'));var rp=require(_0x40d8('0x2'));var util=require(_0x40d8('0x3'));var md5=require(_0x40d8('0x4'));var Redis=require(_0x40d8('0x5'));var intUtil=require('./util');var config=require(_0x40d8('0x6'));var logger=require(_0x40d8('0x7'))(_0x40d8('0x8'));config['redis']=_[_0x40d8('0x9')](config[_0x40d8('0xa')],{'host':_0x40d8('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x34339b,_0x438de2,_0x4858b5,_0x3c217d,_0x2e2fde,_0x4cd2c0){return new Promise(function(_0x5d4b96,_0x59d668){var _0x1e0708={'method':_0x40d8('0xc'),'uri':_0x3c217d+_0x40d8('0xd')+'&'+_0x2e2fde+'&'+_0x4cd2c0,'auth':_0x438de2,'json':!![]};return rp(_0x1e0708)[_0x40d8('0xe')](function(_0x55182e){if(_0x55182e[_0x40d8('0xf')]['length']>0x0){_0x4858b5[_0x40d8('0x10')]=_0x55182e[_0x40d8('0xf')][0x0][_0x40d8('0x11')];}logger[_0x40d8('0x12')]('['+[_0x34339b[_0x40d8('0x13')]()]+'],\x20getAdminUser\x20crm',_0x4858b5);_0x5d4b96(_0x4858b5);})[_0x40d8('0x14')](function(_0x371002){logger['error']('['+[_0x34339b['toUpperCase']()]+']',_0x371002[_0x40d8('0x15')]);_0x59d668(_0x371002[_0x40d8('0x15')]);});});}function getUser(_0x1c5fbc,_0x3b32ad,_0x375460,_0x5720e8,_0xb510ee){return function(_0x57db36){logger[_0x40d8('0x12')]('['+[_0x1c5fbc['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x57db36);return new Promise(function(_0xe298f0,_0x1b1f52){if(intUtil[_0x40d8('0x16')](_0x57db36[_0x40d8('0x17')])){var _0xb5c164={'method':_0x40d8('0xc'),'uri':_0x375460+_0x40d8('0x18')+_0x57db36['userEmail']+'&'+_0x5720e8+'&'+_0xb510ee,'auth':_0x3b32ad,'json':!![]};logger[_0x40d8('0x12')]('['+[_0x1c5fbc['toUpperCase']()]+_0x40d8('0x19'),_0xb5c164);return rp(_0xb5c164)[_0x40d8('0xe')](function(_0x20d147){logger[_0x40d8('0x12')]('['+[_0x1c5fbc['toUpperCase']()]+_0x40d8('0x1a'),_0x20d147);if(_0x20d147[_0x40d8('0xf')][_0x40d8('0x1b')]>0x0&&String(_0x20d147[_0x40d8('0xf')][0x0]['active'])===_0x40d8('0x1c')){_0x57db36[_0x40d8('0x1d')]=_0x20d147[_0x40d8('0xf')][0x0][_0x40d8('0x11')];}else{_0x57db36[_0x40d8('0x1d')]=_0x57db36[_0x40d8('0x10')];_0x57db36[_0x40d8('0x17')]=_0x57db36[_0x40d8('0x1e')];}logger[_0x40d8('0x12')]('['+[_0x1c5fbc[_0x40d8('0x13')]()]+_0x40d8('0x1f'),_0x57db36);_0xe298f0(_0x57db36);})[_0x40d8('0x14')](function(_0x175955){logger[_0x40d8('0x20')]('['+[_0x1c5fbc[_0x40d8('0x13')]()]+']',_0x175955[_0x40d8('0x15')]);_0x1b1f52(_0x175955[_0x40d8('0x15')]);});}else{logger['info']('['+[_0x1c5fbc['toUpperCase']()]+_0x40d8('0x21'));_0x57db36[_0x40d8('0x1d')]=_0x57db36[_0x40d8('0x10')];_0x57db36[_0x40d8('0x17')]=_0x57db36[_0x40d8('0x1e')];_0xe298f0(_0x57db36);}});};}function createEndUser(_0x20deb0,_0x50c47f,_0x53d133,_0x5786d9,_0x1095bd){logger[_0x40d8('0x12')]('['+[_0x20deb0[_0x40d8('0x13')]()]+_0x40d8('0x22'),_0x53d133);return new Promise(function(_0x4e0fed,_0x7b67d8){var _0x269667={'method':_0x40d8('0x23'),'uri':_0x5786d9+_0x40d8('0x24')+_0x1095bd,'body':{'user_name':_0x53d133[_0x40d8('0x25')],'roles':_0x40d8('0x26'),'first_name':_0x53d133[_0x40d8('0x25')],'active':_0x40d8('0x1c'),'date_format':_0x40d8('0x27'),'phone':_0x53d133[_0x40d8('0x25')]},'auth':_0x50c47f,'json':!![]};return rp(_0x269667)[_0x40d8('0xe')](function(_0x3dda21){logger['info']('['+[_0x20deb0[_0x40d8('0x13')]()]+'],\x20EndUser\x20schema',_0x3dda21['result']);_0x53d133[_0x40d8('0x28')]=_0x3dda21['result']['sys_id'];_0x4e0fed(_0x53d133);})[_0x40d8('0x14')](function(_0x48e053){logger['error']('['+[_0x20deb0['toUpperCase']()]+']',_0x48e053[_0x40d8('0x15')]);_0x7b67d8(_0x48e053[_0x40d8('0x15')]);});});}function getEndUser(_0x76d249,_0x5e7cda,_0x4b6ab4,_0x3e69be,_0x36c47a){return function(_0x2b67cf){logger[_0x40d8('0x12')]('['+[_0x76d249[_0x40d8('0x13')]()]+_0x40d8('0x29'),_0x2b67cf);return new Promise(function(_0x49a99a,_0x380027){var _0xec052d={'method':_0x40d8('0xc'),'uri':_0x4b6ab4+'sys_user?sysparm_query=phone%3D'+_0x2b67cf[_0x40d8('0x25')]+'&'+_0x3e69be+'&'+_0x36c47a,'auth':_0x5e7cda,'json':!![]};return rp(_0xec052d)[_0x40d8('0xe')](function(_0x37359a){if(_0x37359a[_0x40d8('0xf')][_0x40d8('0x1b')]>0x0){_0x2b67cf['endUserId']=_0x37359a[_0x40d8('0xf')][0x0][_0x40d8('0x11')];logger['info']('['+[_0x76d249[_0x40d8('0x13')]()]+_0x40d8('0x2a'),_0x2b67cf);_0x49a99a(_0x2b67cf);}else{return createEndUser(_0x76d249,_0x5e7cda,_0x2b67cf,_0x4b6ab4,_0x3e69be)[_0x40d8('0xe')](function(_0x5a1c26){logger[_0x40d8('0x12')]('['+[_0x76d249[_0x40d8('0x13')]()]+_0x40d8('0x2b'),_0x5a1c26);_0x49a99a(_0x5a1c26);});}})[_0x40d8('0x14')](function(_0x48f241){logger['error']('['+[_0x76d249['toUpperCase']()]+']',_0x48f241['message']);_0x380027(_0x48f241[_0x40d8('0x15')]);});});};}function getCustomFields(_0x1451e4,_0x5dd9ae){var _0x47e70d={};if(_0x1451e4[_0x40d8('0x1b')]>0x0){_[_0x40d8('0x2c')](_0x1451e4,function(_0x311ba4){if(_[_0x40d8('0x2d')]([_0x40d8('0x2e'),_0x40d8('0x2f')],_0x311ba4[_0x40d8('0x30')])&&_0x311ba4['nameField']&&!_0x311ba4[_0x40d8('0x31')]){_0x47e70d[_0x311ba4[_0x40d8('0x32')][_0x40d8('0x33')]()]=_0x311ba4['content']['toString']();}else if(_[_0x40d8('0x2d')]([_0x40d8('0x2e'),_0x40d8('0x2f')],_0x311ba4[_0x40d8('0x30')])&&_0x311ba4['idField']&&_0x311ba4[_0x40d8('0x31')]){_0x47e70d[_0x311ba4['idField'][_0x40d8('0x33')]()]=_0x311ba4['content']['toString']();}else if(_0x311ba4[_0x40d8('0x30')]==='variable'&&_0x311ba4[_0x40d8('0x34')]&&_0x311ba4[_0x40d8('0x35')]&&_0x311ba4[_0x40d8('0x31')]){_0x47e70d[_0x311ba4['idField'][_0x40d8('0x33')]()]=_0x5dd9ae[_0x311ba4[_0x40d8('0x34')]][_0x40d8('0x36')]();}else if(_0x311ba4[_0x40d8('0x30')]===_0x40d8('0x37')&&_0x311ba4[_0x40d8('0x38')]&&_0x311ba4[_0x40d8('0x38')][_0x40d8('0x39')]&&_0x311ba4[_0x40d8('0x35')]&&_0x311ba4[_0x40d8('0x31')]){_0x47e70d[_0x311ba4[_0x40d8('0x35')][_0x40d8('0x33')]()]=_0x5dd9ae[_0x311ba4[_0x40d8('0x38')]['name']['toLowerCase']()][_0x40d8('0x36')]();}});}return _0x47e70d;}function getTicket(_0x32dcc4,_0x12e93d,_0x962eb6,_0x5432ae,_0x5d6614,_0x69abcc){return function(_0x241593){logger[_0x40d8('0x12')]('['+[_0x32dcc4[_0x40d8('0x13')]()]+_0x40d8('0x3a'),_0x241593);return new Promise(function(_0x1e3b27,_0x1b1c70){var _0x169b86=_0x32dcc4[_0x40d8('0x33')]()===_0x40d8('0x3b')?_0x241593[_0x40d8('0x1d')]:_0x241593[_0x40d8('0x28')];var _0x5820c1={'method':_0x40d8('0x23'),'uri':_0x962eb6+_0x40d8('0x3c')+'?'+_0x69abcc,'body':Object['assign']({},{'active':'true','caller_id':_0x169b86,'assigned_to':_0x241593['userId'],'short_description':intUtil[_0x40d8('0x3d')](_0x5432ae[_0x40d8('0x3e')],_0x5d6614,'\x20'),'description':intUtil[_0x40d8('0x3d')](_0x5432ae['Descriptions'],_0x5d6614,'\x0a')},getCustomFields(_0x5432ae[_0x40d8('0x3f')],_0x5d6614)),'auth':_0x12e93d,'json':!![]};return rp(_0x5820c1)[_0x40d8('0xe')](function(_0x3df4e3){logger[_0x40d8('0x12')]('['+[_0x32dcc4[_0x40d8('0x13')]()]+_0x40d8('0x40'),_0x3df4e3[_0x40d8('0xf')]);_0x241593[_0x40d8('0x41')]=_0x3df4e3[_0x40d8('0xf')][_0x40d8('0x11')];_0x241593[_0x40d8('0x42')]=_0x3df4e3['result'][_0x40d8('0x43')];logger['info']('['+[_0x32dcc4[_0x40d8('0x13')]()]+_0x40d8('0x44'),_0x241593);_0x1e3b27(_0x241593);})['catch'](function(_0xca613c){logger[_0x40d8('0x20')]('['+[_0x32dcc4[_0x40d8('0x13')]()]+']',_0xca613c[_0x40d8('0x15')]);_0x1b1c70(_0xca613c[_0x40d8('0x15')]);});});};}function createRemoteTag(_0x1dc9d4,_0x5a66ac,_0x2ae9c6,_0x5aa2ef){return new Promise(function(_0x47eb84,_0x4f0fd8){var _0x527747={'method':_0x40d8('0x23'),'uri':_0x2ae9c6+_0x40d8('0x45')+'?'+_0x5aa2ef,'body':{'short_description':_0x1dc9d4,'global':!![],'active':!![],'name':_0x1dc9d4},'auth':_0x5a66ac,'json':!![]};return rp(_0x527747)['then'](function(_0x3ec3a9){var _0x2725a4=_0x3ec3a9[_0x40d8('0xf')]['sys_id'];_0x47eb84(_0x2725a4);});});}function getRemoteTag(_0x1860b9,_0x42fa27,_0xa91c19,_0x2da7a1,_0x326c06){return new Promise(function(_0x10a5e7,_0x596e86){var _0x3093b7={'method':_0x40d8('0xc'),'uri':_0xa91c19+_0x40d8('0x45')+_0x40d8('0x46')+_0x1860b9+'&'+_0x2da7a1,'auth':_0x42fa27,'json':!![]};return rp(_0x3093b7)[_0x40d8('0xe')](function(_0x10f23a){if(_0x10f23a[_0x40d8('0xf')][_0x40d8('0x1b')]>0x0){var _0x2f8f98=_0x10f23a[_0x40d8('0xf')][0x0]['sys_id'];_0x10a5e7(_0x2f8f98);}else{return createRemoteTag(_0x1860b9,_0x42fa27,_0xa91c19,_0x2da7a1)['then'](function(_0x88f27f){_0x10a5e7(_0x88f27f);});}});});}function assignTagToIncident(_0x433027,_0x4be262,_0x4eb2a0,_0x12f023,_0x35e7f8){return new Promise(function(_0x4b1879,_0x565041){var _0xac7037={'method':_0x40d8('0x23'),'uri':_0x4eb2a0+_0x40d8('0x47')+'?'+_0x35e7f8,'body':{'label':_0x433027,'table':'incident','id_type':_0x40d8('0x48'),'table_key':_0x12f023['ticketId'],'title':'Incident\x20-\x20'+_0x12f023[_0x40d8('0x42')],'id_display':_0x12f023['ticketNumber']},'auth':_0x4be262,'json':!![]};return rp(_0xac7037)['then'](function(_0xb4911){_0x4b1879();})[_0x40d8('0x14')](function(){_0x4b1879();});});}function manageTags(_0x5c2d3c,_0x4b3656,_0x409c0e,_0x48da23,_0xdcb7c,_0x445a0f,_0x23edb2){return new Promise(function(_0x1bd094,_0x52b45b){var _0x309299=[];_0x4b3656[_0x40d8('0x2c')](function(_0x391483){_0x309299[_0x40d8('0x49')](getRemoteTag(_0x391483,_0x409c0e,_0x48da23,_0x445a0f,_0x23edb2));});return Promise[_0x40d8('0x4a')](_0x309299)[_0x40d8('0xe')](function(_0x587b57){if(_0x587b57[_0x40d8('0x1b')]){logger[_0x40d8('0x12')]('['+[_0x5c2d3c[_0x40d8('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x587b57);var _0x20a45f=[];_0x587b57[_0x40d8('0x2c')](function(_0x37fbd8){_0x20a45f[_0x40d8('0x49')](assignTagToIncident(_0x37fbd8,_0x409c0e,_0x48da23,_0xdcb7c,_0x445a0f));});return Promise[_0x40d8('0x4a')](_0x20a45f)['then'](function(){_0x1bd094();})[_0x40d8('0x14')](function(){_0x1bd094();});}else{_0x1bd094();}});});}function getTags(_0x3764c6,_0x3afc93,_0x2dfc41,_0x370046,_0x8e887b,_0x5f0811){return function(_0x310cca){return new Promise(function(_0x2ad6d3,_0x31d713){var _0x27111d=[];var _0x1dee85=_0x370046[_0x40d8('0x4b')];if(_0x1dee85&&_0x1dee85[_0x40d8('0x1b')]>0x0){_0x27111d=_[_0x40d8('0x4c')](_0x1dee85,_0x40d8('0x39'));}if(_0x27111d['length']>0x0){return manageTags(_0x3764c6,_0x27111d,_0x3afc93,_0x2dfc41,_0x310cca,_0x8e887b,_0x5f0811)['then'](function(){_0x2ad6d3(_0x310cca);});}else{_0x2ad6d3(_0x310cca);}});};}function emit(_0x38caec,_0x41fb2f,_0x88b61f){var _0x3e84fa=_0x40d8('0x4d')+_0x40d8('0x4e')+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x52b082={'uri':_0x38caec+_0x40d8('0x4f')+_0x88b61f+_0x3e84fa};io['to'](util[_0x40d8('0x50')]('user:%s',_0x41fb2f))[_0x40d8('0x51')](_0x40d8('0x52'),_0x52b082);}exports['cs']=function(_0x30d651,_0x5467e0,_0x193448,_0x3a7644,_0x33c2a0,_0x5f221b,_0x633574,_0x369575){var _0x47f3c1={};var _0x521f44={'user':_0x5f221b[_0x40d8('0x53')],'pass':_0x5f221b[_0x40d8('0x54')]};var _0x37c115=_0x40d8('0x55');var _0x2a0a9a=_0x40d8('0x56');_0x5f221b[_0x40d8('0x57')]=intUtil['stripTrailingSlash'](_0x5f221b['remoteUri']);_0x5f221b[_0x40d8('0x58')]=intUtil[_0x40d8('0x59')](_0x5f221b[_0x40d8('0x58')]);var _0x522f94=util['format'](_0x40d8('0x5a'),_0x5f221b[_0x40d8('0x57')]);_0x47f3c1[_0x40d8('0x17')]=!_[_0x40d8('0x5b')](_0x3a7644)?_0x3a7644[_0x40d8('0x5c')]:null;_0x47f3c1[_0x40d8('0x1e')]=_0x5f221b[_0x40d8('0x5c')];_0x47f3c1[_0x40d8('0x25')]=_0x369575[_0x40d8('0x33')]()==='outbound'?_0x5467e0[_0x40d8('0x5d')]:_0x5467e0[_0x40d8('0x5e')];_0x47f3c1[_0x40d8('0x5f')]=_0x369575===_0x40d8('0x60')||_0x369575===_0x40d8('0x61')?_0x40d8('0x60'):'outbound';var _0x461e17=util[_0x40d8('0x50')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5f221b[_0x40d8('0x58')],_0x5467e0[_0x40d8('0x62')],md5(_0x5467e0['uniqueid']));if(_0x33c2a0&&_0x33c2a0[_0x40d8('0x63')]){logger['info'](_0x40d8('0x64'),_0x40d8('0x65'));_0x5467e0[_0x40d8('0x66')]=_0x461e17;}else if(_0x633574&&_0x633574['recordingFormat']&&_0x633574['recordingFormat']!==_0x40d8('0x67')){logger[_0x40d8('0x12')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5467e0[_0x40d8('0x66')]=_0x461e17;}else{_0x5467e0[_0x40d8('0x66')]='';}return getAdminUser(_0x369575,_0x521f44,_0x47f3c1,_0x522f94,_0x2a0a9a,_0x37c115)[_0x40d8('0xe')](getUser(_0x369575,_0x521f44,_0x522f94,_0x2a0a9a,_0x37c115))[_0x40d8('0xe')](getEndUser(_0x369575,_0x521f44,_0x522f94,_0x2a0a9a,_0x37c115))[_0x40d8('0xe')](getTicket(_0x369575,_0x521f44,_0x522f94,_0x193448,_0x5467e0,_0x2a0a9a))[_0x40d8('0xe')](function(_0x2a2137){logger['info'](util[_0x40d8('0x50')](_0x40d8('0x68'),_0x2a2137[_0x40d8('0x41')]));logger['info'](util[_0x40d8('0x50')](_0x40d8('0x69'),_0x369575));if(_0x369575!==_0x40d8('0x61')){logger[_0x40d8('0x12')]('['+[_0x369575[_0x40d8('0x13')]()]+']',_0x40d8('0x6a'));emit(_0x5f221b[_0x40d8('0x57')],_0x3a7644['name'],_0x2a2137[_0x40d8('0x41')]);}})[_0x40d8('0x14')](function(_0x3ebfc7){logger['error']('['+[_0x369575['toUpperCase']()]+_0x40d8('0x6b'),util[_0x40d8('0x6c')](_0x3ebfc7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xeb81=['picklist','type','nameField','toLowerCase','toString','customField','idField','variable','variableName','name','Variable',']\x20getTicket\x20input\x20crm','outbound','endUserId','incident','assign','getString','Subjects','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','trigger:browser:url','username','password','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','active','userId','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string'];(function(_0x2b5517,_0x117eba){var _0x4fdffd=function(_0x28da1e){while(--_0x28da1e){_0x2b5517['push'](_0x2b5517['shift']());}};_0x4fdffd(++_0x117eba);}(_0xeb81,0x1ce));var _0x1eb8=function(_0x1dfbf0,_0x25aa11){_0x1dfbf0=_0x1dfbf0-0x0;var _0x248732=_0xeb81[_0x1dfbf0];return _0x248732;};'use strict';var _=require('lodash');var Promise=require(_0x1eb8('0x0'));var rp=require(_0x1eb8('0x1'));var util=require(_0x1eb8('0x2'));var md5=require(_0x1eb8('0x3'));var Redis=require(_0x1eb8('0x4'));var intUtil=require(_0x1eb8('0x5'));var config=require(_0x1eb8('0x6'));var logger=require(_0x1eb8('0x7'))(_0x1eb8('0x8'));config['redis']=_[_0x1eb8('0x9')](config[_0x1eb8('0xa')],{'host':_0x1eb8('0xb'),'port':0x18eb});var io=require(_0x1eb8('0xc'))(new Redis(config['redis']));function getAdminUser(_0x7b5014,_0x4b3a16,_0x22c653,_0x3fb080,_0x4a4fe0,_0x399d6b){return new Promise(function(_0xe92610,_0x1f9ec1){var _0x6e4e7f={'method':_0x1eb8('0xd'),'uri':_0x3fb080+_0x1eb8('0xe')+'&'+_0x4a4fe0+'&'+_0x399d6b,'auth':_0x4b3a16,'json':!![]};return rp(_0x6e4e7f)[_0x1eb8('0xf')](function(_0x56f2d1){if(_0x56f2d1[_0x1eb8('0x10')][_0x1eb8('0x11')]>0x0){_0x22c653[_0x1eb8('0x12')]=_0x56f2d1['result'][0x0][_0x1eb8('0x13')];}logger[_0x1eb8('0x14')]('['+[_0x7b5014[_0x1eb8('0x15')]()]+_0x1eb8('0x16'),_0x22c653);_0xe92610(_0x22c653);})['catch'](function(_0x4cfc55){logger[_0x1eb8('0x17')]('['+[_0x7b5014[_0x1eb8('0x15')]()]+']',_0x4cfc55[_0x1eb8('0x18')]);_0x1f9ec1(_0x4cfc55[_0x1eb8('0x18')]);});});}function getUser(_0x10f8a1,_0x3a1563,_0x34497e,_0x2f103c,_0x5a2804){return function(_0x993687){logger['info']('['+[_0x10f8a1[_0x1eb8('0x15')]()]+_0x1eb8('0x19'),_0x993687);return new Promise(function(_0x373641,_0x208eb1){if(intUtil[_0x1eb8('0x1a')](_0x993687[_0x1eb8('0x1b')])){var _0x193b06={'method':'GET','uri':_0x34497e+'sys_user?sysparm_query=email%3D'+_0x993687[_0x1eb8('0x1b')]+'&'+_0x2f103c+'&'+_0x5a2804,'auth':_0x3a1563,'json':!![]};logger[_0x1eb8('0x14')]('['+[_0x10f8a1['toUpperCase']()]+_0x1eb8('0x1c'),_0x193b06);return rp(_0x193b06)[_0x1eb8('0xf')](function(_0x1b5ecc){logger[_0x1eb8('0x14')]('['+[_0x10f8a1[_0x1eb8('0x15')]()]+'],\x20getUser\x20entity',_0x1b5ecc);if(_0x1b5ecc[_0x1eb8('0x10')]['length']>0x0&&String(_0x1b5ecc[_0x1eb8('0x10')][0x0][_0x1eb8('0x1d')])==='true'){_0x993687[_0x1eb8('0x1e')]=_0x1b5ecc[_0x1eb8('0x10')][0x0]['sys_id'];}else{_0x993687[_0x1eb8('0x1e')]=_0x993687[_0x1eb8('0x12')];_0x993687[_0x1eb8('0x1b')]=_0x993687['adminEmail'];}logger[_0x1eb8('0x14')]('['+[_0x10f8a1['toUpperCase']()]+_0x1eb8('0x1f'),_0x993687);_0x373641(_0x993687);})[_0x1eb8('0x20')](function(_0x221086){logger[_0x1eb8('0x17')]('['+[_0x10f8a1[_0x1eb8('0x15')]()]+']',_0x221086['message']);_0x208eb1(_0x221086[_0x1eb8('0x18')]);});}else{logger[_0x1eb8('0x14')]('['+[_0x10f8a1[_0x1eb8('0x15')]()]+_0x1eb8('0x21'));_0x993687[_0x1eb8('0x1e')]=_0x993687[_0x1eb8('0x12')];_0x993687[_0x1eb8('0x1b')]=_0x993687[_0x1eb8('0x22')];_0x373641(_0x993687);}});};}function createEndUser(_0x135447,_0x309dd1,_0x4f94a8,_0x22a150,_0x4832bf){logger[_0x1eb8('0x14')]('['+[_0x135447[_0x1eb8('0x15')]()]+_0x1eb8('0x23'),_0x4f94a8);return new Promise(function(_0x4aa9ce,_0x33d93b){var _0x243962={'method':_0x1eb8('0x24'),'uri':_0x22a150+_0x1eb8('0x25')+_0x4832bf,'body':{'user_name':_0x4f94a8[_0x1eb8('0x26')],'roles':_0x1eb8('0x27'),'first_name':_0x4f94a8[_0x1eb8('0x26')],'active':_0x1eb8('0x28'),'date_format':'System','phone':_0x4f94a8['endUserNumber']},'auth':_0x309dd1,'json':!![]};return rp(_0x243962)[_0x1eb8('0xf')](function(_0x296c22){logger[_0x1eb8('0x14')]('['+[_0x135447[_0x1eb8('0x15')]()]+_0x1eb8('0x29'),_0x296c22[_0x1eb8('0x10')]);_0x4f94a8['endUserId']=_0x296c22[_0x1eb8('0x10')]['sys_id'];_0x4aa9ce(_0x4f94a8);})[_0x1eb8('0x20')](function(_0x3e68c1){logger[_0x1eb8('0x17')]('['+[_0x135447[_0x1eb8('0x15')]()]+']',_0x3e68c1[_0x1eb8('0x18')]);_0x33d93b(_0x3e68c1[_0x1eb8('0x18')]);});});}function getEndUser(_0x56f6a4,_0x59e22c,_0x422a4f,_0xf30790,_0x31d089){return function(_0x533cea){logger['info']('['+[_0x56f6a4[_0x1eb8('0x15')]()]+'],\x20getEndUser\x20input\x20crm',_0x533cea);return new Promise(function(_0x39dacd,_0x22f899){var _0x38ae4d={'method':'GET','uri':_0x422a4f+_0x1eb8('0x2a')+_0x533cea[_0x1eb8('0x26')]+'&'+_0xf30790+'&'+_0x31d089,'auth':_0x59e22c,'json':!![]};return rp(_0x38ae4d)[_0x1eb8('0xf')](function(_0x5101ff){if(_0x5101ff[_0x1eb8('0x10')][_0x1eb8('0x11')]>0x0){_0x533cea['endUserId']=_0x5101ff['result'][0x0][_0x1eb8('0x13')];logger[_0x1eb8('0x14')]('['+[_0x56f6a4[_0x1eb8('0x15')]()]+_0x1eb8('0x2b'),_0x533cea);_0x39dacd(_0x533cea);}else{return createEndUser(_0x56f6a4,_0x59e22c,_0x533cea,_0x422a4f,_0xf30790)[_0x1eb8('0xf')](function(_0x42e55d){logger[_0x1eb8('0x14')]('['+[_0x56f6a4['toUpperCase']()]+_0x1eb8('0x2c'),_0x42e55d);_0x39dacd(_0x42e55d);});}})[_0x1eb8('0x20')](function(_0x5d51ae){logger[_0x1eb8('0x17')]('['+[_0x56f6a4['toUpperCase']()]+']',_0x5d51ae[_0x1eb8('0x18')]);_0x22f899(_0x5d51ae[_0x1eb8('0x18')]);});});};}function getCustomFields(_0x27f641,_0x42f423){var _0xb1b5f9={};if(_0x27f641[_0x1eb8('0x11')]>0x0){_[_0x1eb8('0x2d')](_0x27f641,function(_0xf7ad75){if(_[_0x1eb8('0x2e')]([_0x1eb8('0x2f'),_0x1eb8('0x30')],_0xf7ad75[_0x1eb8('0x31')])&&_0xf7ad75[_0x1eb8('0x32')]&&!_0xf7ad75['customField']){_0xb1b5f9[_0xf7ad75[_0x1eb8('0x32')][_0x1eb8('0x33')]()]=_0xf7ad75['content'][_0x1eb8('0x34')]();}else if(_[_0x1eb8('0x2e')]([_0x1eb8('0x2f'),'picklist'],_0xf7ad75[_0x1eb8('0x31')])&&_0xf7ad75['idField']&&_0xf7ad75[_0x1eb8('0x35')]){_0xb1b5f9[_0xf7ad75[_0x1eb8('0x36')]['toLowerCase']()]=_0xf7ad75['content'][_0x1eb8('0x34')]();}else if(_0xf7ad75[_0x1eb8('0x31')]===_0x1eb8('0x37')&&_0xf7ad75[_0x1eb8('0x38')]&&_0xf7ad75['idField']&&_0xf7ad75[_0x1eb8('0x35')]){_0xb1b5f9[_0xf7ad75[_0x1eb8('0x36')]['toLowerCase']()]=_0x42f423[_0xf7ad75[_0x1eb8('0x38')]][_0x1eb8('0x34')]();}else if(_0xf7ad75['type']==='customVariable'&&_0xf7ad75['Variable']&&_0xf7ad75['Variable'][_0x1eb8('0x39')]&&_0xf7ad75[_0x1eb8('0x36')]&&_0xf7ad75[_0x1eb8('0x35')]){_0xb1b5f9[_0xf7ad75[_0x1eb8('0x36')][_0x1eb8('0x33')]()]=_0x42f423[_0xf7ad75[_0x1eb8('0x3a')][_0x1eb8('0x39')][_0x1eb8('0x33')]()][_0x1eb8('0x34')]();}});}return _0xb1b5f9;}function getTicket(_0x1cda4b,_0x5dd8e8,_0x57b060,_0x2dc3e1,_0x4bb03e,_0xf64edc){return function(_0x57e303){logger[_0x1eb8('0x14')]('['+[_0x1cda4b[_0x1eb8('0x15')]()]+_0x1eb8('0x3b'),_0x57e303);return new Promise(function(_0x40fecf,_0x58f849){var _0x341c0a=_0x1cda4b['toLowerCase']()===_0x1eb8('0x3c')?_0x57e303['userId']:_0x57e303[_0x1eb8('0x3d')];var _0x494533={'method':_0x1eb8('0x24'),'uri':_0x57b060+_0x1eb8('0x3e')+'?'+_0xf64edc,'body':Object[_0x1eb8('0x3f')]({},{'active':'true','caller_id':_0x341c0a,'assigned_to':_0x57e303[_0x1eb8('0x1e')],'short_description':intUtil[_0x1eb8('0x40')](_0x2dc3e1[_0x1eb8('0x41')],_0x4bb03e,'\x20'),'description':intUtil[_0x1eb8('0x40')](_0x2dc3e1['Descriptions'],_0x4bb03e,'\x0a')},getCustomFields(_0x2dc3e1['Fields'],_0x4bb03e)),'auth':_0x5dd8e8,'json':!![]};return rp(_0x494533)[_0x1eb8('0xf')](function(_0x26b5e4){logger['info']('['+[_0x1cda4b[_0x1eb8('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x26b5e4[_0x1eb8('0x10')]);_0x57e303[_0x1eb8('0x42')]=_0x26b5e4[_0x1eb8('0x10')][_0x1eb8('0x13')];_0x57e303[_0x1eb8('0x43')]=_0x26b5e4[_0x1eb8('0x10')][_0x1eb8('0x44')];logger[_0x1eb8('0x14')]('['+[_0x1cda4b[_0x1eb8('0x15')]()]+']\x20getTicket\x20crm',_0x57e303);_0x40fecf(_0x57e303);})['catch'](function(_0x28cfaa){logger[_0x1eb8('0x17')]('['+[_0x1cda4b['toUpperCase']()]+']',_0x28cfaa[_0x1eb8('0x18')]);_0x58f849(_0x28cfaa[_0x1eb8('0x18')]);});});};}function createRemoteTag(_0x2a1aaa,_0x7446de,_0x43e2a4,_0x36ccb1){return new Promise(function(_0x17cf7c,_0x2defaa){var _0x506d7d={'method':'POST','uri':_0x43e2a4+_0x1eb8('0x45')+'?'+_0x36ccb1,'body':{'short_description':_0x2a1aaa,'global':!![],'active':!![],'name':_0x2a1aaa},'auth':_0x7446de,'json':!![]};return rp(_0x506d7d)[_0x1eb8('0xf')](function(_0x2160c6){var _0x38cef4=_0x2160c6['result']['sys_id'];_0x17cf7c(_0x38cef4);});});}function getRemoteTag(_0x30a245,_0x19ea88,_0x28d6f9,_0x521541,_0x2d3406){return new Promise(function(_0x51b8dc,_0x50ff82){var _0x1a33ef={'method':_0x1eb8('0xd'),'uri':_0x28d6f9+_0x1eb8('0x45')+_0x1eb8('0x46')+_0x30a245+'&'+_0x521541,'auth':_0x19ea88,'json':!![]};return rp(_0x1a33ef)[_0x1eb8('0xf')](function(_0x13f0cc){if(_0x13f0cc[_0x1eb8('0x10')][_0x1eb8('0x11')]>0x0){var _0x65daa5=_0x13f0cc[_0x1eb8('0x10')][0x0][_0x1eb8('0x13')];_0x51b8dc(_0x65daa5);}else{return createRemoteTag(_0x30a245,_0x19ea88,_0x28d6f9,_0x521541)[_0x1eb8('0xf')](function(_0x3e5454){_0x51b8dc(_0x3e5454);});}});});}function assignTagToIncident(_0x2573fb,_0x4efe99,_0x9e20dc,_0x57b203,_0xc58e5f){return new Promise(function(_0x1d0b75,_0x56a278){var _0x268f51={'method':_0x1eb8('0x24'),'uri':_0x9e20dc+_0x1eb8('0x47')+'?'+_0xc58e5f,'body':{'label':_0x2573fb,'table':_0x1eb8('0x3e'),'id_type':'Incident','table_key':_0x57b203[_0x1eb8('0x42')],'title':'Incident\x20-\x20'+_0x57b203[_0x1eb8('0x43')],'id_display':_0x57b203[_0x1eb8('0x43')]},'auth':_0x4efe99,'json':!![]};return rp(_0x268f51)['then'](function(_0x5235bc){_0x1d0b75();})[_0x1eb8('0x20')](function(){_0x1d0b75();});});}function manageTags(_0xf68b12,_0x53d256,_0x559621,_0x4e9827,_0x365b8d,_0x4930a0,_0x166204){return new Promise(function(_0x1f9ae6,_0x3b9bcc){var _0x274e3a=[];_0x53d256[_0x1eb8('0x2d')](function(_0x35ce31){_0x274e3a['push'](getRemoteTag(_0x35ce31,_0x559621,_0x4e9827,_0x4930a0,_0x166204));});return Promise[_0x1eb8('0x48')](_0x274e3a)[_0x1eb8('0xf')](function(_0xf64ae){if(_0xf64ae['length']){logger[_0x1eb8('0x14')]('['+[_0xf68b12[_0x1eb8('0x15')]()]+_0x1eb8('0x49'),_0xf64ae);var _0x292dee=[];_0xf64ae[_0x1eb8('0x2d')](function(_0x1d33a8){_0x292dee[_0x1eb8('0x4a')](assignTagToIncident(_0x1d33a8,_0x559621,_0x4e9827,_0x365b8d,_0x4930a0));});return Promise[_0x1eb8('0x48')](_0x292dee)[_0x1eb8('0xf')](function(){_0x1f9ae6();})[_0x1eb8('0x20')](function(){_0x1f9ae6();});}else{_0x1f9ae6();}});});}function getTags(_0x31e8bb,_0x3ebcfd,_0xe83d84,_0x1ac417,_0x5ec96a,_0x126dc8){return function(_0x4007c8){return new Promise(function(_0x5154d3,_0xa2db1b){var _0x11c1a9=[];var _0x51422c=_0x1ac417['Tags'];if(_0x51422c&&_0x51422c[_0x1eb8('0x11')]>0x0){_0x11c1a9=_['map'](_0x51422c,_0x1eb8('0x39'));}if(_0x11c1a9[_0x1eb8('0x11')]>0x0){return manageTags(_0x31e8bb,_0x11c1a9,_0x3ebcfd,_0xe83d84,_0x4007c8,_0x5ec96a,_0x126dc8)[_0x1eb8('0xf')](function(){_0x5154d3(_0x4007c8);});}else{_0x5154d3(_0x4007c8);}});};}function emit(_0x3264da,_0x1d2b2c,_0x46ae3f){var _0x409232=_0x1eb8('0x4b')+_0x1eb8('0x4c')+_0x1eb8('0x4d')+'%255EORDERBYDESCnumber';var _0x231fae={'uri':_0x3264da+_0x1eb8('0x4e')+_0x46ae3f+_0x409232};io['to'](util[_0x1eb8('0x4f')]('user:%s',_0x1d2b2c))['emit'](_0x1eb8('0x50'),_0x231fae);}exports['cs']=function(_0x30869e,_0x30b105,_0x896bcd,_0x89cd4e,_0x3b8301,_0x49677b,_0x487307,_0x502aa7){var _0x4369c8={};var _0x488aad={'user':_0x49677b[_0x1eb8('0x51')],'pass':_0x49677b[_0x1eb8('0x52')]};var _0x59dcc6='sysparm_limit=1';var _0x559805='sysparm_display_value=true';_0x49677b[_0x1eb8('0x53')]=intUtil[_0x1eb8('0x54')](_0x49677b['remoteUri']);_0x49677b[_0x1eb8('0x55')]=intUtil[_0x1eb8('0x54')](_0x49677b[_0x1eb8('0x55')]);var _0x5af2d1=util['format'](_0x1eb8('0x56'),_0x49677b[_0x1eb8('0x53')]);_0x4369c8[_0x1eb8('0x1b')]=!_['isNil'](_0x89cd4e)?_0x89cd4e[_0x1eb8('0x57')]:null;_0x4369c8[_0x1eb8('0x22')]=_0x49677b[_0x1eb8('0x57')];_0x4369c8[_0x1eb8('0x26')]=_0x502aa7['toLowerCase']()===_0x1eb8('0x3c')?_0x30b105[_0x1eb8('0x58')]:_0x30b105[_0x1eb8('0x59')];_0x4369c8[_0x1eb8('0x5a')]=_0x502aa7===_0x1eb8('0x5b')||_0x502aa7===_0x1eb8('0x5c')?'queue':_0x1eb8('0x3c');var _0x531fff=util[_0x1eb8('0x4f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49677b[_0x1eb8('0x55')],_0x30b105[_0x1eb8('0x5d')],md5(_0x30b105[_0x1eb8('0x5d')]));if(_0x3b8301&&_0x3b8301['monitor_format']){logger[_0x1eb8('0x14')](_0x1eb8('0x5e'),_0x1eb8('0x5f'));_0x30b105['recordingURL']=_0x531fff;}else if(_0x487307&&_0x487307[_0x1eb8('0x60')]&&_0x487307[_0x1eb8('0x60')]!=='none'){logger[_0x1eb8('0x14')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x30b105[_0x1eb8('0x61')]=_0x531fff;}else{_0x30b105[_0x1eb8('0x61')]='';}return getAdminUser(_0x502aa7,_0x488aad,_0x4369c8,_0x5af2d1,_0x559805,_0x59dcc6)[_0x1eb8('0xf')](getUser(_0x502aa7,_0x488aad,_0x5af2d1,_0x559805,_0x59dcc6))['then'](getEndUser(_0x502aa7,_0x488aad,_0x5af2d1,_0x559805,_0x59dcc6))[_0x1eb8('0xf')](getTicket(_0x502aa7,_0x488aad,_0x5af2d1,_0x896bcd,_0x30b105,_0x559805))['then'](function(_0x4ee555){logger['info'](util[_0x1eb8('0x4f')](_0x1eb8('0x62'),_0x4ee555[_0x1eb8('0x42')]));logger[_0x1eb8('0x14')](util[_0x1eb8('0x4f')](_0x1eb8('0x63'),_0x502aa7));if(_0x502aa7!==_0x1eb8('0x5c')){logger[_0x1eb8('0x14')]('['+[_0x502aa7[_0x1eb8('0x15')]()]+']',_0x1eb8('0x64'));emit(_0x49677b[_0x1eb8('0x53')],_0x89cd4e['name'],_0x4ee555[_0x1eb8('0x42')]);}})[_0x1eb8('0x20')](function(_0x5ad794){logger[_0x1eb8('0x17')]('['+[_0x502aa7[_0x1eb8('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x1eb8('0x65')](_0x5ad794,{'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 bc420d8..19d33e9 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 _0xb80a=['uri','toUpperCase','users','lastevent','request-promise','md5','util','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','info','Subjects','assigned_user_id','created_by','Descriptions','toISOString','slice','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','forEach','variableName','push','idField','set_entry','JSON','stringify','toString','base64','get_server_info','isNil','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','name','find','entry_list','name_value_list','user_name','value','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','then','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','map','type','string','customField','nameField','content','custom_fields','variable','customVariable','Variable','toLowerCase','POST','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','catch','error','outbound','[OUTBOUND]','destcalleridnum','Outbound','Ticket\x20created!','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','unmanaged'];(function(_0x44a573,_0x1e6efc){var _0x4babc6=function(_0x5495aa){while(--_0x5495aa){_0x44a573['push'](_0x44a573['shift']());}};_0x4babc6(++_0x1e6efc);}(_0xb80a,0x71));var _0xab80=function(_0x1e27ea,_0x1b979b){_0x1e27ea=_0x1e27ea-0x0;var _0x3d89f2=_0xb80a[_0x1e27ea];return _0x3d89f2;};'use strict';var _=require('lodash');var rp=require(_0xab80('0x0'));var BPromise=require('bluebird');var md5=require(_0xab80('0x1'));var util=require(_0xab80('0x2'));var Redis=require('ioredis');var intUtil=require(_0xab80('0x3'));var config=require(_0xab80('0x4'));var logger=require('../../../../config/logger')(_0xab80('0x5'));config[_0xab80('0x6')]=_[_0xab80('0x7')](config['redis'],{'host':_0xab80('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xab80('0x6')]));var def={'method':'POST','json':!![]};function emit(_0x3d58e0,_0x576216,_0x117db5){io['to'](_0x3d58e0)['emit'](_0x576216,_0x117db5);}function getTicket(_0x2bbebf,_0x429558,_0x946e12,_0x3a9bf4,_0x3bfbbe,_0x21ec8d,_0x230ebc,_0x4f0b01){logger[_0xab80('0x9')]('Creating\x20new\x20ticket...');var _0xf43ec1=new Date();var _0x49339d=[{'name':'name','value':intUtil['getString'](_0x3a9bf4[_0xab80('0xa')],_0x3bfbbe,'\x20')},{'name':_0xab80('0xb'),'value':_0x429558['id']},{'name':_0xab80('0xc'),'value':_0x429558['id']},{'name':'description','value':intUtil['getString'](_0x3a9bf4[_0xab80('0xd')],_0x3bfbbe,'\x0a')},{'name':'date_start','value':_0xf43ec1[_0xab80('0xe')]()[_0xab80('0xf')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xab80('0x10'),'value':'15'},{'name':_0xab80('0x11'),'value':_0x946e12['id']},{'name':_0xab80('0x12'),'value':_0xab80('0x13')},{'name':_0xab80('0x14'),'value':_0x946e12['name']},{'name':'direction','value':_0x4f0b01}];if(_0x21ec8d[_0xab80('0x15')]){_[_0xab80('0x16')](_0x21ec8d,function(_0x5a95d4){if(_0x3bfbbe[_0x5a95d4[_0xab80('0x17')]]){_0x49339d[_0xab80('0x18')]({'name':_0x5a95d4[_0xab80('0x19')],'value':_0x3bfbbe[_0x5a95d4['variableName']]});}});}return request({'form':{'method':_0xab80('0x1a'),'input_type':_0xab80('0x1b'),'response_type':'JSON','rest_data':JSON[_0xab80('0x1c')]({'session':_0x230ebc['id'],'module_name':'Calls','name_value_list':_0x49339d})}});}function getAuth(_0x2f2136){return util['format']('Basic\x20%s',new Buffer(_0x2f2136['apiKey']+':X')[_0xab80('0x1d')](_0xab80('0x1e')));}function getServerInfo(_0x2e9af7){return request({'form':{'method':_0xab80('0x1f'),'input_type':_0xab80('0x1b'),'response_type':_0xab80('0x1b'),'rest_data':JSON[_0xab80('0x1c')]({'session':_0x2e9af7['id']})}});}function getUser(_0x565339,_0x6743fd,_0x5168a3){if(!_[_0xab80('0x20')](_0x6743fd)){logger[_0xab80('0x9')]('Getting\x20agent\x20with\x20name',_0x6743fd);return request({'form':{'method':_0xab80('0x21'),'input_type':_0xab80('0x1b'),'response_type':_0xab80('0x1b'),'rest_data':JSON[_0xab80('0x1c')]({'session':_0x5168a3['id'],'module_name':_0xab80('0x22'),'query':util[_0xab80('0x23')](_0xab80('0x24'),_0x6743fd),'order_by':'','offset':'0','select_fields':['id',_0xab80('0x25'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x323533){if(_0x323533['entry_list'][_0xab80('0x15')]){var _0x1be9bc=_[_0xab80('0x26')](_0x323533[_0xab80('0x27')],function(_0xa5e2ad){return _0xa5e2ad[_0xab80('0x28')][_0xab80('0x29')][_0xab80('0x2a')]===_0x6743fd;});if(_0x1be9bc){logger['info']('Agent\x20found!');return BPromise['resolve']({'id':_0x1be9bc[_0xab80('0x28')]['id'][_0xab80('0x2a')],'name':_0x1be9bc[_0xab80('0x28')]['name'][_0xab80('0x2a')]});}}logger[_0xab80('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xab80('0x2b')]({'id':_0x5168a3[_0xab80('0x28')]['user_id']['value'],'name':_0x5168a3[_0xab80('0x28')]['user_name'][_0xab80('0x2a')]});});}else{logger[_0xab80('0x9')](_0xab80('0x2c'));return BPromise[_0xab80('0x2b')]({'id':_0x5168a3[_0xab80('0x28')]['user_id'][_0xab80('0x2a')],'name':_0x5168a3['name_value_list'][_0xab80('0x29')][_0xab80('0x2a')]});}}function getEndUser(_0x53e49d,_0x106c72,_0x52fe55,_0x23f1ee){logger[_0xab80('0x9')](_0xab80('0x2d'),_0x52fe55);return request({'form':{'method':'get_entry_list','input_type':_0xab80('0x1b'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x23f1ee['id'],'module_name':_0xab80('0x13'),'query':util[_0xab80('0x23')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x52fe55),'order_by':'','offset':'0','select_fields':['id',_0xab80('0x25'),_0xab80('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xab80('0x2f')](function(_0x5ee9b2){if(_0x5ee9b2[_0xab80('0x27')][_0xab80('0x15')]){var _0x5bbd2b=_['find'](_0x5ee9b2['entry_list'],function(_0x3ee96f){return _0x3ee96f[_0xab80('0x28')][_0xab80('0x2e')]['value']===_0x52fe55;});if(_0x5bbd2b){logger[_0xab80('0x9')]('Enduser\x20found!');return BPromise[_0xab80('0x2b')]({'id':_0x5bbd2b[_0xab80('0x28')]['id'][_0xab80('0x2a')],'name':_0x5bbd2b[_0xab80('0x28')][_0xab80('0x25')]['value'],'phone':_0x5bbd2b[_0xab80('0x28')][_0xab80('0x2e')][_0xab80('0x2a')]});}}else{logger[_0xab80('0x9')](_0xab80('0x30'));return request({'form':{'method':_0xab80('0x1a'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xab80('0x1c')]({'session':_0x23f1ee['id'],'module_name':_0xab80('0x13'),'name_value_list':[{'name':_0xab80('0x31'),'value':_0x106c72!==''?_0x106c72:util[_0xab80('0x23')](_0xab80('0x32'),_0x52fe55)},{'name':_0xab80('0x2e'),'value':_0x52fe55}]})}})[_0xab80('0x2f')](function(_0x18f348){logger[_0xab80('0x9')](_0xab80('0x33'));return BPromise[_0xab80('0x2b')]({'id':_0x18f348['id'],'name':_0x18f348[_0xab80('0x27')][_0xab80('0x31')][_0xab80('0x2a')],'phone':_0x18f348['entry_list'][_0xab80('0x2e')][_0xab80('0x2a')]});});}});}function request(_0x225cb8){logger['debug'](_0xab80('0x34'),JSON[_0xab80('0x1c')](_0x225cb8));return rp(_['merge'](def,_0x225cb8));}function getTags(_0x427998,_0x1fc28f){var _0x13e9eb=[];if(_0x427998&&_0x427998['length']>0x0){_0x13e9eb=_[_0xab80('0x35')](_0x427998,_0x1fc28f);}return _0x13e9eb;}function getCustomFields(_0x245a36,_0x321907){var _0x12d917=[];var _0x4cc6d8={'custom_fields':[]};if(_0x245a36[_0xab80('0x15')]>0x0){_[_0xab80('0x16')](_0x245a36,function(_0x15f70f){if(_0x15f70f[_0xab80('0x36')]===_0xab80('0x37')&&_0x15f70f['nameField']&&!_0x15f70f[_0xab80('0x38')]){_0x4cc6d8[_0x15f70f[_0xab80('0x39')]['toLowerCase']()]=_0x15f70f[_0xab80('0x3a')]['toString']();}else if(_0x15f70f[_0xab80('0x36')]==='string'&&_0x15f70f[_0xab80('0x19')]&&_0x15f70f[_0xab80('0x38')]){_0x4cc6d8[_0xab80('0x3b')][_0xab80('0x18')]({'id':_0x15f70f['idField'],'value':_0x15f70f[_0xab80('0x3a')][_0xab80('0x1d')]()});}else if(_0x15f70f[_0xab80('0x36')]===_0xab80('0x3c')&&_0x15f70f['variableName']&&_0x15f70f[_0xab80('0x19')]&&_0x15f70f[_0xab80('0x38')]){_0x321907[_0x15f70f[_0xab80('0x17')]]&&_0x4cc6d8[_0xab80('0x3b')][_0xab80('0x18')]({'id':_0x15f70f['idField'],'value':_0x321907[_0x15f70f['variableName']][_0xab80('0x1d')]()});}else if(_0x15f70f[_0xab80('0x36')]===_0xab80('0x3d')&&_0x15f70f[_0xab80('0x3e')]&&_0x15f70f['Variable'][_0xab80('0x25')]&&_0x15f70f['idField']&&_0x15f70f['customField']){_0x321907[_0x15f70f[_0xab80('0x3e')][_0xab80('0x25')][_0xab80('0x3f')]()]&&_0x4cc6d8['custom_fields'][_0xab80('0x18')]({'id':_0x15f70f[_0xab80('0x19')],'value':_0x321907[_0x15f70f['Variable'][_0xab80('0x25')][_0xab80('0x3f')]()][_0xab80('0x1d')]()});}});}return _0x4cc6d8;}function getConnection(_0x208666){return request({'method':_0xab80('0x40'),'form':{'method':'login','input_type':_0xab80('0x1b'),'response_type':_0xab80('0x1b'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x208666[_0xab80('0x41')],'password':_0x208666[_0xab80('0x42')],'encryption':_0xab80('0x43')},'application':_0xab80('0x44')})}})[_0xab80('0x2f')](function(_0x56c4e2){var _0x53ade7=_0x56c4e2;if(_0x53ade7['id']){def[_0xab80('0x45')]=_0x53ade7['id'];return BPromise[_0xab80('0x2b')](_0x53ade7);}else{throw new Error(util[_0xab80('0x23')](_0xab80('0x46'),_0x208666['id']));}});}function setRelationship(_0x5add73,_0x48b61a,_0x4e6300,_0x9a861b){return request({'form':{'method':_0xab80('0x47'),'input_type':'JSON','response_type':_0xab80('0x1b'),'rest_data':JSON[_0xab80('0x1c')]({'session':_0x5add73['id'],'module_name':_0xab80('0x48'),'module_id':_0x4e6300['id'],'link_field_name':_0x9a861b,'related_ids':[_0x48b61a['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x5f094e,_0x29ba5b,_0x409ba3,_0x3641e1,_0x594bfc,_0x225002){var _0x23a16f,_0x507c72,_0x291232,_0x8b7cef;_0x225002[_0xab80('0x49')]=intUtil[_0xab80('0x4a')](_0x225002[_0xab80('0x49')]);_0x225002[_0xab80('0x4b')]=intUtil[_0xab80('0x4a')](_0x225002[_0xab80('0x4b')]);def['uri']=util[_0xab80('0x23')](_0xab80('0x4c'),_0x225002[_0xab80('0x49')]);if(_0x594bfc&&_0x594bfc[_0xab80('0x4d')]){logger[_0xab80('0x9')](_0xab80('0x4e'),_0xab80('0x4f'));_0x29ba5b[_0xab80('0x50')]=util['format'](_0xab80('0x51'),_0x225002[_0xab80('0x4b')],_0x29ba5b[_0xab80('0x52')],md5(_0x29ba5b['uniqueid']));}else{_0x29ba5b[_0xab80('0x50')]='';}return getConnection(_0x225002)[_0xab80('0x2f')](function(_0x206ac4){_0x8b7cef=_0x206ac4;return getUser(_0x225002,_0x3641e1[_0xab80('0x25')],_0x8b7cef);})[_0xab80('0x2f')](function(_0x3f9760){_0x23a16f=_0x3f9760;logger[_0xab80('0x9')](_0xab80('0x53'),_0x23a16f['id']);return getEndUser(_0x225002,_0x29ba5b[_0xab80('0x54')],_0x29ba5b[_0xab80('0x55')],_0x8b7cef);})[_0xab80('0x2f')](function(_0x37feb5){_0x507c72=_0x37feb5;logger[_0xab80('0x9')](_0xab80('0x56'),_0x507c72['id']);return getTicket(_0x225002,_0x23a16f,_0x507c72,_0x409ba3,_0x29ba5b,_0x409ba3[_0xab80('0x57')],_0x8b7cef,_0xab80('0x58'));})[_0xab80('0x2f')](function(_0x457200){_0x291232=_0x457200;logger['info']('Ticket\x20created!');logger['info'](_0xab80('0x59'),_0x291232['id']);return setRelationship(_0x8b7cef,_0x23a16f,_0x291232,'users');})[_0xab80('0x2f')](function(){return setRelationship(_0x8b7cef,_0x507c72,_0x291232,'contacts');})['then'](function(){return getServerInfo(_0x8b7cef);})['then'](function(_0x1aa97f){var _0x12fad3=parseInt(_0x1aa97f['version'][_0xab80('0x5a')](0x0));var _0x2e7c3d=util[_0xab80('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x225002[_0xab80('0x49')],_0x291232['id']);if(_0x12fad3>0x6){_0x2e7c3d=util[_0xab80('0x23')](_0xab80('0x5b'),_0x225002[_0xab80('0x49')],_0x291232['id']);}logger[_0xab80('0x9')](_0xab80('0x4e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x3641e1['name']),'trigger:browser:url',{'uri':_0x2e7c3d});})[_0xab80('0x5c')](function(_0x199d1b){logger[_0xab80('0x5d')](_0xab80('0x4e'),JSON[_0xab80('0x1c')](_0x199d1b));});};exports[_0xab80('0x5e')]=function(_0x37ff5b,_0x5815a5,_0x1f84c6,_0x5e96d3,_0x1dfc61,_0xe6356,_0x508a37){var _0x4403fa,_0x3d3d1d,_0x431752,_0x4c0869;_0xe6356[_0xab80('0x49')]=intUtil[_0xab80('0x4a')](_0xe6356['remoteUri']);_0xe6356[_0xab80('0x4b')]=intUtil[_0xab80('0x4a')](_0xe6356['serverUrl']);def['uri']=util[_0xab80('0x23')](_0xab80('0x4c'),_0xe6356[_0xab80('0x49')]);if(_0x508a37&&_0x508a37['recordingFormat']&&_0x508a37['recordingFormat']!=='none'){logger[_0xab80('0x9')](_0xab80('0x5f'),_0xab80('0x4f'));_0x5815a5[_0xab80('0x50')]=util[_0xab80('0x23')](_0xab80('0x51'),_0xe6356[_0xab80('0x4b')],_0x5815a5['uniqueid'],md5(_0x5815a5[_0xab80('0x52')]));}return getConnection(_0xe6356)[_0xab80('0x2f')](function(_0x25a1d1){_0x4c0869=_0x25a1d1;return getUser(_0xe6356,_0x5e96d3[_0xab80('0x25')],_0x4c0869);})[_0xab80('0x2f')](function(_0x11f8f3){_0x4403fa=_0x11f8f3;logger[_0xab80('0x9')](_0xab80('0x53'),_0x4403fa['id']);return getEndUser(_0xe6356,_0x5815a5['destcalleridname'],_0x5815a5[_0xab80('0x60')],_0x4c0869);})['then'](function(_0x313e27){_0x3d3d1d=_0x313e27;logger[_0xab80('0x9')](_0xab80('0x56'),_0x3d3d1d['id']);return getTicket(_0xe6356,_0x4403fa,_0x3d3d1d,_0x1f84c6,_0x5815a5,_0x1f84c6['Fields'],_0x4c0869,_0xab80('0x61'));})[_0xab80('0x2f')](function(_0x995ea6){_0x431752=_0x995ea6;logger[_0xab80('0x9')](_0xab80('0x62'));logger[_0xab80('0x9')](_0xab80('0x59'),_0x431752['id']);return setRelationship(_0x4c0869,_0x4403fa,_0x431752,'users');})[_0xab80('0x2f')](function(){return setRelationship(_0x4c0869,_0x3d3d1d,_0x431752,_0xab80('0x63'));})['then'](function(){return getServerInfo(_0x4c0869);})[_0xab80('0x2f')](function(_0x29648f){var _0x33607e=parseInt(_0x29648f[_0xab80('0x64')][_0xab80('0x5a')](0x0));var _0x1eca96=util['format'](_0xab80('0x65'),_0xe6356[_0xab80('0x49')],_0x431752['id']);if(_0x33607e>0x6){_0x1eca96=util[_0xab80('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xe6356[_0xab80('0x49')],_0x431752['id']);}logger[_0xab80('0x9')](_0xab80('0x5f'),_0xab80('0x66'));emit(util[_0xab80('0x23')]('user:%s',_0x5e96d3[_0xab80('0x25')]),_0xab80('0x67'),{'uri':_0x1eca96});})[_0xab80('0x5c')](function(_0x1d8da6){logger[_0xab80('0x5d')](_0xab80('0x5f'),JSON[_0xab80('0x1c')](_0x1d8da6));});};exports[_0xab80('0x68')]=function(_0x85529b,_0x17f5d4,_0x3ace29,_0x2f10b,_0x2ab53c,_0x3700e5){var _0x15bc76,_0x121e6c,_0x2644b5,_0xdcf329;_0x3700e5[_0xab80('0x49')]=intUtil[_0xab80('0x4a')](_0x3700e5[_0xab80('0x49')]);_0x3700e5[_0xab80('0x4b')]=intUtil[_0xab80('0x4a')](_0x3700e5[_0xab80('0x4b')]);def[_0xab80('0x69')]=util[_0xab80('0x23')](_0xab80('0x4c'),_0x3700e5[_0xab80('0x49')]);if(_0x2ab53c&&_0x2ab53c[_0xab80('0x4d')]){logger[_0xab80('0x9')]('['+_0x17f5d4['lastevent'][_0xab80('0x6a')]()+']',_0xab80('0x4f'));_0x17f5d4['recordingURL']=util['format'](_0xab80('0x51'),_0x3700e5[_0xab80('0x4b')],_0x17f5d4[_0xab80('0x52')],md5(_0x17f5d4[_0xab80('0x52')]));}else{_0x17f5d4[_0xab80('0x50')]='';}return getConnection(_0x3700e5)[_0xab80('0x2f')](function(_0x35399e){_0xdcf329=_0x35399e;if(!_[_0xab80('0x20')](_0x2f10b)){return getUser(_0x3700e5,_0x2f10b['name'],_0xdcf329);}else{return getUser(_0x3700e5,null,_0xdcf329);}})[_0xab80('0x2f')](function(_0x5c43ae){_0x15bc76=_0x5c43ae;logger['info']('The\x20User\x20ID\x20is:',_0x15bc76['id']);return getEndUser(_0x3700e5,_0x17f5d4[_0xab80('0x54')],_0x17f5d4[_0xab80('0x55')],_0xdcf329);})['then'](function(_0x4c015b){_0x121e6c=_0x4c015b;logger[_0xab80('0x9')](_0xab80('0x56'),_0x121e6c['id']);return getTicket(_0x3700e5,_0x15bc76,_0x121e6c,_0x3ace29,_0x17f5d4,_0x3ace29[_0xab80('0x57')],_0xdcf329,_0xab80('0x58'));})[_0xab80('0x2f')](function(_0x5a3472){_0x2644b5=_0x5a3472;logger['info']('Ticket\x20created!');logger['info'](_0xab80('0x59'),_0x2644b5['id']);return setRelationship(_0xdcf329,_0x15bc76,_0x2644b5,_0xab80('0x6b'));})[_0xab80('0x2f')](function(){return setRelationship(_0xdcf329,_0x121e6c,_0x2644b5,'contacts');})[_0xab80('0x2f')](function(){return getServerInfo(_0xdcf329);})['catch'](function(_0x27f7f8){logger[_0xab80('0x5d')]('['+_0x17f5d4[_0xab80('0x6c')][_0xab80('0x6a')]()+']',JSON[_0xab80('0x1c')](_0x27f7f8));});}; \ No newline at end of file +var _0xefc2=['debug','[HTTP]','merge','map','forEach','string','nameField','customField','toLowerCase','custom_fields','push','content','type','variable','customVariable','Variable','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Outbound','Ticket\x20created!','users','[OUTBOUND]','unmanaged','lastevent','calleridnum','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','localhost','socket.io-emitter','redis','POST','emit','Creating\x20new\x20ticket...','getString','Subjects','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','name','idField','variableName','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','value','info','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','get_entry_list','stringify','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s'];(function(_0x3bacf0,_0x39f7b3){var _0x289a0c=function(_0x4ff2da){while(--_0x4ff2da){_0x3bacf0['push'](_0x3bacf0['shift']());}};_0x289a0c(++_0x39f7b3);}(_0xefc2,0x134));var _0x2efc=function(_0x1a66d1,_0x32ffba){_0x1a66d1=_0x1a66d1-0x0;var _0x161084=_0xefc2[_0x1a66d1];return _0x161084;};'use strict';var _=require(_0x2efc('0x0'));var rp=require(_0x2efc('0x1'));var BPromise=require('bluebird');var md5=require(_0x2efc('0x2'));var util=require(_0x2efc('0x3'));var Redis=require(_0x2efc('0x4'));var intUtil=require(_0x2efc('0x5'));var config=require(_0x2efc('0x6'));var logger=require(_0x2efc('0x7'))(_0x2efc('0x8'));config['redis']=_[_0x2efc('0x9')](config['redis'],{'host':_0x2efc('0xa'),'port':0x18eb});var io=require(_0x2efc('0xb'))(new Redis(config[_0x2efc('0xc')]));var def={'method':_0x2efc('0xd'),'json':!![]};function emit(_0x2761c3,_0x3859f1,_0x5f3b9c){io['to'](_0x2761c3)[_0x2efc('0xe')](_0x3859f1,_0x5f3b9c);}function getTicket(_0x180f92,_0x47f5fc,_0x5bebdf,_0x5b516f,_0x6c70d,_0x1e0f6a,_0x21150e,_0x43ba4e){logger['info'](_0x2efc('0xf'));var _0x4c0f26=new Date();var _0x4eca97=[{'name':'name','value':intUtil[_0x2efc('0x10')](_0x5b516f[_0x2efc('0x11')],_0x6c70d,'\x20')},{'name':'assigned_user_id','value':_0x47f5fc['id']},{'name':'created_by','value':_0x47f5fc['id']},{'name':'description','value':intUtil[_0x2efc('0x10')](_0x5b516f[_0x2efc('0x12')],_0x6c70d,'\x0a')},{'name':_0x2efc('0x13'),'value':_0x4c0f26['toISOString']()[_0x2efc('0x14')](0x0,0x13)[_0x2efc('0x15')]('T','\x20')},{'name':_0x2efc('0x16'),'value':'0'},{'name':_0x2efc('0x17'),'value':'15'},{'name':_0x2efc('0x18'),'value':_0x5bebdf['id']},{'name':_0x2efc('0x19'),'value':_0x2efc('0x1a')},{'name':'parent_name','value':_0x5bebdf[_0x2efc('0x1b')]},{'name':'direction','value':_0x43ba4e}];if(_0x1e0f6a['length']){_['forEach'](_0x1e0f6a,function(_0x3bde69){if(_0x6c70d[_0x3bde69['variableName']]){_0x4eca97['push']({'name':_0x3bde69[_0x2efc('0x1c')],'value':_0x6c70d[_0x3bde69[_0x2efc('0x1d')]]});}});}return request({'form':{'method':_0x2efc('0x1e'),'input_type':'JSON','response_type':_0x2efc('0x1f'),'rest_data':JSON['stringify']({'session':_0x21150e['id'],'module_name':_0x2efc('0x20'),'name_value_list':_0x4eca97})}});}function getAuth(_0x13ab88){return util[_0x2efc('0x21')](_0x2efc('0x22'),new Buffer(_0x13ab88[_0x2efc('0x23')]+':X')[_0x2efc('0x24')](_0x2efc('0x25')));}function getServerInfo(_0x38bf15){return request({'form':{'method':_0x2efc('0x26'),'input_type':_0x2efc('0x1f'),'response_type':_0x2efc('0x1f'),'rest_data':JSON['stringify']({'session':_0x38bf15['id']})}});}function getUser(_0x27f835,_0x130d95,_0x51a930){if(!_[_0x2efc('0x27')](_0x130d95)){logger['info'](_0x2efc('0x28'),_0x130d95);return request({'form':{'method':'get_entry_list','input_type':_0x2efc('0x1f'),'response_type':_0x2efc('0x1f'),'rest_data':JSON['stringify']({'session':_0x51a930['id'],'module_name':'Employees','query':util[_0x2efc('0x21')](_0x2efc('0x29'),_0x130d95),'order_by':'','offset':'0','select_fields':['id',_0x2efc('0x1b'),_0x2efc('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2efc('0x2b')](function(_0x55749c){if(_0x55749c[_0x2efc('0x2c')][_0x2efc('0x2d')]){var _0x8f7fd0=_[_0x2efc('0x2e')](_0x55749c['entry_list'],function(_0xf7cc86){return _0xf7cc86[_0x2efc('0x2f')]['user_name'][_0x2efc('0x30')]===_0x130d95;});if(_0x8f7fd0){logger[_0x2efc('0x31')](_0x2efc('0x32'));return BPromise[_0x2efc('0x33')]({'id':_0x8f7fd0[_0x2efc('0x2f')]['id']['value'],'name':_0x8f7fd0[_0x2efc('0x2f')][_0x2efc('0x1b')]['value']});}}logger[_0x2efc('0x31')](_0x2efc('0x34'));return BPromise['resolve']({'id':_0x51a930[_0x2efc('0x2f')][_0x2efc('0x35')][_0x2efc('0x30')],'name':_0x51a930[_0x2efc('0x2f')][_0x2efc('0x2a')][_0x2efc('0x30')]});});}else{logger['info'](_0x2efc('0x36'));return BPromise[_0x2efc('0x33')]({'id':_0x51a930['name_value_list']['user_id'][_0x2efc('0x30')],'name':_0x51a930[_0x2efc('0x2f')][_0x2efc('0x2a')][_0x2efc('0x30')]});}}function getEndUser(_0x1355f3,_0x382c7f,_0x343ffa,_0xb09aee){logger[_0x2efc('0x31')]('Searching\x20enduser\x20with\x20phone',_0x343ffa);return request({'form':{'method':_0x2efc('0x37'),'input_type':_0x2efc('0x1f'),'response_type':_0x2efc('0x1f'),'rest_data':JSON[_0x2efc('0x38')]({'session':_0xb09aee['id'],'module_name':'Contacts','query':util['format'](_0x2efc('0x39'),_0x343ffa),'order_by':'','offset':'0','select_fields':['id','name',_0x2efc('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2efc('0x2b')](function(_0x957895){if(_0x957895['entry_list'][_0x2efc('0x2d')]){var _0x32ceed=_[_0x2efc('0x2e')](_0x957895[_0x2efc('0x2c')],function(_0x20337d){return _0x20337d['name_value_list']['phone_home']['value']===_0x343ffa;});if(_0x32ceed){logger['info'](_0x2efc('0x3b'));return BPromise[_0x2efc('0x33')]({'id':_0x32ceed[_0x2efc('0x2f')]['id'][_0x2efc('0x30')],'name':_0x32ceed['name_value_list'][_0x2efc('0x1b')]['value'],'phone':_0x32ceed[_0x2efc('0x2f')]['phone_home'][_0x2efc('0x30')]});}}else{logger[_0x2efc('0x31')](_0x2efc('0x3c'));return request({'form':{'method':_0x2efc('0x1e'),'input_type':_0x2efc('0x1f'),'response_type':_0x2efc('0x1f'),'rest_data':JSON[_0x2efc('0x38')]({'session':_0xb09aee['id'],'module_name':_0x2efc('0x1a'),'name_value_list':[{'name':_0x2efc('0x3d'),'value':_0x382c7f!==_0x2efc('0x3e')?_0x382c7f:util[_0x2efc('0x21')](_0x2efc('0x3f'),_0x343ffa)},{'name':_0x2efc('0x3a'),'value':_0x343ffa}]})}})[_0x2efc('0x2b')](function(_0xdbf712){logger[_0x2efc('0x31')]('Enduser\x20created.');return BPromise[_0x2efc('0x33')]({'id':_0xdbf712['id'],'name':_0xdbf712['entry_list'][_0x2efc('0x3d')]['value'],'phone':_0xdbf712[_0x2efc('0x2c')][_0x2efc('0x3a')][_0x2efc('0x30')]});});}});}function request(_0x2ae550){logger[_0x2efc('0x40')](_0x2efc('0x41'),JSON['stringify'](_0x2ae550));return rp(_[_0x2efc('0x42')](def,_0x2ae550));}function getTags(_0x33ba43,_0x1d88de){var _0x36cac6=[];if(_0x33ba43&&_0x33ba43['length']>0x0){_0x36cac6=_[_0x2efc('0x43')](_0x33ba43,_0x1d88de);}return _0x36cac6;}function getCustomFields(_0x5a98fe,_0x5ab0a2){var _0xd68bd9=[];var _0x2e2ea1={'custom_fields':[]};if(_0x5a98fe[_0x2efc('0x2d')]>0x0){_[_0x2efc('0x44')](_0x5a98fe,function(_0x10aa22){if(_0x10aa22['type']===_0x2efc('0x45')&&_0x10aa22[_0x2efc('0x46')]&&!_0x10aa22[_0x2efc('0x47')]){_0x2e2ea1[_0x10aa22[_0x2efc('0x46')][_0x2efc('0x48')]()]=_0x10aa22['content'][_0x2efc('0x24')]();}else if(_0x10aa22['type']===_0x2efc('0x45')&&_0x10aa22[_0x2efc('0x1c')]&&_0x10aa22[_0x2efc('0x47')]){_0x2e2ea1[_0x2efc('0x49')][_0x2efc('0x4a')]({'id':_0x10aa22[_0x2efc('0x1c')],'value':_0x10aa22[_0x2efc('0x4b')][_0x2efc('0x24')]()});}else if(_0x10aa22[_0x2efc('0x4c')]===_0x2efc('0x4d')&&_0x10aa22['variableName']&&_0x10aa22['idField']&&_0x10aa22['customField']){_0x5ab0a2[_0x10aa22[_0x2efc('0x1d')]]&&_0x2e2ea1[_0x2efc('0x49')][_0x2efc('0x4a')]({'id':_0x10aa22[_0x2efc('0x1c')],'value':_0x5ab0a2[_0x10aa22['variableName']]['toString']()});}else if(_0x10aa22[_0x2efc('0x4c')]===_0x2efc('0x4e')&&_0x10aa22['Variable']&&_0x10aa22[_0x2efc('0x4f')][_0x2efc('0x1b')]&&_0x10aa22[_0x2efc('0x1c')]&&_0x10aa22[_0x2efc('0x47')]){_0x5ab0a2[_0x10aa22['Variable'][_0x2efc('0x1b')][_0x2efc('0x48')]()]&&_0x2e2ea1[_0x2efc('0x49')]['push']({'id':_0x10aa22[_0x2efc('0x1c')],'value':_0x5ab0a2[_0x10aa22[_0x2efc('0x4f')][_0x2efc('0x1b')]['toLowerCase']()][_0x2efc('0x24')]()});}});}return _0x2e2ea1;}function getConnection(_0x24592d){return request({'method':_0x2efc('0xd'),'form':{'method':'login','input_type':_0x2efc('0x1f'),'response_type':_0x2efc('0x1f'),'rest_data':JSON[_0x2efc('0x38')]({'user_auth':{'user_name':_0x24592d[_0x2efc('0x50')],'password':_0x24592d[_0x2efc('0x51')],'encryption':_0x2efc('0x52')},'application':_0x2efc('0x53')})}})[_0x2efc('0x2b')](function(_0x28f9ed){var _0x36e831=_0x28f9ed;if(_0x36e831['id']){def[_0x2efc('0x54')]=_0x36e831['id'];return BPromise[_0x2efc('0x33')](_0x36e831);}else{throw new Error(util[_0x2efc('0x21')](_0x2efc('0x55'),_0x24592d['id']));}});}function setRelationship(_0x21e1b9,_0x203121,_0x49ad79,_0xe0b524){return request({'form':{'method':_0x2efc('0x56'),'input_type':_0x2efc('0x1f'),'response_type':_0x2efc('0x1f'),'rest_data':JSON[_0x2efc('0x38')]({'session':_0x21e1b9['id'],'module_name':_0x2efc('0x20'),'module_id':_0x49ad79['id'],'link_field_name':_0xe0b524,'related_ids':[_0x203121['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x2efc('0x57')]=function(_0x519308,_0x5c1f9f,_0x311547,_0x3a2433,_0x50b33d,_0x186200){var _0x43d78a,_0x4b40a0,_0x59eb49,_0x3246f7;_0x186200['remoteUri']=intUtil['stripTrailingSlash'](_0x186200[_0x2efc('0x58')]);_0x186200[_0x2efc('0x59')]=intUtil[_0x2efc('0x5a')](_0x186200[_0x2efc('0x59')]);def[_0x2efc('0x5b')]=util['format'](_0x2efc('0x5c'),_0x186200['remoteUri']);if(_0x50b33d&&_0x50b33d[_0x2efc('0x5d')]){logger[_0x2efc('0x31')](_0x2efc('0x5e'),_0x2efc('0x5f'));_0x5c1f9f[_0x2efc('0x60')]=util[_0x2efc('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x186200[_0x2efc('0x59')],_0x5c1f9f[_0x2efc('0x61')],md5(_0x5c1f9f[_0x2efc('0x61')]));}else{_0x5c1f9f[_0x2efc('0x60')]='';}return getConnection(_0x186200)['then'](function(_0x1f239a){_0x3246f7=_0x1f239a;return getUser(_0x186200,_0x3a2433[_0x2efc('0x1b')],_0x3246f7);})[_0x2efc('0x2b')](function(_0x304c13){_0x43d78a=_0x304c13;logger['info'](_0x2efc('0x62'),_0x43d78a['id']);return getEndUser(_0x186200,_0x5c1f9f[_0x2efc('0x63')],_0x5c1f9f['calleridnum'],_0x3246f7);})[_0x2efc('0x2b')](function(_0x4c313f){_0x4b40a0=_0x4c313f;logger[_0x2efc('0x31')](_0x2efc('0x64'),_0x4b40a0['id']);return getTicket(_0x186200,_0x43d78a,_0x4b40a0,_0x311547,_0x5c1f9f,_0x311547['Fields'],_0x3246f7,_0x2efc('0x65'));})[_0x2efc('0x2b')](function(_0x15f837){_0x59eb49=_0x15f837;logger[_0x2efc('0x31')]('Ticket\x20created!');logger[_0x2efc('0x31')](_0x2efc('0x66'),_0x59eb49['id']);return setRelationship(_0x3246f7,_0x43d78a,_0x59eb49,'users');})[_0x2efc('0x2b')](function(){return setRelationship(_0x3246f7,_0x4b40a0,_0x59eb49,_0x2efc('0x67'));})['then'](function(){return getServerInfo(_0x3246f7);})['then'](function(_0x261a29){var _0x4c54c6=parseInt(_0x261a29[_0x2efc('0x68')][_0x2efc('0x69')](0x0));var _0x29f7d9=util[_0x2efc('0x21')](_0x2efc('0x6a'),_0x186200['remoteUri'],_0x59eb49['id']);if(_0x4c54c6>0x6){_0x29f7d9=util[_0x2efc('0x21')](_0x2efc('0x6b'),_0x186200[_0x2efc('0x58')],_0x59eb49['id']);}logger['info'](_0x2efc('0x5e'),_0x2efc('0x6c'));emit(util[_0x2efc('0x21')](_0x2efc('0x6d'),_0x3a2433['name']),_0x2efc('0x6e'),{'uri':_0x29f7d9});})[_0x2efc('0x6f')](function(_0x4ed7dd){logger[_0x2efc('0x70')](_0x2efc('0x5e'),JSON[_0x2efc('0x38')](_0x4ed7dd));});};exports['outbound']=function(_0xe16bc3,_0x12a1c5,_0x53a7e1,_0x273b92,_0x16372f,_0x534236,_0xf68665){var _0x44cd87,_0x45def1,_0x2c312a,_0x54cb37;_0x534236[_0x2efc('0x58')]=intUtil['stripTrailingSlash'](_0x534236['remoteUri']);_0x534236['serverUrl']=intUtil[_0x2efc('0x5a')](_0x534236[_0x2efc('0x59')]);def['uri']=util[_0x2efc('0x21')](_0x2efc('0x5c'),_0x534236[_0x2efc('0x58')]);if(_0xf68665&&_0xf68665[_0x2efc('0x71')]&&_0xf68665[_0x2efc('0x71')]!==_0x2efc('0x72')){logger[_0x2efc('0x31')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x12a1c5[_0x2efc('0x60')]=util[_0x2efc('0x21')](_0x2efc('0x73'),_0x534236['serverUrl'],_0x12a1c5[_0x2efc('0x61')],md5(_0x12a1c5[_0x2efc('0x61')]));}return getConnection(_0x534236)[_0x2efc('0x2b')](function(_0x53a954){_0x54cb37=_0x53a954;return getUser(_0x534236,_0x273b92[_0x2efc('0x1b')],_0x54cb37);})[_0x2efc('0x2b')](function(_0x99989d){_0x44cd87=_0x99989d;logger['info'](_0x2efc('0x62'),_0x44cd87['id']);return getEndUser(_0x534236,_0x12a1c5['destcalleridname'],_0x12a1c5['destcalleridnum'],_0x54cb37);})[_0x2efc('0x2b')](function(_0x3a949f){_0x45def1=_0x3a949f;logger[_0x2efc('0x31')](_0x2efc('0x64'),_0x45def1['id']);return getTicket(_0x534236,_0x44cd87,_0x45def1,_0x53a7e1,_0x12a1c5,_0x53a7e1['Fields'],_0x54cb37,_0x2efc('0x74'));})['then'](function(_0x4574ee){_0x2c312a=_0x4574ee;logger['info'](_0x2efc('0x75'));logger[_0x2efc('0x31')](_0x2efc('0x66'),_0x2c312a['id']);return setRelationship(_0x54cb37,_0x44cd87,_0x2c312a,_0x2efc('0x76'));})['then'](function(){return setRelationship(_0x54cb37,_0x45def1,_0x2c312a,_0x2efc('0x67'));})[_0x2efc('0x2b')](function(){return getServerInfo(_0x54cb37);})[_0x2efc('0x2b')](function(_0x2fe446){var _0x3b528b=parseInt(_0x2fe446['version'][_0x2efc('0x69')](0x0));var _0x37cbe8=util[_0x2efc('0x21')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x534236[_0x2efc('0x58')],_0x2c312a['id']);if(_0x3b528b>0x6){_0x37cbe8=util[_0x2efc('0x21')](_0x2efc('0x6b'),_0x534236[_0x2efc('0x58')],_0x2c312a['id']);}logger[_0x2efc('0x31')]('[OUTBOUND]',_0x2efc('0x6c'));emit(util[_0x2efc('0x21')]('user:%s',_0x273b92['name']),_0x2efc('0x6e'),{'uri':_0x37cbe8});})[_0x2efc('0x6f')](function(_0x234c9b){logger[_0x2efc('0x70')](_0x2efc('0x77'),JSON[_0x2efc('0x38')](_0x234c9b));});};exports[_0x2efc('0x78')]=function(_0x4cba42,_0x1f8650,_0x1d30ab,_0x3f1c07,_0x267aa2,_0xbd2bea){var _0x204cc6,_0x322104,_0x234880,_0x371af6;_0xbd2bea[_0x2efc('0x58')]=intUtil[_0x2efc('0x5a')](_0xbd2bea[_0x2efc('0x58')]);_0xbd2bea[_0x2efc('0x59')]=intUtil[_0x2efc('0x5a')](_0xbd2bea[_0x2efc('0x59')]);def[_0x2efc('0x5b')]=util['format'](_0x2efc('0x5c'),_0xbd2bea[_0x2efc('0x58')]);if(_0x267aa2&&_0x267aa2[_0x2efc('0x5d')]){logger[_0x2efc('0x31')]('['+_0x1f8650[_0x2efc('0x79')]['toUpperCase']()+']',_0x2efc('0x5f'));_0x1f8650[_0x2efc('0x60')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xbd2bea[_0x2efc('0x59')],_0x1f8650[_0x2efc('0x61')],md5(_0x1f8650['uniqueid']));}else{_0x1f8650['recordingURL']='';}return getConnection(_0xbd2bea)[_0x2efc('0x2b')](function(_0x207586){_0x371af6=_0x207586;if(!_[_0x2efc('0x27')](_0x3f1c07)){return getUser(_0xbd2bea,_0x3f1c07[_0x2efc('0x1b')],_0x371af6);}else{return getUser(_0xbd2bea,null,_0x371af6);}})[_0x2efc('0x2b')](function(_0x1ec6b3){_0x204cc6=_0x1ec6b3;logger[_0x2efc('0x31')](_0x2efc('0x62'),_0x204cc6['id']);return getEndUser(_0xbd2bea,_0x1f8650[_0x2efc('0x63')],_0x1f8650[_0x2efc('0x7a')],_0x371af6);})['then'](function(_0x1ec7f4){_0x322104=_0x1ec7f4;logger[_0x2efc('0x31')](_0x2efc('0x64'),_0x322104['id']);return getTicket(_0xbd2bea,_0x204cc6,_0x322104,_0x1d30ab,_0x1f8650,_0x1d30ab['Fields'],_0x371af6,_0x2efc('0x65'));})[_0x2efc('0x2b')](function(_0x23354f){_0x234880=_0x23354f;logger[_0x2efc('0x31')](_0x2efc('0x75'));logger['info'](_0x2efc('0x66'),_0x234880['id']);return setRelationship(_0x371af6,_0x204cc6,_0x234880,_0x2efc('0x76'));})[_0x2efc('0x2b')](function(){return setRelationship(_0x371af6,_0x322104,_0x234880,'contacts');})[_0x2efc('0x2b')](function(){return getServerInfo(_0x371af6);})['catch'](function(_0x2c0bb5){logger['error']('['+_0x1f8650[_0x2efc('0x79')][_0x2efc('0x7b')]()+']',JSON['stringify'](_0x2c0bb5));});}; \ 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 879222f..90bf60f 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 _0x733e=['substring','lastIndexOf','validateEmail','test','lodash','util','getString','length','sortBy','string','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join','stripTrailingSlash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x733e,0x70));var _0xe733=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x733e[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0xe733('0x0'));var util=require(_0xe733('0x1'));exports[_0xe733('0x2')]=function(_0x40cf49,_0x56b512,_0x358802){var _0xfcb8d1=[];if(_0x40cf49[_0xe733('0x3')]>0x0){var _0x48bcb5=_[_0xe733('0x4')](_0x40cf49,['id']);for(var _0x30a977=0x0;_0x30a977<_0x48bcb5[_0xe733('0x3')];_0x30a977++){var _0x591af8=_0x48bcb5[_0x30a977];if(_0x591af8['type']===_0xe733('0x5')){_0xfcb8d1[_0xe733('0x6')](_0x591af8[_0xe733('0x7')]);}else if(_0x591af8[_0xe733('0x8')]===_0xe733('0x9')&&_0x591af8[_0xe733('0xa')]){_0x56b512[_0x591af8[_0xe733('0xa')]]&&_0xfcb8d1[_0xe733('0x6')](_0x56b512[_0x591af8[_0xe733('0xa')]][_0xe733('0xb')]());}else if(_0x591af8[_0xe733('0x8')]===_0xe733('0xc')&&_0x591af8[_0xe733('0xd')]&&_0x591af8[_0xe733('0xd')][_0xe733('0xe')]){_0x56b512[_0x591af8['Variable']['name'][_0xe733('0xf')]()]&&_0xfcb8d1[_0xe733('0x6')](_0x56b512[_0x591af8[_0xe733('0xd')][_0xe733('0xe')][_0xe733('0xf')]()]['toString']());}else if(_0x591af8[_0xe733('0x8')]===_0xe733('0x10')){if(_0x591af8[_0xe733('0x11')]==='string'&&_0x591af8[_0xe733('0x12')]){_0xfcb8d1['push'](util[_0xe733('0x13')](_0xe733('0x14'),_0x591af8[_0xe733('0x12')],_0x591af8['keyContent']));}else if(_0x591af8['keyType']==='variable'&&_0x591af8[_0xe733('0xa')]&&_0x591af8[_0xe733('0x12')]){_0x56b512[_0x591af8['variableName']]&&_0xfcb8d1[_0xe733('0x6')](util[_0xe733('0x13')](_0xe733('0x14'),_0x591af8[_0xe733('0x12')],_0x56b512[_0x591af8[_0xe733('0xa')]]));}else if(_0x591af8[_0xe733('0x11')]===_0xe733('0xc')&&_0x591af8['Variable']&&_0x591af8[_0xe733('0xd')][_0xe733('0xe')]&&_0x591af8[_0xe733('0x12')]){_0x56b512[_0x591af8[_0xe733('0xd')][_0xe733('0xe')][_0xe733('0xf')]()]&&_0xfcb8d1[_0xe733('0x6')](util['format'](_0xe733('0x14'),_0x591af8[_0xe733('0x12')],_0x56b512[_0x591af8[_0xe733('0xd')][_0xe733('0xe')][_0xe733('0xf')]()]));}}}}return _0xfcb8d1[_0xe733('0x15')](_0x358802);};exports[_0xe733('0x16')]=function(_0x414474){var _0x3c86eb=_0x414474['slice'](-0x1);if(_0x3c86eb==='/'){_0x414474=_0x414474[_0xe733('0x17')](0x0,_0x414474[_0xe733('0x18')](_0x3c86eb));}return _0x414474;};exports[_0xe733('0x19')]=function(_0x43761d){if(!_['isNil'](_0x43761d)&&_0x43761d!==''){var _0x33890a=/^(([^<>()\[\]\\.,;:\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 _0x33890a[_0xe733('0x1a')](String(_0x43761d)[_0xe733('0xf')]());}else{return![];}}; \ No newline at end of file +var _0xea07=['variable','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','string','key','%s:\x20%s','stripTrailingSlash','lastIndexOf','validateEmail','isNil','test','lodash','getString','length','sortBy','type','content'];(function(_0x82247a,_0xe2498e){var _0x3df0d2=function(_0x101b45){while(--_0x101b45){_0x82247a['push'](_0x82247a['shift']());}};_0x3df0d2(++_0xe2498e);}(_0xea07,0x1da));var _0x7ea0=function(_0x4d7dfe,_0x4722c9){_0x4d7dfe=_0x4d7dfe-0x0;var _0x5cf94e=_0xea07[_0x4d7dfe];return _0x5cf94e;};'use strict';var _=require(_0x7ea0('0x0'));var util=require('util');exports[_0x7ea0('0x1')]=function(_0x3e8952,_0x2789c5,_0x4ebc3f){var _0x469786=[];if(_0x3e8952[_0x7ea0('0x2')]>0x0){var _0x183a5d=_[_0x7ea0('0x3')](_0x3e8952,['id']);for(var _0x184c41=0x0;_0x184c41<_0x183a5d[_0x7ea0('0x2')];_0x184c41++){var _0x5afa30=_0x183a5d[_0x184c41];if(_0x5afa30[_0x7ea0('0x4')]==='string'){_0x469786['push'](_0x5afa30[_0x7ea0('0x5')]);}else if(_0x5afa30[_0x7ea0('0x4')]===_0x7ea0('0x6')&&_0x5afa30[_0x7ea0('0x7')]){_0x2789c5[_0x5afa30[_0x7ea0('0x7')]]&&_0x469786[_0x7ea0('0x8')](_0x2789c5[_0x5afa30['variableName']][_0x7ea0('0x9')]());}else if(_0x5afa30[_0x7ea0('0x4')]===_0x7ea0('0xa')&&_0x5afa30[_0x7ea0('0xb')]&&_0x5afa30[_0x7ea0('0xb')]['name']){_0x2789c5[_0x5afa30[_0x7ea0('0xb')][_0x7ea0('0xc')][_0x7ea0('0xd')]()]&&_0x469786[_0x7ea0('0x8')](_0x2789c5[_0x5afa30[_0x7ea0('0xb')][_0x7ea0('0xc')][_0x7ea0('0xd')]()][_0x7ea0('0x9')]());}else if(_0x5afa30[_0x7ea0('0x4')]===_0x7ea0('0xe')){if(_0x5afa30[_0x7ea0('0xf')]===_0x7ea0('0x10')&&_0x5afa30[_0x7ea0('0x11')]){_0x469786[_0x7ea0('0x8')](util['format'](_0x7ea0('0x12'),_0x5afa30[_0x7ea0('0x11')],_0x5afa30['keyContent']));}else if(_0x5afa30[_0x7ea0('0xf')]===_0x7ea0('0x6')&&_0x5afa30['variableName']&&_0x5afa30[_0x7ea0('0x11')]){_0x2789c5[_0x5afa30[_0x7ea0('0x7')]]&&_0x469786[_0x7ea0('0x8')](util['format'](_0x7ea0('0x12'),_0x5afa30[_0x7ea0('0x11')],_0x2789c5[_0x5afa30['variableName']]));}else if(_0x5afa30[_0x7ea0('0xf')]===_0x7ea0('0xa')&&_0x5afa30[_0x7ea0('0xb')]&&_0x5afa30[_0x7ea0('0xb')]['name']&&_0x5afa30[_0x7ea0('0x11')]){_0x2789c5[_0x5afa30[_0x7ea0('0xb')][_0x7ea0('0xc')][_0x7ea0('0xd')]()]&&_0x469786['push'](util['format'](_0x7ea0('0x12'),_0x5afa30[_0x7ea0('0x11')],_0x2789c5[_0x5afa30[_0x7ea0('0xb')][_0x7ea0('0xc')][_0x7ea0('0xd')]()]));}}}}return _0x469786['join'](_0x4ebc3f);};exports[_0x7ea0('0x13')]=function(_0x5c3cd3){var _0x11db32=_0x5c3cd3['slice'](-0x1);if(_0x11db32==='/'){_0x5c3cd3=_0x5c3cd3['substring'](0x0,_0x5c3cd3[_0x7ea0('0x14')](_0x11db32));}return _0x5c3cd3;};exports[_0x7ea0('0x15')]=function(_0x23f73b){if(!_[_0x7ea0('0x16')](_0x23f73b)&&_0x23f73b!==''){var _0x8cf410=/^(([^<>()\[\]\\.,;:\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 _0x8cf410[_0x7ea0('0x17')](String(_0x23f73b)[_0x7ea0('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 b2e2c07..c85d64c 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(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x298a2f,_0x42610d){var _0x2d36dd=function(_0x1c5b53){while(--_0x1c5b53){_0x298a2f['push'](_0x298a2f['shift']());}};_0x2d36dd(++_0x42610d);}(_0xe706,0xa3));var _0x6e70=function(_0x221246,_0x168ceb){_0x221246=_0x221246-0x0;var _0x13e1ea=_0xe706[_0x221246];return _0x13e1ea;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 17ee5cb..e77d53e 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 _0x0094=['email','destcalleridnum','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','socket.io-emitter','emit','application/json','format','%s/tickets.json','remoteUri','POST','merge','name','getString','Subjects','Descriptions','info','Ticket\x20created!','validateEmail','then','count','Agent\x20found!','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/users/me.json','user','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','defaults','GET','map','forEach','includes','picklist','type','customField','nameField','toLowerCase','content','string','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','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','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]'];(function(_0x1f5ce4,_0x1332ec){var _0x4d40ae=function(_0x4d157b){while(--_0x4d157b){_0x1f5ce4['push'](_0x1f5ce4['shift']());}};_0x4d40ae(++_0x1332ec);}(_0x0094,0xdc));var _0x4009=function(_0x1debfa,_0x52bcff){_0x1debfa=_0x1debfa-0x0;var _0x169d72=_0x0094[_0x1debfa];return _0x169d72;};'use strict';var _=require(_0x4009('0x0'));var rp=require(_0x4009('0x1'));var md5=require(_0x4009('0x2'));var util=require(_0x4009('0x3'));var Redis=require(_0x4009('0x4'));var intUtil=require('./util');var config=require(_0x4009('0x5'));var logger=require(_0x4009('0x6'))(_0x4009('0x7'));config[_0x4009('0x8')]=_['defaults'](config[_0x4009('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x4009('0x9'))(new Redis(config['redis']));function emit(_0x4c8662,_0x13b1dd,_0x2e5adc){io['to'](_0x4c8662)[_0x4009('0xa')](_0x13b1dd,_0x2e5adc);}var headers={'Content-Type':'application/json','Accept':_0x4009('0xb')};function getTicket(_0x361697,_0x3820df,_0x12bf21,_0x287034,_0x1f38c1){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0x4009('0xc')](_0x4009('0xd'),_0x361697[_0x4009('0xe')]),'method':_0x4009('0xf'),'body':{'ticket':_[_0x4009('0x10')]({'requester_id':_0x12bf21['id'],'submitter_id':_0x3820df?_0x3820df['id']:undefined,'assignee_id':_0x3820df?_0x3820df['id']:undefined,'tags':getTags(_0x287034['Tags'],_0x4009('0x11')),'subject':intUtil[_0x4009('0x12')](_0x287034[_0x4009('0x13')],_0x1f38c1,'\x20'),'description':intUtil[_0x4009('0x12')](_0x287034['Descriptions'],_0x1f38c1,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x287034[_0x4009('0x14')],_0x1f38c1,'\x0a')}},getCustomFields(_0x287034['Fields'],_0x1f38c1))}})['then'](function(_0x111498){logger[_0x4009('0x15')](_0x4009('0x16'));return _0x111498['ticket'];});}function getUser(_0x52c721,_0x593b58){if(intUtil[_0x4009('0x17')](_0x593b58)){logger[_0x4009('0x15')]('Getting\x20agent\x20with\x20email',_0x593b58);return request({'uri':util['format']('%s/search.json',_0x52c721['remoteUri']),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x593b58)}})[_0x4009('0x18')](function(_0x3749e8){if(_0x3749e8[_0x4009('0x19')]){logger[_0x4009('0x15')](_0x4009('0x1a'));return _['find'](_0x3749e8['results'],{'email':_0x593b58,'role':_0x4009('0x1b')});}else{logger['info'](_0x4009('0x1c'));return request({'uri':util['format']('%s/users/me.json',_0x52c721[_0x4009('0xe')])})['then'](function(_0x482b67){logger[_0x4009('0x15')](_0x4009('0x1d'));return _0x482b67['user'];});}});}else{logger[_0x4009('0x15')](_0x4009('0x1c'));return request({'uri':util[_0x4009('0xc')](_0x4009('0x1e'),_0x52c721['remoteUri'])})['then'](function(_0x393bbe){logger['info'](_0x4009('0x1d'));return _0x393bbe[_0x4009('0x1f')];});}}function getEndUser(_0x188747,_0x391920,_0x284a52){logger[_0x4009('0x15')]('Searching\x20enduser\x20with\x20phone',_0x284a52);return request({'uri':util['format']('%s/search.json',_0x188747[_0x4009('0xe')]),'qs':{'query':util[_0x4009('0xc')](_0x4009('0x20'),_0x284a52)}})[_0x4009('0x18')](function(_0x23e851){var _0x35168c;if(_0x23e851[_0x4009('0x21')][_0x4009('0x22')]){_0x23e851[_0x4009('0x21')]=_[_0x4009('0x23')](_0x23e851[_0x4009('0x21')],{'suspended':![],'role':_0x4009('0x24')});if(_0x23e851[_0x4009('0x21')]['length']){_0x35168c=_[_0x4009('0x25')](_0x23e851['results']);}}if(_0x35168c){logger[_0x4009('0x15')](_0x4009('0x26'));return _0x35168c;}else{logger['info'](_0x4009('0x27'));return request({'uri':util[_0x4009('0xc')](_0x4009('0x28'),_0x188747[_0x4009('0xe')]),'method':_0x4009('0xf'),'body':{'user':{'role':_0x4009('0x24'),'name':util['format'](_0x4009('0x29'),_0x391920||_0x284a52),'phone':_0x284a52}}})[_0x4009('0x18')](function(_0x370a6b){logger[_0x4009('0x15')](_0x4009('0x2a'));return _0x370a6b[_0x4009('0x1f')];});}});}function getAuth(_0x42b49a){var _0x31d960;if(_0x42b49a[_0x4009('0x2b')]===_0x4009('0x2c')){_0x31d960=util[_0x4009('0xc')](_0x4009('0x2d'),_0x42b49a['username'],_0x42b49a[_0x4009('0x2c')]);}else if(_0x42b49a[_0x4009('0x2b')]===_0x4009('0x2e')){_0x31d960=util[_0x4009('0xc')](_0x4009('0x2f'),_0x42b49a[_0x4009('0x30')],_0x42b49a[_0x4009('0x2e')]);}return util[_0x4009('0xc')](_0x4009('0x31'),new Buffer(_0x31d960)[_0x4009('0x32')]('base64'));}function request(_0x4ecb00){logger['debug']('[HTTP]',JSON['stringify'](_0x4ecb00));return rp(_[_0x4009('0x33')](_0x4ecb00,{'method':_0x4009('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x32ad60,_0x2e476f){var _0x3e6ba6=[];if(_0x32ad60&&_0x32ad60[_0x4009('0x22')]>0x0){_0x3e6ba6=_[_0x4009('0x35')](_0x32ad60,_0x2e476f);}return _0x3e6ba6;}function getCustomFields(_0xb021e4,_0x54bc60){var _0xe2b391=[];var _0x4439ef={'custom_fields':[]};if(_0xb021e4[_0x4009('0x22')]>0x0){_[_0x4009('0x36')](_0xb021e4,function(_0x5410ea){if(_[_0x4009('0x37')](['string',_0x4009('0x38')],_0x5410ea[_0x4009('0x39')])&&_0x5410ea['nameField']&&!_0x5410ea[_0x4009('0x3a')]){_0x4439ef[_0x5410ea[_0x4009('0x3b')][_0x4009('0x3c')]()]=_0x5410ea[_0x4009('0x3d')]['toString']();}else if(_[_0x4009('0x37')]([_0x4009('0x3e'),_0x4009('0x38')],_0x5410ea[_0x4009('0x39')])&&_0x5410ea[_0x4009('0x3f')]&&_0x5410ea['customField']){_0x4439ef[_0x4009('0x40')][_0x4009('0x41')]({'id':_0x5410ea[_0x4009('0x3f')],'value':_0x5410ea[_0x4009('0x3d')][_0x4009('0x32')]()});}else if(_0x5410ea[_0x4009('0x39')]===_0x4009('0x42')&&_0x5410ea[_0x4009('0x43')]&&_0x5410ea[_0x4009('0x3f')]&&_0x5410ea['customField']){_0x54bc60[_0x5410ea['variableName']]&&_0x4439ef[_0x4009('0x40')][_0x4009('0x41')]({'id':_0x5410ea['idField'],'value':_0x54bc60[_0x5410ea[_0x4009('0x43')]][_0x4009('0x32')]()});}else if(_0x5410ea[_0x4009('0x39')]===_0x4009('0x44')&&_0x5410ea[_0x4009('0x45')]&&_0x5410ea[_0x4009('0x45')][_0x4009('0x11')]&&_0x5410ea[_0x4009('0x3f')]&&_0x5410ea[_0x4009('0x3a')]){_0x54bc60[_0x5410ea[_0x4009('0x45')][_0x4009('0x11')]['toLowerCase']()]&&_0x4439ef[_0x4009('0x40')][_0x4009('0x41')]({'id':_0x5410ea[_0x4009('0x3f')],'value':_0x54bc60[_0x5410ea[_0x4009('0x45')][_0x4009('0x11')]['toLowerCase']()]['toString']()});}});}return _0x4439ef;}exports[_0x4009('0x46')]=function(_0x4897c8,_0x5c4e46,_0x1fe611,_0xd228d7,_0x246202,_0x57ed21){var _0x5bbcf7,_0x5c61ae;_0x57ed21[_0x4009('0xe')]=intUtil[_0x4009('0x47')](_0x57ed21[_0x4009('0xe')]);_0x57ed21[_0x4009('0x48')]=intUtil[_0x4009('0x47')](_0x57ed21[_0x4009('0x48')]);if(_0x246202&&_0x246202['monitor_format']){logger['info']('[QUEUE]',_0x4009('0x49'));_0x5c4e46[_0x4009('0x4a')]=util[_0x4009('0xc')](_0x4009('0x4b'),_0x57ed21['serverUrl'],_0x5c4e46['uniqueid'],md5(_0x5c4e46[_0x4009('0x4c')]));}else{_0x5c4e46[_0x4009('0x4a')]='';}headers[_0x4009('0x4d')]=getAuth(_0x57ed21);return getUser(_0x57ed21,_0xd228d7['email'])[_0x4009('0x18')](function(_0x1d3db7){_0x5bbcf7=_0x1d3db7;logger[_0x4009('0x15')](_0x4009('0x4e'),_0x5bbcf7['id']);return getEndUser(_0x57ed21,_0x5c4e46[_0x4009('0x4f')],_0x5c4e46[_0x4009('0x50')]);})[_0x4009('0x18')](function(_0x38a8d2){_0x5c61ae=_0x38a8d2;logger[_0x4009('0x15')](_0x4009('0x51'),_0x5c61ae['id']);return getTicket(_0x57ed21,_0x5bbcf7,_0x5c61ae,_0x1fe611,_0x5c4e46);})[_0x4009('0x18')](function(_0x12394e){if(_0x12394e){logger['info'](_0x4009('0x52'),_0x12394e['id']);switch(_0x57ed21[_0x4009('0x39')]){case _0x4009('0x53'):logger[_0x4009('0x15')](_0x4009('0x54'),_0x4009('0x55'));return request({'uri':util[_0x4009('0xc')](_0x4009('0x56'),_0x57ed21[_0x4009('0xe')],_0x5bbcf7['id'],_0x12394e['id']),'method':_0x4009('0xf')});case _0x4009('0x57'):logger[_0x4009('0x15')](_0x4009('0x54'),_0x4009('0x58'));emit(util[_0x4009('0xc')](_0x4009('0x59'),_0xd228d7[_0x4009('0x11')]),_0x4009('0x5a'),{'uri':util['format']('%s/agent/tickets/%s',_0x57ed21[_0x4009('0xe')][_0x4009('0x5b')](_0x4009('0x5c'),''),_0x12394e['id'])});break;default:logger[_0x4009('0x5d')](_0x4009('0x54'),_0x4009('0x5e'));}}})[_0x4009('0x5f')](function(_0x60320c){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x4009('0x60')](_0x60320c,{'showHidden':!![],'depth':null}));});};exports[_0x4009('0x61')]=function(_0x18c0cb,_0x804479,_0x1a3887,_0x94bfaa,_0x5d118d,_0x9f096,_0x4759cc){var _0x60afd3,_0x227dd3;_0x9f096[_0x4009('0xe')]=intUtil[_0x4009('0x47')](_0x9f096[_0x4009('0xe')]);_0x9f096[_0x4009('0x48')]=intUtil[_0x4009('0x47')](_0x9f096[_0x4009('0x48')]);if(_0x4759cc&&_0x4759cc[_0x4009('0x62')]&&_0x4759cc[_0x4009('0x62')]!==_0x4009('0x63')){logger[_0x4009('0x15')](_0x4009('0x64'),_0x4009('0x49'));_0x804479[_0x4009('0x4a')]=util['format'](_0x4009('0x4b'),_0x9f096['serverUrl'],_0x804479[_0x4009('0x4c')],md5(_0x804479[_0x4009('0x4c')]));}headers[_0x4009('0x4d')]=getAuth(_0x9f096);return getUser(_0x9f096,_0x94bfaa[_0x4009('0x65')])[_0x4009('0x18')](function(_0x36de8a){_0x60afd3=_0x36de8a;logger[_0x4009('0x15')](_0x4009('0x4e'),_0x60afd3['id']);return getEndUser(_0x9f096,_0x804479['destcalleridname'],_0x804479[_0x4009('0x66')]);})['then'](function(_0x427d85){_0x227dd3=_0x427d85;logger[_0x4009('0x15')]('The\x20Enduser\x20ID\x20is:',_0x227dd3['id']);return getTicket(_0x9f096,_0x60afd3,_0x227dd3,_0x1a3887,_0x804479);})[_0x4009('0x18')](function(_0x29b658){if(_0x29b658){logger[_0x4009('0x15')](_0x4009('0x52'),_0x29b658['id']);switch(_0x9f096[_0x4009('0x39')]){case _0x4009('0x53'):logger[_0x4009('0x15')]('[OUTBOUND]',_0x4009('0x55'));return request({'uri':util[_0x4009('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x9f096['remoteUri'],_0x60afd3['id'],_0x29b658['id']),'method':_0x4009('0xf')});case _0x4009('0x57'):logger['info']('[OUTBOUND]',_0x4009('0x58'));emit(util[_0x4009('0xc')](_0x4009('0x59'),_0x94bfaa[_0x4009('0x11')]),_0x4009('0x5a'),{'uri':util[_0x4009('0xc')]('%s/agent/tickets/%s',_0x9f096[_0x4009('0xe')]['replace']('/api/v2',''),_0x29b658['id'])});break;default:logger[_0x4009('0x5d')](_0x4009('0x64'),_0x4009('0x5e'));}}})[_0x4009('0x5f')](function(_0x52ce51){logger[_0x4009('0x5d')](_0x4009('0x67'),util['inspect'](_0x52ce51,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x3b29cc,_0x467580,_0x3c4fee,_0x3cf12c,_0x5a9e14,_0x101506){var _0x3262a4,_0x37b1c3;_0x101506[_0x4009('0xe')]=intUtil[_0x4009('0x47')](_0x101506[_0x4009('0xe')]);_0x101506[_0x4009('0x48')]=intUtil[_0x4009('0x47')](_0x101506['serverUrl']);if(_0x5a9e14&&_0x5a9e14['monitor_format']){logger[_0x4009('0x15')]('['+_0x467580[_0x4009('0x68')]['toUpperCase']()+']',_0x4009('0x49'));_0x467580[_0x4009('0x4a')]=util['format'](_0x4009('0x4b'),_0x101506[_0x4009('0x48')],_0x467580[_0x4009('0x4c')],md5(_0x467580[_0x4009('0x4c')]));}else{_0x467580[_0x4009('0x4a')]='';}headers['Authorization']=getAuth(_0x101506);return getUser(_0x101506)[_0x4009('0x18')](function(_0x596a86){_0x3262a4=_0x596a86;logger['info'](_0x4009('0x4e'),_0x3262a4['id']);return getEndUser(_0x101506,_0x467580['calleridname'],_0x467580[_0x4009('0x50')]);})[_0x4009('0x18')](function(_0x4e1b62){_0x37b1c3=_0x4e1b62;logger[_0x4009('0x15')](_0x4009('0x51'),_0x37b1c3['id']);return getTicket(_0x101506,_0x3262a4,_0x37b1c3,_0x3c4fee,_0x467580);})[_0x4009('0x18')](function(_0x2829a3){if(_0x2829a3){logger[_0x4009('0x15')](_0x4009('0x52'),_0x2829a3['id']);}})[_0x4009('0x5f')](function(_0x2d45ab){logger[_0x4009('0x5d')]('['+_0x467580[_0x4009('0x68')][_0x4009('0x69')]()+']'+_0x4009('0x6a'),util['inspect'](_0x2d45ab,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0058=['lodash','request-promise','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','Admin\x20account\x20selected.','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','debug','[HTTP]','stringify','map','forEach','string','picklist','nameField','toLowerCase','content','toString','includes','type','idField','push','variable','variableName','customField','custom_fields','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','lastevent','toUpperCase','calleridname','calleridnum'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0058,0x1c0));var _0x8005=function(_0x53bce2,_0x1ccc06){_0x53bce2=_0x53bce2-0x0;var _0x19e805=_0x0058[_0x53bce2];return _0x19e805;};'use strict';var _=require(_0x8005('0x0'));var rp=require(_0x8005('0x1'));var md5=require(_0x8005('0x2'));var util=require(_0x8005('0x3'));var Redis=require(_0x8005('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x8005('0x5'))('zendesk');config[_0x8005('0x6')]=_[_0x8005('0x7')](config[_0x8005('0x6')],{'host':_0x8005('0x8'),'port':0x18eb});var io=require(_0x8005('0x9'))(new Redis(config[_0x8005('0x6')]));function emit(_0x4a1455,_0x27c499,_0x56bd80){io['to'](_0x4a1455)[_0x8005('0xa')](_0x27c499,_0x56bd80);}var headers={'Content-Type':_0x8005('0xb'),'Accept':_0x8005('0xb')};function getTicket(_0x5bfbc6,_0x3d5160,_0x33bee5,_0x1ecc19,_0x12ca8c){logger[_0x8005('0xc')](_0x8005('0xd'));return request({'uri':util[_0x8005('0xe')]('%s/tickets.json',_0x5bfbc6[_0x8005('0xf')]),'method':'POST','body':{'ticket':_[_0x8005('0x10')]({'requester_id':_0x33bee5['id'],'submitter_id':_0x3d5160?_0x3d5160['id']:undefined,'assignee_id':_0x3d5160?_0x3d5160['id']:undefined,'tags':getTags(_0x1ecc19[_0x8005('0x11')],_0x8005('0x12')),'subject':intUtil[_0x8005('0x13')](_0x1ecc19[_0x8005('0x14')],_0x12ca8c,'\x20'),'description':intUtil[_0x8005('0x13')](_0x1ecc19['Descriptions'],_0x12ca8c,'\x0a'),'comment':{'public':![],'body':intUtil[_0x8005('0x13')](_0x1ecc19[_0x8005('0x15')],_0x12ca8c,'\x0a')}},getCustomFields(_0x1ecc19[_0x8005('0x16')],_0x12ca8c))}})['then'](function(_0x35d3b6){logger[_0x8005('0xc')](_0x8005('0x17'));return _0x35d3b6['ticket'];});}function getUser(_0x5c93e3,_0x3857b9){if(intUtil[_0x8005('0x18')](_0x3857b9)){logger['info'](_0x8005('0x19'),_0x3857b9);return request({'uri':util['format'](_0x8005('0x1a'),_0x5c93e3['remoteUri']),'qs':{'query':util[_0x8005('0xe')](_0x8005('0x1b'),_0x3857b9)}})[_0x8005('0x1c')](function(_0x4fb009){if(_0x4fb009['count']){logger[_0x8005('0xc')]('Agent\x20found!');return _[_0x8005('0x1d')](_0x4fb009[_0x8005('0x1e')],{'email':_0x3857b9,'role':_0x8005('0x1f')});}else{logger[_0x8005('0xc')](_0x8005('0x20'));return request({'uri':util[_0x8005('0xe')]('%s/users/me.json',_0x5c93e3[_0x8005('0xf')])})['then'](function(_0x246599){logger[_0x8005('0xc')]('Admin\x20account\x20selected.');return _0x246599[_0x8005('0x21')];});}});}else{logger[_0x8005('0xc')](_0x8005('0x20'));return request({'uri':util['format']('%s/users/me.json',_0x5c93e3['remoteUri'])})['then'](function(_0x37ef1c){logger[_0x8005('0xc')](_0x8005('0x22'));return _0x37ef1c[_0x8005('0x21')];});}}function getEndUser(_0x5c0c1e,_0x498cbf,_0x9494e2){logger[_0x8005('0xc')]('Searching\x20enduser\x20with\x20phone',_0x9494e2);return request({'uri':util['format'](_0x8005('0x1a'),_0x5c0c1e['remoteUri']),'qs':{'query':util[_0x8005('0xe')](_0x8005('0x23'),_0x9494e2)}})[_0x8005('0x1c')](function(_0x1b6851){var _0x238d40;if(_0x1b6851[_0x8005('0x1e')][_0x8005('0x24')]){_0x1b6851[_0x8005('0x1e')]=_[_0x8005('0x25')](_0x1b6851[_0x8005('0x1e')],{'suspended':![],'role':'end-user'});if(_0x1b6851[_0x8005('0x1e')][_0x8005('0x24')]){_0x238d40=_[_0x8005('0x26')](_0x1b6851[_0x8005('0x1e')]);}}if(_0x238d40){logger[_0x8005('0xc')](_0x8005('0x27'));return _0x238d40;}else{logger[_0x8005('0xc')](_0x8005('0x28'));return request({'uri':util['format']('%s/users.json',_0x5c0c1e[_0x8005('0xf')]),'method':_0x8005('0x29'),'body':{'user':{'role':_0x8005('0x2a'),'name':util['format'](_0x8005('0x2b'),_0x498cbf||_0x9494e2),'phone':_0x9494e2}}})[_0x8005('0x1c')](function(_0x53de4d){logger[_0x8005('0xc')](_0x8005('0x2c'));return _0x53de4d['user'];});}});}function getAuth(_0x158976){var _0x5f3954;if(_0x158976[_0x8005('0x2d')]===_0x8005('0x2e')){_0x5f3954=util[_0x8005('0xe')](_0x8005('0x2f'),_0x158976[_0x8005('0x30')],_0x158976[_0x8005('0x2e')]);}else if(_0x158976[_0x8005('0x2d')]===_0x8005('0x31')){_0x5f3954=util[_0x8005('0xe')](_0x8005('0x32'),_0x158976['username'],_0x158976[_0x8005('0x31')]);}return util[_0x8005('0xe')](_0x8005('0x33'),new Buffer(_0x5f3954)['toString']('base64'));}function request(_0x12d0ab){logger[_0x8005('0x34')](_0x8005('0x35'),JSON[_0x8005('0x36')](_0x12d0ab));return rp(_[_0x8005('0x7')](_0x12d0ab,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2b0ee7,_0x2ab19d){var _0x3e7f2a=[];if(_0x2b0ee7&&_0x2b0ee7[_0x8005('0x24')]>0x0){_0x3e7f2a=_[_0x8005('0x37')](_0x2b0ee7,_0x2ab19d);}return _0x3e7f2a;}function getCustomFields(_0x5ee205,_0x5c4542){var _0x1d2cc0=[];var _0x1f4d0a={'custom_fields':[]};if(_0x5ee205[_0x8005('0x24')]>0x0){_[_0x8005('0x38')](_0x5ee205,function(_0xaa94cd){if(_['includes']([_0x8005('0x39'),_0x8005('0x3a')],_0xaa94cd['type'])&&_0xaa94cd[_0x8005('0x3b')]&&!_0xaa94cd['customField']){_0x1f4d0a[_0xaa94cd['nameField'][_0x8005('0x3c')]()]=_0xaa94cd[_0x8005('0x3d')][_0x8005('0x3e')]();}else if(_[_0x8005('0x3f')]([_0x8005('0x39'),'picklist'],_0xaa94cd[_0x8005('0x40')])&&_0xaa94cd[_0x8005('0x41')]&&_0xaa94cd['customField']){_0x1f4d0a['custom_fields'][_0x8005('0x42')]({'id':_0xaa94cd[_0x8005('0x41')],'value':_0xaa94cd[_0x8005('0x3d')][_0x8005('0x3e')]()});}else if(_0xaa94cd[_0x8005('0x40')]===_0x8005('0x43')&&_0xaa94cd[_0x8005('0x44')]&&_0xaa94cd[_0x8005('0x41')]&&_0xaa94cd[_0x8005('0x45')]){_0x5c4542[_0xaa94cd[_0x8005('0x44')]]&&_0x1f4d0a[_0x8005('0x46')][_0x8005('0x42')]({'id':_0xaa94cd[_0x8005('0x41')],'value':_0x5c4542[_0xaa94cd[_0x8005('0x44')]][_0x8005('0x3e')]()});}else if(_0xaa94cd[_0x8005('0x40')]===_0x8005('0x47')&&_0xaa94cd['Variable']&&_0xaa94cd[_0x8005('0x48')]['name']&&_0xaa94cd[_0x8005('0x41')]&&_0xaa94cd[_0x8005('0x45')]){_0x5c4542[_0xaa94cd[_0x8005('0x48')][_0x8005('0x12')][_0x8005('0x3c')]()]&&_0x1f4d0a['custom_fields']['push']({'id':_0xaa94cd[_0x8005('0x41')],'value':_0x5c4542[_0xaa94cd[_0x8005('0x48')]['name'][_0x8005('0x3c')]()][_0x8005('0x3e')]()});}});}return _0x1f4d0a;}exports[_0x8005('0x49')]=function(_0x1e1385,_0x9ad86,_0xe6e801,_0x3d195b,_0x36efc2,_0x2caf7d){var _0x322ab5,_0x202dbf;_0x2caf7d['remoteUri']=intUtil[_0x8005('0x4a')](_0x2caf7d['remoteUri']);_0x2caf7d[_0x8005('0x4b')]=intUtil['stripTrailingSlash'](_0x2caf7d[_0x8005('0x4b')]);if(_0x36efc2&&_0x36efc2[_0x8005('0x4c')]){logger[_0x8005('0xc')](_0x8005('0x4d'),'Recording\x20is\x20enabled!');_0x9ad86[_0x8005('0x4e')]=util[_0x8005('0xe')](_0x8005('0x4f'),_0x2caf7d['serverUrl'],_0x9ad86[_0x8005('0x50')],md5(_0x9ad86['uniqueid']));}else{_0x9ad86[_0x8005('0x4e')]='';}headers[_0x8005('0x51')]=getAuth(_0x2caf7d);return getUser(_0x2caf7d,_0x3d195b[_0x8005('0x52')])['then'](function(_0x17c9b0){_0x322ab5=_0x17c9b0;logger[_0x8005('0xc')](_0x8005('0x53'),_0x322ab5['id']);return getEndUser(_0x2caf7d,_0x9ad86['calleridname'],_0x9ad86['calleridnum']);})['then'](function(_0x3fd622){_0x202dbf=_0x3fd622;logger[_0x8005('0xc')](_0x8005('0x54'),_0x202dbf['id']);return getTicket(_0x2caf7d,_0x322ab5,_0x202dbf,_0xe6e801,_0x9ad86);})['then'](function(_0x2d8506){if(_0x2d8506){logger['info'](_0x8005('0x55'),_0x2d8506['id']);switch(_0x2caf7d['type']){case _0x8005('0x56'):logger[_0x8005('0xc')](_0x8005('0x4d'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x8005('0xe')](_0x8005('0x57'),_0x2caf7d[_0x8005('0xf')],_0x322ab5['id'],_0x2d8506['id']),'method':_0x8005('0x29')});case _0x8005('0x58'):logger[_0x8005('0xc')](_0x8005('0x4d'),_0x8005('0x59'));emit(util[_0x8005('0xe')](_0x8005('0x5a'),_0x3d195b[_0x8005('0x12')]),_0x8005('0x5b'),{'uri':util['format']('%s/agent/tickets/%s',_0x2caf7d[_0x8005('0xf')][_0x8005('0x5c')](_0x8005('0x5d'),''),_0x2d8506['id'])});break;default:logger['error'](_0x8005('0x4d'),_0x8005('0x5e'));}}})[_0x8005('0x5f')](function(_0x177500){logger[_0x8005('0x60')](_0x8005('0x61'),util['inspect'](_0x177500,{'showHidden':!![],'depth':null}));});};exports[_0x8005('0x62')]=function(_0x3df169,_0x3a6cc3,_0x1aa0bd,_0x11d154,_0x996093,_0x27ef59,_0x15dd48){var _0x553db8,_0x5ca428;_0x27ef59['remoteUri']=intUtil[_0x8005('0x4a')](_0x27ef59[_0x8005('0xf')]);_0x27ef59[_0x8005('0x4b')]=intUtil[_0x8005('0x4a')](_0x27ef59['serverUrl']);if(_0x15dd48&&_0x15dd48[_0x8005('0x63')]&&_0x15dd48[_0x8005('0x63')]!=='none'){logger[_0x8005('0xc')](_0x8005('0x64'),_0x8005('0x65'));_0x3a6cc3[_0x8005('0x4e')]=util['format'](_0x8005('0x4f'),_0x27ef59[_0x8005('0x4b')],_0x3a6cc3['uniqueid'],md5(_0x3a6cc3[_0x8005('0x50')]));}headers[_0x8005('0x51')]=getAuth(_0x27ef59);return getUser(_0x27ef59,_0x11d154[_0x8005('0x52')])[_0x8005('0x1c')](function(_0x13d800){_0x553db8=_0x13d800;logger['info']('The\x20User\x20ID\x20is:',_0x553db8['id']);return getEndUser(_0x27ef59,_0x3a6cc3[_0x8005('0x66')],_0x3a6cc3[_0x8005('0x67')]);})[_0x8005('0x1c')](function(_0x23d24f){_0x5ca428=_0x23d24f;logger[_0x8005('0xc')]('The\x20Enduser\x20ID\x20is:',_0x5ca428['id']);return getTicket(_0x27ef59,_0x553db8,_0x5ca428,_0x1aa0bd,_0x3a6cc3);})[_0x8005('0x1c')](function(_0x413fa7){if(_0x413fa7){logger[_0x8005('0xc')]('The\x20Ticket\x20ID\x20is:',_0x413fa7['id']);switch(_0x27ef59[_0x8005('0x40')]){case _0x8005('0x56'):logger['info'](_0x8005('0x64'),_0x8005('0x68'));return request({'uri':util[_0x8005('0xe')](_0x8005('0x57'),_0x27ef59['remoteUri'],_0x553db8['id'],_0x413fa7['id']),'method':_0x8005('0x29')});case _0x8005('0x58'):logger[_0x8005('0xc')]('[OUTBOUND]',_0x8005('0x59'));emit(util[_0x8005('0xe')](_0x8005('0x5a'),_0x11d154['name']),_0x8005('0x5b'),{'uri':util['format'](_0x8005('0x69'),_0x27ef59['remoteUri'][_0x8005('0x5c')](_0x8005('0x5d'),''),_0x413fa7['id'])});break;default:logger[_0x8005('0x60')](_0x8005('0x64'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x8005('0x5f')](function(_0x3e5033){logger[_0x8005('0x60')](_0x8005('0x6a'),util[_0x8005('0x6b')](_0x3e5033,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x1219ad,_0x2426c0,_0x2847ed,_0x15e8a7,_0x3e3107,_0x48be07){var _0x305e26,_0x48248e;_0x48be07[_0x8005('0xf')]=intUtil[_0x8005('0x4a')](_0x48be07[_0x8005('0xf')]);_0x48be07['serverUrl']=intUtil['stripTrailingSlash'](_0x48be07[_0x8005('0x4b')]);if(_0x3e3107&&_0x3e3107[_0x8005('0x4c')]){logger[_0x8005('0xc')]('['+_0x2426c0[_0x8005('0x6c')][_0x8005('0x6d')]()+']','Recording\x20is\x20enabled!');_0x2426c0['recordingURL']=util[_0x8005('0xe')](_0x8005('0x4f'),_0x48be07[_0x8005('0x4b')],_0x2426c0['uniqueid'],md5(_0x2426c0[_0x8005('0x50')]));}else{_0x2426c0[_0x8005('0x4e')]='';}headers[_0x8005('0x51')]=getAuth(_0x48be07);return getUser(_0x48be07)[_0x8005('0x1c')](function(_0x8b2135){_0x305e26=_0x8b2135;logger[_0x8005('0xc')]('The\x20User\x20ID\x20is:',_0x305e26['id']);return getEndUser(_0x48be07,_0x2426c0[_0x8005('0x6e')],_0x2426c0[_0x8005('0x6f')]);})[_0x8005('0x1c')](function(_0x1c7bb5){_0x48248e=_0x1c7bb5;logger[_0x8005('0xc')](_0x8005('0x54'),_0x48248e['id']);return getTicket(_0x48be07,_0x305e26,_0x48248e,_0x2847ed,_0x2426c0);})[_0x8005('0x1c')](function(_0x5b9bb9){if(_0x5b9bb9){logger[_0x8005('0xc')](_0x8005('0x55'),_0x5b9bb9['id']);}})[_0x8005('0x5f')](function(_0x3dc557){logger['error']('['+_0x2426c0[_0x8005('0x6c')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x8005('0x6b')](_0x3dc557,{'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 602a37e..64259a8 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 _0x5afe=['POST','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','isArrayLikeObject','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','nothing','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','Call_Result','complete','Answered','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','Call\x20created!','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','Inbound','lodash','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','emit','debug','[HTTP]','stringify','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn'];(function(_0x3cc8e4,_0x2e26d0){var _0x50818b=function(_0x266621){while(--_0x266621){_0x3cc8e4['push'](_0x3cc8e4['shift']());}};_0x50818b(++_0x2e26d0);}(_0x5afe,0x1ab));var _0xe5af=function(_0x16aa10,_0xc22da3){_0x16aa10=_0x16aa10-0x0;var _0x3bc706=_0x5afe[_0x16aa10];return _0x3bc706;};'use strict';var _=require(_0xe5af('0x0'));var rp=require(_0xe5af('0x1'));var md5=require(_0xe5af('0x2'));var util=require(_0xe5af('0x3'));var intUtil=require('./util');var moment=require(_0xe5af('0x4'));var Redis=require(_0xe5af('0x5'));var BPromise=require(_0xe5af('0x6'));var config=require(_0xe5af('0x7'));var logger=require(_0xe5af('0x8'))(_0xe5af('0x9'));config[_0xe5af('0xa')]=_[_0xe5af('0xb')](config[_0xe5af('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe5af('0xa')]));function emit(_0x1cc1f3,_0x4876a3,_0x570065){io['to'](_0x1cc1f3)[_0xe5af('0xc')](_0x4876a3,_0x570065);}function request(_0x7e621c){logger[_0xe5af('0xd')](_0xe5af('0xe'),JSON[_0xe5af('0xf')](_0x7e621c));return rp(_0x7e621c);}function getCustomFields(_0x17a68e,_0x1017bd){var _0x48fe40={};if(_0x17a68e['length']>0x0){_[_0xe5af('0x10')](_0x17a68e,function(_0x61f4f0){if(_[_0xe5af('0x11')]([_0xe5af('0x12'),_0xe5af('0x13')],_0x61f4f0[_0xe5af('0x14')])&&_0x61f4f0[_0xe5af('0x15')]){_0x48fe40[_0x61f4f0['idField']]=_0x61f4f0[_0xe5af('0x16')][_0xe5af('0x17')]();}else if(_0x61f4f0[_0xe5af('0x14')]===_0xe5af('0x18')&&_0x61f4f0[_0xe5af('0x19')]&&_0x61f4f0[_0xe5af('0x15')]&&_0x1017bd[_0x61f4f0[_0xe5af('0x19')]]){_0x48fe40[_0x61f4f0[_0xe5af('0x15')]]=_0x1017bd[_0x61f4f0[_0xe5af('0x19')]]['toString']();}else if(_0x61f4f0['type']===_0xe5af('0x1a')&&_0x61f4f0[_0xe5af('0x1b')]&&_0x61f4f0[_0xe5af('0x1b')][_0xe5af('0x1c')]&&_0x61f4f0[_0xe5af('0x15')]&&_0x1017bd[_0x61f4f0[_0xe5af('0x1b')][_0xe5af('0x1c')]['toLowerCase']()]){_0x48fe40[_0x61f4f0['idField']]=_0x1017bd[_0x61f4f0[_0xe5af('0x1b')][_0xe5af('0x1c')][_0xe5af('0x1d')]()][_0xe5af('0x17')]();}});}return _0x48fe40;}function getName(_0x57ea39){if(_0x57ea39[_0xe5af('0x1e')]('\x20')>0x0){var _0x20f783=_0x57ea39[_0xe5af('0x1f')](/ (.+)/);if(_0x20f783[0x1]){return _0x20f783;}}return[_0x57ea39,_0x57ea39];}var accountsTokens={};function getAccessToken(_0x10eb64){return new Promise(function(_0x1cbcc9,_0x408bfc){if(!_['isNil'](accountsTokens[_0x10eb64['id']])&&!_[_0xe5af('0x20')](accountsTokens[_0x10eb64['id']][_0xe5af('0x21')])){if(moment()['isBefore'](accountsTokens[_0x10eb64['id']]['expires_in'])){_0x1cbcc9(accountsTokens[_0x10eb64['id']][_0xe5af('0x21')]);}}var _0x756caf;switch(_0x10eb64['zone']){case'US':_0x756caf=_0xe5af('0x22');break;case'AU':_0x756caf=_0xe5af('0x23');break;case'EU':_0x756caf=_0xe5af('0x24');break;case'IN':_0x756caf='https://accounts.zoho.in';break;case'CN':_0x756caf=_0xe5af('0x25');break;default:_0x756caf=_0xe5af('0x24');break;}var _0x351e51={'method':_0xe5af('0x26'),'uri':_0x756caf+_0xe5af('0x27'),'qs':{'refresh_token':_0x10eb64[_0xe5af('0x28')],'client_id':_0x10eb64[_0xe5af('0x29')],'client_secret':_0x10eb64['clientSecret'],'grant_type':_0xe5af('0x2a')},'json':!![]};return rp(_0x351e51)[_0xe5af('0x2b')](function(_0x513e8d){accountsTokens[_0x10eb64['id']]={'access_token':_0x513e8d[_0xe5af('0x21')],'expires_in':moment()[_0xe5af('0x2c')](_0x513e8d['expires_in'],_0xe5af('0x2d'))};_0x1cbcc9(_0x513e8d[_0xe5af('0x21')]);})[_0xe5af('0x2e')](function(_0x301648){logger[_0xe5af('0x2f')](_0xe5af('0x30'),_0x301648['stack']);_0x408bfc(_0x301648);});});}function getUser(_0x486bab,_0x3fef40,_0x12ef59,_0x16749a){logger[_0xe5af('0x31')](_0xe5af('0x32'));return request({'method':_0xe5af('0x33'),'uri':util[_0xe5af('0x34')](_0xe5af('0x35'),_0x3fef40),'qs':{'type':_0xe5af('0x36')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x486bab},'json':!![]})['then'](function(_0x3a6ee3){if(_0x3a6ee3['users']){var _0x42bd3f=-0x1;if(_[_0xe5af('0x37')](_0x3a6ee3[_0xe5af('0x38')])){if(!_[_0xe5af('0x20')](_0x16749a)){_0x42bd3f=_[_0xe5af('0x39')](_0x3a6ee3['users'],function(_0x11074e){return _0x11074e['email']===_0x16749a;});}if(_0x42bd3f>=0x0){logger[_0xe5af('0x31')](_0xe5af('0x3a'));}else{logger[_0xe5af('0x31')](_0xe5af('0x3b'));_0x42bd3f=_['findIndex'](_0x3a6ee3[_0xe5af('0x38')],function(_0x5c9c53){return _0x5c9c53['profile'][_0xe5af('0x1c')]===_0xe5af('0x3c');});}return _0x3a6ee3[_0xe5af('0x38')][_0x42bd3f];}else{if(_0x3a6ee3[_0xe5af('0x3d')][_0xe5af('0x3e')][_0xe5af('0x1c')]===_0xe5af('0x3c')){logger[_0xe5af('0x31')](_0xe5af('0x3b'));user=_0x3a6ee3[_0xe5af('0x3d')];return user;}else{logger[_0xe5af('0x2f')](_0xe5af('0x3f'),JSON['stringify'](_0x3a6ee3));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xe5af('0xf')](_0x3a6ee3));}}}else{logger[_0xe5af('0x2f')]('The\x20failing\x20result\x20is',JSON[_0xe5af('0xf')](_0x3a6ee3));throw new Error(_0xe5af('0x40')+JSON['stringify'](_0x3a6ee3));}})[_0xe5af('0x2e')](function(_0xd17e0d){console[_0xe5af('0x2f')](_0xd17e0d);});}function getZohoUser(_0x425dd7,_0x1a222c){return new BPromise(function(_0x183bf0,_0x492da0){request(_0x425dd7)['then'](function(_0xe8e61c){var _0x2b94ba=null;if(_0xe8e61c){_0x2b94ba=_0xe8e61c[_0xe5af('0x41')][0x0];_0x2b94ba[_0xe5af('0x42')]=_0x1a222c;}_0x183bf0(_0x2b94ba);})[_0xe5af('0x2e')](function(_0x4dc00b){_0x492da0(_0x4dc00b);});});}function createEndUser(_0x1a98bb,_0x495573,_0x2a41dc,_0x1ddc28,_0x392b8f,_0x2e8b57){var _0x2a41dc=getName(_0x2a41dc);return request({'method':_0xe5af('0x26'),'uri':'https://www.zohoapis.'+_0x495573+_0xe5af('0x43')+_[_0xe5af('0x44')](_0x2e8b57[_0xe5af('0x45')])+'s','body':{'data':[{'Last_Name':_0x2a41dc[0x1],'First_Name':_0x2a41dc[0x0],'Phone':_0x1ddc28,'Owner':{'name':!_[_0xe5af('0x20')](_0x392b8f[_0xe5af('0x46')][_0xe5af('0x1c')])?_0x392b8f['role'][_0xe5af('0x1c')]:!_[_0xe5af('0x20')](_0x392b8f[_0xe5af('0x47')])?_0x392b8f[_0xe5af('0x47')]+'\x20'+_0x392b8f[_0xe5af('0x48')]:_0x392b8f['last_name'],'id':_0x392b8f['id']}}]},'headers':{'Authorization':_0xe5af('0x49')+_0x1a98bb},'json':!![]})['then'](function(_0x446999){if(_0x446999&&_0x446999[_0xe5af('0x41')][0x0][_0xe5af('0x4a')]===_0xe5af('0x4b')){var _0x5d0114=_0x446999['data'][0x0][_0xe5af('0x4c')];_0x5d0114[_0xe5af('0x42')]=_[_0xe5af('0x44')](_0x2e8b57['moduleCreate'])+'s';return _0x5d0114;}logger['error'](_0xe5af('0x3f'),JSON[_0xe5af('0xf')](data));throw new Error(_0xe5af('0x4d')+JSON[_0xe5af('0xf')](data));})['catch'](function(_0x48cbc9){console['log'](_0xe5af('0x4e'),_0x48cbc9);});}function getEndUser(_0x3da1c,_0x19711d,_0x341f96,_0x214f34,_0x4d0019,_0x485fe0,_0x5231d5){var _0x598150={'method':_0xe5af('0x33'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3da1c},'json':!![]};switch(_0x5231d5[_0xe5af('0x4f')]){case _0xe5af('0x50'):_0x598150['uri']=_0xe5af('0x51')+_0x19711d+_0xe5af('0x52')+_0x4d0019+'))';return getZohoUser(_0x598150,_0xe5af('0x53'))[_0xe5af('0x2b')](function(_0x3c0ddd){if(_0x3c0ddd)return _0x3c0ddd;_0x598150[_0xe5af('0x54')]=_0xe5af('0x51')+_0x19711d+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4d0019+'))';return getZohoUser(_0x598150,'Leads')['then'](function(_0x32e970){if(_0x32e970)return _0x32e970;if(_0x5231d5['moduleCreate']!=_0xe5af('0x55')){return createEndUser(_0x3da1c,_0x19711d,_0x214f34,_0x4d0019,_0x485fe0,_0x5231d5);}else{return{};}});});break;case'contact':_0x598150['uri']='https://www.zohoapis.'+_0x19711d+_0xe5af('0x52')+_0x4d0019+'))';return getZohoUser(_0x598150,_0xe5af('0x53'))['then'](function(_0x393a90){if(_0x393a90)return _0x393a90;if(_0x5231d5['moduleCreate']!=_0xe5af('0x55')){return createEndUser(_0x3da1c,_0x19711d,_0x214f34,_0x4d0019,_0x485fe0,_0x5231d5);}else{return{};}});break;case'lead':_0x598150[_0xe5af('0x54')]=_0xe5af('0x51')+_0x19711d+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4d0019+'))';return getZohoUser(_0x598150,_0xe5af('0x56'))[_0xe5af('0x2b')](function(_0x4322ee){if(_0x4322ee)return _0x4322ee;if(_0x5231d5[_0xe5af('0x45')]!=_0xe5af('0x55')){return createEndUser(_0x3da1c,_0x19711d,_0x214f34,_0x4d0019,_0x485fe0,_0x5231d5);}else{return{};}});break;}}function getCall(_0x19ba4a,_0x58ad4d,_0x43a057,_0xbd525b,_0x353026,_0x38d0fc,_0x29da9f,_0x140bac){logger[_0xe5af('0x31')](_0xe5af('0x57'));var _0xe8e1be={};_0xe8e1be[_0xe5af('0x58')]={'name':!_['isNil'](_0xbd525b[_0xe5af('0x46')][_0xe5af('0x1c')])&&!_[_0xe5af('0x20')](_0xbd525b[_0xe5af('0x3e')]['name'])&&_0xbd525b[_0xe5af('0x3e')]['name']===_0xe5af('0x59')?_0xbd525b[_0xe5af('0x46')][_0xe5af('0x1c')]:!_[_0xe5af('0x20')](_0xbd525b[_0xe5af('0x47')])?_0xbd525b[_0xe5af('0x47')]+'\x20'+_0xbd525b[_0xe5af('0x48')]:_0xbd525b[_0xe5af('0x48')],'id':_0xbd525b['id']};_0xe8e1be[_0xe5af('0x5a')]=intUtil[_0xe5af('0x5b')](_0x38d0fc[_0xe5af('0x5c')],_0x29da9f,'\x20');_0xe8e1be[_0xe5af('0x5d')]=intUtil[_0xe5af('0x5b')](_0x38d0fc['Descriptions'],_0x29da9f,'\x0a');if(_0x353026['enduserType']===_0xe5af('0x53')){_0xe8e1be[_0xe5af('0x5e')]={'name':!_[_0xe5af('0x20')](_0x353026[_0xe5af('0x5f')])?_0x353026['Full_Name']:!_[_0xe5af('0x20')](_0x353026['First_Name'])?_0x353026[_0xe5af('0x60')]+'\x20'+_0x353026[_0xe5af('0x61')]:_0x353026[_0xe5af('0x61')],'id':_0x353026['id']};}if(_0x353026[_0xe5af('0x42')]===_0xe5af('0x56')){_0xe8e1be[_0xe5af('0x62')]={'name':!_['isNil'](_0x353026[_0xe5af('0x5f')])?_0x353026['Full_Name']:!_[_0xe5af('0x20')](_0x353026[_0xe5af('0x60')])?_0x353026['First_Name']+'\x20'+_0x353026[_0xe5af('0x61')]:_0x353026[_0xe5af('0x61')],'id':_0x353026['id']};_0xe8e1be['$se_module']=_[_0xe5af('0x44')](_0x353026[_0xe5af('0x42')]);}if(_0x29da9f[_0xe5af('0x63')]){_0xe8e1be[_0xe5af('0x64')]=moment[_0xe5af('0x65')](parseInt(_0x29da9f[_0xe5af('0x63')])*0x3e8)['format']('mm:ss');}else if(_0x29da9f[_0xe5af('0x66')]&&_0x29da9f[_0xe5af('0x67')]){_0xe8e1be[_0xe5af('0x64')]=moment[_0xe5af('0x65')](moment(_0x29da9f[_0xe5af('0x67')],_0xe5af('0x68'))[_0xe5af('0x69')](moment(_0x29da9f[_0xe5af('0x6a')],'YYYY-MM-DDTHH:mm:ss')))[_0xe5af('0x34')](_0xe5af('0x6b'));}switch(_0x29da9f['lastevent']){case'called':_0xe8e1be[_0xe5af('0x6c')]='Called';break;case _0xe5af('0x6d'):case'connect':_0xe8e1be['Call_Result']=_0xe5af('0x6e');break;case'rejected':_0xe8e1be['Call_Result']='Rejected';break;case _0xe5af('0x6f'):_0xe8e1be[_0xe5af('0x6c')]=_0xe5af('0x70');break;case'timeout':_0xe8e1be[_0xe5af('0x6c')]=_0xe5af('0x71');default:}_0xe8e1be[_0xe5af('0x72')]=(_0x140bac===_0xe5af('0x73')?moment(_0x29da9f[_0xe5af('0x6a')])[_0xe5af('0x34')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x29da9f[_0xe5af('0x74')])[_0xe5af('0x34')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xe5af('0x34')](_0xe5af('0x68'));_0xe8e1be[_0xe5af('0x75')]=_0x140bac||'Inbound';_0xe8e1be=_[_0xe5af('0x76')](_0xe8e1be,getCustomFields(_0x38d0fc[_0xe5af('0x77')],_0x29da9f));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x58ad4d+'/crm/v2/Calls','headers':{'Authorization':_0xe5af('0x49')+_0x19ba4a},'body':{'data':[_0xe8e1be]},'json':!![]})['then'](function(_0x1fccc6){if(_0x1fccc6&&_0x1fccc6[_0xe5af('0x41')][0x0][_0xe5af('0x4a')]==='SUCCESS'){logger[_0xe5af('0x31')](_0xe5af('0x78'));return{'id':_0x1fccc6[_0xe5af('0x41')][0x0]['details']['id']};}})[_0xe5af('0x2e')](function(_0x5385ce){logger[_0xe5af('0x31')](_0xe5af('0x79'),_0x5385ce[_0xe5af('0x7a')]);console['log'](_0xe5af('0x79'),_0x5385ce);});}exports[_0xe5af('0x7b')]=function(_0x3187db,_0x34f66f,_0xae9da9,_0x29ef72,_0x55d50f,_0x3867d3){var _0x17aa33,_0x2b4e4c,_0x599efe;_0x3867d3[_0xe5af('0x7c')]=intUtil[_0xe5af('0x7d')](_0x3867d3[_0xe5af('0x7c')]);_0x3867d3['serverUrl']=intUtil[_0xe5af('0x7d')](_0x3867d3[_0xe5af('0x7e')]);if(_0x55d50f&&_0x55d50f[_0xe5af('0x7f')]){logger[_0xe5af('0x31')](_0xe5af('0x80'),_0xe5af('0x81'));_0x34f66f[_0xe5af('0x82')]=_0x3867d3[_0xe5af('0x7e')]+_0xe5af('0x83')+_0x34f66f[_0xe5af('0x84')]+_0xe5af('0x85')+md5(_0x34f66f['uniqueid']);}else{_0x34f66f[_0xe5af('0x82')]='';}var _0x41654e=_0x3867d3[_0xe5af('0x7c')]===_0xe5af('0x86')?'eu':_0xe5af('0x87');return getAccessToken(_0x3867d3)[_0xe5af('0x2b')](function(_0x2462c0){_0x599efe=_0x2462c0;return getUser(_0x599efe,_0x41654e,_0x3867d3,_0x29ef72[_0xe5af('0x88')]);})['then'](function(_0x57e2c6){_0x17aa33=_0x57e2c6;logger[_0xe5af('0x31')](_0xe5af('0x89'),_0x17aa33['id']);return getEndUser(_0x599efe,_0x41654e,_0x3867d3,_0x34f66f[_0xe5af('0x8a')],_0x34f66f[_0xe5af('0x8b')],_0x17aa33,_0xae9da9);})[_0xe5af('0x2b')](function(_0x2bc143){_0x2b4e4c=_0x2bc143;return getCall(_0x599efe,_0x41654e,_0x3867d3,_0x17aa33,_0x2b4e4c,_0xae9da9,_0x34f66f,'Inbound');})[_0xe5af('0x2b')](function(_0x314fd7){if(_0x314fd7){logger[_0xe5af('0x31')]('The\x20Call\x20ID\x20is:',_0x314fd7['id']);logger[_0xe5af('0x31')](_0xe5af('0x80'),_0xe5af('0x8c'));emit(util[_0xe5af('0x34')](_0xe5af('0x8d'),_0x29ef72[_0xe5af('0x1c')]),'trigger:browser:url',{'uri':'https://crm.'+_0x3867d3[_0xe5af('0x7c')]+'/crm/EntityInfo.do?module=Calls&id='+_0x314fd7['id']});}})[_0xe5af('0x2e')](function(_0x267536){logger[_0xe5af('0x2f')](_0xe5af('0x80'),JSON[_0xe5af('0xf')](_0x267536));});};exports[_0xe5af('0x73')]=function(_0x17a1f7,_0x41bdb6,_0x49885e,_0x23deed,_0x243545,_0x39edaf,_0x1cee47){var _0x1b4bf4,_0x2fed46,_0x1f97cb;_0x39edaf[_0xe5af('0x7c')]=intUtil[_0xe5af('0x7d')](_0x39edaf[_0xe5af('0x7c')]);_0x39edaf['serverUrl']=intUtil[_0xe5af('0x7d')](_0x39edaf[_0xe5af('0x7e')]);if(_0x1cee47&&_0x1cee47[_0xe5af('0x8e')]&&_0x1cee47['recordingFormat']!==_0xe5af('0x8f')){logger[_0xe5af('0x31')](_0xe5af('0x90'),_0xe5af('0x81'));_0x41bdb6[_0xe5af('0x82')]=_0x39edaf['serverUrl']+_0xe5af('0x83')+_0x41bdb6[_0xe5af('0x84')]+_0xe5af('0x85')+md5(_0x41bdb6['uniqueid']);}var _0x3ae91a=_0x39edaf[_0xe5af('0x7c')]===_0xe5af('0x86')?'eu':_0xe5af('0x87');return getAccessToken(_0x39edaf)[_0xe5af('0x2b')](function(_0x4b6f51){_0x1f97cb=_0x4b6f51;return getUser(_0x1f97cb,_0x3ae91a,_0x39edaf,_0x23deed[_0xe5af('0x88')]);})[_0xe5af('0x2b')](function(_0x476c87){_0x1b4bf4=_0x476c87;logger['info'](_0xe5af('0x89'),_0x1b4bf4['id']);return getEndUser(_0x1f97cb,_0x3ae91a,_0x39edaf,_0x41bdb6[_0xe5af('0x91')],_0x41bdb6[_0xe5af('0x92')],_0x1b4bf4,_0x49885e);})[_0xe5af('0x2b')](function(_0x188b17){_0x2fed46=_0x188b17;return getCall(_0x1f97cb,_0x3ae91a,_0x39edaf,_0x1b4bf4,_0x2fed46,_0x49885e,_0x41bdb6,_0xe5af('0x93'));})['then'](function(_0x260a34){if(_0x260a34){logger['info'](_0xe5af('0x94'),_0x260a34['id']);logger[_0xe5af('0x31')](_0xe5af('0x90'),_0xe5af('0x8c'));emit(util['format']('user:%s',_0x23deed['name']),_0xe5af('0x95'),{'uri':'https://crm.'+_0x39edaf[_0xe5af('0x7c')]+_0xe5af('0x96')+_0x260a34['id']});}})[_0xe5af('0x2e')](function(_0x1fe15f){logger[_0xe5af('0x2f')](_0xe5af('0x90'),JSON['stringify'](_0x1fe15f));});};exports[_0xe5af('0x97')]=function(_0x5cf813,_0x5663ce,_0x1e9dfc,_0x5805e8,_0x592f25,_0x27cc15){var _0x1aeb4d,_0x436e0e,_0x2cf0e6;_0x27cc15['host']=intUtil['stripTrailingSlash'](_0x27cc15[_0xe5af('0x7c')]);_0x27cc15[_0xe5af('0x7e')]=intUtil[_0xe5af('0x7d')](_0x27cc15[_0xe5af('0x7e')]);if(_0x592f25&&_0x592f25[_0xe5af('0x7f')]){logger[_0xe5af('0x31')]('['+_0x5663ce[_0xe5af('0x98')][_0xe5af('0x99')]()+']','Recording\x20is\x20enabled!');_0x5663ce['recordingURL']=_0x27cc15[_0xe5af('0x7e')]+'/api/voice/recordings/'+_0x5663ce[_0xe5af('0x84')]+_0xe5af('0x85')+md5(_0x5663ce['uniqueid']);}else{_0x5663ce[_0xe5af('0x82')]='';}var _0x32e0fc=_0x27cc15[_0xe5af('0x7c')]===_0xe5af('0x86')?'eu':_0xe5af('0x87');return getAccessToken(_0x27cc15)[_0xe5af('0x2b')](function(_0x2a17e9){_0x2cf0e6=_0x2a17e9;return getUser(_0x2cf0e6,_0x32e0fc,_0x27cc15);})[_0xe5af('0x2b')](function(_0x215520){_0x1aeb4d=_0x215520;logger['info'](_0xe5af('0x89'),_0x1aeb4d['id']);return getEndUser(_0x2cf0e6,_0x32e0fc,_0x27cc15,_0x5663ce[_0xe5af('0x8a')],_0x5663ce[_0xe5af('0x8b')],_0x1aeb4d,_0x1e9dfc);})[_0xe5af('0x2b')](function(_0x2b8cb5){_0x436e0e=_0x2b8cb5;return getCall(_0x2cf0e6,_0x32e0fc,_0x27cc15,_0x1aeb4d,_0x436e0e,_0x1e9dfc,_0x5663ce,_0xe5af('0x9a'));})[_0xe5af('0x2b')](function(_0x2497a0){if(_0x2497a0){logger['info'](_0xe5af('0x94'),_0x2497a0['id']);}})[_0xe5af('0x2e')](function(_0x2bcfc4){logger['error']('['+_0x5663ce[_0xe5af('0x98')]['toUpperCase']()+']',JSON[_0xe5af('0xf')](_0x2bcfc4));});}; \ No newline at end of file +var _0x81c9=['Agent\x20found!','findIndex','profile','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','moduleCreate','role','first_name','last_name','SUCCESS','details','Error:\x20','log','contact_lead','uri','https://www.zohoapis.','Contacts','Leads','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','Full_Name','First_Name','Last_Name','What_Id','startCase','talktime','Call_Duration','utc','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','mm:ss','lastevent','called','Call_Result','Called','complete','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','Call\x20created!','err','queue','host','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','The\x20User\x20ID\x20is:','calleridname','calleridnum','user:%s','trigger:browser:url','https://crm.','serverUrl','recordingFormat','none','zoho.eu','com','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','[OUTBOUND]','/crm/EntityInfo.do?module=Calls&id=','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','debug','stringify','length','forEach','includes','string','picklist','type','idField','toString','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','then','isArrayLikeObject','users','email'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x81c9,0xf7));var _0x981c=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x81c9[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x981c('0x0'));var rp=require(_0x981c('0x1'));var md5=require(_0x981c('0x2'));var util=require(_0x981c('0x3'));var intUtil=require(_0x981c('0x4'));var moment=require(_0x981c('0x5'));var Redis=require(_0x981c('0x6'));var BPromise=require(_0x981c('0x7'));var config=require('../../../../config/environment');var logger=require(_0x981c('0x8'))(_0x981c('0x9'));config[_0x981c('0xa')]=_[_0x981c('0xb')](config[_0x981c('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x981c('0xc'))(new Redis(config[_0x981c('0xa')]));function emit(_0xdfd42c,_0x1ff25a,_0x4bf75a){io['to'](_0xdfd42c)['emit'](_0x1ff25a,_0x4bf75a);}function request(_0x4f3ae3){logger[_0x981c('0xd')]('[HTTP]',JSON[_0x981c('0xe')](_0x4f3ae3));return rp(_0x4f3ae3);}function getCustomFields(_0x5f1776,_0x55f13d){var _0x2c5ad5={};if(_0x5f1776[_0x981c('0xf')]>0x0){_[_0x981c('0x10')](_0x5f1776,function(_0x5531ee){if(_[_0x981c('0x11')]([_0x981c('0x12'),_0x981c('0x13')],_0x5531ee[_0x981c('0x14')])&&_0x5531ee[_0x981c('0x15')]){_0x2c5ad5[_0x5531ee['idField']]=_0x5531ee['content'][_0x981c('0x16')]();}else if(_0x5531ee[_0x981c('0x14')]==='variable'&&_0x5531ee['variableName']&&_0x5531ee[_0x981c('0x15')]&&_0x55f13d[_0x5531ee['variableName']]){_0x2c5ad5[_0x5531ee[_0x981c('0x15')]]=_0x55f13d[_0x5531ee[_0x981c('0x17')]][_0x981c('0x16')]();}else if(_0x5531ee[_0x981c('0x14')]===_0x981c('0x18')&&_0x5531ee[_0x981c('0x19')]&&_0x5531ee[_0x981c('0x19')]['name']&&_0x5531ee[_0x981c('0x15')]&&_0x55f13d[_0x5531ee['Variable'][_0x981c('0x1a')][_0x981c('0x1b')]()]){_0x2c5ad5[_0x5531ee['idField']]=_0x55f13d[_0x5531ee[_0x981c('0x19')][_0x981c('0x1a')][_0x981c('0x1b')]()][_0x981c('0x16')]();}});}return _0x2c5ad5;}function getName(_0x173070){if(_0x173070['indexOf']('\x20')>0x0){var _0x4550a2=_0x173070[_0x981c('0x1c')](/ (.+)/);if(_0x4550a2[0x1]){return _0x4550a2;}}return[_0x173070,_0x173070];}var accountsTokens={};function getAccessToken(_0x3a0fda){return new Promise(function(_0x10b48a,_0x9106bb){if(!_['isNil'](accountsTokens[_0x3a0fda['id']])&&!_[_0x981c('0x1d')](accountsTokens[_0x3a0fda['id']][_0x981c('0x1e')])){if(moment()['isBefore'](accountsTokens[_0x3a0fda['id']][_0x981c('0x1f')])){_0x10b48a(accountsTokens[_0x3a0fda['id']]['access_token']);}}var _0x22af73;switch(_0x3a0fda[_0x981c('0x20')]){case'US':_0x22af73=_0x981c('0x21');break;case'AU':_0x22af73=_0x981c('0x22');break;case'EU':_0x22af73='https://accounts.zoho.eu';break;case'IN':_0x22af73='https://accounts.zoho.in';break;case'CN':_0x22af73='https://accounts.zoho.com.cn';break;default:_0x22af73=_0x981c('0x23');break;}var _0x1ecd4e={'method':_0x981c('0x24'),'uri':_0x22af73+_0x981c('0x25'),'qs':{'refresh_token':_0x3a0fda[_0x981c('0x26')],'client_id':_0x3a0fda[_0x981c('0x27')],'client_secret':_0x3a0fda[_0x981c('0x28')],'grant_type':_0x981c('0x29')},'json':!![]};return rp(_0x1ecd4e)['then'](function(_0x30cffe){accountsTokens[_0x3a0fda['id']]={'access_token':_0x30cffe['access_token'],'expires_in':moment()['add'](_0x30cffe[_0x981c('0x1f')],_0x981c('0x2a'))};_0x10b48a(_0x30cffe[_0x981c('0x1e')]);})[_0x981c('0x2b')](function(_0x2ba22c){logger[_0x981c('0x2c')](_0x981c('0x2d'),_0x2ba22c[_0x981c('0x2e')]);_0x9106bb(_0x2ba22c);});});}function getUser(_0x152efb,_0x224d53,_0x32eed9,_0x56d40d){logger[_0x981c('0x2f')](_0x981c('0x30'));return request({'method':_0x981c('0x31'),'uri':util[_0x981c('0x32')](_0x981c('0x33'),_0x224d53),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x981c('0x34')+_0x152efb},'json':!![]})[_0x981c('0x35')](function(_0x4825dc){if(_0x4825dc['users']){var _0x24a491=-0x1;if(_[_0x981c('0x36')](_0x4825dc[_0x981c('0x37')])){if(!_[_0x981c('0x1d')](_0x56d40d)){_0x24a491=_['findIndex'](_0x4825dc['users'],function(_0x1a4454){return _0x1a4454[_0x981c('0x38')]===_0x56d40d;});}if(_0x24a491>=0x0){logger['info'](_0x981c('0x39'));}else{logger[_0x981c('0x2f')]('Using\x20the\x20admin\x20account!');_0x24a491=_[_0x981c('0x3a')](_0x4825dc['users'],function(_0xb2b090){return _0xb2b090[_0x981c('0x3b')]['name']===_0x981c('0x3c');});}return _0x4825dc[_0x981c('0x37')][_0x24a491];}else{if(_0x4825dc[_0x981c('0x3d')]['profile'][_0x981c('0x1a')]===_0x981c('0x3c')){logger['info'](_0x981c('0x3e'));user=_0x4825dc[_0x981c('0x3d')];return user;}else{logger[_0x981c('0x2c')](_0x981c('0x3f'),JSON['stringify'](_0x4825dc));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x981c('0xe')](_0x4825dc));}}}else{logger['error'](_0x981c('0x3f'),JSON[_0x981c('0xe')](_0x4825dc));throw new Error(_0x981c('0x40')+JSON[_0x981c('0xe')](_0x4825dc));}})['catch'](function(_0x2afb95){console[_0x981c('0x2c')](_0x2afb95);});}function getZohoUser(_0x4878e6,_0x4815ea){return new BPromise(function(_0x7b6e3e,_0x1c46c2){request(_0x4878e6)[_0x981c('0x35')](function(_0x31c0e9){var _0x17d546=null;if(_0x31c0e9){_0x17d546=_0x31c0e9[_0x981c('0x41')][0x0];_0x17d546[_0x981c('0x42')]=_0x4815ea;}_0x7b6e3e(_0x17d546);})[_0x981c('0x2b')](function(_0x15f3ea){_0x1c46c2(_0x15f3ea);});});}function createEndUser(_0x2af251,_0x31a889,_0x1812f0,_0x6ff693,_0x1bd0f6,_0x18d6f2){var _0x1812f0=getName(_0x1812f0);return request({'method':_0x981c('0x24'),'uri':'https://www.zohoapis.'+_0x31a889+_0x981c('0x43')+_['startCase'](_0x18d6f2[_0x981c('0x44')])+'s','body':{'data':[{'Last_Name':_0x1812f0[0x1],'First_Name':_0x1812f0[0x0],'Phone':_0x6ff693,'Owner':{'name':!_[_0x981c('0x1d')](_0x1bd0f6[_0x981c('0x45')]['name'])?_0x1bd0f6[_0x981c('0x45')]['name']:!_[_0x981c('0x1d')](_0x1bd0f6['first_name'])?_0x1bd0f6[_0x981c('0x46')]+'\x20'+_0x1bd0f6[_0x981c('0x47')]:_0x1bd0f6['last_name'],'id':_0x1bd0f6['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2af251},'json':!![]})['then'](function(_0x3a989e){if(_0x3a989e&&_0x3a989e[_0x981c('0x41')][0x0]['code']===_0x981c('0x48')){var _0x290f00=_0x3a989e['data'][0x0][_0x981c('0x49')];_0x290f00['enduserType']=_['startCase'](_0x18d6f2[_0x981c('0x44')])+'s';return _0x290f00;}logger['error'](_0x981c('0x3f'),JSON[_0x981c('0xe')](data));throw new Error(_0x981c('0x4a')+JSON[_0x981c('0xe')](data));})['catch'](function(_0x42fc4c){console[_0x981c('0x4b')]('CREATE\x20ERROR',_0x42fc4c);});}function getEndUser(_0x3268f1,_0x23070e,_0x50627c,_0xf9ab5d,_0x5de5bc,_0x305f00,_0x315eb8){var _0x461a52={'method':_0x981c('0x31'),'uri':'','headers':{'Authorization':_0x981c('0x34')+_0x3268f1},'json':!![]};switch(_0x315eb8['moduleSearch']){case _0x981c('0x4c'):_0x461a52[_0x981c('0x4d')]=_0x981c('0x4e')+_0x23070e+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x5de5bc+'))';return getZohoUser(_0x461a52,_0x981c('0x4f'))['then'](function(_0x25ca25){if(_0x25ca25)return _0x25ca25;_0x461a52['uri']=_0x981c('0x4e')+_0x23070e+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5de5bc+'))';return getZohoUser(_0x461a52,_0x981c('0x50'))[_0x981c('0x35')](function(_0x1e3bd9){if(_0x1e3bd9)return _0x1e3bd9;if(_0x315eb8[_0x981c('0x44')]!=_0x981c('0x51')){return createEndUser(_0x3268f1,_0x23070e,_0xf9ab5d,_0x5de5bc,_0x305f00,_0x315eb8);}else{return{};}});});break;case'contact':_0x461a52[_0x981c('0x4d')]=_0x981c('0x4e')+_0x23070e+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x5de5bc+'))';return getZohoUser(_0x461a52,_0x981c('0x4f'))[_0x981c('0x35')](function(_0x4b125f){if(_0x4b125f)return _0x4b125f;if(_0x315eb8[_0x981c('0x44')]!='nothing'){return createEndUser(_0x3268f1,_0x23070e,_0xf9ab5d,_0x5de5bc,_0x305f00,_0x315eb8);}else{return{};}});break;case _0x981c('0x52'):_0x461a52[_0x981c('0x4d')]=_0x981c('0x4e')+_0x23070e+_0x981c('0x53')+_0x5de5bc+'))';return getZohoUser(_0x461a52,_0x981c('0x50'))[_0x981c('0x35')](function(_0x4e5a2b){if(_0x4e5a2b)return _0x4e5a2b;if(_0x315eb8[_0x981c('0x44')]!=_0x981c('0x51')){return createEndUser(_0x3268f1,_0x23070e,_0xf9ab5d,_0x5de5bc,_0x305f00,_0x315eb8);}else{return{};}});break;}}function getCall(_0x14dd21,_0x299878,_0x285df0,_0x48c6a5,_0x816275,_0x1edcdd,_0x3cf624,_0x4eee9f){logger[_0x981c('0x2f')](_0x981c('0x54'));var _0x305c71={};_0x305c71[_0x981c('0x55')]={'name':!_[_0x981c('0x1d')](_0x48c6a5['role'][_0x981c('0x1a')])&&!_[_0x981c('0x1d')](_0x48c6a5['profile']['name'])&&_0x48c6a5[_0x981c('0x3b')]['name']===_0x981c('0x56')?_0x48c6a5['role'][_0x981c('0x1a')]:!_[_0x981c('0x1d')](_0x48c6a5[_0x981c('0x46')])?_0x48c6a5[_0x981c('0x46')]+'\x20'+_0x48c6a5[_0x981c('0x47')]:_0x48c6a5[_0x981c('0x47')],'id':_0x48c6a5['id']};_0x305c71[_0x981c('0x57')]=intUtil['getString'](_0x1edcdd[_0x981c('0x58')],_0x3cf624,'\x20');_0x305c71[_0x981c('0x59')]=intUtil[_0x981c('0x5a')](_0x1edcdd['Descriptions'],_0x3cf624,'\x0a');if(_0x816275[_0x981c('0x42')]===_0x981c('0x4f')){_0x305c71['Who_Id']={'name':!_['isNil'](_0x816275[_0x981c('0x5b')])?_0x816275[_0x981c('0x5b')]:!_['isNil'](_0x816275[_0x981c('0x5c')])?_0x816275[_0x981c('0x5c')]+'\x20'+_0x816275['Last_Name']:_0x816275[_0x981c('0x5d')],'id':_0x816275['id']};}if(_0x816275[_0x981c('0x42')]===_0x981c('0x50')){_0x305c71[_0x981c('0x5e')]={'name':!_[_0x981c('0x1d')](_0x816275['Full_Name'])?_0x816275[_0x981c('0x5b')]:!_['isNil'](_0x816275['First_Name'])?_0x816275[_0x981c('0x5c')]+'\x20'+_0x816275[_0x981c('0x5d')]:_0x816275[_0x981c('0x5d')],'id':_0x816275['id']};_0x305c71['$se_module']=_[_0x981c('0x5f')](_0x816275[_0x981c('0x42')]);}if(_0x3cf624[_0x981c('0x60')]){_0x305c71[_0x981c('0x61')]=moment[_0x981c('0x62')](parseInt(_0x3cf624[_0x981c('0x60')])*0x3e8)[_0x981c('0x32')]('mm:ss');}else if(_0x3cf624[_0x981c('0x63')]&&_0x3cf624[_0x981c('0x64')]){_0x305c71['Call_Duration']=moment[_0x981c('0x62')](moment(_0x3cf624[_0x981c('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0x981c('0x65')](moment(_0x3cf624[_0x981c('0x66')],_0x981c('0x67'))))[_0x981c('0x32')](_0x981c('0x68'));}switch(_0x3cf624[_0x981c('0x69')]){case _0x981c('0x6a'):_0x305c71[_0x981c('0x6b')]=_0x981c('0x6c');break;case _0x981c('0x6d'):case'connect':_0x305c71[_0x981c('0x6b')]='Answered';break;case _0x981c('0x6e'):_0x305c71['Call_Result']='Rejected';break;case _0x981c('0x6f'):_0x305c71['Call_Result']=_0x981c('0x70');break;case _0x981c('0x71'):_0x305c71[_0x981c('0x6b')]=_0x981c('0x72');default:}_0x305c71[_0x981c('0x73')]=(_0x4eee9f==='outbound'?moment(_0x3cf624[_0x981c('0x66')])[_0x981c('0x32')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x3cf624[_0x981c('0x74')])[_0x981c('0x32')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x981c('0x32')](_0x981c('0x67'));_0x305c71[_0x981c('0x75')]=_0x4eee9f||_0x981c('0x76');_0x305c71=_[_0x981c('0x77')](_0x305c71,getCustomFields(_0x1edcdd[_0x981c('0x78')],_0x3cf624));return request({'method':_0x981c('0x24'),'uri':'https://www.zohoapis.'+_0x299878+_0x981c('0x79'),'headers':{'Authorization':_0x981c('0x34')+_0x14dd21},'body':{'data':[_0x305c71]},'json':!![]})[_0x981c('0x35')](function(_0x14c2c6){if(_0x14c2c6&&_0x14c2c6[_0x981c('0x41')][0x0][_0x981c('0x7a')]===_0x981c('0x48')){logger[_0x981c('0x2f')](_0x981c('0x7b'));return{'id':_0x14c2c6[_0x981c('0x41')][0x0]['details']['id']};}})[_0x981c('0x2b')](function(_0x32b926){logger[_0x981c('0x2f')](_0x981c('0x7c'),_0x32b926['stack']);console[_0x981c('0x4b')](_0x981c('0x7c'),_0x32b926);});}exports[_0x981c('0x7d')]=function(_0x512418,_0x50aaec,_0x513b14,_0x3097d2,_0x1c7abc,_0x586961){var _0x1e9c2c,_0x22312c,_0x451844;_0x586961['host']=intUtil['stripTrailingSlash'](_0x586961[_0x981c('0x7e')]);_0x586961['serverUrl']=intUtil[_0x981c('0x7f')](_0x586961['serverUrl']);if(_0x1c7abc&&_0x1c7abc[_0x981c('0x80')]){logger['info'](_0x981c('0x81'),_0x981c('0x82'));_0x50aaec[_0x981c('0x83')]=_0x586961['serverUrl']+_0x981c('0x84')+_0x50aaec[_0x981c('0x85')]+_0x981c('0x86')+md5(_0x50aaec['uniqueid']);}else{_0x50aaec[_0x981c('0x83')]='';}var _0x568531=_0x586961[_0x981c('0x7e')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x586961)[_0x981c('0x35')](function(_0x517433){_0x451844=_0x517433;return getUser(_0x451844,_0x568531,_0x586961,_0x3097d2[_0x981c('0x38')]);})['then'](function(_0x15e21a){_0x1e9c2c=_0x15e21a;logger[_0x981c('0x2f')](_0x981c('0x87'),_0x1e9c2c['id']);return getEndUser(_0x451844,_0x568531,_0x586961,_0x50aaec[_0x981c('0x88')],_0x50aaec[_0x981c('0x89')],_0x1e9c2c,_0x513b14);})[_0x981c('0x35')](function(_0x32a7c6){_0x22312c=_0x32a7c6;return getCall(_0x451844,_0x568531,_0x586961,_0x1e9c2c,_0x22312c,_0x513b14,_0x50aaec,_0x981c('0x76'));})[_0x981c('0x35')](function(_0x4a3546){if(_0x4a3546){logger[_0x981c('0x2f')]('The\x20Call\x20ID\x20is:',_0x4a3546['id']);logger[_0x981c('0x2f')](_0x981c('0x81'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x981c('0x32')](_0x981c('0x8a'),_0x3097d2[_0x981c('0x1a')]),_0x981c('0x8b'),{'uri':_0x981c('0x8c')+_0x586961[_0x981c('0x7e')]+'/crm/EntityInfo.do?module=Calls&id='+_0x4a3546['id']});}})[_0x981c('0x2b')](function(_0x5123bb){logger['error'](_0x981c('0x81'),JSON[_0x981c('0xe')](_0x5123bb));});};exports['outbound']=function(_0x1b4382,_0x39c4d5,_0x506e08,_0x187d0b,_0x1f2cd9,_0x49671b,_0xf697a5){var _0x27ec50,_0x5d3dca,_0x428c8a;_0x49671b[_0x981c('0x7e')]=intUtil[_0x981c('0x7f')](_0x49671b['host']);_0x49671b[_0x981c('0x8d')]=intUtil[_0x981c('0x7f')](_0x49671b[_0x981c('0x8d')]);if(_0xf697a5&&_0xf697a5[_0x981c('0x8e')]&&_0xf697a5[_0x981c('0x8e')]!==_0x981c('0x8f')){logger['info']('[OUTBOUND]',_0x981c('0x82'));_0x39c4d5[_0x981c('0x83')]=_0x49671b[_0x981c('0x8d')]+'/api/voice/recordings/'+_0x39c4d5['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x39c4d5[_0x981c('0x85')]);}var _0x91a9f5=_0x49671b[_0x981c('0x7e')]===_0x981c('0x90')?'eu':_0x981c('0x91');return getAccessToken(_0x49671b)[_0x981c('0x35')](function(_0x4fbe10){_0x428c8a=_0x4fbe10;return getUser(_0x428c8a,_0x91a9f5,_0x49671b,_0x187d0b[_0x981c('0x38')]);})[_0x981c('0x35')](function(_0x2f6370){_0x27ec50=_0x2f6370;logger[_0x981c('0x2f')](_0x981c('0x87'),_0x27ec50['id']);return getEndUser(_0x428c8a,_0x91a9f5,_0x49671b,_0x39c4d5[_0x981c('0x92')],_0x39c4d5[_0x981c('0x93')],_0x27ec50,_0x506e08);})[_0x981c('0x35')](function(_0x4d364f){_0x5d3dca=_0x4d364f;return getCall(_0x428c8a,_0x91a9f5,_0x49671b,_0x27ec50,_0x5d3dca,_0x506e08,_0x39c4d5,_0x981c('0x94'));})[_0x981c('0x35')](function(_0x21cde0){if(_0x21cde0){logger[_0x981c('0x2f')](_0x981c('0x95'),_0x21cde0['id']);logger[_0x981c('0x2f')](_0x981c('0x96'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x981c('0x32')](_0x981c('0x8a'),_0x187d0b['name']),_0x981c('0x8b'),{'uri':_0x981c('0x8c')+_0x49671b[_0x981c('0x7e')]+_0x981c('0x97')+_0x21cde0['id']});}})[_0x981c('0x2b')](function(_0x110a60){logger[_0x981c('0x2c')](_0x981c('0x96'),JSON['stringify'](_0x110a60));});};exports['unmanaged']=function(_0x36d93d,_0x1516e2,_0x5b5e15,_0x2ac194,_0xde289c,_0x1cc5d0){var _0x10696b,_0x3515d2,_0x5ab556;_0x1cc5d0[_0x981c('0x7e')]=intUtil[_0x981c('0x7f')](_0x1cc5d0[_0x981c('0x7e')]);_0x1cc5d0[_0x981c('0x8d')]=intUtil[_0x981c('0x7f')](_0x1cc5d0['serverUrl']);if(_0xde289c&&_0xde289c[_0x981c('0x80')]){logger['info']('['+_0x1516e2[_0x981c('0x69')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1516e2[_0x981c('0x83')]=_0x1cc5d0[_0x981c('0x8d')]+_0x981c('0x84')+_0x1516e2['uniqueid']+_0x981c('0x86')+md5(_0x1516e2[_0x981c('0x85')]);}else{_0x1516e2[_0x981c('0x83')]='';}var _0x2def7a=_0x1cc5d0['host']===_0x981c('0x90')?'eu':'com';return getAccessToken(_0x1cc5d0)['then'](function(_0x58862d){_0x5ab556=_0x58862d;return getUser(_0x5ab556,_0x2def7a,_0x1cc5d0);})['then'](function(_0x122225){_0x10696b=_0x122225;logger[_0x981c('0x2f')](_0x981c('0x87'),_0x10696b['id']);return getEndUser(_0x5ab556,_0x2def7a,_0x1cc5d0,_0x1516e2[_0x981c('0x88')],_0x1516e2['calleridnum'],_0x10696b,_0x5b5e15);})[_0x981c('0x35')](function(_0xc9a2c1){_0x3515d2=_0xc9a2c1;return getCall(_0x5ab556,_0x2def7a,_0x1cc5d0,_0x10696b,_0x3515d2,_0x5b5e15,_0x1516e2,'Inbound');})[_0x981c('0x35')](function(_0x5046cc){if(_0x5046cc){logger[_0x981c('0x2f')]('The\x20Call\x20ID\x20is:',_0x5046cc['id']);}})[_0x981c('0x2b')](function(_0xf7df){logger['error']('['+_0x1516e2[_0x981c('0x69')]['toUpperCase']()+']',JSON['stringify'](_0xf7df));});}; \ 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 cd98a88..99aacef 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 _0x7659=['mustache','../../../../config/logger','trigger','exec','data2','Script','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x4a56e1,_0x1ef40c){var _0x806054=function(_0x171454){while(--_0x171454){_0x4a56e1['push'](_0x4a56e1['shift']());}};_0x806054(++_0x1ef40c);}(_0x7659,0xd0));var _0x9765=function(_0x174c9d,_0x5d0fc2){_0x174c9d=_0x174c9d-0x0;var _0x13bf70=_0x7659[_0x174c9d];return _0x13bf70;};'use strict';var util=require(_0x9765('0x0'));var sh=require(_0x9765('0x1'));var Mustache=require(_0x9765('0x2'));var logger=require(_0x9765('0x3'))(_0x9765('0x4'));exports[_0x9765('0x5')]=function(_0x5ea3e9,_0x37f0f9){var _0xb1f38c=_0x5ea3e9[_0x9765('0x6')]?_0x5ea3e9[_0x9765('0x6')]:_0x9765('0x7');var _0x1be10e=_0x5ea3e9['data3']?Mustache['render'](_0x5ea3e9[_0x9765('0x8')],_0x37f0f9):_0x37f0f9;sh['exec'](_0x1be10e,function(_0x49bc2a,_0x5bd0ec,_0x418095){if(_0x49bc2a!==0x0){logger[_0x9765('0x9')](util[_0x9765('0xa')](_0x9765('0xb'),_0xb1f38c,_0x1be10e,_0x49bc2a,_0x418095));}else{logger[_0x9765('0xc')](util[_0x9765('0xa')](_0x9765('0xd'),_0xb1f38c,_0x1be10e,_0x5bd0ec));}});}; \ No newline at end of file +var _0xbf55=['../../../../config/logger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs'];(function(_0x49d0eb,_0x45ed48){var _0x414315=function(_0x2a5ca0){while(--_0x2a5ca0){_0x49d0eb['push'](_0x49d0eb['shift']());}};_0x414315(++_0x45ed48);}(_0xbf55,0x199));var _0x5bf5=function(_0xb446d3,_0x25eb4f){_0xb446d3=_0xb446d3-0x0;var _0x3e8394=_0xbf55[_0xb446d3];return _0x3e8394;};'use strict';var util=require('util');var sh=require(_0x5bf5('0x0'));var Mustache=require('mustache');var logger=require(_0x5bf5('0x1'))('trigger');exports[_0x5bf5('0x2')]=function(_0x340900,_0x3c5e70){var _0x5ed70b=_0x340900['data2']?_0x340900[_0x5bf5('0x3')]:_0x5bf5('0x4');var _0x2a9fed=_0x340900[_0x5bf5('0x5')]?Mustache[_0x5bf5('0x6')](_0x340900[_0x5bf5('0x5')],_0x3c5e70):_0x3c5e70;sh[_0x5bf5('0x2')](_0x2a9fed,function(_0x4fb895,_0x21a10e,_0x242c54){if(_0x4fb895!==0x0){logger[_0x5bf5('0x7')](util[_0x5bf5('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x5ed70b,_0x2a9fed,_0x4fb895,_0x242c54));}else{logger['info'](util[_0x5bf5('0x8')](_0x5bf5('0x9'),_0x5ed70b,_0x2a9fed,_0x21a10e));}});}; \ 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 36fda01..881f23d 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 _0x303e=['format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','trigger','data2','data5','number','data6','parse','render','error','stack','data1','toUpperCase','GET','DELETE','PUT','data7','body','info'];(function(_0x3fe1f8,_0x140c18){var _0x1ade72=function(_0x35b2a4){while(--_0x35b2a4){_0x3fe1f8['push'](_0x3fe1f8['shift']());}};_0x1ade72(++_0x140c18);}(_0x303e,0x6b));var _0xe303=function(_0x4a22c3,_0x461394){_0x4a22c3=_0x4a22c3-0x0;var _0x58f1ec=_0x303e[_0x4a22c3];return _0x58f1ec;};'use strict';var rp=require(_0xe303('0x0'));var util=require(_0xe303('0x1'));var _=require(_0xe303('0x2'));var Mustache=require(_0xe303('0x3'));var logger=require('../../../../config/logger')(_0xe303('0x4'));exports['exec']=function(_0x1b3c1c,_0x55abd0){var _0x57f035,_0x172ae2;var _0x4a67a1={'method':_0x1b3c1c['data1']['toUpperCase'](),'uri':Mustache['render'](_0x1b3c1c[_0xe303('0x5')],_0x55abd0),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1b3c1c[_0xe303('0x6')])===_0xe303('0x7')&&parseInt(_0x1b3c1c[_0xe303('0x6')])>=0x1&&parseInt(_0x1b3c1c[_0xe303('0x6')])<=0xa?parseInt(_0x1b3c1c[_0xe303('0x6')])*0x3e8:0x5*0x3e8};try{_0x4a67a1['headers']=_0x1b3c1c[_0xe303('0x8')]?JSON[_0xe303('0x9')](Mustache[_0xe303('0xa')](_0x1b3c1c['data6'],_0x55abd0)):{};}catch(_0xf8adaa){logger[_0xe303('0xb')](_0xf8adaa[_0xe303('0xc')]);}switch(_0x1b3c1c[_0xe303('0xd')][_0xe303('0xe')]()){case _0xe303('0xf'):case _0xe303('0x10'):_0x57f035=null;_0x4a67a1['qs']=_0x55abd0;break;case'POST':case _0xe303('0x11'):if(_0x1b3c1c[_0xe303('0x12')]){try{_0x57f035=JSON['parse'](Mustache[_0xe303('0xa')](_0x1b3c1c[_0xe303('0x12')],_0x55abd0));_0x4a67a1['body']=_0x57f035;}catch(_0x1fd7a6){logger[_0xe303('0xb')](_0x1fd7a6[_0xe303('0xc')]);logger[_0xe303('0xb')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x57f035=_0x55abd0;_0x4a67a1[_0xe303('0x13')]=_0x57f035;}break;}logger[_0xe303('0x14')](util[_0xe303('0x15')](_0xe303('0x16'),_0x1b3c1c['data1'],_0x1b3c1c[_0xe303('0x5')],JSON[_0xe303('0x17')](_0x4a67a1)));rp(_0x4a67a1)[_0xe303('0x18')](function(_0x4828e4){_0x57f035=!_[_0xe303('0x19')](_0x57f035)?_0xe303('0x1a')+_0x57f035:'';_0x172ae2=typeof _0x4828e4['body']==='object'?JSON[_0xe303('0x17')](_0x4828e4[_0xe303('0x13')]):_0x4828e4[_0xe303('0x13')];logger['info'](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x1b3c1c['data1'],_0x1b3c1c[_0xe303('0x5')],_0x4828e4[_0xe303('0x1b')],_0x172ae2));})[_0xe303('0x1c')](function(_0x32f9d7){logger[_0xe303('0xb')](util[_0xe303('0x15')](_0xe303('0x1d'),_0x1b3c1c['data1'],_0x1b3c1c[_0xe303('0x5')],_0x32f9d7[_0xe303('0x1b')],_0x32f9d7[_0xe303('0x1e')],_0x32f9d7[_0xe303('0x1f')]));});}; \ No newline at end of file +var _0x7cc7=['exec','data1','toUpperCase','render','data2','number','data5','data6','parse','error','GET','POST','PUT','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','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','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger'];(function(_0x7a6b60,_0x115eba){var _0x37c397=function(_0x32fefa){while(--_0x32fefa){_0x7a6b60['push'](_0x7a6b60['shift']());}};_0x37c397(++_0x115eba);}(_0x7cc7,0xda));var _0x77cc=function(_0x145b17,_0x4d8b7e){_0x145b17=_0x145b17-0x0;var _0x3107a7=_0x7cc7[_0x145b17];return _0x3107a7;};'use strict';var rp=require(_0x77cc('0x0'));var util=require(_0x77cc('0x1'));var _=require(_0x77cc('0x2'));var Mustache=require(_0x77cc('0x3'));var logger=require(_0x77cc('0x4'))(_0x77cc('0x5'));exports[_0x77cc('0x6')]=function(_0x231261,_0x40beac){var _0x2c2479,_0xb7378d;var _0x7e256={'method':_0x231261[_0x77cc('0x7')][_0x77cc('0x8')](),'uri':Mustache[_0x77cc('0x9')](_0x231261[_0x77cc('0xa')],_0x40beac),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x231261['data5'])===_0x77cc('0xb')&&parseInt(_0x231261['data5'])>=0x1&&parseInt(_0x231261[_0x77cc('0xc')])<=0xa?parseInt(_0x231261['data5'])*0x3e8:0x5*0x3e8};try{_0x7e256['headers']=_0x231261[_0x77cc('0xd')]?JSON[_0x77cc('0xe')](Mustache['render'](_0x231261[_0x77cc('0xd')],_0x40beac)):{};}catch(_0x46066b){logger[_0x77cc('0xf')](_0x46066b['stack']);}switch(_0x231261[_0x77cc('0x7')][_0x77cc('0x8')]()){case _0x77cc('0x10'):case'DELETE':_0x2c2479=null;_0x7e256['qs']=_0x40beac;break;case _0x77cc('0x11'):case _0x77cc('0x12'):if(_0x231261['data7']){try{_0x2c2479=JSON['parse'](Mustache['render'](_0x231261[_0x77cc('0x13')],_0x40beac));_0x7e256[_0x77cc('0x14')]=_0x2c2479;}catch(_0xf87d49){logger[_0x77cc('0xf')](_0xf87d49[_0x77cc('0x15')]);logger[_0x77cc('0xf')](_0x77cc('0x16'));}}else{_0x2c2479=_0x40beac;_0x7e256[_0x77cc('0x14')]=_0x2c2479;}break;}logger['info'](util[_0x77cc('0x17')](_0x77cc('0x18'),_0x231261[_0x77cc('0x7')],_0x231261['data2'],JSON['stringify'](_0x7e256)));rp(_0x7e256)[_0x77cc('0x19')](function(_0x439b87){_0x2c2479=!_[_0x77cc('0x1a')](_0x2c2479)?_0x77cc('0x1b')+_0x2c2479:'';_0xb7378d=typeof _0x439b87[_0x77cc('0x14')]===_0x77cc('0x1c')?JSON[_0x77cc('0x1d')](_0x439b87[_0x77cc('0x14')]):_0x439b87['body'];logger['info'](util[_0x77cc('0x17')](_0x77cc('0x1e'),_0x231261[_0x77cc('0x7')],_0x231261['data2'],_0x439b87['statusCode'],_0xb7378d));})['catch'](function(_0x2044a9){logger[_0x77cc('0xf')](util[_0x77cc('0x17')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x231261['data1'],_0x231261['data2'],_0x2044a9['statusCode'],_0x2044a9['name'],_0x2044a9[_0x77cc('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 9fc5af7..bfeb4f9 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 _0x3e3f=['jayson/promise','bluebird','routing','client','http','Request','request','then','debug','error','rpc','message','catch','exports'];(function(_0x2e1b00,_0xed8260){var _0x33852a=function(_0x2277f8){while(--_0x2277f8){_0x2e1b00['push'](_0x2e1b00['shift']());}};_0x33852a(++_0xed8260);}(_0x3e3f,0xc4));var _0xf3e3=function(_0x26231e,_0x14b4a7){_0x26231e=_0x26231e-0x0;var _0x298707=_0x3e3f[_0x26231e];return _0x298707;};'use strict';var jayson=require(_0xf3e3('0x0'));var BPromise=require(_0xf3e3('0x1'));var logger=require('../../config/logger')(_0xf3e3('0x2'));var client=jayson[_0xf3e3('0x3')][_0xf3e3('0x4')]({'port':0x2329});client[_0xf3e3('0x5')]=function(_0x5d09bd,_0x3fcef4){return new BPromise(function(_0x4cd40f,_0x2cbb6a){return client[_0xf3e3('0x6')](_0x5d09bd,_0x3fcef4)[_0xf3e3('0x7')](function(_0x4469af){logger[_0xf3e3('0x8')]('rpc',_0xf3e3('0x2'),_0x5d09bd,_0x3fcef4,_0x4469af);if(_0x4469af[_0xf3e3('0x9')]){logger['error'](_0xf3e3('0xa'),_0xf3e3('0x2'),_0x5d09bd,_0x4469af[_0xf3e3('0x9')][_0xf3e3('0xb')],_0x3fcef4);return _0x2cbb6a(_0x4469af[_0xf3e3('0x9')]['message']);}else{return _0x4cd40f(_0x4469af['result']);}})[_0xf3e3('0xc')](function(_0x5d8ebf){logger[_0xf3e3('0x9')](_0xf3e3('0xa'),_0xf3e3('0x2'),_0x5d09bd,_0x5d8ebf,_0x3fcef4);return _0x2cbb6a(_0x5d8ebf);});});};module[_0xf3e3('0xd')]=client; \ No newline at end of file +var _0x4f73=['result','catch','exports','jayson/promise','../../config/logger','request','then','debug','rpc','routing','error'];(function(_0x4cd81b,_0x28e47b){var _0x2f1116=function(_0x377314){while(--_0x377314){_0x4cd81b['push'](_0x4cd81b['shift']());}};_0x2f1116(++_0x28e47b);}(_0x4f73,0xdf));var _0x34f7=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x4f73[_0x1fafa5];return _0xcf08c9;};'use strict';var jayson=require(_0x34f7('0x0'));var BPromise=require('bluebird');var logger=require(_0x34f7('0x1'))('routing');var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x119153,_0x3d654d){return new BPromise(function(_0x33f5dd,_0x1c23d8){return client[_0x34f7('0x2')](_0x119153,_0x3d654d)[_0x34f7('0x3')](function(_0x553db6){logger[_0x34f7('0x4')](_0x34f7('0x5'),_0x34f7('0x6'),_0x119153,_0x3d654d,_0x553db6);if(_0x553db6[_0x34f7('0x7')]){logger[_0x34f7('0x7')](_0x34f7('0x5'),_0x34f7('0x6'),_0x119153,_0x553db6[_0x34f7('0x7')]['message'],_0x3d654d);return _0x1c23d8(_0x553db6[_0x34f7('0x7')]['message']);}else{return _0x33f5dd(_0x553db6[_0x34f7('0x8')]);}})[_0x34f7('0x9')](function(_0x4af108){logger[_0x34f7('0x7')](_0x34f7('0x5'),'routing',_0x119153,_0x4af108,_0x3d654d);return _0x1c23d8(_0x4af108);});});};module[_0x34f7('0xa')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 48fdbb1..d83a4be 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 _0x6e8f=['./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','refresh','mailAccounts','listen','catch','Email\x20service\x20initialization','./server'];(function(_0x1b81b9,_0x1d314a){var _0x27a94d=function(_0x3f2916){while(--_0x3f2916){_0x1b81b9['push'](_0x1b81b9['shift']());}};_0x27a94d(++_0x1d314a);}(_0x6e8f,0x15b));var _0xf6e8=function(_0x46c33a,_0x40b748){_0x46c33a=_0x46c33a-0x0;var _0x251c44=_0x6e8f[_0x46c33a];return _0x251c44;};'use strict';var server=require(_0xf6e8('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0xf6e8('0x1'));var setting=require(_0xf6e8('0x2'));var logger=require(_0xf6e8('0x3'))(_0xf6e8('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xf6e8('0x5')]()[_0xf6e8('0x6')](mailAccount['getMailAccounts']())[_0xf6e8('0x6')](realtime['initMailAccounts']())[_0xf6e8('0x6')](function(){email[_0xf6e8('0x7')](realtime[_0xf6e8('0x8')]);return realtime;});}function main(){return server[_0xf6e8('0x9')](realtime,email)[_0xf6e8('0x6')](function(){return initRealtime();})[_0xf6e8('0x6')](function(){return setting['getSettings']();})[_0xf6e8('0x6')](function(_0x2d997e){return setInterval(initRealtime,_0x2d997e['loginMailFrequency']*0x3e8);})[_0xf6e8('0xa')](function(_0x451afd){logger['error'](_0xf6e8('0xb'),_0x451afd);});}main(); \ No newline at end of file +var _0xa4a5=['resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/setting','../../config/logger'];(function(_0x415be9,_0x35eb61){var _0xf13891=function(_0x2a8e8c){while(--_0x2a8e8c){_0x415be9['push'](_0x415be9['shift']());}};_0xf13891(++_0x35eb61);}(_0xa4a5,0x136));var _0x5a4a=function(_0x1dbb05,_0x24e9d4){_0x1dbb05=_0x1dbb05-0x0;var _0x1c459a=_0xa4a5[_0x1dbb05];return _0x1c459a;};'use strict';var server=require(_0x5a4a('0x0'));var Realtime=require(_0x5a4a('0x1'));var EmailChannel=require(_0x5a4a('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x5a4a('0x3'));var logger=require(_0x5a4a('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x5a4a('0x5')]()[_0x5a4a('0x6')](mailAccount[_0x5a4a('0x7')]())['then'](realtime[_0x5a4a('0x8')]())['then'](function(){email[_0x5a4a('0x9')](realtime[_0x5a4a('0xa')]);return realtime;});}function main(){return server[_0x5a4a('0xb')](realtime,email)[_0x5a4a('0x6')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0x5a4a('0x6')](function(_0xb825d9){return setInterval(initRealtime,_0xb825d9['loginMailFrequency']*0x3e8);})[_0x5a4a('0xc')](function(_0x4cf108){logger[_0x5a4a('0xd')](_0x5a4a('0xe'),_0x4cf108);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 6ee4aab..abe22c4 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 _0x29c6=['info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','key','active','Imap','messageStatus','total','isNil','md5','emit','mailAccount:update','prototype','refresh','hasOwnProperty','service','custom','provider','box','handleImapBox','bind','email','end','handleImapEnd','error','handleImapError','status','disabled','connected','name','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','send','Smtp','lastSync','verify','verified','exports','moment','ioredis','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','./imap','../rpc/mailAccount'];(function(_0x3fb0a0,_0x255581){var _0x43d889=function(_0x2ed029){while(--_0x2ed029){_0x3fb0a0['push'](_0x3fb0a0['shift']());}};_0x43d889(++_0x255581);}(_0x29c6,0x153));var _0x629c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x29c6[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var moment=require(_0x629c('0x0'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0x629c('0x1'));var config=require(_0x629c('0x2'));var logger=require(_0x629c('0x3'))('email');config[_0x629c('0x4')]=_[_0x629c('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x629c('0x6'))(new Redis(config[_0x629c('0x4')]));var EmailImap=require(_0x629c('0x7'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x629c('0x8'));var md5Accounts={};function EmailChannel(_0x3c5b81){logger[_0x629c('0x9')](_0x629c('0xa'));this[_0x629c('0xb')]=_0x3c5b81['mailAccounts'];this[_0x629c('0xc')]={};this[_0x629c('0xd')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x4ca257){var _0x30b354=this[_0x629c('0xb')][_0x4ca257];var _0x12e51f={'id':_0x30b354['id'],'name':_0x30b354['name'],'key':_0x30b354[_0x629c('0xe')],'active':_0x30b354[_0x629c('0xf')],'Imap':{'status':_0x30b354[_0x629c('0x10')]['status'],'messageStatus':_0x30b354[_0x629c('0x10')][_0x629c('0x11')],'total':_0x30b354[_0x629c('0x10')][_0x629c('0x12')]}};if(_[_0x629c('0x13')](md5Accounts[_0x4ca257])){md5Accounts[_0x4ca257]={};}var _0x3a297c=md5(JSON['stringify'](_0x12e51f));if(md5Accounts[_0x4ca257][_0x629c('0x14')]!==_0x3a297c){md5Accounts[_0x4ca257]['md5']=_0x3a297c;io[_0x629c('0x15')](_0x629c('0x16'),_0x12e51f);}};EmailChannel[_0x629c('0x17')][_0x629c('0x18')]=function(_0x11d574){for(var _0x1a85eb in _0x11d574){if(_0x11d574[_0x629c('0x19')](_0x1a85eb)){if(_0x11d574[_0x1a85eb][_0x629c('0x10')]&&_0x11d574[_0x1a85eb][_0x629c('0xf')]){var _0x3d3657=_0x11d574[_0x1a85eb]['Imap'];if(!_0x3d3657[_0x629c('0x1a')]&&_0x11d574[_0x1a85eb]['provider']!==_0x629c('0x1b'))_0x3d3657[_0x629c('0x1a')]=_0x11d574[_0x1a85eb][_0x629c('0x1c')];if(!this[_0x629c('0xc')][_0x629c('0x19')](_0x3d3657['id'])){this[_0x629c('0xc')][_0x3d3657['id']]=new EmailImap(_0x3d3657,_0x11d574[_0x1a85eb]['email']);this[_0x629c('0xc')][_0x3d3657['id']]['on'](_0x629c('0x1d'),this[_0x629c('0x1e')][_0x629c('0x1f')](this,_0x1a85eb));this[_0x629c('0xc')][_0x3d3657['id']]['on'](_0x629c('0x20'),this['handleImapEmail'][_0x629c('0x1f')](this,_0x1a85eb));this['imapAccounts'][_0x3d3657['id']]['on'](_0x629c('0x21'),this[_0x629c('0x22')][_0x629c('0x1f')](this,_0x1a85eb));this['imapAccounts'][_0x3d3657['id']]['on'](_0x629c('0x23'),this[_0x629c('0x24')][_0x629c('0x1f')](this,_0x1a85eb));}}else{if(_[_0x629c('0x13')](this[_0x629c('0xb')][_0x1a85eb][_0x629c('0x10')])){this[_0x629c('0xb')][_0x1a85eb][_0x629c('0x10')]={};}this[_0x629c('0xb')][_0x1a85eb][_0x629c('0x10')][_0x629c('0x25')]=_0x629c('0x26');this['mailAccounts'][_0x1a85eb][_0x629c('0x10')][_0x629c('0x11')]='';this[_0x629c('0x15')](_0x1a85eb);}}}};EmailChannel[_0x629c('0x17')][_0x629c('0x1e')]=function(_0x180687,_0x5e13b9){if(this[_0x629c('0xb')][_0x180687]){this[_0x629c('0xb')][_0x180687][_0x629c('0x10')]['status']=_0x629c('0x27');this[_0x629c('0xb')][_0x180687][_0x629c('0x10')][_0x629c('0x11')]=_0x5e13b9[_0x629c('0x28')];if(_0x5e13b9[_0x629c('0x29')]){this[_0x629c('0xb')][_0x180687]['Imap']['total']=_0x5e13b9['messages'][_0x629c('0x12')];}return this[_0x629c('0x15')](_0x180687);}};EmailChannel[_0x629c('0x17')][_0x629c('0x2a')]=function(_0x573574,_0x417657){logger['info'](_0x629c('0x2b'),_0x417657[_0x629c('0x2c')],_0x417657[_0x629c('0x2d')],_0x417657['from'],_0x573574);if(this[_0x629c('0xb')][_0x573574]){return mailAccount[_0x629c('0x2e')](_0x573574,_0x417657)[_0x629c('0x2f')](function(_0x2cb88a){if(_0x2cb88a){logger['info'](_0x629c('0x30'));}})[_0x629c('0x31')](function(_0x403d11){logger[_0x629c('0x23')](_0x629c('0x32'),JSON[_0x629c('0x33')](_0x403d11));});}};EmailChannel['prototype'][_0x629c('0x22')]=function(_0x7bb374){if(this['mailAccounts'][_0x7bb374]&&this[_0x629c('0xb')][_0x7bb374]['Imap']){if(this['imapAccounts'][this[_0x629c('0xb')][_0x7bb374][_0x629c('0x10')]['id']]){delete this[_0x629c('0xc')][this['mailAccounts'][_0x7bb374][_0x629c('0x10')]['id']];}this['mailAccounts'][_0x7bb374][_0x629c('0x10')]['lastSync']=moment();this['emit'](_0x7bb374);}};EmailChannel[_0x629c('0x17')][_0x629c('0x24')]=function(_0x462467,_0x3e78c1){if(this[_0x629c('0xb')][_0x462467]){this[_0x629c('0xb')][_0x462467][_0x629c('0x10')][_0x629c('0x25')]='error';this[_0x629c('0xb')][_0x462467][_0x629c('0x10')][_0x629c('0x11')]=_0x3e78c1;return this[_0x629c('0x15')](_0x462467);}};EmailChannel[_0x629c('0x17')]['sendMail']=function(_0x1d07bb,_0x57239b){return this['smtp'][_0x629c('0x34')](_0x1d07bb,_0x57239b);};EmailChannel[_0x629c('0x17')]['verifySmtp']=function(_0x5e260e){var _0xb7b86c=this;if(this[_0x629c('0xb')][_0x5e260e['id']]){if(_['isNil'](this[_0x629c('0xb')][_0x5e260e['id']][_0x629c('0x35')])){this[_0x629c('0xb')][_0x5e260e['id']][_0x629c('0x35')]={};}this[_0x629c('0xb')][_0x5e260e['id']][_0x629c('0x35')][_0x629c('0x36')]=moment();return new BPromise(function(_0x54ccf5,_0x9a5618){return _0xb7b86c[_0x629c('0xd')][_0x629c('0x37')](_0x5e260e)[_0x629c('0x2f')](function(_0x148f8c){_0xb7b86c[_0x629c('0xb')][_0x5e260e['id']][_0x629c('0x35')]['status']=_0x629c('0x38');_0xb7b86c[_0x629c('0xb')][_0x5e260e['id']]['Smtp'][_0x629c('0x11')]='';_0xb7b86c[_0x629c('0x15')](_0x5e260e['id']);_0x54ccf5(_0x148f8c);})[_0x629c('0x31')](function(_0xff080e){_0xb7b86c[_0x629c('0xb')][_0x5e260e['id']]['Smtp'][_0x629c('0x25')]=_0x629c('0x23');_0xb7b86c['mailAccounts'][_0x5e260e['id']][_0x629c('0x35')][_0x629c('0x11')]=_0xff080e;_0xb7b86c[_0x629c('0x15')](_0x5e260e['id']);_0x9a5618(_0xff080e);});});}return this[_0x629c('0xd')][_0x629c('0x37')](_0x5e260e);};module[_0x629c('0x39')]=EmailChannel; \ No newline at end of file +var _0x5dc0=['verifySmtp','isNil','Smtp','verify','then','verified','lodash','moment','bluebird','ioredis','../../../config/logger','email','redis','defaults','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','key','active','Imap','status','messageStatus','total','stringify','refresh','hasOwnProperty','service','custom','provider','box','handleImapEmail','end','handleImapEnd','bind','error','handleImapError','disabled','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','emit','sendMail','smtp','send'];(function(_0x115a6d,_0x3dd183){var _0x8f7821=function(_0x9afa73){while(--_0x9afa73){_0x115a6d['push'](_0x115a6d['shift']());}};_0x8f7821(++_0x3dd183);}(_0x5dc0,0x1ae));var _0x05dc=function(_0x4cdf87,_0x200caf){_0x4cdf87=_0x4cdf87-0x0;var _0x14d49d=_0x5dc0[_0x4cdf87];return _0x14d49d;};'use strict';var _=require(_0x05dc('0x0'));var moment=require(_0x05dc('0x1'));var BPromise=require(_0x05dc('0x2'));var md5=require('md5');var Redis=require(_0x05dc('0x3'));var config=require('../../../config/environment');var logger=require(_0x05dc('0x4'))(_0x05dc('0x5'));config[_0x05dc('0x6')]=_[_0x05dc('0x7')](config[_0x05dc('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x05dc('0x6')]));var EmailImap=require(_0x05dc('0x8'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x05dc('0x9'));var md5Accounts={};function EmailChannel(_0x250e7b){logger[_0x05dc('0xa')](_0x05dc('0xb'));this[_0x05dc('0xc')]=_0x250e7b[_0x05dc('0xc')];this[_0x05dc('0xd')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x05dc('0xe')]['emit']=function(_0x5f49e1){var _0x42f747=this['mailAccounts'][_0x5f49e1];var _0x2806e7={'id':_0x42f747['id'],'name':_0x42f747['name'],'key':_0x42f747[_0x05dc('0xf')],'active':_0x42f747[_0x05dc('0x10')],'Imap':{'status':_0x42f747[_0x05dc('0x11')][_0x05dc('0x12')],'messageStatus':_0x42f747[_0x05dc('0x11')][_0x05dc('0x13')],'total':_0x42f747[_0x05dc('0x11')][_0x05dc('0x14')]}};if(_['isNil'](md5Accounts[_0x5f49e1])){md5Accounts[_0x5f49e1]={};}var _0x21ef11=md5(JSON[_0x05dc('0x15')](_0x2806e7));if(md5Accounts[_0x5f49e1]['md5']!==_0x21ef11){md5Accounts[_0x5f49e1]['md5']=_0x21ef11;io['emit']('mailAccount:update',_0x2806e7);}};EmailChannel['prototype'][_0x05dc('0x16')]=function(_0x81b59d){for(var _0x39c869 in _0x81b59d){if(_0x81b59d[_0x05dc('0x17')](_0x39c869)){if(_0x81b59d[_0x39c869][_0x05dc('0x11')]&&_0x81b59d[_0x39c869]['active']){var _0x3d944f=_0x81b59d[_0x39c869][_0x05dc('0x11')];if(!_0x3d944f[_0x05dc('0x18')]&&_0x81b59d[_0x39c869]['provider']!==_0x05dc('0x19'))_0x3d944f[_0x05dc('0x18')]=_0x81b59d[_0x39c869][_0x05dc('0x1a')];if(!this[_0x05dc('0xd')][_0x05dc('0x17')](_0x3d944f['id'])){this['imapAccounts'][_0x3d944f['id']]=new EmailImap(_0x3d944f,_0x81b59d[_0x39c869][_0x05dc('0x5')]);this[_0x05dc('0xd')][_0x3d944f['id']]['on'](_0x05dc('0x1b'),this['handleImapBox']['bind'](this,_0x39c869));this[_0x05dc('0xd')][_0x3d944f['id']]['on'](_0x05dc('0x5'),this[_0x05dc('0x1c')]['bind'](this,_0x39c869));this[_0x05dc('0xd')][_0x3d944f['id']]['on'](_0x05dc('0x1d'),this[_0x05dc('0x1e')][_0x05dc('0x1f')](this,_0x39c869));this[_0x05dc('0xd')][_0x3d944f['id']]['on'](_0x05dc('0x20'),this[_0x05dc('0x21')]['bind'](this,_0x39c869));}}else{if(_['isNil'](this[_0x05dc('0xc')][_0x39c869][_0x05dc('0x11')])){this[_0x05dc('0xc')][_0x39c869][_0x05dc('0x11')]={};}this['mailAccounts'][_0x39c869][_0x05dc('0x11')][_0x05dc('0x12')]=_0x05dc('0x22');this[_0x05dc('0xc')][_0x39c869][_0x05dc('0x11')][_0x05dc('0x13')]='';this['emit'](_0x39c869);}}}};EmailChannel[_0x05dc('0xe')][_0x05dc('0x23')]=function(_0x1cbaf5,_0x4f92d8){if(this[_0x05dc('0xc')][_0x1cbaf5]){this[_0x05dc('0xc')][_0x1cbaf5][_0x05dc('0x11')][_0x05dc('0x12')]=_0x05dc('0x24');this[_0x05dc('0xc')][_0x1cbaf5][_0x05dc('0x11')]['messageStatus']=_0x4f92d8['name'];if(_0x4f92d8[_0x05dc('0x25')]){this['mailAccounts'][_0x1cbaf5]['Imap'][_0x05dc('0x14')]=_0x4f92d8[_0x05dc('0x25')][_0x05dc('0x14')];}return this['emit'](_0x1cbaf5);}};EmailChannel[_0x05dc('0xe')][_0x05dc('0x1c')]=function(_0xcedcbc,_0x2f2770){logger[_0x05dc('0xa')](_0x05dc('0x26'),_0x2f2770['firstName'],_0x2f2770[_0x05dc('0x27')],_0x2f2770[_0x05dc('0x28')],_0xcedcbc);if(this['mailAccounts'][_0xcedcbc]){return mailAccount['notify'](_0xcedcbc,_0x2f2770)['then'](function(_0x49d367){if(_0x49d367){logger[_0x05dc('0xa')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x21f693){logger[_0x05dc('0x20')](_0x05dc('0x29'),JSON[_0x05dc('0x15')](_0x21f693));});}};EmailChannel[_0x05dc('0xe')][_0x05dc('0x1e')]=function(_0x380c45){if(this[_0x05dc('0xc')][_0x380c45]&&this[_0x05dc('0xc')][_0x380c45]['Imap']){if(this['imapAccounts'][this[_0x05dc('0xc')][_0x380c45][_0x05dc('0x11')]['id']]){delete this[_0x05dc('0xd')][this['mailAccounts'][_0x380c45][_0x05dc('0x11')]['id']];}this['mailAccounts'][_0x380c45][_0x05dc('0x11')][_0x05dc('0x2a')]=moment();this['emit'](_0x380c45);}};EmailChannel[_0x05dc('0xe')]['handleImapError']=function(_0x16f472,_0x38743e){if(this[_0x05dc('0xc')][_0x16f472]){this[_0x05dc('0xc')][_0x16f472]['Imap'][_0x05dc('0x12')]=_0x05dc('0x20');this[_0x05dc('0xc')][_0x16f472][_0x05dc('0x11')][_0x05dc('0x13')]=_0x38743e;return this[_0x05dc('0x2b')](_0x16f472);}};EmailChannel[_0x05dc('0xe')][_0x05dc('0x2c')]=function(_0x1b8396,_0x511bd2){return this[_0x05dc('0x2d')][_0x05dc('0x2e')](_0x1b8396,_0x511bd2);};EmailChannel['prototype'][_0x05dc('0x2f')]=function(_0x31b381){var _0x5063b4=this;if(this[_0x05dc('0xc')][_0x31b381['id']]){if(_[_0x05dc('0x30')](this['mailAccounts'][_0x31b381['id']][_0x05dc('0x31')])){this[_0x05dc('0xc')][_0x31b381['id']][_0x05dc('0x31')]={};}this[_0x05dc('0xc')][_0x31b381['id']][_0x05dc('0x31')][_0x05dc('0x2a')]=moment();return new BPromise(function(_0x24aaad,_0x4f1cdd){return _0x5063b4['smtp'][_0x05dc('0x32')](_0x31b381)[_0x05dc('0x33')](function(_0x337a02){_0x5063b4[_0x05dc('0xc')][_0x31b381['id']][_0x05dc('0x31')]['status']=_0x05dc('0x34');_0x5063b4[_0x05dc('0xc')][_0x31b381['id']][_0x05dc('0x31')][_0x05dc('0x13')]='';_0x5063b4[_0x05dc('0x2b')](_0x31b381['id']);_0x24aaad(_0x337a02);})['catch'](function(_0x213a79){_0x5063b4[_0x05dc('0xc')][_0x31b381['id']]['Smtp'][_0x05dc('0x12')]=_0x05dc('0x20');_0x5063b4[_0x05dc('0xc')][_0x31b381['id']][_0x05dc('0x31')]['messageStatus']=_0x213a79;_0x5063b4['emit'](_0x31b381['id']);_0x4f1cdd(_0x213a79);});});}return this[_0x05dc('0x2d')][_0x05dc('0x32')](_0x31b381);};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 4cc0bb1..9c3524d 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 _0x4351=['error','prototype','getAccount','connTimeout','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','openBox','handleOpenBox','handleError','emit','box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','end','handleFetchEnd','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','closeBox','handleEnd','textCode','hasOwnProperty','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','once','ready','handleReady','bind'];(function(_0x20a48d,_0x2bc553){var _0x3ee4a2=function(_0x39e042){while(--_0x39e042){_0x20a48d['push'](_0x20a48d['shift']());}};_0x3ee4a2(++_0x2bc553);}(_0x4351,0x1b5));var _0x1435=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x4351[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0x1435('0x0'));var util=require(_0x1435('0x1'));var Imap=require(_0x1435('0x2'));var simpleParser=require(_0x1435('0x3'))[_0x1435('0x4')];var Iconv=require(_0x1435('0x5'))[_0x1435('0x6')];var EventEmitter=require(_0x1435('0x7'))[_0x1435('0x8')];var utils=require(_0x1435('0x9'));var logger=require(_0x1435('0xa'))(_0x1435('0xb'));function EmailImap(_0x1f0838,_0x3a9f9a){this[_0x1435('0xc')]='INBOX';this[_0x1435('0xd')]=this['getAccount'](_0x1f0838,_0x3a9f9a);this['imap']=new Imap(this[_0x1435('0xd')]);this[_0x1435('0x2')][_0x1435('0xe')](_0x1435('0xf'),this[_0x1435('0x10')]['bind'](this));this[_0x1435('0x2')][_0x1435('0xe')]('end',this['handleEnd'][_0x1435('0x11')](this));this['imap']['on'](_0x1435('0x12'),this['handleError'][_0x1435('0x11')](this));this['imap']['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x1435('0x13')][_0x1435('0x14')]=function(_0x243669,_0x4a80bc){var _0x4a52ba={'connTimeout':_0x243669[_0x1435('0x15')]?_0x243669['connTimeout']*0x3e8:0x2710,'authTimeout':_0x243669[_0x1435('0x16')]?_0x243669[_0x1435('0x16')]*0x3e8:0x1388};if(_0x243669[_0x1435('0x17')]){_0x4a52ba[_0x1435('0x18')]=_0x243669[_0x1435('0x18')];_0x4a52ba[_0x1435('0xb')]=_0x4a80bc||_0x243669[_0x1435('0x18')]||_0x1435('0x19');if(_0x243669[_0x1435('0x1a')]){_0x4a52ba[_0x1435('0x1b')]=utils[_0x1435('0x1c')](_0x243669[_0x1435('0x1d')][_0x1435('0x1e')],_0x243669[_0x1435('0x18')]);}else{_0x4a52ba[_0x1435('0x1f')]=_0x243669['password'];}}else{if(_0x243669[_0x1435('0x20')]){_0x4a52ba[_0x1435('0x18')]=_0x243669['user'];_0x4a52ba[_0x1435('0x1f')]=_0x243669['password'];}}_0x4a52ba[_0x1435('0x21')]=_0x243669[_0x1435('0x21')];_0x4a52ba[_0x1435('0x22')]=_0x243669[_0x1435('0x22')]||0x3e1;if(_0x243669[_0x1435('0x23')]){_0x4a52ba[_0x1435('0x23')]=!![];}else{_0x4a52ba['tls']=![];_0x4a52ba[_0x1435('0x24')]=_0x1435('0x25');}return _0x4a52ba;};EmailImap[_0x1435('0x13')][_0x1435('0x10')]=function(){this[_0x1435('0x2')][_0x1435('0x26')](this[_0x1435('0xc')],![],this[_0x1435('0x27')][_0x1435('0x11')](this));};EmailImap[_0x1435('0x13')][_0x1435('0x27')]=function(_0x5f0e15,_0x523792){if(_0x5f0e15){this[_0x1435('0x28')](_0x5f0e15,!![]);}else{this[_0x1435('0x29')](_0x1435('0x2a'),_0x523792);this['readUnseen']();}};EmailImap[_0x1435('0x13')][_0x1435('0x2b')]=function(_0x2663bf){if(_0x2663bf){this[_0x1435('0x28')](_0x2663bf,!![]);}else{this[_0x1435('0x2')]['end']();}};EmailImap[_0x1435('0x13')][_0x1435('0x2c')]=function(){this[_0x1435('0x2')][_0x1435('0x2d')]([_0x1435('0x2e')],this[_0x1435('0x2f')][_0x1435('0x11')](this));};EmailImap['prototype'][_0x1435('0x2f')]=function(_0x102685,_0xe979c0){if(_0x102685){this[_0x1435('0x28')](_0x102685,!![]);}else{if(_0xe979c0[_0x1435('0x30')]){try{var _0x49649f=this[_0x1435('0x2')][_0x1435('0x31')](_0xe979c0,{'bodies':'','markSeen':!![]});_0x49649f['on'](_0x1435('0x32'),this[_0x1435('0x33')]['bind'](this));_0x49649f[_0x1435('0xe')](_0x1435('0x12'),this['handleFetchError'][_0x1435('0x11')](this));_0x49649f['once'](_0x1435('0x34'),this[_0x1435('0x35')]['bind'](this));}catch(_0x1709f8){logger[_0x1435('0x12')](_0x1709f8);}}else{this['imap']['closeBox'](!![],this['handleCloseBox'][_0x1435('0x11')](this));}}};EmailImap['prototype'][_0x1435('0x33')]=function(_0x5ac209){_0x5ac209['on'](_0x1435('0x36'),this['handleMessageBody'][_0x1435('0x11')](this));_0x5ac209[_0x1435('0xe')](_0x1435('0x37'),this[_0x1435('0x38')][_0x1435('0x11')](this));_0x5ac209[_0x1435('0xe')]('end',this[_0x1435('0x39')][_0x1435('0x11')](this));};EmailImap[_0x1435('0x13')][_0x1435('0x3a')]=function(_0x310a28){simpleParser(_0x310a28,{'Iconv':Iconv},this['handleSimpleParser'][_0x1435('0x11')](this));};EmailImap['prototype'][_0x1435('0x38')]=function(){};EmailImap[_0x1435('0x13')]['handleMessageEnd']=function(){};EmailImap[_0x1435('0x13')][_0x1435('0x3b')]=function(_0x4169ab,_0xed44d5){if(_0x4169ab){logger[_0x1435('0x12')](_0x4169ab);}else{var _0x1cde88=this;utils[_0x1435('0x3c')](this[_0x1435('0xd')],_0xed44d5,function(_0x1399e7){_0x1cde88[_0x1435('0x29')](_0x1435('0xb'),_0x1399e7);});}};EmailImap[_0x1435('0x13')]['handleFetchEnd']=function(){this[_0x1435('0x2')]['closeBox'](!![],this[_0x1435('0x2b')]['bind'](this));};EmailImap[_0x1435('0x13')]['handleFetchError']=function(_0x473d6){this['handleError'](_0x473d6);this[_0x1435('0x2')][_0x1435('0x3d')](!![],this[_0x1435('0x2b')]['bind'](this));};EmailImap[_0x1435('0x13')][_0x1435('0x3e')]=function(){this[_0x1435('0x29')]('end');};EmailImap[_0x1435('0x13')][_0x1435('0x28')]=function(_0x5bbf79,_0x49c8fe){logger[_0x1435('0x12')](_0x1435('0x28'),this[_0x1435('0xd')]['email'],JSON['stringify'](_0x5bbf79));var _0x34c905='';if(_0x5bbf79){if(_0x5bbf79['textCode']){_0x34c905=_0x5bbf79[_0x1435('0x3f')];}else{for(var _0x4e2062 in _0x5bbf79){if(_0x5bbf79[_0x1435('0x40')](_0x4e2062)){_0x34c905+=_['upperFirst'](_0x4e2062)+':\x20'+_0x5bbf79[_0x4e2062]+'\x0a';}}}}if(_0x49c8fe){this[_0x1435('0x2')]['end']();}else{this[_0x1435('0x29')]('error',_0x34c905);this[_0x1435('0x29')](_0x1435('0x34'));}};module['exports']=EmailImap; \ No newline at end of file +var _0xe626=['port','tls','autotls','required','handleReady','openBox','handleOpenBox','prototype','emit','readUnseen','handleCloseBox','end','search','UNSEEN','length','message','handleFetchMessage','handleFetchError','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','lodash','util','imap','mailparser','iconv','Iconv','events','EventEmitter','./utils','mailbox','account','getAccount','once','ready','bind','handleEnd','error','handleError','connect','inherits','connTimeout','authTimeout','user','email','anonymous@xcally.com','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','host'];(function(_0x59790d,_0x335171){var _0x4cb23f=function(_0x21bead){while(--_0x21bead){_0x59790d['push'](_0x59790d['shift']());}};_0x4cb23f(++_0x335171);}(_0xe626,0x9d));var _0x6e62=function(_0x16ddef,_0x3eb4a2){_0x16ddef=_0x16ddef-0x0;var _0x227dd9=_0xe626[_0x16ddef];return _0x227dd9;};'use strict';var _=require(_0x6e62('0x0'));var util=require(_0x6e62('0x1'));var Imap=require(_0x6e62('0x2'));var simpleParser=require(_0x6e62('0x3'))['simpleParser'];var Iconv=require(_0x6e62('0x4'))[_0x6e62('0x5')];var EventEmitter=require(_0x6e62('0x6'))[_0x6e62('0x7')];var utils=require(_0x6e62('0x8'));var logger=require('../../../config/logger')('email');function EmailImap(_0x4a778d,_0x2ee927){this[_0x6e62('0x9')]='INBOX';this[_0x6e62('0xa')]=this[_0x6e62('0xb')](_0x4a778d,_0x2ee927);this[_0x6e62('0x2')]=new Imap(this[_0x6e62('0xa')]);this['imap'][_0x6e62('0xc')](_0x6e62('0xd'),this['handleReady'][_0x6e62('0xe')](this));this['imap'][_0x6e62('0xc')]('end',this[_0x6e62('0xf')]['bind'](this));this[_0x6e62('0x2')]['on'](_0x6e62('0x10'),this[_0x6e62('0x11')][_0x6e62('0xe')](this));this[_0x6e62('0x2')][_0x6e62('0x12')]();}util[_0x6e62('0x13')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x44b131,_0x3b980d){var _0x5328fe={'connTimeout':_0x44b131[_0x6e62('0x14')]?_0x44b131[_0x6e62('0x14')]*0x3e8:0x2710,'authTimeout':_0x44b131[_0x6e62('0x15')]?_0x44b131[_0x6e62('0x15')]*0x3e8:0x1388};if(_0x44b131['service']){_0x5328fe[_0x6e62('0x16')]=_0x44b131[_0x6e62('0x16')];_0x5328fe[_0x6e62('0x17')]=_0x3b980d||_0x44b131[_0x6e62('0x16')]||_0x6e62('0x18');if(_0x44b131[_0x6e62('0x19')]){_0x5328fe[_0x6e62('0x1a')]=utils[_0x6e62('0x1b')](_0x44b131[_0x6e62('0x1c')][_0x6e62('0x1d')],_0x44b131['user']);}else{_0x5328fe[_0x6e62('0x1e')]=_0x44b131[_0x6e62('0x1e')];}}else{if(_0x44b131['authentication']){_0x5328fe[_0x6e62('0x16')]=_0x44b131['user'];_0x5328fe[_0x6e62('0x1e')]=_0x44b131[_0x6e62('0x1e')];}}_0x5328fe[_0x6e62('0x1f')]=_0x44b131[_0x6e62('0x1f')];_0x5328fe[_0x6e62('0x20')]=_0x44b131[_0x6e62('0x20')]||0x3e1;if(_0x44b131[_0x6e62('0x21')]){_0x5328fe[_0x6e62('0x21')]=!![];}else{_0x5328fe[_0x6e62('0x21')]=![];_0x5328fe[_0x6e62('0x22')]=_0x6e62('0x23');}return _0x5328fe;};EmailImap['prototype'][_0x6e62('0x24')]=function(){this['imap'][_0x6e62('0x25')](this[_0x6e62('0x9')],![],this[_0x6e62('0x26')][_0x6e62('0xe')](this));};EmailImap[_0x6e62('0x27')][_0x6e62('0x26')]=function(_0x4373b5,_0x3a1683){if(_0x4373b5){this[_0x6e62('0x11')](_0x4373b5,!![]);}else{this[_0x6e62('0x28')]('box',_0x3a1683);this[_0x6e62('0x29')]();}};EmailImap['prototype'][_0x6e62('0x2a')]=function(_0x2f9baf){if(_0x2f9baf){this[_0x6e62('0x11')](_0x2f9baf,!![]);}else{this[_0x6e62('0x2')][_0x6e62('0x2b')]();}};EmailImap[_0x6e62('0x27')]['readUnseen']=function(){this[_0x6e62('0x2')][_0x6e62('0x2c')]([_0x6e62('0x2d')],this['handleReadUnseen']['bind'](this));};EmailImap[_0x6e62('0x27')]['handleReadUnseen']=function(_0x479b12,_0x59c916){if(_0x479b12){this['handleError'](_0x479b12,!![]);}else{if(_0x59c916[_0x6e62('0x2e')]){try{var _0x4c6af1=this[_0x6e62('0x2')]['fetch'](_0x59c916,{'bodies':'','markSeen':!![]});_0x4c6af1['on'](_0x6e62('0x2f'),this[_0x6e62('0x30')][_0x6e62('0xe')](this));_0x4c6af1['once']('error',this[_0x6e62('0x31')][_0x6e62('0xe')](this));_0x4c6af1['once']('end',this['handleFetchEnd'][_0x6e62('0xe')](this));}catch(_0x537f37){logger[_0x6e62('0x10')](_0x537f37);}}else{this[_0x6e62('0x2')][_0x6e62('0x32')](!![],this[_0x6e62('0x2a')][_0x6e62('0xe')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x451e19){_0x451e19['on'](_0x6e62('0x33'),this[_0x6e62('0x34')][_0x6e62('0xe')](this));_0x451e19[_0x6e62('0xc')](_0x6e62('0x35'),this[_0x6e62('0x36')][_0x6e62('0xe')](this));_0x451e19[_0x6e62('0xc')]('end',this[_0x6e62('0x37')][_0x6e62('0xe')](this));};EmailImap[_0x6e62('0x27')]['handleMessageBody']=function(_0x134efd){simpleParser(_0x134efd,{'Iconv':Iconv},this[_0x6e62('0x38')]['bind'](this));};EmailImap[_0x6e62('0x27')][_0x6e62('0x36')]=function(){};EmailImap[_0x6e62('0x27')][_0x6e62('0x37')]=function(){};EmailImap[_0x6e62('0x27')]['handleSimpleParser']=function(_0x34f99e,_0x16a5f5){if(_0x34f99e){logger[_0x6e62('0x10')](_0x34f99e);}else{var _0x100c30=this;utils[_0x6e62('0x39')](this['account'],_0x16a5f5,function(_0x1ff282){_0x100c30[_0x6e62('0x28')](_0x6e62('0x17'),_0x1ff282);});}};EmailImap['prototype'][_0x6e62('0x3a')]=function(){this[_0x6e62('0x2')]['closeBox'](!![],this['handleCloseBox'][_0x6e62('0xe')](this));};EmailImap[_0x6e62('0x27')][_0x6e62('0x31')]=function(_0x5257be){this['handleError'](_0x5257be);this[_0x6e62('0x2')]['closeBox'](!![],this['handleCloseBox'][_0x6e62('0xe')](this));};EmailImap[_0x6e62('0x27')][_0x6e62('0xf')]=function(){this[_0x6e62('0x28')](_0x6e62('0x2b'));};EmailImap['prototype'][_0x6e62('0x11')]=function(_0x4c5431,_0x5c118b){logger[_0x6e62('0x10')](_0x6e62('0x11'),this[_0x6e62('0xa')]['email'],JSON[_0x6e62('0x3b')](_0x4c5431));var _0x530162='';if(_0x4c5431){if(_0x4c5431[_0x6e62('0x3c')]){_0x530162=_0x4c5431[_0x6e62('0x3c')];}else{for(var _0x4212e6 in _0x4c5431){if(_0x4c5431[_0x6e62('0x3d')](_0x4212e6)){_0x530162+=_[_0x6e62('0x3e')](_0x4212e6)+':\x20'+_0x4c5431[_0x4212e6]+'\x0a';}}}}if(_0x5c118b){this[_0x6e62('0x2')][_0x6e62('0x2b')]();}else{this[_0x6e62('0x28')](_0x6e62('0x10'),_0x530162);this[_0x6e62('0x28')]('end');}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index eb5e4bf..3381f64 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 _0xd0ed=['Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype','send','createTransport','toString','verify'];(function(_0x3fa71f,_0xd5ee31){var _0x59582f=function(_0x13f32f){while(--_0x13f32f){_0x3fa71f['push'](_0x3fa71f['shift']());}};_0x59582f(++_0xd5ee31);}(_0xd0ed,0x1da));var _0xdd0e=function(_0x545396,_0x301e2e){_0x545396=_0x545396-0x0;var _0x4e3a04=_0xd0ed[_0x545396];return _0x4e3a04;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xdd0e('0x0'));function EmailSmtp(){}EmailSmtp[_0xdd0e('0x1')][_0xdd0e('0x2')]=function(_0x40505b,_0x17ac88){return new Promise(function(_0x223718,_0x3b3172){var _0x16f779=nodemailer[_0xdd0e('0x3')](_0x40505b);_0x16f779['use']('compile',inlineBase64());_0x16f779['sendMail'](_0x17ac88,function(_0x3152fe,_0x559ba2){if(_0x3152fe){_0x3b3172(_0x3152fe[_0xdd0e('0x4')]());}else{_0x223718(_0x559ba2);}});});};EmailSmtp[_0xdd0e('0x1')][_0xdd0e('0x5')]=function(_0x40bc7c){return new Promise(function(_0x5ea04e,_0xb7bf3d){var _0x3465e6=nodemailer[_0xdd0e('0x3')](_0x40bc7c);_0x3465e6[_0xdd0e('0x5')](function(_0x34c7f2,_0x285a5b){if(_0x34c7f2){_0xb7bf3d(_0x34c7f2[_0xdd0e('0x4')]());}else{if(_0x285a5b){_0x5ea04e(_0x285a5b);}else{_0xb7bf3d(_0xdd0e('0x6'));}}});});};module[_0xdd0e('0x7')]=EmailSmtp; \ No newline at end of file +var _0xb704=['verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail'];(function(_0x3e7fb3,_0x2d9a8e){var _0x14d83d=function(_0x185cca){while(--_0x185cca){_0x3e7fb3['push'](_0x3e7fb3['shift']());}};_0x14d83d(++_0x2d9a8e);}(_0xb704,0x1b0));var _0x4b70=function(_0x41224a,_0x5be29b){_0x41224a=_0x41224a-0x0;var _0x39a838=_0xb704[_0x41224a];return _0x39a838;};'use strict';var nodemailer=require(_0x4b70('0x0'));var inlineBase64=require(_0x4b70('0x1'));function EmailSmtp(){}EmailSmtp[_0x4b70('0x2')][_0x4b70('0x3')]=function(_0x36cd16,_0x41e83b){return new Promise(function(_0x9d1f80,_0x45afce){var _0x49844d=nodemailer[_0x4b70('0x4')](_0x36cd16);_0x49844d[_0x4b70('0x5')](_0x4b70('0x6'),inlineBase64());_0x49844d[_0x4b70('0x7')](_0x41e83b,function(_0x3502ed,_0x17cb3e){if(_0x3502ed){_0x45afce(_0x3502ed['toString']());}else{_0x9d1f80(_0x17cb3e);}});});};EmailSmtp[_0x4b70('0x2')]['verify']=function(_0x29de06){return new Promise(function(_0x1a319a,_0x254ec7){var _0x3cd54b=nodemailer['createTransport'](_0x29de06);_0x3cd54b[_0x4b70('0x8')](function(_0x243616,_0x4954ad){if(_0x243616){_0x254ec7(_0x243616['toString']());}else{if(_0x4954ad){_0x1a319a(_0x4954ad);}else{_0x254ec7(_0x4b70('0x9'));}}});});};module[_0x4b70('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index a9fb26a..128c951 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 _0x45db=['parseBuffer','

Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','utf-8','toString','base64','lodash','moment','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','substring','name','indexOf','split','join','Anonymous','length','isEmpty','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x27c3a5['slice'](0x0,-0x1)[_0xb45d('0x12')]('\x20'):_0x144a08[_0xb45d('0xf')];}return _0xb45d('0x13');}function getLastName(_0xa13ed){var _0x4af63e=_[_0xb45d('0xd')](_0xa13ed[_0xb45d('0x8')]);if(_0x4af63e&&_0x4af63e[_0xb45d('0xf')]){var _0x7a12b=_0x4af63e['name'][_0xb45d('0x11')](/\s+/);return _0x7a12b[_0xb45d('0x14')]>0x1?_0x7a12b['pop']():'';}return'';}function getMails(_0x175557,_0x4e72ab){var _0x174e92='';for(var _0x3c0991=0x0;_0x3c0991<_0x4e72ab[_0xb45d('0x8')][_0xb45d('0x14')];_0x3c0991+=0x1){if(_0x4e72ab[_0xb45d('0x8')][_0x3c0991]['address']!==_0x175557){if(!_[_0xb45d('0x15')](_0x174e92)){_0x174e92+=',';}_0x174e92+=_0x4e72ab['value'][_0x3c0991][_0xb45d('0xf')]||_0x4e72ab['value'][_0x3c0991][_0xb45d('0x9')]||'';_0x174e92+='\x20<';_0x174e92+=_0x4e72ab['value'][_0x3c0991][_0xb45d('0x9')]?_0x4e72ab[_0xb45d('0x8')][_0x3c0991][_0xb45d('0x9')]:'anonymous'+random[_0xb45d('0xb')](0x6)+_0xb45d('0xc');_0x174e92+='>';}}return _0x174e92;}function parseEmail(_0x536c59,_0x52854a,_0x3d4156){if(_0x52854a[_0xb45d('0x16')]){var _0xf6cf76=/)<[^<]*)*<\/script>/gi;while(_0xf6cf76['test'](_0x52854a[_0xb45d('0x16')])){_0x52854a[_0xb45d('0x16')]=_0x52854a[_0xb45d('0x16')][_0xb45d('0x17')](_0xf6cf76,'');}if(_0x52854a[_0xb45d('0x16')][_0xb45d('0x18')](_0xb45d('0x19'))){var _0x5e8bd2=[];_0x52854a['attachments'][_0xb45d('0x1a')](_0x28cd22=>{_0x5e8bd2[_0xb45d('0x1b')](_0x28cd22[_0xb45d('0x1c')]);});var _0x2b450d=/]+>/g;var _0x1ef3d3=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1ed1b2=_0x52854a[_0xb45d('0x16')][_0xb45d('0x17')](_0x1ef3d3,_0xb45d('0x1d'));var _0x134d8d=_0x1ed1b2[_0xb45d('0x17')](_0x2b450d,_0xb45d('0x1e'));for(let _0x4852b4=0x0;_0x4852b4<_0x5e8bd2[_0xb45d('0x14')];_0x4852b4++){var _0xdcc709=_0x134d8d[_0xb45d('0x17')]('_IMG',_0xb45d('0x1f')+_0x5e8bd2[_0x4852b4]+_0xb45d('0x20'));_0x134d8d=_0xdcc709;}_0x52854a[_0xb45d('0x16')]=_0x134d8d;}_0x3d4156['body']=_0x52854a[_0xb45d('0x16')];}else{_0x3d4156[_0xb45d('0x21')]=_0x52854a[_0xb45d('0x22')];}if(_0x3d4156['body']){_0x3d4156[_0xb45d('0x21')]=_0x3d4156[_0xb45d('0x21')][_0xb45d('0x17')](/0x0){var _0x408c83=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0xb45d('0x32')];for(var _0x10a759=0x0;_0x10a759<_0x52854a[_0xb45d('0x31')]['length'];_0x10a759++){var _0x5df5f8=_[_0xb45d('0x10')](_0x408c83,_0x52854a[_0xb45d('0x31')][_0x10a759][_0xb45d('0x33')]);if(_0x5df5f8>=0x0){_0x3d4156[_0xb45d('0x34')]=!![];}}}return _0x3d4156;}exports[_0xb45d('0x35')]=function(_0x328a25,_0x43d97e,_0x5ca575){var _0x54e656={'from':getAddress(_0x43d97e[_0xb45d('0x36')]),'firstName':getFirstName(_0x43d97e[_0xb45d('0x36')]),'lastName':getLastName(_0x43d97e['from']),'mapKey':_0xb45d('0x6'),'message':{'from':getMails(_0x328a25[_0xb45d('0x6')],_0x43d97e[_0xb45d('0x36')]),'to':_0x328a25[_0xb45d('0x6')],'cc':'','subject':_0x43d97e['subject']||'','messageId':_0x43d97e[_0xb45d('0x37')],'inReplyTo':_0x43d97e[_0xb45d('0x38')],'sentAt':moment(_0x43d97e['date'])[_0xb45d('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x43d97e[_0xb45d('0x16')]&&!_0x43d97e[_0xb45d('0x22')]){var _0x5bd7cd=_['filter'](_0x43d97e['attachments'],{'contentType':_0xb45d('0x39')});if(_0x5bd7cd['length']){logger['info'](util[_0xb45d('0x2b')](_0xb45d('0x3a'),_0x43d97e['messageId']));tnef[_0xb45d('0x3b')](_['first'](_0x5bd7cd)['content'],function(_0xbd1566,_0x3eb549){if(_0x3eb549){_0x43d97e[_0xb45d('0x16')]=_0x3eb549['BodyHTML']||_0xb45d('0x3c');if(_0x3eb549[_0xb45d('0x3d')]){for(var _0x2893a5=0x0;_0x2893a5<_0x3eb549[_0xb45d('0x3d')]['length'];_0x2893a5++){var _0x565e3f=_0x3eb549[_0xb45d('0x3d')][_0x2893a5];_0x54e656[_0xb45d('0x25')]['attachments'][_0xb45d('0x1b')]({'filename':_0x565e3f[_0xb45d('0x3e')],'content':Buffer[_0xb45d('0x36')](_0x565e3f['Data'])});}}}_0x5ca575(parseEmail(_0x328a25,_0x43d97e,_0x54e656));});}else{_0x43d97e[_0xb45d('0x16')]=_0xb45d('0x3c');_0x5ca575(parseEmail(_0x328a25,_0x43d97e,_0x54e656));}}else{_0x5ca575(parseEmail(_0x328a25,_0x43d97e,_0x54e656));}};exports[_0xb45d('0x3f')]=function(_0x2deb6c,_0x4eea9c){var _0x25bd09=[_0xb45d('0x40')+(_0x4eea9c||''),'auth=Bearer\x20'+_0x2deb6c,'',''];return Buffer[_0xb45d('0x36')](_0x25bd09[_0xb45d('0x12')](''),_0xb45d('0x41'))[_0xb45d('0x42')](_0xb45d('0x43'));}; \ No newline at end of file +var _0x908e=['path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','isEmpty','test','html','replace','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Data','generateXOAuth2Token','user=','auth=Bearer\x20','toString'];(function(_0x47c0aa,_0x13c0d8){var _0x45e82d=function(_0x1a68a4){while(--_0x1a68a4){_0x47c0aa['push'](_0x47c0aa['shift']());}};_0x45e82d(++_0x13c0d8);}(_0x908e,0x11c));var _0xe908=function(_0x188ee6,_0x4282c4){_0x188ee6=_0x188ee6-0x0;var _0x3995e8=_0x908e[_0x188ee6];return _0x3995e8;};'use strict';var _=require('lodash');var moment=require('moment');var random=require('randomstring');var fs=require('fs');var path=require(_0xe908('0x0'));var util=require(_0xe908('0x1'));var tnef=require(_0xe908('0x2'));var logger=require(_0xe908('0x3'))(_0xe908('0x4'));var config=require(_0xe908('0x5'));function getAddress(_0x38182e){var _0xb18a52=_[_0xe908('0x6')](_0x38182e[_0xe908('0x7')]);return _0xb18a52&&_0xb18a52[_0xe908('0x8')]?_0xb18a52['address']:_0xe908('0x9')+random[_0xe908('0xa')](0x6)+_0xe908('0xb');}function getFirstName(_0x255cad){var _0x1872c0=_[_0xe908('0x6')](_0x255cad['value']);if(_0x1872c0&&_0x1872c0[_0xe908('0xc')]){if(_0x1872c0['name']==_0x1872c0['address']){return _0x1872c0[_0xe908('0xc')][_0xe908('0xd')](0x0,_0x1872c0[_0xe908('0xc')][_0xe908('0xe')]('@'));}var _0x5138b4=_0x1872c0[_0xe908('0xc')][_0xe908('0xf')](/\s+/);return _0x5138b4[_0xe908('0x10')]>0x1?_0x5138b4[_0xe908('0x11')](0x0,-0x1)[_0xe908('0x12')]('\x20'):_0x1872c0['name'];}return _0xe908('0x13');}function getLastName(_0x3e279e){var _0x3046ce=_[_0xe908('0x6')](_0x3e279e[_0xe908('0x7')]);if(_0x3046ce&&_0x3046ce[_0xe908('0xc')]){var _0x80b07f=_0x3046ce['name'][_0xe908('0xf')](/\s+/);return _0x80b07f['length']>0x1?_0x80b07f['pop']():'';}return'';}function getMails(_0x56cd22,_0x3dd88a){var _0x3dc79d='';for(var _0x50a227=0x0;_0x50a227<_0x3dd88a[_0xe908('0x7')][_0xe908('0x10')];_0x50a227+=0x1){if(_0x3dd88a[_0xe908('0x7')][_0x50a227][_0xe908('0x8')]!==_0x56cd22){if(!_[_0xe908('0x14')](_0x3dc79d)){_0x3dc79d+=',';}_0x3dc79d+=_0x3dd88a[_0xe908('0x7')][_0x50a227][_0xe908('0xc')]||_0x3dd88a[_0xe908('0x7')][_0x50a227]['address']||'';_0x3dc79d+='\x20<';_0x3dc79d+=_0x3dd88a[_0xe908('0x7')][_0x50a227][_0xe908('0x8')]?_0x3dd88a[_0xe908('0x7')][_0x50a227]['address']:'anonymous'+random[_0xe908('0xa')](0x6)+_0xe908('0xb');_0x3dc79d+='>';}}return _0x3dc79d;}function parseEmail(_0x289484,_0x3a62b9,_0xf8e377){if(_0x3a62b9['html']){var _0x3820bc=/)<[^<]*)*<\/script>/gi;while(_0x3820bc[_0xe908('0x15')](_0x3a62b9[_0xe908('0x16')])){_0x3a62b9[_0xe908('0x16')]=_0x3a62b9[_0xe908('0x16')][_0xe908('0x17')](_0x3820bc,'');}if(_0x3a62b9['html']['includes'](_0xe908('0x18'))){var _0x1495af=[];_0x3a62b9[_0xe908('0x19')][_0xe908('0x1a')](_0x4f8058=>{_0x1495af[_0xe908('0x1b')](_0x4f8058[_0xe908('0x1c')]);});var _0x3694e1=/]+>/g;var _0x18f394=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4afd45=_0x3a62b9['html'][_0xe908('0x17')](_0x18f394,_0xe908('0x1d'));var _0x1376dc=_0x4afd45[_0xe908('0x17')](_0x3694e1,_0xe908('0x1e'));for(let _0x39dc40=0x0;_0x39dc40<_0x1495af[_0xe908('0x10')];_0x39dc40++){var _0xdad372=_0x1376dc[_0xe908('0x17')](_0xe908('0x1e'),_0xe908('0x1f')+_0x1495af[_0x39dc40]+'\x20]');_0x1376dc=_0xdad372;}_0x3a62b9['html']=_0x1376dc;}_0xf8e377[_0xe908('0x20')]=_0x3a62b9[_0xe908('0x16')];}else{_0xf8e377[_0xe908('0x20')]=_0x3a62b9[_0xe908('0x21')];}if(_0xf8e377[_0xe908('0x20')]){_0xf8e377[_0xe908('0x20')]=_0xf8e377[_0xe908('0x20')][_0xe908('0x17')](/0x0){var _0x5c4b07=[_0xe908('0x31'),_0xe908('0x32'),_0xe908('0x33')];for(var _0x2d243a=0x0;_0x2d243a<_0x3a62b9[_0xe908('0x30')][_0xe908('0x10')];_0x2d243a++){var _0x3a56d8=_['indexOf'](_0x5c4b07,_0x3a62b9['headerLines'][_0x2d243a][_0xe908('0x34')]);if(_0x3a56d8>=0x0){_0xf8e377['isAutoreply']=!![];}}}return _0xf8e377;}exports[_0xe908('0x35')]=function(_0x54c8ac,_0x344d55,_0x40e520){var _0x3588ab={'from':getAddress(_0x344d55[_0xe908('0x36')]),'firstName':getFirstName(_0x344d55[_0xe908('0x36')]),'lastName':getLastName(_0x344d55['from']),'mapKey':_0xe908('0x4'),'message':{'from':getMails(_0x54c8ac[_0xe908('0x4')],_0x344d55[_0xe908('0x36')]),'to':_0x54c8ac[_0xe908('0x4')],'cc':'','subject':_0x344d55[_0xe908('0x37')]||'','messageId':_0x344d55[_0xe908('0x38')],'inReplyTo':_0x344d55[_0xe908('0x39')],'sentAt':moment(_0x344d55[_0xe908('0x3a')])[_0xe908('0x2a')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x344d55[_0xe908('0x16')]&&!_0x344d55[_0xe908('0x21')]){var _0x2ca242=_['filter'](_0x344d55['attachments'],{'contentType':_0xe908('0x3b')});if(_0x2ca242[_0xe908('0x10')]){logger[_0xe908('0x3c')](util[_0xe908('0x2a')](_0xe908('0x3d'),_0x344d55[_0xe908('0x38')]));tnef['parseBuffer'](_[_0xe908('0x3e')](_0x2ca242)[_0xe908('0x2f')],function(_0x41ddc3,_0x915de1){if(_0x915de1){_0x344d55[_0xe908('0x16')]=_0x915de1[_0xe908('0x3f')]||_0xe908('0x40');if(_0x915de1[_0xe908('0x41')]){for(var _0x22aa37=0x0;_0x22aa37<_0x915de1[_0xe908('0x41')][_0xe908('0x10')];_0x22aa37++){var _0x5e80ee=_0x915de1['Attachments'][_0x22aa37];_0x3588ab[_0xe908('0x24')][_0xe908('0x19')][_0xe908('0x1b')]({'filename':_0x5e80ee['Title'],'content':Buffer[_0xe908('0x36')](_0x5e80ee[_0xe908('0x42')])});}}}_0x40e520(parseEmail(_0x54c8ac,_0x344d55,_0x3588ab));});}else{_0x344d55[_0xe908('0x16')]=_0xe908('0x40');_0x40e520(parseEmail(_0x54c8ac,_0x344d55,_0x3588ab));}}else{_0x40e520(parseEmail(_0x54c8ac,_0x344d55,_0x3588ab));}};exports[_0xe908('0x43')]=function(_0x453ade,_0x242030){var _0x553f60=[_0xe908('0x44')+(_0x242030||''),_0xe908('0x45')+_0x453ade,'',''];return Buffer['from'](_0x553f60[_0xe908('0x12')](''),'utf-8')[_0xe908('0x46')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 5689cdb..9238be2 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 _0x22b7=['Smtp','exports','lodash','name','Service','key','SERV','active','Imap'];(function(_0x201fd9,_0x1671ee){var _0x42e7fe=function(_0x2608ee){while(--_0x2608ee){_0x201fd9['push'](_0x201fd9['shift']());}};_0x42e7fe(++_0x1671ee);}(_0x22b7,0x1df));var _0x722b=function(_0x264609,_0x7609b9){_0x264609=_0x264609-0x0;var _0x1f38b9=_0x22b7[_0x264609];return _0x1f38b9;};'use strict';var _=require(_0x722b('0x0'));function MailAccount(_0x46ea1f){this['id']=_0x46ea1f['id']||0x0;this['name']=_0x46ea1f[_0x722b('0x1')]||_0x722b('0x2');this[_0x722b('0x3')]=_0x46ea1f[_0x722b('0x3')]||_0x722b('0x4');this[_0x722b('0x5')]=_0x46ea1f[_0x722b('0x5')]||![];this[_0x722b('0x6')]=_0x46ea1f[_0x722b('0x6')]||[];this[_0x722b('0x7')]=_0x46ea1f[_0x722b('0x7')]||[];}module[_0x722b('0x8')]=MailAccount; \ No newline at end of file +var _0xb25d=['name','Service','key','SERV','active','Imap','Smtp','lodash'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xb25d,0x197));var _0xdb25=function(_0x37ce85,_0x16dd9f){_0x37ce85=_0x37ce85-0x0;var _0x3a312d=_0xb25d[_0x37ce85];return _0x3a312d;};'use strict';var _=require(_0xdb25('0x0'));function MailAccount(_0x4e6053){this['id']=_0x4e6053['id']||0x0;this[_0xdb25('0x1')]=_0x4e6053[_0xdb25('0x1')]||_0xdb25('0x2');this[_0xdb25('0x3')]=_0x4e6053[_0xdb25('0x3')]||_0xdb25('0x4');this[_0xdb25('0x5')]=_0x4e6053[_0xdb25('0x5')]||![];this[_0xdb25('0x6')]=_0x4e6053[_0xdb25('0x6')]||[];this[_0xdb25('0x7')]=_0x4e6053[_0xdb25('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 1e263d8..b8dfd89 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 _0x6765=['isUndefined','merge','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','length'];(function(_0x4f1b36,_0x511442){var _0x4d9eb1=function(_0x261304){while(--_0x261304){_0x4f1b36['push'](_0x4f1b36['shift']());}};_0x4d9eb1(++_0x511442);}(_0x6765,0xde));var _0x5676=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x6765[_0x158f01];return _0x5ef74e;};'use strict';var _=require(_0x5676('0x0'));var MailAccount=require(_0x5676('0x1'));var Realtime=function(){this[_0x5676('0x2')]={};};function freeIsNotKey(_0x111008,_0x1fab2e,_0x320f19){var _0xd22e08=_['mapKeys'](_0x111008,function(_0xc95578,_0xad3c82){return _0xc95578[_0x320f19];});for(var _0x1eebac in _0x1fab2e){if(_0x1fab2e[_0x5676('0x3')](_0x1eebac)){if(!_0xd22e08[_0x1eebac]){delete _0x1fab2e[_0x1eebac];}}}}Realtime['prototype'][_0x5676('0x4')]=function(_0x1ff086,_0x40a5c3){for(var _0x513cf7 in _0x40a5c3){if(_0x1ff086['hasOwnProperty'](_0x513cf7)){_0x1ff086[_0x513cf7]=_0x40a5c3[_0x513cf7];}}};Realtime[_0x5676('0x5')][_0x5676('0x6')]=function(){var _0x5cbd93=this;return function(_0x30746d){if(_0x30746d){freeIsNotKey(_0x30746d,_0x5cbd93[_0x5676('0x2')],'id');for(var _0x1fa127=0x0,_0x54acf7={},_0x39b06c={};_0x1fa127<_0x30746d[_0x5676('0x7')];_0x1fa127+=0x1){_0x54acf7=_0x30746d[_0x1fa127];if(_[_0x5676('0x8')](_0x5cbd93['mailAccounts'][_0x54acf7['id']])){_0x5cbd93[_0x5676('0x2')][_0x54acf7['id']]=new MailAccount(_0x54acf7);}else{_[_0x5676('0x9')](_0x5cbd93[_0x5676('0x2')][_0x54acf7['id']],_0x54acf7);}}}return _0x5cbd93[_0x5676('0x2')];};};module['exports']=Realtime; \ No newline at end of file +var _0x1e67=['mergeFromDatabase','initMailAccounts','length','isUndefined','exports','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype'];(function(_0x5a2f9f,_0x7454f7){var _0x5ab5d3=function(_0xe502d6){while(--_0xe502d6){_0x5a2f9f['push'](_0x5a2f9f['shift']());}};_0x5ab5d3(++_0x7454f7);}(_0x1e67,0x1bd));var _0x71e6=function(_0x23d276,_0x1504da){_0x23d276=_0x23d276-0x0;var _0x2ede22=_0x1e67[_0x23d276];return _0x2ede22;};'use strict';var _=require('lodash');var MailAccount=require(_0x71e6('0x0'));var Realtime=function(){this[_0x71e6('0x1')]={};};function freeIsNotKey(_0x33806f,_0x150d90,_0x431e8d){var _0x539715=_[_0x71e6('0x2')](_0x33806f,function(_0x231c6e,_0x125963){return _0x231c6e[_0x431e8d];});for(var _0x526ce2 in _0x150d90){if(_0x150d90[_0x71e6('0x3')](_0x526ce2)){if(!_0x539715[_0x526ce2]){delete _0x150d90[_0x526ce2];}}}}Realtime[_0x71e6('0x4')][_0x71e6('0x5')]=function(_0xb2ca75,_0x46fc4){for(var _0x4230a6 in _0x46fc4){if(_0xb2ca75[_0x71e6('0x3')](_0x4230a6)){_0xb2ca75[_0x4230a6]=_0x46fc4[_0x4230a6];}}};Realtime[_0x71e6('0x4')][_0x71e6('0x6')]=function(){var _0x162df9=this;return function(_0x3f600f){if(_0x3f600f){freeIsNotKey(_0x3f600f,_0x162df9[_0x71e6('0x1')],'id');for(var _0x278eef=0x0,_0x3a4710={},_0x27f6f9={};_0x278eef<_0x3f600f[_0x71e6('0x7')];_0x278eef+=0x1){_0x3a4710=_0x3f600f[_0x278eef];if(_[_0x71e6('0x8')](_0x162df9[_0x71e6('0x1')][_0x3a4710['id']])){_0x162df9[_0x71e6('0x1')][_0x3a4710['id']]=new MailAccount(_0x3a4710);}else{_['merge'](_0x162df9['mailAccounts'][_0x3a4710['id']],_0x3a4710);}}}return _0x162df9['mailAccounts'];};};module[_0x71e6('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index ef9b0fe..e819be6 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 _0xb0b3=['MailServerOut','CloudProvider','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','service','email','key','ListId','Imap','type','data5'];(function(_0x4bcfcd,_0x5cf858){var _0x5e3bd8=function(_0x1730e2){while(--_0x1730e2){_0x4bcfcd['push'](_0x4bcfcd['shift']());}};_0x5e3bd8(++_0x5cf858);}(_0xb0b3,0x1bf));var _0x3b0b=function(_0x242c23,_0xc4332e){_0x242c23=_0x242c23-0x0;var _0x1706ab=_0xb0b3[_0x242c23];return _0x1706ab;};'use strict';var client=require(_0x3b0b('0x0'));exports[_0x3b0b('0x1')]=function(){return function(){return client[_0x3b0b('0x2')](_0x3b0b('0x3'),{'options':{'attributes':['id',_0x3b0b('0x4'),'provider',_0x3b0b('0x5'),_0x3b0b('0x6'),'active',_0x3b0b('0x7'),_0x3b0b('0x8'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0x3b0b('0x9'),'include':[{'model':'CloudProvider','attributes':['id',_0x3b0b('0x4'),_0x3b0b('0x5'),_0x3b0b('0xa'),_0x3b0b('0xb')],'as':'CloudProvider'}]},{'model':_0x3b0b('0xc'),'as':'Smtp','include':[{'model':_0x3b0b('0xd'),'attributes':['id',_0x3b0b('0x4'),_0x3b0b('0x5'),'type',_0x3b0b('0xb')],'as':'CloudProvider'}]}]},'log':_0x3b0b('0xe')});};};exports[_0x3b0b('0xf')]=function(_0x208e2a,_0x47a761){return client['Request']('NotifyMailAccount',{'account':{'id':_0x208e2a},'body':_0x47a761,'log':_0x3b0b('0x10')});}; \ No newline at end of file +var _0x5fe0=['key','ListId','TemplateId','CloudProvider','service','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','name','provider','active'];(function(_0xdbaf7f,_0x2ffdf7){var _0x2b296b=function(_0x32d2e0){while(--_0x32d2e0){_0xdbaf7f['push'](_0xdbaf7f['shift']());}};_0x2b296b(++_0x2ffdf7);}(_0x5fe0,0xe8));var _0x05fe=function(_0x5064be,_0x248525){_0x5064be=_0x5064be-0x0;var _0x393c92=_0x5fe0[_0x5064be];return _0x393c92;};'use strict';var client=require(_0x05fe('0x0'));exports[_0x05fe('0x1')]=function(){return function(){return client[_0x05fe('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x05fe('0x3'),_0x05fe('0x4'),'service','email',_0x05fe('0x5'),_0x05fe('0x6'),_0x05fe('0x7'),_0x05fe('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':_0x05fe('0x9'),'attributes':['id','name',_0x05fe('0xa'),'type',_0x05fe('0xb')],'as':_0x05fe('0x9')}]},{'model':_0x05fe('0xc'),'as':_0x05fe('0xd'),'include':[{'model':_0x05fe('0x9'),'attributes':['id','name',_0x05fe('0xa'),'type',_0x05fe('0xb')],'as':_0x05fe('0x9')}]}]},'log':_0x05fe('0xe')});};};exports[_0x05fe('0xf')]=function(_0x109624,_0x4c4f2a){return client[_0x05fe('0x2')]('NotifyMailAccount',{'account':{'id':_0x109624},'body':_0x4c4f2a,'log':_0x05fe('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index af147d5..5da2e50 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 _0x7e9b=['loginMailFrequency'];(function(_0x3adde2,_0x3062c3){var _0xd3726d=function(_0x42bbe6){while(--_0x42bbe6){_0x3adde2['push'](_0x3adde2['shift']());}};_0xd3726d(++_0x3062c3);}(_0x7e9b,0x1ea));var _0xb7e9=function(_0x55d183,_0x36a963){_0x55d183=_0x55d183-0x0;var _0x27dc33=_0x7e9b[_0x55d183];return _0x27dc33;};'use strict';var client=require('../client');exports['getSettings']=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb7e9('0x0')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x232e=['getSettings','GetSettings'];(function(_0x49621b,_0xac858a){var _0x1d1a17=function(_0x497a2c){while(--_0x497a2c){_0x49621b['push'](_0x49621b['shift']());}};_0x1d1a17(++_0xac858a);}(_0x232e,0x14c));var _0xe232=function(_0x26617a,_0x14520a){_0x26617a=_0x26617a-0x0;var _0x4f755d=_0x232e[_0x26617a];return _0x4f755d;};'use strict';var client=require('../client');exports[_0xe232('0x0')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xe232('0x1')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index d2f4130..87314db 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 83e1a0d..adcd90c 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 _0x9c03=['listen','port','socket.io','websocket','polling','redis','defaults','adapter','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','createServer','timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c03,0xa1));var _0x39c0=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9c03[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x39c0('0x0'));var http=require(_0x39c0('0x1'));var express=require(_0x39c0('0x2'));var sticky=require(_0x39c0('0x3'));var Redis=require(_0x39c0('0x4'));var config=require('../../config/environment');var app=express();var server=http[_0x39c0('0x5')](app);server[_0x39c0('0x6')]=0xdbba0;if(sticky[_0x39c0('0x7')](server,config[_0x39c0('0x8')])){var socketio=require(_0x39c0('0x9'))(server,{'transports':[_0x39c0('0xa'),_0x39c0('0xb')]});config[_0x39c0('0xc')]=_[_0x39c0('0xd')](config[_0x39c0('0xc')],{'host':'localhost','port':0x18eb});socketio[_0x39c0('0xe')](require('socket.io-redis')({'pubClient':new Redis(config[_0x39c0('0xc')]),'subClient':new Redis(config['redis'])}));require(_0x39c0('0xf'))['default']();require(_0x39c0('0x10'))[_0x39c0('0x11')](socketio);require(_0x39c0('0x12'))['default'](app);require(_0x39c0('0x13'))[_0x39c0('0x11')](app);}else{server[_0x39c0('0x14')]('listening',function(){console[_0x39c0('0x15')](_0x39c0('0x16'),config['port']);});}exports=module[_0x39c0('0x17')]=app; \ No newline at end of file +var _0x7b9c=['../../routes','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','redis','defaults','localhost','../../config/triggers','../../config/socketio','../../config/express','default'];(function(_0x2d4442,_0xa201fc){var _0x2720bd=function(_0xa1911c){while(--_0xa1911c){_0x2d4442['push'](_0x2d4442['shift']());}};_0x2720bd(++_0xa201fc);}(_0x7b9c,0x118));var _0xc7b9=function(_0x5ce30e,_0x2babb2){_0x5ce30e=_0x5ce30e-0x0;var _0x4e64dd=_0x7b9c[_0x5ce30e];return _0x4e64dd;};'use strict';var _=require(_0xc7b9('0x0'));var http=require(_0xc7b9('0x1'));var express=require('express');var sticky=require(_0xc7b9('0x2'));var Redis=require(_0xc7b9('0x3'));var config=require(_0xc7b9('0x4'));var app=express();var server=http[_0xc7b9('0x5')](app);server[_0xc7b9('0x6')]=0xdbba0;if(sticky[_0xc7b9('0x7')](server,config[_0xc7b9('0x8')])){var socketio=require(_0xc7b9('0x9'))(server,{'transports':[_0xc7b9('0xa'),_0xc7b9('0xb')]});config[_0xc7b9('0xc')]=_[_0xc7b9('0xd')](config['redis'],{'host':_0xc7b9('0xe'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0xc7b9('0xc')]),'subClient':new Redis(config[_0xc7b9('0xc')])}));require(_0xc7b9('0xf'))['default']();require(_0xc7b9('0x10'))['default'](socketio);require(_0xc7b9('0x11'))[_0xc7b9('0x12')](app);require(_0xc7b9('0x13'))['default'](app);}else{server['once'](_0xc7b9('0x14'),function(){console['log'](_0xc7b9('0x15'),config['port']);});}exports=module[_0xc7b9('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 883ecaa..e8a4e6c 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 _0xeb1a=['message','result','catch','exports','jayson/promise','bluebird','routing','client','Request','request','then','debug','error','rpc'];(function(_0x55b970,_0x42fae2){var _0x1070d1=function(_0x3f1133){while(--_0x3f1133){_0x55b970['push'](_0x55b970['shift']());}};_0x1070d1(++_0x42fae2);}(_0xeb1a,0x82));var _0xaeb1=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0xeb1a[_0x44216d];return _0xeca523;};'use strict';var jayson=require(_0xaeb1('0x0'));var BPromise=require(_0xaeb1('0x1'));var logger=require('../../config/logger')(_0xaeb1('0x2'));var client=jayson[_0xaeb1('0x3')]['http']({'port':0x2329});client[_0xaeb1('0x4')]=function(_0x59fab9,_0x3efab3){return new BPromise(function(_0x1cf79e,_0x32ad5a){return client[_0xaeb1('0x5')](_0x59fab9,_0x3efab3)[_0xaeb1('0x6')](function(_0x214155){logger[_0xaeb1('0x7')]('rpc','routing',_0x59fab9,_0x3efab3,_0x214155);if(_0x214155[_0xaeb1('0x8')]){logger[_0xaeb1('0x8')](_0xaeb1('0x9'),_0xaeb1('0x2'),_0x59fab9,_0x214155['error'][_0xaeb1('0xa')],_0x3efab3);return _0x32ad5a(_0x214155[_0xaeb1('0x8')][_0xaeb1('0xa')]);}else{return _0x1cf79e(_0x214155[_0xaeb1('0xb')]);}})[_0xaeb1('0xc')](function(_0x1b9eb9){logger[_0xaeb1('0x8')]('rpc','routing',_0x59fab9,_0x1b9eb9,_0x3efab3);return _0x32ad5a(_0x1b9eb9);});});};module[_0xaeb1('0xd')]=client; \ No newline at end of file +var _0x89d5=['bluebird','../../config/logger','routing','client','http','Request','then','debug','rpc','error','message','result','exports','jayson/promise'];(function(_0x1d9c55,_0x4742d2){var _0x1051cb=function(_0x3f78c3){while(--_0x3f78c3){_0x1d9c55['push'](_0x1d9c55['shift']());}};_0x1051cb(++_0x4742d2);}(_0x89d5,0xfb));var _0x589d=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x89d5[_0x4d8ed9];return _0x1e2140;};'use strict';var jayson=require(_0x589d('0x0'));var BPromise=require(_0x589d('0x1'));var logger=require(_0x589d('0x2'))(_0x589d('0x3'));var client=jayson[_0x589d('0x4')][_0x589d('0x5')]({'port':0x2329});client[_0x589d('0x6')]=function(_0x3c9427,_0x143d6e){return new BPromise(function(_0xa22ac7,_0x41cd24){return client['request'](_0x3c9427,_0x143d6e)[_0x589d('0x7')](function(_0x49e5b8){logger[_0x589d('0x8')](_0x589d('0x9'),_0x589d('0x3'),_0x3c9427,_0x143d6e,_0x49e5b8);if(_0x49e5b8['error']){logger[_0x589d('0xa')](_0x589d('0x9'),'routing',_0x3c9427,_0x49e5b8['error']['message'],_0x143d6e);return _0x41cd24(_0x49e5b8[_0x589d('0xa')][_0x589d('0xb')]);}else{return _0xa22ac7(_0x49e5b8[_0x589d('0xc')]);}})['catch'](function(_0xa91154){logger[_0x589d('0xa')](_0x589d('0x9'),_0x589d('0x3'),_0x3c9427,_0xa91154,_0x143d6e);return _0x41cd24(_0xa91154);});});};module[_0x589d('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 598af7c..6177b32 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 _0xf918=['initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals'];(function(_0x534b4f,_0x1ed738){var _0x4c5146=function(_0x1bfa76){while(--_0x1bfa76){_0x534b4f['push'](_0x534b4f['shift']());}};_0x4c5146(++_0x1ed738);}(_0xf918,0x114));var _0x8f91=function(_0x4e0a03,_0x5eb6b0){_0x4e0a03=_0x4e0a03-0x0;var _0x2478fc=_0xf918[_0x4e0a03];return _0x2478fc;};'use strict';var BPromise=require(_0x8f91('0x0'));var server=require('./server');var Realtime=require(_0x8f91('0x1'));var user=require(_0x8f91('0x2'));var interval=require(_0x8f91('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x8f91('0x4'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x8f91('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x8f91('0x6')]()[_0x8f91('0x7')](user[_0x8f91('0x8')]())['then'](realtime[_0x8f91('0x9')]())['then'](interval[_0x8f91('0xa')]())['then'](realtime[_0x8f91('0xb')]())['then'](openchannelQueue['getOpenchannelQueues']())[_0x8f91('0x7')](realtime[_0x8f91('0xc')]())['then'](chatQueue[_0x8f91('0xd')]())[_0x8f91('0x7')](realtime[_0x8f91('0xe')]())[_0x8f91('0x7')](smsQueue[_0x8f91('0xf')]())['then'](realtime[_0x8f91('0x10')]())[_0x8f91('0x7')](mailQueue['getMailQueues']())[_0x8f91('0x7')](realtime[_0x8f91('0x11')]())['then'](faxQueue[_0x8f91('0x12')]())[_0x8f91('0x7')](realtime[_0x8f91('0x13')]())['then'](whatsappQueue[_0x8f91('0x14')]())['then'](realtime[_0x8f91('0x15')]())[_0x8f91('0x7')](function(){return realtime;});}function main(){return server[_0x8f91('0x16')](realtime)[_0x8f91('0x7')](function(_0x3a349b){return initRealtime();})[_0x8f91('0x7')](function(_0x410bd9){return setInterval(initRealtime,0x1388);})['catch'](function(_0x52f6bc){console[_0x8f91('0x17')](_0x52f6bc);});}main(); \ No newline at end of file +var _0x42bc=['then','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue'];(function(_0x48f26c,_0x1b34c5){var _0x27ef57=function(_0x5475aa){while(--_0x5475aa){_0x48f26c['push'](_0x48f26c['shift']());}};_0x27ef57(++_0x1b34c5);}(_0x42bc,0x8e));var _0xc42b=function(_0x3bb9da,_0x502962){_0x3bb9da=_0x3bb9da-0x0;var _0x17eef7=_0x42bc[_0x3bb9da];return _0x17eef7;};'use strict';var BPromise=require('bluebird');var server=require(_0xc42b('0x0'));var Realtime=require(_0xc42b('0x1'));var user=require(_0xc42b('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xc42b('0x3'));var chatQueue=require(_0xc42b('0x4'));var smsQueue=require(_0xc42b('0x5'));var mailQueue=require(_0xc42b('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xc42b('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user['getAgents']())[_0xc42b('0x8')](realtime[_0xc42b('0x9')]())[_0xc42b('0x8')](interval[_0xc42b('0xa')]())['then'](realtime['initIntervals']())['then'](openchannelQueue[_0xc42b('0xb')]())[_0xc42b('0x8')](realtime[_0xc42b('0xc')]())[_0xc42b('0x8')](chatQueue[_0xc42b('0xd')]())[_0xc42b('0x8')](realtime[_0xc42b('0xe')]())[_0xc42b('0x8')](smsQueue[_0xc42b('0xf')]())['then'](realtime[_0xc42b('0x10')]())['then'](mailQueue[_0xc42b('0x11')]())['then'](realtime[_0xc42b('0x12')]())[_0xc42b('0x8')](faxQueue[_0xc42b('0x13')]())[_0xc42b('0x8')](realtime[_0xc42b('0x14')]())['then'](whatsappQueue[_0xc42b('0x15')]())[_0xc42b('0x8')](realtime['initWhatsappQueues']())[_0xc42b('0x8')](function(){return realtime;});}function main(){return server[_0xc42b('0x16')](realtime)['then'](function(_0x585624){return initRealtime();})['then'](function(_0x4d4064){return setInterval(initRealtime,0x1388);})[_0xc42b('0x17')](function(_0x3cc109){console[_0xc42b('0x18')](_0x3cc109);});}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 2ac422f..69363e7 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(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x1261[_0x1ae5ab];return _0x1ce001;};'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(_0x37c5b1,_0x25ab66){var _0xd39edb=function(_0x2d296b){while(--_0x2d296b){_0x37c5b1['push'](_0x37c5b1['shift']());}};_0xd39edb(++_0x25ab66);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index ef8d9c8..2451b3e 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 _0x8b01=['error','message','sendMailMessage','SendMail','jayson/promise','client','http'];(function(_0x5727bc,_0x3bd693){var _0x122d09=function(_0xc40b43){while(--_0xc40b43){_0x5727bc['push'](_0x5727bc['shift']());}};_0x122d09(++_0x3bd693);}(_0x8b01,0x11c));var _0x18b0=function(_0x140078,_0x1026fc){_0x140078=_0x140078-0x0;var _0x54de05=_0x8b01[_0x140078];return _0x54de05;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x18b0('0x0'));var client=jayson[_0x18b0('0x1')][_0x18b0('0x2')]({'port':0x232b});function request(_0xd0b6fb,_0x3290f0){return new BPromise(function(_0x17aed5,_0x479497){return client['request'](_0xd0b6fb,_0x3290f0)['then'](function(_0x5ce2a0){if(_0x5ce2a0[_0x18b0('0x3')]){return _0x479497(_0x5ce2a0[_0x18b0('0x3')][_0x18b0('0x4')]);}else{return _0x17aed5(_0x5ce2a0['result']);}})['catch'](function(_0x4b8757){return _0x479497(_0x4b8757);});});}exports[_0x18b0('0x5')]=function(_0x254f05,_0x3e1ccd){return request(_0x18b0('0x6'),{'account':_0x254f05,'message':_0x3e1ccd});}; \ No newline at end of file +var _0x27c9=['client','http','request','then','error','message','result','catch','SendMail','jayson/promise'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0x27c9,0xa9));var _0x927c=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x27c9[_0x2f5ac5];return _0x37c9a8;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x927c('0x0'));var client=jayson[_0x927c('0x1')][_0x927c('0x2')]({'port':0x232b});function request(_0x8cb5e9,_0x5f0c6c){return new BPromise(function(_0x413225,_0x296fa6){return client[_0x927c('0x3')](_0x8cb5e9,_0x5f0c6c)[_0x927c('0x4')](function(_0x1ee6d6){if(_0x1ee6d6['error']){return _0x296fa6(_0x1ee6d6[_0x927c('0x5')][_0x927c('0x6')]);}else{return _0x413225(_0x1ee6d6[_0x927c('0x7')]);}})[_0x927c('0x8')](function(_0x5d3c0d){return _0x296fa6(_0x5d3c0d);});});}exports['sendMailMessage']=function(_0x75c9c2,_0x1ee3ce){return request(_0x927c('0x9'),{'account':_0x75c9c2,'message':_0x1ee3ce});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 0beea85..11e83e4 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 _0xfc64=['mailStatusTime','mailCurrentCapacity','faxStatusTime','smsStatus','whatsappCurrentCapacity','stringify','emit','user:save','lodash','moment','md5','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','smsPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','mail','chat','openchannel','fax','sms','length','getChannelStatus','Status','StatusTime','toNumber','format','faxPause','openchannelPause'];(function(_0x179320,_0x41f6c9){var _0x503481=function(_0x3baea8){while(--_0x3baea8){_0x179320['push'](_0x179320['shift']());}};_0x503481(++_0x41f6c9);}(_0xfc64,0x1b3));var _0x4fc6=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xfc64[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x4fc6('0x0'));var moment=require(_0x4fc6('0x1'));var md5=require(_0x4fc6('0x2'));var Redis=require('ioredis');var config=require(_0x4fc6('0x3'));config[_0x4fc6('0x4')]=_[_0x4fc6('0x5')](config[_0x4fc6('0x4')],{'host':_0x4fc6('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4fc6('0x4')]));function Agent(_0x2aaaaa){this['id']=_0x2aaaaa['id']||0x0;this[_0x4fc6('0x7')]=_0x2aaaaa[_0x4fc6('0x7')]||'';this[_0x4fc6('0x8')]=_0x2aaaaa[_0x4fc6('0x8')]||!![];this[_0x4fc6('0x9')]=_0x2aaaaa['voicePause']||![];this[_0x4fc6('0xa')]=_0x2aaaaa[_0x4fc6('0xa')]||![];this[_0x4fc6('0xb')]=_0x2aaaaa[_0x4fc6('0xb')]||![];this['faxPause']=_0x2aaaaa['faxPause']||![];this[_0x4fc6('0xc')]=_0x2aaaaa[_0x4fc6('0xc')]||![];this['openchannelPause']=_0x2aaaaa['openchannelPause']||![];this[_0x4fc6('0xd')]=_0x4fc6('0xe');this[_0x4fc6('0xf')]=0x0;this[_0x4fc6('0x10')]=_0x2aaaaa[_0x4fc6('0x10')]||0x0;this[_0x4fc6('0x11')]=0x0;this[_0x4fc6('0x12')]=_0x4fc6('0xe');this['mailStatusTime']=0x0;this[_0x4fc6('0x13')]=_0x2aaaaa[_0x4fc6('0x13')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x4fc6('0x14')]='unknown';this['faxStatusTime']=0x0;this['faxCapacity']=_0x2aaaaa[_0x4fc6('0x15')]||0x0;this[_0x4fc6('0x16')]=0x0;this['smsStatus']='unknown';this[_0x4fc6('0x17')]=0x0;this['smsCapacity']=_0x2aaaaa[_0x4fc6('0x18')]||0x0;this[_0x4fc6('0x19')]=0x0;this[_0x4fc6('0x1a')]=_0x4fc6('0xe');this['whatsappStatusTime']=0x0;this[_0x4fc6('0x1b')]=_0x2aaaaa[_0x4fc6('0x1b')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x4fc6('0x1c')]=_0x4fc6('0xe');this[_0x4fc6('0x1d')]=0x0;this[_0x4fc6('0x1e')]=_0x2aaaaa[_0x4fc6('0x1e')]||0x0;this[_0x4fc6('0x1f')]=0x0;this[_0x4fc6('0x20')]=![];this[_0x4fc6('0x21')]=undefined;this[_0x4fc6('0x2')]='';this[_0x4fc6('0x22')]();}Agent[_0x4fc6('0x23')]['getChannelStatus']=function(_0x11ac79){if(this[_0x11ac79+_0x4fc6('0x24')]>0x0){if(this[_0x11ac79+_0x4fc6('0x25')]>0x0&&this[_0x11ac79+'CurrentCapacity']>=this[_0x11ac79+_0x4fc6('0x25')]){return _0x4fc6('0x26');}else{return _0x4fc6('0x27');}}else{return'idle';}};Agent[_0x4fc6('0x23')]['updateRealtime']=function(){var _0x20b171=[_0x4fc6('0x28'),_0x4fc6('0x29'),_0x4fc6('0x2a'),_0x4fc6('0x2b'),_0x4fc6('0x2c'),'whatsapp'];for(var _0x16632c=0x0;_0x16632c<_0x20b171[_0x4fc6('0x2d')];_0x16632c+=0x1){var _0x5c64b5=this[_0x4fc6('0x2e')](_0x20b171[_0x16632c]);if(this[_0x20b171[_0x16632c]+_0x4fc6('0x2f')]!==_0x5c64b5){this[_0x20b171[_0x16632c]+_0x4fc6('0x30')]=_[_0x4fc6('0x31')](moment()[_0x4fc6('0x32')]('x'));}this[_0x20b171[_0x16632c]+_0x4fc6('0x2f')]=_0x5c64b5;}var _0x57cc0a={'id':this['id'],'name':this[_0x4fc6('0x7')],'online':this['online'],'voicePause':this[_0x4fc6('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0x4fc6('0xb')],'smsPause':this[_0x4fc6('0xc')],'faxPause':this[_0x4fc6('0x33')],'openchannelPause':this[_0x4fc6('0x34')],'chatStatus':this[_0x4fc6('0xd')],'chatStatusTime':this[_0x4fc6('0xf')],'chatCapacity':this[_0x4fc6('0x10')],'chatCurrentCapacity':this[_0x4fc6('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x4fc6('0x35')],'mailCapacity':this[_0x4fc6('0x13')],'mailCurrentCapacity':this[_0x4fc6('0x36')],'faxStatus':this[_0x4fc6('0x14')],'faxStatusTime':this[_0x4fc6('0x37')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x4fc6('0x38')],'smsStatusTime':this[_0x4fc6('0x17')],'smsCapacity':this[_0x4fc6('0x18')],'smsCurrentCapacity':this[_0x4fc6('0x19')],'whatsappStatus':this[_0x4fc6('0x1a')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x4fc6('0x39')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x4fc6('0x1e')],'openchannelCurrentCapacity':this[_0x4fc6('0x1f')],'busy':this[_0x4fc6('0x20')],'busyQueue':this[_0x4fc6('0x21')]};var _0x3967dc=md5(JSON[_0x4fc6('0x3a')](_0x57cc0a));if(this[_0x4fc6('0x2')]!==_0x3967dc){this[_0x4fc6('0x2')]=_0x3967dc;io[_0x4fc6('0x3b')](_0x4fc6('0x3c'),_0x57cc0a);}};module['exports']=Agent; \ No newline at end of file +var _0x8a5c=['whatsappStatus','openchannelStatus','busy','emit','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','busyQueue','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','Status','StatusTime','toNumber','format','chatStatus','chatStatusTime','mailStatusTime','mailCurrentCapacity','smsStatus'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x8a5c,0x136));var _0xc8a5=function(_0xc25771,_0x51ed5f){_0xc25771=_0xc25771-0x0;var _0x910268=_0x8a5c[_0xc25771];return _0x910268;};'use strict';var _=require(_0xc8a5('0x0'));var moment=require(_0xc8a5('0x1'));var md5=require(_0xc8a5('0x2'));var Redis=require(_0xc8a5('0x3'));var config=require(_0xc8a5('0x4'));config[_0xc8a5('0x5')]=_[_0xc8a5('0x6')](config[_0xc8a5('0x5')],{'host':_0xc8a5('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc8a5('0x5')]));function Agent(_0x66b54){this['id']=_0x66b54['id']||0x0;this['name']=_0x66b54[_0xc8a5('0x8')]||'';this[_0xc8a5('0x9')]=_0x66b54[_0xc8a5('0x9')]||!![];this[_0xc8a5('0xa')]=_0x66b54['voicePause']||![];this[_0xc8a5('0xb')]=_0x66b54[_0xc8a5('0xb')]||![];this[_0xc8a5('0xc')]=_0x66b54[_0xc8a5('0xc')]||![];this[_0xc8a5('0xd')]=_0x66b54[_0xc8a5('0xd')]||![];this[_0xc8a5('0xe')]=_0x66b54[_0xc8a5('0xe')]||![];this[_0xc8a5('0xf')]=_0x66b54['openchannelPause']||![];this['chatStatus']=_0xc8a5('0x10');this['chatStatusTime']=0x0;this[_0xc8a5('0x11')]=_0x66b54[_0xc8a5('0x11')]||0x0;this[_0xc8a5('0x12')]=0x0;this[_0xc8a5('0x13')]=_0xc8a5('0x10');this['mailStatusTime']=0x0;this[_0xc8a5('0x14')]=_0x66b54[_0xc8a5('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xc8a5('0x15')]=_0xc8a5('0x10');this[_0xc8a5('0x16')]=0x0;this[_0xc8a5('0x17')]=_0x66b54[_0xc8a5('0x17')]||0x0;this[_0xc8a5('0x18')]=0x0;this['smsStatus']=_0xc8a5('0x10');this[_0xc8a5('0x19')]=0x0;this['smsCapacity']=_0x66b54[_0xc8a5('0x1a')]||0x0;this[_0xc8a5('0x1b')]=0x0;this['whatsappStatus']=_0xc8a5('0x10');this[_0xc8a5('0x1c')]=0x0;this[_0xc8a5('0x1d')]=_0x66b54[_0xc8a5('0x1d')]||0x0;this[_0xc8a5('0x1e')]=0x0;this['openchannelStatus']=_0xc8a5('0x10');this['openchannelStatusTime']=0x0;this[_0xc8a5('0x1f')]=_0x66b54[_0xc8a5('0x1f')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0xc8a5('0x20')]=undefined;this[_0xc8a5('0x2')]='';this[_0xc8a5('0x21')]();}Agent[_0xc8a5('0x22')][_0xc8a5('0x23')]=function(_0x5411a7){if(this[_0x5411a7+'CurrentCapacity']>0x0){if(this[_0x5411a7+_0xc8a5('0x24')]>0x0&&this[_0x5411a7+_0xc8a5('0x25')]>=this[_0x5411a7+_0xc8a5('0x24')]){return _0xc8a5('0x26');}else{return _0xc8a5('0x27');}}else{return _0xc8a5('0x28');}};Agent['prototype'][_0xc8a5('0x21')]=function(){var _0x3beb20=[_0xc8a5('0x29'),_0xc8a5('0x2a'),_0xc8a5('0x2b'),_0xc8a5('0x2c'),_0xc8a5('0x2d'),_0xc8a5('0x2e')];for(var _0x1ac715=0x0;_0x1ac715<_0x3beb20['length'];_0x1ac715+=0x1){var _0x11e162=this[_0xc8a5('0x23')](_0x3beb20[_0x1ac715]);if(this[_0x3beb20[_0x1ac715]+_0xc8a5('0x2f')]!==_0x11e162){this[_0x3beb20[_0x1ac715]+_0xc8a5('0x30')]=_[_0xc8a5('0x31')](moment()[_0xc8a5('0x32')]('x'));}this[_0x3beb20[_0x1ac715]+_0xc8a5('0x2f')]=_0x11e162;}var _0x483011={'id':this['id'],'name':this['name'],'online':this[_0xc8a5('0x9')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0xc8a5('0xc')],'smsPause':this[_0xc8a5('0xe')],'faxPause':this[_0xc8a5('0xd')],'openchannelPause':this[_0xc8a5('0xf')],'chatStatus':this[_0xc8a5('0x33')],'chatStatusTime':this[_0xc8a5('0x34')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xc8a5('0x12')],'mailStatus':this[_0xc8a5('0x13')],'mailStatusTime':this[_0xc8a5('0x35')],'mailCapacity':this[_0xc8a5('0x14')],'mailCurrentCapacity':this[_0xc8a5('0x36')],'faxStatus':this[_0xc8a5('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xc8a5('0x17')],'faxCurrentCapacity':this[_0xc8a5('0x18')],'smsStatus':this[_0xc8a5('0x37')],'smsStatusTime':this[_0xc8a5('0x19')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xc8a5('0x38')],'whatsappStatusTime':this[_0xc8a5('0x1c')],'whatsappCapacity':this[_0xc8a5('0x1d')],'whatsappCurrentCapacity':this[_0xc8a5('0x1e')],'openchannelStatus':this[_0xc8a5('0x39')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xc8a5('0x1f')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xc8a5('0x3a')],'busyQueue':this[_0xc8a5('0x20')]};var _0x1474fa=md5(JSON['stringify'](_0x483011));if(this[_0xc8a5('0x2')]!==_0x1474fa){this[_0xc8a5('0x2')]=_0x1474fa;io[_0xc8a5('0x3b')]('user:save',_0x483011);}};module[_0xc8a5('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index c714972..5399e11 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 _0xde42=['md5','updateRouting','prototype','_rr','map','Agents','updateRealtime','paused','length','online','loggedIn','chatPause','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId'];(function(_0x2ec385,_0x207183){var _0x177879=function(_0x34cc36){while(--_0x34cc36){_0x2ec385['push'](_0x2ec385['shift']());}};_0x177879(++_0x207183);}(_0xde42,0xb4));var _0x2de4=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0xde42[_0xd1c39b];return _0x58f5bc;};'use strict';var _=require(_0x2de4('0x0'));var md5=require('md5');var util=require(_0x2de4('0x1'));var Redis=require(_0x2de4('0x2'));var config=require(_0x2de4('0x3'));config[_0x2de4('0x4')]=_['defaults'](config[_0x2de4('0x4')],{'host':_0x2de4('0x5'),'port':0x18eb});var io=require(_0x2de4('0x6'))(new Redis(config['redis']));function ChatQueue(_0xcb0afa){this['id']=_0xcb0afa['id']||0x0;this['name']=_0xcb0afa[_0x2de4('0x7')]||'';this[_0x2de4('0x8')]=_0xcb0afa[_0x2de4('0x8')]||0xa;this['strategy']=_0xcb0afa[_0x2de4('0x9')]||_0x2de4('0xa');this['Agents']=_0xcb0afa['Agents'];this[_0x2de4('0xb')]={};this['waiting']=0x0;this[_0x2de4('0xc')]='';this[_0x2de4('0xd')]();this['updateRealtime']();}ChatQueue[_0x2de4('0xe')][_0x2de4('0xd')]=function(){var _0x449de8=this[_0x2de4('0xb')][_0x2de4('0xf')];this[_0x2de4('0xb')]=_[_0x2de4('0x10')](this[_0x2de4('0x11')],'id');this['mapAgentsId'][_0x2de4('0xf')]=_0x449de8;};ChatQueue[_0x2de4('0xe')][_0x2de4('0x12')]=function(){this['loggedIn']=0x0;this[_0x2de4('0x13')]=0x0;for(var _0x5e9a1f=0x0;_0x5e9a1f=0x0?this['available']:0x0;var _0x3ac765={'id':this['id'],'available':this[_0x2de4('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x2de4('0x7')],'paused':this['paused'],'waiting':this[_0x2de4('0x19')]};var _0x2822bc=md5(JSON[_0x2de4('0x1a')](_0x3ac765));if(this[_0x2de4('0xc')]!==_0x2822bc){this[_0x2de4('0xc')]=_0x2822bc;io['to'](util[_0x2de4('0x1b')](_0x2de4('0x1c'),_0x3ac765[_0x2de4('0x7')]))[_0x2de4('0x1d')](_0x2de4('0x1e'),_0x3ac765);}};module[_0x2de4('0x1f')]=ChatQueue; \ No newline at end of file +var _0x6084=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','chatPause','available','waiting','stringify','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','../../../config/environment'];(function(_0x51034a,_0x50161a){var _0x1fef98=function(_0x53109b){while(--_0x53109b){_0x51034a['push'](_0x51034a['shift']());}};_0x1fef98(++_0x50161a);}(_0x6084,0xb6));var _0x4608=function(_0x52cbb4,_0x2ea941){_0x52cbb4=_0x52cbb4-0x0;var _0x38ea04=_0x6084[_0x52cbb4];return _0x38ea04;};'use strict';var _=require(_0x4608('0x0'));var md5=require(_0x4608('0x1'));var util=require(_0x4608('0x2'));var Redis=require('ioredis');var config=require(_0x4608('0x3'));config[_0x4608('0x4')]=_[_0x4608('0x5')](config[_0x4608('0x4')],{'host':_0x4608('0x6'),'port':0x18eb});var io=require(_0x4608('0x7'))(new Redis(config[_0x4608('0x4')]));function ChatQueue(_0xe0f41a){this['id']=_0xe0f41a['id']||0x0;this[_0x4608('0x8')]=_0xe0f41a[_0x4608('0x8')]||'';this[_0x4608('0x9')]=_0xe0f41a['timeout']||0xa;this[_0x4608('0xa')]=_0xe0f41a[_0x4608('0xa')]||_0x4608('0xb');this[_0x4608('0xc')]=_0xe0f41a['Agents'];this[_0x4608('0xd')]={};this['waiting']=0x0;this[_0x4608('0x1')]='';this[_0x4608('0xe')]();this[_0x4608('0xf')]();}ChatQueue[_0x4608('0x10')]['updateRouting']=function(){var _0x3345a2=this[_0x4608('0xd')][_0x4608('0x11')];this[_0x4608('0xd')]=_[_0x4608('0x12')](this[_0x4608('0xc')],'id');this['mapAgentsId']['_rr']=_0x3345a2;};ChatQueue[_0x4608('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x4608('0x13')]=0x0;for(var _0xfb9509=0x0;_0xfb9509=0x0?this[_0x4608('0x18')]:0x0;var _0x17e0e5={'id':this['id'],'available':this[_0x4608('0x18')],'loggedIn':this[_0x4608('0x16')],'name':this[_0x4608('0x8')],'paused':this['paused'],'waiting':this[_0x4608('0x19')]};var _0x938693=md5(JSON[_0x4608('0x1a')](_0x17e0e5));if(this[_0x4608('0x1')]!==_0x938693){this[_0x4608('0x1')]=_0x938693;io['to'](util['format'](_0x4608('0x1b'),_0x17e0e5[_0x4608('0x8')]))[_0x4608('0x1c')](_0x4608('0x1d'),_0x17e0e5);}};module[_0x4608('0x1e')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 574ed37..da30c8f 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 _0x7cdb=['beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','online','faxPause','available','waiting','stringify','format','exports','md5','../../../config/environment','redis','localhost','name','timeout','strategy'];(function(_0x26ef14,_0x54606f){var _0x209847=function(_0x4e5e22){while(--_0x4e5e22){_0x26ef14['push'](_0x26ef14['shift']());}};_0x209847(++_0x54606f);}(_0x7cdb,0xe9));var _0xb7cd=function(_0x5a7caf,_0x2dc952){_0x5a7caf=_0x5a7caf-0x0;var _0x5bcd83=_0x7cdb[_0x5a7caf];return _0x5bcd83;};'use strict';var _=require('lodash');var md5=require(_0xb7cd('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0xb7cd('0x1'));config['redis']=_['defaults'](config[_0xb7cd('0x2')],{'host':_0xb7cd('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb7cd('0x2')]));function FaxQueue(_0x4ec41e){this['id']=_0x4ec41e['id']||0x0;this['name']=_0x4ec41e[_0xb7cd('0x4')]||'';this[_0xb7cd('0x5')]=_0x4ec41e[_0xb7cd('0x5')]||0xa;this[_0xb7cd('0x6')]=_0x4ec41e[_0xb7cd('0x6')]||_0xb7cd('0x7');this['Agents']=_0x4ec41e[_0xb7cd('0x8')];this[_0xb7cd('0x9')]={};this['waiting']=0x0;this[_0xb7cd('0x0')]='';this[_0xb7cd('0xa')]();this[_0xb7cd('0xb')]();}FaxQueue[_0xb7cd('0xc')][_0xb7cd('0xa')]=function(){var _0x33b8e2=this[_0xb7cd('0x9')]['_rr'];this[_0xb7cd('0x9')]=_[_0xb7cd('0xd')](this[_0xb7cd('0x8')],'id');this[_0xb7cd('0x9')][_0xb7cd('0xe')]=_0x33b8e2;};FaxQueue[_0xb7cd('0xc')][_0xb7cd('0xb')]=function(){this[_0xb7cd('0xf')]=0x0;this[_0xb7cd('0x10')]=0x0;for(var _0x3d41f7=0x0;_0x3d41f7=0x0?this['available']:0x0;var _0x4cfcd9={'id':this['id'],'available':this['available'],'loggedIn':this[_0xb7cd('0xf')],'name':this[_0xb7cd('0x4')],'paused':this[_0xb7cd('0x10')],'waiting':this[_0xb7cd('0x14')]};var _0x43fc48=md5(JSON[_0xb7cd('0x15')](_0x4cfcd9));if(this[_0xb7cd('0x0')]!==_0x43fc48){this[_0xb7cd('0x0')]=_0x43fc48;io['to'](util[_0xb7cd('0x16')]('fax:queue:%s',_0x4cfcd9[_0xb7cd('0x4')]))['emit']('fax_queue:save',_0x4cfcd9);}};module[_0xb7cd('0x17')]=FaxQueue; \ No newline at end of file +var _0xc9ea=['loggedIn','paused','length','online','faxPause','available','format','fax:queue:%s','emit','fax_queue:save','exports','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr'];(function(_0x3dcdc4,_0x5bc779){var _0x49e513=function(_0x1f55c4){while(--_0x1f55c4){_0x3dcdc4['push'](_0x3dcdc4['shift']());}};_0x49e513(++_0x5bc779);}(_0xc9ea,0x97));var _0xac9e=function(_0x28be47,_0x443d44){_0x28be47=_0x28be47-0x0;var _0x564063=_0xc9ea[_0x28be47];return _0x564063;};'use strict';var _=require('lodash');var md5=require(_0xac9e('0x0'));var util=require(_0xac9e('0x1'));var Redis=require('ioredis');var config=require(_0xac9e('0x2'));config[_0xac9e('0x3')]=_[_0xac9e('0x4')](config[_0xac9e('0x3')],{'host':_0xac9e('0x5'),'port':0x18eb});var io=require(_0xac9e('0x6'))(new Redis(config['redis']));function FaxQueue(_0x16458a){this['id']=_0x16458a['id']||0x0;this[_0xac9e('0x7')]=_0x16458a[_0xac9e('0x7')]||'';this['timeout']=_0x16458a['timeout']||0xa;this[_0xac9e('0x8')]=_0x16458a[_0xac9e('0x8')]||'beepall';this[_0xac9e('0x9')]=_0x16458a[_0xac9e('0x9')];this[_0xac9e('0xa')]={};this[_0xac9e('0xb')]=0x0;this[_0xac9e('0x0')]='';this[_0xac9e('0xc')]();this[_0xac9e('0xd')]();}FaxQueue[_0xac9e('0xe')][_0xac9e('0xc')]=function(){var _0x56372e=this[_0xac9e('0xa')]['_rr'];this['mapAgentsId']=_[_0xac9e('0xf')](this[_0xac9e('0x9')],'id');this[_0xac9e('0xa')][_0xac9e('0x10')]=_0x56372e;};FaxQueue[_0xac9e('0xe')][_0xac9e('0xd')]=function(){this[_0xac9e('0x11')]=0x0;this[_0xac9e('0x12')]=0x0;for(var _0x39fe53=0x0;_0x39fe53=0x0?this['available']:0x0;var _0x2224f3={'id':this['id'],'available':this[_0xac9e('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xac9e('0x7')],'paused':this[_0xac9e('0x12')],'waiting':this[_0xac9e('0xb')]};var _0x35383e=md5(JSON['stringify'](_0x2224f3));if(this[_0xac9e('0x0')]!==_0x35383e){this[_0xac9e('0x0')]=_0x35383e;io['to'](util[_0xac9e('0x17')](_0xac9e('0x18'),_0x2224f3['name']))[_0xac9e('0x19')](_0xac9e('0x1a'),_0x2224f3);}};module[_0xac9e('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 41e8cbd..fffe546 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 _0x9946=['name','Intervals'];(function(_0x43853b,_0x30acd5){var _0x460453=function(_0x1357c6){while(--_0x1357c6){_0x43853b['push'](_0x43853b['shift']());}};_0x460453(++_0x30acd5);}(_0x9946,0x1c4));var _0x6994=function(_0x3806c0,_0xae946f){_0x3806c0=_0x3806c0-0x0;var _0x570946=_0x9946[_0x3806c0];return _0x570946;};'use strict';function Interval(_0x1afc30){this['id']=_0x1afc30['id']||0x0;this[_0x6994('0x0')]=_0x1afc30[_0x6994('0x0')]||'';this[_0x6994('0x1')]=_0x1afc30['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0x181b=['name','Intervals','exports'];(function(_0x1a6bc0,_0x10a019){var _0x122b68=function(_0x38844d){while(--_0x38844d){_0x1a6bc0['push'](_0x1a6bc0['shift']());}};_0x122b68(++_0x10a019);}(_0x181b,0xc3));var _0xb181=function(_0x4fbdc1,_0x6e461a){_0x4fbdc1=_0x4fbdc1-0x0;var _0x766501=_0x181b[_0x4fbdc1];return _0x766501;};'use strict';function Interval(_0x894bf6){this['id']=_0x894bf6['id']||0x0;this[_0xb181('0x0')]=_0x894bf6[_0xb181('0x0')]||'';this[_0xb181('0x1')]=_0x894bf6['Intervals']||{};}module[_0xb181('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 42a29fe..eda6de7 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 _0x86d7=['Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','online','mailPause','available','waiting','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x5d9867,_0x5e9030){var _0x7d2118=function(_0x2e5149){while(--_0x2e5149){_0x5d9867['push'](_0x5d9867['shift']());}};_0x7d2118(++_0x5e9030);}(_0x86d7,0x1b6));var _0x786d=function(_0x31ff34,_0x58ca07){_0x31ff34=_0x31ff34-0x0;var _0x1d40cd=_0x86d7[_0x31ff34];return _0x1d40cd;};'use strict';var _=require(_0x786d('0x0'));var md5=require(_0x786d('0x1'));var util=require(_0x786d('0x2'));var Redis=require('ioredis');var config=require(_0x786d('0x3'));config['redis']=_[_0x786d('0x4')](config[_0x786d('0x5')],{'host':_0x786d('0x6'),'port':0x18eb});var io=require(_0x786d('0x7'))(new Redis(config[_0x786d('0x5')]));function MailQueue(_0x20fdba){this['id']=_0x20fdba['id']||0x0;this[_0x786d('0x8')]=_0x20fdba['name']||'';this[_0x786d('0x9')]=_0x20fdba[_0x786d('0x9')]||0xa;this[_0x786d('0xa')]=_0x20fdba['strategy']||_0x786d('0xb');this[_0x786d('0xc')]=_0x20fdba['Agents'];this[_0x786d('0xd')]={};this['waiting']=0x0;this[_0x786d('0x1')]='';this[_0x786d('0xe')]();this[_0x786d('0xf')]();}MailQueue['prototype'][_0x786d('0xe')]=function(){var _0x14ccee=this[_0x786d('0xd')][_0x786d('0x10')];this['mapAgentsId']=_[_0x786d('0x11')](this[_0x786d('0xc')],'id');this[_0x786d('0xd')][_0x786d('0x10')]=_0x14ccee;};MailQueue['prototype']['updateRealtime']=function(){this[_0x786d('0x12')]=0x0;this[_0x786d('0x13')]=0x0;for(var _0x1d6b1b=0x0;_0x1d6b1b=0x0?this['available']:0x0;var _0x1f343a={'id':this['id'],'available':this[_0x786d('0x17')],'loggedIn':this[_0x786d('0x12')],'name':this[_0x786d('0x8')],'paused':this[_0x786d('0x13')],'waiting':this[_0x786d('0x18')]};var _0x53b0b2=md5(JSON[_0x786d('0x19')](_0x1f343a));if(this[_0x786d('0x1')]!==_0x53b0b2){this['md5']=_0x53b0b2;io['to'](util['format'](_0x786d('0x1a'),_0x1f343a[_0x786d('0x8')]))[_0x786d('0x1b')](_0x786d('0x1c'),_0x1f343a);}};module[_0x786d('0x1d')]=MailQueue; \ No newline at end of file +var _0xb177=['localhost','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','online','mailPause','paused','available','waiting','stringify','format','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults'];(function(_0x5d7eb3,_0x6af107){var _0x51d8aa=function(_0xc7b17f){while(--_0xc7b17f){_0x5d7eb3['push'](_0x5d7eb3['shift']());}};_0x51d8aa(++_0x6af107);}(_0xb177,0x19e));var _0x7b17=function(_0x2be91d,_0x595d2d){_0x2be91d=_0x2be91d-0x0;var _0xb3a0a7=_0xb177[_0x2be91d];return _0xb3a0a7;};'use strict';var _=require('lodash');var md5=require(_0x7b17('0x0'));var util=require(_0x7b17('0x1'));var Redis=require(_0x7b17('0x2'));var config=require(_0x7b17('0x3'));config[_0x7b17('0x4')]=_[_0x7b17('0x5')](config['redis'],{'host':_0x7b17('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7b17('0x4')]));function MailQueue(_0x2c4c54){this['id']=_0x2c4c54['id']||0x0;this[_0x7b17('0x7')]=_0x2c4c54[_0x7b17('0x7')]||'';this[_0x7b17('0x8')]=_0x2c4c54['timeout']||0xa;this[_0x7b17('0x9')]=_0x2c4c54['strategy']||_0x7b17('0xa');this[_0x7b17('0xb')]=_0x2c4c54[_0x7b17('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x7b17('0x0')]='';this[_0x7b17('0xc')]();this[_0x7b17('0xd')]();}MailQueue[_0x7b17('0xe')]['updateRouting']=function(){var _0x52a9cd=this[_0x7b17('0xf')][_0x7b17('0x10')];this[_0x7b17('0xf')]=_[_0x7b17('0x11')](this[_0x7b17('0xb')],'id');this[_0x7b17('0xf')]['_rr']=_0x52a9cd;};MailQueue[_0x7b17('0xe')][_0x7b17('0xd')]=function(){this[_0x7b17('0x12')]=0x0;this['paused']=0x0;for(var _0x35e8bf=0x0;_0x35e8bf=0x0?this[_0x7b17('0x16')]:0x0;var _0x152afc={'id':this['id'],'available':this[_0x7b17('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x7b17('0x15')],'waiting':this[_0x7b17('0x17')]};var _0x236ac2=md5(JSON[_0x7b17('0x18')](_0x152afc));if(this[_0x7b17('0x0')]!==_0x236ac2){this[_0x7b17('0x0')]=_0x236ac2;io['to'](util[_0x7b17('0x19')]('mail:queue:%s',_0x152afc[_0x7b17('0x7')]))['emit'](_0x7b17('0x1a'),_0x152afc);}};module[_0x7b17('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 8ac8402..c5db7f2 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 _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x2ce8b2,_0x55e8a0){var _0x59e5c1=function(_0x265b40){while(--_0x265b40){_0x2ce8b2['push'](_0x2ce8b2['shift']());}};_0x59e5c1(++_0x55e8a0);}(_0x5fc3,0xa8));var _0x35fc=function(_0x48c4ef,_0x319d44){_0x48c4ef=_0x48c4ef-0x0;var _0x435715=_0x5fc3[_0x48c4ef];return _0x435715;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file +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(_0x5df61d,_0x158640){var _0x24cc4c=function(_0x2de006){while(--_0x2de006){_0x5df61d['push'](_0x5df61d['shift']());}};_0x24cc4c(++_0x158640);}(_0x2ef3,0xba));var _0x32ef=function(_0x9d215a,_0x1bc1c5){_0x9d215a=_0x9d215a-0x0;var _0x3bbdc9=_0x2ef3[_0x9d215a];return _0x3bbdc9;};'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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index a14ef89..2a851bb 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 _0x6921=['defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','online','smsPause','available','sms:queue:%s','emit','exports','md5','ioredis','redis'];(function(_0x15d5b4,_0x3d2470){var _0x26f735=function(_0x5642e7){while(--_0x5642e7){_0x15d5b4['push'](_0x15d5b4['shift']());}};_0x26f735(++_0x3d2470);}(_0x6921,0x1d1));var _0x1692=function(_0x4356da,_0x5edb7e){_0x4356da=_0x4356da-0x0;var _0xd62010=_0x6921[_0x4356da];return _0xd62010;};'use strict';var _=require('lodash');var md5=require(_0x1692('0x0'));var util=require('util');var Redis=require(_0x1692('0x1'));var config=require('../../../config/environment');config[_0x1692('0x2')]=_[_0x1692('0x3')](config['redis'],{'host':_0x1692('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1692('0x2')]));function SmsQueue(_0x39cc05){this['id']=_0x39cc05['id']||0x0;this[_0x1692('0x5')]=_0x39cc05[_0x1692('0x5')]||'';this[_0x1692('0x6')]=_0x39cc05[_0x1692('0x6')]||0xa;this[_0x1692('0x7')]=_0x39cc05[_0x1692('0x7')]||_0x1692('0x8');this[_0x1692('0x9')]=_0x39cc05[_0x1692('0x9')];this['mapAgentsId']={};this[_0x1692('0xa')]=0x0;this['md5']='';this[_0x1692('0xb')]();this[_0x1692('0xc')]();}SmsQueue[_0x1692('0xd')][_0x1692('0xb')]=function(){var _0x19a6cd=this[_0x1692('0xe')]['_rr'];this[_0x1692('0xe')]=_[_0x1692('0xf')](this[_0x1692('0x9')],'id');this[_0x1692('0xe')][_0x1692('0x10')]=_0x19a6cd;};SmsQueue[_0x1692('0xd')]['updateRealtime']=function(){this[_0x1692('0x11')]=0x0;this[_0x1692('0x12')]=0x0;for(var _0xddfb0c=0x0;_0xddfb0c=0x0?this['available']:0x0;var _0x598a2f={'id':this['id'],'available':this[_0x1692('0x16')],'loggedIn':this[_0x1692('0x11')],'name':this['name'],'paused':this[_0x1692('0x12')],'waiting':this['waiting']};var _0x2b1795=md5(JSON['stringify'](_0x598a2f));if(this['md5']!==_0x2b1795){this[_0x1692('0x0')]=_0x2b1795;io['to'](util['format'](_0x1692('0x17'),_0x598a2f[_0x1692('0x5')]))[_0x1692('0x18')]('sms_queue:save',_0x598a2f);}};module[_0x1692('0x19')]=SmsQueue; \ No newline at end of file +var _0x97a2=['md5','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','online','smsPause','available','paused','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x14f08b,_0x4ec6e2){var _0x43a80c=function(_0x389fc0){while(--_0x389fc0){_0x14f08b['push'](_0x14f08b['shift']());}};_0x43a80c(++_0x4ec6e2);}(_0x97a2,0x1b1));var _0x297a=function(_0x1a9b54,_0x36717c){_0x1a9b54=_0x1a9b54-0x0;var _0x4c421a=_0x97a2[_0x1a9b54];return _0x4c421a;};'use strict';var _=require(_0x297a('0x0'));var md5=require('md5');var util=require(_0x297a('0x1'));var Redis=require(_0x297a('0x2'));var config=require(_0x297a('0x3'));config[_0x297a('0x4')]=_[_0x297a('0x5')](config[_0x297a('0x4')],{'host':_0x297a('0x6'),'port':0x18eb});var io=require(_0x297a('0x7'))(new Redis(config['redis']));function SmsQueue(_0x19816c){this['id']=_0x19816c['id']||0x0;this[_0x297a('0x8')]=_0x19816c[_0x297a('0x8')]||'';this[_0x297a('0x9')]=_0x19816c[_0x297a('0x9')]||0xa;this[_0x297a('0xa')]=_0x19816c['strategy']||_0x297a('0xb');this[_0x297a('0xc')]=_0x19816c[_0x297a('0xc')];this[_0x297a('0xd')]={};this[_0x297a('0xe')]=0x0;this[_0x297a('0xf')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue['prototype'][_0x297a('0x10')]=function(){var _0x3b0b3c=this[_0x297a('0xd')][_0x297a('0x11')];this['mapAgentsId']=_[_0x297a('0x12')](this[_0x297a('0xc')],'id');this[_0x297a('0xd')][_0x297a('0x11')]=_0x3b0b3c;};SmsQueue[_0x297a('0x13')][_0x297a('0x14')]=function(){this[_0x297a('0x15')]=0x0;this['paused']=0x0;for(var _0x4d826d=0x0;_0x4d826d=0x0?this[_0x297a('0x18')]:0x0;var _0x29c6d6={'id':this['id'],'available':this['available'],'loggedIn':this[_0x297a('0x15')],'name':this[_0x297a('0x8')],'paused':this['paused'],'waiting':this[_0x297a('0xe')]};var _0x43be0b=md5(JSON[_0x297a('0x1a')](_0x29c6d6));if(this[_0x297a('0xf')]!==_0x43be0b){this[_0x297a('0xf')]=_0x43be0b;io['to'](util[_0x297a('0x1b')](_0x297a('0x1c'),_0x29c6d6[_0x297a('0x8')]))[_0x297a('0x1d')](_0x297a('0x1e'),_0x29c6d6);}};module[_0x297a('0x1f')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index cd23817..46342d7 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 _0x154c=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','whatsappPause','available','paused','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x3a2c61,_0x19eb59){var _0x18bf66=function(_0x14e4ff){while(--_0x14e4ff){_0x3a2c61['push'](_0x3a2c61['shift']());}};_0x18bf66(++_0x19eb59);}(_0x154c,0x1c3));var _0xc154=function(_0x282442,_0x135555){_0x282442=_0x282442-0x0;var _0xf97807=_0x154c[_0x282442];return _0xf97807;};'use strict';var _=require(_0xc154('0x0'));var md5=require(_0xc154('0x1'));var util=require(_0xc154('0x2'));var Redis=require(_0xc154('0x3'));var config=require('../../../config/environment');config[_0xc154('0x4')]=_[_0xc154('0x5')](config[_0xc154('0x4')],{'host':_0xc154('0x6'),'port':0x18eb});var io=require(_0xc154('0x7'))(new Redis(config[_0xc154('0x4')]));function WhatsappQueue(_0x20a641){this['id']=_0x20a641['id']||0x0;this[_0xc154('0x8')]=_0x20a641[_0xc154('0x8')]||'';this[_0xc154('0x9')]=_0x20a641[_0xc154('0x9')]||0xa;this[_0xc154('0xa')]=_0x20a641[_0xc154('0xa')]||_0xc154('0xb');this[_0xc154('0xc')]=_0x20a641['Agents'];this[_0xc154('0xd')]={};this[_0xc154('0xe')]=0x0;this[_0xc154('0x1')]='';this[_0xc154('0xf')]();this[_0xc154('0x10')]();}WhatsappQueue[_0xc154('0x11')][_0xc154('0xf')]=function(){var _0x5681cd=this[_0xc154('0xd')][_0xc154('0x12')];this[_0xc154('0xd')]=_[_0xc154('0x13')](this[_0xc154('0xc')],'id');this[_0xc154('0xd')][_0xc154('0x12')]=_0x5681cd;};WhatsappQueue[_0xc154('0x11')][_0xc154('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x256e0d=0x0;_0x256e0d=0x0?this[_0xc154('0x16')]:0x0;var _0x4fc517={'id':this['id'],'available':this[_0xc154('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xc154('0x8')],'paused':this[_0xc154('0x17')],'waiting':this[_0xc154('0xe')]};var _0x26283b=md5(JSON[_0xc154('0x18')](_0x4fc517));if(this[_0xc154('0x1')]!==_0x26283b){this[_0xc154('0x1')]=_0x26283b;io['to'](util[_0xc154('0x19')](_0xc154('0x1a'),_0x4fc517[_0xc154('0x8')]))['emit'](_0xc154('0x1b'),_0x4fc517);}};module[_0xc154('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0xfb78=['online','available','name','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','map','loggedIn','paused','length'];(function(_0x29d1ba,_0x7a5223){var _0x3de575=function(_0x10560b){while(--_0x10560b){_0x29d1ba['push'](_0x29d1ba['shift']());}};_0x3de575(++_0x7a5223);}(_0xfb78,0x116));var _0x8fb7=function(_0x5f46e7,_0x62f9f8){_0x5f46e7=_0x5f46e7-0x0;var _0x567e95=_0xfb78[_0x5f46e7];return _0x567e95;};'use strict';var _=require(_0x8fb7('0x0'));var md5=require(_0x8fb7('0x1'));var util=require('util');var Redis=require(_0x8fb7('0x2'));var config=require(_0x8fb7('0x3'));config[_0x8fb7('0x4')]=_[_0x8fb7('0x5')](config[_0x8fb7('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x8fb7('0x6'))(new Redis(config[_0x8fb7('0x4')]));function WhatsappQueue(_0x1795cd){this['id']=_0x1795cd['id']||0x0;this['name']=_0x1795cd['name']||'';this[_0x8fb7('0x7')]=_0x1795cd[_0x8fb7('0x7')]||0xa;this[_0x8fb7('0x8')]=_0x1795cd[_0x8fb7('0x8')]||'beepall';this[_0x8fb7('0x9')]=_0x1795cd[_0x8fb7('0x9')];this[_0x8fb7('0xa')]={};this[_0x8fb7('0xb')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue[_0x8fb7('0xc')][_0x8fb7('0xd')]=function(){var _0x2572e4=this['mapAgentsId'][_0x8fb7('0xe')];this[_0x8fb7('0xa')]=_[_0x8fb7('0xf')](this[_0x8fb7('0x9')],'id');this[_0x8fb7('0xa')][_0x8fb7('0xe')]=_0x2572e4;};WhatsappQueue[_0x8fb7('0xc')]['updateRealtime']=function(){this[_0x8fb7('0x10')]=0x0;this[_0x8fb7('0x11')]=0x0;for(var _0x2c813f=0x0;_0x2c813f=0x0?this[_0x8fb7('0x14')]:0x0;var _0x92d5b0={'id':this['id'],'available':this[_0x8fb7('0x14')],'loggedIn':this[_0x8fb7('0x10')],'name':this[_0x8fb7('0x15')],'paused':this['paused'],'waiting':this['waiting']};var _0xbddfcc=md5(JSON[_0x8fb7('0x16')](_0x92d5b0));if(this[_0x8fb7('0x1')]!==_0xbddfcc){this[_0x8fb7('0x1')]=_0xbddfcc;io['to'](util[_0x8fb7('0x17')](_0x8fb7('0x18'),_0x92d5b0['name']))[_0x8fb7('0x19')](_0x8fb7('0x1a'),_0x92d5b0);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 1951733..bc0485c 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(_0x29de32,_0x1d5e33){var _0x48c6cc=function(_0x24ad8d){while(--_0x24ad8d){_0x29de32['push'](_0x29de32['shift']());}};_0x48c6cc(++_0x1d5e33);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d1244,_0x156028){_0x3d1244=_0x3d1244-0x0;var _0x5d6372=_0xb10b[_0x3d1244];return _0x5d6372;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index b1ddab0..11bf03d 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 _0xa350=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','../client'];(function(_0x3441e9,_0x269c8a){var _0x7f9ada=function(_0x4e62fd){while(--_0x4e62fd){_0x3441e9['push'](_0x3441e9['shift']());}};_0x7f9ada(++_0x269c8a);}(_0xa350,0xe3));var _0x0a35=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xa350[_0x49b207];return _0x2dc8fa;};'use strict';var client=require(_0x0a35('0x0'));exports['update']=function(_0x1b1da2,_0x564c00){return client[_0x0a35('0x1')](_0x0a35('0x2'),{'body':_0x564c00,'options':{'where':{'id':_0x1b1da2}},'log':_0x0a35('0x3')});};exports[_0x0a35('0x4')]=function(_0x3c744f,_0x5745e6){return client['Request'](_0x0a35('0x5'),{'body':_0x5745e6,'options':{'where':{'id':_0x3c744f}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xbff4=['../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xbff4,0x93));var _0x4bff=function(_0x3e618a,_0x135251){_0x3e618a=_0x3e618a-0x0;var _0x1f3d61=_0xbff4[_0x3e618a];return _0x1f3d61;};'use strict';var client=require(_0x4bff('0x0'));exports[_0x4bff('0x1')]=function(_0x4e8558,_0x220997){return client[_0x4bff('0x2')](_0x4bff('0x3'),{'body':_0x220997,'options':{'where':{'id':_0x4e8558}},'log':_0x4bff('0x4')});};exports[_0x4bff('0x5')]=function(_0x4f732c,_0x3ccacb){return client[_0x4bff('0x2')]('AddTagsToChatInteraction',{'body':_0x3ccacb,'options':{'where':{'id':_0x4f732c}},'log':_0x4bff('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 0ec91cd..f8f2ab0 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 _0x6a59=['Request','CreateChatMessage','../client'];(function(_0x41175b,_0x578262){var _0x38fef2=function(_0x311097){while(--_0x311097){_0x41175b['push'](_0x41175b['shift']());}};_0x38fef2(++_0x578262);}(_0x6a59,0x116));var _0x96a5=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0x6a59[_0x46ae5a];return _0x434986;};'use strict';var client=require(_0x96a5('0x0'));exports['create']=function(_0x296c04){return client[_0x96a5('0x1')](_0x96a5('0x2'),{'body':_0x296c04,'log':'createChatMessage'});}; \ No newline at end of file +var _0x775e=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x3e1415,_0x2ad5ee){var _0x2e1ec7=function(_0x4beb31){while(--_0x4beb31){_0x3e1415['push'](_0x3e1415['shift']());}};_0x2e1ec7(++_0x2ad5ee);}(_0x775e,0x1e8));var _0xe775=function(_0x381496,_0x2c6909){_0x381496=_0x381496-0x0;var _0xc053f1=_0x775e[_0x381496];return _0xc053f1;};'use strict';var client=require(_0xe775('0x0'));exports[_0xe775('0x1')]=function(_0x202f0d){return client[_0xe775('0x2')](_0xe775('0x3'),{'body':_0x202f0d,'log':_0xe775('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index cf9a98a..7e96a5c 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 _0x8a8b=['name','strategy','Agents','online','chatPause','getChatQueues','../client','GetChatQueue'];(function(_0xb5b9bd,_0x88cf67){var _0x3fcf41=function(_0x1cf25f){while(--_0x1cf25f){_0xb5b9bd['push'](_0xb5b9bd['shift']());}};_0x3fcf41(++_0x88cf67);}(_0x8a8b,0xae));var _0xb8a8=function(_0x4dbb3f,_0x487997){_0x4dbb3f=_0x4dbb3f-0x0;var _0x388dc0=_0x8a8b[_0x4dbb3f];return _0x388dc0;};'use strict';var client=require(_0xb8a8('0x0'));exports['getChatQueues']=function(){return function(){return client['Request'](_0xb8a8('0x1'),{'options':{'raw':![],'attributes':['id',_0xb8a8('0x2'),'timeout',_0xb8a8('0x3')],'include':[{'model':'User','as':_0xb8a8('0x4'),'attributes':['id','name',_0xb8a8('0x5'),_0xb8a8('0x6')]}]},'log':_0xb8a8('0x7')});};}; \ No newline at end of file +var _0xbc8d=['timeout','User','Agents','chatPause','getChatQueues','../client','Request','GetChatQueue','name'];(function(_0x212b5d,_0x318113){var _0xd29835=function(_0x39dc22){while(--_0x39dc22){_0x212b5d['push'](_0x212b5d['shift']());}};_0xd29835(++_0x318113);}(_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 diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 4e93360..7cec11e 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 _0x37a4=['CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC','../client'];(function(_0x14d233,_0x4289f7){var _0x2d4c76=function(_0x29ef14){while(--_0x29ef14){_0x14d233['push'](_0x14d233['shift']());}};_0x2d4c76(++_0x4289f7);}(_0x37a4,0xcb));var _0x437a=function(_0xb67779,_0x37fc4d){_0xb67779=_0xb67779-0x0;var _0x1d417a=_0x37a4[_0xb67779];return _0x1d417a;};'use strict';var client=require(_0x437a('0x0'));exports['create']=function(_0x222222){return client['Request'](_0x437a('0x1'),{'body':_0x222222,'log':_0x437a('0x1')});};exports[_0x437a('0x2')]=function(_0x5bfe6f,_0x5f2883){return client[_0x437a('0x3')](_0x437a('0x4'),{'body':_0x5f2883,'options':{'where':{'uniqueid':_0x5bfe6f},'order':[['id',_0x437a('0x5')]],'limit':0x1},'log':_0x437a('0x4')});}; \ No newline at end of file +var _0x639a=['UpdateChatQueueReport','create','Request','CreateChatQueueReport','update'];(function(_0x1b5213,_0x43a222){var _0x31ccb8=function(_0x5ab569){while(--_0x5ab569){_0x1b5213['push'](_0x1b5213['shift']());}};_0x31ccb8(++_0x43a222);}(_0x639a,0xec));var _0xa639=function(_0x1748c5,_0x4678a4){_0x1748c5=_0x1748c5-0x0;var _0x3d47a6=_0x639a[_0x1748c5];return _0x3d47a6;};'use strict';var client=require('../client');exports[_0xa639('0x0')]=function(_0x20266e){return client[_0xa639('0x1')](_0xa639('0x2'),{'body':_0x20266e,'log':_0xa639('0x2')});};exports[_0xa639('0x3')]=function(_0x4e3979,_0x29b07d){return client[_0xa639('0x1')](_0xa639('0x4'),{'body':_0x29b07d,'options':{'where':{'uniqueid':_0x4e3979},'order':[['id','DESC']],'limit':0x1},'log':_0xa639('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index bd84b89..ca9e642 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x296897,_0x4d23ea){var _0x2b44ab=function(_0xdf90d8){while(--_0xdf90d8){_0x296897['push'](_0x296897['shift']());}};_0x2b44ab(++_0x4d23ea);}(_0x7a54,0x106));var _0x47a5=function(_0x1dc253,_0x46f34c){_0x1dc253=_0x1dc253-0x0;var _0xc08550=_0x7a54[_0x1dc253];return _0xc08550;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x36184b,_0x58bc1c){var _0x2d7246=function(_0x5557a2){while(--_0x5557a2){_0x36184b['push'](_0x36184b['shift']());}};_0x2d7246(++_0x58bc1c);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 3ef481b..94dcc17 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 _0x49da=['../client','create','Request'];(function(_0x21b5da,_0x253792){var _0x59d1f8=function(_0x7c6d90){while(--_0x7c6d90){_0x21b5da['push'](_0x21b5da['shift']());}};_0x59d1f8(++_0x253792);}(_0x49da,0x1dd));var _0xa49d=function(_0x369f83,_0x2c0cd9){_0x369f83=_0x369f83-0x0;var _0x5462d8=_0x49da[_0x369f83];return _0x5462d8;};'use strict';var client=require(_0xa49d('0x0'));exports[_0xa49d('0x1')]=function(_0x151bfb){return client[_0xa49d('0x2')]('CreateFaxMessage',{'body':_0x151bfb,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x45b1=['../client','CreateFaxMessage'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0x45b1,0x182));var _0x145b=function(_0x23b2cf,_0x5ee2df){_0x23b2cf=_0x23b2cf-0x0;var _0x7e3fa=_0x45b1[_0x23b2cf];return _0x7e3fa;};'use strict';var client=require(_0x145b('0x0'));exports['create']=function(_0x3ec3f5){return client['Request'](_0x145b('0x1'),{'body':_0x3ec3f5,'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 2149754..3b8c5f4 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 _0x8054=['GetFaxQueue','name','timeout','strategy','User','Agents','faxPause','getFaxQueues'];(function(_0x3e40c5,_0xfaacaa){var _0x4e0446=function(_0x5e1da8){while(--_0x5e1da8){_0x3e40c5['push'](_0x3e40c5['shift']());}};_0x4e0446(++_0xfaacaa);}(_0x8054,0x6f));var _0x4805=function(_0x8264be,_0x54214a){_0x8264be=_0x8264be-0x0;var _0xfb6712=_0x8054[_0x8264be];return _0xfb6712;};'use strict';var client=require('../client');exports[_0x4805('0x0')]=function(){return function(){return client['Request'](_0x4805('0x1'),{'options':{'raw':![],'attributes':['id',_0x4805('0x2'),_0x4805('0x3'),_0x4805('0x4')],'include':[{'model':_0x4805('0x5'),'as':_0x4805('0x6'),'attributes':['id','name','online',_0x4805('0x7')]}]},'log':_0x4805('0x0')});};}; \ No newline at end of file +var _0x6fa5=['timeout','strategy','User','faxPause','getFaxQueues','Request','name'];(function(_0x101c78,_0x156f1e){var _0x478ea7=function(_0x1d7c5f){while(--_0x1d7c5f){_0x101c78['push'](_0x101c78['shift']());}};_0x478ea7(++_0x156f1e);}(_0x6fa5,0xb3));var _0x56fa=function(_0x43e312,_0x4cc1dc){_0x43e312=_0x43e312-0x0;var _0x214ae4=_0x6fa5[_0x43e312];return _0x214ae4;};'use strict';var client=require('../client');exports[_0x56fa('0x0')]=function(){return function(){return client[_0x56fa('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x56fa('0x2'),_0x56fa('0x3'),_0x56fa('0x4')],'include':[{'model':_0x56fa('0x5'),'as':'Agents','attributes':['id',_0x56fa('0x2'),'online',_0x56fa('0x6')]}]},'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 6735dd7..18e0da8 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 _0xb9ae=['UpdateFaxQueueReport','../client','create','CreateFaxQueueReport','update','DESC'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xb9ae,0xaf));var _0xeb9a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xb9ae[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0xeb9a('0x0'));exports[_0xeb9a('0x1')]=function(_0x4f246a){return client['Request'](_0xeb9a('0x2'),{'body':_0x4f246a,'log':_0xeb9a('0x2')});};exports[_0xeb9a('0x3')]=function(_0x5d54dd,_0x399d18){return client['Request']('UpdateFaxQueueReport',{'body':_0x399d18,'options':{'where':{'uniqueid':_0x5d54dd},'order':[['id',_0xeb9a('0x4')]],'limit':0x1},'log':_0xeb9a('0x5')});}; \ No newline at end of file +var _0x3c90=['DESC','../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x3c90,0x16d));var _0x03c9=function(_0x4a401e,_0x236199){_0x4a401e=_0x4a401e-0x0;var _0x5a18fd=_0x3c90[_0x4a401e];return _0x5a18fd;};'use strict';var client=require(_0x03c9('0x0'));exports[_0x03c9('0x1')]=function(_0x23f468){return client[_0x03c9('0x2')](_0x03c9('0x3'),{'body':_0x23f468,'log':_0x03c9('0x3')});};exports[_0x03c9('0x4')]=function(_0x52832b,_0xe63860){return client[_0x03c9('0x2')](_0x03c9('0x5'),{'body':_0xe63860,'options':{'where':{'uniqueid':_0x52832b},'order':[['id',_0x03c9('0x6')]],'limit':0x1},'log':_0x03c9('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index ae65968..9992692 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 _0x75f9=['Intervals','interval','../client','getIntervals','Interval'];(function(_0xfb0832,_0x44acaa){var _0x23c2d5=function(_0x580ff9){while(--_0x580ff9){_0xfb0832['push'](_0xfb0832['shift']());}};_0x23c2d5(++_0x44acaa);}(_0x75f9,0x6b));var _0x975f=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x75f9[_0x45783c];return _0x1161da;};'use strict';var client=require(_0x975f('0x0'));exports[_0x975f('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x975f('0x2'),'as':_0x975f('0x3'),'attributes':['id','name',_0x975f('0x4')]}]},'log':_0x975f('0x1')});};}; \ No newline at end of file +var _0xe151=['../client','getIntervals','Request','GetInterval','name','Interval','Intervals','interval'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe151,0xa0));var _0x1e15=function(_0x431cf2,_0x1d4456){_0x431cf2=_0x431cf2-0x0;var _0x10c9a7=_0xe151[_0x431cf2];return _0x10c9a7;};'use strict';var client=require(_0x1e15('0x0'));exports[_0x1e15('0x1')]=function(){return function(){return client[_0x1e15('0x2')](_0x1e15('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x1e15('0x4')],'include':[{'model':_0x1e15('0x5'),'as':_0x1e15('0x6'),'attributes':['id','name',_0x1e15('0x7')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index abd6d9f..c0a093c 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 _0x781d=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x2a702f,_0x377aa7){var _0x52106f=function(_0x45726f){while(--_0x45726f){_0x2a702f['push'](_0x2a702f['shift']());}};_0x52106f(++_0x377aa7);}(_0x781d,0x14a));var _0xd781=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x781d[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0xd781('0x0'));exports[_0xd781('0x1')]=function(_0x596ba2,_0x5c1007){return client[_0xd781('0x2')](_0xd781('0x3'),{'body':_0x5c1007,'options':{'where':{'id':_0x596ba2}},'log':_0xd781('0x4')});};exports[_0xd781('0x5')]=function(_0xfd915d,_0x42258e){return client[_0xd781('0x2')](_0xd781('0x6'),{'body':_0x42258e,'options':{'where':{'id':_0xfd915d}},'log':_0xd781('0x7')});}; \ No newline at end of file +var _0x02ce=['addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x144d6a,_0x10c4c5){var _0x15d824=function(_0x14bb91){while(--_0x14bb91){_0x144d6a['push'](_0x144d6a['shift']());}};_0x15d824(++_0x10c4c5);}(_0x02ce,0x1ac));var _0xe02c=function(_0x45d562,_0x4fc2bf){_0x45d562=_0x45d562-0x0;var _0x3eba16=_0x02ce[_0x45d562];return _0x3eba16;};'use strict';var client=require(_0xe02c('0x0'));exports[_0xe02c('0x1')]=function(_0x3f9bc7,_0x5a49d9){return client[_0xe02c('0x2')]('UpdateMailInteraction',{'body':_0x5a49d9,'options':{'where':{'id':_0x3f9bc7}},'log':_0xe02c('0x3')});};exports[_0xe02c('0x4')]=function(_0x46475c,_0xf4b764){return client[_0xe02c('0x2')](_0xe02c('0x5'),{'body':_0xf4b764,'options':{'where':{'id':_0x46475c}},'log':_0xe02c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index dd0c772..8ba4237 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 _0x88d0=['../client','create','Request','createMailMessage'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0x88d0,0xb4));var _0x088d=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x88d0[_0x2adbeb];return _0x5e18a6;};'use strict';var client=require(_0x088d('0x0'));exports[_0x088d('0x1')]=function(_0x12841c){return client[_0x088d('0x2')]('CreateMailMessage',{'body':_0x12841c,'log':_0x088d('0x3')});}; \ No newline at end of file +var _0xffc8=['createMailMessage','../client','create','Request'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xffc8,0xcd));var _0x8ffc=function(_0x2421e1,_0x2ef188){_0x2421e1=_0x2421e1-0x0;var _0x4a9018=_0xffc8[_0x2421e1];return _0x4a9018;};'use strict';var client=require(_0x8ffc('0x0'));exports[_0x8ffc('0x1')]=function(_0x5874bf){return client[_0x8ffc('0x2')]('CreateMailMessage',{'body':_0x5874bf,'log':_0x8ffc('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 7f9133a..c2cb028 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 _0x2563=['GetMailQueue','name','timeout','User','Agents','online','mailPause','../client','getMailQueues','Request'];(function(_0x38c4a4,_0x17e86d){var _0x4f7505=function(_0x59bfd4){while(--_0x59bfd4){_0x38c4a4['push'](_0x38c4a4['shift']());}};_0x4f7505(++_0x17e86d);}(_0x2563,0x75));var _0x3256=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2563[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x3256('0x0'));exports[_0x3256('0x1')]=function(){return function(){return client[_0x3256('0x2')](_0x3256('0x3'),{'options':{'raw':![],'attributes':['id',_0x3256('0x4'),_0x3256('0x5'),'strategy'],'include':[{'model':_0x3256('0x6'),'as':_0x3256('0x7'),'attributes':['id','name',_0x3256('0x8'),_0x3256('0x9')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0xcd39=['mailPause','getMailQueues','Request','GetMailQueue','timeout','strategy','User','name','online'];(function(_0x3b69e3,_0x40bb88){var _0x1f5b5e=function(_0x4fdd01){while(--_0x4fdd01){_0x3b69e3['push'](_0x3b69e3['shift']());}};_0x1f5b5e(++_0x40bb88);}(_0xcd39,0xfe));var _0x9cd3=function(_0x2c9e61,_0x2d13f5){_0x2c9e61=_0x2c9e61-0x0;var _0x4d55d6=_0xcd39[_0x2c9e61];return _0x4d55d6;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x9cd3('0x0')](_0x9cd3('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x9cd3('0x2'),_0x9cd3('0x3')],'include':[{'model':_0x9cd3('0x4'),'as':'Agents','attributes':['id',_0x9cd3('0x5'),_0x9cd3('0x6'),_0x9cd3('0x7')]}]},'log':_0x9cd3('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index e30755f..51f76e5 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 _0x83b1=['../client','create','Request','CreateMailQueueReport','UpdateMailQueueReport','DESC'];(function(_0x55196e,_0x2d2449){var _0x497676=function(_0x2bf614){while(--_0x2bf614){_0x55196e['push'](_0x55196e['shift']());}};_0x497676(++_0x2d2449);}(_0x83b1,0xcc));var _0x183b=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x83b1[_0x32d457];return _0x338386;};'use strict';var client=require(_0x183b('0x0'));exports[_0x183b('0x1')]=function(_0x1e5f11){return client[_0x183b('0x2')](_0x183b('0x3'),{'body':_0x1e5f11,'log':_0x183b('0x3')});};exports['update']=function(_0x1cfca3,_0x3b135d){return client[_0x183b('0x2')](_0x183b('0x4'),{'body':_0x3b135d,'options':{'where':{'uniqueid':_0x1cfca3},'order':[['id',_0x183b('0x5')]],'limit':0x1},'log':_0x183b('0x4')});}; \ No newline at end of file +var _0x229f=['DESC','UpdateMailQueueReport','create','Request','CreateMailQueueReport'];(function(_0x40b65a,_0x5f4af9){var _0x12924b=function(_0x42fcfe){while(--_0x42fcfe){_0x40b65a['push'](_0x40b65a['shift']());}};_0x12924b(++_0x5f4af9);}(_0x229f,0x11f));var _0xf229=function(_0x113d66,_0x583623){_0x113d66=_0x113d66-0x0;var _0x48ec78=_0x229f[_0x113d66];return _0x48ec78;};'use strict';var client=require('../client');exports[_0xf229('0x0')]=function(_0x3059c5){return client[_0xf229('0x1')](_0xf229('0x2'),{'body':_0x3059c5,'log':_0xf229('0x2')});};exports['update']=function(_0x3c9640,_0x367868){return client['Request']('UpdateMailQueueReport',{'body':_0x367868,'options':{'where':{'uniqueid':_0x3c9640},'order':[['id',_0xf229('0x3')]],'limit':0x1},'log':_0xf229('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 385a83e..c2c4a11 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 _0xab8e=['update','UpdateOpenchannelInteraction','addTags','addTagsToChatInteraction'];(function(_0x21034a,_0x165198){var _0x37043f=function(_0x35b5b7){while(--_0x35b5b7){_0x21034a['push'](_0x21034a['shift']());}};_0x37043f(++_0x165198);}(_0xab8e,0xdc));var _0xeab8=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xab8e[_0x3b380d];return _0x54502b;};'use strict';var client=require('../client');exports[_0xeab8('0x0')]=function(_0x352250,_0x445069){return client['Request'](_0xeab8('0x1'),{'body':_0x445069,'options':{'where':{'id':_0x352250}},'log':'updateOpenchannelInteraction'});};exports[_0xeab8('0x2')]=function(_0x4d5886,_0x3e1fd1){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x3e1fd1,'options':{'where':{'id':_0x4d5886}},'log':_0xeab8('0x3')});}; \ No newline at end of file +var _0x041e=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x145721,_0x37def3){var _0x4ba267=function(_0xf6b971){while(--_0xf6b971){_0x145721['push'](_0x145721['shift']());}};_0x4ba267(++_0x37def3);}(_0x041e,0xd8));var _0xe041=function(_0xddb97e,_0x43cdef){_0xddb97e=_0xddb97e-0x0;var _0x389dda=_0x041e[_0xddb97e];return _0x389dda;};'use strict';var client=require(_0xe041('0x0'));exports[_0xe041('0x1')]=function(_0x55b70e,_0x8f1537){return client[_0xe041('0x2')](_0xe041('0x3'),{'body':_0x8f1537,'options':{'where':{'id':_0x55b70e}},'log':_0xe041('0x4')});};exports[_0xe041('0x5')]=function(_0x40a637,_0x474bda){return client[_0xe041('0x2')](_0xe041('0x6'),{'body':_0x474bda,'options':{'where':{'id':_0x40a637}},'log':_0xe041('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index c71cf41..ea1484b 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 _0xdca1=['create','Request'];(function(_0x2544b1,_0x199624){var _0x4ece47=function(_0x1fe162){while(--_0x1fe162){_0x2544b1['push'](_0x2544b1['shift']());}};_0x4ece47(++_0x199624);}(_0xdca1,0xf0));var _0x1dca=function(_0x3df0f4,_0x5b5701){_0x3df0f4=_0x3df0f4-0x0;var _0x4b7a27=_0xdca1[_0x3df0f4];return _0x4b7a27;};'use strict';var client=require('../client');exports[_0x1dca('0x0')]=function(_0x250a07){return client[_0x1dca('0x1')]('CreateOpenchannelMessage',{'body':_0x250a07,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xad1e=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x550e29,_0x4047f){var _0x3515b6=function(_0x303fe2){while(--_0x303fe2){_0x550e29['push'](_0x550e29['shift']());}};_0x3515b6(++_0x4047f);}(_0xad1e,0x100));var _0xead1=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xad1e[_0x4565bf];return _0x5610ba;};'use strict';var client=require(_0xead1('0x0'));exports[_0xead1('0x1')]=function(_0x394ff2){return client[_0xead1('0x2')](_0xead1('0x3'),{'body':_0x394ff2,'log':_0xead1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index df27c50..54df891 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 _0x8e96=['getOpenchannelQueues','../client','GetOpenchannelQueue','name','strategy','User','online','openchannelPause'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8e96,0x1e9));var _0x68e9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e96[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x68e9('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0x68e9('0x1'),{'options':{'raw':![],'attributes':['id',_0x68e9('0x2'),'timeout',_0x68e9('0x3')],'include':[{'model':_0x68e9('0x4'),'as':'Agents','attributes':['id',_0x68e9('0x2'),_0x68e9('0x5'),_0x68e9('0x6')]}]},'log':_0x68e9('0x7')});};}; \ No newline at end of file +var _0xdf50=['strategy','User','Agents','name','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf50,0x1e1));var _0x0df5=function(_0x343d36,_0x5f248a){_0x343d36=_0x343d36-0x0;var _0x3bd305=_0xdf50[_0x343d36];return _0x3bd305;};'use strict';var client=require(_0x0df5('0x0'));exports[_0x0df5('0x1')]=function(){return function(){return client[_0x0df5('0x2')](_0x0df5('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x0df5('0x4'),_0x0df5('0x5')],'include':[{'model':_0x0df5('0x6'),'as':_0x0df5('0x7'),'attributes':['id',_0x0df5('0x8'),'online','openchannelPause']}]},'log':_0x0df5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index f09dcbe..f9c13dd 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 _0xfa76=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','../client','Request'];(function(_0x14c360,_0x2b649c){var _0x5f5c96=function(_0x4f544c){while(--_0x4f544c){_0x14c360['push'](_0x14c360['shift']());}};_0x5f5c96(++_0x2b649c);}(_0xfa76,0x116));var _0x6fa7=function(_0x23e363,_0x4a8453){_0x23e363=_0x23e363-0x0;var _0x192e82=_0xfa76[_0x23e363];return _0x192e82;};'use strict';var client=require(_0x6fa7('0x0'));exports['create']=function(_0x5457b3){return client[_0x6fa7('0x1')](_0x6fa7('0x2'),{'body':_0x5457b3,'log':_0x6fa7('0x2')});};exports['update']=function(_0x105765,_0x508cdb){return client['Request'](_0x6fa7('0x3'),{'body':_0x508cdb,'options':{'where':{'uniqueid':_0x105765},'order':[['id',_0x6fa7('0x4')]],'limit':0x1},'log':_0x6fa7('0x3')});}; \ No newline at end of file +var _0x4754=['Request','UpdateOpenchannelQueueReport','DESC','CreateOpenchannelQueueReport','update'];(function(_0x5e99ae,_0x37d21f){var _0x286019=function(_0x38b46c){while(--_0x38b46c){_0x5e99ae['push'](_0x5e99ae['shift']());}};_0x286019(++_0x37d21f);}(_0x4754,0x1d4));var _0x4475=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4754[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['create']=function(_0xd135a1){return client['Request'](_0x4475('0x0'),{'body':_0xd135a1,'log':'CreateOpenchannelQueueReport'});};exports[_0x4475('0x1')]=function(_0x5f23cb,_0x2a09d8){return client[_0x4475('0x2')](_0x4475('0x3'),{'body':_0x2a09d8,'options':{'where':{'uniqueid':_0x5f23cb},'order':[['id',_0x4475('0x4')]],'limit':0x1},'log':_0x4475('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 22c9ae4..c12b5db 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 _0x207d=['Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','addTags'];(function(_0x30b762,_0x19bb5f){var _0x4a78af=function(_0x36216e){while(--_0x36216e){_0x30b762['push'](_0x30b762['shift']());}};_0x4a78af(++_0x19bb5f);}(_0x207d,0x10d));var _0xd207=function(_0x561e82,_0x3eaff0){_0x561e82=_0x561e82-0x0;var _0x31a195=_0x207d[_0x561e82];return _0x31a195;};'use strict';var client=require(_0xd207('0x0'));exports[_0xd207('0x1')]=function(_0x302062,_0x27a1dc){return client['Request'](_0xd207('0x2'),{'body':_0x27a1dc,'options':{'where':{'id':_0x302062}},'log':'updateSmsInteraction'});};exports[_0xd207('0x3')]=function(_0x422501,_0x5351ed){return client[_0xd207('0x4')](_0xd207('0x5'),{'body':_0x5351ed,'options':{'where':{'id':_0x422501}},'log':_0xd207('0x6')});}; \ No newline at end of file +var _0x4be6=['addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x4729ea,_0x478433){var _0x2a3aef=function(_0x2d54a8){while(--_0x2d54a8){_0x4729ea['push'](_0x4729ea['shift']());}};_0x2a3aef(++_0x478433);}(_0x4be6,0xb5));var _0x64be=function(_0x47d606,_0x4fa6b6){_0x47d606=_0x47d606-0x0;var _0x1520be=_0x4be6[_0x47d606];return _0x1520be;};'use strict';var client=require('../client');exports[_0x64be('0x0')]=function(_0x326bcd,_0x22ef48){return client[_0x64be('0x1')](_0x64be('0x2'),{'body':_0x22ef48,'options':{'where':{'id':_0x326bcd}},'log':_0x64be('0x3')});};exports[_0x64be('0x4')]=function(_0x85d7a2,_0x217ce6){return client[_0x64be('0x1')]('AddTagsToSmsInteraction',{'body':_0x217ce6,'options':{'where':{'id':_0x85d7a2}},'log':_0x64be('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index a51d465..4672dd0 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 _0xc8b3=['CreateSmsMessage','createSmsMessage','../client','create'];(function(_0xd89560,_0xb229f){var _0x26563d=function(_0x8c8c91){while(--_0x8c8c91){_0xd89560['push'](_0xd89560['shift']());}};_0x26563d(++_0xb229f);}(_0xc8b3,0xfe));var _0x3c8b=function(_0x49048c,_0x17697d){_0x49048c=_0x49048c-0x0;var _0x615ce0=_0xc8b3[_0x49048c];return _0x615ce0;};'use strict';var client=require(_0x3c8b('0x0'));exports[_0x3c8b('0x1')]=function(_0x3986a7){return client['Request'](_0x3c8b('0x2'),{'body':_0x3986a7,'log':_0x3c8b('0x3')});}; \ No newline at end of file +var _0x2132=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x4eda8d,_0x4203b2){var _0x39f5fc=function(_0x37d942){while(--_0x37d942){_0x4eda8d['push'](_0x4eda8d['shift']());}};_0x39f5fc(++_0x4203b2);}(_0x2132,0xcb));var _0x2213=function(_0x273500,_0x5042d1){_0x273500=_0x273500-0x0;var _0xdb1722=_0x2132[_0x273500];return _0xdb1722;};'use strict';var client=require(_0x2213('0x0'));exports[_0x2213('0x1')]=function(_0xdc3932){return client[_0x2213('0x2')](_0x2213('0x3'),{'body':_0xdc3932,'log':_0x2213('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index c409cd7..5873933 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x45a7a6,_0x380289){var _0x514f51=function(_0x366e28){while(--_0x366e28){_0x45a7a6['push'](_0x45a7a6['shift']());}};_0x514f51(++_0x380289);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x34efb4,_0x39f217){var _0x27a0c5=function(_0x2eab6c){while(--_0x2eab6c){_0x34efb4['push'](_0x34efb4['shift']());}};_0x27a0c5(++_0x39f217);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index f51ef1a..7c66890 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x5f2877,_0x54b6e2){var _0x386165=function(_0x499bd9){while(--_0x499bd9){_0x5f2877['push'](_0x5f2877['shift']());}};_0x386165(++_0x54b6e2);}(_0x70e0,0x17b));var _0x070e=function(_0x2f56bf,_0x2beca9){_0x2f56bf=_0x2f56bf-0x0;var _0x48f9e2=_0x70e0[_0x2f56bf];return _0x48f9e2;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xedd9,0xfc));var _0x9edd=function(_0x1f2c29,_0x8c66e0){_0x1f2c29=_0x1f2c29-0x0;var _0x8977ab=_0xedd9[_0x1f2c29];return _0x8977ab;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 1e88e3f..5213a57 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(_0x1b1935,_0x25e076){var _0x3663b1=function(_0x37aa1b){while(--_0x37aa1b){_0x1b1935['push'](_0x1b1935['shift']());}};_0x3663b1(++_0x25e076);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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(_0x3ef5d8,_0x34f29d){var _0x1f4656=function(_0x9a8c47){while(--_0x9a8c47){_0x3ef5d8['push'](_0x3ef5d8['shift']());}};_0x1f4656(++_0x34f29d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 b3cfed9..547d5b9 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 _0x8ad5=['AddTagsToWhatsappInteraction','../client','update','updateWhatsappInteraction','addTags','Request'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8ad5,0xf1));var _0x58ad=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8ad5[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x58ad('0x0'));exports[_0x58ad('0x1')]=function(_0x114e73,_0x263210){return client['Request']('UpdateWhatsappInteraction',{'body':_0x263210,'options':{'where':{'id':_0x114e73}},'log':_0x58ad('0x2')});};exports[_0x58ad('0x3')]=function(_0x223e54,_0x22aba9){return client[_0x58ad('0x4')](_0x58ad('0x5'),{'body':_0x22aba9,'options':{'where':{'id':_0x223e54}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x0e76=['updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction'];(function(_0x3a2389,_0x6b895c){var _0x27564a=function(_0x247043){while(--_0x247043){_0x3a2389['push'](_0x3a2389['shift']());}};_0x27564a(++_0x6b895c);}(_0x0e76,0xc4));var _0x60e7=function(_0x1a79c6,_0x5bad0b){_0x1a79c6=_0x1a79c6-0x0;var _0x301647=_0x0e76[_0x1a79c6];return _0x301647;};'use strict';var client=require(_0x60e7('0x0'));exports['update']=function(_0x4f9548,_0x259dcb){return client['Request'](_0x60e7('0x1'),{'body':_0x259dcb,'options':{'where':{'id':_0x4f9548}},'log':_0x60e7('0x2')});};exports[_0x60e7('0x3')]=function(_0xd3886,_0x2f1ad1){return client['Request'](_0x60e7('0x4'),{'body':_0x2f1ad1,'options':{'where':{'id':_0xd3886}},'log':_0x60e7('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index cbc342d..a7131eb 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 _0x126c=['createWhatsappMessage','create','Request','CreateWhatsappMessage'];(function(_0x5995bc,_0x5cd10e){var _0x1ac533=function(_0x59fd83){while(--_0x59fd83){_0x5995bc['push'](_0x5995bc['shift']());}};_0x1ac533(++_0x5cd10e);}(_0x126c,0x14d));var _0xc126=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x126c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xc126('0x0')]=function(_0x33f03a){return client[_0xc126('0x1')](_0xc126('0x2'),{'body':_0x33f03a,'log':_0xc126('0x3')});}; \ No newline at end of file +var _0x661b=['Request','../client','create'];(function(_0x475191,_0x5bce86){var _0x189e96=function(_0x46d6a2){while(--_0x46d6a2){_0x475191['push'](_0x475191['shift']());}};_0x189e96(++_0x5bce86);}(_0x661b,0xbb));var _0xb661=function(_0x5cb2a5,_0x52daad){_0x5cb2a5=_0x5cb2a5-0x0;var _0x5cfa50=_0x661b[_0x5cb2a5];return _0x5cfa50;};'use strict';var client=require(_0xb661('0x0'));exports[_0xb661('0x1')]=function(_0x3239c0){return client[_0xb661('0x2')]('CreateWhatsappMessage',{'body':_0x3239c0,'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 d8113e4..52efe39 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 _0x2c9c=['User','Agents','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','strategy'];(function(_0x3d351d,_0x4eac13){var _0x1fb813=function(_0x41ce5b){while(--_0x41ce5b){_0x3d351d['push'](_0x3d351d['shift']());}};_0x1fb813(++_0x4eac13);}(_0x2c9c,0x9c));var _0xc2c9=function(_0x2d1371,_0x43aef7){_0x2d1371=_0x2d1371-0x0;var _0xf17680=_0x2c9c[_0x2d1371];return _0xf17680;};'use strict';var client=require(_0xc2c9('0x0'));exports[_0xc2c9('0x1')]=function(){return function(){return client[_0xc2c9('0x2')](_0xc2c9('0x3'),{'options':{'raw':![],'attributes':['id',_0xc2c9('0x4'),'timeout',_0xc2c9('0x5')],'include':[{'model':_0xc2c9('0x6'),'as':_0xc2c9('0x7'),'attributes':['id',_0xc2c9('0x4'),'online',_0xc2c9('0x8')]}]},'log':_0xc2c9('0x1')});};}; \ No newline at end of file +var _0x6c91=['GetWhatsappQueue','name','timeout','online','whatsappPause','../client','getWhatsappQueues','Request'];(function(_0x368f76,_0x136ee8){var _0x86935e=function(_0x222e96){while(--_0x222e96){_0x368f76['push'](_0x368f76['shift']());}};_0x86935e(++_0x136ee8);}(_0x6c91,0x1c5));var _0x16c9=function(_0x5660d5,_0x235c27){_0x5660d5=_0x5660d5-0x0;var _0x2a144d=_0x6c91[_0x5660d5];return _0x2a144d;};'use strict';var client=require(_0x16c9('0x0'));exports[_0x16c9('0x1')]=function(){return function(){return client[_0x16c9('0x2')](_0x16c9('0x3'),{'options':{'raw':![],'attributes':['id',_0x16c9('0x4'),_0x16c9('0x5'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x16c9('0x4'),_0x16c9('0x6'),_0x16c9('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 97901ec..004382f 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 _0xb8c8=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x1440ce,_0x136aee){var _0x389c35=function(_0x73dfaf){while(--_0x73dfaf){_0x1440ce['push'](_0x1440ce['shift']());}};_0x389c35(++_0x136aee);}(_0xb8c8,0x114));var _0x8b8c=function(_0x457d4f,_0xe38c40){_0x457d4f=_0x457d4f-0x0;var _0x207256=_0xb8c8[_0x457d4f];return _0x207256;};'use strict';var client=require(_0x8b8c('0x0'));exports[_0x8b8c('0x1')]=function(_0x12cb64){return client[_0x8b8c('0x2')](_0x8b8c('0x3'),{'body':_0x12cb64,'log':_0x8b8c('0x3')});};exports[_0x8b8c('0x4')]=function(_0x45a25c,_0x2639a7){return client[_0x8b8c('0x2')](_0x8b8c('0x5'),{'body':_0x2639a7,'options':{'where':{'uniqueid':_0x45a25c},'order':[['id',_0x8b8c('0x6')]],'limit':0x1},'log':_0x8b8c('0x5')});}; \ No newline at end of file +var _0x1c7f=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x1c7f,0x13d));var _0xf1c7=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x1c7f[_0x12d033];return _0x3b4e80;};'use strict';var client=require(_0xf1c7('0x0'));exports['create']=function(_0x53ab20){return client[_0xf1c7('0x1')](_0xf1c7('0x2'),{'body':_0x53ab20,'log':_0xf1c7('0x2')});};exports[_0xf1c7('0x3')]=function(_0x9a72e,_0xa41c7f){return client[_0xf1c7('0x1')](_0xf1c7('0x4'),{'body':_0xa41c7f,'options':{'where':{'uniqueid':_0x9a72e},'order':[['id',_0xf1c7('0x5')]],'limit':0x1},'log':_0xf1c7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 569eb93..a49141a 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 _0x28ab=['[%s][AGENT]\x20%s','map','message','join','find','agents','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','complete','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','error'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x28ab,0x1c5));var _0xb28a=function(_0x4d98b9,_0x4317db){_0x4d98b9=_0x4d98b9-0x0;var _0xfdacce=_0x28ab[_0x4d98b9];return _0xfdacce;};'use strict';var schema=require(_0xb28a('0x0'));var _=require(_0xb28a('0x1'));var util=require(_0xb28a('0x2'));var seqqueue=require(_0xb28a('0x3'));var logger=require(_0xb28a('0x4'))(_0xb28a('0x5'));var strategy=require(_0xb28a('0x6'));var queue=schema({'name':{'type':_0xb28a('0x7'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xb28a('0x8'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x16c814,_0x2bd840,_0x299507){return logger[_0xb28a('0x9')](util[_0xb28a('0xa')](_0xb28a('0xb'),_0x16c814,_0x2bd840[_0xb28a('0xc')],_0x299507));}function handleFindAgent(_0x2f36f9){return function(_0x1f9a80){return _0x1f9a80[_0xb28a('0xc')][_0xb28a('0xd')]()===_0x2f36f9[_0xb28a('0xd')]();};}exports['consequence']=function(_0xfebdcd,_0x4b6686,_0x49a805,_0x199451){return function(_0x4e3a00){try{var _0x346dc7={'name':_0x4b6686[0x0],'timeout':_0x4b6686[0x1]};var _0x306873=queue[_0xb28a('0x0')](_0x346dc7,{'typecast':!![]});if(_0x306873['length']){logger[_0xb28a('0xe')](_0xb28a('0xf'),_0xfebdcd,_[_0xb28a('0x10')](_0x306873,_0xb28a('0x11'))[_0xb28a('0x12')](',\x20'));_0x4e3a00['stop']();}else{var _0x1af4e0=_[_0xb28a('0x13')](_0x49a805[_0xb28a('0x14')],handleFindAgent(_0x346dc7[_0xb28a('0xc')]));if(_0x1af4e0){var _0x517c10=(_0x346dc7['timeout']||0xa)*0x3e8;var _0x52bf08,_0x158454;var _0x31f4a2=seqqueue['createQueue'](_0x517c10);_0x31f4a2['id']=_0xfebdcd;_0x31f4a2[_0xb28a('0x15')]=_0x517c10;_0x31f4a2[_0xb28a('0x16')]=_0x199451[_0xb28a('0x16')];writeLog(_0xfebdcd,_0x1af4e0,util[_0xb28a('0xa')](_0xb28a('0x17'),_0x517c10));_0x49a805[_0xb28a('0x18')][_0xfebdcd]['on'](_0xb28a('0x19'),function(){logger[_0xb28a('0x9')](_0xb28a('0x1a'),_0xfebdcd);clearTimeout(_0x158454);_0x158454=undefined;_0x31f4a2['close']();if(_0x49a805[_0xb28a('0x18')][_0xfebdcd]){delete _0x49a805['rules'][_0xfebdcd];}_0x4e3a00[_0xb28a('0x1b')]();});_0x49a805[_0xb28a('0x18')][_0xfebdcd]['on'](_0xb28a('0x1c'),function(){if(_0x49a805[_0xb28a('0x18')][_0xfebdcd]){delete _0x49a805[_0xb28a('0x18')][_0xfebdcd];}});_0x158454=setTimeout(function(){logger[_0xb28a('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0xfebdcd);clearTimeout(_0x158454);_0x31f4a2[_0xb28a('0x1d')]();_0x4e3a00[_0xb28a('0x1e')]();},_0x517c10);strategy[_0xb28a('0x1f')](_0x31f4a2,_0x1af4e0,_0x49a805,_0x199451);}else{logger[_0xb28a('0xe')](_0xb28a('0x20'),_0xfebdcd,_0x346dc7['name']);_0x4e3a00['stop']();}}}catch(_0x13b1d6){console[_0xb28a('0x21')](_0x13b1d6);logger[_0xb28a('0xe')](_0xb28a('0x22'),_0xfebdcd,_0x13b1d6[_0xb28a('0x23')]);_0x4e3a00[_0xb28a('0x1b')]();}};}; \ No newline at end of file +var _0xfcd2=['[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','join','find','agents','timeout','createQueue','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','util','../../../../config/logger','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xfcd2,0x1d8));var _0x2fcd=function(_0xe93e0c,_0x5eb8d2){_0xe93e0c=_0xe93e0c-0x0;var _0x4a6d52=_0xfcd2[_0xe93e0c];return _0x4a6d52;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x2fcd('0x0'));var seqqueue=require('seq-queue');var logger=require(_0x2fcd('0x1'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0x2fcd('0x2'),'required':!![],'message':_0x2fcd('0x3')},'timeout':{'type':_0x2fcd('0x4'),'message':_0x2fcd('0x5')}});function writeLog(_0x26e6f9,_0x56e19e,_0x372b52){return logger[_0x2fcd('0x6')](util[_0x2fcd('0x7')](_0x2fcd('0x8'),_0x26e6f9,_0x56e19e[_0x2fcd('0x9')],_0x372b52));}function handleFindAgent(_0x16daf3){return function(_0x3c9e28){return _0x3c9e28[_0x2fcd('0x9')][_0x2fcd('0xa')]()===_0x16daf3['toLowerCase']();};}exports['consequence']=function(_0x5bb7d6,_0x402667,_0x826315,_0x399326){return function(_0x1bf93d){try{var _0x4794a2={'name':_0x402667[0x0],'timeout':_0x402667[0x1]};var _0x38458c=queue['validate'](_0x4794a2,{'typecast':!![]});if(_0x38458c[_0x2fcd('0xb')]){logger[_0x2fcd('0xc')](_0x2fcd('0xd'),_0x5bb7d6,_[_0x2fcd('0xe')](_0x38458c,_0x2fcd('0xf'))[_0x2fcd('0x10')](',\x20'));_0x1bf93d['stop']();}else{var _0x2fdcc6=_[_0x2fcd('0x11')](_0x826315[_0x2fcd('0x12')],handleFindAgent(_0x4794a2[_0x2fcd('0x9')]));if(_0x2fdcc6){var _0x2dc214=(_0x4794a2[_0x2fcd('0x13')]||0xa)*0x3e8;var _0x42916e,_0x4e581d;var _0x52b56c=seqqueue[_0x2fcd('0x14')](_0x2dc214);_0x52b56c['id']=_0x5bb7d6;_0x52b56c['atimeout']=_0x2dc214;_0x52b56c[_0x2fcd('0x15')]=_0x399326[_0x2fcd('0x15')];writeLog(_0x5bb7d6,_0x2fdcc6,util[_0x2fcd('0x7')](_0x2fcd('0x16'),_0x2dc214));_0x826315[_0x2fcd('0x17')][_0x5bb7d6]['on']('end',function(){logger['info'](_0x2fcd('0x18'),_0x5bb7d6);clearTimeout(_0x4e581d);_0x4e581d=undefined;_0x52b56c[_0x2fcd('0x19')]();if(_0x826315['rules'][_0x5bb7d6]){delete _0x826315[_0x2fcd('0x17')][_0x5bb7d6];}_0x1bf93d[_0x2fcd('0x1a')]();});_0x826315[_0x2fcd('0x17')][_0x5bb7d6]['on']('complete',function(){if(_0x826315[_0x2fcd('0x17')][_0x5bb7d6]){delete _0x826315[_0x2fcd('0x17')][_0x5bb7d6];}});_0x4e581d=setTimeout(function(){logger[_0x2fcd('0x6')](_0x2fcd('0x1b'),_0x5bb7d6);clearTimeout(_0x4e581d);_0x52b56c[_0x2fcd('0x19')]();_0x1bf93d[_0x2fcd('0x1c')]();},_0x2dc214);strategy[_0x2fcd('0x1d')](_0x52b56c,_0x2fdcc6,_0x826315,_0x399326);}else{logger['error'](_0x2fcd('0x1e'),_0x5bb7d6,_0x4794a2['name']);_0x1bf93d[_0x2fcd('0x1a')]();}}}catch(_0xc22011){console['log'](_0xc22011);logger[_0x2fcd('0xc')](_0x2fcd('0x1f'),_0x5bb7d6,_0xc22011['stack']);_0x1bf93d[_0x2fcd('0x1a')]();}};}; \ 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 5cec9f9..55157c4 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 _0xe83d=['LexRuntime','message','toString','amazonlex','lodash','moment','aws-sdk','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','body','getMustacheRender','Message','create','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe83d,0x164));var _0xde83=function(_0x3af1e0,_0x52ea52){_0x3af1e0=_0x3af1e0-0x0;var _0x43b865=_0xe83d[_0x3af1e0];return _0x43b865;};'use strict';var _=require(_0xde83('0x0'));var moment=require(_0xde83('0x1'));var AWS=require(_0xde83('0x2'));var utils=require(_0xde83('0x3'));var logger=require('../../../../config/logger')(_0xde83('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xde83('0x5')),'mailMessage':require(_0xde83('0x6')),'smsMessage':require(_0xde83('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xde83('0x8'))};exports[_0xde83('0x9')]=function(_0x5f1d3f,_0x36ae16){return function(_0x228848){try{if(!_[_0xde83('0xa')](this['interaction']['UserId'])){logger[_0xde83('0xb')](_0xde83('0xc'),_0x5f1d3f,_0xde83('0xd'));return _0x228848[_0xde83('0xe')]();}var _0x55f0aa={'ContactId':this[_0xde83('0xf')]['id'],'sentAt':moment()[_0xde83('0x10')](_0xde83('0x11')),'direction':_0xde83('0x12')};if(this[_0xde83('0x13')]==='sms'||this[_0xde83('0x13')]===_0xde83('0x14')){_0x55f0aa['phone']=this['interaction'][_0xde83('0x15')];}var _0x9aa55f=this[_0xde83('0x13')];if(_0x9aa55f==='chat'){_0x55f0aa[_0xde83('0x16')]=this[_0xde83('0x17')]['id'];}else{_0x55f0aa[_[_0xde83('0x18')](_0x9aa55f)+_0xde83('0x19')]=this['account']['id'];}_0x55f0aa[_['upperFirst'](_0x9aa55f)+_0xde83('0x1a')]=this[_0xde83('0x1b')]['id'];if(this[_0xde83('0x1b')][_0xde83('0x1c')]){var _0x4c3a48=_0x36ae16[0x4];if(!_[_0xde83('0x1d')](_0x4c3a48)){_0x55f0aa[_0xde83('0x1e')]=utils[_0xde83('0x1f')](_0x4c3a48,this);return rpc[_0x9aa55f+_0xde83('0x20')][_0xde83('0x21')](_0x55f0aa)['then'](function(_0x4a248e){logger[_0xde83('0xb')](_0xde83('0xc'),_0x5f1d3f,_0x55f0aa[_0xde83('0x1e')]);})[_0xde83('0x22')](function(_0x8401f4){logger[_0xde83('0x23')](_0xde83('0xc'),_0x5f1d3f,JSON[_0xde83('0x24')](_0x8401f4));})[_0xde83('0x25')](function(){logger['info'](_0xde83('0x26'),_0x5f1d3f);_0x228848[_0xde83('0x27')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5f1d3f);_0x228848[_0xde83('0x27')]();}}else{var _0x70fb1a=this;var _0x4bc68c=new AWS[(_0xde83('0x28'))]({'accessKeyId':_0x36ae16[0x0],'secretAccessKey':_0x36ae16[0x1],'region':_0x36ae16[0x2]});var _0x3ffef3={'botAlias':'$LATEST','botName':_0x36ae16[0x3],'inputText':this[_0xde83('0x29')][_0xde83('0x1e')],'userId':this[_0xde83('0x13')]+':'+this[_0xde83('0x1b')]['id'][_0xde83('0x2a')]()};_0x4bc68c['postText'](_0x3ffef3,function(_0x4ec30e,_0x55c427){if(_0x4ec30e){logger[_0xde83('0x23')]('[%s][AMAZONLEX]\x20%s',_0x5f1d3f,_0x4ec30e[_0xde83('0x29')]);_0x228848[_0xde83('0xe')]();}else if(_0x55c427&&_0x55c427[_0xde83('0x29')]){_0x70fb1a[_0xde83('0x1e')]['amazonlex']=_0x55c427;_0x55f0aa[_0xde83('0x1e')]=_0x55c427[_0xde83('0x29')];_0x55f0aa['providerName']=_0xde83('0x2b');_0x55f0aa['providerResponse']=JSON[_0xde83('0x24')](_0x55c427);return rpc[_0x9aa55f+_0xde83('0x20')]['create'](_0x55f0aa)['then'](function(_0x4cc71a){logger['info']('[%s][AMAZONLEX]\x20%s',_0x5f1d3f,_0x55f0aa[_0xde83('0x1e')]);if(_0x55c427['dialogState']=='Failed'){_0x228848['next']();}else{_0x228848[_0xde83('0x27')]();}})['catch'](function(_0x40e8ec){logger[_0xde83('0x23')]('[%s][AMAZONLEX]\x20%s',_0x5f1d3f,JSON[_0xde83('0x24')](_0x40e8ec));_0x228848[_0xde83('0xe')]();});}else{_0x228848[_0xde83('0xe')]();}});}}catch(_0x1bb08d){logger['error']('[%s][AMAZONLEX]\x20%s',_0x5f1d3f,JSON['stringify'](_0x1bb08d));_0x228848['stop']();}};}; \ No newline at end of file +var _0x066a=['channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','[%s][AMAZONLEX]\x20%s','catch','stringify','finally','stop','$LATEST','message','toString','postText','error','next','providerName','amazonlex','providerResponse','Failed','lodash','moment','aws-sdk','./utils','../../../../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.','format','YYYY-MM-DD\x20HH:mm:ss','out','sms'];(function(_0x1967b8,_0x2ce618){var _0xeacbb7=function(_0x4e5c73){while(--_0x4e5c73){_0x1967b8['push'](_0x1967b8['shift']());}};_0xeacbb7(++_0x2ce618);}(_0x066a,0x1e8));var _0xa066=function(_0x5dd3c3,_0x222299){_0x5dd3c3=_0x5dd3c3-0x0;var _0x50384a=_0x066a[_0x5dd3c3];return _0x50384a;};'use strict';var _=require(_0xa066('0x0'));var moment=require(_0xa066('0x1'));var AWS=require(_0xa066('0x2'));var utils=require(_0xa066('0x3'));var logger=require(_0xa066('0x4'))(_0xa066('0x5'));var rpc={'chatMessage':require(_0xa066('0x6')),'openchannelMessage':require(_0xa066('0x7')),'mailMessage':require(_0xa066('0x8')),'smsMessage':require(_0xa066('0x9')),'faxMessage':require(_0xa066('0xa')),'whatsappMessage':require(_0xa066('0xb'))};exports[_0xa066('0xc')]=function(_0x504139,_0x1539b5){return function(_0x304282){try{if(!_[_0xa066('0xd')](this[_0xa066('0xe')][_0xa066('0xf')])){logger[_0xa066('0x10')]('[%s][AMAZONLEX]\x20%s',_0x504139,_0xa066('0x11'));return _0x304282['next']();}var _0x15aa01={'ContactId':this['contact']['id'],'sentAt':moment()[_0xa066('0x12')](_0xa066('0x13')),'direction':_0xa066('0x14')};if(this['channel']===_0xa066('0x15')||this[_0xa066('0x16')]===_0xa066('0x17')){_0x15aa01[_0xa066('0x18')]=this['interaction']['phone'];}var _0x123648=this[_0xa066('0x16')];if(_0x123648===_0xa066('0x19')){_0x15aa01['ChatWebsiteId']=this[_0xa066('0x1a')]['id'];}else{_0x15aa01[_[_0xa066('0x1b')](_0x123648)+_0xa066('0x1c')]=this[_0xa066('0x1a')]['id'];}_0x15aa01[_[_0xa066('0x1b')](_0x123648)+_0xa066('0x1d')]=this[_0xa066('0xe')]['id'];if(this[_0xa066('0xe')][_0xa066('0x1e')]){var _0x5b3d74=_0x1539b5[0x4];if(!_[_0xa066('0x1f')](_0x5b3d74)){_0x15aa01[_0xa066('0x20')]=utils[_0xa066('0x21')](_0x5b3d74,this);return rpc[_0x123648+_0xa066('0x22')]['create'](_0x15aa01)[_0xa066('0x23')](function(_0x38ac2c){logger[_0xa066('0x10')](_0xa066('0x24'),_0x504139,_0x15aa01['body']);})[_0xa066('0x25')](function(_0x1f5b02){logger['error'](_0xa066('0x24'),_0x504139,JSON[_0xa066('0x26')](_0x1f5b02));})[_0xa066('0x27')](function(){logger[_0xa066('0x10')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x504139);_0x304282[_0xa066('0x28')]();});}else{logger[_0xa066('0x10')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x504139);_0x304282[_0xa066('0x28')]();}}else{var _0x24653c=this;var _0x52e9cd=new AWS['LexRuntime']({'accessKeyId':_0x1539b5[0x0],'secretAccessKey':_0x1539b5[0x1],'region':_0x1539b5[0x2]});var _0x58520d={'botAlias':_0xa066('0x29'),'botName':_0x1539b5[0x3],'inputText':this[_0xa066('0x2a')][_0xa066('0x20')],'userId':this[_0xa066('0x16')]+':'+this[_0xa066('0xe')]['id'][_0xa066('0x2b')]()};_0x52e9cd[_0xa066('0x2c')](_0x58520d,function(_0x11280c,_0x3fa618){if(_0x11280c){logger[_0xa066('0x2d')](_0xa066('0x24'),_0x504139,_0x11280c[_0xa066('0x2a')]);_0x304282[_0xa066('0x2e')]();}else if(_0x3fa618&&_0x3fa618[_0xa066('0x2a')]){_0x24653c[_0xa066('0x20')]['amazonlex']=_0x3fa618;_0x15aa01[_0xa066('0x20')]=_0x3fa618[_0xa066('0x2a')];_0x15aa01[_0xa066('0x2f')]=_0xa066('0x30');_0x15aa01[_0xa066('0x31')]=JSON['stringify'](_0x3fa618);return rpc[_0x123648+_0xa066('0x22')]['create'](_0x15aa01)[_0xa066('0x23')](function(_0x414245){logger[_0xa066('0x10')](_0xa066('0x24'),_0x504139,_0x15aa01[_0xa066('0x20')]);if(_0x3fa618['dialogState']==_0xa066('0x32')){_0x304282['next']();}else{_0x304282[_0xa066('0x28')]();}})[_0xa066('0x25')](function(_0x25b0b4){logger['error'](_0xa066('0x24'),_0x504139,JSON[_0xa066('0x26')](_0x25b0b4));_0x304282[_0xa066('0x2e')]();});}else{_0x304282[_0xa066('0x2e')]();}});}}catch(_0x53d6af){logger[_0xa066('0x2d')](_0xa066('0x24'),_0x504139,JSON[_0xa066('0x26')](_0x53d6af));_0x304282[_0xa066('0x28')]();}};}; \ 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 ff75788..c3de610 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 _0xbc21=['One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','inReplyTo','messageId','html','','replace','','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','catch','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s'];(function(_0x486e01,_0x77be4e){var _0xabce2e=function(_0x33c99b){while(--_0x33c99b){_0x486e01['push'](_0x486e01['shift']());}};_0xabce2e(++_0x77be4e);}(_0xbc21,0x137));var _0x1bc2=function(_0x37ca55,_0x392624){_0x37ca55=_0x37ca55-0x0;var _0x4f4d8a=_0xbc21[_0x37ca55];return _0x4f4d8a;};'use strict';var _=require(_0x1bc2('0x0'));var moment=require(_0x1bc2('0x1'));var utils=require(_0x1bc2('0x2'));var logger=require('../../../../config/logger')(_0x1bc2('0x3'));var rpc={'chatMessage':require(_0x1bc2('0x4')),'openchannelMessage':require(_0x1bc2('0x5')),'mailMessage':require(_0x1bc2('0x6')),'smsMessage':require(_0x1bc2('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x1bc2('0x8')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x1bc2('0x9')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x1bc2('0xa')),'faxInteraction':require(_0x1bc2('0xb')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x1bc2('0xc'));exports[_0x1bc2('0xd')]=function(_0x3ae28a,_0x47ffaf,_0x527822,_0x28e688){return function(_0x19f4cb){try{var _0xc01960=this['channel'];if(_0xc01960==='mail'&&_0x28e688['body']['isAutoreply']){logger[_0x1bc2('0xe')](_0x1bc2('0xf'),_0x3ae28a,_0x1bc2('0x10'));return _0x19f4cb[_0x1bc2('0x11')]();}if(_0x47ffaf[0x0]==='1'&&(_[_0x1bc2('0x12')](this[_0x1bc2('0x13')]['created'])||!this[_0x1bc2('0x13')][_0x1bc2('0x14')])){logger[_0x1bc2('0xe')](_0x1bc2('0xf'),_0x3ae28a,_0x1bc2('0x15'));return _0x19f4cb[_0x1bc2('0x11')]();}if(_0x47ffaf[0x0]==='2'&&this[_0x1bc2('0x13')][_0x1bc2('0x16')]){logger[_0x1bc2('0xe')](_0x1bc2('0x17'),_0x3ae28a,_0x1bc2('0x18'));return _0x19f4cb[_0x1bc2('0x11')]();}var _0x428c2d={'ContactId':this['contact']['id'],'sentAt':moment()[_0x1bc2('0x19')](_0x1bc2('0x1a')),'direction':_0x1bc2('0x1b')};if(this[_0x1bc2('0x1c')]==='mail'){_0x428c2d[_0x1bc2('0x1d')]=utils[_0x1bc2('0x1e')](_0x47ffaf[0x2],this);}else{_0x428c2d[_0x1bc2('0x1d')]=utils[_0x1bc2('0x1e')](_0x47ffaf[0x1],this);}if(this[_0x1bc2('0x1f')]){_0x428c2d['to']=this[_0x1bc2('0x1f')][_0x1bc2('0x20')]||'';if(this[_0x1bc2('0x1c')]==='mail'&&_0x47ffaf[0x1]==='1'){_0x428c2d['cc']=this[_0x1bc2('0x1f')]['cc']||'';}_0x428c2d[_0x1bc2('0x20')]=this['message']['to']||'';_0x428c2d['phone']=this['message'][_0x1bc2('0x21')]||'';_0x428c2d[_0x1bc2('0x22')]=!![];if(this['message'][_0x1bc2('0x23')]){_0x428c2d[_0x1bc2('0x23')]='';_0x428c2d[_0x1bc2('0x23')]+=_[_0x1bc2('0x24')](this[_0x1bc2('0x1f')]['subject'],_0x1bc2('0x25'))?'':_0x1bc2('0x26');_0x428c2d[_0x1bc2('0x23')]+=this[_0x1bc2('0x1f')][_0x1bc2('0x23')];}}if(this[_0x1bc2('0x1c')]===_0x1bc2('0x27')){_0x428c2d[_0x1bc2('0x28')]=this[_0x1bc2('0x29')]['id'];}else{_0x428c2d[_[_0x1bc2('0x2a')](this[_0x1bc2('0x1c')])+_0x1bc2('0x2b')]=this[_0x1bc2('0x29')]['id'];}_0x428c2d[_[_0x1bc2('0x2a')](this[_0x1bc2('0x1c')])+'InteractionId']=this[_0x1bc2('0x13')]['id'];var _0x56360e=this[_0x1bc2('0x13')];if(rpc[this[_0x1bc2('0x1c')]+_0x1bc2('0x2c')]){if(this[_0x1bc2('0x1c')]==='mail'){_0x428c2d[_0x1bc2('0x2d')]=this[_0x1bc2('0x1f')][_0x1bc2('0x2e')];_0x428c2d[_0x1bc2('0x2f')]=_0x1bc2('0x30')+_[_0x1bc2('0x31')](_0x428c2d[_0x1bc2('0x1d')],'','replace','';_0x5d9828[_0xebc1('0x35')]={'Auto-Submitted':_0xebc1('0x36'),'X-Auto-Response-Suppress':'All','Precedence':'auto_reply'};return mailRpc[_0xebc1('0x37')](this['account'][_0xebc1('0x38')],_0x5d9828)['then'](function(_0x2f6539){logger[_0xebc1('0x12')](_0xebc1('0x39'),_0x4b77aa);_0x5d9828[_0xebc1('0x30')]=_0x2f6539['message']['messageId'];return rpc[_0x4d7391+'Message'][_0xebc1('0x3a')](_0x5d9828);})['then'](function(_0x40a3f5){logger[_0xebc1('0x12')](_0xebc1('0x13'),_0x4b77aa,JSON['stringify'](_0x40a3f5));})[_0xebc1('0x3b')](function(_0x1d41fa){logger['error'](_0xebc1('0x3c'),_0x4b77aa,JSON['stringify'](_0x1d41fa));})[_0xebc1('0x3d')](function(){Promise[_0xebc1('0x3e')]()[_0xebc1('0x3f')](function(){if(_0x463468[0x0]!=='2'||_0x147a03['autoreplyExecuted'])return;return rpc[_0x4d7391+_0xebc1('0x40')][_0xebc1('0x41')](_0x147a03['id'],{'autoreplyExecuted':!![]})[_0xebc1('0x3f')](function(_0x5c8a6f){logger[_0xebc1('0x12')](_0xebc1('0x1a'),_0x4b77aa,JSON[_0xebc1('0x42')](_0x5c8a6f));})[_0xebc1('0x3b')](function(_0x39d63f){logger[_0xebc1('0x43')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4b77aa,JSON[_0xebc1('0x42')](_0x39d63f));});})[_0xebc1('0x3f')](function(){_0x465282[_0xebc1('0x14')]();});});}else{return rpc[this[_0xebc1('0xe')]+'Message']['create'](_0x5d9828)[_0xebc1('0x3f')](function(){logger[_0xebc1('0x12')]('[%s][AUTOREPLY]\x20%s',_0x4b77aa,_0x5d9828[_0xebc1('0x10')]);})[_0xebc1('0x3b')](function(_0x2a2879){logger[_0xebc1('0x43')](_0xebc1('0x13'),_0x4b77aa,JSON[_0xebc1('0x42')](_0x2a2879));})[_0xebc1('0x3d')](function(){Promise['resolve']()[_0xebc1('0x3f')](function(){if(_0x463468[0x0]!=='2'||_0x147a03[_0xebc1('0x19')])return;return rpc[_0x4d7391+'Interaction'][_0xebc1('0x41')](_0x147a03['id'],{'autoreplyExecuted':!![]})[_0xebc1('0x3f')](function(_0x437e49){logger[_0xebc1('0x12')](_0xebc1('0x1a'),_0x4b77aa,JSON[_0xebc1('0x42')](_0x437e49));})['catch'](function(_0x565c96){logger[_0xebc1('0x43')](_0xebc1('0x44'),_0x4b77aa,JSON[_0xebc1('0x42')](_0x565c96));});})[_0xebc1('0x3f')](function(){_0x465282[_0xebc1('0x14')]();});});}}}catch(_0x177865){logger['error'](_0xebc1('0x13'),_0x4b77aa,JSON[_0xebc1('0x42')](_0x177865));_0x465282[_0xebc1('0x45')]();}};}; \ 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 868c02f..623d80c 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 _0xa361=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0xa361,0x14c));var _0x1a36=function(_0x239c72,_0x554a85){_0x239c72=_0x239c72-0x0;var _0x5da3f6=_0xa361[_0x239c72];return _0x5da3f6;};'use strict';var moment=require(_0x1a36('0x0'));var logger=require('../../../../config/logger')(_0x1a36('0x1'));var rpc={'chatInteraction':require(_0x1a36('0x2')),'openchannelInteraction':require(_0x1a36('0x3')),'smsInteraction':require(_0x1a36('0x4')),'mailInteraction':require(_0x1a36('0x5')),'faxInteraction':require(_0x1a36('0x6')),'whatsappInteraction':require(_0x1a36('0x7'))};exports['consequence']=function(_0x559b70,_0x107a2a,_0x29d0ce,_0x1ca8d7){return function(_0xbcfd19){try{logger[_0x1a36('0x8')](_0x1a36('0x9'),_0x559b70,_0x107a2a[0x0]);var _0x431a85={'closed':0x1,'closedAt':moment()[_0x1a36('0xa')](_0x1a36('0xb')),'closeReason':'system','disposition':_0x107a2a[0x0]};if(rpc[_0x1ca8d7[_0x1a36('0xc')]+_0x1a36('0xd')]){rpc[_0x1ca8d7[_0x1a36('0xc')]+_0x1a36('0xd')][_0x1a36('0xe')](_0x1ca8d7[_0x1a36('0xf')]['id'],_0x431a85)['then'](function(_0x128b54){logger[_0x1a36('0x8')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x559b70,_0x1ca8d7[_0x1a36('0xf')]['id']);})['catch'](function(_0x13c84e){logger[_0x1a36('0x10')](_0x1a36('0x11'),_0x559b70,JSON[_0x1a36('0x12')](_0x13c84e));})[_0x1a36('0x13')](function(){_0xbcfd19[_0x1a36('0x14')]();});}}catch(_0x1c453e){logger[_0x1a36('0x10')](_0x1a36('0x11'),_0x559b70,JSON[_0x1a36('0x12')](_0x1c453e));_0xbcfd19[_0x1a36('0x14')]();}};}; \ No newline at end of file +var _0x2512=['../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0xce6e0c,_0x3e5a23){var _0x579d57=function(_0x112b0a){while(--_0x112b0a){_0xce6e0c['push'](_0xce6e0c['shift']());}};_0x579d57(++_0x3e5a23);}(_0x2512,0x6f));var _0x2251=function(_0x53ba30,_0x210d1e){_0x53ba30=_0x53ba30-0x0;var _0x46e47a=_0x2512[_0x53ba30];return _0x46e47a;};'use strict';var moment=require(_0x2251('0x0'));var logger=require('../../../../config/logger')(_0x2251('0x1'));var rpc={'chatInteraction':require(_0x2251('0x2')),'openchannelInteraction':require(_0x2251('0x3')),'smsInteraction':require(_0x2251('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x2251('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x2251('0x6')]=function(_0x3f4354,_0x37bb09,_0x685585,_0x17d09a){return function(_0x286c2e){try{logger[_0x2251('0x7')](_0x2251('0x8'),_0x3f4354,_0x37bb09[0x0]);var _0x254996={'closed':0x1,'closedAt':moment()[_0x2251('0x9')](_0x2251('0xa')),'closeReason':_0x2251('0xb'),'disposition':_0x37bb09[0x0]};if(rpc[_0x17d09a[_0x2251('0xc')]+_0x2251('0xd')]){rpc[_0x17d09a[_0x2251('0xc')]+_0x2251('0xd')][_0x2251('0xe')](_0x17d09a[_0x2251('0xf')]['id'],_0x254996)[_0x2251('0x10')](function(_0x122125){logger[_0x2251('0x7')](_0x2251('0x11'),_0x3f4354,_0x17d09a['interaction']['id']);})[_0x2251('0x12')](function(_0x4c3816){logger['error'](_0x2251('0x13'),_0x3f4354,JSON[_0x2251('0x14')](_0x4c3816));})[_0x2251('0x15')](function(){_0x286c2e['stop']();});}}catch(_0x37128b){logger['error'](_0x2251('0x13'),_0x3f4354,JSON[_0x2251('0x14')](_0x37128b));_0x286c2e[_0x2251('0x16')]();}};}; \ 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 11b7422..3d53978 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 _0x00cd=['dialogflow','result','speech','providerName','then','endConversation','catch','message','lodash','moment','apiai-promise','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','next','contact','format','out','sms','channel','chat','account','AccountId','upperFirst','created','isEmpty','body','getMustacheRender','Message','create','[%s][DIALOGFLOW]\x20%s','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop'];(function(_0x50381e,_0xc4113b){var _0x23189f=function(_0xa53ce2){while(--_0xa53ce2){_0x50381e['push'](_0x50381e['shift']());}};_0x23189f(++_0xc4113b);}(_0x00cd,0xee));var _0xd00c=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x00cd[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xd00c('0x0'));var moment=require(_0xd00c('0x1'));var apiai=require(_0xd00c('0x2'));var md5=require('md5');var utils=require('./utils');var logger=require(_0xd00c('0x3'))(_0xd00c('0x4'));var rpc={'chatMessage':require(_0xd00c('0x5')),'openchannelMessage':require(_0xd00c('0x6')),'mailMessage':require(_0xd00c('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd00c('0x8')),'whatsappMessage':require(_0xd00c('0x9'))};exports[_0xd00c('0xa')]=function(_0x6af060,_0x32bead){return function(_0x751801){try{if(!_[_0xd00c('0xb')](this[_0xd00c('0xc')][_0xd00c('0xd')])){logger[_0xd00c('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x6af060,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x751801[_0xd00c('0xf')]();}var _0x267343={'ContactId':this[_0xd00c('0x10')]['id'],'sentAt':moment()[_0xd00c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xd00c('0x12')};if(this['channel']===_0xd00c('0x13')||this[_0xd00c('0x14')]==='whatsapp'){_0x267343['phone']=this['interaction']['phone'];}var _0x32e3ab=this[_0xd00c('0x14')];if(_0x32e3ab===_0xd00c('0x15')){_0x267343['ChatWebsiteId']=this[_0xd00c('0x16')]['id'];}else{_0x267343[_['upperFirst'](_0x32e3ab)+_0xd00c('0x17')]=this[_0xd00c('0x16')]['id'];}_0x267343[_[_0xd00c('0x18')](_0x32e3ab)+'InteractionId']=this['interaction']['id'];if(this[_0xd00c('0xc')][_0xd00c('0x19')]){var _0x15fddd=_0x32bead[0x2];if(!_[_0xd00c('0x1a')](_0x15fddd)){_0x267343[_0xd00c('0x1b')]=utils[_0xd00c('0x1c')](_0x15fddd,this);return rpc[_0x32e3ab+_0xd00c('0x1d')][_0xd00c('0x1e')](_0x267343)['then'](function(_0x2b167a){logger[_0xd00c('0xe')](_0xd00c('0x1f'),_0x6af060,_0x267343['body']);})['catch'](function(_0x4693a1){logger[_0xd00c('0x20')](_0xd00c('0x1f'),_0x6af060,JSON[_0xd00c('0x21')](_0x4693a1));})[_0xd00c('0x22')](function(){logger[_0xd00c('0xe')](_0xd00c('0x23'),_0x6af060);_0x751801['stop']();});}else{logger[_0xd00c('0xe')](_0xd00c('0x24'),_0x6af060);_0x751801[_0xd00c('0x25')]();}}else{var _0x3807fb=this;var _0x10d08d=apiai(_0x32bead[0x0],{'language':_0x32bead[0x1]||'en'});return _0x10d08d['textRequest'](this['message'][_0xd00c('0x1b')],{'sessionId':md5(this[_0xd00c('0xc')]['id'])})['then'](function(_0x4a6c84){_0x3807fb['body'][_0xd00c('0x26')]=_0x4a6c84;_0x267343['body']=_0x4a6c84[_0xd00c('0x27')]['fulfillment'][_0xd00c('0x28')];_0x267343[_0xd00c('0x29')]='dialogflow';_0x267343['providerResponse']=JSON[_0xd00c('0x21')](_0x4a6c84);return rpc[_0x32e3ab+_0xd00c('0x1d')][_0xd00c('0x1e')](_0x267343)[_0xd00c('0x2a')](function(_0x56f50f){logger[_0xd00c('0xe')](_0xd00c('0x1f'),_0x6af060,_0x267343[_0xd00c('0x1b')]);if(_0x4a6c84[_0xd00c('0x27')]['metadata'][_0xd00c('0x2b')]){_0x751801['next']();}else{_0x751801[_0xd00c('0x25')]();}})[_0xd00c('0x2c')](function(_0x291b71){logger[_0xd00c('0x20')](_0xd00c('0x1f'),_0x6af060,JSON[_0xd00c('0x21')](_0x291b71));_0x751801[_0xd00c('0xf')]();});})[_0xd00c('0x2c')](function(_0x1345dd){logger[_0xd00c('0x20')](_0xd00c('0x1f'),_0x6af060,_0x1345dd[_0xd00c('0x2d')]);_0x751801[_0xd00c('0xf')]();});}}catch(_0x3a0837){logger[_0xd00c('0x20')](_0xd00c('0x1f'),_0x6af060,JSON[_0xd00c('0x21')](_0x3a0837));_0x751801[_0xd00c('0x25')]();}};}; \ No newline at end of file +var _0x49df=['getMustacheRender','Message','create','then','info','catch','error','[%s][DIALOGFLOW]\x20%s','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','result','fulfillment','speech','dialogflow','providerResponse','endConversation','next','message','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body'];(function(_0x30e01f,_0x4b4c42){var _0x54b90e=function(_0x503bec){while(--_0x503bec){_0x30e01f['push'](_0x30e01f['shift']());}};_0x54b90e(++_0x4b4c42);}(_0x49df,0xad));var _0xf49d=function(_0x5ab2b4,_0x288fab){_0x5ab2b4=_0x5ab2b4-0x0;var _0x326806=_0x49df[_0x5ab2b4];return _0x326806;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require(_0xf49d('0x0'));var md5=require(_0xf49d('0x1'));var utils=require(_0xf49d('0x2'));var logger=require(_0xf49d('0x3'))(_0xf49d('0x4'));var rpc={'chatMessage':require(_0xf49d('0x5')),'openchannelMessage':require(_0xf49d('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf49d('0x7')),'faxMessage':require(_0xf49d('0x8')),'whatsappMessage':require(_0xf49d('0x9'))};exports[_0xf49d('0xa')]=function(_0x1aaf37,_0x29b82e){return function(_0x4e8b5e){try{if(!_[_0xf49d('0xb')](this[_0xf49d('0xc')][_0xf49d('0xd')])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x1aaf37,_0xf49d('0xe'));return _0x4e8b5e['next']();}var _0x49d438={'ContactId':this[_0xf49d('0xf')]['id'],'sentAt':moment()[_0xf49d('0x10')](_0xf49d('0x11')),'direction':'out'};if(this[_0xf49d('0x12')]===_0xf49d('0x13')||this['channel']===_0xf49d('0x14')){_0x49d438['phone']=this['interaction'][_0xf49d('0x15')];}var _0x488f64=this[_0xf49d('0x12')];if(_0x488f64===_0xf49d('0x16')){_0x49d438[_0xf49d('0x17')]=this['account']['id'];}else{_0x49d438[_[_0xf49d('0x18')](_0x488f64)+_0xf49d('0x19')]=this[_0xf49d('0x1a')]['id'];}_0x49d438[_['upperFirst'](_0x488f64)+_0xf49d('0x1b')]=this[_0xf49d('0xc')]['id'];if(this[_0xf49d('0xc')][_0xf49d('0x1c')]){var _0x5a7e5a=_0x29b82e[0x2];if(!_[_0xf49d('0x1d')](_0x5a7e5a)){_0x49d438[_0xf49d('0x1e')]=utils[_0xf49d('0x1f')](_0x5a7e5a,this);return rpc[_0x488f64+_0xf49d('0x20')][_0xf49d('0x21')](_0x49d438)[_0xf49d('0x22')](function(_0xbc6fdd){logger[_0xf49d('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x1aaf37,_0x49d438[_0xf49d('0x1e')]);})[_0xf49d('0x24')](function(_0x3785be){logger[_0xf49d('0x25')](_0xf49d('0x26'),_0x1aaf37,JSON[_0xf49d('0x27')](_0x3785be));})[_0xf49d('0x28')](function(){logger[_0xf49d('0x23')](_0xf49d('0x29'),_0x1aaf37);_0x4e8b5e[_0xf49d('0x2a')]();});}else{logger[_0xf49d('0x23')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1aaf37);_0x4e8b5e['stop']();}}else{var _0x2cf806=this;var _0x15bdcb=apiai(_0x29b82e[0x0],{'language':_0x29b82e[0x1]||'en'});return _0x15bdcb['textRequest'](this['message'][_0xf49d('0x1e')],{'sessionId':md5(this[_0xf49d('0xc')]['id'])})['then'](function(_0x58c1e7){_0x2cf806[_0xf49d('0x1e')]['dialogflow']=_0x58c1e7;_0x49d438[_0xf49d('0x1e')]=_0x58c1e7[_0xf49d('0x2b')][_0xf49d('0x2c')][_0xf49d('0x2d')];_0x49d438['providerName']=_0xf49d('0x2e');_0x49d438[_0xf49d('0x2f')]=JSON[_0xf49d('0x27')](_0x58c1e7);return rpc[_0x488f64+_0xf49d('0x20')][_0xf49d('0x21')](_0x49d438)[_0xf49d('0x22')](function(_0x13a1e7){logger[_0xf49d('0x23')](_0xf49d('0x26'),_0x1aaf37,_0x49d438[_0xf49d('0x1e')]);if(_0x58c1e7['result']['metadata'][_0xf49d('0x30')]){_0x4e8b5e[_0xf49d('0x31')]();}else{_0x4e8b5e[_0xf49d('0x2a')]();}})[_0xf49d('0x24')](function(_0x43e868){logger[_0xf49d('0x25')](_0xf49d('0x26'),_0x1aaf37,JSON['stringify'](_0x43e868));_0x4e8b5e[_0xf49d('0x31')]();});})[_0xf49d('0x24')](function(_0x17eb47){logger[_0xf49d('0x25')](_0xf49d('0x26'),_0x1aaf37,_0x17eb47[_0xf49d('0x32')]);_0x4e8b5e[_0xf49d('0x31')]();});}}catch(_0x3cc954){logger[_0xf49d('0x25')](_0xf49d('0x26'),_0x1aaf37,JSON['stringify'](_0x3cc954));_0x4e8b5e['stop']();}};}; \ 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 0e33d73..d60511b 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 _0xe638=['phone','chat','ChatWebsiteId','upperFirst','account','InteractionId','interaction','created','isEmpty','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','dialogflowV2','providerResponse','fulfillmentText','push','all','dialogflow','moment','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel'];(function(_0x377621,_0x35dd81){var _0x2b16f4=function(_0x24d6e3){while(--_0x24d6e3){_0x377621['push'](_0x377621['shift']());}};_0x2b16f4(++_0x35dd81);}(_0xe638,0x1dc));var _0x8e63=function(_0x36844f,_0x2e43ba){_0x36844f=_0x36844f-0x0;var _0x5e07ea=_0xe638[_0x36844f];return _0x5e07ea;};'use strict';var _=require('lodash');var dialogflow=require(_0x8e63('0x0'));var md5=require('md5');var moment=require(_0x8e63('0x1'));var Promise=require('bluebird');var logger=require(_0x8e63('0x2'))(_0x8e63('0x3'));var utils=require(_0x8e63('0x4'));var rpc={'chatMessage':require(_0x8e63('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x8e63('0x6')),'smsMessage':require(_0x8e63('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x8e63('0x8'))};function createMessage(_0x441f81,_0x2ae4f5,_0x13e553,_0x5e4384){return new Promise(function(_0x53955e,_0x333141){var _0x4ef43d=_[_0x8e63('0x9')](_0x13e553);_0x4ef43d[_0x8e63('0xa')]=_0x5e4384;return rpc[_0x2ae4f5+_0x8e63('0xb')][_0x8e63('0xc')](_0x4ef43d)[_0x8e63('0xd')](function(){logger[_0x8e63('0xe')](_0x8e63('0xf'),_0x441f81,_0x4ef43d[_0x8e63('0xa')]);_0x53955e();})[_0x8e63('0x10')](function(_0x1e0c3c){logger[_0x8e63('0x11')](_0x8e63('0xf'),_0x441f81,JSON[_0x8e63('0x12')](_0x1e0c3c));_0x333141(_0x1e0c3c);});});}exports[_0x8e63('0x13')]=function(_0x4fae2d,_0x14990e){return function(_0x192f22){try{if(!_[_0x8e63('0x14')](this['interaction'][_0x8e63('0x15')])){logger['info'](_0x8e63('0xf'),_0x4fae2d,_0x8e63('0x16'));return _0x192f22[_0x8e63('0x17')]();}var _0x48d6ad={'ContactId':this[_0x8e63('0x18')]['id'],'sentAt':moment()[_0x8e63('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x8e63('0x1a')};if(this[_0x8e63('0x1b')]==='sms'||this[_0x8e63('0x1b')]==='whatsapp'){_0x48d6ad[_0x8e63('0x1c')]=this['interaction'][_0x8e63('0x1c')];}var _0x4f5135=this['channel'];if(_0x4f5135===_0x8e63('0x1d')){_0x48d6ad[_0x8e63('0x1e')]=this['account']['id'];}else{_0x48d6ad[_[_0x8e63('0x1f')](_0x4f5135)+'AccountId']=this[_0x8e63('0x20')]['id'];}_0x48d6ad[_[_0x8e63('0x1f')](_0x4f5135)+_0x8e63('0x21')]=this[_0x8e63('0x22')]['id'];if(this[_0x8e63('0x22')][_0x8e63('0x23')]){var _0x15552f=_0x14990e[0x4];if(!_[_0x8e63('0x24')](_0x15552f)){_0x48d6ad[_0x8e63('0xa')]=utils['getMustacheRender'](_0x15552f,this);return rpc[_0x4f5135+_0x8e63('0xb')][_0x8e63('0xc')](_0x48d6ad)[_0x8e63('0xd')](function(_0x4ca627){logger[_0x8e63('0xe')](_0x8e63('0xf'),_0x4fae2d,_0x48d6ad[_0x8e63('0xa')]);})[_0x8e63('0x10')](function(_0xa5d13b){logger['error'](_0x8e63('0xf'),_0x4fae2d,JSON[_0x8e63('0x12')](_0xa5d13b));})[_0x8e63('0x25')](function(){logger[_0x8e63('0xe')](_0x8e63('0x26'),_0x4fae2d);_0x192f22[_0x8e63('0x27')]();});}else{logger['info'](_0x8e63('0x28'),_0x4fae2d);_0x192f22['stop']();}}else{var _0x3731c0=this;var _0x51bfd3=_0x14990e[0x2][_0x8e63('0x29')](/\\n/g,'\x0a');var _0x7b7a99={'credentials':{'private_key':_0x51bfd3,'client_email':_0x14990e[0x1]}};var _0x24e01e=new dialogflow[(_0x8e63('0x2a'))](_0x7b7a99);var _0x94f6c7=_0x24e01e[_0x8e63('0x2b')](_0x14990e[0x0],md5(_0x3731c0['interaction']['id']));var _0x8ea645={'session':_0x94f6c7,'queryInput':{'text':{'text':_0x3731c0['message'][_0x8e63('0xa')],'languageCode':_0x14990e[0x3]||'en'}}};return _0x24e01e['detectIntent'](_0x8ea645)[_0x8e63('0xd')](function(_0x444e5f){if(_0x444e5f&&_0x444e5f[_0x8e63('0x2c')]){_0x3731c0[_0x8e63('0xa')]['dialogflowV2']=_0x444e5f;var _0x26e677=_0x444e5f[0x0];var _0xd5ec3f=_0x26e677[_0x8e63('0x2d')][_0x8e63('0x2e')]&&_0x26e677['queryResult']['diagnosticInfo'][_0x8e63('0x2f')]?_0x26e677[_0x8e63('0x2d')]['diagnosticInfo']['fields'][_0x8e63('0x30')][_0x8e63('0x31')]:![];_0x3731c0[_0x8e63('0xa')][_0x8e63('0x32')]=_0x26e677[_0x8e63('0x2d')]['action'];_0x3731c0[_0x8e63('0xa')][_0x8e63('0x33')]=_0x26e677['queryResult'][_0x8e63('0x34')];_0x3731c0[_0x8e63('0xa')][_0x8e63('0x35')]=_0x26e677[_0x8e63('0x2d')]['diagnosticInfo']&&_0x26e677[_0x8e63('0x2d')][_0x8e63('0x2e')][_0x8e63('0x2f')]?_0x26e677[_0x8e63('0x2d')][_0x8e63('0x2e')][_0x8e63('0x2f')]['end_conversation'][_0x8e63('0x31')]:![];_0x3731c0[_0x8e63('0xa')][_0x8e63('0x36')]=_0x26e677[_0x8e63('0x2d')][_0x8e63('0x37')][_0x8e63('0x38')];_0x3731c0[_0x8e63('0xa')][_0x8e63('0x39')]=_0x26e677[_0x8e63('0x2d')][_0x8e63('0x37')][_0x8e63('0x3a')];_0x3731c0[_0x8e63('0xa')][_0x8e63('0x3b')]=_0x26e677[_0x8e63('0x2d')][_0x8e63('0x37')][_0x8e63('0x3c')];_0x3731c0[_0x8e63('0xa')][_0x8e63('0x3d')]=_0x26e677[_0x8e63('0x2d')][_0x8e63('0x3e')];_0x3731c0[_0x8e63('0xa')][_0x8e63('0x3f')]=_0x26e677[_0x8e63('0x2d')][_0x8e63('0x40')];_0x3731c0[_0x8e63('0xa')][_0x8e63('0x41')]=_0x26e677[_0x8e63('0x2d')][_0x8e63('0x42')];_0x48d6ad['providerName']=_0x8e63('0x43');_0x48d6ad[_0x8e63('0x44')]=JSON['stringify'](_0x444e5f);var _0x16ce64=[];for(var _0x3078d3=0x0;_0x3078d3<_0x444e5f[_0x8e63('0x2c')];_0x3078d3++){var _0x12ff65=_0x444e5f[_0x3078d3];if(_0x12ff65&&_0x12ff65[_0x8e63('0x2d')]&&_0x12ff65[_0x8e63('0x2d')][_0x8e63('0x45')]){_0x16ce64[_0x8e63('0x46')](createMessage(_0x4fae2d,_0x4f5135,_0x48d6ad,_0x12ff65['queryResult'][_0x8e63('0x45')]));}}return Promise[_0x8e63('0x47')](_0x16ce64)[_0x8e63('0xd')](function(){if(_0xd5ec3f){_0x192f22['next']();}else{_0x192f22[_0x8e63('0x27')]();}})[_0x8e63('0x10')](function(_0x1395c7){logger[_0x8e63('0x11')](_0x8e63('0xf'),_0x4fae2d,JSON[_0x8e63('0x12')](_0x1395c7));_0x192f22[_0x8e63('0x17')]();});}})[_0x8e63('0x10')](function(_0x199942){logger[_0x8e63('0x11')](_0x8e63('0xf'),_0x4fae2d,_0x199942['message']);_0x192f22[_0x8e63('0x17')]();});}}catch(_0x3c6770){logger[_0x8e63('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x4fae2d,JSON[_0x8e63('0x12')](_0x3c6770));_0x192f22[_0x8e63('0x27')]();}};}; \ No newline at end of file +var _0x643e=['intentDetectionConfidence','providerName','dialogflowV2','providerResponse','fulfillmentText','push','all','lodash','md5','bluebird','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','body','create','then','catch','stringify','consequence','isNil','interaction','info','[%s][DIALOGFLOWV2]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','error','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','message','detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE'];(function(_0x1af5ae,_0x20e4a3){var _0x2a2a8c=function(_0x1a487f){while(--_0x1a487f){_0x1af5ae['push'](_0x1af5ae['shift']());}};_0x2a2a8c(++_0x20e4a3);}(_0x643e,0x193));var _0xe643=function(_0x261ab8,_0xb00dd1){_0x261ab8=_0x261ab8-0x0;var _0x5c8070=_0x643e[_0x261ab8];return _0x5c8070;};'use strict';var _=require(_0xe643('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xe643('0x1'));var moment=require('moment');var Promise=require(_0xe643('0x2'));var logger=require('../../../../config/logger')('routing');var utils=require(_0xe643('0x3'));var rpc={'chatMessage':require(_0xe643('0x4')),'openchannelMessage':require(_0xe643('0x5')),'mailMessage':require(_0xe643('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe643('0x7'))};function createMessage(_0x583928,_0x4e9cf3,_0x284edf,_0x3b1e40){return new Promise(function(_0x1477bb,_0x59f3cf){var _0x23f7ba=_['clone'](_0x284edf);_0x23f7ba[_0xe643('0x8')]=_0x3b1e40;return rpc[_0x4e9cf3+'Message'][_0xe643('0x9')](_0x23f7ba)[_0xe643('0xa')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x583928,_0x23f7ba[_0xe643('0x8')]);_0x1477bb();})[_0xe643('0xb')](function(_0x4d76b7){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x583928,JSON[_0xe643('0xc')](_0x4d76b7));_0x59f3cf(_0x4d76b7);});});}exports[_0xe643('0xd')]=function(_0xb6d40e,_0x45f7ae){return function(_0x5d5275){try{if(!_[_0xe643('0xe')](this[_0xe643('0xf')]['UserId'])){logger[_0xe643('0x10')](_0xe643('0x11'),_0xb6d40e,_0xe643('0x12'));return _0x5d5275[_0xe643('0x13')]();}var _0x321cf7={'ContactId':this['contact']['id'],'sentAt':moment()[_0xe643('0x14')](_0xe643('0x15')),'direction':_0xe643('0x16')};if(this[_0xe643('0x17')]===_0xe643('0x18')||this['channel']===_0xe643('0x19')){_0x321cf7[_0xe643('0x1a')]=this[_0xe643('0xf')][_0xe643('0x1a')];}var _0x43e8de=this[_0xe643('0x17')];if(_0x43e8de===_0xe643('0x1b')){_0x321cf7[_0xe643('0x1c')]=this[_0xe643('0x1d')]['id'];}else{_0x321cf7[_[_0xe643('0x1e')](_0x43e8de)+'AccountId']=this[_0xe643('0x1d')]['id'];}_0x321cf7[_[_0xe643('0x1e')](_0x43e8de)+_0xe643('0x1f')]=this[_0xe643('0xf')]['id'];if(this[_0xe643('0xf')]['created']){var _0x27fa72=_0x45f7ae[0x4];if(!_['isEmpty'](_0x27fa72)){_0x321cf7[_0xe643('0x8')]=utils['getMustacheRender'](_0x27fa72,this);return rpc[_0x43e8de+_0xe643('0x20')][_0xe643('0x9')](_0x321cf7)[_0xe643('0xa')](function(_0x22e121){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0xb6d40e,_0x321cf7[_0xe643('0x8')]);})[_0xe643('0xb')](function(_0xf5f94d){logger[_0xe643('0x21')](_0xe643('0x11'),_0xb6d40e,JSON[_0xe643('0xc')](_0xf5f94d));})[_0xe643('0x22')](function(){logger[_0xe643('0x10')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0xb6d40e);_0x5d5275[_0xe643('0x23')]();});}else{logger[_0xe643('0x10')](_0xe643('0x24'),_0xb6d40e);_0x5d5275[_0xe643('0x23')]();}}else{var _0x2e9538=this;var _0x2c5c13=_0x45f7ae[0x2][_0xe643('0x25')](/\\n/g,'\x0a');var _0x210e7d={'credentials':{'private_key':_0x2c5c13,'client_email':_0x45f7ae[0x1]}};var _0x3c3da4=new dialogflow['SessionsClient'](_0x210e7d);var _0x4b1061=_0x3c3da4['sessionPath'](_0x45f7ae[0x0],md5(_0x2e9538['interaction']['id']));var _0x1386bd={'session':_0x4b1061,'queryInput':{'text':{'text':_0x2e9538[_0xe643('0x26')][_0xe643('0x8')],'languageCode':_0x45f7ae[0x3]||'en'}}};return _0x3c3da4[_0xe643('0x27')](_0x1386bd)[_0xe643('0xa')](function(_0x3b26cf){if(_0x3b26cf&&_0x3b26cf[_0xe643('0x28')]){_0x2e9538[_0xe643('0x8')]['dialogflowV2']=_0x3b26cf;var _0x51f575=_0x3b26cf[0x0];var _0x25c970=_0x51f575[_0xe643('0x29')][_0xe643('0x2a')]&&_0x51f575[_0xe643('0x29')][_0xe643('0x2a')][_0xe643('0x2b')]?_0x51f575[_0xe643('0x29')][_0xe643('0x2a')][_0xe643('0x2b')][_0xe643('0x2c')][_0xe643('0x2d')]:![];_0x2e9538[_0xe643('0x8')][_0xe643('0x2e')]=_0x51f575[_0xe643('0x29')]['action'];_0x2e9538[_0xe643('0x8')][_0xe643('0x2f')]=_0x51f575[_0xe643('0x29')][_0xe643('0x30')];_0x2e9538[_0xe643('0x8')][_0xe643('0x31')]=_0x51f575['queryResult']['diagnosticInfo']&&_0x51f575['queryResult'][_0xe643('0x2a')][_0xe643('0x2b')]?_0x51f575[_0xe643('0x29')][_0xe643('0x2a')][_0xe643('0x2b')][_0xe643('0x2c')][_0xe643('0x2d')]:![];_0x2e9538[_0xe643('0x8')][_0xe643('0x32')]=_0x51f575[_0xe643('0x29')][_0xe643('0x33')][_0xe643('0x34')];_0x2e9538[_0xe643('0x8')][_0xe643('0x35')]=_0x51f575[_0xe643('0x29')][_0xe643('0x33')]['displayName'];_0x2e9538[_0xe643('0x8')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x51f575[_0xe643('0x29')][_0xe643('0x33')]['isFallback'];_0x2e9538['body'][_0xe643('0x36')]=_0x51f575[_0xe643('0x29')][_0xe643('0x37')];_0x2e9538[_0xe643('0x8')][_0xe643('0x38')]=_0x51f575['queryResult'][_0xe643('0x39')];_0x2e9538[_0xe643('0x8')][_0xe643('0x3a')]=_0x51f575[_0xe643('0x29')][_0xe643('0x3b')];_0x321cf7[_0xe643('0x3c')]=_0xe643('0x3d');_0x321cf7[_0xe643('0x3e')]=JSON[_0xe643('0xc')](_0x3b26cf);var _0x28de02=[];for(var _0x3bc195=0x0;_0x3bc195<_0x3b26cf[_0xe643('0x28')];_0x3bc195++){var _0x3ff3de=_0x3b26cf[_0x3bc195];if(_0x3ff3de&&_0x3ff3de[_0xe643('0x29')]&&_0x3ff3de['queryResult'][_0xe643('0x3f')]){_0x28de02[_0xe643('0x40')](createMessage(_0xb6d40e,_0x43e8de,_0x321cf7,_0x3ff3de[_0xe643('0x29')][_0xe643('0x3f')]));}}return Promise[_0xe643('0x41')](_0x28de02)[_0xe643('0xa')](function(){if(_0x25c970){_0x5d5275[_0xe643('0x13')]();}else{_0x5d5275[_0xe643('0x23')]();}})['catch'](function(_0x4d30eb){logger[_0xe643('0x21')]('[%s][DIALOGFLOWV2]\x20%s',_0xb6d40e,JSON[_0xe643('0xc')](_0x4d30eb));_0x5d5275[_0xe643('0x13')]();});}})[_0xe643('0xb')](function(_0x3bd3f9){logger[_0xe643('0x21')](_0xe643('0x11'),_0xb6d40e,_0x3bd3f9[_0xe643('0x26')]);_0x5d5275[_0xe643('0x13')]();});}}catch(_0x1d3979){logger['error'](_0xe643('0x11'),_0xb6d40e,JSON['stringify'](_0x1d3979));_0x5d5275['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 910f0e1..734fa44 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 _0x3bc4=['[%s][GOTOIF]\x20%s','message','join','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error'];(function(_0x52a548,_0x26b3aa){var _0x5af471=function(_0x61f05d){while(--_0x61f05d){_0x52a548['push'](_0x52a548['shift']());}};_0x5af471(++_0x26b3aa);}(_0x3bc4,0xf7));var _0x43bc=function(_0x21e38c,_0x5cd897){_0x21e38c=_0x21e38c-0x0;var _0x2ba423=_0x3bc4[_0x21e38c];return _0x2ba423;};'use strict';var schema=require(_0x43bc('0x0'));var _=require('lodash');var htmlToText=require(_0x43bc('0x1'));var utils=require(_0x43bc('0x2'));var logger=require(_0x43bc('0x3'))('routing');var gotoif=schema({'condition':{'type':_0x43bc('0x4'),'required':!![],'message':_0x43bc('0x5')},'priorityTrue':{'type':_0x43bc('0x6'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x43bc('0x6'),'message':_0x43bc('0x7')}});exports[_0x43bc('0x8')]=function(_0x539475,_0x1c4775){return function(_0xc1e7be){try{var _0x50e77d={'condition':htmlToText[_0x43bc('0x9')](utils[_0x43bc('0xa')](_0x1c4775[0x0],this),{'wordwrap':![]})[_0x43bc('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1c4775[0x1],'priorityFalse':_0x1c4775[0x2]};var _0x33aa3a=gotoif[_0x43bc('0x0')](_0x50e77d,{'typecast':!![]});if(_0x33aa3a[_0x43bc('0xc')]){logger[_0x43bc('0xd')](_0x43bc('0xe'),_0x539475,_['map'](_0x33aa3a,_0x43bc('0xf'))[_0x43bc('0x10')](',\x20'));_0xc1e7be['stop']();}else{try{var _0x475b72=eval('('+_0x50e77d[_0x43bc('0x11')]+')');var _0x90cb4b=_0x475b72?_0x50e77d[_0x43bc('0x12')]:_0x50e77d[_0x43bc('0x13')];logger[_0x43bc('0x14')](_0x43bc('0x15'),_0x539475,_0x50e77d[_0x43bc('0x11')],_0x475b72,_0x90cb4b||_0x43bc('0x16'));if(_0x90cb4b){var _0xd3555b=_[_0x43bc('0x17')](_0xc1e7be['rules'](),{'p':_0x90cb4b});if(_0xd3555b>=0x0){logger['info'](_0x43bc('0x18'),_0x539475,_0x90cb4b||_0x43bc('0x16'),_0xd3555b);_0xc1e7be[_0x43bc('0x16')](_0xd3555b);}else{logger[_0x43bc('0x14')](_0x43bc('0x19'),_0x539475,_0x90cb4b||_0x43bc('0x16'));_0xc1e7be[_0x43bc('0x1a')]();}}else{_0xc1e7be[_0x43bc('0x16')]();}}catch(_0x3dc8bf){logger[_0x43bc('0xd')](_0x43bc('0x1b'),_0x539475,_0x3dc8bf['message']);_0xc1e7be['stop']();}}}catch(_0x3099d3){logger[_0x43bc('0xd')](_0x43bc('0xe'),_0x539475,JSON[_0x43bc('0x1c')](_0x3099d3));_0xc1e7be['stop']();}};}; \ No newline at end of file +var _0xa826=['../../../../config/logger','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','map','stop','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','[%s][GOTOIF]\x20%s','stringify','validate','lodash','./utils'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xa826,0x15c));var _0x6a82=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa826[_0x501510];return _0x1e6ee5;};'use strict';var schema=require(_0x6a82('0x0'));var _=require(_0x6a82('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x6a82('0x2'));var logger=require(_0x6a82('0x3'))('routing');var gotoif=schema({'condition':{'type':_0x6a82('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x6a82('0x5'),'message':_0x6a82('0x6')},'priorityFalse':{'type':_0x6a82('0x5'),'message':_0x6a82('0x7')}});exports['consequence']=function(_0x373b6b,_0x45dd18){return function(_0x4432fb){try{var _0x4b2b67={'condition':htmlToText[_0x6a82('0x8')](utils[_0x6a82('0x9')](_0x45dd18[0x0],this),{'wordwrap':![]})[_0x6a82('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x45dd18[0x1],'priorityFalse':_0x45dd18[0x2]};var _0x28e6aa=gotoif[_0x6a82('0x0')](_0x4b2b67,{'typecast':!![]});if(_0x28e6aa[_0x6a82('0xb')]){logger[_0x6a82('0xc')]('[%s][GOTOIF]\x20%s',_0x373b6b,_[_0x6a82('0xd')](_0x28e6aa,'message')['join'](',\x20'));_0x4432fb[_0x6a82('0xe')]();}else{try{var _0x1d721d=eval('('+_0x4b2b67['condition']+')');var _0x492ca4=_0x1d721d?_0x4b2b67[_0x6a82('0xf')]:_0x4b2b67['priorityFalse'];logger[_0x6a82('0x10')](_0x6a82('0x11'),_0x373b6b,_0x4b2b67[_0x6a82('0x12')],_0x1d721d,_0x492ca4||_0x6a82('0x13'));if(_0x492ca4){var _0x1c7762=_['findIndex'](_0x4432fb[_0x6a82('0x14')](),{'p':_0x492ca4});if(_0x1c7762>=0x0){logger[_0x6a82('0x10')](_0x6a82('0x15'),_0x373b6b,_0x492ca4||'next',_0x1c7762);_0x4432fb['next'](_0x1c7762);}else{logger['info'](_0x6a82('0x16'),_0x373b6b,_0x492ca4||_0x6a82('0x13'));_0x4432fb[_0x6a82('0xe')]();}}else{_0x4432fb[_0x6a82('0x13')]();}}catch(_0xcd7b9a){logger[_0x6a82('0xc')](_0x6a82('0x17'),_0x373b6b,_0xcd7b9a[_0x6a82('0x18')]);_0x4432fb[_0x6a82('0xe')]();}}}catch(_0x344c3d){logger[_0x6a82('0xc')](_0x6a82('0x19'),_0x373b6b,JSON[_0x6a82('0x1a')](_0x344c3d));_0x4432fb['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index e80ea84..07c66f7 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 _0x57d4=['error','[%s][GOTOP]\x20%s','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','stop','validate','lodash','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x57d4,0x19c));var _0x457d=function(_0xefe438,_0x253458){_0xefe438=_0xefe438-0x0;var _0x4a6f82=_0x57d4[_0xefe438];return _0x4a6f82;};'use strict';var schema=require(_0x457d('0x0'));var _=require(_0x457d('0x1'));var logger=require('../../../../config/logger')(_0x457d('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x457d('0x3')}});exports[_0x457d('0x4')]=function(_0x3d13f3,_0x4e43a5){return function(_0x1aef7e){try{var _0x40c964={'priority':_0x4e43a5[0x0]};var _0x486e4e=gotop[_0x457d('0x0')](_0x40c964,{'typecast':!![]});if(_0x486e4e[_0x457d('0x5')]){logger[_0x457d('0x6')](_0x457d('0x7'),_0x3d13f3,_['map'](_0x486e4e,_0x457d('0x8'))[_0x457d('0x9')](',\x20'));_0x1aef7e['stop']();}else{logger[_0x457d('0xa')](_0x457d('0xb'),_0x3d13f3,_0x40c964[_0x457d('0xc')]);if(_0x40c964[_0x457d('0xc')]){var _0x52b62d=_[_0x457d('0xd')](_0x1aef7e['rules'](),{'p':_0x40c964[_0x457d('0xc')]});if(_0x52b62d>=0x0){logger['info'](_0x457d('0xe'),_0x3d13f3,_0x40c964[_0x457d('0xc')]||_0x457d('0xf'),_0x52b62d);_0x1aef7e[_0x457d('0xf')](_0x52b62d);}else{logger[_0x457d('0xa')](_0x457d('0x10'),_0x3d13f3,_0x40c964[_0x457d('0xc')]||_0x457d('0xf'));_0x1aef7e['stop']();}}else{_0x1aef7e[_0x457d('0xf')]();}}}catch(_0x2fc81b){logger[_0x457d('0x6')]('[%s][GOTOP]\x20%s',_0x3d13f3,JSON[_0x457d('0x11')](_0x2fc81b));_0x1aef7e[_0x457d('0x12')]();}};}; \ No newline at end of file +var _0xae56=['join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','lodash','../../../../config/logger','routing','consequence','validate','length','[%s][GOTOP]\x20%s','message'];(function(_0x2dd22e,_0xec41fe){var _0x257b01=function(_0x26de99){while(--_0x26de99){_0x2dd22e['push'](_0x2dd22e['shift']());}};_0x257b01(++_0xec41fe);}(_0xae56,0x160));var _0x6ae5=function(_0x56436f,_0x15a9db){_0x56436f=_0x56436f-0x0;var _0x5b31b1=_0xae56[_0x56436f];return _0x5b31b1;};'use strict';var schema=require('validate');var _=require(_0x6ae5('0x0'));var logger=require(_0x6ae5('0x1'))(_0x6ae5('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x6ae5('0x3')]=function(_0x4c0078,_0x4a8ada){return function(_0x5a2c5f){try{var _0xd701c6={'priority':_0x4a8ada[0x0]};var _0x1029b0=gotop[_0x6ae5('0x4')](_0xd701c6,{'typecast':!![]});if(_0x1029b0[_0x6ae5('0x5')]){logger['error'](_0x6ae5('0x6'),_0x4c0078,_['map'](_0x1029b0,_0x6ae5('0x7'))[_0x6ae5('0x8')](',\x20'));_0x5a2c5f[_0x6ae5('0x9')]();}else{logger[_0x6ae5('0xa')](_0x6ae5('0xb'),_0x4c0078,_0xd701c6[_0x6ae5('0xc')]);if(_0xd701c6[_0x6ae5('0xc')]){var _0x33b499=_['findIndex'](_0x5a2c5f[_0x6ae5('0xd')](),{'p':_0xd701c6[_0x6ae5('0xc')]});if(_0x33b499>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4c0078,_0xd701c6[_0x6ae5('0xc')]||_0x6ae5('0xe'),_0x33b499);_0x5a2c5f[_0x6ae5('0xe')](_0x33b499);}else{logger[_0x6ae5('0xa')](_0x6ae5('0xf'),_0x4c0078,_0xd701c6[_0x6ae5('0xc')]||_0x6ae5('0xe'));_0x5a2c5f['stop']();}}else{_0x5a2c5f[_0x6ae5('0xe')]();}}}catch(_0x2e3cac){logger[_0x6ae5('0x10')](_0x6ae5('0x6'),_0x4c0078,JSON[_0x6ae5('0x11')](_0x2e3cac));_0x5a2c5f[_0x6ae5('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 2ce794d..2a5b5f4 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 _0xf29f=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','./utils','../../../../config/logger','routing'];(function(_0x457378,_0x58abfb){var _0x1a339c=function(_0x34eaba){while(--_0x34eaba){_0x457378['push'](_0x457378['shift']());}};_0x1a339c(++_0x58abfb);}(_0xf29f,0x18d));var _0xff29=function(_0x5b328b,_0x491ba6){_0x5b328b=_0x5b328b-0x0;var _0x325447=_0xf29f[_0x5b328b];return _0x325447;};'use strict';var _=require('lodash');var utils=require(_0xff29('0x0'));var logger=require(_0xff29('0x1'))(_0xff29('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xff29('0x3')),'mailMessage':require(_0xff29('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xff29('0x5')),'whatsappMessage':require(_0xff29('0x6'))};exports['consequence']=function(_0x3c5aa4,_0xbbe36b){return function(_0x4c814b){try{var _0x566021={'body':utils[_0xff29('0x7')](_0xbbe36b[0x0],this),'ContactId':this['contact']['id']};if(this[_0xff29('0x8')]===_0xff29('0x9')){_0x566021[_0xff29('0xa')]=this[_0xff29('0xb')]['id'];}else{_0x566021[_[_0xff29('0xc')](this[_0xff29('0x8')])+'AccountId']=this['account']['id'];}_0x566021[_[_0xff29('0xc')](this[_0xff29('0x8')])+_0xff29('0xd')]=this[_0xff29('0xe')]['id'];if(rpc[this[_0xff29('0x8')]+_0xff29('0xf')]){return rpc[this[_0xff29('0x8')]+_0xff29('0xf')][_0xff29('0x10')](_0x566021)[_0xff29('0x11')](function(_0xf67040){logger[_0xff29('0x12')](_0xff29('0x13'),_0x3c5aa4,_0x566021[_0xff29('0x14')]);_0x4c814b[_0xff29('0x15')]();})['catch'](function(_0x1ff15e){logger[_0xff29('0x16')]('[%s][MESSAGE]\x20%s',_0x3c5aa4,JSON[_0xff29('0x17')](_0x1ff15e));_0x4c814b[_0xff29('0x18')]();});}}catch(_0x24567d){logger[_0xff29('0x16')](_0xff29('0x13'),_0x3c5aa4,JSON[_0xff29('0x17')](_0x24567d));_0x4c814b[_0xff29('0x18')]();}};}; \ No newline at end of file +var _0x56ff=['[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','contact','channel','ChatWebsiteId','upperFirst','AccountId','account','interaction','Message','create','then','info'];(function(_0x16b672,_0x29071e){var _0x2d69d2=function(_0x9c9afd){while(--_0x9c9afd){_0x16b672['push'](_0x16b672['shift']());}};_0x2d69d2(++_0x29071e);}(_0x56ff,0x66));var _0xf56f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x56ff[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf56f('0x0'));var utils=require(_0xf56f('0x1'));var logger=require('../../../../config/logger')(_0xf56f('0x2'));var rpc={'chatMessage':require(_0xf56f('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf56f('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf56f('0x5'))};exports[_0xf56f('0x6')]=function(_0x3f9855,_0x5c7395){return function(_0x2c65e9){try{var _0x4bdb26={'body':utils['getMustacheRender'](_0x5c7395[0x0],this),'ContactId':this[_0xf56f('0x7')]['id']};if(this[_0xf56f('0x8')]==='chat'){_0x4bdb26[_0xf56f('0x9')]=this['account']['id'];}else{_0x4bdb26[_[_0xf56f('0xa')](this[_0xf56f('0x8')])+_0xf56f('0xb')]=this[_0xf56f('0xc')]['id'];}_0x4bdb26[_[_0xf56f('0xa')](this[_0xf56f('0x8')])+'InteractionId']=this[_0xf56f('0xd')]['id'];if(rpc[this[_0xf56f('0x8')]+_0xf56f('0xe')]){return rpc[this[_0xf56f('0x8')]+_0xf56f('0xe')][_0xf56f('0xf')](_0x4bdb26)[_0xf56f('0x10')](function(_0x2ab689){logger[_0xf56f('0x11')](_0xf56f('0x12'),_0x3f9855,_0x4bdb26['body']);_0x2c65e9[_0xf56f('0x13')]();})[_0xf56f('0x14')](function(_0x537bd9){logger[_0xf56f('0x15')]('[%s][MESSAGE]\x20%s',_0x3f9855,JSON[_0xf56f('0x16')](_0x537bd9));_0x2c65e9[_0xf56f('0x17')]();});}}catch(_0x225800){logger[_0xf56f('0x15')](_0xf56f('0x12'),_0x3f9855,JSON['stringify'](_0x225800));_0x2c65e9[_0xf56f('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 a88aca6..a0fa305 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 _0x5019=['stop','routing','consequence','info','[%s][NOOP]\x20%s','next','error','stringify'];(function(_0x1ee63b,_0x1110c9){var _0x5d6d80=function(_0x459952){while(--_0x459952){_0x1ee63b['push'](_0x1ee63b['shift']());}};_0x5d6d80(++_0x1110c9);}(_0x5019,0xe9));var _0x9501=function(_0x3ef179,_0x21a68a){_0x3ef179=_0x3ef179-0x0;var _0x5ad279=_0x5019[_0x3ef179];return _0x5ad279;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x9501('0x0'));exports[_0x9501('0x1')]=function(_0x16c1a5,_0x5dbbd0){return function(_0x4c5901){try{logger[_0x9501('0x2')](_0x9501('0x3'),_0x16c1a5,utils['getMustacheRender'](_0x5dbbd0[0x0],this));_0x4c5901[_0x9501('0x4')]();}catch(_0x1852eb){logger[_0x9501('0x5')](_0x9501('0x3'),_0x16c1a5,JSON[_0x9501('0x6')](_0x1852eb));_0x4c5901[_0x9501('0x7')]();}};}; \ No newline at end of file +var _0x77b8=['next','error','stringify','./utils','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x1d816a,_0xe06a67){var _0x42c934=function(_0xb48d71){while(--_0xb48d71){_0x1d816a['push'](_0x1d816a['shift']());}};_0x42c934(++_0xe06a67);}(_0x77b8,0xed));var _0x877b=function(_0x2fcb5a,_0x2f9891){_0x2fcb5a=_0x2fcb5a-0x0;var _0x3a9e31=_0x77b8[_0x2fcb5a];return _0x3a9e31;};'use strict';var utils=require(_0x877b('0x0'));var logger=require('../../../../config/logger')(_0x877b('0x1'));exports[_0x877b('0x2')]=function(_0x1e1ed9,_0x46b3b2){return function(_0x1236ca){try{logger[_0x877b('0x3')](_0x877b('0x4'),_0x1e1ed9,utils[_0x877b('0x5')](_0x46b3b2[0x0],this));_0x1236ca[_0x877b('0x6')]();}catch(_0x5df939){logger[_0x877b('0x7')](_0x877b('0x4'),_0x1e1ed9,JSON[_0x877b('0x8')](_0x5df939));_0x1236ca['stop']();}};}; \ 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 2beeeab..8463b9a 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 _0xb13b=['YYYY-MM-DD\x20HH:mm:ss','contact','upperFirst','channel','InteractionId','MessageId','chat','[%s][START:QUEUE][NAME:%s]','name','message','QueueReport','create','catch','error','accepted','[%s][STOP:QUEUE][NAME:%s]','update','timeout','info','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','util','seq-queue','moment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','from','joinAt','clone','account','format','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body'];(function(_0x1b79ea,_0x3c2358){var _0x1c7432=function(_0x4c70de){while(--_0x4c70de){_0x1b79ea['push'](_0x1b79ea['shift']());}};_0x1c7432(++_0x3c2358);}(_0xb13b,0xc7));var _0xbb13=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xb13b[_0x341e0f];return _0x59555a;};'use strict';var schema=require(_0xbb13('0x0'));var _=require('lodash');var util=require(_0xbb13('0x1'));var seqqueue=require(_0xbb13('0x2'));var moment=require(_0xbb13('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0xbb13('0x4'))(_0xbb13('0x5'));var strategy=require(_0xbb13('0x6'));config[_0xbb13('0x7')]=_[_0xbb13('0x8')](config[_0xbb13('0x7')],{'host':_0xbb13('0x9'),'port':0x18eb});var io=require(_0xbb13('0xa'))(new Redis(config[_0xbb13('0x7')]));var attributes=['id',_0xbb13('0xb'),'account',_0xbb13('0xc'),_0xbb13('0xd'),_0xbb13('0xe')];function emit(_0x47d7eb,_0x318704,_0x59694d){io['to'](_0x47d7eb)['emit'](_0x318704,_0x59694d);}function emitChannelQueueInteraction(_0xad597c,_0x7ec2fd,_0x1a397b,_0x32c67a,_0x100659,_0x461656,_0x5cf7dd,_0x4e0bf0){var _0x1b8726=_[_0xbb13('0xf')](_0x1a397b);_0x1b8726['queue_id']=_0x4e0bf0;_0x1b8726[_0xbb13('0xc')]=_0x7ec2fd;_0x1b8726[_0xbb13('0x10')]=_0x32c67a;_0x1b8726['id']=_0x100659;if(_0x461656){_0x5cf7dd[util['format']('%sQueuesWaitingInteractions',_0xad597c)][_0x100659]=_['pick'](_0x1b8726,attributes);}else{delete _0x5cf7dd[util[_0xbb13('0x11')]('%sQueuesWaitingInteractions',_0xad597c)][_0x100659];}emit(util['format']('%s:queue:%s',_0xad597c,_0x7ec2fd),util[_0xbb13('0x11')](_0xbb13('0x12'),_0xad597c,_0x461656?_0xbb13('0x13'):_0xbb13('0x14')),_['pick'](_0x1b8726,attributes));}var rpc={'openchannelQueueReport':require(_0xbb13('0x15')),'mailQueueReport':require(_0xbb13('0x16')),'chatQueueReport':require(_0xbb13('0x17')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xbb13('0x18')),'whatsappQueueReport':require(_0xbb13('0x19'))};var queue=schema({'name':{'type':_0xbb13('0x1a'),'required':!![],'message':_0xbb13('0x1b')},'timeout':{'type':_0xbb13('0x1c'),'message':_0xbb13('0x1d')}});function startRouting(_0x5ef463,_0x38548e,_0x33dae2,_0x2ffcc6){if(_0x5ef463&&_0x38548e&&_0x33dae2){_0x38548e[_0xbb13('0x1e')]+=0x1;var _0x8ed605={'uniqueid':_0x5ef463,'from':_0x33dae2[_0xbb13('0x1f')]?_0x33dae2[_0xbb13('0x1f')][_0xbb13('0xd')]:'','joinAt':moment()[_0xbb13('0x11')](_0xbb13('0x20')),'ContactId':_0x33dae2[_0xbb13('0x21')]?_0x33dae2[_0xbb13('0x21')]['id']:null,'ListId':_0x33dae2['list']?_0x33dae2['list']['id']:null};_0x8ed605[_['upperFirst'](_0x33dae2['channel'])+'QueueId']=_0x38548e['id']||null;_0x8ed605[_[_0xbb13('0x22')](_0x33dae2[_0xbb13('0x23')])+_0xbb13('0x24')]=_0x33dae2['interaction']?_0x33dae2['interaction']['id']:null;_0x8ed605[_[_0xbb13('0x22')](_0x33dae2['channel'])+_0xbb13('0x25')]=_0x33dae2['message']?_0x33dae2['message']['id']:null;_0x8ed605[_[_0xbb13('0x22')](_0x33dae2[_0xbb13('0x23')])+(_0x33dae2['channel']!==_0xbb13('0x26')?'AccountId':'WebsiteId')]=_0x33dae2[_0xbb13('0x10')]?_0x33dae2['account']['id']:null;logger['info'](util['format'](_0xbb13('0x27'),_0x5ef463,_0x38548e[_0xbb13('0x28')]));emitChannelQueueInteraction(_0x33dae2['channel'],_0x38548e[_0xbb13('0x28')],_0x8ed605,_0x33dae2['account']['name'],_0x33dae2[_0xbb13('0x29')]['id'],!![],_0x2ffcc6,_0x38548e['id']);if(rpc[_0x33dae2['channel']+_0xbb13('0x2a')]){return rpc[_0x33dae2[_0xbb13('0x23')]+_0xbb13('0x2a')][_0xbb13('0x2b')](_0x8ed605)[_0xbb13('0x2c')](function(_0x2f201f){logger[_0xbb13('0x2d')]('create\x20queue\x20report');});}}}function stopRouting(_0x574c9f,_0x245713,_0x4e0693,_0x2bb3c7){if(_0x574c9f&&_0x245713){_0x245713['waiting']-=0x1;var _0x368f96={'leaveAt':moment()[_0xbb13('0x11')](_0xbb13('0x20')),'acceptAt':moment()[_0xbb13('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xbb13('0x2e')};logger['info'](util[_0xbb13('0x11')](_0xbb13('0x2f'),_0x574c9f,_0x245713[_0xbb13('0x28')]));emitChannelQueueInteraction(_0x4e0693[_0xbb13('0x23')],_0x245713[_0xbb13('0x28')],_0x4e0693['body'],_0x4e0693[_0xbb13('0x10')][_0xbb13('0x28')],_0x4e0693['message']['id'],![],_0x2bb3c7,_0x245713['id']);if(rpc[_0x4e0693[_0xbb13('0x23')]+_0xbb13('0x2a')]){return rpc[_0x4e0693['channel']+_0xbb13('0x2a')][_0xbb13('0x30')](_0x574c9f,_0x368f96)[_0xbb13('0x2c')](function(_0x30fb46){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0x4afccc,_0x3959c0,_0x2e2226,_0x36e5d7){if(_0x4afccc&&_0x3959c0){_0x3959c0['waiting']-=0x1;var _0x2e49e5={'leaveAt':moment()[_0xbb13('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xbb13('0x11')](_0xbb13('0x20')),'reason':_0xbb13('0x31')};logger[_0xbb13('0x32')](util[_0xbb13('0x11')](_0xbb13('0x33'),_0x4afccc,_0x3959c0[_0xbb13('0x28')]));emitChannelQueueInteraction(_0x2e2226['channel'],_0x3959c0[_0xbb13('0x28')],_0x2e2226['body'],_0x2e2226[_0xbb13('0x10')][_0xbb13('0x28')],_0x2e2226[_0xbb13('0x29')]['id'],![],_0x36e5d7);if(rpc[_0x2e2226[_0xbb13('0x23')]+_0xbb13('0x2a')]){return rpc[_0x2e2226['channel']+_0xbb13('0x2a')][_0xbb13('0x30')](_0x4afccc,_0x2e49e5)[_0xbb13('0x2c')](function(_0x1ac43e){logger[_0xbb13('0x2d')](_0xbb13('0x34'));});}}}function handleFindQueue(_0xae0acb){return function(_0x31704e){return _0x31704e[_0xbb13('0x28')][_0xbb13('0x35')]()===_0xae0acb[_0xbb13('0x35')]();};}exports[_0xbb13('0x36')]=function(_0x5c4107,_0x4a214e,_0x371b5f,_0x36e649){return function(_0x279223){try{var _0x3c2951={'name':_0x4a214e[0x0],'timeout':_0x4a214e[0x1]};var _0x32151a=queue['validate'](_0x3c2951,{'typecast':!![]});if(_0x32151a[_0xbb13('0x37')]){logger['error'](_0xbb13('0x38'),_0x5c4107,_[_0xbb13('0x39')](_0x32151a,'message')['join'](',\x20'));_0x279223[_0xbb13('0x3a')]();}else{var _0x494e66=_[_0xbb13('0x3b')](_0x371b5f[_0x36e649[_0xbb13('0x23')]+_0xbb13('0x3c')],handleFindQueue(_0x3c2951[_0xbb13('0x28')]));if(_0x494e66){startRouting(_0x5c4107,_0x494e66,_0x36e649,_0x371b5f);var _0x5c1009=(_0x494e66[_0xbb13('0x31')]||0xa)*0x3e8;var _0x17228d=(_0x3c2951['timeout']||0x14)*0x3e8;var _0x1dd06b,_0x5c6a43;if(_0x5c1009>_0x17228d){_0x17228d=_0x5c1009;}var _0x2842c6=seqqueue[_0xbb13('0x3d')](_0x5c1009);_0x2842c6['id']=_0x5c4107;_0x2842c6[_0xbb13('0x3e')]=_0x5c1009;_0x2842c6[_0xbb13('0x3f')]=_0x17228d;_0x2842c6[_0xbb13('0x23')]=_0x36e649[_0xbb13('0x23')];_0x371b5f[_0xbb13('0x40')][_0x5c4107]['on'](_0xbb13('0x41'),function(){logger[_0xbb13('0x32')](_0xbb13('0x42'),_0x5c4107);stopRouting(_0x5c4107,_0x494e66,_0x36e649,_0x371b5f);clearTimeout(_0x1dd06b);_0x1dd06b=undefined;_0x2842c6[_0xbb13('0x43')](!![]);if(_0x371b5f[_0xbb13('0x40')][_0x5c4107]){delete _0x371b5f[_0xbb13('0x40')][_0x5c4107];}_0x279223[_0xbb13('0x3a')]();});_0x371b5f[_0xbb13('0x40')][_0x5c4107]['on'](_0xbb13('0x44'),function(){if(_0x371b5f[_0xbb13('0x40')][_0x5c4107]){delete _0x371b5f[_0xbb13('0x40')][_0x5c4107];}});_0x1dd06b=setTimeout(function(){logger[_0xbb13('0x32')](_0xbb13('0x45'),_0x5c4107);endRouting(_0x5c4107,_0x494e66,_0x36e649,_0x371b5f);clearTimeout(_0x1dd06b);_0x2842c6[_0xbb13('0x43')](!![]);_0x279223[_0xbb13('0x46')]();},_0x17228d);switch(_0x494e66[_0xbb13('0x47')]){case _0xbb13('0x48'):strategy[_0xbb13('0x48')](_0x2842c6,_0x494e66,_0x371b5f,_0x36e649);break;default:strategy[_0xbb13('0x49')](_0x2842c6,_0x494e66,_0x371b5f,_0x36e649);}}else{logger[_0xbb13('0x2d')](_0xbb13('0x4a'),_0x5c4107,_0x3c2951[_0xbb13('0x28')]);_0x279223[_0xbb13('0x3a')]();}}}catch(_0xc9a802){console[_0xbb13('0x4b')](_0xc9a802);logger[_0xbb13('0x2d')]('[%s][QUEUE]\x20%s',_0x5c4107,_0xc9a802[_0xbb13('0x4c')]);_0x279223[_0xbb13('0x3a')]();}};}; \ No newline at end of file +var _0x7d36=['length','[%s][QUEUE]\x20%s','map','stop','createQueue','atimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','InteractionId','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','update','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','validate'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7d36,0x14c));var _0x67d3=function(_0x2d9a07,_0x9f887){_0x2d9a07=_0x2d9a07-0x0;var _0x488da3=_0x7d36[_0x2d9a07];return _0x488da3;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x67d3('0x0'));var seqqueue=require('seq-queue');var moment=require(_0x67d3('0x1'));var Redis=require(_0x67d3('0x2'));var config=require(_0x67d3('0x3'));var logger=require(_0x67d3('0x4'))(_0x67d3('0x5'));var strategy=require(_0x67d3('0x6'));config[_0x67d3('0x7')]=_[_0x67d3('0x8')](config['redis'],{'host':_0x67d3('0x9'),'port':0x18eb});var io=require(_0x67d3('0xa'))(new Redis(config[_0x67d3('0x7')]));var attributes=['id',_0x67d3('0xb'),_0x67d3('0xc'),_0x67d3('0xd'),_0x67d3('0xe'),_0x67d3('0xf')];function emit(_0x585cf7,_0x284ac3,_0x1d55d2){io['to'](_0x585cf7)[_0x67d3('0x10')](_0x284ac3,_0x1d55d2);}function emitChannelQueueInteraction(_0x4754e5,_0xb7d62,_0x172bfc,_0x5f524d,_0x3e403d,_0x19f97a,_0xd39f06,_0xd5fd22){var _0x316f69=_[_0x67d3('0x11')](_0x172bfc);_0x316f69[_0x67d3('0xb')]=_0xd5fd22;_0x316f69[_0x67d3('0xd')]=_0xb7d62;_0x316f69[_0x67d3('0xc')]=_0x5f524d;_0x316f69['id']=_0x3e403d;if(_0x19f97a){_0xd39f06[util[_0x67d3('0x12')](_0x67d3('0x13'),_0x4754e5)][_0x3e403d]=_[_0x67d3('0x14')](_0x316f69,attributes);}else{delete _0xd39f06[util[_0x67d3('0x12')](_0x67d3('0x13'),_0x4754e5)][_0x3e403d];}emit(util['format'](_0x67d3('0x15'),_0x4754e5,_0xb7d62),util[_0x67d3('0x12')](_0x67d3('0x16'),_0x4754e5,_0x19f97a?_0x67d3('0x17'):_0x67d3('0x18')),_['pick'](_0x316f69,attributes));}var rpc={'openchannelQueueReport':require(_0x67d3('0x19')),'mailQueueReport':require(_0x67d3('0x1a')),'chatQueueReport':require(_0x67d3('0x1b')),'smsQueueReport':require(_0x67d3('0x1c')),'faxQueueReport':require(_0x67d3('0x1d')),'whatsappQueueReport':require(_0x67d3('0x1e'))};var queue=schema({'name':{'type':_0x67d3('0x1f'),'required':!![],'message':_0x67d3('0x20')},'timeout':{'type':_0x67d3('0x21'),'message':_0x67d3('0x22')}});function startRouting(_0x90c27b,_0x53d813,_0x4e5685,_0x30f3ff){if(_0x90c27b&&_0x53d813&&_0x4e5685){_0x53d813[_0x67d3('0x23')]+=0x1;var _0x1a30ec={'uniqueid':_0x90c27b,'from':_0x4e5685[_0x67d3('0x24')]?_0x4e5685[_0x67d3('0x24')][_0x67d3('0xe')]:'','joinAt':moment()[_0x67d3('0x12')](_0x67d3('0x25')),'ContactId':_0x4e5685['contact']?_0x4e5685[_0x67d3('0x26')]['id']:null,'ListId':_0x4e5685['list']?_0x4e5685[_0x67d3('0x27')]['id']:null};_0x1a30ec[_['upperFirst'](_0x4e5685[_0x67d3('0x28')])+_0x67d3('0x29')]=_0x53d813['id']||null;_0x1a30ec[_[_0x67d3('0x2a')](_0x4e5685[_0x67d3('0x28')])+_0x67d3('0x2b')]=_0x4e5685[_0x67d3('0x2c')]?_0x4e5685[_0x67d3('0x2c')]['id']:null;_0x1a30ec[_[_0x67d3('0x2a')](_0x4e5685[_0x67d3('0x28')])+'MessageId']=_0x4e5685[_0x67d3('0x2d')]?_0x4e5685[_0x67d3('0x2d')]['id']:null;_0x1a30ec[_[_0x67d3('0x2a')](_0x4e5685[_0x67d3('0x28')])+(_0x4e5685[_0x67d3('0x28')]!==_0x67d3('0x2e')?_0x67d3('0x2f'):_0x67d3('0x30'))]=_0x4e5685[_0x67d3('0xc')]?_0x4e5685['account']['id']:null;logger[_0x67d3('0x31')](util['format'](_0x67d3('0x32'),_0x90c27b,_0x53d813[_0x67d3('0x33')]));emitChannelQueueInteraction(_0x4e5685[_0x67d3('0x28')],_0x53d813['name'],_0x1a30ec,_0x4e5685[_0x67d3('0xc')]['name'],_0x4e5685[_0x67d3('0x2d')]['id'],!![],_0x30f3ff,_0x53d813['id']);if(rpc[_0x4e5685[_0x67d3('0x28')]+_0x67d3('0x34')]){return rpc[_0x4e5685['channel']+_0x67d3('0x34')][_0x67d3('0x35')](_0x1a30ec)[_0x67d3('0x36')](function(_0x5be218){logger[_0x67d3('0x37')]('create\x20queue\x20report');});}}}function stopRouting(_0x31e441,_0xdce7d7,_0x32eb8d,_0xf0ccf){if(_0x31e441&&_0xdce7d7){_0xdce7d7[_0x67d3('0x23')]-=0x1;var _0x5cd2da={'leaveAt':moment()[_0x67d3('0x12')](_0x67d3('0x25')),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0x67d3('0x31')](util[_0x67d3('0x12')]('[%s][STOP:QUEUE][NAME:%s]',_0x31e441,_0xdce7d7['name']));emitChannelQueueInteraction(_0x32eb8d['channel'],_0xdce7d7[_0x67d3('0x33')],_0x32eb8d[_0x67d3('0x24')],_0x32eb8d[_0x67d3('0xc')]['name'],_0x32eb8d['message']['id'],![],_0xf0ccf,_0xdce7d7['id']);if(rpc[_0x32eb8d[_0x67d3('0x28')]+_0x67d3('0x34')]){return rpc[_0x32eb8d[_0x67d3('0x28')]+_0x67d3('0x34')][_0x67d3('0x38')](_0x31e441,_0x5cd2da)[_0x67d3('0x36')](function(_0x2fa9dd){logger[_0x67d3('0x37')]('update\x20queue\x20report');});}}}function endRouting(_0x53d6b3,_0x2f4f07,_0x2428f8,_0x486ce5){if(_0x53d6b3&&_0x2f4f07){_0x2f4f07[_0x67d3('0x23')]-=0x1;var _0x52cb4f={'leaveAt':moment()[_0x67d3('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x67d3('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x67d3('0x39')};logger[_0x67d3('0x31')](util[_0x67d3('0x12')](_0x67d3('0x3a'),_0x53d6b3,_0x2f4f07['name']));emitChannelQueueInteraction(_0x2428f8['channel'],_0x2f4f07[_0x67d3('0x33')],_0x2428f8[_0x67d3('0x24')],_0x2428f8['account'][_0x67d3('0x33')],_0x2428f8[_0x67d3('0x2d')]['id'],![],_0x486ce5);if(rpc[_0x2428f8[_0x67d3('0x28')]+'QueueReport']){return rpc[_0x2428f8[_0x67d3('0x28')]+_0x67d3('0x34')][_0x67d3('0x38')](_0x53d6b3,_0x52cb4f)[_0x67d3('0x36')](function(_0x1ead77){logger[_0x67d3('0x37')](_0x67d3('0x3b'));});}}}function handleFindQueue(_0xb1cac0){return function(_0x2a8f8c){return _0x2a8f8c[_0x67d3('0x33')][_0x67d3('0x3c')]()===_0xb1cac0['toLowerCase']();};}exports[_0x67d3('0x3d')]=function(_0x4f65ef,_0x58f379,_0x115988,_0x20f8c4){return function(_0xb529c){try{var _0x57e2a4={'name':_0x58f379[0x0],'timeout':_0x58f379[0x1]};var _0x254c2c=queue[_0x67d3('0x3e')](_0x57e2a4,{'typecast':!![]});if(_0x254c2c[_0x67d3('0x3f')]){logger['error'](_0x67d3('0x40'),_0x4f65ef,_[_0x67d3('0x41')](_0x254c2c,_0x67d3('0x2d'))['join'](',\x20'));_0xb529c[_0x67d3('0x42')]();}else{var _0xd7b8be=_['find'](_0x115988[_0x20f8c4[_0x67d3('0x28')]+'Queues'],handleFindQueue(_0x57e2a4[_0x67d3('0x33')]));if(_0xd7b8be){startRouting(_0x4f65ef,_0xd7b8be,_0x20f8c4,_0x115988);var _0xa209be=(_0xd7b8be['timeout']||0xa)*0x3e8;var _0x299088=(_0x57e2a4[_0x67d3('0x39')]||0x14)*0x3e8;var _0x5d6894,_0x5277dd;if(_0xa209be>_0x299088){_0x299088=_0xa209be;}var _0x65d443=seqqueue[_0x67d3('0x43')](_0xa209be);_0x65d443['id']=_0x4f65ef;_0x65d443[_0x67d3('0x44')]=_0xa209be;_0x65d443['qtimeout']=_0x299088;_0x65d443[_0x67d3('0x28')]=_0x20f8c4[_0x67d3('0x28')];_0x115988[_0x67d3('0x45')][_0x4f65ef]['on'](_0x67d3('0x46'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x4f65ef);stopRouting(_0x4f65ef,_0xd7b8be,_0x20f8c4,_0x115988);clearTimeout(_0x5d6894);_0x5d6894=undefined;_0x65d443[_0x67d3('0x47')](!![]);if(_0x115988[_0x67d3('0x45')][_0x4f65ef]){delete _0x115988[_0x67d3('0x45')][_0x4f65ef];}_0xb529c[_0x67d3('0x42')]();});_0x115988['rules'][_0x4f65ef]['on'](_0x67d3('0x48'),function(){if(_0x115988[_0x67d3('0x45')][_0x4f65ef]){delete _0x115988['rules'][_0x4f65ef];}});_0x5d6894=setTimeout(function(){logger[_0x67d3('0x31')](_0x67d3('0x49'),_0x4f65ef);endRouting(_0x4f65ef,_0xd7b8be,_0x20f8c4,_0x115988);clearTimeout(_0x5d6894);_0x65d443[_0x67d3('0x47')](!![]);_0xb529c[_0x67d3('0x4a')]();},_0x299088);switch(_0xd7b8be[_0x67d3('0x4b')]){case _0x67d3('0x4c'):strategy['rrmemory'](_0x65d443,_0xd7b8be,_0x115988,_0x20f8c4);break;default:strategy['beepall'](_0x65d443,_0xd7b8be,_0x115988,_0x20f8c4);}}else{logger[_0x67d3('0x37')](_0x67d3('0x4d'),_0x4f65ef,_0x57e2a4[_0x67d3('0x33')]);_0xb529c[_0x67d3('0x42')]();}}}catch(_0x5059ce){console[_0x67d3('0x4e')](_0x5059ce);logger['error'](_0x67d3('0x40'),_0x4f65ef,_0x5059ce['stack']);_0xb529c[_0x67d3('0x42')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 0355aec..8a3f0a6 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 _0xfa45=['./util','notificationId','squeue','agent','realtime','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','agents','info','forcedOwnership','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','TIMEOUT','lodash'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0xfa45,0xca));var _0x5fa4=function(_0x300ae9,_0x11ceed){_0x300ae9=_0x300ae9-0x0;var _0xcfec4=_0xfa45[_0x300ae9];return _0xcfec4;};'use strict';var _=require(_0x5fa4('0x0'));var uuid=require('uuid');var util=require(_0x5fa4('0x1'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x10556b,_0x468618,_0x238510,_0x8532f1){this[_0x5fa4('0x2')]=uuid['v4']();this[_0x5fa4('0x3')]=_0x10556b;this[_0x5fa4('0x4')]=_0x468618;this[_0x5fa4('0x5')]=_0x238510;this[_0x5fa4('0x6')]=_0x8532f1;this['squeue'][_0x5fa4('0x7')](this[_0x5fa4('0x8')][_0x5fa4('0x9')](this),this[_0x5fa4('0xa')][_0x5fa4('0x9')](this));this[_0x5fa4('0x3')]['on'](_0x5fa4('0xb'),this[_0x5fa4('0xa')]['bind'](this));this[_0x5fa4('0x3')]['on'](_0x5fa4('0xc'),this[_0x5fa4('0xd')]['bind'](this));};Agent[_0x5fa4('0xe')][_0x5fa4('0x7')]=function(){this[_0x5fa4('0x3')]['push'](this[_0x5fa4('0x8')][_0x5fa4('0x9')](this),this[_0x5fa4('0xa')]['bind'](this));};Agent['prototype'][_0x5fa4('0xd')]=function(){this[_0x5fa4('0xa')](!![]);};Agent['prototype']['handleRun']=function(_0x20195e){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this[_0x5fa4('0x3')]['id'],this[_0x5fa4('0x4')]['id']);if(_[_0x5fa4('0xf')](this['realtime'][_0x5fa4('0x10')][this[_0x5fa4('0x4')]['id']])){logger[_0x5fa4('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x5fa4('0x3')]['id'],this[_0x5fa4('0x4')]['id']);setTimeout(this[_0x5fa4('0x7')]['bind'](this),0x3e8);}else{if(this[_0x5fa4('0x6')][_0x5fa4('0x12')]||util['isAgentAvailable'](this[_0x5fa4('0x3')]['id'],this[_0x5fa4('0x5')][_0x5fa4('0x10')][this[_0x5fa4('0x4')]['id']],this['squeue'][_0x5fa4('0x13')],![])){this[_0x5fa4('0x5')][_0x5fa4('0x10')][this[_0x5fa4('0x4')]['id']][_0x5fa4('0x14')]=!![];this[_0x5fa4('0x5')][_0x5fa4('0x10')][this['agent']['id']][_0x5fa4('0x15')]=undefined;util[_0x5fa4('0x16')](this[_0x5fa4('0x2')],this[_0x5fa4('0x3')]['id'],this['realtime']['agents'][this[_0x5fa4('0x4')]['id']],null,this[_0x5fa4('0x6')]);util[_0x5fa4('0x17')](this[_0x5fa4('0x3')]['id'],this['realtime'][_0x5fa4('0x10')][this[_0x5fa4('0x4')]['id']],_0x5fa4('0x18')+(this[_0x5fa4('0x6')][_0x5fa4('0x12')]?_0x5fa4('0x19'):''));}else{logger[_0x5fa4('0x11')](_0x5fa4('0x1a'),this['squeue']['id'],this[_0x5fa4('0x4')]['id']);setTimeout(this[_0x5fa4('0x7')]['bind'](this),0x3e8);}}};Agent[_0x5fa4('0xe')][_0x5fa4('0xa')]=function(_0x30225e){if(_[_0x5fa4('0xf')](this[_0x5fa4('0x5')][_0x5fa4('0x10')][this['agent']['id']])){return logger[_0x5fa4('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x5fa4('0x3')]['id'],this[_0x5fa4('0x4')]['id']);}else{logger[_0x5fa4('0x11')](_0x5fa4('0x1b'),this[_0x5fa4('0x3')]['id'],this[_0x5fa4('0x4')]['id']);util['hideNotification'](this['notificationId'],this[_0x5fa4('0x3')]['id'],this[_0x5fa4('0x5')]['agents'][this[_0x5fa4('0x4')]['id']],null,this[_0x5fa4('0x6')]);this[_0x5fa4('0x5')][_0x5fa4('0x10')][this['agent']['id']]['busy']=![];this[_0x5fa4('0x5')][_0x5fa4('0x10')][this['agent']['id']]['busyQueue']=undefined;util[_0x5fa4('0x17')](this[_0x5fa4('0x3')]['id'],this[_0x5fa4('0x5')][_0x5fa4('0x10')][this[_0x5fa4('0x4')]['id']],_0x30225e?'STOP':_0x5fa4('0x1c'));}if(!_0x30225e){setTimeout(this[_0x5fa4('0x7')][_0x5fa4('0x9')](this),0x3e8);}};function agent(_0x40736a,_0x10bddc,_0x2cbf98,_0xbe1412){return new Agent(_0x40736a,_0x10bddc,_0x2cbf98,_0xbe1412);}module['exports']=agent; \ No newline at end of file +var _0x6097=['hideNotification','STOP','TIMEOUT','exports','uuid','./util','notificationId','agent','realtime','routing','squeue','push','handleRun','handleTimeout','bind','prototype','handleDrained','info','isNil','agents','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0x3616b3,_0x314c8d){var _0x58da83=function(_0x310f99){while(--_0x310f99){_0x3616b3['push'](_0x3616b3['shift']());}};_0x58da83(++_0x314c8d);}(_0x6097,0x9a));var _0x7609=function(_0x47878f,_0x48d3bf){_0x47878f=_0x47878f-0x0;var _0x4b05b8=_0x6097[_0x47878f];return _0x4b05b8;};'use strict';var _=require('lodash');var uuid=require(_0x7609('0x0'));var util=require(_0x7609('0x1'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x174487,_0x35e0a4,_0x414ab8,_0x204fe6){this[_0x7609('0x2')]=uuid['v4']();this['squeue']=_0x174487;this[_0x7609('0x3')]=_0x35e0a4;this[_0x7609('0x4')]=_0x414ab8;this[_0x7609('0x5')]=_0x204fe6;this[_0x7609('0x6')][_0x7609('0x7')](this[_0x7609('0x8')]['bind'](this),this[_0x7609('0x9')][_0x7609('0xa')](this));this[_0x7609('0x6')]['on']('timeout',this[_0x7609('0x9')]['bind'](this));this['squeue']['on']('drained',this['handleDrained'][_0x7609('0xa')](this));};Agent[_0x7609('0xb')][_0x7609('0x7')]=function(){this[_0x7609('0x6')][_0x7609('0x7')](this[_0x7609('0x8')][_0x7609('0xa')](this),this[_0x7609('0x9')]['bind'](this));};Agent[_0x7609('0xb')][_0x7609('0xc')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x7609('0x8')]=function(_0x4d5bab){logger[_0x7609('0xd')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x7609('0x6')]['id'],this[_0x7609('0x3')]['id']);if(_[_0x7609('0xe')](this[_0x7609('0x4')][_0x7609('0xf')][this['agent']['id']])){logger[_0x7609('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x7609('0x6')]['id'],this[_0x7609('0x3')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this['routing'][_0x7609('0x10')]||util[_0x7609('0x11')](this[_0x7609('0x6')]['id'],this[_0x7609('0x4')][_0x7609('0xf')][this['agent']['id']],this[_0x7609('0x6')][_0x7609('0x12')],![])){this['realtime'][_0x7609('0xf')][this['agent']['id']]['busy']=!![];this[_0x7609('0x4')][_0x7609('0xf')][this['agent']['id']][_0x7609('0x13')]=undefined;util[_0x7609('0x14')](this[_0x7609('0x2')],this[_0x7609('0x6')]['id'],this[_0x7609('0x4')][_0x7609('0xf')][this['agent']['id']],null,this[_0x7609('0x5')]);util[_0x7609('0x15')](this[_0x7609('0x6')]['id'],this['realtime'][_0x7609('0xf')][this[_0x7609('0x3')]['id']],_0x7609('0x16')+(this[_0x7609('0x5')][_0x7609('0x10')]?_0x7609('0x17'):''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0x7609('0x3')]['id']);setTimeout(this['push'][_0x7609('0xa')](this),0x3e8);}}};Agent[_0x7609('0xb')]['handleTimeout']=function(_0xb1d64a){if(_['isNil'](this['realtime'][_0x7609('0xf')][this[_0x7609('0x3')]['id']])){return logger[_0x7609('0xd')](_0x7609('0x18'),this[_0x7609('0x6')]['id'],this['agent']['id']);}else{logger[_0x7609('0xd')](_0x7609('0x19'),this['squeue']['id'],this[_0x7609('0x3')]['id']);util[_0x7609('0x1a')](this['notificationId'],this[_0x7609('0x6')]['id'],this[_0x7609('0x4')][_0x7609('0xf')][this[_0x7609('0x3')]['id']],null,this['routing']);this[_0x7609('0x4')][_0x7609('0xf')][this[_0x7609('0x3')]['id']]['busy']=![];this['realtime'][_0x7609('0xf')][this[_0x7609('0x3')]['id']][_0x7609('0x13')]=undefined;util[_0x7609('0x15')](this['squeue']['id'],this['realtime']['agents'][this[_0x7609('0x3')]['id']],_0xb1d64a?_0x7609('0x1b'):_0x7609('0x1c'));}if(!_0xb1d64a){setTimeout(this['push'][_0x7609('0xa')](this),0x3e8);}};function agent(_0x400177,_0x471cc0,_0x2be7c8,_0x2f0528){return new Agent(_0x400177,_0x471cc0,_0x2be7c8,_0x2f0528);}module[_0x7609('0x1d')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 56b0cd9..02fe1df 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 _0x9d92=['showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','STOP','busy','exports','lodash','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','handleTimeout','bind','drained','handleDrained','prototype','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busyQueue'];(function(_0x3b2f10,_0x34dc5f){var _0x563d79=function(_0x5ab05a){while(--_0x5ab05a){_0x3b2f10['push'](_0x3b2f10['shift']());}};_0x563d79(++_0x34dc5f);}(_0x9d92,0xdf));var _0x29d9=function(_0x59e862,_0x477bf2){_0x59e862=_0x59e862-0x0;var _0x1a25ee=_0x9d92[_0x59e862];return _0x1a25ee;};'use strict';var _=require(_0x29d9('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0x29d9('0x1'))(_0x29d9('0x2'));var Beepall=function(_0x48fe57,_0x3dbd9e,_0x1664bf,_0x18371b){this[_0x29d9('0x3')]=uuid['v4']();this[_0x29d9('0x4')]=_0x48fe57;this[_0x29d9('0x5')]=_0x3dbd9e;this[_0x29d9('0x6')]=_0x1664bf;this['routing']=_0x18371b;this[_0x29d9('0x4')][_0x29d9('0x7')](this[_0x29d9('0x8')]['bind'](this),this[_0x29d9('0x9')][_0x29d9('0xa')](this));this[_0x29d9('0x4')]['on']('timeout',this['handleTimeout']['bind'](this));this['squeue']['on'](_0x29d9('0xb'),this[_0x29d9('0xc')][_0x29d9('0xa')](this));};Beepall['prototype'][_0x29d9('0x7')]=function(){this[_0x29d9('0x4')][_0x29d9('0x7')](this[_0x29d9('0x8')]['bind'](this),this[_0x29d9('0x9')]['bind'](this));};Beepall['prototype']['handleDrained']=function(_0x399643){this[_0x29d9('0x9')](!![]);};Beepall[_0x29d9('0xd')][_0x29d9('0x8')]=function(_0x47b33c){var _0x1ab294=!![];if(!_[_0x29d9('0xe')](this[_0x29d9('0x5')])&&!_[_0x29d9('0xe')](this[_0x29d9('0x5')][_0x29d9('0xf')])&&this[_0x29d9('0x5')][_0x29d9('0xf')][_0x29d9('0x10')]>0x0){for(var _0x8f79e4=0x0,_0x2b4f42;_0x8f79e40x0){for(var _0x27bd8b=0x0,_0x182af5;_0x27bd8b0x0&&_0x490717[_0xae76ec+_0xa3f8('0x29')]>=_0x490717[_0xae76ec+_0xa3f8('0x28')]){writeLog(_0x187352,_0x490717,_0xae76ec[_0xa3f8('0x2a')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xa3f8('0x2b')]=function(_0x57f6be,_0xbad6a6,_0x3a3746,_0x3c1128,_0x4ea213){return sendNotification(!![],_0x57f6be,_0xbad6a6,_0x3a3746,_0x3c1128,_0x4ea213);};exports[_0xa3f8('0x2c')]=function(_0x5e69e2,_0x21c57e,_0x4281ea,_0x226153,_0x406140){return sendNotification(![],_0x5e69e2,_0x21c57e,_0x4281ea,_0x226153,_0x406140);};exports[_0xa3f8('0x2d')]=writeLog; \ No newline at end of file +var _0x7ee1=['info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','ioredis','../../../../../config/environment','../../../../../config/logger','redis','defaults','localhost','format','name','emit','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','user:%s','save'];(function(_0x5e97b7,_0x135f4d){var _0x3b7a89=function(_0x12c22d){while(--_0x12c22d){_0x5e97b7['push'](_0x5e97b7['shift']());}};_0x3b7a89(++_0x135f4d);}(_0x7ee1,0x8d));var _0x17ee=function(_0x135508,_0x31c75b){_0x135508=_0x135508-0x0;var _0x669482=_0x7ee1[_0x135508];return _0x669482;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var utils=require('../utils');var Mustache=require('mustache');var Redis=require(_0x17ee('0x1'));var config=require(_0x17ee('0x2'));var logger=require(_0x17ee('0x3'))('routing');config[_0x17ee('0x4')]=_[_0x17ee('0x5')](config[_0x17ee('0x4')],{'host':_0x17ee('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x17ee('0x4')]));function emit(_0x29b9eb,_0x54b4f6,_0x3f61af){io['to'](_0x29b9eb)['emit'](_0x54b4f6,_0x3f61af);}function sendNotification(_0x3d767b,_0xfa5096,_0x2c961f,_0x4af369,_0x4b6374,_0x4d6bb5){io['to'](util[_0x17ee('0x7')]('user:%s',_0x4af369[_0x17ee('0x8')]))[_0x17ee('0x9')](_0x17ee('0xa'),_0x4af369);var _0x3d4f0f=_0x4d6bb5||{};var _0x57fae0=_0x2c961f[_0x17ee('0xb')]('.');var _0x51b5d9={'uniqueid':_0xfa5096,'channel':_0x57fae0[0x0],'id':_0x57fae0[0x1],'title':_0x57fae0[0x0]+_0x17ee('0xc'),'interactionId':_0x57fae0[0x2],'queue':_0x4b6374?_0x4b6374[_0x17ee('0x8')]:null,'sound':_0x3d4f0f[_0x17ee('0xd')][_0x17ee('0xe')],'shake':_0x3d4f0f[_0x17ee('0xd')][_0x17ee('0xf')]};try{if(!_0x3d4f0f[_0x17ee('0x10')]){_0x3d4f0f[_0x17ee('0x10')]={};}if(_0x4b6374){_0x3d4f0f[_0x17ee('0x10')][_0x17ee('0x11')]=_0x4b6374;}else if(_0x3d4f0f[_0x17ee('0x10')]['queue']){delete _0x3d4f0f['body']['queue'];}_0x51b5d9['msg']=utils[_0x17ee('0x12')](_0x3d4f0f[_0x17ee('0xd')][_0x17ee('0x13')],_0x3d4f0f);}catch(_0x2e2287){_0x51b5d9[_0x17ee('0x14')]=_0x17ee('0x15');logger[_0x17ee('0x16')](util['format'](_0x17ee('0x17'),_0xfa5096,_0x2e2287[_0x17ee('0x18')]));}io['to'](util[_0x17ee('0x7')](_0x17ee('0x19'),_0x4af369[_0x17ee('0x8')]))['emit'](util[_0x17ee('0x7')]('notification:%s',_0x3d767b?_0x17ee('0x1a'):'remove'),_0x51b5d9);}function writeLog(_0x1f4956,_0x343f1b,_0x2ee1b6){return logger[_0x17ee('0x1b')](util[_0x17ee('0x7')](_0x17ee('0x1c'),_0x1f4956,_0x343f1b[_0x17ee('0x8')],_0x2ee1b6));}exports[_0x17ee('0x1d')]=function(_0x1425e5,_0x1f3d6d,_0x37fe4e,_0x4d2d91){if(_0x1f3d6d['busy']){writeLog(_0x1425e5,_0x1f3d6d,_0x17ee('0x1e'));return![];}if(!_0x1f3d6d[_0x17ee('0x1f')]){writeLog(_0x1425e5,_0x1f3d6d,_0x17ee('0x20'));return![];}if(_0x1f3d6d[_0x37fe4e+_0x17ee('0x21')]){writeLog(_0x1425e5,_0x1f3d6d,_0x17ee('0x22'));return![];}if(_0x4d2d91&&_0x1f3d6d[_0x17ee('0x23')](_0x37fe4e+_0x17ee('0x24'))&&_0x1f3d6d[_0x17ee('0x23')](_0x37fe4e+_0x17ee('0x25'))){if(_0x1f3d6d[_0x37fe4e+_0x17ee('0x24')]>0x0&&_0x1f3d6d[_0x37fe4e+_0x17ee('0x25')]>=_0x1f3d6d[_0x37fe4e+_0x17ee('0x24')]){writeLog(_0x1425e5,_0x1f3d6d,_0x37fe4e['toUpperCase']()+_0x17ee('0x26'));return![];}}return!![];};exports[_0x17ee('0x27')]=function(_0x11ce7e,_0x258018,_0x125513,_0x51a561,_0x38237c){return sendNotification(!![],_0x11ce7e,_0x258018,_0x125513,_0x51a561,_0x38237c);};exports[_0x17ee('0x28')]=function(_0x295186,_0x4c461b,_0x2220cb,_0x27ab38,_0x56c6ba){return sendNotification(![],_0x295186,_0x4c461b,_0x2220cb,_0x27ab38,_0x56c6ba);};exports[_0x17ee('0x29')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index d1a6904..e151edc 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 _0x567f=['[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isEmpty','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','stringify','validate','shelljs','lodash','../../../../config/logger','routing','string','consequence','error'];(function(_0x357076,_0x355fe4){var _0x31de15=function(_0x4db804){while(--_0x4db804){_0x357076['push'](_0x357076['shift']());}};_0x31de15(++_0x355fe4);}(_0x567f,0x123));var _0xf567=function(_0x2e8a70,_0x43d2b0){_0x2e8a70=_0x2e8a70-0x0;var _0x1ffcdf=_0x567f[_0x2e8a70];return _0x1ffcdf;};'use strict';var schema=require(_0xf567('0x0'));var sh=require(_0xf567('0x1'));var _=require(_0xf567('0x2'));var utils=require('./utils');var logger=require(_0xf567('0x3'))(_0xf567('0x4'));var system=schema({'command':{'type':_0xf567('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xf567('0x6')]=function(_0x3763a8,_0x30a7ff){return function(_0x33521c){try{var _0x52cf79={'command':_0x30a7ff[0x0]};var _0x28c81f=system['validate'](_0x52cf79,{'typecast':!![]});if(_0x28c81f['length']){logger[_0xf567('0x7')](_0xf567('0x8'),_0x3763a8,_[_0xf567('0x9')](_0x28c81f,_0xf567('0xa'))[_0xf567('0xb')](',\x20'));logger[_0xf567('0xc')](_0xf567('0xd'),_0x3763a8);_0x33521c[_0xf567('0xe')]();}else{var _0x4c7aa7=this;var _0x48677b=utils['getMustacheRender'](_0x30a7ff[0x0],this);logger['info'](_0xf567('0xf'),_0x3763a8,_0x48677b);sh['exec'](_[_0xf567('0x10')](_0x48677b),function(_0x532ede,_0x5a2cbc){logger[_0xf567('0xc')](_0xf567('0x11'),_0x3763a8,_0x532ede);if(_0x532ede==0x0){var _0x19c7c1=_0x5a2cbc['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x30a7ff[0x1])||_[_0xf567('0x12')](_0x30a7ff[0x1])){logger[_0xf567('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x3763a8);_0x4c7aa7['body'][_0x30a7ff[0x1]]=_0x19c7c1;}else{logger[_0xf567('0xc')](_0xf567('0x13'),_0x3763a8,_0x30a7ff[0x1],_0x19c7c1);_0x4c7aa7[_0xf567('0x14')][_0x30a7ff[0x1]]=_0x19c7c1;}}_0x33521c['next']();});}}catch(_0x532db4){logger[_0xf567('0x7')](_0xf567('0x8'),_0x3763a8,_[_0xf567('0x15')](_0x532db4)?JSON[_0xf567('0x16')](_0x532db4):_0x532db4);logger[_0xf567('0xc')](_0xf567('0xd'),_0x3763a8);_0x33521c['next']();}};}; \ No newline at end of file +var _0x34d2=['exec','trim','info','[%s][SYSTEM]\x20result\x20code:\x20%s','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','map','message','join'];(function(_0x15579f,_0x581994){var _0x49fbf9=function(_0xee8216){while(--_0xee8216){_0x15579f['push'](_0x15579f['shift']());}};_0x49fbf9(++_0x581994);}(_0x34d2,0x7b));var _0x234d=function(_0x5667ed,_0x2d4bf1){_0x5667ed=_0x5667ed-0x0;var _0x240cf1=_0x34d2[_0x5667ed];return _0x240cf1;};'use strict';var schema=require('validate');var sh=require(_0x234d('0x0'));var _=require(_0x234d('0x1'));var utils=require(_0x234d('0x2'));var logger=require(_0x234d('0x3'))(_0x234d('0x4'));var system=schema({'command':{'type':_0x234d('0x5'),'required':!![],'message':_0x234d('0x6')}});exports[_0x234d('0x7')]=function(_0x5d3170,_0x7a4915){return function(_0xd287f){try{var _0x5dfaf4={'command':_0x7a4915[0x0]};var _0x244090=system[_0x234d('0x8')](_0x5dfaf4,{'typecast':!![]});if(_0x244090[_0x234d('0x9')]){logger[_0x234d('0xa')](_0x234d('0xb'),_0x5d3170,_[_0x234d('0xc')](_0x244090,_0x234d('0xd'))[_0x234d('0xe')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5d3170);_0xd287f['next']();}else{var _0x4f6810=this;var _0x50fdaa=utils['getMustacheRender'](_0x7a4915[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x5d3170,_0x50fdaa);sh[_0x234d('0xf')](_[_0x234d('0x10')](_0x50fdaa),function(_0xf6f3a3,_0xd23bfb){logger[_0x234d('0x11')](_0x234d('0x12'),_0x5d3170,_0xf6f3a3);if(_0xf6f3a3==0x0){var _0x5ce859=_0xd23bfb['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x7a4915[0x1])||_['isEmpty'](_0x7a4915[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x5d3170);_0x4f6810[_0x234d('0x13')][_0x7a4915[0x1]]=_0x5ce859;}else{logger[_0x234d('0x11')](_0x234d('0x14'),_0x5d3170,_0x7a4915[0x1],_0x5ce859);_0x4f6810['body'][_0x7a4915[0x1]]=_0x5ce859;}}_0xd287f[_0x234d('0x15')]();});}}catch(_0x2094e5){logger[_0x234d('0xa')]('[%s][SYSTEM]\x20%s',_0x5d3170,_['isObject'](_0x2094e5)?JSON['stringify'](_0x2094e5):_0x2094e5);logger['info'](_0x234d('0x16'),_0x5d3170);_0xd287f[_0x234d('0x15')]();}};}; \ 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 868c7f0..aae10c2 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 _0x239b=['../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][TAG]\x20%s','map','message','next','channel','Interaction','addTags','interaction','then','info','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x239b,0x1e9));var _0xb239=function(_0x1ac7f5,_0x470d33){_0x1ac7f5=_0x1ac7f5-0x0;var _0x2821e0=_0x239b[_0x1ac7f5];return _0x2821e0;};'use strict';var schema=require(_0xb239('0x0'));var _=require(_0xb239('0x1'));var rpc={'chatInteraction':require(_0xb239('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xb239('0x3')),'mailInteraction':require(_0xb239('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xb239('0x5'))};var logger=require(_0xb239('0x6'))(_0xb239('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xb239('0x8')}});exports['consequence']=function(_0x56eccd,_0x312fbf,_0x360278,_0x1d7078){return function(_0x28e787){try{var _0x528025={'tag':_0x312fbf[0x0]};var _0x46b867=tag[_0xb239('0x0')](_0x528025,{'typecast':!![]});if(_0x46b867[_0xb239('0x9')]){logger[_0xb239('0xa')](_0xb239('0xb'),_0x56eccd,_[_0xb239('0xc')](_0x46b867,_0xb239('0xd'))['join'](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x56eccd);_0x28e787[_0xb239('0xe')]();}else{var _0x1f5795={'ids':[_0x312fbf[0x0]]};if(rpc[_0x1d7078[_0xb239('0xf')]+'Interaction']){rpc[_0x1d7078['channel']+_0xb239('0x10')][_0xb239('0x11')](_0x1d7078[_0xb239('0x12')]['id'],_0x1f5795)[_0xb239('0x13')](function(_0x3d466b){logger[_0xb239('0x14')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x56eccd,_0x312fbf[0x1],_0x1d7078[_0xb239('0xf')],_0x1d7078[_0xb239('0x12')]['id']);})[_0xb239('0x15')](function(_0xca5b15){logger[_0xb239('0xa')](_0xb239('0xb'),_0x56eccd,JSON[_0xb239('0x16')](_0xca5b15));logger['info'](_0xb239('0x17'),_0x56eccd);})[_0xb239('0x18')](function(){_0x28e787[_0xb239('0xe')]();});}}}catch(_0x3cf7eb){logger[_0xb239('0xa')](_0xb239('0xb'),_0x56eccd,_[_0xb239('0x19')](_0x3cf7eb)?JSON[_0xb239('0x16')](_0x3cf7eb):_0x3cf7eb);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x56eccd);_0x28e787['next']();}};}; \ No newline at end of file +var _0xf1b3=['join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','next','stringify','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','error','[%s][TAG]\x20%s','message'];(function(_0x6aea9b,_0x2de4aa){var _0x477dc4=function(_0xc1545f){while(--_0xc1545f){_0x6aea9b['push'](_0x6aea9b['shift']());}};_0x477dc4(++_0x2de4aa);}(_0xf1b3,0x89));var _0x3f1b=function(_0x5ee5a7,_0x4b3d9d){_0x5ee5a7=_0x5ee5a7-0x0;var _0x364c51=_0xf1b3[_0x5ee5a7];return _0x364c51;};'use strict';var schema=require('validate');var _=require(_0x3f1b('0x0'));var rpc={'chatInteraction':require(_0x3f1b('0x1')),'openchannelInteraction':require(_0x3f1b('0x2')),'smsInteraction':require(_0x3f1b('0x3')),'mailInteraction':require(_0x3f1b('0x4')),'faxInteraction':require(_0x3f1b('0x5')),'whatsappInteraction':require(_0x3f1b('0x6'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0x3f1b('0x7'),'required':!![],'message':_0x3f1b('0x8')}});exports['consequence']=function(_0x2917ef,_0x10a644,_0x1736c0,_0x97efff){return function(_0x4233b1){try{var _0x24e397={'tag':_0x10a644[0x0]};var _0xa7a24e=tag[_0x3f1b('0x9')](_0x24e397,{'typecast':!![]});if(_0xa7a24e['length']){logger[_0x3f1b('0xa')](_0x3f1b('0xb'),_0x2917ef,_['map'](_0xa7a24e,_0x3f1b('0xc'))[_0x3f1b('0xd')](',\x20'));logger[_0x3f1b('0xe')](_0x3f1b('0xf'),_0x2917ef);_0x4233b1['next']();}else{var _0x295db3={'ids':[_0x10a644[0x0]]};if(rpc[_0x97efff[_0x3f1b('0x10')]+_0x3f1b('0x11')]){rpc[_0x97efff[_0x3f1b('0x10')]+_0x3f1b('0x11')][_0x3f1b('0x12')](_0x97efff[_0x3f1b('0x13')]['id'],_0x295db3)[_0x3f1b('0x14')](function(_0x37abc1){logger['info'](_0x3f1b('0x15'),_0x2917ef,_0x10a644[0x1],_0x97efff[_0x3f1b('0x10')],_0x97efff[_0x3f1b('0x13')]['id']);})[_0x3f1b('0x16')](function(_0x37d776){logger['error'](_0x3f1b('0xb'),_0x2917ef,JSON['stringify'](_0x37d776));logger[_0x3f1b('0xe')](_0x3f1b('0xf'),_0x2917ef);})['finally'](function(){_0x4233b1[_0x3f1b('0x17')]();});}}}catch(_0x4ab6d3){logger['error'](_0x3f1b('0xb'),_0x2917ef,_['isObject'](_0x4ab6d3)?JSON[_0x3f1b('0x18')](_0x4ab6d3):_0x4ab6d3);logger[_0x3f1b('0xe')](_0x3f1b('0xf'),_0x2917ef);_0x4233b1[_0x3f1b('0x17')]();}};}; \ 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 96e6025..9f91400 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 _0xbd0d=['replace','includes','push','?params=','urlOnRing','jsonrpc','method','login','stringify','utf8','POST','application/json-rpc','result','logged','channelId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','\x20-\x20'];(function(_0x593467,_0x14e615){var _0x67a71b=function(_0x32799e){while(--_0x32799e){_0x593467['push'](_0x593467['shift']());}};_0x67a71b(++_0x14e615);}(_0xbd0d,0xef));var _0xdbd0=function(_0x371a1d,_0x30cf66){_0x371a1d=_0x371a1d-0x0;var _0x40afb9=_0xbd0d[_0x371a1d];return _0x40afb9;};'use strict';var rp=require(_0xdbd0('0x0'));var logger=require(_0xdbd0('0x1'))(_0xdbd0('0x2'));var _=require('lodash');var arr=[];exports['consequence']=function(_0x219fc6,_0x21dbaa){return function(_0x16c54d){var _0x1fcd03=_0x21dbaa[0xa];var _0x5c9171=_0x21dbaa[0xb];var _0x305761=_0x21dbaa[0xc];var _0x517cfa=_0x21dbaa[0xd];var _0x212625=_0x21dbaa[0xe];var _0x3e980e=_0x21dbaa[0xf]['replace'](/\n/g,_0xdbd0('0x3'));var _0x354483=_0x21dbaa[0x10][_0xdbd0('0x4')](/\n/g,'\x20');if(!arr[_0xdbd0('0x5')](_0x5c9171)){arr[_0xdbd0('0x6')](_0x5c9171);var _0x598ae5=_0x21dbaa[0x3];var _0x98274a=_0x21dbaa[0x4];var _0x13fb0a=_0x21dbaa[0x1];var _0xcf2e3e=_0x21dbaa[0x0];var _0x3bcd81={};_0x3bcd81['urlOnAnswer']=_0x21dbaa[0x8]+_0xdbd0('0x7')+_0x305761+'|'+_0x1fcd03+'|'+_0x517cfa+'|'+_0x5c9171+'|'+_0x212625;_0x3bcd81[_0xdbd0('0x8')]=_0x21dbaa[0x7]+'?params='+_0x305761+'|'+_0x1fcd03+'|'+_0x517cfa+'|'+_0x5c9171+'|'+_0x212625+'|'+_0x3e980e+'|'+_0x354483;_0x3bcd81['title']=_0x21dbaa[0x9];var _0x5470fc={};_0x5470fc[_0xdbd0('0x9')]='2.0';_0x5470fc[_0xdbd0('0xa')]=_0xdbd0('0xb');var _0x38ba63=[];_0x38ba63[_0xdbd0('0x6')](_0x21dbaa[0x2]);_0x38ba63[_0xdbd0('0x6')](_0x21dbaa[0x5]);_0x38ba63[_0xdbd0('0x6')](_0x21dbaa[0x6]);_0x5470fc['params']=_0x38ba63;_0x5470fc['id']=0x1;var _0x1dda08=JSON[_0xdbd0('0xc')](_0x5470fc);var _0x352493={'encoding':_0xdbd0('0xd'),'method':_0xdbd0('0xe'),'timeout':0x2710,'url':_0x598ae5,'headers':{'Content-Type':_0xdbd0('0xf')},'body':_0x1dda08};return rp(_0x352493)['then'](function(_0x47af04){const _0x554995=JSON['parse'](_0x47af04);if(!_0x554995[_0xdbd0('0x10')][_0xdbd0('0x11')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0xb7a55=_0x5c9171;var _0x11e6ca=_0xdbd0('0x12')+_0x13fb0a+'&serviceId='+_0xcf2e3e+_0xdbd0('0x13')+_0xb7a55+_0xdbd0('0x14')+JSON[_0xdbd0('0xc')](_0x3bcd81);var _0x3acb53=_0x98274a+'?'+_0x11e6ca;return rp(_0x3acb53);})['then'](function(_0x5da108){logger['info'](_0xdbd0('0x15'),_0x219fc6,_0x5da108);_0x16c54d[_0xdbd0('0x16')]();})[_0xdbd0('0x17')](function(_0x300723){logger[_0xdbd0('0x18')]('[%s][TVOX]\x20%s',_0x219fc6,_['isObject'](_0x300723)?JSON[_0xdbd0('0xc')](_0x300723):_0x300723);_0x16c54d[_0xdbd0('0x16')]();});}else{logger['info'](_0xdbd0('0x19'),_0x219fc6);_0x16c54d[_0xdbd0('0x1a')]();}};}; \ No newline at end of file +var _0xc8d4=['logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','method','login','params','utf8','POST','application/json-rpc','then','parse','result'];(function(_0xec5337,_0x432482){var _0x57b2b4=function(_0x49c22b){while(--_0x49c22b){_0xec5337['push'](_0xec5337['shift']());}};_0x57b2b4(++_0x432482);}(_0xc8d4,0x1ca));var _0x4c8d=function(_0x15710c,_0x77eb2d){_0x15710c=_0x15710c-0x0;var _0x41b8ed=_0xc8d4[_0x15710c];return _0x41b8ed;};'use strict';var rp=require(_0x4c8d('0x0'));var logger=require(_0x4c8d('0x1'))(_0x4c8d('0x2'));var _=require(_0x4c8d('0x3'));var arr=[];exports[_0x4c8d('0x4')]=function(_0x2fc8d5,_0x52f499){return function(_0xfa0217){var _0x377a39=_0x52f499[0xa];var _0xe1111b=_0x52f499[0xb];var _0x272eb3=_0x52f499[0xc];var _0x221ed8=_0x52f499[0xd];var _0x41550b=_0x52f499[0xe];var _0xbae47f=_0x52f499[0xf][_0x4c8d('0x5')](/\n/g,_0x4c8d('0x6'));var _0x3dd03f=_0x52f499[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x4c8d('0x7')](_0xe1111b)){arr[_0x4c8d('0x8')](_0xe1111b);var _0x5884fb=_0x52f499[0x3];var _0x253752=_0x52f499[0x4];var _0x16d1d7=_0x52f499[0x1];var _0x201345=_0x52f499[0x0];var _0x3b0c6a={};_0x3b0c6a[_0x4c8d('0x9')]=_0x52f499[0x8]+_0x4c8d('0xa')+_0x272eb3+'|'+_0x377a39+'|'+_0x221ed8+'|'+_0xe1111b+'|'+_0x41550b;_0x3b0c6a[_0x4c8d('0xb')]=_0x52f499[0x7]+_0x4c8d('0xa')+_0x272eb3+'|'+_0x377a39+'|'+_0x221ed8+'|'+_0xe1111b+'|'+_0x41550b+'|'+_0xbae47f+'|'+_0x3dd03f;_0x3b0c6a['title']=_0x52f499[0x9];var _0xf4c115={};_0xf4c115[_0x4c8d('0xc')]=_0x4c8d('0xd');_0xf4c115[_0x4c8d('0xe')]=_0x4c8d('0xf');var _0x4b3a37=[];_0x4b3a37[_0x4c8d('0x8')](_0x52f499[0x2]);_0x4b3a37[_0x4c8d('0x8')](_0x52f499[0x5]);_0x4b3a37[_0x4c8d('0x8')](_0x52f499[0x6]);_0xf4c115[_0x4c8d('0x10')]=_0x4b3a37;_0xf4c115['id']=0x1;var _0x576d27=JSON['stringify'](_0xf4c115);var _0x545183={'encoding':_0x4c8d('0x11'),'method':_0x4c8d('0x12'),'timeout':0x2710,'url':_0x5884fb,'headers':{'Content-Type':_0x4c8d('0x13')},'body':_0x576d27};return rp(_0x545183)[_0x4c8d('0x14')](function(_0xacb7c9){const _0x997966=JSON[_0x4c8d('0x15')](_0xacb7c9);if(!_0x997966[_0x4c8d('0x16')][_0x4c8d('0x17')]){throw new Error(_0x4c8d('0x18'));}var _0x151c9e=_0xe1111b;var _0x36c51a=_0x4c8d('0x19')+_0x16d1d7+_0x4c8d('0x1a')+_0x201345+'&sessionId='+_0x151c9e+'&data='+JSON[_0x4c8d('0x1b')](_0x3b0c6a);var _0x42a17d=_0x253752+'?'+_0x36c51a;return rp(_0x42a17d);})[_0x4c8d('0x14')](function(_0x5b2981){logger[_0x4c8d('0x1c')](_0x4c8d('0x1d'),_0x2fc8d5,_0x5b2981);_0xfa0217['stop']();})[_0x4c8d('0x1e')](function(_0x59e292){logger[_0x4c8d('0x1f')](_0x4c8d('0x20'),_0x2fc8d5,_[_0x4c8d('0x21')](_0x59e292)?JSON[_0x4c8d('0x1b')](_0x59e292):_0x59e292);_0xfa0217[_0x4c8d('0x22')]();});}else{logger[_0x4c8d('0x1c')](_0x4c8d('0x23'),_0x2fc8d5);_0xfa0217[_0x4c8d('0x24')]();}};}; \ 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 7ba3a95..7ac0a67 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x5ba35e,_0x47d75f){var _0x2c540a=function(_0x243030){while(--_0x243030){_0x5ba35e['push'](_0x5ba35e['shift']());}};_0x2c540a(++_0x47d75f);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x4b5ad7,_0x32598f){var _0x214333=function(_0x4da9c4){while(--_0x4da9c4){_0x4b5ad7['push'](_0x4b5ad7['shift']());}};_0x214333(++_0x32598f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 3e70470..b0a519b 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 _0xac4a=['UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','isArray','applications','length','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','dialogflow','slice','dialogflowv2','tag','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','./interval','condition','./applications/','consequence','priority','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','info','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport'];(function(_0x4eb901,_0x33eea1){var _0x55f0ae=function(_0x415c80){while(--_0x415c80){_0x4eb901['push'](_0x4eb901['shift']());}};_0x55f0ae(++_0x33eea1);}(_0xac4a,0x13f));var _0xaac4=function(_0x33470d,_0x2483df){_0x33470d=_0x33470d-0x0;var _0x4e8df2=_0xac4a[_0x33470d];return _0x4e8df2;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var fs=require('fs');var jayson=require(_0xaac4('0x3'));var BPromise=require(_0xaac4('0x4'));var uuid=require(_0xaac4('0x5'));var utils=require('./applications/utils');var config=require('../../../config/environment');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var rpc={'openchannelQueueReport':require(_0xaac4('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xaac4('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xaac4('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xaac4('0xb'));function getId(_0x27354c,_0x567295,_0x5cfc1b){return util[_0xaac4('0xc')]('%s.%s.%s',_0x27354c,_0x567295||0x0,_0x5cfc1b||0x0);}function getIntervals(_0x452573,_0x59b992){var _0x4f4c84=[];if(!_[_0xaac4('0xd')](_0x59b992[_0xaac4('0xe')])&&!_[_0xaac4('0xd')](_0x452573[_0x59b992[_0xaac4('0xe')]])&&!_[_0xaac4('0xd')](_0x452573[_0x59b992['IntervalId']]['Intervals'])){_0x4f4c84=_[_0xaac4('0xf')](_0x452573[_0x59b992[_0xaac4('0xe')]][_0xaac4('0x10')],'interval');}else if(!_[_0xaac4('0xd')](_0x59b992[_0xaac4('0x11')])){_0x4f4c84=[_0x59b992['interval']];}return _0x4f4c84;}exports[_0xaac4('0x12')]=function(_0x2b20d0){_0x2b20d0[_0xaac4('0x13')]={};return new BPromise(function(_0x150fdd,_0x187624){var _0x2fbeb7={'Start':function(_0x31b7e5){var _0x1df9ae=this;return new Promise(function(_0x233278,_0xb8466e){if(_0x31b7e5){try{var _0x35bc32=[];var _0x1766c2=getId(_0x31b7e5[_0xaac4('0x14')],_0x31b7e5['message']?_0x31b7e5[_0xaac4('0x15')]['id']:0x0,_0x31b7e5['interaction']?_0x31b7e5[_0xaac4('0x16')]['id']:0x0);if(_0x31b7e5['applications']&&_[_0xaac4('0x17')](_0x31b7e5[_0xaac4('0x18')])&&_0x31b7e5[_0xaac4('0x18')][_0xaac4('0x19')]){for(var _0x3cbcb1=0x0;_0x3cbcb1<_0x31b7e5[_0xaac4('0x18')][_0xaac4('0x19')];_0x3cbcb1+=0x1){var _0x25b946=_0x31b7e5[_0xaac4('0x18')][_0x3cbcb1];if(fs['existsSync'](path[_0xaac4('0x1a')](__dirname,'applications',_0x25b946[_0xaac4('0x1b')]+_0xaac4('0x1c')))){var _0x43625c=[];switch(_0x25b946[_0xaac4('0x1b')][_0xaac4('0x1d')]()){case _0xaac4('0x1e'):var _0x590905=_0x25b946[_0xaac4('0x1f')][_0xaac4('0x20')](',');if(_0x31b7e5[_0xaac4('0x14')]===_0xaac4('0x21')){_0x43625c[_0xaac4('0x22')](_0x590905[0x0]);_0x43625c[_0xaac4('0x22')](_0x590905[0x1]);_0x43625c[_0xaac4('0x22')](_0x590905['slice'](0x2,_0x590905[_0xaac4('0x19')])['join'](','));}else{_0x43625c['push'](_0x590905[0x0]);_0x43625c['push'](_0x590905['slice'](0x1,_0x590905[_0xaac4('0x19')])[_0xaac4('0x1a')](','));}break;case _0xaac4('0x23'):var _0xe93120=_0x25b946[_0xaac4('0x1f')][_0xaac4('0x20')](',');_0x43625c[_0xaac4('0x22')](_0xe93120[0x0]);_0x43625c[_0xaac4('0x22')](_0xe93120[0x1]);_0x43625c[_0xaac4('0x22')](_0xe93120[_0xaac4('0x24')](0x2,_0xe93120['length'])[_0xaac4('0x1a')](','));break;case _0xaac4('0x25'):var _0xda10b6=_0x25b946[_0xaac4('0x1f')][_0xaac4('0x20')](',');_0x43625c[_0xaac4('0x22')](_0xda10b6[0x0]);_0x43625c['push'](_0xda10b6[0x1]);_0x43625c[_0xaac4('0x22')](_0xda10b6[0x2]);_0x43625c['push'](_0xda10b6[0x3]);_0x43625c[_0xaac4('0x22')](_0xda10b6[_0xaac4('0x24')](0x4,_0xda10b6[_0xaac4('0x19')])[_0xaac4('0x1a')](','));break;case'amazonlex':var _0x5000e1=_0x25b946['appdata'][_0xaac4('0x20')](',');_0x43625c[_0xaac4('0x22')](_0x5000e1[0x0]);_0x43625c[_0xaac4('0x22')](_0x5000e1[0x1]);_0x43625c[_0xaac4('0x22')](_0x5000e1[0x2]);_0x43625c[_0xaac4('0x22')](_0x5000e1[0x3]);_0x43625c[_0xaac4('0x22')](_0x5000e1[_0xaac4('0x24')](0x4,_0x5000e1[_0xaac4('0x19')])[_0xaac4('0x1a')](','));break;case _0xaac4('0x15'):_0x43625c[_0xaac4('0x22')](_0x25b946[_0xaac4('0x1f')]);break;case _0xaac4('0x26'):_0x43625c[_0xaac4('0x22')](_0x25b946[_0xaac4('0x27')]);_0x43625c['push'](_0x25b946['appdata']);break;case _0xaac4('0x28'):var _0x40f64b=utils[_0xaac4('0x29')](_0x31b7e5['account'][_0xaac4('0x2a')],_0x31b7e5);var _0x16fae8=_0x25b946[_0xaac4('0x1f')][_0xaac4('0x20')](',');_0x43625c[_0xaac4('0x22')](_0x16fae8[0x0]);_0x43625c[_0xaac4('0x22')](_0x16fae8[0x1]);_0x43625c[_0xaac4('0x22')](_0x16fae8[0x2]);_0x43625c['push'](_0x16fae8[0x3]);_0x43625c[_0xaac4('0x22')](_0x16fae8[0x4]);_0x43625c[_0xaac4('0x22')](_0x16fae8[0x5]);_0x43625c[_0xaac4('0x22')](_0x16fae8[0x6]);_0x43625c['push'](_0x16fae8[0x7]);_0x43625c[_0xaac4('0x22')](_0x16fae8[0x8]);_0x43625c['push'](_0x16fae8[0x9]);_0x43625c['push'](_0x16fae8[0xa]);_0x43625c[_0xaac4('0x22')](_0x31b7e5[_0xaac4('0x16')]['id']);_0x43625c[_0xaac4('0x22')](_0x31b7e5['message']['id']);_0x43625c['push'](_0x25b946[_0xaac4('0x2b')]);_0x43625c[_0xaac4('0x22')](_0x31b7e5[_0xaac4('0x16')][_0xaac4('0x2c')]);_0x43625c[_0xaac4('0x22')](_0x31b7e5[_0xaac4('0x2d')]['body']);_0x43625c['push'](_0x40f64b);break;default:_0x43625c=_[_0xaac4('0xd')](_0x25b946[_0xaac4('0x1f')])?[]:_0x25b946['appdata'][_0xaac4('0x20')](',');}var _0xdea3a0={'id':util[_0xaac4('0xc')]('%s:%s:%s',_0x1766c2,_0x25b946['id'],_0x25b946[_0xaac4('0x1b')]),'condition':require(_0xaac4('0x2e'))[_0xaac4('0x2f')](_0x1766c2,getIntervals(_0x2b20d0['intervals'],_0x25b946),_0x2b20d0),'consequence':require(_0xaac4('0x30')+_0x25b946[_0xaac4('0x1b')])[_0xaac4('0x31')](_0x1766c2,_0x43625c,_0x2b20d0,_0x31b7e5),'p':_0x25b946[_0xaac4('0x32')]||0x0};logger['info'](_0xaac4('0x33'),_0xdea3a0['id'],'on\x20interval',getIntervals(_0x2b20d0['intervals'],_0x25b946)[_0xaac4('0x1a')](_0xaac4('0x34')));_0x35bc32[_0xaac4('0x22')](_0xdea3a0);}else{logger[_0xaac4('0x35')](_0xaac4('0x36'),path[_0xaac4('0x1a')](__dirname,_0xaac4('0x18'),_0x25b946[_0xaac4('0x1b')]+'.js'));}}_0x2b20d0[_0xaac4('0x13')][_0x1766c2]=new RuleEngine(_0x35bc32);_0x2b20d0[_0xaac4('0x13')][_0x1766c2][_0xaac4('0x37')](_0x31b7e5,function(_0x2bba0c){logger['info'](_0xaac4('0x38'),JSON[_0xaac4('0x39')](_0x2bba0c[_0xaac4('0x3a')]));if(_0x2b20d0['rules'][_0x1766c2]){_0x2b20d0[_0xaac4('0x13')][_0x1766c2][_0xaac4('0x3b')](_0xaac4('0x3c'));}});return _0x233278({'code':0xc8,'message':_0x31b7e5});}else{logger[_0xaac4('0x3d')]('No\x20applications\x20to\x20execute');return _0x233278({'code':0xc8,'message':_0x31b7e5});}}catch(_0x10047d){logger[_0xaac4('0x35')](_0x10047d[_0xaac4('0x3e')]);return _0xb8466e(_0x1df9ae['error'](0x1f4,_0x10047d));}}return _0xb8466e(_0xaac4('0x3f'));});},'AcceptMessage':function(_0x2e9a33){var _0x42e0dc=this;return new Promise(function(_0xf9c1e1,_0x2e7ed3){if(_0x2e9a33[_0xaac4('0x40')]&&_0x2e9a33[_0xaac4('0x40')]['id']){if(_0x2b20d0[_0xaac4('0x41')][_0x2e9a33[_0xaac4('0x40')]['id']]){_0x2b20d0['agents'][_0x2e9a33[_0xaac4('0x40')]['id']][_0xaac4('0x42')]=![];_0x2b20d0[_0xaac4('0x41')][_0x2e9a33[_0xaac4('0x40')]['id']][_0xaac4('0x43')]=undefined;}}if(_0x2e9a33['message']&&_0x2e9a33['message']['id']){try{var _0x17821f=getId(_0x2e9a33[_0xaac4('0x14')],_0x2e9a33[_0xaac4('0x15')]?_0x2e9a33[_0xaac4('0x15')]['id']:0x0,_0x2e9a33['interaction']?_0x2e9a33[_0xaac4('0x16')]['id']:0x0);if(_0x2b20d0['rules'][_0x17821f]){_0x2b20d0[_0xaac4('0x13')][_0x17821f][_0xaac4('0x3b')]('end');if(rpc[_0x2e9a33[_0xaac4('0x14')]+_0xaac4('0x44')]){rpc[_0x2e9a33[_0xaac4('0x14')]+'QueueReport']['update'](_0x17821f,{'UserId':_0x2e9a33[_0xaac4('0x15')][_0xaac4('0x45')]})[_0xaac4('0x46')](function(_0xb32d1d){logger[_0xaac4('0x35')](_0xaac4('0x47'));});}}return _0xf9c1e1({'code':0xc8,'message':_0x2e9a33});}catch(_0x512a0c){logger[_0xaac4('0x35')](_0x512a0c[_0xaac4('0x3e')]);return _0x2e7ed3(_0x42e0dc[_0xaac4('0x35')](0x1f4,_0x512a0c));}}logger[_0xaac4('0x35')]('message\x20is\x20empty');return _0x2e7ed3(_0x42e0dc[_0xaac4('0x35')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x33e32f){var _0x3a703c=this;return new Promise(function(_0x460252,_0x3922a0){if(_0x33e32f[_0xaac4('0x40')]&&_0x33e32f[_0xaac4('0x40')]['id']){try{if(_0x2b20d0[_0xaac4('0x41')][_0x33e32f[_0xaac4('0x40')]['id']]){_0x2b20d0[_0xaac4('0x41')][_0x33e32f[_0xaac4('0x40')]['id']][_0xaac4('0x42')]=![];_0x2b20d0[_0xaac4('0x41')][_0x33e32f[_0xaac4('0x40')]['id']][_0xaac4('0x43')]=undefined;}return _0x460252({'code':0xc8,'message':_0x33e32f});}catch(_0x4ede1e){logger[_0xaac4('0x35')](_0x4ede1e[_0xaac4('0x3e')]);return _0x3922a0(_0x3a703c[_0xaac4('0x35')](0x1f4,_0x4ede1e));}}logger[_0xaac4('0x35')](_0xaac4('0x48'));return _0x3922a0(_0x3a703c[_0xaac4('0x35')](0x1f4,_0xaac4('0x48')));});},'AbandonInteraction':function(_0x46082d){var _0x5e8928=this;return new Promise(function(_0x3d7ccc,_0x501664){if(_0x46082d[_0xaac4('0x14')]&&_0x46082d['interaction']&&_0x46082d[_0xaac4('0x16')]['id']){try{var _0x5d56ae=getId(_0x46082d['channel'],_0x46082d[_0xaac4('0x15')]?_0x46082d[_0xaac4('0x15')]['id']:0x0,_0x46082d['interaction']?_0x46082d[_0xaac4('0x16')]['id']:0x0);if(_0x2b20d0[_0xaac4('0x13')][_0x5d56ae]){_0x2b20d0[_0xaac4('0x13')][_0x5d56ae][_0xaac4('0x3b')](_0xaac4('0x49'));}return _0x3d7ccc({'code':0xc8,'message':_0x46082d});}catch(_0x19d9c1){logger['error'](_0x19d9c1[_0xaac4('0x3e')]);return _0x501664(_0x5e8928['error'](0x1f4,_0x19d9c1));}}logger[_0xaac4('0x35')]('message\x20is\x20empty');return _0x501664(_0x5e8928['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x352c78){var _0x380e9d=this;return new Promise(function(_0x467a61,_0x43e7cc){if(_0x2b20d0['agents'][_0xaac4('0x4a')](_0x352c78['id'])){for(var _0x328559 in _0x352c78[_0xaac4('0x4b')]){if(_0x352c78['capacity'][_0xaac4('0x4a')](_0x328559)){if(_0x2b20d0[_0xaac4('0x41')][_0x352c78['id']][_0xaac4('0x4a')](_0x328559+_0xaac4('0x4c'))){_0x2b20d0[_0xaac4('0x41')][_0x352c78['id']][_0x328559+_0xaac4('0x4c')]=parseInt(_0x352c78[_0xaac4('0x4b')][_0x328559],0xa);}}}_0x2b20d0['agents'][_0x352c78['id']]['updateRealtime']();return _0x467a61({'code':0xc8,'message':_0x2b20d0[_0xaac4('0x41')][_0x352c78['id']]});}else{return _0x43e7cc(_0x380e9d['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2df044){return new Promise(function(_0x5971d3,_0x195aa9){var _0x4b6881=_[_0xaac4('0x4d')](_0x2b20d0[_0xaac4('0x41')]);_0x5971d3({'count':_0x4b6881['length'],'rows':_0x4b6881});});},'ChatQueues':function(_0x5112d3){return new Promise(function(_0x4e6de9,_0x4d0ee7){var _0x3f852f=[];for(var _0x18451f in _0x2b20d0[_0xaac4('0x4e')]){if(_0x2b20d0[_0xaac4('0x4e')]['hasOwnProperty'](_0x18451f)){var _0x1037e0=_0x2b20d0[_0xaac4('0x4e')][_0x18451f];var _0x3b0470={'id':_0x1037e0['id'],'available':_0x1037e0[_0xaac4('0x4f')],'loggedIn':_0x1037e0[_0xaac4('0x50')],'name':_0x1037e0[_0xaac4('0x51')],'paused':_0x1037e0[_0xaac4('0x52')],'waiting':_0x1037e0[_0xaac4('0x53')]};_0x3f852f[_0xaac4('0x22')](_0x3b0470);}}_0x4e6de9({'count':_0x3f852f[_0xaac4('0x19')],'rows':_0x3f852f});});},'MailQueues':function(_0x43aeee){return new Promise(function(_0x5dce58,_0x5d2593){var _0x140aed=[];for(var _0x486895 in _0x2b20d0['mailQueues']){if(_0x2b20d0[_0xaac4('0x54')]['hasOwnProperty'](_0x486895)){var _0x3c2fc6=_0x2b20d0[_0xaac4('0x54')][_0x486895];var _0x26bae8={'id':_0x3c2fc6['id'],'available':_0x3c2fc6[_0xaac4('0x4f')],'loggedIn':_0x3c2fc6['loggedIn'],'name':_0x3c2fc6[_0xaac4('0x51')],'paused':_0x3c2fc6[_0xaac4('0x52')],'waiting':_0x3c2fc6[_0xaac4('0x53')]};_0x140aed[_0xaac4('0x22')](_0x26bae8);}}_0x5dce58({'count':_0x140aed[_0xaac4('0x19')],'rows':_0x140aed});});},'OpenchannelQueues':function(_0x3a1b41){return new Promise(function(_0x5b20c6,_0x1db7c7){var _0x429661=[];for(var _0x5b5e57 in _0x2b20d0[_0xaac4('0x55')]){if(_0x2b20d0[_0xaac4('0x55')]['hasOwnProperty'](_0x5b5e57)){var _0x53565a=_0x2b20d0[_0xaac4('0x55')][_0x5b5e57];var _0x3a2e77={'id':_0x53565a['id'],'available':_0x53565a[_0xaac4('0x4f')],'loggedIn':_0x53565a[_0xaac4('0x50')],'name':_0x53565a[_0xaac4('0x51')],'paused':_0x53565a[_0xaac4('0x52')],'waiting':_0x53565a[_0xaac4('0x53')]};_0x429661[_0xaac4('0x22')](_0x3a2e77);}}_0x5b20c6({'count':_0x429661['length'],'rows':_0x429661});});},'SmsQueues':function(_0x3f53f2){return new Promise(function(_0x155fc4,_0x3dead0){var _0x254fb3=[];for(var _0x39d030 in _0x2b20d0[_0xaac4('0x56')]){if(_0x2b20d0['smsQueues'][_0xaac4('0x4a')](_0x39d030)){var _0x16c480=_0x2b20d0['smsQueues'][_0x39d030];var _0x5c3c89={'id':_0x16c480['id'],'available':_0x16c480['available'],'loggedIn':_0x16c480[_0xaac4('0x50')],'name':_0x16c480['name'],'paused':_0x16c480['paused'],'waiting':_0x16c480['waiting']};_0x254fb3['push'](_0x5c3c89);}}_0x155fc4({'count':_0x254fb3['length'],'rows':_0x254fb3});});},'FaxQueues':function(_0x430a49){return new Promise(function(_0x46b0d6,_0x2ca73a){var _0x36cdc8=[];for(var _0x52c9c0 in _0x2b20d0[_0xaac4('0x57')]){if(_0x2b20d0[_0xaac4('0x57')][_0xaac4('0x4a')](_0x52c9c0)){var _0x3bcf67=_0x2b20d0[_0xaac4('0x57')][_0x52c9c0];var _0x3f2b70={'id':_0x3bcf67['id'],'available':_0x3bcf67[_0xaac4('0x4f')],'loggedIn':_0x3bcf67['loggedIn'],'name':_0x3bcf67[_0xaac4('0x51')],'paused':_0x3bcf67['paused'],'waiting':_0x3bcf67['waiting']};_0x36cdc8[_0xaac4('0x22')](_0x3f2b70);}}_0x46b0d6({'count':_0x36cdc8[_0xaac4('0x19')],'rows':_0x36cdc8});});},'WhatsappQueues':function(_0x136231){return new Promise(function(_0x1d02fd,_0x201d81){var _0x1dc79d=[];for(var _0x38a7e8 in _0x2b20d0[_0xaac4('0x58')]){if(_0x2b20d0[_0xaac4('0x58')][_0xaac4('0x4a')](_0x38a7e8)){var _0x24b1d8=_0x2b20d0[_0xaac4('0x58')][_0x38a7e8];var _0x362902={'id':_0x24b1d8['id'],'available':_0x24b1d8[_0xaac4('0x4f')],'loggedIn':_0x24b1d8[_0xaac4('0x50')],'name':_0x24b1d8[_0xaac4('0x51')],'paused':_0x24b1d8[_0xaac4('0x52')],'waiting':_0x24b1d8[_0xaac4('0x53')]};_0x1dc79d[_0xaac4('0x22')](_0x362902);}}_0x1d02fd({'count':_0x1dc79d[_0xaac4('0x19')],'rows':_0x1dc79d});});},'ChatQueuesWaitingInteractions':function(_0x24cca6){return new Promise(function(_0x268fe8,_0x1d3500){var _0x3ace17=_[_0xaac4('0x4d')](_0x2b20d0['chatQueuesWaitingInteractions']);_0x268fe8({'count':_0x3ace17[_0xaac4('0x19')],'rows':_0x3ace17});});},'MailQueuesWaitingInteractions':function(_0x2f77d4){return new Promise(function(_0x29cd95,_0x1d8c13){var _0x4098e6=_['values'](_0x2b20d0[_0xaac4('0x59')]);_0x29cd95({'count':_0x4098e6[_0xaac4('0x19')],'rows':_0x4098e6});});},'OpenchannelQueuesWaitingInteractions':function(_0x13d2aa){return new Promise(function(_0x2e24c4,_0x270b56){var _0x508c4e=_[_0xaac4('0x4d')](_0x2b20d0['openchannelQueuesWaitingInteractions']);_0x2e24c4({'count':_0x508c4e[_0xaac4('0x19')],'rows':_0x508c4e});});},'SmsQueuesWaitingInteractions':function(_0x36d642){return new Promise(function(_0x57e692,_0x30227e){var _0x55cf3c=_[_0xaac4('0x4d')](_0x2b20d0[_0xaac4('0x5a')]);_0x57e692({'count':_0x55cf3c['length'],'rows':_0x55cf3c});});},'FaxQueuesWaitingInteractions':function(_0x3dea56){return new Promise(function(_0x3fe616,_0x5773a6){var _0x1351cb=_[_0xaac4('0x4d')](_0x2b20d0[_0xaac4('0x5b')]);_0x3fe616({'count':_0x1351cb[_0xaac4('0x19')],'rows':_0x1351cb});});},'WhatsappQueuesWaitingInteractions':function(_0x22b8dc){return new Promise(function(_0x328567,_0x89028c){var _0x220f18=_[_0xaac4('0x4d')](_0x2b20d0['whatsappQueuesWaitingInteractions']);_0x328567({'count':_0x220f18[_0xaac4('0x19')],'rows':_0x220f18});});}};var _0x466484=jayson[_0xaac4('0x5c')](_0x2fbeb7)['http']();_0x466484['on'](_0xaac4('0x35'),function(_0x470a07){logger[_0xaac4('0x35')](JSON[_0xaac4('0x39')](_0x470a07));return _0x187624(_0x470a07);});_0x466484[_0xaac4('0x12')](0x232c,_0xaac4('0x5d'),function(){console[_0xaac4('0x5e')](_0xaac4('0x5f'),0x232c);return _0x150fdd(_0xaac4('0x60')+0x232c);});});}; \ No newline at end of file +var _0x4058=['./applications/utils','../../../config/environment','../../../config/logger','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','listen','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','intervals','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','stack','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid'];(function(_0x32d2da,_0xf63150){var _0x3b533c=function(_0x2a1da0){while(--_0x2a1da0){_0x32d2da['push'](_0x32d2da['shift']());}};_0x3b533c(++_0xf63150);}(_0x4058,0x129));var _0x8405=function(_0x34ea51,_0x350db7){_0x34ea51=_0x34ea51-0x0;var _0x38bd97=_0x4058[_0x34ea51];return _0x38bd97;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var path=require(_0x8405('0x2'));var fs=require('fs');var jayson=require(_0x8405('0x3'));var BPromise=require(_0x8405('0x4'));var uuid=require(_0x8405('0x5'));var utils=require(_0x8405('0x6'));var config=require(_0x8405('0x7'));var logger=require(_0x8405('0x8'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x8405('0x9')),'smsQueueReport':require(_0x8405('0xa')),'faxQueueReport':require(_0x8405('0xb')),'whatsappQueueReport':require(_0x8405('0xc'))};var RuleEngine=require(_0x8405('0xd'));function getId(_0x479c97,_0x16d810,_0x2b1c0a){return util[_0x8405('0xe')]('%s.%s.%s',_0x479c97,_0x16d810||0x0,_0x2b1c0a||0x0);}function getIntervals(_0x30705f,_0x5e132b){var _0x6979fd=[];if(!_[_0x8405('0xf')](_0x5e132b['IntervalId'])&&!_[_0x8405('0xf')](_0x30705f[_0x5e132b[_0x8405('0x10')]])&&!_['isNil'](_0x30705f[_0x5e132b['IntervalId']]['Intervals'])){_0x6979fd=_['map'](_0x30705f[_0x5e132b[_0x8405('0x10')]]['Intervals'],'interval');}else if(!_['isNil'](_0x5e132b['interval'])){_0x6979fd=[_0x5e132b['interval']];}return _0x6979fd;}exports[_0x8405('0x11')]=function(_0x238633){_0x238633['rules']={};return new BPromise(function(_0x1722d3,_0xa60bb4){var _0x221cf8={'Start':function(_0x422822){var _0x58eb66=this;return new Promise(function(_0x218fe7,_0x2d7601){if(_0x422822){try{var _0x8ef1fb=[];var _0x30cef7=getId(_0x422822[_0x8405('0x12')],_0x422822[_0x8405('0x13')]?_0x422822[_0x8405('0x13')]['id']:0x0,_0x422822[_0x8405('0x14')]?_0x422822[_0x8405('0x14')]['id']:0x0);if(_0x422822[_0x8405('0x15')]&&_[_0x8405('0x16')](_0x422822[_0x8405('0x15')])&&_0x422822[_0x8405('0x15')][_0x8405('0x17')]){for(var _0x3c0352=0x0;_0x3c0352<_0x422822[_0x8405('0x15')][_0x8405('0x17')];_0x3c0352+=0x1){var _0x14bc3e=_0x422822[_0x8405('0x15')][_0x3c0352];if(fs[_0x8405('0x18')](path[_0x8405('0x19')](__dirname,_0x8405('0x15'),_0x14bc3e[_0x8405('0x1a')]+_0x8405('0x1b')))){var _0x1ceff7=[];switch(_0x14bc3e[_0x8405('0x1a')]['toLowerCase']()){case'autoreply':var _0x3abeb0=_0x14bc3e[_0x8405('0x1c')][_0x8405('0x1d')](',');if(_0x422822['channel']===_0x8405('0x1e')){_0x1ceff7['push'](_0x3abeb0[0x0]);_0x1ceff7[_0x8405('0x1f')](_0x3abeb0[0x1]);_0x1ceff7['push'](_0x3abeb0[_0x8405('0x20')](0x2,_0x3abeb0[_0x8405('0x17')])[_0x8405('0x19')](','));}else{_0x1ceff7[_0x8405('0x1f')](_0x3abeb0[0x0]);_0x1ceff7[_0x8405('0x1f')](_0x3abeb0[_0x8405('0x20')](0x1,_0x3abeb0[_0x8405('0x17')])[_0x8405('0x19')](','));}break;case _0x8405('0x21'):var _0x24b88d=_0x14bc3e[_0x8405('0x1c')][_0x8405('0x1d')](',');_0x1ceff7['push'](_0x24b88d[0x0]);_0x1ceff7[_0x8405('0x1f')](_0x24b88d[0x1]);_0x1ceff7['push'](_0x24b88d['slice'](0x2,_0x24b88d[_0x8405('0x17')])[_0x8405('0x19')](','));break;case _0x8405('0x22'):var _0x26d5ec=_0x14bc3e[_0x8405('0x1c')][_0x8405('0x1d')](',');_0x1ceff7[_0x8405('0x1f')](_0x26d5ec[0x0]);_0x1ceff7[_0x8405('0x1f')](_0x26d5ec[0x1]);_0x1ceff7[_0x8405('0x1f')](_0x26d5ec[0x2]);_0x1ceff7[_0x8405('0x1f')](_0x26d5ec[0x3]);_0x1ceff7[_0x8405('0x1f')](_0x26d5ec[_0x8405('0x20')](0x4,_0x26d5ec[_0x8405('0x17')])['join'](','));break;case _0x8405('0x23'):var _0x305fe8=_0x14bc3e['appdata'][_0x8405('0x1d')](',');_0x1ceff7[_0x8405('0x1f')](_0x305fe8[0x0]);_0x1ceff7[_0x8405('0x1f')](_0x305fe8[0x1]);_0x1ceff7['push'](_0x305fe8[0x2]);_0x1ceff7[_0x8405('0x1f')](_0x305fe8[0x3]);_0x1ceff7[_0x8405('0x1f')](_0x305fe8[_0x8405('0x20')](0x4,_0x305fe8['length'])[_0x8405('0x19')](','));break;case _0x8405('0x13'):_0x1ceff7['push'](_0x14bc3e[_0x8405('0x1c')]);break;case'tag':_0x1ceff7[_0x8405('0x1f')](_0x14bc3e[_0x8405('0x24')]);_0x1ceff7[_0x8405('0x1f')](_0x14bc3e[_0x8405('0x1c')]);break;case _0x8405('0x25'):var _0x2b0929=utils[_0x8405('0x26')](_0x422822[_0x8405('0x27')][_0x8405('0x28')],_0x422822);var _0x298b3f=_0x14bc3e[_0x8405('0x1c')][_0x8405('0x1d')](',');_0x1ceff7['push'](_0x298b3f[0x0]);_0x1ceff7[_0x8405('0x1f')](_0x298b3f[0x1]);_0x1ceff7['push'](_0x298b3f[0x2]);_0x1ceff7['push'](_0x298b3f[0x3]);_0x1ceff7[_0x8405('0x1f')](_0x298b3f[0x4]);_0x1ceff7[_0x8405('0x1f')](_0x298b3f[0x5]);_0x1ceff7['push'](_0x298b3f[0x6]);_0x1ceff7[_0x8405('0x1f')](_0x298b3f[0x7]);_0x1ceff7[_0x8405('0x1f')](_0x298b3f[0x8]);_0x1ceff7[_0x8405('0x1f')](_0x298b3f[0x9]);_0x1ceff7[_0x8405('0x1f')](_0x298b3f[0xa]);_0x1ceff7[_0x8405('0x1f')](_0x422822['interaction']['id']);_0x1ceff7[_0x8405('0x1f')](_0x422822[_0x8405('0x13')]['id']);_0x1ceff7[_0x8405('0x1f')](_0x14bc3e[_0x8405('0x29')]);_0x1ceff7[_0x8405('0x1f')](_0x422822['interaction'][_0x8405('0x2a')]);_0x1ceff7[_0x8405('0x1f')](_0x422822[_0x8405('0x2b')][_0x8405('0x2b')]);_0x1ceff7[_0x8405('0x1f')](_0x2b0929);break;default:_0x1ceff7=_[_0x8405('0xf')](_0x14bc3e['appdata'])?[]:_0x14bc3e[_0x8405('0x1c')][_0x8405('0x1d')](',');}var _0x23e559={'id':util[_0x8405('0xe')](_0x8405('0x2c'),_0x30cef7,_0x14bc3e['id'],_0x14bc3e[_0x8405('0x1a')]),'condition':require(_0x8405('0x2d'))['condition'](_0x30cef7,getIntervals(_0x238633[_0x8405('0x2e')],_0x14bc3e),_0x238633),'consequence':require('./applications/'+_0x14bc3e[_0x8405('0x1a')])[_0x8405('0x2f')](_0x30cef7,_0x1ceff7,_0x238633,_0x422822),'p':_0x14bc3e['priority']||0x0};logger[_0x8405('0x30')](_0x8405('0x31'),_0x23e559['id'],_0x8405('0x32'),getIntervals(_0x238633[_0x8405('0x2e')],_0x14bc3e)[_0x8405('0x19')](_0x8405('0x33')));_0x8ef1fb[_0x8405('0x1f')](_0x23e559);}else{logger[_0x8405('0x34')](_0x8405('0x35'),path[_0x8405('0x19')](__dirname,'applications',_0x14bc3e['app']+_0x8405('0x1b')));}}_0x238633['rules'][_0x30cef7]=new RuleEngine(_0x8ef1fb);_0x238633[_0x8405('0x36')][_0x30cef7][_0x8405('0x37')](_0x422822,function(_0x10e974){logger['info'](_0x8405('0x38'),JSON[_0x8405('0x39')](_0x10e974['matchPath']));if(_0x238633[_0x8405('0x36')][_0x30cef7]){_0x238633[_0x8405('0x36')][_0x30cef7][_0x8405('0x3a')](_0x8405('0x3b'));}});return _0x218fe7({'code':0xc8,'message':_0x422822});}else{logger[_0x8405('0x30')](_0x8405('0x3c'));return _0x218fe7({'code':0xc8,'message':_0x422822});}}catch(_0x336927){logger['error'](_0x336927['stack']);return _0x2d7601(_0x58eb66['error'](0x1f4,_0x336927));}}return _0x2d7601(_0x8405('0x3d'));});},'AcceptMessage':function(_0xb414fe){var _0x1c0350=this;return new Promise(function(_0x3788a4,_0x5201ed){if(_0xb414fe['agent']&&_0xb414fe[_0x8405('0x3e')]['id']){if(_0x238633[_0x8405('0x3f')][_0xb414fe[_0x8405('0x3e')]['id']]){_0x238633[_0x8405('0x3f')][_0xb414fe[_0x8405('0x3e')]['id']][_0x8405('0x40')]=![];_0x238633[_0x8405('0x3f')][_0xb414fe[_0x8405('0x3e')]['id']]['busyQueue']=undefined;}}if(_0xb414fe[_0x8405('0x13')]&&_0xb414fe['message']['id']){try{var _0x3c0e7c=getId(_0xb414fe[_0x8405('0x12')],_0xb414fe[_0x8405('0x13')]?_0xb414fe[_0x8405('0x13')]['id']:0x0,_0xb414fe[_0x8405('0x14')]?_0xb414fe[_0x8405('0x14')]['id']:0x0);if(_0x238633[_0x8405('0x36')][_0x3c0e7c]){_0x238633[_0x8405('0x36')][_0x3c0e7c]['emit'](_0x8405('0x41'));if(rpc[_0xb414fe[_0x8405('0x12')]+_0x8405('0x42')]){rpc[_0xb414fe[_0x8405('0x12')]+'QueueReport']['update'](_0x3c0e7c,{'UserId':_0xb414fe[_0x8405('0x13')][_0x8405('0x43')]})[_0x8405('0x44')](function(_0x2c8432){logger[_0x8405('0x34')](_0x8405('0x45'));});}}return _0x3788a4({'code':0xc8,'message':_0xb414fe});}catch(_0x342ebc){logger['error'](_0x342ebc['stack']);return _0x5201ed(_0x1c0350[_0x8405('0x34')](0x1f4,_0x342ebc));}}logger['error'](_0x8405('0x46'));return _0x5201ed(_0x1c0350[_0x8405('0x34')](0x1f4,_0x8405('0x46')));});},'RejectMessage':function(_0x4b8443){var _0x5b8a93=this;return new Promise(function(_0x3ee921,_0x4d4e37){if(_0x4b8443[_0x8405('0x3e')]&&_0x4b8443[_0x8405('0x3e')]['id']){try{if(_0x238633[_0x8405('0x3f')][_0x4b8443[_0x8405('0x3e')]['id']]){_0x238633[_0x8405('0x3f')][_0x4b8443[_0x8405('0x3e')]['id']][_0x8405('0x40')]=![];_0x238633[_0x8405('0x3f')][_0x4b8443[_0x8405('0x3e')]['id']]['busyQueue']=undefined;}return _0x3ee921({'code':0xc8,'message':_0x4b8443});}catch(_0x1773fe){logger[_0x8405('0x34')](_0x1773fe[_0x8405('0x47')]);return _0x4d4e37(_0x5b8a93[_0x8405('0x34')](0x1f4,_0x1773fe));}}logger['error'](_0x8405('0x46'));return _0x4d4e37(_0x5b8a93[_0x8405('0x34')](0x1f4,_0x8405('0x46')));});},'AbandonInteraction':function(_0x22d378){var _0xf007f8=this;return new Promise(function(_0x3ce3ff,_0x4a2381){if(_0x22d378[_0x8405('0x12')]&&_0x22d378[_0x8405('0x14')]&&_0x22d378[_0x8405('0x14')]['id']){try{var _0x550f08=getId(_0x22d378[_0x8405('0x12')],_0x22d378[_0x8405('0x13')]?_0x22d378[_0x8405('0x13')]['id']:0x0,_0x22d378[_0x8405('0x14')]?_0x22d378[_0x8405('0x14')]['id']:0x0);if(_0x238633[_0x8405('0x36')][_0x550f08]){_0x238633[_0x8405('0x36')][_0x550f08][_0x8405('0x3a')](_0x8405('0x41'));}return _0x3ce3ff({'code':0xc8,'message':_0x22d378});}catch(_0x18a255){logger['error'](_0x18a255[_0x8405('0x47')]);return _0x4a2381(_0xf007f8['error'](0x1f4,_0x18a255));}}logger[_0x8405('0x34')]('message\x20is\x20empty');return _0x4a2381(_0xf007f8[_0x8405('0x34')](0x1f4,_0x8405('0x46')));});},'AgentCapacity':function(_0x13018d){var _0xdf957f=this;return new Promise(function(_0x29d2cf,_0x5a4b6c){if(_0x238633[_0x8405('0x3f')]['hasOwnProperty'](_0x13018d['id'])){for(var _0x58fe94 in _0x13018d[_0x8405('0x48')]){if(_0x13018d['capacity'][_0x8405('0x49')](_0x58fe94)){if(_0x238633[_0x8405('0x3f')][_0x13018d['id']][_0x8405('0x49')](_0x58fe94+'CurrentCapacity')){_0x238633[_0x8405('0x3f')][_0x13018d['id']][_0x58fe94+_0x8405('0x4a')]=parseInt(_0x13018d[_0x8405('0x48')][_0x58fe94],0xa);}}}_0x238633[_0x8405('0x3f')][_0x13018d['id']][_0x8405('0x4b')]();return _0x29d2cf({'code':0xc8,'message':_0x238633[_0x8405('0x3f')][_0x13018d['id']]});}else{return _0x5a4b6c(_0xdf957f['error'](0x1f4,_0x8405('0x4c')));}});},'Agents':function(_0x269d80){return new Promise(function(_0x18efbe,_0x539969){var _0x535b14=_[_0x8405('0x4d')](_0x238633[_0x8405('0x3f')]);_0x18efbe({'count':_0x535b14[_0x8405('0x17')],'rows':_0x535b14});});},'ChatQueues':function(_0x450dad){return new Promise(function(_0x138df7,_0x5319b6){var _0x5a4b36=[];for(var _0x5cd043 in _0x238633[_0x8405('0x4e')]){if(_0x238633[_0x8405('0x4e')][_0x8405('0x49')](_0x5cd043)){var _0x3da720=_0x238633[_0x8405('0x4e')][_0x5cd043];var _0x23aea4={'id':_0x3da720['id'],'available':_0x3da720[_0x8405('0x4f')],'loggedIn':_0x3da720[_0x8405('0x50')],'name':_0x3da720[_0x8405('0x51')],'paused':_0x3da720[_0x8405('0x52')],'waiting':_0x3da720[_0x8405('0x53')]};_0x5a4b36[_0x8405('0x1f')](_0x23aea4);}}_0x138df7({'count':_0x5a4b36['length'],'rows':_0x5a4b36});});},'MailQueues':function(_0x106169){return new Promise(function(_0x21e60a,_0x50c8e2){var _0x2b87ba=[];for(var _0x2a54bb in _0x238633[_0x8405('0x54')]){if(_0x238633[_0x8405('0x54')][_0x8405('0x49')](_0x2a54bb)){var _0x4449bf=_0x238633[_0x8405('0x54')][_0x2a54bb];var _0x27085d={'id':_0x4449bf['id'],'available':_0x4449bf[_0x8405('0x4f')],'loggedIn':_0x4449bf['loggedIn'],'name':_0x4449bf[_0x8405('0x51')],'paused':_0x4449bf[_0x8405('0x52')],'waiting':_0x4449bf[_0x8405('0x53')]};_0x2b87ba['push'](_0x27085d);}}_0x21e60a({'count':_0x2b87ba[_0x8405('0x17')],'rows':_0x2b87ba});});},'OpenchannelQueues':function(_0x320b03){return new Promise(function(_0x20e9ac,_0x211e38){var _0x27f1ef=[];for(var _0x4d9f1f in _0x238633[_0x8405('0x55')]){if(_0x238633[_0x8405('0x55')][_0x8405('0x49')](_0x4d9f1f)){var _0x237090=_0x238633[_0x8405('0x55')][_0x4d9f1f];var _0xc554dc={'id':_0x237090['id'],'available':_0x237090[_0x8405('0x4f')],'loggedIn':_0x237090[_0x8405('0x50')],'name':_0x237090[_0x8405('0x51')],'paused':_0x237090['paused'],'waiting':_0x237090[_0x8405('0x53')]};_0x27f1ef['push'](_0xc554dc);}}_0x20e9ac({'count':_0x27f1ef[_0x8405('0x17')],'rows':_0x27f1ef});});},'SmsQueues':function(_0x8390dc){return new Promise(function(_0x52592c,_0x4f203d){var _0x5f4bb6=[];for(var _0x4a99b8 in _0x238633[_0x8405('0x56')]){if(_0x238633['smsQueues'][_0x8405('0x49')](_0x4a99b8)){var _0x210220=_0x238633[_0x8405('0x56')][_0x4a99b8];var _0x3d85d2={'id':_0x210220['id'],'available':_0x210220[_0x8405('0x4f')],'loggedIn':_0x210220[_0x8405('0x50')],'name':_0x210220[_0x8405('0x51')],'paused':_0x210220['paused'],'waiting':_0x210220[_0x8405('0x53')]};_0x5f4bb6[_0x8405('0x1f')](_0x3d85d2);}}_0x52592c({'count':_0x5f4bb6['length'],'rows':_0x5f4bb6});});},'FaxQueues':function(_0x55f959){return new Promise(function(_0x48b045,_0x4eea07){var _0x4d6e0c=[];for(var _0x506456 in _0x238633[_0x8405('0x57')]){if(_0x238633[_0x8405('0x57')][_0x8405('0x49')](_0x506456)){var _0x2e48de=_0x238633[_0x8405('0x57')][_0x506456];var _0x5a6844={'id':_0x2e48de['id'],'available':_0x2e48de[_0x8405('0x4f')],'loggedIn':_0x2e48de[_0x8405('0x50')],'name':_0x2e48de[_0x8405('0x51')],'paused':_0x2e48de[_0x8405('0x52')],'waiting':_0x2e48de[_0x8405('0x53')]};_0x4d6e0c['push'](_0x5a6844);}}_0x48b045({'count':_0x4d6e0c[_0x8405('0x17')],'rows':_0x4d6e0c});});},'WhatsappQueues':function(_0xa9388d){return new Promise(function(_0xaf9bf,_0x32766f){var _0x150e4d=[];for(var _0x380efd in _0x238633[_0x8405('0x58')]){if(_0x238633[_0x8405('0x58')]['hasOwnProperty'](_0x380efd)){var _0x42049d=_0x238633[_0x8405('0x58')][_0x380efd];var _0x2d3847={'id':_0x42049d['id'],'available':_0x42049d[_0x8405('0x4f')],'loggedIn':_0x42049d[_0x8405('0x50')],'name':_0x42049d[_0x8405('0x51')],'paused':_0x42049d[_0x8405('0x52')],'waiting':_0x42049d[_0x8405('0x53')]};_0x150e4d[_0x8405('0x1f')](_0x2d3847);}}_0xaf9bf({'count':_0x150e4d[_0x8405('0x17')],'rows':_0x150e4d});});},'ChatQueuesWaitingInteractions':function(_0x36eb16){return new Promise(function(_0x7c4d5b,_0x27c3e1){var _0x140ef3=_[_0x8405('0x4d')](_0x238633[_0x8405('0x59')]);_0x7c4d5b({'count':_0x140ef3['length'],'rows':_0x140ef3});});},'MailQueuesWaitingInteractions':function(_0x2562c8){return new Promise(function(_0x456d50,_0x3d1157){var _0x5b2b2b=_[_0x8405('0x4d')](_0x238633[_0x8405('0x5a')]);_0x456d50({'count':_0x5b2b2b[_0x8405('0x17')],'rows':_0x5b2b2b});});},'OpenchannelQueuesWaitingInteractions':function(_0x7506b5){return new Promise(function(_0x15be77,_0x30c799){var _0x34359d=_[_0x8405('0x4d')](_0x238633[_0x8405('0x5b')]);_0x15be77({'count':_0x34359d[_0x8405('0x17')],'rows':_0x34359d});});},'SmsQueuesWaitingInteractions':function(_0x5be58d){return new Promise(function(_0x48ab26,_0x467dcb){var _0x468604=_['values'](_0x238633[_0x8405('0x5c')]);_0x48ab26({'count':_0x468604[_0x8405('0x17')],'rows':_0x468604});});},'FaxQueuesWaitingInteractions':function(_0x33c856){return new Promise(function(_0x4ae432,_0x537624){var _0x4d185e=_['values'](_0x238633[_0x8405('0x5d')]);_0x4ae432({'count':_0x4d185e[_0x8405('0x17')],'rows':_0x4d185e});});},'WhatsappQueuesWaitingInteractions':function(_0x37a642){return new Promise(function(_0x5d6680,_0x372e53){var _0x35607a=_[_0x8405('0x4d')](_0x238633[_0x8405('0x5e')]);_0x5d6680({'count':_0x35607a['length'],'rows':_0x35607a});});}};var _0x4bc83b=jayson[_0x8405('0x5f')](_0x221cf8)[_0x8405('0x60')]();_0x4bc83b['on']('error',function(_0x201eec){logger[_0x8405('0x34')](JSON[_0x8405('0x39')](_0x201eec));return _0xa60bb4(_0x201eec);});_0x4bc83b['listen'](0x232c,_0x8405('0x61'),function(){console[_0x8405('0x62')](_0x8405('0x63'),0x232c);return _0x1722d3(_0x8405('0x64')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index a56e3ef..ef39eb1 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 _0xc262=['then','error','message','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','format','iftime\x20%s','catch','some','join','\x20|\x20','when','[%s][INTERVAL]\x20%s\x20%s','stack','stop','bluebird','jayson/promise','lodash','../../../config/logger','client','http','request'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0xc262,0x117));var _0x2c26=function(_0x1fc541,_0x5dff62){_0x1fc541=_0x1fc541-0x0;var _0x567b35=_0xc262[_0x1fc541];return _0x567b35;};'use strict';var util=require('util');var BPromise=require(_0x2c26('0x0'));var jayson=require(_0x2c26('0x1'));var _=require(_0x2c26('0x2'));var logger=require(_0x2c26('0x3'))('routing');var client=jayson[_0x2c26('0x4')][_0x2c26('0x5')]({'port':0x232a});function request(_0x1a9b79,_0x965f9){return new BPromise(function(_0x411ca5,_0x4f4b95){return client[_0x2c26('0x6')](_0x1a9b79,_0x965f9)[_0x2c26('0x7')](function(_0x3fa862){if(_0x3fa862[_0x2c26('0x8')]){return _0x4f4b95(_0x3fa862[_0x2c26('0x8')][_0x2c26('0x9')]);}else{return _0x411ca5(_0x3fa862['result']);}})['catch'](function(_0x1da153){return _0x4f4b95(_0x1da153);});});}exports[_0x2c26('0xa')]=function(_0x860eea,_0x4c0317,_0x356150){return function(_0x110bff){if(_0x356150[_0x2c26('0xb')]&&!_0x356150['rules'][_0x860eea]){logger[_0x2c26('0xc')](_0x2c26('0xd'),_0x860eea);return _0x110bff['stop']();}var _0x4560ac=[];for(var _0x2cb91c=0x0;_0x2cb91c<_0x4c0317[_0x2c26('0xe')];_0x2cb91c+=0x1){_0x4560ac[_0x2c26('0xf')](request('Command',{'command':util[_0x2c26('0x10')](_0x2c26('0x11'),_0x4c0317[_0x2cb91c])})[_0x2c26('0x7')](function(_0x5b5b8c){return _0x5b5b8c&&_0x5b5b8c[_0x2c26('0x9')]&&_0x5b5b8c['message']['indexOf']('true')>=0x0?!![]:![];})[_0x2c26('0x12')](function(_0x237ceb){logger[_0x2c26('0x8')]('[%s][INTERVAL]\x20%s',_0x860eea,_0x4c0317[_0x2cb91c]);}));}BPromise['all'](_0x4560ac)[_0x2c26('0x7')](function(_0x59ab92){var _0x43573d=_[_0x2c26('0x13')](_0x59ab92);logger[_0x2c26('0xc')]('[%s][INTERVAL]\x20%s\x20%s',_0x860eea,_0x4c0317[_0x2c26('0x14')](_0x2c26('0x15')),_0x43573d);_0x110bff[_0x2c26('0x16')](_0x43573d);})[_0x2c26('0x12')](function(_0x396a07){console['log'](_0x396a07);logger[_0x2c26('0x8')](_0x2c26('0x17'),_0x860eea,_0x4c0317[_0x2c26('0x14')](_0x2c26('0x15')),_0x396a07[_0x2c26('0x18')]);_0x110bff[_0x2c26('0x19')]();});};}; \ No newline at end of file +var _0xf3fa=['jayson/promise','lodash','../../../config/logger','client','http','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','some','\x20|\x20','when','log','[%s][INTERVAL]\x20%s\x20%s','join','stack','util','bluebird'];(function(_0x383e22,_0x163969){var _0x229664=function(_0x17cc79){while(--_0x17cc79){_0x383e22['push'](_0x383e22['shift']());}};_0x229664(++_0x163969);}(_0xf3fa,0x19e));var _0xaf3f=function(_0x34e752,_0x32e2a2){_0x34e752=_0x34e752-0x0;var _0x7c6347=_0xf3fa[_0x34e752];return _0x7c6347;};'use strict';var util=require(_0xaf3f('0x0'));var BPromise=require(_0xaf3f('0x1'));var jayson=require(_0xaf3f('0x2'));var _=require(_0xaf3f('0x3'));var logger=require(_0xaf3f('0x4'))('routing');var client=jayson[_0xaf3f('0x5')][_0xaf3f('0x6')]({'port':0x232a});function request(_0x321dfe,_0x3046a1){return new BPromise(function(_0x4eca33,_0x321307){return client['request'](_0x321dfe,_0x3046a1)[_0xaf3f('0x7')](function(_0x317691){if(_0x317691['error']){return _0x321307(_0x317691[_0xaf3f('0x8')][_0xaf3f('0x9')]);}else{return _0x4eca33(_0x317691[_0xaf3f('0xa')]);}})[_0xaf3f('0xb')](function(_0x59631e){return _0x321307(_0x59631e);});});}exports[_0xaf3f('0xc')]=function(_0x1ff297,_0x9cd3ef,_0x54d88f){return function(_0x22175c){if(_0x54d88f[_0xaf3f('0xd')]&&!_0x54d88f[_0xaf3f('0xd')][_0x1ff297]){logger[_0xaf3f('0xe')](_0xaf3f('0xf'),_0x1ff297);return _0x22175c[_0xaf3f('0x10')]();}var _0x51302b=[];for(var _0x3261c2=0x0;_0x3261c2<_0x9cd3ef[_0xaf3f('0x11')];_0x3261c2+=0x1){_0x51302b[_0xaf3f('0x12')](request(_0xaf3f('0x13'),{'command':util[_0xaf3f('0x14')](_0xaf3f('0x15'),_0x9cd3ef[_0x3261c2])})['then'](function(_0x300fc4){return _0x300fc4&&_0x300fc4[_0xaf3f('0x9')]&&_0x300fc4[_0xaf3f('0x9')][_0xaf3f('0x16')](_0xaf3f('0x17'))>=0x0?!![]:![];})[_0xaf3f('0xb')](function(_0x209a19){logger['error'](_0xaf3f('0x18'),_0x1ff297,_0x9cd3ef[_0x3261c2]);}));}BPromise['all'](_0x51302b)[_0xaf3f('0x7')](function(_0x20fb91){var _0x1f9241=_[_0xaf3f('0x19')](_0x20fb91);logger[_0xaf3f('0xe')]('[%s][INTERVAL]\x20%s\x20%s',_0x1ff297,_0x9cd3ef['join'](_0xaf3f('0x1a')),_0x1f9241);_0x22175c[_0xaf3f('0x1b')](_0x1f9241);})[_0xaf3f('0xb')](function(_0x3c1ab8){console[_0xaf3f('0x1c')](_0x3c1ab8);logger[_0xaf3f('0x8')](_0xaf3f('0x1d'),_0x1ff297,_0x9cd3ef[_0xaf3f('0x1e')]('\x20|\x20'),_0x3c1ab8[_0xaf3f('0x1f')]);_0x22175c['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index dc24990..b7ce694 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 _0xdb94=['transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','calleridnum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','uniqueid','debug','[%s][agents][agentcalled]','destuniqueid','connectedlinenum','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','membername','agentringnoanswerAt','now','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten'];(function(_0x556791,_0x5137ab){var _0x4193eb=function(_0x312114){while(--_0x312114){_0x556791['push'](_0x556791['shift']());}};_0x4193eb(++_0x5137ab);}(_0xdb94,0xab));var _0x4db9=function(_0x57cfdc,_0x427403){_0x57cfdc=_0x57cfdc-0x0;var _0x40a4ed=_0xdb94[_0x57cfdc];return _0x40a4ed;};'use strict';var _=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var utils=require(_0x4db9('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x39909a,_0x3b4f98){utils['info'](util[_0x4db9('0x3')](_0x4db9('0x4'),_0x39909a['uniqueid'],_0x39909a['channel'],_0x39909a[_0x4db9('0x5')],_0x39909a['membername'],_0x39909a['interface'],_0x39909a[_0x4db9('0x6')],_0x39909a['connectedlinenum'],_0x39909a[_0x4db9('0x7')]));if(_0x39909a['queue']){utils[_0x4db9('0x8')](_0x39909a[_0x4db9('0x5')])[_0x4db9('0x9')](function(_0xbbc1eb){if(_0xbbc1eb){_0x39909a[_0x4db9('0xa')]=_0xbbc1eb[_0x4db9('0xa')];_0x39909a[_0x4db9('0xb')]=_0x39909a[_0x4db9('0xc')]?_0xbbc1eb[_0x4db9('0xd')]:![];_0x39909a[_0x4db9('0xe')]=_0x39909a[_0x4db9('0xb')]?_0xbbc1eb['acwTimeout']:0x0;}utils[_0x4db9('0xf')](_0x4db9('0x10'),_0x39909a);});}else{utils['request']('CreateVoiceAgentReport',_0x39909a);}if(_0x3b4f98){delete transfers[_0x39909a[_0x4db9('0x11')]];}else{delete agents[_0x39909a['destuniqueid']];}}exports['agentcalled']=function(_0x34fc7d){try{utils[_0x4db9('0x12')](util['format'](_0x4db9('0x13'),_0x34fc7d[_0x4db9('0x11')]),_0x34fc7d);agents[_0x34fc7d[_0x4db9('0x14')]]=_0x34fc7d;agents[_0x34fc7d[_0x4db9('0x14')]]['agentcalledAt']=utils['now']();agents[_0x34fc7d[_0x4db9('0x14')]][_0x4db9('0x7')]='called';agents[_0x34fc7d[_0x4db9('0x14')]][_0x4db9('0x15')]=null;agents[_0x34fc7d['destuniqueid']]['connectedlinename']=null;utils[_0x4db9('0x16')](util[_0x4db9('0x3')](_0x4db9('0x17'),_0x34fc7d[_0x4db9('0x11')],agents[_0x34fc7d[_0x4db9('0x14')]]['membername'],_0x34fc7d[_0x4db9('0x14')]));}catch(_0x1214ee){utils[_0x4db9('0x18')](util['format'](_0x4db9('0x13'),_0x34fc7d[_0x4db9('0x11')]),_0x1214ee);}};exports[_0x4db9('0x19')]=function(_0x4c92e8){try{if(!_[_0x4db9('0x1a')](agents[_0x4c92e8[_0x4db9('0x14')]])){utils[_0x4db9('0x12')](util[_0x4db9('0x3')](_0x4db9('0x1b'),_0x4c92e8[_0x4db9('0x11')]),_0x4c92e8);utils[_0x4db9('0x16')](util['format'](_0x4db9('0x1c'),_0x4c92e8[_0x4db9('0x11')],agents[_0x4c92e8[_0x4db9('0x14')]][_0x4db9('0x1d')],_0x4c92e8['destuniqueid']));agents[_0x4c92e8[_0x4db9('0x14')]][_0x4db9('0x19')]=!![];agents[_0x4c92e8['destuniqueid']][_0x4db9('0x1e')]=utils[_0x4db9('0x1f')]();agents[_0x4c92e8[_0x4db9('0x14')]]['lastevent']=_0x4db9('0x20');agents[_0x4c92e8[_0x4db9('0x14')]][_0x4db9('0x21')]=_0x4db9('0x20');agents[_0x4c92e8[_0x4db9('0x14')]][_0x4db9('0x22')]=_0x4c92e8[_0x4db9('0x23')]?parseInt(_0x4c92e8[_0x4db9('0x23')])/0x3e8:0x0;agents[_0x4c92e8[_0x4db9('0x14')]][_0x4db9('0x24')]=0x0;unanswered[_0x4db9('0x25')](_0x4c92e8[_0x4db9('0x14')]);}}catch(_0x2d646d){utils[_0x4db9('0x18')](util['format']('[%s][agents][agentringnoanswer]',_0x4c92e8[_0x4db9('0x11')]),_0x2d646d);}};exports[_0x4db9('0x26')]=function(_0x119371){try{_[_0x4db9('0x27')](agents,function(_0x2af884,_0x459131){if(_0x2af884['uniqueid']==_0x119371[_0x4db9('0x11')]&&!_['includes'](unanswered,_0x2af884[_0x4db9('0x14')])){utils[_0x4db9('0x12')](util[_0x4db9('0x3')](_0x4db9('0x28'),_0x119371[_0x4db9('0x11')]),_0x119371);utils['info'](util['format'](_0x4db9('0x29'),_0x119371['uniqueid'],_0x2af884[_0x4db9('0x1d')],_0x2af884[_0x4db9('0x14')]));_0x2af884['agentringnoanswer']=!![];_0x2af884[_0x4db9('0x1e')]=utils[_0x4db9('0x1f')]();_0x2af884[_0x4db9('0x7')]='abandoned';_0x2af884[_0x4db9('0x21')]='abandoned';_0x2af884[_0x4db9('0x22')]=_0x119371[_0x4db9('0x22')];_0x2af884[_0x4db9('0x24')]=0x0;writeDB(_0x2af884);}});}catch(_0x4dbcd3){utils['error'](util[_0x4db9('0x3')](_0x4db9('0x28'),_0x119371[_0x4db9('0x11')]),_0x4dbcd3);}};exports[_0x4db9('0x2a')]=function(_0x2dca24){try{if(agents[_0x2dca24[_0x4db9('0x14')]]){utils[_0x4db9('0x12')](util[_0x4db9('0x3')](_0x4db9('0x2b'),_0x2dca24['uniqueid']),_0x2dca24);utils[_0x4db9('0x16')](util[_0x4db9('0x3')](_0x4db9('0x2c'),_0x2dca24[_0x4db9('0x11')],agents[_0x2dca24['destuniqueid']][_0x4db9('0x1d')],_0x2dca24[_0x4db9('0x14')]));agents[_0x2dca24[_0x4db9('0x14')]]['agentconnectAt']=utils[_0x4db9('0x1f')]();agents[_0x2dca24[_0x4db9('0x14')]][_0x4db9('0x15')]=_0x2dca24[_0x4db9('0x15')];agents[_0x2dca24['destuniqueid']]['connectedlinename']=_0x2dca24[_0x4db9('0x2d')];agents[_0x2dca24[_0x4db9('0x14')]][_0x4db9('0x22')]=_0x2dca24[_0x4db9('0x23')];agents[_0x2dca24[_0x4db9('0x14')]]['lastevent']=_0x4db9('0x2e');_[_0x4db9('0x27')](agents,function(_0x23affc,_0x367c4c){if(_0x23affc[_0x4db9('0x14')]!=_0x2dca24['destuniqueid']&&_0x23affc[_0x4db9('0x11')]==_0x2dca24[_0x4db9('0x11')]){_0x23affc[_0x4db9('0x24')]=0x0;_0x23affc['holdtime']=_0x2dca24[_0x4db9('0x23')];_0x23affc[_0x4db9('0x19')]=!![];_0x23affc[_0x4db9('0x1e')]=utils[_0x4db9('0x1f')]();_0x23affc[_0x4db9('0x7')]=_0x4db9('0x2f');_0x23affc[_0x4db9('0x21')]=_0x4db9('0x2f');_0x23affc[_0x4db9('0x30')]=_0x2dca24[_0x4db9('0x14')];_0x23affc['answeredelsewheremembername']=_0x2dca24['membername'];writeDB(_0x23affc);}});}}catch(_0x48aaf5){utils[_0x4db9('0x18')](util[_0x4db9('0x3')]('[%s][agents][agentconnect]',_0x2dca24[_0x4db9('0x11')]),_0x48aaf5);}};exports[_0x4db9('0xc')]=function(_0x563416){try{if(!_['isNil'](agents[_0x563416[_0x4db9('0x14')]])){utils['debug'](util[_0x4db9('0x3')](_0x4db9('0x31'),_0x563416['uniqueid']),_0x563416);utils[_0x4db9('0x16')](util[_0x4db9('0x3')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x563416[_0x4db9('0x11')],agents[_0x563416[_0x4db9('0x14')]][_0x4db9('0x1d')],_0x563416['destuniqueid']));agents[_0x563416['destuniqueid']][_0x4db9('0xc')]=!![];agents[_0x563416[_0x4db9('0x14')]][_0x4db9('0x32')]=utils[_0x4db9('0x1f')]();agents[_0x563416[_0x4db9('0x14')]][_0x4db9('0x24')]=utils[_0x4db9('0x33')](agents[_0x563416[_0x4db9('0x14')]][_0x4db9('0x32')],agents[_0x563416[_0x4db9('0x14')]][_0x4db9('0x34')]);agents[_0x563416[_0x4db9('0x14')]][_0x4db9('0x21')]=_0x563416['reason'];agents[_0x563416[_0x4db9('0x14')]][_0x4db9('0x7')]=_0x4db9('0x35');writeDB(agents[_0x563416[_0x4db9('0x14')]]);}}catch(_0x329822){utils[_0x4db9('0x18')](util[_0x4db9('0x3')](_0x4db9('0x31'),_0x563416[_0x4db9('0x11')]),_0x329822);}};exports[_0x4db9('0x36')]=function(_0x10dccb){try{if(!_['isNil'](agents[_0x10dccb['transfereruniqueid']])){utils[_0x4db9('0x12')](util[_0x4db9('0x3')](_0x4db9('0x37'),_0x10dccb[_0x4db9('0x11')]),_0x10dccb);utils[_0x4db9('0x16')](util[_0x4db9('0x3')](_0x4db9('0x38'),_0x10dccb[_0x4db9('0x11')],agents[_0x10dccb['transfereruniqueid']][_0x4db9('0x1d')],agents[_0x10dccb[_0x4db9('0x39')]][_0x4db9('0x11')]));agents[_0x10dccb[_0x4db9('0x39')]][_0x4db9('0x3a')]=!![];agents[_0x10dccb[_0x4db9('0x39')]][_0x4db9('0x3b')]=_0x4db9('0x3c');agents[_0x10dccb['transfereruniqueid']][_0x4db9('0x3d')]=_0x10dccb[_0x4db9('0x3e')];agents[_0x10dccb[_0x4db9('0x39')]][_0x4db9('0x3f')]=agents[_0x10dccb[_0x4db9('0x39')]][_0x4db9('0x11')];}}catch(_0x4e88c2){utils[_0x4db9('0x18')](util['format'](_0x4db9('0x37'),_0x10dccb['uniqueid']),_0x4e88c2);}};exports['attendedtransfer']=function(_0x2604bf){try{utils['debug'](util[_0x4db9('0x3')](_0x4db9('0x40'),_0x2604bf[_0x4db9('0x41')]),_0x2604bf);if(_0x2604bf[_0x4db9('0x41')]==_0x2604bf['origtransfererlinkedid']){if(!_[_0x4db9('0x1a')](agents[_0x2604bf['secondtransfereruniqueid']])){utils[_0x4db9('0x16')](util[_0x4db9('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x2604bf[_0x4db9('0x41')],agents[_0x2604bf['secondtransfereruniqueid']][_0x4db9('0x1d')]));agents[_0x2604bf[_0x4db9('0x42')]][_0x4db9('0x3a')]=!![];agents[_0x2604bf[_0x4db9('0x42')]][_0x4db9('0x3b')]=_0x4db9('0x43');agents[_0x2604bf[_0x4db9('0x42')]][_0x4db9('0x3d')]=_0x2604bf[_0x4db9('0x44')];agents[_0x2604bf[_0x4db9('0x42')]][_0x4db9('0x3f')]=_0x2604bf[_0x4db9('0x41')];}if(_0x2604bf[_0x4db9('0x45')]&&agents[_0x2604bf[_0x4db9('0x45')]]){agents[_0x2604bf[_0x4db9('0x45')]]['agententerreason']=0x1;transfers[_0x2604bf[_0x4db9('0x45')]]=_[_0x4db9('0x46')](agents[_0x2604bf['transfereeuniqueid']]);transfers[_0x2604bf[_0x4db9('0x45')]][_0x4db9('0x6')]=agents[_0x2604bf[_0x4db9('0x42')]][_0x4db9('0x6')];transfers[_0x2604bf[_0x4db9('0x45')]][_0x4db9('0x47')]=agents[_0x2604bf[_0x4db9('0x42')]][_0x4db9('0x47')];transfers[_0x2604bf[_0x4db9('0x45')]]['agentcalledAt']=utils['now']();transfers[_0x2604bf[_0x4db9('0x45')]][_0x4db9('0x34')]=utils[_0x4db9('0x1f')]();transfers[_0x2604bf[_0x4db9('0x45')]][_0x4db9('0x22')]=0x0;transfers[_0x2604bf[_0x4db9('0x45')]][_0x4db9('0x48')]=0x2;}}else if(_0x2604bf[_0x4db9('0x42')]==_0x2604bf[_0x4db9('0x49')]){if(!_[_0x4db9('0x1a')](agents[_0x2604bf['origtransfereruniqueid']])){utils[_0x4db9('0x16')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x2604bf['origtransfereruniqueid'],agents[_0x2604bf['origtransfereruniqueid']][_0x4db9('0x1d')]));agents[_0x2604bf['origtransfereruniqueid']]['transfer']=!![];agents[_0x2604bf[_0x4db9('0x41')]][_0x4db9('0x3b')]=_0x4db9('0x43');agents[_0x2604bf[_0x4db9('0x41')]][_0x4db9('0x3d')]=_0x2604bf[_0x4db9('0x4a')];agents[_0x2604bf[_0x4db9('0x41')]][_0x4db9('0x3f')]=_0x2604bf[_0x4db9('0x42')];}if(_0x2604bf[_0x4db9('0x4b')]&&agents[_0x2604bf[_0x4db9('0x4b')]]){agents[_0x2604bf[_0x4db9('0x4b')]][_0x4db9('0x48')]=0x1;transfers[_0x2604bf[_0x4db9('0x4b')]]=_[_0x4db9('0x46')](agents[_0x2604bf[_0x4db9('0x4b')]]);transfers[_0x2604bf['transfertargetuniqueid']]['calleridnum']=agents[_0x2604bf['origtransfereruniqueid']][_0x4db9('0x6')];transfers[_0x2604bf['transfertargetuniqueid']][_0x4db9('0x47')]=agents[_0x2604bf[_0x4db9('0x41')]][_0x4db9('0x47')];transfers[_0x2604bf['transfertargetuniqueid']]['agentcalledAt']=utils[_0x4db9('0x1f')]();transfers[_0x2604bf['transfertargetuniqueid']][_0x4db9('0x34')]=utils[_0x4db9('0x1f')]();transfers[_0x2604bf[_0x4db9('0x4b')]][_0x4db9('0x22')]=0x0;transfers[_0x2604bf[_0x4db9('0x4b')]]['agententerreason']=0x2;}}}catch(_0x1c2c6d){utils['error'](util[_0x4db9('0x3')](_0x4db9('0x40'),_0x2604bf[_0x4db9('0x41')]),_0x1c2c6d);}};exports[_0x4db9('0x4c')]=function(_0x12c1b5){try{utils['debug'](util['format'](_0x4db9('0x4d'),_0x12c1b5[_0x4db9('0x11')]),_0x12c1b5);if(agents[_0x12c1b5['uniqueid']]&&agents[_0x12c1b5['uniqueid']][_0x4db9('0x21')]==='timeout'){if(_0x12c1b5[_0x4db9('0x4e')]==='21'){agents[_0x12c1b5['uniqueid']][_0x4db9('0x21')]=_0x4db9('0x4f');agents[_0x12c1b5['uniqueid']]['lastevent']=_0x4db9('0x4f');}utils[_0x4db9('0x16')](util[_0x4db9('0x3')](_0x4db9('0x50'),_0x12c1b5[_0x4db9('0x11')],agents[_0x12c1b5['uniqueid']]['membername'],agents[_0x12c1b5['uniqueid']]['reason'],agents[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x7')]));writeDB(agents[_0x12c1b5[_0x4db9('0x11')]]);var _0x3a7b70=unanswered['indexOf'](_0x12c1b5[_0x4db9('0x11')]);if(_0x3a7b70>-0x1){unanswered['splice'](_0x3a7b70,0x1);}}if(transfers[_0x12c1b5[_0x4db9('0x11')]]){transfers[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0xc')]=!![];transfers[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x32')]=utils[_0x4db9('0x1f')]();transfers[_0x12c1b5[_0x4db9('0x11')]]['talktime']=utils[_0x4db9('0x33')](transfers[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x32')],transfers[_0x12c1b5['uniqueid']][_0x4db9('0x34')]);transfers[_0x12c1b5[_0x4db9('0x11')]]['reason']='agent';transfers[_0x12c1b5[_0x4db9('0x11')]]['lastevent']='complete';utils[_0x4db9('0x16')](util[_0x4db9('0x3')](_0x4db9('0x50'),_0x12c1b5['uniqueid'],transfers[_0x12c1b5['uniqueid']]['membername'],transfers[_0x12c1b5['uniqueid']]['reason'],transfers[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x7')]));writeDB(transfers[_0x12c1b5[_0x4db9('0x11')]],!![]);}if(agents[_0x12c1b5[_0x4db9('0x11')]]&&agents[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x34')]){agents[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0xc')]=!![];agents[_0x12c1b5['uniqueid']][_0x4db9('0x32')]=utils[_0x4db9('0x1f')]();agents[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x24')]=utils[_0x4db9('0x33')](agents[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x32')],agents[_0x12c1b5[_0x4db9('0x11')]]['agentconnectAt']);agents[_0x12c1b5[_0x4db9('0x11')]]['reason']=agents[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x3a')]?_0x4db9('0x3a'):_0x4db9('0x51');agents[_0x12c1b5['uniqueid']]['lastevent']=_0x4db9('0x35');utils['info'](util[_0x4db9('0x3')](_0x4db9('0x50'),_0x12c1b5[_0x4db9('0x11')],agents[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x1d')],agents[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x21')],agents[_0x12c1b5[_0x4db9('0x11')]]['lastevent']));writeDB(agents[_0x12c1b5[_0x4db9('0x11')]]);}}catch(_0xdc3e6f){utils[_0x4db9('0x18')](util[_0x4db9('0x3')]('[%s][agents][hangup]',_0x12c1b5[_0x4db9('0x11')]),_0xdc3e6f);}}; \ No newline at end of file +var _0x13f6=['[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinenum','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','transfer','transfertype','blind','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','calleridname','agententerreason','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','util','info','format','uniqueid','channel','queue','interface','calleridnum','then','type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','connectedlinename','membername','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','lastevent','reason','timeout','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','[%s][agents][agentconnect]'];(function(_0x2ffa8b,_0x3b246d){var _0x52a8d1=function(_0x5236df){while(--_0x5236df){_0x2ffa8b['push'](_0x2ffa8b['shift']());}};_0x52a8d1(++_0x3b246d);}(_0x13f6,0x124));var _0x613f=function(_0x41a3fa,_0x4320ad){_0x41a3fa=_0x41a3fa-0x0;var _0x18f023=_0x13f6[_0x41a3fa];return _0x18f023;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x563492,_0xd04cfd){utils[_0x613f('0x2')](util[_0x613f('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x563492[_0x613f('0x4')],_0x563492[_0x613f('0x5')],_0x563492[_0x613f('0x6')],_0x563492['membername'],_0x563492[_0x613f('0x7')],_0x563492[_0x613f('0x8')],_0x563492['connectedlinenum'],_0x563492['lastevent']));if(_0x563492['queue']){utils['getVoiceQueueByName'](_0x563492[_0x613f('0x6')])[_0x613f('0x9')](function(_0x363736){if(_0x363736){_0x563492[_0x613f('0xa')]=_0x363736['type'];_0x563492[_0x613f('0xb')]=_0x563492[_0x613f('0xc')]?_0x363736[_0x613f('0xd')]:![];_0x563492['acwtime']=_0x563492[_0x613f('0xb')]?_0x363736[_0x613f('0xe')]:0x0;}utils[_0x613f('0xf')]('CreateVoiceAgentReport',_0x563492);});}else{utils[_0x613f('0xf')](_0x613f('0x10'),_0x563492);}if(_0xd04cfd){delete transfers[_0x563492['uniqueid']];}else{delete agents[_0x563492['destuniqueid']];}}exports['agentcalled']=function(_0x38d90a){try{utils[_0x613f('0x11')](util[_0x613f('0x3')](_0x613f('0x12'),_0x38d90a[_0x613f('0x4')]),_0x38d90a);agents[_0x38d90a[_0x613f('0x13')]]=_0x38d90a;agents[_0x38d90a[_0x613f('0x13')]][_0x613f('0x14')]=utils[_0x613f('0x15')]();agents[_0x38d90a[_0x613f('0x13')]]['lastevent']=_0x613f('0x16');agents[_0x38d90a['destuniqueid']]['connectedlinenum']=null;agents[_0x38d90a[_0x613f('0x13')]][_0x613f('0x17')]=null;utils['info'](util[_0x613f('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x38d90a[_0x613f('0x4')],agents[_0x38d90a[_0x613f('0x13')]][_0x613f('0x18')],_0x38d90a[_0x613f('0x13')]));}catch(_0x3c0feb){utils[_0x613f('0x19')](util['format']('[%s][agents][agentcalled]',_0x38d90a[_0x613f('0x4')]),_0x3c0feb);}};exports['agentringnoanswer']=function(_0x48493c){try{if(!_[_0x613f('0x1a')](agents[_0x48493c[_0x613f('0x13')]])){utils['debug'](util[_0x613f('0x3')](_0x613f('0x1b'),_0x48493c[_0x613f('0x4')]),_0x48493c);utils['info'](util['format'](_0x613f('0x1c'),_0x48493c[_0x613f('0x4')],agents[_0x48493c[_0x613f('0x13')]]['membername'],_0x48493c[_0x613f('0x13')]));agents[_0x48493c[_0x613f('0x13')]][_0x613f('0x1d')]=!![];agents[_0x48493c[_0x613f('0x13')]][_0x613f('0x1e')]=utils['now']();agents[_0x48493c[_0x613f('0x13')]][_0x613f('0x1f')]='timeout';agents[_0x48493c[_0x613f('0x13')]][_0x613f('0x20')]=_0x613f('0x21');agents[_0x48493c['destuniqueid']]['holdtime']=_0x48493c['ringtime']?parseInt(_0x48493c[_0x613f('0x22')])/0x3e8:0x0;agents[_0x48493c['destuniqueid']][_0x613f('0x23')]=0x0;unanswered[_0x613f('0x24')](_0x48493c['destuniqueid']);}}catch(_0x121241){utils[_0x613f('0x19')](util['format']('[%s][agents][agentringnoanswer]',_0x48493c['uniqueid']),_0x121241);}};exports[_0x613f('0x25')]=function(_0x7c1a94){try{_[_0x613f('0x26')](agents,function(_0x47f4af,_0x23eda8){if(_0x47f4af[_0x613f('0x4')]==_0x7c1a94[_0x613f('0x4')]&&!_[_0x613f('0x27')](unanswered,_0x47f4af['destuniqueid'])){utils[_0x613f('0x11')](util[_0x613f('0x3')](_0x613f('0x28'),_0x7c1a94[_0x613f('0x4')]),_0x7c1a94);utils[_0x613f('0x2')](util[_0x613f('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x7c1a94[_0x613f('0x4')],_0x47f4af[_0x613f('0x18')],_0x47f4af[_0x613f('0x13')]));_0x47f4af['agentringnoanswer']=!![];_0x47f4af[_0x613f('0x1e')]=utils['now']();_0x47f4af[_0x613f('0x1f')]=_0x613f('0x29');_0x47f4af[_0x613f('0x20')]=_0x613f('0x29');_0x47f4af[_0x613f('0x2a')]=_0x7c1a94[_0x613f('0x2a')];_0x47f4af['talktime']=0x0;writeDB(_0x47f4af);}});}catch(_0x1a18ce){utils[_0x613f('0x19')](util[_0x613f('0x3')](_0x613f('0x28'),_0x7c1a94[_0x613f('0x4')]),_0x1a18ce);}};exports['agentconnect']=function(_0x59236e){try{if(agents[_0x59236e['destuniqueid']]){utils[_0x613f('0x11')](util[_0x613f('0x3')](_0x613f('0x2b'),_0x59236e[_0x613f('0x4')]),_0x59236e);utils['info'](util[_0x613f('0x3')](_0x613f('0x2c'),_0x59236e['uniqueid'],agents[_0x59236e[_0x613f('0x13')]]['membername'],_0x59236e[_0x613f('0x13')]));agents[_0x59236e['destuniqueid']][_0x613f('0x2d')]=utils['now']();agents[_0x59236e[_0x613f('0x13')]][_0x613f('0x2e')]=_0x59236e[_0x613f('0x2e')];agents[_0x59236e['destuniqueid']][_0x613f('0x17')]=_0x59236e[_0x613f('0x17')];agents[_0x59236e[_0x613f('0x13')]][_0x613f('0x2a')]=_0x59236e[_0x613f('0x22')];agents[_0x59236e[_0x613f('0x13')]][_0x613f('0x1f')]=_0x613f('0x2f');_[_0x613f('0x26')](agents,function(_0x3313c1,_0x4da8d3){if(_0x3313c1[_0x613f('0x13')]!=_0x59236e[_0x613f('0x13')]&&_0x3313c1[_0x613f('0x4')]==_0x59236e[_0x613f('0x4')]){_0x3313c1[_0x613f('0x23')]=0x0;_0x3313c1[_0x613f('0x2a')]=_0x59236e[_0x613f('0x22')];_0x3313c1['agentringnoanswer']=!![];_0x3313c1[_0x613f('0x1e')]=utils[_0x613f('0x15')]();_0x3313c1[_0x613f('0x1f')]=_0x613f('0x30');_0x3313c1[_0x613f('0x20')]=_0x613f('0x30');_0x3313c1[_0x613f('0x31')]=_0x59236e['destuniqueid'];_0x3313c1[_0x613f('0x32')]=_0x59236e[_0x613f('0x18')];writeDB(_0x3313c1);}});}}catch(_0x3bb605){utils[_0x613f('0x19')](util[_0x613f('0x3')](_0x613f('0x2b'),_0x59236e[_0x613f('0x4')]),_0x3bb605);}};exports[_0x613f('0xc')]=function(_0x403feb){try{if(!_[_0x613f('0x1a')](agents[_0x403feb[_0x613f('0x13')]])){utils[_0x613f('0x11')](util[_0x613f('0x3')]('[%s][agents][agentcomplete]',_0x403feb[_0x613f('0x4')]),_0x403feb);utils[_0x613f('0x2')](util[_0x613f('0x3')](_0x613f('0x33'),_0x403feb['uniqueid'],agents[_0x403feb[_0x613f('0x13')]][_0x613f('0x18')],_0x403feb[_0x613f('0x13')]));agents[_0x403feb[_0x613f('0x13')]][_0x613f('0xc')]=!![];agents[_0x403feb[_0x613f('0x13')]][_0x613f('0x34')]=utils[_0x613f('0x15')]();agents[_0x403feb[_0x613f('0x13')]][_0x613f('0x23')]=utils['diffTime'](agents[_0x403feb['destuniqueid']][_0x613f('0x34')],agents[_0x403feb[_0x613f('0x13')]]['agentconnectAt']);agents[_0x403feb[_0x613f('0x13')]][_0x613f('0x20')]=_0x403feb[_0x613f('0x20')];agents[_0x403feb[_0x613f('0x13')]][_0x613f('0x1f')]=_0x613f('0x35');writeDB(agents[_0x403feb[_0x613f('0x13')]]);}}catch(_0x3a7f95){utils[_0x613f('0x19')](util[_0x613f('0x3')](_0x613f('0x36'),_0x403feb[_0x613f('0x4')]),_0x3a7f95);}};exports[_0x613f('0x37')]=function(_0x17f8e5){try{if(!_[_0x613f('0x1a')](agents[_0x17f8e5[_0x613f('0x38')]])){utils[_0x613f('0x11')](util[_0x613f('0x3')]('[%s][agents][blindtransfer]',_0x17f8e5['uniqueid']),_0x17f8e5);utils[_0x613f('0x2')](util[_0x613f('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x17f8e5['uniqueid'],agents[_0x17f8e5[_0x613f('0x38')]]['membername'],agents[_0x17f8e5['transfereruniqueid']][_0x613f('0x4')]));agents[_0x17f8e5[_0x613f('0x38')]][_0x613f('0x39')]=!![];agents[_0x17f8e5['transfereruniqueid']][_0x613f('0x3a')]=_0x613f('0x3b');agents[_0x17f8e5['transfereruniqueid']]['transferexten']=_0x17f8e5[_0x613f('0x3c')];agents[_0x17f8e5[_0x613f('0x38')]][_0x613f('0x3d')]=agents[_0x17f8e5[_0x613f('0x38')]][_0x613f('0x4')];}}catch(_0x395357){utils[_0x613f('0x19')](util['format']('[%s][agents][blindtransfer]',_0x17f8e5[_0x613f('0x4')]),_0x395357);}};exports['attendedtransfer']=function(_0x5dd54e){try{utils[_0x613f('0x11')](util[_0x613f('0x3')](_0x613f('0x3e'),_0x5dd54e['origtransfereruniqueid']),_0x5dd54e);if(_0x5dd54e[_0x613f('0x3f')]==_0x5dd54e[_0x613f('0x40')]){if(!_[_0x613f('0x1a')](agents[_0x5dd54e[_0x613f('0x41')]])){utils[_0x613f('0x2')](util[_0x613f('0x3')](_0x613f('0x42'),_0x5dd54e['origtransfereruniqueid'],agents[_0x5dd54e[_0x613f('0x41')]]['membername']));agents[_0x5dd54e[_0x613f('0x41')]][_0x613f('0x39')]=!![];agents[_0x5dd54e[_0x613f('0x41')]][_0x613f('0x3a')]=_0x613f('0x43');agents[_0x5dd54e[_0x613f('0x41')]][_0x613f('0x44')]=_0x5dd54e[_0x613f('0x45')];agents[_0x5dd54e[_0x613f('0x41')]][_0x613f('0x3d')]=_0x5dd54e[_0x613f('0x3f')];}if(_0x5dd54e[_0x613f('0x46')]&&agents[_0x5dd54e[_0x613f('0x46')]]){agents[_0x5dd54e['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x5dd54e[_0x613f('0x46')]]=_['clone'](agents[_0x5dd54e[_0x613f('0x46')]]);transfers[_0x5dd54e[_0x613f('0x46')]][_0x613f('0x8')]=agents[_0x5dd54e[_0x613f('0x41')]][_0x613f('0x8')];transfers[_0x5dd54e[_0x613f('0x46')]][_0x613f('0x47')]=agents[_0x5dd54e[_0x613f('0x41')]][_0x613f('0x47')];transfers[_0x5dd54e[_0x613f('0x46')]][_0x613f('0x14')]=utils['now']();transfers[_0x5dd54e[_0x613f('0x46')]][_0x613f('0x2d')]=utils[_0x613f('0x15')]();transfers[_0x5dd54e[_0x613f('0x46')]]['holdtime']=0x0;transfers[_0x5dd54e[_0x613f('0x46')]][_0x613f('0x48')]=0x2;}}else if(_0x5dd54e['secondtransfereruniqueid']==_0x5dd54e['secondtransfererlinkedid']){if(!_[_0x613f('0x1a')](agents[_0x5dd54e['origtransfereruniqueid']])){utils['info'](util['format'](_0x613f('0x42'),_0x5dd54e['origtransfereruniqueid'],agents[_0x5dd54e['origtransfereruniqueid']]['membername']));agents[_0x5dd54e[_0x613f('0x3f')]][_0x613f('0x39')]=!![];agents[_0x5dd54e['origtransfereruniqueid']][_0x613f('0x3a')]=_0x613f('0x43');agents[_0x5dd54e[_0x613f('0x3f')]][_0x613f('0x44')]=_0x5dd54e['secondtransfererexten'];agents[_0x5dd54e[_0x613f('0x3f')]][_0x613f('0x3d')]=_0x5dd54e['secondtransfereruniqueid'];}if(_0x5dd54e[_0x613f('0x49')]&&agents[_0x5dd54e[_0x613f('0x49')]]){agents[_0x5dd54e[_0x613f('0x49')]][_0x613f('0x48')]=0x1;transfers[_0x5dd54e[_0x613f('0x49')]]=_[_0x613f('0x4a')](agents[_0x5dd54e[_0x613f('0x49')]]);transfers[_0x5dd54e[_0x613f('0x49')]][_0x613f('0x8')]=agents[_0x5dd54e[_0x613f('0x3f')]][_0x613f('0x8')];transfers[_0x5dd54e[_0x613f('0x49')]]['calleridname']=agents[_0x5dd54e[_0x613f('0x3f')]][_0x613f('0x47')];transfers[_0x5dd54e[_0x613f('0x49')]][_0x613f('0x14')]=utils[_0x613f('0x15')]();transfers[_0x5dd54e[_0x613f('0x49')]]['agentconnectAt']=utils[_0x613f('0x15')]();transfers[_0x5dd54e[_0x613f('0x49')]][_0x613f('0x2a')]=0x0;transfers[_0x5dd54e[_0x613f('0x49')]][_0x613f('0x48')]=0x2;}}}catch(_0x2ae459){utils['error'](util['format'](_0x613f('0x3e'),_0x5dd54e[_0x613f('0x3f')]),_0x2ae459);}};exports[_0x613f('0x4b')]=function(_0xddcd6){try{utils['debug'](util[_0x613f('0x3')](_0x613f('0x4c'),_0xddcd6[_0x613f('0x4')]),_0xddcd6);if(agents[_0xddcd6[_0x613f('0x4')]]&&agents[_0xddcd6['uniqueid']][_0x613f('0x20')]===_0x613f('0x21')){if(_0xddcd6[_0x613f('0x4d')]==='21'){agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0x20')]=_0x613f('0x4e');agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0x1f')]='rejected';}utils[_0x613f('0x2')](util[_0x613f('0x3')](_0x613f('0x4f'),_0xddcd6[_0x613f('0x4')],agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0x18')],agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0x20')],agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0x1f')]));writeDB(agents[_0xddcd6['uniqueid']]);var _0x2c4b88=unanswered[_0x613f('0x50')](_0xddcd6[_0x613f('0x4')]);if(_0x2c4b88>-0x1){unanswered[_0x613f('0x51')](_0x2c4b88,0x1);}}if(transfers[_0xddcd6[_0x613f('0x4')]]){transfers[_0xddcd6[_0x613f('0x4')]][_0x613f('0xc')]=!![];transfers[_0xddcd6[_0x613f('0x4')]][_0x613f('0x34')]=utils[_0x613f('0x15')]();transfers[_0xddcd6[_0x613f('0x4')]]['talktime']=utils[_0x613f('0x52')](transfers[_0xddcd6[_0x613f('0x4')]][_0x613f('0x34')],transfers[_0xddcd6[_0x613f('0x4')]][_0x613f('0x2d')]);transfers[_0xddcd6[_0x613f('0x4')]][_0x613f('0x20')]=_0x613f('0x53');transfers[_0xddcd6[_0x613f('0x4')]][_0x613f('0x1f')]=_0x613f('0x35');utils[_0x613f('0x2')](util['format'](_0x613f('0x4f'),_0xddcd6[_0x613f('0x4')],transfers[_0xddcd6['uniqueid']][_0x613f('0x18')],transfers[_0xddcd6['uniqueid']][_0x613f('0x20')],transfers[_0xddcd6['uniqueid']]['lastevent']));writeDB(transfers[_0xddcd6[_0x613f('0x4')]],!![]);}if(agents[_0xddcd6[_0x613f('0x4')]]&&agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0x2d')]){agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0xc')]=!![];agents[_0xddcd6[_0x613f('0x4')]]['agentcompleteAt']=utils[_0x613f('0x15')]();agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0x23')]=utils[_0x613f('0x52')](agents[_0xddcd6[_0x613f('0x4')]]['agentcompleteAt'],agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0x2d')]);agents[_0xddcd6['uniqueid']][_0x613f('0x20')]=agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0x39')]?'transfer':'agent';agents[_0xddcd6['uniqueid']][_0x613f('0x1f')]=_0x613f('0x35');utils['info'](util[_0x613f('0x3')](_0x613f('0x4f'),_0xddcd6[_0x613f('0x4')],agents[_0xddcd6['uniqueid']][_0x613f('0x18')],agents[_0xddcd6['uniqueid']][_0x613f('0x20')],agents[_0xddcd6['uniqueid']]['lastevent']));writeDB(agents[_0xddcd6[_0x613f('0x4')]]);}}catch(_0x1b5f6e){utils[_0x613f('0x19')](util[_0x613f('0x3')](_0x613f('0x4c'),_0xddcd6[_0x613f('0x4')]),_0x1b5f6e);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 9f8b109..60556ee 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 _0xe64b=['[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','now','disposition','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfereruniqueid','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','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','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','noop','execif','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','debug'];(function(_0x351a0e,_0x16862c){var _0x5ed564=function(_0x43901f){while(--_0x43901f){_0x351a0e['push'](_0x351a0e['shift']());}};_0x5ed564(++_0x16862c);}(_0xe64b,0x1a3));var _0xbe64=function(_0x3591d3,_0xed3065){_0x3591d3=_0x3591d3-0x0;var _0x4ac2e9=_0xe64b[_0x3591d3];return _0x4ac2e9;};'use strict';var _=require(_0xbe64('0x0'));var util=require(_0xbe64('0x1'));var utils=require(_0xbe64('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0xbe64('0x3'),_0xbe64('0x4'),'FAILED',_0xbe64('0x3'),_0xbe64('0x3'),_0xbe64('0x3'),'ANSWERED',_0xbe64('0x5'),_0xbe64('0x4'),_0xbe64('0x4'),'FAILED'];var channels={};function writeDB(_0x513fb9){var _0xe3eabc;if(transfers[_0xbe64('0x6')][_0x513fb9[_0xbe64('0x7')]]){_0xe3eabc=_0x513fb9[_0xbe64('0x7')];_0x513fb9[_0xbe64('0x7')]=transfers[_0xbe64('0x6')][_0x513fb9[_0xbe64('0x7')]][_0xbe64('0x8')];}utils[_0xbe64('0x9')](util[_0xbe64('0xa')](_0xbe64('0xb'),_0x513fb9[_0xbe64('0x7')],_0x513fb9[_0xbe64('0xc')],_0x513fb9[_0xbe64('0xd')],_0x513fb9[_0xbe64('0xe')],_0x513fb9['interface'],_0x513fb9[_0xbe64('0xf')],_0x513fb9['connectedlinenum'],_0x513fb9[_0xbe64('0x10')]));if(_0x513fb9[_0xbe64('0x11')]){utils[_0xbe64('0x12')](_0x513fb9['accountcode'])[_0xbe64('0x13')](function(_0x5c129e){if(_0x5c129e){_0x513fb9[_0xbe64('0x14')]=_0x5c129e['id'];}utils[_0xbe64('0x15')](_0xbe64('0x16'),_0x513fb9);});}else{utils[_0xbe64('0x15')]('CreateVoiceCallReport',_0x513fb9);}if(channels[_0x513fb9[_0xbe64('0x7')]]){delete channels[_0x513fb9[_0xbe64('0x7')]];}else if(_0xe3eabc&&channels[_0xe3eabc]){if(!transfers[_0xbe64('0x6')][_0xe3eabc][_0xbe64('0x17')])delete transfers[_0xbe64('0x6')][_0xe3eabc];delete channels[_0xe3eabc];}}exports['newchannel']=function(_0x393017){try{utils[_0xbe64('0x18')](util['format'](_0xbe64('0x19'),_0x393017['uniqueid']),_0x393017);if(_0x393017[_0xbe64('0x7')]==_0x393017['linkedid']&&_0x393017[_0xbe64('0xc')]!=_0xbe64('0x1a')){utils[_0xbe64('0x9')](util[_0xbe64('0xa')](_0xbe64('0x1b'),_0x393017['uniqueid'],_0x393017[_0xbe64('0x1c')],_0x393017[_0xbe64('0x1d')]));channels[_0x393017[_0xbe64('0x7')]]={'uniqueid':_0x393017[_0xbe64('0x7')],'accountcode':_0x393017[_0xbe64('0x11')],'source':_0x393017[_0xbe64('0xf')],'destination':_0x393017[_0xbe64('0x1d')],'destinationcontext':_0x393017[_0xbe64('0x1c')],'channel':_0x393017[_0xbe64('0xc')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xbe64('0x3'),'amaflags':_0xbe64('0x1e')};}}catch(_0x356916){utils[_0xbe64('0x1f')](util[_0xbe64('0xa')](_0xbe64('0x19'),_0x393017[_0xbe64('0x7')]),_0x356916);}};exports[_0xbe64('0x20')]=function(_0x5deea5){try{utils[_0xbe64('0x18')](util[_0xbe64('0xa')]('[%s][calls][newstate]',_0x5deea5['uniqueid']),_0x5deea5);if(!_[_0xbe64('0x21')](channels[_0x5deea5[_0xbe64('0x7')]])&&_0x5deea5[_0xbe64('0x22')]==0x6){utils[_0xbe64('0x9')](util[_0xbe64('0xa')](_0xbe64('0x23'),_0x5deea5[_0xbe64('0x7')],_0x5deea5[_0xbe64('0x1c')],_0x5deea5[_0xbe64('0xc')]));if(_[_0xbe64('0x21')](channels[_0x5deea5['uniqueid']][_0xbe64('0x24')])){channels[_0x5deea5['uniqueid']][_0xbe64('0x24')]=utils['now']();}}else if(!_['isNil'](channels[_0x5deea5['linkedid']])&&_0x5deea5['channelstate']==0x6&&_0x5deea5[_0xbe64('0x1c')]!=_0xbe64('0x25')){utils['info'](util[_0xbe64('0xa')](_0xbe64('0x26'),_0x5deea5[_0xbe64('0x7')],_0x5deea5[_0xbe64('0x27')],_0x5deea5[_0xbe64('0x1c')],_0x5deea5[_0xbe64('0xc')]));channels[_0x5deea5['linkedid']][_0xbe64('0x11')]=_0x5deea5['accountcode'];channels[_0x5deea5['linkedid']][_0xbe64('0x28')]=_0x5deea5[_0xbe64('0xc')];if(_[_0xbe64('0x21')](channels[_0x5deea5[_0xbe64('0x27')]][_0xbe64('0x29')])){channels[_0x5deea5[_0xbe64('0x27')]][_0xbe64('0x29')]=utils[_0xbe64('0x2a')]();}channels[_0x5deea5[_0xbe64('0x27')]][_0xbe64('0x2b')]=dispositions[_['toNumber'](_0x5deea5['channelstate'])]||_0xbe64('0x2c');}}catch(_0x515780){utils[_0xbe64('0x1f')](util['format']('[%s][calls][newstate]',_0x5deea5[_0xbe64('0x7')]),_0x515780);}};exports[_0xbe64('0x2d')]=function(_0x3aab90){try{if(!_[_0xbe64('0x21')](channels[_0x3aab90[_0xbe64('0x7')]])){utils[_0xbe64('0x18')](util[_0xbe64('0xa')](_0xbe64('0x2e'),_0x3aab90[_0xbe64('0x7')]),_0x3aab90);if(_['isNil'](channels[_0x3aab90[_0xbe64('0x7')]]['callerid'])){channels[_0x3aab90[_0xbe64('0x7')]][_0xbe64('0x2f')]=_0x3aab90[_0xbe64('0x30')]+'\x20<'+_0x3aab90[_0xbe64('0xf')]+'>';}utils[_0xbe64('0x9')](util[_0xbe64('0xa')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x3aab90['uniqueid'],channels[_0x3aab90[_0xbe64('0x7')]][_0xbe64('0x2f')],_0x3aab90[_0xbe64('0x31')]));channels[_0x3aab90[_0xbe64('0x7')]][_0xbe64('0x32')]=utils[_0xbe64('0x2a')]();channels[_0x3aab90['uniqueid']][_0xbe64('0x33')]=utils[_0xbe64('0x34')](channels[_0x3aab90['uniqueid']][_0xbe64('0x32')],channels[_0x3aab90[_0xbe64('0x7')]][_0xbe64('0x35')]);channels[_0x3aab90[_0xbe64('0x7')]][_0xbe64('0x36')]=channels[_0x3aab90[_0xbe64('0x7')]][_0xbe64('0x29')]?utils[_0xbe64('0x34')](channels[_0x3aab90[_0xbe64('0x7')]][_0xbe64('0x32')],channels[_0x3aab90[_0xbe64('0x7')]]['answertime']):0x0;writeDB(channels[_0x3aab90[_0xbe64('0x7')]]);}}catch(_0x5624da){utils[_0xbe64('0x1f')](util[_0xbe64('0xa')](_0xbe64('0x2e'),_0x3aab90[_0xbe64('0x7')]),_0x5624da);}};exports['attendedtransfer']=function(_0x3bc4dc){try{if(!_[_0xbe64('0x21')](channels[_0x3bc4dc[_0xbe64('0x37')]])){utils[_0xbe64('0x18')](util[_0xbe64('0xa')](_0xbe64('0x38'),_0x3bc4dc['origtransfereruniqueid']),_0x3bc4dc);if(channels[_0x3bc4dc[_0xbe64('0x37')]][_0xbe64('0xc')]==_0x3bc4dc[_0xbe64('0x39')]){utils[_0xbe64('0x9')](util[_0xbe64('0xa')](_0xbe64('0x3a'),_0x3bc4dc['origtransfereruniqueid'],_0x3bc4dc[_0xbe64('0x37')],_0x3bc4dc[_0xbe64('0x3b')]));channels[_0x3bc4dc[_0xbe64('0x37')]][_0xbe64('0x28')]=_0x3bc4dc[_0xbe64('0x3b')];channels[_0x3bc4dc[_0xbe64('0x37')]][_0xbe64('0x3c')]=_0xbe64('0x3d');}else if(channels[_0x3bc4dc[_0xbe64('0x37')]][_0xbe64('0xc')]=_0x3bc4dc[_0xbe64('0x3e')]){utils[_0xbe64('0x9')](util['format'](_0xbe64('0x3a'),_0x3bc4dc[_0xbe64('0x3f')],_0x3bc4dc[_0xbe64('0x37')],_0x3bc4dc[_0xbe64('0x40')]));channels[_0x3bc4dc[_0xbe64('0x37')]]['destinationchannel']=_0x3bc4dc[_0xbe64('0x40')];channels[_0x3bc4dc[_0xbe64('0x37')]][_0xbe64('0x3c')]='_attended';}}}catch(_0x16fe38){utils[_0xbe64('0x1f')](util[_0xbe64('0xa')](_0xbe64('0x38'),_0x3bc4dc[_0xbe64('0x3f')]),_0x16fe38);}};exports[_0xbe64('0x41')]=function(_0x50e689){try{if(!_[_0xbe64('0x21')](channels[_0x50e689[_0xbe64('0x7')]])){utils[_0xbe64('0x18')](util['format'](_0xbe64('0x42'),_0x50e689['uniqueid']),_0x50e689);channels[_0x50e689[_0xbe64('0x7')]][_0xbe64('0x43')]=utils[_0xbe64('0x2a')]();utils['info'](util[_0xbe64('0xa')](_0xbe64('0x44'),_0x50e689[_0xbe64('0x7')],channels[_0x50e689['uniqueid']][_0xbe64('0x43')]));}}catch(_0x2d665d){utils['error'](util[_0xbe64('0xa')](_0xbe64('0x42'),_0x50e689[_0xbe64('0x7')]),_0x2d665d);}};exports[_0xbe64('0x45')]=function(_0x3a7b81){try{if(!_[_0xbe64('0x21')](channels[_0x3a7b81[_0xbe64('0x7')]])){utils[_0xbe64('0x18')](util[_0xbe64('0xa')]('[%s][calls][musiconholdstop]',_0x3a7b81[_0xbe64('0x7')]),_0x3a7b81);if(!_['isNil'](channels[_0x3a7b81[_0xbe64('0x7')]][_0xbe64('0x43')])){channels[_0x3a7b81[_0xbe64('0x7')]]['mohtime']+=utils[_0xbe64('0x34')](utils['now'](),channels[_0x3a7b81[_0xbe64('0x7')]]['musiconholdstartAt']);utils[_0xbe64('0x9')](util[_0xbe64('0xa')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x3a7b81[_0xbe64('0x7')],channels[_0x3a7b81[_0xbe64('0x7')]][_0xbe64('0x46')]));delete channels[_0x3a7b81[_0xbe64('0x7')]][_0xbe64('0x43')];}}}catch(_0x122c1d){utils[_0xbe64('0x1f')](util[_0xbe64('0xa')]('[%s][calls][musiconholdstop]',_0x3a7b81[_0xbe64('0x7')]),_0x122c1d);}};exports[_0xbe64('0x47')]=function(_0x101223){try{if(!_[_0xbe64('0x21')](channels[_0x101223[_0xbe64('0x7')]])){utils[_0xbe64('0x18')](util[_0xbe64('0xa')](_0xbe64('0x48'),_0x101223[_0xbe64('0x7')]),_0x101223);if(!_[_0xbe64('0x21')](_0x101223[_0xbe64('0x49')][_0xbe64('0x4a')])){utils[_0xbe64('0x9')](util[_0xbe64('0xa')](_0xbe64('0x4b'),_0x101223[_0xbe64('0x7')],_0x101223[_0xbe64('0x4c')]));channels[_0x101223[_0xbe64('0x7')]][_0xbe64('0x4d')]=_0x101223[_0xbe64('0x4c')];}if(!_[_0xbe64('0x21')](_0x101223[_0xbe64('0x49')][_0xbe64('0x4e')])){utils[_0xbe64('0x9')](util[_0xbe64('0xa')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x101223['uniqueid'],_0x101223[_0xbe64('0x4c')]));channels[_0x101223[_0xbe64('0x7')]][_0xbe64('0x4f')]=_0x101223['value'];channels[_0x101223[_0xbe64('0x7')]][_0xbe64('0x2f')]='\x22'+_0x101223[_0xbe64('0x4c')]+_0xbe64('0x50')+_0x101223[_0xbe64('0x4c')]+'>';}if(!_[_0xbe64('0x21')](_0x101223[_0xbe64('0x49')][_0xbe64('0x51')])||!_[_0xbe64('0x21')](_0x101223[_0xbe64('0x49')][_0xbe64('0x52')])){utils['info'](util[_0xbe64('0xa')](_0xbe64('0x53'),_0x101223[_0xbe64('0x7')],!_[_0xbe64('0x21')](_0x101223['variable'][_0xbe64('0x51')])?_0xbe64('0x51'):'xmd-callerid',_0x101223[_0xbe64('0x4c')]));channels[_0x101223[_0xbe64('0x7')]][_0xbe64('0x2f')]=_0x101223[_0xbe64('0x4c')];}if(!_[_0xbe64('0x21')](_0x101223[_0xbe64('0x49')][_0xbe64('0x54')])||!_[_0xbe64('0x21')](_0x101223[_0xbe64('0x49')][_0xbe64('0x55')])){utils[_0xbe64('0x9')](util[_0xbe64('0xa')](_0xbe64('0x53'),_0x101223[_0xbe64('0x7')],!_[_0xbe64('0x21')](_0x101223[_0xbe64('0x49')][_0xbe64('0x54')])?_0xbe64('0x54'):_0xbe64('0x55'),_0x101223['value']));channels[_0x101223['uniqueid']][_0xbe64('0x56')]=_0xbe64('0x57');channels[_0x101223[_0xbe64('0x7')]][_0xbe64('0x58')]=_0x101223['value'];channels[_0x101223[_0xbe64('0x7')]][_0xbe64('0xd')]=!![];}if(!_[_0xbe64('0x21')](_0x101223[_0xbe64('0x49')][_0xbe64('0x59')])){utils[_0xbe64('0x9')](util[_0xbe64('0xa')](_0xbe64('0x5a'),_0x101223['uniqueid'],_0x101223[_0xbe64('0x4c')]));channels[_0x101223['uniqueid']][_0xbe64('0x5b')]=_0x101223[_0xbe64('0x4c')];}if(!_['isNil'](_0x101223[_0xbe64('0x49')][_0xbe64('0x5c')])){utils['info'](util[_0xbe64('0xa')](_0xbe64('0x5d'),_0x101223['uniqueid'],_0x101223['value']));channels[_0x101223[_0xbe64('0x7')]][_0xbe64('0x5e')]=_0x101223[_0xbe64('0x4c')];}if(!_[_0xbe64('0x21')](_0x101223[_0xbe64('0x49')]['outboundrouteid'])){utils[_0xbe64('0x9')](util[_0xbe64('0xa')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x101223[_0xbe64('0x7')],_0x101223[_0xbe64('0x4c')]));channels[_0x101223[_0xbe64('0x7')]][_0xbe64('0x5f')]=_0x101223[_0xbe64('0x4c')];}if(!_[_0xbe64('0x21')](_0x101223[_0xbe64('0x49')][_0xbe64('0x60')])){utils['info'](util[_0xbe64('0xa')](_0xbe64('0x61'),_0x101223[_0xbe64('0x7')],_0x101223[_0xbe64('0x4c')]));channels[_0x101223['uniqueid']]['sipcallid']=_0x101223[_0xbe64('0x4c')];}}}catch(_0x1c61b5){utils['error'](util[_0xbe64('0xa')]('[%s][calls][varset]',_0x101223[_0xbe64('0x7')]),_0x1c61b5);}};exports[_0xbe64('0x62')]=function(_0x233b07){try{if(!_[_0xbe64('0x21')](channels[_0x233b07[_0xbe64('0x7')]])){utils['debug'](util[_0xbe64('0xa')]('[%s][calls][newexten]',_0x233b07['uniqueid']),_0x233b07);utils[_0xbe64('0x9')](util['format'](_0xbe64('0x63'),_0x233b07['uniqueid'],_0x233b07['application'],_0x233b07['appdata']));if(_0x233b07[_0xbe64('0x64')][_0xbe64('0x65')]()==_0xbe64('0x66')&&_[_0xbe64('0x67')](_0x233b07[_0xbe64('0x68')][_0xbe64('0x65')](),'cdr')){var _0x4b40b9=_0x233b07['appdata'][_0xbe64('0x69')]('=');var _0x1405a0=_0x4b40b9[0x0][_0xbe64('0x6a')](_0x4b40b9[0x0][_0xbe64('0x6b')]('(')+0x1,_0x4b40b9[0x0]['lastIndexOf'](')'));var _0x5ae1d5=_0x4b40b9[0x1];channels[_0x233b07[_0xbe64('0x7')]][_0x1405a0]=_0x5ae1d5;}if(!_['includes']([_0xbe64('0x2d'),_0xbe64('0x6c'),_0xbe64('0x6d'),_0xbe64('0x66'),_0xbe64('0x6e')],_0x233b07[_0xbe64('0x64')][_0xbe64('0x65')]())){channels[_0x233b07[_0xbe64('0x7')]][_0xbe64('0x56')]=_0x233b07['application'];channels[_0x233b07[_0xbe64('0x7')]][_0xbe64('0x58')]=_0x233b07[_0xbe64('0x68')];}}}catch(_0x42b1a6){utils[_0xbe64('0x1f')](util[_0xbe64('0xa')]('[%s][calls][newexten]',_0x233b07['uniqueid']),_0x42b1a6);}}; \ No newline at end of file +var _0x0eb2=['callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','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','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','execif','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','DOCUMENTATION','error','newstate','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','answertime','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]'];(function(_0x29176f,_0x575a58){var _0x2f095e=function(_0x5d3352){while(--_0x5d3352){_0x29176f['push'](_0x29176f['shift']());}};_0x2f095e(++_0x575a58);}(_0x0eb2,0x11c));var _0x20eb=function(_0x47cd62,_0x19bbf3){_0x47cd62=_0x47cd62-0x0;var _0x7923b9=_0x0eb2[_0x47cd62];return _0x7923b9;};'use strict';var _=require(_0x20eb('0x0'));var util=require('util');var utils=require(_0x20eb('0x1'));var transfers=require(_0x20eb('0x2'));var dispositions=[_0x20eb('0x3'),_0x20eb('0x4'),_0x20eb('0x4'),'NO\x20ANSWER',_0x20eb('0x3'),'NO\x20ANSWER','ANSWERED','BUSY',_0x20eb('0x4'),_0x20eb('0x4'),_0x20eb('0x4')];var channels={};function writeDB(_0x4a7e1a){var _0x3dfc09;if(transfers[_0x20eb('0x5')][_0x4a7e1a[_0x20eb('0x6')]]){_0x3dfc09=_0x4a7e1a[_0x20eb('0x6')];_0x4a7e1a[_0x20eb('0x6')]=transfers[_0x20eb('0x5')][_0x4a7e1a[_0x20eb('0x6')]][_0x20eb('0x7')];}utils[_0x20eb('0x8')](util[_0x20eb('0x9')](_0x20eb('0xa'),_0x4a7e1a[_0x20eb('0x6')],_0x4a7e1a[_0x20eb('0xb')],_0x4a7e1a[_0x20eb('0xc')],_0x4a7e1a['membername'],_0x4a7e1a[_0x20eb('0xd')],_0x4a7e1a['calleridnum'],_0x4a7e1a[_0x20eb('0xe')],_0x4a7e1a['lastevent']));if(_0x4a7e1a[_0x20eb('0xf')]){utils[_0x20eb('0x10')](_0x4a7e1a[_0x20eb('0xf')])[_0x20eb('0x11')](function(_0xfee98d){if(_0xfee98d){_0x4a7e1a[_0x20eb('0x12')]=_0xfee98d['id'];}utils[_0x20eb('0x13')](_0x20eb('0x14'),_0x4a7e1a);});}else{utils[_0x20eb('0x13')](_0x20eb('0x14'),_0x4a7e1a);}if(channels[_0x4a7e1a[_0x20eb('0x6')]]){delete channels[_0x4a7e1a[_0x20eb('0x6')]];}else if(_0x3dfc09&&channels[_0x3dfc09]){if(!transfers[_0x20eb('0x5')][_0x3dfc09][_0x20eb('0x15')])delete transfers[_0x20eb('0x5')][_0x3dfc09];delete channels[_0x3dfc09];}}exports['newchannel']=function(_0x1c86de){try{utils['debug'](util[_0x20eb('0x9')](_0x20eb('0x16'),_0x1c86de[_0x20eb('0x6')]),_0x1c86de);if(_0x1c86de[_0x20eb('0x6')]==_0x1c86de[_0x20eb('0x17')]&&_0x1c86de[_0x20eb('0xb')]!=_0x20eb('0x18')){utils['info'](util[_0x20eb('0x9')](_0x20eb('0x19'),_0x1c86de['uniqueid'],_0x1c86de[_0x20eb('0x1a')],_0x1c86de[_0x20eb('0x1b')]));channels[_0x1c86de['uniqueid']]={'uniqueid':_0x1c86de[_0x20eb('0x6')],'accountcode':_0x1c86de[_0x20eb('0xf')],'source':_0x1c86de[_0x20eb('0x1c')],'destination':_0x1c86de['exten'],'destinationcontext':_0x1c86de[_0x20eb('0x1a')],'channel':_0x1c86de[_0x20eb('0xb')],'starttime':utils[_0x20eb('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x20eb('0x1e')};}}catch(_0x15bac3){utils[_0x20eb('0x1f')](util['format'](_0x20eb('0x16'),_0x1c86de['uniqueid']),_0x15bac3);}};exports[_0x20eb('0x20')]=function(_0x363ece){try{utils[_0x20eb('0x21')](util[_0x20eb('0x9')](_0x20eb('0x22'),_0x363ece[_0x20eb('0x6')]),_0x363ece);if(!_[_0x20eb('0x23')](channels[_0x363ece[_0x20eb('0x6')]])&&_0x363ece[_0x20eb('0x24')]==0x6){utils['info'](util[_0x20eb('0x9')](_0x20eb('0x25'),_0x363ece[_0x20eb('0x6')],_0x363ece['context'],_0x363ece['channel']));if(_['isNil'](channels[_0x363ece['uniqueid']][_0x20eb('0x26')])){channels[_0x363ece[_0x20eb('0x6')]]['systemanswertime']=utils[_0x20eb('0x1d')]();}}else if(!_['isNil'](channels[_0x363ece[_0x20eb('0x17')]])&&_0x363ece['channelstate']==0x6&&_0x363ece['context']!=_0x20eb('0x27')){utils[_0x20eb('0x8')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x363ece[_0x20eb('0x6')],_0x363ece[_0x20eb('0x17')],_0x363ece['context'],_0x363ece[_0x20eb('0xb')]));channels[_0x363ece[_0x20eb('0x17')]]['accountcode']=_0x363ece[_0x20eb('0xf')];channels[_0x363ece[_0x20eb('0x17')]]['destinationchannel']=_0x363ece[_0x20eb('0xb')];if(_['isNil'](channels[_0x363ece[_0x20eb('0x17')]][_0x20eb('0x28')])){channels[_0x363ece[_0x20eb('0x17')]]['answertime']=utils[_0x20eb('0x1d')]();}channels[_0x363ece[_0x20eb('0x17')]][_0x20eb('0x29')]=dispositions[_[_0x20eb('0x2a')](_0x363ece['channelstate'])]||_0x20eb('0x2b');}}catch(_0x27a3b0){utils[_0x20eb('0x1f')](util[_0x20eb('0x9')](_0x20eb('0x22'),_0x363ece[_0x20eb('0x6')]),_0x27a3b0);}};exports[_0x20eb('0x2c')]=function(_0x473626){try{if(!_[_0x20eb('0x23')](channels[_0x473626[_0x20eb('0x6')]])){utils[_0x20eb('0x21')](util['format'](_0x20eb('0x2d'),_0x473626[_0x20eb('0x6')]),_0x473626);if(_[_0x20eb('0x23')](channels[_0x473626[_0x20eb('0x6')]]['callerid'])){channels[_0x473626[_0x20eb('0x6')]][_0x20eb('0x2e')]=_0x473626[_0x20eb('0x2f')]+'\x20<'+_0x473626['calleridnum']+'>';}utils[_0x20eb('0x8')](util[_0x20eb('0x9')](_0x20eb('0x30'),_0x473626[_0x20eb('0x6')],channels[_0x473626[_0x20eb('0x6')]][_0x20eb('0x2e')],_0x473626[_0x20eb('0x31')]));channels[_0x473626[_0x20eb('0x6')]][_0x20eb('0x32')]=utils[_0x20eb('0x1d')]();channels[_0x473626['uniqueid']][_0x20eb('0x33')]=utils['diffTime'](channels[_0x473626[_0x20eb('0x6')]][_0x20eb('0x32')],channels[_0x473626[_0x20eb('0x6')]][_0x20eb('0x34')]);channels[_0x473626[_0x20eb('0x6')]][_0x20eb('0x35')]=channels[_0x473626[_0x20eb('0x6')]][_0x20eb('0x28')]?utils[_0x20eb('0x36')](channels[_0x473626['uniqueid']][_0x20eb('0x32')],channels[_0x473626['uniqueid']][_0x20eb('0x28')]):0x0;writeDB(channels[_0x473626['uniqueid']]);}}catch(_0x4a93af){utils[_0x20eb('0x1f')](util['format'](_0x20eb('0x2d'),_0x473626[_0x20eb('0x6')]),_0x4a93af);}};exports[_0x20eb('0x37')]=function(_0x16dfa1){try{if(!_[_0x20eb('0x23')](channels[_0x16dfa1[_0x20eb('0x38')]])){utils[_0x20eb('0x21')](util[_0x20eb('0x9')](_0x20eb('0x39'),_0x16dfa1[_0x20eb('0x3a')]),_0x16dfa1);if(channels[_0x16dfa1[_0x20eb('0x38')]][_0x20eb('0xb')]==_0x16dfa1[_0x20eb('0x3b')]){utils[_0x20eb('0x8')](util[_0x20eb('0x9')](_0x20eb('0x3c'),_0x16dfa1[_0x20eb('0x3a')],_0x16dfa1[_0x20eb('0x38')],_0x16dfa1[_0x20eb('0x3d')]));channels[_0x16dfa1['localtwolinkedid']][_0x20eb('0x3e')]=_0x16dfa1[_0x20eb('0x3d')];channels[_0x16dfa1[_0x20eb('0x38')]][_0x20eb('0x3f')]=_0x20eb('0x40');}else if(channels[_0x16dfa1['localtwolinkedid']][_0x20eb('0xb')]=_0x16dfa1[_0x20eb('0x41')]){utils['info'](util[_0x20eb('0x9')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x16dfa1[_0x20eb('0x3a')],_0x16dfa1[_0x20eb('0x38')],_0x16dfa1[_0x20eb('0x42')]));channels[_0x16dfa1[_0x20eb('0x38')]]['destinationchannel']=_0x16dfa1[_0x20eb('0x42')];channels[_0x16dfa1[_0x20eb('0x38')]][_0x20eb('0x3f')]='_attended';}}}catch(_0x256921){utils['error'](util[_0x20eb('0x9')](_0x20eb('0x39'),_0x16dfa1[_0x20eb('0x3a')]),_0x256921);}};exports['musiconholdstart']=function(_0x36dbd3){try{if(!_[_0x20eb('0x23')](channels[_0x36dbd3[_0x20eb('0x6')]])){utils[_0x20eb('0x21')](util['format'](_0x20eb('0x43'),_0x36dbd3[_0x20eb('0x6')]),_0x36dbd3);channels[_0x36dbd3[_0x20eb('0x6')]][_0x20eb('0x44')]=utils[_0x20eb('0x1d')]();utils['info'](util[_0x20eb('0x9')](_0x20eb('0x45'),_0x36dbd3[_0x20eb('0x6')],channels[_0x36dbd3[_0x20eb('0x6')]][_0x20eb('0x44')]));}}catch(_0x4dd979){utils[_0x20eb('0x1f')](util[_0x20eb('0x9')](_0x20eb('0x43'),_0x36dbd3['uniqueid']),_0x4dd979);}};exports[_0x20eb('0x46')]=function(_0x110b12){try{if(!_[_0x20eb('0x23')](channels[_0x110b12[_0x20eb('0x6')]])){utils[_0x20eb('0x21')](util[_0x20eb('0x9')]('[%s][calls][musiconholdstop]',_0x110b12[_0x20eb('0x6')]),_0x110b12);if(!_[_0x20eb('0x23')](channels[_0x110b12['uniqueid']][_0x20eb('0x44')])){channels[_0x110b12[_0x20eb('0x6')]][_0x20eb('0x47')]+=utils[_0x20eb('0x36')](utils['now'](),channels[_0x110b12[_0x20eb('0x6')]]['musiconholdstartAt']);utils[_0x20eb('0x8')](util[_0x20eb('0x9')](_0x20eb('0x48'),_0x110b12[_0x20eb('0x6')],channels[_0x110b12[_0x20eb('0x6')]][_0x20eb('0x47')]));delete channels[_0x110b12['uniqueid']][_0x20eb('0x44')];}}}catch(_0x2053f2){utils[_0x20eb('0x1f')](util['format']('[%s][calls][musiconholdstop]',_0x110b12[_0x20eb('0x6')]),_0x2053f2);}};exports[_0x20eb('0x49')]=function(_0x145c95){try{if(!_[_0x20eb('0x23')](channels[_0x145c95[_0x20eb('0x6')]])){utils['debug'](util[_0x20eb('0x9')](_0x20eb('0x4a'),_0x145c95[_0x20eb('0x6')]),_0x145c95);if(!_['isNil'](_0x145c95[_0x20eb('0x4b')][_0x20eb('0x4c')])){utils['info'](util[_0x20eb('0x9')](_0x20eb('0x4d'),_0x145c95[_0x20eb('0x6')],_0x145c95[_0x20eb('0x4e')]));channels[_0x145c95['uniqueid']]['source']=_0x145c95[_0x20eb('0x4e')];}if(!_[_0x20eb('0x23')](_0x145c95[_0x20eb('0x4b')][_0x20eb('0x4f')])){utils[_0x20eb('0x8')](util[_0x20eb('0x9')](_0x20eb('0x50'),_0x145c95[_0x20eb('0x6')],_0x145c95[_0x20eb('0x4e')]));channels[_0x145c95[_0x20eb('0x6')]][_0x20eb('0x51')]=_0x145c95[_0x20eb('0x4e')];channels[_0x145c95[_0x20eb('0x6')]]['callerid']='\x22'+_0x145c95['value']+'\x22\x20<'+_0x145c95[_0x20eb('0x4e')]+'>';}if(!_[_0x20eb('0x23')](_0x145c95[_0x20eb('0x4b')][_0x20eb('0x52')])||!_[_0x20eb('0x23')](_0x145c95['variable'][_0x20eb('0x53')])){utils[_0x20eb('0x8')](util['format'](_0x20eb('0x54'),_0x145c95[_0x20eb('0x6')],!_[_0x20eb('0x23')](_0x145c95['variable'][_0x20eb('0x52')])?'xmd-callerid-preview':_0x20eb('0x53'),_0x145c95[_0x20eb('0x4e')]));channels[_0x145c95['uniqueid']][_0x20eb('0x2e')]=_0x145c95['value'];}if(!_[_0x20eb('0x23')](_0x145c95[_0x20eb('0x4b')][_0x20eb('0x55')])||!_[_0x20eb('0x23')](_0x145c95['variable'][_0x20eb('0x56')])){utils[_0x20eb('0x8')](util[_0x20eb('0x9')](_0x20eb('0x54'),_0x145c95[_0x20eb('0x6')],!_[_0x20eb('0x23')](_0x145c95['variable'][_0x20eb('0x55')])?_0x20eb('0x55'):'xmcs-queue',_0x145c95[_0x20eb('0x4e')]));channels[_0x145c95[_0x20eb('0x6')]][_0x20eb('0x57')]=_0x20eb('0x58');channels[_0x145c95['uniqueid']][_0x20eb('0x59')]=_0x145c95['value'];channels[_0x145c95['uniqueid']][_0x20eb('0xc')]=!![];}if(!_[_0x20eb('0x23')](_0x145c95[_0x20eb('0x4b')][_0x20eb('0x5a')])){utils[_0x20eb('0x8')](util[_0x20eb('0x9')](_0x20eb('0x5b'),_0x145c95[_0x20eb('0x6')],_0x145c95[_0x20eb('0x4e')]));channels[_0x145c95[_0x20eb('0x6')]]['ContactId']=_0x145c95['value'];}if(!_[_0x20eb('0x23')](_0x145c95[_0x20eb('0x4b')]['xmd-cdrtype'])){utils[_0x20eb('0x8')](util['format'](_0x20eb('0x5c'),_0x145c95['uniqueid'],_0x145c95[_0x20eb('0x4e')]));channels[_0x145c95['uniqueid']][_0x20eb('0x5d')]=_0x145c95[_0x20eb('0x4e')];}if(!_[_0x20eb('0x23')](_0x145c95['variable'][_0x20eb('0x5e')])){utils['info'](util[_0x20eb('0x9')](_0x20eb('0x5f'),_0x145c95['uniqueid'],_0x145c95[_0x20eb('0x4e')]));channels[_0x145c95['uniqueid']]['routeid']=_0x145c95[_0x20eb('0x4e')];}if(!_[_0x20eb('0x23')](_0x145c95[_0x20eb('0x4b')][_0x20eb('0x60')])){utils[_0x20eb('0x8')](util[_0x20eb('0x9')](_0x20eb('0x61'),_0x145c95[_0x20eb('0x6')],_0x145c95[_0x20eb('0x4e')]));channels[_0x145c95['uniqueid']]['sipcallid']=_0x145c95[_0x20eb('0x4e')];}}}catch(_0x1fbc3e){utils[_0x20eb('0x1f')](util[_0x20eb('0x9')]('[%s][calls][varset]',_0x145c95[_0x20eb('0x6')]),_0x1fbc3e);}};exports['newexten']=function(_0x110f72){try{if(!_['isNil'](channels[_0x110f72[_0x20eb('0x6')]])){utils['debug'](util[_0x20eb('0x9')](_0x20eb('0x62'),_0x110f72['uniqueid']),_0x110f72);utils[_0x20eb('0x8')](util['format'](_0x20eb('0x63'),_0x110f72[_0x20eb('0x6')],_0x110f72[_0x20eb('0x64')],_0x110f72[_0x20eb('0x65')]));if(_0x110f72['application'][_0x20eb('0x66')]()==_0x20eb('0x67')&&_[_0x20eb('0x68')](_0x110f72[_0x20eb('0x65')][_0x20eb('0x66')](),_0x20eb('0x69'))){var _0x450f82=_0x110f72[_0x20eb('0x65')][_0x20eb('0x6a')]('=');var _0x54db47=_0x450f82[0x0][_0x20eb('0x6b')](_0x450f82[0x0][_0x20eb('0x6c')]('(')+0x1,_0x450f82[0x0][_0x20eb('0x6c')](')'));var _0x5d3edf=_0x450f82[0x1];channels[_0x110f72[_0x20eb('0x6')]][_0x54db47]=_0x5d3edf;}if(!_['includes'](['hangup','noop',_0x20eb('0x6d'),_0x20eb('0x67'),'gotoif'],_0x110f72['application']['toLowerCase']())){channels[_0x110f72[_0x20eb('0x6')]][_0x20eb('0x57')]=_0x110f72[_0x20eb('0x64')];channels[_0x110f72[_0x20eb('0x6')]][_0x20eb('0x59')]=_0x110f72[_0x20eb('0x65')];}}}catch(_0x5b37e8){utils[_0x20eb('0x1f')](util[_0x20eb('0x9')](_0x20eb('0x62'),_0x110f72[_0x20eb('0x6')]),_0x5b37e8);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 9c88ab9..8730c7d 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 _0xbc25=['error','close','managerevent','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted'];(function(_0x6054be,_0x2f4ffa){var _0xd1d697=function(_0x5f558b){while(--_0x5f558b){_0x6054be['push'](_0x6054be['shift']());}};_0xd1d697(++_0x2f4ffa);}(_0xbc25,0x81));var _0x5bc2=function(_0x2ce095,_0x439a07){_0x2ce095=_0x2ce095-0x0;var _0x2a8e1f=_0xbc25[_0x2ce095];return _0x2a8e1f;};'use strict';var utils=require('./utils');exports[_0x5bc2('0x0')]=function(){utils[_0x5bc2('0x1')](_0x5bc2('0x2'));};exports[_0x5bc2('0x3')]=function(){utils['info'](_0x5bc2('0x4'));};exports['fullybooted']=function(){utils['info'](_0x5bc2('0x5'));};exports[_0x5bc2('0x6')]=function(_0x1471b6){utils['error']('[core]\x20error',_0x1471b6);};exports[_0x5bc2('0x7')]=function(){utils[_0x5bc2('0x1')]('[core]\x20close');};exports[_0x5bc2('0x8')]=function(_0x184b47){}; \ No newline at end of file +var _0xb0c7=['close','[core]\x20close','managerevent','./utils','[core]\x20connected','shutdown','fullybooted','info','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x1305be,_0x152e6c){var _0x8fa8f6=function(_0x4ccdf5){while(--_0x4ccdf5){_0x1305be['push'](_0x1305be['shift']());}};_0x8fa8f6(++_0x152e6c);}(_0xb0c7,0x1bb));var _0x7b0c=function(_0xcdfc4f,_0x8a111a){_0xcdfc4f=_0xcdfc4f-0x0;var _0x3f70d1=_0xb0c7[_0xcdfc4f];return _0x3f70d1;};'use strict';var utils=require(_0x7b0c('0x0'));exports['connect']=function(){utils['info'](_0x7b0c('0x1'));};exports[_0x7b0c('0x2')]=function(){utils['info']('[core]\x20shutdown');};exports[_0x7b0c('0x3')]=function(){utils[_0x7b0c('0x4')](_0x7b0c('0x5'));};exports[_0x7b0c('0x6')]=function(_0x1c0b8f){utils[_0x7b0c('0x6')](_0x7b0c('0x7'),_0x1c0b8f);};exports[_0x7b0c('0x8')]=function(){utils[_0x7b0c('0x4')](_0x7b0c('0x9'));};exports[_0x7b0c('0xa')]=function(_0x539791){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index d5ea92b..b6f8c5b 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 _0xe1f0=['dialstring','calleridnum','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','error','[%s][dials][varset]','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','assign','starttime','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','isNil','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','endtime','holdtime','diffTime','billableseconds','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid'];(function(_0x487372,_0x5050b9){var _0x1670d8=function(_0x96c4af){while(--_0x96c4af){_0x487372['push'](_0x487372['shift']());}};_0x1670d8(++_0x5050b9);}(_0xe1f0,0x8d));var _0x0e1f=function(_0x23c0e4,_0x2bbc74){_0x23c0e4=_0x23c0e4-0x0;var _0x3e7f12=_0xe1f0[_0x23c0e4];return _0x3e7f12;};'use strict';var _=require(_0x0e1f('0x0'));var util=require(_0x0e1f('0x1'));var utils=require(_0x0e1f('0x2'));var dials={};function writeDB(_0x2dad48){utils[_0x0e1f('0x3')](util['format'](_0x0e1f('0x4'),_0x2dad48[_0x0e1f('0x5')],_0x2dad48['channel'],_0x2dad48[_0x0e1f('0x6')],_0x2dad48[_0x0e1f('0x7')],_0x2dad48['connectedlinenum'],_0x2dad48['dialstatus']));utils[_0x0e1f('0x8')](_0x0e1f('0x9'),_0x2dad48);delete dials[_0x2dad48[_0x0e1f('0x5')]];}exports[_0x0e1f('0xa')]=function(_0xab6305){try{utils[_0x0e1f('0xb')](util[_0x0e1f('0xc')](_0x0e1f('0xd'),_0xab6305[_0x0e1f('0x5')]),_0xab6305);utils[_0x0e1f('0x3')](util[_0x0e1f('0xc')](_0x0e1f('0xe'),_0xab6305[_0x0e1f('0x5')],_0xab6305[_0x0e1f('0xf')],_0xab6305[_0x0e1f('0x10')]));if(_0xab6305[_0x0e1f('0xf')][_0x0e1f('0x11')]()==_0x0e1f('0x12')&&_[_0x0e1f('0x13')](_0xab6305[_0x0e1f('0x10')][_0x0e1f('0x11')](),_0x0e1f('0x14'))){var _0x242fb8=_0xab6305[_0x0e1f('0x10')]['split']('=');dials[_0xab6305[_0x0e1f('0x5')]]={'routeId':_0x242fb8[0x1]};}}catch(_0x2fab1e){utils[_0x0e1f('0x15')](util[_0x0e1f('0xc')](_0x0e1f('0xd'),_0xab6305['uniqueid']),_0x2fab1e);}};exports['varset']=function(_0x1bc056){try{utils[_0x0e1f('0xb')](util['format'](_0x0e1f('0x16'),_0x1bc056[_0x0e1f('0x5')]),_0x1bc056);if(!_['isNil'](_0x1bc056['variable']['outboundrouteid'])){utils[_0x0e1f('0x3')](util['format'](_0x0e1f('0x17'),_0x1bc056[_0x0e1f('0x5')],_0x1bc056['value']));dials[_0x1bc056[_0x0e1f('0x5')]]={'routeId':_0x1bc056[_0x0e1f('0x18')]};}}catch(_0x53768c){utils[_0x0e1f('0x15')](util[_0x0e1f('0xc')]('[%s][dials][varset]',_0x1bc056[_0x0e1f('0x5')]),_0x53768c);}};exports['dialbegin']=function(_0x161301){try{if(!_['isNil'](dials[_0x161301[_0x0e1f('0x5')]])){utils[_0x0e1f('0xb')](util[_0x0e1f('0xc')]('[%s][dials][dialbegin]',_0x161301[_0x0e1f('0x5')]),_0x161301);dials[_0x161301[_0x0e1f('0x5')]]=_[_0x0e1f('0x19')](dials[_0x161301['uniqueid']],_0x161301);dials[_0x161301[_0x0e1f('0x5')]][_0x0e1f('0x1a')]=utils['now']();dials[_0x161301[_0x0e1f('0x5')]]['lastevent']='called';utils[_0x0e1f('0x3')](util[_0x0e1f('0xc')](_0x0e1f('0x1b'),_0x161301[_0x0e1f('0x5')],dials[_0x161301[_0x0e1f('0x5')]][_0x0e1f('0x1a')]));}}catch(_0x22589d){utils[_0x0e1f('0x15')](util[_0x0e1f('0xc')](_0x0e1f('0x1c'),_0x161301['uniqueid']),_0x22589d);}};exports[_0x0e1f('0x1d')]=function(_0xdc6292){try{if(!_['isNil'](dials[_0xdc6292['uniqueid']])){utils['debug'](util['format'](_0x0e1f('0x1e'),_0xdc6292[_0x0e1f('0x5')]),_0xdc6292);dials[_0xdc6292['uniqueid']][_0x0e1f('0x1f')]=_0xdc6292[_0x0e1f('0x1f')];if(_0xdc6292[_0x0e1f('0x1f')]==_0x0e1f('0x20')){dials[_0xdc6292[_0x0e1f('0x5')]]=_['assign'](dials[_0xdc6292[_0x0e1f('0x5')]],_0xdc6292);dials[_0xdc6292[_0x0e1f('0x5')]][_0x0e1f('0x21')]=utils['now']();dials[_0xdc6292[_0x0e1f('0x5')]][_0x0e1f('0x22')]=_0x0e1f('0x23');utils['info'](util[_0x0e1f('0xc')](_0x0e1f('0x24'),_0xdc6292[_0x0e1f('0x5')],_0xdc6292['dialstatus'],dials[_0xdc6292[_0x0e1f('0x5')]]['answertime']));}else{utils[_0x0e1f('0x3')](util[_0x0e1f('0xc')](_0x0e1f('0x25'),_0xdc6292[_0x0e1f('0x5')],_0xdc6292['dialstatus']));}}}catch(_0x528ddc){utils[_0x0e1f('0x15')](util['format'](_0x0e1f('0x1e'),_0xdc6292[_0x0e1f('0x5')]),_0x528ddc);}};exports[_0x0e1f('0x26')]=function(_0x19c143){try{if(!_[_0x0e1f('0x27')](dials[_0x19c143[_0x0e1f('0x5')]])){utils['debug'](util[_0x0e1f('0xc')](_0x0e1f('0x28'),_0x19c143[_0x0e1f('0x5')]),_0x19c143);utils[_0x0e1f('0x3')](util[_0x0e1f('0xc')](_0x0e1f('0x29'),_0x19c143[_0x0e1f('0x5')],_0x19c143[_0x0e1f('0x7')],_0x19c143[_0x0e1f('0x2a')],_0x19c143['cause-txt']));dials[_0x19c143[_0x0e1f('0x5')]]=_['assign'](dials[_0x19c143['uniqueid']],{'endtime':utils['now'](),'lastevent':_0x0e1f('0x2b')});dials[_0x19c143[_0x0e1f('0x5')]][_0x0e1f('0x2c')]=utils['diffTime'](dials[_0x19c143[_0x0e1f('0x5')]][_0x0e1f('0x2d')],dials[_0x19c143[_0x0e1f('0x5')]][_0x0e1f('0x1a')]);dials[_0x19c143[_0x0e1f('0x5')]][_0x0e1f('0x2e')]=utils[_0x0e1f('0x2f')](dials[_0x19c143['uniqueid']][_0x0e1f('0x21')]||dials[_0x19c143['uniqueid']]['endtime'],dials[_0x19c143[_0x0e1f('0x5')]][_0x0e1f('0x1a')]);dials[_0x19c143[_0x0e1f('0x5')]][_0x0e1f('0x30')]=dials[_0x19c143['uniqueid']]['answertime']?utils[_0x0e1f('0x2f')](dials[_0x19c143[_0x0e1f('0x5')]][_0x0e1f('0x2d')],dials[_0x19c143['uniqueid']][_0x0e1f('0x21')]):0x0;writeDB(dials[_0x19c143[_0x0e1f('0x5')]]);}}catch(_0x4bd75f){utils[_0x0e1f('0x15')](util[_0x0e1f('0xc')](_0x0e1f('0x28'),_0x19c143[_0x0e1f('0x5')]),_0x4bd75f);}}; \ No newline at end of file +var _0xfe81=['[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','holdtime','billableseconds','endtime','[%s][dials][hangup]','lodash','util','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','newexten','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','starttime','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','now'];(function(_0x3d4ea5,_0x1921b1){var _0x5e6157=function(_0x587e1f){while(--_0x587e1f){_0x3d4ea5['push'](_0x3d4ea5['shift']());}};_0x5e6157(++_0x1921b1);}(_0xfe81,0xe1));var _0x1fe8=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0xfe81[_0x386525];return _0x14d015;};'use strict';var _=require(_0x1fe8('0x0'));var util=require(_0x1fe8('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x2a9f33){utils['info'](util[_0x1fe8('0x2')](_0x1fe8('0x3'),_0x2a9f33[_0x1fe8('0x4')],_0x2a9f33[_0x1fe8('0x5')],_0x2a9f33[_0x1fe8('0x6')],_0x2a9f33[_0x1fe8('0x7')],_0x2a9f33[_0x1fe8('0x8')],_0x2a9f33[_0x1fe8('0x9')]));utils[_0x1fe8('0xa')]('CreateVoiceDialReport',_0x2a9f33);delete dials[_0x2a9f33[_0x1fe8('0x4')]];}exports[_0x1fe8('0xb')]=function(_0x4310cf){try{utils[_0x1fe8('0xc')](util[_0x1fe8('0x2')](_0x1fe8('0xd'),_0x4310cf['uniqueid']),_0x4310cf);utils[_0x1fe8('0xe')](util[_0x1fe8('0x2')](_0x1fe8('0xf'),_0x4310cf[_0x1fe8('0x4')],_0x4310cf[_0x1fe8('0x10')],_0x4310cf[_0x1fe8('0x11')]));if(_0x4310cf[_0x1fe8('0x10')][_0x1fe8('0x12')]()==_0x1fe8('0x13')&&_['startsWith'](_0x4310cf[_0x1fe8('0x11')][_0x1fe8('0x12')](),'cdr(routeid)')){var _0x1a1f7f=_0x4310cf[_0x1fe8('0x11')][_0x1fe8('0x14')]('=');dials[_0x4310cf[_0x1fe8('0x4')]]={'routeId':_0x1a1f7f[0x1]};}}catch(_0x28c926){utils[_0x1fe8('0x15')](util['format'](_0x1fe8('0xd'),_0x4310cf[_0x1fe8('0x4')]),_0x28c926);}};exports[_0x1fe8('0x16')]=function(_0x390ca0){try{utils[_0x1fe8('0xc')](util[_0x1fe8('0x2')](_0x1fe8('0x17'),_0x390ca0[_0x1fe8('0x4')]),_0x390ca0);if(!_[_0x1fe8('0x18')](_0x390ca0[_0x1fe8('0x19')][_0x1fe8('0x1a')])){utils[_0x1fe8('0xe')](util[_0x1fe8('0x2')](_0x1fe8('0x1b'),_0x390ca0['uniqueid'],_0x390ca0[_0x1fe8('0x1c')]));dials[_0x390ca0[_0x1fe8('0x4')]]={'routeId':_0x390ca0[_0x1fe8('0x1c')]};}}catch(_0x5f0790){utils[_0x1fe8('0x15')](util[_0x1fe8('0x2')]('[%s][dials][varset]',_0x390ca0[_0x1fe8('0x4')]),_0x5f0790);}};exports[_0x1fe8('0x1d')]=function(_0x32e2d6){try{if(!_['isNil'](dials[_0x32e2d6['uniqueid']])){utils[_0x1fe8('0xc')](util[_0x1fe8('0x2')](_0x1fe8('0x1e'),_0x32e2d6[_0x1fe8('0x4')]),_0x32e2d6);dials[_0x32e2d6[_0x1fe8('0x4')]]=_['assign'](dials[_0x32e2d6[_0x1fe8('0x4')]],_0x32e2d6);dials[_0x32e2d6[_0x1fe8('0x4')]][_0x1fe8('0x1f')]=utils['now']();dials[_0x32e2d6[_0x1fe8('0x4')]]['lastevent']=_0x1fe8('0x20');utils[_0x1fe8('0xe')](util[_0x1fe8('0x2')](_0x1fe8('0x21'),_0x32e2d6[_0x1fe8('0x4')],dials[_0x32e2d6['uniqueid']][_0x1fe8('0x1f')]));}}catch(_0x16bed9){utils[_0x1fe8('0x15')](util['format'](_0x1fe8('0x1e'),_0x32e2d6[_0x1fe8('0x4')]),_0x16bed9);}};exports[_0x1fe8('0x22')]=function(_0x507d06){try{if(!_[_0x1fe8('0x18')](dials[_0x507d06[_0x1fe8('0x4')]])){utils['debug'](util[_0x1fe8('0x2')](_0x1fe8('0x23'),_0x507d06['uniqueid']),_0x507d06);dials[_0x507d06[_0x1fe8('0x4')]]['dialstatus']=_0x507d06['dialstatus'];if(_0x507d06['dialstatus']==_0x1fe8('0x24')){dials[_0x507d06[_0x1fe8('0x4')]]=_[_0x1fe8('0x25')](dials[_0x507d06[_0x1fe8('0x4')]],_0x507d06);dials[_0x507d06['uniqueid']][_0x1fe8('0x26')]=utils[_0x1fe8('0x27')]();dials[_0x507d06[_0x1fe8('0x4')]]['lastevent']='connect';utils[_0x1fe8('0xe')](util['format'](_0x1fe8('0x28'),_0x507d06[_0x1fe8('0x4')],_0x507d06[_0x1fe8('0x9')],dials[_0x507d06[_0x1fe8('0x4')]][_0x1fe8('0x26')]));}else{utils['info'](util[_0x1fe8('0x2')](_0x1fe8('0x29'),_0x507d06[_0x1fe8('0x4')],_0x507d06['dialstatus']));}}}catch(_0x23ac80){utils[_0x1fe8('0x15')](util[_0x1fe8('0x2')](_0x1fe8('0x23'),_0x507d06[_0x1fe8('0x4')]),_0x23ac80);}};exports[_0x1fe8('0x2a')]=function(_0x1754e5){try{if(!_['isNil'](dials[_0x1754e5[_0x1fe8('0x4')]])){utils['debug'](util['format']('[%s][dials][hangup]',_0x1754e5[_0x1fe8('0x4')]),_0x1754e5);utils[_0x1fe8('0xe')](util[_0x1fe8('0x2')](_0x1fe8('0x2b'),_0x1754e5[_0x1fe8('0x4')],_0x1754e5[_0x1fe8('0x7')],_0x1754e5[_0x1fe8('0x2c')],_0x1754e5[_0x1fe8('0x2d')]));dials[_0x1754e5[_0x1fe8('0x4')]]=_[_0x1fe8('0x25')](dials[_0x1754e5['uniqueid']],{'endtime':utils[_0x1fe8('0x27')](),'lastevent':_0x1fe8('0x2e')});dials[_0x1754e5['uniqueid']][_0x1fe8('0x2f')]=utils[_0x1fe8('0x30')](dials[_0x1754e5[_0x1fe8('0x4')]]['endtime'],dials[_0x1754e5[_0x1fe8('0x4')]]['starttime']);dials[_0x1754e5[_0x1fe8('0x4')]][_0x1fe8('0x31')]=utils['diffTime'](dials[_0x1754e5[_0x1fe8('0x4')]][_0x1fe8('0x26')]||dials[_0x1754e5[_0x1fe8('0x4')]]['endtime'],dials[_0x1754e5['uniqueid']][_0x1fe8('0x1f')]);dials[_0x1754e5[_0x1fe8('0x4')]][_0x1fe8('0x32')]=dials[_0x1754e5[_0x1fe8('0x4')]][_0x1fe8('0x26')]?utils[_0x1fe8('0x30')](dials[_0x1754e5[_0x1fe8('0x4')]][_0x1fe8('0x33')],dials[_0x1754e5['uniqueid']][_0x1fe8('0x26')]):0x0;writeDB(dials[_0x1754e5[_0x1fe8('0x4')]]);}}catch(_0x5ae6d9){utils[_0x1fe8('0x15')](util[_0x1fe8('0x2')](_0x1fe8('0x34'),_0x1754e5['uniqueid']),_0x5ae6d9);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 1620257..5946f99 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 _0x4105=['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]','asterisk-manager','../../config/environment','./utils','util','disabled','xdr','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','[%s][index][devicestatechange]','device','devicestatechange','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','debug','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]'];(function(_0x29bfe8,_0x119f51){var _0x1ac707=function(_0x2b434e){while(--_0x2b434e){_0x29bfe8['push'](_0x29bfe8['shift']());}};_0x1ac707(++_0x119f51);}(_0x4105,0xa6));var _0x5410=function(_0x62bb9e,_0x3d8f12){_0x62bb9e=_0x62bb9e-0x0;var _0x28a4a1=_0x4105[_0x62bb9e];return _0x28a4a1;};var AsteriskManager=require(_0x5410('0x0'));var config=require(_0x5410('0x1'));var utils=require(_0x5410('0x2'));var util=require(_0x5410('0x3'));var isXDREnabled=config['xdr']&&config['xdr'][_0x5410('0x4')]?!config[_0x5410('0x5')][_0x5410('0x4')]:!![];var isProduction=config['env']===_0x5410('0x6')||![];var isLocalAsterisk=config['xdr']&&config[_0x5410('0x5')][_0x5410('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x5410('0x8')][_0x5410('0x9')],config[_0x5410('0x8')]['ip'],config[_0x5410('0x8')][_0x5410('0xa')],config[_0x5410('0x8')][_0x5410('0xb')],!![]);ami[_0x5410('0xc')]();if(!isXDREnabled){utils[_0x5410('0xd')](_0x5410('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x5410('0xd')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x5410('0xf'));var calls=require(_0x5410('0x10'));var queues=require(_0x5410('0x11'));var recordings=require('./recordings.controller');var members=require(_0x5410('0x12'));var dials=require(_0x5410('0x13'));var transfers=require(_0x5410('0x14'));var core=require(_0x5410('0x15'));ami['on'](_0x5410('0x16'),core[_0x5410('0x16')]);ami['on'](_0x5410('0x17'),core['shutdown']);ami['on'](_0x5410('0x18'),core[_0x5410('0x18')]);ami['on'](_0x5410('0x19'),core[_0x5410('0x19')]);ami['on'](_0x5410('0x1a'),core[_0x5410('0x1a')]);ami['on']('managerevent',core[_0x5410('0x1b')]);ami['on']('devicestatechange',function(_0x4737b7){try{utils['debug'](util['format'](_0x5410('0x1c'),_0x4737b7[_0x5410('0x1d')]),_0x4737b7);members[_0x5410('0x1e')](_0x4737b7);}catch(_0x334a91){utils['error'](util[_0x5410('0x1f')]('[%s][index][devicestatechange]',_0x4737b7['device']),_0x334a91);}});ami['on'](_0x5410('0x20'),function(_0x348b48){try{utils['debug'](util[_0x5410('0x1f')](_0x5410('0x21'),_0x348b48[_0x5410('0x22')]),_0x348b48);agents[_0x5410('0x20')](_0x348b48);}catch(_0x3d1afb){utils['error'](util[_0x5410('0x1f')](_0x5410('0x21'),_0x348b48[_0x5410('0x22')]),_0x3d1afb);}});ami['on'](_0x5410('0x23'),function(_0x50ba47){try{utils[_0x5410('0x24')](util['format'](_0x5410('0x25'),_0x50ba47[_0x5410('0x22')]),_0x50ba47);agents[_0x5410('0x23')](_0x50ba47);}catch(_0x349305){utils[_0x5410('0x19')](util['format']('[%s][index][agentringnoanswer]',_0x50ba47['uniqueid']),_0x349305);}});ami['on'](_0x5410('0x26'),function(_0x326eaf){try{utils[_0x5410('0x24')](util['format'](_0x5410('0x27'),_0x326eaf[_0x5410('0x22')]),_0x326eaf);agents['agentconnect'](_0x326eaf);queues[_0x5410('0x26')](_0x326eaf);}catch(_0x71dab1){utils[_0x5410('0x19')](util[_0x5410('0x1f')]('[%s][index][agentconnect]',_0x326eaf[_0x5410('0x22')]),_0x71dab1);}});ami['on'](_0x5410('0x28'),function(_0x3ac582){try{utils[_0x5410('0x24')](util['format'](_0x5410('0x29'),_0x3ac582[_0x5410('0x22')]),_0x3ac582);agents['agentcomplete'](_0x3ac582);queues[_0x5410('0x28')](_0x3ac582);members[_0x5410('0x28')](_0x3ac582);}catch(_0x1234cd){utils[_0x5410('0x19')](util[_0x5410('0x1f')](_0x5410('0x29'),_0x3ac582[_0x5410('0x22')]),_0x1234cd);}});ami['on'](_0x5410('0x2a'),function(_0x2e5632){try{utils[_0x5410('0x24')](util['format'](_0x5410('0x2b'),_0x2e5632['uniqueid']),_0x2e5632);agents[_0x5410('0x2a')](_0x2e5632);queues[_0x5410('0x2a')](_0x2e5632);}catch(_0x1519ba){utils['error'](util[_0x5410('0x1f')]('[%s][index][queuecallerabandon]',_0x2e5632[_0x5410('0x22')]),_0x1519ba);}});ami['on'](_0x5410('0x2c'),function(_0x486632){try{utils[_0x5410('0x24')](util[_0x5410('0x1f')](_0x5410('0x2d'),_0x486632[_0x5410('0x22')]),_0x486632);queues[_0x5410('0x2c')](_0x486632);recordings[_0x5410('0x2c')](_0x486632);}catch(_0x1c5b3c){utils['error'](util['format'](_0x5410('0x2d'),_0x486632[_0x5410('0x22')]),_0x1c5b3c);}});ami['on'](_0x5410('0x2e'),function(_0x3a6fde){try{utils[_0x5410('0x24')](util[_0x5410('0x1f')](_0x5410('0x2f'),_0x3a6fde['uniqueid']),_0x3a6fde);queues[_0x5410('0x2e')](_0x3a6fde);}catch(_0x288a92){utils[_0x5410('0x19')](util[_0x5410('0x1f')](_0x5410('0x2f'),_0x3a6fde[_0x5410('0x22')]),_0x288a92);}});ami['on'](_0x5410('0x30'),function(_0x2b0063){try{utils[_0x5410('0x24')](util[_0x5410('0x1f')](_0x5410('0x31'),_0x2b0063[_0x5410('0x22')]),_0x2b0063);queues[_0x5410('0x30')](_0x2b0063);calls['musiconholdstart'](_0x2b0063);}catch(_0x3d475c){utils[_0x5410('0x19')](util[_0x5410('0x1f')](_0x5410('0x31'),_0x2b0063[_0x5410('0x22')]),_0x3d475c);}});ami['on'](_0x5410('0x32'),function(_0x406b3c){try{utils[_0x5410('0x24')](util['format'](_0x5410('0x33'),_0x406b3c[_0x5410('0x22')]),_0x406b3c);queues[_0x5410('0x32')](_0x406b3c);calls[_0x5410('0x32')](_0x406b3c);}catch(_0x340a7e){utils[_0x5410('0x19')](util['format'](_0x5410('0x33'),_0x406b3c[_0x5410('0x22')]),_0x340a7e);}});ami['on']('newstate',function(_0xe04ef6){try{utils['debug'](util[_0x5410('0x1f')](_0x5410('0x34'),_0xe04ef6[_0x5410('0x22')]),_0xe04ef6);calls[_0x5410('0x35')](_0xe04ef6);recordings['newstate'](_0xe04ef6);}catch(_0x2997b3){utils[_0x5410('0x19')](util[_0x5410('0x1f')]('[%s][index][newstate]',_0xe04ef6['uniqueid']),_0x2997b3);}});ami['on'](_0x5410('0x36'),function(_0x5c8142){try{utils['debug'](util['format'](_0x5410('0x37'),_0x5c8142[_0x5410('0x22')]),_0x5c8142);calls[_0x5410('0x36')](_0x5c8142);recordings[_0x5410('0x36')](_0x5c8142);dials[_0x5410('0x36')](_0x5c8142);agents['hangup'](_0x5c8142);queues[_0x5410('0x36')](_0x5c8142);}catch(_0x388634){utils[_0x5410('0x19')](util[_0x5410('0x1f')](_0x5410('0x37'),_0x5c8142[_0x5410('0x22')]),_0x388634);}});ami['on'](_0x5410('0x38'),function(_0x3f40cc){try{utils['debug'](util[_0x5410('0x1f')]('[%s][index][cdr]',_0x3f40cc[_0x5410('0x22')]),_0x3f40cc);members[_0x5410('0x38')](_0x3f40cc);}catch(_0x3a9fa3){utils[_0x5410('0x19')](util[_0x5410('0x1f')](_0x5410('0x39'),_0x3f40cc['uniqueid']),_0x3a9fa3);}});ami['on'](_0x5410('0x3a'),function(_0x4da89e){try{utils[_0x5410('0x24')](util[_0x5410('0x1f')](_0x5410('0x3b'),_0x4da89e[_0x5410('0x22')]),_0x4da89e);queues['blindtransfer'](_0x4da89e);agents[_0x5410('0x3a')](_0x4da89e);transfers['blindtransfer'](_0x4da89e);recordings[_0x5410('0x3a')](_0x4da89e);}catch(_0x470319){utils[_0x5410('0x19')](util[_0x5410('0x1f')](_0x5410('0x3b'),_0x4da89e[_0x5410('0x22')]),_0x470319);}});ami['on'](_0x5410('0x3c'),function(_0x4f1470){try{utils[_0x5410('0x24')](util[_0x5410('0x1f')]('[%s][index][attendedtransfer]',_0x4f1470[_0x5410('0x3d')]),_0x4f1470);queues[_0x5410('0x3c')](_0x4f1470);transfers[_0x5410('0x3c')](_0x4f1470);agents[_0x5410('0x3c')](_0x4f1470);calls[_0x5410('0x3c')](_0x4f1470);}catch(_0x300060){utils[_0x5410('0x19')](util['format'](_0x5410('0x3e'),_0x4f1470[_0x5410('0x3d')]),_0x300060);}});ami['on'](_0x5410('0x3f'),function(_0x5a5d94){try{utils[_0x5410('0x24')](util[_0x5410('0x1f')](_0x5410('0x40'),_0x5a5d94[_0x5410('0x22')]),_0x5a5d94);queues[_0x5410('0x3f')](_0x5a5d94);recordings['varset'](_0x5a5d94);calls[_0x5410('0x3f')](_0x5a5d94);dials[_0x5410('0x3f')](_0x5a5d94);}catch(_0x40499d){utils['error'](util[_0x5410('0x1f')](_0x5410('0x40'),_0x5a5d94[_0x5410('0x22')]),_0x40499d);}});ami['on'](_0x5410('0x41'),function(_0x3af364){try{utils[_0x5410('0x24')](util[_0x5410('0x1f')](_0x5410('0x42'),_0x3af364['uniqueid']),_0x3af364);calls[_0x5410('0x41')](_0x3af364);recordings[_0x5410('0x41')](_0x3af364);dials[_0x5410('0x41')](_0x3af364);}catch(_0x167245){utils[_0x5410('0x19')](util[_0x5410('0x1f')](_0x5410('0x42'),_0x3af364[_0x5410('0x22')]),_0x167245);}});ami['on'](_0x5410('0x43'),function(_0xcfe91a){try{utils['debug'](util['format'](_0x5410('0x44'),_0xcfe91a[_0x5410('0x22')]),_0xcfe91a);calls['newchannel'](_0xcfe91a);recordings['newchannel'](_0xcfe91a);}catch(_0x2ef632){utils[_0x5410('0x19')](util[_0x5410('0x1f')](_0x5410('0x44'),_0xcfe91a[_0x5410('0x22')]),_0x2ef632);}});ami['on'](_0x5410('0x45'),function(_0x30ca7f){try{utils[_0x5410('0x24')](util['format'](_0x5410('0x46'),_0x30ca7f[_0x5410('0x22')]),_0x30ca7f);dials['dialbegin'](_0x30ca7f);}catch(_0x11dd5d){utils[_0x5410('0x19')](util['format'](_0x5410('0x47'),_0x30ca7f[_0x5410('0x22')]),_0x11dd5d);}});ami['on']('dialend',function(_0xd351b1){try{utils[_0x5410('0x24')](util[_0x5410('0x1f')]('[%s][index][dialend]',_0xd351b1[_0x5410('0x22')]),_0xd351b1);dials['dialend'](_0xd351b1);}catch(_0xa2b7a3){utils[_0x5410('0x19')](util['format'](_0x5410('0x48'),_0xd351b1['uniqueid']),_0xa2b7a3);}});} \ No newline at end of file +var _0xa497=['[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','production','asterisk','port','username','password','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./members.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','debug','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten'];(function(_0x437470,_0x1985af){var _0x1651a7=function(_0x4beb41){while(--_0x4beb41){_0x437470['push'](_0x437470['shift']());}};_0x1651a7(++_0x1985af);}(_0xa497,0xd9));var _0x7a49=function(_0x3584ab,_0x29ba2a){_0x3584ab=_0x3584ab-0x0;var _0x1ea78c=_0xa497[_0x3584ab];return _0x1ea78c;};var AsteriskManager=require(_0x7a49('0x0'));var config=require('../../config/environment');var utils=require(_0x7a49('0x1'));var util=require(_0x7a49('0x2'));var isXDREnabled=config[_0x7a49('0x3')]&&config[_0x7a49('0x3')][_0x7a49('0x4')]?!config['xdr']['disabled']:!![];var isProduction=config[_0x7a49('0x5')]===_0x7a49('0x6')||![];var isLocalAsterisk=config[_0x7a49('0x3')]&&config[_0x7a49('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x7a49('0x7')][_0x7a49('0x8')],config[_0x7a49('0x7')]['ip'],config['asterisk'][_0x7a49('0x9')],config[_0x7a49('0x7')][_0x7a49('0xa')],!![]);ami[_0x7a49('0xb')]();if(!isXDREnabled){utils['info'](_0x7a49('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x7a49('0xd')](_0x7a49('0xe'));}else{var agents=require(_0x7a49('0xf'));var calls=require(_0x7a49('0x10'));var queues=require(_0x7a49('0x11'));var recordings=require('./recordings.controller');var members=require(_0x7a49('0x12'));var dials=require('./dials.controller');var transfers=require(_0x7a49('0x13'));var core=require('./core.controller');ami['on'](_0x7a49('0x14'),core[_0x7a49('0x14')]);ami['on']('shutdown',core[_0x7a49('0x15')]);ami['on'](_0x7a49('0x16'),core['fullybooted']);ami['on'](_0x7a49('0x17'),core[_0x7a49('0x17')]);ami['on'](_0x7a49('0x18'),core[_0x7a49('0x18')]);ami['on'](_0x7a49('0x19'),core[_0x7a49('0x19')]);ami['on'](_0x7a49('0x1a'),function(_0x195021){try{utils['debug'](util[_0x7a49('0x1b')](_0x7a49('0x1c'),_0x195021[_0x7a49('0x1d')]),_0x195021);members['devicestatechange'](_0x195021);}catch(_0x3dedfa){utils[_0x7a49('0x17')](util[_0x7a49('0x1b')]('[%s][index][devicestatechange]',_0x195021[_0x7a49('0x1d')]),_0x3dedfa);}});ami['on'](_0x7a49('0x1e'),function(_0x291353){try{utils['debug'](util[_0x7a49('0x1b')](_0x7a49('0x1f'),_0x291353[_0x7a49('0x20')]),_0x291353);agents[_0x7a49('0x1e')](_0x291353);}catch(_0x1f68e5){utils[_0x7a49('0x17')](util[_0x7a49('0x1b')](_0x7a49('0x1f'),_0x291353[_0x7a49('0x20')]),_0x1f68e5);}});ami['on'](_0x7a49('0x21'),function(_0x4a0a95){try{utils[_0x7a49('0x22')](util['format']('[%s][index][agentringnoanswer]',_0x4a0a95[_0x7a49('0x20')]),_0x4a0a95);agents[_0x7a49('0x21')](_0x4a0a95);}catch(_0x10d63e){utils[_0x7a49('0x17')](util[_0x7a49('0x1b')](_0x7a49('0x23'),_0x4a0a95[_0x7a49('0x20')]),_0x10d63e);}});ami['on'](_0x7a49('0x24'),function(_0x24cc8f){try{utils[_0x7a49('0x22')](util[_0x7a49('0x1b')](_0x7a49('0x25'),_0x24cc8f[_0x7a49('0x20')]),_0x24cc8f);agents['agentconnect'](_0x24cc8f);queues[_0x7a49('0x24')](_0x24cc8f);}catch(_0x524e6f){utils[_0x7a49('0x17')](util['format']('[%s][index][agentconnect]',_0x24cc8f[_0x7a49('0x20')]),_0x524e6f);}});ami['on']('agentcomplete',function(_0x497347){try{utils['debug'](util[_0x7a49('0x1b')]('[%s][index][agentcomplete]',_0x497347[_0x7a49('0x20')]),_0x497347);agents[_0x7a49('0x26')](_0x497347);queues[_0x7a49('0x26')](_0x497347);members[_0x7a49('0x26')](_0x497347);}catch(_0x112a3e){utils['error'](util[_0x7a49('0x1b')]('[%s][index][agentcomplete]',_0x497347[_0x7a49('0x20')]),_0x112a3e);}});ami['on'](_0x7a49('0x27'),function(_0x460f15){try{utils[_0x7a49('0x22')](util[_0x7a49('0x1b')](_0x7a49('0x28'),_0x460f15[_0x7a49('0x20')]),_0x460f15);agents['queuecallerabandon'](_0x460f15);queues[_0x7a49('0x27')](_0x460f15);}catch(_0x25a16b){utils[_0x7a49('0x17')](util[_0x7a49('0x1b')](_0x7a49('0x28'),_0x460f15[_0x7a49('0x20')]),_0x25a16b);}});ami['on'](_0x7a49('0x29'),function(_0x27b4ef){try{utils[_0x7a49('0x22')](util['format'](_0x7a49('0x2a'),_0x27b4ef[_0x7a49('0x20')]),_0x27b4ef);queues[_0x7a49('0x29')](_0x27b4ef);recordings['queuecallerjoin'](_0x27b4ef);}catch(_0x9ae735){utils[_0x7a49('0x17')](util['format']('[%s][index][queuecallerjoin]',_0x27b4ef[_0x7a49('0x20')]),_0x9ae735);}});ami['on']('queuecallerleave',function(_0x5551f9){try{utils[_0x7a49('0x22')](util['format'](_0x7a49('0x2b'),_0x5551f9[_0x7a49('0x20')]),_0x5551f9);queues[_0x7a49('0x2c')](_0x5551f9);}catch(_0x3de253){utils[_0x7a49('0x17')](util[_0x7a49('0x1b')](_0x7a49('0x2b'),_0x5551f9[_0x7a49('0x20')]),_0x3de253);}});ami['on']('musiconholdstart',function(_0x694fd1){try{utils[_0x7a49('0x22')](util[_0x7a49('0x1b')](_0x7a49('0x2d'),_0x694fd1['uniqueid']),_0x694fd1);queues[_0x7a49('0x2e')](_0x694fd1);calls[_0x7a49('0x2e')](_0x694fd1);}catch(_0x393ce6){utils[_0x7a49('0x17')](util['format'](_0x7a49('0x2d'),_0x694fd1['uniqueid']),_0x393ce6);}});ami['on'](_0x7a49('0x2f'),function(_0x33986e){try{utils[_0x7a49('0x22')](util[_0x7a49('0x1b')]('[%s][index][musiconholdstop]',_0x33986e[_0x7a49('0x20')]),_0x33986e);queues[_0x7a49('0x2f')](_0x33986e);calls[_0x7a49('0x2f')](_0x33986e);}catch(_0x529973){utils[_0x7a49('0x17')](util[_0x7a49('0x1b')](_0x7a49('0x30'),_0x33986e[_0x7a49('0x20')]),_0x529973);}});ami['on'](_0x7a49('0x31'),function(_0x1449a3){try{utils['debug'](util[_0x7a49('0x1b')](_0x7a49('0x32'),_0x1449a3[_0x7a49('0x20')]),_0x1449a3);calls[_0x7a49('0x31')](_0x1449a3);recordings['newstate'](_0x1449a3);}catch(_0x5db38c){utils[_0x7a49('0x17')](util['format']('[%s][index][newstate]',_0x1449a3[_0x7a49('0x20')]),_0x5db38c);}});ami['on'](_0x7a49('0x33'),function(_0x3ac0c6){try{utils['debug'](util[_0x7a49('0x1b')](_0x7a49('0x34'),_0x3ac0c6[_0x7a49('0x20')]),_0x3ac0c6);calls[_0x7a49('0x33')](_0x3ac0c6);recordings[_0x7a49('0x33')](_0x3ac0c6);dials[_0x7a49('0x33')](_0x3ac0c6);agents[_0x7a49('0x33')](_0x3ac0c6);queues['hangup'](_0x3ac0c6);}catch(_0x34f733){utils[_0x7a49('0x17')](util[_0x7a49('0x1b')]('[%s][index][hangup]',_0x3ac0c6[_0x7a49('0x20')]),_0x34f733);}});ami['on'](_0x7a49('0x35'),function(_0x534faa){try{utils['debug'](util[_0x7a49('0x1b')](_0x7a49('0x36'),_0x534faa['uniqueid']),_0x534faa);members['cdr'](_0x534faa);}catch(_0x4470eb){utils['error'](util['format'](_0x7a49('0x36'),_0x534faa[_0x7a49('0x20')]),_0x4470eb);}});ami['on'](_0x7a49('0x37'),function(_0x3929d8){try{utils[_0x7a49('0x22')](util['format'](_0x7a49('0x38'),_0x3929d8[_0x7a49('0x20')]),_0x3929d8);queues[_0x7a49('0x37')](_0x3929d8);agents['blindtransfer'](_0x3929d8);transfers[_0x7a49('0x37')](_0x3929d8);recordings[_0x7a49('0x37')](_0x3929d8);}catch(_0x223b30){utils[_0x7a49('0x17')](util[_0x7a49('0x1b')](_0x7a49('0x38'),_0x3929d8[_0x7a49('0x20')]),_0x223b30);}});ami['on'](_0x7a49('0x39'),function(_0x2c666c){try{utils[_0x7a49('0x22')](util[_0x7a49('0x1b')](_0x7a49('0x3a'),_0x2c666c[_0x7a49('0x3b')]),_0x2c666c);queues[_0x7a49('0x39')](_0x2c666c);transfers[_0x7a49('0x39')](_0x2c666c);agents['attendedtransfer'](_0x2c666c);calls[_0x7a49('0x39')](_0x2c666c);}catch(_0x4dac68){utils[_0x7a49('0x17')](util[_0x7a49('0x1b')]('[%s][index][attendedtransfer]',_0x2c666c[_0x7a49('0x3b')]),_0x4dac68);}});ami['on'](_0x7a49('0x3c'),function(_0x1e6289){try{utils[_0x7a49('0x22')](util[_0x7a49('0x1b')](_0x7a49('0x3d'),_0x1e6289[_0x7a49('0x20')]),_0x1e6289);queues[_0x7a49('0x3c')](_0x1e6289);recordings[_0x7a49('0x3c')](_0x1e6289);calls[_0x7a49('0x3c')](_0x1e6289);dials[_0x7a49('0x3c')](_0x1e6289);}catch(_0x589222){utils[_0x7a49('0x17')](util[_0x7a49('0x1b')](_0x7a49('0x3d'),_0x1e6289[_0x7a49('0x20')]),_0x589222);}});ami['on'](_0x7a49('0x3e'),function(_0x3c1f2f){try{utils[_0x7a49('0x22')](util[_0x7a49('0x1b')]('[%s][index][newexten]',_0x3c1f2f[_0x7a49('0x20')]),_0x3c1f2f);calls[_0x7a49('0x3e')](_0x3c1f2f);recordings[_0x7a49('0x3e')](_0x3c1f2f);dials[_0x7a49('0x3e')](_0x3c1f2f);}catch(_0x4bd0e8){utils['error'](util[_0x7a49('0x1b')](_0x7a49('0x3f'),_0x3c1f2f[_0x7a49('0x20')]),_0x4bd0e8);}});ami['on'](_0x7a49('0x40'),function(_0x2324e4){try{utils['debug'](util['format'](_0x7a49('0x41'),_0x2324e4['uniqueid']),_0x2324e4);calls[_0x7a49('0x40')](_0x2324e4);recordings[_0x7a49('0x40')](_0x2324e4);}catch(_0x54c3ac){utils[_0x7a49('0x17')](util[_0x7a49('0x1b')](_0x7a49('0x41'),_0x2324e4[_0x7a49('0x20')]),_0x54c3ac);}});ami['on']('dialbegin',function(_0x4813fd){try{utils[_0x7a49('0x22')](util[_0x7a49('0x1b')](_0x7a49('0x42'),_0x4813fd['uniqueid']),_0x4813fd);dials[_0x7a49('0x43')](_0x4813fd);}catch(_0xd5c5fe){utils[_0x7a49('0x17')](util[_0x7a49('0x1b')]('[%s]dialbegin',_0x4813fd[_0x7a49('0x20')]),_0xd5c5fe);}});ami['on'](_0x7a49('0x44'),function(_0x266385){try{utils[_0x7a49('0x22')](util[_0x7a49('0x1b')](_0x7a49('0x45'),_0x266385[_0x7a49('0x20')]),_0x266385);dials[_0x7a49('0x44')](_0x266385);}catch(_0x63536d){utils[_0x7a49('0x17')](util[_0x7a49('0x1b')](_0x7a49('0x45'),_0x266385[_0x7a49('0x20')]),_0x63536d);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 1744dd0..e694f10 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 _0x18a5=['isNil','exitAt','duration','diffTime','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','debug','[%s][members][cdr]','channel','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','data2','destinationchannel','source','lodash','util','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','type','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','some','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','INUSE','voice','TALKING','now'];(function(_0x2cf84d,_0x2cba31){var _0x38bf07=function(_0x5d6f17){while(--_0x5d6f17){_0x2cf84d['push'](_0x2cf84d['shift']());}};_0x38bf07(++_0x2cba31);}(_0x18a5,0x164));var _0x518a=function(_0x4414e8,_0x30738c){_0x4414e8=_0x4414e8-0x0;var _0xbb7e85=_0x18a5[_0x4414e8];return _0xbb7e85;};'use strict';var _=require(_0x518a('0x0'));var util=require(_0x518a('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer',_0x518a('0x2')];function writeDB(_0x47e255){utils[_0x518a('0x3')](util[_0x518a('0x4')](_0x518a('0x5'),_0x47e255[_0x518a('0x6')],_0x47e255[_0x518a('0x7')],_0x47e255['channel'],_0x47e255['data2'],_0x47e255['membername'],_0x47e255[_0x518a('0x8')]));if(_0x47e255[_0x518a('0x7')]){utils[_0x518a('0x9')](_0x47e255[_0x518a('0x7')])[_0x518a('0xa')](function(_0xa0d670){if(_0xa0d670){_0x47e255[_0x518a('0xb')]=_0xa0d670[_0x518a('0xc')];_0x47e255[_0x518a('0xd')]=_0xa0d670[_0x518a('0xd')];utils[_0x518a('0xe')](_0x518a('0xf'),_0x47e255);}else{utils[_0x518a('0x10')](_0x47e255[_0x518a('0x7')][_0x518a('0x11')]('/')[0x1])['then'](function(_0x46521c){if(_0x46521c){_0x47e255['membername']=_0x46521c[_0x518a('0xc')];_0x47e255['internal']=_0x46521c[_0x518a('0xd')];utils[_0x518a('0xe')](_0x518a('0xf'),_0x47e255);}});}})[_0x518a('0x12')](function(_0x473b50){utils[_0x518a('0x13')](util[_0x518a('0x4')]('[%s][members][writeDB]',_0x47e255[_0x518a('0x6')]),_0x473b50);});}delete members[_0x47e255[_0x518a('0x7')]];}function startsWith(_0x95d482,_0x4ca80a){return _[_0x518a('0x14')](_0x95d482,function(_0x301ecd){return _['startsWith'](_0x4ca80a,_0x301ecd);});}exports['devicestatechange']=function(_0x177882){try{utils['debug'](util[_0x518a('0x4')](_0x518a('0x15'),members[_0x177882[_0x518a('0x16')]]?members[_0x177882[_0x518a('0x16')]][_0x518a('0x6')]:_0x177882[_0x518a('0x16')]),_0x177882);utils[_0x518a('0x3')](util[_0x518a('0x4')](_0x518a('0x17'),members[_0x177882[_0x518a('0x16')]]?members[_0x177882[_0x518a('0x16')]][_0x518a('0x6')]:_0x177882[_0x518a('0x16')],_0x177882['state'],_0x177882[_0x518a('0x16')]));switch(_0x177882['state']){case _0x518a('0x18'):case'BUSY':if(!startsWith(exclude,_0x177882[_0x518a('0x16')])){members[_0x177882[_0x518a('0x16')]]={'channel':_0x518a('0x19'),'interface':_0x177882[_0x518a('0x16')],'type':_0x518a('0x1a'),'enterAt':utils[_0x518a('0x1b')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x518a('0x1c')](members[_0x177882[_0x518a('0x16')]])){members[_0x177882['device']][_0x518a('0x1d')]=utils[_0x518a('0x1b')]();members[_0x177882[_0x518a('0x16')]][_0x518a('0x1e')]=utils[_0x518a('0x1f')](members[_0x177882[_0x518a('0x16')]][_0x518a('0x1d')],members[_0x177882[_0x518a('0x16')]][_0x518a('0x20')]);if(members[_0x177882[_0x518a('0x16')]][_0x518a('0x6')]){writeDB(members[_0x177882[_0x518a('0x16')]]);}}break;default:break;}}catch(_0x1c34e9){utils[_0x518a('0x13')](util['format']('[%s][members][devicestatechange]',members[_0x177882['device']]?members[_0x177882[_0x518a('0x16')]][_0x518a('0x6')]:_0x177882[_0x518a('0x16')]),_0x1c34e9);}};exports['agentcomplete']=function(_0x4aeccb){try{if(!_[_0x518a('0x1c')](members[_0x4aeccb['interface']])){utils['debug'](util[_0x518a('0x4')](_0x518a('0x21'),_0x4aeccb['uniqueid']),_0x4aeccb);utils['info'](util[_0x518a('0x4')](_0x518a('0x22'),_0x4aeccb[_0x518a('0x6')],_0x4aeccb[_0x518a('0x7')],_0x4aeccb[_0x518a('0x23')]));members[_0x4aeccb[_0x518a('0x7')]]=_[_0x518a('0x24')](members[_0x4aeccb[_0x518a('0x7')]],{'data4':_0x4aeccb['queue'],'uniqueid':_0x4aeccb[_0x518a('0x6')]});}}catch(_0x25a358){utils['error'](util[_0x518a('0x4')](_0x518a('0x21'),_0x4aeccb[_0x518a('0x6')]),_0x25a358);}};exports[_0x518a('0x25')]=function(_0xa8c012){try{utils[_0x518a('0x26')](util[_0x518a('0x4')](_0x518a('0x27'),_0xa8c012['uniqueid']),_0xa8c012);if(_0xa8c012[_0x518a('0x28')]){var _0x4ee7ab=_0xa8c012[_0x518a('0x28')][_0x518a('0x11')]('-')[0x0];if(!_[_0x518a('0x1c')](members[_0x4ee7ab])){members[_0x4ee7ab]=_[_0x518a('0x24')](members[_0x4ee7ab],{'data1':members[_0x4ee7ab]['data1']||_0xa8c012['type'],'data2':members[_0x4ee7ab]['data2']||_0xa8c012['source'],'data3':members[_0x4ee7ab][_0x518a('0x29')]||_0xa8c012[_0x518a('0x2a')],'uniqueid':members[_0x4ee7ab][_0x518a('0x6')]||_0xa8c012[_0x518a('0x6')]});utils[_0x518a('0x3')](util[_0x518a('0x4')](_0x518a('0x2b'),_0xa8c012[_0x518a('0x6')],members[_0x4ee7ab][_0x518a('0x2c')],members[_0x4ee7ab][_0x518a('0x2d')],members[_0x4ee7ab][_0x518a('0x29')]));if(members[_0x4ee7ab][_0x518a('0x1d')]){writeDB(members[_0x4ee7ab]);}}}if(_0xa8c012[_0x518a('0x2e')]){var _0x121dfe=_0xa8c012['destinationchannel'][_0x518a('0x11')]('-')[0x0];if(!_[_0x518a('0x1c')](members[_0x121dfe])){members[_0x121dfe]=_[_0x518a('0x24')](members[_0x121dfe],{'data1':members[_0x121dfe][_0x518a('0x2c')]||_0xa8c012[_0x518a('0x8')],'data2':members[_0x121dfe][_0x518a('0x2d')]||_0xa8c012[_0x518a('0x2f')],'data3':members[_0x121dfe][_0x518a('0x29')]||_0xa8c012['destination'],'uniqueid':members[_0x121dfe][_0x518a('0x6')]||_0xa8c012[_0x518a('0x6')]});utils[_0x518a('0x3')](util[_0x518a('0x4')](_0x518a('0x2b'),_0xa8c012[_0x518a('0x6')],members[_0x121dfe][_0x518a('0x2c')],members[_0x121dfe][_0x518a('0x2d')],members[_0x121dfe][_0x518a('0x29')]));if(members[_0x121dfe][_0x518a('0x1d')]){writeDB(members[_0x121dfe]);}}}}catch(_0x1dcd08){utils['error'](util[_0x518a('0x4')](_0x518a('0x27'),_0xa8c012['uniqueid']),_0x1dcd08);}}; \ No newline at end of file +var _0xc04f=['[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','queue','assign','cdr','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data1','util','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','interface','getUserByInterface','then','name','internal','request','getUserByName','split','CreateMemberReport','catch','error','some','startsWith','devicestatechange','debug'];(function(_0x1e2091,_0x1122ee){var _0x1cfdd1=function(_0x5a5d8c){while(--_0x5a5d8c){_0x1e2091['push'](_0x1e2091['shift']());}};_0x1cfdd1(++_0x1122ee);}(_0xc04f,0x125));var _0xfc04=function(_0x44cca6,_0x5e9271){_0x44cca6=_0x44cca6-0x0;var _0x175d04=_0xc04f[_0x44cca6];return _0x175d04;};'use strict';var _=require('lodash');var util=require(_0xfc04('0x0'));var utils=require(_0xfc04('0x1'));var members={};var exclude=['Local/_attended@transfer',_0xfc04('0x2')];function writeDB(_0x2864ea){utils[_0xfc04('0x3')](util[_0xfc04('0x4')](_0xfc04('0x5'),_0x2864ea[_0xfc04('0x6')],_0x2864ea['interface'],_0x2864ea[_0xfc04('0x7')],_0x2864ea[_0xfc04('0x8')],_0x2864ea[_0xfc04('0x9')],_0x2864ea['type']));if(_0x2864ea[_0xfc04('0xa')]){utils[_0xfc04('0xb')](_0x2864ea[_0xfc04('0xa')])[_0xfc04('0xc')](function(_0x4bc102){if(_0x4bc102){_0x2864ea['membername']=_0x4bc102[_0xfc04('0xd')];_0x2864ea[_0xfc04('0xe')]=_0x4bc102[_0xfc04('0xe')];utils[_0xfc04('0xf')]('CreateMemberReport',_0x2864ea);}else{utils[_0xfc04('0x10')](_0x2864ea[_0xfc04('0xa')][_0xfc04('0x11')]('/')[0x1])[_0xfc04('0xc')](function(_0x47e1bb){if(_0x47e1bb){_0x2864ea[_0xfc04('0x9')]=_0x47e1bb[_0xfc04('0xd')];_0x2864ea[_0xfc04('0xe')]=_0x47e1bb[_0xfc04('0xe')];utils[_0xfc04('0xf')](_0xfc04('0x12'),_0x2864ea);}});}})[_0xfc04('0x13')](function(_0x4566f8){utils[_0xfc04('0x14')](util[_0xfc04('0x4')]('[%s][members][writeDB]',_0x2864ea[_0xfc04('0x6')]),_0x4566f8);});}delete members[_0x2864ea[_0xfc04('0xa')]];}function startsWith(_0x581ab6,_0x35449c){return _[_0xfc04('0x15')](_0x581ab6,function(_0x2f9735){return _[_0xfc04('0x16')](_0x35449c,_0x2f9735);});}exports[_0xfc04('0x17')]=function(_0x406e20){try{utils[_0xfc04('0x18')](util[_0xfc04('0x4')](_0xfc04('0x19'),members[_0x406e20[_0xfc04('0x1a')]]?members[_0x406e20[_0xfc04('0x1a')]][_0xfc04('0x6')]:_0x406e20['device']),_0x406e20);utils['info'](util['format'](_0xfc04('0x1b'),members[_0x406e20[_0xfc04('0x1a')]]?members[_0x406e20[_0xfc04('0x1a')]][_0xfc04('0x6')]:_0x406e20[_0xfc04('0x1a')],_0x406e20[_0xfc04('0x1c')],_0x406e20['device']));switch(_0x406e20['state']){case _0xfc04('0x1d'):case _0xfc04('0x1e'):if(!startsWith(exclude,_0x406e20['device'])){members[_0x406e20[_0xfc04('0x1a')]]={'channel':_0xfc04('0x1f'),'interface':_0x406e20[_0xfc04('0x1a')],'type':_0xfc04('0x20'),'enterAt':utils[_0xfc04('0x21')](),'role':_0xfc04('0x22')};}break;case _0xfc04('0x23'):if(!_[_0xfc04('0x24')](members[_0x406e20[_0xfc04('0x1a')]])){members[_0x406e20[_0xfc04('0x1a')]][_0xfc04('0x25')]=utils[_0xfc04('0x21')]();members[_0x406e20[_0xfc04('0x1a')]][_0xfc04('0x26')]=utils[_0xfc04('0x27')](members[_0x406e20[_0xfc04('0x1a')]][_0xfc04('0x25')],members[_0x406e20[_0xfc04('0x1a')]][_0xfc04('0x28')]);if(members[_0x406e20['device']]['uniqueid']){writeDB(members[_0x406e20[_0xfc04('0x1a')]]);}}break;default:break;}}catch(_0x5ee8f4){utils[_0xfc04('0x14')](util[_0xfc04('0x4')](_0xfc04('0x19'),members[_0x406e20[_0xfc04('0x1a')]]?members[_0x406e20['device']][_0xfc04('0x6')]:_0x406e20['device']),_0x5ee8f4);}};exports[_0xfc04('0x29')]=function(_0x478ac4){try{if(!_[_0xfc04('0x24')](members[_0x478ac4['interface']])){utils['debug'](util['format'](_0xfc04('0x2a'),_0x478ac4[_0xfc04('0x6')]),_0x478ac4);utils['info'](util[_0xfc04('0x4')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x478ac4[_0xfc04('0x6')],_0x478ac4[_0xfc04('0xa')],_0x478ac4[_0xfc04('0x2b')]));members[_0x478ac4['interface']]=_[_0xfc04('0x2c')](members[_0x478ac4[_0xfc04('0xa')]],{'data4':_0x478ac4[_0xfc04('0x2b')],'uniqueid':_0x478ac4[_0xfc04('0x6')]});}}catch(_0x55a732){utils['error'](util[_0xfc04('0x4')](_0xfc04('0x2a'),_0x478ac4['uniqueid']),_0x55a732);}};exports[_0xfc04('0x2d')]=function(_0x2e1d67){try{utils[_0xfc04('0x18')](util[_0xfc04('0x4')]('[%s][members][cdr]',_0x2e1d67[_0xfc04('0x6')]),_0x2e1d67);if(_0x2e1d67['channel']){var _0x2467ff=_0x2e1d67['channel'][_0xfc04('0x11')]('-')[0x0];if(!_[_0xfc04('0x24')](members[_0x2467ff])){members[_0x2467ff]=_['assign'](members[_0x2467ff],{'data1':members[_0x2467ff]['data1']||_0x2e1d67[_0xfc04('0x2e')],'data2':members[_0x2467ff][_0xfc04('0x8')]||_0x2e1d67[_0xfc04('0x2f')],'data3':members[_0x2467ff][_0xfc04('0x30')]||_0x2e1d67[_0xfc04('0x31')],'uniqueid':members[_0x2467ff][_0xfc04('0x6')]||_0x2e1d67[_0xfc04('0x6')]});utils[_0xfc04('0x3')](util[_0xfc04('0x4')](_0xfc04('0x32'),_0x2e1d67['uniqueid'],members[_0x2467ff]['data1'],members[_0x2467ff][_0xfc04('0x8')],members[_0x2467ff][_0xfc04('0x30')]));if(members[_0x2467ff]['exitAt']){writeDB(members[_0x2467ff]);}}}if(_0x2e1d67[_0xfc04('0x33')]){var _0x2d1f16=_0x2e1d67[_0xfc04('0x33')][_0xfc04('0x11')]('-')[0x0];if(!_[_0xfc04('0x24')](members[_0x2d1f16])){members[_0x2d1f16]=_[_0xfc04('0x2c')](members[_0x2d1f16],{'data1':members[_0x2d1f16][_0xfc04('0x34')]||_0x2e1d67[_0xfc04('0x2e')],'data2':members[_0x2d1f16][_0xfc04('0x8')]||_0x2e1d67[_0xfc04('0x2f')],'data3':members[_0x2d1f16][_0xfc04('0x30')]||_0x2e1d67[_0xfc04('0x31')],'uniqueid':members[_0x2d1f16]['uniqueid']||_0x2e1d67[_0xfc04('0x6')]});utils['info'](util[_0xfc04('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x2e1d67[_0xfc04('0x6')],members[_0x2d1f16][_0xfc04('0x34')],members[_0x2d1f16][_0xfc04('0x8')],members[_0x2d1f16][_0xfc04('0x30')]));if(members[_0x2d1f16]['exitAt']){writeDB(members[_0x2d1f16]);}}}}catch(_0x3d0f83){utils['error'](util[_0xfc04('0x4')]('[%s][members][cdr]',_0x2e1d67[_0xfc04('0x6')]),_0x3d0f83);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 4378790..8a8429c 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 _0x5276=['[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','queuecallerenterreason','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][hangup]','debug','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s'];(function(_0x288db8,_0x332618){var _0x52cc89=function(_0x901cb9){while(--_0x901cb9){_0x288db8['push'](_0x288db8['shift']());}};_0x52cc89(++_0x332618);}(_0x5276,0x170));var _0x6527=function(_0x33b167,_0x55cc0b){_0x33b167=_0x33b167-0x0;var _0x25abe5=_0x5276[_0x33b167];return _0x25abe5;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x6527('0x0'));var queues={};function writeDB(_0x4bf9f1){utils[_0x6527('0x1')](util[_0x6527('0x2')](_0x6527('0x3'),_0x4bf9f1[_0x6527('0x4')],_0x4bf9f1[_0x6527('0x5')],_0x4bf9f1[_0x6527('0x6')],_0x4bf9f1[_0x6527('0x7')],_0x4bf9f1[_0x6527('0x8')],_0x4bf9f1[_0x6527('0x9')],_0x4bf9f1[_0x6527('0xa')]));if(_0x4bf9f1[_0x6527('0x6')]){utils['getVoiceQueueByName'](_0x4bf9f1[_0x6527('0x6')])['then'](function(_0x37e96c){if(_0x37e96c){_0x4bf9f1['type']=_0x37e96c[_0x6527('0xb')];}utils[_0x6527('0xc')](_0x6527('0xd'),_0x4bf9f1);});}else{utils[_0x6527('0xc')](_0x6527('0xd'),_0x4bf9f1);}if(_0x4bf9f1[_0x6527('0xe')]){delete queues[_0x4bf9f1[_0x6527('0xe')]];}else{delete queues[_0x4bf9f1[_0x6527('0x4')]];}}exports[_0x6527('0xf')]=function(_0x48eff0){try{utils['debug'](util['format'](_0x6527('0x10'),_0x48eff0[_0x6527('0x4')]),_0x48eff0);utils[_0x6527('0x1')](util[_0x6527('0x2')](_0x6527('0x11'),_0x48eff0['uniqueid'],_0x48eff0[_0x6527('0x6')],_0x48eff0['position']));queues[_0x48eff0[_0x6527('0x4')]]=_[_0x6527('0x12')](_0x48eff0,{'originalposition':_0x48eff0[_0x6527('0x13')],'queuecallerjoinAt':utils[_0x6527('0x14')](),'mohtime':0x0});}catch(_0x14717c){utils[_0x6527('0x15')](util[_0x6527('0x2')](_0x6527('0x10'),_0x48eff0[_0x6527('0x4')]),_0x14717c);}};exports[_0x6527('0x16')]=function(_0x28d020){try{if(!_[_0x6527('0x17')](queues[_0x28d020[_0x6527('0x4')]])){utils['debug'](util[_0x6527('0x2')]('[%s][queues][hangup]',_0x28d020[_0x6527('0x4')]),_0x28d020);if(queues[_0x28d020[_0x6527('0x4')]][_0x6527('0x18')]){if(!queues[_0x28d020['uniqueid']][_0x6527('0x19')]&&!queues[_0x28d020[_0x6527('0x4')]][_0x6527('0x1a')]){queues[_0x28d020[_0x6527('0x4')]][_0x6527('0x1b')]=!![];queues[_0x28d020['uniqueid']][_0x6527('0x1c')]=utils[_0x6527('0x14')]();queues[_0x28d020[_0x6527('0x4')]][_0x6527('0xa')]=_0x6527('0x1d');}utils[_0x6527('0x1')](util[_0x6527('0x2')](_0x6527('0x1e'),_0x28d020[_0x6527('0x4')],queues[_0x28d020['uniqueid']][_0x6527('0x1f')],queues[_0x28d020['uniqueid']][_0x6527('0xa')]));writeDB(queues[_0x28d020[_0x6527('0x4')]]);}else if(queues[_0x28d020[_0x6527('0x4')]][_0x6527('0xe')]){utils[_0x6527('0x1')](util['format'](_0x6527('0x20'),_0x28d020[_0x6527('0x4')],queues[_0x28d020[_0x6527('0x4')]]['name'],queues[_0x28d020[_0x6527('0x4')]]['transfereduniqueid']));queues[queues[_0x28d020[_0x6527('0x4')]][_0x6527('0xe')]]=queues[_0x28d020['uniqueid']];queues[queues[_0x28d020['uniqueid']]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x28d020['uniqueid']];}}}catch(_0x5d20a8){utils[_0x6527('0x15')](util['format'](_0x6527('0x21'),_0x28d020[_0x6527('0x4')]),_0x5d20a8);}};exports['varset']=function(_0x3477d0){try{utils[_0x6527('0x22')](util['format']('[%s][queues][varset]',_0x3477d0[_0x6527('0x4')]),_0x3477d0);if(!_[_0x6527('0x17')](_0x3477d0[_0x6527('0x23')][_0x6527('0x24')])&&_0x3477d0[_0x6527('0x25')][_0x6527('0x26')]()!==_0x6527('0x27')){if(!_[_0x6527('0x17')](queues[_0x3477d0[_0x6527('0x4')]])){queues[_0x3477d0[_0x6527('0x4')]][_0x6527('0x19')]=![];queues[_0x3477d0[_0x6527('0x4')]][_0x6527('0x28')]=null;queues[_0x3477d0['uniqueid']][_0x6527('0x1a')]=!![];queues[_0x3477d0[_0x6527('0x4')]][_0x6527('0x29')]=utils[_0x6527('0x14')]();queues[_0x3477d0[_0x6527('0x4')]][_0x6527('0xa')]=_0x3477d0[_0x6527('0x25')][_0x6527('0x26')]();utils[_0x6527('0x1')](util[_0x6527('0x2')](_0x6527('0x2a'),_0x3477d0[_0x6527('0x4')],queues[_0x3477d0['uniqueid']]['name'],_0x3477d0[_0x6527('0x25')],queues[_0x3477d0[_0x6527('0x4')]][_0x6527('0xa')]));writeDB(queues[_0x3477d0[_0x6527('0x4')]]);}}else if(!_[_0x6527('0x17')](_0x3477d0[_0x6527('0x23')]['queueposition'])){if(!_[_0x6527('0x17')](queues[_0x3477d0[_0x6527('0x4')]])&&!queues[_0x3477d0[_0x6527('0x4')]][_0x6527('0x19')]){queues[_0x3477d0[_0x6527('0x4')]][_0x6527('0x19')]=![];queues[_0x3477d0[_0x6527('0x4')]][_0x6527('0x28')]=null;queues[_0x3477d0['uniqueid']][_0x6527('0x1a')]=!![];queues[_0x3477d0[_0x6527('0x4')]][_0x6527('0x29')]=utils[_0x6527('0x14')]();queues[_0x3477d0['uniqueid']]['queuecallerexitreason']='EXITWITHKEY';utils[_0x6527('0x1')](util[_0x6527('0x2')](_0x6527('0x2b'),_0x3477d0['uniqueid'],queues[_0x3477d0['uniqueid']][_0x6527('0x1f')],_0x3477d0[_0x6527('0x25')],queues[_0x3477d0[_0x6527('0x4')]]['queuecallerexitreason']));}}}catch(_0x5a35a0){utils[_0x6527('0x15')](util[_0x6527('0x2')](_0x6527('0x2c'),_0x3477d0[_0x6527('0x4')]),_0x5a35a0);}};exports[_0x6527('0x19')]=function(_0x43dc3c){try{if(!_[_0x6527('0x17')](queues[_0x43dc3c[_0x6527('0x4')]])){utils[_0x6527('0x22')](util[_0x6527('0x2')](_0x6527('0x2d'),_0x43dc3c[_0x6527('0x4')]),_0x43dc3c);queues[_0x43dc3c[_0x6527('0x4')]][_0x6527('0x1a')]=![];queues[_0x43dc3c['uniqueid']][_0x6527('0x29')]=null;queues[_0x43dc3c[_0x6527('0x4')]][_0x6527('0x19')]=!![];queues[_0x43dc3c[_0x6527('0x4')]][_0x6527('0x28')]=utils[_0x6527('0x14')]();queues[_0x43dc3c[_0x6527('0x4')]][_0x6527('0xa')]=_0x6527('0x2e');utils[_0x6527('0x1')](util['format'](_0x6527('0x2f'),_0x43dc3c[_0x6527('0x4')],queues[_0x43dc3c['uniqueid']]['name'],queues[_0x43dc3c[_0x6527('0x4')]][_0x6527('0xa')]));}}catch(_0x3094d0){utils[_0x6527('0x15')](util['format'](_0x6527('0x2d'),_0x43dc3c[_0x6527('0x4')]),_0x3094d0);}};exports['queuecallerleave']=function(_0x5557de){try{if(!_[_0x6527('0x17')](queues[_0x5557de[_0x6527('0x4')]])){utils['debug'](util[_0x6527('0x2')](_0x6527('0x30'),_0x5557de[_0x6527('0x4')]),_0x5557de);utils['info'](util['format'](_0x6527('0x31'),_0x5557de[_0x6527('0x4')],queues[_0x5557de[_0x6527('0x4')]][_0x6527('0x1f')],_0x5557de[_0x6527('0x32')],_0x5557de[_0x6527('0x33')]));queues[_0x5557de[_0x6527('0x4')]][_0x6527('0x34')]=!![];queues[_0x5557de[_0x6527('0x4')]]['queuecallerleaveAt']=utils[_0x6527('0x14')]();queues[_0x5557de[_0x6527('0x4')]][_0x6527('0x35')]=utils[_0x6527('0x36')](queues[_0x5557de[_0x6527('0x4')]]['queuecallerleaveAt'],queues[_0x5557de[_0x6527('0x4')]][_0x6527('0x37')]);queues[_0x5557de[_0x6527('0x4')]][_0x6527('0x13')]=_0x5557de[_0x6527('0x13')];queues[_0x5557de[_0x6527('0x4')]][_0x6527('0x38')]=_0x5557de['count'];queues[_0x5557de[_0x6527('0x4')]][_0x6527('0x32')]=_0x5557de[_0x6527('0x32')];queues[_0x5557de[_0x6527('0x4')]]['connectedlinename']=_0x5557de['connectedlinename'];}}catch(_0x36336c){utils[_0x6527('0x15')](util[_0x6527('0x2')](_0x6527('0x30'),_0x5557de['uniqueid']),_0x36336c);}};exports['agentconnect']=function(_0x36e073){try{if(!_[_0x6527('0x17')](queues[_0x36e073['uniqueid']])){utils[_0x6527('0x22')](util[_0x6527('0x2')](_0x6527('0x39'),_0x36e073[_0x6527('0x4')]),_0x36e073);utils[_0x6527('0x1')](util[_0x6527('0x2')](_0x6527('0x3a'),_0x36e073['uniqueid'],queues[_0x36e073['uniqueid']][_0x6527('0x1f')],_0x36e073[_0x6527('0x3b')],_0x36e073['destaccountcode']));queues[_0x36e073[_0x6527('0x4')]][_0x6527('0x19')]=![];queues[_0x36e073[_0x6527('0x4')]][_0x6527('0x19')]=![];queues[_0x36e073[_0x6527('0x4')]][_0x6527('0x28')]=null;queues[_0x36e073[_0x6527('0x4')]]['queuecallerexit']=![];queues[_0x36e073[_0x6527('0x4')]][_0x6527('0xa')]=null;queues[_0x36e073[_0x6527('0x4')]][_0x6527('0x29')]=null;queues[_0x36e073[_0x6527('0x4')]][_0x6527('0x3c')]=!![];queues[_0x36e073[_0x6527('0x4')]][_0x6527('0x9')]=_0x36e073['destaccountcode'];queues[_0x36e073[_0x6527('0x4')]]['lastAssignedTo']=_0x36e073['membername'];}}catch(_0x142554){utils['error'](util[_0x6527('0x2')](_0x6527('0x39'),_0x36e073[_0x6527('0x4')]),_0x142554);}};exports[_0x6527('0x3d')]=function(_0x18c863){try{if(!_[_0x6527('0x17')](queues[_0x18c863[_0x6527('0x4')]])){if(queues[_0x18c863['uniqueid']][_0x6527('0x18')]){utils[_0x6527('0x22')](util[_0x6527('0x2')](_0x6527('0x3e'),_0x18c863[_0x6527('0x4')]),_0x18c863);queues[_0x18c863['uniqueid']][_0x6527('0x19')]=![];queues[_0x18c863[_0x6527('0x4')]]['queuecallerabandon']=![];queues[_0x18c863[_0x6527('0x4')]]['queuecallerabandonAt']=null;queues[_0x18c863[_0x6527('0x4')]][_0x6527('0x1a')]=![];queues[_0x18c863[_0x6527('0x4')]][_0x6527('0x29')]=null;queues[_0x18c863[_0x6527('0x4')]][_0x6527('0x3c')]=!![];queues[_0x18c863['uniqueid']][_0x6527('0x7')]=_0x18c863[_0x6527('0x3b')];queues[_0x18c863[_0x6527('0x4')]][_0x6527('0x1b')]=!![];queues[_0x18c863['uniqueid']]['queuecallercompleteAt']=utils[_0x6527('0x14')]();if(_0x18c863[_0x6527('0x3f')]==_0x6527('0x40')){if(!queues[_0x18c863[_0x6527('0x4')]][_0x6527('0x40')]){queues[_0x18c863[_0x6527('0x4')]][_0x6527('0xa')]=_0x6527('0x41');}}else{queues[_0x18c863[_0x6527('0x4')]][_0x6527('0xa')]=_0x6527('0x42')+_0x18c863[_0x6527('0x3f')][_0x6527('0x26')]();}utils[_0x6527('0x1')](util['format'](_0x6527('0x43'),_0x18c863[_0x6527('0x4')],queues[_0x18c863[_0x6527('0x4')]][_0x6527('0x1f')],_0x18c863[_0x6527('0x3b')],queues[_0x18c863[_0x6527('0x4')]][_0x6527('0xa')]));writeDB(queues[_0x18c863[_0x6527('0x4')]]);}}}catch(_0x57d424){utils[_0x6527('0x15')](util[_0x6527('0x2')](_0x6527('0x3e'),_0x18c863[_0x6527('0x4')]),_0x57d424);}};exports['blindtransfer']=function(_0x20133b){try{if(!_[_0x6527('0x17')](queues[_0x20133b[_0x6527('0x44')]])){utils[_0x6527('0x22')](util[_0x6527('0x2')](_0x6527('0x45'),_0x20133b[_0x6527('0x4')]),_0x20133b);queues[_0x20133b['transfereeuniqueid']][_0x6527('0x40')]=!![];queues[_0x20133b['transfereeuniqueid']]['transfertype']=_0x6527('0x46');queues[_0x20133b[_0x6527('0x44')]][_0x6527('0x47')]=_0x20133b[_0x6527('0x48')];queues[_0x20133b[_0x6527('0x44')]]['transferuniqueid']=_0x20133b[_0x6527('0x44')];queues[_0x20133b[_0x6527('0x44')]][_0x6527('0xa')]=_0x6527('0x49');utils[_0x6527('0x1')](util[_0x6527('0x2')](_0x6527('0x4a'),_0x20133b['uniqueid'],queues[_0x20133b['transfereeuniqueid']]['name'],_0x20133b['transfereeuniqueid'],_0x20133b[_0x6527('0x48')]));}}catch(_0x421a79){utils['error'](util[_0x6527('0x2')](_0x6527('0x45'),_0x20133b[_0x6527('0x4')]),_0x421a79);}};exports[_0x6527('0x4b')]=function(_0x25b53d){try{utils['debug'](util[_0x6527('0x2')](_0x6527('0x4c'),_0x25b53d[_0x6527('0x4d')]),_0x25b53d);if(_0x25b53d['origtransfereruniqueid']==_0x25b53d['origtransfererlinkedid']){if(!_[_0x6527('0x17')](queues[_0x25b53d[_0x6527('0x4e')]])){utils['info'](util[_0x6527('0x2')](_0x6527('0x4f'),_0x25b53d['origtransfereruniqueid'],queues[_0x25b53d[_0x6527('0x4e')]][_0x6527('0x1f')],_0x25b53d[_0x6527('0x50')]));queues[_0x25b53d[_0x6527('0x4e')]][_0x6527('0x40')]=!![];queues[_0x25b53d[_0x6527('0x4e')]][_0x6527('0x51')]=_0x6527('0x52');queues[_0x25b53d[_0x6527('0x4e')]]['transferexten']=_0x25b53d[_0x6527('0x50')];queues[_0x25b53d['secondtransfererlinkedid']][_0x6527('0x53')]=_0x25b53d['origtransfereruniqueid'];queues[_0x25b53d['secondtransfererlinkedid']][_0x6527('0xa')]=_0x6527('0x54');}if(!_[_0x6527('0x17')](queues[_0x25b53d['origtransfererlinkedid']])){if(_0x25b53d[_0x6527('0x55')]&&queues[_0x25b53d[_0x6527('0x55')]]){queues[_0x25b53d[_0x6527('0x55')]]['queuecallerenterreason']=0x1;queues[_0x25b53d[_0x6527('0x44')]]=_['clone'](queues[_0x25b53d[_0x6527('0x55')]]);queues[_0x25b53d[_0x6527('0x44')]][_0x6527('0xe')]=_0x25b53d[_0x6527('0x56')];queues[_0x25b53d[_0x6527('0x44')]]['queuecallerenterreason']=0x2;queues[_0x25b53d[_0x6527('0x44')]]['calleridnum']=queues[_0x25b53d[_0x6527('0x4e')]][_0x6527('0x8')];queues[_0x25b53d[_0x6527('0x44')]][_0x6527('0x57')]=queues[_0x25b53d['secondtransfererlinkedid']][_0x6527('0x57')];queues[_0x25b53d[_0x6527('0x44')]][_0x6527('0x37')]=utils[_0x6527('0x14')]();queues[_0x25b53d[_0x6527('0x44')]][_0x6527('0x18')]=utils[_0x6527('0x14')]();queues[_0x25b53d[_0x6527('0x44')]][_0x6527('0x35')]=0x0;queues[_0x25b53d[_0x6527('0x44')]][_0x6527('0x58')]=0x0;utils[_0x6527('0x1')](util[_0x6527('0x2')](_0x6527('0x59'),_0x25b53d['origtransfereruniqueid'],queues[_0x25b53d[_0x6527('0x44')]]['name'],queues[_0x25b53d[_0x6527('0x44')]][_0x6527('0x8')],queues[_0x25b53d[_0x6527('0x44')]][_0x6527('0x57')]));}else{utils[_0x6527('0x1')](util[_0x6527('0x2')](_0x6527('0x5a'),_0x25b53d[_0x6527('0x4d')],queues[_0x25b53d['origtransfererlinkedid']]['name'],_0x25b53d[_0x6527('0x4e')]));queues[_0x25b53d['origtransfererlinkedid']]['transfereduniqueid']=_0x25b53d[_0x6527('0x4e')];}}}else if(_0x25b53d[_0x6527('0x5b')]==_0x25b53d[_0x6527('0x4e')]){if(!_[_0x6527('0x17')](queues[_0x25b53d[_0x6527('0x5c')]])){utils[_0x6527('0x1')](util[_0x6527('0x2')](_0x6527('0x5d'),_0x25b53d[_0x6527('0x4d')],queues[_0x25b53d[_0x6527('0x5c')]][_0x6527('0x1f')],_0x25b53d[_0x6527('0x5b')],_0x25b53d['secondtransfererexten']));queues[_0x25b53d[_0x6527('0x5c')]][_0x6527('0x40')]=!![];queues[_0x25b53d[_0x6527('0x5c')]][_0x6527('0x51')]=_0x6527('0x52');queues[_0x25b53d[_0x6527('0x5c')]]['transferexten']=_0x25b53d[_0x6527('0x5e')];queues[_0x25b53d[_0x6527('0x5c')]][_0x6527('0x53')]=_0x25b53d[_0x6527('0x5b')];queues[_0x25b53d['origtransfererlinkedid']][_0x6527('0xa')]=_0x6527('0x54');}if(!_['isNil'](queues[_0x25b53d[_0x6527('0x4e')]])){if(_0x25b53d[_0x6527('0x5f')]&&queues[_0x25b53d[_0x6527('0x5f')]]){queues[_0x25b53d['transfertargetlinkedid']][_0x6527('0x60')]=0x1;queues[_0x25b53d[_0x6527('0x56')]]=_['clone'](queues[_0x25b53d[_0x6527('0x5f')]]);queues[_0x25b53d[_0x6527('0x56')]][_0x6527('0xe')]=_0x25b53d[_0x6527('0x56')];queues[_0x25b53d['transfertargetuniqueid']][_0x6527('0x60')]=0x2;queues[_0x25b53d['transfertargetuniqueid']][_0x6527('0x8')]=queues[_0x25b53d[_0x6527('0x5c')]]['calleridnum'];queues[_0x25b53d[_0x6527('0x56')]][_0x6527('0x57')]=queues[_0x25b53d[_0x6527('0x5c')]][_0x6527('0x57')];queues[_0x25b53d[_0x6527('0x56')]][_0x6527('0x37')]=utils[_0x6527('0x14')]();queues[_0x25b53d[_0x6527('0x56')]][_0x6527('0x18')]=utils[_0x6527('0x14')]();queues[_0x25b53d[_0x6527('0x56')]][_0x6527('0x35')]=0x0;queues[_0x25b53d['transfertargetuniqueid']]['mohtime']=0x0;utils[_0x6527('0x1')](util[_0x6527('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x25b53d[_0x6527('0x4d')],queues[_0x25b53d[_0x6527('0x56')]][_0x6527('0x1f')],queues[_0x25b53d['transfertargetuniqueid']][_0x6527('0xe')],queues[_0x25b53d[_0x6527('0x56')]][_0x6527('0x8')],queues[_0x25b53d[_0x6527('0x56')]][_0x6527('0x57')]));}else{utils[_0x6527('0x1')](util[_0x6527('0x2')](_0x6527('0x5a'),_0x25b53d['origtransfereruniqueid'],queues[_0x25b53d[_0x6527('0x4e')]][_0x6527('0x1f')],_0x25b53d['origtransfererlinkedid']));queues[_0x25b53d[_0x6527('0x4e')]]['transfereduniqueid']=_0x25b53d['origtransfererlinkedid'];}}}}catch(_0x5966bb){utils[_0x6527('0x15')](util['format']('[%s][queues][attendedtransfer]',_0x25b53d[_0x6527('0x4d')]),_0x5966bb);}};exports[_0x6527('0x61')]=function(_0x31501f){try{if(!_[_0x6527('0x17')](queues[_0x31501f[_0x6527('0x4')]])){utils[_0x6527('0x22')](util['format'](_0x6527('0x62'),_0x31501f[_0x6527('0x4')]),_0x31501f);queues[_0x31501f['uniqueid']]['musiconholdstartAt']=utils[_0x6527('0x14')]();utils[_0x6527('0x1')](util[_0x6527('0x2')](_0x6527('0x63'),_0x31501f[_0x6527('0x4')],queues[_0x31501f[_0x6527('0x4')]][_0x6527('0x1f')],queues[_0x31501f[_0x6527('0x4')]][_0x6527('0x64')]));}}catch(_0x380325){utils[_0x6527('0x15')](util[_0x6527('0x2')](_0x6527('0x62'),_0x31501f['uniqueid']),_0x380325);}};exports['musiconholdstop']=function(_0x465176){try{if(!_['isNil'](queues[_0x465176[_0x6527('0x4')]])){if(!_[_0x6527('0x17')](queues[_0x465176[_0x6527('0x4')]]['musiconholdstartAt'])){utils[_0x6527('0x22')](util['format'](_0x6527('0x65'),_0x465176[_0x6527('0x4')]),_0x465176);queues[_0x465176[_0x6527('0x4')]][_0x6527('0x58')]+=utils[_0x6527('0x36')](utils[_0x6527('0x14')](),queues[_0x465176[_0x6527('0x4')]][_0x6527('0x64')]);utils[_0x6527('0x1')](util[_0x6527('0x2')](_0x6527('0x66'),_0x465176[_0x6527('0x4')],queues[_0x465176['uniqueid']][_0x6527('0x1f')],queues[_0x465176[_0x6527('0x4')]]['mohtime']));delete queues[_0x465176[_0x6527('0x4')]][_0x6527('0x64')];}}}catch(_0x89796d){utils['error'](util[_0x6527('0x2')](_0x6527('0x65'),_0x465176['uniqueid']),_0x89796d);}}; \ No newline at end of file +var _0x8fdc=['uniqueid','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','isNil','variable','queuestatus','toUpperCase','queuecallerabandon','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','agentcomplete','queuecallercomplete','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','holdtime','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','mohtime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','format','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then','type','CreateVoiceQueueReport','request','transfereduniqueid'];(function(_0x39d6a8,_0xc9c91a){var _0x93f3db=function(_0x953b09){while(--_0x953b09){_0x39d6a8['push'](_0x39d6a8['shift']());}};_0x93f3db(++_0xc9c91a);}(_0x8fdc,0x129));var _0xc8fd=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0x8fdc[_0x30cd7e];return _0x462a02;};'use strict';var _=require(_0xc8fd('0x0'));var util=require(_0xc8fd('0x1'));var utils=require(_0xc8fd('0x2'));var queues={};function writeDB(_0x3778fe){utils['info'](util[_0xc8fd('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x3778fe['uniqueid'],_0x3778fe[_0xc8fd('0x4')],_0x3778fe[_0xc8fd('0x5')],_0x3778fe[_0xc8fd('0x6')],_0x3778fe[_0xc8fd('0x7')],_0x3778fe[_0xc8fd('0x8')],_0x3778fe[_0xc8fd('0x9')]));if(_0x3778fe['queue']){utils['getVoiceQueueByName'](_0x3778fe[_0xc8fd('0x5')])[_0xc8fd('0xa')](function(_0x13299e){if(_0x13299e){_0x3778fe[_0xc8fd('0xb')]=_0x13299e[_0xc8fd('0xb')];}utils['request'](_0xc8fd('0xc'),_0x3778fe);});}else{utils[_0xc8fd('0xd')](_0xc8fd('0xc'),_0x3778fe);}if(_0x3778fe[_0xc8fd('0xe')]){delete queues[_0x3778fe[_0xc8fd('0xe')]];}else{delete queues[_0x3778fe[_0xc8fd('0xf')]];}}exports['queuecallerjoin']=function(_0x2d7198){try{utils[_0xc8fd('0x10')](util[_0xc8fd('0x3')](_0xc8fd('0x11'),_0x2d7198[_0xc8fd('0xf')]),_0x2d7198);utils[_0xc8fd('0x12')](util['format'](_0xc8fd('0x13'),_0x2d7198[_0xc8fd('0xf')],_0x2d7198['queue'],_0x2d7198['position']));queues[_0x2d7198[_0xc8fd('0xf')]]=_[_0xc8fd('0x14')](_0x2d7198,{'originalposition':_0x2d7198[_0xc8fd('0x15')],'queuecallerjoinAt':utils[_0xc8fd('0x16')](),'mohtime':0x0});}catch(_0x58c7ca){utils[_0xc8fd('0x17')](util[_0xc8fd('0x3')](_0xc8fd('0x11'),_0x2d7198[_0xc8fd('0xf')]),_0x58c7ca);}};exports[_0xc8fd('0x18')]=function(_0x1923cd){try{if(!_['isNil'](queues[_0x1923cd[_0xc8fd('0xf')]])){utils[_0xc8fd('0x10')](util[_0xc8fd('0x3')](_0xc8fd('0x19'),_0x1923cd['uniqueid']),_0x1923cd);if(queues[_0x1923cd[_0xc8fd('0xf')]][_0xc8fd('0x1a')]){if(!queues[_0x1923cd['uniqueid']]['queuecallerabandon']&&!queues[_0x1923cd[_0xc8fd('0xf')]][_0xc8fd('0x1b')]){queues[_0x1923cd['uniqueid']]['queuecallercomplete']=!![];queues[_0x1923cd['uniqueid']][_0xc8fd('0x1c')]=utils[_0xc8fd('0x16')]();queues[_0x1923cd[_0xc8fd('0xf')]][_0xc8fd('0x9')]='COMPLETEDBYAGENT';}utils[_0xc8fd('0x12')](util[_0xc8fd('0x3')](_0xc8fd('0x1d'),_0x1923cd['uniqueid'],queues[_0x1923cd[_0xc8fd('0xf')]][_0xc8fd('0x1e')],queues[_0x1923cd[_0xc8fd('0xf')]][_0xc8fd('0x9')]));writeDB(queues[_0x1923cd[_0xc8fd('0xf')]]);}else if(queues[_0x1923cd['uniqueid']]['transfereduniqueid']){utils[_0xc8fd('0x12')](util['format'](_0xc8fd('0x1f'),_0x1923cd[_0xc8fd('0xf')],queues[_0x1923cd[_0xc8fd('0xf')]][_0xc8fd('0x1e')],queues[_0x1923cd[_0xc8fd('0xf')]][_0xc8fd('0xe')]));queues[queues[_0x1923cd[_0xc8fd('0xf')]]['transfereduniqueid']]=queues[_0x1923cd['uniqueid']];queues[queues[_0x1923cd[_0xc8fd('0xf')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x1923cd[_0xc8fd('0xf')]];}}}catch(_0x63fecb){utils['error'](util[_0xc8fd('0x3')](_0xc8fd('0x19'),_0x1923cd[_0xc8fd('0xf')]),_0x63fecb);}};exports[_0xc8fd('0x20')]=function(_0x30855c){try{utils['debug'](util[_0xc8fd('0x3')](_0xc8fd('0x21'),_0x30855c['uniqueid']),_0x30855c);if(!_[_0xc8fd('0x22')](_0x30855c[_0xc8fd('0x23')][_0xc8fd('0x24')])&&_0x30855c['value'][_0xc8fd('0x25')]()!=='CONTINUE'){if(!_['isNil'](queues[_0x30855c[_0xc8fd('0xf')]])){queues[_0x30855c['uniqueid']][_0xc8fd('0x26')]=![];queues[_0x30855c[_0xc8fd('0xf')]]['queuecallerabandonAt']=null;queues[_0x30855c[_0xc8fd('0xf')]][_0xc8fd('0x1b')]=!![];queues[_0x30855c[_0xc8fd('0xf')]]['queuecallerexitAt']=utils[_0xc8fd('0x16')]();queues[_0x30855c[_0xc8fd('0xf')]][_0xc8fd('0x9')]=_0x30855c[_0xc8fd('0x27')][_0xc8fd('0x25')]();utils[_0xc8fd('0x12')](util['format'](_0xc8fd('0x28'),_0x30855c[_0xc8fd('0xf')],queues[_0x30855c[_0xc8fd('0xf')]][_0xc8fd('0x1e')],_0x30855c[_0xc8fd('0x27')],queues[_0x30855c[_0xc8fd('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x30855c['uniqueid']]);}}else if(!_[_0xc8fd('0x22')](_0x30855c[_0xc8fd('0x23')][_0xc8fd('0x29')])){if(!_['isNil'](queues[_0x30855c[_0xc8fd('0xf')]])&&!queues[_0x30855c[_0xc8fd('0xf')]]['queuecallerabandon']){queues[_0x30855c[_0xc8fd('0xf')]]['queuecallerabandon']=![];queues[_0x30855c['uniqueid']][_0xc8fd('0x2a')]=null;queues[_0x30855c[_0xc8fd('0xf')]][_0xc8fd('0x1b')]=!![];queues[_0x30855c[_0xc8fd('0xf')]][_0xc8fd('0x2b')]=utils['now']();queues[_0x30855c[_0xc8fd('0xf')]][_0xc8fd('0x9')]=_0xc8fd('0x2c');utils[_0xc8fd('0x12')](util['format'](_0xc8fd('0x2d'),_0x30855c[_0xc8fd('0xf')],queues[_0x30855c[_0xc8fd('0xf')]][_0xc8fd('0x1e')],_0x30855c[_0xc8fd('0x27')],queues[_0x30855c[_0xc8fd('0xf')]][_0xc8fd('0x9')]));}}}catch(_0x26ae8f){utils[_0xc8fd('0x17')](util['format'](_0xc8fd('0x21'),_0x30855c[_0xc8fd('0xf')]),_0x26ae8f);}};exports[_0xc8fd('0x26')]=function(_0x4877a4){try{if(!_[_0xc8fd('0x22')](queues[_0x4877a4[_0xc8fd('0xf')]])){utils['debug'](util[_0xc8fd('0x3')](_0xc8fd('0x2e'),_0x4877a4['uniqueid']),_0x4877a4);queues[_0x4877a4[_0xc8fd('0xf')]][_0xc8fd('0x1b')]=![];queues[_0x4877a4[_0xc8fd('0xf')]][_0xc8fd('0x2b')]=null;queues[_0x4877a4[_0xc8fd('0xf')]][_0xc8fd('0x26')]=!![];queues[_0x4877a4[_0xc8fd('0xf')]][_0xc8fd('0x2a')]=utils[_0xc8fd('0x16')]();queues[_0x4877a4[_0xc8fd('0xf')]]['queuecallerexitreason']=_0xc8fd('0x2f');utils['info'](util[_0xc8fd('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x4877a4[_0xc8fd('0xf')],queues[_0x4877a4[_0xc8fd('0xf')]]['name'],queues[_0x4877a4[_0xc8fd('0xf')]][_0xc8fd('0x9')]));}}catch(_0x860b39){utils[_0xc8fd('0x17')](util[_0xc8fd('0x3')](_0xc8fd('0x2e'),_0x4877a4[_0xc8fd('0xf')]),_0x860b39);}};exports[_0xc8fd('0x30')]=function(_0x530cc5){try{if(!_[_0xc8fd('0x22')](queues[_0x530cc5[_0xc8fd('0xf')]])){utils[_0xc8fd('0x10')](util[_0xc8fd('0x3')](_0xc8fd('0x31'),_0x530cc5[_0xc8fd('0xf')]),_0x530cc5);utils[_0xc8fd('0x12')](util[_0xc8fd('0x3')](_0xc8fd('0x32'),_0x530cc5[_0xc8fd('0xf')],queues[_0x530cc5[_0xc8fd('0xf')]][_0xc8fd('0x1e')],_0x530cc5[_0xc8fd('0x33')],_0x530cc5['connectedlinename']));queues[_0x530cc5['uniqueid']][_0xc8fd('0x30')]=!![];queues[_0x530cc5[_0xc8fd('0xf')]]['queuecallerleaveAt']=utils[_0xc8fd('0x16')]();queues[_0x530cc5[_0xc8fd('0xf')]]['holdtime']=utils[_0xc8fd('0x34')](queues[_0x530cc5[_0xc8fd('0xf')]][_0xc8fd('0x1a')],queues[_0x530cc5[_0xc8fd('0xf')]][_0xc8fd('0x35')]);queues[_0x530cc5[_0xc8fd('0xf')]][_0xc8fd('0x15')]=_0x530cc5[_0xc8fd('0x15')];queues[_0x530cc5[_0xc8fd('0xf')]][_0xc8fd('0x36')]=_0x530cc5[_0xc8fd('0x36')];queues[_0x530cc5[_0xc8fd('0xf')]]['connectedlinenum']=_0x530cc5[_0xc8fd('0x33')];queues[_0x530cc5[_0xc8fd('0xf')]]['connectedlinename']=_0x530cc5[_0xc8fd('0x37')];}}catch(_0x2a8fd5){utils[_0xc8fd('0x17')](util['format'](_0xc8fd('0x31'),_0x530cc5[_0xc8fd('0xf')]),_0x2a8fd5);}};exports[_0xc8fd('0x38')]=function(_0x38fc12){try{if(!_[_0xc8fd('0x22')](queues[_0x38fc12[_0xc8fd('0xf')]])){utils[_0xc8fd('0x10')](util[_0xc8fd('0x3')]('[%s][queues][agentconnect]',_0x38fc12['uniqueid']),_0x38fc12);utils[_0xc8fd('0x12')](util[_0xc8fd('0x3')](_0xc8fd('0x39'),_0x38fc12[_0xc8fd('0xf')],queues[_0x38fc12['uniqueid']][_0xc8fd('0x1e')],_0x38fc12[_0xc8fd('0x3a')],_0x38fc12[_0xc8fd('0x3b')]));queues[_0x38fc12[_0xc8fd('0xf')]][_0xc8fd('0x26')]=![];queues[_0x38fc12['uniqueid']][_0xc8fd('0x26')]=![];queues[_0x38fc12[_0xc8fd('0xf')]][_0xc8fd('0x2a')]=null;queues[_0x38fc12['uniqueid']]['queuecallerexit']=![];queues[_0x38fc12[_0xc8fd('0xf')]]['queuecallerexitreason']=null;queues[_0x38fc12[_0xc8fd('0xf')]][_0xc8fd('0x2b')]=null;queues[_0x38fc12[_0xc8fd('0xf')]][_0xc8fd('0x3c')]=!![];queues[_0x38fc12[_0xc8fd('0xf')]][_0xc8fd('0x8')]=_0x38fc12[_0xc8fd('0x3b')];queues[_0x38fc12[_0xc8fd('0xf')]][_0xc8fd('0x6')]=_0x38fc12[_0xc8fd('0x3a')];}}catch(_0x4cf3b6){utils['error'](util[_0xc8fd('0x3')](_0xc8fd('0x3d'),_0x38fc12[_0xc8fd('0xf')]),_0x4cf3b6);}};exports[_0xc8fd('0x3e')]=function(_0x1b5930){try{if(!_['isNil'](queues[_0x1b5930[_0xc8fd('0xf')]])){if(queues[_0x1b5930[_0xc8fd('0xf')]][_0xc8fd('0x1a')]){utils['debug'](util[_0xc8fd('0x3')]('[%s][queues][agentcomplete]',_0x1b5930[_0xc8fd('0xf')]),_0x1b5930);queues[_0x1b5930[_0xc8fd('0xf')]][_0xc8fd('0x26')]=![];queues[_0x1b5930['uniqueid']]['queuecallerabandon']=![];queues[_0x1b5930[_0xc8fd('0xf')]][_0xc8fd('0x2a')]=null;queues[_0x1b5930[_0xc8fd('0xf')]][_0xc8fd('0x1b')]=![];queues[_0x1b5930[_0xc8fd('0xf')]][_0xc8fd('0x2b')]=null;queues[_0x1b5930[_0xc8fd('0xf')]][_0xc8fd('0x3c')]=!![];queues[_0x1b5930[_0xc8fd('0xf')]][_0xc8fd('0x6')]=_0x1b5930[_0xc8fd('0x3a')];queues[_0x1b5930['uniqueid']][_0xc8fd('0x3f')]=!![];queues[_0x1b5930[_0xc8fd('0xf')]][_0xc8fd('0x1c')]=utils[_0xc8fd('0x16')]();if(_0x1b5930['reason']==_0xc8fd('0x40')){if(!queues[_0x1b5930[_0xc8fd('0xf')]][_0xc8fd('0x40')]){queues[_0x1b5930[_0xc8fd('0xf')]]['queuecallerexitreason']=_0xc8fd('0x41');}}else{queues[_0x1b5930['uniqueid']][_0xc8fd('0x9')]=_0xc8fd('0x42')+_0x1b5930['reason'][_0xc8fd('0x25')]();}utils[_0xc8fd('0x12')](util[_0xc8fd('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x1b5930[_0xc8fd('0xf')],queues[_0x1b5930[_0xc8fd('0xf')]][_0xc8fd('0x1e')],_0x1b5930[_0xc8fd('0x3a')],queues[_0x1b5930[_0xc8fd('0xf')]][_0xc8fd('0x9')]));writeDB(queues[_0x1b5930[_0xc8fd('0xf')]]);}}}catch(_0x50fbfd){utils[_0xc8fd('0x17')](util[_0xc8fd('0x3')](_0xc8fd('0x43'),_0x1b5930[_0xc8fd('0xf')]),_0x50fbfd);}};exports['blindtransfer']=function(_0xff400e){try{if(!_['isNil'](queues[_0xff400e[_0xc8fd('0x44')]])){utils[_0xc8fd('0x10')](util[_0xc8fd('0x3')](_0xc8fd('0x45'),_0xff400e[_0xc8fd('0xf')]),_0xff400e);queues[_0xff400e[_0xc8fd('0x44')]][_0xc8fd('0x40')]=!![];queues[_0xff400e['transfereeuniqueid']][_0xc8fd('0x46')]=_0xc8fd('0x47');queues[_0xff400e['transfereeuniqueid']][_0xc8fd('0x48')]=_0xff400e[_0xc8fd('0x49')];queues[_0xff400e[_0xc8fd('0x44')]][_0xc8fd('0x4a')]=_0xff400e[_0xc8fd('0x44')];queues[_0xff400e[_0xc8fd('0x44')]]['queuecallerexitreason']=_0xc8fd('0x4b');utils[_0xc8fd('0x12')](util[_0xc8fd('0x3')](_0xc8fd('0x4c'),_0xff400e[_0xc8fd('0xf')],queues[_0xff400e['transfereeuniqueid']][_0xc8fd('0x1e')],_0xff400e[_0xc8fd('0x44')],_0xff400e[_0xc8fd('0x49')]));}}catch(_0x33d5d9){utils[_0xc8fd('0x17')](util['format'](_0xc8fd('0x45'),_0xff400e[_0xc8fd('0xf')]),_0x33d5d9);}};exports[_0xc8fd('0x4d')]=function(_0x187ed2){try{utils['debug'](util[_0xc8fd('0x3')](_0xc8fd('0x4e'),_0x187ed2['origtransfereruniqueid']),_0x187ed2);if(_0x187ed2[_0xc8fd('0x4f')]==_0x187ed2[_0xc8fd('0x50')]){if(!_['isNil'](queues[_0x187ed2[_0xc8fd('0x51')]])){utils[_0xc8fd('0x12')](util[_0xc8fd('0x3')](_0xc8fd('0x52'),_0x187ed2[_0xc8fd('0x4f')],queues[_0x187ed2[_0xc8fd('0x51')]][_0xc8fd('0x1e')],_0x187ed2['origtransfererexten']));queues[_0x187ed2[_0xc8fd('0x51')]][_0xc8fd('0x40')]=!![];queues[_0x187ed2['secondtransfererlinkedid']]['transfertype']=_0xc8fd('0x53');queues[_0x187ed2['secondtransfererlinkedid']][_0xc8fd('0x48')]=_0x187ed2['origtransfererexten'];queues[_0x187ed2['secondtransfererlinkedid']][_0xc8fd('0x4a')]=_0x187ed2[_0xc8fd('0x4f')];queues[_0x187ed2['secondtransfererlinkedid']][_0xc8fd('0x9')]=_0xc8fd('0x54');}if(!_['isNil'](queues[_0x187ed2['origtransfererlinkedid']])){if(_0x187ed2[_0xc8fd('0x55')]&&queues[_0x187ed2['transfereelinkedid']]){queues[_0x187ed2[_0xc8fd('0x55')]][_0xc8fd('0x56')]=0x1;queues[_0x187ed2[_0xc8fd('0x44')]]=_[_0xc8fd('0x57')](queues[_0x187ed2[_0xc8fd('0x55')]]);queues[_0x187ed2[_0xc8fd('0x44')]][_0xc8fd('0xe')]=_0x187ed2[_0xc8fd('0x58')];queues[_0x187ed2[_0xc8fd('0x44')]]['queuecallerenterreason']=0x2;queues[_0x187ed2[_0xc8fd('0x44')]][_0xc8fd('0x7')]=queues[_0x187ed2[_0xc8fd('0x51')]][_0xc8fd('0x7')];queues[_0x187ed2[_0xc8fd('0x44')]]['calleridname']=queues[_0x187ed2[_0xc8fd('0x51')]][_0xc8fd('0x59')];queues[_0x187ed2[_0xc8fd('0x44')]]['queuecallerjoinAt']=utils[_0xc8fd('0x16')]();queues[_0x187ed2[_0xc8fd('0x44')]][_0xc8fd('0x1a')]=utils[_0xc8fd('0x16')]();queues[_0x187ed2[_0xc8fd('0x44')]][_0xc8fd('0x5a')]=0x0;queues[_0x187ed2[_0xc8fd('0x44')]]['mohtime']=0x0;utils['info'](util[_0xc8fd('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x187ed2['origtransfereruniqueid'],queues[_0x187ed2[_0xc8fd('0x44')]][_0xc8fd('0x1e')],queues[_0x187ed2[_0xc8fd('0x44')]]['calleridnum'],queues[_0x187ed2['transfereeuniqueid']]['calleridname']));}else{utils[_0xc8fd('0x12')](util[_0xc8fd('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x187ed2[_0xc8fd('0x4f')],queues[_0x187ed2[_0xc8fd('0x50')]][_0xc8fd('0x1e')],_0x187ed2[_0xc8fd('0x51')]));queues[_0x187ed2[_0xc8fd('0x50')]][_0xc8fd('0xe')]=_0x187ed2[_0xc8fd('0x51')];}}}else if(_0x187ed2[_0xc8fd('0x5b')]==_0x187ed2['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x187ed2[_0xc8fd('0x50')]])){utils[_0xc8fd('0x12')](util[_0xc8fd('0x3')](_0xc8fd('0x5c'),_0x187ed2[_0xc8fd('0x4f')],queues[_0x187ed2[_0xc8fd('0x50')]][_0xc8fd('0x1e')],_0x187ed2[_0xc8fd('0x5b')],_0x187ed2['secondtransfererexten']));queues[_0x187ed2[_0xc8fd('0x50')]]['transfer']=!![];queues[_0x187ed2[_0xc8fd('0x50')]][_0xc8fd('0x46')]=_0xc8fd('0x53');queues[_0x187ed2[_0xc8fd('0x50')]][_0xc8fd('0x48')]=_0x187ed2[_0xc8fd('0x5d')];queues[_0x187ed2[_0xc8fd('0x50')]][_0xc8fd('0x4a')]=_0x187ed2['secondtransfereruniqueid'];queues[_0x187ed2[_0xc8fd('0x50')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0xc8fd('0x22')](queues[_0x187ed2[_0xc8fd('0x51')]])){if(_0x187ed2[_0xc8fd('0x5e')]&&queues[_0x187ed2[_0xc8fd('0x5e')]]){queues[_0x187ed2[_0xc8fd('0x5e')]][_0xc8fd('0x56')]=0x1;queues[_0x187ed2[_0xc8fd('0x58')]]=_[_0xc8fd('0x57')](queues[_0x187ed2['transfertargetlinkedid']]);queues[_0x187ed2[_0xc8fd('0x58')]][_0xc8fd('0xe')]=_0x187ed2[_0xc8fd('0x58')];queues[_0x187ed2[_0xc8fd('0x58')]][_0xc8fd('0x56')]=0x2;queues[_0x187ed2[_0xc8fd('0x58')]][_0xc8fd('0x7')]=queues[_0x187ed2[_0xc8fd('0x50')]]['calleridnum'];queues[_0x187ed2[_0xc8fd('0x58')]][_0xc8fd('0x59')]=queues[_0x187ed2['origtransfererlinkedid']]['calleridname'];queues[_0x187ed2['transfertargetuniqueid']][_0xc8fd('0x35')]=utils[_0xc8fd('0x16')]();queues[_0x187ed2[_0xc8fd('0x58')]][_0xc8fd('0x1a')]=utils[_0xc8fd('0x16')]();queues[_0x187ed2[_0xc8fd('0x58')]]['holdtime']=0x0;queues[_0x187ed2[_0xc8fd('0x58')]]['mohtime']=0x0;utils[_0xc8fd('0x12')](util[_0xc8fd('0x3')](_0xc8fd('0x5f'),_0x187ed2[_0xc8fd('0x4f')],queues[_0x187ed2[_0xc8fd('0x58')]][_0xc8fd('0x1e')],queues[_0x187ed2['transfertargetuniqueid']][_0xc8fd('0xe')],queues[_0x187ed2[_0xc8fd('0x58')]]['calleridnum'],queues[_0x187ed2['transfertargetuniqueid']][_0xc8fd('0x59')]));}else{utils['info'](util[_0xc8fd('0x3')](_0xc8fd('0x60'),_0x187ed2[_0xc8fd('0x4f')],queues[_0x187ed2['secondtransfererlinkedid']][_0xc8fd('0x1e')],_0x187ed2['origtransfererlinkedid']));queues[_0x187ed2['secondtransfererlinkedid']][_0xc8fd('0xe')]=_0x187ed2[_0xc8fd('0x50')];}}}}catch(_0x501bf0){utils[_0xc8fd('0x17')](util[_0xc8fd('0x3')](_0xc8fd('0x4e'),_0x187ed2[_0xc8fd('0x4f')]),_0x501bf0);}};exports[_0xc8fd('0x61')]=function(_0x26ff4d){try{if(!_[_0xc8fd('0x22')](queues[_0x26ff4d[_0xc8fd('0xf')]])){utils[_0xc8fd('0x10')](util[_0xc8fd('0x3')](_0xc8fd('0x62'),_0x26ff4d[_0xc8fd('0xf')]),_0x26ff4d);queues[_0x26ff4d[_0xc8fd('0xf')]][_0xc8fd('0x63')]=utils['now']();utils[_0xc8fd('0x12')](util[_0xc8fd('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x26ff4d[_0xc8fd('0xf')],queues[_0x26ff4d[_0xc8fd('0xf')]][_0xc8fd('0x1e')],queues[_0x26ff4d[_0xc8fd('0xf')]]['musiconholdstartAt']));}}catch(_0x489afd){utils[_0xc8fd('0x17')](util[_0xc8fd('0x3')]('[%s][queues][musiconholdstart]',_0x26ff4d[_0xc8fd('0xf')]),_0x489afd);}};exports[_0xc8fd('0x64')]=function(_0x4eae4f){try{if(!_[_0xc8fd('0x22')](queues[_0x4eae4f[_0xc8fd('0xf')]])){if(!_[_0xc8fd('0x22')](queues[_0x4eae4f['uniqueid']]['musiconholdstartAt'])){utils[_0xc8fd('0x10')](util[_0xc8fd('0x3')](_0xc8fd('0x65'),_0x4eae4f['uniqueid']),_0x4eae4f);queues[_0x4eae4f['uniqueid']][_0xc8fd('0x66')]+=utils['diffTime'](utils[_0xc8fd('0x16')](),queues[_0x4eae4f['uniqueid']][_0xc8fd('0x63')]);utils[_0xc8fd('0x12')](util[_0xc8fd('0x3')](_0xc8fd('0x67'),_0x4eae4f[_0xc8fd('0xf')],queues[_0x4eae4f['uniqueid']][_0xc8fd('0x1e')],queues[_0x4eae4f[_0xc8fd('0xf')]][_0xc8fd('0x66')]));delete queues[_0x4eae4f[_0xc8fd('0xf')]][_0xc8fd('0x63')];}}}catch(_0x279b65){utils[_0xc8fd('0x17')](util[_0xc8fd('0x3')]('[%s][queues][musiconholdstop]',_0x4eae4f['uniqueid']),_0x279b65);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index f778ae4..c58208d 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 _0x3648=['transfereeuniqueid','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','newchannel','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','newstate','debug','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','linkedid','transfer','info','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereruniqueid','util','./utils','./transfers.controller','uniqueid','blinds'];(function(_0x5a0693,_0x5e80b8){var _0x5daa64=function(_0x36f24f){while(--_0x36f24f){_0x5a0693['push'](_0x5a0693['shift']());}};_0x5daa64(++_0x5e80b8);}(_0x3648,0x1b7));var _0x8364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3648[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8364('0x0'));var utils=require(_0x8364('0x1'));var transfers=require(_0x8364('0x2'));var recordings={};function writeDB(_0x2696ed){var _0x133cb9;utils['info'](util['format']('[%s][recordings][writeDB]',_0x2696ed[_0x8364('0x3')]));if(transfers[_0x8364('0x4')][_0x2696ed['uniqueid']]){_0x133cb9=_0x2696ed['uniqueid'];_0x2696ed[_0x8364('0x3')]=transfers[_0x8364('0x4')][_0x2696ed[_0x8364('0x3')]][_0x8364('0x5')];}if(_0x2696ed[_0x8364('0x6')]){utils[_0x8364('0x7')](_0x2696ed[_0x8364('0x6')])[_0x8364('0x8')](function(_0x1478dc){if(_0x1478dc){_0x2696ed['membername']=_0x1478dc[_0x8364('0x9')];_0x2696ed[_0x8364('0xa')]=_0x1478dc['id'];}utils[_0x8364('0xb')]('CreateVoiceRecording',_0x2696ed);});}else{utils[_0x8364('0xb')](_0x8364('0xc'),_0x2696ed);}if(_0x133cb9)delete transfers[_0x8364('0x4')][_0x133cb9];}exports[_0x8364('0xd')]=function(_0x4c09b7){try{utils['debug'](util[_0x8364('0xe')]('[%s][recordings][newchannel]',_0x4c09b7[_0x8364('0x3')]),_0x4c09b7);if(_0x4c09b7[_0x8364('0x3')]==_0x4c09b7['linkedid']){utils['info'](util[_0x8364('0xe')](_0x8364('0xf'),_0x4c09b7['uniqueid'],_0x4c09b7[_0x8364('0x10')],_0x4c09b7[_0x8364('0x11')]));recordings[_0x4c09b7[_0x8364('0x3')]]={'uniqueid':_0x4c09b7[_0x8364('0x3')],'accountcode':_0x4c09b7[_0x8364('0x6')],'exten':_0x4c09b7[_0x8364('0x11')],'context':_0x4c09b7['context'],'channel':_0x4c09b7[_0x8364('0x12')],'monitors':[]};}}catch(_0x1d804f){utils[_0x8364('0x13')](util[_0x8364('0xe')](_0x8364('0x14'),_0x4c09b7[_0x8364('0x3')]),_0x1d804f);}};exports[_0x8364('0x15')]=function(_0x49bec6){try{utils[_0x8364('0x16')](util[_0x8364('0xe')](_0x8364('0x17'),_0x49bec6[_0x8364('0x3')]),_0x49bec6);if(!_['isNil'](recordings[_0x49bec6[_0x8364('0x3')]])&&_0x49bec6[_0x8364('0x18')]==0x6){utils['info'](util[_0x8364('0xe')](_0x8364('0x19'),_0x49bec6[_0x8364('0x3')],_0x49bec6[_0x8364('0x10')],_0x49bec6[_0x8364('0x12')]));}else if(!_[_0x8364('0x1a')](recordings[_0x49bec6[_0x8364('0x1b')]])&&_0x49bec6[_0x8364('0x18')]==0x6&&_0x49bec6[_0x8364('0x10')]!=_0x8364('0x1c')){utils[_0x8364('0x1d')](util[_0x8364('0xe')](_0x8364('0x1e'),_0x49bec6[_0x8364('0x3')],_0x49bec6[_0x8364('0x1b')],_0x49bec6[_0x8364('0x10')],_0x49bec6[_0x8364('0x12')]));recordings[_0x49bec6[_0x8364('0x1b')]]['accountcode']=_0x49bec6['accountcode'];}}catch(_0x7cce2a){utils[_0x8364('0x13')](util[_0x8364('0xe')](_0x8364('0x17'),_0x49bec6['uniqueid']),_0x7cce2a);}};exports[_0x8364('0x1f')]=function(_0x19c136){try{if(!_[_0x8364('0x1a')](_0x19c136[_0x8364('0x20')])&&!_[_0x8364('0x1a')](_0x19c136[_0x8364('0x20')][_0x8364('0x21')])){utils['debug'](util[_0x8364('0xe')](_0x8364('0x22'),_0x19c136[_0x8364('0x3')]),_0x19c136);utils[_0x8364('0x1d')](util[_0x8364('0xe')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x19c136[_0x8364('0x3')],_0x19c136[_0x8364('0x20')],_0x19c136['value']));if(_[_0x8364('0x23')](_0x19c136[_0x8364('0x24')],_0x8364('0x25'))){_0x19c136['value']=_0x19c136[_0x8364('0x24')][_0x8364('0x26')](_0x8364('0x25'),_0x8364('0x27'));}if(recordings[_0x19c136['linkedid']]){var _0x3f11db=_[_0x8364('0x28')](recordings[_0x19c136[_0x8364('0x1b')]]['monitors'],{'value':_0x19c136['value']});if(_['isNil'](_0x3f11db)){recordings[_0x19c136[_0x8364('0x1b')]][_0x8364('0x29')][_0x8364('0x2a')]({'value':_0x19c136[_0x8364('0x24')]});}}}}catch(_0x513a28){utils[_0x8364('0x13')](util['format']('[%s][recordings][varset]',_0x19c136[_0x8364('0x3')]),_0x513a28);}};exports[_0x8364('0x2b')]=function(_0x28eaca){try{if(!_[_0x8364('0x1a')](recordings[_0x28eaca['uniqueid']])){utils[_0x8364('0x16')](util[_0x8364('0xe')](_0x8364('0x2c'),_0x28eaca['uniqueid']),_0x28eaca);utils['info'](util[_0x8364('0xe')](_0x8364('0x2d'),_0x28eaca[_0x8364('0x3')],_0x28eaca[_0x8364('0x2e')],_0x28eaca['calleridname'],_0x28eaca['cause-txt']));recordings[_0x28eaca[_0x8364('0x3')]][_0x8364('0x2e')]=_0x28eaca[_0x8364('0x2e')];recordings[_0x28eaca[_0x8364('0x3')]]['calleridname']=_0x28eaca[_0x8364('0x2f')];recordings[_0x28eaca[_0x8364('0x3')]][_0x8364('0x30')]=_0x28eaca[_0x8364('0x30')];recordings[_0x28eaca[_0x8364('0x3')]][_0x8364('0x31')]=_0x28eaca[_0x8364('0x31')];if(recordings[_0x28eaca[_0x8364('0x3')]][_0x8364('0x32')]==_0x8364('0x33')&&recordings[_0x28eaca[_0x8364('0x3')]][_0x8364('0x6')]){recordings[_0x28eaca[_0x8364('0x3')]][_0x8364('0x30')]=recordings[_0x28eaca[_0x8364('0x3')]]['accountcode'];recordings[_0x28eaca['uniqueid']]['connectedlinename']='';}recordings[_0x28eaca['uniqueid']][_0x8364('0x29')][_0x8364('0x34')](function(_0x31a0d2){var _0x417bfd=_[_0x8364('0x35')](recordings[_0x28eaca['uniqueid']]);_0x417bfd['value']=_0x31a0d2[_0x8364('0x24')];writeDB(_0x417bfd);});delete recordings[_0x28eaca[_0x8364('0x3')]];}}catch(_0xc38736){utils['error'](util['format'](_0x8364('0x2c'),_0x28eaca[_0x8364('0x3')]),_0xc38736);}};exports[_0x8364('0x36')]=function(_0x3cbb7b){try{if(!_[_0x8364('0x1a')](recordings[_0x3cbb7b['uniqueid']])){utils[_0x8364('0x16')](util['format'](_0x8364('0x37'),_0x3cbb7b[_0x8364('0x3')]),_0x3cbb7b);utils[_0x8364('0x1d')](util['format'](_0x8364('0x38'),_0x3cbb7b['uniqueid'],_0x3cbb7b['application'],_0x3cbb7b[_0x8364('0x39')]));if(_0x3cbb7b[_0x8364('0x3a')][_0x8364('0x3b')]()=='set'&&_[_0x8364('0x3c')](_0x3cbb7b[_0x8364('0x39')][_0x8364('0x3b')](),_0x8364('0x3d'))){var _0x240e16=_0x3cbb7b[_0x8364('0x39')][_0x8364('0x3e')]('=');var _0x526b93=_0x240e16[0x0][_0x8364('0x3f')](_0x240e16[0x0][_0x8364('0x40')]('(')+0x1,_0x240e16[0x0]['lastIndexOf'](')'));var _0x588a77=_0x240e16[0x1];recordings[_0x3cbb7b[_0x8364('0x3')]][_0x526b93]=_0x588a77;}}}catch(_0x19cdb0){utils[_0x8364('0x13')](util[_0x8364('0xe')](_0x8364('0x37'),_0x3cbb7b[_0x8364('0x3')]),_0x19cdb0);}};exports[_0x8364('0x41')]=function(_0x1c29a9){try{if(!_['isNil'](recordings[_0x1c29a9[_0x8364('0x3')]])){utils[_0x8364('0x16')](util[_0x8364('0xe')](_0x8364('0x42'),_0x1c29a9['uniqueid']),_0x1c29a9);utils[_0x8364('0x1d')](util['format'](_0x8364('0x43'),_0x1c29a9[_0x8364('0x3')],_0x1c29a9[_0x8364('0x44')]));recordings[_0x1c29a9[_0x8364('0x3')]][_0x8364('0x44')]=_0x1c29a9['queue'];}}catch(_0x885f86){utils[_0x8364('0x13')](util[_0x8364('0xe')]('[%s][recordings][queuecallerjoin]',_0x1c29a9[_0x8364('0x3')]),_0x885f86);}};exports[_0x8364('0x45')]=function(_0xac5355){try{utils['debug'](util['format'](_0x8364('0x46'),_0xac5355[_0x8364('0x3')]),_0xac5355);utils[_0x8364('0x1d')](util[_0x8364('0xe')](_0x8364('0x47'),_0xac5355['uniqueid'],_0xac5355[_0x8364('0x48')],_0xac5355['transferercalleridname'],_0xac5355['transfereecalleridnum'],_0xac5355['transfereecalleridname']));if(recordings[_0xac5355[_0x8364('0x49')]]&&transfers[_0x8364('0x4')][_0xac5355[_0x8364('0x49')]]){transfers[_0x8364('0x4')][_0xac5355[_0x8364('0x49')]]['recording']=!![];}}catch(_0x3e99e5){utils[_0x8364('0x13')](util[_0x8364('0xe')](_0x8364('0x46'),_0xac5355[_0x8364('0x3')]),_0x3e99e5);}}; \ No newline at end of file +var _0xf57b=['blindtransfer','[%s][recordings][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','linkedid','transfer','varset','variable','[%s][recordings][varset]','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','forEach','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue'];(function(_0x563f7b,_0x33c617){var _0x8d66fe=function(_0x4e6834){while(--_0x4e6834){_0x563f7b['push'](_0x563f7b['shift']());}};_0x8d66fe(++_0x33c617);}(_0xf57b,0x1e4));var _0xbf57=function(_0x49830c,_0x4ab630){_0x49830c=_0x49830c-0x0;var _0x341b64=_0xf57b[_0x49830c];return _0x341b64;};'use strict';var _=require('lodash');var util=require(_0xbf57('0x0'));var utils=require(_0xbf57('0x1'));var transfers=require(_0xbf57('0x2'));var recordings={};function writeDB(_0x4a20e5){var _0xae2e5d;utils[_0xbf57('0x3')](util[_0xbf57('0x4')](_0xbf57('0x5'),_0x4a20e5[_0xbf57('0x6')]));if(transfers[_0xbf57('0x7')][_0x4a20e5[_0xbf57('0x6')]]){_0xae2e5d=_0x4a20e5[_0xbf57('0x6')];_0x4a20e5[_0xbf57('0x6')]=transfers[_0xbf57('0x7')][_0x4a20e5[_0xbf57('0x6')]][_0xbf57('0x8')];}if(_0x4a20e5[_0xbf57('0x9')]){utils[_0xbf57('0xa')](_0x4a20e5[_0xbf57('0x9')])[_0xbf57('0xb')](function(_0x13019c){if(_0x13019c){_0x4a20e5[_0xbf57('0xc')]=_0x13019c[_0xbf57('0xd')];_0x4a20e5['UserId']=_0x13019c['id'];}utils['request'](_0xbf57('0xe'),_0x4a20e5);});}else{utils[_0xbf57('0xf')](_0xbf57('0xe'),_0x4a20e5);}if(_0xae2e5d)delete transfers[_0xbf57('0x7')][_0xae2e5d];}exports[_0xbf57('0x10')]=function(_0x265050){try{utils[_0xbf57('0x11')](util[_0xbf57('0x4')](_0xbf57('0x12'),_0x265050[_0xbf57('0x6')]),_0x265050);if(_0x265050['uniqueid']==_0x265050['linkedid']){utils['info'](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x265050[_0xbf57('0x6')],_0x265050[_0xbf57('0x13')],_0x265050[_0xbf57('0x14')]));recordings[_0x265050['uniqueid']]={'uniqueid':_0x265050[_0xbf57('0x6')],'accountcode':_0x265050['accountcode'],'exten':_0x265050['exten'],'context':_0x265050[_0xbf57('0x13')],'channel':_0x265050[_0xbf57('0x15')],'monitors':[]};}}catch(_0x2bd0ac){utils[_0xbf57('0x16')](util['format']('[%s][recordings][newchannel]',_0x265050[_0xbf57('0x6')]),_0x2bd0ac);}};exports[_0xbf57('0x17')]=function(_0x1475e7){try{utils[_0xbf57('0x11')](util[_0xbf57('0x4')](_0xbf57('0x18'),_0x1475e7[_0xbf57('0x6')]),_0x1475e7);if(!_[_0xbf57('0x19')](recordings[_0x1475e7[_0xbf57('0x6')]])&&_0x1475e7[_0xbf57('0x1a')]==0x6){utils[_0xbf57('0x3')](util[_0xbf57('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x1475e7[_0xbf57('0x6')],_0x1475e7['context'],_0x1475e7[_0xbf57('0x15')]));}else if(!_[_0xbf57('0x19')](recordings[_0x1475e7[_0xbf57('0x1b')]])&&_0x1475e7[_0xbf57('0x1a')]==0x6&&_0x1475e7['context']!=_0xbf57('0x1c')){utils[_0xbf57('0x3')](util[_0xbf57('0x4')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1475e7[_0xbf57('0x6')],_0x1475e7[_0xbf57('0x1b')],_0x1475e7[_0xbf57('0x13')],_0x1475e7['channel']));recordings[_0x1475e7[_0xbf57('0x1b')]]['accountcode']=_0x1475e7['accountcode'];}}catch(_0x4131fe){utils[_0xbf57('0x16')](util[_0xbf57('0x4')](_0xbf57('0x18'),_0x1475e7[_0xbf57('0x6')]),_0x4131fe);}};exports[_0xbf57('0x1d')]=function(_0x392f1c){try{if(!_[_0xbf57('0x19')](_0x392f1c[_0xbf57('0x1e')])&&!_['isNil'](_0x392f1c[_0xbf57('0x1e')]['mixmonitor_filename'])){utils[_0xbf57('0x11')](util[_0xbf57('0x4')](_0xbf57('0x1f'),_0x392f1c[_0xbf57('0x6')]),_0x392f1c);utils[_0xbf57('0x3')](util[_0xbf57('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x392f1c['uniqueid'],_0x392f1c[_0xbf57('0x1e')],_0x392f1c['value']));if(_[_0xbf57('0x20')](_0x392f1c[_0xbf57('0x21')],_0xbf57('0x22'))){_0x392f1c[_0xbf57('0x21')]=_0x392f1c[_0xbf57('0x21')][_0xbf57('0x23')](_0xbf57('0x22'),_0xbf57('0x24'));}if(recordings[_0x392f1c['linkedid']]){var _0x5b66c3=_[_0xbf57('0x25')](recordings[_0x392f1c['linkedid']][_0xbf57('0x26')],{'value':_0x392f1c['value']});if(_[_0xbf57('0x19')](_0x5b66c3)){recordings[_0x392f1c[_0xbf57('0x1b')]]['monitors'][_0xbf57('0x27')]({'value':_0x392f1c['value']});}}}}catch(_0x58430d){utils[_0xbf57('0x16')](util[_0xbf57('0x4')]('[%s][recordings][varset]',_0x392f1c[_0xbf57('0x6')]),_0x58430d);}};exports[_0xbf57('0x28')]=function(_0x50e298){try{if(!_[_0xbf57('0x19')](recordings[_0x50e298[_0xbf57('0x6')]])){utils['debug'](util[_0xbf57('0x4')]('[%s][recordings][hangup]',_0x50e298[_0xbf57('0x6')]),_0x50e298);utils[_0xbf57('0x3')](util[_0xbf57('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x50e298['uniqueid'],_0x50e298['calleridnum'],_0x50e298[_0xbf57('0x29')],_0x50e298[_0xbf57('0x2a')]));recordings[_0x50e298[_0xbf57('0x6')]]['calleridnum']=_0x50e298[_0xbf57('0x2b')];recordings[_0x50e298[_0xbf57('0x6')]][_0xbf57('0x29')]=_0x50e298[_0xbf57('0x29')];recordings[_0x50e298[_0xbf57('0x6')]][_0xbf57('0x2c')]=_0x50e298[_0xbf57('0x2c')];recordings[_0x50e298[_0xbf57('0x6')]][_0xbf57('0x2d')]=_0x50e298[_0xbf57('0x2d')];if(recordings[_0x50e298[_0xbf57('0x6')]]['type']=='outbound'&&recordings[_0x50e298['uniqueid']][_0xbf57('0x9')]){recordings[_0x50e298['uniqueid']][_0xbf57('0x2c')]=recordings[_0x50e298['uniqueid']][_0xbf57('0x9')];recordings[_0x50e298[_0xbf57('0x6')]][_0xbf57('0x2d')]='';}recordings[_0x50e298[_0xbf57('0x6')]][_0xbf57('0x26')][_0xbf57('0x2e')](function(_0x48deb3){var _0x38fcf3=_['clone'](recordings[_0x50e298[_0xbf57('0x6')]]);_0x38fcf3[_0xbf57('0x21')]=_0x48deb3[_0xbf57('0x21')];writeDB(_0x38fcf3);});delete recordings[_0x50e298[_0xbf57('0x6')]];}}catch(_0x145e85){utils[_0xbf57('0x16')](util[_0xbf57('0x4')]('[%s][recordings][hangup]',_0x50e298[_0xbf57('0x6')]),_0x145e85);}};exports['newexten']=function(_0x5adf66){try{if(!_['isNil'](recordings[_0x5adf66[_0xbf57('0x6')]])){utils[_0xbf57('0x11')](util['format'](_0xbf57('0x2f'),_0x5adf66[_0xbf57('0x6')]),_0x5adf66);utils[_0xbf57('0x3')](util[_0xbf57('0x4')](_0xbf57('0x30'),_0x5adf66['uniqueid'],_0x5adf66[_0xbf57('0x31')],_0x5adf66[_0xbf57('0x32')]));if(_0x5adf66[_0xbf57('0x31')][_0xbf57('0x33')]()==_0xbf57('0x34')&&_[_0xbf57('0x35')](_0x5adf66['appdata'][_0xbf57('0x33')](),_0xbf57('0x36'))){var _0x480a6e=_0x5adf66[_0xbf57('0x32')]['split']('=');var _0x385b8a=_0x480a6e[0x0]['substring'](_0x480a6e[0x0][_0xbf57('0x37')]('(')+0x1,_0x480a6e[0x0][_0xbf57('0x37')](')'));var _0x3d4a94=_0x480a6e[0x1];recordings[_0x5adf66[_0xbf57('0x6')]][_0x385b8a]=_0x3d4a94;}}}catch(_0x423d0f){utils['error'](util['format'](_0xbf57('0x2f'),_0x5adf66['uniqueid']),_0x423d0f);}};exports[_0xbf57('0x38')]=function(_0x1c4139){try{if(!_[_0xbf57('0x19')](recordings[_0x1c4139[_0xbf57('0x6')]])){utils[_0xbf57('0x11')](util[_0xbf57('0x4')](_0xbf57('0x39'),_0x1c4139[_0xbf57('0x6')]),_0x1c4139);utils[_0xbf57('0x3')](util[_0xbf57('0x4')](_0xbf57('0x3a'),_0x1c4139[_0xbf57('0x6')],_0x1c4139[_0xbf57('0x3b')]));recordings[_0x1c4139[_0xbf57('0x6')]]['queue']=_0x1c4139[_0xbf57('0x3b')];}}catch(_0x238948){utils[_0xbf57('0x16')](util[_0xbf57('0x4')]('[%s][recordings][queuecallerjoin]',_0x1c4139[_0xbf57('0x6')]),_0x238948);}};exports[_0xbf57('0x3c')]=function(_0x29e4a6){try{utils[_0xbf57('0x11')](util[_0xbf57('0x4')](_0xbf57('0x3d'),_0x29e4a6[_0xbf57('0x6')]),_0x29e4a6);utils[_0xbf57('0x3')](util[_0xbf57('0x4')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x29e4a6['uniqueid'],_0x29e4a6[_0xbf57('0x3e')],_0x29e4a6[_0xbf57('0x3f')],_0x29e4a6[_0xbf57('0x40')],_0x29e4a6[_0xbf57('0x41')]));if(recordings[_0x29e4a6[_0xbf57('0x42')]]&&transfers[_0xbf57('0x7')][_0x29e4a6[_0xbf57('0x42')]]){transfers[_0xbf57('0x7')][_0x29e4a6['transfereruniqueid']][_0xbf57('0x43')]=!![];}}catch(_0x5805aa){utils[_0xbf57('0x16')](util[_0xbf57('0x4')](_0xbf57('0x3d'),_0x29e4a6[_0xbf57('0x6')]),_0x5805aa);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index fa3cd26..10f51b4 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 _0x217f=['[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','./utils','info'];(function(_0x51a23b,_0x548760){var _0x5ad63a=function(_0xabf7e9){while(--_0xabf7e9){_0x51a23b['push'](_0x51a23b['shift']());}};_0x5ad63a(++_0x548760);}(_0x217f,0x1b6));var _0xf217=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x217f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xf217('0x0'));function writeDB(_0x21851c){utils[_0xf217('0x1')](util['format'](_0xf217('0x2'),_0x21851c[_0xf217('0x3')]===_0xf217('0x4')?_0x21851c[_0xf217('0x5')]:_0x21851c[_0xf217('0x6')],_0x21851c['type']));utils[_0xf217('0x7')](_0xf217('0x8'),_0x21851c);}exports[_0xf217('0x9')]={};exports[_0xf217('0xa')]=function(_0x377c54){try{utils[_0xf217('0xb')](util[_0xf217('0xc')](_0xf217('0xd'),_0x377c54[_0xf217('0x6')]),_0x377c54);utils[_0xf217('0x1')](util[_0xf217('0xc')](_0xf217('0xe'),_0x377c54['uniqueid'],_0x377c54['transferercalleridnum'],_0x377c54[_0xf217('0xf')],_0x377c54['transfereecalleridnum'],_0x377c54[_0xf217('0x10')]));_0x377c54['type']='blind';exports[_0xf217('0x9')][_0x377c54[_0xf217('0x11')]]=_0x377c54;writeDB(_0x377c54);}catch(_0x401002){utils[_0xf217('0x12')](util[_0xf217('0xc')](_0xf217('0xd'),_0x377c54[_0xf217('0x6')]),_0x401002);}};exports[_0xf217('0x13')]=function(_0x591192){try{utils[_0xf217('0xb')](util['format'](_0xf217('0x14'),_0x591192[_0xf217('0x5')]),_0x591192);utils['info'](util[_0xf217('0xc')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x591192[_0xf217('0x5')],_0x591192[_0xf217('0x15')],_0x591192[_0xf217('0x16')],_0x591192[_0xf217('0x17')],_0x591192['transfertargetcalleridname']));_0x591192=_['assign'](_0x591192,{'transfererchannel':_0x591192[_0xf217('0x18')],'transferercalleridnum':_0x591192[_0xf217('0x15')],'transferercalleridname':_0x591192[_0xf217('0x16')],'transfererconnectedlinenum':_0x591192[_0xf217('0x19')],'transfererconnectedlinename':_0x591192[_0xf217('0x1a')],'transfereraccountcode':_0x591192[_0xf217('0x1b')],'transferercontext':_0x591192[_0xf217('0x1c')],'transfererexten':_0x591192[_0xf217('0x1d')],'transfererlinkedid':_0x591192[_0xf217('0x1e')],'context':_0x591192['origtransferercontext'],'extension':_0x591192['origtransfererexten'],'type':_0xf217('0x4')});if(_[_0xf217('0x1f')](_0x591192[_0xf217('0x20')])){_0x591192=_[_0xf217('0x21')](_0x591192,{'transfereechannel':_0x591192[_0xf217('0x22')],'transfereecalleridnum':_0x591192[_0xf217('0x17')],'transfereecalleridname':_0x591192['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x591192[_0xf217('0x23')],'transfereeconnectedlinename':_0x591192[_0xf217('0x24')],'transfereeaccountcode':_0x591192['transfertargetaccountcode'],'transfereecontext':_0x591192[_0xf217('0x25')],'transfereeexten':_0x591192[_0xf217('0x26')],'transfereelinkedid':_0x591192[_0xf217('0x27')]});}writeDB(_0x591192);}catch(_0x7f3dba){utils[_0xf217('0x12')](util['format'](_0xf217('0x14'),_0x591192['origtransfereruniqueid']),_0x7f3dba);}}; \ No newline at end of file +var _0x900c=['transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','./utils','info','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','format','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','type','blind','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum'];(function(_0x2514dd,_0x3edd8b){var _0x25dddb=function(_0x14ec49){while(--_0x14ec49){_0x2514dd['push'](_0x2514dd['shift']());}};_0x25dddb(++_0x3edd8b);}(_0x900c,0xe7));var _0xc900=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x900c[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xc900('0x0'));var util=require('util');var utils=require(_0xc900('0x1'));function writeDB(_0x19fb6b){utils[_0xc900('0x2')](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x19fb6b['type']===_0xc900('0x3')?_0x19fb6b[_0xc900('0x4')]:_0x19fb6b['uniqueid'],_0x19fb6b['type']));utils[_0xc900('0x5')](_0xc900('0x6'),_0x19fb6b);}exports[_0xc900('0x7')]={};exports[_0xc900('0x8')]=function(_0x3e9813){try{utils[_0xc900('0x9')](util[_0xc900('0xa')](_0xc900('0xb'),_0x3e9813[_0xc900('0xc')]),_0x3e9813);utils['info'](util[_0xc900('0xa')](_0xc900('0xd'),_0x3e9813[_0xc900('0xc')],_0x3e9813['transferercalleridnum'],_0x3e9813[_0xc900('0xe')],_0x3e9813[_0xc900('0xf')],_0x3e9813[_0xc900('0x10')]));_0x3e9813[_0xc900('0x11')]=_0xc900('0x12');exports['blinds'][_0x3e9813[_0xc900('0x13')]]=_0x3e9813;writeDB(_0x3e9813);}catch(_0x475b8c){utils['error'](util['format']('[%s][transfers][blindtransfer]',_0x3e9813['uniqueid']),_0x475b8c);}};exports[_0xc900('0x14')]=function(_0x390612){try{utils['debug'](util[_0xc900('0xa')](_0xc900('0x15'),_0x390612[_0xc900('0x4')]),_0x390612);utils[_0xc900('0x2')](util['format'](_0xc900('0x16'),_0x390612['origtransfereruniqueid'],_0x390612[_0xc900('0x17')],_0x390612[_0xc900('0x18')],_0x390612[_0xc900('0x19')],_0x390612[_0xc900('0x1a')]));_0x390612=_[_0xc900('0x1b')](_0x390612,{'transfererchannel':_0x390612[_0xc900('0x1c')],'transferercalleridnum':_0x390612[_0xc900('0x17')],'transferercalleridname':_0x390612['origtransferercalleridname'],'transfererconnectedlinenum':_0x390612[_0xc900('0x1d')],'transfererconnectedlinename':_0x390612[_0xc900('0x1e')],'transfereraccountcode':_0x390612[_0xc900('0x1f')],'transferercontext':_0x390612['secondtransferercontext'],'transfererexten':_0x390612['secondtransfererexten'],'transfererlinkedid':_0x390612[_0xc900('0x20')],'context':_0x390612[_0xc900('0x21')],'extension':_0x390612[_0xc900('0x22')],'type':_0xc900('0x3')});if(_[_0xc900('0x23')](_0x390612[_0xc900('0x24')])){_0x390612=_['assign'](_0x390612,{'transfereechannel':_0x390612[_0xc900('0x25')],'transfereecalleridnum':_0x390612['transfertargetcalleridnum'],'transfereecalleridname':_0x390612[_0xc900('0x1a')],'transfereeconnectedlinenum':_0x390612[_0xc900('0x26')],'transfereeconnectedlinename':_0x390612[_0xc900('0x27')],'transfereeaccountcode':_0x390612[_0xc900('0x28')],'transfereecontext':_0x390612[_0xc900('0x29')],'transfereeexten':_0x390612[_0xc900('0x2a')],'transfereelinkedid':_0x390612[_0xc900('0x2b')]});}writeDB(_0x390612);}catch(_0x6d57ae){utils[_0xc900('0x2c')](util['format'](_0xc900('0x15'),_0x390612[_0xc900('0x4')]),_0x6d57ae);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 140eb06..4cc49d9 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 _0x6093=['[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','bluebird','jayson/promise','moment','util','client','http','../../config/logger','info','inspect','debug','error','request','then'];(function(_0x432072,_0x391590){var _0x5e845a=function(_0x46fd93){while(--_0x46fd93){_0x432072['push'](_0x432072['shift']());}};_0x5e845a(++_0x391590);}(_0x6093,0x107));var _0x3609=function(_0x205742,_0x4ad437){_0x205742=_0x205742-0x0;var _0x222ab9=_0x6093[_0x205742];return _0x222ab9;};'use strict';var BPromise=require(_0x3609('0x0'));var jayson=require(_0x3609('0x1'));var moment=require(_0x3609('0x2'));var util=require(_0x3609('0x3'));var client=jayson[_0x3609('0x4')][_0x3609('0x5')]({'port':0x2329});var logger=require(_0x3609('0x6'))('xdr');exports['info']=function(_0x3b97f7,_0x464521){logger[_0x3609('0x7')](_0x3b97f7,_0x464521?util[_0x3609('0x8')](_0x464521,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x1db553,_0x269e29){logger[_0x3609('0x9')](_0x1db553,_0x269e29?util['inspect'](_0x269e29,{'showHidden':![],'depth':null}):'');};exports[_0x3609('0xa')]=function(_0x2d2570,_0x1de54a){logger[_0x3609('0xa')](_0x2d2570,_0x1de54a?util[_0x3609('0x8')](_0x1de54a,{'showHidden':![],'depth':null}):'');};exports[_0x3609('0xb')]=function(_0x51aaeb,_0x3a40bb){return client[_0x3609('0xb')](_0x51aaeb,{'body':_0x3a40bb})[_0x3609('0xc')](function(_0x356b0c){logger['debug'](_0x3609('0xd'),_0x51aaeb,_0x356b0c?util[_0x3609('0x8')](_0x356b0c,{'showHidden':![],'depth':null}):'');})[_0x3609('0xe')](function(_0x1517dd){logger[_0x3609('0xa')]('[utils][request]\x20name:%s',_0x51aaeb,_0x1517dd?util['inspect'](_0x1517dd,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4b339b){return client[_0x3609('0xb')](_0x3609('0xf'),{'options':{'raw':!![],'attributes':['id',_0x3609('0x10'),_0x3609('0x11'),_0x3609('0x12')],'where':_0x4b339b,'limit':0x1}})[_0x3609('0xc')](function(_0x2d875f){logger[_0x3609('0x9')](_0x3609('0x13'),JSON['stringify'](_0x4b339b),_0x2d875f?util[_0x3609('0x8')](_0x2d875f,{'showHidden':![],'depth':null}):'');return _0x2d875f[_0x3609('0x14')]['length']?_0x2d875f[_0x3609('0x14')][0x0]:null;});}exports[_0x3609('0x15')]=function(_0x29af63){return new BPromise(function(_0x4d1c0a,_0x2d1cd5){if(_0x29af63){return getUser({'internal':_0x29af63})[_0x3609('0xc')](function(_0xb5658d){logger['info'](_0x3609('0x16'),_0x29af63,_0xb5658d?_0x3609('0x17'):_0x3609('0x18'));return _0x4d1c0a(_0xb5658d);})[_0x3609('0xe')](function(_0x13f5a2){logger[_0x3609('0xa')](_0x3609('0x19'),_0x13f5a2?util[_0x3609('0x8')](_0x13f5a2,{'showHidden':![],'depth':null}):'');return _0x4d1c0a(null);});}return _0x4d1c0a(null);});};exports[_0x3609('0x1a')]=function(_0x5eaa5){return new BPromise(function(_0x45eb49,_0x25cd77){if(_0x5eaa5){return getUser({'interface':_0x5eaa5})[_0x3609('0xc')](function(_0x2a03a0){logger['info'](_0x3609('0x1b'),_0x5eaa5,_0x2a03a0?_0x3609('0x17'):'notfound');return _0x45eb49(_0x2a03a0);})[_0x3609('0xe')](function(_0x2a9ebc){logger[_0x3609('0xa')](_0x3609('0x1c'),_0x2a9ebc?util[_0x3609('0x8')](_0x2a9ebc,{'showHidden':![],'depth':null}):'');return _0x45eb49(null);});}return _0x45eb49(null);});};exports['getUserByName']=function(_0x23d4c7){return new BPromise(function(_0x53cbec,_0x4a7f51){if(_0x23d4c7){return getUser({'name':_0x23d4c7})[_0x3609('0xc')](function(_0x2e7c5f){logger[_0x3609('0x7')]('[utils][getUserByName]\x20name:%s\x20%s',_0x23d4c7,_0x2e7c5f?'found':_0x3609('0x18'));return _0x53cbec(_0x2e7c5f);})[_0x3609('0xe')](function(_0x14f26a){logger[_0x3609('0xa')](_0x3609('0x1d'),_0x14f26a?util[_0x3609('0x8')](_0x14f26a,{'showHidden':![],'depth':null}):'');return _0x53cbec(null);});}return _0x53cbec(null);});};exports['getVoiceQueueByName']=function(_0x52c7e5){return new BPromise(function(_0x443f5d,_0x4d40b0){if(_0x52c7e5){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x3609('0x11'),'type',_0x3609('0x1e'),'acwTimeout'],'where':{'name':_0x52c7e5},'limit':0x1}})[_0x3609('0xc')](function(_0xe41e85){logger[_0x3609('0x9')](_0x3609('0x1f'),_0x52c7e5,_0xe41e85?util[_0x3609('0x8')](_0xe41e85,{'showHidden':![],'depth':null}):'');logger[_0x3609('0x7')](_0x3609('0x20'),_0x52c7e5,_0xe41e85?'found':_0x3609('0x18'));return _0x443f5d(_0xe41e85[_0x3609('0x14')][_0x3609('0x21')]?_0xe41e85['result'][0x0]:null);})[_0x3609('0xe')](function(_0x481fe7){logger[_0x3609('0xa')](_0x3609('0x22'),_0x481fe7?util[_0x3609('0x8')](_0x481fe7,{'showHidden':![],'depth':null}):'');return _0x443f5d(null);});}return _0x443f5d(null);});};exports[_0x3609('0x23')]=function(_0x52c8d8,_0xb8b51a){return moment(_0x52c8d8)['add'](_0xb8b51a,_0x3609('0x24'))[_0x3609('0x25')](_0x3609('0x26'));};exports[_0x3609('0x27')]=function(_0x47e39f,_0x10e311){return moment(_0x47e39f)[_0x3609('0x28')](_0x10e311,_0x3609('0x24'))['format'](_0x3609('0x26'));};exports[_0x3609('0x29')]=function(_0x27b820,_0x11c4cb){return moment(_0x27b820)[_0x3609('0x2a')](moment(_0x11c4cb),_0x3609('0x24'));};exports[_0x3609('0x2b')]=function(_0x4a030d,_0x37f1e6){return parseInt(_0x4a030d,0xa)+parseInt(_0x37f1e6,0xa);};exports[_0x3609('0x2c')]=function(){return moment()[_0x3609('0x25')](_0x3609('0x26'));};exports[_0x3609('0x2d')]=function(_0x1febb8,_0x5eeb5d){if(_0x5eeb5d){return moment(_0x1febb8)[_0x3609('0x2d')](_0x5eeb5d);}return!![];};exports['isBefore']=function(_0x12761d,_0x565c86){if(_0x565c86){return moment(_0x12761d)['isBefore'](_0x565c86);}else if(_0x12761d){return!![];}return![];}; \ No newline at end of file +var _0xfe0e=['../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','result','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','sumTime','now','isAfter','isBefore','bluebird','util','http'];(function(_0x34b821,_0x504e55){var _0x5e00a0=function(_0x242892){while(--_0x242892){_0x34b821['push'](_0x34b821['shift']());}};_0x5e00a0(++_0x504e55);}(_0xfe0e,0x1a4));var _0xefe0=function(_0x4c7c25,_0x1e16a8){_0x4c7c25=_0x4c7c25-0x0;var _0x297619=_0xfe0e[_0x4c7c25];return _0x297619;};'use strict';var BPromise=require(_0xefe0('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require(_0xefe0('0x1'));var client=jayson['client'][_0xefe0('0x2')]({'port':0x2329});var logger=require(_0xefe0('0x3'))('xdr');exports[_0xefe0('0x4')]=function(_0x385004,_0x51c6b1){logger[_0xefe0('0x4')](_0x385004,_0x51c6b1?util[_0xefe0('0x5')](_0x51c6b1,{'showHidden':![],'depth':null}):'');};exports[_0xefe0('0x6')]=function(_0x13f133,_0x349b3d){logger[_0xefe0('0x6')](_0x13f133,_0x349b3d?util[_0xefe0('0x5')](_0x349b3d,{'showHidden':![],'depth':null}):'');};exports[_0xefe0('0x7')]=function(_0x44e51b,_0x5d3853){logger[_0xefe0('0x7')](_0x44e51b,_0x5d3853?util[_0xefe0('0x5')](_0x5d3853,{'showHidden':![],'depth':null}):'');};exports[_0xefe0('0x8')]=function(_0x1906fb,_0x5f38ae){return client[_0xefe0('0x8')](_0x1906fb,{'body':_0x5f38ae})[_0xefe0('0x9')](function(_0x52bc85){logger['debug'](_0xefe0('0xa'),_0x1906fb,_0x52bc85?util[_0xefe0('0x5')](_0x52bc85,{'showHidden':![],'depth':null}):'');})[_0xefe0('0xb')](function(_0x46d2ca){logger[_0xefe0('0x7')](_0xefe0('0xa'),_0x1906fb,_0x46d2ca?util[_0xefe0('0x5')](_0x46d2ca,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1bb02d){return client['request'](_0xefe0('0xc'),{'options':{'raw':!![],'attributes':['id',_0xefe0('0xd'),_0xefe0('0xe'),_0xefe0('0xf')],'where':_0x1bb02d,'limit':0x1}})[_0xefe0('0x9')](function(_0x4920d4){logger[_0xefe0('0x6')]('[utils][getUser]\x20where:%s',JSON['stringify'](_0x1bb02d),_0x4920d4?util[_0xefe0('0x5')](_0x4920d4,{'showHidden':![],'depth':null}):'');return _0x4920d4['result']['length']?_0x4920d4[_0xefe0('0x10')][0x0]:null;});}exports[_0xefe0('0x11')]=function(_0x15925d){return new BPromise(function(_0xbd28b9,_0x116606){if(_0x15925d){return getUser({'internal':_0x15925d})['then'](function(_0x3052f2){logger[_0xefe0('0x4')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x15925d,_0x3052f2?_0xefe0('0x12'):_0xefe0('0x13'));return _0xbd28b9(_0x3052f2);})[_0xefe0('0xb')](function(_0x5b07fc){logger['error'](_0xefe0('0x14'),_0x5b07fc?util['inspect'](_0x5b07fc,{'showHidden':![],'depth':null}):'');return _0xbd28b9(null);});}return _0xbd28b9(null);});};exports[_0xefe0('0x15')]=function(_0x57aa14){return new BPromise(function(_0x21a10a,_0x23b6e7){if(_0x57aa14){return getUser({'interface':_0x57aa14})['then'](function(_0x29d619){logger['info'](_0xefe0('0x16'),_0x57aa14,_0x29d619?_0xefe0('0x12'):_0xefe0('0x13'));return _0x21a10a(_0x29d619);})[_0xefe0('0xb')](function(_0xdc1602){logger['error'](_0xefe0('0x17'),_0xdc1602?util[_0xefe0('0x5')](_0xdc1602,{'showHidden':![],'depth':null}):'');return _0x21a10a(null);});}return _0x21a10a(null);});};exports[_0xefe0('0x18')]=function(_0x2b1c50){return new BPromise(function(_0x8800a7,_0x166f25){if(_0x2b1c50){return getUser({'name':_0x2b1c50})[_0xefe0('0x9')](function(_0x5ef8bc){logger[_0xefe0('0x4')](_0xefe0('0x19'),_0x2b1c50,_0x5ef8bc?_0xefe0('0x12'):'notfound');return _0x8800a7(_0x5ef8bc);})[_0xefe0('0xb')](function(_0x2b3201){logger[_0xefe0('0x7')](_0xefe0('0x1a'),_0x2b3201?util[_0xefe0('0x5')](_0x2b3201,{'showHidden':![],'depth':null}):'');return _0x8800a7(null);});}return _0x8800a7(null);});};exports[_0xefe0('0x1b')]=function(_0x4b1e43){return new BPromise(function(_0x161007,_0x5cb42f){if(_0x4b1e43){return client[_0xefe0('0x8')](_0xefe0('0x1c'),{'options':{'raw':!![],'attributes':['id',_0xefe0('0xe'),_0xefe0('0x1d'),_0xefe0('0x1e'),_0xefe0('0x1f')],'where':{'name':_0x4b1e43},'limit':0x1}})[_0xefe0('0x9')](function(_0x135224){logger['debug'](_0xefe0('0x20'),_0x4b1e43,_0x135224?util['inspect'](_0x135224,{'showHidden':![],'depth':null}):'');logger[_0xefe0('0x4')](_0xefe0('0x21'),_0x4b1e43,_0x135224?_0xefe0('0x12'):'notfound');return _0x161007(_0x135224[_0xefe0('0x10')][_0xefe0('0x22')]?_0x135224[_0xefe0('0x10')][0x0]:null);})[_0xefe0('0xb')](function(_0x54c947){logger[_0xefe0('0x7')](_0xefe0('0x23'),_0x54c947?util[_0xefe0('0x5')](_0x54c947,{'showHidden':![],'depth':null}):'');return _0x161007(null);});}return _0x161007(null);});};exports[_0xefe0('0x24')]=function(_0x232302,_0x356252){return moment(_0x232302)[_0xefe0('0x25')](_0x356252,_0xefe0('0x26'))['format'](_0xefe0('0x27'));};exports[_0xefe0('0x28')]=function(_0x5c24db,_0x20783c){return moment(_0x5c24db)[_0xefe0('0x29')](_0x20783c,_0xefe0('0x26'))[_0xefe0('0x2a')](_0xefe0('0x27'));};exports['diffTime']=function(_0x173bc4,_0x1d9a24){return moment(_0x173bc4)['diff'](moment(_0x1d9a24),_0xefe0('0x26'));};exports[_0xefe0('0x2b')]=function(_0x598325,_0x233819){return parseInt(_0x598325,0xa)+parseInt(_0x233819,0xa);};exports[_0xefe0('0x2c')]=function(){return moment()[_0xefe0('0x2a')](_0xefe0('0x27'));};exports[_0xefe0('0x2d')]=function(_0x2b64f7,_0x2c73c3){if(_0x2c73c3){return moment(_0x2b64f7)['isAfter'](_0x2c73c3);}return!![];};exports['isBefore']=function(_0x4ac44d,_0x264cf){if(_0x264cf){return moment(_0x4ac44d)[_0xefe0('0x2e')](_0x264cf);}else if(_0x4ac44d){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 c676daf..2256e03 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 _0x649e=['path','util','./loggers','fileLogger','./safe-template','maskSensitiveData','join','/var','log','client','role','ensureDir','catch','user','then','data','timestamp','error','api','auth','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','name','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','url','statusCode','responseTime','other','agent_name','test','lodash','express-winston'];(function(_0xcf6a9f,_0x227256){var _0x588a34=function(_0x3e415a){while(--_0x3e415a){_0xcf6a9f['push'](_0xcf6a9f['shift']());}};_0x588a34(++_0x227256);}(_0x649e,0xba));var _0xe649=function(_0x404c58,_0x3ba0e3){_0x404c58=_0x404c58-0x0;var _0x3a8c20=_0x649e[_0x404c58];return _0x3a8c20;};var fs=require('fs-extra');var _=require(_0xe649('0x0'));var ewinston=require(_0xe649('0x1'));var path=require(_0xe649('0x2'));var util=require(_0xe649('0x3'));var fileLogger=require(_0xe649('0x4'))[_0xe649('0x5')];var safeTemplate=require(_0xe649('0x6'))['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')[_0xe649('0x7')];function ClientSideLogger(){function _0x2ac702(_0x189591){var _0x2aef18=path[_0xe649('0x8')](_0xe649('0x9'),_0xe649('0xa'),'xcally');var _0x3343a2=path['join'](_0xe649('0xb'),_0x189591[_0xe649('0xc')]+'-'+_0x189591['name']);return fs[_0xe649('0xd')](path['join'](_0x2aef18,_0x3343a2))['then'](function(){var _0x558bbe=fileLogger(_0xe649('0xb'),path[_0xe649('0x8')](_0x2aef18,_0x3343a2));return _0x558bbe;})[_0xe649('0xe')](function(_0x1d5378){throw _0x1d5378;});}this[_0xe649('0xa')]=function(_0x43c243,_0x2c4e60,_0x5dea07,_0x3d6041){return _0x2ac702(_0x43c243[_0xe649('0xf')])[_0xe649('0x10')](function(_0x3a3925){var _0x312f1d=_0x3a3925[_0x2c4e60];return _0x312f1d;})[_0xe649('0x10')](function(_0x2c7a0d){var _0x202d0e=_0x43c243[_0xe649('0xf')]?_0x43c243['user']['id']:'no-user';var _0x4b8719=_0x3d6041[_0xe649('0x11')];var _0x368a77=_0x3d6041[_0xe649('0x12')];var _0x4347e6=new Date(Number(_0x368a77));return _0x2c7a0d(_0x202d0e,_0x4347e6,_0x5dea07,_0x4b8719);})[_0xe649('0xe')](function(_0x27e076){fileLogger(_0xe649('0xb'))[_0xe649('0x13')](_0x27e076);});};}function setupLoggers(_0x4c8351){return new Promise(function(_0x5c3292){var _0x8878e2=new ClientSideLogger();var _0x39d8a3=fileLogger(_0xe649('0x14'));var _0x626f48=fileLogger(_0xe649('0x15'));_0x4c8351[_0xe649('0x16')](_0xe649('0x17'),_0x8878e2);_0x4c8351[_0xe649('0x18')](ewinston['logger']({'winstonInstance':_0x39d8a3,'meta':![],'statusLevels':!![],'msg':function(_0x4a8570,_0x3251d1){var _0x5ff852=_0xe649('0x19');if(!_['isEmpty'](_0x4a8570[_0xe649('0x1a')])){_0x5ff852+=_0xe649('0x1b');var _0x1a1e17=_0x4a8570[_0xe649('0x1a')];maskSensitiveData(_0x1a1e17);}return safeTemplate(util[_0xe649('0x1c')](_0x5ff852,_0x4a8570[_0xe649('0x1d')],_0x4a8570[_0xe649('0x1e')][_0xe649('0x1f')]?_0x4a8570['headers'][_0xe649('0x1f')]:_0x4a8570[_0xe649('0x20')][_0xe649('0x21')]||_0x4a8570['ip'],_0x4a8570['url'],_0x3251d1['statusCode'],_0x3251d1['responseTime'],_0x4a8570['user']?_0x4a8570[_0xe649('0xf')]['id']:null,_0x4a8570[_0xe649('0xf')]?_0x4a8570['user'][_0xe649('0x22')]:null,_0x4a8570[_0xe649('0xf')]?_0x4a8570[_0xe649('0xf')]['role']:null,_0x1a1e17?util[_0xe649('0x23')](_0x1a1e17,![],null):''));}}));_0x4c8351[_0xe649('0x18')](ewinston[_0xe649('0x24')]({'winstonInstance':_0x626f48,'meta':![],'statusLevels':!![],'msg':function(_0x36f7d9,_0x3ccf06){var _0x4cbb7d=_0xe649('0x25');if(_0x36f7d9[_0xe649('0x1a')]&&_0x36f7d9['body'][_0xe649('0x26')]&&_0x36f7d9[_0xe649('0x1a')][_0xe649('0x27')]){_0x4cbb7d=_0xe649('0x28');}return util[_0xe649('0x1c')](_0x4cbb7d,_0x36f7d9[_0xe649('0x1d')],_0x36f7d9[_0xe649('0x1e')][_0xe649('0x1f')]?_0x36f7d9[_0xe649('0x1e')][_0xe649('0x1f')]:_0x36f7d9[_0xe649('0x20')][_0xe649('0x21')]||_0x36f7d9['ip'],_0x36f7d9[_0xe649('0x29')],_0x3ccf06[_0xe649('0x2a')],_0x3ccf06[_0xe649('0x2b')],_0x36f7d9[_0xe649('0xf')]?_0x36f7d9['user']['id']:null,_0x36f7d9['user']?_0x36f7d9[_0xe649('0xf')][_0xe649('0x22')]:null,_0x36f7d9['user']?_0x36f7d9['user'][_0xe649('0xc')]:null,_0x36f7d9[_0xe649('0x1a')]&&_0x36f7d9[_0xe649('0x1a')][_0xe649('0x26')]?_0x36f7d9[_0xe649('0x1a')][_0xe649('0x26')]:_0xe649('0x2c'),_0x36f7d9[_0xe649('0x1a')]&&_0x36f7d9[_0xe649('0x1a')][_0xe649('0x27')]?_0x36f7d9[_0xe649('0x1a')][_0xe649('0x27')]:'',_0x36f7d9[_0xe649('0x1a')]&&_0x36f7d9[_0xe649('0x1a')][_0xe649('0x2d')]?_0x36f7d9['body'][_0xe649('0x2d')]:'');},'ignoreRoute':function(_0x55e2d7){var _0x2abd69=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2abd69[_0xe649('0x2e')](_0x55e2d7[_0xe649('0x29')]);}}));return _0x5c3292();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0xbbef=['agent_name','test','setupLoggers','fs-extra','path','util','./loggers','fileLogger','./safe-template','safeTemplate','maskSensitiveData','join','/var','log','client','role','name','ensureDir','catch','user','then','data','timestamp','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','headers','x-forwarded-for','connection','remoteAddress','responseTime','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','method','url','statusCode','other'];(function(_0x39617d,_0xaa5342){var _0x2809e1=function(_0x231a1b){while(--_0x231a1b){_0x39617d['push'](_0x39617d['shift']());}};_0x2809e1(++_0xaa5342);}(_0xbbef,0x1c5));var _0xfbbe=function(_0x266b8f,_0x41b527){_0x266b8f=_0x266b8f-0x0;var _0x59482e=_0xbbef[_0x266b8f];return _0x59482e;};var fs=require(_0xfbbe('0x0'));var _=require('lodash');var ewinston=require('express-winston');var path=require(_0xfbbe('0x1'));var util=require(_0xfbbe('0x2'));var fileLogger=require(_0xfbbe('0x3'))[_0xfbbe('0x4')];var safeTemplate=require(_0xfbbe('0x5'))[_0xfbbe('0x6')];var maskSensitiveData=require('./mask-sensitive-data')[_0xfbbe('0x7')];function ClientSideLogger(){function _0x2a870b(_0x4c8001){var _0x65d15f=path[_0xfbbe('0x8')](_0xfbbe('0x9'),_0xfbbe('0xa'),'xcally');var _0x153c26=path['join'](_0xfbbe('0xb'),_0x4c8001[_0xfbbe('0xc')]+'-'+_0x4c8001[_0xfbbe('0xd')]);return fs[_0xfbbe('0xe')](path[_0xfbbe('0x8')](_0x65d15f,_0x153c26))['then'](function(){var _0x2c43b1=fileLogger(_0xfbbe('0xb'),path[_0xfbbe('0x8')](_0x65d15f,_0x153c26));return _0x2c43b1;})[_0xfbbe('0xf')](function(_0x271ae5){throw _0x271ae5;});}this[_0xfbbe('0xa')]=function(_0x44b30a,_0x1283d4,_0x6e883a,_0x56d9fe){return _0x2a870b(_0x44b30a[_0xfbbe('0x10')])[_0xfbbe('0x11')](function(_0x3a856e){var _0x5cd3ea=_0x3a856e[_0x1283d4];return _0x5cd3ea;})[_0xfbbe('0x11')](function(_0x44179d){var _0x3e8173=_0x44b30a['user']?_0x44b30a['user']['id']:'no-user';var _0x164a64=_0x56d9fe[_0xfbbe('0x12')];var _0xc6ecfe=_0x56d9fe[_0xfbbe('0x13')];var _0x39d8db=new Date(Number(_0xc6ecfe));return _0x44179d(_0x3e8173,_0x39d8db,_0x6e883a,_0x164a64);})[_0xfbbe('0xf')](function(_0x347419){fileLogger(_0xfbbe('0xb'))['error'](_0x347419);});};}function setupLoggers(_0x7d4f73){return new Promise(function(_0x4e7553){var _0x376cf4=new ClientSideLogger();var _0x5f5cf4=fileLogger(_0xfbbe('0x14'));var _0x4df391=fileLogger(_0xfbbe('0x15'));_0x7d4f73[_0xfbbe('0x16')](_0xfbbe('0x17'),_0x376cf4);_0x7d4f73[_0xfbbe('0x18')](ewinston[_0xfbbe('0x19')]({'winstonInstance':_0x5f5cf4,'meta':![],'statusLevels':!![],'msg':function(_0x3e2d52,_0x2e5e08){var _0x19cb5a=_0xfbbe('0x1a');if(!_[_0xfbbe('0x1b')](_0x3e2d52[_0xfbbe('0x1c')])){_0x19cb5a+='\x20body=%s';var _0x3337bd=_0x3e2d52[_0xfbbe('0x1c')];maskSensitiveData(_0x3337bd);}return safeTemplate(util[_0xfbbe('0x1d')](_0x19cb5a,_0x3e2d52['method'],_0x3e2d52[_0xfbbe('0x1e')][_0xfbbe('0x1f')]?_0x3e2d52[_0xfbbe('0x1e')][_0xfbbe('0x1f')]:_0x3e2d52[_0xfbbe('0x20')][_0xfbbe('0x21')]||_0x3e2d52['ip'],_0x3e2d52['url'],_0x2e5e08['statusCode'],_0x2e5e08[_0xfbbe('0x22')],_0x3e2d52['user']?_0x3e2d52[_0xfbbe('0x10')]['id']:null,_0x3e2d52[_0xfbbe('0x10')]?_0x3e2d52[_0xfbbe('0x10')][_0xfbbe('0xd')]:null,_0x3e2d52[_0xfbbe('0x10')]?_0x3e2d52['user']['role']:null,_0x3337bd?util['inspect'](_0x3337bd,![],null):''));}}));_0x7d4f73['use'](ewinston['logger']({'winstonInstance':_0x4df391,'meta':![],'statusLevels':!![],'msg':function(_0x4c7ad7,_0x4c3293){var _0x81ae11=_0xfbbe('0x23');if(_0x4c7ad7[_0xfbbe('0x1c')]&&_0x4c7ad7[_0xfbbe('0x1c')][_0xfbbe('0x24')]&&_0x4c7ad7[_0xfbbe('0x1c')][_0xfbbe('0x25')]){_0x81ae11='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x81ae11,_0x4c7ad7[_0xfbbe('0x26')],_0x4c7ad7[_0xfbbe('0x1e')][_0xfbbe('0x1f')]?_0x4c7ad7[_0xfbbe('0x1e')][_0xfbbe('0x1f')]:_0x4c7ad7[_0xfbbe('0x20')][_0xfbbe('0x21')]||_0x4c7ad7['ip'],_0x4c7ad7[_0xfbbe('0x27')],_0x4c3293[_0xfbbe('0x28')],_0x4c3293['responseTime'],_0x4c7ad7[_0xfbbe('0x10')]?_0x4c7ad7[_0xfbbe('0x10')]['id']:null,_0x4c7ad7[_0xfbbe('0x10')]?_0x4c7ad7[_0xfbbe('0x10')][_0xfbbe('0xd')]:null,_0x4c7ad7[_0xfbbe('0x10')]?_0x4c7ad7[_0xfbbe('0x10')]['role']:null,_0x4c7ad7[_0xfbbe('0x1c')]&&_0x4c7ad7[_0xfbbe('0x1c')][_0xfbbe('0x24')]?_0x4c7ad7[_0xfbbe('0x1c')][_0xfbbe('0x24')]:_0xfbbe('0x29'),_0x4c7ad7[_0xfbbe('0x1c')]&&_0x4c7ad7[_0xfbbe('0x1c')][_0xfbbe('0x25')]?_0x4c7ad7[_0xfbbe('0x1c')][_0xfbbe('0x25')]:'',_0x4c7ad7['body']&&_0x4c7ad7[_0xfbbe('0x1c')][_0xfbbe('0x2a')]?_0x4c7ad7[_0xfbbe('0x1c')][_0xfbbe('0x2a')]:'');},'ignoreRoute':function(_0x24dee1){var _0x364200=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x364200[_0xfbbe('0x2b')](_0x24dee1['url']);}}));return _0x4e7553();});}exports[_0xfbbe('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index afc468d..13446a3 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f78=['redBG\x20white','red','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','message','replace','}}}','format','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','{{{','meta','keys','length','stringify','level','Logger','transports','Console','File','error','warn','consoleLogger','fileLogger','moment','winston','../config/environment','debugLevel','info'];(function(_0x2e971c,_0x47111f){var _0x4a599f=function(_0x25a62e){while(--_0x25a62e){_0x2e971c['push'](_0x2e971c['shift']());}};_0x4a599f(++_0x47111f);}(_0x7f78,0x11b));var _0x87f7=function(_0x3cb88b,_0x408083){_0x3cb88b=_0x3cb88b-0x0;var _0x1c12f8=_0x7f78[_0x3cb88b];return _0x1c12f8;};'use strict';var path=require('path');var util=require('util');var moment=require(_0x87f7('0x0'));var winston=require(_0x87f7('0x1'));var config=require(_0x87f7('0x2'));var debugLevel=config[_0x87f7('0x3')]?config[_0x87f7('0x3')]['toLowerCase']():_0x87f7('0x4');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x87f7('0x5'),'error':_0x87f7('0x6'),'warn':'bold\x20yellow','info':_0x87f7('0x7'),'print':_0x87f7('0x8'),'success':_0x87f7('0x9'),'http':'gray','verbose':_0x87f7('0xa'),'debug':_0x87f7('0xb'),'silly':_0x87f7('0xc')};winston[_0x87f7('0xd')](XC_LOG_COLORS);function getLogFileName(_0x179905,_0x1531b5,_0x3f15df){var _0x4349e4=_0x179905||_0x87f7('0xe');return path[_0x87f7('0xf')](_0x4349e4,util['format']('%s-%s.log',_0x1531b5,_0x3f15df));}function formatter(_0x4c42ea,_0xaef635){_0xaef635[_0x87f7('0x10')]=_0xaef635[_0x87f7('0x10')][_0x87f7('0x11')](/@@{/g,'{{{')[_0x87f7('0x11')](/}@@/g,_0x87f7('0x12'))[_0x87f7('0x11')](/@{/g,'{{')[_0x87f7('0x11')](/}@/g,'}}');return util[_0x87f7('0x13')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x87f7('0x13')](_0x87f7('0x14')),_0xaef635['level'][_0x87f7('0x15')](),_0x4c42ea,_0xaef635[_0x87f7('0x10')]);}function fileFormat(_0x364e8b,_0x21fcae){_0x21fcae[_0x87f7('0x10')]=_0x21fcae[_0x87f7('0x10')][_0x87f7('0x11')](/@@{/g,_0x87f7('0x16'))[_0x87f7('0x11')](/}@@/g,_0x87f7('0x12'))[_0x87f7('0x11')](/@{/g,'{{')[_0x87f7('0x11')](/}@/g,'}}');var _0x1cc8d5=_0x21fcae[_0x87f7('0x17')]&&Object[_0x87f7('0x18')](_0x21fcae[_0x87f7('0x17')])[_0x87f7('0x19')]?'\x0a\x09'+JSON[_0x87f7('0x1a')](_0x21fcae[_0x87f7('0x17')]):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format'](_0x87f7('0x14')),_0x21fcae[_0x87f7('0x1b')]['toUpperCase'](),_0x364e8b,_0x21fcae[_0x87f7('0x10')],_0x1cc8d5);}function consoleLogger(){var _0x2e048d=new winston[(_0x87f7('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x87f7('0x1d'))][(_0x87f7('0x1e'))]({'level':'warn','json':![],'formatter':function(_0x6a7e0c){return formatter('',_0x6a7e0c);}})]});return _0x2e048d;}function fileLogger(_0x2a88e0,_0x5d0c6d){var _0x564688=new winston[(_0x87f7('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x87f7('0x1d'))][(_0x87f7('0x1f'))]({'name':util[_0x87f7('0x13')]('%s-%s',_0x2a88e0,_0x87f7('0x20')),'filename':getLogFileName(_0x5d0c6d,_0x2a88e0,_0x87f7('0x20')),'level':_0x87f7('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2957c9){return fileFormat(_0x2a88e0,_0x2957c9);}}),new winston['transports'][(_0x87f7('0x1f'))]({'name':util[_0x87f7('0x13')]('%s-%s',_0x2a88e0,debugLevel),'filename':getLogFileName(_0x5d0c6d,_0x2a88e0,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5b221d){return fileFormat(_0x2a88e0,_0x5b221d);}}),new winston[(_0x87f7('0x1d'))]['Console']({'level':_0x87f7('0x21'),'json':![],'formatter':function(_0x42ae64){return fileFormat(_0x2a88e0,_0x42ae64);}})]});return _0x564688;}exports[_0x87f7('0x22')]=consoleLogger;exports[_0x87f7('0x23')]=fileLogger; \ No newline at end of file +var _0xd33d=['%s-%s','consoleLogger','fileLogger','path','util','winston','debugLevel','toLowerCase','redBG\x20white','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','format','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','stringify','level','Logger','transports','Console','warn','File','error'];(function(_0x1aae64,_0x48ca82){var _0x388767=function(_0x4d89ec){while(--_0x4d89ec){_0x1aae64['push'](_0x1aae64['shift']());}};_0x388767(++_0x48ca82);}(_0xd33d,0x19b));var _0xdd33=function(_0xba296b,_0x55e668){_0xba296b=_0xba296b-0x0;var _0x7428d2=_0xd33d[_0xba296b];return _0x7428d2;};'use strict';var path=require(_0xdd33('0x0'));var util=require(_0xdd33('0x1'));var moment=require('moment');var winston=require(_0xdd33('0x2'));var config=require('../config/environment');var debugLevel=config[_0xdd33('0x3')]?config[_0xdd33('0x3')][_0xdd33('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':_0xdd33('0x5'),'error':_0xdd33('0x6'),'warn':_0xdd33('0x7'),'info':'white','print':_0xdd33('0x8'),'success':_0xdd33('0x9'),'http':_0xdd33('0xa'),'verbose':_0xdd33('0xb'),'debug':_0xdd33('0xc'),'silly':_0xdd33('0xd')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x4e36ca,_0x4e5bed,_0x14a9bb){var _0x5e7682=_0x4e36ca||_0xdd33('0xe');return path['join'](_0x5e7682,util[_0xdd33('0xf')]('%s-%s.log',_0x4e5bed,_0x14a9bb));}function formatter(_0x19fae3,_0x595576){_0x595576[_0xdd33('0x10')]=_0x595576[_0xdd33('0x10')][_0xdd33('0x11')](/@@{/g,_0xdd33('0x12'))[_0xdd33('0x11')](/}@@/g,_0xdd33('0x13'))[_0xdd33('0x11')](/@{/g,'{{')[_0xdd33('0x11')](/}@/g,'}}');return util[_0xdd33('0xf')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xdd33('0xf')](_0xdd33('0x14')),_0x595576['level'][_0xdd33('0x15')](),_0x19fae3,_0x595576[_0xdd33('0x10')]);}function fileFormat(_0x44c395,_0x48f493){_0x48f493['message']=_0x48f493[_0xdd33('0x10')]['replace'](/@@{/g,'{{{')['replace'](/}@@/g,_0xdd33('0x13'))[_0xdd33('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x634240=_0x48f493[_0xdd33('0x16')]&&Object['keys'](_0x48f493[_0xdd33('0x16')])['length']?'\x0a\x09'+JSON[_0xdd33('0x17')](_0x48f493[_0xdd33('0x16')]):'';return util[_0xdd33('0xf')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format'](_0xdd33('0x14')),_0x48f493[_0xdd33('0x18')][_0xdd33('0x15')](),_0x44c395,_0x48f493[_0xdd33('0x10')],_0x634240);}function consoleLogger(){var _0x5aa669=new winston[(_0xdd33('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xdd33('0x1a'))][(_0xdd33('0x1b'))]({'level':_0xdd33('0x1c'),'json':![],'formatter':function(_0x5bc371){return formatter('',_0x5bc371);}})]});return _0x5aa669;}function fileLogger(_0x3c5e6d,_0x2d0153){var _0x5998c0=new winston[(_0xdd33('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xdd33('0x1a'))][(_0xdd33('0x1d'))]({'name':util[_0xdd33('0xf')]('%s-%s',_0x3c5e6d,_0xdd33('0x1e')),'filename':getLogFileName(_0x2d0153,_0x3c5e6d,_0xdd33('0x1e')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4b6ded){return fileFormat(_0x3c5e6d,_0x4b6ded);}}),new winston[(_0xdd33('0x1a'))][(_0xdd33('0x1d'))]({'name':util[_0xdd33('0xf')](_0xdd33('0x1f'),_0x3c5e6d,debugLevel),'filename':getLogFileName(_0x2d0153,_0x3c5e6d,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4efc39){return fileFormat(_0x3c5e6d,_0x4efc39);}}),new winston[(_0xdd33('0x1a'))][(_0xdd33('0x1b'))]({'level':'warn','json':![],'formatter':function(_0x17a736){return fileFormat(_0x3c5e6d,_0x17a736);}})]});return _0x5998c0;}exports[_0xdd33('0x20')]=consoleLogger;exports[_0xdd33('0x21')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 06564bb..d3508eb 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x1440ee,_0xadc9d3){var _0x202804=function(_0x93cba1){while(--_0x93cba1){_0x1440ee['push'](_0x1440ee['shift']());}};_0x202804(++_0xadc9d3);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3ce937,_0x568d7d){_0x3ce937=_0x3ce937-0x0;var _0x41d2fa=_0x0b0e[_0x3ce937];return _0x41d2fa;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x0295,0x1f0));var _0x5029=function(_0x1e9d6a,_0x3e5cab){_0x1e9d6a=_0x1e9d6a-0x0;var _0x222bd1=_0x0295[_0x1e9d6a];return _0x222bd1;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index a7c78f5..24e1bed 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 _0xb03e=['safeTemplate','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','exports'];(function(_0x63b821,_0x2892c9){var _0x18766d=function(_0x3a01db){while(--_0x3a01db){_0x63b821['push'](_0x63b821['shift']());}};_0x18766d(++_0x2892c9);}(_0xb03e,0x1eb));var _0xeb03=function(_0x461220,_0x3fce36){_0x461220=_0x461220-0x0;var _0x19c8ca=_0xb03e[_0x461220];return _0x19c8ca;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x36351b){return _0x36351b==='{{'?_0xeb03('0x0'):_0xeb03('0x1');}function safeTemplate(_0x3c5e68){var _0x1c58b5=_0x3c5e68;if(typeof _0x3c5e68===_0xeb03('0x2')){_0x1c58b5=_0x3c5e68[_0xeb03('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xeb03('0x4')](_0x3c5e68)){_0x1c58b5=_0x3c5e68[_0xeb03('0x5')](function(_0x3ba4b0){return safeTemplate(_0x3ba4b0);});}else if(_[_0xeb03('0x6')](_0x3c5e68)){_0x1c58b5=Object[_0xeb03('0x7')](_0x3c5e68)['reduce'](function(_0x3b58a2,_0x3d3322){_0x3b58a2[_0x3d3322]=safeTemplate(_0x3c5e68[_0x3d3322]);return _0x3b58a2;},{});}return _0x1c58b5;}module[_0xeb03('0x8')][_0xeb03('0x9')]=safeTemplate; \ No newline at end of file +var _0x1a85=['{\x20{\x20','\x20}\x20}','replace','isArray','map','isPlainObject','reduce','exports'];(function(_0x171230,_0x1f2c49){var _0x68b3e4=function(_0x1e288d){while(--_0x1e288d){_0x171230['push'](_0x171230['shift']());}};_0x68b3e4(++_0x1f2c49);}(_0x1a85,0x178));var _0x51a8=function(_0x48fff1,_0x50c537){_0x48fff1=_0x48fff1-0x0;var _0x127a1d=_0x1a85[_0x48fff1];return _0x127a1d;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x54a0db){return _0x54a0db==='{{'?_0x51a8('0x0'):_0x51a8('0x1');}function safeTemplate(_0x43e22a){var _0x498466=_0x43e22a;if(typeof _0x43e22a==='string'){_0x498466=_0x43e22a[_0x51a8('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x51a8('0x3')](_0x43e22a)){_0x498466=_0x43e22a[_0x51a8('0x4')](function(_0x48a21b){return safeTemplate(_0x48a21b);});}else if(_[_0x51a8('0x5')](_0x43e22a)){_0x498466=Object['keys'](_0x43e22a)[_0x51a8('0x6')](function(_0x5cf430,_0x331117){_0x5cf430[_0x331117]=safeTemplate(_0x43e22a[_0x331117]);return _0x5cf430;},{});}return _0x498466;}module[_0x51a8('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file